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.

252 lines
7.5 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000-2002 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CPhysicalDisk.h
  7. //
  8. // Description:
  9. // This file contains the declaration of the CPhysicalDisk
  10. // class.
  11. //
  12. // The class CPhysicalDisk represents a cluster storage
  13. // device. It implements the IClusCfgManagaedResourceInfo interface.
  14. //
  15. // Documentation:
  16. //
  17. // Implementation Files:
  18. // CPhysicalDisk.cpp
  19. //
  20. // Maintained By:
  21. // Galen Barbee (GalenB) 23-FEB-2000
  22. //
  23. //////////////////////////////////////////////////////////////////////////////
  24. // Make sure that this file is included only once per compile path.
  25. #pragma once
  26. //////////////////////////////////////////////////////////////////////////////
  27. // Include Files
  28. //////////////////////////////////////////////////////////////////////////////
  29. #include "PrivateInterfaces.h"
  30. //////////////////////////////////////////////////////////////////////////////
  31. // Constant Declarations
  32. //////////////////////////////////////////////////////////////////////////////
  33. //////////////////////////////////////////////////////////////////////////////
  34. //++
  35. //
  36. // class CPhysicalDisk
  37. //
  38. // Description:
  39. // The class CPhysicalDisk represents a cluster storage
  40. // device.
  41. //
  42. //--
  43. //////////////////////////////////////////////////////////////////////////////
  44. class CPhysicalDisk
  45. : public IClusCfgManagedResourceInfo
  46. , public IClusCfgWbemServices
  47. , public IClusCfgSetWbemObject
  48. , public IEnumClusCfgPartitions
  49. , public IClusCfgPhysicalDiskProperties
  50. , public IClusCfgManagedResourceCfg
  51. , public IClusCfgInitialize
  52. , public IClusCfgVerifyQuorum
  53. {
  54. private:
  55. //
  56. // Private member functions and data
  57. //
  58. LONG m_cRef;
  59. LCID m_lcid;
  60. IClusCfgCallback * m_picccCallback;
  61. IWbemServices * m_pIWbemServices;
  62. BSTR m_bstrName;
  63. BSTR m_bstrDeviceID;
  64. BSTR m_bstrDescription;
  65. IUnknown * ((*m_prgPartitions)[]);
  66. ULONG m_idxNextPartition;
  67. ULONG m_ulSCSIBus;
  68. ULONG m_ulSCSITid;
  69. ULONG m_ulSCSIPort;
  70. ULONG m_ulSCSILun;
  71. ULONG m_idxEnumPartitionNext;
  72. DWORD m_dwSignature;
  73. BOOL m_fIsManaged;
  74. BOOL m_fIsManagedByDefault;
  75. BOOL m_fIsQuorumResource;
  76. BOOL m_fIsQuorumCapable; // Is this resource quorum capable
  77. BOOL m_fIsQuorumResourceMultiNodeCapable;
  78. BSTR m_bstrFriendlyName;
  79. // BSTR m_bstrFirmwareSerialNumber;
  80. DWORD m_cPartitions;
  81. DWORD m_idxDevice;
  82. BOOL m_fIsDynamicDisk;
  83. BOOL m_fIsGPTDisk;
  84. // Private constructors and destructors
  85. CPhysicalDisk( void );
  86. ~CPhysicalDisk( void );
  87. // Private copy constructor to prevent copying.
  88. CPhysicalDisk( const CPhysicalDisk & nodeSrc );
  89. // Private assignment operator to prevent copying.
  90. const CPhysicalDisk & operator = ( const CPhysicalDisk & nodeSrc );
  91. HRESULT HrInit( void );
  92. HRESULT HrGetPartitionInfo( IWbemClassObject * pDiskIn, bool * pfRetainObjectOut );
  93. HRESULT HrCreatePartitionInfo( IWbemClassObject * pPartitionIn );
  94. HRESULT HrAddPartitionToArray( IUnknown * punkIn );
  95. HRESULT HrCreateFriendlyName( void );
  96. HRESULT HrCreateFriendlyName( BSTR bstrNameIn );
  97. HRESULT HrIsPartitionGPT( IWbemClassObject * pPartitionIn );
  98. HRESULT HrIsPartitionLDM( IWbemClassObject * pPartitionIn );
  99. // HRESULT HrGetDiskFirmwareSerialNumber( void );
  100. // HRESULT HrGetDiskFirmwareVitalData( void );
  101. HRESULT HrIsClusterCapable( void );
  102. // HRESULT HrProcessMountPoints( void );
  103. // void InitDriveLetterMappings( SDriveLetterMapping * pdlmDriveLetterMappingOut );
  104. // HRESULT HrEnumMountPoints( const WCHAR * pcszRootPathIn );
  105. // HRESULT HrProcessMountedVolume( const WCHAR * pcszRootPathIn, const WCHAR * pcszMountPointIn );
  106. // HRESULT HrProcessSpindle( const WCHAR * pcszDeviceIDIn );
  107. public:
  108. //
  109. // Public, non interface methods.
  110. //
  111. static HRESULT S_HrCreateInstance( IUnknown ** ppunkOut );
  112. //
  113. // IUnknown Interface
  114. //
  115. STDMETHOD( QueryInterface )( REFIID riid, void ** ppvObject );
  116. STDMETHOD_( ULONG, AddRef )( void );
  117. STDMETHOD_( ULONG, Release )( void );
  118. //
  119. // IClusCfgWbemServices Interface
  120. //
  121. STDMETHOD( SetWbemServices )( IWbemServices * pIWbemServicesIn );
  122. //
  123. // IClusCfgInitialize Interfaces
  124. //
  125. // Register callbacks, locale id, etc.
  126. STDMETHOD( Initialize )( IUnknown * punkCallbackIn, LCID lcidIn );
  127. //
  128. // IClusCfgSetWbemObject Interface
  129. //
  130. STDMETHOD( SetWbemObject )( IWbemClassObject * pDiskIn, bool * pfRetainObjectOut );
  131. //
  132. // IClusCfgManagedResourceInfo Interface
  133. //
  134. STDMETHOD( GetUID )( BSTR * pbstrUIDOut );
  135. STDMETHOD( GetName )( BSTR * pbstrNameOut );
  136. STDMETHOD( SetName )( LPCWSTR pcszNameIn );
  137. STDMETHOD( IsManaged )( void );
  138. STDMETHOD( SetManaged )( BOOL fIsManagedIn );
  139. STDMETHOD( IsQuorumResource )( void );
  140. STDMETHOD( SetQuorumResource )( BOOL fIsQuorumResourceIn );
  141. STDMETHOD( IsQuorumCapable )( void );
  142. STDMETHOD( SetQuorumCapable )( BOOL fIsQuorumCapableIn );
  143. STDMETHOD( GetDriveLetterMappings )( SDriveLetterMapping * pdlmDriveLetterMappingOut );
  144. STDMETHOD( SetDriveLetterMappings )( SDriveLetterMapping dlmDriveLetterMappings );
  145. STDMETHOD( IsManagedByDefault )( void );
  146. STDMETHOD( SetManagedByDefault )( BOOL fIsManagedByDefaultIn );
  147. //
  148. // IEnumClusCfgPartitions Interface
  149. //
  150. STDMETHOD( Next )( ULONG cNumberRequestedIn, IClusCfgPartitionInfo ** rgpPartitionInfoOut, ULONG * pcNumberFetchedOut );
  151. STDMETHOD( Skip )( ULONG cNumberToSkipIn );
  152. STDMETHOD( Reset )( void );
  153. STDMETHOD( Clone )( IEnumClusCfgPartitions ** ppEnumClusCfgPartitionsOut );
  154. STDMETHOD( Count )( DWORD * pnCountOut );
  155. //
  156. // IClusCfgPhysicalDiskProperties Interface
  157. //
  158. STDMETHOD( IsThisLogicalDisk )( WCHAR cLogicalDiskIn );
  159. STDMETHOD( HrGetSCSIBus )( ULONG * pulSCSIBusOut );
  160. STDMETHOD( HrGetSCSIPort )( ULONG * pulSCSIPortOut );
  161. STDMETHOD( CanBeManaged )( void );
  162. STDMETHOD( HrGetDeviceID )( BSTR * pbstrDeviceIDOut );
  163. STDMETHOD( HrGetSignature )( DWORD * pdwSignatureOut );
  164. STDMETHOD( HrSetFriendlyName )( LPCWSTR pcszFriendlyNameIn );
  165. STDMETHOD( HrGetDeviceIndex )( DWORD * pidxDeviceOut );
  166. STDMETHOD( HrIsDynamicDisk )( void );
  167. STDMETHOD( HrIsGPTDisk )( void );
  168. STDMETHOD( HrGetDiskNames )( BSTR * pbstrDiskNameOut, BSTR * pbstrDeviceNameOut );
  169. //
  170. // IClusCfgManagedResourceCfg
  171. //
  172. STDMETHOD( PreCreate )( IUnknown * punkServicesIn );
  173. STDMETHOD( Create )( IUnknown * punkServicesIn );
  174. STDMETHOD( PostCreate )( IUnknown * punkServicesIn );
  175. STDMETHOD( Evict )( IUnknown * punkServicesIn );
  176. //
  177. // IClusCfgVerifyQuorum
  178. //
  179. STDMETHOD( PrepareToHostQuorumResource )( void );
  180. STDMETHOD( Cleanup )( EClusCfgCleanupReason cccrReasonIn );
  181. STDMETHOD( IsMultiNodeCapable )( void );
  182. STDMETHOD( SetMultiNodeCapable )( BOOL fMultiNodeCapableIn );
  183. }; //*** class CPhysicalDisk