public static unsafe KdStatus ReceivePacket( KdPacketType PacketType, byte *MessageHeaderBuffer, int MessageHeaderLength, byte *MessageDataBuffer, int MessageDataBufferLength, out int MessageDataLength ) { // DebugStub.WriteLine(String.Format("Kd.ReceivePacket: MessageHeaderBuffer = 0x{0:x}", (UIntPtr)MessageHeaderBuffer)); // Console.WriteLine("Kd.ReceivePacket: Waiting for packet from KD..."); KdStatus status = (KdStatus)ReceivePacket( (uint)PacketType, MessageHeaderBuffer, MessageHeaderLength, MessageDataBuffer, MessageDataBufferLength, out MessageDataLength); // Console.WriteLine("Kd.ReceivePacket: KdReceivePacket has returned. Status = " + status); // DebugStub.Break(); return(status); }
public static unsafe bool SendRequestWaitResponse( KdPacketType PacketType, byte *RequestHeaderBuffer, int RequestHeaderLength, byte *RequestDataBuffer, int RequestDataLength, byte *ResponseHeaderBuffer, int ResponseHeaderLength, byte *ResponseDataBuffer, int ResponseDataMaximumLength, out int ResponseDataActualLength) { ResponseDataActualLength = 0; send_packet: if (!IsDebuggerPresent()) { return(false); } SendPacket( PacketType, RequestHeaderBuffer, RequestHeaderLength, RequestDataBuffer, RequestDataLength); receive_packet: KdStatus status = (KdStatus)ReceivePacket( (uint)PacketType, ResponseHeaderBuffer, ResponseHeaderLength, ResponseDataBuffer, ResponseDataMaximumLength, out ResponseDataActualLength); if (status == KdStatus.PacketReceived) { Dbg("Received response. Actual data length = {0}", ResponseDataActualLength); return(true); } if (status == KdStatus.PacketTimeout) { if (IsDebuggerPresent()) { Dbg("Received PacketTimeout, trying again"); goto receive_packet; } else { ResponseDataActualLength = 0; return(false); } } if (status == KdStatus.PacketResend) { Dbg("Received PacketResend -- resending packet."); goto send_packet; } Dbg("Received unrecognized response from KdReceivePacket. Return value: {0}", (uint)status); ResponseDataActualLength = 0; return(false); }