- Update NDK with proper (when possible) RTL structure names that were previously...
[reactos.git] / reactos / include / ndk / rtlfuncs.h
1 /*
2 * PROJECT: ReactOS Native Headers
3 * FILE: include/ndk/rtlfuncs.h
4 * PURPOSE: Prototypes for Runtime Library Functions not defined in DDK/IFS
5 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
6 * UPDATE HISTORY:
7 * Created 06/10/04
8 */
9 #ifndef _RTLFUNCS_H
10 #define _RTLFUNCS_H
11
12 /* DEPENDENCIES **************************************************************/
13 #include <ntnls.h>
14 #include "extypes.h"
15 #include "rtltypes.h"
16
17 /* MACROS ********************************************************************/
18
19 /* FIXME: Eventually move the ones in rtltypes.h here... */
20
21 /*
22 * Splay Tree Macros
23 */
24 #define RtlIsLeftChild(Links) \
25 (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
26
27 #define RtlIsRightChild(Links) \
28 (RtlRightChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
29
30 #define RtlRightChild(Links) \
31 ((PRTL_SPLAY_LINKS)(Links))->RightChild
32
33 #define RtlIsRoot(Links) \
34 (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
35
36 #define RtlLeftChild(Links) \
37 ((PRTL_SPLAY_LINKS)(Links))->LeftChild
38
39 #define RtlParent(Links) \
40 ((PRTL_SPLAY_LINKS)(Links))->Parent
41
42 #define RtlInitializeSplayLinks(Links) \
43 { \
44 PRTL_SPLAY_LINKS _SplayLinks; \
45 _SplayLinks = (PRTL_SPLAY_LINKS)(Links); \
46 _SplayLinks->Parent = _SplayLinks; \
47 _SplayLinks->LeftChild = NULL; \
48 _SplayLinks->RightChild = NULL; \
49 }
50
51 #define RtlInsertAsLeftChild(ParentLinks,ChildLinks) \
52 { \
53 PRTL_SPLAY_LINKS _SplayParent; \
54 PRTL_SPLAY_LINKS _SplayChild; \
55 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
56 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
57 _SplayParent->LeftChild = _SplayChild; \
58 _SplayChild->Parent = _SplayParent; \
59 }
60
61 #define RtlInsertAsRightChild(ParentLinks,ChildLinks) \
62 { \
63 PRTL_SPLAY_LINKS _SplayParent; \
64 PRTL_SPLAY_LINKS _SplayChild; \
65 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
66 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
67 _SplayParent->RightChild = _SplayChild; \
68 _SplayChild->Parent = _SplayParent; \
69 }
70
71 /* PROTOTYPES ****************************************************************/
72
73 /*
74 * Splay Tree Functions
75 */
76 NTSYSAPI
77 PRTL_SPLAY_LINKS
78 NTAPI
79 RtlSplay(PRTL_SPLAY_LINKS Links);
80
81 NTSYSAPI
82 PRTL_SPLAY_LINKS
83 NTAPI
84 RtlDelete(PRTL_SPLAY_LINKS Links);
85
86 NTSYSAPI
87 VOID
88 NTAPI
89 RtlDeleteNoSplay(
90 PRTL_SPLAY_LINKS Links,
91 PRTL_SPLAY_LINKS *Root
92 );
93
94 NTSYSAPI
95 PRTL_SPLAY_LINKS
96 NTAPI
97 RtlSubtreeSuccessor(PRTL_SPLAY_LINKS Links);
98
99 NTSYSAPI
100 PRTL_SPLAY_LINKS
101 NTAPI
102 RtlSubtreePredecessor(PRTL_SPLAY_LINKS Links);
103
104 NTSYSAPI
105 PRTL_SPLAY_LINKS
106 NTAPI
107 RtlRealSuccessor(PRTL_SPLAY_LINKS Links);
108
109 NTSYSAPI
110 PRTL_SPLAY_LINKS
111 NTAPI
112 RtlRealPredecessor(PRTL_SPLAY_LINKS Links);
113
114 /*
115 * Error and Exception Functions
116 */
117 NTSYSAPI
118 PVOID
119 NTAPI
120 RtlAddVectoredExceptionHandler(
121 IN ULONG FirstHandler,
122 IN PVECTORED_EXCEPTION_HANDLER VectoredHandler
123 );
124
125 NTSYSAPI
126 VOID
127 NTAPI
128 RtlAssert(
129 PVOID FailedAssertion,
130 PVOID FileName,
131 ULONG LineNumber,
132 PCHAR Message
133 );
134
135 NTSYSAPI
136 VOID
137 NTAPI
138 RtlCaptureContext(OUT PCONTEXT ContextRecord);
139
140 NTSYSAPI
141 PVOID
142 NTAPI
143 RtlEncodePointer(IN PVOID Pointer);
144
145 NTSYSAPI
146 PVOID
147 NTAPI
148 RtlDecodePointer(IN PVOID Pointer);
149
150 NTSYSAPI
151 BOOLEAN
152 NTAPI
153 RtlDispatchException(
154 IN PEXCEPTION_RECORD ExceptionRecord,
155 IN PCONTEXT Context
156 );
157
158 NTSYSAPI
159 ULONG
160 NTAPI
161 RtlNtStatusToDosError(IN NTSTATUS Status);
162
163 NTSYSAPI
164 VOID
165 NTAPI
166 RtlRaiseException(IN PEXCEPTION_RECORD ExceptionRecord);
167
168 NTSYSAPI
169 VOID
170 NTAPI
171 RtlRaiseStatus(NTSTATUS Status);
172
173 NTSYSAPI
174 LONG
175 NTAPI
176 RtlUnhandledExceptionFilter(struct _EXCEPTION_POINTERS* ExceptionInfo);
177
178 NTSYSAPI
179 VOID
180 NTAPI
181 RtlUnwind(
182 IN PVOID TargetFrame OPTIONAL,
183 IN PVOID TargetIp OPTIONAL,
184 IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL,
185 IN PVOID ReturnValue
186 );
187
188 /*
189 * Heap Functions
190 */
191
192 NTSYSAPI
193 PVOID
194 NTAPI
195 RtlAllocateHeap(
196 IN HANDLE HeapHandle,
197 IN ULONG Flags,
198 IN ULONG Size
199 );
200
201 NTSYSAPI
202 PVOID
203 NTAPI
204 RtlCreateHeap(
205 IN ULONG Flags,
206 IN PVOID BaseAddress OPTIONAL,
207 IN SIZE_T SizeToReserve OPTIONAL,
208 IN SIZE_T SizeToCommit OPTIONAL,
209 IN PVOID Lock OPTIONAL,
210 IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
211 );
212
213 ULONG
214 NTAPI
215 RtlCompactHeap(
216 HANDLE heap,
217 ULONG flags
218 );
219
220 NTSYSAPI
221 HANDLE
222 NTAPI
223 RtlDestroyHeap(HANDLE hheap);
224
225 NTSYSAPI
226 BOOLEAN
227 NTAPI
228 RtlFreeHeap(
229 IN HANDLE HeapHandle,
230 IN ULONG Flags,
231 IN PVOID P
232 );
233
234 ULONG
235 NTAPI
236 RtlGetProcessHeaps(
237 ULONG HeapCount,
238 HANDLE *HeapArray
239 );
240
241 PVOID
242 NTAPI
243 RtlReAllocateHeap(
244 HANDLE Heap,
245 ULONG Flags,
246 PVOID Ptr,
247 ULONG Size
248 );
249
250 BOOLEAN
251 NTAPI
252 RtlLockHeap(IN HANDLE Heap);
253
254 BOOLEAN
255 NTAPI
256 RtlUnlockHeap(IN HANDLE Heap);
257
258 ULONG
259 NTAPI
260 RtlSizeHeap(
261 IN PVOID HeapHandle,
262 IN ULONG Flags,
263 IN PVOID MemoryPointer
264 );
265
266 BOOLEAN
267 NTAPI
268 RtlValidateHeap(
269 HANDLE Heap,
270 ULONG Flags,
271 PVOID pmem
272 );
273
274 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
275
276
277 /*
278 * Security Functions
279 */
280 NTSYSAPI
281 NTSTATUS
282 NTAPI
283 RtlAbsoluteToSelfRelativeSD(
284 IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
285 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor,
286 IN PULONG BufferLength
287 );
288
289 NTSYSAPI
290 NTSTATUS
291 NTAPI
292 RtlAddAccessAllowedAce(
293 PACL Acl,
294 ULONG Revision,
295 ACCESS_MASK AccessMask,
296 PSID Sid
297 );
298
299 NTSTATUS
300 NTAPI
301 RtlAddAccessAllowedAceEx(
302 IN OUT PACL pAcl,
303 IN ULONG dwAceRevision,
304 IN ULONG AceFlags,
305 IN ULONG AccessMask,
306 IN PSID pSid
307 );
308
309 NTSTATUS
310 NTAPI
311 RtlAddAccessDeniedAce(
312 PACL Acl,
313 ULONG Revision,
314 ACCESS_MASK AccessMask,
315 PSID Sid
316 );
317
318 NTSTATUS
319 NTAPI
320 RtlAddAccessDeniedAceEx(
321 IN OUT PACL Acl,
322 IN ULONG Revision,
323 IN ULONG Flags,
324 IN ACCESS_MASK AccessMask,
325 IN PSID Sid
326 );
327
328 NTSTATUS
329 NTAPI
330 RtlAddAuditAccessAceEx(
331 IN OUT PACL Acl,
332 IN ULONG Revision,
333 IN ULONG Flags,
334 IN ACCESS_MASK AccessMask,
335 IN PSID Sid,
336 IN BOOLEAN Success,
337 IN BOOLEAN Failure
338 );
339
340 NTSYSAPI
341 NTSTATUS
342 NTAPI
343 RtlAddAce(
344 PACL Acl,
345 ULONG AceRevision,
346 ULONG StartingAceIndex,
347 PVOID AceList,
348 ULONG AceListLength
349 );
350
351 NTSTATUS
352 NTAPI
353 RtlAddAuditAccessAce(
354 PACL Acl,
355 ULONG Revision,
356 ACCESS_MASK AccessMask,
357 PSID Sid,
358 BOOLEAN Success,
359 BOOLEAN Failure
360 );
361
362 NTSTATUS
363 NTAPI
364 RtlAdjustPrivilege(
365 IN ULONG Privilege,
366 IN BOOLEAN NewValue,
367 IN BOOLEAN ForThread,
368 OUT PBOOLEAN OldValue
369 );
370
371 NTSYSAPI
372 NTSTATUS
373 NTAPI
374 RtlAllocateAndInitializeSid(
375 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
376 IN UCHAR SubAuthorityCount,
377 IN ULONG SubAuthority0,
378 IN ULONG SubAuthority1,
379 IN ULONG SubAuthority2,
380 IN ULONG SubAuthority3,
381 IN ULONG SubAuthority4,
382 IN ULONG SubAuthority5,
383 IN ULONG SubAuthority6,
384 IN ULONG SubAuthority7,
385 OUT PSID *Sid
386 );
387
388 BOOLEAN
389 NTAPI
390 RtlAreAllAccessesGranted(
391 ACCESS_MASK GrantedAccess,
392 ACCESS_MASK DesiredAccess
393 );
394
395 BOOLEAN
396 NTAPI
397 RtlAreAnyAccessesGranted(
398 ACCESS_MASK GrantedAccess,
399 ACCESS_MASK DesiredAccess
400 );
401
402 NTSYSAPI
403 VOID
404 NTAPI
405 RtlCopyLuid(
406 IN PLUID LuidDest,
407 IN PLUID LuidSrc
408 );
409
410 VOID
411 NTAPI
412 RtlCopyLuidAndAttributesArray(
413 ULONG Count,
414 PLUID_AND_ATTRIBUTES Src,
415 PLUID_AND_ATTRIBUTES Dest
416 );
417
418 NTSTATUS
419 NTAPI
420 RtlCopySidAndAttributesArray(
421 ULONG Count,
422 PSID_AND_ATTRIBUTES Src,
423 ULONG SidAreaSize,
424 PSID_AND_ATTRIBUTES Dest,
425 PVOID SidArea,
426 PVOID* RemainingSidArea,
427 PULONG RemainingSidAreaSize
428 );
429
430 NTSTATUS
431 NTAPI
432 RtlConvertSidToUnicodeString(
433 OUT PUNICODE_STRING DestinationString,
434 IN PSID Sid,
435 IN BOOLEAN AllocateDestinationString
436 );
437
438 NTSYSAPI
439 NTSTATUS
440 NTAPI
441 RtlCopySid(
442 IN ULONG Length,
443 IN PSID Destination,
444 IN PSID Source
445 );
446
447 NTSYSAPI
448 NTSTATUS
449 NTAPI
450 RtlCreateAcl(
451 PACL Acl,
452 ULONG AclSize,
453 ULONG AclRevision
454 );
455
456 NTSYSAPI
457 NTSTATUS
458 NTAPI
459 RtlCreateSecurityDescriptor(
460 PSECURITY_DESCRIPTOR SecurityDescriptor,
461 ULONG Revision
462 );
463
464 NTSYSAPI
465 NTSTATUS
466 NTAPI
467 RtlCreateSecurityDescriptorRelative(
468 PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
469 ULONG Revision
470 );
471
472 NTSYSAPI
473 NTSTATUS
474 NTAPI
475 RtlDeleteAce(
476 PACL Acl,
477 ULONG AceIndex
478 );
479
480 NTSYSAPI
481 BOOLEAN
482 NTAPI
483 RtlEqualPrefixSid(
484 PSID Sid1,
485 PSID Sid2
486 );
487
488 NTSYSAPI
489 BOOLEAN
490 NTAPI
491 RtlEqualSid (
492 IN PSID Sid1,
493 IN PSID Sid2
494 );
495
496 BOOLEAN
497 NTAPI
498 RtlFirstFreeAce(
499 PACL Acl,
500 PACE* Ace
501 );
502
503 NTSYSAPI
504 PVOID
505 NTAPI
506 RtlFreeSid (
507 IN PSID Sid
508 );
509
510 NTSYSAPI
511 NTSTATUS
512 NTAPI
513 RtlGetAce(
514 PACL Acl,
515 ULONG AceIndex,
516 PVOID *Ace
517 );
518
519 NTSTATUS
520 NTAPI
521 RtlGetControlSecurityDescriptor(
522 PSECURITY_DESCRIPTOR SecurityDescriptor,
523 PSECURITY_DESCRIPTOR_CONTROL Control,
524 PULONG Revision
525 );
526
527 NTSYSAPI
528 NTSTATUS
529 NTAPI
530 RtlGetDaclSecurityDescriptor(
531 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
532 OUT PBOOLEAN DaclPresent,
533 OUT PACL *Dacl,
534 OUT PBOOLEAN DaclDefaulted
535 );
536
537 NTSYSAPI
538 NTSTATUS
539 NTAPI
540 RtlGetSaclSecurityDescriptor(
541 PSECURITY_DESCRIPTOR SecurityDescriptor,
542 PBOOLEAN SaclPresent,
543 PACL* Sacl,
544 PBOOLEAN SaclDefaulted
545 );
546
547 NTSYSAPI
548 NTSTATUS
549 NTAPI
550 RtlGetGroupSecurityDescriptor(
551 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
552 OUT PSID *Group,
553 OUT PBOOLEAN GroupDefaulted
554 );
555
556 NTSYSAPI
557 NTSTATUS
558 NTAPI
559 RtlGetOwnerSecurityDescriptor(
560 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
561 OUT PSID *Owner,
562 OUT PBOOLEAN OwnerDefaulted
563 );
564
565 NTSYSAPI
566 BOOLEAN
567 NTAPI
568 RtlGetSecurityDescriptorRMControl(
569 PSECURITY_DESCRIPTOR SecurityDescriptor,
570 PUCHAR RMControl
571 );
572
573 NTSYSAPI
574 PSID_IDENTIFIER_AUTHORITY
575 NTAPI
576 RtlIdentifierAuthoritySid(PSID Sid);
577
578 NTSYSAPI
579 NTSTATUS
580 NTAPI
581 RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel);
582
583 NTSYSAPI
584 NTSTATUS
585 NTAPI
586 RtlInitializeSid(
587 IN OUT PSID Sid,
588 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
589 IN UCHAR SubAuthorityCount
590 );
591
592 NTSYSAPI
593 ULONG
594 NTAPI
595 RtlLengthRequiredSid(IN ULONG SubAuthorityCount);
596
597 NTSYSAPI
598 ULONG
599 NTAPI
600 RtlLengthSid(IN PSID Sid);
601
602 NTSYSAPI
603 VOID
604 NTAPI
605 RtlMapGenericMask(
606 PACCESS_MASK AccessMask,
607 PGENERIC_MAPPING GenericMapping
608 );
609
610 NTSYSAPI
611 NTSTATUS
612 NTAPI
613 RtlQueryInformationAcl(
614 PACL Acl,
615 PVOID Information,
616 ULONG InformationLength,
617 ACL_INFORMATION_CLASS InformationClass
618 );
619
620 NTSYSAPI
621 NTSTATUS
622 NTAPI
623 RtlSelfRelativeToAbsoluteSD(
624 IN PSECURITY_DESCRIPTOR SelfRelativeSD,
625 OUT PSECURITY_DESCRIPTOR AbsoluteSD,
626 IN PULONG AbsoluteSDSize,
627 IN PACL Dacl,
628 IN PULONG DaclSize,
629 IN PACL Sacl,
630 IN PULONG SaclSize,
631 IN PSID Owner,
632 IN PULONG OwnerSize,
633 IN PSID PrimaryGroup,
634 IN PULONG PrimaryGroupSize
635 );
636
637 NTSYSAPI
638 NTSTATUS
639 NTAPI
640 RtlSelfRelativeToAbsoluteSD2(
641 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSD,
642 OUT PULONG BufferSize
643 );
644
645 NTSYSAPI
646 NTSTATUS
647 NTAPI
648 RtlSetControlSecurityDescriptor(
649 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
650 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
651 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
652 );
653
654 NTSYSAPI
655 NTSTATUS
656 NTAPI
657 RtlSetDaclSecurityDescriptor (
658 PSECURITY_DESCRIPTOR SecurityDescriptor,
659 BOOLEAN DaclPresent,
660 PACL Dacl,
661 BOOLEAN DaclDefaulted
662 );
663
664 NTSYSAPI
665 NTSTATUS
666 NTAPI
667 RtlSetGroupSecurityDescriptor(
668 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
669 IN PSID Group,
670 IN BOOLEAN GroupDefaulted
671 );
672
673 NTSYSAPI
674 NTSTATUS
675 NTAPI
676 RtlSetInformationAcl(
677 PACL Acl,
678 PVOID Information,
679 ULONG InformationLength,
680 ACL_INFORMATION_CLASS InformationClass
681 );
682
683 NTSYSAPI
684 NTSTATUS
685 NTAPI
686 RtlSetOwnerSecurityDescriptor(
687 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
688 IN PSID Owner,
689 IN BOOLEAN OwnerDefaulted
690 );
691
692 NTSYSAPI
693 NTSTATUS
694 NTAPI
695 RtlSetSaclSecurityDescriptor(
696 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
697 IN BOOLEAN SaclPresent,
698 IN PACL Sacl,
699 IN BOOLEAN SaclDefaulted
700 );
701
702 NTSYSAPI
703 VOID
704 NTAPI
705 RtlSetSecurityDescriptorRMControl(
706 PSECURITY_DESCRIPTOR SecurityDescriptor,
707 PUCHAR RMControl
708 );
709
710 NTSYSAPI
711 PUCHAR
712 NTAPI
713 RtlSubAuthorityCountSid(
714 IN PSID Sid
715 );
716
717 NTSYSAPI
718 PULONG
719 NTAPI
720 RtlSubAuthoritySid(
721 IN PSID Sid,
722 IN ULONG SubAuthority
723 );
724
725 NTSYSAPI
726 BOOLEAN
727 NTAPI
728 RtlValidRelativeSecurityDescriptor(
729 IN PSECURITY_DESCRIPTOR SecurityDescriptorInput,
730 IN ULONG SecurityDescriptorLength,
731 IN SECURITY_INFORMATION RequiredInformation
732 );
733
734 NTSYSAPI
735 BOOLEAN
736 NTAPI
737 RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor);
738
739 NTSYSAPI
740 BOOLEAN
741 NTAPI
742 RtlValidSid(IN PSID Sid);
743
744 NTSYSAPI
745 BOOLEAN
746 NTAPI
747 RtlValidAcl(PACL Acl);
748
749 NTSYSAPI
750 NTSTATUS
751 NTAPI
752 RtlDeleteSecurityObject(
753 IN PSECURITY_DESCRIPTOR *ObjectDescriptor
754 );
755
756 NTSYSAPI
757 NTSTATUS
758 NTAPI
759 RtlNewSecurityObject(
760 IN PSECURITY_DESCRIPTOR ParentDescriptor,
761 IN PSECURITY_DESCRIPTOR CreatorDescriptor,
762 OUT PSECURITY_DESCRIPTOR *NewDescriptor,
763 IN BOOLEAN IsDirectoryObject,
764 IN HANDLE Token,
765 IN PGENERIC_MAPPING GenericMapping
766 );
767
768 NTSYSAPI
769 NTSTATUS
770 NTAPI
771 RtlQuerySecurityObject(
772 IN PSECURITY_DESCRIPTOR ObjectDescriptor,
773 IN SECURITY_INFORMATION SecurityInformation,
774 OUT PSECURITY_DESCRIPTOR ResultantDescriptor,
775 IN ULONG DescriptorLength,
776 OUT PULONG ReturnLength
777 );
778
779 NTSYSAPI
780 NTSTATUS
781 NTAPI
782 RtlSetSecurityObject(
783 IN SECURITY_INFORMATION SecurityInformation,
784 IN PSECURITY_DESCRIPTOR ModificationDescriptor,
785 OUT PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
786 IN PGENERIC_MAPPING GenericMapping,
787 IN HANDLE Token
788 );
789
790 /*
791 * Single-Character Functions
792 */
793 NTSYSAPI
794 NTSTATUS
795 NTAPI
796 RtlLargeIntegerToChar(
797 IN PLARGE_INTEGER Value,
798 IN ULONG Base,
799 IN ULONG Length,
800 IN OUT PCHAR String
801 );
802
803 NTSYSAPI
804 CHAR
805 NTAPI
806 RtlUpperChar(CHAR Source);
807
808 NTSYSAPI
809 WCHAR
810 NTAPI
811 RtlUpcaseUnicodeChar(WCHAR Source);
812
813 NTSYSAPI
814 WCHAR
815 NTAPI
816 RtlDowncaseUnicodeChar(IN WCHAR Source);
817
818 NTSYSAPI
819 NTSTATUS
820 NTAPI
821 RtlIntegerToChar(
822 IN ULONG Value,
823 IN ULONG Base,
824 IN ULONG Length,
825 IN OUT PCHAR String
826 );
827
828 NTSYSAPI
829 NTSTATUS
830 NTAPI
831 RtlIntegerToUnicode(
832 IN ULONG Value,
833 IN ULONG Base OPTIONAL,
834 IN ULONG Length OPTIONAL,
835 IN OUT LPWSTR String
836 );
837
838 NTSYSAPI
839 NTSTATUS
840 NTAPI
841 RtlIntegerToUnicodeString(
842 IN ULONG Value,
843 IN ULONG Base,
844 IN OUT PUNICODE_STRING String
845 );
846
847 NTSYSAPI
848 NTSTATUS
849 NTAPI
850 RtlCharToInteger(
851 PCSZ String,
852 ULONG Base,
853 PULONG Value
854 );
855
856 #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || ((defined(_M_AMD64) || defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
857 unsigned short __cdecl _byteswap_ushort(unsigned short);
858 unsigned long __cdecl _byteswap_ulong (unsigned long);
859 unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
860 #pragma intrinsic(_byteswap_ushort)
861 #pragma intrinsic(_byteswap_ulong)
862 #pragma intrinsic(_byteswap_uint64)
863 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
864 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
865 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
866 #else
867
868 USHORT
869 FASTCALL
870 RtlUshortByteSwap(IN USHORT Source);
871
872 ULONG
873 FASTCALL
874 RtlUlongByteSwap(IN ULONG Source);
875
876 ULONGLONG
877 FASTCALL
878 RtlUlonglongByteSwap(IN ULONGLONG Source);
879
880 #endif
881
882 /*
883 * Unicode->Ansi String Functions
884 */
885 NTSYSAPI
886 ULONG
887 NTAPI
888 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString);
889
890 #ifdef NTOS_MODE_USER
891 #define RtlUnicodeStringToAnsiSize(STRING) ( \
892 NLS_MB_CODE_PAGE_TAG ? \
893 RtlxUnicodeStringToAnsiSize(STRING) : \
894 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
895 )
896 #endif
897
898 NTSYSAPI
899 NTSTATUS
900 NTAPI
901 RtlUnicodeStringToAnsiString(
902 PANSI_STRING DestinationString,
903 PCUNICODE_STRING SourceString,
904 BOOLEAN AllocateDestinationString
905 );
906
907 /*
908 * Unicode->OEM String Functions
909 */
910 NTSYSAPI
911 NTSTATUS
912 NTAPI
913 RtlUpcaseUnicodeStringToOemString(
914 POEM_STRING DestinationString,
915 PCUNICODE_STRING SourceString,
916 BOOLEAN AllocateDestinationString
917 );
918
919 NTSYSAPI
920 NTSTATUS
921 NTAPI
922 RtlUpcaseUnicodeStringToCountedOemString(
923 IN OUT POEM_STRING DestinationString,
924 IN PCUNICODE_STRING SourceString,
925 IN BOOLEAN AllocateDestinationString
926 );
927
928 NTSYSAPI
929 NTSTATUS
930 NTAPI
931 RtlUnicodeStringToOemString(
932 POEM_STRING DestinationString,
933 PCUNICODE_STRING SourceString,
934 BOOLEAN AllocateDestinationString
935 );
936
937 NTSYSAPI
938 NTSTATUS
939 NTAPI
940 RtlUpcaseUnicodeToOemN(
941 PCHAR OemString,
942 ULONG OemSize,
943 PULONG ResultSize,
944 PWCHAR UnicodeString,
945 ULONG UnicodeSize
946 );
947
948 NTSYSAPI
949 ULONG
950 NTAPI
951 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString);
952
953 #ifdef NTOS_MODE_USER
954 #define RtlUnicodeStringToOemSize(STRING) ( \
955 NLS_MB_OEM_CODE_PAGE_TAG ? \
956 RtlxUnicodeStringToOemSize(STRING) : \
957 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
958 )
959 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
960 (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
961 )
962 #endif
963
964 NTSYSAPI
965 NTSTATUS
966 NTAPI
967 RtlUnicodeToOemN(
968 PCHAR OemString,
969 ULONG OemSize,
970 PULONG ResultSize,
971 PWCHAR UnicodeString,
972 ULONG UnicodeSize
973 );
974
975 /*
976 * Unicode->MultiByte String Functions
977 */
978 NTSYSAPI
979 NTSTATUS
980 NTAPI
981 RtlUnicodeToMultiByteN(
982 PCHAR MbString,
983 ULONG MbSize,
984 PULONG ResultSize,
985 PWCHAR UnicodeString,
986 ULONG UnicodeSize
987 );
988
989 NTSYSAPI
990 NTSTATUS
991 NTAPI
992 RtlUpcaseUnicodeToMultiByteN(
993 PCHAR MbString,
994 ULONG MbSize,
995 PULONG ResultSize,
996 PWCHAR UnicodeString,
997 ULONG UnicodeSize
998 );
999
1000 NTSYSAPI
1001 NTSTATUS
1002 NTAPI
1003 RtlUnicodeToMultiByteSize(
1004 PULONG MbSize,
1005 PWCHAR UnicodeString,
1006 ULONG UnicodeSize
1007 );
1008
1009 NTSYSAPI
1010 ULONG
1011 NTAPI
1012 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString);
1013
1014 /*
1015 * OEM to Unicode Functions
1016 */
1017 #ifdef NTOS_MODE_USER
1018 #define RtlOemStringToUnicodeSize(STRING) ( \
1019 NLS_MB_OEM_CODE_PAGE_TAG ? \
1020 RtlxOemStringToUnicodeSize(STRING) : \
1021 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1022 )
1023 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
1024 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
1025 )
1026 #endif
1027
1028 NTSYSAPI
1029 NTSTATUS
1030 NTAPI
1031 RtlOemStringToUnicodeString(
1032 PUNICODE_STRING DestinationString,
1033 PCOEM_STRING SourceString,
1034 BOOLEAN AllocateDestinationString
1035 );
1036
1037 NTSYSAPI
1038 NTSTATUS
1039 NTAPI
1040 RtlOemToUnicodeN(
1041 PWSTR UnicodeString,
1042 ULONG MaxBytesInUnicodeString,
1043 PULONG BytesInUnicodeString,
1044 IN PCHAR OemString,
1045 ULONG BytesInOemString
1046 );
1047
1048 /*
1049 * Ansi->Unicode String Functions
1050 */
1051 NTSYSAPI
1052 ULONG
1053 NTAPI
1054 RtlxAnsiStringToUnicodeSize(
1055 PCANSI_STRING AnsiString
1056 );
1057
1058 NTSYSAPI
1059 NTSTATUS
1060 NTAPI
1061 RtlAnsiStringToUnicodeString(
1062 PUNICODE_STRING DestinationString,
1063 PCANSI_STRING SourceString,
1064 BOOLEAN AllocateDestinationString
1065 );
1066
1067 #ifdef NTOS_MODE_USER
1068 #define RtlAnsiStringToUnicodeSize(STRING) ( \
1069 NLS_MB_CODE_PAGE_TAG ? \
1070 RtlxAnsiStringToUnicodeSize(STRING) : \
1071 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1072 )
1073 #endif
1074
1075 NTSYSAPI
1076 BOOLEAN
1077 NTAPI
1078 RtlCreateUnicodeStringFromAsciiz(
1079 OUT PUNICODE_STRING Destination,
1080 IN PCSZ Source
1081 );
1082
1083 /*
1084 * Unicode String Functions
1085 */
1086 NTSYSAPI
1087 NTSTATUS
1088 NTAPI
1089 RtlAppendUnicodeToString(
1090 PUNICODE_STRING Destination,
1091 PCWSTR Source
1092 );
1093
1094 NTSYSAPI
1095 NTSTATUS
1096 NTAPI
1097 RtlAppendUnicodeStringToString(
1098 PUNICODE_STRING Destination,
1099 PCUNICODE_STRING Source
1100 );
1101
1102 NTSYSAPI
1103 LONG
1104 NTAPI
1105 RtlCompareUnicodeString(
1106 PCUNICODE_STRING String1,
1107 PCUNICODE_STRING String2,
1108 BOOLEAN CaseInsensitive
1109 );
1110
1111 NTSYSAPI
1112 VOID
1113 NTAPI
1114 RtlCopyUnicodeString(
1115 PUNICODE_STRING DestinationString,
1116 PCUNICODE_STRING SourceString
1117 );
1118
1119 NTSYSAPI
1120 BOOLEAN
1121 NTAPI
1122 RtlCreateUnicodeString(
1123 PUNICODE_STRING DestinationString,
1124 PCWSTR SourceString
1125 );
1126
1127 #ifdef NTOS_MODE_USER
1128 NTSYSAPI
1129 NTSTATUS
1130 NTAPI
1131 RtlDowncaseUnicodeString(
1132 IN OUT PUNICODE_STRING UniDest,
1133 IN PCUNICODE_STRING UniSource,
1134 IN BOOLEAN AllocateDestinationString
1135 );
1136 #endif
1137
1138 NTSYSAPI
1139 NTSTATUS
1140 NTAPI
1141 RtlDuplicateUnicodeString(
1142 IN ULONG Flags,
1143 IN PCUNICODE_STRING SourceString,
1144 OUT PUNICODE_STRING DestinationString
1145 );
1146
1147 NTSYSAPI
1148 BOOLEAN
1149 NTAPI
1150 RtlEqualUnicodeString(
1151 PCUNICODE_STRING String1,
1152 PCUNICODE_STRING String2,
1153 BOOLEAN CaseInsensitive
1154 );
1155
1156 NTSYSAPI
1157 VOID
1158 NTAPI
1159 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString);
1160
1161 NTSYSAPI
1162 NTSTATUS
1163 NTAPI
1164 RtlHashUnicodeString(
1165 IN CONST UNICODE_STRING *String,
1166 IN BOOLEAN CaseInSensitive,
1167 IN ULONG HashAlgorithm,
1168 OUT PULONG HashValue
1169 );
1170
1171 NTSYSAPI
1172 VOID
1173 NTAPI
1174 RtlInitUnicodeString(
1175 IN OUT PUNICODE_STRING DestinationString,
1176 IN PCWSTR SourceString);
1177
1178 NTSYSAPI
1179 ULONG
1180 NTAPI
1181 RtlIsTextUnicode(
1182 PVOID Buffer,
1183 ULONG Length,
1184 ULONG *Flags
1185 );
1186
1187 NTSYSAPI
1188 BOOLEAN
1189 NTAPI
1190 RtlPrefixString(
1191 PCANSI_STRING String1,
1192 PCANSI_STRING String2,
1193 BOOLEAN CaseInsensitive
1194 );
1195
1196 NTSYSAPI
1197 BOOLEAN
1198 NTAPI
1199 RtlPrefixUnicodeString(
1200 PCUNICODE_STRING String1,
1201 PCUNICODE_STRING String2,
1202 BOOLEAN CaseInsensitive
1203 );
1204
1205 NTSYSAPI
1206 NTSTATUS
1207 NTAPI
1208 RtlUpcaseUnicodeString(
1209 PUNICODE_STRING DestinationString,
1210 PCUNICODE_STRING SourceString,
1211 BOOLEAN AllocateDestinationString
1212 );
1213
1214 NTSYSAPI
1215 NTSTATUS
1216 NTAPI
1217 RtlUnicodeStringToInteger(
1218 PCUNICODE_STRING String,
1219 ULONG Base,
1220 PULONG Value
1221 );
1222
1223 /*
1224 * Ansi String Functions
1225 */
1226 NTSYSAPI
1227 VOID
1228 NTAPI
1229 RtlFreeAnsiString(IN PANSI_STRING AnsiString);
1230
1231 NTSYSAPI
1232 VOID
1233 NTAPI
1234 RtlInitAnsiString(
1235 PANSI_STRING DestinationString,
1236 PCSZ SourceString
1237 );
1238
1239 /*
1240 * OEM String Functions
1241 */
1242 NTSYSAPI
1243 VOID
1244 NTAPI
1245 RtlFreeOemString(IN POEM_STRING OemString);
1246
1247 /*
1248 * MultiByte->Unicode String Functions
1249 */
1250 NTSYSAPI
1251 NTSTATUS
1252 NTAPI
1253 RtlMultiByteToUnicodeN(
1254 PWCHAR UnicodeString,
1255 ULONG UnicodeSize,
1256 PULONG ResultSize,
1257 PCSTR MbString,
1258 ULONG MbSize
1259 );
1260
1261 NTSYSAPI
1262 NTSTATUS
1263 NTAPI
1264 RtlMultiByteToUnicodeSize(
1265 PULONG UnicodeSize,
1266 PCSTR MbString,
1267 ULONG MbSize
1268 );
1269
1270 /*
1271 * Atom Functions
1272 */
1273 NTSYSAPI
1274 NTSTATUS
1275 NTAPI
1276 RtlAddAtomToAtomTable(
1277 IN PRTL_ATOM_TABLE AtomTable,
1278 IN PWSTR AtomName,
1279 OUT PRTL_ATOM Atom
1280 );
1281
1282 NTSYSAPI
1283 NTSTATUS
1284 NTAPI
1285 RtlCreateAtomTable(
1286 IN ULONG TableSize,
1287 IN OUT PRTL_ATOM_TABLE *AtomTable
1288 );
1289
1290 NTSYSAPI
1291 NTSTATUS
1292 NTAPI
1293 RtlDeleteAtomFromAtomTable(
1294 IN PRTL_ATOM_TABLE AtomTable,
1295 IN RTL_ATOM Atom
1296 );
1297
1298 NTSYSAPI
1299 NTSTATUS
1300 NTAPI
1301 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable);
1302
1303 NTSYSAPI
1304 NTSTATUS
1305 NTAPI
1306 RtlQueryAtomInAtomTable(
1307 IN PRTL_ATOM_TABLE AtomTable,
1308 IN RTL_ATOM Atom,
1309 IN OUT PULONG RefCount OPTIONAL,
1310 IN OUT PULONG PinCount OPTIONAL,
1311 IN OUT PWSTR AtomName OPTIONAL,
1312 IN OUT PULONG NameLength OPTIONAL
1313 );
1314
1315 NTSYSAPI
1316 NTSTATUS
1317 NTAPI
1318 RtlPinAtomInAtomTable(
1319 IN PRTL_ATOM_TABLE AtomTable,
1320 IN RTL_ATOM Atom
1321 );
1322
1323 NTSYSAPI
1324 NTSTATUS
1325 NTAPI
1326 RtlLookupAtomInAtomTable(
1327 IN PRTL_ATOM_TABLE AtomTable,
1328 IN PWSTR AtomName,
1329 OUT PRTL_ATOM Atom
1330 );
1331
1332 /*
1333 * Memory Functions
1334 */
1335 NTSYSAPI
1336 VOID
1337 NTAPI
1338 RtlFillMemoryUlong(
1339 IN PVOID Destination,
1340 IN ULONG Length,
1341 IN ULONG Fill
1342 );
1343
1344 /*
1345 * Process Management Functions
1346 */
1347 NTSYSAPI
1348 VOID
1349 NTAPI
1350 RtlAcquirePebLock(VOID);
1351
1352 NTSYSAPI
1353 NTSTATUS
1354 NTAPI
1355 RtlCreateProcessParameters (
1356 OUT PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
1357 IN PUNICODE_STRING ImagePathName OPTIONAL,
1358 IN PUNICODE_STRING DllPath OPTIONAL,
1359 IN PUNICODE_STRING CurrentDirectory OPTIONAL,
1360 IN PUNICODE_STRING CommandLine OPTIONAL,
1361 IN PWSTR Environment OPTIONAL,
1362 IN PUNICODE_STRING WindowTitle OPTIONAL,
1363 IN PUNICODE_STRING DesktopInfo OPTIONAL,
1364 IN PUNICODE_STRING ShellInfo OPTIONAL,
1365 IN PUNICODE_STRING RuntimeInfo OPTIONAL
1366 );
1367
1368 NTSYSAPI
1369 NTSTATUS
1370 NTAPI
1371 RtlCreateUserProcess(
1372 IN PUNICODE_STRING ImageFileName,
1373 IN ULONG Attributes,
1374 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters,
1375 IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL,
1376 IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL,
1377 IN HANDLE ParentProcess OPTIONAL,
1378 IN BOOLEAN CurrentDirectory,
1379 IN HANDLE DebugPort OPTIONAL,
1380 IN HANDLE ExceptionPort OPTIONAL,
1381 OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
1382 );
1383
1384 NTSYSAPI
1385 NTSTATUS
1386 NTAPI
1387 RtlCreateUserThread(
1388 IN HANDLE ProcessHandle,
1389 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1390 IN BOOLEAN CreateSuspended,
1391 IN LONG StackZeroBits,
1392 IN ULONG StackReserve,
1393 IN ULONG StackCommit,
1394 IN PTHREAD_START_ROUTINE StartAddress,
1395 IN PVOID Parameter,
1396 IN OUT PHANDLE ThreadHandle,
1397 IN OUT PCLIENT_ID ClientId
1398 );
1399
1400 NTSYSAPI
1401 PRTL_USER_PROCESS_PARAMETERS
1402 NTAPI
1403 RtlDeNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
1404
1405 NTSYSAPI
1406 NTSTATUS
1407 NTAPI
1408 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
1409
1410 NTSYSAPI
1411 VOID
1412 NTAPI
1413 RtlExitUserThread(NTSTATUS Status);
1414
1415 NTSYSAPI
1416 VOID
1417 NTAPI
1418 RtlInitializeContext(
1419 IN HANDLE ProcessHandle,
1420 OUT PCONTEXT ThreadContext,
1421 IN PVOID ThreadStartParam OPTIONAL,
1422 IN PTHREAD_START_ROUTINE ThreadStartAddress,
1423 IN PINITIAL_TEB InitialTeb
1424 );
1425
1426 NTSYSAPI
1427 PRTL_USER_PROCESS_PARAMETERS
1428 NTAPI
1429 RtlNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
1430
1431 NTSYSAPI
1432 VOID
1433 NTAPI
1434 RtlReleasePebLock(VOID);
1435
1436 NTSYSAPI
1437 VOID
1438 NTAPI
1439 RtlSetProcessIsCritical(
1440 IN BOOLEAN NewValue,
1441 OUT PBOOLEAN OldValue OPTIONAL,
1442 IN BOOLEAN IsWinlogon
1443 );
1444
1445 /*
1446 * Environment/Path Functions
1447 */
1448 NTSYSAPI
1449 NTSTATUS
1450 NTAPI
1451 RtlCreateEnvironment(
1452 BOOLEAN Inherit,
1453 PWSTR *Environment
1454 );
1455
1456 NTSYSAPI
1457 VOID
1458 NTAPI
1459 RtlDestroyEnvironment(PWSTR Environment);
1460
1461 NTSYSAPI
1462 BOOLEAN
1463 NTAPI
1464 RtlDoesFileExists_U(PWSTR FileName);
1465
1466 NTSYSAPI
1467 ULONG
1468 NTAPI
1469 RtlDetermineDosPathNameType_U(PCWSTR Path);
1470
1471 NTSYSAPI
1472 ULONG
1473 NTAPI
1474 RtlDosSearchPath_U(
1475 WCHAR *sp,
1476 WCHAR *name,
1477 WCHAR *ext,
1478 ULONG buf_sz,
1479 WCHAR *buffer,
1480 WCHAR **shortname
1481 );
1482
1483 NTSYSAPI
1484 BOOLEAN
1485 NTAPI
1486 RtlDosPathNameToNtPathName_U(
1487 PWSTR DosName,
1488 PUNICODE_STRING NtName,
1489 PWSTR *ShortName,
1490 PCURDIR CurrentDirectory
1491 );
1492
1493 NTSYSAPI
1494 NTSTATUS
1495 NTAPI
1496 RtlExpandEnvironmentStrings_U(
1497 PWSTR Environment,
1498 PUNICODE_STRING Source,
1499 PUNICODE_STRING Destination,
1500 PULONG Length
1501 );
1502
1503 NTSYSAPI
1504 ULONG
1505 NTAPI
1506 RtlGetCurrentDirectory_U(
1507 ULONG MaximumLength,
1508 PWSTR Buffer
1509 );
1510
1511 NTSYSAPI
1512 ULONG
1513 NTAPI
1514 RtlGetFullPathName_U(
1515 const WCHAR *dosname,
1516 ULONG size,
1517 WCHAR *buf,
1518 WCHAR **shortname
1519 );
1520
1521 NTSYSAPI
1522 BOOLEAN
1523 NTAPI
1524 RtlIsNameLegalDOS8Dot3(
1525 IN PUNICODE_STRING UnicodeName,
1526 IN PANSI_STRING AnsiName,
1527 PBOOLEAN Unknown
1528 );
1529
1530 NTSYSAPI
1531 NTSTATUS
1532 NTAPI
1533 RtlQueryEnvironmentVariable_U(
1534 PWSTR Environment,
1535 PUNICODE_STRING Name,
1536 PUNICODE_STRING Value
1537 );
1538
1539 NTSYSAPI
1540 NTSTATUS
1541 NTAPI
1542 RtlSetCurrentDirectory_U(PUNICODE_STRING name);
1543
1544 NTSYSAPI
1545 NTSTATUS
1546 NTAPI
1547 RtlSetEnvironmentVariable(
1548 PWSTR *Environment,
1549 PUNICODE_STRING Name,
1550 PUNICODE_STRING Value
1551 );
1552
1553 /*
1554 * Critical Section/Resource Functions
1555 */
1556 NTSYSAPI
1557 NTSTATUS
1558 NTAPI
1559 RtlDeleteCriticalSection (
1560 IN PRTL_CRITICAL_SECTION CriticalSection
1561 );
1562
1563 NTSYSAPI
1564 NTSTATUS
1565 NTAPI
1566 RtlEnterCriticalSection(
1567 IN PRTL_CRITICAL_SECTION CriticalSection
1568 );
1569
1570 NTSYSAPI
1571 NTSTATUS
1572 NTAPI
1573 RtlInitializeCriticalSection(
1574 IN PRTL_CRITICAL_SECTION CriticalSection
1575 );
1576
1577 NTSYSAPI
1578 NTSTATUS
1579 NTAPI
1580 RtlInitializeCriticalSectionAndSpinCount(
1581 IN PRTL_CRITICAL_SECTION CriticalSection,
1582 IN ULONG SpinCount
1583 );
1584
1585 NTSYSAPI
1586 NTSTATUS
1587 NTAPI
1588 RtlLeaveCriticalSection(
1589 IN PRTL_CRITICAL_SECTION CriticalSection
1590 );
1591
1592 NTSYSAPI
1593 VOID
1594 NTAPI
1595 RtlpUnWaitCriticalSection(
1596 IN PRTL_CRITICAL_SECTION CriticalSection
1597 );
1598
1599 NTSYSAPI
1600 NTSTATUS
1601 NTAPI
1602 RtlpWaitForCriticalSection(
1603 IN PRTL_CRITICAL_SECTION CriticalSection
1604 );
1605
1606 NTSYSAPI
1607 BOOLEAN
1608 NTAPI
1609 RtlAcquireResourceExclusive(
1610 IN PRTL_RESOURCE Resource,
1611 IN BOOLEAN Wait
1612 );
1613
1614 NTSYSAPI
1615 BOOLEAN
1616 NTAPI
1617 RtlAcquireResourceShared(
1618 IN PRTL_RESOURCE Resource,
1619 IN BOOLEAN Wait
1620 );
1621
1622 NTSYSAPI
1623 VOID
1624 NTAPI
1625 RtlConvertExclusiveToShared(
1626 IN PRTL_RESOURCE Resource
1627 );
1628
1629 NTSYSAPI
1630 VOID
1631 NTAPI
1632 RtlConvertSharedToExclusive(
1633 IN PRTL_RESOURCE Resource
1634 );
1635
1636 NTSYSAPI
1637 VOID
1638 NTAPI
1639 RtlDeleteResource(
1640 IN PRTL_RESOURCE Resource
1641 );
1642
1643 NTSYSAPI
1644 VOID
1645 NTAPI
1646 RtlDumpResource(
1647 IN PRTL_RESOURCE Resource
1648 );
1649
1650 NTSYSAPI
1651 VOID
1652 NTAPI
1653 RtlInitializeResource(
1654 IN PRTL_RESOURCE Resource
1655 );
1656
1657 NTSYSAPI
1658 VOID
1659 NTAPI
1660 RtlReleaseResource(
1661 IN PRTL_RESOURCE Resource
1662 );
1663
1664 /*
1665 * Compression Functions
1666 */
1667 NTSYSAPI
1668 NTSTATUS
1669 NTAPI
1670 RtlCompressBuffer(
1671 IN USHORT CompressionFormatAndEngine,
1672 IN PUCHAR UncompressedBuffer,
1673 IN ULONG UncompressedBufferSize,
1674 OUT PUCHAR CompressedBuffer,
1675 IN ULONG CompressedBufferSize,
1676 IN ULONG UncompressedChunkSize,
1677 OUT PULONG FinalCompressedSize,
1678 IN PVOID WorkSpace
1679 );
1680
1681 NTSYSAPI
1682 NTSTATUS
1683 NTAPI
1684 RtlDecompressBuffer(
1685 IN USHORT CompressionFormat,
1686 OUT PUCHAR UncompressedBuffer,
1687 IN ULONG UncompressedBufferSize,
1688 IN PUCHAR CompressedBuffer,
1689 IN ULONG CompressedBufferSize,
1690 OUT PULONG FinalUncompressedSize
1691 );
1692
1693 NTSYSAPI
1694 NTSTATUS
1695 NTAPI
1696 RtlGetCompressionWorkSpaceSize(
1697 IN USHORT CompressionFormatAndEngine,
1698 OUT PULONG CompressBufferWorkSpaceSize,
1699 OUT PULONG CompressFragmentWorkSpaceSize
1700 );
1701
1702 /*
1703 * Debug Info Functions
1704 */
1705 NTSYSAPI
1706 PRTL_DEBUG_BUFFER
1707 NTAPI
1708 RtlCreateQueryDebugBuffer(
1709 IN ULONG Size,
1710 IN BOOLEAN EventPair
1711 );
1712
1713 NTSYSAPI
1714 NTSTATUS
1715 NTAPI
1716 RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_BUFFER DebugBuffer);
1717
1718 NTSYSAPI
1719 NTSTATUS
1720 NTAPI
1721 RtlQueryProcessDebugInformation(
1722 IN ULONG ProcessId,
1723 IN ULONG DebugInfoClassMask,
1724 IN OUT PRTL_DEBUG_BUFFER DebugBuffer
1725 );
1726
1727 /*
1728 * Bitmap Functions
1729 */
1730 NTSYSAPI
1731 BOOLEAN
1732 NTAPI
1733 RtlAreBitsClear(
1734 IN PRTL_BITMAP BitMapHeader,
1735 IN ULONG StartingIndex,
1736 IN ULONG Length
1737 );
1738
1739 NTSYSAPI
1740 BOOLEAN
1741 NTAPI
1742 RtlAreBitsSet(
1743 IN PRTL_BITMAP BitMapHeader,
1744 IN ULONG StartingIndex,
1745 IN ULONG Length
1746 );
1747
1748 NTSYSAPI
1749 VOID
1750 NTAPI
1751 RtlClearBits(
1752 IN PRTL_BITMAP BitMapHeader,
1753 IN ULONG StartingIndex,
1754 IN ULONG NumberToClear
1755 );
1756
1757 NTSYSAPI
1758 ULONG
1759 NTAPI
1760 RtlFindClearBits(
1761 IN PRTL_BITMAP BitMapHeader,
1762 IN ULONG NumberToFind,
1763 IN ULONG HintIndex
1764 );
1765
1766 NTSYSAPI
1767 ULONG
1768 NTAPI
1769 RtlFindClearBitsAndSet(
1770 IN PRTL_BITMAP BitMapHeader,
1771 IN ULONG NumberToFind,
1772 IN ULONG HintIndex
1773 );
1774
1775 NTSYSAPI
1776 VOID
1777 NTAPI
1778 RtlInitializeBitMap(
1779 IN PRTL_BITMAP BitMapHeader,
1780 IN PULONG BitMapBuffer,
1781 IN ULONG SizeOfBitMap
1782 );
1783
1784 NTSYSAPI
1785 VOID
1786 NTAPI
1787 RtlSetBits (
1788 IN PRTL_BITMAP BitMapHeader,
1789 IN ULONG StartingIndex,
1790 IN ULONG NumberToSet
1791 );
1792
1793 /*
1794 * Timer Functions
1795 */
1796 NTSYSAPI
1797 NTSTATUS
1798 NTAPI
1799 RtlCreateTimer(
1800 HANDLE TimerQueue,
1801 PHANDLE phNewTimer,
1802 WAITORTIMERCALLBACKFUNC Callback,
1803 PVOID Parameter,
1804 ULONG DueTime,
1805 ULONG Period,
1806 ULONG Flags
1807 );
1808
1809 NTSYSAPI
1810 NTSTATUS
1811 NTAPI
1812 RtlCreateTimerQueue(PHANDLE TimerQueue);
1813
1814 NTSYSAPI
1815 NTSTATUS
1816 NTAPI
1817 RtlDeleteTimer(
1818 HANDLE TimerQueue,
1819 HANDLE Timer,
1820 HANDLE CompletionEvent
1821 );
1822
1823 NTSYSAPI
1824 NTSTATUS
1825 NTAPI
1826 RtlUpdateTimer(
1827 HANDLE TimerQueue,
1828 HANDLE Timer,
1829 ULONG DueTime,
1830 ULONG Period
1831 );
1832
1833 NTSYSAPI
1834 NTSTATUS
1835 NTAPI
1836 RtlDeleteTimerQueueEx(
1837 HANDLE TimerQueue,
1838 HANDLE CompletionEvent
1839 );
1840
1841 NTSYSAPI
1842 NTSTATUS
1843 NTAPI
1844 RtlDeleteTimerQueue(HANDLE TimerQueue);
1845
1846 /*
1847 * Debug Functions
1848 */
1849 ULONG
1850 __cdecl
1851 DbgPrint(
1852 IN PCH Format,
1853 IN ...
1854 );
1855
1856 VOID
1857 NTAPI
1858 DbgBreakPoint(VOID);
1859
1860 /*
1861 * Handle Table Functions
1862 */
1863 NTSYSAPI
1864 PRTL_HANDLE_TABLE_ENTRY
1865 NTAPI
1866 RtlAllocateHandle(
1867 IN PRTL_HANDLE_TABLE HandleTable,
1868 IN OUT PULONG Index
1869 );
1870
1871 NTSYSAPI
1872 VOID
1873 NTAPI
1874 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable);
1875
1876 NTSYSAPI
1877 BOOLEAN
1878 NTAPI
1879 RtlFreeHandle(
1880 IN PRTL_HANDLE_TABLE HandleTable,
1881 IN PRTL_HANDLE_TABLE_ENTRY Handle
1882 );
1883
1884 NTSYSAPI
1885 VOID
1886 NTAPI
1887 RtlInitializeHandleTable(
1888 IN ULONG TableSize,
1889 IN ULONG HandleSize,
1890 IN PRTL_HANDLE_TABLE HandleTable
1891 );
1892
1893 NTSYSAPI
1894 BOOLEAN
1895 NTAPI
1896 RtlIsValidHandle(
1897 IN PRTL_HANDLE_TABLE HandleTable,
1898 IN PRTL_HANDLE_TABLE_ENTRY Handle
1899 );
1900
1901 NTSYSAPI
1902 BOOLEAN
1903 NTAPI
1904 RtlIsValidIndexHandle(
1905 IN PRTL_HANDLE_TABLE HandleTable,
1906 IN ULONG Index,
1907 OUT PRTL_HANDLE_TABLE_ENTRY *Handle
1908 );
1909
1910 /*
1911 * PE Functions
1912 */
1913 NTSYSAPI
1914 NTSTATUS
1915 NTAPI
1916 RtlFindMessage(
1917 IN PVOID BaseAddress,
1918 IN ULONG Type,
1919 IN ULONG Language,
1920 IN ULONG MessageId,
1921 OUT PRTL_MESSAGE_RESOURCE_ENTRY *MessageResourceEntry
1922 );
1923
1924 NTSYSAPI
1925 ULONG
1926 NTAPI
1927 RtlGetNtGlobalFlags(VOID);
1928
1929 NTSYSAPI
1930 PVOID
1931 NTAPI
1932 RtlImageDirectoryEntryToData(
1933 PVOID BaseAddress,
1934 BOOLEAN bFlag,
1935 ULONG Directory,
1936 PULONG Size
1937 );
1938
1939 NTSYSAPI
1940 ULONG
1941 NTAPI
1942 RtlImageRvaToVa(
1943 PIMAGE_NT_HEADERS NtHeader,
1944 PVOID BaseAddress,
1945 ULONG Rva,
1946 PIMAGE_SECTION_HEADER *SectionHeader
1947 );
1948
1949 NTSYSAPI
1950 PIMAGE_NT_HEADERS
1951 NTAPI
1952 RtlImageNtHeader(IN PVOID BaseAddress);
1953
1954 NTSYSAPI
1955 PIMAGE_SECTION_HEADER
1956 NTAPI
1957 RtlImageRvaToSection(
1958 PIMAGE_NT_HEADERS NtHeader,
1959 PVOID BaseAddress,
1960 ULONG Rva
1961 );
1962
1963 /*
1964 * Registry Functions
1965 */
1966 NTSYSAPI
1967 NTSTATUS
1968 NTAPI
1969 RtlCheckRegistryKey(
1970 ULONG RelativeTo,
1971 PWSTR Path
1972 );
1973
1974 NTSYSAPI
1975 NTSTATUS
1976 NTAPI
1977 RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath);
1978
1979 NTSYSAPI
1980 NTSTATUS
1981 NTAPI
1982 RtlpNtOpenKey(
1983 OUT HANDLE KeyHandle,
1984 IN ACCESS_MASK DesiredAccess,
1985 IN POBJECT_ATTRIBUTES ObjectAttributes,
1986 IN ULONG Unused
1987 );
1988
1989 NTSYSAPI
1990 NTSTATUS
1991 NTAPI
1992 RtlOpenCurrentUser(
1993 IN ACCESS_MASK DesiredAccess,
1994 OUT PHANDLE KeyHandle
1995 );
1996
1997 NTSYSAPI
1998 NTSTATUS
1999 NTAPI
2000 RtlQueryRegistryValues(
2001 IN ULONG RelativeTo,
2002 IN PCWSTR Path,
2003 IN PRTL_QUERY_REGISTRY_TABLE QueryTable,
2004 IN PVOID Context,
2005 IN PVOID Environment
2006 );
2007
2008 NTSYSAPI
2009 NTSTATUS
2010 NTAPI
2011 RtlWriteRegistryValue(
2012 ULONG RelativeTo,
2013 PCWSTR Path,
2014 PCWSTR ValueName,
2015 ULONG ValueType,
2016 PVOID ValueData,
2017 ULONG ValueLength
2018 );
2019
2020 /*
2021 * NLS Functions
2022 */
2023 NTSYSAPI
2024 VOID
2025 NTAPI
2026 RtlInitNlsTables(
2027 IN PUSHORT AnsiTableBase,
2028 IN PUSHORT OemTableBase,
2029 IN PUSHORT CaseTableBase,
2030 OUT PNLSTABLEINFO NlsTable
2031 );
2032
2033 NTSYSAPI
2034 VOID
2035 NTAPI
2036 RtlInitCodePageTable(
2037 IN PUSHORT TableBase,
2038 OUT PCPTABLEINFO CodePageTable
2039 );
2040
2041 NTSYSAPI
2042 VOID
2043 NTAPI
2044 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable);
2045
2046 /*
2047 * Misc conversion functions
2048 */
2049 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
2050 static __inline
2051 LARGE_INTEGER
2052 NTAPI_INLINE
2053 RtlConvertLongToLargeInteger(LONG SignedInteger)
2054 {
2055 LARGE_INTEGER Result;
2056
2057 Result.QuadPart = SignedInteger;
2058 return Result;
2059 }
2060
2061 static __inline
2062 LARGE_INTEGER
2063 NTAPI_INLINE
2064 RtlEnlargedIntegerMultiply(
2065 LONG Multiplicand,
2066 LONG Multiplier)
2067 {
2068 LARGE_INTEGER Product;
2069
2070 Product.QuadPart = (LONGLONG)Multiplicand * (ULONGLONG)Multiplier;
2071 return Product;
2072 }
2073
2074 static __inline
2075 ULONG
2076 NTAPI_INLINE
2077 RtlEnlargedUnsignedDivide(
2078 IN ULARGE_INTEGER Dividend,
2079 IN ULONG Divisor,
2080 IN PULONG Remainder OPTIONAL)
2081 {
2082 ULONG Quotient;
2083
2084 Quotient = (ULONG)(Dividend.QuadPart / Divisor);
2085 if (Remainder) {
2086 *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
2087 }
2088
2089 return Quotient;
2090 }
2091
2092 static __inline
2093 LARGE_INTEGER
2094 NTAPI_INLINE
2095 RtlEnlargedUnsignedMultiply(
2096 ULONG Multiplicand,
2097 ULONG Multiplier)
2098 {
2099 LARGE_INTEGER Product;
2100
2101 Product.QuadPart = (ULONGLONG)Multiplicand * (ULONGLONG)Multiplier;
2102 return Product;
2103 }
2104 #endif
2105
2106 NTSYSAPI
2107 ULONG
2108 NTAPI
2109 RtlUniform(PULONG Seed);
2110
2111 /*
2112 * Network Functions
2113 */
2114 NTSYSAPI
2115 NTSTATUS
2116 NTAPI
2117 RtlIpv4StringToAddressW(
2118 IN LPWSTR IpString,
2119 IN ULONG Base,
2120 OUT PULONG PtrToIpAddr,
2121 OUT PULONG IpAddr
2122 );
2123
2124 /*
2125 * Time Functions
2126 */
2127 NTSYSAPI
2128 NTSTATUS
2129 NTAPI
2130 RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation);
2131
2132 NTSYSAPI
2133 VOID
2134 NTAPI
2135 RtlSecondsSince1970ToTime(
2136 IN ULONG SecondsSince1970,
2137 OUT PLARGE_INTEGER Time
2138 );
2139
2140 NTSYSAPI
2141 NTSTATUS
2142 NTAPI
2143 RtlSetTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation);
2144
2145 NTSYSAPI
2146 BOOLEAN
2147 NTAPI
2148 RtlTimeFieldsToTime(
2149 PTIME_FIELDS TimeFields,
2150 PLARGE_INTEGER Time
2151 );
2152
2153 NTSYSAPI
2154 VOID
2155 NTAPI
2156 RtlTimeToTimeFields(
2157 PLARGE_INTEGER Time,
2158 PTIME_FIELDS TimeFields
2159 );
2160
2161 /*
2162 * Version Functions
2163 */
2164 NTSYSAPI
2165 NTSTATUS
2166 NTAPI
2167 RtlVerifyVersionInfo(
2168 IN PRTL_OSVERSIONINFOEXW VersionInfo,
2169 IN ULONG TypeMask,
2170 IN ULONGLONG ConditionMask
2171 );
2172
2173 NTSYSAPI
2174 NTSTATUS
2175 NTAPI
2176 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation);
2177
2178 NTSYSAPI
2179 BOOLEAN
2180 NTAPI
2181 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType);
2182
2183 static __inline struct _PEB* NtCurrentPeb (void)
2184 {
2185 struct _PEB * pPeb;
2186
2187 #if defined(__GNUC__)
2188
2189 __asm__ __volatile__
2190 (
2191 "movl %%fs:0x30, %0\n" /* fs:30h == Teb->Peb */
2192 : "=r" (pPeb) /* can't have two memory operands */
2193 : /* no inputs */
2194 );
2195
2196 #elif defined(_MSC_VER)
2197
2198 __asm mov eax, fs:0x30;
2199 __asm mov pPeb, eax
2200
2201 #else
2202 #error Unknown compiler for inline assembler
2203 #endif
2204
2205 return pPeb;
2206 }
2207 #endif