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.

224 lines
5.7 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. STDMETHOD(GetMaxMediaCapacity)(
  102. IN REFGUID fromMediaSet,
  103. OUT LONGLONG *pMaxCapacity);
  104. STDMETHOD(DisableAndEject)(
  105. IN IRmsCartridge *pCart,
  106. IN DWORD dwOptions = RMS_NONE);
  107. // CRmsNTMS - these may go public
  108. private:
  109. HRESULT findFirstNtmsObject(
  110. IN DWORD objectType,
  111. IN REFGUID containerId,
  112. IN WCHAR *objectName,
  113. IN REFGUID objectId,
  114. OUT HANDLE *hFindObject,
  115. OUT LPNTMS_OBJECTINFORMATION pFindObjectData);
  116. HRESULT findNextNtmsObject(
  117. IN HANDLE hFindObject,
  118. OUT LPNTMS_OBJECTINFORMATION pFindObjectData);
  119. HRESULT findCloseNtmsObject(
  120. IN HANDLE hFindObject);
  121. HRESULT getNtmsSupportFromRegistry(
  122. OUT DWORD *pNtmsSupport);
  123. HRESULT reportNtmsObjectInformation(
  124. IN LPNTMS_OBJECTINFORMATION pObjectInfo);
  125. HRESULT beginSession(void);
  126. HRESULT endSession(void);
  127. HRESULT waitUntilReady(void);
  128. HRESULT waitForScratchPool(void);
  129. HRESULT createMediaPools(void);
  130. HRESULT replicateScratchMediaPool(IN REFGUID rootPoolId);
  131. HRESULT createMediaPoolForEveryMediaType(IN REFGUID rootPoolId);
  132. HRESULT isReady(void);
  133. HRESULT setPoolDACL(
  134. IN OUT NTMS_GUID *pPoolId,
  135. IN DWORD subAuthority,
  136. IN DWORD action,
  137. IN DWORD mask);
  138. HRESULT EnsureAllSidesNotAllocated(
  139. IN REFGUID physicalMediaId);
  140. private:
  141. enum { // Class specific constants:
  142. //
  143. Version = 1, // Class version, this should be
  144. // incremented each time the
  145. // the class definition changes.
  146. };
  147. HANDLE m_SessionHandle;
  148. BOOL m_IsRmsConfiguredForNTMS;
  149. BOOL m_IsNTMSRegistered;
  150. DWORD m_NotificationWaitTime; // Milliseconds to wait for an object notification
  151. DWORD m_AllocateWaitTime; // Milliseconds to wait for a media allocation
  152. DWORD m_MountWaitTime; // Milliseconds to wait for a mount
  153. DWORD m_RequestWaitTime; // Milliseconds to wait for a request
  154. LPNTMS_GUID m_pLibGuids; // Libraries which may have HSM medias (collected during initialization)
  155. DWORD m_dwNofLibs;
  156. static HRESULT storageMediaTypeToRmsMedia(
  157. IN NTMS_MEDIATYPEINFORMATION *pMediaTypeInfo,
  158. OUT RmsMedia *pTranslatedMediaType);
  159. HRESULT changeState( IN LONG newState );
  160. // Thread routines
  161. public:
  162. static DWORD WINAPI InitializationThread(
  163. IN LPVOID pv);
  164. HRESULT InitializeInAnotherThread(void);
  165. };
  166. #endif // _RMSNTMS_