source: trunk/include/win32k.h@ 5178

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

Added DosAllocMemEx flags.

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