You might think that just because your device is root enumerated or is plugged into fix slot (llike PCI) and not in a hot plug bus (like USB or PCCARD/PCMCIA) that your driver will not get a IRP_MN_SURPRISE_REMOVAL irp.  This would be a bad assumption to make.

Why?  IRP_MN_SURPRISE_REMOVAL is actually an overloaded message.  Not only is it sent when the underlying bus has detected that the device is now missing, it is also sent in error conditions where the PDO is still reported as present.  For instance, if you call IoInvalidateDeviceState and then set PNP_DEVICE_FAILED in the subsequent IRP_MN_QUERY_PNP_DEVICE_STATE PIRP, your device stack will get a surprise remove, no matter how it is connected to the PC!  You don't have to modify your driver either, you can use pnpdtest (in the DDK) to cause the surprise removal.  There is no way to differentiate between these two messages , so you must handle this PIRP regardless of how your device is connected