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.

990 lines
25 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CreateClusterWizard.cpp
  7. //
  8. // Description:
  9. // Implementation of CCreateClusterWizard class.
  10. //
  11. // Maintained By:
  12. // John Franco (jfranco) 17-APR-2002
  13. //
  14. //////////////////////////////////////////////////////////////////////////////
  15. //////////////////////////////////////////////////////////////////////////////
  16. // Include Files
  17. //////////////////////////////////////////////////////////////////////////////
  18. #include "Pch.h"
  19. #include "CreateClusterWizard.h"
  20. //****************************************************************************
  21. //
  22. // CCreateClusterWizard
  23. //
  24. //****************************************************************************
  25. DEFINE_THISCLASS( "CCreateClusterWizard" )
  26. //////////////////////////////////////////////////////////////////////////////
  27. //++
  28. //
  29. // CCreateClusterWizard::S_HrCreateInstance
  30. //
  31. // Description:
  32. // Creates a CCreateClusterWizard instance.
  33. //
  34. // Arguments:
  35. // ppunkOut - The IUnknown interface of the new object.
  36. //
  37. // Return Values:
  38. // S_OK - Success.
  39. // E_OUTOFMEMORY - Not enough memory to create the object.
  40. // Other HRESULTs.
  41. //
  42. //--
  43. //////////////////////////////////////////////////////////////////////////////
  44. HRESULT
  45. CCreateClusterWizard::S_HrCreateInstance( IUnknown ** ppunkOut )
  46. {
  47. TraceFunc( "" );
  48. HRESULT hr = S_OK;
  49. CCreateClusterWizard * pccw = NULL;
  50. Assert( ppunkOut != NULL );
  51. if ( ppunkOut == NULL )
  52. {
  53. hr = THR( E_POINTER );
  54. goto Cleanup;
  55. }
  56. pccw = new CCreateClusterWizard();
  57. if ( pccw == NULL )
  58. {
  59. hr = THR( E_OUTOFMEMORY );
  60. goto Cleanup;
  61. }
  62. hr = THR( pccw->HrInit() );
  63. if ( FAILED( hr ) )
  64. {
  65. goto Cleanup;
  66. }
  67. hr = THR( pccw->TypeSafeQI( IUnknown, ppunkOut ) );
  68. if ( FAILED ( hr ) )
  69. {
  70. goto Cleanup;
  71. }
  72. Cleanup:
  73. if ( pccw != NULL )
  74. {
  75. pccw->Release();
  76. }
  77. HRETURN( hr );
  78. } //*** CCreateClusterWizard::S_HrCreateInstance
  79. //////////////////////////////////////////////////////////////////////////////
  80. //++
  81. //
  82. // CCreateClusterWizard::CCreateClusterWizard
  83. //
  84. // Description:
  85. // Default constructor.
  86. //
  87. // Arguments:
  88. // None.
  89. //
  90. // Return Values:
  91. // None.
  92. //
  93. //--
  94. //////////////////////////////////////////////////////////////////////////////
  95. CCreateClusterWizard::CCreateClusterWizard( void )
  96. : m_pccw( NULL )
  97. , m_bstrFirstNodeInCluster( NULL )
  98. , m_cRef( 1 )
  99. {
  100. } //*** CCreateClusterWizard::CCreateClusterWizard
  101. //////////////////////////////////////////////////////////////////////////////
  102. //++
  103. //
  104. // CCreateClusterWizard::~CCreateClusterWizard
  105. //
  106. // Description:
  107. // Destructor.
  108. //
  109. // Arguments:
  110. // None.
  111. //
  112. // Return Values:
  113. // None.
  114. //
  115. //--
  116. //////////////////////////////////////////////////////////////////////////////
  117. CCreateClusterWizard::~CCreateClusterWizard( void )
  118. {
  119. TraceFunc( "" );
  120. if ( m_pccw != NULL )
  121. {
  122. m_pccw->Release();
  123. }
  124. TraceSysFreeString( m_bstrFirstNodeInCluster );
  125. TraceFuncExit();
  126. } //*** CCreateClusterWizard::~CCreateClusterWizard
  127. //////////////////////////////////////////////////////////////////////////////
  128. //++
  129. //
  130. // CAddNodesWizard::HrInit
  131. //
  132. // Description:
  133. // Initialize the object instance.
  134. //
  135. // Arguments:
  136. // None.
  137. //
  138. // Return Values:
  139. // S_OK - Operation completed successfully.
  140. // Other HRESULTs.
  141. //
  142. //--
  143. //////////////////////////////////////////////////////////////////////////////
  144. HRESULT
  145. CCreateClusterWizard::HrInit( void )
  146. {
  147. TraceFunc( "" );
  148. HRESULT hr = S_OK;
  149. //
  150. // Initialize the IDispatch handler to support the scripting interface.
  151. //
  152. hr = THR( TDispatchHandler< IClusCfgCreateClusterWizard >::HrInit( LIBID_ClusCfgWizard ) );
  153. if ( FAILED ( hr ) )
  154. {
  155. goto Cleanup;
  156. }
  157. //
  158. // Create the wizard object.
  159. //
  160. hr = THR( CClusCfgWizard::S_HrCreateInstance( &m_pccw ) );
  161. if ( FAILED ( hr ) )
  162. {
  163. goto Cleanup;
  164. }
  165. Cleanup:
  166. HRETURN( hr );
  167. } //*** CCreateClusterWizard::HrInit
  168. //****************************************************************************
  169. //
  170. // IUnknown
  171. //
  172. //****************************************************************************
  173. //////////////////////////////////////////////////////////////////////////////
  174. //++
  175. //
  176. // CCreateClusterWizard::QueryInterface
  177. //
  178. // Description:
  179. // Query this object for the passed in interface.
  180. //
  181. // Arguments:
  182. // riidIn
  183. // Id of interface requested.
  184. //
  185. // ppvOut
  186. // Pointer to the requested interface.
  187. //
  188. // Return Value:
  189. // S_OK
  190. // If the interface is available on this object.
  191. //
  192. // E_NOINTERFACE
  193. // If the interface is not available.
  194. //
  195. // E_POINTER
  196. // ppvOut was NULL.
  197. //
  198. // Remarks:
  199. // None.
  200. //
  201. //--
  202. //////////////////////////////////////////////////////////////////////////////
  203. STDMETHODIMP
  204. CCreateClusterWizard::QueryInterface(
  205. REFIID riidIn
  206. , PVOID * ppvOut
  207. )
  208. {
  209. TraceQIFunc( riidIn, ppvOut );
  210. HRESULT hr = S_OK;
  211. //
  212. // Validate arguments.
  213. //
  214. Assert( ppvOut != NULL );
  215. if ( ppvOut == NULL )
  216. {
  217. hr = THR( E_POINTER );
  218. goto Cleanup;
  219. }
  220. //
  221. // Handle known interfaces.
  222. //
  223. if ( IsEqualIID( riidIn, IID_IUnknown ) )
  224. {
  225. *ppvOut = static_cast< IUnknown * >( this );
  226. } // if: IUnknown
  227. else if ( IsEqualIID( riidIn, IID_IClusCfgCreateClusterWizard ) )
  228. {
  229. *ppvOut = TraceInterface( __THISCLASS__, IClusCfgCreateClusterWizard, this, 0 );
  230. } // else if: IClusCfgCreateClusterWizard
  231. else if ( IsEqualIID( riidIn, IID_IDispatch ) )
  232. {
  233. *ppvOut = TraceInterface( __THISCLASS__, IDispatch, this, 0 );
  234. } // else if: IDispatch
  235. else
  236. {
  237. *ppvOut = NULL;
  238. hr = E_NOINTERFACE;
  239. } // else
  240. //
  241. // Add a reference to the interface if successful.
  242. //
  243. if ( SUCCEEDED( hr ) )
  244. {
  245. ((IUnknown *) *ppvOut)->AddRef();
  246. } // if: success
  247. Cleanup:
  248. QIRETURN_IGNORESTDMARSHALLING( hr, riidIn );
  249. } //*** CCreateClusterWizard::QueryInterface
  250. //////////////////////////////////////////////////////////////////////////////
  251. //++
  252. //
  253. // CCreateClusterWizard::AddRef
  254. //
  255. // Description:
  256. // Add a reference to this instance.
  257. //
  258. // Arguments:
  259. // None.
  260. //
  261. // Return Values:
  262. // New reference count.
  263. //
  264. //--
  265. //////////////////////////////////////////////////////////////////////////////
  266. ULONG
  267. CCreateClusterWizard::AddRef( void )
  268. {
  269. TraceFunc( "[IUnknown]" );
  270. InterlockedIncrement( &m_cRef );
  271. CRETURN( m_cRef );
  272. } //*** CCreateClusterWizard::AddRef
  273. //////////////////////////////////////////////////////////////////////////////
  274. //++
  275. //
  276. // CCreateClusterWizard::Release
  277. //
  278. // Description:
  279. // Release a reference to this instance. If it is the last reference
  280. // the object instance will be deallocated.
  281. //
  282. // Arguments:
  283. // None.
  284. //
  285. // Return Values:
  286. // New reference count.
  287. //
  288. //--
  289. //////////////////////////////////////////////////////////////////////////////
  290. ULONG
  291. CCreateClusterWizard::Release( void )
  292. {
  293. TraceFunc( "[IUnknown]" );
  294. LONG cRef;
  295. cRef = InterlockedDecrement( &m_cRef );
  296. if ( cRef == 0 )
  297. {
  298. delete this;
  299. }
  300. CRETURN( cRef );
  301. } //*** CCreateClusterWizard::Release
  302. //****************************************************************************
  303. //
  304. // IClusCfgCreateClusterWizard
  305. //
  306. //****************************************************************************
  307. //////////////////////////////////////////////////////////////////////////////
  308. //++
  309. //
  310. // CCreateClusterWizard::put_ClusterName
  311. //
  312. // Description:
  313. // Set the cluster name to create.
  314. //
  315. // Arguments:
  316. // bstrClusterNameIn - The name of the cluster.
  317. //
  318. // Return Values:
  319. // S_OK - Operation completed successfully.
  320. // Other HRESULTs.
  321. //
  322. //--
  323. //////////////////////////////////////////////////////////////////////////////
  324. STDMETHODIMP
  325. CCreateClusterWizard::put_ClusterName( BSTR bstrClusterNameIn )
  326. {
  327. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  328. HRESULT hr = S_OK;
  329. BSTR bstrClusterLabel = NULL;
  330. PCWSTR pwcszClusterLabel = NULL;
  331. if ( bstrClusterNameIn == NULL )
  332. {
  333. hr = THR( E_POINTER );
  334. goto Cleanup;
  335. }
  336. //
  337. // If the name is fully-qualified, split out just the label for validity test;
  338. // otherwise, use the given name in the validity test.
  339. //
  340. hr = STHR( HrIsValidFQN( bstrClusterNameIn, true ) );
  341. if ( FAILED( hr ) )
  342. {
  343. goto Cleanup;
  344. }
  345. else if ( hr == S_OK )
  346. {
  347. //
  348. // Name is fully-qualified.
  349. //
  350. hr = THR( HrExtractPrefixFromFQN( bstrClusterNameIn, &bstrClusterLabel ) );
  351. if ( FAILED( hr ) )
  352. {
  353. goto Cleanup;
  354. }
  355. pwcszClusterLabel = bstrClusterLabel;
  356. }
  357. else
  358. {
  359. //
  360. // Name is NOT fully-qualified.
  361. //
  362. pwcszClusterLabel = bstrClusterNameIn;
  363. }
  364. //
  365. // Can't use an IP address for cluster name when creating;
  366. // also, cluster label must be compatible with netbios.
  367. //
  368. hr = HrValidateClusterNameLabel( pwcszClusterLabel, true ); // don't trace; name might not be valid.
  369. if ( FAILED( hr ) )
  370. {
  371. goto Cleanup;
  372. }
  373. hr = THR( m_pccw->put_ClusterName( bstrClusterNameIn ) );
  374. if ( FAILED( hr ) )
  375. {
  376. goto Cleanup;
  377. }
  378. Cleanup:
  379. TraceSysFreeString( bstrClusterLabel );
  380. HRETURN( hr );
  381. } //*** CCreateClusterWizard::put_ClusterName
  382. //////////////////////////////////////////////////////////////////////////////
  383. //++
  384. //
  385. // CCreateClusterWizard::get_ClusterName
  386. //
  387. // Description:
  388. // Return the name of the cluster to create. This will be either the
  389. // cluster name specified in a call to put_ClusterName or one entered
  390. // by the user.
  391. //
  392. // Arguments:
  393. // pbstrClusterNameOut - Cluster name used by the wizard.
  394. //
  395. // Return Values:
  396. // S_OK - Operation completed successfully.
  397. // Other HRESULTs.
  398. //
  399. //--
  400. //////////////////////////////////////////////////////////////////////////////
  401. STDMETHODIMP
  402. CCreateClusterWizard::get_ClusterName( BSTR * pbstrClusterNameOut )
  403. {
  404. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  405. HRESULT hr = THR( m_pccw->get_ClusterName( pbstrClusterNameOut ) );
  406. HRETURN( hr );
  407. } //*** CCreateClusterWizard::get_ClusterName
  408. //////////////////////////////////////////////////////////////////////////////
  409. //++
  410. //
  411. // CCreateClusterWizard::put_ServiceAccountName
  412. //
  413. // Description:
  414. // Set the name of the cluster service account.
  415. //
  416. // Arguments:
  417. // bstrServiceAccountNameIn - Cluster service account name.
  418. //
  419. // Return Values:
  420. // S_OK - Operation completed successfully.
  421. // Other HRESULTs.
  422. //
  423. //--
  424. //////////////////////////////////////////////////////////////////////////////
  425. STDMETHODIMP
  426. CCreateClusterWizard::put_ServiceAccountName( BSTR bstrServiceAccountNameIn )
  427. {
  428. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  429. HRESULT hr = THR( m_pccw->put_ServiceAccountUserName( bstrServiceAccountNameIn ) );
  430. HRETURN( hr );
  431. } //*** CCreateClusterWizard::put_ServiceAccountName
  432. //////////////////////////////////////////////////////////////////////////////
  433. //++
  434. //
  435. // CCreateClusterWizard::get_ServiceAccountName
  436. //
  437. // Description:
  438. // Get the name of the cluster service account.
  439. //
  440. // Arguments:
  441. // pbstrServiceAccountNameIn - Cluster service account name.
  442. //
  443. // Return Values:
  444. // S_OK - Operation completed successfully.
  445. // Other HRESULTs.
  446. //
  447. //--
  448. //////////////////////////////////////////////////////////////////////////////
  449. STDMETHODIMP
  450. CCreateClusterWizard::get_ServiceAccountName( BSTR * pbstrServiceAccountNameOut )
  451. {
  452. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  453. HRESULT hr = THR( m_pccw->get_ServiceAccountUserName( pbstrServiceAccountNameOut ) );
  454. HRETURN( hr );
  455. } //*** CCreateClusterWizard::get_ServiceAccountName
  456. //////////////////////////////////////////////////////////////////////////////
  457. //++
  458. //
  459. // CCreateClusterWizard::put_ServiceAccountDomain
  460. //
  461. // Description:
  462. // Set the domain name of the cluster service account.
  463. //
  464. // Arguments:
  465. // bstrServiceAccountDomainIn - Cluster service account domain name.
  466. //
  467. // Return Values:
  468. // S_OK - Operation completed successfully.
  469. // Other HRESULTs.
  470. //
  471. //--
  472. //////////////////////////////////////////////////////////////////////////////
  473. STDMETHODIMP
  474. CCreateClusterWizard::put_ServiceAccountDomain( BSTR bstrServiceAccountDomainIn )
  475. {
  476. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  477. HRESULT hr = THR( m_pccw->put_ServiceAccountDomainName( bstrServiceAccountDomainIn ) );
  478. HRETURN( hr );
  479. } //*** CCreateClusterWizard::put_ServiceAccountDomain
  480. //////////////////////////////////////////////////////////////////////////////
  481. //++
  482. //
  483. // CCreateClusterWizard::get_ServiceAccountDomain
  484. //
  485. // Description:
  486. // Get the domain name of the cluster service account.
  487. //
  488. // Arguments:
  489. // pbstrServiceAccountDomainOut - Cluster service account domain name.
  490. //
  491. // Return Values:
  492. // S_OK - Operation completed successfully.
  493. // Other HRESULTs.
  494. //
  495. //--
  496. //////////////////////////////////////////////////////////////////////////////
  497. STDMETHODIMP
  498. CCreateClusterWizard::get_ServiceAccountDomain( BSTR * pbstrServiceAccountDomainOut )
  499. {
  500. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  501. HRESULT hr = THR( m_pccw->get_ServiceAccountDomainName( pbstrServiceAccountDomainOut ) );
  502. HRETURN( hr );
  503. } //*** CCreateClusterWizard::get_ServiceAccountDomain
  504. //////////////////////////////////////////////////////////////////////////////
  505. //++
  506. //
  507. // CCreateClusterWizard::put_ServiceAccountPassword
  508. //
  509. // Description:
  510. // Set the cluster service account password.
  511. //
  512. // Arguments:
  513. // bstrPasswordIn - Cluster service account password.
  514. //
  515. // Return Values:
  516. // S_OK - Operation completed successfully.
  517. // Other HRESULTs.
  518. //
  519. //--
  520. //////////////////////////////////////////////////////////////////////////////
  521. STDMETHODIMP
  522. CCreateClusterWizard::put_ServiceAccountPassword( BSTR bstrPasswordIn )
  523. {
  524. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  525. HRESULT hr = THR( m_pccw->put_ServiceAccountPassword( bstrPasswordIn ) );
  526. HRETURN( hr );
  527. } //*** CCreateClusterWizard::put_ServiceAccountPassword
  528. //////////////////////////////////////////////////////////////////////////////
  529. //++
  530. //
  531. // CCreateClusterWizard::put_ClusterIPAddress
  532. //
  533. // Description:
  534. // Set the IP address to use for the cluster name.
  535. //
  536. // Arguments:
  537. // bstrClusterIPAddressIn - Cluster IP address in string form.
  538. //
  539. // Return Values:
  540. // S_OK - Operation completed successfully.
  541. // Other HRESULTs.
  542. //
  543. //--
  544. //////////////////////////////////////////////////////////////////////////////
  545. STDMETHODIMP
  546. CCreateClusterWizard::put_ClusterIPAddress( BSTR bstrClusterIPAddressIn )
  547. {
  548. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  549. HRESULT hr = THR( m_pccw->put_ClusterIPAddress( bstrClusterIPAddressIn ) );
  550. HRETURN( hr );
  551. } //*** CCreateClusterWizard::put_ClusterIPAddress
  552. //////////////////////////////////////////////////////////////////////////////
  553. //++
  554. //
  555. // CCreateClusterWizard::get_ClusterIPAddress
  556. //
  557. // Description:
  558. // Get the IP address to use for the cluster name.
  559. //
  560. // Arguments:
  561. // pbstrClusterIPAddressOut - Cluster IP address in string form.
  562. //
  563. // Return Values:
  564. // S_OK - Operation completed successfully.
  565. // Other HRESULTs.
  566. //
  567. //--
  568. //////////////////////////////////////////////////////////////////////////////
  569. STDMETHODIMP
  570. CCreateClusterWizard::get_ClusterIPAddress( BSTR * pbstrClusterIPAddressOut )
  571. {
  572. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  573. HRESULT hr = THR( m_pccw->get_ClusterIPAddress( pbstrClusterIPAddressOut ) );
  574. HRETURN( hr );
  575. } //*** CCreateClusterWizard::get_ClusterIPAddress
  576. //////////////////////////////////////////////////////////////////////////////
  577. //++
  578. //
  579. // CCreateClusterWizard::get_ClusterIPSubnet
  580. //
  581. // Description:
  582. // Get the IP address subnet mask for the cluster name calculated by
  583. // the wizard.
  584. //
  585. // Arguments:
  586. // pbstrClusterIPSubnetOut - Cluster IP address subnet mask in string form.
  587. //
  588. // Return Values:
  589. // S_OK - Operation completed successfully.
  590. // Other HRESULTs.
  591. //
  592. //--
  593. //////////////////////////////////////////////////////////////////////////////
  594. STDMETHODIMP
  595. CCreateClusterWizard::get_ClusterIPSubnet(
  596. BSTR * pbstrClusterIPSubnetOut
  597. )
  598. {
  599. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  600. HRESULT hr = THR( m_pccw->get_ClusterIPSubnet( pbstrClusterIPSubnetOut ) );
  601. HRETURN( hr );
  602. } //*** CCreateClusterWizard::get_ClusterIPSubnet
  603. //////////////////////////////////////////////////////////////////////////////
  604. //++
  605. //
  606. // CCreateClusterWizard::get_ClusterIPAddressNetwork
  607. //
  608. // Description:
  609. // Get the name of the network connection (cluster network) on which the
  610. // cluster IP address is published.
  611. //
  612. // Arguments:
  613. // pbstrClusterNetworkNameOut - Network connection name.
  614. //
  615. // Return Values:
  616. // S_OK - Operation completed successfully.
  617. // Other HRESULTs.
  618. //
  619. //--
  620. //////////////////////////////////////////////////////////////////////////////
  621. STDMETHODIMP
  622. CCreateClusterWizard::get_ClusterIPAddressNetwork(
  623. BSTR * pbstrClusterNetworkNameOut
  624. )
  625. {
  626. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  627. HRESULT hr = THR( m_pccw->get_ClusterIPAddressNetwork( pbstrClusterNetworkNameOut ) );
  628. HRETURN( hr );
  629. } //*** CCreateClusterWizard::get_ClusterIPAddressNetwork
  630. //////////////////////////////////////////////////////////////////////////////
  631. //++
  632. //
  633. // CCreateClusterWizard::put_FirstNodeInCluster
  634. //
  635. // Description:
  636. // Set the name of the first node in the cluster.
  637. //
  638. // Arguments:
  639. // bstrFirstNodeInClusterIn - Name of the first node.
  640. //
  641. // Return Values:
  642. // S_OK - Operation completed successfully.
  643. // Other HRESULTs.
  644. //
  645. //--
  646. //////////////////////////////////////////////////////////////////////////////
  647. STDMETHODIMP
  648. CCreateClusterWizard::put_FirstNodeInCluster(
  649. BSTR bstrFirstNodeInClusterIn
  650. )
  651. {
  652. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  653. HRESULT hr = S_OK;
  654. BSTR bstrNode = NULL;
  655. if ( m_bstrFirstNodeInCluster != NULL )
  656. {
  657. hr = THR( m_pccw->ClearComputerList() );
  658. if ( FAILED( hr ) )
  659. {
  660. goto Cleanup;
  661. }
  662. TraceSysFreeString( m_bstrFirstNodeInCluster );
  663. m_bstrFirstNodeInCluster = NULL;
  664. }
  665. if ( SysStringLen( bstrFirstNodeInClusterIn ) > 0 )
  666. {
  667. bstrNode = TraceSysAllocString( bstrFirstNodeInClusterIn );
  668. if ( bstrNode == NULL )
  669. {
  670. hr = THR( E_OUTOFMEMORY );
  671. goto Cleanup;
  672. }
  673. hr = THR( m_pccw->AddComputer( bstrFirstNodeInClusterIn ) );
  674. if ( FAILED( hr ) )
  675. {
  676. goto Cleanup;
  677. }
  678. m_bstrFirstNodeInCluster = bstrNode;
  679. bstrNode = NULL;
  680. }
  681. Cleanup:
  682. TraceSysFreeString( bstrNode );
  683. HRETURN( hr );
  684. } //*** CCreateClusterWizard::put_FirstNodeInCluster
  685. //////////////////////////////////////////////////////////////////////////////
  686. //++
  687. //
  688. // CCreateClusterWizard::get_FirstNodeInCluster
  689. //
  690. // Description:
  691. // Get the name of the first node in the cluster.
  692. //
  693. // Arguments:
  694. // pbstrFirstNodeInClusterIn - Name of the first node.
  695. //
  696. // Return Values:
  697. // S_OK - Operation completed successfully.
  698. // Other HRESULTs.
  699. //
  700. //--
  701. //////////////////////////////////////////////////////////////////////////////
  702. STDMETHODIMP
  703. CCreateClusterWizard::get_FirstNodeInCluster(
  704. BSTR * pbstrFirstNodeInClusterOut
  705. )
  706. {
  707. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  708. HRESULT hr = S_OK;
  709. if ( pbstrFirstNodeInClusterOut == NULL )
  710. {
  711. hr = THR( E_POINTER );
  712. goto Cleanup;
  713. }
  714. *pbstrFirstNodeInClusterOut = NULL;
  715. if ( m_bstrFirstNodeInCluster != NULL )
  716. {
  717. *pbstrFirstNodeInClusterOut = SysAllocString( m_bstrFirstNodeInCluster );
  718. if ( *pbstrFirstNodeInClusterOut == NULL )
  719. {
  720. hr = THR( E_OUTOFMEMORY );
  721. goto Cleanup;
  722. }
  723. } // if: first node has been set
  724. Cleanup:
  725. HRETURN( hr );
  726. } //*** CCreateClusterWizard::get_FirstNodeInCluster
  727. //////////////////////////////////////////////////////////////////////////////
  728. //++
  729. //
  730. // CCreateClusterWizard::put_MinimumConfiguration
  731. //
  732. // Description:
  733. // Specify whether the wizard should operate in full or minimum
  734. // configuration mode.
  735. //
  736. // Arguments:
  737. // fMinConfigIn
  738. // VARIANT_TRUE - Put wizard in Minimum Configuration mode.
  739. // VARIANT_FALSE - Put wizard in Full Configuration mode.
  740. //
  741. // Return Values:
  742. // S_OK - Operation completed successfully.
  743. // Other HRESULTs.
  744. //
  745. //--
  746. //////////////////////////////////////////////////////////////////////////////
  747. STDMETHODIMP
  748. CCreateClusterWizard::put_MinimumConfiguration(
  749. VARIANT_BOOL fMinConfigIn
  750. )
  751. {
  752. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  753. HRESULT hr = S_OK;
  754. BOOL fMinConfig = ( fMinConfigIn == VARIANT_TRUE? TRUE: FALSE );
  755. hr = THR( m_pccw->put_MinimumConfiguration( fMinConfig ) );
  756. HRETURN( hr );
  757. } //*** CCreateClusterWizard::put_MinimumConfiguration
  758. //////////////////////////////////////////////////////////////////////////////
  759. //++
  760. //
  761. // CCreateClusterWizard::get_MinimumConfiguration
  762. //
  763. // Description:
  764. // Get the current configuration mode of the wizard.
  765. //
  766. // Arguments:
  767. // pfMinConfigOut
  768. // Configuration mode of the wizard:
  769. // VARIANT_TRUE - Minimum Configuration mode.
  770. // VARIANT_FALSE - Full Configuration mode.
  771. // This value could have been set either by a call to the
  772. // put_MinimumConfiguration method or by the user in the wizard.
  773. //
  774. // Return Values:
  775. // S_OK - Operation completed successfully.
  776. // Other HRESULTs.
  777. //
  778. //--
  779. //////////////////////////////////////////////////////////////////////////////
  780. STDMETHODIMP
  781. CCreateClusterWizard::get_MinimumConfiguration(
  782. VARIANT_BOOL * pfMinConfigOut
  783. )
  784. {
  785. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  786. HRESULT hr = S_OK;
  787. BOOL fMinConfig = FALSE;
  788. if ( pfMinConfigOut == NULL )
  789. {
  790. hr = THR( E_POINTER );
  791. goto Cleanup;
  792. }
  793. hr = THR( m_pccw->get_MinimumConfiguration( &fMinConfig ) );
  794. if ( FAILED( hr ) )
  795. {
  796. goto Cleanup;
  797. }
  798. *pfMinConfigOut = ( fMinConfig? VARIANT_TRUE: VARIANT_FALSE );
  799. Cleanup:
  800. HRETURN( hr );
  801. } //*** CCreateClusterWizard::get_MinimumConfiguration
  802. //////////////////////////////////////////////////////////////////////////////
  803. //++
  804. //
  805. // CCreateClusterWizard::ShowWizard
  806. //
  807. // Description:
  808. // Show the wizard.
  809. //
  810. // Arguments:
  811. // lParentWindowHandleIn
  812. // The parent window handle represented as a LONG value.
  813. //
  814. // pfCompletedOut
  815. // Return status of the wizard operation itself:
  816. // VARIANT_TRUE - Wizard was completed.
  817. // VARIANT_FALSE - Wizard was cancelled.
  818. //
  819. // Return Values:
  820. // S_OK - Operation completed successfully.
  821. // Other HRESULTs.
  822. //
  823. //--
  824. //////////////////////////////////////////////////////////////////////////////
  825. STDMETHODIMP
  826. CCreateClusterWizard::ShowWizard(
  827. long lParentWindowHandleIn
  828. , VARIANT_BOOL * pfCompletedOut
  829. )
  830. {
  831. TraceFunc( "[IClusCfgCreateClusterWizard]" );
  832. HRESULT hr = S_OK;
  833. BOOL fCompleted = FALSE;
  834. HWND hwndParent = reinterpret_cast< HWND >( LongToHandle( lParentWindowHandleIn ) );
  835. if ( ( hwndParent != NULL ) && ( IsWindow( hwndParent ) == FALSE ) )
  836. {
  837. hr = THR( E_INVALIDARG );
  838. goto Cleanup;
  839. }
  840. hr = THR( m_pccw->CreateCluster( hwndParent, &fCompleted ) );
  841. if ( FAILED( hr ) )
  842. {
  843. goto Cleanup;
  844. }
  845. if ( pfCompletedOut != NULL )
  846. {
  847. *pfCompletedOut = ( fCompleted ? VARIANT_TRUE : VARIANT_FALSE );
  848. }
  849. Cleanup:
  850. HRETURN( hr );
  851. } //*** CCreateClusterWizard::ShowWizard