1ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov/***************************************************************\
2ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov*                                                               *
3ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov* SpecStrings.h - markers for documenting the semantics of APIs *
4ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov*                                                               *
5ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov* Version 1.0                                                   *
6ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov*                                                               *
7ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov* Copyright (c) Microsoft Corporation. All rights reserved.     *
8ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov*                                                               *
9ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov\***************************************************************/
10ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
11ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// @@BEGIN_DDKSPLIT
12ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
13ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
14ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Introduction
15ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
16ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// SpecStrings.h provides a set of annotations to describe how a function uses its
17ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// parameters - the assumptions it makes about them, and the guarantees it makes
18ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// upon finishing.
19ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
20ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Annotations may be placed before either a function parameter's type or its return
21ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// type, and describe the function's behavior regarding the parameter or return value.
22ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// There are two classes of annotations: buffer annotations and advanced annotations.
23ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Buffer annotations describe how functions use their pointer parameters, and
24ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// advanced annotations either describe complex/unusual buffer behavior, or provide
25ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// additional information about a parameter that is not otherwise expressible.
26ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
27ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
28ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Buffer Annotations
29ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
30ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The most important annotations in SpecStrings.h provide a consistent way to annotate
31ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// buffer parameters or return values for a function. Each of these annotations describes
32ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// a single buffer (which could be a string, a fixed-length or variable-length array,
33ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// or just a pointer) that the function interacts with: where it is, how large it is,
34ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// how much is initialized, and what the function does with it.
35ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
36ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The appropriate macro for a given buffer can be constructed using the table below.
37ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Just pick the appropriate values from each category, and combine them together
38ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// with a leading underscore. Some combinations of values do not make sense as buffer
39ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// annotations. Only meaningful annotations can be added to your code; for a list of
40ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// these, see the buffer annotation definitions section.
41ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
42ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Only a single buffer annotation should be used for each parameter.
43ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
44ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// |------------|------------|---------|--------|----------|---------------|
45ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// |   Level    |   Usage    |  Size   | Output | Optional |  Parameters   |
46ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// |------------|------------|---------|--------|----------|---------------|
47ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// | <>         | <>         | <>      | <>     | <>       | <>            |
48ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// | _deref     | _in        | _ecount | _full  | _opt     | (size)        |
49ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// | _deref_opt | _out       | _bcount | _part  |          | (size,length) |
50ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// |            | _inout     |         |        |          |               |
51ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// |            |            |         |        |          |               |
52ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// |------------|------------|---------|--------|----------|---------------|
53ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
54ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Level: Describes the buffer pointer's level of indirection from the parameter or
55ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//          return value 'p'.
56ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
57ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// <>         : p is the buffer pointer.
58ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// _deref     : *p is the buffer pointer. p must not be NULL.
59ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// _deref_opt : *p may be the buffer pointer. p may be NULL, in which case the rest of
60ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//                the annotation is ignored.
61ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
62ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Usage: Describes how the function uses the buffer.
63ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
64ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// <>     : The buffer is not accessed. If used on the return value or with _deref, the
65ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//            function will provide the buffer, and it will be uninitialized at exit.
66ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//            Otherwise, the caller must provide the buffer. This should only be used
67ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//            for alloc and free functions.
68ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// _in    : The function will only read from the buffer. The caller must provide the
69ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//            buffer and initialize it.
70ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// _out   : The function will only write to the buffer. If used on the return value or
71ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//            with _deref, the function will provide the buffer and initialize it.
72ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//            Otherwise, the caller must provide the buffer, and the function will
73ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//            initialize it.
74ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// _inout : The function may freely read from and write to the buffer. The caller must
75ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//            provide the buffer and initialize it. If used with _deref, the buffer may
76ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//            be reallocated by the function.
77ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
78ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Size: Describes the total size of the buffer. This may be less than the space actually
79ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//         allocated for the buffer, in which case it describes the accessible amount.
80ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
81ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// <>      : No buffer size is given. If the type specifies the buffer size (such as
82ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//             with LPSTR and LPWSTR), that amount is used. Otherwise, the buffer is one
83ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//             element long. Must be used with _in, _out, or _inout.
84ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// _ecount : The buffer size is an explicit element count.
85ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// _bcount : The buffer size is an explicit byte count.
86ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
87ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Output: Describes how much of the buffer will be initialized by the function. For
88ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//           _inout buffers, this also describes how much is initialized at entry. Omit this
89ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//           category for _in buffers; they must be fully initialized by the caller.
90ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
91ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// <>    : The type specifies how much is initialized. For instance, a function initializing
92ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//           an LPWSTR must NULL-terminate the string.
93ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// _full : The function initializes the entire buffer.
94ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// _part : The function initializes part of the buffer, and explicitly indicates how much.
95ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
96ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Optional: Describes if the buffer itself is optional.
97ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
98ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// <>   : The pointer to the buffer must not be NULL.
99ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// _opt : The pointer to the buffer might be NULL. It will be checked before being dereferenced.
100ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
101ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Parameters: Gives explicit counts for the size and length of the buffer.
102ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
103ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// <>            : There is no explicit count. Use when neither _ecount nor _bcount is used.
104ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// (size)        : Only the buffer's total size is given. Use with _ecount or _bcount but not _part.
105ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// (size,length) : The buffer's total size and initialized length are given. Use with _ecount_part
106ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//                   and _bcount_part.
107ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
108ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
109ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Buffer Annotation Examples
110ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
111ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// LWSTDAPI_(BOOL) StrToIntExA(
112ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     LPCSTR pszString,                    // No annotation required, const implies __in.
113ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     DWORD dwFlags,
114ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     __out int *piRet                     // A pointer whose dereference will be filled in.
115ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// );
116ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
117ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// void MyPaintingFunction(
118ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     __in HWND hwndControl,               // An initialized read-only parameter.
119ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     __in_opt HDC hdcOptional,            // An initialized read-only parameter that might be NULL.
120ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     __inout IPropertyStore *ppsStore     // An initialized parameter that may be freely used
121ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//                                          //   and modified.
122ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// );
123ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
124ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// LWSTDAPI_(BOOL) PathCompactPathExA(
125ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     __out_ecount(cchMax) LPSTR pszOut,   // A string buffer with cch elements that will
126ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//                                          //   be NULL terminated on exit.
127ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     LPCSTR pszSrc,                       // No annotation required, const implies __in.
128ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     UINT cchMax,
129ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     DWORD dwFlags
130ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// );
131ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
132ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// HRESULT SHLocalAllocBytes(
133ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     size_t cb,
134ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     __deref_bcount(cb) T **ppv           // A pointer whose dereference will be set to an
135ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//                                          //   uninitialized buffer with cb bytes.
136ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// );
137ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
138ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __inout_bcount_full(cb) : A buffer with cb elements that is fully initialized at
139ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     entry and exit, and may be written to by this function.
140ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
141ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __out_ecount_part(count, *countOut) : A buffer with count elements that will be
142ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     partially initialized by this function. The function indicates how much it
143ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     initialized by setting *countOut.
144ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
145ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
146ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Advanced Annotations
147ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
148ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Advanced annotations describe behavior that is not expressible with the regular
149ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// buffer macros. These may be used either to annotate buffer parameters that involve
150ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// complex or conditional behavior, or to enrich existing annotations with additional
151ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// information.
152ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
153ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __success(expr) f :
154ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     <expr> indicates whether function f succeeded or not. If <expr> is true at exit,
155ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     all the function's guarantees (as given by other annotations) must hold. If <expr>
156ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     is false at exit, the caller should not expect any of the function's guarantees
157ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     to hold. If not used, the function must always satisfy its guarantees. Added
158ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     automatically to functions that indicate success in standard ways, such as by
159ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     returning an HRESULT.
160ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
161ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __out_awcount(expr, size) p :
162ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     Pointer p is a buffer whose size may be given in either bytes or elements. If
163ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     <expr> is true, this acts like __out_bcount. If <expr> is false, this acts
164ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     like __out_ecount. This should only be used to annotate old APIs.
165ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
166ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __in_awcount(expr, size) p :
167ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     Pointer p is a buffer whose size may be given in either bytes or elements. If
168ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     <expr> is true, this acts like __in_bcount. If <expr> is false, this acts
169ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     like __in_ecount. This should only be used to annotate old APIs.
170ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
171ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __nullterminated p :
172ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     Pointer p is a buffer that may be read or written up to and including the first
173ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     NULL character or pointer. May be used on typedefs, which marks valid (properly
174ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     initialized) instances of that type as being NULL-terminated.
175ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
176ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __nullnullterminated p :
177ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     Pointer p is a buffer that may be read or written up to and including the first
178ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     sequence of two NULL characters or pointers. May be used on typedefs, which marks
179ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     valid instances of that type as being double-NULL terminated.
180ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
181ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __reserved v :
182ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     Value v must be 0/NULL, reserved for future use.
183ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
184ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __checkReturn v :
185ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     Return value v must not be ignored by callers of this function.
186ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
187ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __typefix(ctype) v :
188ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     Value v should be treated as an instance of ctype, rather than its declared type.
189ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
190ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __override f :
191ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     Specify C#-style 'override' behaviour for overriding virtual methods.
192ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
193ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __callback f :
194ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     Function f can be used as a function pointer.
195ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
196ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __format_string p :
197ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     Pointer p is a string that contains % markers in the style of printf.
198ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
199ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __blocksOn(resource) f :
200ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     Function f blocks on the resource 'resource'.
201ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
202ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __fallthrough :
203ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     Annotates switch statement labels where fall-through is desired, to distinguish
204ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     from forgotten break statements.
205ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
206ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
207ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Advanced Annotation Examples
208ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
209ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __success(return == TRUE) LWSTDAPI_(BOOL)
210ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// PathCanonicalizeA(__out_ecount(MAX_PATH) LPSTR pszBuf, LPCSTR pszPath) :
211ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     pszBuf is only guaranteed to be NULL-terminated when TRUE is returned.
212ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
213ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// typedef __nullterminated WCHAR* LPWSTR : Initialized LPWSTRs are NULL-terminated strings.
214ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
215ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// __out_ecount(cch) __typefix(LPWSTR) void *psz : psz is a buffer parameter which will be
216ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//     a NULL-terminated WCHAR string at exit, and which initially contains cch WCHARs.
217ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
218ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
219ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
220ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// @@END_DDKSPLIT
221ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
222ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#if _MSC_VER > 1000
223ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#pragma once
224ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif  // #if _MSC_VER > 1000
225ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
226ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __specstrings
227ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
228ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifdef  __cplusplus
229ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __nothrow
230ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov# define __nothrow __declspec(nothrow)
231ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
232ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganovextern "C" {
233ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#else
234ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __nothrow
235ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov# define __nothrow
236ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
237ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif  // #ifdef __cplusplus
238ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
239ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// @@BEGIN_DDKSPLIT
240ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
241ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
242ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Helper Macro Definitions
243ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
244ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// These express behavior common to many of the high-level annotations.
245ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// DO NOT USE THESE IN YOUR CODE.
246ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
247ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
248ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// The helper annotations are only understood by the compiler version used by various
249ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// defect detection tools. When the regular compiler is running, they are defined into
250ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// nothing, and do not affect the compiled code.
251ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#if (_MSC_VER >= 1000) && !defined(MIDL_PASS) && defined(_PREFAST_)
252ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
253ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // In the primitive __declspec("SAL_*") annotations "SAL" stands for Standard
254ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Annotation Language.  These __declspec("SAL_*") annotations are the
255ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // primitives the compiler understands and all high-level SpecString MACROs
256ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // will decompose into these primivates.
257ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
258ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define SPECSTRINGIZE( x ) #x
259ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
260ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
261ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __null p
262ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __notnull p
263ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __maybenull p
264ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
265ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Annotates a pointer p. States that pointer p is null. Commonly used
266ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // in the negated form __notnull or the possibly null form __maybenull.
267ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
268ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __null                  __declspec("SAL_null")
269ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __notnull               __declspec("SAL_notnull")
270ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __maybenull             __declspec("SAL_maybenull")
271ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
272ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
273ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __readonly l
274ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __notreadonly l
275ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __mabyereadonly l
276ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
277ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Annotates a location l. States that location l is not modified after
278ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // this point.  If the annotation is placed on the precondition state of
279ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // a function, the restriction only applies until the postcondition state
280ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // of the function.  __maybereadonly states that the annotated location
281ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // may be modified, whereas __notreadonly states that a location must be
282ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // modified.
283ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
284ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __readonly              __declspec("SAL_readonly")
285ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __notreadonly           __declspec("SAL_notreadonly")
286ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __maybereadonly         __declspec("SAL_maybereadonly")
287ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
288ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
289ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __valid v
290ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __notvalid v
291ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __maybevalid v
292ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
293ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Annotates any value v. States that the value satisfies all properties of
294ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // valid values of its type. For example, for a string buffer, valid means
295ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // that the buffer pointer is either NULL or points to a NULL-terminated string.
296ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
297ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __valid                 __declspec("SAL_valid")
298ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __notvalid              __declspec("SAL_notvalid")
299ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __maybevalid            __declspec("SAL_maybevalid")
300ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
301ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
302ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __readableTo(extent) p
303ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
304ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Annotates a buffer pointer p.  If the buffer can be read, extent describes
305ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // how much of the buffer is readable. For a reader of the buffer, this is
306ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // an explicit permission to read up to that amount, rather than a restriction to
307ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // read only up to it.
308ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
309ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __readableTo(extent)    __declspec("SAL_readableTo("SPECSTRINGIZE(extent)")")
310ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
311ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
312ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __elem_readableTo(size)
313ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
314ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Annotates a buffer pointer p as being readable to size elements.
315ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
316ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __elem_readableTo(size)   __declspec("SAL_readableTo(elementCount("SPECSTRINGIZE(size)"))")
317ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
318ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
319ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __byte_readableTo(size)
320ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
321ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Annotates a buffer pointer p as being readable to size bytes.
322ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
323ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __byte_readableTo(size)   __declspec("SAL_readableTo(byteCount("SPECSTRINGIZE(size)"))")
324ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
325ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
326ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __writableTo(extent) p
327ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
328ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Annotates a buffer pointer p. If the buffer can be modified, extent
329ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // describes how much of the buffer is writable (usually the allocation
330ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // size). For a writer of the buffer, this is an explicit permission to
331ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // write up to that amount, rather than a restriction to write only up to it.
332ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
333ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __writableTo(size)   __declspec("SAL_writableTo("SPECSTRINGIZE(size)")")
334ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
335ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
336ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __elem_writableTo(size)
337ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
338ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Annotates a buffer pointer p as being writable to size elements.
339ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
340ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __elem_writableTo(size)   __declspec("SAL_writableTo(elementCount("SPECSTRINGIZE(size)"))")
341ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
342ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
343ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __byte_writableTo(size)
344ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
345ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Annotates a buffer pointer p as being writable to size bytes.
346ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
347ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __byte_writableTo(size)   __declspec("SAL_writableTo(byteCount("SPECSTRINGIZE(size)"))")
348ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
349ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
350ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __deref p
351ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
352ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Annotates a pointer p. The next annotation applies one dereference down
353ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // in the type. If readableTo(p, size) then the next annotation applies to
354ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // all elements *(p+i) for which i satisfies the size. If p is a pointer
355ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // to a struct, the next annotation applies to all fields of the struct.
356ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
357ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __deref                 __declspec("SAL_deref")
358ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
359ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
360ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __pre __next_annotation
361ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
362ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // The next annotation applies in the precondition state
363ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
364ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __pre                   __declspec("SAL_pre")
365ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
366ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
367ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __post __next_annotation
368ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
369ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // The next annotation applies in the postcondition state
370ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
371ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __post                  __declspec("SAL_post")
372ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
373ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
374ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __precond(<expr>)
375ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
376ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // When <expr> is true, the next annotation applies in the precondition state
377ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // (currently not enabled)
378ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
379ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __precond(expr)         __pre
380ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
381ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
382ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __postcond(<expr>)
383ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
384ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // When <expr> is true, the next annotation applies in the postcondition state
385ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // (currently not enabled)
386ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
387ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __postcond(expr)        __post
388ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
389ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
390ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __exceptthat
391ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
392ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Given a set of annotations Q containing __exceptthat maybeP, the effect of
393ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // the except clause is to erase any P or notP annotations (explicit or
394ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // implied) within Q at the same level of dereferencing that the except
395ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // clause appears, and to replace it with maybeP.
396ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
397ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //  Example 1: __valid __exceptthat __maybenull on a pointer p means that the
398ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //             pointer may be null, and is otherwise valid, thus overriding
399ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //             the implicit notnull annotation implied by __valid on
400ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //             pointers.
401ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
402ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //  Example 2: __valid __deref __exceptthat __maybenull on an int **p means
403ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //             that p is not null (implied by valid), but the elements
404ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //             pointed to by p could be null, and are otherwise valid.
405ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
406ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __exceptthat                __declspec("SAL_except")
407ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
408ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
409ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // _refparam
410ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
411ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Added to all out parameter macros to indicate that they are all reference
412ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // parameters.
413ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
414ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __refparam                  __deref __notreadonly
415ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
416ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
417ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // __inner_*
418ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
419ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Helper macros that directly correspond to certain high-level annotations.
420ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
421ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
422ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
423ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Macros to classify the entrypoints and indicate their category.
424ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
425ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
426ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Pre-defined control point categories include: RPC, LPC, DeviceDriver, UserToKernel, ISAPI, COM.
427ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
428ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_control_entrypoint(category) __declspec("SAL_entrypoint(controlEntry, "SPECSTRINGIZE(category)")")
429ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
430ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
431ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    // Pre-defined data entry point categories include: Registry, File, Network.
432ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    //
433ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_data_entrypoint(category)    __declspec("SAL_entrypoint(dataEntry, "SPECSTRINGIZE(category)")")
434ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
435ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_success(expr)               __declspec("SAL_success("SPECSTRINGIZE(expr)")")
436ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_checkReturn                 __declspec("SAL_checkReturn")
437ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_typefix(ctype)              __declspec("SAL_typefix("SPECSTRINGIZE(ctype)")")
438ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_override                    __declspec("__override")
439ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_callback                    __declspec("__callback")
440ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_blocksOn(resource)          __declspec("SAL_blocksOn("SPECSTRINGIZE(resource)")")
441ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_fallthrough_dec             __inline __nothrow void __FallThrough() {}
442ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_fallthrough                 __FallThrough();
443ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
444ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#else
445ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
446ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// @@END_DDKSPLIT
447ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
448ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __null
449ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __null
450ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
451ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __notnull
452ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __notnull
453ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
454ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __maybenull
455ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __maybenull
456ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
457ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __readonly
458ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __readonly
459ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
460ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __notreadonly
461ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __notreadonly
462ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
463ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __maybereadonly
464ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __maybereadonly
465ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
466ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __valid
467ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __valid
468ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
469ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __notvalid
470ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __notvalid
471ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
472ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __maybevalid
473ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __maybevalid
474ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
475ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __readableTo
476ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __readableTo(extent)
477ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
478ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __elem_readableTo
479ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __elem_readableTo(size)
480ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
481ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __byte_readableTo
482ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __byte_readableTo(size)
483ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
484ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __writableTo
485ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __writableTo(size)
486ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
487ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __elem_writableTo
488ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __elem_writableTo(size)
489ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
490ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __byte_writableTo
491ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __byte_writableTo(size)
492ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
493ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref
494ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __deref
495ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
496ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __pre
497ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __pre
498ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
499ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __post
500ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __post
501ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
502ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __precond
503ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __precond(expr)
504ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
505ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __postcond
506ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __postcond(expr)
507ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
508ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __exceptthat
509ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __exceptthat
510ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
511ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inner_success
512ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_success(expr)
513ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
514ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inner_checkReturn
515ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_checkReturn
516ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
517ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inner_typefix
518ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_typefix(ctype)
519ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
520ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inner_override
521ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_override
522ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
523ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inner_callback
524ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_callback
525ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
526ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inner_blocksOn
527ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_blocksOn(resource)
528ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
529ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inner_fallthrough_dec
530ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_fallthrough_dec
531ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
532ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inner_fallthrough
533ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_fallthrough
534ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
535ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __refparam
536ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __refparam
537ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
538ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inner_control_entrypoint
539ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_control_entrypoint(category)
540ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
541ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inner_data_entrypoint
542ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __inner_data_entrypoint(category)
543ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
544ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// @@BEGIN_DDKSPLIT
545ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif // #if (_MSC_VER >= 1000) && !defined(MIDL_PASS) && defined(_PREFAST_)
546ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
547ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Buffer Annotation Definitions
548ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
549ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Any of these may be used to directly annotate functions, but only one should
550ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// be used for each parameter. To determine which annotation to use for a given
551ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// buffer, use the table in the buffer annotations section.
552ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
553ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// @@END_DDKSPLIT
554ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
555ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __ecount
556ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __ecount(size)                                          __notnull __elem_writableTo(size)
557ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
558ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __bcount
559ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __bcount(size)                                          __notnull __byte_writableTo(size)
560ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
561ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __in
562ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __in                                                    __pre __valid __pre __deref __readonly
563ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
564ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __in_ecount
565ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __in_ecount(size)                                       __in __pre __elem_readableTo(size)
566ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
567ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __in_bcount
568ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __in_bcount(size)                                       __in __pre __byte_readableTo(size)
569ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
570ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out
571ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out                                                   __ecount(1) __post __valid __refparam
572ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
573ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_ecount
574ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_ecount(size)                                      __ecount(size) __post __valid __refparam
575ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
576ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_bcount
577ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_bcount(size)                                      __bcount(size) __post __valid __refparam
578ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
579ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_ecount_part
580ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_ecount_part(size,length)                          __out_ecount(size) __post __elem_readableTo(length)
581ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
582ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_bcount_part
583ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_bcount_part(size,length)                          __out_bcount(size) __post __byte_readableTo(length)
584ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
585ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_ecount_full
586ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_ecount_full(size)                                 __out_ecount_part(size,size)
587ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
588ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_bcount_full
589ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_bcount_full(size)                                 __out_bcount_part(size,size)
590ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
591ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout
592ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout                                                 __pre __valid __post __valid __refparam
593ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
594ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_ecount
595ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_ecount(size)                                    __out_ecount(size) __pre __valid
596ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
597ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_bcount
598ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_bcount(size)                                    __out_bcount(size) __pre __valid
599ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
600ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_ecount_part
601ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_ecount_part(size,length)                        __out_ecount_part(size,length) __pre __valid __pre __elem_readableTo(length)
602ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
603ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_bcount_part
604ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_bcount_part(size,length)                        __out_bcount_part(size,length) __pre __valid __pre __byte_readableTo(length)
605ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
606ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_ecount_full
607ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_ecount_full(size)                               __inout_ecount_part(size,size)
608ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
609ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_bcount_full
610ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_bcount_full(size)                               __inout_bcount_part(size,size)
611ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
612ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
613ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __ecount_opt
614ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __ecount_opt(size)                                      __ecount(size)                              __exceptthat __maybenull
615ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
616ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __bcount_opt
617ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __bcount_opt(size)                                      __bcount(size)                              __exceptthat __maybenull
618ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
619ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __in_opt
620ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __in_opt                                                __in                                        __exceptthat __maybenull
621ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
622ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __in_ecount_opt
623ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __in_ecount_opt(size)                                   __in_ecount(size)                           __exceptthat __maybenull
624ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
625ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __in_bcount_opt
626ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __in_bcount_opt(size)                                   __in_bcount(size)                           __exceptthat __maybenull
627ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
628ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_opt
629ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_opt                                               __out                                       __exceptthat __maybenull
630ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
631ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_ecount_opt
632ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_ecount_opt(size)                                  __out_ecount(size)                          __exceptthat __maybenull
633ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
634ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_bcount_opt
635ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_bcount_opt(size)                                  __out_bcount(size)                          __exceptthat __maybenull
636ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
637ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_ecount_part_opt
638ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_ecount_part_opt(size,length)                      __out_ecount_part(size,length)              __exceptthat __maybenull
639ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
640ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_bcount_part_opt
641ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_bcount_part_opt(size,length)                      __out_bcount_part(size,length)              __exceptthat __maybenull
642ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
643ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_ecount_full_opt
644ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_ecount_full_opt(size)                             __out_ecount_full(size)                     __exceptthat __maybenull
645ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
646ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_bcount_full_opt
647ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_bcount_full_opt(size)                             __out_bcount_full(size)                     __exceptthat __maybenull
648ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
649ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_opt
650ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_opt                                             __inout                                     __exceptthat __maybenull
651ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
652ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_ecount_opt
653ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_ecount_opt(size)                                __inout_ecount(size)                        __exceptthat __maybenull
654ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
655ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_bcount_opt
656ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_bcount_opt(size)                                __inout_bcount(size)                        __exceptthat __maybenull
657ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
658ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_ecount_part_opt
659ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_ecount_part_opt(size,length)                    __inout_ecount_part(size,length)            __exceptthat __maybenull
660ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
661ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_bcount_part_opt
662ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_bcount_part_opt(size,length)                    __inout_bcount_part(size,length)            __exceptthat __maybenull
663ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
664ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_ecount_full_opt
665ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_ecount_full_opt(size)                           __inout_ecount_full(size)                   __exceptthat __maybenull
666ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
667ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __inout_bcount_full_opt
668ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __inout_bcount_full_opt(size)                           __inout_bcount_full(size)                   __exceptthat __maybenull
669ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
670ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
671ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_ecount
672ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_ecount(size)                                    __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __elem_writableTo(size)
673ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
674ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_bcount
675ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_bcount(size)                                    __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __byte_writableTo(size)
676ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
677ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_in
678ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_in                                              __in __pre __deref __deref __readonly
679ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
680ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_in_ecount
681ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_in_ecount(size)                                 __deref_in __pre __deref __elem_readableTo(size)
682ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
683ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_in_bcount
684ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_in_bcount(size)                                 __deref_in __pre __deref __byte_readableTo(size)
685ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
686ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out
687ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out                                             __deref_ecount(1) __post __deref __valid __refparam
688ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
689ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_ecount
690ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_ecount(size)                                __deref_ecount(size) __post __deref __valid __refparam
691ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
692ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_bcount
693ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_bcount(size)                                __deref_bcount(size) __post __deref __valid __refparam
694ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
695ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_ecount_part
696ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_ecount_part(size,length)                    __deref_out_ecount(size) __post __deref __elem_readableTo(length)
697ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
698ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_bcount_part
699ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_bcount_part(size,length)                    __deref_out_bcount(size) __post __deref __byte_readableTo(length)
700ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
701ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_ecount_full
702ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_ecount_full(size)                           __deref_out_ecount_part(size,size)
703ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
704ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_bcount_full
705ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_bcount_full(size)                           __deref_out_bcount_part(size,size)
706ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
707ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout
708ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout                                           __notnull __elem_readableTo(1) __pre __deref __valid __post __deref __valid __refparam
709ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
710ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_ecount
711ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_ecount(size)                              __deref_inout __pre __deref __elem_writableTo(size) __post __deref __elem_writableTo(size)
712ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
713ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_bcount
714ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_bcount(size)                              __deref_inout __pre __deref __byte_writableTo(size) __post __deref __byte_writableTo(size)
715ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
716ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_ecount_part
717ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_ecount_part(size,length)                  __deref_inout_ecount(size) __pre __deref __elem_readableTo(length) __post __deref __elem_readableTo(length)
718ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
719ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_bcount_part
720ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_bcount_part(size,length)                  __deref_inout_bcount(size) __pre __deref __byte_readableTo(length) __post __deref __byte_readableTo(length)
721ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
722ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_ecount_full
723ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_ecount_full(size)                         __deref_inout_ecount_part(size,size)
724ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
725ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_bcount_full
726ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_bcount_full(size)                         __deref_inout_bcount_part(size,size)
727ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
728ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
729ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_ecount_opt
730ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_ecount_opt(size)                                __deref_ecount(size)                        __post __deref __exceptthat __maybenull
731ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
732ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_bcount_opt
733ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_bcount_opt(size)                                __deref_bcount(size)                        __post __deref __exceptthat __maybenull
734ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
735ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_in_opt
736ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_in_opt                                          __deref_in                                  __pre __deref __exceptthat __maybenull
737ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
738ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_in_ecount_opt
739ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_in_ecount_opt(size)                             __deref_in_ecount(size)                     __pre __deref __exceptthat __maybenull
740ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
741ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_in_bcount_opt
742ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_in_bcount_opt(size)                             __deref_in_bcount(size)                     __pre __deref __exceptthat __maybenull
743ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
744ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_opt
745ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_opt                                         __deref_out                                 __post __deref __exceptthat __maybenull
746ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
747ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_ecount_opt
748ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_ecount_opt(size)                            __deref_out_ecount(size)                    __post __deref __exceptthat __maybenull
749ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
750ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_bcount_opt
751ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_bcount_opt(size)                            __deref_out_bcount(size)                    __post __deref __exceptthat __maybenull
752ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
753ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_ecount_part_opt
754ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_ecount_part_opt(size,length)                __deref_out_ecount_part(size,length)        __post __deref __exceptthat __maybenull
755ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
756ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_bcount_part_opt
757ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_bcount_part_opt(size,length)                __deref_out_bcount_part(size,length)        __post __deref __exceptthat __maybenull
758ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
759ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_ecount_full_opt
760ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_ecount_full_opt(size)                       __deref_out_ecount_full(size)               __post __deref __exceptthat __maybenull
761ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
762ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_out_bcount_full_opt
763ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_out_bcount_full_opt(size)                       __deref_out_bcount_full(size)               __post __deref __exceptthat __maybenull
764ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
765ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_opt
766ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_opt                                       __deref_inout                               __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
767ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
768ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_ecount_opt
769ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_ecount_opt(size)                          __deref_inout_ecount(size)                  __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
770ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
771ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_bcount_opt
772ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_bcount_opt(size)                          __deref_inout_bcount(size)                  __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
773ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
774ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_ecount_part_opt
775ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_ecount_part_opt(size,length)              __deref_inout_ecount_part(size,length)      __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
776ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
777ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_bcount_part_opt
778ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_bcount_part_opt(size,length)              __deref_inout_bcount_part(size,length)      __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
779ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
780ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_ecount_full_opt
781ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_ecount_full_opt(size)                     __deref_inout_ecount_full(size)             __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
782ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
783ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_inout_bcount_full_opt
784ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_inout_bcount_full_opt(size)                     __deref_inout_bcount_full(size)             __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
785ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
786ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
787ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_ecount
788ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_ecount(size)                                __deref_ecount(size)                        __exceptthat __maybenull
789ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
790ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_bcount
791ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_bcount(size)                                __deref_bcount(size)                        __exceptthat __maybenull
792ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
793ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_in
794ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_in                                          __deref_in                                  __exceptthat __maybenull
795ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
796ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_in_ecount
797ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_in_ecount(size)                             __deref_in_ecount(size)                     __exceptthat __maybenull
798ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
799ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_in_bcount
800ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_in_bcount(size)                             __deref_in_bcount(size)                     __exceptthat __maybenull
801ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
802ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out
803ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out                                         __deref_out                                 __exceptthat __maybenull
804ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
805ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_ecount
806ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_ecount(size)                            __deref_out_ecount(size)                    __exceptthat __maybenull
807ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
808ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_bcount
809ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_bcount(size)                            __deref_out_bcount(size)                    __exceptthat __maybenull
810ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
811ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_ecount_part
812ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_ecount_part(size,length)                __deref_out_ecount_part(size,length)        __exceptthat __maybenull
813ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
814ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_bcount_part
815ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_bcount_part(size,length)                __deref_out_bcount_part(size,length)        __exceptthat __maybenull
816ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
817ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_ecount_full
818ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_ecount_full(size)                       __deref_out_ecount_full(size)               __exceptthat __maybenull
819ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
820ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_bcount_full
821ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_bcount_full(size)                       __deref_out_bcount_full(size)               __exceptthat __maybenull
822ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
823ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout
824ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout                                       __deref_inout                               __exceptthat __maybenull
825ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
826ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_ecount
827ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_ecount(size)                          __deref_inout_ecount(size)                  __exceptthat __maybenull
828ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
829ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_bcount
830ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_bcount(size)                          __deref_inout_bcount(size)                  __exceptthat __maybenull
831ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
832ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_ecount_part
833ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_ecount_part(size,length)              __deref_inout_ecount_part(size,length)      __exceptthat __maybenull
834ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
835ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_bcount_part
836ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_bcount_part(size,length)              __deref_inout_bcount_part(size,length)      __exceptthat __maybenull
837ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
838ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_ecount_full
839ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_ecount_full(size)                     __deref_inout_ecount_full(size)             __exceptthat __maybenull
840ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
841ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_bcount_full
842ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_bcount_full(size)                     __deref_inout_bcount_full(size)             __exceptthat __maybenull
843ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
844ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
845ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_ecount_opt
846ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_ecount_opt(size)                            __deref_ecount_opt(size)                    __exceptthat __maybenull
847ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
848ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_bcount_opt
849ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_bcount_opt(size)                            __deref_bcount_opt(size)                    __exceptthat __maybenull
850ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
851ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_in_opt
852ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_in_opt                                      __deref_in_opt                              __exceptthat __maybenull
853ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
854ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_in_ecount_opt
855ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_in_ecount_opt(size)                         __deref_in_ecount_opt(size)                 __exceptthat __maybenull
856ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
857ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_in_bcount_opt
858ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_in_bcount_opt(size)                         __deref_in_bcount_opt(size)                 __exceptthat __maybenull
859ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
860ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_opt
861ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_opt                                     __deref_out_opt                             __exceptthat __maybenull
862ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
863ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_ecount_opt
864ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_ecount_opt(size)                        __deref_out_ecount_opt(size)                __exceptthat __maybenull
865ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
866ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_bcount_opt
867ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_bcount_opt(size)                        __deref_out_bcount_opt(size)                __exceptthat __maybenull
868ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
869ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_ecount_part_opt
870ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_ecount_part_opt(size,length)            __deref_out_ecount_part_opt(size,length)    __exceptthat __maybenull
871ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
872ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_bcount_part_opt
873ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_bcount_part_opt(size,length)            __deref_out_bcount_part_opt(size,length)    __exceptthat __maybenull
874ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
875ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_ecount_full_opt
876ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_ecount_full_opt(size)                   __deref_out_ecount_full_opt(size)           __exceptthat __maybenull
877ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
878ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_out_bcount_full_opt
879ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_out_bcount_full_opt(size)                   __deref_out_bcount_full_opt(size)           __exceptthat __maybenull
880ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
881ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_opt
882ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_opt                                   __deref_inout_opt                           __exceptthat __maybenull
883ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
884ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_ecount_opt
885ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_ecount_opt(size)                      __deref_inout_ecount_opt(size)              __exceptthat __maybenull
886ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
887ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_bcount_opt
888ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_bcount_opt(size)                      __deref_inout_bcount_opt(size)              __exceptthat __maybenull
889ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
890ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_ecount_part_opt
891ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_ecount_part_opt(size,length)          __deref_inout_ecount_part_opt(size,length)  __exceptthat __maybenull
892ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
893ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_bcount_part_opt
894ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_bcount_part_opt(size,length)          __deref_inout_bcount_part_opt(size,length)  __exceptthat __maybenull
895ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
896ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_ecount_full_opt
897ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_ecount_full_opt(size)                 __deref_inout_ecount_full_opt(size)         __exceptthat __maybenull
898ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
899ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __deref_opt_inout_bcount_full_opt
900ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __deref_opt_inout_bcount_full_opt(size)                 __deref_inout_bcount_full_opt(size)         __exceptthat __maybenull
901ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
902ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
903ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// @@BEGIN_DDKSPLIT
904ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
905ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Advanced Annotation Definitions
906ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
907ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Any of these may be used to directly annotate functions, and may be used in
908ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// combination with each other or with regular buffer macros. For an explanation
909ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// of each annotation, see the advanced annotations section.
910ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
911ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// @@END_DDKSPLIT
912ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
913ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __out_awcount
914ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __out_awcount(expr,size)            __pre __notnull \
915ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov                                            __precond(expr) __byte_writableTo(size) \
916ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov                                            __precond(!(expr)) __byte_writableTo((size)*2) \
917ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov                                            __post __valid __refparam
918ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
919ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __in_awcount
920ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __in_awcount(expr,size)             __pre __valid \
921ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov                                            __pre __deref __readonly \
922ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov                                            __precond(expr) __byte_readableTo(size) \
923ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov                                            __precond(!(expr)) __elem_readableTo(size)
924ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
925ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __success
926ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __success(expr)                     __inner_success(expr)
927ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
928ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __nullterminated
929ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __nullterminated                    __readableTo(sentinel(0))
930ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
931ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __nullnullterminated
932ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __nullnullterminated
933ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
934ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __reserved
935ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __reserved                          __pre __null
936ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
937ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __checkReturn
938ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __checkReturn                       __inner_checkReturn
939ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
940ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __typefix
941ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __typefix(ctype)                    __inner_typefix(ctype)
942ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
943ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __override
944ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __override                          __inner_override
945ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
946ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __callback
947ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __callback                          __inner_callback
948ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
949ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __format_string
950ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __format_string
951ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
952ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __blocksOn
953ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __blocksOn(resource)                __inner_blocksOn(resource)
954ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
955ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __control_entrypoint
956ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __control_entrypoint(category)      __inner_control_entrypoint(category)
957ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
958ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __data_entrypoint
959ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#define __data_entrypoint(category)         __inner_data_entrypoint(category)
960ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
961ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
962ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifndef __fallthrough
963ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    __inner_fallthrough_dec
964ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov    #define __fallthrough __inner_fallthrough
965ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
966ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
967ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
968ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// Deprecated Annotation Definitions
969ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov//
970ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// These should be removed from existing code.
971ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// -------------------------------------------------------------------------------
972ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
973ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov// #define __opt                               __exceptthat __maybenull
974ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
975ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#ifdef  __cplusplus
976ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov}
977ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov#endif
978ee451cb395940862dad63c85adfe8f2fd55e864cSvet Ganov
979