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.

233 lines
9.6 KiB

  1. /*-----------------------------------------------------------------------------
  2. INSHandler.h
  3. Declaration of CINSHandler - INS file processing
  4. Copyright (C) 1999 Microsoft Corporation
  5. All rights reserved.
  6. Authors:
  7. vyung
  8. History:
  9. 2/7/99 Vyung created - code borrowed from ICW, icwhelp.dll
  10. -----------------------------------------------------------------------------*/
  11. #ifndef __INSHANDLER_H_
  12. #define __INSHANDLER_H_
  13. #include "obcomglb.h"
  14. #include "inets.h"
  15. #include <ras.h>
  16. // Default branding flags the we will support
  17. #define BRAND_FAVORITES 1
  18. #define BRAND_STARTSEARCH 2
  19. #define BRAND_TITLE 4
  20. #define BRAND_BITMAPS 8
  21. #define BRAND_MAIL 16
  22. #define BRAND_NEWS 32
  23. #define BRAND_DEFAULT (BRAND_FAVORITES | BRAND_STARTSEARCH)
  24. typedef enum
  25. {
  26. CONNECT_LAN = 0,
  27. CONNECT_MANUAL,
  28. CONNECT_RAS
  29. };
  30. typedef struct tagCONNECTINFO
  31. {
  32. DWORD cbSize;
  33. DWORD type;
  34. WCHAR szConnectoid[MAX_PATH];
  35. } CONNECTINFO;
  36. // This struct is used to configure the client
  37. typedef struct
  38. {
  39. LPCWSTR lpszSection;
  40. LPCWSTR lpszValue;
  41. UINT uOffset;
  42. UINT uSize;
  43. } CLIENT_TABLE, FAR *LPCLIENT_TABLE;
  44. typedef struct
  45. {
  46. WCHAR szEntryName[RAS_MaxEntryName+1];
  47. WCHAR szUserName[UNLEN+1];
  48. WCHAR szPassword[PWLEN+1];
  49. WCHAR szScriptFile[MAX_PATH+1];
  50. RASENTRY RasEntry;
  51. } ICONNECTION, FAR * LPICONNECTION;
  52. #define LANDT_1483 L"ethernet_1483"
  53. #define LANDT_Cable L"cable"
  54. #define LANDT_Ethernet L"ethernet"
  55. #define LANDT_Pppoe L"pppoe"
  56. #define LAN_MaxDeviceType (max(max(max(sizeof(LANDT_1483), sizeof(LANDT_Cable)), sizeof(LANDT_Normal))), LANDT_Pppoe)
  57. #define CONN_MaxDeviceType (max(LAN_MaxDeviceType, RAS_MaxDeviceType))
  58. // definitions for the m_dwDeviceType member
  59. static const DWORD InetS_RASModem = 0x1;
  60. static const DWORD InetS_RASIsdn = 0x2;
  61. static const DWORD InetS_RASVpn = 0x4;
  62. static const DWORD InetS_RASAtm = 0x8;
  63. static const DWORD InetS_RAS = InetS_RASModem | InetS_RASIsdn | InetS_RASVpn | InetS_RASAtm;
  64. static const DWORD InetS_LANEthernet = 0x8000;
  65. static const DWORD InetS_LANCable = 0x10000;
  66. static const DWORD InetS_LAN1483 = 0x20000;
  67. static const DWORD InetS_LANPppoe = 0x40000;
  68. static const DWORD InetS_LAN = InetS_LANEthernet | InetS_LANCable | InetS_LAN1483 | InetS_LANPppoe;
  69. typedef DWORD (WINAPI *PFNINETCONFIGCLIENT)(HWND hwndParent, LPCSTR lpszPhoneBook, LPCSTR lpszEntryName, LPRASENTRY lpRasEntry, LPCSTR lpszUserName, LPCSTR lpszPassword, LPCSTR lpszProfile, LPINETCLIENTINFO lpClientInfo, DWORD dwfOptions, LPBOOL lpfNeedsRestart);
  70. typedef DWORD (WINAPI *PFNINETCONFIGCLIENTEX)(HWND hwndParent, LPCSTR lpszPhoneBook, LPCSTR lpszEntryName, LPRASENTRY lpRasEntry, LPCSTR lpszUserName, LPCSTR lpszPassword, LPCSTR lpszProfile, LPINETCLIENTINFO lpClientInfo, DWORD dwfOptions, LPBOOL lpfNeedsRestart, LPSTR szConnectoidName, DWORD dwSizeOfCreatedEntryName);
  71. typedef BOOL (WINAPI *PFNBRANDICW)(LPCSTR pszIns, LPCSTR pszPath, DWORD dwFlags);
  72. typedef BOOL (WINAPI *PFNBRANDICW2)(LPCSTR pszIns, LPCSTR pszPath, DWORD dwFlags, LPCSTR pszConnectoid);
  73. typedef DWORD (WINAPI *PFNRASSETAUTODIALADDRESS)(LPWSTR lpszAddress, DWORD dwReserved, RASAUTODIALENTRY* lpAutoDialEntries, DWORD dwcbAutoDialEntries, DWORD dwcAutoDialEntries);
  74. typedef DWORD (WINAPI *PFNRASSETAUTODIALENABLE)(DWORD dwDialingLocation, BOOL fEnabled);
  75. /////////////////////////////////////////////////////////////////////////////
  76. // CINSHandler
  77. class CINSHandler
  78. {
  79. public:
  80. CINSHandler()
  81. {
  82. m_szRunExecutable [0] = L'\0';
  83. m_szRunArgument [0] = L'\0';
  84. m_szCheckAssociations [0] = L'\0';
  85. m_szAutodialConnection [0] = L'\0';
  86. m_szStartURL [0] = L'\0';
  87. m_fResforeDefCheck = FALSE;
  88. m_fAutodialSaved = TRUE;
  89. m_fAutodialEnabled = FALSE;
  90. m_fProxyEnabled = FALSE;
  91. m_bSilentMode = TRUE;
  92. m_lpfnBrandICW = NULL;
  93. m_lpfnBrandICW2 = NULL;
  94. m_lpfnRasSetAutodialEnable = NULL;
  95. m_lpfnRasSetAutodialAddress = NULL;
  96. m_hInetCfg = NULL;
  97. m_hBranding = NULL;
  98. m_hRAS = NULL;
  99. m_dwBrandFlags = BRAND_DEFAULT;
  100. m_dwDeviceType = 0;
  101. }
  102. ~CINSHandler()
  103. {
  104. if (m_hRAS)
  105. FreeLibrary(m_hRAS);
  106. }
  107. // IINSHandler
  108. public:
  109. STDMETHOD (put_BrandingFlags) (/*[in]*/ long lFlags);
  110. STDMETHOD (put_SilentMode) (/*[in]*/ BOOL bSilent);
  111. STDMETHOD (get_NeedRestart) (/*[out, retval]*/ BOOL *pVal);
  112. STDMETHOD (get_DefaultURL) (/*[out, retval]*/ BSTR *pszURL);
  113. BOOL ProcessOEMBrandINS(BSTR bstrFileName, LPWSTR lpszConnectoidName);
  114. HRESULT MergeINSFiles(LPCWSTR lpszMainFile, LPCWSTR lpszOtherFile, LPWSTR lpszOutputFile, DWORD dwFNameSize);
  115. HRESULT RestoreConnectoidInfo();
  116. private:
  117. HRESULT ProcessINS(LPCWSTR lpszFile, LPWSTR lpszConnectoidName,BOOL *pbRetVal);
  118. BSTR m_bstrINSFileName; //CComBSTR m_bstrINSFileName;
  119. HRESULT MassageFile(LPCWSTR lpszFile);
  120. DWORD RunExecutable(void);
  121. BOOL KeepConnection(LPCWSTR lpszFile);
  122. DWORD ImportCustomInfo(LPCWSTR lpszImportFile, LPWSTR lpszExecutable, DWORD cbExecutable, LPWSTR lpszArgument, DWORD cbArgument);
  123. DWORD ImportFile(LPCWSTR lpszImportFile, LPCWSTR lpszSection, LPCWSTR lpszOutputFile);
  124. DWORD ImportCustomFile(LPCWSTR lpszImportFile);
  125. DWORD ImportBrandingInfo(LPCWSTR lpszFile, LPCWSTR lpszConnectoidName);
  126. // Client Config functions
  127. DWORD ImportCustomDialer(LPRASENTRY lpRasEntry, LPCWSTR szFileName);
  128. LPCWSTR StrToSubip (LPCWSTR szIPAddress, LPBYTE pVal);
  129. DWORD StrToip (LPCWSTR szIPAddress, RASIPADDR *ipAddr);
  130. DWORD ImportPhoneInfo(LPRASENTRY lpRasEntry, LPCWSTR szFileName);
  131. DWORD ImportServerInfo(LPRASENTRY lpRasEntry, LPCWSTR szFileName);
  132. DWORD ImportIPInfo(LPRASENTRY lpRasEntry, LPCWSTR szFileName);
  133. DWORD ImportScriptFile(LPCWSTR lpszImportFile, LPWSTR szScriptFile, UINT cbScriptFile);
  134. DWORD RnaValidateImportEntry (LPCWSTR szFileName);
  135. DWORD ImportRasEntry (LPCWSTR szFileName, LPRASENTRY lpRasEntry, LPBYTE & lpDeviceInfo, LPDWORD lpdwDeviceInfoSize);
  136. DWORD ImportAtmInfo(LPRASENTRY lpRasEntry, LPCWSTR cszFileName, LPBYTE & lpDeviceInfo, LPDWORD lpdwDeviceInfoSize);
  137. DWORD ImportConnection (LPCWSTR szFileName, LPICONNECTION lpConn, LPBYTE & lpDeviceInfo, LPDWORD lpdwDeviceInfoSiz);
  138. DWORD InetSGetConnectionType ( LPCWSTR cszINSFile );
  139. DWORD InetSImportRasConnection ( RASINFO& RasEntry, LPCWSTR cszINSFile );
  140. DWORD InetSImportLanConnection ( LANINFO& LanInfo, LPCWSTR cszINSFile );
  141. DWORD InetSImportRfc1483Connection ( RFC1483INFO &Rfc1483Info, LPCWSTR cszINSFile );
  142. DWORD InetSImportPppoeConnection ( PPPOEINFO &PppoeInfo, LPCWSTR cszINSFile);
  143. DWORD InetSImportAtmModule ( ATMPBCONFIG &AtmInfoMod, LPCWSTR cszINSFile );
  144. DWORD InetSImportTcpIpModule ( TCPIP_INFO_EXT &TcpIpInfoMod, LPCWSTR cszINSFile );
  145. DWORD InetSImportRfc1483Module ( RFC1483_INFO_EXT &Rfc1483InfoMod, LPCWSTR cszINSFile );
  146. DWORD InetSImportPppoeModule (PPPOE_INFO_EXT &PppoeInfoMod, LPCWSTR cszINSFile );
  147. DWORD ImportMailAndNewsInfo(LPCWSTR lpszFile, BOOL fConnectPhone);
  148. HRESULT WriteMailAndNewsKey(HKEY hKey, LPCWSTR lpszSection, LPCWSTR lpszValue, LPWSTR lpszBuff, DWORD dwBuffLen, LPCWSTR lpszSubKey, DWORD dwType, LPCWSTR lpszFile);
  149. BOOL LoadExternalFunctions(void);
  150. DWORD ReadClientInfo(LPCWSTR lpszFile, LPINETCLIENTINFO lpClientInfo, LPCLIENT_TABLE lpClientTable);
  151. BOOL WantsExchangeInstalled(LPCWSTR lpszFile);
  152. BOOL DisplayPassword(LPCWSTR lpszFile);
  153. DWORD ImportClientInfo(LPCWSTR lpszFile, LPINETCLIENTINFO lpClientInfo);
  154. DWORD ConfigureClient(HWND hwnd, LPCWSTR lpszFile, LPBOOL lpfNeedsRestart, LPBOOL lpfConnectoidCreated, BOOL fHookAutodial, LPWSTR szConnectoidName, DWORD dwConnectoidNameSize);
  155. HRESULT PopulateNTAutodialAddress(LPCWSTR pszFileName, LPCWSTR pszEntryName);
  156. LPWSTR MoveToNextAddress(LPWSTR lpsz);
  157. HRESULT PreparePassword(LPWSTR szBuff, DWORD dwBuffLen);
  158. BOOL FIsAthenaPresent();
  159. BOOL FTurnOffBrowserDefaultChecking();
  160. BOOL FRestoreBrowserDefaultChecking();
  161. void SaveAutoDial(void);
  162. void RestoreAutoDial(void);
  163. BOOL OpenIcwRmindKey(HKEY *phkey);
  164. BOOL ConfigureTrialReminder(LPCWSTR lpszFile);
  165. BOOL SetICWCompleted( DWORD dwCompleted );
  166. DWORD CallSBSConfig(HWND hwnd, LPCWSTR lpszINSFile);
  167. BOOL CallCMConfig(LPCWSTR lpszINSFile);
  168. DWORD dw_ProcessFlags; // Flags used to control INS processing
  169. WCHAR m_szRunExecutable[MAX_PATH + 1];
  170. WCHAR m_szRunArgument[MAX_PATH + 1];
  171. WCHAR m_szCheckAssociations[20];
  172. WCHAR m_szAutodialConnection[RAS_MaxEntryName + 1];
  173. WCHAR m_szStartURL[MAX_PATH + 1];
  174. BOOL m_fConnectionKilled;
  175. BOOL m_fNeedsRestart;
  176. BOOL m_fResforeDefCheck;
  177. BOOL m_fAutodialSaved;
  178. BOOL m_fAutodialEnabled;
  179. BOOL m_fProxyEnabled;
  180. BOOL m_bSilentMode;
  181. PFNBRANDICW m_lpfnBrandICW;
  182. PFNBRANDICW2 m_lpfnBrandICW2;
  183. PFNRASSETAUTODIALENABLE m_lpfnRasSetAutodialEnable;
  184. PFNRASSETAUTODIALADDRESS m_lpfnRasSetAutodialAddress;
  185. HINSTANCE m_hInetCfg;
  186. HINSTANCE m_hBranding;
  187. HINSTANCE m_hRAS;
  188. DWORD m_dwBrandFlags;
  189. DWORD m_dwDeviceType;
  190. };
  191. #endif //__INSHANDLER_H_