FindFirstFile on Root directory should fail
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Sat Mar 29 13:03:59 CST 2003
Changelog
wine/files/dos_fs.c, wine/dlls/kernel/tests/file.c:
FindFirstFile on Root directory should fail
This lets the Jave2 Runtime Environment installation during the Xilinx
Webpack installation unpack the *.jar files.
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/files/dos_fs.c
===================================================================
RCS file: /home/wine/wine/files/dos_fs.c,v
retrieving revision 1.128
diff -u -r1.128 dos_fs.c
--- wine/files/dos_fs.c 14 Feb 2003 20:27:11 -0000 1.128
+++ wine/files/dos_fs.c 29 Mar 2003 18:55:41 -0000
@@ -1921,6 +1921,15 @@
return INVALID_HANDLE_VALUE;
}
+ if ((lpFileName[1] == L':')
+ && ( (strlenW(lpFileName) == 2) ||
+ ( (strlenW(lpFileName) == 3) && ((lpFileName[2] == L'\\')|| (lpFileName[2] == L'/') ) ) ) )
+ {
+ TRACE("root directories not allowed\n");
+ SetLastError(ERROR_FILE_NOT_FOUND);
+ return INVALID_HANDLE_VALUE;
+ }
+
if ((fSearchOp != FindExSearchNameMatch) || (dwAdditionalFlags != 0))
{
FIXME("options not implemented 0x%08x 0x%08lx\n", fSearchOp, dwAdditionalFlags );
Index: wine/dlls/kernel/tests/file.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/file.c,v
retrieving revision 1.15
diff -u -r1.15 file.c
--- wine/dlls/kernel/tests/file.c 18 Mar 2003 05:04:34 -0000 1.15
+++ wine/dlls/kernel/tests/file.c 29 Mar 2003 18:55:41 -0000
@@ -746,6 +746,26 @@
DeleteFileA( filename );
}
+void test_FindFirstFileA()
+{
+ HANDLE handle;
+ WIN32_FIND_DATAA search_results;
+ int err;
+
+ handle = FindFirstFileA("C:",&search_results);
+ err = GetLastError();
+ ok ( handle == INVALID_HANDLE_VALUE , "FindFirstFile on Root directory should Fail");
+ if (handle == INVALID_HANDLE_VALUE)
+ ok ( err == ERROR_FILE_NOT_FOUND, "Bad Error number\n");
+ handle = FindFirstFileA("C:\\",&search_results);
+ err = GetLastError();
+ ok ( handle == INVALID_HANDLE_VALUE , "FindFirstFile on Root directory should Fail");
+ if (handle == INVALID_HANDLE_VALUE)
+ ok ( err == ERROR_FILE_NOT_FOUND, "Bad Error number\n");
+ handle = FindFirstFileA("C:\\*",&search_results);
+ ok ( handle != INVALID_HANDLE_VALUE, "FindFirstFile on C:\\* should succeed" );
+ ok ( FindClose(handle) == TRUE, "Failed to close handle");
+}
START_TEST(file)
{
@@ -763,6 +783,7 @@
test_CreateFileW();
test_DeleteFileA();
test_DeleteFileW();
+ test_FindFirstFileA();
test_LockFile();
test_offset_in_overlapped_structure();
}
More information about the wine-patches
mailing list