home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / QINST20.ZIP / LZEXE.DOC < prev    next >
Text File  |  1990-08-06  |  13KB  |  311 lines

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