1 /* $Id: port.c,v 1.10 2002/09/07 15:12:58 chorns 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 *****************************************************************/
20 #include <internal/debug.h>
23 /* GLOBALS *******************************************************************/
25 POBJECT_TYPE ExPortType
= NULL
;
26 ULONG EiNextLpcMessageId
= 0;
28 static GENERIC_MAPPING ExpPortMapping
= {
30 STANDARD_RIGHTS_WRITE
,
34 /* FUNCTIONS *****************************************************************/
37 NTSTATUS
NiInitPort (VOID
)
39 ExPortType
= ExAllocatePool(NonPagedPool
,sizeof(OBJECT_TYPE
));
41 RtlInitUnicodeStringFromLiteral(&ExPortType
->TypeName
,L
"Port");
43 ExPortType
->Tag
= TAG('L', 'P', 'R', 'T');
44 ExPortType
->MaxObjects
= ULONG_MAX
;
45 ExPortType
->MaxHandles
= ULONG_MAX
;
46 ExPortType
->TotalObjects
= 0;
47 ExPortType
->TotalHandles
= 0;
48 ExPortType
->PagedPoolCharge
= 0;
49 ExPortType
->NonpagedPoolCharge
= sizeof(EPORT
);
50 ExPortType
->Mapping
= &ExpPortMapping
;
51 ExPortType
->Dump
= NULL
;
52 ExPortType
->Open
= NULL
;
53 ExPortType
->Close
= NiClosePort
;
54 ExPortType
->Delete
= NiDeletePort
;
55 ExPortType
->Parse
= NULL
;
56 ExPortType
->Security
= NULL
;
57 ExPortType
->QueryName
= NULL
;
58 ExPortType
->OkayToClose
= NULL
;
59 ExPortType
->Create
= NiCreatePort
;
60 ExPortType
->DuplicationNotify
= NULL
;
62 EiNextLpcMessageId
= 0;
64 return(STATUS_SUCCESS
);
68 /**********************************************************************
73 * Initialize the EPORT object attributes. The Port
74 * object enters the inactive state.
77 * Port Pointer to an EPORT object to initialize.
80 * STATUS_SUCCESS if initialization succedeed. An error code
84 NiInitializePort (IN OUT PEPORT Port
)
86 memset (Port
, 0, sizeof(EPORT
));
87 KeInitializeSpinLock (& Port
->Lock
);
88 KeInitializeSemaphore( &Port
->Semaphore
, 0, LONG_MAX
);
89 Port
->OtherPort
= NULL
;
90 Port
->QueueLength
= 0;
91 Port
->ConnectQueueLength
= 0;
92 Port
->State
= EPORT_INACTIVE
;
93 InitializeListHead (& Port
->QueueListHead
);
94 InitializeListHead (& Port
->ConnectQueueListHead
);
96 return (STATUS_SUCCESS
);
100 /* MISCELLANEA SYSTEM SERVICES */
103 /**********************************************************************
105 * NtImpersonateClientOfPort@8
117 NtImpersonateClientOfPort (HANDLE PortHandle
,
118 PLPC_MESSAGE ClientMessage
)