I'm debugging a driver with WinDbg. In the DriverUnload
function, there's a call to KdBreakPoint()
.
When I disable the device from device manager, WinDbg breaks into the DriverUnload
function.
But when I shutdown or restart Windows (through Start > Shutdown), the debugger doesn't break.
So the question is: why does windows not call the DriverUnload
function at restart or shutdown?
(BTW: I have already added breakpoints to the PNP dispatch function to catch IRP_MN_QUERY_REMOVE_DEVICE
/ IRP_MN_REMOVE_DEVICE
/ IRP_MN_QUERY_STOP_DEVICE
/ IRP_MN_STOP_DEVICE
, the result is the same)