mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-09 22:07:05 -06:00
22.00
This commit is contained in:
0
CPP/7zip/Archive/7z/7z.dsp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7z.dsp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7z.dsw
Normal file → Executable file
0
CPP/7zip/Archive/7z/7z.dsw
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zCompressionMode.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zCompressionMode.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zCompressionMode.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zCompressionMode.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zDecode.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zDecode.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zDecode.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zDecode.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zEncode.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zEncode.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zEncode.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zEncode.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zExtract.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zExtract.cpp
Normal file → Executable file
123
CPP/7zip/Archive/7z/7zFolderInStream.cpp
Normal file → Executable file
123
CPP/7zip/Archive/7z/7zFolderInStream.cpp
Normal file → Executable file
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Windows/TimeUtils.h"
|
||||
|
||||
#include "7zFolderInStream.h"
|
||||
|
||||
namespace NArchive {
|
||||
@@ -13,17 +15,17 @@ void CFolderInStream::Init(IArchiveUpdateCallback *updateCallback,
|
||||
_updateCallback = updateCallback;
|
||||
_indexes = indexes;
|
||||
_numFiles = numFiles;
|
||||
_index = 0;
|
||||
|
||||
Processed.ClearAndReserve(numFiles);
|
||||
CRCs.ClearAndReserve(numFiles);
|
||||
Sizes.ClearAndReserve(numFiles);
|
||||
|
||||
_pos = 0;
|
||||
_crc = CRC_INIT_VAL;
|
||||
_size_Defined = false;
|
||||
_size = 0;
|
||||
|
||||
if (Need_CTime) CTimes.ClearAndReserve(numFiles);
|
||||
if (Need_ATime) ATimes.ClearAndReserve(numFiles);
|
||||
if (Need_MTime) MTimes.ClearAndReserve(numFiles);
|
||||
if (Need_Attrib) Attribs.ClearAndReserve(numFiles);
|
||||
TimesDefined.ClearAndReserve(numFiles);
|
||||
|
||||
_stream.Release();
|
||||
}
|
||||
|
||||
@@ -32,44 +34,101 @@ HRESULT CFolderInStream::OpenStream()
|
||||
_pos = 0;
|
||||
_crc = CRC_INIT_VAL;
|
||||
_size_Defined = false;
|
||||
_times_Defined = false;
|
||||
_size = 0;
|
||||
FILETIME_Clear(_cTime);
|
||||
FILETIME_Clear(_aTime);
|
||||
FILETIME_Clear(_mTime);
|
||||
_attrib = 0;
|
||||
|
||||
while (_index < _numFiles)
|
||||
while (Processed.Size() < _numFiles)
|
||||
{
|
||||
CMyComPtr<ISequentialInStream> stream;
|
||||
HRESULT result = _updateCallback->GetStream(_indexes[_index], &stream);
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (result != S_FALSE)
|
||||
return result;
|
||||
}
|
||||
const HRESULT result = _updateCallback->GetStream(_indexes[Processed.Size()], &stream);
|
||||
if (result != S_OK && result != S_FALSE)
|
||||
return result;
|
||||
|
||||
_stream = stream;
|
||||
|
||||
if (stream)
|
||||
{
|
||||
CMyComPtr<IStreamGetSize> streamGetSize;
|
||||
stream.QueryInterface(IID_IStreamGetSize, &streamGetSize);
|
||||
if (streamGetSize)
|
||||
{
|
||||
if (streamGetSize->GetSize(&_size) == S_OK)
|
||||
_size_Defined = true;
|
||||
CMyComPtr<IStreamGetProps> getProps;
|
||||
stream.QueryInterface(IID_IStreamGetProps, (void **)&getProps);
|
||||
if (getProps)
|
||||
{
|
||||
// access could be changed in first myx pass
|
||||
if (getProps->GetProps(&_size,
|
||||
Need_CTime ? &_cTime : NULL,
|
||||
Need_ATime ? &_aTime : NULL,
|
||||
Need_MTime ? &_mTime : NULL,
|
||||
Need_Attrib ? &_attrib : NULL)
|
||||
== S_OK)
|
||||
{
|
||||
_size_Defined = true;
|
||||
_times_Defined = true;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
{
|
||||
CMyComPtr<IStreamGetSize> streamGetSize;
|
||||
stream.QueryInterface(IID_IStreamGetSize, &streamGetSize);
|
||||
if (streamGetSize)
|
||||
{
|
||||
if (streamGetSize->GetSize(&_size) == S_OK)
|
||||
_size_Defined = true;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_index++;
|
||||
RINOK(_updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
|
||||
AddFileInfo(result == S_OK);
|
||||
RINOK(AddFileInfo(result == S_OK));
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CFolderInStream::AddFileInfo(bool isProcessed)
|
||||
static void AddFt(CRecordVector<UInt64> &vec, const FILETIME &ft)
|
||||
{
|
||||
Processed.Add(isProcessed);
|
||||
Sizes.Add(_pos);
|
||||
CRCs.Add(CRC_GET_DIGEST(_crc));
|
||||
vec.AddInReserved(FILETIME_To_UInt64(ft));
|
||||
}
|
||||
|
||||
/*
|
||||
HRESULT ReportItemProps(IArchiveUpdateCallbackArcProp *reportArcProp,
|
||||
UInt32 index, UInt64 size, const UInt32 *crc)
|
||||
{
|
||||
PROPVARIANT prop;
|
||||
prop.vt = VT_EMPTY;
|
||||
prop.wReserved1 = 0;
|
||||
|
||||
NWindows::NCOM::PropVarEm_Set_UInt64(&prop, size);
|
||||
RINOK(reportArcProp->ReportProp(NEventIndexType::kOutArcIndex, index, kpidSize, &prop));
|
||||
if (crc)
|
||||
{
|
||||
NWindows::NCOM::PropVarEm_Set_UInt32(&prop, *crc);
|
||||
RINOK(reportArcProp->ReportProp(NEventIndexType::kOutArcIndex, index, kpidCRC, &prop));
|
||||
}
|
||||
return reportArcProp->ReportFinished(NEventIndexType::kOutArcIndex, index, NUpdate::NOperationResult::kOK);
|
||||
}
|
||||
*/
|
||||
|
||||
HRESULT CFolderInStream::AddFileInfo(bool isProcessed)
|
||||
{
|
||||
// const UInt32 index = _indexes[Processed.Size()];
|
||||
Processed.AddInReserved(isProcessed);
|
||||
Sizes.AddInReserved(_pos);
|
||||
const UInt32 crc = CRC_GET_DIGEST(_crc);
|
||||
CRCs.AddInReserved(crc);
|
||||
TimesDefined.AddInReserved(_times_Defined);
|
||||
if (Need_CTime) AddFt(CTimes, _cTime);
|
||||
if (Need_ATime) AddFt(ATimes, _aTime);
|
||||
if (Need_MTime) AddFt(MTimes, _mTime);
|
||||
if (Need_Attrib) Attribs.AddInReserved(_attrib);
|
||||
/*
|
||||
if (isProcessed && _reportArcProp)
|
||||
RINOK(ReportItemProps(_reportArcProp, index, _pos, &crc))
|
||||
*/
|
||||
return _updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK);
|
||||
}
|
||||
|
||||
STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
@@ -95,18 +154,10 @@ STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSiz
|
||||
}
|
||||
|
||||
_stream.Release();
|
||||
_index++;
|
||||
AddFileInfo(true);
|
||||
|
||||
_pos = 0;
|
||||
_crc = CRC_INIT_VAL;
|
||||
_size_Defined = false;
|
||||
_size = 0;
|
||||
|
||||
RINOK(_updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
|
||||
RINOK(AddFileInfo(true));
|
||||
}
|
||||
|
||||
if (_index >= _numFiles)
|
||||
if (Processed.Size() >= _numFiles)
|
||||
break;
|
||||
RINOK(OpenStream());
|
||||
}
|
||||
|
||||
31
CPP/7zip/Archive/7z/7zFolderInStream.h
Normal file → Executable file
31
CPP/7zip/Archive/7z/7zFolderInStream.h
Normal file → Executable file
@@ -23,21 +23,37 @@ class CFolderInStream:
|
||||
UInt64 _pos;
|
||||
UInt32 _crc;
|
||||
bool _size_Defined;
|
||||
bool _times_Defined;
|
||||
UInt64 _size;
|
||||
FILETIME _cTime;
|
||||
FILETIME _aTime;
|
||||
FILETIME _mTime;
|
||||
UInt32 _attrib;
|
||||
|
||||
const UInt32 *_indexes;
|
||||
unsigned _numFiles;
|
||||
unsigned _index;
|
||||
const UInt32 *_indexes;
|
||||
|
||||
CMyComPtr<IArchiveUpdateCallback> _updateCallback;
|
||||
|
||||
HRESULT OpenStream();
|
||||
void AddFileInfo(bool isProcessed);
|
||||
HRESULT AddFileInfo(bool isProcessed);
|
||||
|
||||
public:
|
||||
CRecordVector<bool> Processed;
|
||||
CRecordVector<UInt32> CRCs;
|
||||
CRecordVector<UInt64> Sizes;
|
||||
CRecordVector<UInt64> CTimes;
|
||||
CRecordVector<UInt64> ATimes;
|
||||
CRecordVector<UInt64> MTimes;
|
||||
CRecordVector<UInt32> Attribs;
|
||||
CRecordVector<bool> TimesDefined;
|
||||
|
||||
bool Need_CTime;
|
||||
bool Need_ATime;
|
||||
bool Need_MTime;
|
||||
bool Need_Attrib;
|
||||
|
||||
// CMyComPtr<IArchiveUpdateCallbackArcProp> _reportArcProp;
|
||||
|
||||
MY_UNKNOWN_IMP2(ISequentialInStream, ICompressGetSubStreamSize)
|
||||
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
|
||||
@@ -45,7 +61,7 @@ public:
|
||||
|
||||
void Init(IArchiveUpdateCallback *updateCallback, const UInt32 *indexes, unsigned numFiles);
|
||||
|
||||
bool WasFinished() const { return _index == _numFiles; }
|
||||
bool WasFinished() const { return Processed.Size() == _numFiles; }
|
||||
|
||||
UInt64 GetFullSize() const
|
||||
{
|
||||
@@ -54,6 +70,13 @@ public:
|
||||
size += Sizes[i];
|
||||
return size;
|
||||
}
|
||||
|
||||
CFolderInStream():
|
||||
Need_CTime(false),
|
||||
Need_ATime(false),
|
||||
Need_MTime(false),
|
||||
Need_Attrib(false)
|
||||
{}
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
2
CPP/7zip/Archive/7z/7zHandler.cpp
Normal file → Executable file
2
CPP/7zip/Archive/7z/7zHandler.cpp
Normal file → Executable file
@@ -278,7 +278,7 @@ static void SetFileTimeProp_From_UInt64Def(PROPVARIANT *prop, const CUInt64DefVe
|
||||
{
|
||||
UInt64 value;
|
||||
if (v.GetItem(index, value))
|
||||
PropVarEm_Set_FileTime64(prop, value);
|
||||
PropVarEm_Set_FileTime64_Prec(prop, value, k_PropVar_TimePrec_100ns);
|
||||
}
|
||||
|
||||
bool CHandler::IsFolderEncrypted(CNum folderIndex) const
|
||||
|
||||
5
CPP/7zip/Archive/7z/7zHandler.h
Normal file → Executable file
5
CPP/7zip/Archive/7z/7zHandler.h
Normal file → Executable file
@@ -49,9 +49,8 @@ public:
|
||||
bool _encryptHeaders;
|
||||
// bool _useParents; 9.26
|
||||
|
||||
CBoolPair Write_CTime;
|
||||
CBoolPair Write_ATime;
|
||||
CBoolPair Write_MTime;
|
||||
CHandlerTimeOptions TimeOptions;
|
||||
|
||||
CBoolPair Write_Attrib;
|
||||
|
||||
bool _useMultiThreadMixer;
|
||||
|
||||
39
CPP/7zip/Archive/7z/7zHandlerOut.cpp
Normal file → Executable file
39
CPP/7zip/Archive/7z/7zHandlerOut.cpp
Normal file → Executable file
@@ -384,16 +384,16 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
|
||||
|
||||
CObjectVector<CUpdateItem> updateItems;
|
||||
|
||||
bool need_CTime = (Write_CTime.Def && Write_CTime.Val);
|
||||
bool need_ATime = (Write_ATime.Def && Write_ATime.Val);
|
||||
bool need_MTime = (Write_MTime.Def ? Write_MTime.Val : true);
|
||||
bool need_CTime = (TimeOptions.Write_CTime.Def && TimeOptions.Write_CTime.Val);
|
||||
bool need_ATime = (TimeOptions.Write_ATime.Def && TimeOptions.Write_ATime.Val);
|
||||
bool need_MTime = (TimeOptions.Write_MTime.Def ? TimeOptions.Write_MTime.Val : true);
|
||||
bool need_Attrib = (Write_Attrib.Def ? Write_Attrib.Val : true);
|
||||
|
||||
if (db && !db->Files.IsEmpty())
|
||||
{
|
||||
if (!Write_CTime.Def) need_CTime = !db->CTime.Defs.IsEmpty();
|
||||
if (!Write_ATime.Def) need_ATime = !db->ATime.Defs.IsEmpty();
|
||||
if (!Write_MTime.Def) need_MTime = !db->MTime.Defs.IsEmpty();
|
||||
if (!TimeOptions.Write_CTime.Def) need_CTime = !db->CTime.Defs.IsEmpty();
|
||||
if (!TimeOptions.Write_ATime.Def) need_ATime = !db->ATime.Defs.IsEmpty();
|
||||
if (!TimeOptions.Write_MTime.Def) need_MTime = !db->MTime.Defs.IsEmpty();
|
||||
if (!Write_Attrib.Def) need_Attrib = !db->Attrib.Defs.IsEmpty();
|
||||
}
|
||||
|
||||
@@ -719,6 +719,11 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
|
||||
int level = GetLevel();
|
||||
|
||||
CUpdateOptions options;
|
||||
options.Need_CTime = need_CTime;
|
||||
options.Need_ATime = need_ATime;
|
||||
options.Need_MTime = need_MTime;
|
||||
options.Need_Attrib = need_Attrib;
|
||||
|
||||
options.Method = &methodMode;
|
||||
options.HeaderMethod = (_compressHeaders || encryptHeaders) ? &headerMethod : NULL;
|
||||
options.UseFilters = (level != 0 && _autoFilter && !methodMode.Filter_was_Inserted);
|
||||
@@ -817,9 +822,7 @@ void COutHandler::InitProps7z()
|
||||
_encryptHeaders = false;
|
||||
// _useParents = false;
|
||||
|
||||
Write_CTime.Init();
|
||||
Write_ATime.Init();
|
||||
Write_MTime.Init();
|
||||
TimeOptions.Init();
|
||||
Write_Attrib.Init();
|
||||
|
||||
_useMultiThreadMixer = true;
|
||||
@@ -954,10 +957,20 @@ HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &val
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (name.IsEqualTo("tc")) return PROPVARIANT_to_BoolPair(value, Write_CTime);
|
||||
if (name.IsEqualTo("ta")) return PROPVARIANT_to_BoolPair(value, Write_ATime);
|
||||
if (name.IsEqualTo("tm")) return PROPVARIANT_to_BoolPair(value, Write_MTime);
|
||||
|
||||
{
|
||||
bool processed;
|
||||
RINOK(TimeOptions.Parse(name, value, processed));
|
||||
if (processed)
|
||||
{
|
||||
if ( TimeOptions.Prec != (UInt32)(Int32)-1
|
||||
&& TimeOptions.Prec != k_PropVar_TimePrec_0
|
||||
&& TimeOptions.Prec != k_PropVar_TimePrec_HighPrec
|
||||
&& TimeOptions.Prec != k_PropVar_TimePrec_100ns)
|
||||
return E_INVALIDARG;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (name.IsEqualTo("tr")) return PROPVARIANT_to_BoolPair(value, Write_Attrib);
|
||||
|
||||
if (name.IsEqualTo("mtf")) return PROPVARIANT_to_bool(value, _useMultiThreadMixer);
|
||||
|
||||
0
CPP/7zip/Archive/7z/7zHeader.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zHeader.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zHeader.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zHeader.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zIn.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zIn.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zIn.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zIn.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zItem.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zItem.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zOut.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zOut.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zOut.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zOut.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zProperties.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zProperties.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zProperties.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zProperties.h
Normal file → Executable file
10
CPP/7zip/Archive/7z/7zRegister.cpp
Normal file → Executable file
10
CPP/7zip/Archive/7z/7zRegister.cpp
Normal file → Executable file
@@ -15,7 +15,13 @@ REGISTER_ARC_IO_DECREMENT_SIG(
|
||||
"7z", "7z", NULL, 7,
|
||||
k_Signature_Dec,
|
||||
0,
|
||||
NArcInfoFlags::kFindSignature,
|
||||
NULL);
|
||||
NArcInfoFlags::kFindSignature
|
||||
| NArcInfoFlags::kCTime
|
||||
| NArcInfoFlags::kATime
|
||||
| NArcInfoFlags::kMTime
|
||||
| NArcInfoFlags::kMTime_Default
|
||||
, TIME_PREC_TO_ARC_FLAGS_MASK(NFileTimeType::kWindows)
|
||||
| TIME_PREC_TO_ARC_FLAGS_TIME_DEFAULT(NFileTimeType::kWindows)
|
||||
, NULL);
|
||||
|
||||
}}
|
||||
|
||||
0
CPP/7zip/Archive/7z/7zSpecStream.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zSpecStream.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zSpecStream.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/7zSpecStream.h
Normal file → Executable file
141
CPP/7zip/Archive/7z/7zUpdate.cpp
Normal file → Executable file
141
CPP/7zip/Archive/7z/7zUpdate.cpp
Normal file → Executable file
@@ -804,10 +804,20 @@ struct CAnalysis
|
||||
bool ParseExe;
|
||||
bool ParseAll;
|
||||
|
||||
/*
|
||||
bool Need_ATime;
|
||||
bool ATime_Defined;
|
||||
FILETIME ATime;
|
||||
*/
|
||||
|
||||
CAnalysis():
|
||||
ParseWav(true),
|
||||
ParseExe(false),
|
||||
ParseAll(false)
|
||||
/*
|
||||
, Need_ATime(false)
|
||||
, ATime_Defined(false)
|
||||
*/
|
||||
{}
|
||||
|
||||
HRESULT GetFilterGroup(UInt32 index, const CUpdateItem &ui, CFilterMode &filterMode);
|
||||
@@ -887,6 +897,18 @@ HRESULT CAnalysis::GetFilterGroup(UInt32 index, const CUpdateItem &ui, CFilterMo
|
||||
HRESULT result = Callback->GetStream2(index, &stream, NUpdateNotifyOp::kAnalyze);
|
||||
if (result == S_OK && stream)
|
||||
{
|
||||
/*
|
||||
if (Need_ATime)
|
||||
{
|
||||
// access time could be changed in analysis pass
|
||||
CMyComPtr<IStreamGetProps> getProps;
|
||||
stream.QueryInterface(IID_IStreamGetProps, (void **)&getProps);
|
||||
if (getProps)
|
||||
if (getProps->GetProps(NULL, NULL, &ATime, NULL, NULL) == S_OK)
|
||||
ATime_Defined = true;
|
||||
}
|
||||
*/
|
||||
|
||||
size_t size = kAnalysisBufSize;
|
||||
result = ReadStream(stream, Buffer, &size);
|
||||
stream.Release();
|
||||
@@ -1586,6 +1608,11 @@ HRESULT Update(
|
||||
CMyComPtr<IArchiveExtractCallbackMessage> extractCallback;
|
||||
updateCallback->QueryInterface(IID_IArchiveExtractCallbackMessage, (void **)&extractCallback);
|
||||
|
||||
/*
|
||||
CMyComPtr<IArchiveUpdateCallbackArcProp> reportArcProp;
|
||||
updateCallback->QueryInterface(IID_IArchiveUpdateCallbackArcProp, (void **)&reportArcProp);
|
||||
*/
|
||||
|
||||
// size_t totalSecureDataSize = (size_t)secureBlocks.GetTotalSizeInBytes();
|
||||
|
||||
/*
|
||||
@@ -1756,6 +1783,7 @@ HRESULT Update(
|
||||
|
||||
{
|
||||
CAnalysis analysis;
|
||||
// analysis.Need_ATime = options.Need_ATime;
|
||||
if (options.AnalysisLevel == 0)
|
||||
{
|
||||
analysis.ParseWav = false;
|
||||
@@ -1790,7 +1818,15 @@ HRESULT Update(
|
||||
CFilterMode2 fm;
|
||||
if (useFilters)
|
||||
{
|
||||
// analysis.ATime_Defined = false;
|
||||
RINOK(analysis.GetFilterGroup(i, ui, fm));
|
||||
/*
|
||||
if (analysis.ATime_Defined)
|
||||
{
|
||||
ui.ATime = FILETIME_To_UInt64(analysis.ATime);
|
||||
ui.ATime_WasReadByAnalysis = true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
fm.Encrypted = method.PasswordIsDefined;
|
||||
|
||||
@@ -2374,13 +2410,33 @@ HRESULT Update(
|
||||
|
||||
RINOK(lps->SetCur());
|
||||
|
||||
/*
|
||||
const unsigned folderIndex = newDatabase.NumUnpackStreamsVector.Size();
|
||||
|
||||
if (opCallback)
|
||||
{
|
||||
RINOK(opCallback->ReportOperation(
|
||||
NEventIndexType::kBlockIndex, (UInt32)folderIndex,
|
||||
NUpdateNotifyOp::kAdd));
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
CFolderInStream *inStreamSpec = new CFolderInStream;
|
||||
CMyComPtr<ISequentialInStream> solidInStream(inStreamSpec);
|
||||
|
||||
// inStreamSpec->_reportArcProp = reportArcProp;
|
||||
|
||||
inStreamSpec->Need_CTime = options.Need_CTime;
|
||||
inStreamSpec->Need_ATime = options.Need_ATime;
|
||||
inStreamSpec->Need_MTime = options.Need_MTime;
|
||||
inStreamSpec->Need_Attrib = options.Need_Attrib;
|
||||
|
||||
inStreamSpec->Init(updateCallback, &indices[i], numSubFiles);
|
||||
|
||||
unsigned startPackIndex = newDatabase.PackSizes.Size();
|
||||
UInt64 curFolderUnpackSize = totalSize;
|
||||
// curFolderUnpackSize = (UInt64)(Int64)-1;
|
||||
// curFolderUnpackSize = (UInt64)(Int64)-1; // for debug
|
||||
|
||||
RINOK(encoder.Encode(
|
||||
EXTERNAL_CODECS_LOC_VARS
|
||||
@@ -2393,8 +2449,11 @@ HRESULT Update(
|
||||
if (!inStreamSpec->WasFinished())
|
||||
return E_FAIL;
|
||||
|
||||
UInt64 packSize = 0;
|
||||
// const UInt32 numStreams = newDatabase.PackSizes.Size() - startPackIndex;
|
||||
for (; startPackIndex < newDatabase.PackSizes.Size(); startPackIndex++)
|
||||
lps->OutSize += newDatabase.PackSizes[startPackIndex];
|
||||
packSize += newDatabase.PackSizes[startPackIndex];
|
||||
lps->OutSize += packSize;
|
||||
|
||||
lps->InSize += curFolderUnpackSize;
|
||||
// for ()
|
||||
@@ -2403,7 +2462,9 @@ HRESULT Update(
|
||||
|
||||
CNum numUnpackStreams = 0;
|
||||
UInt64 skippedSize = 0;
|
||||
|
||||
UInt64 procSize = 0;
|
||||
// unsigned numProcessedFiles = 0;
|
||||
|
||||
for (unsigned subIndex = 0; subIndex < numSubFiles; subIndex++)
|
||||
{
|
||||
const CUpdateItem &ui = updateItems[indices[i + subIndex]];
|
||||
@@ -2429,14 +2490,16 @@ HRESULT Update(
|
||||
*/
|
||||
if (!inStreamSpec->Processed[subIndex])
|
||||
{
|
||||
// we don't add file here
|
||||
skippedSize += ui.Size;
|
||||
continue;
|
||||
// file.Name += ".locked";
|
||||
continue; // comment it for debug
|
||||
// name += ".locked"; // for debug
|
||||
}
|
||||
|
||||
file.Crc = inStreamSpec->CRCs[subIndex];
|
||||
file.Size = inStreamSpec->Sizes[subIndex];
|
||||
|
||||
procSize += file.Size;
|
||||
// if (file.Size >= 0) // test purposes
|
||||
if (file.Size != 0)
|
||||
{
|
||||
@@ -2450,6 +2513,23 @@ HRESULT Update(
|
||||
file.HasStream = false;
|
||||
}
|
||||
|
||||
if (inStreamSpec->TimesDefined[subIndex])
|
||||
{
|
||||
if (inStreamSpec->Need_CTime)
|
||||
{ file2.CTimeDefined = true; file2.CTime = inStreamSpec->CTimes[subIndex]; }
|
||||
if (inStreamSpec->Need_ATime
|
||||
// && !ui.ATime_WasReadByAnalysis
|
||||
)
|
||||
{ file2.ATimeDefined = true; file2.ATime = inStreamSpec->ATimes[subIndex]; }
|
||||
if (inStreamSpec->Need_MTime)
|
||||
{ file2.MTimeDefined = true; file2.MTime = inStreamSpec->MTimes[subIndex]; }
|
||||
if (inStreamSpec->Need_Attrib)
|
||||
{
|
||||
file2.AttribDefined = true;
|
||||
file2.Attrib = inStreamSpec->Attribs[subIndex];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
file.Parent = ui.ParentFolderIndex;
|
||||
if (ui.TreeFolderIndex >= 0)
|
||||
@@ -2457,9 +2537,22 @@ HRESULT Update(
|
||||
if (totalSecureDataSize != 0)
|
||||
newDatabase.SecureIDs.Add(ui.SecureIndex);
|
||||
*/
|
||||
/*
|
||||
if (reportArcProp)
|
||||
{
|
||||
RINOK(ReportItemProps(reportArcProp, ui.IndexInClient, file.Size,
|
||||
file.CrcDefined ? &file.Crc : NULL))
|
||||
}
|
||||
*/
|
||||
|
||||
// numProcessedFiles++;
|
||||
newDatabase.AddFile(file, file2, name);
|
||||
}
|
||||
|
||||
// it's optional check to ensure that sizes are correct
|
||||
if (procSize != curFolderUnpackSize)
|
||||
return E_FAIL;
|
||||
|
||||
// numUnpackStreams = 0 is very bad case for locked files
|
||||
// v3.13 doesn't understand it.
|
||||
newDatabase.NumUnpackStreamsVector.Add(numUnpackStreams);
|
||||
@@ -2470,6 +2563,44 @@ HRESULT Update(
|
||||
complexity -= skippedSize;
|
||||
RINOK(updateCallback->SetTotal(complexity));
|
||||
}
|
||||
|
||||
/*
|
||||
if (reportArcProp)
|
||||
{
|
||||
PROPVARIANT prop;
|
||||
prop.vt = VT_EMPTY;
|
||||
prop.wReserved1 = 0;
|
||||
{
|
||||
NWindows::NCOM::PropVarEm_Set_UInt32(&prop, numProcessedFiles);
|
||||
RINOK(reportArcProp->ReportProp(
|
||||
NEventIndexType::kBlockIndex, (UInt32)folderIndex, kpidNumSubFiles, &prop));
|
||||
}
|
||||
{
|
||||
NWindows::NCOM::PropVarEm_Set_UInt64(&prop, curFolderUnpackSize);
|
||||
RINOK(reportArcProp->ReportProp(
|
||||
NEventIndexType::kBlockIndex, (UInt32)folderIndex, kpidSize, &prop));
|
||||
}
|
||||
{
|
||||
NWindows::NCOM::PropVarEm_Set_UInt64(&prop, packSize);
|
||||
RINOK(reportArcProp->ReportProp(
|
||||
NEventIndexType::kBlockIndex, (UInt32)folderIndex, kpidPackSize, &prop));
|
||||
}
|
||||
{
|
||||
NWindows::NCOM::PropVarEm_Set_UInt32(&prop, numStreams);
|
||||
RINOK(reportArcProp->ReportProp(
|
||||
NEventIndexType::kBlockIndex, (UInt32)folderIndex, kpidNumStreams, &prop));
|
||||
}
|
||||
RINOK(reportArcProp->ReportFinished(NEventIndexType::kBlockIndex, (UInt32)folderIndex, NUpdate::NOperationResult::kOK));
|
||||
}
|
||||
*/
|
||||
/*
|
||||
if (opCallback)
|
||||
{
|
||||
RINOK(opCallback->ReportOperation(
|
||||
NEventIndexType::kBlockIndex, (UInt32)folderIndex,
|
||||
NUpdateNotifyOp::kOpFinished));
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
14
CPP/7zip/Archive/7z/7zUpdate.h
Normal file → Executable file
14
CPP/7zip/Archive/7z/7zUpdate.h
Normal file → Executable file
@@ -62,6 +62,8 @@ struct CUpdateItem
|
||||
bool ATimeDefined;
|
||||
bool MTimeDefined;
|
||||
|
||||
// bool ATime_WasReadByAnalysis;
|
||||
|
||||
// int SecureIndex; // 0 means (no_security)
|
||||
|
||||
bool HasStream() const { return !IsDir && !IsAnti && Size != 0; }
|
||||
@@ -76,6 +78,7 @@ struct CUpdateItem
|
||||
CTimeDefined(false),
|
||||
ATimeDefined(false),
|
||||
MTimeDefined(false)
|
||||
// , ATime_WasReadByAnalysis(false)
|
||||
// SecureIndex(0)
|
||||
{}
|
||||
void SetDirStatusFromAttrib() { IsDir = ((Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0); }
|
||||
@@ -103,6 +106,11 @@ struct CUpdateOptions
|
||||
bool RemoveSfxBlock;
|
||||
bool MultiThreadMixer;
|
||||
|
||||
bool Need_CTime;
|
||||
bool Need_ATime;
|
||||
bool Need_MTime;
|
||||
bool Need_Attrib;
|
||||
|
||||
CUpdateOptions():
|
||||
Method(NULL),
|
||||
HeaderMethod(NULL),
|
||||
@@ -114,7 +122,11 @@ struct CUpdateOptions
|
||||
SolidExtension(false),
|
||||
UseTypeSorting(true),
|
||||
RemoveSfxBlock(false),
|
||||
MultiThreadMixer(true)
|
||||
MultiThreadMixer(true),
|
||||
Need_CTime(false),
|
||||
Need_ATime(false),
|
||||
Need_MTime(false),
|
||||
Need_Attrib(false)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
0
CPP/7zip/Archive/7z/StdAfx.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/StdAfx.cpp
Normal file → Executable file
0
CPP/7zip/Archive/7z/StdAfx.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/StdAfx.h
Normal file → Executable file
0
CPP/7zip/Archive/7z/makefile
Normal file → Executable file
0
CPP/7zip/Archive/7z/makefile
Normal file → Executable file
0
CPP/7zip/Archive/7z/resource.rc
Normal file → Executable file
0
CPP/7zip/Archive/7z/resource.rc
Normal file → Executable file
Reference in New Issue
Block a user