• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // DirItem.h
2 
3 #ifndef __DIR_ITEM_H
4 #define __DIR_ITEM_H
5 
6 #include "../../../Common/MyString.h"
7 
8 #include "../../../Windows/FileFind.h"
9 
10 #include "../../Common/UniqBlocks.h"
11 
12 #include "../../Archive/IArchive.h"
13 
14 struct CDirItem
15 {
16   UInt64 Size;
17   FILETIME CTime;
18   FILETIME ATime;
19   FILETIME MTime;
20   UString Name;
21 
22   #if defined(_WIN32) && !defined(UNDER_CE)
23   // UString ShortName;
24   CByteBuffer ReparseData;
25   CByteBuffer ReparseData2; // fixed (reduced) absolute links
26 
AreReparseDataCDirItem27   bool AreReparseData() const { return ReparseData.Size() != 0 || ReparseData2.Size() != 0; }
28   #endif
29 
30   UInt32 Attrib;
31   int PhyParent;
32   int LogParent;
33   int SecureIndex;
34 
35   bool IsAltStream;
36 
CDirItemCDirItem37   CDirItem(): PhyParent(-1), LogParent(-1), SecureIndex(-1), IsAltStream(false) {}
IsDirCDirItem38   bool IsDir() const { return (Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0 ; }
39 };
40 
41 class CDirItems
42 {
43   UStringVector Prefixes;
44   CIntVector PhyParents;
45   CIntVector LogParents;
46 
47   UString GetPrefixesPath(const CIntVector &parents, int index, const UString &name) const;
48 
49   void EnumerateDir(int phyParent, int logParent, const FString &phyPrefix);
50 
51 public:
52   CObjectVector<CDirItem> Items;
53 
54   bool SymLinks;
55 
56   bool ScanAltStreams;
57   FStringVector ErrorPaths;
58   CRecordVector<DWORD> ErrorCodes;
59   UInt64 TotalSize;
60 
61 
62   #ifndef UNDER_CE
63   void SetLinkInfo(CDirItem &dirItem, const NWindows::NFile::NFind::CFileInfo &fi,
64       const FString &phyPrefix);
65   #endif
66 
AddError(const FString & path,DWORD errorCode)67   void AddError(const FString &path, DWORD errorCode)
68   {
69     ErrorCodes.Add(errorCode);
70     ErrorPaths.Add(path);
71   }
72 
AddError(const FString & path)73   void AddError(const FString &path)
74   {
75     AddError(path, ::GetLastError());
76   }
77 
78   #if defined(_WIN32) && !defined(UNDER_CE)
79 
80   CUniqBlocks SecureBlocks;
81   CByteBuffer TempSecureBuf;
82   bool _saclEnabled;
83   bool ReadSecure;
84 
85   void AddSecurityItem(const FString &path, int &secureIndex);
86 
87   #endif
88 
89   CDirItems();
90 
GetNumFolders()91   int GetNumFolders() const { return Prefixes.Size(); }
92   UString GetPhyPath(unsigned index) const;
93   UString GetLogPath(unsigned index) const;
94 
95   unsigned AddPrefix(int phyParent, int logParent, const UString &prefix);
96   void DeleteLastPrefix();
97   void EnumerateItems2(
98     const FString &phyPrefix,
99     const UString &logPrefix,
100     const FStringVector &filePaths,
101     FStringVector *requestedPaths);
102 
103   #if defined(_WIN32) && !defined(UNDER_CE)
104   void FillFixedReparse();
105   #endif
106 
107   void ReserveDown();
108 };
109 
110 struct CArcItem
111 {
112   UInt64 Size;
113   FILETIME MTime;
114   UString Name;
115   bool IsDir;
116   bool IsAltStream;
117   bool SizeDefined;
118   bool MTimeDefined;
119   bool Censored;
120   UInt32 IndexInServer;
121   int TimeType;
122 
CArcItemCArcItem123   CArcItem(): IsDir(false), IsAltStream(false), SizeDefined(false), MTimeDefined(false), Censored(false), TimeType(-1) {}
124 };
125 
126 #endif
127