9c38b7ed17bf7b66ea90f8f5c42c5a51f18e893a
[reactos.git] / rostests / kmtests / ntos_fsrtl / FsRtlExpression.c
1 /*
2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: LGPLv2+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite FsRtl Test
5 * PROGRAMMER: Pierre Schweitzer <pierre.schweitzer@reactos.org>
6 */
7
8 /* TODO: most of these calls fail the Windows checked build's !islower assertion and others */
9
10 #include <kmt_test.h>
11
12 #define NDEBUG
13 #include <debug.h>
14
15 static VOID FsRtlIsNameInExpressionTest()
16 {
17 UNICODE_STRING Expression, Name;
18
19 /* !Name->Length || !Expression->Length asserts */
20 if (!KmtIsCheckedBuild)
21 {
22 RtlInitUnicodeString(&Expression, L"*");
23 RtlInitUnicodeString(&Name, L"");
24 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
25 RtlInitUnicodeString(&Expression, L"");
26 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
27 }
28
29 RtlInitUnicodeString(&Expression, L"**");
30 if (!KmtIsCheckedBuild)
31 {
32 RtlInitUnicodeString(&Name, L"");
33 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
34 }
35 RtlInitUnicodeString(&Name, L"a");
36 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
37
38 RtlInitUnicodeString(&Expression, L"ntdll.dll");
39 RtlInitUnicodeString(&Name, L".");
40 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
41 RtlInitUnicodeString(&Name, L"~1");
42 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
43 RtlInitUnicodeString(&Name, L"..");
44 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
45 RtlInitUnicodeString(&Name, L"ntdll.dll");
46 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
47
48 RtlInitUnicodeString(&Expression, L"smss.exe");
49 RtlInitUnicodeString(&Name, L".");
50 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
51 RtlInitUnicodeString(&Name, L"~1");
52 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
53 RtlInitUnicodeString(&Name, L"..");
54 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
55 RtlInitUnicodeString(&Name, L"ntdll.dll");
56 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
57 RtlInitUnicodeString(&Name, L"NTDLL.dll");
58 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
59
60 RtlInitUnicodeString(&Expression, L"nt??krnl.???");
61 RtlInitUnicodeString(&Name, L"ntoskrnl.exe");
62 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
63
64 RtlInitUnicodeString(&Expression, L"he*o");
65 RtlInitUnicodeString(&Name, L"hello");
66 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
67 RtlInitUnicodeString(&Name, L"helo");
68 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
69 RtlInitUnicodeString(&Name, L"hella");
70 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
71
72 RtlInitUnicodeString(&Expression, L"he*");
73 RtlInitUnicodeString(&Name, L"hello");
74 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
75 RtlInitUnicodeString(&Name, L"helo");
76 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
77 RtlInitUnicodeString(&Name, L"hella");
78 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
79
80 RtlInitUnicodeString(&Expression, L"*.cpl");
81 RtlInitUnicodeString(&Name, L"kdcom.dll");
82 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
83 RtlInitUnicodeString(&Name, L"bootvid.dll");
84 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
85 RtlInitUnicodeString(&Name, L"ntoskrnl.exe");
86 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
87
88 RtlInitUnicodeString(&Expression, L".");
89 RtlInitUnicodeString(&Name, L"NTDLL.DLL");
90 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
91
92 RtlInitUnicodeString(&Expression, L"F0_*.*");
93 RtlInitUnicodeString(&Name, L".");
94 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
95 RtlInitUnicodeString(&Name, L"..");
96 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
97 RtlInitUnicodeString(&Name, L"SETUP.EXE");
98 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
99 RtlInitUnicodeString(&Name, L"f0_");
100 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
101 RtlInitUnicodeString(&Name, L"f0_");
102 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
103 RtlInitUnicodeString(&Name, L"F0_");
104 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
105 RtlInitUnicodeString(&Name, L"f0_.");
106 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
107 RtlInitUnicodeString(&Name, L"f0_.");
108 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
109 RtlInitUnicodeString(&Name, L"F0_.");
110 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
111 RtlInitUnicodeString(&Name, L"F0_001");
112 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
113 RtlInitUnicodeString(&Name, L"F0_001");
114 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
115 RtlInitUnicodeString(&Name, L"f0_001");
116 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
117 RtlInitUnicodeString(&Name, L"f0_001");
118 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
119 RtlInitUnicodeString(&Name, L"F0_001.");
120 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
121 RtlInitUnicodeString(&Name, L"f0_001.txt");
122 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
123 RtlInitUnicodeString(&Name, L"f0_001.txt");
124 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
125 RtlInitUnicodeString(&Name, L"F0_001.txt");
126 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
127 RtlInitUnicodeString(&Name, L"F0_001.txt");
128 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
129 RtlInitUnicodeString(&Name, L"F0_001.txt");
130 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
131
132 RtlInitUnicodeString(&Expression, L"F0_*.");
133 RtlInitUnicodeString(&Name, L".");
134 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
135 RtlInitUnicodeString(&Name, L"..");
136 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
137 RtlInitUnicodeString(&Name, L"SETUP.EXE");
138 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
139 RtlInitUnicodeString(&Name, L"f0_");
140 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
141 RtlInitUnicodeString(&Name, L"f0_");
142 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
143 RtlInitUnicodeString(&Name, L"F0_");
144 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
145 RtlInitUnicodeString(&Name, L"f0_.");
146 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
147 RtlInitUnicodeString(&Name, L"f0_.");
148 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
149 RtlInitUnicodeString(&Name, L"F0_.");
150 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
151 RtlInitUnicodeString(&Name, L"F0_001");
152 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
153 RtlInitUnicodeString(&Name, L"F0_001");
154 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
155 RtlInitUnicodeString(&Name, L"f0_001");
156 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
157 RtlInitUnicodeString(&Name, L"f0_001");
158 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
159 RtlInitUnicodeString(&Name, L"F0_OO1.");
160 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
161 RtlInitUnicodeString(&Name, L"f0_001.txt");
162 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
163 RtlInitUnicodeString(&Name, L"f0_001.txt");
164 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
165 RtlInitUnicodeString(&Name, L"F0_001.txt");
166 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
167 RtlInitUnicodeString(&Name, L"F0_001.txt");
168 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == FALSE, "expected FALSE, got TRUE\n");
169
170 RtlInitUnicodeString(&Expression, L"F0_<\"*");
171 RtlInitUnicodeString(&Name, L".");
172 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
173 RtlInitUnicodeString(&Name, L"..");
174 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
175 RtlInitUnicodeString(&Name, L"SETUP.EXE");
176 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
177 RtlInitUnicodeString(&Name, L"f0_");
178 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
179 RtlInitUnicodeString(&Name, L"f0_");
180 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
181 RtlInitUnicodeString(&Name, L"F0_");
182 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
183 RtlInitUnicodeString(&Name, L"f0_.");
184 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
185 RtlInitUnicodeString(&Name, L"f0_.");
186 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
187 RtlInitUnicodeString(&Name, L"F0_.");
188 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
189 RtlInitUnicodeString(&Name, L"F0_001");
190 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
191 RtlInitUnicodeString(&Name, L"F0_001");
192 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
193 RtlInitUnicodeString(&Name, L"f0_001");
194 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
195 RtlInitUnicodeString(&Name, L"f0_001");
196 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
197 RtlInitUnicodeString(&Name, L"F0_OO1.");
198 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
199 RtlInitUnicodeString(&Name, L"f0_001.txt");
200 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
201 RtlInitUnicodeString(&Name, L"f0_001.txt");
202 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
203 RtlInitUnicodeString(&Name, L"F0_001.txt");
204 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
205 RtlInitUnicodeString(&Name, L"F0_001.txt");
206 ok(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL) == TRUE, "expected TRUE, got FALSE\n");
207
208 RtlInitUnicodeString(&Expression, L"*.TTF");
209 RtlInitUnicodeString(&Name, L".");
210 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
211 RtlInitUnicodeString(&Name, L"..");
212 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
213 RtlInitUnicodeString(&Name, L"SETUP.INI");
214 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
215
216 RtlInitUnicodeString(&Expression, L"*");
217 RtlInitUnicodeString(&Name, L".");
218 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
219 RtlInitUnicodeString(&Name, L"..");
220 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
221 RtlInitUnicodeString(&Name, L"SETUP.INI");
222 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
223
224 RtlInitUnicodeString(&Expression, L".*");
225 RtlInitUnicodeString(&Name, L"1");
226 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
227 RtlInitUnicodeString(&Name, L"01");
228 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
229 RtlInitUnicodeString(&Name, L" ");
230 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
231 RtlInitUnicodeString(&Name, L"");
232 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
233 RtlInitUnicodeString(&Name, L".");
234 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
235 RtlInitUnicodeString(&Name, L"1.txt");
236 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
237 RtlInitUnicodeString(&Name, L" .txt");
238 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
239 RtlInitUnicodeString(&Name, L".txt");
240 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
241
242 RtlInitUnicodeString(&Expression, L"\"ntoskrnl.exe");
243 RtlInitUnicodeString(&Name, L"ntoskrnl.exe");
244 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
245 RtlInitUnicodeString(&Expression, L"ntoskrnl\"exe");
246 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
247 RtlInitUnicodeString(&Expression, L"ntoskrn\".exe");
248 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
249 RtlInitUnicodeString(&Expression, L"ntoskrn\"\"exe");
250 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
251 RtlInitUnicodeString(&Expression, L"ntoskrnl.\"exe");
252 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
253 RtlInitUnicodeString(&Expression, L"ntoskrnl.exe\"");
254 RtlInitUnicodeString(&Name, L"ntoskrnl.exe");
255 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
256 RtlInitUnicodeString(&Name, L"ntoskrnl.exe.");
257 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
258
259 RtlInitUnicodeString(&Expression, L"*.c.d");
260 RtlInitUnicodeString(&Name, L"a.b.c.d");
261 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
262 RtlInitUnicodeString(&Expression, L"*.?.c.d");
263 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
264 RtlInitUnicodeString(&Expression, L"*?");
265 if (!KmtIsCheckedBuild)
266 {
267 RtlInitUnicodeString(&Name, L"");
268 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
269 }
270 RtlInitUnicodeString(&Name, L"a");
271 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
272 RtlInitUnicodeString(&Name, L"aa");
273 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
274 RtlInitUnicodeString(&Name, L"aaa");
275 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
276 RtlInitUnicodeString(&Expression, L"?*?");
277 if (!KmtIsCheckedBuild)
278 {
279 RtlInitUnicodeString(&Name, L"");
280 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
281 }
282 RtlInitUnicodeString(&Name, L"a");
283 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
284 RtlInitUnicodeString(&Name, L"aa");
285 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
286 RtlInitUnicodeString(&Name, L"aaa");
287 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
288 RtlInitUnicodeString(&Name, L"aaaa");
289 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
290
291 /* Tests from #5923 */
292 RtlInitUnicodeString(&Expression, L"C:\\ReactOS\\**");
293 RtlInitUnicodeString(&Name, L"C:\\ReactOS\\dings.bmp");
294 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
295 RtlInitUnicodeString(&Expression, L"C:\\ReactOS\\***");
296 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
297 RtlInitUnicodeString(&Expression, L"C:\\Windows\\*a*");
298 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
299
300 RtlInitUnicodeString(&Expression, L"C:\\ReactOS\\*.bmp");
301 RtlInitUnicodeString(&Name, L"C:\\Windows\\explorer.exe");
302 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
303 RtlInitUnicodeString(&Expression, L"*.bmp;*.dib");
304 RtlInitUnicodeString(&Name, L"winhlp32.exe");
305 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
306
307 /* Backtracking tests */
308 RtlInitUnicodeString(&Expression, L"*.*.*.*");
309 RtlInitUnicodeString(&Name, L"127.0.0.1");
310 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
311
312 RtlInitUnicodeString(&Expression, L"*?*?*?*");
313 RtlInitUnicodeString(&Name, L"1.0.0.1");
314 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
315 RtlInitUnicodeString(&Expression, L"?*?*?*?");
316 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
317 RtlInitUnicodeString(&Expression, L"?.?.?.?");
318 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
319
320 RtlInitUnicodeString(&Expression, L"*a*ab*abc");
321 RtlInitUnicodeString(&Name, L"aabaabcdadabdabc");
322 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
323
324 /* Tests for extra wildcards */
325 RtlInitUnicodeString(&Expression, L"ab<exe");
326 RtlInitUnicodeString(&Name, L"abcd.exe");
327 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
328 RtlInitUnicodeString(&Name, L"ab.exe");
329 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
330 RtlInitUnicodeString(&Name, L"abcdexe");
331 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
332 RtlInitUnicodeString(&Name, L"acd.exe");
333 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
334 RtlInitUnicodeString(&Expression, L"a.b<exe");
335 RtlInitUnicodeString(&Name, L"a.bcd.exe");
336 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
337 RtlInitUnicodeString(&Expression, L"a<b.exe");
338 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
339 RtlInitUnicodeString(&Name, L"a.b.exe");
340 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
341
342 RtlInitUnicodeString(&Expression, L"abc.exe\"");
343 RtlInitUnicodeString(&Name, L"abc.exe");
344 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
345 RtlInitUnicodeString(&Name, L"abc.exe.");
346 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
347 RtlInitUnicodeString(&Name, L"abc.exe.back");
348 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
349 RtlInitUnicodeString(&Name, L"abc.exes");
350 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
351
352 RtlInitUnicodeString(&Expression, L"a>c.exe");
353 RtlInitUnicodeString(&Name, L"abc.exe");
354 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
355 RtlInitUnicodeString(&Name, L"ac.exe");
356 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
357 RtlInitUnicodeString(&Expression, L"a>>>exe");
358 RtlInitUnicodeString(&Name, L"abc.exe");
359 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
360 RtlInitUnicodeString(&Name, L"ac.exe");
361 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE\n");
362
363 RtlInitUnicodeString(&Expression, L"<.exe");
364 RtlInitUnicodeString(&Name, L"test.exe");
365 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE\n");
366 }
367
368 static VOID FsRtlIsDbcsInExpressionTest()
369 {
370 ANSI_STRING Expression, Name;
371
372 if (!KmtIsCheckedBuild)
373 {
374 RtlInitAnsiString(&Expression, "*");
375 RtlInitAnsiString(&Name, "");
376 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
377 RtlInitAnsiString(&Expression, "");
378 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
379 }
380
381 RtlInitAnsiString(&Expression, "**");
382 if (!KmtIsCheckedBuild)
383 {
384 RtlInitAnsiString(&Name, "");
385 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
386 }
387 RtlInitAnsiString(&Name, "a");
388 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
389
390 RtlInitAnsiString(&Expression, "ntdll.dll");
391 RtlInitAnsiString(&Name, ".");
392 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
393 RtlInitAnsiString(&Name, "~1");
394 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
395 RtlInitAnsiString(&Name, "..");
396 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
397 RtlInitAnsiString(&Name, "ntdll.dll");
398 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
399
400 RtlInitAnsiString(&Expression, "smss.exe");
401 RtlInitAnsiString(&Name, ".");
402 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
403 RtlInitAnsiString(&Name, "~1");
404 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
405 RtlInitAnsiString(&Name, "..");
406 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
407 RtlInitAnsiString(&Name, "ntdll.dll");
408 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
409 RtlInitAnsiString(&Name, "NTDLL.dll");
410 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
411
412 RtlInitAnsiString(&Expression, "nt??krnl.???");
413 RtlInitAnsiString(&Name, "ntoskrnl.exe");
414 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
415
416 RtlInitAnsiString(&Expression, "he*o");
417 RtlInitAnsiString(&Name, "hello");
418 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
419 RtlInitAnsiString(&Name, "helo");
420 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
421 RtlInitAnsiString(&Name, "hella");
422 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
423
424 RtlInitAnsiString(&Expression, "he*");
425 RtlInitAnsiString(&Name, "hello");
426 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
427 RtlInitAnsiString(&Name, "helo");
428 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
429 RtlInitAnsiString(&Name, "hella");
430 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
431
432 RtlInitAnsiString(&Expression, "*.cpl");
433 RtlInitAnsiString(&Name, "kdcom.dll");
434 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
435 RtlInitAnsiString(&Name, "bootvid.dll");
436 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
437 RtlInitAnsiString(&Name, "ntoskrnl.exe");
438 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
439
440 RtlInitAnsiString(&Expression, ".");
441 RtlInitAnsiString(&Name, "NTDLL.DLL");
442 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
443
444 RtlInitAnsiString(&Expression, "F0_*.*");
445 RtlInitAnsiString(&Name, ".");
446 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
447 RtlInitAnsiString(&Name, "..");
448 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
449 RtlInitAnsiString(&Name, "SETUP.EXE");
450 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
451 RtlInitAnsiString(&Name, "f0_");
452 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
453 RtlInitAnsiString(&Name, "F0_");
454 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
455 RtlInitAnsiString(&Name, "f0_.");
456 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
457 RtlInitAnsiString(&Name, "F0_.");
458 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
459 RtlInitAnsiString(&Name, "F0_001");
460 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
461
462 RtlInitAnsiString(&Name, "f0_001");
463 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
464 RtlInitAnsiString(&Name, "F0_001.");
465 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
466 RtlInitAnsiString(&Name, "f0_001.txt");
467 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
468 RtlInitAnsiString(&Name, "F0_001.txt");
469 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
470
471 RtlInitAnsiString(&Expression, "F0_*.");
472 RtlInitAnsiString(&Name, ".");
473 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
474 RtlInitAnsiString(&Name, "..");
475 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
476 RtlInitAnsiString(&Name, "SETUP.EXE");
477 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
478 RtlInitAnsiString(&Name, "f0_");
479 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
480 RtlInitAnsiString(&Name, "F0_");
481 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
482 RtlInitAnsiString(&Name, "f0_.");
483 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
484 RtlInitAnsiString(&Name, "F0_.");
485 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
486 RtlInitAnsiString(&Name, "F0_001");
487 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
488 RtlInitAnsiString(&Name, "f0_001");
489 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
490 RtlInitAnsiString(&Name, "F0_OO1.");
491 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
492 RtlInitAnsiString(&Name, "f0_001.txt");
493 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
494 RtlInitAnsiString(&Name, "F0_001.txt");
495 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
496
497 RtlInitAnsiString(&Expression, "F0_<\"*");
498 RtlInitAnsiString(&Name, ".");
499 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
500 RtlInitAnsiString(&Name, "..");
501 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
502 RtlInitAnsiString(&Name, "SETUP.EXE");
503 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
504 RtlInitAnsiString(&Name, "f0_");
505 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
506 RtlInitAnsiString(&Name, "F0_");
507 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
508 RtlInitAnsiString(&Name, "f0_.");
509 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
510 RtlInitAnsiString(&Name, "F0_.");
511 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
512 RtlInitAnsiString(&Name, "F0_001");
513 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
514 RtlInitAnsiString(&Name, "f0_001");
515 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
516 RtlInitAnsiString(&Name, "F0_OO1.");
517 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
518 RtlInitAnsiString(&Name, "f0_001.txt");
519 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
520 RtlInitAnsiString(&Name, "F0_001.txt");
521 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
522
523 RtlInitAnsiString(&Expression, "*.TTF");
524 RtlInitAnsiString(&Name, ".");
525 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
526 RtlInitAnsiString(&Name, "..");
527 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
528 RtlInitAnsiString(&Name, "SETUP.INI");
529 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
530
531 RtlInitAnsiString(&Expression, "*");
532 RtlInitAnsiString(&Name, ".");
533 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
534 RtlInitAnsiString(&Name, "..");
535 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
536 RtlInitAnsiString(&Name, "SETUP.INI");
537 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
538
539 RtlInitAnsiString(&Expression, ".*");
540 RtlInitAnsiString(&Name, "1");
541 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
542 RtlInitAnsiString(&Name, "01");
543 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
544 RtlInitAnsiString(&Name, " ");
545 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
546
547 if (!KmtIsCheckedBuild)
548 {
549 RtlInitAnsiString(&Name, "");
550 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
551 }
552 RtlInitAnsiString(&Name, ".");
553 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
554 RtlInitAnsiString(&Name, "1.txt");
555 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
556 RtlInitAnsiString(&Name, " .txt");
557 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
558 RtlInitAnsiString(&Name, ".txt");
559 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
560
561 RtlInitAnsiString(&Expression, "\"ntoskrnl.exe");
562 RtlInitAnsiString(&Name, "ntoskrnl.exe");
563 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
564 RtlInitAnsiString(&Expression, "ntoskrnl\"exe");
565 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
566 RtlInitAnsiString(&Expression, "ntoskrn\".exe");
567 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
568 RtlInitAnsiString(&Expression, "ntoskrn\"\"exe");
569 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
570 RtlInitAnsiString(&Expression, "ntoskrnl.\"exe");
571 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
572 RtlInitAnsiString(&Expression, "ntoskrnl.exe\"");
573 RtlInitAnsiString(&Name, "ntoskrnl.exe");
574 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
575 RtlInitAnsiString(&Name, "ntoskrnl.exe.");
576 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
577
578 RtlInitAnsiString(&Expression, "*.c.d");
579 RtlInitAnsiString(&Name, "a.b.c.d");
580 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
581 RtlInitAnsiString(&Expression, "*.?.c.d");
582 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
583 RtlInitAnsiString(&Expression, "*?");
584 if (!KmtIsCheckedBuild)
585 {
586 RtlInitAnsiString(&Name, "");
587 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
588 }
589 RtlInitAnsiString(&Name, "a");
590 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
591 RtlInitAnsiString(&Name, "aa");
592 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
593 RtlInitAnsiString(&Name, "aaa");
594 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
595 RtlInitAnsiString(&Expression, "?*?");
596 if (!KmtIsCheckedBuild)
597 {
598 RtlInitAnsiString(&Name, "");
599 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
600 }
601 RtlInitAnsiString(&Name, "a");
602 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
603 RtlInitAnsiString(&Name, "aa");
604 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
605 RtlInitAnsiString(&Name, "aaa");
606 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
607 RtlInitAnsiString(&Name, "aaaa");
608 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
609
610 /* Tests from #5923 */
611 RtlInitAnsiString(&Expression, "C:\\ReactOS\\**");
612 RtlInitAnsiString(&Name, "C:\\ReactOS\\dings.bmp");
613 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
614 RtlInitAnsiString(&Expression, "C:\\ReactOS\\***");
615 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
616 RtlInitAnsiString(&Expression, "C:\\Windows\\*a*");
617 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
618
619 RtlInitAnsiString(&Expression, "C:\\ReactOS\\*.bmp");
620 RtlInitAnsiString(&Name, "C:\\Windows\\explorer.exe");
621 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
622 RtlInitAnsiString(&Expression, "*.bmp;*.dib");
623 RtlInitAnsiString(&Name, "winhlp32.exe");
624 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
625
626 /* Backtracking tests */
627 RtlInitAnsiString(&Expression, "*.*.*.*");
628 RtlInitAnsiString(&Name, "127.0.0.1");
629 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
630
631 RtlInitAnsiString(&Expression, "*?*?*?*");
632 RtlInitAnsiString(&Name, "1.0.0.1");
633 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
634 RtlInitAnsiString(&Expression, "?*?*?*?");
635 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
636 RtlInitAnsiString(&Expression, "?.?.?.?");
637 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
638
639 RtlInitAnsiString(&Expression, "*a*ab*abc");
640 RtlInitAnsiString(&Name, "aabaabcdadabdabc");
641 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
642
643 /* Tests for extra wildcards */
644 RtlInitAnsiString(&Expression, "ab<exe");
645 RtlInitAnsiString(&Name, "abcd.exe");
646 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
647 RtlInitAnsiString(&Name, "ab.exe");
648 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
649 RtlInitAnsiString(&Name, "abcdexe");
650 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
651 RtlInitAnsiString(&Name, "acd.exe");
652 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
653 RtlInitAnsiString(&Expression, "a.b<exe");
654 RtlInitAnsiString(&Name, "a.bcd.exe");
655 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
656 RtlInitAnsiString(&Expression, "a<b.exe");
657 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
658 RtlInitAnsiString(&Name, "a.b.exe");
659 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
660
661 RtlInitAnsiString(&Expression, "abc.exe\"");
662 RtlInitAnsiString(&Name, "abc.exe");
663 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
664 RtlInitAnsiString(&Name, "abc.exe.");
665 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
666 RtlInitAnsiString(&Name, "abc.exe.back");
667 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
668 RtlInitAnsiString(&Name, "abc.exes");
669 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
670
671 RtlInitAnsiString(&Expression, "a>c.exe");
672 RtlInitAnsiString(&Name, "abc.exe");
673 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
674 RtlInitAnsiString(&Name, "ac.exe");
675 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
676 RtlInitAnsiString(&Expression, "a>>>exe");
677 RtlInitAnsiString(&Name, "abc.exe");
678 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
679 RtlInitAnsiString(&Name, "ac.exe");
680 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
681
682 RtlInitAnsiString(&Expression, "<.exe");
683 RtlInitAnsiString(&Name, "test.exe");
684 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
685 }
686
687 START_TEST(FsRtlExpression)
688 {
689 FsRtlIsNameInExpressionTest();
690 FsRtlIsDbcsInExpressionTest();
691 }