<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-winhelp-files-work-5aiygvczn" -->

---
title: How WinHelp files work | daily.dev
description: A WinHelp .hlp file is an archive with an internal B+ tree directory of pipe-named files like |SYSTEM, |TOPIC and |FONT. Text blocks use LZ77 with 12-bit...
canonical: https://daily.dev/posts/how-winhelp-files-work-5aiygvczn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How WinHelp files work | daily.dev
og:description: A WinHelp .hlp file is an archive with an internal B+ tree directory of pipe-named files like |SYSTEM, |TOPIC and |FONT. Text blocks use LZ77 with 12-bit...
og:url: https://daily.dev/posts/how-winhelp-files-work-5aiygvczn
og:image: https://api.daily.dev/og/posts/5aIYGvcZN.png
og:image:alt: How WinHelp files work
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How WinHelp files work

**[Lobsters](https://daily.dev/sources/lobsters)** · 7 min read · 1 upvotes · 0 comments

## Summary

A WinHelp .hlp file is an archive with an internal B+ tree directory of pipe-named files like |SYSTEM, |TOPIC and |FONT. Text blocks use LZ77 with 12-bit distance and 4-bit length back-references, and paragraph text can be compressed again with phrase tables (3.1 style or Windows 95 Hall compression). Links store a hash of the target name, looked up in |CONTEXT, and the lookup is case insensitive. The author wrote libhlp, a pure-Rust reader on crates.io covering versions 3.0 to the Windows 95 compiler.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://quin.fyi/posts/how-winhelp-files-work.html>

## Questions this post answers

### How does WinHelp LZ77 compression encode back-references?

WinHelp's LZ77 groups data under a flag byte followed by up to eight items, where each flag bit (lowest first) marks a literal byte or a back-reference. A back-reference is two bytes: 12 bits of distance and 4 bits of length, with length stored minus 3. A distance of 0 repeats the last written byte.

_Developers digging into legacy file formats keep up with deep dives like this on daily.dev._

### How do WinHelp .hlp files store hyperlinks between topics?

Links don't store the target topic's position; they store a hash of the target's context name. To follow a link, hash the name the way WinHelp does and look it up in the |CONTEXT file, which maps hashes to positions. The hash uses a signed lookup table, multiplies by 43, is case-insensitive, and an empty name hashes to 1.

_If you reverse-engineer old formats, daily.dev surfaces write-ups on how legacy systems really work._

### Why does my parser read garbage from the |PhrIndex file in a WinHelp file?

A likely cause is always reading at least one remainder bit when decoding phrase lengths. |PhrIndex stores lengths as a unary count in power-of-two steps plus remaining low bits, with the step size set per file. When the step is one, there are no remainder bits, so the read must be guarded with a bits > 0 check.

_When a binary format parser breaks on edge cases, daily.dev helps you learn from others' debugging stories._

## Community take

How the wider developer community reacted, aggregated from 2 discussions and 24 comments across lobsters, hackernews (as of 2026-11-28).

**TL;DR:** Discussion is largely nostalgic, with people reminiscing about WinHelp's contextual help and reference-material use cases, while also digging into technical tangents about related container/archive formats and authoring tools.

**Sentiment:** 55% positive · 35% mixed · 10% skeptical

**The case for**

- The contextual help feature (click a question mark, then click anything) is remembered as a genuinely great, fast way to learn software.
- WinHelp provided solid hypertext features (TOC, indexing, search, image maps) bundled free with Windows, without modern web bloat like ads or scripts.
- Several people recall specific books/publications that shipped as .hlp files and found them excellent.

**The pushback**

- CHM is seen by at least one commenter as a pointless regression from WinHelp's contextual help model.
- One commenter doubts anyone reads old help files like these anymore.
- The authoring process (abusing RTF footnotes/page breaks in Word) was confusing and opaque to at least one developer at the time.

**By community**

- lobsters (mixed): Conversation mostly branches into comparisons with other 'filesystem in a file' container formats (MS-CFB, PDB, Xar, ISO) rather than reacting to the post itself, with some practical notes on how .hlp files were authored via RTF and Help Workshop.
- hackernews (positive): Mostly nostalgic and appreciative, recalling WinHelp's contextual help and offline documentation as superior to what followed, alongside historical trivia about related formats and authoring tools.

**Highlights**

> The contextual help was the killer feature. You could click a question mark that activated your cursor, click on anything in the application, and you would get help right there in the window. Nothing Microsoft has built since then has come close to replicating that fast learning loop. .CHM was a pointless regression.
> — [jjordan on hackernews](https://news.ycombinator.com/item?id=50674599)

> They're built from RTF files with Help Workshop; most of the authoring is basically done in Word abusing various features like page breaks and footnotes for things that are not in the pages of the help file itself, and the Help project file for metadata like a TOC and index.
> — [calvin on lobsters · 10 points](https://lobste.rs/s/w4kxiz/how_winhelp_files_work#c_lprbeg)

> 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 my head around how they became popups and hyperlinks. Later, Compiled HTML Help arrived which was significantly less mysterious. Maybe because the input and output were still obviously HTML, packaged into a .chm with some metadata. Or maybe I’d just learned more.
> — [dcrazy on hackernews](https://news.ycombinator.com/item?id=50674568)

> I'm not familiar enough with them to say **how** much, but the description makes me think that they're at least *taking inspiration from* the [MS-CFB](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-cfb/53989ce4-7b05-4f8d-829b-d08d6148375b) container format that Microsoft Word `.doc` files are built on. ...Microsoft does have a history of liking "filesystem in a file" formats and, to be fair, one could argue that the current fashion of using Zip or SQLite as standard containers for structured data is also close enough to count. (OpenDocument, OOXML, EPUB, etc. etc. etc.)
> — [ssokolow on lobsters · 3 points, 2 comments](https://lobste.rs/s/w4kxiz/how_winhelp_files_work#c_sgt793)

**Source threads**

- [lobsters](https://lobste.rs/s/w4kxiz/how_winhelp_files_work) · 23 points · 8 comments
- [hackernews](https://news.ycombinator.com/item?id=50654773) · 3 points · 16 comments

## Similar posts on daily.dev

- [gzip decompression in 250 lines of rust](https://daily.dev/posts/gzip-decompression-in-250-lines-of-rust-cihydpn2m) · Hacker News · 2 upvotes · 0 comments
- [All of Hacker News in 5.3 GB, searchable on a laptop](https://daily.dev/posts/all-of-hacker-news-in-5-3-gb-searchable-on-a-laptop-i3blnm4vi) · Medium · 1 upvotes · 0 comments
- [Announcing Zstandard in Rust](https://daily.dev/posts/announcing-zstandard-in-rust-l4vxsmadl) · Lobsters · 0 upvotes · 0 comments
- [zlib-rs 0.6.9 Released With Performance Improvements](https://daily.dev/posts/zlib-rs-0-6-9-released-with-performance-improvements-ni0ekukve) · Phoronix · 0 upvotes · 0 comments

---

Tags: [#rust](https://daily.dev/tags/rust), [#reverse-engineering](https://daily.dev/tags/reverse-engineering)

[View this post on daily.dev](https://daily.dev/posts/how-winhelp-files-work-5aiygvczn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How WinHelp files work","url":"https://daily.dev/posts/how-winhelp-files-work-5aiygvczn","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-winhelp-files-work-5aiygvczn"},"datePublished":"2026-11-27T20:32:05.884Z","dateModified":"2026-11-28T04:17:52.296Z","description":"A WinHelp .hlp file is an archive with an internal B+ tree directory of pipe-named files like |SYSTEM, |TOPIC and |FONT. Text blocks use LZ77 with 12-bit...","image":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","thumbnailUrl":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","isAccessibleForFree":true,"articleSection":"Lobsters","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Lobsters","logo":"https://media.daily.dev/image/upload/s--tl8v_Fku--/f_auto,t_logo/v1698841318/logos/lobste.jpg","url":"https://daily.dev/sources/lobsters"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-winhelp-files-work-5aiygvczn","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"rust,reverse-engineering","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Lobsters","item":"https://daily.dev/sources/lobsters"},{"@type":"ListItem","position":3,"name":"How WinHelp files work"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-winhelp-files-work-5aiygvczn#faq","mainEntity":[{"@type":"Question","name":"How does WinHelp LZ77 compression encode back-references?","acceptedAnswer":{"@type":"Answer","text":"WinHelp's LZ77 groups data under a flag byte followed by up to eight items, where each flag bit (lowest first) marks a literal byte or a back-reference. A back-reference is two bytes: 12 bits of distance and 4 bits of length, with length stored minus 3. A distance of 0 repeats the last written byte. Developers digging into legacy file formats keep up with deep dives like this on daily.dev."}},{"@type":"Question","name":"How do WinHelp .hlp files store hyperlinks between topics?","acceptedAnswer":{"@type":"Answer","text":"Links don't store the target topic's position; they store a hash of the target's context name. To follow a link, hash the name the way WinHelp does and look it up in the |CONTEXT file, which maps hashes to positions. The hash uses a signed lookup table, multiplies by 43, is case-insensitive, and an empty name hashes to 1. If you reverse-engineer old formats, daily.dev surfaces write-ups on how legacy systems really work."}},{"@type":"Question","name":"Why does my parser read garbage from the |PhrIndex file in a WinHelp file?","acceptedAnswer":{"@type":"Answer","text":"A likely cause is always reading at least one remainder bit when decoding phrase lengths. |PhrIndex stores lengths as a unary count in power-of-two steps plus remaining low bits, with the step size set per file. When the step is one, there are no remainder bits, so the read must be guarded with a bits \u003e 0 check. When a binary format parser breaks on edge cases, daily.dev helps you learn from others' debugging stories."}}]}
```

