[YAROTOWS] Reintegrate the branch. For a brighter future.
[reactos.git] / rostests / drivers / kmtest / ntos_fsrtl.c
1 /*
2 * FsRtl Test
3 *
4 * Copyright 2010 Pierre Schweitzer <pierre.schweitzer@reactos.org>
5 *
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.
10 *
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.
15 *
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.
20 */
21
22 /* INCLUDES *******************************************************************/
23
24 #include "kmtest.h"
25 #include <ntifs.h>
26
27 #define NDEBUG
28 #include "debug.h"
29
30 /* PRIVATE FUNCTIONS **********************************************************/
31
32 VOID FsRtlIsNameInExpressionTest()
33 {
34 UNICODE_STRING Expression, Name;
35
36 RtlInitUnicodeString(&Expression, L"ntdll.dll");
37 RtlInitUnicodeString(&Name, L".");
38 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
39 RtlInitUnicodeString(&Name, L"~1");
40 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
41 RtlInitUnicodeString(&Name, L"..");
42 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
43 RtlInitUnicodeString(&Name, L"ntdll.dll");
44 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
45
46 RtlInitUnicodeString(&Expression, L"smss.exe");
47 RtlInitUnicodeString(&Name, L".");
48 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
49 RtlInitUnicodeString(&Name, L"~1");
50 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
51 RtlInitUnicodeString(&Name, L"..");
52 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
53 RtlInitUnicodeString(&Name, L"ntdll.dll");
54 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
55 RtlInitUnicodeString(&Name, L"NTDLL.dll");
56 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
57
58 RtlInitUnicodeString(&Expression, L"nt??krnl.???");
59 RtlInitUnicodeString(&Name, L"ntoskrnl.exe");
60 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
61
62 RtlInitUnicodeString(&Expression, L"he*o");
63 RtlInitUnicodeString(&Name, L"hello");
64 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
65 RtlInitUnicodeString(&Name, L"helo");
66 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
67 RtlInitUnicodeString(&Name, L"hella");
68 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
69
70 RtlInitUnicodeString(&Expression, L"he*");
71 RtlInitUnicodeString(&Name, L"hello");
72 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
73 RtlInitUnicodeString(&Name, L"helo");
74 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
75 RtlInitUnicodeString(&Name, L"hella");
76 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
77
78 RtlInitUnicodeString(&Expression, L"*.cpl");
79 RtlInitUnicodeString(&Name, L"kdcom.dll");
80 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
81 RtlInitUnicodeString(&Name, L"bootvid.dll");
82 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
83 RtlInitUnicodeString(&Name, L"ntoskrnl.exe");
84 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
85
86 RtlInitUnicodeString(&Expression, L".");
87 RtlInitUnicodeString(&Name, L"NTDLL.DLL");
88 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
89
90 RtlInitUnicodeString(&Expression, L"F0_*.*");
91 RtlInitUnicodeString(&Name, L".");
92 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
93 RtlInitUnicodeString(&Name, L"..");
94 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
95 RtlInitUnicodeString(&Name, L"SETUP.EXE");
96 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
97 RtlInitUnicodeString(&Name, L"F0_001");
98 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
99
100 RtlInitUnicodeString(&Expression, L"*.TTF");
101 RtlInitUnicodeString(&Name, L".");
102 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
103 RtlInitUnicodeString(&Name, L"..");
104 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
105 RtlInitUnicodeString(&Name, L"SETUP.INI");
106 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == FALSE, "expected FALSE, got TRUE");
107
108 RtlInitUnicodeString(&Expression, L"*");
109 RtlInitUnicodeString(&Name, L".");
110 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
111 RtlInitUnicodeString(&Name, L"..");
112 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
113 RtlInitUnicodeString(&Name, L"SETUP.INI");
114 ok(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL) == TRUE, "expected TRUE, got FALSE");
115 }
116
117 /* PUBLIC FUNCTIONS ***********************************************************/
118
119 VOID
120 NtoskrnlFsRtlTest(HANDLE KeyHandle)
121 {
122 FsRtlIsNameInExpressionTest();
123
124 FinishTest(KeyHandle, L"FsRtlTest");
125 }