HKEY GetBaseRegKey(char* keystr)
{
HKEY hKey;
if(strcmp(keystr,"HKEY_CLASSES_ROOT")==0)
hKey=HKEY_CLASSES_ROOT;
if(strcmp(keystr,"HKEY_CURRENT_CONFIG")==0)
hKey=HKEY_CURRENT_CONFIG;
if(strcmp(keystr,"HKEY_CURRENT_USER")==0) hKey=HKEY_CURRENT_USER;
if(strcmp(keystr,"HKEY_LOCAL_MACHINE")==0) hKey=HKEY_LOCAL_MACHINE;
if(strcmp(keystr,"HKEY_USERS")==0) hKey=HKEY_USERS;
return hKey;
}
int RegDelValue(){
HKEY bKey,hKey;
LONG retVal;
char BaseKey[512];
char SubKey[512];
char SubKeyValueName[512];
strcpy(BaseKey,"HKEY_CURRENT_USER");
strcpy(SubKey,"Control Panel\\Desktop");
strcpy(SubKeyValueName,"ShowMenuDelay");
bKey = GetBaseRegKey(BaseKey);
retVal = RegOpenKeyEx(bKey,SubKey,0,KEY_ALL_ACCESS,&hKey);
if (retVal != ERROR_SUCCESS) return 1;
retVal = RegDeleteValue(hKey,(LPCTSTR)SubKeyValueName);
if(retVal !=ERROR_SUCCESS)
{
RegCloseKey(hKey);
return 2;
}
RegCloseKey(hKey);
return 0;
}