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.

482 lines
12 KiB

  1. /*++
  2. Copyright (c) 1994-2001 Microsoft Corporation
  3. Module Name :
  4. app_sheet.h
  5. Abstract:
  6. Application property sheet relevant classes
  7. Author:
  8. Sergei Antonov (sergeia)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef _APP_SHEET_H
  14. #define _APP_SHEET_H
  15. #include <vector>
  16. #include <list>
  17. #include "inetprop.h"
  18. #define CACHE_UNLIM_MAX 999999
  19. typedef struct _Mapping
  20. {
  21. CString ext;
  22. CString path;
  23. CString verbs;
  24. DWORD flags;
  25. _Mapping()
  26. {
  27. }
  28. _Mapping(const struct _Mapping& m)
  29. {
  30. ext = m.ext;
  31. path = m.path;
  32. verbs = m.verbs;
  33. flags = m.flags;
  34. }
  35. _Mapping(const CString& buf);
  36. LPCTSTR ToString(CString& buf) const;
  37. } Mapping;
  38. class CApplicationProps : public CMetaProperties
  39. {
  40. public:
  41. CApplicationProps(CComAuthInfo * pAuthInfo, LPCTSTR meta_path, BOOL fInherit = TRUE);
  42. CApplicationProps(CMetaInterface * pInterface, LPCTSTR meta_path, BOOL fInherit = TRUE);
  43. CApplicationProps(CMetaKey * pInterface, LPCTSTR meta_path, BOOL fInherit = TRUE);
  44. virtual HRESULT WriteDirtyProps();
  45. WORD MajorVersion()
  46. {
  47. return LOWORD(m_dwVersion);
  48. }
  49. WORD MinorVersion()
  50. {
  51. return HIWORD(m_dwVersion);
  52. }
  53. protected:
  54. virtual void ParseFields();
  55. HRESULT LoadVersion();
  56. void LoadInitialMappings(CStringListEx& list);
  57. BOOL InitialDataChanged(CStringListEx& list);
  58. public:
  59. CString m_ServerName;
  60. CString m_UserName;
  61. CStrPassword m_UserPassword;
  62. CString m_MetaPath;
  63. CString m_HelpPath;
  64. BOOL m_fIsLocal;
  65. BOOL m_fCompatMode;
  66. BOOL m_Dirty;
  67. MP_DWORD m_AppIsolated; //MD_APP_ISOLATED
  68. // CAspMain
  69. MP_BOOL m_EnableSession; //MD_ASP_ALLOWSESSIONSTATE
  70. MP_BOOL m_EnableBuffering; //MD_ASP_BUFFERINGON
  71. MP_BOOL m_EnableParents; //MD_ASP_ENABLEPARENTPATHS
  72. MP_DWORD m_SessionTimeout; //MD_ASP_SESSIONTIMEOUT
  73. MP_DWORD m_ScriptTimeout; //MD_ASP_SCRIPTTIMEOUT
  74. MP_CString m_Languages; //MD_ASP_SCRIPTLANGUAGE
  75. MP_DWORD m_AspServiceFlag;
  76. MP_CString m_AspSxsName;
  77. // CAppMappingPageBase
  78. MP_BOOL m_CacheISAPI; //MD_CACHE_EXTENSIONS
  79. MP_CStringListEx m_strlMappings; //MD_SCRIPT_MAPS
  80. BOOL m_fMappingsInherited;
  81. std::vector<CString> m_initData;
  82. MP_BOOL m_ServerDebug; //MD_ASP_ENABLESERVERDEBUG
  83. MP_BOOL m_ClientDebug; //MD_ASP_ENABLECLIENTDEBUG
  84. MP_BOOL m_SendAspError; //MD_ASP_SCRIPTERRORSSENTTOBROWSER
  85. MP_CString m_DefaultError; //MD_ASP_SCRIPTERRORMESSAGE
  86. BOOL m_NoCache;
  87. BOOL m_UnlimCache;
  88. BOOL m_LimCache;
  89. BOOL m_LimDiskCache;
  90. MP_DWORD m_AspScriptFileCacheSize;
  91. MP_DWORD m_AspMaxDiskTemplateCacheFiles;
  92. int m_LimCacheDiskSize;
  93. int m_LimCacheMemSize;
  94. MP_CString m_DiskCacheDir; //MD_ASP_DISKTEMPLATECACHEDIRECTORY
  95. MP_DWORD m_ScriptEngCacheMax; //MD_ASP_SCRIPTENGINECACHEMAX
  96. DWORD m_dwVersion;
  97. // CAppPropSheet * m_pSheet;
  98. };
  99. class CAppPropSheet : public CInetPropertySheet
  100. {
  101. DECLARE_DYNAMIC(CAppPropSheet)
  102. public:
  103. CAppPropSheet(
  104. CComAuthInfo * pAuthInfo,
  105. LPCTSTR lpszMetaPath,
  106. CWnd * pParentWnd = NULL,
  107. LPARAM lParam = 0L,
  108. LPARAM lParamParent = 0L,
  109. UINT iSelectPage = 0
  110. );
  111. virtual ~CAppPropSheet();
  112. public:
  113. // The following methods have predefined names to be compatible with
  114. // BEGIN_META_INST_READ and other macros.
  115. HRESULT QueryInstanceResult() const
  116. {
  117. return m_pprops ? m_pprops->QueryResult() : S_OK;
  118. }
  119. CApplicationProps & GetInstanceProperties() { return *m_pprops; }
  120. virtual HRESULT LoadConfigurationParameters();
  121. virtual void FreeConfigurationParameters();
  122. //{{AFX_MSG(CAppPropSheet)
  123. //}}AFX_MSG
  124. DECLARE_MESSAGE_MAP()
  125. private:
  126. CApplicationProps * m_pprops;
  127. };
  128. class CAspMainPage : public CInetPropertyPage
  129. {
  130. DECLARE_DYNCREATE(CAspMainPage)
  131. public:
  132. CAspMainPage(CInetPropertySheet * pSheet = NULL);
  133. virtual ~CAspMainPage();
  134. protected:
  135. enum {IDD = IDD_ASPMAIN};
  136. virtual BOOL OnInitDialog();
  137. afx_msg void OnItemChanged();
  138. afx_msg void OnSxs();
  139. //}}AFX_MSG
  140. DECLARE_MESSAGE_MAP()
  141. protected:
  142. BOOL m_EnableSession;
  143. BOOL m_EnableBuffering;
  144. BOOL m_EnableParents;
  145. DWORD m_SessionTimeout;
  146. DWORD m_ScriptTimeout;
  147. CString m_Languages;
  148. DWORD m_AspServiceFlag;
  149. BOOL m_AspEnableSxs;
  150. CString m_AspSxsName;
  151. CEdit m_LanguagesCtrl;
  152. //{{AFX_VIRTUAL(CAppPoolGeneral)
  153. virtual void DoDataExchange(CDataExchange * pDX);
  154. //}}AFX_VIRTUAL
  155. virtual void SetControlsState();
  156. virtual HRESULT FetchLoadedValues();
  157. virtual HRESULT SaveInfo();
  158. };
  159. BOOL SortMappings(CListCtrl& list, int col, int order);
  160. class CAppMappingPageBase : public CInetPropertyPage
  161. {
  162. public:
  163. CAppMappingPageBase(DWORD id, CInetPropertySheet * pSheet);
  164. virtual ~CAppMappingPageBase();
  165. enum
  166. {
  167. COL_EXTENSION = 0,
  168. COL_PATH,
  169. COL_EXCLUSIONS
  170. };
  171. protected:
  172. virtual OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  173. virtual BOOL OnInitDialog();
  174. afx_msg void OnAdd();
  175. afx_msg void OnEdit();
  176. afx_msg void OnRemove();
  177. afx_msg BOOL OnDblClickList(NMHDR* pNMHDR, LRESULT* pResult);
  178. afx_msg BOOL OnItemChanged(NMHDR* pNMHDR, LRESULT* pResult);
  179. afx_msg BOOL OnKeyDown(NMHDR* pNMHDR, LRESULT* pResult);
  180. afx_msg BOOL OnColumnClick(NMHDR* pNMHDR, LRESULT* pResult);
  181. afx_msg void OnDlgItemChanged();
  182. //}}AFX_MSG
  183. DECLARE_MESSAGE_MAP()
  184. protected:
  185. BOOL m_CacheISAPI;
  186. CListCtrl m_list;
  187. CStringListEx m_strlMappings;
  188. int m_sortCol;
  189. int m_sortOrder;
  190. //{{AFX_VIRTUAL(CAppMappingPageBase)
  191. virtual void DoDataExchange(CDataExchange * pDX);
  192. //}}AFX_VIRTUAL
  193. virtual HRESULT FetchLoadedValues();
  194. virtual HRESULT SaveInfo();
  195. virtual void SetControlsState();
  196. void RemoveSelected(CListCtrl& lst);
  197. };
  198. class CAppMappingPage_iis5 : public CAppMappingPageBase
  199. {
  200. public:
  201. CAppMappingPage_iis5(CInetPropertySheet * pSheet = NULL)
  202. : CAppMappingPageBase(IDD, pSheet)
  203. {
  204. }
  205. virtual ~CAppMappingPage_iis5()
  206. {
  207. }
  208. protected:
  209. enum {IDD = IDD_APPMAP_IIS5};
  210. DECLARE_MESSAGE_MAP()
  211. };
  212. class CAppMappingPage : public CAppMappingPageBase
  213. {
  214. public:
  215. CAppMappingPage(CInetPropertySheet * pSheet = NULL)
  216. : CAppMappingPageBase(IDD, pSheet)
  217. {
  218. }
  219. virtual ~CAppMappingPage()
  220. {
  221. }
  222. protected:
  223. enum {IDD = IDD_APPMAP};
  224. CListCtrl m_list_exe;
  225. virtual void SetControlsState();
  226. void MoveItem(CListCtrl& lst, int from, int to);
  227. virtual BOOL OnInitDialog();
  228. virtual void DoDataExchange(CDataExchange * pDX);
  229. virtual OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  230. afx_msg void OnInsert();
  231. afx_msg void OnEditExe();
  232. afx_msg void OnRemoveExe();
  233. afx_msg void OnMoveUp();
  234. afx_msg void OnMoveDown();
  235. afx_msg BOOL OnDblClickListExe(NMHDR* pNMHDR, LRESULT* pResult);
  236. afx_msg BOOL OnItemChangedExe(NMHDR* pNMHDR, LRESULT* pResult);
  237. afx_msg BOOL OnKeyDownExe(NMHDR* pNMHDR, LRESULT* pResult);
  238. DECLARE_MESSAGE_MAP()
  239. };
  240. //////////////////////////////////////////////////////////
  241. class CEditMapBase : public CDialog
  242. {
  243. public:
  244. CEditMapBase(UINT id, CWnd * pParent) : CDialog(id, pParent)
  245. {
  246. m_pMaps = NULL;
  247. // IDS_EXECUTABLE_DLL_MASK or IDS_EXECUTABLE_EXE_DLL_MASK
  248. m_IDS_BROWSE_BUTTON_MASK = IDS_EXECUTABLE_DLL_MASK;
  249. }
  250. public:
  251. CString m_exec;
  252. CString m_exec_init;
  253. BOOL m_file_exists;
  254. BOOL m_new, m_exec_valid, m_star_maps;
  255. BOOL m_bIsLocal;
  256. DWORD m_flags;
  257. CListCtrl * m_pMaps;
  258. UINT_PTR m_IDS_BROWSE_BUTTON_MASK;
  259. protected:
  260. virtual BOOL OnInitDialog();
  261. virtual void DoDataExchange(CDataExchange * pDX);
  262. BOOL SetControlsState();
  263. protected:
  264. afx_msg void OnButtonBrowse();
  265. afx_msg void OnExecutableChanged();
  266. DECLARE_MESSAGE_MAP()
  267. };
  268. class CEditMap : public CEditMapBase
  269. {
  270. public:
  271. CEditMap(CWnd * pParent = NULL) : CEditMapBase(CEditMap::IDD, pParent)
  272. {
  273. m_star_maps = FALSE;
  274. m_IDS_BROWSE_BUTTON_MASK = IDS_EXECUTABLE_EXE_DLL_MASK;
  275. }
  276. public:
  277. CString m_ext;
  278. int m_verbs_index;
  279. CString m_verbs;
  280. BOOL m_has_global_interceptor;
  281. BOOL m_script_engine;
  282. protected:
  283. enum { IDD = IDD_EDITMAP };
  284. virtual BOOL OnInitDialog();
  285. virtual void DoDataExchange(CDataExchange * pDX);
  286. BOOL SetControlsState();
  287. protected:
  288. afx_msg void OnExtChanged();
  289. afx_msg void OnVerbs();
  290. afx_msg void OnVerbsChanged();
  291. afx_msg void OnHelp();
  292. DECLARE_MESSAGE_MAP();
  293. };
  294. class CEditStarMap : public CEditMapBase
  295. {
  296. public:
  297. CEditStarMap(CWnd * pParent) : CEditMapBase(CEditStarMap::IDD, pParent)
  298. {
  299. m_star_maps = TRUE;
  300. m_IDS_BROWSE_BUTTON_MASK = IDS_EXECUTABLE_DLL_MASK;
  301. }
  302. protected:
  303. enum { IDD = IDD_EDIT_STARMAP };
  304. afx_msg void OnHelp();
  305. DECLARE_MESSAGE_MAP();
  306. };
  307. class CAppCacheBase : public CInetPropertyPage
  308. {
  309. public:
  310. CAppCacheBase(DWORD id, CInetPropertySheet * pSheet);
  311. virtual ~CAppCacheBase();
  312. protected:
  313. virtual BOOL OnInitDialog();
  314. afx_msg void OnItemChanged();
  315. DECLARE_MESSAGE_MAP()
  316. protected:
  317. virtual void DoDataExchange(CDataExchange * pDX);
  318. virtual HRESULT FetchLoadedValues()
  319. {
  320. return S_OK;
  321. }
  322. virtual HRESULT SaveInfo()
  323. {
  324. return S_OK;
  325. }
  326. virtual void SetControlsState();
  327. protected:
  328. BOOL m_NoCache, m_UnlimCache, m_LimCache;
  329. CSpinButtonCtrl m_ScriptEngCacheMaxSpin;
  330. DWORD m_ScriptEngCacheMax;
  331. };
  332. class CAppCache : public CAppCacheBase
  333. {
  334. public:
  335. CAppCache(CInetPropertySheet * pSheet);
  336. virtual ~CAppCache();
  337. int BrowseForFolderCallback(HWND hwnd, UINT uMsg, LPARAM lParam);
  338. protected:
  339. virtual BOOL OnInitDialog();
  340. afx_msg void OnNoCache();
  341. afx_msg void OnUnlimitedCache();
  342. afx_msg void OnLimitedCache();
  343. afx_msg void OnUnlimitedDiskCache();
  344. afx_msg void OnLimitedDiskCache();
  345. afx_msg void OnBrowse();
  346. // afx_msg void OnItemChanged();
  347. DECLARE_MESSAGE_MAP()
  348. protected:
  349. virtual void DoDataExchange(CDataExchange * pDX);
  350. virtual void SetControlsState();
  351. virtual HRESULT FetchLoadedValues();
  352. virtual HRESULT SaveInfo();
  353. protected:
  354. enum { IDD = IDD_CACHE_OPT };
  355. BOOL m_LimDiskCache;
  356. DWORD m_LimCacheDiskSize;
  357. DWORD m_LimCacheMemSize;
  358. CString m_DiskCacheDir;
  359. LPTSTR m_pPathTemp;
  360. CSpinButtonCtrl m_LimCacheMemSizeSpin;
  361. CSpinButtonCtrl m_LimCacheDiskSizeSpin;
  362. };
  363. class CAppCache_iis5 : public CAppCacheBase
  364. {
  365. public:
  366. CAppCache_iis5(CInetPropertySheet * pSheet);
  367. virtual ~CAppCache_iis5();
  368. protected:
  369. virtual BOOL OnInitDialog();
  370. afx_msg void OnNoCache();
  371. afx_msg void OnUnlimitedCache();
  372. afx_msg void OnLimitedCache();
  373. afx_msg void OnItemChanged();
  374. DECLARE_MESSAGE_MAP()
  375. protected:
  376. virtual void DoDataExchange(CDataExchange * pDX);
  377. virtual void SetControlsState();
  378. virtual HRESULT FetchLoadedValues();
  379. virtual HRESULT SaveInfo();
  380. protected:
  381. enum { IDD = IDD_CACHE_OPT_IIS5 };
  382. int m_AspScriptFileCacheSize;
  383. CSpinButtonCtrl m_AspScriptFileCacheSizeSpin;
  384. };
  385. class CAspDebug : public CInetPropertyPage
  386. {
  387. DECLARE_DYNCREATE(CAspDebug)
  388. public:
  389. CAspDebug(CInetPropertySheet * pSheet = NULL);
  390. virtual ~CAspDebug();
  391. protected:
  392. enum {IDD = IDD_ASPDEBUG};
  393. virtual BOOL OnInitDialog();
  394. afx_msg void OnItemChanged();
  395. afx_msg void OnChangedError();
  396. //}}AFX_MSG
  397. DECLARE_MESSAGE_MAP()
  398. protected:
  399. BOOL m_ServerDebug;
  400. BOOL m_ClientDebug;
  401. BOOL m_SendAspError;
  402. CString m_DefaultError;
  403. //{{AFX_VIRTUAL(CAspDebug)
  404. virtual void DoDataExchange(CDataExchange * pDX);
  405. //}}AFX_VIRTUAL
  406. virtual HRESULT FetchLoadedValues();
  407. virtual HRESULT SaveInfo();
  408. };
  409. #endif //_APP_SHEET_H