[NTOS:KD] Remove some _WINDK_ usages
authorHervé Poussineau <hpoussin@reactos.org>
Mon, 20 May 2019 10:17:22 +0000 (12:17 +0200)
committerHervé Poussineau <hpoussin@reactos.org>
Thu, 23 May 2019 09:04:40 +0000 (11:04 +0200)
- 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

ntoskrnl/ex/init.c
ntoskrnl/include/internal/kd.h
ntoskrnl/include/internal/ntoskrnl.h
ntoskrnl/kd/kdmain.c
ntoskrnl/kdbg/kdb.h
ntoskrnl/kdbg/kdb_cli.c
ntoskrnl/ke/bug.c
ntoskrnl/ps/psmgr.c

index 1e31003..39869a5 100644 (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);
index 3e57fc2..162ece5 100644 (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);
index d0dfe4d..b3dd74f 100644 (file)
 #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"
index d613848..fdbeeea 100644 (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;
 }
index 65bedf2..b641907 100644 (file)
@@ -1,4 +1,5 @@
 #pragma once
+#include "internal/kd.h"
 
 /* DEFINES *******************************************************************/
 
index 5ef7f61..4009e0a 100644 (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;
index a92acb1..3208e6b 100644 (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
         {
index 317861c..4b70413 100644 (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;