ReactOS  0.4.14-dev-98-gb0d4763
RtlGetFullPathName_UstrEx.c File Reference
#include "precomp.h"
Include dependency graph for RtlGetFullPathName_UstrEx.c:

Go to the source code of this file.

Macros

#define ok_eq_ustr(str1, str2)
 
#define RtlPathTypeNotSet   123
 
#define broken(x)   0
 

Enumerations

enum  PREFIX_TYPE {
  PrefixNone, PrefixCurrentDrive, PrefixCurrentPath, PrefixCurrentPathWithoutLastPart,
  PrefixNone, PrefixCurrentDrive, PrefixCurrentPath, PrefixCurrentPathWithoutLastPart,
  PrefixNone, PrefixCurrentDrive, PrefixCurrentPath, PrefixCurrentPathWithoutLastPart
}
 

Functions

 NTSTATUS (NTAPI *pRtlGetFullPathName_UstrEx)(IN PUNICODE_STRING FileName
 
static BOOLEAN CheckStringBuffer (PCUNICODE_STRING String, PCWSTR Expected)
 
static BOOLEAN CheckBuffer (PVOID Buffer, SIZE_T Size, UCHAR Value)
 
static VOID RunTestCases (VOID)
 
 START_TEST (RtlGetFullPathName_UstrEx)
 

Variables

IN PUNICODE_STRING StaticString
 
IN PUNICODE_STRING IN PUNICODE_STRING DynamicString
 
IN PUNICODE_STRING IN PUNICODE_STRING IN PUNICODE_STRINGStringUsed
 
IN PUNICODE_STRING IN PUNICODE_STRING IN PUNICODE_STRING IN PSIZE_T FilePartSize OPTIONAL
 
IN PUNICODE_STRING IN PUNICODE_STRING IN PUNICODE_STRING IN PSIZE_T FilePartSize OUT PBOOLEAN NameInvalid
 
IN PUNICODE_STRING IN PUNICODE_STRING IN PUNICODE_STRING IN PSIZE_T FilePartSize OUT PBOOLEAN OUT RTL_PATH_TYPEPathType
 

Macro Definition Documentation

◆ broken

#define broken (   x)    0

Definition at line 116 of file RtlGetFullPathName_UstrEx.c.

◆ ok_eq_ustr

#define ok_eq_ustr (   str1,
  str2 
)
Value:
do { \
ok((str1)->Buffer == (str2)->Buffer, "Buffer modified\n"); \
ok((str1)->Length == (str2)->Length, "Length modified\n"); \
ok((str1)->MaximumLength == (str2)->MaximumLength, "MaximumLength modified\n"); \
} while (0)
Definition: bufpool.h:45
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
UnicodeString MaximumLength
Definition: rtlfuncs.h:2982

Definition at line 38 of file RtlGetFullPathName_UstrEx.c.

◆ RtlPathTypeNotSet

#define RtlPathTypeNotSet   123

Definition at line 112 of file RtlGetFullPathName_UstrEx.c.

Enumeration Type Documentation

◆ PREFIX_TYPE

Enumerator
PrefixNone 
PrefixCurrentDrive 
PrefixCurrentPath 
PrefixCurrentPathWithoutLastPart 
PrefixNone 
PrefixCurrentDrive 
PrefixCurrentPath 
PrefixCurrentPathWithoutLastPart 
PrefixNone 
PrefixCurrentDrive 
PrefixCurrentPath 
PrefixCurrentPathWithoutLastPart 

Definition at line 118 of file RtlGetFullPathName_UstrEx.c.

Function Documentation

◆ CheckBuffer()

static BOOLEAN CheckBuffer ( PVOID  Buffer,
SIZE_T  Size,
UCHAR  Value 
)
static

Definition at line 93 of file RtlGetFullPathName_UstrEx.c.

