From 17c51a305dc205cda0c0171609ca157ed1aca1f4 Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Sat, 9 Jun 2012 02:55:15 +0000 Subject: [PATCH] [CMD] Fix first argument of the target program so that paths with spaces aren't reparsed by the c runtime as multiple arguments. svn path=/trunk/; revision=56716 --- reactos/base/shell/cmd/cmd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reactos/base/shell/cmd/cmd.c b/reactos/base/shell/cmd/cmd.c index 4df5f2ff968..5c6fc26c4a4 100644 --- a/reactos/base/shell/cmd/cmd.c +++ b/reactos/base/shell/cmd/cmd.c @@ -396,7 +396,10 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd) STARTUPINFO stui; /* build command line for CreateProcess(): FullName + " " + rest */ - _tcscpy(szFullCmdLine, szFullName); + BOOL quoted = !!_tcschr(First, ' '); + _tcscpy(szFullCmdLine, quoted ? _T("\"") : _T("")); + _tcsncat(szFullCmdLine, First, CMDLINE_LENGTH - _tcslen(szFullCmdLine)); + _tcsncat(szFullCmdLine, quoted ? _T("\"") : _T(""), CMDLINE_LENGTH - _tcslen(szFullCmdLine)); if (*rest) {