Introduction
An .msi file is a package for Microsoft’s
Windows Installer,
the installation service built into Windows. Rather than a program that copies files, it is a database that
describes the product: its features, components, files, registry entries and shortcuts,
and the steps to install them. Windows Installer reads the database and does the work,
which lets it repair, update and cleanly remove the product later.
Related files share the format: .msp patches and .msm merge
modules.
Structure
An MSI file is a Compound
File Binary, the “file system in a file” also used by old
Word, Excel and PowerPoint documents. It starts with the 8 bytes
D0 CF 11 E0 A1 B1 1A E1 and a 512-byte header, then divides the rest into
sectors linked together by an allocation table, holding a directory of named
storages and streams.
Inside, each database table, such as Property, Feature,
Component, File and InstallExecuteSequence, is
stored as a stream, with the strings shared through a string pool. The stream names are
encoded, so a plain compound file viewer shows them scrambled. The
SummaryInformation stream holds the title, author and the package code. The
files to install are usually packed into cabinet (.cab) archives stored as
streams inside the MSI, or beside it.
The system tables, column data types and every summary information property are on the database and summary page; every table Windows Installer defines is on the tables page; and every action the sequence tables can name is on standard actions. Microsoft does not document the stream name encoding or the binary layout of the table streams.
0compound file header: signature, sector sizes, allocation table location512 bytes512sectors, chained by the allocation table512 or 4096 bytes each…directory of storages and streamsvaries…table streams and the string poolvaries…SummaryInformation streamvaries…cabinet streams holding the filesvaries
Not described
Known, not yet covered
- Reference: what each column means (the columns page gives name, type, key and nullability for every table; the meanings are on each table’s Learn page) and the rules for each column’s values.
- Reference: the custom action types, the storage CLSIDs, and the layouts of the string pool and database streams.
- Viewer: there is no viewer for MSI files yet.
Links
Software
- Windows Installer – the installation service built into Windows, run as
msiexec(Windows) - Orca – the database editor in the Windows SDK (Windows)
- WiX Toolset – builds MSI packages from XML source (Windows)
- lessmsi – lists and extracts the files in a package (Windows)
- 7-Zip – free archiver that opens the streams inside (Windows)
Developers
- olefile – library that reads compound files, including MSI streams (Python)
Reference
- Windows Installer – Microsoft’s documentation, with the database tables
- [MS-CFB] Compound File Binary File Format – Microsoft’s specification of the container