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.

386 lines
5.5 KiB

  1. /*++
  2. Copyright (c) 1994-2000 Microsoft Corporation
  3. Module Name :
  4. machsht.cpp
  5. Abstract:
  6. IIS Machine Property sheet classes
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Sergei Antonov (sergeia)
  10. Project:
  11. Internet Services Manager
  12. Revision History:
  13. --*/
  14. #include "stdafx.h"
  15. #include "common.h"
  16. #include "inetprop.h"
  17. #include "InetMgrApp.h"
  18. #include "shts.h"
  19. #include "machsht.h"
  20. #include "mime.h"
  21. #include <iisver.h>
  22. #ifdef _DEBUG
  23. #undef THIS_FILE
  24. static char BASED_CODE THIS_FILE[] = __FILE__;
  25. #endif
  26. #define new DEBUG_NEW
  27. //
  28. // CIISMachineSheet class
  29. //
  30. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  31. CIISMachineSheet::CIISMachineSheet(
  32. IN CComAuthInfo * pAuthInfo,
  33. IN LPCTSTR lpszMetaPath,
  34. IN CWnd * pParentWnd,
  35. IN LPARAM lParam,
  36. IN LONG_PTR handle,
  37. IN UINT iSelectPage
  38. )
  39. /*++
  40. Routine Description:
  41. IIS Machine Property sheet constructor
  42. Arguments:
  43. CComAuthInfo * pAuthInfo : Authentication information
  44. LPCTSTR lpszMetPath : Metabase path
  45. CWnd * pParentWnd : Optional parent window
  46. LPARAM lParam : MMC Console parameter
  47. LONG_PTR handle : MMC Console handle
  48. UINT iSelectPage : Initial page to be selected
  49. Return Value:
  50. N/A
  51. --*/
  52. : CInetPropertySheet(
  53. pAuthInfo,
  54. lpszMetaPath,
  55. pParentWnd,
  56. lParam,
  57. handle,
  58. iSelectPage
  59. ),
  60. m_ppropMachine(NULL)
  61. {
  62. }
  63. CIISMachineSheet::~CIISMachineSheet()
  64. /*++
  65. Routine Description:
  66. Sheet destructor
  67. Arguments:
  68. N/A
  69. Return Value:
  70. N/A
  71. --*/
  72. {
  73. FreeConfigurationParameters();
  74. }
  75. /* virtual */
  76. HRESULT
  77. CIISMachineSheet::LoadConfigurationParameters()
  78. /*++
  79. Routine Description:
  80. Load configuration parameters information
  81. Arguments:
  82. None
  83. Return Value:
  84. HRESULT
  85. --*/
  86. {
  87. //
  88. // Load base values
  89. //
  90. CError err(CInetPropertySheet::LoadConfigurationParameters());
  91. if (err.Failed())
  92. {
  93. return err;
  94. }
  95. ASSERT(m_ppropMachine == NULL);
  96. m_ppropMachine = new CMachineProps(QueryAuthInfo());
  97. if (!m_ppropMachine)
  98. {
  99. err = ERROR_NOT_ENOUGH_MEMORY;
  100. return err;
  101. }
  102. err = m_ppropMachine->LoadData();
  103. return err;
  104. }
  105. /* virtual */
  106. void
  107. CIISMachineSheet::FreeConfigurationParameters()
  108. /*++
  109. Routine Description:
  110. Clean up configuration data
  111. Arguments:
  112. None
  113. Return Value:
  114. None
  115. --*/
  116. {
  117. //
  118. // Free Base values
  119. //
  120. CInetPropertySheet::FreeConfigurationParameters();
  121. ASSERT_PTR(m_ppropMachine);
  122. SAFE_DELETE(m_ppropMachine);
  123. }
  124. //
  125. // Message Map
  126. //
  127. BEGIN_MESSAGE_MAP(CIISMachineSheet, CInetPropertySheet)
  128. //{{AFX_MSG_MAP(CInetPropertySheet)
  129. //}}AFX_MSG_MAP
  130. END_MESSAGE_MAP()
  131. IMPLEMENT_DYNCREATE(CIISMachinePage, CInetPropertyPage)
  132. CIISMachinePage::CIISMachinePage(
  133. IN CIISMachineSheet * pSheet
  134. )
  135. /*++
  136. Routine Description:
  137. Constructor.
  138. Arguments:
  139. CInetPropertySheet * pSheet : Associated property sheet
  140. Return Value:
  141. N/A
  142. --*/
  143. : CInetPropertyPage(CIISMachinePage::IDD, pSheet)
  144. {
  145. #if 0 // Keep classwizard happy
  146. //{{AFX_DATA_INIT(CIISMachinePage)
  147. //}}AFX_DATA_INIT
  148. #endif // 0
  149. }
  150. CIISMachinePage::~CIISMachinePage()
  151. /*++
  152. Routine Description:
  153. Destructor
  154. Arguments:
  155. N/A
  156. Return Value:
  157. N/A
  158. --*/
  159. {
  160. }
  161. void
  162. CIISMachinePage::DoDataExchange(
  163. IN CDataExchange * pDX
  164. )
  165. /*++
  166. Routine Description:
  167. Initialise/Store control data
  168. Arguments:
  169. CDataExchange * pDX - DDX/DDV control structure
  170. Return Value:
  171. None
  172. --*/
  173. {
  174. CInetPropertyPage::DoDataExchange(pDX);
  175. //{{AFX_DATA_MAP(CIISMachinePage)
  176. DDX_Control(pDX, IDC_ENABLE_MB_EDIT, m_EnableMetabaseEdit);
  177. DDX_Check(pDX, IDC_ENABLE_MB_EDIT, m_fEnableMetabaseEdit);
  178. //}}AFX_DATA_MAP
  179. }
  180. //
  181. // Message Map
  182. //
  183. BEGIN_MESSAGE_MAP(CIISMachinePage, CInetPropertyPage)
  184. //{{AFX_MSG_MAP(CIISMachinePage)
  185. ON_BN_CLICKED(IDC_ENABLE_MB_EDIT, OnCheckEnableEdit)
  186. //}}AFX_MSG_MAP
  187. END_MESSAGE_MAP()
  188. //
  189. // Message Handlers
  190. //
  191. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  192. /* virtual */
  193. HRESULT
  194. CIISMachinePage::FetchLoadedValues()
  195. /*++
  196. Routine Description:
  197. Move configuration data from sheet to dialog controls
  198. Arguments:
  199. None
  200. Return Value:
  201. HRESULT
  202. --*/
  203. {
  204. CError err;
  205. BEGIN_META_MACHINE_READ(CIISMachineSheet)
  206. FETCH_MACHINE_DATA_FROM_SHEET(m_fEnableMetabaseEdit)
  207. END_META_MACHINE_READ(err);
  208. return err;
  209. }
  210. /* virtual */
  211. HRESULT
  212. CIISMachinePage::SaveInfo()
  213. /*++
  214. Routine Description:
  215. Save the information on this property page.
  216. Arguments:
  217. None
  218. Return Value:
  219. Error return code
  220. --*/
  221. {
  222. ASSERT(IsDirty());
  223. CError err;
  224. BeginWaitCursor();
  225. BEGIN_META_MACHINE_WRITE(CIISMachineSheet)
  226. STORE_MACHINE_DATA_ON_SHEET(m_fEnableMetabaseEdit)
  227. END_META_MACHINE_WRITE(err);
  228. EndWaitCursor();
  229. return S_OK;
  230. }
  231. BOOL
  232. CIISMachinePage::OnInitDialog()
  233. /*++
  234. Routine Description:
  235. WM_INITDIALOG handler. Initialize the dialog.
  236. Arguments:
  237. None.
  238. Return Value:
  239. TRUE if no focus is to be set automatically, FALSE if the focus
  240. is already set.
  241. --*/
  242. {
  243. CInetPropertyPage::OnInitDialog();
  244. if ( GetSheet()->QueryMajorVersion() < VER_IISMAJORVERSION
  245. || GetSheet()->QueryMinorVersion() < VER_IISMINORVERSION
  246. )
  247. {
  248. m_EnableMetabaseEdit.EnableWindow(FALSE);
  249. }
  250. return TRUE;
  251. }
  252. void
  253. CIISMachinePage::OnCheckEnableEdit()
  254. {
  255. SetModified(TRUE);
  256. }