1 /* $Id: close.c,v 1.2 2000/10/22 16:36:51 ekohl Exp $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/lpc/close.c
6 * PURPOSE: Communication mechanism
7 * PROGRAMMER: David Welch (welch@cwcom.net)
12 /* INCLUDES *****************************************************************/
14 #include <ddk/ntddk.h>
15 #include <internal/ob.h>
16 #include <internal/port.h>
17 #include <internal/dbg.h>
20 #include <internal/debug.h>
23 /**********************************************************************
41 PEPORT Port
= (PEPORT
) ObjectBody
;
44 // DPRINT1("NiClosePort(ObjectBody %x, HandleCount %d) RefCount %d\n",
45 // ObjectBody, HandleCount, ObGetReferenceCount(Port));
47 if ( (HandleCount
== 0)
48 && (Port
->State
== EPORT_CONNECTED_CLIENT
)
49 && (ObGetReferenceCount(Port
) == 2)
52 // DPRINT1("All handles closed to client port\n");
54 Message
.MessageSize
= sizeof(LPC_MESSAGE
);
57 EiReplyOrRequestPort (
64 & Port
->OtherPort
->Event
,
69 Port
->OtherPort
->OtherPort
= NULL
;
70 Port
->OtherPort
->State
= EPORT_DISCONNECTED
;
71 ObDereferenceObject (Port
);
73 if ( (HandleCount
== 0)
74 && (Port
->State
== EPORT_CONNECTED_SERVER
)
75 && (ObGetReferenceCount(Port
) == 2)
78 // DPRINT("All handles closed to server\n");
80 Port
->OtherPort
->OtherPort
= NULL
;
81 Port
->OtherPort
->State
= EPORT_DISCONNECTED
;
82 ObDereferenceObject(Port
->OtherPort
);
87 /**********************************************************************
104 // PEPORT Port = (PEPORT)ObjectBody;
106 // DPRINT1("Deleting port %x\n", Port);