Code Analysis for Windows Drivers is an extension of the C/C++ Code Analysis tool included with Visual Studio. In previous versions of the WDK, the driver-specific module for code analysis was part of a standalone tool called PREfast for Drivers (PFD).
The Code Analysis for Drivers tool is a compile-time static verification tool that detects errors missed by the compiler and by conventional runtime testing. It detects common coding errors in C and C++ programs, and is designed to detect errors in kernel-mode driver code. You can run Code Analysis for Drivers very early in the development cycle—as soon as the code compiles correctly. The Code Analysis tool for Drivers supports a large vocabulary of SAL annotations beyond those supported for the C/C++ Code Analysis tool, including annotations for IRQLs, resource-object leaks, memory leaks, and stricter type checking.
Code Analysis for Drivers examines each function in the code independently, looking for common driver errors and unwise coding practices. Code Analysis for Drivers runs quickly, even on larger drivers, and generates a report that identifies the line of driver code with the suspected error.
Code Analysis for Drivers supports Windows Vista and later versions of Windows and is designed to analyze code written for x86-based and x64-based platforms. It can analyze C and C++ source files for drivers in any driver model, including managed code.
You should use Code Analysis for Drivers in conjunction with Driver Verifier, Static Driver Verifier, and the checked build of Windows to ensure that your driver code is safe and reliable.
Code Analysis for Drivers is provided in the Windows Driver Kit (WDK).
What’s New for Code Analysis for Drivers in Windows 8
High Quality Drivers and WDK Samples
For Windows 8, all Microsoft drivers that ship with the operating system and all WDK samples have been verified with the Code Analysis for Drivers tool, and identified defects have been fixed. In addition, the WDK public header files are now annotated with SAL 2 annotations to enable the code analysis tools to better find code defects.