Home | History | Annotate | Download | only in include
      1 /**
      2  * This file is part of the mingw-w64 runtime package.
      3  * No warranty is given; refer to the file DISCLAIMER within this package.
      4  */
      5 
      6 #include <apiset.h>
      7 #include <apisetcconv.h>
      8 
      9 #include <rpc.h>
     10 #include <rpcndr.h>
     11 
     12 #ifndef DECLSPEC_NOTHROW
     13 #define DECLSPEC_NOTHROW
     14 #endif
     15 
     16 #if (NTDDI_VERSION >= 0x06000000 && !defined (_WIN32_WINNT))
     17 #define _WIN32_WINNT 0x0600
     18 #endif
     19 
     20 #if (NTDDI_VERSION >= 0x05020000 && !defined (_WIN32_WINNT))
     21 #define _WIN32_WINNT 0x0502
     22 #endif
     23 
     24 #if (NTDDI_VERSION >= 0x05010000 && !defined (_WIN32_WINNT))
     25 #define _WIN32_WINNT 0x0501
     26 #endif
     27 
     28 #ifndef _COMBASEAPI_H_
     29 #define _COMBASEAPI_H_
     30 
     31 #include <pshpack8.h>
     32 
     33 #ifdef _OLE32_
     34 #define WINOLEAPI STDAPI
     35 #define WINOLEAPI_(type) STDAPI_(type)
     36 #else
     37 #define WINOLEAPI EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
     38 #define WINOLEAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
     39 #endif
     40 
     41 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
     42 #if defined (__cplusplus) && !defined (CINTERFACE)
     43 
     44 #ifdef COM_STDMETHOD_CAN_THROW
     45 #define COM_DECLSPEC_NOTHROW
     46 #else
     47 #define COM_DECLSPEC_NOTHROW DECLSPEC_NOTHROW
     48 #endif
     49 
     50 #define __STRUCT__ struct
     51 #undef interface
     52 #define interface __STRUCT__
     53 #define STDMETHOD(method) virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE method
     54 #define STDMETHOD_(type, method) virtual COM_DECLSPEC_NOTHROW type STDMETHODCALLTYPE method
     55 #define STDMETHODV(method) virtual COM_DECLSPEC_NOTHROW HRESULT STDMETHODVCALLTYPE method
     56 #define STDMETHODV_(type, method) virtual COM_DECLSPEC_NOTHROW type STDMETHODVCALLTYPE method
     57 #define PURE = 0
     58 #define THIS_
     59 #define THIS void
     60 #define DECLARE_INTERFACE(iface) interface DECLSPEC_NOVTABLE iface
     61 #define DECLARE_INTERFACE_(iface, baseiface) interface DECLSPEC_NOVTABLE iface : public baseiface
     62 #define DECLARE_INTERFACE_IID(iface, iid) interface DECLSPEC_UUID (iid) DECLSPEC_NOVTABLE iface
     63 #define DECLARE_INTERFACE_IID_(iface, baseiface, iid) interface DECLSPEC_UUID (iid) DECLSPEC_NOVTABLE iface : public baseiface
     64 
     65 #define IFACEMETHOD(method) STDMETHOD (method)
     66 #define IFACEMETHOD_(type, method) STDMETHOD_(type, method)
     67 #define IFACEMETHODV(method) STDMETHODV (method)
     68 #define IFACEMETHODV_(type, method) STDMETHODV_(type, method)
     69 
     70 #ifndef BEGIN_INTERFACE
     71 #define BEGIN_INTERFACE
     72 #define END_INTERFACE
     73 #endif
     74 
     75 interface IUnknown;
     76 
     77 extern "C++" {
     78   template<typename T> void **IID_PPV_ARGS_Helper (T **pp) {
     79     static_cast<IUnknown *> (*pp);
     80     return reinterpret_cast<void **> (pp);
     81   }
     82 }
     83 
     84 #define IID_PPV_ARGS(ppType) __uuidof (**(ppType)), IID_PPV_ARGS_Helper (ppType)
     85 #else
     86 #undef interface
     87 #define interface struct
     88 
     89 #define STDMETHOD(method) HRESULT (STDMETHODCALLTYPE *method)
     90 #define STDMETHOD_(type, method) type (STDMETHODCALLTYPE *method)
     91 #define STDMETHODV(method) HRESULT (STDMETHODVCALLTYPE *method)
     92 #define STDMETHODV_(type, method) type (STDMETHODVCALLTYPE *method)
     93 
     94 #define IFACEMETHOD(method) STDMETHOD (method)
     95 #define IFACEMETHOD_(type, method) STDMETHOD_ (type, method)
     96 #define IFACEMETHODV(method) STDMETHODV (method)
     97 #define IFACEMETHODV_(type, method) STDMETHODV_ (type, method)
     98 
     99 #ifndef BEGIN_INTERFACE
    100 #define BEGIN_INTERFACE
    101 #define END_INTERFACE
    102 #endif
    103 
    104 #define PURE
    105 #define THIS_ INTERFACE *This,
    106 #define THIS INTERFACE *This
    107 #ifdef CONST_VTABLE
    108 #undef CONST_VTBL
    109 #define CONST_VTBL const
    110 #define DECLARE_INTERFACE(iface) typedef interface iface { const struct iface##Vtbl *lpVtbl; } iface; typedef const struct iface##Vtbl iface##Vtbl; const struct iface##Vtbl
    111 #else
    112 #undef CONST_VTBL
    113 #define CONST_VTBL
    114 #define DECLARE_INTERFACE(iface) typedef interface iface { struct iface##Vtbl *lpVtbl; } iface; typedef struct iface##Vtbl iface##Vtbl; struct iface##Vtbl
    115 #endif
    116 #define DECLARE_INTERFACE_(iface, baseiface) DECLARE_INTERFACE (iface)
    117 #define DECLARE_INTERFACE_IID(iface, iid) DECLARE_INTERFACE (iface)
    118 #define DECLARE_INTERFACE_IID_(iface, baseiface, iid) DECLARE_INTERFACE_ (iface, baseiface)
    119 #endif
    120 
    121 #ifndef FARSTRUCT
    122 #define FARSTRUCT
    123 #endif
    124 
    125 #ifndef HUGEP
    126 #define HUGEP
    127 #endif
    128 
    129 #include <stdlib.h>
    130 
    131 #define LISet32(li, v) ((li).HighPart = ((LONG) (v)) < 0 ? -1 : 0,(li).LowPart = (v))
    132 #define ULISet32(li, v) ((li).HighPart = 0,(li).LowPart = (v))
    133 
    134 #define CLSCTX_INPROC (CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER)
    135 #define CLSCTX_ALL (CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER)
    136 #define CLSCTX_SERVER (CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER)
    137 
    138 typedef enum tagREGCLS {
    139   REGCLS_SINGLEUSE = 0,
    140   REGCLS_MULTIPLEUSE = 1,
    141   REGCLS_MULTI_SEPARATE = 2,
    142   REGCLS_SUSPENDED = 4,
    143   REGCLS_SURROGATE = 8
    144 } REGCLS;
    145 
    146 typedef interface IRpcStubBuffer IRpcStubBuffer;
    147 typedef interface IRpcChannelBuffer IRpcChannelBuffer;
    148 
    149 typedef enum tagCOINITBASE {
    150   COINITBASE_MULTITHREADED = 0x0,
    151 } COINITBASE;
    152 
    153 #include <wtypesbase.h>
    154 #include <unknwnbase.h>
    155 #include <objidlbase.h>
    156 #include <guiddef.h>
    157 
    158 #ifndef INITGUID
    159 #include <cguid.h>
    160 #endif
    161 #endif
    162 
    163 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    164 #if NTDDI_VERSION >= 0x06020000
    165 typedef struct tagServerInformation {
    166   DWORD dwServerPid;
    167   DWORD dwServerTid;
    168   UINT64 ui64ServerAddress;
    169 } ServerInformation,*PServerInformation;
    170 
    171 DECLARE_HANDLE (CO_MTA_USAGE_COOKIE);
    172 #endif
    173 WINOLEAPI CreateStreamOnHGlobal (HGLOBAL hGlobal, WINBOOL fDeleteOnRelease, LPSTREAM *ppstm);
    174 WINOLEAPI GetHGlobalFromStream (LPSTREAM pstm, HGLOBAL *phglobal);
    175 WINOLEAPI_(void) CoUninitialize (void);
    176 WINOLEAPI CoInitializeEx (LPVOID pvReserved, DWORD dwCoInit);
    177 WINOLEAPI CoGetCurrentLogicalThreadId (GUID *pguid);
    178 WINOLEAPI CoGetContextToken (ULONG_PTR *pToken);
    179 #if NTDDI_VERSION >= 0x06010000
    180 WINOLEAPI CoGetApartmentType (APTTYPE *pAptType, APTTYPEQUALIFIER *pAptQualifier);
    181 #endif
    182 WINOLEAPI CoGetObjectContext (REFIID riid, LPVOID *ppv);
    183 WINOLEAPI CoRegisterClassObject (REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister);
    184 WINOLEAPI CoRevokeClassObject (DWORD dwRegister);
    185 WINOLEAPI CoResumeClassObjects (void);
    186 WINOLEAPI CoSuspendClassObjects (void);
    187 #endif
    188 
    189 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
    190 WINOLEAPI CoGetMalloc (DWORD dwMemContext, LPMALLOC *ppMalloc);
    191 WINOLEAPI_(DWORD) CoGetCurrentProcess (void);
    192 WINOLEAPI CoGetCallerTID (LPDWORD lpdwTID);
    193 WINOLEAPI CoGetDefaultContext (APTTYPE aptType, REFIID riid, void **ppv);
    194 #if NTDDI_VERSION >= 0x06020000
    195 WINOLEAPI CoDecodeProxy (DWORD dwClientPid, UINT64 ui64ProxyAddress, PServerInformation pServerInformation);
    196 WINOLEAPI CoIncrementMTAUsage (CO_MTA_USAGE_COOKIE *pCookie);
    197 WINOLEAPI CoDecrementMTAUsage (CO_MTA_USAGE_COOKIE Cookie);
    198 WINOLEAPI CoWaitForMultipleObjects (DWORD dwFlags, DWORD dwTimeout, ULONG cHandles, const HANDLE *pHandles, LPDWORD lpdwindex);
    199 WINOLEAPI CoAllowUnmarshalerCLSID (REFCLSID clsid);
    200 #endif
    201 WINOLEAPI CoGetClassObject (REFCLSID rclsid, DWORD dwClsContext, LPVOID pvReserved, REFIID riid, LPVOID *ppv);
    202 WINOLEAPI_(ULONG) CoAddRefServerProcess (void);
    203 WINOLEAPI_(ULONG) CoReleaseServerProcess (void);
    204 WINOLEAPI CoGetPSClsid (REFIID riid, CLSID *pClsid);
    205 WINOLEAPI CoRegisterPSClsid (REFIID riid, REFCLSID rclsid);
    206 WINOLEAPI CoRegisterSurrogate (LPSURROGATE pSurrogate);
    207 WINOLEAPI CoMarshalHresult (LPSTREAM pstm, HRESULT hresult);
    208 WINOLEAPI CoUnmarshalHresult (LPSTREAM pstm, HRESULT *phresult);
    209 WINOLEAPI CoLockObjectExternal (LPUNKNOWN pUnk, WINBOOL fLock, WINBOOL fLastUnlockReleases);
    210 WINOLEAPI CoGetStdMarshalEx (LPUNKNOWN pUnkOuter, DWORD smexflags, LPUNKNOWN *ppUnkInner);
    211 #endif
    212 
    213 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    214 typedef enum tagSTDMSHLFLAGS {
    215   SMEXF_SERVER = 0x01,
    216   SMEXF_HANDLER = 0x02
    217 } STDMSHLFLAGS;
    218 
    219 WINOLEAPI CoGetMarshalSizeMax (ULONG *pulSize, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
    220 WINOLEAPI CoMarshalInterface (LPSTREAM pStm, REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
    221 WINOLEAPI CoUnmarshalInterface (LPSTREAM pStm, REFIID riid, LPVOID *ppv);
    222 WINOLEAPI CoReleaseMarshalData (LPSTREAM pStm);
    223 WINOLEAPI CoDisconnectObject (LPUNKNOWN pUnk, DWORD dwReserved);
    224 WINOLEAPI CoGetStandardMarshal (REFIID riid, LPUNKNOWN pUnk, DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags, LPMARSHAL *ppMarshal);
    225 WINOLEAPI CoMarshalInterThreadInterfaceInStream (REFIID riid, LPUNKNOWN pUnk, LPSTREAM *ppStm);
    226 WINOLEAPI CoGetInterfaceAndReleaseStream (LPSTREAM pStm, REFIID iid, LPVOID *ppv);
    227 WINOLEAPI CoCreateFreeThreadedMarshaler (LPUNKNOWN punkOuter, LPUNKNOWN *ppunkMarshal);
    228 WINOLEAPI_(void) CoFreeUnusedLibraries (void);
    229 WINOLEAPI_(void) CoFreeUnusedLibrariesEx (DWORD dwUnloadDelay, DWORD dwReserved);
    230 WINOLEAPI CoInitializeSecurity (PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, SOLE_AUTHENTICATION_SERVICE *asAuthSvc, void *pReserved1, DWORD dwAuthnLevel, DWORD dwImpLevel, void *pAuthList, DWORD dwCapabilities, void *pReserved3);
    231 WINOLEAPI CoSwitchCallContext (IUnknown *pNewObject, IUnknown **ppOldObject);
    232 
    233 #define COM_RIGHTS_EXECUTE 1
    234 #define COM_RIGHTS_EXECUTE_LOCAL 2
    235 #define COM_RIGHTS_EXECUTE_REMOTE 4
    236 #define COM_RIGHTS_ACTIVATE_LOCAL 8
    237 #define COM_RIGHTS_ACTIVATE_REMOTE 16
    238 
    239 WINOLEAPI CoCreateInstanceFromApp (REFCLSID Clsid, IUnknown *punkOuter, DWORD dwClsCtx, PVOID reserved, DWORD dwCount, MULTI_QI *pResults);
    240 
    241 #endif
    242 
    243 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
    244 WINOLEAPI_(WINBOOL) CoIsHandlerConnected (LPUNKNOWN pUnk);
    245 #if _WIN32_WINNT >= 0x0600
    246 WINOLEAPI CoDisconnectContext (DWORD dwTimeout);
    247 #endif
    248 WINOLEAPI CoGetCallContext (REFIID riid, void **ppInterface);
    249 WINOLEAPI CoQueryProxyBlanket (IUnknown *pProxy, DWORD *pwAuthnSvc, DWORD *pAuthzSvc, LPOLESTR *pServerPrincName, DWORD *pAuthnLevel, DWORD *pImpLevel, RPC_AUTH_IDENTITY_HANDLE *pAuthInfo, DWORD *pCapabilites);
    250 WINOLEAPI CoSetProxyBlanket (IUnknown *pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc, OLECHAR *pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel, RPC_AUTH_IDENTITY_HANDLE pAuthInfo, DWORD dwCapabilities);
    251 WINOLEAPI CoCopyProxy (IUnknown *pProxy, IUnknown **ppCopy);
    252 WINOLEAPI CoQueryClientBlanket (DWORD *pAuthnSvc, DWORD *pAuthzSvc, LPOLESTR *pServerPrincName, DWORD *pAuthnLevel, DWORD *pImpLevel, RPC_AUTHZ_HANDLE *pPrivs, DWORD *pCapabilities);
    253 WINOLEAPI CoImpersonateClient (void);
    254 WINOLEAPI CoRevertToSelf (void);
    255 WINOLEAPI CoQueryAuthenticationServices (DWORD *pcAuthSvc, SOLE_AUTHENTICATION_SERVICE **asAuthSvc);
    256 WINOLEAPI CoCreateInstance (REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID *ppv);
    257 WINOLEAPI CoCreateInstanceEx (REFCLSID Clsid, IUnknown *punkOuter, DWORD dwClsCtx, COSERVERINFO *pServerInfo, DWORD dwCount, MULTI_QI *pResults);
    258 #endif
    259 
    260 #if WINAPI_FAMILY == WINAPI_FAMILY_APP
    261   __forceinline HRESULT CoCreateInstance (REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID *ppv) {
    262     MULTI_QI OneQI;
    263     HRESULT hr;
    264 
    265     OneQI.pItf = NULL;
    266 #ifdef __cplusplus
    267     OneQI.pIID = &riid;
    268 #else
    269     OneQI.pIID = riid;
    270 #endif
    271     hr = CoCreateInstanceFromApp (rclsid, pUnkOuter, dwClsContext, NULL, 1,&OneQI);
    272     *ppv = OneQI.pItf;
    273     return FAILED (hr) ? hr : OneQI.hr;
    274   }
    275 
    276   __forceinline HRESULT CoCreateInstanceEx (REFCLSID Clsid, IUnknown *punkOuter, DWORD dwClsCtx, COSERVERINFO *pServerInfo, DWORD dwCount, MULTI_QI *pResults) {
    277     return CoCreateInstanceFromApp (Clsid, punkOuter, dwClsCtx, pServerInfo, dwCount, pResults);
    278   }
    279 #endif
    280 
    281 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
    282 WINOLEAPI CoGetCancelObject (DWORD dwThreadId, REFIID iid, void **ppUnk);
    283 WINOLEAPI CoSetCancelObject (IUnknown *pUnk);
    284 WINOLEAPI CoCancelCall (DWORD dwThreadId, ULONG ulTimeout);
    285 WINOLEAPI CoTestCancel (void);
    286 WINOLEAPI CoEnableCallCancellation (LPVOID pReserved);
    287 WINOLEAPI CoDisableCallCancellation (LPVOID pReserved);
    288 #endif
    289 
    290 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    291 WINOLEAPI StringFromCLSID (REFCLSID rclsid, LPOLESTR *lplpsz);
    292 WINOLEAPI CLSIDFromString (LPCOLESTR lpsz, LPCLSID pclsid);
    293 WINOLEAPI StringFromIID (REFIID rclsid, LPOLESTR *lplpsz);
    294 WINOLEAPI IIDFromString (LPCOLESTR lpsz, LPIID lpiid);
    295 #endif
    296 
    297 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
    298 WINOLEAPI ProgIDFromCLSID (REFCLSID clsid, LPOLESTR *lplpszProgID);
    299 WINOLEAPI CLSIDFromProgID (LPCOLESTR lpszProgID, LPCLSID lpclsid);
    300 #endif
    301 
    302 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    303 WINOLEAPI_(int) StringFromGUID2 (REFGUID rguid, LPOLESTR lpsz, int cchMax);
    304 WINOLEAPI CoCreateGuid (GUID *pguid);
    305 
    306 typedef struct tagPROPVARIANT PROPVARIANT;
    307 
    308 WINOLEAPI PropVariantCopy (PROPVARIANT *pvarDest, const PROPVARIANT *pvarSrc);
    309 WINOLEAPI PropVariantClear (PROPVARIANT *pvar);
    310 WINOLEAPI FreePropVariantArray (ULONG cVariants, PROPVARIANT *rgvars);
    311 #endif
    312 
    313 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
    314 WINOLEAPI CoWaitForMultipleHandles (DWORD dwFlags, DWORD dwTimeout, ULONG cHandles, LPHANDLE pHandles, LPDWORD lpdwindex);
    315 #endif
    316 
    317 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    318 typedef enum tagCOWAIT_FLAGS {
    319   COWAIT_DEFAULT = 0,
    320   COWAIT_WAITALL = 1,
    321   COWAIT_ALERTABLE = 2,
    322   COWAIT_INPUTAVAILABLE = 4
    323 #endif
    324 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
    325   , COWAIT_DISPATCH_CALLS = 8,
    326   COWAIT_DISPATCH_WINDOW_MESSAGES = 0x10
    327 #endif
    328 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    329 } COWAIT_FLAGS;
    330 #endif
    331 
    332 #if NTDDI_VERSION >= 0x06020000
    333 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    334 typedef enum CWMO_FLAGS {
    335   CWMO_DEFAULT = 0,
    336   CWMO_DISPATCH_CALLS = 1
    337 #endif
    338 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
    339   , CWMO_DISPATCH_WINDOW_MESSAGES = 2
    340 #endif
    341 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    342 } CWMO_FLAGS;
    343 #endif
    344 #endif
    345 
    346 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    347 #define CWMO_MAX_HANDLES 56
    348 #endif
    349 
    350 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
    351 WINOLEAPI CoGetTreatAsClass (REFCLSID clsidOld, LPCLSID pClsidNew);
    352 WINOLEAPI CoInvalidateRemoteMachineBindings (LPOLESTR pszMachineName);
    353 #endif
    354 
    355 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
    356 typedef HRESULT (STDAPICALLTYPE *LPFNGETCLASSOBJECT) (REFCLSID, REFIID, LPVOID *);
    357 typedef HRESULT (STDAPICALLTYPE *LPFNCANUNLOADNOW) (void);
    358 
    359 STDAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv);
    360 STDAPI DllCanUnloadNow (void);
    361 WINOLEAPI_ (LPVOID) CoTaskMemAlloc (SIZE_T cb);
    362 WINOLEAPI_ (LPVOID) CoTaskMemRealloc (LPVOID pv, SIZE_T cb);
    363 WINOLEAPI_ (void) CoTaskMemFree (LPVOID pv);
    364 
    365 #ifndef RC_INVOKED
    366 #include <poppack.h>
    367 #endif
    368 
    369 #endif
    370 
    371 #endif
    372