#ifndef _RASHELP_H_ #define _RASHELP_H_ #include #include #include #include typedef enum { ENUM_NONE, ENUM_MULTIBYTE, // Win9x ENUM_UNICODE, // NT4 ENUM_WIN2K // Win2K } ENUM_TYPE; ///////////////////////////////////////////////////////////////////////////////////// class GetOSVersion { protected: static ENUM_TYPE _EnumType; public: GetOSVersion(); ~GetOSVersion(); }; ///////////////////////////////////////////////////////////////////////////////////// class RasEnumHelp : public GetOSVersion { private: // // Win2k version of RASENTRYNAMEW struct // // match RAS packing so structs match #include #define W2KRASENTRYNAMEW struct tagW2KRASENTRYNAMEW W2KRASENTRYNAMEW { DWORD dwSize; WCHAR szEntryName[ RAS_MaxEntryName + 1 ]; DWORD dwFlags; WCHAR szPhonebookPath[MAX_PATH + 1]; }; #define LPW2KRASENTRYNAMEW W2KRASENTRYNAMEW* #include // // Any error we got during enumeration // DWORD _dwLastError; // // Number of entries we got // DWORD _dwEntries; // // Pointer to info retrieved from RAS // RASENTRYNAMEA * _preList; // // Last entry returned as multibyte or unicode when conversion required // CHAR _szCurrentEntryA[RAS_MaxEntryName + 1]; WCHAR _szCurrentEntryW[RAS_MaxEntryName + 1]; public: RasEnumHelp(); ~RasEnumHelp(); DWORD GetError(); DWORD GetEntryCount(); LPSTR GetEntryA(DWORD dwEntry); LPWSTR GetEntryW(DWORD dwEntry); }; ///////////////////////////////////////////////////////////////////////////////////// class RasEnumConnHelp : public GetOSVersion { private: // match RAS packing so structs match #include #define W2KRASCONNW struct tagW2KRASCONNW W2KRASCONNW { DWORD dwSize; HRASCONN hrasconn; WCHAR szEntryName[ RAS_MaxEntryName + 1 ]; //#if (WINVER >= 0x400) WCHAR szDeviceType[ RAS_MaxDeviceType + 1 ]; WCHAR szDeviceName[ RAS_MaxDeviceName + 1 ]; //#endif //#if (WINVER >= 0x401) WCHAR szPhonebook [ MAX_PATH ]; DWORD dwSubEntry; //#endif //#if (WINVER >= 0x500) GUID guidEntry; //#endif }; #define LPW2KRASCONNW W2KRASCONNW* #include DWORD _dwLastError; // Any error we got during enumeration DWORD _dwConnections; // Number of connections DWORD _dwStructSize; RASCONNA *_pRasCon; // Last entry returned as multibyte or unicode when conversion required WCHAR _szEntryNameW[ RAS_MaxEntryName + 1 ]; // WCHAR _szDeviceTypeW[ RAS_MaxDeviceType + 1 ]; // WCHAR _szDeviceNameW[ RAS_MaxDeviceName + 1 ]; // WCHAR _szPhonebookW[ MAX_PATH ]; CHAR _szEntryNameA[ RAS_MaxEntryName + 1 ]; // CHAR _szDeviceTypeA[ RAS_MaxDeviceType + 1 ]; // CHAR _szDeviceNameA[ RAS_MaxDeviceName + 1 ]; // CHAR _szPhonebookA[ MAX_PATH ]; public: RasEnumConnHelp(); ~RasEnumConnHelp(); DWORD Enum(); DWORD GetError(); DWORD GetConnectionsCount(); LPWSTR GetEntryW(DWORD dwConnectionNum); LPSTR GetEntryA(DWORD dwConnectionNum); LPWSTR GetLastEntryW(DWORD dwConnectionNum); LPSTR GetLastEntryA(DWORD dwConnectionNum); HRASCONN GetHandle(DWORD dwConnectionNum); }; ///////////////////////////////////////////////////////////////////////////////////// class RasEntryPropHelp : public GetOSVersion { private: // match RAS packing so structs match #include #define W2KRASENTRYW struct tagW2KRASENTRYW W2KRASENTRYW { DWORD dwSize; DWORD dwfOptions; // // Location/phone number // DWORD dwCountryID; DWORD dwCountryCode; WCHAR szAreaCode[ RAS_MaxAreaCode + 1 ]; WCHAR szLocalPhoneNumber[ RAS_MaxPhoneNumber + 1 ]; DWORD dwAlternateOffset; // // PPP/Ip // RASIPADDR ipaddr; RASIPADDR ipaddrDns; RASIPADDR ipaddrDnsAlt; RASIPADDR ipaddrWins; RASIPADDR ipaddrWinsAlt; // // Framing // DWORD dwFrameSize; DWORD dwfNetProtocols; DWORD dwFramingProtocol; // // Scripting // WCHAR szScript[ MAX_PATH ]; // // AutoDial // WCHAR szAutodialDll[ MAX_PATH ]; WCHAR szAutodialFunc[ MAX_PATH ]; // // Device // WCHAR szDeviceType[ RAS_MaxDeviceType + 1 ]; WCHAR szDeviceName[ RAS_MaxDeviceName + 1 ]; // // X.25 // WCHAR szX25PadType[ RAS_MaxPadType + 1 ]; WCHAR szX25Address[ RAS_MaxX25Address + 1 ]; WCHAR szX25Facilities[ RAS_MaxFacilities + 1 ]; WCHAR szX25UserData[ RAS_MaxUserData + 1 ]; DWORD dwChannels; // // Reserved // DWORD dwReserved1; DWORD dwReserved2; //#if (WINVER >= 0x401) // // Multilink // DWORD dwSubEntries; DWORD dwDialMode; DWORD dwDialExtraPercent; DWORD dwDialExtraSampleSeconds; DWORD dwHangUpExtraPercent; DWORD dwHangUpExtraSampleSeconds; // // Idle timeout // DWORD dwIdleDisconnectSeconds; //#endif //#if (WINVER >= 0x500) // // Entry Type // DWORD dwType; // // EncryptionType // DWORD dwEncryptionType; // // CustomAuthKey to be used for EAP // DWORD dwCustomAuthKey; // // Guid of the connection // GUID guidId; // // Custom Dial Dll // WCHAR szCustomDialDll[MAX_PATH]; // // Vpn Strategy // DWORD dwVpnStrategy; //#endif }; #define LPW2KRASENTRYW W2KRASENTRYW* #include DWORD _dwStructSize; DWORD _dwLastError; // Any error we got during enumeration RASENTRYA *_pRasEntry; // Last entry returned as multibyte or unicode when conversion required WCHAR _szEntryNameW[ RAS_MaxEntryName + 1 ]; WCHAR _szDeviceTypeW[ RAS_MaxDeviceType + 1 ]; WCHAR _szAutodialDllW[ MAX_PATH ]; WCHAR _szAutodialFuncW[ MAX_PATH ]; WCHAR _szCustomDialDllW[ MAX_PATH ]; WCHAR _szPhoneNumberW[ RAS_MaxPhoneNumber + 1 ]; WCHAR _szAreaCodeW[ RAS_MaxAreaCode + 1 ]; CHAR _szEntryNameA[ RAS_MaxEntryName + 1 ]; CHAR _szDeviceTypeA[ RAS_MaxDeviceType + 1 ]; CHAR _szAutodialDllA[ MAX_PATH ]; CHAR _szAutodialFuncA[ MAX_PATH ]; public: RasEntryPropHelp(); ~RasEntryPropHelp(); DWORD GetError(); DWORD GetA(LPSTR lpszEntryName); DWORD GetW(LPWSTR lpszEntryName); LPWSTR GetDeviceTypeW(VOID); LPSTR GetDeviceTypeA(VOID); LPWSTR GetAutodiallDllW(); LPSTR GetAutodiallDllA(); LPWSTR GetAutodialFuncW(); LPSTR GetAutodialFuncA(); LPWSTR GetCustomDialDllW(); LPWSTR GetPhoneNumberW(); DWORD GetCountryCode(); DWORD GetOptions(); LPWSTR GetAreaCodeW(); }; ///////////////////////////////////////////////////////////////////////////////////// class RasGetConnectStatusHelp : public GetOSVersion { private: DWORD _dwLastError; // Any error we got during enumeration DWORD _dwStructSize; RASCONNSTATUSA *_pRasConnStatus; public: RasGetConnectStatusHelp(HRASCONN hrasconn); ~RasGetConnectStatusHelp(); DWORD GetError(); RASCONNSTATE ConnState(); }; ///////////////////////////////////////////////////////////////////////////////////// #endif // _RASHELP_H_