Use the full name we get from SearchForExecutable when building the command line for CreateProcess so we get proper name in argv[0] later.

svn path=/trunk/; revision=49020
This commit is contained in:
Kamil Hornicek 2010-10-06 16:44:09 +00:00
parent c617645ef3
commit 2ff3b055ce
2 changed files with 14 additions and 8 deletions

View file

@ -316,6 +316,7 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
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 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
PROCESS_INFORMATION prci;
STARTUPINFO stui;
/* build command line for CreateProcess(): first + " " + rest */
if (*rest)
rest[-1] = _T(' ');
/* build command line for CreateProcess(): FullName + " " + rest */
_tcscpy(szFullCmdLine, szFullName);
TRACE ("[EXEC: %s]\n", debugstr_aw(Full));
if (*rest)
{
_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 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT );
if (CreateProcess (szFullName,
Full,
szFullCmdLine,
NULL,
NULL,
TRUE,

View file

@ -246,14 +246,14 @@ INT cmd_start (LPTSTR Rest)
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 */