Major cleanup to rtlfuncs.h. Not yet perfect but much better organized.
[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 <ndk/rtltypes.h>
14 #include <ndk/pstypes.h>
15
16 /* PROTOTYPES ****************************************************************/
17
18 /* FIXME: FILE NEEDS TO BE CLEANED UP AT THE END WHEN ALL THE FUNCTIONS HAVE BEEN ADDED */
19
20 /* List Macros */
21 static __inline
22 VOID
23 InitializeListHead(
24 IN PLIST_ENTRY ListHead)
25 {
26 ListHead->Flink = ListHead->Blink = ListHead;
27 }
28
29 static __inline
30 VOID
31 InsertHeadList(
32 IN PLIST_ENTRY ListHead,
33 IN PLIST_ENTRY Entry)
34 {
35 PLIST_ENTRY OldFlink;
36 OldFlink = ListHead->Flink;
37 Entry->Flink = OldFlink;
38 Entry->Blink = ListHead;
39 OldFlink->Blink = Entry;
40 ListHead->Flink = Entry;
41 }
42
43 static __inline
44 VOID
45 InsertTailList(
46 IN PLIST_ENTRY ListHead,
47 IN PLIST_ENTRY Entry)
48 {
49 PLIST_ENTRY OldBlink;
50 OldBlink = ListHead->Blink;
51 Entry->Flink = ListHead;
52 Entry->Blink = OldBlink;
53 OldBlink->Flink = Entry;
54 ListHead->Blink = Entry;
55 }
56
57 #define IsListEmpty(ListHead) \
58 ((ListHead)->Flink == (ListHead))
59
60 #define PopEntryList(ListHead) \
61 (ListHead)->Next; \
62 { \
63 PSINGLE_LIST_ENTRY _FirstEntry; \
64 _FirstEntry = (ListHead)->Next; \
65 if (_FirstEntry != NULL) \
66 (ListHead)->Next = _FirstEntry->Next; \
67 }
68
69 #define PushEntryList(_ListHead, _Entry) \
70 (_Entry)->Next = (_ListHead)->Next; \
71 (_ListHead)->Next = (_Entry); \
72
73 static __inline
74 BOOLEAN
75 RemoveEntryList(
76 IN PLIST_ENTRY Entry)
77 {
78 PLIST_ENTRY OldFlink;
79 PLIST_ENTRY OldBlink;
80
81 OldFlink = Entry->Flink;
82 OldBlink = Entry->Blink;
83 OldFlink->Blink = OldBlink;
84 OldBlink->Flink = OldFlink;
85 return (OldFlink == OldBlink);
86 }
87
88 static __inline
89 PLIST_ENTRY
90 RemoveHeadList(
91 IN PLIST_ENTRY ListHead)
92 {
93 PLIST_ENTRY Flink;
94 PLIST_ENTRY Entry;
95
96 Entry = ListHead->Flink;
97 Flink = Entry->Flink;
98 ListHead->Flink = Flink;
99 Flink->Blink = ListHead;
100 return Entry;
101 }
102
103 static __inline
104 PLIST_ENTRY
105 RemoveTailList(
106 IN PLIST_ENTRY ListHead)
107 {
108 PLIST_ENTRY Blink;
109 PLIST_ENTRY Entry;
110
111 Entry = ListHead->Blink;
112 Blink = Entry->Blink;
113 ListHead->Blink = Blink;
114 Blink->Flink = ListHead;
115 return Entry;
116 }
117
118 #define IsFirstEntry(ListHead, Entry) \
119 ((ListHead)->Flink == Entry)
120
121 #define IsLastEntry(ListHead, Entry) \
122 ((ListHead)->Blink == Entry)
123
124 #define InsertAscendingListFIFO(ListHead, Type, ListEntryField, NewEntry, SortField)\
125 {\
126 PLIST_ENTRY current;\
127 \
128 current = (ListHead)->Flink;\
129 while (current != (ListHead))\
130 {\
131 if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField >\
132 (NewEntry)->SortField)\
133 {\
134 break;\
135 }\
136 current = current->Flink;\
137 }\
138 \
139 InsertTailList(current, &((NewEntry)->ListEntryField));\
140 }
141
142 #define InsertDescendingListFIFO(ListHead, Type, ListEntryField, NewEntry, SortField)\
143 {\
144 PLIST_ENTRY current;\
145 \
146 current = (ListHead)->Flink;\
147 while (current != (ListHead))\
148 {\
149 if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField <\
150 (NewEntry)->SortField)\
151 {\
152 break;\
153 }\
154 current = current->Flink;\
155 }\
156 \
157 InsertTailList(current, &((NewEntry)->ListEntryField));\
158 }
159
160 #define InsertAscendingList(ListHead, Type, ListEntryField, NewEntry, SortField)\
161 {\
162 PLIST_ENTRY current;\
163 \
164 current = (ListHead)->Flink;\
165 while (current != (ListHead))\
166 {\
167 if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField >=\
168 (NewEntry)->SortField)\
169 {\
170 break;\
171 }\
172 current = current->Flink;\
173 }\
174 \
175 InsertTailList(current, &((NewEntry)->ListEntryField));\
176 }
177
178 #define InsertDescendingList(ListHead, Type, ListEntryField, NewEntry, SortField)\
179 {\
180 PLIST_ENTRY current;\
181 \
182 current = (ListHead)->Flink;\
183 while (current != (ListHead))\
184 {\
185 if (CONTAINING_RECORD(current, Type, ListEntryField)->SortField <=\
186 (NewEntry)->SortField)\
187 {\
188 break;\
189 }\
190 current = current->Flink;\
191 }\
192 \
193 InsertTailList(current, &((NewEntry)->ListEntryField));\
194 }
195
196 /*
197 * Debug Functions
198 */
199
200 ULONG
201 CDECL
202 DbgPrint(
203 IN PCH Format,
204 IN ...
205 );
206
207 VOID
208 STDCALL
209 DbgBreakPoint(VOID);
210
211 VOID
212 STDCALL
213 RtlAssert(
214 PVOID FailedAssertion,
215 PVOID FileName,
216 ULONG LineNumber,
217 PCHAR Message
218 );
219
220 ULONG
221 STDCALL
222 RtlNtStatusToDosError(IN NTSTATUS Status);
223
224 VOID
225 STDCALL
226 RtlRaiseException(IN PEXCEPTION_RECORD ExceptionRecord);
227
228 VOID
229 STDCALL
230 RtlRaiseStatus(NTSTATUS Status);
231
232 VOID
233 STDCALL
234 RtlUnwind(
235 PEXCEPTION_REGISTRATION RegistrationFrame,
236 PVOID ReturnAddress,
237 PEXCEPTION_RECORD ExceptionRecord,
238 DWORD EaxValue
239 );
240
241 /*
242 * Heap Functions
243 */
244
245 PVOID
246 STDCALL
247 RtlAllocateHeap(
248 IN HANDLE HeapHandle,
249 IN ULONG Flags,
250 IN ULONG Size
251 );
252
253 PVOID
254 STDCALL
255 RtlCreateHeap(
256 IN ULONG Flags,
257 IN PVOID BaseAddress OPTIONAL,
258 IN ULONG SizeToReserve OPTIONAL,
259 IN ULONG SizeToCommit OPTIONAL,
260 IN PVOID Lock OPTIONAL,
261 IN PRTL_HEAP_DEFINITION Definition OPTIONAL
262 );
263
264 HANDLE
265 STDCALL
266 RtlDestroyHeap(HANDLE hheap);
267
268 BOOLEAN
269 STDCALL
270 RtlFreeHeap(
271 IN HANDLE HeapHandle,
272 IN ULONG Flags,
273 IN PVOID P
274 );
275
276 PVOID
277 STDCALL
278 RtlReAllocateHeap(
279 HANDLE Heap,
280 ULONG Flags,
281 PVOID Ptr,
282 ULONG Size
283 );
284
285 BOOLEAN
286 STDCALL
287 RtlLockHeap(IN HANDLE Heap);
288
289 BOOLEAN
290 STDCALL
291 RtlUnlockHeap(IN HANDLE Heap);
292
293 ULONG
294 STDCALL
295 RtlSizeHeap(
296 IN PVOID HeapHandle,
297 IN ULONG Flags,
298 IN PVOID MemoryPointer
299 );
300
301 BOOLEAN
302 STDCALL
303 RtlValidateHeap(
304 HANDLE Heap,
305 ULONG Flags,
306 PVOID pmem
307 );
308
309 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
310
311
312 /*
313 * Security Functions
314 */
315 NTSTATUS
316 STDCALL
317 RtlAbsoluteToSelfRelativeSD(
318 IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
319 IN OUT PSECURITY_DESCRIPTOR_RELATIVE SelfRelativeSecurityDescriptor,
320 IN PULONG BufferLength
321 );
322
323 NTSTATUS
324 STDCALL
325 RtlAddAccessAllowedAce(
326 PACL Acl,
327 ULONG Revision,
328 ACCESS_MASK AccessMask,
329 PSID Sid
330 );
331
332 NTSTATUS
333 STDCALL
334 RtlAllocateAndInitializeSid(
335 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
336 IN UCHAR SubAuthorityCount,
337 IN ULONG SubAuthority0,
338 IN ULONG SubAuthority1,
339 IN ULONG SubAuthority2,
340 IN ULONG SubAuthority3,
341 IN ULONG SubAuthority4,
342 IN ULONG SubAuthority5,
343 IN ULONG SubAuthority6,
344 IN ULONG SubAuthority7,
345 OUT PSID *Sid
346 );
347
348 VOID
349 STDCALL
350 RtlCopyLuid(
351 IN PLUID LuidDest,
352 IN PLUID LuidSrc
353 );
354
355 VOID
356 STDCALL
357 RtlCopyLuidAndAttributesArray(
358 ULONG Count,
359 PLUID_AND_ATTRIBUTES Src,
360 PLUID_AND_ATTRIBUTES Dest
361 );
362
363 NTSTATUS
364 STDCALL
365 RtlCopySidAndAttributesArray(
366 ULONG Count,
367 PSID_AND_ATTRIBUTES Src,
368 ULONG SidAreaSize,
369 PSID_AND_ATTRIBUTES Dest,
370 PVOID SidArea,
371 PVOID* RemainingSidArea,
372 PULONG RemainingSidAreaSize
373 );
374
375 NTSTATUS
376 STDCALL
377 RtlConvertSidToUnicodeString(
378 OUT PUNICODE_STRING DestinationString,
379 IN PSID Sid,
380 IN BOOLEAN AllocateDestinationString
381 );
382
383 NTSTATUS
384 STDCALL
385 RtlCopySid(
386 IN ULONG Length,
387 IN PSID Destination,
388 IN PSID Source
389 );
390
391 NTSTATUS
392 STDCALL
393 RtlCreateAcl(
394 PACL Acl,
395 ULONG AclSize,
396 ULONG AclRevision
397 );
398
399 NTSTATUS
400 STDCALL
401 RtlCreateSecurityDescriptor(
402 PSECURITY_DESCRIPTOR SecurityDescriptor,
403 ULONG Revision
404 );
405
406 NTSTATUS
407 STDCALL
408 RtlCreateSecurityDescriptorRelative(
409 PSECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
410 ULONG Revision
411 );
412
413 BOOLEAN
414 STDCALL
415 RtlEqualSid (
416 IN PSID Sid1,
417 IN PSID Sid2
418 );
419
420 PVOID
421 STDCALL
422 RtlFreeSid (
423 IN PSID Sid
424 );
425
426 NTSTATUS
427 STDCALL
428 RtlGetDaclSecurityDescriptor(
429 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
430 OUT PBOOLEAN DaclPresent,
431 OUT PACL *Dacl,
432 OUT PBOOLEAN DaclDefaulted
433 );
434
435 NTSTATUS
436 STDCALL
437 RtlGetSaclSecurityDescriptor(
438 PSECURITY_DESCRIPTOR SecurityDescriptor,
439 PBOOLEAN SaclPresent,
440 PACL* Sacl,
441 PBOOLEAN SaclDefaulted
442 );
443
444 NTSTATUS
445 STDCALL
446 RtlGetGroupSecurityDescriptor(
447 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
448 OUT PSID *Group,
449 OUT PBOOLEAN GroupDefaulted
450 );
451
452 NTSTATUS
453 STDCALL
454 RtlGetOwnerSecurityDescriptor(
455 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
456 OUT PSID *Owner,
457 OUT PBOOLEAN OwnerDefaulted
458 );
459
460 NTSTATUS
461 STDCALL
462 RtlInitializeSid(
463 IN OUT PSID Sid,
464 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
465 IN UCHAR SubAuthorityCount
466 );
467
468 ULONG
469 STDCALL
470 RtlLengthRequiredSid(IN UCHAR SubAuthorityCount);
471
472 ULONG
473 STDCALL
474 RtlLengthSid(IN PSID Sid);
475
476 #if (VER_PRODUCTBUILD >= 2195)
477
478 NTSTATUS
479 STDCALL
480 RtlSelfRelativeToAbsoluteSD(
481 IN PSECURITY_DESCRIPTOR SelfRelativeSD,
482 OUT PSECURITY_DESCRIPTOR AbsoluteSD,
483 IN PULONG AbsoluteSDSize,
484 IN PACL Dacl,
485 IN PULONG DaclSize,
486 IN PACL Sacl,
487 IN PULONG SaclSize,
488 IN PSID Owner,
489 IN PULONG OwnerSize,
490 IN PSID PrimaryGroup,
491 IN PULONG PrimaryGroupSize
492 );
493
494 #endif /* (VER_PRODUCTBUILD >= 2195) */
495
496 NTSTATUS
497 STDCALL
498 RtlSetDaclSecurityDescriptor (
499 PSECURITY_DESCRIPTOR SecurityDescriptor,
500 BOOLEAN DaclPresent,
501 PACL Dacl,
502 BOOLEAN DaclDefaulted
503 );
504
505 NTSTATUS
506 STDCALL
507 RtlSetGroupSecurityDescriptor(
508 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
509 IN PSID Group,
510 IN BOOLEAN GroupDefaulted
511 );
512
513 NTSTATUS
514 STDCALL
515 RtlSetOwnerSecurityDescriptor(
516 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
517 IN PSID Owner,
518 IN BOOLEAN OwnerDefaulted
519 );
520
521 NTSTATUS
522 STDCALL
523 RtlSetSaclSecurityDescriptor(
524 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
525 IN BOOLEAN SaclPresent,
526 IN PACL Sacl,
527 IN BOOLEAN SaclDefaulted
528 );
529
530 PUCHAR
531 STDCALL
532 RtlSubAuthorityCountSid(
533 IN PSID Sid
534 );
535
536 PULONG
537 STDCALL
538 RtlSubAuthoritySid(
539 IN PSID Sid,
540 IN ULONG SubAuthority
541 );
542
543 BOOLEAN
544 STDCALL
545 RtlValidSid(IN PSID Sid);
546
547 BOOLEAN
548 STDCALL
549 RtlValidAcl(PACL Acl);
550
551 /*
552 * Single-Character Functions
553 */
554 NTSTATUS
555 STDCALL
556 RtlLargeIntegerToChar(
557 IN PLARGE_INTEGER Value,
558 IN ULONG Base,
559 IN ULONG Length,
560 IN OUT PCHAR String
561 );
562
563 CHAR
564 STDCALL
565 RtlUpperChar(CHAR Source);
566
567 WCHAR
568 STDCALL
569 RtlUpcaseUnicodeChar(WCHAR Source);
570
571 WCHAR
572 STDCALL
573 RtlDowncaseUnicodeChar(IN WCHAR Source);
574
575 NTSTATUS
576 STDCALL
577 RtlIntegerToChar(
578 IN ULONG Value,
579 IN ULONG Base,
580 IN ULONG Length,
581 IN OUT PCHAR String
582 );
583
584 NTSTATUS
585 STDCALL
586 RtlIntegerToUnicode(
587 IN ULONG Value,
588 IN ULONG Base OPTIONAL,
589 IN ULONG Length OPTIONAL,
590 IN OUT LPWSTR String
591 );
592
593 NTSTATUS
594 STDCALL
595 RtlIntegerToUnicodeString(
596 IN ULONG Value,
597 IN ULONG Base,
598 IN OUT PUNICODE_STRING String
599 );
600
601 NTSTATUS
602 STDCALL
603 RtlCharToInteger(
604 PCSZ String,
605 ULONG Base,
606 PULONG Value
607 );
608
609 USHORT
610 FASTCALL
611 RtlUshortByteSwap(IN USHORT Source);
612
613 /*
614 * Unicode->Ansi String Functions
615 */
616 ULONG
617 STDCALL
618 RtlUnicodeStringToAnsiSize(IN PUNICODE_STRING UnicodeString);
619
620 NTSTATUS
621 STDCALL
622 RtlUnicodeStringToAnsiString(
623 PANSI_STRING DestinationString,
624 PUNICODE_STRING SourceString,
625 BOOLEAN AllocateDestinationString
626 );
627
628 /*
629 * Unicode->OEM String Functions
630 */
631 NTSTATUS
632 STDCALL
633 RtlUpcaseUnicodeStringToOemString(
634 POEM_STRING DestinationString,
635 PUNICODE_STRING SourceString,
636 BOOLEAN AllocateDestinationString
637 );
638
639 NTSTATUS
640 STDCALL
641 RtlUpcaseUnicodeStringToCountedOemString(
642 IN OUT POEM_STRING DestinationString,
643 IN PUNICODE_STRING SourceString,
644 IN BOOLEAN AllocateDestinationString
645 );
646
647 NTSTATUS
648 STDCALL
649 RtlUpcaseUnicodeString(
650 PUNICODE_STRING DestinationString,
651 PCUNICODE_STRING SourceString,
652 BOOLEAN AllocateDestinationString
653 );
654
655 NTSTATUS
656 STDCALL
657 RtlUnicodeStringToOemString(
658 POEM_STRING DestinationString,
659 PUNICODE_STRING SourceString,
660 BOOLEAN AllocateDestinationString
661 );
662
663 NTSTATUS
664 STDCALL
665 RtlUpcaseUnicodeToOemN(
666 PCHAR OemString,
667 ULONG OemSize,
668 PULONG ResultSize,
669 PWCHAR UnicodeString,
670 ULONG UnicodeSize
671 );
672
673 ULONG
674 STDCALL
675 RtlUnicodeStringToOemSize(IN PUNICODE_STRING UnicodeString);
676
677 NTSTATUS
678 STDCALL
679 RtlUnicodeToOemN(
680 PCHAR OemString,
681 ULONG OemSize,
682 PULONG ResultSize,
683 PWCHAR UnicodeString,
684 ULONG UnicodeSize
685 );
686
687 /*
688 * Unicode->MultiByte String Functions
689 */
690 NTSTATUS
691 STDCALL
692 RtlUnicodeToMultiByteN(
693 PCHAR MbString,
694 ULONG MbSize,
695 PULONG ResultSize,
696 PWCHAR UnicodeString,
697 ULONG UnicodeSize
698 );
699
700 NTSTATUS
701 STDCALL
702 RtlUpcaseUnicodeToMultiByteN(
703 PCHAR MbString,
704 ULONG MbSize,
705 PULONG ResultSize,
706 PWCHAR UnicodeString,
707 ULONG UnicodeSize
708 );
709
710 NTSTATUS
711 STDCALL
712 RtlUnicodeToMultiByteSize(
713 PULONG MbSize,
714 PWCHAR UnicodeString,
715 ULONG UnicodeSize
716 );
717
718 /*
719 * OEM to Unicode Functions
720 */
721 ULONG
722 STDCALL
723 RtlOemStringToUnicodeSize(POEM_STRING AnsiString);
724
725 NTSTATUS
726 STDCALL
727 RtlOemStringToUnicodeString(
728 PUNICODE_STRING DestinationString,
729 POEM_STRING SourceString,
730 BOOLEAN AllocateDestinationString
731 );
732
733 NTSTATUS
734 STDCALL
735 RtlOemToUnicodeN(
736 PWSTR UnicodeString,
737 ULONG MaxBytesInUnicodeString,
738 PULONG BytesInUnicodeString,
739 IN PCHAR OemString,
740 ULONG BytesInOemString
741 );
742
743 /*
744 * Ansi->Multibyte String Functions
745 */
746
747 /*
748 * Ansi->Unicode String Functions
749 */
750 NTSTATUS
751 STDCALL
752 RtlAnsiStringToUnicodeString(
753 PUNICODE_STRING DestinationString,
754 PANSI_STRING SourceString,
755 BOOLEAN AllocateDestinationString
756 );
757
758 ULONG
759 STDCALL
760 RtlAnsiStringToUnicodeSize(
761 PANSI_STRING AnsiString
762 );
763
764 BOOLEAN
765 STDCALL
766 RtlCreateUnicodeStringFromAsciiz(
767 OUT PUNICODE_STRING Destination,
768 IN PCSZ Source
769 );
770
771 /*
772 * Unicode String Functions
773 */
774 NTSTATUS
775 STDCALL
776 RtlAppendUnicodeToString(
777 PUNICODE_STRING Destination,
778 PCWSTR Source
779 );
780
781 NTSTATUS
782 STDCALL
783 RtlAppendUnicodeStringToString(
784 PUNICODE_STRING Destination,
785 PUNICODE_STRING Source
786 );
787
788 LONG
789 STDCALL
790 RtlCompareUnicodeString(
791 PUNICODE_STRING String1,
792 PUNICODE_STRING String2,
793 BOOLEAN CaseInsensitive
794 );
795
796 VOID
797 STDCALL
798 RtlCopyUnicodeString(
799 PUNICODE_STRING DestinationString,
800 PUNICODE_STRING SourceString
801 );
802
803 BOOLEAN
804 STDCALL
805 RtlCreateUnicodeString(
806 PUNICODE_STRING DestinationString,
807 PCWSTR SourceString
808 );
809
810 BOOLEAN
811 STDCALL
812 RtlEqualUnicodeString(
813 PCUNICODE_STRING String1,
814 PCUNICODE_STRING String2,
815 BOOLEAN CaseInsensitive
816 );
817
818 VOID
819 STDCALL
820 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString);
821
822 VOID
823 STDCALL
824 RtlInitUnicodeString(
825 IN OUT PUNICODE_STRING DestinationString,
826 IN PCWSTR SourceString);
827
828 BOOLEAN
829 STDCALL
830 RtlPrefixUnicodeString(
831 PUNICODE_STRING String1,
832 PUNICODE_STRING String2,
833 BOOLEAN CaseInsensitive
834 );
835
836 NTSTATUS
837 STDCALL
838 RtlUnicodeStringToInteger(
839 PUNICODE_STRING String,
840 ULONG Base,
841 PULONG Value
842 );
843
844 /*
845 * Ansi String Functions
846 */
847 VOID
848 STDCALL
849 RtlFreeAnsiString(IN PANSI_STRING AnsiString);
850
851 VOID
852 STDCALL
853 RtlInitAnsiString(
854 PANSI_STRING DestinationString,
855 PCSZ SourceString
856 );
857
858 /*
859 * OEM String Functions
860 */
861 VOID
862 STDCALL
863 RtlFreeOemString(IN POEM_STRING OemString);
864
865 /*
866 * MultiByte->Unicode String Functions
867 */
868 NTSTATUS
869 STDCALL
870 RtlMultiByteToUnicodeN(
871 PWCHAR UnicodeString,
872 ULONG UnicodeSize,
873 PULONG ResultSize,
874 const PCHAR MbString,
875 ULONG MbSize
876 );
877
878 NTSTATUS
879 STDCALL
880 RtlMultiByteToUnicodeSize(
881 PULONG UnicodeSize,
882 PCHAR MbString,
883 ULONG MbSize
884 );
885
886 /*
887 * Atom Functions
888 */
889 NTSTATUS
890 STDCALL
891 RtlAddAtomToAtomTable(
892 IN PRTL_ATOM_TABLE AtomTable,
893 IN PWSTR AtomName,
894 OUT PRTL_ATOM Atom
895 );
896
897 NTSTATUS
898 STDCALL
899 RtlCreateAtomTable(
900 IN ULONG TableSize,
901 IN OUT PRTL_ATOM_TABLE *AtomTable
902 );
903
904 NTSTATUS
905 STDCALL
906 RtlDeleteAtomFromAtomTable(
907 IN PRTL_ATOM_TABLE AtomTable,
908 IN RTL_ATOM Atom
909 );
910
911 NTSTATUS
912 STDCALL
913 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable);
914
915 NTSTATUS
916 STDCALL
917 RtlQueryAtomInAtomTable(
918 IN PRTL_ATOM_TABLE AtomTable,
919 IN RTL_ATOM Atom,
920 IN OUT PULONG RefCount OPTIONAL,
921 IN OUT PULONG PinCount OPTIONAL,
922 IN OUT PWSTR AtomName OPTIONAL,
923 IN OUT PULONG NameLength OPTIONAL
924 );
925
926 NTSTATUS
927 STDCALL
928 RtlLookupAtomInAtomTable(
929 IN PRTL_ATOM_TABLE AtomTable,
930 IN PWSTR AtomName,
931 OUT PRTL_ATOM Atom
932 );
933
934 /*
935 * Memory Functions
936 */
937 SIZE_T
938 STDCALL
939 RtlCompareMemory(
940 IN const VOID *Source1,
941 IN const VOID *Source2,
942 IN SIZE_T Length
943 );
944
945 VOID
946 STDCALL
947 RtlFillMemoryUlong(
948 IN PVOID Destination,
949 IN ULONG Length,
950 IN ULONG Fill
951 );
952
953 /*
954 * Process Management Functions
955 */
956 VOID
957 STDCALL
958 RtlAcquirePebLock(VOID);
959
960 VOID
961 STDCALL
962 RtlReleasePebLock(VOID);
963
964 NTSTATUS
965 STDCALL
966 RtlCreateUserThread(
967 IN HANDLE ProcessHandle,
968 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
969 IN BOOLEAN CreateSuspended,
970 IN LONG StackZeroBits,
971 IN OUT PULONG StackReserve,
972 IN OUT PULONG StackCommit,
973 IN PTHREAD_START_ROUTINE StartAddress,
974 IN PVOID Parameter,
975 IN OUT PHANDLE ThreadHandle,
976 IN OUT PCLIENT_ID ClientId
977 );
978
979 PRTL_USER_PROCESS_PARAMETERS
980 STDCALL
981 RtlDeNormalizeProcessParams(
982 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
983 );
984
985 NTSTATUS
986 STDCALL
987 RtlExpandEnvironmentStrings_U(
988 PWSTR Environment,
989 PUNICODE_STRING Source,
990 PUNICODE_STRING Destination,
991 PULONG Length
992 );
993
994 PRTL_USER_PROCESS_PARAMETERS
995 STDCALL
996 RtlNormalizeProcessParams(
997 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
998 );
999
1000 NTSTATUS
1001 STDCALL
1002 RtlQueryEnvironmentVariable_U(
1003 PWSTR Environment,
1004 PUNICODE_STRING Name,
1005 PUNICODE_STRING Value
1006 );
1007
1008 /*
1009 * Critical Section/Resource Functions
1010 */
1011 NTSTATUS
1012 STDCALL
1013 RtlDeleteCriticalSection (
1014 PRTL_CRITICAL_SECTION CriticalSection
1015 );
1016
1017 NTSTATUS
1018 STDCALL
1019 RtlEnterCriticalSection(
1020 PRTL_CRITICAL_SECTION CriticalSection
1021 );
1022
1023 NTSTATUS
1024 STDCALL
1025 RtlInitializeCriticalSection(
1026 PRTL_CRITICAL_SECTION CriticalSection
1027 );
1028
1029 NTSTATUS
1030 STDCALL
1031 RtlLeaveCriticalSection(
1032 PRTL_CRITICAL_SECTION CriticalSection
1033 );
1034
1035 /*
1036 * Compression Functions
1037 */
1038 NTSTATUS
1039 STDCALL
1040 RtlCompressBuffer(
1041 IN USHORT CompressionFormatAndEngine,
1042 IN PUCHAR UncompressedBuffer,
1043 IN ULONG UncompressedBufferSize,
1044 OUT PUCHAR CompressedBuffer,
1045 IN ULONG CompressedBufferSize,
1046 IN ULONG UncompressedChunkSize,
1047 OUT PULONG FinalCompressedSize,
1048 IN PVOID WorkSpace
1049 );
1050
1051 NTSTATUS
1052 STDCALL
1053 RtlDecompressBuffer(
1054 IN USHORT CompressionFormat,
1055 OUT PUCHAR UncompressedBuffer,
1056 IN ULONG UncompressedBufferSize,
1057 IN PUCHAR CompressedBuffer,
1058 IN ULONG CompressedBufferSize,
1059 OUT PULONG FinalUncompressedSize
1060 );
1061
1062 NTSTATUS
1063 STDCALL
1064 RtlGetCompressionWorkSpaceSize(
1065 IN USHORT CompressionFormatAndEngine,
1066 OUT PULONG CompressBufferWorkSpaceSize,
1067 OUT PULONG CompressFragmentWorkSpaceSize
1068 );
1069
1070 /*
1071 * Bitmap Functions
1072 */
1073 BOOLEAN
1074 STDCALL
1075 RtlAreBitsClear(
1076 IN PRTL_BITMAP BitMapHeader,
1077 IN ULONG StartingIndex,
1078 IN ULONG Length
1079 );
1080
1081 BOOLEAN
1082 STDCALL
1083 RtlAreBitsSet(
1084 IN PRTL_BITMAP BitMapHeader,
1085 IN ULONG StartingIndex,
1086 IN ULONG Length
1087 );
1088
1089 VOID
1090 STDCALL
1091 RtlClearBits(
1092 IN PRTL_BITMAP BitMapHeader,
1093 IN ULONG StartingIndex,
1094 IN ULONG NumberToClear
1095 );
1096
1097 ULONG
1098 STDCALL
1099 RtlFindClearBits(
1100 PRTL_BITMAP BitMapHeader,
1101 ULONG NumberToFind,
1102 ULONG HintIndex
1103 );
1104
1105 ULONG
1106 STDCALL
1107 RtlFindClearBitsAndSet(
1108 PRTL_BITMAP BitMapHeader,
1109 ULONG NumberToFind,
1110 ULONG HintIndex
1111 );
1112
1113 VOID
1114 STDCALL
1115 RtlInitializeBitMap(
1116 IN PRTL_BITMAP BitMapHeader,
1117 IN PULONG BitMapBuffer,
1118 IN ULONG SizeOfBitMap
1119 );
1120
1121 VOID
1122 STDCALL
1123 RtlSetBits (
1124 PRTL_BITMAP BitMapHeader,
1125 ULONG StartingIndex,
1126 ULONG NumberToSet
1127 );
1128
1129 /*
1130 * PE Functions
1131 */
1132 PVOID
1133 STDCALL
1134 RtlImageDirectoryEntryToData(
1135 PVOID BaseAddress,
1136 BOOLEAN bFlag,
1137 ULONG Directory,
1138 PULONG Size
1139 );
1140
1141 ULONG
1142 STDCALL
1143 RtlImageRvaToVa(
1144 PIMAGE_NT_HEADERS NtHeader,
1145 PVOID BaseAddress,
1146 ULONG Rva,
1147 PIMAGE_SECTION_HEADER *SectionHeader
1148 );
1149
1150 PIMAGE_NT_HEADERS
1151 STDCALL
1152 RtlImageNtHeader(IN PVOID BaseAddress);
1153
1154 PIMAGE_SECTION_HEADER
1155 STDCALL
1156 RtlImageRvaToSection(
1157 PIMAGE_NT_HEADERS NtHeader,
1158 PVOID BaseAddress,
1159 ULONG Rva
1160 );
1161
1162 /*
1163 * Registry Functions
1164 */
1165 NTSTATUS
1166 STDCALL
1167 RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath);
1168
1169 NTSTATUS
1170 STDCALL
1171 RtlOpenCurrentUser(
1172 IN ACCESS_MASK DesiredAccess,
1173 OUT PHANDLE KeyHandle
1174 );
1175
1176 NTSTATUS
1177 STDCALL
1178 RtlQueryRegistryValues(
1179 IN ULONG RelativeTo,
1180 IN PCWSTR Path,
1181 IN PRTL_QUERY_REGISTRY_TABLE QueryTable,
1182 IN PVOID Context,
1183 IN PVOID Environment
1184 );
1185
1186 NTSTATUS
1187 STDCALL
1188 RtlWriteRegistryValue(
1189 ULONG RelativeTo,
1190 PCWSTR Path,
1191 PCWSTR ValueName,
1192 ULONG ValueType,
1193 PVOID ValueData,
1194 ULONG ValueLength
1195 );
1196
1197 NTSTATUS
1198 STDCALL
1199 RtlFindMessage (
1200 IN PVOID BaseAddress,
1201 IN ULONG Type,
1202 IN ULONG Language,
1203 IN ULONG MessageId,
1204 OUT PRTL_MESSAGE_RESOURCE_ENTRY *MessageResourceEntry
1205 );
1206
1207 /*
1208 * NLS Functions
1209 */
1210 VOID
1211 STDCALL
1212 RtlInitNlsTables(
1213 IN PUSHORT AnsiTableBase,
1214 IN PUSHORT OemTableBase,
1215 IN PUSHORT CaseTableBase,
1216 OUT PNLSTABLEINFO NlsTable
1217 );
1218
1219 VOID
1220 STDCALL
1221 RtlInitCodePageTable(
1222 IN PUSHORT TableBase,
1223 OUT PCPTABLEINFO CodePageTable
1224 );
1225
1226 VOID
1227 STDCALL
1228 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable);
1229
1230 /*
1231 * Misc String Functions
1232 */
1233 BOOLEAN
1234 STDCALL
1235 RtlIsNameLegalDOS8Dot3(
1236 IN PUNICODE_STRING UnicodeName,
1237 IN PANSI_STRING AnsiName,
1238 PBOOLEAN Unknown
1239 );
1240
1241 ULONG
1242 STDCALL
1243 RtlIsTextUnicode(
1244 PVOID Buffer,
1245 ULONG Length,
1246 ULONG *Flags
1247 );
1248
1249 /*
1250 * Time Functions
1251 */
1252 NTSTATUS
1253 STDCALL
1254 RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation);
1255
1256 VOID
1257 STDCALL
1258 RtlSecondsSince1970ToTime(
1259 IN ULONG SecondsSince1970,
1260 OUT PLARGE_INTEGER Time
1261 );
1262
1263 NTSTATUS
1264 STDCALL
1265 RtlSetTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation);
1266
1267 BOOLEAN
1268 STDCALL
1269 RtlTimeFieldsToTime(
1270 PTIME_FIELDS TimeFields,
1271 PLARGE_INTEGER Time
1272 );
1273
1274 VOID
1275 STDCALL
1276 RtlTimeToTimeFields(
1277 PLARGE_INTEGER Time,
1278 PTIME_FIELDS TimeFields
1279 );
1280
1281 /*
1282 * Version Functions
1283 */
1284 NTSTATUS
1285 STDCALL
1286 RtlVerifyVersionInfo(
1287 IN PRTL_OSVERSIONINFOEXW VersionInfo,
1288 IN ULONG TypeMask,
1289 IN ULONGLONG ConditionMask
1290 );
1291
1292 NTSTATUS
1293 STDCALL
1294 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation);
1295
1296 /*
1297 * C Runtime Library Functions
1298 */
1299 char *_itoa (int value, char *string, int radix);
1300 wchar_t *_itow (int value, wchar_t *string, int radix);
1301 int _snprintf(char * buf, size_t cnt, const char *fmt, ...);
1302 int _snwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, ...);
1303 int _stricmp(const char *s1, const char *s2);
1304 char * _strlwr(char *x);
1305 int _strnicmp(const char *s1, const char *s2, size_t n);
1306 char * _strnset(char* szToFill, int szFill, size_t sizeMaxFill);
1307 char * _strrev(char *s);
1308 char * _strset(char* szToFill, int szFill);
1309 char * _strupr(char *x);
1310 int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args);
1311 int _wcsicmp (const wchar_t* cs, const wchar_t* ct);
1312 wchar_t * _wcslwr (wchar_t *x);
1313 int _wcsnicmp (const wchar_t * cs,const wchar_t * ct,size_t count);
1314 wchar_t* _wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill);
1315 wchar_t * _wcsrev(wchar_t *s);
1316 wchar_t *_wcsupr(wchar_t *x);
1317 int atoi(const char *str);
1318 long atol(const char *str);
1319 int isdigit(int c);
1320 int isalpha(int c);
1321 int islower(int c);
1322 int isprint(int c);
1323 int isspace(int c);
1324 int isupper(int c);
1325 int isxdigit(int c);
1326 size_t mbstowcs (wchar_t *wcstr, const char *mbstr, size_t count);
1327 int mbtowc (wchar_t *wchar, const char *mbchar, size_t count);
1328 void * memchr(const void *s, int c, size_t n);
1329 void * memcpy(void *to, const void *from, size_t count);
1330 void * memmove(void *dest,const void *src, size_t count);
1331 void * memset(void *src, int val, size_t count);
1332 int rand(void);
1333 int sprintf(char * buf, const char *fmt, ...);
1334 void srand(unsigned seed);
1335 char * strcat(char *s, const char *append);
1336 char * strchr(const char *s, int c);
1337 int strcmp(const char *s1, const char *s2);
1338 char * strcpy(char *to, const char *from);
1339 size_t strlen(const char *str);
1340 char * strncat(char *dst, const char *src, size_t n);
1341 int strncmp(const char *s1, const char *s2, size_t n);
1342 char *strncpy(char *dst, const char *src, size_t n);
1343 char *strrchr(const char *s, int c);
1344 size_t strspn(const char *s1, const char *s2);
1345 char *strstr(const char *s, const char *find);
1346 int swprintf(wchar_t *buf, const wchar_t *fmt, ...);
1347 int tolower(int c);
1348 int toupper(int c);
1349 wchar_t towlower(wchar_t c);
1350 wchar_t towupper(wchar_t c);
1351 int vsprintf(char *buf, const char *fmt, va_list args);
1352 wchar_t * wcscat(wchar_t *dest, const wchar_t *src);
1353 wchar_t * wcschr(const wchar_t *str, wchar_t ch);
1354 int wcscmp(const wchar_t *cs, const wchar_t *ct);
1355 wchar_t* wcscpy(wchar_t* str1, const wchar_t* str2);
1356 size_t wcscspn(const wchar_t *str,const wchar_t *reject);
1357 size_t wcslen(const wchar_t *s);
1358 wchar_t * wcsncat(wchar_t *dest, const wchar_t *src, size_t count);
1359 int wcsncmp(const wchar_t *cs, const wchar_t *ct, size_t count);
1360 wchar_t * wcsncpy(wchar_t *dest, const wchar_t *src, size_t count);
1361 wchar_t * wcsrchr(const wchar_t *str, wchar_t ch);
1362 size_t wcsspn(const wchar_t *str,const wchar_t *accept);
1363 wchar_t *wcsstr(const wchar_t *s,const wchar_t *b);
1364 size_t wcstombs (char *mbstr, const wchar_t *wcstr, size_t count);
1365 int wctomb (char *mbchar, wchar_t wchar);
1366
1367 #endif