mirror of
https://github.com/reactos/reactos.git
synced 2025-07-29 08:21:38 +00:00
[KERNEL32][RTL] Diverse fixes/improvements for thread stack creation code. (#802)
- kernel32!BaseCreateStack() is compatible with ntdll!RtlpCreateUserStack().
- When checking whether a stack guard page can be added, its size has to
be accounted for in the checking logic.
- We have to satisfy the PEB::MinimumStackCommit constraint.
- We cannot use PEB::GuaranteedStackBytes in BaseCreateStack() since it is
nowhere initialized (default is 0). It gets initialized to a non-zero
value when the user manually calls SetThreadStackGuarantee().
https://www.installsetupconfig.com/win32programming/windowsthreadsprocessapis7_6.html
- RtlpCreateUserStack(): Fix memory leak in failure case.
- RtlpFreeUserStack() doesn't need to return anything.
See also commit 1bc59379
(r59868).
CORE-11319
This commit is contained in:
parent
4895f21efa
commit
effdb6f232
4 changed files with 102 additions and 75 deletions
|
@ -165,9 +165,10 @@ CreateRemoteThread(IN HANDLE hProcess,
|
|||
|
||||
/* Create the Stack */
|
||||
Status = BaseCreateStack(hProcess,
|
||||
dwStackSize,
|
||||
dwCreationFlags & STACK_SIZE_PARAM_IS_A_RESERVATION ?
|
||||
dwStackSize : 0,
|
||||
(dwCreationFlags & STACK_SIZE_PARAM_IS_A_RESERVATION) ?
|
||||
0 : dwStackSize,
|
||||
(dwCreationFlags & STACK_SIZE_PARAM_IS_A_RESERVATION) ?
|
||||
dwStackSize : 0,
|
||||
&InitialTeb);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue