diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c index 4dfdfb87391..30044d4e1f2 100644 --- a/dlls/ntdll/tests/reg.c +++ b/dlls/ntdll/tests/reg.c @@ -2125,7 +2125,7 @@ static void test_redirection(void) status = pNtQueryKey( root32, KeyFullInformation, full_info, sizeof(buffer), &len ); ok( status == STATUS_SUCCESS, "NtQueryKey failed: 0x%08lx\n", status ); - todo_wine_if(ptr_size == 32) ok( full_info->SubKeys == subkeys64, "wrong number of subkeys: %lu\n", full_info->SubKeys ); + ok( full_info->SubKeys == subkeys64, "wrong number of subkeys: %lu\n", full_info->SubKeys ); subkeys = full_info->SubKeys; found = FALSE; @@ -2137,7 +2137,7 @@ static void test_redirection(void) if (basic_info->NameLength == sizeof(wineW) && !memcmp(basic_info->Name, wineW, sizeof(wineW) )) found = TRUE; } - todo_wine_if(ptr_size == 32) ok( ptr_size == 32 ? found : !found, "key not found\n" ); + ok( ptr_size == 32 ? found : !found, "key not found\n" ); pNtClose( root32 ); status = pNtOpenKey( &root64, KEY_WOW64_64KEY | KEY_ALL_ACCESS, &attr ); @@ -2165,7 +2165,7 @@ static void test_redirection(void) status = pNtQueryKey( root64, KeyFullInformation, full_info, sizeof(buffer), &len ); ok( status == STATUS_SUCCESS, "NtQueryKey failed: 0x%08lx\n", status ); - todo_wine_if(ptr_size == 32) ok( full_info->SubKeys == subkeys64, "wrong number of subkeys: %lu\n", full_info->SubKeys ); + ok( full_info->SubKeys == subkeys64, "wrong number of subkeys: %lu\n", full_info->SubKeys ); subkeys = full_info->SubKeys; found = FALSE; @@ -2177,7 +2177,7 @@ static void test_redirection(void) if (basic_info->NameLength == sizeof(wineW) && !memcmp(basic_info->Name, wineW, sizeof(wineW) )) found = TRUE; } - todo_wine_if(ptr_size == 32) ok( ptr_size == 32 ? found : !found, "key not found\n" ); + ok( ptr_size == 32 ? found : !found, "key not found\n" ); pNtClose( root64 ); pRtlInitUnicodeString( &str, L"\\Registry\\Machine\\Software\\Classes\\Wow6432Node" ); @@ -2247,7 +2247,7 @@ static void test_redirection(void) status = pNtQueryKey( root32, KeyFullInformation, full_info, sizeof(buffer), &len ); ok( status == STATUS_SUCCESS, "NtQueryKey failed: 0x%08lx\n", status ); - todo_wine_if(ptr_size == 32) ok( full_info->SubKeys == (ptr_size == 32 ? subkeys64 : subkeys32), "wrong number of subkeys: %lu\n", full_info->SubKeys ); + ok( full_info->SubKeys == (ptr_size == 32 ? subkeys64 : subkeys32), "wrong number of subkeys: %lu\n", full_info->SubKeys ); subkeys = full_info->SubKeys; found = FALSE; @@ -2259,7 +2259,7 @@ static void test_redirection(void) if (basic_info->NameLength == sizeof(wineW) && !memcmp(basic_info->Name, wineW, sizeof(wineW) )) found = TRUE; } - todo_wine_if(ptr_size == 32) ok( found, "key not found\n" ); + ok( found, "key not found\n" ); pNtClose( root32 ); status = pNtOpenKey( &root64, KEY_WOW64_64KEY | KEY_ALL_ACCESS, &attr ); @@ -2287,7 +2287,7 @@ static void test_redirection(void) status = pNtQueryKey( root64, KeyFullInformation, full_info, sizeof(buffer), &len ); ok( status == STATUS_SUCCESS, "NQtueryKey failed: 0x%08lx\n", status ); - todo_wine_if(ptr_size == 32) ok( full_info->SubKeys == (ptr_size == 32 ? subkeys64 : subkeys32), "wrong number of subkeys: %lu\n", full_info->SubKeys ); + ok( full_info->SubKeys == (ptr_size == 32 ? subkeys64 : subkeys32), "wrong number of subkeys: %lu\n", full_info->SubKeys ); subkeys = full_info->SubKeys; found = FALSE; @@ -2299,7 +2299,7 @@ static void test_redirection(void) if (basic_info->NameLength == sizeof(wineW) && !memcmp(basic_info->Name, wineW, sizeof(wineW) )) found = TRUE; } - todo_wine_if(ptr_size == 32) ok( found, "key not found\n" ); + ok( found, "key not found\n" ); pNtClose( root64 ); pNtDeleteKey( key32 ); diff --git a/server/registry.c b/server/registry.c index d112987b2b9..03e5f20cae5 100644 --- a/server/registry.c +++ b/server/registry.c @@ -516,6 +516,15 @@ static struct object *key_lookup_name( struct object *obj, struct unicode_str *n set_error( STATUS_OBJECT_NAME_NOT_FOUND ); } } + + key = (struct key *)obj; + if (key && (key->flags & KEY_WOWSHARE) && (attr & OBJ_KEY_WOW64) && !name->str) + { + key = get_parent( key ); + release_object( obj ); + return grab_object( key ); + } + return obj; } @@ -768,6 +777,7 @@ static struct key *grab_wow6432node( struct key *key ) struct key *ret = key->wow6432node; if (!ret) return key; + if (ret->flags & KEY_WOWSHARE) return key; grab_object( ret ); release_object( key ); return ret; @@ -810,9 +820,10 @@ static struct key *open_key( struct key *parent, const struct unicode_str *name, return NULL; } - if (parent && (access & KEY_WOW64_32KEY) && !is_wow6432node( name->str, name->len )) + if (parent && !(access & KEY_WOW64_64KEY) && !is_wow6432node( name->str, name->len )) { - if ((key = get_wow6432node( parent ))) + key = get_wow6432node( parent ); + if (key && ((access & KEY_WOW64_32KEY) || (key->flags & KEY_WOWSHARE))) parent = key; } @@ -835,9 +846,10 @@ static struct key *create_key( struct key *parent, const struct unicode_str *nam if (options & REG_OPTION_CREATE_LINK) attributes = (attributes & ~OBJ_OPENIF) | OBJ_OPENLINK; - if (parent && (access & KEY_WOW64_32KEY) && !is_wow6432node( name->str, name->len )) + if (parent && !(access & KEY_WOW64_64KEY) && !is_wow6432node( name->str, name->len )) { - if ((key = get_wow6432node( parent ))) + key = get_wow6432node( parent ); + if (key && ((access & KEY_WOW64_32KEY) || (key->flags & KEY_WOWSHARE))) parent = key; }