How WinHelp Files Work
An engineer built a pure-Rust reader for legacy Windows .hlp files, detailing internal binary structures, LZ77 compression quirks, and hash-based hyperlink resolution.
read it A fascinating technical breakdown of reverse-engineering an undocumented file format with clever compression layers.
summary
The author built a pure-Rust library to parse legacy Windows Help files after examining existing documentation and real files. The format operates as a filesystem within a file using B+ trees, incorporating custom LZ77 and phrase-based text compression schemes alongside hash-based hyperlink resolution. The post details specific binary-level parsing challenges, such as window buffering quirks and bit-packing edge cases in phrase index tables. Commenters reminisce about the usability of contextual WinHelp and how files were originally authored using standard RTF editors.
key points
- WinHelp files function as internal archives structured around B+ tree directories containing system files, topics, fonts, and contexts.
- Text compression layers LZ77 with a zero-initialized window buffer on top of phrase-substitution codecs like Windows 95 Hall compression.
- Hyperlinks use custom case-insensitive hashing of target context strings to look up positions in the internal context index.
who should read it
Systems programmers, reverse engineers, and developers interested in file format internals and retro Windows architecture.
discussion warm
consensus
Commenters fondly remember WinHelp for its fast, reliable offline contextual help and lament the decline of standardized, high-quality offline documentation.
pushback
A few note that subsequent Microsoft help formats like CHM introduced security vectors and sluggish indexing behavior compared to the lightweight WinHelp viewer.
The official WinHelp authoring tool was… WordPad. Or really, any RTF editor that supported the custom footnote glyphs that the WinHelp compiler turned into a .hlp file. But I would’ve been nervous about using WinWord in case of unwanted additional formatting.
For some reason this baffled me at the time, even though it’s really no different from DocBook to HTML conversion. Maybe it was inexperience, or maybe it was because HTML was its own well-known thing while .hlp was opaque, but I always thought that the footnotes etc. were semantically preserved to the final artifact, and I couldn’t wrap …
It explains the ironic reality that the opaque binary .hlp format was originally authored using simple RTF editors and footnote glyphs.
Generated by an LLM from the article and thread. Check the sources before relying on it.