Code:
#include <windows.h>
#include <string.h>
int WINAPI WinMain(HINSTANCE hinst, HINSTANCE previnst,
LPSTR lpszArgs, int Mode){
HKEY hMykey; //Handle to your key
DWORD pDWDisp; // Ignore for this
LONG lRes; // Test Success
char prog[] = "C:\\WINNT\\system32\\sol.exe"; //Key to launch
lRes = RegCreateKeyEx(HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\run",
0,"Whatever",REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,
NULL,&hMykey,&pDWDisp); // Open a key for edit
if(lRes != ERROR_SUCCESS){
MessageBox(0,"Error opening key","",MB_OK);
exit(0);// Shutdown on fail
}
lRes = RegSetValueEx(hMykey,"Sol",0,REG_SZ,
(LPBYTE)prog,strlen(prog)+1);// Add your key value
if(lRes != ERROR_SUCCESS){
MessageBox(0,"Error saving record","",MB_OK);
RegCloseKey(hMykey);
exit(0);// Shutdown on fail
}
MessageBox(0,"Success!! Registry value recorded","",MB_OK);
RegCloseKey(hMykey);
return 0;
}
I think that will do it....
Of course you will need to edit the SubKey in Run and the path......I just set it to run Solitaire as a test
If it works........You owe me a cookie