驱动程序验证程序Driver Verifier

驱动程序验证程序监视 Windows 内核模式驱动程序和图形驱动程序,目的是检测可能损坏系统的非法函数调用或操作。Driver Verifier monitors Windows kernel-mode drivers and graphics drivers to detect illegal function calls or actions that might corrupt the system. 驱动程序验证程序可将 Windows 驱动程序用于各种强调和测试,以找出不正确的行为。Driver Verifier can subject Windows drivers to a variety of stresses and tests to find improper behavior. 你可以配置要运行的测试,这允许你通过繁重的负载或更精简的测试来放置驱动程序。You can configure which tests to run, which allows you to put a driver through heavy stress loads or through more streamlined testing. 你还可以同时在多个驱动程序或一个驱动程序上运行驱动程序验证程序。You can also run Driver Verifier on multiple drivers simultaneously, or on one driver at a time.

注意

  • 运行驱动程序验证程序可能会导致计算机崩溃。Running Driver Verifier could cause the computer to crash.
  • 只应在用于测试和调试的计算机上运行驱动程序验证程序。You should only run Driver Verifier on computers that you are using for testing and debugging.
  • 您必须是计算机上的管理员组才能使用驱动程序验证程序。You must be in the Administrators group on the computer to use Driver Verifier.
  • 驱动程序验证程序不包含在 Windows 10 中,因此我们建议改为在 Windows 10 上测试驱动程序的行为。Driver Verifier is not included in Windows 10 S, so we recommend testing driver behavior on Windows 10 instead.

在哪里可以下载驱动程序验证程序?Where can I download Driver Verifier?

不需要下载驱动程序验证程序,因为它包含在%WinDir%\system32\ 中的大多数 Windows 版本中,如 Verifier.exe。You don't need to download Driver Verifier, because it is included with most versions of Windows in %WinDir%\system32\ as Verifier.exe. (驱动程序验证程序不包含在 Windows 10 S 中。 ) 驱动程序验证程序不会单独分发为下载包。(Driver Verifier is not included with Windows 10 S.) Driver Verifier is not distributed separately as a download package.

有关 Windows 10 和以前版本的 Windows 的驱动程序验证程序更改的信息,请参阅 驱动程序验证程序:新增功能For information about changes in Driver Verifier for Windows 10 and previous versions of Windows, see Driver Verifier: What's New.

何时使用驱动程序验证程序When to use Driver Verifier

在整个开发和测试驱动程序的过程中运行驱动程序验证程序。Run Driver Verifier throughout development and testing of your driver. 更具体地说,将驱动程序验证程序用于以下目的:More specifically, use Driver Verifier for the following purposes:

  • 若要在开发周期的早期发现问题,更容易且成本更低。To find problems early in the development cycle, when they are easier and less costly to correct.

  • 用于故障排除和调试测试失败和计算机崩溃。For troubleshooting and debugging test failures and computer crashes.

  • 若要在部署驱动程序时监视行为,以便使用 WDK、Visual Studio 和 Windows 硬件实验室工具包 中的测试 (windows HLK) 或 Windows 硬件认证工具包 (Windows 8.1) 。To monitor behavior when you deploy a driver for testing using the WDK, Visual Studio, and the tests from the Windows Hardware Lab Kit (Windows HLK) or Windows Hardware Certification Kit (for Windows 8.1). 有关测试驱动程序的详细信息,请参阅 测试驱动程序For more information about testing drivers, see Testing a Driver.

如何启动驱动程序验证程序How to start Driver Verifier

