A number of times recently we’ve seen discussions about how to disable hard error popups in a kernel driver. For example, a driver that wishes to probe the floppy drive does not want a dialog box to pop up as a result of its probe. This is easily achieved using the function IoSetThreadHardErrorMode, which will ensure that the annoying dialog box does not appear.
Correct usage for this is:
{
BOOLEAN oldHardErrorMode;
oldHardErrorMode = IoSetThreadHardErrorMode(TRUE);
// perform protected operation
(void) IoSetThreadHardErrorMode(oldHardErrorMode);
}