mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 20:06:59 -06:00
9.09 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
2fed872194
commit
1fbaf0aac5
@@ -43,7 +43,7 @@ RSC=rc.exe
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "COMPRESS_MT" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /c
|
||||
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x419 /d "NDEBUG"
|
||||
@@ -70,7 +70,7 @@ LINK32=link.exe
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "COMPRESS_MT" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x419 /d "_DEBUG"
|
||||
@@ -619,6 +619,11 @@ SOURCE=..\..\..\..\C\7zCrc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\7zCrcOpt.c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Alloc.c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# End Source File
|
||||
@@ -628,6 +633,11 @@ SOURCE=..\..\..\..\C\Alloc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\CpuArch.c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Threads.c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# End Source File
|
||||
|
||||
@@ -31,7 +31,7 @@ struct CCompressionMethodMode
|
||||
{
|
||||
CObjectVector<CMethodFull> Methods;
|
||||
CRecordVector<CBind> Binds;
|
||||
#ifdef COMPRESS_MT
|
||||
#ifndef _7ZIP_ST
|
||||
UInt32 NumThreads;
|
||||
#endif
|
||||
bool PasswordIsDefined;
|
||||
@@ -39,7 +39,7 @@ struct CCompressionMethodMode
|
||||
|
||||
bool IsEmpty() const { return (Methods.IsEmpty() && !PasswordIsDefined); }
|
||||
CCompressionMethodMode(): PasswordIsDefined(false)
|
||||
#ifdef COMPRESS_MT
|
||||
#ifndef _7ZIP_ST
|
||||
, NumThreads(1)
|
||||
#endif
|
||||
{}
|
||||
|
||||
@@ -97,7 +97,7 @@ HRESULT CDecoder::Decode(
|
||||
#ifndef _NO_CRYPTO
|
||||
, ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
|
||||
#endif
|
||||
#ifdef COMPRESS_MT
|
||||
#if !defined(_7ZIP_ST) && !defined(_SFX)
|
||||
, bool mtMode, UInt32 numThreads
|
||||
#endif
|
||||
)
|
||||
@@ -239,7 +239,7 @@ HRESULT CDecoder::Decode(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
#if !defined(_7ZIP_ST) && !defined(_SFX)
|
||||
if (mtMode)
|
||||
{
|
||||
CMyComPtr<ICompressSetCoderMt> setCoderMt;
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
#ifndef _NO_CRYPTO
|
||||
, ICryptoGetTextPassword *getTextPasswordSpec, bool &passwordIsDefined
|
||||
#endif
|
||||
#ifdef COMPRESS_MT
|
||||
#if !defined(_7ZIP_ST) && !defined(_SFX)
|
||||
, bool mtMode, UInt32 numThreads
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
static const UInt64 k_Delta = 0x03;
|
||||
static const UInt64 k_BCJ = 0x03030103;
|
||||
static const UInt64 k_BCJ2 = 0x0303011B;
|
||||
static const UInt64 k_AES = 0x06F10701;
|
||||
|
||||
namespace NArchive {
|
||||
namespace N7z {
|
||||
@@ -76,7 +75,7 @@ HRESULT CEncoder::CreateMixerCoder(
|
||||
|
||||
CMyComPtr<IUnknown> encoderCommon = encoder ? (IUnknown *)encoder : (IUnknown *)encoder2;
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
#ifndef _7ZIP_ST
|
||||
{
|
||||
CMyComPtr<ICompressSetCoderMt> setCoderMt;
|
||||
encoderCommon.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt);
|
||||
|
||||
@@ -237,7 +237,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
#ifndef _NO_CRYPTO
|
||||
, getTextPassword, passwordIsDefined
|
||||
#endif
|
||||
#ifdef COMPRESS_MT
|
||||
#if !defined(_7ZIP_ST) && !defined(_SFX)
|
||||
, true, _numThreads
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "../../../Common/ComTry.h"
|
||||
#include "../../../Common/IntToString.h"
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
#ifndef __7Z_SET_PROPERTIES
|
||||
#include "../../../Windows/System.h"
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,7 @@ CHandler::CHandler()
|
||||
#endif
|
||||
|
||||
#ifdef EXTRACT_ONLY
|
||||
#ifdef COMPRESS_MT
|
||||
#ifdef __7Z_SET_PROPERTIES
|
||||
_numThreads = NSystem::GetNumberOfProcessors();
|
||||
#endif
|
||||
#else
|
||||
@@ -190,18 +190,11 @@ static inline void AddHexToString(UString &res, Byte value)
|
||||
|
||||
#endif
|
||||
|
||||
static const UInt64 k_AES = 0x06F10701;
|
||||
|
||||
bool CHandler::IsEncrypted(UInt32 index2) const
|
||||
{
|
||||
CNum folderIndex = _db.FileIndexToFolderIndexMap[index2];
|
||||
if (folderIndex != kNumNoIndex)
|
||||
{
|
||||
const CFolder &folderInfo = _db.Folders[folderIndex];
|
||||
for (int i = folderInfo.Coders.Size() - 1; i >= 0; i--)
|
||||
if (folderInfo.Coders[i].MethodID == k_AES)
|
||||
return true;
|
||||
}
|
||||
return _db.Folders[folderIndex].IsEncrypted();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -454,10 +447,8 @@ STDMETHODIMP CHandler::Close()
|
||||
STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
#ifdef COMPRESS_MT
|
||||
const UInt32 numProcessors = NSystem::GetNumberOfProcessors();
|
||||
_numThreads = numProcessors;
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < numProperties; i++)
|
||||
{
|
||||
@@ -472,9 +463,7 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
|
||||
{
|
||||
if(name.Left(2).CompareNoCase(L"MT") == 0)
|
||||
{
|
||||
#ifdef COMPRESS_MT
|
||||
RINOK(ParseMtProp(name.Mid(2), value, numProcessors, _numThreads));
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace N7z {
|
||||
#ifndef __7Z_SET_PROPERTIES
|
||||
|
||||
#ifdef EXTRACT_ONLY
|
||||
#ifdef COMPRESS_MT
|
||||
#if !defined(_7ZIP_ST) && !defined(_SFX)
|
||||
#define __7Z_SET_PROPERTIES
|
||||
#endif
|
||||
#else
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
|
||||
#ifdef EXTRACT_ONLY
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
#ifdef __7Z_SET_PROPERTIES
|
||||
UInt32 _numThreads;
|
||||
#endif
|
||||
|
||||
@@ -92,7 +92,7 @@ private:
|
||||
|
||||
HRESULT SetCompressionMethod(CCompressionMethodMode &method,
|
||||
CObjectVector<COneMethodInfo> &methodsInfo
|
||||
#ifdef COMPRESS_MT
|
||||
#ifndef _7ZIP_ST
|
||||
, UInt32 numThreads
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -51,7 +51,7 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
CCompressionMethodMode &headerMethod)
|
||||
{
|
||||
HRESULT res = SetCompressionMethod(methodMode, _methods
|
||||
#ifdef COMPRESS_MT
|
||||
#ifndef _7ZIP_ST
|
||||
, _numThreads
|
||||
#endif
|
||||
);
|
||||
@@ -91,8 +91,8 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
}
|
||||
headerMethodInfoVector.Add(oneMethodInfo);
|
||||
HRESULT res = SetCompressionMethod(headerMethod, headerMethodInfoVector
|
||||
#ifdef COMPRESS_MT
|
||||
,1
|
||||
#ifndef _7ZIP_ST
|
||||
, 1
|
||||
#endif
|
||||
);
|
||||
RINOK(res);
|
||||
@@ -103,7 +103,7 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
HRESULT CHandler::SetCompressionMethod(
|
||||
CCompressionMethodMode &methodMode,
|
||||
CObjectVector<COneMethodInfo> &methodsInfo
|
||||
#ifdef COMPRESS_MT
|
||||
#ifndef _7ZIP_ST
|
||||
, UInt32 numThreads
|
||||
#endif
|
||||
)
|
||||
@@ -122,7 +122,7 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
{
|
||||
COneMethodInfo &oneMethodInfo = methodsInfo[i];
|
||||
SetCompressionMethod2(oneMethodInfo
|
||||
#ifdef COMPRESS_MT
|
||||
#ifndef _7ZIP_ST
|
||||
, numThreads
|
||||
#endif
|
||||
);
|
||||
@@ -327,7 +327,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
|
||||
|
||||
CCompressionMethodMode methodMode, headerMethod;
|
||||
RINOK(SetCompressionMethod(methodMode, headerMethod));
|
||||
#ifdef COMPRESS_MT
|
||||
#ifndef _7ZIP_ST
|
||||
methodMode.NumThreads = _numThreads;
|
||||
headerMethod.NumThreads = 1;
|
||||
#endif
|
||||
|
||||
@@ -823,7 +823,7 @@ HRESULT CInArchive::ReadAndDecodePackedStreams(
|
||||
#ifndef _NO_CRYPTO
|
||||
, getTextPassword, passwordIsDefined
|
||||
#endif
|
||||
#ifdef COMPRESS_MT
|
||||
#if !defined(_7ZIP_ST) && !defined(_SFX)
|
||||
, false, 1
|
||||
#endif
|
||||
);
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
namespace NArchive {
|
||||
namespace N7z {
|
||||
|
||||
const UInt64 k_AES = 0x06F10701;
|
||||
|
||||
typedef UInt32 CNum;
|
||||
const CNum kNumMax = 0x7FFFFFFF;
|
||||
const CNum kNumNoIndex = 0xFFFFFFFF;
|
||||
@@ -83,6 +85,14 @@ struct CFolder
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool IsEncrypted() const
|
||||
{
|
||||
for (int i = Coders.Size() - 1; i >= 0; i--)
|
||||
if (Coders[i].MethodID == k_AES)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CheckStructure() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -502,9 +502,11 @@ void COutArchive::SkipAlign(unsigned pos, unsigned alignSize)
|
||||
}
|
||||
*/
|
||||
|
||||
static inline unsigned Bv_GetSizeInBytes(const CBoolVector &v) { return ((unsigned)v.Size() + 7) / 8; }
|
||||
|
||||
void COutArchive::WriteAlignedBoolHeader(const CBoolVector &v, int numDefined, Byte type, unsigned itemSize)
|
||||
{
|
||||
const UInt64 bvSize = (numDefined == v.Size()) ? 0 : (v.Size() + 7) / 8;
|
||||
const unsigned bvSize = (numDefined == v.Size()) ? 0 : Bv_GetSizeInBytes(v);
|
||||
const UInt64 dataSize = (UInt64)numDefined * itemSize + bvSize + 2;
|
||||
SkipAlign(3 + (unsigned)bvSize + (unsigned)GetBigNumberSize(dataSize), itemSize);
|
||||
|
||||
@@ -631,7 +633,7 @@ void COutArchive::WriteHeader(
|
||||
if (numEmptyStreams > 0)
|
||||
{
|
||||
WriteByte(NID::kEmptyStream);
|
||||
WriteNumber((emptyStreamVector.Size() + 7) / 8);
|
||||
WriteNumber(Bv_GetSizeInBytes(emptyStreamVector));
|
||||
WriteBoolVector(emptyStreamVector);
|
||||
|
||||
CBoolVector emptyFileVector, antiVector;
|
||||
@@ -656,14 +658,14 @@ void COutArchive::WriteHeader(
|
||||
if (numEmptyFiles > 0)
|
||||
{
|
||||
WriteByte(NID::kEmptyFile);
|
||||
WriteNumber((emptyFileVector.Size() + 7) / 8);
|
||||
WriteNumber(Bv_GetSizeInBytes(emptyFileVector));
|
||||
WriteBoolVector(emptyFileVector);
|
||||
}
|
||||
|
||||
if (numAntiItems > 0)
|
||||
{
|
||||
WriteByte(NID::kAnti);
|
||||
WriteNumber((antiVector.Size() + 7) / 8);
|
||||
WriteNumber(Bv_GetSizeInBytes(antiVector));
|
||||
WriteBoolVector(antiVector);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,4 @@ static IOutArchive *CreateArcOut() { return new NArchive::N7z::CHandler; }
|
||||
static CArcInfo g_ArcInfo =
|
||||
{ L"7z", L"7z", 0, 7, {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C}, 6, false, CreateArc, CreateArcOut };
|
||||
|
||||
REGISTER_ARC_DEC_SIG(7z)
|
||||
REGISTER_ARC(7z)
|
||||
|
||||
@@ -27,7 +27,6 @@ namespace N7z {
|
||||
static const UInt64 k_LZMA = 0x030101;
|
||||
static const UInt64 k_BCJ = 0x03030103;
|
||||
static const UInt64 k_BCJ2 = 0x0303011B;
|
||||
static const UInt64 k_AES = 0x06F10701;
|
||||
|
||||
static const wchar_t *kMatchFinderForBCJ2_LZMA = L"BT2";
|
||||
static const UInt32 kDictionaryForBCJ2_LZMA = 1 << 20;
|
||||
@@ -580,7 +579,7 @@ public:
|
||||
DECL_EXTERNAL_CODECS_VARS
|
||||
CDecoder Decoder;
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
#ifndef _7ZIP_ST
|
||||
bool MtMode;
|
||||
UInt32 NumThreads;
|
||||
#endif
|
||||
@@ -588,7 +587,7 @@ public:
|
||||
CThreadDecoder():
|
||||
Decoder(true)
|
||||
{
|
||||
#ifdef COMPRESS_MT
|
||||
#ifndef _7ZIP_ST
|
||||
MtMode = false;
|
||||
NumThreads = 1;
|
||||
#endif
|
||||
@@ -617,7 +616,7 @@ void CThreadDecoder::Execute()
|
||||
#ifndef _NO_CRYPTO
|
||||
, GetTextPassword, passwordIsDefined
|
||||
#endif
|
||||
#ifdef COMPRESS_MT
|
||||
#ifndef _7ZIP_ST
|
||||
, MtMode, NumThreads
|
||||
#endif
|
||||
);
|
||||
@@ -642,17 +641,6 @@ bool static Is86FilteredFolder(const CFolder &f)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool static IsEncryptedFolder(const CFolder &f)
|
||||
{
|
||||
for (int i = 0; i < f.Coders.Size(); i++)
|
||||
{
|
||||
CMethodId m = f.Coders[i].MethodID;
|
||||
if (m == k_AES)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef _NO_CRYPTO
|
||||
|
||||
class CCryptoGetTextPassword:
|
||||
@@ -760,7 +748,7 @@ HRESULT Update(
|
||||
rep.FolderIndex = i;
|
||||
rep.NumCopyFiles = numCopyItems;
|
||||
const CFolder &f = db->Folders[i];
|
||||
bool isEncrypted = IsEncryptedFolder(f);
|
||||
bool isEncrypted = f.IsEncrypted();
|
||||
rep.Group = GetGroupIndex(isEncrypted, Is86FilteredFolder(f));
|
||||
folderRefs.Add(rep);
|
||||
if (numCopyItems == numUnpackStreams)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
PROG = 7z.dll
|
||||
DEF_FILE = ../Archive.def
|
||||
CFLAGS = $(CFLAGS) -I ../../../ \
|
||||
-DCOMPRESS_MT \
|
||||
-DEXTERNAL_CODECS \
|
||||
|
||||
AR_OBJS = \
|
||||
@@ -71,9 +70,10 @@ AR_COMMON_OBJS = \
|
||||
|
||||
C_OBJS = \
|
||||
$O\Alloc.obj \
|
||||
$O\CpuArch.obj \
|
||||
$O\Threads.obj \
|
||||
|
||||
!include "../../Crc2.mak"
|
||||
!include "../../Crc.mak"
|
||||
|
||||
OBJS = \
|
||||
$O\StdAfx.obj \
|
||||
@@ -85,7 +85,7 @@ OBJS = \
|
||||
$(AR_COMMON_OBJS) \
|
||||
$O\CopyCoder.obj \
|
||||
$(C_OBJS) \
|
||||
$(CRC_OBJS) \
|
||||
$(ASM_OBJS) \
|
||||
$O\resource.res
|
||||
|
||||
!include "../../../Build.mak"
|
||||
@@ -106,4 +106,5 @@ $O\CopyCoder.obj: ../../Compress/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(C_OBJS): ../../../../C/$(*B).c
|
||||
$(COMPL_O2)
|
||||
!include "../../Crc.mak"
|
||||
|
||||
!include "../../Asm.mak"
|
||||
|
||||
Reference in New Issue
Block a user