3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/lpc/complete.c
6 * PURPOSE: Communication mechanism
8 * PROGRAMMERS: David Welch (welch@cwcom.net)
11 /* INCLUDES ******************************************************************/
15 #include <internal/debug.h>
17 /* FUNCTIONS *****************************************************************/
19 /***********************************************************************
21 * NtCompleteConnectPort/1
24 * Wake up the client thread that issued the NtConnectPort call
25 * this server-side port was created for communicating with.
26 * To be used in LPC servers processes on reply ports only.
29 * hServerSideCommPort: a reply port handle returned by
30 * NtAcceptConnectPort.
33 * STATUS_SUCCESS or an error code from Ob.
36 NtCompleteConnectPort (HANDLE hServerSideCommPort
)
41 DPRINT("NtCompleteConnectPort(hServerSideCommPort %x)\n", hServerSideCommPort
);
44 * Ask Ob to translate the port handle to EPORT
46 Status
= ObReferenceObjectByHandle (hServerSideCommPort
,
52 if (!NT_SUCCESS(Status
))
57 * Verify EPORT type is a server-side reply port;
58 * otherwise tell the caller the port handle is not
61 if (ReplyPort
->Type
!= EPORT_TYPE_SERVER_COMM_PORT
)
63 ObDereferenceObject (ReplyPort
);
64 return STATUS_INVALID_PORT_HANDLE
;
67 ReplyPort
->State
= EPORT_CONNECTED_SERVER
;
69 * Wake up the client thread that issued NtConnectPort.
71 KeReleaseSemaphore(&ReplyPort
->OtherPort
->Semaphore
, IO_NO_INCREMENT
, 1,
74 * Tell Ob we are no more interested in ReplyPort
76 ObDereferenceObject (ReplyPort
);
78 return (STATUS_SUCCESS
);