[NTOS:KD] Remove some _WINDK_ usages

- Always include kd64.h
- Change KdpPrompt() prototype to be compatible between KDBG and _WINDK_
- Rename KdComponentTable to KdpComponentTable to prevent a conflict
- Add some functions stubs and global variables
This commit is contained in:
Hervé Poussineau 2019-05-20 12:17:22 +02:00
parent f5e962ff2e
commit f7ec84eea0
8 changed files with 31 additions and 33 deletions

View file

@ -1792,10 +1792,8 @@ Phase1InitializationDiscard(IN PVOID Context)
/* Update progress bar */ /* Update progress bar */
InbvUpdateProgressBar(25); InbvUpdateProgressBar(25);
#ifdef _WINKD_
/* No KD Time Slip is pending */ /* No KD Time Slip is pending */
KdpTimeSlipPending = 0; KdpTimeSlipPending = 0;
#endif
/* Initialize in-place execution support */ /* Initialize in-place execution support */
XIPInit(LoaderBlock); XIPInit(LoaderBlock);

View file

@ -189,16 +189,6 @@ KdpPrintString(
_In_ ULONG Length, _In_ ULONG Length,
_In_ KPROCESSOR_MODE PreviousMode); _In_ KPROCESSOR_MODE PreviousMode);
ULONG
NTAPI
KdpPrompt(
_In_reads_bytes_(InStringLength) PCHAR UnsafeInString,
_In_ USHORT InStringLength,
_Out_writes_bytes_(OutStringLength) PCHAR UnsafeOutString,
_In_ USHORT OutStringLength,
_In_ KPROCESSOR_MODE PreviousMode
);
BOOLEAN BOOLEAN
NTAPI NTAPI
KdpDetectConflicts(PCM_RESOURCE_LIST DriverList); KdpDetectConflicts(PCM_RESOURCE_LIST DriverList);

View file

@ -61,11 +61,7 @@
#include "po.h" #include "po.h"
#include "se.h" #include "se.h"
#include "ldr.h" #include "ldr.h"
#ifndef _WINKD_
#include "kd.h"
#else
#include "kd64.h" #include "kd64.h"
#endif
#include "fsrtl.h" #include "fsrtl.h"
#include "lpc.h" #include "lpc.h"
#include "rtl.h" #include "rtl.h"

View file

@ -21,6 +21,8 @@ BOOLEAN KdPitchDebugger = TRUE;
BOOLEAN KdIgnoreUmExceptions = FALSE; BOOLEAN KdIgnoreUmExceptions = FALSE;
KD_CONTEXT KdpContext; KD_CONTEXT KdpContext;
ULONG Kd_WIN2000_Mask; ULONG Kd_WIN2000_Mask;
LONG KdpTimeSlipPending;
KDDEBUGGER_DATA64 KdDebuggerDataBlock;
VOID NTAPI PspDumpThreads(BOOLEAN SystemThreads); VOID NTAPI PspDumpThreads(BOOLEAN SystemThreads);
typedef struct typedef struct
@ -29,7 +31,7 @@ typedef struct
ULONG Level; ULONG Level;
} KD_COMPONENT_DATA; } KD_COMPONENT_DATA;
#define MAX_KD_COMPONENT_TABLE_ENTRIES 128 #define MAX_KD_COMPONENT_TABLE_ENTRIES 128
KD_COMPONENT_DATA KdComponentTable[MAX_KD_COMPONENT_TABLE_ENTRIES]; KD_COMPONENT_DATA KdpComponentTable[MAX_KD_COMPONENT_TABLE_ENTRIES];
ULONG KdComponentTableEntries = 0; ULONG KdComponentTableEntries = 0;
ULONG Kd_DEFAULT_MASK = 1 << DPFLTR_ERROR_LEVEL; ULONG Kd_DEFAULT_MASK = 1 << DPFLTR_ERROR_LEVEL;
@ -204,7 +206,9 @@ KdpEnterDebuggerException(IN PKTRAP_FRAME TrapFrame,
ExceptionInformation[2], ExceptionInformation[2],
OutString, OutString,
OutStringLength, OutStringLength,
PreviousMode); PreviousMode,
TrapFrame,
ExceptionFrame);
/* Return the number of characters that we received */ /* Return the number of characters that we received */
Context->Eax = ReturnValue; Context->Eax = ReturnValue;
@ -264,6 +268,12 @@ KdIsThisAKdTrap(IN PEXCEPTION_RECORD ExceptionRecord,
/* PUBLIC FUNCTIONS *********************************************************/ /* PUBLIC FUNCTIONS *********************************************************/
VOID
NTAPI
KdUpdateDataBlock(VOID)
{
}
/* /*
* @implemented * @implemented
*/ */
@ -302,6 +312,13 @@ KdDisableDebugger(VOID)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
NTSTATUS
NTAPI
KdEnableDebuggerWithLock(IN BOOLEAN NeedLock)
{
return STATUS_ACCESS_DENIED;
}
/* /*
* @implemented * @implemented
*/ */
@ -383,10 +400,10 @@ NtQueryDebugFilterState(IN ULONG ComponentId,
for (i = 0; i < KdComponentTableEntries; i++) for (i = 0; i < KdComponentTableEntries; i++)
{ {
/* Check if it is the right component */ /* Check if it is the right component */
if (ComponentId == KdComponentTable[i].ComponentId) if (ComponentId == KdpComponentTable[i].ComponentId)
{ {
/* Check if mask are matching */ /* Check if mask are matching */
return (Level & KdComponentTable[i].Level) ? TRUE : FALSE; return (Level & KdpComponentTable[i].Level) ? TRUE : FALSE;
} }
} }
} }
@ -423,7 +440,7 @@ NtSetDebugFilterState(IN ULONG ComponentId,
/* Search for an existing entry */ /* Search for an existing entry */
for (i = 0; i < KdComponentTableEntries; i++ ) for (i = 0; i < KdComponentTableEntries; i++ )
{ {
if (ComponentId == KdComponentTable[i].ComponentId) if (ComponentId == KdpComponentTable[i].ComponentId)
break; break;
} }
@ -436,15 +453,15 @@ NtSetDebugFilterState(IN ULONG ComponentId,
/* Add a new entry */ /* Add a new entry */
++KdComponentTableEntries; ++KdComponentTableEntries;
KdComponentTable[i].ComponentId = ComponentId; KdpComponentTable[i].ComponentId = ComponentId;
KdComponentTable[i].Level = Kd_DEFAULT_MASK; KdpComponentTable[i].Level = Kd_DEFAULT_MASK;
} }
/* Update entry table */ /* Update entry table */
if (State) if (State)
KdComponentTable[i].Level |= Level; KdpComponentTable[i].Level |= Level;
else else
KdComponentTable[i].Level &= ~Level; KdpComponentTable[i].Level &= ~Level;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }

