cmd: Avoid having first parameter to start.exe ignored.

Signed-off-by: Bernhard Übelacker <bernhardu@mailbox.org>
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Bernhard Übelacker 2018-04-27 17:57:42 +08:00 committed by Alexandre Julliard
parent 799719a423
commit f95b85a856
3 changed files with 14 additions and 7 deletions

View File

@ -4322,7 +4322,7 @@ void WCMD_start(WCHAR *args)
int argno; int argno;
int have_title; int have_title;
WCHAR file[MAX_PATH]; WCHAR file[MAX_PATH];
WCHAR *cmdline; WCHAR *cmdline, *cmdline_params;
STARTUPINFOW st; STARTUPINFOW st;
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
@ -4331,6 +4331,7 @@ void WCMD_start(WCHAR *args)
cmdline = heap_alloc( (strlenW(file) + strlenW(args) + 8) * sizeof(WCHAR) ); cmdline = heap_alloc( (strlenW(file) + strlenW(args) + 8) * sizeof(WCHAR) );
strcpyW( cmdline, file ); strcpyW( cmdline, file );
strcatW( cmdline, spaceW ); strcatW( cmdline, spaceW );
cmdline_params = cmdline + strlenW(cmdline);
/* The start built-in has some special command-line parsing properties /* The start built-in has some special command-line parsing properties
* which will be outlined here. * which will be outlined here.
@ -4382,17 +4383,17 @@ void WCMD_start(WCHAR *args)
have_title = TRUE; have_title = TRUE;
/* Copy all of the cmdline processed */ /* Copy all of the cmdline processed */
memcpy(cmdline, args, sizeof(WCHAR) * (argN - args)); memcpy(cmdline_params, args, sizeof(WCHAR) * (argN - args));
cmdline[argN - args] = '\0'; cmdline_params[argN - args] = '\0';
/* Add quoted title */ /* Add quoted title */
strcatW(cmdline, prefixQuote); strcatW(cmdline_params, prefixQuote);
strcatW(cmdline, thisArg); strcatW(cmdline_params, thisArg);
strcatW(cmdline, postfixQuote); strcatW(cmdline_params, postfixQuote);
/* Concatenate remaining command-line */ /* Concatenate remaining command-line */
thisArg = WCMD_parameter_with_delims(args, argno, &argN, TRUE, FALSE, startDelims); thisArg = WCMD_parameter_with_delims(args, argno, &argN, TRUE, FALSE, startDelims);
strcatW(cmdline, argN + strlenW(thisArg)); strcatW(cmdline_params, argN + strlenW(thisArg));
break; break;
} }

View File

@ -2988,6 +2988,10 @@ path
set path=%WINE_backup_path% set path=%WINE_backup_path%
set WINE_backup_path= set WINE_backup_path=
echo ------------ Testing start /W ------------
echo start /W failed to wait>foobar.txt
start /W "" cmd /C "ping -n1 & echo start /W seems to really wait>foobar.txt"& type foobar.txt& del foobar.txt
echo ------------ Testing combined CALLs/GOTOs ------------ echo ------------ Testing combined CALLs/GOTOs ------------
echo @echo off>foo.cmd echo @echo off>foo.cmd
echo goto :eof>>foot.cmd echo goto :eof>>foot.cmd

View File

@ -1574,6 +1574,8 @@ Correctly ignored trailing information
PATH=original PATH=original
PATH=try2 PATH=try2
PATH=try3 PATH=try3
------------ Testing start /W ------------
start /W seems to really wait
------------ Testing combined CALLs/GOTOs ------------ ------------ Testing combined CALLs/GOTOs ------------
world world
cheball cheball