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: 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-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: 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.
Sample CMD:
MsiInfo.exe Test.msi
and
cscript.exe WiSumInf.vbs Test.msi
Further Links: