Format:Microsoft Cabinet
| On this wiki | Facts · Code · Notes · Topics |
|---|
Microsoft Cabinet (.cab): MSCF header, folders of compressed CFDATA blocks (none, MSZIP, Quantum, LZX) and file entries; the payload container of MSI, Burn bundles, MSU updates and many installers.
A cabinet is a set of folders; each folder is one compression stream cut into data blocks, and files are byte ranges inside a folder's uncompressed stream. Source: libmspack (LGPL-2.1) mspack/cab.h and cabd.c; the public [MS-CAB] specification.
Identification
- Magic
4D 53 43 46 00 00 00 00('MSCF' plus 4 reserved bytes) at offset 0. In installers the cabinet sits in the overlay or a PE section/resource (_cabinetin old Tool:InstallShield setups, the overlay of Tool:WiX Toolset Burn bundles); libmspack can search a file for the signature. - Extensions: .cab, .msu; inside MSI as streams (Format:Windows Installer MSI).
CFHEADER (36 bytes, little endian)
| Offset | Field |
|---|---|
| 0x00 | signature |
| 0x08 | cabinet size |
| 0x10 | offset of the first CFFILE |
| 0x18 / 0x19 | minor / major version |
| 0x1A | number of folders (u16) |
| 0x1C | number of files (u16) |
| 0x1E | flags |
| 0x20 | set id |
| 0x22 | index in the set |
Flags: 0x0001 previous cabinet, 0x0002 next cabinet, 0x0004 reserve fields present. With the reserve flag a 4-byte extension follows: header reserve size (u16), folder reserve size (u8), data reserve size (u8). Previous/next cabinet and disk names are zero-terminated strings after it.
CFFOLDER (8 bytes + reserve)
Offset 0 data offset (first CFDATA), 4 number of CFDATA blocks (u16), 6 compression type (u16). Low nibble = method: 0 none, 1 MSZIP, 2 Quantum, 3 LZX. For LZX and Quantum, bits 8-12 are the window size in bits (libmspack reads (type >> 8) & 0x1f). LZX is described in Format:LZX.
CFFILE (16 bytes + name)
Offset 0 uncompressed size, 4 offset in the folder's uncompressed stream, 8 folder index, 0xA date, 0xC time (DOS format: libmspack cabd.c lines 614-624 at 55d5019761 reads time as hour = x >> 11, minute = (x >> 5) & 0x3F, second = (x << 1) & 0x3E, and date as day = x & 0x1F, month = (x >> 5) & 0xF, year = (x >> 9) + 1980; offsets 0x0A and 0x0C are cffile_Date and cffile_Time in cab.h), 0xE attributes, then a zero-terminated name. Folder index FFFD / FFFE / FFFF means continued from previous cabinet / continued to next / both: the file spans a cabinet set.
CFDATA (8 bytes + reserve)
Offset 0 checksum, 4 compressed size (u16), 6 uncompressed size (u16). A block expands to at most 32768 bytes (CAB_BLOCKMAX). MSZIP: libmspack mszipd.c lines 405-413 (55d5019761) scans for the bytes 'C' 'K' (43 4B) before inflating each block, so every MSZIP CFDATA payload starts with CK followed by raw deflate data; its history window is 32768 bytes (mszip.h line 22). Quantum: window size 2^10 to 2^21 bytes (qtmd.c lines 198-199), frame size 32768 (qtm.h line 22), arithmetic-coded (range 0xFFFF code in qtmd.c line 293), and after each frame the decoder skips bytes up to a 0xFF marker (qtmd.c line 437). LZX window 2^15 to 2^21 (see Format:LZX). Unverified: LZX and Quantum keep their window across CFDATA blocks of a folder.
Tools
libmspack and its cabextract front end (LGPL), 7-Zip, Windows expand.exe, msitools (msiextract). libmspack has a salvage mode for damaged cabinets.
Code & repositories
- https://github.com/kyz/libmspack @
55d501976171397ccd5d5a7a1ca7da065b1d9a06· license: LGPL-2.1-only (declared by the contributor; GitHub's detector did not recognize a license file)
libmspack (cabextract's library): CAB, CHM, LIT, HLP, KWAJ and SZDD decompressors with LZX, MSZIP and Quantum; mspack/cab.h defines the cabinet field offsets.
Tested on: source read, not run: source reading only · checked 2026-10-18; last activity 2026-07-21
See also
Format:LZX, Format:Windows Installer MSI, Format:MSU update package, Format:Compound File Binary, Tool:WiX Toolset.