9.07 beta

This commit is contained in:
Igor Pavlov
2009-08-29 00:00:00 +00:00
committed by Kornel Lesiński
parent c99f3ebdd6
commit 2fed872194
22 changed files with 352 additions and 121 deletions

View File

@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 9 #define MY_VER_MAJOR 9
#define MY_VER_MINOR 06 #define MY_VER_MINOR 07
#define MY_VER_BUILD 0 #define MY_VER_BUILD 0
#define MY_VERSION "9.06 beta" #define MY_VERSION "9.07 beta"
#define MY_DATE "2009-08-17" #define MY_DATE "2009-08-29"
#define MY_COPYRIGHT ": Igor Pavlov : Public domain" #define MY_COPYRIGHT ": Igor Pavlov : Public domain"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE

View File

@@ -90,12 +90,14 @@ struct CBlock
UInt64 UnpSize; UInt64 UnpSize;
UInt64 PackPos; UInt64 PackPos;
UInt64 PackSize; UInt64 PackSize;
UInt64 GetNextPackOffset() const { return PackPos + PackSize; }
}; };
struct CFile struct CFile
{ {
CByteBuffer Raw; CByteBuffer Raw;
// UInt64 StartPos; UInt64 StartPos;
CRecordVector<CBlock> Blocks; CRecordVector<CBlock> Blocks;
UInt64 GetUnpackSize() const UInt64 GetUnpackSize() const
{ {
@@ -139,6 +141,7 @@ enum
METHOD_ZERO_0 = 0, METHOD_ZERO_0 = 0,
METHOD_COPY = 1, METHOD_COPY = 1,
METHOD_ZERO_2 = 2, METHOD_ZERO_2 = 2,
METHOD_ADC = 0x80000004,
METHOD_ZLIB = 0x80000005, METHOD_ZLIB = 0x80000005,
METHOD_BZIP2 = 0x80000006, METHOD_BZIP2 = 0x80000006,
METHOD_DUMMY = 0x7FFFFFFE, METHOD_DUMMY = 0x7FFFFFFE,
@@ -196,6 +199,7 @@ UString CMethods::GetString() const
case METHOD_ZERO_0: s = L"zero0"; showPack = (m.PackSize != 0); break; case METHOD_ZERO_0: s = L"zero0"; showPack = (m.PackSize != 0); break;
case METHOD_ZERO_2: s = L"zero2"; showPack = (m.PackSize != 0); break; case METHOD_ZERO_2: s = L"zero2"; showPack = (m.PackSize != 0); break;
case METHOD_COPY: s = L"copy"; showPack = (m.UnpSize != m.PackSize); break; case METHOD_COPY: s = L"copy"; showPack = (m.UnpSize != m.PackSize); break;
case METHOD_ADC: s = L"adc"; break;
case METHOD_ZLIB: s = L"zlib"; break; case METHOD_ZLIB: s = L"zlib"; break;
case METHOD_BZIP2: s = L"bzip2"; break; case METHOD_BZIP2: s = L"bzip2"; break;
default: ConvertUInt64ToString(type, buf); s = buf; default: ConvertUInt64ToString(type, buf); s = buf;
@@ -329,24 +333,15 @@ HRESULT CHandler::Open2(IInStream *stream)
const CXmlItem &arrItem = rfDictItem.SubItems[arrIndex]; const CXmlItem &arrItem = rfDictItem.SubItems[arrIndex];
/* some DMG file has BUG: int i;
PackPos for each new file is 0. for (i = 0; i < arrItem.SubItems.Size(); i++)
So we use additional "StartPos" to fix that BUG */
/*
UInt64 startPos = 0;
bool startPosIsDefined = false;
*/
for (int i = 0; i < arrItem.SubItems.Size(); i++)
{ {
const CXmlItem &item = arrItem.SubItems[i]; const CXmlItem &item = arrItem.SubItems[i];
if (!item.IsTagged("dict")) if (!item.IsTagged("dict"))
continue; continue;
CFile file; CFile file;
// file.StartPos = startPos; file.StartPos = 0;
int destLen; int destLen;
{ {
@@ -381,18 +376,6 @@ HRESULT CHandler::Open2(IInStream *stream)
b.PackPos = Get64(p + 0x18); b.PackPos = Get64(p + 0x18);
b.PackSize = Get64(p + 0x20); b.PackSize = Get64(p + 0x20);
/*
if (startPosIsdefined)
{
}
else
{
startPosIsdefined = true;
startPos = b.PackPos;
}
startPos += b.PackSize;
*/
file.Blocks.Add(b); file.Blocks.Add(b);
PRF(printf("\nType=%8x m[1]=%8x uPos=%8x uSize=%7x pPos=%8x pSize=%7x", PRF(printf("\nType=%8x m[1]=%8x uPos=%8x uSize=%7x pPos=%8x pSize=%7x",
@@ -406,6 +389,28 @@ HRESULT CHandler::Open2(IInStream *stream)
_fileIndices.Add(itemIndex); _fileIndices.Add(itemIndex);
} }
} }
// PackPos for each new file is 0 in some DMG files. So we use additional StartPos
bool allStartAreZeros = true;
for (i = 0; i < _files.Size(); i++)
{
const CFile &file = _files[i];
if (!file.Blocks.IsEmpty() && file.Blocks[0].PackPos != 0)
allStartAreZeros = false;
}
UInt64 startPos = 0;
if (allStartAreZeros)
{
for (i = 0; i < _files.Size(); i++)
{
CFile &file = _files[i];
file.StartPos = startPos;
if (!file.Blocks.IsEmpty())
startPos += file.Blocks.Back().GetNextPackOffset();
}
}
return S_OK; return S_OK;
} }
@@ -459,7 +464,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
prop = RAW_PREFIX L"a.xml"; prop = RAW_PREFIX L"a.xml";
break; break;
case kpidSize: case kpidSize:
case kpidPackedSize: case kpidPackSize:
prop = (UInt64)_xml.Length(); prop = (UInt64)_xml.Length();
break; break;
} }
@@ -477,7 +482,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
break; break;
} }
case kpidSize: case kpidSize:
case kpidPackedSize: case kpidPackSize:
prop = (UInt64)_files[rawIndex].Raw.GetCapacity(); prop = (UInt64)_files[rawIndex].Raw.GetCapacity();
break; break;
} }
@@ -573,6 +578,135 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
COM_TRY_END COM_TRY_END
} }
class CAdcDecoder:
public ICompressCoder,
public CMyUnknownImp
{
CLzOutWindow m_OutWindowStream;
CInBuffer m_InStream;
void ReleaseStreams()
{
m_OutWindowStream.ReleaseStream();
m_InStream.ReleaseStream();
}
class CCoderReleaser
{
CAdcDecoder *m_Coder;
public:
bool NeedFlush;
CCoderReleaser(CAdcDecoder *coder): m_Coder(coder), NeedFlush(true) {}
~CCoderReleaser()
{
if (NeedFlush)
m_Coder->m_OutWindowStream.Flush();
m_Coder->ReleaseStreams();
}
};
friend class CCoderReleaser;
public:
MY_UNKNOWN_IMP
STDMETHOD(CodeReal)(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress);
STDMETHOD(Code)(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress);
};
STDMETHODIMP CAdcDecoder::CodeReal(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress)
{
if (!m_OutWindowStream.Create(1 << 18))
return E_OUTOFMEMORY;
if (!m_InStream.Create(1 << 18))
return E_OUTOFMEMORY;
m_OutWindowStream.SetStream(outStream);
m_OutWindowStream.Init(false);
m_InStream.SetStream(inStream);
m_InStream.Init();
CCoderReleaser coderReleaser(this);
const UInt32 kStep = (1 << 20);
UInt64 nextLimit = kStep;
UInt64 pos = 0;
while (pos < *outSize)
{
if (pos > nextLimit && progress)
{
UInt64 packSize = m_InStream.GetProcessedSize();
RINOK(progress->SetRatioInfo(&packSize, &pos));
nextLimit += kStep;
}
Byte b;
if (!m_InStream.ReadByte(b))
return S_FALSE;
UInt64 rem = *outSize - pos;
if (b & 0x80)
{
unsigned num = (b & 0x7F) + 1;
if (num > rem)
return S_FALSE;
for (unsigned i = 0; i < num; i++)
{
if (!m_InStream.ReadByte(b))
return S_FALSE;
m_OutWindowStream.PutByte(b);
}
pos += num;
continue;
}
Byte b1;
if (!m_InStream.ReadByte(b1))
return S_FALSE;
UInt32 len, distance;
if (b & 0x40)
{
len = ((UInt32)b & 0x3F) + 4;
Byte b2;
if (!m_InStream.ReadByte(b2))
return S_FALSE;
distance = ((UInt32)b1 << 8) + b2;
}
else
{
b &= 0x3F;
len = ((UInt32)b >> 2) + 3;
distance = (((UInt32)b & 3) << 8) + b1;
}
if (distance >= pos || len > rem)
return S_FALSE;
m_OutWindowStream.CopyBlock(distance, len);
pos += len;
}
if (*inSize != m_InStream.GetProcessedSize())
return S_FALSE;
coderReleaser.NeedFlush = false;
return m_OutWindowStream.Flush();
}
STDMETHODIMP CAdcDecoder::Code(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress)
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress);}
catch(const CInBufferException &e) { return e.ErrorCode; }
catch(const CLzOutWindowException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
}
STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems, STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
Int32 testMode, IArchiveExtractCallback *extractCallback) Int32 testMode, IArchiveExtractCallback *extractCallback)
{ {
@@ -617,6 +751,9 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
NCompress::NZlib::CDecoder *zlibCoderSpec = new NCompress::NZlib::CDecoder(); NCompress::NZlib::CDecoder *zlibCoderSpec = new NCompress::NZlib::CDecoder();
CMyComPtr<ICompressCoder> zlibCoder = zlibCoderSpec; CMyComPtr<ICompressCoder> zlibCoder = zlibCoderSpec;
CAdcDecoder *adcCoderSpec = new CAdcDecoder();
CMyComPtr<ICompressCoder> adcCoder = adcCoderSpec;
CLocalProgress *lps = new CLocalProgress; CLocalProgress *lps = new CLocalProgress;
CMyComPtr<ICompressProgressInfo> progress = lps; CMyComPtr<ICompressProgressInfo> progress = lps;
lps->Init(extractCallback, false); lps->Init(extractCallback, false);
@@ -691,7 +828,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
break; break;
} }
RINOK(_inStream->Seek(block.PackPos, STREAM_SEEK_SET, NULL)); RINOK(_inStream->Seek(item.StartPos + block.PackPos, STREAM_SEEK_SET, NULL));
streamSpec->Init(block.PackSize); streamSpec->Init(block.PackSize);
// UInt64 startSize = outStreamSpec->GetSize(); // UInt64 startSize = outStreamSpec->GetSize();
bool realMethod = true; bool realMethod = true;
@@ -716,11 +853,15 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
res = copyCoder->Code(inStream, outStream, NULL, NULL, progress); res = copyCoder->Code(inStream, outStream, NULL, NULL, progress);
break; break;
case METHOD_ADC:
{
res = adcCoder->Code(inStream, outStream, &block.PackSize, &block.UnpSize, progress);
break;
}
case METHOD_ZLIB: case METHOD_ZLIB:
{ {
res = zlibCoder->Code(inStream, outStream, NULL, NULL, progress); res = zlibCoder->Code(inStream, outStream, NULL, NULL, progress);
if (res != S_OK)
break;
break; break;
} }

View File

@@ -305,6 +305,27 @@ HRESULT CInArchive::ReadLocalItem(CItemEx &item)
return S_OK; return S_OK;
} }
static bool FlagsAreSame(CItem &i1, CItem &i2)
{
if (i1.CompressionMethod != i2.CompressionMethod)
return false;
// i1.Time
if (i1.Flags == i2.Flags)
return true;
UInt32 mask = 0xFFFF;
switch(i1.CompressionMethod)
{
case NFileHeader::NCompressionMethod::kDeflated:
mask = 0x7FF9;
break;
default:
if (i1.CompressionMethod <= NFileHeader::NCompressionMethod::kImploded)
mask = 0x7FFF;
}
return ((i1.Flags & mask) == (i2.Flags & mask));
}
HRESULT CInArchive::ReadLocalItemAfterCdItem(CItemEx &item) HRESULT CInArchive::ReadLocalItemAfterCdItem(CItemEx &item)
{ {
if (item.FromLocal) if (item.FromLocal)
@@ -316,25 +337,10 @@ HRESULT CInArchive::ReadLocalItemAfterCdItem(CItemEx &item)
if (ReadUInt32() != NSignature::kLocalFileHeader) if (ReadUInt32() != NSignature::kLocalFileHeader)
return S_FALSE; return S_FALSE;
RINOK(ReadLocalItem(localItem)); RINOK(ReadLocalItem(localItem));
if (item.Flags != localItem.Flags) if (!FlagsAreSame(item, localItem))
{ return S_FALSE;
UInt32 mask = 0xFFFF;
switch(item.CompressionMethod)
{
case NFileHeader::NCompressionMethod::kDeflated:
mask = 0x7FF9;
break;
default:
if (item.CompressionMethod <= NFileHeader::NCompressionMethod::kImploded)
mask = 0x7FFF;
}
if ((item.Flags & mask) != (localItem.Flags & mask))
return S_FALSE;
}
if (item.CompressionMethod != localItem.CompressionMethod || if ((!localItem.HasDescriptor() &&
// item.Time != localItem.Time ||
(!localItem.HasDescriptor() &&
( (
item.FileCRC != localItem.FileCRC || item.FileCRC != localItem.FileCRC ||
item.PackSize != localItem.PackSize || item.PackSize != localItem.PackSize ||
@@ -597,9 +603,10 @@ HRESULT CInArchive::ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt
return res; return res;
} }
HRESULT CInArchive::ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt *progress, UInt64 &cdOffset) HRESULT CInArchive::ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt *progress, UInt64 &cdOffset, int &numCdItems)
{ {
items.Clear(); items.Clear();
numCdItems = 0;
while (m_Signature == NSignature::kLocalFileHeader) while (m_Signature == NSignature::kLocalFileHeader)
{ {
// FSeek points to next byte after signature // FSeek points to next byte after signature
@@ -616,10 +623,14 @@ HRESULT CInArchive::ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt
break; break;
} }
cdOffset = m_Position - 4; cdOffset = m_Position - 4;
for (int i = 0; i < items.Size(); i++) int i;
for (i = 0; i < items.Size(); i++, numCdItems++)
{ {
if (progress && i % 1000 == 0) if (progress && i % 1000 == 0)
RINOK(progress->SetCompleted(items.Size())); RINOK(progress->SetCompleted(items.Size()));
if (m_Signature == NSignature::kEndOfCentralDir)
break;
if (m_Signature != NSignature::kCentralFileHeader) if (m_Signature != NSignature::kCentralFileHeader)
return S_FALSE; return S_FALSE;
@@ -627,7 +638,20 @@ HRESULT CInArchive::ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt
RINOK(ReadCdItem(cdItem)); RINOK(ReadCdItem(cdItem));
if (i == 0) if (i == 0)
m_ArchiveInfo.Base = items[i].LocalHeaderPosition - cdItem.LocalHeaderPosition; {
int j;
for (j = 0; j < items.Size(); j++)
{
CItemEx &item = items[j];
if (item.Name == cdItem.Name)
{
m_ArchiveInfo.Base = item.LocalHeaderPosition - cdItem.LocalHeaderPosition;
break;
}
}
if (j == items.Size())
return S_FALSE;
}
int index; int index;
int left = 0, right = items.Size(); int left = 0, right = items.Size();
@@ -645,15 +669,13 @@ HRESULT CInArchive::ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt
left = index + 1; left = index + 1;
} }
CItemEx &item = items[index]; CItemEx &item = items[index];
item.LocalHeaderPosition = cdItem.LocalHeaderPosition; // item.LocalHeaderPosition = cdItem.LocalHeaderPosition;
item.MadeByVersion = cdItem.MadeByVersion; item.MadeByVersion = cdItem.MadeByVersion;
item.CentralExtra = cdItem.CentralExtra; item.CentralExtra = cdItem.CentralExtra;
if ( if (
// item.ExtractVersion != cdItem.ExtractVersion || // item.ExtractVersion != cdItem.ExtractVersion ||
item.Flags != cdItem.Flags || !FlagsAreSame(item, cdItem) ||
item.CompressionMethod != cdItem.CompressionMethod ||
// item.Time != cdItem.Time ||
item.FileCRC != cdItem.FileCRC) item.FileCRC != cdItem.FileCRC)
return S_FALSE; return S_FALSE;
@@ -670,6 +692,8 @@ HRESULT CInArchive::ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt
if (!ReadUInt32(m_Signature)) if (!ReadUInt32(m_Signature))
return S_FALSE; return S_FALSE;
} }
for (i = 0; i < items.Size(); i++)
items[i].LocalHeaderPosition -= m_ArchiveInfo.Base;
return S_OK; return S_OK;
} }
@@ -753,6 +777,7 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *pr
res = S_FALSE; res = S_FALSE;
*/ */
int numCdItems = items.Size();
if (res == S_FALSE) if (res == S_FALSE)
{ {
_inBufMode = false; _inBufMode = false;
@@ -762,7 +787,7 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *pr
return S_FALSE; return S_FALSE;
if (!ReadUInt32(m_Signature)) if (!ReadUInt32(m_Signature))
return S_FALSE; return S_FALSE;
RINOK(ReadLocalsAndCd(items, progress, cdStartOffset)); RINOK(ReadLocalsAndCd(items, progress, cdStartOffset, numCdItems));
cdSize = (m_Position - 4) - cdStartOffset; cdSize = (m_Position - 4) - cdStartOffset;
cdStartOffset -= m_ArchiveInfo.Base; cdStartOffset -= m_ArchiveInfo.Base;
} }
@@ -785,8 +810,8 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *pr
return S_FALSE; return S_FALSE;
if (ecd64.thisDiskNumber != 0 || ecd64.startCDDiskNumber != 0) if (ecd64.thisDiskNumber != 0 || ecd64.startCDDiskNumber != 0)
throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported); throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported);
if (ecd64.numEntriesInCDOnThisDisk != items.Size() || if (ecd64.numEntriesInCDOnThisDisk != numCdItems ||
ecd64.numEntriesInCD != items.Size() || ecd64.numEntriesInCD != numCdItems ||
ecd64.cdSize != cdSize || ecd64.cdSize != cdSize ||
(ecd64.cdStartOffset != cdStartOffset && (ecd64.cdStartOffset != cdStartOffset &&
(!items.IsEmpty()))) (!items.IsEmpty())))
@@ -822,8 +847,8 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *pr
if (ecd64.thisDiskNumber != 0 || ecd64.startCDDiskNumber != 0) if (ecd64.thisDiskNumber != 0 || ecd64.startCDDiskNumber != 0)
throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported); throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported);
if ((UInt16)ecd64.numEntriesInCDOnThisDisk != ((UInt16)items.Size()) || if ((UInt16)ecd64.numEntriesInCDOnThisDisk != ((UInt16)numCdItems) ||
(UInt16)ecd64.numEntriesInCD != ((UInt16)items.Size()) || (UInt16)ecd64.numEntriesInCD != ((UInt16)numCdItems) ||
(UInt32)ecd64.cdSize != (UInt32)cdSize || (UInt32)ecd64.cdSize != (UInt32)cdSize ||
((UInt32)(ecd64.cdStartOffset) != (UInt32)cdStartOffset && ((UInt32)(ecd64.cdStartOffset) != (UInt32)cdStartOffset &&
(!items.IsEmpty()))) (!items.IsEmpty())))
@@ -831,6 +856,7 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *pr
_inBufMode = false; _inBufMode = false;
_inBuffer.Free(); _inBuffer.Free();
IsOkHeaders = (numCdItems == items.Size());
return S_OK; return S_OK;
} }

