Skip to content

Commit 2191371

Browse files
committed
[KMTEST]
Added a small testcase for FsRtlIsNameInExpression(). It's quite relevant for daily and simple use of the function. It shouldn't fail on ReactOS given our current implementation. svn path=/trunk/; revision=48932
1 parent 5ea7ca5 commit 2191371

File tree

3 files changed

+132
-0
lines changed

3 files changed

+132
-0
lines changed

rostests/drivers/kmtest/kmtest.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ BOOLEAN ZwUnloadTest(PDRIVER_OBJECT, PUNICODE_STRING, PWCHAR);
174174
BOOLEAN DetachDeviceTest(PDEVICE_OBJECT);
175175
BOOLEAN AttachDeviceTest(PDEVICE_OBJECT, PWCHAR);
176176
VOID LowerDeviceKernelAPITest(PDEVICE_OBJECT, BOOLEAN);
177+
VOID NtoskrnlFsRtlTest(HANDLE KeyHandle);
177178

178179
typedef enum {
179180
TestStageExTimer = 0,
@@ -185,6 +186,7 @@ typedef enum {
185186
TestStageOb,
186187
TestStageKeStall,
187188
TestStageDrv,
189+
TestStageFsRtl,
188190
TestStageMax
189191
} TEST_STAGE;
190192

@@ -399,6 +401,10 @@ RunKernelModeTest(PDRIVER_OBJECT DriverObject,
399401
FinishTest(KeyHandle, L"DriverTest");
400402
break;
401403

404+
case TestStageFsRtl:
405+
NtoskrnlFsRtlTest(KeyHandle);
406+
break;
407+
402408
default:
403409
ASSERT(FALSE);
404410
break;

rostests/drivers/kmtest/kmtest.rbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
<file>ntos_ke.c</file>
1515
<file>ntos_ob.c</file>
1616
<file>ntos_pools.c</file>
17+
<file>ntos_fsrtl.c</file>
1718
<file>kmtest.rc</file>
1819
</module>

rostests/drivers/kmtest/ntos_fsrtl.c

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
/*
2+
* FsRtl Test
3+
*
4+
* Copyright 2010 Pierre Schweitzer <[email protected]>
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+
}

0 commit comments

Comments
 (0)