1 /******************************************************************************
2 * Runtime Library Functions *
3 ******************************************************************************/
9 OUT PLIST_ENTRY ListHead
)
11 ListHead
->Flink
= ListHead
->Blink
= ListHead
;
17 IN OUT PLIST_ENTRY ListHead
,
18 IN OUT PLIST_ENTRY Entry
)
21 OldFlink
= ListHead
->Flink
;
22 Entry
->Flink
= OldFlink
;
23 Entry
->Blink
= ListHead
;
24 OldFlink
->Blink
= Entry
;
25 ListHead
->Flink
= Entry
;
31 IN OUT PLIST_ENTRY ListHead
,
32 IN OUT PLIST_ENTRY Entry
)
35 OldBlink
= ListHead
->Blink
;
36 Entry
->Flink
= ListHead
;
37 Entry
->Blink
= OldBlink
;
38 OldBlink
->Flink
= Entry
;
39 ListHead
->Blink
= Entry
;
45 IN CONST LIST_ENTRY
* ListHead
)
47 return (BOOLEAN
)(ListHead
->Flink
== ListHead
);
53 IN OUT PSINGLE_LIST_ENTRY ListHead
)
55 PSINGLE_LIST_ENTRY FirstEntry
;
56 FirstEntry
= ListHead
->Next
;
57 if (FirstEntry
!= NULL
) {
58 ListHead
->Next
= FirstEntry
->Next
;
66 IN OUT PSINGLE_LIST_ENTRY ListHead
,
67 IN OUT PSINGLE_LIST_ENTRY Entry
)
69 Entry
->Next
= ListHead
->Next
;
70 ListHead
->Next
= Entry
;
81 OldFlink
= Entry
->Flink
;
82 OldBlink
= Entry
->Blink
;
83 OldFlink
->Blink
= OldBlink
;
84 OldBlink
->Flink
= OldFlink
;
85 return (BOOLEAN
)(OldFlink
== OldBlink
);
91 IN OUT PLIST_ENTRY ListHead
)
96 Entry
= ListHead
->Flink
;
98 ListHead
->Flink
= Flink
;
99 Flink
->Blink
= ListHead
;
106 IN OUT PLIST_ENTRY ListHead
)
111 Entry
= ListHead
->Blink
;
112 Blink
= Entry
->Blink
;
113 ListHead
->Blink
= Blink
;
114 Blink
->Flink
= ListHead
;
122 IN PVOID FailedAssertion
,
129 * IN VOID UNALIGNED *Destination,
130 * IN CONST VOID UNALIGNED *Source,
133 #define RtlCopyMemory(Destination, Source, Length) \
134 memcpy(Destination, Source, Length)
136 #define RtlCopyBytes RtlCopyMemory
138 #if defined(_M_AMD64)
142 RtlCopyMemoryNonTemporal(
143 VOID UNALIGNED
*Destination
,
144 CONST VOID UNALIGNED
*Source
,
147 #define RtlCopyMemoryNonTemporal RtlCopyMemory
155 #define RtlEqualLuid(Luid1, Luid2) \
156 (((Luid1)->LowPart == (Luid2)->LowPart) && ((Luid1)->HighPart == (Luid2)->HighPart))
160 * IN VOID UNALIGNED *Destination,
161 * IN CONST VOID UNALIGNED *Source,
164 #define RtlEqualMemory(Destination, Source, Length) \
165 (!memcmp(Destination, Source, Length))
169 * IN VOID UNALIGNED *Destination,
173 #define RtlFillMemory(Destination, Length, Fill) \
174 memset(Destination, Fill, Length)
176 #define RtlFillBytes RtlFillMemory
181 RtlFreeUnicodeString(
182 IN OUT PUNICODE_STRING UnicodeString
);
188 IN PUNICODE_STRING GuidString
,
194 RtlInitUnicodeString(
195 IN OUT PUNICODE_STRING DestinationString
,
196 IN PCWSTR SourceString OPTIONAL
);
200 * IN VOID UNALIGNED *Destination,
201 * IN CONST VOID UNALIGNED *Source,
204 #define RtlMoveMemory(Destination, Source, Length) \
205 memmove(Destination, Source, Length)
212 OUT PUNICODE_STRING GuidString
);
216 * IN VOID UNALIGNED *Destination,
219 #define RtlZeroMemory(Destination, Length) \
220 memset(Destination, 0, Length)
222 #define RtlZeroBytes RtlZeroMemory
225 #if (NTDDI_VERSION >= NTDDI_WIN2K)
232 IN HANDLE HeapHandle
,
233 IN ULONG Flags OPTIONAL
,
241 IN ULONG Flags OPTIONAL
,
242 IN PVOID BaseAddress
);
250 IN PRTL_BITMAP BitMapHeader
,
251 IN ULONG StartingIndex
,
258 IN PRTL_BITMAP BitMapHeader
,
259 IN ULONG StartingIndex
,
265 RtlAnsiStringToUnicodeString(
266 IN OUT PUNICODE_STRING DestinationString
,
267 IN PANSI_STRING SourceString
,
268 IN BOOLEAN AllocateDestinationString
);
273 RtlxAnsiStringToUnicodeSize(
274 IN PCANSI_STRING AnsiString
);
276 #define RtlAnsiStringToUnicodeSize(String) ( \
277 NLS_MB_CODE_PAGE_TAG ? \
278 RtlxAnsiStringToUnicodeSize(String) : \
279 ((String)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
285 RtlAppendUnicodeStringToString(
286 IN OUT PUNICODE_STRING Destination
,
287 IN PCUNICODE_STRING Source
);
292 RtlAppendUnicodeToString(
293 IN OUT PUNICODE_STRING Destination
,
307 IN PRTL_BITMAP BitMapHeader
);
313 IN PRTL_BITMAP BitMapHeader
,
314 IN ULONG StartingIndex
,
315 IN ULONG NumberToClear
);
321 IN CONST VOID
*Source1
,
322 IN CONST VOID
*Source2
,
328 RtlCompareUnicodeString(
329 IN PCUNICODE_STRING String1
,
330 IN PCUNICODE_STRING String2
,
331 IN BOOLEAN CaseInSensitive
);
336 RtlCompareUnicodeStrings(
338 IN SIZE_T String1Length
,
340 IN SIZE_T String2Length
,
341 IN BOOLEAN CaseInSensitive
);
346 RtlCopyUnicodeString(
347 IN OUT PUNICODE_STRING DestinationString
,
348 IN PCUNICODE_STRING SourceString
);
353 RtlCreateRegistryKey(
360 RtlCreateSecurityDescriptor(
361 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
367 RtlDeleteRegistryValue(
370 IN PCWSTR ValueName
);
375 RtlEqualUnicodeString(
376 IN CONST UNICODE_STRING
*String1
,
377 IN CONST UNICODE_STRING
*String2
,
378 IN BOOLEAN CaseInSensitive
);
380 #if !defined(_AMD64_) && !defined(_IA64_)
384 RtlExtendedIntegerMultiply(
385 IN LARGE_INTEGER Multiplicand
,
391 RtlExtendedLargeIntegerDivide(
392 IN LARGE_INTEGER Dividend
,
394 IN OUT PULONG Remainder
);
397 #if defined(_X86_) || defined(_IA64_)
401 RtlExtendedMagicDivide(
402 IN LARGE_INTEGER Dividend
,
403 IN LARGE_INTEGER MagicDivisor
,
404 IN CCHAR ShiftCount
);
411 IN PANSI_STRING AnsiString
);
417 IN PRTL_BITMAP BitMapHeader
,
418 IN ULONG NumberToFind
,
424 RtlFindClearBitsAndSet(
425 IN PRTL_BITMAP BitMapHeader
,
426 IN ULONG NumberToFind
,
432 RtlFindFirstRunClear(
433 IN PRTL_BITMAP BitMapHeader
,
434 OUT PULONG StartingIndex
);
440 IN PRTL_BITMAP BitMapHeader
,
441 OUT PRTL_BITMAP_RUN RunArray
,
442 IN ULONG SizeOfRunArray
,
443 IN BOOLEAN LocateLongestRuns
);
448 RtlFindLastBackwardRunClear(
449 IN PRTL_BITMAP BitMapHeader
,
451 OUT PULONG StartingRunIndex
);
456 RtlFindLeastSignificantBit(
462 RtlFindLongestRunClear(
463 IN PRTL_BITMAP BitMapHeader
,
464 OUT PULONG StartingIndex
);
469 RtlFindMostSignificantBit(
475 RtlFindNextForwardRunClear(
476 IN PRTL_BITMAP BitMapHeader
,
478 OUT PULONG StartingRunIndex
);
484 IN PRTL_BITMAP BitMapHeader
,
485 IN ULONG NumberToFind
,
491 RtlFindSetBitsAndClear(
492 IN PRTL_BITMAP BitMapHeader
,
493 IN ULONG NumberToFind
,
499 RtlHashUnicodeString(
500 IN CONST UNICODE_STRING
*String
,
501 IN BOOLEAN CaseInSensitive
,
502 IN ULONG HashAlgorithm
,
503 OUT PULONG HashValue
);
509 IN OUT PANSI_STRING DestinationString
,
510 IN PCSZ SourceString
);
516 IN PRTL_BITMAP BitMapHeader
,
517 IN PULONG BitMapBuffer
,
518 IN ULONG SizeOfBitMap
);
524 IN OUT PSTRING DestinationString
,
525 IN PCSZ SourceString
);
530 RtlIntegerToUnicodeString(
532 IN ULONG Base OPTIONAL
,
533 IN OUT PUNICODE_STRING String
);
538 RtlInt64ToUnicodeString(
540 IN ULONG Base OPTIONAL
,
541 IN OUT PUNICODE_STRING String
);
544 #define RtlIntPtrToUnicodeString(Value, Base, String) \
545 RtlInt64ToUnicodeString(Value, Base, String)
547 #define RtlIntPtrToUnicodeString(Value, Base, String) \
548 RtlIntegerToUnicodeString(Value, Base, String)
555 #define RtlIsZeroLuid(_L1) \
556 ((BOOLEAN) ((!(_L1)->LowPart) && (!(_L1)->HighPart)))
561 RtlLengthSecurityDescriptor(
562 IN PSECURITY_DESCRIPTOR SecurityDescriptor
);
567 RtlNumberOfClearBits(
568 IN PRTL_BITMAP BitMapHeader
);
574 IN PRTL_BITMAP BitMapHeader
);
579 RtlQueryRegistryValues(
582 IN PRTL_QUERY_REGISTRY_TABLE QueryTable
,
584 IN PVOID Environment OPTIONAL
);
586 #define LONG_SIZE (sizeof(LONG))
587 #define LONG_MASK (LONG_SIZE - 1)
591 * PULONG DestinationAddress,
592 * PULONG SourceAddress);
595 #define RtlRetrieveUlong(DestAddress,SrcAddress) \
596 *(ULONG UNALIGNED *)(DestAddress) = *(PULONG)(SrcAddress)
598 #define RtlRetrieveUlong(DestAddress,SrcAddress) \
599 if ((ULONG_PTR)(SrcAddress) & LONG_MASK) \
601 ((PUCHAR)(DestAddress))[0]=((PUCHAR)(SrcAddress))[0]; \
602 ((PUCHAR)(DestAddress))[1]=((PUCHAR)(SrcAddress))[1]; \
603 ((PUCHAR)(DestAddress))[2]=((PUCHAR)(SrcAddress))[2]; \
604 ((PUCHAR)(DestAddress))[3]=((PUCHAR)(SrcAddress))[3]; \
608 *((PULONG)(DestAddress))=*((PULONG)(SrcAddress)); \
614 * PUSHORT DestinationAddress,
615 * PUSHORT SourceAddress);
618 #define RtlRetrieveUshort(DestAddress,SrcAddress) \
619 *(USHORT UNALIGNED *)(DestAddress) = *(USHORT)(SrcAddress)
621 #define RtlRetrieveUshort(DestAddress,SrcAddress) \
622 if ((ULONG_PTR)(SrcAddress) & LONG_MASK) \
624 ((PUCHAR)(DestAddress))[0]=((PUCHAR)(SrcAddress))[0]; \
625 ((PUCHAR)(DestAddress))[1]=((PUCHAR)(SrcAddress))[1]; \
629 *((PUSHORT)(DestAddress))=*((PUSHORT)(SrcAddress)); \
637 IN PRTL_BITMAP BitMapHeader
);
643 IN PRTL_BITMAP BitMapHeader
,
644 IN ULONG StartingIndex
,
645 IN ULONG NumberToSet
);
650 RtlSetDaclSecurityDescriptor(
651 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
652 IN BOOLEAN DaclPresent
,
653 IN PACL Dacl OPTIONAL
,
654 IN BOOLEAN DaclDefaulted OPTIONAL
);
662 #define RtlStoreUlong(Address,Value) \
663 *(ULONG UNALIGNED *)(Address) = (Value)
665 #define RtlStoreUlong(Address,Value) \
666 if ((ULONG_PTR)(Address) & LONG_MASK) { \
667 ((PUCHAR) (Address))[LONG_LEAST_SIGNIFICANT_BIT] = (UCHAR)(FIRSTBYTE(Value)); \
668 ((PUCHAR) (Address))[LONG_3RD_MOST_SIGNIFICANT_BIT] = (UCHAR)(SECONDBYTE(Value)); \
669 ((PUCHAR) (Address))[LONG_2ND_MOST_SIGNIFICANT_BIT] = (UCHAR)(THIRDBYTE(Value)); \
670 ((PUCHAR) (Address))[LONG_MOST_SIGNIFICANT_BIT] = (UCHAR)(FOURTHBYTE(Value)); \
673 *((PULONG)(Address)) = (ULONG) (Value); \
679 * IN OUT PULONGLONG Address,
683 #define RtlStoreUlonglong(Address,Value) \
684 *(ULONGLONG UNALIGNED *)(Address) = (Value)
686 #define RtlStoreUlonglong(Address,Value) \
687 if ((ULONG_PTR)(Address) & LONGLONG_MASK) { \
688 RtlStoreUlong((ULONG_PTR)(Address), \
689 (ULONGLONG)(Value) & 0xFFFFFFFF); \
690 RtlStoreUlong((ULONG_PTR)(Address)+sizeof(ULONG), \
691 (ULONGLONG)(Value) >> 32); \
693 *((PULONGLONG)(Address)) = (ULONGLONG)(Value); \
699 * IN OUT PULONG_PTR Address,
700 * IN ULONG_PTR Value);
703 #define RtlStoreUlongPtr(Address,Value) \
704 RtlStoreUlonglong(Address,Value)
706 #define RtlStoreUlongPtr(Address,Value) \
707 RtlStoreUlong(Address,Value)
712 * IN PUSHORT Address,
716 #define RtlStoreUshort(Address,Value) \
717 *(USHORT UNALIGNED *)(Address) = (Value)
719 #define RtlStoreUshort(Address,Value) \
720 if ((ULONG_PTR)(Address) & SHORT_MASK) { \
721 ((PUCHAR) (Address))[SHORT_LEAST_SIGNIFICANT_BIT] = (UCHAR)(FIRSTBYTE(Value)); \
722 ((PUCHAR) (Address))[SHORT_MOST_SIGNIFICANT_BIT ] = (UCHAR)(SECONDBYTE(Value)); \
725 *((PUSHORT) (Address)) = (USHORT)Value; \
733 IN PTIME_FIELDS TimeFields
,
734 IN PLARGE_INTEGER Time
);
740 IN PLARGE_INTEGER Time
,
741 IN PTIME_FIELDS TimeFields
);
752 RtlUlonglongByteSwap(
753 IN ULONGLONG Source
);
758 RtlUnicodeStringToAnsiString(
759 IN OUT PANSI_STRING DestinationString
,
760 IN PCUNICODE_STRING SourceString
,
761 IN BOOLEAN AllocateDestinationString
);
766 RtlxUnicodeStringToAnsiSize(
767 IN PCUNICODE_STRING UnicodeString
);
769 #define RtlUnicodeStringToAnsiSize(String) ( \
770 NLS_MB_CODE_PAGE_TAG ? \
771 RtlxUnicodeStringToAnsiSize(String) : \
772 ((String)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
778 RtlUnicodeStringToInteger(
779 IN PCUNICODE_STRING String
,
780 IN ULONG Base OPTIONAL
,
786 RtlUpcaseUnicodeChar(
787 IN WCHAR SourceCharacter
);
798 RtlValidRelativeSecurityDescriptor(
799 IN PSECURITY_DESCRIPTOR SecurityDescriptorInput
,
800 IN ULONG SecurityDescriptorLength
,
801 IN SECURITY_INFORMATION RequiredInformation
);
806 RtlValidSecurityDescriptor(
807 IN PSECURITY_DESCRIPTOR SecurityDescriptor
);
812 RtlWriteRegistryValue(
818 IN ULONG ValueLength
);
820 #endif // (NTDDI_VERSION >= NTDDI_WIN2K)
822 #if (NTDDI_VERSION >= NTDDI_WIN2KSP3)
826 RtlPrefetchMemoryNonTemporal(
831 #if (NTDDI_VERSION >= NTDDI_WINXP)
836 PRTL_BITMAP BitMapHeader
,
842 RtlDowncaseUnicodeChar(
843 IN WCHAR SourceCharacter
);
849 PRTL_BITMAP BitMapHeader
,
856 IN PRTL_BITMAP BitMapHeader
,
859 #endif // (NTDDI_VERSION >= NTDDI_WINXP)
861 #if (NTDDI_VERSION >= NTDDI_VISTA)
865 RtlNumberOfSetBitsUlongPtr(
866 IN ULONG_PTR Target
);
871 RtlIoDecodeMemIoResource (
872 IN
struct _IO_RESOURCE_DESCRIPTOR
*Descriptor
,
873 OUT PULONGLONG Alignment OPTIONAL
,
874 OUT PULONGLONG MinimumAddress OPTIONAL
,
875 OUT PULONGLONG MaximumAddress OPTIONAL
);
880 RtlIoEncodeMemIoResource(
881 IN
struct _IO_RESOURCE_DESCRIPTOR
*Descriptor
,
884 IN ULONGLONG Alignment
,
885 IN ULONGLONG MinimumAddress
,
886 IN ULONGLONG MaximumAddress
);
891 RtlCmDecodeMemIoResource(
892 IN
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
*Descriptor
,
893 OUT PULONGLONG Start OPTIONAL
);
898 RtlFindClosestEncodableLength(
899 IN ULONGLONG SourceLength
,
900 OUT PULONGLONG TargetLength
);
904 #if !defined(MIDL_PASS)
905 /* inline funftions */
906 //DECLSPEC_DEPRECATED_DDK_WINXP
910 RtlConvertLongToLargeInteger(LONG SignedInteger
)
913 ret
.QuadPart
= SignedInteger
;
917 //DECLSPEC_DEPRECATED_DDK_WINXP
921 RtlConvertUlongToLargeInteger(
922 ULONG UnsignedInteger
)
925 ret
.QuadPart
= UnsignedInteger
;
929 //DECLSPEC_DEPRECATED_DDK
933 RtlEnlargedUnsignedDivide(
934 IN ULARGE_INTEGER Dividend
,
936 IN OUT PULONG Remainder
)
939 *Remainder
= (ULONG
)(Dividend
.QuadPart
% Divisor
);
940 return (ULONG
)(Dividend
.QuadPart
/ Divisor
);
943 //DECLSPEC_DEPRECATED_DDK
947 RtlEnlargedUnsignedMultiply(
948 IN ULONG Multiplicand
,
952 ret
.QuadPart
= (ULONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
956 //DECLSPEC_DEPRECATED_DDK
960 RtlEnlargedIntegerMultiply(
961 IN LONG Multiplicand
,
965 ret
.QuadPart
= (LONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
971 RtlInitEmptyAnsiString(OUT PANSI_STRING AnsiString
,
973 IN USHORT BufferSize
)
975 AnsiString
->Length
= 0;
976 AnsiString
->MaximumLength
= BufferSize
;
977 AnsiString
->Buffer
= Buffer
;
982 RtlInitEmptyUnicodeString(
983 OUT PUNICODE_STRING UnicodeString
,
985 IN USHORT BufferSize
)
987 UnicodeString
->Length
= 0;
988 UnicodeString
->MaximumLength
= BufferSize
;
989 UnicodeString
->Buffer
= Buffer
;
992 #if defined(_AMD64_) || defined(_IA64_)
996 RtlExtendedIntegerMultiply(
997 LARGE_INTEGER Multiplicand
,
1001 ret
.QuadPart
= Multiplicand
.QuadPart
* Multiplier
;
1008 RtlExtendedLargeIntegerDivide(
1009 LARGE_INTEGER Dividend
,
1014 ret
.QuadPart
= (ULONG64
)Dividend
.QuadPart
/ Divisor
;
1016 *Remainder
= (ULONG
)(Dividend
.QuadPart
% Divisor
);
1021 #if defined(_AMD64_)
1023 #define MultiplyHigh __mulh
1024 #define UnsignedMultiplyHigh __umulh
1026 //DECLSPEC_DEPRECATED_DDK
1030 RtlExtendedMagicDivide(
1031 IN LARGE_INTEGER Dividend
,
1032 IN LARGE_INTEGER MagicDivisor
,
1033 IN CCHAR ShiftCount
)
1038 Pos
= (Dividend
.QuadPart
>= 0);
1039 ret64
= UnsignedMultiplyHigh(Pos
? Dividend
.QuadPart
: -Dividend
.QuadPart
,
1040 MagicDivisor
.QuadPart
);
1041 ret64
>>= ShiftCount
;
1042 ret
.QuadPart
= Pos
? ret64
: -ret64
;
1047 //DECLSPEC_DEPRECATED_DDK
1052 IN LARGE_INTEGER Addend1
,
1053 IN LARGE_INTEGER Addend2
)
1056 ret
.QuadPart
= Addend1
.QuadPart
+ Addend2
.QuadPart
;
1061 * RtlLargeIntegerAnd(
1062 * IN OUT LARGE_INTEGER Result,
1063 * IN LARGE_INTEGER Source,
1064 * IN LARGE_INTEGER Mask);
1066 #define RtlLargeIntegerAnd(Result, Source, Mask) \
1067 Result.QuadPart = Source.QuadPart & Mask.QuadPart
1069 //DECLSPEC_DEPRECATED_DDK
1073 RtlLargeIntegerArithmeticShift(
1074 IN LARGE_INTEGER LargeInteger
,
1075 IN CCHAR ShiftCount
)
1078 ret
.QuadPart
= LargeInteger
.QuadPart
>> ShiftCount
;
1083 * RtlLargeIntegerEqualTo(
1084 * IN LARGE_INTEGER Operand1,
1085 * IN LARGE_INTEGER Operand2);
1087 #define RtlLargeIntegerEqualTo(X,Y) \
1088 (!(((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart)))
1092 RtlSecureZeroMemory(
1096 volatile char* vptr
= (volatile char*)Pointer
;
1097 #if defined(_M_AMD64)
1098 __stosb((PUCHAR
)vptr
, 0, Size
);
1100 char * endptr
= (char *)vptr
+ Size
;
1101 while (vptr
< endptr
)
1109 #if defined(_M_AMD64)
1113 IN PRTL_BITMAP BitMapHeader
,
1114 IN ULONG BitPosition
)
1116 return BitTest((LONG CONST
*)BitMapHeader
->Buffer
, BitPosition
);
1119 #define RtlCheckBit(BMH,BP) (((((PLONG)(BMH)->Buffer)[(BP)/32]) >> ((BP)%32)) & 0x1)
1120 #endif // defined(_M_AMD64)
1122 #endif // !defined(MIDL_PASS)
1124 /* Byte Swap Functions */
1125 #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037 || defined(__GNUC__))) || \
1126 ((defined(_M_AMD64) || defined(_M_IA64)) \
1127 && (_MSC_FULL_VER > 13009175 || defined(__GNUC__)))
1129 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
1130 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
1131 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
1137 #define ASSERT(exp) \
1139 RtlAssert( (PVOID)#exp, (PVOID)__FILE__, __LINE__, NULL ), FALSE : TRUE)
1141 #define ASSERTMSG(msg, exp) \
1143 RtlAssert( (PVOID)#exp, (PVOID)__FILE__, __LINE__, msg ), FALSE : TRUE)
1145 #define RTL_SOFT_ASSERT(exp) \
1147 DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n", __FILE__, __LINE__, #exp), FALSE : TRUE)
1149 #define RTL_SOFT_ASSERTMSG(msg, exp) \
1151 DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n Message: %s\n", __FILE__, __LINE__, #exp, (msg)), FALSE : TRUE)
1153 #define RTL_VERIFY(exp) ASSERT(exp)
1154 #define RTL_VERIFYMSG(msg, exp) ASSERTMSG(msg, exp)
1156 #define RTL_SOFT_VERIFY(exp) RTL_SOFT_ASSERT(exp)
1157 #define RTL_SOFT_VERIFYMSG(msg, exp) RTL_SOFT_ASSERTMSG(msg, exp)
1159 #if defined(_MSC_VER)
1161 #define NT_ASSERT(exp) \
1163 (__annotation(L"Debug", L"AssertFail", L#exp), \
1164 DbgRaiseAssertionFailure(), FALSE) : TRUE)
1166 #define NT_ASSERTMSG(msg, exp) \
1168 (__annotation(L"Debug", L"AssertFail", L##msg), \
1169 DbgRaiseAssertionFailure(), FALSE) : TRUE)
1171 #define NT_ASSERTMSGW(msg, exp) \
1173 (__annotation(L"Debug", L"AssertFail", msg), \
1174 DbgRaiseAssertionFailure(), FALSE) : TRUE)
1178 /* GCC doesn't support __annotation (nor PDB) */
1179 #define NT_ASSERT(exp) \
1180 (VOID)((!(exp)) ? (DbgRaiseAssertionFailure(), FALSE) : TRUE)
1182 #define NT_ASSERTMSG NT_ASSERT
1183 #define NT_ASSERTMSGW NT_ASSERT
1189 #define ASSERT(exp) ((VOID) 0)
1190 #define ASSERTMSG(msg, exp) ((VOID) 0)
1192 #define RTL_SOFT_ASSERT(exp) ((VOID) 0)
1193 #define RTL_SOFT_ASSERTMSG(msg, exp) ((VOID) 0)
1195 #define RTL_VERIFY(exp) ((exp) ? TRUE : FALSE)
1196 #define RTL_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
1198 #define RTL_SOFT_VERIFY(exp) ((exp) ? TRUE : FALSE)
1199 #define RTL_SOFT_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
1201 #define NT_ASSERT(exp) ((VOID)0)
1202 #define NT_ASSERTMSG(exp) ((VOID)0)
1203 #define NT_ASSERTMSGW(exp) ((VOID)0)
1207 #if !defined(_WINBASE_)
1209 #if defined(_WIN64) && (defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_) || defined(_NTOSP_))
1213 InitializeSListHead(
1214 OUT PSLIST_HEADER SListHead
);
1220 InitializeSListHead(
1221 OUT PSLIST_HEADER SListHead
)
1224 ULONG64 FeatureBits
;
1228 if (((ULONG_PTR
)SListHead
& 0xf) != 0)
1230 RtlRaiseStatus(STATUS_DATATYPE_MISALIGNMENT
);
1234 RtlZeroMemory(SListHead
, sizeof(SLIST_HEADER
));
1237 FeatureBits
= __getReg(CV_IA64_CPUID4
);
1238 if ((FeatureBits
& KF_16BYTE_INSTR
) != 0)
1240 SListHead
->Header16
.HeaderType
= 1;
1241 SListHead
->Header16
.Init
= 1;
1250 #define InterlockedPopEntrySList(Head) \
1251 ExpInterlockedPopEntrySList(Head)
1253 #define InterlockedPushEntrySList(Head, Entry) \
1254 ExpInterlockedPushEntrySList(Head, Entry)
1256 #define InterlockedFlushSList(Head) \
1257 ExpInterlockedFlushSList(Head)
1259 #define QueryDepthSList(Head) \
1260 ExQueryDepthSList(Head)
1262 #else /* !defined(_WIN64) */
1267 InterlockedPopEntrySList(
1268 IN PSLIST_HEADER ListHead
);
1273 InterlockedPushEntrySList(
1274 IN PSLIST_HEADER ListHead
,
1275 IN PSLIST_ENTRY ListEntry
);
1277 #define InterlockedFlushSList(ListHead) \
1278 ExInterlockedFlushSList(ListHead)
1280 #define QueryDepthSList(Head) \
1281 ExQueryDepthSList(Head)
1283 #endif /* !defined(_WIN64) */
1285 #endif /* !defined(_WINBASE_) */