Francois Gouget : shell32/tests: Allow the short and long forms when checking a ShellExecute() path.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 8 10:09:21 CST 2016


Module: wine
Branch: master
Commit: 5af9c123f67f163608d556bb294298073fc6f7c2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5af9c123f67f163608d556bb294298073fc6f7c2

Author: Francois Gouget <fgouget at free.fr>
Date:   Mon Feb  8 05:30:31 2016 +0100

shell32/tests: Allow the short and long forms when checking a ShellExecute() path.

ShellExecute() sometimes converts a short path to a long one so always accept the long form.
Windows XP SP1 often converts them to short paths instead but consider this behavior to be broken.

Signed-off-by: Francois Gouget <fgouget at free.fr>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/tests/shlexec.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index f89bab0..11b7e57 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -425,13 +425,29 @@ static int StrCmpPath(const char* s1, const char* s2)
 static void okChildPath_(const char* file, int line, const char* key, const char* expected)
 {
     char* result;
+    int equal, shortequal;
     result=getChildString("Child", key);
     if (!result)
     {
         okShell_(file,line)(FALSE, "%s expected '%s', but key not found or empty\n", key, expected);
         return;
     }
-    okShell_(file,line)(StrCmpPath(result, expected) == 0,
+    shortequal = FALSE;
+    equal = (StrCmpPath(result, expected) == 0);
+    if (!equal)
+    {
+        char altpath[MAX_PATH];
+        DWORD rc = GetLongPathNameA(expected, altpath, sizeof(altpath));
+        if (0 < rc && rc < sizeof(altpath))
+            equal = (StrCmpPath(result, altpath) == 0);
+        if (!equal)
+        {
+            rc = GetShortPathNameA(expected, altpath, sizeof(altpath));
+            if (0 < rc && rc < sizeof(altpath))
+                shortequal = (StrCmpPath(result, altpath) == 0);
+        }
+    }
+    okShell_(file,line)(equal || broken(shortequal) /* XP SP1 */,
                         "%s expected '%s', got '%s'\n", key, expected, result);
 }
 #define okChildPath(key, expected) okChildPath_(__FILE__, __LINE__, (key), (expected))




More information about the wine-cvs mailing list