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.

228 lines
6.3 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000-2001 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. // Interfaces:
  43. // IClusCfgManagedResourceInfo
  44. // IClusCfgWbemServices
  45. // IClusCfgSetWbemObject
  46. // IEnumClusCfgPartitions
  47. // IClusCfgPhysicalDiskProperties
  48. // IClusCfgManagedResourceCfg
  49. // IClusCfgInitialize
  50. //--
  51. //////////////////////////////////////////////////////////////////////////////
  52. class CPhysicalDisk
  53. : public IClusCfgManagedResourceInfo
  54. , public IClusCfgWbemServices
  55. , public IClusCfgSetWbemObject
  56. , public IEnumClusCfgPartitions
  57. , public IClusCfgPhysicalDiskProperties
  58. , public IClusCfgManagedResourceCfg
  59. , public IClusCfgInitialize
  60. {
  61. private:
  62. //
  63. // Private member functions and data
  64. //
  65. LONG m_cRef;
  66. LCID m_lcid;
  67. IClusCfgCallback * m_picccCallback;
  68. IWbemServices * m_pIWbemServices;
  69. BSTR m_bstrName;
  70. BSTR m_bstrDeviceID;
  71. BSTR m_bstrDescription;
  72. IUnknown * ((*m_prgPartitions)[]);
  73. ULONG m_idxNextPartition;
  74. ULONG m_ulSCSIBus;
  75. ULONG m_ulSCSITid;
  76. ULONG m_ulSCSIPort;
  77. ULONG m_ulSCSILun;
  78. ULONG m_idxEnumPartitionNext;
  79. DWORD m_dwSignature;
  80. BOOL m_fIsManaged:1;
  81. BOOL m_fIsQuorumDevice:1;
  82. BOOL m_fIsQuorumCapable:1;
  83. BOOL m_fIsQuorumJoinable:1;
  84. BSTR m_bstrFriendlyName;
  85. BSTR m_bstrFirmwareSerialNumber;
  86. DWORD m_cPartitions;
  87. // Private constructors and destructors
  88. CPhysicalDisk( void );
  89. ~CPhysicalDisk( void );
  90. // Private copy constructor to prevent copying.
  91. CPhysicalDisk( const CPhysicalDisk & nodeSrc );
  92. // Private assignment operator to prevent copying.
  93. const CPhysicalDisk & operator = ( const CPhysicalDisk & nodeSrc );
  94. HRESULT HrInit( void );
  95. HRESULT HrGetPartitionInfo( IWbemClassObject * pDiskIn, bool * pfRetainObjectOut );
  96. HRESULT HrCreatePartitionInfo( IWbemClassObject * pPartitionIn );
  97. HRESULT HrAddPartitionToArray( IUnknown * punkIn );
  98. HRESULT HrCreateFriendlyName( void );
  99. HRESULT HrCreateFriendlyName( BSTR bstrNameIn );
  100. HRESULT HrIsPartitionGPT( IWbemClassObject * pPartitionIn );
  101. HRESULT HrIsPartitionLDM( IWbemClassObject * pPartitionIn );
  102. HRESULT HrGetDiskFirmwareSerialNumber( void );
  103. HRESULT HrGetDiskFirmwareVitalData( void );
  104. HRESULT HrIsClusterCapable( void );
  105. public:
  106. //
  107. // Public, non interface methods.
  108. //
  109. static HRESULT S_HrCreateInstance( IUnknown ** ppunkOut );
  110. //
  111. // IUnknown Interface
  112. //
  113. STDMETHOD( QueryInterface )( REFIID riid, void ** ppvObject );
  114. STDMETHOD_( ULONG, AddRef )( void );
  115. STDMETHOD_( ULONG, Release )( void );
  116. //
  117. // IClusCfgWbemServices Interface
  118. //
  119. STDMETHOD( SetWbemServices )( IWbemServices * pIWbemServicesIn );
  120. //
  121. // IClusCfgInitialize Interfaces
  122. //
  123. // Register callbacks, locale id, etc.
  124. STDMETHOD( Initialize )( IUnknown * punkCallbackIn, LCID lcidIn );
  125. //
  126. // IClusCfgSetWbemObject Interface
  127. //
  128. STDMETHOD( SetWbemObject )( IWbemClassObject * pDiskIn, bool * pfRetainObjectOut );
  129. //
  130. // IClusCfgManagedResourceInfo Interface
  131. //
  132. STDMETHOD( GetUID )( BSTR * pbstrUIDOut );
  133. STDMETHOD( GetName )( BSTR * pbstrNameOut );
  134. STDMETHOD( SetName )( LPCWSTR pcszNameIn );
  135. STDMETHOD( IsManaged )( void );
  136. STDMETHOD( SetManaged )( BOOL fIsManagedIn );
  137. STDMETHOD( IsQuorumDevice )( void );
  138. STDMETHOD( SetQuorumedDevice )( BOOL fIsQuorumDeviceIn );
  139. STDMETHOD( IsQuorumCapable )( void );
  140. STDMETHOD( GetDriveLetterMappings )( SDriveLetterMapping * pdlmDriveLetterMappingOut );
  141. STDMETHOD( SetDriveLetterMappings )( SDriveLetterMapping dlmDriveLetterMappings );
  142. STDMETHOD( IsDeviceJoinable )( void );
  143. STDMETHOD( SetDeviceJoinable )( BOOL fIsJoinableIn );
  144. //
  145. // IEnumClusCfgPartitions Interface
  146. //
  147. STDMETHOD( Next )( ULONG cNumberRequestedIn, IClusCfgPartitionInfo ** rgpPartitionInfoOut, ULONG * pcNumberFetchedOut );
  148. STDMETHOD( Skip )( ULONG cNumberToSkipIn );
  149. STDMETHOD( Reset )( void );
  150. STDMETHOD( Clone )( IEnumClusCfgPartitions ** ppEnumClusCfgPartitionsOut );
  151. STDMETHOD( Count )( DWORD * pnCountOut );
  152. //
  153. // IClusCfgPhysicalDiskProperties Interface
  154. //
  155. STDMETHOD( IsThisLogicalDisk )( WCHAR cLogicalDiskIn );
  156. STDMETHOD( HrGetSCSIBus )( ULONG * pulSCSIBusOut );
  157. STDMETHOD( HrGetSCSIPort )( ULONG * pulSCSIPortOut );
  158. STDMETHOD( CanBeManaged )( void );
  159. STDMETHOD( HrGetDeviceID )( BSTR * pbstrDeviceIDOut );
  160. STDMETHOD( HrGetSignature )( DWORD * pdwSignatureOut );
  161. STDMETHOD( HrSetFriendlyName )( LPCWSTR pcszFriendlyNameIn );
  162. //
  163. // IClusCfgManagedResourceCfg
  164. //
  165. STDMETHOD( PreCreate )( IUnknown * punkServicesIn );
  166. STDMETHOD( Create )( IUnknown * punkServicesIn );
  167. STDMETHOD( PostCreate )( IUnknown * punkServicesIn );
  168. STDMETHOD( Evict )( IUnknown * punkServicesIn );
  169. }; //*** Class CPhysicalDisk