KdRefreshDebuggerNotPresent function

The KdRefreshDebuggerNotPresent macro refreshes the value of the KD_DEBUGGER_NOT_PRESENT global kernel variable.

Syntax


NTKERNELAPI BOOLEAN KdRefreshDebuggerNotPresent(void);

Parameters

This function has no parameters.

Return value

KdRefreshDebuggerNotPresent returns the value of KD_DEBUGGER_NOT_PRESENT.

Remarks

When KdRefreshDebuggerNotPresent is called, it forces the value of KD_DEBUGGER_NOT_PRESENT to be updated to reflect whether a kernel debugger is currently attached. This updated value is also used as the return value of this routine.

If a kernel debugger was recently attached or removed, the value of KD_DEBUGGER_NOT_PRESENT may not reflect the new state. If you suspect this has happened, you should call KdRefreshDebuggerNotPresent to refresh the value of this variable. After this call, you may use either the value of KD_DEBUGGER_NOT_PRESENT or the return value of KdRefreshDebuggerNotPresent to determine if the kernel debugger is present.

KD_DEBUGGER_NOT_PRESENT can be modified by Windows or any other kernel-mode binary. Therefore, it is possible that the most recent return value of KdRefreshDebuggerNotPresent may not match the current value of KD_DEBUGGER_NOT_PRESENT.

Note  KdRefreshDebuggerNotPresent works equally well in the free build of a driver and the checked build of a driver -- unlike the other routines beginning with the letters "Kd."
 

The following sample shows how to use KdRefreshDebuggerNotPresent:


if (KdRefreshDebuggerNotPresent() == FALSE)
{
    //  A kernel debugger is active.
    DbgPrint("A problem occurred\n");
 DbgBreakPoint();
}
else
{
 //  No kernel debugger attached, or kernel debugging not enabled.
 KeBugCheckEx(...);
}

Requirements

Target platform

Universal

Version

Available in Microsoft Windows Server 2003 and later.

Header

Ntddk.h (include Wdm.h or Ntddk.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

See also

Determining if a Debugger is Attached
KD_DEBUGGER_ENABLED
KD_DEBUGGER_NOT_PRESENT

 

 

Send comments about this topic to Microsoft

Show: