mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
Modify Windows registry reading to check both 32-bit and 64-bit key locations.
git-svn-id: https://svn.eduke32.com/eduke32@6111 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
f4fa0ceafd
commit
8cf65eb180
1 changed files with 18 additions and 7 deletions
|
@ -13,6 +13,9 @@
|
||||||
# define NEED_SHLWAPI_H
|
# define NEED_SHLWAPI_H
|
||||||
# include "windows_inc.h"
|
# include "windows_inc.h"
|
||||||
# include "winbits.h"
|
# include "winbits.h"
|
||||||
|
# ifndef KEY_WOW64_64KEY
|
||||||
|
# define KEY_WOW64_64KEY 0x0100
|
||||||
|
# endif
|
||||||
# ifndef KEY_WOW64_32KEY
|
# ifndef KEY_WOW64_32KEY
|
||||||
# define KEY_WOW64_32KEY 0x0200
|
# define KEY_WOW64_32KEY 0x0200
|
||||||
# endif
|
# endif
|
||||||
|
@ -509,18 +512,26 @@ void G_LoadGroups(int32_t autoload)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static int G_ReadRegistryValue(char const * const SubKey, char const * const Value, char * const Output, DWORD * OutputSize)
|
static int G_ReadRegistryValue(char const * const SubKey, char const * const Value, char * const Output, DWORD * OutputSize)
|
||||||
{
|
{
|
||||||
HKEY hkey;
|
|
||||||
LONG keygood = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NULL, 0, KEY_READ | KEY_WOW64_32KEY, &hkey);
|
|
||||||
// KEY_WOW64_32KEY gets us around Wow6432Node on 64-bit builds
|
// KEY_WOW64_32KEY gets us around Wow6432Node on 64-bit builds
|
||||||
|
REGSAM const wow64keys[] = { KEY_WOW64_32KEY, KEY_WOW64_64KEY };
|
||||||
|
|
||||||
if (keygood != ERROR_SUCCESS)
|
for (size_t k = 0; k < ARRAY_SIZE(wow64keys); ++k)
|
||||||
return 0;
|
{
|
||||||
|
HKEY hkey;
|
||||||
|
LONG keygood = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NULL, 0, KEY_READ | wow64keys[k], &hkey);
|
||||||
|
|
||||||
LONG retval = SHGetValueA(hkey, SubKey, Value, NULL, Output, OutputSize);
|
if (keygood != ERROR_SUCCESS)
|
||||||
|
continue;
|
||||||
|
|
||||||
RegCloseKey(hkey);
|
LONG retval = SHGetValueA(hkey, SubKey, Value, NULL, Output, OutputSize);
|
||||||
|
|
||||||
return retval == ERROR_SUCCESS;
|
RegCloseKey(hkey);
|
||||||
|
|
||||||
|
if (retval == ERROR_SUCCESS)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue