Pascal Scripting: ProcessorArchitecture

Prototype:

function ProcessorArchitecture: TSetupProcessorArchitecture;

Description:

Returns the native processor architecture of the current system.

TSetupProcessorArchitecture is defined as:

TSetupProcessorArchitecture = (paUnknown, paX86, paX64, paIA64);

Remarks:

A 64-bit processor architecture will never be returned on 32-bit versions of Windows. Hence, you cannot use this function to detect a 64-bit AMD CPU on a 32-bit version of Windows; you'll just get back paX86 if you try.

paUnknown is returned if Setup/Uninstall does not recognize the processor architecture. It can be assumed that an "unknown" architecture is at least capable of executing 32-bit code, or Setup/Uninstall wouldn't be running at all.

If paIA64 is returned, and ia64 is not included in the value of the ArchitecturesInstallIn64BitMode [Setup] section directive, you should not assume that Inno Setup's 64-bit-only features are available -- for example, the {pf64} constant. Those features only work when IsWin64 returns True, and as documented, it may not return True on older Itanium versions of Windows that lack certain APIs Inno Setup requires.

Therefore, instead of:

  if ProcessorArchitecture = paIA64 then
    // perform some Itanium-specific install task that
    // involves expanding {pf64}

you should additionally check that IsWin64 returns True:

  if ProcessorArchitecture = paIA64 then
  begin
    if IsWin64 then
      // perform some Itanium-specific install task that
      // involves expanding {pf64}
    else
      // cannot use 64-bit features; display an error message,
      // fail silently, try something else, etc.
  end;

If ia64 is included in the value of the ArchitecturesInstallIn64BitMode [Setup] section directive, then it is not necessary to check IsWin64 because Setup will do so itself at startup, and fail with an error message (MissingWOW64APIs) if it is False.

Example:
var
  S: String;
begin
  case ProcessorArchitecture of
    paX86: S := 'x86';
    paX64: S := 'x64';
    paIA64: S := 'Itanium';
  else
    S := 'Unrecognized';
  end;
  MsgBox('Your processor architecture: ' + S, mbInformation, MB_OK);
end;
See also:

IsWin64
Is64BitInstallMode