0

I have created a subkey in the registry, HKEY_LOCAL_MACHINE\SOFTWARE\MyApp\APIConnector. When I load this subkey using Visual Studio's Immediate windows while no launched app is running, I can read the subkey.

However, when my application looks for HKEY_LOCAL_MACHINE\SOFTWARE\MyApp\APIConnector, it cannot find it. It cannot even find HKEY_LOCAL_MACHINE\SOFTWARE\MyApp. It's as if there's a different

However, when I am running an application in debug mode and it is paused, the exact same code cannot find HKEY_LOCAL_MACHINE\SOFTWARE\MyApp let alone HKEY_LOCAL_MACHINE\SOFTWARE\MyApp\APIConnector.

After a bit of digging around, it looks like I've fallen victim to registry virtualization. So I added a manifest that makes the app require administrator rights (UAC dialog), but registry virtualization is still occurring. Microsoft documentation on the matter asserts that this should not be the case. Help!

Steve
  • 8,066
  • 11
  • 70
  • 112
  • Perhaps you're being affected by Wow64 registry redirection instead (or along with?) registry virtualization: http://msdn.microsoft.com/en-us/library/aa384253.aspx Windows sure has a lot of smoke and mirrors going on when accessing the registry. – Michael Burr Mar 19 '12 at 05:24
  • Yes, WoW64 is the culprit. For some reason the assembly was targeting x86 instead of Any CPU. I changed it to Any CPU and it worked. Turn your comment into an answer and I will accept it. Thanks :) – Steve Mar 19 '12 at 13:45
  • @Steve You really don't want to require admin rights. – David Heffernan Mar 19 '12 at 13:50
  • I added admin rights only to check a hunch. As it turns out, it made no difference. – Steve Mar 19 '12 at 13:54

1 Answers1

2

Perhaps you're being affected by Wow64 registry redirection instead (or along with?) registry virtualization:

Windows sure has a lot of smoke and mirrors going on when accessing the registry.

Michael Burr
  • 333,147
  • 50
  • 533
  • 760
  • Now building as Any CPU (was x86) to take WoW64 out of the picture. Problem solved. Thanks. – Steve Mar 19 '12 at 14:47