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