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.

97 lines
3.5 KiB

  1. // SegDb.h : Declaration of the CSegDb
  2. #include "resource.h" // main symbols
  3. #include "Wsb.h" // Wsb Collectable Class
  4. #include "wsbdb.h"
  5. #define SEG_KEY_TYPE 1
  6. #define MEDIA_INFO_KEY_TYPE 1
  7. #define BAG_INFO_KEY_TYPE 1
  8. #define BAG_HOLE_KEY_TYPE 1
  9. #define VOL_ASSIGN_KEY_TYPE 1
  10. // NOTE:
  11. //
  12. // The macro SEG_DB_MAX_MEDIA_NAME_LEN and SEG_DB_MAX_MEDIA_BAR_CODE_LEN below were defined without parenthesis
  13. // As a result, the max size of the media record is only 711 bytes instead of 1751 as it should be !!
  14. // See Windows Bugs 407340.
  15. // It is NOT fixed since there are too many existing installations with the wrong record size...
  16. // This bug has implications around the code - look for "Windows Bugs 407340" comments throughout the HSM code
  17. //
  18. #define SEG_DB_MAX_MEDIA_NAME_LEN MAX_COMPUTERNAME_LENGTH + 128 + 2
  19. #define SEG_DB_MAX_MEDIA_BAR_CODE_LEN MAX_COMPUTERNAME_LENGTH + 128 + 2
  20. /////////////////////////////////////////////////////////////////////////////
  21. // seg
  22. class CSegDb :
  23. public CWsbDb,
  24. public ISegDb,
  25. public CComCoClass<CSegDb,&CLSID_CSegDb>
  26. {
  27. public:
  28. CSegDb() {}
  29. BEGIN_COM_MAP(CSegDb)
  30. COM_INTERFACE_ENTRY(ISegDb)
  31. COM_INTERFACE_ENTRY2(IWsbDb, ISegDb)
  32. COM_INTERFACE_ENTRY(IWsbDbPriv)
  33. COM_INTERFACE_ENTRY(IPersistStream)
  34. // COM_INTERFACE_ENTRY(IWsbTestable)
  35. END_COM_MAP()
  36. DECLARE_REGISTRY(CSegDb, _T("Seg.SegDb.1"), _T("Seg.SegDb"), IDS_SEGDB_DESC, THREADFLAGS_BOTH)
  37. DECLARE_PROTECT_FINAL_CONSTRUCT();
  38. STDMETHOD(FinalConstruct)(void);
  39. STDMETHOD(FinalRelease)(void);
  40. // IWsbTestable
  41. public:
  42. STDMETHOD(Test)(USHORT *pTestsPassed, USHORT* pTestsFailed);
  43. // IWsbDb
  44. WSB_FROM_CWSBDB;
  45. // IPersist
  46. public:
  47. STDMETHOD(GetClassID)(LPCLSID pclsid);
  48. // IPersistStream
  49. public:
  50. STDMETHOD(GetSizeMax)(ULARGE_INTEGER* pSize) {
  51. return(CWsbDb::GetSizeMax(pSize)); }
  52. STDMETHOD(Load)(IStream* pStream);
  53. STDMETHOD(Save)(IStream* pStream, BOOL clearDirty);
  54. // ISegDb
  55. public:
  56. STDMETHOD(Erase)( void );
  57. STDMETHOD(Initialize)(OLECHAR* root, IWsbDbSys* pDbSys, BOOL* pCreateFlag);
  58. STDMETHOD(BagHoleAdd)(IWsbDbSession* pDbSession, GUID bagId, LONGLONG segStartLoc,
  59. LONGLONG segLen);
  60. STDMETHOD(BagHoleFind)(IWsbDbSession* pDbSession, GUID bagId, LONGLONG segStartLoc,
  61. LONGLONG segLen, IBagHole** ppIBagHole );
  62. STDMETHOD(BagHoleSubtract)(IWsbDbSession* pDbSession, GUID bagId, LONGLONG segStartLoc,
  63. LONGLONG segLen);
  64. STDMETHOD(SegAdd)(IWsbDbSession* pDbSession, GUID bagId, LONGLONG segStartLoc,
  65. LONGLONG segLen, GUID MediaId, LONGLONG mediaStart, BOOL indirectRecord = FALSE );
  66. STDMETHOD(SegFind)(IWsbDbSession* pDbSession, GUID bagId, LONGLONG segStartLoc,
  67. LONGLONG segLen, ISegRec** ppISegRec );
  68. STDMETHOD(SegSubtract)(IWsbDbSession* pDbSession, GUID bagId, LONGLONG segStartLoc,
  69. LONGLONG SegLen);
  70. STDMETHOD(VolAssignAdd)(IWsbDbSession* pDbSession, GUID bagId, LONGLONG segStartLoc,
  71. LONGLONG segLen, GUID VolId);
  72. STDMETHOD(VolAssignFind)(IWsbDbSession* pDbSession, GUID bagId, LONGLONG segStartLoc,
  73. LONGLONG segLen, IVolAssign** ppIVolAssign );
  74. STDMETHOD(VolAssignSubtract)(IWsbDbSession* pDbSession, GUID bagId, LONGLONG segStartLoc,
  75. LONGLONG segLen);
  76. private:
  77. LONG m_value;
  78. };