STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sal.h
Go to the documentation of this file.
1 /***
2 *sal.h - markers for documenting the semantics of APIs
3 *
4 * Copyright (c) Microsoft Corporation. All rights reserved.
5 *
6 *Purpose:
7 * sal.h provides a set of annotations to describe how a function uses its
8 * parameters - the assumptions it makes about them, and the guarantees it makes
9 * upon finishing.
10 *
11 * [Public]
12 *
13 ****/
14 #pragma once
15 
16 /*==========================================================================
17 
18  The comments in this file are intended to give basic understanding of
19  the usage of SAL, the Microsoft Source Code Annotation Language.
20  For more details, please see https://go.microsoft.com/fwlink/?LinkID=242134
21 
22  The macros are defined in 3 layers, plus the structural set:
23 
24  _In_/_Out_/_Ret_ Layer:
25  ----------------------
26  This layer provides the highest abstraction and its macros should be used
27  in most cases. These macros typically start with:
28  _In_ : input parameter to a function, unmodified by called function
29  _Out_ : output parameter, written to by called function, pointed-to
30  location not expected to be initialized prior to call
31  _Outptr_ : like _Out_ when returned variable is a pointer type
32  (so param is pointer-to-pointer type). Called function
33  provides/allocated space.
34  _Outref_ : like _Outptr_, except param is reference-to-pointer type.
35  _Inout_ : inout parameter, read from and potentially modified by
36  called function.
37  _Ret_ : for return values
38  _Field_ : class/struct field invariants
39  For common usage, this class of SAL provides the most concise annotations.
40  Note that _In_/_Out_/_Inout_/_Outptr_ annotations are designed to be used
41  with a parameter target. Using them with _At_ to specify non-parameter
42  targets may yield unexpected results.
43 
44  This layer also includes a number of other properties that can be specified
45  to extend the ability of code analysis, most notably:
46  -- Designating parameters as format strings for printf/scanf/scanf_s
47  -- Requesting stricter type checking for C enum parameters
48 
49  _Pre_/_Post_ Layer:
50  ------------------
51  The macros of this layer only should be used when there is no suitable macro
52  in the _In_/_Out_ layer. Its macros start with _Pre_ or _Post_.
53  This layer provides the most flexibility for annotations.
54 
55  Implementation Abstraction Layer:
56  --------------------------------
57  Macros from this layer should never be used directly. The layer only exists
58  to hide the implementation of the annotation macros.
59 
60  Structural Layer:
61  ----------------
62  These annotations, like _At_ and _When_, are used with annotations from
63  any of the other layers as modifiers, indicating exactly when and where
64  the annotations apply.
65 
66 
67  Common syntactic conventions:
68  ----------------------------
69 
70  Usage:
71  -----
72  _In_, _Out_, _Inout_, _Pre_, _Post_, are for formal parameters.
73  _Ret_, _Deref_ret_ must be used for return values.
74 
75  Nullness:
76  --------
77  If the parameter can be NULL as a precondition to the function, the
78  annotation contains _opt. If the macro does not contain '_opt' the
79  parameter cannot be NULL.
80 
81  If an out/inout parameter returns a null pointer as a postcondition, this is
82  indicated by _Ret_maybenull_ or _result_maybenull_. If the macro is not
83  of this form, then the result will not be NULL as a postcondition.
84  _Outptr_ - output value is not NULL
85  _Outptr_result_maybenull_ - output value might be NULL
86 
87  String Type:
88  -----------
89  _z: NullTerminated string
90  for _In_ parameters the buffer must have the specified stringtype before the call
91  for _Out_ parameters the buffer must have the specified stringtype after the call
92  for _Inout_ parameters both conditions apply
93 
94  Extent Syntax:
95  -------------
96  Buffer sizes are expressed as element counts, unless the macro explicitly
97  contains _byte_ or _bytes_. Some annotations specify two buffer sizes, in
98  which case the second is used to indicate how much of the buffer is valid
99  as a postcondition. This table outlines the precondition buffer allocation
100  size, precondition number of valid elements, postcondition allocation size,
101  and postcondition number of valid elements for representative buffer size
102  annotations:
103  Pre | Pre | Post | Post
104  alloc | valid | alloc | valid
105  Annotation elems | elems | elems | elems
106  ---------- ------------------------------------
107  _In_reads_(s) s | s | s | s
108  _Inout_updates_(s) s | s | s | s
109  _Inout_updates_to_(s,c) s | s | s | c
110  _Out_writes_(s) s | 0 | s | s
111  _Out_writes_to_(s,c) s | 0 | s | c
112  _Outptr_result_buffer_(s) ? | ? | s | s
113  _Outptr_result_buffer_to_(s,c) ? | ? | s | c
114 
115  For the _Outptr_ annotations, the buffer in question is at one level of
116  dereference. The called function is responsible for supplying the buffer.
117 
118  Success and failure:
119  -------------------
120  The SAL concept of success allows functions to define expressions that can
121  be tested by the caller, which if it evaluates to non-zero, indicates the
122  function succeeded, which means that its postconditions are guaranteed to
123  hold. Otherwise, if the expression evaluates to zero, the function is
124  considered to have failed, and the postconditions are not guaranteed.
125 
126  The success criteria can be specified with the _Success_(expr) annotation:
127  _Success_(return != FALSE) BOOL
128  PathCanonicalizeA(_Out_writes_(MAX_PATH) LPSTR pszBuf, LPCSTR pszPath) :
129  pszBuf is only guaranteed to be NULL-terminated when TRUE is returned,
130  and FALSE indiates failure. In common practice, callers check for zero
131  vs. non-zero returns, so it is preferable to express the success
132  criteria in terms of zero/non-zero, not checked for exactly TRUE.
133 
134  Functions can specify that some postconditions will still hold, even when
135  the function fails, using _On_failure_(anno-list), or postconditions that
136  hold regardless of success or failure using _Always_(anno-list).
137 
138  The annotation _Return_type_success_(expr) may be used with a typedef to
139  give a default _Success_ criteria to all functions returning that type.
140  This is the case for common Windows API status types, including
141  HRESULT and NTSTATUS. This may be overridden on a per-function basis by
142  specifying a _Success_ annotation locally.
143 
144 ============================================================================*/
145 
146 #define __ATTR_SAL
147 
148 #ifndef _SAL_VERSION
149 #define _SAL_VERSION 20
150 #endif
151 
152 #ifndef __SAL_H_VERSION
153 #define __SAL_H_VERSION 180000000
154 #endif
155 
156 #ifdef _PREFAST_ // [
157 
158 // choose attribute or __declspec implementation
159 #ifndef _USE_DECLSPECS_FOR_SAL // [
160 #define _USE_DECLSPECS_FOR_SAL 1
161 #endif // ]
162 
163 #if _USE_DECLSPECS_FOR_SAL // [
164 #undef _USE_ATTRIBUTES_FOR_SAL
165 #define _USE_ATTRIBUTES_FOR_SAL 0
166 #elif !defined(_USE_ATTRIBUTES_FOR_SAL) // ][
167 #define _USE_ATTRIBUTES_FOR_SAL 1
168 #endif // ]
169 
170 
171 #if !_USE_DECLSPECS_FOR_SAL // [
172 #if !_USE_ATTRIBUTES_FOR_SAL // [
173 #undef _USE_ATTRIBUTES_FOR_SAL
174 #define _USE_ATTRIBUTES_FOR_SAL 1
175 #endif // ]
176 #endif // ]
177 
178 #else
179 
180 // Disable expansion of SAL macros in non-Prefast mode to
181 // improve compiler throughput.
182 #ifndef _USE_DECLSPECS_FOR_SAL // [
183 #define _USE_DECLSPECS_FOR_SAL 0
184 #endif // ]
185 #ifndef _USE_ATTRIBUTES_FOR_SAL // [
186 #define _USE_ATTRIBUTES_FOR_SAL 0
187 #endif // ]
188 
189 #endif // ]
190 
191 // safeguard for MIDL and RC builds
192 #if _USE_DECLSPECS_FOR_SAL && ( defined( MIDL_PASS ) || defined(__midl) || defined(RC_INVOKED) || !defined(_PREFAST_) ) // [
193 #undef _USE_DECLSPECS_FOR_SAL
194 #define _USE_DECLSPECS_FOR_SAL 0
195 #endif // ]
196 #if _USE_ATTRIBUTES_FOR_SAL && ( !defined(_MSC_EXTENSIONS) || defined( MIDL_PASS ) || defined(__midl) || defined(RC_INVOKED) ) // [
197 #undef _USE_ATTRIBUTES_FOR_SAL
198 #define _USE_ATTRIBUTES_FOR_SAL 0
199 #endif // ]
200 
201 #if _USE_DECLSPECS_FOR_SAL || _USE_ATTRIBUTES_FOR_SAL
202 
203 // Special enum type for Y/N/M
204 enum __SAL_YesNo {_SAL_notpresent, _SAL_no, _SAL_maybe, _SAL_yes, _SAL_default};
205 
206 #endif
207 
208 #if defined(BUILD_WINDOWS) && !_USE_ATTRIBUTES_FOR_SAL
209 #define _SAL1_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "1") _GrouP_(annotes _SAL_nop_impl_)
210 #define _SAL1_1_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "1.1") _GrouP_(annotes _SAL_nop_impl_)
211 #define _SAL1_2_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "1.2") _GrouP_(annotes _SAL_nop_impl_)
212 #define _SAL2_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "2") _GrouP_(annotes _SAL_nop_impl_)
213 
214 #ifndef _SAL_L_Source_
215 // Some annotations aren't officially SAL2 yet.
216 #define _SAL_L_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "2") _GrouP_(annotes _SAL_nop_impl_)
217 #endif
218 #else
219 #define _SAL1_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "1") _Group_(annotes _SAL_nop_impl_)
220 #define _SAL1_1_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "1.1") _Group_(annotes _SAL_nop_impl_)
221 #define _SAL1_2_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "1.2") _Group_(annotes _SAL_nop_impl_)
222 #define _SAL2_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "2") _Group_(annotes _SAL_nop_impl_)
223 
224 #ifndef _SAL_L_Source_
225 // Some annotations aren't officially SAL2 yet.
226 #define _SAL_L_Source_(Name, args, annotes) _SA_annotes3(SAL_name, #Name, "", "2") _Group_(annotes _SAL_nop_impl_)
227 #endif
228 #endif
229 
230 
231 //============================================================================
232 // Structural SAL:
233 // These annotations modify the use of other annotations. They may
234 // express the annotation target (i.e. what parameter/field the annotation
235 // applies to) or the condition under which the annotation is applicable.
236 //============================================================================
237 
238 // _At_(target, annos) specifies that the annotations listed in 'annos' is to
239 // be applied to 'target' rather than to the identifier which is the current
240 // lexical target.
241 #define _At_(target, annos) _At_impl_(target, annos _SAL_nop_impl_)
242 
243 // _At_buffer_(target, iter, bound, annos) is similar to _At_, except that
244 // target names a buffer, and each annotation in annos is applied to each
245 // element of target up to bound, with the variable named in iter usable
246 // by the annotations to refer to relevant offsets within target.
247 #define _At_buffer_(target, iter, bound, annos) _At_buffer_impl_(target, iter, bound, annos _SAL_nop_impl_)
248 
249 // _When_(expr, annos) specifies that the annotations listed in 'annos' only
250 // apply when 'expr' evaluates to non-zero.
251 #define _When_(expr, annos) _When_impl_(expr, annos _SAL_nop_impl_)
252 #define _Group_(annos) _Group_impl_(annos _SAL_nop_impl_)
253 #define _GrouP_(annos) _GrouP_impl_(annos _SAL_nop_impl_)
254 
255 // <expr> indicates whether normal post conditions apply to a function
256 #define _Success_(expr) _SAL2_Source_(_Success_, (expr), _Success_impl_(expr))
257 
258 // <expr> indicates whether post conditions apply to a function returning
259 // the type that this annotation is applied to
260 #define _Return_type_success_(expr) _SAL2_Source_(_Return_type_success_, (expr), _Success_impl_(expr))
261 
262 // Establish postconditions that apply only if the function does not succeed
263 #define _On_failure_(annos) _On_failure_impl_(annos _SAL_nop_impl_)
264 
265 // Establish postconditions that apply in both success and failure cases.
266 // Only applicable with functions that have _Success_ or _Return_type_succss_.
267 #define _Always_(annos) _Always_impl_(annos _SAL_nop_impl_)
268 
269 // Usable on a function defintion. Asserts that a function declaration is
270 // in scope, and its annotations are to be used. There are no other annotations
271 // allowed on the function definition.
272 #define _Use_decl_annotations_ _Use_decl_anno_impl_
273 
274 // _Notref_ may precede a _Deref_ or "real" annotation, and removes one
275 // level of dereference if the parameter is a C++ reference (&). If the
276 // net deref on a "real" annotation is negative, it is simply discarded.
277 #define _Notref_ _Notref_impl_
278 
279 // Annotations for defensive programming styles.
280 #define _Pre_defensive_ _SA_annotes0(SAL_pre_defensive)
281 #define _Post_defensive_ _SA_annotes0(SAL_post_defensive)
282 
283 #define _In_defensive_(annotes) _Pre_defensive_ _Group_(annotes)
284 #define _Out_defensive_(annotes) _Post_defensive_ _Group_(annotes)
285 #define _Inout_defensive_(annotes) _Pre_defensive_ _Post_defensive_ _Group_(annotes)
286 
287 //============================================================================
288 // _In_\_Out_ Layer:
289 //============================================================================
290 
291 // Reserved pointer parameters, must always be NULL.
292 #define _Reserved_ _SAL2_Source_(_Reserved_, (), _Pre1_impl_(__null_impl))
293 
294 // _Const_ allows specification that any namable memory location is considered
295 // readonly for a given call.
296 #define _Const_ _SAL2_Source_(_Const_, (), _Pre1_impl_(__readaccess_impl_notref))
297 
298 
299 // Input parameters --------------------------
300 
301 // _In_ - Annotations for parameters where data is passed into the function, but not modified.
302 // _In_ by itself can be used with non-pointer types (although it is redundant).
303 
304 // e.g. void SetPoint( _In_ const POINT* pPT );
305 #define _In_ _SAL2_Source_(_In_, (), _Pre1_impl_(__notnull_impl_notref) _Pre_valid_impl_ _Deref_pre1_impl_(__readaccess_impl_notref))
306 #define _In_opt_ _SAL2_Source_(_In_opt_, (), _Pre1_impl_(__maybenull_impl_notref) _Pre_valid_impl_ _Deref_pre_readonly_)
307 
308 // nullterminated 'in' parameters.
309 // e.g. void CopyStr( _In_z_ const char* szFrom, _Out_z_cap_(cchTo) char* szTo, size_t cchTo );
310 #define _In_z_ _SAL2_Source_(_In_z_, (), _In_ _Pre1_impl_(__zterm_impl))
311 #define _In_opt_z_ _SAL2_Source_(_In_opt_z_, (), _In_opt_ _Pre1_impl_(__zterm_impl))
312 
313 
314 // 'input' buffers with given size
315 
316 #define _In_reads_(size) _SAL2_Source_(_In_reads_, (size), _Pre_count_(size) _Deref_pre_readonly_)
317 #define _In_reads_opt_(size) _SAL2_Source_(_In_reads_opt_, (size), _Pre_opt_count_(size) _Deref_pre_readonly_)
318 #define _In_reads_bytes_(size) _SAL2_Source_(_In_reads_bytes_, (size), _Pre_bytecount_(size) _Deref_pre_readonly_)
319 #define _In_reads_bytes_opt_(size) _SAL2_Source_(_In_reads_bytes_opt_, (size), _Pre_opt_bytecount_(size) _Deref_pre_readonly_)
320 #define _In_reads_z_(size) _SAL2_Source_(_In_reads_z_, (size), _In_reads_(size) _Pre_z_)
321 #define _In_reads_opt_z_(size) _SAL2_Source_(_In_reads_opt_z_, (size), _Pre_opt_count_(size) _Deref_pre_readonly_ _Pre_opt_z_)
322 #define _In_reads_or_z_(size) _SAL2_Source_(_In_reads_or_z_, (size), _In_ _When_(_String_length_(_Curr_) < (size), _Pre_z_) _When_(_String_length_(_Curr_) >= (size), _Pre1_impl_(__count_impl(size))))
323 #define _In_reads_or_z_opt_(size) _SAL2_Source_(_In_reads_or_z_opt_, (size), _In_opt_ _When_(_String_length_(_Curr_) < (size), _Pre_z_) _When_(_String_length_(_Curr_) >= (size), _Pre1_impl_(__count_impl(size))))
324 
325 
326 // 'input' buffers valid to the given end pointer
327 
328 #define _In_reads_to_ptr_(ptr) _SAL2_Source_(_In_reads_to_ptr_, (ptr), _Pre_ptrdiff_count_(ptr) _Deref_pre_readonly_)
329 #define _In_reads_to_ptr_opt_(ptr) _SAL2_Source_(_In_reads_to_ptr_opt_, (ptr), _Pre_opt_ptrdiff_count_(ptr) _Deref_pre_readonly_)
330 #define _In_reads_to_ptr_z_(ptr) _SAL2_Source_(_In_reads_to_ptr_z_, (ptr), _In_reads_to_ptr_(ptr) _Pre_z_)
331 #define _In_reads_to_ptr_opt_z_(ptr) _SAL2_Source_(_In_reads_to_ptr_opt_z_, (ptr), _Pre_opt_ptrdiff_count_(ptr) _Deref_pre_readonly_ _Pre_opt_z_)
332 
333 
334 
335 // Output parameters --------------------------
336 
337 // _Out_ - Annotations for pointer or reference parameters where data passed back to the caller.
338 // These are mostly used where the pointer/reference is to a non-pointer type.
339 // _Outptr_/_Outref) (see below) are typically used to return pointers via parameters.
340 
341 // e.g. void GetPoint( _Out_ POINT* pPT );
342 #define _Out_ _SAL2_Source_(_Out_, (), _Out_impl_)
343 #define _Out_opt_ _SAL2_Source_(_Out_opt_, (), _Out_opt_impl_)
344 
345 #define _Out_writes_(size) _SAL2_Source_(_Out_writes_, (size), _Pre_cap_(size) _Post_valid_impl_)
346 #define _Out_writes_opt_(size) _SAL2_Source_(_Out_writes_opt_, (size), _Pre_opt_cap_(size) _Post_valid_impl_)
347 #define _Out_writes_bytes_(size) _SAL2_Source_(_Out_writes_bytes_, (size), _Pre_bytecap_(size) _Post_valid_impl_)
348 #define _Out_writes_bytes_opt_(size) _SAL2_Source_(_Out_writes_bytes_opt_, (size), _Pre_opt_bytecap_(size) _Post_valid_impl_)
349 #define _Out_writes_z_(size) _SAL2_Source_(_Out_writes_z_, (size), _Pre_cap_(size) _Post_valid_impl_ _Post_z_)
350 #define _Out_writes_opt_z_(size) _SAL2_Source_(_Out_writes_opt_z_, (size), _Pre_opt_cap_(size) _Post_valid_impl_ _Post_z_)
351 
352 #define _Out_writes_to_(size,count) _SAL2_Source_(_Out_writes_to_, (size,count), _Pre_cap_(size) _Post_valid_impl_ _Post_count_(count))
353 #define _Out_writes_to_opt_(size,count) _SAL2_Source_(_Out_writes_to_opt_, (size,count), _Pre_opt_cap_(size) _Post_valid_impl_ _Post_count_(count))
354 #define _Out_writes_all_(size) _SAL2_Source_(_Out_writes_all_, (size), _Out_writes_to_(_Old_(size), _Old_(size)))
355 #define _Out_writes_all_opt_(size) _SAL2_Source_(_Out_writes_all_opt_, (size), _Out_writes_to_opt_(_Old_(size), _Old_(size)))
356 
357 #define _Out_writes_bytes_to_(size,count) _SAL2_Source_(_Out_writes_bytes_to_, (size,count), _Pre_bytecap_(size) _Post_valid_impl_ _Post_bytecount_(count))
358 #define _Out_writes_bytes_to_opt_(size,count) _SAL2_Source_(_Out_writes_bytes_to_opt_, (size,count), _Pre_opt_bytecap_(size) _Post_valid_impl_ _Post_bytecount_(count))
359 #define _Out_writes_bytes_all_(size) _SAL2_Source_(_Out_writes_bytes_all_, (size), _Out_writes_bytes_to_(_Old_(size), _Old_(size)))
360 #define _Out_writes_bytes_all_opt_(size) _SAL2_Source_(_Out_writes_bytes_all_opt_, (size), _Out_writes_bytes_to_opt_(_Old_(size), _Old_(size)))
361 
362 #define _Out_writes_to_ptr_(ptr) _SAL2_Source_(_Out_writes_to_ptr_, (ptr), _Pre_ptrdiff_cap_(ptr) _Post_valid_impl_)
363 #define _Out_writes_to_ptr_opt_(ptr) _SAL2_Source_(_Out_writes_to_ptr_opt_, (ptr), _Pre_opt_ptrdiff_cap_(ptr) _Post_valid_impl_)
364 #define _Out_writes_to_ptr_z_(ptr) _SAL2_Source_(_Out_writes_to_ptr_z_, (ptr), _Pre_ptrdiff_cap_(ptr) _Post_valid_impl_ Post_z_)
365 #define _Out_writes_to_ptr_opt_z_(ptr) _SAL2_Source_(_Out_writes_to_ptr_opt_z_, (ptr), _Pre_opt_ptrdiff_cap_(ptr) _Post_valid_impl_ Post_z_)
366 
367 
368 // Inout parameters ----------------------------
369 
370 // _Inout_ - Annotations for pointer or reference parameters where data is passed in and
371 // potentially modified.
372 // void ModifyPoint( _Inout_ POINT* pPT );
373 // void ModifyPointByRef( _Inout_ POINT& pPT );
374 
375 #define _Inout_ _SAL2_Source_(_Inout_, (), _Prepost_valid_)
376 #define _Inout_opt_ _SAL2_Source_(_Inout_opt_, (), _Prepost_opt_valid_)
377 
378 // For modifying string buffers
379 // void toupper( _Inout_z_ char* sz );
380 #define _Inout_z_ _SAL2_Source_(_Inout_z_, (), _Prepost_z_)
381 #define _Inout_opt_z_ _SAL2_Source_(_Inout_opt_z_, (), _Prepost_opt_z_)
382 
383 // For modifying buffers with explicit element size
384 #define _Inout_updates_(size) _SAL2_Source_(_Inout_updates_, (size), _Pre_cap_(size) _Pre_valid_impl_ _Post_valid_impl_)
385 #define _Inout_updates_opt_(size) _SAL2_Source_(_Inout_updates_opt_, (size), _Pre_opt_cap_(size) _Pre_valid_impl_ _Post_valid_impl_)
386 #define _Inout_updates_z_(size) _SAL2_Source_(_Inout_updates_z_, (size), _Pre_cap_(size) _Pre_valid_impl_ _Post_valid_impl_ _Pre1_impl_(__zterm_impl) _Post1_impl_(__zterm_impl))
387 #define _Inout_updates_opt_z_(size) _SAL2_Source_(_Inout_updates_opt_z_, (size), _Pre_opt_cap_(size) _Pre_valid_impl_ _Post_valid_impl_ _Pre1_impl_(__zterm_impl) _Post1_impl_(__zterm_impl))
388 
389 #define _Inout_updates_to_(size,count) _SAL2_Source_(_Inout_updates_to_, (size,count), _Out_writes_to_(size,count) _Pre_valid_impl_ _Pre1_impl_(__count_impl(size)))
390 #define _Inout_updates_to_opt_(size,count) _SAL2_Source_(_Inout_updates_to_opt_, (size,count), _Out_writes_to_opt_(size,count) _Pre_valid_impl_ _Pre1_impl_(__count_impl(size)))
391 
392 #define _Inout_updates_all_(size) _SAL2_Source_(_Inout_updates_all_, (size), _Inout_updates_to_(_Old_(size), _Old_(size)))
393 #define _Inout_updates_all_opt_(size) _SAL2_Source_(_Inout_updates_all_opt_, (size), _Inout_updates_to_opt_(_Old_(size), _Old_(size)))
394 
395 // For modifying buffers with explicit byte size
396 #define _Inout_updates_bytes_(size) _SAL2_Source_(_Inout_updates_bytes_, (size), _Pre_bytecap_(size) _Pre_valid_impl_ _Post_valid_impl_)
397 #define _Inout_updates_bytes_opt_(size) _SAL2_Source_(_Inout_updates_bytes_opt_, (size), _Pre_opt_bytecap_(size) _Pre_valid_impl_ _Post_valid_impl_)
398 
399 #define _Inout_updates_bytes_to_(size,count) _SAL2_Source_(_Inout_updates_bytes_to_, (size,count), _Out_writes_bytes_to_(size,count) _Pre_valid_impl_ _Pre1_impl_(__bytecount_impl(size)))
400 #define _Inout_updates_bytes_to_opt_(size,count) _SAL2_Source_(_Inout_updates_bytes_to_opt_, (size,count), _Out_writes_bytes_to_opt_(size,count) _Pre_valid_impl_ _Pre1_impl_(__bytecount_impl(size)))
401 
402 #define _Inout_updates_bytes_all_(size) _SAL2_Source_(_Inout_updates_bytes_all_, (size), _Inout_updates_bytes_to_(_Old_(size), _Old_(size)))
403 #define _Inout_updates_bytes_all_opt_(size) _SAL2_Source_(_Inout_updates_bytes_all_opt_, (size), _Inout_updates_bytes_to_opt_(_Old_(size), _Old_(size)))
404 
405 
406 // Pointer to pointer parameters -------------------------
407 
408 // _Outptr_ - Annotations for output params returning pointers
409 // These describe parameters where the called function provides the buffer:
410 // HRESULT SHStrDupW(_In_ LPCWSTR psz, _Outptr_ LPWSTR *ppwsz);
411 // The caller passes the address of an LPWSTR variable as ppwsz, and SHStrDupW allocates
412 // and initializes memory and returns the pointer to the new LPWSTR in *ppwsz.
413 //
414 // _Outptr_opt_ - describes parameters that are allowed to be NULL.
415 // _Outptr_*_result_maybenull_ - describes parameters where the called function might return NULL to the caller.
416 //
417 // Example:
418 // void MyFunc(_Outptr_opt_ int **ppData1, _Outptr_result_maybenull_ int **ppData2);
419 // Callers:
420 // MyFunc(NULL, NULL); // error: parameter 2, ppData2, should not be NULL
421 // MyFunc(&pData1, &pData2); // ok: both non-NULL
422 // if (*pData1 == *pData2) ... // error: pData2 might be NULL after call
423 
424 #define _Outptr_ _SAL2_Source_(_Outptr_, (), _Out_impl_ _Deref_post2_impl_(__notnull_impl_notref, __count_impl(1)))
425 #define _Outptr_result_maybenull_ _SAL2_Source_(_Outptr_result_maybenull_, (), _Out_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __count_impl(1)))
426 #define _Outptr_opt_ _SAL2_Source_(_Outptr_opt_, (), _Out_opt_impl_ _Deref_post2_impl_(__notnull_impl_notref, __count_impl(1)))
427 #define _Outptr_opt_result_maybenull_ _SAL2_Source_(_Outptr_opt_result_maybenull_, (), _Out_opt_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __count_impl(1)))
428 
429 // Annotations for _Outptr_ parameters returning pointers to null terminated strings.
430 
431 #define _Outptr_result_z_ _SAL2_Source_(_Outptr_result_z_, (), _Out_impl_ _Deref_post_z_)
432 #define _Outptr_opt_result_z_ _SAL2_Source_(_Outptr_opt_result_z_, (), _Out_opt_impl_ _Deref_post_z_)
433 #define _Outptr_result_maybenull_z_ _SAL2_Source_(_Outptr_result_maybenull_z_, (), _Out_impl_ _Deref_post_opt_z_)
434 #define _Outptr_opt_result_maybenull_z_ _SAL2_Source_(_Outptr_opt_result_maybenull_z_, (), _Out_opt_impl_ _Deref_post_opt_z_)
435 
436 // Annotations for _Outptr_ parameters where the output pointer is set to NULL if the function fails.
437 
438 #define _Outptr_result_nullonfailure_ _SAL2_Source_(_Outptr_result_nullonfailure_, (), _Outptr_ _On_failure_(_Deref_post_null_))
439 #define _Outptr_opt_result_nullonfailure_ _SAL2_Source_(_Outptr_opt_result_nullonfailure_, (), _Outptr_opt_ _On_failure_(_Deref_post_null_))
440 
441 // Annotations for _Outptr_ parameters which return a pointer to a ref-counted COM object,
442 // following the COM convention of setting the output to NULL on failure.
443 // The current implementation is identical to _Outptr_result_nullonfailure_.
444 // For pointers to types that are not COM objects, _Outptr_result_nullonfailure_ is preferred.
445 
446 #define _COM_Outptr_ _SAL2_Source_(_COM_Outptr_, (), _Outptr_ _On_failure_(_Deref_post_null_))
447 #define _COM_Outptr_result_maybenull_ _SAL2_Source_(_COM_Outptr_result_maybenull_, (), _Outptr_result_maybenull_ _On_failure_(_Deref_post_null_))
448 #define _COM_Outptr_opt_ _SAL2_Source_(_COM_Outptr_opt_, (), _Outptr_opt_ _On_failure_(_Deref_post_null_))
449 #define _COM_Outptr_opt_result_maybenull_ _SAL2_Source_(_COM_Outptr_opt_result_maybenull_, (), _Outptr_opt_result_maybenull_ _On_failure_(_Deref_post_null_))
450 
451 // Annotations for _Outptr_ parameters returning a pointer to buffer with a specified number of elements/bytes
452 
453 #define _Outptr_result_buffer_(size) _SAL2_Source_(_Outptr_result_buffer_, (size), _Out_impl_ _Deref_post2_impl_(__notnull_impl_notref, __cap_impl(size)))
454 #define _Outptr_opt_result_buffer_(size) _SAL2_Source_(_Outptr_opt_result_buffer_, (size), _Out_opt_impl_ _Deref_post2_impl_(__notnull_impl_notref, __cap_impl(size)))
455 #define _Outptr_result_buffer_to_(size, count) _SAL2_Source_(_Outptr_result_buffer_to_, (size, count), _Out_impl_ _Deref_post3_impl_(__notnull_impl_notref, __cap_impl(size), __count_impl(count)))
456 #define _Outptr_opt_result_buffer_to_(size, count) _SAL2_Source_(_Outptr_opt_result_buffer_to_, (size, count), _Out_opt_impl_ _Deref_post3_impl_(__notnull_impl_notref, __cap_impl(size), __count_impl(count)))
457 
458 #define _Outptr_result_buffer_all_(size) _SAL2_Source_(_Outptr_result_buffer_all_, (size), _Out_impl_ _Deref_post2_impl_(__notnull_impl_notref, __count_impl(size)))
459 #define _Outptr_opt_result_buffer_all_(size) _SAL2_Source_(_Outptr_opt_result_buffer_all_, (size), _Out_opt_impl_ _Deref_post2_impl_(__notnull_impl_notref, __count_impl(size)))
460 
461 #define _Outptr_result_buffer_maybenull_(size) _SAL2_Source_(_Outptr_result_buffer_maybenull_, (size), _Out_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __cap_impl(size)))
462 #define _Outptr_opt_result_buffer_maybenull_(size) _SAL2_Source_(_Outptr_opt_result_buffer_maybenull_, (size), _Out_opt_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __cap_impl(size)))
463 #define _Outptr_result_buffer_to_maybenull_(size, count) _SAL2_Source_(_Outptr_result_buffer_to_maybenull_, (size, count), _Out_impl_ _Deref_post3_impl_(__maybenull_impl_notref, __cap_impl(size), __count_impl(count)))
464 #define _Outptr_opt_result_buffer_to_maybenull_(size, count) _SAL2_Source_(_Outptr_opt_result_buffer_to_maybenull_, (size, count), _Out_opt_impl_ _Deref_post3_impl_(__maybenull_impl_notref, __cap_impl(size), __count_impl(count)))
465 
466 #define _Outptr_result_buffer_all_maybenull_(size) _SAL2_Source_(_Outptr_result_buffer_all_maybenull_, (size), _Out_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __count_impl(size)))
467 #define _Outptr_opt_result_buffer_all_maybenull_(size) _SAL2_Source_(_Outptr_opt_result_buffer_all_maybenull_, (size), _Out_opt_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __count_impl(size)))
468 
469 #define _Outptr_result_bytebuffer_(size) _SAL2_Source_(_Outptr_result_bytebuffer_, (size), _Out_impl_ _Deref_post2_impl_(__notnull_impl_notref, __bytecap_impl(size)))
470 #define _Outptr_opt_result_bytebuffer_(size) _SAL2_Source_(_Outptr_opt_result_bytebuffer_, (size), _Out_opt_impl_ _Deref_post2_impl_(__notnull_impl_notref, __bytecap_impl(size)))
471 #define _Outptr_result_bytebuffer_to_(size, count) _SAL2_Source_(_Outptr_result_bytebuffer_to_, (size, count), _Out_impl_ _Deref_post3_impl_(__notnull_impl_notref, __bytecap_impl(size), __bytecount_impl(count)))
472 #define _Outptr_opt_result_bytebuffer_to_(size, count) _SAL2_Source_(_Outptr_opt_result_bytebuffer_to_, (size, count), _Out_opt_impl_ _Deref_post3_impl_(__notnull_impl_notref, __bytecap_impl(size), __bytecount_impl(count)))
473 
474 #define _Outptr_result_bytebuffer_all_(size) _SAL2_Source_(_Outptr_result_bytebuffer_all_, (size), _Out_impl_ _Deref_post2_impl_(__notnull_impl_notref, __bytecount_impl(size)))
475 #define _Outptr_opt_result_bytebuffer_all_(size) _SAL2_Source_(_Outptr_opt_result_bytebuffer_all_, (size), _Out_opt_impl_ _Deref_post2_impl_(__notnull_impl_notref, __bytecount_impl(size)))
476 
477 #define _Outptr_result_bytebuffer_maybenull_(size) _SAL2_Source_(_Outptr_result_bytebuffer_maybenull_, (size), _Out_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __bytecap_impl(size)))
478 #define _Outptr_opt_result_bytebuffer_maybenull_(size) _SAL2_Source_(_Outptr_opt_result_bytebuffer_maybenull_, (size), _Out_opt_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __bytecap_impl(size)))
479 #define _Outptr_result_bytebuffer_to_maybenull_(size, count) _SAL2_Source_(_Outptr_result_bytebuffer_to_maybenull_, (size, count), _Out_impl_ _Deref_post3_impl_(__maybenull_impl_notref, __bytecap_impl(size), __bytecount_impl(count)))
480 #define _Outptr_opt_result_bytebuffer_to_maybenull_(size, count) _SAL2_Source_(_Outptr_opt_result_bytebuffer_to_maybenull_, (size, count), _Out_opt_impl_ _Deref_post3_impl_(__maybenull_impl_notref, __bytecap_impl(size), __bytecount_impl(count)))
481 
482 #define _Outptr_result_bytebuffer_all_maybenull_(size) _SAL2_Source_(_Outptr_result_bytebuffer_all_maybenull_, (size), _Out_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __bytecount_impl(size)))
483 #define _Outptr_opt_result_bytebuffer_all_maybenull_(size) _SAL2_Source_(_Outptr_opt_result_bytebuffer_all_maybenull_, (size), _Out_opt_impl_ _Deref_post2_impl_(__maybenull_impl_notref, __bytecount_impl(size)))
484 
485 // Annotations for output reference to pointer parameters.
486 
487 #define _Outref_ _SAL2_Source_(_Outref_, (), _Out_impl_ _Post_notnull_)
488 #define _Outref_result_maybenull_ _SAL2_Source_(_Outref_result_maybenull_, (), _Pre2_impl_(__notnull_impl_notref, __cap_c_one_notref_impl) _Post_maybenull_ _Post_valid_impl_)
489 
490 #define _Outref_result_buffer_(size) _SAL2_Source_(_Outref_result_buffer_, (size), _Outref_ _Post1_impl_(__cap_impl(size)))
491 #define _Outref_result_bytebuffer_(size) _SAL2_Source_(_Outref_result_bytebuffer_, (size), _Outref_ _Post1_impl_(__bytecap_impl(size)))
492 #define _Outref_result_buffer_to_(size, count) _SAL2_Source_(_Outref_result_buffer_to_, (size, count), _Outref_result_buffer_(size) _Post1_impl_(__count_impl(count)))
493 #define _Outref_result_bytebuffer_to_(size, count) _SAL2_Source_(_Outref_result_bytebuffer_to_, (size, count), _Outref_result_bytebuffer_(size) _Post1_impl_(__bytecount_impl(count)))
494 #define _Outref_result_buffer_all_(size) _SAL2_Source_(_Outref_result_buffer_all_, (size), _Outref_result_buffer_to_(size, _Old_(size)))
495 #define _Outref_result_bytebuffer_all_(size) _SAL2_Source_(_Outref_result_bytebuffer_all_, (size), _Outref_result_bytebuffer_to_(size, _Old_(size)))
496 
497 #define _Outref_result_buffer_maybenull_(size) _SAL2_Source_(_Outref_result_buffer_maybenull_, (size), _Outref_result_maybenull_ _Post1_impl_(__cap_impl(size)))
498 #define _Outref_result_bytebuffer_maybenull_(size) _SAL2_Source_(_Outref_result_bytebuffer_maybenull_, (size), _Outref_result_maybenull_ _Post1_impl_(__bytecap_impl(size)))
499 #define _Outref_result_buffer_to_maybenull_(size, count) _SAL2_Source_(_Outref_result_buffer_to_maybenull_, (size, count), _Outref_result_buffer_maybenull_(size) _Post1_impl_(__count_impl(count)))
500 #define _Outref_result_bytebuffer_to_maybenull_(size, count) _SAL2_Source_(_Outref_result_bytebuffer_to_maybenull_, (size, count), _Outref_result_bytebuffer_maybenull_(size) _Post1_impl_(__bytecount_impl(count)))
501 #define _Outref_result_buffer_all_maybenull_(size) _SAL2_Source_(_Outref_result_buffer_all_maybenull_, (size), _Outref_result_buffer_to_maybenull_(size, _Old_(size)))
502 #define _Outref_result_bytebuffer_all_maybenull_(size) _SAL2_Source_(_Outref_result_bytebuffer_all_maybenull_, (size), _Outref_result_bytebuffer_to_maybenull_(size, _Old_(size)))
503 
504 // Annotations for output reference to pointer parameters that guarantee
505 // that the pointer is set to NULL on failure.
506 #define _Outref_result_nullonfailure_ _SAL2_Source_(_Outref_result_nullonfailure_, (), _Outref_ _On_failure_(_Post_null_))
507 
508 // Generic annotations to set output value of a by-pointer or by-reference parameter to null/zero on failure.
509 #define _Result_nullonfailure_ _SAL2_Source_(_Result_nullonfailure_, (), _On_failure_(_Notref_impl_ _Deref_impl_ _Post_null_))
510 #define _Result_zeroonfailure_ _SAL2_Source_(_Result_zeroonfailure_, (), _On_failure_(_Notref_impl_ _Deref_impl_ _Out_range_(==, 0)))
511 
512 
513 // return values -------------------------------
514 
515 //
516 // _Ret_ annotations
517 //
518 // describing conditions that hold for return values after the call
519 
520 // e.g. _Ret_z_ CString::operator const wchar_t*() const throw();
521 #define _Ret_z_ _SAL2_Source_(_Ret_z_, (), _Ret2_impl_(__notnull_impl, __zterm_impl) _Ret_valid_impl_)
522 #define _Ret_maybenull_z_ _SAL2_Source_(_Ret_maybenull_z_, (), _Ret2_impl_(__maybenull_impl,__zterm_impl) _Ret_valid_impl_)
523 
524 // used with allocated but not yet initialized objects
525 #define _Ret_notnull_ _SAL2_Source_(_Ret_notnull_, (), _Ret1_impl_(__notnull_impl))
526 #define _Ret_maybenull_ _SAL2_Source_(_Ret_maybenull_, (), _Ret1_impl_(__maybenull_impl))
527 #define _Ret_null_ _SAL2_Source_(_Ret_null_, (), _Ret1_impl_(__null_impl))
528 
529 // used with allocated and initialized objects
530 // returns single valid object
531 #define _Ret_valid_ _SAL2_Source_(_Ret_valid_, (), _Ret1_impl_(__notnull_impl_notref) _Ret_valid_impl_)
532 
533 // returns pointer to initialized buffer of specified size
534 #define _Ret_writes_(size) _SAL2_Source_(_Ret_writes_, (size), _Ret2_impl_(__notnull_impl, __count_impl(size)) _Ret_valid_impl_)
535 #define _Ret_writes_z_(size) _SAL2_Source_(_Ret_writes_z_, (size), _Ret3_impl_(__notnull_impl, __count_impl(size), __zterm_impl) _Ret_valid_impl_)
536 #define _Ret_writes_bytes_(size) _SAL2_Source_(_Ret_writes_bytes_, (size), _Ret2_impl_(__notnull_impl, __bytecount_impl(size)) _Ret_valid_impl_)
537 #define _Ret_writes_maybenull_(size) _SAL2_Source_(_Ret_writes_maybenull_, (size), _Ret2_impl_(__maybenull_impl,__count_impl(size)) _Ret_valid_impl_)
538 #define _Ret_writes_maybenull_z_(size) _SAL2_Source_(_Ret_writes_maybenull_z_, (size), _Ret3_impl_(__maybenull_impl,__count_impl(size),__zterm_impl) _Ret_valid_impl_)
539 #define _Ret_writes_bytes_maybenull_(size) _SAL2_Source_(_Ret_writes_bytes_maybenull_, (size), _Ret2_impl_(__maybenull_impl,__bytecount_impl(size)) _Ret_valid_impl_)
540 
541 // returns pointer to partially initialized buffer, with total size 'size' and initialized size 'count'
542 #define _Ret_writes_to_(size,count) _SAL2_Source_(_Ret_writes_to_, (size,count), _Ret3_impl_(__notnull_impl, __cap_impl(size), __count_impl(count)) _Ret_valid_impl_)
543 #define _Ret_writes_bytes_to_(size,count) _SAL2_Source_(_Ret_writes_bytes_to_, (size,count), _Ret3_impl_(__notnull_impl, __bytecap_impl(size), __bytecount_impl(count)) _Ret_valid_impl_)
544 #define _Ret_writes_to_maybenull_(size,count) _SAL2_Source_(_Ret_writes_to_maybenull_, (size,count), _Ret3_impl_(__maybenull_impl, __cap_impl(size), __count_impl(count)) _Ret_valid_impl_)
545 #define _Ret_writes_bytes_to_maybenull_(size,count) _SAL2_Source_(_Ret_writes_bytes_to_maybenull_, (size,count), _Ret3_impl_(__maybenull_impl, __bytecap_impl(size), __bytecount_impl(count)) _Ret_valid_impl_)
546 
547 
548 // Annotations for strict type checking
549 #define _Points_to_data_ _SAL2_Source_(_Points_to_data_, (), _Pre_ _Points_to_data_impl_)
550 #define _Literal_ _SAL2_Source_(_Literal_, (), _Pre_ _Literal_impl_)
551 #define _Notliteral_ _SAL2_Source_(_Notliteral_, (), _Pre_ _Notliteral_impl_)
552 
553 // Check the return value of a function e.g. _Check_return_ ErrorCode Foo();
554 #define _Check_return_ _SAL2_Source_(_Check_return_, (), _Check_return_impl_)
555 #define _Must_inspect_result_ _SAL2_Source_(_Must_inspect_result_, (), _Must_inspect_impl_ _Check_return_impl_)
556 
557 // e.g. MyPrintF( _Printf_format_string_ const wchar_t* wzFormat, ... );
558 #define _Printf_format_string_ _SAL2_Source_(_Printf_format_string_, (), _Printf_format_string_impl_)
559 #define _Scanf_format_string_ _SAL2_Source_(_Scanf_format_string_, (), _Scanf_format_string_impl_)
560 #define _Scanf_s_format_string_ _SAL2_Source_(_Scanf_s_format_string_, (), _Scanf_s_format_string_impl_)
561 
562 #define _Format_string_impl_(kind,where) _SA_annotes2(SAL_IsFormatString2, kind, where)
563 #define _Printf_format_string_params_(x) _SAL2_Source_(_Printf_format_string_params_, (x), _Format_string_impl_("printf", x))
564 #define _Scanf_format_string_params_(x) _SAL2_Source_(_Scanf_format_string_params_, (x), _Format_string_impl_("scanf", x))
565 #define _Scanf_s_format_string_params_(x) _SAL2_Source_(_Scanf_s_format_string_params_, (x), _Format_string_impl_("scanf_s", x))
566 
567 // annotations to express value of integral or pointer parameter
568 #define _In_range_(lb,ub) _SAL2_Source_(_In_range_, (lb,ub), _In_range_impl_(lb,ub))
569 #define _Out_range_(lb,ub) _SAL2_Source_(_Out_range_, (lb,ub), _Out_range_impl_(lb,ub))
570 #define _Ret_range_(lb,ub) _SAL2_Source_(_Ret_range_, (lb,ub), _Ret_range_impl_(lb,ub))
571 #define _Deref_in_range_(lb,ub) _SAL2_Source_(_Deref_in_range_, (lb,ub), _Deref_in_range_impl_(lb,ub))
572 #define _Deref_out_range_(lb,ub) _SAL2_Source_(_Deref_out_range_, (lb,ub), _Deref_out_range_impl_(lb,ub))
573 #define _Deref_ret_range_(lb,ub) _SAL2_Source_(_Deref_ret_range_, (lb,ub), _Deref_ret_range_impl_(lb,ub))
574 #define _Pre_equal_to_(expr) _SAL2_Source_(_Pre_equal_to_, (expr), _In_range_(==, expr))
575 #define _Post_equal_to_(expr) _SAL2_Source_(_Post_equal_to_, (expr), _Out_range_(==, expr))
576 
577 // annotation to express that a value (usually a field of a mutable class)
578 // is not changed by a function call
579 #define _Unchanged_(e) _SAL2_Source_(_Unchanged_, (e), _At_(e, _Post_equal_to_(_Old_(e)) _Const_))
580 
581 // Annotations to allow expressing generalized pre and post conditions.
582 // 'cond' may be any valid SAL expression that is considered to be true as a precondition
583 // or postcondition (respsectively).
584 #define _Pre_satisfies_(cond) _SAL2_Source_(_Pre_satisfies_, (cond), _Pre_satisfies_impl_(cond))
585 #define _Post_satisfies_(cond) _SAL2_Source_(_Post_satisfies_, (cond), _Post_satisfies_impl_(cond))
586 
587 // Annotations to express struct, class and field invariants
588 #define _Struct_size_bytes_(size) _SAL2_Source_(_Struct_size_bytes_, (size), _Writable_bytes_(size))
589 
590 #define _Field_size_(size) _SAL2_Source_(_Field_size_, (size), _Notnull_ _Writable_elements_(size))
591 #define _Field_size_opt_(size) _SAL2_Source_(_Field_size_opt_, (size), _Maybenull_ _Writable_elements_(size))
592 #define _Field_size_part_(size, count) _SAL2_Source_(_Field_size_part_, (size, count), _Notnull_ _Writable_elements_(size) _Readable_elements_(count))
593 #define _Field_size_part_opt_(size, count) _SAL2_Source_(_Field_size_part_opt_, (size, count), _Maybenull_ _Writable_elements_(size) _Readable_elements_(count))
594 #define _Field_size_full_(size) _SAL2_Source_(_Field_size_full_, (size), _Field_size_part_(size, size))
595 #define _Field_size_full_opt_(size) _SAL2_Source_(_Field_size_full_opt_, (size), _Field_size_part_opt_(size, size))
596 
597 #define _Field_size_bytes_(size) _SAL2_Source_(_Field_size_bytes_, (size), _Notnull_ _Writable_bytes_(size))
598 #define _Field_size_bytes_opt_(size) _SAL2_Source_(_Field_size_bytes_opt_, (size), _Maybenull_ _Writable_bytes_(size))
599 #define _Field_size_bytes_part_(size, count) _SAL2_Source_(_Field_size_bytes_part_, (size, count), _Notnull_ _Writable_bytes_(size) _Readable_bytes_(count))
600 #define _Field_size_bytes_part_opt_(size, count) _SAL2_Source_(_Field_size_bytes_part_opt_, (size, count), _Maybenull_ _Writable_bytes_(size) _Readable_bytes_(count))
601 #define _Field_size_bytes_full_(size) _SAL2_Source_(_Field_size_bytes_full_, (size), _Field_size_bytes_part_(size, size))
602 #define _Field_size_bytes_full_opt_(size) _SAL2_Source_(_Field_size_bytes_full_opt_, (size), _Field_size_bytes_part_opt_(size, size))
603 
604 #define _Field_z_ _SAL2_Source_(_Field_z_, (), _Null_terminated_)
605 
606 #define _Field_range_(min,max) _SAL2_Source_(_Field_range_, (min,max), _Field_range_impl_(min,max))
607 
608 //============================================================================
609 // _Pre_\_Post_ Layer:
610 //============================================================================
611 
612 //
613 // Raw Pre/Post for declaring custom pre/post conditions
614 //
615 
616 #define _Pre_ _Pre_impl_
617 #define _Post_ _Post_impl_
618 
619 //
620 // Validity property
621 //
622 
623 #define _Valid_ _Valid_impl_
624 #define _Notvalid_ _Notvalid_impl_
625 #define _Maybevalid_ _Maybevalid_impl_
626 
627 //
628 // Buffer size properties
629 //
630 
631 // Expressing buffer sizes without specifying pre or post condition
632 #define _Readable_bytes_(size) _SAL2_Source_(_Readable_bytes_, (size), _Readable_bytes_impl_(size))
633 #define _Readable_elements_(size) _SAL2_Source_(_Readable_elements_, (size), _Readable_elements_impl_(size))
634 #define _Writable_bytes_(size) _SAL2_Source_(_Writable_bytes_, (size), _Writable_bytes_impl_(size))
635 #define _Writable_elements_(size) _SAL2_Source_(_Writable_elements_, (size), _Writable_elements_impl_(size))
636 
637 #define _Null_terminated_ _SAL2_Source_(_Null_terminated_, (), _Null_terminated_impl_)
638 #define _NullNull_terminated_ _SAL2_Source_(_NullNull_terminated_, (), _NullNull_terminated_impl_)
639 
640 // Expressing buffer size as pre or post condition
641 #define _Pre_readable_size_(size) _SAL2_Source_(_Pre_readable_size_, (size), _Pre1_impl_(__count_impl(size)) _Pre_valid_impl_)
642 #define _Pre_writable_size_(size) _SAL2_Source_(_Pre_writable_size_, (size), _Pre1_impl_(__cap_impl(size)))
643 #define _Pre_readable_byte_size_(size) _SAL2_Source_(_Pre_readable_byte_size_, (size), _Pre1_impl_(__bytecount_impl(size)) _Pre_valid_impl_)
644 #define _Pre_writable_byte_size_(size) _SAL2_Source_(_Pre_writable_byte_size_, (size), _Pre1_impl_(__bytecap_impl(size)))
645 
646 #define _Post_readable_size_(size) _SAL2_Source_(_Post_readable_size_, (size), _Post1_impl_(__count_impl(size)) _Post_valid_impl_)
647 #define _Post_writable_size_(size) _SAL2_Source_(_Post_writable_size_, (size), _Post1_impl_(__cap_impl(size)))
648 #define _Post_readable_byte_size_(size) _SAL2_Source_(_Post_readable_byte_size_, (size), _Post1_impl_(__bytecount_impl(size)) _Post_valid_impl_)
649 #define _Post_writable_byte_size_(size) _SAL2_Source_(_Post_writable_byte_size_, (size), _Post1_impl_(__bytecap_impl(size)))
650 
651 //
652 // Pointer null-ness properties
653 //
654 #define _Null_ _SAL2_Source_(_Null_, (), _Null_impl_)
655 #define _Notnull_ _SAL2_Source_(_Notnull_, (), _Notnull_impl_)
656 #define _Maybenull_ _SAL2_Source_(_Maybenull_, (), _Maybenull_impl_)
657 
658 //
659 // _Pre_ annotations ---
660 //
661 // describing conditions that must be met before the call of the function
662 
663 // e.g. int strlen( _Pre_z_ const char* sz );
664 // buffer is a zero terminated string
665 #define _Pre_z_ _SAL2_Source_(_Pre_z_, (), _Pre1_impl_(__zterm_impl) _Pre_valid_impl_)
666 
667 // valid size unknown or indicated by type (e.g.:LPSTR)
668 #define _Pre_valid_ _SAL2_Source_(_Pre_valid_, (), _Pre1_impl_(__notnull_impl_notref) _Pre_valid_impl_)
669 #define _Pre_opt_valid_ _SAL2_Source_(_Pre_opt_valid_, (), _Pre1_impl_(__maybenull_impl_notref) _Pre_valid_impl_)
670 
671 #define _Pre_invalid_ _SAL2_Source_(_Pre_invalid_, (), _Deref_pre1_impl_(__notvalid_impl))
672 
673 // Overrides recursive valid when some field is not yet initialized when using _Inout_
674 #define _Pre_unknown_ _SAL2_Source_(_Pre_unknown_, (), _Pre1_impl_(__maybevalid_impl))
675 
676 // used with allocated but not yet initialized objects
677 #define _Pre_notnull_ _SAL2_Source_(_Pre_notnull_, (), _Pre1_impl_(__notnull_impl_notref))
678 #define _Pre_maybenull_ _SAL2_Source_(_Pre_maybenull_, (), _Pre1_impl_(__maybenull_impl_notref))
679 #define _Pre_null_ _SAL2_Source_(_Pre_null_, (), _Pre1_impl_(__null_impl_notref))
680 
681 //
682 // _Post_ annotations ---
683 //
684 // describing conditions that hold after the function call
685 
686 // void CopyStr( _In_z_ const char* szFrom, _Pre_cap_(cch) _Post_z_ char* szFrom, size_t cchFrom );
687 // buffer will be a zero-terminated string after the call
688 #define _Post_z_ _SAL2_Source_(_Post_z_, (), _Post1_impl_(__zterm_impl) _Post_valid_impl_)
689 
690 // e.g. HRESULT InitStruct( _Post_valid_ Struct* pobj );
691 #define _Post_valid_ _SAL2_Source_(_Post_valid_, (), _Post_valid_impl_)
692 #define _Post_invalid_ _SAL2_Source_(_Post_invalid_, (), _Deref_post1_impl_(__notvalid_impl))
693 
694 // e.g. void free( _Post_ptr_invalid_ void* pv );
695 #define _Post_ptr_invalid_ _SAL2_Source_(_Post_ptr_invalid_, (), _Post1_impl_(__notvalid_impl))
696 
697 // e.g. void ThrowExceptionIfNull( _Post_notnull_ const void* pv );
698 #define _Post_notnull_ _SAL2_Source_(_Post_notnull_, (), _Post1_impl_(__notnull_impl))
699 
700 // e.g. HRESULT GetObject(_Outptr_ _On_failure_(_At_(*p, _Post_null_)) T **p);
701 #define _Post_null_ _SAL2_Source_(_Post_null_, (), _Post1_impl_(__null_impl))
702 
703 #define _Post_maybenull_ _SAL2_Source_(_Post_maybenull_, (), _Post1_impl_(__maybenull_impl))
704 
705 #define _Prepost_z_ _SAL2_Source_(_Prepost_z_, (), _Pre_z_ _Post_z_)
706 
707 
708 #pragma region Input Buffer SAL 1 compatibility macros
709 
710 /*==========================================================================
711 
712  This section contains definitions for macros defined for VS2010 and earlier.
713  Usage of these macros is still supported, but the SAL 2 macros defined above
714  are recommended instead. This comment block is retained to assist in
715  understanding SAL that still uses the older syntax.
716 
717  The macros are defined in 3 layers:
718 
719  _In_\_Out_ Layer:
720  ----------------
721  This layer provides the highest abstraction and its macros should be used
722  in most cases. Its macros start with _In_, _Out_ or _Inout_. For the
723  typical case they provide the most concise annotations.
724 
725  _Pre_\_Post_ Layer:
726  ------------------
727  The macros of this layer only should be used when there is no suitable macro
728  in the _In_\_Out_ layer. Its macros start with _Pre_, _Post_, _Ret_,
729  _Deref_pre_ _Deref_post_ and _Deref_ret_. This layer provides the most
730  flexibility for annotations.
731 
732  Implementation Abstraction Layer:
733  --------------------------------
734  Macros from this layer should never be used directly. The layer only exists
735  to hide the implementation of the annotation macros.
736 
737 
738  Annotation Syntax:
739  |--------------|----------|----------------|-----------------------------|
740  | Usage | Nullness | ZeroTerminated | Extent |
741  |--------------|----------|----------------|-----------------------------|
742  | _In_ | <> | <> | <> |
743  | _Out_ | opt_ | z_ | [byte]cap_[c_|x_]( size ) |
744  | _Inout_ | | | [byte]count_[c_|x_]( size ) |
745  | _Deref_out_ | | | ptrdiff_cap_( ptr ) |
746  |--------------| | | ptrdiff_count_( ptr ) |
747  | _Ret_ | | | |
748  | _Deref_ret_ | | | |
749  |--------------| | | |
750  | _Pre_ | | | |
751  | _Post_ | | | |
752  | _Deref_pre_ | | | |
753  | _Deref_post_ | | | |
754  |--------------|----------|----------------|-----------------------------|
755 
756  Usage:
757  -----
758  _In_, _Out_, _Inout_, _Pre_, _Post_, _Deref_pre_, _Deref_post_ are for
759  formal parameters.
760  _Ret_, _Deref_ret_ must be used for return values.
761 
762  Nullness:
763  --------
764  If the pointer can be NULL the annotation contains _opt. If the macro
765  does not contain '_opt' the pointer may not be NULL.
766 
767  String Type:
768  -----------
769  _z: NullTerminated string
770  for _In_ parameters the buffer must have the specified stringtype before the call
771  for _Out_ parameters the buffer must have the specified stringtype after the call
772  for _Inout_ parameters both conditions apply
773 
774  Extent Syntax:
775  |------|---------------|---------------|
776  | Unit | Writ\Readable | Argument Type |
777  |------|---------------|---------------|
778  | <> | cap_ | <> |
779  | byte | count_ | c_ |
780  | | | x_ |
781  |------|---------------|---------------|
782 
783  'cap' (capacity) describes the writable size of the buffer and is typically used
784  with _Out_. The default unit is elements. Use 'bytecap' if the size is given in bytes
785  'count' describes the readable size of the buffer and is typically used with _In_.
786  The default unit is elements. Use 'bytecount' if the size is given in bytes.
787 
788  Argument syntax for cap_, bytecap_, count_, bytecount_:
789  (<parameter>|return)[+n] e.g. cch, return, cb+2
790 
791  If the buffer size is a constant expression use the c_ postfix.
792  E.g. cap_c_(20), count_c_(MAX_PATH), bytecount_c_(16)
793 
794  If the buffer size is given by a limiting pointer use the ptrdiff_ versions
795  of the macros.
796 
797  If the buffer size is neither a parameter nor a constant expression use the x_
798  postfix. e.g. bytecount_x_(num*size) x_ annotations accept any arbitrary string.
799  No analysis can be done for x_ annotations but they at least tell the tool that
800  the buffer has some sort of extent description. x_ annotations might be supported
801  by future compiler versions.
802 
803 ============================================================================*/
804 
805 // e.g. void SetCharRange( _In_count_(cch) const char* rgch, size_t cch )
806 // valid buffer extent described by another parameter
807 #define _In_count_(size) _SAL1_1_Source_(_In_count_, (size), _Pre_count_(size) _Deref_pre_readonly_)
808 #define _In_opt_count_(size) _SAL1_1_Source_(_In_opt_count_, (size), _Pre_opt_count_(size) _Deref_pre_readonly_)
809 #define _In_bytecount_(size) _SAL1_1_Source_(_In_bytecount_, (size), _Pre_bytecount_(size) _Deref_pre_readonly_)
810 #define _In_opt_bytecount_(size) _SAL1_1_Source_(_In_opt_bytecount_, (size), _Pre_opt_bytecount_(size) _Deref_pre_readonly_)
811 
812 // valid buffer extent described by a constant extression
813 #define _In_count_c_(size) _SAL1_1_Source_(_In_count_c_, (size), _Pre_count_c_(size) _Deref_pre_readonly_)
814 #define _In_opt_count_c_(size) _SAL1_1_Source_(_In_opt_count_c_, (size), _Pre_opt_count_c_(size) _Deref_pre_readonly_)
815 #define _In_bytecount_c_(size) _SAL1_1_Source_(_In_bytecount_c_, (size), _Pre_bytecount_c_(size) _Deref_pre_readonly_)
816 #define _In_opt_bytecount_c_(size) _SAL1_1_Source_(_In_opt_bytecount_c_, (size), _Pre_opt_bytecount_c_(size) _Deref_pre_readonly_)
817 
818 // nullterminated 'input' buffers with given size
819 
820 // e.g. void SetCharRange( _In_count_(cch) const char* rgch, size_t cch )
821 // nullterminated valid buffer extent described by another parameter
822 #define _In_z_count_(size) _SAL1_1_Source_(_In_z_count_, (size), _Pre_z_ _Pre_count_(size) _Deref_pre_readonly_)
823 #define _In_opt_z_count_(size) _SAL1_1_Source_(_In_opt_z_count_, (size), _Pre_opt_z_ _Pre_opt_count_(size) _Deref_pre_readonly_)
824 #define _In_z_bytecount_(size) _SAL1_1_Source_(_In_z_bytecount_, (size), _Pre_z_ _Pre_bytecount_(size) _Deref_pre_readonly_)
825 #define _In_opt_z_bytecount_(size) _SAL1_1_Source_(_In_opt_z_bytecount_, (size), _Pre_opt_z_ _Pre_opt_bytecount_(size) _Deref_pre_readonly_)
826 
827 // nullterminated valid buffer extent described by a constant extression
828 #define _In_z_count_c_(size) _SAL1_1_Source_(_In_z_count_c_, (size), _Pre_z_ _Pre_count_c_(size) _Deref_pre_readonly_)
829 #define _In_opt_z_count_c_(size) _SAL1_1_Source_(_In_opt_z_count_c_, (size), _Pre_opt_z_ _Pre_opt_count_c_(size) _Deref_pre_readonly_)
830 #define _In_z_bytecount_c_(size) _SAL1_1_Source_(_In_z_bytecount_c_, (size), _Pre_z_ _Pre_bytecount_c_(size) _Deref_pre_readonly_)
831 #define _In_opt_z_bytecount_c_(size) _SAL1_1_Source_(_In_opt_z_bytecount_c_, (size), _Pre_opt_z_ _Pre_opt_bytecount_c_(size) _Deref_pre_readonly_)
832 
833 // buffer capacity is described by another pointer
834 // e.g. void Foo( _In_ptrdiff_count_(pchMax) const char* pch, const char* pchMax ) { while pch < pchMax ) pch++; }
835 #define _In_ptrdiff_count_(size) _SAL1_1_Source_(_In_ptrdiff_count_, (size), _Pre_ptrdiff_count_(size) _Deref_pre_readonly_)
836 #define _In_opt_ptrdiff_count_(size) _SAL1_1_Source_(_In_opt_ptrdiff_count_, (size), _Pre_opt_ptrdiff_count_(size) _Deref_pre_readonly_)
837 
838 // 'x' version for complex expressions that are not supported by the current compiler version
839 // e.g. void Set3ColMatrix( _In_count_x_(3*cRows) const Elem* matrix, int cRows );
840 #define _In_count_x_(size) _SAL1_1_Source_(_In_count_x_, (size), _Pre_count_x_(size) _Deref_pre_readonly_)
841 #define _In_opt_count_x_(size) _SAL1_1_Source_(_In_opt_count_x_, (size), _Pre_opt_count_x_(size) _Deref_pre_readonly_)
842 #define _In_bytecount_x_(size) _SAL1_1_Source_(_In_bytecount_x_, (size), _Pre_bytecount_x_(size) _Deref_pre_readonly_)
843 #define _In_opt_bytecount_x_(size) _SAL1_1_Source_(_In_opt_bytecount_x_, (size), _Pre_opt_bytecount_x_(size) _Deref_pre_readonly_)
844 
845 
846 // 'out' with buffer size
847 // e.g. void GetIndeces( _Out_cap_(cIndeces) int* rgIndeces, size_t cIndices );
848 // buffer capacity is described by another parameter
849 #define _Out_cap_(size) _SAL1_1_Source_(_Out_cap_, (size), _Pre_cap_(size) _Post_valid_impl_)
850 #define _Out_opt_cap_(size) _SAL1_1_Source_(_Out_opt_cap_, (size), _Pre_opt_cap_(size) _Post_valid_impl_)
851 #define _Out_bytecap_(size) _SAL1_1_Source_(_Out_bytecap_, (size), _Pre_bytecap_(size) _Post_valid_impl_)
852 #define _Out_opt_bytecap_(size) _SAL1_1_Source_(_Out_opt_bytecap_, (size), _Pre_opt_bytecap_(size) _Post_valid_impl_)
853 
854 // buffer capacity is described by a constant expression
855 #define _Out_cap_c_(size) _SAL1_1_Source_(_Out_cap_c_, (size), _Pre_cap_c_(size) _Post_valid_impl_)
856 #define _Out_opt_cap_c_(size) _SAL1_1_Source_(_Out_opt_cap_c_, (size), _Pre_opt_cap_c_(size) _Post_valid_impl_)
857 #define _Out_bytecap_c_(size) _SAL1_1_Source_(_Out_bytecap_c_, (size), _Pre_bytecap_c_(size) _Post_valid_impl_)
858 #define _Out_opt_bytecap_c_(size) _SAL1_1_Source_(_Out_opt_bytecap_c_, (size), _Pre_opt_bytecap_c_(size) _Post_valid_impl_)
859 
860 // buffer capacity is described by another parameter multiplied by a constant expression
861 #define _Out_cap_m_(mult,size) _SAL1_1_Source_(_Out_cap_m_, (mult,size), _Pre_cap_m_(mult,size) _Post_valid_impl_)
862 #define _Out_opt_cap_m_(mult,size) _SAL1_1_Source_(_Out_opt_cap_m_, (mult,size), _Pre_opt_cap_m_(mult,size) _Post_valid_impl_)
863 #define _Out_z_cap_m_(mult,size) _SAL1_1_Source_(_Out_z_cap_m_, (mult,size), _Pre_cap_m_(mult,size) _Post_valid_impl_ _Post_z_)
864 #define _Out_opt_z_cap_m_(mult,size) _SAL1_1_Source_(_Out_opt_z_cap_m_, (mult,size), _Pre_opt_cap_m_(mult,size) _Post_valid_impl_ _Post_z_)
865 
866 // buffer capacity is described by another pointer
867 // e.g. void Foo( _Out_ptrdiff_cap_(pchMax) char* pch, const char* pchMax ) { while pch < pchMax ) pch++; }
868 #define _Out_ptrdiff_cap_(size) _SAL1_1_Source_(_Out_ptrdiff_cap_, (size), _Pre_ptrdiff_cap_(size) _Post_valid_impl_)
869 #define _Out_opt_ptrdiff_cap_(size) _SAL1_1_Source_(_Out_opt_ptrdiff_cap_, (size), _Pre_opt_ptrdiff_cap_(size) _Post_valid_impl_)
870 
871 // buffer capacity is described by a complex expression
872 #define _Out_cap_x_(size) _SAL1_1_Source_(_Out_cap_x_, (size), _Pre_cap_x_(size) _Post_valid_impl_)
873 #define _Out_opt_cap_x_(size) _SAL1_1_Source_(_Out_opt_cap_x_, (size), _Pre_opt_cap_x_(size) _Post_valid_impl_)
874 #define _Out_bytecap_x_(size) _SAL1_1_Source_(_Out_bytecap_x_, (size), _Pre_bytecap_x_(size) _Post_valid_impl_)
875 #define _Out_opt_bytecap_x_(size) _SAL1_1_Source_(_Out_opt_bytecap_x_, (size), _Pre_opt_bytecap_x_(size) _Post_valid_impl_)
876 
877 // a zero terminated string is filled into a buffer of given capacity
878 // e.g. void CopyStr( _In_z_ const char* szFrom, _Out_z_cap_(cchTo) char* szTo, size_t cchTo );
879 // buffer capacity is described by another parameter
880 #define _Out_z_cap_(size) _SAL1_1_Source_(_Out_z_cap_, (size), _Pre_cap_(size) _Post_valid_impl_ _Post_z_)
881 #define _Out_opt_z_cap_(size) _SAL1_1_Source_(_Out_opt_z_cap_, (size), _Pre_opt_cap_(size) _Post_valid_impl_ _Post_z_)
882 #define _Out_z_bytecap_(size) _SAL1_1_Source_(_Out_z_bytecap_, (size), _Pre_bytecap_(size) _Post_valid_impl_ _Post_z_)
883 #define _Out_opt_z_bytecap_(size) _SAL1_1_Source_(_Out_opt_z_bytecap_, (size), _Pre_opt_bytecap_(size) _Post_valid_impl_ _Post_z_)
884 
885 // buffer capacity is described by a constant expression
886 #define _Out_z_cap_c_(size) _SAL1_1_Source_(_Out_z_cap_c_, (size), _Pre_cap_c_(size) _Post_valid_impl_ _Post_z_)
887 #define _Out_opt_z_cap_c_(size) _SAL1_1_Source_(_Out_opt_z_cap_c_, (size), _Pre_opt_cap_c_(size) _Post_valid_impl_ _Post_z_)
888 #define _Out_z_bytecap_c_(size) _SAL1_1_Source_(_Out_z_bytecap_c_, (size), _Pre_bytecap_c_(size) _Post_valid_impl_ _Post_z_)
889 #define _Out_opt_z_bytecap_c_(size) _SAL1_1_Source_(_Out_opt_z_bytecap_c_, (size), _Pre_opt_bytecap_c_(size) _Post_valid_impl_ _Post_z_)
890 
891 // buffer capacity is described by a complex expression
892 #define _Out_z_cap_x_(size) _SAL1_1_Source_(_Out_z_cap_x_, (size), _Pre_cap_x_(size) _Post_valid_impl_ _Post_z_)
893 #define _Out_opt_z_cap_x_(size) _SAL1_1_Source_(_Out_opt_z_cap_x_, (size), _Pre_opt_cap_x_(size) _Post_valid_impl_ _Post_z_)
894 #define _Out_z_bytecap_x_(size) _SAL1_1_Source_(_Out_z_bytecap_x_, (size), _Pre_bytecap_x_(size) _Post_valid_impl_ _Post_z_)
895 #define _Out_opt_z_bytecap_x_(size) _SAL1_1_Source_(_Out_opt_z_bytecap_x_, (size), _Pre_opt_bytecap_x_(size) _Post_valid_impl_ _Post_z_)
896 
897 // a zero terminated string is filled into a buffer of given capacity
898 // e.g. size_t CopyCharRange( _In_count_(cchFrom) const char* rgchFrom, size_t cchFrom, _Out_cap_post_count_(cchTo,return)) char* rgchTo, size_t cchTo );
899 #define _Out_cap_post_count_(cap,count) _SAL1_1_Source_(_Out_cap_post_count_, (cap,count), _Pre_cap_(cap) _Post_valid_impl_ _Post_count_(count))
900 #define _Out_opt_cap_post_count_(cap,count) _SAL1_1_Source_(_Out_opt_cap_post_count_, (cap,count), _Pre_opt_cap_(cap) _Post_valid_impl_ _Post_count_(count))
901 #define _Out_bytecap_post_bytecount_(cap,count) _SAL1_1_Source_(_Out_bytecap_post_bytecount_, (cap,count), _Pre_bytecap_(cap) _Post_valid_impl_ _Post_bytecount_(count))
902 #define _Out_opt_bytecap_post_bytecount_(cap,count) _SAL1_1_Source_(_Out_opt_bytecap_post_bytecount_, (cap,count), _Pre_opt_bytecap_(cap) _Post_valid_impl_ _Post_bytecount_(count))
903 
904 // a zero terminated string is filled into a buffer of given capacity
905 // e.g. size_t CopyStr( _In_z_ const char* szFrom, _Out_z_cap_post_count_(cchTo,return+1) char* szTo, size_t cchTo );
906 #define _Out_z_cap_post_count_(cap,count) _SAL1_1_Source_(_Out_z_cap_post_count_, (cap,count), _Pre_cap_(cap) _Post_valid_impl_ _Post_z_count_(count))
907 #define _Out_opt_z_cap_post_count_(cap,count) _SAL1_1_Source_(_Out_opt_z_cap_post_count_, (cap,count), _Pre_opt_cap_(cap) _Post_valid_impl_ _Post_z_count_(count))
908 #define _Out_z_bytecap_post_bytecount_(cap,count) _SAL1_1_Source_(_Out_z_bytecap_post_bytecount_, (cap,count), _Pre_bytecap_(cap) _Post_valid_impl_ _Post_z_bytecount_(count))
909 #define _Out_opt_z_bytecap_post_bytecount_(cap,count) _SAL1_1_Source_(_Out_opt_z_bytecap_post_bytecount_, (cap,count), _Pre_opt_bytecap_(cap) _Post_valid_impl_ _Post_z_bytecount_(count))
910 
911 // only use with dereferenced arguments e.g. '*pcch'
912 #define _Out_capcount_(capcount) _SAL1_1_Source_(_Out_capcount_, (capcount), _Pre_cap_(capcount) _Post_valid_impl_ _Post_count_(capcount))
913 #define _Out_opt_capcount_(capcount) _SAL1_1_Source_(_Out_opt_capcount_, (capcount), _Pre_opt_cap_(capcount) _Post_valid_impl_ _Post_count_(capcount))
914 #define _Out_bytecapcount_(capcount) _SAL1_1_Source_(_Out_bytecapcount_, (capcount), _Pre_bytecap_(capcount) _Post_valid_impl_ _Post_bytecount_(capcount))
915 #define _Out_opt_bytecapcount_(capcount) _SAL1_1_Source_(_Out_opt_bytecapcount_, (capcount), _Pre_opt_bytecap_(capcount) _Post_valid_impl_ _Post_bytecount_(capcount))
916 
917 #define _Out_capcount_x_(capcount) _SAL1_1_Source_(_Out_capcount_x_, (capcount), _Pre_cap_x_(capcount) _Post_valid_impl_ _Post_count_x_(capcount))
918 #define _Out_opt_capcount_x_(capcount) _SAL1_1_Source_(_Out_opt_capcount_x_, (capcount), _Pre_opt_cap_x_(capcount) _Post_valid_impl_ _Post_count_x_(capcount))
919 #define _Out_bytecapcount_x_(capcount) _SAL1_1_Source_(_Out_bytecapcount_x_, (capcount), _Pre_bytecap_x_(capcount) _Post_valid_impl_ _Post_bytecount_x_(capcount))
920 #define _Out_opt_bytecapcount_x_(capcount) _SAL1_1_Source_(_Out_opt_bytecapcount_x_, (capcount), _Pre_opt_bytecap_x_(capcount) _Post_valid_impl_ _Post_bytecount_x_(capcount))
921 
922 // e.g. GetString( _Out_z_capcount_(*pLen+1) char* sz, size_t* pLen );
923 #define _Out_z_capcount_(capcount) _SAL1_1_Source_(_Out_z_capcount_, (capcount), _Pre_cap_(capcount) _Post_valid_impl_ _Post_z_count_(capcount))
924 #define _Out_opt_z_capcount_(capcount) _SAL1_1_Source_(_Out_opt_z_capcount_, (capcount), _Pre_opt_cap_(capcount) _Post_valid_impl_ _Post_z_count_(capcount))
925 #define _Out_z_bytecapcount_(capcount) _SAL1_1_Source_(_Out_z_bytecapcount_, (capcount), _Pre_bytecap_(capcount) _Post_valid_impl_ _Post_z_bytecount_(capcount))
926 #define _Out_opt_z_bytecapcount_(capcount) _SAL1_1_Source_(_Out_opt_z_bytecapcount_, (capcount), _Pre_opt_bytecap_(capcount) _Post_valid_impl_ _Post_z_bytecount_(capcount))
927 
928 
929 // 'inout' buffers with initialized elements before and after the call
930 // e.g. void ModifyIndices( _Inout_count_(cIndices) int* rgIndeces, size_t cIndices );
931 #define _Inout_count_(size) _SAL1_1_Source_(_Inout_count_, (size), _Prepost_count_(size))
932 #define _Inout_opt_count_(size) _SAL1_1_Source_(_Inout_opt_count_, (size), _Prepost_opt_count_(size))
933 #define _Inout_bytecount_(size) _SAL1_1_Source_(_Inout_bytecount_, (size), _Prepost_bytecount_(size))
934 #define _Inout_opt_bytecount_(size) _SAL1_1_Source_(_Inout_opt_bytecount_, (size), _Prepost_opt_bytecount_(size))
935 
936 #define _Inout_count_c_(size) _SAL1_1_Source_(_Inout_count_c_, (size), _Prepost_count_c_(size))
937 #define _Inout_opt_count_c_(size) _SAL1_1_Source_(_Inout_opt_count_c_, (size), _Prepost_opt_count_c_(size))
938 #define _Inout_bytecount_c_(size) _SAL1_1_Source_(_Inout_bytecount_c_, (size), _Prepost_bytecount_c_(size))
939 #define _Inout_opt_bytecount_c_(size) _SAL1_1_Source_(_Inout_opt_bytecount_c_, (size), _Prepost_opt_bytecount_c_(size))
940 
941 // nullterminated 'inout' buffers with initialized elements before and after the call
942 // e.g. void ModifyIndices( _Inout_count_(cIndices) int* rgIndeces, size_t cIndices );
943 #define _Inout_z_count_(size) _SAL1_1_Source_(_Inout_z_count_, (size), _Prepost_z_ _Prepost_count_(size))
944 #define _Inout_opt_z_count_(size) _SAL1_1_Source_(_Inout_opt_z_count_, (size), _Prepost_z_ _Prepost_opt_count_(size))
945 #define _Inout_z_bytecount_(size) _SAL1_1_Source_(_Inout_z_bytecount_, (size), _Prepost_z_ _Prepost_bytecount_(size))
946 #define _Inout_opt_z_bytecount_(size) _SAL1_1_Source_(_Inout_opt_z_bytecount_, (size), _Prepost_z_ _Prepost_opt_bytecount_(size))
947 
948 #define _Inout_z_count_c_(size) _SAL1_1_Source_(_Inout_z_count_c_, (size), _Prepost_z_ _Prepost_count_c_(size))
949 #define _Inout_opt_z_count_c_(size) _SAL1_1_Source_(_Inout_opt_z_count_c_, (size), _Prepost_z_ _Prepost_opt_count_c_(size))
950 #define _Inout_z_bytecount_c_(size) _SAL1_1_Source_(_Inout_z_bytecount_c_, (size), _Prepost_z_ _Prepost_bytecount_c_(size))
951 #define _Inout_opt_z_bytecount_c_(size) _SAL1_1_Source_(_Inout_opt_z_bytecount_c_, (size), _Prepost_z_ _Prepost_opt_bytecount_c_(size))
952 
953 #define _Inout_ptrdiff_count_(size) _SAL1_1_Source_(_Inout_ptrdiff_count_, (size), _Pre_ptrdiff_count_(size))
954 #define _Inout_opt_ptrdiff_count_(size) _SAL1_1_Source_(_Inout_opt_ptrdiff_count_, (size), _Pre_opt_ptrdiff_count_(size))
955 
956 #define _Inout_count_x_(size) _SAL1_1_Source_(_Inout_count_x_, (size), _Prepost_count_x_(size))
957 #define _Inout_opt_count_x_(size) _SAL1_1_Source_(_Inout_opt_count_x_, (size), _Prepost_opt_count_x_(size))
958 #define _Inout_bytecount_x_(size) _SAL1_1_Source_(_Inout_bytecount_x_, (size), _Prepost_bytecount_x_(size))
959 #define _Inout_opt_bytecount_x_(size) _SAL1_1_Source_(_Inout_opt_bytecount_x_, (size), _Prepost_opt_bytecount_x_(size))
960 
961 // e.g. void AppendToLPSTR( _In_ LPCSTR szFrom, _Inout_cap_(cchTo) LPSTR* szTo, size_t cchTo );
962 #define _Inout_cap_(size) _SAL1_1_Source_(_Inout_cap_, (size), _Pre_valid_cap_(size) _Post_valid_)
963 #define _Inout_opt_cap_(size) _SAL1_1_Source_(_Inout_opt_cap_, (size), _Pre_opt_valid_cap_(size) _Post_valid_)
964 #define _Inout_bytecap_(size) _SAL1_1_Source_(_Inout_bytecap_, (size), _Pre_valid_bytecap_(size) _Post_valid_)
965 #define _Inout_opt_bytecap_(size) _SAL1_1_Source_(_Inout_opt_bytecap_, (size), _Pre_opt_valid_bytecap_(size) _Post_valid_)
966 
967 #define _Inout_cap_c_(size) _SAL1_1_Source_(_Inout_cap_c_, (size), _Pre_valid_cap_c_(size) _Post_valid_)
968 #define _Inout_opt_cap_c_(size) _SAL1_1_Source_(_Inout_opt_cap_c_, (size), _Pre_opt_valid_cap_c_(size) _Post_valid_)
969 #define _Inout_bytecap_c_(size) _SAL1_1_Source_(_Inout_bytecap_c_, (size), _Pre_valid_bytecap_c_(size) _Post_valid_)
970 #define _Inout_opt_bytecap_c_(size) _SAL1_1_Source_(_Inout_opt_bytecap_c_, (size), _Pre_opt_valid_bytecap_c_(size) _Post_valid_)
971 
972 #define _Inout_cap_x_(size) _SAL1_1_Source_(_Inout_cap_x_, (size), _Pre_valid_cap_x_(size) _Post_valid_)
973 #define _Inout_opt_cap_x_(size) _SAL1_1_Source_(_Inout_opt_cap_x_, (size), _Pre_opt_valid_cap_x_(size) _Post_valid_)
974 #define _Inout_bytecap_x_(size) _SAL1_1_Source_(_Inout_bytecap_x_, (size), _Pre_valid_bytecap_x_(size) _Post_valid_)
975 #define _Inout_opt_bytecap_x_(size) _SAL1_1_Source_(_Inout_opt_bytecap_x_, (size), _Pre_opt_valid_bytecap_x_(size) _Post_valid_)
976 
977 // inout string buffers with writable size
978 // e.g. void AppendStr( _In_z_ const char* szFrom, _Inout_z_cap_(cchTo) char* szTo, size_t cchTo );
979 #define _Inout_z_cap_(size) _SAL1_1_Source_(_Inout_z_cap_, (size), _Pre_z_cap_(size) _Post_z_)
980 #define _Inout_opt_z_cap_(size) _SAL1_1_Source_(_Inout_opt_z_cap_, (size), _Pre_opt_z_cap_(size) _Post_z_)
981 #define _Inout_z_bytecap_(size) _SAL1_1_Source_(_Inout_z_bytecap_, (size), _Pre_z_bytecap_(size) _Post_z_)
982 #define _Inout_opt_z_bytecap_(size) _SAL1_1_Source_(_Inout_opt_z_bytecap_, (size), _Pre_opt_z_bytecap_(size) _Post_z_)
983 
984 #define _Inout_z_cap_c_(size) _SAL1_1_Source_(_Inout_z_cap_c_, (size), _Pre_z_cap_c_(size) _Post_z_)
985 #define _Inout_opt_z_cap_c_(size) _SAL1_1_Source_(_Inout_opt_z_cap_c_, (size), _Pre_opt_z_cap_c_(size) _Post_z_)
986 #define _Inout_z_bytecap_c_(size) _SAL1_1_Source_(_Inout_z_bytecap_c_, (size), _Pre_z_bytecap_c_(size) _Post_z_)
987 #define _Inout_opt_z_bytecap_c_(size) _SAL1_1_Source_(_Inout_opt_z_bytecap_c_, (size), _Pre_opt_z_bytecap_c_(size) _Post_z_)
988 
989 #define _Inout_z_cap_x_(size) _SAL1_1_Source_(_Inout_z_cap_x_, (size), _Pre_z_cap_x_(size) _Post_z_)
990 #define _Inout_opt_z_cap_x_(size) _SAL1_1_Source_(_Inout_opt_z_cap_x_, (size), _Pre_opt_z_cap_x_(size) _Post_z_)
991 #define _Inout_z_bytecap_x_(size) _SAL1_1_Source_(_Inout_z_bytecap_x_, (size), _Pre_z_bytecap_x_(size) _Post_z_)
992 #define _Inout_opt_z_bytecap_x_(size) _SAL1_1_Source_(_Inout_opt_z_bytecap_x_, (size), _Pre_opt_z_bytecap_x_(size) _Post_z_)
993 
994 
995 // returning pointers to valid objects
996 #define _Ret_ _SAL1_1_Source_(_Ret_, (), _Ret_valid_)
997 #define _Ret_opt_ _SAL1_1_Source_(_Ret_opt_, (), _Ret_opt_valid_)
998 
999 // annotations to express 'boundedness' of integral value parameter
1000 #define _In_bound_ _SAL1_1_Source_(_In_bound_, (), _In_bound_impl_)
1001 #define _Out_bound_ _SAL1_1_Source_(_Out_bound_, (), _Out_bound_impl_)
1002 #define _Ret_bound_ _SAL1_1_Source_(_Ret_bound_, (), _Ret_bound_impl_)
1003 #define _Deref_in_bound_ _SAL1_1_Source_(_Deref_in_bound_, (), _Deref_in_bound_impl_)
1004 #define _Deref_out_bound_ _SAL1_1_Source_(_Deref_out_bound_, (), _Deref_out_bound_impl_)
1005 #define _Deref_inout_bound_ _SAL1_1_Source_(_Deref_inout_bound_, (), _Deref_in_bound_ _Deref_out_bound_)
1006 #define _Deref_ret_bound_ _SAL1_1_Source_(_Deref_ret_bound_, (), _Deref_ret_bound_impl_)
1007 
1008 // e.g. HRESULT HrCreatePoint( _Deref_out_opt_ POINT** ppPT );
1009 #define _Deref_out_ _SAL1_1_Source_(_Deref_out_, (), _Out_ _Deref_post_valid_)
1010 #define _Deref_out_opt_ _SAL1_1_Source_(_Deref_out_opt_, (), _Out_ _Deref_post_opt_valid_)
1011 #define _Deref_opt_out_ _SAL1_1_Source_(_Deref_opt_out_, (), _Out_opt_ _Deref_post_valid_)
1012 #define _Deref_opt_out_opt_ _SAL1_1_Source_(_Deref_opt_out_opt_, (), _Out_opt_ _Deref_post_opt_valid_)
1013 
1014 // e.g. void CloneString( _In_z_ const wchar_t* wzFrom, _Deref_out_z_ wchar_t** pWzTo );
1015 #define _Deref_out_z_ _SAL1_1_Source_(_Deref_out_z_, (), _Out_ _Deref_post_z_)
1016 #define _Deref_out_opt_z_ _SAL1_1_Source_(_Deref_out_opt_z_, (), _Out_ _Deref_post_opt_z_)
1017 #define _Deref_opt_out_z_ _SAL1_1_Source_(_Deref_opt_out_z_, (), _Out_opt_ _Deref_post_z_)
1018 #define _Deref_opt_out_opt_z_ _SAL1_1_Source_(_Deref_opt_out_opt_z_, (), _Out_opt_ _Deref_post_opt_z_)
1019 
1020 //
1021 // _Deref_pre_ ---
1022 //
1023 // describing conditions for array elements of dereferenced pointer parameters that must be met before the call
1024 
1025 // e.g. void SaveStringArray( _In_count_(cStrings) _Deref_pre_z_ const wchar_t* const rgpwch[] );
1026 #define _Deref_pre_z_ _SAL1_1_Source_(_Deref_pre_z_, (), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__zterm_impl) _Pre_valid_impl_)
1027 #define _Deref_pre_opt_z_ _SAL1_1_Source_(_Deref_pre_opt_z_, (), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__zterm_impl) _Pre_valid_impl_)
1028 
1029 // e.g. void FillInArrayOfStr32( _In_count_(cStrings) _Deref_pre_cap_c_(32) _Deref_post_z_ wchar_t* const rgpwch[] );
1030 // buffer capacity is described by another parameter
1031 #define _Deref_pre_cap_(size) _SAL1_1_Source_(_Deref_pre_cap_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__cap_impl(size)))
1032 #define _Deref_pre_opt_cap_(size) _SAL1_1_Source_(_Deref_pre_opt_cap_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__cap_impl(size)))
1033 #define _Deref_pre_bytecap_(size) _SAL1_1_Source_(_Deref_pre_bytecap_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecap_impl(size)))
1034 #define _Deref_pre_opt_bytecap_(size) _SAL1_1_Source_(_Deref_pre_opt_bytecap_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecap_impl(size)))
1035 
1036 // buffer capacity is described by a constant expression
1037 #define _Deref_pre_cap_c_(size) _SAL1_1_Source_(_Deref_pre_cap_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__cap_c_impl(size)))
1038 #define _Deref_pre_opt_cap_c_(size) _SAL1_1_Source_(_Deref_pre_opt_cap_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__cap_c_impl(size)))
1039 #define _Deref_pre_bytecap_c_(size) _SAL1_1_Source_(_Deref_pre_bytecap_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecap_c_impl(size)))
1040 #define _Deref_pre_opt_bytecap_c_(size) _SAL1_1_Source_(_Deref_pre_opt_bytecap_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecap_c_impl(size)))
1041 
1042 // buffer capacity is described by a complex condition
1043 #define _Deref_pre_cap_x_(size) _SAL1_1_Source_(_Deref_pre_cap_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__cap_x_impl(size)))
1044 #define _Deref_pre_opt_cap_x_(size) _SAL1_1_Source_(_Deref_pre_opt_cap_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__cap_x_impl(size)))
1045 #define _Deref_pre_bytecap_x_(size) _SAL1_1_Source_(_Deref_pre_bytecap_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecap_x_impl(size)))
1046 #define _Deref_pre_opt_bytecap_x_(size) _SAL1_1_Source_(_Deref_pre_opt_bytecap_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecap_x_impl(size)))
1047 
1048 // convenience macros for nullterminated buffers with given capacity
1049 #define _Deref_pre_z_cap_(size) _SAL1_1_Source_(_Deref_pre_z_cap_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__cap_impl(size)) _Pre_valid_impl_)
1050 #define _Deref_pre_opt_z_cap_(size) _SAL1_1_Source_(_Deref_pre_opt_z_cap_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__cap_impl(size)) _Pre_valid_impl_)
1051 #define _Deref_pre_z_bytecap_(size) _SAL1_1_Source_(_Deref_pre_z_bytecap_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__bytecap_impl(size)) _Pre_valid_impl_)
1052 #define _Deref_pre_opt_z_bytecap_(size) _SAL1_1_Source_(_Deref_pre_opt_z_bytecap_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__bytecap_impl(size)) _Pre_valid_impl_)
1053 
1054 #define _Deref_pre_z_cap_c_(size) _SAL1_1_Source_(_Deref_pre_z_cap_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__cap_c_impl(size)) _Pre_valid_impl_)
1055 #define _Deref_pre_opt_z_cap_c_(size) _SAL1_1_Source_(_Deref_pre_opt_z_cap_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__cap_c_impl(size)) _Pre_valid_impl_)
1056 #define _Deref_pre_z_bytecap_c_(size) _SAL1_1_Source_(_Deref_pre_z_bytecap_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__bytecap_c_impl(size)) _Pre_valid_impl_)
1057 #define _Deref_pre_opt_z_bytecap_c_(size) _SAL1_1_Source_(_Deref_pre_opt_z_bytecap_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__bytecap_c_impl(size)) _Pre_valid_impl_)
1058 
1059 #define _Deref_pre_z_cap_x_(size) _SAL1_1_Source_(_Deref_pre_z_cap_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__cap_x_impl(size)) _Pre_valid_impl_)
1060 #define _Deref_pre_opt_z_cap_x_(size) _SAL1_1_Source_(_Deref_pre_opt_z_cap_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__cap_x_impl(size)) _Pre_valid_impl_)
1061 #define _Deref_pre_z_bytecap_x_(size) _SAL1_1_Source_(_Deref_pre_z_bytecap_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__bytecap_x_impl(size)) _Pre_valid_impl_)
1062 #define _Deref_pre_opt_z_bytecap_x_(size) _SAL1_1_Source_(_Deref_pre_opt_z_bytecap_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre2_impl_(__zterm_impl,__bytecap_x_impl(size)) _Pre_valid_impl_)
1063 
1064 // known capacity and valid but unknown readable extent
1065 #define _Deref_pre_valid_cap_(size) _SAL1_1_Source_(_Deref_pre_valid_cap_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__cap_impl(size)) _Pre_valid_impl_)
1066 #define _Deref_pre_opt_valid_cap_(size) _SAL1_1_Source_(_Deref_pre_opt_valid_cap_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__cap_impl(size)) _Pre_valid_impl_)
1067 #define _Deref_pre_valid_bytecap_(size) _SAL1_1_Source_(_Deref_pre_valid_bytecap_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecap_impl(size)) _Pre_valid_impl_)
1068 #define _Deref_pre_opt_valid_bytecap_(size) _SAL1_1_Source_(_Deref_pre_opt_valid_bytecap_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecap_impl(size)) _Pre_valid_impl_)
1069 
1070 #define _Deref_pre_valid_cap_c_(size) _SAL1_1_Source_(_Deref_pre_valid_cap_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__cap_c_impl(size)) _Pre_valid_impl_)
1071 #define _Deref_pre_opt_valid_cap_c_(size) _SAL1_1_Source_(_Deref_pre_opt_valid_cap_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__cap_c_impl(size)) _Pre_valid_impl_)
1072 #define _Deref_pre_valid_bytecap_c_(size) _SAL1_1_Source_(_Deref_pre_valid_bytecap_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecap_c_impl(size)) _Pre_valid_impl_)
1073 #define _Deref_pre_opt_valid_bytecap_c_(size) _SAL1_1_Source_(_Deref_pre_opt_valid_bytecap_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecap_c_impl(size)) _Pre_valid_impl_)
1074 
1075 #define _Deref_pre_valid_cap_x_(size) _SAL1_1_Source_(_Deref_pre_valid_cap_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__cap_x_impl(size)) _Pre_valid_impl_)
1076 #define _Deref_pre_opt_valid_cap_x_(size) _SAL1_1_Source_(_Deref_pre_opt_valid_cap_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__cap_x_impl(size)) _Pre_valid_impl_)
1077 #define _Deref_pre_valid_bytecap_x_(size) _SAL1_1_Source_(_Deref_pre_valid_bytecap_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecap_x_impl(size)) _Pre_valid_impl_)
1078 #define _Deref_pre_opt_valid_bytecap_x_(size) _SAL1_1_Source_(_Deref_pre_opt_valid_bytecap_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecap_x_impl(size)) _Pre_valid_impl_)
1079 
1080 // e.g. void SaveMatrix( _In_count_(n) _Deref_pre_count_(n) const Elem** matrix, size_t n );
1081 // valid buffer extent is described by another parameter
1082 #define _Deref_pre_count_(size) _SAL1_1_Source_(_Deref_pre_count_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__count_impl(size)) _Pre_valid_impl_)
1083 #define _Deref_pre_opt_count_(size) _SAL1_1_Source_(_Deref_pre_opt_count_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__count_impl(size)) _Pre_valid_impl_)
1084 #define _Deref_pre_bytecount_(size) _SAL1_1_Source_(_Deref_pre_bytecount_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecount_impl(size)) _Pre_valid_impl_)
1085 #define _Deref_pre_opt_bytecount_(size) _SAL1_1_Source_(_Deref_pre_opt_bytecount_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecount_impl(size)) _Pre_valid_impl_)
1086 
1087 // valid buffer extent is described by a constant expression
1088 #define _Deref_pre_count_c_(size) _SAL1_1_Source_(_Deref_pre_count_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__count_c_impl(size)) _Pre_valid_impl_)
1089 #define _Deref_pre_opt_count_c_(size) _SAL1_1_Source_(_Deref_pre_opt_count_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__count_c_impl(size)) _Pre_valid_impl_)
1090 #define _Deref_pre_bytecount_c_(size) _SAL1_1_Source_(_Deref_pre_bytecount_c_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecount_c_impl(size)) _Pre_valid_impl_)
1091 #define _Deref_pre_opt_bytecount_c_(size) _SAL1_1_Source_(_Deref_pre_opt_bytecount_c_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecount_c_impl(size)) _Pre_valid_impl_)
1092 
1093 // valid buffer extent is described by a complex expression
1094 #define _Deref_pre_count_x_(size) _SAL1_1_Source_(_Deref_pre_count_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__count_x_impl(size)) _Pre_valid_impl_)
1095 #define _Deref_pre_opt_count_x_(size) _SAL1_1_Source_(_Deref_pre_opt_count_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__count_x_impl(size)) _Pre_valid_impl_)
1096 #define _Deref_pre_bytecount_x_(size) _SAL1_1_Source_(_Deref_pre_bytecount_x_, (size), _Deref_pre1_impl_(__notnull_impl_notref) _Deref_pre1_impl_(__bytecount_x_impl(size)) _Pre_valid_impl_)
1097 #define _Deref_pre_opt_bytecount_x_(size) _SAL1_1_Source_(_Deref_pre_opt_bytecount_x_, (size), _Deref_pre1_impl_(__maybenull_impl_notref) _Deref_pre1_impl_(__bytecount_x_impl(size)) _Pre_valid_impl_)
1098 
1099 // e.g. void PrintStringArray( _In_count_(cElems) _Deref_pre_valid_ LPCSTR rgStr[], size_t cElems );
1100 #define _Deref_pre_valid_ _SAL1_1_Source_(_Deref_pre_valid_, (), _Deref_pre1_impl_(__notnull_impl_notref) _Pre_valid_impl_)
1101 #define _Deref_pre_opt_valid_ _SAL1_1_Source_(_Deref_pre_opt_valid_, (), _Deref_pre1_impl_(__maybenull_impl_notref) _Pre_valid_impl_)
1102 #define _Deref_pre_invalid_ _SAL1_1_Source_(_Deref_pre_invalid_, (), _Deref_pre1_impl_(__notvalid_impl))
1103 
1104 #define _Deref_pre_notnull_ _SAL1_1_Source_(_Deref_pre_notnull_, (), _Deref_pre1_impl_(__notnull_impl_notref))
1105 #define _Deref_pre_maybenull_ _SAL1_1_Source_(_Deref_pre_maybenull_, (), _Deref_pre1_impl_(__maybenull_impl_notref))
1106 #define _Deref_pre_null_ _SAL1_1_Source_(_Deref_pre_null_, (), _Deref_pre1_impl_(__null_impl_notref))
1107 
1108 // restrict access rights
1109 #define _Deref_pre_readonly_ _SAL1_1_Source_(_Deref_pre_readonly_, (), _Deref_pre1_impl_(__readaccess_impl_notref))
1110 #define _Deref_pre_writeonly_ _SAL1_1_Source_(_Deref_pre_writeonly_, (), _Deref_pre1_impl_(__writeaccess_impl_notref))
1111 
1112 //
1113 // _Deref_post_ ---
1114 //
1115 // describing conditions for array elements or dereferenced pointer parameters that hold after the call
1116 
1117 // e.g. void CloneString( _In_z_ const Wchar_t* wzIn _Out_ _Deref_post_z_ wchar_t** pWzOut );
1118 #define _Deref_post_z_ _SAL1_1_Source_(_Deref_post_z_, (), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__zterm_impl) _Post_valid_impl_)
1119 #define _Deref_post_opt_z_ _SAL1_1_Source_(_Deref_post_opt_z_, (), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__zterm_impl) _Post_valid_impl_)
1120 
1121 // e.g. HRESULT HrAllocateMemory( size_t cb, _Out_ _Deref_post_bytecap_(cb) void** ppv );
1122 // buffer capacity is described by another parameter
1123 #define _Deref_post_cap_(size) _SAL1_1_Source_(_Deref_post_cap_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__cap_impl(size)))
1124 #define _Deref_post_opt_cap_(size) _SAL1_1_Source_(_Deref_post_opt_cap_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__cap_impl(size)))
1125 #define _Deref_post_bytecap_(size) _SAL1_1_Source_(_Deref_post_bytecap_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecap_impl(size)))
1126 #define _Deref_post_opt_bytecap_(size) _SAL1_1_Source_(_Deref_post_opt_bytecap_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecap_impl(size)))
1127 
1128 // buffer capacity is described by a constant expression
1129 #define _Deref_post_cap_c_(size) _SAL1_1_Source_(_Deref_post_cap_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__cap_c_impl(size)))
1130 #define _Deref_post_opt_cap_c_(size) _SAL1_1_Source_(_Deref_post_opt_cap_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__cap_c_impl(size)))
1131 #define _Deref_post_bytecap_c_(size) _SAL1_1_Source_(_Deref_post_bytecap_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecap_c_impl(size)))
1132 #define _Deref_post_opt_bytecap_c_(size) _SAL1_1_Source_(_Deref_post_opt_bytecap_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecap_c_impl(size)))
1133 
1134 // buffer capacity is described by a complex expression
1135 #define _Deref_post_cap_x_(size) _SAL1_1_Source_(_Deref_post_cap_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__cap_x_impl(size)))
1136 #define _Deref_post_opt_cap_x_(size) _SAL1_1_Source_(_Deref_post_opt_cap_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__cap_x_impl(size)))
1137 #define _Deref_post_bytecap_x_(size) _SAL1_1_Source_(_Deref_post_bytecap_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecap_x_impl(size)))
1138 #define _Deref_post_opt_bytecap_x_(size) _SAL1_1_Source_(_Deref_post_opt_bytecap_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecap_x_impl(size)))
1139 
1140 // convenience macros for nullterminated buffers with given capacity
1141 #define _Deref_post_z_cap_(size) _SAL1_1_Source_(_Deref_post_z_cap_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post2_impl_(__zterm_impl,__cap_impl(size)) _Post_valid_impl_)
1142 #define _Deref_post_opt_z_cap_(size) _SAL1_1_Source_(_Deref_post_opt_z_cap_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post2_impl_(__zterm_impl,__cap_impl(size)) _Post_valid_impl_)
1143 #define _Deref_post_z_bytecap_(size) _SAL1_1_Source_(_Deref_post_z_bytecap_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post2_impl_(__zterm_impl,__bytecap_impl(size)) _Post_valid_impl_)
1144 #define _Deref_post_opt_z_bytecap_(size) _SAL1_1_Source_(_Deref_post_opt_z_bytecap_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post2_impl_(__zterm_impl,__bytecap_impl(size)) _Post_valid_impl_)
1145 
1146 #define _Deref_post_z_cap_c_(size) _SAL1_1_Source_(_Deref_post_z_cap_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post2_impl_(__zterm_impl,__cap_c_impl(size)) _Post_valid_impl_)
1147 #define _Deref_post_opt_z_cap_c_(size) _SAL1_1_Source_(_Deref_post_opt_z_cap_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post2_impl_(__zterm_impl,__cap_c_impl(size)) _Post_valid_impl_)
1148 #define _Deref_post_z_bytecap_c_(size) _SAL1_1_Source_(_Deref_post_z_bytecap_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post2_impl_(__zterm_impl,__bytecap_c_impl(size)) _Post_valid_impl_)
1149 #define _Deref_post_opt_z_bytecap_c_(size) _SAL1_1_Source_(_Deref_post_opt_z_bytecap_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post2_impl_(__zterm_impl,__bytecap_c_impl(size)) _Post_valid_impl_)
1150 
1151 #define _Deref_post_z_cap_x_(size) _SAL1_1_Source_(_Deref_post_z_cap_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post2_impl_(__zterm_impl,__cap_x_impl(size)) _Post_valid_impl_)
1152 #define _Deref_post_opt_z_cap_x_(size) _SAL1_1_Source_(_Deref_post_opt_z_cap_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post2_impl_(__zterm_impl,__cap_x_impl(size)) _Post_valid_impl_)
1153 #define _Deref_post_z_bytecap_x_(size) _SAL1_1_Source_(_Deref_post_z_bytecap_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post2_impl_(__zterm_impl,__bytecap_x_impl(size)) _Post_valid_impl_)
1154 #define _Deref_post_opt_z_bytecap_x_(size) _SAL1_1_Source_(_Deref_post_opt_z_bytecap_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post2_impl_(__zterm_impl,__bytecap_x_impl(size)) _Post_valid_impl_)
1155 
1156 // known capacity and valid but unknown readable extent
1157 #define _Deref_post_valid_cap_(size) _SAL1_1_Source_(_Deref_post_valid_cap_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__cap_impl(size)) _Post_valid_impl_)
1158 #define _Deref_post_opt_valid_cap_(size) _SAL1_1_Source_(_Deref_post_opt_valid_cap_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__cap_impl(size)) _Post_valid_impl_)
1159 #define _Deref_post_valid_bytecap_(size) _SAL1_1_Source_(_Deref_post_valid_bytecap_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecap_impl(size)) _Post_valid_impl_)
1160 #define _Deref_post_opt_valid_bytecap_(size) _SAL1_1_Source_(_Deref_post_opt_valid_bytecap_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecap_impl(size)) _Post_valid_impl_)
1161 
1162 #define _Deref_post_valid_cap_c_(size) _SAL1_1_Source_(_Deref_post_valid_cap_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__cap_c_impl(size)) _Post_valid_impl_)
1163 #define _Deref_post_opt_valid_cap_c_(size) _SAL1_1_Source_(_Deref_post_opt_valid_cap_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__cap_c_impl(size)) _Post_valid_impl_)
1164 #define _Deref_post_valid_bytecap_c_(size) _SAL1_1_Source_(_Deref_post_valid_bytecap_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecap_c_impl(size)) _Post_valid_impl_)
1165 #define _Deref_post_opt_valid_bytecap_c_(size) _SAL1_1_Source_(_Deref_post_opt_valid_bytecap_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecap_c_impl(size)) _Post_valid_impl_)
1166 
1167 #define _Deref_post_valid_cap_x_(size) _SAL1_1_Source_(_Deref_post_valid_cap_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__cap_x_impl(size)) _Post_valid_impl_)
1168 #define _Deref_post_opt_valid_cap_x_(size) _SAL1_1_Source_(_Deref_post_opt_valid_cap_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__cap_x_impl(size)) _Post_valid_impl_)
1169 #define _Deref_post_valid_bytecap_x_(size) _SAL1_1_Source_(_Deref_post_valid_bytecap_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecap_x_impl(size)) _Post_valid_impl_)
1170 #define _Deref_post_opt_valid_bytecap_x_(size) _SAL1_1_Source_(_Deref_post_opt_valid_bytecap_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecap_x_impl(size)) _Post_valid_impl_)
1171 
1172 // e.g. HRESULT HrAllocateZeroInitializedMemory( size_t cb, _Out_ _Deref_post_bytecount_(cb) void** ppv );
1173 // valid buffer extent is described by another parameter
1174 #define _Deref_post_count_(size) _SAL1_1_Source_(_Deref_post_count_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__count_impl(size)) _Post_valid_impl_)
1175 #define _Deref_post_opt_count_(size) _SAL1_1_Source_(_Deref_post_opt_count_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__count_impl(size)) _Post_valid_impl_)
1176 #define _Deref_post_bytecount_(size) _SAL1_1_Source_(_Deref_post_bytecount_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecount_impl(size)) _Post_valid_impl_)
1177 #define _Deref_post_opt_bytecount_(size) _SAL1_1_Source_(_Deref_post_opt_bytecount_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecount_impl(size)) _Post_valid_impl_)
1178 
1179 // buffer capacity is described by a constant expression
1180 #define _Deref_post_count_c_(size) _SAL1_1_Source_(_Deref_post_count_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__count_c_impl(size)) _Post_valid_impl_)
1181 #define _Deref_post_opt_count_c_(size) _SAL1_1_Source_(_Deref_post_opt_count_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__count_c_impl(size)) _Post_valid_impl_)
1182 #define _Deref_post_bytecount_c_(size) _SAL1_1_Source_(_Deref_post_bytecount_c_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecount_c_impl(size)) _Post_valid_impl_)
1183 #define _Deref_post_opt_bytecount_c_(size) _SAL1_1_Source_(_Deref_post_opt_bytecount_c_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecount_c_impl(size)) _Post_valid_impl_)
1184 
1185 // buffer capacity is described by a complex expression
1186 #define _Deref_post_count_x_(size) _SAL1_1_Source_(_Deref_post_count_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__count_x_impl(size)) _Post_valid_impl_)
1187 #define _Deref_post_opt_count_x_(size) _SAL1_1_Source_(_Deref_post_opt_count_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__count_x_impl(size)) _Post_valid_impl_)
1188 #define _Deref_post_bytecount_x_(size) _SAL1_1_Source_(_Deref_post_bytecount_x_, (size), _Deref_post1_impl_(__notnull_impl_notref) _Deref_post1_impl_(__bytecount_x_impl(size)) _Post_valid_impl_)
1189 #define _Deref_post_opt_bytecount_x_(size) _SAL1_1_Source_(_Deref_post_opt_bytecount_x_, (size), _Deref_post1_impl_(__maybenull_impl_notref) _Deref_post1_impl_(__bytecount_x_impl(size)) _Post_valid_impl_)
1190 
1191 // e.g. void GetStrings( _Out_count_(cElems) _Deref_post_valid_ LPSTR const rgStr[], size_t cElems );
1192 #define _Deref_post_valid_ _SAL1_1_Source_(_Deref_post_valid_, (), _Deref_post1_impl_(__notnull_impl_notref) _Post_valid_impl_)
1193 #define _Deref_post_opt_valid_ _SAL1_1_Source_(_Deref_post_opt_valid_, (), _Deref_post1_impl_(__maybenull_impl_notref) _Post_valid_impl_)
1194 
1195 #define _Deref_post_notnull_ _SAL1_1_Source_(_Deref_post_notnull_, (), _Deref_post1_impl_(__notnull_impl_notref))
1196 #define _Deref_post_maybenull_ _SAL1_1_Source_(_Deref_post_maybenull_, (), _Deref_post1_impl_(__maybenull_impl_notref))
1197 #define _Deref_post_null_ _SAL1_1_Source_(_Deref_post_null_, (), _Deref_post1_impl_(__null_impl_notref))
1198 
1199 //
1200 // _Deref_ret_ ---
1201 //
1202 
1203 #define _Deref_ret_z_ _SAL1_1_Source_(_Deref_ret_z_, (), _Deref_ret1_impl_(__notnull_impl_notref) _Deref_ret1_impl_(__zterm_impl))
1204 #define _Deref_ret_opt_z_ _SAL1_1_Source_(_Deref_ret_opt_z_, (), _Deref_ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__zterm_impl))
1205 
1206 //
1207 // special _Deref_ ---
1208 //
1209 #define _Deref2_pre_readonly_ _SAL1_1_Source_(_Deref2_pre_readonly_, (), _Deref2_pre1_impl_(__readaccess_impl_notref))
1210 
1211 //
1212 // _Ret_ ---
1213 //
1214 
1215 // e.g. _Ret_opt_valid_ LPSTR void* CloneSTR( _Pre_valid_ LPSTR src );
1216 #define _Ret_opt_valid_ _SAL1_1_Source_(_Ret_opt_valid_, (), _Ret1_impl_(__maybenull_impl_notref) _Ret_valid_impl_)
1217 #define _Ret_opt_z_ _SAL1_1_Source_(_Ret_opt_z_, (), _Ret2_impl_(__maybenull_impl,__zterm_impl) _Ret_valid_impl_)
1218 
1219 // e.g. _Ret_opt_bytecap_(cb) void* AllocateMemory( size_t cb );
1220 // Buffer capacity is described by another parameter
1221 #define _Ret_cap_(size) _SAL1_1_Source_(_Ret_cap_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__cap_impl(size)))
1222 #define _Ret_opt_cap_(size) _SAL1_1_Source_(_Ret_opt_cap_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__cap_impl(size)))
1223 #define _Ret_bytecap_(size) _SAL1_1_Source_(_Ret_bytecap_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__bytecap_impl(size)))
1224 #define _Ret_opt_bytecap_(size) _SAL1_1_Source_(_Ret_opt_bytecap_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__bytecap_impl(size)))
1225 
1226 // Buffer capacity is described by a constant expression
1227 #define _Ret_cap_c_(size) _SAL1_1_Source_(_Ret_cap_c_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__cap_c_impl(size)))
1228 #define _Ret_opt_cap_c_(size) _SAL1_1_Source_(_Ret_opt_cap_c_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__cap_c_impl(size)))
1229 #define _Ret_bytecap_c_(size) _SAL1_1_Source_(_Ret_bytecap_c_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__bytecap_c_impl(size)))
1230 #define _Ret_opt_bytecap_c_(size) _SAL1_1_Source_(_Ret_opt_bytecap_c_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__bytecap_c_impl(size)))
1231 
1232 // Buffer capacity is described by a complex condition
1233 #define _Ret_cap_x_(size) _SAL1_1_Source_(_Ret_cap_x_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__cap_x_impl(size)))
1234 #define _Ret_opt_cap_x_(size) _SAL1_1_Source_(_Ret_opt_cap_x_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__cap_x_impl(size)))
1235 #define _Ret_bytecap_x_(size) _SAL1_1_Source_(_Ret_bytecap_x_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__bytecap_x_impl(size)))
1236 #define _Ret_opt_bytecap_x_(size) _SAL1_1_Source_(_Ret_opt_bytecap_x_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__bytecap_x_impl(size)))
1237 
1238 // return value is nullterminated and capacity is given by another parameter
1239 #define _Ret_z_cap_(size) _SAL1_1_Source_(_Ret_z_cap_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret2_impl_(__zterm_impl,__cap_impl(size)) _Ret_valid_impl_)
1240 #define _Ret_opt_z_cap_(size) _SAL1_1_Source_(_Ret_opt_z_cap_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret2_impl_(__zterm_impl,__cap_impl(size)) _Ret_valid_impl_)
1241 #define _Ret_z_bytecap_(size) _SAL1_1_Source_(_Ret_z_bytecap_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret2_impl_(__zterm_impl,__bytecap_impl(size)) _Ret_valid_impl_)
1242 #define _Ret_opt_z_bytecap_(size) _SAL1_1_Source_(_Ret_opt_z_bytecap_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret2_impl_(__zterm_impl,__bytecap_impl(size)) _Ret_valid_impl_)
1243 
1244 // e.g. _Ret_opt_bytecount_(cb) void* AllocateZeroInitializedMemory( size_t cb );
1245 // Valid Buffer extent is described by another parameter
1246 #define _Ret_count_(size) _SAL1_1_Source_(_Ret_count_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__count_impl(size)) _Ret_valid_impl_)
1247 #define _Ret_opt_count_(size) _SAL1_1_Source_(_Ret_opt_count_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__count_impl(size)) _Ret_valid_impl_)
1248 #define _Ret_bytecount_(size) _SAL1_1_Source_(_Ret_bytecount_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__bytecount_impl(size)) _Ret_valid_impl_)
1249 #define _Ret_opt_bytecount_(size) _SAL1_1_Source_(_Ret_opt_bytecount_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__bytecount_impl(size)) _Ret_valid_impl_)
1250 
1251 // Valid Buffer extent is described by a constant expression
1252 #define _Ret_count_c_(size) _SAL1_1_Source_(_Ret_count_c_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__count_c_impl(size)) _Ret_valid_impl_)
1253 #define _Ret_opt_count_c_(size) _SAL1_1_Source_(_Ret_opt_count_c_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__count_c_impl(size)) _Ret_valid_impl_)
1254 #define _Ret_bytecount_c_(size) _SAL1_1_Source_(_Ret_bytecount_c_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__bytecount_c_impl(size)) _Ret_valid_impl_)
1255 #define _Ret_opt_bytecount_c_(size) _SAL1_1_Source_(_Ret_opt_bytecount_c_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__bytecount_c_impl(size)) _Ret_valid_impl_)
1256 
1257 // Valid Buffer extent is described by a complex expression
1258 #define _Ret_count_x_(size) _SAL1_1_Source_(_Ret_count_x_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__count_x_impl(size)) _Ret_valid_impl_)
1259 #define _Ret_opt_count_x_(size) _SAL1_1_Source_(_Ret_opt_count_x_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__count_x_impl(size)) _Ret_valid_impl_)
1260 #define _Ret_bytecount_x_(size) _SAL1_1_Source_(_Ret_bytecount_x_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret1_impl_(__bytecount_x_impl(size)) _Ret_valid_impl_)
1261 #define _Ret_opt_bytecount_x_(size) _SAL1_1_Source_(_Ret_opt_bytecount_x_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret1_impl_(__bytecount_x_impl(size)) _Ret_valid_impl_)
1262 
1263 // return value is nullterminated and length is given by another parameter
1264 #define _Ret_z_count_(size) _SAL1_1_Source_(_Ret_z_count_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret2_impl_(__zterm_impl,__count_impl(size)) _Ret_valid_impl_)
1265 #define _Ret_opt_z_count_(size) _SAL1_1_Source_(_Ret_opt_z_count_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret2_impl_(__zterm_impl,__count_impl(size)) _Ret_valid_impl_)
1266 #define _Ret_z_bytecount_(size) _SAL1_1_Source_(_Ret_z_bytecount_, (size), _Ret1_impl_(__notnull_impl_notref) _Ret2_impl_(__zterm_impl,__bytecount_impl(size)) _Ret_valid_impl_)
1267 #define _Ret_opt_z_bytecount_(size) _SAL1_1_Source_(_Ret_opt_z_bytecount_, (size), _Ret1_impl_(__maybenull_impl_notref) _Ret2_impl_(__zterm_impl,__bytecount_impl(size)) _Ret_valid_impl_)
1268 
1269 
1270 // _Pre_ annotations ---
1271 #define _Pre_opt_z_ _SAL1_1_Source_(_Pre_opt_z_, (), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__zterm_impl) _Pre_valid_impl_)
1272 
1273 // restrict access rights
1274 #define _Pre_readonly_ _SAL1_1_Source_(_Pre_readonly_, (), _Pre1_impl_(__readaccess_impl_notref))
1275 #define _Pre_writeonly_ _SAL1_1_Source_(_Pre_writeonly_, (), _Pre1_impl_(__writeaccess_impl_notref))
1276 
1277 // e.g. void FreeMemory( _Pre_bytecap_(cb) _Post_ptr_invalid_ void* pv, size_t cb );
1278 // buffer capacity described by another parameter
1279 #define _Pre_cap_(size) _SAL1_1_Source_(_Pre_cap_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_impl(size)))
1280 #define _Pre_opt_cap_(size) _SAL1_1_Source_(_Pre_opt_cap_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_impl(size)))
1281 #define _Pre_bytecap_(size) _SAL1_1_Source_(_Pre_bytecap_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecap_impl(size)))
1282 #define _Pre_opt_bytecap_(size) _SAL1_1_Source_(_Pre_opt_bytecap_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecap_impl(size)))
1283 
1284 // buffer capacity described by a constant expression
1285 #define _Pre_cap_c_(size) _SAL1_1_Source_(_Pre_cap_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_c_impl(size)))
1286 #define _Pre_opt_cap_c_(size) _SAL1_1_Source_(_Pre_opt_cap_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_c_impl(size)))
1287 #define _Pre_bytecap_c_(size) _SAL1_1_Source_(_Pre_bytecap_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecap_c_impl(size)))
1288 #define _Pre_opt_bytecap_c_(size) _SAL1_1_Source_(_Pre_opt_bytecap_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecap_c_impl(size)))
1289 #define _Pre_cap_c_one_ _SAL1_1_Source_(_Pre_cap_c_one_, (), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_c_one_notref_impl))
1290 #define _Pre_opt_cap_c_one_ _SAL1_1_Source_(_Pre_opt_cap_c_one_, (), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_c_one_notref_impl))
1291 
1292 // buffer capacity is described by another parameter multiplied by a constant expression
1293 #define _Pre_cap_m_(mult,size) _SAL1_1_Source_(_Pre_cap_m_, (mult,size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__mult_impl(mult,size)))
1294 #define _Pre_opt_cap_m_(mult,size) _SAL1_1_Source_(_Pre_opt_cap_m_, (mult,size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__mult_impl(mult,size)))
1295 
1296 // buffer capacity described by size of other buffer, only used by dangerous legacy APIs
1297 // e.g. int strcpy(_Pre_cap_for_(src) char* dst, const char* src);
1298 #define _Pre_cap_for_(param) _SAL1_1_Source_(_Pre_cap_for_, (param), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_for_impl(param)))
1299 #define _Pre_opt_cap_for_(param) _SAL1_1_Source_(_Pre_opt_cap_for_, (param), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_for_impl(param)))
1300 
1301 // buffer capacity described by a complex condition
1302 #define _Pre_cap_x_(size) _SAL1_1_Source_(_Pre_cap_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_x_impl(size)))
1303 #define _Pre_opt_cap_x_(size) _SAL1_1_Source_(_Pre_opt_cap_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_x_impl(size)))
1304 #define _Pre_bytecap_x_(size) _SAL1_1_Source_(_Pre_bytecap_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecap_x_impl(size)))
1305 #define _Pre_opt_bytecap_x_(size) _SAL1_1_Source_(_Pre_opt_bytecap_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecap_x_impl(size)))
1306 
1307 // buffer capacity described by the difference to another pointer parameter
1308 #define _Pre_ptrdiff_cap_(ptr) _SAL1_1_Source_(_Pre_ptrdiff_cap_, (ptr), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_x_impl(__ptrdiff(ptr))))
1309 #define _Pre_opt_ptrdiff_cap_(ptr) _SAL1_1_Source_(_Pre_opt_ptrdiff_cap_, (ptr), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_x_impl(__ptrdiff(ptr))))
1310 
1311 // e.g. void AppendStr( _Pre_z_ const char* szFrom, _Pre_z_cap_(cchTo) _Post_z_ char* szTo, size_t cchTo );
1312 #define _Pre_z_cap_(size) _SAL1_1_Source_(_Pre_z_cap_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre2_impl_(__zterm_impl,__cap_impl(size)) _Pre_valid_impl_)
1313 #define _Pre_opt_z_cap_(size) _SAL1_1_Source_(_Pre_opt_z_cap_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre2_impl_(__zterm_impl,__cap_impl(size)) _Pre_valid_impl_)
1314 #define _Pre_z_bytecap_(size) _SAL1_1_Source_(_Pre_z_bytecap_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre2_impl_(__zterm_impl,__bytecap_impl(size)) _Pre_valid_impl_)
1315 #define _Pre_opt_z_bytecap_(size) _SAL1_1_Source_(_Pre_opt_z_bytecap_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre2_impl_(__zterm_impl,__bytecap_impl(size)) _Pre_valid_impl_)
1316 
1317 #define _Pre_z_cap_c_(size) _SAL1_1_Source_(_Pre_z_cap_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre2_impl_(__zterm_impl,__cap_c_impl(size)) _Pre_valid_impl_)
1318 #define _Pre_opt_z_cap_c_(size) _SAL1_1_Source_(_Pre_opt_z_cap_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre2_impl_(__zterm_impl,__cap_c_impl(size)) _Pre_valid_impl_)
1319 #define _Pre_z_bytecap_c_(size) _SAL1_1_Source_(_Pre_z_bytecap_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre2_impl_(__zterm_impl,__bytecap_c_impl(size)) _Pre_valid_impl_)
1320 #define _Pre_opt_z_bytecap_c_(size) _SAL1_1_Source_(_Pre_opt_z_bytecap_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre2_impl_(__zterm_impl,__bytecap_c_impl(size)) _Pre_valid_impl_)
1321 
1322 #define _Pre_z_cap_x_(size) _SAL1_1_Source_(_Pre_z_cap_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre2_impl_(__zterm_impl,__cap_x_impl(size)) _Pre_valid_impl_)
1323 #define _Pre_opt_z_cap_x_(size) _SAL1_1_Source_(_Pre_opt_z_cap_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre2_impl_(__zterm_impl,__cap_x_impl(size)) _Pre_valid_impl_)
1324 #define _Pre_z_bytecap_x_(size) _SAL1_1_Source_(_Pre_z_bytecap_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre2_impl_(__zterm_impl,__bytecap_x_impl(size)) _Pre_valid_impl_)
1325 #define _Pre_opt_z_bytecap_x_(size) _SAL1_1_Source_(_Pre_opt_z_bytecap_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre2_impl_(__zterm_impl,__bytecap_x_impl(size)) _Pre_valid_impl_)
1326 
1327 // known capacity and valid but unknown readable extent
1328 #define _Pre_valid_cap_(size) _SAL1_1_Source_(_Pre_valid_cap_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_impl(size)) _Pre_valid_impl_)
1329 #define _Pre_opt_valid_cap_(size) _SAL1_1_Source_(_Pre_opt_valid_cap_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_impl(size)) _Pre_valid_impl_)
1330 #define _Pre_valid_bytecap_(size) _SAL1_1_Source_(_Pre_valid_bytecap_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecap_impl(size)) _Pre_valid_impl_)
1331 #define _Pre_opt_valid_bytecap_(size) _SAL1_1_Source_(_Pre_opt_valid_bytecap_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecap_impl(size)) _Pre_valid_impl_)
1332 
1333 #define _Pre_valid_cap_c_(size) _SAL1_1_Source_(_Pre_valid_cap_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_c_impl(size)) _Pre_valid_impl_)
1334 #define _Pre_opt_valid_cap_c_(size) _SAL1_1_Source_(_Pre_opt_valid_cap_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_c_impl(size)) _Pre_valid_impl_)
1335 #define _Pre_valid_bytecap_c_(size) _SAL1_1_Source_(_Pre_valid_bytecap_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecap_c_impl(size)) _Pre_valid_impl_)
1336 #define _Pre_opt_valid_bytecap_c_(size) _SAL1_1_Source_(_Pre_opt_valid_bytecap_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecap_c_impl(size)) _Pre_valid_impl_)
1337 
1338 #define _Pre_valid_cap_x_(size) _SAL1_1_Source_(_Pre_valid_cap_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_x_impl(size)) _Pre_valid_impl_)
1339 #define _Pre_opt_valid_cap_x_(size) _SAL1_1_Source_(_Pre_opt_valid_cap_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_x_impl(size)) _Pre_valid_impl_)
1340 #define _Pre_valid_bytecap_x_(size) _SAL1_1_Source_(_Pre_valid_bytecap_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecap_x_impl(size)) _Pre_valid_impl_)
1341 #define _Pre_opt_valid_bytecap_x_(size) _SAL1_1_Source_(_Pre_opt_valid_bytecap_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecap_x_impl(size)) _Pre_valid_impl_)
1342 
1343 // e.g. void AppendCharRange( _Pre_count_(cchFrom) const char* rgFrom, size_t cchFrom, _Out_z_cap_(cchTo) char* szTo, size_t cchTo );
1344 // Valid buffer extent described by another parameter
1345 #define _Pre_count_(size) _SAL1_1_Source_(_Pre_count_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__count_impl(size)) _Pre_valid_impl_)
1346 #define _Pre_opt_count_(size) _SAL1_1_Source_(_Pre_opt_count_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__count_impl(size)) _Pre_valid_impl_)
1347 #define _Pre_bytecount_(size) _SAL1_1_Source_(_Pre_bytecount_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecount_impl(size)) _Pre_valid_impl_)
1348 #define _Pre_opt_bytecount_(size) _SAL1_1_Source_(_Pre_opt_bytecount_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecount_impl(size)) _Pre_valid_impl_)
1349 
1350 // Valid buffer extent described by a constant expression
1351 #define _Pre_count_c_(size) _SAL1_1_Source_(_Pre_count_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__count_c_impl(size)) _Pre_valid_impl_)
1352 #define _Pre_opt_count_c_(size) _SAL1_1_Source_(_Pre_opt_count_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__count_c_impl(size)) _Pre_valid_impl_)
1353 #define _Pre_bytecount_c_(size) _SAL1_1_Source_(_Pre_bytecount_c_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecount_c_impl(size)) _Pre_valid_impl_)
1354 #define _Pre_opt_bytecount_c_(size) _SAL1_1_Source_(_Pre_opt_bytecount_c_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecount_c_impl(size)) _Pre_valid_impl_)
1355 
1356 // Valid buffer extent described by a complex expression
1357 #define _Pre_count_x_(size) _SAL1_1_Source_(_Pre_count_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__count_x_impl(size)) _Pre_valid_impl_)
1358 #define _Pre_opt_count_x_(size) _SAL1_1_Source_(_Pre_opt_count_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__count_x_impl(size)) _Pre_valid_impl_)
1359 #define _Pre_bytecount_x_(size) _SAL1_1_Source_(_Pre_bytecount_x_, (size), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__bytecount_x_impl(size)) _Pre_valid_impl_)
1360 #define _Pre_opt_bytecount_x_(size) _SAL1_1_Source_(_Pre_opt_bytecount_x_, (size), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__bytecount_x_impl(size)) _Pre_valid_impl_)
1361 
1362 // Valid buffer extent described by the difference to another pointer parameter
1363 #define _Pre_ptrdiff_count_(ptr) _SAL1_1_Source_(_Pre_ptrdiff_count_, (ptr), _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__count_x_impl(__ptrdiff(ptr))) _Pre_valid_impl_)
1364 #define _Pre_opt_ptrdiff_count_(ptr) _SAL1_1_Source_(_Pre_opt_ptrdiff_count_, (ptr), _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__count_x_impl(__ptrdiff(ptr))) _Pre_valid_impl_)
1365 
1366 
1367 // char * strncpy(_Out_cap_(_Count) _Post_maybez_ char * _Dest, _In_z_ const char * _Source, _In_ size_t _Count)
1368 // buffer maybe zero-terminated after the call
1369 #define _Post_maybez_ _SAL_L_Source_(_Post_maybez_, (), _Post1_impl_(__maybezterm_impl))
1370 
1371 // e.g. SIZE_T HeapSize( _In_ HANDLE hHeap, DWORD dwFlags, _Pre_notnull_ _Post_bytecap_(return) LPCVOID lpMem );
1372 #define _Post_cap_(size) _SAL1_1_Source_(_Post_cap_, (size), _Post1_impl_(__cap_impl(size)))
1373 #define _Post_bytecap_(size) _SAL1_1_Source_(_Post_bytecap_, (size), _Post1_impl_(__bytecap_impl(size)))
1374 
1375 // e.g. int strlen( _In_z_ _Post_count_(return+1) const char* sz );
1376 #define _Post_count_(size) _SAL1_1_Source_(_Post_count_, (size), _Post1_impl_(__count_impl(size)) _Post_valid_impl_)
1377 #define _Post_bytecount_(size) _SAL1_1_Source_(_Post_bytecount_, (size), _Post1_impl_(__bytecount_impl(size)) _Post_valid_impl_)
1378 #define _Post_count_c_(size) _SAL1_1_Source_(_Post_count_c_, (size), _Post1_impl_(__count_c_impl(size)) _Post_valid_impl_)
1379 #define _Post_bytecount_c_(size) _SAL1_1_Source_(_Post_bytecount_c_, (size), _Post1_impl_(__bytecount_c_impl(size)) _Post_valid_impl_)
1380 #define _Post_count_x_(size) _SAL1_1_Source_(_Post_count_x_, (size), _Post1_impl_(__count_x_impl(size)) _Post_valid_impl_)
1381 #define _Post_bytecount_x_(size) _SAL1_1_Source_(_Post_bytecount_x_, (size), _Post1_impl_(__bytecount_x_impl(size)) _Post_valid_impl_)
1382 
1383 // e.g. size_t CopyStr( _In_z_ const char* szFrom, _Pre_cap_(cch) _Post_z_count_(return+1) char* szFrom, size_t cchFrom );
1384 #define _Post_z_count_(size) _SAL1_1_Source_(_Post_z_count_, (size), _Post2_impl_(__zterm_impl,__count_impl(size)) _Post_valid_impl_)
1385 #define _Post_z_bytecount_(size) _SAL1_1_Source_(_Post_z_bytecount_, (size), _Post2_impl_(__zterm_impl,__bytecount_impl(size)) _Post_valid_impl_)
1386 #define _Post_z_count_c_(size) _SAL1_1_Source_(_Post_z_count_c_, (size), _Post2_impl_(__zterm_impl,__count_c_impl(size)) _Post_valid_impl_)
1387 #define _Post_z_bytecount_c_(size) _SAL1_1_Source_(_Post_z_bytecount_c_, (size), _Post2_impl_(__zterm_impl,__bytecount_c_impl(size)) _Post_valid_impl_)
1388 #define _Post_z_count_x_(size) _SAL1_1_Source_(_Post_z_count_x_, (size), _Post2_impl_(__zterm_impl,__count_x_impl(size)) _Post_valid_impl_)
1389 #define _Post_z_bytecount_x_(size) _SAL1_1_Source_(_Post_z_bytecount_x_, (size), _Post2_impl_(__zterm_impl,__bytecount_x_impl(size)) _Post_valid_impl_)
1390 
1391 //
1392 // _Prepost_ ---
1393 //
1394 // describing conditions that hold before and after the function call
1395 
1396 #define _Prepost_opt_z_ _SAL1_1_Source_(_Prepost_opt_z_, (), _Pre_opt_z_ _Post_z_)
1397 
1398 #define _Prepost_count_(size) _SAL1_1_Source_(_Prepost_count_, (size), _Pre_count_(size) _Post_count_(size))
1399 #define _Prepost_opt_count_(size) _SAL1_1_Source_(_Prepost_opt_count_, (size), _Pre_opt_count_(size) _Post_count_(size))
1400 #define _Prepost_bytecount_(size) _SAL1_1_Source_(_Prepost_bytecount_, (size), _Pre_bytecount_(size) _Post_bytecount_(size))
1401 #define _Prepost_opt_bytecount_(size) _SAL1_1_Source_(_Prepost_opt_bytecount_, (size), _Pre_opt_bytecount_(size) _Post_bytecount_(size))
1402 #define _Prepost_count_c_(size) _SAL1_1_Source_(_Prepost_count_c_, (size), _Pre_count_c_(size) _Post_count_c_(size))
1403 #define _Prepost_opt_count_c_(size) _SAL1_1_Source_(_Prepost_opt_count_c_, (size), _Pre_opt_count_c_(size) _Post_count_c_(size))
1404 #define _Prepost_bytecount_c_(size) _SAL1_1_Source_(_Prepost_bytecount_c_, (size), _Pre_bytecount_c_(size) _Post_bytecount_c_(size))
1405 #define _Prepost_opt_bytecount_c_(size) _SAL1_1_Source_(_Prepost_opt_bytecount_c_, (size), _Pre_opt_bytecount_c_(size) _Post_bytecount_c_(size))
1406 #define _Prepost_count_x_(size) _SAL1_1_Source_(_Prepost_count_x_, (size), _Pre_count_x_(size) _Post_count_x_(size))
1407 #define _Prepost_opt_count_x_(size) _SAL1_1_Source_(_Prepost_opt_count_x_, (size), _Pre_opt_count_x_(size) _Post_count_x_(size))
1408 #define _Prepost_bytecount_x_(size) _SAL1_1_Source_(_Prepost_bytecount_x_, (size), _Pre_bytecount_x_(size) _Post_bytecount_x_(size))
1409 #define _Prepost_opt_bytecount_x_(size) _SAL1_1_Source_(_Prepost_opt_bytecount_x_, (size), _Pre_opt_bytecount_x_(size) _Post_bytecount_x_(size))
1410 
1411 #define _Prepost_valid_ _SAL1_1_Source_(_Prepost_valid_, (), _Pre_valid_ _Post_valid_)
1412 #define _Prepost_opt_valid_ _SAL1_1_Source_(_Prepost_opt_valid_, (), _Pre_opt_valid_ _Post_valid_)
1413 
1414 //
1415 // _Deref_<both> ---
1416 //
1417 // short version for _Deref_pre_<ann> _Deref_post_<ann>
1418 // describing conditions for array elements or dereferenced pointer parameters that hold before and after the call
1419 
1420 #define _Deref_prepost_z_ _SAL1_1_Source_(_Deref_prepost_z_, (), _Deref_pre_z_ _Deref_post_z_)
1421 #define _Deref_prepost_opt_z_ _SAL1_1_Source_(_Deref_prepost_opt_z_, (), _Deref_pre_opt_z_ _Deref_post_opt_z_)
1422 
1423 #define _Deref_prepost_cap_(size) _SAL1_1_Source_(_Deref_prepost_cap_, (size), _Deref_pre_cap_(size) _Deref_post_cap_(size))
1424 #define _Deref_prepost_opt_cap_(size) _SAL1_1_Source_(_Deref_prepost_opt_cap_, (size), _Deref_pre_opt_cap_(size) _Deref_post_opt_cap_(size))
1425 #define _Deref_prepost_bytecap_(size) _SAL1_1_Source_(_Deref_prepost_bytecap_, (size), _Deref_pre_bytecap_(size) _Deref_post_bytecap_(size))
1426 #define _Deref_prepost_opt_bytecap_(size) _SAL1_1_Source_(_Deref_prepost_opt_bytecap_, (size), _Deref_pre_opt_bytecap_(size) _Deref_post_opt_bytecap_(size))
1427 
1428 #define _Deref_prepost_cap_x_(size) _SAL1_1_Source_(_Deref_prepost_cap_x_, (size), _Deref_pre_cap_x_(size) _Deref_post_cap_x_(size))
1429 #define _Deref_prepost_opt_cap_x_(size) _SAL1_1_Source_(_Deref_prepost_opt_cap_x_, (size), _Deref_pre_opt_cap_x_(size) _Deref_post_opt_cap_x_(size))
1430 #define _Deref_prepost_bytecap_x_(size) _SAL1_1_Source_(_Deref_prepost_bytecap_x_, (size), _Deref_pre_bytecap_x_(size) _Deref_post_bytecap_x_(size))
1431 #define _Deref_prepost_opt_bytecap_x_(size) _SAL1_1_Source_(_Deref_prepost_opt_bytecap_x_, (size), _Deref_pre_opt_bytecap_x_(size) _Deref_post_opt_bytecap_x_(size))
1432 
1433 #define _Deref_prepost_z_cap_(size) _SAL1_1_Source_(_Deref_prepost_z_cap_, (size), _Deref_pre_z_cap_(size) _Deref_post_z_cap_(size))
1434 #define _Deref_prepost_opt_z_cap_(size) _SAL1_1_Source_(_Deref_prepost_opt_z_cap_, (size), _Deref_pre_opt_z_cap_(size) _Deref_post_opt_z_cap_(size))
1435 #define _Deref_prepost_z_bytecap_(size) _SAL1_1_Source_(_Deref_prepost_z_bytecap_, (size), _Deref_pre_z_bytecap_(size) _Deref_post_z_bytecap_(size))
1436 #define _Deref_prepost_opt_z_bytecap_(size) _SAL1_1_Source_(_Deref_prepost_opt_z_bytecap_, (size), _Deref_pre_opt_z_bytecap_(size) _Deref_post_opt_z_bytecap_(size))
1437 
1438 #define _Deref_prepost_valid_cap_(size) _SAL1_1_Source_(_Deref_prepost_valid_cap_, (size), _Deref_pre_valid_cap_(size) _Deref_post_valid_cap_(size))
1439 #define _Deref_prepost_opt_valid_cap_(size) _SAL1_1_Source_(_Deref_prepost_opt_valid_cap_, (size), _Deref_pre_opt_valid_cap_(size) _Deref_post_opt_valid_cap_(size))
1440 #define _Deref_prepost_valid_bytecap_(size) _SAL1_1_Source_(_Deref_prepost_valid_bytecap_, (size), _Deref_pre_valid_bytecap_(size) _Deref_post_valid_bytecap_(size))
1441 #define _Deref_prepost_opt_valid_bytecap_(size) _SAL1_1_Source_(_Deref_prepost_opt_valid_bytecap_, (size), _Deref_pre_opt_valid_bytecap_(size) _Deref_post_opt_valid_bytecap_(size))
1442 
1443 #define _Deref_prepost_valid_cap_x_(size) _SAL1_1_Source_(_Deref_prepost_valid_cap_x_, (size), _Deref_pre_valid_cap_x_(size) _Deref_post_valid_cap_x_(size))
1444 #define _Deref_prepost_opt_valid_cap_x_(size) _SAL1_1_Source_(_Deref_prepost_opt_valid_cap_x_, (size), _Deref_pre_opt_valid_cap_x_(size) _Deref_post_opt_valid_cap_x_(size))
1445 #define _Deref_prepost_valid_bytecap_x_(size) _SAL1_1_Source_(_Deref_prepost_valid_bytecap_x_, (size), _Deref_pre_valid_bytecap_x_(size) _Deref_post_valid_bytecap_x_(size))
1446 #define _Deref_prepost_opt_valid_bytecap_x_(size) _SAL1_1_Source_(_Deref_prepost_opt_valid_bytecap_x_, (size), _Deref_pre_opt_valid_bytecap_x_(size) _Deref_post_opt_valid_bytecap_x_(size))
1447 
1448 #define _Deref_prepost_count_(size) _SAL1_1_Source_(_Deref_prepost_count_, (size), _Deref_pre_count_(size) _Deref_post_count_(size))
1449 #define _Deref_prepost_opt_count_(size) _SAL1_1_Source_(_Deref_prepost_opt_count_, (size), _Deref_pre_opt_count_(size) _Deref_post_opt_count_(size))
1450 #define _Deref_prepost_bytecount_(size) _SAL1_1_Source_(_Deref_prepost_bytecount_, (size), _Deref_pre_bytecount_(size) _Deref_post_bytecount_(size))
1451 #define _Deref_prepost_opt_bytecount_(size) _SAL1_1_Source_(_Deref_prepost_opt_bytecount_, (size), _Deref_pre_opt_bytecount_(size) _Deref_post_opt_bytecount_(size))
1452 
1453 #define _Deref_prepost_count_x_(size) _SAL1_1_Source_(_Deref_prepost_count_x_, (size), _Deref_pre_count_x_(size) _Deref_post_count_x_(size))
1454 #define _Deref_prepost_opt_count_x_(size) _SAL1_1_Source_(_Deref_prepost_opt_count_x_, (size), _Deref_pre_opt_count_x_(size) _Deref_post_opt_count_x_(size))
1455 #define _Deref_prepost_bytecount_x_(size) _SAL1_1_Source_(_Deref_prepost_bytecount_x_, (size), _Deref_pre_bytecount_x_(size) _Deref_post_bytecount_x_(size))
1456 #define _Deref_prepost_opt_bytecount_x_(size) _SAL1_1_Source_(_Deref_prepost_opt_bytecount_x_, (size), _Deref_pre_opt_bytecount_x_(size) _Deref_post_opt_bytecount_x_(size))
1457 
1458 #define _Deref_prepost_valid_ _SAL1_1_Source_(_Deref_prepost_valid_, (), _Deref_pre_valid_ _Deref_post_valid_)
1459 #define _Deref_prepost_opt_valid_ _SAL1_1_Source_(_Deref_prepost_opt_valid_, (), _Deref_pre_opt_valid_ _Deref_post_opt_valid_)
1460 
1461 //
1462 // _Deref_<miscellaneous>
1463 //
1464 // used with references to arrays
1465 
1466 #define _Deref_out_z_cap_c_(size) _SAL1_1_Source_(_Deref_out_z_cap_c_, (size), _Deref_pre_cap_c_(size) _Deref_post_z_)
1467 #define _Deref_inout_z_cap_c_(size) _SAL1_1_Source_(_Deref_inout_z_cap_c_, (size), _Deref_pre_z_cap_c_(size) _Deref_post_z_)
1468 #define _Deref_out_z_bytecap_c_(size) _SAL1_1_Source_(_Deref_out_z_bytecap_c_, (size), _Deref_pre_bytecap_c_(size) _Deref_post_z_)
1469 #define _Deref_inout_z_bytecap_c_(size) _SAL1_1_Source_(_Deref_inout_z_bytecap_c_, (size), _Deref_pre_z_bytecap_c_(size) _Deref_post_z_)
1470 #define _Deref_inout_z_ _SAL1_1_Source_(_Deref_inout_z_, (), _Deref_prepost_z_)
1471 
1472 #pragma endregion Input Buffer SAL 1 compatibility macros
1473 
1474 
1475 //============================================================================
1476 // Implementation Layer:
1477 //============================================================================
1478 
1479 
1480 // Naming conventions:
1481 // A symbol the begins with _SA_ is for the machinery of creating any
1482 // annotations; many of those come from sourceannotations.h in the case
1483 // of attributes.
1484 
1485 // A symbol that ends with _impl is the very lowest level macro. It is
1486 // not required to be a legal standalone annotation, and in the case
1487 // of attribute annotations, usually is not. (In the case of some declspec
1488 // annotations, it might be, but it should not be assumed so.) Those
1489 // symols will be used in the _PreN..., _PostN... and _RetN... annotations
1490 // to build up more complete annotations.
1491 
1492 // A symbol ending in _impl_ is reserved to the implementation as well,
1493 // but it does form a complete annotation; usually they are used to build
1494 // up even higher level annotations.
1495 
1496 
1497 #if _USE_ATTRIBUTES_FOR_SAL || _USE_DECLSPECS_FOR_SAL // [
1498 // Sharable "_impl" macros: these can be shared between the various annotation
1499 // forms but are part of the implementation of the macros. These are collected
1500 // here to assure that only necessary differences in the annotations
1501 // exist.
1502 
1503 #define _Always_impl_(annos) _Group_(annos _SAL_nop_impl_) _On_failure_impl_(annos _SAL_nop_impl_)
1504 #define _Bound_impl_ _SA_annotes0(SAL_bound)
1505 #define _Field_range_impl_(min,max) _Range_impl_(min,max)
1506 #define _Literal_impl_ _SA_annotes1(SAL_constant, __yes)
1507 #define _Maybenull_impl_ _SA_annotes1(SAL_null, __maybe)
1508 #define _Maybevalid_impl_ _SA_annotes1(SAL_valid, __maybe)
1509 #define _Must_inspect_impl_ _Post_impl_ _SA_annotes0(SAL_mustInspect)
1510 #define _Notliteral_impl_ _SA_annotes1(SAL_constant, __no)
1511 #define _Notnull_impl_ _SA_annotes1(SAL_null, __no)
1512 #define _Notvalid_impl_ _SA_annotes1(SAL_valid, __no)
1513 #define _NullNull_terminated_impl_ _Group_(_SA_annotes1(SAL_nullTerminated, __yes) _SA_annotes1(SAL_readableTo,inexpressibleCount("NullNull terminated string")))
1514 #define _Null_impl_ _SA_annotes1(SAL_null, __yes)
1515 #define _Null_terminated_impl_ _SA_annotes1(SAL_nullTerminated, __yes)
1516 #define _Out_impl_ _Pre1_impl_(__notnull_impl_notref) _Pre1_impl_(__cap_c_one_notref_impl) _Post_valid_impl_
1517 #define _Out_opt_impl_ _Pre1_impl_(__maybenull_impl_notref) _Pre1_impl_(__cap_c_one_notref_impl) _Post_valid_impl_
1518 #define _Points_to_data_impl_ _At_(*_Curr_, _SA_annotes1(SAL_mayBePointer, __no))
1519 #define _Post_satisfies_impl_(cond) _Post_impl_ _Satisfies_impl_(cond)
1520 #define _Post_valid_impl_ _Post1_impl_(__valid_impl)
1521 #define _Pre_satisfies_impl_(cond) _Pre_impl_ _Satisfies_impl_(cond)
1522 #define _Pre_valid_impl_ _Pre1_impl_(__valid_impl)
1523 #define _Range_impl_(min,max) _SA_annotes2(SAL_range, min, max)
1524 #define _Readable_bytes_impl_(size) _SA_annotes1(SAL_readableTo, byteCount(size))
1525 #define _Readable_elements_impl_(size) _SA_annotes1(SAL_readableTo, elementCount(size))
1526 #define _Ret_valid_impl_ _Ret1_impl_(__valid_impl)
1527 #define _Satisfies_impl_(cond) _SA_annotes1(SAL_satisfies, cond)
1528 #define _Valid_impl_ _SA_annotes1(SAL_valid, __yes)
1529 #define _Writable_bytes_impl_(size) _SA_annotes1(SAL_writableTo, byteCount(size))
1530 #define _Writable_elements_impl_(size) _SA_annotes1(SAL_writableTo, elementCount(size))
1531 
1532 #define _In_range_impl_(min,max) _Pre_impl_ _Range_impl_(min,max)
1533 #define _Out_range_impl_(min,max) _Post_impl_ _Range_impl_(min,max)
1534 #define _Ret_range_impl_(min,max) _Post_impl_ _Range_impl_(min,max)
1535 #define _Deref_in_range_impl_(min,max) _Deref_pre_impl_ _Range_impl_(min,max)
1536 #define _Deref_out_range_impl_(min,max) _Deref_post_impl_ _Range_impl_(min,max)
1537 #define _Deref_ret_range_impl_(min,max) _Deref_post_impl_ _Range_impl_(min,max)
1538 
1539 #define _Deref_pre_impl_ _Pre_impl_ _Notref_impl_ _Deref_impl_
1540 #define _Deref_post_impl_ _Post_impl_ _Notref_impl_ _Deref_impl_
1541 
1542 // The following are for the implementation machinery, and are not
1543 // suitable for annotating general code.
1544 // We're tying to phase this out, someday. The parser quotes the param.
1545 #define __AuToQuOtE _SA_annotes0(SAL_AuToQuOtE)
1546 
1547 // Normally the parser does some simple type checking of annotation params,
1548 // defer that check to the plugin.
1549 #define __deferTypecheck _SA_annotes0(SAL_deferTypecheck)
1550 
1551 #define _SA_SPECSTRIZE( x ) #x
1552 #define _SAL_nop_impl_ /* nothing */
1553 #define __nop_impl(x) x
1554 #endif
1555 
1556 
1557 #if _USE_ATTRIBUTES_FOR_SAL // [
1558 
1559 // Using attributes for sal
1560 
1562 
1563 
1564 #define _SA_annotes0(n) [SAL_annotes(Name=#n)]
1565 #define _SA_annotes1(n,pp1) [SAL_annotes(Name=#n, p1=_SA_SPECSTRIZE(pp1))]
1566 #define _SA_annotes2(n,pp1,pp2) [SAL_annotes(Name=#n, p1=_SA_SPECSTRIZE(pp1), p2=_SA_SPECSTRIZE(pp2))]
1567 #define _SA_annotes3(n,pp1,pp2,pp3) [SAL_annotes(Name=#n, p1=_SA_SPECSTRIZE(pp1), p2=_SA_SPECSTRIZE(pp2), p3=_SA_SPECSTRIZE(pp3))]
1568 
1569 #define _Pre_impl_ [SAL_pre]
1570 #define _Post_impl_ [SAL_post]
1571 #define _Deref_impl_ [SAL_deref]
1572 #define _Notref_impl_ [SAL_notref]
1573 
1574 
1575 // Declare a function to be an annotation or primop (respectively).
1576 // Done this way so that they don't appear in the regular compiler's
1577 // namespace.
1578 #define __ANNOTATION(fun) _SA_annotes0(SAL_annotation) void __SA_##fun;
1579 #define __PRIMOP(type, fun) _SA_annotes0(SAL_primop) type __SA_##fun;
1580 #define __QUALIFIER(fun) _SA_annotes0(SAL_qualifier) void __SA_##fun;
1581 
1582 // Benign declspec needed here for WindowsPREfast
1583 #define __In_impl_ [SA_Pre(Valid=SA_Yes)] [SA_Pre(Deref=1, Notref=1, Access=SA_Read)] __declspec("SAL_pre SAL_valid")
1584 
1585 #elif _USE_DECLSPECS_FOR_SAL // ][
1586 
1587 // Using declspecs for sal
1588 
1589 #define _SA_annotes0(n) __declspec(#n)
1590 #define _SA_annotes1(n,pp1) __declspec(#n "(" _SA_SPECSTRIZE(pp1) ")" )
1591 #define _SA_annotes2(n,pp1,pp2) __declspec(#n "(" _SA_SPECSTRIZE(pp1) "," _SA_SPECSTRIZE(pp2) ")")
1592 #define _SA_annotes3(n,pp1,pp2,pp3) __declspec(#n "(" _SA_SPECSTRIZE(pp1) "," _SA_SPECSTRIZE(pp2) "," _SA_SPECSTRIZE(pp3) ")")
1593 
1594 #define _Pre_impl_ _SA_annotes0(SAL_pre)
1595 #define _Post_impl_ _SA_annotes0(SAL_post)
1596 #define _Deref_impl_ _SA_annotes0(SAL_deref)
1597 #define _Notref_impl_ _SA_annotes0(SAL_notref)
1598 
1599 // Declare a function to be an annotation or primop (respectively).
1600 // Done this way so that they don't appear in the regular compiler's
1601 // namespace.
1602 #define __ANNOTATION(fun) _SA_annotes0(SAL_annotation) void __SA_##fun
1603 
1604 #define __PRIMOP(type, fun) _SA_annotes0(SAL_primop) type __SA_##fun
1605 
1606 #define __QUALIFIER(fun) _SA_annotes0(SAL_qualifier) void __SA_##fun;
1607 
1608 #define __In_impl_ _Pre_impl_ _SA_annotes0(SAL_valid) _Pre_impl_ _Deref_impl_ _Notref_impl_ _SA_annotes0(SAL_readonly)
1609 
1610 #else // ][
1611 
1612 // Using "nothing" for sal
1613 
1614 #define _SA_annotes0(n)
1615 #define _SA_annotes1(n,pp1)
1616 #define _SA_annotes2(n,pp1,pp2)
1617 #define _SA_annotes3(n,pp1,pp2,pp3)
1618 
1619 #define __ANNOTATION(fun)
1620 #define __PRIMOP(type, fun)
1621 #define __QUALIFIER(type, fun)
1622 
1623 #endif // ]
1624 
1625 #if _USE_ATTRIBUTES_FOR_SAL || _USE_DECLSPECS_FOR_SAL // [
1626 
1627 // Declare annotations that need to be declared.
1628 __ANNOTATION(SAL_useHeader(void));
1629 __ANNOTATION(SAL_bound(void));
1630 __ANNOTATION(SAL_allocator(void)); //??? resolve with PFD
1631 __ANNOTATION(SAL_file_parser(__AuToQuOtE __In_impl_ char *, __In_impl_ char *));
1632 __ANNOTATION(SAL_source_code_content(__In_impl_ char *));
1633 __ANNOTATION(SAL_analysisHint(__AuToQuOtE __In_impl_ char *));
1634 __ANNOTATION(SAL_untrusted_data_source(__AuToQuOtE __In_impl_ char *));
1635 __ANNOTATION(SAL_untrusted_data_source_this(__AuToQuOtE __In_impl_ char *));
1636 __ANNOTATION(SAL_validated(__AuToQuOtE __In_impl_ char *));
1637 __ANNOTATION(SAL_validated_this(__AuToQuOtE __In_impl_ char *));
1638 __ANNOTATION(SAL_encoded(void));
1639 __ANNOTATION(SAL_adt(__AuToQuOtE __In_impl_ char *, __AuToQuOtE __In_impl_ char *));
1640 __ANNOTATION(SAL_add_adt_property(__AuToQuOtE __In_impl_ char *, __AuToQuOtE __In_impl_ char *));
1641 __ANNOTATION(SAL_remove_adt_property(__AuToQuOtE __In_impl_ char *, __AuToQuOtE __In_impl_ char *));
1642 __ANNOTATION(SAL_transfer_adt_property_from(__AuToQuOtE __In_impl_ char *));
1643 __ANNOTATION(SAL_post_type(__AuToQuOtE __In_impl_ char *));
1644 __ANNOTATION(SAL_volatile(void));
1645 __ANNOTATION(SAL_nonvolatile(void));
1646 __ANNOTATION(SAL_entrypoint(__AuToQuOtE __In_impl_ char *, __AuToQuOtE __In_impl_ char *));
1647 __ANNOTATION(SAL_blocksOn(__In_impl_ void*));
1648 __ANNOTATION(SAL_mustInspect(void));
1649 
1650 // Only appears in model files, but needs to be declared.
1651 __ANNOTATION(SAL_TypeName(__AuToQuOtE __In_impl_ char *));
1652 
1653 // To be declared well-known soon.
1654 __ANNOTATION(SAL_interlocked(void);)
1655 
1656 __QUALIFIER(SAL_name(__In_impl_ char *, __In_impl_ char *, __In_impl_ char *);)
1657 
1658 __PRIMOP(char *, _Macro_value_(__In_impl_ char *));
1659 __PRIMOP(int, _Macro_defined_(__In_impl_ char *));
1660 __PRIMOP(char *, _Strstr_(__In_impl_ char *, __In_impl_ char *));
1661 
1662 #endif // ]
1663 
1664 #if _USE_ATTRIBUTES_FOR_SAL // [
1665 
1666 #define _Check_return_impl_ [SA_Post(MustCheck=SA_Yes)]
1667 
1668 #define _Success_impl_(expr) [SA_Success(Condition=#expr)]
1669 #define _On_failure_impl_(annos) [SAL_context(p1="SAL_failed")] _Group_(_Post_impl_ _Group_(annos _SAL_nop_impl_))
1670 
1671 #define _Printf_format_string_impl_ [SA_FormatString(Style="printf")]
1672 #define _Scanf_format_string_impl_ [SA_FormatString(Style="scanf")]
1673 #define _Scanf_s_format_string_impl_ [SA_FormatString(Style="scanf_s")]
1674 
1675 #define _In_bound_impl_ [SA_PreBound(Deref=0)]
1676 #define _Out_bound_impl_ [SA_PostBound(Deref=0)]
1677 #define _Ret_bound_impl_ [SA_PostBound(Deref=0)]
1678 #define _Deref_in_bound_impl_ [SA_PreBound(Deref=1)]
1679 #define _Deref_out_bound_impl_ [SA_PostBound(Deref=1)]
1680 #define _Deref_ret_bound_impl_ [SA_PostBound(Deref=1)]
1681 
1682 #define __valid_impl Valid=SA_Yes
1683 #define __maybevalid_impl Valid=SA_Maybe
1684 #define __notvalid_impl Valid=SA_No
1685 
1686 #define __null_impl Null=SA_Yes
1687 #define __maybenull_impl Null=SA_Maybe
1688 #define __notnull_impl Null=SA_No
1689 
1690 #define __null_impl_notref Null=SA_Yes,Notref=1
1691 #define __maybenull_impl_notref Null=SA_Maybe,Notref=1
1692 #define __notnull_impl_notref Null=SA_No,Notref=1
1693 
1694 #define __zterm_impl NullTerminated=SA_Yes
1695 #define __maybezterm_impl NullTerminated=SA_Maybe
1696 #define __maybzterm_impl NullTerminated=SA_Maybe
1697 #define __notzterm_impl NullTerminated=SA_No
1698 
1699 #define __readaccess_impl Access=SA_Read
1700 #define __writeaccess_impl Access=SA_Write
1701 #define __allaccess_impl Access=SA_ReadWrite
1702 
1703 #define __readaccess_impl_notref Access=SA_Read,Notref=1
1704 #define __writeaccess_impl_notref Access=SA_Write,Notref=1
1705 #define __allaccess_impl_notref Access=SA_ReadWrite,Notref=1
1706 
1707 // For SAL2, we need to expect general expressions.
1708 
1709 #define __cap_impl(size) WritableElements="\n"#size
1710 #define __bytecap_impl(size) WritableBytes="\n"#size
1711 #define __bytecount_impl(size) ValidBytes="\n"#size
1712 #define __count_impl(size) ValidElements="\n"#size
1713 
1714 #define __cap_c_impl(size) WritableElementsConst=size
1715 #define __cap_c_one_notref_impl WritableElementsConst=1,Notref=1
1716 #define __cap_for_impl(param) WritableElementsLength=#param
1717 #define __cap_x_impl(size) WritableElements="\n@"#size
1718 
1719 #define __bytecap_c_impl(size) WritableBytesConst=size
1720 #define __bytecap_x_impl(size) WritableBytes="\n@"#size
1721 
1722 #define __mult_impl(mult,size) __cap_impl((mult)*(size))
1723 
1724 #define __count_c_impl(size) ValidElementsConst=size
1725 #define __count_x_impl(size) ValidElements="\n@"#size
1726 
1727 #define __bytecount_c_impl(size) ValidBytesConst=size
1728 #define __bytecount_x_impl(size) ValidBytes="\n@"#size
1729 
1730 
1731 #define _At_impl_(target, annos) [SAL_at(p1=#target)] _Group_(annos)
1732 #define _At_buffer_impl_(target, iter, bound, annos) [SAL_at_buffer(p1=#target, p2=#iter, p3=#bound)] _Group_(annos)
1733 #define _When_impl_(expr, annos) [SAL_when(p1=#expr)] _Group_(annos)
1734 
1735 #define _Group_impl_(annos) [SAL_begin] annos [SAL_end]
1736 #define _GrouP_impl_(annos) [SAL_BEGIN] annos [SAL_END]
1737 
1738 #define _Use_decl_anno_impl_ _SA_annotes0(SAL_useHeader) // this is a special case!
1739 
1740 #define _Pre1_impl_(p1) [SA_Pre(p1)]
1741 #define _Pre2_impl_(p1,p2) [SA_Pre(p1,p2)]
1742 #define _Pre3_impl_(p1,p2,p3) [SA_Pre(p1,p2,p3)]
1743 
1744 #define _Post1_impl_(p1) [SA_Post(p1)]
1745 #define _Post2_impl_(p1,p2) [SA_Post(p1,p2)]
1746 #define _Post3_impl_(p1,p2,p3) [SA_Post(p1,p2,p3)]
1747 
1748 #define _Ret1_impl_(p1) [SA_Post(p1)]
1749 #define _Ret2_impl_(p1,p2) [SA_Post(p1,p2)]
1750 #define _Ret3_impl_(p1,p2,p3) [SA_Post(p1,p2,p3)]
1751 
1752 #define _Deref_pre1_impl_(p1) [SA_Pre(Deref=1,p1)]
1753 #define _Deref_pre2_impl_(p1,p2) [SA_Pre(Deref=1,p1,p2)]
1754 #define _Deref_pre3_impl_(p1,p2,p3) [SA_Pre(Deref=1,p1,p2,p3)]
1755 
1756 
1757 #define _Deref_post1_impl_(p1) [SA_Post(Deref=1,p1)]
1758 #define _Deref_post2_impl_(p1,p2) [SA_Post(Deref=1,p1,p2)]
1759 #define _Deref_post3_impl_(p1,p2,p3) [SA_Post(Deref=1,p1,p2,p3)]
1760 
1761 #define _Deref_ret1_impl_(p1) [SA_Post(Deref=1,p1)]
1762 #define _Deref_ret2_impl_(p1,p2) [SA_Post(Deref=1,p1,p2)]
1763 #define _Deref_ret3_impl_(p1,p2,p3) [SA_Post(Deref=1,p1,p2,p3)]
1764 
1765 #define _Deref2_pre1_impl_(p1) [SA_Pre(Deref=2,Notref=1,p1)]
1766 #define _Deref2_post1_impl_(p1) [SA_Post(Deref=2,Notref=1,p1)]
1767 #define _Deref2_ret1_impl_(p1) [SA_Post(Deref=2,Notref=1,p1)]
1768 
1769 // Obsolete -- may be needed for transition to attributes.
1770 #define __inner_typefix(ctype) [SAL_typefix(p1=_SA_SPECSTRIZE(ctype))]
1771 #define __inner_exceptthat [SAL_except]
1772 
1773 
1774 #elif _USE_DECLSPECS_FOR_SAL // ][
1775 
1776 #define _Check_return_impl_ __post _SA_annotes0(SAL_checkReturn)
1777 
1778 #define _Success_impl_(expr) _SA_annotes1(SAL_success, expr)
1779 #define _On_failure_impl_(annos) _SA_annotes1(SAL_context, SAL_failed) _Group_(_Post_impl_ _Group_(_SAL_nop_impl_ annos))
1780 
1781 #define _Printf_format_string_impl_ _SA_annotes1(SAL_IsFormatString, "printf")
1782 #define _Scanf_format_string_impl_ _SA_annotes1(SAL_IsFormatString, "scanf")
1783 #define _Scanf_s_format_string_impl_ _SA_annotes1(SAL_IsFormatString, "scanf_s")
1784 
1785 #define _In_bound_impl_ _Pre_impl_ _Bound_impl_
1786 #define _Out_bound_impl_ _Post_impl_ _Bound_impl_
1787 #define _Ret_bound_impl_ _Post_impl_ _Bound_impl_
1788 #define _Deref_in_bound_impl_ _Deref_pre_impl_ _Bound_impl_
1789 #define _Deref_out_bound_impl_ _Deref_post_impl_ _Bound_impl_
1790 #define _Deref_ret_bound_impl_ _Deref_post_impl_ _Bound_impl_
1791 
1792 
1793 #define __null_impl _SA_annotes0(SAL_null) // _SA_annotes1(SAL_null, __yes)
1794 #define __notnull_impl _SA_annotes0(SAL_notnull) // _SA_annotes1(SAL_null, __no)
1795 #define __maybenull_impl _SA_annotes0(SAL_maybenull) // _SA_annotes1(SAL_null, __maybe)
1796 
1797 #define __valid_impl _SA_annotes0(SAL_valid) // _SA_annotes1(SAL_valid, __yes)
1798 #define __notvalid_impl _SA_annotes0(SAL_notvalid) // _SA_annotes1(SAL_valid, __no)
1799 #define __maybevalid_impl _SA_annotes0(SAL_maybevalid) // _SA_annotes1(SAL_valid, __maybe)
1800 
1801 #define __null_impl_notref _Notref_ _Null_impl_
1802 #define __maybenull_impl_notref _Notref_ _Maybenull_impl_
1803 #define __notnull_impl_notref _Notref_ _Notnull_impl_
1804 
1805 #define __zterm_impl _SA_annotes1(SAL_nullTerminated, __yes)
1806 #define __maybezterm_impl _SA_annotes1(SAL_nullTerminated, __maybe)
1807 #define __maybzterm_impl _SA_annotes1(SAL_nullTerminated, __maybe)
1808 #define __notzterm_impl _SA_annotes1(SAL_nullTerminated, __no)
1809 
1810 #define __readaccess_impl _SA_annotes1(SAL_access, 0x1)
1811 #define __writeaccess_impl _SA_annotes1(SAL_access, 0x2)
1812 #define __allaccess_impl _SA_annotes1(SAL_access, 0x3)
1813 
1814 #define __readaccess_impl_notref _Notref_ _SA_annotes1(SAL_access, 0x1)
1815 #define __writeaccess_impl_notref _Notref_ _SA_annotes1(SAL_access, 0x2)
1816 #define __allaccess_impl_notref _Notref_ _SA_annotes1(SAL_access, 0x3)
1817 
1818 #define __cap_impl(size) _SA_annotes1(SAL_writableTo,elementCount(size))
1819 #define __cap_c_impl(size) _SA_annotes1(SAL_writableTo,elementCount(size))
1820 #define __cap_c_one_notref_impl _Notref_ _SA_annotes1(SAL_writableTo,elementCount(1))
1821 #define __cap_for_impl(param) _SA_annotes1(SAL_writableTo,inexpressibleCount(sizeof(param)))
1822 #define __cap_x_impl(size) _SA_annotes1(SAL_writableTo,inexpressibleCount(#size))
1823 
1824 #define __bytecap_impl(size) _SA_annotes1(SAL_writableTo,byteCount(size))
1825 #define __bytecap_c_impl(size) _SA_annotes1(SAL_writableTo,byteCount(size))
1826 #define __bytecap_x_impl(size) _SA_annotes1(SAL_writableTo,inexpressibleCount(#size))
1827 
1828 #define __mult_impl(mult,size) _SA_annotes1(SAL_writableTo,(mult)*(size))
1829 
1830 #define __count_impl(size) _SA_annotes1(SAL_readableTo,elementCount(size))
1831 #define __count_c_impl(size) _SA_annotes1(SAL_readableTo,elementCount(size))
1832 #define __count_x_impl(size) _SA_annotes1(SAL_readableTo,inexpressibleCount(#size))
1833 
1834 #define __bytecount_impl(size) _SA_annotes1(SAL_readableTo,byteCount(size))
1835 #define __bytecount_c_impl(size) _SA_annotes1(SAL_readableTo,byteCount(size))
1836 #define __bytecount_x_impl(size) _SA_annotes1(SAL_readableTo,inexpressibleCount(#size))
1837 
1838 #define _At_impl_(target, annos) _SA_annotes0(SAL_at(target)) _Group_(annos)
1839 #define _At_buffer_impl_(target, iter, bound, annos) _SA_annotes3(SAL_at_buffer, target, iter, bound) _Group_(annos)
1840 #define _Group_impl_(annos) _SA_annotes0(SAL_begin) annos _SA_annotes0(SAL_end)
1841 #define _GrouP_impl_(annos) _SA_annotes0(SAL_BEGIN) annos _SA_annotes0(SAL_END)
1842 #define _When_impl_(expr, annos) _SA_annotes0(SAL_when(expr)) _Group_(annos)
1843 
1844 #define _Use_decl_anno_impl_ __declspec("SAL_useHeader()") // this is a special case!
1845 
1846 #define _Pre1_impl_(p1) _Pre_impl_ p1
1847 #define _Pre2_impl_(p1,p2) _Pre_impl_ p1 _Pre_impl_ p2
1848 #define _Pre3_impl_(p1,p2,p3) _Pre_impl_ p1 _Pre_impl_ p2 _Pre_impl_ p3
1849 
1850 #define _Post1_impl_(p1) _Post_impl_ p1
1851 #define _Post2_impl_(p1,p2) _Post_impl_ p1 _Post_impl_ p2
1852 #define _Post3_impl_(p1,p2,p3) _Post_impl_ p1 _Post_impl_ p2 _Post_impl_ p3
1853 
1854 #define _Ret1_impl_(p1) _Post_impl_ p1
1855 #define _Ret2_impl_(p1,p2) _Post_impl_ p1 _Post_impl_ p2
1856 #define _Ret3_impl_(p1,p2,p3) _Post_impl_ p1 _Post_impl_ p2 _Post_impl_ p3
1857 
1858 #define _Deref_pre1_impl_(p1) _Deref_pre_impl_ p1
1859 #define _Deref_pre2_impl_(p1,p2) _Deref_pre_impl_ p1 _Deref_pre_impl_ p2
1860 #define _Deref_pre3_impl_(p1,p2,p3) _Deref_pre_impl_ p1 _Deref_pre_impl_ p2 _Deref_pre_impl_ p3
1861 
1862 #define _Deref_post1_impl_(p1) _Deref_post_impl_ p1
1863 #define _Deref_post2_impl_(p1,p2) _Deref_post_impl_ p1 _Deref_post_impl_ p2
1864 #define _Deref_post3_impl_(p1,p2,p3) _Deref_post_impl_ p1 _Deref_post_impl_ p2 _Deref_post_impl_ p3
1865 
1866 #define _Deref_ret1_impl_(p1) _Deref_post_impl_ p1
1867 #define _Deref_ret2_impl_(p1,p2) _Deref_post_impl_ p1 _Deref_post_impl_ p2
1868 #define _Deref_ret3_impl_(p1,p2,p3) _Deref_post_impl_ p1 _Deref_post_impl_ p2 _Deref_post_impl_ p3
1869 
1870 #define _Deref2_pre1_impl_(p1) _Deref_pre_impl_ _Notref_impl_ _Deref_impl_ p1
1871 #define _Deref2_post1_impl_(p1) _Deref_post_impl_ _Notref_impl_ _Deref_impl_ p1
1872 #define _Deref2_ret1_impl_(p1) _Deref_post_impl_ _Notref_impl_ _Deref_impl_ p1
1873 
1874 #define __inner_typefix(ctype) _SA_annotes1(SAL_typefix, ctype)
1875 #define __inner_exceptthat _SA_annotes0(SAL_except)
1876 
1877 #elif defined(_MSC_EXTENSIONS) && !defined( MIDL_PASS ) && !defined(__midl) && !defined(RC_INVOKED) && defined(_PFT_VER) // ][
1878 
1879 // minimum attribute expansion for foreground build
1880 
1881 #pragma push_macro( "SA" )
1882 #pragma push_macro( "REPEATABLE" )
1883 
1884 #ifdef __cplusplus // [
1885 #define SA( id ) id
1886 #define REPEATABLE [repeatable]
1887 #else // !__cplusplus // ][
1888 #define SA( id ) SA_##id
1889 #define REPEATABLE
1890 #endif // !__cplusplus // ]
1891 
1892 REPEATABLE
1893 [source_annotation_attribute( SA( Parameter ) )]
1894 struct __P_impl
1895 {
1896 #ifdef __cplusplus // [
1897  __P_impl();
1898 #endif // ]
1899  int __d_;
1900 };
1901 typedef struct __P_impl __P_impl;
1902 
1903 REPEATABLE
1904 [source_annotation_attribute( SA( ReturnValue ) )]
1905 struct __R_impl
1906 {
1907 #ifdef __cplusplus // [
1908  __R_impl();
1909 #endif // ]
1910  int __d_;
1911 };
1912 typedef struct __R_impl __R_impl;
1913 
1914 [source_annotation_attribute( SA( Method ) )]
1915 struct __M_
1916 {
1917 #ifdef __cplusplus // [
1918  __M_();
1919 #endif // ]
1920  int __d_;
1921 };
1922 typedef struct __M_ __M_;
1923 
1924 [source_annotation_attribute( SA( All ) )]
1925 struct __A_
1926 {
1927 #ifdef __cplusplus // [
1928  __A_();
1929 #endif // ]
1930  int __d_;
1931 };
1932 typedef struct __A_ __A_;
1933 
1934 [source_annotation_attribute( SA( Field ) )]
1935 struct __F_
1936 {
1937 #ifdef __cplusplus // [
1938  __F_();
1939 #endif // ]
1940  int __d_;
1941 };
1942 typedef struct __F_ __F_;
1943 
1944 #pragma pop_macro( "REPEATABLE" )
1945 #pragma pop_macro( "SA" )
1946 
1947 
1948 #define _SAL_nop_impl_
1949 
1950 #define _At_impl_(target, annos) [__A_(__d_=0)]
1951 #define _At_buffer_impl_(target, iter, bound, annos) [__A_(__d_=0)]
1952 #define _When_impl_(expr, annos) annos
1953 #define _Group_impl_(annos) annos
1954 #define _GrouP_impl_(annos) annos
1955 #define _Use_decl_anno_impl_ [__M_(__d_=0)]
1956 
1957 #define _Points_to_data_impl_ [__P_impl(__d_=0)]
1958 #define _Literal_impl_ [__P_impl(__d_=0)]
1959 #define _Notliteral_impl_ [__P_impl(__d_=0)]
1960 
1961 #define _Pre_valid_impl_ [__P_impl(__d_=0)]
1962 #define _Post_valid_impl_ [__P_impl(__d_=0)]
1963 #define _Ret_valid_impl_ [__R_impl(__d_=0)]
1964 
1965 #define _Check_return_impl_ [__R_impl(__d_=0)]
1966 #define _Must_inspect_impl_ [__R_impl(__d_=0)]
1967 
1968 #define _Success_impl_(expr) [__M_(__d_=0)]
1969 #define _On_failure_impl_(expr) [__M_(__d_=0)]
1970 #define _Always_impl_(expr) [__M_(__d_=0)]
1971 
1972 #define _Printf_format_string_impl_ [__P_impl(__d_=0)]
1973 #define _Scanf_format_string_impl_ [__P_impl(__d_=0)]
1974 #define _Scanf_s_format_string_impl_ [__P_impl(__d_=0)]
1975 
1976 #define _Raises_SEH_exception_impl_ [__M_(__d_=0)]
1977 #define _Maybe_raises_SEH_exception_impl_ [__M_(__d_=0)]
1978 
1979 #define _In_bound_impl_ [__P_impl(__d_=0)]
1980 #define _Out_bound_impl_ [__P_impl(__d_=0)]
1981 #define _Ret_bound_impl_ [__R_impl(__d_=0)]
1982 #define _Deref_in_bound_impl_ [__P_impl(__d_=0)]
1983 #define _Deref_out_bound_impl_ [__P_impl(__d_=0)]
1984 #define _Deref_ret_bound_impl_ [__R_impl(__d_=0)]
1985 
1986 #define _Range_impl_(min,max) [__P_impl(__d_=0)]
1987 #define _In_range_impl_(min,max) [__P_impl(__d_=0)]
1988 #define _Out_range_impl_(min,max) [__P_impl(__d_=0)]
1989 #define _Ret_range_impl_(min,max) [__R_impl(__d_=0)]
1990 #define _Deref_in_range_impl_(min,max) [__P_impl(__d_=0)]
1991 #define _Deref_out_range_impl_(min,max) [__P_impl(__d_=0)]
1992 #define _Deref_ret_range_impl_(min,max) [__R_impl(__d_=0)]
1993 
1994 #define _Field_range_impl_(min,max) [__F_(__d_=0)]
1995 
1996 #define _Pre_satisfies_impl_(cond) [__A_(__d_=0)]
1997 #define _Post_satisfies_impl_(cond) [__A_(__d_=0)]
1998 #define _Satisfies_impl_(cond) [__A_(__d_=0)]
1999 
2000 #define _Null_impl_ [__A_(__d_=0)]
2001 #define _Notnull_impl_ [__A_(__d_=0)]
2002 #define _Maybenull_impl_ [__A_(__d_=0)]
2003 
2004 #define _Valid_impl_ [__A_(__d_=0)]
2005 #define _Notvalid_impl_ [__A_(__d_=0)]
2006 #define _Maybevalid_impl_ [__A_(__d_=0)]
2007 
2008 #define _Readable_bytes_impl_(size) [__A_(__d_=0)]
2009 #define _Readable_elements_impl_(size) [__A_(__d_=0)]
2010 #define _Writable_bytes_impl_(size) [__A_(__d_=0)]
2011 #define _Writable_elements_impl_(size) [__A_(__d_=0)]
2012 
2013 #define _Null_terminated_impl_ [__A_(__d_=0)]
2014 #define _NullNull_terminated_impl_ [__A_(__d_=0)]
2015 
2016 #define _Pre_impl_ [__P_impl(__d_=0)]
2017 #define _Pre1_impl_(p1) [__P_impl(__d_=0)]
2018 #define _Pre2_impl_(p1,p2) [__P_impl(__d_=0)]
2019 #define _Pre3_impl_(p1,p2,p3) [__P_impl(__d_=0)]
2020 
2021 #define _Post_impl_ [__P_impl(__d_=0)]
2022 #define _Post1_impl_(p1) [__P_impl(__d_=0)]
2023 #define _Post2_impl_(p1,p2) [__P_impl(__d_=0)]
2024 #define _Post3_impl_(p1,p2,p3) [__P_impl(__d_=0)]
2025 
2026 #define _Ret1_impl_(p1) [__R_impl(__d_=0)]
2027 #define _Ret2_impl_(p1,p2) [__R_impl(__d_=0)]
2028 #define _Ret3_impl_(p1,p2,p3) [__R_impl(__d_=0)]
2029 
2030 #define _Deref_pre1_impl_(p1) [__P_impl(__d_=0)]
2031 #define _Deref_pre2_impl_(p1,p2) [__P_impl(__d_=0)]
2032 #define _Deref_pre3_impl_(p1,p2,p3) [__P_impl(__d_=0)]
2033 
2034 #define _Deref_post1_impl_(p1) [__P_impl(__d_=0)]
2035 #define _Deref_post2_impl_(p1,p2) [__P_impl(__d_=0)]
2036 #define _Deref_post3_impl_(p1,p2,p3) [__P_impl(__d_=0)]
2037 
2038 #define _Deref_ret1_impl_(p1) [__R_impl(__d_=0)]
2039 #define _Deref_ret2_impl_(p1,p2) [__R_impl(__d_=0)]
2040 #define _Deref_ret3_impl_(p1,p2,p3) [__R_impl(__d_=0)]
2041 
2042 #define _Deref2_pre1_impl_(p1) //[__P_impl(__d_=0)]
2043 #define _Deref2_post1_impl_(p1) //[__P_impl(__d_=0)]
2044 #define _Deref2_ret1_impl_(p1) //[__P_impl(__d_=0)]
2045 
2046 #else // ][
2047 
2048 
2049 #define _SAL_nop_impl_ X
2050 
2051 #define _At_impl_(target, annos)
2052 #define _When_impl_(expr, annos)
2053 #define _Group_impl_(annos)
2054 #define _GrouP_impl_(annos)
2055 #define _At_buffer_impl_(target, iter, bound, annos)
2056 #define _Use_decl_anno_impl_
2057 #define _Points_to_data_impl_
2058 #define _Literal_impl_
2059 #define _Notliteral_impl_
2060 #define _Notref_impl_
2061 
2062 #define _Pre_valid_impl_
2063 #define _Post_valid_impl_
2064 #define _Ret_valid_impl_
2065 
2066 #define _Check_return_impl_
2067 #define _Must_inspect_impl_
2068 
2069 #define _Success_impl_(expr)
2070 #define _On_failure_impl_(annos)
2071 #define _Always_impl_(annos)
2072 
2073 #define _Printf_format_string_impl_
2074 #define _Scanf_format_string_impl_
2075 #define _Scanf_s_format_string_impl_
2076 
2077 #define _In_bound_impl_
2078 #define _Out_bound_impl_
2079 #define _Ret_bound_impl_
2080 #define _Deref_in_bound_impl_
2081 #define _Deref_out_bound_impl_
2082 #define _Deref_ret_bound_impl_
2083 
2084 #define _Range_impl_(min,max)
2085 #define _In_range_impl_(min,max)
2086 #define _Out_range_impl_(min,max)
2087 #define _Ret_range_impl_(min,max)
2088 #define _Deref_in_range_impl_(min,max)
2089 #define _Deref_out_range_impl_(min,max)
2090 #define _Deref_ret_range_impl_(min,max)
2091 
2092 #define _Satisfies_impl_(expr)
2093 #define _Pre_satisfies_impl_(expr)
2094 #define _Post_satisfies_impl_(expr)
2095 
2096 #define _Null_impl_
2097 #define _Notnull_impl_
2098 #define _Maybenull_impl_
2099 
2100 #define _Valid_impl_
2101 #define _Notvalid_impl_
2102 #define _Maybevalid_impl_
2103 
2104 #define _Field_range_impl_(min,max)
2105 
2106 #define _Pre_impl_
2107 #define _Pre1_impl_(p1)
2108 #define _Pre2_impl_(p1,p2)
2109 #define _Pre3_impl_(p1,p2,p3)
2110 
2111 #define _Post_impl_
2112 #define _Post1_impl_(p1)
2113 #define _Post2_impl_(p1,p2)
2114 #define _Post3_impl_(p1,p2,p3)
2115 
2116 #define _Ret1_impl_(p1)
2117 #define _Ret2_impl_(p1,p2)
2118 #define _Ret3_impl_(p1,p2,p3)
2119 
2120 #define _Deref_pre1_impl_(p1)
2121 #define _Deref_pre2_impl_(p1,p2)
2122 #define _Deref_pre3_impl_(p1,p2,p3)
2123 
2124 #define _Deref_post1_impl_(p1)
2125 #define _Deref_post2_impl_(p1,p2)
2126 #define _Deref_post3_impl_(p1,p2,p3)
2127 
2128 #define _Deref_ret1_impl_(p1)
2129 #define _Deref_ret2_impl_(p1,p2)
2130 #define _Deref_ret3_impl_(p1,p2,p3)
2131 
2132 #define _Deref2_pre1_impl_(p1)
2133 #define _Deref2_post1_impl_(p1)
2134 #define _Deref2_ret1_impl_(p1)
2135 
2136 #define _Readable_bytes_impl_(size)
2137 #define _Readable_elements_impl_(size)
2138 #define _Writable_bytes_impl_(size)
2139 #define _Writable_elements_impl_(size)
2140 
2141 #define _Null_terminated_impl_
2142 #define _NullNull_terminated_impl_
2143 
2144 // Obsolete -- may be needed for transition to attributes.
2145 #define __inner_typefix(ctype)
2146 #define __inner_exceptthat
2147 
2148 #endif // ]
2149 
2150 // This section contains the deprecated annotations
2151 
2152 /*
2153  -------------------------------------------------------------------------------
2154  Introduction
2155 
2156  sal.h provides a set of annotations to describe how a function uses its
2157  parameters - the assumptions it makes about them, and the guarantees it makes
2158  upon finishing.
2159 
2160  Annotations may be placed before either a function parameter's type or its return
2161  type, and describe the function's behavior regarding the parameter or return value.
2162  There are two classes of annotations: buffer annotations and advanced annotations.
2163  Buffer annotations describe how functions use their pointer parameters, and
2164  advanced annotations either describe complex/unusual buffer behavior, or provide
2165  additional information about a parameter that is not otherwise expressible.
2166 
2167  -------------------------------------------------------------------------------
2168  Buffer Annotations
2169 
2170  The most important annotations in sal.h provide a consistent way to annotate
2171  buffer parameters or return values for a function. Each of these annotations describes
2172  a single buffer (which could be a string, a fixed-length or variable-length array,
2173  or just a pointer) that the function interacts with: where it is, how large it is,
2174  how much is initialized, and what the function does with it.
2175 
2176  The appropriate macro for a given buffer can be constructed using the table below.
2177  Just pick the appropriate values from each category, and combine them together
2178  with a leading underscore. Some combinations of values do not make sense as buffer
2179  annotations. Only meaningful annotations can be added to your code; for a list of
2180  these, see the buffer annotation definitions section.
2181 
2182  Only a single buffer annotation should be used for each parameter.
2183 
2184  |------------|------------|---------|--------|----------|----------|---------------|
2185  | Level | Usage | Size | Output | NullTerm | Optional | Parameters |
2186  |------------|------------|---------|--------|----------|----------|---------------|
2187  | <> | <> | <> | <> | _z | <> | <> |
2188  | _deref | _in | _ecount | _full | _nz | _opt | (size) |
2189  | _deref_opt | _out | _bcount | _part | | | (size,length) |
2190  | | _inout | | | | | |
2191  | | | | | | | |
2192  |------------|------------|---------|--------|----------|----------|---------------|
2193 
2194  Level: Describes the buffer pointer's level of indirection from the parameter or
2195  return value 'p'.
2196 
2197  <> : p is the buffer pointer.
2198  _deref : *p is the buffer pointer. p must not be NULL.
2199  _deref_opt : *p may be the buffer pointer. p may be NULL, in which case the rest of
2200  the annotation is ignored.
2201 
2202  Usage: Describes how the function uses the buffer.
2203 
2204  <> : The buffer is not accessed. If used on the return value or with _deref, the
2205  function will provide the buffer, and it will be uninitialized at exit.
2206  Otherwise, the caller must provide the buffer. This should only be used
2207  for alloc and free functions.
2208  _in : The function will only read from the buffer. The caller must provide the
2209  buffer and initialize it. Cannot be used with _deref.
2210  _out : The function will only write to the buffer. If used on the return value or
2211  with _deref, the function will provide the buffer and initialize it.
2212  Otherwise, the caller must provide the buffer, and the function will
2213  initialize it.
2214  _inout : The function may freely read from and write to the buffer. The caller must
2215  provide the buffer and initialize it. If used with _deref, the buffer may
2216  be reallocated by the function.
2217 
2218  Size: Describes the total size of the buffer. This may be less than the space actually
2219  allocated for the buffer, in which case it describes the accessible amount.
2220 
2221  <> : No buffer size is given. If the type specifies the buffer size (such as
2222  with LPSTR and LPWSTR), that amount is used. Otherwise, the buffer is one
2223  element long. Must be used with _in, _out, or _inout.
2224  _ecount : The buffer size is an explicit element count.
2225  _bcount : The buffer size is an explicit byte count.
2226 
2227  Output: Describes how much of the buffer will be initialized by the function. For
2228  _inout buffers, this also describes how much is initialized at entry. Omit this
2229  category for _in buffers; they must be fully initialized by the caller.
2230 
2231  <> : The type specifies how much is initialized. For instance, a function initializing
2232  an LPWSTR must NULL-terminate the string.
2233  _full : The function initializes the entire buffer.
2234  _part : The function initializes part of the buffer, and explicitly indicates how much.
2235 
2236  NullTerm: States if the present of a '\0' marks the end of valid elements in the buffer.
2237  _z : A '\0' indicated the end of the buffer
2238  _nz : The buffer may not be null terminated and a '\0' does not indicate the end of the
2239  buffer.
2240  Optional: Describes if the buffer itself is optional.
2241 
2242  <> : The pointer to the buffer must not be NULL.
2243  _opt : The pointer to the buffer might be NULL. It will be checked before being dereferenced.
2244 
2245  Parameters: Gives explicit counts for the size and length of the buffer.
2246 
2247  <> : There is no explicit count. Use when neither _ecount nor _bcount is used.
2248  (size) : Only the buffer's total size is given. Use with _ecount or _bcount but not _part.
2249  (size,length) : The buffer's total size and initialized length are given. Use with _ecount_part
2250  and _bcount_part.
2251 
2252  -------------------------------------------------------------------------------
2253  Buffer Annotation Examples
2254 
2255  LWSTDAPI_(BOOL) StrToIntExA(
2256  __in LPCSTR pszString,
2257  DWORD dwFlags,
2258  __out int *piRet -- A pointer whose dereference will be filled in.
2259  );
2260 
2261  void MyPaintingFunction(
2262  __in HWND hwndControl, -- An initialized read-only parameter.
2263  __in_opt HDC hdcOptional, -- An initialized read-only parameter that might be NULL.
2264  __inout IPropertyStore *ppsStore -- An initialized parameter that may be freely used
2265  -- and modified.
2266  );
2267 
2268  LWSTDAPI_(BOOL) PathCompactPathExA(
2269  __out_ecount(cchMax) LPSTR pszOut, -- A string buffer with cch elements that will
2270  -- be NULL terminated on exit.
2271  __in LPCSTR pszSrc,
2272  UINT cchMax,
2273  DWORD dwFlags
2274  );
2275 
2276  HRESULT SHLocalAllocBytes(
2277  size_t cb,
2278  __deref_bcount(cb) T **ppv -- A pointer whose dereference will be set to an
2279  -- uninitialized buffer with cb bytes.
2280  );
2281 
2282  __inout_bcount_full(cb) : A buffer with cb elements that is fully initialized at
2283  entry and exit, and may be written to by this function.
2284 
2285  __out_ecount_part(count, *countOut) : A buffer with count elements that will be
2286  partially initialized by this function. The function indicates how much it
2287  initialized by setting *countOut.
2288 
2289  -------------------------------------------------------------------------------
2290  Advanced Annotations
2291 
2292  Advanced annotations describe behavior that is not expressible with the regular
2293  buffer macros. These may be used either to annotate buffer parameters that involve
2294  complex or conditional behavior, or to enrich existing annotations with additional
2295  information.
2296 
2297  __success(expr) f :
2298  <expr> indicates whether function f succeeded or not. If <expr> is true at exit,
2299  all the function's guarantees (as given by other annotations) must hold. If <expr>
2300  is false at exit, the caller should not expect any of the function's guarantees
2301  to hold. If not used, the function must always satisfy its guarantees. Added
2302  automatically to functions that indicate success in standard ways, such as by
2303  returning an HRESULT.
2304 
2305  __nullterminated p :
2306  Pointer p is a buffer that may be read or written up to and including the first
2307  NULL character or pointer. May be used on typedefs, which marks valid (properly
2308  initialized) instances of that type as being NULL-terminated.
2309 
2310  __nullnullterminated p :
2311  Pointer p is a buffer that may be read or written up to and including the first
2312  sequence of two NULL characters or pointers. May be used on typedefs, which marks
2313  valid instances of that type as being double-NULL terminated.
2314 
2315  __reserved v :
2316  Value v must be 0/NULL, reserved for future use.
2317 
2318  __checkReturn v :
2319  Return value v must not be ignored by callers of this function.
2320 
2321  __typefix(ctype) v :
2322  Value v should be treated as an instance of ctype, rather than its declared type.
2323 
2324  __override f :
2325  Specify C#-style 'override' behaviour for overriding virtual methods.
2326 
2327  __callback f :
2328  Function f can be used as a function pointer.
2329 
2330  __format_string p :
2331  Pointer p is a string that contains % markers in the style of printf.
2332 
2333  __blocksOn(resource) f :
2334  Function f blocks on the resource 'resource'.
2335 
2336  __fallthrough :
2337  Annotates switch statement labels where fall-through is desired, to distinguish
2338  from forgotten break statements.
2339 
2340  -------------------------------------------------------------------------------
2341  Advanced Annotation Examples
2342 
2343  __success(return != FALSE) LWSTDAPI_(BOOL)
2344  PathCanonicalizeA(__out_ecount(MAX_PATH) LPSTR pszBuf, LPCSTR pszPath) :
2345  pszBuf is only guaranteed to be NULL-terminated when TRUE is returned.
2346 
2347  typedef __nullterminated WCHAR* LPWSTR : Initialized LPWSTRs are NULL-terminated strings.
2348 
2349  __out_ecount(cch) __typefix(LPWSTR) void *psz : psz is a buffer parameter which will be
2350  a NULL-terminated WCHAR string at exit, and which initially contains cch WCHARs.
2351 
2352  -------------------------------------------------------------------------------
2353 */
2354 
2355 #define __specstrings
2356 
2357 #ifdef __cplusplus // [
2358 #ifndef __nothrow // [
2359 # define __nothrow __declspec(nothrow)
2360 #endif // ]
2361 extern "C" {
2362 #else // ][
2363 #ifndef __nothrow // [
2364 # define __nothrow
2365 #endif // ]
2366 #endif /* __cplusplus */ // ]
2367 
2368 
2369 /*
2370  -------------------------------------------------------------------------------
2371  Helper Macro Definitions
2372 
2373  These express behavior common to many of the high-level annotations.
2374  DO NOT USE THESE IN YOUR CODE.
2375  -------------------------------------------------------------------------------
2376 */
2377 
2378 /*
2379  The helper annotations are only understood by the compiler version used by
2380  various defect detection tools. When the regular compiler is running, they
2381  are defined into nothing, and do not affect the compiled code.
2382 */
2383 
2384 #if !defined(__midl) && defined(_PREFAST_) // [
2385 
2386  /*
2387  In the primitive "SAL_*" annotations "SAL" stands for Standard
2388  Annotation Language. These "SAL_*" annotations are the
2389  primitives the compiler understands and high-level MACROs
2390  will decompose into these primivates.
2391  */
2392 
2393  #define _SA_SPECSTRIZE( x ) #x
2394 
2395  /*
2396  __null p
2397  __notnull p
2398  __maybenull p
2399 
2400  Annotates a pointer p. States that pointer p is null. Commonly used
2401  in the negated form __notnull or the possibly null form __maybenull.
2402  */
2403 
2404  #define __null _Null_impl_
2405  #define __notnull _Notnull_impl_
2406  #define __maybenull _Maybenull_impl_
2407 
2408  /*
2409  __readonly l
2410  __notreadonly l
2411  __mabyereadonly l
2412 
2413  Annotates a location l. States that location l is not modified after
2414  this point. If the annotation is placed on the precondition state of
2415  a function, the restriction only applies until the postcondition state
2416  of the function. __maybereadonly states that the annotated location
2417  may be modified, whereas __notreadonly states that a location must be
2418  modified.
2419  */
2420 
2421  #define __readonly _Pre1_impl_(__readaccess_impl)
2422  #define __notreadonly _Pre1_impl_(__allaccess_impl)
2423  #define __maybereadonly _Pre1_impl_(__readaccess_impl)
2424 
2425  /*
2426  __valid v
2427  __notvalid v
2428  __maybevalid v
2429 
2430  Annotates any value v. States that the value satisfies all properties of
2431  valid values of its type. For example, for a string buffer, valid means
2432  that the buffer pointer is either NULL or points to a NULL-terminated string.
2433  */
2434 
2435  #define __valid _Valid_impl_
2436  #define __notvalid _Notvalid_impl_
2437  #define __maybevalid _Maybevalid_impl_
2438 
2439  /*
2440  __readableTo(extent) p
2441 
2442  Annotates a buffer pointer p. If the buffer can be read, extent describes
2443  how much of the buffer is readable. For a reader of the buffer, this is
2444  an explicit permission to read up to that amount, rather than a restriction to
2445  read only up to it.
2446  */
2447 
2448  #define __readableTo(extent) _SA_annotes1(SAL_readableTo, extent)
2449 
2450  /*
2451 
2452  __elem_readableTo(size)
2453 
2454  Annotates a buffer pointer p as being readable to size elements.
2455  */
2456 
2457  #define __elem_readableTo(size) _SA_annotes1(SAL_readableTo, elementCount( size ))
2458 
2459  /*
2460  __byte_readableTo(size)
2461 
2462  Annotates a buffer pointer p as being readable to size bytes.
2463  */
2464  #define __byte_readableTo(size) _SA_annotes1(SAL_readableTo, byteCount(size))
2465 
2466  /*
2467  __writableTo(extent) p
2468 
2469  Annotates a buffer pointer p. If the buffer can be modified, extent
2470  describes how much of the buffer is writable (usually the allocation
2471  size). For a writer of the buffer, this is an explicit permission to
2472  write up to that amount, rather than a restriction to write only up to it.
2473  */
2474  #define __writableTo(size) _SA_annotes1(SAL_writableTo, size)
2475 
2476  /*
2477  __elem_writableTo(size)
2478 
2479  Annotates a buffer pointer p as being writable to size elements.
2480  */
2481  #define __elem_writableTo(size) _SA_annotes1(SAL_writableTo, elementCount( size ))
2482 
2483  /*
2484  __byte_writableTo(size)
2485 
2486  Annotates a buffer pointer p as being writable to size bytes.
2487  */
2488  #define __byte_writableTo(size) _SA_annotes1(SAL_writableTo, byteCount( size))
2489 
2490  /*
2491  __deref p
2492 
2493  Annotates a pointer p. The next annotation applies one dereference down
2494  in the type. If readableTo(p, size) then the next annotation applies to
2495  all elements *(p+i) for which i satisfies the size. If p is a pointer
2496  to a struct, the next annotation applies to all fields of the struct.
2497  */
2498  #define __deref _Deref_impl_
2499 
2500  /*
2501  __pre __next_annotation
2502 
2503  The next annotation applies in the precondition state
2504  */
2505  #define __pre _Pre_impl_
2506 
2507  /*
2508  __post __next_annotation
2509 
2510  The next annotation applies in the postcondition state
2511  */
2512  #define __post _Post_impl_
2513 
2514  /*
2515  __precond(<expr>)
2516 
2517  When <expr> is true, the next annotation applies in the precondition state
2518  (currently not enabled)
2519  */
2520  #define __precond(expr) __pre
2521 
2522  /*
2523  __postcond(<expr>)
2524 
2525  When <expr> is true, the next annotation applies in the postcondition state
2526  (currently not enabled)
2527  */
2528  #define __postcond(expr) __post
2529 
2530  /*
2531  __exceptthat
2532 
2533  Given a set of annotations Q containing __exceptthat maybeP, the effect of
2534  the except clause is to erase any P or notP annotations (explicit or
2535  implied) within Q at the same level of dereferencing that the except
2536  clause appears, and to replace it with maybeP.
2537 
2538  Example 1: __valid __pre_except_maybenull on a pointer p means that the
2539  pointer may be null, and is otherwise valid, thus overriding
2540  the implicit notnull annotation implied by __valid on
2541  pointers.
2542 
2543  Example 2: __valid __deref __pre_except_maybenull on an int **p means
2544  that p is not null (implied by valid), but the elements
2545  pointed to by p could be null, and are otherwise valid.
2546  */
2547  #define __exceptthat __inner_exceptthat
2548 
2549  /*
2550  _refparam
2551 
2552  Added to all out parameter macros to indicate that they are all reference
2553  parameters.
2554  */
2555  #define __refparam _Notref_ __deref __notreadonly
2556 
2557  /*
2558  __inner_*
2559 
2560  Helper macros that directly correspond to certain high-level annotations.
2561 
2562  */
2563 
2564  /*
2565  Macros to classify the entrypoints and indicate their category.
2566 
2567  Pre-defined control point categories include: RPC, LPC, DeviceDriver, UserToKernel, ISAPI, COM.
2568 
2569  */
2570  #define __inner_control_entrypoint(category) _SA_annotes2(SAL_entrypoint, controlEntry, category)
2571 
2572 
2573  /*
2574  Pre-defined data entry point categories include: Registry, File, Network.
2575  */
2576  #define __inner_data_entrypoint(category) _SA_annotes2(SAL_entrypoint, dataEntry, category)
2577 
2578  #define __inner_override _SA_annotes0(__override)
2579  #define __inner_callback _SA_annotes0(__callback)
2580  #define __inner_blocksOn(resource) _SA_annotes1(SAL_blocksOn, resource)
2581  #define __inner_fallthrough_dec __inline __nothrow void __FallThrough() {}
2582  #define __inner_fallthrough __FallThrough();
2583 
2584  #define __post_except_maybenull __post __inner_exceptthat _Maybenull_impl_
2585  #define __pre_except_maybenull __pre __inner_exceptthat _Maybenull_impl_
2586 
2587  #define __post_deref_except_maybenull __post __deref __inner_exceptthat _Maybenull_impl_
2588  #define __pre_deref_except_maybenull __pre __deref __inner_exceptthat _Maybenull_impl_
2589 
2590  #define __inexpressible_readableTo(size) _Readable_elements_impl_(_Inexpressible_(size))
2591  #define __inexpressible_writableTo(size) _Writable_elements_impl_(_Inexpressible_(size))
2592 
2593 
2594 #else // ][
2595  #define __null
2596  #define __notnull
2597  #define __maybenull
2598  #define __readonly
2599  #define __notreadonly
2600  #define __maybereadonly
2601  #define __valid
2602  #define __notvalid
2603  #define __maybevalid
2604  #define __readableTo(extent)
2605  #define __elem_readableTo(size)
2606  #define __byte_readableTo(size)
2607  #define __writableTo(size)
2608  #define __elem_writableTo(size)
2609  #define __byte_writableTo(size)
2610  #define __deref
2611  #define __pre
2612  #define __post
2613  #define __precond(expr)
2614  #define __postcond(expr)
2615  #define __exceptthat
2616  #define __inner_override
2617  #define __inner_callback
2618  #define __inner_blocksOn(resource)
2619  #define __inner_fallthrough_dec
2620  #define __inner_fallthrough
2621  #define __refparam
2622  #define __inner_control_entrypoint(category)
2623  #define __inner_data_entrypoint(category)
2624 
2625  #define __post_except_maybenull
2626  #define __pre_except_maybenull
2627  #define __post_deref_except_maybenull
2628  #define __pre_deref_except_maybenull
2629 
2630  #define __inexpressible_readableTo(size)
2631  #define __inexpressible_writableTo(size)
2632 
2633 #endif /* !defined(__midl) && defined(_PREFAST_) */ // ]
2634 
2635 /*
2636 -------------------------------------------------------------------------------
2637 Buffer Annotation Definitions
2638 
2639 Any of these may be used to directly annotate functions, but only one should
2640 be used for each parameter. To determine which annotation to use for a given
2641 buffer, use the table in the buffer annotations section.
2642 -------------------------------------------------------------------------------
2643 */
2644 
2645 #define __ecount(size) _SAL1_Source_(__ecount, (size), __notnull __elem_writableTo(size))
2646 #define __bcount(size) _SAL1_Source_(__bcount, (size), __notnull __byte_writableTo(size))
2647 #define __in _SAL1_Source_(__in, (), _In_)
2648 #define __in_ecount(size) _SAL1_Source_(__in_ecount, (size), _In_reads_(size))
2649 #define __in_bcount(size) _SAL1_Source_(__in_bcount, (size), _In_reads_bytes_(size))
2650 #define __in_z _SAL1_Source_(__in_z, (), _In_z_)
2651 #define __in_ecount_z(size) _SAL1_Source_(__in_ecount_z, (size), _In_reads_z_(size))
2652 #define __in_bcount_z(size) _SAL1_Source_(__in_bcount_z, (size), __in_bcount(size) __pre __nullterminated)
2653 #define __in_nz _SAL1_Source_(__in_nz, (), __in)
2654 #define __in_ecount_nz(size) _SAL1_Source_(__in_ecount_nz, (size), __in_ecount(size))
2655 #define __in_bcount_nz(size) _SAL1_Source_(__in_bcount_nz, (size), __in_bcount(size))
2656 #define __out _SAL1_Source_(__out, (), _Out_)
2657 #define __out_ecount(size) _SAL1_Source_(__out_ecount, (size), _Out_writes_(size))
2658 #define __out_bcount(size) _SAL1_Source_(__out_bcount, (size), _Out_writes_bytes_(size))
2659 #define __out_ecount_part(size,length) _SAL1_Source_(__out_ecount_part, (size,length), _Out_writes_to_(size,length))
2660 #define __out_bcount_part(size,length) _SAL1_Source_(__out_bcount_part, (size,length), _Out_writes_bytes_to_(size,length))
2661 #define __out_ecount_full(size) _SAL1_Source_(__out_ecount_full, (size), _Out_writes_all_(size))
2662 #define __out_bcount_full(size) _SAL1_Source_(__out_bcount_full, (size), _Out_writes_bytes_all_(size))
2663 #define __out_z _SAL1_Source_(__out_z, (), __post __valid __refparam __post __nullterminated)
2664 #define __out_z_opt _SAL1_Source_(__out_z_opt, (), __post __valid __refparam __post __nullterminated __pre_except_maybenull)
2665 #define __out_ecount_z(size) _SAL1_Source_(__out_ecount_z, (size), __ecount(size) __post __valid __refparam __post __nullterminated)
2666 #define __out_bcount_z(size) _SAL1_Source_(__out_bcount_z, (size), __bcount(size) __post __valid __refparam __post __nullterminated)
2667 #define __out_ecount_part_z(size,length) _SAL1_Source_(__out_ecount_part_z, (size,length), __out_ecount_part(size,length) __post __nullterminated)
2668 #define __out_bcount_part_z(size,length) _SAL1_Source_(__out_bcount_part_z, (size,length), __out_bcount_part(size,length) __post __nullterminated)
2669 #define __out_ecount_full_z(size) _SAL1_Source_(__out_ecount_full_z, (size), __out_ecount_full(size) __post __nullterminated)
2670 #define __out_bcount_full_z(size) _SAL1_Source_(__out_bcount_full_z, (size), __out_bcount_full(size) __post __nullterminated)
2671 #define __out_nz _SAL1_Source_(__out_nz, (), __post __valid __refparam)
2672 #define __out_nz_opt _SAL1_Source_(__out_nz_opt, (), __post __valid __refparam __post_except_maybenull_)
2673 #define __out_ecount_nz(size) _SAL1_Source_(__out_ecount_nz, (size), __ecount(size) __post __valid __refparam)
2674 #define __out_bcount_nz(size) _SAL1_Source_(__out_bcount_nz, (size), __bcount(size) __post __valid __refparam)
2675 #define __inout _SAL1_Source_(__inout, (), _Inout_)
2676 #define __inout_ecount(size) _SAL1_Source_(__inout_ecount, (size), _Inout_updates_(size))
2677 #define __inout_bcount(size) _SAL1_Source_(__inout_bcount, (size), _Inout_updates_bytes_(size))
2678 #define __inout_ecount_part(size,length) _SAL1_Source_(__inout_ecount_part, (size,length), _Inout_updates_to_(size,length))
2679 #define __inout_bcount_part(size,length) _SAL1_Source_(__inout_bcount_part, (size,length), _Inout_updates_bytes_to_(size,length))
2680 #define __inout_ecount_full(size) _SAL1_Source_(__inout_ecount_full, (size), _Inout_updates_all_(size))
2681 #define __inout_bcount_full(size) _SAL1_Source_(__inout_bcount_full, (size), _Inout_updates_bytes_all_(size))
2682 #define __inout_z _SAL1_Source_(__inout_z, (), _Inout_z_)
2683 #define __inout_ecount_z(size) _SAL1_Source_(__inout_ecount_z, (size), _Inout_updates_z_(size))
2684 #define __inout_bcount_z(size) _SAL1_Source_(__inout_bcount_z, (size), __inout_bcount(size) __pre __nullterminated __post __nullterminated)
2685 #define __inout_nz _SAL1_Source_(__inout_nz, (), __inout)
2686 #define __inout_ecount_nz(size) _SAL1_Source_(__inout_ecount_nz, (size), __inout_ecount(size))
2687 #define __inout_bcount_nz(size) _SAL1_Source_(__inout_bcount_nz, (size), __inout_bcount(size))
2688 #define __ecount_opt(size) _SAL1_Source_(__ecount_opt, (size), __ecount(size) __pre_except_maybenull)
2689 #define __bcount_opt(size) _SAL1_Source_(__bcount_opt, (size), __bcount(size) __pre_except_maybenull)
2690 #define __in_opt _SAL1_Source_(__in_opt, (), _In_opt_)
2691 #define __in_ecount_opt(size) _SAL1_Source_(__in_ecount_opt, (size), _In_reads_opt_(size))
2692 #define __in_bcount_opt(size) _SAL1_Source_(__in_bcount_opt, (size), _In_reads_bytes_opt_(size))
2693 #define __in_z_opt _SAL1_Source_(__in_z_opt, (), _In_opt_z_)
2694 #define __in_ecount_z_opt(size) _SAL1_Source_(__in_ecount_z_opt, (size), __in_ecount_opt(size) __pre __nullterminated)
2695 #define __in_bcount_z_opt(size) _SAL1_Source_(__in_bcount_z_opt, (size), __in_bcount_opt(size) __pre __nullterminated)
2696 #define __in_nz_opt _SAL1_Source_(__in_nz_opt, (), __in_opt)
2697 #define __in_ecount_nz_opt(size) _SAL1_Source_(__in_ecount_nz_opt, (size), __in_ecount_opt(size))
2698 #define __in_bcount_nz_opt(size) _SAL1_Source_(__in_bcount_nz_opt, (size), __in_bcount_opt(size))
2699 #define __out_opt _SAL1_Source_(__out_opt, (), _Out_opt_)
2700 #define __out_ecount_opt(size) _SAL1_Source_(__out_ecount_opt, (size), _Out_writes_opt_(size))
2701 #define __out_bcount_opt(size) _SAL1_Source_(__out_bcount_opt, (size), _Out_writes_bytes_opt_(size))
2702 #define __out_ecount_part_opt(size,length) _SAL1_Source_(__out_ecount_part_opt, (size,length), __out_ecount_part(size,length) __pre_except_maybenull)
2703 #define __out_bcount_part_opt(size,length) _SAL1_Source_(__out_bcount_part_opt, (size,length), __out_bcount_part(size,length) __pre_except_maybenull)
2704 #define __out_ecount_full_opt(size) _SAL1_Source_(__out_ecount_full_opt, (size), __out_ecount_full(size) __pre_except_maybenull)
2705 #define __out_bcount_full_opt(size) _SAL1_Source_(__out_bcount_full_opt, (size), __out_bcount_full(size) __pre_except_maybenull)
2706 #define __out_ecount_z_opt(size) _SAL1_Source_(__out_ecount_z_opt, (size), __out_ecount_opt(size) __post __nullterminated)
2707 #define __out_bcount_z_opt(size) _SAL1_Source_(__out_bcount_z_opt, (size), __out_bcount_opt(size) __post __nullterminated)
2708 #define __out_ecount_part_z_opt(size,length) _SAL1_Source_(__out_ecount_part_z_opt, (size,length), __out_ecount_part_opt(size,length) __post __nullterminated)
2709 #define __out_bcount_part_z_opt(size,length) _SAL1_Source_(__out_bcount_part_z_opt, (size,length), __out_bcount_part_opt(size,length) __post __nullterminated)
2710 #define __out_ecount_full_z_opt(size) _SAL1_Source_(__out_ecount_full_z_opt, (size), __out_ecount_full_opt(size) __post __nullterminated)
2711 #define __out_bcount_full_z_opt(size) _SAL1_Source_(__out_bcount_full_z_opt, (size), __out_bcount_full_opt(size) __post __nullterminated)
2712 #define __out_ecount_nz_opt(size) _SAL1_Source_(__out_ecount_nz_opt, (size), __out_ecount_opt(size) __post __nullterminated)
2713 #define __out_bcount_nz_opt(size) _SAL1_Source_(__out_bcount_nz_opt, (size), __out_bcount_opt(size) __post __nullterminated)
2714 #define __inout_opt _SAL1_Source_(__inout_opt, (), _Inout_opt_)
2715 #define __inout_ecount_opt(size) _SAL1_Source_(__inout_ecount_opt, (size), __inout_ecount(size) __pre_except_maybenull)
2716 #define __inout_bcount_opt(size) _SAL1_Source_(__inout_bcount_opt, (size), __inout_bcount(size) __pre_except_maybenull)
2717 #define __inout_ecount_part_opt(size,length) _SAL1_Source_(__inout_ecount_part_opt, (size,length), __inout_ecount_part(size,length) __pre_except_maybenull)
2718 #define __inout_bcount_part_opt(size,length) _SAL1_Source_(__inout_bcount_part_opt, (size,length), __inout_bcount_part(size,length) __pre_except_maybenull)
2719 #define __inout_ecount_full_opt(size) _SAL1_Source_(__inout_ecount_full_opt, (size), __inout_ecount_full(size) __pre_except_maybenull)
2720 #define __inout_bcount_full_opt(size) _SAL1_Source_(__inout_bcount_full_opt, (size), __inout_bcount_full(size) __pre_except_maybenull)
2721 #define __inout_z_opt _SAL1_Source_(__inout_z_opt, (), __inout_opt __pre __nullterminated __post __nullterminated)
2722 #define __inout_ecount_z_opt(size) _SAL1_Source_(__inout_ecount_z_opt, (size), __inout_ecount_opt(size) __pre __nullterminated __post __nullterminated)
2723 #define __inout_ecount_z_opt(size) _SAL1_Source_(__inout_ecount_z_opt, (size), __inout_ecount_opt(size) __pre __nullterminated __post __nullterminated)
2724 #define __inout_bcount_z_opt(size) _SAL1_Source_(__inout_bcount_z_opt, (size), __inout_bcount_opt(size))
2725 #define __inout_nz_opt _SAL1_Source_(__inout_nz_opt, (), __inout_opt)
2726 #define __inout_ecount_nz_opt(size) _SAL1_Source_(__inout_ecount_nz_opt, (size), __inout_ecount_opt(size))
2727 #define __inout_bcount_nz_opt(size) _SAL1_Source_(__inout_bcount_nz_opt, (size), __inout_bcount_opt(size))
2728 #define __deref_ecount(size) _SAL1_Source_(__deref_ecount, (size), _Notref_ __ecount(1) __post _Notref_ __elem_readableTo(1) __post _Notref_ __deref _Notref_ __notnull __post __deref __elem_writableTo(size))
2729 #define __deref_bcount(size) _SAL1_Source_(__deref_bcount, (size), _Notref_ __ecount(1) __post _Notref_ __elem_readableTo(1) __post _Notref_ __deref _Notref_ __notnull __post __deref __byte_writableTo(size))
2730 #define __deref_out _SAL1_Source_(__deref_out, (), _Outptr_)
2731 #define __deref_out_ecount(size) _SAL1_Source_(__deref_out_ecount, (size), _Outptr_result_buffer_(size))
2732 #define __deref_out_bcount(size) _SAL1_Source_(__deref_out_bcount, (size), _Outptr_result_bytebuffer_(size))
2733 #define __deref_out_ecount_part(size,length) _SAL1_Source_(__deref_out_ecount_part, (size,length), _Outptr_result_buffer_to_(size,length))
2734 #define __deref_out_bcount_part(size,length) _SAL1_Source_(__deref_out_bcount_part, (size,length), _Outptr_result_bytebuffer_to_(size,length))
2735 #define __deref_out_ecount_full(size) _SAL1_Source_(__deref_out_ecount_full, (size), __deref_out_ecount_part(size,size))
2736 #define __deref_out_bcount_full(size) _SAL1_Source_(__deref_out_bcount_full, (size), __deref_out_bcount_part(size,size))
2737 #define __deref_out_z _SAL1_Source_(__deref_out_z, (), _Outptr_result_z_)
2738 #define __deref_out_ecount_z(size) _SAL1_Source_(__deref_out_ecount_z, (size), __deref_out_ecount(size) __post __deref __nullterminated)
2739 #define __deref_out_bcount_z(size) _SAL1_Source_(__deref_out_bcount_z, (size), __deref_out_bcount(size) __post __deref __nullterminated)
2740 #define __deref_out_nz _SAL1_Source_(__deref_out_nz, (), __deref_out)
2741 #define __deref_out_ecount_nz(size) _SAL1_Source_(__deref_out_ecount_nz, (size), __deref_out_ecount(size))
2742 #define __deref_out_bcount_nz(size) _SAL1_Source_(__deref_out_bcount_nz, (size), __deref_out_ecount(size))
2743 #define __deref_inout _SAL1_Source_(__deref_inout, (), _Notref_ __notnull _Notref_ __elem_readableTo(1) __pre __deref __valid __post _Notref_ __deref __valid __refparam)
2744 #define __deref_inout_z _SAL1_Source_(__deref_inout_z, (), __deref_inout __pre __deref __nullterminated __post _Notref_ __deref __nullterminated)
2745 #define __deref_inout_ecount(size) _SAL1_Source_(__deref_inout_ecount, (size), __deref_inout __pre __deref __elem_writableTo(size) __post _Notref_ __deref __elem_writableTo(size))
2746 #define __deref_inout_bcount(size) _SAL1_Source_(__deref_inout_bcount, (size), __deref_inout __pre __deref __byte_writableTo(size) __post _Notref_ __deref __byte_writableTo(size))
2747 #define __deref_inout_ecount_part(size,length) _SAL1_Source_(__deref_inout_ecount_part, (size,length), __deref_inout_ecount(size) __pre __deref __elem_readableTo(length) __post __deref __elem_readableTo(length))
2748 #define __deref_inout_bcount_part(size,length) _SAL1_Source_(__deref_inout_bcount_part, (size,length), __deref_inout_bcount(size) __pre __deref __byte_readableTo(length) __post __deref __byte_readableTo(length))
2749 #define __deref_inout_ecount_full(size) _SAL1_Source_(__deref_inout_ecount_full, (size), __deref_inout_ecount_part(size,size))
2750 #define __deref_inout_bcount_full(size) _SAL1_Source_(__deref_inout_bcount_full, (size), __deref_inout_bcount_part(size,size))
2751 #define __deref_inout_ecount_z(size) _SAL1_Source_(__deref_inout_ecount_z, (size), __deref_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated)
2752 #define __deref_inout_bcount_z(size) _SAL1_Source_(__deref_inout_bcount_z, (size), __deref_inout_bcount(size) __pre __deref __nullterminated __post __deref __nullterminated)
2753 #define __deref_inout_nz _SAL1_Source_(__deref_inout_nz, (), __deref_inout)
2754 #define __deref_inout_ecount_nz(size) _SAL1_Source_(__deref_inout_ecount_nz, (size), __deref_inout_ecount(size))
2755 #define __deref_inout_bcount_nz(size) _SAL1_Source_(__deref_inout_bcount_nz, (size), __deref_inout_ecount(size))
2756 #define __deref_ecount_opt(size) _SAL1_Source_(__deref_ecount_opt, (size), __deref_ecount(size) __post_deref_except_maybenull)
2757 #define __deref_bcount_opt(size) _SAL1_Source_(__deref_bcount_opt, (size), __deref_bcount(size) __post_deref_except_maybenull)
2758 #define __deref_out_opt _SAL1_Source_(__deref_out_opt, (), __deref_out __post_deref_except_maybenull)
2759 #define __deref_out_ecount_opt(size) _SAL1_Source_(__deref_out_ecount_opt, (size), __deref_out_ecount(size) __post_deref_except_maybenull)
2760 #define __deref_out_bcount_opt(size) _SAL1_Source_(__deref_out_bcount_opt, (size), __deref_out_bcount(size) __post_deref_except_maybenull)
2761 #define __deref_out_ecount_part_opt(size,length) _SAL1_Source_(__deref_out_ecount_part_opt, (size,length), __deref_out_ecount_part(size,length) __post_deref_except_maybenull)
2762 #define __deref_out_bcount_part_opt(size,length) _SAL1_Source_(__deref_out_bcount_part_opt, (size,length), __deref_out_bcount_part(size,length) __post_deref_except_maybenull)
2763 #define __deref_out_ecount_full_opt(size) _SAL1_Source_(__deref_out_ecount_full_opt, (size), __deref_out_ecount_full(size) __post_deref_except_maybenull)
2764 #define __deref_out_bcount_full_opt(size) _SAL1_Source_(__deref_out_bcount_full_opt, (size), __deref_out_bcount_full(size) __post_deref_except_maybenull)
2765 #define __deref_out_z_opt _SAL1_Source_(__deref_out_z_opt, (), _Outptr_result_maybenull_z_)
2766 #define __deref_out_ecount_z_opt(size) _SAL1_Source_(__deref_out_ecount_z_opt, (size), __deref_out_ecount_opt(size) __post __deref __nullterminated)
2767 #define __deref_out_bcount_z_opt(size) _SAL1_Source_(__deref_out_bcount_z_opt, (size), __deref_out_bcount_opt(size) __post __deref __nullterminated)
2768 #define __deref_out_nz_opt _SAL1_Source_(__deref_out_nz_opt, (), __deref_out_opt)
2769 #define __deref_out_ecount_nz_opt(size) _SAL1_Source_(__deref_out_ecount_nz_opt, (size), __deref_out_ecount_opt(size))
2770 #define __deref_out_bcount_nz_opt(size) _SAL1_Source_(__deref_out_bcount_nz_opt, (size), __deref_out_bcount_opt(size))
2771 #define __deref_inout_opt _SAL1_Source_(__deref_inout_opt, (), __deref_inout __pre_deref_except_maybenull __post_deref_except_maybenull)
2772 #define __deref_inout_ecount_opt(size) _SAL1_Source_(__deref_inout_ecount_opt, (size), __deref_inout_ecount(size) __pre_deref_except_maybenull __post_deref_except_maybenull)
2773 #define __deref_inout_bcount_opt(size) _SAL1_Source_(__deref_inout_bcount_opt, (size), __deref_inout_bcount(size) __pre_deref_except_maybenull __post_deref_except_maybenull)
2774 #define __deref_inout_ecount_part_opt(size,length) _SAL1_Source_(__deref_inout_ecount_part_opt, (size,length), __deref_inout_ecount_part(size,length) __pre_deref_except_maybenull __post_deref_except_maybenull)
2775 #define __deref_inout_bcount_part_opt(size,length) _SAL1_Source_(__deref_inout_bcount_part_opt, (size,length), __deref_inout_bcount_part(size,length) __pre_deref_except_maybenull __post_deref_except_maybenull)
2776 #define __deref_inout_ecount_full_opt(size) _SAL1_Source_(__deref_inout_ecount_full_opt, (size), __deref_inout_ecount_full(size) __pre_deref_except_maybenull __post_deref_except_maybenull)
2777 #define __deref_inout_bcount_full_opt(size) _SAL1_Source_(__deref_inout_bcount_full_opt, (size), __deref_inout_bcount_full(size) __pre_deref_except_maybenull __post_deref_except_maybenull)
2778 #define __deref_inout_z_opt _SAL1_Source_(__deref_inout_z_opt, (), __deref_inout_opt __pre __deref __nullterminated __post __deref __nullterminated)
2779 #define __deref_inout_ecount_z_opt(size) _SAL1_Source_(__deref_inout_ecount_z_opt, (size), __deref_inout_ecount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated)
2780 #define __deref_inout_bcount_z_opt(size) _SAL1_Source_(__deref_inout_bcount_z_opt, (size), __deref_inout_bcount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated)
2781 #define __deref_inout_nz_opt _SAL1_Source_(__deref_inout_nz_opt, (), __deref_inout_opt)
2782 #define __deref_inout_ecount_nz_opt(size) _SAL1_Source_(__deref_inout_ecount_nz_opt, (size), __deref_inout_ecount_opt(size))
2783 #define __deref_inout_bcount_nz_opt(size) _SAL1_Source_(__deref_inout_bcount_nz_opt, (size), __deref_inout_bcount_opt(size))
2784 #define __deref_opt_ecount(size) _SAL1_Source_(__deref_opt_ecount, (size), __deref_ecount(size) __pre_except_maybenull)
2785 #define __deref_opt_bcount(size) _SAL1_Source_(__deref_opt_bcount, (size), __deref_bcount(size) __pre_except_maybenull)
2786 #define __deref_opt_out _SAL1_Source_(__deref_opt_out, (), _Outptr_opt_)
2787 #define __deref_opt_out_z _SAL1_Source_(__deref_opt_out_z, (), _Outptr_opt_result_z_)
2788 #define __deref_opt_out_ecount(size) _SAL1_Source_(__deref_opt_out_ecount, (size), __deref_out_ecount(size) __pre_except_maybenull)
2789 #define __deref_opt_out_bcount(size) _SAL1_Source_(__deref_opt_out_bcount, (size), __deref_out_bcount(size) __pre_except_maybenull)
2790 #define __deref_opt_out_ecount_part(size,length) _SAL1_Source_(__deref_opt_out_ecount_part, (size,length), __deref_out_ecount_part(size,length) __pre_except_maybenull)
2791 #define __deref_opt_out_bcount_part(size,length) _SAL1_Source_(__deref_opt_out_bcount_part, (size,length), __deref_out_bcount_part(size,length) __pre_except_maybenull)
2792 #define __deref_opt_out_ecount_full(size) _SAL1_Source_(__deref_opt_out_ecount_full, (size), __deref_out_ecount_full(size) __pre_except_maybenull)
2793 #define __deref_opt_out_bcount_full(size) _SAL1_Source_(__deref_opt_out_bcount_full, (size), __deref_out_bcount_full(size) __pre_except_maybenull)
2794 #define __deref_opt_inout _SAL1_Source_(__deref_opt_inout, (), _Inout_opt_)
2795 #define __deref_opt_inout_ecount(size) _SAL1_Source_(__deref_opt_inout_ecount, (size), __deref_inout_ecount(size) __pre_except_maybenull)
2796 #define __deref_opt_inout_bcount(size) _SAL1_Source_(__deref_opt_inout_bcount, (size), __deref_inout_bcount(size) __pre_except_maybenull)
2797 #define __deref_opt_inout_ecount_part(size,length) _SAL1_Source_(__deref_opt_inout_ecount_part, (size,length), __deref_inout_ecount_part(size,length) __pre_except_maybenull)
2798 #define __deref_opt_inout_bcount_part(size,length) _SAL1_Source_(__deref_opt_inout_bcount_part, (size,length), __deref_inout_bcount_part(size,length) __pre_except_maybenull)
2799 #define __deref_opt_inout_ecount_full(size) _SAL1_Source_(__deref_opt_inout_ecount_full, (size), __deref_inout_ecount_full(size) __pre_except_maybenull)
2800 #define __deref_opt_inout_bcount_full(size) _SAL1_Source_(__deref_opt_inout_bcount_full, (size), __deref_inout_bcount_full(size) __pre_except_maybenull)
2801 #define __deref_opt_inout_z _SAL1_Source_(__deref_opt_inout_z, (), __deref_opt_inout __pre __deref __nullterminated __post __deref __nullterminated)
2802 #define __deref_opt_inout_ecount_z(size) _SAL1_Source_(__deref_opt_inout_ecount_z, (size), __deref_opt_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated)
2803 #define __deref_opt_inout_bcount_z(size) _SAL1_Source_(__deref_opt_inout_bcount_z, (size), __deref_opt_inout_bcount(size) __pre __deref __nullterminated __post __deref __nullterminated)
2804 #define __deref_opt_inout_nz _SAL1_Source_(__deref_opt_inout_nz, (), __deref_opt_inout)
2805 #define __deref_opt_inout_ecount_nz(size) _SAL1_Source_(__deref_opt_inout_ecount_nz, (size), __deref_opt_inout_ecount(size))
2806 #define __deref_opt_inout_bcount_nz(size) _SAL1_Source_(__deref_opt_inout_bcount_nz, (size), __deref_opt_inout_bcount(size))
2807 #define __deref_opt_ecount_opt(size) _SAL1_Source_(__deref_opt_ecount_opt, (size), __deref_ecount_opt(size) __pre_except_maybenull)
2808 #define __deref_opt_bcount_opt(size) _SAL1_Source_(__deref_opt_bcount_opt, (size), __deref_bcount_opt(size) __pre_except_maybenull)
2809 #define __deref_opt_out_opt _SAL1_Source_(__deref_opt_out_opt, (), _Outptr_opt_result_maybenull_)
2810 #define __deref_opt_out_ecount_opt(size) _SAL1_Source_(__deref_opt_out_ecount_opt, (size), __deref_out_ecount_opt(size) __pre_except_maybenull)
2811 #define __deref_opt_out_bcount_opt(size) _SAL1_Source_(__deref_opt_out_bcount_opt, (size), __deref_out_bcount_opt(size) __pre_except_maybenull)
2812 #define __deref_opt_out_ecount_part_opt(size,length) _SAL1_Source_(__deref_opt_out_ecount_part_opt, (size,length), __deref_out_ecount_part_opt(size,length) __pre_except_maybenull)
2813 #define __deref_opt_out_bcount_part_opt(size,length) _SAL1_Source_(__deref_opt_out_bcount_part_opt, (size,length), __deref_out_bcount_part_opt(size,length) __pre_except_maybenull)
2814 #define __deref_opt_out_ecount_full_opt(size) _SAL1_Source_(__deref_opt_out_ecount_full_opt, (size), __deref_out_ecount_full_opt(size) __pre_except_maybenull)
2815 #define __deref_opt_out_bcount_full_opt(size) _SAL1_Source_(__deref_opt_out_bcount_full_opt, (size), __deref_out_bcount_full_opt(size) __pre_except_maybenull)
2816 #define __deref_opt_out_z_opt _SAL1_Source_(__deref_opt_out_z_opt, (), __post __deref __valid __refparam __pre_except_maybenull __pre_deref_except_maybenull __post_deref_except_maybenull __post __deref __nullterminated)
2817 #define __deref_opt_out_ecount_z_opt(size) _SAL1_Source_(__deref_opt_out_ecount_z_opt, (size), __deref_opt_out_ecount_opt(size) __post __deref __nullterminated)
2818 #define __deref_opt_out_bcount_z_opt(size) _SAL1_Source_(__deref_opt_out_bcount_z_opt, (size), __deref_opt_out_bcount_opt(size) __post __deref __nullterminated)
2819 #define __deref_opt_out_nz_opt _SAL1_Source_(__deref_opt_out_nz_opt, (), __deref_opt_out_opt)
2820 #define __deref_opt_out_ecount_nz_opt(size) _SAL1_Source_(__deref_opt_out_ecount_nz_opt, (size), __deref_opt_out_ecount_opt(size))
2821 #define __deref_opt_out_bcount_nz_opt(size) _SAL1_Source_(__deref_opt_out_bcount_nz_opt, (size), __deref_opt_out_bcount_opt(size))
2822 #define __deref_opt_inout_opt _SAL1_Source_(__deref_opt_inout_opt, (), __deref_inout_opt __pre_except_maybenull)
2823 #define __deref_opt_inout_ecount_opt(size) _SAL1_Source_(__deref_opt_inout_ecount_opt, (size), __deref_inout_ecount_opt(size) __pre_except_maybenull)
2824 #define __deref_opt_inout_bcount_opt(size) _SAL1_Source_(__deref_opt_inout_bcount_opt, (size), __deref_inout_bcount_opt(size) __pre_except_maybenull)
2825 #define __deref_opt_inout_ecount_part_opt(size,length) _SAL1_Source_(__deref_opt_inout_ecount_part_opt, (size,length), __deref_inout_ecount_part_opt(size,length) __pre_except_maybenull)
2826 #define __deref_opt_inout_bcount_part_opt(size,length) _SAL1_Source_(__deref_opt_inout_bcount_part_opt, (size,length), __deref_inout_bcount_part_opt(size,length) __pre_except_maybenull)
2827 #define __deref_opt_inout_ecount_full_opt(size) _SAL1_Source_(__deref_opt_inout_ecount_full_opt, (size), __deref_inout_ecount_full_opt(size) __pre_except_maybenull)
2828 #define __deref_opt_inout_bcount_full_opt(size) _SAL1_Source_(__deref_opt_inout_bcount_full_opt, (size), __deref_inout_bcount_full_opt(size) __pre_except_maybenull)
2829 #define __deref_opt_inout_z_opt _SAL1_Source_(__deref_opt_inout_z_opt, (), __deref_opt_inout_opt __pre __deref __nullterminated __post __deref __nullterminated)
2830 #define __deref_opt_inout_ecount_z_opt(size) _SAL1_Source_(__deref_opt_inout_ecount_z_opt, (size), __deref_opt_inout_ecount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated)
2831 #define __deref_opt_inout_bcount_z_opt(size) _SAL1_Source_(__deref_opt_inout_bcount_z_opt, (size), __deref_opt_inout_bcount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated)
2832 #define __deref_opt_inout_nz_opt _SAL1_Source_(__deref_opt_inout_nz_opt, (), __deref_opt_inout_opt)
2833 #define __deref_opt_inout_ecount_nz_opt(size) _SAL1_Source_(__deref_opt_inout_ecount_nz_opt, (size), __deref_opt_inout_ecount_opt(size))
2834 #define __deref_opt_inout_bcount_nz_opt(size) _SAL1_Source_(__deref_opt_inout_bcount_nz_opt, (size), __deref_opt_inout_bcount_opt(size))
2835 
2836 /*
2837 -------------------------------------------------------------------------------
2838 Advanced Annotation Definitions
2839 
2840 Any of these may be used to directly annotate functions, and may be used in
2841 combination with each other or with regular buffer macros. For an explanation
2842 of each annotation, see the advanced annotations section.
2843 -------------------------------------------------------------------------------
2844 */
2845 
2846 #define __success(expr) _SAL1_1_Source_(__success, (expr), _Success_(expr))
2847 #define __nullterminated _SAL1_Source_(__nullterminated, (), _Null_terminated_)
2848 #define __nullnullterminated _SAL1_Source_(__nullnulltermiated, (), _SAL_nop_impl_)
2849 #define __reserved _SAL1_Source_(__reserved, (), _Reserved_)
2850 #define __checkReturn _SAL1_Source_(__checkReturn, (), _Check_return_)
2851 #define __typefix(ctype) _SAL1_Source_(__typefix, (ctype), __inner_typefix(ctype))
2852 #define __override __inner_override
2853 #define __callback __inner_callback
2854 #define __format_string _SAL1_1_Source_(__format_string, (), _Printf_format_string_)
2855 #define __blocksOn(resource) _SAL_L_Source_(__blocksOn, (resource), __inner_blocksOn(resource))
2856 #define __control_entrypoint(category) _SAL_L_Source_(__control_entrypoint, (category), __inner_control_entrypoint(category))
2857 #define __data_entrypoint(category) _SAL_L_Source_(__data_entrypoint, (category), __inner_data_entrypoint(category))
2858 
2859 #ifdef _USING_V110_SDK71_ // [
2860 #ifndef _PREFAST_ // [
2861 #define __useHeader
2862 #else // ][
2863 #error Code analysis is not supported when using Visual C++ 11.0/12.0 with the Windows 7.1 SDK.
2864 #endif // ]
2865 #else // ][
2866 #define __useHeader _Use_decl_anno_impl_
2867 #endif // ]
2868 
2869 #ifdef _USING_V110_SDK71_ // [
2870 #ifndef _PREFAST_ // [
2871 #define __on_failure(annotes)
2872 #else // ][
2873 #error Code analysis is not supported when using Visual C++ 11.0/12.0 with the Windows 7.1 SDK.
2874 #endif // ]
2875 #else // ][
2876 #define __on_failure(annotes) _SAL1_1_Source_(__on_failure, (annotes), _On_failure_impl_(annotes _SAL_nop_impl_))
2877 #endif // ]
2878 
2879 #ifndef __fallthrough // [
2881  #define __fallthrough __inner_fallthrough
2882 #endif // ]
2883 
2884 #ifndef __analysis_assume // [
2885 #ifdef _PREFAST_ // [
2886 #define __analysis_assume(expr) __assume(expr)
2887 #else // ][
2888 #define __analysis_assume(expr)
2889 #endif // ]
2890 #endif // ]
2891 
2892 #ifndef _Analysis_assume_ // [
2893 #ifdef _PREFAST_ // [
2894 #define _Analysis_assume_(expr) __assume(expr)
2895 #else // ][
2896 #define _Analysis_assume_(expr)
2897 #endif // ]
2898 #endif // ]
2899 
2900 #define _Analysis_noreturn_ _SAL2_Source_(_Analysis_noreturn_, (), _SA_annotes0(SAL_terminates))
2901 
2902 #ifdef _PREFAST_ // [
2903 __inline __nothrow
2904 void __AnalysisAssumeNullterminated(_Post_ _Null_terminated_ void *p);
2905 
2906 #define _Analysis_assume_nullterminated_(x) __AnalysisAssumeNullterminated(x)
2907 
2908 #else // ][
2909 #define _Analysis_assume_nullterminated_(x)
2910 #endif // ]
2911 
2912 //
2913 // Set the analysis mode (global flags to analysis).
2914 // They take effect at the point of declaration; use at global scope
2915 // as a declaration.
2916 //
2917 
2918 // Synthesize a unique symbol.
2919 #define ___MKID(x, y) x ## y
2920 #define __MKID(x, y) ___MKID(x, y)
2921 #define __GENSYM(x) __MKID(x, __COUNTER__)
2922 
2923 __ANNOTATION(SAL_analysisMode(__AuToQuOtE __In_impl_ char *mode);)
2924 
2925 #define _Analysis_mode_impl_(mode) _SAL2_Source_(_Analysis_mode_impl_, (mode), _SA_annotes1(SAL_analysisMode, #mode))
2926 
2927 //
2928 // Floating point warnings are only meaningful in kernel-mode on x86
2929 // so avoid reporting them on other platforms.
2930 //
2931 #ifndef _M_IX86 // [
2932 
2933 #define _Analysis_mode_(mode) \
2934  __pragma(warning(disable: 28110 28111 28161 28162)) \
2935  typedef _Analysis_mode_impl_(mode) int \
2936  __GENSYM(__prefast_analysis_mode_flag);
2937 
2938 #else // ][
2939 
2940 #define _Analysis_mode_(mode) \
2941  typedef _Analysis_mode_impl_(mode) int \
2942  __GENSYM(__prefast_analysis_mode_flag);
2943 
2944 #endif // ]
2945 
2946 // The following are predefined:
2947 // _Analysis_operator_new_throw_ (operator new throws)
2948 // _Analysis_operator_new_null_ (operator new returns null)
2949 // _Analysis_operator_new_never_fails_ (operator new never fails)
2950 //
2951 
2952 // Function class annotations.
2953 __ANNOTATION(SAL_functionClassNew(__In_impl_ char*);)
2954 __PRIMOP(int, _In_function_class_(__In_impl_ char*);)
2956 #define _Called_from_function_class_(x) _In_function_class_(x)
2957 
2958 #define _Function_class_(x) _SAL2_Source_(_Function_class_, (x), _SA_annotes1(SAL_functionClassNew, _SA_SPECSTRIZE(x)))
2959 
2960 #define _Enum_is_bitflag_ _SAL2_Source_(_Enum_is_bitflag_, (), _SA_annotes0(SAL_enumIsBitflag))
2961 #define _Strict_type_match_ _SAL2_Source_(_Strict_type_match, (), _SA_annotes0(SAL_strictType2))
2962 
2963 #define _Maybe_raises_SEH_exception_ _SAL2_Source_(_Maybe_raises_SEH_exception_, (x), _Pre_ _SA_annotes1(SAL_inTry,__yes))
2964 #define _Raises_SEH_exception_ _SAL2_Source_(_Raises_SEH_exception_, (x), _Maybe_raises_SEH_exception_ _Analysis_noreturn_)
2965 
2966 #ifdef __cplusplus // [
2967 }
2968 #endif // ]
2969 
2970 #include <ConcurrencySal.h>
2971 
#define _Analysis_mode_impl_(mode)
Definition: sal.h:2925
#define REPEATABLE
Definition: sourceannotations.h:38
#define __PRIMOP(type, fun)
Definition: sal.h:1620
#define _In_function_class_(x)
Definition: sal.h:2955
#define _SA_annotes1(n, pp1)
Definition: sal.h:1615
#define __inner_fallthrough_dec
Definition: sal.h:2619
#define __nothrow
Definition: sal.h:2364
#define __ANNOTATION(fun)
Definition: sal.h:1619
#define _Null_terminated_
Definition: sal.h:637
#define __QUALIFIER(type, fun)
Definition: sal.h:1621
#define _SAL2_Source_(Name, args, annotes)
Definition: sal.h:222
#define SA(id)
Definition: sourceannotations.h:37
#define _Post_
Definition: sal.h:617