diff options
Diffstat (limited to 'CPP/7zip/Archive/Nsis/NsisDecode.h')
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/Archive/Nsis/NsisDecode.h | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/CPP/7zip/Archive/Nsis/NsisDecode.h b/CPP/7zip/Archive/Nsis/NsisDecode.h index 36aeb2b1..2ccaaf65 100755..100644 --- a/CPP/7zip/Archive/Nsis/NsisDecode.h +++ b/CPP/7zip/Archive/Nsis/NsisDecode.h @@ -3,9 +3,11 @@ #ifndef __NSIS_DECODE_H #define __NSIS_DECODE_H -#include "../../IStream.h" +#include "../../../Common/MyBuffer.h" -#include "../../Common/CreateCoder.h" +#include "../../Common/StreamUtils.h" + +#include "../../Compress/LzmaDecoder.h" namespace NArchive { namespace NNsis { @@ -21,25 +23,50 @@ namespace NMethodType }; } +/* 7-Zip installers 4.38 - 9.08 used modified version of NSIS that + supported BCJ filter for better compression ratio. + We support such modified NSIS archives. */ + class CDecoder { - NMethodType::EEnum _method; + NMethodType::EEnum _curMethod; // method of created decoder CMyComPtr<ISequentialInStream> _filterInStream; CMyComPtr<ISequentialInStream> _codecInStream; CMyComPtr<ISequentialInStream> _decoderInStream; + NCompress::NLzma::CDecoder *_lzmaDecoder; + public: + CMyComPtr<IInStream> InputStream; // for non-solid + UInt64 StreamPos; // the pos in unpacked for solid, the pos in Packed for non-solid + + NMethodType::EEnum Method; + bool FilterFlag; + bool Solid; + + CByteBuffer Buffer; // temp buf. + void Release() { _filterInStream.Release(); _codecInStream.Release(); _decoderInStream.Release(); + InputStream.Release(); + _lzmaDecoder = NULL; } - HRESULT Init( - DECL_EXTERNAL_CODECS_LOC_VARS - IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter); - HRESULT Read(void *data, size_t *processedSize); + + HRESULT Init(ISequentialInStream *inStream, bool &useFilter); + HRESULT Read(void *data, size_t *processedSize) + { + return ReadStream(_decoderInStream, data, processedSize);; + } + + + HRESULT CDecoder::SetToPos(UInt64 pos, ICompressProgressInfo *progress); // for solid + HRESULT Decode(CByteBuffer *outBuf, bool unpackSizeDefined, UInt32 unpackSize, + ISequentialOutStream *realOutStream, ICompressProgressInfo *progress, + UInt32 &packSizeRes, UInt32 &unpackSizeRes); }; }} |