Hello everyone,
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 connection 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!