38 Checksum += (
ULONG)*ByteBuffer++;
52 Packet.PacketId = PacketId;
55 Packet.PacketType = PacketType;
107 KdContext->KdpControlCPending =
TRUE;
162 switch (
Packet.PacketType)
177 KDDBGPRINT(
"KdReceivePacket - got PACKET_TYPE_KD_RESET\n");
184 KDDBGPRINT(
"KdReceivePacket - got PACKET_TYPE_KD_RESEND\n");
189 KDDBGPRINT(
"KdReceivePacket - got unknown control packet\n");
205 MessageHeader->Length = MessageHeader->MaximumLength;
208 if (
Packet.ByteCount < MessageHeader->Length ||
211 KDDBGPRINT(
"KdReceivePacket - too few data (%d) for type %d\n",
212 Packet.ByteCount, MessageHeader->Length);
213 MessageHeader->Length =
Packet.ByteCount;
222 MessageHeader->Length);
226 KDDBGPRINT(
"KdReceivePacket - Didn't receive message header data.\n");
235 MessageHeader->Length);
247 if (MessageData->Length)
253 MessageData->Length);
257 KDDBGPRINT(
"KdReceivePacket - Didn't receive message data.\n");
264 MessageData->Length);
272 KDDBGPRINT(
"KdReceivePacket - wrong trailing byte (0x%x), status 0x%x\n",
Byte, KdStatus);
278 if (
Packet.Checksum != Checksum)
280 KDDBGPRINT(
"KdReceivePacket - wrong cheksum, got %x, calculated %x\n",
281 Packet.Checksum, Checksum);
297 if (PacketType ==
Packet.PacketType)
306 KDDBGPRINT(
"KdReceivePacket - wrong PacketType\n");
327 Packet.ByteCount = MessageHeader->Length;
329 MessageHeader->Length);
334 Packet.ByteCount += MessageData->Length;
336 MessageData->Length);
339 Retries = KdContext->KdpDefaultRetries;
373 Retries = KdContext->KdpDefaultRetries;
423 KDDBGPRINT(
"KdSendPacket got KdStatus 0x%x\n", KdStatus);
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
VOID NTAPI KdpSendBuffer(IN PVOID Buffer, IN ULONG Size)
KDP_STATUS NTAPI KdpReceiveBuffer(OUT PVOID Buffer, IN ULONG Size)
KDP_STATUS NTAPI KdpReceivePacketLeader(OUT PULONG PacketLeader)
VOID NTAPI KdpSendByte(IN UCHAR Byte)
KDP_STATUS NTAPI KdpPollBreakIn(VOID)
ULONG NTAPI KdpCalculateChecksum(IN PVOID Buffer, IN ULONG Length)
VOID NTAPI KdSendPacket(IN ULONG PacketType, IN PSTRING MessageHeader, IN PSTRING MessageData, IN OUT PKD_CONTEXT KdContext)
KDP_STATUS NTAPI KdReceivePacket(IN ULONG PacketType, OUT PSTRING MessageHeader, OUT PSTRING MessageData, OUT PULONG DataLength, IN OUT PKD_CONTEXT KdContext)
VOID NTAPI KdpSendControlPacket(IN USHORT PacketType, IN ULONG PacketId OPTIONAL)
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
_In_ ULONG _In_ ULONG _In_ ULONG Length
PULONG MinorVersion OPTIONAL
#define DbgKdLoadSymbolsStateChange
#define DbgKdPrintStringApi
#define PACKET_TYPE_KD_FILE_IO
#define PACKET_TYPE_KD_STATE_CHANGE32
#define PACKET_TYPE_KD_ACKNOWLEDGE
#define PACKET_TRAILING_BYTE
#define PACKET_TYPE_KD_STATE_CHANGE64
#define CONTROL_PACKET_LEADER
#define PACKET_TYPE_KD_POLL_BREAKIN
#define DbgKdCreateFileApi
#define INITIAL_PACKET_ID
#define PACKET_TYPE_KD_RESET
#define PACKET_TYPE_KD_RESEND
#define PACKET_TYPE_KD_DEBUG_IO
#define KD_DEBUGGER_NOT_PRESENT