InitFreeDevice 创建规则 (kmdf)

InitFreeDeviceCreate 规则指定,如果某个设备对象初始化方法发生错误,并且驱动程序从调用 WdfControlDeviceInitAllocate 收到 WDFDEVICE_INIT 结构,则驱动程序必须调用 WdfDeviceInitFree 而不是 WdfDeviceCreate

驱动程序模型:KMDF

如何测试

在编译时

运行 静态驱动程序验证程序 并指定 InitFreeDeviceCreate 规则。

使用以下步骤运行代码分析:
  1. 准备代码 (角色类型声明) 。
  2. 运行静态驱动程序验证程序。
  3. 查看并分析结果。

有关详细信息,请参阅使用 静态驱动程序验证程序查找驱动程序中的缺陷

适用于

WdfControlDeviceInitAllocateWdfDeviceCreateWdfDeviceInitAssignNameWdfDeviceInitAssignSDDLStringWdfDeviceInitAssignWdmIrpPreprocessCallbackWdfDeviceInitFreeWdfDeviceInitRegisterPnpStateChangeCallbackWdfDeviceInitRegisterPowerPolicyStateChangeCallbackWdfDeviceInitRegisterPowerStateChangeCallbackWdfPdoInitAddCompatibleIDWdfPdoInitAddDeviceText WdfPdoInitAddHardwareIDWdfPdoInitAssignDeviceIDWdfPdoInitAssignInstanceIDWdfPdoInitAssignRawDevice

另请参阅

InitFreeDeviceCallbackInitFreeDeviceCreateType2PdoInitFreeDeviceCreateType2InitFreeDeviceCreateType4PdoInitFreeDeviceCallbackPdoInitFreeDeviceCreatePdoInitFreeDeviceCreateType4InitFreeNull