1 /* $Id: port.c,v 1.3 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/port.c
6 * PURPOSE: Communication mechanism
7 * PROGRAMMER: David Welch (welch@cwcom.net)
12 * ntoskrnl/nt/port.c moved in ntoskrnl/lpc/port.c
15 /* INCLUDES *****************************************************************/
19 #include <ddk/ntddk.h>
20 #include <internal/ob.h>
21 #include <internal/port.h>
22 #include <internal/dbg.h>
25 #include <internal/debug.h>
28 /* GLOBALS *******************************************************************/
30 POBJECT_TYPE ExPortType
= NULL
;
31 ULONG EiNextLpcMessageId
= 0;
33 /* FUNCTIONS *****************************************************************/
36 NTSTATUS
NiInitPort (VOID
)
38 ExPortType
= ExAllocatePool(NonPagedPool
,sizeof(OBJECT_TYPE
));
40 RtlInitUnicodeString(&ExPortType
->TypeName
,L
"Port");
42 ExPortType
->MaxObjects
= ULONG_MAX
;
43 ExPortType
->MaxHandles
= ULONG_MAX
;
44 ExPortType
->TotalObjects
= 0;
45 ExPortType
->TotalHandles
= 0;
46 ExPortType
->PagedPoolCharge
= 0;
47 ExPortType
->NonpagedPoolCharge
= sizeof(EPORT
);
48 ExPortType
->Dump
= NULL
;
49 ExPortType
->Open
= NULL
;
50 ExPortType
->Close
= NiClosePort
;
51 ExPortType
->Delete
= NiDeletePort
;
52 ExPortType
->Parse
= NULL
;
53 ExPortType
->Security
= NULL
;
54 ExPortType
->QueryName
= NULL
;
55 ExPortType
->OkayToClose
= NULL
;
56 ExPortType
->Create
= NiCreatePort
;
58 EiNextLpcMessageId
= 0;
60 return(STATUS_SUCCESS
);
64 /**********************************************************************
69 * Initialize the EPORT object attributes. The Port
70 * object enters the inactive state.
73 * Port Pointer to an EPORT object to initialize.
76 * STATUS_SUCCESS if initialization succedeed. An error code
85 memset (Port
, 0, sizeof(EPORT
));
86 KeInitializeSpinLock (& Port
->Lock
);
87 KeInitializeEvent (& Port
->Event
, SynchronizationEvent
, FALSE
);
88 Port
->OtherPort
= NULL
;
89 Port
->QueueLength
= 0;
90 Port
->ConnectQueueLength
= 0;
91 Port
->State
= EPORT_INACTIVE
;
92 InitializeListHead (& Port
->QueueListHead
);
93 InitializeListHead (& Port
->ConnectQueueListHead
);
95 return (STATUS_SUCCESS
);
99 /* MISCELLANEA SYSTEM SERVICES */
102 /**********************************************************************
104 * NtImpersonateClientOfPort@8
117 NtImpersonateClientOfPort (
119 PLPC_MESSAGE ClientMessage