Commit b8d7434e authored by Sven Baars's avatar Sven Baars Committed by Alexandre Julliard

server: Recursively obtain the Wow6432Node parent.

parent 3b77a8e4
......@@ -2721,7 +2721,7 @@ static void test_redirection(void)
check_key_value( key, "Winetest", 0, 64 );
check_key_value( key, "Winetest", KEY_WOW64_64KEY, 64 );
dw = get_key_value( key, "Winetest", KEY_WOW64_32KEY );
todo_wine ok( dw == 32, "wrong value %lu\n", dw );
todo_wine_if (ptr_size == 64) ok( dw == 32, "wrong value %lu\n", dw );
RegCloseKey( key );
err = RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine", 0, NULL, 0,
......
......@@ -1630,8 +1630,7 @@ static void test_redirection(void)
ok( status == STATUS_SUCCESS, "NtCreateKey failed: 0x%08lx\n", status );
check_key_value( key, "Winetest", 0, 64 );
check_key_value( key, "Winetest", KEY_WOW64_64KEY, 64 );
dw = get_key_value( key, "Winetest", KEY_WOW64_32KEY );
todo_wine_if (ptr_size == 32) ok( dw == ptr_size, "wrong value %lu\n", dw );
check_key_value( key, "Winetest", KEY_WOW64_32KEY, ptr_size );
pNtClose( key );
status = pNtCreateKey( &key, KEY_WOW64_32KEY | KEY_ALL_ACCESS, &attr, 0, 0, 0, 0 );
......@@ -1993,7 +1992,7 @@ static void test_redirection(void)
if (!status) pNtClose( key );
status = pNtOpenKey( &key, KEY_WOW64_32KEY | KEY_ALL_ACCESS, &attr );
todo_wine_if(ptr_size == 32) ok( status == STATUS_OBJECT_NAME_NOT_FOUND, "NtOpenKey failed: 0x%08lx\n", status );
ok( status == STATUS_OBJECT_NAME_NOT_FOUND, "NtOpenKey failed: 0x%08lx\n", status );
if (!status) pNtClose( key );
attr.RootDirectory = root32;
......
......@@ -773,6 +773,31 @@ static struct key *grab_wow6432node( struct key *key )
return ret;
}
/* recursively obtain the wow6432node parent key if any */
static struct key *get_wow6432node( struct key *key )
{
struct key *parent, *ret;
struct unicode_str name;
int index;
if (!key)
return NULL;
if (key->wow6432node)
return key->wow6432node;
parent = get_parent( key );
if (parent && key == parent->wow6432node)
return key;
if (!(ret = get_wow6432node( parent )))
return key;
name.str = key->obj.name->name;
name.len = key->obj.name->len;
return find_subkey( ret, &name, &index );
}
/* open a subkey */
static struct key *open_key( struct key *parent, const struct unicode_str *name,
unsigned int access, unsigned int attributes )
......@@ -785,10 +810,10 @@ static struct key *open_key( struct key *parent, const struct unicode_str *name,
return NULL;
}
if (parent && (access & KEY_WOW64_32KEY))
if (parent && (access & KEY_WOW64_32KEY) && !is_wow6432node( name->str, name->len ))
{
if (parent->wow6432node && !is_wow6432node( name->str, name->len ))
parent = parent->wow6432node;
if ((key = get_wow6432node( parent )))
parent = key;
}
if (!(access & KEY_WOW64_64KEY)) attributes |= OBJ_KEY_WOW64;
......@@ -810,9 +835,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))
if (parent && (access & KEY_WOW64_32KEY) && !is_wow6432node( name->str, name->len ))
{
if (parent->wow6432node && !is_wow6432node( name->str, name->len )) parent = parent->wow6432node;
if ((key = get_wow6432node( parent )))
parent = key;
}
if (!(access & KEY_WOW64_64KEY)) attributes |= OBJ_KEY_WOW64;
......
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