mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 20:06:58 -06:00
23.01
This commit is contained in:
@@ -25,8 +25,8 @@
|
||||
#include "../../../Windows/PropVariant.h"
|
||||
#include "../../../Windows/PropVariantConv.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(UNDER_CE) && !defined(_SFX)
|
||||
#define _USE_SECURITY_CODE
|
||||
#if defined(_WIN32) && !defined(UNDER_CE) && !defined(Z7_SFX)
|
||||
#define Z7_USE_SECURITY_CODE
|
||||
#include "../../../Windows/SecurityUtils.h"
|
||||
#endif
|
||||
|
||||
@@ -54,9 +54,9 @@ static const char * const kCantCreateHardLink = "Cannot create hard link";
|
||||
static const char * const kCantCreateSymLink = "Cannot create symbolic link";
|
||||
#endif
|
||||
|
||||
#ifndef _SFX
|
||||
#ifndef Z7_SFX
|
||||
|
||||
STDMETHODIMP COutStreamWithHash::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
||||
Z7_COM7F_IMF(COutStreamWithHash::Write(const void *data, UInt32 size, UInt32 *processedSize))
|
||||
{
|
||||
HRESULT result = S_OK;
|
||||
if (_stream)
|
||||
@@ -69,10 +69,10 @@ STDMETHODIMP COutStreamWithHash::Write(const void *data, UInt32 size, UInt32 *pr
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // _SFX
|
||||
#endif // Z7_SFX
|
||||
|
||||
|
||||
#ifdef _USE_SECURITY_CODE
|
||||
#ifdef Z7_USE_SECURITY_CODE
|
||||
bool InitLocalPrivileges();
|
||||
bool InitLocalPrivileges()
|
||||
{
|
||||
@@ -92,11 +92,11 @@ bool InitLocalPrivileges()
|
||||
return false;
|
||||
return (GetLastError() == ERROR_SUCCESS);
|
||||
}
|
||||
#endif // _USE_SECURITY_CODE
|
||||
#endif // Z7_USE_SECURITY_CODE
|
||||
|
||||
|
||||
|
||||
#if defined(_WIN32) && !defined(UNDER_CE) && !defined(_SFX)
|
||||
#if defined(_WIN32) && !defined(UNDER_CE) && !defined(Z7_SFX)
|
||||
|
||||
static const char * const kOfficeExtensions =
|
||||
" doc dot wbk"
|
||||
@@ -117,7 +117,7 @@ static bool FindExt2(const char *p, const UString &name)
|
||||
return false;
|
||||
|
||||
AString s;
|
||||
for (unsigned pos = dotPos + 1;; pos++)
|
||||
for (unsigned pos = (unsigned)(dotPos + 1);; pos++)
|
||||
{
|
||||
const wchar_t c = name[pos];
|
||||
if (c <= 0)
|
||||
@@ -142,7 +142,7 @@ static const FChar * const k_ZoneId_StreamName = FTEXT(":Zone.Identifier");
|
||||
|
||||
void ReadZoneFile_Of_BaseFile(CFSTR fileName2, CByteBuffer &buf)
|
||||
{
|
||||
FString fileName = fileName2;
|
||||
FString fileName (fileName2);
|
||||
fileName += k_ZoneId_StreamName;
|
||||
|
||||
buf.Free();
|
||||
@@ -188,13 +188,13 @@ static HRESULT Archive_Get_HardLinkNode(IInArchive *archive, UInt32 index, CHard
|
||||
defined = false;
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, kpidINode, &prop));
|
||||
RINOK(archive->GetProperty(index, kpidINode, &prop))
|
||||
if (!ConvertPropVariantToUInt64(prop, h.INode))
|
||||
return S_OK;
|
||||
}
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, kpidStreamId, &prop));
|
||||
RINOK(archive->GetProperty(index, kpidStreamId, &prop))
|
||||
ConvertPropVariantToUInt64(prop, h.StreamId);
|
||||
}
|
||||
defined = true;
|
||||
@@ -218,22 +218,27 @@ HRESULT CArchiveExtractCallback::PrepareHardLinks(const CRecordVector<UInt32> *r
|
||||
numItems = realIndices->Size();
|
||||
else
|
||||
{
|
||||
RINOK(archive->GetNumberOfItems(&numItems));
|
||||
RINOK(archive->GetNumberOfItems(&numItems))
|
||||
}
|
||||
|
||||
for (UInt32 i = 0; i < numItems; i++)
|
||||
{
|
||||
CHardLinkNode h;
|
||||
bool defined;
|
||||
UInt32 realIndex = realIndices ? (*realIndices)[i] : i;
|
||||
const UInt32 realIndex = realIndices ? (*realIndices)[i] : i;
|
||||
|
||||
RINOK(Archive_Get_HardLinkNode(archive, realIndex, h, defined));
|
||||
RINOK(Archive_Get_HardLinkNode(archive, realIndex, h, defined))
|
||||
if (defined)
|
||||
{
|
||||
bool isAltStream = false;
|
||||
RINOK(Archive_IsItem_AltStream(archive, realIndex, isAltStream));
|
||||
RINOK(Archive_IsItem_AltStream(archive, realIndex, isAltStream))
|
||||
if (!isAltStream)
|
||||
hardIDs.Add(h);
|
||||
{
|
||||
bool isDir = false;
|
||||
RINOK(Archive_IsItem_Dir(archive, realIndex, isDir))
|
||||
if (!isDir)
|
||||
hardIDs.Add(h);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -275,7 +280,7 @@ CArchiveExtractCallback::CArchiveExtractCallback():
|
||||
LocalProgressSpec = new CLocalProgress();
|
||||
_localProgress = LocalProgressSpec;
|
||||
|
||||
#ifdef _USE_SECURITY_CODE
|
||||
#ifdef Z7_USE_SECURITY_CODE
|
||||
_saclEnabled = InitLocalPrivileges();
|
||||
#endif
|
||||
}
|
||||
@@ -325,16 +330,18 @@ void CArchiveExtractCallback::Init(
|
||||
|
||||
_extractCallback2 = extractCallback2;
|
||||
|
||||
/*
|
||||
_compressProgress.Release();
|
||||
_extractCallback2.QueryInterface(IID_ICompressProgressInfo, &_compressProgress);
|
||||
|
||||
_callbackMessage.Release();
|
||||
_extractCallback2.QueryInterface(IID_IArchiveExtractCallbackMessage, &_callbackMessage);
|
||||
_extractCallback2.QueryInterface(IID_IArchiveExtractCallbackMessage2, &_callbackMessage);
|
||||
*/
|
||||
|
||||
_folderArchiveExtractCallback2.Release();
|
||||
_extractCallback2.QueryInterface(IID_IFolderArchiveExtractCallback2, &_folderArchiveExtractCallback2);
|
||||
|
||||
#ifndef _SFX
|
||||
#ifndef Z7_SFX
|
||||
|
||||
ExtractToStreamCallback.Release();
|
||||
_extractCallback2.QueryInterface(IID_IFolderExtractToStreamCallback, &ExtractToStreamCallback);
|
||||
@@ -355,7 +362,7 @@ void CArchiveExtractCallback::Init(
|
||||
_removePathParts = removePathParts;
|
||||
_removePartsForAltStreams = removePartsForAltStreams;
|
||||
|
||||
#ifndef _SFX
|
||||
#ifndef Z7_SFX
|
||||
_baseParentFolder = (UInt32)(Int32)-1;
|
||||
_use_baseParentFolder_mode = false;
|
||||
#endif
|
||||
@@ -374,7 +381,7 @@ void CArchiveExtractCallback::Init(
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::SetTotal(UInt64 size)
|
||||
Z7_COM7F_IMF(CArchiveExtractCallback::SetTotal(UInt64 size))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
_progressTotal = size;
|
||||
@@ -407,7 +414,7 @@ static UInt64 MyMultDiv64(UInt64 unpCur, UInt64 unpTotal, UInt64 packTotal)
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::SetCompleted(const UInt64 *completeValue)
|
||||
Z7_COM7F_IMF(CArchiveExtractCallback::SetCompleted(const UInt64 *completeValue))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
|
||||
@@ -428,7 +435,7 @@ STDMETHODIMP CArchiveExtractCallback::SetCompleted(const UInt64 *completeValue)
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
|
||||
Z7_COM7F_IMF(CArchiveExtractCallback::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
return _localProgress->SetRatioInfo(inSize, outSize);
|
||||
@@ -510,7 +517,7 @@ HRESULT CArchiveExtractCallback::GetTime(UInt32 index, PROPID propID, CArcTime &
|
||||
{
|
||||
ft.Clear();
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(_arc->Archive->GetProperty(index, propID, &prop));
|
||||
RINOK(_arc->Archive->GetProperty(index, propID, &prop))
|
||||
if (prop.vt == VT_FILETIME)
|
||||
ft.Set_From_Prop(prop);
|
||||
else if (prop.vt != VT_EMPTY)
|
||||
@@ -521,7 +528,7 @@ HRESULT CArchiveExtractCallback::GetTime(UInt32 index, PROPID propID, CArcTime &
|
||||
|
||||
HRESULT CArchiveExtractCallback::GetUnpackSize()
|
||||
{
|
||||
return _arc->GetItem_Size(_index, _curSize, _curSizeDefined);
|
||||
return _arc->GetItem_Size(_index, _curSize, _curSize_Defined);
|
||||
}
|
||||
|
||||
static void AddPathToMessage(UString &s, const FString &path)
|
||||
@@ -564,9 +571,9 @@ HRESULT CArchiveExtractCallback::SendMessageError2(HRESULT errorCode, const char
|
||||
return _extractCallback2->MessageError(s);
|
||||
}
|
||||
|
||||
#ifndef _SFX
|
||||
#ifndef Z7_SFX
|
||||
|
||||
STDMETHODIMP CGetProp::GetProp(PROPID propID, PROPVARIANT *value)
|
||||
Z7_COM7F_IMF(CGetProp::GetProp(PROPID propID, PROPVARIANT *value))
|
||||
{
|
||||
/*
|
||||
if (propID == kpidName)
|
||||
@@ -581,7 +588,7 @@ STDMETHODIMP CGetProp::GetProp(PROPID propID, PROPVARIANT *value)
|
||||
return Arc->Archive->GetProperty(IndexInArc, propID, value);
|
||||
}
|
||||
|
||||
#endif // _SFX
|
||||
#endif // Z7_SFX
|
||||
|
||||
|
||||
#ifdef SUPPORT_LINKS
|
||||
@@ -749,15 +756,15 @@ HRESULT CArchiveExtractCallback::MyCopyFile(ISequentialOutStream *outStream)
|
||||
NIO::CInFile inFile;
|
||||
NIO::COutFile outFile;
|
||||
|
||||
if (!inFile.Open(_CopyFile_Path))
|
||||
return SendMessageError_with_LastError("Open error", _CopyFile_Path);
|
||||
if (!inFile.Open(_copyFile_Path))
|
||||
return SendMessageError_with_LastError("Open error", _copyFile_Path);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
UInt32 num;
|
||||
|
||||
if (!inFile.Read(buf.Buf, kBufSize, num))
|
||||
return SendMessageError_with_LastError("Read error", _CopyFile_Path);
|
||||
return SendMessageError_with_LastError("Read error", _copyFile_Path);
|
||||
|
||||
if (num == 0)
|
||||
return S_OK;
|
||||
@@ -777,7 +784,7 @@ HRESULT CArchiveExtractCallback::ReadLink()
|
||||
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, kpidHardLink, &prop));
|
||||
RINOK(archive->GetProperty(index, kpidHardLink, &prop))
|
||||
if (prop.vt == VT_BSTR)
|
||||
{
|
||||
_link.isHardLink = true;
|
||||
@@ -807,7 +814,7 @@ HRESULT CArchiveExtractCallback::ReadLink()
|
||||
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, kpidSymLink, &prop));
|
||||
RINOK(archive->GetProperty(index, kpidSymLink, &prop))
|
||||
if (prop.vt == VT_BSTR)
|
||||
{
|
||||
_link.isHardLink = false;
|
||||
@@ -937,7 +944,7 @@ static HRESULT GetOwner(IInArchive *archive,
|
||||
{
|
||||
{
|
||||
NWindows::NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, pidId, &prop));
|
||||
RINOK(archive->GetProperty(index, pidId, &prop))
|
||||
if (prop.vt == VT_UI4)
|
||||
{
|
||||
res.Id_Defined = true;
|
||||
@@ -951,7 +958,7 @@ static HRESULT GetOwner(IInArchive *archive,
|
||||
}
|
||||
{
|
||||
NWindows::NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, pidName, &prop));
|
||||
RINOK(archive->GetProperty(index, pidName, &prop))
|
||||
if (prop.vt == VT_BSTR)
|
||||
{
|
||||
const UString s = prop.bstrVal;
|
||||
@@ -981,11 +988,11 @@ HRESULT CArchiveExtractCallback::Read_fi_Props()
|
||||
#ifndef _WIN32
|
||||
_fi.Owner.Clear();
|
||||
_fi.Group.Clear();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, kpidPosixAttrib, &prop));
|
||||
RINOK(archive->GetProperty(index, kpidPosixAttrib, &prop))
|
||||
if (prop.vt == VT_UI4)
|
||||
{
|
||||
_fi.SetFromPosixAttrib(prop.ulVal);
|
||||
@@ -996,7 +1003,7 @@ HRESULT CArchiveExtractCallback::Read_fi_Props()
|
||||
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, kpidAttrib, &prop));
|
||||
RINOK(archive->GetProperty(index, kpidAttrib, &prop))
|
||||
if (prop.vt == VT_UI4)
|
||||
{
|
||||
_fi.Attrib = prop.ulVal;
|
||||
@@ -1006,9 +1013,9 @@ HRESULT CArchiveExtractCallback::Read_fi_Props()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
RINOK(GetTime(index, kpidCTime, _fi.CTime));
|
||||
RINOK(GetTime(index, kpidATime, _fi.ATime));
|
||||
RINOK(GetTime(index, kpidMTime, _fi.MTime));
|
||||
RINOK(GetTime(index, kpidCTime, _fi.CTime))
|
||||
RINOK(GetTime(index, kpidATime, _fi.ATime))
|
||||
RINOK(GetTime(index, kpidMTime, _fi.MTime))
|
||||
|
||||
#ifndef _WIN32
|
||||
if (_ntOptions.ExtractOwner)
|
||||
@@ -1104,9 +1111,19 @@ void CArchiveExtractCallback::CreateFolders()
|
||||
// 21.04 : we don't change original (_item.PathParts) here
|
||||
UStringVector pathParts = _item.PathParts;
|
||||
|
||||
if (!_item.IsDir)
|
||||
if (!pathParts.IsEmpty())
|
||||
{
|
||||
if (!pathParts.IsEmpty())
|
||||
/* v23: if we extract symlink, and we know that it links to dir:
|
||||
Linux: we don't create dir item (symlink_from_path) here.
|
||||
Windows: SetReparseData() will create dir item, if it doesn't exist,
|
||||
but if we create dir item here, it's not problem. */
|
||||
if (!_item.IsDir
|
||||
#ifdef SUPPORT_LINKS
|
||||
#ifndef WIN32
|
||||
|| !_link.linkPath.IsEmpty()
|
||||
#endif
|
||||
#endif
|
||||
)
|
||||
pathParts.DeleteBack();
|
||||
}
|
||||
|
||||
@@ -1167,7 +1184,7 @@ HRESULT CArchiveExtractCallback::CheckExistFile(FString &fullProcessedPath, bool
|
||||
RINOK(_extractCallback2->AskOverwrite(
|
||||
fs2us(realFullProcessedPath), &ft1, &fileInfo.Size, _item.Path,
|
||||
_fi.MTime.Def ? &_fi.MTime.FT : NULL,
|
||||
_curSizeDefined ? &_curSize : NULL,
|
||||
_curSize_Defined ? &_curSize : NULL,
|
||||
&overwriteResult))
|
||||
|
||||
switch (overwriteResult)
|
||||
@@ -1197,7 +1214,7 @@ HRESULT CArchiveExtractCallback::CheckExistFile(FString &fullProcessedPath, bool
|
||||
{
|
||||
if (!AutoRenamePath(fullProcessedPath))
|
||||
{
|
||||
RINOK(SendMessageError(kCantAutoRename, fullProcessedPath));
|
||||
RINOK(SendMessageError(kCantAutoRename, fullProcessedPath))
|
||||
return E_FAIL;
|
||||
}
|
||||
_isRenamed = true;
|
||||
@@ -1207,14 +1224,14 @@ HRESULT CArchiveExtractCallback::CheckExistFile(FString &fullProcessedPath, bool
|
||||
FString existPath (fullProcessedPath);
|
||||
if (!AutoRenamePath(existPath))
|
||||
{
|
||||
RINOK(SendMessageError(kCantAutoRename, fullProcessedPath));
|
||||
RINOK(SendMessageError(kCantAutoRename, fullProcessedPath))
|
||||
return E_FAIL;
|
||||
}
|
||||
// MyMoveFile can rename folders. So it's OK to use it for folders too
|
||||
if (!MyMoveFile(fullProcessedPath, existPath))
|
||||
{
|
||||
HRESULT errorCode = GetLastError_noZero_HRESULT();
|
||||
RINOK(SendMessageError2(errorCode, kCantRenameFile, existPath, fullProcessedPath));
|
||||
RINOK(SendMessageError2(errorCode, kCantRenameFile, existPath, fullProcessedPath))
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
@@ -1225,7 +1242,7 @@ HRESULT CArchiveExtractCallback::CheckExistFile(FString &fullProcessedPath, bool
|
||||
// do we need to delete all files in folder?
|
||||
if (!RemoveDir(fullProcessedPath))
|
||||
{
|
||||
RINOK(SendMessageError_with_LastError(kCantDeleteOutputDir, fullProcessedPath));
|
||||
RINOK(SendMessageError_with_LastError(kCantDeleteOutputDir, fullProcessedPath))
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
@@ -1235,7 +1252,7 @@ HRESULT CArchiveExtractCallback::CheckExistFile(FString &fullProcessedPath, bool
|
||||
if (!DeleteFileAlways(fullProcessedPath))
|
||||
if (GetLastError() != ERROR_FILE_NOT_FOUND) // check it in linux
|
||||
{
|
||||
RINOK(SendMessageError_with_LastError(kCantDeleteOutputFile, fullProcessedPath));
|
||||
RINOK(SendMessageError_with_LastError(kCantDeleteOutputFile, fullProcessedPath))
|
||||
return S_OK;
|
||||
// return E_FAIL;
|
||||
}
|
||||
@@ -1274,7 +1291,7 @@ HRESULT CArchiveExtractCallback::GetExtractStream(CMyComPtr<ISequentialOutStream
|
||||
{
|
||||
needExit = true;
|
||||
|
||||
RINOK(Read_fi_Props());
|
||||
RINOK(Read_fi_Props())
|
||||
|
||||
#ifdef SUPPORT_LINKS
|
||||
IInArchive *archive = _arc->Archive;
|
||||
@@ -1283,7 +1300,7 @@ HRESULT CArchiveExtractCallback::GetExtractStream(CMyComPtr<ISequentialOutStream
|
||||
const UInt32 index = _index;
|
||||
|
||||
bool isAnti = false;
|
||||
RINOK(_arc->IsItem_Anti(index, isAnti));
|
||||
RINOK(_arc->IsItem_Anti(index, isAnti))
|
||||
|
||||
CorrectPathParts();
|
||||
UString processedPath (MakePathFromParts(_item.PathParts));
|
||||
@@ -1333,7 +1350,7 @@ HRESULT CArchiveExtractCallback::GetExtractStream(CMyComPtr<ISequentialOutStream
|
||||
}
|
||||
else if (!_isSplit)
|
||||
{
|
||||
RINOK(CheckExistFile(fullProcessedPath, needExit));
|
||||
RINOK(CheckExistFile(fullProcessedPath, needExit))
|
||||
if (needExit)
|
||||
return S_OK;
|
||||
needExit = true;
|
||||
@@ -1357,7 +1374,7 @@ HRESULT CArchiveExtractCallback::GetExtractStream(CMyComPtr<ISequentialOutStream
|
||||
#ifndef UNDER_CE
|
||||
{
|
||||
bool linkWasSet = false;
|
||||
RINOK(SetFromLinkPath(fullProcessedPath, _link, linkWasSet));
|
||||
RINOK(SetFromLinkPath(fullProcessedPath, _link, linkWasSet))
|
||||
if (linkWasSet)
|
||||
{
|
||||
_isSymLinkCreated = _link.IsSymLink();
|
||||
@@ -1367,18 +1384,18 @@ HRESULT CArchiveExtractCallback::GetExtractStream(CMyComPtr<ISequentialOutStream
|
||||
}
|
||||
#endif // UNDER_CE
|
||||
|
||||
// if (_CopyFile_Path.IsEmpty())
|
||||
// if (_copyFile_Path.IsEmpty())
|
||||
{
|
||||
needExit = false;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_hardLinks.IDs.IsEmpty() && !_item.IsAltStream)
|
||||
if (!_hardLinks.IDs.IsEmpty() && !_item.IsAltStream && !_item.IsDir)
|
||||
{
|
||||
CHardLinkNode h;
|
||||
bool defined;
|
||||
RINOK(Archive_Get_HardLinkNode(archive, index, h, defined));
|
||||
RINOK(Archive_Get_HardLinkNode(archive, index, h, defined))
|
||||
if (defined)
|
||||
{
|
||||
const int linkIndex = _hardLinks.IDs.FindInSorted2(h);
|
||||
@@ -1392,7 +1409,7 @@ HRESULT CArchiveExtractCallback::GetExtractStream(CMyComPtr<ISequentialOutStream
|
||||
if (!MyCreateHardLink(fullProcessedPath, hl))
|
||||
{
|
||||
HRESULT errorCode = GetLastError_noZero_HRESULT();
|
||||
RINOK(SendMessageError2(errorCode, kCantCreateHardLink, fullProcessedPath, hl));
|
||||
RINOK(SendMessageError2(errorCode, kCantCreateHardLink, fullProcessedPath, hl))
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -1412,13 +1429,13 @@ HRESULT CArchiveExtractCallback::GetExtractStream(CMyComPtr<ISequentialOutStream
|
||||
// ---------- CREATE WRITE FILE -----
|
||||
|
||||
_outFileStreamSpec = new COutFileStream;
|
||||
CMyComPtr<ISequentialOutStream> outFileStream_Loc(_outFileStreamSpec);
|
||||
CMyComPtr<IOutStream> outFileStream_Loc(_outFileStreamSpec);
|
||||
|
||||
if (!_outFileStreamSpec->Open(fullProcessedPath, _isSplit ? OPEN_ALWAYS: CREATE_ALWAYS))
|
||||
{
|
||||
// if (::GetLastError() != ERROR_FILE_EXISTS || !isSplit)
|
||||
{
|
||||
RINOK(SendMessageError_with_LastError(kCantOpenOutFile, fullProcessedPath));
|
||||
RINOK(SendMessageError_with_LastError(kCantOpenOutFile, fullProcessedPath))
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
@@ -1427,7 +1444,7 @@ HRESULT CArchiveExtractCallback::GetExtractStream(CMyComPtr<ISequentialOutStream
|
||||
|
||||
bool is_SymLink_in_Data = false;
|
||||
|
||||
if (_curSizeDefined && _curSize > 0 && _curSize < (1 << 12))
|
||||
if (_curSize_Defined && _curSize > 0 && _curSize < (1 << 12))
|
||||
{
|
||||
if (_fi.IsLinuxSymLink())
|
||||
{
|
||||
@@ -1451,18 +1468,18 @@ HRESULT CArchiveExtractCallback::GetExtractStream(CMyComPtr<ISequentialOutStream
|
||||
}
|
||||
else // not reprase
|
||||
{
|
||||
if (_ntOptions.PreAllocateOutFile && !_isSplit && _curSizeDefined && _curSize > (1 << 12))
|
||||
if (_ntOptions.PreAllocateOutFile && !_isSplit && _curSize_Defined && _curSize > (1 << 12))
|
||||
{
|
||||
// UInt64 ticks = GetCpuTicks();
|
||||
_fileLength_that_WasSet = _curSize;
|
||||
bool res = _outFileStreamSpec->File.SetLength(_curSize);
|
||||
_fileLengthWasSet = res;
|
||||
_fileLength_WasSet = res;
|
||||
|
||||
// ticks = GetCpuTicks() - ticks;
|
||||
// printf("\nticks = %10d\n", (unsigned)ticks);
|
||||
if (!res)
|
||||
{
|
||||
RINOK(SendMessageError_with_LastError(kCantSetFileLen, fullProcessedPath));
|
||||
RINOK(SendMessageError_with_LastError(kCantSetFileLen, fullProcessedPath))
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1484,7 +1501,7 @@ HRESULT CArchiveExtractCallback::GetExtractStream(CMyComPtr<ISequentialOutStream
|
||||
res = _outFileStreamSpec->SeekToBegin_bool();
|
||||
if (!res)
|
||||
{
|
||||
RINOK(SendMessageError_with_LastError("Cannot seek to begin of file", fullProcessedPath));
|
||||
RINOK(SendMessageError_with_LastError("Cannot seek to begin of file", fullProcessedPath))
|
||||
}
|
||||
} // PreAllocateOutFile
|
||||
|
||||
@@ -1501,7 +1518,7 @@ HRESULT CArchiveExtractCallback::GetExtractStream(CMyComPtr<ISequentialOutStream
|
||||
|
||||
if (_isSplit)
|
||||
{
|
||||
RINOK(_outFileStreamSpec->Seek((Int64)_position, STREAM_SEEK_SET, NULL));
|
||||
RINOK(outFileStream_Loc->Seek((Int64)_position, STREAM_SEEK_SET, NULL))
|
||||
}
|
||||
outStreamLoc = outFileStream_Loc;
|
||||
} // if not reprase
|
||||
@@ -1516,7 +1533,7 @@ HRESULT CArchiveExtractCallback::GetExtractStream(CMyComPtr<ISequentialOutStream
|
||||
|
||||
HRESULT CArchiveExtractCallback::GetItem(UInt32 index)
|
||||
{
|
||||
#ifndef _SFX
|
||||
#ifndef Z7_SFX
|
||||
_item._use_baseParentFolder_mode = _use_baseParentFolder_mode;
|
||||
if (_use_baseParentFolder_mode)
|
||||
{
|
||||
@@ -1525,7 +1542,7 @@ HRESULT CArchiveExtractCallback::GetItem(UInt32 index)
|
||||
_pathMode == NExtract::NPathMode::kAbsPaths)
|
||||
_item._baseParentFolder = -1;
|
||||
}
|
||||
#endif // _SFX
|
||||
#endif // Z7_SFX
|
||||
|
||||
#ifdef SUPPORT_ALT_STREAMS
|
||||
_item.WriteToAltStreamIfColon = _ntOptions.WriteToAltStreamIfColon;
|
||||
@@ -1535,13 +1552,13 @@ HRESULT CArchiveExtractCallback::GetItem(UInt32 index)
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode)
|
||||
Z7_COM7F_IMF(CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
|
||||
*outStream = NULL;
|
||||
|
||||
#ifndef _SFX
|
||||
#ifndef Z7_SFX
|
||||
if (_hashStream)
|
||||
_hashStreamSpec->ReleaseStream();
|
||||
_hashStreamWasUsed = false;
|
||||
@@ -1555,8 +1572,8 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
_isSplit = false;
|
||||
|
||||
_curSize = 0;
|
||||
_curSizeDefined = false;
|
||||
_fileLengthWasSet = false;
|
||||
_curSize_Defined = false;
|
||||
_fileLength_WasSet = false;
|
||||
_fileLength_that_WasSet = 0;
|
||||
_index = index;
|
||||
|
||||
@@ -1574,7 +1591,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
_itemFailure = false;
|
||||
|
||||
#ifdef SUPPORT_LINKS
|
||||
// _CopyFile_Path.Empty();
|
||||
// _copyFile_Path.Empty();
|
||||
_link.Clear();
|
||||
#endif
|
||||
|
||||
@@ -1590,16 +1607,16 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
else
|
||||
_extractMode = true;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
IInArchive *archive = _arc->Archive;
|
||||
|
||||
RINOK(GetItem(index));
|
||||
RINOK(GetItem(index))
|
||||
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, kpidPosition, &prop));
|
||||
RINOK(archive->GetProperty(index, kpidPosition, &prop))
|
||||
if (prop.vt != VT_EMPTY)
|
||||
{
|
||||
if (prop.vt != VT_UI8)
|
||||
@@ -1610,13 +1627,13 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
}
|
||||
|
||||
#ifdef SUPPORT_LINKS
|
||||
RINOK(ReadLink());
|
||||
RINOK(ReadLink())
|
||||
#endif // SUPPORT_LINKS
|
||||
|
||||
|
||||
RINOK(Archive_GetItemBoolProp(archive, index, kpidEncrypted, _encrypted));
|
||||
RINOK(Archive_GetItemBoolProp(archive, index, kpidEncrypted, _encrypted))
|
||||
|
||||
RINOK(GetUnpackSize());
|
||||
RINOK(GetUnpackSize())
|
||||
|
||||
#ifdef SUPPORT_ALT_STREAMS
|
||||
if (!_ntOptions.AltStreams.Val && _item.IsAltStream)
|
||||
@@ -1632,7 +1649,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#ifndef _SFX
|
||||
#ifndef Z7_SFX
|
||||
if (_use_baseParentFolder_mode)
|
||||
{
|
||||
if (!pathParts.IsEmpty())
|
||||
@@ -1651,7 +1668,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif // _SFX
|
||||
#endif // Z7_SFX
|
||||
{
|
||||
if (pathParts.IsEmpty())
|
||||
{
|
||||
@@ -1734,12 +1751,8 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
numRemovePathParts = pathParts.Size() - 1;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
case NExtract::NPathMode::kFullPaths:
|
||||
case NExtract::NPathMode::kAbsPaths:
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
// default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1747,7 +1760,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
}
|
||||
|
||||
|
||||
#ifndef _SFX
|
||||
#ifndef Z7_SFX
|
||||
|
||||
if (ExtractToStreamCallback)
|
||||
{
|
||||
@@ -1772,7 +1785,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
return ExtractToStreamCallback->GetStream7(name, BoolToInt(_item.IsDir), outStream, askExtractMode, GetProp);
|
||||
}
|
||||
|
||||
#endif // _SFX
|
||||
#endif // Z7_SFX
|
||||
|
||||
|
||||
CMyComPtr<ISequentialOutStream> outStreamLoc;
|
||||
@@ -1784,13 +1797,13 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
else
|
||||
{
|
||||
bool needExit = true;
|
||||
RINOK(GetExtractStream(outStreamLoc, needExit));
|
||||
RINOK(GetExtractStream(outStreamLoc, needExit))
|
||||
if (needExit)
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _SFX
|
||||
#ifndef Z7_SFX
|
||||
if (_hashStream)
|
||||
{
|
||||
if (askExtractMode == NArchive::NExtract::NAskMode::kExtract ||
|
||||
@@ -1802,13 +1815,13 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
_hashStreamWasUsed = true;
|
||||
}
|
||||
}
|
||||
#endif // _SFX
|
||||
#endif // Z7_SFX
|
||||
|
||||
if (outStreamLoc)
|
||||
{
|
||||
/*
|
||||
#ifdef SUPPORT_LINKS
|
||||
if (!_CopyFile_Path.IsEmpty())
|
||||
if (!_copyFile_Path.IsEmpty())
|
||||
{
|
||||
RINOK(PrepareOperation(askExtractMode));
|
||||
RINOK(MyCopyFile(outStreamLoc));
|
||||
@@ -1836,11 +1849,11 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
|
||||
Z7_COM7F_IMF(CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
|
||||
#ifndef _SFX
|
||||
#ifndef Z7_SFX
|
||||
if (ExtractToStreamCallback)
|
||||
return ExtractToStreamCallback->PrepareOperation7(askExtractMode);
|
||||
#endif
|
||||
@@ -1855,10 +1868,10 @@ STDMETHODIMP CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
|
||||
else
|
||||
_extractMode = true;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
return _extractCallback2->PrepareOperation(_item.Path, BoolToInt(_item.IsDir),
|
||||
askExtractMode, _isSplit ? &_position: 0);
|
||||
askExtractMode, _isSplit ? &_position: NULL);
|
||||
|
||||
COM_TRY_END
|
||||
}
|
||||
@@ -1875,28 +1888,28 @@ HRESULT CArchiveExtractCallback::CloseFile()
|
||||
HRESULT hres = S_OK;
|
||||
|
||||
const UInt64 processedSize = _outFileStreamSpec->ProcessedSize;
|
||||
if (_fileLengthWasSet && _fileLength_that_WasSet > processedSize)
|
||||
if (_fileLength_WasSet && _fileLength_that_WasSet > processedSize)
|
||||
{
|
||||
bool res = _outFileStreamSpec->File.SetLength(processedSize);
|
||||
_fileLengthWasSet = res;
|
||||
const bool res = _outFileStreamSpec->File.SetLength(processedSize);
|
||||
_fileLength_WasSet = res;
|
||||
if (!res)
|
||||
{
|
||||
HRESULT hres2 = SendMessageError_with_LastError(kCantSetFileLen, us2fs(_item.Path));
|
||||
const HRESULT hres2 = SendMessageError_with_LastError(kCantSetFileLen, us2fs(_item.Path));
|
||||
if (hres == S_OK)
|
||||
hres = hres2;
|
||||
}
|
||||
}
|
||||
|
||||
_curSize = processedSize;
|
||||
_curSizeDefined = true;
|
||||
_curSize_Defined = true;
|
||||
|
||||
#if defined(_WIN32) && !defined(UNDER_CE) && !defined(_SFX)
|
||||
#if defined(_WIN32) && !defined(UNDER_CE) && !defined(Z7_SFX)
|
||||
if (ZoneBuf.Size() != 0
|
||||
&& !_item.IsAltStream)
|
||||
{
|
||||
// if (NFind::DoesFileExist_Raw(tempFilePath))
|
||||
if (ZoneMode != NExtract::NZoneIdMode::kOffice ||
|
||||
FindExt2(kOfficeExtensions, _diskFilePath))
|
||||
FindExt2(kOfficeExtensions, fs2us(_diskFilePath)))
|
||||
{
|
||||
// we must write zone file before setting of timestamps
|
||||
const FString path = _diskFilePath + k_ZoneId_StreamName;
|
||||
@@ -1920,7 +1933,7 @@ HRESULT CArchiveExtractCallback::CloseFile()
|
||||
t.MTime_Defined ? &t.MTime : NULL);
|
||||
// #endif
|
||||
|
||||
RINOK(_outFileStreamSpec->Close());
|
||||
RINOK(_outFileStreamSpec->Close())
|
||||
_outFileStream.Release();
|
||||
return hres;
|
||||
}
|
||||
@@ -1964,7 +1977,7 @@ HRESULT CArchiveExtractCallback::SetFromLinkPath(
|
||||
{
|
||||
if (!NName::GetFullPath(_dirPathPrefix_Full, us2fs(relatPath), existPath))
|
||||
{
|
||||
RINOK(SendMessageError("Incorrect path", us2fs(relatPath)));
|
||||
RINOK(SendMessageError("Incorrect path", us2fs(relatPath)))
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1982,8 +1995,8 @@ HRESULT CArchiveExtractCallback::SetFromLinkPath(
|
||||
{
|
||||
if (!MyCreateHardLink(fullProcessedPath, existPath))
|
||||
{
|
||||
HRESULT errorCode = GetLastError_noZero_HRESULT();
|
||||
RINOK(SendMessageError2(errorCode, kCantCreateHardLink, fullProcessedPath, existPath));
|
||||
const HRESULT errorCode = GetLastError_noZero_HRESULT();
|
||||
RINOK(SendMessageError2(errorCode, kCantCreateHardLink, fullProcessedPath, existPath))
|
||||
}
|
||||
linkWasSet = true;
|
||||
return S_OK;
|
||||
@@ -1998,8 +2011,8 @@ HRESULT CArchiveExtractCallback::SetFromLinkPath(
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_curSizeDefined && _curSize == fi.Size)
|
||||
_CopyFile_Path = existPath;
|
||||
if (_curSize_Defined && _curSize == fi.Size)
|
||||
_copyFile_Path = existPath;
|
||||
else
|
||||
{
|
||||
RINOK(SendMessageError2("File size collision for file copying", existPath, fullProcessedPath));
|
||||
@@ -2060,12 +2073,12 @@ HRESULT CArchiveExtractCallback::SetFromLinkPath(
|
||||
CReparseAttr attr;
|
||||
if (!attr.Parse(data, data.Size()))
|
||||
{
|
||||
RINOK(SendMessageError("Internal error for symbolic link file", us2fs(_item.Path)));
|
||||
RINOK(SendMessageError("Internal error for symbolic link file", us2fs(_item.Path)))
|
||||
return S_OK;
|
||||
}
|
||||
if (!NFile::NIO::SetReparseData(fullProcessedPath, _item.IsDir, data, (DWORD)data.Size()))
|
||||
{
|
||||
RINOK(SendMessageError_with_LastError(kCantCreateSymLink, fullProcessedPath));
|
||||
RINOK(SendMessageError_with_LastError(kCantCreateSymLink, fullProcessedPath))
|
||||
return S_OK;
|
||||
}
|
||||
linkWasSet = true;
|
||||
@@ -2077,7 +2090,7 @@ HRESULT CArchiveExtractCallback::SetFromLinkPath(
|
||||
|
||||
if (!NFile::NIO::SetSymLink(fullProcessedPath, existPath))
|
||||
{
|
||||
RINOK(SendMessageError_with_LastError(kCantCreateSymLink, fullProcessedPath));
|
||||
RINOK(SendMessageError_with_LastError(kCantCreateSymLink, fullProcessedPath))
|
||||
return S_OK;
|
||||
}
|
||||
linkWasSet = true;
|
||||
@@ -2110,7 +2123,7 @@ bool CLinkInfo::Parse(const Byte *data, size_t dataSize, bool isLinuxData)
|
||||
// if windows link was created, then we also must use linux separator
|
||||
if (u.IsEmpty())
|
||||
return false;
|
||||
wchar_t c = u[0];
|
||||
const wchar_t c = u[0];
|
||||
isRelative = !IS_PATH_SEPAR(c);
|
||||
return true;
|
||||
}
|
||||
@@ -2157,7 +2170,7 @@ HRESULT CArchiveExtractCallback::CloseReparseAndFile()
|
||||
{
|
||||
repraseMode = true;
|
||||
reparseSize = _bufPtrSeqOutStream_Spec->GetPos();
|
||||
if (_curSizeDefined && reparseSize == _outMemBuf.Size())
|
||||
if (_curSize_Defined && reparseSize == _outMemBuf.Size())
|
||||
{
|
||||
/*
|
||||
CReparseAttr reparse;
|
||||
@@ -2181,7 +2194,7 @@ HRESULT CArchiveExtractCallback::CloseReparseAndFile()
|
||||
}
|
||||
if (!needSetReparse && _outFileStream)
|
||||
{
|
||||
HRESULT res2 = WriteStream(_outFileStream, _outMemBuf, reparseSize);
|
||||
const HRESULT res2 = WriteStream(_outFileStream, _outMemBuf, reparseSize);
|
||||
if (res == S_OK)
|
||||
res = res2;
|
||||
}
|
||||
@@ -2191,18 +2204,18 @@ HRESULT CArchiveExtractCallback::CloseReparseAndFile()
|
||||
#endif // SUPPORT_LINKS
|
||||
|
||||
|
||||
HRESULT res2 = CloseFile();
|
||||
const HRESULT res2 = CloseFile();
|
||||
|
||||
if (res == S_OK)
|
||||
res = res2;
|
||||
|
||||
RINOK(res);
|
||||
RINOK(res)
|
||||
|
||||
#ifdef SUPPORT_LINKS
|
||||
if (repraseMode)
|
||||
{
|
||||
_curSize = reparseSize;
|
||||
_curSizeDefined = true;
|
||||
_curSize_Defined = true;
|
||||
|
||||
#ifdef SUPPORT_LINKS
|
||||
if (needSetReparse)
|
||||
@@ -2211,19 +2224,19 @@ HRESULT CArchiveExtractCallback::CloseReparseAndFile()
|
||||
// in Windows : we can create symbolic link even without file deleting
|
||||
if (!DeleteFileAlways(_diskFilePath))
|
||||
{
|
||||
RINOK(SendMessageError_with_LastError("can't delete file", _diskFilePath));
|
||||
RINOK(SendMessageError_with_LastError("can't delete file", _diskFilePath))
|
||||
}
|
||||
{
|
||||
/*
|
||||
// for DEBUG ONLY: we can extract sym links as WSL links
|
||||
// to elimanate (non-admin) errors for sym links.
|
||||
// to eliminate (non-admin) errors for sym links.
|
||||
#ifdef _WIN32
|
||||
if (!linkInfo.isHardLink && !linkInfo.isJunction)
|
||||
linkInfo.isWSL = true;
|
||||
#endif
|
||||
*/
|
||||
bool linkWasSet = false;
|
||||
RINOK(SetFromLinkPath(_diskFilePath, linkInfo, linkWasSet));
|
||||
RINOK(SetFromLinkPath(_diskFilePath, linkInfo, linkWasSet))
|
||||
if (linkWasSet)
|
||||
_isSymLinkCreated = linkInfo.IsSymLink();
|
||||
else
|
||||
@@ -2282,13 +2295,13 @@ void CArchiveExtractCallback::SetAttrib()
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 opRes)
|
||||
Z7_COM7F_IMF(CArchiveExtractCallback::SetOperationResult(Int32 opRes))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
|
||||
// printf("\nCArchiveExtractCallback::SetOperationResult: %d %s\n", opRes, GetAnsiString(_diskFilePath));
|
||||
|
||||
#ifndef _SFX
|
||||
#ifndef Z7_SFX
|
||||
if (ExtractToStreamCallback)
|
||||
{
|
||||
GetUnpackSize();
|
||||
@@ -2296,7 +2309,7 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 opRes)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef _SFX
|
||||
#ifndef Z7_SFX
|
||||
|
||||
if (_hashStreamWasUsed)
|
||||
{
|
||||
@@ -2308,16 +2321,16 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 opRes)
|
||||
#endif
|
||||
, _item.Path);
|
||||
_curSize = _hashStreamSpec->GetSize();
|
||||
_curSizeDefined = true;
|
||||
_curSize_Defined = true;
|
||||
_hashStreamSpec->ReleaseStream();
|
||||
_hashStreamWasUsed = false;
|
||||
}
|
||||
|
||||
#endif // _SFX
|
||||
#endif // Z7_SFX
|
||||
|
||||
RINOK(CloseReparseAndFile());
|
||||
RINOK(CloseReparseAndFile())
|
||||
|
||||
#ifdef _USE_SECURITY_CODE
|
||||
#ifdef Z7_USE_SECURITY_CODE
|
||||
if (!_stdOutMode && _extractMode && _ntOptions.NtSecurity.Val && _arc->GetRawProps)
|
||||
{
|
||||
const void *data;
|
||||
@@ -2337,12 +2350,12 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 opRes)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // _USE_SECURITY_CODE
|
||||
#endif // Z7_USE_SECURITY_CODE
|
||||
|
||||
if (!_curSizeDefined)
|
||||
if (!_curSize_Defined)
|
||||
GetUnpackSize();
|
||||
|
||||
if (_curSizeDefined)
|
||||
if (_curSize_Defined)
|
||||
{
|
||||
#ifdef SUPPORT_ALT_STREAMS
|
||||
if (_item.IsAltStream)
|
||||
@@ -2364,7 +2377,7 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 opRes)
|
||||
if (_needSetAttrib)
|
||||
SetAttrib();
|
||||
|
||||
RINOK(_extractCallback2->SetOperationResult(opRes, BoolToInt(_encrypted)));
|
||||
RINOK(_extractCallback2->SetOperationResult(opRes, BoolToInt(_encrypted)))
|
||||
|
||||
return S_OK;
|
||||
|
||||
@@ -2373,7 +2386,7 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 opRes)
|
||||
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::ReportExtractResult(UInt32 indexType, UInt32 index, Int32 opRes)
|
||||
Z7_COM7F_IMF(CArchiveExtractCallback::ReportExtractResult(UInt32 indexType, UInt32 index, Int32 opRes))
|
||||
{
|
||||
if (_folderArchiveExtractCallback2)
|
||||
{
|
||||
@@ -2383,9 +2396,9 @@ STDMETHODIMP CArchiveExtractCallback::ReportExtractResult(UInt32 indexType, UInt
|
||||
if (indexType == NArchive::NEventIndexType::kInArcIndex && index != (UInt32)(Int32)-1)
|
||||
{
|
||||
CReadArcItem item;
|
||||
RINOK(_arc->GetItem(index, item));
|
||||
RINOK(_arc->GetItem(index, item))
|
||||
s = item.Path;
|
||||
RINOK(Archive_GetItemBoolProp(_arc->Archive, index, kpidEncrypted, isEncrypted));
|
||||
RINOK(Archive_GetItemBoolProp(_arc->Archive, index, kpidEncrypted, isEncrypted))
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2401,13 +2414,13 @@ STDMETHODIMP CArchiveExtractCallback::ReportExtractResult(UInt32 indexType, UInt
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
|
||||
Z7_COM7F_IMF(CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
if (!_cryptoGetTextPassword)
|
||||
{
|
||||
RINOK(_extractCallback2.QueryInterface(IID_ICryptoGetTextPassword,
|
||||
&_cryptoGetTextPassword));
|
||||
&_cryptoGetTextPassword))
|
||||
}
|
||||
return _cryptoGetTextPassword->CryptoGetTextPassword(password);
|
||||
COM_TRY_END
|
||||
@@ -2435,13 +2448,13 @@ FString CArchiveExtractCallback::Hash_GetFullFilePath()
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::GetDiskProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
|
||||
Z7_COM7F_IMF(CArchiveExtractCallback::GetDiskProperty(UInt32 index, PROPID propID, PROPVARIANT *value))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
NCOM::CPropVariant prop;
|
||||
if (propID == kpidSize)
|
||||
{
|
||||
RINOK(GetItem(index));
|
||||
RINOK(GetItem(index))
|
||||
const FString fullProcessedPath = Hash_GetFullFilePath();
|
||||
NFile::NFind::CFileInfo fi;
|
||||
if (fi.Find_FollowLink(fullProcessedPath))
|
||||
@@ -2454,7 +2467,7 @@ STDMETHODIMP CArchiveExtractCallback::GetDiskProperty(UInt32 index, PROPID propI
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::GetStream2(UInt32 index, ISequentialInStream **inStream, UInt32 mode)
|
||||
Z7_COM7F_IMF(CArchiveExtractCallback::GetStream2(UInt32 index, ISequentialInStream **inStream, UInt32 mode))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
*inStream = NULL;
|
||||
@@ -2462,7 +2475,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream2(UInt32 index, ISequentialInStre
|
||||
if (mode != NUpdateNotifyOp::kHashRead)
|
||||
return E_FAIL;
|
||||
|
||||
RINOK(GetItem(index));
|
||||
RINOK(GetItem(index))
|
||||
const FString fullProcessedPath = Hash_GetFullFilePath();
|
||||
|
||||
CInFileStream *inStreamSpec = new CInFileStream;
|
||||
@@ -2470,7 +2483,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream2(UInt32 index, ISequentialInStre
|
||||
inStreamSpec->Set_PreserveATime(_ntOptions.PreserveATime);
|
||||
if (!inStreamSpec->OpenShared(fullProcessedPath, _ntOptions.OpenShareForWrite))
|
||||
{
|
||||
RINOK(SendMessageError_with_LastError(kCantOpenInFile, fullProcessedPath));
|
||||
RINOK(SendMessageError_with_LastError(kCantOpenInFile, fullProcessedPath))
|
||||
return S_OK;
|
||||
}
|
||||
*inStream = inStreamRef.Detach();
|
||||
@@ -2479,8 +2492,8 @@ STDMETHODIMP CArchiveExtractCallback::GetStream2(UInt32 index, ISequentialInStre
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::ReportOperation(
|
||||
UInt32 /* indexType */, UInt32 /* index */, UInt32 /* op */)
|
||||
Z7_COM7F_IMF(CArchiveExtractCallback::ReportOperation(
|
||||
UInt32 /* indexType */, UInt32 /* index */, UInt32 /* op */))
|
||||
{
|
||||
// COM_TRY_BEGIN
|
||||
return S_OK;
|
||||
@@ -2571,7 +2584,7 @@ HRESULT CArchiveExtractCallback::SetDirsTimes()
|
||||
HRESULT CArchiveExtractCallback::CloseArc()
|
||||
{
|
||||
HRESULT res = CloseReparseAndFile();
|
||||
HRESULT res2 = SetDirsTimes();
|
||||
const HRESULT res2 = SetDirsTimes();
|
||||
if (res == S_OK)
|
||||
res = res2;
|
||||
_arc = NULL;
|
||||
|
||||
Reference in New Issue
Block a user