1 /* 2 * sal_old.h 3 * 4 * Old style Standard Annotation Language (SAL) definitions 5 * 6 * This file is part of the ReactOS PSDK package. 7 * 8 * Contributors: 9 * Timo Kreuzer (timo.kreuzer@reactos.org) 10 * 11 * THIS SOFTWARE IS NOT COPYRIGHTED 12 * 13 * This source code is offered for use in the public domain. You may 14 * use, modify or distribute it freely. 15 * 16 * This code is distributed in the hope that it will be useful but 17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 18 * DISCLAIMED. This includes but is not limited to warranties of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 */ 22 23 #pragma once 24 #define __specstrings 25 26 #ifdef __cplusplus 27 #ifndef __nothrow 28 #define __nothrow __declspec(nothrow) 29 #endif 30 #else 31 #ifndef __nothrow 32 #define __nothrow 33 #endif 34 #endif 35 36 37 #if defined(_PREFAST_) && !defined(__midl) 38 39 #define SPECSTRINGIZE(x) #x 40 #define __byte_readableTo(size) __declspec("SAL_readableTo(byteCount("SPECSTRINGIZE(size)"))") 41 #define __byte_writableTo(size) __declspec("SAL_writableTo(byteCount("SPECSTRINGIZE(size)"))") 42 #define __deref __declspec("SAL_deref") 43 #define __elem_readableTo(size) __declspec("SAL_readableTo(elementCount("SPECSTRINGIZE(size)"))") 44 #define __elem_writableTo(size) __declspec("SAL_writableTo(elementCount("SPECSTRINGIZE(size)"))") 45 #define __exceptthat __declspec("SAL_except") 46 #define __execeptthat __exceptthat 47 #define __inner_blocksOn(resource) __declspec("SAL_blocksOn("SPECSTRINGIZE(resource)")") 48 #define __inner_checkReturn __declspec("SAL_checkReturn") 49 #define __inner_control_entrypoint(category) __declspec("SAL_entrypoint(controlEntry, "SPECSTRINGIZE(category)")") 50 #define __inner_data_entrypoint(category) __declspec("SAL_entrypoint(dataEntry, "SPECSTRINGIZE(category)")") 51 #define __inner_fallthrough __FallThrough(); 52 #define __inner_fallthrough_dec __inline __nothrow void __FallThrough() {} 53 #define __inner_override __declspec("__override") 54 #define __inner_success(expr) __declspec("SAL_success("SPECSTRINGIZE(expr)")") 55 #define __maybenull __declspec("SAL_maybenull") 56 #define __maybereadonly __declspec("SAL_maybereadonly") 57 #define __maybevalid __declspec("SAL_maybevalid") 58 #define __notnull __declspec("SAL_notnull") 59 #define __notreadonly __declspec("SAL_notreadonly") 60 #define __notvalid __declspec("SAL_notvalid") 61 #define __null __declspec("SAL_null") 62 #define __post __declspec("SAL_post") 63 #define __postcond(expr) __post 64 #define __pre __declspec("SAL_pre") 65 #define __precond(expr) __pre 66 #define __readableTo(extent) __declspec("SAL_readableTo("SPECSTRINGIZE(extent)")") 67 #define __readonly __declspec("SAL_readonly") 68 #define __refparam __deref __notreadonly 69 #define __valid __declspec("SAL_valid") 70 #define __writableTo(size) __declspec("SAL_writableTo("SPECSTRINGIZE(size)")") 71 72 #else 73 74 #define __byte_readableTo(size) 75 #define __byte_writableTo(size) 76 #define __deref 77 #define __elem_readableTo(size) 78 #define __elem_writableTo(size) 79 #define __exceptthat 80 #define __execeptthat 81 #define __inner_blocksOn(resource) 82 #define __inner_checkReturn 83 #define __inner_control_entrypoint(category) 84 #define __inner_data_entrypoint(category) 85 #define __inner_fallthrough 86 #define __inner_fallthrough_dec 87 #define __inner_override 88 #define __inner_success(expr) 89 #define __inner_typefix(ctype) 90 #define __maybenull 91 #define __maybereadonly 92 #define __maybevalid 93 #define __notnull 94 #define __notreadonly 95 #define __notvalid 96 #define __null 97 #define __post 98 #define __postcond(expr) 99 #define __pre 100 #define __precond(expr) 101 #define __readableTo(extent) 102 #define __readonly 103 #define __refparam 104 #define __valid 105 #define __writableTo(size) 106 107 #endif /* defined(_PREFAST_) && !defined(__midl) */ 108 109 #define __bcount_opt(size) __bcount(size) __exceptthat __maybenull 110 #define __bcount(size) __notnull __byte_writableTo(size) 111 #define __blocksOn(resource) __inner_blocksOn(resource) 112 #define __callback __inner_callback 113 #define __checkReturn __inner_checkReturn 114 #define __control_entrypoint(category) __inner_control_entrypoint(category) 115 #define __data_entrypoint(category) __inner_data_entrypoint(category) 116 #define __deref_bcount_opt(size) __deref_bcount(size) __post __deref __exceptthat __maybenull 117 #define __deref_bcount(size) __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __byte_writableTo(size) 118 #define __deref_ecount_opt(size) __deref_ecount(size) __post __deref __exceptthat __maybenull 119 #define __deref_ecount(size) __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __elem_writableTo(size) 120 #define __deref_inout __notnull __elem_readableTo(1) __pre __deref __valid __post __deref __valid __refparam 121 #define __deref_inout_bcount_full_opt(size) __deref_inout_bcount_full(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull 122 #define __deref_inout_bcount_full(size) __deref_inout_bcount_part(size,size) 123 #define __deref_inout_bcount_nz_opt(size) __deref_inout_bcount_opt(size) 124 #define __deref_inout_bcount_nz(size) __deref_inout_ecount(size) 125 #define __deref_inout_bcount_opt(size) __deref_inout_bcount(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull 126 #define __deref_inout_bcount_part_opt(size,length) __deref_inout_bcount_part(size,length) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull 127 #define __deref_inout_bcount_part(size,length) __deref_inout_bcount(size) __pre __deref __byte_readableTo(length) __post __deref __byte_readableTo(length) 128 #define __deref_inout_bcount_z_opt(size) __deref_inout_bcount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated 129 #define __deref_inout_bcount_z(size) __deref_inout_bcount(size) __pre __deref __nullterminated __post __deref __nullterminated 130 #define __deref_inout_bcount(size) __deref_inout __pre __deref __byte_writableTo(size) __post __deref __byte_writableTo(size) 131 #define __deref_inout_ecount_full_opt(size) __deref_inout_ecount_full(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull 132 #define __deref_inout_ecount_full(size) __deref_inout_ecount_part(size,size) 133 #define __deref_inout_ecount_nz_opt(size) __deref_inout_ecount_opt(size) 134 #define __deref_inout_ecount_nz(size) __deref_inout_ecount(size) 135 #define __deref_inout_ecount_opt(size) __deref_inout_ecount(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull 136 #define __deref_inout_ecount_part_opt(size,length) __deref_inout_ecount_part(size,length) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull 137 #define __deref_inout_ecount_part(size,length) __deref_inout_ecount(size) __pre __deref __elem_readableTo(length) __post __deref __elem_readableTo(length) 138 #define __deref_inout_ecount_z_opt(size) __deref_inout_ecount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated 139 #define __deref_inout_ecount_z(size) __deref_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated 140 #define __deref_inout_ecount(size) __deref_inout __pre __deref __elem_writableTo(size) __post __deref __elem_writableTo(size) 141 #define __deref_inout_nz __deref_inout 142 #define __deref_inout_nz_opt __deref_inout_opt 143 #define __deref_inout_opt __deref_inout __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull 144 #define __deref_inout_z __deref_inout __pre __deref __nullterminated __post __deref __nullterminated 145 #define __deref_inout_z_opt __deref_inout_opt __pre __deref __nullterminated __post __deref __nullterminated 146 #define __deref_opt_bcount_opt(size) __deref_bcount_opt(size) __exceptthat __maybenull 147 #define __deref_opt_bcount(size) __deref_bcount(size) __exceptthat __maybenull 148 #define __deref_opt_ecount_opt(size) __deref_ecount_opt(size) __exceptthat __maybenull 149 #define __deref_opt_ecount(size) __deref_ecount(size) __exceptthat __maybenull 150 #define __deref_opt_inout __deref_inout __exceptthat __maybenull 151 #define __deref_opt_inout_bcount_full_opt(size) __deref_inout_bcount_full_opt(size) __exceptthat __maybenull 152 #define __deref_opt_inout_bcount_full(size) __deref_inout_bcount_full(size) __exceptthat __maybenull 153 #define __deref_opt_inout_bcount_nz_opt(size) __deref_opt_inout_bcount_opt(size) 154 #define __deref_opt_inout_bcount_nz(size) __deref_opt_inout_bcount(size) 155 #define __deref_opt_inout_bcount_opt(size) __deref_inout_bcount_opt(size) __exceptthat __maybenull 156 #define __deref_opt_inout_bcount_part_opt(size,length) __deref_inout_bcount_part_opt(size,length) __exceptthat __maybenull 157 #define __deref_opt_inout_bcount_part(size,length) __deref_inout_bcount_part(size,length) __exceptthat __maybenull 158 #define __deref_opt_inout_bcount_z_opt(size) __deref_opt_inout_bcount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated 159 #define __deref_opt_inout_bcount_z(size) __deref_opt_inout_bcount(size) __pre __deref __nullterminated __post __deref __nullterminated 160 #define __deref_opt_inout_bcount(size) __deref_inout_bcount(size) __exceptthat __maybenull 161 #define __deref_opt_inout_ecount_full_opt(size) __deref_inout_ecount_full_opt(size) __exceptthat __maybenull 162 #define __deref_opt_inout_ecount_full(size) __deref_inout_ecount_full(size) __exceptthat __maybenull 163 #define __deref_opt_inout_ecount_nz_opt(size) __deref_opt_inout_ecount_opt(size) 164 #define __deref_opt_inout_ecount_nz(size) __deref_opt_inout_ecount(size) 165 #define __deref_opt_inout_ecount_opt(size) __deref_inout_ecount_opt(size) __exceptthat __maybenull 166 #define __deref_opt_inout_ecount_part_opt(size,length) __deref_inout_ecount_part_opt(size,length) __exceptthat __maybenull 167 #define __deref_opt_inout_ecount_part(size,length) __deref_inout_ecount_part(size,length) __exceptthat __maybenull 168 #define __deref_opt_inout_ecount_z_opt(size) __deref_opt_inout_ecount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated 169 #define __deref_opt_inout_ecount_z(size) __deref_opt_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated 170 #define __deref_opt_inout_ecount(size) __deref_inout_ecount(size) __exceptthat __maybenull 171 #define __deref_opt_inout_nz __deref_opt_inout 172 #define __deref_opt_inout_nz_opt __deref_opt_inout_opt 173 #define __deref_opt_inout_opt __deref_inout_opt __exceptthat __maybenull 174 #define __deref_opt_inout_z __deref_opt_inout __pre __deref __nullterminated __post __deref __nullterminated 175 #define __deref_opt_inout_z_opt __deref_opt_inout_opt __pre __deref __nullterminated __post __deref __nullterminated 176 #define __deref_opt_out __deref_out __exceptthat __maybenull 177 #define __deref_opt_out_bcount_full_opt(size) __deref_out_bcount_full_opt(size) __exceptthat __maybenull 178 #define __deref_opt_out_bcount_full(size) __deref_out_bcount_full(size) __exceptthat __maybenull 179 #define __deref_opt_out_bcount_nz_opt(size) __deref_opt_out_bcount_opt(size) 180 #define __deref_opt_out_bcount_opt(size) __deref_out_bcount_opt(size) __exceptthat __maybenull 181 #define __deref_opt_out_bcount_part_opt(size,length) __deref_out_bcount_part_opt(size,length) __exceptthat __maybenull 182 #define __deref_opt_out_bcount_part(size,length) __deref_out_bcount_part(size,length) __exceptthat __maybenull 183 #define __deref_opt_out_bcount_z_opt(size) __deref_opt_out_bcount_opt(size) __post __deref __nullterminated 184 #define __deref_opt_out_bcount(size) __deref_out_bcount(size) __exceptthat __maybenull 185 #define __deref_opt_out_ecount_full_opt(size) __deref_out_ecount_full_opt(size) __exceptthat __maybenull 186 #define __deref_opt_out_ecount_full(size) __deref_out_ecount_full(size) __exceptthat __maybenull 187 #define __deref_opt_out_ecount_nz_opt(size) __deref_opt_out_ecount_opt(size) 188 #define __deref_opt_out_ecount_opt(size) __deref_out_ecount_opt(size) __exceptthat __maybenull 189 #define __deref_opt_out_ecount_part_opt(size,length) __deref_out_ecount_part_opt(size,length) __exceptthat __maybenull 190 #define __deref_opt_out_ecount_part(size,length) __deref_out_ecount_part(size,length) __exceptthat __maybenull 191 #define __deref_opt_out_ecount_z_opt(size) __deref_opt_out_ecount_opt(size) __post __deref __nullterminated 192 #define __deref_opt_out_ecount(size) __deref_out_ecount(size) __exceptthat __maybenull 193 #define __deref_opt_out_nz_opt __deref_opt_out_opt 194 #define __deref_opt_out_opt __deref_out_opt __exceptthat __maybenull 195 #define __deref_opt_out_z __deref_opt_out __post __deref __nullterminated 196 #define __deref_opt_out_z_opt __post __deref __valid __refparam __exceptthat __maybenull __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull __post __deref __nullterminated 197 #define __deref_out __deref_ecount(1) __post __deref __valid __refparam 198 #define __deref_out_bcount_full_opt(size) __deref_out_bcount_full(size) __post __deref __exceptthat __maybenull 199 #define __deref_out_bcount_full(size) __deref_out_bcount_part(size,size) 200 #define __deref_out_bcount_nz_opt(size) __deref_out_bcount_opt(size) 201 #define __deref_out_bcount_nz(size) __deref_out_ecount(size) 202 #define __deref_out_bcount_opt(size) __deref_out_bcount(size) __post __deref __exceptthat __maybenull 203 #define __deref_out_bcount_part_opt(size,length) __deref_out_bcount_part(size,length) __post __deref __exceptthat __maybenull 204 #define __deref_out_bcount_part(size,length) __deref_out_bcount(size) __post __deref __byte_readableTo(length) 205 #define __deref_out_bcount_z_opt(size) __deref_out_bcount_opt(size) __post __deref __nullterminated 206 #define __deref_out_bcount_z(size) __deref_out_ecount(size) __post __deref __nullterminated 207 #define __deref_out_bcount(size) __deref_bcount(size) __post __deref __valid __refparam 208 #define __deref_out_ecount_full_opt(size) __deref_out_ecount_full(size) __post __deref __exceptthat __maybenull 209 #define __deref_out_ecount_full(size) __deref_out_ecount_part(size,size) 210 #define __deref_out_ecount_nz_opt(size) __deref_out_ecount_opt(size) 211 #define __deref_out_ecount_nz(size) __deref_out_ecount(size) 212 #define __deref_out_ecount_opt(size) __deref_out_ecount(size) __post __deref __exceptthat __maybenull 213 #define __deref_out_ecount_part_opt(size,length) __deref_out_ecount_part(size,length) __post __deref __exceptthat __maybenull 214 #define __deref_out_ecount_part(size,length) __deref_out_ecount(size) __post __deref __elem_readableTo(length) 215 #define __deref_out_ecount_z_opt(size) __deref_out_ecount_opt(size) __post __deref __nullterminated 216 #define __deref_out_ecount_z(size) __deref_out_ecount(size) __post __deref __nullterminated 217 #define __deref_out_ecount(size) __deref_ecount(size) __post __deref __valid __refparam 218 #define __deref_out_nz __deref_out 219 #define __deref_out_nz_opt __deref_out_opt 220 #define __deref_out_range(x,y) /* FIXME */ 221 #define __deref_out_opt __deref_out __post __deref __exceptthat __maybenull 222 #define __deref_out_z __post __deref __valid __refparam __post __deref __nullterminated 223 #define __deref_out_z_opt __post __deref __valid __refparam __execeptthat __maybenull __post __deref __nullterminated 224 #define __ecount_opt(size) __ecount(size) __exceptthat __maybenull 225 #define __ecount(size) __notnull __elem_writableTo(size) 226 #define __format_string 227 #define __in __pre __valid __pre __deref __readonly 228 #define __in_bcount_nz_opt(size) __in_bcount_opt(size) 229 #define __in_bcount_nz(size) __in_bcount(size) 230 #define __in_bcount_opt(size) __in_bcount(size) __exceptthat __maybenull 231 #define __in_bcount_z_opt(size) __in_bcount_opt(size) __pre __nullterminated 232 #define __in_bcount_z(size) __in_bcount(size) __pre __nullterminated 233 #define __in_bcount(size) __in __pre __byte_readableTo(size) 234 #define __in_ecount_nz_opt(size) __in_ecount_opt(size) 235 #define __in_ecount_nz(size) __in_ecount(size) 236 #define __in_ecount_opt(size) __in_ecount(size) __exceptthat __maybenull 237 #define __in_ecount_z_opt(size) __in_ecount_opt(size) __pre __nullterminated 238 #define __in_ecount_z(size) __in_ecount(size) __pre __nullterminated 239 #define __in_ecount(size) __in __pre __elem_readableTo(size) 240 #define __in_nz __in 241 #define __in_nz_opt __in_opt 242 #define __in_opt __in __exceptthat __maybenull 243 #define __in_z __in __pre __nullterminated 244 #define __in_z_opt __in_opt __pre __nullterminated 245 #define __inout __pre __valid __post __valid __refparam 246 #define __inout_bcount_full_opt(size) __inout_bcount_full(size) __exceptthat __maybenull 247 #define __inout_bcount_full(size) __inout_bcount_part(size,size) 248 #define __inout_bcount_nz_opt(size) __inout_bcount_opt(size) 249 #define __inout_bcount_nz(size) __inout_bcount(size) 250 #define __inout_bcount_opt(size) __inout_bcount(size) __exceptthat __maybenull 251 #define __inout_bcount_part_opt(size,length) __inout_bcount_part(size,length) __exceptthat __maybenull 252 #define __inout_bcount_part(size,length) __out_bcount_part(size,length) __pre __valid __pre __byte_readableTo(length) 253 #define __inout_bcount_z_opt(size) __inout_bcount_opt(size) 254 #define __inout_bcount_z(size) __inout_bcount(size) __pre __nullterminated __post __nullterminated 255 #define __inout_bcount(size) __out_bcount(size) __pre __valid 256 #define __inout_ecount_full_opt(size) __inout_ecount_full(size) __exceptthat __maybenull 257 #define __inout_ecount_full(size) __inout_ecount_part(size,size) 258 #define __inout_ecount_nz_opt(size) __inout_ecount_opt(size) 259 #define __inout_ecount_nz(size) __inout_ecount(size) 260 #define __inout_ecount_opt(size) __inout_ecount(size) __exceptthat __maybenull 261 #define __inout_ecount_part_opt(size,length) __inout_ecount_part(size,length) __exceptthat __maybenull 262 #define __inout_ecount_part(size,length) __out_ecount_part(size,length) __pre __valid __pre __elem_readableTo(length) 263 #define __inout_ecount_z_opt(size) __inout_ecount_opt(size) __pre __nullterminated __post __nullterminated 264 #define __inout_ecount_z(size) __inout_ecount(size) __pre __nullterminated __post __nullterminated 265 #define __inout_ecount(size) __out_ecount(size) __pre __valid 266 #define __inout_nz __inout 267 #define __inout_nz_opt __inout_opt 268 #define __inout_opt __inout __exceptthat __maybenull 269 #define __inout_z __inout __pre __nullterminated __post __nullterminated 270 #define __inout_z_opt __inout_opt __pre __nullterminated __post __nullterminated 271 #define __nullnullterminated 272 #define __nullterminated __readableTo(sentinel(0)) 273 #define __out __ecount(1) __post __valid __refparam 274 #define __out_bcount_full_opt(size) __out_bcount_full(size) __exceptthat __maybenull 275 #define __out_bcount_full_z_opt(size) __out_bcount_full_opt(size) __post __nullterminated 276 #define __out_bcount_full_z(size) __out_bcount_full(size) __post __nullterminated 277 #define __out_bcount_full(size) __out_bcount_part(size,size) 278 #define __out_bcount_nz_opt(size) __out_bcount_opt(size) __post __nullterminated 279 #define __out_bcount_nz(size) __bcount(size) __post __valid __refparam 280 #define __out_bcount_opt(size) __out_bcount(size) __exceptthat __maybenull 281 #define __out_bcount_part_opt(size,length) __out_bcount_part(size,length) __exceptthat __maybenull 282 #define __out_bcount_part_z_opt(size,length) __out_bcount_part_opt(size,length) __post __nullterminated 283 #define __out_bcount_part_z(size,length) __out_bcount_part(size,length) __post __nullterminated 284 #define __out_bcount_part(size,length) __out_bcount(size) __post __byte_readableTo(length) 285 #define __out_bcount_z_opt(size) __out_bcount_opt(size) __post __nullterminated 286 #define __out_bcount_z(size) __bcount(size) __post __valid __refparam __post __nullterminated 287 #define __out_bcount(size) __bcount(size) __post __valid __refparam 288 #define __out_ecount_full_opt(size) __out_ecount_full(size) __exceptthat __maybenull 289 #define __out_ecount_full_z_opt(size) __out_ecount_full_opt(size) __post __nullterminated 290 #define __out_ecount_full_z(size) __out_ecount_full(size) __post __nullterminated 291 #define __out_ecount_full(size) __out_ecount_part(size,size) 292 #define __out_ecount_nz_opt(size) __out_ecount_opt(size) __post __nullterminated 293 #define __out_ecount_nz(size) __ecount(size) __post __valid __refparam 294 #define __out_ecount_opt(size) __out_ecount(size) __exceptthat __maybenull 295 #define __out_ecount_part_opt(size,length) __out_ecount_part(size,length) __exceptthat __maybenull 296 #define __out_ecount_part_z_opt(size,length) __out_ecount_part_opt(size,length) __post __nullterminated 297 #define __out_ecount_part_z(size,length) __out_ecount_part(size,length) __post __nullterminated 298 #define __out_ecount_part(size,length) __out_ecount(size) __post __elem_readableTo(length) 299 #define __out_ecount_z_opt(size) __out_ecount_opt(size) __post __nullterminated 300 #define __out_ecount_z(size) __ecount(size) __post __valid __refparam __post __nullterminated 301 #define __out_ecount(size) __ecount(size) __post __valid __refparam 302 #define __out_nz __post __valid __refparam __post 303 #define __out_nz_opt __post __valid __refparam __post __exceptthat __maybenull 304 #define __out_opt __out __exceptthat __maybenull 305 #define __out_z __post __valid __refparam __post __nullterminated 306 #define __out_z_opt __post __valid __refparam __post __nullterminated __exceptthat __maybenull 307 #define __override __inner_override 308 #define __reserved __pre __null 309 #define __success(expr) __inner_success(expr) 310 #define __typefix(ctype) __inner_typefix(ctype) 311 312 #ifndef __fallthrough 313 __inner_fallthrough_dec 314 #define __fallthrough __inner_fallthrough 315 #endif 316 317