PDA

View Full Version : Get Registry Key Value fails on 64 bit?



MarkDynna
09-09-2014, 08:51 AM
Is there any logical reason why a call to retrieve this key value:
HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\MUNISOFT\setup\SQLPath

works fine on 32 bit systems, but doesn't on 64 bit? I have manually verified that the key exists in the exact place that it is expected on 64 bit systems, the only difference is the actual text value in the key field.

On 64 bit systems, the value returned is always the default, and I'm not sure why?

linder
09-09-2014, 10:06 AM
Mark,

Some interesting reading (and demo) on how to how to handle 64-bit registry keys.

http://www.lindersoft.com/forums/showthread.php?p=55620#post55620

You have to switch into 64-bit mode to access the 64-bit registry branch.

Friedrich

MarkDynna
09-09-2014, 10:09 AM
Would this also apply to Get Related Product calls?

linder
09-09-2014, 10:13 AM
I am afraid I don't understand the question, sorry.

Friedrich

linder
09-09-2014, 10:16 AM
BTW, the key you mentioned:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MUNISOFT\setup\SQLPath

is located in the 64-bit registry branch on x64 systems and so you have to switch into x64 mode to read/write it.

The same key as 32-bit looks like this on x64 systems:

HKEY_LOCAL_MACHINE\Software\WOW6432node\Microsoft\ Microsoft SQL Server\MUNISOFT\setup\SQLPath

Friedrich

MarkDynna
09-09-2014, 10:20 AM
BTW, the key you mentioned:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MUNISOFT\setup\SQLPath

is located in the 64-bit registry branch on x64 systems and so you have to switch into x64 mode to read/write it.

The same key as 32-bit looks like this on x64 systems:

HKEY_LOCAL_MACHINE\Software\WOW6432node\Microsoft\ Microsoft SQL Server\MUNISOFT\setup\SQLPath

Friedrich

Yes, except on the 64 bit machine the SQL server gets installed as a "legit" 64 bit app, so the registry is actually in the same place on a 64 bit machine (it does not) exist in the WOW6432node branch.

However, from your documentation I take it that the installer - as a 32 bit app - has its registry call automatically redirected to WOW6432node?

linder
09-09-2014, 10:33 AM
The Windows operating system handles this redirection completely behind-the-scenes.

32-bit keys are are stored in the following registry sub key on machines running a x64 OS:

HKEY_LOCAL_MACHINE\Software\WOW6432node

64-bit keys are are stored in the following registry sub key:

HKEY_LOCAL_MACHINE\Software

To access the 64-bit branch, you simply switch the installer into 64-bit mode and then you can access the native 64-bit resources. Don't forget to switch back to 32-bit mode after you have processed the 64-bit part.

Friedrich

linder
09-09-2014, 10:38 AM
Here is an example from one of the include scripts. It reads the 64-bit registry keys when running on a 64-bit OS.

Friedrich

MarkDynna
09-09-2014, 11:05 AM
The Windows operating system handles this redirection completely behind-the-scenes.

32-bit keys are are stored in the following registry sub key on machines running a x64 OS:

HKEY_LOCAL_MACHINE\Software\WOW6432node

64-bit keys are are stored in the following registry sub key:

HKEY_LOCAL_MACHINE\Software

To access the 64-bit branch, you simply switch the installer into 64-bit mode and then you can access the native 64-bit resources. Don't forget to switch back to 32-bit mode after you have processed the 64-bit part.

Friedrich

So even though the request is made for the exact correct registry path, Windows silently redirects the call to the WOW6432node branch because the SetupBuilder installation is a 32 bit app? Neat (but annoying).

linder
09-09-2014, 11:14 AM
Annoying? Why? It's not annoying at all. It's very very cool. You can access both 32-bit and 64-bit keys from the very same setup without any problem. So why do you think this powerful feature is "annoying"? This functionality is there for 9+ years now.

Friedrich

MarkDynna
09-09-2014, 11:37 AM
Annoying? Why? It's not annoying at all. It's very very cool. You can access both 32-bit and 64-bit keys from the very same setup without any problem. So why do you think this powerful feature is "annoying"? This functionality is there for 9+ years now.

Friedrich

Oh, I wasn't referring to the SB functionality. The feature in SB is great - I'm sure it will help us work around the problem in the future.

My annoyance is mostly due to deadline-related pressures, and discovering a 100% silent Windows "feature" this late in our testing. Thanks for your help.

linder
09-09-2014, 11:42 AM
Aha, okay :) If you need help, just let me know. We are doing this x86 / x64 stuff for 10+ years and UAC for more than 7 years now :)

Good luck with your project.

Friedrich