Freeing an NDIS Port

Your miniport driver must free all NDIS ports that it allocates for miniport adapters in its MiniportInitializeEx function. It can free a port any time by calling NdisMFreePort, except for the two cases noted below.

Your miniport driver must free all allocated ports in these cases:

  • If your driver’s MiniportInitializeEx function fails, it must free all allocated ports.
  • If a miniport adapter is halted, your driver’s MiniportHaltEx function must free all allocated ports.

Your miniport driver cannot simply call NdisMFreePort in these cases:

  • If the port is the default port, NDIS frees it automatically, so your miniport driver must not free it. If you try to free the default port, NdisMFreePort returns an NDIS_STATUS_INVALID_PORT error.
  • If the port is active, your miniport driver will need to deactivate it before calling NdisMFreePort.

Allocating NDIS Ports

Deactivating NDIS Ports

Default NDIS Port