home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l430 / 1.ddi / CHAP5.ZIP / MODTABLE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-11  |  4.2 KB  |  143 lines

  1. /* 
  2. MODTABLE.H -- Module table and related structures
  3.  
  4. from "Undocumented Windows" by Schulman et al. (Addison-Wesley, 1992)
  5. Chapter 5: KERNEL
  6.  
  7. Copyright (c) Andrew Schulman and Matt Pietrek 1992
  8. */
  9.  
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13.  
  14. typedef struct
  15. {
  16.     int    segment_type  : 1;  /* Segment type identification  */
  17.     int    unknown       : 2;  /* used by Windows for something*/
  18.     int    iterated      : 1;  /* Segment is iterated          */
  19.     int    movable       : 1;  /* Segment is movable           */
  20.     int    pure          : 1;  /* Segment is sharable          */
  21.     int    preload       : 1;  /* Segment is preload           */
  22.     int    read_only     : 1;  /* Segment is read-only         */
  23.     int    reloc_info    : 1;  /* Segment has reloc info       */
  24.     int    u1            : 3;
  25.     int    discardable   : 1;  /* Discardable flag.            */
  26.     int    u2            : 3;
  27. } SEG_BITFIELD_FLAGS;
  28.  
  29. typedef struct
  30. {
  31.     WORD    sector_offset;      /* Offset to logical sector     */
  32.     WORD    segment_length;     /* Size in bytes of segment     */
  33.     SEG_BITFIELD_FLAGS  flags;  /* flags for segment            */
  34.     WORD    alloc_size;         /* Segment allocation size      */
  35.     WORD    handle;
  36. } MODULE_TABLE_SEGMENT_RECORD;
  37.  
  38. typedef enum
  39. {                           /* Segment type constants   */
  40.   CODE      = 0x0000,       /* Code segment type        */
  41.   DATA      = 0x0001,       /* Data segment type        */
  42. } SEGMENT_TYPES;
  43.  
  44. typedef struct
  45. {
  46.    WORD     ne_signature;
  47.    WORD     ne_usage;
  48.    WORD     ne_penttable;
  49.    WORD     ne_pnextexe;
  50.    WORD     ne_pautodata;
  51.    WORD     ne_pfileinfo;
  52.    WORD     ne_flags;
  53.    WORD     ne_autodata;
  54.    WORD     ne_heap;
  55.    WORD     ne_stack;
  56.    DWORD    ne_csip;
  57.    DWORD    ne_sssp;
  58.    WORD     ne_cseg;
  59.    WORD     ne_cmod;
  60.    WORD     ne_cbnrestab;
  61.    WORD     ne_segtab;
  62.    WORD     ne_rsrctab;
  63.    WORD     ne_restab;
  64.    WORD     ne_modtab;
  65.    WORD     ne_imptab;
  66.    DWORD    ne_nrestab;
  67.    WORD     ne_cmovent;
  68.    WORD     ne_align;
  69.    WORD     ne_cres;
  70.    unsigned char ne_exetyp;
  71.    unsigned char ne_flagsother;
  72.    union
  73.    {
  74.       WORD ne_pretthunks;   /* offset to return thunks      */
  75.       WORD ne_gang_start;   /* start of gangload area       */
  76.    } x;
  77.    union
  78.    { 
  79.       WORD ne_psegrefbytes; /* offset to segment ref. bytes */
  80.       WORD ne_gang_length;  /* length of gangload area      */
  81.    } y;
  82.    WORD ne_swaparea;        /* minimum code swap area size  */
  83.    WORD ne_expver;          /* expected windows version num */
  84. } MODULE_TABLE;
  85.  
  86. typedef struct _BUNDLE_HEADER
  87. {
  88.     WORD    firstEntry;
  89.     WORD    lastEntry;
  90.     WORD    nextBundle;
  91. } BUNDLE_HEADER;
  92.  
  93. typedef struct _ENTRY
  94. {
  95.     BYTE    segType;
  96.     BYTE    flags;
  97.     BYTE    segNumber;
  98.     WORD    offset;
  99. } ENTRY;
  100.  
  101. typedef struct _RESOURCETYPE
  102. {
  103.     WORD    ID;
  104.     WORD    count;
  105.     DWORD   function;
  106. }RESOURCETYPE;
  107.  
  108. typedef struct _RESOURCEINFO
  109. {
  110.     WORD    offset;
  111.     WORD    length;
  112.     WORD    flags;
  113.     WORD    ID;
  114.     WORD    handle;
  115.     WORD    usage;
  116. }RESOURCEINFO;
  117.  
  118. #define NENOTP          0x8000  /* Not a process (i.e. a library module) */
  119. #define NESELFLOAD      0x0800  /* Self loading .EXE file */
  120. #define NEAPPTYP        0x0700  /* Application type mask */
  121. #define NEWINAPI        0x0300  /* Uses windowing API */
  122. #define NEWINCOMPAT     0x0200  /* Compatible with windowing API */
  123. #define NENOTWINCOMPAT  0x0100  /* Not compatible with windowing API */
  124. #define NENONRES        0x0080  /* Contains non-resident code segments */
  125. #define NELIM32         0x0010  /* Uses LIM 3.2 API */
  126. #define NEPROT          0x0008  /* Runs in protected mode only */
  127. #define NEPPLI          0x0004  /* Per-Process Library Initialization */
  128. #define NEINST          0x0002  /* Instance data */
  129. #define NESHARED        0x0001  /* Shared data */
  130.  
  131. // Target operating systems
  132.  
  133. #define NE_UNKNOWN      0
  134. #define NE_OS2          1   /* Microsoft/IBM OS/2 /
  135. #define NE_WINDOWS      2   /* Microsoft Windows */
  136. #define NE_DOS4         3   /* Microsoft European MS-DOS 4.x */
  137. #define NE_DEV386       4   /* Microsoft Windows 386 */
  138.  
  139. #ifdef __cplusplus
  140. }
  141. #endif
  142.  
  143.