rasenumconnections function in VB returns 632 Error resolution method _php instance

Source: Internet
Author: User

Using the Rasenumconnections function today, I found the example on MSDN to be wrong.

This is what the Rasenumconnections documentation on MSDN says:

Copy Code code as follows:

To determine the required buffer size, call Rasenumconnections with Lprasconn set to NULL. The variable pointed to by LPCB should is set to zero. The function would return the required buffer size into LPCB and an error code of Error_buffer_too_small.

The sample code provided on MSDN is also written like this:

Copy Code code 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 wrong, at least on the XP SP3 is wrong, the Rasenumconnections function returns Error_invalid_size (632), not error_buffer_too_small. The solution is that the first parameter does not pass in null, but instead passes in a RASCONN structure with the correct set of dwsize, generally dwsize is set to sizeof (Rasconn), but if your program is to run on an earlier system, you need to hard The value of the code into 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.