lineGetCurrentOperator hangs and does not work



Hi,

I need to know if my device is using network in roaming mode or not.
TO do so I first try to get roaming status via lineGetLineDevStatus but I always get LINEROAMMODE_UNAVAIL = 0x00000002 while my device shows me I am in romaing mode (small triangle).
I also tried to use SNAPI and in the registry System\\State\\Phone\\Status I can read the value 0x1002E0 and if I follow SNAPI indication I should apply a SN_PHONEROAMING_BITMASK 0x200 to get roaming status, so I get 2 (LINEROAMMODE_UNAVAIL)

#define SN_PHONEROAMING_PATH TEXT("System\\State\\Phone")
#define SN_PHONEROAMING_VALUE TEXT("Status")
#define SN_PHONEROAMING_BITMASK 0x200


Now I suppose I need to retrieve the operator list and check if device is using the default operator so I am trying lineGetCurrentOperator but I always get dwError = 0x80000035.


void GetOperatorList()
{

....
CString sInfo(L"Available Operators:\r\n");

LINEOPERATORSTATUS lops;
lops.dwTotalSize = sizeof(LINEOPERATORSTATUS);
lRet = ::lineGetOperatorStatus(lineHandle, &lops);
if (lRet != 0 && lRet != LINEERR_STRUCTURETOOSMALL)
{
//AfxMessageBox(szMsg);
return;
}



LPBYTE pLineOperatorStatusBytes = new BYTE[lops.dwNeededSize];
LPLINEOPERATORSTATUS pStatus = (LPLINEOPERATORSTATUS)pLineOperatorStatusBytes;
if ( (lRet = ::lineGetOperatorStatus(lineHandle, pStatus)) == ERROR_SUCCESS )
{
LPLINEOPERATOR pOperator = (LPLINEOPERATOR)((LPBYTE)pStatus+(pStatus->dwAvailableOffset));
for(DWORD dwOperatorNumber = 0;

dwOperatorNumber < pStatus->dwAvailableCount;
dwOperatorNumber++)
{
sInfo += pOperator->lpszLongName;
sInfo += L"\r\n";
pOperator++;
}
}
else
{
GetTAPIErrorMsg(szMsg,sizeof(szMsg), lRet); }
....
}

Any help would be appreciated.

.