NO

Author Topic: InternetDial() causes crash in wininet.dll  (Read 4043 times)

robal

  • Guest
InternetDial() causes crash in wininet.dll
« on: August 08, 2008, 01:50:49 PM »
Hi,

I'm trying to get InternetDial() working, and no matter what I try, it always crashes wininet.dll.

Code: [Select]
unsigned long int *conn;
InternetDial(hwndDlg,"GPRS",INTERNET_DIAL_UNATTENDED,conn,0);

I have included wininet.h.
I have added wininet.lib into linker.
hwndDlg is valid handle to my window.
"GPRS" is an existing RAS/DUN entry.

I've found some pieces of information on net that crashing may be due to 'parameter mismatch'. I couldn't find any more info though.

I haven't got any trouble working with other windows libraries and functions...
RasDial() from ras.h is working fine for me.

Anybody ?  Any clues ?


For reference:
Code: [Select]
DWORD InternetDial(
  HWND hwndParent,
  LPTSTR lpszConnectoid,
  DWORD dwFlags,
  DWORD_PTR lpdwConnection,
  DWORD dwReserved
);


robal

  • Guest
Re: InternetDial() causes crash in wininet.dll
« Reply #1 on: August 08, 2008, 02:32:56 PM »
OK, got some clues.

I set the 'conn' pointer to NULL before calling InternetDial().
I've got no idea why it helps.

There's no crash now, but InternetDial() returns ERROR_INVALID_PARAMETER.

Is it possible that 'unsigned long int *' is not a proper type here ?
Interesting.

JohnF

  • Guest
Re: InternetDial() causes crash in wininet.dll
« Reply #2 on: August 08, 2008, 02:36:45 PM »
The MSDN entry for InternetDial() says.

=============
lpdwConnection
[out] Pointer to a variable that specifies the connection number.
=============

So, you need to give the address of a variable, conn in this case.

Code: [Select]
unsigned long int conn;
InternetDial(hwndDlg,"GPRS",INTERNET_DIAL_UNATTENDED,&conn,0);

John

robal

  • Guest
Re: InternetDial() causes crash in wininet.dll
« Reply #3 on: August 08, 2008, 02:42:46 PM »
My god.
I'm so stupid. 

It's [out] parameter... and I was standing on my head doing crazy stuff to make it work :/

Thanks !

JohnF

  • Guest
Re: InternetDial() causes crash in wininet.dll
« Reply #4 on: August 08, 2008, 02:53:48 PM »
Also, although it works as a 'long int' the variable to be correct should be a DWORD

DWORD conn;

John