|
|
1.1 root 1: //+---------------------------------------------------------------------------
2: //
3: // File: SCode.h
4: //
5: // Contents: Defines standard status code services.
6: //
7: //
8: //----------------------------------------------------------------------------
9:
10: #ifndef __SCODE_H__
11: #define __SCODE_H__
12:
13: //
14: // SCODE
15: //
16:
17: typedef long SCODE;
18: typedef SCODE *PSCODE;
19: typedef void FAR * HRESULT;
20: #define NOERROR 0
21:
22: //
23: // Status values are 32 bit values layed out as follows:
24: //
25: // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
26: // 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
27: // +-+---------------------+-------+-------------------------------+
28: // |S| Context | Facil | Code |
29: // +-+---------------------+-------+-------------------------------+
30: //
31: // where
32: //
33: // S - is the severity code
34: //
35: // 0 - Success
36: // 1 - Error
37: //
38: // Context - context info
39: //
40: // Facility - is the facility code
41: //
42: // Code - is the facility's status code
43: //
44:
45: //
46: // Severity values
47: //
48:
49: #define SEVERITY_SUCCESS 0
50: #define SEVERITY_ERROR 1
51:
52:
53:
54: #define SUCCEEDED(Status) ((SCODE)(Status) >= 0)
55:
56: #define FAILED(Status) ((SCODE)(Status)<0)
57:
58:
59: //
60: // Return the code
61: //
62:
63: #define SCODE_CODE(sc) ((sc) & 0xFFFF)
64:
65: //
66: // Return the facility
67: //
68:
69: #define SCODE_FACILITY(sc) (((sc) >> 16) & 0x1fff)
70:
71: //
72: // Return the severity
73: //
74:
75: #define SCODE_SEVERITY(sc) (((sc) >> 31) & 0x1)
76:
77: //
78: // Create an SCODE value from component pieces
79: //
80:
81: #define MAKE_SCODE(sev,fac,code) \
82: ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
83:
84:
85:
86: // --------------------- Functions ---------------------------------------
87:
88: #define GetScode(hr) ((SCODE)(hr) & 0x800FFFFF)
89: #define ResultFromScode(sc) ((HRESULT)((SCODE)(sc) & 0x800FFFFF))
90:
91: STDAPI PropagateResult(HRESULT hrPrev, SCODE scNew);
92:
93:
94: // -------------------------- Facility definitions -------------------------
95:
96: #define FACILITY_NULL 0x0000 // generally useful errors ([SE]_*)
97: #define FACILITY_RPC 0x0001 // remote procedure call errors (RPC_E_*)
98: #define FACILITY_DISPATCH 0x0002 // late binding dispatch errors
99: #define FACILITY_STORAGE 0x0003 // storage errors (STG_E_*)
100: #define FACILITY_ITF 0x0004 // interface-specific errors
101:
102:
103:
104: #define S_OK 0L
105: #define S_FALSE MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_NULL, 1)
106:
107:
108:
109: // --------------------- FACILITY_NULL errors ------------------------------
110:
111: #define E_UNEXPECTED MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 0xffff)
112: // relatively catastrophic failure
113:
114: #define E_NOTIMPL MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 1)
115: // not implemented
116:
117: #define E_OUTOFMEMORY MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 2)
118: // ran out of memory
119:
120: #define E_INVALIDARG MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 3)
121: // one or more arguments are invalid
122:
123: #define E_NOINTERFACE MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 4)
124: // no such interface supported
125:
126:
127: #define E_POINTER MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 5)
128: // invalid pointer
129:
130: #define E_HANDLE MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 6)
131: // invalid handle
132:
133: #define E_ABORT MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 7)
134: // operation aborted
135:
136: #define E_FAIL MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 8)
137: // unspecified error
138:
139:
140: #define E_ACCESSDENIED MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 9)
141: // general access denied error
142:
143:
144: // ----------------- FACILITY_ITF errors used by OLE ---------------------
145: //
146: // By convention, OLE interfaces divide the FACILITY_ITF range of errors
147: // into nonoverlapping subranges. If an OLE interface returns a FACILITY_ITF
148: // scode, it must be from the range associated with that interface or from
149: // the shared range: OLE_E_FIRST...OLE_E_LAST.
150: //
151: // The ranges, their associated interfaces, and the header file that defines
152: // the actual scodes are given below.
153: //
154:
155: // Generic OLE errors that may be returned by many interfaces
156: #define OLE_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0000)
157: #define OLE_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x00FF)
158: #define OLE_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0000)
159: #define OLE_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x00FF)
160: // interfaces: all
161: // file: ole2.h
162:
163:
164: #define DRAGDROP_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0100)
165: #define DRAGDROP_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x010F)
166: #define DRAGDROP_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0100)
167: #define DRAGDROP_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x010F)
168: // interfaces: IDropSource, IDropTarget
169: // file: ole2.h
170:
171: #define CLASSFACTORY_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0110)
172: #define CLASSFACTORY_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x011F)
173: #define CLASSFACTORY_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0110)
174: #define CLASSFACTORY_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x011F)
175: // interfaces: IClassFactory
176: // file:
177:
178: #define MARSHAL_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0120)
179: #define MARSHAL_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x012F)
180: #define MARSHAL_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0120)
181: #define MARSHAL_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x012F)
182: // interfaces: IMarshal, IStdMarshalInfo, marshal APIs
183: // file:
184:
185: #define DATA_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0130)
186: #define DATA_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x013F)
187: #define DATA_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0130)
188: #define DATA_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x013F)
189: // interfaces: IDataObject
190: // file: dvobj.h
191:
192: #define VIEW_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0140)
193: #define VIEW_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x014F)
194: #define VIEW_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0140)
195: #define VIEW_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x014F)
196: // interfaces: IViewObject
197: // file: dvobj.h
198:
199: #define REGDB_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0150)
200: #define REGDB_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x015F)
201: #define REGDB_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0150)
202: #define REGDB_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x015F)
203: // API: reg.dat manipulation
204:
205: // range 160 - 16F reserved
206:
207: #define CACHE_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0170)
208: #define CACHE_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x017F)
209: #define CACHE_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0170)
210: #define CACHE_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x017F)
211: // interfaces: IOleCache
212: // file:
213:
214: #define OLEOBJ_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0180)
215: #define OLEOBJ_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x018F)
216: #define OLEOBJ_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0180)
217: #define OLEOBJ_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x018F)
218: // interfaces: IOleObject
219: // file:
220:
221: #define CLIENTSITE_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0190)
222: #define CLIENTSITE_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x019F)
223: #define CLIENTSITE_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0190)
224: #define CLIENTSITE_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x019F)
225: // interfaces: IOleClientSite
226: // file:
227:
228: #define INPLACE_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01A0)
229: #define INPLACE_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01AF)
230: #define INPLACE_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01A0)
231: #define INPLACE_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01AF)
232: // interfaces: IOleWindow, IOleInPlaceObject, IOleInPlaceActiveObject,
233: // IOleInPlaceUIWindow, IOleInPlaceFrame, IOleInPlaceSite
234: // file:
235:
236: #define ENUM_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01B0)
237: #define ENUM_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01BF)
238: #define ENUM_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01B0)
239: #define ENUM_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01BF)
240: // interfaces: IEnum*
241: // file:
242:
243: #define CONVERT10_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01C0)
244: #define CONVERT10_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01CF)
245: #define CONVERT10_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01C0)
246: #define CONVERT10_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01CF)
247: // API: OleConvertOLESTREAMToIStorage, OleConvertIStorageToOLESTREAM
248: // file:
249:
250:
251: #define CLIPBRD_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01D0)
252: #define CLIPBRD_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01DF)
253: #define CLIPBRD_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01D0)
254: #define CLIPBRD_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01DF)
255: // interfaces: OleSetClipboard, OleGetClipboard, OleFlushClipboard
256: // file: ole2.h
257:
258: #define MK_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01E0)
259: #define MK_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01EF)
260: #define MK_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01E0)
261: #define MK_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01EF)
262: // interfaces: IMoniker, IBindCtx, IRunningObjectTable, IParseDisplayName,
263: // IOleContainer, IOleItemContainer, IOleLink
264: // file: moniker.h
265:
266:
267: #define CO_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01F0)
268: #define CO_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x01FF)
269: #define CO_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01F0)
270: #define CO_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x01FF)
271: // all Co* API
272: // file: compobj.h
273:
274:
275: // range 200 - ffff for new error codes
276:
277:
278: #ifndef OLE2SHIP
279: #define E_UNSPEC E_FAIL
280: #define ADVSINK_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0150)
281: #define ADVSINK_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x015F)
282: #define ADVSINK_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0150)
283: #define ADVSINK_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x015F)
284: #define ADVHOLDER_E_FIRST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x0160)
285: #define ADVHOLDER_E_LAST MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x016F)
286: #define ADVHOLDER_S_FIRST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x0160)
287: #define ADVHOLDER_S_LAST MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_ITF, 0x016F)
288: #endif
289:
290: #endif // ifndef __SCODE_H__
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.