source: trunk/include/win32k.h@ 5118

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

Added force preload, exefix and apifix options.

File size: 16.7 KB
RevLine 
[5118]1/* $Id: win32k.h,v 1.6 2001-02-11 23:43:22 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. */
[5118]132 ULONG fExeFixes; /* Enables EXE files to export entry points. */
133 ULONG fForcePreload; /* Forces the loader to preload executable images. Handy for ICAT Ring-3 debugging. */
134 ULONG fApiEnh; /* Enables the API enhancements */
[4774]135
[4165]136 /** @cat Options affecting the heap. */
137 ULONG cbSwpHeapMax; /* Maximum heapsize. */
138 ULONG cbResHeapMax; /* Maxiumem residentheapsize. */
139} K32OPTIONS, *PK32OPTIONS;
140
141
142/*
143 * Status struct.
144 *
145 */
146typedef struct _K32Status
147{
148 ULONG cb;
149
150 /** @cat Options status. */
151 ULONG fQuiet; /* Quiet initialization. */
152
153 /** @cat Kernel status. */
154 ULONG fKernel; /* Smp or uni kernel. */
155 ULONG ulBuild; /* Kernel build. */
156 USHORT usVerMajor; /* OS/2 major ver - 20 */
157 USHORT usVerMinor; /* OS/2 minor ver - 30,40 */
158
159 /** @cat Heap status. */
160 ULONG cbSwpHeapInit; /* Initial heapsize. */
161 ULONG cbSwpHeapFree; /* Amount of used space. */
162 ULONG cbSwpHeapUsed; /* Amount of free space reserved. */
163 ULONG cbSwpHeapSize; /* Amount of memory used by the heap free and used++. */
164 ULONG cSwpBlocksUsed; /* Count of used blocks. */
165 ULONG cSwpBlocksFree; /* Count of free blocks. */
166
167 ULONG cbResHeapInit; /* Initial heapsize. */
168 ULONG cbResHeapFree; /* Amount of free space reserved. */
169 ULONG cbResHeapUsed; /* Amount of used space. */
170 ULONG cbResHeapSize; /* Amount of memory used by the heap free and used++. */
171 ULONG cResBlocksUsed; /* Count of used blocks. */
172 ULONG cResBlocksFree; /* Count of free blocks. */
173
174 /** @cat Win32k build, version and init stuff */
175 CHAR szBuildDate[12]; /* Date of the win32k build. (Sep 02 2000) */
176 CHAR szBuildTime[9]; /* Time of the win32k build. (11:44:21) */
177 ULONG ulVersion; /* Win32k version */
178 CHAR szSymFile[CCHMAXPATH]; /* The name of the symbol file or sym database. */
179
180 /** @cat Statistics */
181 ULONG cPe2LxModules; /* Number of Pe2Lx modules currently loaded. */
182 ULONG cElf2LxModules; /* Number of Elf2Lx modules currently loaded. */
183 /*...*/
184} K32STATUS, *PK32STATUS;
185
186
[5112]187/*
188 * Memory information struct.
189 */
190typedef struct _k32SystemMemInfo
191{
192 ULONG cb; /* Size of this structure - must be set. */
193 /* This will be used to distinguish futher versions. */
194 ULONG flFlags; /* This is used to limit amount of information collected - must be set. (K32_SYSMEMINFO_*) */
195 /* Some conciderations.
196 * - VM uses worker functions which traverses internal lists.
197 * - Page and physical memory traverses one internal structure (PGPhysAvail())
198 * - Swap File only accesses variables.
199 */
[4165]200
[5112]201 /* SwapFile Info */
202 BOOL fSwapFile; /* Swap File: Swapping enabled or disabled. (SMswapping) */
203 /* (The SwapFile data below is valid when swapping is enbled!) */
204 ULONG cbSwapFileSize; /* Swap File: Current size. (smFileSize<<PAGESIZE) */
205 ULONG cbSwapFileAvail; /* Swap File: Available within current file. ((smFileSize-smcBrokenDF-SMcDFInuse)<<PAGESIZE) */
206 ULONG cbSwapFileUsed; /* Swap File: Used within current file. (SMcDFInuse<<PAGESIZE) */
207 ULONG cbSwapFileMinFree; /* Swap File: Addjusted min free on swap volume. (SMMinFree<<PAGESHIFT) */
208 ULONG cbSwapFileCFGMinFree; /* Swap File: Configured min free on swap volume. ((SMCFGMinFree<<PAGESHIFT)/4) */
209 ULONG cbSwapFileCFGSwapSize; /* Swap File: Configured initial swap file size. ((SMCFGSwapSize<<PAGESHIFT)/4) */
210 ULONG cSwapFileBrokenDF; /* Swap File: Number of broken disk frames (DF). (smcBrokenDF) */
211 ULONG cSwapFileGrowFails; /* Swap File: Number of times growoperation has failed. (smcGrowFails) */
212 ULONG cSwapFileInMemFile; /* Swap File: Number of pages in the "In-Memory-swapFile". (SMcInMemFile) */
213 /* These pages are not counted into the SMcDFInuse count I think. */
214
215 /* Physical Memory Info */
216 ULONG cbPhysSize; /* Physical memory: total (bytes). (pgPhysPages<<PAGESHIFT) */
217 ULONG cbPhysAvail; /* Physical memory: available (bytes). (PGPhysAvail()) */
218 ULONG cbPhysUsed; /* Physical memory: used (bytes). (PGPhysPresent()<<PAGESHIFT) */
219
220 /* Other paging info */
221 BOOL fPagingSwapEnabled; /* Paging: TRUE when swapping is enabled, else false. (PGSwapEnabled) */
222 ULONG cPagingPageFaults; /* Paging: Number of pagefaults which has occured since boot. (pgcPageFaults) */
223 ULONG cPagingPageFaultsActive;/* Paging: Number of pagefaults currently being processed. (pgcPageFaultsActive) */
224 ULONG cPagingPhysPages; /* Paging: Count of physical pages. (hope this is correct) (pgPhysPages) */
225 ULONG ulPagingPhysMax; /* Paging: Top of physical memory (physical page number) (pgPhysMax) */
226 ULONG cPagingResidentPages; /* Paging: Count of resident pages. (pgResidentPages) */
227 ULONG cPagingSwappablePages; /* Paging: Count of swappable pages which is currently present in memory. (pgSwappablePages) */
228 ULONG cPagingDiscardableInmem;/* Paging: Count of discardable pages which is currently present in memory. (pgDiscardableInmem) */
229 ULONG cPagingDiscardablePages;/* Paging: Count of discardable pages allocated. (pgDiscardablePages) */
230
231 /* Virtual Memory manager info. */
232 ULONG ulAddressLimit; /* VM: Current user virtual address limit - use this for high arena check. (VirtualAddressLimit / 0x20000000) */
233 ULONG ulVMArenaPrivMax; /* VM: Current highest address in the private arena. (vmRecalcShrBound()) */
234 ULONG ulVMArenaSharedMin; /* VM: Current lowest address in the shared arena. (ahvmShr) */
235 ULONG ulVMArenaSharedMax; /* VM: Current highest address in the shared arena. (ahvmShr) */
236 ULONG ulVMArenaSystemMin; /* VM: Current lowest address in the system arena. (ahvmhSys) */
237 ULONG ulVMArenaSystemMax; /* VM: Current highest address in the system arena. (ahvmhSys) */
238 ULONG ulVMArenaHighPrivMax; /* VM: Current highest address in the high private arena - aurora/smp only. (vmRecalcShrBound) */
239 ULONG ulVMArenaHighSharedMin; /* VM: Current lowest address in the high shared arena - aurora/smp only. (ahvmhShr) */
240 ULONG ulVMArenaHighSharedMax; /* VM: Current highest address in the high shared arena - aurora/smp only. (ahvmhShr) */
241
242} K32SYSTEMMEMINFO, *PK32SYSTEMMEMINFO;
243
244
[4165]245/*
246 * K32 category parameter structs
247 */
248typedef struct _k32AllocMemEx
249{
250 PVOID pv; /* Pointer to allocated memory block */
251 /* On input this holds the suggested */
252 /* location of the block. */
253 ULONG cb; /* Blocksize (bytes) */
254 ULONG flFlags; /* Flags (equal to DosAllocMem flags) */
255 ULONG ulCS; /* Call CS */
256 ULONG ulEIP; /* Call EIP */
257 ULONG rc; /* Return code. */
258} K32ALLOCMEMEX, *PK32ALLOCMEMEX;
259
260typedef struct _k32QueryOTEs
261{
262 HMODULE hMTE; /* Module handle. */
263 PQOTEBUFFER pQOte; /* Pointer to output buffer. */
264 ULONG cbQOte; /* Size of the buffer pointed to by pQOte */
265 ULONG rc; /* Return code. */
266} K32QUERYOTES, *PK32QUERYOTES;
267
268typedef struct _k32QueryOptionsStatus
269{
270 PK32OPTIONS pOptions; /* Pointer to option struct. (NULL allowed) */
271 PK32STATUS pStatus; /* Pointer to status struct. (NULL allowed) */
272 ULONG rc; /* Return code. */
273} K32QUERYOPTIONSSTATUS, *PK32QUERYOPTIONSSTATUS;
274
275typedef struct _k32SetOptions
276{
277 PK32OPTIONS pOptions; /* Pointer to option struct. (NULL allowed) */
278 ULONG rc; /* Return code. */
279} K32SETOPTIONS, *PK32SETOPTIONS;
280
[4348]281typedef struct _k32ProcessReadWrite
282{
283 PID pid; /* Process ID of the process to access memory in. */
284 ULONG cb; /* Number of bytes to read or write. */
285 PVOID pvSource; /* Pointer to source data. */
286 PVOID pvTarget; /* Pointer to target area. */
287 BOOL fRead; /* TRUE: pvSource is within pid while pvTarget is ours. */
288 /* FALSE: pvTarget is within pid while pvSource is ours. */
289 ULONG rc; /* Return code. */
290} K32PROCESSREADWRITE, *PK32PROCESSREADWRITE;
[4165]291
[5052]292typedef struct _k32HandleSystemEvent
293{
294 ULONG ulEvent; /* Event identifier. One of the K32_SYSEVENT_ defines. */
295 HEV hev; /* Handle of shared event semaphore which should be */
296 /* posted when the the requested event occurs. */
297 BOOL fHandle; /* Action flag. */
298 /* TRUE: Take control of the event. */
299 /* FALSE: Give control back to the OS of this event. (hev must match the current handle!) */
300 ULONG rc; /* Return code. */
301} K32HANDLESYSTEMEVENT, *PK32HANDLESYSTEMEVENT;
[4348]302
[5112]303typedef struct _k32QuerySystemMemInfo
304{
305 PK32SYSTEMMEMINFO pMemInfo; /* Pointer to system memory info structure with cb set. */
306 /* The other members will be filled on successful return. */
307 APIRET rc; /* Return code. */
308} K32QUERYSYSTEMMEMINFO, *PK32QUERYSYSTEMMEMINFO;
[4348]309
[5112]310
[4165]311#pragma pack()
312
313#ifndef NO_WIN32K_LIB_FUNCTIONS
314/*******************************************************************************
315* External Functions *
316*******************************************************************************/
317/* Win32k APIs */
318APIRET APIENTRY libWin32kInit(void);
319APIRET APIENTRY libWin32kTerm(void);
320BOOL APIENTRY libWin32kInstalled(void);
321APIRET APIENTRY libWin32kQueryOptionsStatus(PK32OPTIONS pOptions, PK32STATUS pStatus);
322APIRET APIENTRY libWin32kSetOptions(PK32OPTIONS pOptions);
[4348]323APIRET APIENTRY libWin32kSetOption(PK32OPTIONS pOptions);
[4165]324
325/* "Extra OS2 APIs" */
326APIRET APIENTRY DosAllocMemEx(PPVOID ppv, ULONG cb, ULONG flag);
327APIRET APIENTRY W32kQueryOTEs(HMODULE hMTE, PQOTEBUFFER pQOte, ULONG cbQOte);
[5112]328APIRET APIENTRY W32kQuerySystemMemInfo(PK32SYSTEMMEMINFO pMemInfo);
[4348]329APIRET APIENTRY W32kProcessReadWrite(PID pid, ULONG cb, PVOID pvSource, PVOID pvTarget, BOOL fRead);
[5052]330APIRET APIENTRY W32kHandleSystemEvent(ULONG ulEvent, HEV hev, BOOL fHandle);
[4165]331
332/* Helper function */
333USHORT APIENTRY libHelperGetCS(void);
334
335
336#endif
337
[5052]338#endif /* !defined(INCL_16) */
339
[4165]340#endif
Note: See TracBrowser for help on using the repository browser.