Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 64-bit registry v.s. 32-bit registry

I heard on Windows x64 architecture, in order to support to run both x86 and x64 application, there is two separate/different sets of Windows registry -- one for x86 application to access and the other for x64 application to access? For example, if a COM registers CLSID in the x86 set of registry, then x64 application will never be able to access the COM component by CLSID, because x86/x64 have different sets of registry?

So, my question is whether my understanding of the above sample is correct? I also want to get some more documents to learn this topic, about the two different sets of registry on x64 architecture. (I did some search, but not found any valuable information.)

like image 655
George2 Avatar asked May 15 '09 16:05

George2


People also ask

What is 64-bit registry?

On 64-bit Windows, portions of the registry entries are stored separately for 32-bit application and 64-bit applications and mapped into separate logical registry views using the registry redirector and registry reflection, because the 64-bit version of an application may use different registry keys and values than the ...

Should I use 32-bit or 64-bit Windows?

Windows 10 64-bit is recommended if you have 4 GB or more RAM. Windows 10 64-bit supports up to 2 TB of RAM, while Windows 10 32-bit can utilize up to 3.2 GB. The memory address space for 64-bit Windows is much larger, which means you need twice as much memory than 32-bit Windows to accomplish some of the same tasks.

What is the difference between Microsoft 64-bit and 32-bit?

Computers running 64-bit versions of Windows generally have more resources such as processing power and memory, than their 32-bit predecessors. Also, 64-bit applications can access more memory than 32-bit applications (up to 18.4 million Petabytes).

How can I tell if an EXE is 32 or 64-bit?

If you are on Windows 7, on a Windows Explorer, right click on the executable and select Properties. At the properties window select the Compatibility tab. If under the Compatibility Mode section you see Windows XP, this is a 32 bit executable. If you see Windows Vista, it is 64 bit.


2 Answers

I ran into this issue not long ago. The short answer is that if you run a 32 bit application on a 64 bit machine then it's registry keys are located under a Wow6432Node.

For example, let's say you have an application that stores its registry information under:

HKEY_LOCAL_MACHINE\SOFTWARE\CompanyX 

If you compile your application as a 64 bit binary and run it on a 64 bit machine then the registry keys are in the location above. However, if you compile your application as a 32 bit binary and run it on a 64 bit machine then your registry information is now located here:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\CompanyX 

This means that if you run both the 32 bit and 64 bit versions of your application on the same machine then they will each be looking at a different set of registry keys.

like image 122
17 of 26 Avatar answered Sep 18 '22 05:09

17 of 26


Your understanding is correct. There wouldn't be any need for a x64 app to access the x86 CLSIDs since it could never load those components anyway and vice versa.

If you want to create component for use by both x86 and x64 then you need to either create a pair of dlls one built for x86 and the other for x64 and register both in their appropriate parts of the registry. The regsrv32.exe in the System32 folder will perversely register the x64 component and the regsrv32.exe in the SysWOW64 folder will register the x86 component.

Alternatively build a .NET assembly for Any CPU which can used by either CPU architecture.

like image 27
AnthonyWJones Avatar answered Sep 19 '22 05:09

AnthonyWJones