Signed-off-by: Serge Gautherie winehq-git_serge_180711@gautherie.fr --- dlls/kernelbase/registry.c | 22 ++++++++++++++++++++-- include/winreg.h | 5 ++++- 2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/kernelbase/registry.c b/dlls/kernelbase/registry.c index e6f3722..17b5020 100644 --- a/dlls/kernelbase/registry.c +++ b/dlls/kernelbase/registry.c @@ -1698,13 +1698,22 @@ LSTATUS WINAPI RegGetValueW( HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue,
if (pvData && !pcbData) return ERROR_INVALID_PARAMETER; + if ((dwFlags & RRF_RT_REG_EXPAND_SZ) && !(dwFlags & RRF_NOEXPAND) && ((dwFlags & RRF_RT_ANY) != RRF_RT_ANY)) return ERROR_INVALID_PARAMETER;
+ if (dwFlags & RRF_WOW64_MASK == RRF_SUBKEY_WOW6432KEY | RRF_SUBKEY_WOW6464KEY) + return ERROR_INVALID_PARAMETER; + if (pszSubKey && pszSubKey[0]) { - ret = RegOpenKeyExW(hKey, pszSubKey, 0, KEY_QUERY_VALUE, &hKey); + REGSAM samDesired = KEY_QUERY_VALUE; + + if (dwFlags & RRF_WOW64_MASK) + samDesired |= (dwFlags & RRF_SUBKEY_WOW6432KEY) ? KEY_WOW64_32KEY : KEY_WOW64_64KEY; + + ret = RegOpenKeyExW(hKey, pszSubKey, 0, samDesired, &hKey); if (ret != ERROR_SUCCESS) return ret; }
@@ -1794,13 +1803,22 @@ LSTATUS WINAPI RegGetValueA( HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue,
if (pvData && !pcbData) return ERROR_INVALID_PARAMETER; + if ((dwFlags & RRF_RT_REG_EXPAND_SZ) && !(dwFlags & RRF_NOEXPAND) && ((dwFlags & RRF_RT_ANY) != RRF_RT_ANY)) return ERROR_INVALID_PARAMETER;
+ if (dwFlags & RRF_WOW64_MASK == RRF_SUBKEY_WOW6432KEY | RRF_SUBKEY_WOW6464KEY) + return ERROR_INVALID_PARAMETER; + if (pszSubKey && pszSubKey[0]) { - ret = RegOpenKeyExA(hKey, pszSubKey, 0, KEY_QUERY_VALUE, &hKey); + REGSAM samDesired = KEY_QUERY_VALUE; + + if (dwFlags & RRF_WOW64_MASK) + samDesired |= (dwFlags & RRF_SUBKEY_WOW6432KEY) ? KEY_WOW64_32KEY : KEY_WOW64_64KEY; + + ret = RegOpenKeyExA(hKey, pszSubKey, 0, samDesired, &hKey); if (ret != ERROR_SUCCESS) return ret; }
diff --git a/include/winreg.h b/include/winreg.h index c003791..7e76479 100644 --- a/include/winreg.h +++ b/include/winreg.h @@ -80,7 +80,10 @@ typedef LONG LSTATUS; #define RRF_RT_REG_QWORD (1 << 6) #define RRF_RT_DWORD (RRF_RT_REG_BINARY | RRF_RT_REG_DWORD) #define RRF_RT_QWORD (RRF_RT_REG_BINARY | RRF_RT_REG_QWORD) -#define RRF_RT_ANY 0xffff +#define RRF_RT_ANY 0x0000ffff +#define RRF_SUBKEY_WOW6464KEY (1 << 16) +#define RRF_SUBKEY_WOW6432KEY (1 << 17) +#define RRF_WOW64_MASK (RRF_SUBKEY_WOW6432KEY | RRF_SUBKEY_WOW6464KEY) #define RRF_NOEXPAND (1 << 28) #define RRF_ZEROONFAILURE (1 << 29)