[ros-diffs] [ion] 20839: - Fix one more leak when converting from non-gui to GUI thread stack.

ion at svn.reactos.org ion at svn.reactos.org
Fri Jan 13 23:23:54 CET 2006


- Fix one more leak when converting from non-gui to GUI thread stack.
Modified: trunk/reactos/ntoskrnl/ke/i386/usercall_asm.S
Modified: trunk/reactos/ntoskrnl/ps/kill.c
Modified: trunk/reactos/ntoskrnl/ps/win32.c
  _____  

Modified: trunk/reactos/ntoskrnl/ke/i386/usercall_asm.S
--- trunk/reactos/ntoskrnl/ke/i386/usercall_asm.S	2006-01-13
21:56:51 UTC (rev 20838)
+++ trunk/reactos/ntoskrnl/ke/i386/usercall_asm.S	2006-01-13
22:23:31 UTC (rev 20839)
@@ -358,6 +358,26 @@

 
 .endfunc
 
+/*++
+ * @name KeSwitchKernelStack 
+ *
+ *     The KeSwitchKernelStack routine switches from the current
thread's stack
+ *     to the new specified base and limit.
+ *
+ * @param StackBase
+ *        Pointer to the new Stack Base of the thread.
+ *
+ * @param StackLimit
+ *        Pointer to the new Stack Limit of the thread.
+ *
+ * @return The previous Stack Limit of the thread.
+ *
+ * @remark This routine should typically only be used when converting
from a 
+ *         non-GUI to a GUI Thread. The caller is responsible for
freeing the
+ *         previous stack. The new stack values MUST be valid before
calling
+ *         this routine.
+ *
+ *--*/
 .globl _KeSwitchKernelStack at 8
 .func KeSwitchKernelStack at 8
 _KeSwitchKernelStack at 8:
@@ -400,7 +420,7 @@
     pop edi
 
     /* Save old stack base and get new limit/base */
-    mov eax, [edx+KTHREAD_STACK_BASE]
+    mov eax, [edx+KTHREAD_STACK_LIMIT]
     mov ecx, [esp+12]
     mov esi, [esp+16]
 
  _____  

Modified: trunk/reactos/ntoskrnl/ps/kill.c
--- trunk/reactos/ntoskrnl/ps/kill.c	2006-01-13 21:56:51 UTC (rev
20838)
+++ trunk/reactos/ntoskrnl/ps/kill.c	2006-01-13 22:23:31 UTC (rev
20839)
@@ -194,7 +194,7 @@

     if(Thread->Tcb.Win32Thread != NULL) ExFreePool
(Thread->Tcb.Win32Thread);
 
     /* Release the Kernel Stack */
-    MmDeleteKernelStack((PVOID)Thread->Tcb.StackLimit,
Thread->Tcb.StackLimit);
+    MmDeleteKernelStack((PVOID)Thread->Tcb.StackLimit,
Thread->Tcb.LargeStack);
 
     /* Dereference the Process */
     ObDereferenceObject(Process);
  _____  

Modified: trunk/reactos/ntoskrnl/ps/win32.c
--- trunk/reactos/ntoskrnl/ps/win32.c	2006-01-13 21:56:51 UTC (rev
20838)
+++ trunk/reactos/ntoskrnl/ps/win32.c	2006-01-13 22:23:31 UTC (rev
20839)
@@ -122,7 +122,7 @@

         KeLeaveCriticalRegion();
 
         /* Delete the old stack */
-        //MmDeleteKernelStack(OldStack, FALSE);
+        MmDeleteKernelStack(OldStack, FALSE);
     }
 
     /* This check is bizare. Check out win32k later */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20060113/17198bbe/attachment.html


More information about the Ros-diffs mailing list