共用方式為


Driver Annotations

Driver annotations enhance the ability of PFD to find some very specific types of errors in driver source code. Driver annotations are intended to complement the general-purpose annotations. The driver annotations are defined in Driverspecs.h and begin with the prefix __drv.

Driver annotation Usage

__drv_at(arg, anno_list) __drv_arg(arg, anno_list)__drv_deref(anno_list) __drv_fun(anno_list) __drv_in(anno_list)__drv_in_deref(anno_list)__drv_out(anno_list)__drv_out_deref(anno_list)__drv_ret(anno_list)__drv_at(expr, anno_list)

Basic driver annotations

Annotation expressions

__drv_when(cond, anno_list)

Conditional annotations

__drv_valueIs(list)

Function result annotations

__drv_strictTypeMatch(mode)__drv_strictType(typename, mode)

Type annotations

__drv_notPointer__drv_isObjectPointer

Pointer annotations

__drv_constant__drv_nonConstant

Constant and nonconstant parameter annotations

__drv_formatString(kind)

Format string annotations

__drv_preferredFunction(name, reason)__drv_reportError(string)

Diagnostic annotations

__drv_inTry __drv_notInTry

Annotations for functions in __try statements

__drv_allocatesMem(type)__drv_freesMem(type)__drv_aliasesMem

Memory annotations

__drv_acquiresResource(kind)__drv_releasesResource(kind)__drv_acquiresResourceGlobal(kind, param)__drv_releasesResourceGlobal(kind, param)__drv_acquiresCriticalRegion__drv_releasesCriticalRegion__drv_acquiresCancelSpinLock__drv_releasesCancelSpinLock__drv_mustHold(kind)__drv_neverHold(kind)__drv_mustHoldGlobal(kind, param)__drv_neverHoldGlobal(kind, param)__drv_mustHoldCriticalRegion__drv_neverHoldCriticalRegion__drv_mustHoldCancelSpinLock__drv_neverHoldCancelSpinLock__drv_acquiresExclusiveResource(kind)__drv_releasesExclusiveResource(kind)__drv_acquiresExclusiveResourceGlobal(kind, param)__drv_releasesExclusiveResourceGlobal(kind, param)

Nonmemory resource annotations

__drv_functionClass

Function class annotations

__drv_floatSaved__drv_floatRestored

__drv_floatUsed

Floating point annotations

__drv_maxIRQL(value)__drv_minIRQL(value)__drv_setsIRQL(value)__drv_requiresIRQL(value)__drv_raisesIRQL(value)__drv_savesIRQL__drv_restoresIRQL__drv_savesIRQLGlobal(kind, param)__drv_restoresIRQLGlobal(kind, param)__drv_minFunctionIRQL(value)__drv_maxFunctionIRQL(value)__drv_sameIRQL__drv_isCancelIRQL

IRQL annotations

__drv_clearDoInit

DO_DEVICE_INITIALIZING annotation

__drv_interlocked

Annotations for interlocked operands

 

 

 

Send comments about this topic to Microsoft

Build date: 5/3/2011