Solved

DUN Rasdial disconnecting issue

Posted on 2004-03-23
8
492 Views
Last Modified: 2007-12-19
Hi experts,

I made an application that uses the RasApi to stablish a Dial-up connection with a local ISP. Everything works like a charm except I can't "cancel" the connection.

While it is dialing and authentificating there is a cancel button in my form, if the user click on it I call rashangup to cancel the connection with a loop to check for the "disconnected" error (6).

This works fine, but the connection never gets disconnected.

I have no clue what the problem might be.

Any ideas?

Thanks,

Esopo.
0
Comment
Question by:Esopo
  • 4
  • 3
8 Comments
 
LVL 10

Expert Comment

by:Kavar
ID: 10658040
give me a sec
0
 
LVL 14

Author Comment

by:Esopo
ID: 10662584
Ok, I'll be waiting... ;)
0
 
LVL 14

Author Comment

by:Esopo
ID: 10671443
Ok, I just realized why my code isn't working. It uses RasEnumConnections to get the pending connection but it won't return any. So I can't call RasHangUp on my connection, or can I ?

Of course that's why RasGetConnectStatus return ERROR_INVALID_HANDLE - "The specified port is not connected".



please check out this Q, it has the code I'm using (or if you'd like I can post it here):

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20922613.html


Thanks in advanced,

Esopo

BTW I'm also posting another Q here about this RasEnumConnections issue, this is rather urgent.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 10

Accepted Solution

by:
Kavar earned 250 total points
ID: 10676860
Delphi is about my weakest language, (except for english)

Your problem with RasEnumConnections (I think)
is that  a RASCONN structure needs to be created, then set dwsize to 412

var
  RasConn  : TRasConn;
  bsize    : DWORD;
  Count    :  DWORD;
begin
  RasConn.dwSize := 412;

I think you have another one of these open... That I am working on, Like I was indicating on the other thread,
Just use rashangup on the RASCONN handle that you got from the connection
0
 
LVL 14

Author Comment

by:Esopo
ID: 10682707
Using the handle the Rasdial gave me worked. As I said in the other Q I called RasHangUp with the Handle RasDial returned and seems to be working properly.

I am still wondering why isn't RasEnumConnections returning my pending connection?
Does a conection need to be fully stablish to appear there? It seemed to show the dialing connections in Win98 (not 100% sure but I think so).

Anyway, is there a way to get the handle for the pending connections that RasEnumConnections won't give me?
0
 
LVL 10

Expert Comment

by:Kavar
ID: 10683419
I htink rasenum isn't returning because the handle your passing it is not configured right..??

try initializing all values to (0) except for dwsize, set that to 412

unlikely, but it maybe possible to guess at the address of a given connection if you can scan the heap?!?

(REALLY DANGEROUS STUFF)
0
 
LVL 14

Author Comment

by:Esopo
ID: 10982093
Kavar,
What you posted did not really solve my problem, but hey!, it was a very vague question anyway, thanks for trying. At least I got a new thing to look for when playing with RAS.

Venabili,
Sorry to waist your administrative time, I'll try to see to it that my Q's don't go unatended for so long in the future.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now