Skip to content
⌘ NSIS Forum Archive

Problem using SetRegView

3 posts

jakc#

Problem using SetRegView

I am creating my first installer with NSIS, and learning a lot.
It is for a desktop Java application, and is 64bit only.
The installer actually exits at onInit if it detects its 32bit.

I have the below code that detects if some application (that's a 32bit native app) is already on the machine.
This code works fine, but I understand that using the Wow6432Node is not good practise, and that I should make use of SetRegView.

Existing Code:

Section "Check AGS" SEC01
 call CheckAGS
 Pop $R0
 messagebox MB_OK $AGSv 
SectionEnd
;Check to see if AGS is installed, and which version.  0 - none, 1 - 9.3, 2 - 10, (3 - 10.1)
Function CheckAGS
        ReadRegStr $1 HKLM "SOFTWARE\Wow6432Node\ESRI\Server10.0\CoreRuntime" "RealVersion"
${If} $1 != ""
    StrCpy $AGSv 2
    return
${EndIf}
ReadRegStr $1 HKLM "SOFTWARE\Wow6432Node\ESRI\ArcServer\Microsoft .NET Framework Edition" "RealVersion"
${If} $1 != ""
    StrCpy $AGSv 1
    return
${EndIf}
StrCpy $AGSv 0 ;not found
Messagebox MB_ICONSTOP "No AGS installation detected."
FunctionEnd 
If I ammend this code to change:

SetRegView 64
ReadRegStr $1 HKLM "SOFTWARE\ESRI\Server10.0\CoreRuntime" "RealVersion"
${If} $1 != ""
    StrCpy $AGSv 2
    return
${EndIf}
ReadRegStr $1 HKLM "SOFTWARE\ESRI\ArcServer\Microsoft .NET Framework Edition" "RealVersion"
${If} $1 != ""
    StrCpy $AGSv 1
    return
${EndIf} 
It still compiles, but always returns me a 0, indicating that its not finding the registry keys that I am expecting it to find.

Can someone point out where I am going wrong?
Afrow UK#
If you are looking for a key or value in Wow6432Node then SetRegView should be 32, not 64. When it is 32, Windows transparently redirects NSIS to Wow6432Node (because the installer is 32-bit). You disable this behaviour by setting SetRegView 64 (which is not what you want).

Stu
jakc#
Perfect thanks!


Function CheckAGS
SetRegView 32
ReadRegStr $1 HKLM "SOFTWARE\ESRI\Server10.0\CoreRuntime" "RealVersion"
${If} $1 != ""
    StrCpy $AGSv 2
    return
${EndIf}
ReadRegStr $1 HKLM "SOFTWARE\ESRI\ArcServer\Microsoft .NET Framework Edition" "RealVersion"
${If} $1 != ""
    StrCpy $AGSv 1
    return
${EndIf}
StrCpy $AGSv 0 ;not found
Messagebox MB_ICONSTOP "No AGS installation detected."
FunctionEnd