“msiexec"如何获取平台信息 [英] "msiexec" how to get platform information
问题描述
我有一些 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 有多种风格.只需扫描 x64
、Intel64
、ARM64
视情况而定 - 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
(将 256
、0x0100
添加到属性标志)在 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.
- MsiInfo.exe 的行为似乎很奇怪 - 如果您尝试切换会持续更改.
- 两个文件都在本地 Windows SDK 安装文件夹中可用 (
%ProgramFiles(x86)%\Windows Kits\10\bin\10.0.17134.0\x86
截至目前对我来说 - 适当调整版本).
示例 CMD:
MsiInfo.exe Test.msi
和
cscript.exe WiSumInf.vbs Test.msi
<小时>
更多链接:
- MS SDK:64-位 Windows 安装程序包
- MS SDK:使用 64 位 Windows 安装程序包
- MS SDK:模板摘要属性
这篇关于“msiexec"如何获取平台信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!