Francois Gouget : shell32: Don' t expand environment variables in ShellExecute()'s parameters argument.

Alexandre Julliard julliard at winehq.org
Tue Oct 9 13:12:35 CDT 2012


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

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Oct  9 00:13:54 2012 +0200

shell32: Don't expand environment variables in ShellExecute()'s parameters argument.

---

 dlls/shell32/shlexec.c       |   17 -----------------
 dlls/shell32/tests/shlexec.c |    2 +-
 2 files changed, 1 insertions(+), 18 deletions(-)

diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index de6c0f9..a714fe8 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -1740,23 +1740,6 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
         sei_tmp.lpFile = wszApplicationName;
     }
 
-    if (*sei_tmp.lpParameters)
-    {
-        len = ExpandEnvironmentStringsW(sei_tmp.lpParameters, NULL, 0);
-        if (len > 0)
-        {
-            LPWSTR buf;
-            len++;
-            buf = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
-            ExpandEnvironmentStringsW(sei_tmp.lpParameters, buf, len);
-            if (wszParameters != parametersBuffer)
-                HeapFree(GetProcessHeap(), 0, wszParameters);
-            wszParameters = buf;
-            parametersLen = len;
-            sei_tmp.lpParameters = wszParameters;
-        }
-    }
-
     if (*sei_tmp.lpDirectory)
     {
         len = ExpandEnvironmentStringsW(sei_tmp.lpDirectory, NULL, 0);
diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index ac68ad0..69b466e 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -1354,7 +1354,7 @@ static const argify_tests_t argify_tests[] =
       {"", "\" p\\three pfour\"", "pfive", "", NULL}, 0}},
 
     /* Environment variables are left untouched. */
-    {"Params23456", "%TMPDIR% %t %c", 0x12,
+    {"Params23456", "%TMPDIR% %t %c", 0,
      {" \"%TMPDIR%\" \"%t\" \"%c\" \"\" \"\"",
       {"", "%TMPDIR%", "%t", "%c", "", "", NULL}, 0}},
 




More information about the wine-cvs mailing list