shell32/tests: Allow the short and long forms when checking a ShellExecute() path.
Francois Gouget
fgouget at free.fr
Sun Feb 7 22:30:31 CST 2016
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>
---
dlls/shell32/tests/shlexec.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
This explains why the tests were failing only when run by WineTest:
WineTest extracts the files to a location that ends up being converted
to a short path, wherease the TestBot calls the test with a normal
argv0.
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))
--
2.7.0
More information about the wine-patches
mailing list