Author: khornicek
Date: Wed Oct 6 16:44:09 2010
New Revision: 49020
URL:
http://svn.reactos.org/svn/reactos?rev=49020&view=rev
Log:
[CMD]
Use the full name we get from SearchForExecutable when building the command line for
CreateProcess so we get proper name in argv[0] later.
Modified:
trunk/reactos/base/shell/cmd/cmd.c
trunk/reactos/base/shell/cmd/start.c
Modified: trunk/reactos/base/shell/cmd/cmd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=4…
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] Wed Oct 6 16:44:09 2010
@@ -316,6 +316,7 @@
TCHAR szWindowTitle[MAX_PATH];
DWORD dwExitCode = 0;
TCHAR *FirstEnd;
+ TCHAR szFullCmdLine [CMDLINE_LENGTH];
TRACE ("Execute: \'%s\' \'%s\'\n", debugstr_aw(First),
debugstr_aw(Rest));
@@ -392,11 +393,16 @@
PROCESS_INFORMATION prci;
STARTUPINFO stui;
- /* build command line for CreateProcess(): first + " " + rest */
+ /* build command line for CreateProcess(): FullName + " " + rest */
+ _tcscpy(szFullCmdLine, szFullName);
+
if (*rest)
- rest[-1] = _T(' ');
-
- TRACE ("[EXEC: %s]\n", debugstr_aw(Full));
+ {
+ _tcsncat(szFullCmdLine, _T(" "), CMDLINE_LENGTH - _tcslen(szFullCmdLine));
+ _tcsncat(szFullCmdLine, rest, CMDLINE_LENGTH - _tcslen(szFullCmdLine));
+ }
+
+ TRACE ("[EXEC: %s]\n", debugstr_aw(szFullCmdLine));
/* fill startup info */
memset (&stui, 0, sizeof (STARTUPINFO));
@@ -409,7 +415,7 @@
ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT );
if (CreateProcess (szFullName,
- Full,
+ szFullCmdLine,
NULL,
NULL,
TRUE,
Modified: trunk/reactos/base/shell/cmd/start.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/start.c?rev…
==============================================================================
--- trunk/reactos/base/shell/cmd/start.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/start.c [iso-8859-1] Wed Oct 6 16:44:09 2010
@@ -246,14 +246,14 @@
else
{
TRACE ("[EXEC: %s %s]\n", debugstr_aw(szFullName), debugstr_aw(Rest));
- _tcscpy(szFullCmdLine, Rest);
+ _tcscpy(szFullCmdLine, szFullName);
}
/* build command line for CreateProcess() */
if (param != NULL)
{
- _tcscat(szFullCmdLine, _T(" "));
- _tcscat(szFullCmdLine, param);
+ _tcsncat(szFullCmdLine, _T(" "), CMDLINE_LENGTH - _tcslen(szFullCmdLine));
+ _tcsncat(szFullCmdLine, param, CMDLINE_LENGTH - _tcslen(szFullCmdLine));
}
/* fill startup info */