Search code examples
node.jsregistrynsis

Can't access some registry keys


I'm trying to access node's version number in a NSIS Script in order to know if i need to upgrade node.js' or not. To do that, I noticed that the key HKLM\SOFTWARE\Node.js\ServerType contains the number I need.

I tried to access it via :

ReadRegStr $0 HKLM "SOFTWARE\Node.js" ServerType

But it doesn't work and $0 is always empty.

I also have a strange behavior using these keys :

ReadRegStr $0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" CurrentVersion

returns me the good version for the Java JRE, BUT when I change it manually in the registry, it doesn't change when I run the NSIS installer => I have the feeling that the installer is not reading it at the path I set (installer in x86 and OS in x64 conflict maybe ?).

I'm a bit lost and dunno what to do next. Do you have any ideas ?


Solution

  • On 64-bit versions of Windows 32-bit apps see a special 32-bit view of the registry and this is not the same as what you see in Regedit. In Regedit the basis for these keys are under Wow6432Node. Some keys are also shared by both views.

    To access the 64-bit view in NSIS you can use the SetRegView instruction.