只应在测试计算机或要测试和调试的计算机上运行驱动程序验证程序。You should only run Driver Verifier on test computers, or on computers that you are testing and debugging. 若要充分利用驱动程序验证程序,你应该使用内核调试器并连接到测试计算机。To get the most benefit from Driver Verifier, you should use a kernel debugger and connect to the test computer. 有关调试工具的详细信息,请参阅 适用于 Windows 的调试工具 (WinDbg,KD,CDB,NTSD) For more information about debugging tools, see Debugging Tools for Windows (WinDbg, KD, CDB, NTSD).

  1. 通过选择 "以 管理员身份运行" 启动 命令提示符 窗口,然后键入 Verifier 以打开 驱动程序验证器管理器Start a Command Prompt window by selecting Run as administrator, and type verifier to open Driver Verifier Manager.

  2. 选择 " (默认任务) 创建标准设置 ,然后选择" 下一步"。Select Create standard settings (the default task), and select Next.

    你还可以选择 " 创建自定义设置 " 从预定义的设置中进行选择,或选择单独的选项。You can also choose Create custom settings to select from predefined settings, or to select individual options. 有关详细信息,请参阅 驱动程序验证程序选项和规则类选择驱动程序验证程序选项For more information, see Driver Verifier options and rule classes and Selecting Driver Verifier Options.

  3. 在 " 选择要验证的驱动程序" 下,选择下表中所述的选择方案之一。Under Select what drivers to verify, choose one of the selection schemes described in the following table.

    选项Option 建议用途Recommended use
    自动选择未签名的驱动程序Automatically select unsigned drivers

    适用于在运行不需要签名驱动程序的 Windows 版本的计算机上进行测试。Useful for testing on computers that are running versions of Windows that do not require signed drivers.

    自动选择为旧版 Windows 构建的驱动程序Automatically select drivers built for older versions of Windows

    用于测试与较新版本的 Windows 的驱动程序兼容性。Useful for testing driver compatibility with newer versions of Windows.

    自动选择在此计算机上安装的所有驱动程序Automatically select all drivers installed on this computer

    提供系统上所测试的驱动程序数量的最大覆盖范围。Provides maximum coverage in terms of the number of drivers that are tested on a system. 对于驱动程序可以与系统上的其他设备或驱动程序交互的测试方案,此选项很有用。This option is useful for test scenarios where a driver can interact with other devices or drivers on a system.

    此选项还可以耗尽适用于 特殊池 和某些资源跟踪的资源。This option can also exhaust the resources available for Special Pool and some resource tracking. 测试所有驱动程序也可能会对系统性能产生不利影响。Testing all drivers can also adversely affect system performance.

    从列表中选择驱动程序名称Select driver names from a list

    在大多数情况下,您需要指定要测试的驱动程序。In most cases, you will want to specify which drivers to test.

    如果选择设备堆栈中的所有驱动程序,则可以使用 增强的 I/o 验证 选项跟踪对象和检查符合性,因为在堆栈中的每个驱动程序之间传递了 i/o 请求数据包 (IRP) ,这允许在检测到错误时提供更详细的信息。Selecting all drivers in a device stack allows the Enhanced I/O Verification option to track objects and check compliance because an I/O request packet (IRP) is passed between each of the drivers in the stack, which allows for a greater level of detail to be provided when an error is detected.

    如果你运行的是用于检测内存损坏或资源跟踪问题的最大资源数,或者如果你想要分配可用于检测内存损坏或资源跟踪问题的最大资源数(如死锁或互斥) (),请选择单个驱动程序。Select a single driver if you are running a test scenario that measures system or driver performance metrics, or if you want to allocate the greatest number of resources available for detecting memory corruption or resource tracking issues (such as deadlocks or mutexes). 当一次使用一个驱动程序时, 特殊池i/o 验证 选项更为有效。The Special Pool and I/O Verification options are more effective when used on one driver at a time.

  4. 如果选择 了 "从列表选择驱动程序名称",请选择 " 下一步",然后选择一个或多个特定驱动程序。If you chose Select driver names from a list, select Next, and then select one or more specific drivers.

  5. 选择 " 完成",然后重新启动计算机。Select Finish, and then restart the computer.

备注

你还可以在命令提示符窗口中运行驱动程序验证程序,而无需启动驱动程序验证程序管理器。You can also run Driver Verifier in a Command Prompt window without starting Driver Verifier Manager. 例如,若要在名为 myDriver.sys 的驱动程序上运行带有标准设置的驱动程序验证程序,可以使用以下命令:For example, to run Driver Verifier with the standard settings on a driver called myDriver.sys, you would use the following command:

verifier /standard /driver myDriver.sys

有关命令行选项的详细信息,请参阅 Driver Verifier 命令语法For more information about command line options, see Driver Verifier Command Syntax.

如何控制驱动程序验证程序How to control Driver Verifier

您可以使用驱动程序验证器管理器或命令行来控制驱动程序验证程序。You can use either Driver Verifier Manager or a command line to control Driver Verifier. 若要启动驱动程序验证程序管理器,请参阅本主题前面的 如何启动驱动程序验证程序To start Driver Verifier Manager, see How to start Driver Verifier, earlier in this topic.

对于以下每项操作,可以使用驱动程序验证器管理器或输入命令行。For each of the following actions, you can use Driver Verifier Manager or enter a command line.

停止或重置驱动程序验证程序To stop or reset Driver Verifier

  1. 驱动程序验证器管理器 中,选择 " 删除现有设置",然后选择 " 完成"。In Driver Verifier Manager, select Delete existing settings, and then select Finish.

    or

    在命令提示符处输入以下命令:Enter the following command at a command prompt:

    verifier /reset
    
  2. 重新启动计算机。Restart the computer.

