Commit d2045611 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

advapi32: Check NULL return key pointers when creating registry keys.

Fix Warlords Battlecry III (433280) crashes at launch.
parent 8dc5242e
......@@ -70,6 +70,9 @@ LSTATUS WINAPI RegOverridePredefKey( HKEY hkey, HKEY override )
*/
LSTATUS WINAPI RegCreateKeyW( HKEY hkey, LPCWSTR lpSubKey, PHKEY phkResult )
{
if (!phkResult)
return ERROR_INVALID_PARAMETER;
return RegCreateKeyExW( hkey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE,
MAXIMUM_ALLOWED, NULL, phkResult, NULL );
}
......@@ -82,6 +85,9 @@ LSTATUS WINAPI RegCreateKeyW( HKEY hkey, LPCWSTR lpSubKey, PHKEY phkResult )
*/
LSTATUS WINAPI RegCreateKeyA( HKEY hkey, LPCSTR lpSubKey, PHKEY phkResult )
{
if (!phkResult)
return ERROR_INVALID_PARAMETER;
return RegCreateKeyExA( hkey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE,
MAXIMUM_ALLOWED, NULL, phkResult, NULL );
}
......
......@@ -592,6 +592,7 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegCreateKeyExW( HKEY hkey, LPCWSTR name, DWORD
{
UNICODE_STRING nameW, classW;
if (!retkey) return ERROR_BADKEY;
if (reserved) return ERROR_INVALID_PARAMETER;
if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
......@@ -633,6 +634,7 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegCreateKeyExA( HKEY hkey, LPCSTR name, DWORD
ANSI_STRING nameA, classA;
NTSTATUS status;
if (!retkey) return ERROR_BADKEY;
if (reserved) return ERROR_INVALID_PARAMETER;
if (!is_version_nt())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment