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.

283 lines
11 KiB

  1. /*****************************************************************************\
  2. * *
  3. * scode.h - Defines standard status code services. *
  4. * *
  5. * OLE Version 2.0 *
  6. * *
  7. * Copyright (c) 1992-1993, Microsoft Corp. All rights reserved. *
  8. * *
  9. \*****************************************************************************/
  10. #ifndef __SCODE_H__
  11. #define __SCODE_H__
  12. //
  13. // SCODE
  14. //
  15. typedef long SCODE;
  16. typedef SCODE *PSCODE;
  17. typedef void FAR * HRESULT;
  18. #define NOERROR 0
  19. //
  20. // Status values are 32 bit values layed out 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 - Success
  33. // 1 - Error
  34. //
  35. // Context - context info
  36. //
  37. // Facility - is the facility code
  38. //
  39. // Code - is the facility's status code
  40. //
  41. //
  42. // Severity values
  43. //
  44. #define SEVERITY_SUCCESS 0
  45. #define SEVERITY_ERROR 1
  46. #define SUCCEEDED(Status) ((SCODE)(Status) >= 0)
  47. #define FAILED(Status) ((SCODE)(Status)<0)
  48. //
  49. // Return the code
  50. //
  51. #define SCODE_CODE(sc) ((sc) & 0xFFFF)
  52. //
  53. // Return the facility
  54. //
  55. #define SCODE_FACILITY(sc) (((sc) >> 16) & 0x1fff)
  56. //
  57. // Return the severity
  58. //
  59. #define SCODE_SEVERITY(sc) (((sc) >> 31) & 0x1)
  60. //
  61. // Create an SCODE value from component pieces
  62. //
  63. #define MAKE_SCODE(sev,fac,code) \
  64. ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
  65. // --------------------- Functions ---------------------------------------
  66. #define GetScode(hr) ((SCODE)(hr) & 0x800FFFFF)
  67. #define ResultFromScode(sc) ((HRESULT)((SCODE)(sc) & 0x800FFFFF))
  68. STDAPI PropagateResult(HRESULT hrPrev, SCODE scNew);
  69. // -------------------------- Facility definitions -------------------------
  70. #define FACILITY_NULL 0x0000 // generally useful errors ([SE]_*)
  71. #define FACILITY_RPC 0x0001 // remote procedure call errors (RPC_E_*)
  72. #define FACILITY_DISPATCH 0x0002 // late binding dispatch errors
  73. #define FACILITY_STORAGE 0x0003 // storage errors (STG_E_*)
  74. #define FACILITY_ITF 0x0004 // interface-specific errors
  75. #define S_OK 0L
  76. #define S_FALSE MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_NULL, 1)
  77. // --------------------- FACILITY_NULL errors ------------------------------
  78. #define E_UNEXPECTED MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 0xffff)
  79. // relatively catastrophic failure
  80. #define E_NOTIMPL MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 1)
  81. // not implemented
  82. #define E_OUTOFMEMORY MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 2)
  83. // ran out of memory
  84. #define E_INVALIDARG MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 3)
  85. // one or more arguments are invalid
  86. #define E_NOINTERFACE MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 4)
  87. // no such interface supported
  88. #define E_POINTER MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 5)
  89. // invalid pointer
  90. #define E_HANDLE MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 6)
  91. // invalid handle
  92. #define E_ABORT MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 7)
  93. // operation aborted
  94. #define E_FAIL MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 8)
  95. // unspecified error
  96. #define E_ACCESSDENIED MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 9)
  97. // general access denied error
  98. // ----------------- FACILITY_ITF errors used by OLE ---------------------
  99. //
  100. // By convention, OLE interfaces divide the FACILITY_ITF range of errors
  101. // into nonoverlapping subranges. If an OLE interface returns a FACILITY_ITF
  102. // scode, it must be from the range associated with that interface or from
  103. // the shared range: OLE_E_FIRST...OLE_E_LAST.
  104. //
  105. // The ranges, their associated interfaces, and the header file that defines
  106. // the actual scodes are given below.
  107. //
  108. // Generic OLE errors that may be returned by many interfaces
  109. #define OLE_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0000)
  110. #define OLE_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x00FF)
  111. #define OLE_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0000)
  112. #define OLE_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x00FF)
  113. // interfaces: all
  114. // file: ole2.h
  115. #define DRAGDROP_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0100)
  116. #define DRAGDROP_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x010F)
  117. #define DRAGDROP_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0100)
  118. #define DRAGDROP_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x010F)
  119. // interfaces: IDropSource, IDropTarget
  120. // file: ole2.h
  121. #define CLASSFACTORY_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0110)
  122. #define CLASSFACTORY_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x011F)
  123. #define CLASSFACTORY_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0110)
  124. #define CLASSFACTORY_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x011F)
  125. // interfaces: IClassFactory
  126. // file:
  127. #define MARSHAL_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0120)
  128. #define MARSHAL_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x012F)
  129. #define MARSHAL_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0120)
  130. #define MARSHAL_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x012F)
  131. // interfaces: IMarshal, IStdMarshalInfo, marshal APIs
  132. // file:
  133. #define DATA_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0130)
  134. #define DATA_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x013F)
  135. #define DATA_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0130)
  136. #define DATA_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x013F)
  137. // interfaces: IDataObject
  138. // file: dvobj.h
  139. #define VIEW_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0140)
  140. #define VIEW_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x014F)
  141. #define VIEW_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0140)
  142. #define VIEW_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x014F)
  143. // interfaces: IViewObject
  144. // file: dvobj.h
  145. #define REGDB_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0150)
  146. #define REGDB_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x015F)
  147. #define REGDB_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0150)
  148. #define REGDB_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x015F)
  149. // API: reg.dat manipulation
  150. // file:
  151. // range 160 - 16F reserved
  152. #define CACHE_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0170)
  153. #define CACHE_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x017F)
  154. #define CACHE_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0170)
  155. #define CACHE_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x017F)
  156. // interfaces: IOleCache
  157. // file:
  158. #define OLEOBJ_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0180)
  159. #define OLEOBJ_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x018F)
  160. #define OLEOBJ_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0180)
  161. #define OLEOBJ_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x018F)
  162. // interfaces: IOleObject
  163. // file:
  164. #define CLIENTSITE_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0190)
  165. #define CLIENTSITE_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x019F)
  166. #define CLIENTSITE_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0190)
  167. #define CLIENTSITE_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x019F)
  168. // interfaces: IOleClientSite
  169. // file:
  170. #define INPLACE_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01A0)
  171. #define INPLACE_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01AF)
  172. #define INPLACE_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01A0)
  173. #define INPLACE_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01AF)
  174. // interfaces: IOleWindow, IOleInPlaceObject, IOleInPlaceActiveObject,
  175. // IOleInPlaceUIWindow, IOleInPlaceFrame, IOleInPlaceSite
  176. // file:
  177. #define ENUM_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01B0)
  178. #define ENUM_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01BF)
  179. #define ENUM_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01B0)
  180. #define ENUM_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01BF)
  181. // interfaces: IEnum*
  182. // file:
  183. #define CONVERT10_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01C0)
  184. #define CONVERT10_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01CF)
  185. #define CONVERT10_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01C0)
  186. #define CONVERT10_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01CF)
  187. // API: OleConvertOLESTREAMToIStorage, OleConvertIStorageToOLESTREAM
  188. // file:
  189. #define CLIPBRD_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01D0)
  190. #define CLIPBRD_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01DF)
  191. #define CLIPBRD_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01D0)
  192. #define CLIPBRD_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01DF)
  193. // interfaces: OleSetClipboard, OleGetClipboard, OleFlushClipboard
  194. // file: ole2.h
  195. #define MK_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01E0)
  196. #define MK_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01EF)
  197. #define MK_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01E0)
  198. #define MK_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01EF)
  199. // interfaces: IMoniker, IBindCtx, IRunningObjectTable, IParseDisplayName,
  200. // IOleContainer, IOleItemContainer, IOleLink
  201. // file: moniker.h
  202. #define CO_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01F0)
  203. #define CO_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01FF)
  204. #define CO_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01F0)
  205. #define CO_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01FF)
  206. // all Co* API
  207. // file: compobj.h
  208. // range 200 - ffff for new error codes
  209. #endif // ifndef __SCODE_H__