npfs/NpfsHelpers.c
npfs/NpfsReadWrite.c
npfs/NpfsVolumeInfo.c
+ novp_fsrtl/FsRtlRemoveDotsFromPath.c
ntos_cm/CmSecurity.c
ntos_ex/ExCallback.c
ntos_ex/ExDoubleList.c
add_library(kmtest_drv SHARED ${KMTEST_DRV_SOURCE})
set_module_type(kmtest_drv kernelmodedriver)
-target_link_libraries(kmtest_drv kmtest_printf chkstk memcmp ${PSEH_LIB})
+target_link_libraries(kmtest_drv kmtest_printf chkstk memcmp ntoskrnl_vista ${PSEH_LIB})
add_importlibs(kmtest_drv ntoskrnl hal)
add_dependencies(kmtest_drv bugcodes xdk)
add_target_compile_definitions(kmtest_drv KMT_KERNEL_MODE NTDDI_VERSION=NTDDI_WS03SP1)
KMT_TESTFUNC Test_FsRtlExpression;
KMT_TESTFUNC Test_FsRtlLegal;
KMT_TESTFUNC Test_FsRtlMcb;
+KMT_TESTFUNC Test_FsRtlRemoveDotsFromPath;
KMT_TESTFUNC Test_FsRtlTunnel;
KMT_TESTFUNC Test_IoCreateFile;
KMT_TESTFUNC Test_IoDeviceInterface;
{ "FsRtlExpression", Test_FsRtlExpression },
{ "FsRtlLegal", Test_FsRtlLegal },
{ "FsRtlMcb", Test_FsRtlMcb },
+ { "FsRtlRemoveDotsFromPath", Test_FsRtlRemoveDotsFromPath },
{ "FsRtlTunnel", Test_FsRtlTunnel },
{ "IoCreateFile", Test_IoCreateFile },
{ "IoDeviceInterface", Test_IoDeviceInterface },
--- /dev/null
+/*
+ * PROJECT: ReactOS kernel-mode tests
+ * LICENSE: LGPLv2+ - See COPYING.LIB in the top level directory
+ * PURPOSE: Tests for FsRtlRemoveDotsFromPath
+ * PROGRAMMER: Pierre Schweitzer <pierre@reactos.org>
+ */
+
+#include <kmt_test.h>
+
+#define NDEBUG
+#include <debug.h>
+
+#define InitConstString(s, c) \
+ wcscpy(s.Buffer, c); \
+ s.Buffer[sizeof(c) / sizeof(WCHAR) - 1] = 0; \
+ s.Length = sizeof(c) - sizeof(UNICODE_NULL)
+
+NTSTATUS NTAPI FsRtlRemoveDotsFromPath(PWSTR OriginalString,
+ USHORT PathLength, USHORT *NewLength);
+
+static
+NTSTATUS
+(NTAPI *pFsRtlRemoveDotsFromPath)(PWSTR OriginalString,
+ USHORT PathLength, USHORT *NewLength);
+
+START_TEST(FsRtlRemoveDotsFromPath)
+{
+ WCHAR Buf[255];
+ UNICODE_STRING TestString;
+ NTSTATUS Status;
+
+ TestString.Buffer = Buf;
+ TestString.MaximumLength = sizeof(Buf);
+ KmtGetSystemOrEmbeddedRoutineAddress(FsRtlRemoveDotsFromPath);
+ ASSERT(pFsRtlRemoveDotsFromPath);
+
+ InitConstString(TestString, L"\\..");
+ Status = pFsRtlRemoveDotsFromPath(TestString.Buffer, TestString.Length, &TestString.Length);
+ ok_eq_hex(Status, STATUS_IO_REPARSE_DATA_INVALID);
+
+ InitConstString(TestString, L"..");
+ Status = pFsRtlRemoveDotsFromPath(TestString.Buffer, TestString.Length, &TestString.Length);
+ ok_eq_hex(Status, STATUS_IO_REPARSE_DATA_INVALID);
+
+ InitConstString(TestString, L"..\\anyOtherContent");
+ Status = pFsRtlRemoveDotsFromPath(TestString.Buffer, TestString.Length, &TestString.Length);
+ ok_eq_hex(Status, STATUS_IO_REPARSE_DATA_INVALID);
+
+ InitConstString(TestString, L"\\\\..");
+ Status = pFsRtlRemoveDotsFromPath(TestString.Buffer, TestString.Length, &TestString.Length);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ ok_eq_wstr(TestString.Buffer, L"\\");
+
+ InitConstString(TestString, L"\\dir1\\dir2\\..\\dir3\\.\\file.txt");
+ Status = pFsRtlRemoveDotsFromPath(TestString.Buffer, TestString.Length, &TestString.Length);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+ ok_eq_wstr(TestString.Buffer, L"\\dir1\\dir3\\file.txt");
+}
+