[Applies to UMDF 1.x only]
The OnD0Entry method notifies a driver when a device enters the D0 power state so that the driver can perform necessary operations, such as enabling the device.
HRESULT OnD0Entry( [in] IWDFDevice *pWdfDevice, [in] WDF_POWER_DEVICE_STATE previousState );
- pWdfDevice [in]
A pointer to the IWDFDevice interface for the device object of the device that enters the D0 power state.
- previousState [in]
A WDF_POWER_DEVICE_STATE-typed value that identifies the power state of the device before it entered the D0 power state.
If the OnD0Entry callback encounters no errors, it must return S_OK or another status code for which SUCCEEDED(status) equals TRUE.
If it returns a status code for which SUCCEEDED(status) equals FALSE, the framework removes the device. If the device's drivers are not supporting other devices on the system, the I/O manager unloads the drivers. The framework notifies the PnP manager, which then attempts to restart the device by requesting the bus driver to reenumerate its devices. If your driver was unloaded, it will be reloaded. In this case, the framework will not call the driver's IPnpCallback::OnD0Exit callback function.
HRESULT error codes are defined in Winerror.h.