home *** CD-ROM | disk | FTP | other *** search
- /*
- MODTABLE.H -- Module table and related structures
-
- from "Undocumented Windows" by Schulman et al. (Addison-Wesley, 1992)
- Chapter 5: KERNEL
-
- Copyright (c) Andrew Schulman and Matt Pietrek 1992
- */
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- typedef struct
- {
- int segment_type : 1; /* Segment type identification */
- int unknown : 2; /* used by Windows for something*/
- int iterated : 1; /* Segment is iterated */
- int movable : 1; /* Segment is movable */
- int pure : 1; /* Segment is sharable */
- int preload : 1; /* Segment is preload */
- int read_only : 1; /* Segment is read-only */
- int reloc_info : 1; /* Segment has reloc info */
- int u1 : 3;
- int discardable : 1; /* Discardable flag. */
- int u2 : 3;
- } SEG_BITFIELD_FLAGS;
-
- typedef struct
- {
- WORD sector_offset; /* Offset to logical sector */
- WORD segment_length; /* Size in bytes of segment */
- SEG_BITFIELD_FLAGS flags; /* flags for segment */
- WORD alloc_size; /* Segment allocation size */
- WORD handle;
- } MODULE_TABLE_SEGMENT_RECORD;
-
- typedef enum
- { /* Segment type constants */
- CODE = 0x0000, /* Code segment type */
- DATA = 0x0001, /* Data segment type */
- } SEGMENT_TYPES;
-
- typedef struct
- {
- WORD ne_signature;
- WORD ne_usage;
- WORD ne_penttable;
- WORD ne_pnextexe;
- WORD ne_pautodata;
- WORD ne_pfileinfo;
- WORD ne_flags;
- WORD ne_autodata;
- WORD ne_heap;
- WORD ne_stack;
- DWORD ne_csip;
- DWORD ne_sssp;
- WORD ne_cseg;
- WORD ne_cmod;
- WORD ne_cbnrestab;
- WORD ne_segtab;
- WORD ne_rsrctab;
- WORD ne_restab;
- WORD ne_modtab;
- WORD ne_imptab;
- DWORD ne_nrestab;
- WORD ne_cmovent;
- WORD ne_align;
- WORD ne_cres;
- unsigned char ne_exetyp;
- unsigned char ne_flagsother;
- union
- {
- WORD ne_pretthunks; /* offset to return thunks */
- WORD ne_gang_start; /* start of gangload area */
- } x;
- union
- {
- WORD ne_psegrefbytes; /* offset to segment ref. bytes */
- WORD ne_gang_length; /* length of gangload area */
- } y;
- WORD ne_swaparea; /* minimum code swap area size */
- WORD ne_expver; /* expected windows version num */
- } MODULE_TABLE;
-
- typedef struct _BUNDLE_HEADER
- {
- WORD firstEntry;
- WORD lastEntry;
- WORD nextBundle;
- } BUNDLE_HEADER;
-
- typedef struct _ENTRY
- {
- BYTE segType;
- BYTE flags;
- BYTE segNumber;
- WORD offset;
- } ENTRY;
-
- typedef struct _RESOURCETYPE
- {
- WORD ID;
- WORD count;
- DWORD function;
- }RESOURCETYPE;
-
- typedef struct _RESOURCEINFO
- {
- WORD offset;
- WORD length;
- WORD flags;
- WORD ID;
- WORD handle;
- WORD usage;
- }RESOURCEINFO;
-
- #define NENOTP 0x8000 /* Not a process (i.e. a library module) */
- #define NESELFLOAD 0x0800 /* Self loading .EXE file */
- #define NEAPPTYP 0x0700 /* Application type mask */
- #define NEWINAPI 0x0300 /* Uses windowing API */
- #define NEWINCOMPAT 0x0200 /* Compatible with windowing API */
- #define NENOTWINCOMPAT 0x0100 /* Not compatible with windowing API */
- #define NENONRES 0x0080 /* Contains non-resident code segments */
- #define NELIM32 0x0010 /* Uses LIM 3.2 API */
- #define NEPROT 0x0008 /* Runs in protected mode only */
- #define NEPPLI 0x0004 /* Per-Process Library Initialization */
- #define NEINST 0x0002 /* Instance data */
- #define NESHARED 0x0001 /* Shared data */
-
- // Target operating systems
-
- #define NE_UNKNOWN 0
- #define NE_OS2 1 /* Microsoft/IBM OS/2 /
- #define NE_WINDOWS 2 /* Microsoft Windows */
- #define NE_DOS4 3 /* Microsoft European MS-DOS 4.x */
- #define NE_DEV386 4 /* Microsoft Windows 386 */
-
- #ifdef __cplusplus
- }
- #endif
-
-