diff --git a/ntoskrnl/kd64/amd64/kdx64.c b/ntoskrnl/kd64/amd64/kdx64.c index 3bb2745d2c4..5c6871d3a9e 100644 --- a/ntoskrnl/kd64/amd64/kdx64.c +++ b/ntoskrnl/kd64/amd64/kdx64.c @@ -363,8 +363,21 @@ NTSTATUS NTAPI KdpAllowDisable(VOID) { - UNIMPLEMENTED; - return STATUS_ACCESS_DENIED; + ULONG i; + + /* Loop every processor */ + for (i = 0; i < KeNumberProcessors; i++) + { + PKPROCESSOR_STATE ProcessorState = &KiProcessorBlock[i]->ProcessorState; + + /* If any processor breakpoints are active, + * we can't allow running without a debugger */ + if (ProcessorState->SpecialRegisters.KernelDr7 & 0xFF) + return STATUS_ACCESS_DENIED; + } + + /* No processor breakpoints, allow disabling the debugger */ + return STATUS_SUCCESS; } /* EOF */