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.

216 lines
5.3 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved
  3. Module Name:
  4. RmsNTMS.h
  5. Abstract:
  6. Declaration of the CRmsNTMS class
  7. Author:
  8. Brian Dodd [brian] 15-Nov-1996
  9. Revision History:
  10. --*/
  11. #ifndef _RMSNTMS_
  12. #define _RMSNTMS_
  13. #include "ntmsapi.h"
  14. #include "resource.h" // main symbols
  15. #include "RmsObjct.h" // CRmsComObject
  16. /*++
  17. Class Name:
  18. CRmsNTMS
  19. Class Description:
  20. A CRmsNTMS represents...
  21. --*/
  22. class CRmsNTMS :
  23. public CComDualImpl<IRmsNTMS, &IID_IRmsNTMS, &LIBID_RMSLib>,
  24. public CRmsComObject,
  25. public CComObjectRoot,
  26. public IConnectionPointContainerImpl<CRmsNTMS>,
  27. public IConnectionPointImpl<CRmsNTMS, &IID_IRmsSinkEveryEvent, CComDynamicUnkArray>,
  28. public CComCoClass<CRmsNTMS,&CLSID_CRmsNTMS>
  29. {
  30. public:
  31. CRmsNTMS() {}
  32. BEGIN_COM_MAP(CRmsNTMS)
  33. COM_INTERFACE_ENTRY2(IDispatch, IRmsNTMS)
  34. COM_INTERFACE_ENTRY(IRmsNTMS)
  35. COM_INTERFACE_ENTRY(IRmsComObject)
  36. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  37. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  38. END_COM_MAP()
  39. DECLARE_REGISTRY_RESOURCEID(IDR_RmsNTMS)
  40. DECLARE_PROTECT_FINAL_CONSTRUCT()
  41. BEGIN_CONNECTION_POINT_MAP(CRmsNTMS)
  42. CONNECTION_POINT_ENTRY(IID_IRmsSinkEveryEvent)
  43. END_CONNECTION_POINT_MAP()
  44. // CComObjectRoot
  45. public:
  46. STDMETHOD(FinalConstruct)(void);
  47. STDMETHOD(FinalRelease)(void);
  48. // IRmsNTMS
  49. public:
  50. STDMETHOD(IsInstalled)(void);
  51. STDMETHOD(Initialize)(void);
  52. STDMETHOD(Allocate)(
  53. IN REFGUID fromMediaSet,
  54. IN REFGUID prevSideId,
  55. IN OUT LONGLONG *pFreeSpace,
  56. IN BSTR displayName,
  57. IN DWORD dwOptions,
  58. OUT IRmsCartridge **ppCartridge);
  59. STDMETHOD(Mount)(
  60. IN IRmsCartridge *pCart,
  61. OUT IRmsDrive **ppDrive,
  62. IN DWORD dwOptions = RMS_NONE,
  63. IN DWORD threadId = 0);
  64. STDMETHOD(Dismount)(
  65. IN IRmsCartridge *pCart,
  66. IN DWORD dwOptions = RMS_NONE);
  67. STDMETHOD(Deallocate)(
  68. IN IRmsCartridge *pCart);
  69. STDMETHOD(UpdateOmidInfo)(
  70. IN REFGUID cartId,
  71. IN BYTE *pBuffer,
  72. IN LONG size,
  73. IN LONG type);
  74. STDMETHOD(GetBlockSize)(
  75. IN REFGUID cartId,
  76. OUT LONG *pBlockSize);
  77. STDMETHOD(SetBlockSize)(
  78. IN REFGUID cartId,
  79. IN LONG blockSize);
  80. STDMETHOD(ExportDatabase)(void);
  81. STDMETHOD(FindCartridge)(
  82. IN REFGUID cartId,
  83. OUT IRmsCartridge **ppCartridge);
  84. STDMETHOD(Suspend)(void);
  85. STDMETHOD(Resume)(void);
  86. STDMETHOD(IsMediaCopySupported)(
  87. IN REFGUID mediaPoolId);
  88. STDMETHOD(UpdateDrive)(
  89. IN IRmsDrive *pDrive);
  90. STDMETHOD(GetNofAvailableDrives)(
  91. OUT DWORD *pdwNofDrives
  92. );
  93. STDMETHOD(CheckSecondSide)(
  94. IN REFGUID firstSideId,
  95. OUT BOOL *pbValid,
  96. OUT GUID *pSecondSideId
  97. );
  98. STDMETHOD(DismountAll)(
  99. IN REFGUID fromMediaSet,
  100. IN DWORD dwOptions = RMS_NONE);
  101. // CRmsNTMS - these may go public
  102. private:
  103. HRESULT findFirstNtmsObject(
  104. IN DWORD objectType,
  105. IN REFGUID containerId,
  106. IN WCHAR *objectName,
  107. IN REFGUID objectId,
  108. OUT HANDLE *hFindObject,
  109. OUT LPNTMS_OBJECTINFORMATION pFindObjectData);
  110. HRESULT findNextNtmsObject(
  111. IN HANDLE hFindObject,
  112. OUT LPNTMS_OBJECTINFORMATION pFindObjectData);
  113. HRESULT findCloseNtmsObject(
  114. IN HANDLE hFindObject);
  115. HRESULT getNtmsSupportFromRegistry(
  116. OUT DWORD *pNtmsSupport);
  117. HRESULT reportNtmsObjectInformation(
  118. IN LPNTMS_OBJECTINFORMATION pObjectInfo);
  119. HRESULT beginSession(void);
  120. HRESULT endSession(void);
  121. HRESULT waitUntilReady(void);
  122. HRESULT waitForScratchPool(void);
  123. HRESULT createMediaPools(void);
  124. HRESULT replicateScratchMediaPool(IN REFGUID rootPoolId);
  125. HRESULT createMediaPoolForEveryMediaType(IN REFGUID rootPoolId);
  126. HRESULT isReady(void);
  127. HRESULT setPoolDACL(
  128. IN OUT NTMS_GUID *pPoolId,
  129. IN DWORD subAuthority,
  130. IN DWORD action,
  131. IN DWORD mask);
  132. HRESULT EnsureAllSidesNotAllocated(
  133. IN REFGUID physicalMediaId);
  134. private:
  135. enum { // Class specific constants:
  136. //
  137. Version = 1, // Class version, this should be
  138. // incremented each time the
  139. // the class definition changes.
  140. };
  141. HANDLE m_SessionHandle;
  142. BOOL m_IsRmsConfiguredForNTMS;
  143. BOOL m_IsNTMSRegistered;
  144. DWORD m_NotificationWaitTime; // Milliseconds to wait for an object notification
  145. DWORD m_AllocateWaitTime; // Milliseconds to wait for a media allocation
  146. DWORD m_MountWaitTime; // Milliseconds to wait for a mount
  147. DWORD m_RequestWaitTime; // Milliseconds to wait for a request
  148. LPNTMS_GUID m_pLibGuids; // Libraries which may have HSM medias (collected during initialization)
  149. DWORD m_dwNofLibs;
  150. static HRESULT storageMediaTypeToRmsMedia(
  151. IN NTMS_MEDIATYPEINFORMATION *pMediaTypeInfo,
  152. OUT RmsMedia *pTranslatedMediaType);
  153. HRESULT changeState( IN LONG newState );
  154. // Thread routines
  155. public:
  156. static DWORD WINAPI InitializationThread(
  157. IN LPVOID pv);
  158. HRESULT InitializeInAnotherThread(void);
  159. };
  160. #endif // _RMSNTMS_