Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/CPP
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2010-04-15 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:16:03 +0300
commit3dacb5eb8afda99aad81f4723cb966c0fa91ba1d (patch)
tree1e1f05aaadf64b4ff99d21bcd4282e8ab4365396 /CPP
parent76b173af78d09dea806d3ed35c0f67a09b496357 (diff)
9.139.13
Diffstat (limited to 'CPP')
-rwxr-xr-xCPP/7zip/Archive/7z/7zDecode.cpp2
-rwxr-xr-xCPP/7zip/Archive/7z/7zUpdate.cpp6
-rwxr-xr-xCPP/7zip/Archive/Cab/CabHandler.cpp141
-rwxr-xr-xCPP/7zip/Archive/Common/CoderMixer2MT.cpp28
-rwxr-xr-xCPP/7zip/Archive/MachoHandler.cpp61
-rwxr-xr-xCPP/7zip/Archive/Nsis/NsisHandler.cpp55
-rwxr-xr-xCPP/7zip/Archive/Nsis/NsisHandler.h2
-rwxr-xr-xCPP/7zip/Archive/Nsis/NsisIn.cpp1
-rwxr-xr-xCPP/7zip/Archive/Nsis/NsisIn.h2
-rwxr-xr-xCPP/7zip/Archive/PeHandler.cpp35
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipHandler.cpp10
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipHandler.h2
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipIn.cpp52
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipIn.h6
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipOut.cpp8
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipOut.h2
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipUpdate.cpp31
-rwxr-xr-xCPP/7zip/Bundles/Fm/FM.dsp8
-rwxr-xr-xCPP/7zip/Bundles/Fm/makefile1
-rwxr-xr-xCPP/7zip/Compress/Bcj2Coder.cpp76
-rwxr-xr-xCPP/7zip/Compress/Bcj2Coder.h50
-rwxr-xr-xCPP/7zip/Compress/LzmaDecoder.cpp47
-rwxr-xr-xCPP/7zip/Compress/LzmaDecoder.h12
-rwxr-xr-xCPP/7zip/Compress/PpmdZip.h2
-rwxr-xr-xCPP/7zip/Guid.txt28
-rwxr-xr-xCPP/7zip/ICoder.h6
-rwxr-xr-xCPP/7zip/MyVersion.h8
-rwxr-xr-xCPP/7zip/UI/Agent/Agent.cpp86
-rwxr-xr-xCPP/7zip/UI/Agent/Agent.h12
-rwxr-xr-xCPP/7zip/UI/Agent/ArchiveFolderOpen.cpp5
-rwxr-xr-xCPP/7zip/UI/Agent/IFolderArchive.h4
-rwxr-xr-xCPP/7zip/UI/Common/Bench.cpp4
-rwxr-xr-xCPP/7zip/UI/Console/Console.dsp38
-rwxr-xr-xCPP/7zip/UI/Console/List.cpp26
-rwxr-xr-xCPP/7zip/UI/Explorer/ContextMenu.cpp119
-rwxr-xr-xCPP/7zip/UI/Explorer/ContextMenu.h42
-rwxr-xr-xCPP/7zip/UI/Explorer/ContextMenuFlags.h42
-rwxr-xr-xCPP/7zip/UI/Explorer/DllExports.cpp4
-rwxr-xr-xCPP/7zip/UI/Far/Main.cpp2
-rwxr-xr-xCPP/7zip/UI/Far/Messages.h1
-rwxr-xr-xCPP/7zip/UI/Far/Plugin.cpp110
-rwxr-xr-xCPP/7zip/UI/Far/PluginWrite.cpp2
-rwxr-xr-xCPP/7zip/UI/FileManager/App.cpp17
-rwxr-xr-xCPP/7zip/UI/FileManager/App.h4
-rwxr-xr-xCPP/7zip/UI/FileManager/ClassDefs.cpp4
-rwxr-xr-xCPP/7zip/UI/FileManager/FM.cpp7
-rwxr-xr-xCPP/7zip/UI/FileManager/FM.dsp8
-rwxr-xr-xCPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp5
-rwxr-xr-xCPP/7zip/UI/FileManager/FileFolderPluginOpen.h4
-rwxr-xr-xCPP/7zip/UI/FileManager/IFolder.h26
-rwxr-xr-xCPP/7zip/UI/FileManager/MenuPage.cpp3
-rwxr-xr-xCPP/7zip/UI/FileManager/MenuPage.rc2
-rwxr-xr-xCPP/7zip/UI/FileManager/Panel.cpp23
-rwxr-xr-xCPP/7zip/UI/FileManager/Panel.h8
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelFolderChange.cpp6
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelItemOpen.cpp12
-rwxr-xr-xCPP/7zip/UI/FileManager/PanelMenu.cpp100
-rwxr-xr-xCPP/7zip/UI/FileManager/PluginInterface.h35
-rwxr-xr-xCPP/7zip/UI/FileManager/makefile1
-rwxr-xr-xCPP/Windows/PropVariant.cpp167
-rwxr-xr-xCPP/Windows/PropVariant.h34
61 files changed, 896 insertions, 749 deletions
diff --git a/CPP/7zip/Archive/7z/7zDecode.cpp b/CPP/7zip/Archive/7z/7zDecode.cpp
index ab3db913..425a3415 100755
--- a/CPP/7zip/Archive/7z/7zDecode.cpp
+++ b/CPP/7zip/Archive/7z/7zDecode.cpp
@@ -232,7 +232,7 @@ HRESULT CDecoder::Decode(
size_t size = props.GetCapacity();
if (size > 0xFFFFFFFF)
return E_NOTIMPL;
- if (size > 0)
+ // if (size > 0)
{
RINOK(setDecoderProperties->SetDecoderProperties2((const Byte *)props, (UInt32)size));
}
diff --git a/CPP/7zip/Archive/7z/7zUpdate.cpp b/CPP/7zip/Archive/7z/7zUpdate.cpp
index 7b9e49e1..ee7f55c0 100755
--- a/CPP/7zip/Archive/7z/7zUpdate.cpp
+++ b/CPP/7zip/Archive/7z/7zUpdate.cpp
@@ -382,6 +382,12 @@ static void MakeExeMethod(const CCompressionMethodMode &method,
prop.Value = kNumFastBytesForBCJ2_LZMA;
methodFull.Props.Add(prop);
}
+ {
+ CProp prop;
+ prop.Id = NCoderPropID::kNumThreads;
+ prop.Value = (UInt32)1;
+ methodFull.Props.Add(prop);
+ }
exeMethod.Methods.Add(methodFull);
exeMethod.Methods.Add(methodFull);
diff --git a/CPP/7zip/Archive/Cab/CabHandler.cpp b/CPP/7zip/Archive/Cab/CabHandler.cpp
index 672172a6..9fb91423 100755
--- a/CPP/7zip/Archive/Cab/CabHandler.cpp
+++ b/CPP/7zip/Archive/Cab/CabHandler.cpp
@@ -2,6 +2,8 @@
#include "StdAfx.h"
+#include "../../../../C/Alloc.h"
+
#include "Common/Buffer.h"
#include "Common/ComTry.h"
#include "Common/Defs.h"
@@ -32,8 +34,6 @@ namespace NCab {
// #define _CAB_DETAILS
-static const UInt32 kMaxTempBufSize = 1 << 20;
-
#ifdef _CAB_DETAILS
enum
{
@@ -344,9 +344,10 @@ private:
const CMvDatabaseEx *m_Database;
const CRecordVector<bool> *m_ExtractStatuses;
- CByteBuffer TempBuf;
+ Byte *TempBuf;
+ UInt32 TempBufSize;
+ int NumIdenticalFiles;
bool TempBufMode;
- bool IsSupported;
UInt32 m_BufStartFolderOffset;
int m_StartIndex;
@@ -362,12 +363,21 @@ private:
UInt64 m_FolderSize;
UInt64 m_PosInFolder;
+ void FreeTempBuf()
+ {
+ ::MyFree(TempBuf);
+ TempBuf = NULL;
+ }
+
HRESULT OpenFile();
+ HRESULT CloseFileWithResOp(Int32 resOp);
HRESULT CloseFile();
HRESULT Write2(const void *data, UInt32 size, UInt32 *processedSize, bool isOK);
public:
HRESULT WriteEmptyFiles();
+ CFolderOutStream(): TempBuf(NULL) {}
+ ~CFolderOutStream() { FreeTempBuf(); }
void Init(
const CMvDatabaseEx *database,
const CRecordVector<bool> *extractStatuses,
@@ -403,54 +413,80 @@ void CFolderOutStream::Init(
m_FileIsOpen = false;
m_IsOk = true;
TempBufMode = false;
+ NumIdenticalFiles = 0;
}
-HRESULT CFolderOutStream::CloseFile()
+HRESULT CFolderOutStream::CloseFileWithResOp(Int32 resOp)
{
m_RealOutStream.Release();
- HRESULT res = m_ExtractCallback->SetOperationResult(m_IsOk ?
+ m_FileIsOpen = false;
+ NumIdenticalFiles--;
+ return m_ExtractCallback->SetOperationResult(resOp);
+}
+
+HRESULT CFolderOutStream::CloseFile()
+{
+ return CloseFileWithResOp(m_IsOk ?
NExtract::NOperationResult::kOK:
NExtract::NOperationResult::kDataError);
- m_FileIsOpen = false;
- return res;
}
HRESULT CFolderOutStream::OpenFile()
{
- Int32 askMode = (*m_ExtractStatuses)[m_CurrentIndex] ? (m_TestMode ?
- NExtract::NAskMode::kTest :
- NExtract::NAskMode::kExtract) :
- NExtract::NAskMode::kSkip;
-
- if (!TempBufMode)
+ if (NumIdenticalFiles == 0)
{
const CMvItem &mvItem = m_Database->Items[m_StartIndex + m_CurrentIndex];
const CItem &item = m_Database->Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex];
- int curIndex = m_CurrentIndex + 1;
- for (; curIndex < m_ExtractStatuses->Size(); curIndex++)
- if ((*m_ExtractStatuses)[curIndex])
- {
- const CMvItem &mvItem2 = m_Database->Items[m_StartIndex + curIndex];
- const CItem &item2 = m_Database->Volumes[mvItem2.VolumeIndex].Items[mvItem2.ItemIndex];
- if (item.Offset != item2.Offset ||
- item.Size != item2.Size ||
- item.Size == 0)
- break;
- }
- if (curIndex > m_CurrentIndex + 1)
+ int numExtractItems = 0;
+ int curIndex;
+ for (curIndex = m_CurrentIndex; curIndex < m_ExtractStatuses->Size(); curIndex++)
+ {
+ const CMvItem &mvItem2 = m_Database->Items[m_StartIndex + curIndex];
+ const CItem &item2 = m_Database->Volumes[mvItem2.VolumeIndex].Items[mvItem2.ItemIndex];
+ if (item.Offset != item2.Offset ||
+ item.Size != item2.Size ||
+ item.Size == 0)
+ break;
+ if (!m_TestMode && (*m_ExtractStatuses)[curIndex])
+ numExtractItems++;
+ }
+ NumIdenticalFiles = (curIndex - m_CurrentIndex);
+ if (NumIdenticalFiles == 0)
+ NumIdenticalFiles = 1;
+ TempBufMode = false;
+ if (numExtractItems > 1)
{
- size_t oldCapacity = TempBuf.GetCapacity();
- IsSupported = (item.Size <= kMaxTempBufSize);
- if (item.Size > oldCapacity && IsSupported)
+ if (!TempBuf || item.Size > TempBufSize)
{
- TempBuf.SetCapacity(0);
- TempBuf.SetCapacity(item.Size);
+ FreeTempBuf();
+ TempBuf = (Byte *)MyAlloc(item.Size);
+ TempBufSize = item.Size;
+ if (TempBuf == NULL)
+ return E_OUTOFMEMORY;
}
TempBufMode = true;
m_BufStartFolderOffset = item.Offset;
}
+ else if (numExtractItems == 1)
+ {
+ while (NumIdenticalFiles && !(*m_ExtractStatuses)[m_CurrentIndex])
+ {
+ CMyComPtr<ISequentialOutStream> stream;
+ RINOK(m_ExtractCallback->GetStream(m_StartIndex + m_CurrentIndex, &stream, NExtract::NAskMode::kSkip));
+ if (stream)
+ return E_FAIL;
+ RINOK(m_ExtractCallback->PrepareOperation(NExtract::NAskMode::kSkip));
+ m_CurrentIndex++;
+ m_FileIsOpen = true;
+ CloseFile();
+ }
+ }
}
+ Int32 askMode = (*m_ExtractStatuses)[m_CurrentIndex] ? (m_TestMode ?
+ NExtract::NAskMode::kTest :
+ NExtract::NAskMode::kExtract) :
+ NExtract::NAskMode::kSkip;
RINOK(m_ExtractCallback->GetStream(m_StartIndex + m_CurrentIndex, &m_RealOutStream, askMode));
if (!m_RealOutStream && !m_TestMode)
askMode = NExtract::NAskMode::kSkip;
@@ -499,7 +535,7 @@ HRESULT CFolderOutStream::Write2(const void *data, UInt32 size, UInt32 *processe
res = m_RealOutStream->Write((const Byte *)data, numBytesToWrite, &processedSizeLocal);
numBytesToWrite = processedSizeLocal;
}
- if (TempBufMode && IsSupported)
+ if (TempBufMode && TempBuf)
memcpy(TempBuf + (m_PosInFolder - m_BufStartFolderOffset), data, numBytesToWrite);
}
realProcessed += numBytesToWrite;
@@ -513,38 +549,27 @@ HRESULT CFolderOutStream::Write2(const void *data, UInt32 size, UInt32 *processe
return res;
if (m_RemainFileSize == 0)
{
- m_RealOutStream.Release();
RINOK(CloseFile());
- if (TempBufMode)
+ while (NumIdenticalFiles)
{
- while (m_CurrentIndex < m_ExtractStatuses->Size())
+ HRESULT result = OpenFile();
+ m_FileIsOpen = true;
+ m_CurrentIndex++;
+ if (result == S_OK && m_RealOutStream && TempBuf)
+ result = WriteStream(m_RealOutStream, TempBuf, (size_t)(m_PosInFolder - m_BufStartFolderOffset));
+
+ if (!TempBuf && TempBufMode && m_RealOutStream)
+ {
+ RINOK(CloseFileWithResOp(NExtract::NOperationResult::kUnSupportedMethod));
+ }
+ else
{
- const CMvItem &mvItem = m_Database->Items[m_StartIndex + m_CurrentIndex];
- const CItem &item = m_Database->Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex];
- if (item.Offset != m_BufStartFolderOffset)
- break;
- HRESULT result = OpenFile();
- m_FileIsOpen = true;
- m_CurrentIndex++;
- m_IsOk = true;
- if (result == S_OK && m_RealOutStream && IsSupported)
- result = WriteStream(m_RealOutStream, TempBuf, item.Size);
-
- if (IsSupported)
- {
- RINOK(CloseFile());
- RINOK(result);
- }
- else
- {
- m_RealOutStream.Release();
- RINOK(m_ExtractCallback->SetOperationResult(NExtract::NOperationResult::kUnSupportedMethod));
- m_FileIsOpen = false;
- }
+ RINOK(CloseFile());
}
- TempBufMode = false;
+ RINOK(result);
}
+ TempBufMode = false;
}
if (realProcessed > 0)
break; // with this break this function works as Write-Part
diff --git a/CPP/7zip/Archive/Common/CoderMixer2MT.cpp b/CPP/7zip/Archive/Common/CoderMixer2MT.cpp
index 1265dfcd..d76450bd 100755
--- a/CPP/7zip/Archive/Common/CoderMixer2MT.cpp
+++ b/CPP/7zip/Archive/Common/CoderMixer2MT.cpp
@@ -54,7 +54,7 @@ static void SetSizes(const UInt64 **srcSizes, CRecordVector<UInt64> &sizes,
{
sizes.Clear();
sizePointers.Clear();
- for(UInt32 i = 0; i < numItems; i++)
+ for (UInt32 i = 0; i < numItems; i++)
{
if (srcSizes == 0 || srcSizes[i] == NULL)
{
@@ -83,7 +83,7 @@ HRESULT CCoderMixer2MT::SetBindInfo(const CBindInfo &bindInfo)
{
_bindInfo = bindInfo;
_streamBinders.Clear();
- for(int i = 0; i < _bindInfo.BindPairs.Size(); i++)
+ for (int i = 0; i < _bindInfo.BindPairs.Size(); i++)
{
_streamBinders.Add(CStreamBinder());
RINOK(_streamBinders.Back().CreateEvents());
@@ -113,7 +113,7 @@ void CCoderMixer2MT::AddCoder2(ICompressCoder2 *coder)
void CCoderMixer2MT::ReInit()
{
- for(int i = 0; i < _streamBinders.Size(); i++)
+ for (int i = 0; i < _streamBinders.Size(); i++)
_streamBinders[i].ReInit();
}
@@ -125,20 +125,20 @@ HRESULT CCoderMixer2MT::Init(ISequentialInStream **inStreams, ISequentialOutStre
throw 0;
*/
int i;
- for(i = 0; i < _coders.Size(); i++)
+ for (i = 0; i < _coders.Size(); i++)
{
CCoder2 &coderInfo = _coders[i];
const CCoderStreamsInfo &coderStreamsInfo = _bindInfo.Coders[i];
coderInfo.InStreams.Clear();
UInt32 j;
- for(j = 0; j < coderStreamsInfo.NumInStreams; j++)
+ for (j = 0; j < coderStreamsInfo.NumInStreams; j++)
coderInfo.InStreams.Add(NULL);
coderInfo.OutStreams.Clear();
- for(j = 0; j < coderStreamsInfo.NumOutStreams; j++)
+ for (j = 0; j < coderStreamsInfo.NumOutStreams; j++)
coderInfo.OutStreams.Add(NULL);
}
- for(i = 0; i < _bindInfo.BindPairs.Size(); i++)
+ for (i = 0; i < _bindInfo.BindPairs.Size(); i++)
{
const CBindPair &bindPair = _bindInfo.BindPairs[i];
UInt32 inCoderIndex, inCoderStreamIndex;
@@ -149,16 +149,26 @@ HRESULT CCoderMixer2MT::Init(ISequentialInStream **inStreams, ISequentialOutStre
_streamBinders[i].CreateStreams(
&_coders[inCoderIndex].InStreams[inCoderStreamIndex],
&_coders[outCoderIndex].OutStreams[outCoderStreamIndex]);
+
+ CMyComPtr<ICompressSetBufSize> inSetSize, outSetSize;
+ _coders[inCoderIndex].QueryInterface(IID_ICompressSetBufSize, (void **)&inSetSize);
+ _coders[outCoderIndex].QueryInterface(IID_ICompressSetBufSize, (void **)&outSetSize);
+ if (inSetSize && outSetSize)
+ {
+ const UInt32 kBufSize = 1 << 19;
+ inSetSize->SetInBufSize(inCoderStreamIndex, kBufSize);
+ outSetSize->SetOutBufSize(outCoderStreamIndex, kBufSize);
+ }
}
- for(i = 0; i < _bindInfo.InStreams.Size(); i++)
+ for (i = 0; i < _bindInfo.InStreams.Size(); i++)
{
UInt32 inCoderIndex, inCoderStreamIndex;
_bindInfo.FindInStream(_bindInfo.InStreams[i], inCoderIndex, inCoderStreamIndex);
_coders[inCoderIndex].InStreams[inCoderStreamIndex] = inStreams[i];
}
- for(i = 0; i < _bindInfo.OutStreams.Size(); i++)
+ for (i = 0; i < _bindInfo.OutStreams.Size(); i++)
{
UInt32 outCoderIndex, outCoderStreamIndex;
_bindInfo.FindOutStream(_bindInfo.OutStreams[i], outCoderIndex, outCoderStreamIndex);
diff --git a/CPP/7zip/Archive/MachoHandler.cpp b/CPP/7zip/Archive/MachoHandler.cpp
index 8d313b54..ad4a5afb 100755
--- a/CPP/7zip/Archive/MachoHandler.cpp
+++ b/CPP/7zip/Archive/MachoHandler.cpp
@@ -41,7 +41,7 @@ namespace NMacho {
#define MACH_SECT_ATTR_ZEROFILL 1
-const char *g_SectTypes[] =
+static const char *g_SectTypes[] =
{
"REGULAR",
"ZEROFILL",
@@ -60,7 +60,7 @@ const char *g_SectTypes[] =
"16BYTE_LITERALS"
};
-const char *g_FileTypes[] =
+static const char *g_FileTypes[] =
{
"0",
"OBJECT",
@@ -111,11 +111,18 @@ struct CSection
char Name[kNameSize];
char SegName[kNameSize];
UInt64 Va;
- UInt64 Size;
- UInt32 Pa;
+ UInt64 Pa;
+ UInt64 VSize;
+ UInt64 PSize;
+
UInt32 Flags;
int SegmentIndex;
- UInt64 GetPackSize() const { return Flags == MACH_SECT_ATTR_ZEROFILL ? 0 : Size; }
+
+ bool IsDummy;
+
+ CSection(): IsDummy(false) {}
+ // UInt64 GetPackSize() const { return Flags == MACH_SECT_ATTR_ZEROFILL ? 0 : Size; }
+ UInt64 GetPackSize() const { return PSize; }
};
@@ -195,8 +202,9 @@ bool CHandler::Parse(const Byte *buf, UInt32 size)
if (cmdSize < offs)
break;
+ UInt64 vmAddr, vmSize, phAddr, phSize;
+
{
- UInt64 vmAddr, vmSize, phAddr, phSize;
if (cmd == MACH_CMD_SEGMENT_64)
{
vmAddr = Get64(buf + 0x18, be);
@@ -226,7 +234,19 @@ bool CHandler::Parse(const Byte *buf, UInt32 size)
if (numSections > (1 << 8))
return false;
- while (numSections-- != 0)
+ if (numSections == 0)
+ {
+ CSection section;
+ section.IsDummy = true;
+ section.SegmentIndex = _segments.Size() - 1;
+ section.Va = vmAddr;
+ section.PSize = phSize;
+ section.VSize = vmSize;
+ section.Pa = phAddr;
+ section.Flags = 0;
+ _sections.Add(section);
+ }
+ else do
{
CSection section;
UInt32 headerSize = (cmd == MACH_CMD_SEGMENT_64) ? 0x50 : 0x44;
@@ -236,23 +256,29 @@ bool CHandler::Parse(const Byte *buf, UInt32 size)
if (cmd == MACH_CMD_SEGMENT_64)
{
section.Va = Get64(p + 0x20, be);
- section.Size = Get64(p + 0x28, be);
+ section.VSize = Get64(p + 0x28, be);
section.Pa = Get32(p + 0x30, be);
section.Flags = Get32(p + 0x40, be);
}
else
{
section.Va = Get32(p + 0x20, be);
- section.Size = Get32(p + 0x24, be);
+ section.VSize = Get32(p + 0x24, be);
section.Pa = Get32(p + 0x28, be);
section.Flags = Get32(p + 0x38, be);
}
+ if (section.Flags == MACH_SECT_ATTR_ZEROFILL)
+ section.PSize = 0;
+ else
+ section.PSize = section.VSize;
memcpy(section.Name, p, kNameSize);
memcpy(section.SegName, p + kNameSize, kNameSize);
section.SegmentIndex = _segments.Size() - 1;
_sections.Add(section);
offs += headerSize;
}
+ while (--numSections);
+
if (offs != cmdSize)
return false;
}
@@ -263,7 +289,7 @@ bool CHandler::Parse(const Byte *buf, UInt32 size)
return reduceCommands || (size == 0);
}
-STATPROPSTG kArcProps[] =
+static STATPROPSTG kArcProps[] =
{
{ NULL, kpidCpu, VT_BSTR},
{ NULL, kpidBit64, VT_BOOL},
@@ -273,7 +299,7 @@ STATPROPSTG kArcProps[] =
{ NULL, kpidHeadersSize, VT_UI4}
};
-STATPROPSTG kProps[] =
+static STATPROPSTG kProps[] =
{
{ NULL, kpidPath, VT_BSTR},
{ NULL, kpidSize, VT_UI8},
@@ -333,10 +359,17 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
const CSection &item = _sections[index];
switch(propID)
{
- case kpidPath: StringToProp(GetName(_segments[item.SegmentIndex].Name) + GetName(item.Name), prop); break;
- case kpidSize: prop = (UInt64)item.Size; break;
+ case kpidPath:
+ {
+ AString s = GetName(_segments[item.SegmentIndex].Name);
+ if (!item.IsDummy)
+ s += GetName(item.Name);
+ StringToProp(s, prop);
+ break;
+ }
+ case kpidSize: /* prop = (UInt64)item.VSize; break; */
case kpidPackSize: prop = (UInt64)item.GetPackSize(); break;
- case kpidCharacts: StringToProp(SectFlagsToString(item.Flags), prop); break;
+ case kpidCharacts: if (!item.IsDummy) StringToProp(SectFlagsToString(item.Flags), prop); break;
case kpidOffset: prop = item.Pa; break;
case kpidVa: prop = item.Va; break;
}
diff --git a/CPP/7zip/Archive/Nsis/NsisHandler.cpp b/CPP/7zip/Archive/Nsis/NsisHandler.cpp
index 9a5daadf..8005ddbc 100755
--- a/CPP/7zip/Archive/Nsis/NsisHandler.cpp
+++ b/CPP/7zip/Archive/Nsis/NsisHandler.cpp
@@ -23,20 +23,20 @@ using namespace NWindows;
namespace NArchive {
namespace NNsis {
-static const wchar_t *kBcjMethod = L"BCJ";
-static const wchar_t *kUnknownMethod = L"Unknown";
+static const char *kBcjMethod = "BCJ";
+static const char *kUnknownMethod = "Unknown";
-static const wchar_t *kMethods[] =
+static const char *kMethods[] =
{
- L"Copy",
- L"Deflate",
- L"BZip2",
- L"LZMA"
+ "Copy",
+ "Deflate",
+ "BZip2",
+ "LZMA"
};
static const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]);
-STATPROPSTG kProps[] =
+static STATPROPSTG kProps[] =
{
{ NULL, kpidPath, VT_BSTR},
{ NULL, kpidSize, VT_UI8},
@@ -46,7 +46,7 @@ STATPROPSTG kProps[] =
{ NULL, kpidSolid, VT_BOOL}
};
-STATPROPSTG kArcProps[] =
+static STATPROPSTG kArcProps[] =
{
{ NULL, kpidMethod, VT_BSTR},
{ NULL, kpidSolid, VT_BOOL}
@@ -116,50 +116,45 @@ STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
return S_OK;
}
-static UString ConvertUInt32ToString(UInt32 value)
+static AString UInt32ToString(UInt32 value)
{
- wchar_t buffer[32];
- ConvertUInt64ToString(value, buffer);
+ char buffer[16];
+ ConvertUInt32ToString(value, buffer);
return buffer;
}
-static UString GetStringForSizeValue(UInt32 value)
+static AString GetStringForSizeValue(UInt32 value)
{
for (int i = 31; i >= 0; i--)
- if ((UInt32(1) << i) == value)
- return ConvertUInt32ToString(i);
- UString result;
+ if (((UInt32)1 << i) == value)
+ return UInt32ToString(i);
+ char c = 'b';
if (value % (1 << 20) == 0)
{
- result += ConvertUInt32ToString(value >> 20);
- result += L"m";
+ value >>= 20;
+ c = 'm';
}
else if (value % (1 << 10) == 0)
{
- result += ConvertUInt32ToString(value >> 10);
- result += L"k";
+ value >>= 10;
+ c = 'k';
}
- else
- {
- result += ConvertUInt32ToString(value);
- result += L"b";
- }
- return result;
+ return UInt32ToString(value) + c;
}
-UString CHandler::GetMethod(bool useItemFilter, UInt32 dictionary) const
+AString CHandler::GetMethod(bool useItemFilter, UInt32 dictionary) const
{
NMethodType::EEnum methodIndex = _archive.Method;
- UString method;
+ AString method;
if (_archive.IsSolid && _archive.UseFilter || !_archive.IsSolid && useItemFilter)
{
method += kBcjMethod;
- method += L" ";
+ method += ' ';
}
method += (methodIndex < kNumMethods) ? kMethods[methodIndex] : kUnknownMethod;
if (methodIndex == NMethodType::kLZMA)
{
- method += L":";
+ method += ':';
method += GetStringForSizeValue(_archive.IsSolid ? _archive.DictionarySize: dictionary);
}
return method;
diff --git a/CPP/7zip/Archive/Nsis/NsisHandler.h b/CPP/7zip/Archive/Nsis/NsisHandler.h
index 95fea5d0..6de493df 100755
--- a/CPP/7zip/Archive/Nsis/NsisHandler.h
+++ b/CPP/7zip/Archive/Nsis/NsisHandler.h
@@ -26,7 +26,7 @@ class CHandler:
bool GetUncompressedSize(int index, UInt32 &size);
bool GetCompressedSize(int index, UInt32 &size);
- UString GetMethod(bool useItemFilter, UInt32 dictionary) const;
+ AString GetMethod(bool useItemFilter, UInt32 dictionary) const;
public:
MY_QUERYINTERFACE_BEGIN2(IInArchive)
QUERY_ENTRY_ISetCompressCodecsInfo
diff --git a/CPP/7zip/Archive/Nsis/NsisIn.cpp b/CPP/7zip/Archive/Nsis/NsisIn.cpp
index 06cc38eb..290349aa 100755
--- a/CPP/7zip/Archive/Nsis/NsisIn.cpp
+++ b/CPP/7zip/Archive/Nsis/NsisIn.cpp
@@ -1290,6 +1290,7 @@ HRESULT CInArchive::Open2(
_headerIsCompressed = true;
IsSolid = true;
FilterFlag = false;
+ DictionarySize = 1;
UInt32 compressedHeaderSize = Get32(sig);
diff --git a/CPP/7zip/Archive/Nsis/NsisIn.h b/CPP/7zip/Archive/Nsis/NsisIn.h
index 3fc08440..87ae3f1c 100755
--- a/CPP/7zip/Archive/Nsis/NsisIn.h
+++ b/CPP/7zip/Archive/Nsis/NsisIn.h
@@ -72,7 +72,7 @@ struct CItem
UInt32 DictionarySize;
CItem(): IsUnicode(false), UseFilter(false), IsCompressed(true), SizeIsDefined(false),
- CompressedSizeIsDefined(false), EstimatedSizeIsDefined(false), Size(0) {}
+ CompressedSizeIsDefined(false), EstimatedSizeIsDefined(false), Size(0), DictionarySize(1) {}
bool IsINSTDIR() const
{
diff --git a/CPP/7zip/Archive/PeHandler.cpp b/CPP/7zip/Archive/PeHandler.cpp
index 97c374d0..5732e1f5 100755
--- a/CPP/7zip/Archive/PeHandler.cpp
+++ b/CPP/7zip/Archive/PeHandler.cpp
@@ -145,7 +145,7 @@ struct COptHeader
// UInt32 AddressOfEntryPoint;
// UInt32 BaseOfCode;
// UInt32 BaseOfData32;
- // UInt64 ImageBase;
+ UInt64 ImageBase;
UInt32 SectAlign;
UInt32 FileAlign;
@@ -202,8 +202,8 @@ bool COptHeader::Parse(const Byte *p, UInt32 size)
// AddressOfEntryPoint = Get32(p + 16);
// BaseOfCode = Get32(p + 20);
- // BaseOfData32 = Get32(p + 24);
- // ImageBase = hdr64 ? GetUi64(p + 24) :Get32(p + 28);
+ // BaseOfData32 = hdr64 ? 0: Get32(p + 24);
+ ImageBase = hdr64 ? GetUi64(p + 24) : Get32(p + 28);
SectAlign = Get32(p + 32);
FileAlign = Get32(p + 36);
@@ -625,6 +625,10 @@ enum
kpidStackCommit,
kpidHeapReserve,
kpidHeapCommit,
+ kpidImageBase
+ // kpidAddressOfEntryPoint,
+ // kpidBaseOfCode,
+ // kpidBaseOfData32,
};
STATPROPSTG kArcProps[] =
@@ -652,6 +656,10 @@ STATPROPSTG kArcProps[] =
{ L"Stack Commit", kpidStackCommit, VT_UI8},
{ L"Heap Reserve", kpidHeapReserve, VT_UI8},
{ L"Heap Commit", kpidHeapCommit, VT_UI8},
+ { L"Image Base", kpidImageBase, VT_UI8}
+ // { L"Address Of Entry Point", kpidAddressOfEntryPoint, VT_UI8},
+ // { L"Base Of Code", kpidBaseOfCode, VT_UI8},
+ // { L"Base Of Data", kpidBaseOfData32, VT_UI8},
};
STATPROPSTG kProps[] =
@@ -720,6 +728,12 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
case kpidStackCommit: prop = _optHeader.StackCommit; break;
case kpidHeapReserve: prop = _optHeader.HeapReserve; break;
case kpidHeapCommit: prop = _optHeader.HeapCommit; break;
+
+ case kpidImageBase: prop = _optHeader.ImageBase; break;
+ // case kpidAddressOfEntryPoint: prop = _optHeader.AddressOfEntryPoint; break;
+ // case kpidBaseOfCode: prop = _optHeader.BaseOfCode; break;
+ // case kpidBaseOfData32: if (!_optHeader.Is64Bit()) prop = _optHeader.BaseOfData32; break;
+
case kpidMainSubfile: if (_mainSubfile >= 0) prop = (UInt32)_mainSubfile; break;
}
prop.Detach(value);
@@ -1393,7 +1407,8 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
_parseResources = true;
UInt64 mainSize = 0, mainSize2 = 0;
- for (int i = 0; i < _sections.Size(); i++)
+ int i;
+ for (i = 0; i < _sections.Size(); i++)
{
const CSection &sect = _sections[i];
CMixItem mixItem;
@@ -1469,8 +1484,20 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
}
_mixItems.Add(mixItem);
}
+
if (mainSize2 >= (1 << 20) && mainSize < mainSize2 * 2)
_mainSubfile = -1;
+
+ for (i = 0; i < _mixItems.Size(); i++)
+ {
+ const CMixItem &mixItem = _mixItems[i];
+ if (mixItem.StringIndex < 0 && mixItem.ResourceIndex < 0 && _sections[mixItem.SectionIndex].Name == "_winzip_")
+ {
+ _mainSubfile = i;
+ break;
+ }
+ }
+
return S_OK;
}
diff --git a/CPP/7zip/Archive/Zip/ZipHandler.cpp b/CPP/7zip/Archive/Zip/ZipHandler.cpp
index 64477766..e54b15ba 100755
--- a/CPP/7zip/Archive/Zip/ZipHandler.cpp
+++ b/CPP/7zip/Archive/Zip/ZipHandler.cpp
@@ -128,7 +128,9 @@ static STATPROPSTG kProps[] =
static STATPROPSTG kArcProps[] =
{
{ NULL, kpidBit64, VT_BOOL},
- { NULL, kpidComment, VT_BSTR}
+ { NULL, kpidComment, VT_BSTR},
+ { NULL, kpidPhySize, VT_UI8},
+ { NULL, kpidOffset, VT_UI8}
};
CHandler::CHandler()
@@ -160,9 +162,9 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
switch(propID)
{
case kpidBit64: if (m_Archive.IsZip64) prop = m_Archive.IsZip64; break;
- case kpidComment:
- prop = MultiByteToUnicodeString(BytesToString(m_Archive.m_ArchiveInfo.Comment), CP_ACP);
- break;
+ case kpidComment: prop = MultiByteToUnicodeString(BytesToString(m_Archive.ArcInfo.Comment), CP_ACP); break;
+ case kpidPhySize: prop = m_Archive.ArcInfo.GetPhySize(); break;
+ case kpidOffset: if (m_Archive.ArcInfo.StartPosition != 0) prop = m_Archive.ArcInfo.StartPosition; break;
}
prop.Detach(value);
COM_TRY_END
diff --git a/CPP/7zip/Archive/Zip/ZipHandler.h b/CPP/7zip/Archive/Zip/ZipHandler.h
index 55ebff25..68dd60dc 100755
--- a/CPP/7zip/Archive/Zip/ZipHandler.h
+++ b/CPP/7zip/Archive/Zip/ZipHandler.h
@@ -87,7 +87,7 @@ private:
m_ForceAesMode = false;
m_IsAesMode = false;
m_AesKeyMode = 3; // aes-256
- m_WriteNtfsTimeExtra = false;
+ m_WriteNtfsTimeExtra = true;
m_ForseLocal = false;
m_ForseUtf8 = false;
#ifndef _7ZIP_ST
diff --git a/CPP/7zip/Archive/Zip/ZipIn.cpp b/CPP/7zip/Archive/Zip/ZipIn.cpp
index a311e7f3..1048b57d 100755
--- a/CPP/7zip/Archive/Zip/ZipIn.cpp
+++ b/CPP/7zip/Archive/Zip/ZipIn.cpp
@@ -63,7 +63,7 @@ static inline bool TestMarkerCandidate2(const Byte *p, UInt32 &value)
HRESULT CInArchive::FindAndReadMarker(IInStream *stream, const UInt64 *searchHeaderSizeLimit)
{
- m_ArchiveInfo.Clear();
+ ArcInfo.Clear();
m_Position = m_StreamStartPosition;
Byte marker[NSignature::kMarkerSize];
@@ -99,7 +99,7 @@ HRESULT CInArchive::FindAndReadMarker(IInStream *stream, const UInt64 *searchHea
if (TestMarkerCandidate2(buffer + pos, m_Signature))
{
curTestPos += pos;
- m_ArchiveInfo.StartPosition = curTestPos;
+ ArcInfo.StartPosition = curTestPos;
m_Position = curTestPos + NSignature::kMarkerSize;
return S_OK;
}
@@ -208,11 +208,6 @@ void CInArchive::ReadFileName(UInt32 nameSize, AString &dest)
dest.ReleaseBuffer();
}
-void CInArchive::GetArchiveInfo(CInArchiveInfo &archiveInfo) const
-{
- archiveInfo = m_ArchiveInfo;
-}
-
void CInArchive::ReadExtra(UInt32 extraSize, CExtraBlock &extraBlock,
UInt64 &unpackSize, UInt64 &packSize, UInt64 &localHeaderOffset, UInt32 &diskStartNumber)
{
@@ -332,7 +327,7 @@ HRESULT CInArchive::ReadLocalItemAfterCdItem(CItemEx &item)
return S_OK;
try
{
- RINOK(Seek(m_ArchiveInfo.Base + item.LocalHeaderPosition));
+ RINOK(Seek(ArcInfo.Base + item.LocalHeaderPosition));
CItemEx localItem;
if (ReadUInt32() != NSignature::kLocalFileHeader)
return S_FALSE;
@@ -419,7 +414,7 @@ HRESULT CInArchive::ReadLocalItemAfterCdItemFull(CItemEx &item)
RINOK(ReadLocalItemAfterCdItem(item));
if (item.HasDescriptor())
{
- RINOK(Seek(m_ArchiveInfo.Base + item.GetDataPosition() + item.PackSize));
+ RINOK(Seek(ArcInfo.Base + item.GetDataPosition() + item.PackSize));
if (ReadUInt32() != NSignature::kDataDescriptor)
return S_FALSE;
UInt32 crc = ReadUInt32();
@@ -534,9 +529,9 @@ HRESULT CInArchive::FindCd(CCdInfo &cdInfo)
UInt64 ecd64Offset = Get64(locator + 8);
if (TryEcd64(ecd64Offset, cdInfo) == S_OK)
return S_OK;
- if (TryEcd64(m_ArchiveInfo.StartPosition + ecd64Offset, cdInfo) == S_OK)
+ if (TryEcd64(ArcInfo.StartPosition + ecd64Offset, cdInfo) == S_OK)
{
- m_ArchiveInfo.Base = m_ArchiveInfo.StartPosition;
+ ArcInfo.Base = ArcInfo.StartPosition;
return S_OK;
}
}
@@ -548,8 +543,8 @@ HRESULT CInArchive::FindCd(CCdInfo &cdInfo)
cdInfo.Offset = Get32(buf + i + 16);
UInt64 curPos = endPosition - bufSize + i;
UInt64 cdEnd = cdInfo.Size + cdInfo.Offset;
- if (curPos > cdEnd)
- m_ArchiveInfo.Base = curPos - cdEnd;
+ if (curPos != cdEnd)
+ ArcInfo.Base = curPos - cdEnd;
return S_OK;
}
}
@@ -585,18 +580,18 @@ HRESULT CInArchive::TryReadCd(CObjectVector<CItemEx> &items, UInt64 cdOffset, UI
HRESULT CInArchive::ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt64 &cdSize, CProgressVirt *progress)
{
- m_ArchiveInfo.Base = 0;
+ ArcInfo.Base = 0;
CCdInfo cdInfo;
RINOK(FindCd(cdInfo));
HRESULT res = S_FALSE;
cdSize = cdInfo.Size;
cdOffset = cdInfo.Offset;
- res = TryReadCd(items, m_ArchiveInfo.Base + cdOffset, cdSize, progress);
- if (res == S_FALSE && m_ArchiveInfo.Base == 0)
+ res = TryReadCd(items, ArcInfo.Base + cdOffset, cdSize, progress);
+ if (res == S_FALSE && ArcInfo.Base == 0)
{
- res = TryReadCd(items, cdInfo.Offset + m_ArchiveInfo.StartPosition, cdSize, progress);
+ res = TryReadCd(items, cdInfo.Offset + ArcInfo.StartPosition, cdSize, progress);
if (res == S_OK)
- m_ArchiveInfo.Base = m_ArchiveInfo.StartPosition;
+ ArcInfo.Base = ArcInfo.StartPosition;
}
if (!ReadUInt32(m_Signature))
return S_FALSE;
@@ -645,7 +640,7 @@ HRESULT CInArchive::ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt
CItemEx &item = items[j];
if (item.Name == cdItem.Name)
{
- m_ArchiveInfo.Base = item.LocalHeaderPosition - cdItem.LocalHeaderPosition;
+ ArcInfo.Base = item.LocalHeaderPosition - cdItem.LocalHeaderPosition;
break;
}
}
@@ -660,7 +655,7 @@ HRESULT CInArchive::ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt
if (left >= right)
return S_FALSE;
index = (left + right) / 2;
- UInt64 position = items[index].LocalHeaderPosition - m_ArchiveInfo.Base;
+ UInt64 position = items[index].LocalHeaderPosition - ArcInfo.Base;
if (cdItem.LocalHeaderPosition == position)
break;
if (cdItem.LocalHeaderPosition < position)
@@ -693,7 +688,7 @@ HRESULT CInArchive::ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt
return S_FALSE;
}
for (i = 0; i < items.Size(); i++)
- items[i].LocalHeaderPosition -= m_ArchiveInfo.Base;
+ items[i].LocalHeaderPosition -= ArcInfo.Base;
return S_OK;
}
@@ -781,20 +776,20 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *pr
if (res == S_FALSE)
{
_inBufMode = false;
- m_ArchiveInfo.Base = 0;
- RINOK(m_Stream->Seek(m_ArchiveInfo.StartPosition, STREAM_SEEK_SET, &m_Position));
- if (m_Position != m_ArchiveInfo.StartPosition)
+ ArcInfo.Base = 0;
+ RINOK(m_Stream->Seek(ArcInfo.StartPosition, STREAM_SEEK_SET, &m_Position));
+ if (m_Position != ArcInfo.StartPosition)
return S_FALSE;
if (!ReadUInt32(m_Signature))
return S_FALSE;
RINOK(ReadLocalsAndCd(items, progress, cdStartOffset, numCdItems));
cdSize = (m_Position - 4) - cdStartOffset;
- cdStartOffset -= m_ArchiveInfo.Base;
+ cdStartOffset -= ArcInfo.Base;
}
CEcd64 ecd64;
bool isZip64 = false;
- UInt64 zip64EcdStartOffset = m_Position - 4 - m_ArchiveInfo.Base;
+ UInt64 zip64EcdStartOffset = m_Position - 4 - ArcInfo.Base;
if (m_Signature == NSignature::kZip64EndOfCentralDir)
{
IsZip64 = isZip64 = true;
@@ -843,7 +838,7 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *pr
COPY_ECD_ITEM_32(cdSize);
COPY_ECD_ITEM_32(cdStartOffset);
- ReadBuffer(m_ArchiveInfo.Comment, ecd.commentSize);
+ ReadBuffer(ArcInfo.Comment, ecd.commentSize);
if (ecd64.thisDiskNumber != 0 || ecd64.startCDDiskNumber != 0)
throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported);
@@ -857,6 +852,7 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *pr
_inBufMode = false;
_inBuffer.Free();
IsOkHeaders = (numCdItems == items.Size());
+ ArcInfo.FinishPosition = m_Position;
return S_OK;
}
@@ -864,7 +860,7 @@ ISequentialInStream* CInArchive::CreateLimitedStream(UInt64 position, UInt64 siz
{
CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
CMyComPtr<ISequentialInStream> stream(streamSpec);
- SeekInArchive(m_ArchiveInfo.Base + position);
+ SeekInArchive(ArcInfo.Base + position);
streamSpec->SetStream(m_Stream);
streamSpec->Init(size);
return stream.Detach();
diff --git a/CPP/7zip/Archive/Zip/ZipIn.h b/CPP/7zip/Archive/Zip/ZipIn.h
index f0e88b03..0565339a 100755
--- a/CPP/7zip/Archive/Zip/ZipIn.h
+++ b/CPP/7zip/Archive/Zip/ZipIn.h
@@ -38,8 +38,11 @@ class CInArchiveInfo
public:
UInt64 Base;
UInt64 StartPosition;
+ UInt64 FinishPosition;
CByteBuffer Comment;
+
CInArchiveInfo(): Base(0), StartPosition(0) {}
+ UInt64 GetPhySize() const { return FinishPosition - StartPosition; }
void Clear()
{
Base = 0;
@@ -101,7 +104,7 @@ class CInArchive
HRESULT ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt64 &cdSize, CProgressVirt *progress);
HRESULT ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt *progress, UInt64 &cdOffset, int &numCdItems);
public:
- CInArchiveInfo m_ArchiveInfo;
+ CInArchiveInfo ArcInfo;
bool IsZip64;
bool IsOkHeaders;
@@ -110,7 +113,6 @@ public:
HRESULT ReadLocalItemAfterCdItemFull(CItemEx &item);
HRESULT Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit);
void Close();
- void GetArchiveInfo(CInArchiveInfo &archiveInfo) const;
bool SeekInArchive(UInt64 position);
ISequentialInStream *CreateLimitedStream(UInt64 position, UInt64 size);
IInStream* CreateStream();
diff --git a/CPP/7zip/Archive/Zip/ZipOut.cpp b/CPP/7zip/Archive/Zip/ZipOut.cpp
index 0807369c..aa82143e 100755
--- a/CPP/7zip/Archive/Zip/ZipOut.cpp
+++ b/CPP/7zip/Archive/Zip/ZipOut.cpp
@@ -221,7 +221,7 @@ void COutArchive::WriteCentralHeader(const CItem &item)
WriteBytes(item.Comment, (UInt32)item.Comment.GetCapacity());
}
-void COutArchive::WriteCentralDir(const CObjectVector<CItem> &items, const CByteBuffer &comment)
+void COutArchive::WriteCentralDir(const CObjectVector<CItem> &items, const CByteBuffer *comment)
{
SeekTo(m_BasePosition);
@@ -260,10 +260,10 @@ void COutArchive::WriteCentralDir(const CObjectVector<CItem> &items, const CByte
WriteUInt16((UInt16)(items64 ? 0xFFFF: items.Size()));
WriteUInt32(cdSize64 ? 0xFFFFFFFF: (UInt32)cdSize);
WriteUInt32(cdOffset64 ? 0xFFFFFFFF: (UInt32)cdOffset);
- UInt16 commentSize = (UInt16)comment.GetCapacity();
- WriteUInt16(commentSize);
+ UInt32 commentSize = (UInt32)(comment ? comment->GetCapacity() : 0);
+ WriteUInt16((UInt16)commentSize);
if (commentSize > 0)
- WriteBytes((const Byte *)comment, commentSize);
+ WriteBytes((const Byte *)*comment, commentSize);
m_OutBuffer.FlushWithCheck();
}
diff --git a/CPP/7zip/Archive/Zip/ZipOut.h b/CPP/7zip/Archive/Zip/ZipOut.h
index 24bc83a1..2f6349e5 100755
--- a/CPP/7zip/Archive/Zip/ZipOut.h
+++ b/CPP/7zip/Archive/Zip/ZipOut.h
@@ -44,7 +44,7 @@ public:
void PrepareWriteCompressedData2(UInt16 fileNameLength, UInt64 unPackSize, UInt64 packSize, bool aesEncryption);
void WriteLocalHeader(const CLocalItem &item);
- void WriteCentralDir(const CObjectVector<CItem> &items, const CByteBuffer &comment);
+ void WriteCentralDir(const CObjectVector<CItem> &items, const CByteBuffer *comment);
void CreateStreamForCompressing(IOutStream **outStream);
void CreateStreamForCopying(ISequentialOutStream **outStream);
diff --git a/CPP/7zip/Archive/Zip/ZipUpdate.cpp b/CPP/7zip/Archive/Zip/ZipUpdate.cpp
index 004e67f8..6dd20f94 100755
--- a/CPP/7zip/Archive/Zip/ZipUpdate.cpp
+++ b/CPP/7zip/Archive/Zip/ZipUpdate.cpp
@@ -398,7 +398,7 @@ static HRESULT Update2St(
const CObjectVector<CItemEx> &inputItems,
const CObjectVector<CUpdateItem> &updateItems,
const CCompressionMethodMode *options,
- const CByteBuffer &comment,
+ const CByteBuffer *comment,
IArchiveUpdateCallback *updateCallback)
{
CLocalProgress *lps = new CLocalProgress;
@@ -482,7 +482,7 @@ static HRESULT Update2(
const CObjectVector<CItemEx> &inputItems,
const CObjectVector<CUpdateItem> &updateItems,
const CCompressionMethodMode *options,
- const CByteBuffer &comment,
+ const CByteBuffer *comment,
IArchiveUpdateCallback *updateCallback)
{
UInt64 complexity = 0;
@@ -515,8 +515,8 @@ static HRESULT Update2(
complexity += NFileHeader::kCentralBlockSize;
}
- if (comment != 0)
- complexity += comment.GetCapacity();
+ if (comment)
+ complexity += comment->GetCapacity();
complexity++; // end of central
updateCallback->SetTotal(complexity);
@@ -812,27 +812,27 @@ HRESULT Update(
if (!outStream)
return E_NOTIMPL;
- CInArchiveInfo archiveInfo;
- if(inArchive != 0)
+ if (inArchive)
{
- inArchive->GetArchiveInfo(archiveInfo);
- if (archiveInfo.Base != 0 || !inArchive->IsOkHeaders)
+ if (inArchive->ArcInfo.Base != 0 ||
+ inArchive->ArcInfo.StartPosition != 0 ||
+ !inArchive->IsOkHeaders)
return E_NOTIMPL;
}
- else
- archiveInfo.StartPosition = 0;
COutArchive outArchive;
outArchive.Create(outStream);
- if (archiveInfo.StartPosition > 0)
+ /*
+ if (inArchive && inArchive->ArcInfo.StartPosition > 0)
{
CMyComPtr<ISequentialInStream> inStream;
- inStream.Attach(inArchive->CreateLimitedStream(0, archiveInfo.StartPosition));
+ inStream.Attach(inArchive->CreateLimitedStream(0, inArchive->ArcInfo.StartPosition));
RINOK(CopyBlockToArchive(inStream, outArchive, NULL));
- outArchive.MoveBasePosition(archiveInfo.StartPosition);
+ outArchive.MoveBasePosition(inArchive->ArcInfo.StartPosition);
}
+ */
CMyComPtr<IInStream> inStream;
- if(inArchive != 0)
+ if (inArchive)
inStream.Attach(inArchive->CreateStream());
return Update2(
@@ -840,7 +840,8 @@ HRESULT Update(
outArchive, inArchive, inStream,
inputItems, updateItems,
compressionMethodMode,
- archiveInfo.Comment, updateCallback);
+ inArchive ? &inArchive->ArcInfo.Comment : NULL,
+ updateCallback);
}
}}
diff --git a/CPP/7zip/Bundles/Fm/FM.dsp b/CPP/7zip/Bundles/Fm/FM.dsp
index 6b08e9dc..44cc6398 100755
--- a/CPP/7zip/Bundles/Fm/FM.dsp
+++ b/CPP/7zip/Bundles/Fm/FM.dsp
@@ -440,14 +440,6 @@ SOURCE=..\..\UI\FileManager\OptionsDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\UI\FileManager\PluginsPage.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\FileManager\PluginsPage.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\UI\FileManager\SettingsPage.cpp
# End Source File
# Begin Source File
diff --git a/CPP/7zip/Bundles/Fm/makefile b/CPP/7zip/Bundles/Fm/makefile
index 7068206c..8b01a739 100755
--- a/CPP/7zip/Bundles/Fm/makefile
+++ b/CPP/7zip/Bundles/Fm/makefile
@@ -65,7 +65,6 @@ FM_OBJS = \
$O\MessagesDialog.obj \
$O\OverwriteDialog.obj \
$O\PasswordDialog.obj \
- $O\PluginsPage.obj \
$O\ProgressDialog2.obj \
$O\SettingsPage.obj \
$O\SplitDialog.obj \
diff --git a/CPP/7zip/Compress/Bcj2Coder.cpp b/CPP/7zip/Compress/Bcj2Coder.cpp
index 7d93155a..684da5ab 100755
--- a/CPP/7zip/Compress/Bcj2Coder.cpp
+++ b/CPP/7zip/Compress/Bcj2Coder.cpp
@@ -57,13 +57,9 @@ HRESULT CEncoder::Flush()
const UInt32 kDefaultLimit = (1 << 24);
-HRESULT CEncoder::CodeReal(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 ** /* outSizes */,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress)
+HRESULT CEncoder::CodeReal(ISequentialInStream **inStreams, const UInt64 **inSizes, UInt32 numInStreams,
+ ISequentialOutStream **outStreams, const UInt64 ** /* outSizes */, UInt32 numOutStreams,
+ ICompressProgressInfo *progress)
{
if (numInStreams != 1 || numOutStreams != 4)
return E_INVALIDARG;
@@ -81,6 +77,8 @@ HRESULT CEncoder::CodeReal(ISequentialInStream **inStreams,
sizeIsDefined = true;
}
+ CCoderReleaser releaser(this);
+
ISequentialInStream *inStream = inStreams[0];
_mainStream.SetStream(outStreams[0]);
@@ -93,7 +91,6 @@ HRESULT CEncoder::CodeReal(ISequentialInStream **inStreams,
_rangeEncoder.Init();
for (int i = 0; i < 256 + 2; i++)
_statusEncoder[i].Init();
- CCoderReleaser releaser(this);
CMyComPtr<ICompressGetSubStreamSize> getSubStreamSize;
{
@@ -253,18 +250,13 @@ HRESULT CEncoder::CodeReal(ISequentialInStream **inStreams,
}
}
-STDMETHODIMP CEncoder::Code(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress)
+STDMETHODIMP CEncoder::Code(ISequentialInStream **inStreams, const UInt64 **inSizes, UInt32 numInStreams,
+ ISequentialOutStream **outStreams, const UInt64 **outSizes, UInt32 numOutStreams,
+ ICompressProgressInfo *progress)
{
try
{
- return CodeReal(inStreams, inSizes, numInStreams,
- outStreams, outSizes,numOutStreams, progress);
+ return CodeReal(inStreams, inSizes, numInStreams, outStreams, outSizes,numOutStreams, progress);
}
catch(const COutBufferException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
@@ -272,28 +264,39 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream **inStreams,
#endif
-HRESULT CDecoder::CodeReal(ISequentialInStream **inStreams,
- const UInt64 ** /* inSizes */,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 ** /* outSizes */,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress)
+
+STDMETHODIMP CDecoder::SetInBufSize(UInt32 streamIndex, UInt32 size) { _inBufSizes[streamIndex] = size; return S_OK; }
+STDMETHODIMP CDecoder::SetOutBufSize(UInt32 , UInt32 size) { _outBufSize = size; return S_OK; }
+
+CDecoder::CDecoder():
+ _outBufSize(1 << 16)
+{
+ _inBufSizes[0] = 1 << 20;
+ _inBufSizes[1] = 1 << 20;
+ _inBufSizes[2] = 1 << 20;
+ _inBufSizes[3] = 1 << 20;
+}
+
+HRESULT CDecoder::CodeReal(ISequentialInStream **inStreams, const UInt64 ** /* inSizes */, UInt32 numInStreams,
+ ISequentialOutStream **outStreams, const UInt64 ** /* outSizes */, UInt32 numOutStreams,
+ ICompressProgressInfo *progress)
{
if (numInStreams != 4 || numOutStreams != 1)
return E_INVALIDARG;
- if (!_mainInStream.Create(1 << 16))
+ if (!_mainInStream.Create(_inBufSizes[0]))
return E_OUTOFMEMORY;
- if (!_callStream.Create(1 << 20))
+ if (!_callStream.Create(_inBufSizes[1]))
return E_OUTOFMEMORY;
- if (!_jumpStream.Create(1 << 16))
+ if (!_jumpStream.Create(_inBufSizes[2]))
return E_OUTOFMEMORY;
- if (!_rangeDecoder.Create(1 << 20))
+ if (!_rangeDecoder.Create(_inBufSizes[3]))
return E_OUTOFMEMORY;
- if (!_outStream.Create(1 << 16))
+ if (!_outStream.Create(_outBufSize))
return E_OUTOFMEMORY;
+ CCoderReleaser releaser(this);
+
_mainInStream.SetStream(inStreams[0]);
_callStream.SetStream(inStreams[1]);
_jumpStream.SetStream(inStreams[2]);
@@ -309,8 +312,6 @@ HRESULT CDecoder::CodeReal(ISequentialInStream **inStreams,
for (int i = 0; i < 256 + 2; i++)
_statusDecoder[i].Init();
- CCoderReleaser releaser(this);
-
Byte prevByte = 0;
UInt32 processedBytes = 0;
for (;;)
@@ -369,18 +370,13 @@ HRESULT CDecoder::CodeReal(ISequentialInStream **inStreams,
}
}
-STDMETHODIMP CDecoder::Code(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress)
+STDMETHODIMP CDecoder::Code(ISequentialInStream **inStreams, const UInt64 **inSizes, UInt32 numInStreams,
+ ISequentialOutStream **outStreams, const UInt64 **outSizes, UInt32 numOutStreams,
+ ICompressProgressInfo *progress)
{
try
{
- return CodeReal(inStreams, inSizes, numInStreams,
- outStreams, outSizes,numOutStreams, progress);
+ return CodeReal(inStreams, inSizes, numInStreams, outStreams, outSizes,numOutStreams, progress);
}
catch(const CInBufferException &e) { return e.ErrorCode; }
catch(const COutBufferException &e) { return e.ErrorCode; }
diff --git a/CPP/7zip/Compress/Bcj2Coder.h b/CPP/7zip/Compress/Bcj2Coder.h
index b8b1e7a9..79a713f1 100755
--- a/CPP/7zip/Compress/Bcj2Coder.h
+++ b/CPP/7zip/Compress/Bcj2Coder.h
@@ -21,9 +21,6 @@ class CEncoder:
public CMyUnknownImp
{
Byte *_buffer;
-public:
- CEncoder(): _buffer(0) {};
- ~CEncoder();
bool Create();
COutBuffer _mainStream;
@@ -33,6 +30,7 @@ public:
NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusEncoder[256 + 2];
HRESULT Flush();
+public:
void ReleaseStreams()
{
_mainStream.ReleaseStream();
@@ -50,32 +48,25 @@ public:
};
public:
-
MY_UNKNOWN_IMP
- HRESULT CodeReal(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
+ HRESULT CodeReal(ISequentialInStream **inStreams, const UInt64 **inSizes, UInt32 numInStreams,
+ ISequentialOutStream **outStreams, const UInt64 **outSizes, UInt32 numOutStreams,
ICompressProgressInfo *progress);
- STDMETHOD(Code)(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
+ STDMETHOD(Code)(ISequentialInStream **inStreams, const UInt64 **inSizes, UInt32 numInStreams,
+ ISequentialOutStream **outStreams, const UInt64 **outSizes, UInt32 numOutStreams,
ICompressProgressInfo *progress);
+ CEncoder(): _buffer(0) {};
+ ~CEncoder();
};
#endif
class CDecoder:
public ICompressCoder2,
+ public ICompressSetBufSize,
public CMyUnknownImp
{
-public:
CInBuffer _mainInStream;
CInBuffer _callStream;
CInBuffer _jumpStream;
@@ -83,7 +74,10 @@ public:
NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusDecoder[256 + 2];
COutBuffer _outStream;
+ UInt32 _inBufSizes[4];
+ UInt32 _outBufSize;
+public:
void ReleaseStreams()
{
_mainInStream.ReleaseStream();
@@ -103,21 +97,17 @@ public:
};
public:
- MY_UNKNOWN_IMP
- HRESULT CodeReal(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
+ MY_UNKNOWN_IMP1(ICompressSetBufSize);
+ HRESULT CodeReal(ISequentialInStream **inStreams, const UInt64 **inSizes, UInt32 numInStreams,
+ ISequentialOutStream **outStreams, const UInt64 **outSizes, UInt32 numOutStreams,
ICompressProgressInfo *progress);
- STDMETHOD(Code)(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
+ STDMETHOD(Code)(ISequentialInStream **inStreams, const UInt64 **inSizes, UInt32 numInStreams,
+ ISequentialOutStream **outStreams, const UInt64 **outSizes, UInt32 numOutStreams,
ICompressProgressInfo *progress);
+
+ STDMETHOD(SetInBufSize)(UInt32 streamIndex, UInt32 size);
+ STDMETHOD(SetOutBufSize)(UInt32 streamIndex, UInt32 size);
+ CDecoder();
};
}}
diff --git a/CPP/7zip/Compress/LzmaDecoder.cpp b/CPP/7zip/Compress/LzmaDecoder.cpp
index c74d5ade..dadd3aba 100755
--- a/CPP/7zip/Compress/LzmaDecoder.cpp
+++ b/CPP/7zip/Compress/LzmaDecoder.cpp
@@ -24,9 +24,10 @@ static HRESULT SResToHRESULT(SRes res)
namespace NCompress {
namespace NLzma {
-static const UInt32 kInBufSize = 1 << 20;
-
-CDecoder::CDecoder(): _inBuf(0), _propsWereSet(false), _outSizeDefined(false), FinishStream(false)
+CDecoder::CDecoder(): _inBuf(0), _propsWereSet(false), _outSizeDefined(false),
+ _inBufSize(1 << 20),
+ _outBufSize(1 << 22),
+ FinishStream(false)
{
_inSizeProcessed = 0;
_inPos = _inSize = 0;
@@ -43,13 +44,18 @@ CDecoder::~CDecoder()
MyFree(_inBuf);
}
+STDMETHODIMP CDecoder::SetInBufSize(UInt32 , UInt32 size) { _inBufSize = size; return S_OK; }
+STDMETHODIMP CDecoder::SetOutBufSize(UInt32 , UInt32 size) { _outBufSize = size; return S_OK; }
+
HRESULT CDecoder::CreateInputBuffer()
{
- if (_inBuf == 0)
+ if (_inBuf == 0 || _inBufSize != _inBufSizeAllocated)
{
- _inBuf = (Byte *)MyAlloc(kInBufSize);
+ MyFree(_inBuf);
+ _inBuf = (Byte *)MyAlloc(_inBufSize);
if (_inBuf == 0)
return E_OUTOFMEMORY;
+ _inBufSizeAllocated = _inBufSize;
}
return S_OK;
}
@@ -67,6 +73,7 @@ void CDecoder::SetOutStreamSizeResume(const UInt64 *outSize)
if (_outSizeDefined)
_outSize = *outSize;
_outSizeProcessed = 0;
+ _wrPos = 0;
LzmaDec_Init(&_state);
}
@@ -85,19 +92,17 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *
UInt64 startInProgress = _inSizeProcessed;
+ SizeT next = (_state.dicBufSize - _state.dicPos < _outBufSize) ? _state.dicBufSize : (_state.dicPos + _outBufSize);
for (;;)
{
if (_inPos == _inSize)
{
_inPos = _inSize = 0;
- RINOK(inStream->Read(_inBuf, kInBufSize, &_inSize));
+ RINOK(inStream->Read(_inBuf, _inBufSizeAllocated, &_inSize));
}
SizeT dicPos = _state.dicPos;
- SizeT curSize = _state.dicBufSize - dicPos;
- const UInt32 kStepSize = ((UInt32)1 << 22);
- if (curSize > kStepSize)
- curSize = (SizeT)kStepSize;
+ SizeT curSize = next - dicPos;
ELzmaFinishMode finishMode = LZMA_FINISH_ANY;
if (_outSizeDefined)
@@ -123,9 +128,18 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *
bool finished = (inSizeProcessed == 0 && outSizeProcessed == 0);
bool stopDecoding = (_outSizeDefined && _outSizeProcessed >= _outSize);
- if (res != 0 || _state.dicPos == _state.dicBufSize || finished || stopDecoding)
+ if (res != 0 || _state.dicPos == next || finished || stopDecoding)
{
- HRESULT res2 = WriteStream(outStream, _state.dic, _state.dicPos);
+ HRESULT res2 = WriteStream(outStream, _state.dic + _wrPos, _state.dicPos - _wrPos);
+
+ _wrPos = _state.dicPos;
+ if (_state.dicPos == _state.dicBufSize)
+ {
+ _state.dicPos = 0;
+ _wrPos = 0;
+ }
+ next = (_state.dicBufSize - _state.dicPos < _outBufSize) ? _state.dicBufSize : (_state.dicPos + _outBufSize);
+
if (res != 0)
return S_FALSE;
RINOK(res2);
@@ -134,9 +148,6 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *
if (finished)
return (status == LZMA_STATUS_FINISHED_WITH_MARK ? S_OK : S_FALSE);
}
- if (_state.dicPos == _state.dicBufSize)
- _state.dicPos = 0;
-
if (progress)
{
UInt64 inSize = _inSizeProcessed - startInProgress;
@@ -148,6 +159,8 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *
STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
{
+ if (_inBuf == 0)
+ return E_INVALIDARG;
SetOutStreamSize(outSize);
return CodeSpec(inStream, outStream, progress);
}
@@ -166,7 +179,7 @@ STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize)
if (_inPos == _inSize)
{
_inPos = _inSize = 0;
- RINOK(_inStream->Read(_inBuf, kInBufSize, &_inSize));
+ RINOK(_inStream->Read(_inBuf, _inBufSizeAllocated, &_inSize));
}
{
SizeT inProcessed = _inSize - _inPos;
@@ -214,7 +227,7 @@ HRESULT CDecoder::ReadFromInputStream(void *data, UInt32 size, UInt32 *processed
if (_inPos == _inSize)
{
_inPos = _inSize = 0;
- RINOK(_inStream->Read(_inBuf, kInBufSize, &_inSize));
+ RINOK(_inStream->Read(_inBuf, _inBufSizeAllocated, &_inSize));
if (_inSize == 0)
break;
}
diff --git a/CPP/7zip/Compress/LzmaDecoder.h b/CPP/7zip/Compress/LzmaDecoder.h
index b4c7c135..d28a4634 100755
--- a/CPP/7zip/Compress/LzmaDecoder.h
+++ b/CPP/7zip/Compress/LzmaDecoder.h
@@ -14,6 +14,7 @@ namespace NLzma {
class CDecoder:
public ICompressCoder,
public ICompressSetDecoderProperties2,
+ public ICompressSetBufSize,
#ifndef NO_READ_FROM_CODER
public ICompressSetInStream,
public ICompressSetOutStreamSize,
@@ -31,7 +32,12 @@ class CDecoder:
UInt64 _outSize;
UInt64 _inSizeProcessed;
UInt64 _outSizeProcessed;
-
+
+ UInt32 _inBufSizeAllocated;
+ UInt32 _inBufSize;
+ UInt32 _outBufSize;
+ SizeT _wrPos;
+
HRESULT CreateInputBuffer();
HRESULT CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress);
void SetOutStreamSizeResume(const UInt64 *outSize);
@@ -39,6 +45,7 @@ class CDecoder:
public:
MY_QUERYINTERFACE_BEGIN2(ICompressCoder)
MY_QUERYINTERFACE_ENTRY(ICompressSetDecoderProperties2)
+ MY_QUERYINTERFACE_ENTRY(ICompressSetBufSize)
#ifndef NO_READ_FROM_CODER
MY_QUERYINTERFACE_ENTRY(ICompressSetInStream)
MY_QUERYINTERFACE_ENTRY(ICompressSetOutStreamSize)
@@ -51,6 +58,8 @@ public:
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
+ STDMETHOD(SetInBufSize)(UInt32 streamIndex, UInt32 size);
+ STDMETHOD(SetOutBufSize)(UInt32 streamIndex, UInt32 size);
#ifndef NO_READ_FROM_CODER
@@ -68,7 +77,6 @@ public:
CDecoder();
virtual ~CDecoder();
-
};
}}
diff --git a/CPP/7zip/Compress/PpmdZip.h b/CPP/7zip/Compress/PpmdZip.h
index 7deb31f4..c2288b5a 100755
--- a/CPP/7zip/Compress/PpmdZip.h
+++ b/CPP/7zip/Compress/PpmdZip.h
@@ -4,8 +4,6 @@
#ifndef __COMPRESS_PPMD_ZIP_H
#define __COMPRESS_PPMD_ZIP_H
-#include "StdAfx.h"
-
#include "../../../C/Alloc.h"
#include "../../../C/Ppmd8.h"
diff --git a/CPP/7zip/Guid.txt b/CPP/7zip/Guid.txt
index 187ad49a..7876a1da 100755
--- a/CPP/7zip/Guid.txt
+++ b/CPP/7zip/Guid.txt
@@ -11,8 +11,9 @@
07 IFileExtractCallback.h::IFolderArchiveExtractCallback
0A IOutFolderArchive
0B IFolderArchiveUpdateCallback
- 0Ń Agent.h::IArchiveFolderInternal
- 0D IInFolderArchive
+ 0C Agent.h::IArchiveFolderInternal
+ 0D
+ 0E IInFolderArchive
03 IStream.h
@@ -40,6 +41,7 @@
32 ICompressSetOutStream
33 ICompressSetInStreamSize
34 ICompressSetOutStreamSize
+ 35 ICompressSetBufSize
40 ICompressFilter
60 ICompressCodecsInfo
61 ISetCompressCodecsInfo
@@ -88,24 +90,24 @@
09 IFolderClone
0A IFolderSetFlatMode
0B IFolderOperationsExtractCallback
- 0C IFolderArchiveProperties
- 0D IGetFolderArchiveProperties
+ 0C //
+ 0D //
0E IFolderProperties
+ 0F
+ 10 IFolderArcProps
+ 11 IGetFolderArcProps
09 IFolder.h :: FOLDER_MANAGER_INTERFACE
- 00 - 03 // old IFolderManager
- 04 IFolderManager
+ 00 - 04 // old IFolderManager
+ 05 IFolderManager
-
-------------------
-
-
-{23170F69-40C1-278D-0000-000100010000} PluginInterface::IInitContextMenu
-{23170F69-40C1-278D-0000-000100020100} PluginInterface::IPluginOptionsCallback
-{23170F69-40C1-278D-0000-000100020000} PluginInterface::IPluginOptions
+// 0A PluginInterface.h
+ 00 IInitContextMenu
+ 01 IPluginOptionsCallback
+ 02 IPluginOptions
Handler GUIDs:
diff --git a/CPP/7zip/ICoder.h b/CPP/7zip/ICoder.h
index 6a2ca6ca..a518de46 100755
--- a/CPP/7zip/ICoder.h
+++ b/CPP/7zip/ICoder.h
@@ -107,6 +107,12 @@ CODER_INTERFACE(ICompressSetOutStreamSize, 0x34)
STDMETHOD(SetOutStreamSize)(const UInt64 *outSize) PURE;
};
+CODER_INTERFACE(ICompressSetBufSize, 0x35)
+{
+ STDMETHOD(SetInBufSize)(UInt32 streamIndex, UInt32 size) PURE;
+ STDMETHOD(SetOutBufSize)(UInt32 streamIndex, UInt32 size) PURE;
+};
+
CODER_INTERFACE(ICompressFilter, 0x40)
{
STDMETHOD(Init)() PURE;
diff --git a/CPP/7zip/MyVersion.h b/CPP/7zip/MyVersion.h
index 14f1c971..337e5725 100755
--- a/CPP/7zip/MyVersion.h
+++ b/CPP/7zip/MyVersion.h
@@ -1,8 +1,8 @@
#define MY_VER_MAJOR 9
-#define MY_VER_MINOR 12
+#define MY_VER_MINOR 13
#define MY_VER_BUILD 0
-#define MY_VERSION "9.12 beta"
-#define MY_7ZIP_VERSION "7-Zip 9.12 beta"
-#define MY_DATE "2010-03-24"
+#define MY_VERSION "9.13 beta"
+#define MY_7ZIP_VERSION "7-Zip 9.13 beta"
+#define MY_DATE "2010-04-15"
#define MY_COPYRIGHT "Copyright (c) 1999-2010 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
diff --git a/CPP/7zip/UI/Agent/Agent.cpp b/CPP/7zip/UI/Agent/Agent.cpp
index 0b8f7c37..4db95c87 100755
--- a/CPP/7zip/UI/Agent/Agent.cpp
+++ b/CPP/7zip/UI/Agent/Agent.cpp
@@ -278,15 +278,15 @@ struct CArchiveItemPropertyTemp
VARTYPE Type;
};
-STDMETHODIMP CAgentFolder::GetNumberOfProperties(UInt32 *numProperties)
+STDMETHODIMP CAgentFolder::GetNumberOfProperties(UInt32 *numProps)
{
COM_TRY_BEGIN
- RINOK(_agentSpec->GetArchive()->GetNumberOfProperties(numProperties));
- *numProperties += kNumProperties;
+ RINOK(_agentSpec->GetArchive()->GetNumberOfProperties(numProps));
+ *numProps += kNumProperties;
if (!_flatMode)
- (*numProperties)--;
+ (*numProps)--;
if (!_agentSpec->_proxyArchive->ThereIsPathProp)
- (*numProperties)++;
+ (*numProps)++;
return S_OK;
COM_TRY_END
}
@@ -294,8 +294,8 @@ STDMETHODIMP CAgentFolder::GetNumberOfProperties(UInt32 *numProperties)
STDMETHODIMP CAgentFolder::GetPropertyInfo(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType)
{
COM_TRY_BEGIN
- UInt32 numProperties;
- _agentSpec->GetArchive()->GetNumberOfProperties(&numProperties);
+ UInt32 numProps;
+ _agentSpec->GetArchive()->GetNumberOfProperties(&numProps);
if (!_agentSpec->_proxyArchive->ThereIsPathProp)
{
if (index == 0)
@@ -308,7 +308,7 @@ STDMETHODIMP CAgentFolder::GetPropertyInfo(UInt32 index, BSTR *name, PROPID *pro
index--;
}
- if (index < numProperties)
+ if (index < numProps)
{
RINOK(_agentSpec->GetArchive()->GetPropertyInfo(index, name, propID, varType));
if (*propID == kpidPath)
@@ -316,7 +316,7 @@ STDMETHODIMP CAgentFolder::GetPropertyInfo(UInt32 index, BSTR *name, PROPID *pro
}
else
{
- const STATPROPSTG &srcItem = kProperties[index - numProperties];
+ const STATPROPSTG &srcItem = kProperties[index - numProps];
*propID = srcItem.propid;
*varType = srcItem.vt;
*name = 0;
@@ -356,9 +356,9 @@ STDMETHODIMP CAgentFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value)
COM_TRY_END
}
-STDMETHODIMP CAgentFolder::GetNumberOfFolderProperties(UInt32 *numProperties)
+STDMETHODIMP CAgentFolder::GetNumberOfFolderProperties(UInt32 *numProps)
{
- *numProperties = kNumFolderProps;
+ *numProps = kNumFolderProps;
return S_OK;
}
@@ -374,9 +374,9 @@ STDMETHODIMP CAgentFolder::GetFolderPropertyInfo(UInt32 index, BSTR *name, PROPI
}
}
-STDMETHODIMP CAgentFolder::GetFolderArchiveProperties(IFolderArchiveProperties **object)
+STDMETHODIMP CAgentFolder::GetFolderArcProps(IFolderArcProps **object)
{
- CMyComPtr<IFolderArchiveProperties> temp = _agentSpec;
+ CMyComPtr<IFolderArcProps> temp = _agentSpec;
*object = temp.Detach();
return S_OK;
}
@@ -468,6 +468,7 @@ CAgent::~CAgent()
STDMETHODIMP CAgent::Open(
IInStream *inStream,
const wchar_t *filePath,
+ const wchar_t *arcFormat,
BSTR *archiveType,
IArchiveOpenCallback *openArchiveCallback)
{
@@ -488,7 +489,11 @@ STDMETHODIMP CAgent::Open(
_compressCodecsInfo = _codecs;
RINOK(_codecs->Load());
- RINOK(_archiveLink.Open(_codecs, CIntVector(), false, inStream, _archiveFilePath, openArchiveCallback));
+ CIntVector formatIndices;
+ if (!_codecs->FindFormatForArchiveType(arcFormat, formatIndices))
+ return S_FALSE;
+
+ RINOK(_archiveLink.Open(_codecs, formatIndices, false, inStream, _archiveFilePath, openArchiveCallback));
CArc &arc = _archiveLink.Arcs.Back();
if (!inStream)
@@ -573,10 +578,10 @@ STDMETHODIMP CAgent::Extract(
COM_TRY_END
}
-STDMETHODIMP CAgent::GetNumberOfProperties(UInt32 *numProperties)
+STDMETHODIMP CAgent::GetNumberOfProperties(UInt32 *numProps)
{
COM_TRY_BEGIN
- return GetArchive()->GetNumberOfProperties(numProperties);
+ return GetArchive()->GetNumberOfProperties(numProps);
COM_TRY_END
}
@@ -591,25 +596,50 @@ STDMETHODIMP CAgent::GetPropertyInfo(UInt32 index,
COM_TRY_END
}
-STDMETHODIMP CAgent::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
+STDMETHODIMP CAgent::GetArcNumLevels(UInt32 *numLevels)
{
- COM_TRY_BEGIN
- return GetArchive()->GetArchiveProperty(propID, value);
- COM_TRY_END
+ *numLevels = _archiveLink.Arcs.Size();
+ return S_OK;
}
-STDMETHODIMP CAgent::GetNumberOfArchiveProperties(UInt32 *numProperties)
+STDMETHODIMP CAgent::GetArcProp(UInt32 level, PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
- return GetArchive()->GetNumberOfArchiveProperties(numProperties);
+ NWindows::NCOM::CPropVariant prop;
+ CArc &arc = _archiveLink.Arcs[level];
+ switch(propID)
+ {
+ case kpidType: prop = _codecs->Formats[arc.FormatIndex].Name; break;
+ case kpidPath: prop = arc.Path; break;
+ default: return arc.Archive->GetArchiveProperty(propID, value);
+ }
+ prop.Detach(value);
+ return S_OK;
COM_TRY_END
}
-STDMETHODIMP CAgent::GetArchivePropertyInfo(UInt32 index,
- BSTR *name, PROPID *propID, VARTYPE *varType)
+STDMETHODIMP CAgent::GetArcNumProps(UInt32 level, UInt32 *numProps)
{
- COM_TRY_BEGIN
- return GetArchive()->GetArchivePropertyInfo(index,
- name, propID, varType);
- COM_TRY_END
+ return _archiveLink.Arcs[level].Archive->GetNumberOfArchiveProperties(numProps);
+}
+
+STDMETHODIMP CAgent::GetArcPropInfo(UInt32 level, UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType)
+{
+ return _archiveLink.Arcs[level].Archive->GetArchivePropertyInfo(index, name, propID, varType);
+}
+
+// MainItemProperty
+STDMETHODIMP CAgent::GetArcProp2(UInt32 level, PROPID propID, PROPVARIANT *value)
+{
+ return _archiveLink.Arcs[level - 1].Archive->GetProperty(_archiveLink.Arcs[level].SubfileIndex, propID, value);
+}
+
+STDMETHODIMP CAgent::GetArcNumProps2(UInt32 level, UInt32 *numProps)
+{
+ return _archiveLink.Arcs[level - 1].Archive->GetNumberOfProperties(numProps);
+}
+
+STDMETHODIMP CAgent::GetArcPropInfo2(UInt32 level, UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType)
+{
+ return _archiveLink.Arcs[level - 1].Archive->GetPropertyInfo(index, name, propID, varType);
}
diff --git a/CPP/7zip/UI/Agent/Agent.h b/CPP/7zip/UI/Agent/Agent.h
index 6e157615..c5efb411 100755
--- a/CPP/7zip/UI/Agent/Agent.h
+++ b/CPP/7zip/UI/Agent/Agent.h
@@ -36,7 +36,7 @@ class CAgent;
class CAgentFolder:
public IFolderFolder,
public IFolderProperties,
- public IGetFolderArchiveProperties,
+ public IGetFolderArcProps,
public IArchiveFolder,
public IArchiveFolderInternal,
public IInArchiveGetStream,
@@ -50,7 +50,7 @@ public:
MY_QUERYINTERFACE_BEGIN2(IFolderFolder)
MY_QUERYINTERFACE_ENTRY(IFolderProperties)
- MY_QUERYINTERFACE_ENTRY(IGetFolderArchiveProperties)
+ MY_QUERYINTERFACE_ENTRY(IGetFolderArcProps)
MY_QUERYINTERFACE_ENTRY(IArchiveFolder)
MY_QUERYINTERFACE_ENTRY(IArchiveFolderInternal)
MY_QUERYINTERFACE_ENTRY(IInArchiveGetStream)
@@ -68,7 +68,7 @@ public:
INTERFACE_FolderFolder(;)
INTERFACE_FolderProperties(;)
- STDMETHOD(GetFolderArchiveProperties)(IFolderArchiveProperties **object);
+ STDMETHOD(GetFolderArcProps)(IFolderArcProps **object);
// IArchiveFolder
STDMETHOD(Extract)(const UINT32 *indices, UINT32 numItems,
@@ -132,7 +132,7 @@ private:
class CAgent:
public IInFolderArchive,
- public IFolderArchiveProperties,
+ public IFolderArcProps,
#ifndef EXTRACT_ONLY
public IOutFolderArchive,
public ISetProperties,
@@ -142,7 +142,7 @@ class CAgent:
public:
MY_QUERYINTERFACE_BEGIN2(IInFolderArchive)
- MY_QUERYINTERFACE_ENTRY(IFolderArchiveProperties)
+ MY_QUERYINTERFACE_ENTRY(IFolderArcProps)
#ifndef EXTRACT_ONLY
MY_QUERYINTERFACE_ENTRY(IOutFolderArchive)
MY_QUERYINTERFACE_ENTRY(ISetProperties)
@@ -151,7 +151,7 @@ public:
MY_ADDREF_RELEASE
INTERFACE_IInFolderArchive(;)
- INTERFACE_IFolderArchiveProperties(;)
+ INTERFACE_IFolderArcProps(;)
#ifndef EXTRACT_ONLY
INTERFACE_IOutFolderArchive(;)
diff --git a/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp b/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
index af9f6df0..477e052c 100755
--- a/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
+++ b/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
@@ -34,7 +34,8 @@ int CArchiveFolderManager::FindFormat(const UString &type)
return -1;
}
-STDMETHODIMP CArchiveFolderManager::OpenFolderFile(IInStream *inStream, const wchar_t *filePath,
+STDMETHODIMP CArchiveFolderManager::OpenFolderFile(IInStream *inStream,
+ const wchar_t *filePath, const wchar_t *arcFormat,
IFolderFolder **resultFolder, IProgress *progress)
{
CMyComPtr<IArchiveOpenCallback> openArchiveCallback;
@@ -45,7 +46,7 @@ STDMETHODIMP CArchiveFolderManager::OpenFolderFile(IInStream *inStream, const wc
}
CAgent *agent = new CAgent();
CMyComPtr<IInFolderArchive> archive = agent;
- RINOK(agent->Open(inStream, filePath, NULL, openArchiveCallback));
+ RINOK(agent->Open(inStream, filePath, arcFormat, NULL, openArchiveCallback));
return agent->BindToRootFolder(resultFolder);
}
diff --git a/CPP/7zip/UI/Agent/IFolderArchive.h b/CPP/7zip/UI/Agent/IFolderArchive.h
index 7b5b0ba4..867ae279 100755
--- a/CPP/7zip/UI/Agent/IFolderArchive.h
+++ b/CPP/7zip/UI/Agent/IFolderArchive.h
@@ -27,7 +27,7 @@ FOLDER_ARCHIVE_INTERFACE(IArchiveFolder, 0x05)
};
#define INTERFACE_IInFolderArchive(x) \
- STDMETHOD(Open)(IInStream *inStream, const wchar_t *filePath, BSTR *archiveType, IArchiveOpenCallback *openArchiveCallback) x; \
+ STDMETHOD(Open)(IInStream *inStream, const wchar_t *filePath, const wchar_t *arcFormat, BSTR *archiveTypeRes, IArchiveOpenCallback *openArchiveCallback) x; \
STDMETHOD(ReOpen)(IArchiveOpenCallback *openArchiveCallback) x; \
STDMETHOD(Close)() x; \
STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties) x; \
@@ -37,7 +37,7 @@ FOLDER_ARCHIVE_INTERFACE(IArchiveFolder, 0x05)
NExtract::NOverwriteMode::EEnum overwriteMode, const wchar_t *path, \
Int32 testMode, IFolderArchiveExtractCallback *extractCallback2) x; \
-FOLDER_ARCHIVE_INTERFACE(IInFolderArchive, 0x0D)
+FOLDER_ARCHIVE_INTERFACE(IInFolderArchive, 0x0E)
{
INTERFACE_IInFolderArchive(PURE)
};
diff --git a/CPP/7zip/UI/Common/Bench.cpp b/CPP/7zip/UI/Common/Bench.cpp
index 36449660..282f405f 100755
--- a/CPP/7zip/UI/Common/Bench.cpp
+++ b/CPP/7zip/UI/Common/Bench.cpp
@@ -696,9 +696,13 @@ HRESULT LzmaBench(
const UInt32 kLzmaId = 0x030101;
RINOK(CreateCoder(EXTERNAL_CODECS_LOC_VARS kLzmaId, encoder.encoder, true));
+ if (!encoder.encoder)
+ return E_NOTIMPL;
for (UInt32 j = 0; j < numSubDecoderThreads; j++)
{
RINOK(CreateCoder(EXTERNAL_CODECS_LOC_VARS kLzmaId, encoder.decoders[j], false));
+ if (!encoder.decoders[j])
+ return E_NOTIMPL;
}
}
diff --git a/CPP/7zip/UI/Console/Console.dsp b/CPP/7zip/UI/Console/Console.dsp
index aa2e0cb8..09633ee5 100755
--- a/CPP/7zip/UI/Console/Console.dsp
+++ b/CPP/7zip/UI/Console/Console.dsp
@@ -160,35 +160,35 @@ SOURCE=.\StdAfx.h
# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\ConsoleClose.cpp
+SOURCE=.\BenchCon.cpp
# End Source File
# Begin Source File
-SOURCE=.\ConsoleClose.h
+SOURCE=.\BenchCon.h
# End Source File
# Begin Source File
-SOURCE=.\ExtractCallbackConsole.cpp
+SOURCE=.\ConsoleClose.cpp
# End Source File
# Begin Source File
-SOURCE=.\ExtractCallbackConsole.h
+SOURCE=.\ConsoleClose.h
# End Source File
# Begin Source File
-SOURCE=.\List.cpp
+SOURCE=.\ExtractCallbackConsole.cpp
# End Source File
# Begin Source File
-SOURCE=.\List.h
+SOURCE=.\ExtractCallbackConsole.h
# End Source File
# Begin Source File
-SOURCE=.\BenchCon.cpp
+SOURCE=.\List.cpp
# End Source File
# Begin Source File
-SOURCE=.\BenchCon.h
+SOURCE=.\List.h
# End Source File
# Begin Source File
@@ -364,10 +364,6 @@ SOURCE=..\..\..\Common\Defs.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Exception.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\..\Common\IntToString.cpp
# End Source File
# Begin Source File
@@ -488,7 +484,11 @@ SOURCE=..\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
-SOURCE=..\Common\CompressionMode.h
+SOURCE=..\Common\Bench.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common\Bench.h
# End Source File
# Begin Source File
@@ -532,10 +532,6 @@ SOURCE=..\Common\ExtractingFilePath.h
# End Source File
# Begin Source File
-SOURCE=..\Common\HandlerLoader.h
-# End Source File
-# Begin Source File
-
SOURCE=..\Common\IFileExtractCallback.h
# End Source File
# Begin Source File
@@ -548,14 +544,6 @@ SOURCE=..\Common\LoadCodecs.h
# End Source File
# Begin Source File
-SOURCE=..\Common\Bench.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\Common\Bench.h
-# End Source File
-# Begin Source File
-
SOURCE=..\Common\OpenArchive.cpp
# End Source File
# Begin Source File
diff --git a/CPP/7zip/UI/Console/List.cpp b/CPP/7zip/UI/Console/List.cpp
index 17f5392a..85eeea20 100755
--- a/CPP/7zip/UI/Console/List.cpp
+++ b/CPP/7zip/UI/Console/List.cpp
@@ -502,7 +502,7 @@ HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
{
const CArc &arc = archiveLink.Arcs[i];
- g_StdOut << "----\n";
+ g_StdOut << "--\n";
PrintPropPair(L"Path", arc.Path);
PrintPropPair(L"Type", codecs->Formats[arc.FormatIndex].Name);
UInt32 numProps;
@@ -524,6 +524,30 @@ HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
PrintPropPair(GetPropName(propID, name), s);
}
}
+ if (i != archiveLink.Arcs.Size() - 1)
+ {
+ UInt32 numProps;
+ g_StdOut << "----\n";
+ if (archive->GetNumberOfProperties(&numProps) == S_OK)
+ {
+ UInt32 mainIndex = archiveLink.Arcs[i + 1].SubfileIndex;
+ for (UInt32 j = 0; j < numProps; j++)
+ {
+ CMyComBSTR name;
+ PROPID propID;
+ VARTYPE vt;
+ if (archive->GetPropertyInfo(j, &name, &propID, &vt) != S_OK)
+ continue;
+ NCOM::CPropVariant prop;
+ if (archive->GetProperty(mainIndex, propID, &prop) != S_OK)
+ continue;
+ UString s = ConvertPropertyToString(prop, propID);
+ if (!s.IsEmpty())
+ PrintPropPair(GetPropName(propID, name), s);
+ }
+ }
+ }
+
}
g_StdOut << endl;
if (techMode)
diff --git a/CPP/7zip/UI/Explorer/ContextMenu.cpp b/CPP/7zip/UI/Explorer/ContextMenu.cpp
index d8fd0e56..ca5bf816 100755
--- a/CPP/7zip/UI/Explorer/ContextMenu.cpp
+++ b/CPP/7zip/UI/Explorer/ContextMenu.cpp
@@ -94,11 +94,10 @@ STDMETHODIMP CZipContextMenu::Initialize(LPCITEMIDLIST pidlFolder, LPDATAOBJECT
return GetFileNames(dataObject, _fileNames);
}
-STDMETHODIMP CZipContextMenu::InitContextMenu(const wchar_t * /* folder */,
- const wchar_t **names, UINT32 numFiles)
+HRESULT CZipContextMenu::InitContextMenu(const wchar_t * /* folder */, const wchar_t **names, UInt32 numFiles)
{
_fileNames.Clear();
- for (UINT32 i = 0; i < numFiles; i++)
+ for (UInt32 i = 0; i < numFiles; i++)
_fileNames.Add(names[i]);
_dropMode = false;
return S_OK;
@@ -124,12 +123,12 @@ static LPCTSTR kCompressToEmailVerb = TEXT("SevenCompressToEmail");
struct CContextMenuCommand
{
- UINT32 flag;
+ UInt32 flag;
CZipContextMenu::ECommandInternalID CommandInternalID;
LPCWSTR Verb;
UINT ResourceID;
UINT ResourceHelpID;
- UINT32 LangID;
+ UInt32 LangID;
};
static CContextMenuCommand g_Commands[] =
@@ -224,7 +223,7 @@ static CContextMenuCommand g_Commands[] =
}
};
-int FindCommand(CZipContextMenu::ECommandInternalID &id)
+static int FindCommand(CZipContextMenu::ECommandInternalID &id)
{
for (int i = 0; i < sizeof(g_Commands) / sizeof(g_Commands[0]); i++)
if (g_Commands[i].CommandInternalID == id)
@@ -336,6 +335,9 @@ static const char *kExtractExludeExtensions =
" xml xsd xsl xslt"
" ";
+static const char *kNoOpenAsExtensions =
+ " 7z arj bz2 cab chm cpio dmg flv gz lha lzh lzma rar swm tar tbz2 tgz wim xar xz z zip ";
+
static bool FindExt(const char *p, const UString &name)
{
int extPos = name.ReverseFind('.');
@@ -415,40 +417,55 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
if (!fileInfo.IsDir() && DoNeedExtract(fileInfo.Name))
{
// Open
- if ((contextMenuFlags & NContextMenuFlags::kOpen) != 0)
+ bool thereIsMainOpenItem = ((contextMenuFlags & NContextMenuFlags::kOpen) != 0);
+ if (thereIsMainOpenItem)
{
CCommandMapItem commandMapItem;
FillCommand(kOpen, mainString, commandMapItem);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
_commandMap.Add(commandMapItem);
-
- /*
- if (FindExt(" exe dll ", fileInfo.Name))
+ }
+ if ((contextMenuFlags & NContextMenuFlags::kOpenAs) != 0 &&
+ (!thereIsMainOpenItem || !FindExt(kNoOpenAsExtensions, fileInfo.Name)))
+ {
+ CMenu subMenu;
+ if (subMenu.CreatePopup())
{
- CMenu subMenu;
- if (subMenu.CreatePopup())
+ CCommandMapItem commandMapItem;
+
+ CMenuItem menuItem;
+ menuItem.fType = MFT_STRING;
+ menuItem.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_ID;
+ menuItem.wID = currentCommandID++;
+ menuItem.hSubMenu = subMenu;
+ menuItem.StringValue = LangString(IDS_CONTEXT_OPEN, 0x02000103);
+ popupMenu.InsertItem(subIndex++, true, menuItem);
+
+ commandMapItem.CommandInternalID = kCommandNULL;
+ commandMapItem.Verb = kMainVerb;
+ commandMapItem.HelpString = LangString(IDS_CONTEXT_OPEN_HELP, 0x02000104);
+ _commandMap.Add(commandMapItem);
+
+ UINT subIndex2 = 0;
+ const wchar_t *exts[] = { L"", L"*", L"7z", L"zip", L"cab", L"rar" };
+ for (int i = (thereIsMainOpenItem ? 1 : 0); i < sizeof(exts) / sizeof(exts[0]); i++)
{
- CMenuItem menuItem;
- menuItem.fType = MFT_STRING;
- menuItem.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_ID;
- menuItem.wID = currentCommandID++;
- menuItem.hSubMenu = subMenu;
- menuItem.StringValue = LangString(IDS_CONTEXT_OPEN, 0x02000103);
- popupMenu.InsertItem(subIndex++, true, menuItem);
- const wchar_t *exts[] = { L"7z", L"cab", L"rar", L"zip", L"pe" };
- for (int i = 0; i < sizeof(exts) / sizeof(exts[0]); i++)
+ CCommandMapItem commandMapItem;
+ if (i == 0)
+ FillCommand(kOpen, mainString, commandMapItem);
+ else
{
- CCommandMapItem commandMapItem;
- FillCommand(kOpenAs, mainString, commandMapItem);
mainString = exts[i];
- commandMapItem.ArchiveType = mainString;
- MyInsertMenu(subMenu, subIndex++, currentCommandID++, mainString);
- _commandMap.Add(commandMapItem);
+ commandMapItem.CommandInternalID = kOpen;
+ commandMapItem.Verb = (UString)kMainVerb + L".Open." + mainString;
+ commandMapItem.HelpString = mainString;
+ commandMapItem.ArcType = mainString;
}
- subMenu.Detach();
+ MyInsertMenu(subMenu, subIndex2++, currentCommandID++, mainString);
+ _commandMap.Add(commandMapItem);
}
+ subMenu.Detach();
}
- */
}
}
}
@@ -542,7 +559,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
commandMapItem.Folder = _dropPath;
else
commandMapItem.Folder = archivePathPrefix;
- commandMapItem.Archive = archiveName;
+ commandMapItem.ArcName = archiveName;
FillCommand(kCompress, mainString, commandMapItem);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
_commandMap.Add(commandMapItem);
@@ -553,7 +570,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
if ((contextMenuFlags & NContextMenuFlags::kCompressEmail) != 0 && !_dropMode)
{
CCommandMapItem commandMapItem;
- commandMapItem.Archive = archiveName;
+ commandMapItem.ArcName = archiveName;
FillCommand(kCompressEmail, mainString, commandMapItem);
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, mainString);
_commandMap.Add(commandMapItem);
@@ -570,8 +587,8 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
commandMapItem.Folder = _dropPath;
else
commandMapItem.Folder = archivePathPrefix;
- commandMapItem.Archive = archiveName7z;
- commandMapItem.ArchiveType = L"7z";
+ commandMapItem.ArcName = archiveName7z;
+ commandMapItem.ArcType = L"7z";
s = MyFormatNew(s, GetQuotedReducedString(archiveName7z));
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem);
@@ -584,8 +601,8 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
CCommandMapItem commandMapItem;
UString s;
FillCommand(kCompressTo7zEmail, s, commandMapItem);
- commandMapItem.Archive = archiveName7z;
- commandMapItem.ArchiveType = L"7z";
+ commandMapItem.ArcName = archiveName7z;
+ commandMapItem.ArcType = L"7z";
s = MyFormatNew(s, GetQuotedReducedString(archiveName7z));
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem);
@@ -602,8 +619,8 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
commandMapItem.Folder = _dropPath;
else
commandMapItem.Folder = archivePathPrefix;
- commandMapItem.Archive = archiveNameZip;
- commandMapItem.ArchiveType = L"zip";
+ commandMapItem.ArcName = archiveNameZip;
+ commandMapItem.ArcType = L"zip";
s = MyFormatNew(s, GetQuotedReducedString(archiveNameZip));
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem);
@@ -616,8 +633,8 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
CCommandMapItem commandMapItem;
UString s;
FillCommand(kCompressToZipEmail, s, commandMapItem);
- commandMapItem.Archive = archiveNameZip;
- commandMapItem.ArchiveType = L"zip";
+ commandMapItem.ArcName = archiveNameZip;
+ commandMapItem.ArcType = L"zip";
s = MyFormatNew(s, GetQuotedReducedString(archiveNameZip));
MyInsertMenu(popupMenu, subIndex++, currentCommandID++, s);
_commandMap.Add(commandMapItem);
@@ -691,15 +708,21 @@ STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
return E_FAIL;
const CCommandMapItem commandMapItem = _commandMap[commandOffset];
- ECommandInternalID commandInternalID = commandMapItem.CommandInternalID;
+ ECommandInternalID cmdID = commandMapItem.CommandInternalID;
try
{
- switch(commandInternalID)
+ switch(cmdID)
{
case kOpen:
{
- UString params = GetQuotedString(_fileNames[0]);
+ UString params;
+ params = GetQuotedString(_fileNames[0]);
+ if (commandMapItem.ArcType)
+ {
+ params += L" -t";
+ params += commandMapItem.ArcType;
+ }
MyCreateProcess(Get7zFmPath(), params);
break;
}
@@ -707,7 +730,7 @@ STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
case kExtractHere:
case kExtractTo:
{
- ExtractArchives(_fileNames, commandMapItem.Folder, (commandInternalID == kExtract));
+ ExtractArchives(_fileNames, commandMapItem.Folder, (cmdID == kExtract));
break;
}
case kTest:
@@ -723,14 +746,14 @@ STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
case kCompressToZipEmail:
{
bool email =
- (commandInternalID == kCompressEmail) ||
- (commandInternalID == kCompressTo7zEmail) ||
- (commandInternalID == kCompressToZipEmail);
+ (cmdID == kCompressEmail) ||
+ (cmdID == kCompressTo7zEmail) ||
+ (cmdID == kCompressToZipEmail);
bool showDialog =
- (commandInternalID == kCompress) ||
- (commandInternalID == kCompressEmail);
+ (cmdID == kCompress) ||
+ (cmdID == kCompressEmail);
CompressFiles(commandMapItem.Folder,
- commandMapItem.Archive, commandMapItem.ArchiveType,
+ commandMapItem.ArcName, commandMapItem.ArcType,
_fileNames, email, showDialog, false);
break;
}
diff --git a/CPP/7zip/UI/Explorer/ContextMenu.h b/CPP/7zip/UI/Explorer/ContextMenu.h
index e0ee6376..76337b19 100755
--- a/CPP/7zip/UI/Explorer/ContextMenu.h
+++ b/CPP/7zip/UI/Explorer/ContextMenu.h
@@ -3,20 +3,13 @@
#ifndef __CONTEXT_MENU_H
#define __CONTEXT_MENU_H
-// {23170F69-40C1-278A-1000-000100020000}
-DEFINE_GUID(CLSID_CZipContextMenu,
-0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
-
#include "Common/MyString.h"
-#include "../FileManager/PluginInterface.h"
#include "../FileManager/MyCom2.h"
-
class CZipContextMenu:
public IContextMenu,
public IShellExtInit,
- public IInitContextMenu,
public CMyUnknownImp
{
public:
@@ -37,17 +30,7 @@ public:
kCompressToZipEmail
};
- struct CCommandMapItem
- {
- ECommandInternalID CommandInternalID;
- UString Verb;
- UString HelpString;
- UString Folder;
- UString Archive;
- UString ArchiveType;
- };
-
- MY_UNKNOWN_IMP3_MT(IContextMenu, IShellExtInit, IInitContextMenu)
+ MY_UNKNOWN_IMP2_MT(IContextMenu, IShellExtInit)
// IShellExtInit
STDMETHOD(Initialize)(LPCITEMIDLIST pidlFolder, LPDATAOBJECT dataObject, HKEY hkeyProgID);
@@ -57,22 +40,31 @@ public:
STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici);
STDMETHOD(GetCommandString)(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax);
- // IInitContextMenu
- STDMETHOD(InitContextMenu)(const wchar_t *folder, const wchar_t **names, UINT32 numFiles);
+ HRESULT InitContextMenu(const wchar_t *folder, const wchar_t **names, UINT32 numFiles);
+
+ CZipContextMenu();
+ ~CZipContextMenu();
+
private:
+
+ struct CCommandMapItem
+ {
+ ECommandInternalID CommandInternalID;
+ UString Verb;
+ UString HelpString;
+ UString Folder;
+ UString ArcName;
+ UString ArcType;
+ };
+
UStringVector _fileNames;
bool _dropMode;
UString _dropPath;
CObjectVector<CCommandMapItem> _commandMap;
HRESULT GetFileNames(LPDATAOBJECT dataObject, UStringVector &fileNames);
-
int FindVerb(const UString &verb);
-
void FillCommand(ECommandInternalID id, UString &mainString, CCommandMapItem &commandMapItem);
-public:
- CZipContextMenu();
- ~CZipContextMenu();
};
#endif
diff --git a/CPP/7zip/UI/Explorer/ContextMenuFlags.h b/CPP/7zip/UI/Explorer/ContextMenuFlags.h
index 248b7602..2f9d94d4 100755
--- a/CPP/7zip/UI/Explorer/ContextMenuFlags.h
+++ b/CPP/7zip/UI/Explorer/ContextMenuFlags.h
@@ -1,34 +1,24 @@
// ContextMenuFlags.h
-#ifndef __SEVENZIP_CONTEXTMENUFLAGS_H
-#define __SEVENZIP_CONTEXTMENUFLAGS_H
+#ifndef __CONTEXT_MENU_FLAGS_H
+#define __CONTEXT_MENU_FLAGS_H
namespace NContextMenuFlags
{
- const UINT32 kExtract = 1 << 0;
- const UINT32 kExtractHere = 1 << 1;
- const UINT32 kExtractTo = 1 << 2;
- // const UINT32 kExtractEach = 1 << 3;
-
- const UINT32 kTest = 1 << 4;
-
- const UINT32 kOpen = 1 << 5;
-
- const UINT32 kCompress = 1 << 8;
- const UINT32 kCompressTo7z = 1 << 9;
- const UINT32 kCompressEmail = 1 << 10;
- const UINT32 kCompressTo7zEmail = 1 << 11;
-
- const UINT32 kCompressToZip = 1 << 12;
- const UINT32 kCompressToZipEmail = 1 << 13;
-
- inline UINT32 GetDefaultFlags() {
- return
- kOpen | kTest |
- kExtract | kExtractHere | kExtractTo |
- kCompress | kCompressEmail |
- kCompressTo7z | kCompressTo7zEmail |
- kCompressToZip | kCompressToZipEmail; }
+ const UInt32 kExtract = 1 << 0;
+ const UInt32 kExtractHere = 1 << 1;
+ const UInt32 kExtractTo = 1 << 2;
+
+ const UInt32 kTest = 1 << 4;
+ const UInt32 kOpen = 1 << 5;
+ const UInt32 kOpenAs = 1 << 6;
+
+ const UInt32 kCompress = 1 << 8;
+ const UInt32 kCompressTo7z = 1 << 9;
+ const UInt32 kCompressEmail = 1 << 10;
+ const UInt32 kCompressTo7zEmail = 1 << 11;
+ const UInt32 kCompressToZip = 1 << 12;
+ const UInt32 kCompressToZipEmail = 1 << 13;
}
#endif
diff --git a/CPP/7zip/UI/Explorer/DllExports.cpp b/CPP/7zip/UI/Explorer/DllExports.cpp
index 5004c1ac..bc8ae177 100755
--- a/CPP/7zip/UI/Explorer/DllExports.cpp
+++ b/CPP/7zip/UI/Explorer/DllExports.cpp
@@ -26,6 +26,10 @@
#include "ContextMenu.h"
+// {23170F69-40C1-278A-1000-000100020000}
+DEFINE_GUID(CLSID_CZipContextMenu,
+0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
+
using namespace NWindows;
HINSTANCE g_hInstance = 0;
diff --git a/CPP/7zip/UI/Far/Main.cpp b/CPP/7zip/UI/Far/Main.cpp
index 65aabea6..052f75f9 100755
--- a/CPP/7zip/UI/Far/Main.cpp
+++ b/CPP/7zip/UI/Far/Main.cpp
@@ -365,7 +365,7 @@ static HANDLE MyOpenFilePlugin(const char *name)
archiveHandler = new CAgent;
CMyComBSTR archiveType;
HRESULT result = archiveHandler->Open(NULL,
- GetUnicodeString(fullName, CP_OEMCP), &archiveType, openArchiveCallback);
+ GetUnicodeString(fullName, CP_OEMCP), UString(), &archiveType, openArchiveCallback);
/*
HRESULT result = ::OpenArchive(fullName, &archiveHandler,
archiverInfoResult, defaultName, openArchiveCallback);
diff --git a/CPP/7zip/UI/Far/Messages.h b/CPP/7zip/UI/Far/Messages.h
index 9c7c69fb..7dc2ec14 100755
--- a/CPP/7zip/UI/Far/Messages.h
+++ b/CPP/7zip/UI/Far/Messages.h
@@ -20,6 +20,7 @@ enum EEnum
kYes,
kNo,
+ kPath,
kName,
kExtension,
kIsFolder,
diff --git a/CPP/7zip/UI/Far/Plugin.cpp b/CPP/7zip/UI/Far/Plugin.cpp
index 5d9b5cf0..bc70278b 100755
--- a/CPP/7zip/UI/Far/Plugin.cpp
+++ b/CPP/7zip/UI/Far/Plugin.cpp
@@ -275,6 +275,7 @@ struct CPROPIDToName
static CPROPIDToName kPROPIDToName[] =
{
+ { kpidPath, NMessageID::kPath },
{ kpidName, NMessageID::kName },
{ kpidExtension, NMessageID::kExtension },
{ kpidIsDir, NMessageID::kIsFolder },
@@ -501,6 +502,32 @@ static AString PropToString2(const NCOM::CPropVariant &prop, PROPID propID)
return s;
}
+static void AddPropertyString(InfoPanelLine *lines, int &numItems, PROPID propID, const wchar_t *name,
+ const NCOM::CPropVariant &prop)
+{
+ if (prop.vt != VT_EMPTY)
+ {
+ AString val = PropToString2(prop, propID);
+ if (!val.IsEmpty())
+ {
+ InfoPanelLine &item = lines[numItems++];
+ COPY_STR_LIMITED(item.Text, GetNameOfProp2(propID, name));
+ COPY_STR_LIMITED(item.Data, val);
+ }
+ }
+}
+
+static void InsertSeparator(InfoPanelLine *lines, int &numItems)
+{
+ if (numItems < kNumInfoLinesMax)
+ {
+ InfoPanelLine &item = lines[numItems++];
+ MyStringCopy(item.Text, "");
+ MyStringCopy(item.Data, "");
+ item.Separator = TRUE;
+ }
+}
+
void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info)
{
info->StructSize = sizeof(*info);
@@ -574,44 +601,71 @@ void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info)
}
}
+ /*
if (numItems < kNumInfoLinesMax)
{
- InfoPanelLine &item = m_InfoLines[numItems++];
- MyStringCopy(item.Text, "");
- MyStringCopy(item.Data, "");
- item.Separator = TRUE;
+ InsertSeparator(m_InfoLines, numItems);
}
+ */
{
- CMyComPtr<IGetFolderArchiveProperties> getFolderArchiveProperties;
- _folder.QueryInterface(IID_IGetFolderArchiveProperties, &getFolderArchiveProperties);
- if (getFolderArchiveProperties)
+ CMyComPtr<IGetFolderArcProps> getFolderArcProps;
+ _folder.QueryInterface(IID_IGetFolderArcProps, &getFolderArcProps);
+ if (getFolderArcProps)
{
- CMyComPtr<IFolderArchiveProperties> getProps;
- getFolderArchiveProperties->GetFolderArchiveProperties(&getProps);
+ CMyComPtr<IFolderArcProps> getProps;
+ getFolderArcProps->GetFolderArcProps(&getProps);
if (getProps)
{
- UInt32 numProps;
- if (getProps->GetNumberOfArchiveProperties(&numProps) == S_OK)
+ UInt32 numLevels;
+ if (getProps->GetArcNumLevels(&numLevels) != S_OK)
+ numLevels = 0;
+ for (UInt32 level2 = 0; level2 < numLevels; level2++)
{
- /*
- if (numProps > 0)
- message += kSeparator;
- */
- for (UInt32 i = 0; i < numProps && numItems < kNumInfoLinesMax; i++)
{
- CMyComBSTR name;
- PROPID propID;
- VARTYPE vt;
- if (getProps->GetArchivePropertyInfo(i, &name, &propID, &vt) != S_OK)
- continue;
- NCOM::CPropVariant prop;
- if (getProps->GetArchiveProperty(propID, &prop) != S_OK || prop.vt == VT_EMPTY)
- continue;
- InfoPanelLine &item = m_InfoLines[numItems++];
- COPY_STR_LIMITED(item.Text, GetNameOfProp2(propID, name));
- COPY_STR_LIMITED(item.Data, PropToString2(prop, propID));
-
+ UInt32 level = numLevels - 1 - level2;
+ UInt32 numProps;
+ if (getProps->GetArcNumProps(level, &numProps) == S_OK)
+ {
+ InsertSeparator(m_InfoLines, numItems);
+ for (Int32 i = -2; i < (Int32)numProps && numItems < kNumInfoLinesMax; i++)
+ {
+ CMyComBSTR name;
+ PROPID propID;
+ VARTYPE vt;
+ if (i == -2)
+ propID = kpidPath;
+ else if (i == -1)
+ propID = kpidType;
+ else if (getProps->GetArcPropInfo(level, i, &name, &propID, &vt) != S_OK)
+ continue;
+ NCOM::CPropVariant prop;
+ if (getProps->GetArcProp(level, propID, &prop) != S_OK)
+ continue;
+ AddPropertyString(m_InfoLines, numItems, propID, name, prop);
+ }
+ }
+ }
+ if (level2 != numLevels - 1)
+ {
+ UInt32 level = numLevels - 1 - level2;
+ UInt32 numProps;
+ if (getProps->GetArcNumProps2(level, &numProps) == S_OK)
+ {
+ InsertSeparator(m_InfoLines, numItems);
+ for (Int32 i = 0; i < (Int32)numProps && numItems < kNumInfoLinesMax; i++)
+ {
+ CMyComBSTR name;
+ PROPID propID;
+ VARTYPE vt;
+ if (getProps->GetArcPropInfo2(level, i, &name, &propID, &vt) != S_OK)
+ continue;
+ NCOM::CPropVariant prop;
+ if (getProps->GetArcProp2(level, propID, &prop) != S_OK)
+ continue;
+ AddPropertyString(m_InfoLines, numItems, propID, name, prop);
+ }
+ }
}
}
}
diff --git a/CPP/7zip/UI/Far/PluginWrite.cpp b/CPP/7zip/UI/Far/PluginWrite.cpp
index 4226aa5c..48b7d98e 100755
--- a/CPP/7zip/UI/Far/PluginWrite.cpp
+++ b/CPP/7zip/UI/Far/PluginWrite.cpp
@@ -692,7 +692,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
// CLSID realClassID;
CMyComBSTR archiveType;
RINOK(agentSpec->Open(NULL,
- GetUnicodeString(fullArchiveName, CP_OEMCP),
+ GetUnicodeString(fullArchiveName, CP_OEMCP), UString(),
// &realClassID,
&archiveType,
NULL));
diff --git a/CPP/7zip/UI/FileManager/App.cpp b/CPP/7zip/UI/FileManager/App.cpp
index 184d6ca0..c195a79d 100755
--- a/CPP/7zip/UI/FileManager/App.cpp
+++ b/CPP/7zip/UI/FileManager/App.cpp
@@ -107,7 +107,8 @@ void CApp::SetShowSystemMenu()
#define ILC_COLOR32 0x0020
#endif
-HRESULT CApp::CreateOnePanel(int panelIndex, const UString &mainPath, bool &archiveIsOpened, bool &encrypted)
+HRESULT CApp::CreateOnePanel(int panelIndex, const UString &mainPath, const UString &arcFormat,
+ bool &archiveIsOpened, bool &encrypted)
{
if (PanelsCreated[panelIndex])
return S_OK;
@@ -122,7 +123,7 @@ HRESULT CApp::CreateOnePanel(int panelIndex, const UString &mainPath, bool &arch
path = mainPath;
int id = 1000 + 100 * panelIndex;
RINOK(Panels[panelIndex].Create(_window, _window,
- id, path, &m_PanelCallbackImp[panelIndex], &AppState, archiveIsOpened, encrypted));
+ id, path, arcFormat, &m_PanelCallbackImp[panelIndex], &AppState, archiveIsOpened, encrypted));
PanelsCreated[panelIndex] = true;
return S_OK;
}
@@ -269,7 +270,7 @@ void CApp::SaveToolbarChanges()
void MyLoadMenu();
-HRESULT CApp::Create(HWND hwnd, const UString &mainPath, int xSizes[2], bool &archiveIsOpened, bool &encrypted)
+HRESULT CApp::Create(HWND hwnd, const UString &mainPath, const UString &arcFormat, int xSizes[2], bool &archiveIsOpened, bool &encrypted)
{
_window.Attach(hwnd);
#ifdef UNDER_CE
@@ -310,7 +311,7 @@ HRESULT CApp::Create(HWND hwnd, const UString &mainPath, int xSizes[2], bool &ar
bool archiveIsOpened2 = false;
bool encrypted2 = false;
bool mainPanel = (i == LastFocusedPanel);
- RINOK(CreateOnePanel(i, mainPanel ? mainPath : L"", archiveIsOpened2, encrypted2));
+ RINOK(CreateOnePanel(i, mainPanel ? mainPath : L"", arcFormat, archiveIsOpened2, encrypted2));
if (mainPanel)
{
archiveIsOpened = archiveIsOpened2;
@@ -328,7 +329,7 @@ HRESULT CApp::SwitchOnOffOnePanel()
{
NumPanels++;
bool archiveIsOpened, encrypted;
- RINOK(CreateOnePanel(1 - LastFocusedPanel, UString(), archiveIsOpened, encrypted));
+ RINOK(CreateOnePanel(1 - LastFocusedPanel, UString(), UString(), archiveIsOpened, encrypted));
Panels[1 - LastFocusedPanel].Enable(true);
Panels[1 - LastFocusedPanel].Show(SW_SHOWNORMAL);
}
@@ -596,8 +597,10 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
}
#endif
- if (indices.Size() > 1 || (!destPath.IsEmpty() && destPath.Back() == WCHAR_PATH_SEPARATOR) ||
- NFind::DoesDirExist(destPath))
+ if (indices.Size() > 1 ||
+ (!destPath.IsEmpty() && destPath.Back() == WCHAR_PATH_SEPARATOR) ||
+ NFind::DoesDirExist(destPath) ||
+ srcPanel.IsArcFolder())
{
NDirectory::CreateComplexDirectory(destPath);
NName::NormalizeDirPathPrefix(destPath);
diff --git a/CPP/7zip/UI/FileManager/App.h b/CPP/7zip/UI/FileManager/App.h
index 8c573cfa..a057c34e 100755
--- a/CPP/7zip/UI/FileManager/App.h
+++ b/CPP/7zip/UI/FileManager/App.h
@@ -161,8 +161,8 @@ public:
void OnSetSameFolder(int srcPanelIndex);
void OnSetSubFolder(int srcPanelIndex);
- HRESULT CreateOnePanel(int panelIndex, const UString &mainPath, bool &archiveIsOpened, bool &encrypted);
- HRESULT Create(HWND hwnd, const UString &mainPath, int xSizes[2], bool &archiveIsOpened, bool &encrypted);
+ HRESULT CreateOnePanel(int panelIndex, const UString &mainPath, const UString &arcFormat, bool &archiveIsOpened, bool &encrypted);
+ HRESULT Create(HWND hwnd, const UString &mainPath, const UString &arcFormat, int xSizes[2], bool &archiveIsOpened, bool &encrypted);
void Read();
void Save();
void Release();
diff --git a/CPP/7zip/UI/FileManager/ClassDefs.cpp b/CPP/7zip/UI/FileManager/ClassDefs.cpp
index 99405d9b..ca05cc6d 100755
--- a/CPP/7zip/UI/FileManager/ClassDefs.cpp
+++ b/CPP/7zip/UI/FileManager/ClassDefs.cpp
@@ -4,8 +4,4 @@
#include "Common/MyInitGuid.h"
-#include "PluginInterface.h"
#include "../Agent/Agent.h"
-
-DEFINE_GUID(CLSID_CZipContextMenu,
-0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
diff --git a/CPP/7zip/UI/FileManager/FM.cpp b/CPP/7zip/UI/FileManager/FM.cpp
index 43a8162f..639a9b23 100755
--- a/CPP/7zip/UI/FileManager/FM.cpp
+++ b/CPP/7zip/UI/FileManager/FM.cpp
@@ -37,6 +37,7 @@ HINSTANCE g_hInstance;
HWND g_HWND;
bool g_OpenArchive = false;
static UString g_MainPath;
+static UString g_ArcFormat;
static bool g_Maximized = false;
#ifndef UNDER_CE
@@ -443,7 +444,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
UString paramString, tailString;
SplitStringToTwoStrings(commandsString, paramString, tailString);
paramString.Trim();
-
+ tailString.Trim();
+ if (tailString.Left(2) == L"-t")
+ g_ArcFormat = tailString.Mid(2);
if (!paramString.IsEmpty())
{
g_MainPath = paramString;
@@ -639,7 +642,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if (NFile::NFind::DoesFileExist(g_MainPath))
needOpenFile = true;
}
- HRESULT res = g_App.Create(hWnd, g_MainPath, xSizes, archiveIsOpened, encrypted);
+ HRESULT res = g_App.Create(hWnd, g_MainPath, g_ArcFormat, xSizes, archiveIsOpened, encrypted);
if (res == E_ABORT)
{
diff --git a/CPP/7zip/UI/FileManager/FM.dsp b/CPP/7zip/UI/FileManager/FM.dsp
index f8ec9364..b821d460 100755
--- a/CPP/7zip/UI/FileManager/FM.dsp
+++ b/CPP/7zip/UI/FileManager/FM.dsp
@@ -442,14 +442,6 @@ SOURCE=.\OptionsDialog.cpp
# End Source File
# Begin Source File
-SOURCE=.\PluginsPage.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\PluginsPage.h
-# End Source File
-# Begin Source File
-
SOURCE=.\SettingsPage.cpp
# End Source File
# Begin Source File
diff --git a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp
index 310b890c..25aec359 100755
--- a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp
+++ b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp
@@ -20,6 +20,7 @@ using namespace NRegistryAssociations;
struct CThreadArchiveOpen
{
UString Path;
+ UString ArcFormat;
CMyComPtr<IInStream> InStream;
CMyComPtr<IFolderManager> FolderManager;
CMyComPtr<IProgress> OpenCallback;
@@ -33,7 +34,7 @@ struct CThreadArchiveOpen
try
{
CProgressCloser closer(OpenCallbackSpec->ProgressDialog);
- Result = FolderManager->OpenFolderFile(InStream, Path, &Folder, OpenCallback);
+ Result = FolderManager->OpenFolderFile(InStream, Path, ArcFormat, &Folder, OpenCallback);
}
catch(...) { Result = E_FAIL; }
}
@@ -58,6 +59,7 @@ static int FindPlugin(const CObjectVector<CPluginInfo> &plugins, const UString &
HRESULT OpenFileFolderPlugin(
IInStream *inStream,
const UString &path,
+ const UString &arcFormat,
HMODULE *module,
IFolderFolder **resultFolder,
HWND parentWindow,
@@ -128,6 +130,7 @@ HRESULT OpenFileFolderPlugin(
t.InStream = inStream;
t.Path = path;
+ t.ArcFormat = arcFormat;
UString progressTitle = LangString(IDS_OPENNING, 0x03020283);
t.OpenCallbackSpec->ProgressDialog.MainWindow = parentWindow;
diff --git a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h
index 692417ba..85717efd 100755
--- a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h
+++ b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h
@@ -3,7 +3,7 @@
#ifndef __FILE_FOLDER_PLUGIN_OPEN_H
#define __FILE_FOLDER_PLUGIN_OPEN_H
-HRESULT OpenFileFolderPlugin(IInStream *inStream, const UString &path,
- HMODULE *module, IFolderFolder **resultFolder, HWND parentWindow, bool &encrypted, UString &password);
+HRESULT OpenFileFolderPlugin(IInStream *inStream, const UString &path, const UString &arcFormat,
+ HMODULE *module, IFolderFolder **resultFolder, HWND parentWindow, bool &encrypted, UString &password);
#endif
diff --git a/CPP/7zip/UI/FileManager/IFolder.h b/CPP/7zip/UI/FileManager/IFolder.h
index b301f513..743017b8 100755
--- a/CPP/7zip/UI/FileManager/IFolder.h
+++ b/CPP/7zip/UI/FileManager/IFolder.h
@@ -112,32 +112,36 @@ FOLDER_INTERFACE(IFolderProperties, 0x0E)
INTERFACE_FolderProperties(PURE)
};
-#define INTERFACE_IFolderArchiveProperties(x) \
- STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value) x; \
- STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties) x; \
- STDMETHOD(GetArchivePropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x;
-
-FOLDER_INTERFACE(IFolderArchiveProperties, 0x0C)
+#define INTERFACE_IFolderArcProps(x) \
+ STDMETHOD(GetArcNumLevels)(UInt32 *numLevels) x; \
+ STDMETHOD(GetArcProp)(UInt32 level, PROPID propID, PROPVARIANT *value) x; \
+ STDMETHOD(GetArcNumProps)(UInt32 level, UInt32 *numProps) x; \
+ STDMETHOD(GetArcPropInfo)(UInt32 level, UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x; \
+ STDMETHOD(GetArcProp2)(UInt32 level, PROPID propID, PROPVARIANT *value) x; \
+ STDMETHOD(GetArcNumProps2)(UInt32 level, UInt32 *numProps) x; \
+ STDMETHOD(GetArcPropInfo2)(UInt32 level, UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x; \
+
+FOLDER_INTERFACE(IFolderArcProps, 0x10)
{
- INTERFACE_IFolderArchiveProperties(PURE)
+ INTERFACE_IFolderArcProps(PURE)
};
-FOLDER_INTERFACE(IGetFolderArchiveProperties, 0x0D)
+FOLDER_INTERFACE(IGetFolderArcProps, 0x11)
{
- STDMETHOD(GetFolderArchiveProperties)(IFolderArchiveProperties **object) PURE;
+ STDMETHOD(GetFolderArcProps)(IFolderArcProps **object) PURE;
};
#define FOLDER_MANAGER_INTERFACE(i, x) DECL_INTERFACE(i, 9, x)
#define INTERFACE_IFolderManager(x) \
- STDMETHOD(OpenFolderFile)(IInStream *inStream, const wchar_t *filePath, IFolderFolder **resultFolder, IProgress *progress) x; \
+ STDMETHOD(OpenFolderFile)(IInStream *inStream, const wchar_t *filePath, const wchar_t *arcFormat, IFolderFolder **resultFolder, IProgress *progress) x; \
STDMETHOD(GetExtensions)(BSTR *extensions) x; \
STDMETHOD(GetIconPath)(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex) x; \
// STDMETHOD(GetTypes)(BSTR *types) PURE;
// STDMETHOD(CreateFolderFile)(const wchar_t *type, const wchar_t *filePath, IProgress *progress) PURE;
-FOLDER_MANAGER_INTERFACE(IFolderManager, 0x04)
+FOLDER_MANAGER_INTERFACE(IFolderManager, 0x05)
{
INTERFACE_IFolderManager(PURE);
};
diff --git a/CPP/7zip/UI/FileManager/MenuPage.cpp b/CPP/7zip/UI/FileManager/MenuPage.cpp
index 719c86ad..e1041204 100755
--- a/CPP/7zip/UI/FileManager/MenuPage.cpp
+++ b/CPP/7zip/UI/FileManager/MenuPage.cpp
@@ -35,6 +35,7 @@ struct CContextMenuItem
static CContextMenuItem kMenuItems[] =
{
{ IDS_CONTEXT_OPEN, 0x02000103, kOpen},
+ { IDS_CONTEXT_OPEN, 0x02000103, kOpenAs},
{ IDS_CONTEXT_EXTRACT, 0x02000105, kExtract},
{ IDS_CONTEXT_EXTRACT_HERE, 0x0200010B, kExtractHere },
{ IDS_CONTEXT_EXTRACT_TO, 0x0200010D, kExtractTo },
@@ -83,6 +84,8 @@ bool CMenuPage::OnInit()
CContextMenuItem &menuItem = kMenuItems[i];
UString s = LangString(menuItem.ControlID, menuItem.LangID);
+ if (menuItem.Flag == kOpenAs)
+ s += L" >";
switch(menuItem.ControlID)
{
diff --git a/CPP/7zip/UI/FileManager/MenuPage.rc b/CPP/7zip/UI/FileManager/MenuPage.rc
index bb4281d8..791a1c08 100755
--- a/CPP/7zip/UI/FileManager/MenuPage.rc
+++ b/CPP/7zip/UI/FileManager/MenuPage.rc
@@ -2,7 +2,7 @@
#include "../../GuiCommon.rc"
#define xc 196
-#define yc 164
+#define yc 174
IDD_MENU MY_PAGE
#include "MenuPage2.rc"
diff --git a/CPP/7zip/UI/FileManager/Panel.cpp b/CPP/7zip/UI/FileManager/Panel.cpp
index 3988f1f3..34f77861 100755
--- a/CPP/7zip/UI/FileManager/Panel.cpp
+++ b/CPP/7zip/UI/FileManager/Panel.cpp
@@ -71,7 +71,9 @@ static LPCWSTR kClassName = L"7-Zip::Panel";
HRESULT CPanel::Create(HWND mainWindow, HWND parentWindow, UINT id,
- const UString &currentFolderPrefix, CPanelCallback *panelCallback, CAppState *appState,
+ const UString &currentFolderPrefix,
+ const UString &arcFormat,
+ CPanelCallback *panelCallback, CAppState *appState,
bool &archiveIsOpened, bool &encrypted)
{
_mainWindow = mainWindow;
@@ -91,7 +93,7 @@ HRESULT CPanel::Create(HWND mainWindow, HWND parentWindow, UINT id,
if (currentFolderPrefix[0] == L'.')
if (!NFile::NDirectory::MyGetFullPathName(currentFolderPrefix, cfp))
cfp = currentFolderPrefix;
- RINOK(BindToPath(cfp, archiveIsOpened, encrypted));
+ RINOK(BindToPath(cfp, arcFormat, archiveIsOpened, encrypted));
if (!CreateEx(0, kClassName, 0, WS_CHILD | WS_VISIBLE,
0, 0, _xSize, 260,
@@ -715,19 +717,18 @@ UString CPanel::GetFolderTypeID() const
return L"";
}
-bool CPanel::IsRootFolder() const
+bool CPanel::IsFolderTypeEqTo(const wchar_t *s) const
{
- return (GetFolderTypeID() == L"RootFolder");
+ return GetFolderTypeID() == s;
}
-bool CPanel::IsFSFolder() const
+bool CPanel::IsRootFolder() const { return IsFolderTypeEqTo(L"RootFolder"); }
+bool CPanel::IsFSFolder() const { return IsFolderTypeEqTo(L"FSFolder"); }
+bool CPanel::IsFSDrivesFolder() const { return IsFolderTypeEqTo(L"FSDrives"); }
+bool CPanel::IsArcFolder() const
{
- return (GetFolderTypeID() == L"FSFolder");
-}
-
-bool CPanel::IsFSDrivesFolder() const
-{
- return (GetFolderTypeID() == L"FSDrives");
+ UString s = GetFolderTypeID();
+ return s.Left(5) == L"7-Zip";
}
UString CPanel::GetFsPath() const
diff --git a/CPP/7zip/UI/FileManager/Panel.h b/CPP/7zip/UI/FileManager/Panel.h
index ead12d2e..fb6d255b 100755
--- a/CPP/7zip/UI/FileManager/Panel.h
+++ b/CPP/7zip/UI/FileManager/Panel.h
@@ -349,7 +349,7 @@ public:
// PanelFolderChange.cpp
void SetToRootFolder();
- HRESULT BindToPath(const UString &fullPath, bool &archiveIsOpened, bool &encrypted); // can be prefix
+ HRESULT BindToPath(const UString &fullPath, const UString &arcFormat, bool &archiveIsOpened, bool &encrypted); // can be prefix
HRESULT BindToPathAndRefresh(const UString &path);
void OpenDrivesFolder();
@@ -367,6 +367,7 @@ public:
HRESULT Create(HWND mainWindow, HWND parentWindow,
UINT id,
const UString &currentFolderPrefix,
+ const UString &arcFormat,
CPanelCallback *panelCallback,
CAppState *appState, bool &archiveIsOpened, bool &encrypted);
void SetFocusToList();
@@ -465,9 +466,11 @@ public:
void KillSelection();
UString GetFolderTypeID() const;
+ bool IsFolderTypeEqTo(const wchar_t *s) const;
bool IsRootFolder() const;
bool IsFSFolder() const;
bool IsFSDrivesFolder() const;
+ bool IsArcFolder() const;
bool IsFsOrDrivesFolder() const { return IsFSFolder() || IsFSDrivesFolder(); }
bool IsDeviceDrivesPrefix() const { return _currentFolderPrefix == L"\\\\.\\"; }
bool IsFsOrPureDrivesFolder() const { return IsFSFolder() || (IsFSDrivesFolder() && !IsDeviceDrivesPrefix()); }
@@ -539,8 +542,9 @@ public:
HRESULT OpenItemAsArchive(IInStream *inStream,
const CTempFileInfo &tempFileInfo,
const UString &virtualFilePath,
+ const UString &arcFormat,
bool &encrypted);
- HRESULT OpenItemAsArchive(const UString &name, bool &encrypted);
+ HRESULT OpenItemAsArchive(const UString &name, const UString &arcFormat, bool &encrypted);
HRESULT OpenItemAsArchive(int index);
void OpenItemInArchive(int index, bool tryInternal, bool tryExternal,
bool editMode);
diff --git a/CPP/7zip/UI/FileManager/PanelFolderChange.cpp b/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
index 41ffe9da..afa4c041 100755
--- a/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
+++ b/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
@@ -35,7 +35,7 @@ void CPanel::SetToRootFolder()
rootFolderSpec->Init();
}
-HRESULT CPanel::BindToPath(const UString &fullPath, bool &archiveIsOpened, bool &encrypted)
+HRESULT CPanel::BindToPath(const UString &fullPath, const UString &arcFormat, bool &archiveIsOpened, bool &encrypted)
{
archiveIsOpened = false;
encrypted = false;
@@ -114,7 +114,7 @@ HRESULT CPanel::BindToPath(const UString &fullPath, bool &archiveIsOpened, bool
UString fileName;
if (NDirectory::GetOnlyName(sysPath, fileName))
{
- HRESULT res = OpenItemAsArchive(fileName, encrypted);
+ HRESULT res = OpenItemAsArchive(fileName, arcFormat, encrypted);
if (res != S_FALSE)
{
RINOK(res);
@@ -145,7 +145,7 @@ HRESULT CPanel::BindToPathAndRefresh(const UString &path)
{
CDisableTimerProcessing disableTimerProcessing1(*this);
bool archiveIsOpened, encrypted;
- RINOK(BindToPath(path, archiveIsOpened, encrypted));
+ RINOK(BindToPath(path, UString(), archiveIsOpened, encrypted));
RefreshListCtrl(UString(), -1, true, UStringVector());
return S_OK;
}
diff --git a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
index b77d3e2a..15e01483 100755
--- a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
+++ b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
@@ -67,6 +67,7 @@ public:
HRESULT CPanel::OpenItemAsArchive(IInStream *inStream,
const CTempFileInfo &tempFileInfo,
const UString &virtualFilePath,
+ const UString &arcFormat,
bool &encrypted)
{
encrypted = false;
@@ -95,6 +96,7 @@ HRESULT CPanel::OpenItemAsArchive(IInStream *inStream,
UString password;
RINOK(OpenFileFolderPlugin(inStream,
folderLink.FilePath.IsEmpty() ? virtualFilePath : folderLink.FilePath,
+ arcFormat,
&library, &newFolder, GetParent(), encrypted, password));
folderLink.Password = password;
@@ -114,20 +116,20 @@ HRESULT CPanel::OpenItemAsArchive(IInStream *inStream,
return S_OK;
}
-HRESULT CPanel::OpenItemAsArchive(const UString &name, bool &encrypted)
+HRESULT CPanel::OpenItemAsArchive(const UString &name, const UString &arcFormat, bool &encrypted)
{
CTempFileInfo tfi;
tfi.ItemName = name;
tfi.FolderPath = _currentFolderPrefix;
tfi.FilePath = _currentFolderPrefix + name;
- return OpenItemAsArchive(NULL, tfi, _currentFolderPrefix + name, encrypted);
+ return OpenItemAsArchive(NULL, tfi, _currentFolderPrefix + name, arcFormat, encrypted);
}
HRESULT CPanel::OpenItemAsArchive(int index)
{
CDisableTimerProcessing disableTimerProcessing1(*this);
bool encrypted;
- RINOK(OpenItemAsArchive(GetItemRelPath(index), encrypted));
+ RINOK(OpenItemAsArchive(GetItemRelPath(index), UString(), encrypted));
RefreshListCtrl();
return S_OK;
}
@@ -575,7 +577,7 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
if (subStream)
{
bool encrypted;
- if (OpenItemAsArchive(subStream, tempFileInfo, fullVirtPath, encrypted) == S_OK)
+ if (OpenItemAsArchive(subStream, tempFileInfo, fullVirtPath, UString(), encrypted) == S_OK)
{
tempDirectory.DisableDeleting();
RefreshListCtrl();
@@ -623,7 +625,7 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
if (tryAsArchive)
{
bool encrypted;
- if (OpenItemAsArchive(NULL, tempFileInfo, fullVirtPath, encrypted) == S_OK)
+ if (OpenItemAsArchive(NULL, tempFileInfo, fullVirtPath, UString(), encrypted) == S_OK)
{
tempDirectory.DisableDeleting();
RefreshListCtrl();
diff --git a/CPP/7zip/UI/FileManager/PanelMenu.cpp b/CPP/7zip/UI/FileManager/PanelMenu.cpp
index 093f02f0..c60751b5 100755
--- a/CPP/7zip/UI/FileManager/PanelMenu.cpp
+++ b/CPP/7zip/UI/FileManager/PanelMenu.cpp
@@ -15,7 +15,6 @@
#include "App.h"
#include "LangUtils.h"
#include "MyLoadMenu.h"
-#include "PluginInterface.h"
#include "PropertyName.h"
#include "resource.h"
@@ -24,11 +23,6 @@
using namespace NWindows;
LONG g_DllRefCount = 0;
-/*
-// {23170F69-40C1-278A-1000-000100020000}
-DEFINE_GUID(CLSID_CZipContextMenu,
-0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
-*/
static const UINT kSevenZipStartMenuID = kPluginMenuStartID ;
static const UINT kSystemStartMenuID = kPluginMenuStartID + 100;
@@ -55,6 +49,7 @@ void CPanel::InvokeSystemCommand(const char *command)
}
static const wchar_t *kSeparator = L"----------------------------\n";
+static const wchar_t *kSeparatorSmall = L"----\n";
static const wchar_t *kPropValueSeparator = L": ";
extern UString ConvertSizeToString(UInt64 value);
@@ -99,9 +94,9 @@ static void AddPropertyString(PROPID propID, const wchar_t *nameBSTR,
void CPanel::Properties()
{
- CMyComPtr<IGetFolderArchiveProperties> getFolderArchiveProperties;
- _folder.QueryInterface(IID_IGetFolderArchiveProperties, &getFolderArchiveProperties);
- if (!getFolderArchiveProperties)
+ CMyComPtr<IGetFolderArcProps> getFolderArcProps;
+ _folder.QueryInterface(IID_IGetFolderArcProps, &getFolderArcProps);
+ if (!getFolderArcProps)
{
InvokeSystemCommand("properties");
return;
@@ -137,10 +132,12 @@ void CPanel::Properties()
message += kSeparator;
}
+ /*
message += LangString(IDS_PROP_FILE_TYPE, 0x02000214);
message += kPropValueSeparator;
message += GetFolderTypeID();
message += L"\n";
+ */
{
NCOM::CPropVariant prop;
@@ -172,30 +169,63 @@ void CPanel::Properties()
}
}
- CMyComPtr<IGetFolderArchiveProperties> getFolderArchiveProperties;
- _folder.QueryInterface(IID_IGetFolderArchiveProperties, &getFolderArchiveProperties);
- if (getFolderArchiveProperties)
+ CMyComPtr<IGetFolderArcProps> getFolderArcProps;
+ _folder.QueryInterface(IID_IGetFolderArcProps, &getFolderArcProps);
+ if (getFolderArcProps)
{
- CMyComPtr<IFolderArchiveProperties> getProps;
- getFolderArchiveProperties->GetFolderArchiveProperties(&getProps);
+ CMyComPtr<IFolderArcProps> getProps;
+ getFolderArcProps->GetFolderArcProps(&getProps);
if (getProps)
{
- UInt32 numProps;
- if (getProps->GetNumberOfArchiveProperties(&numProps) == S_OK)
+ UInt32 numLevels;
+ if (getProps->GetArcNumLevels(&numLevels) != S_OK)
+ numLevels = 0;
+ for (UInt32 level2 = 0; level2 < numLevels; level2++)
{
- if (numProps > 0)
- message += kSeparator;
- for (UInt32 i = 0; i < numProps; i++)
{
- CMyComBSTR name;
- PROPID propID;
- VARTYPE vt;
- if (getProps->GetArchivePropertyInfo(i, &name, &propID, &vt) != S_OK)
- continue;
- NCOM::CPropVariant prop;
- if (getProps->GetArchiveProperty(propID, &prop) != S_OK)
- continue;
- AddPropertyString(propID, name, prop, message);
+ UInt32 level = numLevels - 1 - level2;
+ UInt32 numProps;
+ if (getProps->GetArcNumProps(level, &numProps) == S_OK)
+ {
+ message += kSeparator;
+ for (Int32 i = -2; i < (Int32)numProps; i++)
+ {
+ CMyComBSTR name;
+ PROPID propID;
+ VARTYPE vt;
+ if (i == -2)
+ propID = kpidPath;
+ else if (i == -1)
+ propID = kpidType;
+ else if (getProps->GetArcPropInfo(level, i, &name, &propID, &vt) != S_OK)
+ continue;
+ NCOM::CPropVariant prop;
+ if (getProps->GetArcProp(level, propID, &prop) != S_OK)
+ continue;
+ AddPropertyString(propID, name, prop, message);
+ }
+ }
+ }
+ if (level2 != numLevels - 1)
+ {
+ UInt32 level = numLevels - 1 - level2;
+ UInt32 numProps;
+ if (getProps->GetArcNumProps2(level, &numProps) == S_OK)
+ {
+ message += kSeparatorSmall;
+ for (Int32 i = 0; i < (Int32)numProps; i++)
+ {
+ CMyComBSTR name;
+ PROPID propID;
+ VARTYPE vt;
+ if (getProps->GetArcPropInfo2(level, i, &name, &propID, &vt) != S_OK)
+ continue;
+ NCOM::CPropVariant prop;
+ if (getProps->GetArcProp2(level, propID, &prop) != S_OK)
+ continue;
+ AddPropertyString(propID, name, prop, message);
+ }
+ }
}
}
}
@@ -212,9 +242,9 @@ void CPanel::EditCut()
void CPanel::EditCopy()
{
/*
- CMyComPtr<IGetFolderArchiveProperties> getFolderArchiveProperties;
- _folder.QueryInterface(IID_IGetFolderArchiveProperties, &getFolderArchiveProperties);
- if (!getFolderArchiveProperties)
+ CMyComPtr<IGetFolderArcProps> getFolderArcProps;
+ _folder.QueryInterface(IID_IGetFolderArcProps, &getFolderArcProps);
+ if (!getFolderArcProps)
{
InvokeSystemCommand("copy");
return;
@@ -445,13 +475,15 @@ void CPanel::CreateSevenZipMenu(HMENU menuSpec,
bool sevenZipMenuCreated = false;
- CMyComPtr<IContextMenu> contextMenu;
- contextMenu = new CZipContextMenu;
+ CZipContextMenu *contextMenuSpec = new CZipContextMenu;
+ CMyComPtr<IContextMenu> contextMenu = contextMenuSpec;
// if (contextMenu.CoCreateInstance(CLSID_CZipContextMenu, IID_IContextMenu) == S_OK)
{
+ /*
CMyComPtr<IInitContextMenu> initContextMenu;
if (contextMenu.QueryInterface(IID_IInitContextMenu, &initContextMenu) != S_OK)
return;
+ */
UString currentFolderUnicode = _currentFolderPrefix;
UStringVector names;
int i;
@@ -462,7 +494,7 @@ void CPanel::CreateSevenZipMenu(HMENU menuSpec,
namePointers.Add(names[i]);
// NFile::NDirectory::MySetCurrentDirectory(currentFolderUnicode);
- if (initContextMenu->InitContextMenu(currentFolderUnicode, &namePointers.Front(),
+ if (contextMenuSpec->InitContextMenu(currentFolderUnicode, &namePointers.Front(),
operatedIndices.Size()) == S_OK)
{
HRESULT res = contextMenu->QueryContextMenu(menu, 0, kSevenZipStartMenuID,
diff --git a/CPP/7zip/UI/FileManager/PluginInterface.h b/CPP/7zip/UI/FileManager/PluginInterface.h
index 905aff9a..72711fde 100755
--- a/CPP/7zip/UI/FileManager/PluginInterface.h
+++ b/CPP/7zip/UI/FileManager/PluginInterface.h
@@ -1,42 +1,31 @@
// PluginInterface.h
-#ifndef __PLUGININTERFACE_H
-#define __PLUGININTERFACE_H
+#ifndef __PLUGIN_INTERFACE_H
+#define __PLUGIN_INTERFACE_H
-#include "Common/MyString.h"
+/*
+#include "../../../Common/Types.h"
+#include "../../IDecl.h"
-// {23170F69-40C1-278D-0000-000100010000}
-DEFINE_GUID(IID_IInitContextMenu,
-0x23170F69, 0x40C1, 0x278D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00);
-MIDL_INTERFACE("23170F69-40C1-278D-0000-000100010000")
-IInitContextMenu: public IUnknown
-{
-public:
- STDMETHOD(InitContextMenu)(const wchar_t *aFolder, const wchar_t **aNames, UINT32 aNumFiles) PURE;
+#define PLUGIN_INTERFACE(i, x) DECL_INTERFACE(i, 0x0A, x)
+PLUGIN_INTERFACE(IInitContextMenu, 0x00)
+{
+ STDMETHOD(InitContextMenu)(const wchar_t *folder, const wchar_t **names, UINT32 numFiles) PURE;
};
-// {23170F69-40C1-278D-0000-000100020100}
-DEFINE_GUID(IID_IPluginOptionsCallback,
-0x23170F69, 0x40C1, 0x278D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
-MIDL_INTERFACE("23170F69-40C1-278D-0000-000100020000")
-IPluginOptionsCallback: public IUnknown
+PLUGIN_INTERFACE(IPluginOptionsCallback, 0x01)
{
-public:
STDMETHOD(GetProgramFolderPath)(BSTR *value) PURE;
STDMETHOD(GetProgramPath)(BSTR *value) PURE;
STDMETHOD(GetRegistryCUPath)(BSTR *value) PURE;
};
-// {23170F69-40C1-278D-0000-000100020000}
-DEFINE_GUID(IID_IPluginOptions,
-0x23170F69, 0x40C1, 0x278D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
-MIDL_INTERFACE("23170F69-40C1-278D-0000-000100020000")
-IPluginOptions: public IUnknown
+PLUGIN_INTERFACE(IPluginOptions, 0x02)
{
-public:
STDMETHOD(PluginOptions)(HWND hWnd, IPluginOptionsCallback *callback) PURE;
// STDMETHOD(GetFileExtensions)(BSTR *extensions) PURE;
};
+*/
#endif
diff --git a/CPP/7zip/UI/FileManager/makefile b/CPP/7zip/UI/FileManager/makefile
index 01016038..eeca66f9 100755
--- a/CPP/7zip/UI/FileManager/makefile
+++ b/CPP/7zip/UI/FileManager/makefile
@@ -65,7 +65,6 @@ FM_OBJS = \
$O\MessagesDialog.obj \
$O\OverwriteDialog.obj \
$O\PasswordDialog.obj \
- $O\PluginsPage.obj \
$O\ProgressDialog2.obj \
$O\SettingsPage.obj \
$O\SplitDialog.obj \
diff --git a/CPP/Windows/PropVariant.cpp b/CPP/Windows/PropVariant.cpp
index 1db6c236..c2b15744 100755
--- a/CPP/Windows/PropVariant.cpp
+++ b/CPP/Windows/PropVariant.cpp
@@ -9,13 +9,13 @@
namespace NWindows {
namespace NCOM {
-CPropVariant::CPropVariant(const PROPVARIANT& varSrc)
+CPropVariant::CPropVariant(const PROPVARIANT &varSrc)
{
vt = VT_EMPTY;
InternalCopy(&varSrc);
}
-CPropVariant::CPropVariant(const CPropVariant& varSrc)
+CPropVariant::CPropVariant(const CPropVariant &varSrc)
{
vt = VT_EMPTY;
InternalCopy(&varSrc);
@@ -33,12 +33,12 @@ CPropVariant::CPropVariant(LPCOLESTR lpszSrc)
*this = lpszSrc;
}
-CPropVariant& CPropVariant::operator=(const CPropVariant& varSrc)
+CPropVariant& CPropVariant::operator=(const CPropVariant &varSrc)
{
InternalCopy(&varSrc);
return *this;
}
-CPropVariant& CPropVariant::operator=(const PROPVARIANT& varSrc)
+CPropVariant& CPropVariant::operator=(const PROPVARIANT &varSrc)
{
InternalCopy(&varSrc);
return *this;
@@ -96,89 +96,21 @@ CPropVariant& CPropVariant::operator=(bool bSrc)
return *this;
}
-CPropVariant& CPropVariant::operator=(UInt32 value)
-{
- if (vt != VT_UI4)
- {
- InternalClear();
- vt = VT_UI4;
- }
- ulVal = value;
- return *this;
-}
-
-CPropVariant& CPropVariant::operator=(UInt64 value)
-{
- if (vt != VT_UI8)
- {
- InternalClear();
- vt = VT_UI8;
- }
- uhVal.QuadPart = value;
- return *this;
-}
-
-CPropVariant& CPropVariant::operator=(const FILETIME &value)
-{
- if (vt != VT_FILETIME)
- {
- InternalClear();
- vt = VT_FILETIME;
- }
- filetime = value;
- return *this;
-}
-
-CPropVariant& CPropVariant::operator=(Int32 value)
-{
- if (vt != VT_I4)
- {
- InternalClear();
- vt = VT_I4;
- }
- lVal = value;
-
- return *this;
-}
-
-CPropVariant& CPropVariant::operator=(Byte value)
-{
- if (vt != VT_UI1)
- {
- InternalClear();
- vt = VT_UI1;
- }
- bVal = value;
- return *this;
-}
-
-CPropVariant& CPropVariant::operator=(Int16 value)
-{
- if (vt != VT_I2)
- {
- InternalClear();
- vt = VT_I2;
- }
- iVal = value;
- return *this;
-}
+#define SET_PROP_FUNC(type, id, dest) \
+ CPropVariant& CPropVariant::operator=(type value) \
+ { if (vt != id) { InternalClear(); vt = id; } \
+ dest = value; return *this; }
-/*
-CPropVariant& CPropVariant::operator=(LONG value)
-{
- if (vt != VT_I4)
- {
- InternalClear();
- vt = VT_I4;
- }
- lVal = value;
- return *this;
-}
-*/
+SET_PROP_FUNC(Byte, VT_UI1, bVal)
+SET_PROP_FUNC(Int16, VT_I2, iVal)
+SET_PROP_FUNC(Int32, VT_I4, lVal)
+SET_PROP_FUNC(UInt32, VT_UI4, ulVal)
+SET_PROP_FUNC(UInt64, VT_UI8, uhVal.QuadPart)
+SET_PROP_FUNC(const FILETIME &, VT_FILETIME, filetime)
-static HRESULT MyPropVariantClear(PROPVARIANT *propVariant)
+static HRESULT MyPropVariantClear(PROPVARIANT *prop)
{
- switch(propVariant->vt)
+ switch(prop->vt)
{
case VT_UI1:
case VT_I1:
@@ -196,11 +128,11 @@ static HRESULT MyPropVariantClear(PROPVARIANT *propVariant)
case VT_R8:
case VT_CY:
case VT_DATE:
- propVariant->vt = VT_EMPTY;
- propVariant->wReserved1 = 0;
+ prop->vt = VT_EMPTY;
+ prop->wReserved1 = 0;
return S_OK;
}
- return ::VariantClear((VARIANTARG *)propVariant);
+ return ::VariantClear((VARIANTARG *)prop);
}
HRESULT CPropVariant::Clear()
@@ -236,7 +168,7 @@ HRESULT CPropVariant::Copy(const PROPVARIANT* pSrc)
}
-HRESULT CPropVariant::Attach(PROPVARIANT* pSrc)
+HRESULT CPropVariant::Attach(PROPVARIANT *pSrc)
{
HRESULT hr = Clear();
if (FAILED(hr))
@@ -246,7 +178,7 @@ HRESULT CPropVariant::Attach(PROPVARIANT* pSrc)
return S_OK;
}
-HRESULT CPropVariant::Detach(PROPVARIANT* pDest)
+HRESULT CPropVariant::Detach(PROPVARIANT *pDest)
{
HRESULT hr = MyPropVariantClear(pDest);
if (FAILED(hr))
@@ -267,7 +199,7 @@ HRESULT CPropVariant::InternalClear()
return hr;
}
-void CPropVariant::InternalCopy(const PROPVARIANT* pSrc)
+void CPropVariant::InternalCopy(const PROPVARIANT *pSrc)
{
HRESULT hr = Copy(pSrc);
if (FAILED(hr))
@@ -280,52 +212,25 @@ void CPropVariant::InternalCopy(const PROPVARIANT* pSrc)
int CPropVariant::Compare(const CPropVariant &a)
{
if (vt != a.vt)
- return 0; // it's mean some bug
+ return 0; // it's bug case
switch (vt)
{
- case VT_EMPTY:
- return 0;
-
- /*
- case VT_I1:
- return MyCompare(cVal, a.cVal);
- */
- case VT_UI1:
- return MyCompare(bVal, a.bVal);
-
- case VT_I2:
- return MyCompare(iVal, a.iVal);
- case VT_UI2:
- return MyCompare(uiVal, a.uiVal);
-
- case VT_I4:
- return MyCompare(lVal, a.lVal);
- /*
- case VT_INT:
- return MyCompare(intVal, a.intVal);
- */
- case VT_UI4:
- return MyCompare(ulVal, a.ulVal);
- /*
- case VT_UINT:
- return MyCompare(uintVal, a.uintVal);
- */
- case VT_I8:
- return MyCompare(hVal.QuadPart, a.hVal.QuadPart);
- case VT_UI8:
- return MyCompare(uhVal.QuadPart, a.uhVal.QuadPart);
-
- case VT_BOOL:
- return -MyCompare(boolVal, a.boolVal);
-
- case VT_FILETIME:
- return ::CompareFileTime(&filetime, &a.filetime);
+ case VT_EMPTY: return 0;
+ // case VT_I1: return MyCompare(cVal, a.cVal);
+ case VT_UI1: return MyCompare(bVal, a.bVal);
+ case VT_I2: return MyCompare(iVal, a.iVal);
+ case VT_UI2: return MyCompare(uiVal, a.uiVal);
+ case VT_I4: return MyCompare(lVal, a.lVal);
+ case VT_UI4: return MyCompare(ulVal, a.ulVal);
+ // case VT_UINT: return MyCompare(uintVal, a.uintVal);
+ case VT_I8: return MyCompare(hVal.QuadPart, a.hVal.QuadPart);
+ case VT_UI8: return MyCompare(uhVal.QuadPart, a.uhVal.QuadPart);
+ case VT_BOOL: return -MyCompare(boolVal, a.boolVal);
+ case VT_FILETIME: return ::CompareFileTime(&filetime, &a.filetime);
case VT_BSTR:
return 0; // Not implemented
// return MyCompare(aPropVarint.cVal);
-
- default:
- return 0;
+ default: return 0;
}
}
diff --git a/CPP/Windows/PropVariant.h b/CPP/Windows/PropVariant.h
index 5552bbe2..d018034e 100755
--- a/CPP/Windows/PropVariant.h
+++ b/CPP/Windows/PropVariant.h
@@ -14,41 +14,39 @@ class CPropVariant : public tagPROPVARIANT
public:
CPropVariant() { vt = VT_EMPTY; wReserved1 = 0; }
~CPropVariant() { Clear(); }
- CPropVariant(const PROPVARIANT& varSrc);
- CPropVariant(const CPropVariant& varSrc);
+ CPropVariant(const PROPVARIANT &varSrc);
+ CPropVariant(const CPropVariant &varSrc);
CPropVariant(BSTR bstrSrc);
CPropVariant(LPCOLESTR lpszSrc);
CPropVariant(bool bSrc) { vt = VT_BOOL; wReserved1 = 0; boolVal = (bSrc ? VARIANT_TRUE : VARIANT_FALSE); };
- CPropVariant(UInt32 value) { vt = VT_UI4; wReserved1 = 0; ulVal = value; }
- CPropVariant(UInt64 value) { vt = VT_UI8; wReserved1 = 0; uhVal = *(ULARGE_INTEGER*)&value; }
- CPropVariant(const FILETIME &value) { vt = VT_FILETIME; wReserved1 = 0; filetime = value; }
- CPropVariant(Int32 value) { vt = VT_I4; wReserved1 = 0; lVal = value; }
CPropVariant(Byte value) { vt = VT_UI1; wReserved1 = 0; bVal = value; }
CPropVariant(Int16 value) { vt = VT_I2; wReserved1 = 0; iVal = value; }
- // CPropVariant(LONG value, VARTYPE vtSrc = VT_I4) { vt = vtSrc; lVal = value; }
+ CPropVariant(Int32 value) { vt = VT_I4; wReserved1 = 0; lVal = value; }
+ CPropVariant(UInt32 value) { vt = VT_UI4; wReserved1 = 0; ulVal = value; }
+ CPropVariant(UInt64 value) { vt = VT_UI8; wReserved1 = 0; uhVal.QuadPart = value; }
+ CPropVariant(const FILETIME &value) { vt = VT_FILETIME; wReserved1 = 0; filetime = value; }
- CPropVariant& operator=(const CPropVariant& varSrc);
- CPropVariant& operator=(const PROPVARIANT& varSrc);
+ CPropVariant& operator=(const CPropVariant &varSrc);
+ CPropVariant& operator=(const PROPVARIANT &varSrc);
CPropVariant& operator=(BSTR bstrSrc);
CPropVariant& operator=(LPCOLESTR lpszSrc);
CPropVariant& operator=(const char *s);
CPropVariant& operator=(bool bSrc);
+ CPropVariant& operator=(Byte value);
+ CPropVariant& operator=(Int16 value);
+ CPropVariant& operator=(Int32 value);
CPropVariant& operator=(UInt32 value);
+ CPropVariant& operator=(Int64 value);
CPropVariant& operator=(UInt64 value);
CPropVariant& operator=(const FILETIME &value);
- CPropVariant& operator=(Int32 value);
- CPropVariant& operator=(Byte value);
- CPropVariant& operator=(Int16 value);
- // CPropVariant& operator=(LONG value);
-
HRESULT Clear();
- HRESULT Copy(const PROPVARIANT* pSrc);
- HRESULT Attach(PROPVARIANT* pSrc);
- HRESULT Detach(PROPVARIANT* pDest);
+ HRESULT Copy(const PROPVARIANT *pSrc);
+ HRESULT Attach(PROPVARIANT *pSrc);
+ HRESULT Detach(PROPVARIANT *pDest);
HRESULT InternalClear();
- void InternalCopy(const PROPVARIANT* pSrc);
+ void InternalCopy(const PROPVARIANT *pSrc);
int Compare(const CPropVariant &a1);
};