34#if !defined(_SAL_VERSION_SAL2)
36 #if defined(__BUILDMACHINE__) || defined(_USE_SAL2_ONLY)
37 #define _SAL_VERSION_SAL2(_A) SAL_2_Clean_Violation_using ## _A
39 #define _SAL_VERSION_SAL2(_A)
44 #define _SAL_VERSION_CHECK(_A) _SAL_VERSION_SAL2(_A)
46 #define _SAL_VERSION_CHECK(_A)
49 #ifndef SAL_VERSION_CHECK
50 #define SAL_VERSION_CHECK(_A) _SAL_VERSION_CHECK(_A)
51 #define SAL_VERSION_SAL2(_A) _SAL_VERSION_SAL2(_A)
58#ifndef __SAL_H_FULL_VER
59#define __SAL_H_FULL_VER 140050727
67#if __SAL_H_FULL_VER <= 140050727
69#if !defined(__midl) && defined(_PREFAST_) && _MSC_VER >= 1000
72#define __inner_bound _SA_annotes0(SAL_bound)
73#define __inner_range(lb,ub) _SA_annotes2(SAL_range,lb,ub)
74#define __inner_assume_bound_dec __inline __nothrow void __AssumeBoundInt(_Post_ __inner_bound int i) {i;}
75#define __inner_assume_bound(i) __AssumeBoundInt(i);
76#define __inner_allocator _SA_annotes0(SAL_allocator)
78#define __static_context(ctx, annotes) \
79 _SA_annotes1(SAL_context,ctx) _Group_(__nop_impl(annotes))
81#define __failure(x) __static_context(SAL_return_convention, \
82 _SA_annotes1(SAL_failure,x))
85#define __valueUndefined _SA_annotes0(SAL_valueUndefined)
87enum __SAL_failureKind{__failureUnspecified = 0, __failureUndefined = 1};
90#define __failureDefault(kind) __static_context(SAL_return_convention, \
91 _SA_annotes1(SAL_failureDefault,kind))
96#define __inner_range(lb,ub)
97#define __inner_assume_bound_dec
98#define __inner_assume_bound(i)
99#define __inner_allocator
101#define __static_context(ctx, annotes)
103#define __valueUndefined
104#define __failureDefault(x)
108#define __xcount(size) __notnull __inexpressible_writableTo(size)
109#define __in_xcount(size) __in _Pre_ __inexpressible_readableTo(size)
110#define __out_xcount(size) __xcount(size) _Post_ __valid __refparam
111#define __out_xcount_part(size,length) __out_xcount(size) _Post_ __inexpressible_readableTo(length)
112#define __out_xcount_full(size) __out_xcount_part(size,size)
113#define __inout_xcount(size) __out_xcount(size) _Pre_ __valid
114#define __inout_xcount_part(size,length) __out_xcount_part(size,length) _Pre_ __valid _Pre_ __inexpressible_readableTo(length)
115#define __inout_xcount_full(size) __inout_xcount_part(size,size)
116#define __xcount_opt(size) __xcount(size) __exceptthat __maybenull
117#define __in_xcount_opt(size) __in_xcount(size) __exceptthat __maybenull
118#define __out_xcount_opt(size) __out_xcount(size) __exceptthat __maybenull
119#define __out_xcount_part_opt(size,length) __out_xcount_part(size,length) __exceptthat __maybenull
120#define __out_xcount_full_opt(size) __out_xcount_full(size) __exceptthat __maybenull
121#define __inout_xcount_opt(size) __inout_xcount(size) __exceptthat __maybenull
122#define __inout_xcount_part_opt(size,length) __inout_xcount_part(size,length) __exceptthat __maybenull
123#define __inout_xcount_full_opt(size) __inout_xcount_full(size) __exceptthat __maybenull
124#define __deref_xcount(size) __ecount(1) _Post_ __elem_readableTo(1) _Post_ __deref __notnull _Post_ __deref __inexpressible_writableTo(size)
125#define __deref_in __in _Pre_ __deref __deref __readonly
126#define __deref_in_ecount(size) __deref_in _Pre_ __deref __elem_readableTo(size)
127#define __deref_in_bcount(size) __deref_in _Pre_ __deref __byte_readableTo(size)
128#define __deref_in_xcount(size) __deref_in _Pre_ __deref __inexpressible_readableTo(size)
129#define __deref_out_xcount(size) __deref_xcount(size) _Post_ __deref __valid __refparam
130#define __deref_out_xcount_part(size,length) __deref_out_xcount(size) _Post_ __deref __inexpressible_readableTo(length)
131#define __deref_out_xcount_full(size) __deref_out_xcount_part(size,size)
132#define __deref_out_xcount(size) __deref_xcount(size) _Post_ __deref __valid __refparam
133#define __inout_xcount_opt(size) __inout_xcount(size) __exceptthat __maybenull
134#define __inout_xcount_part_opt(size,length) __inout_xcount_part(size,length) __exceptthat __maybenull
135#define __inout_xcount_full_opt(size) __inout_xcount_full(size) __exceptthat __maybenull
136#define __deref_xcount(size) __ecount(1) _Post_ __elem_readableTo(1) _Post_ __deref __notnull _Post_ __deref __inexpressible_writableTo(size)
137#define __deref_in __in _Pre_ __deref __deref __readonly
138#define __deref_in_ecount(size) __deref_in _Pre_ __deref __elem_readableTo(size)
139#define __deref_in_bcount(size) __deref_in _Pre_ __deref __byte_readableTo(size)
140#define __deref_in_xcount(size) __deref_in _Pre_ __deref __inexpressible_readableTo(size)
141#define __deref_out_xcount(size) __deref_xcount(size) _Post_ __deref __valid __refparam
142#define __deref_out_xcount_part(size,length) __deref_out_xcount(size) _Post_ __deref __inexpressible_readableTo(length)
143#define __deref_out_xcount_full(size) __deref_out_xcount_part(size,size)
144#define __deref_out_xcount(size) __deref_xcount(size) _Post_ __deref __valid __refparam
145#define __deref_inout_xcount(size) __deref_inout _Pre_ __deref __inexpressible_writableTo(size) _Post_ __deref __inexpressible_writableTo(size)
146#define __deref_inout_xcount_part(size,length) __deref_inout_xcount(size) _Pre_ __deref __inexpressible_readableTo(length) _Post_ __deref __inexpressible_readableTo(length)
147#define __deref_inout_xcount_full(size) __deref_inout_xcount_part(size,size)
148#define __deref_xcount_opt(size) __deref_xcount(size) _Post_ __deref __exceptthat __maybenull
149#define __deref_in_opt __deref_in _Pre_ __deref __exceptthat __maybenull
150#define __deref_in_opt_out __deref_inout _Pre_ __deref __exceptthat __maybenull _Post_ __deref __notnull
151#define __deref_in_ecount_opt(size) __deref_in_ecount(size) _Pre_ __deref __exceptthat __maybenull
152#define __deref_in_bcount_opt(size) __deref_in_bcount(size) _Pre_ __deref __exceptthat __maybenull
153#define __deref_in_xcount_opt(size) __deref_in_xcount(size) _Pre_ __deref __exceptthat __maybenull
154#define __deref_out_xcount_opt(size) __deref_out_xcount(size) _Post_ __deref __exceptthat __maybenull
155#define __deref_out_xcount_part_opt(size,length) __deref_out_xcount_part(size,length) _Post_ __deref __exceptthat __maybenull
156#define __deref_out_xcount_full_opt(size) __deref_out_xcount_full(size) _Post_ __deref __exceptthat __maybenull
157#define __deref_inout_xcount_opt(size) __deref_inout_xcount(size) _Pre_ __deref __exceptthat __maybenull _Post_ __deref __exceptthat __maybenull
158#define __deref_inout_xcount_part_opt(size,length) __deref_inout_xcount_part(size,length) _Pre_ __deref __exceptthat __maybenull _Post_ __deref __exceptthat __maybenull
159#define __deref_inout_xcount_full_opt(size) __deref_inout_xcount_full(size) _Pre_ __deref __exceptthat __maybenull _Post_ __deref __exceptthat __maybenull
160#define __deref_opt_xcount(size) __deref_xcount(size) __exceptthat __maybenull
161#define __deref_opt_in __deref_in __exceptthat __maybenull
162#define __deref_opt_in_ecount(size) __deref_in_ecount(size) __exceptthat __maybenull
163#define __deref_opt_in_bcount(size) __deref_in_bcount(size) __exceptthat __maybenull
164#define __deref_opt_in_xcount(size) __deref_in_xcount(size) __exceptthat __maybenull
165#define __deref_opt_out_xcount(size) __deref_out_xcount(size) __exceptthat __maybenull
166#define __deref_opt_out_xcount_part(size,length) __deref_out_xcount_part(size,length) __exceptthat __maybenull
167#define __deref_opt_out_xcount_full(size) __deref_out_xcount_full(size) __exceptthat __maybenull
168#define __deref_opt_inout_xcount(size) __deref_inout_xcount(size) __exceptthat __maybenull
169#define __deref_opt_inout_xcount_part(size,length) __deref_inout_xcount_part(size,length) __exceptthat __maybenull
170#define __deref_opt_inout_xcount_full(size) __deref_inout_xcount_full(size) __exceptthat __maybenull
171#define __deref_opt_xcount_opt(size) __deref_xcount_opt(size) __exceptthat __maybenull
172#define __deref_opt_in_opt __deref_in_opt __exceptthat __maybenull
173#define __deref_opt_in_ecount_opt(size) __deref_in_ecount_opt(size) __exceptthat __maybenull
174#define __deref_opt_in_bcount_opt(size) __deref_in_bcount_opt(size) __exceptthat __maybenull
175#define __deref_opt_in_xcount_opt(size) __deref_in_xcount_opt(size) __exceptthat __maybenull
176#define __deref_opt_out_xcount_opt(size) __deref_out_xcount_opt(size) __exceptthat __maybenull
177#define __deref_opt_out_xcount_part_opt(size,length) __deref_out_xcount_part_opt(size,length) __exceptthat __maybenull
178#define __deref_opt_out_xcount_full_opt(size) __deref_out_xcount_full_opt(size) __exceptthat __maybenull
179#define __deref_opt_inout_xcount_opt(size) __deref_inout_xcount_opt(size) __exceptthat __maybenull
180#define __deref_opt_inout_xcount_part_opt(size,length) __deref_inout_xcount_part_opt(size,length) __exceptthat __maybenull
181#define __deref_opt_inout_xcount_full_opt(size) __deref_inout_xcount_full_opt(size) __exceptthat __maybenull
183#define __deref_in_ecount_iterator(size, incr) __inout _Pre_ __deref __elem_readableTo(size) __deref_out_range(==, _Old_(*_Curr_) + incr)
184#define __deref_out_ecount_iterator(size, incr) __inout _Pre_ __deref __elem_writableTo(size) __deref_out_range(==, _Old_(*_Curr_) + incr)
185#define __deref_inout_ecount_iterator(size, incr) __inout _Pre_ __deref __elem_readableTo(size) _Pre_ __deref __elem_writableTo(size) __deref_out_range(==, _Old_(*_Curr_) + incr)
187#define __post_bcount(size) _Post_ __byte_writableTo(size)
188#define __post_ecount(size) _Post_ __elem_writableTo(size)
190#define __deref_realloc_bcount(insize, outsize) __inout _Pre_ __deref __byte_readableTo(insize) _Post_ __deref __byte_writableTo(outsize)
195#define __in_ecount_or_z(c) _When_(_String_length_(_Curr_) < (c), __in_z) \
196 _When_(_String_length_(_Curr_) >= (c), __in_ecount(c))
200#define __post_nullnullterminated
205#undef __nullnullterminated
206#define __nullnullterminated __inexpressible_readableTo("string terminated by two nulls") __nullterminated
208#undef __post_nullnullterminated
209#define __post_nullnullterminated _Post_ __inexpressible_readableTo("string terminated by two nulls") _Post_ __nullterminated
218#if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_)
220#define __file_parser(typ) _SA_annotes2(SAL_file_parser,"function",typ)
221#define __file_parser_class(typ) _SA_annotes2(SAL_file_parser,"class",typ)
222#define __file_parser_library(typ) extern int _SA_annotes2(SAL_file_parser, "library", typ) __iSALFileParserLibrary##typ;
223#define __source_code_content(typ) extern int _SA_annotes1(SAL_source_code_content, typ) __iSAL_Source_Code_Content##typ;
224#define __class_code_content(typ) _SA_annotes1(SAL_class_code_content, typ)
225#define __analysis_assert(e) __assume(e)
226#define __analysis_hint(hint) _SA_annotes1(SAL_analysisHint, hint)
228#define __analysis_noreturn __declspec(noreturn)
230#define __inner_data_source(src_raw) _SA_annotes1(SAL_untrusted_data_source,src_raw)
231#define __inner_this_data_source(src_raw) _SA_annotes1(SAL_untrusted_data_source_this,src_raw)
232#define __inner_out_validated(typ_raw) _Post_ _SA_annotes1(SAL_validated,typ_raw)
233#define __inner_this_out_validated(typ_raw) _SA_annotes1(SAL_validated_this,typ_raw)
234#define __inner_assume_validated_dec __inline __nothrow void __AssumeValidated(__inner_out_validated("BY_DESIGN") const void *p) {p;}
235#define __inner_assume_validated(p) __AssumeValidated(p)
236#define __inner_transfer(formal) _SA_annotes1(SAL_transfer_adt_property_from,formal)
237#define __inner_encoded _SA_annotes0(SAL_encoded)
239#if defined(_MSC_EXTENSIONS) || defined(_PREFAST_) || defined(OACR)
240#define __inner_adt_prop(adt,prop) _SA_annotes2(SAL_adt, adt,prop)
241#define __inner_adt_add_prop(adt,prop) _SA_annotes2(SAL_add_adt_property,adt,prop)
242#define __inner_adt_remove_prop(adt,prop) _SA_annotes2(SAL_remove_adt_property,adt,prop)
243#define __inner_adt_transfer_prop(arg) _SA_annotes1(SAL_transfer_adt_property_from,arg)
244#define __inner_adt_type_props(typ) _SA_annotes1(SAL_post_type,typ)
245#define __inner_volatile _SA_annotes0(SAL_volatile)
246#define __inner_nonvolatile _SA_annotes0(SAL_nonvolatile)
247#define __inner_possibly_notnullterminated _SA_annotes1(SAL_nullTerminated,__maybe)
248#define __inner_analysis_assume_nullterminated_dec __inline __nothrow void __AnalysisAssumeNullterminated(_Post_ __nullterminated void *p) {*(char*)p=0;}
249#define __inner_analysis_assume_nullterminated(x) __AnalysisAssumeNullterminated(x);
254#define __file_parser(typ)
255#define __file_parser_class(typ)
256#define __file_parser_library(typ)
257#define __source_code_content(typ)
258#define __class_code_content(typ)
259#define __analysis_assert(e)
260#define __analysis_hint(hint)
262#define __analysis_noreturn
264#define __analysis_noreturn __attribute__((analyzer_noreturn))
267#define __inner_data_source(src_raw)
268#define __inner_this_data_source(src_raw)
269#define __inner_out_validated(typ_raw)
270#define __inner_this_out_validated(typ_raw)
271#define __inner_assume_validated_dec
272#define __inner_assume_validated(p)
273#define __inner_transfer(formal)
274#define __inner_encoded
275#define __inner_adt_prop(adt,prop)
276#define __inner_adt_add_prop(adt,prop)
277#define __inner_adt_remove_prop(adt,prop)
278#define __inner_adt_transfer_prop(arg)
279#define __inner_adt_type_props(typ)
280#define __inner_volatile
281#define __inner_nonvolatile
282#define __inner_possibly_notnullterminated
283#define __inner_analysis_assume_nullterminated_dec
284#define __inner_analysis_assume_nullterminated(x)
288#define __field_ecount(size) __notnull __elem_writableTo(size)
289#define __field_bcount(size) __notnull __byte_writableTo(size)
290#define __field_xcount(size) __notnull __inexpressible_writableTo(size)
292#define __field_ecount_opt(size) __maybenull __elem_writableTo(size)
293#define __field_bcount_opt(size) __maybenull __byte_writableTo(size)
294#define __field_xcount_opt(size) __maybenull __inexpressible_writableTo(size)
296#define __field_ecount_part(size,init) __notnull __elem_writableTo(size) __elem_readableTo(init)
297#define __field_bcount_part(size,init) __notnull __byte_writableTo(size) __byte_readableTo(init)
298#define __field_xcount_part(size,init) __notnull __inexpressible_writableTo(size) __inexpressible_readableTo(init)
300#define __field_ecount_part_opt(size,init) __maybenull __elem_writableTo(size) __elem_readableTo(init)
301#define __field_bcount_part_opt(size,init) __maybenull __byte_writableTo(size) __byte_readableTo(init)
302#define __field_xcount_part_opt(size,init) __maybenull __inexpressible_writableTo(size) __inexpressible_readableTo(init)
304#define __field_ecount_full(size) __field_ecount_part(size,size)
305#define __field_bcount_full(size) __field_bcount_part(size,size)
306#define __field_xcount_full(size) __field_xcount_part(size,size)
308#define __field_ecount_full_opt(size) __field_ecount_part_opt(size,size)
309#define __field_bcount_full_opt(size) __field_bcount_part_opt(size,size)
310#define __field_xcount_full_opt(size) __field_xcount_part_opt(size,size)
312#define __field_nullterminated __nullterminated
314#define __struct_bcount(size) __byte_writableTo(size)
315#define __struct_xcount(size) __inexpressible_writableTo(size)
317#define __out_awcount(expr,size) _Pre_ __notnull \
318 __byte_writableTo((expr) ? (size) : (size) * 2) \
319 _Post_ __valid __refparam
320#define __in_awcount(expr,size) _Pre_ __valid \
321 _Pre_ _Notref_ __deref __readonly \
322 __byte_readableTo((expr) ? (size) : (size) * 2)
323#define __post_invalid _Post_ __notvalid
325#define __allocator __inner_allocator
326#ifndef PAL_STDCPP_COMPAT
327#define __deallocate(kind) _Pre_ __notnull __post_invalid
328#define __deallocate_opt(kind) _Pre_ __maybenull __post_invalid
330#define __bound __inner_bound
331#define __range(lb,ub) __inner_range(lb,ub)
332#define __in_bound _Pre_ __inner_bound
333#define __out_bound _Post_ __inner_bound
334#define __deref_out_bound _Post_ __deref __inner_bound
335#define __in_range(lb,ub) _Pre_ __inner_range(lb,ub)
336#define __out_range(lb,ub) _Post_ __inner_range(lb,ub)
337#define __deref_in_range(lb,ub) _Pre_ __deref __inner_range(lb,ub)
338#define __deref_out_range(lb,ub) _Post_ __deref __inner_range(lb,ub)
339#define __deref_inout_range(lb,ub) __deref_in_range(lb,ub) __deref_out_range(lb,ub)
340#define __field_range(lb,ub) __range(lb,ub)
341#define __field_data_source(src_sym) __inner_data_source(#src_sym)
343#define __range_max(a,b) __range(==, a > b ? a : b)
344#define __range_min(a,b) __range(==, a < b ? a : b)
348#define __in_data_source(src_sym) _Pre_ __inner_data_source(#src_sym)
349#define __out_data_source(src_sym) _Post_ __inner_data_source(#src_sym)
350#define __out_validated(typ_sym) __inner_out_validated(#typ_sym)
351#define __this_out_data_source(src_sym) __inner_this_data_source(#src_sym)
352#define __this_out_validated(typ_sym) __inner_this_out_validated(#typ_sym)
353#define __transfer(formal) _Post_ __inner_transfer(formal)
354#define __rpc_entry __inner_control_entrypoint(RPC)
355#define __kernel_entry __inner_control_entrypoint(UserToKernel)
356#define __gdi_entry __inner_control_entrypoint(GDI)
357#define __encoded_pointer __inner_encoded
358#define __encoded_array __inner_encoded
359#define __field_encoded_pointer __inner_encoded
360#define __field_encoded_array __inner_encoded
361#if defined(_MSC_EXTENSIONS) || defined(_PREFAST_) || defined(OACR)
362#define __type_has_adt_prop(adt,prop) __inner_adt_prop(adt,prop)
363#define __out_has_adt_prop(adt,prop) _Post_ __inner_adt_add_prop(adt,prop)
364#define __out_not_has_adt_prop(adt,prop) _Post_ __inner_adt_remove_prop(adt,prop)
365#define __out_transfer_adt_prop(arg) _Post_ __inner_adt_transfer_prop(arg)
366#define __out_has_type_adt_props(typ) _Post_ __inner_adt_type_props(typ)
369#define __possibly_notnullterminated __inner_possibly_notnullterminated
372#define __volatile __inner_volatile
373#define __nonvolatile __inner_nonvolatile
375#define __out_has_type_adt_props(typ)
377#define __deref_volatile __deref __volatile
378#define __deref_nonvolatile __deref __nonvolatile
384#define __analysis_assume_nullterminated(x) __inner_analysis_assume_nullterminated(x)
385#define __assume_validated(p) __inner_assume_validated(p)
386#define __assume_bound(i) __inner_assume_bound(i)
395#ifndef _Unreferenced_parameter_
396#define _Unreferenced_parameter_ _Const_
402#define _Frees_ptr_ _Pre_notnull_ _Post_ptr_invalid_
404#ifndef _Frees_ptr_opt_
405#define _Frees_ptr_opt_ _Pre_maybenull_ _Post_ptr_invalid_
411#define _In_NLS_string_(size) _When_((size) < 0, _In_z_) \
412 _When_((size) >= 0, _In_reads_(size))
419#define _Flt_CompletionContext_Outptr_ \
420 _Outptr_result_maybenull_ _Pre_valid_ \
421 _At_(*_Curr_, _Pre_null_ \
422 _When_(return != FLT_PREOP_SUCCESS_WITH_CALLBACK && return != FLT_PREOP_SYNCHRONIZE, _Post_null_))
427#define _Flt_ConnectionCookie_Outptr_ \
428 _Outptr_result_maybenull_ _Pre_valid_ \
429 _At_(*_Curr_, _Pre_null_ _On_failure_(_Post_null_))
449#ifndef _Writes_and_advances_ptr_
450#define _Writes_and_advances_ptr_(size) \
451 _At_((void*)_Curr_, _Inout_) \
453 _Pre_writable_size_(size) \
454 _Post_writable_size_(size) \
455 _Post_satisfies_(_Curr_ - _Old_(_Curr_) == size)) \
456 _At_(_Old_(_Curr_), \
457 _Post_readable_size_(_Old_(size) - size))
460#ifndef _Writes_bytes_and_advances_ptr_
461#define _Writes_bytes_and_advances_ptr_(size) \
462 _At_((void*)_Curr_, _Inout_) \
464 _Pre_writable_byte_size_(size) \
465 _Post_writable_byte_size_(size) \
466 _Post_satisfies_(((char*)_Curr_) - ((void*)_Old_(_Curr_)) == size)) \
467 _At_(_Old_(_Curr_), \
468 _Post_readable_byte_size_(_Old_(size) - size))
477#define _Post_equals_last_error_ _Post_satisfies_(_Curr_ != 0)
489extern "C" void __pfx_assert(
bool,
const char *);
490extern "C" void __pfx_assume(
bool,
const char *);
492void __pfx_assert(
int,
const char *);
493void __pfx_assume(
int,
const char *);
498#undef __analysis_assume
499#undef __analysis_assert
500#define __analysis_assume(e) (__pfx_assume(e,"pfx_assume"),__assume(e));
501#define __analysis_assert(e) (__pfx_assert(e,"pfx_assert"),__assume(e));
508#if !(defined(RC_INVOKED) || defined(SORTPP_PASS))
523#if (!defined(_Outptr_) || _MSC_VER <= 1600) && !( defined( MIDL_PASS ) || defined(__midl) || defined(RC_INVOKED) )
525#define __ANNOTATION(fun)
527#define __PRIMOP(type, fun)
542#if (!defined(_Outptr_) ) && !( defined( MIDL_PASS ) || defined(__midl) || defined(RC_INVOKED) ) && !( defined( _SDV_ ) )
#define __inner_assume_validated_dec
#define __inner_analysis_assume_nullterminated_dec
#define __ANNOTATION(fun)
#define __inner_assume_bound_dec