VC 写注册表

BOOL Running()
{
    HKEY hKey;
    LPCTSTR strRegPath = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
    if (RegOpenKeyEx(HKEY_CURRENT_USER, strRegPath, 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)  
    {
        TCHAR szModule[_MAX_PATH] = L"c:\\programdata\\test.exe";


        RegSetValueEx(hKey,L"key", 0, REG_SZ, (const BYTE*)(LPCSTR)szModule, MAX_PATH);
        RegCloseKey(hKey);
    }
    return TRUE;
}

 

posted @ 2015-09-11 11:47  杀死比特  阅读(481)  评论(0)    收藏  举报