mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 03:15:00 -06:00
Update to 7-Zip Version 21.07
See: https://sourceforge.net/p/sevenzip/discussion/45797/thread/0a7b47970b/
This commit is contained in:
@@ -3,11 +3,15 @@
|
||||
# IS_X64 = 1
|
||||
# MY_ARCH =
|
||||
# USE_ASM=
|
||||
# USE_JWASM=1
|
||||
|
||||
MY_ARCH_2 = $(MY_ARCH)
|
||||
|
||||
MY_ASM = jwasm
|
||||
MY_ASM = asmc
|
||||
ifdef USE_JWASM
|
||||
MY_ASM = jwasm
|
||||
endif
|
||||
|
||||
|
||||
PROGPATH = $(O)/$(PROG)
|
||||
PROGPATH_STATIC = $(O)/$(PROG)s
|
||||
@@ -95,7 +99,8 @@ ifdef IS_MINGW
|
||||
|
||||
RM = del
|
||||
MY_MKDIR=mkdir
|
||||
LIB2 = -loleaut32 -luuid -ladvapi32 -lUser32
|
||||
LIB2_GUI = -lOle32 -lGdi32 -lComctl32 -lComdlg32
|
||||
LIB2 = -loleaut32 -luuid -ladvapi32 -lUser32 $(LIB2_GUI)
|
||||
|
||||
CXXFLAGS_EXTRA = -DUNICODE -D_UNICODE
|
||||
# -Wno-delete-non-virtual-dtor
|
||||
@@ -126,7 +131,7 @@ CFLAGS = $(MY_ARCH_2) $(LOCAL_FLAGS) $(CFLAGS_BASE2) $(CFLAGS_BASE) $(CC_SHARED)
|
||||
|
||||
ifdef IS_MINGW
|
||||
AFLAGS_ABI = -coff -DABI_CDECL
|
||||
AFLAGS = $(AFLAGS_ABI) -Fo$(O)/$(basename $(<F)).o
|
||||
AFLAGS = -nologo $(AFLAGS_ABI) -Fo$(O)/$(basename $(<F)).o
|
||||
else
|
||||
ifdef IS_X64
|
||||
AFLAGS_ABI = -elf64 -DABI_LINUX
|
||||
@@ -136,7 +141,7 @@ AFLAGS_ABI = -elf -DABI_LINUX -DABI_CDECL
|
||||
# -DABI_LINUX
|
||||
# -DABI_CDECL
|
||||
endif
|
||||
AFLAGS = $(AFLAGS_ABI) -Fo$(O)/
|
||||
AFLAGS = -nologo $(AFLAGS_ABI) -Fo$(O)/
|
||||
endif
|
||||
|
||||
ifdef USE_ASM
|
||||
@@ -455,6 +460,8 @@ $O/VdiHandler.o: ../../Archive/VdiHandler.cpp
|
||||
$(CXX) $(CXXFLAGS) $<
|
||||
$O/VhdHandler.o: ../../Archive/VhdHandler.cpp
|
||||
$(CXX) $(CXXFLAGS) $<
|
||||
$O/VhdxHandler.o: ../../Archive/VhdxHandler.cpp
|
||||
$(CXX) $(CXXFLAGS) $<
|
||||
$O/VmdkHandler.o: ../../Archive/VmdkHandler.cpp
|
||||
$(CXX) $(CXXFLAGS) $<
|
||||
$O/XarHandler.o: ../../Archive/XarHandler.cpp
|
||||
@@ -996,6 +1003,8 @@ $O/TextPairs.o: ../../UI/FileManager/TextPairs.cpp
|
||||
$(CXX) $(CXXFLAGS) $<
|
||||
$O/UpdateCallback100.o: ../../UI/FileManager/UpdateCallback100.cpp
|
||||
$(CXX) $(CXXFLAGS) $<
|
||||
$O/VerCtrl.o: ../../UI/FileManager/VerCtrl.cpp
|
||||
$(CXX) $(CXXFLAGS) $<
|
||||
$O/ViewSettings.o: ../../UI/FileManager/ViewSettings.cpp
|
||||
$(CXX) $(CXXFLAGS) $<
|
||||
|
||||
@@ -1123,12 +1132,15 @@ $O/7zCrcOpt.o: ../../../../Asm/x86/7zCrcOpt.asm
|
||||
$(MY_ASM) $(AFLAGS) $<
|
||||
$O/XzCrc64Opt.o: ../../../../Asm/x86/XzCrc64Opt.asm
|
||||
$(MY_ASM) $(AFLAGS) $<
|
||||
$O/AesOpt.o: ../../../../Asm/x86/AesOpt.asm
|
||||
$(MY_ASM) $(AFLAGS) $<
|
||||
$O/Sha1Opt.o: ../../../../Asm/x86/Sha1Opt.asm
|
||||
$(MY_ASM) $(AFLAGS) $<
|
||||
$O/Sha256Opt.o: ../../../../Asm/x86/Sha256Opt.asm
|
||||
$(MY_ASM) $(AFLAGS) $<
|
||||
|
||||
ifndef USE_JWASM
|
||||
USE_X86_ASM_AES=1
|
||||
endif
|
||||
|
||||
else
|
||||
$O/7zCrcOpt.o: ../../../../C/7zCrcOpt.c
|
||||
$(CC) $(CFLAGS) $<
|
||||
@@ -1138,10 +1150,18 @@ $O/Sha1Opt.o: ../../../../C/Sha1Opt.c
|
||||
$(CC) $(CFLAGS) $<
|
||||
$O/Sha256Opt.o: ../../../../C/Sha256Opt.c
|
||||
$(CC) $(CFLAGS) $<
|
||||
endif
|
||||
|
||||
|
||||
ifdef USE_X86_ASM_AES
|
||||
$O/AesOpt.o: ../../../../Asm/x86/AesOpt.asm
|
||||
$(MY_ASM) $(AFLAGS) $<
|
||||
else
|
||||
$O/AesOpt.o: ../../../../C/AesOpt.c
|
||||
$(CC) $(CFLAGS) $<
|
||||
endif
|
||||
|
||||
|
||||
ifdef USE_X64_ASM
|
||||
$O/LzFindOpt.o: ../../../../Asm/x86/LzFindOpt.asm
|
||||
$(MY_ASM) $(AFLAGS) $<
|
||||
|
||||
@@ -130,8 +130,10 @@ HRESULT CHandler::SetMainMethod(CCompressionMethodMode &methodMode)
|
||||
CMethodFull &methodFull = methodMode.Methods.AddNew();
|
||||
RINOK(PropsMethod_To_FullMethod(methodFull, oneMethodInfo));
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
methodFull.Set_NumThreads = true;
|
||||
methodFull.NumThreads = methodMode.NumThreads;
|
||||
#endif
|
||||
|
||||
if (methodFull.Id != k_Copy)
|
||||
needSolid = true;
|
||||
|
||||
@@ -320,7 +320,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||
break;
|
||||
}
|
||||
|
||||
case kpidBlock: prop = (Int32)m_Database.GetFolderIndex(&mvItem); break;
|
||||
case kpidBlock: prop.Set_Int32((Int32)m_Database.GetFolderIndex(&mvItem)); break;
|
||||
|
||||
#ifdef _CAB_DETAILS
|
||||
|
||||
|
||||
@@ -120,6 +120,15 @@ static void SetMethodProp32(CMethodProps &m, PROPID propID, UInt32 value)
|
||||
m.AddProp32(propID, value);
|
||||
}
|
||||
|
||||
void CMultiMethodProps::SetGlobalLevelTo(COneMethodInfo &oneMethodInfo) const
|
||||
{
|
||||
UInt32 level = _level;
|
||||
if (level != (UInt32)(Int32)-1)
|
||||
SetMethodProp32(oneMethodInfo, NCoderPropID::kLevel, (UInt32)level);
|
||||
}
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
|
||||
static void SetMethodProp32_Replace(CMethodProps &m, PROPID propID, UInt32 value)
|
||||
{
|
||||
const int i = m.FindProp(propID);
|
||||
@@ -132,14 +141,6 @@ static void SetMethodProp32_Replace(CMethodProps &m, PROPID propID, UInt32 value
|
||||
m.AddProp32(propID, value);
|
||||
}
|
||||
|
||||
void CMultiMethodProps::SetGlobalLevelTo(COneMethodInfo &oneMethodInfo) const
|
||||
{
|
||||
UInt32 level = _level;
|
||||
if (level != (UInt32)(Int32)-1)
|
||||
SetMethodProp32(oneMethodInfo, NCoderPropID::kLevel, (UInt32)level);
|
||||
}
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
void CMultiMethodProps::SetMethodThreadsTo_IfNotFinded(CMethodProps &oneMethodInfo, UInt32 numThreads)
|
||||
{
|
||||
SetMethodProp32(oneMethodInfo, NCoderPropID::kNumThreads, numThreads);
|
||||
@@ -149,7 +150,9 @@ void CMultiMethodProps::SetMethodThreadsTo_Replace(CMethodProps &oneMethodInfo,
|
||||
{
|
||||
SetMethodProp32_Replace(oneMethodInfo, NCoderPropID::kNumThreads, numThreads);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _7ZIP_ST
|
||||
|
||||
|
||||
void CMultiMethodProps::InitMulti()
|
||||
{
|
||||
|
||||
@@ -234,6 +234,7 @@ static const CAppleName k_Names[] =
|
||||
{ true, "hfs", "Apple_HFS" },
|
||||
{ true, "hfsx", "Apple_HFSX" },
|
||||
{ true, "ufs", "Apple_UFS" },
|
||||
{ true, "apfs", "Apple_APFS" },
|
||||
|
||||
// efi_sys partition is FAT32, but it's not main file. So we use (IsFs = false)
|
||||
{ false, "efi_sys", "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" },
|
||||
|
||||
@@ -935,7 +935,10 @@ HRESULT CHandler::ParseDir(const Byte *p, size_t size, unsigned iNodeDir)
|
||||
return S_FALSE;
|
||||
|
||||
if (_isUTF)
|
||||
_isUTF = CheckUTF8_AString(item.Name);
|
||||
{
|
||||
// 21.07 : we force UTF8
|
||||
// _isUTF = CheckUTF8_AString(item.Name);
|
||||
}
|
||||
|
||||
if (iNode == 0)
|
||||
{
|
||||
@@ -1835,7 +1838,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
||||
|
||||
case kpidRevision: prop = _h.RevLevel; break;
|
||||
|
||||
case kpidINodeSize: prop = _h.InodeSize; break;
|
||||
case kpidINodeSize: prop = (UInt32)_h.InodeSize; break;
|
||||
|
||||
case kpidId:
|
||||
{
|
||||
|
||||
@@ -112,6 +112,7 @@ static const CPartType kPartTypes[] =
|
||||
{ 0x516E7CB8, "zfs", "FreeBSD ZFS" },
|
||||
|
||||
{ 0x48465300, "hfsx", "HFS+" },
|
||||
{ 0x7C3457EF, "apfs", "APFS" },
|
||||
};
|
||||
|
||||
static int FindPartType(const Byte *guid)
|
||||
|
||||
@@ -105,10 +105,9 @@ STDMETHODIMP CHandlerCont::GetStream(UInt32 index, ISequentialInStream **stream)
|
||||
|
||||
|
||||
|
||||
CHandlerImg::CHandlerImg():
|
||||
_imgExt(NULL)
|
||||
CHandlerImg::CHandlerImg()
|
||||
{
|
||||
ClearStreamVars();
|
||||
Clear_HandlerImg_Vars();
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandlerImg::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
|
||||
@@ -121,7 +120,11 @@ STDMETHODIMP CHandlerImg::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosit
|
||||
default: return STG_E_INVALIDFUNCTION;
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
if (newPosition)
|
||||
*newPosition = _virtPos;
|
||||
return HRESULT_WIN32_ERROR_NEGATIVE_SEEK;
|
||||
}
|
||||
_virtPos = offset;
|
||||
if (newPosition)
|
||||
*newPosition = offset;
|
||||
@@ -130,6 +133,7 @@ STDMETHODIMP CHandlerImg::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosit
|
||||
|
||||
static const Byte k_GDP_Signature[] = { 'E', 'F', 'I', ' ', 'P', 'A', 'R', 'T' };
|
||||
|
||||
|
||||
static const char *GetImgExt(ISequentialInStream *stream)
|
||||
{
|
||||
const size_t kHeaderSize = 1 << 10;
|
||||
@@ -151,6 +155,15 @@ void CHandlerImg::CloseAtError()
|
||||
Stream.Release();
|
||||
}
|
||||
|
||||
void CHandlerImg::Clear_HandlerImg_Vars()
|
||||
{
|
||||
_imgExt = NULL;
|
||||
_size = 0;
|
||||
ClearStreamVars();
|
||||
Reset_VirtPos();
|
||||
Reset_PosInArc();
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandlerImg::Open(IInStream *stream,
|
||||
const UInt64 * /* maxCheckStartPosition */,
|
||||
IArchiveOpenCallback * openCallback)
|
||||
@@ -165,9 +178,16 @@ STDMETHODIMP CHandlerImg::Open(IInStream *stream,
|
||||
if (res == S_OK)
|
||||
{
|
||||
CMyComPtr<ISequentialInStream> inStream;
|
||||
HRESULT res2 = GetStream(0, &inStream);
|
||||
const HRESULT res2 = GetStream(0, &inStream);
|
||||
if (res2 == S_OK && inStream)
|
||||
_imgExt = GetImgExt(inStream);
|
||||
// _imgExt = GetImgExt(this); // for debug
|
||||
/* we reset (_virtPos) to support cases, if some code will
|
||||
call Read() from Handler object instead of GetStream() object. */
|
||||
Reset_VirtPos();
|
||||
// optional: we reset (_posInArc). if real seek position of stream will be changed in external code
|
||||
Reset_PosInArc();
|
||||
// optional: here we could also reset seek positions in parent streams..
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,9 @@ protected:
|
||||
// bool _stream_UsePackSize;
|
||||
// UInt64 _stream_PackSize;
|
||||
|
||||
void Reset_PosInArc() { _posInArc = (UInt64)0 - 1; }
|
||||
void Reset_VirtPos() { _virtPos = (UInt64)0; }
|
||||
|
||||
void ClearStreamVars()
|
||||
{
|
||||
_stream_unavailData = false;
|
||||
@@ -87,6 +90,7 @@ protected:
|
||||
// _stream_PackSize = 0;
|
||||
}
|
||||
|
||||
void Clear_HandlerImg_Vars(); // it doesn't Release (Stream) var.
|
||||
|
||||
virtual HRESULT Open2(IInStream *stream, IArchiveOpenCallback *openCallback) = 0;
|
||||
virtual void CloseAtError();
|
||||
|
||||
@@ -451,7 +451,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
}
|
||||
|
||||
REGISTER_ARC_I(
|
||||
"lzip", "lz tlz", "* .tar", 0xC4,
|
||||
"lzip", "lz tlz", "* .tar", 0xC3,
|
||||
k_Signature,
|
||||
0,
|
||||
NArcInfoFlags::kKeepName,
|
||||
|
||||
@@ -601,7 +601,6 @@ STDMETHODIMP CHandler::Close()
|
||||
_table.Free();
|
||||
_dir.Free();
|
||||
_phySize = 0;
|
||||
_size = 0;
|
||||
|
||||
_cacheCluster = (UInt64)(Int64)-1;
|
||||
_comprPos = 0;
|
||||
@@ -611,7 +610,8 @@ STDMETHODIMP CHandler::Close()
|
||||
_isArc = false;
|
||||
_unsupported = false;
|
||||
|
||||
_imgExt = NULL;
|
||||
// CHandlerImg:
|
||||
Clear_HandlerImg_Vars();
|
||||
Stream.Release();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -28,12 +28,12 @@ public:
|
||||
{
|
||||
_needChangeForNext = true;
|
||||
_after.Empty();
|
||||
UString base = name;
|
||||
int dotPos = name.ReverseFind_Dot();
|
||||
UString base (name);
|
||||
const int dotPos = name.ReverseFind_Dot();
|
||||
|
||||
if (dotPos >= 0)
|
||||
{
|
||||
const UString ext = name.Ptr(dotPos + 1);
|
||||
const UString ext (name.Ptr(dotPos + 1));
|
||||
if (ext.IsEqualTo_Ascii_NoCase("rar"))
|
||||
{
|
||||
_after = name.Ptr(dotPos);
|
||||
|
||||
@@ -21,12 +21,20 @@
|
||||
|
||||
#include "../Compress/CopyCoder.h"
|
||||
#include "../Compress/LzmaDecoder.h"
|
||||
#include "../Compress/LzmaEncoder.h"
|
||||
#include "../Compress/ZlibDecoder.h"
|
||||
#include "../Compress/ZlibEncoder.h"
|
||||
|
||||
#include "Common/DummyOutStream.h"
|
||||
|
||||
// #define SWF_UPDATE
|
||||
|
||||
#ifdef SWF_UPDATE
|
||||
|
||||
#include "../Compress/LzmaEncoder.h"
|
||||
#include "../Compress/ZlibEncoder.h"
|
||||
|
||||
#include "Common/HandlerOut.h"
|
||||
|
||||
#endif
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
@@ -152,8 +160,10 @@ struct CItem
|
||||
class CHandler:
|
||||
public IInArchive,
|
||||
public IArchiveOpenSeq,
|
||||
#ifdef SWF_UPDATE
|
||||
public IOutArchive,
|
||||
public ISetProperties,
|
||||
#endif
|
||||
public CMyUnknownImp
|
||||
{
|
||||
CItem _item;
|
||||
@@ -162,16 +172,22 @@ class CHandler:
|
||||
CMyComPtr<ISequentialInStream> _seqStream;
|
||||
CMyComPtr<IInStream> _stream;
|
||||
|
||||
#ifdef SWF_UPDATE
|
||||
CSingleMethodProps _props;
|
||||
bool _lzmaMode;
|
||||
#endif
|
||||
|
||||
public:
|
||||
CHandler(): _lzmaMode(false) {}
|
||||
#ifdef SWF_UPDATE
|
||||
MY_UNKNOWN_IMP4(IInArchive, IArchiveOpenSeq, IOutArchive, ISetProperties)
|
||||
INTERFACE_IInArchive(;)
|
||||
CHandler(): _lzmaMode(false) {}
|
||||
INTERFACE_IOutArchive(;)
|
||||
STDMETHOD(OpenSeq)(ISequentialInStream *stream);
|
||||
STDMETHOD(SetProperties)(const wchar_t * const *names, const PROPVARIANT *values, UInt32 numProps);
|
||||
#else
|
||||
MY_UNKNOWN_IMP2(IInArchive, IArchiveOpenSeq)
|
||||
#endif
|
||||
INTERFACE_IInArchive(;)
|
||||
STDMETHOD(OpenSeq)(ISequentialInStream *stream);
|
||||
};
|
||||
|
||||
static const Byte kProps[] =
|
||||
@@ -416,6 +432,9 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
|
||||
#ifdef SWF_UPDATE
|
||||
|
||||
static HRESULT UpdateArchive(ISequentialOutStream *outStream, UInt64 size,
|
||||
bool lzmaMode, const CSingleMethodProps &props,
|
||||
IArchiveUpdateCallback *updateCallback)
|
||||
@@ -576,11 +595,14 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t * const *names, const PROPVAR
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static const Byte k_Signature[] = {
|
||||
3, 'C', 'W', 'S',
|
||||
3, 'Z', 'W', 'S' };
|
||||
|
||||
REGISTER_ARC_IO(
|
||||
REGISTER_ARC_I(
|
||||
"SWFc", "swf", "~.swf", 0xD8,
|
||||
k_Signature,
|
||||
0,
|
||||
|
||||
@@ -107,8 +107,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
||||
|
||||
case kpidCharacts:
|
||||
{
|
||||
AString s = _encodingCharacts.GetCharactsString();
|
||||
prop = s;
|
||||
prop = _encodingCharacts.GetCharactsString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,8 +130,8 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
|
||||
return E_INVALIDARG;
|
||||
else
|
||||
ui.Mode = prop.ulVal;
|
||||
// FIXME : we can clear high file type bits to be more compatible with tars created by GNU TAR.
|
||||
// ui.Mode &= ~(UInt32)MY_LIN_S_IFMT;
|
||||
// 21.07 : we clear high file type bits as GNU TAR.
|
||||
ui.Mode &= ~(UInt32)MY_LIN_S_IFMT;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -17,7 +17,10 @@ namespace NFileHeader {
|
||||
// const char * const kUsTar = "ustar"; // 5 chars
|
||||
// const char * const kGNUTar = "GNUtar "; // 7 chars and a null
|
||||
// const char * const kEmpty = "\0\0\0\0\0\0\0\0";
|
||||
const char kUsTar_00[8] = { 'u', 's', 't', 'a', 'r', 0, '0', '0' } ;
|
||||
// 7-Zip used kUsTar_00 before 21.07:
|
||||
// const char kUsTar_00[8] = { 'u', 's', 't', 'a', 'r', 0, '0', '0' } ;
|
||||
// GNU TAR uses such header:
|
||||
const char kUsTar_GNU[8] = { 'u', 's', 't', 'a', 'r', ' ', ' ', 0 } ;
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
@@ -76,7 +76,8 @@ namespace NFileHeader
|
||||
// extern const char * const kUsTar; // = "ustar"; // 5 chars
|
||||
// extern const char * const kGNUTar; // = "GNUtar "; // 7 chars and a null
|
||||
// extern const char * const kEmpty; // = "\0\0\0\0\0\0\0\0"
|
||||
extern const char kUsTar_00[8];
|
||||
// extern const char kUsTar_00[8];
|
||||
extern const char kUsTar_GNU[8];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,10 +72,7 @@ static bool IsRecordLast(const char *buf)
|
||||
|
||||
static void ReadString(const char *s, unsigned size, AString &result)
|
||||
{
|
||||
char temp[NFileHeader::kRecordSize + 1];
|
||||
MyStrNCpy(temp, s, size);
|
||||
temp[size] = '\0';
|
||||
result = temp;
|
||||
result.SetFrom_CalcLen(s, size);
|
||||
}
|
||||
|
||||
static bool ParseInt64(const char *p, Int64 &val)
|
||||
|
||||
@@ -43,6 +43,15 @@ struct CItem
|
||||
|
||||
CRecordVector<CSparseBlock> SparseBlocks;
|
||||
|
||||
void SetDefaultWriteFields()
|
||||
{
|
||||
DeviceMajorDefined = false;
|
||||
DeviceMinorDefined = false;
|
||||
UID = 0;
|
||||
GID = 0;
|
||||
memcpy(Magic, NFileHeader::NMagic::kUsTar_GNU, 8);
|
||||
}
|
||||
|
||||
bool IsSymLink() const { return LinkFlag == NFileHeader::NLinkFlag::kSymLink && (Size == 0); }
|
||||
bool IsHardLink() const { return LinkFlag == NFileHeader::NLinkFlag::kHardLink; }
|
||||
bool IsSparse() const { return LinkFlag == NFileHeader::NLinkFlag::kSparse; }
|
||||
@@ -103,7 +112,7 @@ struct CItem
|
||||
bool IsUstarMagic() const
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
if (Magic[i] != NFileHeader::NMagic::kUsTar_00[i])
|
||||
if (Magic[i] != NFileHeader::NMagic::kUsTar_GNU[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,17 +15,6 @@ HRESULT COutArchive::WriteBytes(const void *data, unsigned size)
|
||||
return WriteStream(m_Stream, data, size);
|
||||
}
|
||||
|
||||
static void MyStrNCpy(char *dest, const char *src, unsigned size)
|
||||
{
|
||||
for (unsigned i = 0; i < size; i++)
|
||||
{
|
||||
char c = src[i];
|
||||
dest[i] = c;
|
||||
if (c == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool WriteOctal_8(char *s, UInt32 val)
|
||||
{
|
||||
const unsigned kNumDigits = 8 - 1;
|
||||
@@ -39,6 +28,12 @@ static bool WriteOctal_8(char *s, UInt32 val)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void WriteBin_64bit(char *s, UInt64 val)
|
||||
{
|
||||
for (unsigned i = 0; i < 8; i++, val <<= 8)
|
||||
s[i] = (char)(val >> 56);
|
||||
}
|
||||
|
||||
static void WriteOctal_12(char *s, UInt64 val)
|
||||
{
|
||||
const unsigned kNumDigits = 12 - 1;
|
||||
@@ -47,8 +42,7 @@ static void WriteOctal_12(char *s, UInt64 val)
|
||||
// GNU extension;
|
||||
s[0] = (char)(Byte)0x80;
|
||||
s[1] = s[2] = s[3] = 0;
|
||||
for (unsigned i = 0; i < 8; i++, val <<= 8)
|
||||
s[4 + i] = (char)(val >> 56);
|
||||
WriteBin_64bit(s + 4, val);
|
||||
return;
|
||||
}
|
||||
for (unsigned i = 0; i < kNumDigits; i++)
|
||||
@@ -66,61 +60,67 @@ static void WriteOctal_12_Signed(char *s, Int64 val)
|
||||
return;
|
||||
}
|
||||
s[0] = s[1] = s[2] = s[3] = (char)(Byte)0xFF;
|
||||
for (unsigned i = 0; i < 8; i++, val <<= 8)
|
||||
s[4 + i] = (char)(val >> 56);
|
||||
WriteBin_64bit(s + 4, val);
|
||||
}
|
||||
|
||||
static bool CopyString(char *dest, const AString &src, unsigned maxSize)
|
||||
static void CopyString(char *dest, const AString &src, unsigned maxSize)
|
||||
{
|
||||
if (src.Len() >= maxSize)
|
||||
return false;
|
||||
MyStringCopy(dest, (const char *)src);
|
||||
return true;
|
||||
unsigned len = src.Len();
|
||||
if (len == 0)
|
||||
return;
|
||||
// 21.07: we don't require additional 0 character at the end
|
||||
if (len > maxSize)
|
||||
{
|
||||
len = maxSize;
|
||||
// return false;
|
||||
}
|
||||
memcpy(dest, src.Ptr(), len);
|
||||
// return true;
|
||||
}
|
||||
|
||||
#define RETURN_IF_NOT_TRUE(x) { if (!(x)) return E_FAIL; }
|
||||
|
||||
#define COPY_STRING_CHECK(dest, src, size) \
|
||||
CopyString(dest, src, size); dest += (size);
|
||||
|
||||
#define WRITE_OCTAL_8_CHECK(dest, src) \
|
||||
RETURN_IF_NOT_TRUE(WriteOctal_8(dest, src));
|
||||
|
||||
|
||||
HRESULT COutArchive::WriteHeaderReal(const CItem &item)
|
||||
{
|
||||
char record[NFileHeader::kRecordSize];
|
||||
memset(record, 0, NFileHeader::kRecordSize);
|
||||
char *cur = record;
|
||||
|
||||
if (item.Name.Len() > NFileHeader::kNameSize)
|
||||
return E_FAIL;
|
||||
MyStrNCpy(cur, item.Name, NFileHeader::kNameSize);
|
||||
cur += NFileHeader::kNameSize;
|
||||
COPY_STRING_CHECK (cur, item.Name, NFileHeader::kNameSize);
|
||||
|
||||
RETURN_IF_NOT_TRUE(WriteOctal_8(cur, item.Mode)); cur += 8;
|
||||
RETURN_IF_NOT_TRUE(WriteOctal_8(cur, item.UID)); cur += 8;
|
||||
RETURN_IF_NOT_TRUE(WriteOctal_8(cur, item.GID)); cur += 8;
|
||||
WRITE_OCTAL_8_CHECK (cur, item.Mode); cur += 8;
|
||||
WRITE_OCTAL_8_CHECK (cur, item.UID); cur += 8;
|
||||
WRITE_OCTAL_8_CHECK (cur, item.GID); cur += 8;
|
||||
|
||||
WriteOctal_12(cur, item.PackSize); cur += 12;
|
||||
WriteOctal_12_Signed(cur, item.MTime); cur += 12;
|
||||
|
||||
memset(cur, ' ', 8);
|
||||
memset(cur, ' ', 8); // checksum field
|
||||
cur += 8;
|
||||
|
||||
*cur++ = item.LinkFlag;
|
||||
|
||||
RETURN_IF_NOT_TRUE(CopyString(cur, item.LinkName, NFileHeader::kNameSize));
|
||||
cur += NFileHeader::kNameSize;
|
||||
COPY_STRING_CHECK (cur, item.LinkName, NFileHeader::kNameSize);
|
||||
|
||||
memcpy(cur, item.Magic, 8);
|
||||
cur += 8;
|
||||
|
||||
RETURN_IF_NOT_TRUE(CopyString(cur, item.User, NFileHeader::kUserNameSize));
|
||||
cur += NFileHeader::kUserNameSize;
|
||||
RETURN_IF_NOT_TRUE(CopyString(cur, item.Group, NFileHeader::kGroupNameSize));
|
||||
cur += NFileHeader::kGroupNameSize;
|
||||
COPY_STRING_CHECK (cur, item.User, NFileHeader::kUserNameSize);
|
||||
COPY_STRING_CHECK (cur, item.Group, NFileHeader::kGroupNameSize);
|
||||
|
||||
|
||||
/* temp fix for #202
|
||||
* if (item.DeviceMajorDefined) RETURN_IF_NOT_TRUE(WriteOctal_8(cur, item.DeviceMajor)); cur += 8;
|
||||
* if (item.DeviceMinorDefined) RETURN_IF_NOT_TRUE(WriteOctal_8(cur, item.DeviceMinor)); cur += 8;
|
||||
*/
|
||||
RETURN_IF_NOT_TRUE(WriteOctal_8(cur, item.DeviceMajorDefined ? item.DeviceMajor : 0)); cur += 8;
|
||||
RETURN_IF_NOT_TRUE(WriteOctal_8(cur, item.DeviceMinorDefined ? item.DeviceMinor : 0)); cur += 8;
|
||||
if (item.DeviceMajorDefined)
|
||||
WRITE_OCTAL_8_CHECK (cur, item.DeviceMajor);
|
||||
cur += 8;
|
||||
if (item.DeviceMinorDefined)
|
||||
WRITE_OCTAL_8_CHECK (cur, item.DeviceMinor);
|
||||
cur += 8;
|
||||
|
||||
if (item.IsSparse())
|
||||
{
|
||||
@@ -144,7 +144,7 @@ HRESULT COutArchive::WriteHeaderReal(const CItem &item)
|
||||
/* we use GNU TAR scheme:
|
||||
checksum field is formatted differently from the
|
||||
other fields: it has [6] digits, a null, then a space. */
|
||||
// RETURN_IF_NOT_TRUE(WriteOctal_8(record + 148, checkSum));
|
||||
// WRITE_OCTAL_8_CHECK(record + 148, checkSum);
|
||||
const unsigned kNumDigits = 6;
|
||||
for (unsigned i = 0; i < kNumDigits; i++)
|
||||
{
|
||||
@@ -176,27 +176,42 @@ HRESULT COutArchive::WriteHeaderReal(const CItem &item)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
/* OLD_GNU_TAR: writes short name with zero at the end
|
||||
NEW_GNU_TAR: writes short name without zero at the end */
|
||||
|
||||
static const unsigned kNameSize_Max =
|
||||
NFileHeader::kNameSize; // NEW_GNU_TAR / 7-Zip 21.07
|
||||
// NFileHeader::kNameSize - 1; // OLD_GNU_TAR / old 7-Zip
|
||||
|
||||
#define DOES_NAME_FIT_IN_FIELD(name) ((name).Len() <= kNameSize_Max)
|
||||
|
||||
HRESULT COutArchive::WriteHeader(const CItem &item)
|
||||
{
|
||||
unsigned nameSize = item.Name.Len();
|
||||
unsigned linkSize = item.LinkName.Len();
|
||||
|
||||
/* There two versions of GNU tar:
|
||||
OLDGNU_FORMAT: it writes short name and zero at the end
|
||||
GNU_FORMAT: it writes only short name without zero at the end
|
||||
we write it as OLDGNU_FORMAT with zero at the end */
|
||||
|
||||
if (nameSize < NFileHeader::kNameSize &&
|
||||
linkSize < NFileHeader::kNameSize)
|
||||
if (DOES_NAME_FIT_IN_FIELD(item.Name) &&
|
||||
DOES_NAME_FIT_IN_FIELD(item.LinkName))
|
||||
return WriteHeaderReal(item);
|
||||
|
||||
// here we can get all fields from main (item) or create new empty item
|
||||
/*
|
||||
CItem mi;
|
||||
mi.SetDefaultWriteFields();
|
||||
*/
|
||||
|
||||
CItem mi = item;
|
||||
mi.Name = NFileHeader::kLongLink;
|
||||
mi.LinkName.Empty();
|
||||
// SparseBlocks will be ignored by IsSparse()
|
||||
// mi.SparseBlocks.Clear();
|
||||
|
||||
mi.Name = NFileHeader::kLongLink;
|
||||
// 21.07 : we set Mode and MTime props as in GNU TAR:
|
||||
mi.Mode = 0644; // octal
|
||||
mi.MTime = 0;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
const AString *name;
|
||||
// We suppose that GNU tar also writes item for long link before item for LongName?
|
||||
// We suppose that GNU TAR also writes item for long link before item for LongName?
|
||||
if (i == 0)
|
||||
{
|
||||
mi.LinkFlag = NFileHeader::NLinkFlag::kGnu_LongLink;
|
||||
@@ -207,21 +222,26 @@ HRESULT COutArchive::WriteHeader(const CItem &item)
|
||||
mi.LinkFlag = NFileHeader::NLinkFlag::kGnu_LongName;
|
||||
name = &item.Name;
|
||||
}
|
||||
if (name->Len() < NFileHeader::kNameSize)
|
||||
if (DOES_NAME_FIT_IN_FIELD(*name))
|
||||
continue;
|
||||
unsigned nameStreamSize = name->Len() + 1;
|
||||
// GNU TAR writes null character after NAME to file. We do same here:
|
||||
const unsigned nameStreamSize = name->Len() + 1;
|
||||
mi.PackSize = nameStreamSize;
|
||||
RINOK(WriteHeaderReal(mi));
|
||||
RINOK(WriteBytes((const char *)*name, nameStreamSize));
|
||||
RINOK(WriteBytes(name->Ptr(), nameStreamSize));
|
||||
RINOK(FillDataResidual(nameStreamSize));
|
||||
}
|
||||
|
||||
// 21.07: WriteHeaderReal() writes short part of (Name) and (LinkName).
|
||||
return WriteHeaderReal(item);
|
||||
/*
|
||||
mi = item;
|
||||
if (mi.Name.Len() >= NFileHeader::kNameSize)
|
||||
mi.Name.SetFrom(item.Name, NFileHeader::kNameSize - 1);
|
||||
if (mi.LinkName.Len() >= NFileHeader::kNameSize)
|
||||
mi.LinkName.SetFrom(item.LinkName, NFileHeader::kNameSize - 1);
|
||||
if (!DOES_NAME_FIT_IN_FIELD(mi.Name))
|
||||
mi.Name.SetFrom(item.Name, kNameSize_Max);
|
||||
if (!DOES_NAME_FIT_IN_FIELD(mi.LinkName))
|
||||
mi.LinkName.SetFrom(item.LinkName, kNameSize_Max);
|
||||
return WriteHeaderReal(mi);
|
||||
*/
|
||||
}
|
||||
|
||||
HRESULT COutArchive::FillDataResidual(UInt64 dataSize)
|
||||
@@ -239,7 +259,17 @@ HRESULT COutArchive::WriteFinishHeader()
|
||||
{
|
||||
Byte record[NFileHeader::kRecordSize];
|
||||
memset(record, 0, NFileHeader::kRecordSize);
|
||||
for (unsigned i = 0; i < 2; i++)
|
||||
|
||||
const unsigned kNumFinishRecords = 2;
|
||||
|
||||
/* GNU TAR by default uses --blocking-factor=20 (512 * 20 = 10 KiB)
|
||||
we also can use cluster alignment:
|
||||
const unsigned numBlocks = (unsigned)(Pos / NFileHeader::kRecordSize) + kNumFinishRecords;
|
||||
const unsigned kNumClusterBlocks = (1 << 3); // 8 blocks = 4 KiB
|
||||
const unsigned numFinishRecords = kNumFinishRecords + ((kNumClusterBlocks - numBlocks) & (kNumClusterBlocks - 1));
|
||||
*/
|
||||
|
||||
for (unsigned i = 0; i < kNumFinishRecords; i++)
|
||||
{
|
||||
RINOK(WriteBytes(record, NFileHeader::kRecordSize));
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ HRESULT UpdateArchive(IInStream *inStream, ISequentialOutStream *outStream,
|
||||
|
||||
if (ui.NewProps)
|
||||
{
|
||||
item.SetDefaultWriteFields();
|
||||
item.Mode = ui.Mode;
|
||||
item.Name = ui.Name;
|
||||
item.User = ui.User;
|
||||
@@ -85,11 +86,6 @@ HRESULT UpdateArchive(IInStream *inStream, ISequentialOutStream *outStream,
|
||||
}
|
||||
|
||||
item.MTime = ui.MTime;
|
||||
item.DeviceMajorDefined = false;
|
||||
item.DeviceMinorDefined = false;
|
||||
item.UID = 0;
|
||||
item.GID = 0;
|
||||
memcpy(item.Magic, NFileHeader::NMagic::kUsTar_00, 8);
|
||||
}
|
||||
else
|
||||
item = inputItems[(unsigned)ui.IndexInArc];
|
||||
|
||||
@@ -403,14 +403,14 @@ STDMETHODIMP CHandler::Close()
|
||||
{
|
||||
_table.Free();
|
||||
_phySize = 0;
|
||||
_size = 0;
|
||||
_isArc = false;
|
||||
_unsupported = false;
|
||||
|
||||
for (unsigned i = 0; i < kNumGuids; i++)
|
||||
memset(Guids[i], 0, 16);
|
||||
|
||||
_imgExt = NULL;
|
||||
// CHandlerImg:
|
||||
Clear_HandlerImg_Vars();
|
||||
Stream.Release();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -226,9 +226,9 @@ class CHandler: public CHandlerImg
|
||||
CByteBuffer BitMap;
|
||||
UInt32 BitMapTag;
|
||||
UInt32 NumUsedBlocks;
|
||||
// CMyComPtr<IInStream> Stream;
|
||||
CMyComPtr<IInStream> ParentStream;
|
||||
CHandler *Parent;
|
||||
UInt64 NumLevels;
|
||||
UString _errorMessage;
|
||||
// bool _unexpectedEnd;
|
||||
|
||||
@@ -604,11 +604,12 @@ enum
|
||||
|
||||
static const CStatProp kArcProps[] =
|
||||
{
|
||||
{ NULL, kpidSize, VT_UI8},
|
||||
{ NULL, kpidOffset, VT_UI8},
|
||||
{ NULL, kpidCTime, VT_FILETIME},
|
||||
{ NULL, kpidClusterSize, VT_UI8},
|
||||
{ NULL, kpidMethod, VT_BSTR},
|
||||
{ NULL, kpidNumVolumes, VT_UI4},
|
||||
{ NULL, kpidTotalPhySize, VT_UI8},
|
||||
{ "Parent", kpidParent, VT_BSTR},
|
||||
{ NULL, kpidCreatorApp, VT_BSTR},
|
||||
{ NULL, kpidHostOS, VT_BSTR},
|
||||
@@ -734,6 +735,21 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
||||
case kpidParent: if (NeedParent()) prop = GetParentSequence(); break;
|
||||
case kpidOffset: prop = _startOffset; break;
|
||||
case kpidPhySize: prop = _phySize; break;
|
||||
case kpidTotalPhySize:
|
||||
{
|
||||
const CHandler *p = this;
|
||||
UInt64 sum = 0;
|
||||
do
|
||||
{
|
||||
sum += p->_phySize;
|
||||
p = p->Parent;
|
||||
}
|
||||
while (p);
|
||||
prop = sum;
|
||||
break;
|
||||
}
|
||||
case kpidNumVolumes: if (NumLevels != 1) prop = (UInt32)NumLevels; break;
|
||||
|
||||
/*
|
||||
case kpidErrorFlags:
|
||||
{
|
||||
@@ -762,6 +778,7 @@ HRESULT CHandler::Open2(IInStream *stream, CHandler *child, IArchiveOpenCallback
|
||||
|
||||
RINOK(Open3());
|
||||
|
||||
NumLevels = 1;
|
||||
if (child && memcmp(child->Dyn.ParentId, Footer.Id, 16) != 0)
|
||||
return S_FALSE;
|
||||
if (Footer.Type != kDiskType_Diff)
|
||||
@@ -826,6 +843,10 @@ HRESULT CHandler::Open2(IInStream *stream, CHandler *child, IArchiveOpenCallback
|
||||
// we must show that error code
|
||||
}
|
||||
}
|
||||
if (res == S_OK)
|
||||
{
|
||||
NumLevels = Parent->NumLevels + 1;
|
||||
}
|
||||
}
|
||||
{
|
||||
const CHandler *p = this;
|
||||
@@ -845,16 +866,19 @@ HRESULT CHandler::Open2(IInStream *stream, CHandler *child, IArchiveOpenCallback
|
||||
|
||||
void CHandler::CloseAtError()
|
||||
{
|
||||
// CHandlerImg:
|
||||
Stream.Release();
|
||||
Clear_HandlerImg_Vars();
|
||||
|
||||
_phySize = 0;
|
||||
NumLevels = 0;
|
||||
Bat.Clear();
|
||||
NumUsedBlocks = 0;
|
||||
Parent = NULL;
|
||||
Stream.Release();
|
||||
ParentStream.Release();
|
||||
Dyn.Clear();
|
||||
_errorMessage.Empty();
|
||||
// _unexpectedEnd = false;
|
||||
_imgExt = NULL;
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::Close()
|
||||
@@ -891,7 +915,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIAN
|
||||
STDMETHODIMP CHandler::GetStream(UInt32 /* index */, ISequentialInStream **stream)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
*stream = 0;
|
||||
*stream = NULL;
|
||||
if (Footer.IsFixed())
|
||||
{
|
||||
CLimitedInStream *streamSpec = new CLimitedInStream;
|
||||
|
||||
2062
CPP/7zip/Archive/VhdxHandler.cpp
Normal file
2062
CPP/7zip/Archive/VhdxHandler.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1430,7 +1430,6 @@ HRESULT CExtent::Open3(IInStream *stream, IArchiveOpenCallback *openCallback,
|
||||
STDMETHODIMP CHandler::Close()
|
||||
{
|
||||
_phySize = 0;
|
||||
_size = 0;
|
||||
|
||||
_cacheCluster = (UInt64)(Int64)-1;
|
||||
_cacheExtent = (unsigned)(int)-1;
|
||||
@@ -1450,8 +1449,10 @@ STDMETHODIMP CHandler::Close()
|
||||
_descriptorBuf.Free();
|
||||
_descriptor.Clear();
|
||||
|
||||
_imgExt = NULL;
|
||||
Stream.Release(); // Stream vriable is unused
|
||||
// CHandlerImg:
|
||||
Clear_HandlerImg_Vars();
|
||||
Stream.Release();
|
||||
|
||||
_extents.Clear();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -1942,10 +1942,6 @@ SOURCE=..\..\..\..\C\Threads.c
|
||||
|
||||
SOURCE=..\..\..\..\C\Threads.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Types.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Crypto"
|
||||
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
100 "7z zip rar 001 cab iso xz txz lzma tar cpio bz2 bzip2 tbz2 tbz gz gzip tgz tpz z taz lz tlz lz4 tlz4 lz5 tlz5 lzh lha rpm deb arj vhd wim swm esd fat ntfs dmg hfs xar squashfs zst"
|
||||
100 "7z zip rar 001 cab iso xz txz lzma tar cpio bz2 bzip2 tbz2 tbz gz gzip tgz tpz z taz lz tlz lz4 tlz4 lz5 tlz5 lzh lha rpm deb arj vhd vhdx wim swm esd fat ntfs dmg hfs xar squashfs zst"
|
||||
END
|
||||
|
||||
@@ -101,6 +101,7 @@ AR_OBJS = \
|
||||
$O\UefiHandler.obj \
|
||||
$O\VdiHandler.obj \
|
||||
$O\VhdHandler.obj \
|
||||
$O\VhdxHandler.obj \
|
||||
$O\VmdkHandler.obj \
|
||||
$O\XarHandler.obj \
|
||||
$O\XzHandler.obj \
|
||||
|
||||
@@ -118,6 +118,7 @@ AR_OBJS = \
|
||||
$O/UefiHandler.o \
|
||||
$O/VdiHandler.o \
|
||||
$O/VhdHandler.o \
|
||||
$O/VhdxHandler.o \
|
||||
$O/VmdkHandler.o \
|
||||
$O/XarHandler.o \
|
||||
$O/XzHandler.o \
|
||||
@@ -175,10 +176,14 @@ NSIS_OBJS = \
|
||||
$O/NsisIn.o \
|
||||
$O/NsisRegister.o \
|
||||
|
||||
ifndef DISABLE_RAR
|
||||
RAR_OBJS = \
|
||||
$O/RarHandler.o \
|
||||
$O/Rar5Handler.o \
|
||||
|
||||
endif
|
||||
|
||||
|
||||
TAR_OBJS = \
|
||||
$O/TarHandler.o \
|
||||
$O/TarHandlerOut.o \
|
||||
@@ -245,12 +250,6 @@ COMPRESS_OBJS = \
|
||||
$O/PpmdRegister.o \
|
||||
$O/PpmdZip.o \
|
||||
$O/QuantumDecoder.o \
|
||||
$O/Rar1Decoder.o \
|
||||
$O/Rar2Decoder.o \
|
||||
$O/Rar3Decoder.o \
|
||||
$O/Rar3Vm.o \
|
||||
$O/Rar5Decoder.o \
|
||||
$O/RarCodecsRegister.o \
|
||||
$O/ShrinkDecoder.o \
|
||||
$O/XpressDecoder.o \
|
||||
$O/XzDecoder.o \
|
||||
@@ -259,6 +258,20 @@ COMPRESS_OBJS = \
|
||||
$O/ZlibEncoder.o \
|
||||
$O/ZDecoder.o \
|
||||
|
||||
ifdef DISABLE_RAR
|
||||
DISABLE_RAR_COMPRESS=1
|
||||
endif
|
||||
|
||||
ifndef DISABLE_RAR_COMPRESS
|
||||
COMPRESS_OBJS += \
|
||||
$O/Rar1Decoder.o \
|
||||
$O/Rar2Decoder.o \
|
||||
$O/Rar3Decoder.o \
|
||||
$O/Rar3Vm.o \
|
||||
$O/Rar5Decoder.o \
|
||||
$O/RarCodecsRegister.o \
|
||||
|
||||
endif
|
||||
|
||||
CRYPTO_OBJS = \
|
||||
$O/7zAes.o \
|
||||
@@ -269,13 +282,18 @@ CRYPTO_OBJS = \
|
||||
$O/MyAesReg.o \
|
||||
$O/Pbkdf2HmacSha1.o \
|
||||
$O/RandGen.o \
|
||||
$O/Rar20Crypto.o \
|
||||
$O/Rar5Aes.o \
|
||||
$O/RarAes.o \
|
||||
$O/WzAes.o \
|
||||
$O/ZipCrypto.o \
|
||||
$O/ZipStrong.o \
|
||||
|
||||
ifndef DISABLE_RAR
|
||||
CRYPTO_OBJS += \
|
||||
$O/Rar20Crypto.o \
|
||||
$O/Rar5Aes.o \
|
||||
$O/RarAes.o \
|
||||
|
||||
endif
|
||||
|
||||
|
||||
C_OBJS = \
|
||||
$O/7zBuf2.o \
|
||||
@@ -323,7 +341,7 @@ C_OBJS = \
|
||||
$O/Sha1Opt.o \
|
||||
|
||||
ARC_OBJS = \
|
||||
$(LZMA_DEC_OPT_OBJS) \
|
||||
$(LZMA_DEC_OPT_OBJS) \
|
||||
$(C_OBJS) \
|
||||
$(MT_OBJS) \
|
||||
$(COMMON_OBJS) \
|
||||
|
||||
@@ -2929,6 +2929,10 @@ SOURCE=..\..\Archive\VhdHandler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\VhdxHandler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\VmdkHandler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -36,5 +36,5 @@ MY_VERSION_INFO_DLL("7z Plugin" , "7z")
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
100 "7z:0 zip:1 rar:3 001:9 cab:7 iso:8 xz:23 txz:23 lzma:16 tar:13 cpio:12 bz2:2 bzip2:2 tbz2:2 tbz:2 gz:14 gzip:14 tgz:14 tpz:14 z:5 taz:5 lz:16 tlz:16 liz:28 lz4:26 lz5:27 lzh:6 lha:6 rpm:10 deb:11 arj:4 vhd:20 wim:15 swm:15 esd:15 fat:21 ntfs:22 dmg:17 hfs:18 xar:19 squashfs:24 zst:25"
|
||||
100 "7z:0 zip:1 rar:3 001:9 cab:7 iso:8 xz:23 txz:23 lzma:16 tar:13 cpio:12 bz2:2 bzip2:2 tbz2:2 tbz:2 gz:14 gzip:14 tgz:14 tpz:14 z:5 taz:5 lz:16 tlz:16 liz:28 lz4:26 lz5:27 lzh:6 lha:6 rpm:10 deb:11 arj:4 vhd:20 vhdx:20 wim:15 swm:15 esd:15 fat:21 ntfs:22 dmg:17 hfs:18 xar:19 squashfs:24 zst:25"
|
||||
END
|
||||
|
||||
@@ -208,7 +208,7 @@ static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
|
||||
if (!IsWildcardFilePathLegal(name))
|
||||
return false;
|
||||
*/
|
||||
bool isWildcard = DoesNameContainWildcard(name);
|
||||
const bool isWildcard = DoesNameContainWildcard(name);
|
||||
bool recursed = false;
|
||||
|
||||
switch (type)
|
||||
@@ -223,7 +223,10 @@ static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
|
||||
recursed = false;
|
||||
break;
|
||||
}
|
||||
wildcardCensor.AddPreItem(include, name, recursed, true);
|
||||
|
||||
NWildcard::CCensorPathProps props;
|
||||
props.Recursive = recursed;
|
||||
wildcardCensor.AddPreItem(include, name, props);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ static int APIENTRY WinMain2()
|
||||
v1.Add(fs2us(fullPath));
|
||||
v2.Add(fs2us(fullPath));
|
||||
NWildcard::CCensorNode wildcardCensor;
|
||||
wildcardCensor.AddItem(true, L"*", true, true, true, true);
|
||||
wildcardCensor.Add_Wildcard();
|
||||
|
||||
bool messageWasDisplayed = false;
|
||||
result = ExtractGUI(codecs,
|
||||
|
||||
@@ -263,8 +263,13 @@ STDMETHODIMP CInFileStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPos
|
||||
}
|
||||
#endif
|
||||
|
||||
UInt64 realNewPosition;
|
||||
bool result = File.Seek(offset, seekOrigin, realNewPosition);
|
||||
UInt64 realNewPosition = 0;
|
||||
const bool result = File.Seek(offset, seekOrigin, realNewPosition);
|
||||
const HRESULT hres = ConvertBoolToHRESULT(result);
|
||||
|
||||
/* 21.07: new File.Seek() in 21.07 already returns correct (realNewPosition)
|
||||
in case of error. So we don't need additional code below */
|
||||
// if (!result) { realNewPosition = 0; File.GetPosition(realNewPosition); }
|
||||
|
||||
#ifdef SUPPORT_DEVICE_FILE
|
||||
PhyPos = VirtPos = realNewPosition;
|
||||
@@ -272,13 +277,19 @@ STDMETHODIMP CInFileStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPos
|
||||
|
||||
if (newPosition)
|
||||
*newPosition = realNewPosition;
|
||||
return ConvertBoolToHRESULT(result);
|
||||
|
||||
return hres;
|
||||
|
||||
#else
|
||||
|
||||
off_t res = File.seek((off_t)offset, (int)seekOrigin);
|
||||
const off_t res = File.seek((off_t)offset, (int)seekOrigin);
|
||||
if (res == -1)
|
||||
return GetLastError_HRESULT();
|
||||
{
|
||||
const HRESULT hres = GetLastError_HRESULT();
|
||||
if (newPosition)
|
||||
*newPosition = (UInt64)File.seekToCur();
|
||||
return hres;
|
||||
}
|
||||
if (newPosition)
|
||||
*newPosition = (UInt64)res;
|
||||
return S_OK;
|
||||
@@ -435,15 +446,15 @@ STDMETHODIMP COutFileStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPo
|
||||
|
||||
#ifdef USE_WIN_FILE
|
||||
|
||||
UInt64 realNewPosition;
|
||||
bool result = File.Seek(offset, seekOrigin, realNewPosition);
|
||||
UInt64 realNewPosition = 0;
|
||||
const bool result = File.Seek(offset, seekOrigin, realNewPosition);
|
||||
if (newPosition)
|
||||
*newPosition = realNewPosition;
|
||||
return ConvertBoolToHRESULT(result);
|
||||
|
||||
#else
|
||||
|
||||
off_t res = File.seek((off_t)offset, (int)seekOrigin);
|
||||
const off_t res = File.seek((off_t)offset, (int)seekOrigin);
|
||||
if (res == -1)
|
||||
return GetLastError_HRESULT();
|
||||
if (newPosition)
|
||||
@@ -455,24 +466,7 @@ STDMETHODIMP COutFileStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPo
|
||||
|
||||
STDMETHODIMP COutFileStream::SetSize(UInt64 newSize)
|
||||
{
|
||||
#ifdef USE_WIN_FILE
|
||||
|
||||
UInt64 currentPos;
|
||||
if (!File.Seek(0, FILE_CURRENT, currentPos))
|
||||
return E_FAIL;
|
||||
bool result = File.SetLength(newSize);
|
||||
UInt64 currentPos2;
|
||||
result = result && File.Seek(currentPos, currentPos2);
|
||||
return result ? S_OK : E_FAIL;
|
||||
|
||||
#else
|
||||
|
||||
// SetLength() uses ftruncate() that doesn't change file offset
|
||||
if (!File.SetLength(newSize))
|
||||
return GetLastError_HRESULT();
|
||||
return S_OK;
|
||||
|
||||
#endif
|
||||
return ConvertBoolToHRESULT(File.SetLength_KeepPosition(newSize));
|
||||
}
|
||||
|
||||
HRESULT COutFileStream::GetSize(UInt64 *size)
|
||||
|
||||
@@ -37,12 +37,34 @@ STDMETHODIMP CCopyCoder::Code(ISequentialInStream *inStream,
|
||||
for (;;)
|
||||
{
|
||||
UInt32 size = kBufSize;
|
||||
if (outSize && size > *outSize - TotalSize)
|
||||
size = (UInt32)(*outSize - TotalSize);
|
||||
if (size == 0)
|
||||
return S_OK;
|
||||
if (outSize)
|
||||
{
|
||||
const UInt64 rem = *outSize - TotalSize;
|
||||
if (size > rem)
|
||||
{
|
||||
size = (UInt32)rem;
|
||||
if (size == 0)
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT readRes = inStream->Read(_buf, size, &size);
|
||||
HRESULT readRes;
|
||||
{
|
||||
UInt32 pos = 0;
|
||||
do
|
||||
{
|
||||
const UInt32 curSize = size - pos;
|
||||
UInt32 processed = 0;
|
||||
readRes = inStream->Read(_buf + pos, curSize, &processed);
|
||||
if (processed > curSize)
|
||||
return E_FAIL; // internal code failure
|
||||
pos += processed;
|
||||
if (readRes != S_OK || processed == 0)
|
||||
break;
|
||||
}
|
||||
while (pos < kBufSize);
|
||||
size = pos;
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
return readRes;
|
||||
@@ -52,12 +74,15 @@ STDMETHODIMP CCopyCoder::Code(ISequentialInStream *inStream,
|
||||
UInt32 pos = 0;
|
||||
do
|
||||
{
|
||||
UInt32 curSize = size - pos;
|
||||
HRESULT res = outStream->Write(_buf + pos, curSize, &curSize);
|
||||
pos += curSize;
|
||||
TotalSize += curSize;
|
||||
const UInt32 curSize = size - pos;
|
||||
UInt32 processed = 0;
|
||||
const HRESULT res = outStream->Write(_buf + pos, curSize, &processed);
|
||||
if (processed > curSize)
|
||||
return E_FAIL; // internal code failure
|
||||
pos += processed;
|
||||
TotalSize += processed;
|
||||
RINOK(res);
|
||||
if (curSize == 0)
|
||||
if (processed == 0)
|
||||
return E_FAIL;
|
||||
}
|
||||
while (pos < size);
|
||||
@@ -67,7 +92,10 @@ STDMETHODIMP CCopyCoder::Code(ISequentialInStream *inStream,
|
||||
|
||||
RINOK(readRes);
|
||||
|
||||
if (progress)
|
||||
if (size != kBufSize)
|
||||
return S_OK;
|
||||
|
||||
if (progress && (TotalSize & (((UInt32)1 << 22) - 1)) == 0)
|
||||
{
|
||||
RINOK(progress->SetRatioInfo(&TotalSize, &TotalSize));
|
||||
}
|
||||
|
||||
@@ -173,7 +173,8 @@ Handler GUIDs:
|
||||
10 lz5
|
||||
11 liz
|
||||
|
||||
C4 Lzip
|
||||
C3 Lzip
|
||||
C4 Vhdx
|
||||
C5 Base64
|
||||
C6 COFF
|
||||
C7 Ext
|
||||
|
||||
@@ -1887,23 +1887,23 @@ STDMETHODIMP CAgent::GetArcProp(UInt32 level, PROPID propID, PROPVARIANT *value)
|
||||
break;
|
||||
case kpidErrorFlags:
|
||||
{
|
||||
UInt32 flags = arc.ErrorInfo.GetErrorFlags();
|
||||
const UInt32 flags = arc.ErrorInfo.GetErrorFlags();
|
||||
if (flags != 0)
|
||||
prop = flags;
|
||||
break;
|
||||
}
|
||||
case kpidWarningFlags:
|
||||
{
|
||||
UInt32 flags = arc.ErrorInfo.GetWarningFlags();
|
||||
const UInt32 flags = arc.ErrorInfo.GetWarningFlags();
|
||||
if (flags != 0)
|
||||
prop = flags;
|
||||
break;
|
||||
}
|
||||
case kpidOffset:
|
||||
{
|
||||
Int64 v = arc.GetGlobalOffset();
|
||||
const Int64 v = arc.GetGlobalOffset();
|
||||
if (v != 0)
|
||||
prop = v;
|
||||
prop.Set_Int64(v);
|
||||
break;
|
||||
}
|
||||
case kpidTailSize:
|
||||
|
||||
@@ -151,6 +151,7 @@ enum Enum
|
||||
kCaseSensitive,
|
||||
kArcNameMode,
|
||||
|
||||
kUseSlashMark,
|
||||
kDisableWildcardParsing,
|
||||
kElimDup,
|
||||
kFullPathMode,
|
||||
@@ -294,6 +295,7 @@ static const CSwitchForm kSwitchForms[] =
|
||||
{ "ssc", SWFRM_MINUS },
|
||||
{ "sa", NSwitchType::kChar, false, 1, k_ArcNameMode_PostCharSet },
|
||||
|
||||
{ "spm", SWFRM_STRING_SINGL(0) },
|
||||
{ "spd", SWFRM_SIMPLE },
|
||||
{ "spe", SWFRM_MINUS },
|
||||
{ "spf", SWFRM_STRING_SINGL(0) },
|
||||
@@ -407,12 +409,28 @@ static bool ParseArchiveCommand(const UString &commandString, CArcCommand &comma
|
||||
// ------------------------------------------------------------------
|
||||
// filenames functions
|
||||
|
||||
struct CNameOption
|
||||
{
|
||||
bool Include;
|
||||
bool WildcardMatching;
|
||||
Byte MarkMode;
|
||||
NRecursedType::EEnum RecursedType;
|
||||
|
||||
CNameOption():
|
||||
Include(true),
|
||||
WildcardMatching(true),
|
||||
MarkMode(NWildcard::kMark_FileOrDir),
|
||||
RecursedType(NRecursedType::kNonRecursed)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
static void AddNameToCensor(NWildcard::CCensor &censor,
|
||||
const UString &name, bool include, NRecursedType::EEnum type, bool wildcardMatching)
|
||||
const CNameOption &nop, const UString &name)
|
||||
{
|
||||
bool recursed = false;
|
||||
|
||||
switch (type)
|
||||
switch (nop.RecursedType)
|
||||
{
|
||||
case NRecursedType::kWildcardOnlyRecursed:
|
||||
recursed = DoesNameContainWildcard(name);
|
||||
@@ -423,7 +441,12 @@ static void AddNameToCensor(NWildcard::CCensor &censor,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
censor.AddPreItem(include, name, recursed, wildcardMatching);
|
||||
|
||||
NWildcard::CCensorPathProps props;
|
||||
props.Recursive = recursed;
|
||||
props.WildcardMatching = nop.WildcardMatching;
|
||||
props.MarkMode = nop.MarkMode;
|
||||
censor.AddPreItem(nop.Include, name, props);
|
||||
}
|
||||
|
||||
static void AddRenamePair(CObjectVector<CRenamePair> *renamePairs,
|
||||
@@ -454,7 +477,7 @@ static void AddRenamePair(CObjectVector<CRenamePair> *renamePairs,
|
||||
static void AddToCensorFromListFile(
|
||||
CObjectVector<CRenamePair> *renamePairs,
|
||||
NWildcard::CCensor &censor,
|
||||
LPCWSTR fileName, bool include, NRecursedType::EEnum type, bool wildcardMatching, UInt32 codePage)
|
||||
const CNameOption &nop, LPCWSTR fileName, UInt32 codePage)
|
||||
{
|
||||
UStringVector names;
|
||||
/*
|
||||
@@ -481,12 +504,12 @@ static void AddToCensorFromListFile(
|
||||
for (unsigned i = 0; i < names.Size(); i += 2)
|
||||
{
|
||||
// change type !!!!
|
||||
AddRenamePair(renamePairs, names[i], names[i + 1], type, wildcardMatching);
|
||||
AddRenamePair(renamePairs, names[i], names[i + 1], nop.RecursedType, nop.WildcardMatching);
|
||||
}
|
||||
}
|
||||
else
|
||||
FOR_VECTOR (i, names)
|
||||
AddNameToCensor(censor, names[i], include, type, wildcardMatching);
|
||||
AddNameToCensor(censor, nop, names[i]);
|
||||
}
|
||||
|
||||
static void AddToCensorFromNonSwitchesStrings(
|
||||
@@ -495,14 +518,27 @@ static void AddToCensorFromNonSwitchesStrings(
|
||||
NWildcard::CCensor &censor,
|
||||
const UStringVector &nonSwitchStrings,
|
||||
int stopSwitchIndex,
|
||||
NRecursedType::EEnum type,
|
||||
bool wildcardMatching,
|
||||
const CNameOption &nop,
|
||||
bool thereAreSwitchIncludes, UInt32 codePage)
|
||||
{
|
||||
// another default
|
||||
if ((renamePairs || nonSwitchStrings.Size() == startIndex) && !thereAreSwitchIncludes)
|
||||
AddNameToCensor(censor, UString(kUniversalWildcard), true, type,
|
||||
true // wildcardMatching
|
||||
);
|
||||
{
|
||||
/* for rename command: -i switch sets the mask for archive item reading.
|
||||
if (thereAreSwitchIncludes), { we don't use UniversalWildcard. }
|
||||
also for non-rename command: we set UniversalWildcard, only if there are no nonSwitches. */
|
||||
// we use default fileds in (CNameOption) for UniversalWildcard.
|
||||
CNameOption nop2;
|
||||
// recursive mode is not important for UniversalWildcard (*)
|
||||
// nop2.RecursedType = nop.RecursedType; // we don't need it
|
||||
/*
|
||||
nop2.RecursedType = NRecursedType::kNonRecursed;
|
||||
nop2.Include = true;
|
||||
nop2.WildcardMatching = true;
|
||||
nop2.MarkMode = NWildcard::kMark_FileOrDir;
|
||||
*/
|
||||
AddNameToCensor(censor, nop2, UString(kUniversalWildcard));
|
||||
}
|
||||
|
||||
int oldIndex = -1;
|
||||
|
||||
@@ -515,7 +551,7 @@ static void AddToCensorFromNonSwitchesStrings(
|
||||
if (s.IsEmpty())
|
||||
throw CArcCmdLineException(kEmptyFilePath);
|
||||
if (i < (unsigned)stopSwitchIndex && s[0] == kFileListID)
|
||||
AddToCensorFromListFile(renamePairs, censor, s.Ptr(1), true, type, wildcardMatching, codePage);
|
||||
AddToCensorFromListFile(renamePairs, censor, nop, s.Ptr(1), codePage);
|
||||
else if (renamePairs)
|
||||
{
|
||||
if (oldIndex == -1)
|
||||
@@ -523,13 +559,13 @@ static void AddToCensorFromNonSwitchesStrings(
|
||||
else
|
||||
{
|
||||
// NRecursedType::EEnum type is used for global wildcard (-i! switches)
|
||||
AddRenamePair(renamePairs, nonSwitchStrings[(unsigned)oldIndex], s, NRecursedType::kNonRecursed, wildcardMatching);
|
||||
AddRenamePair(renamePairs, nonSwitchStrings[(unsigned)oldIndex], s, NRecursedType::kNonRecursed, nop.WildcardMatching);
|
||||
// AddRenamePair(renamePairs, nonSwitchStrings[oldIndex], s, type);
|
||||
oldIndex = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
AddNameToCensor(censor, s, true, type, wildcardMatching);
|
||||
AddNameToCensor(censor, nop, s);
|
||||
}
|
||||
|
||||
if (oldIndex != -1)
|
||||
@@ -557,9 +593,8 @@ static const char * const k_IncorrectMapCommand = "Incorrect Map command";
|
||||
|
||||
static const char *ParseMapWithPaths(
|
||||
NWildcard::CCensor &censor,
|
||||
const UString &s2, bool include,
|
||||
NRecursedType::EEnum commonRecursedType,
|
||||
bool wildcardMatching)
|
||||
const UString &s2,
|
||||
const CNameOption &nop)
|
||||
{
|
||||
UString s (s2);
|
||||
int pos = s.Find(L':');
|
||||
@@ -598,7 +633,7 @@ static const char *ParseMapWithPaths(
|
||||
if (c == 0)
|
||||
{
|
||||
// MessageBoxW(0, name, L"7-Zip ZS", 0);
|
||||
AddNameToCensor(censor, name, include, commonRecursedType, wildcardMatching);
|
||||
AddNameToCensor(censor, nop, name);
|
||||
name.Empty();
|
||||
}
|
||||
else
|
||||
@@ -614,9 +649,8 @@ static const char *ParseMapWithPaths(
|
||||
|
||||
static void AddSwitchWildcardsToCensor(
|
||||
NWildcard::CCensor &censor,
|
||||
const UStringVector &strings, bool include,
|
||||
NRecursedType::EEnum commonRecursedType,
|
||||
bool wildcardMatching,
|
||||
const UStringVector &strings,
|
||||
const CNameOption &nop,
|
||||
UInt32 codePage)
|
||||
{
|
||||
const char *errorMessage = NULL;
|
||||
@@ -624,7 +658,6 @@ static void AddSwitchWildcardsToCensor(
|
||||
for (i = 0; i < strings.Size(); i++)
|
||||
{
|
||||
const UString &name = strings[i];
|
||||
NRecursedType::EEnum recursedType;
|
||||
unsigned pos = 0;
|
||||
|
||||
if (name.Len() < kSomeCludePostStringMinSize)
|
||||
@@ -633,7 +666,7 @@ static void AddSwitchWildcardsToCensor(
|
||||
break;
|
||||
}
|
||||
|
||||
if (!include)
|
||||
if (!nop.Include)
|
||||
{
|
||||
if (name.IsEqualTo_Ascii_NoCase("td"))
|
||||
{
|
||||
@@ -647,20 +680,85 @@ static void AddSwitchWildcardsToCensor(
|
||||
}
|
||||
}
|
||||
|
||||
if (::MyCharLower_Ascii(name[pos]) == kRecursedIDChar)
|
||||
CNameOption nop2 = nop;
|
||||
|
||||
bool type_WasUsed = false;
|
||||
bool recursed_WasUsed = false;
|
||||
bool matching_WasUsed = false;
|
||||
bool error = false;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
pos++;
|
||||
wchar_t c = name[pos];
|
||||
int index = -1;
|
||||
if (c <= 0x7F)
|
||||
index = FindCharPosInString(kRecursedPostCharSet, (char)c);
|
||||
recursedType = GetRecursedTypeFromIndex(index);
|
||||
if (index >= 0)
|
||||
wchar_t c = ::MyCharLower_Ascii(name[pos]);
|
||||
if (c == kRecursedIDChar)
|
||||
{
|
||||
if (recursed_WasUsed)
|
||||
{
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
recursed_WasUsed = true;
|
||||
pos++;
|
||||
c = name[pos];
|
||||
int index = -1;
|
||||
if (c <= 0x7F)
|
||||
index = FindCharPosInString(kRecursedPostCharSet, (char)c);
|
||||
nop2.RecursedType = GetRecursedTypeFromIndex(index);
|
||||
if (index >= 0)
|
||||
{
|
||||
pos++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == 'w')
|
||||
{
|
||||
if (matching_WasUsed)
|
||||
{
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
matching_WasUsed = true;
|
||||
nop2.WildcardMatching = true;
|
||||
pos++;
|
||||
if (name[pos] == '-')
|
||||
{
|
||||
nop2.WildcardMatching = false;
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
else if (c == 'm')
|
||||
{
|
||||
if (type_WasUsed)
|
||||
{
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
type_WasUsed = true;
|
||||
pos++;
|
||||
nop2.MarkMode = NWildcard::kMark_StrictFile;
|
||||
c = name[pos];
|
||||
if (c == '-')
|
||||
{
|
||||
nop2.MarkMode = NWildcard::kMark_FileOrDir;
|
||||
pos++;
|
||||
}
|
||||
else if (c == '2')
|
||||
{
|
||||
nop2.MarkMode = NWildcard::kMark_StrictFile_IfWildcard;
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else
|
||||
recursedType = commonRecursedType;
|
||||
|
||||
if (error)
|
||||
{
|
||||
errorMessage = "inorrect switch";
|
||||
break;
|
||||
}
|
||||
|
||||
if (name.Len() < pos + kSomeCludeAfterRecursedPostStringMinSize)
|
||||
{
|
||||
errorMessage = "Too short switch";
|
||||
@@ -668,15 +766,17 @@ static void AddSwitchWildcardsToCensor(
|
||||
}
|
||||
|
||||
const UString tail = name.Ptr(pos + 1);
|
||||
|
||||
if (name[pos] == kImmediateNameID)
|
||||
AddNameToCensor(censor, tail, include, recursedType, wildcardMatching);
|
||||
else if (name[pos] == kFileListID)
|
||||
AddToCensorFromListFile(NULL, censor, tail, include, recursedType, wildcardMatching, codePage);
|
||||
|
||||
const wchar_t c = name[pos];
|
||||
|
||||
if (c == kImmediateNameID)
|
||||
AddNameToCensor(censor, nop2, tail);
|
||||
else if (c == kFileListID)
|
||||
AddToCensorFromListFile(NULL, censor, nop2, tail, codePage);
|
||||
#ifdef _WIN32
|
||||
else if (name[pos] == kMapNameID)
|
||||
else if (c == kMapNameID)
|
||||
{
|
||||
errorMessage = ParseMapWithPaths(censor, tail, include, recursedType, wildcardMatching);
|
||||
errorMessage = ParseMapWithPaths(censor, tail, nop2);
|
||||
if (errorMessage)
|
||||
break;
|
||||
}
|
||||
@@ -687,6 +787,7 @@ static void AddSwitchWildcardsToCensor(
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i != strings.Size())
|
||||
throw CArcCmdLineException(errorMessage, strings[i]);
|
||||
}
|
||||
@@ -1165,32 +1266,48 @@ void CArcCmdLineParser::Parse2(CArcCmdLineOptions &options)
|
||||
if (parser[NKey::kNameTrailReplace].ThereIs)
|
||||
g_PathTrailReplaceMode = !parser[NKey::kNameTrailReplace].WithMinus;
|
||||
|
||||
NRecursedType::EEnum recursedType;
|
||||
if (parser[NKey::kRecursed].ThereIs)
|
||||
recursedType = GetRecursedTypeFromIndex(parser[NKey::kRecursed].PostCharIndex);
|
||||
else
|
||||
recursedType = NRecursedType::kNonRecursed;
|
||||
CNameOption nop;
|
||||
|
||||
if (parser[NKey::kRecursed].ThereIs)
|
||||
nop.RecursedType = GetRecursedTypeFromIndex(parser[NKey::kRecursed].PostCharIndex);
|
||||
|
||||
bool wildcardMatching = true;
|
||||
if (parser[NKey::kDisableWildcardParsing].ThereIs)
|
||||
wildcardMatching = false;
|
||||
nop.WildcardMatching = false;
|
||||
|
||||
if (parser[NKey::kUseSlashMark].ThereIs)
|
||||
{
|
||||
const UString &s = parser[NKey::kUseSlashMark].PostStrings[0];
|
||||
if (s.IsEmpty())
|
||||
nop.MarkMode = NWildcard::kMark_StrictFile;
|
||||
else if (s.IsEqualTo_Ascii_NoCase("-"))
|
||||
nop.MarkMode = NWildcard::kMark_FileOrDir;
|
||||
else if (s.IsEqualTo_Ascii_NoCase("2"))
|
||||
nop.MarkMode = NWildcard::kMark_StrictFile_IfWildcard;
|
||||
else
|
||||
throw CArcCmdLineException("Unsupported -spm:", s);
|
||||
}
|
||||
|
||||
|
||||
options.ConsoleCodePage = FindCharset(parser, NKey::kConsoleCharSet, true, -1);
|
||||
|
||||
UInt32 codePage = (UInt32)FindCharset(parser, NKey::kListfileCharSet, false, CP_UTF8);
|
||||
|
||||
bool thereAreSwitchIncludes = false;
|
||||
|
||||
|
||||
if (parser[NKey::kInclude].ThereIs)
|
||||
{
|
||||
thereAreSwitchIncludes = true;
|
||||
nop.Include = true;
|
||||
AddSwitchWildcardsToCensor(options.Censor,
|
||||
parser[NKey::kInclude].PostStrings, true, recursedType, wildcardMatching, codePage);
|
||||
parser[NKey::kInclude].PostStrings, nop, codePage);
|
||||
}
|
||||
|
||||
if (parser[NKey::kExclude].ThereIs)
|
||||
{
|
||||
nop.Include = false;
|
||||
AddSwitchWildcardsToCensor(options.Censor,
|
||||
parser[NKey::kExclude].PostStrings, false, recursedType, wildcardMatching, codePage);
|
||||
parser[NKey::kExclude].PostStrings, nop, codePage);
|
||||
}
|
||||
|
||||
unsigned curCommandIndex = kCommandIndex + 1;
|
||||
bool thereIsArchiveName = !parser[NKey::kNoArName].ThereIs &&
|
||||
@@ -1198,9 +1315,9 @@ void CArcCmdLineParser::Parse2(CArcCmdLineOptions &options)
|
||||
options.Command.CommandType != NCommandType::kInfo &&
|
||||
options.Command.CommandType != NCommandType::kHash;
|
||||
|
||||
bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
|
||||
bool isExtractOrList = isExtractGroupCommand || options.Command.CommandType == NCommandType::kList;
|
||||
bool isRename = options.Command.CommandType == NCommandType::kRename;
|
||||
const bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
|
||||
const bool isExtractOrList = isExtractGroupCommand || options.Command.CommandType == NCommandType::kList;
|
||||
const bool isRename = options.Command.CommandType == NCommandType::kRename;
|
||||
|
||||
if ((isExtractOrList || isRename) && options.StdInMode)
|
||||
thereIsArchiveName = false;
|
||||
@@ -1220,10 +1337,11 @@ void CArcCmdLineParser::Parse2(CArcCmdLineOptions &options)
|
||||
#endif
|
||||
}
|
||||
|
||||
nop.Include = true;
|
||||
AddToCensorFromNonSwitchesStrings(isRename ? &options.UpdateOptions.RenamePairs : NULL,
|
||||
curCommandIndex, options.Censor,
|
||||
nonSwitchStrings, parser.StopSwitchIndex,
|
||||
recursedType, wildcardMatching,
|
||||
nop,
|
||||
thereAreSwitchIncludes, codePage);
|
||||
|
||||
options.YesToAll = parser[NKey::kYes].ThereIs;
|
||||
@@ -1317,13 +1435,28 @@ void CArcCmdLineParser::Parse2(CArcCmdLineOptions &options)
|
||||
|
||||
NWildcard::CCensor &arcCensor = options.arcCensor;
|
||||
|
||||
CNameOption nopArc;
|
||||
// nopArc.RecursedType = NRecursedType::kNonRecursed; // default: we don't want recursing for archives, if -r specified
|
||||
// is it OK, external switches can disable WildcardMatching and MarcMode for arc.
|
||||
nopArc.WildcardMatching = nop.WildcardMatching;
|
||||
nopArc.MarkMode = nop.MarkMode;
|
||||
|
||||
if (parser[NKey::kArInclude].ThereIs)
|
||||
AddSwitchWildcardsToCensor(arcCensor, parser[NKey::kArInclude].PostStrings, true, NRecursedType::kNonRecursed, wildcardMatching, codePage);
|
||||
{
|
||||
nopArc.Include = true;
|
||||
AddSwitchWildcardsToCensor(arcCensor, parser[NKey::kArInclude].PostStrings, nopArc, codePage);
|
||||
}
|
||||
if (parser[NKey::kArExclude].ThereIs)
|
||||
AddSwitchWildcardsToCensor(arcCensor, parser[NKey::kArExclude].PostStrings, false, NRecursedType::kNonRecursed, wildcardMatching, codePage);
|
||||
{
|
||||
nopArc.Include = false;
|
||||
AddSwitchWildcardsToCensor(arcCensor, parser[NKey::kArExclude].PostStrings, nopArc, codePage);
|
||||
}
|
||||
|
||||
if (thereIsArchiveName)
|
||||
AddNameToCensor(arcCensor, options.ArchiveName, true, NRecursedType::kNonRecursed, wildcardMatching);
|
||||
{
|
||||
nopArc.Include = true;
|
||||
AddNameToCensor(arcCensor, nopArc, options.ArchiveName);
|
||||
}
|
||||
|
||||
arcCensor.AddPathsToCensor(NWildcard::k_RelatPath);
|
||||
|
||||
@@ -1515,7 +1648,7 @@ FString GetModuleDirPrefix()
|
||||
{
|
||||
FString s;
|
||||
|
||||
s = g_ModuleDirPrefix;
|
||||
s = fas2fs(g_ModuleDirPrefix);
|
||||
if (s.IsEmpty())
|
||||
s = FTEXT(".") FSTRING_PATH_SEPARATOR;
|
||||
return s;
|
||||
|
||||
@@ -1000,8 +1000,8 @@ HRESULT CArchiveExtractCallback::CheckExistFile(FString &fullProcessedPath, bool
|
||||
|
||||
if (_overwriteMode == NExtract::NOverwriteMode::kAsk)
|
||||
{
|
||||
int slashPos = fullProcessedPath.ReverseFind_PathSepar();
|
||||
FString realFullProcessedPath (fullProcessedPath.Left((unsigned)(slashPos + 1)) + fileInfo.Name);
|
||||
const int slashPos = fullProcessedPath.ReverseFind_PathSepar();
|
||||
const FString realFullProcessedPath = fullProcessedPath.Left((unsigned)(slashPos + 1)) + fileInfo.Name;
|
||||
|
||||
/* (fileInfo) can be symbolic link.
|
||||
we can show final file properties here. */
|
||||
|
||||
@@ -48,7 +48,7 @@ STDMETHODIMP COpenCallbackImp::GetProperty(PROPID propID, PROPVARIANT *value)
|
||||
else
|
||||
switch (propID)
|
||||
{
|
||||
case kpidName: prop = _fileInfo.Name; break;
|
||||
case kpidName: prop = fs2us(_fileInfo.Name); break;
|
||||
case kpidIsDir: prop = _fileInfo.IsDir(); break;
|
||||
case kpidSize: prop = _fileInfo.Size; break;
|
||||
case kpidAttrib: prop = (UInt32)_fileInfo.Attrib; break;
|
||||
@@ -103,12 +103,20 @@ STDMETHODIMP COpenCallbackImp::GetStream(const wchar_t *name, IInStream **inStre
|
||||
if (!IsSafePath(name2))
|
||||
return S_FALSE;
|
||||
|
||||
// #ifdef _WIN32
|
||||
// we don't want to support wildcards in names here here
|
||||
if (name2.Find(L'?') >= 0 ||
|
||||
name2.Find(L'*') >= 0)
|
||||
#ifdef _WIN32
|
||||
/* WIN32 allows wildcards in Find() function
|
||||
and doesn't allow wildcard in File.Open()
|
||||
so we can work without the following wildcard check here */
|
||||
if (name2.Find(L'*') >= 0)
|
||||
return S_FALSE;
|
||||
// #endif
|
||||
{
|
||||
int startPos = 0;
|
||||
if (name2.IsPrefixedBy_Ascii_NoCase("\\\\?\\"))
|
||||
startPos = 3;
|
||||
if (name2.Find(L'?', startPos) >= 0)
|
||||
return S_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -866,7 +866,7 @@ struct CAffinityMode
|
||||
DWORD_PTR GetAffinityMask(UInt32 bundleIndex, CCpuSet *cpuSet) const;
|
||||
bool NeedAffinity() const { return NumBundleThreads != 0; }
|
||||
|
||||
WRes CreateThread_WithAffinity(NWindows::CThread &thread, THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter, UInt32 bundleIndex) const
|
||||
WRes CreateThread_WithAffinity(NWindows::CThread &thread, THREAD_FUNC_TYPE startAddress, LPVOID parameter, UInt32 bundleIndex) const
|
||||
{
|
||||
if (NeedAffinity())
|
||||
{
|
||||
|
||||
@@ -35,12 +35,16 @@ using namespace NWindows;
|
||||
|
||||
#define k7zGui "7zG.exe"
|
||||
|
||||
// 21.07 : we can disable wildcard
|
||||
// #define ISWITCH_NO_WILDCARD_POSTFIX "w-"
|
||||
#define ISWITCH_NO_WILDCARD_POSTFIX
|
||||
|
||||
#define kShowDialogSwitch " -ad"
|
||||
#define kEmailSwitch " -seml."
|
||||
#define kIncludeSwitch " -i"
|
||||
#define kArchiveTypeSwitch " -t"
|
||||
#define kArcIncludeSwitches " -an -ai"
|
||||
#define kHashIncludeSwitches " -i"
|
||||
#define kIncludeSwitch " -i" ISWITCH_NO_WILDCARD_POSTFIX
|
||||
#define kArcIncludeSwitches " -an -ai" ISWITCH_NO_WILDCARD_POSTFIX
|
||||
#define kHashIncludeSwitches kIncludeSwitch
|
||||
#define kStopSwitchParsing " --"
|
||||
|
||||
static NCompression::CInfo m_RegistryInfo;
|
||||
|
||||
@@ -124,7 +124,7 @@ HRESULT CompressFiles(
|
||||
NWildcard::CCensor censor;
|
||||
FOR_VECTOR (i, names)
|
||||
{
|
||||
censor.AddPreItem(names[i]);
|
||||
censor.AddPreItem_NoWildcard(names[i]);
|
||||
}
|
||||
|
||||
bool messageWasDisplayed = false;
|
||||
@@ -178,7 +178,7 @@ static HRESULT ExtractGroupCommand(const UStringVector &arcPaths,
|
||||
NWildcard::CCensor arcCensor;
|
||||
FOR_VECTOR (i, arcPaths)
|
||||
{
|
||||
arcCensor.AddPreItem(arcPaths[i]);
|
||||
arcCensor.AddPreItem_NoWildcard(arcPaths[i]);
|
||||
}
|
||||
arcCensor.AddPathsToCensor(NWildcard::k_RelatPath);
|
||||
CDirItemsStat st;
|
||||
@@ -268,7 +268,7 @@ void CalcChecksum(const UStringVector &paths,
|
||||
NWildcard::CCensor censor;
|
||||
FOR_VECTOR (i, paths)
|
||||
{
|
||||
censor.AddPreItem(paths[i]);
|
||||
censor.AddPreItem_NoWildcard(paths[i]);
|
||||
}
|
||||
|
||||
censor.AddPathsToCensor(NWildcard::k_RelatPath);
|
||||
|
||||
@@ -767,6 +767,15 @@ static HRESULT EnumerateDirItems(
|
||||
const UString &name = item.PathParts.Front();
|
||||
FString fullPath = phyPrefix + us2fs(name);
|
||||
|
||||
/*
|
||||
// not possible now
|
||||
if (!item.ForDir && !item.ForFile)
|
||||
{
|
||||
RINOK(dirItems.AddError(fullPath, ERROR_INVALID_PARAMETER));
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) && !defined(UNDER_CE)
|
||||
bool needAltStreams = true;
|
||||
#endif
|
||||
@@ -823,9 +832,20 @@ static HRESULT EnumerateDirItems(
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
#ifdef _WIN32
|
||||
#define MY_ERROR_IS_DIR ERROR_FILE_NOT_FOUND
|
||||
#define MY_ERROR_NOT_DIR DI_DEFAULT_ERROR
|
||||
#else
|
||||
#define MY_ERROR_IS_DIR EISDIR
|
||||
#define MY_ERROR_NOT_DIR ENOTDIR
|
||||
#endif
|
||||
*/
|
||||
|
||||
const bool isDir = fi.IsDir();
|
||||
if ((isDir && !item.ForDir) || (!isDir && !item.ForFile))
|
||||
if (isDir ? !item.ForDir : !item.ForFile)
|
||||
{
|
||||
// RINOK(dirItems.AddError(fullPath, isDir ? MY_ERROR_IS_DIR: MY_ERROR_NOT_DIR));
|
||||
RINOK(dirItems.AddError(fullPath, DI_DEFAULT_ERROR));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -910,7 +910,7 @@ bool CHashPair::Parse(const char *s)
|
||||
return false;
|
||||
if (escape)
|
||||
{
|
||||
AString temp = Name;
|
||||
const AString temp (Name);
|
||||
return CSum_Name_EscapeToOriginal(temp, Name);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -974,6 +974,17 @@ static HRESULT Compress(
|
||||
|
||||
|
||||
|
||||
static bool Censor_AreAllAllowed(const NWildcard::CCensor &censor)
|
||||
{
|
||||
if (censor.Pairs.Size() != 1)
|
||||
return false;
|
||||
const NWildcard::CPair &pair = censor.Pairs[0];
|
||||
/* Censor_CheckPath() ignores (CPair::Prefix).
|
||||
So we also ignore (CPair::Prefix) here */
|
||||
// if (!pair.Prefix.IsEmpty()) return false;
|
||||
return pair.Head.AreAllAllowed();
|
||||
}
|
||||
|
||||
bool CensorNode_CheckPath2(const NWildcard::CCensorNode &node, const CReadArcItem &item, bool &include);
|
||||
|
||||
static bool Censor_CheckPath(const NWildcard::CCensor &censor, const CReadArcItem &item)
|
||||
@@ -981,9 +992,13 @@ static bool Censor_CheckPath(const NWildcard::CCensor &censor, const CReadArcIte
|
||||
bool finded = false;
|
||||
FOR_VECTOR (i, censor.Pairs)
|
||||
{
|
||||
/* (CPair::Prefix) in not used for matching items in archive.
|
||||
So we ignore (CPair::Prefix) here */
|
||||
bool include;
|
||||
if (CensorNode_CheckPath2(censor.Pairs[i].Head, item, include))
|
||||
{
|
||||
// Check it and FIXME !!!!
|
||||
// here we can exclude item via some Pair, that is still allowed by another Pair
|
||||
if (!include)
|
||||
return false;
|
||||
finded = true;
|
||||
@@ -1006,6 +1021,8 @@ static HRESULT EnumerateInArchiveItems(
|
||||
|
||||
CReadArcItem item;
|
||||
|
||||
const bool allFilesAreAllowed = Censor_AreAllAllowed(censor);
|
||||
|
||||
for (UInt32 i = 0; i < numItems; i++)
|
||||
{
|
||||
CArcItem ai;
|
||||
@@ -1024,7 +1041,10 @@ static HRESULT EnumerateInArchiveItems(
|
||||
if (!storeStreamsMode && ai.IsAltStream)
|
||||
continue;
|
||||
*/
|
||||
ai.Censored = Censor_CheckPath(censor, item);
|
||||
if (allFilesAreAllowed)
|
||||
ai.Censored = true;
|
||||
else
|
||||
ai.Censored = Censor_CheckPath(censor, item);
|
||||
|
||||
RINOK(arc.GetItemMTime(i, ai.MTime, ai.MTimeDefined));
|
||||
RINOK(arc.GetItemSize(i, ai.Size, ai.SizeDefined));
|
||||
@@ -1418,7 +1438,7 @@ HRESULT UpdateArchive(
|
||||
UString s;
|
||||
s = "It is not allowed to include archive to itself";
|
||||
s.Add_LF();
|
||||
s += path;
|
||||
s += fs2us(path);
|
||||
throw s;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ static unsigned GetColumnWidth(unsigned digestSize)
|
||||
|
||||
AString CHashCallbackConsole::GetFields() const
|
||||
{
|
||||
AString s = PrintFields;
|
||||
AString s (PrintFields);
|
||||
if (s.IsEmpty())
|
||||
s = "hsn";
|
||||
s.MakeLower_Ascii();
|
||||
@@ -313,7 +313,7 @@ HRESULT CHashCallbackConsole::SetOperationResult(UInt64 fileSize, const CHashBun
|
||||
s = kEmptyFileAlias;
|
||||
else
|
||||
{
|
||||
UString temp = _fileName;
|
||||
UString temp (_fileName);
|
||||
_so->Normalize_UString(temp);
|
||||
_so->Convert_UString_to_AString(temp, s);
|
||||
}
|
||||
|
||||
@@ -840,7 +840,7 @@ static void UString_Replace_CRLF_to_LF(UString &s)
|
||||
|
||||
static void PrintPropVal_MultiLine(CStdOutStream &so, const wchar_t *val)
|
||||
{
|
||||
UString s = val;
|
||||
UString s (val);
|
||||
if (s.Find(L'\n') >= 0)
|
||||
{
|
||||
so << endl;
|
||||
@@ -869,7 +869,7 @@ static void PrintPropPair(CStdOutStream &so, const char *name, const wchar_t *va
|
||||
PrintPropVal_MultiLine(so, val);
|
||||
return;
|
||||
}
|
||||
UString s = val;
|
||||
UString s (val);
|
||||
so.Normalize_UString(s);
|
||||
so << s;
|
||||
so << endl;
|
||||
|
||||
@@ -961,7 +961,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
|
||||
else
|
||||
name = fs2us(fi0.Name);
|
||||
name += ".sha256";
|
||||
cmi.Folder= folderPrefix;
|
||||
cmi.Folder = fs2us(folderPrefix);
|
||||
cmi.ArcName = name;
|
||||
s = "SHA-256 -> ";
|
||||
s += name;
|
||||
|
||||
@@ -13,6 +13,48 @@
|
||||
|
||||
#else
|
||||
|
||||
/* IShellItem is defined:
|
||||
ShObjIdl.h : old Windows SDK
|
||||
ShObjIdl_core.h : new Windows 10 SDK */
|
||||
|
||||
#include <ShObjIdl.h>
|
||||
|
||||
#ifndef __IShellItem_INTERFACE_DEFINED__
|
||||
#define __IShellItem_INTERFACE_DEFINED__
|
||||
|
||||
// For MINGW we define IShellItem
|
||||
|
||||
// #error Stop_Compiling__NOT_DEFINED__IShellItem_INTERFACE_DEFINED__
|
||||
|
||||
typedef
|
||||
enum
|
||||
{ SIGDN_NORMALDISPLAY = 0,
|
||||
SIGDN_PARENTRELATIVEPARSING = 0x80018001,
|
||||
SIGDN_PARENTRELATIVEFORADDRESSBAR = 0x8001c001,
|
||||
SIGDN_DESKTOPABSOLUTEPARSING = 0x80028000,
|
||||
SIGDN_PARENTRELATIVEEDITING = 0x80031001,
|
||||
SIGDN_DESKTOPABSOLUTEEDITING = 0x8004c000,
|
||||
SIGDN_FILESYSPATH = 0x80058000,
|
||||
SIGDN_URL = 0x80068000
|
||||
} SIGDN;
|
||||
|
||||
|
||||
typedef DWORD SICHINTF;
|
||||
typedef ULONG SFGAOF;
|
||||
|
||||
struct IShellItem : public IUnknown
|
||||
{
|
||||
virtual HRESULT STDMETHODCALLTYPE BindToHandler(IBindCtx *pbc, REFGUID rbhid, REFIID riid, void **ppvOut) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE GetParent(IShellItem **ppsi) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE GetDisplayName(SIGDN sigdnName, LPOLESTR *ppszName) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE GetAttributes(SFGAOF sfgaoMask, SFGAOF *psfgaoAttribs) = 0;
|
||||
virtual HRESULT STDMETHODCALLTYPE Compare(IShellItem *psi, SICHINTF hint, int *piOrder) = 0;
|
||||
};
|
||||
|
||||
#endif // __IShellItem_INTERFACE_DEFINED__
|
||||
|
||||
|
||||
|
||||
#ifndef __IShellItemArray_INTERFACE_DEFINED__
|
||||
#define __IShellItemArray_INTERFACE_DEFINED__
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ void CStartupInfo::RestoreScreen(HANDLE handle)
|
||||
|
||||
CSysString CStartupInfo::GetFullKeyName(const char *keyName) const
|
||||
{
|
||||
AString s = m_RegistryPath;
|
||||
AString s (m_RegistryPath);
|
||||
if (keyName && *keyName)
|
||||
{
|
||||
s += kRegistryKeyDelimiter;
|
||||
|
||||
@@ -224,14 +224,14 @@ STDMETHODIMP CFSDrives::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT
|
||||
switch (propID)
|
||||
{
|
||||
case kpidIsDir: prop = !_volumeMode; break;
|
||||
case kpidName: prop = di.Name; break;
|
||||
case kpidName: prop = fs2us(di.Name); break;
|
||||
case kpidOutName:
|
||||
if (!di.Name.IsEmpty() && di.Name.Back() == ':')
|
||||
{
|
||||
FString s = di.Name;
|
||||
s.DeleteBack();
|
||||
AddExt(s, itemIndex);
|
||||
prop = s;
|
||||
prop = fs2us(s);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -515,7 +515,7 @@ STDMETHODIMP CFSFolder::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
|
||||
}
|
||||
case kpidPrefix:
|
||||
if (fi.Parent >= 0)
|
||||
prop = Folders[fi.Parent];
|
||||
prop = fs2us(Folders[fi.Parent]);
|
||||
break;
|
||||
case kpidNumSubDirs: if (fi.IsDir() && fi.FolderStat_Defined) prop = fi.NumFolders; break;
|
||||
case kpidNumSubFiles: if (fi.IsDir() && fi.FolderStat_Defined) prop = fi.NumFiles; break;
|
||||
|
||||
@@ -473,7 +473,10 @@ static HRESULT CopyFile_Ask(
|
||||
|
||||
static FString CombinePath(const FString &folderPath, const FString &fileName)
|
||||
{
|
||||
return folderPath + FCHAR_PATH_SEPARATOR + fileName;
|
||||
FString s (folderPath);
|
||||
s.Add_PathSepar(); // FCHAR_PATH_SEPARATOR
|
||||
s += fileName;
|
||||
return s;
|
||||
}
|
||||
|
||||
static bool IsDestChild(const FString &src, const FString &dest)
|
||||
|
||||
@@ -486,6 +486,8 @@ void CFileMenu::Load(HMENU hMenu, unsigned startPos)
|
||||
ReadRegDiff(diffPath);
|
||||
|
||||
unsigned numRealItems = startPos;
|
||||
|
||||
const bool isBigScreen = NControl::IsDialogSizeOK(40, 200, g_HWND);
|
||||
|
||||
for (unsigned i = 0;; i++)
|
||||
{
|
||||
@@ -568,8 +570,6 @@ void CFileMenu::Load(HMENU hMenu, unsigned startPos)
|
||||
if (item.wID == IDM_ALT_STREAMS)
|
||||
disable = !isAltStreamsSupported;
|
||||
|
||||
bool isBigScreen = NControl::IsDialogSizeOK(40, 200);
|
||||
|
||||
if (!isBigScreen && (disable || item.IsSeparator()))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value
|
||||
{
|
||||
switch (propID)
|
||||
{
|
||||
case kpidName: prop = _fileInfo.Name; break;
|
||||
case kpidName: prop = fs2us(_fileInfo.Name); break;
|
||||
case kpidIsDir: prop = _fileInfo.IsDir(); break;
|
||||
case kpidSize: prop = _fileInfo.Size; break;
|
||||
case kpidAttrib: prop = (UInt32)_fileInfo.Attrib; break;
|
||||
|
||||
@@ -289,7 +289,7 @@ HRESULT CThreadCrc::ProcessVirt()
|
||||
}
|
||||
if (isFirstFile)
|
||||
{
|
||||
Hash.FirstFileName = path;
|
||||
Hash.FirstFileName = fs2us(path);
|
||||
isFirstFile = false;
|
||||
}
|
||||
sync.Set_FilePath(fs2us(path));
|
||||
@@ -375,7 +375,7 @@ HRESULT CApp::CalculateCrc2(const UString &methodName)
|
||||
t.Enumerator.FilePaths.Add(us2fs(srcPanel.GetItemRelPath(indices[i])));
|
||||
|
||||
if (t.Enumerator.FilePaths.Size() == 1)
|
||||
t.Hash.MainName = t.Enumerator.FilePaths[0];
|
||||
t.Hash.MainName = fs2us(t.Enumerator.FilePaths[0]);
|
||||
|
||||
UString basePrefix = srcPanel.GetFsPath();
|
||||
UString basePrefix2 = basePrefix;
|
||||
|
||||
@@ -511,7 +511,7 @@ void CPanel::ChangeComment()
|
||||
LangString(IDS_COMMENT2, dlg.Static);
|
||||
if (dlg.Create(GetParent()) != IDOK)
|
||||
return;
|
||||
NCOM::CPropVariant propVariant = dlg.Value.Ptr();
|
||||
NCOM::CPropVariant propVariant (dlg.Value);
|
||||
|
||||
CDisableNotify disableNotify(*this);
|
||||
HRESULT result = _folderOperations->SetProperty(realIndex, kpidComment, &propVariant, NULL);
|
||||
|
||||
@@ -65,7 +65,7 @@ CAPTION "Progress"
|
||||
RTEXT "", IDT_PROGRESS_ELAPSED_VAL, x1, y0, x1s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_REMAINING_VAL, x1, y1, x1s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_FILES_VAL, x1, y2, x1s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_FILES_TOTAL x1, y3, x1s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_FILES_TOTAL, x1, y3, x1s, MY_TEXT_NOPREFIX
|
||||
RTEXT "", IDT_PROGRESS_ERRORS_VAL, x1, y4, x1s, MY_TEXT_NOPREFIX
|
||||
|
||||
RTEXT "", IDT_PROGRESS_TOTAL_VAL, x3, y0, x3s, MY_TEXT_NOPREFIX
|
||||
|
||||
@@ -389,11 +389,11 @@ void CApp::VerCtrl(unsigned id)
|
||||
|
||||
dialog.OldFileInfo.SetTime(&fdi.Info.ftLastWriteTime);
|
||||
dialog.OldFileInfo.SetSize(fdi.GetSize());
|
||||
dialog.OldFileInfo.Name = path;
|
||||
dialog.OldFileInfo.Name = fs2us(path);
|
||||
|
||||
dialog.NewFileInfo.SetTime(&fdi2.Info.ftLastWriteTime);
|
||||
dialog.NewFileInfo.SetSize(fdi2.GetSize());
|
||||
dialog.NewFileInfo.Name = path2;
|
||||
dialog.NewFileInfo.Name = fs2us(path2);
|
||||
|
||||
dialog.ShowExtraButtons = false;
|
||||
dialog.DefaultButton_is_NO = true;
|
||||
|
||||
@@ -341,10 +341,10 @@ public:
|
||||
|
||||
CBenchmarkDialog():
|
||||
_timer(0),
|
||||
TotalMode(false),
|
||||
WasStopped_in_GUI(false),
|
||||
ExitWasAsked_in_GUI(false),
|
||||
NeedRestart(false)
|
||||
NeedRestart(false),
|
||||
TotalMode(false)
|
||||
{}
|
||||
|
||||
~CBenchmarkDialog();
|
||||
|
||||
@@ -1436,7 +1436,7 @@ UString CCompressDialog::GetMethodSpec(UString &estimatedName)
|
||||
UString s;
|
||||
if (methodId >= 0)
|
||||
{
|
||||
if (methodId < ARRAY_SIZE(kMethodsNames))
|
||||
if ((unsigned)methodId < ARRAY_SIZE(kMethodsNames))
|
||||
estimatedName = kMethodsNames[methodId];
|
||||
else
|
||||
estimatedName = ExternalMethods[methodId - ARRAY_SIZE(kMethodsNames)];
|
||||
|
||||
@@ -112,9 +112,13 @@ static void ParseAndAddPropertires(CObjectVector<CProperty> &properties,
|
||||
SplitString(propertiesString, strings);
|
||||
FOR_VECTOR (i, strings)
|
||||
{
|
||||
const UString &s = strings[i];
|
||||
UString s = strings[i];
|
||||
if (s.Len() > 2
|
||||
&& s[0] == '-'
|
||||
&& MyCharLower_Ascii(s[1]) == 'm')
|
||||
s.DeleteFrontal(2);
|
||||
CProperty property;
|
||||
int index = s.Find(L'=');
|
||||
const int index = s.Find(L'=');
|
||||
if (index < 0)
|
||||
property.Name = s;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user