如何启用Guest账户?
本帖最后由 deodar2006 于 2011-06-07 18:50:23 编辑 通过API NetUserSetInfo 可以设置账户的一些情况,其中一些参数可以实现对账户的停用,但不知道怎么可以启用?谢谢
nStatus = NetUserSetInfo(NULL, L"Guest", 1008, (LPBYTE)&usrname, NULL);
这个问题好像很小白哦~
[最优解释]
ui.usri1008_flags = UF_SCRIPT
[其他解释]
#ifndef UNICODE
#define UNICODE
#endif
#include <stdio.h>
#include <windows.h>
#include <lm.h>
int wmain(int argc, wchar_t *argv[])
{
DWORD dwLevel = 1008;
USER_INFO_1008 ui;
NET_API_STATUS nStatus;
if (argc != 3)
{
fwprintf(stderr, L"Usage: %s \\\\ServerName UserName\n", argv[0]);
exit(1);
}
// Fill in the USER_INFO_1008 structure member.
// UF_SCRIPT: required for LAN Manager 2.0 and
// Windows NT and later.
//
ui.usri1008_flags = UF_SCRIPT
[其他解释]
UF_ACCOUNTDISABLE;
//
// Call the NetUserSetInfo function
// to disable the account, specifying level 1008.
//
nStatus = NetUserSetInfo(argv[1],
argv[2],
dwLevel,
(LPBYTE)&ui,
NULL);
//
// Display the result of the call.
//
if (nStatus == NERR_Success)
fwprintf(stderr, L"User account %s has been disabled\n", argv[2]);
else
fprintf(stderr, "A system error has occurred: %d\n", nStatus);
return 0;
}
[其他解释]
UF_ACCOUNTDISABLE;
把UF_ACCOUNTDISABLE去掉,在调用NetUserSetInfo试试
[其他解释]
呵呵 楼主想干嘛
[其他解释]
net user guest /active
需要管理员权限..
[其他解释]
可以用修改注册表的方式
------其他解决方案--------------------
目前仍无解,排除cmd命令行方式及修改注册表的方法
利用 NetUserSetInfo 或者其它的API不可以实现吗?
[其他解释]
大虾在哪里?问题还是没有解决