diff --git a/reactos/ntoskrnl/include/internal/ob.h b/reactos/ntoskrnl/include/internal/ob.h index 00783969cd2..ed02c4423a3 100644 --- a/reactos/ntoskrnl/include/internal/ob.h +++ b/reactos/ntoskrnl/include/internal/ob.h @@ -12,6 +12,8 @@ #define NTOS_MODE_KERNEL #include +#define TAG_OBJECT_TYPE TAG('O', 'b', 'j', 'T') + struct _EPROCESS; typedef struct diff --git a/reactos/ntoskrnl/include/internal/port.h b/reactos/ntoskrnl/include/internal/port.h index a857ef7adc9..a7a7652bef4 100644 --- a/reactos/ntoskrnl/include/internal/port.h +++ b/reactos/ntoskrnl/include/internal/port.h @@ -26,11 +26,7 @@ typedef struct _EPORT ULONG MaxDataLength; ULONG MaxConnectInfoLength; - - /* - * List of processes that can receive connection requests on this port. - */ - LIST_ENTRY ListenerListHead; + ULONG MaxPoolUsage; /* size of NP zone */ } EPORT, * PEPORT; @@ -88,6 +84,12 @@ LpcSendTerminationPort (PEPORT Port, #define EPORT_CONNECTED_SERVER (6) #define EPORT_DISCONNECTED (7) +/* Pool Tags */ + +#define TAG_LPC_MESSAGE TAG('L', 'p', 'c', 'M') +#define TAG_LPC_ZONE TAG('L', 'p', 'c', 'Z') + + typedef struct _QUEUEDMESSAGE { PEPORT Sender; @@ -139,7 +141,8 @@ NTSTATUS NiInitPort (VOID); extern POBJECT_TYPE ExPortType; -extern ULONG EiNextLpcMessageId; +extern ULONG LpcpNextMessageId; +extern FAST_MUTEX LpcpLock; /* Code in ntoskrnl/lpc/reply.c */ diff --git a/reactos/ntoskrnl/lpc/create.c b/reactos/ntoskrnl/lpc/create.c index 7affe94b90e..1e3b024de42 100644 --- a/reactos/ntoskrnl/lpc/create.c +++ b/reactos/ntoskrnl/lpc/create.c @@ -1,4 +1,4 @@ -/* $Id: create.c,v 1.17 2004/08/15 16:39:06 chorns Exp $ +/* $Id: create.c,v 1.18 2004/10/31 20:27:08 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -32,7 +32,7 @@ LpcpVerifyCreateParameters (IN PHANDLE PortHandle, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG MaxConnectInfoLength, IN ULONG MaxDataLength, - IN ULONG Reserved) + IN ULONG MaxPoolUsage) { if (NULL == PortHandle) { @@ -58,8 +58,8 @@ LpcpVerifyCreateParameters (IN PHANDLE PortHandle, { return (STATUS_INVALID_PARAMETER_4); } - /* FIXME: some checking is done also on Reserved, but - * not in public (free/checked) versions. */ + /* TODO: some checking is done also on MaxPoolUsage + * to avoid choking the executive */ return (STATUS_SUCCESS); } @@ -105,7 +105,7 @@ NiCreatePort (PVOID ObjectBody, * ObjectAttributes, * MaxConnectInfoLength, * MaxDataLength, - * Reserved + * MaxPoolUsage: size of NP zone the NP part of msgs is kept in * * RETURN VALUE */ @@ -114,7 +114,7 @@ NtCreatePort (PHANDLE PortHandle, POBJECT_ATTRIBUTES ObjectAttributes, ULONG MaxConnectInfoLength, ULONG MaxDataLength, - ULONG Reserved) + ULONG MaxPoolUsage) { PEPORT Port; NTSTATUS Status; @@ -126,7 +126,7 @@ NtCreatePort (PHANDLE PortHandle, ObjectAttributes, MaxConnectInfoLength, MaxDataLength, - Reserved); + MaxPoolUsage); if (STATUS_SUCCESS != Status) { return (Status); @@ -162,6 +162,7 @@ NtCreatePort (PHANDLE PortHandle, Status = NiInitializePort (Port, EPORT_TYPE_SERVER_RQST_PORT, NULL); Port->MaxConnectInfoLength = PORT_MAX_DATA_LENGTH; Port->MaxDataLength = PORT_MAX_MESSAGE_LENGTH; + Port->MaxPoolUsage = MaxPoolUsage; ObDereferenceObject (Port); @@ -183,7 +184,7 @@ NtCreatePort (PHANDLE PortHandle, * ObjectAttributes, * MaxConnectInfoLength, * MaxDataLength, - * Reserved + * MaxPoolUsage * * RETURN VALUE */ @@ -192,7 +193,7 @@ NtCreateWaitablePort (OUT PHANDLE PortHandle, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG MaxConnectInfoLength, IN ULONG MaxDataLength, - IN ULONG Reserved) + IN ULONG MaxPoolUsage) { NTSTATUS Status; @@ -201,7 +202,7 @@ NtCreateWaitablePort (OUT PHANDLE PortHandle, ObjectAttributes, MaxConnectInfoLength, MaxDataLength, - Reserved); + MaxPoolUsage); if (STATUS_SUCCESS != Status) { return (Status); diff --git a/reactos/ntoskrnl/lpc/port.c b/reactos/ntoskrnl/lpc/port.c index 0ac5f3d8eba..2b8a283b863 100644 --- a/reactos/ntoskrnl/lpc/port.c +++ b/reactos/ntoskrnl/lpc/port.c @@ -1,4 +1,4 @@ -/* $Id: port.c,v 1.19 2004/08/15 16:39:06 chorns Exp $ +/* $Id: port.c,v 1.20 2004/10/31 20:27:08 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -22,7 +22,8 @@ /* GLOBALS *******************************************************************/ POBJECT_TYPE ExPortType = NULL; -ULONG EiNextLpcMessageId = 0; +ULONG LpcpNextMessageId = 0; /* 0 is not a valid ID */ +FAST_MUTEX LpcpLock; /* global internal sync in LPC facility */ static GENERIC_MAPPING ExpPortMapping = { STANDARD_RIGHTS_READ, @@ -36,7 +37,7 @@ static GENERIC_MAPPING ExpPortMapping = { NTSTATUS INIT_FUNCTION NiInitPort (VOID) { - ExPortType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE)); + ExPortType = ExAllocatePoolWithTag(NonPagedPool,sizeof(OBJECT_TYPE),TAG_OBJECT_TYPE); RtlRosInitUnicodeStringFromLiteral(&ExPortType->TypeName,L"Port"); @@ -61,7 +62,9 @@ NiInitPort (VOID) ObpCreateTypeObject(ExPortType); - EiNextLpcMessageId = 0; + LpcpNextMessageId = 0; + + ExInitializeFastMutex (& LpcpLock); return(STATUS_SUCCESS); } @@ -77,6 +80,9 @@ NiInitPort (VOID) * * ARGUMENTS * Port Pointer to an EPORT object to initialize. + * Type connect (RQST), or communication port (COMM) + * Parent OPTIONAL connect port a communication port + * is created from * * RETURN VALUE * STATUS_SUCCESS if initialization succedeed. An error code diff --git a/reactos/ntoskrnl/lpc/reply.c b/reactos/ntoskrnl/lpc/reply.c index b45a6de7a15..abfdf5c6383 100644 --- a/reactos/ntoskrnl/lpc/reply.c +++ b/reactos/ntoskrnl/lpc/reply.c @@ -1,4 +1,4 @@ -/* $Id: reply.c,v 1.22 2004/09/13 19:10:45 gvg Exp $ +/* $Id: reply.c,v 1.23 2004/10/31 20:27:08 ea Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -17,8 +17,6 @@ /* GLOBALS *******************************************************************/ -#define TAG_LPC_MESSAGE TAG('L', 'P', 'C', 'M') - /* FUNCTIONS *****************************************************************/ /********************************************************************** @@ -58,7 +56,7 @@ EiReplyOrRequestPort (IN PEPORT Port, MessageReply->Message.ClientId.UniqueProcess = PsGetCurrentProcessId(); MessageReply->Message.ClientId.UniqueThread = PsGetCurrentThreadId(); MessageReply->Message.MessageType = MessageType; - MessageReply->Message.MessageId = InterlockedIncrement((LONG *)&EiNextLpcMessageId); + MessageReply->Message.MessageId = InterlockedIncrement((LONG *)&LpcpNextMessageId); KeAcquireSpinLock(&Port->Lock, &oldIrql); EiEnqueueMessagePort(Port, MessageReply);