home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / SEXDOC.ZIP / SEXDOC.TXT
Text File  |  1991-04-04  |  51KB  |  1,085 lines

  1. /---------------------------------------------------------------------------\
  2. |                                                                           |
  3. |            SEXDOC.TXT the README for SEX.EXE  SUPER-EXE-HEADER            |
  4. |                                                                           |
  5. |                    Alan Cobb's Super-Exe-Header V1.00                     |
  6. |                    Copyright (c) 1988-91, Alan S. Cobb                    |
  7. |                                                                           |
  8. |                          Alan Cobb & Associates                           |
  9. |                        510 Shannon Way, Suite 2201                        |
  10. |                          Redwood City, CA  94065                          |
  11. |                                                                           |
  12. |                  CIS/Internet: 73170.3543@CompuServe.COM                  |
  13. |                     Bix/MCI:AlanCobb, Tel:415-593-7158                    |
  14. |                                                                           |
  15. \---------------------------------------------------------------------------/
  16.  
  17. SUMMARY:
  18. --------
  19. Super-Exe-Header ( SEX ) is a program that expands on some of the
  20. capabilities of Microsoft's EXEHDR.EXE utility.  It allows you to
  21. find and decode all the exports and imports made by most OS/2 and
  22. Windows EXEs, DLLs and device drivers.  This is often a prelude to
  23. deeper reverse engineering such as disassembly and runtime tracing
  24. analysis with a debugger.  While it CURRENTLY ONLY _RUNS_ UNDER OS/2
  25. (a Windows version is coming), it will _analyze_ Windows files in
  26. addition to OS/2 1.X EXEs and DLLs, since the format is almost
  27. identical.
  28.  
  29.  
  30. PAPER/BOOK AND PROGRAM OFFER:
  31. -----------------------------
  32.  
  33. SEX is part of my preliminary development of full disassemblers for
  34. both Windows and OS/2 ( WINDIS.EXE and OS2DIS.EXE (tm) ).  For $40
  35. ($35 + $5 shipping and handling) you will get the OS/2 version of SEX
  36. (and a free copy of the Windows version of SEX when it comes out). In
  37. addition you get a copy of my 90 page paper "Reverse Engineering
  38. Windows and OS/2 Software" which was delivered at Software
  39. Development Spring '91. See more below.
  40.  
  41.  
  42.  
  43.  
  44. PRINTING THIS README.TXT FILE:
  45. ------------------------------
  46. Some of the lines in this file are longer than 80 characters.  If you
  47. want to print it out, you should probably do it with compressed (>80 
  48. character) mode.
  49.  
  50.  
  51. WHERE ARE THE INTERESTING PARTS?
  52. --------------------------------
  53. The SEX report you may find most interesting is the one generated
  54. with the "-sex" command.  See the details below.
  55.  
  56.  
  57. TABLE OF CONTENTS:
  58. ------------------
  59.  
  60.    Summary:
  61.  
  62.    Paper/Book and Program Offer:
  63.    Printing This README.TXT File:
  64.    Where are the Interesting Parts:
  65.    Table of Contents:
  66.    Why You Need SEX:
  67.    Legal Warning:
  68.    How SEX is Better Than EXEHDR:
  69.    The Origins of SEX:
  70.    About the Author (Consulting Available):
  71.    Paper/Book and Program Offer:
  72.  
  73.    Steps in Using SEX:
  74.  
  75.    Summary of SEX Commands:
  76.    Creating the Ordinal-To-Export-Function-Name Translation Database:
  77.    Which Exported Functions Are Undocumented?  Understanding the -undoc
  78.       and -headers Switches:
  79.  
  80.    Detailed Discussion of Commands:
  81.       -exp command:
  82.       -imp command:
  83.       -sex command:
  84.       -dat command:
  85.       rlib.exe:
  86.  
  87.    Known Problems / Caveats:
  88.       Differences With My Paper Delivered At Software Development '91:
  89.       Only runs on OS/2 Currently:
  90.       Beta Level Product:
  91.       Uses a Lot of Memory:
  92.       Files SEX Doesn't Work On:
  93.       You'll Still Need EXEHDR:
  94.  
  95.    Abstract Of Paper/Book:
  96.    Table of Contents For Paper/Book:
  97.  
  98.  
  99.  
  100. WHY YOU NEED SEX:
  101. -----------------
  102. Suppose there is a function exported by Windows or OS/2 that you want
  103. to learn more about.  One way to do this is to look at examples of
  104. how it is used by existing programs.  SEX will help you find all the
  105. programs and DLLs that are using the function.  It will also show you
  106. where, in a program, the calls are being made from.  That is often a
  107. prelude to further reverse engineering such as disassembly or runtime
  108. tracing with a debugger.
  109.  
  110.  
  111. LEGAL WARNING:
  112. --------------
  113. This SEX may not be entirely safe.  If you are using SEX as the first
  114. step in a deeper reverse engineering effort, you should remember that
  115. reverse engineering of software is legally controversial.  Examine
  116. your license argeement or other relevant contracts and speak with an
  117. attorney before doing any in-depth reverse engineering.
  118.  
  119.  
  120. HOW SEX IS BETTER THAN EXEHDR:
  121. ------------------------------
  122. EXEHDR does NOT show exhaustively _all_ the imports and other
  123. relocations for a file.  It only shows the first one in the "chain"
  124. for each segment.  A segment could make 20 calls to a single import,
  125. but only the first in the chain of relocations will be shown.  On the
  126. other hand, SEX shows them all, sorted by offset.  It also creates a
  127. database for translating the cryptic numeric ordinals normally shown
  128. by EXEHDR into the full ASCII names for those exported points.  For
  129. example, instead of just showing a far call to "DOSCALLS . 38", SEX
  130. will show it as "DOSCALLS . 38 : DOSREALLOCSEG".
  131.  
  132.  
  133. THE ORIGINS OF SEX:
  134. -------------------
  135. This program is part of the preliminary work I have done on a full
  136. commercial disassembler for Windows and OS/2.  The full product will
  137. be completed and published by me sometime in the future.
  138.  
  139.  
  140.  
  141. ABOUT THE AUTHOR  (CONSULTING AVAILABLE):
  142. -----------------------------------------
  143. I, Alan Cobb, am a consultant and software developer specializing in
  144. Windows and OS/2.  I have been involved in OS/2 PM and Windows
  145. consulting since 1987.  I have been published in Microsoft Systems
  146. Journal and spoken at Windows and OS/2 conferences.  I have a B.S. in
  147. Finance from U.C.Berkeley (Phi Beta Kappa) and an M.S. in Electronics
  148. Engineering from C.S.U.Sacramento.
  149.  
  150.  
  151. PAPER/BOOK AND PROGRAM OFFER:
  152. -----------------------------
  153. Although this SEX is cheap, it is NEITHER FREE, NOR SHAREWARE, NOR IN
  154. THE PUBLIC DOMAIN.  For the price of $40 ($35 plus $5 shipping and
  155. handling), I will send you a copy of the OS/2 version (you'll also get
  156. a free Windows version when it is ready) of SEX and a copy of my 90
  157. page paper titled "Reverse Engineering Windows and OS/2 Software".  I
  158. delivered this paper at Software Development 1991 in Santa Clara on
  159. February 14, 1991.  It will probably be expanded eventually into a
  160. full length book.  At the end of this readme file there is an
  161. abstract and abbreviated table of contents for the paper.  It will
  162. give you more background to help you understand how and why to use
  163. SEX.  If you're not satisfied with the paper and program, return 
  164. them in 60 days for a full refund.
  165.  
  166. You can get the full program and paper by sending a check for $40 to
  167. my address:
  168.  
  169.    Alan Cobb
  170.    Alan Cobb & Associates
  171.    510 Shannon Way, Suite 2201
  172.    Redwood City, CA  94065
  173.  
  174.  
  175.  
  176.  
  177.  
  178. *************************************************************************
  179.  
  180. STEPS IN USING SEX:
  181. -------------------
  182.  
  183. This brief usage summary will get you started quickly.  These commands
  184. are discussed in greater detail later in this file.
  185.  
  186.  
  187. 1) Copy SEX.ZIP onto your hard disk. It is about 170k in size.
  188.  
  189. 2) Uncompress SEX.ZIP.  You should end up with the following files:
  190.  
  191.       SEX.EXE      320k    The main SEX program.
  192.       RLIB.EXE     67k     Reads import libraries (mainly for OS2.LIB).
  193.       README.TXT   50k     The documentation file you are reading now.
  194.  
  195.  
  196. 3) Although it is optional, you will probably want to build the
  197.    ordinal-to-function-name translation database, EXPORTS.DAT.  It only
  198.    takes about 3 minutes on a 386/25.  If you do build it, this database
  199.    will be used to translate any module.ordinal pairs into full ASCII
  200.    function names for the various reports.  Do not be worried by the 
  201.    numerous messages scrolling up your screen during the -exp command,
  202.    that is normal.
  203.  
  204.  3.1) If you are just interested in looking at Windows files:
  205.       SEX -exp -noapps \windows\*.* \windows\system\*.* >  exports.dat
  206.       At this point EXPORTS.DAT will be about 230k
  207.  
  208.  3.2) If you are just interesting in looking at OS/2 files:
  209.       SEX -exp -noapps \os2\*.* \os2\dll\*.*            >  exports.dat
  210.       RLIB \pmsdk12\lib\os2.lib                         >> exports.dat
  211.  
  212.       At this point EXPORTS.DAT will be about 180k.  The RLIB program
  213.       reads the ordinals and function names from the DOSCALLS module
  214.       entries in os2.lib.
  215.  
  216.  3.3) If you are interesting in looking at both Windows and OS/2 files:
  217.       SEX -exp -noapps \windows\*.* \windows\system\*.* >  exports.dat
  218.       SEX -exp -noapps \os2\*.* \os2\dll\*.*            >> exports.dat
  219.       RLIB \pmsdk12\lib\os2.lib                         >> exports.dat
  220.       At this point EXPORTS.DAT will be about 410k.
  221.  
  222.  
  223.  
  224. 4) Run the reports you are interested in:
  225.  
  226.  4.1) List exports:
  227.  
  228.    List all exports of the Windows GDI Dynamic Link Library:
  229.    Also check the Windows header files and mark those exports which
  230.    appear to be documented there.
  231.  
  232.      SEX -exp -human \windows\system\gdi.exe  -headers \windev\include\*.*
  233.  
  234.    List only the undocumented exports of the Windows Kernel:
  235.  
  236.      SEX -exp -human -undoc \windows\system\kernel.exe 
  237.                               -headers \windev\include\*.*  > report.txt
  238.      Look at the resultant report.txt with any ASCII editor.
  239.  
  240.  
  241.  4.2) List imports:
  242.  
  243.    List all imports to a Windows application:
  244.       SEX -imp \mywin\winapp.exe  -headers \windev\include\*.*
  245.  
  246.    List only the undocumented imports to a Windows application:
  247.       SEX -imp -undoc \mywin\winapp.exe  -headers \windev\include\*.*
  248.  
  249.  
  250.  4.3) List exhaustively all imports and, optionally, other relocations:
  251.  
  252.    List all imports, but no other relocations, made by a Windows application.
  253.       SEX -sex  winapp.exe  > winapp.sex
  254.  
  255.    List all imports and relocations made by a Windows DLL:
  256.       SEX -sex -allrel  windll.exe  > report.txt
  257.  
  258.    List all imports and relocations made by a Windows DLL,
  259.                             and mark the ones documented in include files.
  260.       SEX -sex -allrel  windll.exe  -headers \windev\include\*.*
  261.  
  262.  
  263.  4.4) List out the contents of the ordinal-to-function-name translation
  264.       database, EXPORTS.DAT:
  265.  
  266.    List all entries.  Do NOT attempt to see which ones are documented.
  267.       SEX -dat
  268.  
  269.    List all entries.  DO check the header files and mark those exports
  270.    which are apparently documented.
  271.  
  272.       SEX -dat -headers \windev\include\*.*  
  273.  
  274.  
  275.  
  276. *************************************************************************
  277.  
  278. SUMMARY OF SEX COMMANDS:
  279. ------------------------
  280.  
  281. Usage:  SEX -command [-options] [filename(s)]  [-headers filenames]   
  282.  
  283. Commands:
  284.   Show list of exports for file(s): -exp 
  285.                      [-human ] [-noapps] [-undoc]  file(s)   [-headers file(s)]
  286.   Show list of imports for file:    -imp [-undoc]  file      [-headers file(s)]
  287.   Show a Super-Exe-Header report:   -sex [-allrel] file      [-headers file(s)]
  288.   Show ordinal-to-func name database (exports.dat): -dat     [-headers file(s)]
  289.   Show this command summary:        -?                                        
  290.  
  291. Options:
  292.  -human               : Output as an export report for human readers.
  293.  -noapps              : Do NOT read applications (non-DLLs) for exports.
  294.  -allrel              : Show all relocations, not just imports.
  295.  -undoc               : Show only undocumented imports or exports.
  296.  -headers filename(s) : Search files, such as *.H or *.INC, for possible
  297.                                    documentation of export or import names. 
  298. Examples:                    
  299.  SEX -exp -noapps \win3\system\*.* -headers \win\include\*.* >> exports.dat
  300.  SEX -exp -human -undoc winapp.exe -headers \win\include\*.*
  301.  SEX -exp winapp.exe
  302.  
  303.  SEX -imp os2serv.dll  -headers \pmsdk12\include\*.h   
  304.  SEX -imp -undoc os2appl.exe  -headers \pmsdk12\include\*.h  
  305.  
  306.  SEX -sex win3prog.exe                                          
  307.  SEX -sex -allrel os2prog.exe -headers \pmsdk12\include\*.h   
  308.  
  309.  SEX -dat -headers \windev\include\*.*  
  310.  
  311.  
  312.  
  313. ************************************************************************
  314.  
  315. CREATING THE ORDINAL-TO-EXPORT-FUNCTION-NAME TRANSLATION DATABASE:
  316. ------------------------------------------------------------------
  317.  
  318. SEX looks for a file called EXPORTS.DAT in the current directory when
  319. doing the -imp, -sex or -dat reports.  EXPORTS.DAT is created with
  320. the -exp command and with RLIB.EXE.  You can still run all of SEX's
  321. reports even if you have not built the EXPORTS.DAT database, but
  322. you will only be able to see imports expressed as MODULE . ORDINAL,
  323. rather than MODULE . ORDINAL : ASCII NAME.  For example, without the
  324. database, USER.33 : GETCLIENTRECT, will be shown as the more
  325. cryptic USER.33.
  326.  
  327.  
  328.  
  329. WHICH EXPORTED FUNCTIONS ARE UNDOCUMENTED?  UNDERSTANDING THE -undoc
  330. AND -headers SWITCHES:
  331. --------------------------------------------------------------------
  332.  
  333. It is often interesting to know which functions exported by a DLL, or
  334. imported by an EXE file, are documented or undocumented.  For
  335. example, the Windows GDI function CreateDC and most other functions
  336. of interest are documented in the Windows Programmer's Reference
  337. manual.  But the more internal GDI function PixToLine is not.
  338.  
  339. There are two switches used by SEX that relate to undocumented
  340. functions.  They are -headers and -undoc.
  341.  
  342. The -headers switch is followed by a list of header files to search,
  343. such as "\windev\include\*.*".  SEX will read through all those files
  344. looking for ASCII strings.  Many of these strings will indeed be
  345. function names declared in function prototypes, but also of course,
  346. there will be other strings which are just type names or parameter
  347. names.  So this is only a rough test of undocumentedness.
  348.  
  349. There are some exported functions which appear to be undocumented,
  350. but which in fact _are_ documented.  For example, the export
  351. _WSPRINTF from USER.EXE is documented in windows.h, but without the
  352. leading underscore.  The WNET... functions exported by USER.EXE are
  353. not documented in the SDK's include files, but they are in the DDK's
  354. include files.
  355.  
  356. The import and export lines used in SEX's reports have a field with
  357. the label " '*' If apparently documented".  This field is set to '*'
  358. if the -headers switch was specified, and if the import or export
  359. name can be found in the list of "name" strings read in from the
  360. header files.  If the -headers switch was not specified, then this
  361. field will always be blank, since SEX must assume that none of the
  362. exports or imports are documented.
  363.  
  364. The -undoc switch can be used with the -exp and -imp reports to cause
  365. SEX to only display export or import lines which appear to be
  366. undocumented.  This is helpful if you want to enumerate how many
  367. undocumented imports are being made to a program, or how many 
  368. undocumented exports are being made from a DLL.  Currently the -undoc
  369. switch does not effect the -sex and -dat reports.
  370.  
  371.  
  372.  
  373.  
  374. DETAILED DISCUSSION OF COMMANDS:
  375. --------------------------------
  376. As shown in the summary above, SEX has four main commands:
  377.   1)  -exp   Shows a list of exports for given file(s). 
  378.   2)  -imp   Shows a list of imports for a given file.
  379.   3)  -sex   Shows an exhaustive list of all imports and relocations
  380.                for a given file.
  381.   4)  -dat   Shows the content of the ordinal-to-function-name translation
  382.                database file used by SEX (exports.dat).
  383.  
  384.  
  385. 1) -exp COMMAND:
  386. ------------------
  387.  
  388. This command creates a list of exports for one or more, Windows or
  389. OS/2 files.  By using wild cards in the specified filenames it can
  390. examine multiple files in multiple directories.
  391.  
  392. It has two purposes. 1) To create a machine readable ordinal-to-function-
  393. name translation database, and 2) to display a more human readable
  394. version of that database.
  395.  
  396. 1.1)  The default behavior of the -exp command is to create a MACHINE
  397. READABLE database (exports.dat) for translating MODULE.ORDINAL
  398. pairs into their equivalent exported ASCII function names.  Use the
  399. -human switch described below to make reports more suitable for human
  400. reading.
  401.  
  402.   For example, the following -exp command will fill the exports.dat
  403.   database with Windows DLL and device driver exports:
  404.  
  405.     sex -exp -noapps \windows\*.* \windows\system\*.*  > exports.dat
  406.  
  407.   Do not be worried by the numerous messages scrolling up your screen
  408.   during the -exp command, that is normal.  Here is what the resultant
  409.   machine readable output file, exports.dat looks like.  This is only a
  410.   few small sections of the complete file.
  411.  
  412.   RECORDER   1 JRHOOK           DLL/Driver   \win3\RECORDER.DLL
  413.   RECORDER   2 STARTRECORD      DLL/Driver   \win3\RECORDER.DLL
  414.   RECORDER   3 STOPRECORD       DLL/Driver   \win3\RECORDER.DLL
  415.   RECORDER   4 STARTPLAYBACK    DLL/Driver   \win3\RECORDER.DLL
  416.   RECORDER   5 STOPPLAYBACK     DLL/Driver   \win3\RECORDER.DLL
  417.   RECORDER   6 JPHOOK           DLL/Driver   \win3\RECORDER.DLL
  418.   RECORDER   7 KHOOK            DLL/Driver   \win3\RECORDER.DLL
  419.  
  420.                (... some detail removed... ) 
  421.  
  422.   GRABBER    1 PAINTSCREEN      DLL/Driver   \win3\system\EGA.GR3
  423.   GRABBER    2 SCREENFREE       DLL/Driver   \win3\system\EGA.GR3
  424.   GRABBER    3 BEGINSELECTION   DLL/Driver   \win3\system\EGA.GR3
  425.   GRABBER    4 KEYSELECTION     DLL/Driver   \win3\system\EGA.GR3
  426.   GRABBER    5 MAKESELCTRECT    DLL/Driver   \win3\system\EGA.GR3
  427.  
  428.                (... some detail removed... ) 
  429.  
  430.   GDI        1 SETBKCOLOR       DLL/Driver   \win3\system\GDIN.EXE
  431.   GDI        2 SETBKMODE        DLL/Driver   \win3\system\GDIN.EXE
  432.   GDI        3 SETMAPMODE       DLL/Driver   \win3\system\GDIN.EXE
  433.   GDI        4 SETROP2          DLL/Driver   \win3\system\GDIN.EXE
  434.   GDI        5 SETRELABS        DLL/Driver   \win3\system\GDIN.EXE
  435.   GDI        6 SETPOLYFILLMODE  DLL/Driver   \win3\system\GDIN.EXE
  436.  
  437.                (... some detail removed... ) 
  438.  
  439.   KERNEL     1 FATALEXIT        DLL/Driver   \win3\system\KERNEL.EXE
  440.   KERNEL     2 EXITKERNEL       DLL/Driver   \win3\system\KERNEL.EXE
  441.   KERNEL     3 GETVERSION       DLL/Driver   \win3\system\KERNEL.EXE
  442.   KERNEL     4 LOCALINIT        DLL/Driver   \win3\system\KERNEL.EXE
  443.   KERNEL     5 LOCALALLOC       DLL/Driver   \win3\system\KERNEL.EXE
  444.   KERNEL     6 LOCALREALLOC     DLL/Driver   \win3\system\KERNEL.EXE
  445.   KERNEL     7 LOCALFREE        DLL/Driver   \win3\system\KERNEL.EXE
  446.  
  447.  
  448.   Related switch options: 
  449.  
  450. 1.1.1) -noapps :  When this switch is specified, SEX will not examine
  451. and list the exports of any applications in the list of filenames
  452. specified.  This is useful when you specify a pathname with wild cards
  453. such as "\windows\system\*.*", when building the ordinal-to-function-
  454. name translation database.  Normally, you want a list of all the
  455. exports from the dynamic link libraries in \windows\system (like
  456. KERNEL.EXE), but not from any applications there.  The reason is, of
  457. course, that no other application can import the exports of another
  458. application, it can only import the exports of dynamic link
  459. libraries.  If you want to also look at exports from applications you
  460. should use the -human switch below.
  461.  
  462.   You can also manually delete, add or modify entries directly in the
  463.   exports.dat file with any ASCII editor.
  464.  
  465.  
  466. 1.2) To create HUMAN READABLE reports of the same type use the
  467. -human switch.  Below is the report displayed for this command:
  468.  
  469.     sex -exp -human  \win3\system\user.exe
  470.  
  471. +----------------------------------------------------------------------------+
  472. |                      List of all exports from file:                        |
  473. +----------------------------------------------------------------------------+
  474. |   File name:          [ \win3\system\user.exe               ]              |
  475. |   DLL or Application? [ DLL/Driver           ]                             |
  476. |                                                                            |
  477. | +-- Module Name                                                            |
  478. | |            +-- Export Ordinal                                            |
  479. | |            | +-- '*' If apparently documented                            |
  480. | |            | | +-------------- Export Name                               |
  481. |-v------------v-v-v---------------------------------------------------------|
  482.   USER     .   1   MESSAGEBOX               
  483.   USER     .   2   OLDEXITWINDOWS           
  484.   USER     .   3   ENABLEOEMLAYER           
  485.   USER     .   4   DISABLEOEMLAYER          
  486.   USER     .   5   INITAPP                  
  487.   USER     .   6   POSTQUITMESSAGE          
  488.   USER     .   7   EXITWINDOWS              
  489.   USER     .  10   SETTIMER                 
  490.   USER     .  11   SETSYSTEMTIMER           
  491.   USER     .  12   KILLTIMER                
  492.   USER     .  13   GETTICKCOUNT             
  493.   USER     .  14   GETTIMERRESOLUTION       
  494.  
  495.             (... rest of report cut off... ) 
  496.  
  497.  
  498.    The command below adds the -headers switch and produces the report
  499.    that follows.  Notice the added '*' flags.
  500.  
  501.     sex -exp -human  \win3\system\user.exe  -headers \windev\include\*.*
  502.  
  503. +----------------------------------------------------------------------------+
  504. |                      List of all exports from file:                        |
  505. +----------------------------------------------------------------------------+
  506. |   File name:          [ \win3\system\user.exe               ]              |
  507. |   DLL or Application? [ DLL/Driver           ]                             |
  508. |                                                                            |
  509. | +-- Module Name                                                            |
  510. | |            +-- Export Ordinal                                            |
  511. | |            | +-- '*' If apparently documented                            |
  512. | |            | | +-------------- Export Name                               |
  513. |-v------------v-v-v---------------------------------------------------------|
  514.   USER     .   1 * MESSAGEBOX               
  515.   USER     .   2   OLDEXITWINDOWS           
  516.   USER     .   3   ENABLEOEMLAYER           
  517.   USER     .   4   DISABLEOEMLAYER          
  518.   USER     .   5   INITAPP                  
  519.   USER     .   6 * POSTQUITMESSAGE          
  520.   USER     .   7 * EXITWINDOWS              
  521.   USER     .  10 * SETTIMER                 
  522.   USER     .  11   SETSYSTEMTIMER           
  523.   USER     .  12 * KILLTIMER                
  524.   USER     .  13 * GETTICKCOUNT             
  525.   USER     .  14   GETTIMERRESOLUTION       
  526.  
  527.             (... rest of report cut off... ) 
  528.  
  529.  
  530.  
  531.  
  532.   Related switch options: 
  533.  
  534.   1.2.1) -noapps  :  See discussion above.
  535.  
  536.   1.2.2) -undoc  :  You can use the -undoc switch if you only want
  537.   to show the exports which are NOT documented in a given list of header
  538.   include files.  
  539.  
  540.   If you use the -undoc switch you should use the -headers switch 
  541.   at the same time.  If you omit the -headers switch, SEX will think
  542.   that all the exports are undocumented, and hence display them all.
  543.  
  544.  
  545.  
  546. 2) -imp COMMAND:
  547. ------------------
  548.  
  549. This command will create a SUMMARY of imports for OS/2 or Windows,
  550. DLL or EXE files.  This allows you to find which programs are
  551. importing functions you are interested in.  The imports are sorted
  552. by module and ordinal, and include a count of total calls made to
  553. them.
  554.  
  555. For example, the command below will create the report which is partially
  556. shown following it.  Since the -headers switch was not specified, SEX
  557. thinks all the imports are undocumented.
  558.    
  559.     sex -imp \windev\samples\icon\icon.exe
  560.  
  561. +----------------------------------------------------------------------------+
  562. |                     List of all functions imported by:                     |
  563. |----------------------------------------------------------------------------|
  564.  File name:             [ \windev\samples\icon\icon.exe                    ]
  565. |----------------------------------------------------------------------------|
  566. | Calls | Ordinal | Module |Ord.| +-- '*' If apparently documented           |
  567. |       | or Name |        |    | | +-- Name of imported function            |
  568. |-------+---------+--------+----+-v-v----------------------------------------|
  569.      1  Imp.Ord.[ GDI      .  87]   GETSTOCKOBJECT
  570.      1  Imp.Ord.[ KERNEL   .   1]   FATALEXIT
  571.      1  Imp.Ord.[ KERNEL   .   5]   LOCALALLOC
  572.      1  Imp.Ord.[ KERNEL   .   6]   LOCALREALLOC
  573.      1  Imp.Ord.[ KERNEL   .   7]   LOCALFREE
  574.      1  Imp.Ord.[ KERNEL   .  15]   GLOBALALLOC
  575.      1  Imp.Ord.[ KERNEL   .  16]   GLOBALREALLOC
  576.      1  Imp.Ord.[ KERNEL   .  17]   GLOBALFREE
  577.      2  Imp.Ord.[ KERNEL   .  23]   LOCKSEGMENT
  578.  
  579.             (... rest of report cut off... ) 
  580.  
  581.  
  582.    The command below adds the -undoc and -headers switches and produces
  583.    the report that follows.
  584.  
  585.    sex -imp -undoc \windev\samples\icon\icon.exe -headers \windev\include\*.*
  586.  
  587. +----------------------------------------------------------------------------+
  588. |                     List of all functions imported by:                     |
  589. |----------------------------------------------------------------------------|
  590.  File name:             [ \windev\samples\icon\icon.exe                    ]
  591. |----------------------------------------------------------------------------|
  592. | Calls | Ordinal | Module |Ord.| +-- '*' If apparently documented           |
  593. |       | or Name |        |    | | +-- Name of imported function            |
  594. |-------+---------+--------+----+-v-v----------------------------------------|
  595.      1  Imp.Ord.[ KERNEL   .  30]   WAITEVENT
  596.      1  Imp.Ord.[ KERNEL   .  91]   INITTASK
  597.      1  Imp.Ord.[ KERNEL   . 137]   FATALAPPEXIT
  598.      1  Imp.Ord.[ USER     .   5]   INITAPP
  599.  
  600.  Number of unique functions imported:  [   30 ]
  601.  Total calls to these imports:         [   33 ]
  602.  
  603.  
  604.   Related switch options: 
  605.  
  606.   -noapps  :  See the discussion of the -exp command above.
  607.  
  608.  
  609.  
  610. 3) -sex COMMAND:
  611. ------------------               
  612.  
  613. This command will create an exhaustive list of _all_ calls to
  614. imports, and optionally all other relocatable internal references
  615. (relocations), for all segments of an OS/2 or Windows, EXE or DLL
  616. file, sorted by segment and offset.  The absolute offset in the file
  617. for each relocation is shown at the left to allow you to find, and
  618. possibly disassemble with a debugger, the section of code making the
  619. call or other reference.
  620.  
  621. In addition to the relocations, the -sex report also shows several 
  622. other important addresses, each sorted into offset order amongst the
  623. relocations.  These other addresses include the first and last bytes
  624. of each segment, all exports, the initial SS:SP (stack start) and
  625. initial CS:IP (entry point).
  626.  
  627. For example, the following command will create the report below.
  628.  
  629.      sex -sex -allrel  \windev\samples\showfont\showfont.exe
  630.                                           -headers \windev\include\*.*    
  631.  
  632. +----------------------------------------------------------------------------+
  633. |  List of all segments, exports, imports [and other relocations] for file:  |
  634. |----------------------------------------------------------------------------|
  635.  File name:             [ \windev\samples\showfont\showfont.exe    ]
  636. |----------------------------------------------------------------------------|
  637. | File  | Seg:Offet |       Description                                      |
  638. | Offset|           |                        +-- '*' If apparently documented|
  639. |-------+-----------+------------------------v-------------------------------|
  640.  
  641. *** Segment No. [   0 ] *** Type:[ ZERO_SEG ] *************
  642.  000000  000:0000  Segment start
  643.                    Segment length zero
  644.  000000  000:0000  Last byte in segment
  645.  
  646. *** Segment No. [   1 ] *** Type:[ CODE_SEG ] *************
  647.  000800  001:0000  Segment start
  648.  000800  001:0000  Intern.Ref.Target  ST:2:SEGMENT                TT:0:INTRNRF Refs:12
  649.  000870  001:0070  Imp.Ord.[ USER     .  41]   CREATEWINDOW
  650.  000880  001:0080  Imp.Ord.[ USER     .  42]   SHOWWINDOW
  651.  000888  001:0088  Imp.Ord.[ USER     . 124]   UPDATEWINDOW
  652.  000894  001:0094  Imp.Ord.[ USER     . 113]   TRANSLATEMESSAGE
  653.  
  654.             (... some detail removed... ) 
  655.  
  656.  000932  001:0132  Intern.Ref.Source  ST:5:OFFS16   Targ:001:0c9a TT:0:INTRNRF Refs:1
  657.  000937  001:0137  Intern.Ref.Source  ST:2:SEGMENT  Targ:001:0000 TT:0:INTRNRF Refs:1
  658.  00093c  001:013c  Imp.Ord.[ USER     .  57]   REGISTERCLASS
  659.  000947  001:0147  Imp.Ord.[ KERNEL   .   9]   LOCALUNLOCK
  660.  00094f  001:014f  Imp.Ord.[ KERNEL   .   7]   LOCALFREE
  661.  000965  001:0165  Imp.Ord.[ GDI      .   2]   SETBKMODE
  662.  000975  001:0175  Imp.Ord.[ GDI      .   1]   SETBKCOLOR
  663.  
  664.             (... some detail removed... ) 
  665.  
  666.  00111c  001:091c  Export  [ ShowFont .   6]  ENUMFUNC
  667.  00111c  001:091c  Intern.Ref.Target  ST:5:OFFS16                 TT:0:INTRNRF Refs:2
  668.  0011b8  001:09b8  Imp.Ord.[ USER     .  66]   GETDC
  669.  0011c0  001:09c0  Intern.Ref.Source  ST:5:OFFS16   Targ:001:091c TT:0:INTRNRF Refs:1
  670.  0011c3  001:09c3  Intern.Ref.Source  ST:2:SEGMENT  Targ:001:0000 TT:0:INTRNRF Refs:1
  671.  
  672.             (... some detail removed... ) 
  673.  
  674.  002bb1  001:23b1  Imp.Ord.[ USER     .  96]   CHECKRADIOBUTTON
  675.  002bce  001:23ce  Imp.Ord.[ USER     .  96]   CHECKRADIOBUTTON
  676.  002c01  001:2401  Initial CS:IP   (Entry Point)  <****
  677.  002c05  001:2405  Imp.Ord.[ KERNEL   .  91]   INITTASK
  678.  
  679.             (... some detail removed... ) 
  680.  
  681. *** Segment No. [   2 ] *** Type:[ INITIALIZED_DATA_SEG_DGROUP ] *************
  682.  004000  002:0000  Segment start
  683.  004000  002:0000  Initial SS:SP   (Stack Start)  <****
  684.  005b63  002:1b63  Last byte in segment
  685.  
  686.  
  687.  
  688.   Related switch options: 
  689.  
  690.   -allrel  :  When this switch is specified, the report will show
  691.               all relocatable references made by the program, not
  692.               just the imports.  These non-import relocations are
  693.               things like far calls between segments within the program,
  694.               or inter-segment data access within the program. If the
  695.               -allrel switch is not specified the report will only 
  696.               show the import relocations.
  697.  
  698.   -undoc  :  This switch is not supported for the -sex command.
  699.  
  700.  
  701.  
  702. 4) -dat COMMAND:
  703. ----------------
  704.  
  705. This report gives you a way to verify that your EXPORTS.DAT
  706. ordinal-to-function-name translation database is being successfully
  707. read in, and that it contains no corrupted entries.  EXPORTS.DAT is
  708. just an ASCII text file.  Each line is either blank or has five ASCII
  709. fields separated by spaces.  Below are two lines from the EXPORTS.DAT
  710. file shown previously.
  711.  
  712.    DISPLAY    1 BITBLT               DLL/Driver   \win3\system\CGA.DRV
  713.    DISPLAY    2 COLORINFO            DLL/Driver   \win3\system\CGA.DRV
  714.  
  715. You can manipulate EXPORTS.DAT directly with an ASCII editor.  For
  716. example, you might want to manually add, change or delete some entries
  717. in it.
  718.  
  719. The -dat report contains two more fields that do not appear directly
  720. in EXPORTS.DAT.  These fields are shown in the report header below.
  721. The first added field is "Number of times defined".  For most exports
  722. this will be 1, but for some it will be greater than 1.  For example
  723. the video display device export, DISPLAY . 1 (BITBLT) was found in
  724. three separate driver files when the -exp command was used to create
  725. EXPORTS.DAT.  Hence, it appears three times in EXPORTS.DAT, once from
  726. each of these files:
  727.  
  728.    \win3\system\CGA.DRV
  729.    \win3\system\EGA.DRV
  730.    \win3\system\VGA.DRV
  731.  
  732.  
  733. The second additional field is labeled " * if documented".  This field 
  734. is discussed in the topic "WHICH EXPORTED FUNCTIONS ARE UNDOCUMENTED?"
  735. earlier in this readme file.
  736.  
  737. For example, the following command will create the report below.  In
  738. this example the exports.dat database only contains Windows related
  739. exports, but it could simultaneously hold OS/2 exports as well.
  740.  
  741.      sex -dat -headers \windev\include\*.*    
  742.  
  743. +----------------------------------------------------------------------------+
  744. |    List of all entries in ordinal-to-function-name translation database    |
  745. +----------------------------------------------------------------------------+
  746. | +-- Number of times defined                                                |
  747. | | +-- Module name                            +-- Application or DLL/Driver |
  748. | | |            +-- Ordinal                   |     +-- File of origin      |
  749. | | |            | +-- '*' If apparently documented  |                       |
  750. | | |            | | +-- Export name for this ordinal|                       |
  751. | | |            | | |                         |     |                       |
  752. |-v-v------------v-v-v-------------------------v-----v-----------------------|
  753.  
  754.  1 ATM      .   1   _DllInit                  DLL   \win3\system\ATM.DLL
  755.  1 ATM      .   2 * WEP                       DLL   \win3\system\ATM.DLL
  756.  1 ATM      .   3   ___ExportedStub           DLL   \win3\system\ATM.DLL
  757.  1 ATM      . 100   ATMXYSHOWTEXT             DLL   \win3\system\ATM.DLL
  758.  1 ATM      . 101   ATMGETOUTLINE             DLL   \win3\system\ATM.DLL
  759.  
  760.               (... some detail removed... ) 
  761.  
  762.  3 DISPLAY  .   1 * BITBLT                    DLL   \win3\system\CGA.DRV
  763.  3 DISPLAY  .   2   COLORINFO                 DLL   \win3\system\CGA.DRV
  764.  3 DISPLAY  .   3 * CONTROL                   DLL   \win3\system\CGA.DRV
  765.  3 DISPLAY  .   4   DISABLE                   DLL   \win3\system\CGA.DRV
  766.  3 DISPLAY  .   5 * ENABLE                    DLL   \win3\system\CGA.DRV
  767.  3 DISPLAY  .   6   ENUMDFONTS                DLL   \win3\system\CGA.DRV
  768.  
  769.               (... some detail removed... ) 
  770.  
  771.  2 GDI      .   1 * SETBKCOLOR                DLL   \win3\system\GDI.EXE
  772.  2 GDI      .   2 * SETBKMODE                 DLL   \win3\system\GDI.EXE
  773.  2 GDI      .   3 * SETMAPMODE                DLL   \win3\system\GDI.EXE
  774.  2 GDI      .   4 * SETROP2                   DLL   \win3\system\GDI.EXE
  775.  2 GDI      .   5   SETRELABS                 DLL   \win3\system\GDI.EXE
  776.  2 GDI      .   6 * SETPOLYFILLMODE           DLL   \win3\system\GDI.EXE
  777.  2 GDI      .   7 * SETSTRETCHBLTMODE         DLL   \win3\system\GDI.EXE
  778.  2 GDI      .   8 * SETTEXTCHARACTEREXTRA     DLL   \win3\system\GDI.EXE
  779.  
  780.               (... some detail removed... ) 
  781.  
  782.  6 KERNEL   . 163 * GLOBALLRUOLDEST           DLL   \win3\system\KERNEL.EXE
  783.  6 KERNEL   . 164 * GLOBALLRUNEWEST           DLL   \win3\system\KERNEL.EXE
  784.  6 KERNEL   . 165   A20PROC                   DLL   \win3\system\KERNEL.EXE
  785.  6 KERNEL   . 166 * WINEXEC                   DLL   \win3\system\KERNEL.EXE
  786.  6 KERNEL   . 167   GETEXPWINVER              DLL   \win3\system\KERNEL.EXE
  787.  6 KERNEL   . 168   DIRECTRESALLOC            DLL   \win3\system\KERNEL.EXE
  788.  6 KERNEL   . 169 * GETFREESPACE              DLL   \win3\system\KERNEL.EXE
  789.  6 KERNEL   . 170   ALLOCCSTODSALIAS          DLL   \win3\system\KERNEL.EXE
  790.  
  791.               (... rest of report cut off... ) 
  792.  
  793.  
  794.  
  795. RLIB.EXE:
  796. ---------
  797.  
  798. This separate program reads *.LIB files and displays any import
  799. library records it finds there.  These can then be added to the
  800. ordinal-to-export-function-name translation database, exports.dat. 
  801. You really only need this program to get the translation information
  802. for the DOSCALLS functions in the OS/2 kernel.  Since there are no
  803. explicit exports from the OS/2 kernel that we can read with the -exp
  804. command, we have to use RLIB to get them instead, from os2.lib.
  805.  
  806. Use RLIB.EXE like this: 
  807.  
  808.   RLIB  \pmsdk12\lib\os2.lib > os2lib.dat.
  809.  
  810. Then append os2lib.dat to any other *.DAT files you have generated
  811. to make the overall database file exports.dat.
  812.  
  813. The generated ASCII file os2lib.dat should end up being about 83K.
  814. Only about 15K of that 83K are the 208 DOSCALLS entry points that we
  815. are really interested in, such as those shown below.
  816.  
  817.   DOSCALLS   1 DOSICREATETHREAD         DLL-from-LIB  \pmsdk12\lib\os2.lib
  818.    ...
  819.   DOSCALLS 208 DOSFREERESOURCE          DLL-from-LIB  \pmsdk12\lib\os2.lib
  820.  
  821. The rest are from modules like: KBDCALLS, VIOCALLS, PMWIN, PMGPI,
  822. HELPMGR.  We will already be picking up explicit exports for these
  823. entry points by reading the corresponding DLLs directly with the -exp
  824. command.  To save disk space you could chop these duplicate entries
  825. out.  This would reduce the size of exports.dat by 83-15K = 68K.
  826.  
  827. There may be other duplications that can be weeded out of your
  828. exports.dat with an editor, if disk space is tight.  For example, the
  829. GDI functions will appear twice in exports.dat if you have both
  830. GDI.EXE and GDIN.EXE in \windows\system and have used
  831. \windows\system\*.* with the -exp command when building exports.dat.
  832.  
  833.  
  834.  
  835. **********************************************************************
  836.  
  837. KNOWN PROBLEMS / CAVEATS:
  838. -------------------------
  839.  
  840. DIFFERENCES WITH MY PAPER DELIVERED AT SOFTWARE DEVELOPMENT '91:
  841. ----------------------------------------------------------------
  842. My paper, whose abstract is shown below, used an older version of SEX
  843. whose reports used a field titled "undocumented", for exports and
  844. imports.  Today that field has been changed to the inverse.  That is,
  845. now it is set to '*' for "documented" exports and imports.
  846.  
  847.  
  848. ONLY RUNS ON OS/2 CURRENTLY:
  849. ----------------------------
  850. These SEX tools should be of as much interest to Windows programmers
  851. as to OS/2 programmers.  Unfortuately they only run under OS/2 at
  852. this time.  I have written it using, and tested it with, OS/2 1.2.  If
  853. you have problems running it, let me know.  A Windows version is on
  854. my agenda.
  855.  
  856.  
  857. BETA LEVEL PRODUCT:
  858. -------------------
  859. I've done a fair amount of testing to SEX, but you may find some
  860. bugs.  Please let me know about them.  Also tell me what you think of
  861. the product in general.
  862.  
  863.  
  864. USES A LOT OF MEMORY:
  865. ---------------------
  866. You'll need upwards of 1MB free memory in order to run the program.
  867. If you use wild cards to process multiple files or directories the
  868. memory requirements will increase.  If you've got 2MB free memory you
  869. should be able to do just about anything.  (I've got a 9MB system).
  870. This is memory hungry OOP technology folks!
  871.  
  872.  
  873. FILES SEX DOESN'T WORK ON:
  874. --------------------------
  875.  
  876. There are at least two types of files that SEX does not currently
  877. work on.  Firstly, some Windows programs use a method of COMPRESSING
  878. THEIR RELOCATION RECORDS which is undocumented.  EXEHDR itself can not
  879. show them either.  Both SEX and EXEHDR will give a warning when they
  880. encounter one of these files.
  881.  
  882.   SEX'S WARNING:     Yipes! Probable compressed relocations records!!
  883.                       Quitting.
  884.   EXEHDR'S WARNING:  Error U1108: Cannot display compressed relocation
  885.                       records.
  886.  
  887. Secondly there are some EXE files like Windows 3.0's WINDEBUG.386
  888. that SEX can not currently read.  Apparently they are in the same
  889. page based, rather than segment based, linear exe format used by 32
  890. bit flat model OS/2 2.0.  EXEHDR itself _can_ do a report for these
  891. files.  The EXEHDR flat model report looks a lot different from the
  892. conventional one it generates for 16 bit OS/2 and Windows files.
  893.  
  894.  
  895. YOU'LL STILL NEED EXEHDR:
  896. -------------------------
  897. SEX compliments EXEHDR rather than replacing it.  SEX does not try to
  898. show the full detail of the headers, since EXEHDR already does a good
  899. job of that.
  900.  
  901.  
  902.  
  903. ****************************************************************************
  904.  
  905. ABSTRACT OF PAPER/BOOK:
  906. -----------------------
  907. This paper discusses some of the tools, techniques, motivations and
  908. legal/technical limits to reverse engineering Windows and OS/2
  909. software.  Reverse engineering is often the only way to obtain
  910. critical information about new, complex or undocumented features of
  911. operating systems and programs.  This paper will discuss how to
  912. disassemble and analyze the operation of EXE, DLL and SYS files for 
  913. Windows and OS/2.  This paper will answer the questions:  Why
  914. disassemble?  How difficult is it?  Examples will be presented
  915. including the relevant legal and ethical limits.  What is the layout
  916. of the segmented executable file?  How do you read and interpret its
  917. internal tables?  How do you decompile from ASM back to C?
  918.  
  919.  
  920. TABLE OF CONTENTS FOR PAPER/BOOK:
  921. ---------------------------------
  922.  
  923. 1.     What is Reverse Engineering?                            1-1
  924. 1.1.     General Definition:                                   1-1
  925. 1.2.     Applied to Windows and OS/2 Software:                 1-1
  926. 1.2.1.     Static disassembly of programs:                     1-1
  927. 1.2.2.     Runtime analysis of programs:                       1-2
  928. 1.2.3.     Decoding of file formats:                           1-2
  929.  
  930. 2.     Reverse Engineering:  Why and Why Not?                  2-1
  931. 2.1.     Why?                                                  2-1
  932. 2.1.1.     Getting Information:                                2-1
  933. 2.1.2.     Patching - Making Modifications:                    2-1
  934. 2.2.     Why NOT?                                              2-2
  935. 2.3.     Legal, Moral and Philosophical Questions:             2-2
  936.  
  937. 3.     Law of Reverse Engineering and Patching Software        3-1
  938. 3.1.     Introduction:                                         3-1
  939. 3.1.1.     The Anti-Reverse Engineering Camp:                  3-2
  940. 3.1.2.     The Pro-Reverse Engineering Camp:                   3-2
  941. 3.1.3.     Does It Matter Who is Right?                        3-2
  942. 3.2.     The Context of General Intellectual Property Law:     3-2
  943. 3.2.1.     Patent Law:                                         3-2
  944. 3.2.2.     Trade Secret Law:                                   3-2
  945. 3.2.3.     Copyright Law:                                      3-3
  946. 3.2.3.1.     Reverse Engineering as a Violation of Copyright:  3-3
  947. 3.2.3.2.     Counter Arguments:                                3-4
  948. 3.2.4.     Semiconductor Chip Protection Act:  What is its Significance?        3-4
  949. 3.3.     Diagram:  Legal and Illegal Sources of Information:   3-4
  950. 3.4.     The Shrink Wrap License Issue:                        3-7
  951. 3.5.     The Law of Software Patching:                         3-7
  952. 3.6.     Two Scales of Legal Risk:                             3-8
  953. 3.6.1.     What Can Be Safely Reverse-Engineered?  The Scale of Purpose:        3-8
  954. 3.6.2.     What Can Be Safely Imitated?  The Scale of Idea Versus Expression:   3-9
  955. 3.7.     How to Stay Within the Law:                           3-10
  956. 3.7.1.     Get a Good Attorney that Knows Reverse Engineering Law:  3-10
  957. 3.7.2.     Keep a Written Statement of Goals and Sources:      3-10
  958. 3.7.3.     Don't Sign Anything:                                3-10
  959. 3.7.4.     Buy from a Mass Market Retailer:                    3-11
  960. 3.7.5.     Avoid Improper Sources:                             3-11
  961. 3.7.6.     Clean Room:                                         3-11
  962. 3.7.7.     Avoid Unnecessary Similarity:                       3-11
  963. 3.8.     References:                                           3-12
  964.  
  965. 4.     Technical Basics                                        4-1
  966. 4.1.     The Simple COM File:                                  4-1
  967. 4.2.     The Simple Old Exe File:                              4-1
  968. 4.3.     The Segmented Exe File:                               4-2
  969. 4.4.     The Linear Executable EXE File Format:  32 Bit Flat Model:  4-6
  970. 4.5.     A Network of Segmented Exe Files:                     4-10
  971. 4.6.     Differences Between Windows and OS/2 EXE Formats:     4-13
  972. 4.7.     For More Information:                                 4-13
  973. 4.8.     Advantages and Disadvantages of the New Executable
  974.            in Terms of Reverse Engineering:                    4-14
  975.  
  976. 5.     Tools of the Trade                                      5-1
  977. 5.1.     Introduction:                                         5-1
  978. 5.2.     Debuggers / Disassemblers:                            5-1
  979. 5.2.1.     Windows:                                            5-1
  980. 5.2.2.     OS/2:                                               5-1
  981. 5.3.     EXEHDR:  Segmented EXE Analysis:                      5-1
  982. 5.4.     SEX:  Super Exe Header.  An Enhanced Viewer of Segmented EXE Files:    5-3
  983. 5.4.1.     Summary of Imports:                                 5-3
  984. 5.4.2.     List of Exports for Multiple Files:                 5-4
  985. 5.4.3.     Exhaustive List of All Imports and Relocations in a File:    5-4
  986. 5.5.     GDT:  A Descriptor Table Viewer and Disassembler:     5-5
  987. 5.6.     THESEUS:  An OS/2 Memory Use Tool:                    5-5
  988. 5.7.     DENTIST:  An OS/2 Resource Decompiler/Extractor:      5-5
  989. 5.8.     Zortech's OBJTOASM                                    5-6
  990.  
  991. 6.     File Format Decoding                                    6-1
  992. 6.1.     Introduction:                                         6-1
  993. 6.2.     General Analysis Techniques:                          6-1
  994. 6.2.1.     Creating a Hex Dump:                                6-1
  995. 6.2.2.     Looking for patterns:                               6-2
  996. 6.2.2.1.     The Fundamental Particles:                        6-2
  997. 6.2.2.1.1.     The ASCII String:                               6-2
  998. 6.2.2.1.2.     The Byte, Word and Long Word:                   6-2
  999. 6.2.3.     From the Obvious to the More Complex:               6-2
  1000. 6.2.4.     The Cycle: Alter and Test...                        6-3
  1001. 6.2.5.     Making an Intelligent Dump Program:                 6-3
  1002. 6.3.     Example: Decoding the Codeview Format for EXE Files:  6-3
  1003. 6.3.1.     Where is the Codeview Information?                  6-3
  1004.  
  1005. 7.     Sources of Information (Bibliography)                   7-1
  1006. 7.1.     Microsoft "Open Tools Strategy":                      7-1
  1007. 7.1.1.     Microsoft C "Developer's Toolkit Reference":        7-1
  1008. 7.1.1.1.     Introduction:                                     7-1
  1009. 7.1.1.2.     Part 1 in Detail.  File Formats for EXE, OBJ, LIB, ILK, 
  1010.               SYM Files:                                       7-2
  1011. 7.1.1.2.1.     Chapter 1:  Object Module Format for Symbolic 
  1012.                 Debugging:                                     7-2
  1013. 7.1.1.2.2.     Chapter 2:  Object Module Format Extensions:    7-2
  1014. 7.1.1.2.3.     Chapter 3:  Extended .EXE Format for Debug 
  1015.                 Information:                                   7-2
  1016. 7.1.1.2.4.     Chapter 4:  .ILK and .SYM Binary File 
  1017.                 Formats:                                       7-2
  1018. 7.1.1.2.5.     Chapter 5:  Library Format:                     7-2
  1019. 7.1.2.     Microsoft "Windows Developer's Notes":              7-3
  1020. 7.1.2.1.     Developing Network Applications for Windows 3.0:  7-3
  1021. 7.1.2.2.     Executable-File Header Format:                    7-3
  1022. 7.1.2.3.     Font-File Format:                                 7-3
  1023. 7.1.2.4.     Setup Sources:                                    7-3
  1024. 7.1.2.5.     Windows Accessories Binary File Formats:          7-3
  1025. 7.1.2.5.1.     Windows Write Binary File Format:               7-3
  1026. 7.1.2.5.2.     Windows Calendar File Format:                   7-4
  1027. 7.1.2.6.     Windows INT 21H and NetBIOS Support for DPMI:     7-4
  1028. 7.1.2.7.     Writing International Applications for
  1029.               Windows 3.0:                                     7-4
  1030. 7.1.2.8.     Topics Not Yet Covered:                           7-4
  1031. 7.2.     Microsoft Windows Device Development Kit:             7-4
  1032. 7.3.     More Books and Articles:                              7-4
  1033. 7.3.1.     Books:                                              7-4
  1034. 7.3.1.1.     "Undocumented DOS", 1990.  Chief editor: Andrew 
  1035.               Schulman:                                        7-4
  1036.  
  1037. 8.     Raw Disassembly of ICON.EXE with Symdeb and Preliminary Commenting       8-1
  1038. 8.1.     Introduction:                                         8-1
  1039. 8.2.     Raw Disassembly:                                      8-1
  1040. 8.3.     Disassembly of ICON.EXE with Preliminary Commenting
  1041.           Added:                                               8-3
  1042.  
  1043. 9.     Correlating the Reports of Super-Exe-Header, the Application's MAP
  1044.           File, and Disassembly of Portions of the Runtime
  1045.           Library                                              9-1
  1046. 9.1.     Introduction:                                         9-1
  1047. 9.2.     Super Exe Header Report:                              9-1
  1048. 9.3.     Application Linker Map File:                          9-2
  1049. 9.4.     Combining Linker Map File and Super-Exe-Header
  1050.           Reports:                                             9-3
  1051. 9.5.     Disassembly of C Runtime Library Winstart OBJ Module: 9-4
  1052.  
  1053. 10.     Runtime Analysis of Example Program                    10-1
  1054. 10.1.     Introduction:                                        10-1
  1055. 10.2.     Setting Up The Debugger:                             10-1
  1056. 10.3.     The Application Calls Windows:                       10-1
  1057. 10.3.1.     API Prototype from Programmer's Reference:         10-1
  1058. 10.3.2.     Application's C Source Code for Call:              10-2
  1059. 10.4.     Inside the Windows Kernel:                           10-2
  1060. 10.4.1.     EXEHDR's List of the Kernel's Exports:             10-2
  1061.  
  1062. 11.     Sample Program ICON.C in Original C Source and
  1063.          Mixed Source and Object Form                          11-1
  1064. 11.1.     In Original C Source:                                11-1
  1065. 11.2.     In Mixed Source and Object Form:                     11-3
  1066.  
  1067. 12.     Documented and Undocumented Exports from Windows 3.0 USER.EXE, 
  1068.           KERNEL.EXE and GDI.EXE                               12-1
  1069. 12.1.     Introduction:                                        12-1
  1070. 12.2.     Summary of Export "Undocumentedness":                12-1
  1071. 12.3.     Exports from USER.EXE:                               12-2
  1072. 12.4.     Exports From KERNEL.EXE                              12-8
  1073. 12.5.     Exports From GDI.EXE:                                12-11
  1074. 12.6.     Comparing What is Defined in SDK vs. DDK:            12-15
  1075.  
  1076. 13.     Undocumented Imports to Windows 3.0 Applications       13-1
  1077. 13.1.     Introduction:                                        13-1
  1078. 13.2.     TASKMAN.EXE:                                         13-2
  1079. 13.3.     MSDOS.EXE:                                           13-2
  1080. 13.4.     PROGMAN.EXE:                                         13-3
  1081. 13.5.     WINFILE.EXE:                                         13-3
  1082. 13.6.     CONTROL.EXE:                                         13-4
  1083.  
  1084.  
  1085.