views:

37

answers:

0

Code Snippet:

LPRASCONN lpRasConn = NULL; RAS_STATS *lpStatistics; lpRasConn = (LPRASCONN ) calloc (sizeof(RASCONN),1); lpRasConn->dwSize = 0x53c;

lpStatistics = (RAS_STATS *)calloc(sizeof(RAS_STATS), 1);

// Call RasEnumConnections with lpRasConn = NULL. dwCb is returned with the required buffer size and 
// a return code of ERROR_BUFFER_TOO_SMALL
dwRet = RasEnumConnections(lpRasConn, &dwCb, &dwConnections);

if(dwRet == ERROR_SUCCESS)
{
 dwRet = RasGetConnectionStatistics( lpRasConn->hrasconn,  lpStatistics);
}

I get the lpRasConn->hrasconn handle to the connection as 'ununsed' and the statistics are all filled with zeroes. Also only when lpRasConn->dwSize = 0x53c is given the code works fine?? why what might be wrong??? why doesn't it work when sizeof(RASCONN) is assigned to dwSize.

In order to get proper handle (HRASCONN) what am i missing???

Kindly Help

Best Regards, Vinayak