5 #include "7zProperties.h"
17 STATPROPSTG StatPROPSTG
;
22 { NID::kName
, NULL
, kpidPath
, VT_BSTR
},
23 { NID::kSize
, NULL
, kpidSize
, VT_UI8
},
24 { NID::kPackInfo
, NULL
, kpidPackedSize
, VT_UI8
},
27 { 100, L
"Pack0", kpidPackedSize0
, VT_UI8
},
28 { 101, L
"Pack1", kpidPackedSize1
, VT_UI8
},
29 { 102, L
"Pack2", kpidPackedSize2
, VT_UI8
},
30 { 103, L
"Pack3", kpidPackedSize3
, VT_UI8
},
31 { 104, L
"Pack4", kpidPackedSize4
, VT_UI8
},
34 { NID::kCreationTime
, NULL
, kpidCreationTime
, VT_FILETIME
},
35 { NID::kLastWriteTime
, NULL
, kpidLastWriteTime
, VT_FILETIME
},
36 { NID::kLastAccessTime
, NULL
, kpidLastAccessTime
, VT_FILETIME
},
37 { NID::kWinAttributes
, NULL
, kpidAttributes
, VT_UI4
},
38 { NID::kStartPos
, NULL
, kpidPosition
, VT_UI4
},
41 { NID::kCRC
, NULL
, kpidCRC
, VT_UI4
},
43 { NID::kAnti
, L
"Anti", kpidIsAnti
, VT_BOOL
},
44 // { 97, NULL, kpidSolid, VT_BOOL},
46 { 98, NULL
, kpidMethod
, VT_BSTR
},
47 { 99, L
"Block", kpidBlock
, VT_UI4
}
49 // { L"ID", kpidID, VT_BSTR},
50 // { L"UnPack Version", kpidUnPackVersion, VT_UI1},
51 // { L"Host OS", kpidHostOS, VT_BSTR}
54 static const int kPropMapSize
= sizeof(kPropMap
) / sizeof(kPropMap
[0]);
56 static int FindPropInMap(UInt64 filePropID
)
58 for (int i
= 0; i
< kPropMapSize
; i
++)
59 if (kPropMap
[i
].FilePropID
== filePropID
)
64 static void CopyOneItem(CRecordVector
<UInt64
> &src
,
65 CRecordVector
<UInt64
> &dest
, UInt32 item
)
67 for (int i
= 0; i
< src
.Size(); i
++)
76 static void RemoveOneItem(CRecordVector
<UInt64
> &src
, UInt32 item
)
78 for (int i
= 0; i
< src
.Size(); i
++)
86 static void InsertToHead(CRecordVector
<UInt64
> &dest
, UInt32 item
)
88 for (int i
= 0; i
< dest
.Size(); i
++)
97 void CHandler::FillPopIDs()
99 _fileInfoPopIDs
.Clear();
102 if(_volumes
.Size() < 1)
104 const CVolume
&volume
= _volumes
.Front();
105 const CArchiveDatabaseEx
&_database
= volume
.Database
;
108 CRecordVector
<UInt64
> fileInfoPopIDs
= _database
.ArchiveInfo
.FileInfoPopIDs
;
110 RemoveOneItem(fileInfoPopIDs
, NID::kEmptyStream
);
111 RemoveOneItem(fileInfoPopIDs
, NID::kEmptyFile
);
113 CopyOneItem(fileInfoPopIDs
, _fileInfoPopIDs
, NID::kName
);
114 CopyOneItem(fileInfoPopIDs
, _fileInfoPopIDs
, NID::kAnti
);
115 CopyOneItem(fileInfoPopIDs
, _fileInfoPopIDs
, NID::kSize
);
116 CopyOneItem(fileInfoPopIDs
, _fileInfoPopIDs
, NID::kPackInfo
);
117 CopyOneItem(fileInfoPopIDs
, _fileInfoPopIDs
, NID::kCreationTime
);
118 CopyOneItem(fileInfoPopIDs
, _fileInfoPopIDs
, NID::kLastWriteTime
);
119 CopyOneItem(fileInfoPopIDs
, _fileInfoPopIDs
, NID::kLastAccessTime
);
120 CopyOneItem(fileInfoPopIDs
, _fileInfoPopIDs
, NID::kWinAttributes
);
121 CopyOneItem(fileInfoPopIDs
, _fileInfoPopIDs
, NID::kCRC
);
122 CopyOneItem(fileInfoPopIDs
, _fileInfoPopIDs
, NID::kComment
);
123 _fileInfoPopIDs
+= fileInfoPopIDs
;
126 _fileInfoPopIDs
.Add(98);
127 _fileInfoPopIDs
.Add(99);
130 _fileInfoPopIDs
.Add(100);
131 _fileInfoPopIDs
.Add(101);
132 _fileInfoPopIDs
.Add(102);
133 _fileInfoPopIDs
.Add(103);
134 _fileInfoPopIDs
.Add(104);
138 InsertToHead(_fileInfoPopIDs
, NID::kLastWriteTime
);
139 InsertToHead(_fileInfoPopIDs
, NID::kPackInfo
);
140 InsertToHead(_fileInfoPopIDs
, NID::kSize
);
141 InsertToHead(_fileInfoPopIDs
, NID::kName
);
145 STDMETHODIMP
CHandler::GetNumberOfProperties(UInt32
*numProperties
)
147 *numProperties
= _fileInfoPopIDs
.Size();
151 STDMETHODIMP
CHandler::GetPropertyInfo(UInt32 index
,
152 BSTR
*name
, PROPID
*propID
, VARTYPE
*varType
)
154 if((int)index
>= _fileInfoPopIDs
.Size())
156 int indexInMap
= FindPropInMap(_fileInfoPopIDs
[index
]);
157 if (indexInMap
== -1)
159 const STATPROPSTG
&srcItem
= kPropMap
[indexInMap
].StatPROPSTG
;
160 *propID
= srcItem
.propid
;
161 *varType
= srcItem
.vt
;