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.

479 lines
15 KiB

  1. /*++
  2. Copyright (c) 1994-2001 Microsoft Corporation
  3. Module Name :
  4. shts.h
  5. Abstract:
  6. IIS Property sheet definitions
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Sergei Antonov (sergeia)
  10. Project:
  11. Internet Services Manager
  12. Revision History:
  13. --*/
  14. #ifndef __SHTS_H__
  15. #define __SHTS_H__
  16. #include "iisobj.h"
  17. //
  18. // Sheet Definitions
  19. //
  20. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  21. //
  22. // Sheet -> page crackers
  23. //
  24. #define BEGIN_META_INST_READ(sheet)\
  25. { \
  26. sheet * pSheet = (sheet *)GetSheet(); \
  27. do \
  28. { \
  29. if (FAILED(pSheet->QueryInstanceResult())) \
  30. { \
  31. break; \
  32. }
  33. #define FETCH_INST_DATA_FROM_SHEET(value)\
  34. value = pSheet->GetInstanceProperties().value; \
  35. TRACEEOLID(value);
  36. #define END_META_INST_READ(err)\
  37. \
  38. } \
  39. while(FALSE); \
  40. }
  41. #define BEGIN_META_DIR_READ(sheet)\
  42. { \
  43. sheet * pSheet = (sheet *)GetSheet(); \
  44. do \
  45. { \
  46. if (FAILED(pSheet->QueryDirectoryResult())) \
  47. { \
  48. break; \
  49. }
  50. #define FETCH_DIR_DATA_FROM_SHEET(value)\
  51. value = pSheet->GetDirectoryProperties().value; \
  52. TRACEEOLID(value);
  53. #define END_META_DIR_READ(err)\
  54. \
  55. } \
  56. while(FALSE); \
  57. }
  58. #define BEGIN_META_INST_WRITE(sheet)\
  59. { \
  60. sheet * pSheet = (sheet *)GetSheet(); \
  61. \
  62. do \
  63. { \
  64. #define STORE_INST_DATA_ON_SHEET(value)\
  65. pSheet->GetInstanceProperties().value = value;
  66. #define STORE_INST_DATA_ON_SHEET_REMEMBER(value, dirty)\
  67. pSheet->GetInstanceProperties().value = value; \
  68. dirty = MP_D(((sheet *)GetSheet())->GetInstanceProperties().value);
  69. #define FLAG_INST_DATA_FOR_DELETION(id)\
  70. pSheet->GetInstanceProperties().FlagPropertyForDeletion(id);
  71. #define END_META_INST_WRITE(err)\
  72. \
  73. } \
  74. while(FALSE); \
  75. \
  76. err = pSheet->GetInstanceProperties().WriteDirtyProps(); \
  77. }
  78. #define BEGIN_META_DIR_WRITE(sheet)\
  79. { \
  80. sheet * pSheet = (sheet *)GetSheet(); \
  81. \
  82. do \
  83. { \
  84. #define STORE_DIR_DATA_ON_SHEET(value)\
  85. pSheet->GetDirectoryProperties().value = value;
  86. #define STORE_DIR_DATA_ON_SHEET_REMEMBER(value, dirty)\
  87. pSheet->GetDirectoryProperties().value = value; \
  88. dirty = MP_D(pSheet->GetDirectoryProperties().value);
  89. #define INIT_DIR_DATA_MASK(value, mask)\
  90. MP_V(pSheet->GetDirectoryProperties().value).SetMask(mask);
  91. #define FLAG_DIR_DATA_FOR_DELETION(id)\
  92. pSheet->GetDirectoryProperties().FlagPropertyForDeletion(id);
  93. #define END_META_DIR_WRITE(err)\
  94. \
  95. } \
  96. while(FALSE); \
  97. \
  98. err = pSheet->GetDirectoryProperties().WriteDirtyProps(); \
  99. }
  100. class CInetPropertyPage;
  101. class CInetPropertySheet : public CPropertySheet
  102. /*++
  103. Class Description:
  104. IIS Object configuration property sheet.
  105. Public Interface:
  106. CInetPropertySheet : Constructor
  107. ~CInetPropertySheet : Destructor
  108. cap : Get capabilities
  109. --*/
  110. {
  111. DECLARE_DYNAMIC(CInetPropertySheet)
  112. //
  113. // Construction/destruction
  114. //
  115. public:
  116. CInetPropertySheet(
  117. IN CComAuthInfo * pAuthInfo,
  118. IN LPCTSTR lpszMetaPath,
  119. IN CWnd * pParentWnd = NULL,
  120. IN LPARAM lParam = 0L,
  121. IN LPARAM lParamParentObject = 0L,
  122. IN UINT iSelectPage = 0
  123. );
  124. virtual ~CInetPropertySheet();
  125. //
  126. // Overrides
  127. //
  128. protected:
  129. //{{AFX_VIRTUAL(CInetPropertySheet)
  130. //}}AFX_VIRTUAL
  131. //
  132. // Access
  133. //
  134. public:
  135. BOOL IsLocal() const { return m_auth.IsLocal(); }
  136. BOOL IsMasterInstance() const { return m_fIsMasterPath; }
  137. BOOL HasAdminAccess() const { return m_fHasAdminAccess; }
  138. BOOL RestartRequired() const { return m_fRestartRequired; }
  139. DWORD QueryInstance() const { return m_dwInstance; }
  140. LPCTSTR QueryServerName() const { return m_auth.QueryServerName(); }
  141. LPCTSTR QueryMetaPath() const { return m_strMetaPath; }
  142. LPCTSTR QueryServicePath() const { return m_strServicePath; }
  143. LPCTSTR QueryInstancePath() const { return m_strInstancePath; }
  144. LPCTSTR QueryDirectoryPath() const { return m_strDirectoryPath; }
  145. LPCTSTR QueryInfoPath() const { return m_strInfoPath; }
  146. CComAuthInfo * QueryAuthInfo() { return &m_auth; }
  147. CServerCapabilities & cap() { return *m_pCap; }
  148. LPARAM GetParameter() {return m_lParam;}
  149. LPARAM GetParameterParent() {return m_lParamParentObject;}
  150. public:
  151. void AddRef()
  152. {
  153. ++m_refcount;
  154. }
  155. void Release(CInetPropertyPage * pPage)
  156. {
  157. DetachPage(pPage);
  158. if (--m_refcount <= 0)
  159. delete this;
  160. }
  161. void AttachPage(CInetPropertyPage * pPage);
  162. void NotifyMMC();
  163. void NotifyMMC_Node(CIISObject * pNode);
  164. void SetNotifyFlag(DWORD flag)
  165. {
  166. m_prop_change_flag |= flag;
  167. }
  168. void ResetNotifyFlag()
  169. {
  170. m_prop_change_flag = 0;
  171. }
  172. void SetModeless();
  173. BOOL IsModeless() const { return m_bModeless; }
  174. public:
  175. virtual void WinHelp(DWORD dwData, UINT nCmd = HELP_CONTEXT);
  176. //
  177. // Override in derived class to load delayed values
  178. //
  179. virtual HRESULT LoadConfigurationParameters();
  180. virtual void SetObjectsHwnd();
  181. virtual void FreeConfigurationParameters();
  182. void SetRestartRequired(BOOL flag,
  183. DWORD update_flag = PROP_CHANGE_REENUM_VDIR | PROP_CHANGE_REENUM_FILES);
  184. WORD QueryMajorVersion() const;
  185. WORD QueryMinorVersion() const;
  186. //
  187. // Generated message map functions
  188. //
  189. protected:
  190. //{{AFX_MSG(CInetPropertySheet)
  191. //}}AFX_MSG
  192. DECLARE_MESSAGE_MAP()
  193. void Initialize();
  194. void DetachPage(CInetPropertyPage * pPage);
  195. //
  196. // Attempt to resolve admin/operator access for the given
  197. // metbase path (instance path)
  198. //
  199. HRESULT DetermineAdminAccess(DWORD * pdwMetabaseSystemChangeNum);
  200. void SetIsMasterInstance(BOOL flag) {m_fIsMasterPath = flag;}
  201. protected:
  202. int m_refcount;
  203. DWORD m_prop_change_flag;
  204. BOOL m_fChanged;
  205. DWORD m_dwInstance;
  206. CString m_strMetaPath;
  207. CString m_strServicePath;
  208. CString m_strInstancePath;
  209. CString m_strDirectoryPath;
  210. CString m_strInfoPath;
  211. CComAuthInfo m_auth;
  212. private:
  213. BOOL m_bModeless;
  214. BOOL m_fHasAdminAccess;
  215. BOOL m_fIsMasterPath;
  216. BOOL m_fRestartRequired;
  217. LPARAM m_lParam;
  218. LPARAM m_lParamParentObject;
  219. CServerCapabilities * m_pCap;
  220. CList<CInetPropertyPage *, CInetPropertyPage *&> m_pages;
  221. };
  222. //
  223. // Page Definitions
  224. //
  225. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  226. class CInetPropertyPage : public CPropertyPage
  227. /*++
  228. Class Description:
  229. IIS Configuration property page class
  230. Public Interface:
  231. CInetPropertyPage : Constructor
  232. ~CInetPropertyPage : Destructor
  233. SaveInfo : Save info on this page if dirty
  234. --*/
  235. {
  236. DECLARE_DYNAMIC(CInetPropertyPage)
  237. //
  238. // Construction/Destruction
  239. //
  240. public:
  241. CInetPropertyPage(
  242. IN UINT nIDTemplate,
  243. IN CInetPropertySheet * pSheet,
  244. IN UINT nIDCaption = USE_DEFAULT_CAPTION,
  245. IN BOOL fEnableEnhancedFonts = FALSE
  246. );
  247. ~CInetPropertyPage();
  248. //
  249. // Dialog Data
  250. //
  251. protected:
  252. //{{AFX_DATA(CInetPropertyPage)
  253. //enum { IDD = _UNKNOWN_RESOURCE_ID_ };
  254. //}}AFX_DATA
  255. //
  256. // Overrides
  257. //
  258. public:
  259. //
  260. // Derived classes must provide their own equivalents
  261. //
  262. /* PURE */ virtual HRESULT FetchLoadedValues() = 0;
  263. /* PURE */ virtual HRESULT SaveInfo() = 0;
  264. //
  265. // Is the data on this page dirty?
  266. //
  267. BOOL IsDirty() const { return m_bChanged; }
  268. //{{AFX_VIRTUAL(CInetPropertyPage)
  269. protected:
  270. virtual void DoDataExchange(CDataExchange * pDX);
  271. virtual void PostNcDestroy();
  272. //}}AFX_VIRTUAL
  273. #ifdef _DEBUG
  274. virtual void AssertValid() const;
  275. virtual void Dump(CDumpContext & dc) const;
  276. #endif
  277. protected:
  278. //
  279. // Generated message map functions
  280. //
  281. //{{AFX_MSG(CInetPropertyPage)
  282. afx_msg void OnHelp();
  283. afx_msg BOOL OnHelpInfo(HELPINFO * pHelpInfo);
  284. //}}AFX_MSG
  285. DECLARE_MESSAGE_MAP()
  286. virtual BOOL OnInitDialog();
  287. virtual BOOL OnApply();
  288. virtual void OnCancel();
  289. //
  290. // Helper function
  291. //
  292. protected:
  293. BOOL GetIUsrAccount(CString & str);
  294. //
  295. // Access Functions
  296. //
  297. protected:
  298. //
  299. // Get associated property sheet object
  300. //
  301. CInetPropertySheet * GetSheet() { return m_pSheet; }
  302. BOOL IsLocal() const { return m_pSheet->IsLocal(); }
  303. BOOL IsMasterInstance() const { return m_pSheet->IsMasterInstance(); }
  304. BOOL HasAdminAccess() const { return m_pSheet->HasAdminAccess(); }
  305. DWORD QueryInstance() const { return m_pSheet->QueryInstance(); }
  306. LPCTSTR QueryServerName() const { return m_pSheet->QueryServerName(); }
  307. LPCTSTR QueryMetaPath() const { return m_pSheet->QueryMetaPath(); }
  308. LPCTSTR QueryServicePath() const { return m_pSheet->QueryServicePath(); }
  309. LPCTSTR QueryInstancePath() const { return m_pSheet->QueryInstancePath(); }
  310. LPCTSTR QueryDirectoryPath() const { return m_pSheet->QueryDirectoryPath(); }
  311. LPCTSTR QueryInfoPath() const { return m_pSheet->QueryInfoPath(); }
  312. CComAuthInfo * QueryAuthInfo() { return m_pSheet->QueryAuthInfo(); }
  313. HRESULT LoadConfigurationParameters() { return m_pSheet->LoadConfigurationParameters(); }
  314. //
  315. // Update MMC with new changes
  316. //
  317. void NotifyMMC(DWORD param = PROP_CHANGE_NOT_VISIBLE);
  318. public:
  319. //
  320. // Keep private information on page dirty state, necessary for
  321. // SaveInfo() later.
  322. //
  323. void SetModified(BOOL bChanged = TRUE);
  324. //
  325. // Capability bits
  326. //
  327. protected:
  328. BOOL IsSSLSupported() const { return m_pSheet->cap().IsSSLSupported(); }
  329. BOOL IsSSL128Supported() const { return m_pSheet->cap().IsSSL128Supported(); }
  330. BOOL HasMultipleSites() const { return m_pSheet->cap().HasMultipleSites(); }
  331. BOOL HasBwThrottling() const { return m_pSheet->cap().HasBwThrottling(); }
  332. BOOL Has10ConnectionLimit() const { return m_pSheet->cap().Has10ConnectionLimit(); }
  333. BOOL HasIPAccessCheck() const { return m_pSheet->cap().HasIPAccessCheck(); }
  334. BOOL HasOperatorList() const { return m_pSheet->cap().HasOperatorList(); }
  335. BOOL HasFrontPage() const { return m_pSheet->cap().HasFrontPage(); }
  336. BOOL HasCompression() const { return m_pSheet->cap().HasCompression(); }
  337. BOOL HasCPUThrottling() const { return m_pSheet->cap().HasCPUThrottling(); }
  338. BOOL HasDigest() const { return m_pSheet->cap().HasDigest(); }
  339. BOOL HasNTCertMapper() const { return m_pSheet->cap().HasNTCertMapper(); }
  340. BOOL IsCompressionConfigurable() const { return m_pSheet->cap().IsCompressionConfigurable(); }
  341. BOOL IsPerformanceConfigurable() const { return m_pSheet->cap().IsPerformanceConfigurable(); }
  342. BOOL IsServiceLevelConfigurable() const { return m_pSheet->cap().IsServiceLevelConfigurable(); }
  343. BOOL IsWorkstation() const { return m_pSheet->cap().IsWorkstation(); }
  344. protected:
  345. BOOL m_bChanged;
  346. CInetPropertySheet * m_pSheet;
  347. protected:
  348. BOOL m_fEnableEnhancedFonts;
  349. CFont m_fontBold;
  350. UINT m_nHelpContext;
  351. };
  352. //
  353. // Inline Expansion
  354. //
  355. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  356. inline void CInetPropertySheet::SetModeless()
  357. {
  358. m_bModeless = TRUE;
  359. }
  360. inline void CInetPropertySheet::SetRestartRequired(BOOL flag, DWORD update_flag)
  361. {
  362. m_fRestartRequired = flag;
  363. m_prop_change_flag = update_flag;
  364. }
  365. inline HRESULT CInetPropertySheet::DetermineAdminAccess(DWORD * pdwMetabaseSystemChangeNum)
  366. {
  367. //
  368. // Make sure this is called after parms are loaded.
  369. //
  370. return m_pCap ? ::DetermineIfAdministrator(
  371. m_pCap, // Reuse existing interface
  372. m_strMetaPath,
  373. &m_fHasAdminAccess,
  374. pdwMetabaseSystemChangeNum
  375. ) : E_FAIL;
  376. }
  377. inline BOOL CInetPropertyPage::GetIUsrAccount(CString & str)
  378. {
  379. return ::GetIUsrAccount(QueryServerName(), this, str);
  380. }
  381. inline void CInetPropertyPage::NotifyMMC(DWORD param)
  382. {
  383. m_pSheet->SetNotifyFlag(param);
  384. }
  385. #endif // __SHTS_H__