Skip to content
⌘ NSIS Forum Archive

how to read registry entries from 64 bit systems

8 posts

dhiraj3301#

how to read registry entries from 64 bit systems

Hello,

i have use folllowing commang to read the installed instances of sqlserver 2008
${registry::Read} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server" "InstalledInstances" $R0 $R1

this works fine for sqlserver for x86 machine,but for x64 machine it will find the Installedinstances from SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server" "InstalledInstances"

but i want registry entries from SOFTWARE\Microsoft\Microsoft SQL Server" "InstalledInstances" so i have used following code

SetRegView 64
${registry::Read} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\$4" "InstalledInstances" $R0 $R1

but it still shows me data in SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server" "InstalledInstances"

please suggest what i have to do to read entries from "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server" "InstalledInstances"

Thanks,
Dhiraj
MSG#
In the registry plugin thread I see a post stating that REG_MULTI_SZ values aren't properly read from x64 registry. Perhaps that is your problem?

If you want to read a registry value into a string, you can always just use the normal command: http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.2.12
dhiraj3301#
I can not use normal command (Readregstr)because it is not reading multiple values.
I want to read value from "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server" "InstalledInstances"
which are
e.g.
SQLEXPRESS
Sqltest

for reading this value i require ${registry::Read} command,can anyone tell me why SetRegView 64 is not working

Thanks,
Dhiraj
Afrow UK#
SetRegView ensures NSIS opens/creates/deletes keys using KEY_WOW64_64KEY. The registry plug-in does not seem to have a switch to enable the use of KEY_WOW64_64KEY. You need to contact the author.

Stu
dhiraj3301#
can anyone please tell what to do to read registry entry in native section(64 bit section)on 64 bit machine.i have read the blogs but i didn't find exact solution for it

Thanks,
Dhiraj
Afrow UK#

By default, a 32-bit application running on WOW64 accesses the 32-bit registry view and a 64-bit application accesses the 64-bit registry view.


Stu
MSG#
Originally Posted by dhiraj3301 View Post
I can not use normal command (Readregstr)because it is not reading multiple values.
Have you considered using EnumRegValue?