e1542ceeb9b70b6834fb9c2f4b1db7a7ba69b0c8
[reactos.git] / reactos / include / ndk / rtltypes.h
1 /*
2 * PROJECT: ReactOS Native Headers
3 * FILE: include/ndk/rtltypes.h
4 * PURPOSE: Defintions for Runtime Library Types not defined in DDK/IFS
5 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
6 * UPDATE HISTORY:
7 * Created 06/10/04
8 */
9 #ifndef _RTLTYPES_H
10 #define _RTLTYPES_H
11
12 /* DEPENDENCIES **************************************************************/
13 #include "zwtypes.h"
14 #include "excpt.h"
15
16 /* EXPORTED DATA *************************************************************/
17
18 /* CONSTANTS *****************************************************************/
19 #define MAXIMUM_LEADBYTES 12
20
21 #define PPF_NORMALIZED 0x01
22 #define PPF_PROFILE_USER 0x02
23 #define PPF_PROFILE_SERVER 0x04
24 #define PPF_PROFILE_KERNEL 0x08
25
26 #define PPF_RESERVE_1MB 0x20
27 #define PPF_DISABLE_HEAP_CHECKS 0x100
28 #define PPF_PROCESS_OR_1 0x200
29 #define PPF_PROCESS_OR_2 0x400
30
31 #define PEB_BASE (0x7FFDF000)
32
33 #define EXCEPTION_CONTINUE_SEARCH 0
34 #define EXCEPTION_EXECUTE_HANDLER 1
35
36 #define EXCEPTION_UNWINDING 0x02
37 #define EXCEPTION_EXIT_UNWIND 0x04
38 #define EXCEPTION_STACK_INVALID 0x8
39 #define EXCEPTION_NESTED_CALL 0x10
40 #define EXCEPTION_TARGET_UNWIND 0x20
41 #define EXCEPTION_COLLIDED_UNWIND 0x20
42
43 #define EH_NONCONTINUABLE 0x01
44 #define EH_UNWINDING 0x02
45 #define EH_EXIT_UNWIND 0x04
46 #define EH_STACK_INVALID 0x08
47 #define EH_NESTED_CALL 0x10
48
49 #define RTL_RANGE_LIST_ADD_IF_CONFLICT 0x00000001
50 #define RTL_RANGE_LIST_ADD_SHARED 0x00000002
51
52 #define RTL_RANGE_SHARED 0x01
53 #define RTL_RANGE_CONFLICT 0x02
54
55 /* FIXME: Rename these */
56 #define PDI_MODULES 0x01 /* The loaded modules of the process */
57 #define PDI_BACKTRACE 0x02 /* The heap stack back traces */
58 #define PDI_HEAPS 0x04 /* The heaps of the process */
59 #define PDI_HEAP_TAGS 0x08 /* The heap tags */
60 #define PDI_HEAP_BLOCKS 0x10 /* The heap blocks */
61 #define PDI_LOCKS 0x20 /* The locks created by the process */
62
63 /* RTL Handle Flags */
64 #define RTL_HANDLE_VALID 0x1
65
66 /* RTL Atom Flags */
67 #define RTL_ATOM_IS_PINNED 0x1
68
69 /* ENUMERATIONS **************************************************************/
70
71 typedef enum
72 {
73 INVALID_PATH = 0,
74 UNC_PATH, /* "//foo" */
75 ABSOLUTE_DRIVE_PATH, /* "c:/foo" */
76 RELATIVE_DRIVE_PATH, /* "c:foo" */
77 ABSOLUTE_PATH, /* "/foo" */
78 RELATIVE_PATH, /* "foo" */
79 DEVICE_PATH, /* "//./foo" */
80 UNC_DOT_PATH /* "//." */
81 } DOS_PATHNAME_TYPE;
82
83 /* FUNCTION TYPES ************************************************************/
84 typedef NTSTATUS
85 (*PHEAP_ENUMERATION_ROUTINE)(
86 IN PVOID HeapHandle,
87 IN PVOID UserParam
88 );
89
90 typedef EXCEPTION_DISPOSITION
91 (*PEXCEPTION_HANDLER)(
92 struct _EXCEPTION_RECORD*,
93 PVOID,
94 struct _CONTEXT*,
95 PVOID
96 );
97
98 typedef LONG (NTAPI *PVECTORED_EXCEPTION_HANDLER)(
99 PEXCEPTION_POINTERS ExceptionPointers
100 );
101
102 typedef DWORD (NTAPI *PTHREAD_START_ROUTINE)(
103 LPVOID Parameter
104 );
105
106 typedef VOID
107 (NTAPI *PRTL_BASE_PROCESS_START_ROUTINE)(
108 PTHREAD_START_ROUTINE StartAddress,
109 PVOID Parameter
110 );
111
112 /* TYPES *********************************************************************/
113
114 typedef unsigned short RTL_ATOM;
115 typedef unsigned short *PRTL_ATOM;
116
117 typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION;
118 typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION;
119 typedef struct _ACE
120 {
121 ACE_HEADER Header;
122 ACCESS_MASK AccessMask;
123 } ACE, *PACE;
124
125 /* FIXME: Review definitions and give these guys a better name */
126 typedef struct _DEBUG_BUFFER
127 {
128 HANDLE SectionHandle;
129 PVOID SectionBase;
130 PVOID RemoteSectionBase;
131 ULONG SectionBaseDelta;
132 HANDLE EventPairHandle;
133 ULONG Unknown[2];
134 HANDLE RemoteThreadHandle;
135 ULONG InfoClassMask;
136 ULONG SizeOfInfo;
137 ULONG AllocatedSize;
138 ULONG SectionSize;
139 PVOID ModuleInformation;
140 PVOID BackTraceInformation;
141 PVOID HeapInformation;
142 PVOID LockInformation;
143 PVOID Reserved[8];
144 } DEBUG_BUFFER, *PDEBUG_BUFFER;
145
146 typedef struct _DEBUG_MODULE_INFORMATION
147 {
148 ULONG Reserved[2];
149 PVOID Base;
150 ULONG Size;
151 ULONG Flags;
152 USHORT Index;
153 USHORT Unknown;
154 USHORT LoadCount;
155 USHORT ModuleNameOffset;
156 CHAR ImageName[256];
157 } DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
158
159 typedef struct _DEBUG_HEAP_INFORMATION
160 {
161 PVOID Base;
162 ULONG Flags;
163 USHORT Granularity;
164 USHORT Unknown;
165 ULONG Allocated;
166 ULONG Committed;
167 ULONG TagCount;
168 ULONG BlockCount;
169 ULONG Reserved[7];
170 PVOID Tags;
171 PVOID Blocks;
172 } DEBUG_HEAP_INFORMATION, *PDEBUG_HEAP_INFORMATION;
173
174 typedef struct _DEBUG_LOCK_INFORMATION
175 {
176 PVOID Address;
177 USHORT Type;
178 USHORT CreatorBackTraceIndex;
179 ULONG OwnerThreadId;
180 ULONG ActiveCount;
181 ULONG ContentionCount;
182 ULONG EntryCount;
183 ULONG RecursionCount;
184 ULONG NumberOfSharedWaiters;
185 ULONG NumberOfExclusiveWaiters;
186 } DEBUG_LOCK_INFORMATION, *PDEBUG_LOCK_INFORMATION;
187
188 typedef struct _RTL_HANDLE_TABLE_ENTRY
189 {
190 ULONG Flags;
191 struct _RTL_HANDLE_TABLE_ENTRY *NextFree;
192 } RTL_HANDLE_TABLE_ENTRY, *PRTL_HANDLE_TABLE_ENTRY;
193
194 typedef struct _RTL_HANDLE_TABLE
195 {
196 ULONG MaximumNumberOfHandles;
197 ULONG SizeOfHandleTableEntry;
198 ULONG Reserved[2];
199 PRTL_HANDLE_TABLE_ENTRY FreeHandles;
200 PRTL_HANDLE_TABLE_ENTRY CommittedHandles;
201 PRTL_HANDLE_TABLE_ENTRY UnCommittedHandles;
202 PRTL_HANDLE_TABLE_ENTRY MaxReservedHandles;
203 } RTL_HANDLE_TABLE, *PRTL_HANDLE_TABLE;
204
205 typedef struct _LOCK_INFORMATION
206 {
207 ULONG LockCount;
208 DEBUG_LOCK_INFORMATION LockEntry[1];
209 } LOCK_INFORMATION, *PLOCK_INFORMATION;
210
211 typedef struct _HEAP_INFORMATION
212 {
213 ULONG HeapCount;
214 DEBUG_HEAP_INFORMATION HeapEntry[1];
215 } HEAP_INFORMATION, *PHEAP_INFORMATION;
216
217 typedef struct _MODULE_INFORMATION
218 {
219 ULONG ModuleCount;
220 DEBUG_MODULE_INFORMATION ModuleEntry[1];
221 } MODULE_INFORMATION, *PMODULE_INFORMATION;
222
223 typedef struct _RTL_HEAP_DEFINITION
224 {
225 ULONG Length;
226 ULONG Unknown[11];
227 } RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
228 /* END REVIEW AREA */
229
230 #ifdef _INC_EXCPT
231 typedef struct _EXCEPTION_REGISTRATION
232 {
233 struct _EXCEPTION_REGISTRATION* prev;
234 PEXCEPTION_HANDLER handler;
235 } EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION;
236 #endif
237
238 typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD;
239 typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
240
241 typedef struct _CURDIR
242 {
243 UNICODE_STRING DosPath;
244 HANDLE Handle;
245 } CURDIR, *PCURDIR;
246
247 typedef struct RTL_DRIVE_LETTER_CURDIR
248 {
249 USHORT Flags;
250 USHORT Length;
251 ULONG TimeStamp;
252 UNICODE_STRING DosPath;
253 } RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
254
255 typedef struct _RTL_RANGE_LIST
256 {
257 LIST_ENTRY ListHead;
258 ULONG Flags; /* RTL_RANGE_LIST_... flags */
259 ULONG Count;
260 ULONG Stamp;
261 } RTL_RANGE_LIST, *PRTL_RANGE_LIST;
262
263 typedef struct _RTL_RANGE
264 {
265 ULONGLONG Start;
266 ULONGLONG End;
267 PVOID UserData;
268 PVOID Owner;
269 UCHAR Attributes;
270 UCHAR Flags; /* RTL_RANGE_... flags */
271 } RTL_RANGE, *PRTL_RANGE;
272
273 typedef BOOLEAN
274 (NTAPI *PRTL_CONFLICT_RANGE_CALLBACK) (
275 PVOID Context,
276 PRTL_RANGE Range
277 );
278
279 typedef struct _RTL_RESOURCE
280 {
281 RTL_CRITICAL_SECTION Lock;
282 HANDLE SharedSemaphore;
283 ULONG SharedWaiters;
284 HANDLE ExclusiveSemaphore;
285 ULONG ExclusiveWaiters;
286 LONG NumberActive;
287 HANDLE OwningThread;
288 ULONG TimeoutBoost; /* ?? */
289 PVOID DebugInfo; /* ?? */
290 } RTL_RESOURCE, *PRTL_RESOURCE;
291
292 typedef struct _RANGE_LIST_ITERATOR
293 {
294 PLIST_ENTRY RangeListHead;
295 PLIST_ENTRY MergedHead;
296 PVOID Current;
297 ULONG Stamp;
298 } RTL_RANGE_LIST_ITERATOR, *PRTL_RANGE_LIST_ITERATOR;
299
300 typedef struct _RTL_MESSAGE_RESOURCE_ENTRY
301 {
302 USHORT Length;
303 USHORT Flags;
304 CHAR Text[1];
305 } RTL_MESSAGE_RESOURCE_ENTRY, *PRTL_MESSAGE_RESOURCE_ENTRY;
306
307 typedef struct _RTL_MESSAGE_RESOURCE_BLOCK
308 {
309 ULONG LowId;
310 ULONG HighId;
311 ULONG OffsetToEntries;
312 } RTL_MESSAGE_RESOURCE_BLOCK, *PRTL_MESSAGE_RESOURCE_BLOCK;
313
314 typedef struct _RTL_MESSAGE_RESOURCE_DATA
315 {
316 ULONG NumberOfBlocks;
317 RTL_MESSAGE_RESOURCE_BLOCK Blocks[1];
318 } RTL_MESSAGE_RESOURCE_DATA, *PRTL_MESSAGE_RESOURCE_DATA;
319
320 typedef struct _NLS_FILE_HEADER
321 {
322 USHORT HeaderSize;
323 USHORT CodePage;
324 USHORT MaximumCharacterSize; /* SBCS = 1, DBCS = 2 */
325 USHORT DefaultChar;
326 USHORT UniDefaultChar;
327 USHORT TransDefaultChar;
328 USHORT TransUniDefaultChar;
329 USHORT DBCSCodePage;
330 UCHAR LeadByte[MAXIMUM_LEADBYTES];
331 } NLS_FILE_HEADER, *PNLS_FILE_HEADER;
332
333 typedef struct _RTL_USER_PROCESS_PARAMETERS
334 {
335 ULONG MaximumLength;
336 ULONG Length;
337 ULONG Flags;
338 ULONG DebugFlags;
339 HANDLE ConsoleHandle;
340 ULONG ConsoleFlags;
341 HANDLE StandardInput;
342 HANDLE StandardOutput;
343 HANDLE StandardError;
344 CURDIR CurrentDirectory;
345 UNICODE_STRING DllPath;
346 UNICODE_STRING ImagePathName;
347 UNICODE_STRING CommandLine;
348 PWSTR Environment;
349 ULONG StartingX;
350 ULONG StartingY;
351 ULONG CountX;
352 ULONG CountY;
353 ULONG CountCharsX;
354 ULONG CountCharsY;
355 ULONG FillAttribute;
356 ULONG WindowFlags;
357 ULONG ShowWindowFlags;
358 UNICODE_STRING WindowTitle;
359 UNICODE_STRING DesktopInfo;
360 UNICODE_STRING ShellInfo;
361 UNICODE_STRING RuntimeData;
362 RTL_DRIVE_LETTER_CURDIR CurrentDirectories[32];
363 } RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
364
365 typedef struct _RTL_USER_PROCESS_INFORMATION
366 {
367 ULONG Size;
368 HANDLE ProcessHandle;
369 HANDLE ThreadHandle;
370 CLIENT_ID ClientId;
371 SECTION_IMAGE_INFORMATION ImageInformation;
372 } RTL_USER_PROCESS_INFORMATION, *PRTL_USER_PROCESS_INFORMATION;
373
374 typedef struct _RTL_ATOM_TABLE_ENTRY
375 {
376 struct _RTL_ATOM_TABLE_ENTRY *HashLink;
377 USHORT HandleIndex;
378 USHORT Atom;
379 USHORT ReferenceCount;
380 UCHAR Flags;
381 UCHAR NameLength;
382 WCHAR Name[1];
383 } RTL_ATOM_TABLE_ENTRY, *PRTL_ATOM_TABLE_ENTRY;
384
385 typedef struct _RTL_ATOM_TABLE
386 {
387 ULONG Signature;
388 union
389 {
390 RTL_CRITICAL_SECTION CriticalSection;
391 FAST_MUTEX FastMutex;
392 };
393 union
394 {
395 RTL_HANDLE_TABLE RtlHandleTable;
396 PHANDLE_TABLE ExHandleTable;
397 };
398 ULONG NumberOfBuckets;
399 PRTL_ATOM_TABLE_ENTRY Buckets[1];
400 } RTL_ATOM_TABLE, *PRTL_ATOM_TABLE;
401
402 /* Let Kernel Drivers use this */
403 #ifndef _WINBASE_
404 typedef struct _SYSTEMTIME
405 {
406 WORD wYear;
407 WORD wMonth;
408 WORD wDayOfWeek;
409 WORD wDay;
410 WORD wHour;
411 WORD wMinute;
412 WORD wSecond;
413 WORD wMilliseconds;
414 } SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
415
416 typedef struct _TIME_ZONE_INFORMATION
417 {
418 LONG Bias;
419 WCHAR StandardName[32];
420 SYSTEMTIME StandardDate;
421 LONG StandardBias;
422 WCHAR DaylightName[32];
423 SYSTEMTIME DaylightDate;
424 LONG DaylightBias;
425 } TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
426
427 typedef enum _ACL_INFORMATION_CLASS
428 {
429 AclRevisionInformation = 1,
430 AclSizeInformation
431 } ACL_INFORMATION_CLASS;
432
433 #define TIME_ZONE_ID_UNKNOWN 0
434 #define TIME_ZONE_ID_STANDARD 1
435 #define TIME_ZONE_ID_DAYLIGHT 2
436 #define TIME_ZONE_ID_INVALID 0xFFFFFFFF
437 #endif
438
439 #endif