我想恢复卸载时的所有自定义操作。
以下是我的自定义操作
以下是我在installscript中编写的用于添加注册表项的代码
#include "ifx.h"
export prototype SetRegistryParameters(HWND);
function SetRegistryParameters(hMSI)
NUMBER ret;
STRING formatStr;
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
SprintfBox(WARNING, "SetRegistryParameters", "Hi from internal", 0);
ret = RegDBSetKeyValueEx("Software\\XYZ", "InstallDir", REGDB_STRING, INSTALLDIR, -1);
if (ret < 0) then
formatStr = "RegSetValue failed with ret: 0x%x";
SprintfBox(WARNING, "SetRegistryParameters", formatStr, ret);
endif;
return ret;
end;
要停止服务并将其删除,我创建了自定义操作
要删除注册表项,我编写了一个installscript代码,
export prototype DeleteRegistryParameters(HWND);
function DeleteRegistryParameters(hMSI)
// To Do: Declare local variables.
begin
// To Do: Write script that will be executed when MyFunction is called.
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
SprintfBox(WARNING, "SetRegistryParameters", "Bye from internal", 0);
ret = RegDBDeleteKey("XYZ");
if (ret < 0) then
formatStr = "RegSetValue failed with ret: 0x%x";
SprintfBox(WARNING, "SetRegistryParameters", formatStr, ret);
endif;
return ret;
end;
这是所有行动的序列
1. Create a registry entry using installscript
Install Execute Sequence = After CostFinalize
Install Execute Condition: "Not INSTALLED"
2. Install Service
Install Execute Sequence = After SetRegistryParameters
Install Execute Condition: "Not INSTALLED"
3. Start Service
Install Execute Sequence = After Install Service
Install Execute Condition: "NOT Installed"
4. Stop Service
Install Execute Sequence = After InstallFiles
Install Execute Condition: Remove = "ALL"
5. Remove Service
Install Execute Sequence = After Stop Service
Install Execute Condition: Remove = "ALL"
6. Remove Registry
Install Execute Sequence = After Remove Service
Install Execute Condition: Remove = "ALL"
但是包没有被卸载并且
答案 0 :(得分:1)
服务是服务是服务。无论是C ++,C#,Java,。PL,.PY使用ServAny.exe还是其他什么都没关系。 Windows Installer的ServiceInstall和ServiceControl表可以处理它。 Registry表处理Registry。 InstallShield编写MSI的。换句话说,抛弃自定义操作并免费获得回滚/卸载。
请参阅:Zataoca: Custom actions are (generally) an admission of failure.
一个。安装程序开发人员已经编写了一个自定义操作 由底层引擎支持。这基本上是重塑 车轮的解决方案不太稳定。这总是归结为 缺乏文档或缺乏开发人员的努力。 无论哪种方式都无法使用最佳解决方案。