kernelbase: Zero out retkey in the ERROR_INVALID_HANDLE case in RegOpenKeyExW.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48798
Signed-off-by: Jefferson Carpenter <jeffersoncarpenter2@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jefferson Carpenter 2020-03-24 08:02:34 +00:00 committed by Alexandre Julliard
parent 4f2f95195d
commit f070d040eb
2 changed files with 6 additions and 0 deletions

View file

@ -1081,6 +1081,11 @@ static void test_reg_open_key(void)
ok(!RegCloseKey(hkResult), "got invalid hkey\n");
/* empty subkey of NULL */
hkResult = hkPreserve;
ret = RegOpenKeyExW(NULL, L"", 0, KEY_QUERY_VALUE, &hkResult);
ok(ret == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %d\n", ret);
ok(hkResult == NULL || broken(hkResult == hkPreserve /* Windows XP */), "expected hkResult == NULL\n");
hkResult = hkPreserve;
ret = RegOpenKeyExA(NULL, "", 0, KEY_QUERY_VALUE, &hkResult);
ok(ret == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %d\n", ret);

View file

@ -479,6 +479,7 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegOpenKeyExW( HKEY hkey, LPCWSTR name, DWORD o
if (HandleToUlong(hkey) == HandleToUlong(HKEY_CLASSES_ROOT) && name && *name == '\\') name++;
if (!retkey) return ERROR_INVALID_PARAMETER;
*retkey = NULL;
if (!(hkey = get_special_root_hkey( hkey, access ))) return ERROR_INVALID_HANDLE;
attr.Length = sizeof(attr);