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