Allocated the message reply buffer according to the size of the message.

svn path=/trunk/; revision=17581
This commit is contained in:
Hartmut Birr 2005-08-28 11:58:06 +00:00
parent b5fbf00480
commit 37dced9725
2 changed files with 13 additions and 3 deletions

View file

@ -88,7 +88,6 @@ typedef struct _QUEUEDMESSAGE
PEPORT Sender;
LIST_ENTRY QueueListEntry;
PORT_MESSAGE Message;
UCHAR MessageData[0x130]; /* FIXME: HACK */
} QUEUEDMESSAGE, *PQUEUEDMESSAGE;
typedef struct _LPC_DBG_MESSAGE

View file

@ -37,19 +37,30 @@ EiReplyOrRequestPort (IN PEPORT Port,
{
KIRQL oldIrql;
PQUEUEDMESSAGE MessageReply;
ULONG Size;
if (Port == NULL)
{
KEBUGCHECK(0);
}
MessageReply = ExAllocatePoolWithTag(NonPagedPool, sizeof(QUEUEDMESSAGE),
Size = sizeof(QUEUEDMESSAGE);
if (LpcReply && LpcReply->u1.s1.TotalLength > sizeof(PORT_MESSAGE))
{
Size += LpcReply->u1.s1.TotalLength - sizeof(PORT_MESSAGE);
}
MessageReply = ExAllocatePoolWithTag(NonPagedPool, Size,
TAG_LPC_MESSAGE);
MessageReply->Sender = Sender;
if (LpcReply != NULL)
{
memcpy(&MessageReply->Message, LpcReply, LpcReply->u1.s1.TotalLength);
memcpy(&MessageReply->Message, LpcReply, LpcReply->u1.s1.TotalLength);
}
else
{
MessageReply->Message.u1.s1.TotalLength = sizeof(PORT_MESSAGE);
MessageReply->Message.u1.s1.DataLength = 0;
}
MessageReply->Message.ClientId.UniqueProcess = PsGetCurrentProcessId();