Menu

Application Verifier can be used via the UI or by using command line options. Following are examples of how to use the command line (below are the details):

To quickly enable Application Verifier for Handles, Heap, Lock, Exceptions, TLS, and Memory:

Copy Code
appverif /verify TARGET [/faults [PROBABILITY [TIMEOUT [DLL �]]]]
appverif /verify notepad
appverif -enable LAYER � -for TARGET ... [-with [LAYER].PROPERTY=[VALUE] �] 
appverif -disable LAYER ... -for TARGET ...
appverif -query LAYER ... -for TARGET ...
appverif �configure STOP ... -for TARGET ... [-with STOPPROPERTY=[VALUE] �]
appverif �logtofile {enable|disable}

To enable Application Verifier for a specific verification layer for two applications:

Copy Code
appverif �enable Heaps Locks �for notepad.exe iexplore.exe 

To enable two layers named X and Y for target test.exe with properties X.DebugLevel and Y.DebugLevel:

Copy Code
appverif �enable X Y �for test.exe �with X.DebugLevel=1 Y.DebugLevel=2 

To disable all checks run on an application:

Copy Code
appverif -disable * -for notepad.exe

OR

Copy Code
appverif -delete settings -for notepad.exe 

To globally enable or disable Application Verifier logging for all processes:

Copy Code
appverif �logtofile enable
appverif �logtofile disable

Logging is enabled by default for all processes.

Following are the details on running Application Verifier using the command line.

Command Line Syntax

The command line syntax accepts one or more layers and applies them to one or more targets with optional property specifiers for layers.

Copy Code
appverif -enable LAYER ... -for TARGET ... [-with [LAYER].PROPERTY=[VALUE] �] 
appverif -disable LAYER ... -for TARGET ...
appverif -query LAYER ... -for TARGET ...
appverif �configure STOP ... -for TARGET ... [-with STOPPROPERTY=[VALUE] �]

where:

  • LAYER is a standard name for a verification layer. If a new verifier provider is installed then this will expose a new verification layer name to be used in the command line. Current layers are:

    • Heap

    • Locks

    • Handles

    • Etc.

    You can set LAYER to * to specify that the command applies to all layers.

  • TARGET is a binary name (e.g. notepad.exe). This is a static setting that is persisted in the registry and will be taken into consideration whenever the application is started. For the appverif �disable command, you can set TARGET to * to specify that all targets should be disabled.

  • PROPERTY is property name specific to the LAYER mentioned in the command line. For example, the Handles layer has traces as property.

  • VALUE is a value for the property. The type of the value depends on the type associated with the property and it will be enforced. The supported types for now are: boolean (true/false), integer (decimal/octal/hex in C notation), string and multi-string (containing `\0� between strings and being terminated by `\0\0�). If VALUE is not specified it means the user wants to delete that property and revert behavior to the default value for the property.

  • STOP is the number (decimal or hex in C notation) of the verifier stop issue to be configured. The stop codes must be unique (no two layers can use the same stop code therefore the tool itself will determine to what layer the stop belongs to)

  • STOPPROPERTY is a property name that is acceptable for verifier stops. If the value is not specified it is assumed the property must be deleted. Right now the allowed properties for stops are (See Configuring Verifier Stops below for more details):

    • ErrorReport

    • Severity

    • Flavor

The properties can be optionally qualified by the layer they belong to. However, this is not needed if command line enables just one layer. For example, to enable two layers named X and Y for target test.exe with properties X.DebugLevel and Y.DebugLevel the command is:

Copy Code
appverif �enable X Y �for test.exe �with X.DebugLevel=1 Y.DebugLevel=2 

However if layer X is enabled, then an unqualified property name can be used:

Copy Code
appverif �enable X �for test.exe �with DebugLevel=1 

The separator character between property name and value can be `=� (equal sign) or `:� (colon).

Miscellaneous commands

Copy Code
appverif �query providers 
appverif �delete logs �for TARGET ...
appverif �delete settings �for TARGET ... 

Wipe out completely TARGET from registry.

Copy Code
appverif �stamp log �for Target �with Stamp=�LOG_STAMP�[Log= RELATIVE_TO_LAST_INDEX] 

