Determining if a Debugger is Attached
You may wish to take certain actions with your driver if a kernel debugger is currently attached.
To determine the status of kernel debugging, the following variables and routines are useful:
(Microsoft Windows XP and later) The KD_DEBUGGER_ENABLED global kernel variable indicates whether kernel debugging is enabled.
(Windows XP and later) The KD_DEBUGGER_NOT_PRESENT global kernel variable indicates whether a kernel debugger is currently attached.
(Microsoft Windows Server 2003 and later) The KdRefreshDebuggerNotPresent routine refreshes the value of KD_DEBUGGER_NOT_PRESENT.