7674f095b3823c43ae0741814bacc57bb776d225
[reactos.git] / reactos / include / ntos / rtltypes.h
1 /* $Id$
2 *
3 */
4
5 #ifndef __DDK_RTLTYPES_H
6 #define __DDK_RTLTYPES_H
7
8 #ifndef __USE_W32API
9
10 #define COMPRESSION_FORMAT_NONE 0x0000
11 #define COMPRESSION_FORMAT_DEFAULT 0x0001
12 #define COMPRESSION_FORMAT_LZNT1 0x0002
13
14 #define COMPRESSION_ENGINE_STANDARD 0x0000
15 #define COMPRESSION_ENGINE_MAXIMUM 0x0100
16 #define COMPRESSION_ENGINE_HIBER 0x0200
17 /*
18 #define VER_EQUAL 1
19 #define VER_GREATER 2
20 #define VER_GREATER_EQUAL 3
21 #define VER_LESS 4
22 #define VER_LESS_EQUAL 5
23 #define VER_AND 6
24 #define VER_OR 7
25
26 #define VER_CONDITION_MASK 7
27 #define VER_NUM_BITS_PER_CONDITION_MASK 3
28
29 #define VER_MINORVERSION 0x0000001
30 #define VER_MAJORVERSION 0x0000002
31 #define VER_BUILDNUMBER 0x0000004
32 #define VER_PLATFORMID 0x0000008
33 #define VER_SERVICEPACKMINOR 0x0000010
34 #define VER_SERVICEPACKMAJOR 0x0000020
35 #define VER_SUITENAME 0x0000040
36 #define VER_PRODUCT_TYPE 0x0000080
37
38 #define VER_NT_WORKSTATION 0x0000001
39 #define VER_NT_DOMAIN_CONTROLLER 0x0000002
40 #define VER_NT_SERVER 0x0000003
41 */
42
43 typedef struct _CONTROLLER_OBJECT
44 {
45 CSHORT Type;
46 CSHORT Size;
47 PVOID ControllerExtension;
48 KDEVICE_QUEUE DeviceWaitQueue;
49 ULONG Spare1;
50 LARGE_INTEGER Spare2;
51 } CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
52
53 typedef struct _STRING
54 {
55 /*
56 * Length in bytes of the string stored in buffer
57 */
58 USHORT Length;
59
60 /*
61 * Maximum length of the string
62 */
63 USHORT MaximumLength;
64
65 /*
66 * String
67 */
68 PCHAR Buffer;
69 } STRING, *PSTRING;
70
71 typedef STRING ANSI_STRING;
72 typedef PSTRING PANSI_STRING;
73
74 typedef STRING OEM_STRING;
75 typedef PSTRING POEM_STRING;
76
77 typedef struct _TIME_FIELDS
78 {
79 CSHORT Year;
80 CSHORT Month;
81 CSHORT Day;
82 CSHORT Hour;
83 CSHORT Minute;
84 CSHORT Second;
85 CSHORT Milliseconds;
86 CSHORT Weekday;
87 } TIME_FIELDS, *PTIME_FIELDS;
88
89 typedef struct _RTL_BITMAP
90 {
91 ULONG SizeOfBitMap;
92 PULONG Buffer;
93 } RTL_BITMAP, *PRTL_BITMAP;
94
95 typedef struct _RTL_BITMAP_RUN
96 {
97 ULONG StarttingIndex;
98 ULONG NumberOfBits;
99 } RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
100
101 #ifndef STDCALL_FUNC
102 #define STDCALL_FUNC(a) (STDCALL a)
103 #endif
104
105 typedef NTSTATUS STDCALL_FUNC
106 (*PRTL_QUERY_REGISTRY_ROUTINE) (PWSTR ValueName,
107 ULONG ValueType,
108 PVOID ValueData,
109 ULONG ValueLength,
110 PVOID Context,
111 PVOID EntryContext);
112
113 typedef struct _RTL_QUERY_REGISTRY_TABLE
114 {
115 PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine;
116 ULONG Flags;
117 PWSTR Name;
118 PVOID EntryContext;
119 ULONG DefaultType;
120 PVOID DefaultData;
121 ULONG DefaultLength;
122 } RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
123
124 typedef struct _COMPRESSED_DATA_INFO
125 {
126 USHORT CompressionFormatAndEngine;
127 UCHAR CompressionUnitShift;
128 UCHAR ChunkShift;
129 UCHAR ClusterShift;
130 UCHAR Reserved;
131 USHORT NumberOfChunks;
132 ULONG CompressedChunkSizes[1];
133 } COMPRESSED_DATA_INFO, *PCOMPRESSED_DATA_INFO;
134
135 typedef struct _GENERATE_NAME_CONTEXT
136 {
137 USHORT Checksum;
138 BOOLEAN CheckSumInserted;
139 UCHAR NameLength;
140 WCHAR NameBuffer[8];
141 ULONG ExtensionLength;
142 WCHAR ExtensionBuffer[4];
143 ULONG LastIndexValue;
144 } GENERATE_NAME_CONTEXT, *PGENERATE_NAME_CONTEXT;
145
146 typedef struct _RTL_SPLAY_LINKS
147 {
148 struct _RTL_SPLAY_LINKS *Parent;
149 struct _RTL_SPLAY_LINKS *LeftChild;
150 struct _RTL_SPLAY_LINKS *RightChild;
151 } RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS;
152
153
154 typedef struct _RTL_RANGE_LIST
155 {
156 LIST_ENTRY ListHead;
157 ULONG Flags; /* RTL_RANGE_LIST_... flags */
158 ULONG Count;
159 ULONG Stamp;
160 } RTL_RANGE_LIST, *PRTL_RANGE_LIST;
161
162 #define RTL_RANGE_LIST_ADD_IF_CONFLICT 0x00000001
163 #define RTL_RANGE_LIST_ADD_SHARED 0x00000002
164
165 typedef struct _RTL_RANGE
166 {
167 ULONGLONG Start;
168 ULONGLONG End;
169 PVOID UserData;
170 PVOID Owner;
171 UCHAR Attributes;
172 UCHAR Flags; /* RTL_RANGE_... flags */
173 } RTL_RANGE, *PRTL_RANGE;
174
175 #define RTL_RANGE_SHARED 0x01
176 #define RTL_RANGE_CONFLICT 0x02
177
178 typedef BOOLEAN
179 (STDCALL *PRTL_CONFLICT_RANGE_CALLBACK) (PVOID Context,
180 PRTL_RANGE Range);
181
182
183 typedef struct _RANGE_LIST_ITERATOR
184 {
185 PLIST_ENTRY RangeListHead;
186 PLIST_ENTRY MergedHead;
187 PVOID Current;
188 ULONG Stamp;
189 } RTL_RANGE_LIST_ITERATOR, *PRTL_RANGE_LIST_ITERATOR;
190
191
192 typedef struct _INITIAL_TEB
193 {
194 PVOID StackBase;
195 PVOID StackLimit;
196 PVOID StackCommit;
197 PVOID StackCommitMax;
198 PVOID StackReserved;
199 } INITIAL_TEB, *PINITIAL_TEB;
200
201 #else /* __USE_W32API */
202
203 #include <ddk/ntifs.h>
204
205 #endif /* __USE_W32API */
206
207 typedef struct _RTL_HEAP_DEFINITION
208 {
209 ULONG Length;
210 ULONG Unknown[11];
211 } RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
212
213 typedef struct _RTL_ATOM_TABLE
214 {
215 ULONG TableSize;
216 ULONG NumberOfAtoms;
217 PVOID Lock; /* fast mutex (kernel mode)/ critical section (user mode) */
218 PVOID HandleTable;
219 LIST_ENTRY Slot[0];
220 } RTL_ATOM_TABLE, *PRTL_ATOM_TABLE;
221
222
223 #define MAXIMUM_LEADBYTES 12
224
225 typedef struct _CPTABLEINFO
226 {
227 USHORT CodePage;
228 USHORT MaximumCharacterSize; /* SBCS = 1, DBCS = 2 */
229 USHORT DefaultChar;
230 USHORT UniDefaultChar;
231 USHORT TransDefaultChar;
232 USHORT TransUniDefaultChar;
233 USHORT DBCSCodePage;
234 UCHAR LeadByte[MAXIMUM_LEADBYTES];
235 PUSHORT MultiByteTable;
236 PVOID WideCharTable;
237 PUSHORT DBCSRanges;
238 PUSHORT DBCSOffsets;
239 } CPTABLEINFO, *PCPTABLEINFO;
240
241 typedef struct _NLSTABLEINFO
242 {
243 CPTABLEINFO OemTableInfo;
244 CPTABLEINFO AnsiTableInfo;
245 PUSHORT UpperCaseTable;
246 PUSHORT LowerCaseTable;
247 } NLSTABLEINFO, *PNLSTABLEINFO;
248
249
250 #include <pshpack1.h>
251
252 typedef struct _NLS_FILE_HEADER
253 {
254 USHORT HeaderSize;
255 USHORT CodePage;
256 USHORT MaximumCharacterSize; /* SBCS = 1, DBCS = 2 */
257 USHORT DefaultChar;
258 USHORT UniDefaultChar;
259 USHORT TransDefaultChar;
260 USHORT TransUniDefaultChar;
261 USHORT DBCSCodePage;
262 UCHAR LeadByte[MAXIMUM_LEADBYTES];
263 } NLS_FILE_HEADER, *PNLS_FILE_HEADER;
264
265 #include <poppack.h>
266 /*
267 typedef struct _OSVERSIONINFOEXA {
268 ULONG dwOSVersionInfoSize;
269 ULONG dwMajorVersion;
270 ULONG dwMinorVersion;
271 ULONG dwBuildNumber;
272 ULONG dwPlatformId;
273 CHAR szCSDVersion [128];
274 USHORT wServicePackMajor;
275 USHORT wServicePackMinor;
276 USHORT wSuiteMask;
277 UCHAR wProductType;
278 UCHAR wReserved;
279 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
280
281 typedef struct _OSVERSIONINFOEXW {
282 ULONG dwOSVersionInfoSize;
283 ULONG dwMajorVersion;
284 ULONG dwMinorVersion;
285 ULONG dwBuildNumber;
286 ULONG dwPlatformId;
287 WCHAR szCSDVersion[128];
288 USHORT wServicePackMajor;
289 USHORT wServicePackMinor;
290 USHORT wSuiteMask;
291 UCHAR wProductType;
292 UCHAR wReserved;
293 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
294
295 */
296 typedef struct _RTL_MESSAGE_RESOURCE_ENTRY
297 {
298 USHORT Length;
299 USHORT Flags;
300 UCHAR Text[1];
301 } RTL_MESSAGE_RESOURCE_ENTRY, *PRTL_MESSAGE_RESOURCE_ENTRY;
302
303 typedef struct _RTL_MESSAGE_RESOURCE_BLOCK
304 {
305 ULONG LowId;
306 ULONG HighId;
307 ULONG OffsetToEntries;
308 } RTL_MESSAGE_RESOURCE_BLOCK, *PRTL_MESSAGE_RESOURCE_BLOCK;
309
310 typedef struct _RTL_MESSAGE_RESOURCE_DATA
311 {
312 ULONG NumberOfBlocks;
313 RTL_MESSAGE_RESOURCE_BLOCK Blocks[1];
314 } RTL_MESSAGE_RESOURCE_DATA, *PRTL_MESSAGE_RESOURCE_DATA;
315
316 typedef VOID
317 (STDCALL *PRTL_BASE_PROCESS_START_ROUTINE)(PTHREAD_START_ROUTINE StartAddress,
318 PVOID Parameter);
319
320
321 typedef struct _UNICODE_PREFIX_TABLE_ENTRY {
322 USHORT NodeTypeCode;
323 USHORT NameLength;
324 struct _UNICODE_PREFIX_TABLE_ENTRY *NextPrefixTree;
325 struct _UNICODE_PREFIX_TABLE_ENTRY *CaseMatch;
326 RTL_SPLAY_LINKS Links;
327 PUNICODE_STRING Prefix;
328 } UNICODE_PREFIX_TABLE_ENTRY;
329 typedef UNICODE_PREFIX_TABLE_ENTRY *PUNICODE_PREFIX_TABLE_ENTRY;
330
331 typedef struct _UNICODE_PREFIX_TABLE {
332 USHORT NodeTypeCode;
333 USHORT NameLength;
334 PUNICODE_PREFIX_TABLE_ENTRY NextPrefixTree;
335 PUNICODE_PREFIX_TABLE_ENTRY LastNextEntry;
336 } UNICODE_PREFIX_TABLE;
337 typedef UNICODE_PREFIX_TABLE *PUNICODE_PREFIX_TABLE;
338
339 typedef enum _TABLE_SEARCH_RESULT{
340 TableEmptyTree,
341 TableFoundNode,
342 TableInsertAsLeft,
343 TableInsertAsRight
344 } TABLE_SEARCH_RESULT;
345
346
347 typedef enum _RTL_GENERIC_COMPARE_RESULTS {
348 GenericLessThan,
349 GenericGreaterThan,
350 GenericEqual
351 } RTL_GENERIC_COMPARE_RESULTS;
352
353 struct _RTL_AVL_TABLE;
354
355 typedef
356 RTL_GENERIC_COMPARE_RESULTS
357 (STDCALL *PRTL_AVL_COMPARE_ROUTINE) (
358 struct _RTL_AVL_TABLE *Table,
359 PVOID FirstStruct,
360 PVOID SecondStruct
361 );
362
363 typedef
364 PVOID
365 (STDCALL *PRTL_AVL_ALLOCATE_ROUTINE) (
366 struct _RTL_AVL_TABLE *Table,
367 ULONG ByteSize
368 );
369
370 typedef
371 VOID
372 (STDCALL *PRTL_AVL_FREE_ROUTINE) (
373 struct _RTL_AVL_TABLE *Table,
374 PVOID Buffer
375 );
376
377 typedef
378 NTSTATUS
379 (STDCALL *PRTL_AVL_MATCH_FUNCTION) (
380 struct _RTL_AVL_TABLE *Table,
381 PVOID UserData,
382 PVOID MatchData
383 );
384
385 typedef struct _RTL_BALANCED_LINKS {
386 struct _RTL_BALANCED_LINKS *Parent;
387 struct _RTL_BALANCED_LINKS *LeftChild;
388 struct _RTL_BALANCED_LINKS *RightChild;
389 CHAR Balance;
390 UCHAR Reserved[3];
391 } RTL_BALANCED_LINKS;
392
393 typedef RTL_BALANCED_LINKS *PRTL_BALANCED_LINKS;
394
395 typedef struct _RTL_AVL_TABLE {
396 RTL_BALANCED_LINKS BalancedRoot;
397 PVOID OrderedPointer;
398 ULONG WhichOrderedElement;
399 ULONG NumberGenericTableElements;
400 ULONG DepthOfTree;
401 PRTL_BALANCED_LINKS RestartKey;
402 ULONG DeleteCount;
403 PRTL_AVL_COMPARE_ROUTINE CompareRoutine;
404 PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine;
405 PRTL_AVL_FREE_ROUTINE FreeRoutine;
406 PVOID TableContext;
407 } RTL_AVL_TABLE;
408 typedef RTL_AVL_TABLE *PRTL_AVL_TABLE;
409
410 struct _RTL_GENERIC_TABLE;
411
412 typedef
413 RTL_GENERIC_COMPARE_RESULTS
414 (STDCALL *PRTL_GENERIC_COMPARE_ROUTINE) (
415 struct _RTL_GENERIC_TABLE *Table,
416 PVOID FirstStruct,
417 PVOID SecondStruct
418 );
419
420 typedef
421 PVOID
422 (STDCALL *PRTL_GENERIC_ALLOCATE_ROUTINE) (
423 struct _RTL_GENERIC_TABLE *Table,
424 ULONG ByteSize
425 );
426
427 typedef
428 VOID
429 (STDCALL *PRTL_GENERIC_FREE_ROUTINE) (
430 struct _RTL_GENERIC_TABLE *Table,
431 PVOID Buffer
432 );
433
434
435 typedef struct _RTL_GENERIC_TABLE {
436 PRTL_SPLAY_LINKS TableRoot;
437 LIST_ENTRY InsertOrderList;
438 PLIST_ENTRY OrderedPointer;
439 ULONG WhichOrderedElement;
440 ULONG NumberGenericTableElements;
441 PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine;
442 PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine;
443 PRTL_GENERIC_FREE_ROUTINE FreeRoutine;
444 PVOID TableContext;
445 } RTL_GENERIC_TABLE;
446 typedef RTL_GENERIC_TABLE *PRTL_GENERIC_TABLE;
447
448 typedef NTSTATUS
449 (*PHEAP_ENUMERATION_ROUTINE)(IN PVOID HeapHandle,
450 IN PVOID UserParam);
451
452 #endif /* __DDK_RTLTYPES_H */