是否可以在 Inno Setup(32 或 64 位)中设置安装模式?

是否可以在 Inno Setup(32 或 64 位)中设置安装模式?

问题描述:

我知道指令 ArchitecturesInstallIn64BitMode=x64 ia64 可以设置,以便 Inno Setup 决定处理器类型并在可能的情况下安装 64 位.

I know that the directive ArchitecturesInstallIn64BitMode=x64 ia64 can be set, so that Inno Setup will decide on the processor type and install in 64 bit if its possible.

但我需要一些 [Code] 部分功能来设置安装模式(32 或 64).

But I need some [Code] section function to set the install mode (32 or 64).

有可能吗?

示例:

此函数将返回 Java 安装架构(32 位或 64 位):

This function will return the Java installation architecture (32 or 64):

function CheckJavaInstallation()

根据结果我想将 Inno Setup 设置为正确的安装模式 -> 选择正确的 Program FilesProgram files (x86) 并在正确的注册表(普通或 WOW6432Node).

According to the result I want to set Inno Setup to the correct install mode -> Selection of the correct Program Files or Program files (x86) and in the correct registry (normal or WOW6432Node).

我建议您创建两个检查器函数:IsJava32IsJava64.然后,对于每个文件、注册表项等,您可以使用其中一个检查器添加两个版本,例如:

I would suggest you to create two checker functions: IsJava32 and IsJava64. Then for every file, registry entry, etc you add the two versions with one of the checkers, example:

[Files]
Source: "SourceSetupDir32aFile1.dll"; DestDir: "{pf32}{#MyAppName}"; Check: IsJava32;
Source: "SourceSetupDir64aFile1.dll"; DestDir: "{pf64}{#MyAppName}"; Check: IsJava64;
;...
Source: "SourceSetupDir32aFile4.dll"; DestDir: "{pf32}{#MyAppName}"; Check: IsJava32;
Source: "SourceSetupDir64aFile4.dll"; DestDir: "{pf64}{#MyAppName}"; Check: IsJava64;

[Registry]
Root: HKCU32; Subkey: "SoftwareMy Company"; Flags: uninsdeletekeyifempty; Check: IsJava32;
Root: HKCU64; Subkey: "SoftwareMy Company"; Flags: uninsdeletekeyifempty; Check: IsJava64;

[Code]

Function IsJava32(): Boolean;
Begin
  { ... }
End;

Function IsJava64(): Boolean;
Begin
  Result := Not IsJava32;
End;