NdisMIndicateStatus issue on Windows 8 Customer Preview

Home Forums Discussions General Discussion NdisMIndicateStatus issue on Windows 8 Customer Preview

This topic contains 1 reply, has 1 voice, and was last updated by  Winsor 5 years, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5369

    Winsor
    Participant

    I have a problem with NdisMIndicateStatus function on Windows 8.

    From a Windows service I am sending an IOCTL to a NDIS driver in order to indicate media connected of a virtual network adapter. The issue is that, in most of the cases, Windows 8 fails to be notified about the adapter state change. The virtual adapter appears as being disconnected, when displaying IP addressing information with ipconfig command. I never had this issue happen on Windows 7 or Vista.

    My Windows service starts automatically, i.e. startup type is “Automatic”, and the above issue appears if the IOCTL is sent just after Windows logs in. But if the service is delayed started, i.e. startup type is “Automatic (Delayed Start)”, then the adapter’s state successfully changes into “media connected”.

    I know that on Windows 8 CP there are changes of the automatically started services list, or optimizations regarding unused started services, and I’m guessing that this could generate my issue but I didn’t found a proof to confirm my suspicions.

    I am calling NdisMIndicateStatus function, when receiving the IOCTL from the service, as below:


    VOID SetMediaStatus ( PADAPTER p_Adapter, BOOLEAN state )
    {
    if ( p_Adapter->m_MediaState != state )
    {
    if ( state )
    NdisMIndicateStatus ( p_Adapter->m_MiniportAdapterHandle, NDIS_STATUS_MEDIA_CONNECT, NULL, 0 );
    else
    NdisMIndicateStatus ( p_Adapter->m_MiniportAdapterHandle, NDIS_STATUS_MEDIA_DISCONNECT, NULL, 0 );

    NdisMIndicateStatusComplete ( p_Adapter->m_MiniportAdapterHandle );

    p_Adapter->m_MediaState = state;
    }
    }

    Any help is greatly appreciated.

    Thanks!

    #7072

    Winsor
    Participant

    After looking more closely to the query requests that arrive to the my NDIS miniport driver, when the adapter state was changed, I manage to saw what the problem is.

    When trying to change the virtual adapter state, the service sends an IOCTL the driver to change the state of the virtual network adapter into ‘connected’. The miniport driver receives the request and then notifies the upper layer NDIS driver that the state has change and it needs to check it out. In order to obtain the new state of the virtual adapter, NDIS sends a query request, OID_GEN_MEDIA_CONNECT_STATUS, to my NDIS miniport driver. The problem was that my miniport driver notified the upper layer NDIS driver about the state change before actually changing the adapter’s state ( see the above code from SetMediaStatus() ). This was the problem. On Windows 7, the query request from NDIS came much later, when the new adapter state was already set. On Windows 8, the adapter’s state query request came much faster, just after the change state notification, i.e. NdisMIndicateStatus() call, but before the new state could actually be set.

    The solution to the Windows 8 issue was to change the state of the Adapter driver first, and then notify the upper layer drivers about this.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.