mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +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
|
||||
# include "windows_inc.h"
|
||||
# include "winbits.h"
|
||||
# ifndef KEY_WOW64_64KEY
|
||||
# define KEY_WOW64_64KEY 0x0100
|
||||
# endif
|
||||
# ifndef KEY_WOW64_32KEY
|
||||
# define KEY_WOW64_32KEY 0x0200
|
||||
# endif
|
||||
|
@ -509,18 +512,26 @@ void G_LoadGroups(int32_t autoload)
|
|||
#ifdef _WIN32
|
||||
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
|
||||
REGSAM const wow64keys[] = { KEY_WOW64_32KEY, KEY_WOW64_64KEY };
|
||||
|
||||
for (size_t k = 0; k < ARRAY_SIZE(wow64keys); ++k)
|
||||
{
|
||||
HKEY hkey;
|
||||
LONG keygood = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NULL, 0, KEY_READ | wow64keys[k], &hkey);
|
||||
|
||||
if (keygood != ERROR_SUCCESS)
|
||||
return 0;
|
||||
continue;
|
||||
|
||||
LONG retval = SHGetValueA(hkey, SubKey, Value, NULL, Output, OutputSize);
|
||||
|
||||
RegCloseKey(hkey);
|
||||
|
||||
return retval == ERROR_SUCCESS;
|
||||
if (retval == ERROR_SUCCESS)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue