nortsiw_kaka

Hi all:

I create a GPRS Connection using CM_GPRSEntries method. Below it's the sample code

//------------------------------------------------------------------------------------------------------------------------------------

<characteristic type="CM_GPRSEntries">
  <characteristic type="GPRS1">
   <parm name="DestId" value="{436EF144-B4FB-4863-A041-8F905A62C572}" />
   <parm name="UserName" value="" />
   <parm name="Password" value="" />
   <parm name="Domain" value="" />
   <characteristic type="DevSpecificCellular">
     <parm name="GPRSInfoValid" value="1" />
     <parm name="GPRSInfoAccessPointName" value="internet.adatum.com" />
   </characteristic>
  </characteristic>
</characteristic>
//-----------------------------------------------------------------------
but when I use the RasEnumEntries function to get this information. but why I can't get the <parm name="GPRSInfoAccessPointName" value="internet.adatum.com" />,please see the below the red text.
Below it's the sample code.
//------------------------------------------------------------------

TCHAR szTemp[MAX_PATH] = L"";
DWORD nRet = 0;
DWORD cEntries = 0;
DWORD cb = 0;
DWORD dwByte = 1024;
DWORD dwSize = 0;
DWORD dwReturn = 0;
DWORD dwError;
RASENTRY RasEntry;
memset(&RasEntry,0x00,sizeof(RASENTRY));
dwSize = RasEntry.dwSize = sizeof(RASENTRY);
BYTE pByte[1024];
memset(pByte,0x00,1024);
 LPRASENTRYNAME lprasentryname = (LPRASENTRYNAME)LocalAlloc(LPTR, sizeof(RASENTRYNAME));
lprasentryname->dwSize = sizeof(RASENTRYNAME);
if ((nRet = RasEnumEntries(NULL, NULL, lprasentryname, &cb, &cEntries))
== ERROR_BUFFER_TOO_SMALL)
{
lprasentryname = (LPRASENTRYNAME)LocalAlloc(LPTR, cb);
lprasentryname->dwSize = sizeof(RASENTRYNAME);
}
// Calling RasEnumEntries to enumerate the phonebook entries
nRet = RasEnumEntries(NULL, NULL, lprasentryname, &cb, &cEntries);
 if (nRet == ERROR_SUCCESS)
{
for(int i=0;i < cEntries;i++)
{
if(dwError = RasGetEntryProperties(NULL,
lprasentryname->szEntryName,&RasEntry,&dwSize,NULL,NULL))
return ;
RASFP_Slip;
if (wcsstr(RasEntry.szLocalPhoneNumber,L"~GPRS!") != NULL)
{
//RAS entry is GPRS
RASDIALPARAMS RasDialParams;//= (LPRASDIALPARAMS)malloc(sizeof(RASDIALPARAMS));
//lpRasDialParams.dwSize =sizeof(RASDIALPARAMS);
memset(&RasDialParams,0x00,sizeof(RASDIALPARAMS));
RasDialParams.dwSize = sizeof(RASDIALPARAMS);
_tcscpy(RasDialParams.szEntryName, lprasentryname->szEntryName);
nRet = RasGetEntryDialParams(NULL,&RasDialParams,&bPassword);
if (nRet == ERROR_SUCCESS)
{
GPRSInfo *tempGPRSEntry;
tempGPRSEntry=(GPRSInfo*)malloc(sizeof(GPRSInfo));
     wcscpy(tempGPRSEntry->szNetworkName,lprasentryname->szEntryName);
     wcscpy(szTemp,RasEntry.szLocalPhoneNumber);
TCHAR *ptr = szTemp;
int len =wcslen(L"~GPRS!");
while (len)
{
if (ptr == '\0')
break;
ptr++;
len--;
}
if (ptr == '\0')
wcscpy(tempGPRSEntry->szAccessPoint,L"");
else
wcscpy(tempGPRSEntry->szAccessPoint,ptr);
     //
CReg reg;
TCHAR szTempDesId[MAX_PATH] = L"";
wcscpy(szTemp,L"\\Comm\\ConnMgr\\Providers\\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\\Connections\\");
wcscat(szTemp,lprasentryname->szEntryName);
reg.GetString(szTemp,szTempDesId,MAX_PATH);
reg.Close();
if (wcscmp(szTempDesId,L"{18AD9FBD-F716-ACB6-FD8A-1965DB95B814}") == 0)
wcscpy(tempGPRSEntry->szNetworkType,L"{A1182988-0D73-439e-87AD-2A5B369F808B}");
else
wcscpy(tempGPRSEntry->szNetworkType,L"{436EF144-B4FB-4863-A041-8F905A62C572}");

wcscpy(tempGPRSEntry->szUserName,RasDialParams.szUserName);
wcscpy(tempGPRSEntry->szPassword,RasDialParams.szPassword);
wcscpy(tempGPRSEntry->szDomain,RasDialParams.szDomain);
tempGPRSEntry->bSelect = FALSE;
tempGPRSEntry->next = NULL;
tempGPRSEntry->pre = NULL; }
}
lprasentryname++;
}
}
LocalFree(lprasentryname);
//--------------------------------------------------------
Thanks!



Re: Smart Devices Native C++ Development Creating a GPRS Connection question

Saravanan V V

Hi

My suggestion regarding this is after you get the Connection name from the RAS. Use the CSP CM_GPRSEntries to enumerate all the details about the Connection. In this way you will get the Access Point Name.