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