Commit in reactos on MAIN
ntoskrnl/ps/kill.c+2-81.78 -> 1.79
lib/rosrtl/thread/exit.c+17-21.2 -> 1.3
+19-10
2 modified files
Rollback last change since it was incorrect.
See http://www.reactos.com/bugzilla/show_bug.cgi?id=36

reactos/ntoskrnl/ps
kill.c 1.78 -> 1.79
diff -u -r1.78 -r1.79
--- kill.c	3 Oct 2004 18:53:05 -0000	1.78
+++ kill.c	3 Oct 2004 21:03:03 -0000	1.79
@@ -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 @@
    PEPROCESS CurrentProcess;
    SIZE_T Length = PAGE_SIZE;
    PVOID TebBlock;
-   ULONG StackSize;
 
    KeLowerIrql(PASSIVE_LEVEL);
 
@@ -148,14 +147,9 @@
    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);

reactos/lib/rosrtl/thread
exit.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- exit.c	3 Oct 2004 18:53:05 -0000	1.2
+++ exit.c	3 Oct 2004 21:03:06 -0000	1.3
@@ -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 <rosrtl/thread.h>
 
+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(;;);
 }
CVSspam 0.2.8