是否可以在Inno Setup(32或64位)中设置安装模式? [英] Is it possible to set the install mode in Inno Setup (32 or 64 bit)?

查看:365
本文介绍了是否可以在Inno Setup(32或64位)中设置安装模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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



有可能吗?



示例:



此功能将返回Java安装体系结构(32或64):

  function CheckJavaInstallation()

根据结果,我要将Inno Setup设置为正确的安装模式->选择正确的程序文件程序文件(x86)并在正确的注册表中(普通或 WOW6432Node )。

解决方案

我建议您创建两个检查器函数: IsJava32 IsJava64 。然后为每个文件,注册表项等添加两个版本以及一个检查器,例如:

  [Files] 
来源: SourceSetupDir32\aFile1.dll; DestDir: {pf32} \ {#MyAppName} \;检查:IsJava32;
来源: SourceSetupDir64\aFile1.dll; DestDir: {pf64} \ {#MyAppName} \;检查:IsJava64;
; ...
来源: SourceSetupDir32\aFile4.dll; DestDir: {pf32} \ {#MyAppName} \;检查:IsJava32;
来源: SourceSetupDir64\aFile4.dll; DestDir: {pf64} \ {#MyAppName} \;检查:IsJava64;

[注册处]
根:HKCU32;子项:软件\我的公司;标志:uninsdeletekeyifempty;检查:IsJava32;
根:HKCU64;子项:软件\我的公司;标志:uninsdeletekeyifempty;检查:IsJava64;



  [代码] 

函数IsJava32():布尔值;
开始
{...}
结束;

函数IsJava64():布尔值;
开始
结果:=不是IsJava32;
结束;


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.

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

Is it even possible?

Example:

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

function CheckJavaInstallation()

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).

解决方案

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: "SourceSetupDir32\aFile1.dll"; DestDir: "{pf32}\{#MyAppName}\"; Check: IsJava32;
Source: "SourceSetupDir64\aFile1.dll"; DestDir: "{pf64}\{#MyAppName}\"; Check: IsJava64;
;...
Source: "SourceSetupDir32\aFile4.dll"; DestDir: "{pf32}\{#MyAppName}\"; Check: IsJava32;
Source: "SourceSetupDir64\aFile4.dll"; DestDir: "{pf64}\{#MyAppName}\"; Check: IsJava64;

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

[Code]

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

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

这篇关于是否可以在Inno Setup(32或64位)中设置安装模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