mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:52:57 +00:00
Removed some escape sequences from the command line in CreateProcessInternalW.
svn path=/trunk/; revision=19502
This commit is contained in:
parent
ec55f4fec0
commit
fb29639c6b
1 changed files with 39 additions and 2 deletions
|
@ -657,6 +657,7 @@ CreateProcessInternalW(HANDLE hToken,
|
||||||
ULONG RetVal;
|
ULONG RetVal;
|
||||||
UINT Error = 0;
|
UINT Error = 0;
|
||||||
BOOLEAN SearchDone = FALSE;
|
BOOLEAN SearchDone = FALSE;
|
||||||
|
BOOLEAN Escape = FALSE;
|
||||||
CLIENT_ID ClientId;
|
CLIENT_ID ClientId;
|
||||||
PPEB OurPeb = NtCurrentPeb();
|
PPEB OurPeb = NtCurrentPeb();
|
||||||
PPEB RemotePeb;
|
PPEB RemotePeb;
|
||||||
|
@ -745,6 +746,21 @@ CreateProcessInternalW(HANDLE hToken,
|
||||||
PriorityClass.Foreground = FALSE;
|
PriorityClass.Foreground = FALSE;
|
||||||
PriorityClass.PriorityClass = BasepConvertPriorityClass(dwCreationFlags);
|
PriorityClass.PriorityClass = BasepConvertPriorityClass(dwCreationFlags);
|
||||||
|
|
||||||
|
if (lpCommandLine)
|
||||||
|
{
|
||||||
|
/* Serach for escape sequences */
|
||||||
|
ScanString = lpCommandLine;
|
||||||
|
while (NULL != (ScanString = wcschr(ScanString, L'^')))
|
||||||
|
{
|
||||||
|
ScanString++;
|
||||||
|
if (*ScanString == L'\"' || *ScanString == L'^' || *ScanString == L'\"')
|
||||||
|
{
|
||||||
|
Escape = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the application name and do all the proper formating necessary */
|
/* Get the application name and do all the proper formating necessary */
|
||||||
GetAppName:
|
GetAppName:
|
||||||
/* See if we have an application name (oh please let us have one!) */
|
/* See if we have an application name (oh please let us have one!) */
|
||||||
|
@ -775,7 +791,7 @@ GetAppName:
|
||||||
/* Find the closing quote */
|
/* Find the closing quote */
|
||||||
while (*ScanString)
|
while (*ScanString)
|
||||||
{
|
{
|
||||||
if (*ScanString == L'\"')
|
if (*ScanString == L'\"' && *(ScanString - 1) != L'^')
|
||||||
{
|
{
|
||||||
/* Found it */
|
/* Found it */
|
||||||
NullBuffer = ScanString;
|
NullBuffer = ScanString;
|
||||||
|
@ -1179,6 +1195,27 @@ GetAppName:
|
||||||
DPRINT("Quoted CmdLine: %S\n", QuotedCmdLine);
|
DPRINT("Quoted CmdLine: %S\n", QuotedCmdLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Escape)
|
||||||
|
{
|
||||||
|
if (QuotedCmdLine == NULL)
|
||||||
|
{
|
||||||
|
QuotedCmdLine = RtlAllocateHeap(GetProcessHeap(),
|
||||||
|
0,
|
||||||
|
(wcslen(lpCommandLine) + 1) * sizeof(WCHAR));
|
||||||
|
wcscpy(QuotedCmdLine, lpCommandLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
ScanString = QuotedCmdLine;
|
||||||
|
while (NULL != (ScanString = wcschr(ScanString, L'^')))
|
||||||
|
{
|
||||||
|
ScanString++;
|
||||||
|
if (*ScanString == L'\"' || *ScanString == L'^' || *ScanString == L'\\')
|
||||||
|
{
|
||||||
|
memmove(ScanString-1, ScanString, wcslen(ScanString) * sizeof(WCHAR) + sizeof(WCHAR));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the Process Information */
|
/* Get the Process Information */
|
||||||
Status = NtQueryInformationProcess(hProcess,
|
Status = NtQueryInformationProcess(hProcess,
|
||||||
ProcessBasicInformation,
|
ProcessBasicInformation,
|
||||||
|
@ -1199,7 +1236,7 @@ GetAppName:
|
||||||
RemotePeb,
|
RemotePeb,
|
||||||
(LPWSTR)lpApplicationName,
|
(LPWSTR)lpApplicationName,
|
||||||
CurrentDirectory,
|
CurrentDirectory,
|
||||||
(QuotesNeeded || CmdLineIsAppName) ?
|
(QuotesNeeded || CmdLineIsAppName || Escape) ?
|
||||||
QuotedCmdLine : lpCommandLine,
|
QuotedCmdLine : lpCommandLine,
|
||||||
lpEnvironment,
|
lpEnvironment,
|
||||||
EnvSize,
|
EnvSize,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue