ReactOS  0.4.14-dev-293-g2b39b42
FindFiles.c File Reference
#include "precomp.h"
Include dependency graph for FindFiles.c:

Go to the source code of this file.

Macros

#define ok_err(error)   ok(GetLastError() == (error), "Wrong last error. Expected %lu, got %lu\n", (DWORD)(error), GetLastError())
 
#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)
 

Functions

static void Test_FindFirstFileA (void)
 
static void Test_FindFirstFileW (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(GetLastError() == (error), "Wrong last error. Expected %lu, got %lu\n", (DWORD)(error), GetLastError())

Definition at line 39 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"); \
ok(fd.cFileName[0] != 0, "fd.cFileName == \"\"\n"); \
FindClose(h); \
} while (0)
static int fd
Definition: io.c:51
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define ok(value,...)
Definition: atltest.h:57
HANDLE WINAPI FindFirstFileA(IN LPCSTR lpFileName, OUT LPWIN32_FIND_DATAA lpFindFileData)
Definition: find.c:263
_In_ LPCSTR lpFileName
Definition: winbase.h:3018

Definition at line 47 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"); \
ok(fd.cFileName[0] != 0, "fd.cFileName == \"\"\n"); \
FindClose(h); \
} while (0)
static int fd
Definition: io.c:51
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define ok(value,...)
Definition: atltest.h:57
_In_ LPCSTR lpFileName
Definition: winbase.h:3018
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320

Definition at line 61 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)
static int fd
Definition: io.c:51
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
HANDLE WINAPI FindFirstFileA(IN LPCSTR lpFileName, OUT LPWIN32_FIND_DATAA lpFindFileData)
Definition: find.c:263
_In_ LPCSTR lpFileName
Definition: winbase.h:3018

Definition at line 75 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)
static int fd
Definition: io.c:51
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
_In_ LPCSTR lpFileName
Definition: winbase.h:3018
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320

Definition at line 86 of file FindFiles.c.

Function Documentation

◆ init()

static int init ( void  )
static

Definition at line 481 of file FindFiles.c.

482 {
483  LPSTR p;
484  size_t i;
485 
487  if (!GetCurrentDirectoryA(sizeof(baseA)/sizeof(baseA[0]), baseA)) return 0;
488  strcpy(selfnameA, myARGV[0]);
489 
490  /* Strip the path of selfname */
491  if ((p = strrchr(selfnameA, '\\')) != NULL)
492  exenameA = p + 1;
493  else
495 
496  if ((p = strrchr(exenameA, '/')) != NULL)
497  exenameA = p + 1;
498 
499  if (!GetWindowsDirectoryA(OSDirA, sizeof(OSDirA)/sizeof(OSDirA[0]))) return 0;
500 
501  /* Quick-and-dirty conversion ANSI --> UNICODE without the Win32 APIs */
502  for (i = 0 ; i <= strlen(baseA) ; ++i)
503  {
504  baseW[i] = (WCHAR)baseA[i];
505  }
506  for (i = 0 ; i <= strlen(selfnameA) ; ++i)
507  {
508  selfnameW[i] = (WCHAR)selfnameA[i];
509  }
511  for (i = 0 ; i <= strlen(OSDirA) ; ++i)
512  {
513  OSDirW[i] = (WCHAR)OSDirA[i];
514  }
515 
516  return 1;
517 }
static WCHAR selfnameW[MAX_PATH]
Definition: FindFiles.c:25
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
static WCHAR OSDirW[MAX_PATH]
Definition: FindFiles.c:21
char * LPSTR
Definition: xmlstorage.h:182
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
static CHAR selfnameA[MAX_PATH]
Definition: FindFiles.c:24
smooth NULL
Definition: ftsmooth.c:416
static INT myARGC
Definition: FindFiles.c:28
static LPWSTR exenameW
Definition: FindFiles.c:27
static LPSTR exenameA
Definition: FindFiles.c:26
__wchar_t WCHAR
Definition: xmlstorage.h:180
int winetest_get_mainargs(char ***pargv)
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2336
static LPSTR * myARGV
Definition: FindFiles.c:29
static WCHAR baseW[MAX_PATH]
Definition: FindFiles.c:23
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static CHAR baseA[MAX_PATH]
Definition: FindFiles.c:22
GLfloat GLfloat p
Definition: glext.h:8902
static CHAR OSDirA[MAX_PATH]
Definition: FindFiles.c:20

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( FindFiles  )

Definition at line 519 of file FindFiles.c.

