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.

1008 lines
23 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2001-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CEnumUnknownQuorum.cpp
  7. //
  8. // Description:
  9. // This file contains the definition of the CEnumUnknownQuorum
  10. // class.
  11. //
  12. // The class CEnumUnknownQuorum is the enumeration of unknown cluster
  13. // majority node set devices. It implements the IEnumClusCfgManagedResources
  14. // interface.
  15. //
  16. // Maintained By:
  17. // Galen Barbee (GalenB) 10-MAY-2001
  18. //
  19. //////////////////////////////////////////////////////////////////////////////
  20. //////////////////////////////////////////////////////////////////////////////
  21. // Include Files
  22. //////////////////////////////////////////////////////////////////////////////
  23. #include "Pch.h"
  24. #include <PropList.h>
  25. #include "CEnumUnknownQuorum.h"
  26. #include "CUnknownQuorum.h"
  27. //////////////////////////////////////////////////////////////////////////////
  28. // Constant Definitions
  29. //////////////////////////////////////////////////////////////////////////////
  30. DEFINE_THISCLASS( "CEnumUnknownQuorum" );
  31. //*************************************************************************//
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CEnumUnknownQuorum class
  34. /////////////////////////////////////////////////////////////////////////////
  35. //////////////////////////////////////////////////////////////////////////////
  36. //++
  37. //
  38. // CEnumUnknownQuorum::S_HrCreateInstance
  39. //
  40. // Description:
  41. // Create a CEnumUnknownQuorum instance.
  42. //
  43. // Arguments:
  44. // None.
  45. //
  46. // Return Values:
  47. // S_OK
  48. // Success.
  49. //
  50. // E_POINTER
  51. // The passed in ppunk is NULL.
  52. //
  53. // other HRESULTs
  54. // Object creation failed.
  55. //
  56. //--
  57. //////////////////////////////////////////////////////////////////////////////
  58. HRESULT
  59. CEnumUnknownQuorum::S_HrCreateInstance( IUnknown ** ppunkOut )
  60. {
  61. TraceFunc( "" );
  62. HRESULT hr = S_OK;
  63. CEnumUnknownQuorum * peuq = NULL;
  64. if ( ppunkOut == NULL )
  65. {
  66. hr = THR( E_POINTER );
  67. goto Cleanup;
  68. } // if:
  69. peuq = new CEnumUnknownQuorum();
  70. if ( peuq == NULL )
  71. {
  72. hr = THR( E_OUTOFMEMORY );
  73. goto Cleanup;
  74. } // if: error allocating object
  75. hr = THR( peuq->HrInit( NULL ) );
  76. if ( FAILED( hr ) )
  77. {
  78. goto Cleanup;
  79. } // if: HrInit() failed
  80. hr = THR( peuq->TypeSafeQI( IUnknown, ppunkOut ) );
  81. if ( FAILED( hr ) )
  82. {
  83. goto Cleanup;
  84. } // if: QI failed
  85. Cleanup:
  86. if ( FAILED( hr ) )
  87. {
  88. LogMsg( L"[SRV] CEnumUnknownQuorum::S_HrCreateInstance() failed. (hr = %#08x)", hr );
  89. } // if:
  90. if ( peuq != NULL )
  91. {
  92. peuq->Release();
  93. } // if:
  94. HRETURN( hr );
  95. } //*** CEnumUnknownQuorum::S_HrCreateInstance
  96. //////////////////////////////////////////////////////////////////////////////
  97. //++
  98. //
  99. // CEnumUnknownQuorum::S_HrCreateInstance
  100. //
  101. // Description:
  102. // Create a CEnumUnknownQuorum instance.
  103. //
  104. // Arguments:
  105. // None.
  106. //
  107. // Return Values:
  108. // S_OK
  109. // Success.
  110. //
  111. // E_POINTER
  112. // The passed in ppunk is NULL.
  113. //
  114. // other HRESULTs
  115. // Object creation failed.
  116. //
  117. //--
  118. //////////////////////////////////////////////////////////////////////////////
  119. HRESULT
  120. CEnumUnknownQuorum::S_HrCreateInstance(
  121. BSTR bstrNameIn
  122. , BOOL fMakeQuorumIn
  123. , IUnknown ** ppunkOut
  124. )
  125. {
  126. TraceFunc( "" );
  127. HRESULT hr = S_OK;
  128. CEnumUnknownQuorum * peuq = NULL;
  129. if ( ppunkOut == NULL )
  130. {
  131. hr = THR( E_POINTER );
  132. goto Cleanup;
  133. } // if:
  134. peuq = new CEnumUnknownQuorum();
  135. if ( peuq == NULL )
  136. {
  137. hr = THR( E_OUTOFMEMORY );
  138. goto Cleanup;
  139. } // if: error allocating object
  140. hr = THR( peuq->HrInit( bstrNameIn, fMakeQuorumIn ) );
  141. if ( FAILED( hr ) )
  142. {
  143. goto Cleanup;
  144. } // if: HrInit() failed
  145. hr = THR( peuq->TypeSafeQI( IUnknown, ppunkOut ) );
  146. if ( FAILED( hr ) )
  147. {
  148. goto Cleanup;
  149. } // if: QI failed
  150. Cleanup:
  151. if ( FAILED( hr ) )
  152. {
  153. LogMsg( L"[SRV] CEnumUnknownQuorum::S_HrCreateInstance() failed. (hr = %#08x)", hr );
  154. } // if:
  155. if ( peuq != NULL )
  156. {
  157. peuq->Release();
  158. } // if:
  159. HRETURN( hr );
  160. } //*** CEnumUnknownQuorum::S_HrCreateInstance
  161. /*
  162. //////////////////////////////////////////////////////////////////////////////
  163. //++
  164. //
  165. // IUnknown *
  166. // CEnumUnknownQuorum::S_RegisterCatIDSupport
  167. //
  168. // Description:
  169. // Registers/unregisters this class with the categories that it belongs
  170. // to.
  171. //
  172. // Arguments:
  173. // IN ICatRegister * picrIn
  174. // Used to register/unregister our CATID support.
  175. //
  176. // IN BOOL fCreateIn
  177. // When true we are registering the server. When false we are
  178. // un-registering the server.
  179. //
  180. // Return Values:
  181. // S_OK
  182. // Success.
  183. //
  184. // E_INVALIDARG
  185. // The passed in ICatRgister pointer was NULL.
  186. //
  187. // other HRESULTs
  188. // Registration/Unregistration failed.
  189. //
  190. //--
  191. //////////////////////////////////////////////////////////////////////////////
  192. HRESULT
  193. CEnumUnknownQuorum::S_RegisterCatIDSupport(
  194. ICatRegister * picrIn,
  195. BOOL fCreateIn
  196. )
  197. {
  198. TraceFunc( "" );
  199. HRESULT hr = S_OK;
  200. CATID rgCatIds[ 1 ];
  201. if ( picrIn == NULL )
  202. {
  203. hr = THR( E_INVALIDARG );
  204. goto Cleanup;
  205. } // if:
  206. rgCatIds[ 0 ] = CATID_EnumClusCfgManagedResources;
  207. if ( fCreateIn )
  208. {
  209. hr = THR( picrIn->RegisterClassImplCategories( CLSID_EnumMajorityNodeSet, 1, rgCatIds ) );
  210. } // if:
  211. Cleanup:
  212. HRETURN( hr );
  213. } //*** CEnumUnknownQuorum::S_RegisterCatIDSupport
  214. */
  215. //*************************************************************************//
  216. /////////////////////////////////////////////////////////////////////////////
  217. // CEnumUnknownQuorum class -- Private Methods.
  218. /////////////////////////////////////////////////////////////////////////////
  219. //////////////////////////////////////////////////////////////////////////////
  220. //++
  221. //
  222. // CEnumUnknownQuorum::CEnumUnknownQuorum
  223. //
  224. // Description:
  225. // Constructor of the CEnumUnknownQuorum class. This initializes
  226. // the m_cRef variable to 1 instead of 0 to account of possible
  227. // QueryInterface failure in DllGetClassObject.
  228. //
  229. // Arguments:
  230. // None.
  231. //
  232. // Return Value:
  233. // None.
  234. //
  235. // Remarks:
  236. // None.
  237. //
  238. //--
  239. //////////////////////////////////////////////////////////////////////////////
  240. CEnumUnknownQuorum::CEnumUnknownQuorum( void )
  241. : m_cRef( 1 )
  242. , m_lcid( LOCALE_NEUTRAL )
  243. {
  244. TraceFunc( "" );
  245. // Increment the count of components in memory so the DLL hosting this
  246. // object cannot be unloaded.
  247. InterlockedIncrement( &g_cObjects );
  248. Assert( m_picccCallback == NULL );
  249. Assert( m_prgQuorums == NULL );
  250. Assert( m_idxNext == 0 );
  251. Assert( m_idxEnumNext == 0 );
  252. Assert( m_bstrNodeName == NULL );
  253. Assert( !m_fEnumLoaded );
  254. Assert( !m_fDefaultDeviceToQuorum );
  255. Assert( m_bstrQuorumResourceName == NULL );
  256. TraceFuncExit();
  257. } //*** CEnumUnknownQuorum::CEnumUnknownQuorum
  258. //////////////////////////////////////////////////////////////////////////////
  259. //++
  260. //
  261. // CEnumUnknownQuorum::~CEnumUnknownQuorum
  262. //
  263. // Description:
  264. // Desstructor of the CEnumUnknownQuorum class.
  265. //
  266. // Arguments:
  267. // None.
  268. //
  269. // Return Value:
  270. // None.
  271. //
  272. // Remarks:
  273. // None.
  274. //
  275. //--
  276. //////////////////////////////////////////////////////////////////////////////
  277. CEnumUnknownQuorum::~CEnumUnknownQuorum( void )
  278. {
  279. TraceFunc( "" );
  280. ULONG idx;
  281. if ( m_picccCallback != NULL )
  282. {
  283. m_picccCallback->Release();
  284. } // if:
  285. for ( idx = 0; idx < m_idxNext; idx++ )
  286. {
  287. if ( (*m_prgQuorums)[ idx ] != NULL )
  288. {
  289. ((*m_prgQuorums)[ idx ])->Release();
  290. } // end if:
  291. } // for:
  292. TraceFree( m_prgQuorums );
  293. TraceSysFreeString( m_bstrNodeName );
  294. TraceSysFreeString( m_bstrQuorumResourceName );
  295. // There's going to be one less component in memory. Decrement component count.
  296. InterlockedDecrement( &g_cObjects );
  297. TraceFuncExit();
  298. } //*** CEnumUnknownQuorum::~CEnumUnknownQuorum
  299. //////////////////////////////////////////////////////////////////////////////
  300. //++
  301. //
  302. // CEnumUnknownQuorum::HrInit
  303. //
  304. // Description:
  305. // Initialize this component.
  306. //
  307. // Arguments:
  308. //
  309. //
  310. // Return Value:
  311. //
  312. //
  313. // Remarks:
  314. // None.
  315. //
  316. //--
  317. //////////////////////////////////////////////////////////////////////////////
  318. HRESULT
  319. CEnumUnknownQuorum::HrInit( BSTR bstrNameIn, BOOL fMakeQuorumIn /* = FALSE */ )
  320. {
  321. TraceFunc( "" );
  322. HRESULT hr = S_OK;
  323. // IUnknown
  324. Assert( m_cRef == 1 );
  325. m_fDefaultDeviceToQuorum = fMakeQuorumIn;
  326. //
  327. // Were we given a name?
  328. //
  329. if ( bstrNameIn != NULL )
  330. {
  331. m_bstrQuorumResourceName = TraceSysAllocString( bstrNameIn );
  332. if ( m_bstrQuorumResourceName == NULL )
  333. {
  334. hr = THR( E_OUTOFMEMORY );
  335. } // if:
  336. } // if:
  337. HRETURN( hr );
  338. } //*** CEnumUnknownQuorum::HrInit
  339. /////////////////////////////////////////////////////////////////////////////
  340. //++
  341. //
  342. // CEnumUnknownQuorum:HrAddResourceToArray
  343. //
  344. // Description:
  345. // Add the passed in majority node set to the array of punks that holds the
  346. // list of majority node sets.
  347. //
  348. // Arguments:
  349. //
  350. //
  351. // Return Value:
  352. // S_OK
  353. // Success
  354. //
  355. // E_OUTOFMEMORY
  356. // Couldn't allocate memeory.
  357. //
  358. // Remarks:
  359. // None.
  360. //
  361. //--
  362. //////////////////////////////////////////////////////////////////////////////
  363. HRESULT
  364. CEnumUnknownQuorum::HrAddResourceToArray( IUnknown * punkIn )
  365. {
  366. TraceFunc( "" );
  367. Assert( punkIn != NULL );
  368. HRESULT hr = S_OK;
  369. IUnknown * ((*prgpunks)[]) = NULL;
  370. prgpunks = (IUnknown *((*)[])) TraceReAlloc( m_prgQuorums, sizeof( IUnknown * ) * ( m_idxNext + 1 ), HEAP_ZERO_MEMORY );
  371. if ( prgpunks == NULL )
  372. {
  373. hr = THR( E_OUTOFMEMORY );
  374. STATUS_REPORT_REF( TASKID_Major_Find_Devices, TASKID_Minor_HrAddResourceToArray, IDS_ERROR_OUTOFMEMORY, IDS_ERROR_OUTOFMEMORY_REF, hr );
  375. goto Cleanup;
  376. } // if:
  377. m_prgQuorums = prgpunks;
  378. (*m_prgQuorums)[ m_idxNext++ ] = punkIn;
  379. punkIn->AddRef();
  380. Cleanup:
  381. HRETURN( hr );
  382. } //*** CEnumUnknownQuorum::HrAddResourceToArray
  383. //////////////////////////////////////////////////////////////////////////////
  384. //++
  385. //
  386. // CEnumUnknownQuorum::HrCreateDummyObject
  387. //
  388. // Description:
  389. // Create a dummy object so the MiddleTier will be happy.
  390. //
  391. // Arguments:
  392. // None.
  393. //
  394. // Return Value:
  395. //
  396. // Remarks:
  397. // None.
  398. //
  399. //--
  400. //////////////////////////////////////////////////////////////////////////////
  401. HRESULT
  402. CEnumUnknownQuorum::HrCreateDummyObject( void )
  403. {
  404. TraceFunc( "" );
  405. HRESULT hr = S_OK;
  406. IUnknown * punk = NULL;
  407. hr = THR( CUnknownQuorum::S_HrCreateInstance(
  408. m_bstrQuorumResourceName
  409. , m_fDefaultDeviceToQuorum
  410. , &punk ) );
  411. if ( FAILED( hr ) )
  412. {
  413. goto Cleanup;
  414. } // if:
  415. hr = THR( HrSetInitialize( punk, m_picccCallback, m_lcid ) );
  416. if ( FAILED( hr ) )
  417. {
  418. goto Cleanup;
  419. } // if:
  420. hr = THR( HrAddResourceToArray( punk ) );
  421. if ( FAILED( hr ) )
  422. {
  423. goto Cleanup;
  424. } // if:
  425. m_fEnumLoaded = true;
  426. Cleanup:
  427. if ( punk != NULL )
  428. {
  429. punk->Release();
  430. } // if:
  431. HRETURN( hr );
  432. } //*** CEnumUnknownQuorum::HrCreateDummyObject
  433. //*************************************************************************//
  434. /////////////////////////////////////////////////////////////////////////////
  435. // CEnumUnknownQuorum -- IUknkown interface.
  436. /////////////////////////////////////////////////////////////////////////////
  437. //////////////////////////////////////////////////////////////////////////////
  438. //++
  439. //
  440. // CEnumUnknownQuorum::AddRef
  441. //
  442. // Description:
  443. // Increment the reference count of this object by one.
  444. //
  445. // Arguments:
  446. // None.
  447. //
  448. // Return Value:
  449. // The new reference count.
  450. //
  451. // Remarks:
  452. // None.
  453. //
  454. //--
  455. //////////////////////////////////////////////////////////////////////////////
  456. STDMETHODIMP_( ULONG )
  457. CEnumUnknownQuorum::AddRef( void )
  458. {
  459. TraceFunc( "[IUnknown]" );
  460. InterlockedIncrement( &m_cRef );
  461. CRETURN( m_cRef );
  462. } //*** CEnumUnknownQuorum::AddRef
  463. //////////////////////////////////////////////////////////////////////////////
  464. //++
  465. //
  466. // CEnumUnknownQuorum::Release
  467. //
  468. // Description:
  469. // Decrement the reference count of this object by one.
  470. //
  471. // Arguments:
  472. // None.
  473. //
  474. // Return Value:
  475. // The new reference count.
  476. //
  477. // Remarks:
  478. // None.
  479. //
  480. //--
  481. //////////////////////////////////////////////////////////////////////////////
  482. STDMETHODIMP_( ULONG )
  483. CEnumUnknownQuorum::Release( void )
  484. {
  485. TraceFunc( "[IUnknown]" );
  486. LONG cRef;
  487. cRef = InterlockedDecrement( &m_cRef );
  488. if ( cRef == 0 )
  489. {
  490. TraceDo( delete this );
  491. } // if: reference count equal to zero
  492. CRETURN( cRef );
  493. } //*** CEnumUnknownQuorum::Release
  494. //////////////////////////////////////////////////////////////////////////////
  495. //++
  496. //
  497. // CEnumUnknownQuorum::QueryInterface
  498. //
  499. // Description:
  500. // Query this object for the passed in interface.
  501. //
  502. // Arguments:
  503. // riidIn
  504. // Id of interface requested.
  505. //
  506. // ppvOut
  507. // Pointer to the requested interface.
  508. //
  509. // Return Value:
  510. // S_OK
  511. // If the interface is available on this object.
  512. //
  513. // E_NOINTERFACE
  514. // If the interface is not available.
  515. //
  516. // E_POINTER
  517. // ppvOut was NULL.
  518. //
  519. // Remarks:
  520. // None.
  521. //
  522. //--
  523. //////////////////////////////////////////////////////////////////////////////
  524. STDMETHODIMP
  525. CEnumUnknownQuorum::QueryInterface(
  526. REFIID riidIn
  527. , void ** ppvOut
  528. )
  529. {
  530. TraceQIFunc( riidIn, ppvOut );
  531. HRESULT hr = S_OK;
  532. //
  533. // Validate arguments.
  534. //
  535. Assert( ppvOut != NULL );
  536. if ( ppvOut == NULL )
  537. {
  538. hr = THR( E_POINTER );
  539. goto Cleanup;
  540. }
  541. //
  542. // Handle known interfaces.
  543. //
  544. if ( IsEqualIID( riidIn, IID_IUnknown ) )
  545. {
  546. *ppvOut = static_cast< IEnumClusCfgManagedResources * >( this );
  547. } // if: IUnknown
  548. else if ( IsEqualIID( riidIn, IID_IEnumClusCfgManagedResources ) )
  549. {
  550. *ppvOut = TraceInterface( __THISCLASS__, IEnumClusCfgManagedResources, this, 0 );
  551. } // else if: IEnumClusCfgManagedResources
  552. else if ( IsEqualIID( riidIn, IID_IClusCfgInitialize ) )
  553. {
  554. *ppvOut = TraceInterface( __THISCLASS__, IClusCfgInitialize, this, 0 );
  555. } // else if: IClusCfgInitialize
  556. else
  557. {
  558. *ppvOut = NULL;
  559. hr = E_NOINTERFACE;
  560. }
  561. //
  562. // Add a reference to the interface if successful.
  563. //
  564. if ( SUCCEEDED( hr ) )
  565. {
  566. ((IUnknown *) *ppvOut)->AddRef();
  567. } // if: success
  568. Cleanup:
  569. QIRETURN_IGNORESTDMARSHALLING1( hr, riidIn, IID_IClusCfgWbemServices );
  570. } //*** CEnumUnknownQuorum::QueryInterface
  571. //*************************************************************************//
  572. /////////////////////////////////////////////////////////////////////////////
  573. // CEnumUnknownQuorum -- IClusCfgInitialize interface.
  574. /////////////////////////////////////////////////////////////////////////////
  575. //////////////////////////////////////////////////////////////////////////////
  576. //++
  577. //
  578. // CEnumUnknownQuorum::Initialize
  579. //
  580. // Description:
  581. // Initialize this component.
  582. //
  583. // Arguments:
  584. // punkCallbackIn
  585. // lcidIn
  586. //
  587. // Return Value:
  588. // S_OK - Success.
  589. // E_INVALIDARG - Required input argument not specified.
  590. // Other HRESULTs.
  591. //
  592. //--
  593. //////////////////////////////////////////////////////////////////////////////
  594. STDMETHODIMP
  595. CEnumUnknownQuorum::Initialize(
  596. IUnknown * punkCallbackIn
  597. , LCID lcidIn
  598. )
  599. {
  600. TraceFunc( "[IClusCfgInitialize]" );
  601. Assert( m_picccCallback == NULL );
  602. HRESULT hr = S_OK;
  603. m_lcid = lcidIn;
  604. if ( punkCallbackIn == NULL )
  605. {
  606. hr = THR( E_INVALIDARG );
  607. goto Cleanup;
  608. } // if:
  609. hr = THR( punkCallbackIn->TypeSafeQI( IClusCfgCallback, &m_picccCallback ) );
  610. if ( FAILED( hr ) )
  611. {
  612. goto Cleanup;
  613. } // if:
  614. hr = THR( HrGetComputerName(
  615. ComputerNameDnsHostname
  616. , &m_bstrNodeName
  617. , TRUE // fBestEffortIn
  618. ) );
  619. if ( FAILED( hr ) )
  620. {
  621. goto Cleanup;
  622. }
  623. Cleanup:
  624. HRETURN( hr );
  625. } //*** CEnumUnknownQuorum::Initialize
  626. //*************************************************************************//
  627. /////////////////////////////////////////////////////////////////////////////
  628. // CEnumUnknownQuorum -- IEnumClusCfgManagedResources interface.
  629. /////////////////////////////////////////////////////////////////////////////
  630. //////////////////////////////////////////////////////////////////////////////
  631. //++
  632. //
  633. // CEnumUnknownQuorum::Next
  634. //
  635. // Description:
  636. //
  637. // Arguments:
  638. //
  639. // Return Value:
  640. //
  641. // Remarks:
  642. // None.
  643. //
  644. //--
  645. //////////////////////////////////////////////////////////////////////////////
  646. STDMETHODIMP
  647. CEnumUnknownQuorum::Next(
  648. ULONG cNumberRequestedIn,
  649. IClusCfgManagedResourceInfo ** rgpManagedResourceInfoOut,
  650. ULONG * pcNumberFetchedOut
  651. )
  652. {
  653. TraceFunc( "[IEnumClusCfgManagedResources]" );
  654. HRESULT hr = S_FALSE;
  655. ULONG cFetched = 0;
  656. IClusCfgManagedResourceInfo * pccsdi;
  657. IUnknown * punk;
  658. ULONG ulStop;
  659. if ( rgpManagedResourceInfoOut == NULL )
  660. {
  661. hr = THR( E_POINTER );
  662. STATUS_REPORT_REF( TASKID_Major_Find_Devices, TASKID_Minor_Next_Enum_MajorityNodeSet, IDS_ERROR_NULL_POINTER, IDS_ERROR_NULL_POINTER_REF, hr );
  663. goto Cleanup;
  664. } // if:
  665. if ( !m_fEnumLoaded )
  666. {
  667. hr = THR( HrCreateDummyObject() );
  668. if ( FAILED( hr ) )
  669. {
  670. goto Cleanup;
  671. } // if:
  672. } // if:
  673. ulStop = min( cNumberRequestedIn, ( m_idxNext - m_idxEnumNext ) );
  674. for ( hr = S_OK; ( cFetched < ulStop ) && ( m_idxEnumNext < m_idxNext ); m_idxEnumNext++ )
  675. {
  676. punk = (*m_prgQuorums)[ m_idxEnumNext ];
  677. if ( punk != NULL )
  678. {
  679. hr = THR( punk->TypeSafeQI( IClusCfgManagedResourceInfo, &pccsdi ) );
  680. if ( FAILED( hr ) )
  681. {
  682. break;
  683. } // if:
  684. rgpManagedResourceInfoOut[ cFetched++ ] = pccsdi;
  685. } // if:
  686. } // for:
  687. if ( FAILED( hr ) )
  688. {
  689. m_idxEnumNext -= cFetched;
  690. while ( cFetched != 0 )
  691. {
  692. (rgpManagedResourceInfoOut[ --cFetched ])->Release();
  693. } // for:
  694. goto Cleanup;
  695. } // if:
  696. if ( cFetched < cNumberRequestedIn )
  697. {
  698. hr = S_FALSE;
  699. } // if:
  700. Cleanup:
  701. if ( pcNumberFetchedOut != NULL )
  702. {
  703. *pcNumberFetchedOut = cFetched;
  704. } // if:
  705. HRETURN( hr );
  706. } //*** CEnumUnknownQuorum::Next
  707. //////////////////////////////////////////////////////////////////////////////
  708. //++
  709. //
  710. // CEnumUnknownQuorum::Skip
  711. //
  712. // Description:
  713. //
  714. // Arguments:
  715. //
  716. // Return Value:
  717. //
  718. // Remarks:
  719. // None.
  720. //
  721. //--
  722. //////////////////////////////////////////////////////////////////////////////
  723. STDMETHODIMP
  724. CEnumUnknownQuorum::Skip( ULONG cNumberToSkipIn )
  725. {
  726. TraceFunc( "[IEnumClusCfgManagedResources]" );
  727. HRESULT hr = S_OK;
  728. m_idxEnumNext += cNumberToSkipIn;
  729. if ( m_idxEnumNext >= m_idxNext )
  730. {
  731. m_idxEnumNext = m_idxNext;
  732. hr = STHR( S_FALSE );
  733. } // if:
  734. HRETURN( hr );
  735. } //*** CEnumUnknownQuorum::Skip
  736. //////////////////////////////////////////////////////////////////////////////
  737. //++
  738. //
  739. // CEnumUnknownQuorum::Reset
  740. //
  741. // Description:
  742. //
  743. // Arguments:
  744. //
  745. // Return Value:
  746. //
  747. // Remarks:
  748. // None.
  749. //
  750. //--
  751. //////////////////////////////////////////////////////////////////////////////
  752. STDMETHODIMP
  753. CEnumUnknownQuorum::Reset( void )
  754. {
  755. TraceFunc( "[IEnumClusCfgManagedResources]" );
  756. m_idxEnumNext = 0;
  757. HRETURN( S_OK );
  758. } //*** CEnumUnknownQuorum::Reset
  759. //////////////////////////////////////////////////////////////////////////////
  760. //++
  761. //
  762. // CEnumUnknownQuorum::Clone
  763. //
  764. // Description:
  765. //
  766. // Arguments:
  767. //
  768. // Return Value:
  769. //
  770. // Remarks:
  771. // None.
  772. //
  773. //--
  774. //////////////////////////////////////////////////////////////////////////////
  775. STDMETHODIMP
  776. CEnumUnknownQuorum::Clone(
  777. IEnumClusCfgManagedResources ** ppEnumClusCfgStorageDevicesOut
  778. )
  779. {
  780. TraceFunc( "[IEnumClusCfgManagedResources]" );
  781. HRESULT hr = S_OK;
  782. if ( ppEnumClusCfgStorageDevicesOut == NULL )
  783. {
  784. hr = THR( E_POINTER );
  785. STATUS_REPORT_REF( TASKID_Major_Find_Devices, TASKID_Minor_Clone_Enum_MajorityNodeSet, IDS_ERROR_NULL_POINTER, IDS_ERROR_NULL_POINTER_REF, hr );
  786. goto Cleanup;
  787. } // if:
  788. hr = THR( E_NOTIMPL );
  789. Cleanup:
  790. HRETURN( hr );
  791. } //*** CEnumUnknownQuorum::Clone
  792. //////////////////////////////////////////////////////////////////////////////
  793. //++
  794. //
  795. // CEnumUnknownQuorum::Count
  796. //
  797. // Description:
  798. //
  799. // Arguments:
  800. //
  801. // Return Value:
  802. //
  803. // Remarks:
  804. // None.
  805. //
  806. //--
  807. //////////////////////////////////////////////////////////////////////////////
  808. STDMETHODIMP
  809. CEnumUnknownQuorum::Count( DWORD * pnCountOut )
  810. {
  811. TraceFunc( "[IEnumClusCfgManagedResources]" );
  812. HRESULT hr = S_OK;
  813. if ( pnCountOut == NULL )
  814. {
  815. hr = THR( E_POINTER );
  816. goto Cleanup;
  817. } // if:
  818. if ( !m_fEnumLoaded )
  819. {
  820. hr = THR( HrCreateDummyObject() );
  821. if ( FAILED( hr ) )
  822. {
  823. goto Cleanup;
  824. } // if:
  825. } // if:
  826. Assert( m_idxNext == 1 ); // don't expect to ever have more than one.
  827. *pnCountOut = m_idxNext;
  828. Cleanup:
  829. HRETURN( hr );
  830. } //*** CEnumUnknownQuorum::Count