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.

938 lines
20 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000-2001 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // ClusDomainPage.cpp
  7. //
  8. // Maintained By:
  9. // David Potter (DavidP) 31-JAN-2001
  10. // Geoffrey Pease (GPease) 12-MAY-2000
  11. //
  12. //////////////////////////////////////////////////////////////////////////////
  13. #include "Pch.h"
  14. #include "ClusDomainPage.h"
  15. #include "WizardUtils.h"
  16. DEFINE_THISCLASS("CClusDomainPage");
  17. //////////////////////////////////////////////////////////////////////////////
  18. //++
  19. //
  20. // CClusDomainPage::CClusDomainPage
  21. //
  22. // Description:
  23. // Constructor.
  24. //
  25. // Arguments:
  26. // pspIn -- IServiceProvider
  27. // ecamCreateAddModeIn -- Creating cluster or adding nodes to cluster
  28. // pbstrClusterNameIn -- Name of the cluster
  29. // idsDescIn -- Resource ID for the domain description string.
  30. //
  31. // Return Values:
  32. // None.
  33. //
  34. // Remarks:
  35. //
  36. //--
  37. //////////////////////////////////////////////////////////////////////////////
  38. CClusDomainPage::CClusDomainPage(
  39. IServiceProvider * pspIn,
  40. ECreateAddMode ecamCreateAddModeIn,
  41. BSTR * pbstrClusterNameIn,
  42. UINT idsDescIn
  43. )
  44. {
  45. TraceFunc( "" );
  46. Assert( pspIn != NULL );
  47. Assert( pbstrClusterNameIn != NULL );
  48. Assert( idsDescIn != 0 );
  49. // m_hwnd
  50. THR( pspIn->TypeSafeQI( IServiceProvider, &m_psp ) );
  51. m_pbstrClusterName = pbstrClusterNameIn;
  52. m_ecamCreateAddMode = ecamCreateAddModeIn;
  53. m_idsDesc = idsDescIn;
  54. if ( ( ecamCreateAddModeIn == camADDING )
  55. && ( *pbstrClusterNameIn != L'\0' ) )
  56. {
  57. //
  58. // Don't show the cluster name/domain page if we are joining
  59. // and the cluster name has been filled in by the caller.
  60. //
  61. m_fDisplayPage = FALSE;
  62. }
  63. else
  64. {
  65. m_fDisplayPage = TRUE;
  66. }
  67. m_cRef = 0;
  68. m_ptgd = NULL;
  69. TraceFuncExit();
  70. } //*** CClusDomainPage::CClusDomainPage()
  71. //////////////////////////////////////////////////////////////////////////////
  72. //++
  73. //
  74. // CClusDomainPage::~CClusDomainPage
  75. //
  76. // Description:
  77. // Destructor.
  78. //
  79. // Arguments:
  80. // None.
  81. //
  82. // Return Values:
  83. // None.
  84. //
  85. // Remarks:
  86. //
  87. //--
  88. //////////////////////////////////////////////////////////////////////////////
  89. CClusDomainPage::~CClusDomainPage( void )
  90. {
  91. TraceFunc( "" );
  92. if ( m_psp != NULL )
  93. {
  94. m_psp->Release();
  95. }
  96. if ( m_ptgd != NULL )
  97. {
  98. // Make sure we don't get called anymore.
  99. THR( m_ptgd->SetCallback( NULL ) );
  100. m_ptgd->Release();
  101. }
  102. Assert( m_cRef == 0 );
  103. TraceFuncExit();
  104. } //*** CClusDomainPage::~CClusDomainPage()
  105. //////////////////////////////////////////////////////////////////////////////
  106. //++
  107. //
  108. // CClusDomainPage::OnInitDialog
  109. //
  110. // Description:
  111. // Handle the WM_INITDIALOG window message.
  112. //
  113. // Arguments:
  114. // None.
  115. //
  116. // Return Values:
  117. // FALSE - Didn't set the focus.
  118. //
  119. // Remarks:
  120. //
  121. //--
  122. //////////////////////////////////////////////////////////////////////////////
  123. LRESULT
  124. CClusDomainPage::OnInitDialog( void )
  125. {
  126. TraceFunc( "" );
  127. HRESULT hr;
  128. LRESULT lr = FALSE; // didn't set focus
  129. bool fGetLocalDomain = false;
  130. LPWSTR pszDomain;
  131. BSTR bstrDomain = NULL;
  132. BSTR bstrDomainDesc = NULL;
  133. IUnknown * punk = NULL;
  134. ITaskManager * ptm = NULL;
  135. //
  136. // (jfranco, bug #373331) Limit cluster name length to MAX_CLUSTERNAME_LENGTH
  137. //
  138. // according to msdn, EM_(SET)LIMITTEXT does not return a value, so ignore what SendDlgItemMessage returns
  139. SendDlgItemMessage( m_hwnd, IDC_CLUSDOMAIN_E_CLUSTERNAME, EM_SETLIMITTEXT, MAX_CLUSTERNAME_LENGTH, 0 );
  140. //
  141. // Kick off the GetDomains task.
  142. //
  143. hr = THR( m_psp->TypeSafeQS( CLSID_TaskManager, ITaskManager, &ptm ) );
  144. if ( FAILED( hr ) )
  145. {
  146. goto Cleanup;
  147. }
  148. hr = THR( ptm->CreateTask( TASK_GetDomains, &punk ) );
  149. if ( FAILED( hr ) )
  150. {
  151. goto Cleanup;
  152. }
  153. //TraceMoveFromMemoryList( punk, g_GlobalMemoryList );
  154. hr = THR( punk->TypeSafeQI( ITaskGetDomains, &m_ptgd ) );
  155. if ( FAILED( hr ) )
  156. {
  157. goto Cleanup;
  158. }
  159. hr = THR( m_ptgd->SetCallback( static_cast< ITaskGetDomainsCallback * >( this ) ) );
  160. if ( FAILED( hr ) )
  161. {
  162. goto Cleanup;
  163. }
  164. hr = THR( ptm->SubmitTask( m_ptgd ) );
  165. if ( FAILED( hr ) )
  166. {
  167. goto Cleanup;
  168. }
  169. //
  170. // If a cluster name has already been specified, set it to the page.
  171. // If the cluster name is fully qualified, select that domain in the
  172. // domains combobox.
  173. //
  174. if ( *m_pbstrClusterName != NULL )
  175. {
  176. //
  177. // This should be a FQDN. If not, don't fill in the domain.
  178. //
  179. pszDomain = wcschr( *m_pbstrClusterName, L'.' );
  180. if ( pszDomain != NULL )
  181. {
  182. *pszDomain = L'\0'; // terminate to fillin cluster hostname
  183. }
  184. SetDlgItemText( m_hwnd, IDC_CLUSDOMAIN_E_CLUSTERNAME, *m_pbstrClusterName );
  185. if ( pszDomain != NULL )
  186. {
  187. *pszDomain = L'.'; // restore
  188. pszDomain++;
  189. SetDlgItemText( m_hwnd, IDC_CLUSDOMAIN_CB_DOMAIN, pszDomain );
  190. }
  191. else
  192. {
  193. fGetLocalDomain = true;
  194. }
  195. } // if: cluster name specified already
  196. else
  197. {
  198. fGetLocalDomain = true;
  199. }
  200. //
  201. // If a cluster name was not specified or if the cluster name wasn't
  202. // fully qualified, select the domain of the local computer.
  203. //
  204. if ( fGetLocalDomain )
  205. {
  206. //
  207. // Get the domain of the local computer.
  208. //
  209. hr = THR( HrGetComputerName( ComputerNameDnsDomain, &bstrDomain ) );
  210. if ( FAILED( hr ) )
  211. {
  212. goto Cleanup;
  213. }
  214. SetDlgItemText( m_hwnd, IDC_CLUSDOMAIN_CB_DOMAIN, bstrDomain );
  215. } // if: need to get the local domain
  216. //
  217. // Set the text of the domain description control.
  218. //
  219. hr = HrLoadStringIntoBSTR( g_hInstance, m_idsDesc, &bstrDomainDesc );
  220. if ( FAILED( hr ) )
  221. {
  222. goto Cleanup;
  223. }
  224. SetDlgItemText( m_hwnd, IDC_CLUSDOMAIN_S_DOMAIN_DESC, bstrDomainDesc );
  225. Cleanup:
  226. TraceSysFreeString( bstrDomainDesc );
  227. TraceSysFreeString( bstrDomain );
  228. if ( punk != NULL )
  229. {
  230. punk->Release();
  231. }
  232. if ( ptm != NULL )
  233. {
  234. ptm->Release();
  235. }
  236. RETURN( lr );
  237. } //*** CClusDomainPage::OnInitDialog()
  238. //////////////////////////////////////////////////////////////////////////////
  239. //++
  240. //
  241. // CClusDomainPage::OnNotifySetActive
  242. //
  243. // Description:
  244. //
  245. // Arguments:
  246. // None.
  247. //
  248. // Return Values:
  249. // TRUE
  250. //
  251. // Remarks:
  252. //
  253. //--
  254. //////////////////////////////////////////////////////////////////////////////
  255. LRESULT
  256. CClusDomainPage::OnNotifySetActive( void )
  257. {
  258. TraceFunc( "" );
  259. LRESULT lr = TRUE;
  260. if ( m_fDisplayPage )
  261. {
  262. THR( HrUpdateWizardButtons( TRUE ) );
  263. }
  264. else
  265. {
  266. SetWindowLongPtr( m_hwnd, DWLP_MSGRESULT, -1 );
  267. }
  268. RETURN( lr );
  269. } //*** CClusDomainPage::OnNotifySetActive()
  270. //////////////////////////////////////////////////////////////////////////////
  271. //++
  272. //
  273. // CClusDomainPage::OnNotifyWizNext
  274. //
  275. // Description:
  276. //
  277. // Arguments:
  278. // None.
  279. //
  280. // Return Values:
  281. // TRUE
  282. //
  283. // Remarks:
  284. //
  285. //--
  286. //////////////////////////////////////////////////////////////////////////////
  287. LRESULT
  288. CClusDomainPage::OnNotifyWizNext( void )
  289. {
  290. TraceFunc( "" );
  291. HRESULT hr;
  292. DNS_STATUS dnsStatus;
  293. DWORD dwLen;
  294. LPWSTR pszDomain;
  295. DWORD dwErr;
  296. WCHAR szClusterName[ DNS_MAX_NAME_BUFFER_LENGTH ];
  297. BSTR bstrClusterName;
  298. int idcFocus = 0;
  299. LRESULT lr = TRUE;
  300. HWND hDlgWizard = GetParent( m_hwnd );
  301. //
  302. // Retrieve the text and make sure it is a valid DNS hostname.
  303. //
  304. dwLen = GetDlgItemText( m_hwnd, IDC_CLUSDOMAIN_E_CLUSTERNAME, szClusterName, ARRAYSIZE( szClusterName ) );
  305. AssertMsg( dwLen, "How did we get here?" );
  306. //
  307. // Validate cluster hostname.
  308. //
  309. hr = THR( HrValidateDnsHostname(
  310. m_hwnd
  311. , szClusterName
  312. , mvdhoALLOW_ONLY_HOSTNAME_LABEL
  313. ) );
  314. if ( FAILED( hr ) )
  315. {
  316. idcFocus = IDC_CLUSDOMAIN_E_CLUSTERNAME;
  317. goto Error;
  318. }
  319. //
  320. // Add the DOT after the hostname to build the cluster's FQDN.
  321. //
  322. szClusterName[ dwLen ] = L'.';
  323. dwLen++;
  324. pszDomain = &szClusterName[ dwLen ];
  325. //
  326. // Add the domain to the cluster hostname to make a FQDN.
  327. //
  328. dwLen = GetDlgItemText( m_hwnd, IDC_CLUSDOMAIN_CB_DOMAIN, &szClusterName[ dwLen ], ARRAYSIZE( szClusterName ) - dwLen );
  329. if ( dwLen != 0 )
  330. {
  331. //
  332. // Validate the domain name.
  333. //
  334. dnsStatus = TW32( DnsValidateName( pszDomain, DnsNameDomain ) );
  335. if ( dnsStatus != ERROR_SUCCESS )
  336. {
  337. MessageBoxFromStrings( m_hwnd,
  338. IDS_ERR_INVALID_DNS_DOMAIN_NAME_TITLE,
  339. IDS_ERR_INVALID_DNS_DOMAIN_NAME_TEXT,
  340. MB_OK | MB_ICONSTOP
  341. );
  342. hr = HRESULT_FROM_WIN32( dnsStatus );
  343. idcFocus = IDC_CLUSDOMAIN_CB_DOMAIN;
  344. goto Error;
  345. }
  346. }
  347. else
  348. {
  349. //
  350. // Remote the dot.
  351. //
  352. dwLen --;
  353. szClusterName[ dwLen ] = L'\0';
  354. }
  355. //
  356. // Build a BSTR of the FQDN cluster name.
  357. //
  358. bstrClusterName = TraceSysAllocString( szClusterName );
  359. if ( bstrClusterName == NULL )
  360. {
  361. goto OutOfMemory;
  362. }
  363. TraceSysFreeString( *m_pbstrClusterName );
  364. *m_pbstrClusterName = bstrClusterName;
  365. Cleanup:
  366. RETURN( lr );
  367. Error:
  368. if ( idcFocus != 0 )
  369. {
  370. SetFocus( GetDlgItem( m_hwnd, idcFocus ) );
  371. }
  372. // Don't go to the next page.
  373. SetWindowLongPtr( m_hwnd, DWLP_MSGRESULT, -1 );
  374. goto Cleanup;
  375. OutOfMemory:
  376. hr = E_OUTOFMEMORY;
  377. goto Error;
  378. } //*** CClusDomainPage::OnNotifyWizNext()
  379. //////////////////////////////////////////////////////////////////////////////
  380. //++
  381. //
  382. // CClusDomainPage::OnNotifyQueryCancel
  383. //
  384. // Description:
  385. //
  386. // Arguments:
  387. // None.
  388. //
  389. // Return Values:
  390. // TRUE
  391. //
  392. // Remarks:
  393. //
  394. //--
  395. //////////////////////////////////////////////////////////////////////////////
  396. LRESULT
  397. CClusDomainPage::OnNotifyQueryCancel( void )
  398. {
  399. TraceFunc( "" );
  400. LRESULT lr = TRUE;
  401. int iRet;
  402. iRet = MessageBoxFromStrings( m_hwnd,
  403. IDS_QUERY_CANCEL_TITLE,
  404. IDS_QUERY_CANCEL_TEXT,
  405. MB_YESNO
  406. );
  407. if ( iRet == IDNO )
  408. {
  409. SetWindowLongPtr( m_hwnd, DWLP_MSGRESULT, -1 );
  410. }
  411. RETURN( lr );
  412. } //*** OnNotifyQueryCancel()
  413. //////////////////////////////////////////////////////////////////////////////
  414. //++
  415. //
  416. // CClusDomainPage::OnNotify
  417. //
  418. // Description:
  419. //
  420. // Arguments:
  421. // idCtrlIn
  422. // pnmhdrIn
  423. //
  424. // Return Values:
  425. // TRUE
  426. // Other LRESULT values.
  427. //
  428. // Remarks:
  429. //
  430. //--
  431. //////////////////////////////////////////////////////////////////////////////
  432. LRESULT
  433. CClusDomainPage::OnNotify(
  434. WPARAM idCtrlIn,
  435. LPNMHDR pnmhdrIn
  436. )
  437. {
  438. TraceFunc( "" );
  439. LRESULT lr = TRUE;
  440. SetWindowLongPtr( m_hwnd, DWLP_MSGRESULT, 0 );
  441. switch ( pnmhdrIn->code )
  442. {
  443. case PSN_SETACTIVE:
  444. lr = OnNotifySetActive();
  445. break;
  446. case PSN_WIZNEXT:
  447. lr = OnNotifyWizNext();
  448. break;
  449. case PSN_WIZBACK:
  450. //
  451. // Disable the wizard buttons.
  452. //
  453. PropSheet_SetWizButtons( GetParent( m_hwnd ), 0 );
  454. break;
  455. case PSN_QUERYCANCEL:
  456. lr = OnNotifyQueryCancel();
  457. break;
  458. } // switch: notification code
  459. RETURN( lr );
  460. } //*** CClusDomainPage::OnNotify()
  461. //////////////////////////////////////////////////////////////////////////////
  462. //++
  463. //
  464. // CClusDomainPage::OnCommand
  465. //
  466. // Description:
  467. //
  468. // Arguments:
  469. // idNotificationIn
  470. // idControlIn
  471. // hwndSenderIn
  472. //
  473. // Return Values:
  474. // TRUE
  475. // FALSE
  476. //
  477. // Remarks:
  478. //
  479. //--
  480. //////////////////////////////////////////////////////////////////////////////
  481. LRESULT
  482. CClusDomainPage::OnCommand(
  483. UINT idNotificationIn,
  484. UINT idControlIn,
  485. HWND hwndSenderIn
  486. )
  487. {
  488. TraceFunc( "" );
  489. LRESULT lr = FALSE;
  490. switch ( idControlIn )
  491. {
  492. case IDC_CLUSDOMAIN_E_CLUSTERNAME:
  493. if ( idNotificationIn == EN_CHANGE )
  494. {
  495. THR( HrUpdateWizardButtons( TRUE ) );
  496. lr = TRUE;
  497. }
  498. break;
  499. case IDC_CLUSDOMAIN_CB_DOMAIN:
  500. if ( idNotificationIn == CBN_EDITCHANGE )
  501. {
  502. THR( HrUpdateWizardButtons( TRUE ) );
  503. lr = TRUE;
  504. }
  505. else if ( idNotificationIn == CBN_SELCHANGE )
  506. {
  507. THR( HrUpdateWizardButtons( TRUE ) );
  508. lr = TRUE;
  509. }
  510. break;
  511. } // switch: control ID
  512. RETURN( lr );
  513. } //*** CClusDomainPage::OnCommand()
  514. //////////////////////////////////////////////////////////////////////////////
  515. //++
  516. //
  517. // CClusDomainPage::HrUpdateWizardButtons
  518. //
  519. // Description:
  520. //
  521. // Arguments:
  522. // fIgnoreCombBoxIn
  523. //
  524. // Return Values:
  525. // S_OK
  526. //
  527. // Remarks:
  528. //
  529. //--
  530. //////////////////////////////////////////////////////////////////////////////
  531. HRESULT
  532. CClusDomainPage::HrUpdateWizardButtons(
  533. BOOL fIgnoreComboBoxIn
  534. )
  535. {
  536. TraceFunc( "" );
  537. HRESULT hr = S_OK;
  538. DWORD dwFlags = PSWIZB_BACK | PSWIZB_NEXT;
  539. DWORD dwLen;
  540. LRESULT lr;
  541. dwLen = GetWindowTextLength( GetDlgItem( m_hwnd, IDC_CLUSDOMAIN_E_CLUSTERNAME ) );
  542. if ( dwLen == 0 )
  543. {
  544. dwFlags &= ~PSWIZB_NEXT;
  545. }
  546. if ( ! fIgnoreComboBoxIn )
  547. {
  548. dwLen = GetWindowTextLength( GetDlgItem( m_hwnd, IDC_CLUSDOMAIN_CB_DOMAIN ) );
  549. lr = ComboBox_GetCurSel( GetDlgItem( m_hwnd, IDC_CLUSDOMAIN_CB_DOMAIN ) );
  550. if ( lr == CB_ERR )
  551. {
  552. if ( dwLen == 0 )
  553. {
  554. dwFlags &= ~PSWIZB_NEXT;
  555. }
  556. }
  557. else if ( dwLen == 0 )
  558. {
  559. dwFlags &= ~PSWIZB_NEXT;
  560. }
  561. } // if: can't ignore the combobos
  562. PropSheet_SetWizButtons( GetParent( m_hwnd ), dwFlags );
  563. HRETURN( hr );
  564. } //*** CClusDomainPage::HrUpdateWizardButtons()
  565. //////////////////////////////////////////////////////////////////////////////
  566. //++
  567. //
  568. // static
  569. // CALLBACK
  570. // CClusDomainPage::S_DlgProc
  571. //
  572. // Description:
  573. // Dialog proc for this page.
  574. //
  575. // Arguments:
  576. // hDlgIn
  577. // MsgIn
  578. // wParam
  579. // lParam
  580. //
  581. // Return Values:
  582. // FALSE
  583. // Other LRESULT values.
  584. //
  585. // Remarks:
  586. //
  587. //--
  588. //////////////////////////////////////////////////////////////////////////////
  589. INT_PTR
  590. CALLBACK
  591. CClusDomainPage::S_DlgProc(
  592. HWND hDlgIn,
  593. UINT MsgIn,
  594. WPARAM wParam,
  595. LPARAM lParam
  596. )
  597. {
  598. // Don't do TraceFunc because every mouse movement
  599. // will cause this function to be called.
  600. WndMsg( hDlgIn, MsgIn, wParam, lParam );
  601. LRESULT lr = FALSE;
  602. CClusDomainPage * pPage = reinterpret_cast< CClusDomainPage *> ( GetWindowLongPtr( hDlgIn, GWLP_USERDATA ) );
  603. if ( MsgIn == WM_INITDIALOG )
  604. {
  605. PROPSHEETPAGE * ppage = reinterpret_cast< PROPSHEETPAGE * >( lParam );
  606. SetWindowLongPtr( hDlgIn, GWLP_USERDATA, (LPARAM) ppage->lParam );
  607. pPage = reinterpret_cast< CClusDomainPage * >( ppage->lParam );
  608. pPage->m_hwnd = hDlgIn;
  609. }
  610. if ( pPage != NULL )
  611. {
  612. Assert( hDlgIn == pPage->m_hwnd );
  613. switch( MsgIn )
  614. {
  615. case WM_INITDIALOG:
  616. lr = pPage->OnInitDialog();
  617. break;
  618. case WM_NOTIFY:
  619. lr = pPage->OnNotify( wParam, reinterpret_cast< LPNMHDR >( lParam ) );
  620. break;
  621. case WM_COMMAND:
  622. lr= pPage->OnCommand( HIWORD( wParam ), LOWORD( wParam ), (HWND) lParam );
  623. break;
  624. // no default clause needed
  625. } // switch: message
  626. } // if: there is a page associated with the window
  627. return lr;
  628. } //*** CClusDomainPage::S_DlgProc()
  629. // ************************************************************************
  630. //
  631. // IUnknown
  632. //
  633. // ************************************************************************
  634. //////////////////////////////////////////////////////////////////////////////
  635. //++
  636. //
  637. // [IUnknown]
  638. // CClusDomainPage::QueryInterface
  639. //
  640. // Description:
  641. //
  642. // Arguments:
  643. // riidIn
  644. // ppvOut
  645. //
  646. // Return Values:
  647. // S_OK
  648. // E_NOINTERFACE
  649. // Other HRESULT values.
  650. //
  651. // Remarks:
  652. // Supports IUnknown and ITaskGetDomainsCallback.
  653. //
  654. //--
  655. //////////////////////////////////////////////////////////////////////////////
  656. STDMETHODIMP
  657. CClusDomainPage::QueryInterface(
  658. REFIID riidIn,
  659. LPVOID * ppvOut
  660. )
  661. {
  662. TraceQIFunc( riidIn, ppvOut );
  663. HRESULT hr = E_NOINTERFACE;
  664. if ( IsEqualIID( riidIn, IID_IUnknown ) )
  665. {
  666. *ppvOut = static_cast< ITaskGetDomainsCallback * >( this );
  667. hr = S_OK;
  668. } // if: IUnknown
  669. else if ( IsEqualIID( riidIn, IID_ITaskGetDomainsCallback ) )
  670. {
  671. *ppvOut = TraceInterface( __THISCLASS__, ITaskGetDomainsCallback, this, 0 );
  672. hr = S_OK;
  673. } // else if: ITaskGetDomainsCallback
  674. if ( SUCCEEDED( hr ) )
  675. {
  676. ((IUnknown*) *ppvOut)->AddRef();
  677. } // if: success
  678. QIRETURN_IGNORESTDMARSHALLING( hr, riidIn );
  679. } //*** CClusDomainPage::QueryInterface()
  680. //////////////////////////////////////////////////////////////////////////////
  681. //++
  682. //
  683. // [IUnknown]
  684. // CClusDomainPage::AddRef
  685. //
  686. // Description:
  687. //
  688. // Arguments:
  689. // None.
  690. //
  691. // Return Values:
  692. // New reference count.
  693. //
  694. // Remarks:
  695. //
  696. //--
  697. //////////////////////////////////////////////////////////////////////////////
  698. STDMETHODIMP_( ULONG )
  699. CClusDomainPage::AddRef( void )
  700. {
  701. TraceFunc( "[IUnknown]" );
  702. InterlockedIncrement( &m_cRef );
  703. RETURN( m_cRef );
  704. } //*** CClusDomainPage::AddRef()
  705. //////////////////////////////////////////////////////////////////////////////
  706. //++
  707. //
  708. // [IUnknown]
  709. // CClusDomainPage::Release
  710. //
  711. // Description:
  712. //
  713. // Arguments:
  714. // None.
  715. //
  716. // Return Values:
  717. // New reference count.
  718. //
  719. // Remarks:
  720. //
  721. //--
  722. //////////////////////////////////////////////////////////////////////////////
  723. STDMETHODIMP_( ULONG )
  724. CClusDomainPage::Release( void )
  725. {
  726. TraceFunc( "[IUnknown]" );
  727. LONG cRef;
  728. InterlockedDecrement( &m_cRef );
  729. cRef = m_cRef;
  730. if ( cRef == 0 )
  731. {
  732. // TraceDo( delete this );
  733. }
  734. RETURN( cRef );
  735. } //*** CClusDomainPage::Release()
  736. //****************************************************************************
  737. //
  738. // ITaskGetDomainsCallback
  739. //
  740. //****************************************************************************
  741. //////////////////////////////////////////////////////////////////////////////
  742. //++
  743. //
  744. // [ITaskGetDomainsCallback]
  745. // CClusDomainPage::ReceiveDomainResult
  746. //
  747. // Description:
  748. //
  749. // Arguments:
  750. // hrIn
  751. //
  752. // Return Values:
  753. // S_OK
  754. // Other HRESULT values.
  755. //
  756. // Remarks:
  757. //
  758. //--
  759. //////////////////////////////////////////////////////////////////////////////
  760. STDMETHODIMP
  761. CClusDomainPage::ReceiveDomainResult(
  762. HRESULT hrIn
  763. )
  764. {
  765. TraceFunc( "[ITaskGetDomainsCallback]" );
  766. HRESULT hr;
  767. hr = THR( m_ptgd->SetCallback( NULL ) );
  768. HRETURN( hr );
  769. } //*** CClusDomainPage::ReceiveResult()
  770. //////////////////////////////////////////////////////////////////////////////
  771. //++
  772. //
  773. // [ITaskGetDomainsCallback]
  774. // CClusDomainPage::ReceiveDomainName
  775. //
  776. // Description:
  777. //
  778. // Arguments:
  779. // bstrDomainIn
  780. //
  781. // Remarks:
  782. //
  783. //--
  784. //////////////////////////////////////////////////////////////////////////////
  785. STDMETHODIMP
  786. CClusDomainPage::ReceiveDomainName(
  787. LPCWSTR pcszDomainIn
  788. )
  789. {
  790. TraceFunc( "[ITaskGetDomainsCallback]" );
  791. HRESULT hr = S_OK;
  792. ComboBox_AddString( GetDlgItem( m_hwnd, IDC_CLUSDOMAIN_CB_DOMAIN ), pcszDomainIn );
  793. HRETURN( hr );
  794. } //*** CClusDomainPage::ReceiveName()