Update Miniport Driver Status Indications for NDIS 6.0 (Compact 2013)
3/26/2014
The NDIS 6.0 NdisMIndicateStatusEx function replaces the NDIS 5.xNdisMIndicateStatus and NdisMIndicateStatusComplete functions.
The following table shows which API elements have been renamed and/or changed for NDIS 6.0.
NDIS 5.x |
NDIS 6.0 |
---|---|
NdisMIndicateStatus |
NdisMIndicateStatusEx |
To update miniport status indications for NDIS 6.0
Remove calls to NdisMIndicateStatus and NdisMIndicateStatusComplete.
Use NdisMIndicateStatusEx to indicate status to NDIS. Package status indication parameters in an NDIS_STATUS_INDICATION structure that contains the source handle, status code, buffer, and size.
The following code example illustrates how to use NdisMIndicateStatusEx to communicate link status to NDIS.
Important
For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.
NDIS_LINK_STATE LinkState;
NDIS_STATUS_INDICATION StatusIndication;
// Get the connection state, duplex state, and link speed:
LinkState.Header.Revision = NDIS_LINK_STATE_REVISION_1;
LinkState.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
LinkState.Header.Size = sizeof(NDIS_LINK_STATE);
LinkState.MediaConnectState = pMyAdapter->MediaState;
LinkState.MediaDuplexState = pMyAdapter->MediaDuplexState;
LinkState.XmitLinkSpeed = LinkState.RcvLinkSpeed = pMyAdapter->LinkSpeed;
// Initialize the status indication with the link state:
StatusIndication.Header.Type = NDIS_OBJECT_TYPE_STATUS_INDICATION;
StatusIndication.Header.Revision = NDIS_STATUS_INDICATION_REVISION_1;
StatusIndication.Header.Size = sizeof(NDIS_STATUS_INDICATION);
StatusIndication.SourceHandle = pMyAdapter->MiniportAdapterHandle;
StatusIndication.StatusCode = NDIS_STATUS_LINK_STATE;
StatusIndication.StatusBuffer = (PVOID)&LinkState;
StatusIndication.StatusBufferSize = sizeof(LinkState);
// Post the status indication:
NdisMIndicateStatusEx(pMyAdapter->MiniportAdapterHandle, &StatusIndication);
In the preceding example, the media connection state, duplex state, and the link speed are copied from the adapter context into the LinkState
structure. The address and size of this structure is recorded in the StatusIndication
structure, the status code is set to NDIS_STATUS_LINK_STATE, and then this status indication is sent to NDIS through the NdisMIndicateStatusEx function call.