ReactOS  0.4.15-dev-1070-ge1a01de
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)
 

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_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"); \
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:3034

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"); \
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:3034
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)
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:3034

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

Definition at line 87 of file FindFiles.c.

Function Documentation

◆ init()

static int init ( void  )
static

Definition at line 482 of file FindFiles.c.

483 {
484  LPSTR p;
485  size_t i;
486 
488  if (!GetCurrentDirectoryA(sizeof(baseA)/sizeof(baseA[0]), baseA)) return 0;
489  strcpy(selfnameA, myARGV[0]);
490 
491  /* Strip the path of selfname */
492  if ((p = strrchr(selfnameA, '\\')) != NULL)
493  exenameA = p + 1;
494  else
496 
497  if ((p = strrchr(exenameA, '/')) != NULL)
498  exenameA = p + 1;
499 
500  if (!GetWindowsDirectoryA(OSDirA, sizeof(OSDirA)/sizeof(OSDirA[0]))) return 0;
501 
502  /* Quick-and-dirty conversion ANSI --> UNICODE without the Win32 APIs */
503  for (i = 0 ; i <= strlen(baseA) ; ++i)
504  {
505  baseW[i] = (WCHAR)baseA[i];
506  }
507  for (i = 0 ; i <= strlen(selfnameA) ; ++i)
508  {
509  selfnameW[i] = (WCHAR)selfnameA[i];
510  }
512  for (i = 0 ; i <= strlen(OSDirA) ; ++i)
513  {
514  OSDirW[i] = (WCHAR)OSDirA[i];
515  }
516 
517  return 1;
518 }
static WCHAR selfnameW[MAX_PATH]
Definition: FindFiles.c:26
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:22
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:25
smooth NULL
Definition: ftsmooth.c:416
static INT myARGC
Definition: FindFiles.c:29
static LPWSTR exenameW
Definition: FindFiles.c:28
static LPSTR exenameA
Definition: FindFiles.c:27
__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:30
static WCHAR baseW[MAX_PATH]
Definition: FindFiles.c:24
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static CHAR baseA[MAX_PATH]
Definition: FindFiles.c:23
GLfloat GLfloat p
Definition: glext.h:8902
static CHAR OSDirA[MAX_PATH]
Definition: FindFiles.c:21

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( FindFiles  )

Definition at line 520 of file FindFiles.c.

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

◆ Test_FindFirstFileA()

static void Test_FindFirstFileA ( void  )
static

Definition at line 99 of file FindFiles.c.

