共用方式為


Format String Annotations

Use the __drv_formatString annotation to indicate that the annotated parameter is a format string for printf or scanf. This annotation has the following syntax:

__drv_formatString(kind)
  • kind
    Specifies the format of the format string: printf or scanf.

Comment

The __drv_formatString annotation causes PFD to confirm that the argument list matches the format string and that potentially dangerous combinations are avoided.

For example, the following annotation indicates that format is a format string for printf:

int _snprintf(
   __out_ecount(count) __possibly_notnullterminated LPSTR buffer,
   __in size_t count,
   __in __drv_in(__drv_formatString(printf)) LPCSTR *format
   [, argument] ... 
);

 

 

Send comments about this topic to Microsoft

Build date: 5/3/2011