From: Alistair Leslie-Hughes Subject: cmd: Dont assume cmd.exe is the first argument (try 2) Message-Id: <53255531.6050804@hotmail.com> Date: Sun, 16 Mar 2014 18:39:29 +1100 Hi, Fixes http://bugs.winehq.org/show_bug.cgi?id=35134 Changelog: cmd: Dont assume cmd.exe is the first argument Best Regards Alistair Leslie-Hughes From cf2d8fe3e18aa4819612a85497ed972955a8d637 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Sat, 15 Mar 2014 20:00:06 +1100 Subject: [PATCH] Dont assume cmd.exe is the first argument To: wine-patches --- programs/cmd/wcmdmain.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 647f988..7538d11 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -2339,6 +2339,7 @@ int wmain (int argc, WCHAR *argvW[]) static const WCHAR offW[] = {'O','F','F','\0'}; static const WCHAR promptW[] = {'P','R','O','M','P','T','\0'}; static const WCHAR defaultpromptW[] = {'$','P','$','G','\0'}; + static const WCHAR cmdexe[] = {'c','m','d','.','e','x','e','\0'}; CMD_LIST *toExecute = NULL; /* Commands left to be executed */ OSVERSIONINFOW osv; char osver[50]; @@ -2363,7 +2364,7 @@ int wmain (int argc, WCHAR *argvW[]) */ cmdLine = GetCommandLineW(); WINE_TRACE("Full commandline '%s'\n", wine_dbgstr_w(cmdLine)); - args = 1; /* start at first arg, skipping cmd.exe itself */ + args = 0; opt_c = opt_k = opt_q = opt_s = FALSE; WCMD_parameter(cmdLine, args, &argPos, TRUE, TRUE); @@ -2371,6 +2372,10 @@ int wmain (int argc, WCHAR *argvW[]) { WCHAR c; WINE_TRACE("Command line parm: '%s'\n", wine_dbgstr_w(argPos)); + if(args == 0 && strstrW(argPos, cmdexe) != NULL) { + continue; + } + if (argPos[0]!='/' || argPos[1]=='\0') { args++; WCMD_parameter(cmdLine, args, &argPos, TRUE, TRUE); -- 1.8.3.2