PECompact v1.22

©1999 Jeremy Collake

All Rights Reserved.

Email: mailto:jeremy@collakesoftware.com

Homepage:

http://www.collakesoftware.com/

 

 


This software is provided as-is, without warranty of ANY KIND, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The author shall NOT be held liable for ANY damage to you, your computer, or to anyone or anything else, that may result from its use, or misuse. Basically, you use it at YOUR OWN RISK. Registration is required to continue using this software after a 14-day evaluation period has expired. Please see the registration information at the end of this document.


 

          I.      Overview

PECompact is a utility that compresses Windows 9x/NT4/w2k executables and DLLs to, typically, less than half their original size while leaving them 100% functional. PECompact’d applications occupy less disk space, cost less to distribute, are loaded quicker across networks, decrease network traffic, and are more difficult to reverse-engineer and modify.

 

PECompact works by compressing the code, data, import directory, selected resources and other portions of Windows executables. The executable is decompressed and rebuilt at runtime with no noticeable delay. In fact, compressed executables can actually load quicker in some cases because there is less data to be retrieved from the disk or network. Both compression algorithms used by PECompact feature an optimized, 32bit x86 assembly language decompressor for maximum data throughput.

 

Unlike competing products, PECompact is highly configurable and gives the user much more power to select what is compressed and how it is compressed. PECompact also has unique plug-in support to allow for users to supply their own encryption/decryption procedures or special functionality to compressed executables.

 

For users who prefer not to compress their executables for whatever reason, PECompact also offers a “Trim Only” option that optimizes the executable structure and decreases its size without applying any compression at all! This function can optionally strip relocations from the executable.

 

Features

 

     II.      Usage

PECompact analyzes the target executable and auto-configures itself for those users who prefer not to get involved with the intricate details of the compression. However, to support more advanced users, PECompact is the most configurable executable compressor on the market.

A.                       Options

 

 

1.      The Main Dialog

 

Function Name                       Description

Compress Normal Application

Compress file as a normal EXE.

Compress DLL/OCX

Compress file as a Dynamic-Link Library or OCX control.

Trim Only

Realign and optimize the executable structure without applying any compression or installing any symbiotic code. Relocations are stripped from EXEs, and left preserved in DLLs.

aPLib

Utilize Joergen Ibsen’s aPLib data compression library. This compression library is fast and tight, especially for files smaller than 64k. This option can also be selected by using the command line switch “/J”.

JCALG1

Utilize Jeremy Collake’s JCALG1 compression library. This compression library supports multiple compress level settings and performs better than aPLib on larger files. This option can also be selected by using the command line switch “/J-“.

Compression Level

This trackbar allows the user to select the compression level that JCALG1 will use. A higher level (farther to the right) will use a larger window size, thereby increasing the compression level but decreasing the compression speed. Note that higher compression levels will require significantly more memory during compression. Decompression speed and memory requirements are unaffected.

Browse

Browse for and select a file to compress or trim.

Compress/Trim

Begin compression or trimming of an executable.

Test

Test the compressed executable, with an option to restore the backup.

Erase .BAK

Erase backup of compressed executable.

Exit

Exit PECompact.

Advanced Configuration

Show the advanced configuration dialog. See below for explanation of options there.

 

2.      Advanced Configuration

 

Create New Section

Places the PECompact symbiotic code into a new section of the executable rather than the default of appending it to the last section. Checking this option may result in a slightly larger compressed executable.

Restructure Resources

Restructure the resources in a more compressible format. Turning this option off will hinder compression of some resources in the executable.

Merge Sections

Merge congruent, compressible sections into one section to reduce file alignment overhead. Turning this option off will result in a larger compressed executable, but slightly faster loading.

Strip Relocations

Strip the relocations (fixups) from the executable. It is safe to strip the relocations from EXEs, but one should NEVER strip the relocations from DLLs.

Compress Export Table

Compress the export table, if it exists. The export table of most DLLs should remain uncompressed.

Use Windows DLL Loader

Allow the windows loader to process the import directory instead of the PECompact symbiotic code.

Copy Overlay

Some executables, such as setup applications, have extra data appended to the end. Selecting this option will cause any extra data to be copied to the end of the compressed executable.

Backup File

Create a backup of the file before compression. The backup will be named the same as the original, except it will have the “.bak” extension appended to it.

Small/Fast Decompressor

