Introduction
A .hlp file is a compiled help file for WinHelp, the hypertext help viewer of
Microsoft Windows. WinHelp shipped with Windows 3.0 in 1990 and stayed the standard way to
write Windows help until Windows XP. Authors wrote topics in Rich Text Format, listed them
in a project (.hpj) file and ran a help compiler, which packed the text,
pictures, links and index into one compressed file for reading. Microsoft phased WinHelp
out from Windows Vista, which came without it, offered the viewer as a separate download
up to Windows 8.1, and removed it from Windows 10.
The format is reverse-engineered. Microsoft never published it. What
is known comes from Pete Davis’s articles in Dr. Dobb’s Journal in 1993, Manfred
Winterhoff’s HELPDECO notes, and the winhlp32 program in the Wine project.
These pages record what those sources say and what has been checked against real files;
fields whose meaning nobody has worked out are marked as unknown.
A .hlp file dropped on any page opens in the explorer. It shows the tree of
internal files, the readable text of every topic with its links, the keywords, the
pictures and the fonts.
Structure
A help file is a small file system. After a 16-byte header come the internal files, one after another in any order, with a directory that names them. Each internal file has a 9-byte header and then its content. Space freed by the compiler is kept on a free list.
0Header the magic number3F 5F 03 00, the offset of the directory, the free list and the file size16 bytes16Internal files|SYSTEM,|TOPIC,|FONT, the keyword and context tables and the pictures, each with a 9-byte header, in any ordervaries…Directory an internal file holding a B+ tree from names to offsets; the header points at itvaries…Free blocks left unused, chained from the headervaries
Versions
The |SYSTEM internal file holds a version number, Minor, set by the compiler.
The layout changed with the compiler, but one reader can handle them all once it has read
this number. The reference pages note each difference where it matters.
| Minor | Compiler | What is different |
|---|---|---|
| 15 | Windows 3.0 (HC30) | Text in 2 KB blocks with no LZ77 compression; records linked by byte distances; a title straight after the |SYSTEM header; jumps by topic number through |TOMAP |
| 21 | Windows 3.1 (HC31) | LZ77-compressed topic blocks, |SYSTEM records, absolute record positions, jumps by the hash of the context name through |CONTEXT |
| 33 | Windows 95 (HCW 4.0) | The same layout as 3.1, usually with Hall compression (|PhrIndex and |PhrImage) in place of the older |Phrases table |
HELPDECO’s notes also list Minor 27 for some Multimedia Viewer files (.mvb),
which use the same container with records of their own.
Links
Software
- WinHelp – Windows’ own viewer, WINHELP.EXE and WINHLP32.EXE (Windows 3.0 to Windows XP; a download for Vista to 8.1)
- Microsoft Help Workshop – the compiler and project tool of Windows 95 and later (Windows)
- Wine – includes
winhlp32, a free WinHelp viewer (Linux, macOS)
Developers
Reference
- The Windows Help file format – Manfred Winterhoff’s notes from HELPDECO