The NdisMAllocatePort function allocates an NDIS port that is associated with a miniport adapter.
NDIS_STATUS NdisMAllocatePort( NDIS_HANDLE NdisMiniportHandle, PNDIS_PORT_CHARACTERISTICS PortCharacteristics );
The miniport adapter handle that NDIS passed to the MiniportAdapterHandle parameter of the MiniportInitializeEx function.
A pointer to an NDIS_PORT_CHARACTERISTICS structure that defines the characteristics of the port.
NdisMAllocatePort can return one of the following values:
||NDIS successfully allocated resources for the port.|
||NDIS could not allocate resources for the port.|
||The port allocation failed because the associated miniport adapter is closing.|
||The data that was supplied at the PortCharacteristics parameter was invalid.|
The NdisMAllocatePort function allocates resources and a port number for a port that is associated with a miniport adapter. The port is not active until the miniport driver issues a NetEventPortActivation Plug and Play (PnP) event for the port.
After the miniport driver activates the port, NDIS generates a PnP notification for the overlying drivers. If an overlying driver or user-mode application issues the OID_GEN_ENUMERATE_PORTS OID to enumerate a miniport adapter's ports, NDIS does not include non-active allocated ports in the list of the ports.
When NdisMAllocatePort successfully returns, the PortNumber member of the NDIS_PORT_CHARACTERISTICS structure that the PortCharacteristics parameter specifies is set to the port number that NDIS assigned to the port.
After a port is no longer required, the miniport driver should call the NdisMFreePort function to free the port.
|Minimum supported client||Supported in NDIS 6.0 and later.|
|Header||ndis.h (include Ndis.h)|