@@ -115,9 +115,27 @@ Bool setUnsignedIntInRegistry( HKEY root, AsciiString path, AsciiString key, Uns
115115 return (returnValue == ERROR_SUCCESS );
116116}
117117
118+ Bool GetStringFromGeneralsRegistry (AsciiString path, AsciiString key, AsciiString& val)
119+ {
120+ AsciiString fullPath = " SOFTWARE\\ Electronic Arts\\ EA Games\\ Generals" ;
121+
122+ fullPath.concat (path);
123+ DEBUG_LOG ((" GetStringFromRegistry - looking in %s for key %s" , fullPath.str (), key.str ()));
124+ if (getStringFromRegistry (HKEY_LOCAL_MACHINE , fullPath.str (), key.str (), val))
125+ {
126+ return TRUE ;
127+ }
128+
129+ return getStringFromRegistry (HKEY_CURRENT_USER , fullPath.str (), key.str (), val);
130+ }
131+
118132Bool GetStringFromRegistry (AsciiString path, AsciiString key, AsciiString& val)
119133{
134+ #if RTS_GENERALS
120135 AsciiString fullPath = " SOFTWARE\\ Electronic Arts\\ EA Games\\ Generals" ;
136+ #elif RTS_ZEROHOUR
137+ AsciiString fullPath = " SOFTWARE\\ Electronic Arts\\ EA Games\\ Command and Conquer Generals Zero Hour" ;
138+ #endif
121139
122140 fullPath.concat (path);
123141 DEBUG_LOG ((" GetStringFromRegistry - looking in %s for key %s" , fullPath.str (), key.str ()));
@@ -131,7 +149,11 @@ Bool GetStringFromRegistry(AsciiString path, AsciiString key, AsciiString& val)
131149
132150Bool GetUnsignedIntFromRegistry (AsciiString path, AsciiString key, UnsignedInt& val)
133151{
152+ #if RTS_GENERALS
134153 AsciiString fullPath = " SOFTWARE\\ Electronic Arts\\ EA Games\\ Generals" ;
154+ #elif RTS_ZEROHOUR
155+ AsciiString fullPath = " SOFTWARE\\ Electronic Arts\\ EA Games\\ Command and Conquer Generals Zero Hour" ;
156+ #endif
135157
136158 fullPath.concat (path);
137159 DEBUG_LOG ((" GetUnsignedIntFromRegistry - looking in %s for key %s" , fullPath.str (), key.str ()));
@@ -146,6 +168,7 @@ Bool GetUnsignedIntFromRegistry(AsciiString path, AsciiString key, UnsignedInt&
146168AsciiString GetRegistryLanguage (void )
147169{
148170 static Bool cached = FALSE ;
171+ // NOTE: static causes a memory leak, but we have to keep it because the value is cached.
149172 static AsciiString val = " english" ;
150173 if (cached) {
151174 return val;
0 commit comments