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