Search code examples
c#wixregistrywow64

How to create a shared registry key for WoW64 and x64 Processes


Is there some way to create a custom (WoW64) shared registry key?

By default some registry keys are shared and others are redirected (see MSDN). But I want to create a custom registry key under HKLM\Software which should be shared. I'm looking for a solution in C# (maybe P/Invoke) and WIX.


Solution

  • If you add the KEY_WOW64_32KEY flag to RegCreateKeyEx (or RegOpenKeyEx) you will always access the 32 bit registry.

    I couldn't find this flag (nor KEY_WOW64_64KEY which is the same but for 64bit access) in the Wix source code, so you might need to use pinvoke.