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.

1062 lines
27 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2001 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // SummaryPage.cpp
  7. //
  8. // Maintained By:
  9. // David Potter (DavidP) 22-MAR-2001
  10. // Geoffrey Pease (GPease) 06-JUL-2000
  11. //
  12. //////////////////////////////////////////////////////////////////////////////
  13. #include "Pch.h"
  14. #include "SummaryPage.h"
  15. #include "QuorumDlg.h"
  16. #include "WizardUtils.h"
  17. DEFINE_THISCLASS("CSummaryPage");
  18. //////////////////////////////////////////////////////////////////////////////
  19. //++
  20. //
  21. // CSummaryPage::CSummaryPage
  22. //
  23. // Description:
  24. // Constructor.
  25. //
  26. // Arguments:
  27. // pspIn -- IServiceProvider
  28. // ecamCreateAddModeIn -- Creating cluster or adding nodes to cluster
  29. // pbstrClusterNameIn -- Name of the cluster
  30. // idsNextIn -- Resource ID for the Click Next string.
  31. //
  32. //--
  33. //////////////////////////////////////////////////////////////////////////////
  34. CSummaryPage::CSummaryPage(
  35. IServiceProvider * pspIn,
  36. ECreateAddMode ecamCreateAddModeIn,
  37. BSTR * pbstrClusterNameIn,
  38. UINT idsNextIn
  39. )
  40. {
  41. TraceFunc( "" );
  42. Assert( pspIn != NULL );
  43. Assert( pbstrClusterNameIn != NULL );
  44. Assert( idsNextIn != 0 );
  45. m_psp = pspIn;
  46. m_ecamCreateAddMode = ecamCreateAddModeIn;
  47. m_pbstrClusterName = pbstrClusterNameIn;
  48. m_idsNext = idsNextIn;
  49. TraceFuncExit();
  50. } //*** CSummaryPage::CSummaryPage()
  51. //////////////////////////////////////////////////////////////////////////////
  52. //++
  53. //
  54. // CSummaryPage::~CSummaryPage( void )
  55. //
  56. //--
  57. //////////////////////////////////////////////////////////////////////////////
  58. CSummaryPage::~CSummaryPage( void )
  59. {
  60. TraceFunc( "" );
  61. TraceFuncExit();
  62. } //*** CSummaryPage::~CSummaryPage()
  63. //////////////////////////////////////////////////////////////////////////////
  64. //++
  65. //
  66. // LRESULT
  67. // CSummaryPage::OnInitDialog( void )
  68. //
  69. //--
  70. //////////////////////////////////////////////////////////////////////////////
  71. LRESULT
  72. CSummaryPage::OnInitDialog( void )
  73. {
  74. TraceFunc( "" );
  75. LRESULT lr = FALSE; // don't have Windows set default focus
  76. HRESULT hr;
  77. BSTR bstrNext = NULL;
  78. BOOL fShowQuorumButton;
  79. //
  80. // Set the background color.
  81. //
  82. SendDlgItemMessage(
  83. m_hwnd
  84. , IDC_SUMMARY_RE_SUMMARY
  85. , EM_SETBKGNDCOLOR
  86. , 0
  87. , GetSysColor( COLOR_3DFACE )
  88. );
  89. //
  90. // Set the text of the Click Next control.
  91. //
  92. hr = HrLoadStringIntoBSTR( g_hInstance, m_idsNext, &bstrNext );
  93. if ( FAILED( hr ) )
  94. {
  95. goto Cleanup;
  96. }
  97. SetDlgItemText( m_hwnd, IDC_SUMMARY_S_NEXT, bstrNext );
  98. //
  99. // Hide the Quorum button if not creating a cluster.
  100. //
  101. fShowQuorumButton = ( m_ecamCreateAddMode == camCREATING );
  102. ShowWindow( GetDlgItem( m_hwnd, IDC_SUMMARY_PB_QUORUM ), fShowQuorumButton ? SW_SHOW : SW_HIDE );
  103. Cleanup:
  104. TraceSysFreeString( bstrNext );
  105. RETURN( lr );
  106. } //*** CSummaryPage::OnInitDialog()
  107. //////////////////////////////////////////////////////////////////////////////
  108. //++
  109. //
  110. // LRESULT
  111. // CSummaryPage::OnNotifySetActive( void )
  112. //
  113. //--
  114. //////////////////////////////////////////////////////////////////////////////
  115. LRESULT
  116. CSummaryPage::OnNotifySetActive( void )
  117. {
  118. TraceFunc( "" );
  119. HWND hwnd;
  120. HRESULT hr;
  121. DWORD dwClusterIPAddress;
  122. DWORD dwClusterSubnetMask;
  123. ULONG celtDummy;
  124. OBJECTCOOKIE cookieDummy;
  125. OBJECTCOOKIE cookieCluster;
  126. SETTEXTEX stex;
  127. CHARRANGE charrange;
  128. LRESULT lr = TRUE;
  129. BSTR bstr = NULL;
  130. BSTR bstrUsername = NULL;
  131. BSTR bstrPassword = NULL;
  132. BSTR bstrDomain = NULL;
  133. BSTR bstrNodeName = NULL;
  134. BSTR bstrResourceName = NULL;
  135. BSTR bstrNetworkName = NULL;
  136. IUnknown * punk = NULL;
  137. IObjectManager * pom = NULL;
  138. IClusCfgClusterInfo * pcci = NULL;
  139. IClusCfgNetworkInfo * pccni = NULL;
  140. IClusCfgCredentials * pccc = NULL;
  141. IEnumNodes * pen = NULL;
  142. IClusCfgNodeInfo * pccNode = NULL;
  143. IEnumClusCfgManagedResources * peccmr = NULL;
  144. IClusCfgManagedResourceInfo * pccmri = NULL;
  145. IEnumClusCfgNetworks * peccn = NULL;
  146. //
  147. // We're going to be using the control a lot. Grab the HWND to use.
  148. //
  149. hwnd = GetDlgItem( m_hwnd, IDC_SUMMARY_RE_SUMMARY );
  150. //
  151. // Empty the window
  152. //
  153. SetWindowText( hwnd, L"" );
  154. //
  155. // Initilize some stuff.
  156. //
  157. stex.flags = ST_SELECTION;
  158. stex.codepage = 1200; // no translation/unicode
  159. //
  160. // Find the cluster configuration information.
  161. //
  162. hr = THR( m_psp->TypeSafeQS( CLSID_ObjectManager,
  163. IObjectManager,
  164. &pom
  165. ) );
  166. if ( FAILED( hr ) )
  167. {
  168. goto Cleanup;
  169. }
  170. hr = THR( pom->FindObject( CLSID_ClusterConfigurationType,
  171. NULL,
  172. *m_pbstrClusterName,
  173. DFGUID_ClusterConfigurationInfo,
  174. &cookieCluster,
  175. &punk
  176. ) );
  177. if ( FAILED( hr ) )
  178. {
  179. goto Cleanup;
  180. }
  181. Assert( ( *m_pbstrClusterName != NULL ) && ( **m_pbstrClusterName != L'\0' ) );
  182. hr = THR( punk->TypeSafeQI( IClusCfgClusterInfo, &pcci ) );
  183. if ( FAILED( hr ) )
  184. {
  185. goto Cleanup;
  186. }
  187. punk->Release();
  188. punk = NULL;
  189. //
  190. // Name
  191. //
  192. hr = THR( HrFormatMessageIntoBSTR( g_hInstance,
  193. IDS_SUMMARY_CLUSTER_NAME,
  194. &bstr,
  195. *m_pbstrClusterName
  196. ) );
  197. if ( FAILED( hr ) )
  198. {
  199. goto Cleanup;
  200. }
  201. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr);
  202. //
  203. // IPAddress
  204. //
  205. hr = THR( pcci->GetIPAddress( &dwClusterIPAddress ) );
  206. if ( FAILED( hr ) )
  207. {
  208. goto Cleanup;
  209. }
  210. hr = THR( pcci->GetSubnetMask( &dwClusterSubnetMask ) );
  211. if ( FAILED( hr ) )
  212. {
  213. goto Cleanup;
  214. }
  215. Assert( dwClusterIPAddress != 0 );
  216. Assert( dwClusterSubnetMask != 0 );
  217. hr = THR( HrFormatMessageIntoBSTR( g_hInstance,
  218. IDS_SUMMARY_IPADDRESS,
  219. &bstr,
  220. FOURTH_IPADDRESS( dwClusterIPAddress ),
  221. THIRD_IPADDRESS( dwClusterIPAddress ),
  222. SECOND_IPADDRESS( dwClusterIPAddress ),
  223. FIRST_IPADDRESS( dwClusterIPAddress ),
  224. FOURTH_IPADDRESS( dwClusterSubnetMask ),
  225. THIRD_IPADDRESS( dwClusterSubnetMask ),
  226. SECOND_IPADDRESS( dwClusterSubnetMask ),
  227. FIRST_IPADDRESS( dwClusterSubnetMask )
  228. ) );
  229. if ( FAILED( hr ) )
  230. {
  231. goto Cleanup;
  232. }
  233. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  234. //
  235. // Network
  236. //
  237. hr = THR( HrLoadStringIntoBSTR( g_hInstance,
  238. IDS_SUMMARY_CLUSTER_NETWORK,
  239. &bstr
  240. ) );
  241. if ( FAILED( hr ) )
  242. {
  243. goto Cleanup;
  244. }
  245. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  246. hr = THR( pcci->GetNetworkInfo( &pccni ) );
  247. if ( FAILED( hr ) )
  248. {
  249. goto Cleanup;
  250. }
  251. hr = THR( HrFormatNetworkInfo( pccni, &bstr ) );
  252. if ( FAILED( hr ) )
  253. {
  254. goto Cleanup;
  255. }
  256. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  257. //
  258. // Credentials
  259. //
  260. hr = THR( pcci->GetClusterServiceAccountCredentials( &pccc ) );
  261. if ( FAILED( hr ) )
  262. {
  263. goto Cleanup;
  264. }
  265. hr = THR( pccc->GetCredentials( &bstrUsername, &bstrDomain, &bstrPassword ) );
  266. if ( FAILED( hr ) )
  267. {
  268. goto Cleanup;
  269. }
  270. Assert( ( bstrUsername != NULL ) && ( *bstrUsername != L'\0' ) );
  271. Assert( ( bstrDomain != NULL ) && ( *bstrDomain != L'\0' ) );
  272. Assert( ( bstrPassword != NULL ) && ( *bstrPassword != L'\0' ) );
  273. //
  274. // We don't want this!
  275. //
  276. ZeroMemory( bstrPassword, SysStringLen( bstrPassword ) * sizeof( bstrPassword[0] ) );
  277. TraceSysFreeString( bstrPassword );
  278. bstrPassword = NULL;
  279. hr = THR( HrFormatMessageIntoBSTR( g_hInstance,
  280. IDS_SUMMARY_CREDENTIALS,
  281. &bstr,
  282. bstrUsername,
  283. bstrDomain
  284. ) );
  285. if ( FAILED( hr ) )
  286. {
  287. goto Cleanup;
  288. }
  289. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  290. //
  291. // Members of cluster
  292. //
  293. hr = THR( HrLoadStringIntoBSTR( g_hInstance,
  294. IDS_SUMMARY_MEMBERSHIP_BEGIN,
  295. &bstr
  296. ) );
  297. if ( FAILED( hr ) )
  298. {
  299. goto Cleanup;
  300. }
  301. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  302. hr = THR( pom->FindObject( CLSID_NodeType,
  303. cookieCluster,
  304. NULL,
  305. DFGUID_EnumNodes,
  306. &cookieDummy,
  307. &punk
  308. ) );
  309. if ( FAILED( hr ) )
  310. {
  311. goto Cleanup;
  312. }
  313. hr = THR( punk->TypeSafeQI( IEnumNodes, &pen ) );
  314. if ( FAILED( hr ) )
  315. {
  316. goto Cleanup;
  317. }
  318. punk->Release();
  319. punk = NULL;
  320. for ( ;; )
  321. {
  322. TraceSysFreeString( bstrNodeName );
  323. bstrNodeName = NULL;
  324. if ( pccNode != NULL )
  325. {
  326. pccNode->Release();
  327. pccNode = NULL;
  328. }
  329. hr = STHR( pen->Next( 1, &pccNode, &celtDummy ) );
  330. if ( FAILED( hr ) )
  331. {
  332. goto Cleanup;
  333. }
  334. if ( hr == S_FALSE )
  335. {
  336. break; // exit condition
  337. }
  338. hr = THR( pccNode->GetName( &bstrNodeName ) );
  339. if ( FAILED( hr ) )
  340. {
  341. goto Cleanup;
  342. }
  343. Assert( ( bstrNodeName != NULL ) && ( *bstrNodeName != L'\0' ) );
  344. TraceMemoryAddBSTR( bstrNodeName );
  345. hr = THR( HrFormatMessageIntoBSTR( g_hInstance,
  346. IDS_SUMMARY_MEMBERSHIP_SEPARATOR,
  347. &bstr,
  348. bstrNodeName
  349. ) );
  350. if ( FAILED( hr ) )
  351. {
  352. goto Cleanup;
  353. }
  354. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  355. } // forever (loop exits when Next() returns S_FALSE)
  356. hr = THR( HrLoadStringIntoBSTR( g_hInstance,
  357. IDS_SUMMARY_MEMBERSHIP_END,
  358. &bstr
  359. ) );
  360. if ( FAILED( hr ) )
  361. {
  362. goto Cleanup;
  363. }
  364. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  365. //
  366. // Resources
  367. //
  368. hr = THR( HrLoadStringIntoBSTR( g_hInstance,
  369. IDS_SUMMARY_RESOURCES_BEGIN,
  370. &bstr
  371. ) );
  372. if ( FAILED( hr ) )
  373. {
  374. goto Cleanup;
  375. }
  376. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  377. hr = THR( pom->FindObject( CLSID_ManagedResourceType,
  378. cookieCluster,
  379. NULL,
  380. DFGUID_EnumManageableResources,
  381. &cookieDummy,
  382. &punk
  383. ) );
  384. if ( FAILED( hr ) )
  385. {
  386. goto Cleanup;
  387. }
  388. hr = THR( punk->TypeSafeQI( IEnumClusCfgManagedResources, &peccmr ) );
  389. if ( FAILED( hr ) )
  390. {
  391. goto Cleanup;
  392. }
  393. punk->Release();
  394. punk = NULL;
  395. while( hr == S_OK )
  396. {
  397. if ( pccmri != NULL )
  398. {
  399. pccmri->Release();
  400. pccmri = NULL;
  401. }
  402. TraceSysFreeString( bstrResourceName );
  403. bstrResourceName = NULL;
  404. hr = STHR( peccmr->Next( 1, &pccmri, &celtDummy ) );
  405. if ( FAILED( hr ) )
  406. {
  407. goto Cleanup;
  408. }
  409. if ( hr == S_FALSE )
  410. {
  411. break; // exit condition
  412. }
  413. hr = THR( pccmri->GetName( &bstrResourceName ) );
  414. if ( FAILED( hr ) )
  415. {
  416. goto Cleanup;
  417. }
  418. Assert( ( bstrResourceName != NULL ) && ( *bstrResourceName != L'\0' ) );
  419. TraceMemoryAddBSTR( bstrResourceName );
  420. hr = STHR( pccmri->IsManaged() );
  421. if ( FAILED( hr ) )
  422. goto Cleanup;
  423. if ( hr == S_OK )
  424. {
  425. hr = STHR( pccmri->IsQuorumDevice() );
  426. if ( FAILED( hr ) )
  427. {
  428. goto Cleanup;
  429. }
  430. if ( hr == S_OK )
  431. {
  432. hr = THR( HrFormatMessageIntoBSTR( g_hInstance,
  433. IDS_SUMMARY_RESOURCE_QUORUM_DEVICE,
  434. &bstr,
  435. bstrResourceName
  436. ) );
  437. if ( FAILED( hr ) )
  438. {
  439. goto Cleanup;
  440. }
  441. } // if: quorum resource
  442. else
  443. {
  444. hr = THR( HrFormatMessageIntoBSTR( g_hInstance,
  445. IDS_SUMMARY_RESOURCE_MANAGED,
  446. &bstr,
  447. bstrResourceName
  448. ) );
  449. if ( FAILED( hr ) )
  450. {
  451. goto Cleanup;
  452. }
  453. } // else: not quorum resource
  454. } // if: resource is managed
  455. else
  456. {
  457. hr = THR( HrFormatMessageIntoBSTR( g_hInstance,
  458. IDS_SUMMARY_RESOURCE_NOT_MANAGED,
  459. &bstr,
  460. bstrResourceName
  461. ) );
  462. if ( FAILED( hr ) )
  463. {
  464. goto Cleanup;
  465. }
  466. }
  467. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  468. }
  469. hr = THR( HrLoadStringIntoBSTR( g_hInstance,
  470. IDS_SUMMARY_RESOURCES_END,
  471. &bstr
  472. ) );
  473. if ( FAILED( hr ) )
  474. {
  475. goto Cleanup;
  476. }
  477. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  478. //
  479. // Networks
  480. //
  481. hr = THR( HrLoadStringIntoBSTR( g_hInstance,
  482. IDS_SUMMARY_NETWORKS_BEGIN,
  483. &bstr
  484. ) );
  485. if ( FAILED( hr ) )
  486. {
  487. goto Cleanup;
  488. }
  489. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  490. hr = THR( pom->FindObject( CLSID_NetworkType,
  491. cookieCluster,
  492. NULL,
  493. DFGUID_EnumManageableNetworks,
  494. &cookieDummy,
  495. &punk
  496. ) );
  497. if ( FAILED( hr ) )
  498. {
  499. goto Cleanup;
  500. }
  501. hr = THR( punk->TypeSafeQI( IEnumClusCfgNetworks, &peccn ) );
  502. if ( FAILED( hr ) )
  503. {
  504. goto Cleanup;
  505. }
  506. punk->Release();
  507. punk = NULL;
  508. while( hr == S_OK )
  509. {
  510. if ( pccni != NULL )
  511. {
  512. pccni->Release();
  513. pccni = NULL;
  514. }
  515. hr = STHR( peccn->Next( 1, &pccni, &celtDummy ) );
  516. if ( FAILED( hr ) )
  517. {
  518. goto Cleanup;
  519. }
  520. if ( hr == S_FALSE )
  521. {
  522. break; // exit condition
  523. }
  524. hr = THR( HrFormatNetworkInfo( pccni, &bstr ) );
  525. if ( FAILED( hr ) )
  526. {
  527. goto Cleanup;
  528. }
  529. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  530. }
  531. hr = THR( HrLoadStringIntoBSTR( g_hInstance,
  532. IDS_SUMMARY_NETWORKS_END,
  533. &bstr
  534. ) );
  535. if ( FAILED( hr ) )
  536. {
  537. goto Cleanup;
  538. }
  539. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  540. //
  541. // Done.
  542. //
  543. charrange.cpMax = 0;
  544. charrange.cpMin = 0;
  545. SendMessage( hwnd, EM_EXSETSEL, 0, (LPARAM) &charrange );
  546. PropSheet_SetWizButtons( GetParent( m_hwnd ), PSWIZB_BACK | PSWIZB_NEXT );
  547. hr = S_OK;
  548. Cleanup:
  549. TraceSysFreeString( bstrResourceName );
  550. TraceSysFreeString( bstrNodeName );
  551. TraceSysFreeString( bstrUsername );
  552. TraceSysFreeString( bstrDomain );
  553. TraceSysFreeString( bstr );
  554. if ( punk != NULL )
  555. {
  556. punk->Release();
  557. }
  558. if ( peccn != NULL )
  559. {
  560. peccn->Release();
  561. }
  562. if ( pccmri != NULL )
  563. {
  564. pccmri->Release();
  565. }
  566. if ( peccmr != NULL )
  567. {
  568. peccmr->Release();
  569. }
  570. if ( pccNode != NULL )
  571. {
  572. pccNode->Release();
  573. }
  574. if ( pen != NULL )
  575. {
  576. pen->Release();
  577. }
  578. if ( pccni != NULL )
  579. {
  580. pccni->Release();
  581. }
  582. if ( pcci != NULL )
  583. {
  584. pcci->Release();
  585. }
  586. if ( pom != NULL )
  587. {
  588. pom->Release();
  589. }
  590. RETURN( lr );
  591. } //*** CSummaryPage::OnNotifySetActive()
  592. //////////////////////////////////////////////////////////////////////////////
  593. //++
  594. //
  595. // LRESULT
  596. // CSummaryPage::OnNotifyQueryCancel( void )
  597. //
  598. //--
  599. //////////////////////////////////////////////////////////////////////////////
  600. LRESULT
  601. CSummaryPage::OnNotifyQueryCancel( void )
  602. {
  603. TraceFunc( "" );
  604. LRESULT lr = TRUE;
  605. int iRet;
  606. iRet = MessageBoxFromStrings( m_hwnd,
  607. IDS_QUERY_CANCEL_TITLE,
  608. IDS_QUERY_CANCEL_TEXT,
  609. MB_YESNO
  610. );
  611. if ( iRet == IDNO )
  612. {
  613. SetWindowLongPtr( m_hwnd, DWLP_MSGRESULT, -1 );
  614. }
  615. RETURN( lr );
  616. } //*** CSummaryPage::OnNotifyQueryCancel()
  617. //////////////////////////////////////////////////////////////////////////////
  618. //++
  619. //
  620. // LRESULT
  621. // CSummaryPage::OnNotify(
  622. // WPARAM idCtrlIn,
  623. // LPNMHDR pnmhdrIn
  624. // )
  625. //
  626. //--
  627. //////////////////////////////////////////////////////////////////////////////
  628. LRESULT
  629. CSummaryPage::OnNotify(
  630. WPARAM idCtrlIn,
  631. LPNMHDR pnmhdrIn
  632. )
  633. {
  634. TraceFunc( "" );
  635. LRESULT lr = TRUE;
  636. SetWindowLongPtr( m_hwnd, DWLP_MSGRESULT, 0 );
  637. switch ( pnmhdrIn->code )
  638. {
  639. case PSN_SETACTIVE:
  640. lr = OnNotifySetActive();
  641. break;
  642. case PSN_QUERYCANCEL:
  643. lr = OnNotifyQueryCancel();
  644. break;
  645. } // switch: notification code
  646. RETURN( lr );
  647. } //*** CSummaryPage::OnNotify()
  648. //////////////////////////////////////////////////////////////////////////////
  649. //++
  650. //
  651. // LRESULT
  652. // CSummaryPage::OnCommand(
  653. // UINT idNotificationIn,
  654. // UINT idControlIn,
  655. // HWND hwndSenderIn
  656. // )
  657. //
  658. //--
  659. //////////////////////////////////////////////////////////////////////////////
  660. LRESULT
  661. CSummaryPage::OnCommand(
  662. UINT idNotificationIn,
  663. UINT idControlIn,
  664. HWND hwndSenderIn
  665. )
  666. {
  667. TraceFunc( "" );
  668. LRESULT lr = FALSE;
  669. HRESULT hr = S_OK;
  670. switch ( idControlIn )
  671. {
  672. case IDC_SUMMARY_PB_VIEW_LOG:
  673. if ( idNotificationIn == BN_CLICKED )
  674. {
  675. THR( HrViewLogFile( m_hwnd ) );
  676. lr = TRUE;
  677. } // if: button click
  678. break;
  679. case IDC_SUMMARY_PB_QUORUM:
  680. if ( idNotificationIn == BN_CLICKED )
  681. {
  682. hr = STHR( CQuorumDlg::S_HrDisplayModalDialog( m_hwnd, m_psp, *m_pbstrClusterName ) );
  683. if ( hr == S_OK )
  684. {
  685. OnNotifySetActive();
  686. }
  687. lr = TRUE;
  688. }
  689. break;
  690. } // switch: idControlIn
  691. RETURN( lr );
  692. } //*** CSummaryPage::OnCommand()
  693. //////////////////////////////////////////////////////////////////////////////
  694. //++
  695. //
  696. // INT_PTR
  697. // CALLBACK
  698. // CSummaryPage::S_DlgProc(
  699. // HWND hwndDlgIn,
  700. // UINT nMsgIn,
  701. // WPARAM wParam,
  702. // LPARAM lParam
  703. // )
  704. //
  705. //--
  706. //////////////////////////////////////////////////////////////////////////////
  707. INT_PTR
  708. CALLBACK
  709. CSummaryPage::S_DlgProc(
  710. HWND hwndDlgIn,
  711. UINT nMsgIn,
  712. WPARAM wParam,
  713. LPARAM lParam
  714. )
  715. {
  716. // Don't do TraceFunc because every mouse movement
  717. // will cause this function to be called.
  718. WndMsg( hwndDlgIn, nMsgIn, wParam, lParam );
  719. LRESULT lr = FALSE;
  720. CSummaryPage * pPage;
  721. if ( nMsgIn == WM_INITDIALOG )
  722. {
  723. PROPSHEETPAGE * ppage = reinterpret_cast< PROPSHEETPAGE * >( lParam );
  724. SetWindowLongPtr( hwndDlgIn, GWLP_USERDATA, (LPARAM) ppage->lParam );
  725. pPage = reinterpret_cast< CSummaryPage * >( ppage->lParam );
  726. pPage->m_hwnd = hwndDlgIn;
  727. }
  728. else
  729. {
  730. pPage = reinterpret_cast< CSummaryPage *> ( GetWindowLongPtr( hwndDlgIn, GWLP_USERDATA ) );
  731. }
  732. if ( pPage != NULL )
  733. {
  734. Assert( hwndDlgIn == pPage->m_hwnd );
  735. switch ( nMsgIn )
  736. {
  737. case WM_INITDIALOG:
  738. lr = pPage->OnInitDialog();
  739. break;
  740. case WM_NOTIFY:
  741. lr = pPage->OnNotify( wParam, reinterpret_cast< LPNMHDR >( lParam ) );
  742. break;
  743. case WM_COMMAND:
  744. lr = pPage->OnCommand( HIWORD( wParam ), LOWORD( wParam ), reinterpret_cast< HWND >( lParam ) );
  745. break;
  746. // no default clause needed
  747. } // switch: nMsgIn
  748. } // if: page is available
  749. return lr;
  750. } //*** CSummaryPage::S_DlgProc()
  751. //////////////////////////////////////////////////////////////////////////////
  752. //++
  753. //
  754. // HRESULT
  755. // CSummaryPage::HrFormatNetworkInfo(
  756. // IClusCfgNetworkInfo * pccniIn,
  757. // BSTR * pbstrOut
  758. // )
  759. //
  760. //--
  761. //////////////////////////////////////////////////////////////////////////////
  762. HRESULT
  763. CSummaryPage::HrFormatNetworkInfo(
  764. IClusCfgNetworkInfo * pccniIn,
  765. BSTR * pbstrOut
  766. )
  767. {
  768. TraceFunc( "" );
  769. HRESULT hr;
  770. DWORD dwNetworkIPAddress;
  771. DWORD dwNetworkSubnetMask;
  772. BSTR bstrNetworkName = NULL;
  773. BSTR bstrNetworkDescription = NULL;
  774. BSTR bstrNetworkUsage = NULL;
  775. IClusCfgIPAddressInfo * pccipai = NULL;
  776. hr = THR( pccniIn->GetName( &bstrNetworkName ) );
  777. if ( FAILED( hr ) )
  778. {
  779. goto Cleanup;
  780. }
  781. Assert( ( bstrNetworkName != NULL ) && ( *bstrNetworkName != L'\0' ) );
  782. TraceMemoryAddBSTR( bstrNetworkName );
  783. hr = THR( pccniIn->GetDescription( &bstrNetworkDescription ) );
  784. if ( FAILED( hr ) )
  785. {
  786. goto Cleanup;
  787. }
  788. TraceMemoryAddBSTR( bstrNetworkDescription );
  789. hr = STHR( pccniIn->IsPublic() );
  790. if ( FAILED( hr ) )
  791. {
  792. goto Cleanup;
  793. }
  794. if ( hr == S_OK )
  795. {
  796. hr = THR( HrLoadStringIntoBSTR( g_hInstance,
  797. IDS_SUMMARY_NETWORK_PUBLIC,
  798. &bstrNetworkUsage
  799. ) );
  800. if ( FAILED( hr ) )
  801. {
  802. goto Cleanup;
  803. }
  804. } // if: public network
  805. hr = STHR( pccniIn->IsPrivate() );
  806. if ( FAILED( hr ) )
  807. {
  808. goto Cleanup;
  809. }
  810. if ( hr == S_OK )
  811. {
  812. if ( bstrNetworkUsage == NULL )
  813. {
  814. hr = THR( HrLoadStringIntoBSTR( g_hInstance,
  815. IDS_SUMMARY_NETWORK_PRIVATE,
  816. &bstrNetworkUsage
  817. ) );
  818. if ( FAILED( hr ) )
  819. {
  820. goto Cleanup;
  821. }
  822. } // if: not public network
  823. else
  824. {
  825. hr = THR( HrLoadStringIntoBSTR( g_hInstance,
  826. IDS_SUMMARY_NETWORK_BOTH,
  827. &bstrNetworkUsage
  828. ) );
  829. if ( FAILED( hr ) )
  830. {
  831. goto Cleanup;
  832. }
  833. } // else: public network
  834. } // if: private network
  835. else if ( bstrNetworkUsage == NULL )
  836. {
  837. hr = THR( HrLoadStringIntoBSTR( g_hInstance,
  838. IDS_SUMMARY_NETWORK_NOTUSED,
  839. &bstrNetworkUsage
  840. ) );
  841. if ( FAILED( hr ) )
  842. {
  843. goto Cleanup;
  844. }
  845. } // else: not private or public network
  846. hr = THR( pccniIn->GetPrimaryNetworkAddress( &pccipai ) );
  847. if ( FAILED( hr ) )
  848. {
  849. goto Cleanup;
  850. }
  851. hr = THR( pccipai->GetIPAddress( &dwNetworkIPAddress ) );
  852. if ( FAILED( hr ) )
  853. {
  854. goto Cleanup;
  855. }
  856. hr = THR( pccipai->GetSubnetMask( &dwNetworkSubnetMask ) );
  857. if ( FAILED( hr ) )
  858. {
  859. goto Cleanup;
  860. }
  861. Assert( dwNetworkIPAddress != 0 );
  862. Assert( dwNetworkSubnetMask != 0 );
  863. hr = THR( HrFormatMessageIntoBSTR( g_hInstance,
  864. IDS_SUMMARY_NETWORK_INFO,
  865. pbstrOut,
  866. bstrNetworkName,
  867. bstrNetworkDescription,
  868. bstrNetworkUsage,
  869. FOURTH_IPADDRESS( dwNetworkIPAddress ),
  870. THIRD_IPADDRESS( dwNetworkIPAddress ),
  871. SECOND_IPADDRESS( dwNetworkIPAddress ),
  872. FIRST_IPADDRESS( dwNetworkIPAddress ),
  873. FOURTH_IPADDRESS( dwNetworkSubnetMask ),
  874. THIRD_IPADDRESS( dwNetworkSubnetMask ),
  875. SECOND_IPADDRESS( dwNetworkSubnetMask ),
  876. FIRST_IPADDRESS( dwNetworkSubnetMask )
  877. ) );
  878. if ( FAILED( hr ) )
  879. {
  880. goto Cleanup;
  881. }
  882. Cleanup:
  883. if ( pccipai != NULL )
  884. {
  885. pccipai->Release();
  886. }
  887. TraceSysFreeString( bstrNetworkUsage );
  888. TraceSysFreeString( bstrNetworkName );
  889. TraceSysFreeString( bstrNetworkDescription );
  890. HRETURN( hr );
  891. } //*** CSummaryPage::HrEditStreamCallback()