使用 MSI 转换更改从 DLL 加载的 MSI 属性的值 [英] Change the value of a MSI property loaded from a DLL using a MSI transform

查看:25
本文介绍了使用 MSI 转换更改从 DLL 加载的 MSI 属性的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要修改IBM i Access for Windows"的 MSI 设置的安装行为.该设置是使用 InstallShield 创建的.在安装过程中,安装程序通过链接"触发另外两个 MSI 安装.传递给 MSIEXEC.EXE 以执行这两个安装的参数由安装中包含的 DLL 中的自定义操作加载.参数以 MSI 属性结尾.

I need to modify the installation behavior of a MSI setup for "IBM i Access for Windows". The setup was created using InstallShield. During the installation the setup triggers two other MSI installations through "chaining". The parameters passed to MSIEXEC.EXE to execute those two installations get loaded by a custom action from a DLL that is included with the installation. The parameters end up in a MSI property.

我想更改该属性中的值以在启动链接安装之前操作命令行.这可能吗?如果是这样,如何?我没有问题创建一个读取和修改属性的外部 DLL,但我不知道如何将它与现有安装集成 - 我必须修改哪些表以及如何修改,我应该将 DLL 放在哪里,...

I want to change the value in that property to manipulate the command line before the chained installation gets launched. Is this possible? If so, how? I have no problem to create an external DLL that reads and modifies the property, but I am at a loss on how to integrate this with the existing installation -- which tables do I have to modify and how, where should I put the DLL, ...

EDIT 1:为了澄清这一点:我想修改传递给链接的 MSI 安装的参数.它们独立于我传递给主安装的参数,并从作为安装一部分的 DLL 加载.

EDIT 1: To clarify this: I want to modify the parameters passed to the chained MSI installations. They are independent from the parameters I pass to the main installation and are loaded from a DLL that is part of the installation.

EDIT 2:我上传了普通的 MSI +相关的日志文件.我使用/qn"开始主安装以抑制所有消息.这没有问题,链接安装在没有可见提示的情况下执行.卸载软件时出现问题(再次使用/qn").远程自定义操作从 DLL 加载(第 6417 行):

EDIT 2: I have uploaded the plain MSI + the relevant log file. I start the main installation with "/qn" to suppress all messages. That works without problems, the chained installations get executed without visible prompts. The problem arises when uninstalling the software (again with "/qn"). The remote custom action gets loaded from a DLL (line 6417):

MSI (s) (10:28) [09:00:45:643]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIA4BD.tmp, Entrypoint: ISChainPackages

从 DLL 加载的命令行指定使用参数/qb"而不是/qn"(第 6958 行)调用 MSIEXEC.EXE:

The command line loaded from the DLL specifies to call MSIEXEC.EXE with the parameter "/qb" instead of "/qn" (line 6958):

MSI (s) (10!60) [09:00:46:033]: PROPERTY CHANGE: Adding IS_CHAINER_POST_COMMANDLINE property. Its value is '/l"c:\temp\IBM_iAccess_7.1_Uninstall.log" /qb /x{CCA40632-843E-48C6-B14F-E1070015D87C} ...

并且由于 MSI 安装程序锁定了文件,因此在卸载链接的 MSI(第 44046 行)时会弹出一个消息框:

And because the MSI installer has a lock on a file a messagebox pops up triggered by the uninstallation of the chained MSI (line 44046):

MSI (s) (10:C0) [09:01:05:553]: RESTART MANAGER: Did detect that the custom action server with process ID 2352 holds file[s] in use, so a reboot will be necessary.
MSI (s) (10:C0) [09:01:05:553]: Note: 1: 1610 
MSI (s) (10:C0) [09:01:11:224]: RESTART MANAGER: The user chose to go on with the installation, although a reboot will be required.
The setup must update files or services that cannot be updated while the system is running. If you choose to continue, a reboot will be required to complete the setup.

此软件 7.1 版的安装文件不再位于 IBM 网站.只是现在的版本,我还没去研究最新版本是否还存在这个问题,因为业务部门要求我打包v7.1.

The installation files for version 7.1 of this software are no longer available on the IBM website. Only the current version is, and I have not looked into whether the problem still exists with the latest version or not as I have been asked to package v7.1 by the business department.

推荐答案

解决此问题的一种方法是创建一个新的自定义操作,该操作执行存储在 Binary 表中的 VBScript 代码并将新的ISChainPackagePrepare 之后的自定义操作.VBScript 代码将读取IS_CHAINER_POST_COMMANDLINE 的值并按照Replace() 函数

One approach to this problem would be to create a new Custom Action that executes VBScript code stored in the Binary Table and place the new Custom Action right after ISChainPackagePrepare. The VBScript code will read the value of IS_CHAINER_POST_COMMANDLINE and replace it as specified in the Replace() function

VBScript 代码可能如下所示:

The VBScript Code could look like this:

Option Explicit

Function ReplacePropVal()
    dim propvalue
    dim newvalue
    propvalue = Session.Property("IS_CHAINER_POST_COMMANDLINE")
    newvalue = Replace(propvalue,"/qb","/qn")
    Session.Property("IS_CHAINER_POST_COMMANDLINE") = newvalue
End Function

您想为您的新自定义操作添加 类型 6 表示您的自定义操作数据作为 VBScript 存储在 Binary 表中.您的自定义操作 Source 是对 Binary 表中的 Name 的引用.您的自定义操作的 Target 值需要是 VBScript 函数的名称,在本例中为 ReplacePropVal

You want to give your new Custom Action a Type of 6 to indicate that your Custom Action data is stored as a VBScript in the Binary table. Your Custom Action Source is a reference to the Name in the Binary Table. The Target value of your Custom Action will need to be the name of the VBScript Function which is ReplacePropVal in this case

之后,您将新自定义操作放置在 InstallExecutionSequence 表中,并使用与 CustomAction 表中相同的名称.还要确保给它一个更高的 Sequence 值作为 ISChainPackagePrepare.我建议通过将 ISChainPackagePrepareSequence 值增加 1 来将它放在后面.

Afterwards, you place your new Custom Action in the InstallExecutionSequence table using the same name for it as in the CustomAction table. Also make sure to give it a higher Sequence value as ISChainPackagePrepare. I would recommend placing it right after by incrementing the Sequence value of ISChainPackagePrepare by 1.

在更改表并生成新转换后,只需通过在 TRANSFORMS 公共属性中指定其路径来运行应用了新转换的包,并且您的属性值应该被更改.

After you've changed the tables and generated a new transform, just run the package with the new transform being applied by specifying its path in the TRANSFORMS public property and your property value should be changed.

这篇关于使用 MSI 转换更改从 DLL 加载的 MSI 属性的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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