[NTOS:KD64] Correctly initialize the KdPrint buffer data in KdDebuggerDataBlock so as to fix the WinDbg !dbgprint command.

Now, !dbgprint just shows an empty log (since we don't fill it), instead
of showing the following error:

  kd> !dbgprint
  Can't find DbgPrint buffer
This commit is contained in:
Hermès Bélusca-Maïto 2022-11-23 18:19:41 +01:00
parent de81021bab
commit 36335d9cee
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 12 additions and 7 deletions

View file

@ -17,6 +17,11 @@
#define KD_DEFAULT_LOG_BUFFER_SIZE 0x1000
#endif
//
// Default size of the Message and Path buffers
//
#define KDP_MSG_BUFFER_SIZE 0x1000
//
// Maximum supported number of breakpoints
//
@ -511,8 +516,7 @@ VOID
__cdecl
KdpDprintf(
_In_ PCHAR Format,
...
);
...);
BOOLEAN
NTAPI
@ -552,7 +556,8 @@ extern BOOLEAN KdpContextSent;
extern KSPIN_LOCK KdpDebuggerLock;
extern LARGE_INTEGER KdTimerStop, KdTimerStart, KdTimerDifference;
extern CHAR KdpMessageBuffer[0x1000], KdpPathBuffer[0x1000];
extern CHAR KdpMessageBuffer[KDP_MSG_BUFFER_SIZE];
extern CHAR KdpPathBuffer[KDP_MSG_BUFFER_SIZE];
extern CHAR KdPrintDefaultCircularBuffer[KD_DEFAULT_LOG_BUFFER_SIZE];
extern BREAKPOINT_ENTRY KdpBreakpointTable[KD_BREAKPOINT_MAX];
extern KD_BREAKPOINT_TYPE KdpBreakpointInstruction;

View file

@ -124,8 +124,8 @@ LARGE_INTEGER KdTimerStop, KdTimerStart, KdTimerDifference;
//
// Buffers
//
CHAR KdpMessageBuffer[0x1000];
CHAR KdpPathBuffer[0x1000];
CHAR KdpMessageBuffer[KDP_MSG_BUFFER_SIZE];
CHAR KdpPathBuffer[KDP_MSG_BUFFER_SIZE];
//
// KdPrint Buffers
@ -593,7 +593,7 @@ KDDEBUGGER_DATA64 KdDebuggerDataBlock =
PtrToUL64(&MmSystemRangeStart),
PtrToUL64(&MmUserProbeAddress),
PtrToUL64(KdPrintDefaultCircularBuffer),
PtrToUL64(KdPrintDefaultCircularBuffer + 1),
PtrToUL64(KdPrintDefaultCircularBuffer + sizeof(KdPrintDefaultCircularBuffer)),
PtrToUL64(&KdPrintWritePointer),
PtrToUL64(&KdPrintRolloverCount),
PtrToUL64(&MmLoadedUserImageList),
@ -636,7 +636,7 @@ KDDEBUGGER_DATA64 KdDebuggerDataBlock =
FIELD_OFFSET(KPRCB, ProcessorState.ContextFrame),
FIELD_OFFSET(KPRCB, Number),
sizeof(ETHREAD),
PtrToUL64(&KdPrintDefaultCircularBuffer),
PtrToUL64(&KdPrintCircularBuffer),
PtrToUL64(&KdPrintBufferSize),
PtrToUL64(&KeLoaderBlock),
sizeof(KPCR),