2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NDIS library
5 * PURPOSE: String management routines
6 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * Vizzini (vizzini@plasmic.com)
9 * CSH 01/08-2000 Created
10 * Vizzini 08-Oct-2003 Error checking, documentation, and formatting
18 #undef NdisAnsiStringToUnicodeString
21 NdisAnsiStringToUnicodeString(
22 IN OUT PNDIS_STRING DestinationString
,
23 IN PANSI_STRING SourceString
)
25 * FUNCTION: Converts an ANSI string to an NDIS (unicode) string
27 * DestinationString = Address of buffer to place converted string in
28 * SourceString = Pointer to ANSI string to be converted
30 * - caller must be running at IRQL = PASSIVE_LEVEL
34 ASSERT(DestinationString
);
37 return (NDIS_STATUS
)RtlAnsiStringToUnicodeString(
38 (PUNICODE_STRING
)DestinationString
,
39 (PANSI_STRING
)SourceString
, FALSE
);
46 #undef NdisEqualString
50 IN PNDIS_STRING String1
,
51 IN PNDIS_STRING String2
,
52 IN BOOLEAN CaseInsensitive
)
54 * FUNCTION: Tests two strings for equality
56 * String1 = Pointer to first string
57 * String2 = Pointer to second string
58 * CaseInsensitive = TRUE if the compare should be case insensitive
60 * - caller must be at IRQL = PASSIVE_LEVEL
67 return RtlEqualUnicodeString((PUNICODE_STRING
)String1
,
68 (PUNICODE_STRING
)String2
,
75 #undef NdisInitAnsiString
79 IN OUT PANSI_STRING DestinationString
,
80 IN PCSTR SourceString
)
82 * FUNCTION: Initializes an ANSI string
84 * DestinationString = Address of buffer to place string in
85 * SourceString = Pointer to null terminated ANSI string
87 * - Caller must be at IRQL <= DISPATCH_LEVEL
90 ASSERT(DestinationString
);
93 RtlInitString((PANSI_STRING
)DestinationString
, (PCSZ
)SourceString
);
101 NdisInitializeString(
102 IN OUT PNDIS_STRING DestinationString
,
103 IN PUCHAR SourceString
)
105 * FUNCTION: Initializes an NDIS (unicode) string
107 * DestinationString = Address of buffer to place string in
108 * SourceString = Pointer to null terminated ANSI string
110 * - Must be called at IRQL = PASSIVE_LEVEL
113 ANSI_STRING AnsiString
;
116 ASSERT(DestinationString
);
117 ASSERT(SourceString
);
119 RtlInitAnsiString(&AnsiString
, (PCSZ
)SourceString
);
121 RtlAnsiStringToUnicodeString((PUNICODE_STRING
)DestinationString
, &AnsiString
, TRUE
);
127 #undef NdisInitUnicodeString
130 NdisInitUnicodeString(
131 IN OUT PNDIS_STRING DestinationString
,
132 IN PCWSTR SourceString
)
134 * FUNCTION: Initializes an unicode string
136 * DestinationString = Address of buffer to place string in
137 * SourceString = Pointer to null terminated unicode string
139 * - call with IRQL <= DISPATCH_LEVEL
142 ASSERT(DestinationString
);
143 ASSERT(SourceString
);
145 RtlInitUnicodeString((PUNICODE_STRING
)DestinationString
, SourceString
);
151 #undef NdisUnicodeStringToAnsiString
154 NdisUnicodeStringToAnsiString(
155 IN OUT PANSI_STRING DestinationString
,
156 IN PNDIS_STRING SourceString
)
158 * FUNCTION: Converts an NDIS (unicode) string to an ANSI string
160 * DestinationString = Address of buffer to place converted string in
161 * SourceString = Pointer to unicode string to be converted
163 * - must be called at IRQL = PASSIVE_LEVEL
167 ASSERT(DestinationString
);
168 ASSERT(SourceString
);
170 return (NDIS_STATUS
)RtlUnicodeStringToAnsiString(
171 (PANSI_STRING
)DestinationString
,
172 (PUNICODE_STRING
)SourceString
,
179 #undef NdisUpcaseUnicodeString
182 NdisUpcaseUnicodeString(
183 OUT PUNICODE_STRING DestinationString
,
184 IN PUNICODE_STRING SourceString
)
186 * FUNCTION: Uppercase a UNICODE string
188 * DestinationString: caller-allocated space for the uppercased string
189 * SourceString: string to be uppercased
191 * - Currently requires caller to allocate destination string - XXX is this right?
192 * - callers must be running at IRQL = PASSIVE_LEVEL
196 ASSERT(SourceString
);
197 ASSERT(DestinationString
);
199 return RtlUpcaseUnicodeString (DestinationString
, SourceString
, FALSE
);