[PATCH 3/4] shell32: simplify SHELL_execute()

Damjan Jovanovic damjan.jov at gmail.com
Sun Mar 22 06:46:18 CDT 2020


Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
---
 dlls/shell32/shlexec.c | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)
-------------- next part --------------
diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index 28f2e36f9a..d3ff821135 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -1806,26 +1806,10 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
     TRACE("execute:%s,%s,%s\n", debugstr_w(wszApplicationName), debugstr_w(wszParameters), debugstr_w(wszDir));
     lpFile = sei_tmp.lpFile;
     wcmd = wcmdBuffer;
-    len = lstrlenW(wszApplicationName) + 3;
-    if (sei_tmp.lpParameters[0])
-        len += 1 + lstrlenW(wszParameters);
-    if (len > wcmdLen)
-    {
-        wcmd = heap_alloc(len * sizeof(WCHAR));
-        wcmdLen = len;
-    }
-    wcmd[0] = '\"';
-    len = lstrlenW(wszApplicationName);
-    memcpy(wcmd+1, wszApplicationName, len * sizeof(WCHAR));
-    len++;
-    wcmd[len++] = '\"';
-    wcmd[len] = 0;
-    if (sei_tmp.lpParameters[0]) {
-        wcmd[len++] = ' ';
-        strcpyW(wcmd+len, wszParameters);
-    }
-
-    retval = execfunc(wcmd, NULL, FALSE, &sei_tmp, sei);
+    strcpyW(wcmd, wszApplicationName);
+    retval = SHELL_quote_and_execute( wcmd, wszParameters, wszEmpty,
+                                      wszApplicationName, NULL, &sei_tmp,
+                                      sei, execfunc );
     if (retval > 32) {
         heap_free(wszApplicationName);
         if (wszParameters != parametersBuffer)


More information about the wine-devel mailing list