Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 1 | pmbaty | 1 | /****************************************************************\ | 
| 2 | *                                                                * | ||
| 3 | * rpcsal.h - markers for documenting the semantics of RPC APIs   * | ||
| 4 | *                                                                * | ||
| 5 | * Version 1.0                                                    * | ||
| 6 | *                                                                * | ||
| 7 | * Copyright (c) 2004 Microsoft Corporation. All rights reserved. * | ||
| 8 | *                                                                * | ||
| 9 | \****************************************************************/ | ||
| 10 | |||
| 11 | // ------------------------------------------------------------------------------- | ||
| 12 | // Introduction | ||
| 13 | // | ||
| 14 | // rpcsal.h provides a set of annotations to describe how RPC functions use their | ||
| 15 | // parameters - the assumptions it makes about them, adn the guarantees it makes  | ||
| 16 | // upon finishing.  These annotations are similar to those found in specstrings.h, | ||
| 17 | // but are designed to be used by the MIDL compiler when it generates annotations | ||
| 18 | // enabled header files. | ||
| 19 | // | ||
| 20 | // IDL authors do not need to annotate their functions declarations.  The MIDL compiler | ||
| 21 | // will interpret the IDL directives and use one of the annotations contained  | ||
| 22 | // in this header.  This documentation is intended to help those trying to  understand  | ||
| 23 | // the MIDL-generated header files or those who maintain their own copies of these files. | ||
| 24 | // | ||
| 25 | // ------------------------------------------------------------------------------- | ||
| 26 | // Differences between rpcsal.h and specstrings.h | ||
| 27 | //  | ||
| 28 | // There are a few important differences between the annotations found in rpcsal.h and | ||
| 29 | // those in specstrings.h: | ||
| 30 | //  | ||
| 31 | // 1. [in] parameters are not marked as read-only.  They may be used for scratch space  | ||
| 32 | // at the server and changes will not affect the client. | ||
| 33 | // 2. String versions of each macro alleviates the need for a special type definition | ||
| 34 | // | ||
| 35 | // ------------------------------------------------------------------------------- | ||
| 36 | // Interpreting RPC Annotations | ||
| 37 | // | ||
| 38 | // These annotations are interpreted precisely in the same way as those in specstrings.h.   | ||
| 39 | // Please refer to that header for information related to general usage in annotations.  | ||
| 40 | // | ||
| 41 | // To construct an RPC annotation, concatenate the appropriate value from each category | ||
| 42 | // along with a leading __RPC_.  A typical annotation looks like "__RPC__in_string". | ||
| 43 | // | ||
| 44 | // |----------------------------------------------------------------------------------| | ||
| 45 | // | RPC Annotations                                                                  | | ||
| 46 | // |------------|------------|---------|--------|----------|----------|---------------| | ||
| 47 | // |   Level    |   Usage    |  Size   | Output | Optional |  String  |  Parameters   | | ||
| 48 | // |------------|------------|---------|--------|----------|----------|---------------| | ||
| 49 | // | <>         | <>         | <>      | <>     | <>       | <>       | <>            | | ||
| 50 | // | _deref     | _in        | _ecount | _full  | _opt     | _string  | (size)        | | ||
| 51 | // | _deref_opt | _out       | _bcount | _part  |          |          | (size,length) | | ||
| 52 | // |            | _inout     |         |        |          |          |               | | ||
| 53 | // |            |            |         |        |          |          |               | | ||
| 54 | // |------------|------------|---------|--------|----------|----------|---------------| | ||
| 55 | // | ||
| 56 | // Level: Describes the buffer pointer's level of indirection from the parameter or | ||
| 57 | //          return value 'p'. | ||
| 58 | // | ||
| 59 | // <>         : p is the buffer pointer. | ||
| 60 | // _deref     : *p is the buffer pointer. p must not be NULL. | ||
| 61 | // _deref_opt : *p may be the buffer pointer. p may be NULL, in which case the rest of | ||
| 62 | //                the annotation is ignored. | ||
| 63 | // | ||
| 64 | // Usage: Describes how the function uses the buffer. | ||
| 65 | // | ||
| 66 | // <>     : The buffer is not accessed. If used on the return value or with _deref, the | ||
| 67 | //            function will provide the buffer, and it will be uninitialized at exit. | ||
| 68 | //            Otherwise, the caller must provide the buffer. This should only be used | ||
| 69 | //            for alloc and free functions. | ||
| 70 | // _in    : The function will only read from the buffer. The caller must provide the | ||
| 71 | //            buffer and initialize it. Cannot be used with _deref. | ||
| 72 | // _out   : The function will only write to the buffer. If used on the return value or | ||
| 73 | //            with _deref, the function will provide the buffer and initialize it. | ||
| 74 | //            Otherwise, the caller must provide the buffer, and the function will | ||
| 75 | //            initialize it. | ||
| 76 | // _inout : The function may freely read from and write to the buffer. The caller must | ||
| 77 | //            provide the buffer and initialize it. If used with _deref, the buffer may | ||
| 78 | //            be reallocated by the function. | ||
| 79 | // | ||
| 80 | // Size: Describes the total size of the buffer. This may be less than the space actually | ||
| 81 | //         allocated for the buffer, in which case it describes the accessible amount. | ||
| 82 | // | ||
| 83 | // <>      : No buffer size is given. If the type specifies the buffer size (such as | ||
| 84 | //             with LPSTR and LPWSTR), that amount is used. Otherwise, the buffer is one | ||
| 85 | //             element long. Must be used with _in, _out, or _inout. | ||
| 86 | // _ecount : The buffer size is an explicit element count. | ||
| 87 | // _bcount : The buffer size is an explicit byte count. | ||
| 88 | // | ||
| 89 | // Output: Describes how much of the buffer will be initialized by the function. For | ||
| 90 | //           _inout buffers, this also describes how much is initialized at entry. Omit this | ||
| 91 | //           category for _in buffers; they must be fully initialized by the caller. | ||
| 92 | // | ||
| 93 | // <>    : The type specifies how much is initialized. For instance, a function initializing | ||
| 94 | //           an LPWSTR must NULL-terminate the string. | ||
| 95 | // _full : The function initializes the entire buffer. | ||
| 96 | // _part : The function initializes part of the buffer, and explicitly indicates how much. | ||
| 97 | // | ||
| 98 | // Optional: Describes if the buffer itself is optional. | ||
| 99 | // | ||
| 100 | // <>   : The pointer to the buffer must not be NULL. | ||
| 101 | // _opt : The pointer to the buffer might be NULL. It will be checked before being dereferenced. | ||
| 102 | // | ||
| 103 | // String: Describes if the buffer is NULL terminated | ||
| 104 | // | ||
| 105 | // <>      : The buffer is not assumed to be NULL terminated | ||
| 106 | // _string : The buffer is assumed to be NULL terminated once it has been initialized | ||
| 107 | // | ||
| 108 | // Parameters: Gives explicit counts for the size and length of the buffer. | ||
| 109 | // | ||
| 110 | // <>            : There is no explicit count. Use when neither _ecount nor _bcount is used. | ||
| 111 | // (size)        : Only the buffer's total size is given. Use with _ecount or _bcount but not _part. | ||
| 112 | // (size,length) : The buffer's total size and initialized length are given. Use with _ecount_part | ||
| 113 | //                   and _bcount_part. | ||
| 114 | // | ||
| 115 | // Notes: | ||
| 116 | // | ||
| 117 | // 1. Specifying two buffer annotations on a single parameter results in unspecified behavior | ||
| 118 | //    (e.g. __RPC__in_bcount(5) __RPC__out_bcount(6) | ||
| 119 | //  | ||
| 120 | // 2. The size of the buffer and the amount that has been initialized are separate concepts.   | ||
| 121 | //    Specify the size using _ecount or _bcount.  Specify the amount that is initialized using  | ||
| 122 | //    _full, _part, or _string.  As a special case, a single element buffer does not need  | ||
| 123 | //    _ecount, _bcount, _full, or _part | ||
| 124 | //  | ||
| 125 | // 3. The count may be less than the total size of the buffer in which case it describes the  | ||
| 126 | //    accessible portion.  | ||
| 127 | //  | ||
| 128 | // 4. "__RPC__opt" and "__RPC_deref" are not valid annotations. | ||
| 129 | //  | ||
| 130 | // 5. The placement of _opt when using _deref is important: | ||
| 131 | //      __RPC__deref_opt_...      : Input may be NULL | ||
| 132 | //      __RPC__deref_..._opt      : Output may be NULL | ||
| 133 | //      __RPC__deref_opt_..._opt  : Both input and output may be NULL | ||
| 134 | // | ||
| 135 | |||
| 136 | #pragma once | ||
| 137 | |||
| 138 | #include <specstrings.h> | ||
| 139 | |||
| 140 | #ifndef __RPCSAL_H_VERSION__ | ||
| 141 | #define __RPCSAL_H_VERSION__        ( 100 ) | ||
| 142 | #endif // __RPCSAL_H_VERSION__ | ||
| 143 | |||
| 144 | #ifdef __REQUIRED_RPCSAL_H_VERSION__ | ||
| 145 |     #if ( __RPCSAL_H_VERSION__ < __REQUIRED_RPCSAL_H_VERSION__ ) | ||
| 146 |         #error incorrect <rpcsal.h> version. Use the header that matches with the MIDL compiler. | ||
| 147 |     #endif | ||
| 148 | #endif | ||
| 149 | |||
| 150 | |||
| 151 | #ifdef  __cplusplus | ||
| 152 | extern "C" { | ||
| 153 | #endif  // #ifdef __cplusplus | ||
| 154 | |||
| 155 | #if (_MSC_VER >= 1000) && !defined(__midl) && defined(_PREFAST_) | ||
| 156 | |||
| 157 | |||
| 158 | // [in] | ||
| 159 | #define __RPC__in                                   __pre __valid | ||
| 160 | #define __RPC__in_string                            __RPC__in   __pre __nullterminated | ||
| 161 | #define __RPC__in_ecount(size)                      __RPC__in __pre __elem_readableTo(size) | ||
| 162 | #define __RPC__in_ecount_full(size)                 __RPC__in_ecount(size) | ||
| 163 | #define __RPC__in_ecount_full_string(size)          __RPC__in_ecount_full(size) __pre __nullterminated | ||
| 164 | #define __RPC__in_ecount_part(size, length)         __RPC__in_ecount(length) __pre __elem_writableTo(size) | ||
| 165 | #define __RPC__in_ecount_full_opt(size)             __RPC__in_ecount_full(size) __pre __exceptthat  __maybenull | ||
| 166 | #define __RPC__in_ecount_full_opt_string(size)      __RPC__in_ecount_full_opt(size) __pre __nullterminated | ||
| 167 | #define __RPC__in_ecount_part_opt(size, length)     __RPC__in_ecount_part(size, length) __pre __exceptthat __maybenull | ||
| 168 | #define __RPC__in_xcount(size)                      __RPC__in __pre __elem_readableTo(size) | ||
| 169 | #define __RPC__in_xcount_full(size)                 __RPC__in_ecount(size) | ||
| 170 | #define __RPC__in_xcount_full_string(size)          __RPC__in_ecount_full(size) __pre __nullterminated | ||
| 171 | #define __RPC__in_xcount_part(size, length)         __RPC__in_ecount(length) __pre __elem_writableTo(size) | ||
| 172 | #define __RPC__in_xcount_full_opt(size)             __RPC__in_ecount_full(size) __pre __exceptthat  __maybenull | ||
| 173 | #define __RPC__in_xcount_full_opt_string(size)      __RPC__in_ecount_full_opt(size) __pre __nullterminated | ||
| 174 | #define __RPC__in_xcount_part_opt(size, length)     __RPC__in_ecount_part(size, length) __pre __exceptthat __maybenull | ||
| 175 | |||
| 176 | |||
| 177 | #define __RPC__deref_in                             __RPC__in __deref __notnull  | ||
| 178 | #define __RPC__deref_in_string                      __RPC__in   __pre __deref __nullterminated | ||
| 179 | #define __RPC__deref_in_opt                         __RPC__deref_in __deref __exceptthat __maybenull | ||
| 180 | #define __RPC__deref_in_opt_string                  __RPC__deref_in_opt __pre __deref __nullterminated | ||
| 181 | #define __RPC__deref_opt_in                         __RPC__in __exceptthat __maybenull  | ||
| 182 | #define __RPC__deref_opt_in_string                  __RPC__deref_opt_in __pre __deref __nullterminated  | ||
| 183 | #define __RPC__deref_opt_in_opt                     __RPC__deref_opt_in  __pre __deref __exceptthat __maybenull | ||
| 184 | #define __RPC__deref_opt_in_opt_string              __RPC__deref_opt_in_opt  __pre __deref __nullterminated | ||
| 185 | #define __RPC__deref_in_ecount(size)                __RPC__in __pre __deref __elem_readableTo(size) | ||
| 186 | #define __RPC__deref_in_ecount_part(size, length)   __RPC__deref_in_ecount(size)  __pre __deref __elem_readableTo(length) | ||
| 187 | #define __RPC__deref_in_ecount_full(size)           __RPC__deref_in_ecount_part(size, size) | ||
| 188 | #define __RPC__deref_in_ecount_full_opt(size)       __RPC__deref_in_ecount_full(size) __pre __deref __exceptthat __maybenull | ||
| 189 | #define __RPC__deref_in_ecount_full_opt_string(size) __RPC__deref_in_ecount_full_opt(size) __pre __deref __nullterminated | ||
| 190 | #define __RPC__deref_in_ecount_full_string(size)    __RPC__deref_in_ecount_full(size) __pre __deref __nullterminated | ||
| 191 | #define __RPC__deref_in_ecount_opt(size)            __RPC__deref_in_ecount(size) __pre __deref __exceptthat __maybenull | ||
| 192 | #define __RPC__deref_in_ecount_opt_string(size)     __RPC__deref_in_ecount_opt(size) __pre __deref __nullterminated | ||
| 193 | #define __RPC__deref_in_ecount_part_opt(size, length) __RPC__deref_in_ecount_opt(size) __pre __deref __elem_readableTo(length) | ||
| 194 | #define __RPC__deref_in_xcount(size)                __RPC__in __pre __deref __elem_readableTo(size) | ||
| 195 | #define __RPC__deref_in_xcount_part(size, length)   __RPC__deref_in_ecount(size)  __pre __deref __elem_readableTo(length) | ||
| 196 | #define __RPC__deref_in_xcount_full(size)           __RPC__deref_in_ecount_part(size, size) | ||
| 197 | #define __RPC__deref_in_xcount_full_opt(size)       __RPC__deref_in_ecount_full(size) __pre __deref __exceptthat __maybenull | ||
| 198 | #define __RPC__deref_in_xcount_full_opt_string(size) __RPC__deref_in_ecount_full_opt(size) __pre __deref __nullterminated | ||
| 199 | #define __RPC__deref_in_xcount_full_string(size)    __RPC__deref_in_ecount_full(size) __pre __deref __nullterminated | ||
| 200 | #define __RPC__deref_in_xcount_opt(size)            __RPC__deref_in_ecount(size) __pre __deref __exceptthat __maybenull | ||
| 201 | #define __RPC__deref_in_xcount_opt_string(size)     __RPC__deref_in_ecount_opt(size) __pre __deref __nullterminated | ||
| 202 | #define __RPC__deref_in_xcount_part_opt(size, length) __RPC__deref_in_ecount_opt(size) __pre __deref __elem_readableTo(length) | ||
| 203 | |||
| 204 | // [out] | ||
| 205 | #define __RPC__out                                  __out | ||
| 206 | #define __RPC__out_ecount(size)                     __out_ecount(size)  __post  __elem_writableTo(size) | ||
| 207 | #define __RPC__out_ecount_string(size)              __RPC__out_ecount(size) __post __nullterminated | ||
| 208 | #define __RPC__out_ecount_part(size, length)        __RPC__out_ecount(size)  __post  __elem_readableTo(length) | ||
| 209 | #define __RPC__out_ecount_full(size)                __RPC__out_ecount_part(size, size) | ||
| 210 | #define __RPC__out_ecount_full_string(size)         __RPC__out_ecount_full(size) __post  __nullterminated | ||
| 211 | #define __RPC__out_xcount(size)                     __out | ||
| 212 | #define __RPC__out_xcount_string(size)              __RPC__out __post __nullterminated | ||
| 213 | #define __RPC__out_xcount_part(size, length)        __RPC__out | ||
| 214 | #define __RPC__out_xcount_full(size)                __RPC__out | ||
| 215 | #define __RPC__out_xcount_full_string(size)         __RPC__out __post __nullterminated | ||
| 216 | |||
| 217 | // [in,out]  | ||
| 218 | #define __RPC__inout                                __inout | ||
| 219 | #define __RPC__inout_string                         __RPC__inout  __pre __nullterminated __post __nullterminated | ||
| 220 | #define __RPC__inout_ecount(size)                   __inout_ecount(size) | ||
| 221 | #define __RPC__inout_ecount_part(size, length)      __inout_ecount_part(size, length) | ||
| 222 | #define __RPC__inout_ecount_full(size)              __RPC__inout_ecount_part(size, size) | ||
| 223 | #define __RPC__inout_ecount_full_string(size)       __RPC__inout_ecount_full(size) __pre __nullterminated __post __nullterminated | ||
| 224 | #define __RPC__inout_xcount(size)                   __inout | ||
| 225 | #define __RPC__inout_xcount_part(size, length)      __inout | ||
| 226 | #define __RPC__inout_xcount_full(size)              __RPC__inout | ||
| 227 | #define __RPC__inout_xcount_full_string(size)       __RPC__inout __pre __nullterminated __post __nullterminated | ||
| 228 | |||
| 229 | // [in,unique]  | ||
| 230 | #define __RPC__in_opt                               __RPC__in __pre __exceptthat __maybenull | ||
| 231 | #define __RPC__in_opt_string                        __RPC__in_opt   __pre __nullterminated | ||
| 232 | #define __RPC__in_ecount_opt(size)                  __RPC__in_ecount(size) __pre __exceptthat __maybenull | ||
| 233 | #define __RPC__in_ecount_opt_string(size)           __RPC__in_ecount_opt(size) __pre __nullterminated | ||
| 234 | #define __RPC__in_xcount_opt(size)                  __RPC__in_ecount(size) __pre __exceptthat __maybenull | ||
| 235 | #define __RPC__in_xcount_opt_string(size)           __RPC__in_ecount_opt(size) __pre __nullterminated | ||
| 236 | |||
| 237 | // [in,out,unique]  | ||
| 238 | #define __RPC__inout_opt                            __inout_opt | ||
| 239 | #define __RPC__inout_opt_string                     __RPC__inout_opt  __pre __nullterminated | ||
| 240 | #define __RPC__inout_ecount_opt(size)               __inout_ecount_opt(size) | ||
| 241 | #define __RPC__inout_ecount_part_opt(size, length)  __inout_ecount_part_opt(size, length) | ||
| 242 | #define __RPC__inout_ecount_full_opt(size)          __RPC__inout_ecount_part_opt(size, size) | ||
| 243 | #define __RPC__inout_ecount_full_opt_string(size)   __RPC__inout_ecount_full_opt(size)  __pre __nullterminated __post __nullterminated | ||
| 244 | #define __RPC__inout_xcount_opt(size)               __inout_opt | ||
| 245 | #define __RPC__inout_xcount_part_opt(size, length)  __inout_opt | ||
| 246 | #define __RPC__inout_xcount_full_opt(size)          __RPC__inout_opt | ||
| 247 | #define __RPC__inout_xcount_full_opt_string(size)   __RPC__inout_opt __pre __nullterminated __post __nullterminated | ||
| 248 | |||
| 249 | // [out] ** | ||
| 250 | #define __RPC__deref_out                            __deref_out | ||
| 251 | #define __RPC__deref_out_string                     __RPC__deref_out    __post __deref __nullterminated | ||
| 252 | // Removed "__post __deref __exceptthat __maybenull" so return values from QueryInterface and the like can be trusted without an explicit NULL check. | ||
| 253 | // This is a temporary fix until midl.exe can be rev'd to produce more accurate annotations. | ||
| 254 | #define __RPC__deref_out_opt                        __RPC__deref_out | ||
| 255 | #define __RPC__deref_out_opt_string                 __RPC__deref_out_opt  __post __deref __nullterminated __pre __deref __null | ||
| 256 | #define __RPC__deref_out_ecount(size)               __deref_out_ecount(size) __post __deref __elem_writableTo(size) | ||
| 257 | #define __RPC__deref_out_ecount_part(size, length)  __RPC__deref_out_ecount(size) __post __deref __elem_readableTo(length) | ||
| 258 | #define __RPC__deref_out_ecount_full(size)          __RPC__deref_out_ecount_part(size,size) | ||
| 259 | #define __RPC__deref_out_ecount_full_string(size)   __RPC__deref_out_ecount_full(size) __post __deref __nullterminated | ||
| 260 | #define __RPC__deref_out_xcount(size)               __deref_out __post __deref | ||
| 261 | #define __RPC__deref_out_xcount_part(size, length)  __RPC__deref_out __post __deref | ||
| 262 | #define __RPC__deref_out_xcount_full(size)          __RPC__deref_out | ||
| 263 | #define __RPC__deref_out_xcount_full_string(size)   __RPC__deref_out __post __deref __nullterminated | ||
| 264 | |||
| 265 | // [in,out] **, second pointer decoration.  | ||
| 266 | #define __RPC__deref_inout                          __deref_inout | ||
| 267 | #define __RPC__deref_inout_string                   __RPC__deref_inout __pre __deref __nullterminated __post __deref __nullterminated | ||
| 268 | #define __RPC__deref_inout_opt                      __deref_inout_opt | ||
| 269 | #define __RPC__deref_inout_opt_string               __RPC__deref_inout_opt __deref __nullterminated  | ||
| 270 | #define __RPC__deref_inout_ecount_opt(size)         __deref_inout_ecount_opt(size) | ||
| 271 | #define __RPC__deref_inout_ecount_part_opt(size, length) __deref_inout_ecount_part_opt(size , length) | ||
| 272 | #define __RPC__deref_inout_ecount_full_opt(size)    __RPC__deref_inout_ecount_part_opt(size, size) | ||
| 273 | #define __RPC__deref_inout_ecount_full(size)        __deref_inout_ecount_full(size) | ||
| 274 | #define __RPC__deref_inout_ecount_full_string(size) __RPC__deref_inout_ecount_full(size) __post __deref __nullterminated | ||
| 275 | #define __RPC__deref_inout_ecount_full_opt_string(size) __RPC__deref_inout_ecount_full_opt(size) __pre __deref __nullterminated __post __deref __nullterminated | ||
| 276 | #define __RPC__deref_inout_xcount_opt(size)         __deref_inout_opt | ||
| 277 | #define __RPC__deref_inout_xcount_part_opt(size, length) __deref_inout_opt | ||
| 278 | #define __RPC__deref_inout_xcount_full_opt(size)    __RPC__deref_inout_opt | ||
| 279 | #define __RPC__deref_inout_xcount_full(size)        __deref_inout | ||
| 280 | #define __RPC__deref_inout_xcount_full_string(size) __RPC__deref_inout __post __deref __nullterminated | ||
| 281 | #define __RPC__deref_inout_xcount_full_opt_string(size) __RPC__deref_inout_opt __pre __deref __nullterminated __post __deref __nullterminated | ||
| 282 | |||
| 283 | |||
| 284 | // #define __RPC_out_opt    out_opt is not allowed in rpc | ||
| 285 | |||
| 286 | // [in,out,unique]  | ||
| 287 | #define __RPC__deref_opt_inout                          __deref_opt_inout | ||
| 288 | #define __RPC__deref_opt_inout_ecount(size)             __deref_opt_inout_ecount(size) | ||
| 289 | #define __RPC__deref_opt_inout_string                   __RPC__deref_opt_inout __pre __deref __nullterminated __post __deref __nullterminated | ||
| 290 | #define __RPC__deref_opt_inout_ecount_part(size, length) __deref_opt_inout_ecount_part(size, length) | ||
| 291 | #define __RPC__deref_opt_inout_ecount_full(size)        __deref_opt_inout_ecount_full(size) | ||
| 292 | #define __RPC__deref_opt_inout_ecount_full_string(size)  __RPC__deref_opt_inout_ecount_full(size) __pre __deref __nullterminated __post __deref __nullterminated | ||
| 293 | #define __RPC__deref_opt_inout_xcount_part(size, length) __deref_opt_inout | ||
| 294 | #define __RPC__deref_opt_inout_xcount_full(size)        __deref_opt_inout | ||
| 295 | #define __RPC__deref_opt_inout_xcount_full_string(size)  __RPC__deref_opt_inout __pre __deref __nullterminated __post __deref __nullterminated | ||
| 296 | |||
| 297 | |||
| 298 | // We don't need to specify __pre __deref __exceptthat __maybenull : this is default behavior. While this might not hold in SAL 1.1 syntax, SAL team  | ||
| 299 | // believes it's OK. We can revisit if SAL 1.1 can survive.  | ||
| 300 | #define __RPC__deref_out_ecount_opt(size)               __RPC__out_ecount(size) __post __deref __exceptthat __maybenull __pre __deref __null  | ||
| 301 | #define __RPC__deref_out_ecount_part_opt(size, length)  __RPC__deref_out_ecount_part(size, length) __post __deref __exceptthat __maybenull __pre __deref __null | ||
| 302 | #define __RPC__deref_out_ecount_full_opt(size)          __RPC__deref_out_ecount_part_opt(size, size) __pre __deref __null | ||
| 303 | #define __RPC__deref_out_ecount_full_opt_string(size)   __RPC__deref_out_ecount_part_opt(size, size) __post __deref __nullterminated __pre __deref __null | ||
| 304 | #define __RPC__deref_out_xcount_opt(size)               __RPC__out __post __deref __exceptthat __maybenull __pre __deref __null  | ||
| 305 | #define __RPC__deref_out_xcount_part_opt(size, length)  __RPC__deref_out __post __deref __exceptthat __maybenull __pre __deref __null | ||
| 306 | #define __RPC__deref_out_xcount_full_opt(size)          __RPC__deref_out_opt __pre __deref __null | ||
| 307 | #define __RPC__deref_out_xcount_full_opt_string(size)   __RPC__deref_out_opt __post __deref __nullterminated __pre __deref __null | ||
| 308 | |||
| 309 | #define __RPC__deref_opt_inout_opt                      __deref_opt_inout_opt | ||
| 310 | #define __RPC__deref_opt_inout_opt_string               __RPC__deref_opt_inout_opt __pre __deref __nullterminated  __post __deref __nullterminated | ||
| 311 | #define __RPC__deref_opt_inout_ecount_opt(size)         __deref_opt_inout_ecount_opt(size)   | ||
| 312 | #define __RPC__deref_opt_inout_ecount_part_opt(size, length) __deref_opt_inout_ecount_part_opt(size, length) | ||
| 313 | #define __RPC__deref_opt_inout_ecount_full_opt(size)    __RPC__deref_opt_inout_ecount_part_opt(size, size) | ||
| 314 | #define __RPC__deref_opt_inout_ecount_full_opt_string(size)  __RPC__deref_opt_inout_ecount_full_opt(size) __pre __deref __nullterminated __post __deref __nullterminated | ||
| 315 | #define __RPC__deref_opt_inout_xcount_opt(size)         __deref_opt_inout_opt   | ||
| 316 | #define __RPC__deref_opt_inout_xcount_part_opt(size, length) __deref_opt_inout_opt | ||
| 317 | #define __RPC__deref_opt_inout_xcount_full_opt(size)    __RPC__deref_opt_inout_opt | ||
| 318 | #define __RPC__deref_opt_inout_xcount_full_opt_string(size)  __RPC__deref_opt_inout_opt __pre __deref __nullterminated __post __deref __nullterminated | ||
| 319 | |||
| 320 | #define __RPC_full_pointer                              __maybenull  | ||
| 321 | #define __RPC_unique_pointer                            __maybenull | ||
| 322 | #define __RPC_ref_pointer                               __notnull | ||
| 323 | #define __RPC_string                                    __nullterminated | ||
| 324 | |||
| 325 | #define __RPC__range(min,max)                           __range(min,max) | ||
| 326 | #define __RPC__in_range(min,max)                        __in_range(min,max) | ||
| 327 | |||
| 328 | #else   // not prefast | ||
| 329 | |||
| 330 | #define __RPC__range(min,max) | ||
| 331 | #define __RPC__in_range(min,max) | ||
| 332 | |||
| 333 | #define __RPC__in            | ||
| 334 | #define __RPC__in_string | ||
| 335 | #define __RPC__in_opt_string | ||
| 336 | #define __RPC__in_ecount(size)  | ||
| 337 | #define __RPC__in_ecount_full(size) | ||
| 338 | #define __RPC__in_ecount_full_string(size) | ||
| 339 | #define __RPC__in_ecount_part(size, length) | ||
| 340 | #define __RPC__in_ecount_full_opt(size) | ||
| 341 | #define __RPC__in_ecount_full_opt_string(size) | ||
| 342 | #define __RPC__inout_ecount_full_opt_string(size) | ||
| 343 | #define __RPC__in_ecount_part_opt(size, length) | ||
| 344 | #define __RPC__in_xcount(size)  | ||
| 345 | #define __RPC__in_xcount_full(size) | ||
| 346 | #define __RPC__in_xcount_full_string(size) | ||
| 347 | #define __RPC__in_xcount_part(size, length) | ||
| 348 | #define __RPC__in_xcount_full_opt(size) | ||
| 349 | #define __RPC__in_xcount_full_opt_string(size) | ||
| 350 | #define __RPC__inout_xcount_full_opt_string(size) | ||
| 351 | #define __RPC__in_xcount_part_opt(size, length) | ||
| 352 | |||
| 353 | #define __RPC__deref_in  | ||
| 354 | #define __RPC__deref_in_string | ||
| 355 | #define __RPC__deref_in_opt | ||
| 356 | #define __RPC__deref_in_opt_string | ||
| 357 | #define __RPC__deref_opt_in | ||
| 358 | #define __RPC__deref_opt_in_string | ||
| 359 | #define __RPC__deref_opt_in_opt | ||
| 360 | #define __RPC__deref_opt_in_opt_string | ||
| 361 | #define __RPC__deref_in_ecount(size)  | ||
| 362 | #define __RPC__deref_in_ecount_part(size, length)  | ||
| 363 | #define __RPC__deref_in_ecount_full(size)  | ||
| 364 | #define __RPC__deref_in_ecount_full_opt(size) | ||
| 365 | #define __RPC__deref_in_ecount_full_string(size) | ||
| 366 | #define __RPC__deref_in_ecount_full_opt_string(size) | ||
| 367 | #define __RPC__deref_in_ecount_opt(size)  | ||
| 368 | #define __RPC__deref_in_ecount_opt_string(size) | ||
| 369 | #define __RPC__deref_in_ecount_part_opt(size, length)  | ||
| 370 | #define __RPC__deref_in_xcount(size)  | ||
| 371 | #define __RPC__deref_in_xcount_part(size, length)  | ||
| 372 | #define __RPC__deref_in_xcount_full(size)  | ||
| 373 | #define __RPC__deref_in_xcount_full_opt(size) | ||
| 374 | #define __RPC__deref_in_xcount_full_string(size) | ||
| 375 | #define __RPC__deref_in_xcount_full_opt_string(size) | ||
| 376 | #define __RPC__deref_in_xcount_opt(size)  | ||
| 377 | #define __RPC__deref_in_xcount_opt_string(size) | ||
| 378 | #define __RPC__deref_in_xcount_part_opt(size, length)  | ||
| 379 | |||
| 380 | // [out] | ||
| 381 | #define __RPC__out      | ||
| 382 | #define __RPC__out_ecount(size)  | ||
| 383 | #define __RPC__out_ecount_part(size, length)  | ||
| 384 | #define __RPC__out_ecount_full(size) | ||
| 385 | #define __RPC__out_ecount_full_string(size) | ||
| 386 | #define __RPC__out_xcount(size)  | ||
| 387 | #define __RPC__out_xcount_part(size, length)  | ||
| 388 | #define __RPC__out_xcount_full(size) | ||
| 389 | #define __RPC__out_xcount_full_string(size) | ||
| 390 | |||
| 391 | // [in,out]  | ||
| 392 | #define __RPC__inout                                    | ||
| 393 | #define __RPC__inout_string | ||
| 394 | #define __RPC__opt_inout | ||
| 395 | #define __RPC__inout_ecount(size)                      | ||
| 396 | #define __RPC__inout_ecount_part(size, length)     | ||
| 397 | #define __RPC__inout_ecount_full(size)           | ||
| 398 | #define __RPC__inout_ecount_full_string(size)           | ||
| 399 | #define __RPC__inout_xcount(size)                      | ||
| 400 | #define __RPC__inout_xcount_part(size, length)     | ||
| 401 | #define __RPC__inout_xcount_full(size)           | ||
| 402 | #define __RPC__inout_xcount_full_string(size)           | ||
| 403 | |||
| 404 | // [in,unique]  | ||
| 405 | #define __RPC__in_opt        | ||
| 406 | #define __RPC__in_ecount_opt(size)    | ||
| 407 | #define __RPC__in_xcount_opt(size)    | ||
| 408 | |||
| 409 | |||
| 410 | // [in,out,unique]  | ||
| 411 | #define __RPC__inout_opt     | ||
| 412 | #define __RPC__inout_opt_string     | ||
| 413 | #define __RPC__inout_ecount_opt(size)   | ||
| 414 | #define __RPC__inout_ecount_part_opt(size, length)  | ||
| 415 | #define __RPC__inout_ecount_full_opt(size)      | ||
| 416 | #define __RPC__inout_ecount_full_string(size) | ||
| 417 | #define __RPC__inout_xcount_opt(size)   | ||
| 418 | #define __RPC__inout_xcount_part_opt(size, length)  | ||
| 419 | #define __RPC__inout_xcount_full_opt(size)      | ||
| 420 | #define __RPC__inout_xcount_full_string(size) | ||
| 421 | |||
| 422 | // [out] ** | ||
| 423 | #define __RPC__deref_out    | ||
| 424 | #define __RPC__deref_out_string | ||
| 425 | #define __RPC__deref_out_opt  | ||
| 426 | #define __RPC__deref_out_opt_string | ||
| 427 | #define __RPC__deref_out_ecount(size)  | ||
| 428 | #define __RPC__deref_out_ecount_part(size, length)  | ||
| 429 | #define __RPC__deref_out_ecount_full(size)   | ||
| 430 | #define __RPC__deref_out_ecount_full_string(size) | ||
| 431 | #define __RPC__deref_out_xcount(size)  | ||
| 432 | #define __RPC__deref_out_xcount_part(size, length)  | ||
| 433 | #define __RPC__deref_out_xcount_full(size)   | ||
| 434 | #define __RPC__deref_out_xcount_full_string(size) | ||
| 435 | |||
| 436 | |||
| 437 | // [in,out] **, second pointer decoration.  | ||
| 438 | #define __RPC__deref_inout     | ||
| 439 | #define __RPC__deref_inout_string | ||
| 440 | #define __RPC__deref_inout_opt  | ||
| 441 | #define __RPC__deref_inout_opt_string | ||
| 442 | #define __RPC__deref_inout_ecount_full(size) | ||
| 443 | #define __RPC__deref_inout_ecount_full_string(size) | ||
| 444 | #define __RPC__deref_inout_ecount_opt(size)  | ||
| 445 | #define __RPC__deref_inout_ecount_part_opt(size, length)  | ||
| 446 | #define __RPC__deref_inout_ecount_full_opt(size)  | ||
| 447 | #define __RPC__deref_inout_ecount_full_opt_string(size)  | ||
| 448 | #define __RPC__deref_inout_xcount_full(size) | ||
| 449 | #define __RPC__deref_inout_xcount_full_string(size) | ||
| 450 | #define __RPC__deref_inout_xcount_opt(size)  | ||
| 451 | #define __RPC__deref_inout_xcount_part_opt(size, length)  | ||
| 452 | #define __RPC__deref_inout_xcount_full_opt(size)  | ||
| 453 | #define __RPC__deref_inout_xcount_full_opt_string(size)  | ||
| 454 | |||
| 455 | // #define __RPC_out_opt    out_opt is not allowed in rpc | ||
| 456 | |||
| 457 | // [in,out,unique]  | ||
| 458 | #define __RPC__deref_opt_inout   | ||
| 459 | #define __RPC__deref_opt_inout_string | ||
| 460 | #define __RPC__deref_opt_inout_ecount(size)      | ||
| 461 | #define __RPC__deref_opt_inout_ecount_part(size, length)  | ||
| 462 | #define __RPC__deref_opt_inout_ecount_full(size)  | ||
| 463 | #define __RPC__deref_opt_inout_ecount_full_string(size) | ||
| 464 | #define __RPC__deref_opt_inout_xcount(size)      | ||
| 465 | #define __RPC__deref_opt_inout_xcount_part(size, length)  | ||
| 466 | #define __RPC__deref_opt_inout_xcount_full(size)  | ||
| 467 | #define __RPC__deref_opt_inout_xcount_full_string(size) | ||
| 468 | |||
| 469 | #define __RPC__deref_out_ecount_opt(size)  | ||
| 470 | #define __RPC__deref_out_ecount_part_opt(size, length)  | ||
| 471 | #define __RPC__deref_out_ecount_full_opt(size)  | ||
| 472 | #define __RPC__deref_out_ecount_full_opt_string(size) | ||
| 473 | #define __RPC__deref_out_xcount_opt(size)  | ||
| 474 | #define __RPC__deref_out_xcount_part_opt(size, length)  | ||
| 475 | #define __RPC__deref_out_xcount_full_opt(size)  | ||
| 476 | #define __RPC__deref_out_xcount_full_opt_string(size) | ||
| 477 | |||
| 478 | #define __RPC__deref_opt_inout_opt       | ||
| 479 | #define __RPC__deref_opt_inout_opt_string | ||
| 480 | #define __RPC__deref_opt_inout_ecount_opt(size)    | ||
| 481 | #define __RPC__deref_opt_inout_ecount_part_opt(size, length)  | ||
| 482 | #define __RPC__deref_opt_inout_ecount_full_opt(size)  | ||
| 483 | #define __RPC__deref_opt_inout_ecount_full_opt_string(size)  | ||
| 484 | #define __RPC__deref_opt_inout_xcount_opt(size)    | ||
| 485 | #define __RPC__deref_opt_inout_xcount_part_opt(size, length)  | ||
| 486 | #define __RPC__deref_opt_inout_xcount_full_opt(size)  | ||
| 487 | #define __RPC__deref_opt_inout_xcount_full_opt_string(size)  | ||
| 488 | |||
| 489 | #define __RPC_full_pointer   | ||
| 490 | #define __RPC_unique_pointer | ||
| 491 | #define __RPC_ref_pointer | ||
| 492 | #define __RPC_string                                | ||
| 493 | |||
| 494 | |||
| 495 | #endif | ||
| 496 | |||
| 497 | #ifdef  __cplusplus | ||
| 498 | } | ||
| 499 | #endif |