Author: tkreuzer
Date: Mon Oct 26 13:09:05 2009
New Revision: 43776
URL:
http://svn.reactos.org/svn/reactos?rev=43776&view=rev
Log:
[KDCOM]
- take the MessageHeader length from MaximumLength field instead of depending on the
packet type
- Context -> KdContext
- remove redundant return
Modified:
branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.c
Modified: branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/drive…
==============================================================================
--- branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.c [iso-8859-1] Mon Oct 26
13:09:05 2009
@@ -162,7 +162,7 @@
/* Step 3 - Read ByteCount */
KdStatus = KdpReceiveBuffer(&Packet.ByteCount, sizeof(USHORT));
- if (KdStatus != KDP_PACKET_RECEIVED || Packet.ByteCount > PACKET_MAX_SIZE)
+ if (KdStatus != KDP_PACKET_RECEIVED)
{
/* Didn't receive ByteCount or it's too big. Start over. */
continue;
@@ -237,29 +237,11 @@
}
/* Get size of the message header */
- switch (Packet.PacketType)
- {
- case PACKET_TYPE_KD_STATE_CHANGE64:
- MessageHeader->Length = sizeof(DBGKD_WAIT_STATE_CHANGE64);
- break;
-
- case PACKET_TYPE_KD_STATE_MANIPULATE:
- MessageHeader->Length = sizeof(DBGKD_MANIPULATE_STATE64);
- break;
-
- case PACKET_TYPE_KD_DEBUG_IO:
- MessageHeader->Length = sizeof(DBGKD_DEBUG_IO);
- break;
-
- default:
- KDDBGPRINT("KdReceivePacket - unknown PacketType\n");
- return KDP_PACKET_RESEND;
- }
-
- //KDDBGPRINT("KdReceivePacket - got normal PacketType\n");
-
- /* Packet smaller than expected? */
- if (MessageHeader->Length > Packet.ByteCount)
+ MessageHeader->Length = MessageHeader->MaximumLength;
+
+ /* Packet smaller than expected or too big? */
+ if (Packet.ByteCount < MessageHeader->Length ||
+ Packet.ByteCount > PACKET_MAX_SIZE)
{
KDDBGPRINT("KdReceivePacket - too few data (%d) for type %d\n",
Packet.ByteCount, MessageHeader->Length);
@@ -369,7 +351,7 @@
IN ULONG PacketType,
IN PSTRING MessageHeader,
IN PSTRING MessageData,
- IN OUT PKD_CONTEXT Context)
+ IN OUT PKD_CONTEXT KdContext)
{
KD_PACKET Packet;
KDP_STATUS KdStatus;
@@ -390,7 +372,7 @@
MessageData->Length);
}
- Retries = Context->KdpDefaultRetries;
+ Retries = KdContext->KdpDefaultRetries;
do
{
@@ -417,7 +399,7 @@
NULL,
NULL,
0,
- Context);
+ KdContext);
/* Did we succeed? */
if (KdStatus == KDP_PACKET_RECEIVED)
@@ -441,7 +423,5 @@
/* Packet timed out, send it again */
}
while (Retries > 0);
-
- return;
-}
-
+}
+