|
|
|
| 1 |
|
#ifndef SPECSTRINGS_H |
| 2 |
|
#define SPECSTRINGS_H |
| 3 |
|
/************************************************************************* |
| 4 |
|
* See specstrings_strict.h for documentation of all user visible macros. |
| 5 |
|
*************************************************************************/ |
| 6 |
|
#if _MSC_VER |
| 7 |
|
#pragma once |
| 8 |
|
#endif |
| 9 |
|
#include <sal.h> |
| 10 |
|
|
| 11 |
|
#ifndef __SAL_H_FULL_VER |
| 12 |
|
#define __SAL_H_FULL_VER 140050727 |
| 13 |
|
#endif |
| 14 |
|
|
| 15 |
|
#ifdef __cplusplus |
| 16 |
|
extern "C" { |
| 17 |
|
#endif |
| 18 |
|
|
| 19 |
|
/* version specific fixes to bring sal.h upto date */ |
| 20 |
|
#if __SAL_H_FULL_VER <= 140050727 |
| 21 |
|
|
| 22 |
|
/* Missing from RTM sal.h */ |
| 23 |
|
#if !defined(__midl) && defined(_PREFAST_) && _MSC_VER >= 1000 |
| 24 |
|
|
| 25 |
|
#define __inexpressible_readableTo(size) __declspec("SAL_readableTo(inexpressibleCount('" SPECSTRINGIZE(size) "'))") |
| 26 |
|
#define __inexpressible_writableTo(size) __declspec("SAL_writableTo(inexpressibleCount('" SPECSTRINGIZE(size) "'))") |
| 27 |
|
#define __inner_bound __declspec("SAL_bound") |
| 28 |
|
#define __inner_range(lb,ub) __declspec("SAL_range(" SPECSTRINGIZE(lb) "," SPECSTRINGIZE(ub) ")") |
| 29 |
|
#define __inner_assume_bound_dec __inline __nothrow void __AssumeBoundInt(__post __inner_bound int i) {i;} |
| 30 |
|
#define __inner_assume_bound(i) __AssumeBoundInt(i); |
| 31 |
|
#define __inner_allocator __declspec("SAL_allocator") |
| 32 |
|
#else |
| 33 |
|
#define __inexpressible_readableTo(size) |
| 34 |
|
#define __inexpressible_writableTo(size) |
| 35 |
|
#define __inner_bound |
| 36 |
|
#define __inner_range(lb,ub) |
| 37 |
|
#define __inner_assume_bound_dec |
| 38 |
|
#define __inner_assume_bound(i) |
| 39 |
|
#define __inner_allocator |
| 40 |
|
#endif |
| 41 |
|
|
| 42 |
|
#define __xcount(size) __notnull __inexpressible_writableTo(size) |
| 43 |
|
#define __in_xcount(size) __in __pre __inexpressible_readableTo(size) |
| 44 |
|
#define __out_xcount(size) __xcount(size) __post __valid __refparam |
| 45 |
|
#define __out_xcount_part(size,length) __out_xcount(size) __post __inexpressible_readableTo(length) |
| 46 |
|
#define __out_xcount_full(size) __out_xcount_part(size,size) |
| 47 |
|
#define __inout_xcount(size) __out_xcount(size) __pre __valid |
| 48 |
|
#define __inout_xcount_part(size,length) __out_xcount_part(size,length) __pre __valid __pre __inexpressible_readableTo(length) |
| 49 |
|
#define __inout_xcount_full(size) __inout_xcount_part(size,size) |
| 50 |
|
#define __xcount_opt(size) __xcount(size) __exceptthat __maybenull |
| 51 |
|
#define __in_xcount_opt(size) __in_xcount(size) __exceptthat __maybenull |
| 52 |
|
#define __out_xcount_opt(size) __out_xcount(size) __exceptthat __maybenull |
| 53 |
|
#define __out_xcount_part_opt(size,length) __out_xcount_part(size,length) __exceptthat __maybenull |
| 54 |
|
#define __out_xcount_full_opt(size) __out_xcount_full(size) __exceptthat __maybenull |
| 55 |
|
#define __inout_xcount_opt(size) __inout_xcount(size) __exceptthat __maybenull |
| 56 |
|
#define __inout_xcount_part_opt(size,length) __inout_xcount_part(size,length) __exceptthat __maybenull |
| 57 |
|
#define __inout_xcount_full_opt(size) __inout_xcount_full(size) __exceptthat __maybenull |
| 58 |
|
#define __deref_xcount(size) __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __inexpressible_writableTo(size) |
| 59 |
|
#define __deref_in __in __pre __deref __deref __readonly |
| 60 |
|
#define __deref_in_ecount(size) __deref_in __pre __deref __elem_readableTo(size) |
| 61 |
|
#define __deref_in_bcount(size) __deref_in __pre __deref __byte_readableTo(size) |
| 62 |
|
#define __deref_in_xcount(size) __deref_in __pre __deref __inexpressible_readableTo(size) |
| 63 |
|
#define __deref_out_xcount(size) __deref_xcount(size) __post __deref __valid __refparam |
| 64 |
|
#define __deref_out_xcount_part(size,length) __deref_out_xcount(size) __post __deref __inexpressible_readableTo(length) |
| 65 |
|
#define __deref_out_xcount_full(size) __deref_out_xcount_part(size,size) |
| 66 |
|
#define __deref_out_xcount(size) __deref_xcount(size) __post __deref __valid __refparam |
| 67 |
|
#define __inout_xcount_opt(size) __inout_xcount(size) __exceptthat __maybenull |
| 68 |
|
#define __inout_xcount_part_opt(size,length) __inout_xcount_part(size,length) __exceptthat __maybenull |
| 69 |
|
#define __inout_xcount_full_opt(size) __inout_xcount_full(size) __exceptthat __maybenull |
| 70 |
|
#define __deref_xcount(size) __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __inexpressible_writableTo(size) |
| 71 |
|
#define __deref_in __in __pre __deref __deref __readonly |
| 72 |
|
#define __deref_in_ecount(size) __deref_in __pre __deref __elem_readableTo(size) |
| 73 |
|
#define __deref_in_bcount(size) __deref_in __pre __deref __byte_readableTo(size) |
| 74 |
|
#define __deref_in_xcount(size) __deref_in __pre __deref __inexpressible_readableTo(size) |
| 75 |
|
#define __deref_out_xcount(size) __deref_xcount(size) __post __deref __valid __refparam |
| 76 |
|
#define __deref_out_xcount_part(size,length) __deref_out_xcount(size) __post __deref __inexpressible_readableTo(length) |
| 77 |
|
#define __deref_out_xcount_full(size) __deref_out_xcount_part(size,size) |
| 78 |
|
#define __deref_out_xcount(size) __deref_xcount(size) __post __deref __valid __refparam |
| 79 |
|
#define __deref_inout_xcount(size) __deref_inout __pre __deref __inexpressible_writableTo(size) __post __deref __inexpressible_writableTo(size) |
| 80 |
|
#define __deref_inout_xcount_part(size,length) __deref_inout_xcount(size) __pre __deref __inexpressible_readableTo(length) __post __deref __inexpressible_readableTo(length) |
| 81 |
|
#define __deref_inout_xcount_full(size) __deref_inout_xcount_part(size,size) |
| 82 |
|
#define __deref_xcount_opt(size) __deref_xcount(size) __post __deref __exceptthat __maybenull |
| 83 |
|
#define __deref_in_opt __deref_in __pre __deref __exceptthat __maybenull |
| 84 |
|
#define __deref_in_ecount_opt(size) __deref_in_ecount(size) __pre __deref __exceptthat __maybenull |
| 85 |
|
#define __deref_in_bcount_opt(size) __deref_in_bcount(size) __pre __deref __exceptthat __maybenull |
| 86 |
|
#define __deref_in_xcount_opt(size) __deref_in_xcount(size) __pre __deref __exceptthat __maybenull |
| 87 |
|
#define __deref_out_xcount_opt(size) __deref_out_xcount(size) __post __deref __exceptthat __maybenull |
| 88 |
|
#define __deref_out_xcount_part_opt(size,length) __deref_out_xcount_part(size,length) __post __deref __exceptthat __maybenull |
| 89 |
|
#define __deref_out_xcount_full_opt(size) __deref_out_xcount_full(size) __post __deref __exceptthat __maybenull |
| 90 |
|
#define __deref_inout_xcount_opt(size) __deref_inout_xcount(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull |
| 91 |
|
#define __deref_inout_xcount_part_opt(size,length) __deref_inout_xcount_part(size,length) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull |
| 92 |
|
#define __deref_inout_xcount_full_opt(size) __deref_inout_xcount_full(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull |
| 93 |
|
#define __deref_opt_xcount(size) __deref_xcount(size) __exceptthat __maybenull |
| 94 |
|
#define __deref_opt_in __deref_in __exceptthat __maybenull |
| 95 |
|
#define __deref_opt_in_ecount(size) __deref_in_ecount(size) __exceptthat __maybenull |
| 96 |
|
#define __deref_opt_in_bcount(size) __deref_in_bcount(size) __exceptthat __maybenull |
| 97 |
|
#define __deref_opt_in_xcount(size) __deref_in_xcount(size) __exceptthat __maybenull |
| 98 |
|
#define __deref_opt_out_xcount(size) __deref_out_xcount(size) __exceptthat __maybenull |
| 99 |
|
#define __deref_opt_out_xcount_part(size,length) __deref_out_xcount_part(size,length) __exceptthat __maybenull |
| 100 |
|
#define __deref_opt_out_xcount_full(size) __deref_out_xcount_full(size) __exceptthat __maybenull |
| 101 |
|
#define __deref_opt_inout_xcount(size) __deref_inout_xcount(size) __exceptthat __maybenull |
| 102 |
|
#define __deref_opt_inout_xcount_part(size,length) __deref_inout_xcount_part(size,length) __exceptthat __maybenull |
| 103 |
|
#define __deref_opt_inout_xcount_full(size) __deref_inout_xcount_full(size) __exceptthat __maybenull |
| 104 |
|
#define __deref_opt_xcount_opt(size) __deref_xcount_opt(size) __exceptthat __maybenull |
| 105 |
|
#define __deref_opt_in_opt __deref_in_opt __exceptthat __maybenull |
| 106 |
|
#define __deref_opt_in_ecount_opt(size) __deref_in_ecount_opt(size) __exceptthat __maybenull |
| 107 |
|
#define __deref_opt_in_bcount_opt(size) __deref_in_bcount_opt(size) __exceptthat __maybenull |
| 108 |
|
#define __deref_opt_in_xcount_opt(size) __deref_in_xcount_opt(size) __exceptthat __maybenull |
| 109 |
|
#define __deref_opt_out_xcount_opt(size) __deref_out_xcount_opt(size) __exceptthat __maybenull |
| 110 |
|
#define __deref_opt_out_xcount_part_opt(size,length) __deref_out_xcount_part_opt(size,length) __exceptthat __maybenull |
| 111 |
|
#define __deref_opt_out_xcount_full_opt(size) __deref_out_xcount_full_opt(size) __exceptthat __maybenull |
| 112 |
|
#define __deref_opt_inout_xcount_opt(size) __deref_inout_xcount_opt(size) __exceptthat __maybenull |
| 113 |
|
#define __deref_opt_inout_xcount_part_opt(size,length) __deref_inout_xcount_part_opt(size,length) __exceptthat __maybenull |
| 114 |
|
#define __deref_opt_inout_xcount_full_opt(size) __deref_inout_xcount_full_opt(size) __exceptthat __maybenull |
| 115 |
|
/* Must protect redfinitions of macros to workaround rc.exe issues. */ |
| 116 |
|
#ifndef RC_INVOKED |
| 117 |
|
#undef __nullnullterminated |
| 118 |
|
#define __nullnullterminated __xcount("string terminated by two nulls") |
| 119 |
|
#undef __checkReturn |
| 120 |
|
#define __checkReturn __post __inner_checkReturn |
| 121 |
|
#endif |
| 122 |
|
#endif //__SAL_H_FULL_VER <= 140050727 |
| 123 |
|
|
| 124 |
|
/************************************************************************ |
| 125 |
|
New extensions to sal.h follow here. |
| 126 |
|
*************************************************************************/ |
| 127 |
|
|
| 128 |
|
#if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_) |
| 129 |
|
#define __file_parser(typ) __declspec("SAL_file_parser(function, " #typ ")") |
| 130 |
|
#define __file_parser_class(typ) __declspec("SAL_file_parser(class, " #typ ")") |
| 131 |
|
#define __file_parser_library(typ) extern int __declspec("SAL_file_parser(library, " #typ ")") __iSALFileParserLibrary##typ; |
| 132 |
|
#define __source_code_content(typ) extern int __declspec("SAL_source_code_content(" #typ ")") __iSAL_Source_Code_Content##typ; |
| 133 |
|
#define __class_code_content(typ) __declspec("SAL_class_code_content(" #typ ")") |
| 134 |
|
#define __analysis_assert(e) __assume(e) |
| 135 |
|
#define __analysis_hint(hint) __declspec("SAL_analysisHint(" #hint ")") |
| 136 |
|
/* Internal defintions */ |
| 137 |
|
#define __inner_data_source(src_raw) __declspec("SAL_untrusted_data_source(" src_raw ")") |
| 138 |
|
#define __inner_this_data_source(src_raw) __declspec("SAL_untrusted_data_source_this(" src_raw ")") |
| 139 |
|
#define __inner_out_validated(typ_raw) __declspec("SAL_post") __declspec("SAL_validated(" typ_raw ")") |
| 140 |
|
#define __inner_this_out_validated(typ_raw) __declspec("SAL_validated_this(" typ_raw ")") |
| 141 |
|
#define __inner_assume_validated_dec __inline __nothrow void __AssumeValidated(__inner_out_validated("BY_DESIGN") const void *p) {p;} |
| 142 |
|
#define __inner_assume_validated(p) __AssumeValidated(p) |
| 143 |
|
#define __inner_transfer(formal) __declspec("SAL_transfer_adt_property_from(" SPECSTRINGIZE(formal) ")") |
| 144 |
|
#define __inner_encoded __declspec("SAL_encoded") |
| 145 |
|
|
| 146 |
|
#define __$adt_prop(adt,prop) __declspec("SAL_adt("#adt","#prop")") |
| 147 |
|
#define __$adt_add_prop(adt,prop) __declspec("SAL_add_adt_property("#adt","#prop")") |
| 148 |
|
#define __$adt_remove_prop(adt,prop) __declspec("SAL_remove_adt_property("#adt","#prop")") |
| 149 |
|
#define __$adt_transfer_prop(arg) __declspec("SAL_transfer_adt_property_from("#arg")") |
| 150 |
|
#define __$adt_type_props(typ) __declspec("SAL_post_type("#typ")") |
| 151 |
|
#define __$volatile __declspec("SAL_volatile") |
| 152 |
|
#define __$nonvolatile __declspec("SAL_nonvolatile") |
| 153 |
|
#define __$possibly_notnulltermiated __declspec("SAL_RequiresZeroTermination(sometimes)") |
| 154 |
|
#else |
| 155 |
|
#define __file_parser(typ) |
| 156 |
|
#define __file_parser_class(typ) |
| 157 |
|
#define __file_parser_library(typ) |
| 158 |
|
#define __source_code_content(typ) |
| 159 |
|
#define __class_code_content(typ) |
| 160 |
|
#define __analysis_assert(e) |
| 161 |
|
#define __analysis_hint(hint) |
| 162 |
|
/* Internal defintions */ |
| 163 |
|
#define __inner_data_source(src_raw) |
| 164 |
|
#define __inner_this_data_source(src_raw) |
| 165 |
|
#define __inner_out_validated(typ_raw) |
| 166 |
|
#define __inner_this_out_validated(typ_raw) |
| 167 |
|
#define __inner_assume_validated_dec |
| 168 |
|
#define __inner_assume_validated(p) |
| 169 |
|
#define __inner_transfer(formal) |
| 170 |
|
#define __inner_encoded |
| 171 |
|
#define __$adt_prop(adt,prop) |
| 172 |
|
#define __$adt_add_prop(adt,prop) |
| 173 |
|
#define __$adt_remove_prop(adt,prop) |
| 174 |
|
#define __$adt_transfer_prop(arg) |
| 175 |
|
#define __$adt_type_props(typ) |
| 176 |
|
#define __$volatile |
| 177 |
|
#define __$nonvolatile |
| 178 |
|
#define __$possibly_notnulltermiated |
| 179 |
|
#endif // #if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_) |
| 180 |
|
|
| 181 |
|
#define __field_ecount(size) __notnull __elem_writableTo(size) |
| 182 |
|
#define __field_bcount(size) __notnull __byte_writableTo(size) |
| 183 |
|
#define __field_xcount(size) __notnull __inexpressible_writableTo(size) |
| 184 |
|
|
| 185 |
|
#define __field_ecount_opt(size) __maybenull __elem_writableTo(size) |
| 186 |
|
#define __field_bcount_opt(size) __maybenull __byte_writableTo(size) |
| 187 |
|
#define __field_xcount_opt(size) __maybenull __inexpressible_writableTo(size) |
| 188 |
|
|
| 189 |
|
#define __field_ecount_part(size,init) __notnull __elem_writableTo(size) __elem_readableTo(init) |
| 190 |
|
#define __field_bcount_part(size,init) __notnull __byte_writableTo(size) __byte_readableTo(init) |
| 191 |
|
#define __field_xcount_part(size,init) __notnull __inexpressible_writableTo(size) __inexpressible_readableTo(init) |
| 192 |
|
|
| 193 |
|
#define __field_ecount_part_opt(size,init) __maybenull __elem_writableTo(size) __elem_readableTo(init) |
| 194 |
|
#define __field_bcount_part_opt(size,init) __maybenull __byte_writableTo(size) __byte_readableTo(init) |
| 195 |
|
#define __field_xcount_part_opt(size,init) __maybenull __inexpressible_writableTo(size) __inexpressible_readableTo(init) |
| 196 |
|
|
| 207 |
|
|
| 208 |
|
#define __out_awcount(expr,size) __pre __notnull \ |
| 209 |
|
__byte_writableTo((expr) ? (size) : (size) * 2) \ |
| 210 |
|
__post __valid __refparam |
| 211 |
|
#define __in_awcount(expr,size) __pre __valid \ |
| 212 |
|
__pre __deref __readonly \ |
| 213 |
|
__byte_readableTo((expr) ? (size) : (size) * 2) |
| 214 |
|
|
| 215 |
|
/* integer related macros */ |
| 216 |
|
#define __allocator __inner_allocator |
| 217 |
|
#define __bound __inner_bound |
| 218 |
|
#define __range(lb,ub) __inner_range(lb,ub) |
| 219 |
|
#define __in_bound __pre __inner_bound |
| 220 |
|
#define __out_bound __post __inner_bound |
| 221 |
|
#define __deref_out_bound __post __deref __inner_bound |
| 222 |
|
#define __in_range(lb,ub) __pre __inner_range(lb,ub) |
| 223 |
|
#define __out_range(lb,ub) __post __inner_range(lb,ub) |
| 224 |
|
#define __deref_in_range(lb,ub) __pre __deref __inner_range(lb,ub) |
| 225 |
|
#define __deref_out_range(lb,ub) __post __deref __inner_range(lb,ub) |
| 226 |
|
#define __field_range(lb,ub) __range(lb,ub) |
| 227 |
|
#define __field_data_source(src_sym) __inner_data_source(#src_sym) |
| 228 |
|
|
| 229 |
|
/* Pentraion review macros */ |
| 230 |
|
#define __in_data_source(src_sym) __pre __inner_data_source(#src_sym) |
| 231 |
|
#define __out_data_source(src_sym) __post __inner_data_source(#src_sym) |
| 232 |
|
#define __out_validated(typ_sym) __inner_out_validated(#typ_sym) |
| 233 |
|
#define __this_out_data_source(src_sym) __inner_this_data_source(#src_sym) |
| 234 |
|
#define __this_out_validated(typ_sym) __inner_this_out_validated(#typ_sym) |
| 235 |
|
#define __transfer(formal) __post __inner_transfer(formal) |
| 236 |
|
#define __rpc_entry __inner_control_entrypoint(RPC) |
| 237 |
|
#define __kernel_entry __inner_control_entrypoint(UserToKernel) |
| 238 |
|
#define __gdi_entry __inner_control_entrypoint(GDI) |
| 239 |
|
#define __encoded_pointer __inner_encoded |
| 240 |
|
#define __encoded_array __inner_encoded |
| 241 |
|
#define __field_encoded_pointer __inner_encoded |
| 242 |
|
#define __field_encoded_array __inner_encoded |
| 243 |
|
#define __type_has_adt_prop(adt,prop) __$adt_prop(adt,prop) |
| 244 |
|
#define __out_has_adt_prop(adt,prop) __post __$adt_add_prop(adt,prop) |
| 245 |
|
#define __out_not_has_adt_prop(adt,prop) __post __$adt_remove_prop(adt,prop) |
| 246 |
|
#define __out_transfer_adt_prop(arg) __post __$adt_transfer_prop(arg) |
| 247 |
|
#define __out_has_type_adt_props(typ) __post __$adt_type_props(typ) |
| 248 |
|
|
| 249 |
|
/* useful PFD related macros */ |
| 250 |
|
#define __possibly_notnulltermiated __post __$possibly_notnulltermiated |
| 251 |
|
|
| 252 |
|
/* Windows Internal */ |
| 253 |
|
#define __volatile __$volatile |
| 254 |
|
#define __nonvolatile __$nonvolatile |
| 255 |
|
#define __deref_volatile __deref __volatile |
| 256 |
|
#define __deref_nonvolatile __deref __nonvolatile |
| 257 |
|
|
| 258 |
|
/* declare stub functions for macros */ |
| 259 |
|
__inner_assume_validated_dec |
| 260 |
|
__inner_assume_bound_dec |
| 261 |
|
|
| 262 |
|
#define __assume_validated(p) __inner_assume_validated(p) |
| 263 |
|
#define __assume_bound(i) __inner_assume_bound(i) |
| 264 |
|
#ifdef __cplusplus |
| 265 |
|
} |
| 266 |
|
#endif |
| 267 |
|
#include <specstrings_adt.h> |
| 268 |
|
#ifdef _PREFIX_ |
| 269 |
|
/************************************************************************** |
| 270 |
|
* Defintion of __pfx_assume and __pfx_assert. Thse should be the only |
| 271 |
|
* defintions of these functions. |
| 272 |
|
***************************************************************************/ |
| 273 |
|
#if __cplusplus |
| 274 |
|
extern "C" void __pfx_assert(bool, const char *); |
| 275 |
|
extern "C" void __pfx_assume(bool, const char *); |
| 276 |
|
#else |
| 277 |
|
void __pfx_assert(int, const char *); |
| 278 |
|
void __pfx_assume(int, const char *); |
| 279 |
|
#endif |
| 280 |
|
/************************************************************************** |
| 281 |
|
* Redefintion of __analysis_assume and __analysis_assert for PREFIX build |
| 282 |
|
**************************************************************************/ |
| 283 |
|
#undef __analysis_assume |
| 284 |
|
#undef __analysis_assert |
| 285 |
|
#define __analysis_assume(e) (__pfx_assume(e,"pfx_assume"),__assume(e)); |
| 286 |
|
#define __analysis_assert(e) (__pfx_assert(e,"pfx_assert"),__assume(e)); |
| 287 |
|
#endif /* ifdef _PREFIX_ */ |
| 288 |
|
|
| 289 |
|
/************************************************************************** |
| 290 |
|
* This include should always be the last thing in this file. |
| 291 |
|
* Must avoid redfinitions of macros to workaround rc.exe issues. |
| 292 |
|
***************************************************************************/ |
| 293 |
|
#if !(defined(RC_INVOKED) || defined(SORTPP_PASS)) |
| 294 |
|
#include <specstrings_strict.h> |
| 295 |
|
#endif /* if !(defined(RC_INVOKED) || defined(SORTPP_PASS)) */ |
| 296 |
|
#endif /* #ifndef SPECSTRINGS_H */ |
| 297 |
|
|
| 298 |
|
|
| 299 |
|
|
| 300 |
|
|
|
|
|