找回密码
 加入
搜索
查看: 1381|回复: 2

[系统综合] 【已解决】检测windows用户密码是否正确

[复制链接]
发表于 2019-12-11 22:37:29 | 显示全部楼层 |阅读模式
本帖最后由 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()
{
    HANDLE  hUser;
    char    szUserName[MAX_PATH] = "administrator";
    char    szPassWord[MAX_PATH] = "visualstudio";
     
    if(LogonUser(szUserName,".",szPassWord,LOGON32_LOGON_INTERACTIVE,LOGON32_PROVIDER_DEFAULT,&hUser))
    {
        cout<<"Windows用户密码正确!"<<endl;
    }
    else
    {
        cout<<"Windows用户或密码错误!"<<endl;
    }
}

评分

参与人数 1金钱 -20 收起 理由
afan -20

查看全部评分

发表于 2019-12-12 13:12:26 | 显示全部楼层
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] <> 0 Then
        MsgBox(0, '', 'Windows用户密码正确!')
Else
        MsgBox(0, '', 'Windows用户或密码错误!')
EndIf

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

发表于 2019-12-15 12:00:06 | 显示全部楼层
学习中         
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-24 06:29 , Processed in 0.079131 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表