Indicating Connection Status
A miniport driver calls NdisMIndicateStatusEx or NdisMCoIndicateStatusEx to indicate a change in the media connection status. The miniport driver passes one of the following status indications to NdisM(Co)IndicateStatus:
Indicates a media connection status change from disconnected to connected. A media connect status change occurs when a disconnected adapter makes a network connection. For example, the adapter connects when it comes within range (for a wireless adapter) or the user connects the network cable.
Indicates a media connection status change from connected to disconnected. A media disconnect status change occurs when a connected adapter loses a network connection. For example, the adapter loses the connection because it is out of range (for a wireless adapter) or the user unplugs the network cable.
Unless specified otherwise, miniport drivers should indicate media connection status changes within two seconds after detecting the status change.
A miniport driver can check the media connection status while performing certain operations (see the following list). If the status is the same after the operation is complete as it was before the operation started,the miniport driver does not have to report any status changes that might have occurred during the operation.
The following list describes additional requirements for indicating media connection status changes for miniport drivers:
NDIS calls MiniportResetEx to reset a miniport driver. The miniport driver can complete the reset either synchronously or asynchronously.
If the media connection status is different after resetting, the driver should indicate the status within two seconds after completing the reset.
A miniport driver should not complete the reset operation until it has determined the media connection status.
A miniport driver must not indicate any media connection status changes when NDIS calls MiniportHaltEx.
NDIS calls a miniport driver's MiniportInitializeEx function to initialize an adapter. During the adapter initialization, the miniport driver must follow these guidelines:
If the miniport driver does not indicate the media connection status after returning from MiniportInitializeEx, NDIS uses the value of the MediaConnectState member of the NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES structure to determine the media connection status. The miniport driver provides NDIS with this structure when the driver calls NdisMSetMiniportAttributes from its MiniportInitializeEx function.
Note If the MediaConnectState member is set to MediaConnectStateUnknown, NDIS will proceed as if the adapter is disconnected.
If an adapter is connected after NDIS calls MiniportInitializeEx, the miniport driver can indicate NDIS_STATUS_MEDIA_CONNECT within 5 seconds after it returns from MiniportInitializeEx.
If an adapter is disconnected after NDIS calls MiniportInitializeEx, the miniport driver should indicate NDIS_STATUS_MEDIA_DISCONNECT within 2 seconds after it returns from MiniportInitializeEx.
While initializing, the miniport driver should process OID_GEN_MEDIA_CONNECT_STATUS or OID_GEN_CO_MEDIA_CONNECT_STATUS requests asynchronously. The miniport driver should not complete such requests until after it has determined the connection status.
Determination of the media connection status should not delay initialization. If necessary, the miniport driver should initiate the process to determine the connection status within MiniportInitializeEx, and complete the process at a later time. For example, the miniport driver could set a timer to poll the adapter for the connection status.
A deserialized miniport driver can indicate a media disconnect during initialization, but a serialized miniport driver should not.
A miniport driver enters a network sleep state when it receives an OID_PNP_SET_POWER request to set a device power state of D1, D2, or D3.
A miniport driver must not indicate any media connection status changes when it enters a sleep state or while it is in a sleeping state.
If the adapter's media connection status after waking is the same as the status was prior to sleeping, the miniport driver should not indicate a media connection status change. If the connection status changed, the miniport driver should indicate the new connection status within two seconds after waking.
While waking, the miniport driver should process OID_GEN_MEDIA_CONNECT_STATUS or OID_GEN_CO_MEDIA_CONNECT_STATUS requests asynchronously. The miniport driver should not complete such requests until after it has determined the connection status.