The small decompressor is smaller, yet slower than the fast decompressor. The size difference is about 150 bytes, but the fast decompressor could cause an increase in executable size by as much as 512 bytes.

Plugins - Encrypt

Select the encryption plugin.

Plugins - Decrypt

Select the decryption plugin.

Plugins - Post-operative

Select the post-operative plugin.

Finish Beep

Emit beep when compression of a file is complete.

One Instance

Only allow one instance of PECompact to be active at a time.

Lock Memory in RAM

Lock allocated memory into RAM if possible.

Compressible Resources

This list of resources allows for selection of which resources should be compressed, and which should remain uncompressed and preserved.

All Shell Icons

Compress all shell icons, leaving none available for display by explorer and other applications.

# of Shell Icons

The maximum number of icons to leave uncompressed and available for display by explorer and other applications. Decreasing this number will result in greater compression of most executables.

 

3.      Menu Options

 

Configuratation / Save Configuration

Save the current configuration. It will be loaded for all subsequent PECompact executions, but can be overridden by command line parameters.

Configuration / Load Configuration

Load the last saved configuration.

Configuration / Restore Defaults

Restore the default configuration.

Help / About

Display the about box and registration status.

Help / Check For Update

Check for an update on Collake Software’s website.

 

B.     Command Line Switches

 

PECompact can be run without any parameters, however it also accepts the following command line syntax:
PECompact [filename] [switches]

/A

Automatically start compression or trimming without any user intervention.

/X

Automatically exit after compression or trimming is complete.

/T

Trim only, do not compress.

/M[-]

Toggle on/off section merging.

/C[-]

Toggle on/off resource restructuring.

/L[-]

Toggle on/off usage of windows DLL loader.

/E[-]

Toggle on/off compression of the export table.

/I[-]

Toggle on/off compression of all shell icons.

/B[-]

Toggle on/off backup of file.

/O[-]

Toggle on/off copying of overlay.

/S[-]

Toggle on/off stripping of relocations.

/R[-]

Register or unregister shell extension.

/J[-]

Toggle usage of aPLib.

/0-9

Specify compression level for use by JCALG1.

/F[-]

Toggle usage of fast decompression procedure.

 

Command line switches override a saved configuration.

 

III.      Plugins

 

PECompact has unique support of plugins to allow users to add new functionality to the PECompact symbiote. This section is briefly describes the specifications for plugin development, it is intended for developers only.

 

Plugin code is read from an exported procedure of a DLL. This code is loaded into the symbiote, with the exception of the encryption plugin in which it is not necessary to do so. The code has read/write access to itself, however delta offsets must be calculated because the code will not be loaded at its default base on compile. Please see my sample plugins, they should make everything obvious.

 

Of course, it is NOT necessary to include the plugin DLLs with the compressed application.

 

Encryption Plugin

-------------------

Exported API: EncryptPlugin

Maximum Size:   100h

On entry:

             edi->destination

             esi->source

             ecx=size

Preserve:

             You must preserve all registers except edi, esi, eax, and ecx.

Notes:

             This plugin is executed after compression of a section.

 

             

Decryption Plugin

------------------

Exported API: DecryptPlugin

Maximum Size:   100h

On entry:

             edi->destination

             esi->source

             ecx=size

Preserve:

             You must preserve all registers except edi, esi, eax, and ecx.

Notes:

             This plugin is executed before decompression of a section.

             

                         

Post-operative Plugin

---------------------

Exported API: PostOperativePlugin

Maximum Size:   200h

On entry:

             esi->LoadLibrary

             edi->GetProcAddress

Preserve:

             Nothing necessary.

Notes:

             This plugin is executed immediatly prior to passing control

             back to the original entry point of the executable.

 

 

IV.      Registration

 

To continue using PECompact after the 14-day evaluation period, registration is required. All license types include free lifetime updates. To purchase PECompact via a secure web server using a credit card, please click on the desired license type below:

Consumer License

$15

Licensed for use on a single computer for private use or for use on freeware applications by authors.

Shareware License

$30

Licensed for use on shareware applications by authors.

Commercial License

$140

Licensed for use by software companies and teams of programmers on commercial/retail applications.

 

For additional purchasing information please visit http://www.collakesoftware.com or email collake@charter.net. Alternatively, PECompact can be purchased by sending a check or money order to:
           
            Jeremy Collake
            PO BOX 426
            Talbott, TN 37877
            USA