some __stdcall fixes in ntoskrnl and ntdll
[reactos.git] / reactos / include / ddk / rtl.h
1 /*
2 *
3 */
4
5 #ifndef __DDK_RTL_H
6 #define __DDK_RTL_H
7
8 typedef struct _CONTROLLER_OBJECT
9 {
10 CSHORT Type;
11 CSHORT Size;
12 PVOID ControllerExtension;
13 KDEVICE_QUEUE DeviceWaitQueue;
14 ULONG Spare1;
15 LARGE_INTEGER Spare2;
16 } CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
17
18 typedef struct _STRING
19 {
20 USHORT Length;
21 USHORT MaximumLength;
22 PCHAR Buffer;
23 } STRING, *PSTRING;
24
25 typedef struct _ANSI_STRING
26 {
27 /*
28 * Length in bytes of the string stored in buffer
29 */
30 USHORT Length;
31
32 /*
33 * Maximum length of the string
34 */
35 USHORT MaximumLength;
36
37 /*
38 * String
39 */
40 PCHAR Buffer;
41 } ANSI_STRING, *PANSI_STRING;
42
43 typedef struct _TIME_FIELDS
44 {
45 CSHORT Year;
46 CSHORT Month;
47 CSHORT Day;
48 CSHORT Hour;
49 CSHORT Minute;
50 CSHORT Second;
51 CSHORT Milliseconds;
52 CSHORT Weekday;
53 } TIME_FIELDS, *PTIME_FIELDS;
54
55 /*
56 * PURPOSE: Flags for RtlQueryRegistryValues
57 */
58 enum
59 {
60 RTL_QUERY_REGISTRY_SUBKEY,
61 RTL_QUERY_REGISTRY_TOPKEY,
62 RTL_QUERY_REGISTRY_REQUIRED,
63 RTL_QUERY_REGISTRY_NOVALUE,
64 RTL_QUERY_REGISTRY_NOEXPAND,
65 RTL_QUERY_REGISTRY_DIRECT,
66 RTL_QUERY_REGISTRY_DELETE,
67 };
68
69 typedef NTSTATUS (*PRTL_QUERY_REGISTRY_ROUTINE)(PWSTR ValueName,
70 ULONG ValueType,
71 PVOID ValueData,
72 ULONG ValueLength,
73 PVOID Context,
74 PVOID EntryContext);
75
76 typedef struct _RTL_QUERY_REGISTRY_TABLE
77 {
78 PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine;
79 ULONG Flags;
80 PWSTR Name;
81 PVOID EntryContext;
82 ULONG DefaultType;
83 PVOID DefaultData;
84 ULONG DefaultLength;
85 } RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
86
87 /*
88 * PURPOSE: Used with RtlCheckRegistryKey, RtlCreateRegistryKey,
89 * RtlDeleteRegistryKey
90 */
91 enum
92 {
93 RTL_REGISTRY_ABSOLUTE,
94 RTL_REGISTRY_SERVICES,
95 RTL_REGISTRY_CONTROL,
96 RTL_REGISTRY_WINDOWS_NT,
97 RTL_REGISTRY_DEVICEMAP,
98 RTL_REGISTRY_USER,
99 RTL_REGISTRY_OPTIONAL,
100 RTL_REGISTRY_VALUE,
101 };
102
103 /*
104 * FUNCTION: Sets up a parameter of type OBJECT_ATTRIBUTES for a
105 * subsequent call to ZwCreateXXX or ZwOpenXXX
106 * ARGUMENTS:
107 * InitializedAttributes (OUT) = Caller supplied storage for the
108 * object attributes
109 * ObjectName = Full path name for object
110 * Attributes = Attributes for the object
111 * RootDirectory = Where the object should be placed or NULL
112 * SecurityDescriptor = Ignored
113 */
114 VOID
115 InitializeObjectAttributes (
116 POBJECT_ATTRIBUTES InitializedAttributes,
117 PUNICODE_STRING ObjectName,
118 ULONG Attributes,
119 HANDLE RootDirectory,
120 PSECURITY_DESCRIPTOR SecurityDescriptor
121 );
122
123 VOID
124 InitializeListHead (
125 PLIST_ENTRY ListHead
126 );
127
128 VOID
129 InsertHeadList (
130 PLIST_ENTRY ListHead,
131 PLIST_ENTRY Entry
132 );
133
134 VOID
135 InsertTailList (
136 PLIST_ENTRY ListHead,
137 PLIST_ENTRY Entry
138 );
139
140 BOOLEAN
141 IsListEmpty (
142 PLIST_ENTRY ListHead
143 );
144
145 PSINGLE_LIST_ENTRY
146 PopEntryList (
147 PSINGLE_LIST_ENTRY ListHead
148 );
149
150 VOID
151 PushEntryList (
152 PSINGLE_LIST_ENTRY ListHead,
153 PSINGLE_LIST_ENTRY Entry
154 );
155
156 VOID
157 RemoveEntryList (
158 PLIST_ENTRY Entry
159 );
160
161 PLIST_ENTRY
162 RemoveHeadList (
163 PLIST_ENTRY ListHead
164 );
165
166 PLIST_ENTRY
167 RemoveTailList (
168 PLIST_ENTRY ListHead
169 );
170
171 ULONG
172 RtlAnsiStringToUnicodeSize (
173 PANSI_STRING AnsiString
174 );
175
176 NTSTATUS
177 RtlAnsiStringToUnicodeString (
178 PUNICODE_STRING DestinationString,
179 PANSI_STRING SourceString,
180 BOOLEAN AllocateDestinationString
181 );
182
183 NTSTATUS
184 RtlAppendUnicodeStringToString (
185 PUNICODE_STRING Destination,
186 PUNICODE_STRING Source
187 );
188
189 NTSTATUS
190 RtlAppendUnicodeToString (
191 PUNICODE_STRING Destination,
192 PWSTR Source
193 );
194
195 NTSTATUS
196 RtlCharToInteger (
197 PCSZ String,
198 ULONG Base,
199 PULONG Value
200 );
201
202 NTSTATUS
203 STDCALL
204 RtlCheckRegistryKey (
205 ULONG RelativeTo,
206 PWSTR Path
207 );
208
209 ULONG
210 RtlCompareMemory (
211 PVOID Source1,
212 PVOID Source2,
213 ULONG Length
214 );
215
216 LONG
217 RtlCompareString (
218 PSTRING String1,
219 PSTRING String2,
220 BOOLEAN CaseInsensitive
221 );
222
223 LONG
224 RtlCompareUnicodeString (
225 PUNICODE_STRING String1,
226 PUNICODE_STRING String2,
227 BOOLEAN BaseInsensitive
228 );
229
230 LARGE_INTEGER
231 RtlConvertLongToLargeInteger (
232 LONG SignedInteger
233 );
234
235 LARGE_INTEGER
236 RtlConvertUlongToLargeInteger (
237 ULONG UnsignedInteger
238 );
239
240 VOID
241 RtlCopyBytes (
242 PVOID Destination,
243 CONST VOID * Source,
244 ULONG Length
245 );
246
247 VOID
248 RtlCopyMemory (
249 VOID * Destination,
250 CONST VOID * Source,
251 ULONG Length
252 );
253
254 VOID
255 RtlCopyString (
256 PSTRING DestinationString,
257 PSTRING SourceString
258 );
259
260 VOID
261 RtlCopyUnicodeString (
262 PUNICODE_STRING DestinationString,
263 PUNICODE_STRING SourceString
264 );
265
266 NTSTATUS
267 STDCALL
268 RtlCreateRegistryKey (
269 ULONG RelativeTo,
270 PWSTR Path
271 );
272
273 NTSTATUS
274 RtlCreateSecurityDescriptor (
275 PSECURITY_DESCRIPTOR SecurityDescriptor,
276 ULONG Revision
277 );
278
279 NTSTATUS
280 STDCALL
281 RtlDeleteRegistryValue (
282 ULONG RelativeTo,
283 PWSTR Path,
284 PWSTR ValueName
285 );
286
287 LARGE_INTEGER
288 RtlEnlargedIntegerMultiply (
289 LONG Multiplicand,
290 LONG Multiplier
291 );
292
293 ULONG
294 RtlEnlargedUnsignedDivide (
295 ULARGE_INTEGER Dividend,
296 ULONG Divisor,
297 PULONG Remainder
298 );
299
300 LARGE_INTEGER
301 RtlEnlargedUnsignedMultiply (
302 ULONG Multiplicand,
303 ULONG Multiplier
304 );
305
306 BOOLEAN
307 RtlEqualString (
308 PSTRING String1,
309 PSTRING String2,
310 BOOLEAN CaseInSensitive
311 );
312
313 BOOLEAN
314 RtlEqualUnicodeString (
315 PUNICODE_STRING String1,
316 PUNICODE_STRING String2,
317 BOOLEAN CaseInSensitive
318 );
319
320 LARGE_INTEGER
321 RtlExtendedIntegerMultiply (
322 LARGE_INTEGER Multiplicand,
323 LONG Multiplier
324 );
325
326 LARGE_INTEGER
327 RtlExtendedLargeIntegerDivide (
328 LARGE_INTEGER Dividend,
329 ULONG Divisor,
330 PULONG Remainder
331 );
332
333 LARGE_INTEGER
334 RtlExtendedMagicDivide (
335 LARGE_INTEGER Dividend,
336 LARGE_INTEGER MagicDivisor,
337 CCHAR ShiftCount
338 );
339
340 VOID
341 RtlFillMemory (
342 PVOID Destination,
343 ULONG Length,
344 UCHAR Fill
345 );
346
347 VOID
348 RtlFreeAnsiString (
349 PANSI_STRING AnsiString
350 );
351
352 VOID
353 RtlFreeUnicodeString (
354 PUNICODE_STRING UnicodeString
355 );
356
357 VOID
358 RtlInitAnsiString (
359 PANSI_STRING DestinationString,
360 PCSZ SourceString
361 );
362
363 VOID
364 RtlInitString (
365 PSTRING DestinationString,
366 PCSZ SourceString
367 );
368
369 VOID
370 RtlInitUnicodeString (
371 PUNICODE_STRING DestinationString,
372 PCWSTR SourceString
373 );
374
375 NTSTATUS
376 RtlIntegerToUnicodeString (
377 ULONG Value,
378 ULONG Base,
379 PUNICODE_STRING String
380 );
381
382 LARGE_INTEGER
383 RtlLargeIntegerAdd (
384 LARGE_INTEGER Addend1,
385 LARGE_INTEGER Addend2
386 );
387
388 VOID
389 RtlLargeIntegerAnd (
390 PLARGE_INTEGER Result,
391 LARGE_INTEGER Source,
392 LARGE_INTEGER Mask
393 );
394
395 /* MISSING FUNCTIONS GO HERE */
396
397 LARGE_INTEGER
398 RtlConvertLongToLargeInteger (
399 LONG SignedInteger
400 );
401
402 LARGE_INTEGER
403 RtlConvertUlongToLargeInteger (
404 ULONG UnsignedInteger
405 );
406
407 LARGE_INTEGER
408 RtlEnlargedIntegerMultiply (
409 LONG Multiplicand,
410 LONG Multiplier
411 );
412
413 ULONG
414 RtlEnlargedUnsignedDivide (
415 ULARGE_INTEGER Dividend,
416 ULONG Divisor,
417 PULONG Remainder
418 );
419
420 LARGE_INTEGER
421 RtlEnlargedUnsignedMultiply (
422 ULONG Multiplicand,
423 ULONG Multipler
424 );
425
426 LARGE_INTEGER
427 RtlExtendedIntegerMultiply (
428 LARGE_INTEGER Multiplicand,
429 LONG Multiplier
430 );
431
432 LARGE_INTEGER
433 RtlExtendedLargeIntegerDivide (
434 LARGE_INTEGER Dividend,
435 ULONG Divisor,
436 PULONG Remainder
437 );
438
439 LARGE_INTEGER
440 RtlExtendedMagicDivide (
441 LARGE_INTEGER Dividend,
442 LARGE_INTEGER MagicDivisor,
443 CCHAR ShiftCount
444 );
445
446 LARGE_INTEGER
447 ExInterlockedAddLargeInteger (
448 PLARGE_INTEGER Addend,
449 LARGE_INTEGER Increment,
450 PKSPIN_LOCK Lock
451 );
452
453 LARGE_INTEGER
454 RtlLargeIntegerAdd (
455 LARGE_INTEGER Addend1,
456 LARGE_INTEGER Addend2
457 );
458
459 VOID
460 RtlLargeIntegerAnd (
461 PLARGE_INTEGER Result,
462 LARGE_INTEGER Source,
463 LARGE_INTEGER Mask
464 );
465
466 LARGE_INTEGER
467 RtlLargeIntegerArithmeticShift (
468 LARGE_INTEGER LargeInteger,
469 CCHAR ShiftCount
470 );
471
472 LARGE_INTEGER
473 RtlLargeIntegerDivide (
474 LARGE_INTEGER Dividend,
475 LARGE_INTEGER Divisor,
476 PLARGE_INTEGER Remainder
477 );
478
479 BOOLEAN
480 RtlLargeIntegerEqualTo (
481 LARGE_INTEGER Operand1,
482 LARGE_INTEGER Operand2
483 );
484
485 BOOLEAN
486 RtlLargeIntegerEqualToZero (
487 LARGE_INTEGER Operand
488 );
489
490 BOOLEAN
491 RtlLargeIntegerGreaterThan (
492 LARGE_INTEGER Operand1,
493 LARGE_INTEGER Operand2
494 );
495
496 BOOLEAN
497 RtlLargeIntegerGreaterThanOrEqualTo (
498 LARGE_INTEGER Operand1,
499 LARGE_INTEGER Operand2
500 );
501
502 BOOLEAN
503 RtlLargeIntegerGreaterThanOrEqualToZero (
504 LARGE_INTEGER Operand1
505 );
506
507 BOOLEAN
508 RtlLargeIntegerGreaterThanZero (
509 LARGE_INTEGER Operand1
510 );
511
512 BOOLEAN
513 RtlLargeIntegerLessThan (
514 LARGE_INTEGER Operand1,
515 LARGE_INTEGER Operand2
516 );
517
518 BOOLEAN
519 RtlLargeIntegerLessThanOrEqualTo (
520 LARGE_INTEGER Operand1,
521 LARGE_INTEGER Operand2
522 );
523
524 BOOLEAN
525 RtlLargeIntegerLessThanOrEqualToZero (
526 LARGE_INTEGER Operand
527 );
528
529 BOOLEAN
530 RtlLargeIntegerLessThanZero (
531 LARGE_INTEGER Operand
532 );
533
534 LARGE_INTEGER
535 RtlLargeIntegerNegate (
536 LARGE_INTEGER Subtrahend
537 );
538
539 BOOLEAN
540 RtlLargeIntegerNotEqualTo (
541 LARGE_INTEGER Operand1,
542 LARGE_INTEGER Operand2
543 );
544
545 BOOLEAN
546 RtlLargeIntegerNotEqualToZero (
547 LARGE_INTEGER Operand
548 );
549
550 LARGE_INTEGER
551 RtlLargeIntegerShiftLeft (
552 LARGE_INTEGER LargeInteger,
553 CCHAR ShiftCount
554 );
555
556 LARGE_INTEGER
557 RtlLargeIntegerShiftRight (
558 LARGE_INTEGER LargeInteger,
559 CCHAR ShiftCount
560 );
561
562 LARGE_INTEGER
563 RtlLargeIntegerSubtract (
564 LARGE_INTEGER Minuend,
565 LARGE_INTEGER Subtrahend
566 );
567
568 ULONG
569 RtlLengthSecurityDescriptor (
570 PSECURITY_DESCRIPTOR SecurityDescriptor
571 );
572
573 VOID
574 RtlMoveMemory (
575 PVOID Destination,
576 CONST VOID * Source,
577 ULONG Length
578 );
579
580 NTSTATUS
581 STDCALL
582 RtlQueryRegistryValues (
583 ULONG RelativeTo,
584 PWSTR Path,
585 PRTL_QUERY_REGISTRY_TABLE QueryTable,
586 PVOID Context,
587 PVOID Environment
588 );
589
590 VOID
591 RtlRetrieveUlong (
592 PULONG DestinationAddress,
593 PULONG SourceAddress
594 );
595
596 VOID
597 RtlRetrieveUshort (
598 PUSHORT DestinationAddress,
599 PUSHORT SourceAddress
600 );
601
602 NTSTATUS
603 RtlSetDaclSecurityDescriptor (
604 PSECURITY_DESCRIPTOR SecurityDescriptor,
605 BOOLEAN DaclPresent,
606 PACL Dacl,
607 BOOLEAN DaclDefaulted
608 );
609
610 VOID
611 RtlStoreLong (
612 PULONG Address,
613 ULONG Value
614 );
615
616 VOID
617 RtlStoreUshort (
618 PUSHORT Address,
619 USHORT Value
620 );
621
622 BOOLEAN
623 RtlTimeFieldsToTime (
624 PTIME_FIELDS TimeFields,
625 PLARGE_INTEGER Time
626 );
627
628 VOID
629 RtlTimeToTimeFields (
630 PLARGE_INTEGER Time,
631 PTIME_FIELDS TimeFields
632 );
633
634 PWSTR
635 RtlStrtok (
636 PUNICODE_STRING _string,
637 PWSTR _sep,
638 PWSTR * temp
639 );
640
641 VOID
642 RtlGetCallersAddress (
643 PVOID * CallersAddress
644 );
645
646 VOID
647 RtlZeroMemory (
648 PVOID Destination,
649 ULONG Length
650 );
651
652 typedef struct {
653 ULONG Length;
654 ULONG Unknown[11];
655 } RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
656
657 // Heap creation routine
658
659 HANDLE
660 STDCALL
661 RtlCreateHeap (
662 ULONG Flags,
663 PVOID BaseAddress,
664 ULONG SizeToReserve,
665 ULONG SizeToCommit,
666 PVOID Unknown,
667 PRTL_HEAP_DEFINITION Definition
668 );
669
670 PVOID
671 STDCALL
672 RtlAllocateHeap (
673 HANDLE Heap,
674 ULONG Flags,
675 ULONG Size
676 );
677
678
679 BOOLEAN
680 STDCALL
681 RtlFreeHeap (
682 HANDLE Heap,
683 ULONG Flags,
684 PVOID Address
685 );
686
687 NTSTATUS
688 RtlUnicodeStringToAnsiString (
689 IN OUT PANSI_STRING DestinationString,
690 IN PUNICODE_STRING SourceString,
691 IN BOOLEAN AllocateDestinationString
692 );
693
694 NTSTATUS
695 RtlUnicodeStringToInteger (
696 IN PUNICODE_STRING String,
697 IN ULONG Base,
698 OUT PULONG Value
699 );
700
701 NTSTATUS
702 RtlUpcaseUnicodeString (
703 IN OUT PUNICODE_STRING DestinationString,
704 IN PUNICODE_STRING SourceString,
705 IN BOOLEAN AllocateDestinationString
706 );
707
708 VOID
709 RtlUpperString (
710 PSTRING DestinationString,
711 PSTRING SourceString
712 );
713
714 BOOLEAN
715 RtlValidSecurityDescriptor (
716 PSECURITY_DESCRIPTOR SecurityDescriptor
717 );
718
719 NTSTATUS
720 STDCALL
721 RtlWriteRegistryValue (
722 ULONG RelativeTo,
723 PWSTR Path,
724 PWSTR ValueName,
725 ULONG ValueType,
726 PVOID ValueData,
727 ULONG ValueLength
728 );
729
730 VOID
731 RtlStoreUlong (
732 PULONG Address,
733 ULONG Value
734 );
735
736
737 DWORD
738 RtlNtStatusToDosError (
739 NTSTATUS StatusCode
740 );
741
742
743
744 BOOL
745 WINAPI
746 RtlDestroyHeap (
747 HANDLE hheap
748 );
749
750 LPVOID
751 STDCALL
752 RtlReAllocHeap (
753 HANDLE hheap,
754 DWORD flags,
755 LPVOID ptr,
756 DWORD size
757 );
758
759 HANDLE
760 WINAPI
761 RtlGetProcessHeap (VOID);
762
763 BOOL
764 WINAPI
765 RtlLockHeap (
766 HANDLE hheap
767 );
768
769 BOOL
770 WINAPI
771 RtlUnlockHeap (
772 HANDLE hheap
773 );
774
775 UINT
776 STDCALL
777 RtlCompactHeap (
778 HANDLE hheap,
779 DWORD flags
780 );
781
782 DWORD
783 WINAPI
784 RtlSizeHeap (
785 HANDLE hheap,
786 DWORD flags,
787 PVOID pmem
788 );
789
790 BOOL
791 WINAPI
792 RtlValidateHeap (
793 HANDLE hheap,
794 DWORD flags,
795 PVOID pmem
796 );
797
798 /* NtProcessStartup */
799
800 VOID
801 WINAPI
802 RtlDestroyProcessParameters(
803 IN OUT PSTARTUP_ARGUMENT pArgument
804 );
805 VOID
806 WINAPI
807 RtlDenormalizeProcessParams (
808 IN OUT PSTARTUP_ARGUMENT pArgument
809 );
810
811 #endif /* __DDK_RTL_H */