Format:Xpress
| On this wiki | Facts · Code · Notes · Topics |
|---|
Microsoft's Xpress family from the MS-XCA specification: Plain LZ77 (32-bit flag words, no entropy coding), LZ77+Huffman (256-byte table of 512 4-bit lengths) and LZNT1; used in WIM, hiberfil.sys, SMB and other Windows components.
Overview
[MS-XCA] "Xpress Compression Algorithm" (Microsoft Open Specifications, revision 10.0 of 2024-04-23, read at learn.microsoft.com) specifies three variants: LZ77+Huffman, Plain LZ77 and Format:LZNT1. They are not interchangeable and have no magic number; the container or API call names the variant.
LZ77+Huffman ("Xpress Huffman")
From wimlib's decoder: the stream begins with 256 bytes holding 512 4-bit codeword lengths (low nibble = even symbol), one canonical Huffman code (max length 15) for the whole stream; symbols 0 to 255 are literals and 256 to 511 are matches whose symbol carries log2(offset) in bits 4 to 7, with extra bits and extra length bytes read inline. Offsets 1 to 65535, match lengths 3 to 65538. Some decoders (WIMGAPI) expect symbol 256 as an end marker after the data. WIM uses this algorithm per 32 KiB chunk. See Fact:Xpress/behavior/LZ77 Huffman stream layout.
Plain LZ77
Unverified (not read in a source this session): a stream of 32-bit little-endian flag words, one bit per item (0 literal byte, 1 match), matches coded in a 16-bit token (13-bit offset, 3-bit length with escapes); no Huffman table, so the stream has no header.
Where it is used and API ids
Unverified: the Windows hibernation file stores Xpress blocks introduced by the ASCII tag \x81\x81xpress; the Compression API (CreateCompressor) uses COMPRESS_ALGORITHM_XPRESS = 3 and XPRESS_HUFF = 4; RtlCompressBuffer format ids are LZNT1 = 2, XPRESS = 3, XPRESS_HUFF = 4. Test by searching a binary for those constants next to calls to the ntdll or cabinet.dll functions.
Code & repositories
- https://github.com/ebiggers/wimlib @
cd5e231c348c255ae5088873b5a66ee0eb96fa07· license: LGPL-3.0-or-later OR GPL-3.0-or-later (declared by the contributor; GitHub's detector did not recognize COPYING)
Windows imaging library with small, commented LZX, XPRESS and LZMS decoders (LGPL-3.0-or-later; individual files LGPL-3.0/2.1+). Used here only for constants and format description.
Tested on: source read, not run: source read · checked 2026-10-18; last activity 2026-01-30
See also
Format:LZX, Format:LZNT1, Technique:Identifying compression libraries in binaries
Also Format:Windows Prefetch: Windows 10 .pf files are a MAM 0x04 signature, uncompressed size, then Xpress Huffman data (per libscca).
XPRESS Huffman constants from wimlib include/wimlib/xpress_constants.h (cd5e231c34): 512 symbols (256 literals, 256 match headers), end-of-data symbol 256, codeword length 15, offsets 1 to 65535, match length 3 to 65538. In a WIM the flag is 0x20000, see Format:WIM; the sibling Microsoft format is Format:LZMS.