diff --git a/reactos/dll/win32/advapi32/reg/reg.c b/reactos/dll/win32/advapi32/reg/reg.c index 741660ce289..8faea3a3990 100644 --- a/reactos/dll/win32/advapi32/reg/reg.c +++ b/reactos/dll/win32/advapi32/reg/reg.c @@ -2772,6 +2772,11 @@ RegOpenKeyA (HKEY hKey, PHKEY phkResult) { TRACE("RegOpenKeyA hKey 0x%x lpSubKey %s phkResult %p\n", hKey, lpSubKey, phkResult); + + if (!hKey && lpSubKey && phkResult) + { + return ERROR_INVALID_HANDLE; + } if (!lpSubKey || !*lpSubKey) { @@ -2799,6 +2804,11 @@ RegOpenKeyW (HKEY hKey, { TRACE("RegOpenKeyW hKey 0x%x lpSubKey %S phkResult %p\n", hKey, lpSubKey, phkResult); + if (!hKey && lpSubKey && phkResult) + { + return ERROR_INVALID_HANDLE; + } + if (!lpSubKey || !*lpSubKey) { *phkResult = hKey;