COM.h 1.6 KB

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