ReactOS  0.4.13-dev-651-g5dbc677
FsRtlRemoveDotsFromPath.c
Go to the documentation of this file.
1 /*
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>
6  */
7 
8 #include <kmt_test.h>
9 
10 #define NDEBUG
11 #include <debug.h>
12 
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)
17 
20 
21 static
23 (NTAPI *pFsRtlRemoveDotsFromPath)(PWSTR OriginalString,
25 
27 {
28  WCHAR Buf[255];
31 
32  TestString.Buffer = Buf;
33  TestString.MaximumLength = sizeof(Buf);
35  ASSERT(pFsRtlRemoveDotsFromPath);
36 
38  Status = pFsRtlRemoveDotsFromPath(TestString.Buffer, TestString.Length, &TestString.Length);
40 
42  Status = pFsRtlRemoveDotsFromPath(TestString.Buffer, TestString.Length, &TestString.Length);
44 
45  InitConstString(TestString, L"..\\anyOtherContent");
46  Status = pFsRtlRemoveDotsFromPath(TestString.Buffer, TestString.Length, &TestString.Length);
48 
49  InitConstString(TestString, L"\\\\..");
50  Status = pFsRtlRemoveDotsFromPath(TestString.Buffer, TestString.Length, &TestString.Length);
52  ok_eq_wstr(TestString.Buffer, L"\\");
53 
54  InitConstString(TestString, L"\\dir1\\dir2\\..\\dir3\\.\\file.txt");
55  Status = pFsRtlRemoveDotsFromPath(TestString.Buffer, TestString.Length, &TestString.Length);
57  ok_eq_wstr(TestString.Buffer, L"\\dir1\\dir3\\file.txt");
58 }
59 
EH_STD::basic_string< char, EH_STD::char_traits< char >, eh_allocator(char) > TestString
Definition: test_string.cpp:30
#define ok_eq_wstr(value, expected)
Definition: kmt_test.h:262
uint16_t * PWSTR
Definition: typedefs.h:54
LONG NTSTATUS
Definition: precomp.h:26
static NTSTATUS(NTAPI *pFsRtlRemoveDotsFromPath)(PWSTR OriginalString
static USHORT PathLength
static USHORT USHORT * NewLength
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define STATUS_IO_REPARSE_DATA_INVALID
Definition: ntstatus.h:742
#define InitConstString(s, c)
__wchar_t WCHAR
Definition: xmlstorage.h:180
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
#define KmtGetSystemOrEmbeddedRoutineAddress(RoutineName)
Definition: kmt_test.h:293
Status
Definition: gdiplustypes.h:24
unsigned short USHORT
Definition: pedump.c:61
NTSTATUS NTAPI FsRtlRemoveDotsFromPath(PWSTR OriginalString, USHORT PathLength, USHORT *NewLength)
START_TEST(FsRtlRemoveDotsFromPath)
#define ok_eq_hex(value, expected)
return STATUS_SUCCESS
Definition: btrfs.c:2777