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

NDIS_STATUS NdisIMRegisterLayeredMiniport(
  NDIS_HANDLE NdisWrapperHandle,
  UINT CharacteristicsLength,
  PNDIS_HANDLE DriverHandle


  • NdisWrapperHandle
    [in] Specifies the handle returned by NdisMInitializeWrapper.

  • MiniportCharacteristics
    [in] Points to an NDIS_MINIPORT_CHARACTERISTICS structure set up by the caller.

  • CharacteristicsLength
    [in] Specifies the length in bytes of the caller-supplied characteristics buffer. Depending on the value of MajorNdisVersion, this parameter must be either *sizeof(NDIS50_MINIPORT_CHARACTERISTICS)*if the driver supplies an NDIS50_MINIPORT_CHARACTERISTICS structure or sizeof(NDIS40_MINIPORT_CHARACTERISTICS) if the driver supplies an NDIS_MINIPORT_CHARACTERISTICS structure.

    If the driver includes the build instruction NDIS50_MINIPORT, or NDIS40_MINIPORT, as appropriate, in its sources, or if the driver writer uses the NDIS50_MINIPORT or NDIS40_MINIPORT compiler switch, this parameter is set when the driver is built.

  • DriverHandle
    [out] Points to a variable in which NdisIMRegisterLayeredMiniport, if this call is successful, returns a handle that the caller should save. The caller subsequently must pass this handle to NdisIMInitializeDeviceInstance, usually from its ProtocolBindAdapter function.

Return Values

The following table shows the return values for this function.

Value Description
NDIS_STATUS_SUCCESS NDIS registered the caller as a miniport.
NDIS_STATUS_BAD_CHARACTERISTICS The CharacteristicsLength is too small for the MajorNdisVersion specified in the buffer at MiniportCharacteristics.
NDIS_STATUS_BAD_VERSION The MajorNdisVersion or MinorNdisVersion specified in the characteristics structure is invalid.
NDIS_STATUS_RESOURCES A shortage of resources, possibly memory, prevented the NDIS library from registering the caller as a miniport.
NDIS_STATUS_FAILURE This is a default error status, returned when none of the preceding errors caused the registration to fail. For example, if the NDIS library cannot load the driver's image and lock it into system memory, it returns this error.


Any NDIS intermediate driver that exports both MiniportXXX and ProtocolXXX functions sets up a characteristics structure and calls NdisIMRegisterLayeredMiniport from its DriverEntry function after DriverEntry calls NdisMInitializeWrapper. This structure is copied in the NdisIMRegisterLayeredMiniport request to the NDIS library's internal storage. Thus, once it has registered, such a driver cannot change its handler functions.

After such an NDIS intermediate driver has called NdisIMRegisterLayeredMiniport successfully, it must call NdisRegisterProtocol to register its ProtocolXXX functions with the NDIS library. Such a driver usually has both ProtocolBindAdapter and ProtocolUnbindAdapter functions. Its ProtocolBindAdapter function will be called next when the underlying NIC driver has initialized successfully. ProtocolBindAdapter then can establish a binding to that NIC driver with NdisOpenAdapter.

An NDIS intermediate driver should have a MiniportSendPackets function if an underlying NIC driver might support multipacket sends or consume media-specific information, such as packet priorities, sent down in a packet array from a higher-level protocol. An NDIS intermediate driver should have a MiniportReturnPacket function if an underlying NIC driver might support multipacket receive indications or indicate packet arrays containing media-specific information. The NDIS library handles packet arrays transferred between an underlying NIC driver and higher-level protocol that support only single-packet transfers on behalf of such an intermediate driver.


OS Versions: Windows CE .NET 4.0 and later.
Header: Ndis.h.

See Also

DriverEntry | MiniportCancelSendPackets | MiniportCheckForHang | MiniportHalt | MiniportInitialize | MiniportQueryInformation | MiniportReset | MiniportReturnPacket | MiniportReturnPacket | MiniportSend | MiniportSendPackets | MiniportSetInformation | MiniportShutdown | MiniportTransferData | MiniportWanSend | NdisIMInitializeDeviceInstance | NdisMInitializeWrapper | NdisMRegisterAdapterShutdownHandler | NdisOpenAdapter | NdisRegisterProtocol | ProtocolBindAdapter | ProtocolUnbindAdapter

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.