1 /***
2 *sal.h - markers for documenting the semantics of APIs
3 *
4 *           Copyright (c) Microsoft Corporation. All rights reserved.
5 *
6 *Purpose:
7 *           sal.h provides a set of annotations to describe how a function uses its
8 *           parameters - the assumptions it makes about them, and the guarantees it makes
9 *           upon finishing.
10 *
11 *           [Public]
12 *
13 ****/
14
15 #pragma once
16 /*==========================================================================
17
18      The macros are defined in 3 layers:
19
20      _In_\_Out_ Layer:
21      ----------------
22      This layer provides the highest abstraction and its macros should be used
23      in most cases. Its macros start with _In_, _Out_ or _Inout_. For the
24      typical case they provide the most concise annotations.
25
26      _Pre_\_Post_ Layer:
27      ------------------
28      The macros of this layer only should be used when there is no suitable macro
29      in the _In_\_Out_ layer. Its macros start with _Pre_, _Post_, _Ret_,
30      _Deref_pre_ _Deref_post_ and _Deref_ret_. This layer provides the most
31      flexibility for annotations.
32
33      Implementation Abstraction Layer:
34      --------------------------------
35      Macros from this layer should never be used directly. The layer only exists
36      to hide the implementation of the annotation macros.
37
38
39      Annotation Syntax:
40      |--------------|----------|----------------|-----------------------------|
41      |     Usage          | Nullness | ZeroTerminated |  Extent                                   |
42      |--------------|----------|----------------|-----------------------------|
43      | _In_               | <>           | <>                     | <>                                           |
44      | _Out_             | opt_        | z_                     | [byte]cap_[c_|x_]( size )     |
45      | _Inout_          |                |                          | [byte]count_[c_|x_]( size ) |
46      | _Deref_out_  |                |                          | ptrdiff_cap_( ptr )               |
47      |--------------|                |                          | ptrdiff_count_( ptr )           |
48      | _Ret_             |                |                          |                                                |
49      | _Deref_ret_  |                |                          |                                                |
50      |--------------|                |                          |                                                |
Lines 51 ... 1072 are skipped.
1073
1074 #define _$bytecount(size)     __declspec("SAL_readableTo(byteCount("_$SPECSTRIZE(size)"))")
1075 #define _$bytecount_c(size) __declspec("SAL_readableTo(byteCount("_$SPECSTRIZE(size)"))")
1076 #define _$bytecount_x(size) __declspec("SAL_readableTo(inexpressibleCount('"_$SPECSTRIZE(size)"'))")
1077
1078 #define _$pre             __declspec("SAL_pre")
1079 #define _$post           __declspec("SAL_post")
1080 #define _$deref_pre  __declspec("SAL_pre")  __declspec("SAL_deref")
1081 #define _$deref_post __declspec("SAL_post") __declspec("SAL_deref")
1082
1083 #define _$bound                __declspec("SAL_bound")
1084 #define _$range(min,max) __declspec("SAL_range("_$SPECSTRIZE(min)","_$SPECSTRIZE(max)")")
1085
1086 #define _Pre1_impl_(p1)                                 _$pre p1
1087 #define _Pre2_impl_(p1,p2)                            _$pre p1 _$pre p2
1088 #define _Pre3_impl_(p1,p2,p3)                       _$pre p1 _$pre p2 _$pre p3
1089
1090 #define _Post1_impl_(p1)                               _$post p1
1091 #define _Post2_impl_(p1,p2)                          _$post p1 _$post p2
1092 #define _Post3_impl_(p1,p2,p3)                     _$post p1 _$post p2 _$post p3
1093
1094 #define _Ret1_impl_(p1)                                 _$post p1
1095 #define _Ret2_impl_(p1,p2)                            _$post p1 _$post p2
1096 #define _Ret3_impl_(p1,p2,p3)                       _$post p1 _$post p2 _$post p3
1097
1098 #define _Deref_pre1_impl_(p1)                       _$deref_pre p1
1099 #define _Deref_pre2_impl_(p1,p2)                  _$deref_pre p1 _$deref_pre p2
1100 #define _Deref_pre3_impl_(p1,p2,p3)             _$deref_pre p1 _$deref_pre p2 _$deref_pre p3
1101
1102 #define _Deref_post1_impl_(p1)                     _$deref_post p1
1103 #define _Deref_post2_impl_(p1,p2)                _$deref_post p1 _$deref_post p2
1104 #define _Deref_post3_impl_(p1,p2,p3)           _$deref_post p1 _$deref_post p2 _$deref_post p3
1105
1106 #define _Deref_ret1_impl_(p1)                       _$deref_post p1
1107 #define _Deref_ret2_impl_(p1,p2)                  _$deref_post p1 _$deref_post p2
1108 #define _Deref_ret3_impl_(p1,p2,p3)             _$deref_post p1 _$deref_post p2 _$deref_post p3
1109
1110 #define _Deref2_pre1_impl_(p1)                     _$deref_pre __declspec("SAL_deref") p1
1111 #define _Deref2_post1_impl_(p1)                    _$deref_post __declspec("SAL_deref") p1
1112 #define _Deref2_ret1_impl_(p1)                     _$deref_post __declspec("SAL_deref") p1
1113
1114 #elif defined(_MSC_EXTENSIONS) && !defined( MIDL_PASS ) && !defined(__midl) && !defined(RC_INVOKED) && defined(_PFT_VER) && _MSC_VER >= 1400
1115
1116 // minimum attribute expansion for foreground build
1117
1118 #pragma push_macro( "SA" )
1119 #pragma push_macro( "REPEATABLE" )
1120
1121 #ifdef __cplusplus
1122 #define SA( id ) id
1123 #define REPEATABLE [repeatable]
1124 #else  // !__cplusplus
1125 #define SA( id ) SA_##id
1126 #define REPEATABLE
1127 #endif  // !__cplusplus
1128
1129 REPEATABLE
1130 [source_annotation_attribute( SA( Parameter ) )]
1131 struct _$P
1132 {
1133 #ifdef __cplusplus
1134     _$P();
1135 #endif
1136      int _$d;
1137 };
1138 typedef struct _$P _$P;
1139
1140 REPEATABLE
1141 [source_annotation_attribute( SA( ReturnValue ) )]
1142 struct _$R
1143 {
1144 #ifdef __cplusplus
1145     _$R();
1146 #endif
1147      int _$d;
1148 };
1149 typedef struct _$R _$R;
1150
1151 [source_annotation_attribute( SA( Method ) )]
1152 struct _$M
1153 {
1154 #ifdef __cplusplus
1155     _$M();
1156 #endif
1157      int _$d;
1158 };
1159 typedef struct _$M _$M;
1160
1161 #pragma pop_macro( "REPEATABLE" )
1162 #pragma pop_macro( "SA" )
1163
1164 #define _Check_return_impl_ [returnvalue:_$R(_$d=0)]
1165
1166 #define _Success_impl_(expr) [_$M(_$d=0)]
1167
1168 #define _Printf_format_string_impl_     [_$P(_$d=0)]
1169 #define _Scanf_format_string_impl_      [_$P(_$d=0)]
1170 #define _Scanf_s_format_string_impl_  [_$P(_$d=0)]
1171
1172 #define _In_bound_impl_                  [_$P(_$d=0)]
1173 #define _Out_bound_impl_                [_$P(_$d=0)]
1174 #define _Ret_bound_impl_                [returnvalue:_$R(_$d=0)]
1175 #define _Deref_in_bound_impl_        [_$P(_$d=0)]
Lines 1176 ... 1472 are skipped.
1473 #define __specstrings
1474
1475 #ifdef  __cplusplus
1476 #ifndef __nothrow
1477 # define __nothrow __declspec(nothrow)
1478 #endif
1479 extern "C" {
1480 #else
1481 #ifndef __nothrow
1482 # define __nothrow
1483 #endif
1484 #endif  /* #ifdef __cplusplus */
1485
1486
1487 /*
1488  -------------------------------------------------------------------------------
1489  Helper Macro Definitions
1490
1491  These express behavior common to many of the high-level annotations.
1492  DO NOT USE THESE IN YOUR CODE.
1493  -------------------------------------------------------------------------------
1494 */
1495
1496 /*
1497 The helper annotations are only understood by the compiler version used by various
1498 defect detection tools. When the regular compiler is running, they are defined into
1499 nothing, and do not affect the compiled code.
1500 */
1501
1502 #if !defined(__midl) && defined(_PREFAST_) 
1503
1504       /*
1505         In the primitive __declspec("SAL_*") annotations "SAL" stands for Standard
1506         Annotation Language.  These __declspec("SAL_*") annotations are the
1507         primitives the compiler understands and all high-level SpecString MACROs
1508         will decompose into these primivates.
1509       */
1510
1511       #define SPECSTRINGIZE( x ) #x
1512
1513       /*
1514         __null p
1515         __notnull p
1516         __maybenull p
1517       
1518         Annotates a pointer p. States that pointer p is null. Commonly used
1519         in the negated form __notnull or the possibly null form __maybenull.
1520       */
1521
1522       #define __null                              __declspec("SAL_null")
1523       #define __notnull                         __declspec("SAL_notnull")
1524       #define __maybenull                     __declspec("SAL_maybenull")
1525
1526       /*
1527         __readonly l
1528         __notreadonly l
1529         __mabyereadonly l
1530       
1531         Annotates a location l. States that location l is not modified after
1532         this point.  If the annotation is placed on the precondition state of
1533         a function, the restriction only applies until the postcondition state
1534         of the function.  __maybereadonly states that the annotated location
1535         may be modified, whereas __notreadonly states that a location must be
1536         modified.
1537       */
1538
1539       #define __readonly                       __declspec("SAL_readonly")
1540       #define __notreadonly                  __declspec("SAL_notreadonly")
1541       #define __maybereadonly               __declspec("SAL_maybereadonly")
1542
1543       /*
1544         __valid v
1545         __notvalid v
1546         __maybevalid v
1547       
1548         Annotates any value v. States that the value satisfies all properties of
1549         valid values of its type. For example, for a string buffer, valid means
1550         that the buffer pointer is either NULL or points to a NULL-terminated string.
1551       */
1552
1553       #define __valid                            __declspec("SAL_valid")
1554       #define __notvalid                       __declspec("SAL_notvalid")
1555       #define __maybevalid                    __declspec("SAL_maybevalid")
1556
1557       /*
1558         __readableTo(extent) p
1559       
1560         Annotates a buffer pointer p.  If the buffer can be read, extent describes
1561         how much of the buffer is readable. For a reader of the buffer, this is
1562         an explicit permission to read up to that amount, rather than a restriction to
1563         read only up to it.
1564       */
1565
1566       #define __readableTo(extent)      __declspec("SAL_readableTo("SPECSTRINGIZE(extent)")")
1567
1568       /*
1569       
1570         __elem_readableTo(size)
1571       
1572         Annotates a buffer pointer p as being readable to size elements.
1573       */
1574
1575       #define __elem_readableTo(size)     __declspec("SAL_readableTo(elementCount("SPECSTRINGIZE(size)"))")
1576       
1577       /*
1578         __byte_readableTo(size)
1579       
1580         Annotates a buffer pointer p as being readable to size bytes.
1581       */
1582       #define __byte_readableTo(size)     __declspec("SAL_readableTo(byteCount("SPECSTRINGIZE(size)"))")
1583       
1584       /*
1585         __writableTo(extent) p
1586       
1587         Annotates a buffer pointer p. If the buffer can be modified, extent
1588         describes how much of the buffer is writable (usually the allocation
1589         size). For a writer of the buffer, this is an explicit permission to
1590         write up to that amount, rather than a restriction to write only up to it.
1591       */
1592       #define __writableTo(size)     __declspec("SAL_writableTo("SPECSTRINGIZE(size)")")
1593
1594       /*
1595         __elem_writableTo(size)
1596       
1597         Annotates a buffer pointer p as being writable to size elements.
1598       */
1599       #define __elem_writableTo(size)     __declspec("SAL_writableTo(elementCount("SPECSTRINGIZE(size)"))")
1600       
1601       /*
1602         __byte_writableTo(size)
1603       
1604         Annotates a buffer pointer p as being writable to size bytes.
1605       */
1606       #define __byte_writableTo(size)     __declspec("SAL_writableTo(byteCount("SPECSTRINGIZE(size)"))")
1607
1608       /*
1609         __deref p
1610       
1611         Annotates a pointer p. The next annotation applies one dereference down
1612         in the type. If readableTo(p, size) then the next annotation applies to
1613         all elements *(p+i) for which i satisfies the size. If p is a pointer
1614         to a struct, the next annotation applies to all fields of the struct.
1615       */
1616       #define __deref                            __declspec("SAL_deref")
1617       
1618       /*
1619         __pre __next_annotation
1620       
1621         The next annotation applies in the precondition state
1622       */
1623       #define __pre                               __declspec("SAL_pre")
1624       
1625       /*
1626         __post __next_annotation
1627       
1628         The next annotation applies in the postcondition state
1629       */
1630       #define __post                              __declspec("SAL_post")
1631       
1632       /*
1633         __precond(<expr>)
1634       
1635         When <expr> is true, the next annotation applies in the precondition state
1636         (currently not enabled)
1637       */
1638       #define __precond(expr)               __pre
1639
1640       /*
1641         __postcond(<expr>)
1642       
1643         When <expr> is true, the next annotation applies in the postcondition state
1644         (currently not enabled)
1645       */
1646       #define __postcond(expr)             __post
1647
1648       /*
1649         __exceptthat
1650       
1651         Given a set of annotations Q containing __exceptthat maybeP, the effect of
1652         the except clause is to erase any P or notP annotations (explicit or
1653         implied) within Q at the same level of dereferencing that the except
1654         clause appears, and to replace it with maybeP.
1655       
1656           Example 1: __valid __exceptthat __maybenull on a pointer p means that the
1657                             pointer may be null, and is otherwise valid, thus overriding
1658                             the implicit notnull annotation implied by __valid on
1659                             pointers.
1660       
1661           Example 2: __valid __deref __exceptthat __maybenull on an int **p means
1662                             that p is not null (implied by valid), but the elements
1663                             pointed to by p could be null, and are otherwise valid. 
1664       */
1665       #define __exceptthat                          __declspec("SAL_except")
1666       #define __execeptthat                         __exceptthat
1667  
1668       /*
1669         _refparam
1670       
1671         Added to all out parameter macros to indicate that they are all reference
1672         parameters.
1673       */
1674       #define __refparam                              __deref __notreadonly
1675
1676       /*
1677         __inner_*
1678       
1679         Helper macros that directly correspond to certain high-level annotations.
1680       
1681       */
1682
1683       /*
1684         Macros to classify the entrypoints and indicate their category.
1685       
1686         Pre-defined control point categories include: RPC, LPC, DeviceDriver, UserToKernel, ISAPI, COM.
1687       
1688       */
1689       #define __inner_control_entrypoint(category) __declspec("SAL_entrypoint(controlEntry, "SPECSTRINGIZE(category)")")
1690
1691       /*
1692         Pre-defined data entry point categories include: Registry, File, Network.
1693       */
1694       #define __inner_data_entrypoint(category)      __declspec("SAL_entrypoint(dataEntry, "SPECSTRINGIZE(category)")")
1695
1696       #define __inner_success(expr)                         __declspec("SAL_success("SPECSTRINGIZE(expr)")")
1697       #define __inner_checkReturn                            __declspec("SAL_checkReturn")
1698       #define __inner_typefix(ctype)                       __declspec("SAL_typefix("SPECSTRINGIZE(ctype)")")
1699       #define __inner_override                                 __declspec("__override")
1700       #define __inner_callback                                 __declspec("__callback")
1701       #define __inner_blocksOn(resource)                __declspec("SAL_blocksOn("SPECSTRINGIZE(resource)")")
1702       #define __inner_fallthrough_dec                     __inline __nothrow void __FallThrough() {}
1703       #define __inner_fallthrough                            __FallThrough();
1704
1705 #else
1706       #define __null
1707       #define __notnull
1708       #define __maybenull
1709       #define __readonly
1710       #define __notreadonly
1711       #define __maybereadonly
1712       #define __valid
1713       #define __notvalid
1714       #define __maybevalid
1715       #define __readableTo(extent)
1716       #define __elem_readableTo(size)
1717       #define __byte_readableTo(size)
1718       #define __writableTo(size)
1719       #define __elem_writableTo(size)
1720       #define __byte_writableTo(size)
1721       #define __deref
1722       #define __pre
1723       #define __post
1724       #define __precond(expr)
1725       #define __postcond(expr)
1726       #define __exceptthat
1727       #define __execeptthat
1728       #define __inner_success(expr)
1729       #define __inner_checkReturn
1730       #define __inner_typefix(ctype)
1731       #define __inner_override
1732       #define __inner_callback
1733       #define __inner_blocksOn(resource)
1734       #define __inner_fallthrough_dec
1735       #define __inner_fallthrough
1736       #define __refparam
1737       #define __inner_control_entrypoint(category)
1738       #define __inner_data_entrypoint(category)
1739 #endif /* #if !defined(__midl) && defined(_PREFAST_) */
1740
1741 /* 
1742 -------------------------------------------------------------------------------
1743 Buffer Annotation Definitions
1744
1745 Any of these may be used to directly annotate functions, but only one should
1746 be used for each parameter. To determine which annotation to use for a given
1747 buffer, use the table in the buffer annotations section.
1748 -------------------------------------------------------------------------------
1749 */
1750
1751 #define __ecount(size)                                                                      __notnull __elem_writableTo(size)
1752 #define __bcount(size)                                                                      __notnull __byte_writableTo(size)
1753 #define __in                                                                                      __pre __valid __pre __deref __readonly
1754 #define __in_ecount(size)                                                                 __in __pre __elem_readableTo(size)
1755 #define __in_bcount(size)                                                                 __in __pre __byte_readableTo(size)
1756 #define __in_z                                                                                   __in __pre __nullterminated
1757 #define __in_ecount_z(size)                                                             __in_ecount(size) __pre __nullterminated
1758 #define __in_bcount_z(size)                                                             __in_bcount(size) __pre __nullterminated
1759 #define __in_nz                                                                                 __in
1760 #define __in_ecount_nz(size)                                                            __in_ecount(size)
1761 #define __in_bcount_nz(size)                                                            __in_bcount(size)
1762 #define __out                                                                                     __ecount(1) __post __valid __refparam
1763 #define __out_ecount(size)                                                               __ecount(size) __post __valid __refparam
1764 #define __out_bcount(size)                                                               __bcount(size) __post __valid __refparam
1765 #define __out_ecount_part(size,length)                                           __out_ecount(size) __post __elem_readableTo(length)
1766 #define __out_bcount_part(size,length)                                           __out_bcount(size) __post __byte_readableTo(length)
1767 #define __out_ecount_full(size)                                                       __out_ecount_part(size,size)
1768 #define __out_bcount_full(size)                                                       __out_bcount_part(size,size)
1769 #define __out_z                                                                                 __post __valid __refparam __post __nullterminated
1770 #define __out_z_opt                                                                           __post __valid __refparam __post __nullterminated __exceptthat __maybenull
1771 #define __out_ecount_z(size)                                                            __ecount(size) __post __valid __refparam __post __nullterminated
1772 #define __out_bcount_z(size)                                                            __bcount(size) __post __valid __refparam __post __nullterminated
1773 #define __out_ecount_part_z(size,length)                                        __out_ecount_part(size,length) __post __nullterminated
1774 #define __out_bcount_part_z(size,length)                                        __out_bcount_part(size,length) __post __nullterminated
1775 #define __out_ecount_full_z(size)                                                   __out_ecount_full(size) __post __nullterminated
1776 #define __out_bcount_full_z(size)                                                   __out_bcount_full(size) __post __nullterminated
1777 #define __out_nz                                                                                __post __valid __refparam __post
1778 #define __out_nz_opt                                                                         __post __valid __refparam __post __exceptthat __maybenull
1779 #define __out_ecount_nz(size)                                                          __ecount(size) __post __valid __refparam
1780 #define __out_bcount_nz(size)                                                          __bcount(size) __post __valid __refparam
1781 #define __inout                                                                                 __pre __valid __post __valid __refparam
1782 #define __inout_ecount(size)                                                            __out_ecount(size) __pre __valid
1783 #define __inout_bcount(size)                                                            __out_bcount(size) __pre __valid
1784 #define __inout_ecount_part(size,length)                                        __out_ecount_part(size,length) __pre __valid __pre __elem_readableTo(length)
1785 #define __inout_bcount_part(size,length)                                        __out_bcount_part(size,length) __pre __valid __pre __byte_readableTo(length)
1786 #define __inout_ecount_full(size)                                                   __inout_ecount_part(size,size)
1787 #define __inout_bcount_full(size)                                                   __inout_bcount_part(size,size)
1788 #define __inout_z                                                                              __inout __pre __nullterminated __post __nullterminated
1789 #define __inout_ecount_z(size)                                                        __inout_ecount(size) __pre __nullterminated __post __nullterminated
1790 #define __inout_bcount_z(size)                                                        __inout_bcount(size) __pre __nullterminated __post __nullterminated
1791 #define __inout_nz                                                                            __inout
1792 #define __inout_ecount_nz(size)                                                       __inout_ecount(size) 
1793 #define __inout_bcount_nz(size)                                                       __inout_bcount(size) 
1794 #define __ecount_opt(size)                                                               __ecount(size)                                                  __exceptthat __maybenull
1795 #define __bcount_opt(size)                                                               __bcount(size)                                                  __exceptthat __maybenull
1796 #define __in_opt                                                                                __in                                                                  __exceptthat __maybenull
1797 #define __in_ecount_opt(size)                                                          __in_ecount(size)                                             __exceptthat __maybenull
1798 #define __in_bcount_opt(size)                                                          __in_bcount(size)                                             __exceptthat __maybenull
1799 #define __in_z_opt                                                                            __in_opt __pre __nullterminated 
1800 #define __in_ecount_z_opt(size)                                                       __in_ecount_opt(size) __pre __nullterminated 
1801 #define __in_bcount_z_opt(size)                                                       __in_bcount_opt(size) __pre __nullterminated
1802 #define __in_nz_opt                                                                           __in_opt                                                             
1803 #define __in_ecount_nz_opt(size)                                                     __in_ecount_opt(size)                                         
1804 #define __in_bcount_nz_opt(size)                                                     __in_bcount_opt(size)                                         
1805 #define __out_opt                                                                              __out                                                                 __exceptthat __maybenull
1806 #define __out_ecount_opt(size)                                                        __out_ecount(size)                                           __exceptthat __maybenull
1807 #define __out_bcount_opt(size)                                                        __out_bcount(size)                                           __exceptthat __maybenull
1808 #define __out_ecount_part_opt(size,length)                                    __out_ecount_part(size,length)                       __exceptthat __maybenull
1809 #define __out_bcount_part_opt(size,length)                                    __out_bcount_part(size,length)                       __exceptthat __maybenull
1810 #define __out_ecount_full_opt(size)                                                __out_ecount_full(size)                                   __exceptthat __maybenull
1811 #define __out_bcount_full_opt(size)                                                __out_bcount_full(size)                                   __exceptthat __maybenull
1812 #define __out_ecount_z_opt(size)                                                     __out_ecount_opt(size) __post __nullterminated
1813 #define __out_bcount_z_opt(size)                                                     __out_bcount_opt(size) __post __nullterminated
1814 #define __out_ecount_part_z_opt(size,length)                                 __out_ecount_part_opt(size,length) __post __nullterminated
1815 #define __out_bcount_part_z_opt(size,length)                                 __out_bcount_part_opt(size,length) __post __nullterminated
1816 #define __out_ecount_full_z_opt(size)                                             __out_ecount_full_opt(size) __post __nullterminated
1817 #define __out_bcount_full_z_opt(size)                                             __out_bcount_full_opt(size) __post __nullterminated
1818 #define __out_ecount_nz_opt(size)                                                   __out_ecount_opt(size) __post __nullterminated                                      
1819 #define __out_bcount_nz_opt(size)                                                   __out_bcount_opt(size) __post __nullterminated                                        
1820 #define __inout_opt                                                                           __inout                                                             __exceptthat __maybenull
1821 #define __inout_ecount_opt(size)                                                     __inout_ecount(size)                                        __exceptthat __maybenull
1822 #define __inout_bcount_opt(size)                                                     __inout_bcount(size)                                        __exceptthat __maybenull
1823 #define __inout_ecount_part_opt(size,length)                                 __inout_ecount_part(size,length)                    __exceptthat __maybenull
1824 #define __inout_bcount_part_opt(size,length)                                 __inout_bcount_part(size,length)                    __exceptthat __maybenull
1825 #define __inout_ecount_full_opt(size)                                             __inout_ecount_full(size)                               __exceptthat __maybenull
1826 #define __inout_bcount_full_opt(size)                                             __inout_bcount_full(size)                               __exceptthat __maybenull
1827 #define __inout_z_opt                                                                       __inout_opt __pre __nullterminated __post __nullterminated
1828 #define __inout_ecount_z_opt(size)                                                  __inout_ecount_opt(size) __pre __nullterminated __post __nullterminated
1829 #define __inout_ecount_z_opt(size)                                                  __inout_ecount_opt(size) __pre __nullterminated __post __nullterminated
1830 #define __inout_bcount_z_opt(size)                                                  __inout_bcount_opt(size) 
1831 #define __inout_nz_opt                                                                      __inout_opt
1832 #define __inout_ecount_nz_opt(size)                                                __inout_ecount_opt(size)
1833 #define __inout_bcount_nz_opt(size)                                                __inout_bcount_opt(size)
1834 #define __deref_ecount(size)                                                            __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __elem_writableTo(size)
1835 #define __deref_bcount(size)                                                            __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __byte_writableTo(size)
1836 #define __deref_out                                                                           __deref_ecount(1) __post __deref __valid __refparam
1837 #define __deref_out_ecount(size)                                                     __deref_ecount(size) __post __deref __valid __refparam
1838 #define __deref_out_bcount(size)                                                     __deref_bcount(size) __post __deref __valid __refparam
1839 #define __deref_out_ecount_part(size,length)                                 __deref_out_ecount(size) __post __deref __elem_readableTo(length)
1840 #define __deref_out_bcount_part(size,length)                                 __deref_out_bcount(size) __post __deref __byte_readableTo(length)
1841 #define __deref_out_ecount_full(size)                                             __deref_out_ecount_part(size,size)
1842 #define __deref_out_bcount_full(size)                                             __deref_out_bcount_part(size,size)
1843 #define __deref_out_z                                                                       __post __deref __valid __refparam __post __deref __nullterminated
1844 #define __deref_out_ecount_z(size)                                                  __deref_out_ecount(size) __post __deref __nullterminated  
1845 #define __deref_out_bcount_z(size)                                                  __deref_out_ecount(size) __post __deref __nullterminated  
1846 #define __deref_out_nz                                                                      __deref_out
1847 #define __deref_out_ecount_nz(size)                                                __deref_out_ecount(size)     
1848 #define __deref_out_bcount_nz(size)                                                __deref_out_ecount(size)     
1849 #define __deref_inout                                                                       __notnull __elem_readableTo(1) __pre __deref __valid __post __deref __valid __refparam
1850 #define __deref_inout_z                                                                    __deref_inout __pre __deref __nullterminated __post __deref __nullterminated
1851 #define __deref_inout_ecount(size)                                                  __deref_inout __pre __deref __elem_writableTo(size) __post __deref __elem_writableTo(size)
1852 #define __deref_inout_bcount(size)                                                  __deref_inout __pre __deref __byte_writableTo(size) __post __deref __byte_writableTo(size)
1853 #define __deref_inout_ecount_part(size,length)                              __deref_inout_ecount(size) __pre __deref __elem_readableTo(length) __post __deref __elem_readableTo(length)
1854 #define __deref_inout_bcount_part(size,length)                              __deref_inout_bcount(size) __pre __deref __byte_readableTo(length) __post __deref __byte_readableTo(length)
1855 #define __deref_inout_ecount_full(size)                                         __deref_inout_ecount_part(size,size)
1856 #define __deref_inout_bcount_full(size)                                         __deref_inout_bcount_part(size,size)
1857 #define __deref_inout_z                                                                    __deref_inout __pre __deref __nullterminated __post __deref __nullterminated
1858 #define __deref_inout_ecount_z(size)                                              __deref_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated     
1859 #define __deref_inout_bcount_z(size)                                              __deref_inout_bcount(size) __pre __deref __nullterminated __post __deref __nullterminated  
1860 #define __deref_inout_nz                                                                  __deref_inout
1861 #define __deref_inout_ecount_nz(size)                                             __deref_inout_ecount(size)     
1862 #define __deref_inout_bcount_nz(size)                                             __deref_inout_ecount(size)     
1863 #define __deref_ecount_opt(size)                                                     __deref_ecount(size)                                        __post __deref __exceptthat __maybenull
1864 #define __deref_bcount_opt(size)                                                     __deref_bcount(size)                                        __post __deref __exceptthat __maybenull
1865 #define __deref_out_opt                                                                    __deref_out                                                       __post __deref __exceptthat __maybenull
1866 #define __deref_out_ecount_opt(size)                                              __deref_out_ecount(size)                                 __post __deref __exceptthat __maybenull
1867 #define __deref_out_bcount_opt(size)                                              __deref_out_bcount(size)                                 __post __deref __exceptthat __maybenull
1868 #define __deref_out_ecount_part_opt(size,length)                          __deref_out_ecount_part(size,length)             __post __deref __exceptthat __maybenull
1869 #define __deref_out_bcount_part_opt(size,length)                          __deref_out_bcount_part(size,length)             __post __deref __exceptthat __maybenull
1870 #define __deref_out_ecount_full_opt(size)                                      __deref_out_ecount_full(size)                         __post __deref __exceptthat __maybenull
1871 #define __deref_out_bcount_full_opt(size)                                      __deref_out_bcount_full(size)                         __post __deref __exceptthat __maybenull
1872 #define __deref_out_z_opt                                                                 __post __deref __valid __refparam __execeptthat __maybenull __post __deref __nullterminated
1873 #define __deref_out_ecount_z_opt(size)                                           __deref_out_ecount_opt(size) __post __deref __nullterminated
1874 #define __deref_out_bcount_z_opt(size)                                           __deref_out_bcount_opt(size) __post __deref __nullterminated
1875 #define __deref_out_nz_opt                                                               __deref_out_opt
1876 #define __deref_out_ecount_nz_opt(size)                                         __deref_out_ecount_opt(size)
1877 #define __deref_out_bcount_nz_opt(size)                                         __deref_out_bcount_opt(size)
1878 #define __deref_inout_opt                                                                 __deref_inout                                                   __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
1879 #define __deref_inout_ecount_opt(size)                                           __deref_inout_ecount(size)                              __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
1880 #define __deref_inout_bcount_opt(size)                                           __deref_inout_bcount(size)                              __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
1881 #define __deref_inout_ecount_part_opt(size,length)                       __deref_inout_ecount_part(size,length)          __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
1882 #define __deref_inout_bcount_part_opt(size,length)                       __deref_inout_bcount_part(size,length)          __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
1883 #define __deref_inout_ecount_full_opt(size)                                   __deref_inout_ecount_full(size)                     __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
1884 #define __deref_inout_bcount_full_opt(size)                                   __deref_inout_bcount_full(size)                     __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull
1885 #define __deref_inout_z_opt                                                             __deref_inout_opt __pre __deref __nullterminated __post __deref __nullterminated
1886 #define __deref_inout_ecount_z_opt(size)                                        __deref_inout_ecount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated
1887 #define __deref_inout_bcount_z_opt(size)                                        __deref_inout_bcount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated
1888 #define __deref_inout_nz_opt                                                            __deref_inout_opt 
1889 #define __deref_inout_ecount_nz_opt(size)                                      __deref_inout_ecount_opt(size)
1890 #define __deref_inout_bcount_nz_opt(size)                                      __deref_inout_bcount_opt(size)
1891 #define __deref_opt_ecount(size)                                                     __deref_ecount(size)                                        __exceptthat __maybenull
1892 #define __deref_opt_bcount(size)                                                     __deref_bcount(size)                                        __exceptthat __maybenull
1893 #define __deref_opt_out                                                                    __deref_out                                                       __exceptthat __maybenull
1894 #define __deref_opt_out_z                                                                 __deref_opt_out __post __deref __nullterminated
1895 #define __deref_opt_out_ecount(size)                                              __deref_out_ecount(size)                                 __exceptthat __maybenull
1896 #define __deref_opt_out_bcount(size)                                              __deref_out_bcount(size)                                 __exceptthat __maybenull
1897 #define __deref_opt_out_ecount_part(size,length)                          __deref_out_ecount_part(size,length)             __exceptthat __maybenull
1898 #define __deref_opt_out_bcount_part(size,length)                          __deref_out_bcount_part(size,length)             __exceptthat __maybenull
1899 #define __deref_opt_out_ecount_full(size)                                      __deref_out_ecount_full(size)                         __exceptthat __maybenull
1900 #define __deref_opt_out_bcount_full(size)                                      __deref_out_bcount_full(size)                         __exceptthat __maybenull
1901 #define __deref_opt_inout                                                                 __deref_inout                                                   __exceptthat __maybenull
1902 #define __deref_opt_inout_ecount(size)                                           __deref_inout_ecount(size)                              __exceptthat __maybenull
1903 #define __deref_opt_inout_bcount(size)                                           __deref_inout_bcount(size)                              __exceptthat __maybenull
1904 #define __deref_opt_inout_ecount_part(size,length)                       __deref_inout_ecount_part(size,length)          __exceptthat __maybenull
1905 #define __deref_opt_inout_bcount_part(size,length)                       __deref_inout_bcount_part(size,length)          __exceptthat __maybenull
1906 #define __deref_opt_inout_ecount_full(size)                                   __deref_inout_ecount_full(size)                     __exceptthat __maybenull
1907 #define __deref_opt_inout_bcount_full(size)                                   __deref_inout_bcount_full(size)                     __exceptthat __maybenull
1908 #define __deref_opt_inout_z                                                             __deref_opt_inout __pre __deref __nullterminated __post __deref __nullterminated
1909 #define __deref_opt_inout_ecount_z(size)                                        __deref_opt_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated
1910 #define __deref_opt_inout_bcount_z(size)                                        __deref_opt_inout_bcount(size) __pre __deref __nullterminated __post __deref __nullterminated
1911 #define __deref_opt_inout_nz                                                            __deref_opt_inout
1912 #define __deref_opt_inout_ecount_nz(size)                                      __deref_opt_inout_ecount(size)
1913 #define __deref_opt_inout_bcount_nz(size)                                      __deref_opt_inout_bcount(size)
1914 #define __deref_opt_ecount_opt(size)                                              __deref_ecount_opt(size)                                 __exceptthat __maybenull
1915 #define __deref_opt_bcount_opt(size)                                              __deref_bcount_opt(size)                                 __exceptthat __maybenull
1916 #define __deref_opt_out_opt                                                             __deref_out_opt                                                __exceptthat __maybenull
1917 #define __deref_opt_out_ecount_opt(size)                                        __deref_out_ecount_opt(size)                          __exceptthat __maybenull
1918 #define __deref_opt_out_bcount_opt(size)                                        __deref_out_bcount_opt(size)                          __exceptthat __maybenull
1919 #define __deref_opt_out_ecount_part_opt(size,length)                    __deref_out_ecount_part_opt(size,length)      __exceptthat __maybenull
1920 #define __deref_opt_out_bcount_part_opt(size,length)                    __deref_out_bcount_part_opt(size,length)      __exceptthat __maybenull
1921 #define __deref_opt_out_ecount_full_opt(size)                               __deref_out_ecount_full_opt(size)                  __exceptthat __maybenull
1922 #define __deref_opt_out_bcount_full_opt(size)                               __deref_out_bcount_full_opt(size)                  __exceptthat __maybenull
1923 #define __deref_opt_out_z_opt                                                          __post __deref __valid __refparam __exceptthat __maybenull __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull __post __deref __nullterminated
1924 #define __deref_opt_out_ecount_z_opt(size)                                    __deref_opt_out_ecount_opt(size) __post __deref __nullterminated
1925 #define __deref_opt_out_bcount_z_opt(size)                                    __deref_opt_out_bcount_opt(size) __post __deref __nullterminated
1926 #define __deref_opt_out_nz_opt                                                        __deref_opt_out_opt
1927 #define __deref_opt_out_ecount_nz_opt(size)                                   __deref_opt_out_ecount_opt(size)      
1928 #define __deref_opt_out_bcount_nz_opt(size)                                   __deref_opt_out_bcount_opt(size)      
1929 #define __deref_opt_inout_opt                                                          __deref_inout_opt                                             __exceptthat __maybenull
1930 #define __deref_opt_inout_ecount_opt(size)                                    __deref_inout_ecount_opt(size)                       __exceptthat __maybenull
1931 #define __deref_opt_inout_bcount_opt(size)                                    __deref_inout_bcount_opt(size)                       __exceptthat __maybenull
1932 #define __deref_opt_inout_ecount_part_opt(size,length)                __deref_inout_ecount_part_opt(size,length)  __exceptthat __maybenull
1933 #define __deref_opt_inout_bcount_part_opt(size,length)                __deref_inout_bcount_part_opt(size,length)  __exceptthat __maybenull
1934 #define __deref_opt_inout_ecount_full_opt(size)                            __deref_inout_ecount_full_opt(size)               __exceptthat __maybenull
1935 #define __deref_opt_inout_bcount_full_opt(size)                            __deref_inout_bcount_full_opt(size)               __exceptthat __maybenull
1936 #define __deref_opt_inout_z_opt                                                       __deref_opt_inout_opt  __pre __deref __nullterminated __post __deref __nullterminated                     
1937 #define __deref_opt_inout_ecount_z_opt(size)                                 __deref_opt_inout_ecount_opt(size)  __pre __deref __nullterminated __post __deref __nullterminated
1938 #define __deref_opt_inout_bcount_z_opt(size)                                 __deref_opt_inout_bcount_opt(size)  __pre __deref __nullterminated __post __deref __nullterminated
1939 #define __deref_opt_inout_nz_opt                                                     __deref_opt_inout_opt                         
1940 #define __deref_opt_inout_ecount_nz_opt(size)                               __deref_opt_inout_ecount_opt(size)  
1941 #define __deref_opt_inout_bcount_nz_opt(size)                               __deref_opt_inout_bcount_opt(size)  
1942
1943 /*
1944 -------------------------------------------------------------------------------
1945 Advanced Annotation Definitions
1946
1947 Any of these may be used to directly annotate functions, and may be used in
1948 combination with each other or with regular buffer macros. For an explanation
1949 of each annotation, see the advanced annotations section.
1950 -------------------------------------------------------------------------------
1951 */
1952
1953 #define __success(expr)                                   __inner_success(expr)
1954 #define __nullterminated                                 __readableTo(sentinel(0))
1955 #define __nullnullterminated
1956 #define __reserved                                           __pre __null
1957 #define __checkReturn                                      __inner_checkReturn
1958 #define __typefix(ctype)                                 __inner_typefix(ctype)
1959 #define __override                                           __inner_override
1960 #define __callback                                           __inner_callback
1961 #define __format_string
1962 #define __blocksOn(resource)                          __inner_blocksOn(resource)
1963 #define __control_entrypoint(category)          __inner_control_entrypoint(category)
1964 #define __data_entrypoint(category)               __inner_data_entrypoint(category)
1965
1966 #ifndef __fallthrough
1967       __inner_fallthrough_dec
1968       #define __fallthrough __inner_fallthrough
1969 #endif
1970
1971 #ifndef __analysis_assume
1972 #ifdef _PREFAST_
1973 #define __analysis_assume(expr) __assume(expr)
1974 #else
1975 #define __analysis_assume(expr) 
1976 #endif
1977 #endif
1978
1979 #ifdef  __cplusplus
1980 }
1981 #endif
1982
1983
1984