Forgot these changes, sorry
[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 RtlSetControlSecurityDescriptor(
546 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
547 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
548 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
549 );
550
551 NTSYSAPI
552 NTSTATUS
553 NTAPI
554 RtlSetDaclSecurityDescriptor (
555 PSECURITY_DESCRIPTOR SecurityDescriptor,
556 BOOLEAN DaclPresent,
557 PACL Dacl,
558 BOOLEAN DaclDefaulted
559 );
560
561 NTSYSAPI
562 NTSTATUS
563 NTAPI
564 RtlSetGroupSecurityDescriptor(
565 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
566 IN PSID Group,
567 IN BOOLEAN GroupDefaulted
568 );
569
570 NTSYSAPI
571 NTSTATUS
572 NTAPI
573 RtlSetInformationAcl(
574 PACL Acl,
575 PVOID Information,
576 ULONG InformationLength,
577 ACL_INFORMATION_CLASS InformationClass
578 );
579
580 NTSYSAPI
581 NTSTATUS
582 NTAPI
583 RtlSetOwnerSecurityDescriptor(
584 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
585 IN PSID Owner,
586 IN BOOLEAN OwnerDefaulted
587 );
588
589 NTSYSAPI
590 NTSTATUS
591 NTAPI
592 RtlSetSaclSecurityDescriptor(
593 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
594 IN BOOLEAN SaclPresent,
595 IN PACL Sacl,
596 IN BOOLEAN SaclDefaulted
597 );
598
599 NTSYSAPI
600 VOID
601 NTAPI
602 RtlSetSecurityDescriptorRMControl(
603 PSECURITY_DESCRIPTOR SecurityDescriptor,
604 PUCHAR RMControl
605 );
606
607 NTSYSAPI
608 PUCHAR
609 NTAPI
610 RtlSubAuthorityCountSid(
611 IN PSID Sid
612 );
613
614 NTSYSAPI
615 PULONG
616 NTAPI
617 RtlSubAuthoritySid(
618 IN PSID Sid,
619 IN ULONG SubAuthority
620 );
621
622 NTSYSAPI
623 BOOLEAN
624 NTAPI
625 RtlValidRelativeSecurityDescriptor(
626 IN PSECURITY_DESCRIPTOR SecurityDescriptorInput,
627 IN ULONG SecurityDescriptorLength,
628 IN SECURITY_INFORMATION RequiredInformation
629 );
630
631 NTSYSAPI
632 BOOLEAN
633 NTAPI
634 RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor);
635
636 NTSYSAPI
637 BOOLEAN
638 NTAPI
639 RtlValidSid(IN PSID Sid);
640
641 NTSYSAPI
642 BOOLEAN
643 NTAPI
644 RtlValidAcl(PACL Acl);
645
646 NTSYSAPI
647 NTSTATUS
648 NTAPI
649 RtlDeleteSecurityObject(
650 IN PSECURITY_DESCRIPTOR *ObjectDescriptor
651 );
652
653 NTSYSAPI
654 NTSTATUS
655 NTAPI
656 RtlNewSecurityObject(
657 IN PSECURITY_DESCRIPTOR ParentDescriptor,
658 IN PSECURITY_DESCRIPTOR CreatorDescriptor,
659 OUT PSECURITY_DESCRIPTOR *NewDescriptor,
660 IN BOOLEAN IsDirectoryObject,
661 IN HANDLE Token,
662 IN PGENERIC_MAPPING GenericMapping
663 );
664
665 NTSYSAPI
666 NTSTATUS
667 NTAPI
668 RtlQuerySecurityObject(
669 IN PSECURITY_DESCRIPTOR ObjectDescriptor,
670 IN SECURITY_INFORMATION SecurityInformation,
671 OUT PSECURITY_DESCRIPTOR ResultantDescriptor,
672 IN ULONG DescriptorLength,
673 OUT PULONG ReturnLength
674 );
675
676 NTSYSAPI
677 NTSTATUS
678 NTAPI
679 RtlSetSecurityObject(
680 IN SECURITY_INFORMATION SecurityInformation,
681 IN PSECURITY_DESCRIPTOR ModificationDescriptor,
682 OUT PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
683 IN PGENERIC_MAPPING GenericMapping,
684 IN HANDLE Token
685 );
686
687 /*
688 * Single-Character Functions
689 */
690 NTSYSAPI
691 NTSTATUS
692 NTAPI
693 RtlLargeIntegerToChar(
694 IN PLARGE_INTEGER Value,
695 IN ULONG Base,
696 IN ULONG Length,
697 IN OUT PCHAR String
698 );
699
700 NTSYSAPI
701 CHAR
702 NTAPI
703 RtlUpperChar(CHAR Source);
704
705 NTSYSAPI
706 WCHAR
707 NTAPI
708 RtlUpcaseUnicodeChar(WCHAR Source);
709
710 NTSYSAPI
711 WCHAR
712 NTAPI
713 RtlDowncaseUnicodeChar(IN WCHAR Source);
714
715 NTSYSAPI
716 NTSTATUS
717 NTAPI
718 RtlIntegerToChar(
719 IN ULONG Value,
720 IN ULONG Base,
721 IN ULONG Length,
722 IN OUT PCHAR String
723 );
724
725 NTSYSAPI
726 NTSTATUS
727 NTAPI
728 RtlIntegerToUnicode(
729 IN ULONG Value,
730 IN ULONG Base OPTIONAL,
731 IN ULONG Length OPTIONAL,
732 IN OUT LPWSTR String
733 );
734
735 NTSYSAPI
736 NTSTATUS
737 NTAPI
738 RtlIntegerToUnicodeString(
739 IN ULONG Value,
740 IN ULONG Base,
741 IN OUT PUNICODE_STRING String
742 );
743
744 NTSYSAPI
745 NTSTATUS
746 NTAPI
747 RtlCharToInteger(
748 PCSZ String,
749 ULONG Base,
750 PULONG Value
751 );
752
753 #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || ((defined(_M_AMD64) || defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
754 unsigned short __cdecl _byteswap_ushort(unsigned short);
755 unsigned long __cdecl _byteswap_ulong (unsigned long);
756 unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
757 #pragma intrinsic(_byteswap_ushort)
758 #pragma intrinsic(_byteswap_ulong)
759 #pragma intrinsic(_byteswap_uint64)
760 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
761 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
762 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
763 #else
764
765 USHORT
766 FASTCALL
767 RtlUshortByteSwap(IN USHORT Source);
768
769 ULONG
770 FASTCALL
771 RtlUlongByteSwap(IN ULONG Source);
772
773 ULONGLONG
774 FASTCALL
775 RtlUlonglongByteSwap(IN ULONGLONG Source);
776
777 #endif
778
779 /*
780 * Unicode->Ansi String Functions
781 */
782 NTSYSAPI
783 ULONG
784 NTAPI
785 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString);
786
787 #ifdef NTOS_MODE_USER
788 #define RtlUnicodeStringToAnsiSize(STRING) ( \
789 NLS_MB_CODE_PAGE_TAG ? \
790 RtlxUnicodeStringToAnsiSize(STRING) : \
791 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
792 )
793 #endif
794
795 NTSYSAPI
796 NTSTATUS
797 NTAPI
798 RtlUnicodeStringToAnsiString(
799 PANSI_STRING DestinationString,
800 PCUNICODE_STRING SourceString,
801 BOOLEAN AllocateDestinationString
802 );
803
804 /*
805 * Unicode->OEM String Functions
806 */
807 NTSYSAPI
808 NTSTATUS
809 NTAPI
810 RtlUpcaseUnicodeStringToOemString(
811 POEM_STRING DestinationString,
812 PCUNICODE_STRING SourceString,
813 BOOLEAN AllocateDestinationString
814 );
815
816 NTSYSAPI
817 NTSTATUS
818 NTAPI
819 RtlUpcaseUnicodeStringToCountedOemString(
820 IN OUT POEM_STRING DestinationString,
821 IN PCUNICODE_STRING SourceString,
822 IN BOOLEAN AllocateDestinationString
823 );
824
825 NTSYSAPI
826 NTSTATUS
827 NTAPI
828 RtlUnicodeStringToOemString(
829 POEM_STRING DestinationString,
830 PCUNICODE_STRING SourceString,
831 BOOLEAN AllocateDestinationString
832 );
833
834 NTSYSAPI
835 NTSTATUS
836 NTAPI
837 RtlUpcaseUnicodeToOemN(
838 PCHAR OemString,
839 ULONG OemSize,
840 PULONG ResultSize,
841 PWCHAR UnicodeString,
842 ULONG UnicodeSize
843 );
844
845 NTSYSAPI
846 ULONG
847 NTAPI
848 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString);
849
850 #ifdef NTOS_MODE_USER
851 #define RtlUnicodeStringToOemSize(STRING) ( \
852 NLS_MB_OEM_CODE_PAGE_TAG ? \
853 RtlxUnicodeStringToOemSize(STRING) : \
854 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
855 )
856 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
857 (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
858 )
859 #endif
860
861 NTSYSAPI
862 NTSTATUS
863 NTAPI
864 RtlUnicodeToOemN(
865 PCHAR OemString,
866 ULONG OemSize,
867 PULONG ResultSize,
868 PWCHAR UnicodeString,
869 ULONG UnicodeSize
870 );
871
872 /*
873 * Unicode->MultiByte String Functions
874 */
875 NTSYSAPI
876 NTSTATUS
877 NTAPI
878 RtlUnicodeToMultiByteN(
879 PCHAR MbString,
880 ULONG MbSize,
881 PULONG ResultSize,
882 PWCHAR UnicodeString,
883 ULONG UnicodeSize
884 );
885
886 NTSYSAPI
887 NTSTATUS
888 NTAPI
889 RtlUpcaseUnicodeToMultiByteN(
890 PCHAR MbString,
891 ULONG MbSize,
892 PULONG ResultSize,
893 PWCHAR UnicodeString,
894 ULONG UnicodeSize
895 );
896
897 NTSYSAPI
898 NTSTATUS
899 NTAPI
900 RtlUnicodeToMultiByteSize(
901 PULONG MbSize,
902 PWCHAR UnicodeString,
903 ULONG UnicodeSize
904 );
905
906 NTSYSAPI
907 ULONG
908 NTAPI
909 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString);
910
911 /*
912 * OEM to Unicode Functions
913 */
914 #ifdef NTOS_MODE_USER
915 #define RtlOemStringToUnicodeSize(STRING) ( \
916 NLS_MB_OEM_CODE_PAGE_TAG ? \
917 RtlxOemStringToUnicodeSize(STRING) : \
918 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
919 )
920 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
921 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
922 )
923 #endif
924
925 NTSYSAPI
926 NTSTATUS
927 NTAPI
928 RtlOemStringToUnicodeString(
929 PUNICODE_STRING DestinationString,
930 PCOEM_STRING SourceString,
931 BOOLEAN AllocateDestinationString
932 );
933
934 NTSYSAPI
935 NTSTATUS
936 NTAPI
937 RtlOemToUnicodeN(
938 PWSTR UnicodeString,
939 ULONG MaxBytesInUnicodeString,
940 PULONG BytesInUnicodeString,
941 IN PCHAR OemString,
942 ULONG BytesInOemString
943 );
944
945 /*
946 * Ansi->Unicode String Functions
947 */
948 NTSYSAPI
949 ULONG
950 NTAPI
951 RtlxAnsiStringToUnicodeSize(
952 PCANSI_STRING AnsiString
953 );
954
955 NTSYSAPI
956 NTSTATUS
957 NTAPI
958 RtlAnsiStringToUnicodeString(
959 PUNICODE_STRING DestinationString,
960 PCANSI_STRING SourceString,
961 BOOLEAN AllocateDestinationString
962 );
963
964 #ifdef NTOS_MODE_USER
965 #define RtlAnsiStringToUnicodeSize(STRING) ( \
966 NLS_MB_CODE_PAGE_TAG ? \
967 RtlxAnsiStringToUnicodeSize(STRING) : \
968 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
969 )
970 #endif
971
972 NTSYSAPI
973 BOOLEAN
974 NTAPI
975 RtlCreateUnicodeStringFromAsciiz(
976 OUT PUNICODE_STRING Destination,
977 IN PCSZ Source
978 );
979
980 /*
981 * Unicode String Functions
982 */
983 NTSYSAPI
984 NTSTATUS
985 NTAPI
986 RtlAppendUnicodeToString(
987 PUNICODE_STRING Destination,
988 PCWSTR Source
989 );
990
991 NTSYSAPI
992 NTSTATUS
993 NTAPI
994 RtlAppendUnicodeStringToString(
995 PUNICODE_STRING Destination,
996 PCUNICODE_STRING Source
997 );
998
999 NTSYSAPI
1000 LONG
1001 NTAPI
1002 RtlCompareUnicodeString(
1003 PCUNICODE_STRING String1,
1004 PCUNICODE_STRING String2,
1005 BOOLEAN CaseInsensitive
1006 );
1007
1008 NTSYSAPI
1009 VOID
1010 NTAPI
1011 RtlCopyUnicodeString(
1012 PUNICODE_STRING DestinationString,
1013 PCUNICODE_STRING SourceString
1014 );
1015
1016 NTSYSAPI
1017 BOOLEAN
1018 NTAPI
1019 RtlCreateUnicodeString(
1020 PUNICODE_STRING DestinationString,
1021 PCWSTR SourceString
1022 );
1023
1024 #ifdef NTOS_MODE_USER
1025 NTSYSAPI
1026 NTSTATUS
1027 NTAPI
1028 RtlDowncaseUnicodeString(
1029 IN OUT PUNICODE_STRING UniDest,
1030 IN PCUNICODE_STRING UniSource,
1031 IN BOOLEAN AllocateDestinationString
1032 );
1033 #endif
1034
1035 NTSYSAPI
1036 NTSTATUS
1037 NTAPI
1038 RtlDuplicateUnicodeString(
1039 IN ULONG Flags,
1040 IN PCUNICODE_STRING SourceString,
1041 OUT PUNICODE_STRING DestinationString
1042 );
1043
1044 NTSYSAPI
1045 BOOLEAN
1046 NTAPI
1047 RtlEqualUnicodeString(
1048 PCUNICODE_STRING String1,
1049 PCUNICODE_STRING String2,
1050 BOOLEAN CaseInsensitive
1051 );
1052
1053 NTSYSAPI
1054 VOID
1055 NTAPI
1056 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString);
1057
1058 NTSYSAPI
1059 NTSTATUS
1060 NTAPI
1061 RtlHashUnicodeString(
1062 IN CONST UNICODE_STRING *String,
1063 IN BOOLEAN CaseInSensitive,
1064 IN ULONG HashAlgorithm,
1065 OUT PULONG HashValue
1066 );
1067
1068 NTSYSAPI
1069 VOID
1070 NTAPI
1071 RtlInitUnicodeString(
1072 IN OUT PUNICODE_STRING DestinationString,
1073 IN PCWSTR SourceString);
1074
1075 NTSYSAPI
1076 ULONG
1077 NTAPI
1078 RtlIsTextUnicode(
1079 PVOID Buffer,
1080 ULONG Length,
1081 ULONG *Flags
1082 );
1083
1084 NTSYSAPI
1085 BOOLEAN
1086 NTAPI
1087 RtlPrefixUnicodeString(
1088 PCUNICODE_STRING String1,
1089 PCUNICODE_STRING String2,
1090 BOOLEAN CaseInsensitive
1091 );
1092
1093 NTSYSAPI
1094 NTSTATUS
1095 NTAPI
1096 RtlUpcaseUnicodeString(
1097 PUNICODE_STRING DestinationString,
1098 PCUNICODE_STRING SourceString,
1099 BOOLEAN AllocateDestinationString
1100 );
1101
1102 NTSYSAPI
1103 NTSTATUS
1104 NTAPI
1105 RtlUnicodeStringToInteger(
1106 PCUNICODE_STRING String,
1107 ULONG Base,
1108 PULONG Value
1109 );
1110
1111 /*
1112 * Ansi String Functions
1113 */
1114 NTSYSAPI
1115 VOID
1116 NTAPI
1117 RtlFreeAnsiString(IN PANSI_STRING AnsiString);
1118
1119 NTSYSAPI
1120 VOID
1121 NTAPI
1122 RtlInitAnsiString(
1123 PANSI_STRING DestinationString,
1124 PCSZ SourceString
1125 );
1126
1127 /*
1128 * OEM String Functions
1129 */
1130 NTSYSAPI
1131 VOID
1132 NTAPI
1133 RtlFreeOemString(IN POEM_STRING OemString);
1134
1135 /*
1136 * MultiByte->Unicode String Functions
1137 */
1138 NTSYSAPI
1139 NTSTATUS
1140 NTAPI
1141 RtlMultiByteToUnicodeN(
1142 PWCHAR UnicodeString,
1143 ULONG UnicodeSize,
1144 PULONG ResultSize,
1145 PCSTR MbString,
1146 ULONG MbSize
1147 );
1148
1149 NTSYSAPI
1150 NTSTATUS
1151 NTAPI
1152 RtlMultiByteToUnicodeSize(
1153 PULONG UnicodeSize,
1154 PCSTR MbString,
1155 ULONG MbSize
1156 );
1157
1158 /*
1159 * Atom Functions
1160 */
1161 NTSYSAPI
1162 NTSTATUS
1163 NTAPI
1164 RtlAddAtomToAtomTable(
1165 IN PRTL_ATOM_TABLE AtomTable,
1166 IN PWSTR AtomName,
1167 OUT PRTL_ATOM Atom
1168 );
1169
1170 NTSYSAPI
1171 NTSTATUS
1172 NTAPI
1173 RtlCreateAtomTable(
1174 IN ULONG TableSize,
1175 IN OUT PRTL_ATOM_TABLE *AtomTable
1176 );
1177
1178 NTSYSAPI
1179 NTSTATUS
1180 NTAPI
1181 RtlDeleteAtomFromAtomTable(
1182 IN PRTL_ATOM_TABLE AtomTable,
1183 IN RTL_ATOM Atom
1184 );
1185
1186 NTSYSAPI
1187 NTSTATUS
1188 NTAPI
1189 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable);
1190
1191 NTSYSAPI
1192 NTSTATUS
1193 NTAPI
1194 RtlQueryAtomInAtomTable(
1195 IN PRTL_ATOM_TABLE AtomTable,
1196 IN RTL_ATOM Atom,
1197 IN OUT PULONG RefCount OPTIONAL,
1198 IN OUT PULONG PinCount OPTIONAL,
1199 IN OUT PWSTR AtomName OPTIONAL,
1200 IN OUT PULONG NameLength OPTIONAL
1201 );
1202
1203 NTSYSAPI
1204 NTSTATUS
1205 NTAPI
1206 RtlLookupAtomInAtomTable(
1207 IN PRTL_ATOM_TABLE AtomTable,
1208 IN PWSTR AtomName,
1209 OUT PRTL_ATOM Atom
1210 );
1211
1212 /*
1213 * Memory Functions
1214 */
1215 NTSYSAPI
1216 VOID
1217 NTAPI
1218 RtlFillMemoryUlong(
1219 IN PVOID Destination,
1220 IN ULONG Length,
1221 IN ULONG Fill
1222 );
1223
1224 /*
1225 * Process Management Functions
1226 */
1227 NTSYSAPI
1228 VOID
1229 NTAPI
1230 RtlAcquirePebLock(VOID);
1231
1232 NTSYSAPI
1233 NTSTATUS
1234 NTAPI
1235 RtlCreateProcessParameters (
1236 OUT PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
1237 IN PUNICODE_STRING ImagePathName OPTIONAL,
1238 IN PUNICODE_STRING DllPath OPTIONAL,
1239 IN PUNICODE_STRING CurrentDirectory OPTIONAL,
1240 IN PUNICODE_STRING CommandLine OPTIONAL,
1241 IN PWSTR Environment OPTIONAL,
1242 IN PUNICODE_STRING WindowTitle OPTIONAL,
1243 IN PUNICODE_STRING DesktopInfo OPTIONAL,
1244 IN PUNICODE_STRING ShellInfo OPTIONAL,
1245 IN PUNICODE_STRING RuntimeInfo OPTIONAL
1246 );
1247
1248 NTSYSAPI
1249 NTSTATUS
1250 NTAPI
1251 RtlCreateUserProcess(
1252 IN PUNICODE_STRING ImageFileName,
1253 IN ULONG Attributes,
1254 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters,
1255 IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL,
1256 IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL,
1257 IN HANDLE ParentProcess OPTIONAL,
1258 IN BOOLEAN CurrentDirectory,
1259 IN HANDLE DebugPort OPTIONAL,
1260 IN HANDLE ExceptionPort OPTIONAL,
1261 OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
1262 );
1263
1264 NTSYSAPI
1265 NTSTATUS
1266 NTAPI
1267 RtlCreateUserThread(
1268 IN HANDLE ProcessHandle,
1269 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1270 IN BOOLEAN CreateSuspended,
1271 IN LONG StackZeroBits,
1272 IN ULONG StackReserve,
1273 IN ULONG StackCommit,
1274 IN PTHREAD_START_ROUTINE StartAddress,
1275 IN PVOID Parameter,
1276 IN OUT PHANDLE ThreadHandle,
1277 IN OUT PCLIENT_ID ClientId
1278 );
1279
1280 NTSYSAPI
1281 PRTL_USER_PROCESS_PARAMETERS
1282 NTAPI
1283 RtlDeNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
1284
1285 NTSYSAPI
1286 NTSTATUS
1287 NTAPI
1288 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
1289
1290 NTSYSAPI
1291 VOID
1292 NTAPI
1293 RtlExitUserThread(NTSTATUS Status);
1294
1295 NTSYSAPI
1296 VOID
1297 NTAPI
1298 RtlInitializeContext(
1299 IN HANDLE ProcessHandle,
1300 OUT PCONTEXT ThreadContext,
1301 IN PVOID ThreadStartParam OPTIONAL,
1302 IN PTHREAD_START_ROUTINE ThreadStartAddress,
1303 IN PINITIAL_TEB InitialTeb
1304 );
1305
1306 NTSYSAPI
1307 PRTL_USER_PROCESS_PARAMETERS
1308 NTAPI
1309 RtlNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
1310
1311 NTSYSAPI
1312 VOID
1313 NTAPI
1314 RtlReleasePebLock(VOID);
1315
1316 /*
1317 * Environment/Path Functions
1318 */
1319 NTSYSAPI
1320 NTSTATUS
1321 NTAPI
1322 RtlCreateEnvironment(
1323 BOOLEAN Inherit,
1324 PWSTR *Environment
1325 );
1326
1327 NTSYSAPI
1328 VOID
1329 NTAPI
1330 RtlDestroyEnvironment(PWSTR Environment);
1331
1332 NTSYSAPI
1333 BOOLEAN
1334 NTAPI
1335 RtlDoesFileExists_U(PWSTR FileName);
1336
1337 NTSYSAPI
1338 ULONG
1339 NTAPI
1340 RtlDetermineDosPathNameType_U(PCWSTR Path);
1341
1342 NTSYSAPI
1343 ULONG
1344 NTAPI
1345 RtlDosSearchPath_U(
1346 WCHAR *sp,
1347 WCHAR *name,
1348 WCHAR *ext,
1349 ULONG buf_sz,
1350 WCHAR *buffer,
1351 WCHAR **shortname
1352 );
1353
1354 NTSYSAPI
1355 BOOLEAN
1356 NTAPI
1357 RtlDosPathNameToNtPathName_U(
1358 PWSTR DosName,
1359 PUNICODE_STRING NtName,
1360 PWSTR *ShortName,
1361 PCURDIR CurrentDirectory
1362 );
1363
1364 NTSYSAPI
1365 NTSTATUS
1366 NTAPI
1367 RtlExpandEnvironmentStrings_U(
1368 PWSTR Environment,
1369 PUNICODE_STRING Source,
1370 PUNICODE_STRING Destination,
1371 PULONG Length
1372 );
1373
1374 NTSYSAPI
1375 ULONG
1376 NTAPI
1377 RtlGetCurrentDirectory_U(
1378 ULONG MaximumLength,
1379 PWSTR Buffer
1380 );
1381
1382 NTSYSAPI
1383 ULONG
1384 NTAPI
1385 RtlGetFullPathName_U(
1386 const WCHAR *dosname,
1387 ULONG size,
1388 WCHAR *buf,
1389 WCHAR **shortname
1390 );
1391
1392 NTSYSAPI
1393 BOOLEAN
1394 NTAPI
1395 RtlIsNameLegalDOS8Dot3(
1396 IN PUNICODE_STRING UnicodeName,
1397 IN PANSI_STRING AnsiName,
1398 PBOOLEAN Unknown
1399 );
1400
1401 NTSYSAPI
1402 NTSTATUS
1403 NTAPI
1404 RtlQueryEnvironmentVariable_U(
1405 PWSTR Environment,
1406 PUNICODE_STRING Name,
1407 PUNICODE_STRING Value
1408 );
1409
1410 NTSYSAPI
1411 NTSTATUS
1412 NTAPI
1413 RtlSetCurrentDirectory_U(PUNICODE_STRING name);
1414
1415 NTSYSAPI
1416 NTSTATUS
1417 NTAPI
1418 RtlSetEnvironmentVariable(
1419 PWSTR *Environment,
1420 PUNICODE_STRING Name,
1421 PUNICODE_STRING Value
1422 );
1423
1424 /*
1425 * Critical Section/Resource Functions
1426 */
1427 NTSYSAPI
1428 NTSTATUS
1429 NTAPI
1430 RtlDeleteCriticalSection (
1431 IN PRTL_CRITICAL_SECTION CriticalSection
1432 );
1433
1434 NTSYSAPI
1435 NTSTATUS
1436 NTAPI
1437 RtlEnterCriticalSection(
1438 IN PRTL_CRITICAL_SECTION CriticalSection
1439 );
1440
1441 NTSYSAPI
1442 NTSTATUS
1443 NTAPI
1444 RtlInitializeCriticalSection(
1445 IN PRTL_CRITICAL_SECTION CriticalSection
1446 );
1447
1448 NTSYSAPI
1449 NTSTATUS
1450 NTAPI
1451 RtlInitializeCriticalSectionAndSpinCount(
1452 IN PRTL_CRITICAL_SECTION CriticalSection,
1453 IN ULONG SpinCount
1454 );
1455
1456 NTSYSAPI
1457 NTSTATUS
1458 NTAPI
1459 RtlLeaveCriticalSection(
1460 IN PRTL_CRITICAL_SECTION CriticalSection
1461 );
1462
1463 NTSYSAPI
1464 VOID
1465 NTAPI
1466 RtlpUnWaitCriticalSection(
1467 IN PRTL_CRITICAL_SECTION CriticalSection
1468 );
1469
1470 NTSYSAPI
1471 NTSTATUS
1472 NTAPI
1473 RtlpWaitForCriticalSection(
1474 IN PRTL_CRITICAL_SECTION CriticalSection
1475 );
1476
1477 NTSYSAPI
1478 BOOLEAN
1479 NTAPI
1480 RtlAcquireResourceExclusive(
1481 IN PRTL_RESOURCE Resource,
1482 IN BOOLEAN Wait
1483 );
1484
1485 NTSYSAPI
1486 BOOLEAN
1487 NTAPI
1488 RtlAcquireResourceShared(
1489 IN PRTL_RESOURCE Resource,
1490 IN BOOLEAN Wait
1491 );
1492
1493 NTSYSAPI
1494 VOID
1495 NTAPI
1496 RtlConvertExclusiveToShared(
1497 IN PRTL_RESOURCE Resource
1498 );
1499
1500 NTSYSAPI
1501 VOID
1502 NTAPI
1503 RtlConvertSharedToExclusive(
1504 IN PRTL_RESOURCE Resource
1505 );
1506
1507 NTSYSAPI
1508 VOID
1509 NTAPI
1510 RtlDeleteResource(
1511 IN PRTL_RESOURCE Resource
1512 );
1513
1514 NTSYSAPI
1515 VOID
1516 NTAPI
1517 RtlDumpResource(
1518 IN PRTL_RESOURCE Resource
1519 );
1520
1521 NTSYSAPI
1522 VOID
1523 NTAPI
1524 RtlInitializeResource(
1525 IN PRTL_RESOURCE Resource
1526 );
1527
1528 NTSYSAPI
1529 VOID
1530 NTAPI
1531 RtlReleaseResource(
1532 IN PRTL_RESOURCE Resource
1533 );
1534
1535 /*
1536 * Compression Functions
1537 */
1538 NTSYSAPI
1539 NTSTATUS
1540 NTAPI
1541 RtlCompressBuffer(
1542 IN USHORT CompressionFormatAndEngine,
1543 IN PUCHAR UncompressedBuffer,
1544 IN ULONG UncompressedBufferSize,
1545 OUT PUCHAR CompressedBuffer,
1546 IN ULONG CompressedBufferSize,
1547 IN ULONG UncompressedChunkSize,
1548 OUT PULONG FinalCompressedSize,
1549 IN PVOID WorkSpace
1550 );
1551
1552 NTSYSAPI
1553 NTSTATUS
1554 NTAPI
1555 RtlDecompressBuffer(
1556 IN USHORT CompressionFormat,
1557 OUT PUCHAR UncompressedBuffer,
1558 IN ULONG UncompressedBufferSize,
1559 IN PUCHAR CompressedBuffer,
1560 IN ULONG CompressedBufferSize,
1561 OUT PULONG FinalUncompressedSize
1562 );
1563
1564 NTSYSAPI
1565 NTSTATUS
1566 NTAPI
1567 RtlGetCompressionWorkSpaceSize(
1568 IN USHORT CompressionFormatAndEngine,
1569 OUT PULONG CompressBufferWorkSpaceSize,
1570 OUT PULONG CompressFragmentWorkSpaceSize
1571 );
1572
1573 /*
1574 * Debug Info Functions
1575 */
1576 NTSYSAPI
1577 PDEBUG_BUFFER
1578 NTAPI
1579 RtlCreateQueryDebugBuffer(
1580 IN ULONG Size,
1581 IN BOOLEAN EventPair
1582 );
1583
1584 NTSYSAPI
1585 NTSTATUS
1586 NTAPI
1587 RtlDestroyQueryDebugBuffer(IN PDEBUG_BUFFER DebugBuffer);
1588
1589 NTSYSAPI
1590 NTSTATUS
1591 NTAPI
1592 RtlQueryProcessDebugInformation(
1593 IN ULONG ProcessId,
1594 IN ULONG DebugInfoClassMask,
1595 IN OUT PDEBUG_BUFFER DebugBuffer
1596 );
1597
1598 /*
1599 * Bitmap Functions
1600 */
1601 NTSYSAPI
1602 BOOLEAN
1603 NTAPI
1604 RtlAreBitsClear(
1605 IN PRTL_BITMAP BitMapHeader,
1606 IN ULONG StartingIndex,
1607 IN ULONG Length
1608 );
1609
1610 NTSYSAPI
1611 BOOLEAN
1612 NTAPI
1613 RtlAreBitsSet(
1614 IN PRTL_BITMAP BitMapHeader,
1615 IN ULONG StartingIndex,
1616 IN ULONG Length
1617 );
1618
1619 NTSYSAPI
1620 VOID
1621 NTAPI
1622 RtlClearBits(
1623 IN PRTL_BITMAP BitMapHeader,
1624 IN ULONG StartingIndex,
1625 IN ULONG NumberToClear
1626 );
1627
1628 NTSYSAPI
1629 ULONG
1630 NTAPI
1631 RtlFindClearBits(
1632 IN PRTL_BITMAP BitMapHeader,
1633 IN ULONG NumberToFind,
1634 IN ULONG HintIndex
1635 );
1636
1637 NTSYSAPI
1638 ULONG
1639 NTAPI
1640 RtlFindClearBitsAndSet(
1641 IN PRTL_BITMAP BitMapHeader,
1642 IN ULONG NumberToFind,
1643 IN ULONG HintIndex
1644 );
1645
1646 NTSYSAPI
1647 VOID
1648 NTAPI
1649 RtlInitializeBitMap(
1650 IN PRTL_BITMAP BitMapHeader,
1651 IN PULONG BitMapBuffer,
1652 IN ULONG SizeOfBitMap
1653 );
1654
1655 NTSYSAPI
1656 VOID
1657 NTAPI
1658 RtlSetBits (
1659 IN PRTL_BITMAP BitMapHeader,
1660 IN ULONG StartingIndex,
1661 IN ULONG NumberToSet
1662 );
1663
1664 /*
1665 * Timer Functions
1666 */
1667 NTSYSAPI
1668 NTSTATUS
1669 NTAPI
1670 RtlCreateTimer(
1671 HANDLE TimerQueue,
1672 PHANDLE phNewTimer,
1673 WAITORTIMERCALLBACKFUNC Callback,
1674 PVOID Parameter,
1675 ULONG DueTime,
1676 ULONG Period,
1677 ULONG Flags
1678 );
1679
1680 NTSYSAPI
1681 NTSTATUS
1682 NTAPI
1683 RtlCreateTimerQueue(PHANDLE TimerQueue);
1684
1685 NTSYSAPI
1686 NTSTATUS
1687 NTAPI
1688 RtlDeleteTimer(
1689 HANDLE TimerQueue,
1690 HANDLE Timer,
1691 HANDLE CompletionEvent
1692 );
1693
1694 NTSYSAPI
1695 NTSTATUS
1696 NTAPI
1697 RtlUpdateTimer(
1698 HANDLE TimerQueue,
1699 HANDLE Timer,
1700 ULONG DueTime,
1701 ULONG Period
1702 );
1703
1704 NTSYSAPI
1705 NTSTATUS
1706 NTAPI
1707 RtlDeleteTimerQueueEx(
1708 HANDLE TimerQueue,
1709 HANDLE CompletionEvent
1710 );
1711
1712 NTSYSAPI
1713 NTSTATUS
1714 NTAPI
1715 RtlDeleteTimerQueue(HANDLE TimerQueue);
1716
1717 /*
1718 * Debug Functions
1719 */
1720 ULONG
1721 __cdecl
1722 DbgPrint(
1723 IN PCH Format,
1724 IN ...
1725 );
1726
1727 VOID
1728 NTAPI
1729 DbgBreakPoint(VOID);
1730
1731 /*
1732 * Handle Table Functions
1733 */
1734 NTSYSAPI
1735 PRTL_HANDLE_TABLE_ENTRY
1736 NTAPI
1737 RtlAllocateHandle(
1738 IN PRTL_HANDLE_TABLE HandleTable,
1739 IN OUT PULONG Index
1740 );
1741
1742 NTSYSAPI
1743 VOID
1744 NTAPI
1745 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable);
1746
1747 NTSYSAPI
1748 BOOLEAN
1749 NTAPI
1750 RtlFreeHandle(
1751 IN PRTL_HANDLE_TABLE HandleTable,
1752 IN PRTL_HANDLE_TABLE_ENTRY Handle
1753 );
1754
1755 NTSYSAPI
1756 VOID
1757 NTAPI
1758 RtlInitializeHandleTable(
1759 IN ULONG TableSize,
1760 IN ULONG HandleSize,
1761 IN PRTL_HANDLE_TABLE HandleTable
1762 );
1763
1764 NTSYSAPI
1765 BOOLEAN
1766 NTAPI
1767 RtlIsValidHandle(
1768 IN PRTL_HANDLE_TABLE HandleTable,
1769 IN PRTL_HANDLE_TABLE_ENTRY Handle
1770 );
1771
1772 NTSYSAPI
1773 BOOLEAN
1774 NTAPI
1775 RtlIsValidIndexHandle(
1776 IN PRTL_HANDLE_TABLE HandleTable,
1777 IN ULONG Index,
1778 OUT PRTL_HANDLE_TABLE_ENTRY *Handle
1779 );
1780
1781 /*
1782 * PE Functions
1783 */
1784 NTSYSAPI
1785 NTSTATUS
1786 NTAPI
1787 RtlFindMessage(
1788 IN PVOID BaseAddress,
1789 IN ULONG Type,
1790 IN ULONG Language,
1791 IN ULONG MessageId,
1792 OUT PRTL_MESSAGE_RESOURCE_ENTRY *MessageResourceEntry
1793 );
1794
1795 NTSYSAPI
1796 ULONG
1797 NTAPI
1798 RtlGetNtGlobalFlags(VOID);
1799
1800 NTSYSAPI
1801 PVOID
1802 NTAPI
1803 RtlImageDirectoryEntryToData(
1804 PVOID BaseAddress,
1805 BOOLEAN bFlag,
1806 ULONG Directory,
1807 PULONG Size
1808 );
1809
1810 NTSYSAPI
1811 ULONG
1812 NTAPI
1813 RtlImageRvaToVa(
1814 PIMAGE_NT_HEADERS NtHeader,
1815 PVOID BaseAddress,
1816 ULONG Rva,
1817 PIMAGE_SECTION_HEADER *SectionHeader
1818 );
1819
1820 NTSYSAPI
1821 PIMAGE_NT_HEADERS
1822 NTAPI
1823 RtlImageNtHeader(IN PVOID BaseAddress);
1824
1825 NTSYSAPI
1826 PIMAGE_SECTION_HEADER
1827 NTAPI
1828 RtlImageRvaToSection(
1829 PIMAGE_NT_HEADERS NtHeader,
1830 PVOID BaseAddress,
1831 ULONG Rva
1832 );
1833
1834 /*
1835 * Registry Functions
1836 */
1837 NTSYSAPI
1838 NTSTATUS
1839 NTAPI
1840 RtlCheckRegistryKey(
1841 ULONG RelativeTo,
1842 PWSTR Path
1843 );
1844
1845 NTSYSAPI
1846 NTSTATUS
1847 NTAPI
1848 RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath);
1849
1850 NTSYSAPI
1851 NTSTATUS
1852 NTAPI
1853 RtlpNtOpenKey(
1854 OUT HANDLE KeyHandle,
1855 IN ACCESS_MASK DesiredAccess,
1856 IN POBJECT_ATTRIBUTES ObjectAttributes,
1857 IN ULONG Unused
1858 );
1859
1860 NTSYSAPI
1861 NTSTATUS
1862 NTAPI
1863 RtlOpenCurrentUser(
1864 IN ACCESS_MASK DesiredAccess,
1865 OUT PHANDLE KeyHandle
1866 );
1867
1868 NTSYSAPI
1869 NTSTATUS
1870 NTAPI
1871 RtlQueryRegistryValues(
1872 IN ULONG RelativeTo,
1873 IN PCWSTR Path,
1874 IN PRTL_QUERY_REGISTRY_TABLE QueryTable,
1875 IN PVOID Context,
1876 IN PVOID Environment
1877 );
1878
1879 NTSYSAPI
1880 NTSTATUS
1881 NTAPI
1882 RtlWriteRegistryValue(
1883 ULONG RelativeTo,
1884 PCWSTR Path,
1885 PCWSTR ValueName,
1886 ULONG ValueType,
1887 PVOID ValueData,
1888 ULONG ValueLength
1889 );
1890
1891 /*
1892 * NLS Functions
1893 */
1894 NTSYSAPI
1895 VOID
1896 NTAPI
1897 RtlInitNlsTables(
1898 IN PUSHORT AnsiTableBase,
1899 IN PUSHORT OemTableBase,
1900 IN PUSHORT CaseTableBase,
1901 OUT PNLSTABLEINFO NlsTable
1902 );
1903
1904 NTSYSAPI
1905 VOID
1906 NTAPI
1907 RtlInitCodePageTable(
1908 IN PUSHORT TableBase,
1909 OUT PCPTABLEINFO CodePageTable
1910 );
1911
1912 NTSYSAPI
1913 VOID
1914 NTAPI
1915 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable);
1916
1917 /*
1918 * Misc conversion functions
1919 */
1920 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
1921 static __inline
1922 LARGE_INTEGER
1923 NTAPI_INLINE
1924 RtlConvertLongToLargeInteger(LONG SignedInteger)
1925 {
1926 LARGE_INTEGER Result;
1927
1928 Result.QuadPart = SignedInteger;
1929 return Result;
1930 }
1931
1932 static __inline
1933 LARGE_INTEGER
1934 NTAPI_INLINE
1935 RtlEnlargedIntegerMultiply(
1936 LONG Multiplicand,
1937 LONG Multiplier)
1938 {
1939 LARGE_INTEGER Product;
1940
1941 Product.QuadPart = (LONGLONG)Multiplicand * (ULONGLONG)Multiplier;
1942 return Product;
1943 }
1944
1945 static __inline
1946 ULONG
1947 NTAPI_INLINE
1948 RtlEnlargedUnsignedDivide(
1949 IN ULARGE_INTEGER Dividend,
1950 IN ULONG Divisor,
1951 IN PULONG Remainder OPTIONAL)
1952 {
1953 ULONG Quotient;
1954
1955 Quotient = (ULONG)(Dividend.QuadPart / Divisor);
1956 if (Remainder) {
1957 *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
1958 }
1959
1960 return Quotient;
1961 }
1962
1963 static __inline
1964 LARGE_INTEGER
1965 NTAPI_INLINE
1966 RtlEnlargedUnsignedMultiply(
1967 ULONG Multiplicand,
1968 ULONG Multiplier)
1969 {
1970 LARGE_INTEGER Product;
1971
1972 Product.QuadPart = (ULONGLONG)Multiplicand * (ULONGLONG)Multiplier;
1973 return Product;
1974 }
1975 #endif
1976
1977 NTSYSAPI
1978 ULONG
1979 NTAPI
1980 RtlUniform(PULONG Seed);
1981
1982 /*
1983 * Time Functions
1984 */
1985 NTSYSAPI
1986 NTSTATUS
1987 NTAPI
1988 RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation);
1989
1990 NTSYSAPI
1991 VOID
1992 NTAPI
1993 RtlSecondsSince1970ToTime(
1994 IN ULONG SecondsSince1970,
1995 OUT PLARGE_INTEGER Time
1996 );
1997
1998 NTSYSAPI
1999 NTSTATUS
2000 NTAPI
2001 RtlSetTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation);
2002
2003 NTSYSAPI
2004 BOOLEAN
2005 NTAPI
2006 RtlTimeFieldsToTime(
2007 PTIME_FIELDS TimeFields,
2008 PLARGE_INTEGER Time
2009 );
2010
2011 NTSYSAPI
2012 VOID
2013 NTAPI
2014 RtlTimeToTimeFields(
2015 PLARGE_INTEGER Time,
2016 PTIME_FIELDS TimeFields
2017 );
2018
2019 /*
2020 * Version Functions
2021 */
2022 NTSYSAPI
2023 NTSTATUS
2024 NTAPI
2025 RtlVerifyVersionInfo(
2026 IN PRTL_OSVERSIONINFOEXW VersionInfo,
2027 IN ULONG TypeMask,
2028 IN ULONGLONG ConditionMask
2029 );
2030
2031 NTSYSAPI
2032 NTSTATUS
2033 NTAPI
2034 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation);
2035
2036
2037 static __inline struct _PEB* NtCurrentPeb (void)
2038 {
2039 struct _PEB * pPeb;
2040
2041 #if defined(__GNUC__)
2042
2043 __asm__ __volatile__
2044 (
2045 "movl %%fs:0x30, %0\n" /* fs:30h == Teb->Peb */
2046 : "=r" (pPeb) /* can't have two memory operands */
2047 : /* no inputs */
2048 );
2049
2050 #elif defined(_MSC_VER)
2051
2052 __asm mov eax, fs:0x30;
2053 __asm mov pPeb, eax
2054
2055 #else
2056 #error Unknown compiler for inline assembler
2057 #endif
2058
2059 return pPeb;
2060 }
2061 #endif