source: trunk/include/win32k.h@ 10010

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

Kill API - initial coding.

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