Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
After I do a RasDial() function, RasGetConnectStatus() always returns a 632 error code. Here's what I have: I've made it as simple as possible.

C++
RASDIALPARAMS pParams;
HRASCONN      hRas;
DWORD         dwRetVal;
DWORD         dw_ret;
RASCONNSTATUS status;

hRasInstance = LoadLibrary("RASAPI32.DLL");
fRasDial = (pRasDial)GetProcAddress(hRasInstance, "RasDialA");
fRasGetErrorString = (pRasGetErrorString)GetProcAddress(hRasInstance, "RasGetErrorStringA");
fRasEnumConnections = (pRasEnumConnections)GetProcAddress(hRasInstance, "RasEnumConnectionsA");
fRasHangUp = (pRasHangUp)GetProcAddress(hRasInstance, "RasHangUpA");
fRasGetConnectStatus = (pRasGetConnectStatus)GetProcAddress(hRasInstance, "RasGetConnectStatusA")

pParams.dwSize = sizeof(RASDIALPARAMS); // I've tried 816, 1052 and 1060

hRas = 0;
dwRetVal = fRasDial(NULL, NULL, &pParams, 1, RasCallback, &hRas);

// dwRetVal is always a 0.

dw_ret = fRasGetConnectStatus(hRas, &status);

if(dw_ret)
{
  // Display the error. Is always a 632. 
}
Posted
Updated 8-Apr-11 6:54am
v3

Try this:
status.dwSize = sizeof(RASCONNSTATUS);

Regards.
 
Share this answer
 
OK, now I get Error 6 with an empty buffer.
 
Share this answer
 
I'm doing this:

status.dwSize = sizeof(RASCONNSTATUS); // status.dwSize turns out to be 288

dw_ret = fRasGetConnectStatus(hRas, &status);

if(dw_ret) // dw_ret is a 6
{
fRasGetErrorString(dw_ret, buff, sizeof(buff));
sprintf(szString, "RAS: %s, Error: %d", buff, dw_ret);
ShowMessage(szString);
}
 
Share this answer
 
v2
Comments
mbue 8-Apr-11 13:50pm    
Please use Add comment to add a comment!
Winerror.h says: 6==ERROR_INVALID_HANDLE
Regards.
"stdafx.h"
#define WINVER 0x0501    //xp
 
Share this answer
 
v3
Comments
Member 2583616 30-Jun-11 13:31pm    
Thanks Man!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900