getHostNames method

List<HostName> getHostNames()

Implementation

List<HostName> getHostNames() {
  final retValuePtr = calloc<COMObject>();

  final hr = ptr.ref.vtable
          .elementAt(9)
          .cast<
              Pointer<
                  NativeFunction<
                      HRESULT Function(Pointer, Pointer<COMObject>)>>>()
          .value
          .asFunction<int Function(Pointer, Pointer<COMObject>)>()(
      ptr.ref.lpVtbl, retValuePtr);

  if (FAILED(hr)) {
    free(retValuePtr);
    throw WindowsException(hr);
  }

  final vectorView = IVectorView<HostName>.fromRawPointer(retValuePtr,
      iterableIid: '{9e5f3ed0-cf1c-5d38-832c-acea6164bf5c}',
      creator: HostName.fromRawPointer);
  final list = vectorView.toList();
  vectorView.release();

  return list;
}