3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/lpc/port.c
6 * PURPOSE: Communication mechanism
8 * PROGRAMMERS: David Welch (welch@cwcom.net)
11 /* INCLUDES *****************************************************************/
15 #include <internal/debug.h>
17 #if defined (ALLOC_PRAGMA)
18 #pragma alloc_text(INIT, LpcpInitSystem)
22 /* GLOBALS *******************************************************************/
24 POBJECT_TYPE LpcPortObjectType
= 0;
25 ULONG LpcpNextMessageId
= 0; /* 0 is not a valid ID */
26 FAST_MUTEX LpcpLock
; /* global internal sync in LPC facility */
28 static GENERIC_MAPPING LpcpPortMapping
=
31 STANDARD_RIGHTS_WRITE
,
36 /* FUNCTIONS *****************************************************************/
44 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer
;
47 DPRINT("Creating Port Object Type\n");
49 /* Create the Port Object Type */
50 RtlZeroMemory(&ObjectTypeInitializer
, sizeof(ObjectTypeInitializer
));
51 RtlInitUnicodeString(&Name
, L
"Port");
52 ObjectTypeInitializer
.Length
= sizeof(ObjectTypeInitializer
);
53 ObjectTypeInitializer
.DefaultNonPagedPoolCharge
= sizeof(EPORT
);
54 ObjectTypeInitializer
.GenericMapping
= LpcpPortMapping
;
55 ObjectTypeInitializer
.PoolType
= NonPagedPool
;
56 ObjectTypeInitializer
.UseDefaultObject
= TRUE
;
57 ObjectTypeInitializer
.CloseProcedure
= LpcpClosePort
;
58 ObjectTypeInitializer
.DeleteProcedure
= LpcpDeletePort
;
59 ObpCreateTypeObject(&ObjectTypeInitializer
, &Name
, &LpcPortObjectType
);
61 LpcpNextMessageId
= 0;
62 ExInitializeFastMutex (& LpcpLock
);
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.
78 * Type connect (RQST), or communication port (COMM)
79 * Parent OPTIONAL connect port a communication port
83 * STATUS_SUCCESS if initialization succedeed. An error code
87 LpcpInitializePort (IN OUT PEPORT Port
,
89 IN PEPORT Parent OPTIONAL
)
91 if ((Type
!= EPORT_TYPE_SERVER_RQST_PORT
) &&
92 (Type
!= EPORT_TYPE_SERVER_COMM_PORT
) &&
93 (Type
!= EPORT_TYPE_CLIENT_COMM_PORT
))
95 return STATUS_INVALID_PARAMETER_2
;
97 memset (Port
, 0, sizeof(EPORT
));
98 KeInitializeSpinLock (& Port
->Lock
);
99 KeInitializeSemaphore( &Port
->Semaphore
, 0, MAXLONG
);
100 Port
->RequestPort
= Parent
;
101 Port
->OtherPort
= NULL
;
102 Port
->QueueLength
= 0;
103 Port
->ConnectQueueLength
= 0;
105 Port
->State
= EPORT_INACTIVE
;
106 InitializeListHead (& Port
->QueueListHead
);
107 InitializeListHead (& Port
->ConnectQueueListHead
);
109 return (STATUS_SUCCESS
);
113 /* MISCELLANEA SYSTEM SERVICES */
116 /**********************************************************************
118 * NtImpersonateClientOfPort/2
129 NtImpersonateClientOfPort (HANDLE PortHandle
,
130 PPORT_MESSAGE ClientMessage
)
133 return(STATUS_NOT_IMPLEMENTED
);