From 7eb30acddb456a09ef4ff1a0755ab52dd22ebf9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sun, 3 Oct 2004 21:03:06 +0000 Subject: [PATCH] Rollback last change since it was incorrect. See http://www.reactos.com/bugzilla/show_bug.cgi?id=36 svn path=/trunk/; revision=11173 --- reactos/lib/rosrtl/thread/exit.c | 19 +++++++++++++++++-- reactos/ntoskrnl/ps/kill.c | 10 ++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/reactos/lib/rosrtl/thread/exit.c b/reactos/lib/rosrtl/thread/exit.c index 8091a92e745..d143ce012d8 100644 --- a/reactos/lib/rosrtl/thread/exit.c +++ b/reactos/lib/rosrtl/thread/exit.c @@ -1,4 +1,4 @@ -/* $Id: exit.c,v 1.2 2004/10/03 18:53:05 gvg Exp $ +/* $Id: exit.c,v 1.3 2004/10/03 21:03:06 gvg Exp $ */ /* */ @@ -11,12 +11,27 @@ #include +static VOID NTAPI RtlRosExitUserThread_Stage2 +( + IN ULONG_PTR Status +) +{ + RtlRosFreeUserThreadStack(NtCurrentProcess(), NtCurrentThread()); + NtTerminateThread(NtCurrentThread(), Status); +} + __declspec(noreturn) VOID NTAPI RtlRosExitUserThread ( IN NTSTATUS Status ) { - NtTerminateThread(NtCurrentThread(), Status); + RtlRosSwitchStackForExit + ( + NtCurrentTeb()->StaticUnicodeBuffer, + sizeof(NtCurrentTeb()->StaticUnicodeBuffer), + RtlRosExitUserThread_Stage2, + Status + ); for(;;); } diff --git a/reactos/ntoskrnl/ps/kill.c b/reactos/ntoskrnl/ps/kill.c index 4b8e4e566ac..f1559fad042 100644 --- a/reactos/ntoskrnl/ps/kill.c +++ b/reactos/ntoskrnl/ps/kill.c @@ -1,4 +1,4 @@ -/* $Id: kill.c,v 1.78 2004/10/03 18:53:05 gvg Exp $ +/* $Id: kill.c,v 1.79 2004/10/03 21:03:03 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -114,7 +114,6 @@ PsTerminateCurrentThread(NTSTATUS ExitStatus) PEPROCESS CurrentProcess; SIZE_T Length = PAGE_SIZE; PVOID TebBlock; - ULONG StackSize; KeLowerIrql(PASSIVE_LEVEL); @@ -148,14 +147,9 @@ PsTerminateCurrentThread(NTSTATUS ExitStatus) PspRunCreateThreadNotifyRoutines(CurrentThread, FALSE); PsTerminateWin32Thread(CurrentThread); - /* Free the usermode stack and the TEB */ + /* Free the TEB */ if(CurrentThread->Tcb.Teb) { - StackSize = 0; - ZwFreeVirtualMemory(NtCurrentProcess(), - &CurrentThread->Tcb.Teb->DeallocationStack, - &StackSize, - MEM_RELEASE); DPRINT("Decommit teb at %p\n", CurrentThread->Tcb.Teb); ExAcquireFastMutex(&CurrentProcess->TebLock); TebBlock = MM_ROUND_DOWN(CurrentThread->Tcb.Teb, MM_VIRTMEM_GRANULARITY);