ITSF format

Preface

This chapter an addon to Matthew Russotto's page; "Microsoft's HTML Help (.chm) format", which is available at http://www.speakeasy.org/~russotto/chm/chmformat.htm. It details a few facts not included in that page.

Titbits

The LCID in the initial header is the LCID of the OS at the time of compilation, not the one stored in the HHP file. It is unknown whether or not this is the system LCID (from GetSystemDefaultLCID), the user LCID (from GetUserDefaultLCID) or the thread LCID (from GetThreadLocale). It is likely to be GetUserDefaultLCID since that is the function that itss.dll depends on. If you have the facility to check this please let us know of the result.

The LCID in the directory header is probably from the program that compiled the ITSF, definately not the one stored in the HHP file or from the OS. It is unknown which EXE/DLL this LCID comes from, but at a guess it would be ITSS.DLL, which provides the GUID that follows it. 0x409=en-us is the only one seen. If you have a non-us version of HHW please change your system and HHP locales to something other than en-us & other than the locale of HHW, compile a CHM and check its LCID at offset 168.

Between the chunk entries and the quickref entries is chunk length - ( num entries / n + !!( num entries % n ) ) * 2 bytes worth of free space. This usually contains the same data from the same offsets in the previous chunk, and can be zeroed out, with no effect on the decoder and a slight increase in the compressability of the file with zip/gzip/bzip2 & probably other crunchers. The free space is usually partial/junk chunk entries, free space and/or quickref entries.