source: trunk/src/win32k/include/OS2Krnl.h@ 5000

Last change on this file since 5000 was 4347, checked in by bird, 25 years ago

Implemented tool for generating calltab for kernel imports. (mkcalltab)
Implemented API for accessing memory in another process. (*ProcessReadWrite)
Added kernel imports needed to implemented ProcessReadWrite.
Removed unused kernel imports.

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