why is it, that I can save some registry info and it works in XP, but when i run the same program on 98, it doesn't do anything?
here is my code:
Code:
//include stuff
void writetoKey(HKEY keypath, char *keyname, unsigned int type, char *value)
{
unsigned long result;
HKEY key;
RegCreateKeyEx(
keypath,
keyname,
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_SET_VALUE,
NULL,
&key,
&result
);
switch(result)
{
case REG_CREATED_NEW_KEY:
cout << "Created new key" << endl;
break;
case REG_OPENED_EXISTING_KEY:
cout << "Key already existed, rewriting" << endl;
}
RegSetValueEx(
key,
NULL,
0,
type,
(LPBYTE)value,
strlen(value)+1
);
RegFlushKey(key);
RegCloseKey(key);
}
int main()
{
char fullpath[]="C:\testfolder\EXE\OpenScript.exe %1";
char tempname[]="ost_auto_file";
char tempname2[]="%SystemRoot%\\system32\\NOTEPAD.EXE %1";
writetoKey(HKEY_CLASSES_ROOT,".ost",REG_SZ,tempname);
writetoKey(HKEY_CLASSES_ROOT,"ost_auto_file\\shell\\edit\\command\\",REG_EXPAND_SZ,tempname2);
writetoKey(HKEY_CLASSES_ROOT,"ost_auto_file\\shell\\open\\command\\",REG_EXPAND_SZ,fullpath);
return 1;
}
any help would be greatly appreciated. I need to know if there is a way to edit the registry on ALL (or most) operating systems...
-thanks in advance