520 {
521  int b = init();
522  ok(b, "Basic init of FindFiles test\n");
523  if (!b) return;
524 
527 }
static int init(void)
Definition: FindFiles.c:481
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
static void Test_FindFirstFileA(void)
Definition: FindFiles.c:98
static void Test_FindFirstFileW(void)
Definition: FindFiles.c:289
#define ok(value,...)
Definition: atltest.h:57

◆ Test_FindFirstFileA()

static void Test_FindFirstFileA ( void  )
static

Definition at line 98 of file FindFiles.c.

99 {
103  HANDLE h;
104 
105  /* Save the current directory */
107 
108 /*** Tests for the root directory - root directory ***/
109  /* Modify the current directory */
110  SetCurrentDirectoryA("C:\\");
111 
113 
116  testType2_A("C:\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
117 
120  testType2_A("\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
121 
122  /* Restore the old current directory */
124 /*****************************************************/
125 
126 /*** Tests for the root directory - long directory ***/
127  /* Modify the current directory */
128  SetCurrentDirectoryA(OSDirA); /* We expect here that OSDir is of the form: C:\OSDir */
129 
130  testType2_A("C:", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
131 
134  testType2_A("C:\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
135 
138  testType2_A("\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
139 
140  /* Restore the old current directory */
142 /*****************************************************/
143 
144 /*** Relative paths ***/
145  /*
146  * NOTE: This test does not give the same results if you launch the app
147  * from a root drive or from a long-form directory (of the form C:\dir).
148  */
149  // testType2_A("..", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
150  // testType1_A("..", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND, TRUE);
151 /**********************/
152 
153 /*** Relative paths - root directory ***/
154  /* Modify the current directory */
155  SetCurrentDirectoryA("C:\\");
156 
160  testType2_A(".\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
161 
165  testType2_A("..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
166 
167  /* Restore the old current directory */
169 /***************************************/
170 
171 /*** Relative paths - long directory ***/
172  /* Modify the current directory */
173  SetCurrentDirectoryA(OSDirA); /* We expect here that OSDir is of the form: C:\OSDir */
174 
175  testType2_A(".", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
176 
179  testType2_A(".\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
180 
182 
185  testType2_A("..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
186 
187  /* Restore the old current directory */
189 /****************************************/
190 
191 /*** Unexisting path ***/
192  testType1_A("C:\\foobar", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND, TRUE);
193  testType1_A("C:\\foobar\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
194  testType1_A("C:\\foobar\\\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
195  testType1_A("C:\\foobar\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
196  testType1_A("C:\\foobar\\system32\\..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
197 
198  /* Possibly a DOS device */
199  testType1_A("C:\\foobar\\nul", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
200  testType1_A("C:\\foobar\\nul\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
201  testType1_A("C:\\foobar\\nul\\\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
202  testType1_A("C:\\foobar\\nul\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
203 
204  testType1_A("C:\\foobar\\toto", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
205  testType1_A("C:\\foobar\\toto\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
206  testType1_A("C:\\foobar\\toto\\\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
207  testType1_A("C:\\foobar\\toto\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
208 
209  strcpy(Buffer, "C:\\foobar\\");
212 
213  strcpy(Buffer, "C:\\foobar\\.\\");
216 /***********************/
217 
218 /*** Existing path ***/
219  strcpy(Buffer, OSDirA);
220  testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
221 
222  strcpy(Buffer, OSDirA);
223  strcat(Buffer, "\\");
225 
226  strcpy(Buffer, OSDirA);
227  strcat(Buffer, "\\\\");
229 
230  strcpy(Buffer, OSDirA);
231  strcat(Buffer, "\\*");
232  testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
233 
234  strcpy(Buffer, OSDirA);
235  strcat(Buffer, "\\.\\*");
236  testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
237 
238  strcpy(Buffer, OSDirA);
239  strcat(Buffer, "\\system32\\..\\*");
240  testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
241 
242  /* Possibly a DOS device */
243  strcpy(Buffer, OSDirA);
244  strcat(Buffer, "\\nul");
245  testType1_A(Buffer, 0xdeadbeef, (HANDLE)0x00000001, 0xdeadbeef, FALSE);
246 
247  strcpy(Buffer, OSDirA);
248  strcat(Buffer, "\\nul\\");
250 
251  strcpy(Buffer, OSDirA);
252  strcat(Buffer, "\\nul\\\\");
254 
255  strcpy(Buffer, OSDirA);
256  strcat(Buffer, "\\nul\\*");
258 
259  strcpy(Buffer, OSDirA);
260  strcat(Buffer, "\\toto");
262 
263  strcpy(Buffer, OSDirA);
264  strcat(Buffer, "\\toto\\");
266 
267  strcpy(Buffer, OSDirA);
268  strcat(Buffer, "\\toto\\\\");
270 
271  strcpy(Buffer, OSDirA);
272  strcat(Buffer, "\\toto\\*");
274 
275  // strcpy(Buffer, baseA);
276  // strcat(Buffer, "\\");
277  // strcat(Buffer, exenameA);
278  // testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
279 
280  // strcpy(Buffer, baseA);
281  // strcat(Buffer, "\\.\\");
282  // strcat(Buffer, exenameA);
283  // testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
284 /*********************/
285 
286  return;
287 }
#define TRUE
Definition: types.h:120
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
WCHAR CurrentDirectory[1024]
Definition: chkdsk.c:74
char CHAR
Definition: xmlstorage.h:175
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
static int fd
Definition: io.c:51
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
Definition: bufpool.h:45
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static LPSTR exenameA
Definition: FindFiles.c:26
#define MAX_PATH
Definition: compat.h:26
#define testType2_A(lpFileName, dwInitialError, hUnexpectedHandleValue, dwExpectedError)
Definition: FindFiles.c:75
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2205
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
#define testType1_A(lpFileName, dwInitialError, hExpectedHandleValue, dwExpectedError, bExpectedNullFilename)
Definition: FindFiles.c:47
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define ERROR_INVALID_NAME
Definition: compat.h:93
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
static CHAR OSDirA[MAX_PATH]
Definition: FindFiles.c:20

Referenced by START_TEST().

◆ Test_FindFirstFileW()

static void Test_FindFirstFileW ( void  )
static

Definition at line 289 of file FindFiles.c.

290 {
294  HANDLE h;
295 
296  /* Save the current directory */
298 
299 /*** Tests for the root directory - root directory ***/
300  /* Modify the current directory */
301  SetCurrentDirectoryW(L"C:\\");
302 
304 
307  testType2_W(L"C:\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
308 
311  testType2_W(L"\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
312 
313  /* Restore the old current directory */
315 /*****************************************************/
316 
317 /*** Tests for the root directory - long directory ***/
318  /* Modify the current directory */
319  SetCurrentDirectoryW(OSDirW); /* We expect here that OSDir is of the form: C:\OSDir */
320 
321  testType2_W(L"C:", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
322 
325  testType2_W(L"C:\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
326 
329  testType2_W(L"\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
330 
331  /* Restore the old current directory */
333 /*****************************************************/
334 
335 /*** Relative paths ***/
336  /*
337  * NOTE: This test does not give the same results if you launch the app
338  * from a root drive or from a long-form directory (of the form C:\dir).
339  */
340  // testType2_W(L"..", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
341  // testType1_W(L"..", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND, TRUE);
342 /**********************/
343 
344 /*** Relative paths - root directory ***/
345  /* Modify the current directory */
346  SetCurrentDirectoryW(L"C:\\");
347 
351  testType2_W(L".\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
352 
356  testType2_W(L"..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
357 
358  /* Restore the old current directory */
360 /***************************************/
361 
362 /*** Relative paths - long directory ***/
363  /* Modify the current directory */
364  SetCurrentDirectoryW(OSDirW); /* We expect here that OSDir is of the form: C:\OSDir */
365 
366  testType2_W(L".", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
367 
370  testType2_W(L".\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
371 
373 
376  testType2_W(L"..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
377 
378  /* Restore the old current directory */
380 /****************************************/
381 
382 /*** Unexisting path ***/
383  testType1_W(L"C:\\foobar", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND, TRUE);
384  testType1_W(L"C:\\foobar\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
385  testType1_W(L"C:\\foobar\\\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
386  testType1_W(L"C:\\foobar\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
387  testType1_W(L"C:\\foobar\\system32\\..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
388 
389  /* Possibly a DOS device */
390  testType1_W(L"C:\\foobar\\nul", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
391  testType1_W(L"C:\\foobar\\nul\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
392  testType1_W(L"C:\\foobar\\nul\\\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
393  testType1_W(L"C:\\foobar\\nul\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
394 
395  testType1_W(L"C:\\foobar\\toto", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
396  testType1_W(L"C:\\foobar\\toto\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
397  testType1_W(L"C:\\foobar\\toto\\\\", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
398  testType1_W(L"C:\\foobar\\toto\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
399 
400  wcscpy(Buffer, L"C:\\foobar\\");
403 
404  wcscpy(Buffer, L"C:\\foobar\\.\\");
407 /***********************/
408 
409 /*** Existing path ***/
410  wcscpy(Buffer, OSDirW);
411  testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
412 
413  wcscpy(Buffer, OSDirW);
414  wcscat(Buffer, L"\\");
416 
417  wcscpy(Buffer, OSDirW);
418  wcscat(Buffer, L"\\\\");
420 
421  wcscpy(Buffer, OSDirW);
422  wcscat(Buffer, L"\\*");
423  testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
424 
425  wcscpy(Buffer, OSDirW);
426  wcscat(Buffer, L"\\.\\*");
427  testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
428 
429  wcscpy(Buffer, OSDirW);
430  wcscat(Buffer, L"\\system32\\..\\*");
431  testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
432 
433  /* Possibly a DOS device */
434  wcscpy(Buffer, OSDirW);
435  wcscat(Buffer, L"\\nul");
436  testType1_W(Buffer, 0xdeadbeef, (HANDLE)0x00000001, 0xdeadbeef, FALSE);
437 
438  wcscpy(Buffer, OSDirW);
439  wcscat(Buffer, L"\\nul\\");
441 
442  wcscpy(Buffer, OSDirW);
443  wcscat(Buffer, L"\\nul\\\\");
445 
446  wcscpy(Buffer, OSDirW);
447  wcscat(Buffer, L"\\nul\\*");
449 
450  wcscpy(Buffer, OSDirW);
451  wcscat(Buffer, L"\\toto");
453 
454  wcscpy(Buffer, OSDirW);
455  wcscat(Buffer, L"\\toto\\");
457 
458  wcscpy(Buffer, OSDirW);
459  wcscat(Buffer, L"\\toto\\\\");
461 
462  wcscpy(Buffer, OSDirW);
463  wcscat(Buffer, L"\\toto\\*");
465 
466  // wcscpy(Buffer, baseW);
467  // wcscat(Buffer, L"\\");
468  // wcscat(Buffer, exenameW);
469  // testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
470 
471  // wcscpy(Buffer, baseW);
472  // wcscat(Buffer, L"\\.\\");
473  // wcscat(Buffer, exenameW);
474  // testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
475 /*********************/
476 
477  return;
478 }
#define TRUE
Definition: types.h:120
WCHAR CurrentDirectory[1024]
Definition: chkdsk.c:74
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:413
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
static int fd
Definition: io.c:51
static WCHAR OSDirW[MAX_PATH]
Definition: FindFiles.c:21
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define testType2_W(lpFileName, dwInitialError, hUnexpectedHandleValue, dwExpectedError)
Definition: FindFiles.c:86
Definition: bufpool.h:45
static LPWSTR exenameW
Definition: FindFiles.c:27
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2248
_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 testType1_W(lpFileName, dwInitialError, hExpectedHandleValue, dwExpectedError, bExpectedNullFilename)
Definition: FindFiles.c:61
#define ERROR_INVALID_NAME
Definition: compat.h:93
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106

Referenced by START_TEST().

Variable Documentation

◆ baseA

CHAR baseA[MAX_PATH]
static

Definition at line 22 of file FindFiles.c.

Referenced by gl_color_shade_vertices(), and init().

◆ baseW

◆ exenameA

LPSTR exenameA
static

Definition at line 26 of file FindFiles.c.

Referenced by init(), and Test_FindFirstFileA().

◆ exenameW

LPWSTR exenameW
static

Definition at line 27 of file FindFiles.c.

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

◆ myARGC

INT myARGC
static

Definition at line 28 of file FindFiles.c.

Referenced by init(), and START_TEST().

◆ myARGV

LPSTR* myARGV
static

Definition at line 29 of file FindFiles.c.

Referenced by init(), and START_TEST().

◆ OSDirA

CHAR OSDirA[MAX_PATH]
static

Definition at line 20 of file FindFiles.c.

Referenced by init(), and Test_FindFirstFileA().

◆ OSDirW

WCHAR OSDirW[MAX_PATH]
static

Definition at line 21 of file FindFiles.c.

Referenced by init(), and Test_FindFirstFileW().

◆ selfnameA

CHAR selfnameA[MAX_PATH]
static

Definition at line 24 of file FindFiles.c.

Referenced by init().

◆ selfnameW

WCHAR selfnameW[MAX_PATH]
static

Definition at line 25 of file FindFiles.c.

Referenced by init().