ReactOS 0.4.16-dev-92-g0c2cdca
RtlDetermineDosPathNameType.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Test for RtlDetermineDosPathNameType_U/RtlDetermineDosPathNameType_Ustr
5 * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
6 */
7
8#include "precomp.h"
9
10/*
11ULONG
12NTAPI
13RtlDetermineDosPathNameType_U(
14 IN PCWSTR Path
15);
16
17ULONG
18NTAPI
19RtlDetermineDosPathNameType_Ustr(
20 IN PCUNICODE_STRING Path
21);
22*/
23
24static
26(NTAPI
29)
30//= (PVOID)0x7c830669;
31;
32
33START_TEST(RtlDetermineDosPathNameType)
34{
36 struct
37 {
40 } Tests[] =
41 {
43 { L"xyz", RtlPathTypeRelative },
44 { L"CON", RtlPathTypeRelative },
45 { L"NUL", RtlPathTypeRelative },
46 { L":", RtlPathTypeRelative },
49 { L"::::", RtlPathTypeDriveRelative },
50 { L"::\\", RtlPathTypeDriveAbsolute },
51 { L"\\", RtlPathTypeRooted },
52 { L"\\:", RtlPathTypeRooted },
53 { L"\\C:", RtlPathTypeRooted },
54 { L"\\C:\\", RtlPathTypeRooted },
55 { L"/", RtlPathTypeRooted },
56 { L"/:", RtlPathTypeRooted },
57 { L"/C:", RtlPathTypeRooted },
58 { L"/C:/", RtlPathTypeRooted },
59 { L"C", RtlPathTypeRelative },
62 { L"C:a\\", RtlPathTypeDriveRelative },
63 { L"C:\\", RtlPathTypeDriveAbsolute },
65 { L"C:\\a", RtlPathTypeDriveAbsolute },
66 { L"C:/a", RtlPathTypeDriveAbsolute },
67 { L"C:\\\\", RtlPathTypeDriveAbsolute },
68 { L"\\\\", RtlPathTypeUncAbsolute },
69 { L"\\\\\\", RtlPathTypeUncAbsolute },
70 { L"\\\\;", RtlPathTypeUncAbsolute },
71 { L"\\\\f\\b\\", RtlPathTypeUncAbsolute },
72 { L"\\\\f\\b", RtlPathTypeUncAbsolute },
73 { L"\\\\f\\", RtlPathTypeUncAbsolute },
74 { L"\\\\f", RtlPathTypeUncAbsolute },
75 { L"\\??\\", RtlPathTypeRooted },
76 { L"\\??\\UNC", RtlPathTypeRooted },
77 { L"\\??\\UNC\\", RtlPathTypeRooted },
78 { L"\\?", RtlPathTypeRooted },
79 { L"\\?\\", RtlPathTypeRooted },
80 { L"\\?\\UNC", RtlPathTypeRooted },
81 { L"\\?\\UNC\\", RtlPathTypeRooted },
82 { L"\\\\?\\UNC\\", RtlPathTypeLocalDevice },
83 { L"\\\\?", RtlPathTypeRootLocalDevice },
84 { L"\\\\??", RtlPathTypeUncAbsolute },
85 { L"\\\\??\\", RtlPathTypeUncAbsolute },
86 { L"\\\\??\\C:\\", RtlPathTypeUncAbsolute },
87 { L"\\\\.", RtlPathTypeRootLocalDevice },
88 { L"\\\\.\\", RtlPathTypeLocalDevice },
89 { L"\\\\.\\C:\\", RtlPathTypeLocalDevice },
90 { L"\\/", RtlPathTypeUncAbsolute },
91 { L"/\\", RtlPathTypeUncAbsolute },
93 { L"///", RtlPathTypeUncAbsolute },
94 { L"//;", RtlPathTypeUncAbsolute },
98 { L"//??", RtlPathTypeUncAbsolute },
99 { L"//?" L"?/", RtlPathTypeUncAbsolute },
100 { L"//?" L"?/C:/", RtlPathTypeUncAbsolute },
102 { L"\\/.", RtlPathTypeRootLocalDevice },
103 { L"/\\.", RtlPathTypeRootLocalDevice },
104 { L"//./", RtlPathTypeLocalDevice },
105 { L"//./C:/", RtlPathTypeLocalDevice },
106 { L"%SystemRoot%", RtlPathTypeRelative },
107 };
108 ULONG i;
111
113 {
114 RtlDetermineDosPathNameType_Ustr = (PVOID)GetProcAddress(GetModuleHandleW(L"ntdll"), "RtlDetermineDosPathNameType_Ustr");
116 skip("RtlDetermineDosPathNameType_Ustr unavailable\n");
117 }
118
120
122 {
123 UNICODE_STRING PathString;
125
126 RtlInitEmptyUnicodeString(&PathString, NULL, MAXUSHORT);
128 ok(PathType == RtlPathTypeRelative, "PathType = %d\n", PathType);
129 }
130
131 for (i = 0; i < sizeof(Tests) / sizeof(Tests[0]); i++)
132 {
133 Length = (USHORT)wcslen(Tests[i].FileName) * sizeof(WCHAR);
137 StartSeh()
139 ok(PathType == Tests[i].PathType, "PathType is %d, expected %d for '%S'\n", PathType, Tests[i].PathType, Tests[i].FileName);
142
144 {
145 UNICODE_STRING PathString;
146
150 PathString.Buffer = FileName;
151 PathString.Length = Length;
152 PathString.MaximumLength = MAXUSHORT;
153 StartSeh()
155 ok(PathType == Tests[i].PathType, "PathType is %d, expected %d for '%S'\n", PathType, Tests[i].PathType, Tests[i].FileName);
158 }
159 }
160}
struct test_data Tests[]
static IN ULONG IN PWSTR OUT PCWSTR OUT PBOOLEAN OUT PATH_TYPE_AND_UNKNOWN * PathType
PRTL_UNICODE_STRING_BUFFER Path
#define StartSeh()
Definition: _sntprintf.h:16
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17
static VOID MakeReadOnly(PVOID Pointer, SIZE_T SizeRequested)
Definition: apitest_guard.h:59
static VOID FreeGuarded(_In_ PVOID Pointer)
Definition: apitest_guard.h:45
static PVOID AllocateGuarded(_In_ SIZE_T SizeRequested)
Definition: apitest_guard.h:10
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define NULL
Definition: types.h:112
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
struct _FileName FileName
Definition: fatprocs.h:897
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI RTL_PATH_TYPE NTAPI RtlDetermineDosPathNameType_U(_In_ PCWSTR Path)
@ RtlPathTypeRootLocalDevice
Definition: rtltypes.h:478
@ RtlPathTypeDriveRelative
Definition: rtltypes.h:474
@ RtlPathTypeRelative
Definition: rtltypes.h:476
@ RtlPathTypeUncAbsolute
Definition: rtltypes.h:472
@ RtlPathTypeRooted
Definition: rtltypes.h:475
@ RtlPathTypeLocalDevice
Definition: rtltypes.h:477
@ RtlPathTypeDriveAbsolute
Definition: rtltypes.h:473
enum _RTL_PATH_TYPE RTL_PATH_TYPE
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
RTL_PATH_TYPE NTAPI RtlDetermineDosPathNameType_Ustr(IN PCUNICODE_STRING PathString)
Definition: path.c:61
#define STATUS_SUCCESS
Definition: shellext.h:65
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define MAXUSHORT
Definition: typedefs.h:83
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
__wchar_t WCHAR
Definition: xmlstorage.h:180