← Back to BLACKWIRE PULSE BUREAU TECH REVELATIONS Screenshot of a WinHelp .hlp file opened in the libhlp Rust viewer, showing directory entries and compressed text blocks.

libhlp displays the hidden structure of a WinHelp archive, exposing its internal files and compression details.

LIBHLP REVEALS WINHELP .HLP FILE ARCHIVE STRUCTURE

*A Rust‑based reader cracks the undocumented WinHelp format. The discovery exposes the file system, compression quirks, phrase tables, and hash‑based linking that have hidden Windows help internals for decades.*

By PULSE Bureau - BLACKWIRE  |  November 28, 2026, 06:00 CET  |  WinHelp, libhlp, LZ77, phrase compression, hash links

A developer who spent a Friday recovering from wisdom‑tooth surgery woke up Saturday and built libhlp, a pure‑Rust reader for legacy WinHelp .hlp files. Microsoft never published the format, leaving a gap that Manfred Winterhoff partially filled with helpfile.txt alongside his helpdeco decompiler. By cross‑referencing that documentation with real‑world files, the author reconstructed the archive layout, compression layers, and linking logic. The effort turned a dormant Windows help system into an open, inspectable artifact, exposing quirks that have persisted since the early 1990s. libhlp now offers a transparent view of a format that powered countless software manuals, revealing how Microsoft’s undocumented choices still affect modern reverse‑engineering.

How is a .hlp file organized?

A WinHelp .hlp file begins with the magic number 3F 5F 03 00, followed by a pointer to its internal directory. The file is essentially an archive; the directory lists every embedded file. Most entries start with a pipe character: |SYSTEM holds title and settings, |TOPIC stores the text, |FONT defines fonts, |CONTEXT maps hashes to topic positions, and picture files appear as |bm0, |bm1, etc. Both the directory and every index inside the file are B+ trees sharing a uniform page layout. This structure lets the reader locate any component without scanning the whole file.

Why does WinHelp use a two‑stage LZ77 scheme?

Text in |TOPIC is split into fixed‑size blocks, typically 16 KB each, but only about 4 KB decompresses per block. Each block may be LZ77 compressed; the decompressor reads a flag byte then up to eight items, interpreting each bit as a literal or a back‑reference. Back‑references encode a 12‑bit distance and a 4‑bit length, with length stored minus three. A distance of zero repeats the last byte, allowing runs like xxxxxx. Some files contain references that point before the start of data; libhlp and the original helpdeco treat the initial window as zero‑filled, producing correct output instead of erroring.

"Microsoft never documented the format, but Manfred Winterhoff did," the libhlp author notes, underscoring the reliance on community reverse‑engineering.

What phrase‑compression methods does WinHelp employ?

WinHelp 3.1 stores a phrase table in |Phrases. Any byte from 1 to 15 starts a two‑byte code; the low bit indicates whether a space follows the phrase. This saves a byte for most phrases, which end at word boundaries. Windows 95 introduced Hall compression, splitting phrases across |PhrIndex and |PhrImage. Here, the lowest bits of each byte signal the type: a clear low bit selects one of the first 128 phrases, 01 starts a two‑byte code for the rest, 011 begins a literal run, 0111 a space run, and 1111 a zero‑byte run. Lengths are stored as unary counts with a step size set per file. A bug in early parsers misread lengths when the step size was one; the fix adds a simple bits > 0 check.

How are links resolved inside WinHelp topics?

When an author creates a link, the help file stores a hash of the target’s context string, not its file offset. To follow a link, the reader hashes the target name using WinHelp’s algorithm: each byte is looked up in a table that normalizes case, then combined with a rolling multiply‑add (multiply by 43, add signed term). The resulting 32‑bit value indexes |CONTEXT, which maps hashes to topic positions. The hash table treats values ≥ 0x80 as negative, making the calculation error‑tolerant; most mistakes still yield a plausible hash. An empty name hashes to 1, matching WinHelp’s legacy behavior.

Frequently asked questions

What is the magic number that starts a WinHelp .hlp file?

A .hlp file starts with the four‑byte magic number 3F 5F 03 00.

How does WinHelp compress text inside |TOPIC blocks?

Text is split into fixed‑size blocks, each optionally LZ77 compressed using a flag byte and up to eight items, with back‑references encoded as a 12‑bit distance and a 4‑bit length.

How are links to other topics stored in WinHelp files?

Links store a hash of the target context string; the hash is computed with a case‑insensitive lookup table and a multiply‑add algorithm, then looked up in the |CONTEXT file to find the topic position.

libhlp’s release turns a closed‑source relic into a public resource. By laying bare the B+ tree directory, dual‑stage LZ77, phrase tables, and hash‑based linking, it equips security researchers, archivists, and developers with the tools to parse, preserve, and even repurpose historic help content. The project demonstrates that even the most obscure legacy formats can be decoded when curiosity outweighs complacency.

Sources: Hacker News – How WinHelp Files Work (https://quin.fyi/posts/how-winhelp-files-work.html)