home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lx2v103.zip / LX2Dump.h < prev    next >
C/C++ Source or Header  |  2000-02-17  |  5KB  |  119 lines

  1. #ifndef __LX2DUMP_H__
  2. #define __LX2DUMP_H__
  3.  
  4. /***********************************************************************\
  5.  *                              LX2Dump.c                              *
  6.  *                 Copyright (C) by Stangl Roman, 1999                 *
  7.  * This Code may be freely distributed, provided the Copyright isn't   *
  8.  * removed, under the conditions indicated in the documentation.       *
  9.  *                                                                     *
  10.  * LX2Dump.h    Linear eXecutable Dump Facility/2 header file          *
  11.  *                                                                     *
  12. \***********************************************************************/
  13.  
  14. #pragma strings(readonly)
  15.  
  16.                                         /* BLDLEVEL information (in C source modules added via macro
  17.                                            concatenation) for BuildLevel.cmd to generate BLDLEVEL information.
  18.                                            Version and Signature should correspond (at least for a GA build) */
  19. #define BLDLEVEL_VENDOR         "(C) Roman_Stangl@at.ibm.com"
  20. #define BLDLEVEL_VERSION        "1.03 (02,2000)"
  21. #define BLDLEVEL_SIGNATURE      0x00010003
  22. #define BLDLEVEL_RELEASE        ((((BLDLEVEL_SIGNATURE & 0xFFFF0000)>>16)*100)+(BLDLEVEL_SIGNATURE & 0x000000FF))
  23. #define BLDLEVEL_INFO           "LX/2 - Linear eXecutable Dump Facility/2"
  24. #define BLDLEVEL_PRODUCT        "LX/2"
  25.  
  26. typedef unsigned long   DWORD;
  27.  
  28. #include    <os2.h>
  29. #include    <newexe.h>
  30. #include    <exe.h>
  31. #define     SMP
  32. #define     FOR_EXEHDR  1
  33. #include    <exe386.h>
  34.  
  35. #include    <malloc.h>
  36. #include    <memory.h>
  37. #include    <stdio.h>
  38. #include    <string.h>
  39.  
  40. #pragma pack(1)
  41.                                         /* Structure for Resident and Non-Resident Name
  42.                                            Table entries */
  43. struct  res_nonres_table
  44. {
  45.     unsigned char           bLen;       /* Length of acName or 0 */
  46.     char                    acName[1];  /* Name of length bLen */
  47.     unsigned short          usOrd;      /* Ordinal at acSymbol[bLen] */
  48. };
  49.  
  50. struct  nonres_exports
  51. {
  52.     unsigned char           bLen;
  53.     char                    acExport[1];
  54.     unsigned short          us_ord;
  55. };
  56.  
  57.                                         /* Import Module/Procedure Name Table */
  58. struct  impname_table
  59. {
  60.     unsigned char           bLen;
  61.     char                    acName[1];
  62. };
  63.  
  64.                                         /* Fixup Record */
  65. struct r32_fixup
  66. {
  67.     unsigned char           nr_stype;   /* Source type */
  68.     unsigned char           nr_flags;   /* Flag byte */
  69.                                         /* Source offset/count */
  70.     short                   r32_soff_cnt; 
  71.     union targettype
  72.     {
  73.         unsigned short      int_obj;    /* Object index in Object Table */
  74.         unsigned short      mod;        /* Module index in Import Name Table */
  75.         unsigned short      ord;        /* Ordinal index in Module Entry Table */
  76.     }                       r32_type;
  77.     union targefixup
  78.     {
  79.                                         /* Internal fixup */
  80.         struct intfixup
  81.         {
  82.             unsigned long   toff;       /* Target Offset (optional) */
  83.         }                   intref;
  84.                                         /* Import by ordinal */
  85.         struct impbyord
  86.         {
  87.             unsigned long   ord;        /* Ordinal number */
  88.             unsigned long   add;        /* Additive (optional) */
  89.  
  90.         }                   impord;
  91.                                         /* Import by name */
  92.         struct impbyname
  93.         {
  94.             unsigned long   proc;       /* Procedure name offset in Import Procedure Name Table */
  95.             unsigned long   add;        /* Additive (optional) */
  96.         }                   impname;
  97.         struct  intentryrecord
  98.         {
  99.             unsigned long   add;        /* Additive (optional) */
  100.         }                   intentry;
  101.     }                       r32_target; 
  102.     unsigned short          soff[1];    /* Source Offset(s) (optional) */
  103. };
  104.  
  105. int GetExportFromOrdinal(struct b32_bundle **ppB32Bundle, struct e32_entry **ppE32Entry, 
  106.     struct e32_exe *pE32Exe, struct exe_hdr *pExeHdr, int iOrdinalSearch);
  107. int DumpHeader(struct e32_exe *pE32Exe, struct exe_hdr *pExeHdr);
  108. int DumpObjectTable(struct e32_exe *pE32Exe, struct exe_hdr *pExeHdr, ULONG bDumpPages);
  109. int DumpResourceTable(struct e32_exe *pE32Exe, struct exe_hdr *pExeHdr);
  110. int DumpImportModulesTable(struct e32_exe *pE32Exe, struct exe_hdr *pExeHdr);
  111. int DumpImportProceduresTable(struct e32_exe *pE32Exe, struct exe_hdr *pExeHdr);
  112. int DumpResidentNameTable(struct e32_exe *pE32Exe, struct exe_hdr *pExeHdr);
  113. int DumpNonResidentNameTable(struct e32_exe *pE32Exe, struct exe_hdr *pExeHdr);
  114. int DumpEntryTable(struct e32_exe *pE32Exe, struct exe_hdr *pExeHdr);
  115. int DumpFixupPageTable(struct e32_exe *pE32Exe, struct exe_hdr *pExeHdr);
  116. int DumpFixupRecordTable(struct e32_exe *pE32Exe, struct exe_hdr *pExeHdr);
  117.  
  118. #endif  /* __LX2DUMP_H__ */
  119.