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
20 NdisAnsiStringToUnicodeString(
21 IN OUT PNDIS_STRING DestinationString
,
22 IN PANSI_STRING SourceString
)
24 * FUNCTION: Converts an ANSI string to an NDIS (unicode) string
26 * DestinationString = Address of buffer to place converted string in
27 * SourceString = Pointer to ANSI string to be converted
29 * - caller must be running at IRQL = PASSIVE_LEVEL
33 ASSERT(DestinationString
);
36 return (NDIS_STATUS
)RtlAnsiStringToUnicodeString(
37 (PUNICODE_STRING
)DestinationString
,
38 (PANSI_STRING
)SourceString
, FALSE
);
48 IN PNDIS_STRING String1
,
49 IN PNDIS_STRING String2
,
50 IN BOOLEAN CaseInsensitive
)
52 * FUNCTION: Tests two strings for equality
54 * String1 = Pointer to first string
55 * String2 = Pointer to second string
56 * CaseInsensitive = TRUE if the compare should be case insensitive
58 * - caller must be at IRQL = PASSIVE_LEVEL
65 return RtlEqualUnicodeString((PUNICODE_STRING
)String1
,
66 (PUNICODE_STRING
)String2
,
77 IN OUT PANSI_STRING DestinationString
,
78 IN PCSTR SourceString
)
80 * FUNCTION: Initializes an ANSI string
82 * DestinationString = Address of buffer to place string in
83 * SourceString = Pointer to null terminated ANSI string
85 * - Caller must be at IRQL <= DISPATCH_LEVEL
88 ASSERT(DestinationString
);
91 RtlInitString((PANSI_STRING
)DestinationString
, (PCSZ
)SourceString
);
100 NdisInitializeString(
101 IN OUT PNDIS_STRING DestinationString
,
102 IN PUCHAR SourceString
)
104 * FUNCTION: Initializes an NDIS (unicode) string
106 * DestinationString = Address of buffer to place string in
107 * SourceString = Pointer to null terminated ANSI string
109 * - Must be called at IRQL = PASSIVE_LEVEL
112 ANSI_STRING AnsiString
;
115 ASSERT(DestinationString
);
116 ASSERT(SourceString
);
118 RtlInitAnsiString(&AnsiString
, (PCSZ
)SourceString
);
120 RtlAnsiStringToUnicodeString((PUNICODE_STRING
)DestinationString
, &AnsiString
, TRUE
);
129 NdisInitUnicodeString(
130 IN OUT PNDIS_STRING DestinationString
,
131 IN PCWSTR SourceString
)
133 * FUNCTION: Initializes an unicode string
135 * DestinationString = Address of buffer to place string in
136 * SourceString = Pointer to null terminated unicode string
138 * - call with IRQL <= DISPATCH_LEVEL
141 ASSERT(DestinationString
);
142 ASSERT(SourceString
);
144 RtlInitUnicodeString((PUNICODE_STRING
)DestinationString
, SourceString
);
153 NdisUnicodeStringToAnsiString(
154 IN OUT PANSI_STRING DestinationString
,
155 IN PNDIS_STRING SourceString
)
157 * FUNCTION: Converts an NDIS (unicode) string to an ANSI string
159 * DestinationString = Address of buffer to place converted string in
160 * SourceString = Pointer to unicode string to be converted
162 * - must be called at IRQL = PASSIVE_LEVEL
166 ASSERT(DestinationString
);
167 ASSERT(SourceString
);
169 return (NDIS_STATUS
)RtlUnicodeStringToAnsiString(
170 (PANSI_STRING
)DestinationString
,
171 (PUNICODE_STRING
)SourceString
,
181 NdisUpcaseUnicodeString(
182 OUT PUNICODE_STRING DestinationString
,
183 IN PUNICODE_STRING SourceString
)
185 * FUNCTION: Uppercase a UNICODE string
187 * DestinationString: caller-allocated space for the uppercased string
188 * SourceString: string to be uppercased
190 * - Currently requires caller to allocate destination string - XXX is this right?
191 * - callers must be running at IRQL = PASSIVE_LEVEL
195 ASSERT(SourceString
);
196 ASSERT(DestinationString
);
198 return RtlUpcaseUnicodeString (DestinationString
, SourceString
, FALSE
);