Old 11th January 2012, 05:14   #1
jakc
Junior Member
 
Join Date: Sep 2011
Posts: 12
Question 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:

PHP Code:
Section "Check AGS" SEC01
 call CheckAGS
 Pop $R0
 messagebox MB_OK $AGSv 
SectionEnd

;Check to see if AGS is installed, and which version.  none9.310, (10.1)
Function 
CheckAGS
        ReadRegStr 
$1 HKLM "SOFTWARE\Wow6432Node\ESRI\Server10.0\CoreRuntime" "RealVersion"
${If} $!= ""
    
StrCpy $AGSv 2
    
return
${EndIf}
ReadRegStr $1 HKLM "SOFTWARE\Wow6432Node\ESRI\ArcServer\Microsoft .NET Framework Edition" "RealVersion"
${If} $!= ""
    
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:

PHP Code:
SetRegView 64
ReadRegStr 
$1 HKLM "SOFTWARE\ESRI\Server10.0\CoreRuntime" "RealVersion"
${If} $!= ""
    
StrCpy $AGSv 2
    
return
${EndIf}
ReadRegStr $1 HKLM "SOFTWARE\ESRI\ArcServer\Microsoft .NET Framework Edition" "RealVersion"
${If} $!= ""
    
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?
jakc is offline   Reply With Quote
Old 11th January 2012, 12:30   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 12th January 2012, 04:20   #3
jakc
Junior Member
 
Join Date: Sep 2011
Posts: 12
Perfect thanks!


PHP Code:
Function CheckAGS
SetRegView 32
ReadRegStr 
$1 HKLM "SOFTWARE\ESRI\Server10.0\CoreRuntime" "RealVersion"
${If} $!= ""
    
StrCpy $AGSv 2
    
return
${EndIf}
ReadRegStr $1 HKLM "SOFTWARE\ESRI\ArcServer\Microsoft .NET Framework Edition" "RealVersion"
${If} $!= ""
    
StrCpy $AGSv 1
    
return
${EndIf}
StrCpy $AGSv 0 ;not found
Messagebox MB_ICONSTOP 
"No AGS installation detected."
FunctionEnd 
jakc is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
registry

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump