-2

I have a program that integrates with explorer context menu. It works properly in Win32 but not in Win64. I've compiled the shell extension to Win64 but now I want to register that

The DLL file from the main program is 32 bit and I also want to keep the main program as 32 bit.

I want to access the CLSID key under in Wow6432Node under HKEY_CLASS_ROOT. I used RegDisableRef but it doesn't work

phuclv
  • 37,963
  • 15
  • 156
  • 475
drjackool
  • 483
  • 1
  • 4
  • 9
  • 1
    So your question is actually "How do I register a 64-bit shell extension from a 32-bit application?", if I understand you. Is that correct? (There's a lot of clutter there.) – Ken White Jan 10 '14 at 04:15
  • you said that the shell extension has been compiled to 64-bit but now why the DLL file is 32-bit? It'd be easier to have the whole program in the same bitness, since you only need to recompile the source code without worrying about the 64-32 cross process intercommunication – phuclv Sep 19 '18 at 14:57
  • This is the first x86 / x86-64 question I've seen that's *actually* talking about the Windows registry, not asm registers like RAX. And that's a lot of question over the years to get gold badges in them; many dozens of questions with that mistake. (Apparently a lot of non-native speakers mistranslate and write write "registry" in questions about CPU registers). After seeing the question title, I literally clicked on this expecting to click edit and change it to registers. :P Turns out, not an assembly-language question at all. – Peter Cordes Sep 19 '18 at 18:47

1 Answers1

2

Just like how files are redirected by WoW64, registry accesses are also redirected

The registry redirector isolates 32-bit and 64-bit applications by providing separate logical views of certain portions of the registry on WOW64. The registry redirector intercepts 32-bit and 64-bit registry calls to their respective logical registry views and maps them to the corresponding physical registry location. The redirection process is transparent to the application. Therefore, a 32-bit application can access registry data as if it were running on 32-bit Windows even if the data is stored in a different location on 64-bit Windows.

Registry Redirector

You need to specify KEY_WOW64_64KEY on the samDesired parameter when accessing 64-bit registry keys with RegCreateKeyEx, RegDeleteKeyEx or RegOpenKeyEx

The following flags enable 32-bit applications to access redirected keys in the 64-bit registry view and 64-bit applications to access redirected keys in the 32-bit registry view. These flags have no effect on shared registry keys. For more information, see Registry Keys Affected by WOW64.

Flag name Value Description
KEY_WOW64_64KEY 0x0100 Access a 64-bit key from either a 32-bit or 64-bit application.
KEY_WOW64_32KEY 0x0200 Access a 32-bit key from either a 32-bit or 64-bit application.
Windows 10 on ARM: This refers to the 32-bit ARM registry view for 32-bit ARM processes and the 32-bit x86 registry view for 32-bit x86 and 64-bit ARM64 processes.

Accessing an Alternate Registry View

However I think compiling the program in separate 32 and 64-bit versions will be easier. Most programs don't need to change when recompile. Moreover you'll still have to recompile the shell extension because 64-bit processes can't load 32-bit DLLs

phuclv
  • 37,963
  • 15
  • 156
  • 475