getTrustLevel function

  1. @Deprecated('No replacement')
TrustLevel getTrustLevel(
  1. IInspectable object
)

Gets the trust level of the Windows Runtime object.

Implementation

@Deprecated('No replacement')
TrustLevel getTrustLevel(IInspectable object) {
  final pTrustLevel = calloc<Int32>();

  try {
    final hr = (object.ptr.ref.vtable + 5)
            .cast<
                Pointer<
                    NativeFunction<
                        Int32 Function(VTablePointer lpVtbl,
                            Pointer<Int32> trustLevel)>>>()
            .value
            .asFunction<
                int Function(
                    VTablePointer lpVtbl, Pointer<Int32> trustLevel)>()(
        object.ptr.ref.lpVtbl, pTrustLevel);

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

    return TrustLevel.from(pTrustLevel.value);
  } finally {
    free(pTrustLevel);
  }
}