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.

886 lines
21 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000-2001 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CSAccountPage.cpp
  7. //
  8. // Maintained By:
  9. // David Potter (DavidP) 22-MAR-2001
  10. // Geoffrey Pease (GPease) 12-MAY-2000
  11. //
  12. //////////////////////////////////////////////////////////////////////////////
  13. #include "Pch.h"
  14. #include "CSAccountPage.h"
  15. DEFINE_THISCLASS("CCSAccountPage");
  16. //////////////////////////////////////////////////////////////////////////////
  17. //++
  18. //
  19. // CCSAccountPage::CCSAccountPage(
  20. // IServiceProvider * pspIn,
  21. // ECreateAddMode ecamCreateAddModeIn,
  22. // BSTR * pbstrUsernameIn,
  23. // BSTR * pbstrPasswordIn,
  24. // BSTR * pbstrDomainIn,
  25. // BSTR * pbstrClusterNameIn
  26. // )
  27. //
  28. //--
  29. //////////////////////////////////////////////////////////////////////////////
  30. CCSAccountPage::CCSAccountPage(
  31. IServiceProvider * pspIn,
  32. ECreateAddMode ecamCreateAddModeIn,
  33. BSTR * pbstrUsernameIn,
  34. BSTR * pbstrPasswordIn,
  35. BSTR * pbstrDomainIn,
  36. BSTR * pbstrClusterNameIn
  37. )
  38. {
  39. TraceFunc( "" );
  40. // m_hwnd
  41. THR( pspIn->TypeSafeQI( IServiceProvider, &m_psp ) );
  42. m_ecamCreateAddMode = ecamCreateAddModeIn;
  43. m_pbstrUsername = pbstrUsernameIn;
  44. m_pbstrPassword = pbstrPasswordIn;
  45. m_pbstrDomain = pbstrDomainIn;
  46. m_pbstrClusterName = pbstrClusterNameIn;
  47. m_cRef = 0;
  48. m_ptgd = NULL;
  49. Assert( m_pbstrUsername != NULL );
  50. Assert( m_pbstrPassword != NULL );
  51. Assert( m_pbstrDomain != NULL );
  52. Assert( m_pbstrClusterName != NULL );
  53. TraceFuncExit();
  54. } //*** CCSAccountPage::CCSAccountPage()
  55. //////////////////////////////////////////////////////////////////////////////
  56. //++
  57. //
  58. // CCSAccountPage::~CCSAccountPage( void )
  59. //
  60. //--
  61. //////////////////////////////////////////////////////////////////////////////
  62. CCSAccountPage::~CCSAccountPage( void )
  63. {
  64. TraceFunc( "" );
  65. if ( m_psp != NULL )
  66. {
  67. m_psp->Release();
  68. }
  69. if ( m_ptgd != NULL )
  70. {
  71. // Make sure we don't get called anymore.
  72. THR( m_ptgd->SetCallback( NULL ) );
  73. m_ptgd->Release();
  74. }
  75. Assert( m_cRef == 0 );
  76. TraceFuncExit();
  77. } //*** CCSAccountPage::~CCSAccountPage()
  78. //////////////////////////////////////////////////////////////////////////////
  79. //++
  80. //
  81. // LRESULT
  82. // CCSAccountPage::OnInitDialog( void )
  83. //
  84. //--
  85. //////////////////////////////////////////////////////////////////////////////
  86. LRESULT
  87. CCSAccountPage::OnInitDialog( void )
  88. {
  89. TraceFunc( "" );
  90. BOOL bRet;
  91. HRESULT hr;
  92. BSTR bstrDomain = NULL;
  93. IUnknown * punk = NULL;
  94. ITaskManager * ptm = NULL;
  95. LRESULT lr = FALSE;
  96. //
  97. // (jfranco, bug #377545) Limit user name length to MAX_USERNAME_LENGTH
  98. //
  99. // according to msdn, EM_(SET)LIMITTEXT does not return a value, so ignore what SendDlgItemMessage returns
  100. SendDlgItemMessage( m_hwnd, IDC_CSACCOUNT_E_USERNAME, EM_SETLIMITTEXT, MAX_USERNAME_LENGTH, 0 );
  101. //
  102. // Create the task to get the domains.
  103. //
  104. hr = THR( m_psp->TypeSafeQS( CLSID_TaskManager,
  105. ITaskManager,
  106. &ptm
  107. ) );
  108. if ( FAILED( hr ) )
  109. goto Cleanup;
  110. hr = THR( ptm->CreateTask( TASK_GetDomains, &punk ) );
  111. if ( FAILED( hr ) )
  112. goto Cleanup;
  113. // TraceMoveFromMemoryList( punk, g_GlobalMemoryList );
  114. hr = THR( punk->TypeSafeQI( ITaskGetDomains, &m_ptgd ) );
  115. if ( FAILED( hr ) )
  116. goto Cleanup;
  117. hr = THR( m_ptgd->SetCallback( static_cast< ITaskGetDomainsCallback * >( this ) ) );
  118. if ( FAILED( hr ) )
  119. goto Cleanup;
  120. hr = THR( ptm->SubmitTask( m_ptgd ) );
  121. if ( FAILED( hr ) )
  122. goto Cleanup;
  123. //
  124. // Default to the script supplied information.
  125. //
  126. SetDlgItemText( m_hwnd, IDC_CSACCOUNT_E_USERNAME, *m_pbstrUsername );
  127. SetDlgItemText( m_hwnd, IDC_CSACCOUNT_E_PASSWORD, *m_pbstrPassword );
  128. SetDlgItemText( m_hwnd, IDC_CSACCOUNT_CB_DOMAIN, *m_pbstrDomain );
  129. //
  130. // Get the domain of the current computer.
  131. //
  132. hr = THR( HrGetComputerName( ComputerNameDnsDomain, &bstrDomain ) );
  133. if ( FAILED( hr ) )
  134. goto Cleanup;
  135. SetDlgItemText( m_hwnd, IDC_CSACCOUNT_CB_DOMAIN, bstrDomain );
  136. Cleanup:
  137. THR( HrUpdateWizardButtons( FALSE ) );
  138. if ( punk != NULL )
  139. {
  140. punk->Release();
  141. }
  142. if ( ptm != NULL )
  143. {
  144. ptm->Release();
  145. }
  146. TraceSysFreeString( bstrDomain );
  147. RETURN( lr );
  148. } //*** CCSAccountPage::OnInitDialog()
  149. //////////////////////////////////////////////////////////////////////////////
  150. //++
  151. //
  152. // LRESULT
  153. // CCSAccountPage::OnCommand(
  154. // UINT idNotificationIn,
  155. // UINT idControlIn,
  156. // HWND hwndSenderIn
  157. // )
  158. //
  159. //--
  160. //////////////////////////////////////////////////////////////////////////////
  161. LRESULT
  162. CCSAccountPage::OnCommand(
  163. UINT idNotificationIn,
  164. UINT idControlIn,
  165. HWND hwndSenderIn
  166. )
  167. {
  168. TraceFunc( "" );
  169. LRESULT lr = FALSE;
  170. switch ( idControlIn )
  171. {
  172. case IDC_CSACCOUNT_E_PASSWORD:
  173. case IDC_CSACCOUNT_E_USERNAME:
  174. if ( idNotificationIn == EN_CHANGE )
  175. {
  176. THR( HrUpdateWizardButtons( FALSE ) );
  177. lr = TRUE;
  178. }
  179. break;
  180. case IDC_CSACCOUNT_CB_DOMAIN:
  181. if ( idNotificationIn == CBN_EDITCHANGE )
  182. {
  183. THR( HrUpdateWizardButtons( FALSE ) );
  184. lr = TRUE;
  185. }
  186. else if ( idNotificationIn == CBN_SELCHANGE )
  187. {
  188. THR( HrUpdateWizardButtons( TRUE ) );
  189. lr = TRUE;
  190. }
  191. break;
  192. }
  193. RETURN( lr );
  194. } //*** CCSAccountPage::OnCommand()
  195. //////////////////////////////////////////////////////////////////////////////
  196. //++
  197. //
  198. // HRESULT
  199. // CCSAccountPage::HrUpdateWizardButtons(
  200. // BOOL fIgnoreComboxBoxIn
  201. // )
  202. //
  203. //--
  204. //////////////////////////////////////////////////////////////////////////////
  205. HRESULT
  206. CCSAccountPage::HrUpdateWizardButtons(
  207. BOOL fIgnoreComboxBoxIn
  208. )
  209. {
  210. TraceFunc( "" );
  211. DWORD dwLen;
  212. HRESULT hr = S_OK;
  213. DWORD dwFlags = PSWIZB_BACK | PSWIZB_NEXT;
  214. dwLen = GetWindowTextLength( GetDlgItem( m_hwnd, IDC_CSACCOUNT_E_USERNAME ) );
  215. if ( dwLen == 0 )
  216. {
  217. dwFlags &= ~PSWIZB_NEXT;
  218. }
  219. //
  220. // It is valid to have a blank password. No need to check it.
  221. //
  222. if ( !fIgnoreComboxBoxIn )
  223. {
  224. LRESULT lr;
  225. dwLen = GetWindowTextLength( GetDlgItem( m_hwnd, IDC_CSACCOUNT_CB_DOMAIN ) );
  226. lr = ComboBox_GetCurSel( GetDlgItem( m_hwnd, IDC_CSACCOUNT_CB_DOMAIN ) );
  227. if ( lr == CB_ERR )
  228. {
  229. if ( dwLen == 0 )
  230. {
  231. dwFlags &= ~PSWIZB_NEXT;
  232. }
  233. }
  234. else if ( dwLen == 0 )
  235. {
  236. dwFlags &= ~PSWIZB_NEXT;
  237. }
  238. }
  239. PropSheet_SetWizButtons( GetParent( m_hwnd ), dwFlags );
  240. HRETURN( hr );
  241. } //*** CCSAccountPage::HrUpdateWizardButtons()
  242. //////////////////////////////////////////////////////////////////////////////
  243. //++
  244. //
  245. // LRESULT
  246. // CCSAccountPage::OnNotifyQueryCancel( void )
  247. //
  248. //--
  249. //////////////////////////////////////////////////////////////////////////////
  250. LRESULT
  251. CCSAccountPage::OnNotifyQueryCancel( void )
  252. {
  253. TraceFunc( "" );
  254. LRESULT lr = TRUE;
  255. int iRet;
  256. iRet = MessageBoxFromStrings( m_hwnd,
  257. IDS_QUERY_CANCEL_TITLE,
  258. IDS_QUERY_CANCEL_TEXT,
  259. MB_YESNO
  260. );
  261. if ( iRet == IDNO )
  262. {
  263. SetWindowLongPtr( m_hwnd, DWLP_MSGRESULT, -1 );
  264. }
  265. RETURN( lr );
  266. } //*** CCSAccountPage::OnNotifyQueryCancel()
  267. //////////////////////////////////////////////////////////////////////////////
  268. //++
  269. //
  270. // LRESULT
  271. // CCSAccountPage::OnNotifySetActive( void )
  272. //
  273. //--
  274. //////////////////////////////////////////////////////////////////////////////
  275. LRESULT
  276. CCSAccountPage::OnNotifySetActive( void )
  277. {
  278. TraceFunc( "" );
  279. HRESULT hr;
  280. OBJECTCOOKIE cookieDummy;
  281. LRESULT lr = TRUE;
  282. IUnknown * punk = NULL;
  283. IClusCfgClusterInfo * pccci = NULL;
  284. IClusCfgCredentials * piccc = NULL;
  285. IObjectManager * pom = NULL;
  286. BSTR bstrUsername = NULL;
  287. BSTR bstrPassword = NULL;
  288. BSTR bstrDomain = NULL;
  289. if ( m_ecamCreateAddMode == camADDING )
  290. {
  291. Assert( *m_pbstrClusterName != NULL );
  292. //
  293. // See if the cluster configuration information has something
  294. // different.
  295. //
  296. hr = THR( m_psp->TypeSafeQS( CLSID_ObjectManager,
  297. IObjectManager,
  298. &pom
  299. ) );
  300. if ( FAILED( hr ) )
  301. goto Cleanup;
  302. hr = THR( pom->FindObject( CLSID_ClusterConfigurationType,
  303. NULL,
  304. *m_pbstrClusterName,
  305. DFGUID_ClusterConfigurationInfo,
  306. &cookieDummy,
  307. &punk
  308. ) );
  309. if ( FAILED( hr ) )
  310. goto Cleanup;
  311. hr = THR( punk->TypeSafeQI( IClusCfgClusterInfo, &pccci ) );
  312. if ( FAILED( hr ) )
  313. goto Cleanup;
  314. hr = THR( pccci->GetClusterServiceAccountCredentials( &piccc ) );
  315. if ( FAILED( hr ) )
  316. goto Cleanup;
  317. hr = THR( piccc->GetCredentials( &bstrUsername,
  318. &bstrDomain,
  319. &bstrPassword
  320. ) );
  321. if ( FAILED( hr ) )
  322. goto Cleanup;
  323. SetDlgItemText( m_hwnd, IDC_CSACCOUNT_E_USERNAME, bstrUsername );
  324. SetDlgItemText( m_hwnd, IDC_CSACCOUNT_CB_DOMAIN, bstrDomain );
  325. //
  326. // Only update the password if we actually received something from GetCredentials().
  327. // When we first enter this page, this will not be the case and we would nuke the
  328. // scripted password.
  329. //
  330. if ( ( bstrPassword != NULL )
  331. && ( *bstrPassword != L'\0' ) )
  332. SetDlgItemText( m_hwnd, IDC_CSACCOUNT_E_PASSWORD, bstrPassword );
  333. //
  334. // Disable the username and domain windows.
  335. //
  336. EnableWindow( GetDlgItem( m_hwnd, IDC_CSACCOUNT_E_USERNAME ), FALSE );
  337. EnableWindow( GetDlgItem( m_hwnd, IDC_CSACCOUNT_CB_DOMAIN ), FALSE );
  338. }
  339. Cleanup:
  340. THR( HrUpdateWizardButtons( FALSE ) );
  341. if ( punk != NULL )
  342. {
  343. punk->Release();
  344. }
  345. if ( pom != NULL )
  346. {
  347. pom->Release();
  348. }
  349. if ( piccc != NULL )
  350. {
  351. piccc->Release();
  352. }
  353. if ( pccci != NULL )
  354. {
  355. pccci->Release();
  356. }
  357. TraceSysFreeString( bstrUsername );
  358. TraceSysFreeString( bstrPassword );
  359. TraceSysFreeString( bstrDomain );
  360. RETURN( lr );
  361. } //*** CCSAccountPage::OnNotifySetActive()
  362. //////////////////////////////////////////////////////////////////////////////
  363. //++
  364. //
  365. // LRESULT
  366. // CCSAccountPage::OnNotifyWizNext( void )
  367. //
  368. //--
  369. //////////////////////////////////////////////////////////////////////////////
  370. LRESULT
  371. CCSAccountPage::OnNotifyWizNext( void )
  372. {
  373. TraceFunc( "" );
  374. HRESULT hr;
  375. HWND hwnd;
  376. DWORD dwLen;
  377. BSTR bstrUsername = NULL;
  378. BSTR bstrPassword = NULL;
  379. BSTR bstrDomain = NULL;
  380. OBJECTCOOKIE cookieDummy;
  381. LRESULT lr = TRUE;
  382. IUnknown * punk = NULL;
  383. IObjectManager * pom = NULL;
  384. IClusCfgClusterInfo * pccci = NULL;
  385. IClusCfgCredentials * piccc = NULL;
  386. //
  387. // Get the username from the UI.
  388. //
  389. hwnd = GetDlgItem( m_hwnd, IDC_CSACCOUNT_E_USERNAME );
  390. Assert( hwnd != NULL );
  391. dwLen = GetWindowTextLength( hwnd );
  392. Assert( dwLen != 0 );
  393. dwLen ++;
  394. bstrUsername = TraceSysAllocStringByteLen( NULL, sizeof(WCHAR) * ( dwLen + 1 ) );
  395. if ( bstrUsername == NULL )
  396. goto OutOfMemory;
  397. GetWindowText( hwnd, bstrUsername, dwLen );
  398. //
  399. // Get the password from the UI.
  400. //
  401. hwnd = GetDlgItem( m_hwnd, IDC_CSACCOUNT_E_PASSWORD );
  402. Assert( hwnd != NULL );
  403. dwLen = GetWindowTextLength( hwnd );
  404. dwLen ++;
  405. bstrPassword = TraceSysAllocStringByteLen( NULL, sizeof(WCHAR) * ( dwLen + 1 ) );
  406. if ( bstrPassword == NULL )
  407. goto OutOfMemory;
  408. GetWindowText( hwnd, bstrPassword, dwLen );
  409. //
  410. // Get the domain from the UI.
  411. //
  412. hwnd = GetDlgItem( m_hwnd, IDC_CSACCOUNT_CB_DOMAIN );
  413. Assert( hwnd != NULL );
  414. dwLen = GetWindowTextLength( hwnd );
  415. Assert( dwLen != 0 );
  416. dwLen ++;
  417. bstrDomain = TraceSysAllocStringByteLen( NULL, sizeof(WCHAR) * ( dwLen + 1 ) );
  418. if ( bstrDomain == NULL )
  419. goto OutOfMemory;
  420. GetWindowText( hwnd, bstrDomain, dwLen );
  421. //
  422. // Release the old strings (if any).
  423. //
  424. TraceSysFreeString( *m_pbstrUsername );
  425. TraceSysFreeString( *m_pbstrPassword );
  426. TraceSysFreeString( *m_pbstrDomain );
  427. //
  428. // Give ownership away.
  429. //
  430. *m_pbstrUsername = bstrUsername;
  431. *m_pbstrPassword = bstrPassword;
  432. *m_pbstrDomain = bstrDomain;
  433. bstrUsername = NULL;
  434. bstrPassword = NULL;
  435. bstrDomain = NULL;
  436. //
  437. // Grab the object manager.
  438. //
  439. hr = THR( m_psp->TypeSafeQS( CLSID_ObjectManager,
  440. IObjectManager,
  441. &pom
  442. ) );
  443. if ( FAILED( hr ) )
  444. goto Error;
  445. //
  446. // Get the cluster configuration info.
  447. //
  448. hr = THR( pom->FindObject( CLSID_ClusterConfigurationType,
  449. NULL,
  450. *m_pbstrClusterName,
  451. DFGUID_ClusterConfigurationInfo,
  452. &cookieDummy,
  453. &punk
  454. ) );
  455. if ( FAILED( hr ) )
  456. goto Error;
  457. hr = THR( punk->TypeSafeQI( IClusCfgClusterInfo, &pccci ) );
  458. if ( FAILED( hr ) )
  459. goto Cleanup;
  460. //
  461. // Set the cluster service account credentials...
  462. //
  463. hr = THR( pccci->GetClusterServiceAccountCredentials( &piccc ) );
  464. if ( FAILED( hr ) )
  465. goto Error;
  466. hr = THR( piccc->SetCredentials( *m_pbstrUsername, *m_pbstrDomain, *m_pbstrPassword ) );
  467. if ( FAILED( hr ) )
  468. goto Error;
  469. Cleanup:
  470. if ( punk != NULL )
  471. {
  472. punk->Release();
  473. }
  474. TraceSysFreeString( bstrUsername );
  475. TraceSysFreeString( bstrPassword );
  476. TraceSysFreeString( bstrDomain );
  477. if ( piccc != NULL )
  478. {
  479. piccc->Release();
  480. }
  481. if ( pccci != NULL )
  482. {
  483. pccci->Release();
  484. }
  485. if ( pom != NULL )
  486. {
  487. pom->Release();
  488. }
  489. RETURN( lr );
  490. Error:
  491. SetWindowLongPtr( m_hwnd, DWLP_MSGRESULT, -1 );
  492. goto Cleanup;
  493. OutOfMemory:
  494. goto Error;
  495. } //*** CCSAccountPage::OnNotifyWizNext()
  496. //////////////////////////////////////////////////////////////////////////////
  497. //++
  498. //
  499. // LRESULT
  500. // CCSAccountPage::OnNotify(
  501. // WPARAM idCtrlIn,
  502. // LPNMHDR pnmhdrIn
  503. // )
  504. //
  505. //--
  506. //////////////////////////////////////////////////////////////////////////////
  507. LRESULT
  508. CCSAccountPage::OnNotify(
  509. WPARAM idCtrlIn,
  510. LPNMHDR pnmhdrIn
  511. )
  512. {
  513. TraceFunc( "" );
  514. LRESULT lr = TRUE;
  515. SetWindowLongPtr( m_hwnd, DWLP_MSGRESULT, 0 );
  516. switch( pnmhdrIn->code )
  517. {
  518. case PSN_SETACTIVE:
  519. lr = OnNotifySetActive();
  520. break;
  521. case PSN_WIZNEXT:
  522. lr = OnNotifyWizNext();
  523. break;
  524. case PSN_QUERYCANCEL:
  525. lr = OnNotifyQueryCancel();
  526. break;
  527. }
  528. RETURN( lr );
  529. } //*** CCSAccountPage::OnNotify()
  530. //////////////////////////////////////////////////////////////////////////////
  531. //++
  532. //
  533. // INT_PTR
  534. // CALLBACK
  535. // CCSAccountPage::S_DlgProc(
  536. // HWND hDlgIn,
  537. // UINT MsgIn,
  538. // WPARAM wParam,
  539. // LPARAM lParam
  540. // )
  541. //
  542. //--
  543. //////////////////////////////////////////////////////////////////////////////
  544. INT_PTR
  545. CALLBACK
  546. CCSAccountPage::S_DlgProc(
  547. HWND hDlgIn,
  548. UINT MsgIn,
  549. WPARAM wParam,
  550. LPARAM lParam
  551. )
  552. {
  553. // Don't do TraceFunc because every mouse movement
  554. // will cause this function to be called.
  555. WndMsg( hDlgIn, MsgIn, wParam, lParam );
  556. LRESULT lr = FALSE;
  557. CCSAccountPage * pPage = reinterpret_cast< CCSAccountPage *> ( GetWindowLongPtr( hDlgIn, GWLP_USERDATA ) );
  558. if ( MsgIn == WM_INITDIALOG )
  559. {
  560. PROPSHEETPAGE * ppage = reinterpret_cast< PROPSHEETPAGE * >( lParam );
  561. SetWindowLongPtr( hDlgIn, GWLP_USERDATA, (LPARAM) ppage->lParam );
  562. pPage = reinterpret_cast< CCSAccountPage * >( ppage->lParam );
  563. pPage->m_hwnd = hDlgIn;
  564. }
  565. if ( pPage != NULL )
  566. {
  567. Assert( hDlgIn == pPage->m_hwnd );
  568. switch( MsgIn )
  569. {
  570. case WM_INITDIALOG:
  571. lr = pPage->OnInitDialog();
  572. break;
  573. case WM_NOTIFY:
  574. lr = pPage->OnNotify( wParam, reinterpret_cast< LPNMHDR >( lParam ) );
  575. break;
  576. case WM_COMMAND:
  577. lr= pPage->OnCommand( HIWORD( wParam ), LOWORD( wParam ), (HWND) lParam );
  578. break;
  579. // no default clause needed
  580. }
  581. }
  582. return lr;
  583. } //*** CCSAccountPage::S_DlgProc()
  584. // ************************************************************************
  585. //
  586. // IUnknown
  587. //
  588. // ************************************************************************
  589. //////////////////////////////////////////////////////////////////////////////
  590. //++
  591. //
  592. // STDMETHODIMP
  593. // CCSAccountPage::QueryInterface(
  594. // REFIID riidIn,
  595. // LPVOID * ppvOut
  596. // )
  597. //
  598. //--
  599. //////////////////////////////////////////////////////////////////////////////
  600. STDMETHODIMP
  601. CCSAccountPage::QueryInterface(
  602. REFIID riidIn,
  603. LPVOID * ppvOut
  604. )
  605. {
  606. TraceQIFunc( riidIn, ppvOut );
  607. HRESULT hr = E_NOINTERFACE;
  608. if ( IsEqualIID( riidIn, IID_IUnknown ) )
  609. {
  610. *ppvOut = static_cast< ITaskGetDomainsCallback * >( this );
  611. hr = S_OK;
  612. } // if: IUnknown
  613. else if ( IsEqualIID( riidIn, IID_ITaskGetDomainsCallback ) )
  614. {
  615. *ppvOut = TraceInterface( __THISCLASS__, ITaskGetDomainsCallback, this, 0 );
  616. hr = S_OK;
  617. } // else if: ITaskGetDomainsCallback
  618. if ( SUCCEEDED( hr ) )
  619. {
  620. ((IUnknown*) *ppvOut)->AddRef();
  621. } // if: success
  622. QIRETURN_IGNORESTDMARSHALLING( hr, riidIn );
  623. } //*** CCSAccountPage::QueryInterface()
  624. //////////////////////////////////////////////////////////////////////////////
  625. //++
  626. //
  627. // STDMETHODIMP_( ULONG )
  628. // CCSAccountPage::AddRef( void )
  629. //
  630. //--
  631. //////////////////////////////////////////////////////////////////////////////
  632. STDMETHODIMP_( ULONG )
  633. CCSAccountPage::AddRef( void )
  634. {
  635. TraceFunc( "[IUnknown]" );
  636. InterlockedIncrement( &m_cRef );
  637. RETURN( m_cRef );
  638. } //*** CCSAccountPage::AddRef()
  639. //////////////////////////////////////////////////////////////////////////////
  640. //++
  641. //
  642. // STDMETHODIMP_( ULONG )
  643. // CCSAccountPage::Release( void )
  644. //
  645. //--
  646. //////////////////////////////////////////////////////////////////////////////
  647. STDMETHODIMP_( ULONG )
  648. CCSAccountPage::Release( void )
  649. {
  650. TraceFunc( "[IUnknown]" );
  651. InterlockedDecrement( &m_cRef );
  652. if ( m_cRef )
  653. RETURN( m_cRef );
  654. // TraceDo( delete this );
  655. RETURN(0);
  656. } //*** CCSAccountPage::Release()
  657. //****************************************************************************
  658. //
  659. // ITaskGetDomainsCallback
  660. //
  661. //****************************************************************************
  662. //////////////////////////////////////////////////////////////////////////////
  663. //++
  664. //
  665. // STDMETHODIMP
  666. // CCSAccountPage::ReceiveDomainResult(
  667. // HRESULT hrIn
  668. // )
  669. //
  670. //--
  671. //////////////////////////////////////////////////////////////////////////////
  672. STDMETHODIMP
  673. CCSAccountPage::ReceiveDomainResult(
  674. HRESULT hrIn
  675. )
  676. {
  677. TraceFunc( "[ITaskGetDomainsCallback]" );
  678. HRESULT hr;
  679. hr = THR( m_ptgd->SetCallback( NULL ) );
  680. HRETURN( hr );
  681. } //*** CCSAccountPage::ReceiveResult()
  682. //////////////////////////////////////////////////////////////////////////////
  683. //++
  684. //
  685. // STDMETHODIMP
  686. // CCSAccountPage::ReceiveDomainName(
  687. // LPCWSTR pcszDomainIn
  688. // )
  689. //
  690. //--
  691. //////////////////////////////////////////////////////////////////////////////
  692. STDMETHODIMP
  693. CCSAccountPage::ReceiveDomainName(
  694. LPCWSTR pcszDomainIn
  695. )
  696. {
  697. TraceFunc( "[ITaskGetDomainsCallback]" );
  698. HRESULT hr = S_OK;
  699. ComboBox_AddString( GetDlgItem( m_hwnd, IDC_CSACCOUNT_CB_DOMAIN ), pcszDomainIn );
  700. HRETURN( hr );
  701. } //*** CCSAccountPage::ReceiveName()