CoCreateInstance function Null safety ole32

int CoCreateInstance(
  1. Pointer<GUID> rclsid,
  2. Pointer<NativeType> pUnkOuter,
  3. int dwClsContext,
  4. Pointer<GUID> riid,
  5. Pointer<Pointer<NativeType>> ppv
)

Creates a single uninitialized object of the class associated with a specified CLSID. Call CoCreateInstance when you want to create only one object on the local system. To create a single object on a remote system, call the CoCreateInstanceEx function. To create multiple objects based on a single CLSID, call the CoGetClassObject function.

HRESULT CoCreateInstance(
  REFCLSID  rclsid,
  LPUNKNOWN pUnkOuter,
  DWORD     dwClsContext,
  REFIID    riid,
  LPVOID    *ppv
);

Implementation

int CoCreateInstance(Pointer<GUID> rclsid, Pointer pUnkOuter, int dwClsContext,
    Pointer<GUID> riid, Pointer<Pointer> ppv) {
  final _CoCreateInstance = _ole32.lookupFunction<
      Int32 Function(Pointer<GUID> rclsid, Pointer pUnkOuter,
          Uint32 dwClsContext, Pointer<GUID> riid, Pointer<Pointer> ppv),
      int Function(Pointer<GUID> rclsid, Pointer pUnkOuter, int dwClsContext,
          Pointer<GUID> riid, Pointer<Pointer> ppv)>('CoCreateInstance');
  return _CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);
}