[Applies to KMDF and UMDF]
The WDFDEVICE_INIT structure is an opaque structure that is defined and allocated by the framework.
After a driver receives a WDFDEVICE_INIT structure, it passes the structure pointer to initialization functions. These functions use the WDFDEVICE_INIT structure to store information that the framework uses to create a framework device object. There are three sets of initialization methods:
After calling initialization functions, the driver must call WdfDeviceCreate to create the framework device object.
If your driver encounters an error while initializing a new framework device object, and if the driver received the WDFDEVICE_INIT structure from a call to WdfPdoInitAllocate or WdfControlDeviceInitAllocate, the driver must call WdfDeviceInitFree instead of WdfDeviceCreate.
If your driver received the WDFDEVICE_INIT structure as input to its EvtDriverDeviceAdd callback function, the driver does not need to call WdfDeviceInitFree because the framework deletes the structure after the callback function returns.
The WDFDEVICE_INIT structure is available in version 1.0 and later versions of KMDF.