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
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
);
42 #undef NdisEqualString
51 IN PNDIS_STRING String1
,
52 IN PNDIS_STRING String2
,
53 IN BOOLEAN CaseInsensitive
)
55 * FUNCTION: Tests two strings for equality
57 * String1 = Pointer to first string
58 * String2 = Pointer to second string
59 * CaseInsensitive = TRUE if the compare should be case insensitive
61 * - caller must be at IRQL = PASSIVE_LEVEL
68 return RtlEqualUnicodeString((PUNICODE_STRING
)String1
,
69 (PUNICODE_STRING
)String2
,
80 IN OUT PANSI_STRING DestinationString
,
81 IN PCSTR SourceString
)
83 * FUNCTION: Initializes an ANSI string
85 * DestinationString = Address of buffer to place string in
86 * SourceString = Pointer to null terminated ANSI string
88 * - Caller must be at IRQL <= DISPATCH_LEVEL
91 ASSERT(DestinationString
);
94 RtlInitString((PANSI_STRING
)DestinationString
, (PCSZ
)SourceString
);
103 NdisInitializeString(
104 IN OUT PNDIS_STRING DestinationString
,
105 IN PUCHAR SourceString
)
107 * FUNCTION: Initializes an NDIS (unicode) string
109 * DestinationString = Address of buffer to place string in
110 * SourceString = Pointer to null terminated ANSI string
112 * - Must be called at IRQL = PASSIVE_LEVEL
115 ANSI_STRING AnsiString
;
118 ASSERT(DestinationString
);
119 ASSERT(SourceString
);
121 RtlInitAnsiString(&AnsiString
, (PCSZ
)SourceString
);
123 RtlAnsiStringToUnicodeString((PUNICODE_STRING
)DestinationString
, &AnsiString
, TRUE
);
132 NdisInitUnicodeString(
133 IN OUT PNDIS_STRING DestinationString
,
134 IN PCWSTR SourceString
)
136 * FUNCTION: Initializes an unicode string
138 * DestinationString = Address of buffer to place string in
139 * SourceString = Pointer to null terminated unicode string
141 * - call with IRQL <= DISPATCH_LEVEL
144 ASSERT(DestinationString
);
145 ASSERT(SourceString
);
147 RtlInitUnicodeString((PUNICODE_STRING
)DestinationString
, SourceString
);
156 NdisUnicodeStringToAnsiString(
157 IN OUT PANSI_STRING DestinationString
,
158 IN PNDIS_STRING SourceString
)
160 * FUNCTION: Converts an NDIS (unicode) string to an ANSI string
162 * DestinationString = Address of buffer to place converted string in
163 * SourceString = Pointer to unicode string to be converted
165 * - must be called at IRQL = PASSIVE_LEVEL
169 ASSERT(DestinationString
);
170 ASSERT(SourceString
);
172 return (NDIS_STATUS
)RtlUnicodeStringToAnsiString(
173 (PANSI_STRING
)DestinationString
,
174 (PUNICODE_STRING
)SourceString
,
184 NdisUpcaseUnicodeString(
185 OUT PUNICODE_STRING DestinationString
,
186 IN PUNICODE_STRING SourceString
)
188 * FUNCTION: Uppercase a UNICODE string
190 * DestinationString: caller-allocated space for the uppercased string
191 * SourceString: string to be uppercased
193 * - Currently requires caller to allocate destination string - XXX is this right?
194 * - callers must be running at IRQL = PASSIVE_LEVEL
198 ASSERT(SourceString
);
199 ASSERT(DestinationString
);
201 return RtlUpcaseUnicodeString (DestinationString
, SourceString
, FALSE
);