【已解决】检测windows用户密码是否正确
本帖最后由 anythinging 于 2020-1-21 14:36 编辑我想检测windows用户的密码是否正确,请大神指点,谢谢!
在网上找了一段c的代码,不会改
#include <iostream.h>
#include <windows.h>
#pragma comment(lib,"user32.lib")
#pragma comment(lib,"Advapi32.lib")
void main()
{
HANDLEhUser;
char szUserName = "administrator";
char szPassWord = "visualstudio";
if(LogonUser(szUserName,".",szPassWord,LOGON32_LOGON_INTERACTIVE,LOGON32_PROVIDER_DEFAULT,&hUser))
{
cout<<"Windows用户密码正确!"<<endl;
}
else
{
cout<<"Windows用户或密码错误!"<<endl;
}
} Local $sUsername = 'administrator'
Local $sPassword = 'visualstudio'
Local $phToken = DllStructCreate("int")
Local $aRet = DllCall('advapi32.dll', 'bool', 'LogonUser', _
'str', $sUsername, _
'str', '.', _
'str', $sPassword, _
'dword', 2, _ ; LOGON32_LOGON_INTERACTIVE
'dword', 0, _ ; LOGON32_PROVIDER_DEFAULT
'ptr', DllStructGetPtr($phToken))
If Not @error And $aRet <> 0 Then
MsgBox(0, '', 'Windows用户密码正确!')
Else
MsgBox(0, '', 'Windows用户或密码错误!')
EndIf 学习中
页:
[1]