1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

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

Fix Warlords Battlecry III (433280) crashes at launch.
This commit is contained in:
Zhiyi Zhang 2024-03-04 12:13:46 +08:00 committed by Alexandre Julliard
parent 8dc5242e29
commit d2045611b6
2 changed files with 8 additions and 0 deletions

View file

@ -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 );
}

View file

@ -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())
{