This article mainly introduces the solution to the 632 error returned by the RasEnumConnections function in VB. The error in the example in MSDN is displayed on the SP3 SP3 system. If you need a friend, refer to the following: I used the RasEnumConnections function today, the MSDN example is incorrect.
The RasEnumConnections document on MSDN says this:
The Code is as follows:
To determine the required buffer size, call RasEnumConnections with lprasconn set to NULL. the variable pointed to by lpcb shocould be set to zero. the function will return the required buffer size in lpcb and an error code of ERROR_BUFFER_TOO_SMALL.
The sample code provided on MSDN is also written as follows:
The Code is as follows:
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 ){
//......
}
Unfortunately, this example is incorrect, at least on XP SP3. The RasEnumConnections function returns ERROR_INVALID_SIZE (632) instead of ERROR_BUFFER_TOO_SMALL. The solution is that the first parameter should not be NULL, but a RASCONN structure with dwSize correctly set. Generally, dwSize is set to sizeof (RASCONN; however, if your program is to run on an earlier system, You Need To hard code it into the value of the target system.