[Kernel32]Test for Bug 21292: Createfile creating with illegal char in name

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Sun Jan 17 08:42:34 CST 2010


---
 dlls/kernel32/tests/file.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 3493ff3..bfc9b10 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -878,6 +878,21 @@ static void test_CreateFileA(void)
     ret = RemoveDirectoryA(dirname);
     ok(ret, "RemoveDirectoryA: error %d\n", GetLastError());
 
+    /* test creating with invalid chars in name
+       Only Wine (at least until Jan 2010) and NT4 succeed
+    */
+    hFile = CreateFileA( "test/", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
+			 NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+    todo_wine{
+      ok((hFile ==  INVALID_HANDLE_VALUE && GetLastError() == ERROR_INVALID_NAME) ||
+		 broken(hFile !=  INVALID_HANDLE_VALUE),
+	 "CreateFile with illegal char should nor succeed(Bug 21292)\n");
+    }
+    if (hFile != INVALID_HANDLE_VALUE)
+      {
+	CloseHandle( hFile );
+	DeleteFileA("test/");
+      }
 
     /* test opening directory as a directory */
     hFile = CreateFileA( temp_path, GENERIC_READ,
-- 
1.6.4.2




More information about the wine-patches mailing list