source: trunk/include/win32k.h@ 5219

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

H2INC changes. New IOCtl for selector. Changed parameter packet layout.

File size: 19.3 KB
Line 
1/* $Id: win32k.h,v 1.10 2001-02-21 07:41:24 bird Exp $
2 *
3 * Top level make file for the Win32k library.
4 * Contains library and 32-bit IOCtl definition.
5 *
6 * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 */
11/* NOINC */
12#ifndef _WIN32K_H_
13#define _WIN32K_H_
14/* INC */
15
16/*******************************************************************************
17* Defined Constants And Macros *
18*******************************************************************************/
19/*
20 * IOCtls categories.
21 */
22#define IOCTL_W32K_K32 0xC1
23#define IOCTL_W32K_ELF 0xC2
24
25/*
26 * K32 category - these are the functions found in the k32 directory.
27 */
28#define K32_ALLOCMEMEX 0x01
29#define K32_QUERYOTES 0x02
30#define K32_QUERYOPTIONSSTATUS 0x03
31#define K32_SETOPTIONS 0x04
32#define K32_PROCESSREADWRITE 0x05
33#define K32_HANDLESYSTEMEVENT 0x06
34#define K32_QUERYSYSTEMMEMINFO 0x07
35#define K32_QUERYCALLGATE 0x08
36#define K32_LASTIOCTLFUNCTION K32_QUERYCALLGATE
37
38
39/*
40 * Elf category
41 */
42#define ELF_DUMMY 0x01
43
44
45/*
46 * DosAllocMemEx - Extra (bsememf.h) flag definitions.
47 */
48#define OBJ_ALIGNDEFAULT 0x00000000UL
49#define OBJ_ALIGN64K 0x10000000UL
50#define OBJ_ALIGNPAGE 0x20000000UL
51#define OBJ_ALIGNMASK 0x30000000UL
52#define OBJ_LOCATION 0x80000000UL
53#ifndef OBJ_SELMAPALL
54#define OBJ_SELMAPALL 0x00000800UL /* This isn't ours. It just a dropout form bsememf.h */
55#endif
56
57
58/*
59 * System event Identifiers.
60 */
61#define K32_SYSEVENT_SM_MOUSE 0x00 /* dh SendEvent - Session Manager (mouse) */
62#define K32_SYSEVENT_CTRL_BREAK 0x01 /* dh SendEvent - Ctrl-Break */
63#define K32_SYSEVENT_CTRL_C 0x02 /* dh SendEvent - Ctrl-C */
64#define K32_SYSEVENT_CTRL_SCREEN_LOCK 0x03 /* dh SendEvent - Ctrl-ScrollLock */
65#define K32_SYSEVENT_CTRL_PRINT_SCREEN 0x04 /* dh SendEvent - Ctrl-PrtSc */
66#define K32_SYSEVENT_SHIFT_PRINT_SCREEN 0x05 /* dh SendEvent - Shift-PrtSc */
67#define K32_SYSEVENT_SM_KEYBOARD 0x06 /* dh SendEvent - Session Manager (keyboard) */
68#define K32_SYSEVENT_SM_CTRL_ALT_DELETE 0x07 /* dh SendEvent - Ctrl-Alt-Del */
69#define K32_SYSEVENT_HOT_PLUG 0x08 /* dh SendEvent - Keyboard Hot Plug/Reset */
70#define K32_SYSEVENT_POWER 0x09 /* dh SendEvent - Power suspend event */
71#define K32_SYSEVENT_POWEROFF 0x0a /* dh SendEvent - Power off event */
72#define K32_SYSEVENT_CTRL_ALT_2xNUMLOCK 0x0b /* VectorSDF - System Dump */
73#define K32_SYSEVENT_LAST K32_SYSEVENT_CTRL_ALT_2xNUMLOCK
74
75/*
76 * System Memory Info flags.
77 */
78#define K32_SYSMEMINFO_ALL 0 /* Everything is queried. */
79#define K32_SYSMEMINFO_SWAPFILE 0x01 /* Swapfile stuff is queried. */
80#define K32_SYSMEMINFO_PAGING 0x02 /* Paging and Physical memory stuff is queried. */
81#define K32_SYSMEMINFO_VM 0x04 /* Virtual memory stuff is all queried. */
82
83
84/* NOINC */
85#ifndef INCL_16 /* We don't need this in 16-bit code. */
86/* INC */
87
88/*******************************************************************************
89* Assembly Fixes *
90*******************************************************************************/
91/*ASM
92BOOL struc
93 dd ?
94BOOL ends
95
96PID struc
97 dd ?
98PID ends
99
100HMODULE struc
101 dd ?
102HMODULE ends
103
104HEV struc
105 dd ?
106HEV ends
107
108PVOID struc
109 dd ?
110PVOID ends
111
112PPVOID struc
113 dd ?
114PPVOID ends
115
116PUSHORT struc
117 dd ?
118PUSHORT ends
119
120CCHMAXPATH EQU 260
121
122*/ /* end of assembly */
123
124
125/*******************************************************************************
126* Structures and Typedefs *
127*******************************************************************************/
128#pragma pack(1)
129
130/*
131 * Object Table Entry buffer.
132 */
133struct _QueryOTE
134{
135 ULONG ote_size; /* Object virtual size */
136 ULONG ote_base; /* Object base virtual address */
137 ULONG ote_flags; /* Attribute flags */
138 ULONG ote_pagemap; /* Object page map index */
139 ULONG ote_mapsize; /* Num of entries in obj page map */
140 /*ULONG ote_reserved;*/
141 USHORT ote_sel; /* Object Selector */
142 USHORT ote_hob; /* Object Handle */
143};
144typedef struct _QueryOTE QOTE;
145typedef QOTE * PQOTE;
146
147
148typedef struct _QueryOTEBuffer
149{
150 ULONG cOTEs; /* Number of entries in aOTE. */
151 QOTE aOTE[1]; /* Array of OTEs. */
152} QOTEBUFFER;
153typedef QOTEBUFFER *PQOTEBUFFER;
154
155
156/*
157 * Options struct.
158 *
159 * (The function of these members are described in options.h in
160 * the src\win32k\include directory.)
161 * All members of this struct (except cb ofcourse) is changable.
162 */
163typedef struct _K32Options
164{
165 ULONG cb;
166
167 /** @cat logging options */
168 USHORT usCom; /* Output port no. */
169 ULONG fLogging; /* Logging. */
170
171 /** @cat Options affecting the generated LX executables */
172 ULONG fPE; /* Flags set the type of conversion. */
173 ULONG fPEOneObject; /* All in one object. */
174 ULONG ulInfoLevel; /* Pe2Lx InfoLevel. */
175
176 /** @cat Options affecting the generated ELF executables */
177 ULONG fElf; /* Elf flags. */
178
179 /** @cat Options affecting the UNIX script executables */
180 ULONG fUNIXScript; /* UNIX script flags. */
181
182 /** @cat Options affecting the REXX script executables */
183 ULONG fREXXScript; /* REXX script flags. */
184
185 /** @cat Options affecting the JAVA executables */
186 ULONG fJava; /* Java flags. */
187
188 /** @cat Options affecting the executables */
189 ULONG fNoLoader; /* No loader stuff. !FIXME! We should import / functions even if this flag is set!!! */
190
191 /** @cat Options affecting the behaviour changes in the OS/2 loader */
192 ULONG fDllFixes; /* Enables the long DLL name and non .DLL extention fixes. */
193 ULONG fExeFixes; /* Enables EXE files to export entry points. */
194 ULONG fForcePreload; /* Forces the loader to preload executable images. Handy for ICAT Ring-3 debugging. */
195 ULONG fApiEnh; /* Enables the API enhancements */
196
197 /** @cat Options affecting the heap. */
198 ULONG cbSwpHeapMax; /* Maximum heapsize. */
199 ULONG cbResHeapMax; /* Maxiumem residentheapsize. */
200} K32OPTIONS;
201typedef K32OPTIONS *PK32OPTIONS;
202
203
204/*
205 * Status struct.
206 *
207 */
208typedef struct _K32Status
209{
210 ULONG cb;
211
212 /** @cat Options status. */
213 ULONG fQuiet; /* Quiet initialization. */
214
215 /** @cat Kernel status. */
216 ULONG fKernel; /* Smp or uni kernel. */
217 ULONG ulBuild; /* Kernel build. */
218 USHORT usVerMajor; /* OS/2 major ver - 20 */
219 USHORT usVerMinor; /* OS/2 minor ver - 30,40 */
220
221 /** @cat Heap status. */
222 ULONG cbSwpHeapInit; /* Initial heapsize. */
223 ULONG cbSwpHeapFree; /* Amount of used space. */
224 ULONG cbSwpHeapUsed; /* Amount of free space reserved. */
225 ULONG cbSwpHeapSize; /* Amount of memory used by the heap free and used++. */
226 ULONG cSwpBlocksUsed; /* Count of used blocks. */
227 ULONG cSwpBlocksFree; /* Count of free blocks. */
228
229 ULONG cbResHeapInit; /* Initial heapsize. */
230 ULONG cbResHeapFree; /* Amount of free space reserved. */
231 ULONG cbResHeapUsed; /* Amount of used space. */
232 ULONG cbResHeapSize; /* Amount of memory used by the heap free and used++. */
233 ULONG cResBlocksUsed; /* Count of used blocks. */
234 ULONG cResBlocksFree; /* Count of free blocks. */
235
236 /** @cat Win32k build, version and init stuff */
237 CHAR szBuildDate[12]; /* Date of the win32k build. (Sep 02 2000) */
238 CHAR szBuildTime[9]; /* Time of the win32k build. (11:44:21) */
239 ULONG ulVersion; /* Win32k version */
240 CHAR szSymFile[CCHMAXPATH]; /* The name of the symbol file or sym database. */
241
242 /** @cat Statistics */
243 ULONG cPe2LxModules; /* Number of Pe2Lx modules currently loaded. */
244 ULONG cElf2LxModules; /* Number of Elf2Lx modules currently loaded. */
245 /*...*/
246} K32STATUS;
247typedef K32STATUS * PK32STATUS;
248
249
250/*
251 * Memory information struct.
252 */
253typedef struct _k32SystemMemInfo
254{
255 ULONG cb; /* Size of this structure - must be set. */
256 /* This will be used to distinguish futher versions. */
257 ULONG flFlags; /* This is used to limit amount of information collected - must be set. (K32_SYSMEMINFO_*) */
258 /* Some conciderations.
259 * - VM uses worker functions which traverses internal lists.
260 * - Page and physical memory traverses one internal structure (PGPhysAvail())
261 * - Swap File only accesses variables.
262 */
263
264 /* SwapFile Info */
265 BOOL fSwapFile; /* Swap File: Swapping enabled or disabled. (SMswapping) */
266 /* (The SwapFile data below is valid when swapping is enbled!) */
267 ULONG cbSwapFileSize; /* Swap File: Current size. (smFileSize<<PAGESIZE) */
268 ULONG cbSwapFileAvail; /* Swap File: Available within current file. ((smFileSize-smcBrokenDF-SMcDFInuse)<<PAGESIZE) */
269 ULONG cbSwapFileUsed; /* Swap File: Used within current file. (SMcDFInuse<<PAGESIZE) */
270 ULONG cbSwapFileMinFree; /* Swap File: Addjusted min free on swap volume. (SMMinFree<<PAGESHIFT) */
271 ULONG cbSwapFileCFGMinFree; /* Swap File: Configured min free on swap volume. ((SMCFGMinFree<<PAGESHIFT)/4) */
272 ULONG cbSwapFileCFGSwapSize; /* Swap File: Configured initial swap file size. ((SMCFGSwapSize<<PAGESHIFT)/4) */
273 ULONG cSwapFileBrokenDF; /* Swap File: Number of broken disk frames (DF). (smcBrokenDF) */
274 ULONG cSwapFileGrowFails; /* Swap File: Number of times growoperation has failed. (smcGrowFails) */
275 ULONG cSwapFileInMemFile; /* Swap File: Number of pages in the "In-Memory-swapFile". (SMcInMemFile) */
276 /* These pages are not counted into the SMcDFInuse count I think. */
277
278 /* Physical Memory Info */
279 ULONG cbPhysSize; /* Physical memory: total (bytes). (pgPhysPages<<PAGESHIFT) */
280 ULONG cbPhysAvail; /* Physical memory: available (bytes). (PGPhysAvail()) */
281 ULONG cbPhysUsed; /* Physical memory: used (bytes). (PGPhysPresent()<<PAGESHIFT) */
282
283 /* Other paging info */
284 BOOL fPagingSwapEnabled; /* Paging: TRUE when swapping is enabled, else false. (PGSwapEnabled) */
285 ULONG cPagingPageFaults; /* Paging: Number of pagefaults which has occured since boot. (pgcPageFaults) */
286 ULONG cPagingPageFaultsActive;/* Paging: Number of pagefaults currently being processed. (pgcPageFaultsActive) */
287 ULONG cPagingPhysPages; /* Paging: Count of physical pages. (hope this is correct) (pgPhysPages) */
288 ULONG ulPagingPhysMax; /* Paging: Top of physical memory (physical page number) (pgPhysMax) */
289 ULONG cPagingResidentPages; /* Paging: Count of resident pages. (pgResidentPages) */
290 ULONG cPagingSwappablePages; /* Paging: Count of swappable pages which is currently present in memory. (pgSwappablePages) */
291 ULONG cPagingDiscardableInmem;/* Paging: Count of discardable pages which is currently present in memory. (pgDiscardableInmem) */
292 ULONG cPagingDiscardablePages;/* Paging: Count of discardable pages allocated. (pgDiscardablePages) */
293
294 /* Virtual Memory manager info. */
295 ULONG ulAddressLimit; /* VM: Current user virtual address limit - use this for high arena check. (VirtualAddressLimit / 0x20000000) */
296 ULONG ulVMArenaPrivMax; /* VM: Current highest address in the private arena. (vmRecalcShrBound()) */
297 ULONG ulVMArenaSharedMin; /* VM: Current lowest address in the shared arena. (ahvmShr) */
298 ULONG ulVMArenaSharedMax; /* VM: Current highest address in the shared arena. (ahvmShr) */
299 ULONG ulVMArenaSystemMin; /* VM: Current lowest address in the system arena. (ahvmhSys) */
300 ULONG ulVMArenaSystemMax; /* VM: Current highest address in the system arena. (ahvmhSys) */
301 ULONG ulVMArenaHighPrivMax; /* VM: Current highest address in the high private arena - aurora/smp only. (vmRecalcShrBound) */
302 ULONG ulVMArenaHighSharedMin; /* VM: Current lowest address in the high shared arena - aurora/smp only. (ahvmhShr) */
303 ULONG ulVMArenaHighSharedMax; /* VM: Current highest address in the high shared arena - aurora/smp only. (ahvmhShr) */
304
305} K32SYSTEMMEMINFO;
306typedef K32SYSTEMMEMINFO * PK32SYSTEMMEMINFO;
307
308
309/*
310 * K32 category parameter structs
311 * ---
312 * First member is allways a K32HDR struct called hdr.
313 * The rest of it should be exactly like the parameter list for the API call.
314 */
315struct _k32Header /* Common parameter header. */
316{
317 ULONG cb; /* Size of the parameters struct. */
318 ULONG rc; /* Return code. */
319};
320typedef struct _k32Header K32HDR;
321typedef K32HDR * PK32HDR;
322
323
324struct _k32AllocMemEx
325{
326 K32HDR hdr; /* Common parameter header */
327 PPVOID ppv; /* Pointer to pointer to the allocated memory block */
328 /* On input it (*ppv) may hold the suggested location of the block. */
329 ULONG cb; /* Blocksize (bytes) */
330 ULONG flFlags; /* Flags (equal to DosAllocMem flags) */
331 ULONG ulCS; /* Call CS */
332 ULONG ulEIP; /* Call EIP */
333};
334typedef struct _k32AllocMemEx K32ALLOCMEMEX;
335typedef K32ALLOCMEMEX * PK32ALLOCMEMEX;
336
337
338struct _k32QueryOTEs
339{
340 K32HDR hdr; /* Common parameter header */
341 HMODULE hMTE; /* Module handle. */
342 PQOTEBUFFER pQOte; /* Pointer to output buffer. */
343 ULONG cbQOte; /* Size of the buffer pointed to by pQOte */
344};
345typedef struct _k32QueryOTEs K32QUERYOTES;
346typedef K32QUERYOTES * PK32QUERYOTES;
347
348
349struct _k32QueryOptionsStatus
350{
351 K32HDR hdr; /* Common parameter header */
352 PK32OPTIONS pOptions; /* Pointer to option struct. (NULL allowed) */
353 PK32STATUS pStatus; /* Pointer to status struct. (NULL allowed) */
354};
355typedef struct _k32QueryOptionsStatus K32QUERYOPTIONSSTATUS;
356typedef K32QUERYOPTIONSSTATUS * PK32QUERYOPTIONSSTATUS;
357
358
359struct _k32SetOptions
360{
361 K32HDR hdr; /* Common parameter header */
362 PK32OPTIONS pOptions; /* Pointer to option struct. (NULL allowed) */
363};
364typedef struct _k32SetOptions K32SETOPTIONS;
365typedef K32SETOPTIONS * PK32SETOPTIONS;
366
367
368struct _k32ProcessReadWrite
369{
370 K32HDR hdr; /* Common parameter header */
371 PID pid; /* Process ID of the process to access memory in. */
372 ULONG cb; /* Number of bytes to read or write. */
373 PVOID pvSource; /* Pointer to source data. */
374 PVOID pvTarget; /* Pointer to target area. */
375 BOOL fRead; /* TRUE: pvSource is within pid while pvTarget is ours. */
376 /* FALSE: pvTarget is within pid while pvSource is ours. */
377};
378typedef struct _k32ProcessReadWrite K32PROCESSREADWRITE;
379typedef K32PROCESSREADWRITE * PK32PROCESSREADWRITE;
380
381
382struct _k32HandleSystemEvent
383{
384 K32HDR hdr; /* Common parameter header */
385 ULONG ulEvent; /* Event identifier. One of the K32_SYSEVENT_ defines. */
386 HEV hev; /* Handle of shared event semaphore which should be */
387 /* posted when the the requested event occurs. */
388 BOOL fHandle; /* Action flag. */
389 /* TRUE: Take control of the event. */
390 /* FALSE: Give control back to the OS of this event. (hev must match the current handle!) */
391};
392typedef struct _k32HandleSystemEvent K32HANDLESYSTEMEVENT;
393typedef K32HANDLESYSTEMEVENT * PK32HANDLESYSTEMEVENT;
394
395
396struct _k32QuerySystemMemInfo
397{
398 K32HDR hdr; /* Common parameter header */
399 PK32SYSTEMMEMINFO pMemInfo; /* Pointer to system memory info structure with cb set. */
400 /* The other members will be filled on successful return. */
401};
402typedef struct _k32QuerySystemMemInfo K32QUERYSYSTEMMEMINFO;
403typedef K32QUERYSYSTEMMEMINFO * PK32QUERYSYSTEMMEMINFO;
404
405
406struct _k32QueryCallGate
407{
408 K32HDR hdr; /* Common parameter header */
409 PUSHORT pusCGSelector; /* Pointer to variable where the callgate selector */
410 /* is to be stored. */
411};
412typedef struct _k32QueryCallGate K32QUERYCALLGATE;
413typedef struct _k32QueryCallGate * PK32QUERYCALLGATE;
414
415#pragma pack()
416
417/* NOINC */
418#ifndef NO_WIN32K_LIB_FUNCTIONS
419/*******************************************************************************
420* External Functions *
421*******************************************************************************/
422/* Win32k APIs */
423APIRET APIENTRY libWin32kInit(void);
424APIRET APIENTRY libWin32kTerm(void);
425BOOL APIENTRY libWin32kInstalled(void);
426APIRET APIENTRY libWin32kQueryOptionsStatus(PK32OPTIONS pOptions, PK32STATUS pStatus);
427APIRET APIENTRY libWin32kSetOptions(PK32OPTIONS pOptions);
428
429/* "Extra OS2 APIs" */
430APIRET APIENTRY DosAllocMemEx(PPVOID ppv, ULONG cb, ULONG flag);
431APIRET APIENTRY W32kQueryOTEs(HMODULE hMTE, PQOTEBUFFER pQOte, ULONG cbQOte);
432APIRET APIENTRY W32kQuerySystemMemInfo(PK32SYSTEMMEMINFO pMemInfo);
433APIRET APIENTRY W32kProcessReadWrite(PID pid, ULONG cb, PVOID pvSource, PVOID pvTarget, BOOL fRead);
434APIRET APIENTRY W32kHandleSystemEvent(ULONG ulEvent, HEV hev, BOOL fHandle);
435
436/* Helper function */
437USHORT APIENTRY libHelperGetCS(void);
438
439#endif
440/* INC */
441
442/* NOINC */
443#endif /* !defined(INCL_16) */
444#endif
445/* INC */
Note: See TracBrowser for help on using the repository browser.