Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

213 lines
8.6 KiB

  1. /*
  2. * WABCODE.H
  3. *
  4. * Status Codes returned by WAB routines
  5. *
  6. * Copyright 1993-1998 Microsoft Corporation. All Rights Reserved.
  7. */
  8. #if !defined(MAPICODE_H) && !defined(WABCODE_H)
  9. #define WABCODE_H
  10. /* Define S_OK and ITF_* */
  11. #ifdef WIN32
  12. #include <objerror.h>
  13. #endif
  14. /*
  15. * WAB Status codes follow the style of OLE 2.0 sCodes as defined in the
  16. * OLE 2.0 Programmer's Reference and header file scode.h (Windows 3.x)
  17. * or objerror.h (Windows NT 3.5 and Windows 95).
  18. *
  19. */
  20. /* On Windows 3.x, status codes have 32-bit values as follows:
  21. *
  22. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  23. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  24. * +-+---------------------+-------+-------------------------------+
  25. * |S| Context | Facil | Code |
  26. * +-+---------------------+-------+-------------------------------+
  27. *
  28. * where
  29. *
  30. * S - is the severity code
  31. *
  32. * 0 - SEVERITY_SUCCESS
  33. * 1 - SEVERITY_ERROR
  34. *
  35. * Context - context info
  36. *
  37. * Facility - is the facility code
  38. *
  39. * 0x0 - FACILITY_NULL generally useful errors ([SE]_*)
  40. * 0x1 - FACILITY_RPC remote procedure call errors (RPC_E_*)
  41. * 0x2 - FACILITY_DISPATCH late binding dispatch errors
  42. * 0x3 - FACILITY_STORAGE storage errors (STG_E_*)
  43. * 0x4 - FACILITY_ITF interface-specific errors
  44. *
  45. * Code - is the facility's status code
  46. *
  47. *
  48. */
  49. /*
  50. * On Windows NT 3.5 and Windows 95, scodes are 32-bit values
  51. * laid out as follows:
  52. *
  53. * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  54. * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  55. * +-+-+-+-+-+---------------------+-------------------------------+
  56. * |S|R|C|N|r| Facility | Code |
  57. * +-+-+-+-+-+---------------------+-------------------------------+
  58. *
  59. * where
  60. *
  61. * S - Severity - indicates success/fail
  62. *
  63. * 0 - Success
  64. * 1 - Fail (COERROR)
  65. *
  66. * R - reserved portion of the facility code, corresponds to NT's
  67. * second severity bit.
  68. *
  69. * C - reserved portion of the facility code, corresponds to NT's
  70. * C field.
  71. *
  72. * N - reserved portion of the facility code. Used to indicate a
  73. * mapped NT status value.
  74. *
  75. * r - reserved portion of the facility code. Reserved for internal
  76. * use. Used to indicate HRESULT values that are not status
  77. * values, but are instead message ids for display strings.
  78. *
  79. * Facility - is the facility code
  80. * FACILITY_NULL 0x0
  81. * FACILITY_RPC 0x1
  82. * FACILITY_DISPATCH 0x2
  83. * FACILITY_STORAGE 0x3
  84. * FACILITY_ITF 0x4
  85. * FACILITY_WIN32 0x7
  86. * FACILITY_WINDOWS 0x8
  87. *
  88. * Code - is the facility's status code
  89. *
  90. */
  91. /*
  92. * We can't use OLE 2.0 macros to build sCodes because the definition has
  93. * changed and we wish to conform to the new definition.
  94. */
  95. #define MAKE_MAPI_SCODE(sev,fac,code) \
  96. ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
  97. /* The following two macros are used to build OLE 2.0 style sCodes */
  98. #define MAKE_MAPI_E( err ) (MAKE_MAPI_SCODE( 1, FACILITY_ITF, err ))
  99. #define MAKE_MAPI_S( warn ) (MAKE_MAPI_SCODE( 0, FACILITY_ITF, warn ))
  100. #ifdef SUCCESS_SUCCESS
  101. #undef SUCCESS_SUCCESS
  102. #endif
  103. #define SUCCESS_SUCCESS 0L
  104. /* General errors (used by more than one WAB object) */
  105. #define MAPI_E_CALL_FAILED E_FAIL
  106. #define MAPI_E_NOT_ENOUGH_MEMORY E_OUTOFMEMORY
  107. #define MAPI_E_INVALID_PARAMETER E_INVALIDARG
  108. #define MAPI_E_INTERFACE_NOT_SUPPORTED E_NOINTERFACE
  109. #define MAPI_E_NO_ACCESS E_ACCESSDENIED
  110. #define MAPI_E_NO_SUPPORT MAKE_MAPI_E( 0x102 )
  111. #define MAPI_E_BAD_CHARWIDTH MAKE_MAPI_E( 0x103 )
  112. #define MAPI_E_STRING_TOO_LONG MAKE_MAPI_E( 0x105 )
  113. #define MAPI_E_UNKNOWN_FLAGS MAKE_MAPI_E( 0x106 )
  114. #define MAPI_E_INVALID_ENTRYID MAKE_MAPI_E( 0x107 )
  115. #define MAPI_E_INVALID_OBJECT MAKE_MAPI_E( 0x108 )
  116. #define MAPI_E_OBJECT_CHANGED MAKE_MAPI_E( 0x109 )
  117. #define MAPI_E_OBJECT_DELETED MAKE_MAPI_E( 0x10A )
  118. #define MAPI_E_BUSY MAKE_MAPI_E( 0x10B )
  119. #define MAPI_E_NOT_ENOUGH_DISK MAKE_MAPI_E( 0x10D )
  120. #define MAPI_E_NOT_ENOUGH_RESOURCES MAKE_MAPI_E( 0x10E )
  121. #define MAPI_E_NOT_FOUND MAKE_MAPI_E( 0x10F )
  122. #define MAPI_E_VERSION MAKE_MAPI_E( 0x110 )
  123. #define MAPI_E_LOGON_FAILED MAKE_MAPI_E( 0x111 )
  124. #define MAPI_E_SESSION_LIMIT MAKE_MAPI_E( 0x112 )
  125. #define MAPI_E_USER_CANCEL MAKE_MAPI_E( 0x113 )
  126. #define MAPI_E_UNABLE_TO_ABORT MAKE_MAPI_E( 0x114 )
  127. #define MAPI_E_NETWORK_ERROR MAKE_MAPI_E( 0x115 )
  128. #define MAPI_E_DISK_ERROR MAKE_MAPI_E( 0x116 )
  129. #define MAPI_E_TOO_COMPLEX MAKE_MAPI_E( 0x117 )
  130. #define MAPI_E_BAD_COLUMN MAKE_MAPI_E( 0x118 )
  131. #define MAPI_E_EXTENDED_ERROR MAKE_MAPI_E( 0x119 )
  132. #define MAPI_E_COMPUTED MAKE_MAPI_E( 0x11A )
  133. #define MAPI_E_CORRUPT_DATA MAKE_MAPI_E( 0x11B )
  134. #define MAPI_E_UNCONFIGURED MAKE_MAPI_E( 0x11C )
  135. #define MAPI_E_FAILONEPROVIDER MAKE_MAPI_E( 0x11D )
  136. /* WAB base function and status object specific errors and warnings */
  137. #define MAPI_E_END_OF_SESSION MAKE_MAPI_E( 0x200 )
  138. #define MAPI_E_UNKNOWN_ENTRYID MAKE_MAPI_E( 0x201 )
  139. #define MAPI_E_MISSING_REQUIRED_COLUMN MAKE_MAPI_E( 0x202 )
  140. #define MAPI_W_NO_SERVICE MAKE_MAPI_S( 0x203 )
  141. /* Property specific errors and warnings */
  142. #define MAPI_E_BAD_VALUE MAKE_MAPI_E( 0x301 )
  143. #define MAPI_E_INVALID_TYPE MAKE_MAPI_E( 0x302 )
  144. #define MAPI_E_TYPE_NO_SUPPORT MAKE_MAPI_E( 0x303 )
  145. #define MAPI_E_UNEXPECTED_TYPE MAKE_MAPI_E( 0x304 )
  146. #define MAPI_E_TOO_BIG MAKE_MAPI_E( 0x305 )
  147. #define MAPI_E_DECLINE_COPY MAKE_MAPI_E( 0x306 )
  148. #define MAPI_E_UNEXPECTED_ID MAKE_MAPI_E( 0x307 )
  149. #define MAPI_W_ERRORS_RETURNED MAKE_MAPI_S( 0x380 )
  150. /* Table specific errors and warnings */
  151. #define MAPI_E_UNABLE_TO_COMPLETE MAKE_MAPI_E( 0x400 )
  152. #define MAPI_E_TIMEOUT MAKE_MAPI_E( 0x401 )
  153. #define MAPI_E_TABLE_EMPTY MAKE_MAPI_E( 0x402 )
  154. #define MAPI_E_TABLE_TOO_BIG MAKE_MAPI_E( 0x403 )
  155. #define MAPI_E_INVALID_BOOKMARK MAKE_MAPI_E( 0x405 )
  156. #define MAPI_W_POSITION_CHANGED MAKE_MAPI_S( 0x481 )
  157. #define MAPI_W_APPROX_COUNT MAKE_MAPI_S( 0x482 )
  158. #define MAPI_W_PARTIAL_COMPLETION MAKE_MAPI_S( 0x680 )
  159. /* Address Book specific errors and warnings */
  160. #define MAPI_E_AMBIGUOUS_RECIP MAKE_MAPI_E( 0x700 )
  161. /* Miscellaneous errors */
  162. #define MAPI_E_COLLISION MAKE_MAPI_E( 0x604 )
  163. #define MAPI_E_NOT_INITIALIZED MAKE_MAPI_E( 0x605 )
  164. #define MAPI_E_FOLDER_CYCLE MAKE_MAPI_E( 0x60B )
  165. /* The range 0x0800 to 0x08FF is reserved */
  166. /* Obsolete typing shortcut that will go away eventually. */
  167. #ifndef MakeResult
  168. #define MakeResult(_s) ResultFromScode(_s)
  169. #endif
  170. /* We expect these to eventually be defined by OLE, but for now,
  171. * here they are. When OLE defines them they can be much more
  172. * efficient than these, but these are "proper" and don't make
  173. * use of any hidden tricks.
  174. */
  175. #ifndef HR_SUCCEEDED
  176. #define HR_SUCCEEDED(_hr) SUCCEEDED((SCODE)(_hr))
  177. #define HR_FAILED(_hr) FAILED((SCODE)(_hr))
  178. #endif
  179. #endif /* WABCODE_H */