1 out of 1 rated this helpful - Rate this topic

Using the Framework's Verifier

The framework provides a code verifier that you can use while the driver is running. The verifier extensively validates your driver's state and the arguments that the driver passes to framework object methods. You can use the framework's verifier by itself or together with the general-purpose Driver Verifier tool.

In kernel mode, the framework's verifier checks lock acquisition and hierarchies, ensures that calls to the framework occur at the correct IRQL, verifies correct I/O cancellation and queue usage, and ensures that the driver and framework follow the documented contracts. It can also simulate low-memory and out-of-memory conditions and test a driver's response to these situations to determine whether the driver responds properly without crashing, hanging, or failing to unload.

Enabling and Disabling the Framework's Verifier

By default, the framework's verifier is disabled because its extensive checks can decrease system performance. During testing, you should enable the verifier before you load your driver. Enabling the framework's verifier does not require a system reboot, unlike enabling the Driver Verifier.

To enable the framework's verifier, perform the following steps:

  1. If your driver is already loaded, use Device Manager to disable the device. Disabling the device causes the driver to be unloaded.
  2. Use RegEdit to set VerifierOn to a nonzero value in the driver's Parameters\Wdf subkey of the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services key in the Windows registry. A nonzero value indicates that the framework's verifier is enabled.

    You may need to add VerifierOn manually to the subkey if it is not already present.

  3. Use Device Manager to reenable the device, thereby loading the driver.
It is not necessary to reboot the system after you enable the framework's verifier. To disable the framework's verifier, follow the same steps, but set the value of VerifierOn to zero.

If your driver has been built with version 1.9 or a later version of the framework and you run the Driver Verifier tool, the framework's verifier automatically runs at the same time.

If your driver was built with a version of the framework earlier than version 1.9, the framework's verifier runs only if you create a VerifierOn registry value and set it to a nonzero value. The framework's verifier does not automatically run when the Driver Verifier tool runs.

After your driver is loaded, you can use the !wdfdriverinfo debugger extension command to determine whether the framework's verifier is enabled:

!wdfkd.wdfdriverinfo <your drivername> 0x1

For more information about the debugger extension commands, see Debugger Extensions for Framework-based Drivers.

Controlling the Verifier's Behavior

When the framework's verifier is used, you can control the verifier's behavior by modifying the following registry values under the Parameters\Wdf subkey:

VerifyOn

Set this value to a nonzero value to enable the WDFVERIFY macro.

DbgBreakOnError

If this value is set to a nonzero value, the framework will break into the debugger (if available) each time that a driver calls WdfVerifierDbgBreakPoint.

VerifierAllocateFailCount

If this value is set to a value n, the framework fails every attempt to allocate memory for the driver's objects after the nth allocation.

TrackHandles

If this value is set to a list of one or more type names of framework object handles, the framework tracks references to all object handles that match the specified handle types.

EnhancedVerifierOptions

Contains a bitmap that you can use to enable optional features of the framework's verifier.

VerifyDownLevel

If set to a nonzero value, and if the driver was built with a version of the framework that is older than the current version, the framework's verifier includes tests that were added after the driver was built.

For more information about these registry values, see Registry Values for Debugging Framework-based Drivers.

For information about an automated way to control these registry values and use the code verifier, see WDF Verifier Control Application.

 

 

Send comments about this topic to Microsoft

Build date: 4/5/2012

Did you find this helpful?
(1500 characters remaining)