1370b324cSopenharmony_ci// IArchive.h
2370b324cSopenharmony_ci
3370b324cSopenharmony_ci#ifndef ZIP7_INC_IARCHIVE_H
4370b324cSopenharmony_ci#define ZIP7_INC_IARCHIVE_H
5370b324cSopenharmony_ci
6370b324cSopenharmony_ci#include "../IProgress.h"
7370b324cSopenharmony_ci#include "../IStream.h"
8370b324cSopenharmony_ci#include "../PropID.h"
9370b324cSopenharmony_ci
10370b324cSopenharmony_ciZ7_PURE_INTERFACES_BEGIN
11370b324cSopenharmony_ci
12370b324cSopenharmony_ci
13370b324cSopenharmony_ci#define Z7_IFACE_CONSTR_ARCHIVE_SUB(i, base, n) \
14370b324cSopenharmony_ci  Z7_DECL_IFACE_7ZIP_SUB(i, base, 6, n) \
15370b324cSopenharmony_ci  { Z7_IFACE_COM7_PURE(i) };
16370b324cSopenharmony_ci
17370b324cSopenharmony_ci#define Z7_IFACE_CONSTR_ARCHIVE(i, n) \
18370b324cSopenharmony_ci  Z7_IFACE_CONSTR_ARCHIVE_SUB(i, IUnknown, n)
19370b324cSopenharmony_ci
20370b324cSopenharmony_ci/*
21370b324cSopenharmony_ciHow the function in 7-Zip returns object for output parameter via pointer
22370b324cSopenharmony_ci
23370b324cSopenharmony_ci1) The caller sets the value of variable before function call:
24370b324cSopenharmony_ci  PROPVARIANT  :  vt = VT_EMPTY
25370b324cSopenharmony_ci  BSTR         :  NULL
26370b324cSopenharmony_ci  IUnknown* and derived interfaces  :  NULL
27370b324cSopenharmony_ci  another scalar types  :  any non-initialized value is allowed
28370b324cSopenharmony_ci
29370b324cSopenharmony_ci2) The callee in current 7-Zip code now can free input object for output parameter:
30370b324cSopenharmony_ci  PROPVARIANT   : the callee calls VariantClear(propvaiant_ptr) for input
31370b324cSopenharmony_ci                  value stored in variable
32370b324cSopenharmony_ci  another types : the callee ignores stored value.
33370b324cSopenharmony_ci
34370b324cSopenharmony_ci3) The callee writes new value to variable for output parameter and
35370b324cSopenharmony_ci  returns execution to caller.
36370b324cSopenharmony_ci
37370b324cSopenharmony_ci4) The caller must free or release object returned by the callee:
38370b324cSopenharmony_ci  PROPVARIANT   : VariantClear(&propvaiant)
39370b324cSopenharmony_ci  BSTR          : SysFreeString(bstr)
40370b324cSopenharmony_ci  IUnknown* and derived interfaces  :  if (ptr) ptr->Relase()
41370b324cSopenharmony_ci*/
42370b324cSopenharmony_ci
43370b324cSopenharmony_ci
44370b324cSopenharmony_cinamespace NFileTimeType
45370b324cSopenharmony_ci{
46370b324cSopenharmony_ci  enum EEnum
47370b324cSopenharmony_ci  {
48370b324cSopenharmony_ci    kNotDefined = -1,
49370b324cSopenharmony_ci    kWindows = 0,
50370b324cSopenharmony_ci    kUnix,
51370b324cSopenharmony_ci    kDOS,
52370b324cSopenharmony_ci    k1ns
53370b324cSopenharmony_ci  };
54370b324cSopenharmony_ci}
55370b324cSopenharmony_ci
56370b324cSopenharmony_cinamespace NArcInfoFlags
57370b324cSopenharmony_ci{
58370b324cSopenharmony_ci  const UInt32 kKeepName        = 1 << 0;  // keep name of file in archive name
59370b324cSopenharmony_ci  const UInt32 kAltStreams      = 1 << 1;  // the handler supports alt streams
60370b324cSopenharmony_ci  const UInt32 kNtSecure        = 1 << 2;  // the handler supports NT security
61370b324cSopenharmony_ci  const UInt32 kFindSignature   = 1 << 3;  // the handler can find start of archive
62370b324cSopenharmony_ci  const UInt32 kMultiSignature  = 1 << 4;  // there are several signatures
63370b324cSopenharmony_ci  const UInt32 kUseGlobalOffset = 1 << 5;  // the seek position of stream must be set as global offset
64370b324cSopenharmony_ci  const UInt32 kStartOpen       = 1 << 6;  // call handler for each start position
65370b324cSopenharmony_ci  const UInt32 kPureStartOpen   = 1 << 7;  // call handler only for start of file
66370b324cSopenharmony_ci  const UInt32 kBackwardOpen    = 1 << 8;  // archive can be open backward
67370b324cSopenharmony_ci  const UInt32 kPreArc          = 1 << 9;  // such archive can be stored before real archive (like SFX stub)
68370b324cSopenharmony_ci  const UInt32 kSymLinks        = 1 << 10; // the handler supports symbolic links
69370b324cSopenharmony_ci  const UInt32 kHardLinks       = 1 << 11; // the handler supports hard links
70370b324cSopenharmony_ci  const UInt32 kByExtOnlyOpen   = 1 << 12; // call handler only if file extension matches
71370b324cSopenharmony_ci  const UInt32 kHashHandler     = 1 << 13; // the handler contains the hashes (checksums)
72370b324cSopenharmony_ci  const UInt32 kCTime           = 1 << 14;
73370b324cSopenharmony_ci  const UInt32 kCTime_Default   = 1 << 15;
74370b324cSopenharmony_ci  const UInt32 kATime           = 1 << 16;
75370b324cSopenharmony_ci  const UInt32 kATime_Default   = 1 << 17;
76370b324cSopenharmony_ci  const UInt32 kMTime           = 1 << 18;
77370b324cSopenharmony_ci  const UInt32 kMTime_Default   = 1 << 19;
78370b324cSopenharmony_ci  // const UInt32 kTTime_Reserved         = 1 << 20;
79370b324cSopenharmony_ci  // const UInt32 kTTime_Reserved_Default = 1 << 21;
80370b324cSopenharmony_ci}
81370b324cSopenharmony_ci
82370b324cSopenharmony_cinamespace NArcInfoTimeFlags
83370b324cSopenharmony_ci{
84370b324cSopenharmony_ci  const unsigned kTime_Prec_Mask_bit_index = 0;
85370b324cSopenharmony_ci  const unsigned kTime_Prec_Mask_num_bits = 26;
86370b324cSopenharmony_ci
87370b324cSopenharmony_ci  const unsigned kTime_Prec_Default_bit_index = 27;
88370b324cSopenharmony_ci  const unsigned kTime_Prec_Default_num_bits = 5;
89370b324cSopenharmony_ci}
90370b324cSopenharmony_ci
91370b324cSopenharmony_ci#define TIME_PREC_TO_ARC_FLAGS_MASK(v) \
92370b324cSopenharmony_ci  ((UInt32)1 << (NArcInfoTimeFlags::kTime_Prec_Mask_bit_index + (v)))
93370b324cSopenharmony_ci
94370b324cSopenharmony_ci#define TIME_PREC_TO_ARC_FLAGS_TIME_DEFAULT(v) \
95370b324cSopenharmony_ci  ((UInt32)(v) << NArcInfoTimeFlags::kTime_Prec_Default_bit_index)
96370b324cSopenharmony_ci
97370b324cSopenharmony_cinamespace NArchive
98370b324cSopenharmony_ci{
99370b324cSopenharmony_ci  namespace NHandlerPropID
100370b324cSopenharmony_ci  {
101370b324cSopenharmony_ci    enum
102370b324cSopenharmony_ci    {
103370b324cSopenharmony_ci      kName = 0,        // VT_BSTR
104370b324cSopenharmony_ci      kClassID,         // binary GUID in VT_BSTR
105370b324cSopenharmony_ci      kExtension,       // VT_BSTR
106370b324cSopenharmony_ci      kAddExtension,    // VT_BSTR
107370b324cSopenharmony_ci      kUpdate,          // VT_BOOL
108370b324cSopenharmony_ci      kKeepName,        // VT_BOOL
109370b324cSopenharmony_ci      kSignature,       // binary in VT_BSTR
110370b324cSopenharmony_ci      kMultiSignature,  // binary in VT_BSTR
111370b324cSopenharmony_ci      kSignatureOffset, // VT_UI4
112370b324cSopenharmony_ci      kAltStreams,      // VT_BOOL
113370b324cSopenharmony_ci      kNtSecure,        // VT_BOOL
114370b324cSopenharmony_ci      kFlags,           // VT_UI4
115370b324cSopenharmony_ci      kTimeFlags        // VT_UI4
116370b324cSopenharmony_ci    };
117370b324cSopenharmony_ci  }
118370b324cSopenharmony_ci
119370b324cSopenharmony_ci  namespace NExtract
120370b324cSopenharmony_ci  {
121370b324cSopenharmony_ci    namespace NAskMode
122370b324cSopenharmony_ci    {
123370b324cSopenharmony_ci      enum
124370b324cSopenharmony_ci      {
125370b324cSopenharmony_ci        kExtract = 0,
126370b324cSopenharmony_ci        kTest,
127370b324cSopenharmony_ci        kSkip,
128370b324cSopenharmony_ci        kReadExternal
129370b324cSopenharmony_ci      };
130370b324cSopenharmony_ci    }
131370b324cSopenharmony_ci
132370b324cSopenharmony_ci    namespace NOperationResult
133370b324cSopenharmony_ci    {
134370b324cSopenharmony_ci      enum
135370b324cSopenharmony_ci      {
136370b324cSopenharmony_ci        kOK = 0,
137370b324cSopenharmony_ci        kUnsupportedMethod,
138370b324cSopenharmony_ci        kDataError,
139370b324cSopenharmony_ci        kCRCError,
140370b324cSopenharmony_ci        kUnavailable,
141370b324cSopenharmony_ci        kUnexpectedEnd,
142370b324cSopenharmony_ci        kDataAfterEnd,
143370b324cSopenharmony_ci        kIsNotArc,
144370b324cSopenharmony_ci        kHeadersError,
145370b324cSopenharmony_ci        kWrongPassword
146370b324cSopenharmony_ci        // , kMemError
147370b324cSopenharmony_ci      };
148370b324cSopenharmony_ci    }
149370b324cSopenharmony_ci  }
150370b324cSopenharmony_ci
151370b324cSopenharmony_ci  namespace NEventIndexType
152370b324cSopenharmony_ci  {
153370b324cSopenharmony_ci    enum
154370b324cSopenharmony_ci    {
155370b324cSopenharmony_ci      kNoIndex = 0,
156370b324cSopenharmony_ci      kInArcIndex,
157370b324cSopenharmony_ci      kBlockIndex,
158370b324cSopenharmony_ci      kOutArcIndex
159370b324cSopenharmony_ci      // kArcProp
160370b324cSopenharmony_ci    };
161370b324cSopenharmony_ci  }
162370b324cSopenharmony_ci
163370b324cSopenharmony_ci  namespace NUpdate
164370b324cSopenharmony_ci  {
165370b324cSopenharmony_ci    namespace NOperationResult
166370b324cSopenharmony_ci    {
167370b324cSopenharmony_ci      enum
168370b324cSopenharmony_ci      {
169370b324cSopenharmony_ci        kOK = 0
170370b324cSopenharmony_ci        // kError = 1,
171370b324cSopenharmony_ci        // kError_FileChanged
172370b324cSopenharmony_ci      };
173370b324cSopenharmony_ci    }
174370b324cSopenharmony_ci  }
175370b324cSopenharmony_ci}
176370b324cSopenharmony_ci
177370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveOpenCallback(x) \
178370b324cSopenharmony_ci  x(SetTotal(const UInt64 *files, const UInt64 *bytes)) \
179370b324cSopenharmony_ci  x(SetCompleted(const UInt64 *files, const UInt64 *bytes)) \
180370b324cSopenharmony_ci
181370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveOpenCallback, 0x10)
182370b324cSopenharmony_ci
183370b324cSopenharmony_ci/*
184370b324cSopenharmony_ciIArchiveExtractCallback::
185370b324cSopenharmony_ci
186370b324cSopenharmony_ci7-Zip doesn't call IArchiveExtractCallback functions
187370b324cSopenharmony_ci  GetStream()
188370b324cSopenharmony_ci  PrepareOperation()
189370b324cSopenharmony_ci  SetOperationResult()
190370b324cSopenharmony_cifrom different threads simultaneously.
191370b324cSopenharmony_ciBut 7-Zip can call functions for IProgress or ICompressProgressInfo functions
192370b324cSopenharmony_cifrom another threads simultaneously with calls for IArchiveExtractCallback interface.
193370b324cSopenharmony_ci
194370b324cSopenharmony_ciIArchiveExtractCallback::GetStream()
195370b324cSopenharmony_ci  UInt32 index - index of item in Archive
196370b324cSopenharmony_ci  Int32 askExtractMode  (Extract::NAskMode)
197370b324cSopenharmony_ci    if (askMode != NExtract::NAskMode::kExtract)
198370b324cSopenharmony_ci    {
199370b324cSopenharmony_ci      then the callee doesn't write data to stream: (*outStream == NULL)
200370b324cSopenharmony_ci    }
201370b324cSopenharmony_ci
202370b324cSopenharmony_ci  Out:
203370b324cSopenharmony_ci      (*outStream == NULL) - for directories
204370b324cSopenharmony_ci      (*outStream == NULL) - if link (hard link or symbolic link) was created
205370b324cSopenharmony_ci      if (*outStream == NULL && askMode == NExtract::NAskMode::kExtract)
206370b324cSopenharmony_ci      {
207370b324cSopenharmony_ci        then the caller must skip extracting of that file.
208370b324cSopenharmony_ci      }
209370b324cSopenharmony_ci
210370b324cSopenharmony_ci  returns:
211370b324cSopenharmony_ci    S_OK     : OK
212370b324cSopenharmony_ci    S_FALSE  : data error (for decoders)
213370b324cSopenharmony_ci
214370b324cSopenharmony_ciif (IProgress::SetTotal() was called)
215370b324cSopenharmony_ci{
216370b324cSopenharmony_ci  IProgress::SetCompleted(completeValue) uses
217370b324cSopenharmony_ci    packSize   - for some stream formats (xz, gz, bz2, lzma, z, ppmd).
218370b324cSopenharmony_ci    unpackSize - for another formats.
219370b324cSopenharmony_ci}
220370b324cSopenharmony_cielse
221370b324cSopenharmony_ci{
222370b324cSopenharmony_ci  IProgress::SetCompleted(completeValue) uses packSize.
223370b324cSopenharmony_ci}
224370b324cSopenharmony_ci
225370b324cSopenharmony_ciSetOperationResult()
226370b324cSopenharmony_ci  7-Zip calls SetOperationResult at the end of extracting,
227370b324cSopenharmony_ci  so the callee can close the file, set attributes, timestamps and security information.
228370b324cSopenharmony_ci
229370b324cSopenharmony_ci  Int32 opRes (NExtract::NOperationResult)
230370b324cSopenharmony_ci*/
231370b324cSopenharmony_ci
232370b324cSopenharmony_ci// INTERFACE_IProgress(x)
233370b324cSopenharmony_ci
234370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveExtractCallback(x) \
235370b324cSopenharmony_ci  x(GetStream(UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode)) \
236370b324cSopenharmony_ci  x(PrepareOperation(Int32 askExtractMode)) \
237370b324cSopenharmony_ci  x(SetOperationResult(Int32 opRes)) \
238370b324cSopenharmony_ci
239370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE_SUB(IArchiveExtractCallback, IProgress, 0x20)
240370b324cSopenharmony_ci
241370b324cSopenharmony_ci
242370b324cSopenharmony_ci
243370b324cSopenharmony_ci/*
244370b324cSopenharmony_civ23:
245370b324cSopenharmony_ciIArchiveExtractCallbackMessage2 can be requested from IArchiveExtractCallback object
246370b324cSopenharmony_ci  by Extract() or UpdateItems() functions to report about extracting errors
247370b324cSopenharmony_ciReportExtractResult()
248370b324cSopenharmony_ci  UInt32 indexType (NEventIndexType)
249370b324cSopenharmony_ci  UInt32 index
250370b324cSopenharmony_ci  Int32 opRes (NExtract::NOperationResult)
251370b324cSopenharmony_ci*/
252370b324cSopenharmony_ci/*
253370b324cSopenharmony_cibefore v23:
254370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveExtractCallbackMessage(x) \
255370b324cSopenharmony_ci  x(ReportExtractResult(UInt32 indexType, UInt32 index, Int32 opRes))
256370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE_SUB(IArchiveExtractCallbackMessage, IProgress, 0x21)
257370b324cSopenharmony_ci*/
258370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveExtractCallbackMessage2(x) \
259370b324cSopenharmony_ci  x(ReportExtractResult(UInt32 indexType, UInt32 index, Int32 opRes))
260370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveExtractCallbackMessage2, 0x22)
261370b324cSopenharmony_ci
262370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveOpenVolumeCallback(x) \
263370b324cSopenharmony_ci  x(GetProperty(PROPID propID, PROPVARIANT *value)) \
264370b324cSopenharmony_ci  x(GetStream(const wchar_t *name, IInStream **inStream))
265370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveOpenVolumeCallback, 0x30)
266370b324cSopenharmony_ci
267370b324cSopenharmony_ci
268370b324cSopenharmony_ci#define Z7_IFACEM_IInArchiveGetStream(x) \
269370b324cSopenharmony_ci  x(GetStream(UInt32 index, ISequentialInStream **stream))
270370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IInArchiveGetStream, 0x40)
271370b324cSopenharmony_ci
272370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveOpenSetSubArchiveName(x) \
273370b324cSopenharmony_ci  x(SetSubArchiveName(const wchar_t *name))
274370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveOpenSetSubArchiveName, 0x50)
275370b324cSopenharmony_ci
276370b324cSopenharmony_ci
277370b324cSopenharmony_ci/*
278370b324cSopenharmony_ciIInArchive::Open
279370b324cSopenharmony_ci    stream
280370b324cSopenharmony_ci      if (kUseGlobalOffset), stream current position can be non 0.
281370b324cSopenharmony_ci      if (!kUseGlobalOffset), stream current position is 0.
282370b324cSopenharmony_ci    if (maxCheckStartPosition == NULL), the handler can try to search archive start in stream
283370b324cSopenharmony_ci    if (*maxCheckStartPosition == 0), the handler must check only current position as archive start
284370b324cSopenharmony_ci
285370b324cSopenharmony_ciIInArchive::Extract:
286370b324cSopenharmony_ci  indices must be sorted
287370b324cSopenharmony_ci  numItems = (UInt32)(Int32)-1 = 0xFFFFFFFF means "all files"
288370b324cSopenharmony_ci  testMode != 0 means "test files without writing to outStream"
289370b324cSopenharmony_ci
290370b324cSopenharmony_ciIInArchive::GetArchiveProperty:
291370b324cSopenharmony_ci  kpidOffset  - start offset of archive.
292370b324cSopenharmony_ci      VT_EMPTY : means offset = 0.
293370b324cSopenharmony_ci      VT_UI4, VT_UI8, VT_I8 : result offset; negative values is allowed
294370b324cSopenharmony_ci  kpidPhySize - size of archive. VT_EMPTY means unknown size.
295370b324cSopenharmony_ci    kpidPhySize is allowed to be larger than file size. In that case it must show
296370b324cSopenharmony_ci    supposed size.
297370b324cSopenharmony_ci
298370b324cSopenharmony_ci  kpidIsDeleted:
299370b324cSopenharmony_ci  kpidIsAltStream:
300370b324cSopenharmony_ci  kpidIsAux:
301370b324cSopenharmony_ci  kpidINode:
302370b324cSopenharmony_ci    must return VARIANT_TRUE (VT_BOOL), if archive can support that property in GetProperty.
303370b324cSopenharmony_ci
304370b324cSopenharmony_ci
305370b324cSopenharmony_ciNotes:
306370b324cSopenharmony_ci  Don't call IInArchive functions for same IInArchive object from different threads simultaneously.
307370b324cSopenharmony_ci  Some IInArchive handlers will work incorrectly in that case.
308370b324cSopenharmony_ci*/
309370b324cSopenharmony_ci
310370b324cSopenharmony_ci#if defined(_MSC_VER) && !defined(__clang__)
311370b324cSopenharmony_ci  #define MY_NO_THROW_DECL_ONLY  Z7_COM7F_E
312370b324cSopenharmony_ci#else
313370b324cSopenharmony_ci  #define MY_NO_THROW_DECL_ONLY
314370b324cSopenharmony_ci#endif
315370b324cSopenharmony_ci
316370b324cSopenharmony_ci#define Z7_IFACEM_IInArchive(x) \
317370b324cSopenharmony_ci  x(Open(IInStream *stream, const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *openCallback)) \
318370b324cSopenharmony_ci  x(Close()) \
319370b324cSopenharmony_ci  x(GetNumberOfItems(UInt32 *numItems)) \
320370b324cSopenharmony_ci  x(GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)) \
321370b324cSopenharmony_ci  x(Extract(const UInt32 *indices, UInt32 numItems, Int32 testMode, IArchiveExtractCallback *extractCallback)) \
322370b324cSopenharmony_ci  x(GetArchiveProperty(PROPID propID, PROPVARIANT *value)) \
323370b324cSopenharmony_ci  x(GetNumberOfProperties(UInt32 *numProps)) \
324370b324cSopenharmony_ci  x(GetPropertyInfo(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType)) \
325370b324cSopenharmony_ci  x(GetNumberOfArchiveProperties(UInt32 *numProps)) \
326370b324cSopenharmony_ci  x(GetArchivePropertyInfo(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType)) \
327370b324cSopenharmony_ci
328370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IInArchive, 0x60)
329370b324cSopenharmony_ci
330370b324cSopenharmony_cinamespace NParentType
331370b324cSopenharmony_ci{
332370b324cSopenharmony_ci  enum
333370b324cSopenharmony_ci  {
334370b324cSopenharmony_ci    kDir = 0,
335370b324cSopenharmony_ci    kAltStream
336370b324cSopenharmony_ci  };
337370b324cSopenharmony_ci}
338370b324cSopenharmony_ci
339370b324cSopenharmony_cinamespace NPropDataType
340370b324cSopenharmony_ci{
341370b324cSopenharmony_ci  const UInt32 kMask_ZeroEnd   = 1 << 4;
342370b324cSopenharmony_ci  // const UInt32 kMask_BigEndian = 1 << 5;
343370b324cSopenharmony_ci  const UInt32 kMask_Utf       = 1 << 6;
344370b324cSopenharmony_ci  const UInt32 kMask_Utf8  = kMask_Utf | 0;
345370b324cSopenharmony_ci  const UInt32 kMask_Utf16 = kMask_Utf | 1;
346370b324cSopenharmony_ci  // const UInt32 kMask_Utf32 = kMask_Utf | 2;
347370b324cSopenharmony_ci
348370b324cSopenharmony_ci  const UInt32 kNotDefined = 0;
349370b324cSopenharmony_ci  const UInt32 kRaw = 1;
350370b324cSopenharmony_ci
351370b324cSopenharmony_ci  const UInt32 kUtf8z  = kMask_Utf8  | kMask_ZeroEnd;
352370b324cSopenharmony_ci  const UInt32 kUtf16z = kMask_Utf16 | kMask_ZeroEnd;
353370b324cSopenharmony_ci}
354370b324cSopenharmony_ci
355370b324cSopenharmony_ci// UTF string (pointer to wchar_t) with zero end and little-endian.
356370b324cSopenharmony_ci#define PROP_DATA_TYPE_wchar_t_PTR_Z_LE ((NPropDataType::kMask_Utf | NPropDataType::kMask_ZeroEnd) + (sizeof(wchar_t) >> 1))
357370b324cSopenharmony_ci
358370b324cSopenharmony_ci
359370b324cSopenharmony_ci/*
360370b324cSopenharmony_ciGetRawProp:
361370b324cSopenharmony_ci  Result:
362370b324cSopenharmony_ci    S_OK - even if property is not set
363370b324cSopenharmony_ci*/
364370b324cSopenharmony_ci
365370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveGetRawProps(x) \
366370b324cSopenharmony_ci  x(GetParent(UInt32 index, UInt32 *parent, UInt32 *parentType)) \
367370b324cSopenharmony_ci  x(GetRawProp(UInt32 index, PROPID propID, const void **data, UInt32 *dataSize, UInt32 *propType)) \
368370b324cSopenharmony_ci  x(GetNumRawProps(UInt32 *numProps)) \
369370b324cSopenharmony_ci  x(GetRawPropInfo(UInt32 index, BSTR *name, PROPID *propID))
370370b324cSopenharmony_ci
371370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveGetRawProps, 0x70)
372370b324cSopenharmony_ci
373370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveGetRootProps(x) \
374370b324cSopenharmony_ci  x(GetRootProp(PROPID propID, PROPVARIANT *value)) \
375370b324cSopenharmony_ci  x(GetRootRawProp(PROPID propID, const void **data, UInt32 *dataSize, UInt32 *propType)) \
376370b324cSopenharmony_ci
377370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveGetRootProps, 0x71)
378370b324cSopenharmony_ci
379370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveOpenSeq(x) \
380370b324cSopenharmony_ci  x(OpenSeq(ISequentialInStream *stream)) \
381370b324cSopenharmony_ci
382370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveOpenSeq, 0x61)
383370b324cSopenharmony_ci
384370b324cSopenharmony_ci/*
385370b324cSopenharmony_ci  OpenForSize
386370b324cSopenharmony_ci  Result:
387370b324cSopenharmony_ci    S_FALSE - is not archive
388370b324cSopenharmony_ci    ? - DATA error
389370b324cSopenharmony_ci*/
390370b324cSopenharmony_ci
391370b324cSopenharmony_ci/*
392370b324cSopenharmony_ciconst UInt32 kOpenFlags_RealPhySize = 1 << 0;
393370b324cSopenharmony_ciconst UInt32 kOpenFlags_NoSeek = 1 << 1;
394370b324cSopenharmony_ci// const UInt32 kOpenFlags_BeforeExtract = 1 << 2;
395370b324cSopenharmony_ci*/
396370b324cSopenharmony_ci
397370b324cSopenharmony_ci/*
398370b324cSopenharmony_ciFlags:
399370b324cSopenharmony_ci   0 - opens archive with IInStream, if IInStream interface is supported
400370b324cSopenharmony_ci     - if phySize is not available, it doesn't try to make full parse to get phySize
401370b324cSopenharmony_ci   kOpenFlags_NoSeek -  ArcOpen2 function doesn't use IInStream interface, even if it's available
402370b324cSopenharmony_ci   kOpenFlags_RealPhySize - the handler will try to get PhySize, even if it requires full decompression for file
403370b324cSopenharmony_ci
404370b324cSopenharmony_ci  if handler is not allowed to use IInStream and the flag kOpenFlags_RealPhySize is not specified,
405370b324cSopenharmony_ci  the handler can return S_OK, but it doesn't check even Signature.
406370b324cSopenharmony_ci  So next Extract can be called for that sequential stream.
407370b324cSopenharmony_ci*/
408370b324cSopenharmony_ci/*
409370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveOpen2(x) \
410370b324cSopenharmony_ci  x(ArcOpen2(ISequentialInStream *stream, UInt32 flags, IArchiveOpenCallback *openCallback))
411370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveOpen2, 0x62)
412370b324cSopenharmony_ci*/
413370b324cSopenharmony_ci
414370b324cSopenharmony_ci// ---------- UPDATE ----------
415370b324cSopenharmony_ci
416370b324cSopenharmony_ci/*
417370b324cSopenharmony_ciGetUpdateItemInfo outs:
418370b324cSopenharmony_ci*newData  *newProps
419370b324cSopenharmony_ci   0        0      - Copy data and properties from archive
420370b324cSopenharmony_ci   0        1      - Copy data from archive, request new properties
421370b324cSopenharmony_ci   1        0      - that combination is unused now
422370b324cSopenharmony_ci   1        1      - Request new data and new properties. It can be used even for folders
423370b324cSopenharmony_ci
424370b324cSopenharmony_ci  indexInArchive = -1 if there is no item in archive, or if it doesn't matter.
425370b324cSopenharmony_ci
426370b324cSopenharmony_ci
427370b324cSopenharmony_ciGetStream out:
428370b324cSopenharmony_ci  Result:
429370b324cSopenharmony_ci    S_OK:
430370b324cSopenharmony_ci      (*inStream == NULL) - only for directories
431370b324cSopenharmony_ci                          - the bug was fixed in 9.33: (*Stream == NULL) was in case of anti-file
432370b324cSopenharmony_ci      (*inStream != NULL) - for any file, even for empty file or anti-file
433370b324cSopenharmony_ci    S_FALSE - skip that file (don't add item to archive) - (client code can't open stream of that file by some reason)
434370b324cSopenharmony_ci      (*inStream == NULL)
435370b324cSopenharmony_ci
436370b324cSopenharmony_ciThe order of calling for hard links:
437370b324cSopenharmony_ci  - GetStream()
438370b324cSopenharmony_ci  - GetProperty(kpidHardLink)
439370b324cSopenharmony_ci
440370b324cSopenharmony_ciSetOperationResult()
441370b324cSopenharmony_ci  Int32 opRes (NExtract::NOperationResult::kOK)
442370b324cSopenharmony_ci*/
443370b324cSopenharmony_ci
444370b324cSopenharmony_ci// INTERFACE_IProgress(x)
445370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveUpdateCallback(x) \
446370b324cSopenharmony_ci  x(GetUpdateItemInfo(UInt32 index, Int32 *newData, Int32 *newProps, UInt32 *indexInArchive)) \
447370b324cSopenharmony_ci  x(GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)) \
448370b324cSopenharmony_ci  x(GetStream(UInt32 index, ISequentialInStream **inStream)) \
449370b324cSopenharmony_ci  x(SetOperationResult(Int32 operationResult)) \
450370b324cSopenharmony_ci
451370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE_SUB(IArchiveUpdateCallback, IProgress, 0x80)
452370b324cSopenharmony_ci
453370b324cSopenharmony_ci// INTERFACE_IArchiveUpdateCallback(x)
454370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveUpdateCallback2(x) \
455370b324cSopenharmony_ci  x(GetVolumeSize(UInt32 index, UInt64 *size)) \
456370b324cSopenharmony_ci  x(GetVolumeStream(UInt32 index, ISequentialOutStream **volumeStream)) \
457370b324cSopenharmony_ci
458370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE_SUB(IArchiveUpdateCallback2, IArchiveUpdateCallback, 0x82)
459370b324cSopenharmony_ci
460370b324cSopenharmony_cinamespace NUpdateNotifyOp
461370b324cSopenharmony_ci{
462370b324cSopenharmony_ci  enum
463370b324cSopenharmony_ci  {
464370b324cSopenharmony_ci    kAdd = 0,
465370b324cSopenharmony_ci    kUpdate,
466370b324cSopenharmony_ci    kAnalyze,
467370b324cSopenharmony_ci    kReplicate,
468370b324cSopenharmony_ci    kRepack,
469370b324cSopenharmony_ci    kSkip,
470370b324cSopenharmony_ci    kDelete,
471370b324cSopenharmony_ci    kHeader,
472370b324cSopenharmony_ci    kHashRead,
473370b324cSopenharmony_ci    kInFileChanged
474370b324cSopenharmony_ci    // , kOpFinished
475370b324cSopenharmony_ci    // , kNumDefined
476370b324cSopenharmony_ci  };
477370b324cSopenharmony_ci}
478370b324cSopenharmony_ci
479370b324cSopenharmony_ci/*
480370b324cSopenharmony_ciIArchiveUpdateCallbackFile::ReportOperation
481370b324cSopenharmony_ci  UInt32 indexType (NEventIndexType)
482370b324cSopenharmony_ci  UInt32 index
483370b324cSopenharmony_ci  UInt32 notifyOp (NUpdateNotifyOp)
484370b324cSopenharmony_ci*/
485370b324cSopenharmony_ci
486370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveUpdateCallbackFile(x) \
487370b324cSopenharmony_ci  x(GetStream2(UInt32 index, ISequentialInStream **inStream, UInt32 notifyOp)) \
488370b324cSopenharmony_ci  x(ReportOperation(UInt32 indexType, UInt32 index, UInt32 notifyOp)) \
489370b324cSopenharmony_ci
490370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveUpdateCallbackFile, 0x83)
491370b324cSopenharmony_ci
492370b324cSopenharmony_ci
493370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveGetDiskProperty(x) \
494370b324cSopenharmony_ci  x(GetDiskProperty(UInt32 index, PROPID propID, PROPVARIANT *value)) \
495370b324cSopenharmony_ci
496370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveGetDiskProperty, 0x84)
497370b324cSopenharmony_ci
498370b324cSopenharmony_ci/*
499370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveUpdateCallbackArcProp(x) \
500370b324cSopenharmony_ci  x(ReportProp(UInt32 indexType, UInt32 index, PROPID propID, const PROPVARIANT *value)) \
501370b324cSopenharmony_ci  x(ReportRawProp(UInt32 indexType, UInt32 index, PROPID propID, const void *data, UInt32 dataSize, UInt32 propType)) \
502370b324cSopenharmony_ci  x(ReportFinished(UInt32 indexType, UInt32 index, Int32 opRes)) \
503370b324cSopenharmony_ci  x(DoNeedArcProp(PROPID propID, Int32 *answer)) \
504370b324cSopenharmony_ci
505370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveUpdateCallbackArcProp, 0x85)
506370b324cSopenharmony_ci*/
507370b324cSopenharmony_ci
508370b324cSopenharmony_ci/*
509370b324cSopenharmony_ciUpdateItems()
510370b324cSopenharmony_ci-------------
511370b324cSopenharmony_ci
512370b324cSopenharmony_ci  outStream: output stream. (the handler) MUST support the case when
513370b324cSopenharmony_ci    Seek position in outStream is not ZERO.
514370b324cSopenharmony_ci    but the caller calls with empty outStream and seek position is ZERO??
515370b324cSopenharmony_ci
516370b324cSopenharmony_ci  archives with stub:
517370b324cSopenharmony_ci
518370b324cSopenharmony_ci  If archive is open and the handler and (Offset > 0), then the handler
519370b324cSopenharmony_ci  knows about stub size.
520370b324cSopenharmony_ci  UpdateItems():
521370b324cSopenharmony_ci  1) the handler MUST copy that stub to outStream
522370b324cSopenharmony_ci  2) the caller MUST NOT copy the stub to outStream, if
523370b324cSopenharmony_ci     "rsfx" property is set with SetProperties
524370b324cSopenharmony_ci
525370b324cSopenharmony_ci  the handler must support the case where
526370b324cSopenharmony_ci    ISequentialOutStream *outStream
527370b324cSopenharmony_ci*/
528370b324cSopenharmony_ci
529370b324cSopenharmony_ci
530370b324cSopenharmony_ci#define Z7_IFACEM_IOutArchive(x) \
531370b324cSopenharmony_ci  x(UpdateItems(ISequentialOutStream *outStream, UInt32 numItems, IArchiveUpdateCallback *updateCallback)) \
532370b324cSopenharmony_ci  x(GetFileTimeType(UInt32 *type))
533370b324cSopenharmony_ci
534370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IOutArchive, 0xA0)
535370b324cSopenharmony_ci
536370b324cSopenharmony_ci
537370b324cSopenharmony_ci/*
538370b324cSopenharmony_ciISetProperties::SetProperties()
539370b324cSopenharmony_ci  PROPVARIANT values[i].vt:
540370b324cSopenharmony_ci    VT_EMPTY
541370b324cSopenharmony_ci    VT_BOOL
542370b324cSopenharmony_ci    VT_UI4   - if 32-bit number
543370b324cSopenharmony_ci    VT_UI8   - if 64-bit number
544370b324cSopenharmony_ci    VT_BSTR
545370b324cSopenharmony_ci*/
546370b324cSopenharmony_ci
547370b324cSopenharmony_ci#define Z7_IFACEM_ISetProperties(x) \
548370b324cSopenharmony_ci  x(SetProperties(const wchar_t * const *names, const PROPVARIANT *values, UInt32 numProps))
549370b324cSopenharmony_ci
550370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(ISetProperties, 0x03)
551370b324cSopenharmony_ci
552370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveKeepModeForNextOpen(x) \
553370b324cSopenharmony_ci  x(KeepModeForNextOpen()) \
554370b324cSopenharmony_ci
555370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveKeepModeForNextOpen, 0x04)
556370b324cSopenharmony_ci
557370b324cSopenharmony_ci/* Exe handler: the handler for executable format (PE, ELF, Mach-O).
558370b324cSopenharmony_ci   SFX archive: executable stub + some tail data.
559370b324cSopenharmony_ci     before 9.31: exe handler didn't parse SFX archives as executable format.
560370b324cSopenharmony_ci     for 9.31+: exe handler parses SFX archives as executable format, only if AllowTail(1) was called */
561370b324cSopenharmony_ci
562370b324cSopenharmony_ci#define Z7_IFACEM_IArchiveAllowTail(x) \
563370b324cSopenharmony_ci  x(AllowTail(Int32 allowTail)) \
564370b324cSopenharmony_ci
565370b324cSopenharmony_ciZ7_IFACE_CONSTR_ARCHIVE(IArchiveAllowTail, 0x05)
566370b324cSopenharmony_ci
567370b324cSopenharmony_ci
568370b324cSopenharmony_ci
569370b324cSopenharmony_cistruct CStatProp
570370b324cSopenharmony_ci{
571370b324cSopenharmony_ci  const char *Name;
572370b324cSopenharmony_ci  UInt32 PropID;
573370b324cSopenharmony_ci  VARTYPE vt;
574370b324cSopenharmony_ci};
575370b324cSopenharmony_ci
576370b324cSopenharmony_cinamespace NWindows {
577370b324cSopenharmony_cinamespace NCOM {
578370b324cSopenharmony_ci// PropVariant.cpp
579370b324cSopenharmony_ciBSTR AllocBstrFromAscii(const char *s) throw();
580370b324cSopenharmony_ci}}
581370b324cSopenharmony_ci
582370b324cSopenharmony_ci
583370b324cSopenharmony_ci#define IMP_IInArchive_GetProp_Base(fn, f, k) \
584370b324cSopenharmony_ci  Z7_COM7F_IMF(CHandler::fn(UInt32 *numProps)) \
585370b324cSopenharmony_ci    { *numProps = Z7_ARRAY_SIZE(k); return S_OK; } \
586370b324cSopenharmony_ci  Z7_COM7F_IMF(CHandler::f(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType)) \
587370b324cSopenharmony_ci    { if (index >= Z7_ARRAY_SIZE(k)) return E_INVALIDARG; \
588370b324cSopenharmony_ci
589370b324cSopenharmony_ci#define IMP_IInArchive_GetProp_NO_NAME(fn, f, k) \
590370b324cSopenharmony_ci  IMP_IInArchive_GetProp_Base(fn, f, k) \
591370b324cSopenharmony_ci    *propID = k[index]; \
592370b324cSopenharmony_ci    *varType = k7z_PROPID_To_VARTYPE[(unsigned)*propID]; \
593370b324cSopenharmony_ci    *name = NULL; return S_OK; } \
594370b324cSopenharmony_ci
595370b324cSopenharmony_ci#define IMP_IInArchive_GetProp_WITH_NAME(fn, f, k) \
596370b324cSopenharmony_ci  IMP_IInArchive_GetProp_Base(fn, f, k) \
597370b324cSopenharmony_ci    const CStatProp &prop = k[index]; \
598370b324cSopenharmony_ci    *propID = (PROPID)prop.PropID; \
599370b324cSopenharmony_ci    *varType = prop.vt; \
600370b324cSopenharmony_ci    *name = NWindows::NCOM::AllocBstrFromAscii(prop.Name); return S_OK; } \
601370b324cSopenharmony_ci
602370b324cSopenharmony_ci
603370b324cSopenharmony_ci#define IMP_IInArchive_Props \
604370b324cSopenharmony_ci  IMP_IInArchive_GetProp_NO_NAME(GetNumberOfProperties, GetPropertyInfo, kProps)
605370b324cSopenharmony_ci
606370b324cSopenharmony_ci#define IMP_IInArchive_Props_WITH_NAME \
607370b324cSopenharmony_ci  IMP_IInArchive_GetProp_WITH_NAME(GetNumberOfProperties, GetPropertyInfo, kProps)
608370b324cSopenharmony_ci
609370b324cSopenharmony_ci#define IMP_IInArchive_ArcProps \
610370b324cSopenharmony_ci  IMP_IInArchive_GetProp_NO_NAME(GetNumberOfArchiveProperties, GetArchivePropertyInfo, kArcProps)
611370b324cSopenharmony_ci
612370b324cSopenharmony_ci#define IMP_IInArchive_ArcProps_WITH_NAME \
613370b324cSopenharmony_ci  IMP_IInArchive_GetProp_WITH_NAME(GetNumberOfArchiveProperties, GetArchivePropertyInfo, kArcProps)
614370b324cSopenharmony_ci
615370b324cSopenharmony_ci#define IMP_IInArchive_ArcProps_NO_Table \
616370b324cSopenharmony_ci  Z7_COM7F_IMF(CHandler::GetNumberOfArchiveProperties(UInt32 *numProps)) \
617370b324cSopenharmony_ci    { *numProps = 0; return S_OK; } \
618370b324cSopenharmony_ci  Z7_COM7F_IMF(CHandler::GetArchivePropertyInfo(UInt32, BSTR *, PROPID *, VARTYPE *)) \
619370b324cSopenharmony_ci    { return E_NOTIMPL; } \
620370b324cSopenharmony_ci
621370b324cSopenharmony_ci#define IMP_IInArchive_ArcProps_NO \
622370b324cSopenharmony_ci  IMP_IInArchive_ArcProps_NO_Table \
623370b324cSopenharmony_ci  Z7_COM7F_IMF(CHandler::GetArchiveProperty(PROPID, PROPVARIANT *value)) \
624370b324cSopenharmony_ci    { value->vt = VT_EMPTY; return S_OK; }
625370b324cSopenharmony_ci
626370b324cSopenharmony_ci
627370b324cSopenharmony_ci#define Z7_class_CHandler_final \
628370b324cSopenharmony_ci        Z7_class_final(CHandler)
629370b324cSopenharmony_ci
630370b324cSopenharmony_ci
631370b324cSopenharmony_ci#define Z7_CLASS_IMP_CHandler_IInArchive_0 \
632370b324cSopenharmony_ci  Z7_CLASS_IMP_COM_1(CHandler, IInArchive)
633370b324cSopenharmony_ci#define Z7_CLASS_IMP_CHandler_IInArchive_1(i1) \
634370b324cSopenharmony_ci  Z7_CLASS_IMP_COM_2(CHandler, IInArchive, i1)
635370b324cSopenharmony_ci#define Z7_CLASS_IMP_CHandler_IInArchive_2(i1, i2) \
636370b324cSopenharmony_ci  Z7_CLASS_IMP_COM_3(CHandler, IInArchive, i1, i2)
637370b324cSopenharmony_ci#define Z7_CLASS_IMP_CHandler_IInArchive_3(i1, i2, i3) \
638370b324cSopenharmony_ci  Z7_CLASS_IMP_COM_4(CHandler, IInArchive, i1, i2, i3)
639370b324cSopenharmony_ci#define Z7_CLASS_IMP_CHandler_IInArchive_4(i1, i2, i3, i4) \
640370b324cSopenharmony_ci  Z7_CLASS_IMP_COM_5(CHandler, IInArchive, i1, i2, i3, i4)
641370b324cSopenharmony_ci#define Z7_CLASS_IMP_CHandler_IInArchive_5(i1, i2, i3, i4, i5) \
642370b324cSopenharmony_ci  Z7_CLASS_IMP_COM_6(CHandler, IInArchive, i1, i2, i3, i4, i5)
643370b324cSopenharmony_ci
644370b324cSopenharmony_ci
645370b324cSopenharmony_ci
646370b324cSopenharmony_ci#define k_IsArc_Res_NO   0
647370b324cSopenharmony_ci#define k_IsArc_Res_YES  1
648370b324cSopenharmony_ci#define k_IsArc_Res_NEED_MORE 2
649370b324cSopenharmony_ci// #define k_IsArc_Res_YES_LOW_PROB 3
650370b324cSopenharmony_ci
651370b324cSopenharmony_ci#define API_FUNC_IsArc EXTERN_C UInt32 WINAPI
652370b324cSopenharmony_ci#define API_FUNC_static_IsArc extern "C" { static UInt32 WINAPI
653370b324cSopenharmony_ci
654370b324cSopenharmony_ciextern "C"
655370b324cSopenharmony_ci{
656370b324cSopenharmony_ci  typedef HRESULT (WINAPI *Func_CreateObject)(const GUID *clsID, const GUID *iid, void **outObject);
657370b324cSopenharmony_ci
658370b324cSopenharmony_ci  typedef UInt32 (WINAPI *Func_IsArc)(const Byte *p, size_t size);
659370b324cSopenharmony_ci  typedef HRESULT (WINAPI *Func_GetIsArc)(UInt32 formatIndex, Func_IsArc *isArc);
660370b324cSopenharmony_ci
661370b324cSopenharmony_ci  typedef HRESULT (WINAPI *Func_GetNumberOfFormats)(UInt32 *numFormats);
662370b324cSopenharmony_ci  typedef HRESULT (WINAPI *Func_GetHandlerProperty)(PROPID propID, PROPVARIANT *value);
663370b324cSopenharmony_ci  typedef HRESULT (WINAPI *Func_GetHandlerProperty2)(UInt32 index, PROPID propID, PROPVARIANT *value);
664370b324cSopenharmony_ci
665370b324cSopenharmony_ci  typedef HRESULT (WINAPI *Func_SetCaseSensitive)(Int32 caseSensitive);
666370b324cSopenharmony_ci  typedef HRESULT (WINAPI *Func_SetLargePageMode)();
667370b324cSopenharmony_ci  // typedef HRESULT (WINAPI *Func_SetClientVersion)(UInt32 version);
668370b324cSopenharmony_ci
669370b324cSopenharmony_ci  typedef IOutArchive * (*Func_CreateOutArchive)();
670370b324cSopenharmony_ci  typedef IInArchive * (*Func_CreateInArchive)();
671370b324cSopenharmony_ci}
672370b324cSopenharmony_ci
673370b324cSopenharmony_ci
674370b324cSopenharmony_ci/*
675370b324cSopenharmony_ci  if there is no time in archive, external MTime of archive
676370b324cSopenharmony_ci  will be used instead of _item.Time from archive.
677370b324cSopenharmony_ci  For 7-zip before 22.00 we need to return some supported value.
678370b324cSopenharmony_ci  But (kpidTimeType > kDOS) is not allowed in 7-Zip before 22.00.
679370b324cSopenharmony_ci  So we return highest precision value supported by old 7-Zip.
680370b324cSopenharmony_ci  new 7-Zip 22.00 doesn't use that value in usual cases.
681370b324cSopenharmony_ci*/
682370b324cSopenharmony_ci
683370b324cSopenharmony_ci
684370b324cSopenharmony_ci#define DECLARE_AND_SET_CLIENT_VERSION_VAR
685370b324cSopenharmony_ci#define GET_FileTimeType_NotDefined_for_GetFileTimeType \
686370b324cSopenharmony_ci      NFileTimeType::kWindows
687370b324cSopenharmony_ci
688370b324cSopenharmony_ci/*
689370b324cSopenharmony_ciextern UInt32 g_ClientVersion;
690370b324cSopenharmony_ci
691370b324cSopenharmony_ci#define GET_CLIENT_VERSION(major, minor)  \
692370b324cSopenharmony_ci  ((UInt32)(((UInt32)(major) << 16) | (UInt32)(minor)))
693370b324cSopenharmony_ci
694370b324cSopenharmony_ci#define DECLARE_AND_SET_CLIENT_VERSION_VAR \
695370b324cSopenharmony_ci  UInt32 g_ClientVersion = GET_CLIENT_VERSION(MY_VER_MAJOR, MY_VER_MINOR);
696370b324cSopenharmony_ci
697370b324cSopenharmony_ci#define GET_FileTimeType_NotDefined_for_GetFileTimeType \
698370b324cSopenharmony_ci      ((UInt32)(g_ClientVersion >= GET_CLIENT_VERSION(22, 0) ? \
699370b324cSopenharmony_ci        (UInt32)(Int32)NFileTimeType::kNotDefined : \
700370b324cSopenharmony_ci        NFileTimeType::kWindows))
701370b324cSopenharmony_ci*/
702370b324cSopenharmony_ci
703370b324cSopenharmony_ciZ7_PURE_INTERFACES_END
704370b324cSopenharmony_ci#endif
705