Thread View: comp.os.ms-windows.programmer.win32
1 messages
1 total messages
Started by Alan Mintz
Mon, 19 Nov 2001 07:11
SOLUTION: RasDial() and ERROR_NO_CONNECTION (668) on Win2K
Author: Alan Mintz
Date: Mon, 19 Nov 2001 07:11
Date: Mon, 19 Nov 2001 07:11
33 lines
2750 bytes
2750 bytes
Several people have posted that, on Win2K or WinXP, they are getting ERROR_NO_CONNECTION (668) from RasDial() immediately when attempting to dial an outbound connection. The same thing happened to me. ***Short answer: Initialize *lphRasConn to NULL before calling RasDial(). It then works as expected. Narrative: Not having found this answer in any of those threads, or anywhere else, I did the hack of shelling out and calling RasDial.exe, which worked OK, but lacks the robustness of the API. I finally decided to attack it again. The solution is, as usual, somewhat misleading documentation. Like others, I read the description of the lphRasConn parameter to mean that it stuffs the referenced HRASCONN variable with the resulting handle if the connection succeeds. So, like others, I declared an HRASCONN variable, and passed its address to RasDial() _without_initializing_it_first. After all, why should the present value matter - it's only purpose is to receive the result? RasDial() shouldn't care what's there. If you look carefully at the man page, however, it says that this is an [in] parameter, and that you have to initialize the variable to which it points to NULL before calling RasDial(). This, of course, doesn't correlate with the rest of the description, and I have no idea why RasDial() cares what's there. Either the man page should state that it's an [in/out] parameter and what it does with the existing value, or correct the man page to call it an [out] parameter and fix RasDial() to ignore the existing value.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads