1 /* $Id: complete.c,v 1.12 2004/08/15 16:39:06 chorns Exp $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/lpc/complete.c
6 * PURPOSE: Communication mechanism
7 * PROGRAMMER: David Welch (welch@cwcom.net)
12 /* INCLUDES ******************************************************************/
16 #include <internal/debug.h>
18 /* FUNCTIONS *****************************************************************/
20 /***********************************************************************
22 * NtCompleteConnectPort/1
25 * Wake up the client thread that issued the NtConnectPort call
26 * this server-side port was created for communicating with.
27 * To be used in LPC servers processes on reply ports only.
30 * hServerSideCommPort: a reply port handle returned by
31 * NtAcceptConnectPort.
34 * STATUS_SUCCESS or an error code from Ob.
37 NtCompleteConnectPort (HANDLE hServerSideCommPort
)
42 DPRINT("NtCompleteConnectPort(hServerSideCommPort %x)\n", hServerSideCommPort
);
45 * Ask Ob to translate the port handle to EPORT
47 Status
= ObReferenceObjectByHandle (hServerSideCommPort
,
53 if (!NT_SUCCESS(Status
))
58 * Verify EPORT type is a server-side reply port;
59 * otherwise tell the caller the port handle is not
62 if (ReplyPort
->Type
!= EPORT_TYPE_SERVER_COMM_PORT
)
64 ObDereferenceObject (ReplyPort
);
65 return STATUS_INVALID_PORT_HANDLE
;
68 ReplyPort
->State
= EPORT_CONNECTED_SERVER
;
70 * Wake up the client thread that issued NtConnectPort.
72 KeReleaseSemaphore(&ReplyPort
->OtherPort
->Semaphore
, IO_NO_INCREMENT
, 1,
75 * Tell Ob we are no more interested in ReplyPort
77 ObDereferenceObject (ReplyPort
);
79 return (STATUS_SUCCESS
);