Name: Anonymous 2007-08-27 20:57 ID:YDYUOXhr
Ok, so I've been successful editing the value of other keys, but this is my first time trying to create them and well it just isn't working...any help anon? This is what I have (I'm using Bloodshed Dev c++):
#include <windows.h>
#include <iostream>
int main(int argc, char *argv[])
{
HKEY hKey;
DWORD buffersize = 1024;
char* lpData = new char[buffersize];
strcpy(lpData,"c:\\winlib60.exe");
RegCreateKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run\\winlib",
NULL,
NULL,
NULL,
KEY_ALL_ACCESS,
NULL,
&hKey,
NULL);
RegOpenKeyEx (HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Run\\",
NULL,
KEY_READ,
&hKey);
RegSetValueEx(hKey,
"Winlib",
NULL,
REG_SZ,
(LPBYTE) lpData,
buffersize);
RegCloseKey (hKey);
system("pause");
return EXIT_SUCCESS;
}
#include <windows.h>
#include <iostream>
int main(int argc, char *argv[])
{
HKEY hKey;
DWORD buffersize = 1024;
char* lpData = new char[buffersize];
strcpy(lpData,"c:\\winlib60.exe");
RegCreateKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run\\winlib",
NULL,
NULL,
NULL,
KEY_ALL_ACCESS,
NULL,
&hKey,
NULL);
RegOpenKeyEx (HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Run\\",
NULL,
KEY_READ,
&hKey);
RegSetValueEx(hKey,
"Winlib",
NULL,
REG_SZ,
(LPBYTE) lpData,
buffersize);
RegCloseKey (hKey);
system("pause");
return EXIT_SUCCESS;
}