Commit a9d5de84 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

RegDeleteKey fails if the lpSubKey param is NULL.

parent 13578c86
......@@ -871,9 +871,11 @@ DWORD WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name )
DWORD ret;
HKEY tmp;
if (!name) return ERROR_INVALID_PARAMETER;
if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
if (!name || !*name)
if (!*name)
{
ret = RtlNtStatusToDosError( NtDeleteKey( hkey ) );
}
......@@ -905,9 +907,11 @@ DWORD WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
DWORD ret;
HKEY tmp;
if (!name) return ERROR_INVALID_PARAMETER;
if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
if (!name || !*name)
if (!*name)
{
ret = RtlNtStatusToDosError( NtDeleteKey( hkey ) );
}
......
......@@ -352,6 +352,14 @@ static void test_reg_close_key()
"expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %ld\n", ret);
}
static void test_reg_delete_key()
{
DWORD ret;
ret = RegDeleteKey(hkey_main, NULL);
ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", ret);
}
static void test_reg_save_key()
{
DWORD ret;
......@@ -385,6 +393,7 @@ START_TEST(registry)
test_query_value_ex();
test_reg_open_key();
test_reg_close_key();
test_reg_delete_key();
test_reg_save_key();
test_reg_load_key();
......
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