InnoSetup,在运行时更改Uninstallable属性的行为? [英] InnoSetup, change the Uninstallable property behavior at runtime?
问题描述
场景
我已经创建了一个安装程序,该安装程序将出于教育目的安装恶意软件应用程序,该安装程序包含以下两个任务:
I have created an installer that will installs a Malware application for educative purposes, the installer contains these two tasks:
[Tasks]
Name: hidden; Description: Hidden mode; GroupDescription: Installation Mode
Name: visible; Description: Visible mode; GroupDescription: Installation Mode
这意味着对用户执行隐藏安装(隐藏的目录和文件并进行卸载,使其成为安装程序),或对用户执行可见的安装(常规目录和文件以及Uninstallable = True).
This means, performs a hidden installation for the user (hidden dirs and files and make uninstallabe the installer), or a visible installation (normal dirs and files and Uninstallable=True).
问题
我默认设置了Uninstallable=True
,但是如果用户选择hidden
任务,那么我想避免创建卸载程序.
I've set the Uninstallable=True
by default, but If the user selects the hidden
task then I would like to avoid the uninstaller creation.
我该怎么做呢?
推荐答案
您可以使用 Uninstallable
指令文档:
You can use the code shown in the Uninstallable
directive documentation:
[Setup]
...
Uninstallable=not IsTaskSelected('hidden')
[Tasks]
Name: hidden; Description: Hidden mode; GroupDescription: Installation Mode
Name: visible; Description: Visible mode; GroupDescription: Installation Mode
或者,如果您需要用可重用函数编写的更复杂的语句,或者访问某些脚本代码元素,则可以编写一个函数,例如:
Optionally, if you'd need more complex statements written in reusable function, or access some of the scripting code elements, you could write a function, e.g.:
[Setup]
...
Uninstallable=IsUninstallable
[Tasks]
Name: hidden; Description: Hidden mode; GroupDescription: Installation Mode
Name: visible; Description: Visible mode; GroupDescription: Installation Mode
[Code]
function IsUninstallable: Boolean;
begin
Result := WizardSilent or not IsTaskSelected('hidden');
end;
这篇关于InnoSetup,在运行时更改Uninstallable属性的行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!