ReactOS 0.4.15-dev-7918-g2a2556c
RtlDosSearchPath_U.c File Reference
#include "precomp.h"
Include dependency graph for RtlDosSearchPath_U.c:

Go to the source code of this file.

Macros

#define PrintablePointer(p)   ((p) == InvalidPointer ? NULL : (p))
 
#define MAKE_DIRECTORY(path)
 
#define MAKE_FILE(path)
 
#define DELETE_DIRECTORY(path)
 
#define DELETE_FILE(path)
 

Functions

static BOOLEAN CheckStringBuffer (PCWSTR Buffer, SIZE_T Length, SIZE_T MaximumLength, PCWSTR Expected)
 
static BOOLEAN CheckBuffer (PVOID Buffer, SIZE_T Size, UCHAR Value)
 
static VOID RunTestCases (PCWSTR CustomPath)
 
 START_TEST (RtlDosSearchPath_U)
 

Macro Definition Documentation

◆ DELETE_DIRECTORY

#define DELETE_DIRECTORY (   path)
Value:
do { \
swprintf(FileName, path, CustomPath); \
ok(Success, \
"RemoveDirectory failed (%lu), test might leave stale directory\n", \
} while (0)
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
@ Success
Definition: eventcreate.c:712
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Definition at line 287 of file RtlDosSearchPath_U.c.

◆ DELETE_FILE

#define DELETE_FILE (   path)
Value:
do { \
swprintf(FileName, path, CustomPath); \
ok(Success, \
"DeleteFile failed (%lu), test might leave stale file\n", \
} while (0)
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39

Definition at line 296 of file RtlDosSearchPath_U.c.

◆ MAKE_DIRECTORY

#define MAKE_DIRECTORY (   path)
Value:
do { \
swprintf(FileName, path, CustomPath); \
ok(Success, "CreateDirectory failed, results might not be accurate\n"); \
} while (0)
#define NULL
Definition: types.h:112
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90

Definition at line 271 of file RtlDosSearchPath_U.c.

◆ MAKE_FILE

#define MAKE_FILE (   path)
Value:
do { \
swprintf(FileName, path, CustomPath); \
"CreateFile failed, results might not be accurate\n"); \
} while (0)
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileW
Definition: compat.h:741
ULONG Handle
Definition: gdb_input.c:15
#define CREATE_NEW
Definition: disk.h:69

Definition at line 278 of file RtlDosSearchPath_U.c.

◆ PrintablePointer

#define PrintablePointer (   p)    ((p) == InvalidPointer ? NULL : (p))

Definition at line 23 of file RtlDosSearchPath_U.c.

Function Documentation

◆ CheckBuffer()

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

Definition at line 76 of file RtlDosSearchPath_U.c.

80{
81 PUCHAR Array = Buffer;
82 SIZE_T i;
83
84 for (i = 0; i < Size; i++)
85 if (Array[i] != Value)
86 {
87 trace("Expected %x, found %x at offset %lu\n", Value, Array[i], (ULONG)i);
88 return FALSE;
89 }
90 return TRUE;
91}
#define trace
Definition: atltest.h:70
Definition: bufpool.h:45
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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
ULONG_PTR SIZE_T
Definition: typedefs.h:80
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by RunTestCases(), and START_TEST().

◆ CheckStringBuffer()

static BOOLEAN CheckStringBuffer ( PCWSTR  Buffer,
SIZE_T  Length,
SIZE_T  MaximumLength,
PCWSTR  Expected 
)
static

Definition at line 27 of file RtlDosSearchPath_U.c.

32{
33 SIZE_T ExpectedLength = wcslen(Expected) * sizeof(WCHAR);
34 SIZE_T EqualLength;
36 SIZE_T i;
37
38 if (Length != ExpectedLength)
39 {
40 ok(0, "String length is %lu, expected %lu\n", (ULONG)Length, (ULONG)ExpectedLength);
41 Result = FALSE;
42 }
43
44 EqualLength = RtlCompareMemory(Buffer, Expected, Length);
45 if (EqualLength != Length)
46 {
47 ok(0, "String is '%S', expected '%S'\n", Buffer, Expected);
48 Result = FALSE;
49 }
50
51 if (Buffer[Length / sizeof(WCHAR)] != UNICODE_NULL)
52 {
53 ok(0, "Not null terminated\n");
54 Result = FALSE;
55 }
56
57 /* the function nulls the rest of the buffer! */
58 for (i = Length + sizeof(UNICODE_NULL); i < MaximumLength; i++)
59 {
60 UCHAR Char = ((PUCHAR)Buffer)[i];
61 if (Char != 0)
62 {
63 ok(0, "Found 0x%x at offset %lu, expected 0x%x\n", Char, (ULONG)i, 0);
64 /* don't count this as a failure unless the string was actually wrong */
65 //Result = FALSE;
66 /* don't flood the log */
67 break;
68 }
69 }
70
71 return Result;
72}
BOOLEAN Expected
unsigned char BOOLEAN
#define ok(value,...)
Definition: atltest.h:57
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength
_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:409
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by RunTestCases().

◆ RunTestCases()

static VOID RunTestCases ( PCWSTR  CustomPath)
static

Definition at line 95 of file RtlDosSearchPath_U.c.

97{
98 struct
99 {
103 PCWSTR ResultPath;
104 PCWSTR ResultFileName;
105 } Tests[] =
106 {
107 { L"", L"", NULL, NULL, NULL },
108 { L"C:\\%ls\\Folder1", L"File1", NULL, L"C:\\%ls\\Folder1\\", L"File1" },
109 /* No path: current directory */
110 { L"", L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
111 /* Full path as FileName */
112 { L"", L"C:\\", NULL, L"C:\\", NULL },
113 { L"", L"C:\\%ls\\Folder1", NULL, L"C:\\%ls\\", L"Folder1" },
114 /* No FileName */
115 { L"C:\\", L"", NULL, L"C:\\", NULL },
116 { L"C:\\%ls\\Folder1", L"", NULL, L"C:\\%ls\\Folder1\\", NULL },
117 /* Full path as FileName */
118 { L"", L"C:\\%ls\\Folder1\\SomeProgram.exe", NULL, L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
119 { L"", L"C:\\%ls\\Folder1\\SomeProgram.exe", L".exe", L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
120 { L"", L"C:\\%ls\\Folder1\\SomeProgram", NULL, NULL, NULL },
121 // 10
122 { L"", L"C:\\%ls\\Folder1\\SomeProgram", L".exe", NULL, NULL },
123 /* Both SearchPath and FileName */
124 { L"C:\\%ls\\Folder1\\", L"SomeProgram.exe", NULL, L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
125 { L"C:\\%ls\\Folder1\\", L"SomeProgram.exe", L".exe", L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
126 { L"C:\\%ls\\Folder1\\", L"SomeProgram", NULL, NULL, NULL },
127 { L"C:\\%ls\\Folder1\\", L"SomeProgram", L".exe", L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
128 { L"C:\\%ls\\Folder1", L"SomeProgram.exe", NULL, L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
129 { L"C:\\%ls\\Folder1", L"SomeProgram.exe", L".exe", L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
130 { L"C:\\%ls\\Folder1", L"SomeProgram", NULL, NULL, NULL },
131 { L"C:\\%ls\\Folder1", L"SomeProgram", L".exe", L"C:\\%ls\\Folder1\\", L"SomeProgram.exe" },
132 /* Full path to file in SearchPath doesn't work */
133 { L"C:\\%ls\\Folder1\\SomeProgram.exe", L"", NULL, NULL, NULL },
134 // 20
135 { L"C:\\%ls\\Folder1\\SomeProgram.exe", L"", L".exe", NULL, NULL },
136 { L"C:\\%ls\\Folder1\\SomeProgram", L"", NULL, NULL, NULL },
137 { L"C:\\%ls\\Folder1\\SomeProgram", L"", L".exe", NULL, NULL },
138 /* */
139 { L"C:\\%ls\\Folder1", L"File1", NULL, L"C:\\%ls\\Folder1\\", L"File1" },
140 { L"C:\\%ls\\CurrentDirectory", L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
141 { L"C:\\%ls\\Folder1 ", L"File1", NULL, NULL, NULL },
142 { L"C:\\%ls\\CurrentDirectory ",L"File1", NULL, NULL, NULL },
143 { L" C:\\%ls\\Folder1", L"File1", NULL, NULL, NULL },
144 { L" C:\\%ls\\CurrentDirectory",L"File1", NULL, NULL, NULL },
145 { L" C:\\%ls\\Folder1 ", L"File1", NULL, NULL, NULL },
146 // 30
147 { L" C:\\%ls\\CurrentDirectory ",L"File1", NULL, NULL, NULL },
148 /* Multiple search paths */
149 { L"C:\\%ls\\Folder1;C:\\%ls\\CurrentDirectory",
150 L"File1", NULL, L"C:\\%ls\\Folder1\\", L"File1" },
151 { L"C:\\%ls\\CurrentDirectory;C:\\%ls\\Folder1",
152 L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
153 { L"C:\\%ls\\CurrentDirectory ; C:\\%ls\\Folder1",
154 L"File1", NULL, NULL, NULL },
155 { L"C:\\%ls\\CurrentDirectory ;C:\\%ls\\Folder1",
156 L"File1", NULL, L"C:\\%ls\\Folder1\\", L"File1" },
157 { L"C:\\%ls\\CurrentDirectory; C:\\%ls\\Folder1",
158 L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
159 { L";C:\\%ls\\Folder1", L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
160 { L";C:\\%ls\\Folder1;", L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
161 { L";C:\\%ls\\Folder1;", L"File1", NULL, L"C:\\%ls\\CurrentDirectory\\", L"File1" },
162 { L"C:\\%ls\\Folder1", L"OnlyInCurr", NULL, NULL, NULL },
163 // 40
164 { L"", L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
165 { L"", L"OnlyInCurr ", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
166 { L"", L" OnlyInCurr", NULL, NULL, NULL },
167 { L" ", L"OnlyInCurr", NULL, NULL, NULL },
168 { L";", L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
169 { L"; ", L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
170 { L" ;", L"OnlyInCurr", NULL, NULL, NULL },
171 { L" ; ", L"OnlyInCurr", NULL, NULL, NULL },
172 { L";C:\\%ls\\Folder1", L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
173 { L"C:\\%ls\\Folder1;", L"OnlyInCurr", NULL, NULL, NULL },
174 // 50
175 { L"C:\\%ls\\Folder1;;", L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
176 { L";C:\\%ls\\Folder1;", L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
177 { L"C:\\%ls\\Folder1;C:\\%ls\\Folder2",
178 L"OnlyInCurr", NULL, NULL, NULL },
179 { L";C:\\%ls\\Folder1;C:\\%ls\\Folder2",
180 L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
181 { L"C:\\%ls\\Folder1;;C:\\%ls\\Folder2",
182 L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
183 { L"C:\\%ls\\Folder1;C:\\%ls\\Folder2;",
184 L"OnlyInCurr", NULL, NULL, NULL },
185 { L"C:\\%ls\\Folder1;C:\\%ls\\Folder2;;",
186 L"OnlyInCurr", NULL, L"C:\\%ls\\CurrentDirectory\\", L"OnlyInCurr" },
187 /* Spaces in FileName! */
188 { L"", L"C:\\%ls\\Folder1\\SomeProgram With Spaces",
189 L".exe", NULL, NULL },
190 { L"", L"C:\\%ls\\Folder1\\SomeProgram With Spaces.exe",
191 L".exe", NULL, NULL },
192 { L"", L"C:\\%ls\\Folder1\\Program", L".exe", NULL, NULL },
193 // 60
194 { L"", L"C:\\%ls\\Folder1\\Program.exe", L".exe", L"C:\\%ls\\Folder1\\", L"Program.exe" },
195 { L"", L"C:\\%ls\\Folder1\\Program With", L".exe", NULL, NULL },
196 { L"", L"C:\\%ls\\Folder1\\Program With.exe", L".exe", L"C:\\%ls\\Folder1\\", L"Program With.exe" },
197 { L"", L"C:\\%ls\\Folder1\\Program With Spaces",L".exe", NULL, NULL },
198 { L"", L"C:\\%ls\\Folder1\\Program With Spaces.exe",
199 L".exe", L"C:\\%ls\\Folder1\\", L"Program With Spaces.exe" },
200 /* Same tests with path in SearchPath - now extensions are appended */
201 { L"C:\\%ls\\Folder1", L"SomeProgram With Spaces",
202 L".exe", NULL, NULL },
203 { L"C:\\%ls\\Folder1", L"SomeProgram With Spaces.exe",
204 L".exe", NULL, NULL },
205 { L"C:\\%ls\\Folder1", L"Program", L".exe", L"C:\\%ls\\Folder1\\", L"Program.exe" },
206 { L"C:\\%ls\\Folder1", L"Program.exe", L".exe", L"C:\\%ls\\Folder1\\", L"Program.exe" },
207 { L"C:\\%ls\\Folder1", L"Program With", L".exe", L"C:\\%ls\\Folder1\\", L"Program With.exe" },
208 // 70
209 { L"C:\\%ls\\Folder1", L"Program With.exe", L".exe", L"C:\\%ls\\Folder1\\", L"Program With.exe" },
210 { L"C:\\%ls\\Folder1", L"Program With Spaces", L".exe", L"C:\\%ls\\Folder1\\", L"Program With Spaces.exe" },
211 { L"C:\\%ls\\Folder1", L"Program With Spaces.exe",
212 L".exe", L"C:\\%ls\\Folder1\\", L"Program With Spaces.exe" },
213 };
214
215 ULONG i;
217 PWSTR PartName;
220 WCHAR ResultPath[MAX_PATH];
222 BOOLEAN Okay;
223
224 for (i = 0; i < sizeof(Tests) / sizeof(Tests[0]); i++)
225 {
226 swprintf(SearchPath, Tests[i].SearchPath, CustomPath, CustomPath, CustomPath, CustomPath);
227 swprintf(FileName, Tests[i].FileName, CustomPath, CustomPath, CustomPath, CustomPath);
228 RtlFillMemory(Buffer, sizeof(Buffer), 0x55);
229 PartName = InvalidPointer;
230
231 StartSeh()
233 FileName,
235 sizeof(Buffer),
236 Buffer,
237 &PartName);
239
240 if (Tests[i].ResultPath)
241 {
242 swprintf(ResultPath, Tests[i].ResultPath, CustomPath, CustomPath, CustomPath, CustomPath);
243 if (Tests[i].ResultFileName)
244 {
245 ok(PartName == &Buffer[wcslen(ResultPath)],
246 "PartName = %p (%ls), expected %p\n",
247 PartName, PrintablePointer(PartName), &Buffer[wcslen(ResultPath)]);
248 wcscat(ResultPath, Tests[i].ResultFileName);
249 }
250 else
251 {
252 ok(PartName == NULL,
253 "PartName = %p (%ls), expected NULL\n",
254 PartName, PrintablePointer(PartName));
255 }
256 Okay = CheckStringBuffer(Buffer, Length, sizeof(Buffer), ResultPath);
257 ok(Okay == TRUE, "CheckStringBuffer failed. Got '%ls', expected '%ls'\n", Buffer, ResultPath);
258 }
259 else
260 {
261 Okay = CheckBuffer(Buffer, sizeof(Buffer), 0x55);
262 ok(Okay == TRUE, "CheckBuffer failed\n");
263 ok(Length == 0, "Length = %lu\n", Length);
264 ok(PartName == InvalidPointer,
265 "PartName = %p (%ls), expected %p\n",
266 PartName, PrintablePointer(PartName), InvalidPointer);
267 }
268 }
269}
struct test_data Tests[]
#define PrintablePointer(p)
static BOOLEAN CheckStringBuffer(PCWSTR Buffer, SIZE_T Length, SIZE_T MaximumLength, PCWSTR Expected)
static BOOLEAN CheckBuffer(PVOID Buffer, SIZE_T Size, UCHAR Value)
#define InvalidPointer
#define StartSeh()
Definition: _sntprintf.h:16
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17
#define MAX_PATH
Definition: compat.h:34
#define swprintf
Definition: precomp.h:40
struct _FileName FileName
Definition: fatprocs.h:896
_Inout_opt_ PUNICODE_STRING Extension
Definition: fltkernel.h:1092
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:599
if(dx< 0)
Definition: linetemp.h:194
NTSYSAPI ULONG NTAPI RtlDosSearchPath_U(_In_ PCWSTR Path, _In_ PCWSTR FileName, _In_ PCWSTR Extension, _In_ ULONG BufferSize, _Out_ PWSTR Buffer, _Out_ PWSTR *PartName)
#define L(x)
Definition: ntvdm.h:50
_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 STATUS_SUCCESS
Definition: shellext.h:65
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define SearchPath
Definition: winbase.h:3900
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( RtlDosSearchPath_U  )

Definition at line 305 of file RtlDosSearchPath_U.c.

306{
307 ULONG Length = 0;
309 PWSTR PartName;
310 BOOLEAN Okay;
313 WCHAR CustomPath[MAX_PATH] = L"RtlDosSearchPath_U_TestPath";
315
316 swprintf(FileName, L"C:\\%ls", CustomPath);
317 /* Make sure this directory doesn't exist */
319 {
320 wcscat(CustomPath, L"X");
321 swprintf(FileName, L"C:\\%ls", CustomPath);
322 }
324 ok(Success, "CreateDirectory failed, results might not be accurate\n");
325
326 MAKE_DIRECTORY(L"C:\\%ls\\Folder1");
327 MAKE_DIRECTORY(L"C:\\%ls\\Folder2");
328 MAKE_DIRECTORY(L"C:\\%ls\\CurrentDirectory");
330 ok(Success, "SetCurrentDirectory failed\n");
331 MAKE_FILE(L"C:\\%ls\\Folder1\\File1");
332 MAKE_FILE(L"C:\\%ls\\Folder1\\SomeProgram.exe");
333 MAKE_FILE(L"C:\\%ls\\Folder1\\SomeProgram2.exe");
334 MAKE_FILE(L"C:\\%ls\\Folder1\\SomeProgram2.exe.exe");
335 MAKE_FILE(L"C:\\%ls\\Folder1\\SomeProgram3.exe.exe");
336 MAKE_FILE(L"C:\\%ls\\Folder1\\Program.exe");
337 MAKE_FILE(L"C:\\%ls\\Folder1\\Program With.exe");
338 MAKE_FILE(L"C:\\%ls\\Folder1\\Program With Spaces.exe");
339 MAKE_FILE(L"C:\\%ls\\CurrentDirectory\\File1");
340 MAKE_FILE(L"C:\\%ls\\CurrentDirectory\\OnlyInCurr");
341
342 /* NULL parameters */
349
350 /* Empty strings - first one that doesn't crash */
351 StartSeh()
352 Length = RtlDosSearchPath_U(L"", L"", NULL, 0, NULL, NULL);
353 ok(Length == 0, "Length %lu\n", Length);
355
356 /* Check what's initialized */
357 PartName = InvalidPointer;
358 StartSeh()
359 Length = RtlDosSearchPath_U(L"", L"", NULL, 0, NULL, &PartName);
360 ok(Length == 0, "Length = %lu\n", Length);
362 ok(PartName == InvalidPointer, "PartName = %p\n", PartName);
363
365 StartSeh()
367 ok(Length == 0, "Length %lu\n", Length);
369 Okay = CheckBuffer(Buffer, sizeof(Buffer), 0x55);
370 ok(Okay, "CheckBuffer failed\n");
371
372 PartName = InvalidPointer;
374 StartSeh()
375 Length = RtlDosSearchPath_U(L"", L"", NULL, sizeof(Buffer), Buffer, &PartName);
376 ok(Length == 0, "Length %lu\n", Length);
378 ok(PartName == InvalidPointer, "PartName = %p\n", PartName);
379 Okay = CheckBuffer(Buffer, sizeof(Buffer), 0x55);
380 ok(Okay, "CheckBuffer failed\n");
381
382 /* Now test the actual functionality */
383 RunTestCases(CustomPath);
384
385 /*
386 * Clean up test folder - We can't delete it
387 * if our current directory is inside.
388 */
390 DELETE_FILE(L"C:\\%ls\\CurrentDirectory\\OnlyInCurr");
391 DELETE_FILE(L"C:\\%ls\\CurrentDirectory\\File1");
392 DELETE_FILE(L"C:\\%ls\\Folder1\\Program With Spaces.exe");
393 DELETE_FILE(L"C:\\%ls\\Folder1\\Program With.exe");
394 DELETE_FILE(L"C:\\%ls\\Folder1\\Program.exe");
395 DELETE_FILE(L"C:\\%ls\\Folder1\\SomeProgram3.exe.exe");
396 DELETE_FILE(L"C:\\%ls\\Folder1\\SomeProgram2.exe.exe");
397 DELETE_FILE(L"C:\\%ls\\Folder1\\SomeProgram2.exe");
398 DELETE_FILE(L"C:\\%ls\\Folder1\\SomeProgram.exe");
399 DELETE_FILE(L"C:\\%ls\\Folder1\\File1");
401 DELETE_DIRECTORY(L"C:\\%ls\\Folder2");
402 DELETE_DIRECTORY(L"C:\\%ls\\Folder1");
403 DELETE_DIRECTORY(L"C:\\%ls");
404}
#define MAKE_DIRECTORY(path)
static VOID RunTestCases(PCWSTR CustomPath)
#define DELETE_DIRECTORY(path)
#define MAKE_FILE(path)
#define DELETE_FILE(path)
void ls(int argc, const char *argv[])
Definition: cmds.c:1136
WCHAR CurrentDirectory[1024]
Definition: chkdsk.c:74
Definition: terminate.cpp:24
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2249
unsigned int BOOL
Definition: ntddk_ex.h:94
GLdouble n
Definition: glext.h:7729
GLfloat GLfloat p
Definition: glext.h:8902
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23