These internal files let WinHelp find topics by context name, keyword or title. Most are B+ trees. A topic offset is explained on the |TOPIC page.
|CONTEXT
A B+ tree (structure L4) from the hash of a context name to a topic offset.
Jumps in Windows 3.1 and later files carry only the hash, so a name cannot be recovered
from the file.
The hash is built character by character, multiplying by 43 and adding a value for the character from a fixed table. HELPDECO’s notes give the table.
|KWBTREE, |KWDATA, |KWMAP
The keyword index for K footnotes. Other letters use files named in the same
way, such as |AWBTREE for A footnotes.
| File | Holds |
|---|---|
|KWBTREE | A B+ tree. Each leaf entry is a keyword, a 16-bit count and a 32-bit offset into |KWDATA |
|KWDATA | An array of topic offsets. A keyword’s entry starts at its offset and runs for its count |
|KWMAP | Six-byte entries: a 32-bit keyword number and a 16-bit leaf page number |
|TTLBTREE
A B+ tree from topic offset to title (structure Lz), used to name topics in the
search dialog.
|TOMAP
Windows 3.0 only. An array of topic positions, indexed by topic number, which starts at 16 in the files checked for this page. Jumps hold the topic number.
|CTXOMAP
A 16-bit count, then entries of a 32-bit map number (from the project’s
[MAP] section) and a topic offset. Programs use it to open a topic by number.
Other tables
| File | Holds |
|---|---|
|Viola | A B+ tree from topic offset to the number of its default window |
|Rose | A B+ tree from a keyword hash to a macro and a title, for macros attached to search terms |
|Petra | A B+ tree from topic offset to the name of the source file |
|CF0, |CF1 … | NUL-terminated macros, one file for each configuration section |
The .CNT contents file
WinHelp 4 (Windows 95) reads a plain text file beside the help file, with the same base name and
the extension .cnt, to build the Contents tab. It is not part of the .hlp
file. Each line is one of:
| Line | Meaning |
|---|---|
:Base file.hlp>window | The help file (and optionally the window) the entries below go to |
:Title text | The title of the contents window |
:Index name=file.hlp, :Include file.cnt, :Link file.hlp, :Tab name=macro | More indexes, contents files and help files to merge in, and custom tabs |
1 Title | A book: a level from 1 to 9, a space and a title, with no =. The entries one level deeper that follow belong to it |
2 Title=context | A topic: the title, then = and the context string to jump to. @file.hlp after the context names another help file and >window a secondary window |
2 Title=!macro | An entry that runs a macro instead of jumping |
; text | A comment |
The explorer opens a .cnt file and lists its entries with each line linked to its bytes; it was
checked on 20 real files (Windows-1252 text, CR LF line ends). The directive list above comes from those files
and from memory of the Help Workshop documentation, not from a source checked here: a directive that is not
in it is flagged, not rejected.
The .GID cache file
WinHelp 4 writes a .gid file beside a help file the first time it opens it. It uses
the container of the help file itself (the 16-byte header, the directory and B+ trees) but has no
|SYSTEM file. The files seen in 42 real examples:
| File | Holds |
|---|---|
|FILES | A B+ tree (structure L4z): a file number, a 32-bit value and a path. Number 1 is the help file, its path starting with =; number 10000 is the contents file. The value for the help file differs between files (it looks like a time stamp or checksum, not confirmed) and is 0 for the contents file |
|KWBTREE | A B+ tree (structure F!) that merges the keyword tree and its data: a keyword and a counted block of packed topic references, 8 bytes for one topic. The packing is not worked out |
|KWMAP | The six-byte entries described above, for the merged tree |
|Flags | 756 bytes, starting 87 10 00 00. Unknown |
|Pete | 2,048 bytes, mostly zeros after a short header. Unknown |
|WinPos, |CntJump, |CntText | Named in HELPDECO’s notes (an empty tree, the jump references of the contents file, and their titles); none occurs in the examples checked here |