Search code examples
inno-setuppascalscript

Custom setup on operating system and architecture


I have been asked to have a setup procedure running in the following operating systems:
Windows Vista (only x86) and higher (both x86 and x64)

In order to restrict whole setup from running in older operating systems I added into [Setup] section the Minversion=0,6.0.6000 that corresponds to Windows Vista.

I wonder if in Pascal scripting it is possible to apply a conditional installation like the following:

[Run]

Filename: "{tmp}\mysetup.exe"; Components: Install; MinVersion: 0,6.0.6000; Check: not Iswin64;

Filename: "{tmp}\mysetup.exe"; Components: Install; MinVersion: 0,6.1.7600;

This way mysetup.exe should run only on Vista x86 and on all higher operating systems.


Solution

  • Use GetWindowsVersion and IsWin64 support functions:

    if ((GetWindowsVersion >= $06000000) {Vista} and (not IsWin64)) or
       (GetWindowsVersion >= $06010000) {7} then
    begin
      // Install
    end;