The Rasenumconnections function in VB returns the 632 error resolution method _php instance

Source: Internet
Author: User
Using the Rasenumconnections function today, we found that the example on MSDN is wrong.

This is what the Rasenumconnections documentation on MSDN says:
Copy the 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 in LPCB and an error code of Error_buffer_too_small.

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

Copy the 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 XP SP3, the Rasenumconnections function returns error_invalid_size (632) instead of Error_buffer_too_small. The solution is not to pass the first parameter to NULL, but to pass in a properly set dwsize rasconn structure, General dwsize is set to sizeof (Rasconn), but if your program to run on an earlier system, you need to hard Code 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.