From: Sven Baars sbaars@codeweavers.com
--- dlls/kernelbase/registry.c | 45 ++++---------------------------------- server/registry.c | 3 ++- 2 files changed, 6 insertions(+), 42 deletions(-)
diff --git a/dlls/kernelbase/registry.c b/dlls/kernelbase/registry.c index 5fd4c5aef2d..78c8e7fdf6e 100644 --- a/dlls/kernelbase/registry.c +++ b/dlls/kernelbase/registry.c @@ -100,29 +100,6 @@ static inline BOOL is_version_nt(void) return !(GetVersion() & 0x80000000); }
-static BOOL is_wow6432node( const UNICODE_STRING *name ) -{ - return (name->Length == 11 * sizeof(WCHAR) && !wcsnicmp( name->Buffer, L"Wow6432Node", 11 )); -} - -/* open the Wow6432Node subkey of the specified key */ -static HANDLE open_wow6432node( HANDLE key ) -{ - OBJECT_ATTRIBUTES attr; - UNICODE_STRING nameW; - HANDLE ret; - - attr.Length = sizeof(attr); - attr.RootDirectory = key; - attr.ObjectName = &nameW; - attr.Attributes = 0; - attr.SecurityDescriptor = NULL; - attr.SecurityQualityOfService = NULL; - RtlInitUnicodeString( &nameW, L"Wow6432Node" ); - if (NtOpenKeyEx( &ret, MAXIMUM_ALLOWED, &attr, 0 )) ret = 0; - return ret; -} - static HKEY get_perflib_key( HANDLE key ) { static const WCHAR performance_text[] = @@ -146,11 +123,12 @@ static HKEY get_perflib_key( HANDLE key ) static NTSTATUS create_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr, const UNICODE_STRING *class, ULONG options, PULONG dispos ) { - BOOL force_wow32 = is_win64 && (access & KEY_WOW64_32KEY); NTSTATUS status = STATUS_OBJECT_NAME_NOT_FOUND; HANDLE subkey, root = attr->RootDirectory;
- if (!force_wow32) status = NtCreateKey( &subkey, access, attr, 0, class, options, dispos ); + if (!is_wow64 && (access & KEY_WOW64_32KEY)) attr->Attributes |= OBJ_KEY_WOW64; + + status = NtCreateKey( &subkey, access, attr, 0, class, options, dispos );
if (status == STATUS_OBJECT_NAME_NOT_FOUND) { @@ -162,7 +140,7 @@ static NTSTATUS create_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES if (!attr->RootDirectory && len > 10 && !wcsnicmp( buffer, L"\Registry\", 10 )) i += 10;
while (i < len && buffer[i] != '\') i++; - if (i == len && !force_wow32) return status; + if (i == len) return status;
attrs = attr->Attributes; attr->ObjectName = &str; @@ -171,16 +149,6 @@ static NTSTATUS create_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES { str.Buffer = buffer + pos; str.Length = (i - pos) * sizeof(WCHAR); - if (force_wow32 && pos) - { - if (is_wow6432node( &str )) force_wow32 = FALSE; - else if ((subkey = open_wow6432node( attr->RootDirectory ))) - { - if (attr->RootDirectory != root) NtClose( attr->RootDirectory ); - attr->RootDirectory = subkey; - force_wow32 = FALSE; - } - } if (i == len) { attr->Attributes = attrs; @@ -202,11 +170,6 @@ static NTSTATUS create_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES } } attr->RootDirectory = subkey; - if (force_wow32 && (subkey = open_wow6432node( attr->RootDirectory ))) - { - if (attr->RootDirectory != root) NtClose( attr->RootDirectory ); - attr->RootDirectory = subkey; - } if (status == STATUS_PREDEFINED_HANDLE) { attr->RootDirectory = get_perflib_key( attr->RootDirectory ); diff --git a/server/registry.c b/server/registry.c index bb52bf8c184..41df93f2676 100644 --- a/server/registry.c +++ b/server/registry.c @@ -2176,7 +2176,8 @@ DECL_HANDLER(create_key)
if (!objattr) return;
- if (!is_wow64_thread( current )) access = (access & ~KEY_WOW64_32KEY) | KEY_WOW64_64KEY; + if (!is_wow64_thread( current ) && !(objattr->attributes & OBJ_KEY_WOW64)) + access = (access & ~KEY_WOW64_32KEY) | KEY_WOW64_64KEY;
if (objattr->rootdir) {