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.

258 lines
7.2 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. Ca.h
  5. Abstract:
  6. Cartridge node implementation. Represents a piece of media.
  7. Author:
  8. Rohde Wakefield [rohde] 12-Aug-1997
  9. Revision History:
  10. --*/
  11. #ifndef _CAR_H
  12. #define _CAR_H
  13. #include "saknodei.h"
  14. #include "PrCar.h"
  15. // Forward declaration
  16. // class CMediaInfoObject;
  17. class CPropCartStatus;
  18. class CPropCartCopies;
  19. class CPropCartRecover;
  20. class CRecreateChooseCopy;
  21. ///////////////////////////////////////////////////////////////////////////////////
  22. //
  23. //
  24. // Property Sheet container class for media
  25. //
  26. // Media information object
  27. class CMediaInfoObject
  28. {
  29. // Construction
  30. public:
  31. CMediaInfoObject();
  32. ~CMediaInfoObject();
  33. protected:
  34. private:
  35. CComPtr<IWsbDb> m_pDb;
  36. CComPtr<IWsbDbSession> m_pDbSession;
  37. CComPtr<IMediaInfo> m_pMediaInfo;
  38. CComPtr<IHsmServer> m_pHsmServer;
  39. CComPtr<IRmsServer> m_pRmsServer;
  40. public:
  41. HRESULT Initialize( GUID nMediaId, IHsmServer *pHsmServer, IRmsServer *pRmsServer );
  42. HRESULT First( );
  43. HRESULT Next( );
  44. HRESULT DeleteCopy( int Copy );
  45. HRESULT RecreateMaster( );
  46. public:
  47. HRESULT IsCopyInSync( INT Copy );
  48. HRESULT DoesMasterExist( );
  49. HRESULT DoesCopyExist( INT Copy );
  50. HRESULT IsViewable( BOOL ConsiderInactiveCopies );
  51. GUID m_MediaId;
  52. GUID m_RmsIdMaster;
  53. CCopySetInfo m_CopyInfo[HSMADMIN_MAX_COPY_SETS];
  54. CString m_Name,
  55. m_Description;
  56. CString m_MasterName,
  57. m_MasterDescription;
  58. HRESULT m_LastHr;
  59. HSM_JOB_MEDIA_TYPE m_Type;
  60. LONGLONG m_FreeSpace,
  61. m_Capacity;
  62. SHORT m_NextDataSet;
  63. FILETIME m_Modify;
  64. BOOL m_ReadOnly,
  65. m_Recreating,
  66. m_Disabled;
  67. SHORT m_LastGoodNextDataSet;
  68. USHORT m_NumMediaCopies;
  69. // Helper functions
  70. private:
  71. HRESULT InternalGetInfo();
  72. friend class CRecreateChooseCopy;
  73. };
  74. class CUiCarSheet : public CSakPropertySheet
  75. {
  76. public:
  77. CUiCarSheet( ) { };
  78. HRESULT AddPropertyPages( );
  79. HRESULT InitSheet(
  80. RS_NOTIFY_HANDLE handle,
  81. IUnknown* pUnkPropSheetCallback,
  82. CSakNode* pSakNode,
  83. ISakSnapAsk* pSakSnapAsk,
  84. IEnumGUID* pEnumObjectId,
  85. IEnumUnknown* pEnumUnkNode);
  86. HRESULT GetNumMediaCopies( USHORT *pNumMediaCopies );
  87. HRESULT GetMediaId( GUID *pMediaId );
  88. private:
  89. USHORT m_pNumMediaCopies;
  90. GUID m_mediaId;
  91. CPropCartStatus *m_pPropPageStatus;
  92. CPropCartCopies *m_pPropPageCopies;
  93. CPropCartRecover *m_pPropPageRecover;
  94. public:
  95. HRESULT OnPropertyChange( RS_NOTIFY_HANDLE hNotifyHandle );
  96. };
  97. class ATL_NO_VTABLE CUiCar :
  98. public CSakNodeImpl<CUiCar>,
  99. public CComCoClass<CUiCar,&CLSID_CUiCar>,
  100. public CComDualImpl<ICartridge, &IID_ICartridge, &LIBID_HSMADMINLib>
  101. {
  102. public:
  103. // constructor/destructor
  104. CUiCar(void) {};
  105. BEGIN_COM_MAP(CUiCar)
  106. COM_INTERFACE_ENTRY2(IDispatch, ICartridge)
  107. COM_INTERFACE_ENTRY2(ISakNodeProp, ICartridge)
  108. COM_INTERFACE_ENTRY(ISakNode)
  109. COM_INTERFACE_ENTRY(IDataObject)
  110. END_COM_MAP()
  111. DECLARE_REGISTRY_RESOURCEID(IDR_CUiCar)
  112. // for multiple-inheritance, forward all base implementations to CSakNode.
  113. FORWARD_BASEHSM_IMPLS
  114. HRESULT FinalConstruct( void );
  115. void FinalRelease( void );
  116. public:
  117. STDMETHOD( InvokeCommand ) ( SHORT sCmd, IDataObject *pDataObject );
  118. STDMETHOD( GetContextMenu ) ( BOOL bMultiSelect, HMENU *phMenu );
  119. STDMETHOD( AddPropertyPages ) ( RS_NOTIFY_HANDLE handle, IUnknown* pUnkPropSheetCallback, IEnumGUID* pEnumObjectId, IEnumUnknown *pEnumUnkNode );
  120. // ISakNode methods
  121. STDMETHOD( InitNode ) ( ISakSnapAsk* pSakSnapAsk, IUnknown* pHsmObj, ISakNode* pParent );
  122. STDMETHOD( RefreshObject ) ();
  123. STDMETHOD( OnToolbarButtonClick ) ( IDataObject *pDataObject, long cmdId );
  124. STDMETHOD( GetResultIcon ) ( IN BOOL bOK, OUT int* pIconIndex );
  125. // ICartridge methods
  126. STDMETHOD( get_MediaTypeP ) ( BSTR * pszValue );
  127. STDMETHOD( get_CapacityP ) ( BSTR * pszValue );
  128. STDMETHOD( get_CapacityP_SortKey ) ( BSTR * pszValue );
  129. STDMETHOD( get_FreeSpaceP ) ( BSTR * pszValue );
  130. STDMETHOD( get_FreeSpaceP_SortKey ) ( BSTR * pszValue );
  131. STDMETHOD( get_StatusP ) ( BSTR * pszValue );
  132. STDMETHOD( get_StatusP_SortKey ) ( BSTR * pszValue );
  133. STDMETHOD( get_CopySet1P ) ( BSTR * pszValue );
  134. STDMETHOD( get_CopySet2P ) ( BSTR * pszValue );
  135. STDMETHOD( get_CopySet3P ) ( BSTR * pszValue );
  136. STDMETHOD( get_CopySet1P_SortKey ) ( BSTR * pszValue );
  137. STDMETHOD( get_CopySet2P_SortKey ) ( BSTR * pszValue );
  138. STDMETHOD( get_CopySet3P_SortKey ) ( BSTR * pszValue );
  139. // Interal Copy set access functions
  140. HRESULT GetCopySetP ( int CopySet, BSTR * pszValue );
  141. // private store of media info
  142. private:
  143. GUID m_RmsIdMaster;
  144. HSM_JOB_MEDIA_TYPE m_Type;
  145. LONGLONG m_FreeSpace,
  146. m_Capacity;
  147. HRESULT m_LastHr;
  148. BOOL m_ReadOnly;
  149. BOOL m_Recreating;
  150. CString m_MasterName;
  151. FILETIME m_Modify;
  152. SHORT m_NextDataSet;
  153. SHORT m_LastGoodNextDataSet;
  154. BOOL m_Disabled;
  155. CCopySetInfo m_CopyInfo[HSMADMIN_MAX_COPY_SETS];
  156. HRESULT ShowCarProperties (IDataObject *pDataObject, int initialPage);
  157. // static, class-wide variables
  158. static INT m_nResultIconD;
  159. };
  160. /////////////////////////////////////////////////////////////////////////////
  161. /////////////////////////////////////////////////////////////////////////////
  162. // CRecreateChooseCopy dialog
  163. class CRecreateChooseCopy : public CDialog
  164. {
  165. // Construction
  166. public:
  167. CRecreateChooseCopy( CMediaInfoObject * pMio, CWnd* pParent = NULL); // standard constructor
  168. // Dialog Data
  169. //{{AFX_DATA(CRecreateChooseCopy)
  170. enum { IDD = IDD_DLG_RECREATE_CHOOSE_COPY };
  171. CListCtrl m_List;
  172. //}}AFX_DATA
  173. // Overrides
  174. // ClassWizard generated virtual function overrides
  175. //{{AFX_VIRTUAL(CRecreateChooseCopy)
  176. protected:
  177. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  178. //}}AFX_VIRTUAL
  179. // Implementation
  180. CMediaInfoObject * m_pMio;
  181. SHORT m_CopyToUse;
  182. int m_ColCopy;
  183. int m_ColName;
  184. int m_ColDate;
  185. int m_ColStatus;
  186. public:
  187. SHORT CopyToUse( void );
  188. protected:
  189. // Generated message map functions
  190. //{{AFX_MSG(CRecreateChooseCopy)
  191. afx_msg void OnClickList(NMHDR* pNMHDR, LRESULT* pResult);
  192. virtual BOOL OnInitDialog();
  193. virtual void OnOK();
  194. //}}AFX_MSG
  195. DECLARE_MESSAGE_MAP()
  196. };
  197. #endif