Usb rule set (KMDF)

Use these rules to verify that your driver correctly handles some specialized KMDF methods for USB devices.

In this section

Topic Description

FailD0EntryIoTargetState

The FailD0EntryIoTargetState rule specifies that an I/O target for a USB continuous reader started within the EvtDeviceD0Entry will get stopped appropriately from the same callback if the EvtDeviceD0Entry fails.

UsbContReader

The UsbContReader rule specifies that a continuous reader is configured correctly within a driver's EvtDevicePrepareHardware event callback function, where the driver makes a call to the WdfUsbTargetPipeConfigContinuousReader method.

UsbDeviceCreate

The UsbDeviceCreate rule specifies that the WdfUsbTargetDeviceCreate and WdfUsbTargetDeviceCreateWithParameters methods are not called outside of the EvtDevicePrepareHardware event callback function.

UsbDeviceCreateFail

The UsbDeviceCreateFail rule specifies that the driver returns from the EvtDevicePrepareHardware event callback function with an error status if creation of a WDFUSBDEVICE object fails.

UsbDeviceCreateTarget

The UsbDeviceCreateTarget rule specifies that multiple WDFUSBDEVICE objects are not created while WDFUSBDEVICE object(s) that are currently in the device context are leaked.

To select the Usb rule set

  1. Select your driver project (.vcxProj) in Microsoft Visual Studio. From the Driver menu, click Launch Static Driver Verifier….

  2. Click the Rules tab. Under Rule Sets, select Usb.

    To select the default rule set from a Visual Studio developer command prompt window, specify Usb.sdv with the /check option. For example:

    msbuild /t:sdv /p:Inputs="/check:Usb.sdv" mydriver.VcxProj /p:Configuration="Win8 Release" /p:Platform=Win32
    

    For more information, see Using Static Driver Verifier to Find Defects in Drivers and Static Driver Verifier commands (MSBuild).