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.

215 lines
8.7 KiB

  1. // INSHandler.h : Declaration of the CINSHandler
  2. #ifndef __INSHANDLER_H_
  3. #define __INSHANDLER_H_
  4. // This struct is used to configure the client
  5. typedef struct
  6. {
  7. LPCTSTR lpszSection;
  8. LPCTSTR lpszValue;
  9. UINT uOffset;
  10. UINT uSize;
  11. } CLIENT_TABLE, FAR *LPCLIENT_TABLE;
  12. typedef struct
  13. {
  14. TCHAR szEntryName[RAS_MaxEntryName+1];
  15. TCHAR szUserName[UNLEN+1];
  16. TCHAR szPassword[PWLEN+1];
  17. TCHAR szScriptFile[MAX_PATH+1];
  18. RASENTRY RasEntry;
  19. } ICONNECTION, FAR * LPICONNECTION;
  20. #include "resource.h" // main symbols
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CINSHandler
  23. class ATL_NO_VTABLE CINSHandler :
  24. public CComObjectRootEx<CComSingleThreadModel>,
  25. public CComCoClass<CINSHandler,&CLSID_INSHandler>,
  26. public CComControl<CINSHandler>,
  27. public IDispatchImpl<IINSHandler, &IID_IINSHandler, &LIBID_ICWHELPLib>,
  28. public IProvideClassInfo2Impl<&CLSID_INSHandler, &DIID__INSHandlerEvents, &LIBID_ICWHELPLib>,
  29. public IPersistStreamInitImpl<CINSHandler>,
  30. public IOleControlImpl<CINSHandler>,
  31. public IOleObjectImpl<CINSHandler>,
  32. public IOleInPlaceActiveObjectImpl<CINSHandler>,
  33. public IViewObjectExImpl<CINSHandler>,
  34. public IOleInPlaceObjectWindowlessImpl<CINSHandler>,
  35. public CProxy_INSHandlerEvents<CINSHandler>,
  36. public IConnectionPointContainerImpl<CINSHandler>,
  37. public IObjectSafetyImpl<CINSHandler>
  38. {
  39. public:
  40. CINSHandler()
  41. {
  42. m_szRunExecutable [0] = '\0';
  43. m_szRunArgument [0] = '\0';
  44. m_szCheckAssociations [0] = '\0';
  45. m_szAutodialConnection [0] = '\0';
  46. m_szStartURL [0] = '\0';
  47. m_fResforeDefCheck = FALSE;
  48. m_fAutodialSaved = TRUE;
  49. m_fAutodialEnabled = FALSE;
  50. m_fProxyEnabled = FALSE;
  51. m_bSilentMode = FALSE;
  52. m_lpfnInetConfigSystem = NULL;
  53. m_lpfnInetGetProxy = NULL;
  54. m_lpfnInetConfigClient = NULL;
  55. //m_lpfnInetConfigClientEx = NULL;
  56. m_lpfnInetGetAutodial = NULL;
  57. m_lpfnInetSetAutodial = NULL;
  58. m_lpfnInetSetClientInfo = NULL;
  59. m_lpfnInetSetProxy = NULL;
  60. m_lpfnBrandICW = NULL;
  61. m_lpfnRasSetAutodialEnable = NULL;
  62. m_lpfnRasSetAutodialAddress = NULL;
  63. m_hInetCfg = NULL;
  64. m_hBranding = NULL;
  65. m_hRAS = NULL;
  66. m_dwBrandFlags = BRAND_DEFAULT;
  67. }
  68. DECLARE_REGISTRY_RESOURCEID(IDR_INSHANDLER)
  69. BEGIN_COM_MAP(CINSHandler)
  70. COM_INTERFACE_ENTRY(IDispatch)
  71. COM_INTERFACE_ENTRY(IINSHandler)
  72. COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject, IViewObjectEx)
  73. COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject2, IViewObjectEx)
  74. COM_INTERFACE_ENTRY_IMPL(IViewObjectEx)
  75. COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleWindow, IOleInPlaceObjectWindowless)
  76. COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleInPlaceObject, IOleInPlaceObjectWindowless)
  77. COM_INTERFACE_ENTRY_IMPL(IOleInPlaceObjectWindowless)
  78. COM_INTERFACE_ENTRY_IMPL(IOleInPlaceActiveObject)
  79. COM_INTERFACE_ENTRY_IMPL(IOleControl)
  80. COM_INTERFACE_ENTRY_IMPL(IOleObject)
  81. COM_INTERFACE_ENTRY_IMPL(IPersistStreamInit)
  82. COM_INTERFACE_ENTRY_IMPL(IObjectSafety)
  83. COM_INTERFACE_ENTRY(IProvideClassInfo)
  84. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  85. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  86. END_COM_MAP()
  87. BEGIN_CONNECTION_POINT_MAP(CINSHandler)
  88. CONNECTION_POINT_ENTRY(DIID__INSHandlerEvents)
  89. END_CONNECTION_POINT_MAP()
  90. BEGIN_PROPERTY_MAP(CINSHandler)
  91. // Example entries
  92. // PROP_ENTRY("Property Description", dispid, clsid)
  93. // PROP_PAGE(CLSID_StockColorPage)
  94. END_PROPERTY_MAP()
  95. BEGIN_MSG_MAP(CINSHandler)
  96. MESSAGE_HANDLER(WM_PAINT, OnPaint)
  97. MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
  98. MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
  99. END_MSG_MAP()
  100. // IViewObjectEx
  101. STDMETHOD(GetViewStatus)(DWORD* pdwStatus)
  102. {
  103. ATLTRACE(_T("IViewObjectExImpl::GetViewStatus\n"));
  104. *pdwStatus = 0;
  105. return S_OK;
  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 (ProcessINS) (BSTR bstrINSFilePath, /*[out, retval]*/ BOOL *pbRetVal);
  113. STDMETHOD (get_DefaultURL) (/*[out, retval]*/ BSTR *pszURL);
  114. HRESULT OnDraw(ATL_DRAWINFO& di);
  115. private:
  116. CComBSTR m_bstrINSFileName;
  117. HRESULT MassageFile(LPCTSTR lpszFile);
  118. DWORD RunExecutable(void);
  119. BOOL KeepConnection(LPCTSTR lpszFile);
  120. DWORD ImportCustomInfo(LPCTSTR lpszImportFile, LPTSTR lpszExecutable, DWORD cbExecutable, LPTSTR lpszArgument, DWORD cbArgument);
  121. DWORD ImportFile(LPCTSTR lpszImportFile, LPCTSTR lpszSection, LPCTSTR lpszOutputFile);
  122. DWORD ImportCustomFile(LPCTSTR lpszImportFile);
  123. DWORD ImportBrandingInfo(LPCTSTR lpszFile, LPCTSTR lpszConnectoidName);
  124. // Client Config functions
  125. DWORD ImportCustomDialer(LPRASENTRY lpRasEntry, LPCTSTR szFileName);
  126. LPCTSTR StrToSubip (LPCTSTR szIPAddress, LPBYTE pVal);
  127. DWORD StrToip (LPCTSTR szIPAddress, RASIPADDR *ipAddr);
  128. DWORD ImportPhoneInfo(LPRASENTRY lpRasEntry, LPCTSTR szFileName);
  129. DWORD ImportServerInfo(LPRASENTRY lpRasEntry, LPCTSTR szFileName);
  130. DWORD ImportIPInfo(LPRASENTRY lpRasEntry, LPCTSTR szFileName);
  131. DWORD ImportScriptFile(LPCTSTR lpszImportFile, LPTSTR szScriptFile, UINT cbScriptFile);
  132. DWORD RnaValidateImportEntry (LPCTSTR szFileName);
  133. DWORD ImportRasEntry (LPCTSTR szFileName, LPRASENTRY lpRasEntry);
  134. DWORD ImportConnection (LPCTSTR szFileName, LPICONNECTION lpConn);
  135. DWORD ImportMailAndNewsInfo(LPCTSTR lpszFile, BOOL fConnectPhone);
  136. HRESULT WriteMailAndNewsKey(HKEY hKey, LPCTSTR lpszSection, LPCTSTR lpszValue,LPTSTR lpszBuff, DWORD dwBuffLen,LPCTSTR lpszSubKey,DWORD dwType, LPCTSTR lpszFile);
  137. BOOL LoadExternalFunctions(void);
  138. DWORD ReadClientInfo(LPCTSTR lpszFile, LPINETCLIENTINFO lpClientInfo, LPCLIENT_TABLE lpClientTable);
  139. BOOL WantsExchangeInstalled(LPCTSTR lpszFile);
  140. BOOL DisplayPassword(LPCTSTR lpszFile);
  141. DWORD ImportClientInfo(LPCTSTR lpszFile, LPINETCLIENTINFO lpClientInfo);
  142. DWORD ConfigureClient(HWND hwnd, LPCTSTR lpszFile, LPBOOL lpfNeedsRestart, LPBOOL lpfConnectoidCreated, BOOL fHookAutodial, LPTSTR szConnectoidName, DWORD dwConnectoidNameSize);
  143. HRESULT PopulateNTAutodialAddress(LPCTSTR pszFileName, LPCTSTR pszEntryName);
  144. LPTSTR MoveToNextAddress(LPTSTR lpsz);
  145. HRESULT PreparePassword(LPTSTR szBuff, DWORD dwBuffLen);
  146. BOOL FIsAthenaPresent();
  147. BOOL FTurnOffBrowserDefaultChecking();
  148. BOOL FRestoreBrowserDefaultChecking();
  149. void SaveAutoDial(void);
  150. void RestoreAutoDial(void);
  151. BOOL OpenIcwRmindKey(CMcRegistry &reg);
  152. BOOL ConfigureTrialReminder(LPCTSTR lpszFile);
  153. BOOL SetICWCompleted( DWORD dwCompleted );
  154. DWORD CallSBSConfig(HWND hwnd, LPCTSTR lpszINSFile);
  155. BOOL CallCMConfig(LPCTSTR lpszINSFile);
  156. DWORD dw_ProcessFlags; // Flags used to control INS processing
  157. TCHAR m_szRunExecutable[MAX_PATH + 1];
  158. TCHAR m_szRunArgument[MAX_PATH + 1];
  159. TCHAR m_szCheckAssociations[20];
  160. TCHAR m_szAutodialConnection[RAS_MaxEntryName + 1];
  161. TCHAR m_szStartURL[MAX_PATH + 1];
  162. BOOL m_fConnectionKilled;
  163. BOOL m_fNeedsRestart;
  164. BOOL m_fResforeDefCheck;
  165. BOOL m_fAutodialSaved;
  166. BOOL m_fAutodialEnabled;
  167. BOOL m_fProxyEnabled;
  168. BOOL m_bSilentMode;
  169. PFNINETCONFIGSYSTEM m_lpfnInetConfigSystem;
  170. PFNINETGETPROXY m_lpfnInetGetProxy;
  171. PFNINETCONFIGCLIENT m_lpfnInetConfigClient;
  172. //PFNINETCONFIGCLIENTEX m_lpfnInetConfigClientEx;
  173. PFNINETGETAUTODIAL m_lpfnInetGetAutodial;
  174. PFNINETSETAUTODIAL m_lpfnInetSetAutodial;
  175. PFNINETSETCLIENTINFO m_lpfnInetSetClientInfo;
  176. PFNINETSETPROXY m_lpfnInetSetProxy;
  177. PFNBRANDICW m_lpfnBrandICW;
  178. PFNRASSETAUTODIALENABLE m_lpfnRasSetAutodialEnable;
  179. PFNRASSETAUTODIALADDRESS m_lpfnRasSetAutodialAddress;
  180. HINSTANCE m_hInetCfg;
  181. HINSTANCE m_hBranding;
  182. HINSTANCE m_hRAS;
  183. DWORD m_dwBrandFlags;
  184. };
  185. #endif //__INSHANDLER_H_