DeviceInitAPI rule (kmdf)

For an FDO device, the framework device object initialization methods and the framework FDO initialization methods must be called before the driver calls the WdfDeviceCreate method for the device object.

For an FDO device, the framework device object initialization methods and framework FDO initialization methods, which store information in the WDFDEVICE_INIT structure, cannot be called after the driver calls WdfDeviceCreate for the framework device object.

Driver model: KMDF

How to test

At compile time

Run Static Driver Verifier and specify the DeviceInitAPI rule.

Use the following steps to run an analysis of your code:
  1. Prepare your code (use role type declarations).
  2. Run Static Driver Verifier.
  3. View and analyze the results.

For more information, see Using Static Driver Verifier to Find Defects in Drivers.

Applies to

WdfDeviceCreate
WdfDeviceInitAssignName
WdfDeviceInitAssignSDDLString
WdfDeviceInitAssignWdmIrpPreprocessCallback
WdfDeviceInitRegisterPnpStateChangeCallback
WdfDeviceInitRegisterPowerPolicyStateChangeCallback
WdfDeviceInitRegisterPowerStateChangeCallback
WdfDeviceInitSetCharacteristics
WdfDeviceInitSetDeviceClass
WdfDeviceInitSetDeviceType
WdfDeviceInitSetExclusive
WdfDeviceInitSetFileObjectConfig
WdfDeviceInitSetIoInCallerContextCallback
WdfDeviceInitSetIoType
WdfDeviceInitSetPnpPowerEventCallbacks
WdfDeviceInitSetPowerInrush
WdfDeviceInitSetPowerNotPageable
WdfDeviceInitSetPowerPageable
WdfDeviceInitSetPowerPolicyEventCallbacks
WdfDeviceInitSetPowerPolicyOwnership
WdfDeviceInitSetRequestAttributes
WdfFdoInitAllocAndQueryProperty
WdfFdoInitOpenRegistryKey
WdfFdoInitQueryProperty
WdfFdoInitSetDefaultChildListConfig
WdfFdoInitSetEventCallbacks
WdfFdoInitSetFilter
WdfFdoInitWdmGetPhysicalDevice