NdisMFreePort function

The NdisMFreePort function frees an NDIS port that was previously allocated with the NdisMAllocatePort function.

Syntax


NDIS_STATUS NdisMFreePort(
  _In_  NDIS_HANDLE MiniportAdapterHandle,
  _In_  NDIS_PORT_NUMBER PortNumber
);

Parameters

MiniportAdapterHandle [in]

The miniport adapter handle that NDIS passed to the MiniportAdapterHandle parameter of the MiniportInitializeEx function.

PortNumber [in]

The number of the NDIS port that NDIS should free. The PortNumber value is an NDIS_PORT_NUMBER value, which has a ULONG data type. NDIS provided the port number in the PortNumber member of the NDIS_PORT_CHARACTERISTICS structure when the miniport driver called the NdisMAllocatePort function.

The port number can be a number from 1 through 0xffffff. You cannot set PortNumber to zero, which indicates the default port.

Return value

NdisMFreePort can return one of the following values:

Return codeDescription
NDIS_STATUS_SUCCESS

NDIS successfully freed the resources for the port.

NDIS_STATUS_INVALID_PORT

NDIS could not free the resources for the port because the port number was invalid.

NDIS_STATUS_INVALID_PORT_STATE

NDIS could not free the resources for the port because the port was is in a state where the free operation is invalid. To free the port, the port must be in the allocated state.

NDIS_STATUS_INVALID_DATA

The port number that was supplied at the PortNumber parameter was invalid.

 

Remarks

If a miniport driver allocated a port by calling the NdisMAllocatePort function, the driver must free the port before it returns from its MiniportHaltEx function. If the miniport driver activated the port by issuing a NetEventPortActivation Plug and Play (PnP) event, the driver must issue a NetEventPortDeactivation PnP event for the port before freeing the port.

When a miniport driver calls NdisMFreePort to free a port, NDIS also frees the port number that is assigned to the freed port so that NDIS can reuse the port number.

The miniport driver must not attempt to free the default port.

Requirements

Version

Supported in NDIS 6.0 and later.

Header

Ndis.h (include Ndis.h)

IRQL

<= DISPATCH_LEVEL

DDI compliance rules

Irql_Miniport_Driver_Function

See also

MiniportHaltEx
MiniportInitializeEx
NDIS_PORT_CHARACTERISTICS
NdisMAllocatePort
Default NDIS Port
Freeing an NDIS Port

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft