source: trunk/include/win32k.h@ 5112

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

Added new K32QUERYSYSTEMMEMINFO IOCtl with lib call and structs.

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