alroyso 4 months ago
parent
commit
fea00c6a4f
1 changed files with 5 additions and 3 deletions
  1. 5 3
      windows/wl_base_help_plugin.cpp

+ 5 - 3
windows/wl_base_help_plugin.cpp

@@ -232,16 +232,18 @@ void KillProcess(const std::wstring& processName) {
     }
 }
 
-bool CheckPPPConnection() {
+bool isDialUpEnabled() {
     RASCONN rasConn[256];
     DWORD dwSize = sizeof(rasConn);
     DWORD dwConnections = 0;
     rasConn[0].dwSize = sizeof(RASCONN);
 
+    // 枚举所有的 RAS 连接,检查是否有 PPP 连接
     if (RasEnumConnections(rasConn, &dwSize, &dwConnections) == ERROR_SUCCESS) {
         for (DWORD i = 0; i < dwConnections; i++) {
-            if (rasConn[i].szDeviceType == RASDT_PPPoE) {
-                return true;  // 检测到 PPPoE 连接
+            if (strcmp(rasConn[i].szDeviceType, RASDT_PPP) == 0 ||
+                strcmp(rasConn[i].szDeviceType, RASDT_PPPoE) == 0) {
+                return true;  // 检测到 PPP 或 PPPoE 连接
             }
         }
     }