getNetwork method

INetwork? getNetwork()

Returns the network associated with the connection.

Throws a WindowsException on failure.

To learn more, see learn.microsoft.com/windows/win32/api/netlistmgr/nf-netlistmgr-inetworkconnection-getnetwork.

Implementation

INetwork? getNetwork() {
  final ppNetwork = adaptiveCalloc<VTablePointer>();
  final hr$ = HRESULT(_GetNetworkFn(ptr, ppNetwork));
  if (hr$.isError) {
    free(ppNetwork);
    throw WindowsException(hr$);
  }
  final result$ = ppNetwork.value;
  free(ppNetwork);
  if (result$.isNull) return null;
  return INetwork(result$);
}