4 * Copyright 2010 Pierre Schweitzer <pierre.schweitzer@reactos.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; see the file COPYING.LIB.
18 * If not, write to the Free Software Foundation,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 /* INCLUDES *******************************************************************/
30 /* PRIVATE FUNCTIONS **********************************************************/
32 VOID
FsRtlIsNameInExpressionTest()
34 UNICODE_STRING Expression
, Name
;
36 RtlInitUnicodeString(&Expression
, L
"*");
37 RtlInitUnicodeString(&Name
, L
"");
38 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
39 RtlInitUnicodeString(&Expression
, L
"");
40 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
42 RtlInitUnicodeString(&Expression
, L
"ntdll.dll");
43 RtlInitUnicodeString(&Name
, L
".");
44 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
45 RtlInitUnicodeString(&Name
, L
"~1");
46 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
47 RtlInitUnicodeString(&Name
, L
"..");
48 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
49 RtlInitUnicodeString(&Name
, L
"ntdll.dll");
50 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
52 RtlInitUnicodeString(&Expression
, L
"smss.exe");
53 RtlInitUnicodeString(&Name
, L
".");
54 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
55 RtlInitUnicodeString(&Name
, L
"~1");
56 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
57 RtlInitUnicodeString(&Name
, L
"..");
58 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
59 RtlInitUnicodeString(&Name
, L
"ntdll.dll");
60 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
61 RtlInitUnicodeString(&Name
, L
"NTDLL.dll");
62 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
64 RtlInitUnicodeString(&Expression
, L
"nt??krnl.???");
65 RtlInitUnicodeString(&Name
, L
"ntoskrnl.exe");
66 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
68 RtlInitUnicodeString(&Expression
, L
"he*o");
69 RtlInitUnicodeString(&Name
, L
"hello");
70 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
71 RtlInitUnicodeString(&Name
, L
"helo");
72 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
73 RtlInitUnicodeString(&Name
, L
"hella");
74 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
76 RtlInitUnicodeString(&Expression
, L
"he*");
77 RtlInitUnicodeString(&Name
, L
"hello");
78 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
79 RtlInitUnicodeString(&Name
, L
"helo");
80 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
81 RtlInitUnicodeString(&Name
, L
"hella");
82 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
84 RtlInitUnicodeString(&Expression
, L
"*.cpl");
85 RtlInitUnicodeString(&Name
, L
"kdcom.dll");
86 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
87 RtlInitUnicodeString(&Name
, L
"bootvid.dll");
88 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
89 RtlInitUnicodeString(&Name
, L
"ntoskrnl.exe");
90 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
92 RtlInitUnicodeString(&Expression
, L
".");
93 RtlInitUnicodeString(&Name
, L
"NTDLL.DLL");
94 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
96 RtlInitUnicodeString(&Expression
, L
"F0_*.*");
97 RtlInitUnicodeString(&Name
, L
".");
98 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
99 RtlInitUnicodeString(&Name
, L
"..");
100 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
101 RtlInitUnicodeString(&Name
, L
"SETUP.EXE");
102 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
103 RtlInitUnicodeString(&Name
, L
"F0_001");
104 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
106 RtlInitUnicodeString(&Expression
, L
"*.TTF");
107 RtlInitUnicodeString(&Name
, L
".");
108 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
109 RtlInitUnicodeString(&Name
, L
"..");
110 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
111 RtlInitUnicodeString(&Name
, L
"SETUP.INI");
112 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
114 RtlInitUnicodeString(&Expression
, L
"*");
115 RtlInitUnicodeString(&Name
, L
".");
116 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
117 RtlInitUnicodeString(&Name
, L
"..");
118 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
119 RtlInitUnicodeString(&Name
, L
"SETUP.INI");
120 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
122 RtlInitUnicodeString(&Expression
, L
"\"ntoskrnl.exe");
123 RtlInitUnicodeString(&Name
, L
"ntoskrnl.exe");
124 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
125 RtlInitUnicodeString(&Expression
, L
"ntoskrnl\"exe");
126 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
127 RtlInitUnicodeString(&Expression
, L
"ntoskrn\".exe");
128 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
129 RtlInitUnicodeString(&Expression
, L
"ntoskrn\"\"exe");
130 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
131 RtlInitUnicodeString(&Expression
, L
"ntoskrnl.\"exe");
132 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == FALSE
, "expected FALSE, got TRUE");
133 RtlInitUnicodeString(&Expression
, L
"ntoskrnl.exe\"");
134 RtlInitUnicodeString(&Name
, L
"ntoskrnl.exe");
135 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
136 RtlInitUnicodeString(&Name
, L
"ntoskrnl.exe.");
137 ok(FsRtlIsNameInExpression(&Expression
, &Name
, FALSE
, NULL
) == TRUE
, "expected TRUE, got FALSE");
140 VOID
FsRtlIsDbcsInExpressionTest()
142 ANSI_STRING Expression
, Name
;
144 RtlInitAnsiString(&Expression
, "*");
145 RtlInitAnsiString(&Name
, "");
146 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
147 RtlInitAnsiString(&Expression
, "");
148 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
150 RtlInitAnsiString(&Expression
, "ntdll.dll");
151 RtlInitAnsiString(&Name
, ".");
152 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
153 RtlInitAnsiString(&Name
, "~1");
154 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
155 RtlInitAnsiString(&Name
, "..");
156 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
157 RtlInitAnsiString(&Name
, "ntdll.dll");
158 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
160 RtlInitAnsiString(&Expression
, "smss.exe");
161 RtlInitAnsiString(&Name
, ".");
162 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
163 RtlInitAnsiString(&Name
, "~1");
164 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
165 RtlInitAnsiString(&Name
, "..");
166 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
167 RtlInitAnsiString(&Name
, "ntdll.dll");
168 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
169 RtlInitAnsiString(&Name
, "NTDLL.dll");
170 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
172 RtlInitAnsiString(&Expression
, "nt??krnl.???");
173 RtlInitAnsiString(&Name
, "ntoskrnl.exe");
174 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
176 RtlInitAnsiString(&Expression
, "he*o");
177 RtlInitAnsiString(&Name
, "hello");
178 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
179 RtlInitAnsiString(&Name
, "helo");
180 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
181 RtlInitAnsiString(&Name
, "hella");
182 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
184 RtlInitAnsiString(&Expression
, "he*");
185 RtlInitAnsiString(&Name
, "hello");
186 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
187 RtlInitAnsiString(&Name
, "helo");
188 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
189 RtlInitAnsiString(&Name
, "hella");
190 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
192 RtlInitAnsiString(&Expression
, "*.cpl");
193 RtlInitAnsiString(&Name
, "kdcom.dll");
194 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
195 RtlInitAnsiString(&Name
, "bootvid.dll");
196 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
197 RtlInitAnsiString(&Name
, "ntoskrnl.exe");
198 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
200 RtlInitAnsiString(&Expression
, ".");
201 RtlInitAnsiString(&Name
, "NTDLL.DLL");
202 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
204 RtlInitAnsiString(&Expression
, "F0_*.*");
205 RtlInitAnsiString(&Name
, ".");
206 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
207 RtlInitAnsiString(&Name
, "..");
208 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
209 RtlInitAnsiString(&Name
, "SETUP.EXE");
210 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
211 RtlInitAnsiString(&Name
, "F0_001");
212 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
214 RtlInitAnsiString(&Expression
, "*.TTF");
215 RtlInitAnsiString(&Name
, ".");
216 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
217 RtlInitAnsiString(&Name
, "..");
218 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
219 RtlInitAnsiString(&Name
, "SETUP.INI");
220 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
222 RtlInitAnsiString(&Expression
, "*");
223 RtlInitAnsiString(&Name
, ".");
224 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
225 RtlInitAnsiString(&Name
, "..");
226 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
227 RtlInitAnsiString(&Name
, "SETUP.INI");
228 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
230 RtlInitAnsiString(&Expression
, "\"ntoskrnl.exe");
231 RtlInitAnsiString(&Name
, "ntoskrnl.exe");
232 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
233 RtlInitAnsiString(&Expression
, "ntoskrnl\"exe");
234 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
235 RtlInitAnsiString(&Expression
, "ntoskrn\".exe");
236 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
237 RtlInitAnsiString(&Expression
, "ntoskrn\"\"exe");
238 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
239 RtlInitAnsiString(&Expression
, "ntoskrnl.\"exe");
240 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == FALSE
, "expected FALSE, got TRUE");
241 RtlInitAnsiString(&Expression
, "ntoskrnl.exe\"");
242 RtlInitAnsiString(&Name
, "ntoskrnl.exe");
243 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
244 RtlInitAnsiString(&Name
, "ntoskrnl.exe.");
245 ok(FsRtlIsDbcsInExpression(&Expression
, &Name
) == TRUE
, "expected TRUE, got FALSE");
248 /* PUBLIC FUNCTIONS ***********************************************************/
251 NtoskrnlFsRtlTest(HANDLE KeyHandle
)
253 FsRtlIsNameInExpressionTest();
254 FsRtlIsDbcsInExpressionTest();
256 FinishTest(KeyHandle
, L
"FsRtlTest");