Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

253 lines
9.2 KiB

  1. // RefDial.h : Declaration of the CRefDial
  2. #ifndef __REFDIAL_H_
  3. #define __REFDIAL_H_
  4. #include "rnaapi.h"
  5. #include "import.h"
  6. #include "inshdlr.h"
  7. #include "obcomglb.h"
  8. #include "ispcsv.h"
  9. #include "ispdata.h"
  10. // Defines used for Dialing
  11. #define MAX_EXIT_RETRIES 10
  12. #define MAX_RETIES 3
  13. #define MAX_RASENTRYNAME 126
  14. #define MAX_STRING 256 //used by ErrorMsg1 in mt.cpp
  15. #define MAX_VERSION_LEN 40
  16. #define szLoginKey L"Software\\Microsoft\\MOS\\Connection"
  17. #define szCurrentComDev L"CurrentCommDev"
  18. #define szTollFree L"OlRegPhone"
  19. #define CCD_BUFFER_SIZE 255
  20. #define szSignupConnectoidName L"MSN Signup Connection"
  21. #define szSignupDeviceKey L"SignupCommDevice"
  22. #define KEYVALUE_SIGNUPID L"iSignUp"
  23. #define RASENTRYVALUENAME L"RasEntryName"
  24. #define GATHERINFOVALUENAME L"UserInfo"
  25. #define INFFILE_USER_SECTION L"User"
  26. #define INFFILE_PASSWORD L"Password"
  27. #define NULLSZ L""
  28. typedef DWORD (WINAPI *PFNRASGETCONNECTSTATUS)(HRASCONN, LPRASCONNSTATUS);
  29. static const WCHAR cszBrandingSection[] = L"Branding";
  30. static const WCHAR cszBrandingFlags[] = L"Flags";
  31. static const WCHAR cszSupportSection[] = L"Support";
  32. static const WCHAR cszSupportNumber[] = L"SupportPhoneNumber";
  33. static const WCHAR cszLoggingSection[] = L"Logging";
  34. static const WCHAR cszStartURL[] = L"StartURL";
  35. static const WCHAR cszEndURL[] = L"EndURL";
  36. typedef struct ISPLIST
  37. {
  38. void* pElement;
  39. int uElem;
  40. ISPLIST* pNext;
  41. } ISPLIST;
  42. class RNAAPI;
  43. class CISPImport;
  44. class CObCommunicationManager;
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CRefDial
  47. class CRefDial
  48. {
  49. public:
  50. CRefDial();
  51. CRefDial::~CRefDial();
  52. friend DWORD WINAPI DownloadThreadInit(LPVOID lpv);
  53. public:
  54. virtual HRESULT SetupForDialing(UINT nType, BSTR bstrISPFile, DWORD dwCountry, BSTR bstrAreaCode, DWORD dwFlag, DWORD dwAppMode, DWORD dwMigISPIdx, LPCWSTR szRasDeviceName);
  55. virtual HRESULT DoConnect(BOOL *pbRetVal) ;
  56. virtual HRESULT DoHangup() ;
  57. virtual HRESULT GetDialPhoneNumber(BSTR *pVal);
  58. virtual HRESULT PutDialPhoneNumber(BSTR newVal);
  59. virtual HRESULT SetDialAlternative(BOOL bVal);
  60. virtual HRESULT GetDialErrorMsg(BSTR *pVal);
  61. virtual HRESULT GetSupportNumber(BSTR *pVal);
  62. virtual HRESULT RemoveConnectoid(BOOL *pbRetVal);
  63. virtual HRESULT ReadPhoneBook(LPGATHERINFO lpGatherInfo, PSUGGESTINFO pSuggestInfo);
  64. virtual HRESULT get_SignupURL(BSTR * pVal);
  65. virtual HRESULT get_ReconnectURL(BSTR * pVal);
  66. virtual HRESULT CheckPhoneBook(BSTR bstrISPFile, DWORD dwCountry, BSTR bstrAreaCode, DWORD dwFlag, BOOL *pbRetVal);
  67. virtual HRESULT GetConnectionType(DWORD * pdwVal);
  68. virtual HRESULT DoOfferDownload(BOOL *pbRetVal);
  69. virtual HRESULT FormReferralServerURL(BOOL * pbRetVal);
  70. virtual HRESULT OnDownloadEvent(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL* bHandled);
  71. virtual HRESULT GetISPList(BSTR* pbstrISPList);
  72. virtual HRESULT Set_SelectISP(UINT nVal);
  73. virtual HRESULT Set_ConnectionMode(UINT nVal);
  74. virtual HRESULT Get_ConnectionMode(UINT *pnVal);
  75. virtual HRESULT DownloadISPOffer(BOOL *pbVal, BSTR *pVal);
  76. virtual HRESULT ProcessSignedPID(BOOL * pbRetVal);
  77. virtual HRESULT get_SignedPID(BSTR * pVal);
  78. virtual HRESULT get_ISDNAutoConfigURL(BSTR *pVal);
  79. virtual HRESULT get_AutoConfigURL(BSTR *pVal);
  80. virtual HRESULT get_ISPName(BSTR *pVal);
  81. virtual HRESULT RemoveDownloadDir() ;
  82. virtual HRESULT PostRegData(DWORD dwSrvType, LPWSTR szPath);
  83. virtual HRESULT CheckStayConnected(BSTR bstrISPFile, BOOL *pbVal);
  84. virtual HRESULT Connect(UINT nType, BSTR bstrISPFile, DWORD dwCountry, BSTR bstrAreaCode, DWORD dwFlag, DWORD dwAppMode);
  85. virtual HRESULT CheckOnlineStatus(BOOL *pbVal);
  86. virtual HRESULT GetPhoneBookNumber(BSTR *pVal);
  87. BOOL CrackUrl(const WCHAR* lpszUrlIn, WCHAR* lpszHostOut, WCHAR* lpszActionOut, INTERNET_PORT* lpnHostPort, BOOL* lpfSecure);
  88. BOOL ParseISPInfo(HWND hDlg, WCHAR *pszCSVFileName, BOOL bCheckDupe);
  89. // Dialing service functions
  90. HRESULT GetDisplayableNumber();
  91. HRESULT Dial();
  92. BOOL FShouldRetry(HRESULT hrErr);
  93. DWORD ReadConnectionInformation(void);
  94. DWORD FillGatherInfoStruct(LPGATHERINFO lpGatherInfo);
  95. HRESULT CreateEntryFromDUNFile(LPWSTR pszDunFile);
  96. HRESULT SetupForRASDialing(LPGATHERINFO lpGatherInfo,
  97. HINSTANCE hPHBKDll,
  98. LPDWORD lpdwPhoneBook,
  99. PSUGGESTINFO pSuggestInfo,
  100. WCHAR *pszConnectoid,
  101. BOOL FAR *bConnectiodCreated);
  102. HRESULT SetupConnectoid(PSUGGESTINFO pSuggestInfo, int irc,
  103. WCHAR *pszConnectoid, DWORD dwSize, BOOL * pbSuccess);
  104. HRESULT MyRasGetEntryProperties(LPWSTR lpszPhonebookFile,
  105. LPWSTR lpszPhonebookEntry,
  106. LPRASENTRY *lplpRasEntryBuff,
  107. LPDWORD lpdwRasEntryBuffSize,
  108. LPRASDEVINFO *lplpRasDevInfoBuff,
  109. LPDWORD lpdwRasDevInfoBuffSize);
  110. static void CALLBACK RasDialFunc( HRASCONN hRas, UINT unMsg,
  111. RASCONNSTATE rasconnstate,
  112. DWORD dwError,
  113. DWORD dwErrorEx);
  114. BOOL get_QueryString(WCHAR* szTemp, DWORD dwSize);
  115. DWORD DialThreadInit(LPVOID pdata);
  116. DWORD ConnectionMonitorThread(LPVOID pdata);
  117. void TerminateConnMonitorThread();
  118. HRESULT RasGetConnectStatus(BOOL *pVal);
  119. void CleanISPList();
  120. void DeleteDirectory(LPCWSTR szDirName);
  121. HRESULT SetupForAutoDial(BOOL bEnabled, BSTR bstrUserSection);
  122. // Dialing service members
  123. UINT m_unRasDialMsg;
  124. DWORD m_dwTapiDev;
  125. HRASCONN m_hrasconn;
  126. WCHAR m_szConnectoid[RAS_MaxEntryName+1];
  127. DWORD m_dwThreadID;
  128. HINSTANCE m_hRasDll;
  129. FARPROC m_fpRasDial;
  130. FARPROC m_fpRasGetEntryDialParams;
  131. LPGATHERINFO m_pGI;
  132. WCHAR m_szUrl[INTERNET_MAX_URL_LENGTH]; // Download thread
  133. HANDLE m_hThread;
  134. HANDLE m_hDialThread;
  135. HANDLE m_hConnMonThread;
  136. HANDLE m_hConnectionTerminate;
  137. HANDLE m_hEventError;
  138. DWORD_PTR m_dwDownLoad; // Download thread
  139. HLINEAPP m_hLineApp;
  140. DWORD m_dwAPIVersion;
  141. LPWSTR m_pszDisplayable;
  142. LPWSTR m_pszOriginalDisplayable;
  143. RNAAPI *m_pcRNA;
  144. WCHAR m_szPhoneNumber[256];
  145. BOOL m_bDialAsIs;
  146. BOOL m_bDialCustom;
  147. UINT m_uiRetry;
  148. WCHAR m_szISPFile[MAX_PATH];
  149. WCHAR m_szCurrentDUNFile[MAX_PATH];
  150. WCHAR m_szLastDUNFile[MAX_PATH];
  151. WCHAR m_szEntryName[RAS_MaxEntryName+1];
  152. WCHAR m_szISPSupportNumber[RAS_MaxAreaCode + RAS_MaxPhoneNumber +1];
  153. BOOL m_bDownloadHasBeenCanceled;
  154. BOOL m_bDisconnect;
  155. BOOL m_bFromPhoneBook;
  156. BOOL m_bDialAlternative;
  157. LPGATHERINFO m_lpGatherInfo;
  158. //
  159. // Used for Phone book look-up
  160. //
  161. SUGGESTINFO m_SuggestInfo;
  162. CISPImport m_ISPImport; // Import an ISP file
  163. CINSHandler m_InsHandler;
  164. int m_RasStatusID;
  165. int m_DownloadStatusID;
  166. WCHAR m_szRefServerURL[INTERNET_MAX_URL_LENGTH];
  167. WCHAR m_szRegServerName[INTERNET_MAX_URL_LENGTH];
  168. INTERNET_PORT m_nRegServerPort;
  169. BOOL m_fSecureRegServer;
  170. WCHAR m_szRegFormAction[INTERNET_MAX_URL_LENGTH];
  171. LPRASENTRY m_reflpRasEntryBuff;
  172. LPRASDEVINFO m_reflpRasDevInfoBuff;
  173. DWORD m_dwRASErr;
  174. DWORD m_dwCnType;
  175. WCHAR* m_pszISPList;
  176. DWORD m_dwNumOfAutoConfigOffers;
  177. ISPLIST* m_pCSVList;
  178. BOOL m_bUserInitiateHangup;
  179. UINT m_unSelectedISP;
  180. protected:
  181. CRITICAL_SECTION m_csMyCriticalSection;
  182. BOOL m_bTryAgain;
  183. BOOL m_bQuitWizard;
  184. BOOL m_bUserPickNumber;
  185. BOOL m_bRedial;
  186. HRESULT m_hrDisplayableNumber;
  187. BSTR m_bstrPromoCode;
  188. BSTR m_bstrProductCode;
  189. WCHAR m_szOEM[MAX_OEMNAME];
  190. BSTR m_bstrSignedPID;
  191. BSTR m_bstrSupportNumber;
  192. BSTR m_bstrLoggingStartUrl;
  193. BSTR m_bstrLoggingEndUrl;
  194. long m_lAllOffers;
  195. DWORD m_dwCountryCode;
  196. long m_lBrandingFlags;
  197. long m_lCurrentModem;
  198. // Version of the wizard HTML. Sent to RefServer
  199. DWORD m_dwWizardVersion;
  200. WCHAR m_szPID[(MAX_DIGITAL_PID * 2) + 1];
  201. long m_PhoneNumberEnumidx;
  202. private:
  203. BOOL IsDBCSString( CHAR *sz );
  204. void GetISPFileSettings(LPWSTR lpszFile);
  205. void CleanupAutodial();
  206. BOOL m_bModemOverride;
  207. DWORD m_dwConnectionType;
  208. DWORD m_dwAppMode;
  209. DWORD m_bDial;
  210. CISPCSV* m_pSelectedISPInfo;
  211. CICWISPData* m_pISPData;
  212. BOOL m_bAutodialModeSaved;
  213. BOOL m_bCleanupAutodial;
  214. DWORD m_dwOrigAutodialMode;
  215. };
  216. #endif //__REFDIAL_H_