Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef _OLE_H_
      7 #define _OLE_H_
      8 
      9 #ifdef _OLE2_H_
     10 #error You can't use ole.h and ole2.h together.
     11 #endif
     12 
     13 #ifdef __cplusplus
     14 extern "C" {
     15 #endif
     16 
     17 #ifndef WINAPI
     18 #define WINAPI __stdcall
     19 #define CALLBACK __stdcall
     20 #define LPCSTR LPSTR
     21 #define LRESULT LONG_PTR
     22 #define HGLOBAL HANDLE
     23 #endif
     24 
     25 #define OLE_LPCSTR LPCSTR
     26 #define OLE_CONST const
     27 
     28 #define LRESULT LONG_PTR
     29 #define HGLOBAL HANDLE
     30 
     31 #define OT_LINK __MSABI_LONG(1)
     32 #define OT_EMBEDDED __MSABI_LONG(2)
     33 #define OT_STATIC __MSABI_LONG(3)
     34 
     35 #define OLEVERB_PRIMARY 0
     36 
     37   typedef struct _OLETARGETDEVICE {
     38     USHORT otdDeviceNameOffset;
     39     USHORT otdDriverNameOffset;
     40     USHORT otdPortNameOffset;
     41     USHORT otdExtDevmodeOffset;
     42     USHORT otdExtDevmodeSize;
     43     USHORT otdEnvironmentOffset;
     44     USHORT otdEnvironmentSize;
     45     BYTE otdData[1];
     46   } OLETARGETDEVICE;
     47 
     48   typedef OLETARGETDEVICE *LPOLETARGETDEVICE;
     49 
     50 #define OF_SET 0x0001
     51 #define OF_GET 0x0002
     52 #define OF_HANDLER 0x0004
     53 
     54   typedef enum {
     55     OLE_OK,OLE_WAIT_FOR_RELEASE,OLE_BUSY,OLE_ERROR_PROTECT_ONLY,OLE_ERROR_MEMORY,OLE_ERROR_STREAM,OLE_ERROR_STATIC,OLE_ERROR_BLANK,
     56     OLE_ERROR_DRAW,OLE_ERROR_METAFILE,OLE_ERROR_ABORT,OLE_ERROR_CLIPBOARD,OLE_ERROR_FORMAT,OLE_ERROR_OBJECT,OLE_ERROR_OPTION,OLE_ERROR_PROTOCOL,
     57     OLE_ERROR_ADDRESS,OLE_ERROR_NOT_EQUAL,OLE_ERROR_HANDLE,OLE_ERROR_GENERIC,OLE_ERROR_CLASS,OLE_ERROR_SYNTAX,OLE_ERROR_DATATYPE,OLE_ERROR_PALETTE,
     58     OLE_ERROR_NOT_LINK,OLE_ERROR_NOT_EMPTY,OLE_ERROR_SIZE,OLE_ERROR_DRIVE,OLE_ERROR_NETWORK,OLE_ERROR_NAME,OLE_ERROR_TEMPLATE,OLE_ERROR_NEW,
     59     OLE_ERROR_EDIT,OLE_ERROR_OPEN,OLE_ERROR_NOT_OPEN,OLE_ERROR_LAUNCH,OLE_ERROR_COMM,OLE_ERROR_TERMINATE,OLE_ERROR_COMMAND,OLE_ERROR_SHOW,
     60     OLE_ERROR_DOVERB,OLE_ERROR_ADVISE_NATIVE,OLE_ERROR_ADVISE_PICT,OLE_ERROR_ADVISE_RENAME,OLE_ERROR_POKE_NATIVE,OLE_ERROR_REQUEST_NATIVE,
     61     OLE_ERROR_REQUEST_PICT,OLE_ERROR_SERVER_BLOCKED,OLE_ERROR_REGISTRATION,OLE_ERROR_ALREADY_REGISTERED,OLE_ERROR_TASK,OLE_ERROR_OUTOFDATE,
     62     OLE_ERROR_CANT_UPDATE_CLIENT,OLE_ERROR_UPDATE,OLE_ERROR_SETDATA_FORMAT,OLE_ERROR_STATIC_FROM_OTHER_OS,OLE_ERROR_FILE_VER,OLE_WARN_DELETE_DATA = 1000
     63   } OLESTATUS;
     64 
     65   typedef enum {
     66     OLE_CHANGED,OLE_SAVED,OLE_CLOSED,OLE_RENAMED,OLE_QUERY_PAINT,OLE_RELEASE,OLE_QUERY_RETRY
     67   } OLE_NOTIFICATION;
     68 
     69   typedef enum {
     70     OLE_NONE,OLE_DELETE,OLE_LNKPASTE,OLE_EMBPASTE,OLE_SHOW,OLE_RUN,OLE_ACTIVATE,OLE_UPDATE,OLE_CLOSE,OLE_RECONNECT,OLE_SETUPDATEOPTIONS,
     71     OLE_SERVERUNLAUNCH,OLE_LOADFROMSTREAM,OLE_SETDATA,OLE_REQUESTDATA,OLE_OTHER,OLE_CREATE,OLE_CREATEFROMTEMPLATE,OLE_CREATELINKFROMFILE,
     72     OLE_COPYFROMLNK,OLE_CREATEFROMFILE,OLE_CREATEINVISIBLE
     73   } OLE_RELEASE_METHOD;
     74 
     75   typedef enum {
     76     olerender_none,olerender_draw,olerender_format
     77   } OLEOPT_RENDER;
     78 
     79   typedef WORD OLECLIPFORMAT;
     80 
     81   typedef enum {
     82     oleupdate_always,oleupdate_onsave,
     83 #ifdef OLE_INTERNAL
     84     oleupdate_oncall,oleupdate_onclose
     85 #else
     86     oleupdate_oncall
     87 #endif
     88   } OLEOPT_UPDATE;
     89 
     90   typedef HANDLE HOBJECT;
     91   typedef LONG_PTR LHSERVER;
     92   typedef LONG_PTR LHCLIENTDOC;
     93   typedef LONG_PTR LHSERVERDOC;
     94 #ifndef _LPOLEOBJECT_DEFINED
     95 #define _LPOLEOBJECT_DEFINED
     96   typedef struct _OLEOBJECT *LPOLEOBJECT;
     97 #endif
     98   typedef struct _OLESTREAM *LPOLESTREAM;
     99   typedef struct _OLECLIENT *LPOLECLIENT;
    100 
    101   typedef struct _OLEOBJECTVTBL {
    102     void *(CALLBACK *QueryProtocol) (LPOLEOBJECT,LPCSTR);
    103     OLESTATUS (CALLBACK *Release) (LPOLEOBJECT);
    104     OLESTATUS (CALLBACK *Show) (LPOLEOBJECT,WINBOOL);
    105     OLESTATUS (CALLBACK *DoVerb) (LPOLEOBJECT,UINT,WINBOOL,WINBOOL);
    106     OLESTATUS (CALLBACK *GetData) (LPOLEOBJECT,OLECLIPFORMAT,HANDLE *);
    107     OLESTATUS (CALLBACK *SetData) (LPOLEOBJECT,OLECLIPFORMAT,HANDLE);
    108     OLESTATUS (CALLBACK *SetTargetDevice) (LPOLEOBJECT,HGLOBAL);
    109     OLESTATUS (CALLBACK *SetBounds) (LPOLEOBJECT,const RECT *);
    110     OLECLIPFORMAT (CALLBACK *EnumFormats) (LPOLEOBJECT,OLECLIPFORMAT);
    111     OLESTATUS (CALLBACK *SetColorScheme) (LPOLEOBJECT,const LOGPALETTE *);
    112 #ifndef SERVERONLY
    113     OLESTATUS (CALLBACK *Delete) (LPOLEOBJECT);
    114     OLESTATUS (CALLBACK *SetHostNames) (LPOLEOBJECT,LPCSTR,LPCSTR);
    115     OLESTATUS (CALLBACK *SaveToStream) (LPOLEOBJECT,LPOLESTREAM);
    116     OLESTATUS (CALLBACK *Clone) (LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *);
    117     OLESTATUS (CALLBACK *CopyFromLink) (LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *);
    118     OLESTATUS (CALLBACK *Equal)(LPOLEOBJECT,LPOLEOBJECT);
    119     OLESTATUS (CALLBACK *CopyToClipboard)(LPOLEOBJECT);
    120     OLESTATUS (CALLBACK *Draw)(LPOLEOBJECT,HDC,const RECT *,const RECT *,HDC);
    121     OLESTATUS (CALLBACK *Activate)(LPOLEOBJECT,UINT,WINBOOL,WINBOOL,HWND,const RECT *);
    122     OLESTATUS (CALLBACK *Execute)(LPOLEOBJECT,HGLOBAL,UINT);
    123     OLESTATUS (CALLBACK *Close)(LPOLEOBJECT);
    124     OLESTATUS (CALLBACK *Update)(LPOLEOBJECT);
    125     OLESTATUS (CALLBACK *Reconnect) (LPOLEOBJECT);
    126     OLESTATUS (CALLBACK *ObjectConvert) (LPOLEOBJECT,LPCSTR,LPOLECLIENT,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *);
    127     OLESTATUS (CALLBACK *GetLinkUpdateOptions) (LPOLEOBJECT,OLEOPT_UPDATE *);
    128     OLESTATUS (CALLBACK *SetLinkUpdateOptions) (LPOLEOBJECT,OLEOPT_UPDATE);
    129     OLESTATUS (CALLBACK *Rename) (LPOLEOBJECT,LPCSTR);
    130     OLESTATUS (CALLBACK *QueryName) (LPOLEOBJECT,LPSTR,UINT *);
    131     OLESTATUS (CALLBACK *QueryType) (LPOLEOBJECT,LONG *);
    132     OLESTATUS (CALLBACK *QueryBounds) (LPOLEOBJECT,RECT *);
    133     OLESTATUS (CALLBACK *QuerySize) (LPOLEOBJECT,DWORD *);
    134     OLESTATUS (CALLBACK *QueryOpen) (LPOLEOBJECT);
    135     OLESTATUS (CALLBACK *QueryOutOfDate) (LPOLEOBJECT);
    136     OLESTATUS (CALLBACK *QueryReleaseStatus) (LPOLEOBJECT);
    137     OLESTATUS (CALLBACK *QueryReleaseError) (LPOLEOBJECT);
    138     OLE_RELEASE_METHOD (CALLBACK *QueryReleaseMethod)(LPOLEOBJECT);
    139     OLESTATUS (CALLBACK *RequestData) (LPOLEOBJECT,OLECLIPFORMAT);
    140     OLESTATUS (CALLBACK *ObjectLong) (LPOLEOBJECT,UINT,LONG *);
    141     OLESTATUS (CALLBACK *ChangeData) (LPOLEOBJECT,HANDLE,LPOLECLIENT,WINBOOL);
    142 #endif
    143   } OLEOBJECTVTBL;
    144 
    145   typedef OLEOBJECTVTBL *LPOLEOBJECTVTBL;
    146 
    147 #ifndef OLE_INTERNAL
    148   typedef struct _OLEOBJECT {
    149     LPOLEOBJECTVTBL lpvtbl;
    150   } OLEOBJECT;
    151 #endif
    152 
    153   typedef struct _OLECLIENTVTBL {
    154     int (CALLBACK *CallBack)(LPOLECLIENT,OLE_NOTIFICATION,LPOLEOBJECT);
    155   } OLECLIENTVTBL;
    156 
    157   typedef OLECLIENTVTBL *LPOLECLIENTVTBL;
    158 
    159   typedef struct _OLECLIENT {
    160     LPOLECLIENTVTBL lpvtbl;
    161   } OLECLIENT;
    162 
    163 #ifndef _DEFINED_OLESTREAMVRBL
    164 #define _DEFINED_OLESTREAMVRBL
    165   typedef struct _OLESTREAMVTBL {
    166     DWORD (CALLBACK *Get)(LPOLESTREAM,void *,DWORD);
    167     DWORD (CALLBACK *Put)(LPOLESTREAM,const void *,DWORD);
    168   } OLESTREAMVTBL;
    169   typedef OLESTREAMVTBL *LPOLESTREAMVTBL;
    170 #endif
    171 
    172 #ifndef _DEFINED_OLESTREAM
    173 #define _DEFINED_OLESTREAM
    174   typedef struct _OLESTREAM {
    175     LPOLESTREAMVTBL lpstbl;
    176   } OLESTREAM;
    177 #endif
    178 
    179   OLESTATUS WINAPI OleDelete(LPOLEOBJECT);
    180   OLESTATUS WINAPI OleRelease(LPOLEOBJECT);
    181   OLESTATUS WINAPI OleSaveToStream(LPOLEOBJECT,LPOLESTREAM);
    182   OLESTATUS WINAPI OleEqual(LPOLEOBJECT,LPOLEOBJECT);
    183   OLESTATUS WINAPI OleCopyToClipboard(LPOLEOBJECT);
    184   OLESTATUS WINAPI OleSetHostNames(LPOLEOBJECT,LPCSTR,LPCSTR);
    185   OLESTATUS WINAPI OleSetTargetDevice(LPOLEOBJECT,HGLOBAL);
    186   OLESTATUS WINAPI OleSetBounds(LPOLEOBJECT,const RECT *);
    187   OLESTATUS WINAPI OleSetColorScheme(LPOLEOBJECT,const LOGPALETTE *);
    188   OLESTATUS WINAPI OleQueryBounds(LPOLEOBJECT,RECT *);
    189   OLESTATUS WINAPI OleQuerySize(LPOLEOBJECT,DWORD *);
    190   OLESTATUS WINAPI OleDraw(LPOLEOBJECT,HDC,const RECT *,const RECT *,HDC);
    191   OLESTATUS WINAPI OleQueryOpen(LPOLEOBJECT);
    192   OLESTATUS WINAPI OleActivate(LPOLEOBJECT,UINT,WINBOOL,WINBOOL,HWND,const RECT *);
    193   OLESTATUS WINAPI OleExecute(LPOLEOBJECT,HGLOBAL,UINT);
    194   OLESTATUS WINAPI OleClose(LPOLEOBJECT);
    195   OLESTATUS WINAPI OleUpdate(LPOLEOBJECT);
    196   OLESTATUS WINAPI OleReconnect(LPOLEOBJECT);
    197   OLESTATUS WINAPI OleGetLinkUpdateOptions(LPOLEOBJECT,OLEOPT_UPDATE *);
    198   OLESTATUS WINAPI OleSetLinkUpdateOptions(LPOLEOBJECT,OLEOPT_UPDATE);
    199   void *WINAPI OleQueryProtocol(LPOLEOBJECT,LPCSTR);
    200   OLESTATUS WINAPI OleQueryReleaseStatus(LPOLEOBJECT);
    201   OLESTATUS WINAPI OleQueryReleaseError(LPOLEOBJECT);
    202   OLE_RELEASE_METHOD WINAPI OleQueryReleaseMethod(LPOLEOBJECT);
    203   OLESTATUS WINAPI OleQueryType(LPOLEOBJECT,LONG *);
    204   DWORD WINAPI OleQueryClientVersion(void);
    205   DWORD WINAPI OleQueryServerVersion(void);
    206   OLECLIPFORMAT WINAPI OleEnumFormats(LPOLEOBJECT,OLECLIPFORMAT);
    207   OLESTATUS WINAPI OleGetData(LPOLEOBJECT,OLECLIPFORMAT,HANDLE *);
    208   OLESTATUS WINAPI OleSetData(LPOLEOBJECT,OLECLIPFORMAT,HANDLE);
    209   OLESTATUS WINAPI OleQueryOutOfDate(LPOLEOBJECT);
    210   OLESTATUS WINAPI OleRequestData(LPOLEOBJECT,OLECLIPFORMAT);
    211   OLESTATUS WINAPI OleQueryLinkFromClip(LPCSTR,OLEOPT_RENDER,OLECLIPFORMAT);
    212   OLESTATUS WINAPI OleQueryCreateFromClip(LPCSTR,OLEOPT_RENDER,OLECLIPFORMAT);
    213   OLESTATUS WINAPI OleCreateFromClip(LPCSTR,LPOLECLIENT,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *,OLEOPT_RENDER,OLECLIPFORMAT);
    214   OLESTATUS WINAPI OleCreateLinkFromClip(LPCSTR,LPOLECLIENT,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *,OLEOPT_RENDER,OLECLIPFORMAT);
    215   OLESTATUS WINAPI OleCreateFromFile(LPCSTR,LPOLECLIENT,LPCSTR,LPCSTR,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *,OLEOPT_RENDER,OLECLIPFORMAT);
    216   OLESTATUS WINAPI OleCreateLinkFromFile(LPCSTR,LPOLECLIENT,LPCSTR,LPCSTR,LPCSTR,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *,OLEOPT_RENDER,OLECLIPFORMAT);
    217   OLESTATUS WINAPI OleLoadFromStream(LPOLESTREAM,LPCSTR,LPOLECLIENT,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *);
    218   OLESTATUS WINAPI OleCreate(LPCSTR,LPOLECLIENT,LPCSTR,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *,OLEOPT_RENDER,OLECLIPFORMAT);
    219   OLESTATUS WINAPI OleCreateInvisible(LPCSTR,LPOLECLIENT,LPCSTR,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *,OLEOPT_RENDER,OLECLIPFORMAT,WINBOOL);
    220   OLESTATUS WINAPI OleCreateFromTemplate(LPCSTR,LPOLECLIENT,LPCSTR,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *,OLEOPT_RENDER,OLECLIPFORMAT);
    221   OLESTATUS WINAPI OleClone(LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *);
    222   OLESTATUS WINAPI OleCopyFromLink(LPOLEOBJECT,LPCSTR,LPOLECLIENT,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *);
    223   OLESTATUS WINAPI OleObjectConvert(LPOLEOBJECT,LPCSTR,LPOLECLIENT,LHCLIENTDOC,LPCSTR,LPOLEOBJECT *);
    224   OLESTATUS WINAPI OleRename(LPOLEOBJECT,LPCSTR);
    225   OLESTATUS WINAPI OleQueryName(LPOLEOBJECT,LPSTR,UINT *);
    226   OLESTATUS WINAPI OleRevokeObject(LPOLECLIENT);
    227   WINBOOL WINAPI OleIsDcMeta(HDC);
    228   OLESTATUS WINAPI OleRegisterClientDoc(LPCSTR,LPCSTR,LONG,LHCLIENTDOC *);
    229   OLESTATUS WINAPI OleRevokeClientDoc(LHCLIENTDOC);
    230   OLESTATUS WINAPI OleRenameClientDoc(LHCLIENTDOC,LPCSTR);
    231   OLESTATUS WINAPI OleRevertClientDoc(LHCLIENTDOC);
    232   OLESTATUS WINAPI OleSavedClientDoc(LHCLIENTDOC);
    233   OLESTATUS WINAPI OleEnumObjects(LHCLIENTDOC,LPOLEOBJECT *);
    234 
    235   typedef enum {
    236     OLE_SERVER_MULTI,OLE_SERVER_SINGLE
    237   } OLE_SERVER_USE;
    238 
    239   typedef struct _OLESERVER *LPOLESERVER;
    240 
    241   OLESTATUS WINAPI OleRegisterServer(LPCSTR,LPOLESERVER,LHSERVER *,HINSTANCE,OLE_SERVER_USE);
    242   OLESTATUS WINAPI OleRevokeServer(LHSERVER);
    243   OLESTATUS WINAPI OleBlockServer(LHSERVER);
    244   OLESTATUS WINAPI OleUnblockServer(LHSERVER,WINBOOL *);
    245   OLESTATUS WINAPI OleLockServer(LPOLEOBJECT,LHSERVER *);
    246   OLESTATUS WINAPI OleUnlockServer(LHSERVER);
    247 
    248   typedef struct _OLESERVERDOC *LPOLESERVERDOC;
    249 
    250   OLESTATUS WINAPI OleRegisterServerDoc(LHSERVER,LPCSTR,LPOLESERVERDOC,LHSERVERDOC *);
    251   OLESTATUS WINAPI OleRevokeServerDoc(LHSERVERDOC);
    252   OLESTATUS WINAPI OleRenameServerDoc(LHSERVERDOC,LPCSTR);
    253   OLESTATUS WINAPI OleRevertServerDoc(LHSERVERDOC);
    254   OLESTATUS WINAPI OleSavedServerDoc(LHSERVERDOC);
    255 
    256   typedef struct _OLESERVERVTBL {
    257     OLESTATUS (CALLBACK *Open)(LPOLESERVER,LHSERVERDOC,LPCSTR,LPOLESERVERDOC *);
    258     OLESTATUS (CALLBACK *Create)(LPOLESERVER,LHSERVERDOC,LPCSTR,LPCSTR,LPOLESERVERDOC *);
    259     OLESTATUS (CALLBACK *CreateFromTemplate)(LPOLESERVER,LHSERVERDOC,LPCSTR,LPCSTR,LPCSTR,LPOLESERVERDOC *);
    260     OLESTATUS (CALLBACK *Edit)(LPOLESERVER,LHSERVERDOC,LPCSTR,LPCSTR,LPOLESERVERDOC *);
    261     OLESTATUS (CALLBACK *Exit)(LPOLESERVER);
    262     OLESTATUS (CALLBACK *Release)(LPOLESERVER);
    263     OLESTATUS (CALLBACK *Execute)(LPOLESERVER,HGLOBAL);
    264   } OLESERVERVTBL;
    265 
    266   typedef OLESERVERVTBL *LPOLESERVERVTBL;
    267 
    268   typedef struct _OLESERVER {
    269     LPOLESERVERVTBL lpvtbl;
    270   } OLESERVER;
    271 
    272   typedef struct _OLESERVERDOCVTBL {
    273     OLESTATUS (CALLBACK *Save)(LPOLESERVERDOC);
    274     OLESTATUS (CALLBACK *Close)(LPOLESERVERDOC);
    275     OLESTATUS (CALLBACK *SetHostNames)(LPOLESERVERDOC,LPCSTR,LPCSTR);
    276     OLESTATUS (CALLBACK *SetDocDimensions)(LPOLESERVERDOC,const RECT *);
    277     OLESTATUS (CALLBACK *GetObject)(LPOLESERVERDOC,LPCSTR,LPOLEOBJECT *,LPOLECLIENT);
    278     OLESTATUS (CALLBACK *Release)(LPOLESERVERDOC);
    279     OLESTATUS (CALLBACK *SetColorScheme)(LPOLESERVERDOC,const LOGPALETTE *);
    280     OLESTATUS (CALLBACK *Execute)(LPOLESERVERDOC,HGLOBAL);
    281   } OLESERVERDOCVTBL;
    282 
    283   typedef OLESERVERDOCVTBL *LPOLESERVERDOCVTBL;
    284 
    285   typedef struct _OLESERVERDOC {
    286     LPOLESERVERDOCVTBL lpvtbl;
    287   } OLESERVERDOC;
    288 
    289 #ifdef __cplusplus
    290 }
    291 #endif
    292 
    293 #endif /* _OLE_H_ */
    294