static void WinDialRasClose(HRASCONN connection) { RASCONNSTATUSW status; DWORD ret; status.dwSize = sizeof(status); if(ERROR_SUCCESS == RasHangUpW(connection)) { do { ret = RasGetConnectStatusW(connection, &status); Sleep(100); } while(ERROR_INVALID_HANDLE != ret); } }
bool dial_close_conn(const char *name) { RASCONNW conn; RASCONNSTATUSW status; DWORD ret; if (!find_conn_desc(name, &conn)) return FALSE; status.dwSize = sizeof(status); if (RasHangUpW(conn) == ERROR_SUCCESS) { do { ret = RasGetConnectStatusW(conn, &status); Sleep(100); } while (ret != ERROR_INVALID_HANDLE); } return TRUE; }