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