// Active user phonebook viewer with decrypted passwords :-)
// (c) DZh, one of last day of 1998 year
// Fixed by Alexei Duzhiy, now works on Windows NT4SP6a
// and supports Russian language, script dump added
#include "stdafx.h"
#pragma comment(lib, "rasapi32")
#define MAX_ENTRIES 100
void main(void)
{
LPRASENTRYNAME EntryArray = new (RASENTRYNAME[MAX_ENTRIES]);
DWORD lpcb = sizeof(RASENTRYNAME)*MAX_ENTRIES;
DWORD lpcEntries;
DWORD i, e;
int lpfPassword;
RASDIALPARAMS DialEntry;
RASENTRY *EntryParam;
DWORD dwEntryInfoSize = 0;
char buf[1024];
printf("Active phonebook:\n");
printf("Entry : CountryCode,AreaCode,Phone : Login/Pass\n");
EntryArray[0].dwSize = sizeof(RASENTRYNAME);
RasGetEntryProperties(NULL, NULL,
NULL, &dwEntryInfoSize, NULL, NULL);
EntryParam = (RASENTRY*)malloc(dwEntryInfoSize);
if( (e = RasEnumEntries( NULL, NULL, EntryArray, &lpcb,
&lpcEntries)) == 0 )
for(i=0;i < lpcEntries;i++)
{
strcpy(DialEntry.szEntryName, EntryArray[i].szEntryName);
DialEntry.dwSize = sizeof(RASDIALPARAMS);
RasGetEntryDialParams(NULL, &DialEntry, &lpfPassword );
EntryParam->dwSize = dwEntryInfoSize;
RasGetEntryProperties(NULL, DialEntry.szEntryName,
EntryParam, &dwEntryInfoSize, NULL, NULL);
CharToOem(DialEntry.szEntryName,DialEntry.szEntryName);
CharToOem(DialEntry.szUserName,DialEntry.szUserName);
CharToOem(DialEntry.szPassword,DialEntry.szPassword);
printf("%s : %u,%s,%s : %s/%s\n", DialEntry.szEntryName,
EntryParam->dwCountryCode,
EntryParam->szAreaCode,
EntryParam->szLocalPhoneNumber,
DialEntry.szUserName,
lpfPassword==1?DialEntry.szPassword:"no_password");
if (strcmp(EntryParam->szScript,""))
{
printf("Script:%s\n",EntryParam->szScript);
FILE *fs = fopen(EntryParam->szScript,"rb");
while(!feof(fs)&&(fgets(buf,sizeof(buf),fs))) printf("%s",buf);
fclose(fs);
printf("\n\n");
}
}
else
printf("RasEnumEntries error? Code:%d\n", e);
free(EntryParam);
}