From 06f1f53c4c11c972561de91e76cd5ea6dc5c2ced Mon Sep 17 00:00:00 2001 From: Damjan Jovanovic Date: Sun, 22 Mar 2020 13:46:18 +0200 Subject: [PATCH] shell32: Simplify SHELL_execute(). Signed-off-by: Damjan Jovanovic Signed-off-by: Alexandre Julliard --- dlls/shell32/shlexec.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index 28f2e36f9a7..d3ff821135f 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)