1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// DirItem.h 2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef __DIR_ITEM_H 4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define __DIR_ITEM_H 5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 6cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky#include "../../../Common/MyString.h" 7cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 8cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky#include "../../../Windows/FileFind.h" 9cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 10cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky#include "../../Common/UniqBlocks.h" 11cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 12baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../Archive/IArchive.h" 13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 14f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osakastruct CDirItemsStat 15f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka{ 16f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka UInt64 NumDirs; 17f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka UInt64 NumFiles; 18f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka UInt64 NumAltStreams; 19f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka UInt64 FilesSize; 20f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka UInt64 AltStreamsSize; 21f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka 22f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka UInt64 NumErrors; 23f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka // UInt64 GetTotalItems() const { return NumDirs + NumFiles + NumAltStreams; } 24f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka 25f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka UInt64 GetTotalBytes() const { return FilesSize + AltStreamsSize; } 26f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka 27f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka CDirItemsStat(): 28f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka NumDirs(0), 29f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka NumFiles(0), 30f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka NumAltStreams(0), 31f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka FilesSize(0), 32f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka AltStreamsSize(0), 33f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka NumErrors(0) 34f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka {} 35f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka}; 36f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka 37f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka#define INTERFACE_IDirItemsCallback(x) \ 38f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka virtual HRESULT ScanError(const FString &path, DWORD systemError) x; \ 39f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka virtual HRESULT ScanProgress(const CDirItemsStat &st, const FString &path, bool isDir) x; \ 40f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka 41f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osakastruct IDirItemsCallback 42f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka{ 43f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka INTERFACE_IDirItemsCallback(=0) 44f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka}; 45f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka 46baa3858d3f5d128a5c8466b700098109edcad5f2repo syncstruct CDirItem 47baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 48baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt64 Size; 49baa3858d3f5d128a5c8466b700098109edcad5f2repo sync FILETIME CTime; 50baa3858d3f5d128a5c8466b700098109edcad5f2repo sync FILETIME ATime; 51baa3858d3f5d128a5c8466b700098109edcad5f2repo sync FILETIME MTime; 52baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UString Name; 53cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 54cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky #if defined(_WIN32) && !defined(UNDER_CE) 55cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky // UString ShortName; 56cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky CByteBuffer ReparseData; 57cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky CByteBuffer ReparseData2; // fixed (reduced) absolute links 58cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 59cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky bool AreReparseData() const { return ReparseData.Size() != 0 || ReparseData2.Size() != 0; } 60cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky #endif 61cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 62baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt32 Attrib; 63baa3858d3f5d128a5c8466b700098109edcad5f2repo sync int PhyParent; 64baa3858d3f5d128a5c8466b700098109edcad5f2repo sync int LogParent; 65cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky int SecureIndex; 66cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 67cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky bool IsAltStream; 68baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 69cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky CDirItem(): PhyParent(-1), LogParent(-1), SecureIndex(-1), IsAltStream(false) {} 70baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool IsDir() const { return (Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0 ; } 71baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}; 72baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 73baa3858d3f5d128a5c8466b700098109edcad5f2repo syncclass CDirItems 74baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 75baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UStringVector Prefixes; 76baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CIntVector PhyParents; 77baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CIntVector LogParents; 78baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 79baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UString GetPrefixesPath(const CIntVector &parents, int index, const UString &name) const; 80cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 81f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka HRESULT EnumerateDir(int phyParent, int logParent, const FString &phyPrefix); 82cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 83baa3858d3f5d128a5c8466b700098109edcad5f2repo syncpublic: 84baa3858d3f5d128a5c8466b700098109edcad5f2repo sync CObjectVector<CDirItem> Items; 85baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 86cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky bool SymLinks; 87cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 88cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky bool ScanAltStreams; 89f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka 90f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka CDirItemsStat Stat; 91baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 92cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky #ifndef UNDER_CE 93f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka HRESULT SetLinkInfo(CDirItem &dirItem, const NWindows::NFile::NFind::CFileInfo &fi, 94cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky const FString &phyPrefix); 95cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky #endif 96baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 97cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 98cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky #if defined(_WIN32) && !defined(UNDER_CE) 99cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 100cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky CUniqBlocks SecureBlocks; 101cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky CByteBuffer TempSecureBuf; 102cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky bool _saclEnabled; 103cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky bool ReadSecure; 104cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 105f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka HRESULT AddSecurityItem(const FString &path, int &secureIndex); 106cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 107cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky #endif 108cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 109f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka IDirItemsCallback *Callback; 110f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka 111cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky CDirItems(); 112cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 113f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka void AddDirFileInfo(int phyParent, int logParent, int secureIndex, 114f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka const NWindows::NFile::NFind::CFileInfo &fi); 115f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka 116f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka HRESULT AddError(const FString &path, DWORD errorCode); 117f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka HRESULT AddError(const FString &path); 118f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka 119f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka HRESULT ScanProgress(const FString &path); 120f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka 121f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka // unsigned GetNumFolders() const { return Prefixes.Size(); } 122f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka FString GetPhyPath(unsigned index) const; 123cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky UString GetLogPath(unsigned index) const; 124cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 125cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky unsigned AddPrefix(int phyParent, int logParent, const UString &prefix); 126cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky void DeleteLastPrefix(); 127f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka 128f955a79a9fffb09826cf7547f70d08c3798a2f50Tetsuo Osaka HRESULT EnumerateItems2( 129cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky const FString &phyPrefix, 130baa3858d3f5d128a5c8466b700098109edcad5f2repo sync const UString &logPrefix, 131cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky const FStringVector &filePaths, 132cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky FStringVector *requestedPaths); 133cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky 134cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky #if defined(_WIN32) && !defined(UNDER_CE) 135cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky void FillFixedReparse(); 136cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky #endif 137baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 138baa3858d3f5d128a5c8466b700098109edcad5f2repo sync void ReserveDown(); 139baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}; 140baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 141baa3858d3f5d128a5c8466b700098109edcad5f2repo syncstruct CArcItem 142baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 143baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt64 Size; 144baa3858d3f5d128a5c8466b700098109edcad5f2repo sync FILETIME MTime; 145baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UString Name; 146baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool IsDir; 147cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky bool IsAltStream; 148baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool SizeDefined; 149baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool MTimeDefined; 150baa3858d3f5d128a5c8466b700098109edcad5f2repo sync bool Censored; 151baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UInt32 IndexInServer; 152baa3858d3f5d128a5c8466b700098109edcad5f2repo sync int TimeType; 153baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 154cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky CArcItem(): IsDir(false), IsAltStream(false), SizeDefined(false), MTimeDefined(false), Censored(false), TimeType(-1) {} 155baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}; 156baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 157baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif 158