source: trunk/include/win32k.h@ 6212

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

Added Environment fixes.

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