NdisRegisterMac

VOID
   NdisRegisterMac(
       OUT PNDIS_STATUS Status,
       OUT PNDIS_HANDLE NdisMacHandle,
       IN NDIS_HANDLE NdisWrapperHandle,
       IN NDIS_HANDLE MacMacContext,
       IN PNDIS_MAC_CHARACTERISTICS MacCharacteristics,
       IN UINT CharacteristicsLength
       );

NdisRegisterMac is called by the NIC driver immediately after it calls NdisInitializeWrapper.

Parameters

Status

Points to the caller-supplied variable in which this function writes the status of the registration. Possible values are:

NDIS_STATUS_BAD_CHARACTERISTICS
NDIS_STATUS_BAD_VERSION
NDIS_STATUS_FAILURE
NDIS_STATUS_NOT_ACCEPTED
NDIS_STATUS_RESOURCES
NDIS_STATUS_SUCCESS

NdisMacHandle

Points to the caller-supplied variable in which this function writes the handle that the NDIS interface library associates with the NIC driver. This value is a required parameter to several NdisXxx functions.

NdisWrapperHandle

Specifies the handle associated with the NDIS interface library.

MacMacContext

Specifies the context that the NIC driver associates with itself. This value is typically a pointer to storage that the NIC driver maintains and describes. The NDIS interface library records the context and passes it to the caller’s MacAddAdapter and MacUnload functions.

MacCharacteristics

Points to an NDIS_MAC_CHARACTERISTICS structure, defined as follows:

typedef struct _NDIS_MAC_CHARACTERISTICS {

    UCHAR MajorNdisVersion;

    UCHAR MinorNdisVersion;

    UINT Reserved;

    OPEN_ADAPTER_HANDLER OpenAdapterHandler;

    CLOSE_ADAPTER_HANDLER CloseAdapterHandler;

    SEND_HANDLER SendHandler;

    TRANSFER_DATA_HANDLER TransferDataHandler;

    RESET_HANDLER ResetHandler;

    REQUEST_HANDLER RequestHandler;

    QUERY_GLOBAL_STATISTICS_HANDLER
                     QueryGlobalStatisticsHandler;

    UNLOAD_MAC_HANDLER UnloadMacHandler;

    ADD_ADAPTER_HANDLER AddAdapterHandler;

    REMOVE_ADAPTER_HANDLER RemoveAdapterHandler;

    NDIS_STRING Name;

} NDIS_MAC_CHARACTERISTICS, *PNDIS_MAC_CHARACTERISTICS;

This structure’s members provide the following information:

MajorNdisVersion

Specifies the major NDIS version. This value should be set to 0x03.

MinorNdisVersion

Specifies the minor NDIS version. This value should be set to NDIS 3.0.

Reserved

This member is reserved for system use.

OpenAdapterHandler

Specifies the address of the caller’s MacOpenAdapter function.

CloseAdapterHandler

Specifies the address of the caller’s MacCloseAdapter function.

SendHandler

Specifies the address of the caller’s MacSend function.

TransferDataHandler

Specifies the address of the caller’s MacTransferData function.

ResetHandler

Specifies the address of the caller’s MacReset function.

RequestHandler

Specifies the address of the caller’s MacRequest function.

QueryGlobalStatisticsHandler

Specifies the address of the caller’s MacQueryGlobalStatistics function.

UnloadMacHandler

Specifies the address of the caller’s MacUnload function.

AddAdapterHandler

Specifies the address of the caller’s MacAddAdapter function.

RemoveAdapterHandler

Specifies the address of the caller’s MacRemoveAdapter function.

Name

Specifies the address of a caller-initialized counted string, in the system-default character set, naming the driver. For Windows NT drivers, this string contains Unicode characters.

CharacteristicsLength

Specifies the size in bytes of the characteristics structure.

Comments

NdisRegisterMac provides the NDIS library with information about the NIC driver, including the addresses of its upper-edge driver functions. In response, the NDIS library registers the NIC driver and provides a connection for it.

Every NIC driver should initialize the characteristics structure with NdisZeroMemory before it sets values in this structure and calls NdisRegisterMac.

NdisRegisterMac saves the information at MacCharacteristics in the NDIS library.

All upper-edge function addresses in the characteristics structure must be valid. After it has registered, the NIC driver cannot alter its upper-edge functions.

After NdisRegisterMac returns control, the NDIS interface library calls the supplied MacAddAdapter function.

Callers of NdisRegisterMac run at IRQL PASSIVE_LEVEL.

See Also

MacAddAdapter, MacCloseAdapter, MacOpenAdapter, MacQueryGlobalStatistics, MacRemoveAdapter, MacRequest, MacReset, MacSend, MacTransferData, MacUnload, NdisDeregisterMac, NdisInitializeString, NdisInitializeWrapper, NdisRegisterAdapter, NdisZeroMemory