[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 */
InbvUpdateProgressBar(25);
#ifdef _WINKD_
/* No KD Time Slip is pending */
KdpTimeSlipPending = 0;
#endif
/* Initialize in-place execution support */
XIPInit(LoaderBlock);

View file

@ -189,16 +189,6 @@ KdpPrintString(
_In_ ULONG Length,
_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
NTAPI
KdpDetectConflicts(PCM_RESOURCE_LIST DriverList);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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