https://git.reactos.org/?p=reactos.git;a=commitdiff;h=36335d9ceeed7342b70b6…
commit 36335d9ceeed7342b70b6dab7e162cab419a6b76
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Wed Nov 23 18:19:41 2022 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Thu Nov 24 01:18:17 2022 +0100
[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
---
ntoskrnl/include/internal/kd64.h | 11 ++++++++---
ntoskrnl/kd64/kddata.c | 8 ++++----
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/ntoskrnl/include/internal/kd64.h b/ntoskrnl/include/internal/kd64.h
index 8f87c591634..d12d10fde1e 100644
--- a/ntoskrnl/include/internal/kd64.h
+++ b/ntoskrnl/include/internal/kd64.h
@@ -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;
diff --git a/ntoskrnl/kd64/kddata.c b/ntoskrnl/kd64/kddata.c
index bd7e038aba6..6e99c18d374 100644
--- a/ntoskrnl/kd64/kddata.c
+++ b/ntoskrnl/kd64/kddata.c
@@ -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),