void enumentryname()
{
char nstring[100]={0};
LPRASENTRYNAME lprasentryname;
int i;
DWORD nRet,cb,cEntries;
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)
{
printf("RasEnumEntries failed: Error %d\n", nRet);
}
else
{
for(i=0;i < cEntries;i++)
{
wcstombs( nstring,lprasentryname->szEntryName,100);
Write(nstring,strlen(nstring));
memset(nstring,0,100);
lprasentryname++;
}
}
}
void WINAPI RasDialFunc(UINT nmsg,RASCONNSTATE st,DWORD dwError)
{
wprintf(nmsg,"MSG");
}
HRASCONN hs=NULL;
RASDIALPARAMS RasDialParams;
RasDialParams.dwSize=sizeof(RasDialParams);
lstrcpy(RasDialParams.szEntryName,L"tdwap");
lstrcpy(RasDialParams.szPhoneNumber,L"");
lstrcpy(RasDialParams.szUserName,L"");
lstrcpy(RasDialParams.szPassword,L"");
lstrcpy(RasDialParams.szCallbackNumber,L"");
DWORD dwret=RasDial(NULL,NULL,&RasDialParams,0xFFFFFFFF,RasDialFunc,&hs);
wprintf(dwret,"RasDial");
while(1)
{
Sleep(1000);
}