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.

633 lines
12 KiB

  1. /*++
  2. Copyright (c) 1994-1998 Microsoft Corporation
  3. Module Name :
  4. w3sht.h
  5. Abstract:
  6. WWW Property Sheet Definitions
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef __W3SHT_H__
  14. #define __W3SHT_H__
  15. #include "shts.h"
  16. extern const LPCTSTR g_cszSvc;
  17. //
  18. // Helper function to determine if SSL is installed
  19. // and enabled on the given server
  20. //
  21. DWORD
  22. IsSSLEnabledOnServer(
  23. IN CComAuthInfo * pAuthInfo,
  24. OUT BOOL & fInstalled,
  25. OUT BOOL & fEnabled
  26. );
  27. //
  28. // Helper function to see if a certificate is installed
  29. //
  30. BOOL
  31. IsCertInstalledOnServer(
  32. IN CComAuthInfo * pAuthInfo,
  33. IN LPCTSTR lpszMDPath
  34. );
  35. #ifndef LOGGING_ENABLED
  36. #define LOGGING_ENABLED
  37. inline BOOL LoggingEnabled(
  38. IN DWORD dwLogType
  39. )
  40. {
  41. return (dwLogType == MD_LOG_TYPE_ENABLED);
  42. }
  43. #endif
  44. #ifndef ENABLE_LOGGING
  45. #define ENABLE_LOGGING
  46. inline void EnableLogging(
  47. OUT DWORD & dwLogType,
  48. IN BOOL fEnabled = TRUE
  49. )
  50. {
  51. dwLogType = fEnabled ? MD_LOG_TYPE_ENABLED : MD_LOG_TYPE_DISABLED;
  52. }
  53. #endif
  54. //
  55. // Bandwidth definitions
  56. //
  57. #define INFINITE_BANDWIDTH (0xffffffff)
  58. #define INFINITE_CPU_RAW (0xffffffff)
  59. #define KILOBYTE (1024L)
  60. #define MEGABYTE (1024L * KILOBYTE)
  61. #define DEF_BANDWIDTH (1 * MEGABYTE)
  62. #define CPU_THROTTLING_FACTOR (1000)
  63. #define DEFAULT_CPU_PERCENTAGE (10L)
  64. //
  65. // Some sanity values on max connections
  66. //
  67. #define INITIAL_MAX_CONNECTIONS ( 1000L)
  68. // TODO: Check these limits
  69. //#define UNLIMITED_CONNECTIONS (2000000000L)
  70. #define UNLIMITED_CONNECTIONS (0xFFFFFFFF)
  71. #define MAX_MAX_CONNECTIONS (UNLIMITED_CONNECTIONS - 1L)
  72. #define MAX_TIMEOUT (0x7FFFFFFF)
  73. class CW3InstanceProps : public CInstanceProps
  74. /*++
  75. Class Description:
  76. WWW Instance properties class
  77. Public Interface:
  78. CW3InstanceProps : Constructor
  79. --*/
  80. {
  81. public:
  82. CW3InstanceProps(
  83. IN CComAuthInfo * pAuthInfo,
  84. IN LPCTSTR lpszMDPath
  85. );
  86. public:
  87. //
  88. // Write Data if dirty
  89. //
  90. virtual HRESULT WriteDirtyProps();
  91. protected:
  92. //
  93. // Break out GetAllData() data to data fields
  94. //
  95. virtual void ParseFields();
  96. public:
  97. //
  98. // Service Page
  99. //
  100. MP_DWORD m_dwLogType;
  101. MP_CILong m_nMaxConnections;
  102. MP_CILong m_nConnectionTimeOut;
  103. MP_CStringListEx m_strlSecureBindings;
  104. //
  105. // Performance Page
  106. //
  107. MP_int m_nServerSize;
  108. MP_BOOL m_fUseKeepAlives;
  109. MP_BOOL m_fLogUTF8;
  110. MP_BOOL m_fEnableCPUAccounting;
  111. MP_DWORD m_dwCPULimitLogEventRaw;
  112. MP_DWORD m_dwCPULimitPriorityRaw;
  113. MP_DWORD m_dwCPULimitPauseRaw;
  114. MP_DWORD m_dwCPULimitProcStopRaw;
  115. MP_CILong m_dwMaxBandwidth;
  116. MP_CILong m_dwMaxGlobalBandwidth;
  117. BOOL m_fUninstallPSHED;
  118. //
  119. // Operators Page
  120. //
  121. MP_CBlob m_acl;
  122. //
  123. // Root dir page
  124. //
  125. //MP_BOOL m_fFrontPage;
  126. //
  127. // Default Site page
  128. //
  129. MP_DWORD m_dwDownlevelInstance;
  130. //
  131. // Certificate and CTL information
  132. //
  133. MP_CBlob m_CertHash;
  134. MP_CString m_strCertStoreName;
  135. MP_CString m_strCTLIdentifier;
  136. MP_CString m_strCTLStoreName;
  137. };
  138. class CW3DirProps : public CChildNodeProps
  139. /*++
  140. Class Description:
  141. WWW Directory Properties
  142. Public Interface:
  143. CW3DirProps : Constructor
  144. --*/
  145. {
  146. public:
  147. //
  148. // Constructor
  149. //
  150. CW3DirProps(
  151. IN CComAuthInfo * pAuthInfo,
  152. IN LPCTSTR lpszMDPath
  153. );
  154. public:
  155. //
  156. // Write Data if dirty
  157. //
  158. virtual HRESULT WriteDirtyProps();
  159. protected:
  160. //
  161. // Break out GetAllData() data to data fields
  162. //
  163. virtual void ParseFields();
  164. public:
  165. //
  166. // Directory properties page
  167. //
  168. MP_CString m_strUserName;
  169. MP_CString m_strPassword;
  170. MP_CString m_strDefaultDocument;
  171. MP_CString m_strFooter;
  172. MP_CMaskedDWORD m_dwDirBrowsing;
  173. MP_BOOL m_fDontLog;
  174. MP_BOOL m_fEnableFooter;
  175. MP_BOOL m_fIndexed;
  176. //
  177. // HTTP Page
  178. //
  179. MP_CString m_strExpiration;
  180. MP_CStringListEx m_strlCustomHeaders;
  181. //
  182. // Custom Errors
  183. //
  184. MP_CStringListEx m_strlCustomErrors;
  185. //
  186. // Security page
  187. //
  188. MP_DWORD m_dwAuthFlags;
  189. MP_DWORD m_dwSSLAccessPermissions;
  190. MP_CString m_strBasicDomain;
  191. MP_CString m_strRealm;
  192. MP_CString m_strAnonUserName;
  193. MP_CString m_strAnonPassword;
  194. MP_BOOL m_fPasswordSync;
  195. MP_BOOL m_fU2Installed;
  196. MP_BOOL m_fUseNTMapper;
  197. MP_CBlob m_ipl;
  198. };
  199. class CIISFilter : public CObjectPlus
  200. /*++
  201. Class Description:
  202. A single filter description
  203. Public Interface:
  204. CIISFilter : Constructors
  205. IsInitialized : Check to see if the name is set.
  206. Write : Write to the metabase.
  207. QueryResult : Query result from metabase read
  208. QueryError : Returns error as stored in metabase
  209. QueryName : Returns filter name
  210. IsLoaded : TRUE if filter is loaded
  211. IsUnloaded : TRUE if filter is unloaded
  212. IsEnabled : TRUE if filter is enabled
  213. Enable : Enable filter
  214. IsDirty : TRUE if filter values have changed
  215. IsFlaggedForDeletion : TRUE if filter should be deleted
  216. --*/
  217. {
  218. //
  219. // Constructors/Destructors
  220. //
  221. public:
  222. //
  223. // Null Constructor
  224. //
  225. CIISFilter();
  226. //
  227. // Read filter values using provided key
  228. //
  229. CIISFilter(
  230. IN CMetaKey * pKey,
  231. IN LPCTSTR lpszName
  232. );
  233. //
  234. // Copy constructor
  235. //
  236. CIISFilter(
  237. IN const CIISFilter & flt
  238. );
  239. public:
  240. //
  241. // Sorting helper
  242. //
  243. int OrderByPriority(
  244. IN const CObjectPlus * pobAccess
  245. ) const;
  246. BOOL IsInitialized() const { return !m_strName.IsEmpty(); }
  247. //
  248. // Write using provided key
  249. //
  250. HRESULT Write(CMetaKey * pKey);
  251. public:
  252. BOOL IsLoaded() const;
  253. BOOL IsUnloaded() const;
  254. BOOL IsEnabled() const { return m_fEnabled; }
  255. void Enable(BOOL fEnabled = TRUE);
  256. DWORD QueryError() const { return m_dwWin32Error; }
  257. HRESULT QueryResult() const { return m_hrResult; }
  258. //
  259. // Check to see if this item is marked as dirty
  260. //
  261. BOOL IsDirty() const { return m_fDirty; }
  262. //
  263. // Check to see if this item is flagged for deletion
  264. //
  265. BOOL IsFlaggedForDeletion() const { return m_fFlaggedForDeletion; }
  266. //
  267. // Set/reset the dirty flag
  268. //
  269. void Dirty(BOOL fDirty = TRUE);
  270. //
  271. // Flag this item for deletion
  272. //
  273. void FlagForDeletion();
  274. //
  275. // Get the name of this filter
  276. //
  277. LPCTSTR QueryName() const { return m_strName; }
  278. //
  279. // Meta Values
  280. //
  281. public:
  282. int m_nPriority;
  283. int m_nOrder;
  284. BOOL m_fEnabled;
  285. DWORD m_dwState;
  286. DWORD m_dwWin32Error;
  287. HRESULT m_hrResult;
  288. CString m_strName;
  289. CString m_strExecutable;
  290. //
  291. // State Values
  292. //
  293. private:
  294. BOOL m_fDirty;
  295. BOOL m_fFlaggedForDeletion;
  296. DWORD m_dwFlags;
  297. };
  298. class CIISFilterList : public CMetaKey
  299. /*++
  300. Class Description:
  301. A list of filters
  302. Public Interface:
  303. CIISFilterList : Constructor
  304. BeginSearch : Reset the iterator
  305. MoreFilters : More items available in the list?
  306. GetNextFilter : Get the next item in the list
  307. --*/
  308. {
  309. public:
  310. CIISFilterList(
  311. IN CComAuthInfo * pAuthInfo,
  312. IN LPCTSTR lpszMetaPath
  313. /*
  314. IN LPCTSTR lpszServerName,
  315. IN LPCTSTR lpszService,
  316. IN DWORD dwInstance = MASTER_INSTANCE
  317. */
  318. );
  319. public:
  320. //
  321. // Write out the filter list
  322. //
  323. HRESULT WriteIfDirty();
  324. //
  325. // Acccess Functions
  326. //
  327. public:
  328. //DWORD QueryInstance() const { return m_dwInstance; }
  329. BOOL FiltersLoaded() const { return m_fFiltersLoaded; }
  330. //
  331. // Load each filter in turn
  332. //
  333. HRESULT LoadAllFilters();
  334. //
  335. // Filter Access Functions
  336. //
  337. public:
  338. //
  339. // Reset the filter list iterator
  340. //
  341. void ResetEnumerator();
  342. int GetCount() const { return (int)m_oblFilters.GetCount(); }
  343. //
  344. // More filters available in the list?
  345. //
  346. BOOL MoreFilters() const { return m_pos != NULL; }
  347. //
  348. // Return position of filter by index
  349. //
  350. POSITION GetFilterPositionByIndex(int nSel);
  351. //
  352. // Iterate to the next filter in the list
  353. //
  354. CIISFilter * GetNextFilter();
  355. //
  356. // Remove filter
  357. //
  358. void RemoveFilter(int nItem);
  359. //
  360. // Add new filter
  361. //
  362. void AddFilter(CIISFilter * pFilter);
  363. //
  364. // Exchange two filters in the list
  365. //
  366. BOOL ExchangePositions(
  367. IN int nSel1,
  368. IN int nSel2,
  369. OUT CIISFilter *& p1,
  370. OUT CIISFilter *& p2
  371. );
  372. //
  373. // See if at least one filter is dirty
  374. //
  375. BOOL HasDirtyFilter() const;
  376. //
  377. // Virtual Interface:
  378. //
  379. public:
  380. virtual BOOL Succeeded() const { return SUCCEEDED(m_hrResult); }
  381. virtual HRESULT QueryResult() const { return m_hrResult; }
  382. protected:
  383. //
  384. // Build up order string from component list
  385. //
  386. LPCTSTR BuildFilterOrderString(
  387. OUT CString & strFilterOrder
  388. );
  389. protected:
  390. //
  391. // Seperator string (one character)
  392. //
  393. static const LPCTSTR s_lpszSep;
  394. private:
  395. BOOL m_fFiltersLoaded;
  396. //DWORD m_dwInstance;
  397. POSITION m_pos;
  398. HRESULT m_hrResult;
  399. CString m_strFilterOrder;
  400. CObListPlus m_oblFilters;
  401. };
  402. //
  403. // W3 Property sheet
  404. //
  405. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  406. class CW3Sheet : public CInetPropertySheet
  407. {
  408. public:
  409. CW3Sheet(
  410. IN CComAuthInfo * pAuthInfo,
  411. IN LPCTSTR lpszMetaPath,
  412. IN DWORD dwAttributes,
  413. IN CWnd * pParentWnd = NULL,
  414. IN LPARAM lParam = 0L,
  415. IN LONG_PTR handle = 0L,
  416. IN UINT iSelectPage = 0
  417. );
  418. virtual ~CW3Sheet();
  419. public:
  420. HRESULT QueryInstanceResult() const;
  421. HRESULT QueryDirectoryResult() const;
  422. CW3InstanceProps & GetInstanceProperties() { return *m_ppropInst; }
  423. CW3DirProps & GetDirectoryProperties() { return *m_ppropDir; }
  424. BOOL InCompatibilityMode() const { return m_fCompatMode; }
  425. virtual HRESULT LoadConfigurationParameters();
  426. virtual void FreeConfigurationParameters();
  427. HRESULT EnumAppPools(CMapStringToString& pools);
  428. HRESULT SetKeyType();
  429. HRESULT QueryDefaultPoolId(CString& id);
  430. enum
  431. {
  432. SHEET_TYPE_SERVER,
  433. SHEET_TYPE_SITE,
  434. SHEET_TYPE_VDIR,
  435. SHEET_TYPE_DIR,
  436. SHEET_TYPE_FILE
  437. };
  438. HRESULT SetSheetType(int fSheetType);
  439. protected:
  440. virtual void WinHelp(DWORD dwData, UINT nCmd = HELP_CONTEXT);
  441. //{{AFX_MSG(CW3Sheet)
  442. //}}AFX_MSG
  443. DECLARE_MESSAGE_MAP()
  444. private:
  445. DWORD m_fNew;
  446. DWORD m_dwAttributes;
  447. BOOL m_fCompatMode;
  448. CW3InstanceProps * m_ppropInst;
  449. CW3DirProps * m_ppropDir;
  450. int m_fSheetType;
  451. };
  452. //
  453. // Inline Expansion
  454. //
  455. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  456. inline BOOL CIISFilter::IsLoaded() const
  457. {
  458. return m_dwState == MD_FILTER_STATE_LOADED;
  459. }
  460. inline BOOL CIISFilter::IsUnloaded() const
  461. {
  462. return m_dwState == MD_FILTER_STATE_UNLOADED;
  463. }
  464. inline void CIISFilter::Enable(
  465. IN BOOL fEnabled
  466. )
  467. {
  468. m_fEnabled = fEnabled;
  469. }
  470. inline void CIISFilter::Dirty(
  471. IN BOOL fDirty
  472. )
  473. {
  474. m_fDirty = fDirty;
  475. }
  476. inline void CIISFilter::FlagForDeletion()
  477. {
  478. m_fFlaggedForDeletion = TRUE;
  479. }
  480. inline void CIISFilterList::ResetEnumerator()
  481. {
  482. m_pos = m_oblFilters.GetHeadPosition();
  483. }
  484. inline CIISFilter * CIISFilterList::GetNextFilter()
  485. {
  486. return (CIISFilter *)m_oblFilters.GetNext(m_pos);
  487. }
  488. inline void CIISFilterList::RemoveFilter(int nItem)
  489. {
  490. m_oblFilters.RemoveIndex(nItem);
  491. }
  492. inline void CIISFilterList::AddFilter(CIISFilter * pFilter)
  493. {
  494. m_oblFilters.AddTail(pFilter);
  495. }
  496. //
  497. // BUGBUG: Returns S_OK if object not present
  498. //
  499. inline HRESULT CW3Sheet::QueryInstanceResult() const
  500. {
  501. return m_ppropInst ? m_ppropInst->QueryResult() : S_OK;
  502. }
  503. inline HRESULT CW3Sheet::QueryDirectoryResult() const
  504. {
  505. return m_ppropDir ? m_ppropDir->QueryResult() : S_OK;
  506. }
  507. #endif // __W3SHT_H__