Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.63 KB | None | 0 0
  1. /*
  2.  
  3. Copyright (c) Microsoft Corporation. All rights reserved.
  4.  
  5. Module Name:
  6.  
  7. winapifamily.h
  8.  
  9. Abstract:
  10.  
  11. Master include file for API family partitioning.
  12.  
  13. */
  14.  
  15. #ifndef _INC_WINAPIFAMILY
  16. #define _INC_WINAPIFAMILY
  17.  
  18. #if defined(_MSC_VER) && !defined(MOFCOMP_PASS)
  19. #pragma once
  20. #endif // defined(_MSC_VER) && !defined(MOFCOMP_PASS)
  21.  
  22. /*
  23. * When compiling C and C++ code using SDK header files, the development
  24. * environment can specify a target platform by #define-ing the
  25. * pre-processor symbol WINAPI_FAMILY to one of the following values.
  26. * Each FAMILY value denotes an application family for which a different
  27. * subset of the total set of header-file-defined APIs are available.
  28. * Setting the WINAPI_FAMILY value will effectively hide from the
  29. * editing and compilation environments the existence of APIs that
  30. * are not applicable to the family of applications targeting a
  31. * specific platform.
  32. */
  33.  
  34. /*
  35. * The WINAPI_FAMILY values of 0 and 1 are reserved to ensure that
  36. * an error will occur if WINAPI_FAMILY is set to any
  37. * WINAPI_PARTITION value (which must be 0 or 1, see below).
  38. */
  39. #define WINAPI_FAMILY_PC_APP 2 /* Windows Store Applications */
  40. #define WINAPI_FAMILY_PHONE_APP 3 /* Windows Phone Applications */
  41. #define WINAPI_FAMILY_DESKTOP_APP 100 /* Windows Desktop Applications */
  42. /* The value of WINAPI_FAMILY_DESKTOP_APP may change in future SDKs. */
  43. /* Additional WINAPI_FAMILY values may be defined in future SDKs. */
  44.  
  45. /*
  46. * For compatibility with Windows 8 header files, the following
  47. * synonym for WINAPI_FAMILY_PC_APP is temporarily #define'd.
  48. * Use of this symbol should be considered deprecated.
  49. */
  50. #define WINAPI_FAMILY_APP WINAPI_FAMILY_PC_APP
  51.  
  52. /*
  53. * If no WINAPI_FAMILY value is specified, then all APIs available to
  54. * Windows desktop applications are exposed.
  55. */
  56. #ifndef WINAPI_FAMILY
  57. #define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
  58. #endif
  59.  
  60. /*
  61. * API PARTITONs are part of an indirection mechanism for mapping between
  62. * individual APIs and the FAMILYs to which they apply.
  63. * Each PARTITION is a category or subset of named APIs. PARTITIONs
  64. * are permitted to have overlapping membership -- some single API
  65. * might be part of more than one PARTITION. In support of new
  66. * FAMILYs that might be added in future SDKs, any single current
  67. * PARTITION might in that future SDK be split into two or more new PARTITIONs.
  68. * Accordingly, application developers should avoid taking dependencies on
  69. * PARTITION names; developers' only dependency upon the symbols defined
  70. * in this file should be their reliance on the WINAPI_FAMILY names and values.
  71. */
  72.  
  73. /*
  74. * Current PARTITIONS are each #undef'ed below, and then will be #define-ed
  75. * to be either 1 or 0 or depending on the active WINAPI_FAMILY.
  76. */
  77.  
  78. #undef WINAPI_PARTITION_DESKTOP /* usable for PC desktop apps (but not store apps) */
  79. #undef WINAPI_PARTITION_APP /* usable for most platforms' store apps */
  80. #undef WINAPI_PARTITION_PC_APP /* specific to PC store apps */
  81. #undef WINAPI_PARTITION_PHONE_APP /* specific to phone store apps */
  82.  
  83.  
  84. /*
  85. * The mapping between families and partitions is summarized here.
  86. * An X indicates that the given partition is active for the given
  87. * platform/family.
  88. *
  89. * +---------------+
  90. * | *Partition* |
  91. * +---+---+---+---+
  92. * | | | | P |
  93. * | | | | H |
  94. * | D | | | O |
  95. * | E | | P | N |
  96. * | S | | C | E |
  97. * | K | | _ | _ |
  98. * | T | A | A | A |
  99. * +-------------------------+-+ O | P | P | P |
  100. * | *Platform/Family* \| P | P | P | P |
  101. * +---------------------------+---+---+---+---+
  102. * | WINAPI_FAMILY_DESKTOP_APP | X | X | X | |
  103. * +---------------------------+---+---+---+---+
  104. * | WINAPI_FAMILY_PC_APP | | X | X | |
  105. * +---------------------------+---+---+---+---+
  106. * | WINAPI_FAMILY_PHONE_APP | | X | | X |
  107. * +---------------------------+---+---+---+---+
  108. *
  109. * The table above is encoded in the following expressions,
  110. * each of which evaluates to 1 or 0.
  111. *
  112. * Whenever a new family is added, all of these expressions
  113. * need to be reconsidered.
  114. */
  115. #if WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP && WINAPI_FAMILY != WINAPI_FAMILY_PC_APP && WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
  116. # error Unknown WINAPI_FAMILY value. Was it defined in terms of a WINAPI_PARTITION_* value?
  117. #endif
  118. #define WINAPI_PARTITION_DESKTOP (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
  119. #define WINAPI_PARTITION_APP 1 /* active for all current families */
  120. #define WINAPI_PARTITION_PC_APP (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP || WINAPI_FAMILY == WINAPI_FAMILY_PC_APP)
  121. #define WINAPI_PARTITION_PHONE_APP (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
  122.  
  123. /*
  124. * For compatibility with Windows Phone 8 header files, the following
  125. * synonym for WINAPI_PARTITION_PHONE_APP is temporarily #define'd.
  126. * Use of this symbol should be regarded as deprecated.
  127. */
  128. #define WINAPI_PARTITION_PHONE WINAPI_PARTITION_PHONE_APP
  129.  
  130. /*
  131. * Header files use the WINAPI_FAMILY_PARTITION macro to assign one or
  132. * more declarations to some group of partitions. The macro chooses
  133. * whether the preprocessor will emit or omit a sequence of declarations
  134. * bracketed by an #if/#endif pair. All header file references to the
  135. * WINAPI_PARTITION_* values should be in the form of occurrences of
  136. * WINAPI_FAMILY_PARTITION(...).
  137. *
  138. * For example, the following usage of WINAPI_FAMILY_PARTITION identifies
  139. * a sequence of declarations that are part of both the Windows Desktop
  140. * Partition and the Windows-Phone-Specific Store Partition:
  141. *
  142. * #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_PHONE_APP)
  143. * ...
  144. * #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_PHONE_APP)
  145. *
  146. * The comment on the closing #endif allow tools as well as people to find the
  147. * matching #ifdef properly.
  148. *
  149. * Usages of WINAPI_FAMILY_PARTITION may be combined, when the partitition definitions are
  150. * related. In particular one might use declarations like
  151. *
  152. * #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  153. *
  154. * or
  155. *
  156. * #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
  157. *
  158. * Direct references to WINAPI_PARTITION_ values (eg #if !WINAPI_FAMILY_PARTITION_...)
  159. * should not be used.
  160. */
  161. #define WINAPI_FAMILY_PARTITION(Partitions) (Partitions)
  162.  
  163. /*
  164. * Macro used to #define or typedef a symbol used for selective deprecation
  165. * of individual methods of a COM interfaces that are otherwise available
  166. * for a given set of partitions.
  167. */
  168. #define _WINAPI_DEPRECATED_DECLARATION __declspec(deprecated("This API cannot be used in the context of the caller's application type."))
  169.  
  170. /*
  171. * For compatibility with Windows 8 header files, the following
  172. * symbol is temporarily conditionally #define'd. Additional symbols
  173. * like this should be not defined in winapifamily.h, but rather should be
  174. * introduced locally to the header files of the component that needs them.
  175. */
  176. #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  177. # define APP_DEPRECATED_HRESULT HRESULT _WINAPI_DEPRECATED_DECLARATION
  178. #endif // WINAPIFAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  179.  
  180. #endif /* !_INC_WINAPIFAMILY */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement