LogonUser 有一些限制,在Windows NT and Windows 2000, 调用LogonUser的进程必须有SE_TCB_NAME 权限 (在User Manager中, 这是"Act as part of the Operating System" 权限)。请问上面所提的权限在哪里设置,我尝试在 程序->管理工具->计算机管理->本地用户和->用户  里找但没有找到,请高手指点,谢谢请高手帮忙,这个函数我周围没有用过,直接调用logonUser会提示'客户没有所需的特权'

解决方案 »

  1.   

    logonUser api 函数是用过验证用户的
    我现在是想通过程序从客户端访问服务器上的共享文件夹中的文件,从csdn上查了一些资料,最后知道是用logonUser这个api函数,但是调用这个api函数,需要有SE_TCB_NAME个权限,而我不知道在哪里给用户授予这个权限对不起我上面没有说清楚
      

  2.   

    这个我研究过,可惜没有成功,下面是转贴:
    如果是机器的网络密码(如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;
      

  3.   

    win2000 server
    管理工具-本地安全策略-本地策略-用户权利指派
      

  4.   

    to 楼上,SE_TCB_NAME 在管理工具-本地安全策略-本地策略-用户权利指派这里也没有找到呀,中文权限名是什么?
    谢谢
      

  5.   

    to 楼上太感谢你了我现在把这个权限指给administrator了,也重新启动了,但是logonUser还是返回false,
    syserrorMessage(getLastError)提示‘客户没有所需的特权'
    源代码如下:
      if LogonUser('administrator' , '.' , 'aaa', LOGON32_LOGON_INTERACTIVE ,      LOGON32_PROVIDER_DEFAULT , handle) = true then  
      begin
        ShowMessage('创建用户成功');
      end
      else
      begin
       ShowMessage(SysErrorMessage(GetLastError()));//提示‘客户没有所需的特权'
      end;这是为什么?谢谢
      

  6.   

    "以操作系统方式操作"
    =====================================================比如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;=========================================================
    我的机器显示成功的
      

  7.   

    那是为什么呢?我增加这个权限后,发现administrator的本策略设置为enabled,但有效策略设置项目为disabled,而且无法使它变成enabled的,与这个有关吗,我看帮助是这样写的
    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. 应该是没有关吧
      

  8.   

    我添加Admin之外的用户都显示后面一项无效,比如隶属Administrators的某用户,everyone等,这个我也不知道了,要不到系统那边去问问吧
      

  9.   

    本地用户,win2000 server,sp4,诺顿,
      

  10.   

    我感觉好象应该和delphi版本没有关系是windows的事
      

  11.   

    The 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.这句话是什么意思?
      

  12.   

    上面这句话是指有效策略选项不必enabled吗?