Search code examples
compression7zipextractchm

How to pack-back a chm file that was unpacked by 7zip


According to the 7zip documentation, the formats that 7zip supports are:

Packing / unpacking: 7z, XZ, BZIP2, GZIP, TAR, ZIP and WIM

Unpacking only: AR, ARJ, CAB, CHM, CPIO, CramFS, DMG, EXT, FAT, GPT, HFS, IHEX, ISO, LZH, LZMA, MBR, MSI, NSIS, NTFS, QCOW2, RAR, RPM, SquashFS, UDF, UEFI, VDI, VHD, VMDK, WIM, XAR and Z.

I wanted to ask, if I use 7zip to unpack a chm file. How can I pack it back? I see that 7zip does not support this, so who does? I would like to take the files that 7zip unpacked (from the chm file) and create back a CHM file. Is that possible?


Solution

  • If you have only the CHM file, there is no easy way to do this and you need reverse-engineering like mentioned by @Mark.

    So you have to decompile the CHM file and compile again by HTML Help Workshop - a free CHM compiler created by Microsoft many years ago - or by another help authoring tool.

    Edit 2023-01-11:

    I've archived a copy of the HTML Help Workshop installer

    Microsoft HTML Help Downloads (the download links are broken and dropped by Microsoft)

    If you really want to start with Reverse Engineering a first step of decompiling is described at HTMLHelp command-line. Search for: Example of using HH.EXE to decompile a CHM help file.

    You know, you can use 7Zip or just open a command prompt window on a Windows PC and type the following:

    hh.exe -decompile <target_directory> <path>\<filename>.chm
    

    The only decompiler with any additional features is KeyTools as this can try to rebuild the project (.hhp) file. You'll need this file if you want to recompile the help project.

    One thing to note is that the decompile/recompile process isn't a "round-trip" process. Certain features that the help author added to the original help file can't be recovered when you decompile it, so these may no longer work properly after you've recompiled. This is especially true in the area of context-sensitive help, which may be broken in the new version of the file.