I've searched every thread in the board and hit MSDN for this for hours, but I still cannot solve my problem. I am aiming to create a registry key in the Run dir, or simply to make my program run each time on boot. To do this, I need to RegCreateKeyEx, then to RegSetValueEx, to set the value of this key, however none of this is working. This is the little I have so far :
Code:
HKEY HandleKey = NULL;
HKEY* HandleKey2 = NULL;
char *tryme = "C:\\Docs\\bsuv.exe";
RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0,
"REG_SZ", REG_OPTION_NON_VOLATILE, 0, NULL, HandleKey2,
NULL);
RegCloseKey(HandleKey);
RegSetValueEx(HandleKey, "BSUV", 0, REG_SZ, (BYTE*)tryme,
29);
As you see, it's a bunch of nothing. I tried many combinations, but I can't get the BYTE to work in RegSetValueEx, and the RegCreateKeyEx doesn't want to work. As well as that, I'm not using my handle to my key, HKEY HandleKey, but a pointer to it, HandleKey2... If anyone could enlighten me, I'd be very grateful.
Thanks,
Korhedron