Fix prototype of RtlCreateHeap and respect the CommitRoutine if passed. Also fix...
[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 #ifndef _NTIFS_
113 typedef NTSTATUS
114 (NTAPI * PRTL_HEAP_COMMIT_ROUTINE) (
115 IN PVOID Base,
116 IN OUT PVOID *CommitAddress,
117 IN OUT PSIZE_T CommitSize
118 );
119 #endif
120
121 /* TYPES *********************************************************************/
122
123 typedef unsigned short RTL_ATOM;
124 typedef unsigned short *PRTL_ATOM;
125
126 typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION;
127 typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION;
128 typedef struct _ACE
129 {
130 ACE_HEADER Header;
131 ACCESS_MASK AccessMask;
132 } ACE, *PACE;
133
134 /* FIXME: Review definitions and give these guys a better name */
135 typedef struct _DEBUG_BUFFER
136 {
137 HANDLE SectionHandle;
138 PVOID SectionBase;
139 PVOID RemoteSectionBase;
140 ULONG SectionBaseDelta;
141 HANDLE EventPairHandle;
142 ULONG Unknown[2];
143 HANDLE RemoteThreadHandle;
144 ULONG InfoClassMask;
145 ULONG SizeOfInfo;
146 ULONG AllocatedSize;
147 ULONG SectionSize;
148 PVOID ModuleInformation;
149 PVOID BackTraceInformation;
150 PVOID HeapInformation;
151 PVOID LockInformation;
152 PVOID Reserved[8];
153 } DEBUG_BUFFER, *PDEBUG_BUFFER;
154
155 typedef struct _DEBUG_MODULE_INFORMATION
156 {
157 ULONG Reserved[2];
158 PVOID Base;
159 ULONG Size;
160 ULONG Flags;
161 USHORT Index;
162 USHORT Unknown;
163 USHORT LoadCount;
164 USHORT ModuleNameOffset;
165 CHAR ImageName[256];
166 } DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
167
168 typedef struct _DEBUG_HEAP_INFORMATION
169 {
170 PVOID Base;
171 ULONG Flags;
172 USHORT Granularity;
173 USHORT Unknown;
174 ULONG Allocated;
175 ULONG Committed;
176 ULONG TagCount;
177 ULONG BlockCount;
178 ULONG Reserved[7];
179 PVOID Tags;
180 PVOID Blocks;
181 } DEBUG_HEAP_INFORMATION, *PDEBUG_HEAP_INFORMATION;
182
183 typedef struct _DEBUG_LOCK_INFORMATION
184 {
185 PVOID Address;
186 USHORT Type;
187 USHORT CreatorBackTraceIndex;
188 ULONG OwnerThreadId;
189 ULONG ActiveCount;
190 ULONG ContentionCount;
191 ULONG EntryCount;
192 ULONG RecursionCount;
193 ULONG NumberOfSharedWaiters;
194 ULONG NumberOfExclusiveWaiters;
195 } DEBUG_LOCK_INFORMATION, *PDEBUG_LOCK_INFORMATION;
196
197 typedef struct _RTL_HANDLE_TABLE_ENTRY
198 {
199 ULONG Flags;
200 struct _RTL_HANDLE_TABLE_ENTRY *NextFree;
201 } RTL_HANDLE_TABLE_ENTRY, *PRTL_HANDLE_TABLE_ENTRY;
202
203 typedef struct _RTL_HANDLE_TABLE
204 {
205 ULONG MaximumNumberOfHandles;
206 ULONG SizeOfHandleTableEntry;
207 ULONG Reserved[2];
208 PRTL_HANDLE_TABLE_ENTRY FreeHandles;
209 PRTL_HANDLE_TABLE_ENTRY CommittedHandles;
210 PRTL_HANDLE_TABLE_ENTRY UnCommittedHandles;
211 PRTL_HANDLE_TABLE_ENTRY MaxReservedHandles;
212 } RTL_HANDLE_TABLE, *PRTL_HANDLE_TABLE;
213
214 typedef struct _LOCK_INFORMATION
215 {
216 ULONG LockCount;
217 DEBUG_LOCK_INFORMATION LockEntry[1];
218 } LOCK_INFORMATION, *PLOCK_INFORMATION;
219
220 typedef struct _HEAP_INFORMATION
221 {
222 ULONG HeapCount;
223 DEBUG_HEAP_INFORMATION HeapEntry[1];
224 } HEAP_INFORMATION, *PHEAP_INFORMATION;
225
226 typedef struct _MODULE_INFORMATION
227 {
228 ULONG ModuleCount;
229 DEBUG_MODULE_INFORMATION ModuleEntry[1];
230 } MODULE_INFORMATION, *PMODULE_INFORMATION;
231 /* END REVIEW AREA */
232
233 #ifdef _INC_EXCPT
234 typedef struct _EXCEPTION_REGISTRATION
235 {
236 struct _EXCEPTION_REGISTRATION* prev;
237 PEXCEPTION_HANDLER handler;
238 } EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION;
239 #endif
240
241 typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD;
242 typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
243
244 typedef struct _CURDIR
245 {
246 UNICODE_STRING DosPath;
247 HANDLE Handle;
248 } CURDIR, *PCURDIR;
249
250 typedef struct RTL_DRIVE_LETTER_CURDIR
251 {
252 USHORT Flags;
253 USHORT Length;
254 ULONG TimeStamp;
255 UNICODE_STRING DosPath;
256 } RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
257
258 typedef struct _RTL_RANGE_LIST
259 {
260 LIST_ENTRY ListHead;
261 ULONG Flags; /* RTL_RANGE_LIST_... flags */
262 ULONG Count;
263 ULONG Stamp;
264 } RTL_RANGE_LIST, *PRTL_RANGE_LIST;
265
266 typedef struct _RTL_RANGE
267 {
268 ULONGLONG Start;
269 ULONGLONG End;
270 PVOID UserData;
271 PVOID Owner;
272 UCHAR Attributes;
273 UCHAR Flags; /* RTL_RANGE_... flags */
274 } RTL_RANGE, *PRTL_RANGE;
275
276 typedef BOOLEAN
277 (NTAPI *PRTL_CONFLICT_RANGE_CALLBACK) (
278 PVOID Context,
279 PRTL_RANGE Range
280 );
281
282 typedef struct _RTL_RESOURCE
283 {
284 RTL_CRITICAL_SECTION Lock;
285 HANDLE SharedSemaphore;
286 ULONG SharedWaiters;
287 HANDLE ExclusiveSemaphore;
288 ULONG ExclusiveWaiters;
289 LONG NumberActive;
290 HANDLE OwningThread;
291 ULONG TimeoutBoost; /* ?? */
292 PVOID DebugInfo; /* ?? */
293 } RTL_RESOURCE, *PRTL_RESOURCE;
294
295 typedef struct _RANGE_LIST_ITERATOR
296 {
297 PLIST_ENTRY RangeListHead;
298 PLIST_ENTRY MergedHead;
299 PVOID Current;
300 ULONG Stamp;
301 } RTL_RANGE_LIST_ITERATOR, *PRTL_RANGE_LIST_ITERATOR;
302
303 typedef struct _RTL_MESSAGE_RESOURCE_ENTRY
304 {
305 USHORT Length;
306 USHORT Flags;
307 CHAR Text[1];
308 } RTL_MESSAGE_RESOURCE_ENTRY, *PRTL_MESSAGE_RESOURCE_ENTRY;
309
310 typedef struct _RTL_MESSAGE_RESOURCE_BLOCK
311 {
312 ULONG LowId;
313 ULONG HighId;
314 ULONG OffsetToEntries;
315 } RTL_MESSAGE_RESOURCE_BLOCK, *PRTL_MESSAGE_RESOURCE_BLOCK;
316
317 typedef struct _RTL_MESSAGE_RESOURCE_DATA
318 {
319 ULONG NumberOfBlocks;
320 RTL_MESSAGE_RESOURCE_BLOCK Blocks[1];
321 } RTL_MESSAGE_RESOURCE_DATA, *PRTL_MESSAGE_RESOURCE_DATA;
322
323 typedef struct _NLS_FILE_HEADER
324 {
325 USHORT HeaderSize;
326 USHORT CodePage;
327 USHORT MaximumCharacterSize; /* SBCS = 1, DBCS = 2 */
328 USHORT DefaultChar;
329 USHORT UniDefaultChar;
330 USHORT TransDefaultChar;
331 USHORT TransUniDefaultChar;
332 USHORT DBCSCodePage;
333 UCHAR LeadByte[MAXIMUM_LEADBYTES];
334 } NLS_FILE_HEADER, *PNLS_FILE_HEADER;
335
336 typedef struct _RTL_USER_PROCESS_PARAMETERS
337 {
338 ULONG MaximumLength;
339 ULONG Length;
340 ULONG Flags;
341 ULONG DebugFlags;
342 HANDLE ConsoleHandle;
343 ULONG ConsoleFlags;
344 HANDLE StandardInput;
345 HANDLE StandardOutput;
346 HANDLE StandardError;
347 CURDIR CurrentDirectory;
348 UNICODE_STRING DllPath;
349 UNICODE_STRING ImagePathName;
350 UNICODE_STRING CommandLine;
351 PWSTR Environment;
352 ULONG StartingX;
353 ULONG StartingY;
354 ULONG CountX;
355 ULONG CountY;
356 ULONG CountCharsX;
357 ULONG CountCharsY;
358 ULONG FillAttribute;
359 ULONG WindowFlags;
360 ULONG ShowWindowFlags;
361 UNICODE_STRING WindowTitle;
362 UNICODE_STRING DesktopInfo;
363 UNICODE_STRING ShellInfo;
364 UNICODE_STRING RuntimeData;
365 RTL_DRIVE_LETTER_CURDIR CurrentDirectories[32];
366 } RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
367
368 typedef struct _RTL_USER_PROCESS_INFORMATION
369 {
370 ULONG Size;
371 HANDLE ProcessHandle;
372 HANDLE ThreadHandle;
373 CLIENT_ID ClientId;
374 SECTION_IMAGE_INFORMATION ImageInformation;
375 } RTL_USER_PROCESS_INFORMATION, *PRTL_USER_PROCESS_INFORMATION;
376
377 typedef struct _RTL_ATOM_TABLE_ENTRY
378 {
379 struct _RTL_ATOM_TABLE_ENTRY *HashLink;
380 USHORT HandleIndex;
381 USHORT Atom;
382 USHORT ReferenceCount;
383 UCHAR Flags;
384 UCHAR NameLength;
385 WCHAR Name[1];
386 } RTL_ATOM_TABLE_ENTRY, *PRTL_ATOM_TABLE_ENTRY;
387
388 typedef struct _RTL_ATOM_TABLE
389 {
390 ULONG Signature;
391 union
392 {
393 RTL_CRITICAL_SECTION CriticalSection;
394 FAST_MUTEX FastMutex;
395 };
396 union
397 {
398 RTL_HANDLE_TABLE RtlHandleTable;
399 PHANDLE_TABLE ExHandleTable;
400 };
401 ULONG NumberOfBuckets;
402 PRTL_ATOM_TABLE_ENTRY Buckets[1];
403 } RTL_ATOM_TABLE, *PRTL_ATOM_TABLE;
404
405 #ifndef _NTIFS_
406 typedef struct _RTL_HEAP_PARAMETERS {
407 ULONG Length;
408 SIZE_T SegmentReserve;
409 SIZE_T SegmentCommit;
410 SIZE_T DeCommitFreeBlockThreshold;
411 SIZE_T DeCommitTotalFreeThreshold;
412 SIZE_T MaximumAllocationSize;
413 SIZE_T VirtualMemoryThreshold;
414 SIZE_T InitialCommit;
415 SIZE_T InitialReserve;
416 PRTL_HEAP_COMMIT_ROUTINE CommitRoutine;
417 SIZE_T Reserved[2];
418 } RTL_HEAP_PARAMETERS, *PRTL_HEAP_PARAMETERS;
419 #endif
420
421 /* Let Kernel Drivers use this */
422 #ifndef _WINBASE_
423 typedef struct _SYSTEMTIME
424 {
425 WORD wYear;
426 WORD wMonth;
427 WORD wDayOfWeek;
428 WORD wDay;
429 WORD wHour;
430 WORD wMinute;
431 WORD wSecond;
432 WORD wMilliseconds;
433 } SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
434
435 typedef struct _TIME_ZONE_INFORMATION
436 {
437 LONG Bias;
438 WCHAR StandardName[32];
439 SYSTEMTIME StandardDate;
440 LONG StandardBias;
441 WCHAR DaylightName[32];
442 SYSTEMTIME DaylightDate;
443 LONG DaylightBias;
444 } TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
445
446 typedef enum _ACL_INFORMATION_CLASS
447 {
448 AclRevisionInformation = 1,
449 AclSizeInformation
450 } ACL_INFORMATION_CLASS;
451
452 #define TIME_ZONE_ID_UNKNOWN 0
453 #define TIME_ZONE_ID_STANDARD 1
454 #define TIME_ZONE_ID_DAYLIGHT 2
455 #define TIME_ZONE_ID_INVALID 0xFFFFFFFF
456 #endif
457
458 #endif