Bewerken

Delen via


NdisMAllocatePort function (ndis.h)

The NdisMAllocatePort function allocates an NDIS port that is associated with a miniport adapter.

Syntax

NDIS_STATUS NdisMAllocatePort(
            NDIS_HANDLE                NdisMiniportHandle,
  [in, out] PNDIS_PORT_CHARACTERISTICS PortCharacteristics
);

Parameters

NdisMiniportHandle

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

[in, out] PortCharacteristics

A pointer to an NDIS_PORT_CHARACTERISTICS structure that defines the characteristics of the port.

Return value

NdisMAllocatePort can return one of the following values:

Return code Description
NDIS_STATUS_SUCCESS
NDIS successfully allocated resources for the port.
NDIS_STATUS_RESOURCES
NDIS could not allocate resources for the port.
NDIS_STATUS_CLOSING
The port allocation failed because the associated miniport adapter is closing.
NDIS_STATUS_INVALID_DATA
The data that was supplied at the PortCharacteristics parameter was invalid.

Remarks

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.

Requirements

Requirement Value
Minimum supported client Supported in NDIS 6.0 and later.
Target Platform Universal
Header ndis.h (include Ndis.h)
Library Ndis.lib
IRQL <= DISPATCH_LEVEL

See also

Allocating an NDIS Port

MiniportInitializeEx

NDIS_PORT_CHARACTERISTICS

NdisMFreePort

OID_GEN_ENUMERATE_PORTS