97 {
98  PUCHAR Array = Buffer;
99  SIZE_T i;
100 
101  for (i = 0; i < Size; i++)
102  {
103  if (Array[i] != Value)
104  {
105  trace("Expected %x, found %x at offset %lu\n", Value, Array[i], (ULONG)i);
106  return FALSE;
107  }
108  }
109  return TRUE;
110 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
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 trace
Definition: atltest.h:70
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
ULONG_PTR SIZE_T
Definition: typedefs.h:78
unsigned int ULONG
Definition: retypes.h:1
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

Referenced by START_TEST().

◆ CheckStringBuffer()

static BOOLEAN CheckStringBuffer ( PCUNICODE_STRING  String,
PCWSTR  Expected 
)
static

Definition at line 46 of file RtlGetFullPathName_UstrEx.c.

49 {
50  SIZE_T ExpectedLength = wcslen(Expected) * sizeof(WCHAR);
51  SIZE_T EqualLength;
53  SIZE_T i;
54 
55  if (String->Length != ExpectedLength)
56  {
57  ok(0, "String length is %u, expected %lu\n", String->Length, (ULONG)ExpectedLength);
58  Result = FALSE;
59  }
60 
61  EqualLength = RtlCompareMemory(String->Buffer, Expected, ExpectedLength);
62  if (EqualLength != ExpectedLength)
63  {
64  ok(0, "String is '%wZ', expected '%S'\n", String, Expected);
65  Result = FALSE;
66  }
67 
68  if (String->Buffer[String->Length / sizeof(WCHAR)] != UNICODE_NULL)
69  {
70  ok(0, "Not null terminated\n");
71  Result = FALSE;
72  }
73 
74  /* the function nulls the rest of the buffer! */
75  for (i = String->Length + sizeof(UNICODE_NULL); i < String->MaximumLength; i++)
76  {
77  UCHAR Char = ((PUCHAR)String->Buffer)[i];
78  if (Char != 0)
79  {
80  ok(0, "Found 0x%x at offset %lu, expected 0x%x\n", Char, (ULONG)i, 0);
81  /* don't count this as a failure unless the string was actually wrong */
82  //Result = FALSE;
83  /* don't flood the log */
84  break;
85  }
86  }
87 
88  return Result;
89 }
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
static WCHAR String[]
Definition: stringtable.c:55
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 UNICODE_NULL
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char UCHAR
Definition: xmlstorage.h:181
UnicodeString MaximumLength
Definition: rtlfuncs.h:2982
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define ok(value,...)
Definition: atltest.h:57
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN Expected
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465

Referenced by RunTestCases().

◆ NTSTATUS()

NTSTATUS ( NTAPI pRtlGetFullPathName_UstrEx)

◆ RunTestCases()

static VOID RunTestCases ( VOID  )
static

Definition at line 128 of file RtlGetFullPathName_UstrEx.c.

129 {
130  /* TODO: don't duplicate this in the other tests */
131  /* TODO: Drive Relative tests don't work yet if the current drive isn't C: */
132  struct
133  {
135  PREFIX_TYPE PrefixType;
136  PCWSTR FullPathName;
138  PREFIX_TYPE FilePartPrefixType;
139  SIZE_T FilePartSize;
140  } TestCases[] =
141  {
143  { L"C:\\", PrefixNone, L"C:\\", RtlPathTypeDriveAbsolute },
144  { L"C:\\test", PrefixNone, L"C:\\test", RtlPathTypeDriveAbsolute, PrefixCurrentDrive },
145  { L"C:\\test\\", PrefixNone, L"C:\\test\\", RtlPathTypeDriveAbsolute },
146  { L"C:/test/", PrefixNone, L"C:\\test\\", RtlPathTypeDriveAbsolute },
147 
148  { L"C:\\\\test", PrefixNone, L"C:\\test", RtlPathTypeDriveAbsolute, PrefixCurrentDrive },
149  { L"test", PrefixCurrentPath, L"\\test", RtlPathTypeRelative, PrefixCurrentPath, sizeof(WCHAR) },
152  { L".\\test", PrefixCurrentPath, L"\\test", RtlPathTypeRelative, PrefixCurrentPath, sizeof(WCHAR) },
153 
154  { L"\\.", PrefixCurrentDrive, L"", RtlPathTypeRooted },
155  { L"\\.\\", PrefixCurrentDrive, L"", RtlPathTypeRooted },
156  { L"\\\\.", PrefixNone, L"\\\\.\\", RtlPathTypeRootLocalDevice },
157  { L"\\\\.\\", PrefixNone, L"\\\\.\\", RtlPathTypeLocalDevice },
158  { L"\\\\.\\Something\\", PrefixNone, L"\\\\.\\Something\\", RtlPathTypeLocalDevice },
159 
160  { L"\\??\\", PrefixCurrentDrive, L"??\\", RtlPathTypeRooted },
161  { L"\\??\\C:", PrefixCurrentDrive, L"??\\C:", RtlPathTypeRooted, PrefixCurrentDrive, 3 * sizeof(WCHAR) },
162  { L"\\??\\C:\\", PrefixCurrentDrive, L"??\\C:\\", RtlPathTypeRooted },
163  { L"\\??\\C:\\test", PrefixCurrentDrive, L"??\\C:\\test", RtlPathTypeRooted, PrefixCurrentDrive, 6 * sizeof(WCHAR) },
164  { L"\\??\\C:\\test\\", PrefixCurrentDrive, L"??\\C:\\test\\", RtlPathTypeRooted },
165 
166  { L"\\\\??\\", PrefixNone, L"\\\\??\\", RtlPathTypeUncAbsolute },
167  { L"\\\\??\\C:", PrefixNone, L"\\\\??\\C:", RtlPathTypeUncAbsolute },
168  { L"\\\\??\\C:\\", PrefixNone, L"\\\\??\\C:\\", RtlPathTypeUncAbsolute },
169  { L"\\\\??\\C:\\test", PrefixNone, L"\\\\??\\C:\\test", RtlPathTypeUncAbsolute, PrefixNone, sizeof(L"\\\\??\\C:\\") },
170  { L"\\\\??\\C:\\test\\", PrefixNone, L"\\\\??\\C:\\test\\", RtlPathTypeUncAbsolute },
171  };
174  UNICODE_STRING FullPathName;
175  WCHAR FullPathNameBuffer[MAX_PATH];
176  UNICODE_STRING TempString;
178  SIZE_T FilePartSize;
182  WCHAR ExpectedPathName[MAX_PATH];
183  SIZE_T ExpectedFilePartSize;
184  const INT TestCount = sizeof(TestCases) / sizeof(TestCases[0]);
185  INT i;
186  BOOLEAN Okay;
187 
188  for (i = 0; i < TestCount; i++)
189  {
190  switch (TestCases[i].PrefixType)
191  {
192  case PrefixNone:
193  ExpectedPathName[0] = UNICODE_NULL;
194  break;
195  case PrefixCurrentDrive:
196  GetCurrentDirectoryW(sizeof(ExpectedPathName) / sizeof(WCHAR), ExpectedPathName);
197  ExpectedPathName[3] = UNICODE_NULL;
198  break;
199  case PrefixCurrentPath:
200  {
201  ULONG Length;
202  Length = GetCurrentDirectoryW(sizeof(ExpectedPathName) / sizeof(WCHAR), ExpectedPathName);
203  if (Length == 3 && TestCases[i].FullPathName[0])
204  ExpectedPathName[2] = UNICODE_NULL;
205  break;
206  }
207  default:
208  skip("Invalid test!\n");
209  continue;
210  }
211  wcscat(ExpectedPathName, TestCases[i].FullPathName);
213  RtlInitEmptyUnicodeString(&FullPathName, FullPathNameBuffer, sizeof(FullPathNameBuffer));
214  RtlFillMemory(FullPathName.Buffer, FullPathName.MaximumLength, 0xAA);
215  TempString = FileName;
218  FilePartSize = 1234;
219  NameInvalid = (BOOLEAN)-1;
220  LengthNeeded = 1234;
221  StartSeh()
222  Status = pRtlGetFullPathName_UstrEx(&FileName,
223  &FullPathName,
224  NULL,
225  &StringUsed,
226  &FilePartSize,
227  &NameInvalid,
228  &PathType,
229  &LengthNeeded);
230  ok(Status == STATUS_SUCCESS, "status = %lx\n", Status);
232  ok_eq_ustr(&FileName, &TempString);
233  ok(FullPathName.Buffer == FullPathNameBuffer, "Buffer modified\n");
234  ok(FullPathName.MaximumLength == sizeof(FullPathNameBuffer), "MaximumLength modified\n");
235  Okay = CheckStringBuffer(&FullPathName, ExpectedPathName);
236  ok(Okay, "Wrong path name '%wZ', expected '%S'\n", &FullPathName, ExpectedPathName);
237  ok(StringUsed == &FullPathName, "StringUsed = %p, expected %p\n", StringUsed, &FullPathName);
238  switch (TestCases[i].FilePartPrefixType)
239  {
240  case PrefixNone:
241  ExpectedFilePartSize = 0;
242  break;
243  case PrefixCurrentDrive:
244  ExpectedFilePartSize = sizeof(L"C:\\");
245  break;
246  case PrefixCurrentPath:
247  ExpectedFilePartSize = GetCurrentDirectoryW(0, NULL) * sizeof(WCHAR);
248  if (ExpectedFilePartSize == sizeof(L"C:\\"))
249  ExpectedFilePartSize -= sizeof(WCHAR);
250  break;
252  {
253  WCHAR CurrentPath[MAX_PATH];
255  ExpectedFilePartSize = GetCurrentDirectoryW(sizeof(CurrentPath) / sizeof(WCHAR), CurrentPath) * sizeof(WCHAR) + sizeof(UNICODE_NULL);
256  if (ExpectedFilePartSize == sizeof(L"C:\\"))
257  ExpectedFilePartSize = 0;
258  else
259  {
260  BackSlash = wcsrchr(CurrentPath, L'\\');
261  if (BackSlash)
262  ExpectedFilePartSize -= wcslen(BackSlash + 1) * sizeof(WCHAR);
263  else
264  ok(0, "GetCurrentDirectory returned %S\n", CurrentPath);
265  }
266  break;
267  }
268  default:
269  skip("Invalid test!\n");
270  continue;
271  }
272  ExpectedFilePartSize += TestCases[i].FilePartSize;
273  if (ExpectedFilePartSize != 0)
274  ExpectedFilePartSize = (ExpectedFilePartSize - sizeof(UNICODE_NULL)) / sizeof(WCHAR);
275  ok(FilePartSize == ExpectedFilePartSize,
276  "FilePartSize = %lu, expected %lu\n", (ULONG)FilePartSize, (ULONG)ExpectedFilePartSize);
277  ok(NameInvalid == FALSE, "NameInvalid = %u\n", NameInvalid);
278  ok(PathType == TestCases[i].PathType, "PathType = %d, expected %d\n", PathType, TestCases[i].PathType);
279  ok(LengthNeeded == 0, "LengthNeeded = %lu\n", (ULONG)LengthNeeded);
280  }
281 }
enum _RTL_PATH_TYPE RTL_PATH_TYPE
const uint16_t * PCWSTR
Definition: typedefs.h:55
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
USHORT MaximumLength
Definition: env_spec_w32.h:370
LONG NTSTATUS
Definition: precomp.h:26
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:413
GLdouble n
Definition: glext.h:7729
Definition: movable.cpp:7
#define StartSeh()
Definition: _sntprintf.h:16
int32_t INT
Definition: typedefs.h:56
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 UNICODE_NULL
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
Definition: bufpool.h:45
switch(r->id)
Definition: btrfs.c:2932
#define InvalidPointer
static BOOLEAN CheckStringBuffer(PCUNICODE_STRING String, PCWSTR Expected)
#define ok_eq_ustr(str1, str2)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
IN PUNICODE_STRING IN PUNICODE_STRING IN PUNICODE_STRING IN PSIZE_T FilePartSize OUT PBOOLEAN OUT RTL_PATH_TYPE * PathType
static TEST_CASE TestCases[]
Definition: CommandLine.c:101
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
UnicodeString MaximumLength
Definition: rtlfuncs.h:2982
ULONG_PTR SIZE_T
Definition: typedefs.h:78
struct _FileName FileName
Definition: fatprocs.h:884
IN PUNICODE_STRING IN PUNICODE_STRING IN PUNICODE_STRING IN PSIZE_T FilePartSize OUT PBOOLEAN NameInvalid
#define ok(value,...)
Definition: atltest.h:57
Definition: services.c:325
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define skip(...)
Definition: atltest.h:64
Definition: name.c:36
#define BOOLEAN
Definition: pedump.c:73
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlPathTypeNotSet
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION _In_ ULONG _Out_opt_ PULONG LengthNeeded
Definition: fltkernel.h:1342
IN PUNICODE_STRING IN PUNICODE_STRING IN PUNICODE_STRING * StringUsed
GLfloat GLfloat p
Definition: glext.h:8902
static const WCHAR BackSlash[]
Definition: devclass.c:29
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
BOOL expected
Definition: store.c:2063
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17
Definition: ps.c:97

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( RtlGetFullPathName_UstrEx  )

Definition at line 283 of file RtlGetFullPathName_UstrEx.c.

284 {
287  UNICODE_STRING TempString;
290  SIZE_T FilePartSize;
292  BOOLEAN NameInvalidArray[sizeof(ULONGLONG)];
295  BOOLEAN Okay;
296 
297  pRtlGetFullPathName_UstrEx = (PVOID)GetProcAddress(GetModuleHandleW(L"ntdll"), "RtlGetFullPathName_UstrEx");
298  if (!pRtlGetFullPathName_UstrEx)
299  {
300  skip("RtlGetFullPathName_UstrEx unavailable\n");
301  return;
302  }
303 
304  /* NULL parameters */
305  StartSeh()
306  pRtlGetFullPathName_UstrEx(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
308 
310  TempString = FileName;
311  StartSeh()
312  pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
314  ok_eq_ustr(&FileName, &TempString);
315 
317  TempString = FileName;
318  StartSeh()
319  pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
321  ok_eq_ustr(&FileName, &TempString);
322 
324  StartSeh()
325  pRtlGetFullPathName_UstrEx(NULL, NULL, NULL, NULL, NULL, NULL, &PathType, NULL);
328  broken(PathType == RtlPathTypeNotSet) /* Win7 */, "PathType = %d\n", PathType);
329 
330  /* Check what else is initialized before it crashes */
333  FilePartSize = 1234;
334  NameInvalid = (BOOLEAN)-1;
335  LengthNeeded = 1234;
336  StartSeh()
337  pRtlGetFullPathName_UstrEx(NULL, NULL, NULL, &StringUsed, &FilePartSize, &NameInvalid, &PathType, &LengthNeeded);
340  ok(FilePartSize == 0, "FilePartSize = %lu\n", (ULONG)FilePartSize);
343  broken(PathType == RtlPathTypeNotSet) /* Win7 */, "PathType = %d\n", PathType);
344  ok(LengthNeeded == 0, "LengthNeeded = %lu\n", (ULONG)LengthNeeded);
345 
347  TempString = FileName;
349  FilePartSize = 1234;
350  NameInvalid = (BOOLEAN)-1;
351  LengthNeeded = 1234;
352  StartSeh()
353  pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, &StringUsed, &FilePartSize, &NameInvalid, NULL, &LengthNeeded);
355  ok_eq_ustr(&FileName, &TempString);
357  ok(FilePartSize == 0, "FilePartSize = %lu\n", (ULONG)FilePartSize);
358  ok(NameInvalid == FALSE ||
359  broken(NameInvalid == (BOOLEAN)-1) /* Win7 */, "NameInvalid = %u\n", NameInvalid);
360  ok(LengthNeeded == 0, "LengthNeeded = %lu\n", (ULONG)LengthNeeded);
361 
362  /* This is the first one that doesn't crash. FileName and PathType cannot be NULL */
364  TempString = FileName;
366  StartSeh()
367  Status = pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, NULL, NULL, NULL, &PathType, NULL);
370  ok_eq_ustr(&FileName, &TempString);
372 
374  TempString = FileName;
376  StartSeh()
377  Status = pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, NULL, NULL, NULL, &PathType, NULL);
380  ok_eq_ustr(&FileName, &TempString);
382 
383  /* Show that NameInvalid is indeed BOOLEAN */
385  TempString = FileName;
387  RtlFillMemory(NameInvalidArray, sizeof(NameInvalidArray), 0x55);
388  StartSeh()
389  Status = pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, NULL, NULL, NameInvalidArray, &PathType, NULL);
392  ok_eq_ustr(&FileName, &TempString);
394  ok(NameInvalidArray[0] == FALSE, "NameInvalid = %u\n", NameInvalidArray[0]);
395  Okay = CheckBuffer(NameInvalidArray + 1, sizeof(NameInvalidArray) - sizeof(NameInvalidArray[0]), 0x55);
396  ok(Okay, "CheckBuffer failed\n");
397 
398  /* Give it a valid path */
400  TempString = FileName;
402  StartSeh()
403  Status = pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, NULL, NULL, NULL, &PathType, NULL);
406  ok_eq_ustr(&FileName, &TempString);
408 
409  /* Zero-length static string */
411  TempString = FileName;
414  StartSeh()
415  Status = pRtlGetFullPathName_UstrEx(&FileName, &StaticString, NULL, NULL, NULL, NULL, &PathType, NULL);
418  ok_eq_ustr(&FileName, &TempString);
420 
421  /* TODO: play around with StaticString and DynamicString */
422 
423  /* Check the actual functionality with different paths */
424  RunTestCases();
425 }
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 * u
Definition: glfuncs.h:240
enum _RTL_PATH_TYPE RTL_PATH_TYPE
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
static BOOLEAN CheckBuffer(PVOID Buffer, SIZE_T Size, UCHAR Value)
LONG NTSTATUS
Definition: precomp.h:26
GLdouble n
Definition: glext.h:7729
#define test
Definition: rosglue.h:37
#define broken(x)
#define StartSeh()
Definition: _sntprintf.h:16
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
#define InvalidPointer
#define ok_eq_ustr(str1, str2)
#define d
Definition: ke_i.h:81
uint64_t ULONGLONG
Definition: typedefs.h:65
IN PUNICODE_STRING IN PUNICODE_STRING IN PUNICODE_STRING IN PSIZE_T FilePartSize OUT PBOOLEAN OUT RTL_PATH_TYPE * PathType
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
struct _FileName FileName
Definition: fatprocs.h:884
IN PUNICODE_STRING IN PUNICODE_STRING IN PUNICODE_STRING IN PSIZE_T FilePartSize OUT PBOOLEAN NameInvalid
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define ok(value,...)
Definition: atltest.h:57
Definition: ttei6.cpp:27
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
#define skip(...)
Definition: atltest.h:64
unsigned int ULONG
Definition: retypes.h:1
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:847
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlPathTypeNotSet
#define GetProcAddress(x, y)
Definition: compat.h:410
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION _In_ ULONG _Out_opt_ PULONG LengthNeeded
Definition: fltkernel.h:1342
IN PUNICODE_STRING IN PUNICODE_STRING IN PUNICODE_STRING * StringUsed
GLfloat GLfloat p
Definition: glext.h:8902
static VOID RunTestCases(VOID)
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
IN PUNICODE_STRING StaticString
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17
Definition: ps.c:97

Variable Documentation

◆ DynamicString

◆ NameInvalid

◆ OPTIONAL

◆ PathType

◆ StaticString

◆ StringUsed