100 {
104  HANDLE h;
105 
106  /* Save the current directory */
108 
109 /*** Tests for the root directory - root directory ***/
110  /* Modify the current directory */
111  SetCurrentDirectoryA("C:\\");
112 
114 
117  testType2_A("C:\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
118 
121  testType2_A("\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
122 
123  /* Restore the old current directory */
125 /*****************************************************/
126 
127 /*** Tests for the root directory - long directory ***/
128  /* Modify the current directory */
129  SetCurrentDirectoryA(OSDirA); /* We expect here that OSDir is of the form: C:\OSDir */
130 
131  testType2_A("C:", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
132 
135  testType2_A("C:\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
136 
139  testType2_A("\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
140 
141  /* Restore the old current directory */
143 /*****************************************************/
144 
145 /*** Relative paths ***/
146  /*
147  * NOTE: This test does not give the same results if you launch the app
148  * from a root drive or from a long-form directory (of the form C:\dir).
149  */
150  // testType2_A("..", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
151  // testType1_A("..", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND, TRUE);
152 /**********************/
153 
154 /*** Relative paths - root directory ***/
155  /* Modify the current directory */
156  SetCurrentDirectoryA("C:\\");
157 
161  testType2_A(".\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
162 
166  testType2_A("..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
167 
168  /* Restore the old current directory */
170 /***************************************/
171 
172 /*** Relative paths - long directory ***/
173  /* Modify the current directory */
174  SetCurrentDirectoryA(OSDirA); /* We expect here that OSDir is of the form: C:\OSDir */
175 
176  testType2_A(".", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
177 
180  testType2_A(".\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
181 
183 
186  testType2_A("..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
187 
188  /* Restore the old current directory */
190 /****************************************/
191 
192 /*** Unexisting path ***/
193  testType1_A("C:\\foobar", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_FILE_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\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
197  testType1_A("C:\\foobar\\system32\\..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
198 
199  /* Possibly a DOS device */
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  testType1_A("C:\\foobar\\nul\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
204 
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  testType1_A("C:\\foobar\\toto\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
209 
210  strcpy(Buffer, "C:\\foobar\\");
213 
214  strcpy(Buffer, "C:\\foobar\\.\\");
217 /***********************/
218 
219 /*** Existing path ***/
220  strcpy(Buffer, OSDirA);
221  testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
222 
223  strcpy(Buffer, OSDirA);
224  strcat(Buffer, "\\");
226 
227  strcpy(Buffer, OSDirA);
228  strcat(Buffer, "\\\\");
230 
231  strcpy(Buffer, OSDirA);
232  strcat(Buffer, "\\*");
233  testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
234 
235  strcpy(Buffer, OSDirA);
236  strcat(Buffer, "\\.\\*");
237  testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
238 
239  strcpy(Buffer, OSDirA);
240  strcat(Buffer, "\\system32\\..\\*");
241  testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
242 
243  /* Possibly a DOS device */
244  strcpy(Buffer, OSDirA);
245  strcat(Buffer, "\\nul");
246  testType1_A(Buffer, 0xdeadbeef, (HANDLE)0x00000001, 0xdeadbeef, FALSE);
247 
248  strcpy(Buffer, OSDirA);
249  strcat(Buffer, "\\nul\\");
251 
252  strcpy(Buffer, OSDirA);
253  strcat(Buffer, "\\nul\\\\");
255 
256  strcpy(Buffer, OSDirA);
257  strcat(Buffer, "\\nul\\*");
259 
260  strcpy(Buffer, OSDirA);
261  strcat(Buffer, "\\toto");
263 
264  strcpy(Buffer, OSDirA);
265  strcat(Buffer, "\\toto\\");
267 
268  strcpy(Buffer, OSDirA);
269  strcat(Buffer, "\\toto\\\\");
271 
272  strcpy(Buffer, OSDirA);
273  strcat(Buffer, "\\toto\\*");
275 
276  // strcpy(Buffer, baseA);
277  // strcat(Buffer, "\\");
278  // strcat(Buffer, exenameA);
279  // testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
280 
281  // strcpy(Buffer, baseA);
282  // strcat(Buffer, "\\.\\");
283  // strcat(Buffer, exenameA);
284  // testType2_A(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
285 /*********************/
286 
287  return;
288 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
WCHAR CurrentDirectory[1024]
Definition: chkdsk.c:74
#define TRUE
Definition: types.h:120
char CHAR
Definition: xmlstorage.h:175
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
static int fd
Definition: io.c:51
#define ERROR_BAD_NETPATH
Definition: winerror.h:145
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define FALSE
Definition: types.h:117
Definition: bufpool.h:45
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static LPSTR exenameA
Definition: FindFiles.c:27
#define MAX_PATH
Definition: compat.h:34
#define testType2_A(lpFileName, dwInitialError, hUnexpectedHandleValue, dwExpectedError)
Definition: FindFiles.c:76
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2205
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
VERSIONHELPERAPI IsWindows7OrGreater()
#define testType1_A(lpFileName, dwInitialError, hExpectedHandleValue, dwExpectedError, bExpectedNullFilename)
Definition: FindFiles.c:48
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define ERROR_INVALID_NAME
Definition: compat.h:103
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
static CHAR OSDirA[MAX_PATH]
Definition: FindFiles.c:21

Referenced by START_TEST().

◆ Test_FindFirstFileW()

static void Test_FindFirstFileW ( void  )
static

Definition at line 290 of file FindFiles.c.

291 {
295  HANDLE h;
296 
297  /* Save the current directory */
299 
300 /*** Tests for the root directory - root directory ***/
301  /* Modify the current directory */
302  SetCurrentDirectoryW(L"C:\\");
303 
305 
308  testType2_W(L"C:\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
309 
312  testType2_W(L"\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
313 
314  /* Restore the old current directory */
316 /*****************************************************/
317 
318 /*** Tests for the root directory - long directory ***/
319  /* Modify the current directory */
320  SetCurrentDirectoryW(OSDirW); /* We expect here that OSDir is of the form: C:\OSDir */
321 
322  testType2_W(L"C:", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
323 
326  testType2_W(L"C:\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
327 
330  testType2_W(L"\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
331 
332  /* Restore the old current directory */
334 /*****************************************************/
335 
336 /*** Relative paths ***/
337  /*
338  * NOTE: This test does not give the same results if you launch the app
339  * from a root drive or from a long-form directory (of the form C:\dir).
340  */
341  // testType2_W(L"..", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
342  // testType1_W(L"..", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_FILE_NOT_FOUND, TRUE);
343 /**********************/
344 
345 /*** Relative paths - root directory ***/
346  /* Modify the current directory */
347  SetCurrentDirectoryW(L"C:\\");
348 
352  testType2_W(L".\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
353 
357  testType2_W(L"..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
358 
359  /* Restore the old current directory */
361 /***************************************/
362 
363 /*** Relative paths - long directory ***/
364  /* Modify the current directory */
365  SetCurrentDirectoryW(OSDirW); /* We expect here that OSDir is of the form: C:\OSDir */
366 
367  testType2_W(L".", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
368 
371  testType2_W(L".\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
372 
374 
377  testType2_W(L"..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
378 
379  /* Restore the old current directory */
381 /****************************************/
382 
383 /*** Unexisting path ***/
384  testType1_W(L"C:\\foobar", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_FILE_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\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
388  testType1_W(L"C:\\foobar\\system32\\..\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
389 
390  /* Possibly a DOS device */
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  testType1_W(L"C:\\foobar\\nul\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
395 
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  testType1_W(L"C:\\foobar\\toto\\*", 0xdeadbeef, INVALID_HANDLE_VALUE, ERROR_PATH_NOT_FOUND, TRUE);
400 
401  wcscpy(Buffer, L"C:\\foobar\\");
404 
405  wcscpy(Buffer, L"C:\\foobar\\.\\");
408 /***********************/
409 
410 /*** Existing path ***/
411  wcscpy(Buffer, OSDirW);
412  testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
413 
414  wcscpy(Buffer, OSDirW);
415  wcscat(Buffer, L"\\");
417 
418  wcscpy(Buffer, OSDirW);
419  wcscat(Buffer, L"\\\\");
421 
422  wcscpy(Buffer, OSDirW);
423  wcscat(Buffer, L"\\*");
424  testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
425 
426  wcscpy(Buffer, OSDirW);
427  wcscat(Buffer, L"\\.\\*");
428  testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
429 
430  wcscpy(Buffer, OSDirW);
431  wcscat(Buffer, L"\\system32\\..\\*");
432  testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
433 
434  /* Possibly a DOS device */
435  wcscpy(Buffer, OSDirW);
436  wcscat(Buffer, L"\\nul");
437  testType1_W(Buffer, 0xdeadbeef, (HANDLE)0x00000001, 0xdeadbeef, FALSE);
438 
439  wcscpy(Buffer, OSDirW);
440  wcscat(Buffer, L"\\nul\\");
442 
443  wcscpy(Buffer, OSDirW);
444  wcscat(Buffer, L"\\nul\\\\");
446 
447  wcscpy(Buffer, OSDirW);
448  wcscat(Buffer, L"\\nul\\*");
450 
451  wcscpy(Buffer, OSDirW);
452  wcscat(Buffer, L"\\toto");
454 
455  wcscpy(Buffer, OSDirW);
456  wcscat(Buffer, L"\\toto\\");
458 
459  wcscpy(Buffer, OSDirW);
460  wcscat(Buffer, L"\\toto\\\\");
462 
463  wcscpy(Buffer, OSDirW);
464  wcscat(Buffer, L"\\toto\\*");
466 
467  // wcscpy(Buffer, baseW);
468  // wcscat(Buffer, L"\\");
469  // wcscat(Buffer, exenameW);
470  // testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
471 
472  // wcscpy(Buffer, baseW);
473  // wcscat(Buffer, L"\\.\\");
474  // wcscat(Buffer, exenameW);
475  // testType2_W(Buffer, 0xdeadbeef, INVALID_HANDLE_VALUE, 0xdeadbeef);
476 /*********************/
477 
478  return;
479 }
WCHAR CurrentDirectory[1024]
Definition: chkdsk.c:74
#define TRUE
Definition: types.h:120
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:504
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
static int fd
Definition: io.c:51
static WCHAR OSDirW[MAX_PATH]
Definition: FindFiles.c:22
#define ERROR_BAD_NETPATH
Definition: winerror.h:145
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define FALSE
Definition: types.h:117
#define testType2_W(lpFileName, dwInitialError, hUnexpectedHandleValue, dwExpectedError)
Definition: FindFiles.c:87
Definition: bufpool.h:45
static LPWSTR exenameW
Definition: FindFiles.c:28
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
_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:62
VERSIONHELPERAPI IsWindows7OrGreater()
#define ERROR_INVALID_NAME
Definition: compat.h:103
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106

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(), and Test_FindFirstFileA().

◆ OSDirW

WCHAR OSDirW[MAX_PATH]
static

Definition at line 22 of file FindFiles.c.

Referenced by init(), 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().