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.

800 lines
23 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // ClusRes.h
  7. //
  8. // Description:
  9. // Definition of the resource classes for the MSCLUS automation
  10. // classes.
  11. //
  12. // Implementation File:
  13. // ClusRes.cpp
  14. //
  15. // Author:
  16. // Charles Stacy Harris (stacyh) 28-Feb-1997
  17. // Galen Barbee (galenb) July 1998
  18. //
  19. // Revision History:
  20. // July 1998 GalenB Maaaaaajjjjjjjjjoooooorrrr clean up
  21. //
  22. // Notes:
  23. //
  24. /////////////////////////////////////////////////////////////////////////////
  25. #ifndef _CLUSRES_H_
  26. #define _CLUSRES_H_
  27. #ifndef __CLUSDISK_H_
  28. #include "ClusDisk.h"
  29. #endif // __CLUSDISK_H_
  30. #ifndef _CLUSKEYS_H_
  31. #include "ClusKeys.h"
  32. #endif
  33. /////////////////////////////////////////////////////////////////////////////
  34. // Forward Class Declarations
  35. /////////////////////////////////////////////////////////////////////////////
  36. class CClusResource;
  37. class CResources;
  38. class CClusResources;
  39. class CClusResDepends;
  40. class CClusResDependencies;
  41. class CClusResDependents;
  42. class CClusResGroupResources;
  43. class CClusResTypeResources;
  44. const IID IID_CClusResource = {0xf2e60801,0x2631,0x11d1,{0x89,0xf1,0x00,0xa0,0xc9,0x0d,0x06,0x1e}};
  45. /////////////////////////////////////////////////////////////////////////////
  46. //++
  47. //
  48. // class CClusResource
  49. //
  50. // Description:
  51. // Cluster Resource Automation Class.
  52. //
  53. // Inheritance:
  54. // IDispatchImpl< ISClusResource, &IID_ISClusResource, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  55. // CSupportErrorInfo
  56. // CComObjectRootEx< CComSingleThreadModel >
  57. // CComCoClass< CClusResource, &CLSID_ClusResource >
  58. // CClusterObject
  59. //
  60. //--
  61. /////////////////////////////////////////////////////////////////////////////
  62. class ATL_NO_VTABLE CClusResource :
  63. public IDispatchImpl< ISClusResource, &IID_ISClusResource, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  64. public CSupportErrorInfo,
  65. public CComObjectRootEx< CComSingleThreadModel >,
  66. public CComCoClass< CClusResource, &CLSID_ClusResource >,
  67. public CClusterObject
  68. {
  69. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  70. public:
  71. CClusResource( void );
  72. ~CClusResource( void );
  73. BEGIN_COM_MAP(CClusResource)
  74. COM_INTERFACE_ENTRY(IDispatch)
  75. COM_INTERFACE_ENTRY(ISClusResource)
  76. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  77. COM_INTERFACE_ENTRY_IID(IID_CClusResource, CClusResource)
  78. END_COM_MAP()
  79. DECLARE_NOT_AGGREGATABLE(CClusResource)
  80. DECLARE_NO_REGISTRY()
  81. private:
  82. ISClusRefObject * m_pClusRefObject;
  83. HRESOURCE m_hResource;
  84. CComObject< CClusProperties > * m_pCommonProperties;
  85. CComObject< CClusProperties > * m_pPrivateProperties;
  86. CComObject< CClusProperties > * m_pCommonROProperties;
  87. CComObject< CClusProperties > * m_pPrivateROProperties;
  88. CComBSTR m_bstrResourceName;
  89. HRESULT GetProperties( OUT ISClusProperties ** ppProperties, IN BOOL bPrivate, IN BOOL bReadOnly );
  90. DWORD ScGetResourceTypeName( OUT LPWSTR * ppwszResourceTypeName );
  91. protected:
  92. virtual DWORD ScWriteProperties( IN const CClusPropList & rcplPropList, IN BOOL bPrivate );
  93. public:
  94. HRESULT Create(
  95. IN ISClusRefObject * pClusRefObject,
  96. IN HGROUP hGroup,
  97. IN BSTR bstrResourceName,
  98. IN BSTR bstrResourceType,
  99. IN long dwFlags
  100. );
  101. HRESULT Open( IN ISClusRefObject * pClusRefObject, IN BSTR bstrResourceName );
  102. STDMETHODIMP get_Handle( OUT ULONG_PTR * phandle );
  103. STDMETHODIMP Close( void );
  104. STDMETHODIMP put_Name( IN BSTR bstrResourceName );
  105. STDMETHODIMP get_Name( OUT BSTR * pbstrResourceName );
  106. STDMETHODIMP get_State( IN CLUSTER_RESOURCE_STATE * dwState );
  107. STDMETHODIMP get_CoreFlag( OUT CLUS_FLAGS * dwCoreFlag );
  108. STDMETHODIMP BecomeQuorumResource( IN BSTR bstrDevicePath, IN long lMaxLogSize );
  109. STDMETHODIMP Delete( void );
  110. STDMETHODIMP Fail( void );
  111. STDMETHODIMP Online( IN long nTimeout, OUT VARIANT * pvarPending );
  112. STDMETHODIMP Offline( IN long nTimeout, OUT VARIANT * pvarPending );
  113. STDMETHODIMP ChangeResourceGroup( IN ISClusResGroup * pResourceGroup );
  114. STDMETHODIMP AddResourceNode( IN ISClusNode * pNode );
  115. STDMETHODIMP RemoveResourceNode( IN ISClusNode * pNode );
  116. STDMETHODIMP CanResourceBeDependent( IN ISClusResource * pResource, OUT VARIANT * pvarDependent );
  117. STDMETHODIMP get_Dependencies( OUT ISClusResDependencies ** ppResDependencies );
  118. STDMETHODIMP get_Dependents( OUT ISClusResDependents ** ppResDependents );
  119. STDMETHODIMP get_CommonProperties( OUT ISClusProperties ** ppProperties );
  120. STDMETHODIMP get_PrivateProperties( OUT ISClusProperties ** ppProperties );
  121. STDMETHODIMP get_CommonROProperties( OUT ISClusProperties ** ppProperties );
  122. STDMETHODIMP get_PrivateROProperties( OUT ISClusProperties ** ppProperties );
  123. STDMETHODIMP get_PossibleOwnerNodes( OUT ISClusResPossibleOwnerNodes ** ppOwnerNodes );
  124. STDMETHODIMP get_Group( OUT ISClusResGroup ** ppResGroup );
  125. STDMETHODIMP get_OwnerNode( OUT ISClusNode ** ppNode );
  126. STDMETHODIMP get_Cluster( OUT ISCluster ** ppCluster );
  127. STDMETHODIMP get_ClassInfo( OUT CLUSTER_RESOURCE_CLASS * prclassInfo );
  128. STDMETHODIMP get_Disk( OUT ISClusDisk ** ppDisk );
  129. STDMETHODIMP get_RegistryKeys( OUT ISClusRegistryKeys ** ppRegistryKeys );
  130. STDMETHODIMP get_CryptoKeys( OUT ISClusCryptoKeys ** ppCryptoKeys );
  131. STDMETHODIMP get_TypeName( OUT BSTR * pbstrTypeName );
  132. STDMETHODIMP get_Type( OUT ISClusResType ** ppResourceType );
  133. virtual HRESULT HrLoadProperties( CClusPropList & rcplPropList, BOOL bReadOnly, BOOL bPrivate );
  134. const CComBSTR Name( void ) const { return m_bstrResourceName ; };
  135. }; //*** Class CClusResource
  136. /////////////////////////////////////////////////////////////////////////////
  137. //++
  138. //
  139. // class CResources
  140. //
  141. // Description:
  142. // Cluster Resource Collection Implementation Base Class.
  143. //
  144. // Inheritance:
  145. //
  146. //--
  147. /////////////////////////////////////////////////////////////////////////////
  148. class CResources
  149. {
  150. public:
  151. CResources( void );
  152. ~CResources( void );
  153. HRESULT Create( ISClusRefObject* pClusRefObject );
  154. protected:
  155. typedef std::vector< CComObject< CClusResource > * > ResourceList;
  156. ResourceList m_Resources;
  157. ISClusRefObject * m_pClusRefObject;
  158. void Clear( void );
  159. HRESULT FindItem( IN LPWSTR lpszResourceName, OUT UINT * pnIndex );
  160. HRESULT FindItem( IN ISClusResource * pResource, OUT UINT * pnIndex );
  161. HRESULT GetIndex( IN VARIANT varIndex, OUT UINT * pnIndex );
  162. HRESULT GetResourceItem( IN VARIANT varIndex, OUT ISClusResource ** ppResource );
  163. HRESULT RemoveAt( IN size_t pos );
  164. HRESULT DeleteItem( IN VARIANT varIndex );
  165. }; //*** Class CResources
  166. /////////////////////////////////////////////////////////////////////////////
  167. //++
  168. //
  169. // class CClusResources
  170. //
  171. // Description:
  172. // Cluster Resource Collection Automation Class.
  173. //
  174. // Inheritance:
  175. // IDispatchImpl< ISClusResources, &IID_ISClusResources, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  176. // CSupportErrorInfo
  177. // CComObjectRootEx< CComSingleThreadModel >
  178. // CResources
  179. // CComCoClass< CClusResources, &CLSID_ClusResources >
  180. //
  181. //--
  182. /////////////////////////////////////////////////////////////////////////////
  183. class ATL_NO_VTABLE CClusResources :
  184. public IDispatchImpl< ISClusResources, &IID_ISClusResources, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  185. public CSupportErrorInfo,
  186. public CComObjectRootEx< CComSingleThreadModel >,
  187. public CResources,
  188. public CComCoClass< CClusResources, &CLSID_ClusResources >
  189. {
  190. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  191. public:
  192. CClusResources( void );
  193. ~CClusResources( void );
  194. BEGIN_COM_MAP(CClusResources)
  195. COM_INTERFACE_ENTRY(IDispatch)
  196. COM_INTERFACE_ENTRY(ISClusResources)
  197. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  198. END_COM_MAP()
  199. DECLARE_NOT_AGGREGATABLE(CClusResources)
  200. DECLARE_NO_REGISTRY()
  201. STDMETHODIMP get_Count( OUT long * plCount );
  202. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT ISClusResource ** ppClusterResource );
  203. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk );
  204. STDMETHODIMP CreateItem(
  205. IN BSTR bstrResourceName,
  206. IN BSTR bstrResourceType,
  207. IN BSTR bstrGroupName,
  208. IN CLUSTER_RESOURCE_CREATE_FLAGS dwFlags,
  209. OUT ISClusResource ** ppClusterResource
  210. );
  211. STDMETHODIMP DeleteItem( IN VARIANT varIndex );
  212. STDMETHODIMP Refresh( void );
  213. }; //*** Class CClusResources
  214. /////////////////////////////////////////////////////////////////////////////
  215. //++
  216. //
  217. // class CClusResDepends
  218. //
  219. // Description:
  220. // Cluster Resource Collection Automation Base Class.
  221. //
  222. // Inheritance:
  223. // CResources
  224. //
  225. //--
  226. /////////////////////////////////////////////////////////////////////////////
  227. class ATL_NO_VTABLE CClusResDepends :
  228. public CResources
  229. {
  230. public:
  231. CClusResDepends( void );
  232. ~CClusResDepends( void );
  233. HRESULT Create( IN ISClusRefObject * pClusRefObject, IN HRESOURCE hResource );
  234. STDMETHODIMP get_Count( OUT long * plCount );
  235. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT ISClusResource ** ppClusterResource );
  236. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk );
  237. STDMETHODIMP DeleteItem( IN VARIANT varIndex );
  238. HRESULT HrRefresh( IN CLUSTER_RESOURCE_ENUM cre );
  239. STDMETHODIMP CreateItem(
  240. IN BSTR bstrResourceName,
  241. IN BSTR bstrResourceType,
  242. IN CLUSTER_RESOURCE_CREATE_FLAGS dwFlags,
  243. OUT ISClusResource ** ppClusterResource
  244. );
  245. STDMETHODIMP AddItem( IN ISClusResource * pResource );
  246. STDMETHODIMP RemoveItem( IN VARIANT varIndex );
  247. protected:
  248. HRESOURCE m_hResource;
  249. /////////////////////////////////////////////////////////////////////////////
  250. //++
  251. //
  252. // ScAddDependency
  253. //
  254. // Description:
  255. // Abstracts AddClusterResourceDependency() so the arguments can be
  256. // swapped as necessary if you are making a depedency or a dependent.
  257. //
  258. // Arguments:
  259. // hRes1 [IN] - The first resource. Could be dependency or
  260. // dependent, depending upon the implementation.
  261. // hRes2 [IN] - The second resource. Could be dependency or
  262. // dependent, depending upon the implementation.
  263. //
  264. // Return Value:
  265. // Win32 status code.
  266. //
  267. //--
  268. /////////////////////////////////////////////////////////////////////////////
  269. virtual DWORD ScAddDependency( IN HRESOURCE hRes1, IN HRESOURCE hRes2 ) = 0;
  270. /////////////////////////////////////////////////////////////////////////////
  271. //++
  272. //
  273. // ScRemoveDependency
  274. //
  275. // Description:
  276. // Abstracts RemoveClusterResourceDependency() so the arguments can be
  277. // swapped as necessary if you are making a depedency or a dependent.
  278. //
  279. // Arguments:
  280. // hRes1 [IN] - The first resource. Could be dependency or
  281. // dependent, depending upon the implementation.
  282. // hRes2 [IN] - The second resource. Could be dependency or
  283. // dependent, depending upon the implementation.
  284. //
  285. // Return Value:
  286. // Win32 status code.
  287. //
  288. //--
  289. /////////////////////////////////////////////////////////////////////////////
  290. virtual DWORD ScRemoveDependency( IN HRESOURCE hRes1, IN HRESOURCE hRes2 ) = 0;
  291. }; //*** Class CClusResDepends
  292. /////////////////////////////////////////////////////////////////////////////
  293. //++
  294. //
  295. // class CClusResDependencies
  296. //
  297. // Description:
  298. // Cluster Resource Collection Automation Class.
  299. //
  300. // Inheritance:
  301. // IDispatchImpl< ISClusResDependencies, &IID_ISClusResDependencies, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  302. // CSupportErrorInfo
  303. // CComObjectRootEx< CComSingleThreadModel >
  304. // CComCoClass< CClusResDependencies, &CLSID_ClusResDependencies >
  305. //
  306. //--
  307. /////////////////////////////////////////////////////////////////////////////
  308. class ATL_NO_VTABLE CClusResDependencies :
  309. public CClusResDepends,
  310. public IDispatchImpl< ISClusResDependencies, &IID_ISClusResDependencies, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  311. public CSupportErrorInfo,
  312. public CComObjectRootEx< CComSingleThreadModel >,
  313. public CComCoClass< CClusResDependencies, &CLSID_ClusResDependencies >
  314. {
  315. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  316. public:
  317. CClusResDependencies( void );
  318. BEGIN_COM_MAP(CClusResDependencies)
  319. COM_INTERFACE_ENTRY(IDispatch)
  320. COM_INTERFACE_ENTRY(ISClusResDependencies)
  321. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  322. END_COM_MAP()
  323. DECLARE_NOT_AGGREGATABLE(CClusResDependencies)
  324. DECLARE_NO_REGISTRY()
  325. HRESULT Create( IN ISClusRefObject * pClusRefObject, IN HRESOURCE hResource )
  326. {
  327. return CClusResDepends::Create( pClusRefObject, hResource );
  328. };
  329. STDMETHODIMP get_Count( OUT long * plCount )
  330. {
  331. return CClusResDepends::get_Count( plCount );
  332. };
  333. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT ISClusResource ** ppClusterResource )
  334. {
  335. return CClusResDepends::get_Item( varIndex, ppClusterResource );
  336. };
  337. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk )
  338. {
  339. return CClusResDepends::get__NewEnum( ppunk );
  340. };
  341. STDMETHODIMP DeleteItem( IN VARIANT varIndex )
  342. {
  343. return CClusResDepends::DeleteItem( varIndex );
  344. };
  345. STDMETHODIMP CreateItem(
  346. IN BSTR bstrResourceName,
  347. IN BSTR bstrResourceType,
  348. IN CLUSTER_RESOURCE_CREATE_FLAGS dwFlags,
  349. OUT ISClusResource ** ppClusterResource
  350. )
  351. {
  352. return CClusResDepends::CreateItem( bstrResourceName, bstrResourceType, dwFlags, ppClusterResource );
  353. };
  354. STDMETHODIMP AddItem( IN ISClusResource * pResource )
  355. {
  356. return CClusResDepends::AddItem( pResource );
  357. };
  358. STDMETHODIMP RemoveItem( IN VARIANT varIndex )
  359. {
  360. return CClusResDepends::RemoveItem( varIndex );
  361. };
  362. STDMETHODIMP Refresh( void )
  363. {
  364. return HrRefresh( CLUSTER_RESOURCE_ENUM_DEPENDS );
  365. };
  366. protected:
  367. /////////////////////////////////////////////////////////////////////////////
  368. //++
  369. //
  370. // ScAddDependency
  371. //
  372. // Description:
  373. // Abstracts AddClusterResourceDependency() so the arguments can be
  374. // swapped as necessary if you are making a depedency or a dependent.
  375. //
  376. // Arguments:
  377. // hRes1 [IN] - The dependent resource
  378. // hRes2 [IN] - The depends on resource
  379. //
  380. // Return Value:
  381. // Win32 status code.
  382. //
  383. //--
  384. /////////////////////////////////////////////////////////////////////////////
  385. virtual DWORD ScAddDependency( HRESOURCE hRes1, HRESOURCE hRes2 )
  386. {
  387. return ::AddClusterResourceDependency( hRes1, hRes2 );
  388. }; //*** ScAddDependency
  389. /////////////////////////////////////////////////////////////////////////////
  390. //++
  391. //
  392. // ScRemoveDependency
  393. //
  394. // Description:
  395. // Abstracts RemoveClusterResourceDependency() so the arguments can be
  396. // swapped as necessary if you are making a depedency or a dependent.
  397. //
  398. // Arguments:
  399. // hRes1 [IN] - The dependent resource
  400. // hRes2 [IN] - The depends on resource
  401. //
  402. // Return Value:
  403. // Win32 status code.
  404. //
  405. //--
  406. /////////////////////////////////////////////////////////////////////////////
  407. virtual DWORD ScRemoveDependency( HRESOURCE hRes1, HRESOURCE hRes2 )
  408. {
  409. return ::RemoveClusterResourceDependency( hRes1, hRes2 );
  410. }; //*** ScRemoveDependency
  411. }; //*** Class CClusResDependencies
  412. /////////////////////////////////////////////////////////////////////////////
  413. //++
  414. //
  415. // class CClusResDependents
  416. //
  417. // Description:
  418. // Cluster Resource Collection Automation Class.
  419. //
  420. // Inheritance:
  421. // IDispatchImpl< ISClusResDependents, &IID_ISClusResDependents, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  422. // CSupportErrorInfo
  423. // CComObjectRootEx< CComSingleThreadModel >
  424. // CComCoClass< CClusResDependents, &CLSID_ClusResDependents >
  425. //
  426. //--
  427. /////////////////////////////////////////////////////////////////////////////
  428. class ATL_NO_VTABLE CClusResDependents :
  429. public CClusResDepends,
  430. public IDispatchImpl< ISClusResDependents, &IID_ISClusResDependents, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  431. public CSupportErrorInfo,
  432. public CComObjectRootEx< CComSingleThreadModel >,
  433. public CComCoClass< CClusResDependents, &CLSID_ClusResDependents >
  434. {
  435. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  436. public:
  437. CClusResDependents( void );
  438. BEGIN_COM_MAP(CClusResDependents)
  439. COM_INTERFACE_ENTRY(IDispatch)
  440. COM_INTERFACE_ENTRY(ISClusResDependents)
  441. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  442. END_COM_MAP()
  443. DECLARE_NOT_AGGREGATABLE(CClusResDependents)
  444. DECLARE_NO_REGISTRY()
  445. HRESULT Create( IN ISClusRefObject * pClusRefObject, IN HRESOURCE hResource )
  446. {
  447. return CClusResDepends::Create( pClusRefObject, hResource );
  448. };
  449. STDMETHODIMP get_Count( OUT long * plCount )
  450. {
  451. return CClusResDepends::get_Count( plCount );
  452. };
  453. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT ISClusResource ** ppClusterResource )
  454. {
  455. return CClusResDepends::get_Item( varIndex, ppClusterResource );
  456. };
  457. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk )
  458. {
  459. return CClusResDepends::get__NewEnum( ppunk );
  460. };
  461. STDMETHODIMP DeleteItem( IN VARIANT varIndex )
  462. {
  463. return CClusResDepends::DeleteItem( varIndex );
  464. };
  465. STDMETHODIMP CreateItem(
  466. IN BSTR bstrResourceName,
  467. IN BSTR bstrResourceType,
  468. IN CLUSTER_RESOURCE_CREATE_FLAGS dwFlags,
  469. OUT ISClusResource ** ppClusterResource
  470. )
  471. {
  472. return CClusResDepends::CreateItem( bstrResourceName, bstrResourceType, dwFlags, ppClusterResource );
  473. };
  474. STDMETHODIMP AddItem( IN ISClusResource * pResource )
  475. {
  476. return CClusResDepends::AddItem( pResource );
  477. };
  478. STDMETHODIMP RemoveItem( IN VARIANT varIndex )
  479. {
  480. return CClusResDepends::RemoveItem( varIndex );
  481. };
  482. STDMETHODIMP Refresh( void )
  483. {
  484. return HrRefresh( CLUSTER_RESOURCE_ENUM_PROVIDES );
  485. };
  486. protected:
  487. /////////////////////////////////////////////////////////////////////////////
  488. //++
  489. //
  490. // ScAddDependency
  491. //
  492. // Description:
  493. // Abstracts AddClusterResourceDependency() so the arguments can be
  494. // swapped as necessary if you are making a depedency or a dependent.
  495. //
  496. // Arguments:
  497. // hRes1 [IN] - The depends on resource
  498. // hRes2 [IN] - The dependent resource
  499. //
  500. // Return Value:
  501. // Win32 status code.
  502. //
  503. //--
  504. /////////////////////////////////////////////////////////////////////////////
  505. virtual DWORD ScAddDependency( HRESOURCE hRes1, HRESOURCE hRes2 )
  506. {
  507. return ::AddClusterResourceDependency( hRes2, hRes1 );
  508. }; //*** ScAddDependency
  509. /////////////////////////////////////////////////////////////////////////////
  510. //++
  511. //
  512. // ScRemoveDependency
  513. //
  514. // Description:
  515. // Abstracts RemoveClusterResourceDependency() so the arguments can be
  516. // swapped as necessary if you are making a depedency or a dependent.
  517. //
  518. // Arguments:
  519. // hRes1 [IN] - The depends on resource
  520. // hRes2 [IN] - The dependent resource
  521. //
  522. // Return Value:
  523. // Win32 status code.
  524. //
  525. //--
  526. /////////////////////////////////////////////////////////////////////////////
  527. virtual DWORD ScRemoveDependency( HRESOURCE hRes1, HRESOURCE hRes2 )
  528. {
  529. return ::RemoveClusterResourceDependency( hRes2, hRes1 );
  530. }; //*** ScRemoveDependency
  531. }; //*** Class CClusResDependents
  532. /////////////////////////////////////////////////////////////////////////////
  533. //++
  534. //
  535. // class CClusResGroupResources
  536. //
  537. // Description:
  538. // Cluster Group Resources Collection Automation Class.
  539. //
  540. // Inheritance:
  541. // IDispatchImpl< ISClusResGroupResources, &IID_ISClusResGroupResources, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  542. // CSupportErrorInfo
  543. // CComObjectRootEx< CComSingleThreadModel >
  544. // CResources
  545. // CComCoClass< CClusResGroupResources, &CLSID_ClusResGroupResources >
  546. //
  547. //--
  548. /////////////////////////////////////////////////////////////////////////////
  549. class ATL_NO_VTABLE CClusResGroupResources :
  550. public IDispatchImpl< ISClusResGroupResources, &IID_ISClusResGroupResources, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  551. public CSupportErrorInfo,
  552. public CComObjectRootEx< CComSingleThreadModel >,
  553. public CResources,
  554. public CComCoClass< CClusResGroupResources, &CLSID_ClusResGroupResources >
  555. {
  556. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  557. public:
  558. CClusResGroupResources( void );
  559. ~CClusResGroupResources( void );
  560. BEGIN_COM_MAP(CClusResGroupResources)
  561. COM_INTERFACE_ENTRY(IDispatch)
  562. COM_INTERFACE_ENTRY(ISClusResGroupResources)
  563. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  564. END_COM_MAP()
  565. DECLARE_NOT_AGGREGATABLE(CClusResGroupResources)
  566. DECLARE_NO_REGISTRY()
  567. HRESULT Create( IN ISClusRefObject * pClusRefObject , IN CRefcountedHGROUP hGroup );
  568. STDMETHODIMP get_Count( OUT long * plCount );
  569. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT ISClusResource ** ppClusterResource );
  570. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk );
  571. STDMETHODIMP CreateItem(
  572. IN BSTR bstrResourceName,
  573. IN BSTR bstrResourceType,
  574. IN CLUSTER_RESOURCE_CREATE_FLAGS dwFlags,
  575. OUT ISClusResource ** ppClusterResource
  576. );
  577. STDMETHODIMP DeleteItem( IN VARIANT varIndex );
  578. STDMETHODIMP Refresh( void );
  579. private:
  580. CRefcountedHGROUP m_hGroup;
  581. }; //*** Class CClusResGroupResources
  582. /////////////////////////////////////////////////////////////////////////////
  583. //++
  584. //
  585. // class CClusResTypeResources
  586. //
  587. // Description:
  588. // Cluster Resource Type Resources Collection Automation Class.
  589. //
  590. // Inheritance:
  591. // IDispatchImpl< ISClusResTypeResources, &IID_ISClusResTypeResources, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  592. // CSupportErrorInfo
  593. // CComObjectRootEx< CComSingleThreadModel >
  594. // CResources
  595. // CComCoClass< CClusResTypeResources, &CLSID_ClusResTypeResources >
  596. //
  597. //--
  598. /////////////////////////////////////////////////////////////////////////////
  599. class ATL_NO_VTABLE CClusResTypeResources :
  600. public IDispatchImpl< ISClusResTypeResources, &IID_ISClusResTypeResources, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  601. public CSupportErrorInfo,
  602. public CComObjectRootEx< CComSingleThreadModel >,
  603. public CResources,
  604. public CComCoClass< CClusResTypeResources, &CLSID_ClusResTypeResources >
  605. {
  606. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  607. public:
  608. CClusResTypeResources( void );
  609. ~CClusResTypeResources( void );
  610. BEGIN_COM_MAP(CClusResTypeResources)
  611. COM_INTERFACE_ENTRY(IDispatch)
  612. COM_INTERFACE_ENTRY(ISClusResTypeResources)
  613. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  614. END_COM_MAP()
  615. DECLARE_NOT_AGGREGATABLE(CClusResTypeResources)
  616. DECLARE_NO_REGISTRY()
  617. HRESULT Create( IN ISClusRefObject * pClusRefObject, IN BSTR bstrResTypeName );
  618. STDMETHODIMP get_Count( OUT long * plCount );
  619. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT ISClusResource ** ppClusterResource );
  620. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk );
  621. STDMETHODIMP CreateItem(
  622. IN BSTR bstrResourceName,
  623. IN BSTR bstrGroupName,
  624. IN CLUSTER_RESOURCE_CREATE_FLAGS dwFlags,
  625. OUT ISClusResource ** ppClusterResource
  626. );
  627. STDMETHODIMP DeleteItem( IN VARIANT varIndex );
  628. STDMETHODIMP Refresh( void );
  629. private:
  630. CComBSTR m_bstrResourceTypeName;
  631. }; //*** Class CClusResTypeResources
  632. #endif // _CLUSRES_H_