From 5162bf1060e8205d73dd55e8440711b3c06fd482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Sun, 10 Jul 2022 14:09:44 +0200 Subject: [PATCH] [NTOS:KD] In KDBG, introduce alternate function names, so we can call real Kd* functions CORE-10749 --- ntoskrnl/include/ntoskrnl.h | 25 ++++++++++++++++++++++++- ntoskrnl/kd/kdio.c | 9 +++++++-- ntoskrnl/kd/kdmain.c | 9 +++++++-- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/ntoskrnl/include/ntoskrnl.h b/ntoskrnl/include/ntoskrnl.h index 6f2f5379bec..9e64206b6bf 100644 --- a/ntoskrnl/include/ntoskrnl.h +++ b/ntoskrnl/include/ntoskrnl.h @@ -88,13 +88,36 @@ #define NOEXTAPI #include #include +#include #ifdef KDBG +NTSTATUS +NTAPI +KdpDebuggerInitialize0( + IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL); +NTSTATUS +NTAPI +KdpDebuggerInitialize1( + IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL); +VOID +NTAPI +KdpSendPacket( + IN ULONG PacketType, + IN PSTRING MessageHeader, + IN PSTRING MessageData, + IN OUT PKD_CONTEXT KdContext); +KDSTATUS +NTAPI +KdpReceivePacket( + IN ULONG PacketType, + OUT PSTRING MessageHeader, + OUT PSTRING MessageData, + OUT PULONG DataLength, + IN OUT PKD_CONTEXT Context); #define KdDebuggerInitialize0 KdpDebuggerInitialize0 #define KdDebuggerInitialize1 KdpDebuggerInitialize1 #define KdSendPacket KdpSendPacket #define KdReceivePacket KdpReceivePacket #endif -#include #ifdef __ROS_ROSSYM__ #include #endif diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c index 8c0ca1825ad..f2f304a26ab 100644 --- a/ntoskrnl/kd/kdio.c +++ b/ntoskrnl/kd/kdio.c @@ -15,6 +15,11 @@ #define NDEBUG #include +#undef KdDebuggerInitialize0 +#undef KdDebuggerInitialize1 +#undef KdSendPacket +#undef KdReceivePacket + /* GLOBALS *******************************************************************/ #define KdpBufferSize (1024 * 512) @@ -573,7 +578,7 @@ extern STRING KdbPromptString; VOID NTAPI -KdSendPacket( +KdpSendPacket( IN ULONG PacketType, IN PSTRING MessageHeader, IN PSTRING MessageData, @@ -669,7 +674,7 @@ KdSendPacket( KDSTATUS NTAPI -KdReceivePacket( +KdpReceivePacket( IN ULONG PacketType, OUT PSTRING MessageHeader, OUT PSTRING MessageData, diff --git a/ntoskrnl/kd/kdmain.c b/ntoskrnl/kd/kdmain.c index 76e28962a98..f08e8495c5c 100644 --- a/ntoskrnl/kd/kdmain.c +++ b/ntoskrnl/kd/kdmain.c @@ -11,6 +11,11 @@ #define NDEBUG #include +#undef KdDebuggerInitialize0 +#undef KdDebuggerInitialize1 +#undef KdSendPacket +#undef KdReceivePacket + /* VARIABLES ***************************************************************/ VOID NTAPI PspDumpThreads(BOOLEAN SystemThreads); @@ -82,7 +87,7 @@ KdpGetDebugMode(PCHAR Currentp2) NTSTATUS NTAPI -KdDebuggerInitialize0( +KdpDebuggerInitialize0( IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL) { ULONG i; @@ -137,7 +142,7 @@ KdDebuggerInitialize0( NTSTATUS NTAPI -KdDebuggerInitialize1( +KdpDebuggerInitialize1( IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL) { PLIST_ENTRY CurrentEntry;