shurr@cbnews.att.com (Larry A. Shurr) (05/18/90)
(I inadvertantly posted this to comp.binaries.ibm.pc instead of c.b.i.p.d like I was supposed to. Hopefully the moderator will forgive my mistake and discard my bogus submission. My apologies.) The lzexe V0.91 program by Fabrice BELLARD recently discussed in cbip compresses EXE files and attaches a small stub program which expands the compressed program text, peforms segment fixups at run time and runs the original program. In exchange for a small amount of memory & CPU time, you can save a lot of disk space. The expansion and fixup phase is very quick: on my TI Pro, the run-time penaly appears to be almost exactly offset by the savings in time waiting for disk I/O on the smaller file. On a 386 system, the delay is unnoticable. Unfortunately, lzexe as distributed hangs my old TI Pro. After expand- ing it with the unlzexe program, I found that it appears to perform an unnecessary processor speed check. I patched the call to that routine, and the program continues to work fine and works on non-IBM compatibles such as the Pro. The following script illustrates the patch: C> unlzexe lzexe.exe C> ren lzexe.exe lzexe.xxx C> debug lzexe.xxx - e1d6d 90 90 B8 00 00 - w - q C> ren lzexe.xxx lzexe.exe C> lzexe lzexe.exe CAVEATS: This patch is valid only for version 0.91 of lzexe. Always patch a copy of your program instead of the original in case any- thing goes wrong. Since I don't really know why the program performs a speed check or even if that is what it's really doing, I don't know why it's OK to omit that step. Hence, the big caveat: There is no warranty for this patch. The program is not warranted by its original author, anyway, so how could I? The program is freeware, so is the patch. EXPLANATION: The patch replaces a far call to the offending routine with the instruction sequence: NOP NOP MOV AX,0000h I couldn't just use a series of NOPs as the instruction replaced is a far call which gets a segment fixup at load time. The segment fixup would overwrite some of the NOPs creating an unpredictable and possibly harmful instruction sequence. With my patch, the segment fixup is placed in the source field of the MOV AX instruction and causes no harm. WHERE TO FIND LZEXE: Lzexe and related utilities are available from Simtel20 and from it's related listservers: Directory PD1:<MSDOS.FILUTL> COMTOEXE.ZIP B 6992 900311 Converts COM files to EXE files for LZEXE ISLZEXE.ZIP B 4816 900317 Lists names of EXE files compressed with LZEXE LZEXE91.ZIP B 43939 900329 Compress most EXE files and run them directly LZESHL21.ZIP B 23261 900409 Shell program for LZEXE. English output UNLZEXE.ZIP B 9118 900403 Converts LZEXE compressed EXE to original EXE regards, Larry -- Signed: Larry A. Shurr (cbnmva!las@att.ATT.COM or att!cbnmva!las) My psuedo-Burma Shave .signature has served me long and well and has been retired. A new .signature is now under consideration. This posting reflects my opinions, not those of AGS or AT&T, but you knew that)