“msiexec"如何获取平台信息 [英] "msiexec" how to get platform information

查看:20
本文介绍了“msiexec"如何获取平台信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些 python 脚本可以为一些应用程序数据库生成信息.

I have some python script which generates information for some application database.

现在我需要为指定的 .msi 文件获取支持的平台.目的是在 .msi 文件中区分 Win32 和 x64 应用程序.

Now I need fetch supported platform for specified .msi file. Aim is to distinguish Win32 and x64 applications inside of .msi file.

我在 msiexec/? 中没有看到任何有用的东西这基本上显示了与 https://docs 相同的内容.microsoft.com/en-us/windows/desktop/msi/command-line-options

I don't see anything useful from msiexec /? Which basically shows same thing as https://docs.microsoft.com/en-us/windows/desktop/msi/command-line-options

推荐答案

建议:我不是 Python 人(无意双关语),但我喜欢掠夺github.com 每当我需要这样的东西时.这是我发现的.并且 github.com 搜索随机设置为第 21 页.

Suggestion: I am not a Python guy (no pun intended), but I like to pillage github.com whenever I need something like that. Here is what I found. And the github.com search randomly set to page 21.

import msilib
#import sys

db = msilib.OpenDatabase("setup.msi", msilib.MSIDBOPEN_READONLY)
print( db.GetSummaryInformation(0).GetProperty(7))

Bitness:比特信息保存在 MSI 的 Summary Information Stream 中,它是称为 Template 值.您必须对其进行解析以确定它是否为 64 位包.此处描述了有效值.64 位 CPU 有多种风格.只需扫描 x64Intel64ARM64视情况而定 - x64 是桌面最常见的(我相信).了解高级安装程序是如何做到的.

Bitness: The bitness information is kept in the Summary Information Stream for the MSI, and it is referred to as the Template value. You must parse it to determine if it is a 64-bit package. Valid values are described here. There are several flavors of 64-bit CPUs. Just scan for x64, Intel64, ARM64 as appropriate - x64 is the most common for desktop (I believe). See how Advanced Installer does it.

64 位组件标志:对于 64 位包的真正赠品是任何标记为 msidbComponentAttributes64bit(将 2560x0100 添加到属性标志)在 Component 表的 Attributes 列中在 Component Table 中表示 MSI 包具有为 64 位以支持此类组件.

64-Bit Component Flag: A real giveaway for a 64-bit package is that any components marked as msidbComponentAttributes64bit (which adds 256, 0x0100 to the attribute flag) in the Attributes column of the Component table in the Component Table means that the MSI package has to be 64-bit to support such components.

MSI SDK:我还要提到 MSI SDK 二进制 MsiInfo.exe (%ProgramFiles(x86)%\Windows Kits) 可以轻松读取模板值,以及 MSI API 示例 WiSumInf.vbs可以这样做.

MSI SDK: I will also mention that the MSI SDK binary MsiInfo.exe (%ProgramFiles(x86)%\Windows Kits) can read the Template value easily, and the MSI API sample WiSumInf.vbs can do the same.

示例 CMD:

MsiInfo.exe Test.msi

cscript.exe WiSumInf.vbs Test.msi

<小时>

更多链接:

这篇关于“msiexec"如何获取平台信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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