Stack is freed on failure.

svn path=/trunk/; revision=662
This commit is contained in:
Eric Kohl 1999-09-12 20:49:06 +00:00
parent 40f81ce970
commit 3255097117

View file

@ -42,6 +42,7 @@ RtlCreateUserThread(HANDLE ProcessHandle,
ULONG ReservedSize;
ULONG CommitSize;
ULONG GuardSize;
ULONG RegionSize;
NTSTATUS Status;
/* initialize initial teb */
@ -57,6 +58,8 @@ RtlCreateUserThread(HANDLE ProcessHandle,
GuardSize = PAGESIZE;
RegionSize = 0;
/* Reserve stack */
InitialTeb.StackReserved = NULL;
Status = NtAllocateVirtualMemory(ProcessHandle,
@ -93,6 +96,12 @@ RtlCreateUserThread(HANDLE ProcessHandle,
if (!NT_SUCCESS(Status))
{
/* release the stack space */
NtFreeVirtualMemory(ProcessHandle,
InitialTeb.StackReserved,
&RegionSize,
MEM_RELEASE);
DPRINT("Error committing stack page!\n");
return Status;
}
@ -110,6 +119,12 @@ RtlCreateUserThread(HANDLE ProcessHandle,
if (!NT_SUCCESS(Status))
{
/* release the stack space */
NtFreeVirtualMemory(ProcessHandle,
InitialTeb.StackReserved,
&RegionSize,
MEM_RELEASE);
DPRINT("Error committing guard page!\n");
return Status;
}
@ -144,14 +159,13 @@ RtlCreateUserThread(HANDLE ProcessHandle,
if (!NT_SUCCESS(Status))
{
ULONG RegionSize = 0;
/* release the stack space */
NtFreeVirtualMemory(ProcessHandle,
InitialTeb.StackReserved,
&RegionSize,
MEM_RELEASE);
DPRINT("Error creating thread!\n");
return Status;
}
@ -223,4 +237,13 @@ RtlInitializeContext(HANDLE ProcessHandle,
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
RtlDestroyUserThreadStack(param1, param2)
{
}
/* EOF */