To determine the required buffer size, call RasEnumConnections with lprasconn set to NULL. The variable pointed to by lpcb should be set to zero. The function will return the required buffer size in lpcb and an error code of ERROR_BUFFER_TOO_SMALL.
DWORD __cdecl wmain(){DWORD dwCb = 0; DWORD dwRet = ERROR_SUCCESS; DWORD dwConnections = 0; LPRASCONN lpRasConn = NULL; dwRet = RasEnumConnections(lpRasConn, &dwCb, &dwConnections);
if (dwRet == ERROR_BUFFER_TOO_SMALL) { // ...... }