1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-03 08:19:41 +00:00

server: Don't return the actual 32-bit Software\Classes key.

This commit is contained in:
Sven Baars 2022-09-19 14:36:53 +02:00 committed by Alexandre Julliard
parent 0edf023bc6
commit fe8b10f8c8
2 changed files with 24 additions and 12 deletions

View File

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

View File

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