How the WinHelp .hlp format works, and libhlp, a Rust reader for it
The author wrote libhlp, a pure-Rust reader for WinHelp .hlp help files, so that the Paperback app could open old ones. Microsoft never documented the format, so the details come from helpfile.txt by Manfred Winterhoff and from testing real files. Claude wrote much of the Rust code.
A .hlp file is an archive, and its internal directory is a B+ tree[1]. The text is stored in blocks compressed with LZ77[2], and sometimes it is compressed a second time using tables of common phrases. Links store a hash of the target's name, not a position, and bold or underlined text is a font switch, not a separate formatting flag.
libhlp reads WinHelp versions from 3.0 up to the Windows 95 help compiler and bounds-checks every read. Text is decoded with the Windows code page[3] the author used; when the file's language ID does not say which one, libhlp guesses it from the text. The library is on crates.io.
Repository libhlp github.com
Pure-Rust library for reading old WinHelp .hlp help files, extracting text, titles, tables, links and pictures.
Read the original quin.fyiDiscussion
Discussion
Commenters mostly praise the write-up. One plans to compile libhlp to WebAssembly together with CHMate to build a frontend for Recoll and compare it with Zeal for old reference material. Another says PuTTY's Windows help files are built by Halibut, a generator that does not depend on Microsoft tools, and a third had assumed these files were RTF with extra structure.
Links from the post and discussion
- CHMate, a CHM file reader mentioned in a comment github.com
- Recoll, a desktop search tool a commenter plans to build on recoll.org
- Zeal, an offline documentation viewer a commenter compares to zealdocs.org
- Halibut, the documentation generator used for PuTTY's help chiark.greenend.org.uk
Sources
-
quin.fyi
How WinHelp files work



