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.

159 lines
4.1 KiB

  1. #ifndef __InternetThread_h__
  2. #define __InternetThread_h__
  3. #include "ATKinternet.h"
  4. //#include <tchar.h>
  5. // CInternetThread Class...manages worker thread which POSTS to
  6. // Register.msn.com.
  7. //
  8. class CInternetThread
  9. {
  10. public:
  11. // Construction
  12. //
  13. CInternetThread();
  14. ~CInternetThread();
  15. // Re-initialized Internet functions. Used after changing access type.
  16. //
  17. void ResetSession();
  18. // Manage Buffer where HTML text is placed.
  19. //
  20. LPCSTR GetBuffer() { return m_strBuffer; }
  21. void SetBuffer(LPSTR strBuffer);
  22. void SetBuffer(LPSTR strBuffer, DWORD dwLen);
  23. DWORD PostData(HWND hWnd);
  24. void Initialize(HINSTANCE hIns)
  25. {
  26. m_hInstance = hIns;
  27. m_strIISServer = new TCHAR[256];
  28. m_strPath = new TCHAR[256];
  29. m_UserName = new TCHAR[256];
  30. m_Password = new TCHAR[256];
  31. m_bPostWithSSL = TRUE;
  32. LoadString(m_hInstance, IDS_HTTP_SERVER,
  33. m_strIISServer, 255);
  34. LoadString(m_hInstance, IDS_HTTP_SERVER_PATH,
  35. m_strPath, 255);
  36. LoadString(m_hInstance, IDS_HTTP_USERNAME,
  37. m_UserName, 255);
  38. LoadString(m_hInstance, IDS_HTTP_PASSWORD,
  39. m_Password, 255);
  40. }
  41. //
  42. //
  43. void SetHInstance ( HINSTANCE hIns)
  44. {
  45. m_hInstance = hIns;
  46. //Initialize(hIns);
  47. }
  48. HINSTANCE GetHInstance ()
  49. {
  50. return m_hInstance;
  51. }
  52. // Proxy Server name.
  53. //
  54. BOOL GetSystemProxyServer( PCHAR szProxy,
  55. DWORD dwBufferLength,
  56. int *ipProxyPort);
  57. // This gets proxy using ICW call
  58. LPCTSTR GetProxyServer() { return m_strProxyServer; }
  59. void SetProxyServer(LPSTR strProxyServer, int iProxyPort);
  60. void GetSystemProxySettings( PCHAR szProxy,
  61. DWORD dwBufferLength);
  62. void SetSystemProxySettings( PCHAR szProxy );
  63. // HTTP Server name.
  64. //
  65. LPCTSTR GetIISServer() { return m_strIISServer; }
  66. void SetIISServer(LPTSTR strIISServer);
  67. // HTTP Server Path
  68. //
  69. LPCTSTR GetServerPath() { return m_strPath; }
  70. void SetServerPath(LPTSTR strPath);
  71. void SetSSLFlag(BOOL bFlag) { m_bPostWithSSL = bFlag;}
  72. // POST the Data in m_strBuffer into
  73. //
  74. //DWORD PostData(HWND hWnd);
  75. // Access Type: **** At present Not used ***
  76. //
  77. //int GetAccessTypeIndex();
  78. //void SetAccessTypeIndex(int index);
  79. //
  80. // General ICW DLL loading related functions
  81. HINSTANCE LoadInetCfgDll();
  82. BOOL InstallModem(HWND hwnd);
  83. void UnLoadInetCfgDll();
  84. //private:
  85. // Worker thread calls _PostDataWorker.
  86. static UINT PostDataThread(LPVOID pvThread) ;
  87. // This is where the actually work is done.
  88. UINT _PostDataWorker(HWND hWnd);
  89. UINT GetBackEndResult(HINTERNET hConnect);
  90. LPTSTR m_strIISServer;
  91. LPTSTR m_strPath;
  92. LPTSTR m_strProxyServer;
  93. DWORD m_dwAccessType;
  94. BOOL m_bPostWithSSL;
  95. LPSTR m_strBuffer; // Buffer to be POSTed to Register.msn.com
  96. DWORD m_dwBufferLen; // Buffer Len
  97. HINSTANCE m_hInstance;
  98. HINTERNET m_hSession;
  99. LPTSTR m_UserName;
  100. LPTSTR m_Password;
  101. HINSTANCE m_hICWDllInstance;
  102. };
  103. // Working Thread which does all the actually internet work.
  104. //
  105. UINT PostDataThread(LPVOID pvThreadData);
  106. #endif
  107. // How to use this class
  108. //
  109. //
  110. ////////// Check if connectivity to a an IIS exists //////////////////////
  111. // i) Call CInternetThread.SetProxyServer(szProxy) to set the Proxy if any exists.
  112. // ii) Call CInternetThread.SetIISServer(szIISServer) to set the IP Address (URL)
  113. // of the Internet Server.
  114. // iii)Call CInternetThread.InternetConnectivityExists() which will return TRUE
  115. // if connectivity to the ISS server (szIISServer in 1) exists, else FALSE.
  116. //
  117. //
  118. ///////// Perform an HTTP Post to an IIS ////////////////////////////////
  119. // i) Call CInternetThread.SetProxyServer(szProxy) to set the Proxy if any exists.
  120. // ii) Call CInternetThread.SetIISServer(szIISServer) to set the IP Address (URL)
  121. // of the Internet Server.
  122. // iii)Call CInternetThread.InternetConnectivityExists() which will return TRUE
  123. // if connectivity to the ISS (szIISServer in 1) exists, else FALSE.
  124. // iv) Call CInternetThread.SetBuffer(szBuffer) to set the Data that has to be
  125. // POSTed of the Internet Server.
  126. // v) Call CInternetThread.PostData() which will return TRUE, if the Data has been
  127. // POSTed successfully to the IIS.
  128. //
  129. //