summaryrefslogtreecommitdiffstats
path: root/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim
diff options
context:
space:
mode:
Diffstat (limited to 'installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim')
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.cpp619
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.h66
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.cpp570
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.h235
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimRegister.cpp13
5 files changed, 0 insertions, 1503 deletions
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.cpp
deleted file mode 100644
index 1b8661c9f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.cpp
+++ /dev/null
@@ -1,619 +0,0 @@
-// WimHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/Defs.h"
-#include "Common/ComTry.h"
-#include "Common/StringToInt.h"
-#include "Common/UTFConvert.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../../Common/StreamUtils.h"
-#include "../../Common/ProgressUtils.h"
-
-#include "../../../../C/CpuArch.h"
-
-#include "WimHandler.h"
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-#define Get64(p) GetUi64(p)
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NWim {
-
-#define WIM_DETAILS
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidAttrib, VT_UI4},
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidATime, VT_FILETIME}
-
- #ifdef WIM_DETAILS
- , { NULL, kpidVolume, VT_UI4}
- , { NULL, kpidOffset, VT_UI8}
- , { NULL, kpidLinks, VT_UI4}
- #endif
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidComment, VT_FILETIME},
- { NULL, kpidIsVolume, VT_BOOL},
- { NULL, kpidVolume, VT_UI4},
- { NULL, kpidNumVolumes, VT_UI4}
-};
-
-static bool ParseNumber64(const AString &s, UInt64 &res)
-{
- const char *end;
- if (s.Left(2) == "0x")
- {
- if (s.Length() == 2)
- return false;
- res = ConvertHexStringToUInt64((const char *)s + 2, &end);
- }
- else
- {
- if (s.IsEmpty())
- return false;
- res = ConvertStringToUInt64(s, &end);
- }
- return *end == 0;
-}
-
-static bool ParseNumber32(const AString &s, UInt32 &res)
-{
- UInt64 res64;
- if (!ParseNumber64(s, res64) || res64 >= ((UInt64)1 << 32))
- return false;
- res = (UInt32)res64;
- return true;
-}
-
-void ParseTime(const CXmlItem &item, bool &defined, FILETIME &ft, const AString &s)
-{
- defined = false;
- int cTimeIndex = item.FindSubTag(s);
- if (cTimeIndex >= 0)
- {
- const CXmlItem &timeItem = item.SubItems[cTimeIndex];
- UInt32 high = 0, low = 0;
- if (ParseNumber32(timeItem.GetSubStringForTag("HIGHPART"), high) &&
- ParseNumber32(timeItem.GetSubStringForTag("LOWPART"), low))
- {
- defined = true;
- ft.dwHighDateTime = high;
- ft.dwLowDateTime = low;
- }
- }
-}
-
-void CImageInfo::Parse(const CXmlItem &item)
-{
- ParseTime(item, CTimeDefined, CTime, "CREATIONTIME");
- ParseTime(item, MTimeDefined, MTime, "LASTMODIFICATIONTIME");
- NameDefined = ConvertUTF8ToUnicode(item.GetSubStringForTag("NAME"), Name);
- // IndexDefined = ParseNumber32(item.GetPropertyValue("INDEX"), Index);
-}
-
-void CXml::Parse()
-{
- size_t size = Data.GetCapacity();
- if (size < 2 || (size & 1) != 0 || (size > 1 << 24))
- return;
- const Byte *p = Data;
- if (Get16(p) != 0xFEFF)
- return;
- UString s;
- {
- wchar_t *chars = s.GetBuffer((int)size / 2 + 1);
- for (size_t i = 2; i < size; i += 2)
- *chars++ = (wchar_t)Get16(p + i);
- *chars = 0;
- s.ReleaseBuffer();
- }
-
- AString utf;
- if (!ConvertUnicodeToUTF8(s, utf))
- return;
- ::CXml xml;
- if (!xml.Parse(utf))
- return;
- if (xml.Root.Name != "WIM")
- return;
-
- for (int i = 0; i < xml.Root.SubItems.Size(); i++)
- {
- const CXmlItem &item = xml.Root.SubItems[i];
- if (item.IsTagged("IMAGE"))
- {
- CImageInfo imageInfo;
- imageInfo.Parse(item);
- Images.Add(imageInfo);
- }
- }
-}
-
-static const wchar_t *kStreamsNamePrefix = L"Files" WSTRING_PATH_SEPARATOR;
-static const wchar_t *kMethodLZX = L"LZX";
-static const wchar_t *kMethodXpress = L"XPress";
-static const wchar_t *kMethodCopy = L"Copy";
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
-
- const CImageInfo *image = NULL;
- if (m_Xmls.Size() == 1)
- {
- const CXml &xml = m_Xmls[0];
- if (xml.Images.Size() == 1)
- image = &xml.Images[0];
- }
-
- switch(propID)
- {
- case kpidSize: prop = m_Database.GetUnpackSize(); break;
- case kpidPackSize: prop = m_Database.GetPackSize(); break;
-
- case kpidCTime:
- if (m_Xmls.Size() == 1)
- {
- const CXml &xml = m_Xmls[0];
- int index = -1;
- for (int i = 0; i < xml.Images.Size(); i++)
- {
- const CImageInfo &image = xml.Images[i];
- if (image.CTimeDefined)
- if (index < 0 || ::CompareFileTime(&image.CTime, &xml.Images[index].CTime) < 0)
- index = i;
- }
- if (index >= 0)
- prop = xml.Images[index].CTime;
- }
- break;
-
- case kpidMTime:
- if (m_Xmls.Size() == 1)
- {
- const CXml &xml = m_Xmls[0];
- int index = -1;
- for (int i = 0; i < xml.Images.Size(); i++)
- {
- const CImageInfo &image = xml.Images[i];
- if (image.MTimeDefined)
- if (index < 0 || ::CompareFileTime(&image.MTime, &xml.Images[index].MTime) > 0)
- index = i;
- }
- if (index >= 0)
- prop = xml.Images[index].MTime;
- }
- break;
-
- case kpidComment: if (image != NULL && image->NameDefined) prop = image->Name; break;
-
- case kpidIsVolume:
- if (m_Xmls.Size() > 0)
- {
- UInt16 volIndex = m_Xmls[0].VolIndex;
- if (volIndex < m_Volumes.Size())
- prop = (m_Volumes[volIndex].Header.NumParts > 1);
- }
- break;
- case kpidVolume:
- if (m_Xmls.Size() > 0)
- {
- UInt16 volIndex = m_Xmls[0].VolIndex;
- if (volIndex < m_Volumes.Size())
- prop = (UInt32)m_Volumes[volIndex].Header.PartNumber;
- }
- break;
- case kpidNumVolumes: if (m_Volumes.Size() > 0) prop = (UInt32)(m_Volumes.Size() - 1); break;
- case kpidMethod:
- {
- bool lzx = false, xpress = false, copy = false;
- for (int i = 0; i < m_Xmls.Size(); i++)
- {
- const CVolume &vol = m_Volumes[m_Xmls[i].VolIndex];
- const CHeader &header = vol.Header;
- if (header.IsCompressed())
- if (header.IsLzxMode())
- lzx = true;
- else
- xpress = true;
- else
- copy = true;
- }
- UString res;
- if (lzx)
- res = kMethodLZX;
- if (xpress)
- {
- if (!res.IsEmpty())
- res += L' ';
- res += kMethodXpress;
- }
- if (copy)
- {
- if (!res.IsEmpty())
- res += L' ';
- res += kMethodCopy;
- }
- prop = res;
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- if (index < (UInt32)m_Database.Items.Size())
- {
- const CItem &item = m_Database.Items[index];
- const CStreamInfo *si = NULL;
- const CVolume *vol = NULL;
- if (item.StreamIndex >= 0)
- {
- si = &m_Database.Streams[item.StreamIndex];
- vol = &m_Volumes[si->PartNumber];
- }
-
- switch(propID)
- {
- case kpidPath:
- if (item.HasMetadata)
- prop = item.Name;
- else
- {
- wchar_t sz[32];
- ConvertUInt64ToString(item.StreamIndex, sz);
- UString s = sz;
- while (s.Length() < m_NameLenForStreams)
- s = L'0' + s;
- s = UString(kStreamsNamePrefix) + s;
- prop = s;
- break;
- }
- break;
- case kpidIsDir: prop = item.isDir(); break;
- case kpidAttrib: if (item.HasMetadata) prop = item.Attrib; break;
- case kpidCTime: if (item.HasMetadata) prop = item.CTime; break;
- case kpidATime: if (item.HasMetadata) prop = item.ATime; break;
- case kpidMTime: if (item.HasMetadata) prop = item.MTime; break;
- case kpidPackSize: prop = si ? si->Resource.PackSize : (UInt64)0; break;
- case kpidSize: prop = si ? si->Resource.UnpackSize : (UInt64)0; break;
- case kpidMethod: if (si) prop = si->Resource.IsCompressed() ?
- (vol->Header.IsLzxMode() ? kMethodLZX : kMethodXpress) : kMethodCopy; break;
- #ifdef WIM_DETAILS
- case kpidVolume: if (si) prop = (UInt32)si->PartNumber; break;
- case kpidOffset: if (si) prop = (UInt64)si->Resource.Offset; break;
- case kpidLinks: prop = si ? (UInt32)si->RefCount : (UInt32)0; break;
- #endif
- }
- }
- else
- {
- index -= m_Database.Items.Size();
- {
- switch(propID)
- {
- case kpidPath:
- {
- wchar_t sz[32];
- ConvertUInt64ToString(m_Xmls[index].VolIndex, sz);
- UString s = (UString)sz + L".xml";
- prop = s;
- break;
- }
- case kpidIsDir: prop = false; break;
- case kpidPackSize:
- case kpidSize: prop = (UInt64)m_Xmls[index].Data.GetCapacity(); break;
- case kpidMethod: prop = L"Copy"; break;
- }
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-class CVolumeName
-{
- // UInt32 _volIndex;
- UString _before;
- UString _after;
-public:
- CVolumeName() {};
-
- void InitName(const UString &name)
- {
- // _volIndex = 1;
- int dotPos = name.ReverseFind('.');
- if (dotPos < 0)
- dotPos = name.Length();
- _before = name.Left(dotPos);
- _after = name.Mid(dotPos);
- }
-
- UString GetNextName(UInt32 index)
- {
- wchar_t s[32];
- ConvertUInt64ToString((index), s);
- return _before + (UString)s + _after;
- }
-};
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback *openArchiveCallback)
-{
- COM_TRY_BEGIN
- Close();
- try
- {
- CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
-
- CVolumeName seqName;
- if (openArchiveCallback != NULL)
- openArchiveCallback->QueryInterface(IID_IArchiveOpenVolumeCallback, (void **)&openVolumeCallback);
-
- UInt32 numVolumes = 1;
- int firstVolumeIndex = -1;
- for (UInt32 i = 1; i <= numVolumes; i++)
- {
- CMyComPtr<IInStream> curStream;
- if (i != 1)
- {
- UString fullName = seqName.GetNextName(i);
- HRESULT result = openVolumeCallback->GetStream(fullName, &curStream);
- if (result == S_FALSE)
- continue;
- if (result != S_OK)
- return result;
- if (!curStream)
- break;
- }
- else
- curStream = inStream;
- CHeader header;
- HRESULT res = NWim::ReadHeader(curStream, header);
- if (res != S_OK)
- {
- if (i == 1)
- return res;
- if (res == S_FALSE)
- continue;
- return res;
- }
- if (firstVolumeIndex >= 0)
- if (!header.AreFromOnArchive(m_Volumes[firstVolumeIndex].Header))
- break;
- if (m_Volumes.Size() > header.PartNumber && m_Volumes[header.PartNumber].Stream)
- break;
- CXml xml;
- xml.VolIndex = header.PartNumber;
- res = OpenArchive(curStream, header, xml.Data, m_Database);
- if (res != S_OK)
- {
- if (i == 1)
- return res;
- if (res == S_FALSE)
- continue;
- return res;
- }
-
- while (m_Volumes.Size() <= header.PartNumber)
- m_Volumes.Add(CVolume());
- CVolume &volume = m_Volumes[header.PartNumber];
- volume.Header = header;
- volume.Stream = curStream;
-
- firstVolumeIndex = header.PartNumber;
-
- bool needAddXml = true;
- if (m_Xmls.Size() != 0)
- if (xml.Data == m_Xmls[0].Data)
- needAddXml = false;
- if (needAddXml)
- {
- xml.Parse();
- m_Xmls.Add(xml);
- }
-
- if (i == 1)
- {
- if (header.PartNumber != 1)
- break;
- if (!openVolumeCallback)
- break;
- numVolumes = header.NumParts;
- {
- NCOM::CPropVariant prop;
- RINOK(openVolumeCallback->GetProperty(kpidName, &prop));
- if (prop.vt != VT_BSTR)
- break;
- seqName.InitName(prop.bstrVal);
- }
- }
- }
-
- RINOK(SortDatabase(m_Database));
-
- wchar_t sz[32];
- ConvertUInt64ToString(m_Database.Streams.Size(), sz);
- m_NameLenForStreams = MyStringLen(sz);
- }
- catch(...)
- {
- return S_FALSE;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- m_Database.Clear();
- m_Volumes.Clear();
- m_Xmls.Clear();
- m_NameLenForStreams = 0;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool allFilesMode = (numItems == UInt32(-1));
-
- if (allFilesMode)
- numItems = m_Database.Items.Size() + m_Xmls.Size();
- if (numItems == 0)
- return S_OK;
- bool testMode = (_aTestMode != 0);
-
- UInt32 i;
- UInt64 totalSize = 0;
- for (i = 0; i < numItems; i++)
- {
- UInt32 index = allFilesMode ? i : indices[i];
- if (index < (UInt32)m_Database.Items.Size())
- {
- int streamIndex = m_Database.Items[index].StreamIndex;
- if (streamIndex >= 0)
- {
- const CStreamInfo &si = m_Database.Streams[streamIndex];
- totalSize += si.Resource.UnpackSize;
- }
- }
- else
- totalSize += m_Xmls[index - (UInt32)m_Database.Items.Size()].Data.GetCapacity();
- }
-
- RINOK(extractCallback->SetTotal(totalSize));
-
- UInt64 currentTotalPacked = 0;
- UInt64 currentTotalUnPacked = 0;
- UInt64 currentItemUnPacked, currentItemPacked;
-
- int prevSuccessStreamIndex = -1;
-
- CUnpacker unpacker;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- for (i = 0; i < numItems; currentTotalUnPacked += currentItemUnPacked,
- currentTotalPacked += currentItemPacked)
- {
- currentItemUnPacked = 0;
- currentItemPacked = 0;
-
- lps->InSize = currentTotalPacked;
- lps->OutSize = currentTotalUnPacked;
-
- RINOK(lps->SetCur());
- UInt32 index = allFilesMode ? i : indices[i];
- i++;
- Int32 askMode = testMode ?
- NExtract::NAskMode::kTest :
- NExtract::NAskMode::kExtract;
-
- CMyComPtr<ISequentialOutStream> realOutStream;
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
- if (index >= (UInt32)m_Database.Items.Size())
- {
- if(!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- const CByteBuffer &data = m_Xmls[index - (UInt32)m_Database.Items.Size()].Data;
- currentItemUnPacked = data.GetCapacity();
- if (realOutStream)
- {
- RINOK(WriteStream(realOutStream, (const Byte *)data, data.GetCapacity()));
- realOutStream.Release();
- }
- RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kOK));
- continue;
- }
-
- const CItem &item = m_Database.Items[index];
- int streamIndex = item.StreamIndex;
- if (streamIndex < 0)
- {
- if(!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(item.HasStream() ?
- NExtract::NOperationResult::kDataError :
- NExtract::NOperationResult::kOK));
- continue;
- }
-
- const CStreamInfo &si = m_Database.Streams[streamIndex];
- currentItemUnPacked = si.Resource.UnpackSize;
- currentItemPacked = si.Resource.PackSize;
-
- if(!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- Int32 opRes = NExtract::NOperationResult::kOK;
- if (streamIndex != prevSuccessStreamIndex || realOutStream)
- {
- Byte digest[20];
- const CVolume &vol = m_Volumes[si.PartNumber];
- HRESULT res = unpacker.Unpack(vol.Stream, si.Resource, vol.Header.IsLzxMode(),
- realOutStream, progress, digest);
- if (res == S_OK)
- {
- if (memcmp(digest, si.Hash, kHashSize) == 0)
- prevSuccessStreamIndex = streamIndex;
- else
- opRes = NExtract::NOperationResult::kCRCError;
- }
- else if (res == S_FALSE)
- opRes = NExtract::NOperationResult::kDataError;
- else
- return res;
- }
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(opRes));
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = m_Database.Items.Size() + m_Xmls.Size();
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.h
deleted file mode 100644
index b7df36067..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// WimHandler.h
-
-#ifndef __ARCHIVE_WIM_HANDLER_H
-#define __ARCHIVE_WIM_HANDLER_H
-
-#include "Common/MyCom.h"
-#include "Common/MyXml.h"
-
-#include "../IArchive.h"
-#include "WimIn.h"
-
-namespace NArchive {
-namespace NWim {
-
-struct CVolume
-{
- CHeader Header;
- CMyComPtr<IInStream> Stream;
-};
-
-struct CImageInfo
-{
- bool CTimeDefined;
- bool MTimeDefined;
- bool NameDefined;
- // bool IndexDefined;
-
- FILETIME CTime;
- FILETIME MTime;
- UString Name;
- // UInt32 Index;
-
- CImageInfo(): CTimeDefined(false), MTimeDefined(false), NameDefined(false)
- // , IndexDefined(false)
- {}
- void Parse(const CXmlItem &item);
-};
-
-struct CXml
-{
- CByteBuffer Data;
- UInt16 VolIndex;
-
- CObjectVector<CImageInfo> Images;
-
- void Parse();
-};
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(IInArchive)
- INTERFACE_IInArchive(;)
-
-private:
- CDatabase m_Database;
- CObjectVector<CVolume> m_Volumes;
- CObjectVector<CXml> m_Xmls;
- int m_NameLenForStreams;
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.cpp
deleted file mode 100644
index 90c3c2c2f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.cpp
+++ /dev/null
@@ -1,570 +0,0 @@
-// Archive/WimIn.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/CpuArch.h"
-
-#include "Common/IntToString.h"
-
-#include "../../Common/StreamUtils.h"
-#include "../../Common/StreamObjects.h"
-#include "../../Common/LimitedStreams.h"
-
-#include "../Common/OutStreamWithSha1.h"
-
-#include "WimIn.h"
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-#define Get64(p) GetUi64(p)
-
-namespace NArchive{
-namespace NWim{
-
-static const int kChunkSizeBits = 15;
-static const UInt32 kChunkSize = (1 << kChunkSizeBits);
-
-namespace NXpress {
-
-class CDecoderFlusher
-{
- CDecoder *m_Decoder;
-public:
- bool NeedFlush;
- CDecoderFlusher(CDecoder *decoder): m_Decoder(decoder), NeedFlush(true) {}
- ~CDecoderFlusher()
- {
- if (NeedFlush)
- m_Decoder->Flush();
- m_Decoder->ReleaseStreams();
- }
-};
-
-HRESULT CDecoder::CodeSpec(UInt32 outSize)
-{
- {
- Byte levels[kMainTableSize];
- for (int i = 0; i < kMainTableSize; i += 2)
- {
- Byte b = m_InBitStream.DirectReadByte();
- levels[i] = b & 0xF;
- levels[i + 1] = b >> 4;
- }
- if (!m_MainDecoder.SetCodeLengths(levels))
- return S_FALSE;
- }
-
- while (outSize > 0)
- {
- UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream);
- if (number < 256)
- {
- m_OutWindowStream.PutByte((Byte)number);
- outSize--;
- }
- else
- {
- if (number >= kMainTableSize)
- return S_FALSE;
- UInt32 posLenSlot = number - 256;
- UInt32 posSlot = posLenSlot / kNumLenSlots;
- UInt32 len = posLenSlot % kNumLenSlots;
- UInt32 distance = (1 << posSlot) - 1 + m_InBitStream.ReadBits(posSlot);
-
- if (len == kNumLenSlots - 1)
- {
- len = m_InBitStream.DirectReadByte();
- if (len == 0xFF)
- {
- len = m_InBitStream.DirectReadByte();
- len |= (UInt32)m_InBitStream.DirectReadByte() << 8;
- }
- else
- len += kNumLenSlots - 1;
- }
-
- len += kMatchMinLen;
- UInt32 locLen = (len <= outSize ? len : outSize);
-
- if (!m_OutWindowStream.CopyBlock(distance, locLen))
- return S_FALSE;
-
- len -= locLen;
- outSize -= locLen;
- if (len != 0)
- return S_FALSE;
- }
- }
- return S_OK;
-}
-
-const UInt32 kDictSize = (1 << kNumPosSlots);
-
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream, UInt32 outSize)
-{
- if (!m_OutWindowStream.Create(kDictSize) || !m_InBitStream.Create(1 << 16))
- return E_OUTOFMEMORY;
-
- CDecoderFlusher flusher(this);
-
- m_InBitStream.SetStream(inStream);
- m_OutWindowStream.SetStream(outStream);
- m_InBitStream.Init();
- m_OutWindowStream.Init(false);
-
- RINOK(CodeSpec(outSize));
-
- flusher.NeedFlush = false;
- return Flush();
-}
-
-HRESULT CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream, UInt32 outSize)
-{
- try { return CodeReal(inStream, outStream, outSize); }
- catch(const CInBufferException &e) { return e.ErrorCode; } \
- catch(const CLzOutWindowException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-}
-
-static void GetFileTimeFromMem(const Byte *p, FILETIME *ft)
-{
- ft->dwLowDateTime = Get32(p);
- ft->dwHighDateTime = Get32(p + 4);
-}
-
-HRESULT CUnpacker::Unpack(IInStream *inStream, const CResource &resource, bool lzxMode,
- ISequentialOutStream *outStream, ICompressProgressInfo *progress)
-{
- RINOK(inStream->Seek(resource.Offset, STREAM_SEEK_SET, NULL));
-
- CLimitedSequentialInStream *limitedStreamSpec = new CLimitedSequentialInStream();
- CMyComPtr<ISequentialInStream> limitedStream = limitedStreamSpec;
- limitedStreamSpec->SetStream(inStream);
-
- if (!copyCoder)
- {
- copyCoderSpec = new NCompress::CCopyCoder;
- copyCoder = copyCoderSpec;
- }
- if (!resource.IsCompressed())
- {
- if (resource.PackSize != resource.UnpackSize)
- return S_FALSE;
- limitedStreamSpec->Init(resource.PackSize);
- return copyCoder->Code(limitedStreamSpec, outStream, NULL, NULL, progress);
- }
- if (resource.UnpackSize == 0)
- return S_OK;
- UInt64 numChunks = (resource.UnpackSize + kChunkSize - 1) >> kChunkSizeBits;
- unsigned entrySize = ((resource.UnpackSize > (UInt64)1 << 32) ? 8 : 4);
- UInt64 sizesBufSize64 = entrySize * (numChunks - 1);
- size_t sizesBufSize = (size_t)sizesBufSize64;
- if (sizesBufSize != sizesBufSize64)
- return E_OUTOFMEMORY;
- if (sizesBufSize > sizesBuf.GetCapacity())
- {
- sizesBuf.Free();
- sizesBuf.SetCapacity(sizesBufSize);
- }
- RINOK(ReadStream_FALSE(inStream, (Byte *)sizesBuf, sizesBufSize));
- const Byte *p = (const Byte *)sizesBuf;
-
- if (lzxMode && !lzxDecoder)
- {
- lzxDecoderSpec = new NCompress::NLzx::CDecoder(true);
- lzxDecoder = lzxDecoderSpec;
- RINOK(lzxDecoderSpec->SetParams(kChunkSizeBits));
- }
-
- UInt64 baseOffset = resource.Offset + sizesBufSize64;
- UInt64 outProcessed = 0;
- for (UInt32 i = 0; i < (UInt32)numChunks; i++)
- {
- UInt64 offset = 0;
- if (i > 0)
- {
- offset = (entrySize == 4) ? Get32(p): Get64(p);
- p += entrySize;
- }
- UInt64 nextOffset = resource.PackSize - sizesBufSize64;
- if (i + 1 < (UInt32)numChunks)
- nextOffset = (entrySize == 4) ? Get32(p): Get64(p);
- if (nextOffset < offset)
- return S_FALSE;
-
- RINOK(inStream->Seek(baseOffset + offset, STREAM_SEEK_SET, NULL));
- UInt64 inSize = nextOffset - offset;
- limitedStreamSpec->Init(inSize);
-
- if (progress)
- {
- RINOK(progress->SetRatioInfo(&offset, &outProcessed));
- }
-
- UInt32 outSize = kChunkSize;
- if (outProcessed + outSize > resource.UnpackSize)
- outSize = (UInt32)(resource.UnpackSize - outProcessed);
- UInt64 outSize64 = outSize;
- if (inSize == outSize)
- {
- RINOK(copyCoder->Code(limitedStreamSpec, outStream, NULL, &outSize64, NULL));
- }
- else
- {
- if (lzxMode)
- {
- lzxDecoderSpec->SetKeepHistory(false);
- RINOK(lzxDecoder->Code(limitedStreamSpec, outStream, NULL, &outSize64, NULL));
- }
- else
- {
- RINOK(xpressDecoder.Code(limitedStreamSpec, outStream, outSize));
- }
- }
- outProcessed += outSize;
- }
- return S_OK;
-}
-
-HRESULT CUnpacker::Unpack(IInStream *inStream, const CResource &resource, bool lzxMode,
- ISequentialOutStream *outStream, ICompressProgressInfo *progress, Byte *digest)
-{
- COutStreamWithSha1 *shaStreamSpec = new COutStreamWithSha1();
- CMyComPtr<ISequentialOutStream> shaStream = shaStreamSpec;
- shaStreamSpec->SetStream(outStream);
- shaStreamSpec->Init(digest != NULL);
- HRESULT result = Unpack(inStream, resource, lzxMode, shaStream, progress);
- if (digest)
- shaStreamSpec->Final(digest);
- return result;
-}
-
-static HRESULT UnpackData(IInStream *inStream, const CResource &resource, bool lzxMode, CByteBuffer &buf, Byte *digest)
-{
- size_t size = (size_t)resource.UnpackSize;
- if (size != resource.UnpackSize)
- return E_OUTOFMEMORY;
- buf.Free();
- buf.SetCapacity(size);
-
- CSequentialOutStreamImp2 *outStreamSpec = new CSequentialOutStreamImp2();
- CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
- outStreamSpec->Init((Byte *)buf, size);
-
- CUnpacker unpacker;
- return unpacker.Unpack(inStream, resource, lzxMode, outStream, NULL, digest);
-}
-
-static const UInt32 kSignatureSize = 8;
-static const Byte kSignature[kSignatureSize] = { 'M', 'S', 'W', 'I', 'M', 0, 0, 0 };
-
-void CResource::Parse(const Byte *p)
-{
- Flags = p[7];
- PackSize = Get64(p) & (((UInt64)1 << 56) - 1);
- Offset = Get64(p + 8);
- UnpackSize = Get64(p + 16);
-}
-
-#define GetResource(p, res) res.Parse(p)
-
-static void GetStream(const Byte *p, CStreamInfo &s)
-{
- s.Resource.Parse(p);
- s.PartNumber = Get16(p + 24);
- s.RefCount = Get32(p + 26);
- memcpy(s.Hash, p + 30, kHashSize);
-}
-
-static HRESULT ParseDirItem(const Byte *base, size_t pos, size_t size,
- const UString &prefix, CObjectVector<CItem> &items)
-{
- for (;;)
- {
- if (pos + 8 > size)
- return S_FALSE;
- const Byte *p = base + pos;
- UInt64 length = Get64(p);
- if (length == 0)
- return S_OK;
- if (pos + 102 > size || pos + length + 8 > size || length > ((UInt64)1 << 62))
- return S_FALSE;
- CItem item;
- item.Attrib = Get32(p + 8);
- // item.SecurityId = Get32(p + 0xC);
- UInt64 subdirOffset = Get64(p + 0x10);
- GetFileTimeFromMem(p + 0x28, &item.CTime);
- GetFileTimeFromMem(p + 0x30, &item.ATime);
- GetFileTimeFromMem(p + 0x38, &item.MTime);
- memcpy(item.Hash, p + 0x40, kHashSize);
-
- // UInt16 shortNameLen = Get16(p + 98);
- UInt16 fileNameLen = Get16(p + 100);
-
- size_t tempPos = pos + 102;
- if (tempPos + fileNameLen > size)
- return S_FALSE;
-
- wchar_t *sz = item.Name.GetBuffer(prefix.Length() + fileNameLen / 2 + 1);
- MyStringCopy(sz, (const wchar_t *)prefix);
- sz += prefix.Length();
- for (UInt16 i = 0; i + 2 <= fileNameLen; i += 2)
- *sz++ = Get16(base + tempPos + i);
- *sz++ = '\0';
- item.Name.ReleaseBuffer();
- if (fileNameLen == 0 && item.isDir() && !item.HasStream())
- {
- item.Attrib = 0x10; // some swm archives have system/hidden attributes for root
- item.Name.Delete(item.Name.Length() - 1);
- }
- items.Add(item);
- pos += (size_t)length;
- if (item.isDir() && (subdirOffset != 0))
- {
- if (subdirOffset >= size)
- return S_FALSE;
- RINOK(ParseDirItem(base, (size_t)subdirOffset, size, item.Name + WCHAR_PATH_SEPARATOR, items));
- }
- }
-}
-
-static HRESULT ParseDir(const Byte *base, size_t size,
- const UString &prefix, CObjectVector<CItem> &items)
-{
- size_t pos = 0;
- if (pos + 8 > size)
- return S_FALSE;
- const Byte *p = base + pos;
- UInt32 totalLength = Get32(p);
- // UInt32 numEntries = Get32(p + 4);
- pos += 8;
- {
- /*
- CRecordVector<UInt64> entryLens;
- UInt64 sum = 0;
- for (UInt32 i = 0; i < numEntries; i++)
- {
- if (pos + 8 > size)
- return S_FALSE;
- UInt64 len = Get64(p + pos);
- entryLens.Add(len);
- sum += len;
- pos += 8;
- }
- pos += sum; // skip security descriptors
- while ((pos & 7) != 0)
- pos++;
- if (pos != totalLength)
- return S_FALSE;
- */
- pos = totalLength;
- }
- return ParseDirItem(base, pos, size, prefix, items);
-}
-
-static int CompareHashRefs(const int *p1, const int *p2, void *param)
-{
- const CRecordVector<CStreamInfo> &streams = *(const CRecordVector<CStreamInfo> *)param;
- return memcmp(streams[*p1].Hash, streams[*p2].Hash, kHashSize);
-}
-
-static int CompareStreamsByPos(const CStreamInfo *p1, const CStreamInfo *p2, void * /* param */)
-{
- int res = MyCompare(p1->PartNumber, p2->PartNumber);
- if (res != 0)
- return res;
- return MyCompare(p1->Resource.Offset, p2->Resource.Offset);
-}
-
-int CompareItems(void *const *a1, void *const *a2, void * /* param */)
-{
- const CItem &i1 = **((const CItem **)a1);
- const CItem &i2 = **((const CItem **)a2);
-
- if (i1.isDir() != i2.isDir())
- return (i1.isDir()) ? 1 : -1;
- if (i1.isDir())
- return -MyStringCompareNoCase(i1.Name, i2.Name);
-
- int res = MyCompare(i1.StreamIndex, i2.StreamIndex);
- if (res != 0)
- return res;
- return MyStringCompareNoCase(i1.Name, i2.Name);
-}
-
-static int FindHash(const CRecordVector<CStreamInfo> &streams,
- const CRecordVector<int> &sortedByHash, const Byte *hash)
-{
- int left = 0, right = streams.Size();
- while (left != right)
- {
- int mid = (left + right) / 2;
- int streamIndex = sortedByHash[mid];
- UInt32 i;
- const Byte *hash2 = streams[streamIndex].Hash;
- for (i = 0; i < kHashSize; i++)
- if (hash[i] != hash2[i])
- break;
- if (i == kHashSize)
- return streamIndex;
- if (hash[i] < hash2[i])
- right = mid;
- else
- left = mid + 1;
- }
- return -1;
-}
-
-HRESULT CHeader::Parse(const Byte *p)
-{
- UInt32 haderSize = Get32(p + 8);
- if (haderSize < 0x74)
- return S_FALSE;
- Version = Get32(p + 0x0C);
- Flags = Get32(p + 0x10);
- if (!IsSupported())
- return S_FALSE;
- UInt32 chunkSize = Get32(p + 0x14);
- if (chunkSize != kChunkSize && chunkSize != 0)
- return S_FALSE;
- memcpy(Guid, p + 0x18, 16);
- PartNumber = Get16(p + 0x28);
- NumParts = Get16(p + 0x2A);
- int offset = 0x2C;
- if (IsNewVersion())
- {
- NumImages = Get32(p + offset);
- offset += 4;
- }
- GetResource(p + offset, OffsetResource);
- GetResource(p + offset + 0x18, XmlResource);
- GetResource(p + offset + 0x30, MetadataResource);
- /*
- if (IsNewVersion())
- {
- if (haderSize < 0xD0)
- return S_FALSE;
- IntegrityResource.Parse(p + offset + 0x4C);
- BootIndex = Get32(p + 0x48);
- }
- */
- return S_OK;
-}
-
-HRESULT ReadHeader(IInStream *inStream, CHeader &h)
-{
- const UInt32 kHeaderSizeMax = 0xD0;
- Byte p[kHeaderSizeMax];
- RINOK(ReadStream_FALSE(inStream, p, kHeaderSizeMax));
- if (memcmp(p, kSignature, kSignatureSize) != 0)
- return S_FALSE;
- return h.Parse(p);
-}
-
-HRESULT ReadStreams(IInStream *inStream, const CHeader &h, CDatabase &db)
-{
- CByteBuffer offsetBuf;
- RINOK(UnpackData(inStream, h.OffsetResource, h.IsLzxMode(), offsetBuf, NULL));
- for (size_t i = 0; i + kStreamInfoSize <= offsetBuf.GetCapacity(); i += kStreamInfoSize)
- {
- CStreamInfo s;
- GetStream((const Byte *)offsetBuf + i, s);
- if (s.PartNumber == h.PartNumber)
- db.Streams.Add(s);
- }
- return S_OK;
-}
-
-HRESULT OpenArchive(IInStream *inStream, const CHeader &h, CByteBuffer &xml, CDatabase &db)
-{
- RINOK(UnpackData(inStream, h.XmlResource, h.IsLzxMode(), xml, NULL));
-
- RINOK(ReadStreams(inStream, h, db));
- bool needBootMetadata = !h.MetadataResource.IsEmpty();
- if (h.PartNumber == 1)
- {
- int imageIndex = 1;
- for (int j = 0; j < db.Streams.Size(); j++)
- {
- // if (imageIndex > 1) break;
- const CStreamInfo &si = db.Streams[j];
- if (!si.Resource.IsMetadata() || si.PartNumber != h.PartNumber)
- continue;
- Byte hash[kHashSize];
- CByteBuffer metadata;
- RINOK(UnpackData(inStream, si.Resource, h.IsLzxMode(), metadata, hash));
- if (memcmp(hash, si.Hash, kHashSize) != 0)
- return S_FALSE;
- wchar_t sz[16];
- ConvertUInt32ToString(imageIndex++, sz);
- UString s = sz;
- s += WCHAR_PATH_SEPARATOR;
- RINOK(ParseDir(metadata, metadata.GetCapacity(), s, db.Items));
- if (needBootMetadata)
- if (h.MetadataResource.Offset == si.Resource.Offset)
- needBootMetadata = false;
- }
- }
-
- if (needBootMetadata)
- {
- CByteBuffer metadata;
- RINOK(UnpackData(inStream, h.MetadataResource, h.IsLzxMode(), metadata, NULL));
- RINOK(ParseDir(metadata, metadata.GetCapacity(), L"0" WSTRING_PATH_SEPARATOR, db.Items));
- }
- return S_OK;
-}
-
-
-HRESULT SortDatabase(CDatabase &db)
-{
- db.Streams.Sort(CompareStreamsByPos, NULL);
-
- {
- CRecordVector<int> sortedByHash;
- {
- for (int j = 0; j < db.Streams.Size(); j++)
- sortedByHash.Add(j);
- sortedByHash.Sort(CompareHashRefs, &db.Streams);
- }
-
- for (int i = 0; i < db.Items.Size(); i++)
- {
- CItem &item = db.Items[i];
- item.StreamIndex = -1;
- if (item.HasStream())
- item.StreamIndex = FindHash(db.Streams, sortedByHash, item.Hash);
- }
- }
-
- {
- CRecordVector<bool> used;
- int j;
- for (j = 0; j < db.Streams.Size(); j++)
- {
- const CStreamInfo &s = db.Streams[j];
- used.Add(s.Resource.IsMetadata() && s.PartNumber == 1);
- }
- for (int i = 0; i < db.Items.Size(); i++)
- {
- CItem &item = db.Items[i];
- if (item.StreamIndex >= 0)
- used[item.StreamIndex] = true;
- }
- for (j = 0; j < db.Streams.Size(); j++)
- if (!used[j])
- {
- CItem item;
- item.StreamIndex = j;
- item.HasMetadata = false;
- db.Items.Add(item);
- }
- }
-
- db.Items.Sort(CompareItems, NULL);
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.h
deleted file mode 100644
index e51a301aa..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.h
+++ /dev/null
@@ -1,235 +0,0 @@
-// Archive/WimIn.h
-
-#ifndef __ARCHIVE_WIM_IN_H
-#define __ARCHIVE_WIM_IN_H
-
-#include "Common/Buffer.h"
-#include "Common/MyString.h"
-
-#include "../../Compress/CopyCoder.h"
-#include "../../Compress/LzxDecoder.h"
-
-namespace NArchive {
-namespace NWim {
-
-namespace NXpress {
-
-class CBitStream
-{
- CInBuffer m_Stream;
- UInt32 m_Value;
- unsigned m_BitPos;
-public:
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialInStream *s) { m_Stream.SetStream(s); }
- void ReleaseStream() { m_Stream.ReleaseStream(); }
-
- void Init() { m_Stream.Init(); m_BitPos = 0; }
- // UInt64 GetProcessedSize() const { return m_Stream.GetProcessedSize() - m_BitPos / 8; }
- Byte DirectReadByte() { return m_Stream.ReadByte(); }
-
- void Normalize()
- {
- if (m_BitPos < 16)
- {
- Byte b0 = m_Stream.ReadByte();
- Byte b1 = m_Stream.ReadByte();
- m_Value = (m_Value << 8) | b1;
- m_Value = (m_Value << 8) | b0;
- m_BitPos += 16;
- }
- }
-
- UInt32 GetValue(unsigned numBits)
- {
- Normalize();
- return (m_Value >> (m_BitPos - numBits)) & ((1 << numBits) - 1);
- }
-
- void MovePos(unsigned numBits) { m_BitPos -= numBits; }
-
- UInt32 ReadBits(unsigned numBits)
- {
- UInt32 res = GetValue(numBits);
- m_BitPos -= numBits;
- return res;
- }
-};
-
-const int kNumHuffmanBits = 16;
-const UInt32 kMatchMinLen = 3;
-const UInt32 kNumLenSlots = 16;
-const UInt32 kNumPosSlots = 16;
-const UInt32 kNumPosLenSlots = kNumPosSlots * kNumLenSlots;
-const UInt32 kMainTableSize = 256 + kNumPosLenSlots;
-
-class CDecoder
-{
- CBitStream m_InBitStream;
- CLzOutWindow m_OutWindowStream;
- NCompress::NHuffman::CDecoder<kNumHuffmanBits, kMainTableSize> m_MainDecoder;
-
- HRESULT CodeSpec(UInt32 size);
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream, UInt32 outSize);
-public:
- void ReleaseStreams()
- {
- m_OutWindowStream.ReleaseStream();
- m_InBitStream.ReleaseStream();
- }
- HRESULT Flush() { return m_OutWindowStream.Flush(); }
- HRESULT Code(ISequentialInStream *inStream, ISequentialOutStream *outStream, UInt32 outSize);
-};
-
-}
-
-namespace NResourceFlags
-{
- const Byte Compressed = 4;
- const Byte kMetadata = 2;
-}
-
-struct CResource
-{
- UInt64 PackSize;
- UInt64 Offset;
- UInt64 UnpackSize;
- Byte Flags;
-
- void Parse(const Byte *p);
- bool IsCompressed() const { return (Flags & NResourceFlags::Compressed) != 0; }
- bool IsMetadata() const { return (Flags & NResourceFlags::kMetadata) != 0; }
- bool IsEmpty() const { return (UnpackSize == 0); }
-};
-
-namespace NHeaderFlags
-{
- const UInt32 kCompression = 2;
- const UInt32 kSpanned = 8;
- const UInt32 kRpFix = 0x80;
- const UInt32 kXPRESS = 0x20000;
- const UInt32 kLZX = 0x40000;
-}
-
-struct CHeader
-{
- UInt32 Flags;
- UInt32 Version;
- // UInt32 ChunkSize;
- UInt16 PartNumber;
- UInt16 NumParts;
- UInt32 NumImages;
- Byte Guid[16];
-
- CResource OffsetResource;
- CResource XmlResource;
- CResource MetadataResource;
- /*
- CResource IntegrityResource;
- UInt32 BootIndex;
- */
-
- HRESULT Parse(const Byte *p);
- bool IsCompressed() const { return (Flags & NHeaderFlags::kCompression) != 0; }
- bool IsSupported() const { return (!IsCompressed() || (Flags & NHeaderFlags::kLZX) != 0 || (Flags & NHeaderFlags::kXPRESS) != 0 ) ; }
- bool IsLzxMode() const { return (Flags & NHeaderFlags::kLZX) != 0; }
- bool IsSpanned() const { return (!IsCompressed() || (Flags & NHeaderFlags::kSpanned) != 0); }
-
- bool IsNewVersion()const { return (Version > 0x010C00); }
-
- bool AreFromOnArchive(const CHeader &h)
- {
- return (memcmp(Guid, h.Guid, sizeof(Guid)) == 0) && (h.NumParts == NumParts);
- }
-};
-
-const UInt32 kHashSize = 20;
-const UInt32 kStreamInfoSize = 24 + 2 + 4 + kHashSize;
-
-struct CStreamInfo
-{
- CResource Resource;
- UInt16 PartNumber;
- UInt32 RefCount;
- BYTE Hash[kHashSize];
-};
-
-struct CItem
-{
- UString Name;
- UInt32 Attrib;
- // UInt32 SecurityId;
- BYTE Hash[kHashSize];
- FILETIME CTime;
- FILETIME ATime;
- FILETIME MTime;
- // UInt32 ReparseTag;
- // UInt64 HardLink;
- // UInt16 NumStreams;
- // UInt16 ShortNameLen;
- int StreamIndex;
- bool HasMetadata;
- CItem(): HasMetadata(true), StreamIndex(-1) {}
- bool isDir() const { return HasMetadata && ((Attrib & 0x10) != 0); }
- bool HasStream() const
- {
- for (int i = 0; i < kHashSize; i++)
- if (Hash[i] != 0)
- return true;
- return false;
- }
-};
-
-struct CDatabase
-{
- CRecordVector<CStreamInfo> Streams;
- CObjectVector<CItem> Items;
-
- UInt64 GetUnpackSize() const
- {
- UInt64 res = 0;
- for (int i = 0; i < Streams.Size(); i++)
- res += Streams[i].Resource.UnpackSize;
- return res;
- }
-
- UInt64 GetPackSize() const
- {
- UInt64 res = 0;
- for (int i = 0; i < Streams.Size(); i++)
- res += Streams[i].Resource.PackSize;
- return res;
- }
-
- void Clear()
- {
- Streams.Clear();
- Items.Clear();
- }
-};
-
-HRESULT ReadHeader(IInStream *inStream, CHeader &header);
-HRESULT OpenArchive(IInStream *inStream, const CHeader &header, CByteBuffer &xml, CDatabase &database);
-HRESULT SortDatabase(CDatabase &database);
-
-class CUnpacker
-{
- NCompress::CCopyCoder *copyCoderSpec;
- CMyComPtr<ICompressCoder> copyCoder;
-
- NCompress::NLzx::CDecoder *lzxDecoderSpec;
- CMyComPtr<ICompressCoder> lzxDecoder;
-
- NXpress::CDecoder xpressDecoder;
-
- CByteBuffer sizesBuf;
- HRESULT Unpack(IInStream *inStream, const CResource &res, bool lzxMode,
- ISequentialOutStream *outStream, ICompressProgressInfo *progress);
-public:
- HRESULT Unpack(IInStream *inStream, const CResource &res, bool lzxMode,
- ISequentialOutStream *outStream, ICompressProgressInfo *progress, Byte *digest);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimRegister.cpp
deleted file mode 100644
index 22344b3a2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimRegister.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// WimRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "WimHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NWim::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Wim", L"wim swm", 0, 0xE6, { 'M', 'S', 'W', 'I', 'M', 0, 0, 0 }, 8, false, CreateArc, 0 };
-
-REGISTER_ARC(Wim)