Allocated the message reply buffer according to the size of the message. Modified: trunk/reactos/ntoskrnl/include/internal/port.h Modified: trunk/reactos/ntoskrnl/lpc/reply.c _____
Modified: trunk/reactos/ntoskrnl/include/internal/port.h --- trunk/reactos/ntoskrnl/include/internal/port.h 2005-08-28 09:50:00 UTC (rev 17580) +++ trunk/reactos/ntoskrnl/include/internal/port.h 2005-08-28 11:58:06 UTC (rev 17581) @@ -88,7 +88,6 @@
PEPORT Sender; LIST_ENTRY QueueListEntry; PORT_MESSAGE Message; - UCHAR MessageData[0x130]; /* FIXME: HACK */ } QUEUEDMESSAGE, *PQUEUEDMESSAGE;
typedef struct _LPC_DBG_MESSAGE _____
Modified: trunk/reactos/ntoskrnl/lpc/reply.c --- trunk/reactos/ntoskrnl/lpc/reply.c 2005-08-28 09:50:00 UTC (rev 17580) +++ trunk/reactos/ntoskrnl/lpc/reply.c 2005-08-28 11:58:06 UTC (rev 17581) @@ -37,20 +37,31 @@
{ 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(); MessageReply->Message.ClientId.UniqueThread = PsGetCurrentThreadId();