This command will stamp the log with LOG_STAMP. This stamp is useful to identify only a section of a log as relevant when viewing the log in XML form.

Copy Code
appverif �export log �for TARGET �with To=XML_FILE[Symbols=SYMBOL_PATH][Stamp=LOG_STAMP][StampTo=LOG_STAMP][Log=RELATIVE_TO_LAST_INDEX] 

The command above will export a binary log to an xml file. The optional Stamp property is used to identify which part of the log should be exported to XML. If not specified then the entire log will be converted. The Log property has a negative integer as possible value and signifies what log file should be converted starting from last one (assumed if property is not present). For example, launch notepad.exe three times in a row. To access the first log created, specify Log=-2 in the command line.

Shortcuts for Command Line

Following are shortcuts:

Copy Code
appverif /verify TARGET [/faults [PROBABILITY [TIMEOUT [DLL �]]]] 

where:

  • TARGET has the same meaning as described above.

  • PROBABILITY is the probability to inject faults. Must be a value in the range 0..1000000. If not specified the default value is 5%.

  • TIMEOUT is the time interval in milliseconds during process startup when fault injection does not happen. This is done to allow the process to properly startup before faults happen. If not specified the value is 500 msecs.

  • DLL is the name of module that gets loaded in the process. Typically this is the name of a dynamic library (extension .dll) but can be an ActiveX (extension .ocx) or some other loadable module.

Examples:

Copy Code
appverif /verify notepad.exe /faults 100000 1000 msvcrt.dll 

Enable fault injection for notepad.exe (whenever it will be launched). Faults should happen with probability 10%, only 1000 msecs after process got launched and only for operations initiated from msvcrt.dll.

Enabling Fault Injection details

Using the /faults command line will enable fault injection just for OLE_ALLOC and HEAP_ALLOC. However, you can use the command line to configure which type of fault injection you want to turn on. For example, if you want to inject fault into a registry or file API as 2%, use the command line:

Copy Code
appverif -enable lowres -for hello.exe -with registry=20000 file=20000

Another example:

Copy Code
appverif -query lowres -for hello.exe

Settings for hello.exe:

Test [lowres] enabled.

Copy Code
Include = *
Exclude =
TimeOut = 2000 (0x7D0)
WAIT = 0 (0x0)
HEAP_ALLOC = 20000 (0x4E20)
VIRTUAL_ALLOC = 0 (0x0)
REGISTRY = 20000 (0x4E20)
FILE = 20000 (0x4E20)
EVENT = 0 (0x0)
MAP_VIEW = 0 (0x0)
OLE_ALLOC = 20000 (0x4E20)
STACKS = false

Configuring Verifier Stops

Using the command line (or user interface) you can configure verifier stops. Following are examples to leverage:

Copy Code
Appverif -configure STOP ... -for TARGET ... -with PROPERTY=VALUE ...

STOP is stop code such as 0x200 0x201

TARGET is application name such as foo.exe

PROPERTY can be one of the �ErrorReport�, �Severity�, and �Flavor�

For the ErrorReport , VALUE can be the combination of the following values.

0x00000001 means the stop is active. (If this bit is zero, it means the stop is disabled)

0x00000020 means the stop will break into debugger using a breakpoint.

0x00000040 means the stop break into debugger by generating a Verifier Exception.

0x00000080 means the stop will be logged in the log file.

0x00000100 means the stack trace for this stop will be logged in the log file.

For the Severity , VALUE can be one of followings.

0x00000003 Informative stop.

0x0000000F Warning.

0x0000003F Error.

For the Flavor , Value can be the combination of the following values.

0x00000002 Non-continuable stop.

0x00000010 This stop will only appear one time. It will be ignored the following time within the test run.

For example, disable stops 0x2700, 0x2701 for foo.exe

Copy Code
Appverif �configure 0x2700 0x2701 �for foo.exe �with ErrorReport=0

Configure stop code 0x2700 as breaking into debugger (it�s off by default), saving a log without stack trace, and make it non-continuable

Copy Code
Appverif �configure 0x2700 �for foo.exe �with ErrorReport=0xA1 Flavor=0x2