mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:03:00 +00:00
[KERNEL32] Do not use TEB->StaticUnicodeString in CreateProcessInternalA. CORE-10368
svn path=/trunk/; revision=74702
This commit is contained in:
parent
9a54d4a3a0
commit
29177f71b6
1 changed files with 6 additions and 26 deletions
|
@ -4660,9 +4660,7 @@ CreateProcessInternalA(HANDLE hToken,
|
||||||
LPPROCESS_INFORMATION lpProcessInformation,
|
LPPROCESS_INFORMATION lpProcessInformation,
|
||||||
PHANDLE hNewToken)
|
PHANDLE hNewToken)
|
||||||
{
|
{
|
||||||
PUNICODE_STRING CommandLine = NULL;
|
UNICODE_STRING CommandLine;
|
||||||
UNICODE_STRING DummyString;
|
|
||||||
UNICODE_STRING LiveCommandLine;
|
|
||||||
UNICODE_STRING ApplicationName;
|
UNICODE_STRING ApplicationName;
|
||||||
UNICODE_STRING CurrentDirectory;
|
UNICODE_STRING CurrentDirectory;
|
||||||
BOOL bRetVal;
|
BOOL bRetVal;
|
||||||
|
@ -4677,8 +4675,7 @@ CreateProcessInternalA(HANDLE hToken,
|
||||||
RtlMoveMemory(&StartupInfo, lpStartupInfo, sizeof(*lpStartupInfo));
|
RtlMoveMemory(&StartupInfo, lpStartupInfo, sizeof(*lpStartupInfo));
|
||||||
|
|
||||||
/* Initialize all strings to nothing */
|
/* Initialize all strings to nothing */
|
||||||
LiveCommandLine.Buffer = NULL;
|
CommandLine.Buffer = NULL;
|
||||||
DummyString.Buffer = NULL;
|
|
||||||
ApplicationName.Buffer = NULL;
|
ApplicationName.Buffer = NULL;
|
||||||
CurrentDirectory.Buffer = NULL;
|
CurrentDirectory.Buffer = NULL;
|
||||||
StartupInfo.lpDesktop = NULL;
|
StartupInfo.lpDesktop = NULL;
|
||||||
|
@ -4688,24 +4685,8 @@ CreateProcessInternalA(HANDLE hToken,
|
||||||
/* Convert the Command line */
|
/* Convert the Command line */
|
||||||
if (lpCommandLine)
|
if (lpCommandLine)
|
||||||
{
|
{
|
||||||
/* If it's too long, then we'll have a problem */
|
Basep8BitStringToDynamicUnicodeString(&CommandLine,
|
||||||
if ((strlen(lpCommandLine) + 1) * sizeof(WCHAR) <
|
lpCommandLine);
|
||||||
NtCurrentTeb()->StaticUnicodeString.MaximumLength)
|
|
||||||
{
|
|
||||||
/* Cache it in the TEB */
|
|
||||||
CommandLine = Basep8BitStringToStaticUnicodeString(lpCommandLine);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Use a dynamic version */
|
|
||||||
Basep8BitStringToDynamicUnicodeString(&LiveCommandLine,
|
|
||||||
lpCommandLine);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* The logic below will use CommandLine, so we must make it valid */
|
|
||||||
CommandLine = &DummyString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the Name and Directory */
|
/* Convert the Name and Directory */
|
||||||
|
@ -4740,8 +4721,7 @@ CreateProcessInternalA(HANDLE hToken,
|
||||||
/* Call the Unicode function */
|
/* Call the Unicode function */
|
||||||
bRetVal = CreateProcessInternalW(hToken,
|
bRetVal = CreateProcessInternalW(hToken,
|
||||||
ApplicationName.Buffer,
|
ApplicationName.Buffer,
|
||||||
LiveCommandLine.Buffer ?
|
CommandLine.Buffer,
|
||||||
LiveCommandLine.Buffer : CommandLine->Buffer,
|
|
||||||
lpProcessAttributes,
|
lpProcessAttributes,
|
||||||
lpThreadAttributes,
|
lpThreadAttributes,
|
||||||
bInheritHandles,
|
bInheritHandles,
|
||||||
|
@ -4754,7 +4734,7 @@ CreateProcessInternalA(HANDLE hToken,
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
RtlFreeUnicodeString(&ApplicationName);
|
RtlFreeUnicodeString(&ApplicationName);
|
||||||
RtlFreeUnicodeString(&LiveCommandLine);
|
RtlFreeUnicodeString(&CommandLine);
|
||||||
RtlFreeUnicodeString(&CurrentDirectory);
|
RtlFreeUnicodeString(&CurrentDirectory);
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, StartupInfo.lpDesktop);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, StartupInfo.lpDesktop);
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, StartupInfo.lpReserved);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, StartupInfo.lpReserved);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue