Jim Kita's MS Architecture Blog

Best Practices in Enterprise Application Architecture from an MS perspective.

  Home  |   Contact  |   Syndication    |   Login
  19 Posts | 0 Stories | 5 Comments | 0 Trackbacks

News

Archives

Pardon me if this is a “duh” topic, but it was new to me and so may be new to other developers too, so… The registry has changed under Windows 64 presumably starting from Windows Server 2003 64 bit and Windows XP 64 bit. As a result, there is a different view of the registry for 64 bit applications and 32 bit applications. According to the documentation:

“To support the co-existence of 32-bit and 64-bit COM registration and program states, WOW64 presents 32-bit programs with an alternate view of the registry. 32-bit programs see a 32-bit HKEY_LOCAL_MACHINE\Software tree (HKEY_LOCAL_MACHINE\Software\WOW6432Node) that is completely separate from the true 64-bit HKEY_LOCAL_MACHINE\Software tree.”

The Microsoft.Win32.RegistryKey library, predictably runs as a 32 bit application. You can safely add/read/remove keys and entries with this library and they will be safely mapped to the “WOW6432Node” transparently for you.

Things get hinky when using the regedit tool to add or remove keys/entries. The default version of regedit is a 64 bit application and therefore has access to all registry entries, but with a 64 bit view. If you add an entry in the path that you are accustomed to, either manually or through a script, the items will appear only to 64 bit applications, and therefore NOT visible to the .NET application that makes use of the Win32 library. One has two options for working around this behavior. If you are aware of the “WOW5432Node” you can mentally make your changes under that node and/or modify your scripts to include that path. Alternatively there exists a 32 bit version of regedit that acts and behaves like a 32 bit application with the all 32 bit keys properly mapped. You may access this version of regedit with the following command:

“%systemroot%\syswow64\regedit”

Obviously this version is only available on 64 bit OSes and you must close the 64 bit version of regedit before opening a 32 bit version. So by using the 32 bit version of regedit all of your existing scripts and .NET applications will remain compatible with 64 bit versions of Windows, which is the approach that I prefer.

posted on Friday, September 03, 2010 11:07 AM
Comments have been closed on this topic.