Joshua
Joshua

Reputation: 277

Use both 32-bit and 64-bit version of rundll32.exe in Inno Setup

I want to convert theses two lines that I have in a batch file to Inno Setup [Run] section:

%windir%\SysWOW64\rundll32.exe "%~dp0my32.dll",RegDll
%windir%\system32\rundll32.exe "%~dp0my64.dll",RegDll

So I want something like this (but working):

[Run]
Filename: "{sys}\rundll32.exe"; Parameters: ""{code:GetDir|0}\my64.dll",RegDll"; WorkingDir: "{code:GetDir|0}"; StatusMsg: "Registering Module..."; MinVersion: 0.0,5.0; Flags: runhidden runascurrentuser
Filename: "{syswow64}\rundll32.exe"; Parameters: ""{code:GetDir|0}\my32.dll",RegDll"; WorkingDir: "{code:GetDir|0}"; StatusMsg: "Registering Module..."; MinVersion: 0.0,5.0; Flags: runhidden runascurrentuser

Upvotes: 2

Views: 880

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202088

Your code is correct in 64-bit install mode, i.e. if you have ArchitecturesInstallIn64BitMode set:

[Setup]
ArchitecturesInstallIn64BitMode=x64 

In 32-bit install mode, Inno Setup, being 32-bit application, will get redirected to C:\WINDOWS\SysWOW64, when it tries to access C:\Windows\System32. So effectively, both sys and syswow64 map to the same [32-bit] folder (C:\WINDOWS\SysWOW64).

You can override that (if you do not want to switch to 64-bit install mode) by using 64bit flag:

[Run]
Filename: "{sys}\rundll32.exe"; Parameters: """{code:GetDir|0}\my64.dll"",RegDll"; \
    WorkingDir: "{code:GetDir|0}"; StatusMsg: "Registering Module..."; \
    MinVersion: 0.0,5.0; Flags: runhidden runascurrentuser; Flags: 64bit;
Filename: "{sys}\rundll32.exe"; Parameters: """{code:GetDir|0}\my32.dll"",RegDll"; \
    WorkingDir: "{code:GetDir|0}"; StatusMsg: "Registering Module..."; \
    MinVersion: 0.0,5.0; Flags: runhidden runascurrentuser; Flags: 32bit;

Upvotes: 1

Related Questions