Author: arty
Date: Sat Jun 9 02:55:15 2012
New Revision: 56716
URL:
http://svn.reactos.org/svn/reactos?rev=56716&view=rev
Log:
[CMD]
Fix first argument of the target program so that paths with spaces aren't
reparsed by the c runtime as multiple arguments.
Modified:
trunk/reactos/base/shell/cmd/cmd.c
Modified: trunk/reactos/base/shell/cmd/cmd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=5…
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] Sat Jun 9 02:55:15 2012
@@ -396,7 +396,10 @@
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)
{