mirror of
https://github.com/a0rtega/pafish
synced 2024-11-24 23:29:39 +03:00
Handle registry keys redirection in x86_64
This commit is contained in:
parent
ea2888161b
commit
d957b6bcd1
@ -12,6 +12,9 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
|
#define KEY_WOW64_32KEY 0x0200
|
||||||
|
#define KEY_WOW64_64KEY 0x0100
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prototypes for the Wow64 API's since they aren't available in all Windows
|
* Prototypes for the Wow64 API's since they aren't available in all Windows
|
||||||
* versions, most notably Windows XP 32 bits.
|
* versions, most notably Windows XP 32 bits.
|
||||||
@ -63,7 +66,12 @@ inline int pafish_exists_regkey(HKEY hKey, char * regkey_s) {
|
|||||||
HKEY regkey;
|
HKEY regkey;
|
||||||
LONG ret;
|
LONG ret;
|
||||||
|
|
||||||
ret = RegOpenKeyEx(hKey, regkey_s, 0, KEY_READ, ®key);
|
if (pafish_iswow64()) {
|
||||||
|
ret = RegOpenKeyEx(hKey, regkey_s, 0, KEY_READ | KEY_WOW64_64KEY, ®key);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ret = RegOpenKeyEx(hKey, regkey_s, 0, KEY_READ, ®key);
|
||||||
|
}
|
||||||
if (ret == ERROR_SUCCESS) {
|
if (ret == ERROR_SUCCESS) {
|
||||||
RegCloseKey(regkey);
|
RegCloseKey(regkey);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -84,7 +92,12 @@ inline int pafish_exists_regkey_value_str(HKEY hKey, char * regkey_s, char * val
|
|||||||
strncpy(lookup_str, lookup, lookup_size+sizeof(char));
|
strncpy(lookup_str, lookup, lookup_size+sizeof(char));
|
||||||
|
|
||||||
size = sizeof(value);
|
size = sizeof(value);
|
||||||
ret = RegOpenKeyEx(hKey, regkey_s, 0, KEY_READ, ®key);
|
if (pafish_iswow64()) {
|
||||||
|
ret = RegOpenKeyEx(hKey, regkey_s, 0, KEY_READ | KEY_WOW64_64KEY, ®key);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ret = RegOpenKeyEx(hKey, regkey_s, 0, KEY_READ, ®key);
|
||||||
|
}
|
||||||
if (ret == ERROR_SUCCESS) {
|
if (ret == ERROR_SUCCESS) {
|
||||||
ret = RegQueryValueEx(regkey, value_s, NULL, NULL, (BYTE*)value, &size);
|
ret = RegQueryValueEx(regkey, value_s, NULL, NULL, (BYTE*)value, &size);
|
||||||
RegCloseKey(regkey);
|
RegCloseKey(regkey);
|
||||||
|
Loading…
Reference in New Issue
Block a user