共用方式為


General-Purpose Annotations

The general-purpose annotations provide the analysis tools with information about the information flow between a caller and the function that is being called. This information is related to both the direction that the information flows and the size and type that can be checked to detect potential buffer overflows.

You can use the general-purpose annotations in both driver and nondriver code. General-purpose annotations are defined in Specstrings.h and described with extensive comments in Specstrings_strict.h. Both files are in the  \inc\api subdirectory of the WDK.

This section provides guidelines and examples for using the general-purpose annotations and modifiers.

General-purpose annotation Usage

__in__out

__inout

Input and Output Parameter Annotations

_opt_deref

Annotation Modifiers

_ecount(size)_bcount(size)

Buffer Annotations

_full(size)_part(size, length)

Buffer Annotations

__nullterminated__nullnullterminated__possibly_notnullterminated

String annotations

__reserved

Reserved Parameters

__checkReturn

Function Return Annotations

__success(expr)__failure(expr)

Success and Failure Annotations

 

PFD does not interpret certain annotations such as __fallthrough, but these can still be useful when they are applied as comments in code. See the comments in Specstrings_strict.h for a complete list of annotations.

 

 

Send comments about this topic to Microsoft

Build date: 5/3/2011