Delphi集成Windows验证登录函数

该日志由 samool 发表于 2007-10-17 3:08 PM



The first and biggest of these restrictions is that on Windows NT and Windows 2000, the process that is calling LogonUser must have the SE_TCB_NAME privilege (in User Manager, this is the ""Act as part of the Operating System"" right). The SE_TCB_NAME privilege is very powerful and should not be granted to any arbitrary user just so that they can run an application that needs to validate credentials. The recommended method is to call LogonUser from a service that is running in the local system account, because the local system account already has the SE_TCB_NAME privilege.  

delphi代码
  1. function   VerifyWindowsUser(const   Machine,Username,Password:String):boolean;      
  2.   var   hToken:THandle;      
  3.   begin      
  4.     hToken:=0;      
  5.     Result:=LogonUser(PChar(UserName),PChar(Machine),PChar(Password),LOGON32_LOGON_INTERACTIVE,LOGON32_PROVIDER_DEFAULT,hToken);      
  6.     if(hToken<>0)then      
  7.       CloseHandle(hToken);      
  8.   end;     

 傻猫网络日志标签:    windows, 验证, 登录, 函数  tiffany jewelry  
网摘: Yahoo Baidu Google Bolaa 365Key Yesky Wozhai POCO ViVi YouNote Hexun Del.icio.us Yeeyoo igooi I2Key Cn3 Bytemen Furl Blinklist Blogmarks Technorati 分享到饭否
相关文章: (最多只显示5条记录)

Delphi常用的函数库 (浏览:2731, 评论:0)
汇编级超快字符串替换函数 (浏览:2720, 评论:0)
IsNumeric 判断字符串是否为数字 (浏览:2338, 评论:0)
WinExecAndWait32调用外部程序,等待外部程序运行完成 (浏览:2216, 评论:0)
侠客密码查看器 v4.1 Build 20071011 (浏览:1587, 评论:0)
发表评论:( 来了就留个脚印吧!你的参与是我最大的动力!)

    

(单击图片换张图片)