Piotr Caban : shell32: Handle executable with space in path in SHELL_execute.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jul 16 08:37:19 CDT 2015
Module: wine
Branch: master
Commit: 663f9f4b217a50cb5c6c1a6f94f348e047bc2747
URL: http://source.winehq.org/git/wine.git/?a=commit;h=663f9f4b217a50cb5c6c1a6f94f348e047bc2747
Author: Piotr Caban <piotr at codeweavers.com>
Date: Wed Jul 15 17:34:05 2015 +0200
shell32: Handle executable with space in path in SHELL_execute.
---
dlls/shell32/shlexec.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index 9865005..2505981 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -1554,7 +1554,6 @@ static void do_error_dialog( UINT_PTR retval, HWND hwnd )
*/
static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
{
- static const WCHAR wSpace[] = {' ',0};
static const WCHAR wWww[] = {'w','w','w',0};
static const WCHAR wHttp[] = {'h','t','t','p',':','/','/',0};
static const DWORD unsupportedFlags =
@@ -1763,7 +1762,7 @@ 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) + 1;
+ len = lstrlenW(wszApplicationName) + 3;
if (sei_tmp.lpParameters[0])
len += 1 + lstrlenW(wszParameters);
if (len > wcmdLen)
@@ -1771,10 +1770,14 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
wcmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
wcmdLen = len;
}
- strcpyW(wcmd, wszApplicationName);
+ wcmd[0] = '\"';
+ len = lstrlenW(wszApplicationName);
+ memcpy(wcmd+1, wszApplicationName, len * sizeof(WCHAR));
+ len++;
+ wcmd[len++] = '\"';
if (sei_tmp.lpParameters[0]) {
- strcatW(wcmd, wSpace);
- strcatW(wcmd, wszParameters);
+ wcmd[len++] = ' ';
+ strcpyW(wcmd+len, wszParameters);
}
retval = execfunc(wcmd, NULL, FALSE, &sei_tmp, sei);
More information about the wine-cvs
mailing list