1 /* $Id: port.c,v 1.5 2001/03/07 16:48:43 dwelch 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>
23 #include <internal/pool.h>
26 #include <internal/debug.h>
29 /* GLOBALS *******************************************************************/
31 POBJECT_TYPE ExPortType
= NULL
;
32 ULONG EiNextLpcMessageId
= 0;
34 static GENERIC_MAPPING ExpPortMapping
= {
36 STANDARD_RIGHTS_WRITE
,
40 /* FUNCTIONS *****************************************************************/
43 NTSTATUS
NiInitPort (VOID
)
45 ExPortType
= ExAllocatePool(NonPagedPool
,sizeof(OBJECT_TYPE
));
47 RtlInitUnicodeString(&ExPortType
->TypeName
,L
"Port");
49 ExPortType
->Tag
= TAG('L', 'P', 'R', 'T');
50 ExPortType
->MaxObjects
= ULONG_MAX
;
51 ExPortType
->MaxHandles
= ULONG_MAX
;
52 ExPortType
->TotalObjects
= 0;
53 ExPortType
->TotalHandles
= 0;
54 ExPortType
->PagedPoolCharge
= 0;
55 ExPortType
->NonpagedPoolCharge
= sizeof(EPORT
);
56 ExPortType
->Mapping
= &ExpPortMapping
;
57 ExPortType
->Dump
= NULL
;
58 ExPortType
->Open
= NULL
;
59 ExPortType
->Close
= NiClosePort
;
60 ExPortType
->Delete
= NiDeletePort
;
61 ExPortType
->Parse
= NULL
;
62 ExPortType
->Security
= NULL
;
63 ExPortType
->QueryName
= NULL
;
64 ExPortType
->OkayToClose
= NULL
;
65 ExPortType
->Create
= NiCreatePort
;
67 EiNextLpcMessageId
= 0;
69 return(STATUS_SUCCESS
);
73 /**********************************************************************
78 * Initialize the EPORT object attributes. The Port
79 * object enters the inactive state.
82 * Port Pointer to an EPORT object to initialize.
85 * STATUS_SUCCESS if initialization succedeed. An error code
94 memset (Port
, 0, sizeof(EPORT
));
95 KeInitializeSpinLock (& Port
->Lock
);
96 KeInitializeEvent (& Port
->Event
, SynchronizationEvent
, FALSE
);
97 Port
->OtherPort
= NULL
;
98 Port
->QueueLength
= 0;
99 Port
->ConnectQueueLength
= 0;
100 Port
->State
= EPORT_INACTIVE
;
101 InitializeListHead (& Port
->QueueListHead
);
102 InitializeListHead (& Port
->ConnectQueueListHead
);
104 return (STATUS_SUCCESS
);
108 /* MISCELLANEA SYSTEM SERVICES */
111 /**********************************************************************
113 * NtImpersonateClientOfPort@8
126 NtImpersonateClientOfPort (
128 PLPC_MESSAGE ClientMessage