1 | /* $Id: OS2Krnl.h,v 1.3 1999-11-10 01:45:31 bird Exp $
|
---|
2 | *
|
---|
3 | * OS/2 kernel structures, typedefs and macros.
|
---|
4 | *
|
---|
5 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
6 | *
|
---|
7 | */
|
---|
8 |
|
---|
9 | #ifndef _OS2Krnl_h_
|
---|
10 | #define _OS2Krnl_h_
|
---|
11 |
|
---|
12 | #pragma pack(1)
|
---|
13 |
|
---|
14 | #ifdef RING0
|
---|
15 | typedef USHORT SFN, *PSFN; /* system file number */
|
---|
16 | #else
|
---|
17 | #define SFN HFILE
|
---|
18 | #define PSFN PHFILE
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | typedef struct OTE
|
---|
22 | {
|
---|
23 | ULONG ote_size; /* Object virtual size */
|
---|
24 | ULONG ote_base; /* Object base virtual address */
|
---|
25 | ULONG ote_flags; /* Attribute flags */
|
---|
26 | ULONG ote_pagemap; /* Object page map index */
|
---|
27 | ULONG ote_mapsize; /* Num of entries in obj page map */
|
---|
28 | /*ULONG ote_reserved;*/
|
---|
29 | USHORT ote_hob; /* Object Handle */
|
---|
30 | USHORT ote_sel; /* Object Selector */
|
---|
31 | } OTE, *POTE;
|
---|
32 |
|
---|
33 |
|
---|
34 | /* ote_flags */
|
---|
35 | #ifndef __EXE386__
|
---|
36 | #define OBJREAD 0x00000001L /* Readable Object */
|
---|
37 | #define OBJWRITE 0x00000002L /* Writeable Object */
|
---|
38 | #define OBJEXEC 0x00000004L /* Executable Object */
|
---|
39 | #define OBJRSRC 0x00000008L /* Resource Object */
|
---|
40 | #define OBJDISCARD 0x00000010L /* Object is Discardable */
|
---|
41 | #define OBJSHARED 0x00000020L /* Object is Shared */
|
---|
42 | #define OBJPRELOAD 0x00000040L /* Object has preload pages */
|
---|
43 | #define OBJINVALID 0x00000080L /* Object has invalid pages */
|
---|
44 | #endif
|
---|
45 | #define OBJZEROFIL 0x00000100L /* Object has zero-filled pages */
|
---|
46 | #ifndef __EXE386__
|
---|
47 | #define OBJRESIDENT 0x00000200L /* Object is resident */
|
---|
48 | #define OBJCONTIG 0x00000300L /* Object is resident and contiguous */
|
---|
49 | #define OBJDYNAMIC 0x00000400L /* Object is permanent and long locable */
|
---|
50 | #define OBJTYPEMASK 0x00000700L /* Object type mask */
|
---|
51 | #define OBJALIAS16 0x00001000L /* 16:16 alias required */
|
---|
52 | #define OBJBIGDEF 0x00002000L /* Big/Default bit setting */
|
---|
53 | #define OBJCONFORM 0x00004000L /* Object is conforming for code */
|
---|
54 | #define OBJIOPL 0x00008000L /* Object I/O privilege level */
|
---|
55 | #endif
|
---|
56 | #define OBJMADEPRIV 0x40000000L /* Object is made private for debug (now obsolete) */
|
---|
57 | #define OBJALLOC 0x80000000L /* Object is allocated used by loader */
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 | /*************************/
|
---|
65 | /* warp 3.0 AS SMTEs */
|
---|
66 | /* Swap ModuleTableEntry */
|
---|
67 | /*************************/
|
---|
68 | typedef struct SMTE
|
---|
69 | {
|
---|
70 | /* lxheader fields */
|
---|
71 | /*- magic,border,worder,level,cpu,os,ver,mflags */
|
---|
72 | ULONG smte_mpages; /* 00 Module # pages */
|
---|
73 | ULONG smte_startobj; /* 04 Object # for instruction */
|
---|
74 | ULONG smte_eip; /* 08 Extended instruction pointer */
|
---|
75 | ULONG smte_stackobj; /* 0c Object # for stack pointer */
|
---|
76 | ULONG smte_esp; /* 10 Extended stack pointer */
|
---|
77 | /*- pagesize*/
|
---|
78 | ULONG smte_pageshift; /* 14 Page alignment shift in .EXE */
|
---|
79 | ULONG smte_fixupsize; /* 18 Fixup section size */
|
---|
80 | /*- fixupsum,ldrsize,ldrsum*/
|
---|
81 | POTE smte_objtab; /* 1c Object table offset - POINTER */
|
---|
82 | ULONG smte_objcnt; /* 20 Number of objects in module */
|
---|
83 | ULONG smte_objmap; /* 24 Object page map offset - POINTER */
|
---|
84 | ULONG smte_itermap; /* 28 Object iterated data map offset */
|
---|
85 | ULONG smte_rsrctab; /* 2c Offset of Resource Table */
|
---|
86 | ULONG smte_rsrccnt; /* 30 Number of resource entries */
|
---|
87 | ULONG smte_restab; /* 34 Offset of resident name table - POINTER */
|
---|
88 | ULONG smte_enttab; /* 38 Offset of Entry Table - POINTER */
|
---|
89 | ULONG smte_fpagetab; /* 3c Offset of Fixup Page Table - POINTER */
|
---|
90 | ULONG smte_frectab; /* 40 Offset of Fixup Record Table - POINTER */
|
---|
91 | ULONG smte_impmod; /* 44 Offset of Import Module Name Table - POINTER */
|
---|
92 | /*- impmodcnt*/
|
---|
93 | ULONG smte_impproc; /* 48 Offset of Imp Procedure Name Tab - POINTER */
|
---|
94 | /*- pagesum*/
|
---|
95 | ULONG smte_datapage; /* 4c Offset of Enumerated Data Pages */
|
---|
96 | /*- preload*/
|
---|
97 | ULONG smte_nrestab; /* 50 Offset of Non-resident Names Table */
|
---|
98 | ULONG smte_cbnrestab; /* 54 Size of Non-resident Name Table */
|
---|
99 | /*- nressum*/
|
---|
100 | ULONG smte_autods; /* 58 Object # for automatic data object */
|
---|
101 | ULONG smte_debuginfo; /* 5c Offset of the debugging info */
|
---|
102 | ULONG smte_debuglen; /* 60 The len of the debug info in */
|
---|
103 | /*- instpreload,instdemand*/
|
---|
104 | ULONG smte_heapsize; /* 64 use for converted 16-bit modules */
|
---|
105 | /*- res3*/
|
---|
106 | /* extra */
|
---|
107 | PCHAR smte_path; /* 68 full pathname - POINTER */
|
---|
108 | USHORT smte_semcount; /* 6c Count of threads waiting on MTE semaphore. 0 => semaphore is free */
|
---|
109 | USHORT smte_semowner; /* 6e Slot number of the owner of MTE semahore */
|
---|
110 | ULONG smte_pfilecache; /* 70 Pointer to file cache for Dos32CacheModule */
|
---|
111 | ULONG smte_stacksize; /* 74 Thread 1 Stack size from the exe header */
|
---|
112 | USHORT smte_alignshift; /* 78 use for converted 16-bit modules */
|
---|
113 | USHORT smte_NEexpver; /* 7a expver from NE header */
|
---|
114 | USHORT smte_pathlen; /* 7c length of full pathname */
|
---|
115 | USHORT smte_NEexetype; /* 7e exetype from NE header */
|
---|
116 | USHORT smte_csegpack; /* 80 count of segs to pack */
|
---|
117 | } SMTE, *PSMTE;
|
---|
118 |
|
---|
119 |
|
---|
120 |
|
---|
121 |
|
---|
122 |
|
---|
123 |
|
---|
124 |
|
---|
125 |
|
---|
126 | /********************/
|
---|
127 | /* warp 3.0 GA MTEs */
|
---|
128 | /* ModuleTableEntry */
|
---|
129 | /********************/
|
---|
130 | typedef struct MTE
|
---|
131 | {
|
---|
132 | USHORT mte_flags2;
|
---|
133 | USHORT mte_handle;
|
---|
134 | PSMTE mte_swapmte; /* handle for swapmte */
|
---|
135 | struct MTE * mte_link;
|
---|
136 | ULONG mte_flags1;
|
---|
137 | ULONG mte_impmodcnt; /* number of entries in Import Module Name Table*/
|
---|
138 | SFN mte_sfn; /*"filehandle"*/
|
---|
139 | USHORT mte_usecnt; /* (.EXE only) - use count */
|
---|
140 | CHAR mte_modname[8];
|
---|
141 | }MTE,*PMTE,**PPMTE;
|
---|
142 |
|
---|
143 |
|
---|
144 |
|
---|
145 | /***********/
|
---|
146 | /* flags 1 */
|
---|
147 | /***********/
|
---|
148 | #define NOAUTODS 0x00000000 /* No Auto DS exists */
|
---|
149 | #define SOLO 0x00000001 /* Auto DS is shared */
|
---|
150 | #define INSTANCEDS 0x00000002 /* Auto DS is not shared */
|
---|
151 | #define INSTLIBINIT 0x00000004 /* Perinstance Libinit */
|
---|
152 | #define GINISETUP 0x00000008 /* Global Init has been setup */
|
---|
153 | #define NOINTERNFIXUPS 0x00000010 /* internal fixups in .EXE.DLL applied */
|
---|
154 | #define NOEXTERNFIXUPS 0x00000020 /* external fixups in .EXE.DLL applied */
|
---|
155 | #define CLASS_PROGRAM 0x00000040 /* Program class */
|
---|
156 | #define CLASS_GLOBAL 0x00000080 /* Global class */
|
---|
157 | #define CLASS_SPECIFIC 0x000000C0 /* Specific class, as against global */
|
---|
158 | #define CLASS_ALL 0x00000000 /* nonspecific class all modules */
|
---|
159 | #define CLASS_MASK 0x000000C0 /* */
|
---|
160 | #define MTEPROCESSED 0x00000100 /* MTE being loaded */
|
---|
161 | #define USED 0x00000200 /* MTE is referenced see ldrgc.c */
|
---|
162 | #define DOSLIB 0x00000400 /* set if DOSCALL1 */
|
---|
163 | #define DOSMOD 0x00000800 /* set if DOSCALLS */
|
---|
164 | #define MTE_MEDIAFIXED 0x00001000 /* File Media permits discarding */
|
---|
165 | #define LDRINVALID 0x00002000 /* module not loadable */
|
---|
166 | #define PROGRAMMOD 0x00000000 /* program module */
|
---|
167 | #define DEVDRVMOD 0x00004000 /* device driver module */
|
---|
168 | #define LIBRARYMOD 0x00008000 /* DLL module */
|
---|
169 | #define VDDMOD 0x00010000 /* VDD module */
|
---|
170 | #define MVDMMOD 0x00020000 /* Set if VDD Helper MTE (MVDM.DLL) */
|
---|
171 | #define INGRAPH 0x00040000 /* In Module Graph see ldrgc.c */
|
---|
172 | #define GINIDONE 0x00080000 /* Global Init has finished */
|
---|
173 | #define MTEADDRALLOCED 0x00100000 /* Allocate specific or not */
|
---|
174 | #define FSDMOD 0x00200000 /* FSD MTE */
|
---|
175 | #define FSHMOD 0x00400000 /* FS helper MTE */
|
---|
176 | #define MTELONGNAMES 0x00800000 /* Module supports longnames */
|
---|
177 | #define MTE_MEDIACONTIG 0x01000000 /* File Media contiguous memory req */
|
---|
178 | #define MTE_MEDIA16M 0x02000000 /* File Media requires mem below 16M */
|
---|
179 | #define MTESWAPONLOAD 0x04000000 /* make code pages swap on load */
|
---|
180 | #define MTEPORTHOLE 0x08000000 /* porthole module */
|
---|
181 | #define MTEMODPROT 0x10000000 /* Module has shared memory protected */
|
---|
182 | #define MTENEWMOD 0x20000000 /* Newly added module */
|
---|
183 | #define MTEDLLTERM 0x40000000 /* Gets instance termination */
|
---|
184 | #define MTESYMLOADED 0x80000000 /* Set if debugger symbols loaded */
|
---|
185 |
|
---|
186 |
|
---|
187 | /***********/
|
---|
188 | /* flags 2 */
|
---|
189 | /***********/
|
---|
190 | #define MTEFORMATMASK 0x0003 /* Module format mask */
|
---|
191 | #define MTEFORMATR1 0x0000 /* Module format reserved */
|
---|
192 | #define MTEFORMATNE 0x0001 /* Module format NE */
|
---|
193 | #define MTEFORMATLX 0x0002 /* Module format LX */
|
---|
194 | #define MTEFORMATR2 0x0003 /* Module format reserved */
|
---|
195 | #define MTESYSTEMDLL 0x0004 /* DLL exists in system list */
|
---|
196 | #define MTELOADORATTACH 0x0008 /* Module under load or attach for init */
|
---|
197 | #define MTECIRCLEREF 0x0010 /* Module circular reference detection */
|
---|
198 | #define MTEFREEFIXUPS 0x0020 /* Free system mte's fixup flag d#98488 */
|
---|
199 | #define MTEPRELOADED 0x0040 /* MTE Preload completed */
|
---|
200 | #define MTEGETMTEDONE 0x0080 /* GetMTE already resolved */
|
---|
201 | #define MTEPACKSEGDONE 0x0100 /* Segment packed memory allocated */
|
---|
202 | #define MTE20LIELIST 0x0200 /* Name present in version20 lie list */
|
---|
203 | #define MTESYSPROCESSED 0x0400 /* System DLL already processed */
|
---|
204 | #define MTEDLLONEXTLST 0x1000 /* DLL has term routine on exit list #74177 */
|
---|
205 |
|
---|
206 |
|
---|
207 |
|
---|
208 |
|
---|
209 |
|
---|
210 | #pragma pack()
|
---|
211 | #endif
|
---|