Is it possible to set the install mode in Inno Setup (32 or 64 bit)?

房东的猫 提交于 2019-12-09 20:23:12

问题


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


回答1:


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;



回答2:


A simpler solution can be find here. For those that are searching for an answer to this question.



来源:https://stackoverflow.com/questions/9788252/is-it-possible-to-set-the-install-mode-in-inno-setup-32-or-64-bit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!