[PATCH] shell32/tests: Avoid random values in the shlexec failure messages.

Francois Gouget fgouget at codeweavers.com
Sun Mar 15 08:32:20 CDT 2020


Trace the temporary directory value on startup since it's no longer 
visible in the failure messages.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 dlls/shell32/tests/shlexec.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index 030ab54525a..e884b409493 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -507,7 +507,14 @@ static INT_PTR shell_execute_(const char* file, int line, LPCSTR verb, LPCSTR fi
 
     strcpy(shell_call, "ShellExecute(");
     strcat_param(shell_call, "verb", verb);
-    strcat_param(shell_call, "file", filename);
+    if (strncmp(filename, tmpdir, strlen(tmpdir)) != 0)
+        strcat_param(shell_call, "file", filename);
+    else
+    {
+        char buffer[MAX_PATH];
+        sprintf(buffer, "tmpdir%s", filename + strlen(tmpdir));
+        strcat_param(shell_call, "file", buffer);
+    }
     strcat_param(shell_call, "params", parameters);
     strcat_param(shell_call, "dir", directory);
     strcat(shell_call, ")");
@@ -591,7 +598,14 @@ static INT_PTR shell_execute_ex_(const char* file, int line,
     sprintf(smask, "0x%x", mask);
     strcat_param(shell_call, "mask", smask);
     strcat_param(shell_call, "verb", verb);
-    strcat_param(shell_call, "file", filename);
+    if (strncmp(filename, tmpdir, strlen(tmpdir)) != 0)
+        strcat_param(shell_call, "file", filename);
+    else
+    {
+        char buffer[MAX_PATH];
+        sprintf(buffer, "<tmpdir>%s", filename + strlen(tmpdir));
+        strcat_param(shell_call, "file", buffer);
+    }
     strcat_param(shell_call, "params", parameters);
     strcat_param(shell_call, "dir", directory);
     strcat_param(shell_call, "class", class);
@@ -2705,6 +2719,7 @@ static void init_test(void)
     ok( rc, "failed to create %s err %u\n", tmpdir, GetLastError() );
     /* Set %TMPDIR% for the tests */
     SetEnvironmentVariableA("TMPDIR", tmpdir);
+    trace("tmpdir=\"%s\"\n", tmpdir);
 
     rc = GetTempFileNameA(tmpdir, "wt", 0, child_file);
     ok(rc != 0, "got %d\n", rc);
-- 
2.20.1



More information about the wine-devel mailing list