HanDs
NO.2

[Visual Studio文章] WinXP/2k数字签名状态设置 





学习中请遵循国家相关法律法规,黑客不作恶。没有网络安全就没有国家安全

本站需要登陆后才能查看

DWORD WINAPI SetDriverSign()
{
    HKEY    hReg;
    DWORD    dwLen;
    DWORD    dwSeed;
    DWORD    hProv;
    DWORD    hHash;
    DWORD    dwData;
    BYTE    bHash[16];

    if(RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SYSTEM\\WPA\\PnP",0,KEY_READ,&hReg) == ERROR_SUCCESS)
    {
        dwLen = 4;
        RegQueryValueExA(hReg,"seed",0,0,(LPBYTE)&dwSeed,&dwLen);
        RegCloseKey(hReg);

        CryptAcquireContext(&hProv,0,0,PROV_RSA_FULL,CRYPT_VERIFYCONTEXT);
        CryptCreateHash(hProv,0x8003,0,0,&hHash);

        dwData = 0;
        CryptHashData(hHash,(BYTE *)&dwData,4,0);
        CryptHashData(hHash,(BYTE *)&dwSeed,4,0);

        dwLen = 16;
        CryptGetHashParam(hHash,HP_HASHVAL,&bHash[0],&dwLen,0);

        CryptDestroyHash(hHash);
        CryptReleaseContext(hProv,0);

        //    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup    PrivateHash    BIN MD5
        //    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Driver Signing        Policy        BIN        0
        //    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Non-Driver Signing    Policy        BIN        0
        //    HKEY_CURRENT_USER\Software\Microsoft\Driver Signing            Policy        DWORD    0
        lpParameter = 0;
        RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Driver Signing",0,KEY_WRITE,&hReg);
        RegSetValueExA(hReg,"Policy",0,REG_BINARY,(BYTE *)&dwData,1);
        RegCloseKey(hReg);
        RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Non-Driver Signing",0,KEY_WRITE,&hReg);
        RegSetValueExA(hReg,"Policy",0,REG_BINARY,(BYTE *)&dwData,1);
        RegCloseKey(hReg);
        RegOpenKeyExA(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Driver Signing",0,KEY_WRITE,&hReg);
        RegSetValueExA(hReg,"Policy",0,REG_BINARY,(BYTE *)&dwData,1);
        RegCloseKey(hReg);

        RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup",0,KEY_WRITE,&hReg);
        RegSetValueExA(hReg,"PrivateHash",0,REG_BINARY,&bHash[0],16);
        RegCloseKey(hReg);

    }

    return 0;
}


以上代码执行后WinXP/2003中硬件驱动数字签名状态被设置为忽略。


学习中请遵守法律法规,本网站内容均来自于互联网,本网站不负担法律责任
WinXP/2k 数字签名状态设置
#1楼
发帖时间:2016-7-9   |   查看数:0   |   回复数:0
游客组