3c6f75f8129d225423bf29d27ce6efc0ccd6436f
[reactos.git] / reactos / sdk / 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 _Out_ PLIST_ENTRY ListHead
46 )
47 {
48 ListHead->Flink = ListHead->Blink = ListHead;
49 }
50
51 FORCEINLINE
52 VOID
53 InsertHeadList(
54 _Inout_ PLIST_ENTRY ListHead,
55 _Inout_ 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 _Inout_ PLIST_ENTRY ListHead,
70 _Inout_ 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 _Must_inspect_result_
82 FORCEINLINE
83 BOOLEAN
84 IsListEmpty(
85 _In_ const LIST_ENTRY * ListHead
86 )
87 {
88 return (BOOLEAN)(ListHead->Flink == ListHead);
89 }
90
91 FORCEINLINE
92 PSINGLE_LIST_ENTRY
93 PopEntryList(
94 _Inout_ PSINGLE_LIST_ENTRY ListHead
95 )
96 {
97 PSINGLE_LIST_ENTRY FirstEntry;
98 FirstEntry = ListHead->Next;
99 if (FirstEntry != NULL) {
100 ListHead->Next = FirstEntry->Next;
101 }
102
103 return FirstEntry;
104 }
105
106 FORCEINLINE
107 VOID
108 PushEntryList(
109 _Inout_ PSINGLE_LIST_ENTRY ListHead,
110 _Inout_ PSINGLE_LIST_ENTRY Entry
111 )
112 {
113 Entry->Next = ListHead->Next;
114 ListHead->Next = Entry;
115 }
116
117 FORCEINLINE
118 BOOLEAN
119 RemoveEntryList(
120 _In_ PLIST_ENTRY Entry)
121 {
122 PLIST_ENTRY OldFlink;
123 PLIST_ENTRY OldBlink;
124
125 OldFlink = Entry->Flink;
126 OldBlink = Entry->Blink;
127 OldFlink->Blink = OldBlink;
128 OldBlink->Flink = OldFlink;
129 return (BOOLEAN)(OldFlink == OldBlink);
130 }
131
132 FORCEINLINE
133 PLIST_ENTRY
134 RemoveHeadList(
135 _Inout_ PLIST_ENTRY ListHead)
136 {
137 PLIST_ENTRY Flink;
138 PLIST_ENTRY Entry;
139
140 Entry = ListHead->Flink;
141 Flink = Entry->Flink;
142 ListHead->Flink = Flink;
143 Flink->Blink = ListHead;
144 return Entry;
145 }
146
147 FORCEINLINE
148 PLIST_ENTRY
149 RemoveTailList(
150 _Inout_ PLIST_ENTRY ListHead)
151 {
152 PLIST_ENTRY Blink;
153 PLIST_ENTRY Entry;
154
155 Entry = ListHead->Blink;
156 Blink = Entry->Blink;
157 ListHead->Blink = Blink;
158 Blink->Flink = ListHead;
159 return Entry;
160 }
161
162 //
163 // Unicode string macros
164 //
165 _At_(UnicodeString->Buffer, _Post_equal_to_(Buffer))
166 _At_(UnicodeString->Length, _Post_equal_to_(0))
167 _At_(UnicodeString->MaximumLength, _Post_equal_to_(BufferSize))
168 FORCEINLINE
169 VOID
170 RtlInitEmptyUnicodeString(
171 _Out_ PUNICODE_STRING UnicodeString,
172 _When_(BufferSize != 0, _Notnull_) _Writable_bytes_(BufferSize) __drv_aliasesMem PWCHAR Buffer,
173 _In_ USHORT BufferSize)
174 {
175 UnicodeString->Length = 0;
176 UnicodeString->MaximumLength = BufferSize;
177 UnicodeString->Buffer = Buffer;
178 }
179
180 _At_(AnsiString->Buffer, _Post_equal_to_(Buffer))
181 _At_(AnsiString->Length, _Post_equal_to_(0))
182 _At_(AnsiString->MaximumLength, _Post_equal_to_(BufferSize))
183 FORCEINLINE
184 VOID
185 RtlInitEmptyAnsiString(
186 _Out_ PANSI_STRING AnsiString,
187 _When_(BufferSize != 0, _Notnull_) _Writable_bytes_(BufferSize) __drv_aliasesMem PCHAR Buffer,
188 _In_ USHORT BufferSize)
189 {
190 AnsiString->Length = 0;
191 AnsiString->MaximumLength = BufferSize;
192 AnsiString->Buffer = Buffer;
193 }
194
195 //
196 // LUID Macros
197 //
198 #define RtlEqualLuid(L1, L2) (((L1)->HighPart == (L2)->HighPart) && \
199 ((L1)->LowPart == (L2)->LowPart))
200 FORCEINLINE
201 LUID
202 NTAPI_INLINE
203 RtlConvertUlongToLuid(
204 _In_ ULONG Ulong)
205 {
206 LUID TempLuid;
207
208 TempLuid.LowPart = Ulong;
209 TempLuid.HighPart = 0;
210 return TempLuid;
211 }
212
213 //
214 // ASSERT Macros
215 //
216 #ifndef ASSERT
217 #if DBG
218
219 #define ASSERT( exp ) \
220 ((void)((!(exp)) ? \
221 (RtlAssert( (PVOID)#exp, (PVOID)__FILE__, __LINE__, NULL ),FALSE) : \
222 TRUE))
223
224 #define ASSERTMSG( msg, exp ) \
225 ((void)((!(exp)) ? \
226 (RtlAssert( (PVOID)#exp, (PVOID)__FILE__, __LINE__, (PCHAR)msg ),FALSE) : \
227 TRUE))
228
229 #else
230
231 #define ASSERT( exp ) ((void) 0)
232 #define ASSERTMSG( msg, exp ) ((void) 0)
233
234 #endif
235 #endif
236
237 #ifdef NTOS_KERNEL_RUNTIME
238
239 //
240 // Executing RTL functions at DISPATCH_LEVEL or higher will result in a
241 // bugcheck.
242 //
243 #define RTL_PAGED_CODE PAGED_CODE
244
245 #else
246
247 //
248 // This macro does nothing in user mode
249 //
250 #define RTL_PAGED_CODE NOP_FUNCTION
251
252 #endif
253
254 //
255 // RTL Splay Tree Functions
256 //
257 #ifndef RTL_USE_AVL_TABLES
258
259 NTSYSAPI
260 VOID
261 NTAPI
262 RtlInitializeGenericTable(
263 _Out_ PRTL_GENERIC_TABLE Table,
264 _In_ PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine,
265 _In_opt_ PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine,
266 _In_opt_ PRTL_GENERIC_FREE_ROUTINE FreeRoutine,
267 _In_opt_ PVOID TableContext
268 );
269
270 NTSYSAPI
271 PVOID
272 NTAPI
273 RtlInsertElementGenericTable(
274 _In_ PRTL_GENERIC_TABLE Table,
275 _In_reads_bytes_(BufferSize) PVOID Buffer,
276 _In_ CLONG BufferSize,
277 _Out_opt_ PBOOLEAN NewElement
278 );
279
280 NTSYSAPI
281 PVOID
282 NTAPI
283 RtlInsertElementGenericTableFull(
284 _In_ PRTL_GENERIC_TABLE Table,
285 _In_reads_bytes_(BufferSize) PVOID Buffer,
286 _In_ CLONG BufferSize,
287 _Out_opt_ PBOOLEAN NewElement,
288 _In_ PVOID NodeOrParent,
289 _In_ TABLE_SEARCH_RESULT SearchResult
290 );
291
292 NTSYSAPI
293 BOOLEAN
294 NTAPI
295 RtlDeleteElementGenericTable(
296 _In_ PRTL_GENERIC_TABLE Table,
297 _In_ PVOID Buffer
298 );
299
300 _Must_inspect_result_
301 NTSYSAPI
302 PVOID
303 NTAPI
304 RtlLookupElementGenericTable(
305 _In_ PRTL_GENERIC_TABLE Table,
306 _In_ PVOID Buffer
307 );
308
309 NTSYSAPI
310 PVOID
311 NTAPI
312 RtlLookupElementGenericTableFull(
313 _In_ PRTL_GENERIC_TABLE Table,
314 _In_ PVOID Buffer,
315 _Out_ PVOID *NodeOrParent,
316 _Out_ TABLE_SEARCH_RESULT *SearchResult
317 );
318
319 _Must_inspect_result_
320 NTSYSAPI
321 PVOID
322 NTAPI
323 RtlEnumerateGenericTable(
324 _In_ PRTL_GENERIC_TABLE Table,
325 _In_ BOOLEAN Restart
326 );
327
328 _Must_inspect_result_
329 NTSYSAPI
330 PVOID
331 NTAPI
332 RtlEnumerateGenericTableWithoutSplaying(
333 _In_ PRTL_GENERIC_TABLE Table,
334 _Inout_ PVOID *RestartKey
335 );
336
337 _Must_inspect_result_
338 NTSYSAPI
339 PVOID
340 NTAPI
341 RtlGetElementGenericTable(
342 _In_ PRTL_GENERIC_TABLE Table,
343 _In_ ULONG I
344 );
345
346 NTSYSAPI
347 ULONG
348 NTAPI
349 RtlNumberGenericTableElements(
350 _In_ PRTL_GENERIC_TABLE Table
351 );
352
353 _Must_inspect_result_
354 NTSYSAPI
355 BOOLEAN
356 NTAPI
357 RtlIsGenericTableEmpty(
358 _In_ PRTL_GENERIC_TABLE Table
359 );
360
361 #endif /* !RTL_USE_AVL_TABLES */
362
363 NTSYSAPI
364 PRTL_SPLAY_LINKS
365 NTAPI
366 RtlSplay(
367 _Inout_ PRTL_SPLAY_LINKS Links
368 );
369
370 NTSYSAPI
371 PRTL_SPLAY_LINKS
372 NTAPI
373 RtlDelete(
374 _In_ PRTL_SPLAY_LINKS Links
375 );
376
377 NTSYSAPI
378 VOID
379 NTAPI
380 RtlDeleteNoSplay(
381 _In_ PRTL_SPLAY_LINKS Links,
382 _Inout_ PRTL_SPLAY_LINKS *Root
383 );
384
385 _Must_inspect_result_
386 NTSYSAPI
387 PRTL_SPLAY_LINKS
388 NTAPI
389 RtlSubtreeSuccessor(
390 _In_ PRTL_SPLAY_LINKS Links
391 );
392
393 _Must_inspect_result_
394 NTSYSAPI
395 PRTL_SPLAY_LINKS
396 NTAPI
397 RtlSubtreePredecessor(
398 _In_ PRTL_SPLAY_LINKS Links
399 );
400
401 _Must_inspect_result_
402 NTSYSAPI
403 PRTL_SPLAY_LINKS
404 NTAPI
405 RtlRealSuccessor(
406 _In_ PRTL_SPLAY_LINKS Links
407 );
408
409 _Must_inspect_result_
410 NTSYSAPI
411 PRTL_SPLAY_LINKS
412 NTAPI
413 RtlRealPredecessor(
414 _In_ PRTL_SPLAY_LINKS Links
415 );
416
417 #define RtlIsLeftChild(Links) \
418 (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
419
420 #define RtlIsRightChild(Links) \
421 (RtlRightChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
422
423 #define RtlRightChild(Links) \
424 ((PRTL_SPLAY_LINKS)(Links))->RightChild
425
426 #define RtlIsRoot(Links) \
427 (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
428
429 #define RtlLeftChild(Links) \
430 ((PRTL_SPLAY_LINKS)(Links))->LeftChild
431
432 #define RtlParent(Links) \
433 ((PRTL_SPLAY_LINKS)(Links))->Parent
434
435 // FIXME: use inline function
436
437 #define RtlInitializeSplayLinks(Links) \
438 { \
439 PRTL_SPLAY_LINKS _SplayLinks; \
440 _SplayLinks = (PRTL_SPLAY_LINKS)(Links); \
441 _SplayLinks->Parent = _SplayLinks; \
442 _SplayLinks->LeftChild = NULL; \
443 _SplayLinks->RightChild = NULL; \
444 }
445
446 #define RtlInsertAsLeftChild(ParentLinks,ChildLinks) \
447 { \
448 PRTL_SPLAY_LINKS _SplayParent; \
449 PRTL_SPLAY_LINKS _SplayChild; \
450 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
451 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
452 _SplayParent->LeftChild = _SplayChild; \
453 _SplayChild->Parent = _SplayParent; \
454 }
455
456 #define RtlInsertAsRightChild(ParentLinks,ChildLinks) \
457 { \
458 PRTL_SPLAY_LINKS _SplayParent; \
459 PRTL_SPLAY_LINKS _SplayChild; \
460 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
461 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
462 _SplayParent->RightChild = _SplayChild; \
463 _SplayChild->Parent = _SplayParent; \
464 }
465
466 //
467 // RTL AVL Tree Functions
468 //
469 NTSYSAPI
470 VOID
471 NTAPI
472 RtlInitializeGenericTableAvl(
473 _Out_ PRTL_AVL_TABLE Table,
474 _In_ PRTL_AVL_COMPARE_ROUTINE CompareRoutine,
475 _In_opt_ PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine,
476 _In_opt_ PRTL_AVL_FREE_ROUTINE FreeRoutine,
477 _In_opt_ PVOID TableContext
478 );
479
480 NTSYSAPI
481 PVOID
482 NTAPI
483 RtlInsertElementGenericTableAvl(
484 _In_ PRTL_AVL_TABLE Table,
485 _In_reads_bytes_(BufferSize) PVOID Buffer,
486 _In_ CLONG BufferSize,
487 _Out_opt_ PBOOLEAN NewElement
488 );
489
490 NTSYSAPI
491 PVOID
492 NTAPI
493 RtlInsertElementGenericTableFullAvl(
494 _In_ PRTL_AVL_TABLE Table,
495 _In_reads_bytes_(BufferSize) PVOID Buffer,
496 _In_ CLONG BufferSize,
497 _Out_opt_ PBOOLEAN NewElement,
498 _In_ PVOID NodeOrParent,
499 _In_ TABLE_SEARCH_RESULT SearchResult
500 );
501
502 NTSYSAPI
503 BOOLEAN
504 NTAPI
505 RtlDeleteElementGenericTableAvl(
506 _In_ PRTL_AVL_TABLE Table,
507 _In_ PVOID Buffer
508 );
509
510 _Must_inspect_result_
511 NTSYSAPI
512 PVOID
513 NTAPI
514 RtlLookupElementGenericTableAvl(
515 _In_ PRTL_AVL_TABLE Table,
516 _In_ PVOID Buffer
517 );
518
519 NTSYSAPI
520 PVOID
521 NTAPI
522 RtlLookupElementGenericTableFullAvl(
523 _In_ PRTL_AVL_TABLE Table,
524 _In_ PVOID Buffer,
525 _Out_ PVOID *NodeOrParent,
526 _Out_ TABLE_SEARCH_RESULT *SearchResult
527 );
528
529 _Must_inspect_result_
530 NTSYSAPI
531 PVOID
532 NTAPI
533 RtlEnumerateGenericTableAvl(
534 _In_ PRTL_AVL_TABLE Table,
535 _In_ BOOLEAN Restart
536 );
537
538 _Must_inspect_result_
539 NTSYSAPI
540 PVOID
541 NTAPI
542 RtlEnumerateGenericTableWithoutSplayingAvl(
543 _In_ PRTL_AVL_TABLE Table,
544 _Inout_ PVOID *RestartKey
545 );
546
547 _Must_inspect_result_
548 NTSYSAPI
549 PVOID
550 NTAPI
551 RtlLookupFirstMatchingElementGenericTableAvl(
552 _In_ PRTL_AVL_TABLE Table,
553 _In_ PVOID Buffer,
554 _Out_ PVOID *RestartKey
555 );
556
557 _Must_inspect_result_
558 NTSYSAPI
559 PVOID
560 NTAPI
561 RtlEnumerateGenericTableLikeADirectory(
562 _In_ PRTL_AVL_TABLE Table,
563 _In_opt_ PRTL_AVL_MATCH_FUNCTION MatchFunction,
564 _In_opt_ PVOID MatchData,
565 _In_ ULONG NextFlag,
566 _Inout_ PVOID *RestartKey,
567 _Inout_ PULONG DeleteCount,
568 _In_ PVOID Buffer
569 );
570
571 _Must_inspect_result_
572 NTSYSAPI
573 PVOID
574 NTAPI
575 RtlGetElementGenericTableAvl(
576 _In_ PRTL_AVL_TABLE Table,
577 _In_ ULONG I
578 );
579
580 NTSYSAPI
581 ULONG
582 NTAPI
583 RtlNumberGenericTableElementsAvl(
584 _In_ PRTL_AVL_TABLE Table
585 );
586
587 _Must_inspect_result_
588 NTSYSAPI
589 BOOLEAN
590 NTAPI
591 RtlIsGenericTableEmptyAvl(
592 _In_ PRTL_AVL_TABLE Table
593 );
594
595 #ifdef RTL_USE_AVL_TABLES
596
597 #define RtlInitializeGenericTable RtlInitializeGenericTableAvl
598 #define RtlInsertElementGenericTable RtlInsertElementGenericTableAvl
599 #define RtlInsertElementGenericTableFull RtlInsertElementGenericTableFullAvl
600 #define RtlDeleteElementGenericTable RtlDeleteElementGenericTableAvl
601 #define RtlLookupElementGenericTable RtlLookupElementGenericTableAvl
602 #define RtlLookupElementGenericTableFull RtlLookupElementGenericTableFullAvl
603 #define RtlEnumerateGenericTable RtlEnumerateGenericTableAvl
604 #define RtlEnumerateGenericTableWithoutSplaying RtlEnumerateGenericTableWithoutSplayingAvl
605 #define RtlGetElementGenericTable RtlGetElementGenericTableAvl
606 #define RtlNumberGenericTableElements RtlNumberGenericTableElementsAvl
607 #define RtlIsGenericTableEmpty RtlIsGenericTableEmptyAvl
608
609 #endif /* RTL_USE_AVL_TABLES */
610
611 //
612 // Error and Exception Functions
613 //
614 NTSYSAPI
615 PVOID
616 NTAPI
617 RtlAddVectoredExceptionHandler(
618 _In_ ULONG FirstHandler,
619 _In_ PVECTORED_EXCEPTION_HANDLER VectoredHandler
620 );
621
622 __analysis_noreturn
623 NTSYSAPI
624 VOID
625 NTAPI
626 RtlAssert(
627 _In_ PVOID FailedAssertion,
628 _In_ PVOID FileName,
629 _In_ ULONG LineNumber,
630 _In_opt_z_ PCHAR Message
631 );
632
633 NTSYSAPI
634 VOID
635 NTAPI
636 RtlSetUnhandledExceptionFilter(
637 _In_ PRTLP_UNHANDLED_EXCEPTION_FILTER TopLevelExceptionFilter
638 );
639
640 #endif /* NTOS_MODE_USER */
641
642 NTSYSAPI
643 VOID
644 NTAPI
645 RtlCaptureContext(
646 _Out_ PCONTEXT ContextRecord
647 );
648
649 NTSYSAPI
650 PVOID
651 NTAPI
652 RtlEncodePointer(
653 _In_ PVOID Pointer
654 );
655
656 NTSYSAPI
657 PVOID
658 NTAPI
659 RtlDecodePointer(
660 _In_ PVOID Pointer
661 );
662
663 NTSYSAPI
664 PVOID
665 NTAPI
666 RtlEncodeSystemPointer(
667 _In_ PVOID Pointer
668 );
669
670 NTSYSAPI
671 PVOID
672 NTAPI
673 RtlDecodeSystemPointer(
674 _In_ PVOID Pointer
675 );
676
677 NTSYSAPI
678 BOOLEAN
679 NTAPI
680 RtlDispatchException(
681 _In_ PEXCEPTION_RECORD ExceptionRecord,
682 _In_ PCONTEXT Context
683 );
684
685 _IRQL_requires_max_(APC_LEVEL)
686 _When_(Status < 0, _Out_range_(>, 0))
687 _When_(Status >= 0, _Out_range_(==, 0))
688 NTSYSAPI
689 ULONG
690 NTAPI
691 RtlNtStatusToDosError(
692 _In_ NTSTATUS Status
693 );
694
695 _When_(Status < 0, _Out_range_(>, 0))
696 _When_(Status >= 0, _Out_range_(==, 0))
697 NTSYSAPI
698 ULONG
699 NTAPI
700 RtlNtStatusToDosErrorNoTeb(
701 _In_ NTSTATUS Status
702 );
703
704 NTSYSAPI
705 VOID
706 NTAPI
707 RtlSetLastWin32ErrorAndNtStatusFromNtStatus(
708 _In_ NTSTATUS Status
709 );
710
711 NTSYSAPI
712 VOID
713 NTAPI
714 RtlRaiseException(
715 _In_ PEXCEPTION_RECORD ExceptionRecord
716 );
717
718 DECLSPEC_NORETURN
719 NTSYSAPI
720 VOID
721 NTAPI
722 RtlRaiseStatus(
723 _In_ NTSTATUS Status
724 );
725
726 NTSYSAPI
727 LONG
728 NTAPI
729 RtlUnhandledExceptionFilter(
730 _In_ struct _EXCEPTION_POINTERS* ExceptionInfo
731 );
732
733 NTSYSAPI
734 VOID
735 NTAPI
736 RtlUnwind(
737 _In_opt_ PVOID TargetFrame,
738 _In_opt_ PVOID TargetIp,
739 _In_opt_ PEXCEPTION_RECORD ExceptionRecord,
740 _In_ PVOID ReturnValue
741 );
742
743 #define RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT 8
744
745 //
746 // Tracing Functions
747 //
748 NTSYSAPI
749 ULONG
750 NTAPI
751 RtlWalkFrameChain(
752 _Out_writes_(Count - (Flags >> RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT)) PVOID *Callers,
753 _In_ ULONG Count,
754 _In_ ULONG Flags
755 );
756
757 NTSYSAPI
758 USHORT
759 NTAPI
760 RtlLogStackBackTrace(
761 VOID
762 );
763
764 #ifdef NTOS_MODE_USER
765 //
766 // Heap Functions
767 //
768 _Must_inspect_result_
769 _Ret_maybenull_
770 _Post_writable_byte_size_(Size)
771 NTSYSAPI
772 PVOID
773 NTAPI
774 RtlAllocateHeap(
775 _In_ PVOID HeapHandle,
776 _In_opt_ ULONG Flags,
777 _In_ SIZE_T Size
778 );
779
780 _Must_inspect_result_
781 NTSYSAPI
782 PVOID
783 NTAPI
784 RtlCreateHeap(
785 _In_ ULONG Flags,
786 _In_opt_ PVOID BaseAddress,
787 _In_opt_ SIZE_T SizeToReserve,
788 _In_opt_ SIZE_T SizeToCommit,
789 _In_opt_ PVOID Lock,
790 _In_opt_ PRTL_HEAP_PARAMETERS Parameters
791 );
792
793 NTSYSAPI
794 ULONG
795 NTAPI
796 RtlCreateTagHeap(
797 _In_ HANDLE HeapHandle,
798 _In_ ULONG Flags,
799 _In_ PWSTR TagName,
800 _In_ PWSTR TagSubName
801 );
802
803 ULONG
804 NTAPI
805 RtlCompactHeap(
806 _In_ HANDLE Heap,
807 _In_ ULONG Flags
808 );
809
810 _Must_inspect_result_
811 NTSYSAPI
812 PVOID
813 NTAPI
814 RtlDebugCreateHeap(
815 _In_ ULONG Flags,
816 _In_opt_ PVOID BaseAddress,
817 _In_opt_ SIZE_T SizeToReserve,
818 _In_opt_ SIZE_T SizeToCommit,
819 _In_opt_ PVOID Lock,
820 _In_opt_ PRTL_HEAP_PARAMETERS Parameters
821 );
822
823 NTSYSAPI
824 HANDLE
825 NTAPI
826 RtlDestroyHeap(
827 _In_ _Post_invalid_ HANDLE Heap
828 );
829
830 NTSYSAPI
831 ULONG
832 NTAPI
833 RtlExtendHeap(
834 _In_ HANDLE Heap,
835 _In_ ULONG Flags,
836 _In_ PVOID P,
837 _In_ SIZE_T Size
838 );
839
840 _Success_(return != 0)
841 NTSYSAPI
842 BOOLEAN
843 NTAPI
844 RtlFreeHeap(
845 _In_ HANDLE HeapHandle,
846 _In_opt_ ULONG Flags,
847 _In_ _Post_invalid_ PVOID P
848 );
849
850 ULONG
851 NTAPI
852 RtlGetProcessHeaps(
853 _In_ ULONG HeapCount,
854 _Out_cap_(HeapCount) HANDLE *HeapArray
855 );
856
857 _Success_(return != 0)
858 BOOLEAN
859 NTAPI
860 RtlGetUserInfoHeap(
861 _In_ PVOID HeapHandle,
862 _In_ ULONG Flags,
863 _In_ PVOID BaseAddress,
864 _Inout_opt_ PVOID *UserValue,
865 _Out_opt_ PULONG UserFlags
866 );
867
868 NTSYSAPI
869 PVOID
870 NTAPI
871 RtlProtectHeap(
872 _In_ PVOID HeapHandle,
873 _In_ BOOLEAN Protect
874 );
875
876 NTSYSAPI
877 NTSTATUS
878 NTAPI
879 RtlQueryHeapInformation(
880 _In_ PVOID HeapHandle,
881 _In_ HEAP_INFORMATION_CLASS HeapInformationClass,
882 _Out_ PVOID HeapInformation,
883 _In_ SIZE_T HeapInformationLength,
884 _When_(HeapInformationClass==HeapCompatibilityInformation, _On_failure_(_Out_opt_))
885 _Out_opt_ PSIZE_T ReturnLength
886 );
887
888 _Ret_opt_z_
889 NTSYSAPI
890 PWSTR
891 NTAPI
892 RtlQueryTagHeap(
893 _In_ PVOID HeapHandle,
894 _In_ ULONG Flags,
895 _In_ USHORT TagIndex,
896 _In_ BOOLEAN ResetCounters,
897 _Out_ PRTL_HEAP_TAG_INFO HeapTagInfo
898 );
899
900 _Must_inspect_result_
901 _Ret_maybenull_
902 _Post_writable_byte_size_(Size)
903 NTSYSAPI
904 PVOID
905 NTAPI
906 RtlReAllocateHeap(
907 _In_ HANDLE Heap,
908 _In_opt_ ULONG Flags,
909 _In_ _Post_invalid_ PVOID Ptr,
910 _In_ SIZE_T Size
911 );
912
913 NTSYSAPI
914 NTSTATUS
915 NTAPI
916 RtlSetHeapInformation(
917 _In_ PVOID HeapHandle,
918 _In_ HEAP_INFORMATION_CLASS HeapInformationClass,
919 _When_(HeapInformationClass==HeapCompatibilityInformation,_In_) PVOID HeapInformation,
920 _In_ SIZE_T HeapInformationLength
921 );
922
923 NTSYSAPI
924 BOOLEAN
925 NTAPI
926 RtlLockHeap(
927 _In_ HANDLE Heap
928 );
929
930 _Must_inspect_result_
931 NTSYSAPI
932 NTSTATUS
933 NTAPI
934 RtlMultipleAllocateHeap (
935 _In_ HANDLE HeapHandle,
936 _In_ ULONG Flags,
937 _In_ SIZE_T Size,
938 _In_ ULONG Count,
939 _Out_cap_(Count) _Deref_post_bytecap_(Size) PVOID * Array
940 );
941
942 NTSYSAPI
943 NTSTATUS
944 NTAPI
945 RtlMultipleFreeHeap (
946 _In_ HANDLE HeapHandle,
947 _In_ ULONG Flags,
948 _In_ ULONG Count,
949 _In_count_(Count) /* _Deref_ _Post_invalid_ */ PVOID * Array
950 );
951
952 NTSYSAPI
953 NTSTATUS
954 NTAPI
955 RtlUsageHeap(
956 _In_ HANDLE Heap,
957 _In_ ULONG Flags,
958 _Out_ PRTL_HEAP_USAGE Usage
959 );
960
961 NTSYSAPI
962 BOOLEAN
963 NTAPI
964 RtlUnlockHeap(
965 _In_ HANDLE Heap
966 );
967
968 BOOLEAN
969 NTAPI
970 RtlSetUserValueHeap(
971 _In_ PVOID HeapHandle,
972 _In_ ULONG Flags,
973 _In_ PVOID BaseAddress,
974 _In_ PVOID UserValue
975 );
976
977 BOOLEAN
978 NTAPI
979 RtlSetUserFlagsHeap(
980 _In_ PVOID HeapHandle,
981 _In_ ULONG Flags,
982 _In_ PVOID BaseAddress,
983 _In_ ULONG UserFlagsReset,
984 _In_ ULONG UserFlagsSet
985 );
986
987 NTSYSAPI
988 BOOLEAN
989 NTAPI
990 RtlValidateHeap(
991 _In_ HANDLE Heap,
992 _In_ ULONG Flags,
993 _In_opt_ PVOID P
994 );
995
996 NTSYSAPI
997 NTSTATUS
998 NTAPI
999 RtlWalkHeap(
1000 _In_ HANDLE HeapHandle,
1001 _In_ PVOID HeapEntry
1002 );
1003
1004 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
1005
1006 #endif // NTOS_MODE_USER
1007
1008 NTSYSAPI
1009 SIZE_T
1010 NTAPI
1011 RtlSizeHeap(
1012 _In_ PVOID HeapHandle,
1013 _In_ ULONG Flags,
1014 _In_ PVOID MemoryPointer
1015 );
1016
1017
1018 //
1019 // Security Functions
1020 //
1021 _IRQL_requires_max_(APC_LEVEL)
1022 NTSYSAPI
1023 NTSTATUS
1024 NTAPI
1025 RtlAbsoluteToSelfRelativeSD(
1026 _In_ PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
1027 _Out_writes_bytes_to_opt_(*BufferLength, *BufferLength) PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor,
1028 _Inout_ PULONG BufferLength
1029 );
1030
1031 _IRQL_requires_max_(APC_LEVEL)
1032 NTSYSAPI
1033 NTSTATUS
1034 NTAPI
1035 RtlAddAccessAllowedAce(
1036 _Inout_ PACL Acl,
1037 _In_ ULONG Revision,
1038 _In_ ACCESS_MASK AccessMask,
1039 _In_ PSID Sid
1040 );
1041
1042 _IRQL_requires_max_(APC_LEVEL)
1043 NTSYSAPI
1044 NTSTATUS
1045 NTAPI
1046 RtlAddAccessAllowedAceEx(
1047 _Inout_ PACL pAcl,
1048 _In_ ULONG dwAceRevision,
1049 _In_ ULONG AceFlags,
1050 _In_ ACCESS_MASK AccessMask,
1051 _In_ PSID pSid
1052 );
1053
1054 NTSYSAPI
1055 NTSTATUS
1056 NTAPI
1057 RtlAddAccessAllowedObjectAce(
1058 _Inout_ PACL pAcl,
1059 _In_ ULONG dwAceRevision,
1060 _In_ ULONG AceFlags,
1061 _In_ ACCESS_MASK AccessMask,
1062 _In_opt_ GUID *ObjectTypeGuid,
1063 _In_opt_ GUID *InheritedObjectTypeGuid,
1064 _In_ PSID pSid
1065 );
1066
1067 NTSYSAPI
1068 NTSTATUS
1069 NTAPI
1070 RtlAddAccessDeniedAce(
1071 _Inout_ PACL Acl,
1072 _In_ ULONG Revision,
1073 _In_ ACCESS_MASK AccessMask,
1074 _In_ PSID Sid
1075 );
1076
1077 NTSYSAPI
1078 NTSTATUS
1079 NTAPI
1080 RtlAddAccessDeniedAceEx(
1081 _Inout_ PACL Acl,
1082 _In_ ULONG Revision,
1083 _In_ ULONG Flags,
1084 _In_ ACCESS_MASK AccessMask,
1085 _In_ PSID Sid
1086 );
1087
1088 NTSYSAPI
1089 NTSTATUS
1090 NTAPI
1091 RtlAddAccessDeniedObjectAce(
1092 _Inout_ PACL pAcl,
1093 _In_ ULONG dwAceRevision,
1094 _In_ ULONG AceFlags,
1095 _In_ ACCESS_MASK AccessMask,
1096 _In_opt_ GUID *ObjectTypeGuid,
1097 _In_opt_ GUID *InheritedObjectTypeGuid,
1098 _In_ PSID pSid
1099 );
1100
1101 NTSYSAPI
1102 NTSTATUS
1103 NTAPI
1104 RtlAddAce(
1105 _Inout_ PACL Acl,
1106 _In_ ULONG AceRevision,
1107 _In_ ULONG StartingAceIndex,
1108 _In_reads_bytes_(AceListLength) PVOID AceList,
1109 _In_ ULONG AceListLength
1110 );
1111
1112 NTSYSAPI
1113 NTSTATUS
1114 NTAPI
1115 RtlAddAuditAccessAce(
1116 _Inout_ PACL Acl,
1117 _In_ ULONG Revision,
1118 _In_ ACCESS_MASK AccessMask,
1119 _In_ PSID Sid,
1120 _In_ BOOLEAN Success,
1121 _In_ BOOLEAN Failure
1122 );
1123
1124 NTSYSAPI
1125 NTSTATUS
1126 NTAPI
1127 RtlAcquirePrivilege(
1128 _In_ PULONG Privilege,
1129 _In_ ULONG NumPriv,
1130 _In_ ULONG Flags,
1131 _Out_ PVOID *ReturnedState
1132 );
1133
1134 NTSYSAPI
1135 NTSTATUS
1136 NTAPI
1137 RtlAddAuditAccessAceEx(
1138 _Inout_ PACL Acl,
1139 _In_ ULONG Revision,
1140 _In_ ULONG Flags,
1141 _In_ ACCESS_MASK AccessMask,
1142 _In_ PSID Sid,
1143 _In_ BOOLEAN Success,
1144 _In_ BOOLEAN Failure
1145 );
1146
1147 NTSYSAPI
1148 NTSTATUS
1149 NTAPI
1150 RtlAddAuditAccessObjectAce(
1151 _Inout_ PACL Acl,
1152 _In_ ULONG Revision,
1153 _In_ ULONG Flags,
1154 _In_ ACCESS_MASK AccessMask,
1155 _In_opt_ GUID *ObjectTypeGuid,
1156 _In_opt_ GUID *InheritedObjectTypeGuid,
1157 _In_ PSID Sid,
1158 _In_ BOOLEAN Success,
1159 _In_ BOOLEAN Failure
1160 );
1161
1162 NTSYSAPI
1163 NTSTATUS
1164 NTAPI
1165 RtlAddMandatoryAce(
1166 _Inout_ PACL Acl,
1167 _In_ ULONG Revision,
1168 _In_ ULONG Flags,
1169 _In_ ULONG MandatoryFlags,
1170 _In_ UCHAR AceType,
1171 _In_ PSID LabelSid);
1172
1173 NTSYSAPI
1174 NTSTATUS
1175 NTAPI
1176 RtlAdjustPrivilege(
1177 _In_ ULONG Privilege,
1178 _In_ BOOLEAN NewValue,
1179 _In_ BOOLEAN ForThread,
1180 _Out_ PBOOLEAN OldValue
1181 );
1182
1183 _Must_inspect_result_
1184 NTSYSAPI
1185 NTSTATUS
1186 NTAPI
1187 RtlAllocateAndInitializeSid(
1188 _In_ PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
1189 _In_ UCHAR SubAuthorityCount,
1190 _In_ ULONG SubAuthority0,
1191 _In_ ULONG SubAuthority1,
1192 _In_ ULONG SubAuthority2,
1193 _In_ ULONG SubAuthority3,
1194 _In_ ULONG SubAuthority4,
1195 _In_ ULONG SubAuthority5,
1196 _In_ ULONG SubAuthority6,
1197 _In_ ULONG SubAuthority7,
1198 _Outptr_ PSID *Sid
1199 );
1200
1201 NTSYSAPI
1202 BOOLEAN
1203 NTAPI
1204 RtlAreAllAccessesGranted(
1205 ACCESS_MASK GrantedAccess,
1206 ACCESS_MASK DesiredAccess
1207 );
1208
1209 NTSYSAPI
1210 BOOLEAN
1211 NTAPI
1212 RtlAreAnyAccessesGranted(
1213 ACCESS_MASK GrantedAccess,
1214 ACCESS_MASK DesiredAccess
1215 );
1216
1217 _IRQL_requires_max_(APC_LEVEL)
1218 NTSYSAPI
1219 VOID
1220 NTAPI
1221 RtlCopyLuid (
1222 _Out_ PLUID DestinationLuid,
1223 _In_ PLUID SourceLuid
1224 );
1225
1226 NTSYSAPI
1227 VOID
1228 NTAPI
1229 RtlCopyLuidAndAttributesArray(
1230 ULONG Count,
1231 PLUID_AND_ATTRIBUTES Src,
1232 PLUID_AND_ATTRIBUTES Dest
1233 );
1234
1235 NTSYSAPI
1236 NTSTATUS
1237 NTAPI
1238 RtlCopySidAndAttributesArray(
1239 ULONG Count,
1240 PSID_AND_ATTRIBUTES Src,
1241 ULONG SidAreaSize,
1242 PSID_AND_ATTRIBUTES Dest,
1243 PVOID SidArea,
1244 PVOID* RemainingSidArea,
1245 PULONG RemainingSidAreaSize
1246 );
1247
1248 _IRQL_requires_max_(APC_LEVEL)
1249 NTSYSAPI
1250 NTSTATUS
1251 NTAPI
1252 RtlConvertSidToUnicodeString(
1253 _Inout_ PUNICODE_STRING UnicodeString,
1254 _In_ PSID Sid,
1255 _In_ BOOLEAN AllocateDestinationString
1256 );
1257
1258 _IRQL_requires_max_(APC_LEVEL)
1259 NTSYSAPI
1260 NTSTATUS
1261 NTAPI
1262 RtlCopySid(
1263 _In_ ULONG DestinationSidLength,
1264 _Out_writes_bytes_(DestinationSidLength) PSID DestinationSid,
1265 _In_ PSID SourceSid
1266 );
1267
1268 NTSYSAPI
1269 NTSTATUS
1270 NTAPI
1271 RtlCreateAcl(
1272 PACL Acl,
1273 ULONG AclSize,
1274 ULONG AclRevision
1275 );
1276
1277 NTSYSAPI
1278 NTSTATUS
1279 NTAPI
1280 RtlCreateSecurityDescriptor(
1281 _Out_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1282 _In_ ULONG Revision
1283 );
1284
1285 NTSYSAPI
1286 NTSTATUS
1287 NTAPI
1288 RtlCreateSecurityDescriptorRelative(
1289 _Out_ PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
1290 _In_ ULONG Revision
1291 );
1292
1293 NTSYSAPI
1294 NTSTATUS
1295 NTAPI
1296 RtlCopySecurityDescriptor(
1297 _In_ PSECURITY_DESCRIPTOR pSourceSecurityDescriptor,
1298 _Out_ PSECURITY_DESCRIPTOR *pDestinationSecurityDescriptor
1299 );
1300
1301 NTSYSAPI
1302 NTSTATUS
1303 NTAPI
1304 RtlDeleteAce(
1305 PACL Acl,
1306 ULONG AceIndex
1307 );
1308
1309 NTSYSAPI
1310 BOOLEAN
1311 NTAPI
1312 RtlEqualPrefixSid(
1313 PSID Sid1,
1314 PSID Sid2
1315 );
1316
1317 NTSYSAPI
1318 BOOLEAN
1319 NTAPI
1320 RtlEqualSid (
1321 _In_ PSID Sid1,
1322 _In_ PSID Sid2
1323 );
1324
1325 NTSYSAPI
1326 BOOLEAN
1327 NTAPI
1328 RtlFirstFreeAce(
1329 PACL Acl,
1330 PACE* Ace
1331 );
1332
1333 NTSYSAPI
1334 PVOID
1335 NTAPI
1336 RtlFreeSid(
1337 _In_ _Post_invalid_ PSID Sid
1338 );
1339
1340 NTSYSAPI
1341 NTSTATUS
1342 NTAPI
1343 RtlGetAce(
1344 PACL Acl,
1345 ULONG AceIndex,
1346 PVOID *Ace
1347 );
1348
1349 NTSYSAPI
1350 NTSTATUS
1351 NTAPI
1352 RtlGetControlSecurityDescriptor(
1353 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1354 _Out_ PSECURITY_DESCRIPTOR_CONTROL Control,
1355 _Out_ PULONG Revision
1356 );
1357
1358 NTSYSAPI
1359 NTSTATUS
1360 NTAPI
1361 RtlGetDaclSecurityDescriptor(
1362 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1363 _Out_ PBOOLEAN DaclPresent,
1364 _Out_ PACL *Dacl,
1365 _Out_ PBOOLEAN DaclDefaulted
1366 );
1367
1368 NTSYSAPI
1369 NTSTATUS
1370 NTAPI
1371 RtlGetSaclSecurityDescriptor(
1372 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1373 _Out_ PBOOLEAN SaclPresent,
1374 _Out_ PACL* Sacl,
1375 _Out_ PBOOLEAN SaclDefaulted
1376 );
1377
1378 NTSYSAPI
1379 NTSTATUS
1380 NTAPI
1381 RtlGetGroupSecurityDescriptor(
1382 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1383 _Out_ PSID *Group,
1384 _Out_ PBOOLEAN GroupDefaulted
1385 );
1386
1387 NTSYSAPI
1388 NTSTATUS
1389 NTAPI
1390 RtlGetOwnerSecurityDescriptor(
1391 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1392 _Out_ PSID *Owner,
1393 _Out_ PBOOLEAN OwnerDefaulted
1394 );
1395
1396 NTSYSAPI
1397 BOOLEAN
1398 NTAPI
1399 RtlGetSecurityDescriptorRMControl(
1400 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1401 _Out_ PUCHAR RMControl
1402 );
1403
1404 NTSYSAPI
1405 PSID_IDENTIFIER_AUTHORITY
1406 NTAPI
1407 RtlIdentifierAuthoritySid(PSID Sid);
1408
1409 NTSYSAPI
1410 NTSTATUS
1411 NTAPI
1412 RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel);
1413
1414 _IRQL_requires_max_(APC_LEVEL)
1415 NTSYSAPI
1416 NTSTATUS
1417 NTAPI
1418 RtlInitializeSid(
1419 _Out_ PSID Sid,
1420 _In_ PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
1421 _In_ UCHAR SubAuthorityCount
1422 );
1423
1424 NTSYSAPI
1425 ULONG
1426 NTAPI
1427 RtlLengthRequiredSid(IN ULONG SubAuthorityCount);
1428
1429 NTSYSAPI
1430 ULONG
1431 NTAPI
1432 RtlLengthSid(IN PSID Sid);
1433
1434 NTSYSAPI
1435 NTSTATUS
1436 NTAPI
1437 RtlMakeSelfRelativeSD(
1438 _In_ PSECURITY_DESCRIPTOR AbsoluteSD,
1439 _Out_ PSECURITY_DESCRIPTOR SelfRelativeSD,
1440 _Inout_ PULONG BufferLength);
1441
1442 NTSYSAPI
1443 VOID
1444 NTAPI
1445 RtlMapGenericMask(
1446 PACCESS_MASK AccessMask,
1447 PGENERIC_MAPPING GenericMapping
1448 );
1449
1450 #ifdef NTOS_MODE_USER
1451
1452 NTSYSAPI
1453 NTSTATUS
1454 NTAPI
1455 RtlQueryInformationAcl(
1456 PACL Acl,
1457 PVOID Information,
1458 ULONG InformationLength,
1459 ACL_INFORMATION_CLASS InformationClass
1460 );
1461
1462 #endif
1463
1464 NTSYSAPI
1465 VOID
1466 NTAPI
1467 RtlReleasePrivilege(
1468 _In_ PVOID ReturnedState
1469 );
1470
1471 _IRQL_requires_max_(APC_LEVEL)
1472 NTSYSAPI
1473 NTSTATUS
1474 NTAPI
1475 RtlSelfRelativeToAbsoluteSD(
1476 _In_ PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor,
1477 _Out_writes_bytes_to_opt_(*AbsoluteSecurityDescriptorSize, *AbsoluteSecurityDescriptorSize) PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
1478 _Inout_ PULONG AbsoluteSecurityDescriptorSize,
1479 _Out_writes_bytes_to_opt_(*DaclSize, *DaclSize) PACL Dacl,
1480 _Inout_ PULONG DaclSize,
1481 _Out_writes_bytes_to_opt_(*SaclSize, *SaclSize) PACL Sacl,
1482 _Inout_ PULONG SaclSize,
1483 _Out_writes_bytes_to_opt_(*OwnerSize, *OwnerSize) PSID Owner,
1484 _Inout_ PULONG OwnerSize,
1485 _Out_writes_bytes_to_opt_(*PrimaryGroupSize, *PrimaryGroupSize) PSID PrimaryGroup,
1486 _Inout_ PULONG PrimaryGroupSize
1487 );
1488
1489 NTSYSAPI
1490 NTSTATUS
1491 NTAPI
1492 RtlSelfRelativeToAbsoluteSD2(
1493 _Inout_ PSECURITY_DESCRIPTOR SelfRelativeSD,
1494 _Out_ PULONG BufferSize
1495 );
1496
1497 NTSYSAPI
1498 NTSTATUS
1499 NTAPI
1500 RtlSetAttributesSecurityDescriptor(
1501 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1502 _In_ SECURITY_DESCRIPTOR_CONTROL Control,
1503 _Out_ PULONG Revision
1504 );
1505
1506 NTSYSAPI
1507 NTSTATUS
1508 NTAPI
1509 RtlSetControlSecurityDescriptor(
1510 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1511 _In_ SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
1512 _In_ SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
1513 );
1514
1515 _IRQL_requires_max_(APC_LEVEL)
1516 NTSYSAPI
1517 NTSTATUS
1518 NTAPI
1519 RtlSetDaclSecurityDescriptor(
1520 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1521 _In_ BOOLEAN DaclPresent,
1522 _In_opt_ PACL Dacl,
1523 _In_opt_ BOOLEAN DaclDefaulted
1524 );
1525
1526 _IRQL_requires_max_(APC_LEVEL)
1527 NTSYSAPI
1528 NTSTATUS
1529 NTAPI
1530 RtlSetGroupSecurityDescriptor(
1531 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1532 _In_opt_ PSID Group,
1533 _In_opt_ BOOLEAN GroupDefaulted
1534 );
1535
1536 #ifdef NTOS_MODE_USER
1537
1538 NTSYSAPI
1539 NTSTATUS
1540 NTAPI
1541 RtlSetInformationAcl(
1542 PACL Acl,
1543 PVOID Information,
1544 ULONG InformationLength,
1545 ACL_INFORMATION_CLASS InformationClass
1546 );
1547
1548 #endif
1549
1550 _IRQL_requires_max_(APC_LEVEL)
1551 NTSYSAPI
1552 NTSTATUS
1553 NTAPI
1554 RtlSetOwnerSecurityDescriptor(
1555 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1556 _In_opt_ PSID Owner,
1557 _In_opt_ BOOLEAN OwnerDefaulted
1558 );
1559
1560 NTSYSAPI
1561 NTSTATUS
1562 NTAPI
1563 RtlSetSaclSecurityDescriptor(
1564 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1565 _In_ BOOLEAN SaclPresent,
1566 _In_ PACL Sacl,
1567 _In_ BOOLEAN SaclDefaulted
1568 );
1569
1570 NTSYSAPI
1571 VOID
1572 NTAPI
1573 RtlSetSecurityDescriptorRMControl(
1574 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor,
1575 _In_ PUCHAR RMControl
1576 );
1577
1578 NTSYSAPI
1579 PUCHAR
1580 NTAPI
1581 RtlSubAuthorityCountSid(
1582 _In_ PSID Sid
1583 );
1584
1585 NTSYSAPI
1586 PULONG
1587 NTAPI
1588 RtlSubAuthoritySid(
1589 _In_ PSID Sid,
1590 _In_ ULONG SubAuthority
1591 );
1592
1593 _IRQL_requires_max_(APC_LEVEL)
1594 _Must_inspect_result_
1595 NTSYSAPI
1596 BOOLEAN
1597 NTAPI
1598 RtlValidRelativeSecurityDescriptor(
1599 _In_reads_bytes_(SecurityDescriptorLength) PSECURITY_DESCRIPTOR SecurityDescriptorInput,
1600 _In_ ULONG SecurityDescriptorLength,
1601 _In_ SECURITY_INFORMATION RequiredInformation
1602 );
1603
1604 NTSYSAPI
1605 BOOLEAN
1606 NTAPI
1607 RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor);
1608
1609 NTSYSAPI
1610 BOOLEAN
1611 NTAPI
1612 RtlValidSid(IN PSID Sid);
1613
1614 NTSYSAPI
1615 BOOLEAN
1616 NTAPI
1617 RtlValidAcl(PACL Acl);
1618
1619 NTSYSAPI
1620 NTSTATUS
1621 NTAPI
1622 RtlDeleteSecurityObject(
1623 _In_ PSECURITY_DESCRIPTOR *ObjectDescriptor
1624 );
1625
1626 NTSYSAPI
1627 NTSTATUS
1628 NTAPI
1629 RtlNewSecurityObject(
1630 _In_ PSECURITY_DESCRIPTOR ParentDescriptor,
1631 _In_ PSECURITY_DESCRIPTOR CreatorDescriptor,
1632 _Out_ PSECURITY_DESCRIPTOR *NewDescriptor,
1633 _In_ BOOLEAN IsDirectoryObject,
1634 _In_ HANDLE Token,
1635 _In_ PGENERIC_MAPPING GenericMapping
1636 );
1637
1638 NTSYSAPI
1639 NTSTATUS
1640 NTAPI
1641 RtlQuerySecurityObject(
1642 _In_ PSECURITY_DESCRIPTOR ObjectDescriptor,
1643 _In_ SECURITY_INFORMATION SecurityInformation,
1644 _Out_ PSECURITY_DESCRIPTOR ResultantDescriptor,
1645 _In_ ULONG DescriptorLength,
1646 _Out_ PULONG ReturnLength
1647 );
1648
1649 NTSYSAPI
1650 NTSTATUS
1651 NTAPI
1652 RtlSetSecurityObject(
1653 _In_ SECURITY_INFORMATION SecurityInformation,
1654 _In_ PSECURITY_DESCRIPTOR ModificationDescriptor,
1655 _Out_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
1656 _In_ PGENERIC_MAPPING GenericMapping,
1657 _In_ HANDLE Token
1658 );
1659
1660 //
1661 // Single-Character Functions
1662 //
1663 NTSYSAPI
1664 NTSTATUS
1665 NTAPI
1666 RtlLargeIntegerToChar(
1667 _In_ PLARGE_INTEGER Value,
1668 _In_ ULONG Base,
1669 _In_ ULONG Length,
1670 _Out_ PCHAR String
1671 );
1672
1673 NTSYSAPI
1674 CHAR
1675 NTAPI
1676 RtlUpperChar(CHAR Source);
1677
1678 NTSYSAPI
1679 WCHAR
1680 NTAPI
1681 RtlUpcaseUnicodeChar(WCHAR Source);
1682
1683 NTSYSAPI
1684 WCHAR
1685 NTAPI
1686 RtlDowncaseUnicodeChar(IN WCHAR Source);
1687
1688 NTSYSAPI
1689 NTSTATUS
1690 NTAPI
1691 RtlIntegerToChar(
1692 _In_ ULONG Value,
1693 _In_ ULONG Base,
1694 _In_ ULONG Length,
1695 _Out_ PCHAR String
1696 );
1697
1698 NTSYSAPI
1699 NTSTATUS
1700 NTAPI
1701 RtlIntegerToUnicode(
1702 _In_ ULONG Value,
1703 _In_opt_ ULONG Base,
1704 _In_opt_ ULONG Length,
1705 _Inout_ LPWSTR String
1706 );
1707
1708 _IRQL_requires_max_(PASSIVE_LEVEL)
1709 _At_(String->MaximumLength, _Const_)
1710 NTSYSAPI
1711 NTSTATUS
1712 NTAPI
1713 RtlIntegerToUnicodeString(
1714 _In_ ULONG Value,
1715 _In_opt_ ULONG Base,
1716 _Inout_ PUNICODE_STRING String
1717 );
1718
1719 NTSYSAPI
1720 NTSTATUS
1721 NTAPI
1722 RtlCharToInteger(
1723 PCSZ String,
1724 ULONG Base,
1725 PULONG Value
1726 );
1727
1728 //
1729 // Byte Swap Functions
1730 //
1731 #ifdef NTOS_MODE_USER
1732
1733 unsigned short __cdecl _byteswap_ushort(unsigned short);
1734 unsigned long __cdecl _byteswap_ulong (unsigned long);
1735 unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
1736 #ifdef _MSC_VER
1737 #pragma intrinsic(_byteswap_ushort)
1738 #pragma intrinsic(_byteswap_ulong)
1739 #pragma intrinsic(_byteswap_uint64)
1740 #endif // _MSC_VER
1741 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
1742 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
1743 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
1744
1745 #endif // NTOS_MODE_USER
1746
1747 //
1748 // Unicode->Ansi String Functions
1749 //
1750 NTSYSAPI
1751 ULONG
1752 NTAPI
1753 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString);
1754
1755 #ifdef NTOS_MODE_USER
1756
1757 #define RtlUnicodeStringToAnsiSize(STRING) ( \
1758 NLS_MB_CODE_PAGE_TAG ? \
1759 RtlxUnicodeStringToAnsiSize(STRING) : \
1760 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1761 )
1762
1763 #endif
1764
1765 NTSYSAPI
1766 NTSTATUS
1767 NTAPI
1768 RtlUnicodeStringToAnsiString(
1769 PANSI_STRING DestinationString,
1770 PCUNICODE_STRING SourceString,
1771 BOOLEAN AllocateDestinationString
1772 );
1773
1774 //
1775 // Unicode->OEM String Functions
1776 //
1777 NTSYSAPI
1778 NTSTATUS
1779 NTAPI
1780 RtlUpcaseUnicodeStringToOemString(
1781 POEM_STRING DestinationString,
1782 PCUNICODE_STRING SourceString,
1783 BOOLEAN AllocateDestinationString
1784 );
1785
1786 _IRQL_requires_max_(PASSIVE_LEVEL)
1787 _Must_inspect_result_
1788 //_At_(DestinationString->Buffer, _Post_bytecount_(DestinationString->Length))
1789 NTSYSAPI
1790 NTSTATUS
1791 NTAPI
1792 RtlUpcaseUnicodeStringToCountedOemString(
1793 _When_(AllocateDestinationString, _Out_ _At_(DestinationString->Buffer, __drv_allocatesMem(Mem)))
1794 _When_(!AllocateDestinationString, _Inout_)
1795 POEM_STRING DestinationString,
1796 _In_ PCUNICODE_STRING SourceString,
1797 _In_ BOOLEAN AllocateDestinationString
1798 );
1799
1800 NTSYSAPI
1801 NTSTATUS
1802 NTAPI
1803 RtlUnicodeStringToOemString(
1804 POEM_STRING DestinationString,
1805 PCUNICODE_STRING SourceString,
1806 BOOLEAN AllocateDestinationString
1807 );
1808
1809 NTSYSAPI
1810 NTSTATUS
1811 NTAPI
1812 RtlUpcaseUnicodeToOemN(
1813 PCHAR OemString,
1814 ULONG OemSize,
1815 PULONG ResultSize,
1816 PCWCH UnicodeString,
1817 ULONG UnicodeSize
1818 );
1819
1820 NTSYSAPI
1821 ULONG
1822 NTAPI
1823 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString);
1824
1825 #ifdef NTOS_MODE_USER
1826
1827 #define RtlUnicodeStringToOemSize(STRING) ( \
1828 NLS_MB_OEM_CODE_PAGE_TAG ? \
1829 RtlxUnicodeStringToOemSize(STRING) : \
1830 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1831 )
1832
1833 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
1834 (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
1835 )
1836
1837 #endif
1838
1839 NTSYSAPI
1840 NTSTATUS
1841 NTAPI
1842 RtlUnicodeToOemN(
1843 PCHAR OemString,
1844 ULONG OemSize,
1845 PULONG ResultSize,
1846 PCWCH UnicodeString,
1847 ULONG UnicodeSize
1848 );
1849
1850 //
1851 // Unicode->MultiByte String Functions
1852 //
1853 NTSYSAPI
1854 NTSTATUS
1855 NTAPI
1856 RtlUnicodeToMultiByteN(
1857 PCHAR MbString,
1858 ULONG MbSize,
1859 PULONG ResultSize,
1860 PCWCH UnicodeString,
1861 ULONG UnicodeSize
1862 );
1863
1864 NTSYSAPI
1865 NTSTATUS
1866 NTAPI
1867 RtlUpcaseUnicodeToMultiByteN(
1868 PCHAR MbString,
1869 ULONG MbSize,
1870 PULONG ResultSize,
1871 PCWCH UnicodeString,
1872 ULONG UnicodeSize
1873 );
1874
1875 NTSYSAPI
1876 NTSTATUS
1877 NTAPI
1878 RtlUnicodeToMultiByteSize(
1879 PULONG MbSize,
1880 PCWCH UnicodeString,
1881 ULONG UnicodeSize
1882 );
1883
1884 NTSYSAPI
1885 ULONG
1886 NTAPI
1887 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString);
1888
1889 //
1890 // OEM to Unicode Functions
1891 //
1892 NTSYSAPI
1893 NTSTATUS
1894 NTAPI
1895 RtlOemStringToUnicodeString(
1896 PUNICODE_STRING DestinationString,
1897 PCOEM_STRING SourceString,
1898 BOOLEAN AllocateDestinationString
1899 );
1900
1901 _IRQL_requires_max_(PASSIVE_LEVEL)
1902 NTSYSAPI
1903 NTSTATUS
1904 NTAPI
1905 RtlOemToUnicodeN(
1906 _Out_writes_bytes_to_(MaxBytesInUnicodeString, *BytesInUnicodeString) PWCH UnicodeString,
1907 _In_ ULONG MaxBytesInUnicodeString,
1908 _Out_opt_ PULONG BytesInUnicodeString,
1909 _In_reads_bytes_(BytesInOemString) PCCH OemString,
1910 _In_ ULONG BytesInOemString
1911 );
1912
1913 #ifdef NTOS_MODE_USER
1914
1915 #define RtlOemStringToUnicodeSize(STRING) ( \
1916 NLS_MB_OEM_CODE_PAGE_TAG ? \
1917 RtlxOemStringToUnicodeSize(STRING) : \
1918 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1919 )
1920
1921 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
1922 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
1923 )
1924
1925 #endif
1926
1927 //
1928 // Ansi->Unicode String Functions
1929 //
1930 _IRQL_requires_max_(APC_LEVEL)
1931 NTSYSAPI
1932 WCHAR
1933 NTAPI
1934 RtlAnsiCharToUnicodeChar(
1935 _Inout_ PUCHAR *SourceCharacter);
1936
1937 NTSYSAPI
1938 NTSTATUS
1939 NTAPI
1940 RtlAnsiStringToUnicodeString(
1941 PUNICODE_STRING DestinationString,
1942 PCANSI_STRING SourceString,
1943 BOOLEAN AllocateDestinationString
1944 );
1945
1946 NTSYSAPI
1947 ULONG
1948 NTAPI
1949 RtlxAnsiStringToUnicodeSize(
1950 PCANSI_STRING AnsiString
1951 );
1952
1953 #ifdef NTOS_MODE_USER
1954
1955 #define RtlAnsiStringToUnicodeSize(STRING) ( \
1956 NLS_MB_CODE_PAGE_TAG ? \
1957 RtlxAnsiStringToUnicodeSize(STRING) : \
1958 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1959 )
1960
1961 #endif
1962
1963 NTSYSAPI
1964 BOOLEAN
1965 NTAPI
1966 RtlCreateUnicodeStringFromAsciiz(
1967 _Out_ PUNICODE_STRING Destination,
1968 _In_ PCSZ Source
1969 );
1970
1971 //
1972 // Unicode String Functions
1973 //
1974 NTSYSAPI
1975 NTSTATUS
1976 NTAPI
1977 RtlAppendUnicodeToString(
1978 PUNICODE_STRING Destination,
1979 PCWSTR Source
1980 );
1981
1982 NTSYSAPI
1983 NTSTATUS
1984 NTAPI
1985 RtlAppendUnicodeStringToString(
1986 PUNICODE_STRING Destination,
1987 PCUNICODE_STRING Source
1988 );
1989
1990 NTSYSAPI
1991 LONG
1992 NTAPI
1993 RtlCompareUnicodeString(
1994 PCUNICODE_STRING String1,
1995 PCUNICODE_STRING String2,
1996 BOOLEAN CaseInsensitive
1997 );
1998
1999 NTSYSAPI
2000 VOID
2001 NTAPI
2002 RtlCopyUnicodeString(
2003 PUNICODE_STRING DestinationString,
2004 PCUNICODE_STRING SourceString
2005 );
2006
2007 NTSYSAPI
2008 BOOLEAN
2009 NTAPI
2010 RtlCreateUnicodeString(
2011 PUNICODE_STRING DestinationString,
2012 PCWSTR SourceString
2013 );
2014
2015 #ifdef NTOS_MODE_USER
2016
2017 NTSYSAPI
2018 NTSTATUS
2019 NTAPI
2020 RtlDowncaseUnicodeString(
2021 _Inout_ PUNICODE_STRING UniDest,
2022 _In_ PCUNICODE_STRING UniSource,
2023 _In_ BOOLEAN AllocateDestinationString
2024 );
2025
2026 NTSYSAPI
2027 NTSTATUS
2028 NTAPI
2029 RtlDuplicateUnicodeString(
2030 _In_ ULONG Flags,
2031 _In_ PCUNICODE_STRING SourceString,
2032 _Out_ PUNICODE_STRING DestinationString
2033 );
2034
2035 //
2036 // Memory Functions
2037 //
2038 NTSYSAPI
2039 VOID
2040 NTAPI
2041 RtlFillMemoryUlong(
2042 _In_ PVOID Destination,
2043 _In_ SIZE_T Length,
2044 _In_ ULONG Fill
2045 );
2046
2047 NTSYSAPI
2048 VOID
2049 NTAPI
2050 RtlFillMemoryUlonglong(
2051 _Out_ PVOID Destination,
2052 _In_ SIZE_T Length,
2053 _In_ ULONGLONG Pattern
2054 );
2055
2056 NTSYSAPI
2057 NTSTATUS
2058 NTAPI
2059 RtlCopyMappedMemory(
2060 _Out_writes_bytes_all_(Size) PVOID Destination,
2061 _In_reads_bytes_(Size) const VOID *Source,
2062 _In_ SIZE_T Size
2063 );
2064
2065 NTSYSAPI
2066 SIZE_T
2067 NTAPI
2068 RtlCompareMemoryUlong(
2069 _In_ PVOID Source,
2070 _In_ SIZE_T Length,
2071 _In_ ULONG Pattern
2072 );
2073
2074 #ifndef RtlEqualMemory
2075 #define RtlEqualMemory(Destination, Source, Length) \
2076 (!memcmp(Destination, Source, Length))
2077 #endif
2078
2079 #define RtlCopyBytes RtlCopyMemory
2080 #define RtlFillBytes RtlFillMemory
2081 #define RtlZeroBytes RtlZeroMemory
2082
2083 #endif
2084
2085 NTSYSAPI
2086 BOOLEAN
2087 NTAPI
2088 RtlEqualUnicodeString(
2089 PCUNICODE_STRING String1,
2090 PCUNICODE_STRING String2,
2091 BOOLEAN CaseInsensitive
2092 );
2093
2094 NTSYSAPI
2095 NTSTATUS
2096 NTAPI
2097 RtlFindCharInUnicodeString(
2098 _In_ ULONG Flags,
2099 _In_ PCUNICODE_STRING SearchString,
2100 _In_ PCUNICODE_STRING MatchString,
2101 _Out_ PUSHORT Position
2102 );
2103
2104 _IRQL_requires_max_(PASSIVE_LEVEL)
2105 NTSYSAPI
2106 VOID
2107 NTAPI
2108 RtlFreeUnicodeString(
2109 _Inout_ _At_(UnicodeString->Buffer, __drv_freesMem(Mem))
2110 PUNICODE_STRING UnicodeString
2111 );
2112
2113 NTSYSAPI
2114 VOID
2115 NTAPI
2116 RtlEraseUnicodeString(
2117 _Inout_ PUNICODE_STRING String
2118 );
2119
2120 NTSYSAPI
2121 NTSTATUS
2122 NTAPI
2123 RtlHashUnicodeString(
2124 _In_ CONST UNICODE_STRING *String,
2125 _In_ BOOLEAN CaseInSensitive,
2126 _In_ ULONG HashAlgorithm,
2127 _Out_ PULONG HashValue
2128 );
2129
2130 _IRQL_requires_max_(DISPATCH_LEVEL)
2131 _At_(DestinationString->Buffer, _Post_equal_to_(SourceString))
2132 _When_(SourceString != NULL,
2133 _At_(DestinationString->Length, _Post_equal_to_(_String_length_(SourceString) * sizeof(WCHAR)))
2134 _At_(DestinationString->MaximumLength, _Post_equal_to_(DestinationString->Length + sizeof(WCHAR))))
2135 _When_(SourceString == NULL,
2136 _At_(DestinationString->Length, _Post_equal_to_(0))
2137 _At_(DestinationString->MaximumLength, _Post_equal_to_(0)))
2138 NTSYSAPI
2139 VOID
2140 NTAPI
2141 RtlInitUnicodeString(
2142 _Out_ PUNICODE_STRING DestinationString,
2143 _In_opt_z_ __drv_aliasesMem PCWSTR SourceString
2144 );
2145
2146 _IRQL_requires_max_(DISPATCH_LEVEL)
2147 NTSYSAPI
2148 NTSTATUS
2149 NTAPI
2150 RtlInitUnicodeStringEx(
2151 _Out_ PUNICODE_STRING DestinationString,
2152 _In_opt_z_ __drv_aliasesMem PCWSTR SourceString
2153 );
2154
2155 NTSYSAPI
2156 BOOLEAN
2157 NTAPI
2158 RtlIsTextUnicode(
2159 PVOID Buffer,
2160 INT Length,
2161 INT *Flags
2162 );
2163
2164 _IRQL_requires_max_(PASSIVE_LEVEL)
2165 _Must_inspect_result_
2166 NTSYSAPI
2167 BOOLEAN
2168 NTAPI
2169 RtlPrefixString(
2170 _In_ const STRING *String1,
2171 _In_ const STRING *String2,
2172 _In_ BOOLEAN CaseInsensitive
2173 );
2174
2175 _IRQL_requires_max_(PASSIVE_LEVEL)
2176 _Must_inspect_result_
2177 NTSYSAPI
2178 BOOLEAN
2179 NTAPI
2180 RtlPrefixUnicodeString(
2181 _In_ PCUNICODE_STRING String1,
2182 _In_ PCUNICODE_STRING String2,
2183 _In_ BOOLEAN CaseInsensitive
2184 );
2185
2186 _IRQL_requires_max_(PASSIVE_LEVEL)
2187 NTSYSAPI
2188 VOID
2189 NTAPI
2190 RtlUpperString(
2191 _Inout_ PSTRING DestinationString,
2192 _In_ const STRING *SourceString
2193 );
2194
2195 _IRQL_requires_max_(PASSIVE_LEVEL)
2196 _Must_inspect_result_
2197 NTSYSAPI
2198 LONG
2199 NTAPI
2200 RtlCompareString(
2201 _In_ const STRING *String1,
2202 _In_ const STRING *String2,
2203 _In_ BOOLEAN CaseInSensitive
2204 );
2205
2206 NTSYSAPI
2207 VOID
2208 NTAPI
2209 RtlCopyString(
2210 _Out_ PSTRING DestinationString,
2211 _In_opt_ const STRING *SourceString
2212 );
2213
2214 _IRQL_requires_max_(PASSIVE_LEVEL)
2215 _Must_inspect_result_
2216 NTSYSAPI
2217 BOOLEAN
2218 NTAPI
2219 RtlEqualString(
2220 _In_ const STRING *String1,
2221 _In_ const STRING *String2,
2222 _In_ BOOLEAN CaseInSensitive
2223 );
2224
2225 _IRQL_requires_max_(APC_LEVEL)
2226 NTSYSAPI
2227 NTSTATUS
2228 NTAPI
2229 RtlAppendStringToString(
2230 _Inout_ PSTRING Destination,
2231 _In_ const STRING *Source
2232 );
2233
2234 _IRQL_requires_max_(PASSIVE_LEVEL)
2235 _When_(AllocateDestinationString, _Must_inspect_result_)
2236 NTSYSAPI
2237 NTSTATUS
2238 NTAPI
2239 RtlUpcaseUnicodeString(
2240 _When_(AllocateDestinationString, _Out_ _At_(DestinationString->Buffer, __drv_allocatesMem(Mem)))
2241 _When_(!AllocateDestinationString, _Inout_)
2242 PUNICODE_STRING DestinationString,
2243 _In_ PCUNICODE_STRING SourceString,
2244 _In_ BOOLEAN AllocateDestinationString
2245 );
2246
2247 _IRQL_requires_max_(PASSIVE_LEVEL)
2248 NTSYSAPI
2249 NTSTATUS
2250 NTAPI
2251 RtlUnicodeStringToInteger(
2252 _In_ PCUNICODE_STRING String,
2253 _In_opt_ ULONG Base,
2254 _Out_ PULONG Value
2255 );
2256
2257 NTSYSAPI
2258 NTSTATUS
2259 NTAPI
2260 RtlValidateUnicodeString(
2261 _In_ ULONG Flags,
2262 _In_ PCUNICODE_STRING String
2263 );
2264
2265 //
2266 // Ansi String Functions
2267 //
2268 _IRQL_requires_max_(PASSIVE_LEVEL)
2269 NTSYSAPI
2270 VOID
2271 NTAPI
2272 RtlFreeAnsiString(
2273 _Inout_ _At_(AnsiString->Buffer, __drv_freesMem(Mem))
2274 PANSI_STRING AnsiString
2275 );
2276
2277 _IRQL_requires_max_(DISPATCH_LEVEL)
2278 NTSYSAPI
2279 VOID
2280 NTAPI
2281 RtlInitAnsiString(
2282 _Out_ PANSI_STRING DestinationString,
2283 _In_opt_z_ __drv_aliasesMem PCSZ SourceString
2284 );
2285
2286 _IRQL_requires_max_(DISPATCH_LEVEL)
2287 NTSYSAPI
2288 NTSTATUS
2289 NTAPI
2290 RtlInitAnsiStringEx(
2291 _Out_ PANSI_STRING DestinationString,
2292 _In_opt_z_ __drv_aliasesMem PCSZ SourceString
2293 );
2294
2295 //
2296 // OEM String Functions
2297 //
2298 _IRQL_requires_max_(PASSIVE_LEVEL)
2299 NTSYSAPI
2300 VOID
2301 NTAPI
2302 RtlFreeOemString(
2303 _Inout_ _At_(OemString->Buffer, __drv_freesMem(Mem))
2304 POEM_STRING OemString
2305 );
2306
2307 //
2308 // MultiByte->Unicode String Functions
2309 //
2310 _IRQL_requires_max_(PASSIVE_LEVEL)
2311 NTSYSAPI
2312 NTSTATUS
2313 NTAPI
2314 RtlMultiByteToUnicodeN(
2315 _Out_writes_bytes_to_(MaxBytesInUnicodeString, *BytesInUnicodeString) PWCH UnicodeString,
2316 _In_ ULONG MaxBytesInUnicodeString,
2317 _Out_opt_ PULONG BytesInUnicodeString,
2318 _In_reads_bytes_(BytesInMultiByteString) const CHAR *MultiByteString,
2319 _In_ ULONG BytesInMultiByteString
2320 );
2321
2322 _IRQL_requires_max_(PASSIVE_LEVEL)
2323 NTSYSAPI
2324 NTSTATUS
2325 NTAPI
2326 RtlMultiByteToUnicodeSize(
2327 _Out_ PULONG BytesInUnicodeString,
2328 _In_reads_bytes_(BytesInMultiByteString) const CHAR *MultiByteString,
2329 _In_ ULONG BytesInMultiByteString
2330 );
2331
2332 //
2333 // Atom Functions
2334 //
2335 NTSYSAPI
2336 NTSTATUS
2337 NTAPI
2338 RtlAddAtomToAtomTable(
2339 _In_ PRTL_ATOM_TABLE AtomTable,
2340 _In_ PWSTR AtomName,
2341 _Out_ PRTL_ATOM Atom
2342 );
2343
2344 NTSYSAPI
2345 NTSTATUS
2346 NTAPI
2347 RtlCreateAtomTable(
2348 _In_ ULONG TableSize,
2349 _Inout_ PRTL_ATOM_TABLE *AtomTable
2350 );
2351
2352 NTSYSAPI
2353 NTSTATUS
2354 NTAPI
2355 RtlDeleteAtomFromAtomTable(
2356 _In_ PRTL_ATOM_TABLE AtomTable,
2357 _In_ RTL_ATOM Atom
2358 );
2359
2360 NTSYSAPI
2361 NTSTATUS
2362 NTAPI
2363 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable);
2364
2365 NTSYSAPI
2366 NTSTATUS
2367 NTAPI
2368 RtlQueryAtomInAtomTable(
2369 _In_ PRTL_ATOM_TABLE AtomTable,
2370 _In_ RTL_ATOM Atom,
2371 _Out_opt_ PULONG RefCount,
2372 _Out_opt_ PULONG PinCount,
2373 _Out_opt_z_bytecap_(*NameLength) PWSTR AtomName,
2374 _Inout_opt_ PULONG NameLength
2375 );
2376
2377 NTSYSAPI
2378 NTSTATUS
2379 NTAPI
2380 RtlPinAtomInAtomTable(
2381 _In_ PRTL_ATOM_TABLE AtomTable,
2382 _In_ RTL_ATOM Atom
2383 );
2384
2385 NTSYSAPI
2386 NTSTATUS
2387 NTAPI
2388 RtlLookupAtomInAtomTable(
2389 _In_ PRTL_ATOM_TABLE AtomTable,
2390 _In_ PWSTR AtomName,
2391 _Out_ PRTL_ATOM Atom
2392 );
2393
2394 //
2395 // Process Management Functions
2396 //
2397 NTSYSAPI
2398 PPEB
2399 NTAPI
2400 RtlGetCurrentPeb(
2401 VOID
2402 );
2403
2404 NTSYSAPI
2405 VOID
2406 NTAPI
2407 RtlAcquirePebLock(VOID);
2408
2409 NTSYSAPI
2410 NTSTATUS
2411 NTAPI
2412 RtlCreateProcessParameters (
2413 _Out_ PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
2414 _In_ PUNICODE_STRING ImagePathName,
2415 _In_opt_ PUNICODE_STRING DllPath,
2416 _In_opt_ PUNICODE_STRING CurrentDirectory,
2417 _In_opt_ PUNICODE_STRING CommandLine,
2418 _In_opt_ PWSTR Environment,
2419 _In_opt_ PUNICODE_STRING WindowTitle,
2420 _In_opt_ PUNICODE_STRING DesktopInfo,
2421 _In_opt_ PUNICODE_STRING ShellInfo,
2422 _In_opt_ PUNICODE_STRING RuntimeInfo
2423 );
2424
2425 NTSYSAPI
2426 NTSTATUS
2427 NTAPI
2428 RtlCreateUserProcess(
2429 _In_ PUNICODE_STRING ImageFileName,
2430 _In_ ULONG Attributes,
2431 _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters,
2432 _In_opt_ PSECURITY_DESCRIPTOR ProcessSecutityDescriptor,
2433 _In_opt_ PSECURITY_DESCRIPTOR ThreadSecurityDescriptor,
2434 _In_opt_ HANDLE ParentProcess,
2435 _In_ BOOLEAN CurrentDirectory,
2436 _In_opt_ HANDLE DebugPort,
2437 _In_opt_ HANDLE ExceptionPort,
2438 _Out_ PRTL_USER_PROCESS_INFORMATION ProcessInfo
2439 );
2440
2441 #if (NTDDI_VERSION >= NTDDI_WIN7)
2442 NTSYSAPI
2443 NTSTATUS
2444 NTAPI
2445 RtlCreateUserThread(
2446 _In_ PVOID ThreadContext,
2447 _Out_ HANDLE *OutThreadHandle,
2448 _Reserved_ PVOID Reserved1,
2449 _Reserved_ PVOID Reserved2,
2450 _Reserved_ PVOID Reserved3,
2451 _Reserved_ PVOID Reserved4,
2452 _Reserved_ PVOID Reserved5,
2453 _Reserved_ PVOID Reserved6,
2454 _Reserved_ PVOID Reserved7,
2455 _Reserved_ PVOID Reserved8
2456 );
2457 #else
2458 NTSYSAPI
2459 NTSTATUS
2460 NTAPI
2461 RtlCreateUserThread(
2462 _In_ HANDLE ProcessHandle,
2463 _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor,
2464 _In_ BOOLEAN CreateSuspended,
2465 _In_ ULONG StackZeroBits,
2466 _In_ SIZE_T StackReserve,
2467 _In_ SIZE_T StackCommit,
2468 _In_ PTHREAD_START_ROUTINE StartAddress,
2469 _In_ PVOID Parameter,
2470 _Out_opt_ PHANDLE ThreadHandle,
2471 _Out_opt_ PCLIENT_ID ClientId
2472 );
2473 #endif
2474
2475 NTSYSAPI
2476 PRTL_USER_PROCESS_PARAMETERS
2477 NTAPI
2478 RtlDeNormalizeProcessParams(
2479 _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2480
2481 NTSYSAPI
2482 NTSTATUS
2483 NTAPI
2484 RtlDestroyProcessParameters(
2485 _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2486
2487 NTSYSAPI
2488 VOID
2489 NTAPI
2490 RtlExitUserThread(
2491 _In_ NTSTATUS Status);
2492
2493 NTSYSAPI
2494 VOID
2495 NTAPI
2496 RtlInitializeContext(
2497 _In_ HANDLE ProcessHandle,
2498 _Out_ PCONTEXT ThreadContext,
2499 _In_opt_ PVOID ThreadStartParam,
2500 _In_ PTHREAD_START_ROUTINE ThreadStartAddress,
2501 _In_ PINITIAL_TEB InitialTeb
2502 );
2503
2504 #ifdef _M_AMD64
2505 typedef struct _WOW64_CONTEXT *PWOW64_CONTEXT;
2506
2507 NTSYSAPI
2508 NTSTATUS
2509 NTAPI
2510 RtlWow64GetThreadContext(
2511 _In_ HANDLE ThreadHandle,
2512 _Inout_ PWOW64_CONTEXT ThreadContext
2513 );
2514
2515
2516 NTSYSAPI
2517 NTSTATUS
2518 NTAPI
2519 RtlWow64SetThreadContext(
2520 _In_ HANDLE ThreadHandle,
2521 _In_ PWOW64_CONTEXT ThreadContext
2522 );
2523 #endif
2524
2525 NTSYSAPI
2526 BOOLEAN
2527 NTAPI
2528 RtlIsThreadWithinLoaderCallout(VOID);
2529
2530 NTSYSAPI
2531 PRTL_USER_PROCESS_PARAMETERS
2532 NTAPI
2533 RtlNormalizeProcessParams(
2534 _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2535
2536 NTSYSAPI
2537 VOID
2538 NTAPI
2539 RtlReleasePebLock(VOID);
2540
2541 NTSYSAPI
2542 NTSTATUS
2543 NTAPI
2544 RtlRemoteCall(
2545 _In_ HANDLE Process,
2546 _In_ HANDLE Thread,
2547 _In_ PVOID CallSite,
2548 _In_ ULONG ArgumentCount,
2549 _In_ PULONG Arguments,
2550 _In_ BOOLEAN PassContext,
2551 _In_ BOOLEAN AlreadySuspended
2552 );
2553
2554 NTSYSAPI
2555 NTSTATUS
2556 __cdecl
2557 RtlSetProcessIsCritical(
2558 _In_ BOOLEAN NewValue,
2559 _Out_opt_ PBOOLEAN OldValue,
2560 _In_ BOOLEAN NeedBreaks
2561 );
2562
2563 NTSYSAPI
2564 NTSTATUS
2565 __cdecl
2566 RtlSetThreadIsCritical(
2567 _In_ BOOLEAN NewValue,
2568 _Out_opt_ PBOOLEAN OldValue,
2569 _In_ BOOLEAN NeedBreaks
2570 );
2571
2572 NTSYSAPI
2573 ULONG
2574 NTAPI
2575 RtlGetCurrentProcessorNumber(
2576 VOID
2577 );
2578
2579 #define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock)
2580
2581 //
2582 // Thread Pool Functions
2583 //
2584 //
2585 NTSTATUS
2586 NTAPI
2587 RtlSetThreadPoolStartFunc(
2588 _In_ PRTL_START_POOL_THREAD StartPoolThread,
2589 _In_ PRTL_EXIT_POOL_THREAD ExitPoolThread
2590 );
2591
2592 NTSYSAPI
2593 NTSTATUS
2594 NTAPI
2595 RtlDeregisterWaitEx(
2596 _In_ HANDLE hWaitHandle,
2597 _In_opt_ HANDLE hCompletionEvent
2598 );
2599
2600 NTSYSAPI
2601 NTSTATUS
2602 NTAPI
2603 RtlDeregisterWait(
2604 _In_ HANDLE hWaitHandle
2605 );
2606
2607 NTSYSAPI
2608 NTSTATUS
2609 NTAPI
2610 RtlQueueWorkItem(
2611 _In_ WORKERCALLBACKFUNC Function,
2612 _In_opt_ PVOID Context,
2613 _In_ ULONG Flags
2614 );
2615
2616 NTSYSAPI
2617 NTSTATUS
2618 NTAPI
2619 RtlSetIoCompletionCallback(
2620 _In_ HANDLE FileHandle,
2621 _In_ PIO_APC_ROUTINE Callback,
2622 _In_ ULONG Flags
2623 );
2624
2625 NTSYSAPI
2626 NTSTATUS
2627 NTAPI
2628 RtlRegisterWait(
2629 _In_ PHANDLE phNewWaitObject,
2630 _In_ HANDLE hObject,
2631 _In_ WAITORTIMERCALLBACKFUNC Callback,
2632 _In_ PVOID pvContext,
2633 _In_ ULONG ulMilliseconds,
2634 _In_ ULONG ulFlags
2635 );
2636
2637 //
2638 // Environment/Path Functions
2639 //
2640 NTSYSAPI
2641 NTSTATUS
2642 NTAPI
2643 RtlCreateEnvironment(
2644 _In_ BOOLEAN Inherit,
2645 _Out_ PWSTR *Environment
2646 );
2647
2648 NTSYSAPI
2649 NTSTATUS
2650 NTAPI
2651 RtlComputePrivatizedDllName_U(
2652 _In_ PUNICODE_STRING DllName,
2653 _Out_ PUNICODE_STRING RealName,
2654 _Out_ PUNICODE_STRING LocalName
2655 );
2656
2657 NTSYSAPI
2658 VOID
2659 NTAPI
2660 RtlDestroyEnvironment(
2661 _In_ PWSTR Environment
2662 );
2663
2664 NTSYSAPI
2665 BOOLEAN
2666 NTAPI
2667 RtlDoesFileExists_U(
2668 _In_ PCWSTR FileName
2669 );
2670
2671 NTSYSAPI
2672 RTL_PATH_TYPE
2673 NTAPI
2674 RtlDetermineDosPathNameType_U(
2675 _In_ PCWSTR Path
2676 );
2677
2678 NTSYSAPI
2679 ULONG
2680 NTAPI
2681 RtlDosSearchPath_U(
2682 _In_ PCWSTR Path,
2683 _In_ PCWSTR FileName,
2684 _In_ PCWSTR Extension,
2685 _In_ ULONG BufferSize,
2686 _Out_ PWSTR Buffer,
2687 _Out_ PWSTR *PartName
2688 );
2689
2690 NTSYSAPI
2691 NTSTATUS
2692 NTAPI
2693 RtlDosSearchPath_Ustr(
2694 _In_ ULONG Flags,
2695 _In_ PUNICODE_STRING PathString,
2696 _In_ PUNICODE_STRING FileNameString,
2697 _In_ PUNICODE_STRING ExtensionString,
2698 _In_ PUNICODE_STRING CallerBuffer,
2699 _Inout_opt_ PUNICODE_STRING DynamicString,
2700 _Out_opt_ PUNICODE_STRING* FullNameOut,
2701 _Out_opt_ PSIZE_T FilePartSize,
2702 _Out_opt_ PSIZE_T LengthNeeded
2703 );
2704
2705 NTSYSAPI
2706 BOOLEAN
2707 NTAPI
2708 RtlDosPathNameToNtPathName_U(
2709 _In_opt_z_ PCWSTR DosPathName,
2710 _Out_ PUNICODE_STRING NtPathName,
2711 _Out_opt_ PCWSTR *NtFileNamePart,
2712 _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo
2713 );
2714
2715 NTSYSAPI
2716 BOOLEAN
2717 NTAPI
2718 RtlDosPathNameToRelativeNtPathName_U(
2719 _In_ PCWSTR DosName,
2720 _Out_ PUNICODE_STRING NtName,
2721 _Out_ PCWSTR *PartName,
2722 _Out_ PRTL_RELATIVE_NAME_U RelativeName
2723 );
2724
2725 _At_(Destination->Buffer, _Out_bytecap_(Destination->MaximumLength))
2726 NTSYSAPI
2727 NTSTATUS
2728 NTAPI
2729 RtlExpandEnvironmentStrings_U(
2730 _In_z_ PWSTR Environment,
2731 _In_ PUNICODE_STRING Source,
2732 _Inout_ PUNICODE_STRING Destination,
2733 _Out_ PULONG Length
2734 );
2735
2736 NTSYSAPI
2737 ULONG
2738 NTAPI
2739 RtlGetCurrentDirectory_U(
2740 _In_ ULONG MaximumLength,
2741 _Out_bytecap_(MaximumLength) PWSTR Buffer
2742 );
2743
2744 NTSYSAPI
2745 ULONG
2746 NTAPI
2747 RtlGetFullPathName_U(
2748 _In_ PCWSTR FileName,
2749 _In_ ULONG Size,
2750 _Out_z_bytecap_(Size) PWSTR Buffer,
2751 _Out_opt_ PWSTR *ShortName
2752 );
2753
2754 #if (NTDDI_VERSION >= NTDDI_WIN7)
2755 NTSYSAPI
2756 NTSTATUS
2757 NTAPI
2758 RtlGetFullPathName_UEx(
2759 _In_ PWSTR FileName,
2760 _In_ ULONG BufferLength,
2761 _Out_ PWSTR Buffer,
2762 _Out_opt_ PWSTR *FilePart,
2763 _Out_opt_ RTL_PATH_TYPE *InputPathType
2764 );
2765 #endif
2766
2767 NTSTATUS
2768 NTAPI
2769 RtlGetFullPathName_UstrEx(
2770 _In_ PUNICODE_STRING FileName,
2771 _In_opt_ PUNICODE_STRING StaticString,
2772 _In_opt_ PUNICODE_STRING DynamicString,
2773 _Out_opt_ PUNICODE_STRING *StringUsed,
2774 _Out_opt_ PSIZE_T FilePartSize,
2775 _Out_opt_ PBOOLEAN NameInvalid,
2776 _Out_ RTL_PATH_TYPE* PathType,
2777 _Out_opt_ PSIZE_T LengthNeeded
2778 );
2779
2780 NTSYSAPI
2781 NTSTATUS
2782 NTAPI
2783 RtlGetLengthWithoutTrailingPathSeperators(
2784 _Reserved_ ULONG Flags,
2785 _In_ PCUNICODE_STRING PathString,
2786 _Out_ PULONG Length
2787 );
2788
2789 NTSYSAPI
2790 ULONG
2791 NTAPI
2792 RtlGetLongestNtPathLength(
2793 VOID
2794 );
2795
2796 NTSYSAPI
2797 ULONG
2798 NTAPI
2799 RtlIsDosDeviceName_U(
2800 _In_ PCWSTR Name
2801 );
2802
2803 NTSYSAPI
2804 ULONG
2805 NTAPI
2806 RtlIsDosDeviceName_Ustr(
2807 _In_ PCUNICODE_STRING Name
2808 );
2809
2810 _IRQL_requires_max_(PASSIVE_LEVEL)
2811 _Must_inspect_result_
2812 NTSYSAPI
2813 BOOLEAN
2814 NTAPI
2815 RtlIsNameLegalDOS8Dot3(
2816 _In_ PCUNICODE_STRING Name,
2817 _Inout_opt_ POEM_STRING OemName,
2818 _Out_opt_ PBOOLEAN NameContainsSpaces
2819 );
2820
2821 NTSYSAPI
2822 NTSTATUS
2823 NTAPI
2824 RtlQueryEnvironmentVariable_U(
2825 _In_opt_ PWSTR Environment,
2826 _In_ PUNICODE_STRING Name,
2827 _Out_ PUNICODE_STRING Value
2828 );
2829
2830 VOID
2831 NTAPI
2832 RtlReleaseRelativeName(
2833 _In_ PRTL_RELATIVE_NAME_U RelativeName
2834 );
2835
2836 NTSYSAPI
2837 NTSTATUS
2838 NTAPI
2839 RtlSetCurrentDirectory_U(
2840 _In_ PUNICODE_STRING name
2841 );
2842
2843 NTSYSAPI
2844 NTSTATUS
2845 NTAPI
2846 RtlSetEnvironmentVariable(
2847 _In_z_ PWSTR *Environment,
2848 _In_ PUNICODE_STRING Name,
2849 _In_ PUNICODE_STRING Value
2850 );
2851
2852 //
2853 // Critical Section/Resource Functions
2854 //
2855 NTSYSAPI
2856 NTSTATUS
2857 NTAPI
2858 RtlDeleteCriticalSection (
2859 _In_ PRTL_CRITICAL_SECTION CriticalSection
2860 );
2861
2862 NTSYSAPI
2863 NTSTATUS
2864 NTAPI
2865 RtlEnterCriticalSection(
2866 _In_ PRTL_CRITICAL_SECTION CriticalSection
2867 );
2868
2869 NTSYSAPI
2870 NTSTATUS
2871 NTAPI
2872 RtlInitializeCriticalSection(
2873 _In_ PRTL_CRITICAL_SECTION CriticalSection
2874 );
2875
2876 NTSYSAPI
2877 NTSTATUS
2878 NTAPI
2879 RtlInitializeCriticalSectionAndSpinCount(
2880 _In_ PRTL_CRITICAL_SECTION CriticalSection,
2881 _In_ ULONG SpinCount
2882 );
2883
2884 NTSYSAPI
2885 NTSTATUS
2886 NTAPI
2887 RtlLeaveCriticalSection(
2888 _In_ PRTL_CRITICAL_SECTION CriticalSection
2889 );
2890
2891 NTSYSAPI
2892 BOOLEAN
2893 NTAPI
2894 RtlTryEnterCriticalSection(
2895 _In_ PRTL_CRITICAL_SECTION CriticalSection
2896 );
2897
2898 NTSYSAPI
2899 VOID
2900 NTAPI
2901 RtlpUnWaitCriticalSection(
2902 _In_ PRTL_CRITICAL_SECTION CriticalSection
2903 );
2904
2905 NTSYSAPI
2906 NTSTATUS
2907 NTAPI
2908 RtlpWaitForCriticalSection(
2909 _In_ PRTL_CRITICAL_SECTION CriticalSection
2910 );
2911
2912 NTSYSAPI
2913 BOOLEAN
2914 NTAPI
2915 RtlAcquireResourceExclusive(
2916 _In_ PRTL_RESOURCE Resource,
2917 _In_ BOOLEAN Wait
2918 );
2919
2920 NTSYSAPI
2921 BOOLEAN
2922 NTAPI
2923 RtlAcquireResourceShared(
2924 _In_ PRTL_RESOURCE Resource,
2925 _In_ BOOLEAN Wait
2926 );
2927
2928 NTSYSAPI
2929 VOID
2930 NTAPI
2931 RtlConvertExclusiveToShared(
2932 _In_ PRTL_RESOURCE Resource
2933 );
2934
2935 NTSYSAPI
2936 VOID
2937 NTAPI
2938 RtlConvertSharedToExclusive(
2939 _In_ PRTL_RESOURCE Resource
2940 );
2941
2942 NTSYSAPI
2943 VOID
2944 NTAPI
2945 RtlDeleteResource(
2946 _In_ PRTL_RESOURCE Resource
2947 );
2948
2949 NTSYSAPI
2950 VOID
2951 NTAPI
2952 RtlDumpResource(
2953 _In_ PRTL_RESOURCE Resource
2954 );
2955
2956 NTSYSAPI
2957 VOID
2958 NTAPI
2959 RtlInitializeResource(
2960 _In_ PRTL_RESOURCE Resource
2961 );
2962
2963 NTSYSAPI
2964 VOID
2965 NTAPI
2966 RtlReleaseResource(
2967 _In_ PRTL_RESOURCE Resource
2968 );
2969
2970 //
2971 // Compression Functions
2972 //
2973 NTSYSAPI //NT_RTL_COMPRESS_API
2974 NTSTATUS
2975 NTAPI
2976 RtlCompressBuffer(
2977 _In_ USHORT CompressionFormatAndEngine,
2978 _In_reads_bytes_(UncompressedBufferSize) PUCHAR UncompressedBuffer,
2979 _In_ ULONG UncompressedBufferSize,
2980 _Out_writes_bytes_to_(CompressedBufferSize, *FinalCompressedSize) PUCHAR CompressedBuffer,
2981 _In_ ULONG CompressedBufferSize,
2982 _In_ ULONG UncompressedChunkSize,
2983 _Out_ PULONG FinalCompressedSize,
2984 _In_ PVOID WorkSpace
2985 );
2986
2987 _IRQL_requires_max_(APC_LEVEL)
2988 NTSYSAPI //NT_RTL_COMPRESS_API
2989 NTSTATUS
2990 NTAPI
2991 RtlDecompressBuffer(
2992 _In_ USHORT CompressionFormat,
2993 _Out_writes_bytes_to_(UncompressedBufferSize, *FinalUncompressedSize) PUCHAR UncompressedBuffer,
2994 _In_ ULONG UncompressedBufferSize,
2995 _In_reads_bytes_(CompressedBufferSize) PUCHAR CompressedBuffer,
2996 _In_ ULONG CompressedBufferSize,
2997 _Out_ PULONG FinalUncompressedSize
2998 );
2999
3000 NTSYSAPI
3001 NTSTATUS
3002 NTAPI
3003 RtlGetCompressionWorkSpaceSize(
3004 _In_ USHORT CompressionFormatAndEngine,
3005 _Out_ PULONG CompressBufferWorkSpaceSize,
3006 _Out_ PULONG CompressFragmentWorkSpaceSize
3007 );
3008
3009 //
3010 // Frame Functions
3011 //
3012 NTSYSAPI
3013 VOID
3014 NTAPI
3015 RtlPopFrame(
3016 _In_ PTEB_ACTIVE_FRAME Frame
3017 );
3018
3019 NTSYSAPI
3020 VOID
3021 NTAPI
3022 RtlPushFrame(
3023 _In_ PTEB_ACTIVE_FRAME Frame
3024 );
3025
3026 NTSYSAPI
3027 PTEB_ACTIVE_FRAME
3028 NTAPI
3029 RtlGetFrame(
3030 VOID
3031 );
3032
3033 //
3034 // Debug Info Functions
3035 //
3036 NTSYSAPI
3037 PRTL_DEBUG_INFORMATION
3038 NTAPI
3039 RtlCreateQueryDebugBuffer(
3040 _In_ ULONG Size,
3041 _In_ BOOLEAN EventPair
3042 );
3043
3044 NTSYSAPI
3045 NTSTATUS
3046 NTAPI
3047 RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_INFORMATION DebugBuffer);
3048
3049 NTSYSAPI
3050 NTSTATUS
3051 NTAPI
3052 RtlQueryProcessDebugInformation(
3053 _In_ ULONG ProcessId,
3054 _In_ ULONG DebugInfoClassMask,
3055 _Inout_ PRTL_DEBUG_INFORMATION DebugBuffer
3056 );
3057
3058 //
3059 // Bitmap Functions
3060 //
3061 NTSYSAPI
3062 BOOLEAN
3063 NTAPI
3064 RtlAreBitsClear(
3065 _In_ PRTL_BITMAP BitMapHeader,
3066 _In_ ULONG StartingIndex,
3067 _In_ ULONG Length
3068 );
3069
3070 NTSYSAPI
3071 BOOLEAN
3072 NTAPI
3073 RtlAreBitsSet(
3074 _In_ PRTL_BITMAP BitMapHeader,
3075 _In_ ULONG StartingIndex,
3076 _In_ ULONG Length
3077 );
3078
3079 NTSYSAPI
3080 VOID
3081 NTAPI
3082 RtlClearAllBits(
3083 _In_ PRTL_BITMAP BitMapHeader
3084 );
3085
3086 NTSYSAPI
3087 VOID
3088 NTAPI
3089 RtlClearBits(
3090 _In_ PRTL_BITMAP BitMapHeader,
3091 _In_range_(0, BitMapHeader->SizeOfBitMap - NumberToClear) ULONG StartingIndex,
3092 _In_range_(0, BitMapHeader->SizeOfBitMap - StartingIndex) ULONG NumberToClear
3093 );
3094
3095 NTSYSAPI
3096 ULONG
3097 NTAPI
3098 RtlFindClearBits(
3099 _In_ PRTL_BITMAP BitMapHeader,
3100 _In_ ULONG NumberToFind,
3101 _In_ ULONG HintIndex
3102 );
3103
3104 NTSYSAPI
3105 ULONG
3106 NTAPI
3107 RtlFindClearBitsAndSet(
3108 _In_ PRTL_BITMAP BitMapHeader,
3109 _In_ ULONG NumberToFind,
3110 _In_ ULONG HintIndex
3111 );
3112
3113 NTSYSAPI
3114 ULONG
3115 NTAPI
3116 RtlFindFirstRunClear(
3117 _In_ PRTL_BITMAP BitMapHeader,
3118 _Out_ PULONG StartingIndex
3119 );
3120
3121 NTSYSAPI
3122 ULONG
3123 NTAPI
3124 RtlFindClearRuns(
3125 _In_ PRTL_BITMAP BitMapHeader,
3126 _Out_writes_to_(SizeOfRunArray, return) PRTL_BITMAP_RUN RunArray,
3127 _In_range_(>, 0) ULONG SizeOfRunArray,
3128 _In_ BOOLEAN LocateLongestRuns
3129 );
3130
3131 NTSYSAPI
3132 ULONG
3133 NTAPI
3134 RtlFindLastBackwardRunClear(
3135 _In_ PRTL_BITMAP BitMapHeader,
3136 _In_ ULONG FromIndex,
3137 _Out_ PULONG StartingRunIndex
3138 );
3139
3140 NTSYSAPI
3141 CCHAR
3142 NTAPI
3143 RtlFindLeastSignificantBit(
3144 _In_ ULONGLONG Value
3145 );
3146
3147 NTSYSAPI
3148 CCHAR
3149 NTAPI
3150 RtlFindMostSignificantBit(
3151 _In_ ULONGLONG Value
3152 );
3153
3154 NTSYSAPI
3155 ULONG
3156 NTAPI
3157 RtlFindNextForwardRunClear(
3158 _In_ PRTL_BITMAP BitMapHeader,
3159 _In_ ULONG FromIndex,
3160 _Out_ PULONG StartingRunIndex
3161 );
3162
3163 NTSYSAPI
3164 ULONG
3165 NTAPI
3166 RtlFindNextForwardRunSet(
3167 _In_ PRTL_BITMAP BitMapHeader,
3168 _In_ ULONG FromIndex,
3169 _Out_ PULONG StartingRunIndex
3170 );
3171
3172 NTSYSAPI
3173 ULONG
3174 NTAPI
3175 RtlFindSetBits(
3176 _In_ PRTL_BITMAP BitMapHeader,
3177 _In_ ULONG NumberToFind,
3178 _In_ ULONG HintIndex
3179 );
3180
3181 NTSYSAPI
3182 ULONG
3183 NTAPI
3184 RtlFindSetBitsAndClear(
3185 _In_ PRTL_BITMAP BitMapHeader,
3186 _In_ ULONG NumberToFind,
3187 _In_ ULONG HintIndex
3188 );
3189
3190 #ifdef _REACTOS_ // ReactOS improvement
3191 _At_(BitMapHeader->SizeOfBitMap, _Post_equal_to_(SizeOfBitMap))
3192 _At_(BitMapHeader->Buffer, _Post_equal_to_(BitMapBuffer))
3193 #endif
3194 NTSYSAPI
3195 VOID
3196 NTAPI
3197 RtlInitializeBitMap(
3198 _Out_ PRTL_BITMAP BitMapHeader,
3199 _In_opt_ __drv_aliasesMem PULONG BitMapBuffer,
3200 _In_opt_ ULONG SizeOfBitMap
3201 );
3202
3203 NTSYSAPI
3204 ULONG
3205 NTAPI
3206 RtlNumberOfClearBits(
3207 _In_ PRTL_BITMAP BitMapHeader
3208 );
3209
3210 NTSYSAPI
3211 ULONG
3212 NTAPI
3213 RtlNumberOfSetBits(
3214 _In_ PRTL_BITMAP BitMapHeader
3215 );
3216
3217 NTSYSAPI
3218 VOID
3219 NTAPI
3220 RtlSetBit(
3221 _In_ PRTL_BITMAP BitMapHeader,
3222 _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber
3223 );
3224
3225 NTSYSAPI
3226 VOID
3227 NTAPI
3228 RtlSetBits(
3229 _In_ PRTL_BITMAP BitMapHeader,
3230 _In_range_(0, BitMapHeader->SizeOfBitMap - NumberToSet) ULONG StartingIndex,
3231 _In_range_(0, BitMapHeader->SizeOfBitMap - StartingIndex) ULONG NumberToSet
3232 );
3233
3234 NTSYSAPI
3235 VOID
3236 NTAPI
3237 RtlSetAllBits(
3238 _In_ PRTL_BITMAP BitMapHeader
3239 );
3240
3241 _Must_inspect_result_
3242 NTSYSAPI
3243 BOOLEAN
3244 NTAPI
3245 RtlTestBit(
3246 _In_ PRTL_BITMAP BitMapHeader,
3247 _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber
3248 );
3249
3250 //
3251 // Timer Functions
3252 //
3253 NTSYSAPI
3254 NTSTATUS
3255 NTAPI
3256 RtlCreateTimer(
3257 _In_ HANDLE TimerQueue,
3258 _In_ PHANDLE phNewTimer,
3259 _In_ WAITORTIMERCALLBACKFUNC Callback,
3260 _In_ PVOID Parameter,
3261 _In_ ULONG DueTime,
3262 _In_ ULONG Period,
3263 _In_ ULONG Flags
3264 );
3265
3266 NTSYSAPI
3267 NTSTATUS
3268 NTAPI
3269 RtlCreateTimerQueue(PHANDLE TimerQueue);
3270
3271 NTSYSAPI
3272 NTSTATUS
3273 NTAPI
3274 RtlDeleteTimer(
3275 _In_ HANDLE TimerQueue,
3276 _In_ HANDLE Timer,
3277 _In_ HANDLE CompletionEvent
3278 );
3279
3280 NTSYSAPI
3281 NTSTATUS
3282 NTAPI
3283 RtlUpdateTimer(
3284 _In_ HANDLE TimerQueue,
3285 _In_ HANDLE Timer,
3286 _In_ ULONG DueTime,
3287 _In_ ULONG Period
3288 );
3289
3290 NTSYSAPI
3291 NTSTATUS
3292 NTAPI
3293 RtlDeleteTimerQueueEx(
3294 _In_ HANDLE TimerQueue,
3295 _In_opt_ HANDLE CompletionEvent
3296 );
3297
3298 NTSYSAPI
3299 NTSTATUS
3300 NTAPI
3301 RtlDeleteTimerQueue(HANDLE TimerQueue);
3302
3303 //
3304 // SList functions
3305 //
3306 PSLIST_ENTRY
3307 FASTCALL
3308 InterlockedPushListSList(
3309 _Inout_ PSLIST_HEADER ListHead,
3310 _Inout_ __drv_aliasesMem PSLIST_ENTRY List,
3311 _Inout_ PSLIST_ENTRY ListEnd,
3312 _In_ ULONG Count
3313 );
3314
3315 //
3316 // Range List functions
3317 //
3318 NTSYSAPI
3319 VOID
3320 NTAPI
3321 RtlInitializeRangeList(
3322 _Inout_ PRTL_RANGE_LIST RangeList
3323 );
3324
3325 NTSYSAPI
3326 VOID
3327 NTAPI
3328 RtlFreeRangeList(
3329 _In_ PRTL_RANGE_LIST RangeList
3330 );
3331
3332 NTSYSAPI
3333 NTSTATUS
3334 NTAPI
3335 RtlAddRange(
3336 _Inout_ PRTL_RANGE_LIST RangeList,
3337 _In_ ULONGLONG Start,
3338 _In_ ULONGLONG End,
3339 _In_ UCHAR Attributes,
3340 _In_ ULONG Flags,
3341 _In_opt_ PVOID UserData,
3342 _In_opt_ PVOID Owner
3343 );
3344
3345 //
3346 // Debug Functions
3347 //
3348 ULONG
3349 __cdecl
3350 DbgPrint(
3351 _In_z_ _Printf_format_string_ PCSTR Format,
3352 ...
3353 );
3354
3355 NTSYSAPI
3356 ULONG
3357 __cdecl
3358 DbgPrintEx(
3359 _In_ ULONG ComponentId,
3360 _In_ ULONG Level,
3361 _In_z_ _Printf_format_string_ PCSTR Format,
3362 ...
3363 );
3364
3365 NTSYSAPI
3366 ULONG
3367 NTAPI
3368 DbgPrompt(
3369 _In_z_ PCCH Prompt,
3370 _Out_writes_bytes_(MaximumResponseLength) PCH Response,
3371 _In_ ULONG MaximumResponseLength
3372 );
3373
3374 #undef DbgBreakPoint
3375 VOID
3376 NTAPI
3377 DbgBreakPoint(
3378 VOID
3379 );
3380
3381 VOID
3382 NTAPI
3383 DbgLoadImageSymbols(
3384 _In_ PSTRING Name,
3385 _In_ PVOID Base,
3386 _In_ ULONG_PTR ProcessId
3387 );
3388
3389 VOID
3390 NTAPI
3391 DbgUnLoadImageSymbols(
3392 _In_ PSTRING Name,
3393 _In_ PVOID Base,
3394 _In_ ULONG_PTR ProcessId
3395 );
3396
3397 VOID
3398 NTAPI
3399 DbgCommandString(
3400 _In_ PCCH Name,
3401 _In_ PCCH Command
3402 );
3403
3404 //
3405 // Generic Table Functions
3406 //
3407 #if defined(NTOS_MODE_USER) || defined(_NTIFS_)
3408 NTSYSAPI
3409 PVOID
3410 NTAPI
3411 RtlInsertElementGenericTable(
3412 _In_ PRTL_GENERIC_TABLE Table,
3413 _In_reads_bytes_(BufferSize) PVOID Buffer,
3414 _In_ CLONG BufferSize,
3415 _Out_opt_ PBOOLEAN NewElement
3416 );
3417
3418 NTSYSAPI
3419 PVOID
3420 NTAPI
3421 RtlInsertElementGenericTableFull(
3422 _In_ PRTL_GENERIC_TABLE Table,
3423 _In_reads_bytes_(BufferSize) PVOID Buffer,
3424 _In_ CLONG BufferSize,
3425 _Out_opt_ PBOOLEAN NewElement,
3426 _In_ PVOID NodeOrParent,
3427 _In_ TABLE_SEARCH_RESULT SearchResult
3428 );
3429
3430 NTSYSAPI
3431 BOOLEAN
3432 NTAPI
3433 RtlIsGenericTableEmpty(
3434 _In_ PRTL_GENERIC_TABLE Table
3435 );
3436
3437 NTSYSAPI
3438 PVOID
3439 NTAPI
3440 RtlLookupElementGenericTableFull(
3441 _In_ PRTL_GENERIC_TABLE Table,
3442 _In_ PVOID Buffer,
3443 _Out_ PVOID *NodeOrParent,
3444 _Out_ TABLE_SEARCH_RESULT *SearchResult
3445 );
3446 #endif
3447
3448 //
3449 // Handle Table Functions
3450 //
3451 NTSYSAPI
3452 PRTL_HANDLE_TABLE_ENTRY
3453 NTAPI
3454 RtlAllocateHandle(
3455 _In_ PRTL_HANDLE_TABLE HandleTable,
3456 _Inout_ PULONG Index
3457 );
3458
3459 NTSYSAPI
3460 VOID
3461 NTAPI
3462 RtlDestroyHandleTable(
3463 _Inout_ PRTL_HANDLE_TABLE HandleTable);
3464
3465 NTSYSAPI
3466 BOOLEAN
3467 NTAPI
3468 RtlFreeHandle(
3469 _In_ PRTL_HANDLE_TABLE HandleTable,
3470 _In_ PRTL_HANDLE_TABLE_ENTRY Handle
3471 );
3472
3473 NTSYSAPI
3474 VOID
3475 NTAPI
3476 RtlInitializeHandleTable(
3477 _In_ ULONG TableSize,
3478 _In_ ULONG HandleSize,
3479 _In_ PRTL_HANDLE_TABLE HandleTable
3480 );
3481
3482 NTSYSAPI
3483 BOOLEAN
3484 NTAPI
3485 RtlIsValidHandle(
3486 _In_ PRTL_HANDLE_TABLE HandleTable,
3487 _In_ PRTL_HANDLE_TABLE_ENTRY Handle
3488 );
3489
3490 _Success_(return!=FALSE)
3491 NTSYSAPI
3492 BOOLEAN
3493 NTAPI
3494 RtlIsValidIndexHandle(
3495 _In_ PRTL_HANDLE_TABLE HandleTable,
3496 _In_ ULONG Index,
3497 _Out_ PRTL_HANDLE_TABLE_ENTRY *Handle
3498 );
3499
3500 //
3501 // PE Functions
3502 //
3503 NTSYSAPI
3504 NTSTATUS
3505 NTAPI
3506 RtlFindMessage(
3507 _In_ PVOID BaseAddress,
3508 _In_ ULONG Type,
3509 _In_ ULONG Language,
3510 _In_ ULONG MessageId,
3511 _Out_ PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry
3512 );
3513
3514 NTSYSAPI
3515 ULONG
3516 NTAPI
3517 RtlGetNtGlobalFlags(VOID);
3518
3519 _Success_(return!=NULL)
3520 NTSYSAPI
3521 PVOID
3522 NTAPI
3523 RtlImageDirectoryEntryToData(
3524 _In_ PVOID BaseAddress,
3525 _In_ BOOLEAN MappedAsImage,
3526 _In_ USHORT Directory,
3527 _Out_ PULONG Size
3528 );
3529
3530 NTSYSAPI
3531 PVOID
3532 NTAPI
3533 RtlImageRvaToVa(
3534 _In_ PIMAGE_NT_HEADERS NtHeader,
3535 _In_ PVOID BaseAddress,
3536 _In_ ULONG Rva,
3537 _Inout_opt_ PIMAGE_SECTION_HEADER *SectionHeader
3538 );
3539
3540 NTSYSAPI
3541 PIMAGE_NT_HEADERS
3542 NTAPI
3543 RtlImageNtHeader(
3544 _In_ PVOID BaseAddress);
3545
3546 NTSYSAPI
3547 NTSTATUS
3548 NTAPI
3549 RtlImageNtHeaderEx(
3550 _In_ ULONG Flags,
3551 _In_ PVOID BaseAddress,
3552 _In_ ULONGLONG Size,
3553 _Out_ PIMAGE_NT_HEADERS *NtHeader
3554 );
3555
3556 NTSYSAPI
3557 PIMAGE_SECTION_HEADER
3558 NTAPI
3559 RtlImageRvaToSection(
3560 _In_ PIMAGE_NT_HEADERS NtHeader,
3561 _In_ PVOID BaseAddress,
3562 _In_ ULONG Rva
3563 );
3564
3565 NTSYSAPI
3566 ULONG
3567 NTAPI
3568 LdrRelocateImageWithBias(
3569 _In_ PVOID NewAddress,
3570 _In_ LONGLONG AdditionalBias,
3571 _In_ PCCH LoaderName,
3572 _In_ ULONG Success,
3573 _In_ ULONG Conflict,
3574 _In_ ULONG Invalid
3575 );
3576
3577 //
3578 // Activation Context Functions
3579 //
3580 #ifdef NTOS_MODE_USER
3581 NTSYSAPI
3582 NTSTATUS
3583 NTAPI
3584 RtlActivateActivationContextEx(
3585 _In_ ULONG Flags,
3586 _In_ PTEB Teb,
3587 _In_ PVOID Context,
3588 _Out_ PULONG_PTR Cookie
3589 );
3590
3591 NTSYSAPI
3592 NTSTATUS
3593 NTAPI
3594 RtlActivateActivationContext(
3595 _In_ ULONG Flags,
3596 _In_ HANDLE Handle,
3597 _Out_ PULONG_PTR Cookie
3598 );
3599
3600 NTSYSAPI
3601 VOID
3602 NTAPI
3603 RtlAddRefActivationContext(
3604 _In_ PVOID Context
3605 );
3606
3607 NTSYSAPI
3608 PRTL_ACTIVATION_CONTEXT_STACK_FRAME
3609 FASTCALL
3610 RtlActivateActivationContextUnsafeFast(
3611 _In_ PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame,
3612 _In_ PVOID Context
3613 );
3614
3615 NTSYSAPI
3616 NTSTATUS
3617 NTAPI
3618 RtlAllocateActivationContextStack(
3619 _In_ PACTIVATION_CONTEXT_STACK *Stack
3620 );
3621
3622 NTSYSAPI
3623 NTSTATUS
3624 NTAPI
3625 RtlCreateActivationContext(
3626 _In_ ULONG Flags,
3627 _In_ PACTIVATION_CONTEXT_DATA ActivationContextData,
3628 _In_ ULONG ExtraBytes,
3629 _In_ PVOID NotificationRoutine,
3630 _In_ PVOID NotificationContext,
3631 _Out_ PACTIVATION_CONTEXT *ActCtx
3632 );
3633
3634 NTSYSAPI
3635 NTSTATUS
3636 NTAPI
3637 RtlGetActiveActivationContext(
3638 _In_ PVOID *Context
3639 );
3640
3641 NTSYSAPI
3642 VOID
3643 NTAPI
3644 RtlReleaseActivationContext(
3645 _In_ HANDLE handle
3646 );
3647
3648 NTSYSAPI
3649 NTSTATUS
3650 NTAPI
3651 RtlDeactivateActivationContext(
3652 _In_ ULONG dwFlags,
3653 _In_ ULONG_PTR ulCookie
3654 );
3655
3656 NTSYSAPI
3657 VOID
3658 NTAPI
3659 RtlFreeActivationContextStack(
3660 _In_ PACTIVATION_CONTEXT_STACK Stack
3661 );
3662
3663 NTSYSAPI
3664 VOID
3665 NTAPI
3666 RtlFreeThreadActivationContextStack(VOID);
3667
3668 NTSYSAPI
3669 PRTL_ACTIVATION_CONTEXT_STACK_FRAME
3670 FASTCALL
3671 RtlDeactivateActivationContextUnsafeFast(
3672 _In_ PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame
3673 );
3674
3675 NTSYSAPI
3676 NTSTATUS
3677 NTAPI
3678 RtlDosApplyFileIsolationRedirection_Ustr(
3679 _In_ ULONG Flags,
3680 _In_ PUNICODE_STRING OriginalName,
3681 _In_ PUNICODE_STRING Extension,
3682 _Inout_ PUNICODE_STRING StaticString,
3683 _Inout_ PUNICODE_STRING DynamicString,
3684 _Inout_ PUNICODE_STRING *NewName,
3685 _In_ PULONG NewFlags,
3686 _In_ PSIZE_T FileNameSize,
3687 _In_ PSIZE_T RequiredLength
3688 );
3689
3690 NTSYSAPI
3691 NTSTATUS
3692 NTAPI
3693 RtlFindActivationContextSectionString(
3694 _In_ ULONG dwFlags,
3695 _In_ const GUID *ExtensionGuid,
3696 _In_ ULONG SectionType,
3697 _In_ const UNICODE_STRING *SectionName,
3698 _Inout_ PVOID ReturnedData
3699 );
3700
3701 NTSYSAPI
3702 NTSTATUS
3703 NTAPI
3704 RtlQueryInformationActivationContext(
3705 _In_ DWORD dwFlags,
3706 _In_opt_ PVOID Context,
3707 _In_opt_ PVOID pvSubInstance,
3708 _In_ ULONG ulInfoClass,
3709 _Out_bytecap_(cbBuffer) PVOID pvBuffer,
3710 _In_opt_ SIZE_T cbBuffer,
3711 _Out_opt_ SIZE_T *pcbWrittenOrRequired
3712 );
3713
3714 NTSYSAPI
3715 NTSTATUS
3716 NTAPI
3717 RtlQueryInformationActiveActivationContext(
3718 _In_ ULONG ulInfoClass,
3719 _Out_bytecap_(cbBuffer) PVOID pvBuffer,
3720 _In_opt_ SIZE_T cbBuffer,
3721 _Out_opt_ SIZE_T *pcbWrittenOrRequired
3722 );
3723
3724 NTSYSAPI
3725 NTSTATUS
3726 NTAPI
3727 RtlZombifyActivationContext(
3728 PVOID Context
3729 );
3730
3731 //
3732 // WOW64 Functions
3733 //
3734 NTSYSAPI
3735 NTSTATUS
3736 NTAPI
3737 RtlWow64EnableFsRedirection(
3738 _In_ BOOLEAN Wow64FsEnableRedirection
3739 );
3740
3741 NTSYSAPI
3742 NTSTATUS
3743 NTAPI
3744 RtlWow64EnableFsRedirectionEx(
3745 _In_ PVOID Wow64FsEnableRedirection,
3746 _Out_ PVOID *OldFsRedirectionLevel
3747 );
3748
3749 #endif
3750
3751 //
3752 // Registry Functions
3753 //
3754 _IRQL_requires_max_(PASSIVE_LEVEL)
3755 _Must_inspect_result_
3756 NTSYSAPI
3757 NTSTATUS
3758 NTAPI
3759 RtlCheckRegistryKey(
3760 _In_ ULONG RelativeTo,
3761 _In_ PWSTR Path
3762 );
3763
3764 NTSYSAPI
3765 NTSTATUS
3766 NTAPI
3767 RtlCreateRegistryKey(
3768 _In_ ULONG RelativeTo,
3769 _In_ PWSTR Path
3770 );
3771
3772 NTSYSAPI
3773 NTSTATUS
3774 NTAPI
3775 RtlFormatCurrentUserKeyPath(
3776 _Out_ _At_(KeyPath->Buffer, __drv_allocatesMem(Mem) _Post_bytecap_(KeyPath->MaximumLength) _Post_bytecount_(KeyPath->Length))
3777 PUNICODE_STRING KeyPath
3778 );
3779
3780 NTSYSAPI
3781 NTSTATUS
3782 NTAPI
3783 RtlOpenCurrentUser(
3784 _In_ ACCESS_MASK DesiredAccess,
3785 _Out_ PHANDLE KeyHandle
3786 );
3787
3788 _IRQL_requires_max_(PASSIVE_LEVEL)
3789 NTSYSAPI
3790 NTSTATUS
3791 NTAPI
3792 RtlQueryRegistryValues(
3793 _In_ ULONG RelativeTo,
3794 _In_ PCWSTR Path,
3795 _Inout_ _At_(*(*QueryTable).EntryContext, _Pre_unknown_)
3796 PRTL_QUERY_REGISTRY_TABLE QueryTable,
3797 _In_opt_ PVOID Context,
3798 _In_opt_ PVOID Environment
3799 );
3800
3801 _IRQL_requires_max_(PASSIVE_LEVEL)
3802 NTSYSAPI
3803 NTSTATUS
3804 NTAPI
3805 RtlWriteRegistryValue(
3806 _In_ ULONG RelativeTo,
3807 _In_ PCWSTR Path,
3808 _In_z_ PCWSTR ValueName,
3809 _In_ ULONG ValueType,
3810 _In_reads_bytes_opt_(ValueLength) PVOID ValueData,
3811 _In_ ULONG ValueLength
3812 );
3813
3814 #ifdef NTOS_MODE_USER
3815 NTSYSAPI
3816 NTSTATUS
3817 NTAPI
3818 RtlpNtCreateKey(
3819 _Out_ HANDLE KeyHandle,
3820 _In_ ACCESS_MASK DesiredAccess,
3821 _In_ POBJECT_ATTRIBUTES ObjectAttributes,
3822 _In_ ULONG TitleIndex,
3823 _In_ PUNICODE_STRING Class,
3824 _Out_ PULONG Disposition
3825 );
3826
3827 NTSYSAPI
3828 NTSTATUS
3829 NTAPI
3830 RtlpNtEnumerateSubKey(
3831 _In_ HANDLE KeyHandle,
3832 _Inout_ PUNICODE_STRING SubKeyName,
3833 _In_ ULONG Index,
3834 _In_ ULONG Unused
3835 );
3836
3837 NTSYSAPI
3838 NTSTATUS
3839 NTAPI
3840 RtlpNtMakeTemporaryKey(
3841 _In_ HANDLE KeyHandle
3842 );
3843
3844 NTSYSAPI
3845 NTSTATUS
3846 NTAPI
3847 RtlpNtOpenKey(
3848 _Out_ HANDLE KeyHandle,
3849 _In_ ACCESS_MASK DesiredAccess,
3850 _In_ POBJECT_ATTRIBUTES ObjectAttributes,
3851 _In_ ULONG Unused
3852 );
3853
3854 NTSYSAPI
3855 NTSTATUS
3856 NTAPI
3857 RtlpNtQueryValueKey(
3858 _In_ HANDLE KeyHandle,
3859 _Out_opt_ PULONG Type,
3860 _Out_opt_ PVOID Data,
3861 _Inout_opt_ PULONG DataLength,
3862 _In_ ULONG Unused
3863 );
3864
3865 NTSYSAPI
3866 NTSTATUS
3867 NTAPI
3868 RtlpNtSetValueKey(
3869 _In_ HANDLE KeyHandle,
3870 _In_ ULONG Type,
3871 _In_ PVOID Data,
3872 _In_ ULONG DataLength
3873 );
3874 #endif
3875
3876 //
3877 // NLS Functions
3878 //
3879 NTSYSAPI
3880 VOID
3881 NTAPI
3882 RtlGetDefaultCodePage(
3883 _Out_ PUSHORT AnsiCodePage,
3884 _Out_ PUSHORT OemCodePage
3885 );
3886
3887 NTSYSAPI
3888 VOID
3889 NTAPI
3890 RtlInitNlsTables(
3891 _In_ PUSHORT AnsiTableBase,
3892 _In_ PUSHORT OemTableBase,
3893 _In_ PUSHORT CaseTableBase,
3894 _Out_ PNLSTABLEINFO NlsTable
3895 );
3896
3897 _IRQL_requires_max_(PASSIVE_LEVEL)
3898 NTSYSAPI
3899 VOID
3900 NTAPI
3901 RtlInitCodePageTable(
3902 _In_ PUSHORT TableBase,
3903 _Out_ PCPTABLEINFO CodePageTable
3904 );
3905
3906 NTSYSAPI
3907 VOID
3908 NTAPI
3909 RtlResetRtlTranslations(
3910 _In_ PNLSTABLEINFO NlsTable);
3911
3912 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
3913
3914 //
3915 // Misc conversion functions
3916 //
3917 static __inline
3918 LARGE_INTEGER
3919 NTAPI_INLINE
3920 RtlConvertLongToLargeInteger(
3921 _In_ LONG SignedInteger
3922 )
3923 {
3924 LARGE_INTEGER Result;
3925
3926 Result.QuadPart = SignedInteger;
3927 return Result;
3928 }
3929
3930 static __inline
3931 LARGE_INTEGER
3932 NTAPI_INLINE
3933 RtlEnlargedIntegerMultiply(
3934 _In_ LONG Multiplicand,
3935 _In_ LONG Multiplier
3936 )
3937 {
3938 LARGE_INTEGER Product;
3939
3940 Product.QuadPart = (LONGLONG)Multiplicand * (ULONGLONG)Multiplier;
3941 return Product;
3942 }
3943
3944 static __inline
3945 ULONG
3946 NTAPI_INLINE
3947 RtlEnlargedUnsignedDivide(
3948 _In_ ULARGE_INTEGER Dividend,
3949 _In_ ULONG Divisor,
3950 _In_opt_ PULONG Remainder
3951 )
3952 {
3953 ULONG Quotient;
3954
3955 Quotient = (ULONG)(Dividend.QuadPart / Divisor);
3956 if (Remainder) {
3957 *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
3958 }
3959
3960 return Quotient;
3961 }
3962
3963 static __inline
3964 LARGE_INTEGER
3965 NTAPI_INLINE
3966 RtlEnlargedUnsignedMultiply(
3967 _In_ ULONG Multiplicand,
3968 _In_ ULONG Multiplier
3969 )
3970 {
3971 LARGE_INTEGER Product;
3972
3973 Product.QuadPart = (ULONGLONG)Multiplicand * (ULONGLONG)Multiplier;
3974 return Product;
3975 }
3976
3977 #if defined(_AMD64_) || defined(_IA64_)
3978 static __inline
3979 LARGE_INTEGER
3980 NTAPI_INLINE
3981 RtlExtendedLargeIntegerDivide(
3982 _In_ LARGE_INTEGER Dividend,
3983 _In_ ULONG Divisor,
3984 _Out_opt_ PULONG Remainder)
3985 {
3986 LARGE_INTEGER ret;
3987 ret.QuadPart = (ULONG64)Dividend.QuadPart / Divisor;
3988 if (Remainder)
3989 *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
3990 return ret;
3991 }
3992
3993 #else
3994 NTSYSAPI
3995 LARGE_INTEGER
3996 NTAPI
3997 RtlExtendedLargeIntegerDivide(
3998 _In_ LARGE_INTEGER Dividend,
3999 _In_ ULONG Divisor,
4000 _Out_opt_ PULONG Remainder
4001 );
4002
4003 #endif /* defined(_AMD64_) || defined(_IA64_) */
4004
4005 #endif
4006
4007
4008 NTSYSAPI
4009 ULONG
4010 NTAPI
4011 RtlUniform(
4012 _In_ PULONG Seed
4013 );
4014
4015 NTSYSAPI
4016 ULONG
4017 NTAPI
4018 RtlRandom(
4019 _Inout_ PULONG Seed
4020 );
4021
4022 NTSYSAPI
4023 ULONG
4024 NTAPI
4025 RtlComputeCrc32(
4026 _In_ ULONG InitialCrc,
4027 _In_ PUCHAR Buffer,
4028 _In_ ULONG Length
4029 );
4030
4031 //
4032 // Network Functions
4033 //
4034 NTSYSAPI
4035 PSTR
4036 NTAPI
4037 RtlIpv4AddressToStringA(
4038 _In_ const struct in_addr *Addr,
4039 _Out_writes_(16) PCHAR S
4040 );
4041
4042 NTSYSAPI
4043 PWSTR
4044 NTAPI
4045 RtlIpv4AddressToStringW(
4046 _In_ const struct in_addr *Addr,
4047 _Out_writes_(16) PWCHAR S
4048 );
4049
4050 NTSYSAPI
4051 NTSTATUS
4052 NTAPI
4053 RtlIpv4AddressToStringExA(
4054 _In_ const struct in_addr *Address,
4055 _In_ USHORT Port,
4056 _Out_writes_to_(*AddressStringLength, *AddressStringLength) PCHAR AddressString,
4057 _Inout_ PULONG AddressStringLength
4058 );
4059
4060 NTSTATUS
4061 NTAPI
4062 RtlIpv4AddressToStringExW(
4063 _In_ const struct in_addr *Address,
4064 _In_ USHORT Port,
4065 _Out_writes_to_(*AddressStringLength, *AddressStringLength) PWCHAR AddressString,
4066 _Inout_ PULONG AddressStringLength
4067 );
4068
4069 NTSYSAPI
4070 NTSTATUS
4071 NTAPI
4072 RtlIpv4StringToAddressA(
4073 _In_ PCSTR String,
4074 _In_ BOOLEAN Strict,
4075 _Out_ PCSTR *Terminator,
4076 _Out_ struct in_addr *Addr
4077 );
4078
4079 NTSYSAPI
4080 NTSTATUS
4081 NTAPI
4082 RtlIpv4StringToAddressW(
4083 _In_ PCWSTR String,
4084 _In_ BOOLEAN Strict,
4085 _Out_ PCWSTR *Terminator,
4086 _Out_ struct in_addr *Addr
4087 );
4088
4089 NTSYSAPI
4090 NTSTATUS
4091 NTAPI
4092 RtlIpv4StringToAddressExA(
4093 _In_ PCSTR AddressString,
4094 _In_ BOOLEAN Strict,
4095 _Out_ struct in_addr *Address,
4096 _Out_ PUSHORT Port
4097 );
4098
4099 NTSYSAPI
4100 NTSTATUS
4101 NTAPI
4102 RtlIpv4StringToAddressExW(
4103 _In_ PCWSTR AddressString,
4104 _In_ BOOLEAN Strict,
4105 _Out_ struct in_addr *Address,
4106 _Out_ PUSHORT Port
4107 );
4108
4109 NTSYSAPI
4110 PSTR
4111 NTAPI
4112 RtlIpv6AddressToStringA(
4113 _In_ const struct in6_addr *Addr,
4114 _Out_writes_(46) PSTR S
4115 );
4116
4117 NTSYSAPI
4118 PWSTR
4119 NTAPI
4120 RtlIpv6AddressToStringW(
4121 _In_ const struct in6_addr *Addr,
4122 _Out_writes_(46) PWSTR S
4123 );
4124
4125 NTSYSAPI
4126 NTSTATUS
4127 NTAPI
4128 RtlIpv6AddressToStringExA(
4129 _In_ const struct in6_addr *Address,
4130 _In_ ULONG ScopeId,
4131 _In_ USHORT Port,
4132 _Out_writes_to_(*AddressStringLength, *AddressStringLength) PSTR AddressString,
4133 _Inout_ PULONG AddressStringLength
4134 );
4135
4136 NTSYSAPI
4137 NTSTATUS
4138 NTAPI
4139 RtlIpv6AddressToStringExW(
4140 _In_ const struct in6_addr *Address,
4141 _In_ ULONG ScopeId,
4142 _In_ USHORT Port,
4143 _Out_writes_to_(*AddressStringLength, *AddressStringLength) PWCHAR AddressString,
4144 _Inout_ PULONG AddressStringLength
4145 );
4146
4147 NTSYSAPI
4148 NTSTATUS
4149 NTAPI
4150 RtlIpv6StringToAddressA(
4151 _In_ PCSTR String,
4152 _Out_ PCSTR *Terminator,
4153 _Out_ struct in6_addr *Addr
4154 );
4155
4156 NTSYSAPI
4157 NTSTATUS
4158 NTAPI
4159 RtlIpv6StringToAddressW(
4160 _In_ PCWSTR String,
4161 _Out_ PCWSTR *Terminator,
4162 _Out_ struct in6_addr *Addr
4163 );
4164
4165 NTSYSAPI
4166 NTSTATUS
4167 NTAPI
4168 RtlIpv6StringToAddressExA(
4169 _In_ PCSTR AddressString,
4170 _Out_ struct in6_addr *Address,
4171 _Out_ PULONG ScopeId,
4172 _Out_ PUSHORT Port
4173 );
4174
4175 NTSYSAPI
4176 NTSTATUS
4177 NTAPI
4178 RtlIpv6StringToAddressExW(
4179 _In_ PCWSTR AddressString,
4180 _Out_ struct in6_addr *Address,
4181 _Out_ PULONG ScopeId,
4182 _Out_ PUSHORT Port
4183 );
4184
4185
4186 //
4187 // Time Functions
4188 //
4189 NTSYSAPI
4190 NTSTATUS
4191 NTAPI
4192 RtlQueryTimeZoneInformation(
4193 _Out_ PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
4194
4195 NTSYSAPI
4196 VOID
4197 NTAPI
4198 RtlSecondsSince1970ToTime(
4199 _In_ ULONG SecondsSince1970,
4200 _Out_ PLARGE_INTEGER Time
4201 );
4202
4203 NTSYSAPI
4204 NTSTATUS
4205 NTAPI
4206 RtlSetTimeZoneInformation(
4207 _In_ PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
4208
4209 _Success_(return!=FALSE)
4210 _Must_inspect_result_
4211 NTSYSAPI
4212 BOOLEAN
4213 NTAPI
4214 RtlTimeFieldsToTime(
4215 _In_ PTIME_FIELDS TimeFields,
4216 _Out_ PLARGE_INTEGER Time
4217 );
4218
4219 _Success_(return != 0)
4220 _Must_inspect_result_
4221 NTSYSAPI
4222 BOOLEAN
4223 NTAPI
4224 RtlTimeToSecondsSince1970(
4225 _In_ PLARGE_INTEGER Time,
4226 _Out_ PULONG ElapsedSeconds
4227 );
4228
4229 NTSYSAPI
4230 VOID
4231 NTAPI
4232 RtlTimeToTimeFields(
4233 PLARGE_INTEGER Time,
4234 PTIME_FIELDS TimeFields
4235 );
4236
4237 NTSYSAPI
4238 NTSTATUS
4239 NTAPI
4240 RtlSystemTimeToLocalTime(
4241 _In_ PLARGE_INTEGER SystemTime,
4242 _Out_ PLARGE_INTEGER LocalTime
4243 );
4244
4245 //
4246 // Version Functions
4247 //
4248 _IRQL_requires_max_(PASSIVE_LEVEL)
4249 _Must_inspect_result_
4250 NTSYSAPI
4251 NTSTATUS
4252 NTAPI
4253 RtlVerifyVersionInfo(
4254 _In_ PRTL_OSVERSIONINFOEXW VersionInfo,
4255 _In_ ULONG TypeMask,
4256 _In_ ULONGLONG ConditionMask
4257 );
4258
4259 _IRQL_requires_max_(PASSIVE_LEVEL)
4260 NTSYSAPI
4261 NTSTATUS
4262 NTAPI
4263 RtlGetVersion(
4264 _Out_
4265 _At_(lpVersionInformation->dwOSVersionInfoSize, _Pre_ _Valid_)
4266 _When_(lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW),
4267 _At_((PRTL_OSVERSIONINFOEXW)lpVersionInformation, _Out_))
4268 PRTL_OSVERSIONINFOW lpVersionInformation
4269 );
4270
4271 NTSYSAPI
4272 BOOLEAN
4273 NTAPI
4274 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType);
4275
4276 //
4277 // Secure Memory Functions
4278 //
4279 #ifdef NTOS_MODE_USER
4280 NTSYSAPI
4281 NTSTATUS
4282 NTAPI
4283 RtlRegisterSecureMemoryCacheCallback(
4284 _In_ PRTL_SECURE_MEMORY_CACHE_CALLBACK Callback);
4285
4286 NTSYSAPI
4287 BOOLEAN
4288 NTAPI
4289 RtlFlushSecureMemoryCache(
4290 _In_ PVOID MemoryCache,
4291 _In_opt_ SIZE_T MemoryLength
4292 );
4293 #endif
4294
4295 //
4296 // Boot Status Data Functions
4297 //
4298 #ifdef NTOS_MODE_USER
4299 NTSYSAPI
4300 NTSTATUS
4301 NTAPI
4302 RtlCreateBootStatusDataFile(
4303 VOID
4304 );
4305
4306 NTSYSAPI
4307 NTSTATUS
4308 NTAPI
4309 RtlGetSetBootStatusData(
4310 _In_ HANDLE FileHandle,
4311 _In_ BOOLEAN WriteMode,
4312 _In_ RTL_BSD_ITEM_TYPE DataClass,
4313 _In_ PVOID Buffer,
4314 _In_ ULONG BufferSize,
4315 _Out_opt_ PULONG ReturnLength
4316 );
4317
4318 NTSYSAPI
4319 NTSTATUS
4320 NTAPI
4321 RtlLockBootStatusData(
4322 _Out_ PHANDLE FileHandle
4323 );
4324
4325 NTSYSAPI
4326 NTSTATUS
4327 NTAPI
4328 RtlUnlockBootStatusData(
4329 _In_ HANDLE FileHandle
4330 );
4331 #endif
4332
4333 #ifdef NTOS_MODE_USER
4334 _Must_inspect_result_
4335 NTSYSAPI
4336 NTSTATUS
4337 NTAPI
4338 RtlGUIDFromString(
4339 _In_ PUNICODE_STRING GuidString,
4340 _Out_ GUID *Guid);
4341
4342 _Must_inspect_result_
4343 NTSYSAPI
4344 NTSTATUS
4345 NTAPI
4346 RtlStringFromGUID(
4347 _In_ REFGUID Guid,
4348 _Out_ _At_(GuidString->Buffer, __drv_allocatesMem(Mem))
4349 PUNICODE_STRING GuidString);
4350
4351 NTSYSAPI
4352 NTSTATUS
4353 NTAPI
4354 RtlComputeImportTableHash(
4355 _In_ HANDLE hFile,
4356 _Out_ PCHAR Hash,
4357 _In_ ULONG ImportTableHashRevision
4358 );
4359 #endif
4360
4361 //
4362 // MemoryStream functions
4363 //
4364 #ifdef NTOS_MODE_USER
4365
4366 NTSYSAPI
4367 VOID
4368 NTAPI
4369 RtlInitMemoryStream(
4370 _Out_ PRTL_MEMORY_STREAM Stream
4371 );
4372
4373 NTSYSAPI
4374 VOID
4375 NTAPI
4376 RtlInitOutOfProcessMemoryStream(
4377 _Out_ PRTL_MEMORY_STREAM Stream
4378 );
4379
4380 NTSYSAPI
4381 VOID
4382 NTAPI
4383 RtlFinalReleaseOutOfProcessMemoryStream(
4384 _In_ PRTL_MEMORY_STREAM Stream
4385 );
4386
4387 NTSYSAPI
4388 HRESULT
4389 NTAPI
4390 RtlQueryInterfaceMemoryStream(
4391 _In_ struct IStream *This,
4392 _In_ REFIID RequestedIid,
4393 _Outptr_ PVOID *ResultObject
4394 );
4395
4396 NTSYSAPI
4397 ULONG
4398 NTAPI
4399 RtlAddRefMemoryStream(
4400 _In_ struct IStream *This
4401 );
4402
4403 NTSYSAPI
4404 ULONG
4405 NTAPI
4406 RtlReleaseMemoryStream(
4407 _In_ struct IStream *This
4408 );
4409
4410 NTSYSAPI
4411 HRESULT
4412 NTAPI
4413 RtlReadMemoryStream(
4414 _In_ struct IStream *This,
4415 _Out_writes_bytes_(Length) PVOID Buffer,
4416 _In_ ULONG Length,
4417 _Out_opt_ PULONG BytesRead
4418 );
4419
4420 NTSYSAPI
4421 HRESULT
4422 NTAPI
4423 RtlReadOutOfProcessMemoryStream(
4424 _In_ struct IStream *This,
4425 _Out_writes_bytes_(Length) PVOID Buffer,
4426 _In_ ULONG Length,
4427 _Out_opt_ PULONG BytesRead
4428 );
4429
4430 NTSYSAPI
4431 HRESULT
4432 NTAPI
4433 RtlSeekMemoryStream(
4434 _In_ struct IStream *This,
4435 _In_ LARGE_INTEGER RelativeOffset,
4436 _In_ ULONG Origin,
4437 _Out_opt_ PULARGE_INTEGER ResultOffset
4438 );
4439
4440 NTSYSAPI
4441 HRESULT
4442 NTAPI
4443 RtlCopyMemoryStreamTo(
4444 _In_ struct IStream *This,
4445 _In_ struct IStream *Target,
4446 _In_ ULARGE_INTEGER Length,
4447 _Out_opt_ PULARGE_INTEGER BytesRead,
4448 _Out_opt_ PULARGE_INTEGER BytesWritten
4449 );
4450
4451 NTSYSAPI
4452 HRESULT
4453 NTAPI
4454 RtlCopyOutOfProcessMemoryStreamTo(
4455 _In_ struct IStream *This,
4456 _In_ struct IStream *Target,
4457 _In_ ULARGE_INTEGER Length,
4458 _Out_opt_ PULARGE_INTEGER BytesRead,
4459 _Out_opt_ PULARGE_INTEGER BytesWritten
4460 );
4461
4462 NTSYSAPI
4463 HRESULT
4464 NTAPI
4465 RtlStatMemoryStream(
4466 _In_ struct IStream *This,
4467 _Out_ struct tagSTATSTG *Stats,
4468 _In_ ULONG Flags
4469 );
4470
4471 // Dummy functions
4472 NTSYSAPI
4473 HRESULT
4474 NTAPI
4475 RtlWriteMemoryStream(
4476 _In_ struct IStream *This,
4477 _In_reads_bytes_(Length) CONST VOID *Buffer,
4478 _In_ ULONG Length,
4479 _Out_opt_ PULONG BytesWritten
4480 );
4481
4482 NTSYSAPI
4483 HRESULT
4484 NTAPI
4485 RtlSetMemoryStreamSize(
4486 _In_ struct IStream *This,
4487 _In_ ULARGE_INTEGER NewSize
4488 );
4489
4490 NTSYSAPI
4491 HRESULT
4492 NTAPI
4493 RtlCommitMemoryStream(
4494 _In_ struct IStream *This,
4495 _In_ ULONG CommitFlags
4496 );
4497
4498 NTSYSAPI
4499 HRESULT
4500 NTAPI
4501 RtlRevertMemoryStream(
4502 _In_ struct IStream *This
4503 );
4504
4505 NTSYSAPI
4506 HRESULT
4507 NTAPI
4508 RtlLockMemoryStreamRegion(
4509 _In_ struct IStream *This,
4510 _In_ ULARGE_INTEGER Offset,
4511 _In_ ULARGE_INTEGER Length,
4512 _In_ ULONG LockType
4513 );
4514
4515 NTSYSAPI
4516 HRESULT
4517 NTAPI
4518 RtlUnlockMemoryStreamRegion(
4519 _In_ struct IStream *This,
4520 _In_ ULARGE_INTEGER Offset,
4521 _In_ ULARGE_INTEGER Length,
4522 _In_ ULONG LockType
4523 );
4524
4525 NTSYSAPI
4526 HRESULT
4527 NTAPI
4528 RtlCloneMemoryStream(
4529 _In_ struct IStream *This,
4530 _Outptr_ struct IStream **ResultStream
4531 );
4532
4533 #endif // NTOS_MODE_USER
4534
4535 NTSYSAPI
4536 NTSTATUS
4537 NTAPI
4538 RtlFindActivationContextSectionGuid(
4539 ULONG flags,
4540 const GUID *extguid,
4541 ULONG section_kind,
4542 const GUID *guid,
4543 void *ptr
4544 );
4545
4546 #ifdef __cplusplus
4547 }
4548 #endif
4549
4550 #endif