roapi.h 2.7 KB

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