2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: LGPLv2+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Tests for FsRtlRemoveDotsFromPath
5 * PROGRAMMER: Pierre Schweitzer <pierre@reactos.org>
13 #define InitConstString(s, c) \
14 wcscpy(s.Buffer, c); \
15 s.Buffer[sizeof(c) / sizeof(WCHAR) - 1] = 0; \
16 s.Length = sizeof(c) - sizeof(UNICODE_NULL)
18 NTSTATUS NTAPI
FsRtlRemoveDotsFromPath(PWSTR OriginalString
,
19 USHORT PathLength
, USHORT
*NewLength
);
23 (NTAPI
*pFsRtlRemoveDotsFromPath
)(PWSTR OriginalString
,
24 USHORT PathLength
, USHORT
*NewLength
);
26 START_TEST(FsRtlRemoveDotsFromPath
)
29 UNICODE_STRING TestString
;
32 TestString
.Buffer
= Buf
;
33 TestString
.MaximumLength
= sizeof(Buf
);
34 KmtGetSystemOrEmbeddedRoutineAddress(FsRtlRemoveDotsFromPath
);
35 ASSERT(pFsRtlRemoveDotsFromPath
);
37 InitConstString(TestString
, L
"\\..");
38 Status
= pFsRtlRemoveDotsFromPath(TestString
.Buffer
, TestString
.Length
, &TestString
.Length
);
39 ok_eq_hex(Status
, STATUS_IO_REPARSE_DATA_INVALID
);
41 InitConstString(TestString
, L
"..");
42 Status
= pFsRtlRemoveDotsFromPath(TestString
.Buffer
, TestString
.Length
, &TestString
.Length
);
43 ok_eq_hex(Status
, STATUS_IO_REPARSE_DATA_INVALID
);
45 InitConstString(TestString
, L
"..\\anyOtherContent");
46 Status
= pFsRtlRemoveDotsFromPath(TestString
.Buffer
, TestString
.Length
, &TestString
.Length
);
47 ok_eq_hex(Status
, STATUS_IO_REPARSE_DATA_INVALID
);
49 InitConstString(TestString
, L
"\\\\..");
50 Status
= pFsRtlRemoveDotsFromPath(TestString
.Buffer
, TestString
.Length
, &TestString
.Length
);
51 ok_eq_hex(Status
, STATUS_SUCCESS
);
52 ok_eq_wstr(TestString
.Buffer
, L
"\\");
54 InitConstString(TestString
, L
"\\dir1\\dir2\\..\\dir3\\.\\file.txt");
55 Status
= pFsRtlRemoveDotsFromPath(TestString
.Buffer
, TestString
.Length
, &TestString
.Length
);
56 ok_eq_hex(Status
, STATUS_SUCCESS
);
57 ok_eq_wstr(TestString
.Buffer
, L
"\\dir1\\dir3\\file.txt");