PREfast for Drivers

PREfast for Drivers (Prefast.exe) is a static source code analysis tool that detects certain classes of errors not easily found by the typical compiler. PREfast for Drivers includes PREfast, a component that detects common basic coding errors in C and C++ programs, and a specialized driver module that is designed to detect errors in kernel-mode driver code.

PREfast analyzes C and C++ source code by stepping through all possible execution paths in each function and simulating execution to evaluate each path for problems. PREfast does not actually execute code and cannot find all possible errors, but it can find errors that the compiler may ignore and that may be difficult to find during debugging.

PREfast for Drivers checks for driver-specific issues such as correct interrupt request level (IRQL), use of preferred driver routines, misuse of driver routines, and more aggressive checking of memory leaks and leaks of other resources such as locks. PREfast for Drivers supports analysis of code that uses annotations to provide PREfast with information about the intended use of an annotated function, which allows PREfast to better determine whether a particular bug exists.

PREfast for Drivers is provided in the Microsoft Windows Server 2003 SP1 DDK and the Windows Driver Kit (WDK).

General PREfast
White PaperHow to Use Function typedefs in C++ Driver Code to Improve PREfast Results
White PaperPREfast Annotations
White PaperPREfast Step-by-Step (V8.0)
WHDC Portal/NodalStatic Driver Verifier
OtherDeveloping Drivers with Windows Driver Foundation by Orwick and Smith
Comprehensive Guide from Microsoft Press

Static Analysis Tools - WinHEC 2007
Microsoft Powerpoint (.ppt)Static Analysis and Verification of Drivers [WinHEC 2007; 8.6 MB]
Microsoft Powerpoint (.ppt)Static Analysis Tools: PREfast for Drivers [WinHEC 2007; 1.2 MB]

Static Tools for Driver Development - WHDC Labs
DownloadablePREfast for Drivers: WHDC Lab [388 KB]
DownloadableStatic Driver Verifier for KMDF Drivers: WHDC Lab [242 KB]
DownloadableStatic Driver Verifier for WDM Drivers: WHDC Lab [366 KB]


Looking for help with your personal computer?