If you are migrating a 32 bit application from Vista x64 to Windows 7 x64 and your application relies on some information in registry. There are few things you should consider as following.
In Windows 7, registry is virtualized. As a result, wow64 applications don’t have to explicitly provide registry path with Wow6432Node node. For example if you have to probe 32 bit .Net SDK’s location, you don’t have to use path like path \SOFTWARE\
\Microsoft\.NETFramework from your 32 bit app. Using just \SOFTWARE\Microsoft\.NETFramework should direct your application to an entry under Wow6432Node.
For example, If you are using RegistryKey class in a 32 bit managed application running on 64 bit Win7 and something like
You will be routed to \SOFTWARE\
\Microsoft\.NETFramework and get null key returned.
Let me show you an example.
Although, On Windows 7, it is not needed to check platform before reading and writing in registry but to make things clear, I am going to use a method called
Depending upon the processor and
property returned by System.Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE") and WMI, I am figuring if the process is pure x86, x64 or WOW64 (32 bit process on 64 bit operating system.
//Logic to check architecture and verified it using three flags (X86,X64 and SysWOW64). I called this Method CheckArchitecture()
public static string CheckArchitecture()// Return one of these values (X64, X86, SysWOW64, Unidentified)
SCREEN SHOT 1 : 32 bit Windows 7 & 32 Bit application.
SCREEN SHOT 2 : 64 bit Windows 7 & 64 Bit application.
SCREEN SHOT 3 : 64 bit Windows 7 & 32 Bit application.
Note : Although values for 32 bit and 64 applications are different. Application queries same registry key in all three cases (Software\Microsoft\.NETFramework). OS itself mapped the 32 bit and SysWOW64 request to SOFTWARE\Wow6432Node\Microsoft\.NETFramework.
Author : Runeet(MSFT), SQL Developer Engineer, Microsoft
Reviewed by : Snehadeep(MSFT), SQL Developer Engineer, Microsoft