9.09 beta

This commit is contained in:
Igor Pavlov
2009-12-14 00:00:00 +00:00
committed by Kornel Lesiński
parent 2fed872194
commit 1fbaf0aac5
179 changed files with 3365 additions and 2136 deletions
+7
View File
@@ -0,0 +1,7 @@
C_OBJS = $(C_OBJS) \
$O\Aes.obj
!IF "$(CPU)" != "IA64" && "$(CPU)" != "MIPS" && "$(CPU)" != "ARM"
ASM_OBJS = $(ASM_OBJS) \
$O\AesOpt.obj
!ENDIF
+12 -2
View File
@@ -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
+2 -2
View 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
{}
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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
);
+1 -2
View File
@@ -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);
+1 -1
View File
@@ -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
);
+3 -14
View File
@@ -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
+3 -3
View File
@@ -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
);
+6 -6
View File
@@ -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
+1 -1
View File
@@ -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
);
+10
View File
@@ -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;
};
+6 -4
View File
@@ -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);
}
}
+1 -1
View File
@@ -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)
+4 -16
View File
@@ -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)
+5 -4
View File
@@ -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"
+356
View File
@@ -0,0 +1,356 @@
// ApmHandler.cpp
#include "StdAfx.h"
#include "../../../C/CpuArch.h"
#include "Common/ComTry.h"
#include "Common/IntToString.h"
#include "Common/MyString.h"
#include "Windows/PropVariant.h"
#include "../Common/LimitedStreams.h"
#include "../Common/ProgressUtils.h"
#include "../Common/RegisterArc.h"
#include "../Common/StreamUtils.h"
#include "../Compress/CopyCoder.h"
#define Get16(p) GetBe16(p)
#define Get32(p) GetBe32(p)
using namespace NWindows;
namespace NArchive {
namespace NApm {
struct CItem
{
UInt32 StartBlock;
UInt32 NumBlocks;
char Name[32];
char Type[32];
/*
UInt32 DataStartBlock;
UInt32 NumDataBlocks;
UInt32 Status;
UInt32 BootStartBlock;
UInt32 BootSize;
UInt32 BootAddr;
UInt32 BootEntry;
UInt32 BootChecksum;
char Processor[16];
*/
bool Parse(const Byte *p, UInt32 &numBlocksInMap)
{
if (p[0] != 0x50 || p[1] != 0x4D || p[2] != 0 || p[3] != 0)
return false;
numBlocksInMap = Get32(p + 4);
StartBlock = Get32(p + 8);
NumBlocks = Get32(p + 0xC);
memcpy(Name, p + 0x10, 32);
memcpy(Type, p + 0x30, 32);
/*
DataStartBlock = Get32(p + 0x50);
NumDataBlocks = Get32(p + 0x54);
Status = Get32(p + 0x58);
BootStartBlock = Get32(p + 0x5C);
BootSize = Get32(p + 0x60);
BootAddr = Get32(p + 0x64);
if (Get32(p + 0x68) != 0)
return false;
BootEntry = Get32(p + 0x6C);
if (Get32(p + 0x70) != 0)
return false;
BootChecksum = Get32(p + 0x74);
memcpy(Processor, p + 0x78, 16);
*/
return true;
}
};
class CHandler:
public IInArchive,
public IInArchiveGetStream,
public CMyUnknownImp
{
CMyComPtr<IInStream> _stream;
CRecordVector<CItem> _items;
int _blockSizeLog;
UInt32 _numBlocks;
HRESULT ReadTables(IInStream *stream);
UInt64 BlocksToBytes(UInt32 i) const { return (UInt64)i << _blockSizeLog; }
UInt64 GetItemSize(const CItem &item) { return BlocksToBytes(item.NumBlocks); }
public:
MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
INTERFACE_IInArchive(;)
STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
};
static inline int GetLog(UInt32 num)
{
for (int i = 0; i < 31; i++)
if (((UInt32)1 << i) == num)
return i;
return -1;
}
HRESULT CHandler::ReadTables(IInStream *stream)
{
const UInt32 kSectorSize = 512;
Byte buf[kSectorSize];
{
RINOK(ReadStream_FALSE(stream, buf, kSectorSize));
if (buf[0] != 0x45 || buf[1] != 0x52)
return S_FALSE;
_blockSizeLog = GetLog(Get16(buf + 2));
if (_blockSizeLog < 9 || _blockSizeLog > 14)
return S_FALSE;
_numBlocks = Get32(buf + 4);
for (int i = 8; i < 16; i++)
if (buf[i] != 0)
return S_FALSE;
}
unsigned numSkips = (unsigned)1 << (_blockSizeLog - 9);
for (unsigned j = 1; j < numSkips; j++)
{
RINOK(ReadStream_FALSE(stream, buf, kSectorSize));
}
UInt32 numBlocksInMap = 0;
for (unsigned i = 0;;)
{
RINOK(ReadStream_FALSE(stream, buf, kSectorSize));
CItem item;
UInt32 numBlocksInMap2;
if (!item.Parse(buf, numBlocksInMap2))
return S_FALSE;
if (i == 0)
{
numBlocksInMap = numBlocksInMap2;
if (numBlocksInMap > (1 << 8))
return S_FALSE;
}
else if (numBlocksInMap2 != numBlocksInMap)
return S_FALSE;
UInt32 finish = item.StartBlock + item.NumBlocks;
if (finish < item.StartBlock)
return S_FALSE;
_numBlocks = MyMax(_numBlocks, finish);
_items.Add(item);
for (unsigned j = 1; j < numSkips; j++)
{
RINOK(ReadStream_FALSE(stream, buf, kSectorSize));
}
if (++i == numBlocksInMap)
break;
}
return S_OK;
}
STDMETHODIMP CHandler::Open(IInStream *stream,
const UInt64 * /* maxCheckStartPosition */,
IArchiveOpenCallback * /* openArchiveCallback */)
{
COM_TRY_BEGIN
Close();
RINOK(ReadTables(stream));
_stream = stream;
return S_OK;
COM_TRY_END
}
STDMETHODIMP CHandler::Close()
{
_items.Clear();
_stream.Release();
return S_OK;
}
STATPROPSTG kProps[] =
{
{ NULL, kpidPath, VT_BSTR},
{ NULL, kpidSize, VT_UI8},
{ NULL, kpidOffset, VT_UI8}
};
STATPROPSTG kArcProps[] =
{
{ NULL, kpidClusterSize, VT_UI4},
{ NULL, kpidPhySize, VT_UI8}
};
IMP_IInArchive_Props
IMP_IInArchive_ArcProps
static AString GetString(const char *s)
{
AString res;
for (int i = 0; i < 32 && s[i] != 0; i++)
res += s[i];
return res;
}
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
NCOM::CPropVariant prop;
switch(propID)
{
case kpidMainSubfile:
{
int mainIndex = -1;
for (int i = 0; i < _items.Size(); i++)
{
AString s = GetString(_items[i].Type);
if (s != "Apple_Free" &&
s != "Apple_partition_map")
{
if (mainIndex >= 0)
{
mainIndex = -1;
break;
}
mainIndex = i;
}
}
if (mainIndex >= 0)
prop = (UInt32)mainIndex;
break;
}
case kpidClusterSize: prop = (UInt32)1 << _blockSizeLog; break;
case kpidPhySize: prop = BlocksToBytes(_numBlocks); break;
}
prop.Detach(value);
return S_OK;
COM_TRY_END
}
STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
{
*numItems = _items.Size();
return S_OK;
}
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
NCOM::CPropVariant prop;
const CItem &item = _items[index];
switch(propID)
{
case kpidPath:
{
AString s = GetString(item.Name);
if (s.IsEmpty())
{
char s2[32];
ConvertUInt32ToString(index, s2);
s = s2;
}
AString type = GetString(item.Type);
if (type == "Apple_HFS")
type = "hfs";
if (!type.IsEmpty())
{
s += '.';
s += type;
}
prop = s;
break;
}
case kpidSize:
case kpidPackSize:
prop = GetItemSize(item);
break;
case kpidOffset: prop = BlocksToBytes(item.StartBlock); break;
}
prop.Detach(value);
return S_OK;
COM_TRY_END
}
STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
Int32 testMode, IArchiveExtractCallback *extractCallback)
{
COM_TRY_BEGIN
bool allFilesMode = (numItems == (UInt32)-1);
if (allFilesMode)
numItems = _items.Size();
if (numItems == 0)
return S_OK;
UInt64 totalSize = 0;
UInt32 i;
for (i = 0; i < numItems; i++)
totalSize += GetItemSize(_items[allFilesMode ? i : indices[i]]);
extractCallback->SetTotal(totalSize);
totalSize = 0;
NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
CLocalProgress *lps = new CLocalProgress;
CMyComPtr<ICompressProgressInfo> progress = lps;
lps->Init(extractCallback, false);
CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
CMyComPtr<ISequentialInStream> inStream(streamSpec);
streamSpec->SetStream(_stream);
for (i = 0; i < numItems; i++)
{
lps->InSize = totalSize;
lps->OutSize = totalSize;
RINOK(lps->SetCur());
CMyComPtr<ISequentialOutStream> outStream;
Int32 askMode = testMode ?
NExtract::NAskMode::kTest :
NExtract::NAskMode::kExtract;
Int32 index = allFilesMode ? i : indices[i];
const CItem &item = _items[index];
RINOK(extractCallback->GetStream(index, &outStream, askMode));
UInt64 size = GetItemSize(item);
totalSize += size;
if (!testMode && !outStream)
continue;
RINOK(extractCallback->PrepareOperation(askMode));
RINOK(_stream->Seek(BlocksToBytes(item.StartBlock), STREAM_SEEK_SET, NULL));
streamSpec->Init(size);
RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
outStream.Release();
RINOK(extractCallback->SetOperationResult(copyCoderSpec->TotalSize == size ?
NExtract::NOperationResult::kOK:
NExtract::NOperationResult::kDataError));
}
return S_OK;
COM_TRY_END
}
STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
{
COM_TRY_BEGIN
const CItem &item = _items[index];
return CreateLimitedInStream(_stream, BlocksToBytes(item.StartBlock), GetItemSize(item), stream);
COM_TRY_END
}
static IInArchive *CreateArc() { return new CHandler; }
static CArcInfo g_ArcInfo =
{ L"APM", L"", 0, 0xD4, { 0x50, 0x4D, 0, 0, 0, 0, 0 }, 7, false, CreateArc, 0 };
REGISTER_ARC(Apm)
}}
+10 -10
View File
@@ -6,7 +6,7 @@
#include "Windows/PropVariant.h"
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
#include "../../Windows/System.h"
#endif
@@ -51,7 +51,7 @@ class CHandler:
UInt32 _level;
UInt32 _dicSize;
UInt32 _numPasses;
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
UInt32 _numThreads;
#endif
@@ -60,7 +60,7 @@ class CHandler:
_level = 5;
_dicSize =
_numPasses = 0xFFFFFFFF;
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
_numThreads = NWindows::NSystem::GetNumberOfProcessors();;
#endif
}
@@ -187,7 +187,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
decoderSpec->SetInStream(_seqStream);
#if defined( COMPRESS_MT) && defined( COMPRESS_BZIP2_MT)
#ifndef _7ZIP_ST
RINOK(decoderSpec->SetNumberOfThreads(_numThreads));
#endif
@@ -249,7 +249,7 @@ static HRESULT UpdateArchive(
int indexInClient,
UInt32 dictionary,
UInt32 numPasses,
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
UInt32 numThreads,
#endif
IArchiveUpdateCallback *updateCallback)
@@ -273,7 +273,7 @@ static HRESULT UpdateArchive(
{
dictionary,
numPasses
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
, numThreads
#endif
};
@@ -281,7 +281,7 @@ static HRESULT UpdateArchive(
{
NCoderPropID::kDictionarySize,
NCoderPropID::kNumPasses
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
, NCoderPropID::kNumThreads
#endif
};
@@ -351,7 +351,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
return UpdateArchive(
size, outStream, 0, dicSize, numPasses,
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
_numThreads,
#endif
updateCallback);
@@ -366,7 +366,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProps)
{
InitMethodProperties();
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
const UInt32 numProcessors = NSystem::GetNumberOfProcessors();
_numThreads = numProcessors;
#endif
@@ -398,7 +398,7 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
}
else if (name.Left(2) == L"MT")
{
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
RINOK(ParseMtProp(name.Mid(2), prop, numProcessors, _numThreads));
#endif
}
+6 -6
View File
@@ -233,17 +233,14 @@ STDMETHODIMP CHandler::Open(IInStream *inStream,
HRESULT res = S_FALSE;
CInArchive archive;
CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
{
CMyComPtr<IArchiveOpenCallback> openArchiveCallbackWrap = callback;
openArchiveCallbackWrap.QueryInterface(IID_IArchiveOpenVolumeCallback, &openVolumeCallback);
}
callback->QueryInterface(IID_IArchiveOpenVolumeCallback, (void **)&openVolumeCallback);
CMyComPtr<IInStream> nextStream = inStream;
bool prevChecked = false;
UInt64 numItems = 0;
try
{
while(nextStream != 0)
while (nextStream != 0)
{
CDatabaseEx db;
db.Stream = nextStream;
@@ -296,6 +293,9 @@ STDMETHODIMP CHandler::Open(IInStream *inStream,
if (!otherArchive)
break;
const UString fullName = MultiByteToUnicodeString(otherArchive->FileName, CP_ACP);
if (!openVolumeCallback)
break;
HRESULT result = openVolumeCallback->GetStream(fullName, &nextStream);
if (result == S_OK)
break;
+7 -7
View File
@@ -6,7 +6,7 @@
#include "../../../Windows/PropVariant.h"
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
#include "../../../Windows/System.h"
#endif
@@ -190,7 +190,7 @@ static void SetMethodProp(COneMethodInfo &m, PROPID propID, const NCOM::CPropVar
}
void COutHandler::SetCompressionMethod2(COneMethodInfo &oneMethodInfo
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
, UInt32 numThreads
#endif
)
@@ -224,7 +224,7 @@ void COutHandler::SetCompressionMethod2(COneMethodInfo &oneMethodInfo
SetMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algo);
SetMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, fastBytes);
SetMethodProp(oneMethodInfo, NCoderPropID::kMatchFinder, matchFinder);
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
SetMethodProp(oneMethodInfo, NCoderPropID::kNumThreads, numThreads);
#endif
}
@@ -262,7 +262,7 @@ void COutHandler::SetCompressionMethod2(COneMethodInfo &oneMethodInfo
SetMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, numPasses);
SetMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize);
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
SetMethodProp(oneMethodInfo, NCoderPropID::kNumThreads, numThreads);
#endif
}
@@ -476,7 +476,7 @@ void COutHandler::Init()
WriteATime = false;
WriteMTime = true;
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
_numThreads = NSystem::GetNumberOfProcessors();
#endif
@@ -490,7 +490,7 @@ void COutHandler::Init()
void COutHandler::BeforeSetProperty()
{
Init();
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
numProcessors = NSystem::GetNumberOfProcessors();
#endif
@@ -538,7 +538,7 @@ HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &val
{
if(name.Left(2).CompareNoCase(L"MT") == 0)
{
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
RINOK(ParseMtProp(name.Mid(2), value, numProcessors, _numThreads));
#endif
return S_OK;
+2 -2
View File
@@ -24,7 +24,7 @@ public:
HRESULT SetSolidSettings(const UString &s);
HRESULT SetSolidSettings(const PROPVARIANT &value);
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
UInt32 _numThreads;
#endif
@@ -55,7 +55,7 @@ public:
HRESULT SetParams(COneMethodInfo &oneMethodInfo, const UString &srcString);
void SetCompressionMethod2(COneMethodInfo &oneMethodInfo
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
, UInt32 numThreads
#endif
);
+1 -2
View File
@@ -188,8 +188,7 @@ class CHandler:
DECL_ISetCompressCodecsInfo
public:
MY_QUERYINTERFACE_BEGIN
MY_QUERYINTERFACE_ENTRY(IInArchive)
MY_QUERYINTERFACE_BEGIN2(IInArchive)
MY_QUERYINTERFACE_ENTRY(IArchiveOpenSeq)
QUERY_ENTRY_ISetCompressCodecsInfo
MY_QUERYINTERFACE_END
+6 -4
View File
@@ -70,7 +70,7 @@ bool CInArchive::ReadBytesAndTestSize(void *data, UInt32 size)
{
if (m_CryptoMode)
{
const Byte *bufData = (const Byte *)m_DecryptedData;
const Byte *bufData = m_DecryptedDataAligned;
UInt32 bufSize = m_DecryptedDataSize;
UInt32 i;
for (i = 0; i < size && m_CryptoPos < bufSize; i++)
@@ -423,13 +423,15 @@ HRESULT CInArchive::GetNextItem(CItemEx &item, ICryptoGetTextPassword *getTextPa
const UInt32 kDecryptedBufferSize = (1 << 12);
if (m_DecryptedData.GetCapacity() == 0)
{
m_DecryptedData.SetCapacity(kDecryptedBufferSize);
const UInt32 kAlign = 16;
m_DecryptedData.SetCapacity(kDecryptedBufferSize + kAlign);
m_DecryptedDataAligned = (Byte *)((ptrdiff_t)((Byte *)m_DecryptedData + kAlign - 1) & ~(ptrdiff_t)(kAlign - 1));
}
RINOK(m_RarAES->Init());
size_t decryptedDataSizeT = kDecryptedBufferSize;
RINOK(ReadStream(m_Stream, (Byte *)m_DecryptedData, &decryptedDataSizeT));
RINOK(ReadStream(m_Stream, m_DecryptedDataAligned, &decryptedDataSizeT));
m_DecryptedDataSize = (UInt32)decryptedDataSizeT;
m_DecryptedDataSize = m_RarAES->Filter((Byte *)m_DecryptedData, m_DecryptedDataSize);
m_DecryptedDataSize = m_RarAES->Filter(m_DecryptedDataAligned, m_DecryptedDataSize);
m_CryptoMode = true;
m_CryptoPos = 0;
+1 -2
View File
@@ -76,8 +76,6 @@ class CInArchive
void AddToSeekValue(UInt64 addValue);
protected:
CDynamicBuffer<Byte> m_FileHeaderData;
NHeader::NBlock::CBlock m_BlockHeader;
@@ -94,6 +92,7 @@ protected:
void ReadTime(Byte mask, CRarTime &rarTime);
CBuffer<Byte> m_DecryptedData;
Byte *m_DecryptedDataAligned;
UInt32 m_DecryptedDataSize;
bool m_CryptoMode;
+2
View File
@@ -107,6 +107,8 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
if (prop.vt != VT_UI8)
return E_INVALIDARG;
ui.Size = prop.uhVal.QuadPart;
if (ui.Size >= ((UInt64)1 << 33))
return E_INVALIDARG;
}
updateItems.Add(ui);
}
+16 -9
View File
@@ -220,7 +220,6 @@ class CHandler:
HRESULT ReadPhy(UInt64 offset, void *data, UInt32 size);
bool NeedParent() const { return Footer.Type == kDiskType_Diff; }
UInt64 GetSize() const { return Footer.CurrentSize; }
UInt64 GetPackSize() const
{ return Footer.ThereIsDynamic() ? ((UInt64)NumUsedBlocks << Dyn.BlockSizeLog) : Footer.CurrentSize; }
@@ -317,7 +316,12 @@ HRESULT CHandler::Open3()
if (Dyn.NumBlocks >= (UInt32)1 << 31)
return S_FALSE;
if (GetSize() != ((UInt64)Dyn.NumBlocks << Dyn.BlockSizeLog))
if (Footer.CurrentSize == 0)
{
if (Dyn.NumBlocks != 0)
return S_FALSE;
}
else if (((Footer.CurrentSize - 1) >> Dyn.BlockSizeLog) + 1 != Dyn.NumBlocks)
return S_FALSE;
Bat.Reserve(Dyn.NumBlocks);
@@ -341,8 +345,11 @@ STDMETHODIMP CHandler::Read(void *data, UInt32 size, UInt32 *processedSize)
{
if (processedSize != NULL)
*processedSize = 0;
if (_virtPos >= GetSize())
return (GetSize() == _virtPos) ? S_OK: E_FAIL;
if (_virtPos >= Footer.CurrentSize)
return (Footer.CurrentSize == _virtPos) ? S_OK: E_FAIL;
UInt64 rem = Footer.CurrentSize - _virtPos;
if (size > rem)
size = (UInt32)rem;
if (size == 0)
return S_OK;
UInt32 blockIndex = (UInt32)(_virtPos >> Dyn.BlockSizeLog);
@@ -406,7 +413,7 @@ STDMETHODIMP CHandler::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition
{
case STREAM_SEEK_SET: _virtPos = offset; break;
case STREAM_SEEK_CUR: _virtPos += offset; break;
case STREAM_SEEK_END: _virtPos = GetSize() + offset; break;
case STREAM_SEEK_END: _virtPos = Footer.CurrentSize + offset; break;
default: return STG_E_INVALIDFUNCTION;
}
if (newPosition)
@@ -627,7 +634,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIAN
switch(propID)
{
case kpidSize: prop = GetSize(); break;
case kpidSize: prop = Footer.CurrentSize; break;
case kpidPackSize: prop = GetPackSize(); break;
case kpidCTime: VhdTimeToFileTime(Footer.CTime, prop); break;
/*
@@ -650,7 +657,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
if (numItems != (UInt32)-1 && (numItems != 1 || indices[0] != 0))
return E_INVALIDARG;
RINOK(extractCallback->SetTotal(GetSize()));
RINOK(extractCallback->SetTotal(Footer.CurrentSize));
CMyComPtr<ISequentialOutStream> outStream;
Int32 askMode = testMode ?
NExtract::NAskMode::kTest :
@@ -678,7 +685,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
HRESULT hres = copyCoder->Code(inStream, outStream, NULL, NULL, progress);
if (hres == S_OK)
{
if (copyCoderSpec->TotalSize == GetSize())
if (copyCoderSpec->TotalSize == Footer.CurrentSize)
res = NExtract::NOperationResult::kOK;
}
else
@@ -703,7 +710,7 @@ STDMETHODIMP CHandler::GetStream(UInt32 /* index */, ISequentialInStream **strea
CLimitedInStream *streamSpec = new CLimitedInStream;
CMyComPtr<ISequentialInStream> streamTemp = streamSpec;
streamSpec->SetStream(Stream);
streamSpec->InitAndSeek(0, GetSize());
streamSpec->InitAndSeek(0, Footer.CurrentSize);
RINOK(streamSpec->SeekToStart());
*stream = streamTemp.Detach();
return S_OK;
+18 -15
View File
@@ -198,25 +198,28 @@ static bool AddItem(const CXmlItem &item, CObjectVector<CFile> &files, int paren
file.Sha1IsDefined = ParseSha1(dataItem, "extracted-checksum", file.Sha1);
// file.packSha1IsDefined = ParseSha1(dataItem, "archived-checksum", file.packSha1);
int encodingIndex = dataItem.FindSubTag("encoding");
const CXmlItem &encodingItem = dataItem.SubItems[encodingIndex];
if (encodingItem.IsTag)
if (encodingIndex >= 0)
{
AString s = encodingItem.GetPropertyValue("style");
if (s.Length() >= 0)
const CXmlItem &encodingItem = dataItem.SubItems[encodingIndex];
if (encodingItem.IsTag)
{
AString appl = "application/";
if (s.Left(appl.Length()) == appl)
AString s = encodingItem.GetPropertyValue("style");
if (s.Length() >= 0)
{
s = s.Mid(appl.Length());
AString xx = "x-";
if (s.Left(xx.Length()) == xx)
AString appl = "application/";
if (s.Left(appl.Length()) == appl)
{
s = s.Mid(xx.Length());
if (s == "gzip")
s = METHOD_NAME_ZLIB;
s = s.Mid(appl.Length());
AString xx = "x-";
if (s.Left(xx.Length()) == xx)
{
s = s.Mid(xx.Length());
if (s == "gzip")
s = METHOD_NAME_ZLIB;
}
}
file.Method = s;
}
file.Method = s;
}
}
}
@@ -359,7 +362,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
case kpidMethod:
{
UString name;
if (ConvertUTF8ToUnicode(item.Method, name))
if (!item.Method.IsEmpty() && ConvertUTF8ToUnicode(item.Method, name))
prop = name;
break;
}
@@ -521,7 +524,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
HRESULT res = S_OK;
ICompressCoder *coder = NULL;
if (item.Method == "octet-stream")
if (item.Method.IsEmpty() || item.Method == "octet-stream")
if (item.PackSize == item.Size)
coder = copyCoder;
else
+3 -4
View File
@@ -73,8 +73,7 @@ class CHandler:
HRESULT Open2(IInStream *inStream, IArchiveOpenCallback *callback);
public:
MY_QUERYINTERFACE_BEGIN
MY_QUERYINTERFACE_ENTRY(IInArchive)
MY_QUERYINTERFACE_BEGIN2(IInArchive)
MY_QUERYINTERFACE_ENTRY(IArchiveOpenSeq)
#ifndef EXTRACT_ONLY
MY_QUERYINTERFACE_ENTRY(IOutArchive)
@@ -644,7 +643,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
{
COneMethodInfo &m = _methods[i];
SetCompressionMethod2(m
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
, _numThreads
#endif
);
@@ -658,7 +657,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
}
}
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
lzma2Props.numTotalThreads = _numThreads;
#endif
+38 -22
View File
@@ -102,7 +102,7 @@ static HRESULT GetStreamCRC(ISequentialInStream *inStream, UInt32 &resultCRC)
HRESULT CAddCommon::Compress(
DECL_EXTERNAL_CODECS_LOC_VARS
ISequentialInStream *inStream, IOutStream *outStream,
ICompressProgressInfo *progress, CCompressingResult &operationResult)
ICompressProgressInfo *progress, CCompressingResult &opRes)
{
CSequentialInStreamWithCRC *inSecCrcStreamSpec = 0;
CInStreamWithCRC *inCrcStreamSpec = 0;
@@ -139,13 +139,17 @@ HRESULT CAddCommon::Compress(
}
Byte method = 0;
COutStreamReleaser outStreamReleaser;
opRes.ExtractVersion = NFileHeader::NCompressionMethod::kExtractVersion_Default;
for (int i = 0; i < numTestMethods; i++)
{
opRes.ExtractVersion = NFileHeader::NCompressionMethod::kExtractVersion_Default;
if (inCrcStreamSpec != 0)
RINOK(inCrcStreamSpec->Seek(0, STREAM_SEEK_SET, NULL));
RINOK(outStream->Seek(0, STREAM_SEEK_SET, NULL));
if (_options.PasswordIsDefined)
{
opRes.ExtractVersion = NFileHeader::NCompressionMethod::kExtractVersion_ZipCrypto;
if (!_cryptoStream)
{
_cryptoStreamSpec = new CFilterCoder;
@@ -153,17 +157,24 @@ HRESULT CAddCommon::Compress(
}
if (_options.IsAesMode)
{
_cryptoStreamSpec->Filter = _aesFilter = _filterAesSpec = new NCrypto::NWzAes::CEncoder;
_filterAesSpec->SetKeyMode(_options.AesKeyMode);
RINOK(_filterAesSpec->CryptoSetPassword(
opRes.ExtractVersion = NFileHeader::NCompressionMethod::kExtractVersion_Aes;
if (!_cryptoStreamSpec->Filter)
{
_cryptoStreamSpec->Filter = _filterAesSpec = new NCrypto::NWzAes::CEncoder;
_filterAesSpec->SetKeyMode(_options.AesKeyMode);
RINOK(_filterAesSpec->CryptoSetPassword(
(const Byte *)(const char *)_options.Password, _options.Password.Length()));
}
RINOK(_filterAesSpec->WriteHeader(outStream));
}
else
{
_cryptoStreamSpec->Filter = _zipCryptoFilter = _filterSpec = new NCrypto::NZip::CEncoder;
RINOK(_filterSpec->CryptoSetPassword(
if (!_cryptoStreamSpec->Filter)
{
_cryptoStreamSpec->Filter = _filterSpec = new NCrypto::NZip::CEncoder;
RINOK(_filterSpec->CryptoSetPassword(
(const Byte *)(const char *)_options.Password, _options.Password.Length()));
}
UInt32 crc = 0;
RINOK(GetStreamCRC(inStream, crc));
RINOK(inCrcStreamSpec->Seek(0, STREAM_SEEK_SET, NULL));
@@ -190,7 +201,6 @@ HRESULT CAddCommon::Compress(
else
outStreamNew = outStream;
RINOK(_copyCoder->Code(inCrcStream, outStreamNew, NULL, NULL, progress));
operationResult.ExtractVersion = NFileHeader::NCompressionMethod::kStoreExtractVersion;
break;
}
default:
@@ -199,11 +209,12 @@ HRESULT CAddCommon::Compress(
{
if (method == NFileHeader::NCompressionMethod::kLZMA)
{
_compressExtractVersion = NFileHeader::NCompressionMethod::kExtractVersion_LZMA;
CLzmaEncoder *_lzmaEncoder = new CLzmaEncoder();
_compressEncoder = _lzmaEncoder;
NWindows::NCOM::CPropVariant props[] =
{
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
_options.NumThreads,
#endif
_options.Algo,
@@ -214,7 +225,7 @@ HRESULT CAddCommon::Compress(
};
PROPID propIDs[] =
{
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
NCoderPropID::kNumThreads,
#endif
NCoderPropID::kAlgorithm,
@@ -235,8 +246,12 @@ HRESULT CAddCommon::Compress(
{
case NFileHeader::NCompressionMethod::kBZip2:
methodId = kMethodId_BZip2;
_compressExtractVersion = NFileHeader::NCompressionMethod::kExtractVersion_BZip2;
break;
default:
_compressExtractVersion = ((method == NFileHeader::NCompressionMethod::kDeflated64) ?
NFileHeader::NCompressionMethod::kExtractVersion_Deflate64 :
NFileHeader::NCompressionMethod::kExtractVersion_Deflate);
methodId = kMethodId_ZipBase + method;
break;
}
@@ -279,7 +294,7 @@ HRESULT CAddCommon::Compress(
{
_options.DicSize,
_options.NumPasses
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
, _options.NumThreads
#endif
};
@@ -287,7 +302,7 @@ HRESULT CAddCommon::Compress(
{
NCoderPropID::kDictionarySize,
NCoderPropID::kNumPasses
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
, NCoderPropID::kNumThreads
#endif
};
@@ -305,41 +320,42 @@ HRESULT CAddCommon::Compress(
outStreamNew = _cryptoStream;
else
outStreamNew = outStream;
if (_compressExtractVersion > opRes.ExtractVersion)
opRes.ExtractVersion = _compressExtractVersion;
RINOK(_compressEncoder->Code(inCrcStream, outStreamNew, NULL, NULL, progress));
operationResult.ExtractVersion = NFileHeader::NCompressionMethod::kDeflateExtractVersion;
break;
}
}
RINOK(outStream->Seek(0, STREAM_SEEK_CUR, &operationResult.PackSize));
RINOK(outStream->Seek(0, STREAM_SEEK_CUR, &opRes.PackSize));
if (inCrcStreamSpec != 0)
{
operationResult.CRC = inCrcStreamSpec->GetCRC();
operationResult.UnpackSize = inCrcStreamSpec->GetSize();
opRes.CRC = inCrcStreamSpec->GetCRC();
opRes.UnpackSize = inCrcStreamSpec->GetSize();
}
else
{
operationResult.CRC = inSecCrcStreamSpec->GetCRC();
operationResult.UnpackSize = inSecCrcStreamSpec->GetSize();
opRes.CRC = inSecCrcStreamSpec->GetCRC();
opRes.UnpackSize = inSecCrcStreamSpec->GetSize();
}
if (_options.PasswordIsDefined)
{
if (operationResult.PackSize < operationResult.UnpackSize +
if (opRes.PackSize < opRes.UnpackSize +
(_options.IsAesMode ? _filterAesSpec->GetHeaderSize() : NCrypto::NZip::kHeaderSize))
break;
}
else if (operationResult.PackSize < operationResult.UnpackSize)
else if (opRes.PackSize < opRes.UnpackSize)
break;
}
if (_options.IsAesMode)
{
RINOK(_filterAesSpec->WriteFooter(outStream));
RINOK(outStream->Seek(0, STREAM_SEEK_CUR, &operationResult.PackSize));
RINOK(outStream->Seek(0, STREAM_SEEK_CUR, &opRes.PackSize));
}
operationResult.Method = method;
return outStream->SetSize(operationResult.PackSize);
opRes.Method = method;
return outStream->SetSize(opRes.PackSize);
}
}}
+1 -4
View File
@@ -35,6 +35,7 @@ class CAddCommon
CMyComPtr<ICompressCoder> _copyCoder;
CMyComPtr<ICompressCoder> _compressEncoder;
Byte _compressExtractVersion;
CFilterCoder *_cryptoStreamSpec;
CMyComPtr<ISequentialOutStream> _cryptoStream;
@@ -42,10 +43,6 @@ class CAddCommon
NCrypto::NZip::CEncoder *_filterSpec;
NCrypto::NWzAes::CEncoder *_filterAesSpec;
CMyComPtr<ICompressFilter> _zipCryptoFilter;
CMyComPtr<ICompressFilter> _aesFilter;
public:
CAddCommon(const CCompressionMethodMode &options);
HRESULT Compress(
+3 -3
View File
@@ -1,7 +1,7 @@
// CompressionMode.h
#ifndef __ZIP_COMPRESSIONMETHOD_H
#define __ZIP_COMPRESSIONMETHOD_H
#ifndef __ZIP_COMPRESSION_MODE_H
#define __ZIP_COMPRESSION_MODE_H
#include "Common/MyString.h"
@@ -18,7 +18,7 @@ struct CCompressionMethodMode
bool NumMatchFinderCyclesDefined;
UInt32 NumMatchFinderCycles;
UInt32 DicSize;
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
UInt32 NumThreads;
#endif
bool PasswordIsDefined;
+35 -40
View File
@@ -63,30 +63,7 @@ static const char *kHostOS[] =
static const char *kUnknownOS = "Unknown";
STATPROPSTG kProps[] =
{
{ NULL, kpidPath, VT_BSTR},
{ NULL, kpidIsDir, VT_BOOL},
{ NULL, kpidSize, VT_UI8},
{ NULL, kpidPackSize, VT_UI8},
{ NULL, kpidMTime, VT_FILETIME},
{ NULL, kpidCTime, VT_FILETIME},
{ NULL, kpidATime, VT_FILETIME},
{ NULL, kpidAttrib, VT_UI4},
{ NULL, kpidEncrypted, VT_BOOL},
{ NULL, kpidComment, VT_BSTR},
{ NULL, kpidCRC, VT_UI4},
{ NULL, kpidMethod, VT_BSTR},
{ NULL, kpidHostOS, VT_BSTR}
// { NULL, kpidUnpackVer, VT_UI1},
};
const char *kMethods[] =
static const char *kMethods[] =
{
"Store",
"Shrink",
@@ -101,23 +78,20 @@ const char *kMethods[] =
"PKImploding"
};
const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]);
const char *kBZip2Method = "BZip2";
const char *kLZMAMethod = "LZMA";
const char *kJpegMethod = "Jpeg";
const char *kWavPackMethod = "WavPack";
const char *kPPMdMethod = "PPMd";
const char *kAESMethod = "AES";
const char *kZipCryptoMethod = "ZipCrypto";
const char *kStrongCryptoMethod = "StrongCrypto";
static const char *kBZip2Method = "BZip2";
static const char *kLZMAMethod = "LZMA";
static const char *kJpegMethod = "Jpeg";
static const char *kWavPackMethod = "WavPack";
static const char *kPPMdMethod = "PPMd";
static const char *kAESMethod = "AES";
static const char *kZipCryptoMethod = "ZipCrypto";
static const char *kStrongCryptoMethod = "StrongCrypto";
struct CStrongCryptoPair
static struct CStrongCryptoPair
{
UInt16 Id;
const char *Name;
};
CStrongCryptoPair g_StrongCryptoPairs[] =
} g_StrongCryptoPairs[] =
{
{ NStrongCryptoFlags::kDES, "DES" },
{ NStrongCryptoFlags::kRC2old, "RC2a" },
@@ -132,7 +106,25 @@ CStrongCryptoPair g_StrongCryptoPairs[] =
{ NStrongCryptoFlags::kRC4, "RC4" }
};
STATPROPSTG kArcProps[] =
static STATPROPSTG kProps[] =
{
{ NULL, kpidPath, VT_BSTR},
{ NULL, kpidIsDir, VT_BOOL},
{ NULL, kpidSize, VT_UI8},
{ NULL, kpidPackSize, VT_UI8},
{ NULL, kpidMTime, VT_FILETIME},
{ NULL, kpidCTime, VT_FILETIME},
{ NULL, kpidATime, VT_FILETIME},
{ NULL, kpidAttrib, VT_UI4},
{ NULL, kpidEncrypted, VT_BOOL},
{ NULL, kpidComment, VT_BSTR},
{ NULL, kpidCRC, VT_UI4},
{ NULL, kpidMethod, VT_BSTR},
{ NULL, kpidHostOS, VT_BSTR},
{ NULL, kpidUnpackVer, VT_UI4}
};
static STATPROPSTG kArcProps[] =
{
{ NULL, kpidBit64, VT_BOOL},
{ NULL, kpidComment, VT_BSTR}
@@ -289,7 +281,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
method += ' ';
}
}
if (methodId < kNumMethods)
if (methodId < sizeof(kMethods) / sizeof(kMethods[0]))
method += kMethods[methodId];
else switch (methodId)
{
@@ -316,6 +308,9 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
prop = (item.MadeByVersion.HostOS < sizeof(kHostOS) / sizeof(kHostOS[0])) ?
(kHostOS[item.MadeByVersion.HostOS]) : kUnknownOS;
break;
case kpidUnpackVer:
prop = (UInt32)item.ExtractVersion.Version;
break;
}
prop.Detach(value);
return S_OK;
@@ -637,7 +632,7 @@ HRESULT CZipDecoder::Decode(
}
}
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
{
CMyComPtr<ICompressSetCoderMt> setCoderMt;
coder->QueryInterface(IID_ICompressSetCoderMt, (void **)&setCoderMt);
+3 -3
View File
@@ -12,7 +12,7 @@
#include "ZipIn.h"
#include "ZipCompressionMode.h"
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
#include "../../../Windows/System.h"
#endif
@@ -63,7 +63,7 @@ private:
bool m_ForseLocal;
bool m_ForseUtf8;
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
UInt32 _numThreads;
#endif
@@ -85,7 +85,7 @@ private:
m_WriteNtfsTimeExtra = false;
m_ForseLocal = false;
m_ForseUtf8 = false;
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
_numThreads = NWindows::NSystem::GetNumberOfProcessors();;
#endif
}
+3 -3
View File
@@ -297,7 +297,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
options.NumMatchFinderCycles = m_NumMatchFinderCycles;
options.NumMatchFinderCyclesDefined = m_NumMatchFinderCyclesDefined;
options.Algo = m_Algo;
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
options.NumThreads = _numThreads;
#endif
if (isLz)
@@ -357,7 +357,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties)
{
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
const UInt32 numProcessors = NSystem::GetNumberOfProcessors();
_numThreads = numProcessors;
#endif
@@ -467,7 +467,7 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
}
else if (name.Left(2) == L"MT")
{
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
RINOK(ParseMtProp(name.Mid(2), prop, numProcessors, _numThreads));
#endif
}
+10 -3
View File
@@ -80,10 +80,17 @@ namespace NFileHeader
const int kNumCompressionMethods = 11;
const Byte kMadeByProgramVersion = 20;
const Byte kDeflateExtractVersion = 20;
const Byte kStoreExtractVersion = 10;
const Byte kExtractVersion_Default = 10;
const Byte kExtractVersion_Dir = 20;
const Byte kExtractVersion_ZipCrypto = 20;
const Byte kExtractVersion_Deflate = 20;
const Byte kExtractVersion_Deflate64 = 21;
const Byte kExtractVersion_Zip64 = 45;
const Byte kExtractVersion_BZip2 = 46;
const Byte kExtractVersion_Aes = 51;
const Byte kExtractVersion_LZMA = 63;
const Byte kSupportedVersion = 20;
// const Byte kSupportedVersion = 20;
}
namespace NExtraID
+14 -5
View File
@@ -2,10 +2,9 @@
#include "StdAfx.h"
#include "ZipOut.h"
#include "Common/StringConvert.h"
#include "../../Common/OffsetStream.h"
#include "../../Common/StreamUtils.h"
#include "ZipOut.h"
namespace NArchive {
namespace NZip {
@@ -115,7 +114,12 @@ void COutArchive::WriteLocalHeader(const CLocalItem &item)
bool isZip64 = m_IsZip64 || item.PackSize >= 0xFFFFFFFF || item.UnPackSize >= 0xFFFFFFFF;
WriteUInt32(NSignature::kLocalFileHeader);
WriteByte(item.ExtractVersion.Version);
{
Byte ver = item.ExtractVersion.Version;
if (isZip64 && ver < NFileHeader::NCompressionMethod::kExtractVersion_Zip64)
ver = NFileHeader::NCompressionMethod::kExtractVersion_Zip64;
WriteByte(ver);
}
WriteByte(item.ExtractVersion.HostOS);
WriteUInt16(item.Flags);
WriteUInt16(item.CompressionMethod);
@@ -162,7 +166,12 @@ void COutArchive::WriteCentralHeader(const CItem &item)
WriteUInt32(NSignature::kCentralFileHeader);
WriteByte(item.MadeByVersion.Version);
WriteByte(item.MadeByVersion.HostOS);
WriteByte(item.ExtractVersion.Version);
{
Byte ver = item.ExtractVersion.Version;
if (isZip64 && ver < NFileHeader::NCompressionMethod::kExtractVersion_Zip64)
ver = NFileHeader::NCompressionMethod::kExtractVersion_Zip64;
WriteByte(ver);
}
WriteByte(item.ExtractVersion.HostOS);
WriteUInt16(item.Flags);
WriteUInt16(item.CompressionMethod);
+5 -6
View File
@@ -13,7 +13,7 @@
#include "../../Common/LimitedStreams.h"
#include "../../Common/OutMemStream.h"
#include "../../Common/ProgressUtils.h"
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
#include "../../Common/ProgressMt.h"
#endif
@@ -40,7 +40,6 @@ static const Byte kMadeByHostOS = kHostOS;
static const Byte kExtractHostOS = kHostOS;
static const Byte kMethodForDirectory = NFileHeader::NCompressionMethod::kStored;
static const Byte kExtractVersionForDirectory = NFileHeader::NCompressionMethod::kStoreExtractVersion;
static HRESULT CopyBlockToArchive(ISequentialInStream *inStream,
COutArchive &outArchive, ICompressProgressInfo *progress)
@@ -101,7 +100,7 @@ static void SetFileHeader(
item.SetEncrypted(!isDir && options.PasswordIsDefined);
if (isDir)
{
item.ExtractVersion.Version = kExtractVersionForDirectory;
item.ExtractVersion.Version = NFileHeader::NCompressionMethod::kExtractVersion_Dir;
item.CompressionMethod = kMethodForDirectory;
item.PackSize = 0;
item.FileCRC = 0; // test it
@@ -134,7 +133,7 @@ static void SetItemInfoFromCompressingResult(const CCompressingResult &compressi
}
}
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
static THREAD_FUNC_DECL CoderThread(void *threadCoderInfo);
@@ -525,7 +524,7 @@ static HRESULT Update2(
complexity = 0;
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
const size_t kNumMaxThreads = (1 << 10);
UInt32 numThreads = options->NumThreads;
@@ -584,7 +583,7 @@ static HRESULT Update2(
inputItems, updateItems, options, comment, updateCallback);
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
CObjectVector<CItem> items;
+7
View File
@@ -0,0 +1,7 @@
!IF "$(CPU)" == "ARM"
$(ASM_OBJS): ../../../../Asm/Arm/$(*B).asm
$(COMPL_ASM)
!ELSEIF "$(CPU)" != "IA64" && "$(CPU)" != "MIPS"
$(ASM_OBJS): ../../../../Asm/x86/$(*B).asm
$(COMPL_ASM)
!ENDIF
+102 -26
View File
@@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /D "BREAK_HANDLER" /D "_7ZIP_LARGE_PAGES" /D "BENCH_MT" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "_7ZIP_LARGE_PAGES" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /D "BREAK_HANDLER" /D "_7ZIP_LARGE_PAGES" /D "BENCH_MT" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "_7ZIP_LARGE_PAGES" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -93,8 +93,8 @@ LINK32=link.exe
# PROP Intermediate_Dir "ReleaseU"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /D "BREAK_HANDLER" /D "_7ZIP_LARGE_PAGES" /D "BENCH_MT" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /c
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /D "_7ZIP_LARGE_PAGES" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -120,8 +120,8 @@ LINK32=link.exe
# PROP Intermediate_Dir "DebugU"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /D "BREAK_HANDLER" /D "_7ZIP_LARGE_PAGES" /D "BENCH_MT" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "_7ZIP_LARGE_PAGES" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -176,6 +176,14 @@ SOURCE=..\..\UI\Console\List.h
# End Source File
# Begin Source File
SOURCE=..\..\UI\Console\BenchCon.cpp
# End Source File
# Begin Source File
SOURCE=..\..\UI\Console\BenchCon.h
# End Source File
# Begin Source File
SOURCE=..\..\UI\Console\Main.cpp
# End Source File
# Begin Source File
@@ -1099,26 +1107,6 @@ SOURCE=..\..\Compress\QuantumDecoder.cpp
SOURCE=..\..\Compress\QuantumDecoder.h
# End Source File
# End Group
# Begin Group "LZMA_Alone"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.h
# End Source File
# Begin Source File
SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.h
# End Source File
# End Group
# Begin Source File
SOURCE=..\..\Compress\Bcj2Coder.cpp
@@ -1593,6 +1581,14 @@ SOURCE=..\..\Archive\Bz2Handler.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Archive\DeflateProps.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Archive\DeflateProps.h
# End Source File
# Begin Source File
SOURCE=..\..\Archive\GzHandler.cpp
# End Source File
# Begin Source File
@@ -1681,6 +1677,14 @@ SOURCE=..\..\UI\Common\LoadCodecs.h
# End Source File
# Begin Source File
SOURCE=..\..\UI\Common\Bench.cpp
# End Source File
# Begin Source File
SOURCE=..\..\UI\Common\Bench.h
# End Source File
# Begin Source File
SOURCE=..\..\UI\Common\OpenArchive.cpp
# End Source File
# Begin Source File
@@ -2136,6 +2140,30 @@ SOURCE=..\..\..\..\C\7zCrc.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\7zCrcOpt.c
!IF "$(CFG)" == "Alone - Win32 Release"
# ADD CPP /O2
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Alone - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Alone - Win32 DebugU"
# SUBTRACT CPP /YX /Yc /Yu
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\7zStream.c
!IF "$(CFG)" == "Alone - Win32 Release"
@@ -2188,6 +2216,30 @@ SOURCE=..\..\..\..\C\Aes.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\AesOpt.c
!IF "$(CFG)" == "Alone - Win32 Release"
# ADD CPP /O2
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Alone - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Alone - Win32 DebugU"
# SUBTRACT CPP /YX /Yc /Yu
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Alloc.c
!IF "$(CFG)" == "Alone - Win32 Release"
@@ -2329,6 +2381,30 @@ SOURCE=..\..\..\..\C\BwtSort.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.c
!IF "$(CFG)" == "Alone - Win32 Release"
# ADD CPP /O2
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Alone - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "Alone - Win32 DebugU"
# SUBTRACT CPP /YX /Yc /Yu
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.h
# End Source File
# Begin Source File
+9 -17
View File
@@ -1,17 +1,13 @@
PROG = 7za.exe
MY_CONSOLE = 1
CFLAGS = $(CFLAGS) -I ../../../ \
-DCOMPRESS_MT \
-DCOMPRESS_BZIP2_MT \
-DCOMPRESS_MF_MT \
-DBREAK_HANDLER \
-DBENCH_MT \
CFLAGS = $(CFLAGS) -I ../../../
!IFNDEF UNDER_CE
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -D_7ZIP_LARGE_PAGES -DSUPPORT_DEVICE_FILE
!ENDIF
CONSOLE_OBJS = \
$O\BenchCon.obj \
$O\ConsoleClose.obj \
$O\ExtractCallbackConsole.obj \
$O\List.obj \
@@ -78,6 +74,7 @@ UI_COMMON_OBJS = \
$O\ArchiveCommandLine.obj \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
$O\Bench.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\Extract.obj \
@@ -202,10 +199,6 @@ COMPRESS_OBJS = \
$O\ShrinkDecoder.obj \
$O\ZDecoder.obj \
LZMA_BENCH_OBJS = \
$O\LzmaBench.obj \
$O\LzmaBenchCon.obj \
CRYPTO_OBJS = \
$O\7zAes.obj \
$O\7zAesRegister.obj \
@@ -220,12 +213,12 @@ CRYPTO_OBJS = \
C_OBJS = \
$O\7zStream.obj \
$O\Aes.obj \
$O\Alloc.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\BwtSort.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\HuffEnc.obj \
$O\LzFind.obj \
@@ -244,7 +237,8 @@ C_OBJS = \
$O\XzEnc.obj \
$O\XzIn.obj \
!include "../../Crc2.mak"
!include "../../Aes.mak"
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
@@ -264,7 +258,7 @@ OBJS = \
$(LZMA_BENCH_OBJS) \
$(CRYPTO_OBJS) \
$(C_OBJS) \
$(CRC_OBJS) \
$(ASM_OBJS) \
$O\resource.res
@@ -298,12 +292,10 @@ $(ZIP_OBJS): ../../Archive/Zip/$(*B).cpp
$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
$(COMPL_O2)
$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp
$(COMPL)
$(CRYPTO_OBJS): ../../Crypto/$(*B).cpp
$(COMPL_O2)
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Crc.mak"
!include "../../Asm.mak"
+8 -15
View File
@@ -1,17 +1,14 @@
PROG = 7zr.exe
MY_CONSOLE = 1
CFLAGS = $(CFLAGS) -I ../../../ \
-DCOMPRESS_MT \
-DCOMPRESS_MF_MT \
-D_NO_CRYPTO \
-DBREAK_HANDLER \
-DBENCH_MT \
!IFNDEF UNDER_CE
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH
!ENDIF
CONSOLE_OBJS = \
$O\BenchCon.obj \
$O\ConsoleClose.obj \
$O\ExtractCallbackConsole.obj \
$O\List.obj \
@@ -75,6 +72,7 @@ UI_COMMON_OBJS = \
$O\ArchiveCommandLine.obj \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
$O\Bench.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\Extract.obj \
@@ -146,16 +144,13 @@ COMPRESS_OBJS = \
$O\LzmaEncoder.obj \
$O\LzmaRegister.obj \
LZMA_BENCH_OBJS = \
$O\LzmaBench.obj \
$O\LzmaBenchCon.obj \
C_OBJS = \
$O\7zStream.obj \
$O\Alloc.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\Alloc.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\LzFind.obj \
$O\LzFindMt.obj \
@@ -172,7 +167,7 @@ C_OBJS = \
$O\XzEnc.obj \
$O\XzIn.obj \
!include "../../Crc2.mak"
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
@@ -185,9 +180,8 @@ OBJS = \
$(AR_COMMON_OBJS) \
$(7Z_OBJS) \
$(COMPRESS_OBJS) \
$(LZMA_BENCH_OBJS) \
$(C_OBJS) \
$(CRC_OBJS) \
$(ASM_OBJS) \
$O\resource.res
@@ -213,8 +207,7 @@ $(7Z_OBJS): ../../Archive/7z/$(*B).cpp
$(COMPL)
$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
$(COMPL_O2)
$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp
$(COMPL)
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Crc.mak"
!include "../../Asm.mak"
+82 -12
View File
@@ -45,7 +45,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /D "EXTERNAL_LZMA" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /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"
@@ -72,7 +72,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /D "EXTERNAL_LZMA" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /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"
@@ -99,7 +99,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /D "EXTERNAL_LZMA" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /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"
@@ -127,7 +127,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /D "EXTERNAL_LZMA" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "NEW_FOLDER_INTERFACE" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /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"
@@ -658,6 +658,31 @@ SOURCE=..\..\..\..\C\7zCrc.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\7zCrcOpt.c
!IF "$(CFG)" == "FM - Win32 Release"
# ADD CPP /O2
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "FM - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "FM - Win32 ReleaseU"
# ADD CPP /O2
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "FM - Win32 DebugU"
# SUBTRACT CPP /YX /Yc /Yu
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Alloc.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
@@ -667,6 +692,35 @@ SOURCE=..\..\..\..\C\Alloc.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.c
!IF "$(CFG)" == "FM - Win32 Release"
# ADD CPP /O2
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "FM - Win32 Debug"
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "FM - Win32 ReleaseU"
# ADD CPP /O2
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "FM - Win32 DebugU"
# SUBTRACT CPP /YX /Yc /Yu
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Sha256.c
!IF "$(CFG)" == "FM - Win32 Release"
@@ -1196,6 +1250,14 @@ SOURCE=..\..\UI\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
SOURCE=..\..\UI\Common\Bench.cpp
# End Source File
# Begin Source File
SOURCE=..\..\UI\Common\Bench.h
# End Source File
# Begin Source File
SOURCE=..\..\UI\Common\CompressCall.h
# End Source File
# Begin Source File
@@ -1204,6 +1266,14 @@ SOURCE=..\..\UI\Common\CompressCall2.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\CreateCoder.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\CreateCoder.h
# End Source File
# Begin Source File
SOURCE=..\..\UI\Common\DefaultName.cpp
# End Source File
# Begin Source File
@@ -1248,6 +1318,14 @@ SOURCE=..\..\UI\Common\ExtractMode.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\FilterCoder.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\FilterCoder.h
# End Source File
# Begin Source File
SOURCE=..\..\UI\Common\IFileExtractCallback.h
# End Source File
# Begin Source File
@@ -1507,14 +1585,6 @@ SOURCE=..\..\Compress\CopyCoder.cpp
SOURCE=..\..\Compress\CopyCoder.h
# End Source File
# Begin Source File
SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.h
# End Source File
# End Group
# Begin Group "Interface"
+6 -13
View File
@@ -3,9 +3,6 @@ CFLAGS = $(CFLAGS) -I ../../../ \
-DLANG \
-DNEW_FOLDER_INTERFACE \
-DEXTERNAL_CODECS \
-DCOMPRESS_MT \
-DCOMPRESS_BZIP2_MT \
-DCOMPRESS_MF_MT \
!IFDEF UNDER_CE
LIBS = $(LIBS) ceshell.lib Commctrl.lib
@@ -206,6 +203,7 @@ UI_COMMON_OBJS = \
$O\ArchiveExtractCallback.obj \
$O\ArchiveName.obj \
$O\ArchiveOpenCallback.obj \
$O\Bench.obj \
$O\CompressCall2.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
@@ -388,9 +386,6 @@ COMPRESS_OBJS = \
$O\ZlibEncoder.obj \
$O\ZDecoder.obj \
LZMA_BENCH_OBJS = \
$O\LzmaBench.obj \
CRYPTO_OBJS = \
$O\7zAes.obj \
$O\7zAesRegister.obj \
@@ -409,12 +404,12 @@ CRYPTO_OBJS = \
C_OBJS = \
$O\7zBuf2.obj \
$O\7zStream.obj \
$O\Aes.obj \
$O\Alloc.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\BwtSort.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\HuffEnc.obj \
$O\LzFind.obj \
@@ -433,7 +428,8 @@ C_OBJS = \
$O\XzEnc.obj \
$O\XzIn.obj \
!include "../../Crc2.mak"
!include "../../Aes.mak"
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
@@ -461,10 +457,9 @@ OBJS = \
$(WIM_OBJS) \
$(ZIP_OBJS) \
$(COMPRESS_OBJS) \
$(LZMA_BENCH_OBJS) \
$(CRYPTO_OBJS) \
$(CRC_OBJS) \
$(C_OBJS) \
$(ASM_OBJS) \
$O\resource.res \
!include "../../../Build.mak"
@@ -512,8 +507,6 @@ $(ZIP_OBJS): ../../Archive/Zip/$(*B).cpp
$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
$(COMPL_O2)
$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp
$(COMPL)
$(CRYPTO_OBJS): ../../Crypto/$(*B).cpp
$(COMPL_O2)
@@ -530,4 +523,4 @@ $(GUI_OBJS): ../../UI/GUI/$(*B).cpp
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Crc.mak"
!include "../../Asm.mak"
+5 -6
View File
@@ -1,9 +1,6 @@
PROG = 7za.dll
DEF_FILE = ../../Archive/Archive2.def
CFLAGS = $(CFLAGS) -I ../../../ \
-DCOMPRESS_MT \
-DCOMPRESS_MF_MT \
-DCOMPRESS_BZIP2_MT \
-DDEFLATE_EXTRACT_ONLY \
-DBZIP2_EXTRACT_ONLY \
@@ -121,6 +118,7 @@ C_OBJS = \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\BwtSort.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\HuffEnc.obj \
$O\LzFind.obj \
@@ -134,7 +132,8 @@ C_OBJS = \
$O\Sort.obj \
$O\Threads.obj \
!include "../../Crc2.mak"
!include "../../Aes.mak"
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
@@ -148,7 +147,7 @@ OBJS = \
$(COMPRESS_OBJS) \
$(CRYPTO_OBJS) \
$(C_OBJS) \
$(CRC_OBJS) \
$(ASM_OBJS) \
$O\resource.res
@@ -177,4 +176,4 @@ $(CRYPTO_OBJS): ../../Crypto/$(*B).cpp
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Crc.mak"
!include "../../Asm.mak"
+5 -6
View File
@@ -2,8 +2,6 @@ PROG = 7zxa.dll
DEF_FILE = ../../Archive/Archive2.def
CFLAGS = $(CFLAGS) -I ../../../ \
-DEXTRACT_ONLY \
-DCOMPRESS_MT \
-DCOMPRESS_BZIP2_MT \
COMMON_OBJS = \
$O\CRC.obj \
@@ -92,18 +90,19 @@ CRYPTO_OBJS = \
$O\MyAes.obj \
C_OBJS = \
$O\Aes.obj \
$O\Alloc.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\Lzma2Dec.obj \
$O\LzmaDec.obj \
$O\Sha256.obj \
$O\Threads.obj \
!include "../../Crc2.mak"
!include "../../Aes.mak"
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
@@ -117,7 +116,7 @@ OBJS = \
$(COMPRESS_OBJS) \
$(CRYPTO_OBJS) \
$(C_OBJS) \
$(CRC_OBJS) \
$(ASM_OBJS) \
$O\resource.res
@@ -146,4 +145,4 @@ $(CRYPTO_OBJS): ../../Crypto/$(*B).cpp
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Crc.mak"
!include "../../Asm.mak"
+6 -2
View File
@@ -2,7 +2,6 @@ PROG = 7zxr.dll
DEF_FILE = ../../Archive/Archive2.def
CFLAGS = $(CFLAGS) -I ../../../ \
-DEXTRACT_ONLY \
-DCOMPRESS_MT \
-D_NO_CRYPTO
COMMON_OBJS = \
@@ -81,16 +80,18 @@ COMPRESS_OBJS = \
$O\LzmaRegister.obj \
C_OBJS = \
$O\7zCrc.obj \
$O\Alloc.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\Lzma2Dec.obj \
$O\LzmaDec.obj \
$O\Threads.obj \
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
$(CONSOLE_OBJS) \
@@ -102,6 +103,7 @@ OBJS = \
$(7Z_OBJS) \
$(COMPRESS_OBJS) \
$(C_OBJS) \
$(ASM_OBJS) \
$O\resource.res
@@ -126,3 +128,5 @@ $(COMPRESS_OBJS): ../../Compress/$(*B).cpp
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Asm.mak"
+83 -2
View File
@@ -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 /Gr /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "NO_REGISTRY" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /D "EXTERNAL_CODECS" /D "_7ZIP_LARGE_PAGES" /D "_LZMA_PROB32_" /FAcs /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gr /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "NO_REGISTRY" /D "EXTERNAL_CODECS" /D "_7ZIP_LARGE_PAGES" /FAcs /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 /Gr /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\SDK" /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "NO_REGISTRY" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /D "EXTERNAL_CODECS" /D "_7ZIP_LARGE_PAGES" /D "_LZMA_PROB32" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gr /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\SDK" /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "NO_REGISTRY" /D "EXTERNAL_CODECS" /D "_7ZIP_LARGE_PAGES" /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"
@@ -1316,6 +1316,11 @@ SOURCE=..\..\..\..\C\BwtSort.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.h
# End Source File
# Begin Source File
@@ -2175,6 +2180,10 @@ SOURCE=..\..\Archive\Udf\UdfRegister.cpp
# End Group
# Begin Source File
SOURCE=..\..\Archive\ApmHandler.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Archive\ArjHandler.cpp
# End Source File
# Begin Source File
@@ -2380,6 +2389,78 @@ SOURCE=..\..\..\Windows\Time.cpp
# Begin Source File
SOURCE=..\..\..\Windows\Time.h
# End Source File
# End Group
# Begin Group "Asm"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\..\Asm\x86\7zAsm.asm
# End Source File
# Begin Source File
SOURCE=..\..\..\..\Asm\x86\7zCrcOpt.asm
!IF "$(CFG)" == "7z - Win32 Release"
# Begin Custom Build
OutDir=.\Release
InputPath=..\..\..\..\Asm\x86\7zCrcOpt.asm
InputName=7zCrcOpt
"$(OutDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
ml.exe -c -Fo$(OutDir)\$(InputName).obj $(InputPath)
# End Custom Build
!ELSEIF "$(CFG)" == "7z - Win32 Debug"
# Begin Custom Build
OutDir=.\Debug
InputPath=..\..\..\..\Asm\x86\7zCrcOpt.asm
InputName=7zCrcOpt
"$(OutDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
ml.exe -c -omf -Fo$(OutDir)\$(InputName).obj $(InputPath)
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\..\..\Asm\x86\AesOpt.asm
!IF "$(CFG)" == "7z - Win32 Release"
# PROP Ignore_Default_Tool 1
# Begin Custom Build
OutDir=.\Release
InputPath=..\..\..\..\Asm\x86\AesOpt.asm
InputName=AesOpt
"$(OutDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
ml.exe -c -Fo$(OutDir)\$(InputName).obj $(InputPath)
# End Custom Build
!ELSEIF "$(CFG)" == "7z - Win32 Debug"
# PROP Ignore_Default_Tool 1
# Begin Custom Build
OutDir=.\Debug
InputPath=..\..\..\..\Asm\x86\AesOpt.asm
InputName=AesOpt
"$(OutDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
ml.exe -c -omf -WX -W3 -Fo$(OutDir)\$(InputName).obj $(InputPath)
# End Custom Build
!ENDIF
# End Source File
# End Group
# End Target
+6 -7
View File
@@ -2,9 +2,6 @@ PROG = 7z.dll
DEF_FILE = ../../Archive/Archive2.def
CFLAGS = $(CFLAGS) -I ../../../ \
-DEXTERNAL_CODECS \
-DCOMPRESS_MT \
-DCOMPRESS_BZIP2_MT \
-DCOMPRESS_MF_MT \
!IFNDEF UNDER_CE
CFLAGS = $(CFLAGS) -D_7ZIP_LARGE_PAGES
@@ -57,6 +54,7 @@ WIN_OBJS = \
AR_OBJS = \
$O\ArchiveExports.obj \
$O\DllExports2.obj \
$O\ApmHandler.obj \
$O\ArjHandler.obj \
$O\Bz2Handler.obj \
$O\CpioHandler.obj \
@@ -257,12 +255,12 @@ CRYPTO_OBJS = \
C_OBJS = \
$O\7zBuf2.obj \
$O\7zStream.obj \
$O\Aes.obj \
$O\Alloc.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\BwtSort.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\HuffEnc.obj \
$O\LzFind.obj \
@@ -281,7 +279,8 @@ C_OBJS = \
$O\XzEnc.obj \
$O\XzIn.obj \
!include "../../Crc2.mak"
!include "../../Aes.mak"
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
@@ -306,7 +305,7 @@ OBJS = \
$(COMPRESS_OBJS) \
$(CRYPTO_OBJS) \
$(C_OBJS) \
$(CRC_OBJS) \
$(ASM_OBJS) \
$O\resource.res
@@ -357,4 +356,4 @@ $(CRYPTO_OBJS): ../../Crypto/$(*B).cpp
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Crc.mak"
!include "../../Asm.mak"
+6 -3
View File
@@ -1,8 +1,6 @@
PROG = 7zra.dll
DEF_FILE = ../../Archive/Archive2.def
CFLAGS = $(CFLAGS) -I ../../../ \
-DCOMPRESS_MT \
-DCOMPRESS_MF_MT \
-D_NO_CRYPTO
COMMON_OBJS = \
@@ -94,11 +92,11 @@ COMPRESS_OBJS = \
$O\LzmaRegister.obj \
C_OBJS = \
$O\7zCrc.obj \
$O\Alloc.obj \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\LzFind.obj \
$O\LzFindMt.obj \
@@ -109,6 +107,8 @@ C_OBJS = \
$O\MtCoder.obj \
$O\Threads.obj \
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
$(CONSOLE_OBJS) \
@@ -120,6 +120,7 @@ OBJS = \
$(7Z_OBJS) \
$(COMPRESS_OBJS) \
$(C_OBJS) \
$(ASM_OBJS) \
$O\resource.res
@@ -144,3 +145,5 @@ $(COMPRESS_OBJS): ../../Compress/$(*B).cpp
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Asm.mak"
@@ -2,9 +2,6 @@
#include "StdAfx.h"
#include "../../../Common/MyWindows.h"
#include "../../../Common/MyInitGuid.h"
#include <stdio.h>
#if (defined(_WIN32) || defined(OS2) || defined(MSDOS)) && !defined(UNDER_CE)
@@ -15,28 +12,32 @@
#define MY_SET_BINARY_MODE(file)
#endif
#include "../../../Common/CommandLineParser.h"
#include "../../../Common/StringConvert.h"
#include "../../../Common/StringToInt.h"
#include "../../../Windows/NtCheck.h"
#include "../../Common/FileStreams.h"
#include "../../Common/StreamUtils.h"
#include "../LzmaDecoder.h"
#include "../LzmaEncoder.h"
#include "LzmaBenchCon.h"
#ifdef COMPRESS_MF_MT
#include "../../../Windows/System.h"
#endif
// #include "../../../Common/MyWindows.h"
#include "../../../Common/MyInitGuid.h"
#include "../../../../C/7zVersion.h"
#include "../../../../C/Alloc.h"
#include "../../../../C/Lzma86.h"
#include "../../../Windows/NtCheck.h"
#ifndef _7ZIP_ST
#include "../../../Windows/System.h"
#endif
#include "../../../Common/CommandLineParser.h"
#include "../../../Common/StringConvert.h"
#include "../../../Common/StringToInt.h"
#include "../../Common/FileStreams.h"
#include "../../Common/StreamUtils.h"
#include "../../Compress/LzmaDecoder.h"
#include "../../Compress/LzmaEncoder.h"
#include "../../UI/Console/BenchCon.h"
using namespace NCommandLineParser;
static const char *kCantAllocate = "Can not allocate memory";
@@ -213,7 +214,7 @@ int main2(int numArgs, const char *args[])
UInt32 numThreads = (UInt32)-1;
#ifdef COMPRESS_MF_MT
#ifndef _7ZIP_ST
if (parser[NKey::kMultiThread].ThereIs)
{
UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors();
@@ -1,26 +1,24 @@
# Microsoft Developer Studio Project File - Name="AloneLZMA" - Package Owner=<4>
# Microsoft Developer Studio Project File - Name="LzmaCon" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=AloneLZMA - Win32 DebugU
CFG=LzmaCon - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "AloneLZMA.mak".
!MESSAGE NMAKE /f "LzmaCon.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "AloneLZMA.mak" CFG="AloneLZMA - Win32 DebugU"
!MESSAGE NMAKE /f "LzmaCon.mak" CFG="LzmaCon - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "AloneLZMA - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "AloneLZMA - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE "AloneLZMA - Win32 ReleaseU" (based on "Win32 (x86) Console Application")
!MESSAGE "AloneLZMA - Win32 DebugU" (based on "Win32 (x86) Console Application")
!MESSAGE "LzmaCon - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "LzmaCon - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
@@ -30,7 +28,7 @@ CFG=AloneLZMA - Win32 DebugU
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "AloneLZMA - Win32 Release"
!IF "$(CFG)" == "LzmaCon - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@@ -44,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "BENCH_MT" /FAcs /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gr /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -52,10 +50,9 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\lzma.exe" /opt:NOWIN98
# SUBTRACT LINK32 /pdb:none
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"C:\Util\lzma.exe"
!ELSEIF "$(CFG)" == "AloneLZMA - Win32 Debug"
!ELSEIF "$(CFG)" == "LzmaCon - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
@@ -69,7 +66,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "BENCH_MT" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -77,68 +74,14 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\lzma.exe" /pdbtype:sept
!ELSEIF "$(CFG)" == "AloneLZMA - Win32 ReleaseU"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseU"
# PROP BASE Intermediate_Dir "ReleaseU"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseU"
# PROP Intermediate_Dir "ReleaseU"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "BENCH_MT" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\7za2.exe" /opt:NOWIN98
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"c:\UTIL\lzma.exe" /opt:NOWIN98
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "AloneLZMA - Win32 DebugU"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "DebugU"
# PROP BASE Intermediate_Dir "DebugU"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "DebugU"
# PROP Intermediate_Dir "DebugU"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "BENCH_MT" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\7za2.exe" /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"c:\UTIL\lzma.exe" /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"C:\Util\lzma.exe" /pdbtype:sept
!ENDIF
# Begin Target
# Name "AloneLZMA - Win32 Release"
# Name "AloneLZMA - Win32 Debug"
# Name "AloneLZMA - Win32 ReleaseU"
# Name "AloneLZMA - Win32 DebugU"
# Name "LzmaCon - Win32 Release"
# Name "LzmaCon - Win32 Debug"
# Begin Group "Spec"
# PROP Default_Filter ""
@@ -154,27 +97,27 @@ SOURCE=.\StdAfx.h
# End Group
# Begin Group "Compress"
# PROP Default_Filter ""
# Begin Group "LZMA"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\LzmaDecoder.cpp
SOURCE=..\..\Compress\LzmaDecoder.cpp
# End Source File
# Begin Source File
SOURCE=..\LzmaDecoder.h
SOURCE=..\..\Compress\LzmaDecoder.h
# End Source File
# Begin Source File
SOURCE=..\LzmaEncoder.cpp
SOURCE=..\..\Compress\LzmaEncoder.cpp
# End Source File
# Begin Source File
SOURCE=..\LzmaEncoder.h
SOURCE=..\..\Compress\LzmaEncoder.h
# End Source File
# Begin Source File
SOURCE=..\..\Compress\LzmaRegister.cpp
# End Source File
# End Group
# End Group
# Begin Group "Windows"
@@ -221,6 +164,10 @@ SOURCE=..\..\..\Common\CommandLineParser.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\ComTry.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\CRC.cpp
# End Source File
# Begin Source File
@@ -229,10 +176,6 @@ SOURCE=..\..\..\Common\Defs.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Defs.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\IntToString.cpp
# End Source File
# Begin Source File
@@ -253,6 +196,10 @@ SOURCE=..\..\..\Common\MyString.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\MyUnknown.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\MyVector.cpp
# End Source File
# Begin Source File
@@ -261,6 +208,10 @@ SOURCE=..\..\..\Common\MyVector.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\MyWindows.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\MyWindows.h
# End Source File
# Begin Source File
@@ -297,6 +248,14 @@ SOURCE=..\..\..\Common\Types.h
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Common\CreateCoder.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\CreateCoder.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\CWrappers.cpp
# End Source File
# Begin Source File
@@ -313,19 +272,11 @@ SOURCE=..\..\Common\FileStreams.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\InBuffer.cpp
SOURCE=..\..\Common\FilterCoder.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\InBuffer.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\OutBuffer.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\OutBuffer.h
SOURCE=..\..\Common\FilterCoder.h
# End Source File
# Begin Source File
@@ -336,13 +287,49 @@ SOURCE=..\..\Common\StreamUtils.cpp
SOURCE=..\..\Common\StreamUtils.h
# End Source File
# End Group
# Begin Group "UI Common"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\UI\Common\Bench.cpp
# End Source File
# Begin Source File
SOURCE=..\..\UI\Common\Bench.h
# End Source File
# Begin Source File
SOURCE=..\..\UI\Common\LoadCodecs.cpp
# End Source File
# Begin Source File
SOURCE=..\..\UI\Common\LoadCodecs.h
# End Source File
# End Group
# Begin Group "Console"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\UI\Console\BenchCon.cpp
# End Source File
# Begin Source File
SOURCE=..\..\UI\Console\BenchCon.h
# End Source File
# Begin Source File
SOURCE=..\..\UI\Console\ConsoleClose.cpp
# End Source File
# Begin Source File
SOURCE=..\..\UI\Console\ConsoleClose.h
# End Source File
# End Group
# Begin Group "C"
# PROP Default_Filter ""
# Begin Group "LzmaUtil"
# PROP Default_Filter ""
# End Group
# Begin Source File
SOURCE=..\..\..\..\C\7zCrc.c
@@ -354,6 +341,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
@@ -363,6 +355,11 @@ SOURCE=..\..\..\..\C\Alloc.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Bra.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Bra.h
# End Source File
# Begin Source File
@@ -372,6 +369,20 @@ SOURCE=..\..\..\..\C\Bra86.c
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\BraIA64.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\LzFind.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
@@ -440,27 +451,7 @@ SOURCE=..\..\..\..\C\Types.h
# End Group
# Begin Source File
SOURCE=..\..\ICoder.h
# End Source File
# Begin Source File
SOURCE=.\LzmaAlone.cpp
# End Source File
# Begin Source File
SOURCE=.\LzmaBench.cpp
# End Source File
# Begin Source File
SOURCE=.\LzmaBench.h
# End Source File
# Begin Source File
SOURCE=.\LzmaBenchCon.cpp
# End Source File
# Begin Source File
SOURCE=.\LzmaBenchCon.h
# End Source File
# End Target
# End Project
@@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
###############################################################################
Project: "AloneLZMA"=.\AloneLZMA.dsp - Package Owner=<4>
Project: "LzmaCon"=.\LzmaCon.dsp - Package Owner=<4>
Package=<5>
{{{
@@ -1,17 +1,14 @@
PROG = lzma.exe
MY_CONSOLE = 1
CFLAGS = $(CFLAGS) \
-DCOMPRESS_MF_MT \
-DBENCH_MT \
CFLAGS = $(CFLAGS)
LZMA_OBJS = \
$O\LzmaAlone.obj \
$O\LzmaBench.obj \
$O\LzmaBenchCon.obj \
LZMA_OPT_OBJS = \
COMPRESS_OBJS = \
$O\LzmaDecoder.obj \
$O\LzmaEncoder.obj \
$O\LzmaRegister.obj \
COMMON_OBJS = \
$O\CommandLineParser.obj \
@@ -23,18 +20,28 @@ COMMON_OBJS = \
$O\MyVector.obj
WIN_OBJS = \
$O\FileIO.obj \
$O\System.obj
7ZIP_COMMON_OBJS = \
$O\CWrappers.obj \
$O\InBuffer.obj \
$O\CreateCoder.obj \
$O\FileStreams.obj \
$O\FilterCoder.obj \
$O\OutBuffer.obj \
$O\StreamUtils.obj \
UI_COMMON_OBJS = \
$O\Bench.obj \
CONSOLE_OBJS = \
$O\ConsoleClose.obj \
$O\BenchCon.obj \
C_OBJS = \
$O\7zCrc.obj \
$O\Alloc.obj \
$O\Bra86.obj \
$O\CpuArch.obj \
$O\LzFind.obj \
$O\LzFindMt.obj \
$O\Lzma86Dec.obj \
@@ -43,23 +50,26 @@ C_OBJS = \
$O\LzmaEnc.obj \
$O\Threads.obj \
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
$(LZMA_OBJS) \
$(LZMA_OPT_OBJS) \
$(COMPRESS_OBJS) \
$(COMMON_OBJS) \
$(WIN_OBJS) \
$(7ZIP_COMMON_OBJS) \
$(UI_COMMON_OBJS) \
$(CONSOLE_OBJS) \
$(C_OBJS) \
$O\FileStreams.obj \
$O\FileIO.obj \
$(ASM_OBJS) \
!include "../../../Build.mak"
$(LZMA_OBJS): $(*B).cpp
$(COMPL)
$(LZMA_OPT_OBJS): ../$(*B).cpp
$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
$(COMPL_O2)
$(COMMON_OBJS): ../../../Common/$(*B).cpp
$(COMPL)
@@ -67,9 +77,11 @@ $(WIN_OBJS): ../../../Windows/$(*B).cpp
$(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
$O\FileStreams.obj: ../../Common/FileStreams.cpp
$(UI_COMMON_OBJS): ../../UI/Common/$(*B).cpp
$(COMPL)
$O\FileIO.obj: ../../../Windows/FileIO.cpp
$(CONSOLE_OBJS): ../../UI/Console/$(*B).cpp
$(COMPL)
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Asm.mak"
@@ -3,7 +3,7 @@ CXX = g++ -O2 -Wall
CXX_C = gcc -O2 -Wall
LIB = -lm
RM = rm -f
CFLAGS = -c
CFLAGS = -c -D_7ZIP_ST
ifdef SystemDrive
IS_MINGW = 1
@@ -20,14 +20,16 @@ endif
OBJS = \
LzmaAlone.o \
LzmaBench.o \
LzmaBenchCon.o \
Bench.o \
BenchCon.o \
ConsoleClose.o \
LzmaDecoder.o \
LzmaEncoder.o \
LzmaRegister.o \
CreateCoder.o \
CWrappers.o \
InBuffer.o \
OutBuffer.o \
FileStreams.o \
FilterCoder.o \
StreamUtils.o \
$(FILE_IO).o \
CommandLineParser.o \
@@ -38,8 +40,10 @@ OBJS = \
StringToInt.o \
MyVector.o \
7zCrc.o \
7zCrcOpt.o \
Alloc.o \
Bra86.o \
CpuArch.o \
LzFind.o \
LzmaDec.o \
LzmaEnc.o \
@@ -55,30 +59,36 @@ $(PROG): $(OBJS)
LzmaAlone.o: LzmaAlone.cpp
$(CXX) $(CFLAGS) LzmaAlone.cpp
LzmaBench.o: LzmaBench.cpp
$(CXX) $(CFLAGS) LzmaBench.cpp
Bench.o: ../../UI/Common/Bench.cpp
$(CXX) $(CFLAGS) ../../UI/Common/Bench.cpp
LzmaBenchCon.o: LzmaBenchCon.cpp
$(CXX) $(CFLAGS) LzmaBenchCon.cpp
BenchCon.o: ../../UI/Console/BenchCon.cpp
$(CXX) $(CFLAGS) ../../UI/Console/BenchCon.cpp
LzmaDecoder.o: ../LzmaDecoder.cpp
$(CXX) $(CFLAGS) ../LzmaDecoder.cpp
ConsoleClose.o: ../../UI/Console/ConsoleClose.cpp
$(CXX) $(CFLAGS) ../../UI/Console/ConsoleClose.cpp
LzmaEncoder.o: ../LzmaEncoder.cpp
$(CXX) $(CFLAGS) ../LzmaEncoder.cpp
LzmaDecoder.o: ../../Compress/LzmaDecoder.cpp
$(CXX) $(CFLAGS) ../../Compress/LzmaDecoder.cpp
LzmaEncoder.o: ../../Compress/LzmaEncoder.cpp
$(CXX) $(CFLAGS) ../../Compress/LzmaEncoder.cpp
LzmaRegister.o: ../../Compress/LzmaRegister.cpp
$(CXX) $(CFLAGS) ../../Compress/LzmaRegister.cpp
CreateCoder.o: ../../Common/CreateCoder.cpp
$(CXX) $(CFLAGS) ../../Common/CreateCoder.cpp
CWrappers.o: ../../Common/CWrappers.cpp
$(CXX) $(CFLAGS) ../../Common/CWrappers.cpp
InBuffer.o: ../../Common/InBuffer.cpp
$(CXX) $(CFLAGS) ../../Common/InBuffer.cpp
OutBuffer.o: ../../Common/OutBuffer.cpp
$(CXX) $(CFLAGS) ../../Common/OutBuffer.cpp
FileStreams.o: ../../Common/FileStreams.cpp
$(CXX) $(CFLAGS) ../../Common/FileStreams.cpp
FilterCoder.o: ../../Common/FilterCoder.cpp
$(CXX) $(CFLAGS) ../../Common/FilterCoder.cpp
StreamUtils.o: ../../Common/StreamUtils.cpp
$(CXX) $(CFLAGS) ../../Common/StreamUtils.cpp
@@ -113,12 +123,18 @@ MyVector.o: ../../../Common/MyVector.cpp
7zCrc.o: ../../../../C/7zCrc.c
$(CXX_C) $(CFLAGS) ../../../../C/7zCrc.c
7zCrcOpt.o: ../../../../C/7zCrcOpt.c
$(CXX_C) $(CFLAGS) ../../../../C/7zCrcOpt.c
Alloc.o: ../../../../C/Alloc.c
$(CXX_C) $(CFLAGS) ../../../../C/Alloc.c
Bra86.o: ../../../../C/Bra86.c
$(CXX_C) $(CFLAGS) ../../../../C/Bra86.c
CpuArch.o: ../../../../C/CpuArch.c
$(CXX_C) $(CFLAGS) ../../../../C/CpuArch.c
LzFind.o: ../../../../C/LzFind.c
$(CXX_C) $(CFLAGS) ../../../../C/LzFind.c
+16 -1
View File
@@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "COMPRESS_BCJ2" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "EXTRACT_ONLY" /D "_SFX" /D "NO_READ_FROM_CODER" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "EXTRACT_ONLY" /D "_SFX" /D "NO_READ_FROM_CODER" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -710,6 +710,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\Aes.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
@@ -719,6 +724,11 @@ SOURCE=..\..\..\..\C\Aes.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\AesOpt.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Alloc.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
@@ -737,6 +747,11 @@ SOURCE=..\..\..\..\C\Bra86.c
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Lzma2Dec.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
+6 -5
View File
@@ -38,7 +38,7 @@ WIN_OBJS = \
$O\FileName.obj \
$O\PropVariant.obj \
$O\PropVariantConversions.obj \
$O\Synchronization.obj
$O\Synchronization.obj \
7ZIP_COMMON_OBJS = \
$O\CreateCoder.obj \
@@ -103,15 +103,16 @@ CRYPTO_OBJS = \
$O\MyAes.obj \
C_OBJS = \
$O\Aes.obj \
$O\Alloc.obj \
$O\Bra86.obj \
$O\CpuArch.obj \
$O\Lzma2Dec.obj \
$O\LzmaDec.obj \
$O\Sha256.obj \
$O\Threads.obj \
!include "../../Crc2.mak"
!include "../../Aes.mak"
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
@@ -126,7 +127,7 @@ OBJS = \
$(COMPRESS_OBJS) \
$(CRYPTO_OBJS) \
$(C_OBJS) \
$(CRC_OBJS) \
$(ASM_OBJS) \
$O\resource.res
@@ -157,4 +158,4 @@ $(CRYPTO_OBJS): ../../Crypto/$(*B).cpp
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Crc.mak"
!include "../../Asm.mak"
+15 -1
View File
@@ -97,7 +97,7 @@ LINK32=link.exe
# PROP Intermediate_Dir "ReleaseD"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "_SFX" /Yu"StdAfx.h" /FD /c
# ADD BASE CPP /nologo /MD /W3 /GX /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "_SFX" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "NO_REGISTRY" /D "_SFX" /D "_NO_CRYPTO" /Yu"StdAfx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -650,6 +650,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
@@ -668,6 +673,15 @@ SOURCE=..\..\..\..\C\Bra86.c
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\LzmaDec.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
+4 -3
View File
@@ -92,10 +92,11 @@ COMPRESS_OBJS = \
C_OBJS = \
$O\Alloc.obj \
$O\Bra86.obj \
$O\CpuArch.obj \
$O\LzmaDec.obj \
$O\Threads.obj \
!include "../../Crc2.mak"
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
@@ -111,7 +112,7 @@ OBJS = \
$(COMPRESS_OBJS) \
$O\MyMessages.obj \
$(C_OBJS) \
$(CRC_OBJS) \
$(ASM_OBJS) \
$O\resource.res
@@ -146,4 +147,4 @@ $O\MyMessages.obj: ../../UI/Explorer/MyMessages.cpp
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Crc.mak"
!include "../../Asm.mak"
+16 -1
View File
@@ -97,7 +97,7 @@ LINK32=link.exe
# PROP Intermediate_Dir "SFXWin___Win32_ReleaseD"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /c
# ADD BASE CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "_SFX" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_SFXWIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "NO_REGISTRY" /D "NO_READ_FROM_CODER" /D "_SFX" /Yu"StdAfx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -770,6 +770,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\Aes.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
@@ -779,6 +784,11 @@ SOURCE=..\..\..\..\C\Aes.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\AesOpt.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Alloc.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
@@ -797,6 +807,11 @@ SOURCE=..\..\..\..\C\Bra86.c
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\CpuArch.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Lzma2Dec.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
+5 -4
View File
@@ -120,15 +120,16 @@ CRYPTO_OBJS = \
$O\MyAes.obj \
C_OBJS = \
$O\Aes.obj \
$O\Alloc.obj \
$O\Bra86.obj \
$O\CpuArch.obj \
$O\Lzma2Dec.obj \
$O\LzmaDec.obj \
$O\Sha256.obj \
$O\Threads.obj \
!include "../../Crc2.mak"
!include "../../Aes.mak"
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
@@ -146,7 +147,7 @@ OBJS = \
$(CRYPTO_OBJS) \
$O\MyMessages.obj \
$(C_OBJS) \
$(CRC_OBJS) \
$(ASM_OBJS) \
$O\resource.res
@@ -184,4 +185,4 @@ $O\MyMessages.obj: ../../UI/Explorer/MyMessages.cpp
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Crc.mak"
!include "../../Asm.mak"
+1
View File
@@ -7,6 +7,7 @@ DIRS = \
Format7zR\~ \
Format7zExtract\~ \
Format7zExtractR\~ \
LzmaCon\~ \
SFXCon\~ \
SFXSetup\~ \
SFXWin\~ \
+3 -2
View File
@@ -2,10 +2,11 @@
#include "StdAfx.h"
#include "../../Windows/Defs.h"
#include "../../Windows/PropVariant.h"
#include "CreateCoder.h"
#include "../../Windows/PropVariant.h"
#include "../../Windows/Defs.h"
#include "FilterCoder.h"
#include "RegisterCodec.h"
+4 -4
View File
@@ -1,10 +1,10 @@
// CreateCoder.h
#ifndef __CREATECODER_H
#define __CREATECODER_H
#ifndef __CREATE_CODER_H
#define __CREATE_CODER_H
#include "Common/MyCom.h"
#include "Common/MyString.h"
#include "../../Common/MyCom.h"
#include "../../Common/MyString.h"
#include "../ICoder.h"
#include "MethodId.h"
+32 -40
View File
@@ -14,6 +14,8 @@ static const UInt32 kBufferSize = 1 << 17;
CFilterCoder::CFilterCoder()
{
_buffer = (Byte *)::MidAlloc(kBufferSize);
if (_buffer == 0)
throw 1;
}
CFilterCoder::~CFilterCoder()
@@ -34,10 +36,8 @@ HRESULT CFilterCoder::WriteWithLimit(ISequentialOutStream *outStream, UInt32 siz
return S_OK;
}
STDMETHODIMP CFilterCoder::Code(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize,
ICompressProgressInfo *progress)
STDMETHODIMP CFilterCoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
{
RINOK(Init());
UInt32 bufferPos = 0;
@@ -45,7 +45,7 @@ STDMETHODIMP CFilterCoder::Code(ISequentialInStream *inStream,
if (_outSizeIsDefined)
_outSize = *outSize;
while(NeedMore())
while (!_outSizeIsDefined || _nowPos64 < _outSize)
{
size_t processedSize = kBufferSize - bufferPos;
@@ -57,16 +57,16 @@ STDMETHODIMP CFilterCoder::Code(ISequentialInStream *inStream,
bufferPos = Filter->Filter(_buffer, endPos);
if (bufferPos > endPos)
{
for (; endPos< bufferPos; endPos++)
for (; endPos < bufferPos; endPos++)
_buffer[endPos] = 0;
bufferPos = Filter->Filter(_buffer, endPos);
}
if (bufferPos == 0)
{
if (endPos > 0)
return WriteWithLimit(outStream, endPos);
return S_OK;
if (endPos == 0)
return S_OK;
return WriteWithLimit(outStream, endPos);
}
RINOK(WriteWithLimit(outStream, bufferPos));
if (progress != NULL)
@@ -74,14 +74,13 @@ STDMETHODIMP CFilterCoder::Code(ISequentialInStream *inStream,
RINOK(progress->SetRatioInfo(&_nowPos64, &_nowPos64));
}
UInt32 i = 0;
while(bufferPos < endPos)
while (bufferPos < endPos)
_buffer[i++] = _buffer[bufferPos++];
bufferPos = i;
}
return S_OK;
}
// #ifdef _ST_MODE
STDMETHODIMP CFilterCoder::SetOutStream(ISequentialOutStream *outStream)
{
_bufferPos = 0;
@@ -98,16 +97,15 @@ STDMETHODIMP CFilterCoder::ReleaseOutStream()
STDMETHODIMP CFilterCoder::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
UInt32 processedSizeTotal = 0;
while(size > 0)
if (processedSize != NULL)
*processedSize = 0;
while (size > 0)
{
UInt32 sizeMax = kBufferSize - _bufferPos;
UInt32 sizeTemp = size;
if (sizeTemp > sizeMax)
sizeTemp = sizeMax;
memmove(_buffer + _bufferPos, data, sizeTemp);
UInt32 sizeTemp = MyMin(size, kBufferSize - _bufferPos);
memcpy(_buffer + _bufferPos, data, sizeTemp);
size -= sizeTemp;
processedSizeTotal += sizeTemp;
if (processedSize != NULL)
*processedSize += sizeTemp;
data = (const Byte *)data + sizeTemp;
UInt32 endPos = _bufferPos + sizeTemp;
_bufferPos = Filter->Filter(_buffer, endPos);
@@ -124,12 +122,10 @@ STDMETHODIMP CFilterCoder::Write(const void *data, UInt32 size, UInt32 *processe
}
RINOK(WriteWithLimit(_outStream, _bufferPos));
UInt32 i = 0;
while(_bufferPos < endPos)
while (_bufferPos < endPos)
_buffer[i++] = _buffer[_bufferPos++];
_bufferPos = i;
}
if (processedSize != NULL)
*processedSize = processedSizeTotal;
return S_OK;
}
@@ -137,6 +133,7 @@ STDMETHODIMP CFilterCoder::Flush()
{
if (_bufferPos != 0)
{
// _buffer contains only data refused by previous Filter->Filter call.
UInt32 endPos = Filter->Filter(_buffer, _bufferPos);
if (endPos > _bufferPos)
{
@@ -145,13 +142,13 @@ STDMETHODIMP CFilterCoder::Flush()
if (Filter->Filter(_buffer, endPos) != endPos)
return E_FAIL;
}
RINOK(WriteStream(_outStream, _buffer, _bufferPos));
RINOK(WriteWithLimit(_outStream, _bufferPos));
_bufferPos = 0;
}
CMyComPtr<IOutStreamFlush> flush;
_outStream.QueryInterface(IID_IOutStreamFlush, &flush);
if (flush)
return flush->Flush();
return flush->Flush();
return S_OK;
}
@@ -171,37 +168,36 @@ STDMETHODIMP CFilterCoder::ReleaseInStream()
STDMETHODIMP CFilterCoder::Read(void *data, UInt32 size, UInt32 *processedSize)
{
UInt32 processedSizeTotal = 0;
while(size > 0)
if (processedSize != NULL)
*processedSize = 0;
while (size > 0)
{
if (_convertedPosBegin != _convertedPosEnd)
{
UInt32 sizeTemp = MyMin(size, _convertedPosEnd - _convertedPosBegin);
memmove(data, _buffer + _convertedPosBegin, sizeTemp);
memcpy(data, _buffer + _convertedPosBegin, sizeTemp);
_convertedPosBegin += sizeTemp;
data = (void *)((Byte *)data + sizeTemp);
size -= sizeTemp;
processedSizeTotal += sizeTemp;
if (processedSize != NULL)
*processedSize += sizeTemp;
break;
}
int i;
UInt32 i;
for (i = 0; _convertedPosEnd + i < _bufferPos; i++)
_buffer[i] = _buffer[i + _convertedPosEnd];
_buffer[i] = _buffer[_convertedPosEnd + i];
_bufferPos = i;
_convertedPosBegin = _convertedPosEnd = 0;
size_t processedSizeTemp = kBufferSize - _bufferPos;
RINOK(ReadStream(_inStream, _buffer + _bufferPos, &processedSizeTemp));
_bufferPos = _bufferPos + (UInt32)processedSizeTemp;
_bufferPos += (UInt32)processedSizeTemp;
_convertedPosEnd = Filter->Filter(_buffer, _bufferPos);
if (_convertedPosEnd == 0)
{
if (_bufferPos == 0)
break;
else
{
_convertedPosEnd = _bufferPos; // check it
continue;
}
_convertedPosEnd = _bufferPos; // check it
continue;
}
if (_convertedPosEnd > _bufferPos)
{
@@ -210,13 +206,9 @@ STDMETHODIMP CFilterCoder::Read(void *data, UInt32 size, UInt32 *processedSize)
_convertedPosEnd = Filter->Filter(_buffer, _bufferPos);
}
}
if (processedSize != NULL)
*processedSize = processedSizeTotal;
return S_OK;
}
// #endif // _ST_MODE
#ifndef _NO_CRYPTO
STDMETHODIMP CFilterCoder::CryptoSetPassword(const Byte *data, UInt32 size)
{
+5 -20
View File
@@ -1,7 +1,7 @@
// FilterCoder.h
#ifndef __FILTERCODER_H
#define __FILTERCODER_H
#ifndef __FILTER_CODER_H
#define __FILTER_CODER_H
#include "../../Common/MyCom.h"
#include "../ICoder.h"
@@ -13,13 +13,11 @@
class CFilterCoder:
public ICompressCoder,
// #ifdef _ST_MODE
public ICompressSetInStream,
public ISequentialInStream,
public ICompressSetOutStream,
public ISequentialOutStream,
public IOutStreamFlush,
// #endif
#ifndef _NO_CRYPTO
public ICryptoSetPassword,
@@ -35,13 +33,11 @@ class CFilterCoder:
{
protected:
Byte *_buffer;
// #ifdef _ST_MODE
CMyComPtr<ISequentialInStream> _inStream;
CMyComPtr<ISequentialOutStream> _outStream;
UInt32 _bufferPos;
UInt32 _convertedPosBegin;
UInt32 _convertedPosEnd;
// #endif
bool _outSizeIsDefined;
UInt64 _outSize;
UInt64 _nowPos64;
@@ -67,20 +63,14 @@ public:
CFilterCoder();
~CFilterCoder();
HRESULT WriteWithLimit(ISequentialOutStream *outStream, UInt32 size);
bool NeedMore() const
{ return (!_outSizeIsDefined || (_nowPos64 < _outSize)); }
public:
MY_QUERYINTERFACE_BEGIN
MY_QUERYINTERFACE_ENTRY(ICompressCoder)
// #ifdef _ST_MODE
MY_QUERYINTERFACE_BEGIN2(ICompressCoder)
MY_QUERYINTERFACE_ENTRY(ICompressSetInStream)
MY_QUERYINTERFACE_ENTRY(ISequentialInStream)
MY_QUERYINTERFACE_ENTRY(ICompressSetOutStream)
MY_QUERYINTERFACE_ENTRY(ISequentialOutStream)
MY_QUERYINTERFACE_ENTRY(IOutStreamFlush)
// #endif
#ifndef _NO_CRYPTO
MY_QUERYINTERFACE_ENTRY_AG(ICryptoSetPassword, Filter, _setPassword)
@@ -96,10 +86,8 @@ public:
MY_QUERYINTERFACE_ENTRY_AG(ICompressSetDecoderProperties2, Filter, _setDecoderProperties)
MY_QUERYINTERFACE_END
MY_ADDREF_RELEASE
STDMETHOD(Code)(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress);
// #ifdef _ST_MODE
STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(ReleaseInStream)();
STDMETHOD(SetInStream)(ISequentialInStream *inStream);
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); \
@@ -107,7 +95,6 @@ public:
STDMETHOD(ReleaseOutStream)();
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
STDMETHOD(Flush)();
// #endif
#ifndef _NO_CRYPTO
STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
@@ -122,7 +109,6 @@ public:
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
};
// #ifdef _ST_MODE
class CInStreamReleaser
{
public:
@@ -138,6 +124,5 @@ public:
COutStreamReleaser(): FilterCoder(0) {}
~COutStreamReleaser() { if (FilterCoder) FilterCoder->ReleaseOutStream(); }
};
// #endif
#endif
+2 -2
View File
@@ -24,12 +24,12 @@ struct CMethod
struct CMethodsMode
{
CObjectVector<CMethod> Methods;
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
UInt32 NumThreads;
#endif
CMethodsMode()
#ifdef COMPRESS_MT
#ifndef _7ZIP_ST
: NumThreads(1)
#endif
{}
+2 -6
View File
@@ -1,7 +1,7 @@
// RegisterArc.h
#ifndef __REGISTERARC_H
#define __REGISTERARC_H
#ifndef __REGISTER_ARC_H
#define __REGISTER_ARC_H
#include "../Archive/IArchive.h"
@@ -25,10 +25,6 @@ void RegisterArc(const CArcInfo *arcInfo);
#define REGISTER_ARC_NAME(x) CRegister ## x
#define REGISTER_ARC_DEC_SIG(x) struct REGISTER_ARC_NAME(x) { \
REGISTER_ARC_NAME(x)() { g_ArcInfo.Signature[0]--; RegisterArc(&g_ArcInfo); }}; \
static REGISTER_ARC_NAME(x) g_RegisterArc;
#define REGISTER_ARC(x) struct REGISTER_ARC_NAME(x) { \
REGISTER_ARC_NAME(x)() { RegisterArc(&g_ArcInfo); }}; \
static REGISTER_ARC_NAME(x) g_RegisterArc;
+2 -8
View File
@@ -246,15 +246,9 @@ HRESULT CCoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *ou
if (!m_InBitStream.Create(1 << 20))
return E_OUTOFMEMORY;
int size1 = sizeof(c_table) / sizeof(c_table[0]);
for (int i = 0; i < size1; i++)
{
if (i % 100 == 0)
c_table[i] = 0;
// check it
for (int i = 0; i < CTABLESIZE; i++)
c_table[i] = 0;
}
UInt64 pos = 0;
m_OutWindowStream.SetStream(outStream);
+5 -5
View File
@@ -420,7 +420,7 @@ static UInt32 NO_INLINE DecodeBlock2Rand(const UInt32 *tt, UInt32 blockSize, UIn
CDecoder::CDecoder()
{
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
m_States = 0;
m_NumThreadsPrev = 0;
NumThreads = 1;
@@ -428,7 +428,7 @@ CDecoder::CDecoder()
_needInStreamInit = true;
}
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
CDecoder::~CDecoder()
{
@@ -521,8 +521,8 @@ HRESULT CDecoder::ReadSignatures(bool &wasFinished, UInt32 &crc)
HRESULT CDecoder::DecodeFile(bool &isBZ, ICompressProgressInfo *progress)
{
#ifdef COMPRESS_BZIP2_MT
Progress = progress;
#ifndef _7ZIP_ST
RINOK(Create());
for (UInt32 t = 0; t < NumThreads; t++)
{
@@ -556,7 +556,7 @@ HRESULT CDecoder::DecodeFile(bool &isBZ, ICompressProgressInfo *progress)
UInt32 dicSize = (UInt32)(s[3] - kArSig3) * kBlockSizeStep;
CombinedCrc.Init();
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
if (MtMode)
{
NextBlockIndex = 0;
@@ -662,7 +662,7 @@ HRESULT CDecoder::CodeResume(ISequentialOutStream *outStream, bool &isBZ, ICompr
STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream) { m_InStream.SetStream(inStream); return S_OK; }
STDMETHODIMP CDecoder::ReleaseInStream() { m_InStream.ReleaseStream(); return S_OK; }
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
static THREAD_FUNC_DECL MFThread(void *p) { ((CState *)p)->ThreadFunc(); return 0; }
+8 -8
View File
@@ -5,7 +5,7 @@
#include "../../Common/MyCom.h"
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
#include "../../Windows/Synchronization.h"
#include "../../Windows/Thread.h"
#endif
@@ -31,7 +31,7 @@ struct CState
{
UInt32 *Counters;
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
CDecoder *Decoder;
NWindows::CThread Thread;
@@ -59,7 +59,7 @@ struct CState
class CDecoder :
public ICompressCoder,
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
public ICompressSetCoderMt,
#endif
public CMyUnknownImp
@@ -104,9 +104,9 @@ private:
public:
CBZip2CombinedCrc CombinedCrc;
#ifdef COMPRESS_BZIP2_MT
ICompressProgressInfo *Progress;
#ifndef _7ZIP_ST
CState *m_States;
UInt32 m_NumThreadsPrev;
@@ -145,8 +145,8 @@ public:
m_OutStream.ReleaseStream();
}
MY_QUERYINTERFACE_BEGIN
#ifdef COMPRESS_BZIP2_MT
MY_QUERYINTERFACE_BEGIN2(ICompressCoder)
#ifndef _7ZIP_ST
MY_QUERYINTERFACE_ENTRY(ICompressSetCoderMt)
#endif
@@ -163,7 +163,7 @@ public:
HRESULT CodeResume(ISequentialOutStream *outStream, bool &isBZ, ICompressProgressInfo *progress);
UInt64 GetInputProcessedSize() const { return m_InStream.GetProcessedSize(); }
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
STDMETHOD(SetNumberOfThreads)(UInt32 numThreads);
#endif
};
+12 -12
View File
@@ -46,7 +46,7 @@ void CThreadInfo::Free()
m_Block = 0;
}
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
static THREAD_FUNC_DECL MFThread(void *threadCoderInfo)
{
@@ -127,14 +127,14 @@ CEncoder::CEncoder():
m_OptimizeNumTables(false),
m_BlockSizeMult(kBlockSizeMultMax)
{
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
ThreadsInfo = 0;
m_NumThreadsPrev = 0;
NumThreads = 1;
#endif
}
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
CEncoder::~CEncoder()
{
Free();
@@ -680,7 +680,7 @@ HRESULT CThreadInfo::EncodeBlock3(UInt32 blockSize)
EncodeBlock2(m_Block, blockSize, Encoder->NumPasses);
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
if (Encoder->MtMode)
Encoder->ThreadsInfo[m_BlockIndex].CanWriteEvent.Lock();
#endif
@@ -688,7 +688,7 @@ HRESULT CThreadInfo::EncodeBlock3(UInt32 blockSize)
Encoder->CombinedCrc.Update(m_CRCs[i]);
Encoder->WriteBytes(m_TempArray, outStreamTemp.GetPos(), outStreamTemp.GetCurByte());
HRESULT res = S_OK;
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
if (Encoder->MtMode)
{
UInt32 blockIndex = m_BlockIndex + 1;
@@ -719,13 +719,13 @@ void CEncoder::WriteBytes(const Byte *data, UInt32 sizeInBits, Byte lastByte)
HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
{
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
Progress = progress;
RINOK(Create());
for (UInt32 t = 0; t < NumThreads; t++)
#endif
{
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
CThreadInfo &ti = ThreadsInfo[t];
if (MtMode)
{
@@ -760,7 +760,7 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
CFlusher flusher(this);
CombinedCrc.Init();
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
NextBlockIndex = 0;
StreamWasFinished = false;
CloseThreads = false;
@@ -772,7 +772,7 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
WriteByte(kArSig2);
WriteByte((Byte)(kArSig3 + m_BlockSizeMult));
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
if (MtMode)
{
@@ -795,7 +795,7 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *
for (;;)
{
CThreadInfo &ti =
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
ThreadsInfo[0];
#else
ThreadsInfo;
@@ -866,7 +866,7 @@ HRESULT CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *p
}
case NCoderPropID::kNumThreads:
{
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
if (prop.vt != VT_UI4)
return E_INVALIDARG;
NumThreads = prop.ulVal;
@@ -882,7 +882,7 @@ HRESULT CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *p
return S_OK;
}
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
STDMETHODIMP CEncoder::SetNumberOfThreads(UInt32 numThreads)
{
NumThreads = numThreads;
+8 -8
View File
@@ -6,7 +6,7 @@
#include "../../Common/Defs.h"
#include "../../Common/MyCom.h"
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
#include "../../Windows/Synchronization.h"
#include "../../Windows/Thread.h"
#endif
@@ -120,7 +120,7 @@ private:
public:
bool m_OptimizeNumTables;
CEncoder *Encoder;
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
NWindows::CThread Thread;
NWindows::NSynchronization::CAutoResetEvent StreamWasFinishedEvent;
@@ -148,7 +148,7 @@ public:
class CEncoder :
public ICompressCoder,
public ICompressSetCoderProperties,
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
public ICompressSetCoderMt,
#endif
public CMyUnknownImp
@@ -166,7 +166,7 @@ public:
UInt32 NumPasses;
CBZip2CombinedCrc CombinedCrc;
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
CThreadInfo *ThreadsInfo;
NWindows::NSynchronization::CManualResetEvent CanProcessEvent;
NWindows::NSynchronization::CCriticalSection CS;
@@ -192,14 +192,14 @@ public:
void WriteBit(bool v);
void WriteCrc(UInt32 v);
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
HRESULT Create();
void Free();
#endif
public:
CEncoder();
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
~CEncoder();
#endif
@@ -222,7 +222,7 @@ public:
}
};
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
MY_UNKNOWN_IMP2(ICompressSetCoderMt, ICompressSetCoderProperties)
#else
MY_UNKNOWN_IMP1(ICompressSetCoderProperties)
@@ -235,7 +235,7 @@ public:
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
#ifdef COMPRESS_BZIP2_MT
#ifndef _7ZIP_ST
STDMETHOD(SetNumberOfThreads)(UInt32 numThreads);
#endif
};
+8 -9
View File
@@ -7,10 +7,9 @@
namespace NBitl {
const int kNumBigValueBits = 8 * 4;
const int kNumValueBytes = 3;
const int kNumValueBits = 8 * kNumValueBytes;
const unsigned kNumBigValueBits = 8 * 4;
const unsigned kNumValueBytes = 3;
const unsigned kNumValueBits = 8 * kNumValueBytes;
const UInt32 kMask = (1 << kNumValueBits) - 1;
@@ -20,7 +19,7 @@ template<class TInByte>
class CBaseDecoder
{
protected:
int m_BitPos;
unsigned m_BitPos;
UInt32 m_Value;
TInByte m_Stream;
public:
@@ -51,7 +50,7 @@ public:
}
}
UInt32 ReadBits(int numBits)
UInt32 ReadBits(unsigned numBits)
{
Normalize();
UInt32 res = m_Value & ((1 << numBits) - 1);
@@ -95,19 +94,19 @@ public:
}
}
UInt32 GetValue(int numBits)
UInt32 GetValue(unsigned numBits)
{
Normalize();
return ((this->m_Value >> (8 - this->m_BitPos)) & kMask) >> (kNumValueBits - numBits);
}
void MovePos(int numBits)
void MovePos(unsigned numBits)
{
this->m_BitPos += numBits;
m_NormalValue >>= numBits;
}
UInt32 ReadBits(int numBits)
UInt32 ReadBits(unsigned numBits)
{
Normalize();
UInt32 res = m_NormalValue & ((1 << numBits) - 1);
+6 -9
View File
@@ -8,12 +8,14 @@
class CBitlEncoder
{
COutBuffer m_Stream;
int m_BitPos;
unsigned m_BitPos;
Byte m_CurByte;
public:
bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
void SetStream(ISequentialOutStream *outStream) { m_Stream.SetStream(outStream); }
void ReleaseStream() { m_Stream.ReleaseStream(); }
UInt32 GetBitPosition() const { return (8 - m_BitPos); }
UInt64 GetProcessedSize() const { return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) /8; }
void Init()
{
m_Stream.Init();
@@ -25,18 +27,16 @@ public:
FlushByte();
return m_Stream.Flush();
}
void FlushByte()
{
if(m_BitPos < 8)
if (m_BitPos < 8)
m_Stream.WriteByte(m_CurByte);
m_BitPos = 8;
m_CurByte = 0;
}
void WriteBits(UInt32 value, int numBits)
void WriteBits(UInt32 value, unsigned numBits)
{
while(numBits > 0)
while (numBits > 0)
{
if (numBits < m_BitPos)
{
@@ -51,9 +51,6 @@ public:
m_CurByte = 0;
}
}
UInt32 GetBitPosition() const { return (8 - m_BitPos); }
UInt64 GetProcessedSize() const {
return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) /8; }
void WriteByte(Byte b) { m_Stream.WriteByte(b);}
};
+7 -7
View File
@@ -7,16 +7,16 @@
namespace NBitm {
const int kNumBigValueBits = 8 * 4;
const int kNumValueBytes = 3;
const int kNumValueBits = 8 * kNumValueBytes;
const unsigned kNumBigValueBits = 8 * 4;
const unsigned kNumValueBytes = 3;
const unsigned kNumValueBits = 8 * kNumValueBytes;
const UInt32 kMask = (1 << kNumValueBits) - 1;
template<class TInByte>
class CDecoder
{
UInt32 m_BitPos;
unsigned m_BitPos;
UInt32 m_Value;
public:
TInByte m_Stream;
@@ -39,19 +39,19 @@ public:
m_Value = (m_Value << 8) | m_Stream.ReadByte();
}
UInt32 GetValue(UInt32 numBits) const
UInt32 GetValue(unsigned numBits) const
{
// return (m_Value << m_BitPos) >> (kNumBigValueBits - numBits);
return ((m_Value >> (8 - m_BitPos)) & kMask) >> (kNumValueBits - numBits);
}
void MovePos(UInt32 numBits)
void MovePos(unsigned numBits)
{
m_BitPos += numBits;
Normalize();
}
UInt32 ReadBits(UInt32 numBits)
UInt32 ReadBits(unsigned numBits)
{
UInt32 res = GetValue(numBits);
MovePos(numBits);
+5 -7
View File
@@ -9,12 +9,13 @@ template<class TOutByte>
class CBitmEncoder
{
TOutByte m_Stream;
int m_BitPos;
unsigned m_BitPos;
Byte m_CurByte;
public:
bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
void SetStream(ISequentialOutStream *outStream) { m_Stream.SetStream(outStream);}
void ReleaseStream() { m_Stream.ReleaseStream(); }
UInt64 GetProcessedSize() const { return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) / 8; }
void Init()
{
m_Stream.Init();
@@ -23,14 +24,13 @@ public:
}
HRESULT Flush()
{
if(m_BitPos < 8)
if (m_BitPos < 8)
WriteBits(0, m_BitPos);
return m_Stream.Flush();
}
void WriteBits(UInt32 value, int numBits)
void WriteBits(UInt32 value, unsigned numBits)
{
while(numBits > 0)
while (numBits > 0)
{
if (numBits < m_BitPos)
{
@@ -45,8 +45,6 @@ public:
m_CurByte = 0;
}
}
UInt64 GetProcessedSize() const {
return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) / 8; }
};
#endif
+7 -1
View File
@@ -19,7 +19,13 @@ void RegisterCodec(const CCodecInfo *codecInfo)
#ifdef _WIN32
extern "C"
BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/)
BOOL WINAPI DllMain(
#ifdef UNDER_CE
HANDLE
#else
HINSTANCE
#endif
, DWORD /* dwReason */, LPVOID /*lpReserved*/)
{
return TRUE;
}
@@ -1,20 +0,0 @@
// LzmaBenchCon.h
#ifndef __LZMABENCHCON_H
#define __LZMABENCHCON_H
#include <stdio.h>
#include "../../../Common/Types.h"
#ifdef EXTERNAL_LZMA
#include "../../UI/Common/LoadCodecs.h"
#endif
HRESULT LzmaBenchCon(
#ifdef EXTERNAL_LZMA
CCodecs *codecs,
#endif
FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary);
HRESULT CrcBenchCon(FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary);
#endif
+1 -1
View File
@@ -37,7 +37,7 @@ class CDecoder:
void SetOutStreamSizeResume(const UInt64 *outSize);
public:
MY_QUERYINTERFACE_BEGIN
MY_QUERYINTERFACE_BEGIN2(ICompressCoder)
MY_QUERYINTERFACE_ENTRY(ICompressSetDecoderProperties2)
#ifndef NO_READ_FROM_CODER
MY_QUERYINTERFACE_ENTRY(ICompressSetInStream)
+21 -21
View File
@@ -6,7 +6,7 @@
namespace NCompress {
namespace NLzx {
const int kNumHuffmanBits = 16;
const unsigned kNumHuffmanBits = 16;
const UInt32 kNumRepDistances = 3;
const UInt32 kNumLenSlots = 8;
@@ -14,7 +14,7 @@ const UInt32 kMatchMinLen = 2;
const UInt32 kNumLenSymbols = 249;
const UInt32 kMatchMaxLen = kMatchMinLen + (kNumLenSlots - 1) + kNumLenSymbols - 1;
const int kNumAlignBits = 3;
const unsigned kNumAlignBits = 3;
const UInt32 kAlignTableSize = 1 << kNumAlignBits;
const UInt32 kNumPosSlots = 50;
@@ -24,36 +24,36 @@ const UInt32 kMainTableSize = 256 + kNumPosLenSlots;
const UInt32 kLevelTableSize = 20;
const UInt32 kMaxTableSize = kMainTableSize;
const int kNumBlockTypeBits = 3;
const int kBlockTypeVerbatim = 1;
const int kBlockTypeAligned = 2;
const int kBlockTypeUncompressed = 3;
const unsigned kNumBlockTypeBits = 3;
const unsigned kBlockTypeVerbatim = 1;
const unsigned kBlockTypeAligned = 2;
const unsigned kBlockTypeUncompressed = 3;
const int kUncompressedBlockSizeNumBits = 24;
const unsigned kUncompressedBlockSizeNumBits = 24;
const int kNumBitsForPreTreeLevel = 4;
const unsigned kNumBitsForPreTreeLevel = 4;
const int kLevelSymbolZeros = 17;
const int kLevelSymbolZerosBig = 18;
const int kLevelSymbolSame = 19;
const unsigned kLevelSymbolZeros = 17;
const unsigned kLevelSymbolZerosBig = 18;
const unsigned kLevelSymbolSame = 19;
const int kLevelSymbolZerosStartValue = 4;
const int kLevelSymbolZerosNumBits = 4;
const unsigned kLevelSymbolZerosStartValue = 4;
const unsigned kLevelSymbolZerosNumBits = 4;
const int kLevelSymbolZerosBigStartValue = kLevelSymbolZerosStartValue +
const unsigned kLevelSymbolZerosBigStartValue = kLevelSymbolZerosStartValue +
(1 << kLevelSymbolZerosNumBits);
const int kLevelSymbolZerosBigNumBits = 5;
const unsigned kLevelSymbolZerosBigNumBits = 5;
const int kLevelSymbolSameNumBits = 1;
const int kLevelSymbolSameStartValue = 4;
const unsigned kLevelSymbolSameNumBits = 1;
const unsigned kLevelSymbolSameStartValue = 4;
const int kNumBitsForAlignLevel = 3;
const unsigned kNumBitsForAlignLevel = 3;
const int kNumDictionaryBitsMin = 15;
const int kNumDictionaryBitsMax = 21;
const unsigned kNumDictionaryBitsMin = 15;
const unsigned kNumDictionaryBitsMax = 21;
const UInt32 kDictionarySizeMax = (1 << kNumDictionaryBitsMax);
const int kNumLinearPosSlotBits = 17;
const unsigned kNumLinearPosSlotBits = 17;
const UInt32 kNumPowerPosSlots = 0x26;
}}
+18 -18
View File
@@ -33,7 +33,7 @@ STDMETHODIMP CDecoder::Flush()
return m_x86ConvertOutStreamSpec->Flush();
}
UInt32 CDecoder::ReadBits(int numBits) { return m_InBitStream.ReadBits(numBits); }
UInt32 CDecoder::ReadBits(unsigned numBits) { return m_InBitStream.ReadBits(numBits); }
#define RIF(x) { if (!(x)) return false; }
@@ -44,7 +44,7 @@ bool CDecoder::ReadTable(Byte *lastLevels, Byte *newLevels, UInt32 numSymbols)
for (i = 0; i < kLevelTableSize; i++)
levelLevels[i] = (Byte)ReadBits(kNumBitsForPreTreeLevel);
RIF(m_LevelDecoder.SetCodeLengths(levelLevels));
int num = 0;
unsigned num = 0;
Byte symbol = 0;
for (i = 0; i < numSymbols;)
{
@@ -58,12 +58,12 @@ bool CDecoder::ReadTable(Byte *lastLevels, Byte *newLevels, UInt32 numSymbols)
UInt32 number = m_LevelDecoder.DecodeSymbol(&m_InBitStream);
if (number == kLevelSymbolZeros)
{
num = kLevelSymbolZerosStartValue + (int)ReadBits(kLevelSymbolZerosNumBits);
num = kLevelSymbolZerosStartValue + (unsigned)ReadBits(kLevelSymbolZerosNumBits);
symbol = 0;
}
else if (number == kLevelSymbolZerosBig)
{
num = kLevelSymbolZerosBigStartValue + (int)ReadBits(kLevelSymbolZerosBigNumBits);
num = kLevelSymbolZerosBigStartValue + (unsigned)ReadBits(kLevelSymbolZerosBigNumBits);
symbol = 0;
}
else if (number == kLevelSymbolSame || number <= kNumHuffmanBits)
@@ -72,7 +72,7 @@ bool CDecoder::ReadTable(Byte *lastLevels, Byte *newLevels, UInt32 numSymbols)
num = 1;
else
{
num = kLevelSymbolSameStartValue + (int)ReadBits(kLevelSymbolSameNumBits);
num = kLevelSymbolSameStartValue + (unsigned)ReadBits(kLevelSymbolSameNumBits);
number = m_LevelDecoder.DecodeSymbol(&m_InBitStream);
if (number > kNumHuffmanBits)
return false;
@@ -93,7 +93,7 @@ bool CDecoder::ReadTables(void)
m_InBitStream.DirectReadByte();
m_InBitStream.Normalize();
int blockType = (int)ReadBits(kNumBlockTypeBits);
unsigned blockType = (unsigned)ReadBits(kNumBlockTypeBits);
if (blockType > kBlockTypeUncompressed)
return false;
if (_wimMode)
@@ -114,10 +114,10 @@ bool CDecoder::ReadTables(void)
if (!m_InBitStream.ReadUInt32(m_RepDistances[0]))
return false;
m_RepDistances[0]--;
for (int i = 1; i < kNumRepDistances; i++)
for (unsigned i = 1; i < kNumRepDistances; i++)
{
UInt32 rep = 0;
for (int j = 0; j < 4; j++)
for (unsigned j = 0; j < 4; j++)
rep |= (UInt32)m_InBitStream.DirectReadByte() << (8 * j);
m_RepDistances[i] = rep - 1;
}
@@ -126,7 +126,7 @@ bool CDecoder::ReadTables(void)
m_AlignIsUsed = (blockType == kBlockTypeAligned);
if (m_AlignIsUsed)
{
for(int i = 0; i < kAlignTableSize; i++)
for (unsigned i = 0; i < kAlignTableSize; i++)
newLevels[i] = (Byte)ReadBits(kNumBitsForAlignLevel);
RIF(m_AlignDecoder.SetCodeLengths(newLevels));
}
@@ -159,7 +159,7 @@ public:
void CDecoder::ClearPrevLevels()
{
int i;
unsigned i;
for (i = 0; i < kMainTableSize; i++)
m_LastMainLevels[i] = 0;
for (i = 0; i < kNumLenSymbols; i++)
@@ -193,19 +193,19 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
}
m_x86ConvertOutStreamSpec->Init(translationMode, i86TranslationSize);
for(int i = 0 ; i < kNumRepDistances; i++)
for (unsigned i = 0 ; i < kNumRepDistances; i++)
m_RepDistances[i] = 0;
}
}
while(_remainLen > 0 && curSize > 0)
while (_remainLen > 0 && curSize > 0)
{
m_OutWindowStream.PutByte(m_OutWindowStream.GetByte(m_RepDistances[0]));
_remainLen--;
curSize--;
}
while(curSize > 0)
while (curSize > 0)
{
if (m_UnCompressedBlockSize == 0)
if (!ReadTables())
@@ -215,13 +215,13 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
m_UnCompressedBlockSize -= next;
if (m_IsUncompressedBlock)
{
while(next > 0)
while (next > 0)
{
m_OutWindowStream.PutByte(m_InBitStream.DirectReadByte());
next--;
}
}
else while(next > 0)
else while (next > 0)
{
UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream);
if (number < 256)
@@ -254,10 +254,10 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
else
{
UInt32 distance;
int numDirectBits;
unsigned numDirectBits;
if (posSlot < kNumPowerPosSlots)
{
numDirectBits = (int)(posSlot >> 1) - 1;
numDirectBits = (unsigned)(posSlot >> 1) - 1;
distance = ((2 | (posSlot & 1)) << numDirectBits);
}
else
@@ -365,7 +365,7 @@ STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
return S_OK;
}
HRESULT CDecoder::SetParams(int numDictBits)
HRESULT CDecoder::SetParams(unsigned numDictBits)
{
if (numDictBits < kNumDictionaryBitsMin || numDictBits > kNumDictionaryBitsMax)
return E_INVALIDARG;
+16 -18
View File
@@ -17,15 +17,15 @@ namespace NLzx {
namespace NBitStream {
const int kNumBigValueBits = 8 * 4;
const int kNumValueBits = 17;
const unsigned kNumBigValueBits = 8 * 4;
const unsigned kNumValueBits = 17;
const UInt32 kBitDecoderValueMask = (1 << kNumValueBits) - 1;
class CDecoder
{
CInBuffer m_Stream;
UInt32 m_Value;
int m_BitPos;
unsigned m_BitPos;
public:
CDecoder() {}
bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
@@ -39,14 +39,13 @@ public:
m_BitPos = kNumBigValueBits;
}
UInt64 GetProcessedSize() const
{ return m_Stream.GetProcessedSize() - (kNumBigValueBits - m_BitPos) / 8; }
UInt64 GetProcessedSize() const { return m_Stream.GetProcessedSize() - (kNumBigValueBits - m_BitPos) / 8; }
int GetBitPosition() const { return m_BitPos & 0xF; }
unsigned GetBitPosition() const { return m_BitPos & 0xF; }
void Normalize()
{
for (;m_BitPos >= 16; m_BitPos -= 16)
for (; m_BitPos >= 16; m_BitPos -= 16)
{
Byte b0 = m_Stream.ReadByte();
Byte b1 = m_Stream.ReadByte();
@@ -55,29 +54,28 @@ public:
}
}
UInt32 GetValue(int numBits) const
UInt32 GetValue(unsigned numBits) const
{
return ((m_Value >> ((32 - kNumValueBits) - m_BitPos)) & kBitDecoderValueMask) >>
(kNumValueBits - numBits);
return ((m_Value >> ((32 - kNumValueBits) - m_BitPos)) & kBitDecoderValueMask) >> (kNumValueBits - numBits);
}
void MovePos(UInt32 numBits)
void MovePos(unsigned numBits)
{
m_BitPos += (int)numBits;
m_BitPos += numBits;
Normalize();
}
UInt32 ReadBits(int numBits)
UInt32 ReadBits(unsigned numBits)
{
UInt32 res = GetValue(numBits);
MovePos(numBits);
return res;
}
UInt32 ReadBitsBig(int numBits)
UInt32 ReadBitsBig(unsigned numBits)
{
int numBits0 = numBits / 2;
int numBits1 = numBits - numBits0;
unsigned numBits0 = numBits / 2;
unsigned numBits1 = numBits - numBits0;
UInt32 res = ReadBits(numBits0) << numBits1;
return res + ReadBits(numBits1);
}
@@ -128,7 +126,7 @@ class CDecoder :
bool _wimMode;
UInt32 ReadBits(int numBits);
UInt32 ReadBits(unsigned numBits);
bool ReadTable(Byte *lastLevels, Byte *newLevels, UInt32 numSymbols);
bool ReadTables();
void ClearPrevLevels();
@@ -152,7 +150,7 @@ public:
STDMETHOD(ReleaseInStream)();
STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
HRESULT SetParams(int numDictBits);
HRESULT SetParams(unsigned numDictBits);
void SetKeepHistory(bool keepHistory) { _keepHistory = keepHistory; }
};
+20 -16
View File
@@ -9,19 +9,23 @@
namespace NCompress {
namespace NQuantum {
// const UInt32 kDictionarySizeMax = (1 << 21);
static const int kLenIdNeedInit = -2;
const int kLenIdNeedInit = -2;
static const unsigned kNumLenSymbols = 27;
static const unsigned kMatchMinLen = 3;
static const unsigned kNumSimplePosSlots = 4;
static const unsigned kNumSimpleLenSlots = 6;
void CDecoder::Init()
{
m_Selector.Init(kNumSelectors);
for (unsigned int i = 0; i < kNumLitSelectors; i++)
unsigned i;
for (i = 0; i < kNumLitSelectors; i++)
m_Literals[i].Init(kNumLitSymbols);
unsigned int numItems = _numDictBits << 1;
m_PosSlot[0].Init(MyMin(numItems, kNumLen3PosSymbolsMax));
m_PosSlot[1].Init(MyMin(numItems, kNumLen4PosSymbolsMax));
m_PosSlot[2].Init(MyMin(numItems, kNumLen5PosSymbolsMax));
unsigned numItems = (_numDictBits == 0 ? 1 : (_numDictBits << 1));
const unsigned kNumPosSymbolsMax[kNumMatchSelectors] = { 24, 36, 42 };
for (i = 0; i < kNumMatchSelectors; i++)
m_PosSlot[i].Init(MyMin(numItems, kNumPosSymbolsMax[i]));
m_LenSlot.Init(kNumLenSymbols);
}
@@ -31,7 +35,7 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
{
if (!_keepHistory)
{
if (!_outWindowStream.Create(_dictionarySize))
if (!_outWindowStream.Create((UInt32)1 << _numDictBits))
return E_OUTOFMEMORY;
Init();
}
@@ -43,7 +47,7 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
if (curSize == 0)
return S_OK;
while(_remainLen > 0 && curSize > 0)
while (_remainLen > 0 && curSize > 0)
{
_remainLen--;
Byte b = _outWindowStream.GetByte(_rep0);
@@ -51,12 +55,12 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
curSize--;
}
while(curSize > 0)
while (curSize > 0)
{
if (_rangeDecoder.Stream.WasFinished())
return S_FALSE;
unsigned int selector = m_Selector.Decode(&_rangeDecoder);
unsigned selector = m_Selector.Decode(&_rangeDecoder);
if (selector < kNumLitSelectors)
{
Byte b = (Byte)((selector << (8 - kNumLitSelectorBits)) + m_Literals[selector].Decode(&_rangeDecoder));
@@ -66,10 +70,10 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
else
{
selector -= kNumLitSelectors;
unsigned int len = selector + kMatchMinLen;
unsigned len = selector + kMatchMinLen;
if (selector == 2)
{
unsigned int lenSlot = m_LenSlot.Decode(&_rangeDecoder);;
unsigned lenSlot = m_LenSlot.Decode(&_rangeDecoder);
if (lenSlot >= kNumSimpleLenSlots)
{
lenSlot -= 2;
@@ -81,15 +85,15 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
else
len += lenSlot;
}
UInt32 rep0 = m_PosSlot[selector].Decode(&_rangeDecoder);;
UInt32 rep0 = m_PosSlot[selector].Decode(&_rangeDecoder);
if (rep0 >= kNumSimplePosSlots)
{
int numDirectBits = (int)((rep0 >> 1) - 1);
rep0 = ((2 | (rep0 & 1)) << numDirectBits) + _rangeDecoder.Stream.ReadBits(numDirectBits);
}
unsigned int locLen = len;
unsigned locLen = len;
if (len > curSize)
locLen = (unsigned int)curSize;
locLen = (unsigned)curSize;
if (!_outWindowStream.CopyBlock(rep0, locLen))
return S_FALSE;
curSize -= locLen;
+38 -61
View File
@@ -16,30 +16,30 @@ namespace NQuantum {
class CStreamBitDecoder
{
UInt32 m_Value;
CInBuffer m_Stream;
UInt32 Value;
CInBuffer Stream;
public:
bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream);}
void ReleaseStream() { m_Stream.ReleaseStream();}
bool Create(UInt32 bufferSize) { return Stream.Create(bufferSize); }
void SetStream(ISequentialInStream *stream) { Stream.SetStream(stream); }
void ReleaseStream() { Stream.ReleaseStream(); }
void Finish() { m_Value = 0x10000; }
void Finish() { Value = 0x10000; }
void Init()
{
m_Stream.Init();
m_Value = 0x10000;
Stream.Init();
Value = 0x10000;
}
UInt64 GetProcessedSize() const { return m_Stream.GetProcessedSize(); }
bool WasFinished() const { return m_Stream.WasFinished(); };
UInt64 GetProcessedSize() const { return Stream.GetProcessedSize(); }
bool WasFinished() const { return Stream.WasFinished(); }
UInt32 ReadBit()
{
if (m_Value >= 0x10000)
m_Value = 0x100 | m_Stream.ReadByte();
UInt32 res = (m_Value >> 7) & 1;
m_Value <<= 1;
if (Value >= 0x10000)
Value = 0x100 | Stream.ReadByte();
UInt32 res = (Value >> 7) & 1;
Value <<= 1;
return res;
}
@@ -48,26 +48,17 @@ public:
UInt32 res = 0;
do
res = (res << 1) | ReadBit();
while(--numBits != 0);
while (--numBits != 0);
return res;
}
};
const int kNumLitSelectorBits = 2;
const unsigned int kNumLitSelectors = (1 << kNumLitSelectorBits);
const unsigned int kNumLitSymbols = 1 << (8 - kNumLitSelectorBits);
const unsigned int kNumMatchSelectors = 3;
const unsigned int kNumSelectors = kNumLitSelectors + kNumMatchSelectors;
const unsigned int kNumLen3PosSymbolsMax = 24;
const unsigned int kNumLen4PosSymbolsMax = 36;
const unsigned int kNumLen5PosSymbolsMax = 42;
const unsigned int kNumLenSymbols = 27;
const unsigned int kNumSymbolsMax = kNumLitSymbols; // 64
const unsigned int kMatchMinLen = 3;
const unsigned int kNumSimplePosSlots = 4;
const unsigned int kNumSimpleLenSlots = 6;
const unsigned kNumLitSelectorBits = 2;
const unsigned kNumLitSelectors = (1 << kNumLitSelectorBits);
const unsigned kNumLitSymbols = 1 << (8 - kNumLitSelectorBits);
const unsigned kNumMatchSelectors = 3;
const unsigned kNumSelectors = kNumLitSelectors + kNumMatchSelectors;
const unsigned kNumSymbolsMax = kNumLitSymbols; // 64
namespace NRangeCoder {
@@ -135,16 +126,16 @@ const UInt16 kReorderCount = 50;
class CModelDecoder
{
unsigned int NumItems;
unsigned int ReorderCount;
unsigned NumItems;
unsigned ReorderCount;
UInt16 Freqs[kNumSymbolsMax + 1];
Byte Values[kNumSymbolsMax];
public:
void Init(unsigned int numItems)
void Init(unsigned numItems)
{
NumItems = numItems;
ReorderCount = kReorderCountStart;
for(unsigned int i = 0; i < numItems; i++)
for (unsigned i = 0; i < numItems; i++)
{
Freqs[i] = (UInt16)(numItems - i);
Values[i] = (Byte)i;
@@ -152,26 +143,26 @@ public:
Freqs[numItems] = 0;
}
unsigned int Decode(CDecoder *rangeDecoder)
unsigned Decode(CDecoder *rangeDecoder)
{
UInt32 threshold = rangeDecoder->GetThreshold(Freqs[0]);
unsigned int i;
unsigned i;
for (i = 1; Freqs[i] > threshold; i++);
rangeDecoder->Decode(Freqs[i], Freqs[i - 1], Freqs[0]);
unsigned int res = Values[--i];
unsigned res = Values[--i];
do
Freqs[i] += kUpdateStep;
while(i-- != 0);
while (i-- != 0);
if (Freqs[0] > kFreqSumMax)
{
if (--ReorderCount == 0)
{
ReorderCount = kReorderCount;
for(i = 0; i < NumItems; i++)
for (i = 0; i < NumItems; i++)
Freqs[i] = (UInt16)(((Freqs[i] - Freqs[i + 1]) + 1) >> 1);
for(i = 0; i < NumItems - 1; i++)
for(unsigned int j = i + 1; j < NumItems; j++)
for (i = 0; i < NumItems - 1; i++)
for (unsigned j = i + 1; j < NumItems; j++)
if (Freqs[i] < Freqs[j])
{
UInt16 tmpFreq = Freqs[i];
@@ -183,7 +174,7 @@ public:
}
do
Freqs[i] = (UInt16)(Freqs[i] + Freqs[i + 1]);
while(i-- != 0);
while (i-- != 0);
}
else
{
@@ -194,11 +185,11 @@ public:
if (Freqs[i] <= Freqs[i + 1])
Freqs[i] = (UInt16)(Freqs[i + 1] + 1);
}
while(i-- != 0);
while (i-- != 0);
}
}
return res;
};
}
};
}
@@ -212,23 +203,17 @@ class CDecoder:
CLzOutWindow _outWindowStream;
NRangeCoder::CDecoder _rangeDecoder;
///////////////////
// State
UInt64 _outSize;
// UInt64 _nowPos64;
int _remainLen; // -1 means end of stream. // -2 means need Init
UInt32 _rep0;
int _numDictBits;
UInt32 _dictionarySize;
bool _keepHistory;
NRangeCoder::CModelDecoder m_Selector;
NRangeCoder::CModelDecoder m_Literals[kNumLitSelectors];
NRangeCoder::CModelDecoder m_PosSlot[kNumMatchSelectors];
NRangeCoder::CModelDecoder m_LenSlot;
bool _keepHistory;
void Init();
HRESULT CodeSpec(UInt32 size);
public:
@@ -268,16 +253,8 @@ public:
STDMETHOD(ReleaseInStream)();
STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
void SetParams(int numDictBits)
{
_numDictBits = numDictBits;
_dictionarySize = (UInt32)1 << numDictBits;
}
void SetKeepHistory(bool keepHistory)
{
_keepHistory = keepHistory;
}
void SetParams(int numDictBits) { _numDictBits = numDictBits; }
void SetKeepHistory(bool keepHistory) { _keepHistory = keepHistory; }
CDecoder(): _keepHistory(false) {}
virtual ~CDecoder() {}
};
+2
View File
@@ -42,6 +42,8 @@ UInt32 CDecoder::ReadBits(int numBits) { return m_InBitStream.ReadBits(numBits);
HRESULT CDecoder::CopyBlock(UInt32 distance, UInt32 len)
{
if (len == 0)
return S_FALSE;
m_UnpackSize -= len;
return m_OutWindowStream.CopyBlock(distance, len) ? S_OK : S_FALSE;
}
+2
View File
@@ -256,6 +256,8 @@ bool CDecoder::DecodeLz(Int32 pos)
else if (number == kRepBothNumber)
{
length = m_LastLength;
if (length == 0)
return false;
distance = m_RepDists[(m_RepDistPtr + 4 - 1) & 3];
}
else if (number < kLen2Number)
+3 -2
View File
@@ -623,8 +623,7 @@ HRESULT CDecoder::DecodeLZ(bool &keepDecompressing)
UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream);
if (number < 256)
{
PutByte(Byte(number));
PutByte((Byte)number);
continue;
}
else if (number == kSymbolReadTable)
@@ -640,6 +639,8 @@ HRESULT CDecoder::DecodeLZ(bool &keepDecompressing)
}
else if (number == 258)
{
if (length == 0)
return S_FALSE;
}
else if (number < kSymbolRep + 4)
{
+6 -13
View File
@@ -1,15 +1,8 @@
!IFNDEF CPU
$O\7zCrcT8U.obj: ../../../../Asm/x86/$(*B).asm
$(COMPL_ASM)
$O\7zCrcT8.obj: ../../../../C/$(*B).c
$(COMPL_O2)
!ELSE IF "$(CPU)" == "AMD64"
$O\7zCrcT8U.obj: ../../../../Asm/x64/$(*B).asm
$(COMPL_ASM)
$O\7zCrcT8.obj: ../../../../C/$(*B).c
$(COMPL_O2)
C_OBJS = $(C_OBJS) \
$O\7zCrc.obj
!IF "$(CPU)" == "IA64" || "$(CPU)" == "MIPS"
C_OBJS = $(C_OBJS) \
!ELSE
$(CRC_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
ASM_OBJS = $(ASM_OBJS) \
!ENDIF
$O\7zCrcOpt.obj
-7
View File
@@ -1,7 +0,0 @@
CRC_OBJS = \
!IF "$(CPU)" != "IA64" && "$(CPU)" != "ARM"
$O\7zCrcT8U.obj \
$O\7zCrcT8.obj \
!ELSE
$O\7zCrc.obj \
!ENDIF
+2 -2
View File
@@ -47,7 +47,7 @@ void CKeyInfo::CalculateDigest()
{
CSha256 sha;
Sha256_Init(&sha);
const UInt64 numRounds = UInt64(1) << (NumCyclesPower);
const UInt64 numRounds = (UInt64)1 << NumCyclesPower;
Byte temp[8] = { 0,0,0,0,0,0,0,0 };
for (UInt64 round = 0; round < numRounds; round++)
{
@@ -206,7 +206,7 @@ STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
_key.Salt[i] = data[pos++];
for (i = 0; i < ivSize; i++)
_iv[i] = data[pos++];
return S_OK;
return (_key.NumCyclesPower <= 24) ? S_OK : E_NOTIMPL;
}
STDMETHODIMP CBaseCoder::CryptoSetPassword(const Byte *data, UInt32 size)
+21 -30
View File
@@ -8,50 +8,41 @@ namespace NCrypto {
struct CAesTabInit { CAesTabInit() { AesGenTables();} } g_AesTabInit;
STDMETHODIMP CAesCbcEncoder::Init() { return S_OK; }
STDMETHODIMP_(UInt32) CAesCbcEncoder::Filter(Byte *data, UInt32 size)
CAesCbcCoder::CAesCbcCoder()
{
return (UInt32)AesCbc_Encode(&Aes, data, size);
_offset = ((0 - (unsigned)(ptrdiff_t)_aes) & 0xF) / sizeof(UInt32);
}
STDMETHODIMP CAesCbcEncoder::SetKey(const Byte *data, UInt32 size)
STDMETHODIMP CAesCbcCoder::Init() { return S_OK; }
STDMETHODIMP_(UInt32) CAesCbcCoder::Filter(Byte *data, UInt32 size)
{
if (size == 0)
return 0;
if (size < AES_BLOCK_SIZE)
return AES_BLOCK_SIZE;
size >>= 4;
_codeFunc(_aes + _offset, data, size);
return size << 4;
}
STDMETHODIMP CAesCbcCoder::SetKey(const Byte *data, UInt32 size)
{
if ((size & 0x7) != 0 || size < 16 || size > 32)
return E_INVALIDARG;
Aes_SetKeyEncode(&Aes.aes, data, size);
_setKeyFunc(_aes + _offset + 4, data, size);
return S_OK;
}
STDMETHODIMP CAesCbcEncoder::SetInitVector(const Byte *data, UInt32 size)
STDMETHODIMP CAesCbcCoder::SetInitVector(const Byte *data, UInt32 size)
{
if (size != AES_BLOCK_SIZE)
return E_INVALIDARG;
AesCbc_Init(&Aes, data);
AesCbc_Init(_aes + _offset, data);
return S_OK;
}
STDMETHODIMP CAesCbcDecoder::Init() { return S_OK; }
STDMETHODIMP_(UInt32) CAesCbcDecoder::Filter(Byte *data, UInt32 size)
{
return (UInt32)AesCbc_Decode(&Aes, data, size);
}
STDMETHODIMP CAesCbcDecoder::SetKey(const Byte *data, UInt32 size)
{
if ((size & 0x7) != 0 || size < 16 || size > 32)
return E_INVALIDARG;
Aes_SetKeyDecode(&Aes.aes, data, size);
return S_OK;
}
STDMETHODIMP CAesCbcDecoder::SetInitVector(const Byte *data, UInt32 size)
{
if (size != AES_BLOCK_SIZE)
return E_INVALIDARG;
AesCbc_Init(&Aes, data);
return S_OK;
}
CAesCbcEncoder::CAesCbcEncoder() { _codeFunc = g_AesCbc_Encode; _setKeyFunc = Aes_SetKey_Enc; }
CAesCbcDecoder::CAesCbcDecoder() { _codeFunc = g_AesCbc_Decode; _setKeyFunc = Aes_SetKey_Dec; }
}
+9 -16
View File
@@ -6,19 +6,23 @@
#include "../../../C/Aes.h"
#include "../../Common/MyCom.h"
#include "../../Common/Types.h"
#include "../ICoder.h"
namespace NCrypto {
class CAesCbcEncoder:
class CAesCbcCoder:
public ICompressFilter,
public ICryptoProperties,
public CMyUnknownImp
{
CAesCbc Aes;
protected:
AES_CODE_FUNC _codeFunc;
AES_SET_KEY_FUNC _setKeyFunc;
unsigned _offset;
UInt32 _aes[AES_NUM_IVMRK_WORDS + 3];
public:
CAesCbcCoder();
MY_UNKNOWN_IMP1(ICryptoProperties)
STDMETHOD(Init)();
STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
@@ -26,19 +30,8 @@ public:
STDMETHOD(SetInitVector)(const Byte *data, UInt32 size);
};
class CAesCbcDecoder:
public ICompressFilter,
public ICryptoProperties,
public CMyUnknownImp
{
CAesCbc Aes;
public:
MY_UNKNOWN_IMP1(ICryptoProperties)
STDMETHOD(Init)();
STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
STDMETHOD(SetKey)(const Byte *data, UInt32 size);
STDMETHOD(SetInitVector)(const Byte *data, UInt32 size);
};
struct CAesCbcEncoder: public CAesCbcCoder { CAesCbcEncoder(); };
struct CAesCbcDecoder: public CAesCbcCoder { CAesCbcDecoder(); };
}
+13 -18
View File
@@ -33,7 +33,7 @@ STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
same = true;
if (_thereIsSalt)
{
for (int i = 0; i < sizeof(_salt); i++)
for (unsigned i = 0; i < sizeof(_salt); i++)
if (_salt[i] != data[i])
{
same = false;
@@ -41,14 +41,14 @@ STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
}
}
}
for (int i = 0; i < sizeof(_salt); i++)
for (unsigned i = 0; i < sizeof(_salt); i++)
_salt[i] = data[i];
if (!_needCalculate && !same)
_needCalculate = true;
return S_OK;
}
static const int kMaxPasswordLength = 127 * 2;
static const unsigned kMaxPasswordLength = 127 * 2;
STDMETHODIMP CDecoder::CryptoSetPassword(const Byte *data, UInt32 size)
{
@@ -75,21 +75,16 @@ STDMETHODIMP CDecoder::CryptoSetPassword(const Byte *data, UInt32 size)
STDMETHODIMP CDecoder::Init()
{
Calculate();
Aes_SetKeyDecode(&Aes.aes, aesKey, kRarAesKeySize);
AesCbc_Init(&Aes, aesInit);
SetKey(aesKey, kRarAesKeySize);
AesCbc_Init(_aes + _offset, _aesInit);
return S_OK;
}
STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
{
return (UInt32)AesCbc_Decode(&Aes, data, size);
}
void CDecoder::Calculate()
{
if (_needCalculate)
{
const int kSaltSize = 8;
const unsigned kSaltSize = 8;
Byte rawPassword[kMaxPasswordLength + kSaltSize];
@@ -106,20 +101,20 @@ void CDecoder::Calculate()
NSha1::CContext sha;
sha.Init();
// seems rar reverts hash for sha.
const int hashRounds = 0x40000;
int i;
for (i = 0; i < hashRounds; i++)
// rar reverts hash for sha.
const unsigned kNumRounds = (1 << 18);
unsigned i;
for (i = 0; i < kNumRounds; i++)
{
sha.Update(rawPassword, rawLength, _rar350Mode);
Byte pswNum[3] = { (Byte)i, (Byte)(i >> 8), (Byte)(i >> 16) };
sha.Update(pswNum, 3, _rar350Mode);
if (i % (hashRounds / 16) == 0)
if (i % (kNumRounds / 16) == 0)
{
NSha1::CContext shaTemp = sha;
Byte digest[NSha1::kDigestSize];
shaTemp.Final(digest);
aesInit[i / (hashRounds / 16)] = (Byte)digest[4 * 4 + 3];
_aesInit[i / (kNumRounds / 16)] = (Byte)digest[4 * 4 + 3];
}
}
/*
@@ -130,7 +125,7 @@ void CDecoder::Calculate()
Byte digest[20];
sha.Final(digest);
for (i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
for (unsigned j = 0; j < 4; j++)
aesKey[i * 4 + j] = (digest[i * 4 + 3 - j]);
}
_needCalculate = false;
+5 -17
View File
@@ -6,48 +6,36 @@
#include "../../../C/Aes.h"
#include "Common/Buffer.h"
#include "Common/MyCom.h"
#include "../ICoder.h"
#include "../IPassword.h"
#include "MyAes.h"
namespace NCrypto {
namespace NRar29 {
const UInt32 kRarAesKeySize = 16;
class CDecoder:
public ICompressFilter,
public CAesCbcDecoder,
public ICompressSetDecoderProperties2,
public ICryptoSetPassword,
public CMyUnknownImp
public ICryptoSetPassword
{
Byte _salt[8];
bool _thereIsSalt;
CByteBuffer buffer;
Byte aesKey[kRarAesKeySize];
Byte aesInit[AES_BLOCK_SIZE];
Byte _aesInit[AES_BLOCK_SIZE];
bool _needCalculate;
CAesCbc Aes;
bool _rar350Mode;
void Calculate();
public:
MY_UNKNOWN_IMP2(
ICryptoSetPassword,
ICompressSetDecoderProperties2)
STDMETHOD(Init)();
STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
STDMETHOD(CryptoSetPassword)(const Byte *aData, UInt32 aSize);
// ICompressSetDecoderProperties
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
CDecoder();
+61 -49
View File
@@ -21,7 +21,7 @@ Note: you must include MyAes.cpp to project to initialize AES tables
namespace NCrypto {
namespace NWzAes {
const unsigned int kAesKeySizeMax = 32;
const unsigned kAesKeySizeMax = 32;
static const UInt32 kNumKeyGenIterations = 1000;
@@ -34,36 +34,11 @@ STDMETHODIMP CBaseCoder::CryptoSetPassword(const Byte *data, UInt32 size)
return S_OK;
}
#define SetUi32(p, d) { UInt32 x = (d); (p)[0] = (Byte)x; (p)[1] = (Byte)(x >> 8); \
(p)[2] = (Byte)(x >> 16); (p)[3] = (Byte)(x >> 24); }
void CBaseCoder::EncryptData(Byte *data, UInt32 size)
{
unsigned int pos = _blockPos;
for (; size > 0; size--)
{
if (pos == AES_BLOCK_SIZE)
{
if (++_counter[0] == 0)
_counter[1]++;
UInt32 temp[4];
Aes_Encode32(&Aes, temp, _counter);
SetUi32(_buffer, temp[0]);
SetUi32(_buffer + 4, temp[1]);
SetUi32(_buffer + 8, temp[2]);
SetUi32(_buffer + 12, temp[3]);
pos = 0;
}
*data++ ^= _buffer[pos++];
}
_blockPos = pos;
}
#ifndef _NO_WZAES_OPTIMIZATIONS
static void BytesToBeUInt32s(const Byte *src, UInt32 *dest, int destSize)
static void BytesToBeUInt32s(const Byte *src, UInt32 *dest, unsigned destSize)
{
for (int i = 0 ; i < destSize; i++)
for (unsigned i = 0; i < destSize; i++)
dest[i] =
((UInt32)(src[i * 4 + 0]) << 24) |
((UInt32)(src[i * 4 + 1]) << 16) |
@@ -79,7 +54,7 @@ STDMETHODIMP CBaseCoder::Init()
UInt32 keysTotalSize = 2 * keySize + kPwdVerifCodeSize;
Byte buf[2 * kAesKeySizeMax + kPwdVerifCodeSize];
// for (int ii = 0; ii < 1000; ii++)
// for (unsigned ii = 0; ii < 1000; ii++)
{
#ifdef _NO_WZAES_OPTIMIZATIONS
@@ -109,23 +84,12 @@ STDMETHODIMP CBaseCoder::Init()
_hmac.SetKey(buf + keySize, keySize);
memcpy(_key.PwdVerifComputed, buf + 2 * keySize, kPwdVerifCodeSize);
_blockPos = AES_BLOCK_SIZE;
for (int i = 0; i < 4; i++)
_counter[i] = 0;
Aes_SetKeyEncode(&Aes, buf, keySize);
AesCtr2_Init(&_aes);
Aes_SetKey_Enc(_aes.aes + _aes.offset + 8, buf, keySize);
return S_OK;
}
/*
STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
{
Byte keySizeMode = 3;
return outStream->Write(&keySizeMode, 1, NULL);
}
*/
HRESULT CEncoder::WriteHeader(ISequentialOutStream *outStream)
{
UInt32 saltSize = _key.GetSaltSize();
@@ -147,11 +111,7 @@ STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
if (size != 1)
return E_INVALIDARG;
_key.Init();
Byte keySizeMode = data[0];
if (keySizeMode < 1 || keySizeMode > 3)
return E_INVALIDARG;
_key.KeySizeMode = keySizeMode;
return S_OK;
return SetKeyMode(data[0]) ? S_OK : E_INVALIDARG;
}
HRESULT CDecoder::ReadHeader(ISequentialInStream *inStream)
@@ -192,9 +152,61 @@ HRESULT CDecoder::CheckMac(ISequentialInStream *inStream, bool &isOK)
return S_OK;
}
CAesCtr2::CAesCtr2()
{
offset = ((0 - (unsigned)(ptrdiff_t)aes) & 0xF) / sizeof(UInt32);
}
void AesCtr2_Init(CAesCtr2 *p)
{
UInt32 *ctr = p->aes + p->offset + 4;
unsigned i;
for (i = 0; i < 4; i++)
ctr[i] = 0;
p->pos = AES_BLOCK_SIZE;
}
void AesCtr2_Code(CAesCtr2 *p, Byte *data, SizeT size)
{
unsigned pos = p->pos;
UInt32 *buf32 = p->aes + p->offset;
if (size == 0)
return;
if (pos != AES_BLOCK_SIZE)
{
const Byte *buf = (const Byte *)buf32;
do
*data++ ^= buf[pos++];
while (--size != 0 && pos != AES_BLOCK_SIZE);
}
if (size >= 16)
{
SizeT size2 = size >> 4;
g_AesCtr_Code(buf32 + 4, data, size2);
size2 <<= 4;
data += size2;
size -= size2;
pos = AES_BLOCK_SIZE;
}
if (size != 0)
{
unsigned j;
const Byte *buf;
for (j = 0; j < 4; j++)
buf32[j] = 0;
g_AesCtr_Code(buf32 + 4, (Byte *)buf32, 1);
buf = (const Byte *)buf32;
pos = 0;
do
*data++ ^= buf[pos++];
while (--size != 0 && pos != AES_BLOCK_SIZE);
}
p->pos = pos;
}
STDMETHODIMP_(UInt32) CEncoder::Filter(Byte *data, UInt32 size)
{
EncryptData(data, size);
AesCtr2_Code(&_aes, data, size);
_hmac.Update(data, size);
return size;
}
@@ -202,7 +214,7 @@ STDMETHODIMP_(UInt32) CEncoder::Filter(Byte *data, UInt32 size)
STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
{
_hmac.Update(data, size);
EncryptData(data, size);
AesCtr2_Code(&_aes, data, size);
return size;
}
+31 -22
View File
@@ -26,18 +26,25 @@ specified in password Based File Encryption Utility:
namespace NCrypto {
namespace NWzAes {
const unsigned int kSaltSizeMax = 16;
const unsigned int kMacSize = 10;
const unsigned kSaltSizeMax = 16;
const unsigned kMacSize = 10;
const UInt32 kPasswordSizeMax = 99; // 128;
// Password Verification Code Size
const unsigned int kPwdVerifCodeSize = 2;
const unsigned kPwdVerifCodeSize = 2;
enum EKeySizeMode
{
kKeySizeMode_AES128 = 1,
kKeySizeMode_AES192 = 2,
kKeySizeMode_AES256 = 3
};
class CKeyInfo
{
public:
Byte KeySizeMode; // 1 - 128-bit , 2 - 192-bit , 3 - 256-bit
EKeySizeMode KeySizeMode;
Byte Salt[kSaltSizeMax];
Byte PwdVerifComputed[kPwdVerifCodeSize];
@@ -47,9 +54,20 @@ public:
UInt32 GetSaltSize() const { return (4 * (KeySizeMode & 3) + 4); }
CKeyInfo() { Init(); }
void Init() { KeySizeMode = 3; }
void Init() { KeySizeMode = kKeySizeMode_AES256; }
};
struct CAesCtr2
{
unsigned pos;
unsigned offset;
UInt32 aes[4 + AES_NUM_IVMRK_WORDS + 3];
CAesCtr2();
};
void AesCtr2_Init(CAesCtr2 *p);
void AesCtr2_Code(CAesCtr2 *p, Byte *data, SizeT size);
class CBaseCoder:
public ICompressFilter,
public ICryptoSetPassword,
@@ -57,15 +75,9 @@ class CBaseCoder:
{
protected:
CKeyInfo _key;
UInt32 _counter[AES_BLOCK_SIZE / 4];
Byte _buffer[AES_BLOCK_SIZE];
NSha1::CHmac _hmac;
unsigned int _blockPos;
Byte _pwdVerifFromArchive[kPwdVerifCodeSize];
void EncryptData(Byte *data, UInt32 size);
CAes Aes;
CAesCtr2 _aes;
public:
STDMETHOD(Init)();
@@ -74,26 +86,23 @@ public:
STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
UInt32 GetHeaderSize() const { return _key.GetSaltSize() + kPwdVerifCodeSize; }
bool SetKeyMode(unsigned mode)
{
if (mode < kKeySizeMode_AES128 || mode > kKeySizeMode_AES256)
return false;
_key.KeySizeMode = (EKeySizeMode)mode;
return true;
}
};
class CEncoder:
public CBaseCoder
// public ICompressWriteCoderProperties
{
public:
MY_UNKNOWN_IMP1(ICryptoSetPassword)
// ICompressWriteCoderProperties
// STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
HRESULT WriteHeader(ISequentialOutStream *outStream);
HRESULT WriteFooter(ISequentialOutStream *outStream);
bool SetKeyMode(Byte mode)
{
if (mode < 1 || mode > 3)
return false;
_key.KeySizeMode = mode;
return true;
}
};
class CDecoder:
+27 -46
View File
@@ -57,11 +57,6 @@ STDMETHODIMP CBaseCoder::CryptoSetPassword(const Byte *data, UInt32 size)
return S_OK;
}
STDMETHODIMP CBaseCoder::Init()
{
return S_OK;
}
HRESULT CDecoder::ReadHeader(ISequentialInStream *inStream, UInt32 /* crc */, UInt64 /* unpackSize */)
{
Byte temp[4];
@@ -85,79 +80,70 @@ HRESULT CDecoder::ReadHeader(ISequentialInStream *inStream, UInt32 /* crc */, UI
return E_NOTIMPL;
RINOK(ReadStream_FALSE(inStream, temp, 4));
_remSize = GetUi32(temp);
if (_remSize > _buf.GetCapacity())
const UInt32 kAlign = 16;
if (_remSize < 16 || _remSize > (1 << 18))
return E_NOTIMPL;
if (_remSize + kAlign > _buf.GetCapacity())
{
_buf.Free();
_buf.SetCapacity(_remSize);
_buf.SetCapacity(_remSize + kAlign);
_bufAligned = (Byte *)((ptrdiff_t)((Byte *)_buf + kAlign - 1) & ~(ptrdiff_t)(kAlign - 1));
}
return ReadStream_FALSE(inStream, _buf, _remSize);
return ReadStream_FALSE(inStream, _bufAligned, _remSize);
}
HRESULT CDecoder::CheckPassword(bool &passwOK)
{
passwOK = false;
if (_remSize < 10)
if (_remSize < 16)
return E_NOTIMPL;
Byte *p = _buf;
Byte *p = _bufAligned;
UInt16 format = GetUi16(p);
if (format != 3)
return E_NOTIMPL;
UInt16 algId = GetUi16(p + 2);
UInt16 algId = GetUi16(p + 2);
if (algId < kAES128)
return E_NOTIMPL;
algId -= kAES128;
if (algId > 2)
return E_NOTIMPL;
UInt16 bitLen = GetUi16(p + 4);
UInt16 flags = GetUi16(p + 6);
UInt16 flags = GetUi16(p + 6);
if (algId * 64 + 128 != bitLen)
return E_NOTIMPL;
_key.KeySize = 16 + algId * 8;
if ((flags & 1) == 0)
return E_NOTIMPL;
UInt32 rdSize = GetUi16(p + 8);
UInt32 pos = 10;
Byte *rd = p + pos;
pos += rdSize;
if (pos + 4 > _remSize)
if ((rdSize & 0xF) != 0 || rdSize + 16 > _remSize)
return E_NOTIMPL;
UInt32 reserved = GetUi32(p + pos);
pos += 4;
if (reserved != 0)
memmove(p, p + 10, rdSize);
Byte *validData = p + rdSize + 16;
if (GetUi32(validData - 6) != 0) // reserved
return E_NOTIMPL;
if (pos + 2 > _remSize)
return E_NOTIMPL;
UInt32 validSize = GetUi16(p + pos);
pos += 2;
Byte *validData = p + pos;
if (pos + validSize != _remSize)
UInt32 validSize = GetUi16(validData - 2);
if ((validSize & 0xF) != 0 || 16 + rdSize + validSize != _remSize)
return E_NOTIMPL;
if (!_aesFilter)
_aesFilter = new CAesCbcDecoder;
CMyComPtr<ICryptoProperties> cp;
RINOK(_aesFilter.QueryInterface(IID_ICryptoProperties, &cp));
{
RINOK(cp->SetKey(_key.MasterKey, _key.KeySize));
RINOK(cp->SetInitVector(_iv, 16));
_aesFilter->Init();
if (_aesFilter->Filter(rd, rdSize) != rdSize)
return E_NOTIMPL;
RINOK(SetKey(_key.MasterKey, _key.KeySize));
RINOK(SetInitVector(_iv, 16));
Init();
Filter(p, rdSize);
}
Byte fileKey[32];
NSha1::CContext sha;
sha.Init();
sha.Update(_iv, 16);
sha.Update(rd, rdSize - 16); // we don't use last 16 bytes (PAD bytes)
sha.Update(p, rdSize - 16); // we don't use last 16 bytes (PAD bytes)
DeriveKey(sha, fileKey);
RINOK(cp->SetKey(fileKey, _key.KeySize));
RINOK(cp->SetInitVector(_iv, 16));
_aesFilter->Init();
if (_aesFilter->Filter(validData, validSize) != validSize)
return E_NOTIMPL;
RINOK(SetKey(fileKey, _key.KeySize));
RINOK(SetInitVector(_iv, 16));
Init();
Filter(validData, validSize);
if (validSize < 4)
return E_NOTIMPL;
@@ -165,13 +151,8 @@ HRESULT CDecoder::CheckPassword(bool &passwOK)
if (GetUi32(validData + validSize) != CrcCalc(validData, validSize))
return S_OK;
passwOK = true;
_aesFilter->Init();
Init();
return S_OK;
}
STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
{
return _aesFilter->Filter(data, size);
}
}}
+6 -12
View File
@@ -3,12 +3,12 @@
#ifndef __CRYPTO_ZIP_STRONG_H
#define __CRYPTO_ZIP_STRONG_H
#include "Common/MyCom.h"
#include "Common/Buffer.h"
#include "../ICoder.h"
#include "../IPassword.h"
#include "MyAes.h"
namespace NCrypto {
namespace NZipStrong {
@@ -20,30 +20,24 @@ struct CKeyInfo
};
class CBaseCoder:
public ICompressFilter,
public ICryptoSetPassword,
public CMyUnknownImp
public CAesCbcDecoder,
public ICryptoSetPassword
{
protected:
CKeyInfo _key;
CMyComPtr<ICompressFilter> _aesFilter;
CByteBuffer _buf;
Byte *_bufAligned;
public:
STDMETHOD(Init)();
STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size) = 0;
STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
};
class CDecoder:
public CBaseCoder
class CDecoder: public CBaseCoder
{
UInt32 _ivSize;
Byte _iv[16];
UInt32 _remSize;
public:
MY_UNKNOWN_IMP1(ICryptoSetPassword)
STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
HRESULT ReadHeader(ISequentialInStream *inStream, UInt32 crc, UInt64 unpackSize);
HRESULT CheckPassword(bool &passwOK);
};

Some files were not shown because too many files have changed in this diff Show More