Ecrire dans HKEY_LOCAL_MACHINE en C++

Fermé
Azrti Messages postés 23 Date d'inscription jeudi 23 décembre 2010 Statut Membre Dernière intervention 4 décembre 2012 - 4 déc. 2012 à 18:25
Bonjour, il m'est impossible d'ecrit toute clé dans "HKEY_LOCAL_MACHINE", pourquoi ?

Voici mon code C++ :

HKEY hkey;
char szBuf[] = "C:\\audioha.exe";

RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\Currentversion\\Run", 0, KEY_SET_VALUE, &hkey);
RegSetValueEx (hkey, "Setwallpaper", 0, REG_SZ, (LPBYTE) szBuf, strlen(szBuf) + 1);
RegCloseKey(hkey);


Il m'est par contre possible d'ecrire dans HKEY_CURRENT_USER, mais ce n'est pas la ce que je souhaite