fixing bug 690 by Brandon Turner. note ms only allown start "notepad" or "note"pad not notep"ad or notepad" but we do that, for we think it is a bug in ms cmd that only allowing " at start of a file name to start the apps.

svn path=/trunk/; revision=17218
This commit is contained in:
Magnus Olsen
2005-08-08 18:59:56 +00:00
parent 3ed0977d46
commit c8a180611e
+52 -3
View File
@@ -287,14 +287,18 @@ static BOOL RunFile(LPTSTR filename)
/*
* This command (in first) was not found in the command table
*
* first - first word on command line
* rest - rest of command line
* Full - whole command line
* First - first word on command line
* Rest - rest of command line
*/
static VOID
Execute (LPTSTR full, LPTSTR first, LPTSTR rest)
Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
{
TCHAR szFullName[MAX_PATH];
TCHAR first[MAX_PATH];
TCHAR rest[MAX_PATH];
TCHAR full[MAX_PATH];
#ifndef __REACTOS__
TCHAR szWindowTitle[MAX_PATH];
#endif
@@ -304,6 +308,51 @@ Execute (LPTSTR full, LPTSTR first, LPTSTR rest)
DebugPrintf (_T("Execute: \'%s\' \'%s\'\n"), first, rest);
#endif
/* Though it was already parsed once, we have a different set of rules
for parsing before we pass to CreateProccess */
if(!_tcschr(Full,_T('\"')))
{
_tcscpy(first,First);
_tcscpy(rest,Rest);
_tcscpy(full,Full);
}
else
{
INT i = 0;
BOOL bInside = FALSE;
rest[0] = _T('\0');
full[0] = _T('\0');
first[0] = _T('\0');
_tcscpy(first,Full);
/* find the end of the command and start of the args */
for(i = 0; i < _tcslen(first); i++)
{
if(!_tcsncmp(&first[i], _T("\""), 1))
bInside = !bInside;
if(!_tcsncmp(&first[i], _T(" "), 1) && !bInside)
{
_tcscpy(rest,&first[i]);
first[i] = _T('\0');
break;
}
}
i = 0;
/* remove any slashes */
while(i < _tcslen(first))
{
if(!_tcsncmp (&first[i], _T("\""), 1))
memcpy(&first[i],&first[i + 1], _tcslen(&first[i]));
else
i++;
}
/* Drop quotes around it just in case there is a space */
_tcscpy(full,_T("\""));
_tcscat(full,first);
_tcscat(full,_T("\" "));
_tcscat(full,rest);
}
/* check for a drive change */
if ((_istalpha (first[0])) && (!_tcscmp (first + 1, _T(":"))))
{