home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / CVTICONS.ZIP / NEWEXE.H < prev    next >
Text File  |  1990-11-01  |  9KB  |  254 lines

  1. #define DOS            1
  2. #define WIN            2
  3. #define ICO            3
  4.  
  5. #define RS_CURSOR        1
  6. #define RS_BITMAP        2
  7. #define RS_ICON            3
  8. #define RS_MENU            4
  9. #define RS_DIALOG        5
  10. #define RS_STRING        6
  11. #define RS_FONTDIR        7
  12. #define RS_FONT            8
  13. #define RS_ACCELERATOR        9
  14. #define RS_RESDATA        0xA
  15. #define RS_ICONDIR        0xE
  16. #define RS_RESNAMES         0xF
  17.  
  18. #define CODE_DATA            0x0007
  19. #define ITERATION            0x0008
  20. #define MOVE_FIX            0x0010
  21. #define PURITY                0x0020
  22. #define LOADING             0x0040
  23. #define READ_WRITE_PRIV            0x0080
  24. #define RELOCATIONS            0x0100
  25. #define CONFORMITY            0x2000
  26. #define PRIVLEGES            0xC000
  27. #define DISCARDABLE            0x1000
  28. #define CODESEG             0x2000
  29. #define SIZESEG             0x4000
  30.  
  31. #define DGROUP                0x0002
  32. #define INIT                0x0007
  33. #define OPMODE                0x0008
  34. #define ONLY8086            0x0010
  35. #define HAS286                0x0020
  36. #define HAS386                0x0040
  37. #define HASFLOAT            0x0080
  38. #define APPTYPE             0x0700
  39. #define FAMILYAPP            0x0800
  40. #define VALID                0x2000
  41. #define APP_DLL             0x8000
  42.  
  43. #define RC_RSRVD1            0x000F
  44. #define RC_FIX_MOV            0x0010
  45. #define RC_PURITY            0x0020
  46. #define RC_LOADING            0x0040
  47. #define RC_RSRVD2            0x0F80
  48. #define RC_DISCARD            0xF000
  49.  
  50. #define SEG_MOVABLE            0xFF
  51. #define SEG_EXPORT            0x01
  52. #define SEG_DATA            0x02
  53. #define SEG_PARMS            0xF8
  54.  
  55. typedef struct tagOLDEXEHDR
  56. {
  57.   BYTE    bySigByte1,    /* Signature byte 1 'M'                    */
  58.     bySigByte2;    /* Signature byte 2 'Z'                             */
  59.   WORD    wModFilLen,    /* Length of file header and program image MOD 512  */
  60.     wPagFilLen,    /* Number of 512-byte pages of header and prog image*/
  61.     wRelocItems,    /* Number of relocation table items for MS-DOS stub */
  62.     wHeaderSize,    /* size of old EXE header in 16-byte paragraphs     */
  63.     wMinMem,    /* Minimum # of paragraphs of mem needed to run stub*/
  64.     wMaxMem,    /* Maximum # of paragraphs of mem needed to run stub*/
  65.     wWinStubSS,    /* Segement displacement of stub program stack      */
  66.     wWinStubSP,    /* Contents of SP register in stub program entry    */
  67.     wWinStubCRC,    /* Checksum of stub program                         */
  68.     wWinStubIP,    /* Contents of IP register at stub program entry    */
  69.     wWinStubCS,    /* Segment displacement of stub program code        */
  70.     wRelocOfs,    /* 0040h if NEWEXE, offset to first stub prog reloc */
  71.     wOverlayNbr,    /* Overlay number '0'                               */
  72.     wMemoryNeeded,  /*                            */
  73.     wReserved1[3],
  74.     wOEMId,     /* OEM Identifier                                   */
  75.     wOEMInfo,    /* OEM information                                  */
  76.     wReserved2[10];
  77.   DWORD    dwNewExeOfs;    /* File offset of new EXE Header                    */
  78.  } OLDEXEHDR;
  79.  
  80. typedef struct tagNEWEXEHDR
  81. {
  82.   BYTE    bySigByte1,    /* Signature byte 1 'N'                             */
  83.     bySigByte2,    /* Signature byte 2 'E'                             */
  84.     byLinkMajVer,    /* Linker major version number                      */
  85.     byLinkMinVer;    /* Linker minor version number                      */
  86.   WORD    wEntryOfs,    /* Offset of entry table relative to start of new ex*/
  87.     wEntrySize;    /* Length of entry table                            */
  88.   DWORD dwFileLoadCRC;    /* 32-bit Checksum of entire file                   */
  89.   WORD    wModuleFlags,    /* Module Flags                                     */
  90.     wAutoDataSeg,    /* Segment Number of DGROUP                         */
  91.     wHeap,        /* Initial Heap Size                                */
  92.     wStack,        /* Initial Stack Size                               */
  93.     wProgIP,    /* Contents of IP register at program entry         */
  94.     wProgCS,    /* Segment number containing entry point            */
  95.     wProgSP,    /* Contents of SP register at program entry         */
  96.     wProgSS,    /* Segment number containg stack                    */
  97.     wSegEntries,    /* Entries in segment table                         */
  98.     wResNameSize,    /* Entries in module reference table                */
  99.     wNonResNameSize,/* Length of NonResident names table                */
  100.     wSegOfs,    /* Offset of Segment Table relative to new EXE hdr  */
  101.     wResourceOfs,    /* Offset of Resource Table relative to new EXE hdr */
  102.     wResidentOfs,    /* Offset of Resident Names Table rel to new EXE hdr*/
  103.     wModuleOfs,    /* Offset of Module refernce table rel to new EXE hd*/
  104.     wImportNameOfs; /* Offset of Imported names table rel to new EXE hdr*/
  105.   DWORD dwNonResNameOfs;/* Offset of NonResident names table rel start of fi*/
  106.   WORD    wMoveEntryPtCnt,/* Number of moveable entry points                  */
  107.     wLogSectorAlign,/* Size of file alignment unit (power of 2)         */
  108.     wResourceSegs;    /* Number of resource table entries           */
  109.   BYTE    byTargetSystem,    /*  Target operating
  110.                   0: UnKnown       1: OS/2
  111.                   2: Windows       3: MS-DOS 4
  112.             */
  113.     byBytesLeft;    /* Number of Bytes that are valid in rsrvd following*/
  114.   WORD    wReserved[4];
  115. } NEWEXEHDR;
  116. /*********************** Module Flags Bit Significance **********************
  117.   Bit(s)        Significance
  118.   0 - 1         DGROUP characteristics
  119.                 0 : no DGROUP
  120.                 1 : single DGROUP (shared)
  121.                 2 : multiple DGROUPs (unshared)
  122.   2            0 : Global Initilization (DLLs)
  123.             1 : Instance Initilization
  124.   3            0 : Real or Protected Mode
  125.             1 : Protected Mode Only
  126.   4            1 : Only contains 8086 instructions
  127.   5            1 : contains 80286 instructions
  128.   6            1 : contains 80386 instructions
  129.   7            1 : contains floating-point instructions
  130.   8 - 10        Application type
  131.                 0 : UnKnown
  132.                 1 : Full Screen
  133.                 2 : Vio App, can run in a window
  134.                 3 : Presntation Manager / Windows
  135.   11            0 : Not a Family Application
  136.             1 : Family Application
  137.   12            RESERVED
  138.   13            0 : File is executable
  139.             1 : invalid load module (errors in linking)
  140.   14            RESERVED
  141.   15            0 : Application
  142.             1 : DLL or Driver
  143. ****************************************************************************/
  144. typedef struct tagSEGTABLE
  145. {
  146.   WORD wSectorOfs,    /* Offset of beginning of segment within file
  147.                 Expressed as multiple of file unit size        */
  148.        wSegmentLen,    /* Length of segment ( 0 = 65,536 )                */
  149.        wSegFlags,    /* Segment Flags
  150.                 Bit(s)    Significance
  151.                 0 - 2    Segment Type
  152.                         0 : Code
  153.                         1 : Data
  154.                 3        0 : Noniterated Data
  155.                     1 : Iterated Data
  156.                 4        0 : Fixed
  157.                     1 : Moveable
  158.                 5        0 : Impure or Nonshareable
  159.                     1 : Pure or Shareable
  160.                 6        0 : Load-on-Call
  161.                     1 : Preload
  162.                 7        0 : Execute/read if code, r/w if data
  163.                     1 : Execute-only if code, read if data
  164.                 8        0 : No relocation table
  165.                     1 : Relocation table present
  166.                 9        0 : Nonconforming
  167.                     1 : Conforming
  168.                 10 - 11    Privilege level
  169.                 12        0 : Nondiscardable
  170.                     1 : discardable
  171.                 13        0 : 16-bit code segment
  172.                     1 : 32-bit code segment
  173.                 14        0 : normal segment
  174.                     1 : huge segment
  175.                 15        RESERVED
  176.             */
  177.        wAllocSize;    /* Minimum allocation size for segment (0 = 65,536 )*/
  178. } SEGTABLE;
  179.  
  180. typedef struct tagRSRCTBL
  181. {
  182.   WORD wShiftCount,    /* power of 2 which determines resource unit size   */
  183.        wType,        /* Resource Type                                    */
  184.        wFollowing,    /* Number of Resources follwing                     */
  185.        wReserved;
  186. } RSRCTBL;
  187. /**********************     Resource Types    ******************************
  188.     1    --  Cursor
  189.     2    --  Bitmap
  190.     3    --  Icon
  191.     4       --  Menu
  192.     5    --  Dialog
  193.     6    --  String
  194.     7    --  Font Dir
  195.     8    --  Font
  196.     9    --  Accelerator
  197.     A    --  Resource Data
  198.     B       --
  199.     C    --
  200.     D    --
  201.     E    -- ICO file header / directory entry
  202.     F    -- Resource Name
  203. ****************************************************************************/
  204.  
  205. typedef struct tagRSRCENTRY
  206. {
  207.   WORD  wReserved1,
  208.     wOffset,    /* Offset to resource from start of file           */
  209.     wLength,    /* Length of resource                       */
  210.     wRsrcFlags, /* Resource flags
  211.             Bit(s)        Significance
  212.             0 - 3        RESERVED
  213.             4        0 : Fixed
  214.                     1 : Moveable
  215.             5        0 : Impure or Nonshareable
  216.                     1 : Pure or Shareable
  217.             6        0 : Load-on-Call
  218.                     1 : Preload
  219.             7  - 11        RESERVED
  220.             12 - 15     Discard Priority
  221.              */
  222.     wRsrcNum,   /* Resource Number if bit 15 set offset to string      */
  223.     wReserved2;
  224. } RSRCENTRY;
  225. typedef RSRCENTRY     *PRSRCENTRY;
  226. typedef RSRCENTRY far *LPRSRCENTRY;
  227.  
  228. typedef struct tagMOVSEG
  229. {
  230.   BYTE byEntryFlags;    /*  Bit(s)     Significancs
  231.                 0          0 : Entry point not exported
  232.                        1 : Entry point Exported
  233.                 1          0 : Entry Point uses Instance data
  234.                        1 : Entry Point uses Single data
  235.                 2          RESERVED
  236.                 3 - 7      Number of stack parameter words
  237.             */
  238.   WORD w3FIns;          /*  Int 3FH instruction (CDH 3FH)       */
  239.   BYTE bySegNbr;        /*  Segment number of entry point       */
  240.   WORD wSegOfs;        /* Offset of entry point within segment */
  241. } MOVSEG;
  242.  
  243. typedef struct tagFIXSEG
  244. {
  245.   BYTE byEntryFlags;  /* Entry point flags same as above      */
  246.   WORD wSegOfs;          /* Offset of entry point within segment */
  247. } FIXSEG;
  248.  
  249. typedef struct tagRESNAMES
  250. {
  251.   WORD wLen,
  252.        wType;
  253. } RESNAMES;
  254. typedef RESNAMES *PRESNAMES;