queryInterface method

int queryInterface(
  1. Pointer<GUID> riid,
  2. Pointer<Pointer<NativeType>> ppvObject
)
inherited

Queries a COM object for a pointer to one of its interface; identifying the interface by a reference to its interface identifier (IID).

If the COM object implements the interface, then it returns a pointer to that interface after calling addRef on it.

Implementation

int queryInterface(Pointer<GUID> riid, Pointer<Pointer> ppvObject) =>
    (ptr.ref.vtable + 0)
            .cast<
                Pointer<
                    NativeFunction<
                        Int32 Function(Pointer, Pointer<GUID> riid,
                            Pointer<Pointer> ppvObject)>>>()
            .value
            .asFunction<
                int Function(Pointer, Pointer<GUID> riid,
                    Pointer<Pointer> ppvObject)>()(
        ptr.ref.lpVtbl, riid, ppvObject);