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.

1694 lines
42 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2002 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. // pccwIn -- CClusCfgWizard
  28. // ecamCreateAddModeIn -- Creating cluster or adding nodes to cluster
  29. // idsNextIn -- Resource ID for the Click Next string.
  30. //
  31. //--
  32. //////////////////////////////////////////////////////////////////////////////
  33. CSummaryPage::CSummaryPage(
  34. CClusCfgWizard * pccwIn,
  35. ECreateAddMode ecamCreateAddModeIn,
  36. UINT idsNextIn
  37. )
  38. : m_pccw( pccwIn )
  39. {
  40. TraceFunc( "" );
  41. Assert( pccwIn != NULL );
  42. Assert( idsNextIn != 0 );
  43. m_pccw->AddRef();
  44. m_ecamCreateAddMode = ecamCreateAddModeIn;
  45. m_idsNext = idsNextIn;
  46. m_ssa.bInitialized = FALSE;
  47. m_ssa.cCount = 0;
  48. m_ssa.prsArray = NULL;
  49. TraceFuncExit();
  50. } //*** CSummaryPage::CSummaryPage
  51. //////////////////////////////////////////////////////////////////////////////
  52. //++
  53. //
  54. // CSummaryPage::~CSummaryPage( void )
  55. //
  56. //--
  57. //////////////////////////////////////////////////////////////////////////////
  58. CSummaryPage::~CSummaryPage( void )
  59. {
  60. TraceFunc( "" );
  61. if ( m_pccw != NULL )
  62. {
  63. m_pccw->Release();
  64. }
  65. delete [] m_ssa.prsArray;
  66. TraceFuncExit();
  67. } //*** CSummaryPage::~CSummaryPage
  68. //////////////////////////////////////////////////////////////////////////////
  69. //++
  70. //
  71. // LRESULT
  72. // CSummaryPage::OnInitDialog( void )
  73. //
  74. //--
  75. //////////////////////////////////////////////////////////////////////////////
  76. LRESULT
  77. CSummaryPage::OnInitDialog( void )
  78. {
  79. TraceFunc( "" );
  80. LRESULT lr = FALSE; // don't have Windows set default focus
  81. HRESULT hr;
  82. BSTR bstrNext = NULL;
  83. BOOL fShowQuorumButton;
  84. //
  85. // Set the background color.
  86. //
  87. SendDlgItemMessage(
  88. m_hwnd
  89. , IDC_SUMMARY_RE_SUMMARY
  90. , EM_SETBKGNDCOLOR
  91. , 0
  92. , GetSysColor( COLOR_3DFACE )
  93. );
  94. //
  95. // Set the text of the Click Next control.
  96. //
  97. hr = HrLoadStringIntoBSTR( g_hInstance, m_idsNext, &bstrNext );
  98. if ( FAILED( hr ) )
  99. {
  100. goto Cleanup;
  101. }
  102. SetDlgItemText( m_hwnd, IDC_SUMMARY_S_NEXT, bstrNext );
  103. //
  104. // Hide the Quorum button if not creating a cluster.
  105. //
  106. fShowQuorumButton = ( m_ecamCreateAddMode == camCREATING );
  107. ShowWindow( GetDlgItem( m_hwnd, IDC_SUMMARY_PB_QUORUM ), fShowQuorumButton ? SW_SHOW : SW_HIDE );
  108. Cleanup:
  109. TraceSysFreeString( bstrNext );
  110. RETURN( lr );
  111. } //*** CSummaryPage::OnInitDialog
  112. //////////////////////////////////////////////////////////////////////////////
  113. //++
  114. //
  115. // LRESULT
  116. // CSummaryPage::OnNotifySetActive( void )
  117. //
  118. //--
  119. //////////////////////////////////////////////////////////////////////////////
  120. LRESULT
  121. CSummaryPage::OnNotifySetActive( void )
  122. {
  123. TraceFunc( "" );
  124. HWND hwnd = NULL;
  125. HRESULT hr = S_OK;
  126. DWORD dwClusterIPAddress = 0;
  127. DWORD dwClusterSubnetMask = 0;
  128. SETTEXTEX stex;
  129. CHARRANGE charrange;
  130. LRESULT lr = TRUE;
  131. BSTR bstr = NULL;
  132. BSTR bstrClusterName = NULL;
  133. IClusCfgClusterInfo * pcci = NULL;
  134. IClusCfgNetworkInfo * pccni = NULL;
  135. //
  136. // We're going to be using the control a lot. Grab the HWND to use.
  137. //
  138. hwnd = GetDlgItem( m_hwnd, IDC_SUMMARY_RE_SUMMARY );
  139. //
  140. // Empty the window
  141. //
  142. SetWindowText( hwnd, L"" );
  143. //
  144. // Initilize some stuff.
  145. //
  146. stex.flags = ST_SELECTION;
  147. stex.codepage = 1200; // no translation/unicode
  148. //
  149. // Find the cluster configuration information.
  150. //
  151. hr = THR( m_pccw->HrGetClusterObject( &pcci ) );
  152. if ( FAILED( hr ) )
  153. {
  154. goto Cleanup;
  155. }
  156. //
  157. // Name
  158. //
  159. hr = THR( m_pccw->get_ClusterName( &bstrClusterName ) );
  160. if ( FAILED( hr ) )
  161. {
  162. goto Cleanup;
  163. }
  164. TraceMemoryAddBSTR( bstrClusterName );
  165. hr = THR( HrFormatMessageIntoBSTR( g_hInstance, IDS_SUMMARY_CLUSTER_NAME, &bstr, bstrClusterName ) );
  166. if ( FAILED( hr ) )
  167. {
  168. goto Cleanup;
  169. }
  170. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr);
  171. //
  172. // IPAddress
  173. //
  174. hr = THR( pcci->GetIPAddress( &dwClusterIPAddress ) );
  175. if ( FAILED( hr ) )
  176. {
  177. goto Cleanup;
  178. }
  179. hr = THR( pcci->GetSubnetMask( &dwClusterSubnetMask ) );
  180. if ( FAILED( hr ) )
  181. {
  182. goto Cleanup;
  183. }
  184. Assert( dwClusterIPAddress != 0 );
  185. Assert( dwClusterSubnetMask != 0 );
  186. hr = THR( HrFormatMessageIntoBSTR( g_hInstance,
  187. IDS_SUMMARY_IPADDRESS,
  188. &bstr,
  189. FOURTH_IPADDRESS( dwClusterIPAddress ),
  190. THIRD_IPADDRESS( dwClusterIPAddress ),
  191. SECOND_IPADDRESS( dwClusterIPAddress ),
  192. FIRST_IPADDRESS( dwClusterIPAddress ),
  193. FOURTH_IPADDRESS( dwClusterSubnetMask ),
  194. THIRD_IPADDRESS( dwClusterSubnetMask ),
  195. SECOND_IPADDRESS( dwClusterSubnetMask ),
  196. FIRST_IPADDRESS( dwClusterSubnetMask )
  197. ) );
  198. if ( FAILED( hr ) )
  199. {
  200. goto Cleanup;
  201. }
  202. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  203. //
  204. // Network
  205. //
  206. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_CLUSTER_NETWORK, &bstr ) );
  207. if ( FAILED( hr ) )
  208. {
  209. goto Cleanup;
  210. }
  211. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  212. hr = THR( pcci->GetNetworkInfo( &pccni ) );
  213. if ( FAILED( hr ) )
  214. {
  215. goto Cleanup;
  216. }
  217. hr = THR( HrFormatNetworkInfo( pccni, &bstr ) );
  218. if ( FAILED( hr ) )
  219. {
  220. goto Cleanup;
  221. }
  222. SendMessage( hwnd, EM_SETTEXTEX, (WPARAM) &stex, (LPARAM) bstr );
  223. //
  224. // Credentials
  225. //
  226. hr = THR( HrCredentialsSummary( hwnd, &stex, pcci ) );
  227. if ( FAILED( hr ) )
  228. {
  229. goto Cleanup;
  230. }
  231. //
  232. // Members of cluster
  233. //
  234. hr = THR( HrNodeSummary( hwnd, &stex ) );
  235. if ( FAILED( hr ) )
  236. {
  237. goto Cleanup;
  238. }
  239. //
  240. // Resources
  241. //
  242. hr = THR( HrResourceSummary( hwnd, &stex ) );
  243. if ( FAILED( hr ) )
  244. {
  245. goto Cleanup;
  246. }
  247. //
  248. // Networks
  249. //
  250. hr = THR( HrNetworkSummary( hwnd, &stex ) );
  251. if ( FAILED( hr ) )
  252. {
  253. goto Cleanup;
  254. }
  255. //
  256. // Done.
  257. //
  258. charrange.cpMax = 0;
  259. charrange.cpMin = 0;
  260. SendMessage( hwnd, EM_EXSETSEL, 0, (LPARAM) &charrange );
  261. PropSheet_SetWizButtons( GetParent( m_hwnd ), PSWIZB_BACK | PSWIZB_NEXT );
  262. Cleanup:
  263. TraceSysFreeString( bstr );
  264. TraceSysFreeString( bstrClusterName );
  265. if ( pccni != NULL )
  266. {
  267. pccni->Release();
  268. }
  269. if ( pcci != NULL )
  270. {
  271. pcci->Release();
  272. }
  273. RETURN( lr );
  274. } //*** CSummaryPage::OnNotifySetActive
  275. //////////////////////////////////////////////////////////////////////////////
  276. //++
  277. //
  278. // LRESULT
  279. // CSummaryPage::OnNotifyQueryCancel( void )
  280. //
  281. //--
  282. //////////////////////////////////////////////////////////////////////////////
  283. LRESULT
  284. CSummaryPage::OnNotifyQueryCancel( void )
  285. {
  286. TraceFunc( "" );
  287. LRESULT lr = TRUE;
  288. int iRet;
  289. iRet = MessageBoxFromStrings( m_hwnd, IDS_QUERY_CANCEL_TITLE, IDS_QUERY_CANCEL_TEXT, MB_YESNO );
  290. if ( iRet == IDNO )
  291. {
  292. SetWindowLongPtr( m_hwnd, DWLP_MSGRESULT, -1 );
  293. } // if:
  294. else
  295. {
  296. THR( m_pccw->HrLaunchCleanupTask() );
  297. } // else:
  298. RETURN( lr );
  299. } //*** CSummaryPage::OnNotifyQueryCancel
  300. //////////////////////////////////////////////////////////////////////////////
  301. //++
  302. //
  303. // LRESULT
  304. // CSummaryPage::OnNotify(
  305. // WPARAM idCtrlIn,
  306. // LPNMHDR pnmhdrIn
  307. // )
  308. //
  309. //--
  310. //////////////////////////////////////////////////////////////////////////////
  311. LRESULT
  312. CSummaryPage::OnNotify(
  313. WPARAM idCtrlIn,
  314. LPNMHDR pnmhdrIn
  315. )
  316. {
  317. TraceFunc( "" );
  318. LRESULT lr = TRUE;
  319. SetWindowLongPtr( m_hwnd, DWLP_MSGRESULT, 0 );
  320. switch ( pnmhdrIn->code )
  321. {
  322. case PSN_SETACTIVE:
  323. lr = OnNotifySetActive();
  324. break;
  325. case PSN_QUERYCANCEL:
  326. lr = OnNotifyQueryCancel();
  327. break;
  328. } // switch: notification code
  329. RETURN( lr );
  330. } //*** CSummaryPage::OnNotify
  331. //////////////////////////////////////////////////////////////////////////////
  332. //++
  333. //
  334. // LRESULT
  335. // CSummaryPage::OnCommand(
  336. // UINT idNotificationIn,
  337. // UINT idControlIn,
  338. // HWND hwndSenderIn
  339. // )
  340. //
  341. //--
  342. //////////////////////////////////////////////////////////////////////////////
  343. LRESULT
  344. CSummaryPage::OnCommand(
  345. UINT idNotificationIn,
  346. UINT idControlIn,
  347. HWND hwndSenderIn
  348. )
  349. {
  350. TraceFunc( "" );
  351. LRESULT lr = FALSE;
  352. HRESULT hr = S_OK;
  353. switch ( idControlIn )
  354. {
  355. case IDC_SUMMARY_PB_VIEW_LOG:
  356. if ( idNotificationIn == BN_CLICKED )
  357. {
  358. THR( HrViewLogFile( m_hwnd ) );
  359. lr = TRUE;
  360. } // if: button click
  361. break;
  362. case IDC_SUMMARY_PB_QUORUM:
  363. if ( idNotificationIn == BN_CLICKED )
  364. {
  365. hr = STHR( CQuorumDlg::S_HrDisplayModalDialog( m_hwnd, m_pccw, &m_ssa ) );
  366. if ( hr == S_OK )
  367. {
  368. OnNotifySetActive();
  369. }
  370. lr = TRUE;
  371. }
  372. break;
  373. } // switch: idControlIn
  374. RETURN( lr );
  375. } //*** CSummaryPage::OnCommand
  376. //////////////////////////////////////////////////////////////////////////////
  377. //++
  378. //
  379. // INT_PTR
  380. // CALLBACK
  381. // CSummaryPage::S_DlgProc(
  382. // HWND hwndDlgIn,
  383. // UINT nMsgIn,
  384. // WPARAM wParam,
  385. // LPARAM lParam
  386. // )
  387. //
  388. //--
  389. //////////////////////////////////////////////////////////////////////////////
  390. INT_PTR
  391. CALLBACK
  392. CSummaryPage::S_DlgProc(
  393. HWND hwndDlgIn,
  394. UINT nMsgIn,
  395. WPARAM wParam,
  396. LPARAM lParam
  397. )
  398. {
  399. // Don't do TraceFunc because every mouse movement
  400. // will cause this function to be called.
  401. WndMsg( hwndDlgIn, nMsgIn, wParam, lParam );
  402. LRESULT lr = FALSE;
  403. CSummaryPage * pPage;
  404. if ( nMsgIn == WM_INITDIALOG )
  405. {
  406. PROPSHEETPAGE * ppage = reinterpret_cast< PROPSHEETPAGE * >( lParam );
  407. SetWindowLongPtr( hwndDlgIn, GWLP_USERDATA, (LPARAM) ppage->lParam );
  408. pPage = reinterpret_cast< CSummaryPage * >( ppage->lParam );
  409. pPage->m_hwnd = hwndDlgIn;
  410. }
  411. else
  412. {
  413. pPage = reinterpret_cast< CSummaryPage *> ( GetWindowLongPtr( hwndDlgIn, GWLP_USERDATA ) );
  414. }
  415. if ( pPage != NULL )
  416. {
  417. Assert( hwndDlgIn == pPage->m_hwnd );
  418. switch ( nMsgIn )
  419. {
  420. case WM_INITDIALOG:
  421. lr = pPage->OnInitDialog();
  422. break;
  423. case WM_NOTIFY:
  424. lr = pPage->OnNotify( wParam, reinterpret_cast< LPNMHDR >( lParam ) );
  425. break;
  426. case WM_COMMAND:
  427. lr = pPage->OnCommand( HIWORD( wParam ), LOWORD( wParam ), reinterpret_cast< HWND >( lParam ) );
  428. break;
  429. // no default clause needed
  430. } // switch: nMsgIn
  431. } // if: page is available
  432. return lr;
  433. } //*** CSummaryPage::S_DlgProc
  434. //////////////////////////////////////////////////////////////////////////////
  435. //++
  436. //
  437. // HRESULT
  438. // CSummaryPage::HrFormatNetworkInfo(
  439. // IClusCfgNetworkInfo * pccniIn,
  440. // BSTR * pbstrOut
  441. // )
  442. //
  443. //--
  444. //////////////////////////////////////////////////////////////////////////////
  445. HRESULT
  446. CSummaryPage::HrFormatNetworkInfo(
  447. IClusCfgNetworkInfo * pccniIn,
  448. BSTR * pbstrOut
  449. )
  450. {
  451. TraceFunc( "" );
  452. HRESULT hr;
  453. DWORD dwNetworkIPAddress;
  454. DWORD dwNetworkSubnetMask;
  455. BSTR bstrNetworkName = NULL;
  456. BSTR bstrNetworkDescription = NULL;
  457. BSTR bstrNetworkUsage = NULL;
  458. IClusCfgIPAddressInfo * pccipai = NULL;
  459. hr = THR( pccniIn->GetName( &bstrNetworkName ) );
  460. if ( FAILED( hr ) )
  461. {
  462. goto Cleanup;
  463. }
  464. Assert( ( bstrNetworkName != NULL ) && ( *bstrNetworkName != L'\0' ) );
  465. TraceMemoryAddBSTR( bstrNetworkName );
  466. hr = THR( pccniIn->GetDescription( &bstrNetworkDescription ) );
  467. if ( FAILED( hr ) )
  468. {
  469. goto Cleanup;
  470. }
  471. TraceMemoryAddBSTR( bstrNetworkDescription );
  472. hr = STHR( pccniIn->IsPublic() );
  473. if ( FAILED( hr ) )
  474. {
  475. goto Cleanup;
  476. }
  477. if ( hr == S_OK )
  478. {
  479. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_NETWORK_PUBLIC, &bstrNetworkUsage ) );
  480. if ( FAILED( hr ) )
  481. {
  482. goto Cleanup;
  483. }
  484. } // if: public network
  485. hr = STHR( pccniIn->IsPrivate() );
  486. if ( FAILED( hr ) )
  487. {
  488. goto Cleanup;
  489. }
  490. if ( hr == S_OK )
  491. {
  492. if ( bstrNetworkUsage == NULL )
  493. {
  494. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_NETWORK_PRIVATE, &bstrNetworkUsage ) );
  495. if ( FAILED( hr ) )
  496. {
  497. goto Cleanup;
  498. }
  499. } // if: not public network
  500. else
  501. {
  502. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_NETWORK_BOTH, &bstrNetworkUsage ) );
  503. if ( FAILED( hr ) )
  504. {
  505. goto Cleanup;
  506. }
  507. } // else: public network
  508. } // if: private network
  509. else if ( bstrNetworkUsage == NULL )
  510. {
  511. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_NETWORK_NOTUSED, &bstrNetworkUsage ) );
  512. if ( FAILED( hr ) )
  513. {
  514. goto Cleanup;
  515. }
  516. } // else: not private or public network
  517. hr = THR( pccniIn->GetPrimaryNetworkAddress( &pccipai ) );
  518. if ( FAILED( hr ) )
  519. {
  520. goto Cleanup;
  521. }
  522. hr = THR( pccipai->GetIPAddress( &dwNetworkIPAddress ) );
  523. if ( FAILED( hr ) )
  524. {
  525. goto Cleanup;
  526. }
  527. hr = THR( pccipai->GetSubnetMask( &dwNetworkSubnetMask ) );
  528. if ( FAILED( hr ) )
  529. {
  530. goto Cleanup;
  531. }
  532. Assert( dwNetworkIPAddress != 0 );
  533. Assert( dwNetworkSubnetMask != 0 );
  534. hr = THR( HrFormatMessageIntoBSTR( g_hInstance,
  535. IDS_SUMMARY_NETWORK_INFO,
  536. pbstrOut,
  537. bstrNetworkName,
  538. bstrNetworkDescription,
  539. bstrNetworkUsage,
  540. FOURTH_IPADDRESS( dwNetworkIPAddress ),
  541. THIRD_IPADDRESS( dwNetworkIPAddress ),
  542. SECOND_IPADDRESS( dwNetworkIPAddress ),
  543. FIRST_IPADDRESS( dwNetworkIPAddress ),
  544. FOURTH_IPADDRESS( dwNetworkSubnetMask ),
  545. THIRD_IPADDRESS( dwNetworkSubnetMask ),
  546. SECOND_IPADDRESS( dwNetworkSubnetMask ),
  547. FIRST_IPADDRESS( dwNetworkSubnetMask )
  548. ) );
  549. if ( FAILED( hr ) )
  550. {
  551. goto Cleanup;
  552. }
  553. Cleanup:
  554. if ( pccipai != NULL )
  555. {
  556. pccipai->Release();
  557. }
  558. TraceSysFreeString( bstrNetworkUsage );
  559. TraceSysFreeString( bstrNetworkName );
  560. TraceSysFreeString( bstrNetworkDescription );
  561. HRETURN( hr );
  562. } //*** CSummaryPage::HrEditStreamCallback
  563. /////////////////////////////////////////////////////////////////////////////
  564. //++
  565. //
  566. // CSummaryPage:HrCredentialsSummary
  567. //
  568. // Description:
  569. // Format and display the credentials summary.
  570. //
  571. // Arguments:
  572. // hwndIn
  573. // The window to display the text in.
  574. //
  575. // pstexIn
  576. // Dunno? We just need it?!
  577. //
  578. // piccciIn
  579. // Pointer to the cluster info object.
  580. //
  581. // Return Value:
  582. // S_OK
  583. // Success.
  584. //
  585. // E_OUTOFMEMORY
  586. // Couldn't allocate memory.
  587. //
  588. //--
  589. //////////////////////////////////////////////////////////////////////////////
  590. HRESULT
  591. CSummaryPage::HrCredentialsSummary(
  592. HWND hwndIn
  593. , SETTEXTEX * pstexIn
  594. , IClusCfgClusterInfo * piccciIn
  595. )
  596. {
  597. TraceFunc( "" );
  598. Assert( hwndIn != NULL );
  599. Assert( pstexIn != NULL );
  600. Assert( piccciIn != NULL );
  601. HRESULT hr = S_OK;
  602. IClusCfgCredentials * pccc = NULL;
  603. BSTR bstr = NULL;
  604. BSTR bstrUsername = NULL;
  605. BSTR bstrDomain = NULL;
  606. hr = THR( piccciIn->GetClusterServiceAccountCredentials( &pccc ) );
  607. if ( FAILED( hr ) )
  608. {
  609. goto Cleanup;
  610. }
  611. hr = THR( pccc->GetIdentity( &bstrUsername, &bstrDomain ) );
  612. if ( FAILED( hr ) )
  613. {
  614. goto Cleanup;
  615. }
  616. TraceMemoryAddBSTR( bstrUsername );
  617. TraceMemoryAddBSTR( bstrDomain );
  618. Assert( ( bstrUsername != NULL ) && ( *bstrUsername != L'\0' ) );
  619. Assert( ( bstrDomain != NULL ) && ( *bstrDomain != L'\0' ) );
  620. hr = THR( HrFormatMessageIntoBSTR( g_hInstance, IDS_SUMMARY_CREDENTIALS, &bstr, bstrUsername, bstrDomain ) );
  621. if ( FAILED( hr ) )
  622. {
  623. goto Cleanup;
  624. }
  625. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  626. Cleanup:
  627. if ( pccc != NULL )
  628. {
  629. pccc->Release();
  630. } // if:
  631. TraceSysFreeString( bstr );
  632. TraceSysFreeString( bstrUsername );
  633. TraceSysFreeString( bstrDomain );
  634. HRETURN( hr );
  635. } //*** CSummaryPage::HrCredentialsSummary
  636. /////////////////////////////////////////////////////////////////////////////
  637. //++
  638. //
  639. // CSummaryPage:HrNodeSummary
  640. //
  641. // Description:
  642. // Format and display the node summary.
  643. //
  644. // Arguments:
  645. // hwndIn
  646. // The window to display the text in.
  647. //
  648. // pstexIn
  649. // Dunno? We just need it?!
  650. //
  651. // Return Value:
  652. // S_OK
  653. // Success.
  654. //
  655. // E_OUTOFMEMORY
  656. // Couldn't allocate memory.
  657. //
  658. //--
  659. //////////////////////////////////////////////////////////////////////////////
  660. HRESULT
  661. CSummaryPage::HrNodeSummary(
  662. HWND hwndIn
  663. , SETTEXTEX * pstexIn
  664. )
  665. {
  666. TraceFunc( "" );
  667. Assert( hwndIn != NULL );
  668. Assert( pstexIn != NULL );
  669. HRESULT hr = S_OK;
  670. BSTR bstr = NULL;
  671. BSTR bstrNodeName = NULL;
  672. size_t cNodes = 0;
  673. size_t idxNode = 0;
  674. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_MEMBERSHIP_BEGIN, &bstr ) );
  675. if ( FAILED( hr ) )
  676. {
  677. goto Cleanup;
  678. }
  679. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  680. hr = THR( m_pccw->HrGetNodeCount( &cNodes ) );
  681. if ( FAILED( hr ) )
  682. {
  683. goto Cleanup;
  684. }
  685. for ( idxNode = 0; idxNode < cNodes; ++idxNode )
  686. {
  687. hr = THR( m_pccw->HrGetNodeName( idxNode, &bstrNodeName ) );
  688. if ( FAILED( hr ) )
  689. {
  690. goto Cleanup;
  691. }
  692. hr = THR( HrFormatMessageIntoBSTR( g_hInstance, IDS_SUMMARY_MEMBERSHIP_SEPARATOR, &bstr, bstrNodeName ) );
  693. if ( FAILED( hr ) )
  694. {
  695. goto Cleanup;
  696. }
  697. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  698. TraceSysFreeString( bstrNodeName );
  699. bstrNodeName = NULL;
  700. }
  701. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_MEMBERSHIP_END, &bstr ) );
  702. if ( FAILED( hr ) )
  703. {
  704. goto Cleanup;
  705. }
  706. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  707. Cleanup:
  708. TraceSysFreeString( bstrNodeName );
  709. TraceSysFreeString( bstr );
  710. HRETURN( hr );
  711. } //*** CSummaryPage::HrNodeSummary
  712. /////////////////////////////////////////////////////////////////////////////
  713. //++
  714. //
  715. // CSummaryPage:HrResourceSummary
  716. //
  717. // Description:
  718. // Format and display the resources summary.
  719. //
  720. // Arguments:
  721. // hwndIn
  722. // The window to display the text in.
  723. //
  724. // pstexIn
  725. // Dunno? We just need it?!
  726. //
  727. // Return Value:
  728. // S_OK
  729. // Success.
  730. //
  731. // E_OUTOFMEMORY
  732. // Couldn't allocate memory.
  733. //
  734. //--
  735. //////////////////////////////////////////////////////////////////////////////
  736. HRESULT
  737. CSummaryPage::HrResourceSummary(
  738. HWND hwndIn
  739. , SETTEXTEX * pstexIn
  740. )
  741. {
  742. TraceFunc( "" );
  743. Assert( hwndIn != NULL );
  744. Assert( pstexIn != NULL );
  745. HRESULT hr = S_OK;
  746. IUnknown * punkResEnum = NULL;
  747. IEnumClusCfgManagedResources * peccmr = NULL;
  748. IClusCfgManagedResourceInfo * pccmri = NULL;
  749. BSTR bstr = NULL;
  750. BSTR bstrResourceName = NULL;
  751. BSTR bstrUnknownQuorum = NULL;
  752. ULONG celtDummy = 0;
  753. BSTR bstrTemp = NULL;
  754. BOOL fFoundQuorum = FALSE;
  755. BOOL fIsLocalQuorum = FALSE;
  756. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_UNKNOWN_QUORUM, &bstrUnknownQuorum ) );
  757. if ( FAILED( hr ) )
  758. {
  759. //
  760. // If we cannot load the resource string then make a simple string that will work for english...
  761. //
  762. hr = S_OK;
  763. bstrUnknownQuorum = TraceSysAllocString( L"Unknown Quorum" );
  764. if ( bstrUnknownQuorum == NULL )
  765. {
  766. hr = THR( E_OUTOFMEMORY );
  767. goto Cleanup;
  768. } // if:
  769. } // if:
  770. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_RESOURCES_BEGIN, &bstr ) );
  771. if ( FAILED( hr ) )
  772. {
  773. goto Cleanup;
  774. }
  775. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  776. hr = THR( m_pccw->HrGetClusterChild( CLSID_ManagedResourceType, DFGUID_EnumManageableResources, &punkResEnum ) );
  777. if ( FAILED( hr ) )
  778. {
  779. goto Cleanup;
  780. }
  781. hr = THR( punkResEnum->TypeSafeQI( IEnumClusCfgManagedResources, &peccmr ) );
  782. if ( FAILED( hr ) )
  783. {
  784. goto Cleanup;
  785. }
  786. //
  787. // Need to see if there is a quorum chosen
  788. //
  789. for ( ; ; )
  790. {
  791. if ( pccmri != NULL )
  792. {
  793. pccmri->Release();
  794. pccmri = NULL;
  795. }
  796. hr = STHR( peccmr->Next( 1, &pccmri, &celtDummy ) );
  797. if ( FAILED( hr ) )
  798. {
  799. goto Cleanup;
  800. }
  801. if ( hr == S_FALSE )
  802. {
  803. break; // exit condition
  804. }
  805. hr = STHR( pccmri->IsManaged() );
  806. if ( FAILED( hr ) )
  807. {
  808. goto Cleanup;
  809. } // if:
  810. if ( hr == S_OK )
  811. {
  812. hr = STHR( pccmri->IsQuorumResource() );
  813. if ( FAILED( hr ) )
  814. {
  815. goto Cleanup;
  816. } // if:
  817. if ( hr == S_OK )
  818. {
  819. fFoundQuorum = TRUE;
  820. break;
  821. } // if:
  822. } // if:
  823. } // for:
  824. hr = THR( peccmr->Reset() );
  825. if ( FAILED( hr ) )
  826. {
  827. goto Cleanup;
  828. } // if:
  829. for ( ; ; )
  830. {
  831. if ( pccmri != NULL )
  832. {
  833. pccmri->Release();
  834. pccmri = NULL;
  835. }
  836. TraceSysFreeString( bstrResourceName );
  837. bstrResourceName = NULL;
  838. TraceSysFreeString( bstrTemp );
  839. bstrTemp = NULL;
  840. TraceSysFreeString( bstr );
  841. bstr = NULL;
  842. hr = STHR( peccmr->Next( 1, &pccmri, &celtDummy ) );
  843. if ( FAILED( hr ) )
  844. {
  845. goto Cleanup;
  846. }
  847. if ( hr == S_FALSE )
  848. {
  849. break; // exit condition
  850. }
  851. hr = THR( pccmri->GetName( &bstrResourceName ) );
  852. if ( FAILED( hr ) )
  853. {
  854. goto Cleanup;
  855. }
  856. Assert( ( bstrResourceName != NULL ) && ( *bstrResourceName != L'\0' ) );
  857. TraceMemoryAddBSTR( bstrResourceName );
  858. //
  859. // If this resource is still called "Unknown Quorum" then we need to skip showing it
  860. // in this summary.
  861. //
  862. if ( NBSTRCompareCase( bstrUnknownQuorum, bstrResourceName ) == 0 )
  863. {
  864. continue;
  865. } // if:
  866. hr = THR( pccmri->GetUID( &bstrTemp ) );
  867. if ( FAILED( hr ) )
  868. {
  869. goto Cleanup;
  870. } // if:
  871. Assert( ( bstrTemp != NULL ) && ( *bstrTemp != L'\0' ) );
  872. TraceMemoryAddBSTR( bstrTemp );
  873. fIsLocalQuorum = ( NStringCchCompareNoCase(
  874. CLUS_RESTYPE_NAME_LKQUORUM
  875. , RTL_NUMBER_OF( CLUS_RESTYPE_NAME_LKQUORUM )
  876. , bstrTemp
  877. , SysStringLen( bstrTemp ) + 1
  878. ) == 0 );
  879. //
  880. // Display the information about the local quorum resource. If there
  881. // is not another quorum resource chosen then we need to "fake out"
  882. // the info shown about local quorum since it will become the quorum.
  883. // The problem is that we don't want to set the local quorum resource
  884. // to be managed or as the quorum since it will automatically become
  885. // managed and the quorum.
  886. //
  887. if ( ( fIsLocalQuorum == TRUE ) && ( fFoundQuorum == FALSE ) )
  888. {
  889. hr = THR( HrFormatMessageIntoBSTR( g_hInstance, IDS_SUMMARY_RESOURCE_QUORUM_DEVICE, &bstr, bstrResourceName ) );
  890. if ( FAILED( hr ) )
  891. {
  892. goto Cleanup;
  893. } // if:
  894. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  895. continue;
  896. } // if:
  897. hr = STHR( pccmri->IsManaged() );
  898. if ( FAILED( hr ) )
  899. {
  900. goto Cleanup;
  901. } // if:
  902. if ( hr == S_OK )
  903. {
  904. hr = STHR( pccmri->IsQuorumResource() );
  905. if ( FAILED( hr ) )
  906. {
  907. goto Cleanup;
  908. } // if:
  909. if ( hr == S_OK )
  910. {
  911. hr = THR( HrFormatMessageIntoBSTR( g_hInstance, IDS_SUMMARY_RESOURCE_QUORUM_DEVICE, &bstr, bstrResourceName ) );
  912. if ( FAILED( hr ) )
  913. {
  914. goto Cleanup;
  915. } // if:
  916. } // if: quorum resource
  917. else
  918. {
  919. hr = THR( HrFormatMessageIntoBSTR( g_hInstance, IDS_SUMMARY_RESOURCE_MANAGED, &bstr, bstrResourceName ) );
  920. if ( FAILED( hr ) )
  921. {
  922. goto Cleanup;
  923. } // if:
  924. } // else: not quorum resource
  925. } // if: resource is managed
  926. else
  927. {
  928. hr = THR( HrFormatMessageIntoBSTR( g_hInstance, IDS_SUMMARY_RESOURCE_NOT_MANAGED, &bstr, bstrResourceName ) );
  929. if ( FAILED( hr ) )
  930. {
  931. goto Cleanup;
  932. } // if:
  933. } // else:
  934. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  935. } // for:
  936. TraceSysFreeString( bstr );
  937. bstr = NULL;
  938. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_RESOURCES_END, &bstr ) );
  939. if ( FAILED( hr ) )
  940. {
  941. goto Cleanup;
  942. } // if:
  943. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  944. Cleanup:
  945. if ( punkResEnum != NULL )
  946. {
  947. punkResEnum->Release();
  948. } // if:
  949. if ( pccmri != NULL )
  950. {
  951. pccmri->Release();
  952. } // if:
  953. if ( peccmr != NULL )
  954. {
  955. peccmr->Release();
  956. } // if:
  957. TraceSysFreeString( bstrTemp );
  958. TraceSysFreeString( bstrUnknownQuorum );
  959. TraceSysFreeString( bstr );
  960. TraceSysFreeString( bstrResourceName );
  961. HRETURN( hr );
  962. } //*** CSummaryPage::HrResourceSummary
  963. /*
  964. /////////////////////////////////////////////////////////////////////////////
  965. //++
  966. //
  967. // CSummaryPage:HrResourceSummary
  968. //
  969. // Description:
  970. // Format and display the resources summary.
  971. //
  972. // Arguments:
  973. // hwndIn
  974. // The window to display the text in.
  975. //
  976. // pstexIn
  977. // Dunno? We just need it?!
  978. //
  979. // pomIn
  980. // Pointer to the object manager.
  981. //
  982. // ocClusterIn
  983. // The cookie for the cluster object.
  984. //
  985. // Return Value:
  986. // S_OK
  987. // Success.
  988. //
  989. // E_OUTOFMEMORY
  990. // Couldn't allocate memory.
  991. //
  992. //--
  993. //////////////////////////////////////////////////////////////////////////////
  994. HRESULT
  995. CSummaryPage::HrResourceSummary(
  996. HWND hwndIn
  997. , SETTEXTEX * pstexIn
  998. , IObjectManager * pomIn
  999. , OBJECTCOOKIE ocClusterIn
  1000. )
  1001. {
  1002. TraceFunc( "" );
  1003. Assert( hwndIn != NULL );
  1004. Assert( pstexIn != NULL );
  1005. Assert( pomIn != NULL );
  1006. HRESULT hr = S_OK;
  1007. IUnknown * punk = NULL;
  1008. IEnumClusCfgManagedResources * peccmr = NULL;
  1009. IClusCfgManagedResourceInfo * pccmri = NULL;
  1010. BSTR bstr = NULL;
  1011. BSTR bstrResourceName = NULL;
  1012. BSTR bstrUnknownQuorum = NULL;
  1013. BSTR bstrNodeName = NULL;
  1014. BSTR bstrNewLine = NULL;
  1015. ULONG celtDummy;
  1016. OBJECTCOOKIE cookieDummy;
  1017. OBJECTCOOKIE cookieNode;
  1018. IEnumCookies * pecNodes = NULL;
  1019. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_RESOURCES_END, &bstrNewLine ) );
  1020. if ( FAILED( hr ) )
  1021. {
  1022. goto Cleanup;
  1023. } // if:
  1024. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_UNKNOWN_QUORUM, &bstrUnknownQuorum ) );
  1025. if ( FAILED( hr ) )
  1026. {
  1027. //
  1028. // If we cannot load the resource string then make a simple string that will work for english...
  1029. //
  1030. hr = S_OK;
  1031. bstrUnknownQuorum = TraceSysAllocString( L"Unknown Quorum" );
  1032. if ( bstrUnknownQuorum == NULL )
  1033. {
  1034. hr = THR( E_OUTOFMEMORY );
  1035. goto Cleanup;
  1036. } // if:
  1037. } // if:
  1038. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_RESOURCES_BEGIN, &bstr ) );
  1039. if ( FAILED( hr ) )
  1040. {
  1041. goto Cleanup;
  1042. } // if:
  1043. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  1044. //
  1045. // Get the node cookie enumerator.
  1046. //
  1047. hr = THR( pomIn->FindObject( CLSID_NodeType, ocClusterIn, NULL, DFGUID_EnumCookies, &cookieDummy, &punk ) );
  1048. if ( FAILED( hr ) )
  1049. {
  1050. goto Cleanup;
  1051. } // if:
  1052. hr = THR( punk->TypeSafeQI( IEnumCookies, &pecNodes ) );
  1053. if ( FAILED( hr ) )
  1054. {
  1055. goto Cleanup;
  1056. } // if:
  1057. punk->Release();
  1058. punk = NULL;
  1059. for ( ; ; )
  1060. {
  1061. //
  1062. // Cleanup
  1063. //
  1064. if ( peccmr != NULL )
  1065. {
  1066. peccmr->Release();
  1067. peccmr = NULL;
  1068. } // if:
  1069. TraceSysFreeString( bstrNodeName );
  1070. bstrNodeName = NULL;
  1071. //
  1072. // Get the next node.
  1073. //
  1074. hr = STHR( pecNodes->Next( 1, &cookieNode, &celtDummy ) );
  1075. if ( FAILED( hr ) )
  1076. {
  1077. goto Cleanup;
  1078. } // if:
  1079. if ( hr == S_FALSE )
  1080. {
  1081. hr = S_OK;
  1082. break; // exit condition
  1083. } // if:
  1084. //
  1085. // Retrieve the node's name.
  1086. //
  1087. hr = THR( HrRetrieveCookiesName( pomIn, cookieNode, &bstrNodeName ) );
  1088. if ( FAILED( hr ) )
  1089. {
  1090. goto Cleanup;
  1091. } // if:
  1092. hr = THR( HrFormatMessageIntoBSTR( g_hInstance, IDS_SUMMARY_NODE_RESOURCES_BEGIN, &bstr, bstrNodeName ) );
  1093. if ( FAILED( hr ) )
  1094. {
  1095. goto Cleanup;
  1096. } // if:
  1097. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  1098. //
  1099. // Retrieve the managed resources enumer.
  1100. //
  1101. hr = THR( pomIn->FindObject(
  1102. CLSID_ManagedResourceType
  1103. , cookieNode
  1104. , NULL
  1105. , DFGUID_EnumManageableResources
  1106. , &cookieDummy
  1107. , &punk
  1108. ) );
  1109. if ( hr == HRESULT_FROM_WIN32( ERROR_NOT_FOUND ) )
  1110. {
  1111. //hr = THR( HrSendStatusReport(
  1112. // bstrNodeName
  1113. // , TASKID_Major_Find_Devices
  1114. // , TASKID_Minor_No_Managed_Resources_Found
  1115. // , 0
  1116. // , 1
  1117. // , 1
  1118. // , MAKE_HRESULT( 0, FACILITY_WIN32, ERROR_NOT_FOUND )
  1119. // , IDS_TASKID_MINOR_NO_MANAGED_RESOURCES_FOUND
  1120. // ) );
  1121. //if ( FAILED( hr ) )
  1122. //{
  1123. // goto Cleanup;
  1124. //}
  1125. continue; // skip this node
  1126. } // if: no manageable resources for the node are available
  1127. else if ( FAILED( hr ) )
  1128. {
  1129. goto Cleanup;
  1130. } // else if: error finding manageable resources for the node
  1131. hr = THR( punk->TypeSafeQI( IEnumClusCfgManagedResources, &peccmr ) );
  1132. if ( FAILED( hr ) )
  1133. {
  1134. goto Cleanup;
  1135. } // if:
  1136. punk->Release();
  1137. punk = NULL;
  1138. //
  1139. // Loop thru the managed resources that the node has.
  1140. //
  1141. for ( ; ; )
  1142. {
  1143. if ( pccmri != NULL )
  1144. {
  1145. pccmri->Release();
  1146. pccmri = NULL;
  1147. } // if:
  1148. TraceSysFreeString( bstrResourceName );
  1149. bstrResourceName = NULL;
  1150. hr = STHR( peccmr->Next( 1, &pccmri, &celtDummy ) );
  1151. if ( FAILED( hr ) )
  1152. {
  1153. goto Cleanup;
  1154. } // if:
  1155. if ( hr == S_FALSE )
  1156. {
  1157. hr = S_OK;
  1158. break; // exit condition
  1159. } // if:
  1160. hr = THR( pccmri->GetName( &bstrResourceName ) );
  1161. if ( FAILED( hr ) )
  1162. {
  1163. goto Cleanup;
  1164. } // if:
  1165. Assert( ( bstrResourceName != NULL ) && ( *bstrResourceName != L'\0' ) );
  1166. TraceMemoryAddBSTR( bstrResourceName );
  1167. //
  1168. // If this resource is still called "Unknown Quorum" then we need to skip showing it
  1169. // in this summary.
  1170. //
  1171. if ( NBSTRCompareCase( bstrUnknownQuorum, bstrResourceName ) == 0 )
  1172. {
  1173. continue;
  1174. } // if:
  1175. hr = STHR( pccmri->IsManaged() );
  1176. if ( FAILED( hr ) )
  1177. {
  1178. goto Cleanup;
  1179. } // if:
  1180. if ( hr == S_OK )
  1181. {
  1182. hr = STHR( pccmri->IsQuorumResource() );
  1183. if ( FAILED( hr ) )
  1184. {
  1185. goto Cleanup;
  1186. } // if:
  1187. if ( hr == S_OK )
  1188. {
  1189. hr = THR( HrFormatMessageIntoBSTR( g_hInstance, IDS_SUMMARY_RESOURCE_QUORUM_DEVICE, &bstr, bstrResourceName ) );
  1190. if ( FAILED( hr ) )
  1191. {
  1192. goto Cleanup;
  1193. } // if:
  1194. } // if: quorum resource
  1195. else
  1196. {
  1197. hr = THR( HrFormatMessageIntoBSTR( g_hInstance, IDS_SUMMARY_RESOURCE_MANAGED, &bstr, bstrResourceName ) );
  1198. if ( FAILED( hr ) )
  1199. {
  1200. goto Cleanup;
  1201. } // if:
  1202. } // else: not quorum resource
  1203. } // if: resource is managed
  1204. else
  1205. {
  1206. hr = THR( HrFormatMessageIntoBSTR( g_hInstance, IDS_SUMMARY_RESOURCE_NOT_MANAGED, &bstr, bstrResourceName ) );
  1207. if ( FAILED( hr ) )
  1208. {
  1209. goto Cleanup;
  1210. } // if:
  1211. } // else:
  1212. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  1213. } // for:
  1214. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstrNewLine );
  1215. } // for:
  1216. Cleanup:
  1217. if ( pecNodes != NULL )
  1218. {
  1219. pecNodes->Release();
  1220. } // if:
  1221. if ( peccmr != NULL )
  1222. {
  1223. peccmr->Release();
  1224. } // if:
  1225. if ( pccmri != NULL )
  1226. {
  1227. pccmri->Release();
  1228. } // if:
  1229. if ( peccmr != NULL )
  1230. {
  1231. peccmr->Release();
  1232. } // if:
  1233. TraceSysFreeString( bstrNewLine );
  1234. TraceSysFreeString( bstrUnknownQuorum );
  1235. TraceSysFreeString( bstr );
  1236. TraceSysFreeString( bstrResourceName );
  1237. TraceSysFreeString( bstrNodeName );
  1238. HRETURN( hr );
  1239. } //*** CSummaryPage::HrResourceSummary
  1240. */
  1241. /////////////////////////////////////////////////////////////////////////////
  1242. //++
  1243. //
  1244. // CSummaryPage:HrNetworkSummary
  1245. //
  1246. // Description:
  1247. // Format and display the networks summary.
  1248. //
  1249. // Arguments:
  1250. // hwndIn
  1251. // The window to display the text in.
  1252. //
  1253. // pstexIn
  1254. // Dunno? We just need it?!
  1255. //
  1256. // Return Value:
  1257. // S_OK
  1258. // Success.
  1259. //
  1260. // E_OUTOFMEMORY
  1261. // Couldn't allocate memory.
  1262. //
  1263. //--
  1264. //////////////////////////////////////////////////////////////////////////////
  1265. HRESULT
  1266. CSummaryPage::HrNetworkSummary(
  1267. HWND hwndIn
  1268. , SETTEXTEX * pstexIn
  1269. )
  1270. {
  1271. TraceFunc( "" );
  1272. Assert( hwndIn != NULL );
  1273. Assert( pstexIn != NULL );
  1274. HRESULT hr = S_OK;
  1275. IUnknown * punkNetEnum = NULL;
  1276. BSTR bstr = NULL;
  1277. ULONG celtDummy = 0;
  1278. IEnumClusCfgNetworks * peccn = NULL;
  1279. IClusCfgNetworkInfo * pccni = NULL;
  1280. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_NETWORKS_BEGIN, &bstr ) );
  1281. if ( FAILED( hr ) )
  1282. {
  1283. goto Cleanup;
  1284. } // if:
  1285. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  1286. hr = THR( m_pccw->HrGetClusterChild(
  1287. CLSID_NetworkType
  1288. , DFGUID_EnumManageableNetworks
  1289. , &punkNetEnum
  1290. ) );
  1291. if ( FAILED( hr ) )
  1292. {
  1293. goto Cleanup;
  1294. }
  1295. hr = THR( punkNetEnum->TypeSafeQI( IEnumClusCfgNetworks, &peccn ) );
  1296. if ( FAILED( hr ) )
  1297. {
  1298. goto Cleanup;
  1299. }
  1300. while( true )
  1301. {
  1302. if ( pccni != NULL )
  1303. {
  1304. pccni->Release();
  1305. pccni = NULL;
  1306. }
  1307. hr = STHR( peccn->Next( 1, &pccni, &celtDummy ) );
  1308. if ( FAILED( hr ) )
  1309. {
  1310. goto Cleanup;
  1311. }
  1312. if ( hr == S_FALSE )
  1313. {
  1314. break; // exit condition
  1315. }
  1316. hr = THR( HrFormatNetworkInfo( pccni, &bstr ) );
  1317. if ( FAILED( hr ) )
  1318. {
  1319. goto Cleanup;
  1320. }
  1321. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  1322. } // while:
  1323. hr = THR( HrLoadStringIntoBSTR( g_hInstance, IDS_SUMMARY_NETWORKS_END, &bstr ) );
  1324. if ( FAILED( hr ) )
  1325. {
  1326. goto Cleanup;
  1327. }
  1328. SendMessage( hwndIn, EM_SETTEXTEX, (WPARAM) pstexIn, (LPARAM) bstr );
  1329. Cleanup:
  1330. if ( punkNetEnum != NULL )
  1331. {
  1332. punkNetEnum->Release();
  1333. } // if:
  1334. if ( peccn != NULL )
  1335. {
  1336. peccn->Release();
  1337. } // if:
  1338. if ( pccni != NULL )
  1339. {
  1340. pccni->Release();
  1341. } // if:
  1342. TraceSysFreeString( bstr );
  1343. HRETURN( hr );
  1344. } //*** CSummaryPage::HrNetworkSummary
  1345. /*
  1346. /////////////////////////////////////////////////////////////////////////////
  1347. //++
  1348. //
  1349. // CSummaryPage:HrRetrieveCookiesName
  1350. //
  1351. // Description:
  1352. // Get the name of the passed in cookie.
  1353. //
  1354. // Arguments:
  1355. // pomIn
  1356. // Pointer to the object manager.
  1357. //
  1358. // cookieIn
  1359. // The cookie whose name we want.
  1360. //
  1361. // pbstrNameOut
  1362. // Used to send the name back out.
  1363. //
  1364. // Return Value:
  1365. // S_OK
  1366. // Success.
  1367. //
  1368. // E_OUTOFMEMORY
  1369. // Couldn't allocate memory.
  1370. //
  1371. //--
  1372. //////////////////////////////////////////////////////////////////////////////
  1373. HRESULT
  1374. CSummaryPage::HrRetrieveCookiesName(
  1375. IObjectManager * pomIn
  1376. , OBJECTCOOKIE cookieIn
  1377. , BSTR * pbstrNameOut
  1378. )
  1379. {
  1380. TraceFunc( "" );
  1381. Assert( pomIn != NULL );
  1382. Assert( cookieIn != NULL );
  1383. Assert( pbstrNameOut != NULL );
  1384. HRESULT hr;
  1385. IUnknown * punk = NULL;
  1386. IStandardInfo * psi = NULL;
  1387. hr = THR( pomIn->GetObject( DFGUID_StandardInfo, cookieIn, &punk ) );
  1388. if ( FAILED( hr ) )
  1389. {
  1390. goto Cleanup;
  1391. } // if:
  1392. hr = THR( punk->TypeSafeQI( IStandardInfo, &psi ) );
  1393. if ( FAILED( hr ) )
  1394. {
  1395. goto Cleanup;
  1396. } // if:
  1397. hr = THR( psi->GetName( pbstrNameOut ) );
  1398. if ( FAILED( hr ) )
  1399. {
  1400. goto Cleanup;
  1401. } // if:
  1402. TraceMemoryAddBSTR( *pbstrNameOut );
  1403. Cleanup:
  1404. if ( punk != NULL )
  1405. {
  1406. punk->Release();
  1407. } // if:
  1408. if ( psi != NULL )
  1409. {
  1410. psi->Release();
  1411. } // if:
  1412. HRETURN( hr );
  1413. } //*** CSummaryPage::HrRetrieveCookiesName
  1414. */