Share via


NdisRegisterProtocol (Compact 2013)

3/26/2014

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

Syntax

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

Parameters

  • Status
    [out] Pointer to a caller-supplied variable that gives the status of the registration attempt.
  • NdisProtocolHandle
    [out] Pointer to a caller-supplied variable in which this function returns a handle representing the registered driver.
  • ProtocolCharacteristics
    [in] Pointer to an NDIS_PROTOCOL_CHARACTERISTICS structure set up by the caller.
  • CharacteristicsLength
    [in] 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.

Return Value

The following table shows the return values for this function.

Value

Description

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.

Remarks

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

For best performance, a protocol that layers itself above an NIC driver that supports multipacket receives should provide a ProtocolReceivePacket function. An 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 that it supplied.

A successfully registered driver saves the handle returned at NdisProtocolHandle. Other Ndis functions that the driver calls subsequently require this parameter.

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.

Requirements

Header

ndis.h

See Also

Reference

NDIS 5.x Legacy Functions
NdisDeregisterProtocol
NdisInitializeString
NdisInitUnicodeString
NdisOpenAdapter
NdisZeroMemory
ProtocolReceivePacket
ProtocolReceive