0

I need to read default value of HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID{CF2CF428-325B-48d3-8CA8-7633E36E5A32}\InprocServer32

In my Project options "Prefer 32-Bit" is unchecked and Platform target is Any CPU, i'm running on Windows-7 64 Bit operating system.

I tried everything and read A LOT of topics about this issue but i can't still read this value.

Please, can you write the actual code ?

I Tried,

RegistryKey LocalMachine32 = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry32);
RegistryKey location = LocalMachine32.OpenSubKey(@"Software\Wow6432Node\Classes\CLSID\{CF2CF428-325B-48d3-8CA8-7633E36E5A32}\InprocServer32", true);
String myValue = location.GetValue("").ToString();

.

RegistryKey LocalMachine64 = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);
RegistryKey location = LocalMachine64.OpenSubKey(@"Software\Wow6432Node\Classes\CLSID\{CF2CF428-325B-48d3-8CA8-7633E36E5A32}\InprocServer32", true);
String myValue = location.GetValue("").ToString();

.

RegistryKey LocalMachine64 = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);
RegistryKey location = LocalMachine64.OpenSubKey(@"Software\Classes\CLSID\{CF2CF428-325B-48d3-8CA8-7633E36E5A32}\InprocServer32", true);
String myValue = location.GetValue("").ToString();

.

RegistryKey LocalMachine32 = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry32);
RegistryKey location = LocalMachine32.OpenSubKey(@"Software\Classes\CLSID\{CF2CF428-325B-48d3-8CA8-7633E36E5A32}\InprocServer32", true);
String myValue = location.GetValue("").ToString();

But no luck :(

Trax
  • 943
  • 2
  • 12
  • 30

1 Answers1

0

As far as I'm aware you cannot do this with .NET Framework calls; in the past I've used P/Invoke calls to advapi32.dll's RegOpenKeyEx, RegQueryValueEx, and RegQueryValueEx methods to read from a specific bitness registry.

Here is an article with an example of doing this:

http://blogs.msdn.com/b/cumgranosalis/archive/2005/12/19/win64registrypart2.aspx

Edit: The reason it doesn't work in Windows 7 (along with other potentially helpful resources) is discussed here:

How to open a WOW64 registry key from a 64-bit .NET application

Community
  • 1
  • 1
Matt Burnell
  • 2,646
  • 1
  • 22
  • 23