7ff855f3f3a5c03e428f2433f0be7b94793d4161
[reactos.git] / reactos / include / ndk / rtlfuncs.h
1 /*++ NDK Version: 0098
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 rtlfuncs.h
8
9 Abstract:
10
11 Function definitions for the Run-Time Library
12
13 Author:
14
15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16
17 --*/
18
19 #ifndef _RTLFUNCS_H
20 #define _RTLFUNCS_H
21
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26 #include <ntnls.h>
27 #include <rtltypes.h>
28 #include <pstypes.h>
29 #include <extypes.h>
30 #include "in6addr.h"
31 #include "inaddr.h"
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 #ifdef NTOS_MODE_USER
38
39 //
40 // List Functions
41 //
42 FORCEINLINE
43 VOID
44 InitializeListHead(
45 IN PLIST_ENTRY ListHead
46 )
47 {
48 ListHead->Flink = ListHead->Blink = ListHead;
49 }
50
51 FORCEINLINE
52 VOID
53 InsertHeadList(
54 IN PLIST_ENTRY ListHead,
55 IN PLIST_ENTRY Entry
56 )
57 {
58 PLIST_ENTRY OldFlink;
59 OldFlink = ListHead->Flink;
60 Entry->Flink = OldFlink;
61 Entry->Blink = ListHead;
62 OldFlink->Blink = Entry;
63 ListHead->Flink = Entry;
64 }
65
66 FORCEINLINE
67 VOID
68 InsertTailList(
69 IN PLIST_ENTRY ListHead,
70 IN PLIST_ENTRY Entry
71 )
72 {
73 PLIST_ENTRY OldBlink;
74 OldBlink = ListHead->Blink;
75 Entry->Flink = ListHead;
76 Entry->Blink = OldBlink;
77 OldBlink->Flink = Entry;
78 ListHead->Blink = Entry;
79 }
80
81 FORCEINLINE
82 BOOLEAN
83 IsListEmpty(
84 IN const LIST_ENTRY * ListHead
85 )
86 {
87 return (BOOLEAN)(ListHead->Flink == ListHead);
88 }
89
90 FORCEINLINE
91 PSINGLE_LIST_ENTRY
92 PopEntryList(
93 PSINGLE_LIST_ENTRY ListHead
94 )
95 {
96 PSINGLE_LIST_ENTRY FirstEntry;
97 FirstEntry = ListHead->Next;
98 if (FirstEntry != NULL) {
99 ListHead->Next = FirstEntry->Next;
100 }
101
102 return FirstEntry;
103 }
104
105 FORCEINLINE
106 VOID
107 PushEntryList(
108 PSINGLE_LIST_ENTRY ListHead,
109 PSINGLE_LIST_ENTRY Entry
110 )
111 {
112 Entry->Next = ListHead->Next;
113 ListHead->Next = Entry;
114 }
115
116 FORCEINLINE
117 BOOLEAN
118 RemoveEntryList(
119 IN PLIST_ENTRY Entry)
120 {
121 PLIST_ENTRY OldFlink;
122 PLIST_ENTRY OldBlink;
123
124 OldFlink = Entry->Flink;
125 OldBlink = Entry->Blink;
126 OldFlink->Blink = OldBlink;
127 OldBlink->Flink = OldFlink;
128 return (BOOLEAN)(OldFlink == OldBlink);
129 }
130
131 FORCEINLINE
132 PLIST_ENTRY
133 RemoveHeadList(
134 IN PLIST_ENTRY ListHead)
135 {
136 PLIST_ENTRY Flink;
137 PLIST_ENTRY Entry;
138
139 Entry = ListHead->Flink;
140 Flink = Entry->Flink;
141 ListHead->Flink = Flink;
142 Flink->Blink = ListHead;
143 return Entry;
144 }
145
146 FORCEINLINE
147 PLIST_ENTRY
148 RemoveTailList(
149 IN PLIST_ENTRY ListHead)
150 {
151 PLIST_ENTRY Blink;
152 PLIST_ENTRY Entry;
153
154 Entry = ListHead->Blink;
155 Blink = Entry->Blink;
156 ListHead->Blink = Blink;
157 Blink->Flink = ListHead;
158 return Entry;
159 }
160
161 //
162 // Unicode string macros
163 //
164 FORCEINLINE
165 VOID
166 RtlInitEmptyUnicodeString(OUT PUNICODE_STRING UnicodeString,
167 IN PWSTR Buffer,
168 IN USHORT BufferSize)
169 {
170 UnicodeString->Length = 0;
171 UnicodeString->MaximumLength = BufferSize;
172 UnicodeString->Buffer = Buffer;
173 }
174
175 //
176 // LUID Macros
177 //
178 #define RtlEqualLuid(L1, L2) (((L1)->HighPart == (L2)->HighPart) && \
179 ((L1)->LowPart == (L2)->LowPart))
180 FORCEINLINE
181 LUID
182 NTAPI_INLINE
183 RtlConvertUlongToLuid(ULONG Ulong)
184 {
185 LUID TempLuid;
186
187 TempLuid.LowPart = Ulong;
188 TempLuid.HighPart = 0;
189 return TempLuid;
190 }
191
192 //
193 // ASSERT Macros
194 //
195 #ifndef ASSERT
196 #if DBG
197
198 #define ASSERT( exp ) \
199 ((void)((!(exp)) ? \
200 (RtlAssert( #exp, __FILE__, __LINE__, NULL ),FALSE) : \
201 TRUE))
202
203 #define ASSERTMSG( msg, exp ) \
204 ((void)((!(exp)) ? \
205 (RtlAssert( #exp, __FILE__, __LINE__, msg ),FALSE) : \
206 TRUE))
207
208 #else
209
210 #define ASSERT( exp ) ((void) 0)
211 #define ASSERTMSG( msg, exp ) ((void) 0)
212
213 #endif
214 #endif
215
216 #ifdef NTOS_KERNEL_RUNTIME
217
218 //
219 // Executing RTL functions at DISPATCH_LEVEL or higher will result in a
220 // bugcheck.
221 //
222 #define RTL_PAGED_CODE PAGED_CODE
223
224 #else
225
226 //
227 // This macro does nothing in user mode
228 //
229 #define RTL_PAGED_CODE NOP_FUNCTION
230
231 #endif
232
233 //
234 // RTL Splay Tree Functions
235 //
236 NTSYSAPI
237 PRTL_SPLAY_LINKS
238 NTAPI
239 RtlSplay(
240 IN PRTL_SPLAY_LINKS Links
241 );
242
243 NTSYSAPI
244 PRTL_SPLAY_LINKS
245 NTAPI
246 RtlDelete(IN PRTL_SPLAY_LINKS Links
247 );
248
249 NTSYSAPI
250 VOID
251 NTAPI
252 RtlDeleteNoSplay(
253 IN PRTL_SPLAY_LINKS Links,
254 OUT PRTL_SPLAY_LINKS *Root
255 );
256
257 NTSYSAPI
258 PRTL_SPLAY_LINKS
259 NTAPI
260 RtlSubtreeSuccessor(
261 IN PRTL_SPLAY_LINKS Links
262 );
263
264 NTSYSAPI
265 PRTL_SPLAY_LINKS
266 NTAPI
267 RtlSubtreePredecessor(
268 IN PRTL_SPLAY_LINKS Links
269 );
270
271 NTSYSAPI
272 PRTL_SPLAY_LINKS
273 NTAPI
274 RtlRealSuccessor(
275 IN PRTL_SPLAY_LINKS Links
276 );
277
278 NTSYSAPI
279 PRTL_SPLAY_LINKS
280 NTAPI
281 RtlRealPredecessor(
282 IN PRTL_SPLAY_LINKS Links
283 );
284
285 #define RtlIsLeftChild(Links) \
286 (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
287
288 #define RtlIsRightChild(Links) \
289 (RtlRightChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
290
291 #define RtlRightChild(Links) \
292 ((PRTL_SPLAY_LINKS)(Links))->RightChild
293
294 #define RtlIsRoot(Links) \
295 (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
296
297 #define RtlLeftChild(Links) \
298 ((PRTL_SPLAY_LINKS)(Links))->LeftChild
299
300 #define RtlParent(Links) \
301 ((PRTL_SPLAY_LINKS)(Links))->Parent
302
303 #define RtlInitializeSplayLinks(Links) \
304 { \
305 PRTL_SPLAY_LINKS _SplayLinks; \
306 _SplayLinks = (PRTL_SPLAY_LINKS)(Links); \
307 _SplayLinks->Parent = _SplayLinks; \
308 _SplayLinks->LeftChild = NULL; \
309 _SplayLinks->RightChild = NULL; \
310 }
311
312 #define RtlInsertAsLeftChild(ParentLinks,ChildLinks) \
313 { \
314 PRTL_SPLAY_LINKS _SplayParent; \
315 PRTL_SPLAY_LINKS _SplayChild; \
316 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
317 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
318 _SplayParent->LeftChild = _SplayChild; \
319 _SplayChild->Parent = _SplayParent; \
320 }
321
322 #define RtlInsertAsRightChild(ParentLinks,ChildLinks) \
323 { \
324 PRTL_SPLAY_LINKS _SplayParent; \
325 PRTL_SPLAY_LINKS _SplayChild; \
326 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
327 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
328 _SplayParent->RightChild = _SplayChild; \
329 _SplayChild->Parent = _SplayParent; \
330 }
331
332 //
333 // RTL AVL Tree Functions
334 //
335 NTSYSAPI
336 VOID
337 NTAPI
338 RtlInitializeGenericTableAvl(
339 OUT PRTL_AVL_TABLE Table,
340 IN PRTL_AVL_COMPARE_ROUTINE CompareRoutine,
341 IN PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine,
342 IN PRTL_AVL_FREE_ROUTINE FreeRoutine,
343 IN PVOID TableContext OPTIONAL
344 );
345
346 NTSYSAPI
347 PVOID
348 NTAPI
349 RtlInsertElementGenericTableAvl(
350 IN PRTL_AVL_TABLE Table,
351 IN PVOID Buffer,
352 IN CLONG BufferSize,
353 OUT PBOOLEAN NewElement OPTIONAL
354 );
355
356 NTSYSAPI
357 PVOID
358 NTAPI
359 RtlInsertElementGenericTableFullAvl(
360 IN PRTL_AVL_TABLE Table,
361 IN PVOID Buffer,
362 IN CLONG BufferSize,
363 OUT PBOOLEAN NewElement OPTIONAL,
364 IN PVOID NodeOrParent,
365 IN TABLE_SEARCH_RESULT SearchResult
366 );
367
368 NTSYSAPI
369 BOOLEAN
370 NTAPI
371 RtlDeleteElementGenericTableAvl(
372 IN PRTL_AVL_TABLE Table,
373 IN PVOID Buffer
374 );
375
376 NTSYSAPI
377 PVOID
378 NTAPI
379 RtlLookupElementGenericTableAvl(
380 IN PRTL_AVL_TABLE Table,
381 IN PVOID Buffer
382 );
383
384 NTSYSAPI
385 PVOID
386 NTAPI
387 RtlLookupElementGenericTableFullAvl(
388 IN PRTL_AVL_TABLE Table,
389 IN PVOID Buffer,
390 OUT PVOID *NodeOrParent,
391 OUT TABLE_SEARCH_RESULT *SearchResult
392 );
393
394 NTSYSAPI
395 PVOID
396 NTAPI
397 RtlEnumerateGenericTableAvl(
398 IN PRTL_AVL_TABLE Table,
399 IN BOOLEAN Restart
400 );
401
402 NTSYSAPI
403 PVOID
404 NTAPI
405 RtlEnumerateGenericTableWithoutSplayingAvl(
406 IN PRTL_AVL_TABLE Table,
407 IN OUT PVOID *RestartKey
408 );
409
410 NTSYSAPI
411 PVOID
412 NTAPI
413 RtlLookupFirstMatchingElementGenericTableAvl(
414 IN PRTL_AVL_TABLE Table,
415 IN PVOID Buffer,
416 OUT PVOID *RestartKey
417 );
418
419 NTSYSAPI
420 PVOID
421 NTAPI
422 RtlEnumerateGenericTableLikeADirectory(
423 IN PRTL_AVL_TABLE Table,
424 IN PRTL_AVL_MATCH_FUNCTION MatchFunction OPTIONAL,
425 IN PVOID MatchData OPTIONAL,
426 IN ULONG NextFlag,
427 IN OUT PVOID *RestartKey,
428 IN OUT PULONG DeleteCount,
429 IN PVOID Buffer
430 );
431
432 NTSYSAPI
433 PVOID
434 NTAPI
435 RtlGetElementGenericTableAvl(
436 IN PRTL_AVL_TABLE Table,
437 IN ULONG I
438 );
439
440 NTSYSAPI
441 ULONG
442 NTAPI
443 RtlNumberGenericTableElementsAvl(
444 IN PRTL_AVL_TABLE Table
445 );
446
447 NTSYSAPI
448 BOOLEAN
449 NTAPI
450 RtlIsGenericTableEmptyAvl(
451 IN PRTL_AVL_TABLE Table
452 );
453
454 #endif
455
456 //
457 // Error and Exception Functions
458 //
459 NTSYSAPI
460 PVOID
461 NTAPI
462 RtlAddVectoredExceptionHandler(
463 IN ULONG FirstHandler,
464 IN PVECTORED_EXCEPTION_HANDLER VectoredHandler
465 );
466
467 NTSYSAPI
468 VOID
469 NTAPI
470 RtlAssert(
471 IN PVOID FailedAssertion,
472 IN PVOID FileName,
473 IN ULONG LineNumber,
474 IN PCHAR Message
475 );
476
477 NTSYSAPI
478 PVOID
479 NTAPI
480 RtlSetUnhandledExceptionFilter(
481 IN PVOID TopLevelExceptionFilter
482 );
483
484 NTSYSAPI
485 VOID
486 NTAPI
487 RtlCaptureContext(
488 OUT PCONTEXT ContextRecord
489 );
490
491 NTSYSAPI
492 PVOID
493 NTAPI
494 RtlEncodePointer(
495 IN PVOID Pointer
496 );
497
498 NTSYSAPI
499 PVOID
500 NTAPI
501 RtlDecodePointer(
502 IN PVOID Pointer
503 );
504
505 NTSYSAPI
506 PVOID
507 NTAPI
508 RtlEncodeSystemPointer(
509 IN PVOID Pointer
510 );
511
512 NTSYSAPI
513 PVOID
514 NTAPI
515 RtlDecodeSystemPointer(
516 IN PVOID Pointer
517 );
518
519 NTSYSAPI
520 BOOLEAN
521 NTAPI
522 RtlDispatchException(
523 IN PEXCEPTION_RECORD ExceptionRecord,
524 IN PCONTEXT Context
525 );
526
527 NTSYSAPI
528 ULONG
529 NTAPI
530 RtlNtStatusToDosError(
531 IN NTSTATUS Status
532 );
533
534 NTSYSAPI
535 ULONG
536 NTAPI
537 RtlNtStatusToDosErrorNoTeb(
538 IN NTSTATUS Status
539 );
540
541 NTSYSAPI
542 VOID
543 NTAPI
544 RtlSetLastWin32ErrorAndNtStatusFromNtStatus(
545 IN NTSTATUS Status
546 );
547
548 NTSYSAPI
549 VOID
550 NTAPI
551 RtlRaiseException(
552 IN PEXCEPTION_RECORD ExceptionRecord
553 );
554
555 DECLSPEC_NORETURN
556 NTSYSAPI
557 VOID
558 NTAPI
559 RtlRaiseStatus(
560 IN NTSTATUS Status
561 );
562
563 NTSYSAPI
564 LONG
565 NTAPI
566 RtlUnhandledExceptionFilter(
567 IN struct _EXCEPTION_POINTERS* ExceptionInfo
568 );
569
570 NTSYSAPI
571 VOID
572 NTAPI
573 RtlUnwind(
574 IN PVOID TargetFrame OPTIONAL,
575 IN PVOID TargetIp OPTIONAL,
576 IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL,
577 IN PVOID ReturnValue
578 );
579
580 //
581 // Tracing Functions
582 //
583 NTSYSAPI
584 ULONG
585 NTAPI
586 RtlWalkFrameChain(
587 OUT PVOID *Callers,
588 IN ULONG Count,
589 IN ULONG Flags
590 );
591
592 NTSYSAPI
593 USHORT
594 NTAPI
595 RtlLogStackBackTrace(
596 VOID
597 );
598
599 //
600 // Heap Functions
601 //
602 NTSYSAPI
603 PVOID
604 NTAPI
605 RtlAllocateHeap(
606 IN HANDLE HeapHandle,
607 IN ULONG Flags,
608 IN SIZE_T Size
609 );
610
611 NTSYSAPI
612 PVOID
613 NTAPI
614 RtlCreateHeap(
615 IN ULONG Flags,
616 IN PVOID BaseAddress OPTIONAL,
617 IN SIZE_T SizeToReserve OPTIONAL,
618 IN SIZE_T SizeToCommit OPTIONAL,
619 IN PVOID Lock OPTIONAL,
620 IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
621 );
622
623 NTSYSAPI
624 ULONG
625 NTAPI
626 RtlCreateTagHeap(
627 IN HANDLE HeapHandle,
628 IN ULONG Flags,
629 IN PWSTR TagName,
630 IN PWSTR TagSubName
631 );
632
633 ULONG
634 NTAPI
635 RtlCompactHeap(
636 HANDLE Heap,
637 ULONG Flags
638 );
639
640 NTSYSAPI
641 PVOID
642 NTAPI
643 RtlDebugCreateHeap(
644 IN ULONG Flags,
645 IN PVOID BaseAddress OPTIONAL,
646 IN SIZE_T SizeToReserve OPTIONAL,
647 IN SIZE_T SizeToCommit OPTIONAL,
648 IN PVOID Lock OPTIONAL,
649 IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
650 );
651
652 NTSYSAPI
653 HANDLE
654 NTAPI
655 RtlDestroyHeap(
656 IN HANDLE Heap
657 );
658
659 NTSYSAPI
660 ULONG
661 NTAPI
662 RtlExtendHeap(
663 IN HANDLE Heap,
664 IN ULONG Flags,
665 IN PVOID P,
666 IN SIZE_T Size
667 );
668
669 NTSYSAPI
670 BOOLEAN
671 NTAPI
672 RtlFreeHeap(
673 IN HANDLE HeapHandle,
674 IN ULONG Flags,
675 IN PVOID P
676 );
677
678 NTSYSAPI
679 ULONG
680 NTAPI
681 RtlGetNtGlobalFlags(
682 VOID
683 );
684
685 ULONG
686 NTAPI
687 RtlGetProcessHeaps(
688 ULONG HeapCount,
689 HANDLE *HeapArray
690 );
691
692 BOOLEAN
693 NTAPI
694 RtlGetUserInfoHeap(
695 IN PVOID HeapHandle,
696 IN ULONG Flags,
697 IN PVOID BaseAddress,
698 OUT PVOID *UserValue,
699 OUT PULONG UserFlags
700 );
701
702 NTSYSAPI
703 PVOID
704 NTAPI
705 RtlProtectHeap(
706 IN PVOID HeapHandle,
707 IN BOOLEAN Protect
708 );
709
710 NTSYSAPI
711 PWSTR
712 NTAPI
713 RtlQueryTagHeap(
714 IN PVOID HeapHandle,
715 IN ULONG Flags,
716 IN USHORT TagIndex,
717 IN BOOLEAN ResetCounters,
718 OUT PRTL_HEAP_TAG_INFO HeapTagInfo
719 );
720
721 NTSYSAPI
722 PVOID
723 NTAPI
724 RtlReAllocateHeap(
725 HANDLE Heap,
726 ULONG Flags,
727 PVOID Ptr,
728 SIZE_T Size
729 );
730
731 NTSYSAPI
732 BOOLEAN
733 NTAPI
734 RtlLockHeap(
735 IN HANDLE Heap
736 );
737
738 NTSYSAPI
739 NTSTATUS
740 NTAPI
741 RtlUsageHeap(
742 IN HANDLE Heap,
743 IN ULONG Flags,
744 OUT PRTL_HEAP_USAGE Usage
745 );
746
747 NTSYSAPI
748 BOOLEAN
749 NTAPI
750 RtlUnlockHeap(
751 IN HANDLE Heap
752 );
753
754 BOOLEAN
755 NTAPI
756 RtlSetUserValueHeap(
757 IN PVOID HeapHandle,
758 IN ULONG Flags,
759 IN PVOID BaseAddress,
760 IN PVOID UserValue
761 );
762
763 BOOLEAN
764 NTAPI
765 RtlSetUserFlagsHeap(
766 IN PVOID HeapHandle,
767 IN ULONG Flags,
768 IN PVOID BaseAddress,
769 IN ULONG UserFlags
770 );
771
772 NTSYSAPI
773 SIZE_T
774 NTAPI
775 RtlSizeHeap(
776 IN PVOID HeapHandle,
777 IN ULONG Flags,
778 IN PVOID MemoryPointer
779 );
780
781 NTSYSAPI
782 BOOLEAN
783 NTAPI
784 RtlValidateHeap(
785 HANDLE Heap,
786 ULONG Flags,
787 PVOID P
788 );
789
790 NTSYSAPI
791 NTSTATUS
792 NTAPI
793 RtlWalkHeap(
794 IN HANDLE HeapHandle,
795 IN PVOID HeapEntry
796 );
797
798 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
799
800 //
801 // Security Functions
802 //
803 NTSYSAPI
804 NTSTATUS
805 NTAPI
806 RtlAbsoluteToSelfRelativeSD(
807 IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
808 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor,
809 IN PULONG BufferLength
810 );
811
812 NTSYSAPI
813 NTSTATUS
814 NTAPI
815 RtlAddAccessAllowedAce(
816 PACL Acl,
817 ULONG Revision,
818 ACCESS_MASK AccessMask,
819 PSID Sid
820 );
821
822 NTSYSAPI
823 NTSTATUS
824 NTAPI
825 RtlAddAccessAllowedAceEx(
826 IN OUT PACL pAcl,
827 IN ULONG dwAceRevision,
828 IN ULONG AceFlags,
829 IN ACCESS_MASK AccessMask,
830 IN PSID pSid
831 );
832
833 NTSYSAPI
834 NTSTATUS
835 NTAPI
836 RtlAddAccessAllowedObjectAce(
837 IN OUT PACL pAcl,
838 IN ULONG dwAceRevision,
839 IN ULONG AceFlags,
840 IN ACCESS_MASK AccessMask,
841 IN GUID *ObjectTypeGuid OPTIONAL,
842 IN GUID *InheritedObjectTypeGuid OPTIONAL,
843 IN PSID pSid
844 );
845
846 NTSYSAPI
847 NTSTATUS
848 NTAPI
849 RtlAddAccessDeniedAce(
850 PACL Acl,
851 ULONG Revision,
852 ACCESS_MASK AccessMask,
853 PSID Sid
854 );
855
856 NTSYSAPI
857 NTSTATUS
858 NTAPI
859 RtlAddAccessDeniedAceEx(
860 IN OUT PACL Acl,
861 IN ULONG Revision,
862 IN ULONG Flags,
863 IN ACCESS_MASK AccessMask,
864 IN PSID Sid
865 );
866
867 NTSYSAPI
868 NTSTATUS
869 NTAPI
870 RtlAddAccessDeniedObjectAce(
871 IN OUT PACL pAcl,
872 IN ULONG dwAceRevision,
873 IN ULONG AceFlags,
874 IN ACCESS_MASK AccessMask,
875 IN GUID *ObjectTypeGuid OPTIONAL,
876 IN GUID *InheritedObjectTypeGuid OPTIONAL,
877 IN PSID pSid
878 );
879
880 NTSYSAPI
881 NTSTATUS
882 NTAPI
883 RtlAddAce(
884 PACL Acl,
885 ULONG AceRevision,
886 ULONG StartingAceIndex,
887 PVOID AceList,
888 ULONG AceListLength
889 );
890
891 NTSYSAPI
892 NTSTATUS
893 NTAPI
894 RtlAddAuditAccessAce(
895 PACL Acl,
896 ULONG Revision,
897 ACCESS_MASK AccessMask,
898 PSID Sid,
899 BOOLEAN Success,
900 BOOLEAN Failure
901 );
902
903 NTSYSAPI
904 NTSTATUS
905 NTAPI
906 RtlAcquirePrivilege(
907 IN PULONG Privilege,
908 IN ULONG NumPriv,
909 IN ULONG Flags,
910 OUT PVOID *ReturnedState
911 );
912
913 NTSYSAPI
914 NTSTATUS
915 NTAPI
916 RtlAddAuditAccessAceEx(
917 IN OUT PACL Acl,
918 IN ULONG Revision,
919 IN ULONG Flags,
920 IN ACCESS_MASK AccessMask,
921 IN PSID Sid,
922 IN BOOLEAN Success,
923 IN BOOLEAN Failure
924 );
925
926 NTSYSAPI
927 NTSTATUS
928 NTAPI
929 RtlAddAuditAccessObjectAce(
930 IN OUT PACL Acl,
931 IN ULONG Revision,
932 IN ULONG Flags,
933 IN ACCESS_MASK AccessMask,
934 IN GUID *ObjectTypeGuid OPTIONAL,
935 IN GUID *InheritedObjectTypeGuid OPTIONAL,
936 IN PSID Sid,
937 IN BOOLEAN Success,
938 IN BOOLEAN Failure
939 );
940
941 NTSYSAPI
942 NTSTATUS
943 NTAPI
944 RtlAddMandatoryAce(
945 IN OUT PACL Acl,
946 IN ULONG Revision,
947 IN ULONG Flags,
948 IN ULONG MandatoryFlags,
949 IN ULONG AceType,
950 IN PSID LabelSid);
951
952 NTSYSAPI
953 NTSTATUS
954 NTAPI
955 RtlAdjustPrivilege(
956 IN ULONG Privilege,
957 IN BOOLEAN NewValue,
958 IN BOOLEAN ForThread,
959 OUT PBOOLEAN OldValue
960 );
961
962 NTSYSAPI
963 NTSTATUS
964 NTAPI
965 RtlAllocateAndInitializeSid(
966 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
967 IN UCHAR SubAuthorityCount,
968 IN ULONG SubAuthority0,
969 IN ULONG SubAuthority1,
970 IN ULONG SubAuthority2,
971 IN ULONG SubAuthority3,
972 IN ULONG SubAuthority4,
973 IN ULONG SubAuthority5,
974 IN ULONG SubAuthority6,
975 IN ULONG SubAuthority7,
976 OUT PSID *Sid
977 );
978
979 NTSYSAPI
980 BOOLEAN
981 NTAPI
982 RtlAreAllAccessesGranted(
983 ACCESS_MASK GrantedAccess,
984 ACCESS_MASK DesiredAccess
985 );
986
987 NTSYSAPI
988 BOOLEAN
989 NTAPI
990 RtlAreAnyAccessesGranted(
991 ACCESS_MASK GrantedAccess,
992 ACCESS_MASK DesiredAccess
993 );
994
995 NTSYSAPI
996 VOID
997 NTAPI
998 RtlCopyLuid(
999 IN PLUID LuidDest,
1000 IN PLUID LuidSrc
1001 );
1002
1003 NTSYSAPI
1004 VOID
1005 NTAPI
1006 RtlCopyLuidAndAttributesArray(
1007 ULONG Count,
1008 PLUID_AND_ATTRIBUTES Src,
1009 PLUID_AND_ATTRIBUTES Dest
1010 );
1011
1012 NTSYSAPI
1013 NTSTATUS
1014 NTAPI
1015 RtlCopySidAndAttributesArray(
1016 ULONG Count,
1017 PSID_AND_ATTRIBUTES Src,
1018 ULONG SidAreaSize,
1019 PSID_AND_ATTRIBUTES Dest,
1020 PVOID SidArea,
1021 PVOID* RemainingSidArea,
1022 PULONG RemainingSidAreaSize
1023 );
1024
1025 NTSYSAPI
1026 NTSTATUS
1027 NTAPI
1028 RtlConvertSidToUnicodeString(
1029 OUT PUNICODE_STRING DestinationString,
1030 IN PSID Sid,
1031 IN BOOLEAN AllocateDestinationString
1032 );
1033
1034 NTSYSAPI
1035 NTSTATUS
1036 NTAPI
1037 RtlCopySid(
1038 IN ULONG Length,
1039 IN PSID Destination,
1040 IN PSID Source
1041 );
1042
1043 NTSYSAPI
1044 NTSTATUS
1045 NTAPI
1046 RtlCreateAcl(
1047 PACL Acl,
1048 ULONG AclSize,
1049 ULONG AclRevision
1050 );
1051
1052 NTSYSAPI
1053 NTSTATUS
1054 NTAPI
1055 RtlCreateSecurityDescriptor(
1056 OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1057 IN ULONG Revision
1058 );
1059
1060 NTSYSAPI
1061 NTSTATUS
1062 NTAPI
1063 RtlCreateSecurityDescriptorRelative(
1064 OUT PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
1065 IN ULONG Revision
1066 );
1067
1068 NTSYSAPI
1069 NTSTATUS
1070 NTAPI
1071 RtlCopySecurityDescriptor(
1072 IN PSECURITY_DESCRIPTOR pSourceSecurityDescriptor,
1073 OUT PSECURITY_DESCRIPTOR pDestinationSecurityDescriptor
1074 );
1075
1076 NTSYSAPI
1077 NTSTATUS
1078 NTAPI
1079 RtlDeleteAce(
1080 PACL Acl,
1081 ULONG AceIndex
1082 );
1083
1084 NTSYSAPI
1085 BOOLEAN
1086 NTAPI
1087 RtlEqualPrefixSid(
1088 PSID Sid1,
1089 PSID Sid2
1090 );
1091
1092 NTSYSAPI
1093 BOOLEAN
1094 NTAPI
1095 RtlEqualSid (
1096 IN PSID Sid1,
1097 IN PSID Sid2
1098 );
1099
1100 NTSYSAPI
1101 BOOLEAN
1102 NTAPI
1103 RtlFirstFreeAce(
1104 PACL Acl,
1105 PACE* Ace
1106 );
1107
1108 NTSYSAPI
1109 PVOID
1110 NTAPI
1111 RtlFreeSid (
1112 IN PSID Sid
1113 );
1114
1115 NTSYSAPI
1116 NTSTATUS
1117 NTAPI
1118 RtlGetAce(
1119 PACL Acl,
1120 ULONG AceIndex,
1121 PVOID *Ace
1122 );
1123
1124 NTSYSAPI
1125 NTSTATUS
1126 NTAPI
1127 RtlGetControlSecurityDescriptor(
1128 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1129 OUT PSECURITY_DESCRIPTOR_CONTROL Control,
1130 OUT PULONG Revision
1131 );
1132
1133 NTSYSAPI
1134 NTSTATUS
1135 NTAPI
1136 RtlGetDaclSecurityDescriptor(
1137 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1138 OUT PBOOLEAN DaclPresent,
1139 OUT PACL *Dacl,
1140 OUT PBOOLEAN DaclDefaulted
1141 );
1142
1143 NTSYSAPI
1144 NTSTATUS
1145 NTAPI
1146 RtlGetSaclSecurityDescriptor(
1147 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1148 OUT PBOOLEAN SaclPresent,
1149 OUT PACL* Sacl,
1150 OUT PBOOLEAN SaclDefaulted
1151 );
1152
1153 NTSYSAPI
1154 NTSTATUS
1155 NTAPI
1156 RtlGetGroupSecurityDescriptor(
1157 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1158 OUT PSID *Group,
1159 OUT PBOOLEAN GroupDefaulted
1160 );
1161
1162 NTSYSAPI
1163 NTSTATUS
1164 NTAPI
1165 RtlGetOwnerSecurityDescriptor(
1166 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1167 OUT PSID *Owner,
1168 OUT PBOOLEAN OwnerDefaulted
1169 );
1170
1171 NTSYSAPI
1172 BOOLEAN
1173 NTAPI
1174 RtlGetSecurityDescriptorRMControl(
1175 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1176 OUT PUCHAR RMControl
1177 );
1178
1179 NTSYSAPI
1180 PSID_IDENTIFIER_AUTHORITY
1181 NTAPI
1182 RtlIdentifierAuthoritySid(PSID Sid);
1183
1184 NTSYSAPI
1185 NTSTATUS
1186 NTAPI
1187 RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel);
1188
1189 NTSYSAPI
1190 NTSTATUS
1191 NTAPI
1192 RtlInitializeSid(
1193 IN OUT PSID Sid,
1194 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
1195 IN UCHAR SubAuthorityCount
1196 );
1197
1198 NTSYSAPI
1199 ULONG
1200 NTAPI
1201 RtlLengthRequiredSid(IN ULONG SubAuthorityCount);
1202
1203 NTSYSAPI
1204 ULONG
1205 NTAPI
1206 RtlLengthSid(IN PSID Sid);
1207
1208 NTSYSAPI
1209 NTSTATUS
1210 NTAPI
1211 RtlMakeSelfRelativeSD(
1212 IN PSECURITY_DESCRIPTOR AbsoluteSD,
1213 OUT PSECURITY_DESCRIPTOR SelfRelativeSD,
1214 IN OUT PULONG BufferLength);
1215
1216 NTSYSAPI
1217 VOID
1218 NTAPI
1219 RtlMapGenericMask(
1220 PACCESS_MASK AccessMask,
1221 PGENERIC_MAPPING GenericMapping
1222 );
1223
1224 #ifdef NTOS_MODE_USER
1225
1226 NTSYSAPI
1227 NTSTATUS
1228 NTAPI
1229 RtlQueryInformationAcl(
1230 PACL Acl,
1231 PVOID Information,
1232 ULONG InformationLength,
1233 ACL_INFORMATION_CLASS InformationClass
1234 );
1235
1236 #endif
1237
1238 NTSYSAPI
1239 VOID
1240 NTAPI
1241 RtlReleasePrivilege(
1242 IN PVOID ReturnedState
1243 );
1244
1245 NTSYSAPI
1246 NTSTATUS
1247 NTAPI
1248 RtlSelfRelativeToAbsoluteSD(
1249 IN PSECURITY_DESCRIPTOR SelfRelativeSD,
1250 OUT PSECURITY_DESCRIPTOR AbsoluteSD,
1251 IN PULONG AbsoluteSDSize,
1252 IN PACL Dacl,
1253 IN PULONG DaclSize,
1254 IN PACL Sacl,
1255 IN PULONG SaclSize,
1256 IN PSID Owner,
1257 IN PULONG OwnerSize,
1258 IN PSID PrimaryGroup,
1259 IN PULONG PrimaryGroupSize
1260 );
1261
1262 NTSYSAPI
1263 NTSTATUS
1264 NTAPI
1265 RtlSelfRelativeToAbsoluteSD2(
1266 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSD,
1267 OUT PULONG BufferSize
1268 );
1269
1270 NTSYSAPI
1271 NTSTATUS
1272 NTAPI
1273 RtlSetAttributesSecurityDescriptor(
1274 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1275 IN SECURITY_DESCRIPTOR_CONTROL Control,
1276 OUT PULONG Revision
1277 );
1278
1279 NTSYSAPI
1280 NTSTATUS
1281 NTAPI
1282 RtlSetControlSecurityDescriptor(
1283 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1284 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
1285 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
1286 );
1287
1288 NTSYSAPI
1289 NTSTATUS
1290 NTAPI
1291 RtlSetDaclSecurityDescriptor (
1292 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1293 IN BOOLEAN DaclPresent,
1294 IN PACL Dacl,
1295 IN BOOLEAN DaclDefaulted
1296 );
1297
1298 NTSYSAPI
1299 NTSTATUS
1300 NTAPI
1301 RtlSetGroupSecurityDescriptor(
1302 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1303 IN PSID Group,
1304 IN BOOLEAN GroupDefaulted
1305 );
1306
1307 #ifdef NTOS_MODE_USER
1308
1309 NTSYSAPI
1310 NTSTATUS
1311 NTAPI
1312 RtlSetInformationAcl(
1313 PACL Acl,
1314 PVOID Information,
1315 ULONG InformationLength,
1316 ACL_INFORMATION_CLASS InformationClass
1317 );
1318
1319 #endif
1320
1321 NTSYSAPI
1322 NTSTATUS
1323 NTAPI
1324 RtlSetOwnerSecurityDescriptor(
1325 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1326 IN PSID Owner,
1327 IN BOOLEAN OwnerDefaulted
1328 );
1329
1330 NTSYSAPI
1331 NTSTATUS
1332 NTAPI
1333 RtlSetSaclSecurityDescriptor(
1334 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1335 IN BOOLEAN SaclPresent,
1336 IN PACL Sacl,
1337 IN BOOLEAN SaclDefaulted
1338 );
1339
1340 NTSYSAPI
1341 VOID
1342 NTAPI
1343 RtlSetSecurityDescriptorRMControl(
1344 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1345 IN PUCHAR RMControl
1346 );
1347
1348 NTSYSAPI
1349 PUCHAR
1350 NTAPI
1351 RtlSubAuthorityCountSid(
1352 IN PSID Sid
1353 );
1354
1355 NTSYSAPI
1356 PULONG
1357 NTAPI
1358 RtlSubAuthoritySid(
1359 IN PSID Sid,
1360 IN ULONG SubAuthority
1361 );
1362
1363 NTSYSAPI
1364 BOOLEAN
1365 NTAPI
1366 RtlValidRelativeSecurityDescriptor(
1367 IN PSECURITY_DESCRIPTOR SecurityDescriptorInput,
1368 IN ULONG SecurityDescriptorLength,
1369 IN SECURITY_INFORMATION RequiredInformation
1370 );
1371
1372 NTSYSAPI
1373 BOOLEAN
1374 NTAPI
1375 RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor);
1376
1377 NTSYSAPI
1378 BOOLEAN
1379 NTAPI
1380 RtlValidSid(IN PSID Sid);
1381
1382 NTSYSAPI
1383 BOOLEAN
1384 NTAPI
1385 RtlValidAcl(PACL Acl);
1386
1387 NTSYSAPI
1388 NTSTATUS
1389 NTAPI
1390 RtlDeleteSecurityObject(
1391 IN PSECURITY_DESCRIPTOR *ObjectDescriptor
1392 );
1393
1394 NTSYSAPI
1395 NTSTATUS
1396 NTAPI
1397 RtlNewSecurityObject(
1398 IN PSECURITY_DESCRIPTOR ParentDescriptor,
1399 IN PSECURITY_DESCRIPTOR CreatorDescriptor,
1400 OUT PSECURITY_DESCRIPTOR *NewDescriptor,
1401 IN BOOLEAN IsDirectoryObject,
1402 IN HANDLE Token,
1403 IN PGENERIC_MAPPING GenericMapping
1404 );
1405
1406 NTSYSAPI
1407 NTSTATUS
1408 NTAPI
1409 RtlQuerySecurityObject(
1410 IN PSECURITY_DESCRIPTOR ObjectDescriptor,
1411 IN SECURITY_INFORMATION SecurityInformation,
1412 OUT PSECURITY_DESCRIPTOR ResultantDescriptor,
1413 IN ULONG DescriptorLength,
1414 OUT PULONG ReturnLength
1415 );
1416
1417 NTSYSAPI
1418 NTSTATUS
1419 NTAPI
1420 RtlSetSecurityObject(
1421 IN SECURITY_INFORMATION SecurityInformation,
1422 IN PSECURITY_DESCRIPTOR ModificationDescriptor,
1423 OUT PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
1424 IN PGENERIC_MAPPING GenericMapping,
1425 IN HANDLE Token
1426 );
1427
1428 //
1429 // Single-Character Functions
1430 //
1431 NTSYSAPI
1432 NTSTATUS
1433 NTAPI
1434 RtlLargeIntegerToChar(
1435 IN PLARGE_INTEGER Value,
1436 IN ULONG Base,
1437 IN ULONG Length,
1438 IN OUT PCHAR String
1439 );
1440
1441 NTSYSAPI
1442 CHAR
1443 NTAPI
1444 RtlUpperChar(CHAR Source);
1445
1446 NTSYSAPI
1447 WCHAR
1448 NTAPI
1449 RtlUpcaseUnicodeChar(WCHAR Source);
1450
1451 NTSYSAPI
1452 WCHAR
1453 NTAPI
1454 RtlDowncaseUnicodeChar(IN WCHAR Source);
1455
1456 NTSYSAPI
1457 NTSTATUS
1458 NTAPI
1459 RtlIntegerToChar(
1460 IN ULONG Value,
1461 IN ULONG Base,
1462 IN ULONG Length,
1463 IN OUT PCHAR String
1464 );
1465
1466 NTSYSAPI
1467 NTSTATUS
1468 NTAPI
1469 RtlIntegerToUnicode(
1470 IN ULONG Value,
1471 IN ULONG Base OPTIONAL,
1472 IN ULONG Length OPTIONAL,
1473 IN OUT LPWSTR String
1474 );
1475
1476 NTSYSAPI
1477 NTSTATUS
1478 NTAPI
1479 RtlIntegerToUnicodeString(
1480 IN ULONG Value,
1481 IN ULONG Base,
1482 IN OUT PUNICODE_STRING String
1483 );
1484
1485 NTSYSAPI
1486 NTSTATUS
1487 NTAPI
1488 RtlCharToInteger(
1489 PCSZ String,
1490 ULONG Base,
1491 PULONG Value
1492 );
1493
1494 //
1495 // Byte Swap Functions
1496 //
1497 #ifdef NTOS_MODE_USER
1498
1499 #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || \
1500 ((defined(_M_AMD64) || \
1501 defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
1502
1503 unsigned short __cdecl _byteswap_ushort(unsigned short);
1504 unsigned long __cdecl _byteswap_ulong (unsigned long);
1505 unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
1506 #pragma intrinsic(_byteswap_ushort)
1507 #pragma intrinsic(_byteswap_ulong)
1508 #pragma intrinsic(_byteswap_uint64)
1509 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
1510 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
1511 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
1512
1513 #elif defined (__GNUC__)
1514
1515 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
1516 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
1517 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
1518
1519 #else
1520
1521 #if (NTDDI_VERSION >= NTDDI_WIN2K)
1522 NTSYSAPI
1523 USHORT
1524 FASTCALL
1525 RtlUshortByteSwap(IN USHORT Source);
1526
1527 NTSYSAPI
1528 ULONG
1529 FASTCALL
1530 RtlUlongByteSwap(IN ULONG Source);
1531
1532 NTSYSAPI
1533 ULONGLONG
1534 FASTCALL
1535 RtlUlonglongByteSwap(IN ULONGLONG Source);
1536 #endif
1537
1538 #endif
1539 #endif // NTOS_MODE_USER
1540
1541 //
1542 // Unicode->Ansi String Functions
1543 //
1544 NTSYSAPI
1545 ULONG
1546 NTAPI
1547 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString);
1548
1549 #ifdef NTOS_MODE_USER
1550
1551 #define RtlUnicodeStringToAnsiSize(STRING) ( \
1552 NLS_MB_CODE_PAGE_TAG ? \
1553 RtlxUnicodeStringToAnsiSize(STRING) : \
1554 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1555 )
1556
1557 #endif
1558
1559 NTSYSAPI
1560 NTSTATUS
1561 NTAPI
1562 RtlUnicodeStringToAnsiString(
1563 PANSI_STRING DestinationString,
1564 PCUNICODE_STRING SourceString,
1565 BOOLEAN AllocateDestinationString
1566 );
1567
1568 //
1569 // Unicode->OEM String Functions
1570 //
1571 NTSYSAPI
1572 NTSTATUS
1573 NTAPI
1574 RtlUpcaseUnicodeStringToOemString(
1575 POEM_STRING DestinationString,
1576 PCUNICODE_STRING SourceString,
1577 BOOLEAN AllocateDestinationString
1578 );
1579
1580 NTSYSAPI
1581 NTSTATUS
1582 NTAPI
1583 RtlUpcaseUnicodeStringToCountedOemString(
1584 IN OUT POEM_STRING DestinationString,
1585 IN PCUNICODE_STRING SourceString,
1586 IN BOOLEAN AllocateDestinationString
1587 );
1588
1589 NTSYSAPI
1590 NTSTATUS
1591 NTAPI
1592 RtlUnicodeStringToOemString(
1593 POEM_STRING DestinationString,
1594 PCUNICODE_STRING SourceString,
1595 BOOLEAN AllocateDestinationString
1596 );
1597
1598 NTSYSAPI
1599 NTSTATUS
1600 NTAPI
1601 RtlUpcaseUnicodeToOemN(
1602 PCHAR OemString,
1603 ULONG OemSize,
1604 PULONG ResultSize,
1605 PCWCH UnicodeString,
1606 ULONG UnicodeSize
1607 );
1608
1609 NTSYSAPI
1610 ULONG
1611 NTAPI
1612 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString);
1613
1614 #ifdef NTOS_MODE_USER
1615
1616 #define RtlUnicodeStringToOemSize(STRING) ( \
1617 NLS_MB_OEM_CODE_PAGE_TAG ? \
1618 RtlxUnicodeStringToOemSize(STRING) : \
1619 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1620 )
1621
1622 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
1623 (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
1624 )
1625
1626 #endif
1627
1628 NTSYSAPI
1629 NTSTATUS
1630 NTAPI
1631 RtlUnicodeToOemN(
1632 PCHAR OemString,
1633 ULONG OemSize,
1634 PULONG ResultSize,
1635 PCWCH UnicodeString,
1636 ULONG UnicodeSize
1637 );
1638
1639 //
1640 // Unicode->MultiByte String Functions
1641 //
1642 NTSYSAPI
1643 NTSTATUS
1644 NTAPI
1645 RtlUnicodeToMultiByteN(
1646 PCHAR MbString,
1647 ULONG MbSize,
1648 PULONG ResultSize,
1649 PWCHAR UnicodeString,
1650 ULONG UnicodeSize
1651 );
1652
1653 NTSYSAPI
1654 NTSTATUS
1655 NTAPI
1656 RtlUpcaseUnicodeToMultiByteN(
1657 PCHAR MbString,
1658 ULONG MbSize,
1659 PULONG ResultSize,
1660 PCWCH UnicodeString,
1661 ULONG UnicodeSize
1662 );
1663
1664 NTSYSAPI
1665 NTSTATUS
1666 NTAPI
1667 RtlUnicodeToMultiByteSize(
1668 PULONG MbSize,
1669 PCWCH UnicodeString,
1670 ULONG UnicodeSize
1671 );
1672
1673 NTSYSAPI
1674 ULONG
1675 NTAPI
1676 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString);
1677
1678 //
1679 // OEM to Unicode Functions
1680 //
1681 NTSYSAPI
1682 NTSTATUS
1683 NTAPI
1684 RtlOemStringToUnicodeString(
1685 PUNICODE_STRING DestinationString,
1686 PCOEM_STRING SourceString,
1687 BOOLEAN AllocateDestinationString
1688 );
1689
1690 NTSYSAPI
1691 NTSTATUS
1692 NTAPI
1693 RtlOemToUnicodeN(
1694 PWSTR UnicodeString,
1695 ULONG MaxBytesInUnicodeString,
1696 PULONG BytesInUnicodeString,
1697 IN PCCH OemString,
1698 ULONG BytesInOemString
1699 );
1700
1701 #ifdef NTOS_MODE_USER
1702
1703 #define RtlOemStringToUnicodeSize(STRING) ( \
1704 NLS_MB_OEM_CODE_PAGE_TAG ? \
1705 RtlxOemStringToUnicodeSize(STRING) : \
1706 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1707 )
1708
1709 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
1710 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
1711 )
1712
1713 #endif
1714
1715 //
1716 // Ansi->Unicode String Functions
1717 //
1718 NTSYSAPI
1719 ULONG
1720 NTAPI
1721 RtlxAnsiStringToUnicodeSize(
1722 PCANSI_STRING AnsiString
1723 );
1724
1725 NTSYSAPI
1726 NTSTATUS
1727 NTAPI
1728 RtlAnsiStringToUnicodeString(
1729 PUNICODE_STRING DestinationString,
1730 PCANSI_STRING SourceString,
1731 BOOLEAN AllocateDestinationString
1732 );
1733
1734 #ifdef NTOS_MODE_USER
1735
1736 #define RtlAnsiStringToUnicodeSize(STRING) ( \
1737 NLS_MB_CODE_PAGE_TAG ? \
1738 RtlxAnsiStringToUnicodeSize(STRING) : \
1739 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1740 )
1741
1742 #endif
1743
1744 NTSYSAPI
1745 BOOLEAN
1746 NTAPI
1747 RtlCreateUnicodeStringFromAsciiz(
1748 OUT PUNICODE_STRING Destination,
1749 IN PCSZ Source
1750 );
1751
1752 //
1753 // Unicode String Functions
1754 //
1755 NTSYSAPI
1756 NTSTATUS
1757 NTAPI
1758 RtlAppendUnicodeToString(
1759 PUNICODE_STRING Destination,
1760 PCWSTR Source
1761 );
1762
1763 NTSYSAPI
1764 NTSTATUS
1765 NTAPI
1766 RtlAppendUnicodeStringToString(
1767 PUNICODE_STRING Destination,
1768 PCUNICODE_STRING Source
1769 );
1770
1771 NTSYSAPI
1772 LONG
1773 NTAPI
1774 RtlCompareUnicodeString(
1775 PCUNICODE_STRING String1,
1776 PCUNICODE_STRING String2,
1777 BOOLEAN CaseInsensitive
1778 );
1779
1780 NTSYSAPI
1781 VOID
1782 NTAPI
1783 RtlCopyUnicodeString(
1784 PUNICODE_STRING DestinationString,
1785 PCUNICODE_STRING SourceString
1786 );
1787
1788 NTSYSAPI
1789 BOOLEAN
1790 NTAPI
1791 RtlCreateUnicodeString(
1792 PUNICODE_STRING DestinationString,
1793 PCWSTR SourceString
1794 );
1795
1796 #ifdef NTOS_MODE_USER
1797
1798 NTSYSAPI
1799 NTSTATUS
1800 NTAPI
1801 RtlDowncaseUnicodeString(
1802 IN OUT PUNICODE_STRING UniDest,
1803 IN PCUNICODE_STRING UniSource,
1804 IN BOOLEAN AllocateDestinationString
1805 );
1806
1807 NTSYSAPI
1808 NTSTATUS
1809 NTAPI
1810 RtlDuplicateUnicodeString(
1811 IN ULONG Flags,
1812 IN PCUNICODE_STRING SourceString,
1813 OUT PUNICODE_STRING DestinationString
1814 );
1815
1816 //
1817 // Memory Functions
1818 //
1819 NTSYSAPI
1820 VOID
1821 NTAPI
1822 RtlFillMemoryUlong(
1823 IN PVOID Destination,
1824 IN ULONG Length,
1825 IN ULONG Fill
1826 );
1827
1828 #endif
1829
1830 NTSYSAPI
1831 BOOLEAN
1832 NTAPI
1833 RtlEqualUnicodeString(
1834 PCUNICODE_STRING String1,
1835 PCUNICODE_STRING String2,
1836 BOOLEAN CaseInsensitive
1837 );
1838
1839 NTSYSAPI
1840 NTSTATUS
1841 NTAPI
1842 RtlFindCharInUnicodeString(
1843 IN ULONG Flags,
1844 IN PUNICODE_STRING SearchString,
1845 IN PCUNICODE_STRING MatchString,
1846 OUT PUSHORT Position
1847 );
1848
1849 NTSYSAPI
1850 VOID
1851 NTAPI
1852 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString);
1853
1854 NTSYSAPI
1855 NTSTATUS
1856 NTAPI
1857 RtlHashUnicodeString(
1858 IN CONST UNICODE_STRING *String,
1859 IN BOOLEAN CaseInSensitive,
1860 IN ULONG HashAlgorithm,
1861 OUT PULONG HashValue
1862 );
1863
1864 NTSYSAPI
1865 VOID
1866 NTAPI
1867 RtlInitUnicodeString(
1868 IN OUT PUNICODE_STRING DestinationString,
1869 IN PCWSTR SourceString
1870 );
1871
1872 NTSYSAPI
1873 NTSTATUS
1874 NTAPI
1875 RtlInitUnicodeStringEx(
1876 OUT PUNICODE_STRING DestinationString,
1877 IN PCWSTR SourceString OPTIONAL
1878 );
1879
1880 NTSYSAPI
1881 BOOLEAN
1882 NTAPI
1883 RtlIsTextUnicode(
1884 PVOID Buffer,
1885 INT Length,
1886 INT *Flags
1887 );
1888
1889 NTSYSAPI
1890 BOOLEAN
1891 NTAPI
1892 RtlPrefixString(
1893 PCANSI_STRING String1,
1894 PCANSI_STRING String2,
1895 BOOLEAN CaseInsensitive
1896 );
1897
1898 NTSYSAPI
1899 BOOLEAN
1900 NTAPI
1901 RtlPrefixUnicodeString(
1902 PCUNICODE_STRING String1,
1903 PCUNICODE_STRING String2,
1904 BOOLEAN CaseInsensitive
1905 );
1906
1907 NTSYSAPI
1908 NTSTATUS
1909 NTAPI
1910 RtlUpcaseUnicodeString(
1911 PUNICODE_STRING DestinationString,
1912 PCUNICODE_STRING SourceString,
1913 BOOLEAN AllocateDestinationString
1914 );
1915
1916 NTSYSAPI
1917 NTSTATUS
1918 NTAPI
1919 RtlUnicodeStringToInteger(
1920 PCUNICODE_STRING String,
1921 ULONG Base,
1922 PULONG Value
1923 );
1924
1925 NTSYSAPI
1926 NTSTATUS
1927 NTAPI
1928 RtlValidateUnicodeString(
1929 IN ULONG Flags,
1930 IN PCUNICODE_STRING String
1931 );
1932
1933 //
1934 // Ansi String Functions
1935 //
1936 NTSYSAPI
1937 VOID
1938 NTAPI
1939 RtlFreeAnsiString(IN PANSI_STRING AnsiString);
1940
1941 NTSYSAPI
1942 VOID
1943 NTAPI
1944 RtlInitAnsiString(
1945 PANSI_STRING DestinationString,
1946 PCSZ SourceString
1947 );
1948
1949 NTSYSAPI
1950 NTSTATUS
1951 NTAPI
1952 RtlInitAnsiStringEx(
1953 PANSI_STRING DestinationString,
1954 PCSZ SourceString
1955 );
1956
1957 //
1958 // OEM String Functions
1959 //
1960 NTSYSAPI
1961 VOID
1962 NTAPI
1963 RtlFreeOemString(IN POEM_STRING OemString);
1964
1965 //
1966 // MultiByte->Unicode String Functions
1967 //
1968 NTSYSAPI
1969 NTSTATUS
1970 NTAPI
1971 RtlMultiByteToUnicodeN(
1972 PWCHAR UnicodeString,
1973 ULONG UnicodeSize,
1974 PULONG ResultSize,
1975 PCSTR MbString,
1976 ULONG MbSize
1977 );
1978
1979 NTSYSAPI
1980 NTSTATUS
1981 NTAPI
1982 RtlMultiByteToUnicodeSize(
1983 PULONG UnicodeSize,
1984 PCSTR MbString,
1985 ULONG MbSize
1986 );
1987
1988 //
1989 // Atom Functions
1990 //
1991 NTSYSAPI
1992 NTSTATUS
1993 NTAPI
1994 RtlAddAtomToAtomTable(
1995 IN PRTL_ATOM_TABLE AtomTable,
1996 IN PWSTR AtomName,
1997 OUT PRTL_ATOM Atom
1998 );
1999
2000 NTSYSAPI
2001 NTSTATUS
2002 NTAPI
2003 RtlCreateAtomTable(
2004 IN ULONG TableSize,
2005 IN OUT PRTL_ATOM_TABLE *AtomTable
2006 );
2007
2008 NTSYSAPI
2009 NTSTATUS
2010 NTAPI
2011 RtlDeleteAtomFromAtomTable(
2012 IN PRTL_ATOM_TABLE AtomTable,
2013 IN RTL_ATOM Atom
2014 );
2015
2016 NTSYSAPI
2017 NTSTATUS
2018 NTAPI
2019 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable);
2020
2021 NTSYSAPI
2022 NTSTATUS
2023 NTAPI
2024 RtlQueryAtomInAtomTable(
2025 IN PRTL_ATOM_TABLE AtomTable,
2026 IN RTL_ATOM Atom,
2027 IN OUT PULONG RefCount OPTIONAL,
2028 IN OUT PULONG PinCount OPTIONAL,
2029 IN OUT PWSTR AtomName OPTIONAL,
2030 IN OUT PULONG NameLength OPTIONAL
2031 );
2032
2033 NTSYSAPI
2034 NTSTATUS
2035 NTAPI
2036 RtlPinAtomInAtomTable(
2037 IN PRTL_ATOM_TABLE AtomTable,
2038 IN RTL_ATOM Atom
2039 );
2040
2041 NTSYSAPI
2042 NTSTATUS
2043 NTAPI
2044 RtlLookupAtomInAtomTable(
2045 IN PRTL_ATOM_TABLE AtomTable,
2046 IN PWSTR AtomName,
2047 OUT PRTL_ATOM Atom
2048 );
2049
2050 //
2051 // Process Management Functions
2052 //
2053 NTSYSAPI
2054 PPEB
2055 NTAPI
2056 RtlGetCurrentPeb(
2057 VOID
2058 );
2059
2060 NTSYSAPI
2061 VOID
2062 NTAPI
2063 RtlAcquirePebLock(VOID);
2064
2065 NTSYSAPI
2066 NTSTATUS
2067 NTAPI
2068 RtlCreateProcessParameters (
2069 OUT PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
2070 IN PUNICODE_STRING ImagePathName OPTIONAL,
2071 IN PUNICODE_STRING DllPath OPTIONAL,
2072 IN PUNICODE_STRING CurrentDirectory OPTIONAL,
2073 IN PUNICODE_STRING CommandLine OPTIONAL,
2074 IN PWSTR Environment OPTIONAL,
2075 IN PUNICODE_STRING WindowTitle OPTIONAL,
2076 IN PUNICODE_STRING DesktopInfo OPTIONAL,
2077 IN PUNICODE_STRING ShellInfo OPTIONAL,
2078 IN PUNICODE_STRING RuntimeInfo OPTIONAL
2079 );
2080
2081 NTSYSAPI
2082 NTSTATUS
2083 NTAPI
2084 RtlCreateUserProcess(
2085 IN PUNICODE_STRING ImageFileName,
2086 IN ULONG Attributes,
2087 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters,
2088 IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL,
2089 IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL,
2090 IN HANDLE ParentProcess OPTIONAL,
2091 IN BOOLEAN CurrentDirectory,
2092 IN HANDLE DebugPort OPTIONAL,
2093 IN HANDLE ExceptionPort OPTIONAL,
2094 OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
2095 );
2096
2097 NTSYSAPI
2098 NTSTATUS
2099 NTAPI
2100 RtlCreateUserThread(
2101 IN HANDLE ProcessHandle,
2102 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
2103 IN BOOLEAN CreateSuspended,
2104 IN ULONG StackZeroBits,
2105 IN SIZE_T StackReserve,
2106 IN SIZE_T StackCommit,
2107 IN PTHREAD_START_ROUTINE StartAddress,
2108 IN PVOID Parameter,
2109 IN OUT PHANDLE ThreadHandle,
2110 IN OUT PCLIENT_ID ClientId
2111 );
2112
2113 NTSYSAPI
2114 PRTL_USER_PROCESS_PARAMETERS
2115 NTAPI
2116 RtlDeNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2117
2118 NTSYSAPI
2119 NTSTATUS
2120 NTAPI
2121 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2122
2123 NTSYSAPI
2124 VOID
2125 NTAPI
2126 RtlExitUserThread(NTSTATUS Status);
2127
2128 NTSYSAPI
2129 VOID
2130 NTAPI
2131 RtlInitializeContext(
2132 IN HANDLE ProcessHandle,
2133 OUT PCONTEXT ThreadContext,
2134 IN PVOID ThreadStartParam OPTIONAL,
2135 IN PTHREAD_START_ROUTINE ThreadStartAddress,
2136 IN PINITIAL_TEB InitialTeb
2137 );
2138
2139 NTSYSAPI
2140 BOOLEAN
2141 NTAPI
2142 RtlIsThreadWithinLoaderCallout(VOID);
2143
2144 NTSYSAPI
2145 PRTL_USER_PROCESS_PARAMETERS
2146 NTAPI
2147 RtlNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2148
2149 NTSYSAPI
2150 VOID
2151 NTAPI
2152 RtlReleasePebLock(VOID);
2153
2154 NTSYSAPI
2155 NTSTATUS
2156 NTAPI
2157 RtlRemoteCall(
2158 IN HANDLE Process,
2159 IN HANDLE Thread,
2160 IN PVOID CallSite,
2161 IN ULONG ArgumentCount,
2162 IN PULONG Arguments,
2163 IN BOOLEAN PassContext,
2164 IN BOOLEAN AlreadySuspended
2165 );
2166
2167 NTSYSAPI
2168 NTSTATUS
2169 NTAPI
2170 RtlSetProcessIsCritical(
2171 IN BOOLEAN NewValue,
2172 OUT PBOOLEAN OldValue OPTIONAL,
2173 IN BOOLEAN NeedBreaks
2174 );
2175
2176 NTSYSAPI
2177 ULONG
2178 NTAPI
2179 RtlGetCurrentProcessorNumber(
2180 VOID
2181 );
2182
2183 #define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock)
2184
2185 //
2186 // Thread Pool Functions
2187 //
2188 NTSYSAPI
2189 NTSTATUS
2190 NTAPI
2191 RtlDeregisterWaitEx(
2192 IN HANDLE hWaitHandle,
2193 IN HANDLE hCompletionEvent
2194 );
2195
2196 NTSYSAPI
2197 NTSTATUS
2198 NTAPI
2199 RtlDeregisterWait(
2200 IN HANDLE hWaitHandle
2201 );
2202
2203 NTSYSAPI
2204 NTSTATUS
2205 NTAPI
2206 RtlQueueWorkItem(
2207 IN WORKERCALLBACKFUNC Function,
2208 IN PVOID Context OPTIONAL,
2209 IN ULONG Flags
2210 );
2211
2212 NTSYSAPI
2213 NTSTATUS
2214 NTAPI
2215 RtlSetIoCompletionCallback(
2216 IN HANDLE FileHandle,
2217 IN PIO_APC_ROUTINE Callback,
2218 IN ULONG Flags
2219 );
2220
2221 NTSYSAPI
2222 NTSTATUS
2223 NTAPI
2224 RtlRegisterWait(
2225 IN PHANDLE phNewWaitObject,
2226 IN HANDLE hObject,
2227 IN WAITORTIMERCALLBACKFUNC Callback,
2228 IN PVOID pvContext,
2229 IN ULONG ulMilliseconds,
2230 IN ULONG ulFlags
2231 );
2232
2233 //
2234 // Environment/Path Functions
2235 //
2236 NTSYSAPI
2237 NTSTATUS
2238 NTAPI
2239 RtlCreateEnvironment(
2240 BOOLEAN Inherit,
2241 PWSTR *Environment
2242 );
2243
2244 NTSYSAPI
2245 NTSTATUS
2246 NTAPI
2247 RtlComputePrivatizedDllName_U(
2248 IN PUNICODE_STRING DllName,
2249 OUT PUNICODE_STRING RealName,
2250 OUT PUNICODE_STRING LocalName
2251 );
2252
2253 NTSYSAPI
2254 VOID
2255 NTAPI
2256 RtlDestroyEnvironment(
2257 IN PWSTR Environment
2258 );
2259
2260 NTSYSAPI
2261 BOOLEAN
2262 NTAPI
2263 RtlDoesFileExists_U(
2264 IN PCWSTR FileName
2265 );
2266
2267 NTSYSAPI
2268 BOOLEAN
2269 NTAPI
2270 RtlDoesFileExists_UstrEx(
2271 IN PCUNICODE_STRING FileName,
2272 IN BOOLEAN SucceedIfBusy
2273 );
2274
2275 NTSYSAPI
2276 ULONG
2277 NTAPI
2278 RtlDetermineDosPathNameType_U(
2279 IN PCWSTR Path
2280 );
2281
2282 NTSYSAPI
2283 ULONG
2284 NTAPI
2285 RtlDetermineDosPathNameType_Ustr(
2286 IN PCUNICODE_STRING Path
2287 );
2288
2289 NTSYSAPI
2290 ULONG
2291 NTAPI
2292 RtlDosSearchPath_U(
2293 IN PCWSTR Path,
2294 IN PCWSTR FileName,
2295 IN PCWSTR Extension,
2296 IN ULONG BufferSize,
2297 OUT PWSTR Buffer,
2298 OUT PWSTR *PartName
2299 );
2300
2301 NTSYSAPI
2302 BOOLEAN
2303 NTAPI
2304 RtlDosPathNameToNtPathName_U(
2305 IN PCWSTR DosPathName,
2306 OUT PUNICODE_STRING NtPathName,
2307 OUT PCWSTR *NtFileNamePart,
2308 OUT CURDIR *DirectoryInfo
2309 );
2310
2311 NTSYSAPI
2312 NTSTATUS
2313 NTAPI
2314 RtlExpandEnvironmentStrings_U(
2315 PWSTR Environment,
2316 PUNICODE_STRING Source,
2317 PUNICODE_STRING Destination,
2318 PULONG Length
2319 );
2320
2321 NTSYSAPI
2322 ULONG
2323 NTAPI
2324 RtlGetCurrentDirectory_U(
2325 ULONG MaximumLength,
2326 PWSTR Buffer
2327 );
2328
2329 NTSYSAPI
2330 ULONG
2331 NTAPI
2332 RtlGetFullPathName_U(
2333 IN PCWSTR FileName,
2334 IN ULONG Size,
2335 IN PWSTR Buffer,
2336 OUT PWSTR *ShortName
2337 );
2338
2339 NTSYSAPI
2340 ULONG
2341 NTAPI
2342 RtlGetFullPathName_Ustr(
2343 IN PUNICODE_STRING FileName,
2344 IN ULONG Size,
2345 IN PWSTR Buffer,
2346 OUT PWSTR *ShortName,
2347 OUT PBOOLEAN InvalidName,
2348 OUT RTL_PATH_TYPE *PathType
2349 );
2350
2351 NTSYSAPI
2352 ULONG
2353 NTAPI
2354 RtlIsDosDeviceName_U(
2355 IN PWSTR Name
2356 );
2357
2358 NTSYSAPI
2359 ULONG
2360 NTAPI
2361 RtlIsDosDeviceName_Ustr(
2362 IN PUNICODE_STRING Name
2363 );
2364
2365
2366 NTSYSAPI
2367 BOOLEAN
2368 NTAPI
2369 RtlIsNameLegalDOS8Dot3(
2370 IN PCUNICODE_STRING Name,
2371 IN OUT POEM_STRING OemName OPTIONAL,
2372 IN OUT PBOOLEAN NameContainsSpaces OPTIONAL
2373 );
2374
2375 NTSYSAPI
2376 NTSTATUS
2377 NTAPI
2378 RtlQueryEnvironmentVariable_U(
2379 PWSTR Environment,
2380 PUNICODE_STRING Name,
2381 PUNICODE_STRING Value
2382 );
2383
2384 NTSYSAPI
2385 NTSTATUS
2386 NTAPI
2387 RtlSetCurrentDirectory_U(
2388 IN PUNICODE_STRING name
2389 );
2390
2391 NTSYSAPI
2392 NTSTATUS
2393 NTAPI
2394 RtlSetEnvironmentVariable(
2395 PWSTR *Environment,
2396 PUNICODE_STRING Name,
2397 PUNICODE_STRING Value
2398 );
2399
2400 //
2401 // Critical Section/Resource Functions
2402 //
2403 NTSYSAPI
2404 NTSTATUS
2405 NTAPI
2406 RtlDeleteCriticalSection (
2407 IN PRTL_CRITICAL_SECTION CriticalSection
2408 );
2409
2410 NTSYSAPI
2411 NTSTATUS
2412 NTAPI
2413 RtlEnterCriticalSection(
2414 IN PRTL_CRITICAL_SECTION CriticalSection
2415 );
2416
2417 NTSYSAPI
2418 NTSTATUS
2419 NTAPI
2420 RtlInitializeCriticalSection(
2421 IN PRTL_CRITICAL_SECTION CriticalSection
2422 );
2423
2424 NTSYSAPI
2425 NTSTATUS
2426 NTAPI
2427 RtlInitializeCriticalSectionAndSpinCount(
2428 IN PRTL_CRITICAL_SECTION CriticalSection,
2429 IN ULONG SpinCount
2430 );
2431
2432 NTSYSAPI
2433 NTSTATUS
2434 NTAPI
2435 RtlLeaveCriticalSection(
2436 IN PRTL_CRITICAL_SECTION CriticalSection
2437 );
2438
2439 NTSYSAPI
2440 BOOLEAN
2441 NTAPI
2442 RtlTryEnterCriticalSection(
2443 IN PRTL_CRITICAL_SECTION CriticalSection
2444 );
2445
2446 NTSYSAPI
2447 VOID
2448 NTAPI
2449 RtlpUnWaitCriticalSection(
2450 IN PRTL_CRITICAL_SECTION CriticalSection
2451 );
2452
2453 NTSYSAPI
2454 NTSTATUS
2455 NTAPI
2456 RtlpWaitForCriticalSection(
2457 IN PRTL_CRITICAL_SECTION CriticalSection
2458 );
2459
2460 NTSYSAPI
2461 BOOLEAN
2462 NTAPI
2463 RtlAcquireResourceExclusive(
2464 IN PRTL_RESOURCE Resource,
2465 IN BOOLEAN Wait
2466 );
2467
2468 NTSYSAPI
2469 BOOLEAN
2470 NTAPI
2471 RtlAcquireResourceShared(
2472 IN PRTL_RESOURCE Resource,
2473 IN BOOLEAN Wait
2474 );
2475
2476 NTSYSAPI
2477 VOID
2478 NTAPI
2479 RtlConvertExclusiveToShared(
2480 IN PRTL_RESOURCE Resource
2481 );
2482
2483 NTSYSAPI
2484 VOID
2485 NTAPI
2486 RtlConvertSharedToExclusive(
2487 IN PRTL_RESOURCE Resource
2488 );
2489
2490 NTSYSAPI
2491 VOID
2492 NTAPI
2493 RtlDeleteResource(
2494 IN PRTL_RESOURCE Resource
2495 );
2496
2497 NTSYSAPI
2498 VOID
2499 NTAPI
2500 RtlDumpResource(
2501 IN PRTL_RESOURCE Resource
2502 );
2503
2504 NTSYSAPI
2505 VOID
2506 NTAPI
2507 RtlInitializeResource(
2508 IN PRTL_RESOURCE Resource
2509 );
2510
2511 NTSYSAPI
2512 VOID
2513 NTAPI
2514 RtlReleaseResource(
2515 IN PRTL_RESOURCE Resource
2516 );
2517
2518 //
2519 // Compression Functions
2520 //
2521 NTSYSAPI
2522 NTSTATUS
2523 NTAPI
2524 RtlCompressBuffer(
2525 IN USHORT CompressionFormatAndEngine,
2526 IN PUCHAR UncompressedBuffer,
2527 IN ULONG UncompressedBufferSize,
2528 OUT PUCHAR CompressedBuffer,
2529 IN ULONG CompressedBufferSize,
2530 IN ULONG UncompressedChunkSize,
2531 OUT PULONG FinalCompressedSize,
2532 IN PVOID WorkSpace
2533 );
2534
2535 NTSYSAPI
2536 NTSTATUS
2537 NTAPI
2538 RtlDecompressBuffer(
2539 IN USHORT CompressionFormat,
2540 OUT PUCHAR UncompressedBuffer,
2541 IN ULONG UncompressedBufferSize,
2542 IN PUCHAR CompressedBuffer,
2543 IN ULONG CompressedBufferSize,
2544 OUT PULONG FinalUncompressedSize
2545 );
2546
2547 NTSYSAPI
2548 NTSTATUS
2549 NTAPI
2550 RtlGetCompressionWorkSpaceSize(
2551 IN USHORT CompressionFormatAndEngine,
2552 OUT PULONG CompressBufferWorkSpaceSize,
2553 OUT PULONG CompressFragmentWorkSpaceSize
2554 );
2555
2556 //
2557 // Debug Info Functions
2558 //
2559 NTSYSAPI
2560 PRTL_DEBUG_INFORMATION
2561 NTAPI
2562 RtlCreateQueryDebugBuffer(
2563 IN ULONG Size,
2564 IN BOOLEAN EventPair
2565 );
2566
2567 NTSYSAPI
2568 NTSTATUS
2569 NTAPI
2570 RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_INFORMATION DebugBuffer);
2571
2572 NTSYSAPI
2573 NTSTATUS
2574 NTAPI
2575 RtlQueryProcessDebugInformation(
2576 IN ULONG ProcessId,
2577 IN ULONG DebugInfoClassMask,
2578 IN OUT PRTL_DEBUG_INFORMATION DebugBuffer
2579 );
2580
2581 //
2582 // Bitmap Functions
2583 //
2584 NTSYSAPI
2585 BOOLEAN
2586 NTAPI
2587 RtlAreBitsClear(
2588 IN PRTL_BITMAP BitMapHeader,
2589 IN ULONG StartingIndex,
2590 IN ULONG Length
2591 );
2592
2593 NTSYSAPI
2594 BOOLEAN
2595 NTAPI
2596 RtlAreBitsSet(
2597 IN PRTL_BITMAP BitMapHeader,
2598 IN ULONG StartingIndex,
2599 IN ULONG Length
2600 );
2601
2602 NTSYSAPI
2603 VOID
2604 NTAPI
2605 RtlClearBits(
2606 IN PRTL_BITMAP BitMapHeader,
2607 IN ULONG StartingIndex,
2608 IN ULONG NumberToClear
2609 );
2610
2611 NTSYSAPI
2612 ULONG
2613 NTAPI
2614 RtlFindClearBits(
2615 IN PRTL_BITMAP BitMapHeader,
2616 IN ULONG NumberToFind,
2617 IN ULONG HintIndex
2618 );
2619
2620 NTSYSAPI
2621 ULONG
2622 NTAPI
2623 RtlFindClearBitsAndSet(
2624 IN PRTL_BITMAP BitMapHeader,
2625 IN ULONG NumberToFind,
2626 IN ULONG HintIndex
2627 );
2628
2629 NTSYSAPI
2630 ULONG
2631 NTAPI
2632 RtlFindNextForwardRunClear(
2633 IN PRTL_BITMAP BitMapHeader,
2634 IN ULONG FromIndex,
2635 IN PULONG StartingRunIndex
2636 );
2637
2638 NTSYSAPI
2639 VOID
2640 NTAPI
2641 RtlInitializeBitMap(
2642 IN PRTL_BITMAP BitMapHeader,
2643 IN PULONG BitMapBuffer,
2644 IN ULONG SizeOfBitMap
2645 );
2646
2647 NTSYSAPI
2648 ULONG
2649 NTAPI
2650 RtlNumberOfSetBits(
2651 IN PRTL_BITMAP BitMapHeader
2652 );
2653
2654 NTSYSAPI
2655 VOID
2656 NTAPI
2657 RtlSetBit(
2658 PRTL_BITMAP BitMapHeader,
2659 ULONG BitNumber
2660 );
2661
2662 NTSYSAPI
2663 VOID
2664 NTAPI
2665 RtlSetBits(
2666 IN PRTL_BITMAP BitMapHeader,
2667 IN ULONG StartingIndex,
2668 IN ULONG NumberToSet
2669 );
2670
2671 NTSYSAPI
2672 VOID
2673 NTAPI
2674 RtlSetAllBits(
2675 PRTL_BITMAP BitMapHeader
2676 );
2677
2678 NTSYSAPI
2679 BOOLEAN
2680 NTAPI
2681 RtlTestBit(
2682 PRTL_BITMAP BitMapHeader,
2683 ULONG BitNumber
2684 );
2685
2686 //
2687 // Timer Functions
2688 //
2689 NTSYSAPI
2690 NTSTATUS
2691 NTAPI
2692 RtlCreateTimer(
2693 HANDLE TimerQueue,
2694 PHANDLE phNewTimer,
2695 WAITORTIMERCALLBACKFUNC Callback,
2696 PVOID Parameter,
2697 ULONG DueTime,
2698 ULONG Period,
2699 ULONG Flags
2700 );
2701
2702 NTSYSAPI
2703 NTSTATUS
2704 NTAPI
2705 RtlCreateTimerQueue(PHANDLE TimerQueue);
2706
2707 NTSYSAPI
2708 NTSTATUS
2709 NTAPI
2710 RtlDeleteTimer(
2711 HANDLE TimerQueue,
2712 HANDLE Timer,
2713 HANDLE CompletionEvent
2714 );
2715
2716 NTSYSAPI
2717 NTSTATUS
2718 NTAPI
2719 RtlUpdateTimer(
2720 HANDLE TimerQueue,
2721 HANDLE Timer,
2722 ULONG DueTime,
2723 ULONG Period
2724 );
2725
2726 NTSYSAPI
2727 NTSTATUS
2728 NTAPI
2729 RtlDeleteTimerQueueEx(
2730 HANDLE TimerQueue,
2731 HANDLE CompletionEvent
2732 );
2733
2734 NTSYSAPI
2735 NTSTATUS
2736 NTAPI
2737 RtlDeleteTimerQueue(HANDLE TimerQueue);
2738
2739 //
2740 // SList functions
2741 //
2742 PSLIST_ENTRY
2743 FASTCALL
2744 InterlockedPushListSList(
2745 IN PSLIST_HEADER ListHead,
2746 IN PSLIST_ENTRY List,
2747 IN PSLIST_ENTRY ListEnd,
2748 IN ULONG Count
2749 );
2750
2751 //
2752 // Range List functions
2753 //
2754 NTSYSAPI
2755 VOID
2756 NTAPI
2757 RtlInitializeRangeList(
2758 IN OUT PRTL_RANGE_LIST RangeList
2759 );
2760
2761 NTSYSAPI
2762 VOID
2763 NTAPI
2764 RtlFreeRangeList(
2765 IN PRTL_RANGE_LIST RangeList
2766 );
2767
2768 NTSYSAPI
2769 NTSTATUS
2770 NTAPI
2771 RtlAddRange(
2772 IN OUT PRTL_RANGE_LIST RangeList,
2773 IN ULONGLONG Start,
2774 IN ULONGLONG End,
2775 IN UCHAR Attributes,
2776 IN ULONG Flags,
2777 IN PVOID UserData OPTIONAL,
2778 IN PVOID Owner OPTIONAL
2779 );
2780
2781 //
2782 // Debug Functions
2783 //
2784 ULONG
2785 __cdecl
2786 DbgPrint(
2787 IN PCCH Format,
2788 IN ...
2789 );
2790
2791 NTSYSAPI
2792 ULONG
2793 __cdecl
2794 DbgPrintEx(
2795 IN ULONG ComponentId,
2796 IN ULONG Level,
2797 IN PCCH Format,
2798 IN ...
2799 );
2800
2801 NTSYSAPI
2802 ULONG
2803 NTAPI
2804 DbgPrompt(
2805 IN PCCH Prompt,
2806 OUT PCH Response,
2807 IN ULONG MaximumResponseLength
2808 );
2809
2810 VOID
2811 NTAPI
2812 DbgBreakPoint(
2813 VOID
2814 );
2815
2816 VOID
2817 NTAPI
2818 DbgLoadImageSymbols(
2819 IN PSTRING Name,
2820 IN PVOID Base,
2821 IN ULONG_PTR ProcessId
2822 );
2823
2824 VOID
2825 NTAPI
2826 DbgUnLoadImageSymbols(
2827 IN PSTRING Name,
2828 IN PVOID Base,
2829 IN ULONG_PTR ProcessId
2830 );
2831
2832 VOID
2833 NTAPI
2834 DbgCommandString(
2835 IN PCCH Name,
2836 IN PCCH Command
2837 );
2838
2839 //
2840 // Generic Table Functions
2841 //
2842 #if defined(NTOS_MODE_USER) || defined(_NTIFS_)
2843 NTSYSAPI
2844 PVOID
2845 NTAPI
2846 RtlInsertElementGenericTable(
2847 IN PRTL_GENERIC_TABLE Table,
2848 IN PVOID Buffer,
2849 IN ULONG BufferSize,
2850 OUT PBOOLEAN NewElement OPTIONAL
2851 );
2852
2853 NTSYSAPI
2854 PVOID
2855 NTAPI
2856 RtlInsertElementGenericTableFull(
2857 IN PRTL_GENERIC_TABLE Table,
2858 IN PVOID Buffer,
2859 IN ULONG BufferSize,
2860 OUT PBOOLEAN NewElement OPTIONAL,
2861 IN PVOID NodeOrParent,
2862 IN TABLE_SEARCH_RESULT SearchResult
2863 );
2864
2865 NTSYSAPI
2866 BOOLEAN
2867 NTAPI
2868 RtlIsGenericTableEmpty(
2869 IN PRTL_GENERIC_TABLE Table
2870 );
2871
2872 NTSYSAPI
2873 PVOID
2874 NTAPI
2875 RtlLookupElementGenericTableFull(
2876 IN PRTL_GENERIC_TABLE Table,
2877 IN PVOID Buffer,
2878 OUT PVOID *NodeOrParent,
2879 OUT TABLE_SEARCH_RESULT *SearchResult
2880 );
2881 #endif
2882
2883 //
2884 // Handle Table Functions
2885 //
2886 NTSYSAPI
2887 PRTL_HANDLE_TABLE_ENTRY
2888 NTAPI
2889 RtlAllocateHandle(
2890 IN PRTL_HANDLE_TABLE HandleTable,
2891 IN OUT PULONG Index
2892 );
2893
2894 NTSYSAPI
2895 VOID
2896 NTAPI
2897 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable);
2898
2899 NTSYSAPI
2900 BOOLEAN
2901 NTAPI
2902 RtlFreeHandle(
2903 IN PRTL_HANDLE_TABLE HandleTable,
2904 IN PRTL_HANDLE_TABLE_ENTRY Handle
2905 );
2906
2907 NTSYSAPI
2908 VOID
2909 NTAPI
2910 RtlInitializeHandleTable(
2911 IN ULONG TableSize,
2912 IN ULONG HandleSize,
2913 IN PRTL_HANDLE_TABLE HandleTable
2914 );
2915
2916 NTSYSAPI
2917 BOOLEAN
2918 NTAPI
2919 RtlIsValidHandle(
2920 IN PRTL_HANDLE_TABLE HandleTable,
2921 IN PRTL_HANDLE_TABLE_ENTRY Handle
2922 );
2923
2924 NTSYSAPI
2925 BOOLEAN
2926 NTAPI
2927 RtlIsValidIndexHandle(
2928 IN PRTL_HANDLE_TABLE HandleTable,
2929 IN ULONG Index,
2930 OUT PRTL_HANDLE_TABLE_ENTRY *Handle
2931 );
2932
2933 //
2934 // PE Functions
2935 //
2936 NTSYSAPI
2937 NTSTATUS
2938 NTAPI
2939 RtlFindMessage(
2940 IN PVOID BaseAddress,
2941 IN ULONG Type,
2942 IN ULONG Language,
2943 IN ULONG MessageId,
2944 OUT PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry
2945 );
2946
2947 NTSYSAPI
2948 ULONG
2949 NTAPI
2950 RtlGetNtGlobalFlags(VOID);
2951
2952 NTSYSAPI
2953 PVOID
2954 NTAPI
2955 RtlImageDirectoryEntryToData(
2956 PVOID BaseAddress,
2957 BOOLEAN MappedAsImage,
2958 USHORT Directory,
2959 PULONG Size
2960 );
2961
2962 NTSYSAPI
2963 PVOID
2964 NTAPI
2965 RtlImageRvaToVa(
2966 PIMAGE_NT_HEADERS NtHeader,
2967 PVOID BaseAddress,
2968 ULONG Rva,
2969 PIMAGE_SECTION_HEADER *SectionHeader
2970 );
2971
2972 NTSYSAPI
2973 PIMAGE_NT_HEADERS
2974 NTAPI
2975 RtlImageNtHeader(IN PVOID BaseAddress);
2976
2977 NTSYSAPI
2978 NTSTATUS
2979 NTAPI
2980 RtlImageNtHeaderEx(
2981 IN ULONG Flags,
2982 IN PVOID BaseAddress,
2983 IN ULONGLONG Size,
2984 IN PIMAGE_NT_HEADERS *NtHeader
2985 );
2986
2987 NTSYSAPI
2988 PIMAGE_SECTION_HEADER
2989 NTAPI
2990 RtlImageRvaToSection(
2991 PIMAGE_NT_HEADERS NtHeader,
2992 PVOID BaseAddress,
2993 ULONG Rva
2994 );
2995
2996 NTSYSAPI
2997 ULONG
2998 NTAPI
2999 LdrRelocateImageWithBias(
3000 IN PVOID NewAddress,
3001 IN LONGLONG AdditionalBias,
3002 IN PCCH LoaderName,
3003 IN ULONG Success,
3004 IN ULONG Conflict,
3005 IN ULONG Invalid
3006 );
3007
3008 //
3009 // Activation Context Functions
3010 //
3011 #ifdef NTOS_MODE_USER
3012
3013 NTSYSAPI
3014 NTSTATUS
3015 NTAPI
3016 RtlActivateActivationContext(
3017 IN ULONG Unknown,
3018 IN HANDLE Handle,
3019 OUT PULONG_PTR Cookie
3020 );
3021
3022 NTSYSAPI
3023 VOID
3024 NTAPI
3025 RtlAddRefActivationContext(
3026 PVOID Context
3027 );
3028
3029
3030 NTSYSAPI
3031 NTSTATUS
3032 NTAPI
3033 RtlActivateActivationContextUnsafeFast(
3034 IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame,
3035 IN PVOID Context
3036 );
3037
3038 NTSYSAPI
3039 NTSTATUS
3040 NTAPI
3041 RtlAllocateActivationContextStack(
3042 IN PVOID *Context
3043 );
3044
3045 NTSYSAPI
3046 NTSTATUS
3047 NTAPI
3048 RtlCreateActivationContext(
3049 OUT PHANDLE Handle,
3050 IN OUT PVOID ReturnedData
3051 );
3052
3053 NTSYSAPI
3054 NTSTATUS
3055 NTAPI
3056 RtlGetActiveActivationContext(
3057 IN PVOID *Context
3058 );
3059
3060 NTSYSAPI
3061 VOID
3062 NTAPI
3063 RtlReleaseActivationContext(
3064 IN HANDLE handle
3065 );
3066
3067 NTSYSAPI
3068 NTSTATUS
3069 NTAPI
3070 RtlDeactivateActivationContext(
3071 ULONG dwFlags,
3072 ULONG_PTR ulCookie
3073 );
3074
3075 NTSYSAPI
3076 VOID
3077 NTAPI
3078 RtlFreeThreadActivationContextStack(void);
3079
3080 NTSYSAPI
3081 NTSTATUS
3082 NTAPI
3083 RtlDeactivateActivationContextUnsafeFast(
3084 IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame
3085 );
3086
3087 NTSYSAPI
3088 NTSTATUS
3089 NTAPI
3090 RtlDosApplyFileIsolationRedirection_Ustr(
3091 IN BOOLEAN Unknown,
3092 IN PUNICODE_STRING OriginalName,
3093 IN PUNICODE_STRING Extension,
3094 IN OUT PUNICODE_STRING RedirectedName,
3095 IN OUT PUNICODE_STRING RedirectedName2,
3096 IN OUT PUNICODE_STRING *OriginalName2,
3097 IN PVOID Unknown1,
3098 IN PVOID Unknown2,
3099 IN PVOID Unknown3
3100 );
3101
3102 NTSYSAPI
3103 NTSTATUS
3104 NTAPI
3105 RtlFindActivationContextSectionString(
3106 IN ULONG dwFlags,
3107 IN const GUID *ExtensionGuid,
3108 IN ULONG SectionType,
3109 IN PUNICODE_STRING SectionName,
3110 IN OUT PVOID ReturnedData
3111 );
3112
3113 NTSYSAPI
3114 NTSTATUS
3115 NTAPI
3116 RtlQueryInformationActivationContext(
3117 DWORD dwFlags,
3118 PVOID Context,
3119 PVOID pvSubInstance,
3120 ULONG ulInfoClass,
3121 PVOID pvBuffer,
3122 SIZE_T cbBuffer OPTIONAL,
3123 SIZE_T *pcbWrittenOrRequired OPTIONAL
3124 );
3125
3126 NTSYSAPI
3127 NTSTATUS
3128 NTAPI
3129 RtlZombifyActivationContext(
3130 PVOID Context
3131 );
3132
3133
3134 #endif
3135
3136 //
3137 // Registry Functions
3138 //
3139 NTSYSAPI
3140 NTSTATUS
3141 NTAPI
3142 RtlCheckRegistryKey(
3143 ULONG RelativeTo,
3144 PWSTR Path
3145 );
3146
3147 NTSYSAPI
3148 NTSTATUS
3149 NTAPI
3150 RtlCreateRegistryKey(
3151 IN ULONG RelativeTo,
3152 IN PWSTR Path
3153 );
3154
3155 NTSYSAPI
3156 NTSTATUS
3157 NTAPI
3158 RtlFormatCurrentUserKeyPath(
3159 IN OUT PUNICODE_STRING KeyPath
3160 );
3161
3162 NTSYSAPI
3163 NTSTATUS
3164 NTAPI
3165 RtlpNtOpenKey(
3166 OUT HANDLE KeyHandle,
3167 IN ACCESS_MASK DesiredAccess,
3168 IN POBJECT_ATTRIBUTES ObjectAttributes,
3169 IN ULONG Unused
3170 );
3171
3172 NTSYSAPI
3173 NTSTATUS
3174 NTAPI
3175 RtlOpenCurrentUser(
3176 IN ACCESS_MASK DesiredAccess,
3177 OUT PHANDLE KeyHandle
3178 );
3179
3180 NTSYSAPI
3181 NTSTATUS
3182 NTAPI
3183 RtlQueryRegistryValues(
3184 IN ULONG RelativeTo,
3185 IN PCWSTR Path,
3186 IN PRTL_QUERY_REGISTRY_TABLE QueryTable,
3187 IN PVOID Context,
3188 IN PVOID Environment
3189 );
3190
3191 NTSYSAPI
3192 NTSTATUS
3193 NTAPI
3194 RtlWriteRegistryValue(
3195 ULONG RelativeTo,
3196 PCWSTR Path,
3197 PCWSTR ValueName,
3198 ULONG ValueType,
3199 PVOID ValueData,
3200 ULONG ValueLength
3201 );
3202
3203 //
3204 // NLS Functions
3205 //
3206 NTSYSAPI
3207 VOID
3208 NTAPI
3209 RtlGetDefaultCodePage(
3210 OUT PUSHORT AnsiCodePage,
3211 OUT PUSHORT OemCodePage
3212 );
3213
3214 NTSYSAPI
3215 VOID
3216 NTAPI
3217 RtlInitNlsTables(
3218 IN PUSHORT AnsiTableBase,
3219 IN PUSHORT OemTableBase,
3220 IN PUSHORT CaseTableBase,
3221 OUT PNLSTABLEINFO NlsTable
3222 );
3223
3224 NTSYSAPI
3225 VOID
3226 NTAPI
3227 RtlInitCodePageTable(
3228 IN PUSHORT TableBase,
3229 OUT PCPTABLEINFO CodePageTable
3230 );
3231
3232 NTSYSAPI
3233 VOID
3234 NTAPI
3235 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable);
3236
3237 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
3238
3239 //
3240 // Misc conversion functions
3241 //
3242 static __inline
3243 LARGE_INTEGER
3244 NTAPI_INLINE
3245 RtlConvertLongToLargeInteger(
3246 LONG SignedInteger
3247 )
3248 {
3249 LARGE_INTEGER Result;
3250
3251 Result.QuadPart = SignedInteger;
3252 return Result;
3253 }
3254
3255 static __inline
3256 LARGE_INTEGER
3257 NTAPI_INLINE
3258 RtlEnlargedIntegerMultiply(
3259 LONG Multiplicand,
3260 LONG Multiplier
3261 )
3262 {
3263 LARGE_INTEGER Product;
3264
3265 Product.QuadPart = (LONGLONG)Multiplicand * (ULONGLONG)Multiplier;
3266 return Product;
3267 }
3268
3269 static __inline
3270 ULONG
3271 NTAPI_INLINE
3272 RtlEnlargedUnsignedDivide(
3273 IN ULARGE_INTEGER Dividend,
3274 IN ULONG Divisor,
3275 IN PULONG Remainder OPTIONAL
3276 )
3277 {
3278 ULONG Quotient;
3279
3280 Quotient = (ULONG)(Dividend.QuadPart / Divisor);
3281 if (Remainder) {
3282 *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
3283 }
3284
3285 return Quotient;
3286 }
3287
3288 static __inline
3289 LARGE_INTEGER
3290 NTAPI_INLINE
3291 RtlEnlargedUnsignedMultiply(
3292 ULONG Multiplicand,
3293 ULONG Multiplier
3294 )
3295 {
3296 LARGE_INTEGER Product;
3297
3298 Product.QuadPart = (ULONGLONG)Multiplicand * (ULONGLONG)Multiplier;
3299 return Product;
3300 }
3301 #endif
3302
3303 NTSYSAPI
3304 ULONG
3305 NTAPI
3306 RtlUniform(
3307 IN PULONG Seed
3308 );
3309
3310 NTSYSAPI
3311 ULONG
3312 NTAPI
3313 RtlRandom(
3314 IN OUT PULONG Seed
3315 );
3316
3317 NTSYSAPI
3318 ULONG
3319 NTAPI
3320 RtlComputeCrc32(
3321 IN ULONG InitialCrc,
3322 IN PUCHAR Buffer,
3323 IN ULONG Length
3324 );
3325
3326 //
3327 // Network Functions
3328 //
3329 NTSYSAPI
3330 NTSTATUS
3331 NTAPI
3332 RtlIpv4StringToAddressW(
3333 IN PCWSTR String,
3334 IN BOOLEAN Strict,
3335 OUT LPWSTR *Terminator,
3336 OUT struct in_addr *Addr
3337 );
3338
3339 NTSYSAPI
3340 NTSTATUS
3341 NTAPI
3342 RtlIpv6StringToAddressA(
3343 IN PCHAR Name,
3344 OUT PCHAR *Terminator,
3345 OUT struct in6_addr *Addr
3346 );
3347
3348 NTSYSAPI
3349 NTSTATUS
3350 NTAPI
3351 RtlIpv6StringToAddressW(
3352 IN PWCHAR Name,
3353 OUT PCHAR *Terminator,
3354 OUT struct in6_addr *Addr
3355 );
3356
3357 NTSYSAPI
3358 NTSTATUS
3359 NTAPI
3360 RtlIpv6StringToAddressExA(
3361 IN PCHAR AddressString,
3362 IN struct in6_addr *Address,
3363 IN PULONG ScopeId,
3364 IN PUSHORT Port
3365 );
3366
3367 NTSYSAPI
3368 NTSTATUS
3369 NTAPI
3370 RtlIpv6StringToAddressExW(
3371 IN PWCHAR AddressName,
3372 IN struct in6_addr *Address,
3373 IN PULONG ScopeId,
3374 IN PUSHORT Port
3375 );
3376
3377
3378 //
3379 // Time Functions
3380 //
3381 NTSYSAPI
3382 NTSTATUS
3383 NTAPI
3384 RtlQueryTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
3385
3386 NTSYSAPI
3387 VOID
3388 NTAPI
3389 RtlSecondsSince1970ToTime(
3390 IN ULONG SecondsSince1970,
3391 OUT PLARGE_INTEGER Time
3392 );
3393
3394 NTSYSAPI
3395 NTSTATUS
3396 NTAPI
3397 RtlSetTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
3398
3399 NTSYSAPI
3400 BOOLEAN
3401 NTAPI
3402 RtlTimeFieldsToTime(
3403 PTIME_FIELDS TimeFields,
3404 PLARGE_INTEGER Time
3405 );
3406
3407 NTSYSAPI
3408 BOOLEAN
3409 NTAPI
3410 RtlTimeToSecondsSince1970(
3411 PLARGE_INTEGER Time,
3412 OUT PULONG SecondsSince1970
3413 );
3414
3415 NTSYSAPI
3416 VOID
3417 NTAPI
3418 RtlTimeToTimeFields(
3419 PLARGE_INTEGER Time,
3420 PTIME_FIELDS TimeFields
3421 );
3422
3423 NTSYSAPI
3424 NTSTATUS
3425 NTAPI
3426 RtlSystemTimeToLocalTime(
3427 IN PLARGE_INTEGER SystemTime,
3428 OUT PLARGE_INTEGER LocalTime
3429 );
3430
3431 //
3432 // Version Functions
3433 //
3434 NTSYSAPI
3435 NTSTATUS
3436 NTAPI
3437 RtlVerifyVersionInfo(
3438 IN PRTL_OSVERSIONINFOEXW VersionInfo,
3439 IN ULONG TypeMask,
3440 IN ULONGLONG ConditionMask
3441 );
3442
3443 NTSYSAPI
3444 NTSTATUS
3445 NTAPI
3446 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation);
3447
3448 NTSYSAPI
3449 BOOLEAN
3450 NTAPI
3451 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType);
3452
3453 //
3454 // Secure Memory Functions
3455 //
3456 #ifdef NTOS_MODE_USER
3457 NTSYSAPI
3458 NTSTATUS
3459 NTAPI
3460 RtlRegisterSecureMemoryCacheCallback(
3461 IN PRTL_SECURE_MEMORY_CACHE_CALLBACK Callback);
3462
3463 NTSYSAPI
3464 BOOLEAN
3465 NTAPI
3466 RtlFlushSecureMemoryCache(
3467 IN PVOID MemoryCache,
3468 IN OPTIONAL SIZE_T MemoryLength
3469 );
3470 #endif
3471
3472 //
3473 // Boot Status Data Functions
3474 //
3475 #ifdef NTOS_MODE_USER
3476 NTSYSAPI
3477 NTSTATUS
3478 NTAPI
3479 RtlCreateBootStatusDataFile(
3480 VOID
3481 );
3482
3483 NTSYSAPI
3484 NTSTATUS
3485 NTAPI
3486 RtlGetSetBootStatusData(
3487 HANDLE FileHandle,
3488 BOOLEAN WriteMode,
3489 DWORD DataClass,
3490 PVOID Buffer,
3491 ULONG BufferSize,
3492 DWORD DataClass2
3493 );
3494
3495 NTSYSAPI
3496 NTSTATUS
3497 NTAPI
3498 RtlLockBootStatusData(
3499 HANDLE FileHandle
3500 );
3501
3502 NTSYSAPI
3503 NTSTATUS
3504 NTAPI
3505 RtlUnlockBootStatusData(
3506 HANDLE FileHandle
3507 );
3508 #endif
3509
3510 #ifdef __cplusplus
3511 }
3512 #endif
3513
3514 #endif