Windows Driver Kit: Kernel-Mode Driver Framework
EvtDeviceSurpriseRemoval
A driver's EvtDeviceSurpriseRemoval event callback function performs any operations that are needed after a device has been unexpectedly removed from the system or after a driver reports that the device has failed.
EVT_WDF_DEVICE_SURPRISE_REMOVAL EvtDeviceSurpriseRemoval;
VOID
EvtDeviceSurpriseRemoval (
IN WDFDEVICE Device
)
{…}
You must declare the function by using the EVT_WDF_DEVICE_SURPRISE_REMOVAL type. For more information, see the following Example section.
Parameters
- Device
- A handle to a framework device object.
Return Value
None
Comments
To register an EvtDeviceSurpriseRemoval callback function, a driver must call WdfDeviceInitSetPnpPowerEventCallbacks.
For more information about when the framework calls this callback, see A User Unplugs a Device.
Example
To define an EvtDeviceSurpriseRemoval callback function that is named MyDeviceSurpriseRemoval, you must first provide a function declaration that SDV and other verification tools require, as follows:
EVT_WDF_DEVICE_SURPRISE_REMOVAL MyDeviceSurpriseRemoval;
Then, implement your callback function as follows:
VOID
MyDeviceSurpriseRemoval (
IN WDFDEVICE Device
)
{…}
Requirements
Versions: The EvtDeviceSurpriseRemoval callback function is supported by version 1.0 and later versions of KMDF.
IRQL: PASSIVE_LEVEL
Headers: Defined in Wdfdevice.h, as follows:
typedef VOID
(EVT_WDF_DEVICE_SURPRISE_REMOVAL)(
IN WDFDEVICE Device
);
Include Wdf.h.
See Also