getHostNames method

List<IHostName> getHostNames()

Implementation

List<IHostName> 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)) throw WindowsException(hr);

  try {
    return IVectorView<IHostName>.fromRawPointer(retValuePtr,
            iterableIid: '{9e5f3ed0-cf1c-5d38-832c-acea6164bf5c}',
            creator: IHostName.fromRawPointer)
        .toList();
  } finally {
    free(retValuePtr);
  }
}