VirtualStorport rule set (Storport)

Use these rules to verify that your driver correctly calls DDIs that are of particular interest to Storport virtual miniport (VMiniport) drivers.

In this section

Topic Description

DoubleExFreePool

This rule verifies that the driver does not attempt to free the same block of pool memory twice.

DoubleKeSetEvent

This rule verifies that KeSetEvent is not called twice on the same event object. If the same event object is passed to the routine, the driver fails the rule.

IoFreeIrp

This rule verifies that an IRP that was allocated by IoAllocateIrp either will be freed by IoFreeIrp or its completion routine will get set by IoSetCompletionRoutine.

StorPortVirtualDevice

This rule verifies that upon exit from the HwStorFindAdapter routine, the VirtualDevice field in the PORT_CONFIGURATION_INFORMATION (Storport) structure has been set to FALSE. The rule applies only to physical StorPort miniports.

StorPortVirtualDevice2

This rule verifies that upon exit from the HwStorFindAdapter routine, the VirtualDevice field in the PORT_CONFIGURATION_INFORMATION (Storport) structure has been set to TRUE. The rule applies only to virtual StorPort miniports.

WithinCriticalRegion

This rule verifies that the driver's calls to certain synchronization functions are made only while normal kernel APC delivery is disabled.

ZwRegistryCreate

This rule verifies that the handle to a registry key created with ZwCreateKey is subsequently used correctly by other ZwXxx routines. The ZwOpenKey routine must not be called on an already open handle. The routines ZwEnumerateKey, ZwEnumerateValueKey, ZwFlushKey, ZwQueryKey, ZwQueryValueKey, ZwSetValueKey, ZwClose, and ZwDeleteKey must not be called on a handle that isn't open. The handle must also be closed before returning.

ZwRegistryOpen

This rule verifies that the handle to the registry key opened via ZwOpenKey is subsequently used correctly by other ZwXxx routines. The routines ZwEnumerateKey, ZwEnumerateValueKey, ZwFlushKey, ZwQueryKey, ZwQueryValueKey, ZwSetValueKey, ZwClose, and ZwDeleteKey must not be called on a handle that isn't open. The handle must also be closed before returning.

To select the VirtualStorport 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 VirtualStorport.

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

    msbuild /t:sdv /p:Inputs="/check:VirtualStorport.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).