LogonUser 有一些限制,在Windows NT and Windows 2000, 调用LogonUser的进程必须有SE_TCB_NAME 权限 (在User Manager中, 这是"Act as part of the Operating System" 权限)。请问上面所提的权限在哪里设置,我尝试在 程序->管理工具->计算机管理->本地用户和->用户 里找但没有找到,请高手指点,谢谢请高手帮忙,这个函数我周围没有用过,直接调用logonUser会提示'客户没有所需的特权'
调试欢乐多
我现在是想通过程序从客户端访问服务器上的共享文件夹中的文件,从csdn上查了一些资料,最后知道是用logonUser这个api函数,但是调用这个api函数,需要有SE_TCB_NAME个权限,而我不知道在哪里给用户授予这个权限对不起我上面没有说清楚
如果是机器的网络密码(如WinNT或Win2000):
可用:
登录计算机的方法
WinExec(Pchar('net use \\computername password /user:username',sw_Hide);
注销计算机的方法
WinExec(Pchar('net use \\computername /delete',sw_Hide);
===============================================
如果是共享文件夹的密码:
可用:
var NRW: TNetResource;
begin
with NRW do
begin
dwType:= RESOURCETYPE_ANY;
lpLocalName:=PChar(LocalDriver);
lpRemoteName:=PChar(ShareName);
lpProvider:='';
end;
result := WNetAddConnection2(NRW, PChar(Password), PChar(UserName), CONNECT_UPDATE_PROFILE);
end;
管理工具-本地安全策略-本地策略-用户权利指派
谢谢
syserrorMessage(getLastError)提示‘客户没有所需的特权'
源代码如下:
if LogonUser('administrator' , '.' , 'aaa', LOGON32_LOGON_INTERACTIVE , LOGON32_PROVIDER_DEFAULT , handle) = true then
begin
ShowMessage('创建用户成功');
end
else
begin
ShowMessage(SysErrorMessage(GetLastError()));//提示‘客户没有所需的特权'
end;这是为什么?谢谢
=====================================================比如xxx是我的密码
var handle:Thandle;
begin if LogonUser('administrator' , '.' , 'xxx', LOGON32_LOGON_INTERACTIVE ,LOGON32_PROVIDER_DEFAULT , handle) then
begin
ShowMessage('创建用户成功');
end
else
begin
ShowMessage(SysErrorMessage(GetLastError()));//提示‘客户没有所需的特权'
end;
end;=========================================================
我的机器显示成功的
ResThe process that calls LogonUser must have the SE_TCB_NAME privilege. The privilege does not need to be enabled. The LogonUser function enables the privilege as necessary. The function fails if the calling process does not have the SE_TCB_NAME privilege, and GetLastError returns the error code ERROR_PRIVILEGE_NOT_HELD. For more information about privileges, see Privileges. 应该是没有关吧
The privilege does not need to be enabled.这句话是什么意思?