home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / COMPRESS / LZEXE.ZIP / LZEXE.DOC next >
Encoding:
Text File  |  1990-02-20  |  9.5 KB  |  226 lines

  1. Documentation for:
  2. -------------------
  3. LZEXE.EXE v0.90 (ß-release) (c) 1989 Fabrice BELLARD
  4. Compressor for EXE files.
  5.  
  6.  
  7. This program is in the public domain (FREEWARE), and you can therefore
  8. use, copy and distribute it freely.  You can also utilize it commercially,
  9. i.e. you can use it on programs you intend to sell.  However, the sale of
  10. LZEXE.EXE itself is forbidden.
  11.  
  12.  
  13. Requirements:  PC and compatibles.  80286 or 80386 microprocessors are
  14. recommended  for greater execution speed.
  15. Memory requirements: 256K minimum are needed to run LZEXE.
  16.  
  17.  
  18. 1-Introduction
  19. --------------
  20.  
  21. This utility compresses EXE files, namely executable files.
  22. You know that there are many other compressors for such files, such as
  23. the excellent PKZIP or LHARC.  This uniqueness of the present method
  24. consists in the fact that the compressed files can be run directly!
  25. For almost all EXE files the decompression time is so short that it is
  26. negligible ! In addition the decompression does not use any extra space
  27. on disk or in RAM.  It simply uses the amount of RAM normally allocated
  28. for the uncompressed file.  The compressor algorithm has been optimized
  29. not only for speed but also for efficiency:  EXE files are reduced almost
  30. to the size of their ZIPped counterparts.  I am working on future releases
  31. which I hope will be even better.
  32.  
  33. 2-Using LZEXE
  34. -------------
  35.  
  36. Usage is very simple: just enter the command line
  37.  
  38.                  LZEXE filename [path]
  39.  
  40. where filename is the EXE file to be compressed.  The extension .EXE is
  41. implied by default. "path" is optional: it refers to the directory where
  42. the compacted file and the temporary working file LZTMP.EXE are to be
  43. located.
  44.  
  45. Warning!  Certain files are EXE only by name! For DOS it is not the 
  46. extension EXE that characterizes an 'EXE' file, but the presence of a header
  47. with the letters "MZ" followed by information on the length of the file
  48. the space occupied in RAM, etc...  Thus if you change the COM extension to
  49. EXE, LZEXE will refuse to process the file.
  50.  
  51. There is a way to force LZEXE to accept a COM file: just use COMTOEXE by the
  52. same author.  It works like EXE2BIN in reverse.
  53.  
  54. For greater safety LZEXE does not erase the original EXE file, but it renames
  55. it with the extension .OLD.  In addition it creates the temporary file
  56. LZTMP.EXE which is renamed with the name of the original program only at the
  57. end of the compression process.
  58.  
  59. 3-Usage tips
  60. ------------
  61.  
  62. Certain files can not be compressed for various reasons:
  63.  
  64. -  The file is not a true EXE file.  Solution: use COMTOEXE.EXE.
  65. -  The relocation table is too large. To understand this you need to know
  66.    the internal structure of an EXE file: such a file can occupy several
  67.    segments unlike COM files.  Thus it must contain a table specifying where
  68.    to branch and where to call subprograms, etc... And if the program is
  69.    rather large  it may confuse the compressor.  I have provided for a table
  70.    with up to 16,000 relocation addresses, which should suffice for almost
  71.    all EXE files.
  72. -  The file you wish to compress has already been compressed by LZEXE.
  73.    Notice that there exists another compressor:   Microsoft's EXEPACK.EXE,
  74.    which however is far less efficient than LZEXE.  LZEXE can further
  75.    compress an EXEPACKed file.
  76. -  Sometimes the compression factor is not significant.  This may happen with
  77.    very small files (less than 2K).  Normally the compression is quite
  78.    substantial.
  79.  
  80.  
  81. -  A more serious problem: certain compressed EXE file may hang the system:
  82.    
  83.     -  If the program checks its size (like Turbo Debugger for example).
  84.     -  If it checks for its integrity on disk.
  85.     -  If it uses overlays, which must be loaded later and thus must occupy
  86.        occupy fixed position in the file.
  87.     -  Programs that require Microsoft's Windows:  they are not true EXE
  88.        and will not work properly if compressed.
  89.     -  This list may grow, since I have not experimented with all types
  90.        of EXE files.
  91.  
  92.  
  93. -  A less serious problem: Certain programs use configuration options that
  94.    modify the code (Turbo  Pascal, for example).
  95.    In this case, first configure the program, then compress it.  (Always
  96.    keep an uncompressed version for safety.)
  97.  
  98.  
  99. 4-Some technical notes
  100. ----------------------
  101.  
  102.     The compression algorithm used is based on the Ziv Lempel method,
  103. uses a circular (ring) buffer, and a tree-lile method for finding byte
  104. sequence repeats.  The encoding of the position and length of the repeating
  105. sequences is optimized via an auxiliary algorithm based on the Huffman
  106. method.  Uncompressed bytes are kept unchanged since any further method
  107. (such as Adaptive Huffman, as in LHARC, or Shanon-Fano trees, as in PKZIP)
  108. would have entailed a much longer decompression time, and above all, a much
  109. more complex and larger decompressor, which would have decreased excessively
  110. the compression factor.
  111.  
  112.     The decompressor is located at the end of the compressed EXE file
  113. and is 395 bytes long (in this version). Its functions are:
  114.  
  115. -  Check the CRC to ensure that the file has not be tampred with (useful
  116.    against viruses).  If the test files, the message  "CRC Error" is
  117.    displayed.
  118. -  Locate itself in high RAM, then move the compressed code in order to
  119.    leave sufficient room to the EXE file.
  120. -  Decompress the code, checking that it is correct, and adjust the sgments
  121.    if more than 64K (this was a hard problem, in terms of speed!).
  122. -  Decompress the relocation table, and update the relocatable addresses
  123.    of the EXE file.
  124. -  Run the program, updating the CS,IP,SS,SP registers.
  125.  
  126. That's all!!!
  127.  
  128.     This decompressor is by itself a little jewel of 8086 assembler
  129. programming. It goes without saying that it was hard work.  But the
  130. compressor was not much easier, particularly with regard to the updating
  131. all the pointers that the decompressor needs in order to function. 
  132.  
  133.  
  134. 5-LZEXE and the other compressors
  135. ---------------------------------
  136.  
  137. PKARC (latest version):  LZEXE  is much better:  "crunching" (alias
  138. Shrinking for PKZIP) is outdated...
  139.  
  140. PKZIP v0.92: LZEXE is just about as efficient for large files.
  141.  
  142. PKZIP v1.02: better than LZEXE due to "imploding", since this algorithm
  143. is a subset of mine, but the decompressor is slower than mine.
  144.  
  145. LHARC v1.01:  better than LZEXE due to "freezing", but same remark as
  146. for PKZIP v1.02.
  147.  
  148. LARC: LZEXE is better.
  149.  
  150. Important notes:
  151.  
  152. - One can not truly compare LZEXE with these other products. since the
  153. files compressed with my method contain a decompressor which runs the
  154. programs by itself.  It is true that the other compressor can create
  155. "self-extracting" files, but they do so on disk, are slow and add sveral
  156. scores of K to the compressed files (except for PKARC and LHARC, which add
  157. only 1 or 2K., but only decompress to disk, unfortunately.)
  158. - In almost all cases. the compressors mentioned can not further compress
  159. a file already compressed with LZEXE, which demonstrates the high 
  160. efficiency of thismethod.
  161.  
  162.  
  163. 6-The future...
  164. ---------------
  165.  
  166. - I want to develop soon a decompressor which allows the recreation of the
  167. original EXE file from the compressed one.  Its usefulness is questionable,
  168. - I intend to optimize further the decompressor for speed,  and the
  169. compressor for efficiency, by further reducing the relocation table, for
  170. example (I already have a few ideas...);  adding a password system, and
  171. creating an 80836 version which should speed things quite abit.
  172. - I intend to develop a decompressor for  Microsoft's EXEPACKed files, which
  173. is interesting because my compressor works better on files which have not
  174. been treated with EXEPACK.
  175. - I am also thinking of an automatic document-decompressor of the LIZEMOI.COM
  176. or LIST.COM type, which should be very handy.
  177. - Finally, I hope to create a "universal" compressor, like PKZIP or LHARC,
  178. slower than LZEXE in decompression, but better than the existing ones.
  179.  
  180.  
  181.  
  182. 7-Warnings...
  183. -------------
  184.  
  185. I hope that LZEXE and the files it can create may become very popular...
  186. a good incentive for further work.
  187.  
  188. I shall not be responsible in any way for any loss of data caused by LZEXE>
  189. But rest assured: the algorithms are reliable and I do not believe there
  190. are many bugs. If the EXE program created by LZEXE functions properly the
  191. first time, then it will always do so!
  192.  
  193. Warning!  I advise against compressing and distributing commercial software
  194. protected by copyright.  The authors may not like it...
  195.  
  196. But if you create a piece of FREEWARE or SHAREWARE,  or even a commercial
  197. product,  nothing prevents you from compressing it with LZEXE.  In fact, I
  198. urge youto do so:
  199.  
  200. - Your EXE files will be smaller and people may even think you programmed
  201. them in assembler.  Your competitors will be amazed by your software, which
  202. does what their does butis 30% smaller.
  203. In addition you will have more space on your floppy and hard disks.  Space
  204. is always at a premium...
  205. -  Compressed programs are always less vulnerable to viruses, since any
  206. interference will cause the "CRC error" to appear or the system to hang.
  207. -  The compression constitutes an excellent encryption system, preventing
  208. unscrupulous people from hacking your messages or examine your algorithms.
  209. The only way would be to disassemble the decompressor, which is not going
  210. to be easy, I tell you!
  211.  
  212.  
  213.     That's it!  I hope you enjoy this utility.  Please remember it is
  214. still in its ß-state!
  215.  
  216.  
  217.     Fabrice.
  218.  
  219.     If you would like more information on the algorithms used, or in case of
  220. difficulties, here is my address:
  221.  
  222.     Fabrice BELLARD
  223.     451 chemin du mas de Matour
  224.     34790 GRABELS  (FRANCE)
  225.  
  226.