source: trunk/include/win32k.h@ 5319

Last change on this file since 5319 was 5319, checked in by bird, 24 years ago

Defines OBJ_ANY if it doesn't exists.

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