1 | /* $Id: win32k.h,v 1.2 2000-10-01 02:59:18 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 | #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
|
---|
30 | #define K32_PROCESSREADWRITE 0x05
|
---|
31 |
|
---|
32 | /*
|
---|
33 | * Elf category
|
---|
34 | */
|
---|
35 | #define ELF_DUMMY 0x01
|
---|
36 |
|
---|
37 |
|
---|
38 | /*******************************************************************************
|
---|
39 | * Structures and Typedefs *
|
---|
40 | *******************************************************************************/
|
---|
41 | #pragma pack(1)
|
---|
42 |
|
---|
43 | /*
|
---|
44 | * Object Table Entry buffer.
|
---|
45 | */
|
---|
46 | typedef struct _QueryOTE
|
---|
47 | {
|
---|
48 | ULONG ote_size; /* Object virtual size */
|
---|
49 | ULONG ote_base; /* Object base virtual address */
|
---|
50 | ULONG ote_flags; /* Attribute flags */
|
---|
51 | ULONG ote_pagemap; /* Object page map index */
|
---|
52 | ULONG ote_mapsize; /* Num of entries in obj page map */
|
---|
53 | /*ULONG ote_reserved;*/
|
---|
54 | USHORT ote_sel; /* Object Selector */
|
---|
55 | USHORT ote_hob; /* Object Handle */
|
---|
56 | } QOTE, *PQOTE;
|
---|
57 |
|
---|
58 | typedef struct _QueryOTEBuffer
|
---|
59 | {
|
---|
60 | ULONG cOTEs; /* Number of entries in aOTE. */
|
---|
61 | QOTE aOTE[1]; /* Array of OTEs. */
|
---|
62 | } QOTEBUFFER, *PQOTEBUFFER;
|
---|
63 |
|
---|
64 |
|
---|
65 | /*
|
---|
66 | * Options struct.
|
---|
67 | *
|
---|
68 | * (The function of these members are described in options.h in
|
---|
69 | * the src\win32k\include directory.)
|
---|
70 | * All members of this struct (except cb ofcourse) is changable.
|
---|
71 | */
|
---|
72 | typedef struct _K32Options
|
---|
73 | {
|
---|
74 | ULONG cb;
|
---|
75 |
|
---|
76 | /** @cat logging options */
|
---|
77 | USHORT usCom; /* Output port no. */
|
---|
78 | ULONG fLogging; /* Logging. */
|
---|
79 |
|
---|
80 | /** @cat Options affecting the generated LX executables */
|
---|
81 | ULONG fPE; /* Flags set the type of conversion. */
|
---|
82 | ULONG ulInfoLevel; /* Pe2Lx InfoLevel. */
|
---|
83 |
|
---|
84 | /** @cat Options affecting the generated ELF executables */
|
---|
85 | ULONG fElf; /* Elf flags. */
|
---|
86 |
|
---|
87 | /** @cat Options affecting the UNIX script executables */
|
---|
88 | ULONG fUNIXScript; /* UNIX script flags. */
|
---|
89 |
|
---|
90 | /** @cat Options affecting the REXX script executables */
|
---|
91 | ULONG fREXXScript; /* REXX script flags. */
|
---|
92 |
|
---|
93 | /** @cat Options affecting the JAVA executables */
|
---|
94 | ULONG fJava; /* Java flags. */
|
---|
95 |
|
---|
96 | /** @cat Options affecting the executables */
|
---|
97 | ULONG fNoLoader; /* No loader stuff. !FIXME! We should import / functions even if this flag is set!!! */
|
---|
98 |
|
---|
99 | /** @cat Options affecting the heap. */
|
---|
100 | ULONG cbSwpHeapMax; /* Maximum heapsize. */
|
---|
101 | ULONG cbResHeapMax; /* Maxiumem residentheapsize. */
|
---|
102 | } K32OPTIONS, *PK32OPTIONS;
|
---|
103 |
|
---|
104 |
|
---|
105 | /*
|
---|
106 | * Status struct.
|
---|
107 | *
|
---|
108 | */
|
---|
109 | typedef struct _K32Status
|
---|
110 | {
|
---|
111 | ULONG cb;
|
---|
112 |
|
---|
113 | /** @cat Options status. */
|
---|
114 | ULONG fQuiet; /* Quiet initialization. */
|
---|
115 |
|
---|
116 | /** @cat Kernel status. */
|
---|
117 | ULONG fKernel; /* Smp or uni kernel. */
|
---|
118 | ULONG ulBuild; /* Kernel build. */
|
---|
119 | USHORT usVerMajor; /* OS/2 major ver - 20 */
|
---|
120 | USHORT usVerMinor; /* OS/2 minor ver - 30,40 */
|
---|
121 |
|
---|
122 | /** @cat Heap status. */
|
---|
123 | ULONG cbSwpHeapInit; /* Initial heapsize. */
|
---|
124 | ULONG cbSwpHeapFree; /* Amount of used space. */
|
---|
125 | ULONG cbSwpHeapUsed; /* Amount of free space reserved. */
|
---|
126 | ULONG cbSwpHeapSize; /* Amount of memory used by the heap free and used++. */
|
---|
127 | ULONG cSwpBlocksUsed; /* Count of used blocks. */
|
---|
128 | ULONG cSwpBlocksFree; /* Count of free blocks. */
|
---|
129 |
|
---|
130 | ULONG cbResHeapInit; /* Initial heapsize. */
|
---|
131 | ULONG cbResHeapFree; /* Amount of free space reserved. */
|
---|
132 | ULONG cbResHeapUsed; /* Amount of used space. */
|
---|
133 | ULONG cbResHeapSize; /* Amount of memory used by the heap free and used++. */
|
---|
134 | ULONG cResBlocksUsed; /* Count of used blocks. */
|
---|
135 | ULONG cResBlocksFree; /* Count of free blocks. */
|
---|
136 |
|
---|
137 | /** @cat Win32k build, version and init stuff */
|
---|
138 | CHAR szBuildDate[12]; /* Date of the win32k build. (Sep 02 2000) */
|
---|
139 | CHAR szBuildTime[9]; /* Time of the win32k build. (11:44:21) */
|
---|
140 | ULONG ulVersion; /* Win32k version */
|
---|
141 | CHAR szSymFile[CCHMAXPATH]; /* The name of the symbol file or sym database. */
|
---|
142 |
|
---|
143 | /** @cat Statistics */
|
---|
144 | ULONG cPe2LxModules; /* Number of Pe2Lx modules currently loaded. */
|
---|
145 | ULONG cElf2LxModules; /* Number of Elf2Lx modules currently loaded. */
|
---|
146 | /*...*/
|
---|
147 | } K32STATUS, *PK32STATUS;
|
---|
148 |
|
---|
149 |
|
---|
150 |
|
---|
151 | /*
|
---|
152 | * K32 category parameter structs
|
---|
153 | */
|
---|
154 | typedef struct _k32AllocMemEx
|
---|
155 | {
|
---|
156 | PVOID pv; /* Pointer to allocated memory block */
|
---|
157 | /* On input this holds the suggested */
|
---|
158 | /* location of the block. */
|
---|
159 | ULONG cb; /* Blocksize (bytes) */
|
---|
160 | ULONG flFlags; /* Flags (equal to DosAllocMem flags) */
|
---|
161 | ULONG ulCS; /* Call CS */
|
---|
162 | ULONG ulEIP; /* Call EIP */
|
---|
163 | ULONG rc; /* Return code. */
|
---|
164 | } K32ALLOCMEMEX, *PK32ALLOCMEMEX;
|
---|
165 |
|
---|
166 | typedef struct _k32QueryOTEs
|
---|
167 | {
|
---|
168 | HMODULE hMTE; /* Module handle. */
|
---|
169 | PQOTEBUFFER pQOte; /* Pointer to output buffer. */
|
---|
170 | ULONG cbQOte; /* Size of the buffer pointed to by pQOte */
|
---|
171 | ULONG rc; /* Return code. */
|
---|
172 | } K32QUERYOTES, *PK32QUERYOTES;
|
---|
173 |
|
---|
174 | typedef struct _k32QueryOptionsStatus
|
---|
175 | {
|
---|
176 | PK32OPTIONS pOptions; /* Pointer to option struct. (NULL allowed) */
|
---|
177 | PK32STATUS pStatus; /* Pointer to status struct. (NULL allowed) */
|
---|
178 | ULONG rc; /* Return code. */
|
---|
179 | } K32QUERYOPTIONSSTATUS, *PK32QUERYOPTIONSSTATUS;
|
---|
180 |
|
---|
181 | typedef struct _k32SetOptions
|
---|
182 | {
|
---|
183 | PK32OPTIONS pOptions; /* Pointer to option struct. (NULL allowed) */
|
---|
184 | ULONG rc; /* Return code. */
|
---|
185 | } K32SETOPTIONS, *PK32SETOPTIONS;
|
---|
186 |
|
---|
187 | typedef struct _k32ProcessReadWrite
|
---|
188 | {
|
---|
189 | PID pid; /* Process ID of the process to access memory in. */
|
---|
190 | ULONG cb; /* Number of bytes to read or write. */
|
---|
191 | PVOID pvSource; /* Pointer to source data. */
|
---|
192 | PVOID pvTarget; /* Pointer to target area. */
|
---|
193 | BOOL fRead; /* TRUE: pvSource is within pid while pvTarget is ours. */
|
---|
194 | /* FALSE: pvTarget is within pid while pvSource is ours. */
|
---|
195 | ULONG rc; /* Return code. */
|
---|
196 | } K32PROCESSREADWRITE, *PK32PROCESSREADWRITE;
|
---|
197 |
|
---|
198 |
|
---|
199 |
|
---|
200 | #pragma pack()
|
---|
201 |
|
---|
202 | #ifndef NO_WIN32K_LIB_FUNCTIONS
|
---|
203 | /*******************************************************************************
|
---|
204 | * External Functions *
|
---|
205 | *******************************************************************************/
|
---|
206 | /* Win32k APIs */
|
---|
207 | APIRET APIENTRY libWin32kInit(void);
|
---|
208 | APIRET APIENTRY libWin32kTerm(void);
|
---|
209 | BOOL APIENTRY libWin32kInstalled(void);
|
---|
210 | APIRET APIENTRY libWin32kQueryOptionsStatus(PK32OPTIONS pOptions, PK32STATUS pStatus);
|
---|
211 | APIRET APIENTRY libWin32kSetOptions(PK32OPTIONS pOptions);
|
---|
212 | APIRET APIENTRY libWin32kSetOption(PK32OPTIONS pOptions);
|
---|
213 |
|
---|
214 | /* "Extra OS2 APIs" */
|
---|
215 | APIRET APIENTRY DosAllocMemEx(PPVOID ppv, ULONG cb, ULONG flag);
|
---|
216 | APIRET APIENTRY W32kQueryOTEs(HMODULE hMTE, PQOTEBUFFER pQOte, ULONG cbQOte);
|
---|
217 | APIRET APIENTRY W32kProcessReadWrite(PID pid, ULONG cb, PVOID pvSource, PVOID pvTarget, BOOL fRead);
|
---|
218 |
|
---|
219 | /* Helper function */
|
---|
220 | USHORT APIENTRY libHelperGetCS(void);
|
---|
221 |
|
---|
222 |
|
---|
223 | #endif
|
---|
224 |
|
---|
225 | #endif
|
---|