home *** CD-ROM | disk | FTP | other *** search
/ Programming Win32 Under the API / ProgrammingWin32UnderTheApiPatVillani.iso / pedasm.zip / readme.txt < prev    next >
Text File  |  1998-10-23  |  6KB  |  205 lines

  1. ---------------------------------*-text-*---------------------------------
  2.  
  3.     PEDasm -- win32 executable file disassember ver 0.31 october 1998
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.     Copyright (C) 1997 - 1998 Nicolas Witczak <witczak@geocities.com>
  20.     Home page : http://www.geocities.com/SiliconValley/Lab/6307
  21.  
  22. --------------------------------------------------------------------------
  23.  
  24. remarks concerning the source code
  25. ==================================
  26.  
  27. Don't mail me in order to ask the following kind of questions :
  28.  
  29. - how do I recompile the sources ?
  30.  
  31. - I can't compile, my xxxcc generate xxx errors  ?
  32.  
  33. - Where can I find the headers xxx ? Didn't you forget .h extensions ?
  34.  
  35. - I recompiled the sources and the generated bin hangs ?
  36.  
  37. ...
  38.  
  39. overview
  40. ========
  41.  
  42.  
  43. PEDasm is a Win32 command line tool wich disassemble binary files targeted 
  44. for win32 X86 plateforms. It produces on output an asm source file that can 
  45. in several case be successefully recompiled with an masm compatible assembler . 
  46. This executable may be downloaded and used freeely. 
  47.  
  48.  
  49. list of files from this archive
  50. ===============================
  51.  
  52.  
  53. * CPP source files 
  54.  
  55.     + DasmBase.cpp .h , DasmCode.cpp .h , DasmData.cpp .h 
  56.         core disassembly code
  57.  
  58.     + symbol.cpp .h :
  59.         symbols type ( var function ... ) categorization
  60.  
  61.     + DasmCte.h : x86 machine code and assembly related constants
  62.  
  63.     + ExeRep.cpp .h :
  64.         ms PE file exe and dll loader specific code .
  65.  
  66.     + globals.cpp globals.h    :
  67.        generic helpers 
  68.  
  69.     + config.h :
  70.         plateform and compiler specific stuff
  71.  
  72.     + main.cpp :
  73.         entry point, cmd line analysis        
  74.  
  75. * build file
  76.  
  77.     + Makefile : generic standard make file 
  78.  
  79. * binary file :
  80.  
  81.     + PEDasm.exe : win32 executable
  82.  
  83. * text file 
  84.     +  readme.txt     
  85.     +  licence.txt
  86.  
  87.  
  88. Command line options and output format
  89. ======================================
  90.  
  91. Given an executable inputFile.exe it produces the following files
  92.     - inputFile.asm : disassembled file 
  93.     - (opt) inputFile.def : if inputFile.exe export section is not empty 
  94.     this file gathers exported symbols
  95.     - various xxx.def files : one for each imported dll used by inputFile.exe 
  96.      
  97. Command line options are :
  98.  
  99.     -h : echos help message
  100.     -o name : override default asm output with name
  101.     -r : feed each assembly line with raw hexa content within a comment
  102.     -l : add to each assembly line its virtual address
  103.     -p integerVal : override number of pass ( default 3 )
  104.         increasing this number may help distinguish code from data when both are deeply mixed
  105.     -s : specify additional synchro point config file 
  106.         file must have the following form  :
  107.  
  108. [# comment]
  109.  
  110. adress  data | funct | ptr [symbolName]
  111.  
  112. ex: 
  113.  
  114. # override default PEDasm beheavior to consider 0x0040a478    address as data
  115. # and name it progConstant 
  116. 0x0040a478    Data    progConstant
  117.  
  118.  
  119.     -b [+|-]bank_name : use instruction set bank_name . Not using an instruction bank prevent from 
  120. recognizing some kind of instructions. Accessible banks are : user , system , fpu , mmx 
  121. Usage -b [+]bank_name : force use of bank_name instruction set
  122. Usage -b -bank_name : prevent use of bank_name instruction set
  123.     
  124.     default -b +userX86 +fpuX86
  125.  
  126. rq : using minimal banks can help detect garbage code !
  127.  
  128. new in ver 0.31
  129. ===============
  130.  
  131. - removed some oddity in code
  132. - moved plateform and compiler specific code to a single file "config.h"
  133.  
  134. NOTE : at this time  Giuseppe Guerrini is working on a port of PEDasm for Linux 
  135.     here is his mail adresse : <giusguerrini@racine.ra.it>
  136.  
  137. new in ver 0.3
  138. ==============
  139.  
  140. - added assembly instruction banks choice
  141. - now distributed as a GNU software
  142.  
  143. new in ver 0.2
  144. ==============
  145.  
  146. - improved speed
  147. - bug correction : better output and robustness
  148. - explicit support for dll input
  149. - added command line options
  150. - user overrides file for code data mixing interpretation
  151.  
  152. example of use
  153. ===============
  154.  
  155. One must have an masm compatible assembler and a resource extractor
  156. Provided environment variables and path are set following sequence 
  157. disassembles and reproduces calc.exe :
  158.  
  159.  
  160.     pedasm calc.exe    -s calcConf.txt
  161.     lib -machine:I386 /out:kernel32.lib  /def:kernel32.def 
  162.     lib -machine:I386 /out:user32.lib  /def:user32.def 
  163.     lib -machine:I386 /out:shell32.lib  /def:shell32.def 
  164.     lib -machine:I386 /out:gdi32.lib  /def:gdi32.def 
  165.     ml /c  /coff calc.asm
  166.     link -entry:main -out:calcdasm.exe calc.res  -subsystem:windows -machine:I386 \
  167.     calc.obj kernel32.lib user32.lib shell32.lib gdi32.lib 
  168.  
  169.  
  170. remarks
  171. =======
  172.  
  173.  
  174. -  asm generated source contains line that produces error at compilation
  175.  
  176. some examples encountered while testing :
  177.  
  178.     call 0x00405c21     
  179.         :  pedasm missed that address -> try increase -p switch
  180.  
  181.     mov al , byte ptr Unknown3800dc 
  182.         : pedasm marked this symbol as Unknown because it was outside the legal adress space
  183.         of the exe while present in .reloc section
  184.             
  185.     call Data4174a0    
  186.         : address 0x004174a0 was wrongly interpreted as data
  187.         -> try config file with "0x004174a0 Funct" line
  188.  
  189.     add  byte ptr gs:[eax] , al
  190.         : obviously garbage code, only selector pointed by fs may be used
  191.         for structured exception handling and thread structures
  192.         -> try a conf file line with a "data" keyword
  193.  
  194. - text segment begin with many line like the following :
  195.     
  196.     extern    _imp__RegQueryValueExA : dword
  197.     RegQueryValueExA equ _imp__RegQueryValueExA
  198.  
  199.     dword 0BFEC15C4h
  200.  
  201.         : import dll data are usually placed in idata section but can be placed anywhere
  202.  
  203.  
  204.  
  205.