mirror of
https://github.com/reactos/reactos.git
synced 2024-10-10 19:27:40 +00:00
* put application name in quotes when lpCommandLine is != NULL
svn path=/trunk/; revision=23547
This commit is contained in:
parent
4a4efbf11b
commit
336ae5366e
|
@ -673,7 +673,7 @@ CreateProcessInternalW(HANDLE hToken,
|
||||||
* key (see http://blogs.msdn.com/oldnewthing/archive/2005/12/19/505449.aspx)
|
* key (see http://blogs.msdn.com/oldnewthing/archive/2005/12/19/505449.aspx)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DPRINT("CreateProcessW: lpApplicationName: %S lpCommandLine: %S"
|
DPRINT1("CreateProcessW: lpApplicationName: %S lpCommandLine: %S"
|
||||||
" lpEnvironment: %p lpCurrentDirectory: %S dwCreationFlags: %lx\n",
|
" lpEnvironment: %p lpCurrentDirectory: %S dwCreationFlags: %lx\n",
|
||||||
lpApplicationName, lpCommandLine, lpEnvironment, lpCurrentDirectory,
|
lpApplicationName, lpCommandLine, lpEnvironment, lpCurrentDirectory,
|
||||||
dwCreationFlags);
|
dwCreationFlags);
|
||||||
|
@ -1227,6 +1227,64 @@ GetAppName:
|
||||||
|
|
||||||
DPRINT("Quoted CmdLine: %S\n", QuotedCmdLine);
|
DPRINT("Quoted CmdLine: %S\n", QuotedCmdLine);
|
||||||
}
|
}
|
||||||
|
else if(lpApplicationName && lpCommandLine)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
int Size = 0;
|
||||||
|
WCHAR * AppName;
|
||||||
|
|
||||||
|
AppName = wcsrchr(lpApplicationName, L'\\');
|
||||||
|
if (AppName)
|
||||||
|
{
|
||||||
|
AppName++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AppName = (WCHAR*)lpApplicationName;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = wcslen(AppName);
|
||||||
|
if (!_wcsnicmp(AppName, lpCommandLine, len-4) && lpCommandLine[len-4] == L' ')
|
||||||
|
{
|
||||||
|
/* remove application name */
|
||||||
|
NullBuffer = wcschr(lpCommandLine, L' ');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NullBuffer = (WCHAR*)lpCommandLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NullBuffer)
|
||||||
|
{
|
||||||
|
Size = wcslen(NullBuffer) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate a buffer */
|
||||||
|
QuotedCmdLine = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||||
|
0,
|
||||||
|
(Size + wcslen(lpApplicationName) + 2 + 1) *
|
||||||
|
sizeof(WCHAR));
|
||||||
|
if (QuotedCmdLine == NULL)
|
||||||
|
{
|
||||||
|
DPRINT1("Cannot allocate memory for quoted command line\n");
|
||||||
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
goto Cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Copy the first quote */
|
||||||
|
wcscpy(QuotedCmdLine, L"\"");
|
||||||
|
|
||||||
|
/* Add the command line and the finishing quote */
|
||||||
|
wcscat(QuotedCmdLine, lpApplicationName);
|
||||||
|
wcscat(QuotedCmdLine, L"\"");
|
||||||
|
|
||||||
|
if (Size)
|
||||||
|
{
|
||||||
|
wcscat(QuotedCmdLine, L" ");
|
||||||
|
wcscat(QuotedCmdLine, NullBuffer);
|
||||||
|
}
|
||||||
|
lpCommandLine = QuotedCmdLine;
|
||||||
|
}
|
||||||
|
|
||||||
if (Escape)
|
if (Escape)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue