Archive: Check for 64 bit CPU


Check for 64 bit CPU
I am looking for a way to check the architecture of the cpu (32bit or 64bit). My installation script should deny a installation on a 64 bit system.

Thanks for your help.


The Debian installer has a plug-in that uses cupid to find out the processor architecture.

In case you just want to install on a 32-bit OS, you can use ${RunningX64} from x64.nsh.


!ifndef PROC
!define PROC 32 ; to be defined in cmd line
!endif
LangString wrongWow ${LANG_ENGLISH} "This distribution is for ${PROC} bits computers only."

Function .onInit

System::Call "kernel32::GetCurrentProcess() i .s"
System::Call "kernel32::IsWow64Process(i s, *i .r0)"
IntCmp $0 0 is32
IntCmp ${PROC} 64 procOk
wrongProc:
MessageBox MB_OK|MB_ICONSTOP $(wrongWow)
Abort $(wrongWow)
is32:
IntCmp ${PROC} 32 procOk wrongProc wrongProc
procOk:
...

That would only work if the user is running on x64 OS.


This script works on all systems. Attached is a popup of x64 package on my 32-bits XP. Normall command file defines PROC for makensis.


IsWow64Process tests if the OS is running x64. It won't tell you the real processor capability. It's what ${RunningX64} does.

If you want to know the real capability of the processor itself and not the OS, you have to use cpuid. Even GetNativeSystemInfo returns x86 while running XP on x64. And that API is not even available on versions below XP.


You probably have a good reason for deny the installer to run on 64Bit Win OS,

But keep in mind that 32Bit installer and applications just work fine in most cases.


SCSI passthrough driver included to package and it not works on wrong OS.. So we have 2 packages, 32 and 64.


"SCSI passthrough driver", yes that IS a good reason! ;)