Click here to Skip to main content
14,691,272 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing VC++ Project. It is a 32-bit application. In Prerequisites check, I am accessing some registry keys/values from this Project. My application is working fine on 32-bit machine. On 64-bit machine, prerequisities check is failing. I am trying to access a registry key under HKLM\SOFTWARE\Microsoft\Microsoft Operations Manager as below:

regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS", true);

On 64-bit machine, the code is checking under HKLM\SOFTWARE\Wow6432Node\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS, where the key is not present.

I tried to Disable registry redirection but with no luck. The code for Disbaling Redirection is


Type type = typeof(RegistryKey);

FieldInfo fi = type.GetField("hkey", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Instance);

SafeHandle handle = (SafeHandle)fi.GetValue(regKey);

IntPtr realHandle = handle.DangerousGetHandle();

int errorCode = RegDisableReflectionKey(handle.DangerousGetHandle());
Posted
Comments
AAv.Soft 2-Jan-14 6:27am
   
How about Reading a 64bit registry key from 32bit app, in VB.NET?

What is the value of "errorCode" when running your sample ?
   
The value of errorCode is 0. It should be ERROR_SUCCESS. Please correct me if I've misunderstood anything here.
   
I'm trying to find how we can do too!!
If you find something on this purpose try to write somthing here please :-D .
I call you if I fing anything!!
See you
   
on Msdn website they talk about a solution!!
But for me it's not a way! They talk about make a copy of the 32 bits Node in the same place in the 64Node!! X|
I'm digging!! :doh:
   
Could you please elaborate your issue more clearly. In my case, I was struggling with "Failed Install-Check because of Registry Redirection". So I did some changes in my Installer to refer correct registry under appropriate registry view. I did refer a useful MSDN article Accessing an Alternate Registry View

Thanks.
   
In my case, I try to keep the value of a key.
This key comming from a 32 bits soft installation and my system is in 64 bits.
It means that when a user try to access to this key, if he is in 64bits it will not work.

My key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\...\InstallProperties

When I check with a VB.net program that return:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\...\InstallProperties
   
Comments
AAv.Soft 3-Jan-14 5:36am
   
That is my problem too.
How to READ 64bit registry key from 32bit app, in VB.NET...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900