[NTOS:KD] Accept some packet types without KDBG (#7892)

When KDBG isn't included in the kernel (Release build), the fall-back
KdSend/ReceivePacket() routines are invoked by KD64. A minimal handling
of the basic packets needs to be done:
PACKET_TYPE_KD_STATE_CHANGE32/64 for KdSendPacket(),
and PACKET_TYPE_KD_POLL_BREAKIN, PACKET_TYPE_KD_STATE_MANIPULATE
for KdReceivePacket().

Addendum to commit 2046a17ef4
CORE-20107
This commit is contained in:
Serge Gautherie 2025-04-15 08:04:53 +02:00 committed by Hermès Bélusca-Maïto
parent 005f75bd61
commit 0e21c6f3fd
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -609,6 +609,14 @@ KdSendPacket(
if (PacketType != PACKET_TYPE_KD_DEBUG_IO)
{
#ifndef KDBG
if (PacketType == PACKET_TYPE_KD_STATE_CHANGE64)
{
// KdIoPrintf("%s: PacketType %d is ignored without KDBG\n", __FUNCTION__, PacketType);
return;
}
#endif
KdIoPrintf("%s: PacketType %d is UNIMPLEMENTED\n", __FUNCTION__, PacketType);
return;
}
@ -652,8 +660,29 @@ KdReceivePacket(
CHAR MessageBuffer[512];
#endif
#ifndef KDBG
// Polling happens regularly, so check it first.
if (PacketType == PACKET_TYPE_KD_POLL_BREAKIN)
{
// KdIoPrintf("%s: PacketType %d is refused without KDBG\n", __FUNCTION__, PacketType);
return KdPacketTimedOut;
}
#endif
if (PacketType != PACKET_TYPE_KD_DEBUG_IO)
{
#ifndef KDBG
if (PacketType == PACKET_TYPE_KD_STATE_MANIPULATE)
{
PDBGKD_MANIPULATE_STATE64 ManipulateState = (PDBGKD_MANIPULATE_STATE64)MessageHeader->Buffer;
// KdIoPrintf("%s: PacketType %d is ignored without KDBG\n", __FUNCTION__, PacketType);
ManipulateState->ApiNumber = DbgKdContinueApi;
ManipulateState->u.Continue.ContinueStatus = STATUS_SUCCESS;
return KdPacketReceived;
}
#endif
KdIoPrintf("%s: PacketType %d is UNIMPLEMENTED\n", __FUNCTION__, PacketType);
return KdPacketTimedOut;
}