Salve ragazzi, qualcuno potrebbe dirmi cosa c'è di sbagliato in questo codice?
Apparentemente il compilatore non da errori... ma di sicuro qualcosa sbaglio, perchè nel registro la chiave non appare!
codice:
#include <Windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){
HKEY key;
DWORD error;
LONG result;
BYTE word[100] = "C:\\Users\\Salvatore\\Desktop\\\0\0";
result = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "Microsoft\\Windows\\CurrentVersion\\Run\\", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, NULL);
error = GetLastError();
result = RegSetValueEx(key, "Client", 0, REG_SZ, word, sizeof(word)+1);
error = GetLastError();
RegCloseKey(key);
return 0;
}
Il primo result restituisce 6, il secondo 87 ...