======================================================= COMPRESSING YOUR EXECUTABLES --- SOMETHING FOR NOTHING? ======================================================= by Dickford Cohn Ah yes, the current "rage" in PC-land: EXECUTABLE FILE COMPRESSION! Does it work? Yes! Very well! Is it "something for nothing?" Well, you be the judge --- in my experience, it is VERY useful. This article is intended to "corral", in one place, most of the "bits and pieces" of what is known about these programs and to offer performance comparisons and operating tips gleaned from those who have used them. This article centers upon the THREE most common methods available to us --- those that I've used and tested. --WHAT IS EXECUTABLE FILE COMPRESSION? It is simply a method by which an EXECUTABLE file (.COM or .EXE) is made small- er on disk (outwardly similar to PKZIP). If you have a lot of executables, you can save substantially on disk space. When a file is "compressed" a small addi- tion is made to the code that UNCOMPRESSES the executable to "full size" when it is loaded into RAM. It's that simple (yeah, the programming is a LOT more involved than that!) --IS EXECUTABLE FILE COMPRESSION SOMETHING I CAN USE? It depends on how you use your system and what you have on it. For example, if your PC emulates your office PC in that you have 50-60 executables and you pri- marily have spreadsheet/word processing programs on your hard disk, an execut- able file compressor would probably not be worth the expense of a download. On the other hand, if your system has LOTS of executables, executable file com- pression is quite effective in re-capturing valuable disk space. In my own case I have almost 950 executables that, at normal size, take up almost 25Meg of disk space. I have compressed over 500 of these executables, re-capturing almost 9Meg of disk space --- representing about 15% of my TOTAL OCCUPIED DISK SPACE! TWO IMPORTANT NOTES: (1) Executable file compression is NOT a replacement for other disk management techniques (i.e. good housekeeping): It IS an effective tool to add to your arsenal. (2) Executable file compression is NOT A GOOD IDEA in the office setting --- unless YOU are SOLELY responsible for your PC: In the hands of the uninitiated, these programs can be dangerous. --IS EXECUTABLE FILE COMPRESSION DANGEROUS? ANY program that can OVERWRITE an existing file is dangerous! You MUST have a BASIC UNDERSTANDING of what you are doing and employ the standard safeguards that ANYONE would employ (i.e. backups) when dealing with programs that have this capability. With that in mind, it must be said that ALL the programs des- cribed here in detail are thoughtfully designed and have certain safeguards built in. However, there is NO EXCUSE for NOT READING THE DOCUMENTATION --- it is BRIEF and CONCISE. ===================================== ADVANTAGES OF COMPRESSING EXECUTABLES ===================================== There are TWO distinct advantages to compressing executable files: 1. You can achieve a substantial savings in disk space by using these util- ities: Typically, you can re-capture 35-40% of the disk space now occupied by your executables. You have to determine if the OVERALL space gained is worth the effort. 2. A less-heralded but equally significant benefit of executable compression is that compression (a form of encryption) offers some protection against viruses that overwrite program code. Since the "file header" is relocated, the virus can't find it (to attach itself); hence the virus cannot over- write code. However, the executable is still "externally infected" --- it CAN load the little critter into RAM, ready to "pounce" on some uncompress- ed executable. At least, your executable is not TRASHED. ====================== GENERAL TIPS FOR USAGE ====================== 1. DO NOT COMPRESS DOS's COMMAND.COM, or ANY CRITICAL DOS FILES --- if you don't know which DOS files are CRITICAL, don't compress ANY OF THEM. (Watch for my upcoming article, HARD DISK MANAGEMENT TIPS, which will include a section on DOS files you can "dump" or replace with "modern" equivalents: Saves about 300k on your disk!) 2. If you choose to compress executables at all, pick ONE method and stick with THAT ONE. The confusion caused by "mixing 'em up" is not worth it. 3. When compressing executables for the first time, or experimenting, create a separate directory and COPY your "target" executable to it (this precludes damage caused by "typos" at the command line and such --- if you screw up, all you have to do is RE-COPY the file and try again.) When you are satisfied with the result, RENAME the ORIGINAL executable, and copy the COMPRESSED executable to its original directory. Now, TEST the "new" executable --- call up your program and see if ALL of its functions work. I mention this because SOME programs will compress just fine (i.e. with NO WARNINGS from the compression program) and yet they MAY NOT work properly, if AT ALL. 4. Some programs have a companion "configuration" program that WILL NOT WORK on a compressed executable. Just UNCOMPRESS the executable, re-configure (via the config program) what you want and then RE-COMPRESS the executable. ================= WHAT'S OUT THERE? ================= At this writing, I am aware of EIGHT executable file compression programs: - AXE ...A program from Systems Enhancement Associates. This is a commercial software package ($65) that, outwardly at least, offers no significant advantages over other methods (see COMPARISON) and is NOT reviewed here. - EXEPACK ...A MicroSoft product, NOT generally available but packaged with certain software (MASM 5.1). Although, apparently the FIRST such program of this type (1986 copyright), it is NOT in the same league as those reviewed here, although you are LIKELY to encounter this method with some executables. - DIET ...A program by the author of LEXEM (functions like PKZIP and apparently in wide usage in Japan). DIET is reviewed here. - LEXEM ...Not currently distributed in the U.S. (Likewise, you are NOT likely to encounter files compressed with this method) - LZEXE ...By Fabrice Bellard; the first generally available program of this type --- reviewed here. - PKLITE ...Shareware from PKWARE ($46) --- reviewed here. - SHRINK ...An experimental method, not in the same class as those re- viewed but interesting to those who may want to delve into the "mysteries" of compression. - TINYPROG ...Shareware from Tranzoa Associates. Only slightly more eff- ective than EXEPACK: No UNCOMPRESS available. Not reviewed. ==================== PROGRAM DESCRIPTIONS ==================== +------------+ The "newest" of the three tested, by Teddy Matsumoto, the author | DIET10.EXE | of LEXEM an "archive" program used in Japan. This program app- +------------+ ears well written -BUT- by the authors own subtle admonition, it is experimental. It SEEMED to work slightly better than the other two -BUT- and this is a big BUT: IT DOES NOT CHECK FOR EXECUTABLES THAT USE OVERLAYS --- IT JUST COMPRESSES THEM! YOU WILL NOT BE ABLE TO RESTORE THE EXECUTABLE WITH THE '-R' SWITCH, EITHER --- THE FILE IS DESTROYED! (That's WHY you maintain back-ups). The program DOES ALLOW you to make back-ups however, so you should be safe. When I attempted to compress a 1 Meg+ executable (that I knew used overlays), the error that came up was "insufficient memory" (more about this later). DIET also compresses using wildcards and WILL COMPRESS virtually any file EXCEPT one that is already compressed by another program. PRICE: The current version on EXEC-PC (DIET10.ZIP) is **FREE** +------------+ Developed by Fabrice Bellard (current version is 0.91, backward | LZEXE.EXE | compatible with version 0.90). This program was the FIRST +------------+ generally available executable file compressor --- and is the most widely used (see SUPPORT PROGRAMS). It also is programmed with some forethought: For example, it can recognize the MicroSoft EXEPACK compression method in executables; it can UN-compress EXEPACK'd files and RE-compress them with it's own method (the savings is significant). It's error prompts work as advertised -BUT- they're too polite! For example, if you decide to go ahead and compress an executable that uses over- lays, you'll NEVER restore it with the un-compressor UNLZEXE.EXE However, since LZEXE DOES NOT OVERWRITE your ORIGINAL FILE, you are safe! LZEXE copies your original file to an ".OLD" exten- sion: You simple erase the "bad .EXE" and RENAME the ".OLD" file to an ".EXE" extension. The original program's prompts are in French (there is a program in English --- ENGLZEXE.ZIP): I would recommend LZESHELL to sensibly use LZEXE. LZEXE also com- presses .COM files, but it first converts them to .EXE files and THEN compresses them. This measurably slows down the process AND you CANNOT restore "converted" .EXE to .COM files (the .OLD file is STILL created, though). This program comes with LZEXE (the compressor), UPACKEXE.EXE (unpacks EXEPACK'd files) and COMTOEXE.EXE (converts .COM files to .EXE). You MUST also have UNLZEXE.EXE, by Kou Kurizono, to UN-compress LZEXE'd files! PRICE: The current version on EXEC-PC (LZEXE91.ZIP) original French version -OR- (ENGLZEXE.ZIP) English version, are **FREE** +------------+ Developed by PKWARE (the purveyors of PKZIP, et al) this program | PKLITE.EXE | is a textbook example of "completely developed" software. +------------+ Unlike the other two examples, there are no "cliffs" to fall over; no unforgiving "surprises". Performance was slightly less than the other two overall --- the difference is nominal. The elements I liked best are: This is a COMPREHENSIVE package, fea- turing a logical selection of command line options; it IS INTUITIVE; -AND- unlike the other two, it could COMPLETELY RE- CONSTRUCT an executable with overlays that it had COMPRESSED! This program compresses (and UN-compresses) .COM and .EXE only. PKLITE WILL NOT COMPRESS Windows Executables (A SAFETY FACTOR). PRICE: The current version on EXEC-PC (PKLTE103.EXE) costs **$46** =================== SUPPORTING PROGRAMS =================== The following is a PARTIAL listing of programs that provide support for the compression programs above (files on EXEC-PC):