Use macros for LPC message limits in current LPC implementation.

svn path=/trunk/; revision=7967
This commit is contained in:
Emanuele Aliberti 2004-02-01 18:19:28 +00:00
parent 04aba507f3
commit 8443a77631
2 changed files with 63 additions and 30 deletions

View file

@ -1,4 +1,4 @@
/* $Id: connect.c,v 1.23 2004/01/22 21:56:48 ea Exp $ /* $Id: connect.c,v 1.24 2004/02/01 18:19:28 ea Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -29,6 +29,16 @@
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
/**********************************************************************
* NAME EXPORTED
* EiConnectPort/12
*
* DESCRIPTION
*
* ARGUMENTS
*
* RETURN VALUE
*/
NTSTATUS STDCALL NTSTATUS STDCALL
EiConnectPort(IN PEPORT* ConnectedPort, EiConnectPort(IN PEPORT* ConnectedPort,
IN PEPORT NamedPort, IN PEPORT NamedPort,
@ -219,11 +229,11 @@ EiConnectPort(IN PEPORT* ConnectedPort,
/********************************************************************** /**********************************************************************
* NAME EXPORTED * NAME EXPORTED
* NtConnectPort@32 * NtConnectPort/8
* *
* DESCRIPTION * DESCRIPTION
* Connect to a named port and wait for the other side to * Connect to a named port and wait for the other side to
* accept the connection. * accept or reject the connection request.
* *
* ARGUMENTS * ARGUMENTS
* ConnectedPort * ConnectedPort
@ -500,7 +510,7 @@ NtConnectPort (PHANDLE UnsafeConnectedPortHandle,
/********************************************************************** /**********************************************************************
* NAME EXPORTED * NAME EXPORTED
* NtAcceptConnectPort@24 * NtAcceptConnectPort/6
* *
* DESCRIPTION * DESCRIPTION
* *
@ -732,7 +742,7 @@ NtAcceptConnectPort (PHANDLE ServerPortHandle,
{ {
CReply->ReceiveClientViewBase = WriteMap->TargetViewBase; CReply->ReceiveClientViewBase = WriteMap->TargetViewBase;
} }
CReply->MaximumMessageSize = 0x148; CReply->MaximumMessageSize = PORT_MAX_MESSAGE_LENGTH;
/* /*
@ -787,7 +797,7 @@ NtSecureConnectPort (OUT PHANDLE ConnectedPort,
IN OUT PVOID ConnectInfo OPTIONAL, IN OUT PVOID ConnectInfo OPTIONAL,
IN OUT PULONG UserConnectInfoLength OPTIONAL) IN OUT PULONG UserConnectInfoLength OPTIONAL)
{ {
/* TODO: implement a new object type: SecurePort */ /* TODO: implement a new object type: WaitablePort */
/* TODO: verify the process' SID that hosts the rendez-vous port equals ServerSid */ /* TODO: verify the process' SID that hosts the rendez-vous port equals ServerSid */
return NtConnectPort (ConnectedPort, return NtConnectPort (ConnectedPort,
PortName, PortName,

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.14 2003/12/30 18:52:05 fireball Exp $ /* $Id: create.c,v 1.15 2004/02/01 18:19:28 ea Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -19,12 +19,24 @@
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/**********************************************************************
* NAME
* LpcpVerifyCreateParameters/5
*
* DESCRIPTION
* Verify user parameters in NtCreatePort and in
* NtCreateWaitablePort.
*
* ARGUMENTS
*
* RETURN VALUE
*/
STATIC NTSTATUS STDCALL STATIC NTSTATUS STDCALL
VerifyCreateParameters (IN PHANDLE PortHandle, LpcpVerifyCreateParameters (IN PHANDLE PortHandle,
IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_ATTRIBUTES ObjectAttributes,
IN ULONG MaxConnectInfoLength, IN ULONG MaxConnectInfoLength,
IN ULONG MaxDataLength, IN ULONG MaxDataLength,
IN ULONG Reserved) IN ULONG Reserved)
{ {
if (NULL == PortHandle) if (NULL == PortHandle)
{ {
@ -42,19 +54,30 @@ VerifyCreateParameters (IN PHANDLE PortHandle,
{ {
return (STATUS_INVALID_PORT_ATTRIBUTES); return (STATUS_INVALID_PORT_ATTRIBUTES);
} }
if (MaxConnectInfoLength > 0x104) /* FIXME: use a macro! */ if (MaxConnectInfoLength > PORT_MAX_DATA_LENGTH)
{ {
return (STATUS_INVALID_PARAMETER_3); return (STATUS_INVALID_PARAMETER_3);
} }
if (MaxDataLength > 0x148) /* FIXME: use a macro! */ if (MaxDataLength > PORT_MAX_MESSAGE_LENGTH)
{ {
return (STATUS_INVALID_PARAMETER_4); return (STATUS_INVALID_PARAMETER_4);
} }
/* FIXME: some checking is done also on Reserved */ /* FIXME: some checking is done also on Reserved, but
* not in public (free/checked) versions. */
return (STATUS_SUCCESS); return (STATUS_SUCCESS);
} }
/**********************************************************************
* NAME
* NiCreatePort/4
*
* DESCRIPTION
*
* ARGUMENTS
*
* RETURN VALUE
*/
NTSTATUS STDCALL NTSTATUS STDCALL
NiCreatePort (PVOID ObjectBody, NiCreatePort (PVOID ObjectBody,
PVOID Parent, PVOID Parent,
@ -77,7 +100,7 @@ NiCreatePort (PVOID ObjectBody,
/********************************************************************** /**********************************************************************
* NAME EXPORTED * NAME EXPORTED
* NtCreatePort@20 * NtCreatePort/5
* *
* DESCRIPTION * DESCRIPTION
* *
@ -103,12 +126,12 @@ NtCreatePort (PHANDLE PortHandle,
DPRINT("NtCreatePort() Name %x\n", ObjectAttributes->ObjectName->Buffer); DPRINT("NtCreatePort() Name %x\n", ObjectAttributes->ObjectName->Buffer);
/* Verify parameters */ /* Verify parameters */
Status = VerifyCreateParameters (PortHandle, Status = LpcpVerifyCreateParameters (PortHandle,
ObjectAttributes, ObjectAttributes,
MaxConnectInfoLength, MaxConnectInfoLength,
MaxDataLength, MaxDataLength,
Reserved); Reserved);
if (!NT_SUCCESS(Status)) if (STATUS_SUCCESS != Status)
{ {
return (Status); return (Status);
} }
@ -141,8 +164,8 @@ NtCreatePort (PHANDLE PortHandle,
} }
Status = NiInitializePort (Port); Status = NiInitializePort (Port);
Port->MaxConnectInfoLength = 260; /* FIXME: use a macro! */ Port->MaxConnectInfoLength = PORT_MAX_DATA_LENGTH;
Port->MaxDataLength = 328; /* FIXME: use a macro! */ Port->MaxDataLength = PORT_MAX_MESSAGE_LENGTH;
ObDereferenceObject (Port); ObDereferenceObject (Port);
@ -151,7 +174,7 @@ NtCreatePort (PHANDLE PortHandle,
/********************************************************************** /**********************************************************************
* NAME EXPORTED * NAME EXPORTED
* NtCreateWaitablePort@20 * NtCreateWaitablePort/5
* *
* DESCRIPTION * DESCRIPTION
* Waitable ports can be connected to with NtSecureConnectPort. * Waitable ports can be connected to with NtSecureConnectPort.
@ -178,11 +201,11 @@ NtCreateWaitablePort (OUT PHANDLE PortHandle,
NTSTATUS Status; NTSTATUS Status;
/* Verify parameters */ /* Verify parameters */
Status = VerifyCreateParameters (PortHandle, Status = LpcpVerifyCreateParameters (PortHandle,
ObjectAttributes, ObjectAttributes,
MaxConnectInfoLength, MaxConnectInfoLength,
MaxDataLength, MaxDataLength,
Reserved); Reserved);
if (STATUS_SUCCESS != Status) if (STATUS_SUCCESS != Status)
{ {
return (Status); return (Status);