[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ros-diffs
Subject:    [ros-diffs] [hbirr] 17581: Allocated the message reply buffer
From:       <hbirr () svn ! reactos ! com>
Date:       2005-08-28 11:58:12
Message-ID: 000001c5abc7$c3b35a80$6b01a8c0 () PENELOPE
[Download RAW message or body]

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();

[Attachment #3 (text/html)]

<html>
<head>
<style>
<!--
body { background-color:#ffffff }
.file { border:1px solid #eeeeee; margin-top:1em; margin-bottom:1em }
.pathname { font-family:monospace; float:right }
.fileheader { margin-bottom:.5em }
.diff { margin:0 }
.tasklist { padding:4px; border:1px dashed #000000; margin-top:1em }
.tasklist ul { margin-top:0; margin-bottom:0 }
tr.alt { background-color:#eeeeee }
#added { background-color:#ddffdd }
#addedchars { background-color:#99ff99; font-weight:bolder }
tr.alt #added { background-color:#ccf7cc }
#removed { background-color:#ffdddd }
#removedchars { background-color:#ff9999; font-weight:bolder }
tr.alt #removed { background-color:#f7cccc }
#info { color:#888888 }
#context { background-color:#eeeeee }
td {padding-left:.3em; padding-right:.3em }
tr.head { border-bottom-width:1px; border-bottom-style:solid }
tr.head td { padding:0; padding-top:.2em }
.task { background-color:#ffff00 }
.comment { padding:4px; border:1px dashed #000000; background-color:#ffffdd }
.error { color:red }
hr { border-width:0px; height:2px; background:black }
-->
</style>
</head>
<body>
<pre class="comment">Allocated the message reply buffer according to the size of the \
message.</pre><pre class="diff" id="context">Modified: \
                trunk/reactos/ntoskrnl/include/internal/port.h
Modified: trunk/reactos/ntoskrnl/lpc/reply.c
</pre><hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/ntoskrnl/include/internal/port.h</b></big></div> <pre \
class="diff"><small id="info">--- \
                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 @@
</small></pre><pre class="diff" id="context"> &nbsp; PEPORT		Sender;
 &nbsp; LIST_ENTRY	QueueListEntry;
 &nbsp; PORT_MESSAGE	Message;
</pre><pre class="diff" id="removed">- &nbsp;UCHAR &nbsp; &nbsp; &nbsp; &nbsp; \
MessageData[0x130]; /* FIXME: HACK */ </pre><pre class="diff" id="context"> } \
QUEUEDMESSAGE, &nbsp;*PQUEUEDMESSAGE;  
 typedef struct _LPC_DBG_MESSAGE
</pre></div>
<hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/ntoskrnl/lpc/reply.c</b></big></div> <pre class="diff"><small \
                id="info">--- 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 @@
</small></pre><pre class="diff" id="context"> {
 &nbsp; &nbsp;KIRQL oldIrql;
 &nbsp; &nbsp;PQUEUEDMESSAGE MessageReply;
</pre><pre class="diff" id="added">+ &nbsp; ULONG Size;
</pre><pre class="diff" id="context"> 
 &nbsp; &nbsp;if (Port == NULL)
 &nbsp; &nbsp; &nbsp;{
 &nbsp; &nbsp; &nbsp; &nbsp;KEBUGCHECK(0);
 &nbsp; &nbsp; &nbsp;}
 
</pre><pre class="diff" id="removed">- &nbsp; <span id="removedchars">MessageReply = \
ExAllocatePoolWithTag(NonPagedPool, sizeof(QUEUEDMESSAGE),</span> </pre><pre \
class="diff" id="added">+ &nbsp; <span id="addedchars">Size = \
sizeof(QUEUEDMESSAGE);</span> + &nbsp; if (LpcReply &amp;&amp; \
LpcReply-&gt;u1.s1.TotalLength &gt; sizeof(PORT_MESSAGE)) + &nbsp; &nbsp; {
+ &nbsp; &nbsp; &nbsp; Size += LpcReply-&gt;u1.s1.TotalLength - sizeof(PORT_MESSAGE);
+ &nbsp; &nbsp; }
+ &nbsp; MessageReply = ExAllocatePoolWithTag(NonPagedPool, Size, 
</pre><pre class="diff" id="context"> 					TAG_LPC_MESSAGE);
 &nbsp; &nbsp;MessageReply-&gt;Sender = Sender;
 
 &nbsp; &nbsp;if (LpcReply != NULL)
 &nbsp; &nbsp; &nbsp;{
</pre><pre class="diff" id="removed">-<span \
id="removedchars">	</span>memcpy(&amp;MessageReply-&gt;Message, LpcReply, \
LpcReply-&gt;u1.s1.TotalLength); </pre><pre class="diff" id="added">+<span \
id="addedchars"> &nbsp; &nbsp; &nbsp; </span>memcpy(&amp;MessageReply-&gt;Message, \
LpcReply, LpcReply-&gt;u1.s1.TotalLength); </pre><pre class="diff" id="context"> \
&nbsp; &nbsp; &nbsp;} </pre><pre class="diff" id="added">+ &nbsp; else
+ &nbsp; &nbsp; {
+ &nbsp; &nbsp; &nbsp; MessageReply-&gt;Message.u1.s1.TotalLength = \
sizeof(PORT_MESSAGE); + &nbsp; &nbsp; &nbsp; \
MessageReply-&gt;Message.u1.s1.DataLength = 0; + &nbsp; &nbsp; }
</pre><pre class="diff" id="context"> 
 &nbsp; &nbsp;MessageReply-&gt;Message.ClientId.UniqueProcess = \
PsGetCurrentProcessId();  &nbsp; &nbsp;MessageReply-&gt;Message.ClientId.UniqueThread \
= PsGetCurrentThreadId(); </pre>
</div>

</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic