EXEPACK2

EXEPACK2, or EXEPACK:2, is the (informal?) name of a compressed data format used in some OS/2 executable files (see Linear Executable), and certain other OS/2 formats. It was introduced in OS/2 Warp (OS/2 3.0).

Such executables are usually created by using the "/EXEPACK:2" option of the LINK386 utility, or by the special REPACK utility.

The decompressor is built into the OS/2 loader, so a compressed executable does not contain the code for decompressing itself.

Format details
The compression scheme is essentially a derivative of LZ77/LZSS, with a 4K history buffer. It also incorporates run-length encoding.

Assuming that OS/2 Boot Logo files use the same EXEPACK2 compression as executables, there is a small but significant error in the Wynn/Wu paper. For a "Long String token", it says the length field is biased by 3, when in fact it is not biased.

Other clarifications:
 * When a token specifies both a set of uncompressed bytes, and a copy-from-history instruction, it is processed as if it were two separate instructions, in that order.
 * The "distance back" values are encoded such that the most recently decompressed byte is 1, not 0 as it is in most formats.

Specifications

 * 2000 Publications (Jie Wu) → A. C. Wynn and J. Wu, "The Effect of Compression on Performance in a Demand Paging System," Journal of Systems and Software 50 (2000), pp. 151-170 - §3.2. Exepack2 page-based compression.

Software

 * → repack
 * lxLite - possibly related
 * See also OS/2 Boot Logo, notably lgoproc.