home *** CD-ROM | disk | FTP | other *** search
/ PC Open 18 / pcopen18_giallo.iso / Msdos / EXEDUMP / DUMPEXE.TXT < prev    next >
Encoding:
Text File  |  1997-04-08  |  42.4 KB  |  855 lines

  1.  ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  2.  █                                                                            █
  3.  █                     <*>   EXE-dumper version 2.3   <*>                     █
  4.  █                                                                            █
  5.  █                  by ▄─▄ ▄   ▄─▄ ▄─▄ ▄─▄ ▄─▄ ▄ ▄─▄ ▄─▄                      █
  6.  █                     █ █ █─▄ ▀─▄ █─  ▀─▄ ▀─▄ ▄ █ █ █ █                      █
  7.  █                     █ █ █ █ ▄ █ █   ▄ █ ▄ █ █ █ █ █ █                      █
  8.  █                     ▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀ ▀ ▀▀▀ ▀ ▀ 1997                 █
  9.  █                                                                            █
  10.  █────────────────────────────────────────────────────────────────────────────█
  11.  █ Handle          Real name           Age   Profession   Group activity      █
  12.  █────────────────────────────────────────────────────────────────────────────█
  13.  █ Bugsy           Benjamin Petersen    24   Programmer   Coder               █
  14.  █ Spawn           Michael Skovslund    23   Programmer   Coder, gfx          █
  15.  █────────────────────────────────────────────────────────────────────────────█
  16.  █   PLEASE CHECKOUT OUR INTERNET HOMEPAGE AT : WWW.CYBERNET.DK/USERS/BUGSY   █
  17.  █                                                                            █
  18.  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  19.  
  20. INDEX
  21.   History
  22.   Introduction
  23.   Disclaimer
  24.   Keyboard layout
  25.   Program documentation
  26.   Configuration                  (New information, please take a look)
  27.   SoftICE user notice            (New information, please take a look)
  28.   GameTools user notice
  29.   EatMem utility
  30.   How to unpack an exefile
  31.   How to get in touch with us    (New information, please take a look)
  32.   Distribution sites
  33.   Greetings                      (New information, please take a look)
  34.  
  35.  
  36. ■ History
  37.  
  38.   Version   Release Note
  39.  
  40.       1.0   Never released to the public, only for our beta-testers (Darkman)
  41.  
  42.       1.1   First public release
  43.  
  44.       1.2   Now with SoftICE debugger support. Activate with INT FCh
  45.  
  46.       2.0   Autodump from TD, S-ICE and GAMETOOLS. Detects a lot of things.
  47.             Uses UMB. Added Total Memory Dump feature, Show User Screen. Now it
  48.             swaps dos-stack so DUMPEXE can be activated at any time (reentrance)
  49.  
  50.       2.1   Fixed a bug in dos version check. (Damn)
  51.  
  52.       2.2   Added support for overlay as requested by José Navarro Martínez
  53.             Fixed minor bugs in DUMPEXE. Added mail registration form
  54.             Added a utility called EATMEM that allocates 4 KB from within DOS.
  55.             Removed the WORD version of this doc file (Did anybody use it ?).
  56.  
  57.       2.3   Added a configuration file. Added "Fastmode" in file 2.
  58.             Now you can choose between a rasterbar and a textmode bar.
  59.             Added the auto-fill from SoftICE as promised in v2.0, phew.
  60.             The PSP validation function have now 3 ways to demind if PSP
  61.             is valid. Added userdefined SoftICE/DUMPEXE interrupt. Now the
  62.             user can change the stacksize that DUMPEXE uses. Changed some
  63.             colors. Added a function that alows the user to specifye SoftICE
  64.             backdoor values. Added support for Turbo Debugger 4.x and 5.0
  65.             SoftICE is now, by default, activated via INT 4C
  66.  
  67. ■ Introduction
  68.  
  69.   This program is able to unpack ANY exe-packed file. Many other programs,
  70.   such as cup, up, tron, unp and vgacbust give you the same ability. But those
  71.   programs can only expand/unpack files packed with known exepackers. By
  72.   using the OBSESSiON DUMPEXE toolpack, you can unpack any of those exe-files
  73.   that the above utilitys gave up on. Of course this can't be done by inserting
  74.   a quarter (kr.) into the crypt-o-mate. We have to do a little more than this.
  75.   This is where you, the OBSESSiON DUMPEXE toolpack, and your debugger gets
  76.   into the picture.
  77.  
  78.   All you have to do is this :
  79.     Load the exeprogram into your favourite debugger (eg. TD, S-ice, GameTools)
  80.     Debug the program until first original (unpacked) instruction
  81.     Dump the code/data, using the DUMPEXE program, via the FILE 1 option
  82.     Terminate the loaded program
  83.     Allocate a 4 Kb memory block via the DUMPEXE program (or use EATMEM.EXE)
  84.     Reload the program, and ensure that the entry point is different
  85.     Debug the program until first original (unpacked) instruction
  86.     Dump the code/data, using the DUMPEXE program, via the FILE 2 option
  87.     Terminate the loaded program
  88.     Deallocate the 4 Kb memory block via the DUMPEXE program (or use EATMEM.EXE)
  89.     Run MAKEEXE with the needed parameters.
  90.       Example : MAKEEXE.EXE ORIGINAL.EXE NEWFILE.EXE
  91.  
  92.     And 'puf', your done.
  93.  
  94.   To technically understand how this can be done, please refer to selection :
  95.   "How to unpack an exefile".
  96.  
  97.   If this sounds easy, exit your doc reader now, if not, keep on reading. 8-)
  98.  
  99. ■ Disclaimer
  100.  
  101.   This software has been tested and found to work properly. OBSESSiON have no
  102.   responsbility whatsoever for any damages caused by use, or misuse of this
  103.   software.
  104.  
  105.   IF YOU DISAGREE WITH ANY OF THOSE TERMS, PLEASE REMOVE THIS SOFTWARE NOW.
  106.  
  107.   If you, after a 24 hour test period, still wish to continue using this
  108.   software, you NEED to send us a postcard with your name and address or
  109.   register at our homepage at HTTP://WWW.CYBERNET.DK/USERS/BUGSY. The reason is
  110.   that it's the ONLY way I can explain to my wife why I have invested MORE than
  111.   300 hours developing this software. This is the only way I can see that
  112.   someone is really using this software. If I don't receive anything by mail,
  113.   I won't update the program any more.
  114.  
  115.   This means :
  116.     IF NOT (ReceivedAnyPostCardOrEMail) THEN
  117.       HALT (Programmer)
  118.     ELSE
  119.       ReleaseNextVersion
  120.  
  121. ■ Keyboard layout
  122.  
  123.   Left shift + right shift : Activate the resident part of DUMPEXE
  124.   TAB                      : Jump to next menu block
  125.   Shift TAB                : Jump to previous menu block
  126.   Arrow up/down            : Next/previous menu selection/block
  127.   Arrow left/right         : Next/previous digit or menu block
  128.   ESC                      : Terminate DUMPEXE or return to previous state
  129.   Enter                    : Confirm selection/input
  130.  
  131. ■ Program documentation
  132.  
  133.   Install DUMPEXE into memory by starting the file DUMPEXE.EXE. The program
  134.   will now go resident (TSR) in memory. This means that it can be envoked at
  135.   any time and within any dos program (such as a debugger).If UMB is available,
  136.   the 'DOS stack' and 'Screen swap data' will be placed here. To activate
  137.   DUMPEXE, please press <LEFT SHIFT> and <RIGHT SHIFT> at the same time (also
  138.   called the hotkey). A menu like the one shown below, should appear. To return
  139.   to interrupted program, press <ESC>.
  140.  
  141.   NOTICE : In versions 1.2 you couldn't start DUMPEXE by pressing the
  142.            hotkey within the dos command line (InDOS). This has now been
  143.            fixed by using the technique called 'DOS stack switching'.
  144.  
  145.                FIG 1. The main picture of DUMPEXE
  146.  
  147.   ┌────── DumpExe v2.3 CARDWARE 1997 by BUGSY/OBSESSiON ──[1]─┐
  148.   │          Dos, ≥80386, V86 mode, Turbo Debugger        [2] │
  149.   │───────── First file ────[3]─┬───────── Second file ───[4]─│
  150.   │ CS   : 0000                 │ CS   : 0000                 │
  151.   │ IP   : 0000                 │ IP   : 0000                 │
  152.   │ SS   : 0000                 │ SS   : 0000                 │
  153.   │ SP   : 0000                 │ SP   : 0000                 │
  154.   │ PSP  : 0000                 │ PSP  : 0000                 │
  155.   │ Size : 00000 (0)            │ Size : 00000 (0)            │
  156.   │ Name : #NoName#.1           │ Name : #NoName#.2           │
  157.   │─────────────────────────[5]─┼─────────────────────────[6]─│
  158.   │      Dump exe-code          │      Dump exe-code          │
  159.   │      Autodetect name        │      Autodetect name        │
  160.   │      Autodetect size        │      Autodetect size        │
  161.   │─────────────────────────[7]─┼─────────────────────────[8]─│
  162.   │      Configuration          │      User screen            │
  163.   │      Memory snapshot        │      Allocate 4Kb           │
  164.   │      Reset menu             │      Auto config file 2     │
  165.   │      Uninstall              │      Fill from debugger     │
  166.   │─────────────────────────────┴─ Free 99 kb, Slack 0 kb [9]─│
  167.   │                                                      [10] │
  168.   └───────────────── Hotkey : (U)ser screen ──────────────────┘
  169.  
  170.   Overview
  171.     [1] Copyright text.
  172.     [2] Information on the operating system and found debuggers.
  173.     [3] Data for first memory dump, set by the user.
  174.     [4] -"-  for second memory dump.
  175.     [5] Menu concerning first memory dump.
  176.     [6] -"-  for second memory dump.
  177.     [7] General purpose menu, concerning global use of DUMPEXE.
  178.     [8] Utility menu with functions, helps you get the job done faster.
  179.     [9] Information about the current memory status.
  180.    [10] Shows status messages from DUMPEXE and serves as an input prompt.
  181.  
  182.   Explenation
  183.     [1] Copyright text.
  184.           Tells who made this brilliant program.
  185.  
  186.     [2] Information on the operating system and found debuggers.
  187.           Shows if current session is a DOS, WINDOWS or OS/2 session.
  188.           Also shows which debuggers have been found active at the present
  189.           moment.
  190.  
  191.           Can show a mixture of the following text strings :
  192.             [8086, 80286, ≥80386],
  193.             [Real mode, V86 mode],
  194.             [Dos, Win Std, Win Enh, OS/2],
  195.             [No debugger, Turbo Debugger, SoftICE, GameTools]
  196.  
  197.           Example : Dos, ≥80386, Real mode, SoftICE, GameTools
  198.  
  199.           As you can see, it is possible to have more than one debugger loaded
  200.           at the same time. This can be usefull when combining Turbo Debugger
  201.           and GameTools.
  202.  
  203.     [3] Data for first memory dump, set by the user.
  204.           This subwindow is used to enter information about the program you
  205.           want to unpack. You have to fill out ALL fields to get a working
  206.           copy of the unpacked program.
  207.  
  208.             CS   : Current code segment
  209.             IP   : Current instruction pointer
  210.             SS   : Current stack segment
  211.             SP   : Current stack pointer
  212.             PSP  : Current program prefix segment, usually the same as ES
  213.             Size : Size of program in bytes
  214.             Name : Name of dump file
  215.  
  216.           To change a value, move the selector to the decided item and press
  217.           <ENTER>. Enter the new value and press <ENTER> again.
  218.           REMARK : All numbers are shown and entered in heximal values.
  219.                    The filename can not be entered manuelly.
  220.  
  221.     [4] -"- for second memory dump. ([3])
  222.  
  223.     [5] Menu concerning first memory dump.
  224.           It is used for dumping the code/data block entered in [3] or [4].
  225.  
  226.           Menu items available are :
  227.  
  228.             Dump exe-code   : Select this one to dump selected code/data block.
  229.  
  230.             Autodetect name : Let DUMPEXE autodetect the name of the program
  231.                               its processing, and use it as the dump filename.
  232.  
  233.             Autodetect size : Let DUMPEXE autodetect the size of the code/data
  234.                               block. There are two ways to autodetect this
  235.                               size. It can be done by Stack or by PSP. The
  236.                               most common way is 'By Stack', because this
  237.                               usually gives a smaller, and more acurrent image
  238.                               of the original unpacked exefile.
  239.  
  240.     [6] -"- for second memory dump. ([5])
  241.  
  242.     [7] General purpose menu, concerning the global use of DUMPEXE.
  243.  
  244.         Menu items available are :
  245.  
  246.             Configuration   : Use it to configure how DUMPEXE reacts in
  247.                               different situations. See "Configuration"
  248.  
  249.             Memory snapshot : Takes a snapshot of the first megabyte of memory,
  250.                               and puts it in a file in the current directory;
  251.                               called SNAPSHOT.MEM. Use it for whatever you may
  252.                               like.
  253.  
  254.             Reset menu      : Sets all items to their initial value. Use it if
  255.                               something, somehow goes bananas.
  256.  
  257.             Uninstall       : Removes the DUMPEXE software from the memory.
  258.                               Use it if you want to remove the DUMPEXE from
  259.                               memory.
  260.  
  261.     [8] Utility menu with functions that helps you get the job done faster.
  262.  
  263.           Menu items available are :
  264.  
  265.             User screen        : Shows the screen as it was before DUMPEXE was
  266.                                  started. Use this function instead of pressing
  267.                                  <ESC> and then the hotkey. This function can
  268.                                  also be called by pressing <U> while in view
  269.                                  mode.
  270.  
  271.             (De)Allocate 4Kb   : Used to allocate/deallocate a block of 0100h
  272.                                  paragraphs (4 Kb). This should be done after
  273.                                  the first dump and termination, and before you
  274.                                  reload the program. Please take a look at the
  275.                                  tutorial later in this document.
  276.  
  277.                                  NOTICE : This function can ONLY be used within
  278.                                           Turbo Debugger and GameTools. So if
  279.                                           you are using SoftICE, please use
  280.                                           the utility called EATMEM.EXE insted.
  281.  
  282.             Auto-Config        : Adds 0101h to all segment registers in [2] and
  283.                                  store them in [3]. It is useful after
  284.                                  preparing for second dump. This works only on
  285.                                  9 out 10 packed files. Please notice that CS
  286.                                  in [3] matches the one shown by the debugger.
  287.                                  If not, enter all values manually. You only
  288.                                  have to use this function if
  289.                                  "Fill from debugger" fails.
  290.  
  291.             Fill from debugger : Read the register shown by the debugger and
  292.                                  automatically place the values into first or
  293.                                  second dumpfile. This is a VERVY useful
  294.                                  function, since it gives you the ability to
  295.                                  unpack the exefile FAST.
  296.  
  297.     [9] Information about the current memory status.
  298.  
  299.           Free  : Amount of free basememory, in Kb.
  300.           Slack : Number of memory fragments in Kb, after allocating 4 Kb.
  301.  
  302.    [10] Status messages from DUMPEXE and input prompt.
  303.         This line serves as an error message and input scratch.
  304.  
  305.         Here are some of the error messages that can appear :
  306.  
  307.           No size given.
  308.             You have to enter how much memory the program needs to dump.
  309.  
  310.           No memory allocated.
  311.             You are trying to auto-config file 2, and you haven't used
  312.             "allocate 4KB". You must manually enter the data required to dump
  313.  
  314.           Can't auto-config file 2, sorry.
  315.             You have to manuelly, enter the data required to dump a program.
  316.             Or you could use the function : "Fill from debugger"
  317.  
  318.           The PSP-segment is not valid.
  319.             You are using a function that requires a valid PSP segment,
  320.             entered in [3] or [4].
  321.  
  322.           The PSP-segment for file 1 is not valid.
  323.             See the above.
  324.  
  325.           Can't find name.
  326.             DUMPEXE is not able to find the name of the program you want
  327.             to dump. The program is using a standard name instead.
  328.  
  329.           Can't uninstall, vector hooked by another program.
  330.             You have loaded another program after DUMPEXE. Unfortunately the
  331.             two programs have both hooked onto the same interrupt. Unload the
  332.             other program first and try again.
  333.  
  334.           Can't allocate necessary memory.
  335.             Boot your machine with fewer drivers, and try again. If this
  336.             does'nt help, you are f.....
  337.  
  338.           Out of stack.
  339.             Your memory is fragmented to much. By default DUMPEXE has a 4 Kb
  340.             stack and in this case it doesn't seem to be enough. Make it bigger
  341.             in the config
  342.  
  343.           Can't release memory.
  344.             This error is most likely caused by the program you are about to
  345.             dump, or the stack of this program has been destroyed. Dump the
  346.             code and boot your PC. (the dumpfile should be okay, I hope...)
  347.  
  348.           Can't make file.
  349.             Oops, a disk error. Check your harddisk with "chkdsk /f" or
  350.             "scandisk"
  351.  
  352.           Can't write file, disk full ?.
  353.             Free some disk space, and try again.
  354.  
  355.           Can't deallocate memory.
  356.             The MCB (memory control block) has been destroyed. Dump the code
  357.             and don't think more about it. (again, the dumpfile should be okay,
  358.             I hope...)
  359.  
  360. ■ Configuration
  361.  
  362.   Below is a picture of the configuration menu :
  363.  
  364.   ┌────── DumpExe Configuration ──[1]─┐
  365.   │ Rasterbar                : AUTO   │
  366.   │ Fast mode                : ON     │
  367.   │ PSP validation level     : MEDIUM │
  368.   │ SoftICE SI value         : 4647h  │
  369.   │ SoftICE DI value         : 4A4Dh  │
  370.   │───────────────────────────────[2]─│
  371.   │ Activate via interrupt   : 4Ch    │
  372.   │ DumpExe stack size       : 1000h  │
  373.   │───────────────────────────────[3]─│
  374.   │      Reset to default values      │
  375.   │───────────────────────────────[4]─│
  376.   │                                   │
  377.   └───────────────────────────────────┘
  378.  
  379.   With this menu you can control how DUMPEXE reacts in different situations.
  380.   When you change a value, it will be saved to the binary file DUMPEXE.CFG.
  381.   If you change values in [1] it will affect the behavor of DUMPEXE instantly,
  382.   and if you change the values in [2], you have to reload DUMPEXE in order to
  383.   let them affect DUMPEXE.
  384.  
  385.   Overview
  386.     [1] User parameters
  387.     [2] System parameters
  388.     [3] Reset the configuration to default values.
  389.     [4] Shows status messages from DUMPEXE.
  390.  
  391.   Explenation
  392.     [1] User parameters
  393.  
  394.           Menu items available are :
  395.  
  396.             Rasterbar              : When you activate this selection,
  397.                                      you switch between a rasterbar, and a
  398.                                      textmodebar. The difference between them
  399.                                      are that rasterbar looks nice, but are
  400.                                      slow and uses alot of processor time.
  401.                                      Textmodebar look ugly, but are fast and
  402.                                      uses almost no processor time. You can
  403.                                      cycle between OFF/ON/AUTO. In automode
  404.                                      DUMPEXE will demind if it should use a
  405.                                      raster- or textmodebar. It choose
  406.                                      rasterbar in dos mode and textmodebar
  407.                                      while running under windows.
  408.  
  409.             Fast mode              : Fast mode is for people in a hurry. The
  410.                                      registeres in File 2 follows File 1. Well
  411.                                      atleast IP, SP, size and name does. When
  412.                                      you enter the PSP in File 2, DUMPEXE will
  413.                                      calculate the rest of the values for you.
  414.                                      "Fast mode" can be set to ON or OFF. If
  415.                                      you choose OFF mode, DUMPEXE reacts like
  416.                                      it did in previous versions, and you have
  417.                                      to enter all informations by yourself (or
  418.                                      use the "Fill from debugger" selection).
  419.  
  420.             PSP validation level   : When DUMPEXE is detecting the name or the
  421.                                      the size of the program you are unpacking,
  422.                                      it uses the programs PSP. So in order to
  423.                                      do that, it need to know if the PSP is
  424.                                      valid or not. DUMPEXE performs 3 check to
  425.                                      do that. When you activate this selection
  426.                                      it cycles between NONE/SOFT/MEDIUM/HARD.
  427.                                      In NONE mode no check is performed. In
  428.                                      SOFT mode, one out of three PSP check must
  429.                                      be true. In MEDIUM mode, two out of three
  430.                                      PSP check must be true. In HARD mode three
  431.                                      out of three PSP check must be true, in
  432.                                      order to continue calculations. Some
  433.                                      packers change part of the static PSP data
  434.                                      to confuse unpackers, and therefor we
  435.                                      advice you to use MEDIUM or SOFT mode.
  436.  
  437.             SoftICE SI value       : When DUMPEXE trys to detect SoftICE, it
  438.                                      need the so called backdoor values. These
  439.                                      values are always the same if you are
  440.                                      using the original version from Nu-Mega.
  441.                                      But if you are using a patched verison,
  442.                                      DUMPEXE cannot demind if SoftICE is
  443.                                      installed or not without the new backdoor
  444.                                      values. So if you are using a patched
  445.                                      version, enter the values here and in
  446.                                      selection below.
  447.  
  448.             SoftICE DI value       : See "SoftICE SI value"
  449.  
  450.     [2] System parameters
  451.  
  452.           Menu items available are :
  453.  
  454.             Activate via interrupt : Since SoftICE for Windows doesn't support
  455.                                      all interrupts (using the GENINT command)
  456.                                      you have the ability to choose one for
  457.                                      your self. Please be sure that the
  458.                                      interrupt you are choose isn't used.
  459.                                      Just to be clear : You cannot choose
  460.                                      INT 09h, 21h or FBh, and guess why not !
  461.                                      So if you are using SoftICE for windows
  462.                                      choose one below 5Fh.
  463.  
  464.             DumpExe stack size     : When you allocate a 4 kb memory block
  465.                                      DumpExe uses alot of stack, and if you
  466.                                      get the error message "Out of stack",
  467.                                      try to increase this value by 800h. But
  468.                                      it is my guess that you will NEVER see
  469.                                      this error message, well at least I havn't
  470.  
  471.     [3] Reset configuration to default values.
  472.           Resets the values in the configuration to there default values,
  473.           nothing more, nothing less.
  474.  
  475.     [4] Shows status messages from DUMPEXE.
  476.           Read the above line ;-)
  477.  
  478. ■ SoftICE user notice
  479.  
  480.   If you are using SoftICE, the hotkey is disabled. This is because SoftICE
  481.   runs in protected mode and uses its own interrupt vector table. To activate
  482.   DUMPEXE, enter the following sequence at the SoftICE command line prompt :
  483.  
  484.     BPX CS:IP      : So we can return after INT 04Ch has terminated
  485.     GENINT 4C      : Start the exe-dumper
  486.     GENINT 4C      : Start the exe-dumper again (if you need it)
  487.     BC 0           : Clear the breakpoint set by BPX. The number (in this case
  488.                      0) is the name of the breakpoint label.
  489.  
  490.   Don't start DUMPEXE unless you are are at the very first instruction of
  491.   the unpacked exefile because your current location might be in the keyboard
  492.   handler or equal.
  493.  
  494.   NOTICE : You cannot use the DUMPEXE menu called 'Allocate 4Kb' within
  495.            SoftICE. This function can ONLY be used within Turbo Debugger
  496.            and GameTools. Please use the utility called EATMEM.EXE insted.
  497.            (Look at selection 'EatMem utility' later)
  498.  
  499.   NOTICE : In version 2.2 and below the SoftICE/DUMPEXE interrupt was FCh,
  500.            but since SoftICE for Windows can't handle interrupts above 5Fh
  501.            we changed the default value. But if you have any problem using
  502.            4Ch please send me a mail and choose an other in the Configuration
  503.            menu.
  504.  
  505. ■ GameTools user notice
  506.  
  507.   DUMPEXE only support GameTools version 3.40 properly.
  508.  
  509.   If you are using GameTools, be SURE to load DUMPEXE BEFORE you load
  510.   GameTools. If you don't, you can't activate DUMPEXE within GameTools.
  511.  
  512. ■ EatMem utility
  513.  
  514.   EatMem is a program that from within dos allows you to allocates
  515.   a 4 KB memory block.
  516.  
  517.   When you start EATMEM.EXE the first time it starts DUMPEXE (if resident) and
  518.   allocates a 4 KB memory block. The next time you start EATMEM.EXE it will
  519.   free the 4 KB memory block.
  520.  
  521.   Use this utility if you can't allocate a 4 KB memory block within DUMPEXE.
  522.   So insted of using the menu (in DUMPEXE) 'Allocate 4 KB', just return to dos,
  523.   and run EATMEM.EXE. When you are finished with the second dump, just run
  524.   EATMEM.EXE again, or release the 4 KB memory block via DUMPEXE.
  525.  
  526. ■ How to unpack an exefile
  527.  
  528.   The file named TESTEXE.EXE is a packed exe-file. It is used to illustrate
  529.   how to use this tool, and nothing more. The file is packed with pklite
  530.   version 2.01 using normal compression.
  531.  
  532.   I will use Turbo Debugger for this example, because if you know how to use
  533.   the ultimate debugger SoftICE, you probably don't need this introduction
  534.   anyway, do you ?
  535.  
  536.   If you don't know anything about using a debugger, I advise you to consult
  537.   your debuggers manual.
  538.  
  539.   Try to execute the tutorial program TESTEXE.EXE and look at the text it
  540.   displays. The program will tell you if it's packed or not.
  541.  
  542.   REMEMBER : Start DUMPEXE.EXE before proceeding with the next step.
  543.  
  544.   Start debugging TESTEXE.EXE by writing : TD.EXE TESTEXE.EXE
  545.  
  546.   The picture shown, by TD (Turbo Debugger), should look something like
  547.   this :
  548.  
  549.   ╔═[■]═CPU 80486═══════════════════════════════════════╤═══════1═[][]═╗
  550.   ║  cs:010050             push   ax                     ax 0000   │c=0║
  551.   ║  cs:0101 B83106         mov    ax,0631              ■  bx 0000   │z=0║
  552.   ║  cs:0104 BA8501         mov    dx,0185              ▒  cx 0000   │s=0║
  553.   ║  cs:0107 054C84         add    ax,844C              ▒  dx 0000   │o=0║
  554.   ║  cs:010A 3B060200       cmp    ax,[0002]            ▒  si 0000   │p=0║
  555.   ║  cs:010E 722A           jb     013A                 ▒  di 0000   │a=0║
  556.   ║  cs:0110 B409           mov    ah,09                ▒  bp 0000   │i=1║
  557.   ║  cs:0112 BA1C01         mov    dx,011C              ▒  sp 0200   │d=0║
  558.   ║  cs:0115 CD21           int    21                   ▒  ds 843C   │   ║
  559.   ║  cs:0117 B8014C         mov    ax,4C01              ▒  es 843C   │   ║
  560.   ║  cs:011A CD21           int    21                   ▒  ss 85F7   │   ║
  561.   ║  cs:011C 4E             dec    si                   ▒  cs 843C   │   ║
  562.   ║  cs:011D 6F             outsw                       ▒  ip 0100   │   ║
  563.   ║  cs:011E 7420           je     0140                 ▒            │   ║
  564.   ║  cs:0120 656E           outsb  gs:                              │   ║
  565.   ╟■▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒┼────────────┴───╢
  566.   ║  ds:0000 CD 20 A7 8A 00 9A C0 00 ═ ºè Ü└            │  ss:0208 2020  ║
  567.   ║  ds:0008 00 00 E4 01 32 4B AE 01   Σ2K«           │  ss:0206 2020  ║
  568.   ║  ds:0010 32 4B 80 02 8D 45 FB 36 2KÇìE√6           │  ss:0204 2020  ║
  569.   ║  ds:0018 01 01 01 00 02 FF FF FF                │  ss:0202 2020  ║
  570.   ║  ds:0020 FF FF FF FF FF FF FF FF                    │  ss:02003130  ║
  571.   ╚═════════════════════════════════════════════════════╧═══════════════─┘
  572.   NOTICE : Due to the nature of the PC-memory, the segment registers
  573.            (CS, DS, ES, SS) might show different values than the one
  574.            shown.
  575.  
  576.   Start executing the code until cs:0153, by pressing <F4> at location cs:0153,
  577.   shown below. (Press <PAGEDOWN> 2 or 3 times)
  578.  
  579.   ╔═[■]═CPU 80486═══════════════════════════════════════╤═══════1═[][]═╗
  580.   ║  cs:0147 B9C500         mov    cx,00C5                ax 8A44   │c=0║
  581.   ║  cs:014A 33FF           xor    di,di                ■  bx 0000   │z=1║
  582.   ║  cs:014C 57             push   di                   ▒  cx 0000   │s=0║
  583.   ║  cs:014D BE5401         mov    si,0154              ▒  dx 0185   │o=0║
  584.   ║  cs:0150 FC             cld                         ▒  si 02DE   │p=1║
  585.   ║  cs:0151 F3A5           rep movsw                   ▒  di 018A   │a=0║
  586.   ║  cs:0153CB             retf                        ▒  bp 0000   │i=1║
  587.   ║  cs:0154 FD             std                         ▒  sp 01FA   │d=0║
  588.   ║  cs:0155 8CDB           mov    bx,ds                ▒  ds 843C   │   ║
  589.   ║  cs:0157 53             push   bx                   ▒  es 8A44   │   ║
  590.   ║  cs:0158 83C32E         add    bx,002E              ▒  ss 8A5D   │   ║
  591.   ║  cs:015B 90             nop                         ▒  cs 843C   │   ║
  592.   ║  cs:015C 03DA           add    bx,dx                ▒  ip 0153   │   ║
  593.   ║  cs:015E 8CCD           mov    bp,cs                ▒            │   ║
  594.   ║  cs:0160 8BC2           mov    ax,dx                            │   ║
  595.   ╟■▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒┼────────────┴───╢
  596.   ║  ds:0000 CD 20 A7 8A 00 9A C0 00 ═ ºè Ü└            │  ss:0202 0004  ║
  597.   ║  ds:0008 00 00 E4 01 32 4B AE 01   Σ2K«           │  ss:0200 0000  ║
  598.   ║  ds:0010 32 4B 80 02 8D 45 FB 36 2KÇìE√6           │  ss:01FE 0000  ║
  599.   ║  ds:0018 01 01 01 00 02 FF FF FF                │  ss:01FC 8A44  ║
  600.   ║  ds:0020 FF FF FF FF FF FF FF FF                    │  ss:01FA0000  ║
  601.   ╚═════════════════════════════════════════════════════╧═══════════════─┘
  602.  
  603.   The unpacker has copied itself to a location, which is just after the
  604.   (not yet) unpacked code location. Singlestep one instruction (<F7>), and
  605.   you'll hopefully see this :
  606.  
  607.   ╔═[■]═CPU 80486═══════════════════════════════════════╤═══════1═[][]═╗
  608.   ║  cs:0000FD             std                           ax 8A44   │c=0║
  609.   ║  cs:0001 8CDB           mov    bx,ds                ■  bx 0000   │z=1║
  610.   ║  cs:0003 53             push   bx                   ▒  cx 0000   │s=0║
  611.   ║  cs:0004 83C32E         add    bx,002E              ▒  dx 0185   │o=0║
  612.   ║  cs:0007 90             nop                         ▒  si 02DE   │p=1║
  613.   ║  cs:0008 03DA           add    bx,dx                ▒  di 018A   │a=0║
  614.   ║  cs:000A 8CCD           mov    bp,cs                ▒  bp 0000   │i=1║
  615.   ║  cs:000C 8BC2           mov    ax,dx                ▒  sp 01FE   │d=0║
  616.   ║  cs:000E 80E40F         and    ah,0F                ▒  ds 843C   │   ║
  617.   ║  cs:0011 B104           mov    cl,04                ▒  es 8A44   │   ║
  618.   ║  cs:0013 8BF2           mov    si,dx                ▒  ss 8A5D   │   ║
  619.   ║  cs:0015 D3E6           shl    si,cl                ▒  cs 8A44   │   ║
  620.   ║  cs:0017 8BCE           mov    cx,si                ▒  ip 0000   │   ║
  621.   ║  cs:0019 D1E9           shr    cx,1                 ▒            │   ║
  622.   ║  cs:001B 4E             dec    si                               │   ║
  623.   ╟■▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒┼────────────┴───╢
  624.   ║  ds:0000 CD 20 A7 8A 00 9A C0 00 ═ ºè Ü└            │  ss:0206 0002  ║
  625.   ║  ds:0008 00 00 E4 01 32 4B AE 01   Σ2K«           │  ss:0204 0003  ║
  626.   ║  ds:0010 32 4B 80 02 8D 45 FB 36 2KÇìE√6           │  ss:0202 0004  ║
  627.   ║  ds:0018 01 01 01 00 02 FF FF FF                │  ss:0200 0000  ║
  628.   ║  ds:0020 FF FF FF FF FF FF FF FF                    │  ss:01FE0000  ║
  629.   ╚═════════════════════════════════════════════════════╧═══════════════─┘
  630.  
  631.   Press <F4> at location cs:0161 (the retf instruction), found by pressing
  632.   <PageDown> 13 - 14 times; and then <F7>. That's it. You have now unpacked
  633.   the TESTEXE program. If you have done it right, TD shows something like this :
  634.  
  635.   ╔═[■]═CPU 80486═══════════════════════════════════════╤═══════1═[][]═╗
  636.   ║  cs:01179A00005985     call   8559:0000              ax 0000   │c=0║
  637.   ║  cs:011C 9A0D00F784     call   84F7:000D            ■  bx 0000   │z=1║
  638.   ║  cs:0121 9A97077B84     call   847B:0797            ▒  cx 0000   │s=0║
  639.   ║  cs:0126 55             push   bp                   ▒  dx 0000   │o=0║
  640.   ║  cs:0127 89E5           mov    bp,sp                ▒  si 0000   │p=1║
  641.   ║  cs:0129 B80001         mov    ax,0100              ▒  di 0000   │a=0║
  642.   ║  cs:012C 9ACD025985     call   8559:02CD            ▒  bp 0000   │i=1║
  643.   ║  cs:0131 81EC0001       sub    sp,0100              ▒  sp 4000   │d=0║
  644.   ║  cs:0135 9ACC01F784     call   84F7:01CC            ▒  ds 843C   │   ║
  645.   ║  cs:013A BFB800         mov    di,00B8              ▒  es 843C   │   ║
  646.   ║  cs:013D 1E             push   ds                   ▒  ss 868D   │   ║
  647.   ║  cs:013E 57             push   di                   ▒  cs 844C   │   ║
  648.   ║  cs:013F 8DBE00FF       lea    di,[bp-0100]         ▒  ip 0117   │   ║
  649.   ║  cs:0143 16             push   ss                   ▒            │   ║
  650.   ║  cs:0144 57             push   di                               │   ║
  651.   ╟■▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒┼────────────┴───╢
  652.   ║  ds:0000 CD 20 A7 8A 00 9A C0 00 ═ ºè Ü└            │  ss:4008 0000  ║
  653.   ║  ds:0008 00 00 E4 01 32 4B AE 01   Σ2K«           │  ss:4006 0001  ║
  654.   ║  ds:0010 32 4B 80 02 8D 45 FB 36 2KÇìE√6           │  ss:4004 0002  ║
  655.   ║  ds:0018 01 01 01 00 02 FF FF FF                │  ss:4002 0001  ║
  656.   ║  ds:0020 FF FF FF FF FF FF FF FF                    │  ss:40000002  ║
  657.   ╚═════════════════════════════════════════════════════╧═══════════════─┘
  658.  
  659.   As you can see there are three far calls. These are direct calls. This means
  660.   that it will make a call to a certain location in memory. If we dump the
  661.   memory used by TESTEXE, we'll have an image of the program. But this is not
  662.   enough to make a new exefile. This is because an exefile is not just an image
  663.   of the memory, unlike COM files. We need a second dump from a different
  664.   memory location. This is because of the direct calls. By comparing the two
  665.   dumps, we can find the relocations (direct calls) needed to build a new
  666.   exefile. Information like min/max memory usage is taken from the original
  667.   exefiles header, but let's get on with the tutorial.
  668.  
  669.   There are serval ways to enter the values of SP, DS, ES, SS, CS and IP into
  670.   DUMPEXE. Since we are using one of the supported debuggers, we can use
  671.   the "Fill from debugger" function. This function takes register values, shown
  672.   by the debugger, and automatically puts them into DUMPEXE. Start DUMPEXE
  673.   by pressing the hotkey, and then <ENTER> at the "Fill from debugger"
  674.   function. Answer <1> to whatever the values should be places in first or
  675.   second dump file. Another way is to remember the values of SP, DS, ES, SS,
  676.   CS and IP before pressing the hotkey, and enter the values at their
  677.   corresponding locations in [2]. If you decide to do so, you will probably
  678.   notice that there is no field for ES. This is because the initial value of
  679.   ES, points to the PSP, so write the value of ES in the PSP field instead.
  680.  
  681.   It's now time to tell DUMPEXE the size of the memory block we want to dump.
  682.   Use TAB until you get to [4]. Press <ENTER> at "Autodetect size". There are
  683.   two ways of getting the size of the program. One is by using the stack, the
  684.   other is by using PSP. 99 % of all cases, you should use "by stack". Press
  685.   <S>, and the size will be put into size field. If DUMPEXE somehow fails to
  686.   calculate the right value, you have the option of entering a size that you
  687.   decide. Press <ENTER> at "Autodetect name", and the name of the executeable
  688.   file will be put into the name field. The last thing we have to do is to
  689.   dump the program to a file. This is done by pressing <ENTER> at
  690.   "Dump exe-code". DUMPEXE will probably do it so fast that you won't notice
  691.   the "process message" that appears.
  692.  
  693.   Below is a picture of DUMPEXE after the first dump. Again, remember that
  694.   values varie from dump to dump.
  695.  
  696.   ┌────── DumpExe v2.3 CARDWARE 1997 by BUGSY/OBSESSiON ──────┐
  697.   │     Dos, ≥80386, Real mode, Turbo Debugger, Soft-Ice      │
  698.   │───────── First file ────────┬───────── Second file ───────│
  699.   │ CS   : 844C                 │ CS   : 0000                 │
  700.   │ IP   : 0117                 │ IP   : 0000                 │
  701.   │ SS   : 868D                 │ SS   : 0000                 │
  702.   │ SP   : 4000                 │ SP   : 0000                 │
  703.   │ PSP  : 843C                 │ PSP  : 0000                 │
  704.   │ Size : 02410 (9232)         │ Size : 02410 (9232)         │
  705.   │ Name : TESTEXE.1            │ Name : TESTEXE.2            │
  706.   │─────────────────────────────┼─────────────────────────────│
  707.   │      Dump exe-code          │      Dump exe-code          │
  708.   │      Autodetect name        │      Autodetect name        │
  709.   │      Autodetect size        │      Autodetect size        │
  710.   │─────────────────────────────┼─────────────────────────────│
  711.   │      Configuration          │      User screen            │
  712.   │      Memory snapshot        │      Allocate 4Kb           │
  713.   │      Reset menu             │      Auto config file 2     │
  714.   │      Uninstall              │      Fill from debugger     │
  715.   │─────────────────────────────┴─ Free 75 kb, Slack 0 kb ────│
  716.   │                                                           │
  717.   └───────────────── Hotkey : (U)ser screen───────────────────┘
  718.  
  719.   Press <ESC> (in DUMPEXE) and then <F9> in TD. The program has now terminated,
  720.   and it's time to allocate a 4KB memory block.
  721.  
  722.   Start DUMPEXE again, and press enter at "Allocate 4Kb". The menu item will
  723.   change to "Deallocate 4Kb". Press <ESC>, and reload the program by pressing
  724.   <CTRL F2>. Start debugging like you did the first time. When you have reached
  725.   the first instruction of the original code, enter all the information, like CS,
  726.   SS.... in [3]. Autodetect size and name. Dump the code, and we are almost
  727.   done. Again terminate your program, by pressing <F9> in TD. Start DUMPEXE
  728.   again, and press <ENTER> at 'Deallocate 4Kb'. Exit your debugger.
  729.  
  730.   Run the MAKEEXE program with parameters : TESTEXE.EXE UNPACKED.EXE
  731.  
  732.   or like this : MAKEEXE.EXE TEXTEXE.EXE UNPACKED.EXE
  733.  
  734.   The MAKEEXE program compares the two memory dump and builds a new exefile
  735.   out of the information found there and in the original exefiles header.
  736.  
  737.   After MAKEEXE has built the new exefile, the screen should look like this :
  738.  
  739.   ┌─────────────────────────────────────────────────────────┐
  740.   │ ─┼── MakeExe v2.3 CARDWARE 1997 by BUGSY/OBSESSiON ─┼── │
  741.   │                                                         │
  742.   │                                                         │
  743.   │Unpacking TESTEXE.EXE into UNPACKED.EXE                  │
  744.   │                                                         │
  745.   │■ Read dump info                                         │
  746.   │■ Read exe info                                          │
  747.   │■ Create new file                                        │
  748.   │■ Create tempfile                                        │
  749.   │■ Write relocations                                      │
  750.   │■ Write zero data                                        │
  751.   │■ Write code                                             │
  752.   │■ Write new header                                       │
  753.   │■ Number of relocations 00C2h                            │
  754.   │                                                         │
  755.   │All done!                                                │
  756.   │                                                         │
  757.   └─────────────────────────────────────────────────────────┘
  758.  
  759.   Try to execute UNPACKED.EXE (it is now unpacked) and see how it reacts.
  760.  
  761.   I think this would be enough for you to continue on your own.
  762.  
  763. ■ How to get in touch with us
  764.  
  765.   If you have any questions about the use of these programs, feel free to
  766.   contact us.
  767.  
  768.   You can get in touch with us by :
  769.  
  770.   Writing a letter to    : Benjamin Petersen
  771.                           Skovburren 271
  772.                           4700 Naestved
  773.                           Denmark
  774.  
  775.   E-Mail us at        : bugsy@cybernet.dk
  776.  
  777.   World Wide Web (WWW)    : http://www.cybernet.dk/users/bugsy/default.htm
  778.  
  779. ■ Distribution sites
  780.  
  781.   BBS Name : Final Fantasy BBS
  782.   Contact  : Mr. Zenix Yang (Mr. Yang Shiuh-Phong)
  783.   Address  : 11F-2, No. 107-3,
  784.              Chung-Yung Road,
  785.              Taichung, Taiwan,
  786.              Republica Of China
  787.   BBS/Fax  : +886 4 - 383 1006
  788.   Voice    : +886 4 - 384 8298
  789.   Email    : zenix@ms10.hinet.net
  790.  
  791.   BBS Name : SelF Destruction BBS
  792.   Contact  : BloOD aNGeL
  793.   Address  : France
  794.   BBS      : +33.01-69893603 (near Paris) (remove the zero after +33 ??)
  795.   Email    : bloodang@club-internet.fr
  796.  
  797.   You can always find the newest version at :
  798.     www.simtel.net/pub/simtelnet/msdos/execomp/dmpexe??.zip
  799.   or
  800.     ftp.simtel.net/pub/simtelnet/msdos/execomp/dmpexe??.zip
  801.  
  802.   Where ?? is the version number without the dot. Eg. dmpexe23.zip
  803.  
  804. ■ Greetings
  805.  
  806.   Our greetings goes to (A-Z order) :
  807.  
  808.   Alif
  809.   Andrea Laforgia
  810.   Benchen
  811.   Benny
  812.   Bob Vandersteen
  813.   Carlos Miguel Viales Solérzano
  814.   Daniel Fazekas
  815.   Dariush Safari                : How is Daniel ?
  816.   DaRk sTAlKeR [UCf]            : How about that DRX emulator ?
  817.   Ernest Herrera
  818.   Franz
  819.   G-MaN
  820.   Hades Wu
  821.   Hakan Olofsson                : Thanks for the card
  822.   Horst Hackenbruch
  823.   Ingo Fischer
  824.   JauMing Tseng
  825.   Jean-Stephane PERRI
  826.   Jestrz
  827.   José Navarro Marténez         : Happy now ? ;-)
  828.   Jung-ho Ryu
  829.   LiBaTiOn
  830.   LuZiFeR
  831.   MaNaGeR
  832.   Mariusz Kowalczyk aka -KoVi-
  833.   Mega Warrior [hAcx'97]
  834.   Mega Warrior
  835.   Michael Pedersen
  836.   Michi Frech
  837.   Murilo Rodrigues
  838.   Pasquale Abagnale
  839.   Paul Simpson                  : O.J's brother ;-) (or was it Bart?)
  840.   PengQing
  841.   Philippe Ahles                : Damn your good.
  842.   TeSdT
  843.   tHEpHARAo^mSH [cRACKER]
  844.   Thorben Sandner
  845.   Thorsten nicolay
  846.   Tommy kurniawan
  847.   VeGeTTa
  848.   X Logic
  849.   Zenix Yang                    : The BBS god !
  850.   Zielu
  851.  
  852. Have fun, and remember there are still some people who DON'T take money
  853. for making _good_ programs.
  854.  
  855. [BUGSY/OBSESSiON]