From a600f07982405b1e6b1986de2aafbee3b2c1fe02 Mon Sep 17 00:00:00 2001 From: Rafal Harabien Date: Sun, 20 Nov 2011 22:22:42 +0000 Subject: [PATCH] [SHELL32] - Fix running batch files from patch containing spaces in ShellExecute API svn path=/trunk/; revision=54465 --- reactos/dll/win32/shell32/shlexec.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/shell32/shlexec.cpp b/reactos/dll/win32/shell32/shlexec.cpp index d4b30aac5f6..233a599aad4 100644 --- a/reactos/dll/win32/shell32/shlexec.cpp +++ b/reactos/dll/win32/shell32/shlexec.cpp @@ -475,7 +475,7 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait, } else if ((retval = GetLastError()) >= 32) { - TRACE("CreateProcess returned error %ld\n", retval); + WARN("CreateProcess returned error %ld\n", retval); retval = ERROR_BAD_FORMAT; } @@ -1906,7 +1906,7 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) lpFile = wfileName; wcmd = wcmdBuffer; - len = lstrlenW(wszApplicationName) + 1; + len = lstrlenW(wszApplicationName) + 3; if (sei_tmp.lpParameters[0]) len += 1 + lstrlenW(wszParameters); if (len > wcmdLen) @@ -1914,7 +1914,7 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) wcmd = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); wcmdLen = len; } - strcpyW(wcmd, wszApplicationName); + swprintf(wcmd, L"\"%s\"", wszApplicationName); if (sei_tmp.lpParameters[0]) { strcatW(wcmd, wSpace);