怎样用API函数登录WinNT
编号:QA000844
建立日期: 1999年4月21日 最后修改日期:2000年5月29日
所属类别:
yuzhq:
操作系统:Windows
工具:未知
问题:我想知道怎样用API函数登录WinNT,并通过它来利用NT上的资源,而不会弹出系统的对话框.
回答:
使用LogonUser函数
BOOL LogonUser(
LPTSTR lpszUsername, // string that specifies the user name
LPTSTR lpszDomain, // string that specifies the domain or
// server
LPTSTR lpszPassword, // string that specifies the password
DWORD dwLogonType, // specifies the type of logon operation
DWORD dwLogonProvider, // specifies the logon provider
PHANDLE phToken // pointer to variable to receive token
// handle
);
yi xue ming问:
这种方法似乎只能在NT机器上登录,有没有办法用APT函数实现从WIN98的机器上登录到NT的域呢?期待您的答复。
李海回答:
这个函数在Win9x下也可以使用。只不过在NT下,该函数在Security.dll中,而在Win9x下是在Secur32.dll中。参考:微软的Knowledge Base的文章:“Q180548 OWTO: Validate User Credentials on Microsoft WinNT and Win95”。
此问题由Leo Liu回答。
| |
|
|
| |
|
|