mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-12 14:11:33 -06:00
23.01
This commit is contained in:
@@ -85,7 +85,7 @@ void CChecksum::Parse(const Byte *p)
|
||||
Type = Get32(p);
|
||||
NumBits = Get32(p + 4);
|
||||
memcpy(Data, p + 8, kChecksumSize_Max);
|
||||
};
|
||||
}
|
||||
|
||||
struct CFile
|
||||
{
|
||||
@@ -132,11 +132,9 @@ struct CForkPair
|
||||
};
|
||||
|
||||
|
||||
class CHandler:
|
||||
public IInArchive,
|
||||
public IInArchiveGetStream,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
Z7_CLASS_IMP_CHandler_IInArchive_1(
|
||||
IInArchiveGetStream
|
||||
)
|
||||
CMyComPtr<IInStream> _inStream;
|
||||
CObjectVector<CFile> _files;
|
||||
bool _masterCrcError;
|
||||
@@ -156,10 +154,6 @@ class CHandler:
|
||||
bool ParseBlob(const CByteBuffer &data);
|
||||
HRESULT Open2(IInStream *stream);
|
||||
HRESULT Extract(IInStream *stream);
|
||||
public:
|
||||
MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
|
||||
INTERFACE_IInArchive(;)
|
||||
STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
|
||||
};
|
||||
|
||||
// that limit can be increased, if there are such dmg files
|
||||
@@ -248,7 +242,7 @@ static const CAppleName k_Names[] =
|
||||
{ false, NULL, "Patches" }
|
||||
};
|
||||
|
||||
static const unsigned kNumAppleNames = ARRAY_SIZE(k_Names);
|
||||
static const unsigned kNumAppleNames = Z7_ARRAY_SIZE(k_Names);
|
||||
|
||||
static const Byte kProps[] =
|
||||
{
|
||||
@@ -270,7 +264,7 @@ static const Byte kArcProps[] =
|
||||
kpidComment
|
||||
};
|
||||
|
||||
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
||||
Z7_COM7F_IMF(CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
NWindows::NCOM::CPropVariant prop;
|
||||
@@ -313,19 +307,19 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
||||
if (appleName.IsFs)
|
||||
{
|
||||
numFS++;
|
||||
mainIndex = i;
|
||||
mainIndex = (int)i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (n == kNumAppleNames)
|
||||
{
|
||||
mainIndex = i;
|
||||
mainIndex = (int)i;
|
||||
numUnknown++;
|
||||
}
|
||||
}
|
||||
if (numFS + numUnknown == 1)
|
||||
prop = (UInt32)mainIndex;
|
||||
prop = (UInt32)(Int32)mainIndex;
|
||||
break;
|
||||
}
|
||||
case kpidWarning:
|
||||
@@ -448,7 +442,7 @@ static int FindKeyPair(const CXmlItem &item, const char *key, const char *nextTa
|
||||
{
|
||||
const CXmlItem &si = item.SubItems[i];
|
||||
if (si.IsTagged("key") && si.GetSubString() == key && item.SubItems[i + 1].IsTagged(nextTag))
|
||||
return i + 1;
|
||||
return (int)(i + 1);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -467,7 +461,7 @@ static const Byte k_Signature[] = { 'k','o','l','y', 0, 0, 0, 4, 0, 0, 2, 0 };
|
||||
|
||||
static inline bool IsKoly(const Byte *p)
|
||||
{
|
||||
return memcmp(p, k_Signature, ARRAY_SIZE(k_Signature)) == 0;
|
||||
return memcmp(p, k_Signature, Z7_ARRAY_SIZE(k_Signature)) == 0;
|
||||
/*
|
||||
if (Get32(p) != 0x6B6F6C79) // "koly" signature
|
||||
return false;
|
||||
@@ -486,7 +480,7 @@ HRESULT CHandler::ReadData(IInStream *stream, const CForkPair &pair, CByteBuffer
|
||||
if (size != pair.Len)
|
||||
return E_OUTOFMEMORY;
|
||||
buf.Alloc(size);
|
||||
RINOK(stream->Seek(_startPos + pair.Offset, STREAM_SEEK_SET, NULL));
|
||||
RINOK(InStream_SeekSet(stream, _startPos + pair.Offset))
|
||||
return ReadStream_FALSE(stream, buf, size);
|
||||
}
|
||||
|
||||
@@ -564,14 +558,11 @@ HRESULT CHandler::Open2(IInStream *stream)
|
||||
*/
|
||||
|
||||
_dataStartOffset = 0;
|
||||
RINOK(stream->Seek(0, STREAM_SEEK_CUR, &_startPos));
|
||||
|
||||
UInt64 fileSize = 0;
|
||||
RINOK(stream->Seek(0, STREAM_SEEK_END, &fileSize));
|
||||
RINOK(stream->Seek(_startPos, STREAM_SEEK_SET, NULL));
|
||||
UInt64 fileSize;
|
||||
RINOK(InStream_GetPos_GetSize(stream, _startPos, fileSize))
|
||||
|
||||
Byte buf[HEADER_SIZE];
|
||||
RINOK(ReadStream_FALSE(stream, buf, HEADER_SIZE));
|
||||
RINOK(ReadStream_FALSE(stream, buf, HEADER_SIZE))
|
||||
|
||||
UInt64 headerPos;
|
||||
bool startKolyMode = false;
|
||||
@@ -595,8 +586,8 @@ HRESULT CHandler::Open2(IInStream *stream)
|
||||
if (headerPos < HEADER_SIZE)
|
||||
return S_FALSE;
|
||||
headerPos -= HEADER_SIZE;
|
||||
RINOK(stream->Seek(headerPos, STREAM_SEEK_SET, NULL));
|
||||
RINOK(ReadStream_FALSE(stream, buf, HEADER_SIZE));
|
||||
RINOK(InStream_SeekSet(stream, headerPos))
|
||||
RINOK(ReadStream_FALSE(stream, buf, HEADER_SIZE))
|
||||
if (!IsKoly(buf))
|
||||
return S_FALSE;
|
||||
}
|
||||
@@ -674,7 +665,7 @@ HRESULT CHandler::Open2(IInStream *stream)
|
||||
#else
|
||||
CByteBuffer blobBuf;
|
||||
#endif
|
||||
RINOK(ReadData(stream, blobPair, blobBuf));
|
||||
RINOK(ReadData(stream, blobPair, blobBuf))
|
||||
if (!ParseBlob(blobBuf))
|
||||
_headersError = true;
|
||||
}
|
||||
@@ -704,7 +695,7 @@ HRESULT CHandler::Open2(IInStream *stream)
|
||||
CByteBuffer rsrcBuf;
|
||||
#endif
|
||||
|
||||
RINOK(ReadData(stream, rsrcPair, rsrcBuf));
|
||||
RINOK(ReadData(stream, rsrcPair, rsrcBuf))
|
||||
|
||||
const Byte *p = rsrcBuf;
|
||||
UInt32 headSize = Get32(p + 0);
|
||||
@@ -803,7 +794,7 @@ HRESULT CHandler::Open2(IInStream *stream)
|
||||
{
|
||||
CFile &file = _files.AddNew();
|
||||
file.Name = name;
|
||||
RINOK(file.Parse(pBlock + 4, blockSize));
|
||||
RINOK(file.Parse(pBlock + 4, blockSize))
|
||||
}
|
||||
|
||||
#ifdef DMG_SHOW_RAW
|
||||
@@ -844,12 +835,12 @@ HRESULT CHandler::Open2(IInStream *stream)
|
||||
if (size != xmlPair.Len)
|
||||
return S_FALSE;
|
||||
|
||||
RINOK(stream->Seek(_startPos + xmlPair.Offset, STREAM_SEEK_SET, NULL));
|
||||
RINOK(InStream_SeekSet(stream, _startPos + xmlPair.Offset))
|
||||
|
||||
CXml xml;
|
||||
{
|
||||
CObjArray<char> xmlStr(size + 1);
|
||||
RINOK(ReadStream_FALSE(stream, xmlStr, size));
|
||||
RINOK(ReadStream_FALSE(stream, xmlStr, size))
|
||||
xmlStr[size] = 0;
|
||||
// if (strlen(xmlStr) != size) return S_FALSE;
|
||||
if (!xml.Parse(xmlStr))
|
||||
@@ -916,7 +907,7 @@ HRESULT CHandler::Open2(IInStream *stream)
|
||||
if (name)
|
||||
file.Name = *name;
|
||||
}
|
||||
RINOK(file.Parse(rawBuf, destLen));
|
||||
RINOK(file.Parse(rawBuf, destLen))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -941,9 +932,9 @@ HRESULT CHandler::Open2(IInStream *stream)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::Open(IInStream *stream,
|
||||
Z7_COM7F_IMF(CHandler::Open(IInStream *stream,
|
||||
const UInt64 * /* maxCheckStartPosition */,
|
||||
IArchiveOpenCallback * /* openArchiveCallback */)
|
||||
IArchiveOpenCallback * /* openArchiveCallback */))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
{
|
||||
@@ -956,7 +947,7 @@ STDMETHODIMP CHandler::Open(IInStream *stream,
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::Close()
|
||||
Z7_COM7F_IMF(CHandler::Close())
|
||||
{
|
||||
_phySize = 0;
|
||||
_inStream.Release();
|
||||
@@ -970,7 +961,7 @@ STDMETHODIMP CHandler::Close()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
|
||||
Z7_COM7F_IMF(CHandler::GetNumberOfItems(UInt32 *numItems))
|
||||
{
|
||||
*numItems = _files.Size()
|
||||
#ifdef DMG_SHOW_RAW
|
||||
@@ -984,7 +975,7 @@ STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
|
||||
#define RAW_PREFIX "raw" STRING_PATH_SEPARATOR
|
||||
#endif
|
||||
|
||||
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
|
||||
Z7_COM7F_IMF(CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
NWindows::NCOM::CPropVariant prop;
|
||||
@@ -1054,7 +1045,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||
if (pos1 >= 0)
|
||||
{
|
||||
pos1++;
|
||||
int pos2 = item.Name.Find(')', pos1);
|
||||
const int pos2 = item.Name.Find(')', pos1);
|
||||
if (pos2 >= 0)
|
||||
{
|
||||
subName.SetFrom(item.Name.Ptr(pos1), pos2 - pos1);
|
||||
@@ -1063,6 +1054,8 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||
subName.DeleteFrom(pos1);
|
||||
}
|
||||
}
|
||||
else
|
||||
subName = item.Name; // new apfs dmg can be without braces
|
||||
subName.Trim();
|
||||
if (!subName.IsEmpty())
|
||||
{
|
||||
@@ -1080,7 +1073,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||
}
|
||||
UString name2;
|
||||
ConvertUTF8ToUnicode(subName, name2);
|
||||
name += '.';
|
||||
name.Add_Dot();
|
||||
name += name2;
|
||||
}
|
||||
else
|
||||
@@ -1109,10 +1102,11 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
class CAdcDecoder:
|
||||
public ICompressCoder,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
|
||||
Z7_CLASS_IMP_NOQIB_1(
|
||||
CAdcDecoder
|
||||
, ICompressCoder
|
||||
)
|
||||
CLzOutWindow m_OutWindowStream;
|
||||
CInBuffer m_InStream;
|
||||
|
||||
@@ -1124,7 +1118,7 @@ class CAdcDecoder:
|
||||
}
|
||||
*/
|
||||
|
||||
class CCoderReleaser
|
||||
class CCoderReleaser Z7_final
|
||||
{
|
||||
CAdcDecoder *m_Coder;
|
||||
public:
|
||||
@@ -1140,18 +1134,12 @@ class CAdcDecoder:
|
||||
friend class CCoderReleaser;
|
||||
|
||||
public:
|
||||
MY_UNKNOWN_IMP
|
||||
|
||||
STDMETHOD(CodeReal)(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress);
|
||||
|
||||
STDMETHOD(Code)(ISequentialInStream *inStream,
|
||||
HRESULT CodeReal(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress);
|
||||
};
|
||||
|
||||
STDMETHODIMP CAdcDecoder::CodeReal(ISequentialInStream *inStream,
|
||||
HRESULT CAdcDecoder::CodeReal(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress)
|
||||
{
|
||||
@@ -1176,7 +1164,7 @@ STDMETHODIMP CAdcDecoder::CodeReal(ISequentialInStream *inStream,
|
||||
if (pos > nextLimit && progress)
|
||||
{
|
||||
UInt64 packSize = m_InStream.GetProcessedSize();
|
||||
RINOK(progress->SetRatioInfo(&packSize, &pos));
|
||||
RINOK(progress->SetRatioInfo(&packSize, &pos))
|
||||
nextLimit += kStep;
|
||||
}
|
||||
Byte b;
|
||||
@@ -1229,9 +1217,9 @@ STDMETHODIMP CAdcDecoder::CodeReal(ISequentialInStream *inStream,
|
||||
return m_OutWindowStream.Flush();
|
||||
}
|
||||
|
||||
STDMETHODIMP CAdcDecoder::Code(ISequentialInStream *inStream,
|
||||
Z7_COM7F_IMF(CAdcDecoder::Code(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress)
|
||||
ICompressProgressInfo *progress))
|
||||
{
|
||||
try { return CodeReal(inStream, outStream, inSize, outSize, progress);}
|
||||
catch(const CInBufferException &e) { return e.ErrorCode; }
|
||||
@@ -1245,11 +1233,11 @@ STDMETHODIMP CAdcDecoder::Code(ISequentialInStream *inStream,
|
||||
|
||||
|
||||
|
||||
STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
Int32 testMode, IArchiveExtractCallback *extractCallback)
|
||||
Z7_COM7F_IMF(CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
Int32 testMode, IArchiveExtractCallback *extractCallback))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
bool allFilesMode = (numItems == (UInt32)(Int32)-1);
|
||||
const bool allFilesMode = (numItems == (UInt32)(Int32)-1);
|
||||
if (allFilesMode)
|
||||
numItems = _files.Size();
|
||||
if (numItems == 0)
|
||||
@@ -1307,17 +1295,17 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
lps->OutSize = currentUnpTotal;
|
||||
currentPackSize = 0;
|
||||
currentUnpSize = 0;
|
||||
RINOK(lps->SetCur());
|
||||
RINOK(lps->SetCur())
|
||||
CMyComPtr<ISequentialOutStream> realOutStream;
|
||||
Int32 askMode = testMode ?
|
||||
const Int32 askMode = testMode ?
|
||||
NExtract::NAskMode::kTest :
|
||||
NExtract::NAskMode::kExtract;
|
||||
UInt32 index = allFilesMode ? i : indices[i];
|
||||
RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
|
||||
const UInt32 index = allFilesMode ? i : indices[i];
|
||||
RINOK(extractCallback->GetStream(index, &realOutStream, askMode))
|
||||
|
||||
if (!testMode && !realOutStream)
|
||||
continue;
|
||||
RINOK(extractCallback->PrepareOperation(askMode));
|
||||
RINOK(extractCallback->PrepareOperation(askMode))
|
||||
|
||||
|
||||
COutStreamWithCRC *outCrcStreamSpec = new COutStreamWithCRC;
|
||||
@@ -1357,7 +1345,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
{
|
||||
lps->InSize = currentPackTotal + packPos;
|
||||
lps->OutSize = currentUnpTotal + unpPos;
|
||||
RINOK(lps->SetCur());
|
||||
RINOK(lps->SetCur())
|
||||
|
||||
const CBlock &block = item.Blocks[j];
|
||||
if (!block.ThereAreDataInBlock())
|
||||
@@ -1370,7 +1358,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
break;
|
||||
}
|
||||
|
||||
RINOK(_inStream->Seek(_startPos + _dataStartOffset + item.StartPos + block.PackPos, STREAM_SEEK_SET, NULL));
|
||||
RINOK(InStream_SeekSet(_inStream, _startPos + _dataStartOffset + item.StartPos + block.PackPos))
|
||||
streamSpec->Init(block.PackSize);
|
||||
bool realMethod = true;
|
||||
outStreamSpec->Init(block.UnpSize);
|
||||
@@ -1451,7 +1439,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
{
|
||||
UInt64 rem = outStreamSpec->GetRem();
|
||||
UInt32 size = (UInt32)MyMin(rem, (UInt64)kZeroBufSize);
|
||||
RINOK(WriteStream(outStream, zeroBuf, size));
|
||||
RINOK(WriteStream(outStream, zeroBuf, size))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1464,7 +1452,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
}
|
||||
}
|
||||
outStream.Release();
|
||||
RINOK(extractCallback->SetOperationResult(opRes));
|
||||
RINOK(extractCallback->SetOperationResult(opRes))
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
@@ -1478,10 +1466,13 @@ struct CChunk
|
||||
CByteBuffer Buf;
|
||||
};
|
||||
|
||||
class CInStream:
|
||||
public IInStream,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
|
||||
Z7_CLASS_IMP_COM_1(
|
||||
CInStream
|
||||
, IInStream
|
||||
)
|
||||
Z7_IFACE_COM7_IMP(ISequentialInStream)
|
||||
|
||||
UInt64 _virtPos;
|
||||
int _latestChunk;
|
||||
int _latestBlock;
|
||||
@@ -1528,11 +1519,6 @@ public:
|
||||
outStream = outStreamSpec;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
MY_UNKNOWN_IMP1(IInStream)
|
||||
|
||||
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
|
||||
STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
|
||||
};
|
||||
|
||||
|
||||
@@ -1551,7 +1537,7 @@ static unsigned FindBlock(const CRecordVector<CBlock> &blocks, UInt64 pos)
|
||||
}
|
||||
}
|
||||
|
||||
STDMETHODIMP CInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
Z7_COM7F_IMF(CInStream::Read(void *data, UInt32 size, UInt32 *processedSize))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
|
||||
@@ -1569,7 +1555,7 @@ STDMETHODIMP CInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
|
||||
if (_latestBlock >= 0)
|
||||
{
|
||||
const CBlock &block = File->Blocks[_latestBlock];
|
||||
const CBlock &block = File->Blocks[(unsigned)_latestBlock];
|
||||
if (_virtPos < block.UnpPos || (_virtPos - block.UnpPos) >= block.UnpSize)
|
||||
_latestBlock = -1;
|
||||
}
|
||||
@@ -1588,7 +1574,7 @@ STDMETHODIMP CInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
break;
|
||||
|
||||
if (i != _chunks.Size())
|
||||
_latestChunk = i;
|
||||
_latestChunk = (int)i;
|
||||
else
|
||||
{
|
||||
const unsigned kNumChunksMax = 128;
|
||||
@@ -1618,7 +1604,7 @@ STDMETHODIMP CInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
|
||||
outStreamSpec->Init(chunk.Buf, (size_t)block.UnpSize);
|
||||
|
||||
RINOK(Stream->Seek(_startPos + File->StartPos + block.PackPos, STREAM_SEEK_SET, NULL));
|
||||
RINOK(InStream_SeekSet(Stream, _startPos + File->StartPos + block.PackPos))
|
||||
|
||||
limitedStreamSpec->Init(block.PackSize);
|
||||
HRESULT res = S_OK;
|
||||
@@ -1679,17 +1665,17 @@ STDMETHODIMP CInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
return res;
|
||||
if (block.Type != METHOD_COPY && outStreamSpec->GetPos() != block.UnpSize)
|
||||
return E_FAIL;
|
||||
chunk.BlockIndex = blockIndex;
|
||||
_latestChunk = chunkIndex;
|
||||
chunk.BlockIndex = (int)blockIndex;
|
||||
_latestChunk = (int)chunkIndex;
|
||||
}
|
||||
|
||||
_chunks[_latestChunk].AccessMark = _accessMark++;
|
||||
}
|
||||
|
||||
_latestBlock = blockIndex;
|
||||
_latestBlock = (int)blockIndex;
|
||||
}
|
||||
|
||||
const CBlock &block = File->Blocks[_latestBlock];
|
||||
const CBlock &block = File->Blocks[(unsigned)_latestBlock];
|
||||
const UInt64 offset = _virtPos - block.UnpPos;
|
||||
const UInt64 rem = block.UnpSize - offset;
|
||||
if (size > rem)
|
||||
@@ -1699,7 +1685,7 @@ STDMETHODIMP CInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
|
||||
if (block.Type == METHOD_COPY)
|
||||
{
|
||||
RINOK(Stream->Seek(_startPos + File->StartPos + block.PackPos + offset, STREAM_SEEK_SET, NULL));
|
||||
RINOK(InStream_SeekSet(Stream, _startPos + File->StartPos + block.PackPos + offset))
|
||||
res = Stream->Read(data, size, &size);
|
||||
}
|
||||
else if (block.IsZeroMethod())
|
||||
@@ -1715,7 +1701,7 @@ STDMETHODIMP CInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
STDMETHODIMP CInStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
|
||||
Z7_COM7F_IMF(CInStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition))
|
||||
{
|
||||
switch (seekOrigin)
|
||||
{
|
||||
@@ -1726,13 +1712,13 @@ STDMETHODIMP CInStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPositio
|
||||
}
|
||||
if (offset < 0)
|
||||
return HRESULT_WIN32_ERROR_NEGATIVE_SEEK;
|
||||
_virtPos = offset;
|
||||
_virtPos = (UInt64)offset;
|
||||
if (newPosition)
|
||||
*newPosition = offset;
|
||||
*newPosition = (UInt64)offset;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
|
||||
Z7_COM7F_IMF(CHandler::GetStream(UInt32 index, ISequentialInStream **stream))
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
|
||||
@@ -1767,7 +1753,7 @@ STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
|
||||
|
||||
spec->Stream = _inStream;
|
||||
spec->Size = spec->File->Size;
|
||||
RINOK(spec->InitAndSeek(_startPos + _dataStartOffset));
|
||||
RINOK(spec->InitAndSeek(_startPos + _dataStartOffset))
|
||||
*stream = specStream.Detach();
|
||||
return S_OK;
|
||||
|
||||
@@ -1775,7 +1761,7 @@ STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
|
||||
}
|
||||
|
||||
REGISTER_ARC_I(
|
||||
"Dmg", "dmg", 0, 0xE4,
|
||||
"Dmg", "dmg", NULL, 0xE4,
|
||||
k_Signature,
|
||||
0,
|
||||
NArcInfoFlags::kBackwardOpen |
|
||||
|
||||
Reference in New Issue
Block a user