Static Driver Verifier commands (MSBuild)

You can run Static Driver Verifier (SDV) in a Visual Studio Command Prompt window. Navigate to the directory where the driver's project file or the library's project file is stored. The parameters can appear in any order on the command line.

Note  Previously available in the Windows Driver Kit (WDK) as a stand-alone tool, SDV is now integrated into Visual Studio and can be run as an MSBuild target, or from the Driver menu in Visual Studio.


msbuild /t:sdv /p:Inputs="Parameters" ProjectFile /p:Configuration=configuration /p:Platform=platform     


You must select a Release configuration (for example, /p:Configuration="Windows 7 Release"). For the list of supported Release Configurations, see Building a Driver. The Platform can be Win32 (for x86) or x64 (for example, /p:Platform=Win32).

Note  Be sure to check your computer's power management plan to ensure the computer will not go into a sleep state during the analysis.

Parameters

/scan

Scans the driver's source code for function role type declarations. For information about how to declare the driver supplied callback functions and dispatch routines, see Using Function Role Type Declarations. During this scan, SDV tries to detect the driver entry points that it needs to verify the driver. It records the results of the scan in Sdv-map.h, a file that it creates in the driver's project directory.

For more information, see Preparing your source code.

/check:Rule | [Rule,...]

Starts a verification with the specified rule(s). You can specify more than one rule by enclosing the list of rules in square brackets and separating each rule with a comma. Run the /check: command and specify the driver's Visual Studio project file (*.vcxproj).

Rule is the name of one rule or a rule name pattern that includes wildcard characters (*) to represent one or more characters. When used alone, the wildcard character (*) represents all rules.

/check:RuleList.sdv

Starts a verification with the rules in the specified rule list file. You can list only one file with this parameter. In the rule list file, each line can be the name of one rule or it can be a wildcard character (*), which represents all SDV rules. You can also use the wildcard character (*) in a rule name to mean any character or characters. Run /check:RuleList.sdv command and specify the driver's Visual Studio project file (*.vcxproj).

RuleList.sdv is the fully qualified path and file name of a rule list file. The file must have the .sdv file name extension. Unless the file is in the local directory, the path is required. If the path or file name includes spaces, you must enclose RuleList.sdv in quotation marks.

If you specify the /check: option without specifying a rule, SDV runs with the default rule set for the driver model.

/refine

If SDV directs you to use this option, /refine performs a per entry verification for the rule or rules you had specified. The /refine option partitions the verification process into groups of related entry points. This allows SDV to produce useful results for larger drivers. SDV automatically generates a rule file called Refine.sdv in the same directory as your project. This file contains those rules which might benefit from further verification. Follow the instructions SDV provides in the results summary and continue the analysis.

/lib

Processes the library in the current directory. SDV calls MSBuild.exe to compile and build the library for external use, and it generates the files that it needs to include the library in the driver verification.

Use this parameter before verifying drivers that require the library. Run the msbuild /t:sdv /p:Inputs="/lib" command and specify the Visual Studio project file (*.vcxproj) for the library.

For more information about the use and effect of the /lib parameter, see Library Processing in Static Driver Verifier.

/view

Opens Static Driver Verifier. Run /view commands and specify the driver's Visual Studio project file (*.vcxproj).

The results are available as soon as a verification is complete, and remain available until you use a /clean command to delete the SDV files from the driver's project directory.

/clean

Deletes SDV files from the directory. Because these files are used to generate the Static Driver Verifier Report display, the /clean command also deletes the report of the verification.

Run a /clean command and specify the Visual Studio project file (*.vcxproj) for the driver or library. The command deletes SDV files only for the project specified.

Run a /clean command for a driver project before each verification.

Run a /clean command for a library when the library files are outdated, such as when the library code changes.

A /clean command does not remove the Sdv-map.h file, if the approved flag is set to true in the Sdv-map.h file (Approved=true). SDV can then use this file for future verifications.

/cleanalllibs

Deletes the library-processing files that SDV created in all directories on the computer's hard disk drives. It does not affect driver data.

You can run a /cleanalllibs command in any directory of the build environment window.

Use this parameter to remove all library processing files that SDV created or when the code in several libraries has changed. For more information, see Library Processing in Static Driver Verifier.

/?

Displays usage for SDV commands. Commands that use this parameter do not have to be run in a build environment window.

Comments

Running msbuild /t:/sdv p:/Inputs=”/?” without parameters displays usage for the SDV commands.

A /clean command deletes the files that SDV uses to create the Static Driver Verifier Report display for a verification. After running this command, the Static Driver Verifier Report display for the verification is no longer available.

Examples

To run SDV using all rules on the driver files in the local directory for the mydriver project:

msbuild /t:sdv /p:Inputs="/check:*" mydriver.VcxProj /p:Configuration="Windows 7 Release"/p:Platform=Win32

To run SDV using all rules that begin with "Irql" on the driver files in the local directory:

msbuild /t:sdv /p:Inputs="/check:Irql*" mydriverVcxProj /p:Configuration="Windows 7 Release" /p:Platform=Win32


To run SDV using the CancelSpinLock rule on the driver files in the local directory:

msbuild /t:sdv /p:Inputs="/check:CancelSpinLock" mydriver.VcxProj /p:Configuration="Windows 7 Release" /p:Platform=Win32

To run SDV using the rule that is specified in the Rules1.sdv rule list file in the D:\SDV directory:

msbuild /t:sdv /p:Inputs="/check:D:\SDV\Rules1.sdv" mydriver.VcxProj /p:Configuration="Windows 7 Release" /p:Platform=Win32

To run SDV again, this time using the /clean option.

msbuild /t:sdv /p:Inputs="/clean" mydriver.VcxProj /p:Configuration="Windows 7 Release"/p:Platform=Win32

To run SDV, using the /refine option (if SDV directs you to do so).

msbuild /t:sdv /p:Inputs="/refine" mydriver.VcxProj /p:Configuration="Windows 7 Release"/p:Platform=Win32

To display Static Driver Verifier so that you can view the results for the most recent verification of the driver in the local directory:

msbuild /t:sdv /p:Inputs="/view" mydriver.VcxProj /p:Configuration="Windows 7 Release" /p:Platform=Win32

Related topics

Using Static Driver Verifier to Find Defects in Windows Drivers

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft