Leaked source code of windows server 2003
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.

249 lines
9.3 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. // Dialing service members
  122. UINT m_unRasDialMsg;
  123. DWORD m_dwTapiDev;
  124. HRASCONN m_hrasconn;
  125. WCHAR m_szConnectoid[RAS_MaxEntryName+1];
  126. DWORD m_dwThreadID;
  127. HINSTANCE m_hRasDll;
  128. FARPROC m_fpRasDial;
  129. FARPROC m_fpRasGetEntryDialParams;
  130. LPGATHERINFO m_pGI;
  131. WCHAR m_szUrl[INTERNET_MAX_URL_LENGTH]; // Download thread
  132. HANDLE m_hThread;
  133. HANDLE m_hDialThread;
  134. HANDLE m_hConnMonThread;
  135. HANDLE m_hConnectionTerminate;
  136. HANDLE m_hEventError;
  137. DWORD_PTR m_dwDownLoad; // Download thread
  138. HLINEAPP m_hLineApp;
  139. DWORD m_dwAPIVersion;
  140. LPWSTR m_pszDisplayable;
  141. LPWSTR m_pszOriginalDisplayable;
  142. RNAAPI *m_pcRNA;
  143. WCHAR m_szPhoneNumber[256];
  144. BOOL m_bDialAsIs;
  145. BOOL m_bDialCustom;
  146. UINT m_uiRetry;
  147. WCHAR m_szISPFile[MAX_PATH];
  148. WCHAR m_szCurrentDUNFile[MAX_PATH];
  149. WCHAR m_szLastDUNFile[MAX_PATH];
  150. WCHAR m_szEntryName[RAS_MaxEntryName+1];
  151. WCHAR m_szISPSupportNumber[RAS_MaxAreaCode + RAS_MaxPhoneNumber +1];
  152. BOOL m_bDownloadHasBeenCanceled;
  153. BOOL m_bDisconnect;
  154. BOOL m_bFromPhoneBook;
  155. BOOL m_bDialAlternative;
  156. LPGATHERINFO m_lpGatherInfo;
  157. //
  158. // Used for Phone book look-up
  159. //
  160. SUGGESTINFO m_SuggestInfo;
  161. CISPImport m_ISPImport; // Import an ISP file
  162. CINSHandler m_InsHandler;
  163. int m_RasStatusID;
  164. int m_DownloadStatusID;
  165. WCHAR m_szRefServerURL[INTERNET_MAX_URL_LENGTH];
  166. WCHAR m_szRegServerName[INTERNET_MAX_URL_LENGTH];
  167. INTERNET_PORT m_nRegServerPort;
  168. BOOL m_fSecureRegServer;
  169. WCHAR m_szRegFormAction[INTERNET_MAX_URL_LENGTH];
  170. LPRASENTRY m_reflpRasEntryBuff;
  171. LPRASDEVINFO m_reflpRasDevInfoBuff;
  172. DWORD m_dwRASErr;
  173. DWORD m_dwCnType;
  174. WCHAR* m_pszISPList;
  175. DWORD m_dwNumOfAutoConfigOffers;
  176. ISPLIST* m_pCSVList;
  177. BOOL m_bUserInitiateHangup;
  178. UINT m_unSelectedISP;
  179. protected:
  180. CRITICAL_SECTION m_csMyCriticalSection;
  181. BOOL m_bTryAgain;
  182. BOOL m_bQuitWizard;
  183. BOOL m_bUserPickNumber;
  184. BOOL m_bRedial;
  185. HRESULT m_hrDisplayableNumber;
  186. BSTR m_bstrPromoCode;
  187. BSTR m_bstrProductCode;
  188. WCHAR m_szOEM[MAX_OEMNAME];
  189. BSTR m_bstrSignedPID;
  190. BSTR m_bstrSupportNumber;
  191. BSTR m_bstrLoggingStartUrl;
  192. BSTR m_bstrLoggingEndUrl;
  193. long m_lAllOffers;
  194. DWORD m_dwCountryCode;
  195. long m_lBrandingFlags;
  196. long m_lCurrentModem;
  197. // Version of the wizard HTML. Sent to RefServer
  198. DWORD m_dwWizardVersion;
  199. WCHAR m_szPID[(MAX_DIGITAL_PID * 2) + 1];
  200. long m_PhoneNumberEnumidx;
  201. private:
  202. BOOL IsDBCSString( CHAR *sz );
  203. void GetISPFileSettings(LPWSTR lpszFile);
  204. BOOL m_bModemOverride;
  205. DWORD m_dwConnectionType;
  206. DWORD m_dwAppMode;
  207. DWORD m_bDial;
  208. CISPCSV* m_pSelectedISPInfo;
  209. CICWISPData* m_pISPData;
  210. // CObCommunicationManager* m_pCommMgr;
  211. };
  212. #endif //__REFDIAL_H_