diff --git a/ntoskrnl/kd64/kdapi.c b/ntoskrnl/kd64/kdapi.c index d532cb37767..47898cacabc 100644 --- a/ntoskrnl/kd64/kdapi.c +++ b/ntoskrnl/kd64/kdapi.c @@ -1991,6 +1991,10 @@ KdEnableDebuggerWithLock(IN BOOLEAN NeedLock) KdDbgPortPrintf("%s\n", __FUNCTION__); + /* Fail if there is no debugger */ + if (KdPitchDebugger) + return STATUS_DEBUGGER_INACTIVE; + /* Check if enabling the debugger is blocked */ if (KdBlockEnable) { @@ -2065,10 +2069,11 @@ KdDisableDebuggerWithLock(IN BOOLEAN NeedLock) KdDbgPortPrintf("%s\n", __FUNCTION__); - /* - * If enabling the debugger is blocked - * then there is nothing to disable (duh) - */ + /* Fail if there is no debugger */ + if (KdPitchDebugger) + return STATUS_DEBUGGER_INACTIVE; + + /* If enabling the debugger is blocked, then there is nothing to disable */ if (KdBlockEnable) { /* Fail */ @@ -2594,10 +2599,7 @@ KdChangeOption(IN KD_OPTION Option, { /* Fail if there is no debugger */ if (KdPitchDebugger) - { - /* No debugger, no options */ return STATUS_DEBUGGER_INACTIVE; - } /* Do we recognize this option? */ if (Option != KD_OPTION_SET_BLOCK_ENABLE) @@ -2674,12 +2676,9 @@ KdRefreshDebuggerNotPresent(VOID) { BOOLEAN Enable, DebuggerNotPresent; - /* Check if the debugger is completely disabled */ - if (KdPitchDebugger) - { - /* Don't try to refresh then, fail early */ - return TRUE; - } + /* Fail if there is no debugger, or if it is currently disabled */ + if (KdPitchDebugger || !KdDebuggerEnabled) + return TRUE; // (KdDebuggerNotPresent = TRUE); /* Enter the debugger */ Enable = KdEnterDebugger(NULL, NULL);