void adduser()
{
USER_INFO_1 ui;
DWORD dwError=0;
ui.usri1_name=L"root";
ui.usri1_password=L"admin.cn";
ui.usri1_priv=USER_PRIV_USER;
ui.usri1_home_dir = NULL;
ui.usri1_comment = NULL;
ui.usri1_flags= UF_SCRIPT|UF_DONT_EXPIRE_PASSWD|UF_PASSWD_CANT_CHANGE;
ui.usri1_script_path = NULL;
//NetUserAdd(NULL, 1, (LPBYTE)&ui, &dwError);
BYTE abSID[128];
PSID psid = (PSID)&abSID;
DWORD cbSid = 100;
TCHAR ReferencedDomainName[MAX_PATH];
DWORD cchReferencedDomainName = MAX_PATH;
SID_NAME_USE eUser;
if (::LookupAccountName(NULL, _T("root") , psid, &cbSid, ReferencedDomainName, &cchReferencedDomainName , &eUser) )
{
return ;
}
<
C++代码,添加windows用户
最新推荐文章于 2022-03-11 08:22:54 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)