Vadim's Weblog

Never stop learning.

WoW64 and the registry.

Posted by Vadim on January 25, 2009

Technorati Tags: ,,,

Have you ever had a case that one application cannot find a registry key while another one doesn’t have any problem accessing the same entry?  It happened to me. 

If you think it’s a security issue, I have to tell you that in case it’s not security fault. 

To be fair to you I need to give some more information which I withheld from you so far.

I ran both application on 64-bit OS.  The first application, that cannot read the specific registry key, is 32-bit app. and the second one is 64-bit app.

The both application are trying to access registry using the same statement.  Something like this:

LocalMachine.OpenSubKey(@"SOFTWARE\MyCompany");

When 64-bit application executes the line above, it will try to retrieve HKLM\SOFTWARE\MyCompany subkey.  However, when 32-bit application executes the same statement on 64-bit OS, it will retrieve HKLM\SOFTWARE\Wow6432Node\MyCompany.

All 32-bit applications are executed in WoW64 (Windows-on-Windows 64-bit) subsystem.

To fix this issue, I just copy MyCompany key under Wow6432Node key.

2 Responses to “WoW64 and the registry.”

  1. Anonymous said

    Thanks, you saved me time!

  2. Anonymous said

    It’s a pity that LocalMachine.OpenSubKey() doesn’t expose the KEY_WOW64_64KEY flag.

    That would be a better solution because it avoids duplicating data and you don’t have to worry about keeping the two registry locations consistent.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: