An Easy Fix for Registry Access for 32-bit Applications in 64-bit OSes

My company has a 32-bit application that is frequently run in a 64-bit environment. There are some registry settings retrieved by this application that exist in the WoW6432Node in a 64-bit OS, but how can we make our application smart enough to look there without breaking backward compatibility with 32-bit operating systems or sacrificing future compatibility if our application is converted to 64-bit?

One option is to implement a solution like what’s described here. You can add logic to your application to determine whether the OS is 32 or 64 bit and access the appropriate key.

That’s great, but it’s a lot of work for a setting in my application that’s read once during initialization. Instead of going through all that trouble, I just implemented a simple retry algorithm to look in Wow6432Node if the key isn’t found in the default expected location.

var regKey = GetRegistryKey(@"SOFTWARE\MyCompany\Settings");
if (regKey == null)
    regKey = GetRegistryKey(@"SOFTWARE\Wow6432Node\MyCompany\Settings");
    if (regKey == null)
        throw new InvalidOperationException(
            @"Unable to find registry key HKLM\SOFTWARE\MyCompany\Settings");

internal virtual RegistryKey GetRegistryKey(string path)
    return Registry.LocalMachine.OpenSubKey(

It’s simple and it works–terrific!


Author: Adam Prescott

I'm enthusiastic and passionate about creating intuitive, great-looking software. I strive to find the simplest solutions to complex problems, and I embrace agile principles and test-driven development.

One thought on “An Easy Fix for Registry Access for 32-bit Applications in 64-bit OSes”

  1. This post and many other on your website are very interesting.
    You should show your content to bigger audience. There is a big chance to go viral.

    You need initial boost and visitors will flood your website in no
    time. Simply search in google for:
    Juuri13 viral effect

Leave a comment

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

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

Facebook photo

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

Connecting to %s

%d bloggers like this: