ReactOS  0.4.15-dev-425-gc40b086
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:2373
#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:361
ULONG_PTR SIZE_T
Definition: typedefs.h:79
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:79
#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  {
134  ULONG Line;
136  PREFIX_TYPE PrefixType;
137  PCWSTR FullPathName;
139  PREFIX_TYPE FilePartPrefixType;
140  SIZE_T FilePartSize;
141  } TestCases[] =
142  {
143 // { __LINE__, L"C:", PrefixCurrentPath, L"", RtlPathTypeDriveRelative, PrefixCurrentPathWithoutLastPart }, // This is broken
144  { __LINE__, L"C:\\", PrefixNone, L"C:\\", RtlPathTypeDriveAbsolute },
145  { __LINE__, L"C:\\test", PrefixNone, L"C:\\test", RtlPathTypeDriveAbsolute, PrefixCurrentDrive },
146  { __LINE__, L"C:\\test\\", PrefixNone, L"C:\\test\\", RtlPathTypeDriveAbsolute },
147  { __LINE__, L"C:/test/", PrefixNone, L"C:\\test\\", RtlPathTypeDriveAbsolute },
148 
149  { __LINE__, L"C:\\\\test", PrefixNone, L"C:\\test", RtlPathTypeDriveAbsolute, PrefixCurrentDrive },
150  { __LINE__, L"test", PrefixCurrentPath, L"\\test", RtlPathTypeRelative, PrefixCurrentPath, sizeof(WCHAR) },
151  { __LINE__, L"\\test", PrefixCurrentDrive, L"test", RtlPathTypeRooted, PrefixCurrentDrive },
152  { __LINE__, L"/test", PrefixCurrentDrive, L"test", RtlPathTypeRooted, PrefixCurrentDrive },
153  { __LINE__, L".\\test", PrefixCurrentPath, L"\\test", RtlPathTypeRelative, PrefixCurrentPath, sizeof(WCHAR) },
154 
155  { __LINE__, L"\\.", PrefixCurrentDrive, L"", RtlPathTypeRooted },
156  { __LINE__, L"\\.\\", PrefixCurrentDrive, L"", RtlPathTypeRooted },
157  { __LINE__, L"\\\\.", PrefixNone, L"\\\\.\\", RtlPathTypeRootLocalDevice },
158  { __LINE__, L"\\\\.\\", PrefixNone, L"\\\\.\\", RtlPathTypeLocalDevice },
159  { __LINE__, L"\\\\.\\Something\\", PrefixNone, L"\\\\.\\Something\\", RtlPathTypeLocalDevice },
160 
161  { __LINE__, L"\\??\\", PrefixCurrentDrive, L"??\\", RtlPathTypeRooted },
162  { __LINE__, L"\\??\\C:", PrefixCurrentDrive, L"??\\C:", RtlPathTypeRooted, PrefixCurrentDrive, 3 * sizeof(WCHAR) },
163  { __LINE__, L"\\??\\C:\\", PrefixCurrentDrive, L"??\\C:\\", RtlPathTypeRooted },
164  { __LINE__, L"\\??\\C:\\test", PrefixCurrentDrive, L"??\\C:\\test", RtlPathTypeRooted, PrefixCurrentDrive, 6 * sizeof(WCHAR) },
165  { __LINE__, L"\\??\\C:\\test\\", PrefixCurrentDrive, L"??\\C:\\test\\", RtlPathTypeRooted },
166 
167  { __LINE__, L"\\\\??\\", PrefixNone, L"\\\\??\\", RtlPathTypeUncAbsolute },
168  { __LINE__, L"\\\\??\\C:", PrefixNone, L"\\\\??\\C:", RtlPathTypeUncAbsolute },
169  { __LINE__, L"\\\\??\\C:\\", PrefixNone, L"\\\\??\\C:\\", RtlPathTypeUncAbsolute },
170  { __LINE__, L"\\\\??\\C:\\test", PrefixNone, L"\\\\??\\C:\\test", RtlPathTypeUncAbsolute, PrefixNone, sizeof(L"\\\\??\\C:\\") },
171  { __LINE__, L"\\\\??\\C:\\test\\", PrefixNone, L"\\\\??\\C:\\test\\", RtlPathTypeUncAbsolute },
172  };
175  UNICODE_STRING FullPathName;
176  WCHAR FullPathNameBuffer[MAX_PATH];
177  UNICODE_STRING TempString;
179  SIZE_T FilePartSize;
183  WCHAR ExpectedPathName[MAX_PATH];
184  SIZE_T ExpectedFilePartSize;
185  const INT TestCount = sizeof(TestCases) / sizeof(TestCases[0]);
186  INT i;
187  BOOLEAN Okay;
188 
189  for (i = 0; i < TestCount; i++)
190  {
191  switch (TestCases[i].PrefixType)
192  {
193  case PrefixNone:
194  ExpectedPathName[0] = UNICODE_NULL;
195  break;
196  case PrefixCurrentDrive:
197  GetCurrentDirectoryW(sizeof(ExpectedPathName) / sizeof(WCHAR), ExpectedPathName);
198  ExpectedPathName[3] = UNICODE_NULL;
199  break;
200  case PrefixCurrentPath:
201  {
202  ULONG Length;
203  Length = GetCurrentDirectoryW(sizeof(ExpectedPathName) / sizeof(WCHAR), ExpectedPathName);
204  if (Length == 3 && TestCases[i].FullPathName[0])
205  ExpectedPathName[2] = UNICODE_NULL;
206  break;
207  }
208  default:
209  skip("Invalid test!\n");
210  continue;
211  }
212  wcscat(ExpectedPathName, TestCases[i].FullPathName);
214  RtlInitEmptyUnicodeString(&FullPathName, FullPathNameBuffer, sizeof(FullPathNameBuffer));
215  RtlFillMemory(FullPathName.Buffer, FullPathName.MaximumLength, 0xAA);
216  TempString = FileName;
219  FilePartSize = 1234;
220  NameInvalid = (BOOLEAN)-1;
221  LengthNeeded = 1234;
222  StartSeh()
223  Status = pRtlGetFullPathName_UstrEx(&FileName,
224  &FullPathName,
225  NULL,
226  &StringUsed,
227  &FilePartSize,
228  &NameInvalid,
229  &PathType,
230  &LengthNeeded);
231  ok(Status == STATUS_SUCCESS, "Line %lu: status = %lx\n", TestCases[i].Line, Status);
233  ok_eq_ustr(&FileName, &TempString);
234  ok(FullPathName.Buffer == FullPathNameBuffer, "Line %lu: Buffer modified\n", TestCases[i].Line);
235  ok(FullPathName.MaximumLength == sizeof(FullPathNameBuffer), "Line %lu: MaximumLength modified\n", TestCases[i].Line);
236  Okay = CheckStringBuffer(&FullPathName, ExpectedPathName);
237  ok(Okay, "Line %lu: Wrong path name '%wZ', expected '%S'\n", TestCases[i].Line, &FullPathName, ExpectedPathName);
238  ok(StringUsed == &FullPathName, "Line %lu: StringUsed = %p, expected %p\n", TestCases[i].Line, StringUsed, &FullPathName);
239  switch (TestCases[i].FilePartPrefixType)
240  {
241  case PrefixNone:
242  ExpectedFilePartSize = 0;
243  break;
244  case PrefixCurrentDrive:
245  ExpectedFilePartSize = sizeof(L"C:\\");
246  break;
247  case PrefixCurrentPath:
248  ExpectedFilePartSize = GetCurrentDirectoryW(0, NULL) * sizeof(WCHAR);
249  if (ExpectedFilePartSize == sizeof(L"C:\\"))
250  ExpectedFilePartSize -= sizeof(WCHAR);
251  break;
253  {
254  WCHAR CurrentPath[MAX_PATH];
256  ExpectedFilePartSize = GetCurrentDirectoryW(sizeof(CurrentPath) / sizeof(WCHAR), CurrentPath) * sizeof(WCHAR) + sizeof(UNICODE_NULL);
257  if (ExpectedFilePartSize == sizeof(L"C:\\"))
258  ExpectedFilePartSize = 0;
259  else
260  {
261  BackSlash = wcsrchr(CurrentPath, L'\\');
262  if (BackSlash)
263  ExpectedFilePartSize -= wcslen(BackSlash + 1) * sizeof(WCHAR);
264  else
265  ok(0, "Line %lu: GetCurrentDirectory returned %S\n", TestCases[i].Line, CurrentPath);
266  }
267  break;
268  }
269  default:
270  skip("Invalid test!\n");
271  continue;
272  }
273  ExpectedFilePartSize += TestCases[i].FilePartSize;
274  if (ExpectedFilePartSize != 0)
275  ExpectedFilePartSize = (ExpectedFilePartSize - sizeof(UNICODE_NULL)) / sizeof(WCHAR);
276  ok(FilePartSize == ExpectedFilePartSize,
277  "Line %lu: FilePartSize = %lu, expected %lu\n", TestCases[i].Line, (ULONG)FilePartSize, (ULONG)ExpectedFilePartSize);
278  ok(NameInvalid == FALSE, "Line %lu: NameInvalid = %u\n", TestCases[i].Line, NameInvalid);
279  ok(PathType == TestCases[i].PathType, "Line %lu: PathType = %d, expected %d\n", TestCases[i].Line, PathType, TestCases[i].PathType);
280  ok(LengthNeeded == 0, "Line %lu: LengthNeeded = %lu\n", TestCases[i].Line, (ULONG)LengthNeeded);
281  }
282 }
enum _RTL_PATH_TYPE RTL_PATH_TYPE
const uint16_t * PCWSTR
Definition: typedefs.h:56
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:422
GLdouble n
Definition: glext.h:7729
Definition: movable.cpp:7
#define StartSeh()
Definition: _sntprintf.h:16
int32_t INT
Definition: typedefs.h:57
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:2980
#define InvalidPointer
static BOOLEAN CheckStringBuffer(PCUNICODE_STRING String, PCWSTR Expected)
#define ok_eq_ustr(str1, str2)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
#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
Definition: ncftp.h:79
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:79
struct _FileName FileName
Definition: fatprocs.h:893
IN PUNICODE_STRING IN PUNICODE_STRING IN PUNICODE_STRING IN PSIZE_T FilePartSize OUT PBOOLEAN NameInvalid
#define ok(value,...)
Definition: atltest.h:57
_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:38
#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:3014
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
struct Line Line
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 284 of file RtlGetFullPathName_UstrEx.c.

285 {
288  UNICODE_STRING TempString;
291  SIZE_T FilePartSize;
293  BOOLEAN NameInvalidArray[sizeof(ULONGLONG)];
296  BOOLEAN Okay;
297 
298  pRtlGetFullPathName_UstrEx = (PVOID)GetProcAddress(GetModuleHandleW(L"ntdll"), "RtlGetFullPathName_UstrEx");
299  if (!pRtlGetFullPathName_UstrEx)
300  {
301  skip("RtlGetFullPathName_UstrEx unavailable\n");
302  return;
303  }
304 
305  /* NULL parameters */
306  StartSeh()
307  pRtlGetFullPathName_UstrEx(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
309 
311  TempString = FileName;
312  StartSeh()
313  pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
315  ok_eq_ustr(&FileName, &TempString);
316 
318  TempString = FileName;
319  StartSeh()
320  pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
322  ok_eq_ustr(&FileName, &TempString);
323 
325  StartSeh()
326  pRtlGetFullPathName_UstrEx(NULL, NULL, NULL, NULL, NULL, NULL, &PathType, NULL);
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  ok(LengthNeeded == 0, "LengthNeeded = %lu\n", (ULONG)LengthNeeded);
344 
346  TempString = FileName;
348  FilePartSize = 1234;
349  NameInvalid = (BOOLEAN)-1;
350  LengthNeeded = 1234;
351  StartSeh()
352  pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, &StringUsed, &FilePartSize, &NameInvalid, NULL, &LengthNeeded);
354  ok_eq_ustr(&FileName, &TempString);
356  ok(FilePartSize == 0, "FilePartSize = %lu\n", (ULONG)FilePartSize);
358  ok(LengthNeeded == 0, "LengthNeeded = %lu\n", (ULONG)LengthNeeded);
359 
360  /* This is the first one that doesn't crash. FileName and PathType cannot be NULL */
362  TempString = FileName;
364  StartSeh()
365  Status = pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, NULL, NULL, NULL, &PathType, NULL);
368  ok_eq_ustr(&FileName, &TempString);
370 
372  TempString = FileName;
374  StartSeh()
375  Status = pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, NULL, NULL, NULL, &PathType, NULL);
378  ok_eq_ustr(&FileName, &TempString);
380 
381  /* Show that NameInvalid is indeed BOOLEAN */
383  TempString = FileName;
385  RtlFillMemory(NameInvalidArray, sizeof(NameInvalidArray), 0x55);
386  StartSeh()
387  Status = pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, NULL, NULL, NameInvalidArray, &PathType, NULL);
390  ok_eq_ustr(&FileName, &TempString);
392  ok(NameInvalidArray[0] == FALSE, "NameInvalid = %u\n", NameInvalidArray[0]);
393  Okay = CheckBuffer(NameInvalidArray + 1, sizeof(NameInvalidArray) - sizeof(NameInvalidArray[0]), 0x55);
394  ok(Okay, "CheckBuffer failed\n");
395 
396  /* Give it a valid path */
398  TempString = FileName;
400  StartSeh()
401  Status = pRtlGetFullPathName_UstrEx(&FileName, NULL, NULL, NULL, NULL, NULL, &PathType, NULL);
404  ok_eq_ustr(&FileName, &TempString);
406 
407  /* Zero-length static string */
409  TempString = FileName;
412  StartSeh()
413  Status = pRtlGetFullPathName_UstrEx(&FileName, &StaticString, NULL, NULL, NULL, NULL, &PathType, NULL);
416  ok_eq_ustr(&FileName, &TempString);
418 
419  /* TODO: play around with StaticString and DynamicString */
420 
421  /* Check the actual functionality with different paths */
422  RunTestCases();
423 }
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 StartSeh()
Definition: _sntprintf.h:16
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
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
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
uint64_t ULONGLONG
Definition: typedefs.h:66
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:79
struct _FileName FileName
Definition: fatprocs.h:893
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:838
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlPathTypeNotSet
#define GetProcAddress(x, y)
Definition: compat.h:419
_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:3014
IN PUNICODE_STRING StaticString
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17
Definition: ps.c:97

Variable Documentation

◆ DynamicString

◆ NameInvalid

◆ OPTIONAL

◆ PathType

◆ StaticString

◆ StringUsed