Allocated the message reply buffer according to the size of the message.
authorHartmut Birr <osexpert@googlemail.com>
Sun, 28 Aug 2005 11:58:06 +0000 (11:58 +0000)
committerHartmut Birr <osexpert@googlemail.com>
Sun, 28 Aug 2005 11:58:06 +0000 (11:58 +0000)
svn path=/trunk/; revision=17581

reactos/ntoskrnl/include/internal/port.h
reactos/ntoskrnl/lpc/reply.c

index 9e2c51d..a859eff 100644 (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
index 7ebda68..ae42bb2 100644 (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();