Windows Drivers Documentation

Driver Verification

Driver verification is a crucial process in the development lifecycle of Windows drivers. It ensures that your driver adheres to Microsoft's quality, stability, and security standards before it is deployed to end-users. This section guides you through the essential steps and tools involved in driver verification.

Tip: Proactive verification throughout the development process can save significant debugging time and prevent critical issues later on.

Why Driver Verification is Important

Key Verification Tools and Techniques

1. Static Analysis

Static analysis tools examine your driver's source code without executing it to identify potential bugs, security flaws, and code style violations.

Using Static Driver Verifier (SDV)

SDV works by defining verification rules that describe common driver programming patterns. You can run SDV on your driver project from the command line or through its integration with Visual Studio.

Basic Command-Line Usage:

sdv /check:Driver /config:sdv_config.xml driver.sys

The sdv_config.xml file specifies the rules and configurations for the verification run. Consult the official SDV documentation for detailed configuration options.

2. Dynamic Analysis (Runtime Verification)

Dynamic analysis involves running your driver on a test system and monitoring its behavior to detect runtime errors.

Important: Always run Driver Verifier on a test machine, not your primary development machine. A driver bug detected by Driver Verifier can easily lead to a system crash.

Enabling Driver Verifier

You can enable Driver Verifier using the verifier.exe utility or through the registry.

Using verifier.exe:

  1. Open an elevated Command Prompt.
  2. Type verifier and press Enter.
  3. Select "Create custom settings" and click Next.
  4. Choose the checks relevant to your driver. For comprehensive testing, consider selecting "Standard checks" and then enabling "I/O verification" and "Deadlock detection".
  5. Select "Select driver(s) to verify" and add your driver's image file.
  6. Click OK and restart your system.

3. Code Reviews

Peer code reviews are an effective way to catch logic errors, security flaws, and adherence to coding standards that automated tools might miss.

4. Testing

Rigorous testing is essential to ensure your driver functions correctly in real-world scenarios.

Driver Signing and Certification

For a driver to be installed on most Windows systems without user intervention, it needs to be digitally signed. The Windows Hardware Compatibility Program (WHCP) provides a framework for testing and certifying drivers, ensuring they meet Microsoft's quality standards. Drivers that pass WHCP testing can be signed with a Microsoft-provided signature, allowing for a smoother installation experience.

Steps to WHCP Submission:

  1. Ensure your driver passes all static and dynamic verification checks.
  2. Run the Windows HLK (Hardware Lab Kit) or HCK (Hardware Certification Kit) tests relevant to your driver.
  3. Submit your driver package to the Windows Hardware Dev Center dashboard for signing.
Tip: Familiarize yourself with the latest WHCP requirements and test plans before starting the submission process.