PATCH: add test for non existing directory during createfile

Marcus Meissner marcus at jet.franken.de
Thu May 5 11:59:16 CDT 2005


Hi,

I would like to have someone test this test on windows...

I have the suspicion that Windows might create non-existing directories
in the middle.

Ciao, Marcus

Changelog:
	Check whether non existing directories in the filename are
	created or not (expecting not).

Index: dlls/kernel/tests/file.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/file.c,v
retrieving revision 1.53
diff -u -r1.53 file.c
--- dlls/kernel/tests/file.c	19 Apr 2005 11:59:46 -0000	1.53
+++ dlls/kernel/tests/file.c	5 May 2005 16:56:28 -0000
@@ -685,6 +685,7 @@
     static const WCHAR emptyW[]={'\0'};
     static const WCHAR prefix[] = {'p','f','x',0};
     static const WCHAR bogus[] = { '\\', '\\', '.', '\\', 'B', 'O', 'G', 'U', 'S', 0 };
+    static const WCHAR notexist[] = { '\\','n', 'o', 't', 'e', 'x', 'i', 's', 't', '\\', 'n', 'o', 'f', 'i', 'l', 'e', 0 };
     DWORD ret;
 
     ret = GetTempPathW(MAX_PATH, temp_path);
@@ -703,6 +704,15 @@
 
     ret = DeleteFileW(filename);
     ok(ret, "DeleteFileW: error %ld\n", GetLastError());
+
+    lstrcpyW(filename, temp_path); lstrcatW(filename, notexist);
+    hFile = CreateFileW(filename, GENERIC_READ|GENERIC_WRITE, 0, NULL,
+                        CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0);
+    ok(hFile == INVALID_HANDLE_VALUE, "CREATE_NEW of file in non-existing directory should fail.\n");
+    if (hFile != INVALID_HANDLE_VALUE) {
+	CloseHandle(hFile);
+	DeleteFileW(filename);
+    }
 
 #if 0  /* this test crashes on NT4.0 */
     hFile = CreateFileW(NULL, GENERIC_READ, 0, NULL,



More information about the wine-patches mailing list