msiexec MsiSetExternalUI的外部处理程序 [英] External handler for msiexec MsiSetExternalUI

查看:147
本文介绍了msiexec MsiSetExternalUI的外部处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早上好,

我希望为msiexec实现一个外部处理程序,但不会阻止msiexec采取任何其他措施。我希望能够利用MsiSetExternalUI截取所有消息,但对最终用户仍然具有相同的响应和对话框。

I am looking to achieve an external handler for msiexec, but not stopping msiexec from acting any different. I would like to be able to intercept all messages utilising the MsiSetExternalUI but still having the same responses and dialogs to the end user.

我的主要目的是截取缓存源的位置

My main aim is intercept where the cached source for msi are installed from and move them to another location.

我尝试使用日志记录来利用日志记录注册表项,但是可以删除软件包的源位置,并且可以将软件包的源位置删除。

I have tried utilising logging utilise the logging registry key, but source location of packages can get deleted and the source of the package will not exist by the time i have intercepted the log file and got the location of the msi.

例如,在安装exe中嵌入了msi,特别是旧的C ++可再发行文件提取包使用redist将其自身放置到homedrive根目录上的随机目录中并安装,然后在完成后删除该目录。 msiexec的行为不一致,因为大多数软件包都缓存在Windows安装程序目录c:\windows\installer中,而原始软件包则缓存在c:\programdata\cached软件包中。

For example embedded msi in a setup exe especially old C++ redistributable extract themselves with the redist to a random directory on the root of the homedrive and install, then on completion delete the directory. The behaviour of msiexec isn't consistent as majority of packages are cached in the windows installer dir c:\windows\installer and the original packages cached in the c:\programdata\cached packages.

为什么某些程序包被缓存而其他arent?

Why are some packages cached and others arent?

因此,我想使用外部UI的原因是,但要确保行为保持不变。

Hence the reason why i would like to utilise the External UI, but ensure that the behaviour is kept the same.

我目前正在使用

MsiInterop.MsiSetExternalUI(new
MsiInstallUIHandler(_OnExternalUI),
MsiInstallLogMode.ExternalUI,IntPtr.Zero);

MsiInterop.MsiSetExternalUI(new MsiInstallUIHandler(_OnExternalUI), MsiInstallLogMode.ExternalUI, IntPtr.Zero);

任何想法或示例都会很有帮助。

Any ideas or examples would be really helpful.

推荐答案

我看不到为什么截取UI与在安装过程中无法更改的缓存位置有关。但是,目前尚不清楚您打算在此使用什么缓存。我假设您所指的是完整的MSI文件,该文件可能已提取到某个位置进行安装,或者位于该文件的安装位置。

I cannot see why intercepting the UI has anything to do with cache locations that you cannot alter while the install is in progress. However it's not clear exactly what usage of "cache" you are intending here. I'll assume that you are referring to the complete MSI file which may have been extracted to some location for install, or is otherwise at the location it was installed from.

假设安装已完成,您知道(或可以获得)其ProductCode。获取所有正式源位置所需要做的就是调用MsiSourceListEnumSources(),这将告诉您Windows用来查找MSI进行维护,升级,维修等的实际位置(如果需要)。

Let's assume that the install has finished and you know (or can get) its ProductCode. All you need do to obtain all the official source locations is call MsiSourceListEnumSources () and that will tell you the actual locations that Windows will use to find the MSI for maintenance, upgrade, repair, etc, if and when required.

如果源MSI位于您不认可的位置,则使用MsiSourceListClearSource()删除该条目,将MSI复制到您选择的位置,然后使用MsiSourceListAddSource()添加该位置。完全有这种类型的管理活动,例如当从不再可用的网络位置安装产品时,有大量的源列表API。

If the source MSI is at a location you do not approve of, then use MsiSourceListClearSource () to delete that entry, copy the MSI to a location of your choice, then use MsiSourceListAddSource () to add that location. There are plenty of sourcelist APIs for exactly this type of management activity, such as when products were installed from network locations that are no longer available.

我认为您不应该移动或更改通常在Windows安装程序中使用的内部缓存(混淆名称)MSI文件。我们有时将其称为缓存位置,但您似乎是指用于安装产品的完整MSI。

I don't believe you should be moving or altering the internal cached (obfuscated name) MSI file that is typically in \windows\installer. That us sometimes referred to as the cached location, but you seem to be referring to the complete MSI used to install the product.

这篇关于msiexec MsiSetExternalUI的外部处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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