mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 20:07:05 -06:00
4.63
This commit is contained in:
committed by
Kornel Lesiński
parent
c1f1243a70
commit
3a524e5ba2
@@ -2,15 +2,12 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "7zDecode.h"
|
||||
|
||||
#include "../../IPassword.h"
|
||||
#include "../../Common/LockedStream.h"
|
||||
#include "../../Common/StreamObjects.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../../Common/CreateCoder.h"
|
||||
#include "../../Common/FilterCoder.h"
|
||||
#include "../../Common/LockedStream.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Common/StreamObjects.h"
|
||||
|
||||
#include "7zDecode.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace N7z {
|
||||
@@ -105,6 +102,8 @@ HRESULT CDecoder::Decode(
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (!folderInfo.CheckStructure())
|
||||
return E_NOTIMPL;
|
||||
#ifndef _NO_CRYPTO
|
||||
passwordIsDefined = false;
|
||||
#endif
|
||||
@@ -229,13 +228,13 @@ HRESULT CDecoder::Decode(
|
||||
decoder.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties);
|
||||
if (setDecoderProperties)
|
||||
{
|
||||
const CByteBuffer &properties = coderInfo.Properties;
|
||||
size_t size = properties.GetCapacity();
|
||||
const CByteBuffer &props = coderInfo.Props;
|
||||
size_t size = props.GetCapacity();
|
||||
if (size > 0xFFFFFFFF)
|
||||
return E_NOTIMPL;
|
||||
if (size > 0)
|
||||
{
|
||||
RINOK(setDecoderProperties->SetDecoderProperties2((const Byte *)properties, (UInt32)size));
|
||||
RINOK(setDecoderProperties->SetDecoderProperties2((const Byte *)props, (UInt32)size));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,8 +233,8 @@ HRESULT CEncoder::Encode(
|
||||
outStreamSpec->Init();
|
||||
writeCoderProperties->WriteCoderProperties(outStream);
|
||||
size_t size = outStreamSpec->GetSize();
|
||||
encodingInfo.Properties.SetCapacity(size);
|
||||
memmove(encodingInfo.Properties, outStreamSpec->GetBuffer(), size);
|
||||
encodingInfo.Props.SetCapacity(size);
|
||||
memmove(encodingInfo.Props, outStreamSpec->GetBuffer(), size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ HRESULT CEncoder::Encode(
|
||||
folderItem.UnpackSizes.Add(streamSize);
|
||||
}
|
||||
for (i = numMethods - 1; i >= 0; i--)
|
||||
folderItem.Coders[numMethods - 1 - i].Properties = _codersInfo[i].Properties;
|
||||
folderItem.Coders[numMethods - 1 - i].Props = _codersInfo[i].Props;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,25 +2,29 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "7zHandler.h"
|
||||
#include "7zProperties.h"
|
||||
extern "C"
|
||||
{
|
||||
#include "../../../../C/CpuArch.h"
|
||||
}
|
||||
|
||||
#include "../../../Common/IntToString.h"
|
||||
#include "../../../Common/ComTry.h"
|
||||
#include "../../../Windows/Defs.h"
|
||||
#include "../../../Common/IntToString.h"
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
#include "../../../Windows/System.h"
|
||||
#endif
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
|
||||
#include "7zHandler.h"
|
||||
#include "7zProperties.h"
|
||||
|
||||
#ifdef __7Z_SET_PROPERTIES
|
||||
#ifdef EXTRACT_ONLY
|
||||
#include "../Common/ParseProperties.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
#include "../../../Windows/System.h"
|
||||
#endif
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
extern UString ConvertMethodIdToString(UInt64 id);
|
||||
@@ -191,13 +195,6 @@ static inline UString GetHex2(Byte value)
|
||||
|
||||
static const UInt64 k_AES = 0x06F10701;
|
||||
|
||||
#ifndef _SFX
|
||||
static inline UInt32 GetUInt32FromMemLE(const Byte *p)
|
||||
{
|
||||
return p[0] | (((UInt32)p[1]) << 8) | (((UInt32)p[2]) << 16) | (((UInt32)p[3]) << 24);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool CHandler::IsEncrypted(UInt32 index2) const
|
||||
{
|
||||
CNum folderIndex = _db.FileIndexToFolderIndexMap[index2];
|
||||
@@ -291,33 +288,31 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
|
||||
methodsString += methodName;
|
||||
if (coderInfo.MethodID == k_LZMA)
|
||||
{
|
||||
if (coderInfo.Properties.GetCapacity() >= 5)
|
||||
if (coderInfo.Props.GetCapacity() >= 5)
|
||||
{
|
||||
methodsString += L":";
|
||||
UInt32 dicSize = GetUInt32FromMemLE(
|
||||
((const Byte *)coderInfo.Properties + 1));
|
||||
UInt32 dicSize = GetUi32((const Byte *)coderInfo.Props + 1);
|
||||
methodsString += GetStringForSizeValue(dicSize);
|
||||
}
|
||||
}
|
||||
else if (coderInfo.MethodID == k_PPMD)
|
||||
{
|
||||
if (coderInfo.Properties.GetCapacity() >= 5)
|
||||
if (coderInfo.Props.GetCapacity() >= 5)
|
||||
{
|
||||
Byte order = *(const Byte *)coderInfo.Properties;
|
||||
Byte order = *(const Byte *)coderInfo.Props;
|
||||
methodsString += L":o";
|
||||
methodsString += ConvertUInt32ToString(order);
|
||||
methodsString += L":mem";
|
||||
UInt32 dicSize = GetUInt32FromMemLE(
|
||||
((const Byte *)coderInfo.Properties + 1));
|
||||
UInt32 dicSize = GetUi32((const Byte *)coderInfo.Props + 1);
|
||||
methodsString += GetStringForSizeValue(dicSize);
|
||||
}
|
||||
}
|
||||
else if (coderInfo.MethodID == k_AES)
|
||||
{
|
||||
if (coderInfo.Properties.GetCapacity() >= 1)
|
||||
if (coderInfo.Props.GetCapacity() >= 1)
|
||||
{
|
||||
methodsString += L":";
|
||||
const Byte *data = (const Byte *)coderInfo.Properties;
|
||||
const Byte *data = (const Byte *)coderInfo.Props;
|
||||
Byte firstByte = *data++;
|
||||
UInt32 numCyclesPower = firstByte & 0x3F;
|
||||
methodsString += ConvertUInt32ToString(numCyclesPower);
|
||||
@@ -328,7 +323,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
|
||||
return S_OK;
|
||||
UInt32 saltSize = (firstByte >> 7) & 1;
|
||||
UInt32 ivSize = (firstByte >> 6) & 1;
|
||||
if (coderInfo.Properties.GetCapacity() >= 2)
|
||||
if (coderInfo.Props.GetCapacity() >= 2)
|
||||
{
|
||||
Byte secondByte = *data++;
|
||||
saltSize += (secondByte >> 4);
|
||||
@@ -340,18 +335,18 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
|
||||
}
|
||||
else
|
||||
{
|
||||
if (coderInfo.Properties.GetCapacity() > 0)
|
||||
if (coderInfo.Props.GetCapacity() > 0)
|
||||
{
|
||||
methodsString += L":[";
|
||||
for (size_t bi = 0; bi < coderInfo.Properties.GetCapacity(); bi++)
|
||||
for (size_t bi = 0; bi < coderInfo.Props.GetCapacity(); bi++)
|
||||
{
|
||||
if (bi > 5 && bi + 1 < coderInfo.Properties.GetCapacity())
|
||||
if (bi > 5 && bi + 1 < coderInfo.Props.GetCapacity())
|
||||
{
|
||||
methodsString += L"..";
|
||||
break;
|
||||
}
|
||||
else
|
||||
methodsString += GetHex2(coderInfo.Properties[bi]);
|
||||
methodsString += GetHex2(coderInfo.Props[bi]);
|
||||
}
|
||||
methodsString += L"]";
|
||||
}
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "7zHandler.h"
|
||||
#include "7zOut.h"
|
||||
#include "7zUpdate.h"
|
||||
|
||||
#include "../../../Windows/PropVariant.h"
|
||||
|
||||
#include "../../../Common/ComTry.h"
|
||||
#include "../../../Common/StringToInt.h"
|
||||
#include "../../IPassword.h"
|
||||
|
||||
#include "../../ICoder.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
#include "../Common/ParseProperties.h"
|
||||
|
||||
#include "7zHandler.h"
|
||||
#include "7zOut.h"
|
||||
#include "7zUpdate.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
namespace NArchive {
|
||||
@@ -85,28 +85,28 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
COneMethodInfo oneMethodInfo;
|
||||
oneMethodInfo.MethodName = kLZMAMethodName;
|
||||
{
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kMatchFinder;
|
||||
property.Value = kLzmaMatchFinderForHeaders;
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
CProp prop;
|
||||
prop.Id = NCoderPropID::kMatchFinder;
|
||||
prop.Value = kLzmaMatchFinderForHeaders;
|
||||
oneMethodInfo.Props.Add(prop);
|
||||
}
|
||||
{
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kAlgorithm;
|
||||
property.Value = kAlgorithmForHeaders;
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
CProp prop;
|
||||
prop.Id = NCoderPropID::kAlgorithm;
|
||||
prop.Value = kAlgorithmForHeaders;
|
||||
oneMethodInfo.Props.Add(prop);
|
||||
}
|
||||
{
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kNumFastBytes;
|
||||
property.Value = UInt32(kNumFastBytesForHeaders);
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
CProp prop;
|
||||
prop.Id = NCoderPropID::kNumFastBytes;
|
||||
prop.Value = (UInt32)kNumFastBytesForHeaders;
|
||||
oneMethodInfo.Props.Add(prop);
|
||||
}
|
||||
{
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kDictionarySize;
|
||||
property.Value = UInt32(kDictionaryForHeaders);
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
CProp prop;
|
||||
prop.Id = NCoderPropID::kDictionarySize;
|
||||
prop.Value = (UInt32)kDictionaryForHeaders;
|
||||
oneMethodInfo.Props.Add(prop);
|
||||
}
|
||||
headerMethodInfoVector.Add(oneMethodInfo);
|
||||
HRESULT res = SetCompressionMethod(headerMethod, headerMethodInfoVector
|
||||
@@ -155,14 +155,14 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
EXTERNAL_CODECS_VARS
|
||||
oneMethodInfo.MethodName, methodFull.Id, methodFull.NumInStreams, methodFull.NumOutStreams))
|
||||
return E_INVALIDARG;
|
||||
methodFull.Properties = oneMethodInfo.Properties;
|
||||
methodFull.Props = oneMethodInfo.Props;
|
||||
methodMode.Methods.Add(methodFull);
|
||||
|
||||
if (!_numSolidBytesDefined)
|
||||
{
|
||||
for (int j = 0; j < methodFull.Properties.Size(); j++)
|
||||
for (int j = 0; j < methodFull.Props.Size(); j++)
|
||||
{
|
||||
const CProp &prop = methodFull.Properties[j];
|
||||
const CProp &prop = methodFull.Props[j];
|
||||
if ((prop.Id == NCoderPropID::kDictionarySize ||
|
||||
prop.Id == NCoderPropID::kUsedMemorySize) && prop.Value.vt == VT_UI4)
|
||||
{
|
||||
|
||||
@@ -2,16 +2,18 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "7zIn.h"
|
||||
#include "7zDecode.h"
|
||||
#include "../../Common/StreamObjects.h"
|
||||
#include "../../Common/StreamUtils.h"
|
||||
extern "C"
|
||||
{
|
||||
#include "../../../../C/7zCrc.h"
|
||||
#include "../../../../C/CpuArch.h"
|
||||
}
|
||||
|
||||
#include "../../Common/StreamObjects.h"
|
||||
#include "../../Common/StreamUtils.h"
|
||||
|
||||
#include "7zDecode.h"
|
||||
#include "7zIn.h"
|
||||
|
||||
#define Get16(p) GetUi16(p)
|
||||
#define Get32(p) GetUi32(p)
|
||||
#define Get64(p) GetUi64(p)
|
||||
@@ -24,6 +26,86 @@ extern "C"
|
||||
namespace NArchive {
|
||||
namespace N7z {
|
||||
|
||||
static void BoolVector_Fill_False(CBoolVector &v, int size)
|
||||
{
|
||||
v.Clear();
|
||||
v.Reserve(size);
|
||||
for (int i = 0; i < size; i++)
|
||||
v.Add(false);
|
||||
}
|
||||
|
||||
static bool BoolVector_GetAndSet(CBoolVector &v, UInt32 index)
|
||||
{
|
||||
if (index >= (UInt32)v.Size())
|
||||
return true;
|
||||
bool res = v[index];
|
||||
v[index] = true;
|
||||
return res;
|
||||
}
|
||||
|
||||
bool CFolder::CheckStructure() const
|
||||
{
|
||||
const int kNumCodersMax = sizeof(UInt32) * 8; // don't change it
|
||||
const int kMaskSize = sizeof(UInt32) * 8; // it must be >= kNumCodersMax
|
||||
const int kNumBindsMax = 32;
|
||||
|
||||
if (Coders.Size() > kNumCodersMax || BindPairs.Size() > kNumBindsMax)
|
||||
return false;
|
||||
|
||||
{
|
||||
CBoolVector v;
|
||||
BoolVector_Fill_False(v, BindPairs.Size() + PackStreams.Size());
|
||||
|
||||
int i;
|
||||
for (i = 0; i < BindPairs.Size(); i++)
|
||||
if (BoolVector_GetAndSet(v, BindPairs[i].InIndex))
|
||||
return false;
|
||||
for (i = 0; i < PackStreams.Size(); i++)
|
||||
if (BoolVector_GetAndSet(v, PackStreams[i]))
|
||||
return false;
|
||||
|
||||
BoolVector_Fill_False(v, UnpackSizes.Size());
|
||||
for (i = 0; i < BindPairs.Size(); i++)
|
||||
if (BoolVector_GetAndSet(v, BindPairs[i].OutIndex))
|
||||
return false;
|
||||
}
|
||||
|
||||
UInt32 mask[kMaskSize];
|
||||
int i;
|
||||
for (i = 0; i < kMaskSize; i++)
|
||||
mask[i] = 0;
|
||||
|
||||
{
|
||||
CIntVector inStreamToCoder, outStreamToCoder;
|
||||
for (i = 0; i < Coders.Size(); i++)
|
||||
{
|
||||
CNum j;
|
||||
const CCoderInfo &coder = Coders[i];
|
||||
for (j = 0; j < coder.NumInStreams; j++)
|
||||
inStreamToCoder.Add(i);
|
||||
for (j = 0; j < coder.NumOutStreams; j++)
|
||||
outStreamToCoder.Add(i);
|
||||
}
|
||||
|
||||
for (i = 0; i < BindPairs.Size(); i++)
|
||||
{
|
||||
const CBindPair &bp = BindPairs[i];
|
||||
mask[inStreamToCoder[bp.InIndex]] |= (1 << outStreamToCoder[bp.OutIndex]);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < kMaskSize; i++)
|
||||
for (int j = 0; j < kMaskSize; j++)
|
||||
if (((1 << j) & mask[i]) != 0)
|
||||
mask[i] |= mask[j];
|
||||
|
||||
for (i = 0; i < kMaskSize; i++)
|
||||
if (((1 << i) & mask[i]) != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
class CInArchiveException {};
|
||||
|
||||
static void ThrowException() { throw CInArchiveException(); }
|
||||
@@ -323,9 +405,9 @@ void CInArchive::GetNextFolderItem(CFolder &folder)
|
||||
}
|
||||
if ((mainByte & 0x20) != 0)
|
||||
{
|
||||
CNum propertiesSize = ReadNum();
|
||||
coder.Properties.SetCapacity((size_t)propertiesSize);
|
||||
ReadBytes((Byte *)coder.Properties, (size_t)propertiesSize);
|
||||
CNum propsSize = ReadNum();
|
||||
coder.Props.SetCapacity((size_t)propsSize);
|
||||
ReadBytes((Byte *)coder.Props, (size_t)propsSize);
|
||||
}
|
||||
if ((mainByte & 0x80) != 0)
|
||||
ThrowUnsupported();
|
||||
@@ -334,31 +416,34 @@ void CInArchive::GetNextFolderItem(CFolder &folder)
|
||||
numOutStreams += coder.NumOutStreams;
|
||||
}
|
||||
|
||||
CNum numBindPairs;
|
||||
numBindPairs = numOutStreams - 1;
|
||||
CNum numBindPairs = numOutStreams - 1;
|
||||
folder.BindPairs.Clear();
|
||||
folder.BindPairs.Reserve(numBindPairs);
|
||||
for (i = 0; i < numBindPairs; i++)
|
||||
{
|
||||
CBindPair bindPair;
|
||||
bindPair.InIndex = ReadNum();
|
||||
bindPair.OutIndex = ReadNum();
|
||||
folder.BindPairs.Add(bindPair);
|
||||
CBindPair bp;
|
||||
bp.InIndex = ReadNum();
|
||||
bp.OutIndex = ReadNum();
|
||||
folder.BindPairs.Add(bp);
|
||||
}
|
||||
|
||||
CNum numPackedStreams = numInStreams - numBindPairs;
|
||||
folder.PackStreams.Reserve(numPackedStreams);
|
||||
if (numPackedStreams == 1)
|
||||
if (numInStreams < numBindPairs)
|
||||
ThrowUnsupported();
|
||||
CNum numPackStreams = numInStreams - numBindPairs;
|
||||
folder.PackStreams.Reserve(numPackStreams);
|
||||
if (numPackStreams == 1)
|
||||
{
|
||||
for (CNum j = 0; j < numInStreams; j++)
|
||||
if (folder.FindBindPairForInStream(j) < 0)
|
||||
for (i = 0; i < numInStreams; i++)
|
||||
if (folder.FindBindPairForInStream(i) < 0)
|
||||
{
|
||||
folder.PackStreams.Add(j);
|
||||
folder.PackStreams.Add(i);
|
||||
break;
|
||||
}
|
||||
if (folder.PackStreams.Size() != 1)
|
||||
ThrowUnsupported();
|
||||
}
|
||||
else
|
||||
for (i = 0; i < numPackedStreams; i++)
|
||||
for (i = 0; i < numPackStreams; i++)
|
||||
folder.PackStreams.Add(ReadNum());
|
||||
}
|
||||
|
||||
@@ -376,7 +461,7 @@ void CInArchive::WaitAttribute(UInt64 attribute)
|
||||
}
|
||||
|
||||
void CInArchive::ReadHashDigests(int numItems,
|
||||
CRecordVector<bool> &digestsDefined,
|
||||
CBoolVector &digestsDefined,
|
||||
CRecordVector<UInt32> &digests)
|
||||
{
|
||||
ReadBoolVector2(numItems, digestsDefined);
|
||||
@@ -394,7 +479,7 @@ void CInArchive::ReadHashDigests(int numItems,
|
||||
void CInArchive::ReadPackInfo(
|
||||
UInt64 &dataOffset,
|
||||
CRecordVector<UInt64> &packSizes,
|
||||
CRecordVector<bool> &packCRCsDefined,
|
||||
CBoolVector &packCRCsDefined,
|
||||
CRecordVector<UInt32> &packCRCs)
|
||||
{
|
||||
dataOffset = ReadNumber();
|
||||
@@ -421,15 +506,11 @@ void CInArchive::ReadPackInfo(
|
||||
}
|
||||
if (packCRCsDefined.IsEmpty())
|
||||
{
|
||||
packCRCsDefined.Reserve(numPackStreams);
|
||||
packCRCsDefined.Clear();
|
||||
BoolVector_Fill_False(packCRCsDefined, numPackStreams);
|
||||
packCRCs.Reserve(numPackStreams);
|
||||
packCRCs.Clear();
|
||||
for (CNum i = 0; i < numPackStreams; i++)
|
||||
{
|
||||
packCRCsDefined.Add(false);
|
||||
packCRCs.Add(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,7 +552,7 @@ void CInArchive::ReadUnpackInfo(
|
||||
return;
|
||||
if (type == NID::kCRC)
|
||||
{
|
||||
CRecordVector<bool> crcsDefined;
|
||||
CBoolVector crcsDefined;
|
||||
CRecordVector<UInt32> crcs;
|
||||
ReadHashDigests(numFolders, crcsDefined, crcs);
|
||||
for (i = 0; i < numFolders; i++)
|
||||
@@ -490,7 +571,7 @@ void CInArchive::ReadSubStreamsInfo(
|
||||
const CObjectVector<CFolder> &folders,
|
||||
CRecordVector<CNum> &numUnpackStreamsInFolders,
|
||||
CRecordVector<UInt64> &unpackSizes,
|
||||
CRecordVector<bool> &digestsDefined,
|
||||
CBoolVector &digestsDefined,
|
||||
CRecordVector<UInt32> &digests)
|
||||
{
|
||||
numUnpackStreamsInFolders.Clear();
|
||||
@@ -551,7 +632,7 @@ void CInArchive::ReadSubStreamsInfo(
|
||||
{
|
||||
if (type == NID::kCRC)
|
||||
{
|
||||
CRecordVector<bool> digestsDefined2;
|
||||
CBoolVector digestsDefined2;
|
||||
CRecordVector<UInt32> digests2;
|
||||
ReadHashDigests(numDigests, digestsDefined2, digests2);
|
||||
int digestIndex = 0;
|
||||
@@ -576,13 +657,10 @@ void CInArchive::ReadSubStreamsInfo(
|
||||
{
|
||||
if (digestsDefined.IsEmpty())
|
||||
{
|
||||
digestsDefined.Clear();
|
||||
BoolVector_Fill_False(digestsDefined, numDigestsTotal);
|
||||
digests.Clear();
|
||||
for (int i = 0; i < numDigestsTotal; i++)
|
||||
{
|
||||
digestsDefined.Add(false);
|
||||
digests.Add(0);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -596,12 +674,12 @@ void CInArchive::ReadStreamsInfo(
|
||||
const CObjectVector<CByteBuffer> *dataVector,
|
||||
UInt64 &dataOffset,
|
||||
CRecordVector<UInt64> &packSizes,
|
||||
CRecordVector<bool> &packCRCsDefined,
|
||||
CBoolVector &packCRCsDefined,
|
||||
CRecordVector<UInt32> &packCRCs,
|
||||
CObjectVector<CFolder> &folders,
|
||||
CRecordVector<CNum> &numUnpackStreamsInFolders,
|
||||
CRecordVector<UInt64> &unpackSizes,
|
||||
CRecordVector<bool> &digestsDefined,
|
||||
CBoolVector &digestsDefined,
|
||||
CRecordVector<UInt32> &digests)
|
||||
{
|
||||
for (;;)
|
||||
@@ -695,13 +773,13 @@ HRESULT CInArchive::ReadAndDecodePackedStreams(
|
||||
)
|
||||
{
|
||||
CRecordVector<UInt64> packSizes;
|
||||
CRecordVector<bool> packCRCsDefined;
|
||||
CBoolVector packCRCsDefined;
|
||||
CRecordVector<UInt32> packCRCs;
|
||||
CObjectVector<CFolder> folders;
|
||||
|
||||
CRecordVector<CNum> numUnpackStreamsInFolders;
|
||||
CRecordVector<UInt64> unpackSizes;
|
||||
CRecordVector<bool> digestsDefined;
|
||||
CBoolVector digestsDefined;
|
||||
CRecordVector<UInt32> digests;
|
||||
|
||||
ReadStreamsInfo(NULL,
|
||||
@@ -802,7 +880,7 @@ HRESULT CInArchive::ReadHeader(
|
||||
}
|
||||
|
||||
CRecordVector<UInt64> unpackSizes;
|
||||
CRecordVector<bool> digestsDefined;
|
||||
CBoolVector digestsDefined;
|
||||
CRecordVector<UInt32> digests;
|
||||
|
||||
if (type == NID::kMainStreamsInfo)
|
||||
@@ -852,9 +930,7 @@ HRESULT CInArchive::ReadHeader(
|
||||
db.ArchiveInfo.FileInfoPopIDs.Add(NID::kCRC);
|
||||
|
||||
CBoolVector emptyStreamVector;
|
||||
emptyStreamVector.Reserve((int)numFiles);
|
||||
for (i = 0; i < numFiles; i++)
|
||||
emptyStreamVector.Add(false);
|
||||
BoolVector_Fill_False(emptyStreamVector, (int)numFiles);
|
||||
CBoolVector emptyFileVector;
|
||||
CBoolVector antiFileVector;
|
||||
CNum numEmptyStreams = 0;
|
||||
@@ -901,13 +977,10 @@ HRESULT CInArchive::ReadHeader(
|
||||
for (i = 0; i < (CNum)emptyStreamVector.Size(); i++)
|
||||
if (emptyStreamVector[i])
|
||||
numEmptyStreams++;
|
||||
emptyFileVector.Reserve(numEmptyStreams);
|
||||
antiFileVector.Reserve(numEmptyStreams);
|
||||
for (i = 0; i < numEmptyStreams; i++)
|
||||
{
|
||||
emptyFileVector.Add(false);
|
||||
antiFileVector.Add(false);
|
||||
}
|
||||
|
||||
BoolVector_Fill_False(emptyFileVector, numEmptyStreams);
|
||||
BoolVector_Fill_False(antiFileVector, numEmptyStreams);
|
||||
|
||||
break;
|
||||
}
|
||||
case NID::kEmptyFile: ReadBoolVector(numEmptyStreams, emptyFileVector); break;
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
#define __7Z_IN_H
|
||||
|
||||
#include "../../../Common/MyCom.h"
|
||||
#include "../../IStream.h"
|
||||
|
||||
#include "../../IPassword.h"
|
||||
#include "../../IStream.h"
|
||||
|
||||
#include "../../Common/CreateCoder.h"
|
||||
#include "../../Common/InBuffer.h"
|
||||
|
||||
@@ -167,12 +169,12 @@ private:
|
||||
void ReadArchiveProperties(CInArchiveInfo &archiveInfo);
|
||||
void GetNextFolderItem(CFolder &itemInfo);
|
||||
void ReadHashDigests(int numItems,
|
||||
CRecordVector<bool> &digestsDefined, CRecordVector<UInt32> &digests);
|
||||
CBoolVector &digestsDefined, CRecordVector<UInt32> &digests);
|
||||
|
||||
void ReadPackInfo(
|
||||
UInt64 &dataOffset,
|
||||
CRecordVector<UInt64> &packSizes,
|
||||
CRecordVector<bool> &packCRCsDefined,
|
||||
CBoolVector &packCRCsDefined,
|
||||
CRecordVector<UInt32> &packCRCs);
|
||||
|
||||
void ReadUnpackInfo(
|
||||
@@ -183,19 +185,19 @@ private:
|
||||
const CObjectVector<CFolder> &folders,
|
||||
CRecordVector<CNum> &numUnpackStreamsInFolders,
|
||||
CRecordVector<UInt64> &unpackSizes,
|
||||
CRecordVector<bool> &digestsDefined,
|
||||
CBoolVector &digestsDefined,
|
||||
CRecordVector<UInt32> &digests);
|
||||
|
||||
void ReadStreamsInfo(
|
||||
const CObjectVector<CByteBuffer> *dataVector,
|
||||
UInt64 &dataOffset,
|
||||
CRecordVector<UInt64> &packSizes,
|
||||
CRecordVector<bool> &packCRCsDefined,
|
||||
CBoolVector &packCRCsDefined,
|
||||
CRecordVector<UInt32> &packCRCs,
|
||||
CObjectVector<CFolder> &folders,
|
||||
CRecordVector<CNum> &numUnpackStreamsInFolders,
|
||||
CRecordVector<UInt64> &unpackSizes,
|
||||
CRecordVector<bool> &digestsDefined,
|
||||
CBoolVector &digestsDefined,
|
||||
CRecordVector<UInt32> &digests);
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
|
||||
#include "../../../Common/Buffer.h"
|
||||
#include "../../../Common/MyString.h"
|
||||
|
||||
#include "../../Common/MethodId.h"
|
||||
|
||||
#include "7zHeader.h"
|
||||
|
||||
namespace NArchive {
|
||||
@@ -18,7 +20,7 @@ const CNum kNumNoIndex = 0xFFFFFFFF;
|
||||
struct CCoderInfo
|
||||
{
|
||||
CMethodId MethodID;
|
||||
CByteBuffer Properties;
|
||||
CByteBuffer Props;
|
||||
CNum NumInStreams;
|
||||
CNum NumOutStreams;
|
||||
bool IsSimpleCoder() const { return (NumInStreams == 1) && (NumOutStreams == 1); }
|
||||
@@ -80,6 +82,8 @@ struct CFolder
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool CheckStructure() const;
|
||||
};
|
||||
|
||||
struct CUInt64DefVector
|
||||
|
||||
@@ -278,7 +278,7 @@ void COutArchive::WriteFolder(const CFolder &folder)
|
||||
{
|
||||
const CCoderInfo &coder = folder.Coders[i];
|
||||
{
|
||||
size_t propertiesSize = coder.Properties.GetCapacity();
|
||||
size_t propsSize = coder.Props.GetCapacity();
|
||||
|
||||
UInt64 id = coder.MethodID;
|
||||
int idSize;
|
||||
@@ -292,7 +292,7 @@ void COutArchive::WriteFolder(const CFolder &folder)
|
||||
b = (Byte)(idSize & 0xF);
|
||||
bool isComplex = !coder.IsSimpleCoder();
|
||||
b |= (isComplex ? 0x10 : 0);
|
||||
b |= ((propertiesSize != 0) ? 0x20 : 0 );
|
||||
b |= ((propsSize != 0) ? 0x20 : 0 );
|
||||
WriteByte(b);
|
||||
WriteBytes(longID, idSize);
|
||||
if (isComplex)
|
||||
@@ -300,10 +300,10 @@ void COutArchive::WriteFolder(const CFolder &folder)
|
||||
WriteNumber(coder.NumInStreams);
|
||||
WriteNumber(coder.NumOutStreams);
|
||||
}
|
||||
if (propertiesSize == 0)
|
||||
if (propsSize == 0)
|
||||
continue;
|
||||
WriteNumber(propertiesSize);
|
||||
WriteBytes(coder.Properties, propertiesSize);
|
||||
WriteNumber(propsSize);
|
||||
WriteBytes(coder.Props, propsSize);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < folder.BindPairs.Size(); i++)
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
// UpdateMain.cpp
|
||||
// 7zUpdate.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "7zUpdate.h"
|
||||
#include "7zFolderInStream.h"
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
|
||||
#include "7zEncode.h"
|
||||
#include "7zFolderInStream.h"
|
||||
#include "7zHandler.h"
|
||||
#include "7zOut.h"
|
||||
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
#include "7zUpdate.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace N7z {
|
||||
@@ -78,7 +79,7 @@ static int CompareCoders(const CCoderInfo &c1, const CCoderInfo &c2)
|
||||
RINOZ(MyCompare(c1.NumInStreams, c2.NumInStreams));
|
||||
RINOZ(MyCompare(c1.NumOutStreams, c2.NumOutStreams));
|
||||
RINOZ(MyCompare(c1.MethodID, c2.MethodID));
|
||||
return CompareBuffers(c1.Properties, c2.Properties);
|
||||
return CompareBuffers(c1.Props, c2.Props);
|
||||
}
|
||||
|
||||
static int CompareBindPairs(const CBindPair &b1, const CBindPair &b2)
|
||||
@@ -336,28 +337,28 @@ static bool MakeExeMethod(const CCompressionMethodMode &method,
|
||||
if (!GetMethodFull(k_LZMA, 1, methodFull))
|
||||
return false;
|
||||
{
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kAlgorithm;
|
||||
property.Value = kAlgorithmForBCJ2_LZMA;
|
||||
methodFull.Properties.Add(property);
|
||||
CProp prop;
|
||||
prop.Id = NCoderPropID::kAlgorithm;
|
||||
prop.Value = kAlgorithmForBCJ2_LZMA;
|
||||
methodFull.Props.Add(prop);
|
||||
}
|
||||
{
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kMatchFinder;
|
||||
property.Value = kMatchFinderForBCJ2_LZMA;
|
||||
methodFull.Properties.Add(property);
|
||||
CProp prop;
|
||||
prop.Id = NCoderPropID::kMatchFinder;
|
||||
prop.Value = kMatchFinderForBCJ2_LZMA;
|
||||
methodFull.Props.Add(prop);
|
||||
}
|
||||
{
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kDictionarySize;
|
||||
property.Value = kDictionaryForBCJ2_LZMA;
|
||||
methodFull.Properties.Add(property);
|
||||
CProp prop;
|
||||
prop.Id = NCoderPropID::kDictionarySize;
|
||||
prop.Value = kDictionaryForBCJ2_LZMA;
|
||||
methodFull.Props.Add(prop);
|
||||
}
|
||||
{
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kNumFastBytes;
|
||||
property.Value = kNumFastBytesForBCJ2_LZMA;
|
||||
methodFull.Properties.Add(property);
|
||||
CProp prop;
|
||||
prop.Id = NCoderPropID::kNumFastBytes;
|
||||
prop.Value = kNumFastBytesForBCJ2_LZMA;
|
||||
methodFull.Props.Add(prop);
|
||||
}
|
||||
|
||||
exeMethod.Methods.Add(methodFull);
|
||||
|
||||
@@ -16,11 +16,9 @@
|
||||
#include "../Common/StreamObjects.h"
|
||||
#include "../Common/StreamUtils.h"
|
||||
|
||||
#include "../Compress/Arj/ArjDecoder1.h"
|
||||
#include "../Compress/Arj/ArjDecoder2.h"
|
||||
#include "../Compress/Copy/CopyCoder.h"
|
||||
|
||||
#include "IArchive.h"
|
||||
#include "../Compress/ArjDecoder1.h"
|
||||
#include "../Compress/ArjDecoder2.h"
|
||||
#include "../Compress/CopyCoder.h"
|
||||
|
||||
#include "Common/ItemNameUtils.h"
|
||||
#include "Common/OutStreamWithCRC.h"
|
||||
@@ -427,7 +425,7 @@ HRESULT CInArchive::GetNextItem(bool &filled, CItem &item)
|
||||
/*
|
||||
UInt32 extraData;
|
||||
if ((header.Flags & NFileHeader::NFlags::kExtFile) != 0)
|
||||
extraData = GetUInt32FromMemLE(_block + pos);
|
||||
extraData = GetUi32(_block + pos);
|
||||
*/
|
||||
|
||||
RINOK(SkeepExtendedHeaders());
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/Defs.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
#include "Windows/PropVariant.h"
|
||||
|
||||
#include "../../Common/CreateCoder.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Common/StreamUtils.h"
|
||||
#include "../../Common/CreateCoder.h"
|
||||
|
||||
#include "../Common/DummyOutStream.h"
|
||||
|
||||
#include "BZip2Handler.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "Windows/PropVariant.h"
|
||||
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "../Common/ParseProperties.h"
|
||||
|
||||
|
||||
@@ -2,27 +2,27 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/UTFConvert.h"
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/IntToString.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/UTFConvert.h"
|
||||
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "CabHandler.h"
|
||||
#include "CabBlockInStream.h"
|
||||
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Compress/Deflate/DeflateDecoder.h"
|
||||
#include "../../Compress/Lzx/LzxDecoder.h"
|
||||
#include "../../Compress/Quantum/QuantumDecoder.h"
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
#include "../../Compress/DeflateDecoder.h"
|
||||
#include "../../Compress/LzxDecoder.h"
|
||||
#include "../../Compress/QuantumDecoder.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
|
||||
#include "CabBlockInStream.h"
|
||||
#include "CabHandler.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
namespace NArchive {
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
// Chm/Handler.cpp
|
||||
// ChmHandler.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/UTFConvert.h"
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/UTFConvert.h"
|
||||
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../../Common/StreamUtils.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Common/StreamUtils.h"
|
||||
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Compress/Lzx/LzxDecoder.h"
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
#include "../../Compress/LzxDecoder.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
|
||||
#include "ChmHandler.h"
|
||||
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NTime;
|
||||
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
// HandlerOutCommon.cpp
|
||||
// HandlerOut.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "HandlerOut.h"
|
||||
#include "../../../Windows/PropVariant.h"
|
||||
#include "../../../Common/StringToInt.h"
|
||||
#include "../../ICoder.h"
|
||||
#include "../Common/ParseProperties.h"
|
||||
|
||||
#include "../../../Windows/PropVariant.h"
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
#include "../../../Windows/System.h"
|
||||
#endif
|
||||
|
||||
#include "../../ICoder.h"
|
||||
|
||||
#include "../Common/ParseProperties.h"
|
||||
|
||||
#include "HandlerOut.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
namespace NArchive {
|
||||
@@ -161,13 +165,13 @@ static int FindPropIdFromStringName(const UString &name)
|
||||
static void SetOneMethodProp(COneMethodInfo &oneMethodInfo, PROPID propID,
|
||||
const NWindows::NCOM::CPropVariant &value)
|
||||
{
|
||||
for (int j = 0; j < oneMethodInfo.Properties.Size(); j++)
|
||||
if (oneMethodInfo.Properties[j].Id == propID)
|
||||
for (int j = 0; j < oneMethodInfo.Props.Size(); j++)
|
||||
if (oneMethodInfo.Props[j].Id == propID)
|
||||
return;
|
||||
CProp property;
|
||||
property.Id = propID;
|
||||
property.Value = value;
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
CProp prop;
|
||||
prop.Id = propID;
|
||||
prop.Value = value;
|
||||
oneMethodInfo.Props.Add(prop);
|
||||
}
|
||||
|
||||
void COutHandler::SetCompressionMethod2(COneMethodInfo &oneMethodInfo
|
||||
@@ -311,19 +315,16 @@ static void SplitParam(const UString ¶m, UString &name, UString &value)
|
||||
|
||||
HRESULT COutHandler::SetParam(COneMethodInfo &oneMethodInfo, const UString &name, const UString &value)
|
||||
{
|
||||
CProp property;
|
||||
if (
|
||||
name.CompareNoCase(L"D") == 0 ||
|
||||
name.CompareNoCase(L"MEM") == 0)
|
||||
CProp prop;
|
||||
if (name.CompareNoCase(L"D") == 0 ||
|
||||
name.CompareNoCase(L"MEM") == 0)
|
||||
{
|
||||
UInt32 dicSize;
|
||||
RINOK(ParsePropDictionaryValue(value, dicSize));
|
||||
if (name.CompareNoCase(L"D") == 0)
|
||||
property.Id = NCoderPropID::kDictionarySize;
|
||||
else
|
||||
property.Id = NCoderPropID::kUsedMemorySize;
|
||||
property.Value = dicSize;
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
prop.Id = (name.CompareNoCase(L"D") == 0) ?
|
||||
NCoderPropID::kDictionarySize :
|
||||
NCoderPropID::kUsedMemorySize;
|
||||
prop.Value = dicSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -332,7 +333,7 @@ HRESULT COutHandler::SetParam(COneMethodInfo &oneMethodInfo, const UString &name
|
||||
return E_INVALIDARG;
|
||||
|
||||
const CNameToPropID &nameToPropID = g_NameToPropID[index];
|
||||
property.Id = nameToPropID.PropID;
|
||||
prop.Id = nameToPropID.PropID;
|
||||
|
||||
NCOM::CPropVariant propValue;
|
||||
|
||||
@@ -354,11 +355,10 @@ HRESULT COutHandler::SetParam(COneMethodInfo &oneMethodInfo, const UString &name
|
||||
propValue = value;
|
||||
}
|
||||
|
||||
if (!ConvertProperty(propValue, nameToPropID.VarType, property.Value))
|
||||
if (!ConvertProperty(propValue, nameToPropID.VarType, prop.Value))
|
||||
return E_INVALIDARG;
|
||||
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
}
|
||||
oneMethodInfo.Props.Add(prop);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -576,14 +576,13 @@ HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &val
|
||||
}
|
||||
else
|
||||
{
|
||||
CProp property;
|
||||
CProp prop;
|
||||
if (realName.Left(1).CompareNoCase(L"D") == 0)
|
||||
{
|
||||
UInt32 dicSize;
|
||||
RINOK(ParsePropDictionaryValue(realName.Mid(1), value, dicSize));
|
||||
property.Id = NCoderPropID::kDictionarySize;
|
||||
property.Value = dicSize;
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
prop.Id = NCoderPropID::kDictionarySize;
|
||||
prop.Value = dicSize;
|
||||
if (number <= mainDicMethodIndex)
|
||||
mainDicSize = dicSize;
|
||||
}
|
||||
@@ -591,17 +590,15 @@ HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &val
|
||||
{
|
||||
UInt32 blockSize;
|
||||
RINOK(ParsePropDictionaryValue(realName.Mid(1), value, blockSize));
|
||||
property.Id = NCoderPropID::kBlockSize;
|
||||
property.Value = blockSize;
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
prop.Id = NCoderPropID::kBlockSize;
|
||||
prop.Value = blockSize;
|
||||
}
|
||||
else if (realName.Left(3).CompareNoCase(L"MEM") == 0)
|
||||
{
|
||||
UInt32 dicSize;
|
||||
RINOK(ParsePropDictionaryValue(realName.Mid(3), value, dicSize));
|
||||
property.Id = NCoderPropID::kUsedMemorySize;
|
||||
property.Value = dicSize;
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
prop.Id = NCoderPropID::kUsedMemorySize;
|
||||
prop.Value = dicSize;
|
||||
if (number <= mainDicMethodIndex)
|
||||
mainDicSize = dicSize;
|
||||
}
|
||||
@@ -610,15 +607,12 @@ HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &val
|
||||
int index = FindPropIdFromStringName(realName);
|
||||
if (index < 0)
|
||||
return E_INVALIDARG;
|
||||
|
||||
const CNameToPropID &nameToPropID = g_NameToPropID[index];
|
||||
property.Id = nameToPropID.PropID;
|
||||
|
||||
if (!ConvertProperty(value, nameToPropID.VarType, property.Value))
|
||||
prop.Id = nameToPropID.PropID;
|
||||
if (!ConvertProperty(value, nameToPropID.VarType, prop.Value))
|
||||
return E_INVALIDARG;
|
||||
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
}
|
||||
oneMethodInfo.Props.Add(prop);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
#ifndef __HANDLER_OUT_H
|
||||
#define __HANDLER_OUT_H
|
||||
|
||||
#include "../../Common/MethodProps.h"
|
||||
#include "../../../Common/MyString.h"
|
||||
#include "../../Common/MethodProps.h"
|
||||
|
||||
namespace NArchive {
|
||||
|
||||
struct COneMethodInfo
|
||||
{
|
||||
CObjectVector<CProp> Properties;
|
||||
CObjectVector<CProp> Props;
|
||||
UString MethodName;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// OutStreamWithCRC.h
|
||||
|
||||
#ifndef __OUTSTREAMWITHCRC_H
|
||||
#define __OUTSTREAMWITHCRC_H
|
||||
#ifndef __OUT_STREAM_WITH_CRC_H
|
||||
#define __OUT_STREAM_WITH_CRC_H
|
||||
|
||||
#include "../../../Common/MyCom.h"
|
||||
#include "../../IStream.h"
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// OutStreamWithSha1.h
|
||||
|
||||
#ifndef __OUTSTREAMWITHSHA1_H
|
||||
#define __OUTSTREAMWITHSHA1_H
|
||||
#ifndef __OUT_STREAM_WITH_SHA1_H
|
||||
#define __OUT_STREAM_WITH_SHA1_H
|
||||
|
||||
#include "../../../Common/MyCom.h"
|
||||
#include "../../IStream.h"
|
||||
|
||||
|
||||
|
||||
#include "../../Crypto/Hash/Sha1.h"
|
||||
#include "../../Crypto/Sha1.h"
|
||||
|
||||
|
||||
class COutStreamWithSha1:
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
// Archive/cpio/Handler.cpp
|
||||
// CpioHandler.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "CpioHandler.h"
|
||||
#include "CpioIn.h"
|
||||
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/NewHandler.h"
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/NewHandler.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/Time.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Common//LimitedStreams.h"
|
||||
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
|
||||
#include "CpioHandler.h"
|
||||
#include "CpioIn.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NTime;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "../Common/RegisterArc.h"
|
||||
#include "../Common/StreamUtils.h"
|
||||
|
||||
#include "../Compress/Copy/CopyCoder.h"
|
||||
#include "../Compress/CopyCoder.h"
|
||||
|
||||
#include "Common/ItemNameUtils.h"
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
#include "../Common/RegisterArc.h"
|
||||
#include "../Common/StreamUtils.h"
|
||||
|
||||
#include "../Compress/BZip2/BZip2Decoder.h"
|
||||
#include "../Compress/Copy/CopyCoder.h"
|
||||
#include "../Compress/Deflate/ZlibDecoder.h"
|
||||
#include "../Compress/BZip2Decoder.h"
|
||||
#include "../Compress/CopyCoder.h"
|
||||
#include "../Compress/ZlibDecoder.h"
|
||||
|
||||
// #define DMG_SHOW_RAW
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "../Common/RegisterArc.h"
|
||||
#include "../Common/StreamUtils.h"
|
||||
|
||||
#include "../Compress/Copy/CopyCoder.h"
|
||||
#include "../Compress/CopyCoder.h"
|
||||
|
||||
#include "Common/DummyOutStream.h"
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
// Archive/GZip/OutHandler.cpp
|
||||
// GZipHandlerOut.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "GZipHandler.h"
|
||||
#include "GZipUpdate.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/StringToInt.h"
|
||||
|
||||
#include "Windows/Time.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../Common/ParseProperties.h"
|
||||
|
||||
#include "GZipHandler.h"
|
||||
#include "GZipUpdate.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NTime;
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "GZipUpdate.h"
|
||||
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
@@ -11,12 +9,16 @@
|
||||
#include "Windows/PropVariant.h"
|
||||
|
||||
#include "../../ICoder.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
|
||||
#include "../../Common/CreateCoder.h"
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "../Common/InStreamWithCRC.h"
|
||||
|
||||
#include "GZipUpdate.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace NGZip {
|
||||
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
// Iso/Handler.cpp
|
||||
// IsoHandler.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "IsoHandler.h"
|
||||
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/IntToString.h"
|
||||
#include "Common/NewHandler.h"
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/Time.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
|
||||
#include "IsoHandler.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NTime;
|
||||
|
||||
|
||||
@@ -2,23 +2,23 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/ComTry.h"
|
||||
|
||||
#include "Windows/Time.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "LzhHandler.h"
|
||||
#include "LzhOutStreamWithCRC.h"
|
||||
|
||||
#include "../../ICoder.h"
|
||||
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Compress/Lzh/LzhDecoder.h"
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
#include "../../Compress/LzhDecoder.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
|
||||
@@ -384,5 +384,4 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "../Common/RegisterArc.h"
|
||||
#include "../Common/StreamUtils.h"
|
||||
|
||||
#include "../Compress/Copy/CopyCoder.h"
|
||||
#include "../Compress/CopyCoder.h"
|
||||
|
||||
#include "Common/DummyOutStream.h"
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "../Common/RegisterArc.h"
|
||||
#include "../Common/StreamUtils.h"
|
||||
|
||||
#include "../Compress/Copy/CopyCoder.h"
|
||||
#include "../Compress/CopyCoder.h"
|
||||
|
||||
#define Get32(p) GetBe32(p)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "../Common/RegisterArc.h"
|
||||
#include "../Common/StreamUtils.h"
|
||||
|
||||
#include "../Compress/Copy/CopyCoder.h"
|
||||
#include "../Compress/CopyCoder.h"
|
||||
|
||||
#include "Common/DummyOutStream.h"
|
||||
|
||||
@@ -605,7 +605,11 @@ HRESULT CHandler::LoadDebugSections(IInStream *stream, bool &thereIsSection)
|
||||
}
|
||||
}
|
||||
if (i == _sections.Size())
|
||||
return S_FALSE;
|
||||
{
|
||||
return S_OK;
|
||||
// Exe for ARM requires S_OK
|
||||
// return S_FALSE;
|
||||
}
|
||||
|
||||
CByteBuffer buffer;
|
||||
buffer.SetCapacity(debugLink.Size);
|
||||
|
||||
@@ -2,25 +2,29 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "RarHandler.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/IntToString.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "../../IPassword.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
|
||||
#include "../../Common/CreateCoder.h"
|
||||
#include "../../Common/MethodId.h"
|
||||
#include "../../Common/FilterCoder.h"
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Crypto/Rar20/Rar20Cipher.h"
|
||||
#include "../../Crypto/RarAES/RarAES.h"
|
||||
#include "../Common/OutStreamWithCRC.h"
|
||||
#include "../../Common/MethodId.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "../../Crypto/Rar20Crypto.h"
|
||||
#include "../../Crypto/RarAes.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
#include "../Common/OutStreamWithCRC.h"
|
||||
|
||||
#include "RarHandler.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NTime;
|
||||
|
||||
@@ -5,10 +5,14 @@
|
||||
|
||||
#include "Common/DynamicBuffer.h"
|
||||
#include "Common/MyCom.h"
|
||||
#include "../../IStream.h"
|
||||
|
||||
#include "../../ICoder.h"
|
||||
#include "../../IStream.h"
|
||||
|
||||
#include "../../Common/StreamObjects.h"
|
||||
#include "../../Crypto/RarAES/RarAES.h"
|
||||
|
||||
#include "../../Crypto/RarAes.h"
|
||||
|
||||
#include "RarHeader.h"
|
||||
#include "RarItem.h"
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "../Common/RegisterArc.h"
|
||||
#include "../Common/StreamUtils.h"
|
||||
|
||||
#include "../Compress/Copy/CopyCoder.h"
|
||||
#include "../Compress/CopyCoder.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
// Tar/Handler.cpp
|
||||
// SplitHandler.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "SplitHandler.h"
|
||||
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/NewHandler.h"
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/NewHandler.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/Time.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
#include "../Common/MultiStream.h"
|
||||
|
||||
#include "SplitHandler.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NTime;
|
||||
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
// Tar/Handler.cpp
|
||||
// TarHandler.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/NewHandler.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "../Common/DummyOutStream.h"
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
|
||||
#include "TarHandler.h"
|
||||
#include "TarIn.h"
|
||||
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/NewHandler.h"
|
||||
#include "Common/ComTry.h"
|
||||
|
||||
#include "Windows/Time.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../Common/DummyOutStream.h"
|
||||
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
namespace NArchive {
|
||||
|
||||
@@ -2,13 +2,10 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "TarOut.h"
|
||||
#include "TarUpdate.h"
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
// Udf/Handler.cpp
|
||||
// UdfHandler.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "UdfHandler.h"
|
||||
|
||||
#include "Common/NewHandler.h"
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/NewHandler.h"
|
||||
|
||||
#include "Windows/Time.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "../Common/DummyOutStream.h"
|
||||
|
||||
#include "UdfHandler.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace NUdf {
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ HRESULT CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outS
|
||||
{
|
||||
try { return CodeReal(inStream, outStream, outSize); }
|
||||
catch(const CInBufferException &e) { return e.ErrorCode; } \
|
||||
catch(const CLZOutWindowException &e) { return e.ErrorCode; }
|
||||
catch(const CLzOutWindowException &e) { return e.ErrorCode; }
|
||||
catch(...) { return S_FALSE; }
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
#ifndef __ARCHIVE_WIM_IN_H
|
||||
#define __ARCHIVE_WIM_IN_H
|
||||
|
||||
#include "Common/MyString.h"
|
||||
#include "Common/Buffer.h"
|
||||
#include "Common/MyString.h"
|
||||
|
||||
#include "../../Compress/Lzx/LzxDecoder.h"
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
#include "../../Compress/LzxDecoder.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace NWim {
|
||||
@@ -66,7 +66,7 @@ const UInt32 kMainTableSize = 256 + kNumPosLenSlots;
|
||||
class CDecoder
|
||||
{
|
||||
CBitStream m_InBitStream;
|
||||
CLZOutWindow m_OutWindowStream;
|
||||
CLzOutWindow m_OutWindowStream;
|
||||
NCompress::NHuffman::CDecoder<kNumHuffmanBits, kMainTableSize> m_MainDecoder;
|
||||
|
||||
HRESULT CodeSpec(UInt32 size);
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#include "../Common/StreamObjects.h"
|
||||
#include "../Common/StreamUtils.h"
|
||||
|
||||
#include "../Compress/BZip2/BZip2Decoder.h"
|
||||
#include "../Compress/Copy/CopyCoder.h"
|
||||
#include "../Compress/Deflate/ZlibDecoder.h"
|
||||
#include "../Compress/BZip2Decoder.h"
|
||||
#include "../Compress/CopyCoder.h"
|
||||
#include "../Compress/ZlibDecoder.h"
|
||||
|
||||
#include "Common/OutStreamWithSha1.h"
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "../Common/RegisterArc.h"
|
||||
#include "../Common/StreamUtils.h"
|
||||
|
||||
#include "../Compress/Z/ZDecoder.h"
|
||||
#include "../Compress/ZDecoder.h"
|
||||
|
||||
#include "Common/DummyOutStream.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// AddCommon.cpp
|
||||
// ZipAddCommon.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
@@ -8,14 +8,17 @@ extern "C"
|
||||
}
|
||||
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Defs.h"
|
||||
#include "../../MyVersion.h"
|
||||
|
||||
#include "../../ICoder.h"
|
||||
#include "../../IPassword.h"
|
||||
#include "../../MyVersion.h"
|
||||
|
||||
#include "../../Common/CreateCoder.h"
|
||||
#include "../../Common/StreamObjects.h"
|
||||
#include "../../Common/StreamUtils.h"
|
||||
#include "../../Compress/LZMA/LZMAEncoder.h"
|
||||
|
||||
#include "../../Compress/LzmaEncoder.h"
|
||||
|
||||
#include "../Common/InStreamWithCRC.h"
|
||||
|
||||
#include "ZipAddCommon.h"
|
||||
@@ -34,7 +37,7 @@ class CLzmaEncoder:
|
||||
public ICompressCoder,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
NCompress::NLZMA::CEncoder *EncoderSpec;
|
||||
NCompress::NLzma::CEncoder *EncoderSpec;
|
||||
CMyComPtr<ICompressCoder> Encoder;
|
||||
Byte Header[kLzmaHeaderSize];
|
||||
public:
|
||||
@@ -49,7 +52,7 @@ HRESULT CLzmaEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIAN
|
||||
{
|
||||
if (!Encoder)
|
||||
{
|
||||
EncoderSpec = new NCompress::NLZMA::CEncoder;
|
||||
EncoderSpec = new NCompress::NLzma::CEncoder;
|
||||
Encoder = EncoderSpec;
|
||||
}
|
||||
CSequentialOutStreamImp *outStreamSpec = new CSequentialOutStreamImp;
|
||||
@@ -153,7 +156,7 @@ HRESULT CAddCommon::Compress(
|
||||
}
|
||||
if (_options.IsAesMode)
|
||||
{
|
||||
_cryptoStreamSpec->Filter = _aesFilter = _filterAesSpec = new NCrypto::NWzAES::CEncoder;
|
||||
_cryptoStreamSpec->Filter = _aesFilter = _filterAesSpec = new NCrypto::NWzAes::CEncoder;
|
||||
_filterAesSpec->SetKeyMode(_options.AesKeyMode);
|
||||
RINOK(_filterAesSpec->CryptoSetPassword(
|
||||
(const Byte *)(const char *)_options.Password, _options.Password.Length()));
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
// Zip/AddCommon.h
|
||||
// ZipAddCommon.h
|
||||
|
||||
#ifndef __ZIP_ADDCOMMON_H
|
||||
#define __ZIP_ADDCOMMON_H
|
||||
#ifndef __ZIP_ADD_COMMON_H
|
||||
#define __ZIP_ADD_COMMON_H
|
||||
|
||||
#include "../../ICoder.h"
|
||||
#include "../../IProgress.h"
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
|
||||
#include "../../Common/CreateCoder.h"
|
||||
#include "../../Common/FilterCoder.h"
|
||||
#include "../../Crypto/Zip/ZipCipher.h"
|
||||
#include "../../Crypto/WzAES/WzAES.h"
|
||||
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "../../Crypto/ZipCrypto.h"
|
||||
#include "../../Crypto/WzAes.h"
|
||||
|
||||
#include "ZipCompressionMode.h"
|
||||
|
||||
@@ -38,7 +40,7 @@ class CAddCommon
|
||||
CMyComPtr<ISequentialOutStream> _cryptoStream;
|
||||
|
||||
NCrypto::NZip::CEncoder *_filterSpec;
|
||||
NCrypto::NWzAES::CEncoder *_filterAesSpec;
|
||||
NCrypto::NWzAes::CEncoder *_filterAesSpec;
|
||||
|
||||
CMyComPtr<ICompressFilter> _zipCryptoFilter;
|
||||
CMyComPtr<ICompressFilter> _aesFilter;
|
||||
|
||||
@@ -2,40 +2,35 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "ZipHandler.h"
|
||||
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/IntToString.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/Time.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "../../IPassword.h"
|
||||
|
||||
#include "../../Common/CreateCoder.h"
|
||||
#include "../../Common/FilterCoder.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#include "../../Common/StreamObjects.h"
|
||||
#include "../../Common/StreamUtils.h"
|
||||
#include "../../Common/CreateCoder.h"
|
||||
#include "../../Common/FilterCoder.h"
|
||||
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Compress/LZMA/LZMADecoder.h"
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
#include "../../Compress/LzmaDecoder.h"
|
||||
#include "../../Compress/ImplodeDecoder.h"
|
||||
#include "../../Compress/ShrinkDecoder.h"
|
||||
|
||||
#include "../../Crypto/WzAes.h"
|
||||
#include "../../Crypto/ZipCrypto.h"
|
||||
#include "../../Crypto/ZipStrong.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
#include "../Common/OutStreamWithCRC.h"
|
||||
|
||||
#include "../../Compress/Shrink/ShrinkDecoder.h"
|
||||
#include "../../Compress/Implode/ImplodeDecoder.h"
|
||||
|
||||
|
||||
#include "../../Crypto/Zip/ZipCipher.h"
|
||||
#include "../../Crypto/WzAES/WzAES.h"
|
||||
|
||||
#ifdef ZIP_STRONG_SUPORT
|
||||
#include "../../Crypto/ZipStrong/ZipStrong.h"
|
||||
#endif
|
||||
#include "ZipHandler.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
@@ -381,7 +376,7 @@ class CLzmaDecoder:
|
||||
public ICompressCoder,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
NCompress::NLZMA::CDecoder *DecoderSpec;
|
||||
NCompress::NLzma::CDecoder *DecoderSpec;
|
||||
CMyComPtr<ICompressCoder> Decoder;
|
||||
public:
|
||||
CLzmaDecoder();
|
||||
@@ -393,7 +388,7 @@ public:
|
||||
|
||||
CLzmaDecoder::CLzmaDecoder()
|
||||
{
|
||||
DecoderSpec = new NCompress::NLZMA::CDecoder;
|
||||
DecoderSpec = new NCompress::NLzma::CDecoder;
|
||||
Decoder = DecoderSpec;
|
||||
}
|
||||
|
||||
@@ -417,20 +412,24 @@ struct CMethodItem
|
||||
class CZipDecoder
|
||||
{
|
||||
NCrypto::NZip::CDecoder *_zipCryptoDecoderSpec;
|
||||
NCrypto::NWzAES::CDecoder *_aesDecoderSpec;
|
||||
NCrypto::NZipStrong::CDecoder *_pkAesDecoderSpec;
|
||||
NCrypto::NWzAes::CDecoder *_wzAesDecoderSpec;
|
||||
|
||||
CMyComPtr<ICompressFilter> _zipCryptoDecoder;
|
||||
CMyComPtr<ICompressFilter> _aesDecoder;
|
||||
#ifdef ZIP_STRONG_SUPORT
|
||||
NCrypto::NZipStrong::CDecoder *_zsDecoderSpec;
|
||||
CMyComPtr<ICompressFilter> _zsDecoder;
|
||||
#endif
|
||||
CMyComPtr<ICompressFilter> _pkAesDecoder;
|
||||
CMyComPtr<ICompressFilter> _wzAesDecoder;
|
||||
|
||||
CFilterCoder *filterStreamSpec;
|
||||
CMyComPtr<ISequentialInStream> filterStream;
|
||||
CMyComPtr<ICryptoGetTextPassword> getTextPassword;
|
||||
CObjectVector<CMethodItem> methodItems;
|
||||
|
||||
public:
|
||||
CZipDecoder(): _zipCryptoDecoderSpec(0), _aesDecoderSpec(0), filterStreamSpec(0) {}
|
||||
CZipDecoder():
|
||||
_zipCryptoDecoderSpec(0),
|
||||
_pkAesDecoderSpec(0),
|
||||
_wzAesDecoderSpec(0),
|
||||
filterStreamSpec(0) {}
|
||||
|
||||
HRESULT Decode(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
@@ -453,23 +452,19 @@ HRESULT CZipDecoder::Decode(
|
||||
CInStreamReleaser inStreamReleaser;
|
||||
|
||||
bool needCRC = true;
|
||||
bool aesMode = false;
|
||||
#ifdef ZIP_STRONG_SUPORT
|
||||
bool wzAesMode = false;
|
||||
bool pkAesMode = false;
|
||||
#endif
|
||||
UInt16 methodId = item.CompressionMethod;
|
||||
if (item.IsEncrypted())
|
||||
{
|
||||
if (item.IsStrongEncrypted())
|
||||
{
|
||||
#ifdef ZIP_STRONG_SUPORT
|
||||
CStrongCryptoField f;
|
||||
if (item.CentralExtra.GetStrongCryptoField(f))
|
||||
{
|
||||
pkAesMode = true;
|
||||
}
|
||||
if (!pkAesMode)
|
||||
#endif
|
||||
{
|
||||
res = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
|
||||
return S_OK;
|
||||
@@ -480,7 +475,7 @@ HRESULT CZipDecoder::Decode(
|
||||
CWzAesExtraField aesField;
|
||||
if (item.CentralExtra.GetWzAesField(aesField))
|
||||
{
|
||||
aesMode = true;
|
||||
wzAesMode = true;
|
||||
needCRC = aesField.NeedCrc();
|
||||
}
|
||||
}
|
||||
@@ -496,11 +491,11 @@ HRESULT CZipDecoder::Decode(
|
||||
CMyComPtr<ISequentialInStream> inStream;
|
||||
{
|
||||
UInt64 packSize = item.PackSize;
|
||||
if (aesMode)
|
||||
if (wzAesMode)
|
||||
{
|
||||
if (packSize < NCrypto::NWzAES::kMacSize)
|
||||
if (packSize < NCrypto::NWzAes::kMacSize)
|
||||
return S_OK;
|
||||
packSize -= NCrypto::NWzAES::kMacSize;
|
||||
packSize -= NCrypto::NWzAes::kMacSize;
|
||||
}
|
||||
UInt64 dataPos = item.GetDataPosition();
|
||||
inStream.Attach(archive.CreateLimitedStream(dataPos, packSize));
|
||||
@@ -510,32 +505,30 @@ HRESULT CZipDecoder::Decode(
|
||||
CMyComPtr<ICompressFilter> cryptoFilter;
|
||||
if (item.IsEncrypted())
|
||||
{
|
||||
if (aesMode)
|
||||
if (wzAesMode)
|
||||
{
|
||||
CWzAesExtraField aesField;
|
||||
if (!item.CentralExtra.GetWzAesField(aesField))
|
||||
return S_OK;
|
||||
methodId = aesField.Method;
|
||||
if (!_aesDecoder)
|
||||
if (!_wzAesDecoder)
|
||||
{
|
||||
_aesDecoderSpec = new NCrypto::NWzAES::CDecoder;
|
||||
_aesDecoder = _aesDecoderSpec;
|
||||
_wzAesDecoderSpec = new NCrypto::NWzAes::CDecoder;
|
||||
_wzAesDecoder = _wzAesDecoderSpec;
|
||||
}
|
||||
cryptoFilter = _aesDecoder;
|
||||
cryptoFilter = _wzAesDecoder;
|
||||
Byte properties = aesField.Strength;
|
||||
RINOK(_aesDecoderSpec->SetDecoderProperties2(&properties, 1));
|
||||
RINOK(_wzAesDecoderSpec->SetDecoderProperties2(&properties, 1));
|
||||
}
|
||||
#ifdef ZIP_STRONG_SUPORT
|
||||
else if (pkAesMode)
|
||||
{
|
||||
if (!_zsDecoder)
|
||||
if (!_pkAesDecoder)
|
||||
{
|
||||
_zsDecoderSpec = new NCrypto::NZipStrong::CDecoder;
|
||||
_zsDecoder = _zsDecoderSpec;
|
||||
_pkAesDecoderSpec = new NCrypto::NZipStrong::CDecoder;
|
||||
_pkAesDecoder = _pkAesDecoderSpec;
|
||||
}
|
||||
cryptoFilter = _zsDecoder;
|
||||
cryptoFilter = _pkAesDecoder;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
if (!_zipCryptoDecoder)
|
||||
@@ -556,11 +549,7 @@ HRESULT CZipDecoder::Decode(
|
||||
CMyComBSTR password;
|
||||
RINOK(getTextPassword->CryptoGetTextPassword(&password));
|
||||
AString charPassword;
|
||||
if (aesMode
|
||||
#ifdef ZIP_STRONG_SUPORT
|
||||
|| pkAesMode
|
||||
#endif
|
||||
)
|
||||
if (wzAesMode || pkAesMode)
|
||||
{
|
||||
charPassword = UnicodeStringToMultiByte((const wchar_t *)password, CP_ACP);
|
||||
/*
|
||||
@@ -583,9 +572,9 @@ HRESULT CZipDecoder::Decode(
|
||||
// we use OEM. WinZip/Windows probably use ANSI for some files
|
||||
charPassword = UnicodeStringToMultiByte((const wchar_t *)password, CP_OEMCP);
|
||||
}
|
||||
HRESULT res = cryptoSetPassword->CryptoSetPassword(
|
||||
HRESULT result = cryptoSetPassword->CryptoSetPassword(
|
||||
(const Byte *)(const char *)charPassword, charPassword.Length());
|
||||
if (res != S_OK)
|
||||
if (result != S_OK)
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
@@ -660,7 +649,7 @@ HRESULT CZipDecoder::Decode(
|
||||
#endif
|
||||
|
||||
{
|
||||
HRESULT result;
|
||||
HRESULT result = S_OK;
|
||||
CMyComPtr<ISequentialInStream> inStreamNew;
|
||||
if (item.IsEncrypted())
|
||||
{
|
||||
@@ -670,33 +659,42 @@ HRESULT CZipDecoder::Decode(
|
||||
filterStream = filterStreamSpec;
|
||||
}
|
||||
filterStreamSpec->Filter = cryptoFilter;
|
||||
if (aesMode)
|
||||
if (wzAesMode)
|
||||
{
|
||||
RINOK(_aesDecoderSpec->ReadHeader(inStream));
|
||||
result = _wzAesDecoderSpec->ReadHeader(inStream);
|
||||
if (result == S_OK)
|
||||
{
|
||||
if (!_wzAesDecoderSpec->CheckPasswordVerifyCode())
|
||||
result = S_FALSE;
|
||||
}
|
||||
}
|
||||
#ifdef ZIP_STRONG_SUPORT
|
||||
else if (pkAesMode)
|
||||
{
|
||||
RINOK(_zsDecoderSpec->ReadHeader(inStream));
|
||||
result =_pkAesDecoderSpec->ReadHeader(inStream, item.FileCRC, item.UnPackSize);
|
||||
if (result == S_OK)
|
||||
{
|
||||
bool passwOK;
|
||||
result = _pkAesDecoderSpec->CheckPassword(passwOK);
|
||||
if (result == S_OK && !passwOK)
|
||||
result = S_FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
RINOK(_zipCryptoDecoderSpec->ReadHeader(inStream));
|
||||
result = _zipCryptoDecoderSpec->ReadHeader(inStream);
|
||||
}
|
||||
RINOK(filterStreamSpec->SetInStream(inStream));
|
||||
inStreamReleaser.FilterCoder = filterStreamSpec;
|
||||
inStreamNew = filterStream;
|
||||
|
||||
if (aesMode)
|
||||
|
||||
if (result == S_OK)
|
||||
{
|
||||
if (!_aesDecoderSpec->CheckPasswordVerifyCode())
|
||||
return S_OK;
|
||||
RINOK(filterStreamSpec->SetInStream(inStream));
|
||||
inStreamReleaser.FilterCoder = filterStreamSpec;
|
||||
inStreamNew = filterStream;
|
||||
}
|
||||
}
|
||||
else
|
||||
inStreamNew = inStream;
|
||||
result = coder->Code(inStreamNew, outStream, NULL, &item.UnPackSize, compressProgress);
|
||||
if (result == S_OK)
|
||||
result = coder->Code(inStreamNew, outStream, NULL, &item.UnPackSize, compressProgress);
|
||||
if (result == S_FALSE)
|
||||
return S_OK;
|
||||
if (result == E_NOTIMPL)
|
||||
@@ -711,10 +709,10 @@ HRESULT CZipDecoder::Decode(
|
||||
bool authOk = true;
|
||||
if (needCRC)
|
||||
crcOK = (outStreamSpec->GetCRC() == item.FileCRC);
|
||||
if (aesMode)
|
||||
if (wzAesMode)
|
||||
{
|
||||
inStream.Attach(archive.CreateLimitedStream(authenticationPos, NCrypto::NWzAES::kMacSize));
|
||||
if (_aesDecoderSpec->CheckMac(inStream, authOk) != S_OK)
|
||||
inStream.Attach(archive.CreateLimitedStream(authenticationPos, NCrypto::NWzAes::kMacSize));
|
||||
if (_wzAesDecoderSpec->CheckMac(inStream, authOk) != S_OK)
|
||||
authOk = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
// Zip/HandlerOut.cpp
|
||||
// ZipHandlerOut.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "ZipHandler.h"
|
||||
#include "ZipUpdate.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/ComTry.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/StringToInt.h"
|
||||
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "../../IPassword.h"
|
||||
|
||||
#include "../../Common/OutBuffer.h"
|
||||
|
||||
#include "../../Crypto/WzAes.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
#include "../Common/ParseProperties.h"
|
||||
#include "../../Crypto/WzAES/WzAES.h"
|
||||
#include "../../Common/OutBuffer.h"
|
||||
|
||||
#include "ZipHandler.h"
|
||||
#include "ZipUpdate.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NCOM;
|
||||
@@ -253,7 +256,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
|
||||
return E_INVALIDARG;
|
||||
if (m_IsAesMode)
|
||||
{
|
||||
if (options.Password.Length() > NCrypto::NWzAES::kPasswordSizeMax)
|
||||
if (options.Password.Length() > NCrypto::NWzAes::kPasswordSizeMax)
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
options.Password = UnicodeStringToMultiByte((const wchar_t *)password, CP_OEMCP);
|
||||
|
||||
@@ -2,27 +2,26 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ZipUpdate.h"
|
||||
#include "ZipAddCommon.h"
|
||||
#include "ZipOut.h"
|
||||
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/AutoPtr.h"
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/Defs.h"
|
||||
#include "Windows/Thread.h"
|
||||
|
||||
#include "../../Common/CreateCoder.h"
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../../Common/OutMemStream.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
#ifdef COMPRESS_MT
|
||||
#include "../../Common/ProgressMt.h"
|
||||
#endif
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../../Common/OutMemStream.h"
|
||||
#include "../../Common/CreateCoder.h"
|
||||
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
#include "../../Compress/CopyCoder.h"
|
||||
|
||||
#include "ZipAddCommon.h"
|
||||
#include "ZipOut.h"
|
||||
#include "ZipUpdate.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NSynchronization;
|
||||
|
||||
Reference in New Issue
Block a user