97c2d82d08e03382a6c87e0fef3ddb34cdd5dd1c
[reactos.git] / reactos / ntoskrnl / lpc / complete.c
1 /* $Id: complete.c,v 1.9 2003/07/11 01:23:15 royce Exp $
2 *
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)
8 * UPDATE HISTORY:
9 * Created 22/05/98
10 */
11
12 /* INCLUDES ******************************************************************/
13
14 #include <ddk/ntddk.h>
15 #include <internal/ob.h>
16 #include <internal/port.h>
17 #include <internal/dbg.h>
18
19 #define NDEBUG
20 #include <internal/debug.h>
21
22 /* FUNCTIONS *****************************************************************/
23
24 /***********************************************************************
25 * NAME EXPORTED
26 * NtCompleteConnectPort@4
27 *
28 */
29 EXPORTED NTSTATUS STDCALL
30 NtCompleteConnectPort (HANDLE PortHandle)
31 {
32 NTSTATUS Status;
33 PEPORT OurPort;
34
35 DPRINT("NtCompleteConnectPort(PortHandle %x)\n", PortHandle);
36
37 Status = ObReferenceObjectByHandle (PortHandle,
38 PORT_ALL_ACCESS,
39 ExPortType,
40 UserMode,
41 (PVOID*)&OurPort,
42 NULL);
43 if (!NT_SUCCESS(Status))
44 {
45 return (Status);
46 }
47
48 OurPort->State = EPORT_CONNECTED_SERVER;
49
50 KeReleaseSemaphore(&OurPort->OtherPort->Semaphore, IO_NO_INCREMENT, 1,
51 FALSE);
52
53 ObDereferenceObject (OurPort);
54
55 return (STATUS_SUCCESS);
56 }
57
58
59 /* EOF */