Commit in reactos on MAIN
lib/kernel32/process/proc.c+2-31.64 -> 1.65
ntoskrnl/lpc/close.c+9-31.13 -> 1.14
            /reply.c+7-11.21 -> 1.22
            /send.c+7-11.17 -> 1.18
+25-8
4 modified files
Fix closing of LPC ports

reactos/lib/kernel32/process
proc.c 1.64 -> 1.65
diff -u -r1.64 -r1.65
--- proc.c	29 Aug 2004 14:46:02 -0000	1.64
+++ proc.c	13 Sep 2004 19:10:45 -0000	1.65
@@ -1,4 +1,4 @@
-/* $Id: proc.c,v 1.64 2004/08/29 14:46:02 weiden Exp $
+/* $Id: proc.c,v 1.65 2004/09/13 19:10:45 gvg Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -639,8 +639,7 @@
 			       sizeof(CSRSS_API_REPLY));
   if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrReply.Status))
     {
-      DbgPrint("Failed to tell csrss about terminating process. "
-	       "Expect trouble.\n");
+      DPRINT("Failed to tell csrss about terminating process\n");
     }
   
   

reactos/ntoskrnl/lpc
close.c 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- close.c	15 Aug 2004 16:39:06 -0000	1.13
+++ close.c	13 Sep 2004 19:10:45 -0000	1.14
@@ -1,4 +1,4 @@
-/* $Id: close.c,v 1.13 2004/08/15 16:39:06 chorns Exp $
+/* $Id: close.c,v 1.14 2004/09/13 19:10:45 gvg Exp $
  * 
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -33,7 +33,11 @@
 {
   PEPORT Port = (PEPORT)ObjectBody;
   LPC_MESSAGE Message;
-  
+
+  /* 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.
@@ -41,6 +45,7 @@
   if (HandleCount == 0 && Port->State == EPORT_CONNECTED_CLIENT && 
       ObGetObjectPointerCount(Port) == 2)
     {
+      DPRINT("Informing server\n");
       Message.MessageSize = sizeof(LPC_MESSAGE);
       Message.DataSize = 0;
       EiReplyOrRequestPort (Port->OtherPort,
@@ -61,8 +66,9 @@
    * don't actually notify the client until it attempts an operation.
    */
   if (HandleCount == 0 && Port->State == EPORT_CONNECTED_SERVER && 
-      ObGetObjectPointerCount(Port) == 2)
+      ObGetObjectPointerCount(Port) == 1)
     {
+        DPRINT("Cleaning up server\n");
 	Port->OtherPort->OtherPort = NULL;
 	Port->OtherPort->State = EPORT_DISCONNECTED;
 	ObDereferenceObject(Port->OtherPort);

reactos/ntoskrnl/lpc
reply.c 1.21 -> 1.22
diff -u -r1.21 -r1.22
--- reply.c	15 Aug 2004 16:39:06 -0000	1.21
+++ reply.c	13 Sep 2004 19:10:45 -0000	1.22
@@ -1,4 +1,4 @@
-/* $Id: reply.c,v 1.21 2004/08/15 16:39:06 chorns Exp $
+/* $Id: reply.c,v 1.22 2004/09/13 19:10:45 gvg Exp $
  * 
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -99,6 +99,12 @@
 	DPRINT("NtReplyPort() = %x\n", Status);
 	return(Status);
      }
+
+   if (EPORT_DISCONNECTED == Port->State)
+     {
+	ObDereferenceObject(Port);
+	return STATUS_PORT_DISCONNECTED;
+     }
    
    Status = EiReplyOrRequestPort(Port->OtherPort, 
 				 LpcReply, 

reactos/ntoskrnl/lpc
send.c 1.17 -> 1.18
diff -u -r1.17 -r1.18
--- send.c	31 Aug 2004 20:17:18 -0000	1.17
+++ send.c	13 Sep 2004 19:10:45 -0000	1.18
@@ -1,4 +1,4 @@
-/* $Id: send.c,v 1.17 2004/08/31 20:17:18 hbirr Exp $
+/* $Id: send.c,v 1.18 2004/09/13 19:10:45 gvg Exp $
  * 
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -240,6 +240,12 @@
 	return(Status);
      }
 
+   if (EPORT_DISCONNECTED == Port->State)
+     {
+	ObDereferenceObject(Port);
+	return STATUS_PORT_DISCONNECTED;
+     }
+
    /* win32k sometimes needs to KeAttach() the CSRSS process in order to make
       the PortHandle valid. Now that we've got the EPORT structure from the
       handle we can undo this, so everything is normal again. Need to
CVSspam 0.2.8