Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 2nd February 2012, 03:39   #1
sethradio
Junior Member
 
Join Date: Oct 2011
Posts: 20
Question How tell if the target is a 64-bit or not

Is there some way to create a script that tells whether the target computer is a 64-bit computer, and if it is, do some action that would not be done if it were a 32-bit machine?

Thanks in advance.
sethradio is offline   Reply With Quote
Old 2nd February 2012, 05:59   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
NSIS\Include\x64.nsh. Have you even *tried* searching? o_O
MSG is offline   Reply With Quote
Old 2nd February 2012, 12:49   #3
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
read help file chapter "4.2.3 Constants"
PHP Code:
  ;Var BITVERSION
  
;Var ERROR
  
;32/64bit
  
;Call bitversion
  
;StrCmp $ERROR "1" jump_error
Function bitversion
  GetVersion
::WindowsPlatformArchitecture
  Pop $BITVERSION
  StrCmp $BITVERSION 
"64" bit64
  StrCmp $BITVERSION 
"32" 0 error
  
;bit32:
    
SetRegView 32
    Sleep 500
    
Goto done
  bit64
:
    ; 
disable registry redirection (enable access to 64-bit portion of registry)
    
SetRegView 64
    Sleep 500
    
Goto done
  error
:
    
StrCpy $ERROR "1"
  
done:
  ;
messagebox mb_ok "'$BITVERSION'"
FunctionEnd 
Brummelchen is offline   Reply With Quote
Old 2nd February 2012, 14:59   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You don't need to use GetVersion for this, just use x64.nsh as MSG pointed out.
code:
${If} ${RunningX64}
...
${Else}
...

Stu
Afrow UK is offline   Reply With Quote
Old 2nd February 2012, 16:27   #5
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
well, actually i am working with that flag in $vars$bitversion instead logiclib
Brummelchen is offline   Reply With Quote
Old 2nd February 2012, 16:57   #6
sethradio
Junior Member
 
Join Date: Oct 2011
Posts: 20
Can't believe I completely forgot about x64.nsh.
sethradio is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Tags
32-bit, 64-bit, bit, nsis

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