ReactOS 0.4.16-dev-197-g92996da
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
21static
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
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
static USHORT PathLength
#define InitConstString(s, c)
static USHORT USHORT * NewLength
NTSTATUS NTAPI FsRtlRemoveDotsFromPath(PWSTR OriginalString, USHORT PathLength, USHORT *NewLength)
#define ok_eq_hex(value, expected)
Definition: apitest.h:77
#define ok_eq_wstr(value, expected)
Definition: apitest.h:84
#define START_TEST(x)
Definition: atltest.h:75
LONG NTSTATUS
Definition: precomp.h:26
#define NTSTATUS
Definition: precomp.h:21
Status
Definition: gdiplustypes.h:25
#define KmtGetSystemOrEmbeddedRoutineAddress(RoutineName)
Definition: kmt_test.h:298
#define ASSERT(a)
Definition: mode.c:44
#define STATUS_IO_REPARSE_DATA_INVALID
Definition: ntstatus.h:756
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_SUCCESS
Definition: shellext.h:65
EH_STD::basic_string< char, EH_STD::char_traits< char >, eh_allocator(char) > TestString
Definition: test_string.cpp:30
uint16_t * PWSTR
Definition: typedefs.h:56
#define NTAPI
Definition: typedefs.h:36
__wchar_t WCHAR
Definition: xmlstorage.h:180