COM.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include "il2cpp-class-internals.h"
  3. #include "os/COM.h"
  4. #include "vm/Exception.h"
  5. struct Il2CppGuid;
  6. struct Il2CppSafeArrayBound;
  7. struct Il2CppSafeArray;
  8. struct Il2CppIUnknown;
  9. namespace il2cpp
  10. {
  11. namespace vm
  12. {
  13. class LIBIL2CPP_CODEGEN_API COM
  14. {
  15. public:
  16. static inline void CreateInstance(const Il2CppGuid& clsid, Il2CppIUnknown** object)
  17. {
  18. const il2cpp_hresult_t hr = os::COM::CreateInstance(clsid, object);
  19. vm::Exception::RaiseIfFailed(hr, true);
  20. }
  21. static inline il2cpp_hresult_t CreateFreeThreadedMarshaler(Il2CppIUnknown* outer, Il2CppIUnknown** marshal)
  22. {
  23. return os::COM::CreateFreeThreadedMarshaler(outer, marshal);
  24. }
  25. static void MarshalVariant(Il2CppObject* obj, Il2CppVariant* variant);
  26. static Il2CppObject* MarshalVariantResult(const Il2CppVariant* variant);
  27. static void DestroyVariant(Il2CppVariant* variant);
  28. static Il2CppSafeArray* MarshalSafeArray(uint16_t variantType, Il2CppArray* managedArray);
  29. static Il2CppArray* MarshalSafeArrayResult(uint16_t variantType, Il2CppClass* type, Il2CppSafeArray* safeArray);
  30. static Il2CppSafeArray* MarshalSafeArrayBString(Il2CppArray* managedArray);
  31. static Il2CppArray* MarshalSafeArrayBStringResult(Il2CppClass* type, Il2CppSafeArray* safeArray);
  32. static inline void DestroySafeArray(Il2CppSafeArray* safeArray)
  33. {
  34. const il2cpp_hresult_t hr = os::COM::SafeArrayDestroy(safeArray);
  35. vm::Exception::RaiseIfFailed(hr, true);
  36. }
  37. };
  38. } /* namespace vm */
  39. } /* namespace il2cpp */