bd9fbb8183c579c2c929c8dfd2b8a696065a8dfa
[reactos.git] / reactos / drivers / net / ndis / ndis / string.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NDIS library
4 * FILE: ndis/string.c
5 * PURPOSE: String management routines
6 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * REVISIONS:
8 * CSH 01/08-2000 Created
9 */
10 #include <ndissys.h>
11
12
13 NDIS_STATUS
14 EXPORT
15 NdisAnsiStringToUnicodeString(
16 IN OUT PNDIS_STRING DestinationString,
17 IN PNDIS_ANSI_STRING SourceString)
18 /*
19 * FUNCTION: Converts an ANSI string to an NDIS (unicode) string
20 * ARGUMENTS:
21 * DestinationString = Address of buffer to place converted string in
22 * SourceString = Pointer to ANSI string to be converted
23 */
24 {
25 return (NDIS_STATUS)RtlAnsiStringToUnicodeString(
26 (PUNICODE_STRING)DestinationString,
27 (PANSI_STRING)SourceString, FALSE);
28 }
29
30
31 BOOLEAN
32 EXPORT
33 NdisEqualString(
34 IN PNDIS_STRING String1,
35 IN PNDIS_STRING String2,
36 IN BOOLEAN CaseInsensitive)
37 /*
38 * FUNCTION: Tests two strings for equality
39 * ARGUMENTS:
40 * String1 = Pointer to first string
41 * String2 = Pointer to second string
42 * CaseInsensitive = TRUE if the compare should be case insensitive
43 */
44 {
45 return RtlEqualUnicodeString(
46 (PUNICODE_STRING)String1,
47 (PUNICODE_STRING)String2,
48 CaseInsensitive);
49 }
50
51
52 VOID
53 EXPORT
54 NdisInitAnsiString(
55 IN OUT PNDIS_ANSI_STRING DestinationString,
56 IN PCSTR SourceString)
57 /*
58 * FUNCTION: Initializes an ANSI string
59 * ARGUMENTS:
60 * DestinationString = Address of buffer to place string in
61 * SourceString = Pointer to null terminated ANSI string
62 */
63 {
64 RtlInitString(
65 (PANSI_STRING)DestinationString,
66 (PCSZ)SourceString);
67 }
68
69
70 VOID
71 EXPORT
72 NdisInitializeString(
73 IN OUT PNDIS_STRING DestinationString,
74 IN PUCHAR SourceString)
75 /*
76 * FUNCTION: Initializes an NDIS (unicode) string
77 * ARGUMENTS:
78 * DestinationString = Address of buffer to place string in
79 * SourceString = Pointer to null terminated ANSI string
80 */
81 {
82 ANSI_STRING AnsiString;
83
84 RtlInitAnsiString(
85 &AnsiString,
86 (PCSZ)SourceString);
87
88 RtlAnsiStringToUnicodeString(
89 (PUNICODE_STRING)DestinationString,
90 &AnsiString,
91 TRUE);
92 }
93
94
95 VOID
96 EXPORT
97 NdisInitUnicodeString(
98 IN OUT PNDIS_STRING DestinationString,
99 IN PCWSTR SourceString)
100 /*
101 * FUNCTION: Initializes an unicode string
102 * ARGUMENTS:
103 * DestinationString = Address of buffer to place string in
104 * SourceString = Pointer to null terminated unicode string
105 */
106 {
107 RtlInitUnicodeString(
108 (PUNICODE_STRING)DestinationString,
109 SourceString);
110 }
111
112
113 NDIS_STATUS
114 EXPORT
115 NdisUnicodeStringToAnsiString(
116 IN OUT PNDIS_ANSI_STRING DestinationString,
117 IN PNDIS_STRING SourceString)
118 /*
119 * FUNCTION: Converts an NDIS (unicode) string to an ANSI string
120 * ARGUMENTS:
121 * DestinationString = Address of buffer to place converted string in
122 * SourceString = Pointer to unicode string to be converted
123 */
124 {
125 return (NDIS_STATUS)RtlUnicodeStringToAnsiString(
126 (PANSI_STRING)DestinationString,
127 (PUNICODE_STRING)SourceString,
128 FALSE);
129 }
130
131
132 NTSTATUS
133 EXPORT
134 NdisUpcaseUnicodeString(
135 OUT PUNICODE_STRING DestinationString,
136 IN PUNICODE_STRING SourceString)
137 /*
138 * FUNCTION:
139 * ARGUMENTS:
140 * NOTES:
141 * NDIS 5.0
142 */
143 {
144 UNIMPLEMENTED
145
146 return STATUS_NOT_IMPLEMENTED;
147 }
148
149 /* EOF */