cff59cfbf98068d3808f50cbe59ac26e5fd7d302
[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
364 static VOID FsRtlIsDbcsInExpressionTest()
365 {
366 ANSI_STRING Expression, Name;
367
368 if (!KmtIsCheckedBuild)
369 {
370 RtlInitAnsiString(&Expression, "*");
371 RtlInitAnsiString(&Name, "");
372 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
373 RtlInitAnsiString(&Expression, "");
374 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
375 }
376
377 RtlInitAnsiString(&Expression, "**");
378 if (!KmtIsCheckedBuild)
379 {
380 RtlInitAnsiString(&Name, "");
381 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
382 }
383 RtlInitAnsiString(&Name, "a");
384 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
385
386 RtlInitAnsiString(&Expression, "ntdll.dll");
387 RtlInitAnsiString(&Name, ".");
388 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
389 RtlInitAnsiString(&Name, "~1");
390 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
391 RtlInitAnsiString(&Name, "..");
392 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
393 RtlInitAnsiString(&Name, "ntdll.dll");
394 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
395
396 RtlInitAnsiString(&Expression, "smss.exe");
397 RtlInitAnsiString(&Name, ".");
398 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
399 RtlInitAnsiString(&Name, "~1");
400 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
401 RtlInitAnsiString(&Name, "..");
402 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
403 RtlInitAnsiString(&Name, "ntdll.dll");
404 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
405 RtlInitAnsiString(&Name, "NTDLL.dll");
406 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
407
408 RtlInitAnsiString(&Expression, "nt??krnl.???");
409 RtlInitAnsiString(&Name, "ntoskrnl.exe");
410 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
411
412 RtlInitAnsiString(&Expression, "he*o");
413 RtlInitAnsiString(&Name, "hello");
414 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
415 RtlInitAnsiString(&Name, "helo");
416 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
417 RtlInitAnsiString(&Name, "hella");
418 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
419
420 RtlInitAnsiString(&Expression, "he*");
421 RtlInitAnsiString(&Name, "hello");
422 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
423 RtlInitAnsiString(&Name, "helo");
424 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
425 RtlInitAnsiString(&Name, "hella");
426 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
427
428 RtlInitAnsiString(&Expression, "*.cpl");
429 RtlInitAnsiString(&Name, "kdcom.dll");
430 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
431 RtlInitAnsiString(&Name, "bootvid.dll");
432 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
433 RtlInitAnsiString(&Name, "ntoskrnl.exe");
434 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
435
436 RtlInitAnsiString(&Expression, ".");
437 RtlInitAnsiString(&Name, "NTDLL.DLL");
438 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
439
440 RtlInitAnsiString(&Expression, "F0_*.*");
441 RtlInitAnsiString(&Name, ".");
442 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
443 RtlInitAnsiString(&Name, "..");
444 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
445 RtlInitAnsiString(&Name, "SETUP.EXE");
446 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
447 RtlInitAnsiString(&Name, "f0_");
448 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
449 RtlInitAnsiString(&Name, "F0_");
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) == TRUE, "expected TRUE, got FALSE\n");
455 RtlInitAnsiString(&Name, "F0_001");
456 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
457
458 RtlInitAnsiString(&Name, "f0_001");
459 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
460 RtlInitAnsiString(&Name, "F0_001.");
461 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
462 RtlInitAnsiString(&Name, "f0_001.txt");
463 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
464 RtlInitAnsiString(&Name, "F0_001.txt");
465 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
466
467 RtlInitAnsiString(&Expression, "F0_*.");
468 RtlInitAnsiString(&Name, ".");
469 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
470 RtlInitAnsiString(&Name, "..");
471 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
472 RtlInitAnsiString(&Name, "SETUP.EXE");
473 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
474 RtlInitAnsiString(&Name, "f0_");
475 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
476 RtlInitAnsiString(&Name, "F0_");
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) == TRUE, "expected TRUE, got FALSE\n");
482 RtlInitAnsiString(&Name, "F0_001");
483 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
484 RtlInitAnsiString(&Name, "f0_001");
485 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
486 RtlInitAnsiString(&Name, "F0_OO1.");
487 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
488 RtlInitAnsiString(&Name, "f0_001.txt");
489 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
490 RtlInitAnsiString(&Name, "F0_001.txt");
491 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
492
493 RtlInitAnsiString(&Expression, "F0_<\"*");
494 RtlInitAnsiString(&Name, ".");
495 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
496 RtlInitAnsiString(&Name, "..");
497 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
498 RtlInitAnsiString(&Name, "SETUP.EXE");
499 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
500 RtlInitAnsiString(&Name, "f0_");
501 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
502 RtlInitAnsiString(&Name, "F0_");
503 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\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_001");
509 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
510 RtlInitAnsiString(&Name, "f0_001");
511 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
512 RtlInitAnsiString(&Name, "F0_OO1.");
513 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
514 RtlInitAnsiString(&Name, "f0_001.txt");
515 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
516 RtlInitAnsiString(&Name, "F0_001.txt");
517 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
518
519 RtlInitAnsiString(&Expression, "*.TTF");
520 RtlInitAnsiString(&Name, ".");
521 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
522 RtlInitAnsiString(&Name, "..");
523 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
524 RtlInitAnsiString(&Name, "SETUP.INI");
525 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
526
527 RtlInitAnsiString(&Expression, "*");
528 RtlInitAnsiString(&Name, ".");
529 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
530 RtlInitAnsiString(&Name, "..");
531 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
532 RtlInitAnsiString(&Name, "SETUP.INI");
533 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
534
535 RtlInitAnsiString(&Expression, ".*");
536 RtlInitAnsiString(&Name, "1");
537 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
538 RtlInitAnsiString(&Name, "01");
539 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
540 RtlInitAnsiString(&Name, " ");
541 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
542
543 if (!KmtIsCheckedBuild)
544 {
545 RtlInitAnsiString(&Name, "");
546 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
547 }
548 RtlInitAnsiString(&Name, ".");
549 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
550 RtlInitAnsiString(&Name, "1.txt");
551 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
552 RtlInitAnsiString(&Name, " .txt");
553 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
554 RtlInitAnsiString(&Name, ".txt");
555 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
556
557 RtlInitAnsiString(&Expression, "\"ntoskrnl.exe");
558 RtlInitAnsiString(&Name, "ntoskrnl.exe");
559 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
560 RtlInitAnsiString(&Expression, "ntoskrnl\"exe");
561 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
562 RtlInitAnsiString(&Expression, "ntoskrn\".exe");
563 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
564 RtlInitAnsiString(&Expression, "ntoskrn\"\"exe");
565 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
566 RtlInitAnsiString(&Expression, "ntoskrnl.\"exe");
567 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
568 RtlInitAnsiString(&Expression, "ntoskrnl.exe\"");
569 RtlInitAnsiString(&Name, "ntoskrnl.exe");
570 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
571 RtlInitAnsiString(&Name, "ntoskrnl.exe.");
572 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
573
574 RtlInitAnsiString(&Expression, "*.c.d");
575 RtlInitAnsiString(&Name, "a.b.c.d");
576 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
577 RtlInitAnsiString(&Expression, "*.?.c.d");
578 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
579 RtlInitAnsiString(&Expression, "*?");
580 if (!KmtIsCheckedBuild)
581 {
582 RtlInitAnsiString(&Name, "");
583 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
584 }
585 RtlInitAnsiString(&Name, "a");
586 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
587 RtlInitAnsiString(&Name, "aa");
588 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
589 RtlInitAnsiString(&Name, "aaa");
590 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
591 RtlInitAnsiString(&Expression, "?*?");
592 if (!KmtIsCheckedBuild)
593 {
594 RtlInitAnsiString(&Name, "");
595 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
596 }
597 RtlInitAnsiString(&Name, "a");
598 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
599 RtlInitAnsiString(&Name, "aa");
600 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
601 RtlInitAnsiString(&Name, "aaa");
602 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
603 RtlInitAnsiString(&Name, "aaaa");
604 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
605
606 /* Tests from #5923 */
607 RtlInitAnsiString(&Expression, "C:\\ReactOS\\**");
608 RtlInitAnsiString(&Name, "C:\\ReactOS\\dings.bmp");
609 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
610 RtlInitAnsiString(&Expression, "C:\\ReactOS\\***");
611 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
612 RtlInitAnsiString(&Expression, "C:\\Windows\\*a*");
613 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
614
615 RtlInitAnsiString(&Expression, "C:\\ReactOS\\*.bmp");
616 RtlInitAnsiString(&Name, "C:\\Windows\\explorer.exe");
617 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
618 RtlInitAnsiString(&Expression, "*.bmp;*.dib");
619 RtlInitAnsiString(&Name, "winhlp32.exe");
620 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
621
622 /* Backtracking tests */
623 RtlInitAnsiString(&Expression, "*.*.*.*");
624 RtlInitAnsiString(&Name, "127.0.0.1");
625 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
626
627 RtlInitAnsiString(&Expression, "*?*?*?*");
628 RtlInitAnsiString(&Name, "1.0.0.1");
629 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
630 RtlInitAnsiString(&Expression, "?*?*?*?");
631 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
632 RtlInitAnsiString(&Expression, "?.?.?.?");
633 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
634
635 RtlInitAnsiString(&Expression, "*a*ab*abc");
636 RtlInitAnsiString(&Name, "aabaabcdadabdabc");
637 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
638
639 /* Tests for extra wildcards */
640 RtlInitAnsiString(&Expression, "ab<exe");
641 RtlInitAnsiString(&Name, "abcd.exe");
642 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
643 RtlInitAnsiString(&Name, "ab.exe");
644 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
645 RtlInitAnsiString(&Name, "abcdexe");
646 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
647 RtlInitAnsiString(&Name, "acd.exe");
648 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
649 RtlInitAnsiString(&Expression, "a.b<exe");
650 RtlInitAnsiString(&Name, "a.bcd.exe");
651 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
652 RtlInitAnsiString(&Expression, "a<b.exe");
653 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
654 RtlInitAnsiString(&Name, "a.b.exe");
655 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
656
657 RtlInitAnsiString(&Expression, "abc.exe\"");
658 RtlInitAnsiString(&Name, "abc.exe");
659 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
660 RtlInitAnsiString(&Name, "abc.exe.");
661 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
662 RtlInitAnsiString(&Name, "abc.exe.back");
663 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
664 RtlInitAnsiString(&Name, "abc.exes");
665 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
666
667 RtlInitAnsiString(&Expression, "a>c.exe");
668 RtlInitAnsiString(&Name, "abc.exe");
669 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == TRUE, "expected TRUE, got FALSE\n");
670 RtlInitAnsiString(&Name, "ac.exe");
671 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
672 RtlInitAnsiString(&Expression, "a>>>exe");
673 RtlInitAnsiString(&Name, "abc.exe");
674 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
675 RtlInitAnsiString(&Name, "ac.exe");
676 ok(FsRtlIsDbcsInExpression(&Expression, &Name) == FALSE, "expected FALSE, got TRUE\n");
677 }
678
679 START_TEST(FsRtlExpression)
680 {
681 FsRtlIsNameInExpressionTest();
682 FsRtlIsDbcsInExpressionTest();
683 }