#include <ras.h>
#define DIAL_MODIFIER_LEN 256
#define MAX_CFG_BLOB 126
#define MAX_NAME_LENGTH 8
typedef struct tagDEVMINICFG
{
WORD wVersion;
WORD wWaitBong; // DevCfgHdr
DWORD dwCallSetupFailTimer; // CommConfig.ModemSettings
DWORD dwModemOptions; // CommConfig.ModemSettings
DWORD dwBaudRate; // DCB
WORD fwOptions; // DevCfgHdr
BYTE ByteSize; // DCB
BYTE StopBits; // DCB
BYTE Parity; // DCB
WCHAR szDialModifier[DIAL_MODIFIER_LEN+1]; // Unique to MiniCfg
// Dynamic devices configuration
WCHAR wszDriverName[MAX_NAME_LENGTH+1];
BYTE pConfigBlob[MAX_CFG_BLOB];
HANDLE hPort;
} DEVMINICFG, *PDEVMINICFG;
DWORD CreateRasEntry()
{
RASENTRY EntryInfo;
memset(&EntryInfo, 0, sizeof(RASENTRY));
EntryInfo.dwSize=sizeof(RASENTRY);
DWORD dwSize = sizeof(DEVMINICFG);
DEVMINICFG *lpCfg = new DEVMINICFG;
if(RasGetEntryProperties(NULL, TEXT("3gnet"), &EntryInfo, &EntryInfo.dwSize, (BYTE *)lpCfg, &dwSize) == ERROR_SUCCESS)
return RasSetEntryProperties(NULL, TEXT("liulixiang"), &EntryInfo, EntryInfo.dwSize, (BYTE *)lpCfg, dwSize);
}