[ros-diffs] [ion] 23292: - Fix a bug in LPC creation (missing one handle) and LPC closing (was not properly closing the port). This caused LPC_PORT_CLOSED never to be sent, and thus CSRSS never received and never closed its handle of the process, meaning that all win32 processes leaked. - As a result, processes can die again, and also be killed by Task Manager. - And finally, "Exit" in cmd.exe as well as pressing the "x" button work.

ion at svn.reactos.org ion at svn.reactos.org
Tue Jul 25 22:21:25 CEST 2006


Author: ion
Date: Wed Jul 26 00:21:24 2006
New Revision: 23292

URL: http://svn.reactos.org/svn/reactos?rev=23292&view=rev
Log:
- Fix a bug in LPC creation (missing one handle) and LPC closing (was not properly closing the port). This caused LPC_PORT_CLOSED never to be sent, and thus CSRSS never received and never closed its handle of the process, meaning that all win32 processes leaked.
- As a result, processes can die again, and also be killed by Task Manager.
- And finally, "Exit" in cmd.exe as well as pressing the "x" button work.

Modified:
    trunk/reactos/ntoskrnl/KrnlFun.c
    trunk/reactos/ntoskrnl/lpc/close.c
    trunk/reactos/ntoskrnl/lpc/connect.c

Modified: trunk/reactos/ntoskrnl/KrnlFun.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/KrnlFun.c?rev=23292&r1=23291&r2=23292&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/KrnlFun.c (original)
+++ trunk/reactos/ntoskrnl/KrnlFun.c Wed Jul 26 00:21:24 2006
@@ -24,7 +24,6 @@
 //  - Add support for Fast Dispatch I/O.
 //
 // Ps:
-//  - Figure out why processes don't die.
 //  - Generate process cookie for user-more thread.
 //
 // Ob:
@@ -32,11 +31,9 @@
 //  - Add Directory Lock.
 //  - Use Object Type Mutex/Lock.
 //  - Implement handle database if anyone needs it.
-//  - Figure out why cmd.exe won't close anymore.
 //
 // Ex:
 //  - Use pushlocks for handle implementation.
-//  - Figure out why cmd.exe won't close anymore.
 //
 ///////////////////////////////////////////////////////////////////////////////
 

Modified: trunk/reactos/ntoskrnl/lpc/close.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/close.c?rev=23292&r1=23291&r2=23292&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/lpc/close.c (original)
+++ trunk/reactos/ntoskrnl/lpc/close.c Wed Jul 26 00:21:24 2006
@@ -57,13 +57,11 @@
 
   /* FIXME Race conditions here! */
 
-  DPRINT("NiClosePort 0x%p OtherPort 0x%p State %d\n", Port, Port->OtherPort, Port->State);
-
   /*
    * If the client has just closed its handle then tell the server what
    * happened and disconnect this port.
    */
-  if (HandleCount == 1 && Port->State == EPORT_CONNECTED_CLIENT)
+  if (!(HandleCount)&& (Port->State == EPORT_CONNECTED_CLIENT))
     {
       DPRINT("Informing server\n");
       Message.u1.s1.TotalLength = sizeof(PORT_MESSAGE);
@@ -85,7 +83,7 @@
    * If the server has closed all of its handles then disconnect the port,
    * don't actually notify the client until it attempts an operation.
    */
-  if (HandleCount == 1 && Port->State == EPORT_CONNECTED_SERVER)
+  if (!(HandleCount)&& (Port->State == EPORT_CONNECTED_SERVER))
     {
         DPRINT("Cleaning up server\n");
 	Port->OtherPort->OtherPort = NULL;

Modified: trunk/reactos/ntoskrnl/lpc/connect.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/lpc/connect.c?rev=23292&r1=23291&r2=23292&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/lpc/connect.c (original)
+++ trunk/reactos/ntoskrnl/lpc/connect.c Wed Jul 26 00:21:24 2006
@@ -552,8 +552,8 @@
   Status = ObInsertObject(ConnectedPort,
 			  NULL,
 			  PORT_ALL_ACCESS,
-			  0,
-			  NULL,
+			  1,
+			  (PVOID*)&ConnectedPort,
 			  &ConnectedPortHandle);
   if (!NT_SUCCESS(Status))
     {




More information about the Ros-diffs mailing list