Düzenle

Aracılığıyla paylaş


Locking rule set (NDIS)

Use these rules to verify that your driver correctly manages shared resources.

In this section

Topic Description

SpinLock

The SpinLock rule verifies the correct use of the NDIS spin lock interface. This rule specifies that calls to NdisAcquireSpinLock are made only when the SpinLock is in the unlocked state. This rule also verifies that the SpinLock is released before the miniport handler routine exits.

SpinLockBalanced

The SpinLockBalanced rule verifies that the number of calls to functions that acquire a SpinLock are equal to the number of calls to functions that release the same SpinLock.

SpinLockDpr

The SpinLockDpr rule verifies the correct use of the NDIS spin lock interface.

This rule specifies that calls to NdisDprAcquireSpinLock are made only when the spin lock is in the unlocked state. This rule also verifies that the spin lock is released before the miniport handler routine exits.

SpinLockDprRelease

The SpinLockDprRelease rule verifies that calls to NdisAcquireSpinLock or NdisDprAcquireSpinLock are called only when the SpinLock is the "unlocked" state. This rule also checks that before exiting the miniport handler routine the SpinLock has been release.

SpinLockRelease

The SpinLockRelease rule specifies that a driver must not release a spin lock (NdisReleaseSpinLock) without first acquiring it.

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

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

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