// wdfdevice.h
EVT_WDF_DEVICE_D0_ENTRY EvtWdfDeviceD0Entry;
NTSTATUS EvtWdfDeviceD0Entry(
[in] WDFDEVICE Device,
[in] WDF_POWER_DEVICE_STATE PreviousState
)
{...}
View the official Windows Driver Kit DDI referenceNo description available.
[Applies to KMDF and UMDF]
A driver's EvtDeviceD0Entry event callback function performs operations that are needed when the driver's device enters the D0 power state.
Device [in]A handle to a framework device object.
PreviousState [in]A WDF_POWER_DEVICE_STATE-typed enumerator that identifies the previous device power state.
If the EvtDeviceD0Entry callback function encounters no errors, it must return STATUS_SUCCESS or another status value for which NT_SUCCESS(status) equals TRUE. Otherwise, it must return a status value for which NT_SUCCESS(status) equals FALSE.
For more information about this callback function's return values, see Reporting Device Failures.
The framework does not call the driver's EvtDeviceD0Exit callback function after the EvtDeviceD0Entry callback function returns a status value for which NT_SUCCESS(status) equals FALSE.
To register an EvtDeviceD0Entry callback function for a device, a driver must call WdfDeviceInitSetPnpPowerEventCallbacks.
If the driver has registered an EvtDeviceD0Entry callback function for a device, the framework calls the function each time the device enters its working (D0) state. A device will enter the D0 state when one of the following occurs:
The framework calls the EvtDeviceD0Entry callback function immediately after the device enters its working (D0) state and is available to the driver, but before the device's interrupts have been enabled. The PreviousState parameter identifies the device power state that the device was in before it entered the D0 state. When the framework first calls EvtDeviceD0Entry, it provides a PreviousState value of WdfPowerDeviceD3Final.
The callback function must perform any operations that are needed to make the device fully operational, such as loading firmware or enabling device capabilities that are disabled when the device is in a low-power state.
If the EvtDeviceD0Entry callback function returns a status value for which NT_SUCCESS(status) equals FALSE, the framework does the following:
The framework does not call the driver's EvtDeviceD0Exit callback function in either of these situations.
For more information about when the framework calls the EvtDeviceD0Entry callback function, see PnP and Power Management Scenarios.
For more information about drivers that provide this callback function, see Supporting PnP and Power Management in Function Drivers.
The EvtDeviceD0Entry callback function is called at IRQL = PASSIVE_LEVEL. You should not make this callback function pageable.