| 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 __ROAPI_H__ |
| 7 | #define __ROAPI_H__ |
| 8 | |
| 9 | #include <winapifamily.h> |
| 10 | #include <windows.h> |
| 11 | #include <sdkddkver.h> |
| 12 | #include <hstring.h> |
| 13 | #include <inspectable.h> |
| 14 | #include <activation.h> |
| 15 | |
| 16 | typedef enum RO_INIT_TYPE { |
| 17 | #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) |
| 18 | RO_INIT_SINGLETHREADED = 0, |
| 19 | #endif |
| 20 | RO_INIT_MULTITHREADED = 1 |
| 21 | } RO_INIT_TYPE; |
| 22 | |
| 23 | typedef struct { } *RO_REGISTRATION_COOKIE; |
| 24 | |
| 25 | typedef HRESULT (WINAPI *PFNGETACTIVATIONFACTORY)(HSTRING, IActivationFactory **); |
| 26 | |
| 27 | #ifdef __cplusplus |
| 28 | extern "C" { |
| 29 | #endif |
| 30 | |
| 31 | HRESULT WINAPI RoActivateInstance(HSTRING activatableClassId, IInspectable **instance); |
| 32 | |
| 33 | HRESULT WINAPI RoGetActivationFactory(HSTRING activatableClassId, REFIID iid, void **factory); |
| 34 | |
| 35 | HRESULT WINAPI RoGetApartmentIdentifier(UINT64 *apartmentIdentifier); |
| 36 | |
| 37 | HRESULT WINAPI RoInitialize(RO_INIT_TYPE initType); |
| 38 | |
| 39 | HRESULT WINAPI RoRegisterActivationFactories(HSTRING *activatableClassIds, PFNGETACTIVATIONFACTORY *activationFactoryCallbacks, UINT32 count, RO_REGISTRATION_COOKIE *cookie); |
| 40 | |
| 41 | void WINAPI RoRevokeActivationFactories(RO_REGISTRATION_COOKIE cookie); |
| 42 | |
| 43 | void WINAPI RoUninitialize(void); |
| 44 | |
| 45 | typedef interface IApartmentShutdown IApartmentShutdown; |
| 46 | DECLARE_HANDLE (APARTMENT_SHUTDOWN_REGISTRATION_COOKIE); |
| 47 | |
| 48 | HRESULT WINAPI RoRegisterForApartmentShutdown (IApartmentShutdown *callbackObj, UINT64 *apartmentId, APARTMENT_SHUTDOWN_REGISTRATION_COOKIE *regCookie); |
| 49 | |
| 50 | HRESULT WINAPI RoUnregisterForApartmentShutdown (APARTMENT_SHUTDOWN_REGISTRATION_COOKIE regCookie); |
| 51 | |
| 52 | HRESULT WINAPI RoGetApartmentIdentifier (UINT64 *apartmentId); |
| 53 | |
| 54 | #ifdef __cplusplus |
| 55 | } /* extern "C" */ |
| 56 | |
| 57 | namespace Windows { |
| 58 | namespace Foundation { |
| 59 | __inline HRESULT Initialize (RO_INIT_TYPE it |
| 60 | #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) |
| 61 | 	 = RO_INIT_SINGLETHREADED |
| 62 | #endif |
| 63 | ) { return RoInitialize (it); } |
| 64 | __inline void Uninitialize () |
| 65 | { RoUninitialize (); } |
| 66 | |
| 67 | template<class T> __inline HRESULT GetActivationFactory(HSTRING classid, T **factory) { |
| 68 | return RoGetActivationFactory(classid, IID_INS_ARGS(factory)); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | namespace ABI { |
| 74 | namespace Windows { |
| 75 | namespace Foundation { |
| 76 | __inline HRESULT Initialze (RO_INIT_TYPE it |
| 77 | #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) |
| 78 | 	= RO_INIT_SINGLETHREADED |
| 79 | #endif |
| 80 | ) { return RoInitialize (it); } |
| 81 | __inline void Uninitialize () |
| 82 | { RoUninitialize (); } |
| 83 | } |
| 84 | |
| 85 | template<class T> __inline HRESULT GetActivationFactory(HSTRING classid, T **factory) { |
| 86 | return RoGetActivationFactory(classid, IID_INS_ARGS(factory)); |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | #endif |
| 92 | |
| 93 | #endif |