mirror of https://github.com/x64dbg/TitanEngine
Make the default command line the quoted image path, to prevent empty command lines in case no arguments were specified
This commit is contained in:
parent
ef7deb59d4
commit
86fe598475
|
|
@ -215,15 +215,16 @@ __declspec(dllexport) void* TITCALL InitNativeDebugW(wchar_t* szFileName, wchar_
|
||||||
goto finished;
|
goto finished;
|
||||||
|
|
||||||
// Convert command line and directory to UNICODE_STRING if present
|
// Convert command line and directory to UNICODE_STRING if present
|
||||||
SIZE_T ArgumentsLength = lstrlenW(szCommandLine);
|
SIZE_T ArgumentsLength = szCommandLine != NULL ? lstrlenW(szCommandLine) : 0;
|
||||||
if(szCommandLine != NULL && ArgumentsLength > 0)
|
|
||||||
{
|
|
||||||
SIZE_T BufferSize = ImagePath.Length + ((ArgumentsLength + 4) * sizeof(wchar_t));
|
SIZE_T BufferSize = ImagePath.Length + ((ArgumentsLength + 4) * sizeof(wchar_t));
|
||||||
CommandLine.Buffer = (PWSTR)RtlAllocateHeap(RtlProcessHeap(), HEAP_ZERO_MEMORY, BufferSize);
|
CommandLine.Buffer = (PWSTR)RtlAllocateHeap(RtlProcessHeap(), HEAP_ZERO_MEMORY, BufferSize * 10);
|
||||||
CommandLine.MaximumLength = (USHORT)BufferSize;
|
CommandLine.MaximumLength = (USHORT)BufferSize;
|
||||||
RtlAppendUnicodeToString(&CommandLine, L"\"");
|
RtlAppendUnicodeToString(&CommandLine, L"\"");
|
||||||
RtlAppendUnicodeStringToString(&CommandLine, &ImagePath);
|
RtlAppendUnicodeStringToString(&CommandLine, &ImagePath);
|
||||||
RtlAppendUnicodeToString(&CommandLine, L"\"");
|
RtlAppendUnicodeToString(&CommandLine, L"\"");
|
||||||
|
if(ArgumentsLength > 0)
|
||||||
|
{
|
||||||
|
RtlAppendUnicodeToString(&CommandLine, L" ");
|
||||||
RtlAppendUnicodeToString(&CommandLine, szCommandLine);
|
RtlAppendUnicodeToString(&CommandLine, szCommandLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue