NdisRegisterProtocol

This function registers an NDIS driver’s Protocol_* entry points and name with the NDIS library when the driver initializes.

At a Glance

Header file: Ndis.h
Windows CE versions: 2.0 and later

Syntax

VOID NdisRegisterProtocol( OUT PNDIS_STATUS Status,
OUT PNDIS_HANDLE NdisProtocolHandle,
IN PNDIS_PROTOCOL_CHARACTERISTICS ProtocolCharacteristics,
IN UINT CharacteristicsLength );

Parameters

Status
Pointer to a caller-supplied variable that can be one of the following values on return from this function:
NDIS_STATUS_SUCCESS
The NDIS library registered the caller as a protocol driver.
NDIS_STATUS_BAD_CHARACTERISTICS
The CharacteristicsLength is too small for the MajorNdisVersion specified in the buffer at ProtocolCharacteristics.
NDIS_STATUS_BAD_VERSION
The MajorNdisVersion specified in the buffer at ProtocolCharacteristics is invalid.
NDIS_STATUS_RESOURCES
A shortage of resources, possibly memory, prevented the NDIS library from registering the caller.
NdisProtocolHandle
Pointer to a caller-supplied variable in which this function returns a handle representing the registered driver.
ProtocolCharacteristics
Pointer to an NDIS_PROTOCOL_CHARACTERISTICS structure set up by the caller.
CharacteristicsLength
Specifies the size, in bytes, of the structure at ProtocolCharacteristics. If the build directive NDIS40 is specified in the sources ahead of #include ndis.h, this value is supplied automatically.

Remarks

The value supplied at CharacteristicsLength must be at least the sizeof( NDISXXX_PROTOCOL_CHARACTERISTICS ) designated by the supplied MajorNdisVersion in this structure.

For the best possible performance, any protocol that layers itself above an NIC driver that supports multipacket receives should provide a ProtocolReceivePacket function. Any NIC driver that supports multipacket sends is also likely to indicate multipacket receives. A driver that provides a ProtocolReceivePacket function must also provide a ProtocolReceive function.

After a successful call to this function, a driver cannot alter the set of ProtocolXXX functions it supplied.

A successfully registered driver saves the handle returned at NdisProtocolHandle. It is a required parameter to other NDIS functions that the driver calls subsequently.

After a successful call to this function, the driver can call the NdisOpenAdapter function to set up a binding to the underlying NIC driver or to layer itself above any NDIS driver that registered a set of NDIS upper-edge ( MiniportXXX ) functions.

A driver that calls this function runs at IRQL PASSIVE_LEVEL.

See Also

NdisDeregisterProtocol, NdisInitializeString, NdisInitUnicodeString, NdisOpenAdapter, NdisZeroMemory