// These error codes have been taken from the OLE header files and sorted
// into numerical order.  The comments too come from the OLE header files.
//
// This list is provided as a convenience for interpreting OLE error
// codes when functions fail.

#define S_OK                                   0x00000000
#define S_FALSE                                0x00000001
#define STG_S_CONVERTED                        0x00030200
#define OLE_S_FIRST                            0x00040000 // all interfaces
#define OLE_S_USEREG                           0x00040000 // use the reg database to provide the requested info
#define OLE_S_STATIC                           0x00040001 // success, but static 
#define OLE_S_MAC_CLIPFORMAT                   0x00040002 // macintosh clipboard format
#define OLE_S_LAST                             0x000400FF
#define DRAGDROP_S_DROP                        0x00040100
#define DRAGDROP_S_CANCEL                      0x00040101
#define DRAGDROP_S_USEDEFAULTCURSORS           0x00040102
#define CLASSFACTORY_S_FIRST                   0x00040110 // IClassFactory
#define CLASSFACTORY_S_LAST                    0x0004011F
#define MARSHAL_S_FIRST                        0x00040120 // IMarshal, IStdMarshalInfo, marshal APIs
#define MARSHAL_S_LAST                         0x0004012F
#define DATA_S_SAMEFORMATETC                   0x00040130
#define DATA_S_FIRST                           0x00040130 // IDataObject
#define DATA_S_LAST                            0x0004013F
#define VIEW_S_FIRST                           0x00040140 // IViewObject
#define VIEW_S_LAST                            0x0004014F
#define REGDB_S_FIRST                          0x00040150 // reg.dat manipulation API
#define REGDB_S_LAST                           0x0004015F
#define CACHE_S_FORMATETC_NOTSUPPORTED         0x00040170
#define CACHE_S_FIRST                          0x00040170 // IOleCache
#define CACHE_S_SAMECACHE                      0x00040171
#define CACHE_S_SOMECACHES_NOTUPDATED          0x00040172
#define CACHE_S_LAST                           0x0004017F
#define OLEOBJ_S_FIRST                         0x00040180 // IOleObject
#define OLEOBJ_S_CANNOT_DOVERB_NOW             0x00040181
#define OLEOBJ_S_INVALIDHWND                   0x00040182
#define OLEOBJ_S_LAST                          0x0004018F
#define CLIENTSITE_S_FIRST                     0x00040190 // IOleClientSite
#define CLIENTSITE_S_LAST                      0x0004019F
#define INPLACE_S_FIRST                        0x000401A0 // IOleWindow,IOleInPlaceObject,IOleInPlaceActiveObject
#define INPLACE_S_TRUNCATED                    0x000401A0 // Message is too long, some of it had to be truncated before displaying
#define INPLACE_S_LAST                         0x000401AF // IOleInPlaceUIWindow,IOleInPlaceFrame,IOleInPlaceSite
#define ENUM_S_FIRST                           0x000401B0 // IEnum*
#define ENUM_S_LAST                            0x000401BF
#define CONVERT10_S_FIRST                      0x000401C0 // OleConvertOLESTREAMToIStorage, OleConvertIStorageToOLESTREAM
#define CONVERT10_S_NO_PRESENTATION            0x000401C0 // Returned by either API,  the original object had no presentation
#define CONVERT10_S_LAST                       0x000401CF
#define CLIPBRD_S_FIRST                        0x000401D0 // OleSetClipboard, OleGetClipboard, OleFlushClipboard
#define CLIPBRD_S_LAST                         0x000401DF
#define MK_S_FIRST                             0x000401E0 // IMoniker, IBindCtx, IRunningObjectTable, IParseDisplayName
#define MK_S_REDUCED_TO_SELF                   0x000401E2
#define MK_S_ME                                0x000401E4
#define MK_S_HIM                               0x000401E5
#define MK_S_US                                0x000401E6
#define MK_S_MONIKERALREADYREGISTERED          0x000401E7
#define MK_S_LAST                              0x000401EF // IOleContainer, IOleItemContainer, IOleLink
#define CO_S_FIRST                             0x000401F0 // all Co* API
#define CO_S_LAST                              0x000401FF
#define E_NOTIMPL                              0x80000001 // not implemented
#define E_OUTOFMEMORY                          0x80000002 // ran out of memory
#define E_INVALIDARG                           0x80000003 // one or more arguments are invalid
#define E_NOINTERFACE                          0x80000004 // no such interface supported
#define E_POINTER                              0x80000005 // invalid pointer
#define E_HANDLE                               0x80000006 // invalid handle
#define E_ABORT                                0x80000007 // operation aborted
#define E_FAIL                                 0x80000008 // unspecified error
#define E_ACCESSDENIED                         0x80000009 // general access denied error
#define E_UNEXPECTED                           0x8000FFFF // relatively catastrophic failure
#define RPC_E_CALL_REJECTED                    0x80010001 // call was rejected by callee
#define RPC_E_CALL_CANCELED                    0x80010002 // call was canceld by call - returned by MessagePending
#define RPC_E_CANTPOST_INSENDCALL              0x80010003 // the caller is dispatching an intertask SendMessage call and can NOT call out via PostMessage
#define RPC_E_CANTCALLOUT_INASYNCCALL          0x80010004 // the caller is dispatching an asynchronus call can NOT make an outgoing call on behalf of this call
#define RPC_E_CANTCALLOUT_INEXTERNALCALL       0x80010005 // the caller is not in a state where an outgoing call can be made
#define RPC_E_CONNECTION_TERMINATED            0x80010006 // the connection terminated or is in a bogus state
#define RPC_E_SERVER_DIED                      0x80010007 // the callee (server [not server application]) is not available 
#define RPC_E_CLIENT_DIED                      0x80010008 // the caller (client) disappeared while the callee (server) was processing a call 
#define RPC_E_INVALID_DATAPACKET               0x80010009 // the date paket with the marshalled parameter data is incorrect
#define RPC_E_CANTTRANSMIT_CALL                0x8001000A // the call was not transmitted properly; the message queue was full and was not emptied after yielding
#define RPC_E_CLIENT_CANTMARSHAL_DATA          0x8001000B // the client (caller) can not marshall the parameter data
#define RPC_E_CLIENT_CANTUNMARSHAL_DATA        0x8001000C // the client (caller) can not unmarshall the return data
#define RPC_E_SERVER_CANTMARSHAL_DATA          0x8001000D // the server (caller) can not unmarshall the parameter data
#define RPC_E_SERVER_CANTUNMARSHAL_DATA        0x8001000E // the server (caller) can not marshall the return data - low memory
#define RPC_E_INVALID_DATA                     0x8001000F // received data are invalid; can be server or client data
#define RPC_E_INVALID_PARAMETER                0x80010010 // a particular parameter is invalid and can not be un/marshalled
#define RPC_E_CANTCALLOUT_AGAIN                0x80010011 // DDE conversation - no second outgoing call on same channel
#define RPC_E_UNEXPECTED                       0x8001FFFF // a internal error occured 
#define DISP_E_UNKNOWNINTERFACE                0x80020001
#define DISP_E_MEMBERNOTFOUND                  0x80020003
#define DISP_E_PARAMNOTFOUND                   0x80020004
#define DISP_E_TYPEMISMATCH                    0x80020005
#define DISP_E_UNKNOWNNAME                     0x80020006
#define DISP_E_NONAMEDARGS                     0x80020007
#define DISP_E_BADVARTYPE                      0x80020008
#define DISP_E_EXCEPTION                       0x80020009
#define DISP_E_OVERFLOW                        0x8002000A
#define DISP_E_BADINDEX                        0x8002000B
#define DISP_E_UNKNOWNLCID                     0x8002000C
#define DISP_E_ARRAYISLOCKED                   0x8002000D
#define DISP_E_BADPARAMCOUNT                   0x8002000E
#define DISP_E_PARAMNOTOPTIONAL                0x8002000F
#define DISP_E_BADCALLEE                       0x80020010
#define DISP_E_NOTACOLLECTION                  0x80020011
#define TYPE_E_BUFFERTOOSMALL                  0x80028016
#define TYPE_E_INVDATAREAD                     0x80028018
#define TYPE_E_UNSUPFORMAT                     0x80028019
#define TYPE_E_REGISTRYACCESS                  0x8002801C
#define TYPE_E_LIBNOTREGISTERED                0x8002801D
#define TYPE_E_UNDEFINEDTYPE                   0x80028027
#define TYPE_E_QUALIFIEDNAMEDISALLOWED         0x80028028
#define TYPE_E_INVALIDSTATE                    0x80028029
#define TYPE_E_WRONGTYPEKIND                   0x8002802A
#define TYPE_E_ELEMENTNOTFOUND                 0x8002802B
#define TYPE_E_AMBIGUOUSNAME                   0x8002802C
#define TYPE_E_NAMECONFLICT                    0x8002802D
#define TYPE_E_UNKNOWNLCID                     0x8002802E
#define TYPE_E_DLLFUNCTIONNOTFOUND             0x8002802F
#define TYPE_E_BADMODULEKIND                   0x800288BD
#define TYPE_E_SIZETOOBIG                      0x800288C5
#define TYPE_E_DUPLICATEID                     0x800288C6
#define TYPE_E_TYPEMISMATCH                    0x80028CA0
#define TYPE_E_OUTOFBOUNDS                     0x80028CA1
#define TYPE_E_IOERROR                         0x80028CA2
#define TYPE_E_CANTCREATETMPFILE               0x80028CA3
#define TYPE_E_CANTLOADLIBRARY                 0x80029C4A
#define TYPE_E_INCONSISTENTPROPFUNCS           0x80029C83
#define TYPE_E_CIRCULARTYPE                    0x80029C84
#define STG_E_INVALIDFUNCTION                  0x80030001
#define STG_E_FILENOTFOUND                     0x80030002
#define STG_E_PATHNOTFOUND                     0x80030003
#define STG_E_TOOMANYOPENFILES                 0x80030004
#define STG_E_ACCESSDENIED                     0x80030005
#define STG_E_INVALIDHANDLE                    0x80030006
#define STG_E_INSUFFICIENTMEMORY               0x80030008
#define STG_E_INVALIDPOINTER                   0x80030009
#define STG_E_NOMOREFILES                      0x80030012
#define STG_E_DISKISWRITEPROTECTED             0x80030013
#define STG_E_SEEKERROR                        0x80030019
#define STG_E_WRITEFAULT                       0x8003001D
#define STG_E_READFAULT                        0x8003001E
#define STG_E_SHAREVIOLATION                   0x80030020
#define STG_E_LOCKVIOLATION                    0x80030021
#define STG_E_FILEALREADYEXISTS                0x80030050
#define STG_E_INVALIDPARAMETER                 0x80030057
#define STG_E_MEDIUMFULL                       0x80030070
#define STG_E_ABNORMALAPIEXIT                  0x800300FA
#define STG_E_INVALIDHEADER                    0x800300FB
#define STG_E_INVALIDNAME                      0x800300FC
#define STG_E_UNKNOWN                          0x800300FD
#define STG_E_UNIMPLEMENTEDFUNCTION            0x800300FE
#define STG_E_INVALIDFLAG                      0x800300FF
#define STG_E_INUSE                            0x80030100
#define STG_E_NOTCURRENT                       0x80030101
#define STG_E_REVERTED                         0x80030102
#define STG_E_CANTSAVE                         0x80030103
#define STG_E_OLDFORMAT                        0x80030104
#define STG_E_OLDDLL                           0x80030105
#define STG_E_SHAREREQUIRED                    0x80030106
#define STG_E_NOTFILEBASEDSTORAGE              0x80030107
#define STG_E_EXTANTMARSHALLINGS               0x80030108
#define OLE_E_FIRST                            0x80040000 // all interfaces
#define OLE_E_OLEVERB                          0x80040000 // invalid OLEVERB structure  
#define OLE_E_ADVF                             0x80040001 // invalid advise flags
#define OLE_E_ENUM_NOMORE                      0x80040002 // you can't enuemrate any more, because the associated data is missing
#define OLE_E_ADVISENOTSUPPORTED               0x80040003 // this implementation doesn't take advises
#define OLE_E_NOCONNECTION                     0x80040004 // there is no connection for this connection id
#define OLE_E_NOTRUNNING                       0x80040005 // need run the object to perform this operation
#define OLE_E_NOCACHE                          0x80040006 // there is no cache to operate on
#define OLE_E_BLANK                            0x80040007 // Uninitialized object
#define OLE_E_CLASSDIFF                        0x80040008 // linked object's source class has changed 
#define OLE_E_CANT_GETMONIKER                  0x80040009 // not able to get the moniker of the object
#define OLE_E_CANT_BINDTOSOURCE                0x8004000A // not able to bind to the source
#define OLE_E_STATIC                           0x8004000B // object is static, operation not allowed
#define OLE_E_PROMPTSAVECANCELLED              0x8004000C // user cancelled out of save dialog
#define OLE_E_INVALIDRECT                      0x8004000D // invalid rectangle 
#define OLE_E_WRONGCOMPOBJ                     0x8004000E // compobj.dll is too old for the ole2.dll initialized
#define OLE_E_INVALIDHWND                      0x8004000F // invalid window handle
#define OLE_E_NOT_INPLACEACTIVE                0x80040010 // object is not in any of the inplace active states  
#define OLE_E_CANTCONVERT                      0x80040011 // not able to convert the object 
#define OLE_E_NOSTORAGE                        0x80040012 // not able to perform the operation because object is not given storage yet.
#define DVGEN_E_FIRST                          0x80040064 // (OLE_E_FIRST+100) Might move to FACILITY_NULL
#define DV_E_FORMATETC                         0x80040064 // invalid FORMATETC structure
#define DV_E_DVTARGETDEVICE                    0x80040065 // invalid DVTARGETDEVICE structure
#define DV_E_STGMEDIUM                         0x80040066 // invalid STDGMEDIUM structure
#define DV_E_STATDATA                          0x80040067 // invalid STATDATA structure
#define DV_E_LINDEX                            0x80040068 // invalid lindex
#define DV_E_TYMED                             0x80040069 // invalid tymed
#define DV_E_CLIPFORMAT                        0x8004006A // invalid clipboard format
#define DV_E_DVASPECT                          0x8004006B // invalid aspect(s) 
#define DV_E_DVTARGETDEVICE_SIZE               0x8004006C // tdSize paramter of the DVTARGETDEVICE structure is invalid
#define DV_E_NOIVIEWOBJECT                     0x8004006D // object doesn't support IViewObject interface
#define OLE_E_LAST                             0x800400FF  
#define DRAGDROP_E_FIRST                       0x80040100 // IDropSource, IDropTarget
#define DRAGDROP_S_FIRST                       0x80040100 // IDropSource, IDropTarget
#define DRAGDROP_E_INVALIDHWND                 0x80040100 // invalid HWND
#define DRAGDROP_E_ALREADYREGISTERED           0x80040100 // this window has already been registered as a drop target
#define DRAGDROP_E_NOTREGISTERED               0x80040100 // trying to revoke a drop target that has not been registered 
#define DRAGDROP_E_LAST                        0x8004010F
#define DRAGDROP_S_LAST                        0x8004010F
#define CLASS_E_NOAGGREGATION                  0x80040110 // class does not support aggregation (or class object is remote)
#define CLASSFACTORY_E_FIRST                   0x80040110 // IClassFactory
#define CLASS_E_CLASSNOTAVAILABLE              0x80040111 // dll doesn't support that class (returned from DllGetClassObject)
#define CLASSFACTORY_E_LAST                    0x8004011F
#define MARSHAL_E_FIRST                        0x80040120 // IMarshal, IStdMarshalInfo, marshal APIs
#define MARSHAL_E_LAST                         0x8004012F 
#define DATA_E_FIRST                           0x80040130 // IDataObject
#define DATA_E_LAST                            0x8004013F
#define VIEW_E_DRAW                            0x80040140
#define VIEW_E_FIRST                           0x80040140 // IViewObject
#define VIEW_E_LAST                            0x8004014F
#define REGDB_E_FIRST                          0x80040150 // reg.dat manipulation API
#define REGDB_E_READREGDB                      0x80040150 // some error reading the registration database
#define REGDB_E_WRITEREGDB                     0x80040151 // some error reading the registration database
#define REGDB_E_KEYMISSING                     0x80040152 // some error reading the registration database
#define REGDB_E_INVALIDVALUE                   0x80040153 // some error reading the registration database
#define REGDB_E_CLASSNOTREG                    0x80040154 // some error reading the registration database
#define REGDB_E_IIDNOTREG                      0x80040155 // some error reading the registration database
#define REGDB_E_LAST                           0x8004015F
#define CACHE_E_NOCACHE_UPDATED                0x80040170
#define CACHE_E_FIRST                          0x80040170 // IOleCache
#define CACHE_E_LAST                           0x8004017F
#define OLEOBJ_E_NOVERBS                       0x80040180
#define OLEOBJ_S_INVALIDVERB                   0x80040180
#define OLEOBJ_E_FIRST                         0x80040180 // IOleObject
#define OLEOBJ_E_INVALIDVERB                   0x80040181
#define OLEOBJ_E_LAST                          0x8004018F
#define CLIENTSITE_E_FIRST                     0x80040190 // IOleClientSite
#define CLIENTSITE_E_LAST                      0x8004019F
#define INPLACE_E_FIRST                        0x800401A0 // IOleWindow,IOleInPlaceObject,IOleInPlaceActiveObject
#define INPLACE_E_NOTUNDOABLE                  0x800401A0 // undo is not avaiable
#define INPLACE_E_NOTOOLSPACE                  0x800401A1 // Space for tools is not available
#define INPLACE_E_LAST                         0x800401AF // IOleInPlaceUIWindow,IOleInPlaceFrame,IOleInPlaceSite
#define ENUM_E_FIRST                           0x800401B0 // IEnum*
#define ENUM_E_LAST                            0x800401BF
#define CONVERT10_E_FIRST                      0x800401C0 // OleConvertOLESTREAMToIStorage, OleConvertIStorageToOLESTREAM
#define CONVERT10_E_OLESTREAM_GET              0x800401C0 // OLESTREAM Get method failed
#define CONVERT10_E_OLESTREAM_PUT              0x800401C1 // OLESTREAM Put method failed
#define CONVERT10_E_OLESTREAM_FMT              0x800401C2 // Contents of the OLESTREAM not in correct format
#define CONVERT10_E_OLESTREAM_BITMAP_TO_DIB    0x800401C3 // There was in an error in a Windows GDI call while converting the bitmap to a DIB
#define CONVERT10_E_STG_FMT                    0x800401C4 // Contents of the IStorage not in correct format
#define CONVERT10_E_STG_NO_STD_STREAM          0x800401C5 // Contents of IStorage is missing one of the standard streams ("\1CompObj", "\1Ole", "\2OlePres000")
#define CONVERT10_E_STG_DIB_TO_BITMAP          0x800401C6 // There was in an error in a Windows GDI call while converting the DIB to a bitmap
#define CONVERT10_E_LAST                       0x800401CF
#define CLIPBRD_E_FIRST                        0x800401D0 // OleSetClipboard, OleGetClipboard, OleFlushClipboard
#define CLIPBRD_E_CANT_OPEN                    0x800401D0 // OpenClipboard Failed
#define CLIPBRD_E_CANT_EMPTY                   0x800401D1 // EmptyClipboard Failed
#define CLIPBRD_E_CANT_SET                     0x800401D2 // SetClipboard Failed
#define CLIPBRD_E_BAD_DATA                     0x800401D3 // Data on clipboard is invalid
#define CLIPBRD_E_CANT_CLOSE                   0x800401D4 // OpenClipboard Failed
#define CLIPBRD_E_LAST                         0x800401DF
#define MK_E_CONNECTMANUALLY                   0x800401E0
#define MK_E_FIRST                             0x800401E0 // IMoniker, IBindCtx, IRunningObjectTable, IParseDisplayName
#define MK_E_EXCEEDEDDEADLINE                  0x800401E1
#define MK_E_NEEDGENERIC                       0x800401E2
#define MK_E_UNAVAILABLE                       0x800401E3
#define MK_E_SYNTAX                            0x800401E4
#define MK_E_NOOBJECT                          0x800401E5
#define MK_E_INVALIDEXTENSION                  0x800401E6
#define MK_E_INTERMEDIATEINTERFACENOTSUPPORTED 0x800401E7
#define MK_E_NOTBINDABLE                       0x800401E8
#define MK_E_NOTBOUND                          0x800401E9 // called IBindCtx->RevokeObjectBound for an object which was not bound
#define MK_E_CANTOPENFILE                      0x800401EA
#define MK_E_MUSTBOTHERUSER                    0x800401EB
#define MK_E_NOINVERSE                         0x800401EC
#define MK_E_NOSTORAGE                         0x800401ED
#define MK_E_NOPREFIX                          0x800401EE
#define MK_E_LAST                              0x800401EF // IOleContainer, IOleItemContainer, IOleLink
#define CO_E_FIRST                             0x800401F0 // all Co* API
#define CO_E_NOTINITIALIZED                    0x800401F0 // CoInitialize has not been called and must be
#define CO_E_ALREADYINITIALIZED                0x800401F1 // CoInitialize has already been called and cannot be called again (temporary)
#define CO_E_CANTDETERMINECLASS                0x800401F2 // can't determine clsid (e.g., extension not in reg.dat)
#define CO_E_CLASSSTRING                       0x800401F3 // the string form of the clsid is invalid (including ole1 classes)
#define CO_E_IIDSTRING                         0x800401F4 // the string form of the iid is invalid
#define CO_E_APPNOTFOUND                       0x800401F5 // application not found
#define CO_E_APPSINGLEUSE                      0x800401F6 // application cannot be run more than once
#define CO_E_ERRORINAPP                        0x800401F7 // some error in the app program file
#define CO_E_DLLNOTFOUND                       0x800401F8 // dll not found
#define CO_E_ERRORINDLL                        0x800401F9 // some error in the dll file
#define CO_E_WRONGOSFORAPP                     0x800401FA // app written for other version of OS or other OS altogether
#define CO_E_OBJNOTREG                         0x800401FB // object is not registered
#define CO_E_OBJISREG                          0x800401FC // object is already registered
#define CO_E_OBJNOTCONNECTED                   0x800401FD // handler is not connected to server
#define CO_E_APPDIDNTREG                       0x800401FE // app was launched, but didn't registered a class factory
#define CO_E_LAST                              0x800401FF
#define FACILITY_NULL                         0  // generally useful errors ([SE]_*)
#define FACILITY_RPC                          1  // remote procedure call errors (RPC_E_*)
#define FACILITY_DISPATCH                     2  // late binding dispatch errors
#define FACILITY_STORAGE                      3  // storage errors (STG_E_*)
#define FACILITY_ITF                          4  // interface-specific errors
