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.

185 lines
6.7 KiB

  1. #ifndef _FSAITEM_
  2. #define _FSAITEM_
  3. /*++
  4. 1998 Seagate Software, Inc. All rights reserved.
  5. Module Name:
  6. fsaitem.cpp
  7. Abstract:
  8. This class contains represents a scan item (i.e. file or directory) for NTFS 5.0.
  9. Author:
  10. Chuck Bardeen [cbardeen] 1-Dec-1996
  11. Revision History:
  12. --*/
  13. #include "resource.h" // main symbols
  14. #include "wsb.h"
  15. #include "job.h"
  16. #include "mover.h"
  17. #include "fsa.h"
  18. #include "fsaprv.h"
  19. /*++
  20. Class Name:
  21. CFsaScanItem
  22. Class Description:
  23. --*/
  24. class CFsaScanItem :
  25. public CComObjectRoot,
  26. public IFsaScanItem,
  27. public IFsaScanItemPriv,
  28. public CComCoClass<CFsaScanItem,&CLSID_CFsaScanItemNTFS>
  29. {
  30. public:
  31. CFsaScanItem() {}
  32. BEGIN_COM_MAP(CFsaScanItem)
  33. COM_INTERFACE_ENTRY(IFsaScanItem)
  34. COM_INTERFACE_ENTRY(IFsaScanItemPriv)
  35. // COM_INTERFACE_ENTRY(IWsbCollectable)
  36. // COM_INTERFACE_ENTRY(IWsbTestable)
  37. END_COM_MAP()
  38. DECLARE_REGISTRY_RESOURCEID(IDR_FsaScanItem)
  39. // CComObjectRoot
  40. public:
  41. HRESULT FinalConstruct(void);
  42. void FinalRelease(void);
  43. // IWsbCollectable
  44. public:
  45. STDMETHOD(CompareTo)(IUnknown* pUnknown, SHORT* pResult);
  46. // IWsbTestable
  47. STDMETHOD(Test)(USHORT *passed, USHORT* failed);
  48. // IFsaScanItemPriv
  49. public:
  50. STDMETHOD(FindFirst)(IFsaResource* pResource, OLECHAR* path, IHsmSession* pSession);
  51. STDMETHOD(FindFirstInRPIndex)(IFsaResource* pResource, IHsmSession* pSession);
  52. STDMETHOD(FindFirstInDbIndex)(IFsaResource* pResource, IHsmSession* pSession);
  53. STDMETHOD(FindNext)(void);
  54. STDMETHOD(FindNextInRPIndex)(void);
  55. STDMETHOD(FindNextInDbIndex)(void);
  56. STDMETHOD(TruncateInternal)(LONGLONG offset, LONGLONG size);
  57. STDMETHOD(VerifyInternal)(LONGLONG offset, LONGLONG size, LONGLONG usn1, LONGLONG usn2);
  58. // IFsaScanItem
  59. public:
  60. STDMETHOD(CheckIfSparse)(LONGLONG offset, LONGLONG size);
  61. STDMETHOD(CompareToIScanItem)(IFsaScanItem* pScanItem, SHORT* pResult);
  62. STDMETHOD(CompareToPathAndName)(OLECHAR* path, OLECHAR* name, SHORT* pResult);
  63. STDMETHOD(Copy)(OLECHAR* dest, BOOL retainHierarcy, BOOL expandPlaceholders, BOOL overwriteExisting);
  64. STDMETHOD(CreateLocalStream)(IStream **ppStream);
  65. STDMETHOD(CreatePlaceholder)(LONGLONG offset, LONGLONG size, FSA_PLACEHOLDER pPlaceholder, BOOL checkUsn, LONGLONG usn, LONGLONG *pUsn);
  66. STDMETHOD(Delete)(void);
  67. STDMETHOD(DeletePlaceholder)(LONGLONG offset, LONGLONG size);
  68. STDMETHOD(FindFirstPlaceholder)(LONGLONG* pOffset, LONGLONG* pSize, FSA_PLACEHOLDER* pPlaceholder);
  69. STDMETHOD(FindNextPlaceholder)(LONGLONG* pOffset, LONGLONG* pSize, FSA_PLACEHOLDER* pPlaceholder);
  70. STDMETHOD(GetAccessTime)(FILETIME* pTime);
  71. STDMETHOD(GetFileId)(LONGLONG* pFileId);
  72. STDMETHOD(GetFileUsn)(LONGLONG* pFileUsn);
  73. STDMETHOD(GetFullPathAndName)(OLECHAR* prependix, OLECHAR *appendix, OLECHAR** pPath, ULONG bufferSize);
  74. STDMETHOD(GetGroup)(OLECHAR** pOwner, ULONG bufferSize);
  75. STDMETHOD(GetLogicalSize)(LONGLONG* pSize);
  76. STDMETHOD(GetModifyTime)(FILETIME* pTime);
  77. STDMETHOD(GetOwner)(OLECHAR** pOwner, ULONG bufferSize);
  78. STDMETHOD(GetName)(OLECHAR** pName, ULONG bufferSize);
  79. STDMETHOD(GetPath)(OLECHAR** pPath, ULONG bufferSize);
  80. STDMETHOD(GetPathForFind)(OLECHAR* searchName, OLECHAR** pPath, ULONG bufferSize);
  81. STDMETHOD(GetPathAndName)(OLECHAR* appendix, OLECHAR** pPath, ULONG bufferSize);
  82. STDMETHOD(GetPhysicalSize)(LONGLONG* pSize);
  83. STDMETHOD(GetPlaceholder)(LONGLONG offset, LONGLONG size, FSA_PLACEHOLDER* pPlaceholder);
  84. STDMETHOD(GetSession)(IHsmSession** ppSession);
  85. STDMETHOD(GetUncPathAndName)(OLECHAR* prependix, OLECHAR *appendix, OLECHAR** pPath, ULONG bufferSize);
  86. STDMETHOD(GetVersionId)(LONGLONG* pId);
  87. STDMETHOD(HasExtendedAttributes)(void);
  88. STDMETHOD(IsALink)(void);
  89. STDMETHOD(IsAParent)(void);
  90. STDMETHOD(IsARelativeParent)(void);
  91. STDMETHOD(IsCompressed)(void);
  92. STDMETHOD(IsDeleteOK)(IFsaPostIt *pPostIt);
  93. STDMETHOD(IsEncrypted)(void);
  94. STDMETHOD(IsHidden)(void);
  95. STDMETHOD(IsGroupMemberOf)(OLECHAR* group);
  96. STDMETHOD(IsManageable)(LONGLONG offset, LONGLONG size);
  97. STDMETHOD(IsManaged)(LONGLONG offset, LONGLONG size);
  98. STDMETHOD(IsMbit)(void);
  99. STDMETHOD(IsOffline)(void);
  100. STDMETHOD(IsMigrateOK)(IFsaPostIt *pPostIt);
  101. STDMETHOD(IsOwnerMemberOf)(OLECHAR* group);
  102. STDMETHOD(IsPremigrated)(LONGLONG offset, LONGLONG size);
  103. STDMETHOD(IsReadOnly)(void);
  104. STDMETHOD(IsRecallOK)(IFsaPostIt *pPostIt);
  105. STDMETHOD(IsSparse)(void);
  106. STDMETHOD(IsSystem)(void);
  107. STDMETHOD(IsTotallySparse)(void);
  108. STDMETHOD(IsTruncated)(LONGLONG offset, LONGLONG size);
  109. STDMETHOD(Manage)(LONGLONG offset, LONGLONG size, GUID storagePoolId, BOOL truncate);
  110. STDMETHOD(Move)(OLECHAR* dest, BOOL retainHierarcy, BOOL expandPlaceholders, BOOL overwriteExisting);
  111. STDMETHOD(Recall)(LONGLONG offset, LONGLONG size, BOOL deletePlaceholder);
  112. STDMETHOD(Recycle)(void);
  113. STDMETHOD(Truncate)(LONGLONG offset, LONGLONG size);
  114. STDMETHOD(Unmanage)(LONGLONG offset, LONGLONG size);
  115. STDMETHOD(Validate)(LONGLONG offset, LONGLONG size);
  116. STDMETHOD(PrepareForManage)(LONGLONG offset, LONGLONG size);
  117. STDMETHOD(Verify)(LONGLONG offset, LONGLONG size);
  118. STDMETHOD(TruncateValidated)(LONGLONG offset, LONGLONG size);
  119. // Private functions
  120. private:
  121. STDMETHOD(CheckUsnJournalForChanges)(LONGLONG StartUsn, LONGLONG StopUsn, BOOL *pChanged);
  122. STDMETHOD(GetPremigratedUsn)(LONGLONG* pFileUsn);
  123. STDMETHOD(GetFromRPIndex)(BOOL first);
  124. STDMETHOD(GetFromDbIndex)(BOOL first);
  125. STDMETHOD(CalculateCurrentCRCAndUSN)(LONGLONG offset,LONGLONG size, ULONG *pCurrentCRC, LONGLONG *pUsn);
  126. STDMETHOD(CalculateCurrentCRCInternal)(HANDLE handle, LONGLONG offset,LONGLONG size, ULONG *pCurrentCRC);
  127. STDMETHOD(MakeReadWrite)(void);
  128. STDMETHOD(RestoreAttributes)(void);
  129. protected:
  130. CComPtr<IFsaResource> m_pResource;
  131. CWsbStringPtr m_path;
  132. CComPtr<IHsmSession> m_pSession;
  133. HANDLE m_handle;
  134. WIN32_FIND_DATA m_findData;
  135. BOOL m_gotPhysicalSize;
  136. ULARGE_INTEGER m_physicalSize;
  137. BOOL m_gotPlaceholder;
  138. FSA_PLACEHOLDER m_placeholder;
  139. BOOL m_changedAttributes;
  140. ULONG m_originalAttributes;
  141. CComPtr<IDataMover> m_pDataMover;
  142. CComPtr<IStream> m_pStream;
  143. // Only used for Reparse Point Index scan:
  144. HANDLE m_handleRPI;
  145. // Used by :Verify
  146. HANDLE m_handleVerify;
  147. // Only used for Database scan
  148. CComPtr<IFsaUnmanageDb> m_pUnmanageDb;
  149. CComPtr<IFsaUnmanageRec> m_pUnmanageRec;
  150. CComPtr<IWsbDbSession> m_pDbSession;
  151. };
  152. #endif // _FSAITEM_