The RasEnumConnections function in VB Returns Error 632 _ php instance

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.