forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 117
Labels
BugSomething is not working right, typically is user facingSomething is not working right, typically is user facingMinorSeverity: Minor < Major < Critical < BlockerSeverity: Minor < Major < Critical < Blocker
Description
GetStringFromRegistry can fail to read from the correct location depending on process admin privileges. This is reproducible with the HTTP Proxy setting in the Options Menu. When using the game once as Admin, then the game will write a Proxy key into HKEY_LOCAL_MACHINE. Then when using the game without Admin privileges, the game will write a Proxy key into HKEY_CURRENT_USER. But when reading, it will be able to read from HKEY_LOCAL_MACHINE first. This is a bug.
bool GetStringFromRegistry(std::string path, std::string key, std::string& val)
{
#if RTS_GENERALS
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
#elif RTS_ZEROHOUR
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
#endif
fullPath.append(path);
// PROBLEMATICO
if (getStringFromRegistry(HKEY_LOCAL_MACHINE, fullPath.c_str(), key.c_str(), val))
{
return true;
}
return getStringFromRegistry(HKEY_CURRENT_USER, fullPath.c_str(), key.c_str(), val);
}bool SetStringInRegistry( std::string path, std::string key, std::string val)
{
#if RTS_GENERALS
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Generals";
#elif RTS_ZEROHOUR
std::string fullPath = "SOFTWARE\\Electronic Arts\\EA Games\\Command and Conquer Generals Zero Hour";
#endif
fullPath.append(path);
if (setStringInRegistry( HKEY_LOCAL_MACHINE, fullPath, key, val))
return true;
return setStringInRegistry( HKEY_CURRENT_USER, fullPath, key, val );
}Metadata
Metadata
Assignees
Labels
BugSomething is not working right, typically is user facingSomething is not working right, typically is user facingMinorSeverity: Minor < Major < Critical < BlockerSeverity: Minor < Major < Critical < Blocker