windowswinapiwindows-11wininet

Regression(?): InternetGetConnectedState returns TRUE always under Windows 11


In my app I'm using InternetGetConnectedState to determine if the system is online.

I was using Windows 10 and it was always working fine.

Recently I've upgraded my machine to Windows 11 and found that it's not working anymore: it's returning TRUE always.

In its lpdwFlags parameter it returns 18, which means LAN (0x2) | RasInstalled (0x10).

I think this is a regression and it's related to Ras (I connect using Dial-up).

Two questions:

  1. Is it really a bug, or me misusing this function in some way?
  2. Is there a known workaround for my config?

Solution

  • As InternetGetConnectedState recommends,

    use the INetworkListManager::GetConnectivity method instead.

    There is a Microsoft sample NetworkListManager which is uploaded recently.

    enter image description here

    enter image description here