Accessing an Alternate Registry View Home
This page is specific to:.NET Framework Version:3.0
Accessing an Alternate Registry View

By default, a 32-bit application running on WOW64 accesses the 32-bit registry view and a 64-bit application accesses the 64-bit registry view. The following flags enable 32-bit applications to access redirected keys in the 64-bit registry view and 64-bit applications to access redirected keys in the 32-bit registry view. These flags have no effect on shared registry keys. For more information, see Registry Keys Affected by WOW64.

Flag nameValueDescription
KEY_WOW64_64KEY0x0100Access a 64-bit key from either a 32-bit or 64-bit application.
Windows 2000:  This flag is not supported.
KEY_WOW64_32KEY0x0200Access a 32-bit key from either a 32-bit or 64-bit application.
Windows 2000:  This flag is not supported.

 

These flags can be specified in the samDesired parameter of the following registry functions:

Either KEY_WOW64_32KEY or KEY_WOW64_64KEY can be specified. If both flags are specified, the function fails with ERROR_INVALID_PARAMETER.

Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP:  If both flags are specified, the function’s behavior is undefined.

The RegDeleteKey function cannot be used to access an alternate registry view.

The following are best practices when accessing the registry from an application:

  • After the application has accessed an alternate registry view using one of the flags, all subsequent operations (create, delete, or open) on child registry keys must explicitly use the same flag. Otherwise, there can be unexpected behavior.
  • To accurately enumerate all keys in both views, perform the enumeration in two passes. The first pass should use a handle opened with one of the flags, and the other pass should use a handle opened with the other flag.

Note  The Wow6432Node key is reserved. For compatibility, applications should not use this key directly.

For information about accessing the alternate registry view through WMI, see Requesting WMI Data on a 64-bit Platform.

See Also

Registry Redirector
Registry Reflection

Send comments about this topic to Microsoft

Build date: 10/8/2009

Community Content

Avoid use of Wow6432Node in 32-bit code
Added by:Gideon7

Do not try to open Wow6432Node to view the alternate registry hive in 32-bit code. Instead open the desired branch (e.g., HKLM\Software\Microsoft\xxx) with the KEY_WOW64_64KEY flag as shown above.

When using the registry API (e.g., RegOpenKeyEx and RegEnumKeyEx) in 32-bit code, Wow6432Node acts like a symbolic link that loops back to HKLM\Software in the 32-bit hive. It does not map into the 64-bit hive as you might expect.

The 64-bit REGEDT32 works as expected and shows the 'other' hive (32-bit) under Wow6432Node.

The non-intuitive behavior of Wow6432Node might change post-Vista-SP1 - as hinted above - to something else. As a general rule you should never open Wow6432Node in your code. Instead use KEY_WOW64_xxx as required. This applies to both both 32-bit and 64-bit code.

Windows Server 2008: In the 32-bit hive the registry key HKLM\Software\Wow6432Node is hidden from RegEnumKeyEx.

Using the KEY_WOW64_32KEY and KEY_WOW64_64KEY in Windows 2000 will result in failure
Added by:luxspes
This page states that the "KEY_WOW64_64KEY" and "KEY_WOW64_32KEY" are "not supported" in Windows 2000, but what it should say is that if you try to use them, the registry functions will fail to work, if you want to write code that can run in Windows 2000, avoid this flags.
© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View