To get a trial key
fill out the form below
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement

Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

Free PVS-Studio license for Microsoft MVP specialists
** By clicking this button you agree to our Privacy Policy statement

To get the licence for your open-source project, please fill out this form
** By clicking this button you agree to our Privacy Policy statement

I am interested to try it on the platforms:
** By clicking this button you agree to our Privacy Policy statement

Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
WOW6432Node and API-functions RegOpenKe…

WOW6432Node and API-functions RegOpenKeyEx / RegEnumKeyEx

Jan 24 2011
Author:

The register in 64-bit Windows versions is subdivided into 32-bit and 64-bit hives. Most 32-bit hives have the same names as their counterparts in the 64-bit hives and vice versa. By default, 32-bit hives are displayed in the WOW6432Node node in 64-bit Windows versions. The redirection process is transparent for 32-bit applications, i.e. they can access the register hives as if they worked in the 32-bit environment despite the fact that the data are stored in a different place.

This behavior causes issues when 32-bit applications try to access the WOW6432Node node using of Windows API functions (for instance, RegOpenKeyEx and RegEnumKeyEx). When accessing the HKLM\Software\Wow6432Node node, the redirection mechanism is launched and an eternal loop of the "HKLM\Software\Wow6432Node\Wow6432Node\Wow6432Node\... and so on" kind occurs. You might often encounter such errors in various 32-bit register management utilities like, for instance, here.

Beginning with Windows Server 2008, the HKLM\Software\Wow6432Node node is hidden from the RegEnumKeyEx function, although it does not guarantee that an eternal recursion will not occur when trying to directly access this node.

But if you want to work with 64-bit register hives from a 32-bit program, you should open the HKLM\Software node using the KEY_WOW64_64KEY key. But do not try to get a direct access to WOW6432Node and avoid creating new register nodes with the same name.

As an example of an error related to WOW6432Node, consider the defect in a program system consisting of 32-bit and 64-bit units that interact with each other and use different register presentations. The following line in a 32-bit unit stopped working in one program:

lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
  "SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources", 0,
  KEY_QUERY_VALUE,  &hKey);

To make this program friends with other 64-bit parts, you should add the KEY_WOW64_64KEY key:

lRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
  "SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources", 0,
  KEY_QUERY_VALUE | KEY_WOW64_64KEY,  &hKey);

References

Popular related articles
macOS 10.15 no longer supports 32-bit apps. What can you do?

Date: Oct 15 2019

Author: Sergey Khrenov

On October 7, 2019, Apple released a new version of its Mac operating system, macOS Catalina. Version 10.15 contains many changes and improvements. One of the significant is the complete phasing out …
If the coding bug is banal, it doesn't mean it's not crucial

Date: Apr 19 2017

Author: Andrey Karpov

Spreading the word about PVS-Studio static analyzer, we usually write articles for programmers. However, some things are seen by programmers quite one-sided. That is why there are project managers wh…
Detecting Overflows of 32-Bit Variables in Long Loops in 64-Bit Programs

Date: Mar 22 2016

Author: Andrey Karpov

One of the problems that 64-bit software developers have to face is overflows of 32-bit variables in very long loops. PVS-Studio code analyzer is very good at catching issues of this type (see the Vi…
Is it possible to run 64-bit applications in a 32-bit OS?

Date: Dec 08 2015

Author: Andrey Karpov

Nowadays 64-bit operating systems are very widespread. But 32-bit OS are still present on the market, in quite obvious quantities. A lot of modern program tools are developed to be run only in 64-bit…
How to Port a 9 Million Code Line Project to 64 bits?

Date: Aug 03 2015

Author: Evgenii Ryzhkov, Ilya Ivanov

Our team has recently finished porting one pretty large project (9 million code lines, 300 Mbytes of source files) to the 64-bit platform. It took us one year and a half. Although we are not permitte…

Comments (0)

Next comments
Unicorn with delicious cookie
Our website uses cookies to enhance your browsing experience.
Accept