Determining if a Debugger is Attached

Kernel-mode code can determine the status of kernel debugging by using the following variables and routines: