Le samedi 08 mai 2010 18:14:49, Vincent Pelletier a écrit :
> This test passes on win2k & winxp, fails on wine.

Bug opened for this issue:
http://bugs.winehq.org/show_bug.cgi?id=22635

Updated patch, with (too ?) many more test cases.
Interesting URLs:

http://msdn.microsoft.com/en-
us/library/aa365247%28VS.85%29.aspx#naming_conventions

http://msdn.microsoft.com/en-us/library/aa364418%28VS.85%29.aspx
  (especially "Bug?!" comment)

-- 
Vincent Pelletier
From 110ee20580c7eeb6035edc45cc13bfe6e4f87daf Mon Sep 17 00:00:00 2001
Message-Id: <110ee20580c7eeb6035edc45cc13bfe6e4f87daf.1273393410.git.plr.vinc...@gmail.com>
From: Vincent Pelletier <[email protected]>
Date: Sat, 8 May 2010 17:52:47 +0200
Subject: [PATCH] kernel32: add test for FindFirstFileA with a path ending with "/>"
To: wine-patches <[email protected]>
Reply-To: wine-devel <[email protected]>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.0.4"

This is a multi-part message in MIME format.
--------------1.7.0.4
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


This test passes on win2k, fails on wine.
That failure causes cdkey problems in "Earth 2160" as sold on GOG.com:
Once the installation is finished, the installers generates a registry key
value based (among other things) on the ctime of installed directory.
Looked-up path has a spurious "/>" trail, causing the registry key to be
incorrect and the game rejects it.
---
 dlls/kernel32/tests/file.c |   85 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 85 insertions(+), 0 deletions(-)


--------------1.7.0.4
Content-Type: text/x-patch; name="0001-kernel32-add-test-for-FindFirstFileA-with-a-path-end.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="0001-kernel32-add-test-for-FindFirstFileA-with-a-path-end.patch"

diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index b6f066e..541c70d 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -2084,6 +2084,91 @@ static void test_FindFirstFileA(void)
     err = GetLastError();
     ok ( handle == INVALID_HANDLE_VALUE, "FindFirstFile on %s should Fail\n", buffer2 );
     ok ( err == ERROR_PATH_NOT_FOUND, "Bad Error number %d\n", err );
+
+    /* try FindFirstFileA on "test-dir" with forbidden chars */
+    CreateDirectoryA("test-dir", NULL);
+    _lclose(_lcreat("test-file", 0));
+
+#define test_FindFirstFileA_with(x, y) { \
+        handle = FindFirstFileA(x, &data);\
+        if (y) { \
+            ok ( handle != INVALID_HANDLE_VALUE, "FindFirstFile on "x" should succeed\n");\
+            ok ( FindClose(handle) == TRUE, "Failed to close handle "x"\n"); \
+        } else { \
+            ok ( handle == INVALID_HANDLE_VALUE, "FindFirstFile on "x" should fail\n");\
+        } \
+    }
+
+    /* Disallowed chars being ignored: */
+    test_FindFirstFileA_with("test-dir/>", 1);
+    test_FindFirstFileA_with("test-dir/<", 1);
+    test_FindFirstFileA_with("test-dir/\"", 1);
+    test_FindFirstFileA_with("test-dir<>", 1);
+    test_FindFirstFileA_with("test-dir<<", 1);
+    test_FindFirstFileA_with("test-dir<\"", 1);
+    test_FindFirstFileA_with("test-dir>>", 1);
+    test_FindFirstFileA_with("test-dir><", 1);
+    test_FindFirstFileA_with("test-dir>\"", 1);
+    test_FindFirstFileA_with("test-dir\">", 1);
+    test_FindFirstFileA_with("test-dir\"<", 1);
+    test_FindFirstFileA_with("test-dir\"\"", 1);
+    test_FindFirstFileA_with("test-dir\\<", 1);
+    test_FindFirstFileA_with("test-dir\\>", 1);
+    test_FindFirstFileA_with("test-dir\\\"", 1);
+    /* But forward & back slashes are not tolerated on a file */
+    test_FindFirstFileA_with("test-file/>", 0);
+    test_FindFirstFileA_with("test-file/<", 0);
+    test_FindFirstFileA_with("test-file/\"", 0);
+    test_FindFirstFileA_with("test-file<>", 1);
+    test_FindFirstFileA_with("test-file<<", 1);
+    test_FindFirstFileA_with("test-file<\"", 1);
+    test_FindFirstFileA_with("test-file>>", 1);
+    test_FindFirstFileA_with("test-file><", 1);
+    test_FindFirstFileA_with("test-file>\"", 1);
+    test_FindFirstFileA_with("test-file\">", 1);
+    test_FindFirstFileA_with("test-file\"<", 1);
+    test_FindFirstFileA_with("test-file\"\"", 1);
+    test_FindFirstFileA_with("test-file\\<", 0);
+    test_FindFirstFileA_with("test-file\\>", 0);
+    test_FindFirstFileA_with("test-file\\\"", 0);
+    /* Even when many */
+    test_FindFirstFileA_with("test-dir\"\"\"\"\"", 1);
+    test_FindFirstFileA_with("test-dir<<<><><>\"\"\"\"<<<>", 1);
+    /* But only in the end of path */
+    test_FindFirstFileA_with("test-/>dir", 0);
+    test_FindFirstFileA_with("/>test-dir", 0);
+    test_FindFirstFileA_with(">test-dir", 0);
+    test_FindFirstFileA_with(">>test-dir", 0);
+    test_FindFirstFileA_with(">test->dir", 0);
+    test_FindFirstFileA_with("><test->dir", 0);
+    test_FindFirstFileA_with("<test->dir", 0);
+    test_FindFirstFileA_with("<\"test->dir", 0);
+
+    /* Slash after ignored chars is not ignored: */
+    test_FindFirstFileA_with("test-dir//", 0);
+    test_FindFirstFileA_with("test-dir</", 0);
+    test_FindFirstFileA_with("test-dir>/", 0);
+    test_FindFirstFileA_with("test-dir\"/", 0);
+    test_FindFirstFileA_with("test-dir\\", 0);
+    test_FindFirstFileA_with("test-dir\\\\", 0);
+    test_FindFirstFileA_with("test-dir\\/", 0);
+    test_FindFirstFileA_with("test-dir/\\", 0);
+
+    /* Disalowed chars being preserved: */
+    test_FindFirstFileA_with("test-dir/:", 0);
+    test_FindFirstFileA_with("test-dir/|", 0);
+
+    /* Slashes converted to backslashes */
+    test_FindFirstFileA_with("test-dir/", 0);
+    test_FindFirstFileA_with("./test-dir", 1);
+    test_FindFirstFileA_with("./test-dir/", 0);
+    test_FindFirstFileA_with("test-dir\\", 0);
+    test_FindFirstFileA_with(".\\test-dir", 1);
+    test_FindFirstFileA_with(".\\test-dir\\", 0);
+
+#undef test_FindFirstFileA_with
+    DeleteFileA("test-file");
+    RemoveDirectoryA("test-dir");
 }
 
 static void test_FindNextFileA(void)

--------------1.7.0.4--




Reply via email to