ReactOS  0.4.15-dev-3453-gff89651
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 /*
11 ULONG
12 NTAPI
13 RtlDetermineDosPathNameType_U(
14  IN PCWSTR Path
15 );
16 
17 ULONG
18 NTAPI
19 RtlDetermineDosPathNameType_Ustr(
20  IN PCUNICODE_STRING Path
21 );
22 */
23 
24 static
25 ULONG
26 (NTAPI
29 )
30 //= (PVOID)0x7c830669;
31 ;
32 
33 START_TEST(RtlDetermineDosPathNameType)
34 {
36  struct
37  {
40  } Tests[] =
41  {
42  { L"", RtlPathTypeRelative },
43  { L"xyz", RtlPathTypeRelative },
44  { L"CON", RtlPathTypeRelative },
45  { L"NUL", RtlPathTypeRelative },
46  { L":", RtlPathTypeRelative },
47  { L"::", RtlPathTypeDriveRelative },
48  { L":::", RtlPathTypeDriveRelative },
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 },
60  { L"C:", RtlPathTypeDriveRelative },
61  { L"C:a", RtlPathTypeDriveRelative },
62  { L"C:a\\", RtlPathTypeDriveRelative },
63  { L"C:\\", RtlPathTypeDriveAbsolute },
64  { 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 },
92  { L"//", RtlPathTypeUncAbsolute },
93  { L"///", RtlPathTypeUncAbsolute },
94  { L"//;", RtlPathTypeUncAbsolute },
95  { L"//?", RtlPathTypeRootLocalDevice },
96  { L"/\\?", RtlPathTypeRootLocalDevice },
97  { L"\\/?", RtlPathTypeRootLocalDevice },
98  { L"//??", RtlPathTypeUncAbsolute },
99  { L"//?" L"?/", RtlPathTypeUncAbsolute },
100  { L"//?" L"?/C:/", RtlPathTypeUncAbsolute },
101  { L"//.", RtlPathTypeRootLocalDevice },
102  { L"\\/.", RtlPathTypeRootLocalDevice },
103  { L"/\\.", RtlPathTypeRootLocalDevice },
104  { L"//./", RtlPathTypeLocalDevice },
105  { L"//./C:/", RtlPathTypeLocalDevice },
106  { L"%SystemRoot%", RtlPathTypeRelative },
107  };
108  ULONG i;
109  PWSTR FileName;
110  USHORT Length;
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 }
RTL_PATH_TYPE NTAPI RtlDetermineDosPathNameType_Ustr(IN PCUNICODE_STRING PathString)
Definition: path.c:61
enum _RTL_PATH_TYPE RTL_PATH_TYPE
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define IN
Definition: typedefs.h:39
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint16_t * PWSTR
Definition: typedefs.h:56
static VOID FreeGuarded(_In_ PVOID Pointer)
Definition: apitest_guard.h:45
#define StartSeh()
Definition: _sntprintf.h:16
static IN ULONG IN PWSTR OUT PCWSTR OUT PBOOLEAN OUT PATH_TYPE_AND_UNKNOWN * PathType
static PVOID AllocateGuarded(_In_ SIZE_T SizeRequested)
Definition: apitest_guard.h:10
#define L(x)
Definition: ntvdm.h:50
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define UNICODE_NULL
void * PVOID
Definition: retypes.h:9
START_TEST(RtlDetermineDosPathNameType)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static ULONG(NTAPI *RtlDetermineDosPathNameType_Ustr)(IN PCUNICODE_STRING Path)
static VOID MakeReadOnly(PVOID Pointer, SIZE_T SizeRequested)
Definition: apitest_guard.h:59
struct _FileName FileName
Definition: fatprocs.h:893
PRTL_UNICODE_STRING_BUFFER Path
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
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
unsigned short USHORT
Definition: pedump.c:61
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define MAXUSHORT
Definition: typedefs.h:83
#define skip(...)
Definition: atltest.h:64
unsigned int ULONG
Definition: retypes.h:1
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define GetProcAddress(x, y)
Definition: compat.h:612
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_SUCCESS
Definition: shellext.h:65
struct test_data Tests[]
NTSYSAPI RTL_PATH_TYPE NTAPI RtlDetermineDosPathNameType_U(_In_ PCWSTR Path)
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17