home *** CD-ROM | disk | FTP | other *** search
/ Cool Page Magazine 14 / CoolPage_14.iso / tools / unp.doc < prev    next >
Text File  |  1995-05-30  |  31KB  |  686 lines

  1.                                    │
  2.  
  3.                                    │
  4.                                 ─ ─┼─ ─
  5.         ░░▌ ░░▌ ░░░░░░▌ ░░░░░░▌   ░░▌ ░░▌        ░░▌     ░░▌│
  6.         ░░▌ ░░▌ ░░▌ ░░▌ ░░▌ ░░▌   ░░▌ ░░▌       ░░░▌    ░░░▌
  7.         ░░▌ ░░▌ ░░▌ ░░▌ ░░░░░░▌   ░░░░░░▌        ░░▌     ░░▌│
  8.         ░░▌ ░░▌ ░░▌ ░░▌ ░░▌       ░░▌        ░░▌     ░░▌
  9.         ░░░░░░▌ ░░▌ ░░▌ ░░▌       ░░▌ ░▌  ░░░░░░▌ ░░░░░░▌
  10.  
  11.           ───────────────────────────────────────────────┐
  12.  
  13.  
  14.               Written by Ben Castricum
  15.  
  16.                     May 30, 1995
  17.  
  18.  
  19.  
  20.        This is the documentation belonging to and explaining the use of:
  21.  
  22.  
  23.                     UNP V4.11
  24.  
  25.  
  26.             Executable file restore utility
  27.  
  28.  
  29.  
  30.  
  31. TABLE OF CONTENTS:
  32.  
  33. DISCLAIMER
  34. WHAT IS UNP ?
  35. GENERAL INFO
  36. HOW TO USE UNP
  37. MESSAGES
  38. NOTES ON COMPRESSORS
  39. REGISTERING UNP
  40. HEY! UNP IS COMPRESSED!
  41. WHAT UNP CAN REMOVE
  42. WHAT UNP CANNOT REMOVE
  43. CONTACTING ME
  44.  
  45.  
  46. Disclaimer
  47. ----------
  48. Under NO circumstances I can be held responsible for any damage caused by
  49. files in this or any other package containing programs written by me.
  50. (That should do it :-)
  51.  
  52.  
  53. What is UNP ?
  54. -------------
  55. UNP's main purpose is to restore executable files to their original state.
  56. However it can do more than that.  UNP can optimise EXE-headers, remove
  57. debug information, convert files from one structure to the other, scan
  58. directories for compressed files, reveal hidden viruses and even make files
  59. that didn't run anymore run again.
  60.  
  61.  
  62. General info
  63. ------------
  64. Before you start using UNP, I would like to point out a few things which you
  65. might take into consideration.
  66.  
  67. Compressed EXE files containing an overlay may not work correctly after they
  68. have been decompressed.  Decompression expands the code size of the EXE file
  69. which also means that the overlay moves up.  Some programs do not check where
  70. the overlay currently is but just use a constant to get the overlay.  If this
  71. is the case, most anything can happen.
  72.  
  73. When you use UNP to convert a file to another structure, please take into
  74. consideration that the converted program never runs under the exact same
  75. conditions as it did before.  Though these differences are likely not to
  76. cause any problems with most programs, there are always programs which expect
  77. just that what is changed by conversion.
  78.  
  79. UNP can do just about anything with files.  This definately includes messing
  80. up your files.    For that reason it is always a good idea to have a backup of
  81. the files your are going to process.  Someone suggested to let the -b
  82. (create backup) option turned on by default.  Although this is a good idea,
  83. it's still not 100% reliable.
  84.  
  85. UNP is not case sensitive in anyway, nor does it care about extensions.  This
  86. however does not mean that it is possible to convert files which are reported
  87. by UNP to be "binary (.COM)" can all be converted to .EXE files.  Files which
  88. are not really .COM files (e.g. .BAT or .GIF) will not run or view the
  89. picture when converted and executed.
  90.  
  91.  
  92. How to use UNP
  93. --------------
  94. If you type UNP without any parameters then you will get the built-in help
  95. screen of UNP which is explained below.
  96.  
  97.  - Commands - These are 1 character long and only one can be specified on the
  98. command line.  It does not really matter where you put it.  If no command is
  99. specified, the E command is used.
  100.  
  101. c = convert to COM file
  102.    Some .EXE files can be converted to .COM files.  You can do this by using
  103.    this command.  Please note that the resulting file will not automaticly
  104.    have a .COM extention.  You should only convert a file when you know
  105.    exactly what you are doing (see general info section).
  106.  
  107. d = make current options default
  108.    Using this command enables you to specify the default options yourself.
  109.    Simply type the options on the commandline you would like to have as
  110.    default and use this command.  UNP will modify itself to the settings
  111.    as default. For example to let UNP always create a backup use
  112.      UNP d -b+
  113.    UNP stores the new settings in itself, which means that UNP is self-
  114.    modifying.  With most anti-virus programs, this causes some alarm to go
  115.    off. Check your anti-virus program documentation on how to solve this
  116.    problem (see also: Hey! UNP is compressed!)
  117.  
  118. e = expand compressed file (default)
  119.    This command expands the compressed file.  If you do not specify a
  120.    command, UNP will use this by default.  Using this command without a
  121.    filename will result in unpacking all files in the current directory
  122.  
  123. i = show info only
  124.    If you just want some information about the file, this is the command to
  125.    use.  UNP will show all information like the E command but will not
  126.    decompress or write the file back.
  127.  
  128. l = load and save
  129.    This command loads a .COM or .EXE file but does not expand it.  It will be
  130.    written back just like a decompressed file would be written back.  This is
  131.    useful in case you want to remove an overlay, irrelevant header data or
  132.    optimize the relocation items.
  133.  
  134. m = MarkEXE, insert a file in header
  135.    MarkEXE is a small utility supplied with PROTECT! EXE/COM V5.0.  This
  136.    program can add a piece of text to an EXE file in such a way that when the
  137.    file is shown on screen the user can see that piece of text.  The 'M'
  138.    command does not exactly do the same as MarkEXE.  First it inserts the
  139.    file before the relocation items, this way any EOF markers in the
  140.    relocation items won't screw it up.  Second, UNP does not place the same
  141.    piece of text at the end of the code, since I see this as more or less
  142.    screwing up the file.
  143.  
  144. o = copy overlay
  145.    A new (and probably rarely used) command is the overlay copy command.
  146.    With this you can get the overlay from some .EXE file and append to some
  147.    other .EXE file.  The idea behind this is that when you use LZEXE as
  148.    compressor, the overlay is removed from the file.  With this command you
  149.    can place the overlay back.
  150.  
  151. s = search for compressed files
  152.    When you use this command, only a small list of compressed files matching
  153.    the Infile wildcard will be generated.  To save some space on the screen,
  154.    the pathname of the file will not  be show.  But since UNP does not work
  155.    recursive, it should not be a problem.
  156.  
  157. t = trace executable
  158.    My first attempt to a general unpacker can be found in this command.
  159.    Actually there are 2 different implemtations.  The implementation used for
  160.    .COM files will single-step through a program and checking every
  161.    instruction if the original program has been restored.  If UNP thinks it
  162.    has, it will stop and write the file back.  Unfortunately this is a very
  163.    slow process.  The .EXE implementation also single-steps through the file
  164.    but it checks every step to see if a known packer has been revealed.  If
  165.    it has found one, it will remove it and write it the resulting file back.
  166.    If the program has not been compressed with a known packer, sooner or
  167.    later some interrupt will be used which UNP will detect and abort the
  168.    tracing.
  169.  
  170. x = convert to EXE file
  171.    Some compressors can only compress .EXE files (like LZEXE).    With this
  172.    command you can convert a .COM file to an .EXE file.  The resulting file
  173.    will not be written back with an .EXE extension by default.    As with the
  174.    .EXE to .COM conversion, be sure you know what you're doing.  Not all
  175.    programs can be converted.
  176.  
  177.  
  178.  - Options - Even more fun can be achieved with specifying options on the
  179. command line. Options can be passed sepparated (like -a -b -c) but can also
  180. be combined (like -abc).  After each option there can be one of the
  181. characters "-", "+" or "?". The first turns switches off, the second turns
  182. them on and the third.. well it turns them on as well.  But the real purpose
  183. of the question mark is to force UNP to ask if it should do something.
  184. Currently only the -K switch supports this.  Options which are not followed
  185. by one of the mentioned characters work as toggles, which means that using an
  186. option twice will undo the previous (eg. -a -a has no result). However once
  187. an option has been turned on with the question mark (like -a?) then you can
  188. only turn it off by appending a - (like -a-). Still got it? :)
  189.  
  190. -? = help (this screen