getGuid method

Guid getGuid()

Implementation

Guid getGuid() {
  final value = calloc<GUID>();

  try {
    final hr = ptr.ref.vtable
            .elementAt(20)
            .cast<
                Pointer<
                    NativeFunction<
                        HRESULT Function(
                            VTablePointer lpVtbl, Pointer<GUID> value)>>>()
            .value
            .asFunction<
                int Function(VTablePointer lpVtbl, Pointer<GUID> value)>()(
        ptr.ref.lpVtbl, value);

    if (FAILED(hr)) throwWindowsException(hr);

    return value.toDartGuid();
  } finally {
    free(value);
  }
}