advapi32: Check NULL return key pointers when creating registry keys.
Fix Warlords Battlecry III (433280) crashes at launch.
This commit is contained in:
parent
8dc5242e29
commit
d2045611b6
2 changed files with 8 additions and 0 deletions
|
@ -70,6 +70,9 @@ LSTATUS WINAPI RegOverridePredefKey( HKEY hkey, HKEY override )
|
||||||
*/
|
*/
|
||||||
LSTATUS WINAPI RegCreateKeyW( HKEY hkey, LPCWSTR lpSubKey, PHKEY phkResult )
|
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,
|
return RegCreateKeyExW( hkey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE,
|
||||||
MAXIMUM_ALLOWED, NULL, phkResult, NULL );
|
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 )
|
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,
|
return RegCreateKeyExA( hkey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE,
|
||||||
MAXIMUM_ALLOWED, NULL, phkResult, NULL );
|
MAXIMUM_ALLOWED, NULL, phkResult, NULL );
|
||||||
}
|
}
|
||||||
|
|
|
@ -592,6 +592,7 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegCreateKeyExW( HKEY hkey, LPCWSTR name, DWORD
|
||||||
{
|
{
|
||||||
UNICODE_STRING nameW, classW;
|
UNICODE_STRING nameW, classW;
|
||||||
|
|
||||||
|
if (!retkey) return ERROR_BADKEY;
|
||||||
if (reserved) return ERROR_INVALID_PARAMETER;
|
if (reserved) return ERROR_INVALID_PARAMETER;
|
||||||
if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
|
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;
|
ANSI_STRING nameA, classA;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
|
if (!retkey) return ERROR_BADKEY;
|
||||||
if (reserved) return ERROR_INVALID_PARAMETER;
|
if (reserved) return ERROR_INVALID_PARAMETER;
|
||||||
if (!is_version_nt())
|
if (!is_version_nt())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue