-
Notifications
You must be signed in to change notification settings - Fork 24
/
ntrtl.h
101 lines (90 loc) · 3.52 KB
/
ntrtl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include "ntapi.h"
// Hacky case manipulation macros.
#define RTL_UPCASE(wch) ( \
((wch) < 'a' ? \
(wch) \
: \
((wch) <= 'z' ? \
(wch) - ('a'-'A') \
: \
((WCHAR)(wch)) \
) \
) \
)
#define RTL_DOWNCASE(wch) ( \
((wch) < 'A' ? \
(wch) \
: \
((wch) <= 'Z' ? \
(wch) + ('a'-'A') \
: \
((WCHAR)(wch)) \
) \
) \
)
//NTSYSAPI
LONG
NTAPI
RtlCompareUnicodeStrings(
IN CONST WCHAR* String1,
IN SIZE_T Length1,
IN CONST WCHAR* String2,
IN SIZE_T Length2,
IN BOOLEAN CaseInSensitive
);
#if !defined(_NTDDK_)
FORCEINLINE
LONG
NTAPI
RtlCompareUnicodeString(
IN PCUNICODE_STRING String1,
IN PCUNICODE_STRING String2,
IN BOOLEAN CaseInSensitive
)
{
return RtlCompareUnicodeStrings(String1->Buffer, String1->Length,
String2->Buffer, String2->Length,
CaseInSensitive);
}
_At_(DestinationString->Buffer, _Post_equal_to_(SourceString))
_At_(DestinationString->Length, _Post_equal_to_(_String_length_(SourceString) * sizeof(WCHAR)))
_At_(DestinationString->MaximumLength, _Post_equal_to_((_String_length_(SourceString)+1) * sizeof(WCHAR)))
//NTSYSAPI
VOID
NTAPI
RtlInitUnicodeString(
_Out_ PUNICODE_STRING DestinationString,
_In_opt_z_ PCWSTR SourceString
);
_At_(UnicodeString->Buffer, _Post_equal_to_(Buffer))
_At_(UnicodeString->Length, _Post_equal_to_(0))
_At_(UnicodeString->MaximumLength, _Post_equal_to_(BufferSize))
FORCEINLINE
VOID
RtlInitEmptyUnicodeString(
OUT PUNICODE_STRING UnicodeString,
IN _Writable_bytes_(BufferSize) _When_(BufferSize != 0, _Notnull_)
PWCHAR Buffer,
IN UINT16 BufferSize
)
{
memset(UnicodeString, 0, sizeof(*UnicodeString));
UnicodeString->MaximumLength = BufferSize;
UnicodeString->Buffer = Buffer;
}
_At_(AnsiString->Buffer, _Post_equal_to_(Buffer))
_At_(AnsiString->Length, _Post_equal_to_(0))
_At_(AnsiString->MaximumLength, _Post_equal_to_(BufferSize))
FORCEINLINE
VOID
RtlInitEmptyAnsiString(
OUT PANSI_STRING AnsiString,
IN _Pre_readable_size_(BufferSize) CHAR* Buffer,
IN UINT16 BufferSize
)
{
AnsiString->Length = 0;
AnsiString->MaximumLength = BufferSize;
AnsiString->Buffer = Buffer;
}
#endif // !_NTDDK_