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.

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