查看驱动程序验证程序统计信息To view Driver Verifier statistics

  • 在 "驱动程序验证程序管理器" 中 ,选择 "显示有关当前已验证的驱动程序的信息",In Driver Verifier Manager, select Display information about the currently verified drivers, and then select Next. 继续选择 " 下一步 " 将显示其他信息。Continuing to select Next displays additional information.

    or

    在命令提示符处输入以下命令:Enter the following command at a command prompt:

    verifier /query
    

查看驱动程序验证程序设置To view Driver Verifier settings

  • 驱动程序验证器管理器 中,选择 " 显示现有设置",然后选择 " 下一步"In Driver Verifier Manager, select Display existing settings, and then select Next.

    or

    在命令提示符处输入以下命令:Enter the following command at a command prompt:

    verifier /querysettings
    

如何调试驱动程序验证程序冲突How to debug Driver Verifier violations

若要充分利用驱动程序验证程序,你应该使用内核调试器并将其连接到测试计算机。To get the most benefit from Driver Verifier, you should use a kernel debugger and connect it to the test computer. 有关适用于 Windows 的调试工具的概述,请参阅 适用于 windows 的调试工具 (WinDbg,KD,CDB,NTSD) For an overview of debugging tools for Windows, see Debugging Tools for Windows (WinDbg, KD, CDB, NTSD).

如果驱动程序验证程序检测到冲突,则会生成 bug 检查来停止计算机。If Driver Verifier detects a violation, it generates a bug check to stop the computer. 这是为了提供用于调试问题的最大信息。This is to provide you with the most information possible for debugging the issue. 如果已将内核调试器连接到运行驱动程序验证程序的测试计算机,并且 Driver Verifier 检测到冲突,则 Windows 将中断调试器并显示错误的简短说明。When you have a kernel debugger connected to a test computer that is running Driver Verifier, and Driver Verifier detects a violation, Windows breaks into the debugger and displays a brief description of the error.

驱动程序验证程序检测到的所有冲突都将导致 bug 检查。All violations detected by Driver Verifier result in bug checks. 常见的 bug 检查代码包括:Common bug check codes include the following:

有关详细信息,请参阅 在启用驱动程序验证程序时处理 Bug 检查For more information, see Handling a Bug Check When Driver Verifier is Enabled. 有关调试 Bug 检查0xC4 的提示,请参阅 调试 Bug 检查0xC4:驱动程序 _ 验证程序 _ 检测到 _ 冲突For tips about debugging Bug Check 0xC4, see Debugging Bug Check 0xC4: DRIVER_VERIFIER_DETECTED_VIOLATION.

当你启动新的调试会话时,请使用调试器扩展命令 " !分析"。When you start a new debugging session, use the debugger extension command, !analyze. 在内核模式下," !分析 " 命令显示有关最新 bug 检查的信息。In kernel mode, the !analyze command displays information about the most recent bug check. 若要显示 其他 信息,以帮助识别出错的驱动程序,请在 kd> 提示符下向命令添加选项 vTo display additional information, to help identify the faulting driver, add option -v to the command at the kd> prompt:

kd> !analyze -v

除了 !分析 以外,还可以在 kd> 提示符下输入以下调试器扩展,以查看特定于驱动程序验证程序的信息:In addition to !analyze, you can enter the following debugger extensions at the kd> prompt to view information that is specific to Driver Verifier:

  • ! verifier 转储捕获的驱动程序验证程序统计信息。!verifier dumps captured Driver Verifier statistics. 使用 ! verifier-?Use !verifier -? 显示所有可用选项。to display all of the available options.

    kd> !verifier
    
  • !死锁 显示了驱动程序验证程序的死锁检测功能跟踪的锁定或对象的相关信息。!deadlock displays information related to locks or objects tracked by Driver Verifier's deadlock detection feature. 使用 !死锁-?Use !deadlock -? 显示所有可用选项。to display all of the available options.

    kd> !deadlock
    
  • ! iovirp [地址 ]显示与由 i/o 验证程序跟踪的 IRP 相关的信息。!iovirp [address] displays information related to an IRP tracked by I/O Verifier. 例如:For example:

    kd> !iovirp 947cef68
    
  • ! ruleinfo [RuleID ]显示与违反的 DDI 相容性检查规则相关的信息。!ruleinfo [RuleID] displays information related to the DDI compliance checking rule that was violated. (RuleID 始终是 bug 检查的第一个参数。 ) DDI 相容性检查中的所有规则 id 的形式为 0x200 nn(RuleID is always the first argument to the bug check.) All rule IDs from DDI compliance checking are in the form 0x200 nn. 例如:For example:

    kd> !ruleinfo 0x20005
    

驱动程序验证程序:新增功能Driver Verifier: What's New

驱动程序验证程序选项Driver Verifier Options

驱动程序验证程序命令语法Driver Verifier Command Syntax

使用驱动程序验证程序Using Driver Verifier

控制驱动程序验证程序Controlling Driver Verifier