Commit 88fa3459 authored by Sven Baars's avatar Sven Baars Committed by Alexandre Julliard

kernelbase: Also call NtOpenKeyEx() on empty key names.

parent 68920ee4
...@@ -1510,11 +1510,11 @@ static void test_reg_delete_key(void) ...@@ -1510,11 +1510,11 @@ static void test_reg_delete_key(void)
ok(ret == ERROR_SUCCESS, "Could not open key, got %ld\n", ret); ok(ret == ERROR_SUCCESS, "Could not open key, got %ld\n", ret);
ret = RegDeleteKeyExA(key, "", KEY_WOW64_32KEY, 0); ret = RegDeleteKeyExA(key, "", KEY_WOW64_32KEY, 0);
todo_wine_if(ptr_size == 64) ok(ret == ERROR_SUCCESS, "RegDeleteKeyExA failed, got %ld\n", ret); ok(ret == ERROR_SUCCESS, "RegDeleteKeyExA failed, got %ld\n", ret);
RegCloseKey(key); RegCloseKey(key);
ret = RegOpenKeyExA(hkey_main, "deleteme", 0, KEY_READ | KEY_WOW64_32KEY, &key); ret = RegOpenKeyExA(hkey_main, "deleteme", 0, KEY_READ | KEY_WOW64_32KEY, &key);
todo_wine_if(ptr_size == 64) ok(ret == ERROR_FILE_NOT_FOUND, "Key was not deleted, got %ld\n", ret); ok(ret == ERROR_FILE_NOT_FOUND, "Key was not deleted, got %ld\n", ret);
RegCloseKey(key); RegCloseKey(key);
} }
......
...@@ -155,7 +155,7 @@ static NTSTATUS open_subkey( HKEY *subkey, HKEY root, UNICODE_STRING *name, DWOR ...@@ -155,7 +155,7 @@ static NTSTATUS open_subkey( HKEY *subkey, HKEY root, UNICODE_STRING *name, DWOR
attr.SecurityDescriptor = NULL; attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL; attr.SecurityQualityOfService = NULL;
if (buffer[0] == '\\') return STATUS_OBJECT_PATH_INVALID; if (len > 0 && buffer[0] == '\\') return STATUS_OBJECT_PATH_INVALID;
while (i < len && buffer[i] != '\\') i++; while (i < len && buffer[i] != '\\') i++;
str.Buffer = name->Buffer; str.Buffer = name->Buffer;
...@@ -202,7 +202,7 @@ static NTSTATUS open_subkey( HKEY *subkey, HKEY root, UNICODE_STRING *name, DWOR ...@@ -202,7 +202,7 @@ static NTSTATUS open_subkey( HKEY *subkey, HKEY root, UNICODE_STRING *name, DWOR
/* wrapper for NtOpenKeyEx to handle Wow6432 nodes */ /* wrapper for NtOpenKeyEx to handle Wow6432 nodes */
static NTSTATUS open_key( HKEY *retkey, HKEY root, UNICODE_STRING name, DWORD options, ACCESS_MASK access ) static NTSTATUS open_key( HKEY *retkey, HKEY root, UNICODE_STRING name, DWORD options, ACCESS_MASK access )
{ {
HKEY subkey, subkey_root = root; HKEY subkey = 0, subkey_root = root;
NTSTATUS status = 0; NTSTATUS status = 0;
*retkey = NULL; *retkey = NULL;
...@@ -228,7 +228,7 @@ static NTSTATUS open_key( HKEY *retkey, HKEY root, UNICODE_STRING name, DWORD op ...@@ -228,7 +228,7 @@ static NTSTATUS open_key( HKEY *retkey, HKEY root, UNICODE_STRING name, DWORD op
return status; return status;
} }
while (!status && name.Length) while (!status && (name.Length || !subkey))
{ {
status = open_subkey( &subkey, subkey_root, &name, options, access ); status = open_subkey( &subkey, subkey_root, &name, options, access );
if (subkey_root && subkey_root != root) NtClose( subkey_root ); if (subkey_root && subkey_root != root) NtClose( subkey_root );
......
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