Commit 178cd20e authored by Alexandre Julliard's avatar Alexandre Julliard

server: Add support for Wow64 sharing of the HKLM\Software\Classes key.

parent 606cc061
...@@ -85,6 +85,7 @@ struct key ...@@ -85,6 +85,7 @@ struct key
#define KEY_DIRTY 0x0004 /* key has been modified */ #define KEY_DIRTY 0x0004 /* key has been modified */
#define KEY_SYMLINK 0x0008 /* key is a symbolic link */ #define KEY_SYMLINK 0x0008 /* key is a symbolic link */
#define KEY_WOW64 0x0010 /* key contains a Wow6432Node subkey */ #define KEY_WOW64 0x0010 /* key contains a Wow6432Node subkey */
#define KEY_WOWSHARE 0x0020 /* key is a Wow64 shared key (used for Software\Classes) */
/* a key value */ /* a key value */
struct key_value struct key_value
...@@ -654,7 +655,16 @@ static struct key *open_key_prefix( struct key *key, const struct unicode_str *n ...@@ -654,7 +655,16 @@ static struct key *open_key_prefix( struct key *key, const struct unicode_str *n
while (token->len) while (token->len)
{ {
struct key *subkey; struct key *subkey;
if (!(subkey = find_subkey( key, token, index ))) break; if (!(subkey = find_subkey( key, token, index )))
{
if ((key->flags & KEY_WOWSHARE) && !(access & KEY_WOW64_64KEY))
{
/* try in the 64-bit parent */
key = key->parent;
subkey = find_subkey( key, token, index );
}
}
if (!subkey) break;
key = subkey; key = subkey;
get_path_token( name, token ); get_path_token( name, token );
if (!token->len) break; if (!token->len) break;
...@@ -1604,13 +1614,17 @@ void init_registry(void) ...@@ -1604,13 +1614,17 @@ void init_registry(void)
{ {
static const WCHAR HKLM[] = { 'M','a','c','h','i','n','e' }; static const WCHAR HKLM[] = { 'M','a','c','h','i','n','e' };
static const WCHAR HKU_default[] = { 'U','s','e','r','\\','.','D','e','f','a','u','l','t' }; static const WCHAR HKU_default[] = { 'U','s','e','r','\\','.','D','e','f','a','u','l','t' };
static const WCHAR classes[] = {'S','o','f','t','w','a','r','e','\\',
'C','l','a','s','s','e','s','\\',
'W','o','w','6','4','3','2','N','o','d','e'};
static const struct unicode_str root_name = { NULL, 0 }; static const struct unicode_str root_name = { NULL, 0 };
static const struct unicode_str HKLM_name = { HKLM, sizeof(HKLM) }; static const struct unicode_str HKLM_name = { HKLM, sizeof(HKLM) };
static const struct unicode_str HKU_name = { HKU_default, sizeof(HKU_default) }; static const struct unicode_str HKU_name = { HKU_default, sizeof(HKU_default) };
static const struct unicode_str classes_name = { classes, sizeof(classes) };
WCHAR *current_user_path; WCHAR *current_user_path;
struct unicode_str current_user_str; struct unicode_str current_user_str;
struct key *key; struct key *key, *hklm, *hkcu;
/* switch to the config dir */ /* switch to the config dir */
...@@ -1623,11 +1637,10 @@ void init_registry(void) ...@@ -1623,11 +1637,10 @@ void init_registry(void)
/* load system.reg into Registry\Machine */ /* load system.reg into Registry\Machine */
if (!(key = create_key_recursive( root_key, &HKLM_name, current_time ))) if (!(hklm = create_key_recursive( root_key, &HKLM_name, current_time )))
fatal_error( "could not create Machine registry key\n" ); fatal_error( "could not create Machine registry key\n" );
load_init_registry_from_file( "system.reg", key ); load_init_registry_from_file( "system.reg", hklm );
release_object( key );
/* load userdef.reg into Registry\User\.Default */ /* load userdef.reg into Registry\User\.Default */
...@@ -1642,11 +1655,24 @@ void init_registry(void) ...@@ -1642,11 +1655,24 @@ void init_registry(void)
/* FIXME: match default user in token.c. should get from process token instead */ /* FIXME: match default user in token.c. should get from process token instead */
current_user_path = format_user_registry_path( security_interactive_sid, &current_user_str ); current_user_path = format_user_registry_path( security_interactive_sid, &current_user_str );
if (!current_user_path || if (!current_user_path ||
!(key = create_key_recursive( root_key, &current_user_str, current_time ))) !(hkcu = create_key_recursive( root_key, &current_user_str, current_time )))
fatal_error( "could not create HKEY_CURRENT_USER registry key\n" ); fatal_error( "could not create HKEY_CURRENT_USER registry key\n" );
free( current_user_path ); free( current_user_path );
load_init_registry_from_file( "user.reg", key ); load_init_registry_from_file( "user.reg", hkcu );
release_object( key );
/* set the shared flag on Software\Classes\Wow6432Node */
if (sizeof(void *) > sizeof(int))
{
if ((key = create_key_recursive( hklm, &classes_name, current_time )))
{
key->flags |= KEY_WOWSHARE;
release_object( key );
}
/* FIXME: handle HKCU too */
}
release_object( hklm );
release_object( hkcu );
/* start the periodic save timer */ /* start the periodic save timer */
set_periodic_save_timer(); set_periodic_save_timer();
......
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