clone method

IEnumNetworks? clone()

Creates an enumerator that contains the same enumeration state as the enumerator currently in use.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/netlistmgr/nf-netlistmgr-ienumnetworks-clone.

Implementation

IEnumNetworks? clone() {
  final ppEnumNetwork = adaptiveCalloc<VTablePointer>();
  final hr$ = HRESULT(_CloneFn(ptr, ppEnumNetwork));
  if (hr$.isError) {
    free(ppEnumNetwork);
    throw WindowsException(hr$);
  }
  final result$ = ppEnumNetwork.value;
  free(ppEnumNetwork);
  if (result$.isNull) return null;
  return .new(result$);
}