PDA

View Full Version : How tell if the target is a 64-bit or not


sethradio
2nd February 2012, 03:39
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.

MSG
2nd February 2012, 05:59
NSIS\Include\x64.nsh. Have you even *tried* searching? o_O

Brummelchen
2nd February 2012, 12:49
read help file chapter "4.2.3 Constants"
;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

Afrow UK
2nd February 2012, 14:59
You don't need to use GetVersion for this, just use x64.nsh as MSG pointed out.${If} ${RunningX64}
...
${Else}
...Stu

Brummelchen
2nd February 2012, 16:27
well, actually i am working with that flag in $vars$bitversion instead logiclib

sethradio
2nd February 2012, 16:57
Can't believe I completely forgot about x64.nsh.:weird: