ReactOS 0.4.15-dev-7788-g1ad9096
FindFiles.c File Reference
#include "precomp.h"
#include <versionhelpers.h>
Include dependency graph for FindFiles.c:

Go to the source code of this file.

Macros

#define ok_err(error)    ok_int(GetLastError(), error)
 
#define testType1_A(lpFileName, dwInitialError, hExpectedHandleValue, dwExpectedError, bExpectedNullFilename)
 
#define testType1_W(lpFileName, dwInitialError, hExpectedHandleValue, dwExpectedError, bExpectedNullFilename)
 
#define testType2_A(lpFileName, dwInitialError, hUnexpectedHandleValue, dwExpectedError)
 
#define testType2_W(lpFileName, dwInitialError, hUnexpectedHandleValue, dwExpectedError)
 
#define testType3_A(lpFileName, fInfoLevelId, fSearchOp, lpSearchFilter, dwAdditionalFlags, dwInitialError, hUnexpectedHandleValue, dwExpectedError)
 
#define testType3_W(lpFileName, fInfoLevelId, fSearchOp, lpSearchFilter, dwAdditionalFlags, dwInitialError, hUnexpectedHandleValue, dwExpectedError)
 

Functions

static void Test_FindFirstFileA (void)
 
static void Test_FindFirstFileW (void)
 
static void Test_FindFirstFileExA (void)
 
static void Test_FindFirstFileExW (void)
 
static int init (void)
 
 START_TEST (FindFiles)
 

Variables

static CHAR OSDirA [MAX_PATH]
 
static WCHAR OSDirW [MAX_PATH]
 
static CHAR baseA [MAX_PATH]
 
static WCHAR baseW [MAX_PATH]
 
static CHAR selfnameA [MAX_PATH]
 
static WCHAR selfnameW [MAX_PATH]
 
static LPSTR exenameA
 
static LPWSTR exenameW
 
static INT myARGC
 
static LPSTRmyARGV
 

Macro Definition Documentation

◆ ok_err

#define ok_err (   error)     ok_int(GetLastError(), error)

Definition at line 40 of file FindFiles.c.

◆ testType1_A

#define testType1_A (   lpFileName,
  dwInitialError,
  hExpectedHandleValue,
  dwExpectedError,
  bExpectedNullFilename 
)
Value:
do { \
ZeroMemory(&fd, sizeof(fd)); \
SetLastError((dwInitialError)); \
ok(h == (hExpectedHandleValue), "FindFirstFileA returned 0x%p, expected 0x%p\n", h, (hExpectedHandleValue)); \
ok_err(dwExpectedError); \
if (bExpectedNullFilename) \
ok(fd.cFileName[0] == 0, "fd.cFileName != \"\"\n"); \
else \
ok(fd.cFileName[0] != 0, "fd.cFileName == \"\"\n"); \
FindClose(h); \
} while (0)
HANDLE WINAPI FindFirstFileA(IN LPCSTR lpFileName, OUT LPWIN32_FIND_DATAA lpFindFileData)
Definition: find.c:263
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static int fd
Definition: io.c:51
_In_ LPCSTR lpFileName
Definition: winbase.h:3071

Definition at line 48 of file FindFiles.c.

◆ testType1_W

#define testType1_W (   lpFileName,
  dwInitialError,
  hExpectedHandleValue,
  dwExpectedError,
  bExpectedNullFilename 
)
Value:
do { \
ZeroMemory(&fd, sizeof(fd)); \
SetLastError((dwInitialError)); \
ok(h == (hExpectedHandleValue), "FindFirstFileW returned 0x%p, expected 0x%p\n", h, (hExpectedHandleValue)); \
ok_err(dwExpectedError); \
if (bExpectedNullFilename) \
ok(fd.cFileName[0] == 0, "fd.cFileName != \"\"\n"); \
else \
ok(fd.cFileName[0] != 0, "fd.cFileName == \"\"\n"); \
FindClose(h); \
} while (0)
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320

Definition at line 62 of file FindFiles.c.

◆ testType2_A

#define testType2_A (   lpFileName,
  dwInitialError,
  hUnexpectedHandleValue,
  dwExpectedError 
)
Value:
do { \
ZeroMemory(&fd, sizeof(fd)); \
SetLastError((dwInitialError)); \
ok(h != (hUnexpectedHandleValue), "FindFirstFileA returned 0x%p\n", h); \
ok_err(dwExpectedError); \
ok(fd.cFileName[0] != 0, "fd.cFileName == \"\"\n"); \
FindClose(h); \
} while (0)

