kernelbase: Handle RegGetValue() RRF_SUBKEY_WOW64??KEY flags.

Signed-off-by: Serge Gautherie <winehq-git_serge_180711@gautherie.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Serge Gautherie 2020-03-21 16:21:29 +01:00 committed by Alexandre Julliard
parent 27d1ef75c4
commit 7c0ba9007a
2 changed files with 23 additions and 2 deletions

View File

@ -1699,13 +1699,22 @@ LSTATUS WINAPI RegGetValueW( HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue,
if (pvData && !pcbData) if (pvData && !pcbData)
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
if ((dwFlags & RRF_RT_REG_EXPAND_SZ) && !(dwFlags & RRF_NOEXPAND) && if ((dwFlags & RRF_RT_REG_EXPAND_SZ) && !(dwFlags & RRF_NOEXPAND) &&
((dwFlags & RRF_RT_ANY) != RRF_RT_ANY)) ((dwFlags & RRF_RT_ANY) != RRF_RT_ANY))
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
if ((dwFlags & RRF_WOW64_MASK) == RRF_WOW64_MASK)
return ERROR_INVALID_PARAMETER;
if (pszSubKey && pszSubKey[0]) 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; if (ret != ERROR_SUCCESS) return ret;
} }
@ -1795,13 +1804,22 @@ LSTATUS WINAPI RegGetValueA( HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue,
if (pvData && !pcbData) if (pvData && !pcbData)
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
if ((dwFlags & RRF_RT_REG_EXPAND_SZ) && !(dwFlags & RRF_NOEXPAND) && if ((dwFlags & RRF_RT_REG_EXPAND_SZ) && !(dwFlags & RRF_NOEXPAND) &&
((dwFlags & RRF_RT_ANY) != RRF_RT_ANY)) ((dwFlags & RRF_RT_ANY) != RRF_RT_ANY))
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
if ((dwFlags & RRF_WOW64_MASK) == RRF_WOW64_MASK)
return ERROR_INVALID_PARAMETER;
if (pszSubKey && pszSubKey[0]) 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; if (ret != ERROR_SUCCESS) return ret;
} }

View File

@ -81,6 +81,9 @@ typedef LONG LSTATUS;
#define RRF_RT_DWORD (RRF_RT_REG_BINARY | RRF_RT_REG_DWORD) #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_QWORD (RRF_RT_REG_BINARY | RRF_RT_REG_QWORD)
#define RRF_RT_ANY 0xffff #define RRF_RT_ANY 0xffff
#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_NOEXPAND (1 << 28)
#define RRF_ZEROONFAILURE (1 << 29) #define RRF_ZEROONFAILURE (1 << 29)