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.

448 lines
12 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 20002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // AdvancedDlg.cpp
  7. //
  8. // Maintained By:
  9. // Galen Barbee (GalenB) 10-APR-2002
  10. //
  11. //////////////////////////////////////////////////////////////////////////////
  12. #include "Pch.h"
  13. #include "AdvancedDlg.h"
  14. #include "WizardUtils.h"
  15. #include "WizardHelp.h"
  16. #include "SummaryPage.h"
  17. #include <HtmlHelp.h>
  18. //////////////////////////////////////////////////////////////////////////////
  19. // Constants
  20. //////////////////////////////////////////////////////////////////////////////
  21. DEFINE_THISCLASS("AdvancedDlg");
  22. //////////////////////////////////////////////////////////////////////////////
  23. // Context-sensitive help table.
  24. //////////////////////////////////////////////////////////////////////////////
  25. const DWORD g_rgidAdvancedDlgHelpIDs[] =
  26. {
  27. IDC_ADVANCED_RB_FULL_CONFIG, IDH_ADVANCED_RB_FULL_CONFIG,
  28. IDC_ADVANCED_S_FULL_CONFIG_DESC, IDH_ADVANCED_RB_FULL_CONFIG,
  29. IDC_ADVANCED_RB_MIN_CONFIG, IDH_ADVANCED_RB_MIN_CONFIG,
  30. IDC_ADVANCED_S_MIN_CONFIG_DESC, IDH_ADVANCED_RB_MIN_CONFIG,
  31. IDC_ADVANCED_S_MIN_CONFIG_DESC2, IDH_ADVANCED_RB_MIN_CONFIG,
  32. IDC_ADVANCED_S_MIN_CONFIG_DESC3, IDH_ADVANCED_RB_MIN_CONFIG,
  33. 0, 0
  34. };
  35. //////////////////////////////////////////////////////////////////////////////
  36. // Static Function Prototypes
  37. //////////////////////////////////////////////////////////////////////////////
  38. //////////////////////////////////////////////////////////////////////////////
  39. //++
  40. //
  41. // CAdvancedDlg::S_HrDisplayModalDialog
  42. //
  43. // Description:
  44. // Display the dialog box.
  45. //
  46. // Arguments:
  47. // hwndParentIn - Parent window for the dialog box.
  48. // pccwIn - CClusCfgWizard pointer for talking to the middle tier.
  49. // pssaOut - array of all the initial IsManaged states
  50. //
  51. // Return Values:
  52. // S_OK - Operation completed successfully.
  53. //
  54. // Remarks:
  55. //
  56. //--
  57. //////////////////////////////////////////////////////////////////////////////
  58. HRESULT
  59. CAdvancedDlg::S_HrDisplayModalDialog(
  60. HWND hwndParentIn
  61. , CClusCfgWizard * pccwIn
  62. )
  63. {
  64. TraceFunc( "" );
  65. Assert( pccwIn != NULL );
  66. HRESULT hr = S_OK;
  67. INT_PTR dlgResult = IDOK;
  68. //
  69. // Display the dialog.
  70. //
  71. {
  72. CAdvancedDlg dlg( pccwIn );
  73. dlgResult = DialogBoxParam(
  74. g_hInstance
  75. , MAKEINTRESOURCE( IDD_ADVANCED )
  76. , hwndParentIn
  77. , CAdvancedDlg::S_DlgProc
  78. , (LPARAM) &dlg
  79. );
  80. if ( dlgResult == IDOK )
  81. {
  82. hr = S_OK;
  83. } // if:
  84. else
  85. {
  86. hr = S_FALSE;
  87. } // else:
  88. }
  89. HRETURN( hr );
  90. } //*** CAdvancedDlg::S_HrDisplayModalDialog
  91. //////////////////////////////////////////////////////////////////////////////
  92. //++
  93. //
  94. // CAdvancedDlg::CAdvancedDlg
  95. //
  96. // Description:
  97. // Constructor.
  98. //
  99. // Arguments:
  100. // pccwIn - CClusCfgWizard for talking to the middle tier.
  101. //
  102. // Return Values:
  103. // None.
  104. //
  105. //--
  106. //////////////////////////////////////////////////////////////////////////////
  107. CAdvancedDlg::CAdvancedDlg(
  108. CClusCfgWizard * pccwIn
  109. )
  110. : m_pccw( pccwIn )
  111. {
  112. TraceFunc( "" );
  113. Assert( pccwIn != NULL );
  114. // m_hwnd
  115. m_pccw->AddRef();
  116. TraceFuncExit();
  117. } //*** CAdvancedDlg::CAdvancedDlg
  118. //////////////////////////////////////////////////////////////////////////////
  119. //++
  120. //
  121. // CAdvancedDlg::~CAdvancedDlg
  122. //
  123. // Description:
  124. // Destructor.
  125. //
  126. // Arguments:
  127. // None.
  128. //
  129. // Return Values:
  130. // None.
  131. //
  132. //--
  133. //////////////////////////////////////////////////////////////////////////////
  134. CAdvancedDlg::~CAdvancedDlg( void )
  135. {
  136. TraceFunc( "" );
  137. if ( m_pccw != NULL )
  138. {
  139. m_pccw->Release();
  140. } // if:
  141. TraceFuncExit();
  142. } //*** CAdvancedDlg::~CAdvancedDlg
  143. //////////////////////////////////////////////////////////////////////////////
  144. //++
  145. //
  146. // CAdvancedDlg::S_DlgProc
  147. //
  148. // Description:
  149. // Dialog proc for the Quorum dialog box.
  150. //
  151. // Arguments:
  152. // hwndDlgIn - Dialog box window handle.
  153. // nMsgIn - Message ID.
  154. // wParam - Message-specific parameter.
  155. // lParam - Message-specific parameter.
  156. //
  157. // Return Values:
  158. // TRUE - Message has been handled.
  159. // FALSE - Message has not been handled yet.
  160. //
  161. // Remarks:
  162. // It is expected that this dialog box is invoked by a call to
  163. // DialogBoxParam() with the lParam argument set to the address of the
  164. // instance of this class.
  165. //
  166. //--
  167. //////////////////////////////////////////////////////////////////////////////
  168. INT_PTR
  169. CALLBACK
  170. CAdvancedDlg::S_DlgProc(
  171. HWND hwndDlgIn
  172. , UINT nMsgIn
  173. , WPARAM wParam
  174. , LPARAM lParam
  175. )
  176. {
  177. // Don't do TraceFunc because every mouse movement
  178. // will cause this function to be called.
  179. WndMsg( hwndDlgIn, nMsgIn, wParam, lParam );
  180. LRESULT lr = FALSE;
  181. CAdvancedDlg * pdlg;
  182. //
  183. // Get a pointer to the class.
  184. //
  185. if ( nMsgIn == WM_INITDIALOG )
  186. {
  187. SetWindowLongPtr( hwndDlgIn, GWLP_USERDATA, lParam );
  188. pdlg = reinterpret_cast< CAdvancedDlg * >( lParam );
  189. pdlg->m_hwnd = hwndDlgIn;
  190. } // if:
  191. else
  192. {
  193. pdlg = reinterpret_cast< CAdvancedDlg * >( GetWindowLongPtr( hwndDlgIn, GWLP_USERDATA ) );
  194. } // else:
  195. if ( pdlg != NULL )
  196. {
  197. Assert( hwndDlgIn == pdlg->m_hwnd );
  198. switch( nMsgIn )
  199. {
  200. case WM_INITDIALOG:
  201. lr = pdlg->OnInitDialog();
  202. break;
  203. case WM_COMMAND:
  204. lr = pdlg->OnCommand( HIWORD( wParam ), LOWORD( wParam ), reinterpret_cast< HWND >( lParam ) );
  205. break;
  206. case WM_HELP:
  207. WinHelp(
  208. (HWND)((LPHELPINFO) lParam)->hItemHandle,
  209. CLUSCFG_HELP_FILE,
  210. HELP_WM_HELP,
  211. (ULONG_PTR) g_rgidAdvancedDlgHelpIDs
  212. );
  213. break;
  214. case WM_CONTEXTMENU:
  215. WinHelp(
  216. (HWND)wParam,
  217. CLUSCFG_HELP_FILE,
  218. HELP_CONTEXTMENU,
  219. (ULONG_PTR) g_rgidAdvancedDlgHelpIDs
  220. );
  221. break;
  222. // no default clause needed
  223. } // switch: nMsgIn
  224. } // if: page is specified
  225. return lr;
  226. } //*** CAdvancedDlg::S_DlgProc
  227. //////////////////////////////////////////////////////////////////////////////
  228. //++
  229. //
  230. // CAdvancedDlg::OnInitDialog
  231. //
  232. // Description:
  233. // Handler for the WM_INITDIALOG message.
  234. //
  235. // Arguments:
  236. // None.
  237. //
  238. // Return Values:
  239. // TRUE Focus has been set.
  240. // FALSE Focus has not been set.
  241. //--
  242. //////////////////////////////////////////////////////////////////////////////
  243. LRESULT
  244. CAdvancedDlg::OnInitDialog( void )
  245. {
  246. TraceFunc( "" );
  247. Assert( m_pccw != NULL );
  248. LRESULT lr = FALSE; // did not set focus
  249. HRESULT hr = S_OK;
  250. // EConfigurationSettings ecsConfigType = csFullConfig;
  251. // BOOL fValuePresent = FALSE;
  252. BOOL fMinConfig = FALSE;
  253. //
  254. // It's no big deal if we cannot read the settings from the registry
  255. // since everything defaults to full config.
  256. //
  257. // STHR( m_pccw->HrReadSettings( &ecsConfigType, &fValuePresent ) );
  258. //
  259. // If the value is not present then we have to get the minconfig state from
  260. // the wizard.
  261. //
  262. /*
  263. if ( fValuePresent == FALSE )
  264. {
  265. BOOL fMinConfig;
  266. hr = THR( m_pccw->get_MinimalConfiguration( &fMinConfig ) );
  267. if ( FAILED( hr ) )
  268. {
  269. goto Cleanup;
  270. } // if:
  271. if ( fMinConfig )
  272. {
  273. ecsConfigType = csMinConfig;
  274. } // if:
  275. } // if:
  276. SendDlgItemMessage( m_hwnd, IDC_ADVANCED_RB_MIN_CONFIG, BM_SETCHECK, ecsConfigType == csMinConfig ? BST_CHECKED : BST_UNCHECKED, 0 );
  277. SendDlgItemMessage( m_hwnd, IDC_ADVANCED_RB_FULL_CONFIG, BM_SETCHECK, ecsConfigType != csMinConfig ? BST_CHECKED : BST_UNCHECKED, 0 );
  278. SendDlgItemMessage( m_hwnd, IDC_ADVANCED_CB_MAKE_DEFAULT, BM_SETCHECK, fValuePresent ? BST_CHECKED : BST_UNCHECKED, 0 );
  279. */
  280. hr = THR( m_pccw->get_MinimumConfiguration( &fMinConfig ) );
  281. if ( FAILED( hr ) )
  282. {
  283. fMinConfig = FALSE;
  284. } // if:
  285. SendDlgItemMessage( m_hwnd, IDC_ADVANCED_RB_MIN_CONFIG, BM_SETCHECK, fMinConfig ? BST_CHECKED : BST_UNCHECKED, 0 );
  286. SendDlgItemMessage( m_hwnd, IDC_ADVANCED_RB_FULL_CONFIG, BM_SETCHECK, fMinConfig ? BST_UNCHECKED : BST_CHECKED, 0 );
  287. //Cleanup:
  288. RETURN( lr );
  289. } //*** CAdvancedDlg::OnInitDialog
  290. //////////////////////////////////////////////////////////////////////////////
  291. //++
  292. //
  293. // CAdvancedDlg::OnCommand
  294. //
  295. // Description:
  296. // Handler for the WM_COMMAND message.
  297. //
  298. // Arguments:
  299. // idNotificationIn - Notification code.
  300. // idControlIn - Control ID.
  301. // hwndSenderIn - Handle for the window that sent the message.
  302. //
  303. // Return Values:
  304. // TRUE - Message has been handled.
  305. // FALSE - Message has not been handled yet.
  306. //
  307. //--
  308. //////////////////////////////////////////////////////////////////////////////
  309. LRESULT
  310. CAdvancedDlg::OnCommand(
  311. UINT idNotificationIn
  312. , UINT idControlIn
  313. , HWND hwndSenderIn
  314. )
  315. {
  316. TraceFunc( "" );
  317. LRESULT lr = FALSE;
  318. switch ( idControlIn )
  319. {
  320. case IDOK:
  321. THR( HrOnOK() );
  322. EndDialog( m_hwnd, IDOK );
  323. break;
  324. case IDCANCEL:
  325. EndDialog( m_hwnd, IDCANCEL );
  326. break;
  327. case IDHELP:
  328. HtmlHelp( m_hwnd, L"mscsconcepts.chm::/SAG_MSCS3setup_21.htm", HH_DISPLAY_TOPIC, 0 );
  329. break;
  330. } // switch: idControlIn
  331. RETURN( lr );
  332. } //*** CAdvancedDlg::OnCommand
  333. //////////////////////////////////////////////////////////////////////////////
  334. //++
  335. //
  336. // CAdvancedDlg::HrOnOK
  337. //
  338. // Description:
  339. // Processing to be done when OK is pressed.
  340. //
  341. // Arguments:
  342. // None.
  343. //
  344. // Return Values:
  345. // S_OK
  346. // Success
  347. //
  348. //--
  349. //////////////////////////////////////////////////////////////////////////////
  350. HRESULT
  351. CAdvancedDlg::HrOnOK( void )
  352. {
  353. TraceFunc( "" );
  354. HRESULT hr = S_OK;
  355. LRESULT lr;
  356. BOOL fMinimalConfig = FALSE;
  357. // BOOL fMakeDefault = FALSE;
  358. lr = SendDlgItemMessage( m_hwnd, IDC_ADVANCED_RB_MIN_CONFIG, BM_GETCHECK, 0, 0 );
  359. fMinimalConfig = ( lr == BST_CHECKED );
  360. // lr = SendDlgItemMessage( m_hwnd, IDC_ADVANCED_CB_MAKE_DEFAULT, BM_GETCHECK, 0, 0 );
  361. // fMakeDefault = ( lr == BST_CHECKED );
  362. hr = THR( m_pccw->put_MinimumConfiguration( fMinimalConfig ) );
  363. if ( FAILED( hr ) )
  364. {
  365. goto Cleanup;
  366. } // if:
  367. //
  368. // It's okay if this fails because we have already set the config choice for this
  369. // session. It's no big deal if we cannot write the settings into the registry
  370. // since everything defaults to full config.
  371. //
  372. // THR( m_pccw->HrWriteSettings( fMinimalConfig ? csMinConfig : csFullConfig, !fMakeDefault ) );
  373. Cleanup:
  374. HRETURN( hr );
  375. } //*** CAdvancedDlg::HrOnOK