George Hovhannisian
George Hovhannisian

Reputation: 707

Inno Setup - Force run in 32-bit mode

So, I've made a combo installer which should install one set of files if ran on 64-bit machine, and another if it's run on 32-bit machine.

I'm currently on a 64-bit machine. So is there a command line argument or any other way to simulate running in 32-bit mode? I just wanna check if it works as intended.

My code looks like this:

[Setup]
...
ArchitecturesInstallIn64BitMode=x64

[Files]
Source: "Win64Data\filename.ext"; DestDir: "{app}"; Flags: ignoreversion; Check: IsWin64
Source: "Win32Data\filename.ext"; DestDir: "{app}"; Flags: ignoreversion; Check: not IsWin64

Upvotes: 1

Views: 1697

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202672

No. There's no generic way to simulate a 32-bit system.

Of course, you can create a 32-bit virtual machine.


Though for your specific case, you have a full control. So just replace the IsWin64 function with a custom function that allows overriding with a command-line switch:

[Files]
Source: "Win64Data\filename.ext"; ...; Check: IsWin64Overridable
Source: "Win32Data\filename.ext"; ...; Check: not IsWin64Overridable

[Code]

{ @TLama's function from https://stackoverflow.com/q/14392921/850848 }
function CmdLineParamExists(const Value: string): Boolean;
var
  I: Integer;  
begin
  Result := False;
  for I := 1 to ParamCount do
    if CompareText(ParamStr(I), Value) = 0 then
    begin
      Result := True;
      Exit;
    end;
end;

function IsWin64Overridable: Boolean;
begin
  Result := IsWin64 and (not CmdLineParamExists('/Win32'));
end;

Upvotes: 2

Related Questions