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.

1175 lines
28 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CBaseInfo.cpp
  7. //
  8. // Description:
  9. // This file contains the implementation of the CBaseInfo
  10. // class heirarchy. They are wrappers for the ClusterApi methods.
  11. //
  12. //
  13. // Documentation:
  14. //
  15. // Maintained By:
  16. //
  17. //////////////////////////////////////////////////////////////////////////////
  18. #include "pch.h"
  19. #include "CBaseInfo.h"
  20. DEFINE_THISCLASS("CBaseInfo")
  21. CBaseInfo::CBaseInfo( void )
  22. {
  23. m_pICHProvider = NULL;
  24. }
  25. CBaseInfo::~CBaseInfo( void )
  26. {
  27. TraceFunc( "" );
  28. Close();
  29. if ( m_pICHProvider )
  30. {
  31. m_pICHProvider->Release();
  32. } // if:
  33. TraceFuncExit();
  34. }
  35. HRESULT CBaseInfo::Close( void )
  36. {
  37. return S_FALSE;
  38. }
  39. HCLUSTER CBaseInfo::getClusterHandle( void )
  40. {
  41. HCLUSTER hCluster = NULL;
  42. if ( m_pICHProvider != NULL )
  43. {
  44. m_pICHProvider->GetClusterHandle( & hCluster );
  45. }
  46. return hCluster;
  47. }
  48. HRESULT CBaseInfo::SetClusterHandleProvider( IClusterHandleProvider * pICHPIn )
  49. {
  50. TraceFunc( "" );
  51. Assert( m_pICHProvider == NULL );
  52. Assert( pICHPIn != NULL );
  53. m_pICHProvider = pICHPIn;
  54. m_pICHProvider->AddRef();
  55. Assert( m_pICHProvider == pICHPIn );
  56. HRETURN( S_OK );
  57. }
  58. HRESULT CBaseInfo::GetPropertyStringValue(
  59. CtlCodeEnum cceIn,
  60. const WCHAR * pszPropertyIn,
  61. BSTR * pbstrResultOut
  62. )
  63. {
  64. TraceFunc( "" );
  65. Assert( pbstrResultOut != NULL );
  66. Assert( pszPropertyIn != NULL );
  67. DWORD sc;
  68. HRESULT hr = S_OK;
  69. CBasePropList cpl;
  70. sc = TW32( cpl.ScGetProperties( *this, ToCode( cceIn ) ) );
  71. if ( sc == ERROR_SUCCESS )
  72. {
  73. hr = THR( GetPropertyStringHelper( cpl, pszPropertyIn, pbstrResultOut ) );
  74. }
  75. else
  76. {
  77. hr = HRESULT_FROM_WIN32( sc );
  78. }
  79. HRETURN( hr );
  80. }
  81. HRESULT CBaseInfo::GetPropertyStringHelper(
  82. CBasePropList & cplIn,
  83. const WCHAR * pszPropertyIn,
  84. BSTR * pbstrResultOut
  85. )
  86. {
  87. TraceFunc( "" );
  88. Assert( pbstrResultOut != NULL );
  89. Assert( pszPropertyIn != NULL );
  90. DWORD sc;
  91. HRESULT hr = S_OK;
  92. CLUSPROP_BUFFER_HELPER cpbh;
  93. sc = TW32( cplIn.ScMoveToPropertyByName( pszPropertyIn ) );
  94. if ( sc != ERROR_SUCCESS )
  95. {
  96. hr = HRESULT_FROM_WIN32( sc );
  97. goto Exit;
  98. } // if:
  99. cpbh = cplIn.CbhCurrentValue();
  100. Assert( cpbh.pSyntax->dw == CLUSPROP_SYNTAX_LIST_VALUE_SZ );
  101. *pbstrResultOut = TraceSysAllocString( cpbh.pStringValue->sz );
  102. if ( *pbstrResultOut == NULL )
  103. {
  104. hr = THR( E_OUTOFMEMORY );
  105. } // if:
  106. Exit:
  107. HRETURN( hr );
  108. }
  109. HRESULT CBaseInfo::GetPropertyDwordValue(
  110. CtlCodeEnum cceIn,
  111. const WCHAR * pszPropertyIn,
  112. DWORD * pdwValueOut
  113. )
  114. {
  115. TraceFunc( "" );
  116. Assert( pdwValueOut != NULL );
  117. Assert( pszPropertyIn != NULL );
  118. DWORD sc;
  119. HRESULT hr = S_OK;
  120. CBasePropList cpl;
  121. sc = TW32( cpl.ScGetProperties( *this, ToCode( cceIn ) ) );
  122. if ( sc == ERROR_SUCCESS )
  123. {
  124. hr = THR( GetPropertyDwordHelper( cpl, pszPropertyIn, pdwValueOut ) );
  125. }
  126. else
  127. {
  128. hr = HRESULT_FROM_WIN32( sc );
  129. }
  130. HRETURN( hr );
  131. }
  132. HRESULT CBaseInfo::GetPropertyDwordHelper(
  133. CBasePropList & cplIn,
  134. const WCHAR * pszPropertyIn,
  135. DWORD * pdwValueOut
  136. )
  137. {
  138. TraceFunc( "" );
  139. Assert( pdwValueOut != NULL );
  140. Assert( pszPropertyIn != NULL );
  141. DWORD sc;
  142. HRESULT hr = S_OK;
  143. CLUSPROP_BUFFER_HELPER cpbh;
  144. sc = TW32( cplIn.ScMoveToPropertyByName( pszPropertyIn ) );
  145. if ( sc != ERROR_SUCCESS )
  146. {
  147. hr = HRESULT_FROM_WIN32( sc );
  148. goto Exit;
  149. }
  150. cpbh = cplIn.CbhCurrentValue();
  151. Assert( cpbh.pSyntax->dw == CLUSPROP_SYNTAX_LIST_VALUE_DWORD );
  152. *pdwValueOut = cpbh.pDwordValue->dw;
  153. Exit:
  154. HRETURN( hr );
  155. }
  156. //////////////////////////////////////////////////////////////////////////////
  157. // CBaseClusterInfo
  158. //////////////////////////////////////////////////////////////////////////////
  159. HRESULT CBaseClusterInfo::Close( void )
  160. {
  161. return S_FALSE;
  162. }
  163. HRESULT CBaseClusterInfo::Open( BSTR bstrNameIn )
  164. {
  165. TraceFunc( "" );
  166. HRESULT hr = S_FALSE;
  167. HCLUSTER hCluster = getClusterHandle();
  168. IUnknown * punk = NULL;
  169. IClusterHandleProvider * piCHProvider = NULL;
  170. if ( hCluster == NULL )
  171. {
  172. CHandleProvider::S_HrCreateInstance( &punk );
  173. hr = punk->TypeSafeQI( IClusterHandleProvider, &piCHProvider );
  174. if ( SUCCEEDED( hr ))
  175. {
  176. hr = piCHProvider->OpenCluster( bstrNameIn );
  177. if ( SUCCEEDED( hr ) )
  178. {
  179. hr = SetClusterHandleProvider( piCHProvider );
  180. }
  181. }
  182. }
  183. if ( punk )
  184. {
  185. punk->Release();
  186. }
  187. if ( piCHProvider )
  188. {
  189. piCHProvider->Release();
  190. }
  191. HRETURN( hr );
  192. }
  193. DWORD CBaseClusterInfo::Control(
  194. DWORD dwEnum,
  195. VOID * pvBufferIn,
  196. DWORD dwLengthIn,
  197. VOID * pvBufferOut,
  198. DWORD dwBufferLength,
  199. DWORD * pdwLengthOut,
  200. HNODE hHostNode
  201. )
  202. {
  203. TraceFunc( "" );
  204. DWORD sc;
  205. HCLUSTER hCluster = getClusterHandle();
  206. if ( hCluster == NULL )
  207. {
  208. sc = TW32( ERROR_INVALID_PARAMETER );
  209. goto Exit;
  210. }
  211. sc = ClusterControl( hCluster, hHostNode, dwEnum, pvBufferIn, dwLengthIn, pvBufferOut, dwBufferLength, pdwLengthOut );
  212. if ( ( sc != ERROR_MORE_DATA ) && ( sc != ERROR_SUCCESS ) )
  213. {
  214. TW32( sc );
  215. } // if:
  216. Exit:
  217. RETURN( sc );
  218. }
  219. //////////////////////////////////////////////////////////////////////////////
  220. // CBaseClusterGroupInfo
  221. //////////////////////////////////////////////////////////////////////////////
  222. HRESULT CBaseClusterGroupInfo::Close( )
  223. {
  224. TraceFunc( "" );
  225. HRESULT hr = S_FALSE;
  226. if ( m_hGroup )
  227. {
  228. hr = S_OK;
  229. CloseClusterGroup( m_hGroup );
  230. }
  231. HRETURN( hr );
  232. }
  233. HRESULT CBaseClusterGroupInfo::Open( BSTR bstrGroupName )
  234. {
  235. TraceFunc( "" );
  236. HRESULT hr = S_OK;
  237. HCLUSTER hCluster = getClusterHandle();
  238. if ( hCluster == NULL )
  239. {
  240. hr = THR( E_FAIL );
  241. goto Exit;
  242. }
  243. m_hGroup = OpenClusterGroup( hCluster, bstrGroupName );
  244. if ( m_hGroup == NULL )
  245. {
  246. hr = HRESULT_FROM_WIN32( TW32( GetLastError() ) );
  247. }
  248. Exit:
  249. HRETURN( hr );
  250. }
  251. DWORD CBaseClusterGroupInfo::Control(
  252. DWORD dwEnum,
  253. VOID * pvBufferIn,
  254. DWORD dwLengthIn,
  255. VOID * pvBufferOut,
  256. DWORD dwBufferLength,
  257. DWORD * pdwLengthOut,
  258. HNODE hHostNode
  259. )
  260. {
  261. TraceFunc( "" );
  262. DWORD sc;
  263. if ( m_hGroup == NULL )
  264. {
  265. sc = TW32( ERROR_INVALID_PARAMETER );
  266. goto Exit;
  267. }
  268. sc = ClusterGroupControl( m_hGroup , hHostNode, dwEnum, pvBufferIn, dwLengthIn, pvBufferOut, dwBufferLength, pdwLengthOut );
  269. if ( ( sc != ERROR_MORE_DATA ) && ( sc != ERROR_SUCCESS ) )
  270. {
  271. TW32( sc );
  272. } // if:
  273. Exit:
  274. RETURN( sc );
  275. }
  276. //////////////////////////////////////////////////////////////////////////////
  277. // CBaseClusterGroupInfo
  278. //////////////////////////////////////////////////////////////////////////////
  279. HRESULT CBaseClusterResourceInfo::Close( void )
  280. {
  281. TraceFunc( "" );
  282. HRESULT hr = S_FALSE;
  283. if ( m_hResource )
  284. {
  285. hr = S_OK;
  286. CloseClusterResource( m_hResource );
  287. }
  288. HRETURN( hr );
  289. }
  290. HRESULT CBaseClusterResourceInfo::Open( BSTR bstrResourceName )
  291. {
  292. TraceFunc( "" );
  293. HRESULT hr = S_OK;
  294. HCLUSTER hCluster = getClusterHandle();
  295. if ( hCluster == NULL )
  296. {
  297. hr = THR( E_FAIL );
  298. goto Exit;
  299. }
  300. m_hResource = OpenClusterResource( hCluster, bstrResourceName );
  301. if ( m_hResource == NULL )
  302. {
  303. hr = HRESULT_FROM_WIN32( TW32( GetLastError() ) );
  304. }
  305. Exit:
  306. HRETURN( hr );
  307. }
  308. DWORD CBaseClusterResourceInfo::Control(
  309. DWORD dwEnum,
  310. VOID * pvBufferIn,
  311. DWORD dwLengthIn,
  312. VOID * pvBufferOut,
  313. DWORD dwBufferLength,
  314. DWORD * pdwLengthOut,
  315. HNODE hHostNode
  316. )
  317. {
  318. TraceFunc( "" );
  319. DWORD sc;
  320. if ( m_hResource == NULL )
  321. {
  322. sc = TW32( ERROR_INVALID_PARAMETER );
  323. goto Exit;
  324. }
  325. sc = ClusterResourceControl( m_hResource, hHostNode, dwEnum, pvBufferIn, dwLengthIn, pvBufferOut, dwBufferLength, pdwLengthOut );
  326. if ( ( sc != ERROR_MORE_DATA ) && ( sc != ERROR_SUCCESS ) )
  327. {
  328. TW32( sc );
  329. } // if:
  330. Exit:
  331. RETURN( sc );
  332. }
  333. //////////////////////////////////////////////////////////////////////////////
  334. // CBaseClusterGroupInfo
  335. //////////////////////////////////////////////////////////////////////////////
  336. HRESULT CBaseClusterNodeInfo::Close( void )
  337. {
  338. TraceFunc( "" );
  339. HRESULT hr = S_FALSE;
  340. if ( m_hNode )
  341. {
  342. hr = S_OK;
  343. CloseClusterNode( m_hNode );
  344. }
  345. HRETURN( hr );
  346. }
  347. HRESULT CBaseClusterNodeInfo::Open( BSTR bstrNodeName )
  348. {
  349. TraceFunc( "" );
  350. HRESULT hr = S_OK;
  351. HCLUSTER hCluster = getClusterHandle();
  352. if ( hCluster == NULL )
  353. {
  354. hr = THR( E_FAIL );
  355. goto Exit;
  356. }
  357. m_hNode = OpenClusterNode( hCluster, bstrNodeName );
  358. if ( m_hNode == NULL )
  359. {
  360. hr = HRESULT_FROM_WIN32( TW32( GetLastError() ) );
  361. }
  362. Exit:
  363. HRETURN( hr );
  364. }
  365. DWORD CBaseClusterNodeInfo::Control(
  366. DWORD dwEnum,
  367. VOID * pvBufferIn,
  368. DWORD dwLengthIn,
  369. VOID * pvBufferOut,
  370. DWORD dwBufferLength,
  371. DWORD * pdwLengthOut,
  372. HNODE hHostNode
  373. )
  374. {
  375. TraceFunc( "" );
  376. DWORD sc;
  377. if ( m_hNode == NULL )
  378. {
  379. sc = TW32( ERROR_INVALID_PARAMETER );
  380. goto Exit;
  381. }
  382. sc = ClusterNodeControl( m_hNode, hHostNode, dwEnum, pvBufferIn, dwLengthIn, pvBufferOut, dwBufferLength, pdwLengthOut );
  383. if ( ( sc != ERROR_MORE_DATA ) && ( sc != ERROR_SUCCESS ) )
  384. {
  385. TW32( sc );
  386. } // if:
  387. Exit:
  388. RETURN( sc );
  389. }
  390. //////////////////////////////////////////////////////////////////////////////
  391. // CBaseClusterGroupInfo
  392. //////////////////////////////////////////////////////////////////////////////
  393. HRESULT CBaseClusterNetworkInfo::Close( void )
  394. {
  395. TraceFunc( "" );
  396. HRESULT hr = S_FALSE;
  397. if ( m_hNetwork )
  398. {
  399. hr = S_OK;
  400. CloseClusterNetwork( m_hNetwork );
  401. }
  402. HRETURN( hr );
  403. }
  404. HRESULT CBaseClusterNetworkInfo::Open( BSTR bstrNetworkName )
  405. {
  406. TraceFunc( "" );
  407. HRESULT hr = S_OK;
  408. HCLUSTER hCluster = getClusterHandle();
  409. if ( hCluster == NULL )
  410. {
  411. hr = THR( E_FAIL );
  412. goto Exit;
  413. }
  414. m_hNetwork = OpenClusterNetwork( hCluster, bstrNetworkName );
  415. if ( m_hNetwork == NULL )
  416. {
  417. hr = HRESULT_FROM_WIN32( TW32( GetLastError() ) );
  418. }
  419. Exit:
  420. HRETURN( hr );
  421. }
  422. DWORD CBaseClusterNetworkInfo::Control(
  423. DWORD dwEnum,
  424. VOID * pvBufferIn,
  425. DWORD dwLengthIn,
  426. VOID * pvBufferOut,
  427. DWORD dwBufferLength,
  428. DWORD * pdwLengthOut,
  429. HNODE hHostNode
  430. )
  431. {
  432. TraceFunc( "" );
  433. DWORD sc;
  434. if ( m_hNetwork == NULL )
  435. {
  436. sc = TW32( ERROR_INVALID_PARAMETER );
  437. goto Exit;
  438. }
  439. sc = ClusterNetworkControl( m_hNetwork, hHostNode, dwEnum, pvBufferIn, dwLengthIn, pvBufferOut, dwBufferLength, pdwLengthOut );
  440. if ( ( sc != ERROR_MORE_DATA ) && ( sc != ERROR_SUCCESS ) )
  441. {
  442. TW32( sc );
  443. } // if:
  444. Exit:
  445. RETURN( sc );
  446. }
  447. //////////////////////////////////////////////////////////////////////////////
  448. // CBaseClusterGroupInfo
  449. //////////////////////////////////////////////////////////////////////////////
  450. HRESULT CBaseClusterNetInterfaceInfo::Close( void )
  451. {
  452. TraceFunc( "" );
  453. HRESULT hr = S_FALSE;
  454. if ( m_hNetworkInterface )
  455. {
  456. hr = S_OK;
  457. CloseClusterNetInterface( m_hNetworkInterface );
  458. }
  459. HRETURN( hr );
  460. }
  461. HRESULT CBaseClusterNetInterfaceInfo::Open( BSTR bstrNetworkInterfaceName )
  462. {
  463. TraceFunc( "" );
  464. HRESULT hr = S_OK;
  465. HCLUSTER hCluster = getClusterHandle();
  466. if ( hCluster == NULL )
  467. {
  468. hr = THR( E_FAIL );
  469. goto Exit;
  470. }
  471. m_hNetworkInterface = OpenClusterNetInterface( hCluster, bstrNetworkInterfaceName );
  472. if ( m_hNetworkInterface == NULL )
  473. {
  474. hr = HRESULT_FROM_WIN32( TW32( GetLastError() ) );
  475. }
  476. Exit:
  477. HRETURN( hr );
  478. }
  479. DWORD CBaseClusterNetInterfaceInfo::Control(
  480. DWORD dwEnum,
  481. VOID * pvBufferIn,
  482. DWORD dwLengthIn,
  483. VOID * pvBufferOut,
  484. DWORD dwBufferLength,
  485. DWORD * pdwLengthOut,
  486. HNODE hHostNode
  487. )
  488. {
  489. TraceFunc( "" );
  490. DWORD sc;
  491. if ( m_hNetworkInterface == NULL )
  492. {
  493. sc = TW32( ERROR_INVALID_PARAMETER );
  494. goto Exit;
  495. }
  496. sc = ClusterNetInterfaceControl( m_hNetworkInterface, hHostNode, dwEnum, pvBufferIn, dwLengthIn, pvBufferOut, dwBufferLength, pdwLengthOut );
  497. if ( ( sc != ERROR_MORE_DATA ) && ( sc != ERROR_SUCCESS ) )
  498. {
  499. TW32( sc );
  500. } // if:
  501. Exit:
  502. RETURN( sc );
  503. }
  504. //////////////////////////////////////////////////////////////////////////////
  505. // ToCode
  506. //
  507. // These methods translate the CtlCodeEnums to the appropriate control code
  508. // for each class.
  509. //
  510. //
  511. /////////////////////////////////////////////////////////////////
  512. DWORD CBaseClusterInfo::ToCode( CtlCodeEnum cceIn )
  513. {
  514. TraceFunc( "" );
  515. DWORD dwResult = 0;
  516. switch( cceIn )
  517. {
  518. case CONTROL_UNKNOWN:
  519. dwResult = CLUSCTL_CLUSTER_UNKNOWN;
  520. break;
  521. case CONTROL_VALIDATE_COMMON_PROPERTIES:
  522. dwResult = CLUSCTL_CLUSTER_VALIDATE_COMMON_PROPERTIES;
  523. break;
  524. case CONTROL_VALIDATE_PRIVATE_PROPERTIES:
  525. dwResult = CLUSCTL_CLUSTER_VALIDATE_PRIVATE_PROPERTIES;
  526. break;
  527. case CONTROL_ENUM_COMMON_PROPERTIES:
  528. dwResult = CLUSCTL_CLUSTER_ENUM_COMMON_PROPERTIES;
  529. break;
  530. case CONTROL_ENUM_PRIVATE_PROPERTIES:
  531. dwResult = CLUSCTL_CLUSTER_ENUM_PRIVATE_PROPERTIES;
  532. break;
  533. case CONTROL_GET_RO_COMMON_PROPERTIES:
  534. dwResult = CLUSCTL_CLUSTER_GET_RO_COMMON_PROPERTIES;
  535. break;
  536. case CONTROL_GET_RO_PRIVATE_PROPERTIES:
  537. dwResult = CLUSCTL_CLUSTER_GET_RO_PRIVATE_PROPERTIES;
  538. break;
  539. case CONTROL_GET_COMMON_PROPERTIES:
  540. dwResult = CLUSCTL_CLUSTER_GET_COMMON_PROPERTIES;
  541. break;
  542. case CONTROL_GET_PRIVATE_PROPERTIES:
  543. dwResult = CLUSCTL_CLUSTER_GET_PRIVATE_PROPERTIES;
  544. break;
  545. case CONTROL_SET_COMMON_PROPERTIES:
  546. dwResult = CLUSCTL_CLUSTER_SET_COMMON_PROPERTIES;
  547. break;
  548. case CONTROL_SET_PRIVATE_PROPERTIES:
  549. dwResult = CLUSCTL_CLUSTER_SET_PRIVATE_PROPERTIES;
  550. break;
  551. case CONTROL_GET_TYPE:
  552. case CONTROL_GET_NAME:
  553. case CONTROL_GET_ID:
  554. case CONTROL_GET_FLAGS:
  555. case CONTROL_GET_CLASS_INFO:
  556. case CONTROL_GET_NETWORK_NAME:
  557. case CONTROL_GET_CHARACTERISTICS:
  558. case CONTROL_GET_REQUIRED_DEPENDENCIES:
  559. case CONTROL_STORAGE_GET_DISK_INFO:
  560. case CONTROL_STORAGE_IS_PATH_VALID:
  561. case CONTROL_STORAGE_GET_AVAILABLE_DISKS:
  562. case CONTROL_QUERY_DELETE:
  563. case CONTROL_ADD_CRYPTO_CHECKPOINT:
  564. case CONTROL_ADD_REGISTRY_CHECKPOINT:
  565. case CONTROL_GET_REGISTRY_CHECKPOINTS:
  566. case CONTROL_GET_CRYPTO_CHECKPOINTS:
  567. case CONTROL_DELETE_CRYPTO_CHECKPOINT:
  568. case CONTROL_DELETE_REGISTRY_CHECKPOINT:
  569. default:
  570. dwResult = 0;
  571. }
  572. RETURN( dwResult );
  573. }
  574. DWORD CBaseClusterGroupInfo::ToCode( CtlCodeEnum cceIn )
  575. {
  576. TraceFunc( "" );
  577. DWORD dwResult = 0;
  578. switch( cceIn )
  579. {
  580. case CONTROL_UNKNOWN:
  581. dwResult = CLUSCTL_GROUP_UNKNOWN;
  582. break;
  583. case CONTROL_VALIDATE_COMMON_PROPERTIES:
  584. dwResult = CLUSCTL_GROUP_VALIDATE_COMMON_PROPERTIES;
  585. break;
  586. case CONTROL_VALIDATE_PRIVATE_PROPERTIES:
  587. dwResult = CLUSCTL_GROUP_VALIDATE_PRIVATE_PROPERTIES;
  588. break;
  589. case CONTROL_ENUM_COMMON_PROPERTIES:
  590. dwResult = CLUSCTL_GROUP_ENUM_COMMON_PROPERTIES;
  591. break;
  592. case CONTROL_ENUM_PRIVATE_PROPERTIES:
  593. dwResult = CLUSCTL_GROUP_ENUM_PRIVATE_PROPERTIES;
  594. break;
  595. case CONTROL_GET_RO_COMMON_PROPERTIES:
  596. dwResult = CLUSCTL_GROUP_GET_RO_COMMON_PROPERTIES;
  597. break;
  598. case CONTROL_GET_RO_PRIVATE_PROPERTIES:
  599. dwResult = CLUSCTL_GROUP_GET_RO_PRIVATE_PROPERTIES;
  600. break;
  601. case CONTROL_GET_COMMON_PROPERTIES:
  602. dwResult = CLUSCTL_GROUP_GET_COMMON_PROPERTIES;
  603. break;
  604. case CONTROL_GET_PRIVATE_PROPERTIES:
  605. dwResult = CLUSCTL_GROUP_GET_PRIVATE_PROPERTIES;
  606. break;
  607. case CONTROL_SET_COMMON_PROPERTIES:
  608. dwResult = CLUSCTL_GROUP_SET_COMMON_PROPERTIES;
  609. break;
  610. case CONTROL_SET_PRIVATE_PROPERTIES:
  611. dwResult = CLUSCTL_GROUP_SET_PRIVATE_PROPERTIES;
  612. break;
  613. case CONTROL_GET_NAME:
  614. dwResult = CLUSCTL_GROUP_GET_NAME;
  615. break;
  616. case CONTROL_GET_ID:
  617. dwResult = CLUSCTL_GROUP_GET_ID;
  618. break;
  619. case CONTROL_GET_FLAGS:
  620. dwResult = CLUSCTL_GROUP_GET_FLAGS;
  621. break;
  622. case CONTROL_GET_CHARACTERISTICS:
  623. dwResult = CLUSCTL_GROUP_GET_CHARACTERISTICS;
  624. break;
  625. case CONTROL_QUERY_DELETE:
  626. dwResult = CLUSCTL_GROUP_QUERY_DELETE;
  627. break;
  628. case CONTROL_GET_CLASS_INFO:
  629. case CONTROL_GET_NETWORK_NAME:
  630. case CONTROL_GET_TYPE:
  631. case CONTROL_GET_REQUIRED_DEPENDENCIES:
  632. case CONTROL_STORAGE_GET_DISK_INFO:
  633. case CONTROL_STORAGE_IS_PATH_VALID:
  634. case CONTROL_STORAGE_GET_AVAILABLE_DISKS:
  635. case CONTROL_ADD_CRYPTO_CHECKPOINT:
  636. case CONTROL_ADD_REGISTRY_CHECKPOINT:
  637. case CONTROL_GET_REGISTRY_CHECKPOINTS:
  638. case CONTROL_GET_CRYPTO_CHECKPOINTS:
  639. case CONTROL_DELETE_CRYPTO_CHECKPOINT:
  640. case CONTROL_DELETE_REGISTRY_CHECKPOINT:
  641. default:
  642. dwResult = 0;
  643. }
  644. RETURN( dwResult );
  645. }
  646. DWORD CBaseClusterResourceInfo::ToCode( CtlCodeEnum cceIn )
  647. {
  648. TraceFunc( "" );
  649. DWORD dwResult = 0;
  650. switch( cceIn )
  651. {
  652. case CONTROL_UNKNOWN:
  653. dwResult = CLUSCTL_RESOURCE_UNKNOWN;
  654. break;
  655. case CONTROL_VALIDATE_COMMON_PROPERTIES:
  656. dwResult = CLUSCTL_RESOURCE_VALIDATE_COMMON_PROPERTIES;
  657. break;
  658. case CONTROL_VALIDATE_PRIVATE_PROPERTIES:
  659. dwResult = CLUSCTL_RESOURCE_VALIDATE_PRIVATE_PROPERTIES;
  660. break;
  661. case CONTROL_ENUM_COMMON_PROPERTIES:
  662. dwResult = CLUSCTL_RESOURCE_ENUM_COMMON_PROPERTIES;
  663. break;
  664. case CONTROL_ENUM_PRIVATE_PROPERTIES:
  665. dwResult = CLUSCTL_RESOURCE_ENUM_PRIVATE_PROPERTIES;
  666. break;
  667. case CONTROL_GET_RO_COMMON_PROPERTIES:
  668. dwResult = CLUSCTL_RESOURCE_GET_RO_COMMON_PROPERTIES;
  669. break;
  670. case CONTROL_GET_RO_PRIVATE_PROPERTIES:
  671. dwResult = CLUSCTL_RESOURCE_GET_RO_PRIVATE_PROPERTIES;
  672. break;
  673. case CONTROL_GET_COMMON_PROPERTIES:
  674. dwResult = CLUSCTL_RESOURCE_GET_COMMON_PROPERTIES;
  675. break;
  676. case CONTROL_GET_PRIVATE_PROPERTIES:
  677. dwResult = CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES;
  678. break;
  679. case CONTROL_SET_COMMON_PROPERTIES:
  680. dwResult = CLUSCTL_RESOURCE_SET_COMMON_PROPERTIES;
  681. break;
  682. case CONTROL_SET_PRIVATE_PROPERTIES:
  683. dwResult = CLUSCTL_RESOURCE_SET_PRIVATE_PROPERTIES;
  684. break;
  685. case CONTROL_GET_TYPE:
  686. dwResult = CLUSCTL_RESOURCE_GET_RESOURCE_TYPE;
  687. break;
  688. case CONTROL_GET_NAME:
  689. dwResult = CLUSCTL_RESOURCE_GET_NAME;
  690. break;
  691. case CONTROL_GET_ID:
  692. dwResult = CLUSCTL_RESOURCE_GET_ID;
  693. break;
  694. case CONTROL_GET_FLAGS:
  695. dwResult = CLUSCTL_RESOURCE_GET_FLAGS;
  696. break;
  697. case CONTROL_GET_CLASS_INFO:
  698. dwResult = CLUSCTL_RESOURCE_GET_CLASS_INFO;
  699. break;
  700. case CONTROL_GET_NETWORK_NAME:
  701. dwResult = CLUSCTL_RESOURCE_GET_NETWORK_NAME;
  702. break;
  703. case CONTROL_GET_CHARACTERISTICS:
  704. dwResult = CLUSCTL_RESOURCE_GET_CHARACTERISTICS;
  705. break;
  706. case CONTROL_GET_REQUIRED_DEPENDENCIES:
  707. dwResult = CLUSCTL_RESOURCE_GET_REQUIRED_DEPENDENCIES;
  708. break;
  709. case CONTROL_ADD_CRYPTO_CHECKPOINT:
  710. dwResult = CLUSCTL_RESOURCE_ADD_CRYPTO_CHECKPOINT;
  711. break;
  712. case CONTROL_ADD_REGISTRY_CHECKPOINT:
  713. dwResult = CLUSCTL_RESOURCE_ADD_REGISTRY_CHECKPOINT;
  714. break;
  715. case CONTROL_GET_REGISTRY_CHECKPOINTS:
  716. dwResult = CLUSCTL_RESOURCE_GET_REGISTRY_CHECKPOINTS;
  717. break;
  718. case CONTROL_GET_CRYPTO_CHECKPOINTS:
  719. dwResult = CLUSCTL_RESOURCE_GET_CRYPTO_CHECKPOINTS;
  720. break;
  721. case CONTROL_DELETE_CRYPTO_CHECKPOINT:
  722. dwResult = CLUSCTL_RESOURCE_DELETE_CRYPTO_CHECKPOINT;
  723. break;
  724. case CONTROL_DELETE_REGISTRY_CHECKPOINT:
  725. dwResult = CLUSCTL_RESOURCE_DELETE_REGISTRY_CHECKPOINT;
  726. break;
  727. case CONTROL_STORAGE_GET_DISK_INFO:
  728. dwResult = CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO;
  729. break;
  730. case CONTROL_STORAGE_IS_PATH_VALID:
  731. dwResult = CLUSCTL_RESOURCE_STORAGE_IS_PATH_VALID;
  732. break;
  733. case CONTROL_QUERY_DELETE:
  734. dwResult = CLUSCTL_RESOURCE_QUERY_DELETE;
  735. break;
  736. case CONTROL_STORAGE_GET_AVAILABLE_DISKS:
  737. default:
  738. dwResult = 0;
  739. }
  740. RETURN( dwResult );
  741. }
  742. DWORD
  743. CBaseClusterNodeInfo::ToCode( CtlCodeEnum cceIn )
  744. {
  745. TraceFunc( "" );
  746. DWORD dwResult = 0;
  747. switch( cceIn )
  748. {
  749. case CONTROL_UNKNOWN:
  750. dwResult = CLUSCTL_NODE_UNKNOWN;
  751. break;
  752. case CONTROL_VALIDATE_COMMON_PROPERTIES:
  753. dwResult = CLUSCTL_NODE_VALIDATE_COMMON_PROPERTIES;
  754. break;
  755. case CONTROL_VALIDATE_PRIVATE_PROPERTIES:
  756. dwResult = CLUSCTL_NODE_VALIDATE_PRIVATE_PROPERTIES;
  757. break;
  758. case CONTROL_ENUM_COMMON_PROPERTIES:
  759. dwResult = CLUSCTL_NODE_ENUM_COMMON_PROPERTIES;
  760. break;
  761. case CONTROL_ENUM_PRIVATE_PROPERTIES:
  762. dwResult = CLUSCTL_NODE_ENUM_PRIVATE_PROPERTIES;
  763. break;
  764. case CONTROL_GET_RO_COMMON_PROPERTIES:
  765. dwResult = CLUSCTL_NODE_GET_RO_COMMON_PROPERTIES;
  766. break;
  767. case CONTROL_GET_RO_PRIVATE_PROPERTIES:
  768. dwResult = CLUSCTL_NODE_GET_RO_PRIVATE_PROPERTIES;
  769. break;
  770. case CONTROL_GET_COMMON_PROPERTIES:
  771. dwResult = CLUSCTL_NODE_GET_COMMON_PROPERTIES;
  772. break;
  773. case CONTROL_GET_PRIVATE_PROPERTIES:
  774. dwResult = CLUSCTL_NODE_GET_PRIVATE_PROPERTIES;
  775. break;
  776. case CONTROL_SET_COMMON_PROPERTIES:
  777. dwResult = CLUSCTL_NODE_SET_COMMON_PROPERTIES;
  778. break;
  779. case CONTROL_SET_PRIVATE_PROPERTIES:
  780. dwResult = CLUSCTL_NODE_SET_PRIVATE_PROPERTIES;
  781. break;
  782. case CONTROL_GET_NAME:
  783. dwResult = CLUSCTL_NODE_GET_NAME;
  784. break;
  785. case CONTROL_GET_ID:
  786. dwResult = CLUSCTL_NODE_GET_ID;
  787. break;
  788. case CONTROL_GET_FLAGS:
  789. dwResult = CLUSCTL_NODE_GET_FLAGS;
  790. break;
  791. case CONTROL_GET_CHARACTERISTICS:
  792. dwResult = CLUSCTL_NODE_GET_CHARACTERISTICS;
  793. break;
  794. case CONTROL_GET_TYPE:
  795. case CONTROL_GET_CLASS_INFO:
  796. case CONTROL_GET_NETWORK_NAME:
  797. case CONTROL_GET_REQUIRED_DEPENDENCIES:
  798. case CONTROL_STORAGE_GET_DISK_INFO:
  799. case CONTROL_STORAGE_IS_PATH_VALID:
  800. case CONTROL_STORAGE_GET_AVAILABLE_DISKS:
  801. case CONTROL_QUERY_DELETE:
  802. case CONTROL_ADD_CRYPTO_CHECKPOINT:
  803. case CONTROL_ADD_REGISTRY_CHECKPOINT:
  804. case CONTROL_GET_REGISTRY_CHECKPOINTS:
  805. case CONTROL_GET_CRYPTO_CHECKPOINTS:
  806. case CONTROL_DELETE_CRYPTO_CHECKPOINT:
  807. case CONTROL_DELETE_REGISTRY_CHECKPOINT:
  808. default:
  809. dwResult = 0;
  810. }
  811. RETURN( dwResult );
  812. }
  813. DWORD
  814. CBaseClusterNetworkInfo::ToCode( CtlCodeEnum cceIn )
  815. {
  816. TraceFunc( "" );
  817. DWORD dwResult = 0;
  818. switch( cceIn )
  819. {
  820. case CONTROL_UNKNOWN:
  821. dwResult = CLUSCTL_NETWORK_UNKNOWN;
  822. break;
  823. case CONTROL_VALIDATE_COMMON_PROPERTIES:
  824. dwResult = CLUSCTL_NETWORK_VALIDATE_COMMON_PROPERTIES;
  825. break;
  826. case CONTROL_VALIDATE_PRIVATE_PROPERTIES:
  827. dwResult = CLUSCTL_NETWORK_VALIDATE_PRIVATE_PROPERTIES;
  828. break;
  829. case CONTROL_ENUM_COMMON_PROPERTIES:
  830. dwResult = CLUSCTL_NETWORK_ENUM_COMMON_PROPERTIES;
  831. break;
  832. case CONTROL_ENUM_PRIVATE_PROPERTIES:
  833. dwResult = CLUSCTL_NETWORK_ENUM_PRIVATE_PROPERTIES;
  834. break;
  835. case CONTROL_GET_RO_COMMON_PROPERTIES:
  836. dwResult = CLUSCTL_NETWORK_GET_RO_COMMON_PROPERTIES;
  837. break;
  838. case CONTROL_GET_RO_PRIVATE_PROPERTIES:
  839. dwResult = CLUSCTL_NETWORK_GET_RO_PRIVATE_PROPERTIES;
  840. break;
  841. case CONTROL_GET_COMMON_PROPERTIES:
  842. dwResult = CLUSCTL_NETWORK_GET_COMMON_PROPERTIES;
  843. break;
  844. case CONTROL_GET_PRIVATE_PROPERTIES:
  845. dwResult = CLUSCTL_NETWORK_GET_PRIVATE_PROPERTIES;
  846. break;
  847. case CONTROL_SET_COMMON_PROPERTIES:
  848. dwResult = CLUSCTL_NETWORK_SET_COMMON_PROPERTIES;
  849. break;
  850. case CONTROL_SET_PRIVATE_PROPERTIES:
  851. dwResult = CLUSCTL_NETWORK_SET_PRIVATE_PROPERTIES;
  852. break;
  853. case CONTROL_GET_NAME:
  854. dwResult = CLUSCTL_NETWORK_GET_NAME;
  855. break;
  856. case CONTROL_GET_ID:
  857. dwResult = CLUSCTL_NETWORK_GET_ID;
  858. break;
  859. case CONTROL_GET_FLAGS:
  860. dwResult = CLUSCTL_NETWORK_GET_FLAGS;
  861. break;
  862. case CONTROL_GET_CHARACTERISTICS:
  863. dwResult = CLUSCTL_NETWORK_GET_CHARACTERISTICS;
  864. break;
  865. case CONTROL_GET_TYPE:
  866. case CONTROL_GET_CLASS_INFO:
  867. case CONTROL_GET_NETWORK_NAME:
  868. case CONTROL_GET_REQUIRED_DEPENDENCIES:
  869. case CONTROL_STORAGE_GET_DISK_INFO:
  870. case CONTROL_STORAGE_IS_PATH_VALID:
  871. case CONTROL_STORAGE_GET_AVAILABLE_DISKS:
  872. case CONTROL_QUERY_DELETE:
  873. case CONTROL_ADD_CRYPTO_CHECKPOINT:
  874. case CONTROL_ADD_REGISTRY_CHECKPOINT:
  875. case CONTROL_GET_REGISTRY_CHECKPOINTS:
  876. case CONTROL_GET_CRYPTO_CHECKPOINTS:
  877. case CONTROL_DELETE_CRYPTO_CHECKPOINT:
  878. case CONTROL_DELETE_REGISTRY_CHECKPOINT:
  879. default:
  880. dwResult = 0;
  881. }
  882. RETURN( dwResult );
  883. }
  884. DWORD
  885. CBaseClusterNetInterfaceInfo::ToCode( CtlCodeEnum cceIn )
  886. {
  887. TraceFunc( "" );
  888. DWORD dwResult = 0;
  889. switch( cceIn )
  890. {
  891. case CONTROL_UNKNOWN:
  892. dwResult = CLUSCTL_NETINTERFACE_UNKNOWN;
  893. break;
  894. case CONTROL_VALIDATE_COMMON_PROPERTIES:
  895. dwResult = CLUSCTL_NETINTERFACE_VALIDATE_COMMON_PROPERTIES;
  896. break;
  897. case CONTROL_VALIDATE_PRIVATE_PROPERTIES:
  898. dwResult = CLUSCTL_NETINTERFACE_VALIDATE_PRIVATE_PROPERTIES;
  899. break;
  900. case CONTROL_ENUM_COMMON_PROPERTIES:
  901. dwResult = CLUSCTL_NETINTERFACE_ENUM_COMMON_PROPERTIES;
  902. break;
  903. case CONTROL_ENUM_PRIVATE_PROPERTIES:
  904. dwResult = CLUSCTL_NETINTERFACE_ENUM_PRIVATE_PROPERTIES;
  905. break;
  906. case CONTROL_GET_RO_COMMON_PROPERTIES:
  907. dwResult = CLUSCTL_NETINTERFACE_GET_RO_COMMON_PROPERTIES;
  908. break;
  909. case CONTROL_GET_RO_PRIVATE_PROPERTIES:
  910. dwResult = CLUSCTL_NETINTERFACE_GET_RO_PRIVATE_PROPERTIES;
  911. break;
  912. case CONTROL_GET_COMMON_PROPERTIES:
  913. dwResult = CLUSCTL_NETINTERFACE_GET_COMMON_PROPERTIES;
  914. break;
  915. case CONTROL_GET_PRIVATE_PROPERTIES:
  916. dwResult = CLUSCTL_NETINTERFACE_GET_PRIVATE_PROPERTIES;
  917. break;
  918. case CONTROL_SET_COMMON_PROPERTIES:
  919. dwResult = CLUSCTL_NETINTERFACE_SET_COMMON_PROPERTIES;
  920. break;
  921. case CONTROL_SET_PRIVATE_PROPERTIES:
  922. dwResult = CLUSCTL_NETINTERFACE_SET_PRIVATE_PROPERTIES;
  923. break;
  924. case CONTROL_GET_NAME:
  925. dwResult = CLUSCTL_NETINTERFACE_SET_PRIVATE_PROPERTIES;
  926. break;
  927. case CONTROL_GET_ID:
  928. dwResult = CLUSCTL_NETINTERFACE_SET_PRIVATE_PROPERTIES;
  929. break;
  930. case CONTROL_GET_FLAGS:
  931. dwResult = CLUSCTL_NETINTERFACE_SET_PRIVATE_PROPERTIES;
  932. break;
  933. case CONTROL_GET_CHARACTERISTICS:
  934. dwResult = CLUSCTL_NETINTERFACE_SET_PRIVATE_PROPERTIES;
  935. break;
  936. case CONTROL_GET_CLASS_INFO:
  937. case CONTROL_GET_NETWORK_NAME:
  938. case CONTROL_GET_REQUIRED_DEPENDENCIES:
  939. case CONTROL_GET_TYPE:
  940. case CONTROL_STORAGE_GET_DISK_INFO:
  941. case CONTROL_STORAGE_IS_PATH_VALID:
  942. case CONTROL_STORAGE_GET_AVAILABLE_DISKS:
  943. case CONTROL_QUERY_DELETE:
  944. case CONTROL_ADD_CRYPTO_CHECKPOINT:
  945. case CONTROL_ADD_REGISTRY_CHECKPOINT:
  946. case CONTROL_GET_REGISTRY_CHECKPOINTS:
  947. case CONTROL_GET_CRYPTO_CHECKPOINTS:
  948. case CONTROL_DELETE_CRYPTO_CHECKPOINT:
  949. case CONTROL_DELETE_REGISTRY_CHECKPOINT:
  950. default:
  951. dwResult = 0;
  952. }
  953. RETURN( dwResult );
  954. }