getInterfaces function

  1. @Deprecated('No replacement')
List<String> getInterfaces(
  1. IInspectable object
)

Returns the interface IDs that are implemented by the Windows Runtime object.

The IUnknown and IInspectable interfaces are excluded.

Implementation

@Deprecated('No replacement')
List<String> getInterfaces(IInspectable object) {
  final pIIDCount = calloc<Uint32>();
  final pIIDs = calloc<Pointer<GUID>>();

  try {
    final hr = (object.ptr.ref.vtable + 3)
            .cast<
                Pointer<
                    NativeFunction<
                        Int32 Function(
                            VTablePointer lpVtbl,
                            Pointer<Uint32> iidCount,
                            Pointer<Pointer<GUID>> iids)>>>()
            .value
            .asFunction<
                int Function(VTablePointer lpVtbl, Pointer<Uint32> iidCount,
                    Pointer<Pointer<GUID>> iids)>()(
        object.ptr.ref.lpVtbl, pIIDCount, pIIDs);

    if (FAILED(hr)) throw WindowsException(hr);

    return [
      for (var i = 0; i < pIIDCount.value; i++) pIIDs.value[i].toString()
    ];
  } finally {
    free(pIIDCount);
    free(pIIDs);
  }
}