Definition at line 76 of file FindFiles.c.

◆ testType2_W

#define testType2_W (   lpFileName,
  dwInitialError,
  hUnexpectedHandleValue,
  dwExpectedError 
)
Value:
do { \
ZeroMemory(&fd, sizeof(fd)); \
SetLastError((dwInitialError)); \
ok(h != (hUnexpectedHandleValue), "FindFirstFileW returned 0x%p\n", h); \
ok_err(dwExpectedError); \
ok(fd.cFileName[0] != 0, "fd.cFileName == \"\"\n"); \
FindClose(h); \
} while (0)

Definition at line 87 of file FindFiles.c.

◆ testType3_A

#define testType3_A (   lpFileName,
  fInfoLevelId,
  fSearchOp,
  lpSearchFilter,
  dwAdditionalFlags,
  dwInitialError,
  hUnexpectedHandleValue,
  dwExpectedError 
)
Value:
do { \
ZeroMemory(&fd, sizeof(fd)); \
SetLastError((dwInitialError)); \
h = FindFirstFileExA((lpFileName), (fInfoLevelId), &fd, (fSearchOp), (lpSearchFilter), (dwAdditionalFlags)); \
ok(h != (hUnexpectedHandleValue), "FindFirstFileExA returned 0x%p\n", h); \
ok_err(dwExpectedError); \
ok(fd.cFileName[0] != 0, "fd.cFileName == \"\"\n"); \
FindClose(h); \
} while (0)
HANDLE WINAPI FindFirstFileExA(IN LPCSTR lpFileName, IN FINDEX_INFO_LEVELS fInfoLevelId, OUT LPVOID lpFindFileData, IN FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, IN DWORD dwAdditionalFlags)
Definition: find.c:569

Definition at line 98 of file FindFiles.c.

◆ testType3_W

#define testType3_W (   lpFileName,
  fInfoLevelId,
  fSearchOp,
  lpSearchFilter,
  dwAdditionalFlags,
  dwInitialError,
  hUnexpectedHandleValue,
  dwExpectedError 
)
Value:
do { \
ZeroMemory(&fd, sizeof(fd)); \
SetLastError((dwInitialError)); \
h = FindFirstFileExW((lpFileName), (fInfoLevelId), &fd, (fSearchOp), (lpSearchFilter), (dwAdditionalFlags)); \
ok(h != (hUnexpectedHandleValue), "FindFirstFileExW returned 0x%p\n", h); \
ok_err(dwExpectedError); \
ok(fd.cFileName[0] != 0, "fd.cFileName == \"\"\n"); \
FindClose(h); \
} while (0)
HANDLE WINAPI FindFirstFileExW(IN LPCWSTR lpFileName, IN FINDEX_INFO_LEVELS fInfoLevelId, OUT LPVOID lpFindFileData, IN FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, IN DWORD dwAdditionalFlags)
Definition: find.c:649

Definition at line 109 of file FindFiles.c.

Function Documentation

◆ init()

static int init ( void  )
static

Definition at line 537 of file FindFiles.c.

538{
539 LPSTR p;
540 size_t i;
541
543 if (!GetCurrentDirectoryA(_countof(baseA), baseA)) return 0;
545
546 /* Strip the path of selfname */
547 if ((p = strrchr(selfnameA, '\\')) != NULL)
548 exenameA = p + 1;
549 else
551
552 if ((p = strrchr(exenameA, '/')) != NULL)
553 exenameA = p + 1;
554
555 if (!GetWindowsDirectoryA(OSDirA, _countof(OSDirA))) return 0;
556
557 /* Quick-and-dirty conversion ANSI --> UNICODE without the Win32 APIs */
558 for (i = 0 ; i <= strlen(baseA) ; ++i)
559 {
560 baseW[i] = (WCHAR)baseA[i];
561 }
562 for (i = 0 ; i <= strlen(selfnameA) ; ++i)
563 {
565 }
567 for (i = 0 ; i <= strlen(OSDirA) ; ++i)
568 {
569 OSDirW[i] = (WCHAR)OSDirA[i];
570 }
571
572 return 1;
573}
static LPSTR exenameA
Definition: FindFiles.c:27
static CHAR baseA[MAX_PATH]
Definition: FindFiles.c:23
static WCHAR OSDirW[MAX_PATH]
Definition: FindFiles.c:22
static INT myARGC
Definition: FindFiles.c:29
static CHAR OSDirA[MAX_PATH]
Definition: FindFiles.c:21
static WCHAR selfnameW[MAX_PATH]
Definition: FindFiles.c:26
static WCHAR baseW[MAX_PATH]
Definition: FindFiles.c:24
static LPWSTR exenameW
Definition: FindFiles.c:28
static LPSTR * myARGV
Definition: FindFiles.c:30
static CHAR selfnameA[MAX_PATH]
Definition: FindFiles.c:25
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define NULL
Definition: types.h:112
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2146
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337
GLfloat GLfloat p
Definition: glext.h:8902
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
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
int winetest_get_mainargs(char ***pargv)
#define _countof(array)
Definition: sndvol32.h:68
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( FindFiles  )

Definition at line 575 of file FindFiles.c.

576{
577 int b = init();
578 ok(b, "Basic init of FindFiles test\n");
579 if (!b) return;
580
585}
static void Test_FindFirstFileExA(void)
Definition: FindFiles.c:503
static void Test_FindFirstFileExW(void)
Definition: FindFiles.c:520
static void Test_FindFirstFileA(void)
Definition: FindFiles.c:121
static void Test_FindFirstFileW(void)
Definition: FindFiles.c:312
static int init(void)
Definition: FindFiles.c:537
#define ok(value,...)
Definition: atltest.h:57
GLboolean GLboolean GLboolean b
Definition: glext.h:6204

◆ Test_FindFirstFileA()

static void Test_FindFirstFileA ( void  )
static

Definition at line 121 of file FindFiles.c.

122{
126 HANDLE h;
127
128 /* Save the current directory */
130
131/*** Tests for the root directory - root directory ***/
132 /* Modify the current directory */
133 SetCurrentDirectoryA("C:\\");
134
136
139 testType2_A("C:\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
140
143 testType2_A("\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
144
145 /* Restore the old current directory */
147/*****************************************************/
148
149/*** Tests for the root directory - long directory ***/
150 /* Modify the current directory */
151 SetCurrentDirectoryA(OSDirA); /* We expect here that OSDir is of the form: C:\OSDir */
152
153 testType2_A("C:", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
154
157 testType2_A("C:\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
158
161 testType2_A("\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
162
163 /* Restore the old current directory */
165/*****************************************************/
166
167/*** Relative paths ***/
168 /*
169 * NOTE: This test does not give the same results if you launch the app
170 * from a root drive or from a long-form directory (of the form C:\dir).
171 */
172 // testType2_A("..", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
173 // testType1_A("..", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND, TRUE);
174/**********************/
175
176/*** Relative paths - root directory ***/
177 /* Modify the current directory */
178 SetCurrentDirectoryA("C:\\");
179
183 testType2_A(".\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
184
188 testType2_A("..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
189
190 /* Restore the old current directory */
192/***************************************/
193
194/*** Relative paths - long directory ***/
195 /* Modify the current directory */
196 SetCurrentDirectoryA(OSDirA); /* We expect here that OSDir is of the form: C:\OSDir */
197
198 testType2_A(".", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
199
202 testType2_A(".\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
203
205
208 testType2_A("..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
209
210 /* Restore the old current directory */
212/****************************************/
213
214/*** Unexisting path ***/
215 testType1_A("C:\\foobar", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND, TRUE);
216 testType1_A("C:\\foobar\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
217 testType1_A("C:\\foobar\\\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
218 testType1_A("C:\\foobar\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
219 testType1_A("C:\\foobar\\system32\\..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
220
221 /* Possibly a DOS device */
222 testType1_A("C:\\foobar\\nul", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
223 testType1_A("C:\\foobar\\nul\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
224 testType1_A("C:\\foobar\\nul\\\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
225 testType1_A("C:\\foobar\\nul\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
226
227 testType1_A("C:\\foobar\\toto", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
228 testType1_A("C:\\foobar\\toto\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
229 testType1_A("C:\\foobar\\toto\\\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
230 testType1_A("C:\\foobar\\toto\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
231
232 strcpy(Buffer, "C:\\foobar\\");
235
236 strcpy(Buffer, "C:\\foobar\\.\\");
239/***********************/
240
241/*** Existing path ***/
243 testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
244
246 strcat(Buffer, "\\");
248
250 strcat(Buffer, "\\\\");
252
254 strcat(Buffer, "\\*");
255 testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
256
258 strcat(Buffer, "\\.\\*");
259 testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
260
262 strcat(Buffer, "\\system32\\..\\*");
263 testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
264
265 /* Possibly a DOS device */
267 strcat(Buffer, "\\nul");
268 testType1_A(Buffer, 0xdeadbeef, (HANDLE)0x00000001, 0xdeadbeef, FALSE);
269
271 strcat(Buffer, "\\nul\\");
273
275 strcat(Buffer, "\\nul\\\\");
277
279 strcat(Buffer, "\\nul\\*");
281
283 strcat(Buffer, "\\toto");
285
287 strcat(Buffer, "\\toto\\");
289
291 strcat(Buffer, "\\toto\\\\");
293
295 strcat(Buffer, "\\toto\\*");
297
298 // strcpy(Buffer, baseA);
299 // strcat(Buffer, "\\");
300 // strcat(Buffer, exenameA);
301 // testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
302
303 // strcpy(Buffer, baseA);
304 // strcat(Buffer, "\\.\\");
305 // strcat(Buffer, exenameA);
306 // testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
307/*********************/
308
309 return;
310}
#define testType1_A(lpFileName, dwInitialError, hExpectedHandleValue, dwExpectedError, bExpectedNullFilename)
Definition: FindFiles.c:48
#define testType2_A(lpFileName, dwInitialError, hUnexpectedHandleValue, dwExpectedError)
Definition: FindFiles.c:76
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
WCHAR CurrentDirectory[1024]
Definition: chkdsk.c:74
Definition: bufpool.h:45
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define ERROR_INVALID_NAME
Definition: compat.h:103
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2206
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

◆ Test_FindFirstFileExA()

static void Test_FindFirstFileExA ( void  )
static

Definition at line 503 of file FindFiles.c.

504{
507 HANDLE h;
508
509 /* Save the current directory */
511 SetCurrentDirectoryA(OSDirA); /* We expect here that OSDir is of the form: C:\OSDir */
512
514 testType3_A(".", FindExInfoStandard, FindExSearchNameMatch, "XXX", 0, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
515
516 /* Restore the old current directory */
518}
#define testType3_A(lpFileName, fInfoLevelId, fSearchOp, lpSearchFilter, dwAdditionalFlags, dwInitialError, hUnexpectedHandleValue, dwExpectedError)
Definition: FindFiles.c:98
@ FindExSearchNameMatch
Definition: winbase.h:1134
@ FindExInfoStandard
Definition: winbase.h:1128

Referenced by START_TEST().

◆ Test_FindFirstFileExW()

static void Test_FindFirstFileExW ( void  )
static

Definition at line 520 of file FindFiles.c.

521{
524 HANDLE h;
525
526 /* Save the current directory */
528 SetCurrentDirectoryW(OSDirW); /* We expect here that OSDir is of the form: C:\OSDir */
529
531 testType3_W(L".", FindExInfoStandard, FindExSearchNameMatch, L"XXX", 0, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
532
533 /* Restore the old current directory */
535}
#define testType3_W(lpFileName, fInfoLevelId, fSearchOp, lpSearchFilter, dwAdditionalFlags, dwInitialError, hUnexpectedHandleValue, dwExpectedError)
Definition: FindFiles.c:109
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2249
#define L(x)
Definition: ntvdm.h:50

Referenced by START_TEST().

◆ Test_FindFirstFileW()

static void Test_FindFirstFileW ( void  )
static

Definition at line 312 of file FindFiles.c.

313{
317 HANDLE h;
318
319 /* Save the current directory */
321
322/*** Tests for the root directory - root directory ***/
323 /* Modify the current directory */
324 SetCurrentDirectoryW(L"C:\\");
325
327
330 testType2_W(L"C:\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
331
334 testType2_W(L"\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
335
336 /* Restore the old current directory */
338/*****************************************************/
339
340/*** Tests for the root directory - long directory ***/
341 /* Modify the current directory */
342 SetCurrentDirectoryW(OSDirW); /* We expect here that OSDir is of the form: C:\OSDir */
343
344 testType2_W(L"C:", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
345
348 testType2_W(L"C:\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
349
352 testType2_W(L"\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
353
354 /* Restore the old current directory */
356/*****************************************************/
357
358/*** Relative paths ***/
359 /*
360 * NOTE: This test does not give the same results if you launch the app
361 * from a root drive or from a long-form directory (of the form C:\dir).
362 */
363 // testType2_W(L"..", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
364 // testType1_W(L"..", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND, TRUE);
365/**********************/
366
367/*** Relative paths - root directory ***/
368 /* Modify the current directory */
369 SetCurrentDirectoryW(L"C:\\");
370
374 testType2_W(L".\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
375
379 testType2_W(L"..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
380
381 /* Restore the old current directory */
383/***************************************/
384
385/*** Relative paths - long directory ***/
386 /* Modify the current directory */
387 SetCurrentDirectoryW(OSDirW); /* We expect here that OSDir is of the form: C:\OSDir */
388
389 testType2_W(L".", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
390
393 testType2_W(L".\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
394
396
399 testType2_W(L"..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
400
401 /* Restore the old current directory */
403/****************************************/
404
405/*** Unexisting path ***/
406 testType1_W(L"C:\\foobar", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND, TRUE);
407 testType1_W(L"C:\\foobar\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
408 testType1_W(L"C:\\foobar\\\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
409 testType1_W(L"C:\\foobar\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
410 testType1_W(L"C:\\foobar\\system32\\..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
411
412 /* Possibly a DOS device */
413 testType1_W(L"C:\\foobar\\nul", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
414 testType1_W(L"C:\\foobar\\nul\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
415 testType1_W(L"C:\\foobar\\nul\\\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
416 testType1_W(L"C:\\foobar\\nul\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
417
418 testType1_W(L"C:\\foobar\\toto", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
419 testType1_W(L"C:\\foobar\\toto\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
420 testType1_W(L"C:\\foobar\\toto\\\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
421 testType1_W(L"C:\\foobar\\toto\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
422
423 wcscpy(Buffer, L"C:\\foobar\\");
426
427 wcscpy(Buffer, L"C:\\foobar\\.\\");
430/***********************/
431
432/*** Existing path ***/
434 testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
435
437 wcscat(Buffer, L"\\");
439
441 wcscat(Buffer, L"\\\\");
443
445 wcscat(Buffer, L"\\*");
446 testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
447
449 wcscat(Buffer, L"\\.\\*");
450 testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
451
453 wcscat(Buffer, L"\\system32\\..\\*");
454 testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
455
456 /* Possibly a DOS device */
458 wcscat(Buffer, L"\\nul");
459 testType1_W(Buffer, 0xdeadbeef, (HANDLE)0x00000001, 0xdeadbeef, FALSE);
460
462 wcscat(Buffer, L"\\nul\\");
464
466 wcscat(Buffer, L"\\nul\\\\");
468
470 wcscat(Buffer, L"\\nul\\*");
472
474 wcscat(Buffer, L"\\toto");
476
478 wcscat(Buffer, L"\\toto\\");
480
482 wcscat(Buffer, L"\\toto\\\\");
484
486 wcscat(Buffer, L"\\toto\\*");
488
489 // wcscpy(Buffer, baseW);
490 // wcscat(Buffer, L"\\");
491 // wcscat(Buffer, exenameW);
492 // testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
493
494 // wcscpy(Buffer, baseW);
495 // wcscat(Buffer, L"\\.\\");
496 // wcscat(Buffer, exenameW);
497 // testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
498/*********************/
499
500 return;
501}
#define testType1_W(lpFileName, dwInitialError, hExpectedHandleValue, dwExpectedError, bExpectedNullFilename)
Definition: FindFiles.c:62
#define testType2_W(lpFileName, dwInitialError, hUnexpectedHandleValue, dwExpectedError)
Definition: FindFiles.c:87
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)

Referenced by START_TEST().

Variable Documentation

◆ baseA

CHAR baseA[MAX_PATH]
static

Definition at line 23 of file FindFiles.c.

Referenced by gl_color_shade_vertices(), and init().

◆ baseW

◆ exenameA

LPSTR exenameA
static

Definition at line 27 of file FindFiles.c.

Referenced by init(), and Test_FindFirstFileA().

◆ exenameW

LPWSTR exenameW
static

Definition at line 28 of file FindFiles.c.

Referenced by init(), Test_FindFirstFileW(), and test_mode_generic().

◆ myARGC

INT myARGC
static

Definition at line 29 of file FindFiles.c.

Referenced by init(), and START_TEST().

◆ myARGV

LPSTR* myARGV
static

Definition at line 30 of file FindFiles.c.

Referenced by init(), and START_TEST().

◆ OSDirA

CHAR OSDirA[MAX_PATH]
static

Definition at line 21 of file FindFiles.c.

Referenced by init(), Test_FindFirstFileA(), and Test_FindFirstFileExA().

◆ OSDirW

WCHAR OSDirW[MAX_PATH]
static

Definition at line 22 of file FindFiles.c.

Referenced by init(), Test_FindFirstFileExW(), and Test_FindFirstFileW().

◆ selfnameA

CHAR selfnameA[MAX_PATH]
static

Definition at line 25 of file FindFiles.c.

Referenced by init().

◆ selfnameW

WCHAR selfnameW[MAX_PATH]
static

Definition at line 26 of file FindFiles.c.

Referenced by init().