View File

@@ -99,10 +99,11 @@ class CInArchive
HRESULT FindCd(CCdInfo &cdInfo); HRESULT FindCd(CCdInfo &cdInfo);
HRESULT TryReadCd(CObjectVector<CItemEx> &items, UInt64 cdOffset, UInt64 cdSize, CProgressVirt *progress); HRESULT TryReadCd(CObjectVector<CItemEx> &items, UInt64 cdOffset, UInt64 cdSize, CProgressVirt *progress);
HRESULT ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt64 &cdSize, CProgressVirt *progress); HRESULT ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt64 &cdSize, CProgressVirt *progress);
HRESULT ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt *progress, UInt64 &cdOffset); HRESULT ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt *progress, UInt64 &cdOffset, int &numCdItems);
public: public:
CInArchiveInfo m_ArchiveInfo; CInArchiveInfo m_ArchiveInfo;
bool IsZip64; bool IsZip64;
bool IsOkHeaders;
HRESULT ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *progress); HRESULT ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *progress);
HRESULT ReadLocalItemAfterCdItem(CItemEx &item); HRESULT ReadLocalItemAfterCdItem(CItemEx &item);

View File

@@ -817,7 +817,7 @@ HRESULT Update(
if(inArchive != 0) if(inArchive != 0)
{ {
inArchive->GetArchiveInfo(archiveInfo); inArchive->GetArchiveInfo(archiveInfo);
if (archiveInfo.Base != 0) if (archiveInfo.Base != 0 || !inArchive->IsOkHeaders)
return E_NOTIMPL; return E_NOTIMPL;
} }
else else

View File

@@ -1,8 +1,8 @@
#define MY_VER_MAJOR 9 #define MY_VER_MAJOR 9
#define MY_VER_MINOR 06 #define MY_VER_MINOR 07
#define MY_VER_BUILD 0 #define MY_VER_BUILD 0
#define MY_VERSION "9.06 beta" #define MY_VERSION "9.07 beta"
#define MY_7ZIP_VERSION "7-Zip 9.06 beta" #define MY_7ZIP_VERSION "7-Zip 9.07 beta"
#define MY_DATE "2009-08-17" #define MY_DATE "2009-08-29"
#define MY_COPYRIGHT "Copyright (c) 1999-2009 Igor Pavlov" #define MY_COPYRIGHT "Copyright (c) 1999-2009 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE

View File

@@ -140,7 +140,7 @@ HRESULT CArc::OpenStream(
} }
#ifndef _SFX #ifndef _SFX
if (numFinded == 0) if (orderIndices.Size() >= 2 && (numFinded == 0 || extension.CompareNoCase(L"exe") == 0))
{ {
CIntVector orderIndices2; CIntVector orderIndices2;
CByteBuffer byteBuffer; CByteBuffer byteBuffer;

View File

@@ -16,6 +16,8 @@ extern HWND g_HWND;
const int kNumPanelsMax = 2; const int kNumPanelsMax = 2;
extern bool g_IsSmallScreen;
enum enum
{ {
kAddCommand = kToolbarStartID, kAddCommand = kToolbarStartID,
@@ -202,8 +204,8 @@ public:
void RefreshStatusBar() { GetFocusedPanel().RefreshStatusBar(); } void RefreshStatusBar() { GetFocusedPanel().RefreshStatusBar(); }
void SetListViewMode(UINT32 index) { GetFocusedPanel().SetListViewMode(index); } void SetListViewMode(UInt32 index) { GetFocusedPanel().SetListViewMode(index); }
UINT32 GetListViewMode() { return GetFocusedPanel().GetListViewMode(); } UInt32 GetListViewMode() { return GetFocusedPanel().GetListViewMode(); }
PROPID GetSortID() { return GetFocusedPanel().GetSortID(); } PROPID GetSortID() { return GetFocusedPanel().GetSortID(); }
void SortItemsWithPropID(PROPID propID) { GetFocusedPanel().SortItemsWithPropID(propID); } void SortItemsWithPropID(PROPID propID) { GetFocusedPanel().SortItemsWithPropID(propID); }
@@ -248,15 +250,24 @@ public:
void ReloadToolbars(); void ReloadToolbars();
void ReadToolbar() void ReadToolbar()
{ {
UINT32 mask = ReadToolbarsMask(); UInt32 mask = ReadToolbarsMask();
ShowButtonsLables = ((mask & 1) != 0); if (mask & ((UInt32)1 << 31))
LargeButtons = ((mask & 2) != 0); {
ShowStandardToolbar = ((mask & 4) != 0); ShowButtonsLables = !g_IsSmallScreen;
ShowArchiveToolbar = ((mask & 8) != 0); LargeButtons = false;
ShowStandardToolbar = ShowArchiveToolbar = true;
}
else
{
ShowButtonsLables = ((mask & 1) != 0);
LargeButtons = ((mask & 2) != 0);
ShowStandardToolbar = ((mask & 4) != 0);
ShowArchiveToolbar = ((mask & 8) != 0);
}
} }
void SaveToolbar() void SaveToolbar()
{ {
UINT32 mask = 0; UInt32 mask = 0;
if (ShowButtonsLables) mask |= 1; if (ShowButtonsLables) mask |= 1;
if (LargeButtons) mask |= 2; if (LargeButtons) mask |= 2;
if (ShowStandardToolbar) mask |= 4; if (ShowStandardToolbar) mask |= 4;

View File

@@ -14,7 +14,8 @@ using namespace NWindows;
static CIDLangPair kIDLangPairs[] = static CIDLangPair kIDLangPairs[] =
{ {
{ IDC_EDIT_STATIC_EDITOR, 0x03010201} { IDC_EDIT_STATIC_EDITOR, 0x03010201},
{ IDC_EDIT_STATIC_DIFF, 0x03010202}
}; };
static LPCWSTR kEditTopic = L"FM/options.htm#editor"; static LPCWSTR kEditTopic = L"FM/options.htm#editor";
@@ -23,18 +24,34 @@ bool CEditPage::OnInit()
{ {
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0])); LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
_editorEdit.Attach(GetItem(IDC_EDIT_EDIT_EDITOR)); _editor.Attach(GetItem(IDC_EDIT_EDIT_EDITOR));
UString editorPath; _diff.Attach(GetItem(IDC_EDIT_EDIT_DIFF));
ReadRegEditor(editorPath);
_editorEdit.SetText(editorPath); {
UString path;
ReadRegEditor(path);
_editor.SetText(path);
}
{
UString path;
ReadRegDiff(path);
_diff.SetText(path);
}
return CPropertyPage::OnInit(); return CPropertyPage::OnInit();
} }
LONG CEditPage::OnApply() LONG CEditPage::OnApply()
{ {
UString editorPath; {
_editorEdit.GetText(editorPath); UString path;
SaveRegEditor(editorPath); _editor.GetText(path);
SaveRegEditor(path);
}
{
UString path;
_diff.GetText(path);
SaveRegDiff(path);
}
return PSNRET_NOERROR; return PSNRET_NOERROR;
} }
@@ -43,29 +60,37 @@ void CEditPage::OnNotifyHelp()
ShowHelpWindow(NULL, kEditTopic); ShowHelpWindow(NULL, kEditTopic);
} }
static void Edit_BrowseForFile(NWindows::NControl::CEdit &edit, HWND hwnd)
{
UString path;
edit.GetText(path);
UString resPath;
if (MyBrowseForFile(hwnd, 0, path, L"*.exe", resPath))
{
edit.SetText(resPath);
// Changed();
}
}
bool CEditPage::OnButtonClicked(int buttonID, HWND buttonHWND) bool CEditPage::OnButtonClicked(int buttonID, HWND buttonHWND)
{ {
switch (buttonID) switch (buttonID)
{ {
case IDC_EDIT_BUTTON_SET: case IDC_EDIT_BUTTON_EDITOR:
{ Edit_BrowseForFile(_editor, *this);
UString editorPath; return true;
_editorEdit.GetText(editorPath); case IDC_EDIT_BUTTON_DIFF:
UString resPath; Edit_BrowseForFile(_diff, *this);
if (MyBrowseForFile(HWND(*this), 0, editorPath, L"*.exe", resPath))
{
_editorEdit.SetText(resPath);
// Changed();
}
return true; return true;
}
} }
return CPropertyPage::OnButtonClicked(buttonID, buttonHWND); return CPropertyPage::OnButtonClicked(buttonID, buttonHWND);
} }
bool CEditPage::OnCommand(int code, int itemID, LPARAM param) bool CEditPage::OnCommand(int code, int itemID, LPARAM param)
{ {
if (code == EN_CHANGE && itemID == IDC_EDIT_EDIT_EDITOR) if (code == EN_CHANGE &&
(itemID == IDC_EDIT_EDIT_EDITOR ||
itemID == IDC_EDIT_EDIT_DIFF))
{ {
Changed(); Changed();
return true; return true;

View File

@@ -8,7 +8,8 @@
class CEditPage: public NWindows::NControl::CPropertyPage class CEditPage: public NWindows::NControl::CPropertyPage
{ {
NWindows::NControl::CEdit _editorEdit; NWindows::NControl::CEdit _editor;
NWindows::NControl::CEdit _diff;
public: public:
virtual bool OnInit(); virtual bool OnInit();
virtual void OnNotifyHelp(); virtual void OnNotifyHelp();

View File

@@ -1,13 +1,19 @@
#include "EditPageRes.h" #include "EditPageRes.h"
#include "../../GuiCommon.rc" #include "../../GuiCommon.rc"
#define xc SMALL_PAGE_SIZE_X #define xc 200
#define yc 60 #define yc 80
IDD_EDIT MY_PAGE IDD_EDIT MY_PAGE
CAPTION "Editor" #include "EditPage2.rc"
{
LTEXT "&Editor:", IDC_EDIT_STATIC_EDITOR, m, m, xc, 8 #ifdef UNDER_CE
EDITTEXT IDC_EDIT_EDIT_EDITOR, m, 20, xc - m - bxsDots, 14, ES_AUTOHSCROLL
PUSHBUTTON "...", IDC_EDIT_BUTTON_SET, xs - m - bxsDots, 19, bxsDots, bys #undef xc
}
#define xc SMALL_PAGE_SIZE_X
IDD_EDIT_2 MY_PAGE
#include "EditPage2.rc"
#endif

View File

@@ -0,0 +1,9 @@
CAPTION "Editor"
{
LTEXT "&Editor:", IDC_EDIT_STATIC_EDITOR, m, m, xc, 8
EDITTEXT IDC_EDIT_EDIT_EDITOR, m, 20, xc - m - bxsDots, 14, ES_AUTOHSCROLL
PUSHBUTTON "...", IDC_EDIT_BUTTON_EDITOR, xs - m - bxsDots, 19, bxsDots, bys
LTEXT "&Diff:", IDC_EDIT_STATIC_DIFF, m, 40, xc, 8
EDITTEXT IDC_EDIT_EDIT_DIFF, m, 52, xc - m - bxsDots, 14, ES_AUTOHSCROLL
PUSHBUTTON "...", IDC_EDIT_BUTTON_DIFF, xs - m - bxsDots, 51, bxsDots, bys
}

View File

@@ -1,4 +1,10 @@
#define IDD_EDIT 542 #define IDD_EDIT 542
#define IDC_EDIT_STATIC_EDITOR 1000 #define IDD_EDIT_2 642
#define IDC_EDIT_EDIT_EDITOR 1002
#define IDC_EDIT_BUTTON_SET 1003 #define IDC_EDIT_STATIC_EDITOR 1000
#define IDC_EDIT_EDIT_EDITOR 1001
#define IDC_EDIT_BUTTON_EDITOR 1002
#define IDC_EDIT_STATIC_DIFF 1010
#define IDC_EDIT_EDIT_DIFF 1011
#define IDC_EDIT_BUTTON_DIFF 1012

View File

@@ -43,6 +43,8 @@ static bool g_Maximized = false;
DWORD g_ComCtl32Version; DWORD g_ComCtl32Version;
#endif #endif
bool g_IsSmallScreen = false;
bool g_LVN_ITEMACTIVATE_Support = true; bool g_LVN_ITEMACTIVATE_Support = true;
// LVN_ITEMACTIVATE replaces both NM_DBLCLK & NM_RETURN // LVN_ITEMACTIVATE replaces both NM_DBLCLK & NM_RETURN
// Windows 2000 // Windows 2000
@@ -418,6 +420,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
g_LVN_ITEMACTIVATE_Support = (g_ComCtl32Version >= MAKELONG(71, 4)); g_LVN_ITEMACTIVATE_Support = (g_ComCtl32Version >= MAKELONG(71, 4));
#endif #endif
g_IsSmallScreen = !NWindows::NControl::IsDialogSizeOK(200, 200);
// OleInitialize is required for drag and drop. // OleInitialize is required for drag and drop.
#ifndef UNDER_CE #ifndef UNDER_CE
OleInitialize(NULL); OleInitialize(NULL);

View File

@@ -64,6 +64,7 @@ static const CIDLangPair kIDLangPairs[] =
{ IDM_FILE_PROPERTIES, 0x03000240 }, { IDM_FILE_PROPERTIES, 0x03000240 },
{ IDM_FILE_COMMENT, 0x03000241 }, { IDM_FILE_COMMENT, 0x03000241 },
{ IDM_FILE_CRC, 0x03000242 }, { IDM_FILE_CRC, 0x03000242 },
{ IDM_FILE_DIFF, 0x03000243 },
{ IDM_FILE_SPLIT, 0x03000270 }, { IDM_FILE_SPLIT, 0x03000270 },
{ IDM_FILE_COMBINE, 0x03000271 }, { IDM_FILE_COMBINE, 0x03000271 },
{ IDM_CREATE_FOLDER, 0x03000250 }, { IDM_CREATE_FOLDER, 0x03000250 },

View File

@@ -106,7 +106,7 @@ void OptionsDialog(HWND hwndOwner, HINSTANCE /* hInstance */)
// IDD_PLUGINS, // IDD_PLUGINS,
SIZED_DIALOG(IDD_MENU), SIZED_DIALOG(IDD_MENU),
SIZED_DIALOG(IDD_FOLDERS), SIZED_DIALOG(IDD_FOLDERS),
IDD_EDIT, SIZED_DIALOG(IDD_EDIT),
SIZED_DIALOG(IDD_SETTINGS), SIZED_DIALOG(IDD_SETTINGS),
SIZED_DIALOG(IDD_LANG) }; SIZED_DIALOG(IDD_LANG) };
NControl::CPropertyPage *pagePinters[] = { &systemPage, &menuPage, &foldersPage, &editPage, &settingsPage, &langPage }; NControl::CPropertyPage *pagePinters[] = { &systemPage, &menuPage, &foldersPage, &editPage, &settingsPage, &langPage };

View File

@@ -25,10 +25,10 @@ static CIDLangPair kIDLangPairs[] =
{ IDC_SETTINGS_SHOW_SYSTEM_MENU, 0x03010410}, { IDC_SETTINGS_SHOW_SYSTEM_MENU, 0x03010410},
{ IDC_SETTINGS_FULL_ROW, 0x03010420}, { IDC_SETTINGS_FULL_ROW, 0x03010420},
{ IDC_SETTINGS_SHOW_GRID, 0x03010421}, { IDC_SETTINGS_SHOW_GRID, 0x03010421},
{ IDC_SETTINGS_SINGLE_CLICK, 0x03010422},
// { IDC_SETTINGS_UNDERLINE, 0x03010423}
{ IDC_SETTINGS_ALTERNATIVE_SELECTION, 0x03010430}, { IDC_SETTINGS_ALTERNATIVE_SELECTION, 0x03010430},
{ IDC_SETTINGS_LARGE_PAGES, 0x03010440} { IDC_SETTINGS_LARGE_PAGES, 0x03010440}
// { IDC_SETTINGS_SINGLE_CLICK, 0x03010422},
// { IDC_SETTINGS_UNDERLINE, 0x03010423}
}; };
static LPCWSTR kEditTopic = L"FM/options.htm#settings"; static LPCWSTR kEditTopic = L"FM/options.htm#settings";

View File

@@ -281,7 +281,7 @@ void SaveToolbarsMask(UInt32 toolbarMask)
key.SetValue(kToolbars, toolbarMask); key.SetValue(kToolbars, toolbarMask);
} }
static const UInt32 kDefaultToolbarMask = 8 | 4 | 1; static const UInt32 kDefaultToolbarMask = ((UInt32)1 << 31) | 8 | 4 | 1;
UInt32 ReadToolbarsMask() UInt32 ReadToolbarsMask()
{ {

View File

@@ -10,8 +10,8 @@ AppName = "7-Zip"
InstallDir = %CE1%\%AppName% InstallDir = %CE1%\%AppName%
[Strings] [Strings]
AppVer = "9.06" AppVer = "9.07"
AppDate = "2009-08-17" AppDate = "2009-08-29"
[CEDevice] [CEDevice]
; ProcessorType = 2577 ; ARM ; ProcessorType = 2577 ; ARM

View File

@@ -2,7 +2,7 @@
;Defines ;Defines
!define VERSION_MAJOR 9 !define VERSION_MAJOR 9
!define VERSION_MINOR 06 !define VERSION_MINOR 07
!define VERSION_POSTFIX_FULL " beta" !define VERSION_POSTFIX_FULL " beta"
!ifdef WIN64 !ifdef WIN64
!ifdef IA64 !ifdef IA64

View File

@@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<?define VerMajor = "9" ?> <?define VerMajor = "9" ?>
<?define VerMinor = "06" ?> <?define VerMinor = "07" ?>
<?define VerBuild = "00" ?> <?define VerBuild = "00" ?>
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?> <?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
<?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?> <?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?>

View File

@@ -1,7 +1,7 @@
7-Zip 9.04 Sources 7-Zip 9.07 Sources
------------------ ------------------
7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP/Vista. 7-Zip is a file archiver for Windows.
7-Zip Copyright (C) 1999-2009 Igor Pavlov. 7-Zip Copyright (C) 1999-2009 Igor Pavlov.