1 /* $Id: port.c,v 1.4 2001/01/28 17:38:12 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 static GENERIC_MAPPING ExpPortMapping
= {
35 STANDARD_RIGHTS_WRITE
,
39 /* FUNCTIONS *****************************************************************/
42 NTSTATUS
NiInitPort (VOID
)
44 ExPortType
= ExAllocatePool(NonPagedPool
,sizeof(OBJECT_TYPE
));
46 RtlInitUnicodeString(&ExPortType
->TypeName
,L
"Port");
48 ExPortType
->MaxObjects
= ULONG_MAX
;
49 ExPortType
->MaxHandles
= ULONG_MAX
;
50 ExPortType
->TotalObjects
= 0;
51 ExPortType
->TotalHandles
= 0;
52 ExPortType
->PagedPoolCharge
= 0;
53 ExPortType
->NonpagedPoolCharge
= sizeof(EPORT
);
54 ExPortType
->Mapping
= &ExpPortMapping
;
55 ExPortType
->Dump
= NULL
;
56 ExPortType
->Open
= NULL
;
57 ExPortType
->Close
= NiClosePort
;
58 ExPortType
->Delete
= NiDeletePort
;
59 ExPortType
->Parse
= NULL
;
60 ExPortType
->Security
= NULL
;
61 ExPortType
->QueryName
= NULL
;
62 ExPortType
->OkayToClose
= NULL
;
63 ExPortType
->Create
= NiCreatePort
;
65 EiNextLpcMessageId
= 0;
67 return(STATUS_SUCCESS
);
71 /**********************************************************************
76 * Initialize the EPORT object attributes. The Port
77 * object enters the inactive state.
80 * Port Pointer to an EPORT object to initialize.
83 * STATUS_SUCCESS if initialization succedeed. An error code
92 memset (Port
, 0, sizeof(EPORT
));
93 KeInitializeSpinLock (& Port
->Lock
);
94 KeInitializeEvent (& Port
->Event
, SynchronizationEvent
, FALSE
);
95 Port
->OtherPort
= NULL
;
96 Port
->QueueLength
= 0;
97 Port
->ConnectQueueLength
= 0;
98 Port
->State
= EPORT_INACTIVE
;
99 InitializeListHead (& Port
->QueueListHead
);
100 InitializeListHead (& Port
->ConnectQueueListHead
);
102 return (STATUS_SUCCESS
);
106 /* MISCELLANEA SYSTEM SERVICES */
109 /**********************************************************************
111 * NtImpersonateClientOfPort@8
124 NtImpersonateClientOfPort (
126 PLPC_MESSAGE ClientMessage