View file

@ -1,4 +1,5 @@
#pragma once #pragma once
#include "internal/kd.h"
/* DEFINES *******************************************************************/ /* DEFINES *******************************************************************/

View file

@ -3672,14 +3672,16 @@ KdpSerialDebugPrint(
STRING KdpPromptString = RTL_CONSTANT_STRING("kdb:> "); STRING KdpPromptString = RTL_CONSTANT_STRING("kdb:> ");
extern KSPIN_LOCK KdpSerialSpinLock; extern KSPIN_LOCK KdpSerialSpinLock;
ULONG USHORT
NTAPI NTAPI
KdpPrompt( KdpPrompt(
_In_reads_bytes_(InStringLength) PCHAR UnsafeInString, _In_reads_bytes_(InStringLength) PCHAR UnsafeInString,
_In_ USHORT InStringLength, _In_ USHORT InStringLength,
_Out_writes_bytes_(OutStringLength) PCHAR UnsafeOutString, _Out_writes_bytes_(OutStringLength) PCHAR UnsafeOutString,
_In_ USHORT OutStringLength, _In_ USHORT OutStringLength,
_In_ KPROCESSOR_MODE PreviousMode) _In_ KPROCESSOR_MODE PreviousMode,
_In_ PKTRAP_FRAME TrapFrame,
_In_ PKEXCEPTION_FRAME ExceptionFrame)
{ {
USHORT i; USHORT i;
CHAR Response; CHAR Response;

View file

@ -1062,9 +1062,7 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
} }
/* Check if we need to save the context for KD */ /* Check if we need to save the context for KD */
#ifdef _WINKD_
if (!KdPitchDebugger) KdDebuggerDataBlock.SavedContext = (ULONG_PTR)&Context; if (!KdPitchDebugger) KdDebuggerDataBlock.SavedContext = (ULONG_PTR)&Context;
#endif
/* Check if a debugger is connected */ /* Check if a debugger is connected */
if ((BugCheckCode != MANUALLY_INITIATED_CRASH) && (KdDebuggerEnabled)) if ((BugCheckCode != MANUALLY_INITIATED_CRASH) && (KdDebuggerEnabled))
@ -1147,9 +1145,7 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
if (!(KdDebuggerEnabled) && !(KdPitchDebugger)) if (!(KdDebuggerEnabled) && !(KdPitchDebugger))
{ {
/* Enable it */ /* Enable it */
#ifdef _WINKD_
KdEnableDebuggerWithLock(FALSE); KdEnableDebuggerWithLock(FALSE);
#endif
} }
else else
{ {

View file

@ -383,10 +383,8 @@ PspInitializeSystemDll(VOID)
KeBugCheckEx(PROCESS1_INITIALIZATION_FAILED, Status, 8, 0, 0); KeBugCheckEx(PROCESS1_INITIALIZATION_FAILED, Status, 8, 0, 0);
} }
#ifdef _WINKD_
/* Let KD know we are done */ /* Let KD know we are done */
KdUpdateDataBlock(); KdUpdateDataBlock();
#endif
/* Return status */ /* Return status */
return Status; return Status;