@@ -508,56 +508,81 @@ KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable,
508
508
BOOLEAN
509
509
NTAPI
510
510
KdpPrintString (
511
- _In_ PSTRING Output )
512
- {
513
- PLIST_ENTRY CurrentEntry ;
514
- PKD_DISPATCH_TABLE CurrentTable ;
511
+ _In_ PSTRING Output );
515
512
516
- if (! KdpDebugMode . Value ) return FALSE ;
513
+ extern STRING KdbPromptString ;
517
514
518
- /* Call the registered handlers */
519
- CurrentEntry = KdProviders .Flink ;
520
- while (CurrentEntry != & KdProviders )
515
+ VOID
516
+ NTAPI
517
+ KdSendPacket (
518
+ IN ULONG PacketType ,
519
+ IN PSTRING MessageHeader ,
520
+ IN PSTRING MessageData ,
521
+ IN OUT PKD_CONTEXT Context )
522
+ {
523
+ if (PacketType == PACKET_TYPE_KD_DEBUG_IO )
521
524
{
522
- /* Get the current table */
523
- CurrentTable = CONTAINING_RECORD (CurrentEntry ,
524
- KD_DISPATCH_TABLE ,
525
- KdProvidersList );
525
+ PSTRING Output = MessageData ;
526
+ PLIST_ENTRY CurrentEntry ;
527
+ PKD_DISPATCH_TABLE CurrentTable ;
526
528
527
- /* Call it */
528
- CurrentTable -> KdpPrintRoutine (Output -> Buffer , Output -> Length );
529
+ if (!KdpDebugMode .Value ) return ;
529
530
530
- /* Next Table */
531
- CurrentEntry = CurrentEntry -> Flink ;
532
- }
531
+ /* Call the registered handlers */
532
+ CurrentEntry = KdProviders .Flink ;
533
+ while (CurrentEntry != & KdProviders )
534
+ {
535
+ /* Get the current table */
536
+ CurrentTable = CONTAINING_RECORD (CurrentEntry ,
537
+ KD_DISPATCH_TABLE ,
538
+ KdProvidersList );
533
539
534
- /* Call the Wrapper Routine */
535
- if (WrapperTable .KdpPrintRoutine )
536
- WrapperTable .KdpPrintRoutine (Output -> Buffer , Output -> Length );
540
+ /* Call it */
541
+ CurrentTable -> KdpPrintRoutine (Output -> Buffer , Output -> Length );
537
542
538
- return FALSE;
539
- }
543
+ /* Next Table */
544
+ CurrentEntry = CurrentEntry -> Flink ;
545
+ }
540
546
541
- extern STRING KdbPromptString ;
547
+ /* Call the Wrapper Routine */
548
+ if (WrapperTable .KdpPrintRoutine )
549
+ WrapperTable .KdpPrintRoutine (Output -> Buffer , Output -> Length );
542
550
543
- BOOLEAN
551
+ return ;
552
+ }
553
+ UNIMPLEMENTED ;
554
+ }
555
+
556
+ KDSTATUS
544
557
NTAPI
545
- KdpPromptString (
546
- _In_ PSTRING PromptString ,
547
- _In_ PSTRING ResponseString )
558
+ KdReceivePacket (
559
+ IN ULONG PacketType ,
560
+ OUT PSTRING MessageHeader ,
561
+ OUT PSTRING MessageData ,
562
+ OUT PULONG DataLength ,
563
+ IN OUT PKD_CONTEXT Context )
548
564
{
549
565
#ifdef KDBG
550
566
KIRQL OldIrql ;
551
567
STRING StringChar ;
552
568
CHAR Response ;
553
569
USHORT i ;
554
570
ULONG DummyScanCode ;
571
+ CHAR MessageBuffer [100 ];
572
+ STRING ResponseString ;
573
+ #endif
555
574
575
+ if (PacketType != PACKET_TYPE_KD_DEBUG_IO )
576
+ return KdPacketTimedOut ;
577
+
578
+ #ifdef KDBG
579
+ ResponseString .Buffer = MessageBuffer ;
580
+ ResponseString .Length = 0 ;
581
+ ResponseString .MaximumLength = min (sizeof (MessageBuffer ), MessageData -> MaximumLength );
556
582
StringChar .Buffer = & Response ;
557
583
StringChar .Length = StringChar .MaximumLength = sizeof (Response );
558
584
559
585
/* Display the string and print a new line for log neatness */
560
- KdpPrintString (PromptString );
561
586
* StringChar .Buffer = '\n' ;
562
587
KdpPrintString (& StringChar );
563
588
@@ -573,7 +598,7 @@ KdpPromptString(
573
598
KbdDisableMouse ();
574
599
575
600
/* Loop the whole string */
576
- for (i = 0 ; i < ResponseString -> MaximumLength ; i ++ )
601
+ for (i = 0 ; i < ResponseString . MaximumLength ; i ++ )
577
602
{
578
603
/* Check if this is serial debugging mode */
579
604
if (KdbDebugState & KD_DEBUG_KDSERIAL )
@@ -618,58 +643,33 @@ KdpPromptString(
618
643
* Null terminate the output string -- documentation states that
619
644
* DbgPrompt does not null terminate, but it does
620
645
*/
621
- * (PCHAR )(ResponseString -> Buffer + i ) = 0 ;
646
+ * (PCHAR )(ResponseString . Buffer + i ) = 0 ;
622
647
break ;
623
648
}
624
649
625
650
/* Write it back and print it to the log */
626
- * (PCHAR )(ResponseString -> Buffer + i ) = Response ;
651
+ * (PCHAR )(ResponseString . Buffer + i ) = Response ;
627
652
KdpReleaseLock (& KdpSerialSpinLock , OldIrql );
628
653
KdpPrintString (& StringChar );
629
654
OldIrql = KdpAcquireLock (& KdpSerialSpinLock );
630
655
}
631
656
657
+ /* Print a new line */
658
+ * StringChar .Buffer = '\n' ;
659
+ KdpPrintString (& StringChar );
660
+
632
661
/* Return the length */
633
- ResponseString -> Length = i ;
662
+ RtlCopyMemory (MessageData -> Buffer , ResponseString .Buffer , i );
663
+ * DataLength = i ;
634
664
635
665
if (!(KdbDebugState & KD_DEBUG_KDSERIAL ))
636
666
KbdEnableMouse ();
637
667
638
668
/* Release the spinlock */
639
669
KdpReleaseLock (& KdpSerialSpinLock , OldIrql );
640
670
641
- /* Print a new line */
642
- * StringChar .Buffer = '\n' ;
643
- KdpPrintString (& StringChar );
644
671
#endif
645
-
646
- /* Success; we don't need to resend */
647
- return FALSE;
648
- }
649
-
650
- VOID
651
- NTAPI
652
- KdSendPacket (
653
- IN ULONG PacketType ,
654
- IN PSTRING MessageHeader ,
655
- IN PSTRING MessageData ,
656
- IN OUT PKD_CONTEXT Context )
657
- {
658
- UNIMPLEMENTED ;
659
- return ;
660
- }
661
-
662
- KDSTATUS
663
- NTAPI
664
- KdReceivePacket (
665
- IN ULONG PacketType ,
666
- OUT PSTRING MessageHeader ,
667
- OUT PSTRING MessageData ,
668
- OUT PULONG DataLength ,
669
- IN OUT PKD_CONTEXT Context )
670
- {
671
- UNIMPLEMENTED ;
672
- return 0 ;
672
+ return KdPacketReceived ;
673
673
}
674
674
675
675
/* EOF */
0 commit comments