diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2007-04-17 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:50 +0300 |
commit | a145bfc7cf17f7bbcfae8f0064333c8ea75b455c (patch) | |
tree | 4ea458c9f35956fe080562989a702ea8c9af4b90 /CPP/7zip/Archive | |
parent | d9666cf046a8453b33b3e2fbf4d82295a9f87df3 (diff) |
4.45 beta
Diffstat (limited to 'CPP/7zip/Archive')
177 files changed, 1438 insertions, 10694 deletions
diff --git a/CPP/7zip/Archive/7z/7z.dsp b/CPP/7zip/Archive/7z/7z.dsp index e57115ef..de892631 100755 --- a/CPP/7zip/Archive/7z/7z.dsp +++ b/CPP/7zip/Archive/7z/7z.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c +# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "COMPRESS_MT" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "NDEBUG" @@ -70,7 +70,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c +# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "COMPRESS_MT" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "_DEBUG" @@ -97,7 +97,11 @@ SOURCE=..\Archive.def # End Source File # Begin Source File -SOURCE=.\DllExports.cpp +SOURCE=..\ArchiveExports.cpp +# End Source File +# Begin Source File + +SOURCE=..\DllExports.cpp # End Source File # Begin Source File @@ -194,22 +198,6 @@ SOURCE=.\7zItem.h # End Source File # Begin Source File -SOURCE=.\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=.\7zMethods.cpp -# End Source File -# Begin Source File - -SOURCE=.\7zMethods.h -# End Source File -# Begin Source File - SOURCE=.\7zOut.cpp # End Source File # Begin Source File @@ -226,6 +214,10 @@ SOURCE=.\7zProperties.h # End Source File # Begin Source File +SOURCE=.\7zRegister.cpp +# End Source File +# Begin Source File + SOURCE=.\7zSpecStream.cpp # End Source File # Begin Source File @@ -278,14 +270,6 @@ SOURCE=..\..\PropID.h # PROP Default_Filter "" # Begin Source File -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - SOURCE=..\..\..\Common\Buffer.h # End Source File # Begin Source File @@ -294,10 +278,6 @@ SOURCE=..\..\..\Common\CRC.cpp # End Source File # Begin Source File -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - SOURCE=..\..\..\Common\DynamicBuffer.h # End Source File # Begin Source File @@ -354,22 +334,6 @@ SOURCE=..\..\..\Common\Vector.h # PROP Default_Filter "" # Begin Source File -SOURCE=..\Common\CodecsPath.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CodecsPath.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.h -# End Source File -# Begin Source File - SOURCE=..\Common\CoderMixer2.cpp # End Source File # Begin Source File @@ -394,14 +358,6 @@ SOURCE=..\Common\CrossThreadProgress.h # End Source File # Begin Source File -SOURCE=..\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.h -# End Source File -# Begin Source File - SOURCE=..\Common\InStreamWithCRC.cpp # End Source File # Begin Source File @@ -446,6 +402,22 @@ SOURCE=..\Common\ParseProperties.h # PROP Default_Filter "" # Begin Source File +SOURCE=..\..\Common\CreateCoder.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Common\CreateCoder.h +# End Source File +# Begin Source File + +SOURCE=..\..\Common\FilterCoder.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Common\FilterCoder.h +# End Source File +# Begin Source File + SOURCE=..\..\Common\InOutTempBuffer.cpp # End Source File # Begin Source File @@ -470,6 +442,14 @@ SOURCE=..\..\Common\LockedStream.h # End Source File # Begin Source File +SOURCE=..\..\Common\MethodId.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Common\MethodId.h +# End Source File +# Begin Source File + SOURCE=..\..\Common\OutBuffer.cpp # End Source File # Begin Source File @@ -486,6 +466,14 @@ SOURCE=..\..\Common\ProgressUtils.h # End Source File # Begin Source File +SOURCE=..\..\Common\RegisterArc.h +# End Source File +# Begin Source File + +SOURCE=..\..\Common\RegisterCodec.h +# End Source File +# Begin Source File + SOURCE=..\..\Common\StreamBinder.cpp # End Source File # Begin Source File @@ -585,6 +573,28 @@ SOURCE=..\..\Compress\Copy\CopyCoder.cpp SOURCE=..\..\Compress\Copy\CopyCoder.h # End Source File # End Group +# Begin Group "C" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\..\C\7zCrc.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\C\7zCrc.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\C\Alloc.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\C\Alloc.h +# End Source File +# End Group # Begin Source File SOURCE=.\7z.ico diff --git a/CPP/7zip/Archive/7z/7zCompressionMode.h b/CPP/7zip/Archive/7z/7zCompressionMode.h index fe54e8a6..4c4527f2 100755 --- a/CPP/7zip/Archive/7z/7zCompressionMode.h +++ b/CPP/7zip/Archive/7z/7zCompressionMode.h @@ -3,9 +3,11 @@ #ifndef __7Z_COMPRESSION_MODE_H #define __7Z_COMPRESSION_MODE_H +#include "../../../Common/String.h" + #include "../../../Windows/PropVariant.h" -#include "7zMethodID.h" +#include "../../Common/MethodID.h" namespace NArchive { namespace N7z { @@ -18,18 +20,10 @@ struct CProperty struct CMethodFull { - CMethodID MethodID; + CMethodId MethodID; UInt32 NumInStreams; UInt32 NumOutStreams; - bool IsSimpleCoder() const - { return (NumInStreams == 1) && (NumOutStreams == 1); } - - #ifdef EXCLUDE_COM - #else - CLSID EncoderClassID; - CSysString FilePath; - #endif - + bool IsSimpleCoder() const { return (NumInStreams == 1) && (NumOutStreams == 1); } CObjectVector<CProperty> CoderProperties; }; diff --git a/CPP/7zip/Archive/7z/7zDecode.cpp b/CPP/7zip/Archive/7z/7zDecode.cpp index 5c58f817..bce9b009 100755 --- a/CPP/7zip/Archive/7z/7zDecode.cpp +++ b/CPP/7zip/Archive/7z/7zDecode.cpp @@ -9,61 +9,8 @@ #include "../../Common/StreamObjects.h" #include "../../Common/ProgressUtils.h" #include "../../Common/LimitedStreams.h" -#include "../Common/FilterCoder.h" - -#include "7zMethods.h" - -#ifdef COMPRESS_LZMA -#include "../../Compress/LZMA/LZMADecoder.h" -static NArchive::N7z::CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; -#endif - -#ifdef COMPRESS_PPMD -#include "../../Compress/PPMD/PPMDDecoder.h" -static NArchive::N7z::CMethodID k_PPMD = { { 0x3, 0x4, 0x1 }, 3 }; -#endif - -#ifdef COMPRESS_BCJ_X86 -#include "../../Compress/Branch/x86.h" -static NArchive::N7z::CMethodID k_BCJ_X86 = { { 0x3, 0x3, 0x1, 0x3 }, 4 }; -#endif - -#ifdef COMPRESS_BCJ2 -#include "../../Compress/Branch/x86_2.h" -static NArchive::N7z::CMethodID k_BCJ2 = { { 0x3, 0x3, 0x1, 0x1B }, 4 }; -#endif - -#ifdef COMPRESS_DEFLATE -#ifndef COMPRESS_DEFLATE_DECODER -#define COMPRESS_DEFLATE_DECODER -#endif -#endif - -#ifdef COMPRESS_DEFLATE_DECODER -#include "../../Compress/Deflate/DeflateDecoder.h" -static NArchive::N7z::CMethodID k_Deflate = { { 0x4, 0x1, 0x8 }, 3 }; -#endif - -#ifdef COMPRESS_BZIP2 -#ifndef COMPRESS_BZIP2_DECODER -#define COMPRESS_BZIP2_DECODER -#endif -#endif - -#ifdef COMPRESS_BZIP2_DECODER -#include "../../Compress/BZip2/BZip2Decoder.h" -static NArchive::N7z::CMethodID k_BZip2 = { { 0x4, 0x2, 0x2 }, 3 }; -#endif - -#ifdef COMPRESS_COPY -#include "../../Compress/Copy/CopyCoder.h" -static NArchive::N7z::CMethodID k_Copy = { { 0x0 }, 1 }; -#endif - -#ifdef CRYPTO_7ZAES -#include "../../Crypto/7zAES/7zAES.h" -static NArchive::N7z::CMethodID k_7zAES = { { 0x6, 0xF1, 0x07, 0x01 }, 4 }; -#endif +#include "../../Common/CreateCoder.h" +#include "../../Common/FilterCoder.h" namespace NArchive { namespace N7z { @@ -88,8 +35,7 @@ static void ConvertFolderItemInfoToBindInfo(const CFolder &folder, coderStreamsInfo.NumInStreams = (UInt32)coderInfo.NumInStreams; coderStreamsInfo.NumOutStreams = (UInt32)coderInfo.NumOutStreams; bindInfo.Coders.Add(coderStreamsInfo); - const CAltCoderInfo &altCoderInfo = coderInfo.AltCoders.Front(); - bindInfo.CoderMethodIDs.Add(altCoderInfo.MethodID); + bindInfo.CoderMethodIDs.Add(coderInfo.MethodID); for (UInt32 j = 0; j < coderStreamsInfo.NumOutStreams; j++, outStreamIndex++) if (folder.FindBindPairForOutStream(outStreamIndex) < 0) bindInfo.OutStreams.Add(outStreamIndex); @@ -141,12 +87,11 @@ CDecoder::CDecoder(bool multiThread) #endif _multiThread = multiThread; _bindInfoExPrevIsDefined = false; - #ifndef EXCLUDE_COM - LoadMethodMap(); - #endif } -HRESULT CDecoder::Decode(IInStream *inStream, +HRESULT CDecoder::Decode( + DECL_EXTERNAL_CODECS_LOC_VARS + IInStream *inStream, UInt64 startPos, const UInt64 *packSizes, const CFolder &folderInfo, @@ -217,72 +162,21 @@ HRESULT CDecoder::Decode(IInStream *inStream, for (i = 0; i < numCoders; i++) { const CCoderInfo &coderInfo = folderInfo.Coders[i]; - const CAltCoderInfo &altCoderInfo = coderInfo.AltCoders.Front(); - #ifndef EXCLUDE_COM - CMethodInfo methodInfo; - if (!GetMethodInfo(altCoderInfo.MethodID, methodInfo)) - return E_NOTIMPL; - #endif + + CMyComPtr<ICompressCoder> decoder; + CMyComPtr<ICompressCoder2> decoder2; + RINOK(CreateCoder( + EXTERNAL_CODECS_LOC_VARS + coderInfo.MethodID, decoder, decoder2, false)); + CMyComPtr<IUnknown> decoderUnknown; if (coderInfo.IsSimpleCoder()) { - CMyComPtr<ICompressCoder> decoder; - CMyComPtr<ICompressFilter> filter; - - #ifdef COMPRESS_LZMA - if (altCoderInfo.MethodID == k_LZMA) - decoder = new NCompress::NLZMA::CDecoder; - #endif - - #ifdef COMPRESS_PPMD - if (altCoderInfo.MethodID == k_PPMD) - decoder = new NCompress::NPPMD::CDecoder; - #endif - - #ifdef COMPRESS_BCJ_X86 - if (altCoderInfo.MethodID == k_BCJ_X86) - filter = new CBCJ_x86_Decoder; - #endif - - #ifdef COMPRESS_DEFLATE_DECODER - if (altCoderInfo.MethodID == k_Deflate) - decoder = new NCompress::NDeflate::NDecoder::CCOMCoder; - #endif - - #ifdef COMPRESS_BZIP2_DECODER - if (altCoderInfo.MethodID == k_BZip2) - decoder = new NCompress::NBZip2::CDecoder; - #endif - - #ifdef COMPRESS_COPY - if (altCoderInfo.MethodID == k_Copy) - decoder = new NCompress::CCopyCoder; - #endif - - #ifdef CRYPTO_7ZAES - if (altCoderInfo.MethodID == k_7zAES) - filter = new NCrypto::NSevenZ::CDecoder; - #endif - - if (filter) - { - CFilterCoder *coderSpec = new CFilterCoder; - decoder = coderSpec; - coderSpec->Filter = filter; - } - #ifndef EXCLUDE_COM - if (decoder == 0) - { - RINOK(_libraries.CreateCoderSpec(methodInfo.FilePath, - methodInfo.Decoder, &decoder)); - } - #endif - if (decoder == 0) return E_NOTIMPL; - _decoders.Add((IUnknown *)decoder); - + decoderUnknown = (IUnknown *)decoder; + if (_multiThread) _mixerCoderMTSpec->AddCoder(decoder); #ifdef _ST_MODE @@ -292,32 +186,25 @@ HRESULT CDecoder::Decode(IInStream *inStream, } else { - CMyComPtr<ICompressCoder2> decoder; - - #ifdef COMPRESS_BCJ2 - if (altCoderInfo.MethodID == k_BCJ2) - decoder = new CBCJ2_x86_Decoder; - #endif - - #ifndef EXCLUDE_COM - if (decoder == 0) - { - RINOK(_libraries.CreateCoder2(methodInfo.FilePath, - methodInfo.Decoder, &decoder)); - } - #endif - - if (decoder == 0) + if (decoder2 == 0) return E_NOTIMPL; - - _decoders.Add((IUnknown *)decoder); + decoderUnknown = (IUnknown *)decoder2; if (_multiThread) - _mixerCoderMTSpec->AddCoder2(decoder); + _mixerCoderMTSpec->AddCoder2(decoder2); #ifdef _ST_MODE else - _mixerCoderSTSpec->AddCoder2(decoder, false); + _mixerCoderSTSpec->AddCoder2(decoder2, false); #endif } + _decoders.Add(decoderUnknown); + #ifdef EXTERNAL_CODECS + CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo; + decoderUnknown.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo); + if (setCompressCodecsInfo) + { + RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecsInfo)); + } + #endif } _bindInfoExPrev = bindInfo; _bindInfoExPrevIsDefined = true; @@ -332,7 +219,6 @@ HRESULT CDecoder::Decode(IInStream *inStream, for (i = 0; i < numCoders; i++) { const CCoderInfo &coderInfo = folderInfo.Coders[i]; - const CAltCoderInfo &altCoderInfo = coderInfo.AltCoders.Front(); CMyComPtr<IUnknown> &decoder = _decoders[coderIndex]; { @@ -340,7 +226,7 @@ HRESULT CDecoder::Decode(IInStream *inStream, decoder.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties); if (setDecoderProperties) { - const CByteBuffer &properties = altCoderInfo.Properties; + const CByteBuffer &properties = coderInfo.Properties; size_t size = properties.GetCapacity(); if (size > 0xFFFFFFFF) return E_NOTIMPL; diff --git a/CPP/7zip/Archive/7z/7zDecode.h b/CPP/7zip/Archive/7z/7zDecode.h index 50f80d4c..2e493c37 100755 --- a/CPP/7zip/Archive/7z/7zDecode.h +++ b/CPP/7zip/Archive/7z/7zDecode.h @@ -11,9 +11,8 @@ #ifdef _ST_MODE #include "../Common/CoderMixer2ST.h" #endif -#ifndef EXCLUDE_COM -#include "../Common/CoderLoader.h" -#endif + +#include "../../Common/CreateCoder.h" #include "7zItem.h" @@ -22,7 +21,7 @@ namespace N7z { struct CBindInfoEx: public NCoderMixer2::CBindInfo { - CRecordVector<CMethodID> CoderMethodIDs; + CRecordVector<CMethodId> CoderMethodIDs; void Clear() { CBindInfo::Clear(); @@ -32,10 +31,6 @@ struct CBindInfoEx: public NCoderMixer2::CBindInfo class CDecoder { - #ifndef EXCLUDE_COM - CCoderLibraries _libraries; - #endif - bool _bindInfoExPrevIsDefined; CBindInfoEx _bindInfoExPrev; @@ -51,7 +46,9 @@ class CDecoder // CObjectVector<CMyComPtr<ICompressCoder2> > _decoders2; public: CDecoder(bool multiThread); - HRESULT Decode(IInStream *inStream, + HRESULT Decode( + DECL_EXTERNAL_CODECS_LOC_VARS + IInStream *inStream, UInt64 startPos, const UInt64 *packSizes, const CFolder &folder, diff --git a/CPP/7zip/Archive/7z/7zEncode.cpp b/CPP/7zip/Archive/7z/7zEncode.cpp index a9fe2d0a..ef0b757b 100755 --- a/CPP/7zip/Archive/7z/7zEncode.cpp +++ b/CPP/7zip/Archive/7z/7zEncode.cpp @@ -4,84 +4,24 @@ #include "7zEncode.h" #include "7zSpecStream.h" -#include "7zMethods.h" #include "../../IPassword.h" #include "../../Common/ProgressUtils.h" #include "../../Common/LimitedStreams.h" #include "../../Common/InOutTempBuffer.h" #include "../../Common/StreamObjects.h" -#include "../Common/FilterCoder.h" - -#ifdef COMPRESS_COPY -static NArchive::N7z::CMethodID k_Copy = { { 0x0 }, 1 }; -#include "../../Compress/Copy/CopyCoder.h" -#endif - -static NArchive::N7z::CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; -static NArchive::N7z::CMethodID k_LZMA2 = { { 0x3, 0x1, 0x2 }, 3 }; - -#ifdef COMPRESS_LZMA -#include "../../Compress/LZMA/LZMAEncoder.h" -#endif - -#ifdef COMPRESS_PPMD -#include "../../Compress/PPMD/PPMDEncoder.h" -static NArchive::N7z::CMethodID k_PPMD = { { 0x3, 0x4, 0x1 }, 3 }; -#endif - -#ifdef COMPRESS_BCJ_X86 -static NArchive::N7z::CMethodID k_BCJ_X86 = { { 0x3, 0x3, 0x1, 0x3 }, 4 }; -#include "../../Compress/Branch/x86.h" -#endif - -#ifdef COMPRESS_BCJ2 -static NArchive::N7z::CMethodID k_BCJ2 = { { 0x3, 0x3, 0x1, 0x1B }, 4 }; -#include "../../Compress/Branch/x86_2.h" -#endif - -#ifdef COMPRESS_DEFLATE -#ifndef COMPRESS_DEFLATE_ENCODER -#define COMPRESS_DEFLATE_ENCODER -#endif -#endif - -#ifdef COMPRESS_DEFLATE_ENCODER -#include "../../Compress/Deflate/DeflateEncoder.h" -static NArchive::N7z::CMethodID k_Deflate = { { 0x4, 0x1, 0x8 }, 3 }; -#endif - -#ifdef COMPRESS_BZIP2 -#ifndef COMPRESS_BZIP2_ENCODER -#define COMPRESS_BZIP2_ENCODER -#endif -#endif - -#ifdef COMPRESS_BZIP2_ENCODER -#include "../../Compress/BZip2/BZip2Encoder.h" -static NArchive::N7z::CMethodID k_BZip2 = { { 0x4, 0x2, 0x2 }, 3 }; -#endif - -static NArchive::N7z::CMethodID k_AES = { { 0x6, 0xF1, 0x7, 0x1}, 4 }; - -#ifndef EXCLUDE_COM -static const wchar_t *kCryproMethod = L"7zAES"; -/* -// {23170F69-40C1-278B-06F1-070100000100} -DEFINE_GUID(CLSID_CCrypto7zAESEncoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x07, 0x01, 0x00, 0x00, 0x01, 0x00); -*/ -#endif - -#ifdef CRYPTO_7ZAES -#include "../../Crypto/7zAES/7zAES.h" -#endif +#include "../../Common/CreateCoder.h" +#include "../../Common/FilterCoder.h" + +static UInt64 k_LZMA = 0x030101; +// static UInt64 k_LZMA2 = 0x030102; +static UInt64 k_AES = 0x06F10701; namespace NArchive { namespace N7z { static void ConvertBindInfoToFolderItemInfo(const NCoderMixer2::CBindInfo &bindInfo, - const CRecordVector<CMethodID> decompressionMethods, + const CRecordVector<CMethodId> decompressionMethods, CFolder &folder) { folder.Coders.Clear(); @@ -103,20 +43,16 @@ static void ConvertBindInfoToFolderItemInfo(const NCoderMixer2::CBindInfo &bindI const NCoderMixer2::CCoderStreamsInfo &coderStreamsInfo = bindInfo.Coders[i]; coderInfo.NumInStreams = coderStreamsInfo.NumInStreams; coderInfo.NumOutStreams = coderStreamsInfo.NumOutStreams; - - // coderInfo.MethodID = decompressionMethods[i]; - // if (coderInfo.AltCoders.Size() == 0) - coderInfo.AltCoders.Add(CAltCoderInfo()); - CAltCoderInfo &altCoderInfo = coderInfo.AltCoders.Front(); - altCoderInfo.MethodID = decompressionMethods[i]; - + coderInfo.MethodID = decompressionMethods[i]; folder.Coders.Add(coderInfo); } for (i = 0; i < bindInfo.InStreams.Size(); i++) folder.PackStreams.Add(bindInfo.InStreams[i]); } -HRESULT CEncoder::CreateMixerCoder(const UInt64 *inSizeForReduce) +HRESULT CEncoder::CreateMixerCoder( + DECL_EXTERNAL_CODECS_LOC_VARS + const UInt64 *inSizeForReduce) { _mixerCoderSpec = new NCoderMixer2::CCoderMixer2MT; _mixerCoder = _mixerCoderSpec; @@ -127,88 +63,19 @@ HRESULT CEncoder::CreateMixerCoder(const UInt64 *inSizeForReduce) _codersInfo.Add(CCoderInfo()); CCoderInfo &encodingInfo = _codersInfo.Back(); CMyComPtr<ICompressCoder> encoder; - CMyComPtr<ICompressFilter> filter; CMyComPtr<ICompressCoder2> encoder2; - if (methodFull.IsSimpleCoder()) - { - #ifdef COMPRESS_LZMA - if (methodFull.MethodID == k_LZMA) - encoder = new NCompress::NLZMA::CEncoder; - #endif - - #ifdef COMPRESS_PPMD - if (methodFull.MethodID == k_PPMD) - encoder = new NCompress::NPPMD::CEncoder; - #endif - - #ifdef COMPRESS_BCJ_X86 - if (methodFull.MethodID == k_BCJ_X86) - filter = new CBCJ_x86_Encoder; - #endif - - #ifdef COMPRESS_COPY - if (methodFull.MethodID == k_Copy) - encoder = new NCompress::CCopyCoder; - #endif - - #ifdef COMPRESS_BZIP2_ENCODER - if (methodFull.MethodID == k_BZip2) - encoder = new NCompress::NBZip2::CEncoder; - #endif - - #ifdef COMPRESS_DEFLATE_ENCODER - if (methodFull.MethodID == k_Deflate) - encoder = new NCompress::NDeflate::NEncoder::CCOMCoder; - #endif - - #ifdef CRYPTO_7ZAES - if (methodFull.MethodID == k_AES) - filter = new NCrypto::NSevenZ::CEncoder; - #endif - if (filter) - { - CFilterCoder *coderSpec = new CFilterCoder; - encoder = coderSpec; - coderSpec->Filter = filter; - } + RINOK(CreateCoder( + EXTERNAL_CODECS_LOC_VARS + methodFull.MethodID, encoder, encoder2, true)); - #ifndef EXCLUDE_COM - if (encoder == 0) - { - RINOK(_libraries.CreateCoderSpec(methodFull.FilePath, - methodFull.EncoderClassID, &encoder)); - } - #endif - - if (encoder == 0) - return E_FAIL; - - } - else - { - #ifdef COMPRESS_BCJ2 - if (methodFull.MethodID == k_BCJ2) - encoder2 = new CBCJ2_x86_Encoder; - #endif - - #ifndef EXCLUDE_COM - if (encoder2 == 0) - { - RINOK(_libraries.CreateCoder2(methodFull.FilePath, - methodFull.EncoderClassID, &encoder2)); - } - #else - - if (encoder2 == 0) - return E_FAIL; - #endif - } + if (!encoder && !encoder2) + return E_FAIL; bool tryReduce = false; UInt32 reducedDictionarySize = 1 << 10; - if (inSizeForReduce != 0 && (methodFull.MethodID == k_LZMA || methodFull.MethodID == k_LZMA2)) + if (inSizeForReduce != 0 && (methodFull.MethodID == k_LZMA /* || methodFull.MethodID == k_LZMA2 */)) { for (;;) { @@ -230,7 +97,7 @@ HRESULT CEncoder::CreateMixerCoder(const UInt64 *inSizeForReduce) } } - CMyComPtr<IUnknown> encoderCommon = methodFull.IsSimpleCoder() ? (IUnknown *)encoder : (IUnknown *)encoder2; + CMyComPtr<IUnknown> encoderCommon = encoder ? (IUnknown *)encoder : (IUnknown *)encoder2; #ifdef COMPRESS_MT { @@ -284,14 +151,18 @@ HRESULT CEncoder::CreateMixerCoder(const UInt64 *inSizeForReduce) size_t size = outStreamSpec->GetSize(); - // encodingInfo.Properties.SetCapacity(size); - if (encodingInfo.AltCoders.Size() == 0) - encodingInfo.AltCoders.Add(CAltCoderInfo()); - CAltCoderInfo &altCoderInfo = encodingInfo.AltCoders.Front(); - altCoderInfo.Properties.SetCapacity(size); - - memmove(altCoderInfo.Properties, outStreamSpec->GetBuffer(), size); + encodingInfo.Properties.SetCapacity(size); + memmove(encodingInfo.Properties, outStreamSpec->GetBuffer(), size); } + + #ifdef EXTERNAL_CODECS + CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo; + encoderCommon.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo); + if (setCompressCodecsInfo) + { + RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecsInfo)); + } + #endif CMyComPtr<ICryptoSetPassword> cryptoSetPassword; encoderCommon.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword); @@ -310,7 +181,7 @@ HRESULT CEncoder::CreateMixerCoder(const UInt64 *inSizeForReduce) RINOK(cryptoSetPassword->CryptoSetPassword((const Byte *)buffer, sizeInBytes)); } - if (methodFull.IsSimpleCoder()) + if (encoder) _mixerCoderSpec->AddCoder(encoder); else _mixerCoderSpec->AddCoder2(encoder2); @@ -318,16 +189,20 @@ HRESULT CEncoder::CreateMixerCoder(const UInt64 *inSizeForReduce) return S_OK; } -HRESULT CEncoder::Encode(ISequentialInStream *inStream, +HRESULT CEncoder::Encode( + DECL_EXTERNAL_CODECS_LOC_VARS + ISequentialInStream *inStream, const UInt64 *inStreamSize, const UInt64 *inSizeForReduce, CFolder &folderItem, ISequentialOutStream *outStream, CRecordVector<UInt64> &packSizes, ICompressProgressInfo *compressProgress) { + RINOK(EncoderConstr()); + if (_mixerCoderSpec == NULL) { - RINOK(CreateMixerCoder(inSizeForReduce)); + RINOK(CreateMixerCoder(EXTERNAL_CODECS_LOC_VARS inSizeForReduce)); } _mixerCoderSpec->ReInit(); // _mixerCoderSpec->SetCoderInfo(0, NULL, NULL, progress); @@ -423,50 +298,41 @@ HRESULT CEncoder::Encode(ISequentialInStream *inStream, folderItem.UnPackSizes.Add(streamSize); } for (i = numMethods - 1; i >= 0; i--) - { - // folderItem.Coders[numMethods - 1 - i].Properties = _codersInfo[i].Properties; - for (int j = 0; j < _codersInfo[i].AltCoders.Size(); j++) - folderItem.Coders[numMethods - 1 - i].AltCoders[j].Properties - = _codersInfo[i].AltCoders[j].Properties; - } + folderItem.Coders[numMethods - 1 - i].Properties = _codersInfo[i].Properties; return S_OK; } CEncoder::CEncoder(const CCompressionMethodMode &options): - _bindReverseConverter(0) + _bindReverseConverter(0), + _constructed(false) { if (options.IsEmpty()) throw 1; _options = options; _mixerCoderSpec = NULL; +} - if (options.Methods.IsEmpty()) +HRESULT CEncoder::EncoderConstr() +{ + if (_constructed) + return S_OK; + if (_options.Methods.IsEmpty()) { // it has only password method; - if (!options.PasswordIsDefined) + if (!_options.PasswordIsDefined) throw 1; - if (!options.Binds.IsEmpty()) + if (!_options.Binds.IsEmpty()) throw 1; NCoderMixer2::CCoderStreamsInfo coderStreamsInfo; CMethodFull method; method.NumInStreams = 1; method.NumOutStreams = 1; - coderStreamsInfo.NumInStreams = method.NumOutStreams; - coderStreamsInfo.NumOutStreams = method.NumInStreams; + coderStreamsInfo.NumInStreams = 1; + coderStreamsInfo.NumOutStreams = 1; method.MethodID = k_AES; - - - #ifndef EXCLUDE_COM - CMethodInfo2 methodInfo; - if (!GetMethodInfo(kCryproMethod, methodInfo)) - throw 2; - method.FilePath = methodInfo.FilePath; - method.EncoderClassID = methodInfo.Encoder; - // method.EncoderClassID = CLSID_CCrypto7zAESEncoder; - #endif _options.Methods.Add(method); _bindInfo.Coders.Add(coderStreamsInfo); @@ -479,15 +345,15 @@ CEncoder::CEncoder(const CCompressionMethodMode &options): UInt32 numInStreams = 0, numOutStreams = 0; int i; - for (i = 0; i < options.Methods.Size(); i++) + for (i = 0; i < _options.Methods.Size(); i++) { - const CMethodFull &methodFull = options.Methods[i]; + const CMethodFull &methodFull = _options.Methods[i]; NCoderMixer2::CCoderStreamsInfo coderStreamsInfo; coderStreamsInfo.NumInStreams = methodFull.NumOutStreams; coderStreamsInfo.NumOutStreams = methodFull.NumInStreams; - if (options.Binds.IsEmpty()) + if (_options.Binds.IsEmpty()) { - if (i < options.Methods.Size() - 1) + if (i < _options.Methods.Size() - 1) { NCoderMixer2::CBindPair bindPair; bindPair.InIndex = numInStreams + coderStreamsInfo.NumInStreams; @@ -506,12 +372,12 @@ CEncoder::CEncoder(const CCompressionMethodMode &options): _bindInfo.Coders.Add(coderStreamsInfo); } - if (!options.Binds.IsEmpty()) + if (!_options.Binds.IsEmpty()) { - for (i = 0; i < options.Binds.Size(); i++) + for (i = 0; i < _options.Binds.Size(); i++) { NCoderMixer2::CBindPair bindPair; - const CBind &bind = options.Binds[i]; + const CBind &bind = _options.Binds[i]; bindPair.InIndex = _bindInfo.GetCoderInStreamIndex(bind.InCoder) + bind.InStream; bindPair.OutIndex = _bindInfo.GetCoderOutStreamIndex(bind.OutCoder) + bind.OutStream; _bindInfo.BindPairs.Add(bindPair); @@ -579,15 +445,6 @@ CEncoder::CEncoder(const CCompressionMethodMode &options): coderStreamsInfo.NumOutStreams = method.NumInStreams; method.MethodID = k_AES; - #ifndef EXCLUDE_COM - CMethodInfo2 methodInfo; - if (!GetMethodInfo(kCryproMethod, methodInfo)) - throw 2; - method.FilePath = methodInfo.FilePath; - method.EncoderClassID = methodInfo.Encoder; - // method.EncoderClassID = CLSID_CCrypto7zAESEncoder; - #endif - _options.Methods.Add(method); _bindInfo.Coders.Add(coderStreamsInfo); _bindInfo.OutStreams.Add(numOutStreams + i); @@ -604,6 +461,8 @@ CEncoder::CEncoder(const CCompressionMethodMode &options): _bindReverseConverter = new NCoderMixer2::CBindReverseConverter(_bindInfo); _bindReverseConverter->CreateReverseBindInfo(_decompressBindInfo); + _constructed = true; + return S_OK; } CEncoder::~CEncoder() diff --git a/CPP/7zip/Archive/7z/7zEncode.h b/CPP/7zip/Archive/7z/7zEncode.h index efd8bba6..588105c3 100755 --- a/CPP/7zip/Archive/7z/7zEncode.h +++ b/CPP/7zip/Archive/7z/7zEncode.h @@ -12,23 +12,15 @@ #ifdef _ST_MODE #include "../Common/CoderMixer2ST.h" #endif -#ifndef EXCLUDE_COM -#include "../Common/CoderLoader.h" -#endif -#include "7zMethods.h" #include "7zItem.h" +#include "../../Common/CreateCoder.h" + namespace NArchive { namespace N7z { class CEncoder { - #ifndef EXCLUDE_COM - // CMethodMap _methodMap; - // it must be in top of objects - CCoderLibraries _libraries; - #endif - NCoderMixer2::CCoderMixer2MT *_mixerCoderSpec; CMyComPtr<ICompressCoder2> _mixerCoder; @@ -38,14 +30,19 @@ class CEncoder NCoderMixer2::CBindInfo _bindInfo; NCoderMixer2::CBindInfo _decompressBindInfo; NCoderMixer2::CBindReverseConverter *_bindReverseConverter; - CRecordVector<CMethodID> _decompressionMethods; + CRecordVector<CMethodId> _decompressionMethods; - HRESULT CreateMixerCoder(const UInt64 *inSizeForReduce); + HRESULT CreateMixerCoder(DECL_EXTERNAL_CODECS_LOC_VARS + const UInt64 *inSizeForReduce); + bool _constructed; public: CEncoder(const CCompressionMethodMode &options); ~CEncoder(); - HRESULT Encode(ISequentialInStream *inStream, + HRESULT EncoderConstr(); + HRESULT Encode( + DECL_EXTERNAL_CODECS_LOC_VARS + ISequentialInStream *inStream, const UInt64 *inStreamSize, const UInt64 *inSizeForReduce, CFolder &folderItem, ISequentialOutStream *outStream, diff --git a/CPP/7zip/Archive/7z/7zExtract.cpp b/CPP/7zip/Archive/7z/7zExtract.cpp index 540241f7..2f2423ee 100755 --- a/CPP/7zip/Archive/7z/7zExtract.cpp +++ b/CPP/7zip/Archive/7z/7zExtract.cpp @@ -4,7 +4,6 @@ #include "7zHandler.h" #include "7zFolderOutStream.h" -#include "7zMethods.h" #include "7zDecode.h" // #include "7z1Decode.h" @@ -216,6 +215,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, try { HRESULT result = decoder.Decode( + EXTERNAL_CODECS_VARS #ifdef _7Z_VOL volume.Stream, #else diff --git a/CPP/7zip/Archive/7z/7zHandler.cpp b/CPP/7zip/Archive/7z/7zHandler.cpp index 3321fd71..abccdce9 100755 --- a/CPP/7zip/Archive/7z/7zHandler.cpp +++ b/CPP/7zip/Archive/7z/7zHandler.cpp @@ -22,6 +22,8 @@ using namespace NWindows; +extern UString ConvertMethodIdToString(UInt64 id); + namespace NArchive { namespace N7z { @@ -33,9 +35,6 @@ CHandler::CHandler() #ifndef EXTRACT_ONLY Init(); #endif - #ifndef EXCLUDE_COM - LoadMethodMap(); - #endif } STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems) @@ -124,14 +123,9 @@ static UString GetStringForSizeValue(UInt32 value) return result; } -static CMethodID k_Copy = { { 0x0 }, 1 }; -static CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; -static CMethodID k_BCJ = { { 0x3, 0x3, 0x1, 0x3 }, 4 }; -static CMethodID k_BCJ2 = { { 0x3, 0x3, 0x1, 0x1B }, 4 }; -static CMethodID k_PPMD = { { 0x3, 0x4, 0x1 }, 3 }; -static CMethodID k_Deflate = { { 0x4, 0x1, 0x8 }, 3 }; -static CMethodID k_Deflate64 = { { 0x4, 0x1, 0x9 }, 3 }; -static CMethodID k_BZip2 = { { 0x4, 0x2, 0x2 }, 3 }; +static const UInt64 k_Copy = 0x0; +static const UInt64 k_LZMA = 0x030101; +static const UInt64 k_PPMD = 0x030401; static wchar_t GetHex(Byte value) { @@ -147,7 +141,7 @@ static inline UString GetHex2(Byte value) #endif -static CMethodID k_AES = { { 0x6, 0xF1, 0x7, 0x1}, 4 }; +static const UInt64 k_AES = 0x06F10701; static inline UInt32 GetUInt32FromMemLE(const Byte *p) { @@ -161,12 +155,8 @@ bool CHandler::IsEncrypted(UInt32 index2) const { const CFolder &folderInfo = _database.Folders[folderIndex]; for (int i = folderInfo.Coders.Size() - 1; i >= 0; i--) - { - const CCoderInfo &coderInfo = folderInfo.Coders[i]; - for (int j = 0; j < coderInfo.AltCoders.Size(); j++) - if (coderInfo.AltCoders[j].MethodID == k_AES) - return true; - } + if (folderInfo.Coders[i].MethodID == k_AES) + return true; } return false; } @@ -276,81 +266,45 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va const CCoderInfo &coderInfo = folderInfo.Coders[i]; if (!methodsString.IsEmpty()) methodsString += L' '; - CMethodInfo methodInfo; - bool methodIsKnown; - - for (int j = 0; j < coderInfo.AltCoders.Size(); j++) { - if (j > 0) - methodsString += L"|"; - const CAltCoderInfo &altCoderInfo = coderInfo.AltCoders[j]; - UString methodName; - #ifdef NO_REGISTRY - - methodIsKnown = true; - if (altCoderInfo.MethodID == k_Copy) - methodName = L"Copy"; - else if (altCoderInfo.MethodID == k_LZMA) - methodName = L"LZMA"; - else if (altCoderInfo.MethodID == k_BCJ) - methodName = L"BCJ"; - else if (altCoderInfo.MethodID == k_BCJ2) - methodName = L"BCJ2"; - else if (altCoderInfo.MethodID == k_PPMD) - methodName = L"PPMD"; - else if (altCoderInfo.MethodID == k_Deflate) - methodName = L"Deflate"; - else if (altCoderInfo.MethodID == k_Deflate64) - methodName = L"Deflate64"; - else if (altCoderInfo.MethodID == k_BZip2) - methodName = L"BZip2"; - else if (altCoderInfo.MethodID == k_AES) - methodName = L"7zAES"; - else - methodIsKnown = false; - - #else - - methodIsKnown = GetMethodInfo( - altCoderInfo.MethodID, methodInfo); - methodName = methodInfo.Name; - - #endif + bool methodIsKnown = FindMethod( + EXTERNAL_CODECS_VARS + coderInfo.MethodID, methodName); if (methodIsKnown) { methodsString += methodName; - if (altCoderInfo.MethodID == k_LZMA) + if (coderInfo.MethodID == k_LZMA) { - if (altCoderInfo.Properties.GetCapacity() >= 5) + if (coderInfo.Properties.GetCapacity() >= 5) { methodsString += L":"; UInt32 dicSize = GetUInt32FromMemLE( - ((const Byte *)altCoderInfo.Properties + 1)); + ((const Byte *)coderInfo.Properties + 1)); methodsString += GetStringForSizeValue(dicSize); } } - else if (altCoderInfo.MethodID == k_PPMD) + else if (coderInfo.MethodID == k_PPMD) { - if (altCoderInfo.Properties.GetCapacity() >= 5) + if (coderInfo.Properties.GetCapacity() >= 5) { - Byte order = *(const Byte *)altCoderInfo.Properties; + Byte order = *(const Byte *)coderInfo.Properties; methodsString += L":o"; methodsString += ConvertUInt32ToString(order); methodsString += L":mem"; UInt32 dicSize = GetUInt32FromMemLE( - ((const Byte *)altCoderInfo.Properties + 1)); + ((const Byte *)coderInfo.Properties + 1)); methodsString += GetStringForSizeValue(dicSize); } } - else if (altCoderInfo.MethodID == k_AES) + else if (coderInfo.MethodID == k_AES) { - if (altCoderInfo.Properties.GetCapacity() >= 1) + if (coderInfo.Properties.GetCapacity() >= 1) { methodsString += L":"; - const Byte *data = (const Byte *)altCoderInfo.Properties; + const Byte *data = (const Byte *)coderInfo.Properties; Byte firstByte = *data++; UInt32 numCyclesPower = firstByte & 0x3F; methodsString += ConvertUInt32ToString(numCyclesPower); @@ -361,7 +315,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va return S_OK; UInt32 saltSize = (firstByte >> 7) & 1; UInt32 ivSize = (firstByte >> 6) & 1; - if (altCoderInfo.Properties.GetCapacity() >= 2) + if (coderInfo.Properties.GetCapacity() >= 2) { Byte secondByte = *data++; saltSize += (secondByte >> 4); @@ -373,18 +327,18 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va } else { - if (altCoderInfo.Properties.GetCapacity() > 0) + if (coderInfo.Properties.GetCapacity() > 0) { methodsString += L":["; - for (size_t bi = 0; bi < altCoderInfo.Properties.GetCapacity(); bi++) + for (size_t bi = 0; bi < coderInfo.Properties.GetCapacity(); bi++) { - if (bi > 5 && bi + 1 < altCoderInfo.Properties.GetCapacity()) + if (bi > 5 && bi + 1 < coderInfo.Properties.GetCapacity()) { methodsString += L".."; break; } else - methodsString += GetHex2(altCoderInfo.Properties[bi]); + methodsString += GetHex2(coderInfo.Properties[bi]); } methodsString += L"]"; } @@ -392,7 +346,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va } else { - methodsString += altCoderInfo.MethodID.ConvertToString(); + methodsString += ConvertMethodIdToString(coderInfo.MethodID); } } } @@ -655,7 +609,9 @@ STDMETHODIMP CHandler::Open(IInStream *stream, #else CInArchive archive; RINOK(archive.Open(stream, maxCheckStartPosition)); - HRESULT result = archive.ReadDatabase(_database + HRESULT result = archive.ReadDatabase( + EXTERNAL_CODECS_VARS + _database #ifndef _NO_CRYPTO , getTextPassword #endif @@ -733,8 +689,7 @@ STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream) const CCoderInfo &coder = folder.Coders.Front(); if (coder.NumInStreams != 1 || coder.NumOutStreams != 1) return S_FALSE; - const CAltCoderInfo &altCoder = coder.AltCoders.Front(); - if (altCoder.MethodID.IDSize != 1 || altCoder.MethodID.ID[0] != 0) + if (coder.MethodID != k_Copy) return S_FALSE; pos += file.UnPackSize; @@ -791,4 +746,6 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v #endif #endif +IMPL_ISetCompressCodecsInfo + }} diff --git a/CPP/7zip/Archive/7z/7zHandler.h b/CPP/7zip/Archive/7z/7zHandler.h index 8be9f398..26675b78 100755 --- a/CPP/7zip/Archive/7z/7zHandler.h +++ b/CPP/7zip/Archive/7z/7zHandler.h @@ -3,19 +3,18 @@ #ifndef __7Z_HANDLER_H #define __7Z_HANDLER_H +#include "../../ICoder.h" #include "../IArchive.h" #include "7zIn.h" #include "7zCompressionMode.h" -#ifndef _SFX -#include "7zMethods.h" -#endif - #ifdef COMPRESS_MT #include "../../../Windows/System.h" #endif +#include "../../Common/CreateCoder.h" + namespace NArchive { namespace N7z { @@ -82,13 +81,12 @@ class CHandler: #ifndef EXTRACT_ONLY public IOutArchive, #endif + PUBLIC_ISetCompressCodecsInfo public CMyUnknownImp { public: - #if !defined(_7Z_VOL) && !defined(__7Z_SET_PROPERTIES) && defined(EXTRACT_ONLY) - MY_UNKNOWN_IMP - #else MY_QUERYINTERFACE_BEGIN + MY_QUERYINTERFACE_ENTRY(IInArchive) #ifdef _7Z_VOL MY_QUERYINTERFACE_ENTRY(IInArchiveGetStream) #endif @@ -98,9 +96,9 @@ public: #ifndef EXTRACT_ONLY MY_QUERYINTERFACE_ENTRY(IOutArchive) #endif + QUERY_ENTRY_ISetCompressCodecsInfo MY_QUERYINTERFACE_END MY_ADDREF_RELEASE - #endif STDMETHOD(Open)(IInStream *stream, @@ -144,6 +142,8 @@ public: HRESULT SetSolidSettings(const PROPVARIANT &value); #endif + DECL_ISetCompressCodecsInfo + CHandler(); private: @@ -155,6 +155,7 @@ private: NArchive::N7z::CArchiveDatabaseEx _database; #endif + #ifdef COMPRESS_MT UInt32 _numThreads; #endif @@ -169,7 +170,6 @@ private: bool _solidExtension; bool _compressHeaders; - bool _compressHeadersFull; bool _encryptHeaders; bool WriteModified; @@ -182,6 +182,7 @@ private: bool _volumeMode; + DECL_EXTERNAL_CODECS_VARS HRESULT SetParam(COneMethodInfo &oneMethodInfo, const UString &name, const UString &value); HRESULT SetParams(COneMethodInfo &oneMethodInfo, const UString &srcString); @@ -225,7 +226,6 @@ private: { _removeSfxBlock = false; _compressHeaders = true; - _compressHeadersFull = true; _encryptHeaders = false; WriteModified = true; diff --git a/CPP/7zip/Archive/7z/7zHandlerOut.cpp b/CPP/7zip/Archive/7z/7zHandlerOut.cpp index 8be88c38..2508e518 100755 --- a/CPP/7zip/Archive/7z/7zHandlerOut.cpp +++ b/CPP/7zip/Archive/7z/7zHandlerOut.cpp @@ -5,7 +5,6 @@ #include "7zHandler.h" #include "7zOut.h" #include "7zUpdate.h" -#include "7zMethods.h" #include "../../../Windows/PropVariant.h" @@ -22,47 +21,6 @@ using namespace NWindows; namespace NArchive { namespace N7z { -#ifdef COMPRESS_LZMA -static CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; -static CMethodID k_LZMA2 = { { 0x3, 0x1, 0x2 }, 3 }; -#endif - -#ifdef COMPRESS_PPMD -static CMethodID k_PPMD = { { 0x3, 0x4, 0x1 }, 3 }; -#endif - -#ifdef COMPRESS_BCJ_X86 -static CMethodID k_BCJ_X86 = { { 0x3, 0x3, 0x1, 0x3 }, 4 }; -#endif - -#ifdef COMPRESS_BCJ2 -static CMethodID k_BCJ2 = { { 0x3, 0x3, 0x1, 0x1B }, 4 }; -#endif - -#ifdef COMPRESS_COPY -static CMethodID k_Copy = { { 0x0 }, 1 }; -#endif - -#ifdef COMPRESS_DEFLATE -#ifndef COMPRESS_DEFLATE_ENCODER -#define COMPRESS_DEFLATE_ENCODER -#endif -#endif - -#ifdef COMPRESS_DEFLATE_ENCODER -static CMethodID k_Deflate = { { 0x4, 0x1, 0x8 }, 3 }; -#endif - -#ifdef COMPRESS_BZIP2 -#ifndef COMPRESS_BZIP2_ENCODER -#define COMPRESS_BZIP2_ENCODER -#endif -#endif - -#ifdef COMPRESS_BZIP2_ENCODER -static CMethodID k_BZip2 = { { 0x4, 0x2, 0x2 }, 3 }; -#endif - const wchar_t *kCopyMethod = L"Copy"; const wchar_t *kLZMAMethodName = L"LZMA"; const wchar_t *kLZMA2MethodName = L"LZMA2"; @@ -79,8 +37,8 @@ static const UInt32 kLzmaAlgorithmX5 = 1; static const UInt32 kLzmaDicSizeX1 = 1 << 16; static const UInt32 kLzmaDicSizeX3 = 1 << 20; -static const UInt32 kLzmaDicSizeX5 = 1 << 22; -static const UInt32 kLzmaDicSizeX7 = 1 << 24; +static const UInt32 kLzmaDicSizeX5 = 1 << 24; +static const UInt32 kLzmaDicSizeX7 = 1 << 25; static const UInt32 kLzmaDicSizeX9 = 1 << 26; static const UInt32 kLzmaFastBytesX1 = 32; @@ -240,8 +198,6 @@ HRESULT CHandler::SetCompressionMethod( ); RINOK(res); methodMode.Binds = _binds; - if (_compressHeadersFull) - _compressHeaders = true; if (_compressHeaders) { @@ -308,15 +264,6 @@ HRESULT CHandler::SetCompressionMethod( #endif ) { - #ifndef EXCLUDE_COM - /* - CObjectVector<CMethodInfo2> methodInfoVector; - if (!NRegistryInfo::EnumerateAllMethods(methodInfoVector)) - return E_FAIL; - */ - #endif - - UInt32 level = _level; if (methodsInfo.IsEmpty()) @@ -418,93 +365,11 @@ HRESULT CHandler::SetCompressionMethod( CMethodFull methodFull; - methodFull.NumInStreams = 1; - methodFull.NumOutStreams = 1; - - bool defined = false; - - #ifdef COMPRESS_LZMA - if (oneMethodInfo.MethodName.CompareNoCase(L"LZMA") == 0) - { - defined = true; - methodFull.MethodID = k_LZMA; - } - #endif - - #ifdef COMPRESS_PPMD - if (oneMethodInfo.MethodName.CompareNoCase(L"PPMD") == 0) - { - defined = true; - methodFull.MethodID = k_PPMD; - } - #endif - - #ifdef COMPRESS_BCJ_X86 - if (oneMethodInfo.MethodName.CompareNoCase(L"BCJ") == 0) - { - defined = true; - methodFull.MethodID = k_BCJ_X86; - } - #endif - - #ifdef COMPRESS_BCJ2 - if (oneMethodInfo.MethodName.CompareNoCase(L"BCJ2") == 0) - { - defined = true; - methodFull.MethodID = k_BCJ2; - methodFull.NumInStreams = 4; - methodFull.NumOutStreams = 1; - } - #endif - - #ifdef COMPRESS_DEFLATE_ENCODER - if (oneMethodInfo.MethodName.CompareNoCase(L"Deflate") == 0) - { - defined = true; - methodFull.MethodID = k_Deflate; - } - #endif - - #ifdef COMPRESS_BZIP2_ENCODER - if (oneMethodInfo.MethodName.CompareNoCase(L"BZip2") == 0) - { - defined = true; - methodFull.MethodID = k_BZip2; - } - #endif - - #ifdef COMPRESS_COPY - if (oneMethodInfo.MethodName.CompareNoCase(L"Copy") == 0) - { - defined = true; - methodFull.MethodID = k_Copy; - } - - #endif - - #ifndef EXCLUDE_COM - if (!defined) - { - CMethodInfo2 methodInfo; - if (!GetMethodInfo(oneMethodInfo.MethodName, methodInfo)) - return E_INVALIDARG; - if (!methodInfo.EncoderIsAssigned) - return E_INVALIDARG; - - methodFull.MethodID = methodInfo.MethodID; - methodFull.NumInStreams = methodInfo.NumInStreams; - methodFull.NumOutStreams = methodInfo.NumOutStreams; - - methodFull.EncoderClassID = methodInfo.Encoder; - methodFull.FilePath = methodInfo.FilePath; - defined = true; - } - - #endif - if (!defined) + if (!FindMethod( + EXTERNAL_CODECS_VARS + oneMethodInfo.MethodName, methodFull.MethodID, methodFull.NumInStreams, methodFull.NumOutStreams)) return E_INVALIDARG; - methodFull.CoderProperties = oneMethodInfo.CoderProperties; methodMode.Methods.Add(methodFull); @@ -707,17 +572,10 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt RINOK(SetPassword(methodMode, updateCallback)); - bool useAdditionalHeaderStreams = true; - bool compressMainHeader = false; + bool compressMainHeader = _compressHeaders; // check it - if (_compressHeadersFull) - { - useAdditionalHeaderStreams = false; - compressMainHeader = true; - } if (methodMode.PasswordIsDefined) { - useAdditionalHeaderStreams = false; compressMainHeader = true; if(_encryptHeaders) RINOK(SetPassword(headerMethod, updateCallback)); @@ -734,7 +592,6 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt options.UseFilters = _level != 0 && _autoFilter; options.MaxFilter = _level >= 8; - options.HeaderOptions.UseAdditionalHeaderStreams = useAdditionalHeaderStreams; options.HeaderOptions.CompressMainHeader = compressMainHeader; options.HeaderOptions.WriteModified = WriteModified; options.HeaderOptions.WriteCreated = WriteCreated; @@ -746,6 +603,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt options.RemoveSfxBlock = _removeSfxBlock; options.VolumeMode = _volumeMode; return Update( + EXTERNAL_CODECS_VARS #ifdef _7Z_VOL volume ? volume->Stream: 0, volume ? database: 0, @@ -1050,7 +908,10 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v } else if (name.CompareNoCase(L"HCF") == 0) { - RINOK(SetBoolProperty(_compressHeadersFull, value)); + bool compressHeadersFull = true; + RINOK(SetBoolProperty(compressHeadersFull, value)); + if (!compressHeadersFull) + return E_INVALIDARG; continue; } else if (name.CompareNoCase(L"HE") == 0) diff --git a/CPP/7zip/Archive/7z/7zHeader.h b/CPP/7zip/Archive/7z/7zHeader.h index 59bc7fe5..e239ab23 100755 --- a/CPP/7zip/Archive/7z/7zHeader.h +++ b/CPP/7zip/Archive/7z/7zHeader.h @@ -3,7 +3,7 @@ #ifndef __7Z_HEADER_H #define __7Z_HEADER_H -#include "7zMethodID.h" +#include "../../../Common/Types.h" namespace NArchive { namespace N7z { diff --git a/CPP/7zip/Archive/7z/7zIn.cpp b/CPP/7zip/Archive/7z/7zIn.cpp index 53d78b1a..6c709b89 100755 --- a/CPP/7zip/Archive/7z/7zIn.cpp +++ b/CPP/7zip/Archive/7z/7zIn.cpp @@ -3,11 +3,13 @@ #include "StdAfx.h" #include "7zIn.h" -#include "7zMethods.h" #include "7zDecode.h" #include "../../Common/StreamObjects.h" #include "../../Common/StreamUtils.h" -#include "../../../Common/CRC.h" +extern "C" +{ +#include "../../../../C/7zCrc.h" +} // define FORMAT_7Z_RECOVERY if you want to recover multivolume archives with empty StartHeader // #define FORMAT_7Z_RECOVERY @@ -99,7 +101,7 @@ HRESULT CInArchive::SafeReadDirectByte(Byte &b) return SafeReadDirect(&b, 1); } -HRESULT CInArchive::SafeReadDirectUInt32(UInt32 &value) +HRESULT CInArchive::SafeReadDirectUInt32(UInt32 &value, UInt32 &crc) { value = 0; for (int i = 0; i < 4; i++) @@ -107,11 +109,12 @@ HRESULT CInArchive::SafeReadDirectUInt32(UInt32 &value) Byte b; RINOK(SafeReadDirectByte(b)); value |= (UInt32(b) << (8 * i)); + crc = CRC_UPDATE_BYTE(crc, b); } return S_OK; } -HRESULT CInArchive::SafeReadDirectUInt64(UInt64 &value) +HRESULT CInArchive::SafeReadDirectUInt64(UInt64 &value, UInt32 &crc) { value = 0; for (int i = 0; i < 8; i++) @@ -119,6 +122,7 @@ HRESULT CInArchive::SafeReadDirectUInt64(UInt64 &value) Byte b; RINOK(SafeReadDirectByte(b)); value |= (UInt64(b) << (8 * i)); + crc = CRC_UPDATE_BYTE(crc, b); } return S_OK; } @@ -367,14 +371,19 @@ HRESULT CInArchive::GetNextFolderItem(CFolder &folder) folder.Coders.Add(CCoderInfo()); CCoderInfo &coder = folder.Coders.Back(); - for (;;) { - coder.AltCoders.Add(CAltCoderInfo()); - CAltCoderInfo &altCoder = coder.AltCoders.Back(); Byte mainByte = 0; RINOK(ReadByte(mainByte)); - altCoder.MethodID.IDSize = (Byte)(mainByte & 0xF); - RINOK(ReadBytes(altCoder.MethodID.ID, altCoder.MethodID.IDSize)); + int idSize = (mainByte & 0xF); + BYTE longID[15]; + RINOK(ReadBytes(longID, idSize)); + if (idSize > 8) + return S_FALSE; + UInt64 id = 0; + for (int j = 0; j < idSize; j++) + id |= (UInt64)longID[idSize - 1 - j] << (8 * j); + coder.MethodID = id; + if ((mainByte & 0x10) != 0) { RINOK(ReadNum(coder.NumInStreams)); @@ -389,11 +398,11 @@ HRESULT CInArchive::GetNextFolderItem(CFolder &folder) { CNum propertiesSize = 0; RINOK(ReadNum(propertiesSize)); - altCoder.Properties.SetCapacity((size_t)propertiesSize); - RINOK(ReadBytes((Byte *)altCoder.Properties, (size_t)propertiesSize)); + coder.Properties.SetCapacity((size_t)propertiesSize); + RINOK(ReadBytes((Byte *)coder.Properties, (size_t)propertiesSize)); } - if ((mainByte & 0x80) == 0) - break; + if ((mainByte & 0x80) != 0) + return S_FALSE; } numInStreams += coder.NumInStreams; numOutStreams += coder.NumOutStreams; @@ -826,7 +835,9 @@ HRESULT CInArchive::ReadTime(const CObjectVector<CByteBuffer> &dataVector, return S_OK; } -HRESULT CInArchive::ReadAndDecodePackedStreams(UInt64 baseOffset, +HRESULT CInArchive::ReadAndDecodePackedStreams( + DECL_EXTERNAL_CODECS_LOC_VARS + UInt64 baseOffset, UInt64 &dataOffset, CObjectVector<CByteBuffer> &dataVector #ifndef _NO_CRYPTO , ICryptoGetTextPassword *getTextPassword @@ -881,7 +892,9 @@ HRESULT CInArchive::ReadAndDecodePackedStreams(UInt64 baseOffset, CMyComPtr<ISequentialOutStream> outStream = outStreamSpec; outStreamSpec->Init(data, (size_t)unPackSize); - HRESULT result = decoder.Decode(_stream, dataStartPos, + HRESULT result = decoder.Decode( + EXTERNAL_CODECS_LOC_VARS + _stream, dataStartPos, &packSizes[packIndex], folder, outStream, NULL #ifndef _NO_CRYPTO , getTextPassword @@ -893,7 +906,7 @@ HRESULT CInArchive::ReadAndDecodePackedStreams(UInt64 baseOffset, RINOK(result); if (folder.UnPackCRCDefined) - if (!CCRC::VerifyDigest(folder.UnPackCRC, data, (UInt32)unPackSize)) + if (CrcCalc(data, (UInt32)unPackSize) != folder.UnPackCRC) throw CInArchiveException(CInArchiveException::kIncorrectHeader); for (int j = 0; j < folder.PackStreams.Size(); j++) dataStartPos += packSizes[packIndex++]; @@ -901,7 +914,9 @@ HRESULT CInArchive::ReadAndDecodePackedStreams(UInt64 baseOffset, return S_OK; } -HRESULT CInArchive::ReadHeader(CArchiveDatabaseEx &database +HRESULT CInArchive::ReadHeader( + DECL_EXTERNAL_CODECS_LOC_VARS + CArchiveDatabaseEx &database #ifndef _NO_CRYPTO , ICryptoGetTextPassword *getTextPassword #endif @@ -921,6 +936,7 @@ HRESULT CInArchive::ReadHeader(CArchiveDatabaseEx &database if (type == NID::kAdditionalStreamsInfo) { HRESULT result = ReadAndDecodePackedStreams( + EXTERNAL_CODECS_LOC_VARS database.ArchiveInfo.StartPositionAfterHeader, database.ArchiveInfo.DataStartPosition2, dataVector @@ -1192,7 +1208,9 @@ void CArchiveDatabaseEx::FillFolderStartFileIndex() } } -HRESULT CInArchive::ReadDatabase(CArchiveDatabaseEx &database +HRESULT CInArchive::ReadDatabase( + DECL_EXTERNAL_CODECS_LOC_VARS + CArchiveDatabaseEx &database #ifndef _NO_CRYPTO , ICryptoGetTextPassword *getTextPassword #endif @@ -1219,11 +1237,12 @@ HRESULT CInArchive::ReadDatabase(CArchiveDatabaseEx &database UInt64 nextHeaderOffset; UInt64 nextHeaderSize; UInt32 nextHeaderCRC; - CCRC crc; - RINOK(SafeReadDirectUInt32(crcFromArchive)); - RINOK(SafeReadDirectUInt64(nextHeaderOffset)); - RINOK(SafeReadDirectUInt64(nextHeaderSize)); - RINOK(SafeReadDirectUInt32(nextHeaderCRC)); + UInt32 crc = CRC_INIT_VAL; + UInt32 temp; + RINOK(SafeReadDirectUInt32(crcFromArchive, temp)); + RINOK(SafeReadDirectUInt64(nextHeaderOffset, crc)); + RINOK(SafeReadDirectUInt64(nextHeaderSize, crc)); + RINOK(SafeReadDirectUInt32(nextHeaderCRC, crc)); #ifdef FORMAT_7Z_RECOVERY if (crcFromArchive == 0 && nextHeaderOffset == 0 && nextHeaderSize == 0 && nextHeaderCRC == 0) @@ -1254,10 +1273,6 @@ HRESULT CInArchive::ReadDatabase(CArchiveDatabaseEx &database } #endif - crc.UpdateUInt64(nextHeaderOffset); - crc.UpdateUInt64(nextHeaderSize); - crc.UpdateUInt32(nextHeaderCRC); - #ifdef FORMAT_7Z_RECOVERY crcFromArchive = crc.GetDigest(); #endif @@ -1278,7 +1293,7 @@ HRESULT CInArchive::ReadDatabase(CArchiveDatabaseEx &database { database.ArchiveInfo.StartPositionAfterHeader = _position; } - if (crc.GetDigest() != crcFromArchive) + if (CRC_GET_DIGEST(crc) != crcFromArchive) throw CInArchiveException(CInArchiveException::kIncorrectHeader); if (nextHeaderSize == 0) @@ -1292,7 +1307,7 @@ HRESULT CInArchive::ReadDatabase(CArchiveDatabaseEx &database CByteBuffer buffer2; buffer2.SetCapacity((size_t)nextHeaderSize); RINOK(SafeReadDirect(buffer2, (UInt32)nextHeaderSize)); - if (!CCRC::VerifyDigest(nextHeaderCRC, buffer2, (UInt32)nextHeaderSize)) + if (CrcCalc(buffer2, (UInt32)nextHeaderSize) != nextHeaderCRC) throw CInArchiveException(CInArchiveException::kIncorrectHeader); CStreamSwitch streamSwitch; @@ -1309,6 +1324,7 @@ HRESULT CInArchive::ReadDatabase(CArchiveDatabaseEx &database if (type != NID::kEncodedHeader) throw CInArchiveException(CInArchiveException::kIncorrectHeader); HRESULT result = ReadAndDecodePackedStreams( + EXTERNAL_CODECS_LOC_VARS database.ArchiveInfo.StartPositionAfterHeader, database.ArchiveInfo.DataStartPosition2, dataVector @@ -1325,7 +1341,9 @@ HRESULT CInArchive::ReadDatabase(CArchiveDatabaseEx &database streamSwitch.Set(this, dataVector.Front()); } - return ReadHeader(database + return ReadHeader( + EXTERNAL_CODECS_LOC_VARS + database #ifndef _NO_CRYPTO , getTextPassword #endif diff --git a/CPP/7zip/Archive/7z/7zIn.h b/CPP/7zip/Archive/7z/7zIn.h index 4f27aa75..927c23f9 100755 --- a/CPP/7zip/Archive/7z/7zIn.h +++ b/CPP/7zip/Archive/7z/7zIn.h @@ -5,6 +5,9 @@ #include "../../IStream.h" #include "../../IPassword.h" + +#include "../../Common/CreateCoder.h" + #include "../../../Common/MyCom.h" #include "../../Common/InBuffer.h" @@ -95,11 +98,9 @@ struct CArchiveDatabaseEx: public CArchiveDatabase UInt64 GetFilePackSize(CNum fileIndex) const { CNum folderIndex = FileIndexToFolderIndexMap[fileIndex]; - if (folderIndex >= 0) - { + if (folderIndex != kNumNoIndex) if (FolderStartFileIndex[folderIndex] == fileIndex) return GetFolderFullPackSize(folderIndex); - } return 0; } }; @@ -182,8 +183,8 @@ private: HRESULT ReadDirect(void *data, UInt32 size, UInt32 *processedSize); HRESULT SafeReadDirect(void *data, UInt32 size); HRESULT SafeReadDirectByte(Byte &b); - HRESULT SafeReadDirectUInt32(UInt32 &value); - HRESULT SafeReadDirectUInt64(UInt64 &value); + HRESULT SafeReadDirectUInt32(UInt32 &value, UInt32 &crc); + HRESULT SafeReadDirectUInt64(UInt64 &value, UInt32 &crc); HRESULT ReadBytes(void *data, size_t size) { @@ -261,13 +262,17 @@ private: HRESULT ReadBoolVector2(int numItems, CBoolVector &v); HRESULT ReadTime(const CObjectVector<CByteBuffer> &dataVector, CObjectVector<CFileItem> &files, UInt64 type); - HRESULT ReadAndDecodePackedStreams(UInt64 baseOffset, UInt64 &dataOffset, + HRESULT ReadAndDecodePackedStreams( + DECL_EXTERNAL_CODECS_LOC_VARS + UInt64 baseOffset, UInt64 &dataOffset, CObjectVector<CByteBuffer> &dataVector #ifndef _NO_CRYPTO , ICryptoGetTextPassword *getTextPassword #endif ); - HRESULT ReadHeader(CArchiveDatabaseEx &database + HRESULT ReadHeader( + DECL_EXTERNAL_CODECS_LOC_VARS + CArchiveDatabaseEx &database #ifndef _NO_CRYPTO ,ICryptoGetTextPassword *getTextPassword #endif @@ -276,7 +281,9 @@ public: HRESULT Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit); // S_FALSE means is not archive void Close(); - HRESULT ReadDatabase(CArchiveDatabaseEx &database + HRESULT ReadDatabase( + DECL_EXTERNAL_CODECS_LOC_VARS + CArchiveDatabaseEx &database #ifndef _NO_CRYPTO ,ICryptoGetTextPassword *getTextPassword #endif diff --git a/CPP/7zip/Archive/7z/7zItem.h b/CPP/7zip/Archive/7z/7zItem.h index 08ea61f4..c4f9dc13 100755 --- a/CPP/7zip/Archive/7z/7zItem.h +++ b/CPP/7zip/Archive/7z/7zItem.h @@ -4,27 +4,23 @@ #define __7Z_ITEM_H #include "../../../Common/Buffer.h" -#include "7zMethodID.h" +#include "../../../Common/String.h" +#include "../../Common/MethodID.h" #include "7zHeader.h" namespace NArchive { namespace N7z { -struct CAltCoderInfo -{ - CMethodID MethodID; - CByteBuffer Properties; -}; - typedef UInt32 CNum; const CNum kNumMax = 0x7FFFFFFF; const CNum kNumNoIndex = 0xFFFFFFFF; struct CCoderInfo { + CMethodId MethodID; + CByteBuffer Properties; CNum NumInStreams; CNum NumOutStreams; - CObjectVector<CAltCoderInfo> AltCoders; bool IsSimpleCoder() const { return (NumInStreams == 1) && (NumOutStreams == 1); } }; diff --git a/CPP/7zip/Archive/7z/7zMethodID.cpp b/CPP/7zip/Archive/7z/7zMethodID.cpp deleted file mode 100755 index 0d45b732..00000000 --- a/CPP/7zip/Archive/7z/7zMethodID.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// 7zMethodID.cpp - -#include "StdAfx.h" - -#include "7zMethodID.h" - -namespace NArchive { -namespace N7z { - -static wchar_t GetHex(Byte value) -{ - return (wchar_t)((value < 10) ? ('0' + value) : ('A' + (value - 10))); -} - -static bool HexCharToInt(wchar_t value, Byte &result) -{ - if (value >= '0' && value <= '9') - result = (Byte)(value - '0'); - else if (value >= 'a' && value <= 'f') - result = (Byte)(10 + value - 'a'); - else if (value >= 'A' && value <= 'F') - result = (Byte)(10 + value - 'A'); - else - return false; - return true; -} - -static bool TwoHexCharsToInt(wchar_t valueHigh, wchar_t valueLow, Byte &result) -{ - Byte resultHigh, resultLow; - if (!HexCharToInt(valueHigh, resultHigh)) - return false; - if (!HexCharToInt(valueLow, resultLow)) - return false; - result = (Byte)((resultHigh << 4) + resultLow); - return true; -} - -UString CMethodID::ConvertToString() const -{ - UString result; - for (int i = 0; i < IDSize; i++) - { - Byte b = ID[i]; - result += GetHex((Byte)(b >> 4)); - result += GetHex((Byte)(b & 0xF)); - } - return result; -} - -bool CMethodID::ConvertFromString(const UString &srcString) -{ - int length = srcString.Length(); - if ((length & 1) != 0 || (length >> 1) > kMethodIDSize) - return false; - IDSize = (Byte)(length / 2); - UInt32 i; - for(i = 0; i < IDSize; i++) - if (!TwoHexCharsToInt(srcString[i * 2], srcString[i * 2 + 1], ID[i])) - return false; - for(; i < kMethodIDSize; i++) - ID[i] = 0; - return true; -} - -bool operator==(const CMethodID &a1, const CMethodID &a2) -{ - if (a1.IDSize != a2.IDSize) - return false; - for (UInt32 i = 0; i < a1.IDSize; i++) - if (a1.ID[i] != a2.ID[i]) - return false; - return true; -} - -}} diff --git a/CPP/7zip/Archive/7z/7zMethodID.h b/CPP/7zip/Archive/7z/7zMethodID.h deleted file mode 100755 index 54561054..00000000 --- a/CPP/7zip/Archive/7z/7zMethodID.h +++ /dev/null @@ -1,29 +0,0 @@ -// 7zMethodID.h - -#ifndef __7Z_METHOD_ID_H -#define __7Z_METHOD_ID_H - -#include "../../../Common/String.h" -#include "../../../Common/Types.h" - -namespace NArchive { -namespace N7z { - -const int kMethodIDSize = 15; - -struct CMethodID -{ - Byte ID[kMethodIDSize]; - Byte IDSize; - UString ConvertToString() const; - bool ConvertFromString(const UString &srcString); -}; - -bool operator==(const CMethodID &a1, const CMethodID &a2); - -inline bool operator!=(const CMethodID &a1, const CMethodID &a2) - { return !(a1 == a2); } - -}} - -#endif diff --git a/CPP/7zip/Archive/7z/7zMethods.cpp b/CPP/7zip/Archive/7z/7zMethods.cpp deleted file mode 100755 index 19270aa4..00000000 --- a/CPP/7zip/Archive/7z/7zMethods.cpp +++ /dev/null @@ -1,174 +0,0 @@ -// 7zMethods.cpp - -#include "StdAfx.h" - -#include "7zMethods.h" - -#include "../../../Windows/FileFind.h" -#include "../../../Windows/DLL.h" -#include "../../../Windows/PropVariant.h" -#include "../../../Windows/Synchronization.h" - -#include "../../ICoder.h" -#include "../Common/CodecsPath.h" - -using namespace NWindows; - -namespace NArchive { -namespace N7z { - -static CObjectVector<CMethodInfo2> g_Methods; -static bool g_Loaded = false; - -typedef UInt32 (WINAPI *GetNumberOfMethodsFunc)(UInt32 *numMethods); - -typedef UInt32 (WINAPI *GetMethodPropertyFunc)( - UInt32 index, PROPID propID, PROPVARIANT *value); - -static void Load(const CSysString &folderPrefix) -{ - NFile::NFind::CEnumerator enumerator(folderPrefix + CSysString(TEXT("*"))); - NFile::NFind::CFileInfo fileInfo; - while (enumerator.Next(fileInfo)) - { - if (fileInfo.IsDirectory()) - continue; - CSysString filePath = folderPrefix + fileInfo.Name; - { - NDLL::CLibrary library; - if (!library.LoadEx(filePath, LOAD_LIBRARY_AS_DATAFILE)) - continue; - } - NDLL::CLibrary library; - if (!library.Load(filePath)) - continue; - GetMethodPropertyFunc getMethodProperty = (GetMethodPropertyFunc) - library.GetProcAddress("GetMethodProperty"); - if (getMethodProperty == NULL) - continue; - - UInt32 numMethods = 1; - GetNumberOfMethodsFunc getNumberOfMethodsFunc = (GetNumberOfMethodsFunc) - library.GetProcAddress("GetNumberOfMethods"); - if (getNumberOfMethodsFunc != NULL) - if (getNumberOfMethodsFunc(&numMethods) != S_OK) - continue; - - for(UInt32 i = 0; i < numMethods; i++) - { - CMethodInfo2 info; - info.FilePath = filePath; - - NWindows::NCOM::CPropVariant propVariant; - if (getMethodProperty(i, NMethodPropID::kID, &propVariant) != S_OK) - continue; - if (propVariant.vt != VT_BSTR) - continue; - info.MethodID.IDSize = (Byte)SysStringByteLen(propVariant.bstrVal); - memmove(info.MethodID.ID, propVariant.bstrVal, info.MethodID.IDSize); - propVariant.Clear(); - - if (getMethodProperty(i, NMethodPropID::kName, &propVariant) != S_OK) - continue; - if (propVariant.vt == VT_EMPTY) - { - } - else if (propVariant.vt == VT_BSTR) - info.Name = propVariant.bstrVal; - else - continue; - propVariant.Clear(); - - if (getMethodProperty (i, NMethodPropID::kEncoder, &propVariant) != S_OK) - continue; - if (propVariant.vt == VT_EMPTY) - info.EncoderIsAssigned = false; - else if (propVariant.vt == VT_BSTR) - { - info.EncoderIsAssigned = true; - info.Encoder = *(const GUID *)propVariant.bstrVal; - } - else - continue; - propVariant.Clear(); - - if (getMethodProperty (i, NMethodPropID::kDecoder, &propVariant) != S_OK) - continue; - if (propVariant.vt == VT_EMPTY) - info.DecoderIsAssigned = false; - else if (propVariant.vt == VT_BSTR) - { - info.DecoderIsAssigned = true; - info.Decoder = *(const GUID *)propVariant.bstrVal; - } - else - continue; - propVariant.Clear(); - - if (getMethodProperty (i, NMethodPropID::kInStreams, &propVariant) != S_OK) - continue; - if (propVariant.vt == VT_EMPTY) - info.NumInStreams = 1; - else if (propVariant.vt == VT_UI4) - info.NumInStreams = propVariant.ulVal; - else - continue; - propVariant.Clear(); - - if (getMethodProperty (i, NMethodPropID::kOutStreams, &propVariant) != S_OK) - continue; - if (propVariant.vt == VT_EMPTY) - info.NumOutStreams = 1; - else if (propVariant.vt == VT_UI4) - info.NumOutStreams = propVariant.ulVal; - else - continue; - propVariant.Clear(); - - g_Methods.Add(info); - } - } -} - -static NSynchronization::CCriticalSection g_CriticalSection; - -void LoadMethodMap() -{ - NSynchronization::CCriticalSectionLock lock(g_CriticalSection); - if (g_Loaded) - return; - g_Loaded = true; - Load(GetCodecsFolderPrefix()); -} - -bool GetMethodInfo(const CMethodID &methodID, CMethodInfo &methodInfo) -{ - for(int i = 0; i < g_Methods.Size(); i++) - { - const CMethodInfo2 &method = g_Methods[i]; - if (method.MethodID == methodID) - { - methodInfo = (CMethodInfo)method; - return true; - } - } - return false; -} - -bool GetMethodInfo(const UString &name, CMethodInfo2 &methodInfo) -{ - for(int i = 0; i < g_Methods.Size(); i++) - { - const CMethodInfo2 &method = g_Methods[i]; - if (method.Name.CompareNoCase(name) == 0) - { - methodInfo = method; - return true; - } - } - return false; -} - -}} - - diff --git a/CPP/7zip/Archive/7z/7zMethods.h b/CPP/7zip/Archive/7z/7zMethods.h deleted file mode 100755 index 231f3183..00000000 --- a/CPP/7zip/Archive/7z/7zMethods.h +++ /dev/null @@ -1,36 +0,0 @@ -// 7zMethods.h - -#ifndef __7Z_METHODS_H -#define __7Z_METHODS_H - -#include "7zMethodID.h" - -namespace NArchive { -namespace N7z { - -struct CMethodInfo -{ - UString Name; - bool EncoderIsAssigned; - bool DecoderIsAssigned; - UInt32 NumInStreams; - UInt32 NumOutStreams; - CLSID Encoder; - CLSID Decoder; - // UString Description; - CSysString FilePath; -}; - -struct CMethodInfo2: public CMethodInfo -{ - CMethodID MethodID; -}; - -void LoadMethodMap(); -bool GetMethodInfo(const CMethodID &methodID, CMethodInfo &methodInfo); -bool GetMethodInfo(const UString &name, CMethodInfo2 &methodInfo); - -}} - -#endif - diff --git a/CPP/7zip/Archive/7z/7zOut.cpp b/CPP/7zip/Archive/7z/7zOut.cpp index 5a81a0d5..2399f652 100755 --- a/CPP/7zip/Archive/7z/7zOut.cpp +++ b/CPP/7zip/Archive/7z/7zOut.cpp @@ -7,6 +7,11 @@ #include "7zOut.h" +extern "C" +{ +#include "../../../../C/7zCrc.h" +} + static HRESULT WriteBytes(ISequentialOutStream *stream, const void *data, size_t size) { while (size > 0) @@ -30,6 +35,20 @@ HRESULT COutArchive::WriteDirect(const void *data, UInt32 size) return ::WriteBytes(SeqStream, data, size); } +UInt32 CrcUpdateUInt32(UInt32 crc, UInt32 value) +{ + for (int i = 0; i < 4; i++, value >>= 8) + crc = CRC_UPDATE_BYTE(crc, (Byte)value); + return crc; +} + +UInt32 CrcUpdateUInt64(UInt32 crc, UInt64 value) +{ + for (int i = 0; i < 8; i++, value >>= 8) + crc = CRC_UPDATE_BYTE(crc, (Byte)value); + return crc; +} + HRESULT COutArchive::WriteDirectUInt32(UInt32 value) { for (int i = 0; i < 4; i++) @@ -71,11 +90,11 @@ HRESULT COutArchive::WriteFinishSignature() HRESULT COutArchive::WriteStartHeader(const CStartHeader &h) { - CCRC crc; - crc.UpdateUInt64(h.NextHeaderOffset); - crc.UpdateUInt64(h.NextHeaderSize); - crc.UpdateUInt32(h.NextHeaderCRC); - RINOK(WriteDirectUInt32(crc.GetDigest())); + UInt32 crc = CRC_INIT_VAL; + crc = CrcUpdateUInt64(crc, h.NextHeaderOffset); + crc = CrcUpdateUInt64(crc, h.NextHeaderSize); + crc = CrcUpdateUInt32(crc, h.NextHeaderCRC); + RINOK(WriteDirectUInt32(CRC_GET_DIGEST(crc))); RINOK(WriteDirectUInt64(h.NextHeaderOffset)); RINOK(WriteDirectUInt64(h.NextHeaderSize)); return WriteDirectUInt32(h.NextHeaderCRC); @@ -161,7 +180,7 @@ HRESULT COutArchive::WriteBytes(const void *data, size_t size) _dynamicBuffer.Write(data, size); else _outByte.WriteBytes(data, size); - _crc.Update(data, size); + _crc = CrcUpdate(_crc, data, size); } else { @@ -217,6 +236,7 @@ HRESULT COutArchive::WriteNumber(UInt64 value) return S_OK; } +#ifdef _7Z_VOL static UInt32 GetBigNumberSize(UInt64 value) { int i; @@ -226,7 +246,6 @@ static UInt32 GetBigNumberSize(UInt64 value) return 1 + i; } -#ifdef _7Z_VOL UInt32 COutArchive::GetVolHeadersSize(UInt64 dataSize, int nameLength, bool props) { UInt32 result = GetBigNumberSize(dataSize) * 2 + 41; @@ -268,19 +287,24 @@ HRESULT COutArchive::WriteFolder(const CFolder &folder) for (i = 0; i < folder.Coders.Size(); i++) { const CCoderInfo &coder = folder.Coders[i]; - for (int j = 0; j < coder.AltCoders.Size(); j++) { - const CAltCoderInfo &altCoder = coder.AltCoders[j]; - size_t propertiesSize = altCoder.Properties.GetCapacity(); + size_t propertiesSize = coder.Properties.GetCapacity(); + UInt64 id = coder.MethodID; + int idSize; + for (idSize = 1; idSize < sizeof(id); idSize++) + if ((id >> (8 * idSize)) == 0) + break; + BYTE longID[15]; + for (int t = idSize - 1; t >= 0 ; t--, id >>= 8) + longID[t] = (Byte)(id & 0xFF); Byte b; - b = (Byte)(altCoder.MethodID.IDSize & 0xF); + b = (Byte)(idSize & 0xF); bool isComplex = !coder.IsSimpleCoder(); b |= (isComplex ? 0x10 : 0); b |= ((propertiesSize != 0) ? 0x20 : 0 ); - b |= ((j == coder.AltCoders.Size() - 1) ? 0 : 0x80 ); RINOK(WriteByte(b)); - RINOK(WriteBytes(altCoder.MethodID.ID, altCoder.MethodID.IDSize)); + RINOK(WriteBytes(longID, idSize)); if (isComplex) { RINOK(WriteNumber(coder.NumInStreams)); @@ -289,7 +313,7 @@ HRESULT COutArchive::WriteFolder(const CFolder &folder) if (propertiesSize == 0) continue; RINOK(WriteNumber(propertiesSize)); - RINOK(WriteBytes(altCoder.Properties, propertiesSize)); + RINOK(WriteBytes(coder.Properties, propertiesSize)); } } for (i = 0; i < folder.BindPairs.Size(); i++) @@ -380,10 +404,7 @@ HRESULT COutArchive::WritePackInfo( return WriteByte(NID::kEnd); } -HRESULT COutArchive::WriteUnPackInfo( - bool externalFolders, - CNum externalFoldersStreamIndex, - const CObjectVector<CFolder> &folders) +HRESULT COutArchive::WriteUnPackInfo(const CObjectVector<CFolder> &folders) { if (folders.IsEmpty()) return S_OK; @@ -392,12 +413,6 @@ HRESULT COutArchive::WriteUnPackInfo( RINOK(WriteByte(NID::kFolder)); RINOK(WriteNumber(folders.Size())); - if (externalFolders) - { - RINOK(WriteByte(1)); - RINOK(WriteNumber(externalFoldersStreamIndex)); - } - else { RINOK(WriteByte(0)); for(int i = 0; i < folders.Size(); i++) @@ -484,8 +499,7 @@ HRESULT COutArchive::WriteSubStreamsInfo( } HRESULT COutArchive::WriteTime( - const CObjectVector<CFileItem> &files, Byte type, - bool isExternal, CNum externalDataIndex) + const CObjectVector<CFileItem> &files, Byte type) { ///////////////////////////////////////////////// // CreationTime @@ -520,9 +534,6 @@ HRESULT COutArchive::WriteTime( return S_OK; RINOK(WriteByte(type)); size_t dataSize = 1 + 1; - if (isExternal) - dataSize += GetBigNumberSize(externalDataIndex); - else dataSize += files.Size() * 8; if (allDefined) { @@ -535,12 +546,6 @@ HRESULT COutArchive::WriteTime( WriteByte(0); RINOK(WriteBoolVector(boolVector)); } - if (isExternal) - { - RINOK(WriteByte(1)); - RINOK(WriteNumber(externalDataIndex)); - return S_OK; - } RINOK(WriteByte(0)); for(i = 0; i < files.Size(); i++) { @@ -569,7 +574,9 @@ HRESULT COutArchive::WriteTime( return S_OK; } -HRESULT COutArchive::EncodeStream(CEncoder &encoder, const Byte *data, size_t dataSize, +HRESULT COutArchive::EncodeStream( + DECL_EXTERNAL_CODECS_LOC_VARS + CEncoder &encoder, const Byte *data, size_t dataSize, CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders) { CSequentialInStreamImp *streamSpec = new CSequentialInStreamImp; @@ -577,17 +584,23 @@ HRESULT COutArchive::EncodeStream(CEncoder &encoder, const Byte *data, size_t da streamSpec->Init(data, dataSize); CFolder folderItem; folderItem.UnPackCRCDefined = true; - folderItem.UnPackCRC = CCRC::CalculateDigest(data, dataSize); + folderItem.UnPackCRC = CrcCalc(data, dataSize); UInt64 dataSize64 = dataSize; - RINOK(encoder.Encode(stream, NULL, &dataSize64, folderItem, SeqStream, packSizes, NULL)); + RINOK(encoder.Encode( + EXTERNAL_CODECS_LOC_VARS + stream, NULL, &dataSize64, folderItem, SeqStream, packSizes, NULL)) folders.Add(folderItem); return S_OK; } -HRESULT COutArchive::EncodeStream(CEncoder &encoder, const CByteBuffer &data, +HRESULT COutArchive::EncodeStream( + DECL_EXTERNAL_CODECS_LOC_VARS + CEncoder &encoder, const CByteBuffer &data, CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders) { - return EncodeStream(encoder, data, data.GetCapacity(), packSizes, folders); + return EncodeStream( + EXTERNAL_CODECS_LOC_VARS + encoder, data, data.GetCapacity(), packSizes, folders); } static void WriteUInt32ToBuffer(Byte *data, UInt32 value) @@ -609,62 +622,13 @@ static void WriteUInt64ToBuffer(Byte *data, UInt64 value) } -HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, - const CCompressionMethodMode *options, +HRESULT COutArchive::WriteHeader( + const CArchiveDatabase &database, const CHeaderOptions &headerOptions, UInt64 &headerOffset) { - CObjectVector<CFolder> folders; - - bool compressHeaders = (options != NULL); - CMyAutoPtr<CEncoder> encoder; - if (compressHeaders) - { - // it's for gcc2.95.2 - CMyAutoPtr<CEncoder> tmp(new CEncoder(*options)); - encoder = tmp; - } - - CRecordVector<UInt64> packSizes; - - CNum dataIndex = 0; - - ////////////////////////// - // Folders - - CNum externalFoldersStreamIndex = 0; - bool externalFolders = (compressHeaders && database.Folders.Size() > 8); - if (externalFolders) - { - _mainMode = false; - _countMode = true; - _countSize = 0; - int i; - for(i = 0; i < database.Folders.Size(); i++) - { - RINOK(WriteFolder(database.Folders[i])); - } - - _countMode = false; - - CByteBuffer foldersData; - foldersData.SetCapacity(_countSize); - _outByte2.Init(foldersData, foldersData.GetCapacity()); - - for(i = 0; i < database.Folders.Size(); i++) - { - RINOK(WriteFolder(database.Folders[i])); - } - - { - externalFoldersStreamIndex = dataIndex++; - RINOK(EncodeStream(*encoder, foldersData, packSizes, folders)); - } - } - - int i; - + ///////////////////////////////// // Names @@ -679,8 +643,6 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, } CByteBuffer namesData; - CNum externalNamesStreamIndex = 0; - bool externalNames = (compressHeaders && database.Files.Size() > 8); if (numDefinedNames > 0) { namesData.SetCapacity((size_t)namesDataSize); @@ -697,12 +659,6 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, namesData[pos++] = 0; namesData[pos++] = 0; } - - if (externalNames) - { - externalNamesStreamIndex = dataIndex++; - RINOK(EncodeStream(*encoder, namesData, packSizes, folders)); - } } ///////////////////////////////// @@ -719,8 +675,6 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, } CByteBuffer attributesData; - CNum externalAttributesStreamIndex = 0; - bool externalAttributes = (compressHeaders && numDefinedAttributes > 8); if (numDefinedAttributes > 0) { attributesData.SetCapacity(numDefinedAttributes * 4); @@ -734,11 +688,6 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, pos += 4; } } - if (externalAttributes) - { - externalAttributesStreamIndex = dataIndex++; - RINOK(EncodeStream(*encoder, attributesData, packSizes, folders)); - } } ///////////////////////////////// @@ -755,8 +704,6 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, } CByteBuffer startsData; - CNum externalStartStreamIndex = 0; - bool externalStarts = (compressHeaders && numDefinedStarts > 8); if (numDefinedStarts > 0) { startsData.SetCapacity(numDefinedStarts * 8); @@ -770,24 +717,16 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, pos += 8; } } - if (externalStarts) - { - externalStartStreamIndex = dataIndex++; - RINOK(EncodeStream(*encoder, startsData, packSizes, folders)); - } } ///////////////////////////////// // Write Last Write Time - CNum externalLastWriteTimeStreamIndex = 0; - bool externalLastWriteTime = false; // /* CNum numDefinedLastWriteTimes = 0; for(i = 0; i < database.Files.Size(); i++) if (database.Files[i].IsLastWriteTimeDefined) numDefinedLastWriteTimes++; - externalLastWriteTime = (compressHeaders && numDefinedLastWriteTimes > 64); if (numDefinedLastWriteTimes > 0) { CByteBuffer lastWriteTimeData; @@ -804,11 +743,6 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, pos += 4; } } - if (externalLastWriteTime) - { - externalLastWriteTimeStreamIndex = dataIndex++; - RINOK(EncodeStream(*encoder, lastWriteTimeData, packSizes, folders)); - } } // */ @@ -816,34 +750,20 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, UInt64 packedSize = 0; for(i = 0; i < database.PackSizes.Size(); i++) packedSize += database.PackSizes[i]; - UInt64 headerPackSize = 0; - for (i = 0; i < packSizes.Size(); i++) - headerPackSize += packSizes[i]; - headerOffset = packedSize + headerPackSize; + headerOffset = packedSize; _mainMode = true; _outByte.SetStream(SeqStream); _outByte.Init(); - _crc.Init(); + _crc = CRC_INIT_VAL; RINOK(WriteByte(NID::kHeader)); // Archive Properties - if (folders.Size() > 0) - { - RINOK(WriteByte(NID::kAdditionalStreamsInfo)); - RINOK(WritePackInfo(packedSize, packSizes, - CRecordVector<bool>(), CRecordVector<UInt32>())); - RINOK(WriteUnPackInfo(false, 0, folders)); - RINOK(WriteByte(NID::kEnd)); - } - - //////////////////////////////////////////////////// - if (database.Folders.Size() > 0) { RINOK(WriteByte(NID::kMainStreamsInfo)); @@ -851,7 +771,7 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, database.PackCRCsDefined, database.PackCRCs)); - RINOK(WriteUnPackInfo(externalFolders, externalFoldersStreamIndex, database.Folders)); + RINOK(WriteUnPackInfo(database.Folders)); CRecordVector<UInt64> unPackSizes; CRecordVector<bool> digestsDefined; @@ -938,13 +858,6 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, { ///////////////////////////////////////////////// RINOK(WriteByte(NID::kName)); - if (externalNames) - { - RINOK(WriteNumber(1 + GetBigNumberSize(externalNamesStreamIndex))); - RINOK(WriteByte(1)); - RINOK(WriteNumber(externalNamesStreamIndex)); - } - else { RINOK(WriteNumber(1 + namesData.GetCapacity())); RINOK(WriteByte(0)); @@ -955,17 +868,15 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, if (headerOptions.WriteCreated) { - RINOK(WriteTime(database.Files, NID::kCreationTime, false, 0)); + RINOK(WriteTime(database.Files, NID::kCreationTime)); } if (headerOptions.WriteModified) { - RINOK(WriteTime(database.Files, NID::kLastWriteTime, - // false, 0)); - externalLastWriteTime, externalLastWriteTimeStreamIndex)); + RINOK(WriteTime(database.Files, NID::kLastWriteTime)); } if (headerOptions.WriteAccessed) { - RINOK(WriteTime(database.Files, NID::kLastAccessTime, false, 0)); + RINOK(WriteTime(database.Files, NID::kLastAccessTime)); } if (numDefinedAttributes > 0) @@ -974,9 +885,6 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, size_t size = 2; if (numDefinedAttributes != database.Files.Size()) size += (attributesBoolVector.Size() + 7) / 8 + 1; - if (externalAttributes) - size += GetBigNumberSize(externalAttributesStreamIndex); - else size += attributesData.GetCapacity(); RINOK(WriteNumber(size)); @@ -990,12 +898,6 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, RINOK(WriteBoolVector(attributesBoolVector)); } - if (externalAttributes) - { - RINOK(WriteByte(1)); - RINOK(WriteNumber(externalAttributesStreamIndex)); - } - else { RINOK(WriteByte(0)); RINOK(WriteBytes(attributesData)); @@ -1008,9 +910,6 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, size_t size = 2; if (numDefinedStarts != database.Files.Size()) size += (startsBoolVector.Size() + 7) / 8 + 1; - if (externalStarts) - size += GetBigNumberSize(externalStartStreamIndex); - else size += startsData.GetCapacity(); RINOK(WriteNumber(size)); @@ -1024,12 +923,6 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, RINOK(WriteBoolVector(startsBoolVector)); } - if (externalAttributes) - { - RINOK(WriteByte(1)); - RINOK(WriteNumber(externalStartStreamIndex)); - } - else { RINOK(WriteByte(0)); RINOK(WriteBytes(startsData)); @@ -1042,7 +935,9 @@ HRESULT COutArchive::WriteHeader(const CArchiveDatabase &database, return _outByte.Flush(); } -HRESULT COutArchive::WriteDatabase(const CArchiveDatabase &database, +HRESULT COutArchive::WriteDatabase( + DECL_EXTERNAL_CODECS_LOC_VARS + const CArchiveDatabase &database, const CCompressionMethodMode *options, const CHeaderOptions &headerOptions) { @@ -1053,7 +948,7 @@ HRESULT COutArchive::WriteDatabase(const CArchiveDatabase &database, { headerSize = 0; headerOffset = 0; - headerCRC = CCRC::CalculateDigest(0, 0); + headerCRC = CrcCalc(0, 0); } else { @@ -1063,17 +958,10 @@ HRESULT COutArchive::WriteDatabase(const CArchiveDatabase &database, if (options != 0) if (options->IsEmpty()) options = 0; - const CCompressionMethodMode *additionalStreamsOptions = options; - if (!headerOptions.UseAdditionalHeaderStreams) - additionalStreamsOptions = 0; - /* - if (database.Files.Size() < 2) - compressMainHeader = false; - */ if (options != 0) if (options->PasswordIsDefined || headerOptions.CompressMainHeader) _dynamicMode = true; - RINOK(WriteHeader(database, additionalStreamsOptions, headerOptions, headerOffset)); + RINOK(WriteHeader(database, headerOptions, headerOffset)); if (_dynamicMode) { @@ -1083,14 +971,16 @@ HRESULT COutArchive::WriteDatabase(const CArchiveDatabase &database, CEncoder encoder(headerOptions.CompressMainHeader ? *options : encryptOptions); CRecordVector<UInt64> packSizes; CObjectVector<CFolder> folders; - RINOK(EncodeStream(encoder, _dynamicBuffer, + RINOK(EncodeStream( + EXTERNAL_CODECS_LOC_VARS + encoder, _dynamicBuffer, _dynamicBuffer.GetSize(), packSizes, folders)); _dynamicMode = false; _mainMode = true; _outByte.SetStream(SeqStream); _outByte.Init(); - _crc.Init(); + _crc = CRC_INIT_VAL; if (folders.Size() == 0) throw 1; @@ -1098,13 +988,13 @@ HRESULT COutArchive::WriteDatabase(const CArchiveDatabase &database, RINOK(WriteID(NID::kEncodedHeader)); RINOK(WritePackInfo(headerOffset, packSizes, CRecordVector<bool>(), CRecordVector<UInt32>())); - RINOK(WriteUnPackInfo(false, 0, folders)); + RINOK(WriteUnPackInfo(folders)); RINOK(WriteByte(NID::kEnd)); for (int i = 0; i < packSizes.Size(); i++) headerOffset += packSizes[i]; RINOK(_outByte.Flush()); } - headerCRC = _crc.GetDigest(); + headerCRC = CRC_GET_DIGEST(_crc); headerSize = _outByte.GetProcessedSize(); } #ifdef _7Z_VOL diff --git a/CPP/7zip/Archive/7z/7zOut.h b/CPP/7zip/Archive/7z/7zOut.h index cccc813a..fd798184 100755 --- a/CPP/7zip/Archive/7z/7zOut.h +++ b/CPP/7zip/Archive/7z/7zOut.h @@ -10,7 +10,6 @@ #include "../../Common/OutBuffer.h" #include "../../../Common/DynamicBuffer.h" -#include "../../../Common/CRC.h" namespace NArchive { namespace N7z { @@ -62,14 +61,14 @@ public: struct CHeaderOptions { - bool UseAdditionalHeaderStreams; + // bool UseAdditionalHeaderStreams; bool CompressMainHeader; bool WriteModified; bool WriteCreated; bool WriteAccessed; CHeaderOptions(): - UseAdditionalHeaderStreams(false), + // UseAdditionalHeaderStreams(false), CompressMainHeader(true), WriteModified(true), WriteCreated(false), @@ -105,10 +104,7 @@ class COutArchive const CRecordVector<bool> &packCRCsDefined, const CRecordVector<UInt32> &packCRCs); - HRESULT WriteUnPackInfo( - bool externalFolders, - CNum externalFoldersStreamIndex, - const CObjectVector<CFolder> &folders); + HRESULT WriteUnPackInfo(const CObjectVector<CFolder> &folders); HRESULT WriteSubStreamsInfo( const CObjectVector<CFolder> &folders, @@ -133,15 +129,18 @@ class COutArchive */ - HRESULT WriteTime(const CObjectVector<CFileItem> &files, Byte type, - bool isExternal, CNum externalDataIndex); + HRESULT WriteTime(const CObjectVector<CFileItem> &files, Byte type); - HRESULT EncodeStream(CEncoder &encoder, const Byte *data, size_t dataSize, + HRESULT EncodeStream( + DECL_EXTERNAL_CODECS_LOC_VARS + CEncoder &encoder, const Byte *data, size_t dataSize, CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders); - HRESULT EncodeStream(CEncoder &encoder, const CByteBuffer &data, + HRESULT EncodeStream( + DECL_EXTERNAL_CODECS_LOC_VARS + CEncoder &encoder, const CByteBuffer &data, CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders); - HRESULT WriteHeader(const CArchiveDatabase &database, - const CCompressionMethodMode *options, + HRESULT WriteHeader( + const CArchiveDatabase &database, const CHeaderOptions &headerOptions, UInt64 &headerOffset); @@ -154,7 +153,7 @@ class COutArchive COutBuffer _outByte; CWriteBufferLoc _outByte2; CWriteDynamicBuffer _dynamicBuffer; - CCRC _crc; + UInt32 _crc; #ifdef _7Z_VOL bool _endMarker; @@ -176,7 +175,9 @@ public: HRESULT Create(ISequentialOutStream *stream, bool endMarker); void Close(); HRESULT SkeepPrefixArchiveHeader(); - HRESULT WriteDatabase(const CArchiveDatabase &database, + HRESULT WriteDatabase( + DECL_EXTERNAL_CODECS_LOC_VARS + const CArchiveDatabase &database, const CCompressionMethodMode *options, const CHeaderOptions &headerOptions); diff --git a/CPP/7zip/Archive/7z/7zRegister.cpp b/CPP/7zip/Archive/7z/7zRegister.cpp new file mode 100755 index 00000000..e18c4d74 --- /dev/null +++ b/CPP/7zip/Archive/7z/7zRegister.cpp @@ -0,0 +1,18 @@ +// 7zRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "7zHandler.h" +static IInArchive *CreateArc() { return new NArchive::N7z::CHandler; } +#ifndef EXTRACT_ONLY +static IOutArchive *CreateArcOut() { return new NArchive::N7z::CHandler; } +#else +#define CreateArcOut 0 +#endif + +static CArcInfo g_ArcInfo = + { L"7z", L"7z", 0, 7, {'7' + 1 , 'z', 0xBC, 0xAF, 0x27, 0x1C}, 6, false, CreateArc, CreateArcOut }; + +REGISTER_ARC_DEC_SIG(7z) diff --git a/CPP/7zip/Archive/7z/7zUpdate.cpp b/CPP/7zip/Archive/7z/7zUpdate.cpp index b3d5009a..30b97632 100755 --- a/CPP/7zip/Archive/7z/7zUpdate.cpp +++ b/CPP/7zip/Archive/7z/7zUpdate.cpp @@ -8,10 +8,6 @@ #include "7zHandler.h" #include "7zOut.h" -#ifndef EXCLUDE_COM -#include "7zMethods.h" -#endif - #include "../../Compress/Copy/CopyCoder.h" #include "../../Common/ProgressUtils.h" #include "../../Common/LimitedStreams.h" @@ -108,13 +104,6 @@ struct CFolderRef #define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; } -static int CompareMethodIDs(const CMethodID &a1, const CMethodID &a2) -{ - for (int i = 0; i < a1.IDSize && i < a2.IDSize; i++) - RINOZ(MyCompare(a1.ID[i], a2.ID[i])); - return MyCompare(a1.IDSize, a2.IDSize); -} - static int CompareBuffers(const CByteBuffer &a1, const CByteBuffer &a2) { size_t c1 = a1.GetCapacity(); @@ -125,22 +114,12 @@ static int CompareBuffers(const CByteBuffer &a1, const CByteBuffer &a2) return 0; } -static int CompareAltCoders(const CAltCoderInfo &a1, const CAltCoderInfo &a2) -{ - RINOZ(CompareMethodIDs(a1.MethodID, a2.MethodID)); - return CompareBuffers(a1.Properties, a2.Properties); -} - static int CompareCoders(const CCoderInfo &c1, const CCoderInfo &c2) { RINOZ(MyCompare(c1.NumInStreams, c2.NumInStreams)); RINOZ(MyCompare(c1.NumOutStreams, c2.NumOutStreams)); - int s1 = c1.AltCoders.Size(); - int s2 = c2.AltCoders.Size(); - RINOZ(MyCompare(s1, s2)); - for (int i = 0; i < s1; i++) - RINOZ(CompareAltCoders(c1.AltCoders[i], c2.AltCoders[i])); - return 0; + RINOZ(MyCompare(c1.MethodID, c2.MethodID)); + return CompareBuffers(c1.Properties, c2.Properties); } static int CompareBindPairs(const CBindPair &b1, const CBindPair &b2) @@ -371,28 +350,17 @@ static bool IsExeFile(const UString &ext) return false; } -static CMethodID k_BCJ_X86 = { { 0x3, 0x3, 0x1, 0x3 }, 4 }; -static CMethodID k_BCJ2 = { { 0x3, 0x3, 0x1, 0x1B }, 4 }; -static CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; +static const UInt64 k_Copy = 0x0; +static const UInt64 k_LZMA = 0x030101; +static const UInt64 k_BCJ = 0x03030103; +static const UInt64 k_BCJ2 = 0x0303011B; -static bool GetMethodFull(const CMethodID &methodID, +static bool GetMethodFull(UInt64 methodID, UInt32 numInStreams, CMethodFull &methodResult) { methodResult.MethodID = methodID; methodResult.NumInStreams = numInStreams; methodResult.NumOutStreams = 1; - - #ifndef EXCLUDE_COM - CMethodInfo methodInfo; - if (!GetMethodInfo(methodID, methodInfo)) - return false; - if (!methodInfo.EncoderIsAssigned) - return false; - methodResult.EncoderClassID = methodInfo.Encoder; - methodResult.FilePath = methodInfo.FilePath; - if (methodInfo.NumOutStreams != 1 || methodInfo.NumInStreams != numInStreams) - return false; - #endif return true; } @@ -455,7 +423,7 @@ static bool MakeExeMethod(const CCompressionMethodMode &method, else { CMethodFull methodFull; - if (!GetMethodFull(k_BCJ_X86, 1, methodFull)) + if (!GetMethodFull(k_BCJ, 1, methodFull)) return false; exeMethod.Methods.Insert(0, methodFull); CBind bind; @@ -537,6 +505,7 @@ static void FromUpdateItemToFileItem(const CUpdateItem &updateItem, } static HRESULT Update2( + DECL_EXTERNAL_CODECS_LOC_VARS IInStream *inStream, const CArchiveDatabaseEx *database, const CObjectVector<CUpdateItem> &updateItems, @@ -775,8 +744,11 @@ static HRESULT Update2( CMyComPtr<ICompressProgressInfo> compressProgress = localCompressProgressSpec; localCompressProgressSpec->Init(localProgress, &complexity, NULL); - RINOK(encoder.Encode(solidInStream, NULL, &inSizeForReduce, folderItem, - archive.SeqStream, newDatabase.PackSizes, compressProgress)); + RINOK(encoder.Encode( + EXTERNAL_CODECS_LOC_VARS + solidInStream, NULL, &inSizeForReduce, folderItem, + archive.SeqStream, newDatabase.PackSizes, compressProgress)); + // for() // newDatabase.PackCRCsDefined.Add(false); // newDatabase.PackCRCs.Add(0); @@ -865,19 +837,17 @@ static HRESULT Update2( return E_FAIL; */ - return archive.WriteDatabase(newDatabase, options.HeaderMethod, options.HeaderOptions); + return archive.WriteDatabase(EXTERNAL_CODECS_LOC_VARS + newDatabase, options.HeaderMethod, options.HeaderOptions); } #ifdef _7Z_VOL static HRESULT WriteVolumeHeader(COutArchive &archive, CFileItem &file, const CUpdateOptions &options) { - CAltCoderInfo altCoder; - altCoder.MethodID.IDSize = 1; - altCoder.MethodID.ID[0] = 0; CCoderInfo coder; coder.NumInStreams = coder.NumOutStreams = 1; - coder.AltCoders.Add(altCoder); + coder.MethodID = k_Copy; CFolder folder; folder.Coders.Add(coder); @@ -1066,6 +1036,7 @@ STDMETHODIMP COutVolumeStream::Write(const void *data, UInt32 size, UInt32 *proc #endif HRESULT Update( + DECL_EXTERNAL_CODECS_LOC_VARS IInStream *inStream, const CArchiveDatabaseEx *database, const CObjectVector<CUpdateItem> &updateItems, @@ -1076,7 +1047,9 @@ HRESULT Update( #ifdef _7Z_VOL if (seqOutStream) #endif - return Update2(inStream, database, updateItems, + return Update2( + EXTERNAL_CODECS_LOC_VARS + inStream, database, updateItems, seqOutStream, updateCallback, options); #ifdef _7Z_VOL if (options.VolumeMode) diff --git a/CPP/7zip/Archive/7z/7zUpdate.h b/CPP/7zip/Archive/7z/7zUpdate.h index 385bd942..e19d7a2d 100755 --- a/CPP/7zip/Archive/7z/7zUpdate.h +++ b/CPP/7zip/Archive/7z/7zUpdate.h @@ -68,6 +68,7 @@ struct CUpdateOptions }; HRESULT Update( + DECL_EXTERNAL_CODECS_LOC_VARS IInStream *inStream, const CArchiveDatabaseEx *database, const CObjectVector<CUpdateItem> &updateItems, diff --git a/CPP/7zip/Archive/7z/DllExports.cpp b/CPP/7zip/Archive/7z/DllExports.cpp deleted file mode 100755 index 2d70d4de..00000000 --- a/CPP/7zip/Archive/7z/DllExports.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "../../../Common/MyInitGuid.h" -#include "../../../Common/ComTry.h" -#ifdef _WIN32 -#include "../../../Common/Alloc.h" -#endif - -#include "../../ICoder.h" - -#include "7zHandler.h" - -#ifndef EXCLUDE_COM -// {23170F69-40C1-278B-06F1-070100000100} -DEFINE_GUID(CLSID_CCrypto7zAESEncoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x07, 0x01, 0x00, 0x00, 0x01, 0x00); -#endif - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - #ifdef _WIN32 - SetLargePageSize(); - #endif - } - return TRUE; -} - - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != NArchive::N7z::CLSID_CFormat7z) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID == IID_IInArchive) - { - CMyComPtr<IInArchive> inArchive = new NArchive::N7z::CHandler; - *outObject = inArchive.Detach(); - } - #ifndef EXTRACT_ONLY - else if (*interfaceID == IID_IOutArchive) - { - CMyComPtr<IOutArchive> outArchive = new NArchive::N7z::CHandler; - *outObject = outArchive.Detach(); - } - #endif - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"7z"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&NArchive::N7z::CLSID_CFormat7z, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"7z"; - break; - case NArchive::kUpdate: - propVariant = true; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)NArchive::N7z::kSignature, - NArchive::N7z::kSignatureSize)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/7z/makefile b/CPP/7zip/Archive/7z/makefile index 06bf2f37..03ef4e46 100755 --- a/CPP/7zip/Archive/7z/makefile +++ b/CPP/7zip/Archive/7z/makefile @@ -1,8 +1,15 @@ PROG = 7z.dll DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MT +CFLAGS = $(CFLAGS) -I ../../../ \ + -DCOMPRESS_MT \ + -DEXTERNAL_CODECS \ + LIBS = $(LIBS) oleaut32.lib user32.lib +AR_OBJS = \ + $O\ArchiveExports.obj \ + $O\DllExports.obj \ + 7Z_OBJS = \ $O\7zCompressionMode.obj \ $O\7zDecode.obj \ @@ -14,16 +21,13 @@ LIBS = $(LIBS) oleaut32.lib user32.lib $O\7zHandlerOut.obj \ $O\7zHeader.obj \ $O\7zIn.obj \ - $O\7zMethodID.obj \ - $O\7zMethods.obj \ $O\7zOut.obj \ $O\7zProperties.obj \ $O\7zSpecStream.obj \ $O\7zUpdate.obj \ - $O\DllExports.obj \ + $O\7zRegister.obj \ COMMON_OBJS = \ - $O\Alloc.obj \ $O\CRC.obj \ $O\IntToString.obj \ $O\NewHandler.obj \ @@ -41,9 +45,12 @@ WIN_OBJS = \ $O\Synchronization.obj 7ZIP_COMMON_OBJS = \ + $O\CreateCoder.obj \ $O\InOutTempBuffer.obj \ + $O\FilterCoder.obj \ $O\LimitedStreams.obj \ $O\LockedStream.obj \ + $O\MethodId.obj \ $O\OutBuffer.obj \ $O\ProgressUtils.obj \ $O\StreamBinder.obj \ @@ -51,30 +58,37 @@ WIN_OBJS = \ $O\StreamUtils.obj \ AR_COMMON_OBJS = \ - $O\CodecsPath.obj \ - $O\CoderLoader.obj \ $O\CoderMixer2.obj \ $O\CoderMixer2MT.obj \ $O\CrossThreadProgress.obj \ - $O\FilterCoder.obj \ $O\InStreamWithCRC.obj \ $O\ItemNameUtils.obj \ $O\MultiStream.obj \ $O\OutStreamWithCRC.obj \ $O\ParseProperties.obj \ +C_OBJS = \ + $O\Alloc.obj \ + +!include "../../Crc2.mak" + OBJS = \ $O\StdAfx.obj \ + $(AR_OBJS) \ $(7Z_OBJS) \ $(COMMON_OBJS) \ $(WIN_OBJS) \ $(7ZIP_COMMON_OBJS) \ $(AR_COMMON_OBJS) \ $O\CopyCoder.obj \ + $(C_OBJS) \ + $(CRC_OBJS) \ $O\resource.res !include "../../../Build.mak" +$(AR_OBJS): ../$(*B).cpp + $(COMPL) $(7Z_OBJS): $(*B).cpp $(COMPL) $(COMMON_OBJS): ../../../Common/$(*B).cpp @@ -87,3 +101,6 @@ $(AR_COMMON_OBJS): ../Common/$(*B).cpp $(COMPL) $O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp $(COMPL) +$(C_OBJS): ../../../../C/$(*B).c + $(COMPL_O2) +!include "../../Crc.mak" diff --git a/CPP/7zip/Archive/Archive.def b/CPP/7zip/Archive/Archive.def index befc7d83..55b530b2 100755 --- a/CPP/7zip/Archive/Archive.def +++ b/CPP/7zip/Archive/Archive.def @@ -1,3 +1,6 @@ EXPORTS CreateObject PRIVATE GetHandlerProperty PRIVATE + GetNumberOfFormats PRIVATE + GetHandlerProperty2 PRIVATE + CreateObject PRIVATE diff --git a/CPP/7zip/Archive/Archive2.def b/CPP/7zip/Archive/Archive2.def new file mode 100755 index 00000000..78ec1dd7 --- /dev/null +++ b/CPP/7zip/Archive/Archive2.def @@ -0,0 +1,8 @@ +EXPORTS + CreateObject PRIVATE + GetHandlerProperty PRIVATE + GetNumberOfFormats PRIVATE + GetHandlerProperty2 PRIVATE + CreateObject PRIVATE + GetNumberOfMethods PRIVATE + GetMethodProperty PRIVATE diff --git a/CPP/7zip/Archive/ArchiveExports.cpp b/CPP/7zip/Archive/ArchiveExports.cpp new file mode 100755 index 00000000..294b14d1 --- /dev/null +++ b/CPP/7zip/Archive/ArchiveExports.cpp @@ -0,0 +1,130 @@ +// ArchiveExports.cpp + +#include "StdAfx.h" + +#include "../../Common/ComTry.h" +#include "../../Common/Types.h" +#include "../../Windows/PropVariant.h" +#include "../Common/RegisterArc.h" + +#include "IArchive.h" +#include "../ICoder.h" +#include "../IPassword.h" + +static const unsigned int kNumArcsMax = 32; +static unsigned int g_NumArcs = 0; +static const CArcInfo *g_Arcs[kNumArcsMax]; +void RegisterArc(const CArcInfo *arcInfo) +{ + if (g_NumArcs < kNumArcsMax) + g_Arcs[g_NumArcs++] = arcInfo; +} + +DEFINE_GUID(CLSID_CArchiveHandler, +0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00); + +#define CLS_ARC_ID_ITEM(cls) ((cls).Data4[5]) + +static inline HRESULT SetPropString(const char *s, unsigned int size, PROPVARIANT *value) +{ + if ((value->bstrVal = ::SysAllocStringByteLen(s, size)) != 0) + value->vt = VT_BSTR; + return S_OK; +} + +static inline HRESULT SetPropGUID(const GUID &guid, PROPVARIANT *value) +{ + return SetPropString((const char *)&guid, sizeof(GUID), value); +} + +int FindFormatCalssId(const GUID *clsID) +{ + GUID cls = *clsID; + CLS_ARC_ID_ITEM(cls) = 0; + if (cls != CLSID_CArchiveHandler) + return -1; + Byte id = CLS_ARC_ID_ITEM(*clsID); + for (UInt32 i = 0; i < g_NumArcs; i++) + if (g_Arcs[i]->ClassId == id) + return i; + return -1; +} + +STDAPI CreateArchiver(const GUID *clsid, const GUID *iid, void **outObject) +{ + COM_TRY_BEGIN + { + int needIn = (*iid == IID_IInArchive); + int needOut = (*iid == IID_IOutArchive); + if (!needIn && !needOut) + return E_NOINTERFACE; + int formatIndex = FindFormatCalssId(clsid); + if (formatIndex < 0) + return CLASS_E_CLASSNOTAVAILABLE; + + const CArcInfo &arc = *g_Arcs[formatIndex]; + if (needIn) + { + *outObject = arc.CreateInArchive(); + ((IInArchive *)*outObject)->AddRef(); + } + else + { + if (!arc.CreateOutArchive) + return CLASS_E_CLASSNOTAVAILABLE; + *outObject = arc.CreateOutArchive(); + ((IOutArchive *)*outObject)->AddRef(); + } + } + COM_TRY_END + return S_OK; +} + +STDAPI GetHandlerProperty2(UInt32 formatIndex, PROPID propID, PROPVARIANT *value) +{ + if (formatIndex >= g_NumArcs) + return E_INVALIDARG; + const CArcInfo &arc = *g_Arcs[formatIndex]; + NWindows::NCOM::CPropVariant propVariant; + switch(propID) + { + case NArchive::kName: + propVariant = arc.Name; + break; + case NArchive::kClassID: + { + GUID clsId = CLSID_CArchiveHandler; + CLS_ARC_ID_ITEM(clsId) = arc.ClassId; + return SetPropGUID(clsId, value); + } + case NArchive::kExtension: + if (arc.Ext != 0) + propVariant = arc.Ext; + break; + case NArchive::kAddExtension: + if (arc.AddExt != 0) + propVariant = arc.AddExt; + break; + case NArchive::kUpdate: + propVariant = (bool)(arc.CreateOutArchive != 0); + break; + case NArchive::kKeepName: + propVariant = arc.KeepName; + break; + case NArchive::kStartSignature: + return SetPropString((const char *)arc.Signature, arc.SignatureSize, value); + } + propVariant.Detach(value); + return S_OK; +} + +STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) +{ + return GetHandlerProperty2(0, propID, value); +} + +STDAPI GetNumberOfFormats(UINT32 *numFormats) +{ + *numFormats = g_NumArcs; + return S_OK; +} diff --git a/CPP/7zip/Archive/Arj/Arj.dsp b/CPP/7zip/Archive/Arj/Arj.dsp deleted file mode 100755 index 3bc6fa91..00000000 --- a/CPP/7zip/Archive/Arj/Arj.dsp +++ /dev/null @@ -1,329 +0,0 @@ -# Microsoft Developer Studio Project File - Name="arj" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=arj - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "arj.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "arj.mak" CFG="arj - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "arj - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "arj - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "arj - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\arj.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "arj - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\arj.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "arj - Win32 Release" -# Name "arj - Win32 Debug" -# Begin Group "spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ArjHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\ArjHandler.h -# End Source File -# Begin Source File - -SOURCE=.\ArjHeader.h -# End Source File -# Begin Source File - -SOURCE=.\ArjIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\ArjIn.h -# End Source File -# Begin Source File - -SOURCE=.\ArjItem.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "Codecs" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Arj\ArjDecoder1.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Arj\ArjDecoder1.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Arj\ArjDecoder2.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Arj\ArjDecoder2.h -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# End Group -# Begin Group "7zip common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\arj.ico -# End Source File -# End Target -# End Project diff --git a/CPP/7zip/Archive/Arj/Arj.dsw b/CPP/7zip/Archive/Arj/Arj.dsw deleted file mode 100755 index 7ce4bca5..00000000 --- a/CPP/7zip/Archive/Arj/Arj.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "arj"=.\arj.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Arj/ArjHandler.cpp b/CPP/7zip/Archive/Arj/ArjHandler.cpp index a61cc775..b5227e54 100755 --- a/CPP/7zip/Archive/Arj/ArjHandler.cpp +++ b/CPP/7zip/Archive/Arj/ArjHandler.cpp @@ -3,7 +3,6 @@ #include "StdAfx.h" #include "Common/Defs.h" -#include "Common/CRC.h" #include "Common/StringConvert.h" #include "Common/ComTry.h" diff --git a/CPP/7zip/Archive/Arj/ArjIn.cpp b/CPP/7zip/Archive/Arj/ArjIn.cpp index 5d03ea65..146f4f09 100755 --- a/CPP/7zip/Archive/Arj/ArjIn.cpp +++ b/CPP/7zip/Archive/Arj/ArjIn.cpp @@ -4,12 +4,16 @@ #include "Common/StringConvert.h" #include "Common/Buffer.h" -#include "Common/CRC.h" #include "../../Common/StreamUtils.h" #include "ArjIn.h" +extern "C" +{ + #include "../../../../C/7zCrc.h" +} + namespace NArchive { namespace NArj { @@ -47,7 +51,7 @@ inline bool TestMarkerCandidate(const void *testBytes, UInt32 maxSize) if (blockSize == 0 || blockSize > 2600) return false; UInt32 crcFromFile = GetUInt32FromMemLE(block + blockSize); - return (CCRC::VerifyDigest(crcFromFile, block, blockSize)); + return (crcFromFile == CrcCalc(block, blockSize)); } bool CInArchive::FindAndReadMarker(const UInt64 *searchHeaderSizeLimit) @@ -168,7 +172,7 @@ bool CInArchive::ReadBlock() return false; SafeReadBytes(_block, _blockSize); UInt32 crcFromFile = SafeReadUInt32(); - if (!CCRC::VerifyDigest(crcFromFile, _block, _blockSize)) + if (crcFromFile != CrcCalc(_block, _blockSize)) throw CInArchiveException(CInArchiveException::kCRCError); return true; } diff --git a/CPP/7zip/Archive/Arj/ArjRegister.cpp b/CPP/7zip/Archive/Arj/ArjRegister.cpp new file mode 100755 index 00000000..8fb6c9ee --- /dev/null +++ b/CPP/7zip/Archive/Arj/ArjRegister.cpp @@ -0,0 +1,13 @@ +// ArjRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "ArjHandler.h" +static IInArchive *CreateArc() { return new NArchive::NArj::CHandler; } + +static CArcInfo g_ArcInfo = + { L"Arj", L"arj", 0, 4, { 0x60, 0xEA }, 2, false, CreateArc, 0 }; + +REGISTER_ARC(Arj) diff --git a/CPP/7zip/Archive/Arj/DllExports.cpp b/CPP/7zip/Archive/Arj/DllExports.cpp deleted file mode 100755 index d32ca2d6..00000000 --- a/CPP/7zip/Archive/Arj/DllExports.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "ArjHandler.h" - -// {23170F69-40C1-278A-1000-000110040000} -DEFINE_GUID(CLSID_CArjHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x04, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CArjHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr<IInArchive> inArchive = (IInArchive *)new NArchive::NArj::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Arj"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CArjHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"arj"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const unsigned char sig[] = { 0x60, 0xEA }; - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)sig, 2)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/Arj/makefile b/CPP/7zip/Archive/Arj/makefile deleted file mode 100755 index 2609998b..00000000 --- a/CPP/7zip/Archive/Arj/makefile +++ /dev/null @@ -1,66 +0,0 @@ -PROG = arj.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -ARJ_OBJS = \ - $O\DllExports.obj \ - $O\ArjHandler.obj \ - $O\ArjIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\LimitedStreams.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - $O\OutStreamWithCRC.obj \ - -COMPRESS_ARJ_OBJS = \ - $O\ArjDecoder1.obj \ - $O\ArjDecoder2.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(ARJ_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_ARJ_OBJS) \ - $O\CopyCoder.obj \ - $O\LZOutWindow.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(ARJ_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(COMPRESS_ARJ_OBJS): ../../Compress/Arj/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) -$O\LZOutWindow.obj: ../../Compress/LZ/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/Arj/resource.rc b/CPP/7zip/Archive/Arj/resource.rc deleted file mode 100755 index 5158e405..00000000 --- a/CPP/7zip/Archive/Arj/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Arj Plugin", "arj") - -101 ICON "arj.ico" diff --git a/CPP/7zip/Archive/BZip2/BZip2.dsp b/CPP/7zip/Archive/BZip2/BZip2.dsp deleted file mode 100755 index 1d14aedb..00000000 --- a/CPP/7zip/Archive/BZip2/BZip2.dsp +++ /dev/null @@ -1,281 +0,0 @@ -# Microsoft Developer Studio Project File - Name="BZip2" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=BZip2 - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "BZip2.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "BZip2.mak" CFG="BZip2 - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "BZip2 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "BZip2 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "BZip2 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\bz2.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "BZip2 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\bz2.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "BZip2 - Win32 Release" -# Name "BZip2 - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\BZip2.ico -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compression" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\CodecsPath.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CodecsPath.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.h -# End Source File -# Begin Source File - -SOURCE=..\Common\DummyOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\DummyOutStream.h -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\BZip2Handler.cpp -# End Source File -# Begin Source File - -SOURCE=.\BZip2Handler.h -# End Source File -# Begin Source File - -SOURCE=.\BZip2HandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\BZip2Item.h -# End Source File -# Begin Source File - -SOURCE=.\BZip2Update.cpp -# End Source File -# Begin Source File - -SOURCE=.\BZip2Update.h -# End Source File -# End Group -# Begin Group "7zip common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\bz2.ico -# End Source File -# End Target -# End Project diff --git a/CPP/7zip/Archive/BZip2/BZip2.dsw b/CPP/7zip/Archive/BZip2/BZip2.dsw deleted file mode 100755 index 697e5095..00000000 --- a/CPP/7zip/Archive/BZip2/BZip2.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "BZip2"=.\BZip2.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/BZip2/BZip2Handler.cpp b/CPP/7zip/Archive/BZip2/BZip2Handler.cpp index 169b2597..c60045fa 100755 --- a/CPP/7zip/Archive/BZip2/BZip2Handler.cpp +++ b/CPP/7zip/Archive/BZip2/BZip2Handler.cpp @@ -2,34 +2,25 @@ #include "StdAfx.h" -#include "BZip2Handler.h" - +#include "Common/ComTry.h" #include "Common/Defs.h" - -#include "../../Common/ProgressUtils.h" -#include "../../Common/StreamUtils.h" - #include "Windows/PropVariant.h" #include "Windows/Defs.h" -#include "Common/ComTry.h" +#include "../../Common/ProgressUtils.h" +#include "../../Common/StreamUtils.h" +#include "../../Common/CreateCoder.h" #include "../Common/DummyOutStream.h" -#ifdef COMPRESS_BZIP2 -#include "../../Compress/BZip2/BZip2Decoder.h" -#else -// {23170F69-40C1-278B-0402-020000000000} -DEFINE_GUID(CLSID_CCompressBZip2Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); -#include "../Common/CoderLoader.h" -extern CSysString GetBZip2CodecPath(); -#endif +#include "BZip2Handler.h" using namespace NWindows; namespace NArchive { namespace NBZip2 { +static const CMethodId kMethodId_BZip2 = 0x040202; + STATPROPSTG kProperties[] = { { NULL, kpidPath, VT_BSTR}, @@ -174,22 +165,15 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, extractCallback->PrepareOperation(askMode); - #ifndef COMPRESS_BZIP2 - CCoderLibrary lib; - #endif CMyComPtr<ICompressCoder> decoder; - #ifdef COMPRESS_BZIP2 - decoder = new NCompress::NBZip2::CDecoder; - #else - HRESULT loadResult = lib.LoadAndCreateCoder( - GetBZip2CodecPath(), - CLSID_CCompressBZip2Decoder, &decoder); - if (loadResult != S_OK) + HRESULT loadResult = CreateCoder( + EXTERNAL_CODECS_VARS + kMethodId_BZip2, decoder, false); + if (loadResult != S_OK || !decoder) { RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); return S_OK; } - #endif #ifdef COMPRESS_MT { @@ -284,4 +268,6 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, COM_TRY_END } +IMPL_ISetCompressCodecsInfo + }} diff --git a/CPP/7zip/Archive/BZip2/BZip2Handler.h b/CPP/7zip/Archive/BZip2/BZip2Handler.h index 7977334e..c7049d2f 100755 --- a/CPP/7zip/Archive/BZip2/BZip2Handler.h +++ b/CPP/7zip/Archive/BZip2/BZip2Handler.h @@ -5,6 +5,7 @@ #include "Common/MyCom.h" #include "../IArchive.h" +#include "../../Common/CreateCoder.h" #include "BZip2Item.h" #ifdef COMPRESS_MT @@ -18,6 +19,7 @@ class CHandler: public IInArchive, public IOutArchive, public ISetProperties, + PUBLIC_ISetCompressCodecsInfo public CMyUnknownImp { CMyComPtr<IInStream> _stream; @@ -30,6 +32,9 @@ class CHandler: #ifdef COMPRESS_MT UInt32 _numThreads; #endif + + DECL_EXTERNAL_CODECS_VARS + void InitMethodProperties() { _level = 5; @@ -41,11 +46,13 @@ class CHandler: } public: - MY_UNKNOWN_IMP3( - IInArchive, - IOutArchive, - ISetProperties - ) + MY_QUERYINTERFACE_BEGIN + MY_QUERYINTERFACE_ENTRY(IInArchive) + MY_QUERYINTERFACE_ENTRY(IOutArchive) + MY_QUERYINTERFACE_ENTRY(ISetProperties) + QUERY_ENTRY_ISetCompressCodecsInfo + MY_QUERYINTERFACE_END + MY_ADDREF_RELEASE STDMETHOD(Open)(IInStream *stream, const UInt64 *maxCheckStartPosition, @@ -75,6 +82,8 @@ public: // ISetProperties STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties); + DECL_ISetCompressCodecsInfo + CHandler() { InitMethodProperties(); } }; diff --git a/CPP/7zip/Archive/BZip2/BZip2HandlerOut.cpp b/CPP/7zip/Archive/BZip2/BZip2HandlerOut.cpp index b5fc72a9..38797c33 100755 --- a/CPP/7zip/Archive/BZip2/BZip2HandlerOut.cpp +++ b/CPP/7zip/Archive/BZip2/BZip2HandlerOut.cpp @@ -91,11 +91,13 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt (_level >= 7 ? kNumPassesX7 : kNumPassesX1)); - return UpdateArchive(size, outStream, 0, dicSize, numPasses, - #ifdef COMPRESS_MT - _numThreads, - #endif - updateCallback); + return UpdateArchive( + EXTERNAL_CODECS_VARS + size, outStream, 0, dicSize, numPasses, + #ifdef COMPRESS_MT + _numThreads, + #endif + updateCallback); } if (indexInArchive != 0) return E_INVALIDARG; diff --git a/CPP/7zip/Archive/BZip2/BZip2Update.cpp b/CPP/7zip/Archive/BZip2/BZip2Update.cpp index d9bdf963..d5eecc17 100755 --- a/CPP/7zip/Archive/BZip2/BZip2Update.cpp +++ b/CPP/7zip/Archive/BZip2/BZip2Update.cpp @@ -3,24 +3,19 @@ #include "StdAfx.h" #include "../../Common/ProgressUtils.h" +#include "../../Common/CreateCoder.h" #include "Windows/PropVariant.h" #include "BZip2Update.h" -#ifdef COMPRESS_BZIP2 -#include "../../Compress/BZip2/BZip2Encoder.h" -#else -// {23170F69-40C1-278B-0402-020000000100} -DEFINE_GUID(CLSID_CCompressBZip2Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00); -#include "../Common/CoderLoader.h" -extern CSysString GetBZip2CodecPath(); -#endif - namespace NArchive { namespace NBZip2 { -HRESULT UpdateArchive(UInt64 unpackSize, +static const CMethodId kMethodId_BZip2 = 0x040202; + +HRESULT UpdateArchive( + DECL_EXTERNAL_CODECS_LOC_VARS + UInt64 unpackSize, ISequentialOutStream *outStream, int indexInClient, UInt32 dictionary, @@ -42,17 +37,12 @@ HRESULT UpdateArchive(UInt64 unpackSize, CMyComPtr<ICompressProgressInfo> localProgress = localProgressSpec; localProgressSpec->Init(updateCallback, true); - #ifndef COMPRESS_BZIP2 - CCoderLibrary lib; - #endif CMyComPtr<ICompressCoder> encoder; - #ifdef COMPRESS_BZIP2 - encoder = new NCompress::NBZip2::CEncoder; - #else - RINOK(lib.LoadAndCreateCoder(GetBZip2CodecPath(), - CLSID_CCompressBZip2Encoder, &encoder)); - #endif - + RINOK(CreateCoder( + EXTERNAL_CODECS_LOC_VARS + kMethodId_BZip2, encoder, true)); + if (!encoder) + return E_NOTIMPL; CMyComPtr<ICompressSetCoderProperties> setCoderProperties; encoder.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties); if (setCoderProperties) diff --git a/CPP/7zip/Archive/BZip2/BZip2Update.h b/CPP/7zip/Archive/BZip2/BZip2Update.h index ce20e323..e54a7e16 100755 --- a/CPP/7zip/Archive/BZip2/BZip2Update.h +++ b/CPP/7zip/Archive/BZip2/BZip2Update.h @@ -4,11 +4,13 @@ #define __BZIP2_UPDATE_H #include "../IArchive.h" +#include "../../Common/CreateCoder.h" namespace NArchive { namespace NBZip2 { HRESULT UpdateArchive( + DECL_EXTERNAL_CODECS_LOC_VARS UInt64 unpackSize, ISequentialOutStream *outStream, int indexInClient, diff --git a/CPP/7zip/Archive/BZip2/DllExports.cpp b/CPP/7zip/Archive/BZip2/DllExports.cpp deleted file mode 100755 index 5a861318..00000000 --- a/CPP/7zip/Archive/BZip2/DllExports.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "BZip2Handler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278B-0402-020000000100} -DEFINE_GUID(CLSID_CCompressBZip2Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-0402-020000000000} -DEFINE_GUID(CLSID_CCompressBZip2Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278A-1000-000110020000} -DEFINE_GUID(CLSID_CBZip2Handler, -0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x02, 0x00, 0x00); - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -#ifndef COMPRESS_BZIP2 -#include "../Common/CodecsPath.h" -CSysString GetBZip2CodecPath() -{ - return GetCodecsFolderPrefix() + TEXT("BZip2.dll"); -} -#endif - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - } - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CBZip2Handler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - int needOut = *interfaceID == IID_IOutArchive; - if (needIn || needOut) - { - NArchive::NBZip2::CHandler *temp = new NArchive::NBZip2::CHandler; - if (needIn) - { - CMyComPtr<IInArchive> inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - else - { - CMyComPtr<IOutArchive> outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"BZip2"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CBZip2Handler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"bz2 bzip2 tbz2 tbz"; - break; - case NArchive::kAddExtension: - propVariant = L"* * .tar .tar"; - break; - case NArchive::kUpdate: - propVariant = true; - break; - case NArchive::kKeepName: - propVariant = true; - break; - case NArchive::kStartSignature: - { - const char sig[] = { 'B', 'Z', 'h' }; - if ((value->bstrVal = ::SysAllocStringByteLen(sig, 3)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/BZip2/bz2Register.cpp b/CPP/7zip/Archive/BZip2/bz2Register.cpp new file mode 100755 index 00000000..76d3d25b --- /dev/null +++ b/CPP/7zip/Archive/BZip2/bz2Register.cpp @@ -0,0 +1,18 @@ +// BZip2Register.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "BZip2Handler.h" +static IInArchive *CreateArc() { return new NArchive::NBZip2::CHandler; } +#ifndef EXTRACT_ONLY +static IOutArchive *CreateArcOut() { return new NArchive::NBZip2::CHandler; } +#else +#define CreateArcOut 0 +#endif + +static CArcInfo g_ArcInfo = + { L"BZip2", L"bz2 bzip2 tbz2 tbz", L"* * .tar .tar", 2, { 'B', 'Z', 'h' }, 3, true, CreateArc, CreateArcOut }; + +REGISTER_ARC(BZip2) diff --git a/CPP/7zip/Archive/BZip2/makefile b/CPP/7zip/Archive/BZip2/makefile deleted file mode 100755 index 20f20bdb..00000000 --- a/CPP/7zip/Archive/BZip2/makefile +++ /dev/null @@ -1,55 +0,0 @@ -PROG = bz2.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MT -LIBS = $(LIBS) oleaut32.lib user32.lib - -BZ2_OBJS = \ - $O\BZip2Handler.obj \ - $O\BZip2HandlerOut.obj \ - $O\BZip2Update.obj \ - $O\DllExports.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CodecsPath.obj \ - $O\DummyOutStream.obj \ - $O\ParseProperties.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(BZ2_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(BZ2_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/BZip2/resource.rc b/CPP/7zip/Archive/BZip2/resource.rc deleted file mode 100755 index 2d4f27e3..00000000 --- a/CPP/7zip/Archive/BZip2/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("BZip2 Plugin", "bz2") - -101 ICON "bz2.ico" diff --git a/CPP/7zip/Archive/Cab/Cab.dsp b/CPP/7zip/Archive/Cab/Cab.dsp deleted file mode 100755 index 565661f6..00000000 --- a/CPP/7zip/Archive/Cab/Cab.dsp +++ /dev/null @@ -1,395 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Cab" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Cab - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Cab.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Cab.mak" CFG="Cab - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Cab - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Cab - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Cab - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CAB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CAB_EXPORTS" /FAs /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\cab.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Cab - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CAB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CAB_EXPORTS" /FAcs /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\cab.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Cab - Win32 Release" -# Name "Cab - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\CabBlockInStream.cpp -# End Source File -# Begin Source File - -SOURCE=.\CabBlockInStream.h -# End Source File -# Begin Source File - -SOURCE=.\CabHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\CabHandler.h -# End Source File -# Begin Source File - -SOURCE=.\CabHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\CabHeader.h -# End Source File -# Begin Source File - -SOURCE=.\CabIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\CabIn.h -# End Source File -# Begin Source File - -SOURCE=.\CabItem.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "Lzx" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Lzx\Lzx.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\Lzx86Converter.cpp - -!IF "$(CFG)" == "Cab - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Cab - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\Lzx86Converter.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\LzxDecoder.cpp - -!IF "$(CFG)" == "Cab - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Cab - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\LzxDecoder.h -# End Source File -# End Group -# Begin Group "Deflate" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateConst.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateDecoder.cpp - -!IF "$(CFG)" == "Cab - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Cab - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Deflate\DeflateExtConst.h -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Quantum" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Quantum\QuantumDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Quantum\QuantumDecoder.h -# End Source File -# End Group -# Begin Group "Huffman" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Huffman\HuffmanDecoder.h -# End Source File -# End Group -# End Group -# Begin Source File - -SOURCE=.\cab.ico -# End Source File -# End Target -# End Project diff --git a/CPP/7zip/Archive/Cab/Cab.dsw b/CPP/7zip/Archive/Cab/Cab.dsw deleted file mode 100755 index 470cb1b3..00000000 --- a/CPP/7zip/Archive/Cab/Cab.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Cab"=.\Cab.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Cab/CabBlockInStream.cpp b/CPP/7zip/Archive/Cab/CabBlockInStream.cpp index b775c105..570ce058 100755 --- a/CPP/7zip/Archive/Cab/CabBlockInStream.cpp +++ b/CPP/7zip/Archive/Cab/CabBlockInStream.cpp @@ -2,7 +2,11 @@ #include "StdAfx.h" -#include "Common/Alloc.h" +extern "C" +{ +#include "../../../../C/Alloc.h" +} + #include "Common/Defs.h" #include "../../Common/StreamUtils.h" diff --git a/CPP/7zip/Archive/Cab/CabHandler.cpp b/CPP/7zip/Archive/Cab/CabHandler.cpp index cac79b11..f23484f7 100755 --- a/CPP/7zip/Archive/Cab/CabHandler.cpp +++ b/CPP/7zip/Archive/Cab/CabHandler.cpp @@ -4,7 +4,6 @@ #include "Common/StringConvert.h" #include "Common/Defs.h" -#include "Common/Alloc.h" #include "Common/UTFConvert.h" #include "Common/ComTry.h" #include "Common/IntToString.h" diff --git a/CPP/7zip/Archive/Cab/CabRegister.cpp b/CPP/7zip/Archive/Cab/CabRegister.cpp new file mode 100755 index 00000000..0ce8a87f --- /dev/null +++ b/CPP/7zip/Archive/Cab/CabRegister.cpp @@ -0,0 +1,13 @@ +// CabRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "CabHandler.h" +static IInArchive *CreateArc() { return new NArchive::NCab::CHandler; } + +static CArcInfo g_ArcInfo = + { L"Cab", L"cab", 0, 8, { 0x4D, 0x53, 0x43, 0x46 }, 4, false, CreateArc, 0 }; + +REGISTER_ARC(Cab) diff --git a/CPP/7zip/Archive/Cab/DllExports.cpp b/CPP/7zip/Archive/Cab/DllExports.cpp deleted file mode 100755 index fa17f10b..00000000 --- a/CPP/7zip/Archive/Cab/DllExports.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "CabHandler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278A-1000-000110080000} -DEFINE_GUID(CLSID_CCabHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x08, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CCabHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr<IInArchive> inArchive = (IInArchive *)new NArchive::NCab::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Cab"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCabHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"cab"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const char sig[] = { 0x4D, 0x53, 0x43, 0x46 }; - if ((value->bstrVal = ::SysAllocStringByteLen(sig, 4)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/Cab/makefile b/CPP/7zip/Archive/Cab/makefile deleted file mode 100755 index 672afed3..00000000 --- a/CPP/7zip/Archive/Cab/makefile +++ /dev/null @@ -1,70 +0,0 @@ -PROG = cab.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -CAB_OBJS = \ - $O\DllExports.obj \ - $O\CabBlockInStream.obj \ - $O\CabHandler.obj \ - $O\CabHeader.obj \ - $O\CabIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\UTFConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\LSBFDecoder.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -COMPRESS_LZX_OBJS = \ - $O\LzxDecoder.obj \ - $O\Lzx86Converter.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(CAB_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(COMPRESS_LZX_OBJS) \ - $O\DeflateDecoder.obj \ - $O\QuantumDecoder.obj \ - $O\LZOutWindow.obj \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(CAB_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(COMPRESS_LZX_OBJS): ../../Compress/Lzx/$(*B).cpp - $(COMPL_O2) -$O\DeflateDecoder.obj: ../../Compress/Deflate/$(*B).cpp - $(COMPL_O2) -$O\QuantumDecoder.obj: ../../Compress/Quantum/$(*B).cpp - $(COMPL) -$O\LZOutWindow.obj: ../../Compress/LZ/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) - diff --git a/CPP/7zip/Archive/Cab/resource.rc b/CPP/7zip/Archive/Cab/resource.rc deleted file mode 100755 index fa0792bd..00000000 --- a/CPP/7zip/Archive/Cab/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Cab Plugin", "cab") - -101 ICON "cab.ico" diff --git a/CPP/7zip/Archive/Chm/Chm.dsp b/CPP/7zip/Archive/Chm/Chm.dsp deleted file mode 100755 index 7e0b7c66..00000000 --- a/CPP/7zip/Archive/Chm/Chm.dsp +++ /dev/null @@ -1,337 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Chm" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Chm - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Chm.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Chm.mak" CFG="Chm - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Chm - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Chm - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Chm - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CHM_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CHM_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\chm.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Chm - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CHM_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CHM_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\chm.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Chm - Win32 Release" -# Name "Chm - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ChmHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\ChmHandler.h -# End Source File -# Begin Source File - -SOURCE=.\ChmHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\ChmHeader.h -# End Source File -# Begin Source File - -SOURCE=.\ChmIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\ChmIn.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "Lzx" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Lzx\Lzx.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\Lzx86Converter.cpp - -!IF "$(CFG)" == "Chm - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Chm - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\Lzx86Converter.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\LzxDecoder.cpp - -!IF "$(CFG)" == "Chm - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Chm - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzx\LzxDecoder.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# End Target -# End Project diff --git a/CPP/7zip/Archive/Chm/Chm.dsw b/CPP/7zip/Archive/Chm/Chm.dsw deleted file mode 100755 index 58cb09b2..00000000 --- a/CPP/7zip/Archive/Chm/Chm.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Chm"=.\Chm.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Chm/ChmRegister.cpp b/CPP/7zip/Archive/Chm/ChmRegister.cpp new file mode 100755 index 00000000..abebe6c6 --- /dev/null +++ b/CPP/7zip/Archive/Chm/ChmRegister.cpp @@ -0,0 +1,13 @@ +// ChmRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "ChmHandler.h" +static IInArchive *CreateArc() { return new NArchive::NChm::CHandler; } + +static CArcInfo g_ArcInfo = + { L"Chm", L"chm chi chq chw hxs hxi hxr hxq hxw lit", 0, 0xE9, { 'I', 'T', 'S', 'F' }, 4, false, CreateArc, 0 }; + +REGISTER_ARC(Chm) diff --git a/CPP/7zip/Archive/Chm/DllExports.cpp b/CPP/7zip/Archive/Chm/DllExports.cpp deleted file mode 100755 index ad822094..00000000 --- a/CPP/7zip/Archive/Chm/DllExports.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "ChmHandler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278A-1000-000110E90000} -DEFINE_GUID(CLSID_CChmHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xE9, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CChmHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr<IInArchive> inArchive = (IInArchive *)new NArchive::NChm::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Chm"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CChmHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"chm chi chq chw hxs hxi hxr hxq hxw lit"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const char sig[] = { 'I', 'T', 'S', 'F' }; - if ((value->bstrVal = ::SysAllocStringByteLen(sig, 4)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kAssociate: - { - propVariant = false; - break; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/Chm/makefile b/CPP/7zip/Archive/Chm/makefile deleted file mode 100755 index 4adce2f5..00000000 --- a/CPP/7zip/Archive/Chm/makefile +++ /dev/null @@ -1,68 +0,0 @@ -PROG = chm.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -CHM_OBJS = \ - $O\DllExports.obj \ - $O\ChmHandler.obj \ - $O\ChmHeader.obj \ - $O\ChmIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\UTFConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\LimitedStreams.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - -COMPRESS_LZX_OBJS = \ - $O\LzxDecoder.obj \ - $O\Lzx86Converter.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(CHM_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_LZX_OBJS) \ - $O\LZOutWindow.obj \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(CHM_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(COMPRESS_LZX_OBJS): ../../Compress/Lzx/$(*B).cpp - $(COMPL_O2) -$O\LZOutWindow.obj: ../../Compress/LZ/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) - diff --git a/CPP/7zip/Archive/Chm/resource.rc b/CPP/7zip/Archive/Chm/resource.rc deleted file mode 100755 index fc93ae4f..00000000 --- a/CPP/7zip/Archive/Chm/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Chm Plugin", "chm") diff --git a/CPP/7zip/Archive/Common/CodecsPath.cpp b/CPP/7zip/Archive/Common/CodecsPath.cpp deleted file mode 100755 index 7ee89875..00000000 --- a/CPP/7zip/Archive/Common/CodecsPath.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// CodecsPath.cpp - -#include "StdAfx.h" -#include "../../../Common/String.h" - -extern HINSTANCE g_hInstance; - -static CSysString GetLibraryPath() -{ - TCHAR fullPath[MAX_PATH + 1]; - ::GetModuleFileName(g_hInstance, fullPath, MAX_PATH); - return fullPath; -} - -static CSysString GetLibraryFolderPrefix() -{ - CSysString path = GetLibraryPath(); - int pos = path.ReverseFind(TEXT(CHAR_PATH_SEPARATOR)); - return path.Left(pos + 1); -} - -CSysString GetBaseFolderPrefix() -{ - CSysString libPrefix = GetLibraryFolderPrefix(); - CSysString temp = libPrefix; - temp.Delete(temp.Length() - 1); - int pos = temp.ReverseFind(TEXT(CHAR_PATH_SEPARATOR)); - return temp.Left(pos + 1); -} - -CSysString GetCodecsFolderPrefix() -{ - return GetBaseFolderPrefix() + (CSysString)(TEXT("Codecs")) + (CSysString)(TEXT(STRING_PATH_SEPARATOR)); -} diff --git a/CPP/7zip/Archive/Common/CodecsPath.h b/CPP/7zip/Archive/Common/CodecsPath.h deleted file mode 100755 index 11145a03..00000000 --- a/CPP/7zip/Archive/Common/CodecsPath.h +++ /dev/null @@ -1,12 +0,0 @@ -// CodecsPath.h - -#ifndef __CODECSPATH_H -#define __CODECSPATH_H - -#include "../../../Common/String.h" - -CSysString GetBaseFolderPrefix(); -CSysString GetCodecsFolderPrefix(); - -#endif - diff --git a/CPP/7zip/Archive/Common/CoderLoader.cpp b/CPP/7zip/Archive/Common/CoderLoader.cpp deleted file mode 100755 index bf54f6e0..00000000 --- a/CPP/7zip/Archive/Common/CoderLoader.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// CoderLoader.cpp - -#include "StdAfx.h" - -#include "CoderLoader.h" -#include "FilterCoder.h" - -HRESULT CCoderLibrary::CreateCoderSpec(REFGUID clsID, ICompressCoder **coder) -{ - HRESULT result = CreateObject(clsID, IID_ICompressCoder, (void **)coder); - if (result == S_OK || result != E_NOINTERFACE) - return result; - CMyComPtr<ICompressFilter> filter; - RINOK(CreateObject(clsID, IID_ICompressFilter, (void **)&filter)); - CFilterCoder *filterCoderSpec = new CFilterCoder; - CMyComPtr<ICompressCoder> filterCoder = filterCoderSpec; - filterCoderSpec->Filter = filter; - *coder = filterCoder.Detach(); - return S_OK; -} - - -HRESULT CCoderLibrary::LoadAndCreateCoderSpec(LPCTSTR filePath, REFGUID clsID, ICompressCoder **coder) -{ - CCoderLibrary libTemp; - if (!libTemp.Load(filePath)) - return GetLastError(); - RINOK(libTemp.CreateCoderSpec(clsID, coder)); - Attach(libTemp.Detach()); - return S_OK; -} diff --git a/CPP/7zip/Archive/Common/CoderLoader.h b/CPP/7zip/Archive/Common/CoderLoader.h deleted file mode 100755 index 02322d8c..00000000 --- a/CPP/7zip/Archive/Common/CoderLoader.h +++ /dev/null @@ -1,147 +0,0 @@ -// CoderLoader.h - -#ifndef __CODERLOADER_H -#define __CODERLOADER_H - -#include "../../../Common/String.h" -#include "../../../Common/MyCom.h" -#include "../../../Windows/DLL.h" -#include "../../ICoder.h" - -typedef UInt32 (WINAPI * CreateObjectPointer)( - const GUID *clsID, - const GUID *interfaceID, - void **outObject); - -class CCoderLibrary: public NWindows::NDLL::CLibrary -{ -public: - HRESULT CreateObject(REFGUID clsID, REFGUID iid, void **obj) - { - CreateObjectPointer createObject = (CreateObjectPointer) - GetProcAddress("CreateObject"); - if (createObject == NULL) - return GetLastError(); - return createObject(&clsID, &iid, obj); - } - - HRESULT CreateFilter(REFGUID clsID, ICompressFilter **filter) - { - return CreateObject(clsID, IID_ICompressFilter, (void **)filter); - } - - HRESULT CreateCoder(REFGUID clsID, ICompressCoder **coder) - { - return CreateObject(clsID, IID_ICompressCoder, (void **)coder); - } - - HRESULT CreateCoderSpec(REFGUID clsID, ICompressCoder **coder); - - HRESULT LoadAndCreateFilter(LPCTSTR filePath, REFGUID clsID, ICompressFilter **filter) - { - CCoderLibrary libTemp; - if (!libTemp.Load(filePath)) - return GetLastError(); - RINOK(libTemp.CreateFilter(clsID, filter)); - Attach(libTemp.Detach()); - return S_OK; - } - - - HRESULT LoadAndCreateCoder(LPCTSTR filePath, REFGUID clsID, ICompressCoder **coder) - { - CCoderLibrary libTemp; - if (!libTemp.Load(filePath)) - return GetLastError(); - RINOK(libTemp.CreateCoder(clsID, coder)); - Attach(libTemp.Detach()); - return S_OK; - } - - HRESULT LoadAndCreateCoderSpec(LPCTSTR filePath, REFGUID clsID, ICompressCoder **coder); - HRESULT CreateCoder2(REFGUID clsID, ICompressCoder2 **coder) - { - CreateObjectPointer createObject = (CreateObjectPointer) - GetProcAddress("CreateObject"); - if (createObject == NULL) - return GetLastError(); - return createObject(&clsID, &IID_ICompressCoder2, (void **)coder); - } - HRESULT LoadAndCreateCoder2(LPCTSTR filePath, REFGUID clsID, ICompressCoder2 **coder) - { - CCoderLibrary libTemp; - if (!libTemp.Load(filePath)) - return GetLastError(); - RINOK(libTemp.CreateCoder2(clsID, coder)); - Attach(libTemp.Detach()); - return S_OK; - } -}; - - -class CCoderLibraries -{ - struct CPathToLibraryPair - { - CSysString Path; - CCoderLibrary Libary; - }; - CObjectVector<CPathToLibraryPair> Pairs; -public: - int FindPath(LPCTSTR filePath) - { - for (int i = 0; i < Pairs.Size(); i++) - if (Pairs[i].Path.CompareNoCase(filePath) == 0) - return i; - return -1; - } - - HRESULT CreateCoder(LPCTSTR filePath, REFGUID clsID, ICompressCoder **coder) - { - int index = FindPath(filePath); - if (index < 0) - { - CPathToLibraryPair pair; - RINOK(pair.Libary.LoadAndCreateCoder(filePath, clsID, coder)); - pair.Path = filePath; - Pairs.Add(pair); - pair.Libary.Detach(); - return S_OK; - } - return Pairs[index].Libary.CreateCoder(clsID, coder); - } - - HRESULT CreateCoderSpec(LPCTSTR filePath, REFGUID clsID, ICompressCoder **coder) - { - int index = FindPath(filePath); - if (index < 0) - { - CPathToLibraryPair pair; - RINOK(pair.Libary.LoadAndCreateCoderSpec(filePath, clsID, coder)); - pair.Path = filePath; - Pairs.Add(pair); - pair.Libary.Detach(); - return S_OK; - } - return Pairs[index].Libary.CreateCoderSpec(clsID, coder); - } - - HRESULT CreateCoder2(LPCTSTR filePath, REFGUID clsID, ICompressCoder2 **coder) - { - int index = FindPath(filePath); - if (index < 0) - { - CPathToLibraryPair pair; - RINOK(pair.Libary.LoadAndCreateCoder2(filePath, clsID, coder)); - pair.Path = filePath; - Pairs.Add(pair); - pair.Libary.Detach(); - return S_OK; - } - return Pairs[index].Libary.CreateCoder2(clsID, coder); - } -}; - - -#endif - diff --git a/CPP/7zip/Archive/Common/CoderMixer2MT.cpp b/CPP/7zip/Archive/Common/CoderMixer2MT.cpp index 9d7944b1..c3b37f2d 100755 --- a/CPP/7zip/Archive/Common/CoderMixer2MT.cpp +++ b/CPP/7zip/Archive/Common/CoderMixer2MT.cpp @@ -227,8 +227,10 @@ void CCoderMixer2MT::ReInit() STDMETHODIMP CCoderMixer2MT::Init(ISequentialInStream **inStreams, ISequentialOutStream **outStreams) { + /* if (_coderInfoVector.Size() != _bindInfo.Coders.Size()) throw 0; + */ int i; for(i = 0; i < _coderInfoVector.Size(); i++) { diff --git a/CPP/7zip/Archive/Common/FilterCoder.cpp b/CPP/7zip/Archive/Common/FilterCoder.cpp deleted file mode 100755 index 5e104c84..00000000 --- a/CPP/7zip/Archive/Common/FilterCoder.cpp +++ /dev/null @@ -1,243 +0,0 @@ -// FilterCoder.cpp - -#include "StdAfx.h" - -#include "FilterCoder.h" -#include "../../../Common/Alloc.h" -#include "../../../Common/Defs.h" -#include "../../Common/StreamUtils.h" - -static const int kBufferSize = 1 << 17; - -CFilterCoder::CFilterCoder() -{ - _buffer = (Byte *)::MidAlloc(kBufferSize); -} - -CFilterCoder::~CFilterCoder() -{ - ::MidFree(_buffer); -} - -HRESULT CFilterCoder::WriteWithLimit(ISequentialOutStream *outStream, UInt32 size) -{ - if (_outSizeIsDefined) - { - UInt64 remSize = _outSize - _nowPos64; - if (size > remSize) - size = (UInt32)remSize; - } - UInt32 processedSize = 0; - RINOK(WriteStream(outStream, _buffer, size, &processedSize)); - if (size != processedSize) - return E_FAIL; - _nowPos64 += processedSize; - return S_OK; -} - - -STDMETHODIMP CFilterCoder::Code(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize, - ICompressProgressInfo *progress) -{ - RINOK(Init()); - UInt32 bufferPos = 0; - _outSizeIsDefined = (outSize != 0); - if (_outSizeIsDefined) - _outSize = *outSize; - - while(NeedMore()) - { - UInt32 processedSize; - - // Change it: It can be optimized using ReadPart - RINOK(ReadStream(inStream, _buffer + bufferPos, kBufferSize - bufferPos, &processedSize)); - - UInt32 endPos = bufferPos + processedSize; - - bufferPos = Filter->Filter(_buffer, endPos); - if (bufferPos > endPos) - { - for (; endPos< bufferPos; endPos++) - _buffer[endPos] = 0; - bufferPos = Filter->Filter(_buffer, endPos); - } - - if (bufferPos == 0) - { - if (endPos > 0) - return WriteWithLimit(outStream, endPos); - return S_OK; - } - RINOK(WriteWithLimit(outStream, bufferPos)); - if (progress != NULL) - { - RINOK(progress->SetRatioInfo(&_nowPos64, &_nowPos64)); - } - UInt32 i = 0; - while(bufferPos < endPos) - _buffer[i++] = _buffer[bufferPos++]; - bufferPos = i; - } - return S_OK; -} - -// #ifdef _ST_MODE -STDMETHODIMP CFilterCoder::SetOutStream(ISequentialOutStream *outStream) -{ - _bufferPos = 0; - _outStream = outStream; - return Init(); -} - -STDMETHODIMP CFilterCoder::ReleaseOutStream() -{ - _outStream.Release(); - return S_OK; -}; - - -STDMETHODIMP CFilterCoder::Write(const void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 processedSizeTotal = 0; - while(size > 0) - { - UInt32 sizeMax = kBufferSize - _bufferPos; - UInt32 sizeTemp = size; - if (sizeTemp > sizeMax) - sizeTemp = sizeMax; - memmove(_buffer + _bufferPos, data, sizeTemp); - size -= sizeTemp; - processedSizeTotal += sizeTemp; - data = (const Byte *)data + sizeTemp; - UInt32 endPos = _bufferPos + sizeTemp; - _bufferPos = Filter->Filter(_buffer, endPos); - if (_bufferPos == 0) - { - _bufferPos = endPos; - break; - } - if (_bufferPos > endPos) - { - if (size != 0) - return E_FAIL; - break; - } - RINOK(WriteWithLimit(_outStream, _bufferPos)); - UInt32 i = 0; - while(_bufferPos < endPos) - _buffer[i++] = _buffer[_bufferPos++]; - _bufferPos = i; - } - if (processedSize != NULL) - *processedSize = processedSizeTotal; - return S_OK; -} - -STDMETHODIMP CFilterCoder::Flush() -{ - if (_bufferPos != 0) - { - UInt32 endPos = Filter->Filter(_buffer, _bufferPos); - if (endPos > _bufferPos) - { - for (; _bufferPos < endPos; _bufferPos++) - _buffer[_bufferPos] = 0; - if (Filter->Filter(_buffer, endPos) != endPos) - return E_FAIL; - } - UInt32 processedSize; - RINOK(WriteStream(_outStream, _buffer, _bufferPos, &processedSize)); - if (_bufferPos != processedSize) - return E_FAIL; - _bufferPos = 0; - } - CMyComPtr<IOutStreamFlush> flush; - _outStream.QueryInterface(IID_IOutStreamFlush, &flush); - if (flush) - return flush->Flush(); - return S_OK; -} - - -STDMETHODIMP CFilterCoder::SetInStream(ISequentialInStream *inStream) -{ - _convertedPosBegin = _convertedPosEnd = _bufferPos = 0; - _inStream = inStream; - return Init(); -} - -STDMETHODIMP CFilterCoder::ReleaseInStream() -{ - _inStream.Release(); - return S_OK; -}; - -STDMETHODIMP CFilterCoder::Read(void *data, UInt32 size, UInt32 *processedSize) -{ - UInt32 processedSizeTotal = 0; - while(size > 0) - { - if (_convertedPosBegin != _convertedPosEnd) - { - UInt32 sizeTemp = MyMin(size, _convertedPosEnd - _convertedPosBegin); - memmove(data, _buffer + _convertedPosBegin, sizeTemp); - _convertedPosBegin += sizeTemp; - data = (void *)((Byte *)data + sizeTemp); - size -= sizeTemp; - processedSizeTotal += sizeTemp; - break; - } - int i; - for (i = 0; _convertedPosEnd + i < _bufferPos; i++) - _buffer[i] = _buffer[i + _convertedPosEnd]; - _bufferPos = i; - _convertedPosBegin = _convertedPosEnd = 0; - UInt32 processedSizeTemp; - UInt32 size0 = kBufferSize - _bufferPos; - // Optimize it: - RINOK(ReadStream(_inStream, _buffer + _bufferPos, size0, &processedSizeTemp)); - _bufferPos = _bufferPos + processedSizeTemp; - _convertedPosEnd = Filter->Filter(_buffer, _bufferPos); - if (_convertedPosEnd == 0) - { - if (_bufferPos == 0) - break; - else - { - _convertedPosEnd = _bufferPos; // check it - continue; - } - } - if (_convertedPosEnd > _bufferPos) - { - for (; _bufferPos < _convertedPosEnd; _bufferPos++) - _buffer[_bufferPos] = 0; - _convertedPosEnd = Filter->Filter(_buffer, _bufferPos); - } - } - if (processedSize != NULL) - *processedSize = processedSizeTotal; - return S_OK; -} - -// #endif // _ST_MODE - -#ifndef _NO_CRYPTO -STDMETHODIMP CFilterCoder::CryptoSetPassword(const Byte *data, UInt32 size) -{ - return _setPassword->CryptoSetPassword(data, size); -} -#endif - -#ifndef EXTRACT_ONLY -STDMETHODIMP CFilterCoder::WriteCoderProperties(ISequentialOutStream *outStream) -{ - return _writeCoderProperties->WriteCoderProperties(outStream); -} -#endif - -STDMETHODIMP CFilterCoder::SetDecoderProperties2(const Byte *data, UInt32 size) -{ - return _setDecoderProperties->SetDecoderProperties2(data, size); -} diff --git a/CPP/7zip/Archive/Common/FilterCoder.h b/CPP/7zip/Archive/Common/FilterCoder.h deleted file mode 100755 index 45618172..00000000 --- a/CPP/7zip/Archive/Common/FilterCoder.h +++ /dev/null @@ -1,130 +0,0 @@ -// FilterCoder.h - -#ifndef __FILTERCODER_H -#define __FILTERCODER_H - -#include "../../../Common/MyCom.h" -#include "../../ICoder.h" -#include "../../IPassword.h" - -#define MY_QUERYINTERFACE_ENTRY_AG(i, sub0, sub) if (iid == IID_ ## i) \ -{ if (!sub) RINOK(sub0->QueryInterface(IID_ ## i, (void **)&sub)) \ -*outObject = (void *)(i *)this; AddRef(); return S_OK; } - -class CFilterCoder: - public ICompressCoder, - // #ifdef _ST_MODE - public ICompressSetInStream, - public ISequentialInStream, - public ICompressSetOutStream, - public ISequentialOutStream, - public IOutStreamFlush, - // #endif - - #ifndef _NO_CRYPTO - public ICryptoSetPassword, - #endif - #ifndef EXTRACT_ONLY - public ICompressWriteCoderProperties, - #endif - public ICompressSetDecoderProperties2, - public CMyUnknownImp -{ -protected: - Byte *_buffer; - // #ifdef _ST_MODE - CMyComPtr<ISequentialInStream> _inStream; - CMyComPtr<ISequentialOutStream> _outStream; - UInt32 _bufferPos; - UInt32 _convertedPosBegin; - UInt32 _convertedPosEnd; - // #endif - bool _outSizeIsDefined; - UInt64 _outSize; - UInt64 _nowPos64; - - HRESULT Init() - { - _nowPos64 = 0; - _outSizeIsDefined = false; - return Filter->Init(); - } - - CMyComPtr<ICryptoSetPassword> _setPassword; - #ifndef EXTRACT_ONLY - CMyComPtr<ICompressWriteCoderProperties> _writeCoderProperties; - #endif - CMyComPtr<ICompressSetDecoderProperties2> _setDecoderProperties; -public: - CMyComPtr<ICompressFilter> Filter; - - CFilterCoder(); - ~CFilterCoder(); - HRESULT WriteWithLimit(ISequentialOutStream *outStream, UInt32 size); - bool NeedMore() const - { return (!_outSizeIsDefined || (_nowPos64 < _outSize)); } - -public: - MY_QUERYINTERFACE_BEGIN - MY_QUERYINTERFACE_ENTRY(ICompressCoder) - // #ifdef _ST_MODE - MY_QUERYINTERFACE_ENTRY(ICompressSetInStream) - MY_QUERYINTERFACE_ENTRY(ISequentialInStream) - - MY_QUERYINTERFACE_ENTRY(ICompressSetOutStream) - MY_QUERYINTERFACE_ENTRY(ISequentialOutStream) - MY_QUERYINTERFACE_ENTRY(IOutStreamFlush) - // #endif - - #ifndef _NO_CRYPTO - MY_QUERYINTERFACE_ENTRY_AG(ICryptoSetPassword, Filter, _setPassword) - #endif - - #ifndef EXTRACT_ONLY - MY_QUERYINTERFACE_ENTRY_AG(ICompressWriteCoderProperties, Filter, _writeCoderProperties) - #endif - - MY_QUERYINTERFACE_ENTRY_AG(ICompressSetDecoderProperties2, Filter, _setDecoderProperties) - MY_QUERYINTERFACE_END - MY_ADDREF_RELEASE - STDMETHOD(Code)(ISequentialInStream *inStream, - ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, - ICompressProgressInfo *progress); - // #ifdef _ST_MODE - STDMETHOD(ReleaseInStream)(); - STDMETHOD(SetInStream)(ISequentialInStream *inStream); - STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); \ - STDMETHOD(SetOutStream)(ISequentialOutStream *outStream); - STDMETHOD(ReleaseOutStream)(); - STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); - STDMETHOD(Flush)(); - // #endif - - #ifndef _NO_CRYPTO - STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size); - #endif - #ifndef EXTRACT_ONLY - STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream); - #endif - STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size); -}; - -// #ifdef _ST_MODE -class CInStreamReleaser -{ -public: - CFilterCoder *FilterCoder; - CInStreamReleaser(): FilterCoder(0) {} - ~CInStreamReleaser() { if (FilterCoder) FilterCoder->ReleaseInStream(); } -}; - -class COutStreamReleaser -{ -public: - CFilterCoder *FilterCoder; - COutStreamReleaser(): FilterCoder(0) {} - ~COutStreamReleaser() { if (FilterCoder) FilterCoder->ReleaseOutStream(); } -}; -// #endif - -#endif diff --git a/CPP/7zip/Archive/Common/InStreamWithCRC.cpp b/CPP/7zip/Archive/Common/InStreamWithCRC.cpp index 74dff7e1..1d9e5556 100755 --- a/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +++ b/CPP/7zip/Archive/Common/InStreamWithCRC.cpp @@ -11,7 +11,7 @@ STDMETHODIMP CSequentialInStreamWithCRC::Read(void *data, UInt32 size, UInt32 *p _size += realProcessedSize; if (size > 0 && realProcessedSize == 0) _wasFinished = true; - _crc.Update(data, realProcessedSize); + _crc = CrcUpdate(_crc, data, realProcessedSize); if(processedSize != NULL) *processedSize = realProcessedSize; return result; @@ -24,18 +24,17 @@ STDMETHODIMP CInStreamWithCRC::Read(void *data, UInt32 size, UInt32 *processedSi if (size > 0 && realProcessedSize == 0) _wasFinished = true; _size += realProcessedSize; - _crc.Update(data, realProcessedSize); + _crc = CrcUpdate(_crc, data, realProcessedSize); if(processedSize != NULL) *processedSize = realProcessedSize; return result; } -STDMETHODIMP CInStreamWithCRC::Seek(Int64 offset, - UInt32 seekOrigin, UInt64 *newPosition) +STDMETHODIMP CInStreamWithCRC::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) { if (seekOrigin != STREAM_SEEK_SET || offset != 0) return E_FAIL; _size = 0; - _crc.Init(); + _crc = CRC_INIT_VAL; return _stream->Seek(offset, seekOrigin, newPosition); } diff --git a/CPP/7zip/Archive/Common/InStreamWithCRC.h b/CPP/7zip/Archive/Common/InStreamWithCRC.h index 770a1437..96bea9b2 100755 --- a/CPP/7zip/Archive/Common/InStreamWithCRC.h +++ b/CPP/7zip/Archive/Common/InStreamWithCRC.h @@ -3,10 +3,14 @@ #ifndef __INSTREAMWITHCRC_H #define __INSTREAMWITHCRC_H -#include "../../../Common/CRC.h" #include "../../../Common/MyCom.h" #include "../../IStream.h" +extern "C" +{ +#include "../../../../C/7zCrc.h" +} + class CSequentialInStreamWithCRC: public ISequentialInStream, public CMyUnknownImp @@ -18,7 +22,7 @@ public: private: CMyComPtr<ISequentialInStream> _stream; UInt64 _size; - CCRC _crc; + UInt32 _crc; bool _wasFinished; public: void SetStream(ISequentialInStream *stream) { _stream = stream; } @@ -26,10 +30,10 @@ public: { _size = 0; _wasFinished = false; - _crc.Init(); + _crc = CRC_INIT_VAL; } void ReleaseStream() { _stream.Release(); } - UInt32 GetCRC() const { return _crc.GetDigest(); } + UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); } UInt64 GetSize() const { return _size; } bool WasFinished() const { return _wasFinished; } }; @@ -46,7 +50,7 @@ public: private: CMyComPtr<IInStream> _stream; UInt64 _size; - CCRC _crc; + UInt32 _crc; bool _wasFinished; public: void SetStream(IInStream *stream) { _stream = stream; } @@ -54,10 +58,10 @@ public: { _size = 0; _wasFinished = false; - _crc.Init(); + _crc = CRC_INIT_VAL; } void ReleaseStream() { _stream.Release(); } - UInt32 GetCRC() const { return _crc.GetDigest(); } + UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); } UInt64 GetSize() const { return _size; } bool WasFinished() const { return _wasFinished; } }; diff --git a/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp b/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp index 7ac3f123..43166ee1 100755 --- a/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +++ b/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp @@ -16,7 +16,7 @@ STDMETHODIMP COutStreamWithCRC::Write(const void *data, UInt32 size, UInt32 *pr else result = _stream->Write(data, size, &realProcessedSize); if (_calculateCrc) - _crc.Update(data, realProcessedSize); + _crc = CrcUpdate(_crc, data, realProcessedSize); _size += realProcessedSize; if(processedSize != NULL) *processedSize = realProcessedSize; diff --git a/CPP/7zip/Archive/Common/OutStreamWithCRC.h b/CPP/7zip/Archive/Common/OutStreamWithCRC.h index 0feb542b..a8791288 100755 --- a/CPP/7zip/Archive/Common/OutStreamWithCRC.h +++ b/CPP/7zip/Archive/Common/OutStreamWithCRC.h @@ -3,10 +3,14 @@ #ifndef __OUTSTREAMWITHCRC_H #define __OUTSTREAMWITHCRC_H -#include "../../../Common/CRC.h" #include "../../../Common/MyCom.h" #include "../../IStream.h" +extern "C" +{ +#include "../../../../C/7zCrc.h" +} + class COutStreamWithCRC: public ISequentialOutStream, public CMyUnknownImp @@ -18,7 +22,7 @@ public: private: CMyComPtr<ISequentialOutStream> _stream; UInt64 _size; - CCRC _crc; + UInt32 _crc; bool _calculateCrc; public: void SetStream(ISequentialOutStream *stream) { _stream = stream; } @@ -26,12 +30,12 @@ public: { _size = 0; _calculateCrc = calculateCrc; - _crc.Init(); + _crc = CRC_INIT_VAL; } void ReleaseStream() { _stream.Release(); } UInt64 GetSize() const { return _size; } - UInt32 GetCRC() const { return _crc.GetDigest(); } - void InitCRC() { _crc.Init(); } + UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); } + void InitCRC() { _crc = CRC_INIT_VAL; } }; #endif diff --git a/CPP/7zip/Archive/Cpio/CpioRegister.cpp b/CPP/7zip/Archive/Cpio/CpioRegister.cpp new file mode 100755 index 00000000..62d1265e --- /dev/null +++ b/CPP/7zip/Archive/Cpio/CpioRegister.cpp @@ -0,0 +1,13 @@ +// CpioRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "CpioHandler.h" +static IInArchive *CreateArc() { return new NArchive::NCpio::CHandler; } + +static CArcInfo g_ArcInfo = + { L"Cpio", L"cpio", 0, 0xED, { 0 }, 0, false, CreateArc, 0 }; + +REGISTER_ARC(Cpio) diff --git a/CPP/7zip/Archive/Cpio/DllExports.cpp b/CPP/7zip/Archive/Cpio/DllExports.cpp deleted file mode 100755 index 8eb38bfd..00000000 --- a/CPP/7zip/Archive/Cpio/DllExports.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "CpioHandler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278A-1000-000110ED0000} -DEFINE_GUID(CLSID_CCpioHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xED, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CCpioHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr<IInArchive> inArchive = (IInArchive *)new NArchive::NCpio::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Cpio"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CCpioHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"cpio"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/Cpio/cpio.dsp b/CPP/7zip/Archive/Cpio/cpio.dsp deleted file mode 100755 index f30c3e63..00000000 --- a/CPP/7zip/Archive/Cpio/cpio.dsp +++ /dev/null @@ -1,265 +0,0 @@ -# Microsoft Developer Studio Project File - Name="cpio" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=cpio - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "cpio.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "cpio.mak" CFG="cpio - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cpio - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cpio - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cpio - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPIO_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPIO_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\cpio.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "cpio - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPIO_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CPIO_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\cpio.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "cpio - Win32 Release" -# Name "cpio - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\cpio.ico -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\CpioHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\CpioHandler.h -# End Source File -# Begin Source File - -SOURCE=.\CpioHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\CpioHeader.h -# End Source File -# Begin Source File - -SOURCE=.\CpioIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\CpioIn.h -# End Source File -# Begin Source File - -SOURCE=.\CpioItem.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# End Target -# End Project diff --git a/CPP/7zip/Archive/Cpio/cpio.dsw b/CPP/7zip/Archive/Cpio/cpio.dsw deleted file mode 100755 index b1b6d98f..00000000 --- a/CPP/7zip/Archive/Cpio/cpio.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "cpio"=.\cpio.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Cpio/makefile b/CPP/7zip/Archive/Cpio/makefile deleted file mode 100755 index d7760281..00000000 --- a/CPP/7zip/Archive/Cpio/makefile +++ /dev/null @@ -1,55 +0,0 @@ -PROG = cpio.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -CPIO_OBJS = \ - $O\DllExports.obj \ - $O\CpioHandler.obj \ - $O\CpioHeader.obj \ - $O\CpioIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\LimitedStreams.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(CPIO_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_CPIO_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(CPIO_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/Cpio/resource.rc b/CPP/7zip/Archive/Cpio/resource.rc deleted file mode 100755 index d5456e5a..00000000 --- a/CPP/7zip/Archive/Cpio/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Cpio Plugin", "cpio") - -101 ICON "cpio.ico" diff --git a/CPP/7zip/Archive/Deb/Deb.dsp b/CPP/7zip/Archive/Deb/Deb.dsp deleted file mode 100755 index 56689305..00000000 --- a/CPP/7zip/Archive/Deb/Deb.dsp +++ /dev/null @@ -1,269 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Deb" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Deb - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Deb.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Deb.mak" CFG="Deb - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Deb - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Deb - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Deb - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEB_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\deb.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Deb - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEB_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\deb.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Deb - Win32 Release" -# Name "Deb - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\Deb.ico -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\DebHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\DebHandler.h -# End Source File -# Begin Source File - -SOURCE=.\DebHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\DebHeader.h -# End Source File -# Begin Source File - -SOURCE=.\DebIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\DebIn.h -# End Source File -# Begin Source File - -SOURCE=.\DebItem.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# End Target -# End Project diff --git a/CPP/7zip/Archive/Deb/Deb.dsw b/CPP/7zip/Archive/Deb/Deb.dsw deleted file mode 100755 index c7169534..00000000 --- a/CPP/7zip/Archive/Deb/Deb.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Deb"=.\Deb.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Deb/DebRegister.cpp b/CPP/7zip/Archive/Deb/DebRegister.cpp new file mode 100755 index 00000000..35c4965e --- /dev/null +++ b/CPP/7zip/Archive/Deb/DebRegister.cpp @@ -0,0 +1,13 @@ +// DebRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "DebHandler.h" +static IInArchive *CreateArc() { return new NArchive::NDeb::CHandler; } + +static CArcInfo g_ArcInfo = + { L"Deb", L"deb", 0, 0xEC, { '!', '<', 'a', 'r', 'c', 'h', '>', '\n' }, 8, false, CreateArc, 0 }; + +REGISTER_ARC(Deb) diff --git a/CPP/7zip/Archive/Deb/DllExports.cpp b/CPP/7zip/Archive/Deb/DllExports.cpp deleted file mode 100755 index fe320531..00000000 --- a/CPP/7zip/Archive/Deb/DllExports.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "DebHandler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278A-1000-000110EC0000} -DEFINE_GUID(CLSID_CDebHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xEC, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CDebHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr<IInArchive> inArchive = (IInArchive *)new NArchive::NDeb::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Deb"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CDebHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"deb"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)NArchive::NDeb::NHeader::kSignature, - NArchive::NDeb::NHeader::kSignatureLen)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/Deb/makefile b/CPP/7zip/Archive/Deb/makefile deleted file mode 100755 index a74f33de..00000000 --- a/CPP/7zip/Archive/Deb/makefile +++ /dev/null @@ -1,54 +0,0 @@ -PROG = deb.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -DEB_OBJS = \ - $O\DllExports.obj \ - $O\DebHandler.obj \ - $O\DebHeader.obj \ - $O\DebIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\LimitedStreams.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(DEB_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(DEB_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/Deb/resource.rc b/CPP/7zip/Archive/Deb/resource.rc deleted file mode 100755 index a80edced..00000000 --- a/CPP/7zip/Archive/Deb/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Deb Plugin", "deb") - -101 ICON "deb.ico" diff --git a/CPP/7zip/Archive/DllExports.cpp b/CPP/7zip/Archive/DllExports.cpp new file mode 100755 index 00000000..58daedb4 --- /dev/null +++ b/CPP/7zip/Archive/DllExports.cpp @@ -0,0 +1,52 @@ +// DLLExports.cpp + +#include "StdAfx.h" + +#include "../../Common/MyInitGuid.h" +#include "../../Common/ComTry.h" +#include "../../Common/Types.h" +#include "../../Windows/PropVariant.h" + +#include "IArchive.h" +#include "../ICoder.h" +#include "../IPassword.h" + +HINSTANCE g_hInstance; +#ifndef _UNICODE +bool g_IsNT = false; +static bool IsItWindowsNT() +{ + OSVERSIONINFO versionInfo; + versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); + if (!::GetVersionEx(&versionInfo)) + return false; + return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); +} +#endif + +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + g_hInstance = hInstance; + #ifndef _UNICODE + g_IsNT = IsItWindowsNT(); + #endif + #if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES) + SetLargePageSize(); + #endif + } + return TRUE; +} + +DEFINE_GUID(CLSID_CArchiveHandler, +0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00); + +STDAPI CreateArchiver(const GUID *classID, const GUID *iid, void **outObject); + +STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) +{ + return CreateArchiver(clsid, iid, outObject); +} + diff --git a/CPP/7zip/Archive/DllExports2.cpp b/CPP/7zip/Archive/DllExports2.cpp new file mode 100755 index 00000000..cdf00346 --- /dev/null +++ b/CPP/7zip/Archive/DllExports2.cpp @@ -0,0 +1,74 @@ +// DLLExports.cpp + +#include "StdAfx.h" + +#include "../../Common/MyInitGuid.h" +#include "../../Common/ComTry.h" +#include "../../Common/Types.h" +#include "../../Windows/PropVariant.h" +#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES) +extern "C" +{ +#include "../../../C/Alloc.h" +} +#endif + +#include "IArchive.h" +#include "../ICoder.h" +#include "../IPassword.h" + +HINSTANCE g_hInstance; +#ifndef _UNICODE +bool g_IsNT = false; +static bool IsItWindowsNT() +{ + OSVERSIONINFO versionInfo; + versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); + if (!::GetVersionEx(&versionInfo)) + return false; + return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); +} +#endif + +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + g_hInstance = hInstance; + #ifndef _UNICODE + g_IsNT = IsItWindowsNT(); + #endif + #if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES) + SetLargePageSize(); + #endif + } + return TRUE; +} + +DEFINE_GUID(CLSID_CArchiveHandler, +0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00); + +static const UInt16 kDecodeId = 0x2790; + +DEFINE_GUID(CLSID_CCodec, +0x23170F69, 0x40C1, kDecodeId, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + +STDAPI CreateCoder(const GUID *clsid, const GUID *iid, void **outObject); +STDAPI CreateArchiver(const GUID *classID, const GUID *iid, void **outObject); + +STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject) +{ + // COM_TRY_BEGIN + *outObject = 0; + if (*iid == IID_ICompressCoder || *iid == IID_ICompressCoder2 || *iid == IID_ICompressFilter) + { + return CreateCoder(clsid, iid, outObject); + } + else + { + return CreateArchiver(clsid, iid, outObject); + } + // COM_TRY_END +} + diff --git a/CPP/7zip/Archive/GZip/DllExports.cpp b/CPP/7zip/Archive/GZip/DllExports.cpp deleted file mode 100755 index 3bddcfb9..00000000 --- a/CPP/7zip/Archive/GZip/DllExports.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "GZipHandler.h" - -// {23170F69-40C1-278A-1000-000110EF0000} -DEFINE_GUID(CLSID_CGZipHandler, -0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xEF, 0x00, 0x00); - -// {23170F69-40C1-278B-0401-080000000100} -DEFINE_GUID(CLSID_CCompressDeflateEncoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-0401-080000000000} -DEFINE_GUID(CLSID_CCompressDeflateDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00); - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -#ifndef COMPRESS_DEFLATE -#include "../Common/CodecsPath.h" -CSysString GetDeflateCodecPath() -{ - return GetCodecsFolderPrefix() + TEXT("Deflate.dll"); -} -#endif - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - } - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CGZipHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - int needOut = *interfaceID == IID_IOutArchive; - if (needIn || needOut) - { - NArchive::NGZip::CHandler *temp = new NArchive::NGZip::CHandler; - if (needIn) - { - CMyComPtr<IInArchive> inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - else - { - CMyComPtr<IOutArchive> outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"GZip"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CGZipHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"gz gzip tgz tpz"; - break; - case NArchive::kAddExtension: - propVariant = L"* * .tar .tar"; - break; - case NArchive::kUpdate: - propVariant = true; - break; - case NArchive::kKeepName: - propVariant = true; - break; - case NArchive::kStartSignature: - { - const unsigned char sig[] = { 0x1F, 0x8B }; - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)sig, 2)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/GZip/GZip.dsp b/CPP/7zip/Archive/GZip/GZip.dsp deleted file mode 100755 index 3af06b46..00000000 --- a/CPP/7zip/Archive/GZip/GZip.dsp +++ /dev/null @@ -1,321 +0,0 @@ -# Microsoft Developer Studio Project File - Name="GZip" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=GZip - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "GZip.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "GZip.mak" CFG="GZip - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "GZip - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "GZip - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "GZip - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GZIP_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GZIP_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\gz.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "GZip - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GZIP_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GZIP_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\gz.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "GZip - Win32 Release" -# Name "GZip - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZip.ico -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compression" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\GZipHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZipHandler.h -# End Source File -# Begin Source File - -SOURCE=.\GZipHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZipHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZipHeader.h -# End Source File -# Begin Source File - -SOURCE=.\GZipIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZipIn.h -# End Source File -# Begin Source File - -SOURCE=.\GZipItem.h -# End Source File -# Begin Source File - -SOURCE=.\GZipOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZipOut.h -# End Source File -# Begin Source File - -SOURCE=.\GZipUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=.\GZipUpdate.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\CodecsPath.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CodecsPath.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.h -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\gz.ico -# End Source File -# End Target -# End Project diff --git a/CPP/7zip/Archive/GZip/GZip.dsw b/CPP/7zip/Archive/GZip/GZip.dsw deleted file mode 100755 index 5ff50d2c..00000000 --- a/CPP/7zip/Archive/GZip/GZip.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "GZip"=.\GZip.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/GZip/GZipHandler.cpp b/CPP/7zip/Archive/GZip/GZipHandler.cpp index ff592324..427098ce 100755 --- a/CPP/7zip/Archive/GZip/GZipHandler.cpp +++ b/CPP/7zip/Archive/GZip/GZipHandler.cpp @@ -5,7 +5,6 @@ #include "GZipHandler.h" #include "Common/Defs.h" -#include "Common/CRC.h" #include "Common/StringConvert.h" #include "Common/ComTry.h" #include "Windows/PropVariant.h" @@ -13,23 +12,16 @@ #include "../../ICoder.h" #include "../../Common/ProgressUtils.h" +#include "../../Common/CreateCoder.h" #include "../Common/OutStreamWithCRC.h" -#ifdef COMPRESS_DEFLATE -#include "../../Compress/Deflate/DeflateDecoder.h" -#else -// {23170F69-40C1-278B-0401-080000000000} -DEFINE_GUID(CLSID_CCompressDeflateDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00); -#include "../Common/CoderLoader.h" -extern CSysString GetDeflateCodecPath(); -#endif - using namespace NWindows; namespace NArchive { namespace NGZip { +static const CMethodId kMethodId_Deflate = 0x040108; + const wchar_t *kHostOS[] = { L"FAT", @@ -269,9 +261,6 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, new CLocalCompressProgressInfo; CMyComPtr<ICompressProgressInfo> compressProgress = localCompressProgressSpec; - #ifndef COMPRESS_DEFLATE - CCoderLibrary lib; - #endif CMyComPtr<ICompressCoder> deflateDecoder; bool firstItem = true; RINOK(m_Stream->Seek(m_StreamStartPosition, STREAM_SEEK_SET, NULL)); @@ -305,12 +294,15 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, { if(!deflateDecoder) { - #ifdef COMPRESS_DEFLATE - deflateDecoder = new NCompress::NDeflate::NDecoder::CCOMCoder; - #else - RINOK(lib.LoadAndCreateCoder(GetDeflateCodecPath(), - CLSID_CCompressDeflateDecoder, &deflateDecoder)); - #endif + RINOK(CreateCoder( + EXTERNAL_CODECS_VARS + kMethodId_Deflate, deflateDecoder, false)); + if (!deflateDecoder) + { + outStream.Release(); + RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); + return S_OK; + } } try { @@ -358,4 +350,6 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, return S_OK; } +IMPL_ISetCompressCodecsInfo + }} diff --git a/CPP/7zip/Archive/GZip/GZipHandler.h b/CPP/7zip/Archive/GZip/GZipHandler.h index 9af7e4a4..ace3c657 100755 --- a/CPP/7zip/Archive/GZip/GZipHandler.h +++ b/CPP/7zip/Archive/GZip/GZipHandler.h @@ -7,6 +7,8 @@ #include "../IArchive.h" +#include "../../Common/CreateCoder.h" + #include "GZipIn.h" #include "GZipUpdate.h" @@ -17,13 +19,17 @@ class CHandler: public IInArchive, public IOutArchive, public ISetProperties, + PUBLIC_ISetCompressCodecsInfo public CMyUnknownImp { public: - MY_UNKNOWN_IMP3( - IInArchive, - IOutArchive, - ISetProperties) + MY_QUERYINTERFACE_BEGIN + MY_QUERYINTERFACE_ENTRY(IInArchive) + MY_QUERYINTERFACE_ENTRY(IOutArchive) + MY_QUERYINTERFACE_ENTRY(ISetProperties) + QUERY_ENTRY_ISetCompressCodecsInfo + MY_QUERYINTERFACE_END + MY_ADDREF_RELEASE STDMETHOD(Open)(IInStream *inStream, const UInt64 *maxCheckStartPosition, @@ -55,7 +61,8 @@ public: // ISetProperties STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties); -public: + DECL_ISetCompressCodecsInfo + CHandler() { InitMethodProperties(); } private: @@ -67,6 +74,8 @@ private: CCompressionMethodMode m_Method; UInt32 m_Level; + DECL_EXTERNAL_CODECS_VARS + void InitMethodProperties() { m_Method.NumMatchFinderCyclesDefined = false; diff --git a/CPP/7zip/Archive/GZip/GZipHandlerOut.cpp b/CPP/7zip/Archive/GZip/GZipHandlerOut.cpp index cc896016..906a324a 100755 --- a/CPP/7zip/Archive/GZip/GZipHandlerOut.cpp +++ b/CPP/7zip/Archive/GZip/GZipHandlerOut.cpp @@ -138,7 +138,9 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt (level >= 7 ? kNumFastBytesX7 : kNumFastBytesX1)); - return UpdateArchive(m_Stream, size, outStream, newItem, m_Method, itemIndex, updateCallback); + return UpdateArchive( + EXTERNAL_CODECS_VARS + m_Stream, size, outStream, newItem, m_Method, itemIndex, updateCallback); } if (indexInArchive != 0) diff --git a/CPP/7zip/Archive/GZip/GZipIn.cpp b/CPP/7zip/Archive/GZip/GZipIn.cpp index 2b16d369..69eb491e 100755 --- a/CPP/7zip/Archive/GZip/GZipIn.cpp +++ b/CPP/7zip/Archive/GZip/GZipIn.cpp @@ -10,6 +10,11 @@ #include "../../Common/StreamUtils.h" +extern "C" +{ + #include "../../../../C/7zCrc.h" +} + namespace NArchive { namespace NGZip { @@ -23,43 +28,44 @@ HRESULT CInArchive::ReadBytes(ISequentialInStream *inStream, void *data, UInt32 return S_OK; } -HRESULT CInArchive::ReadByte(ISequentialInStream *inStream, Byte &value) +HRESULT CInArchive::ReadByte(ISequentialInStream *inStream, Byte &value, UInt32 &crc) { - return ReadBytes(inStream, &value, 1); + HRESULT res = ReadBytes(inStream, &value, 1); + crc = CRC_UPDATE_BYTE(crc, value); + return res; } -HRESULT CInArchive::ReadUInt16(ISequentialInStream *inStream, UInt16 &value) +HRESULT CInArchive::ReadUInt16(ISequentialInStream *inStream, UInt16 &value, UInt32 &crc) { value = 0; for (int i = 0; i < 2; i++) { Byte b; - RINOK(ReadByte(inStream, b)); + RINOK(ReadByte(inStream, b, crc)); value |= (UInt16(b) << (8 * i)); } return S_OK; } -HRESULT CInArchive::ReadUInt32(ISequentialInStream *inStream, UInt32 &value) +HRESULT CInArchive::ReadUInt32(ISequentialInStream *inStream, UInt32 &value, UInt32 &crc) { value = 0; for (int i = 0; i < 4; i++) { Byte b; - RINOK(ReadByte(inStream, b)); + RINOK(ReadByte(inStream, b, crc)); value |= (UInt32(b) << (8 * i)); } return S_OK; } -HRESULT CInArchive::ReadZeroTerminatedString(ISequentialInStream *inStream, AString &resString, CCRC &crc) +HRESULT CInArchive::ReadZeroTerminatedString(ISequentialInStream *inStream, AString &resString, UInt32 &crc) { resString.Empty(); for (;;) { Byte c; - RINOK(ReadByte(inStream, c)); - crc.UpdateByte(c); + RINOK(ReadByte(inStream, c, crc)); if (c == 0) return S_OK; resString += char(c); @@ -72,31 +78,24 @@ HRESULT CInArchive::ReadHeader(ISequentialInStream *inStream, CItem &item) m_Position = 0; UInt16 signature; - RINOK(ReadUInt16(inStream, signature)); + UInt32 crc = CRC_INIT_VAL;; + RINOK(ReadUInt16(inStream, signature, crc)); if (signature != kSignature) return S_FALSE; - RINOK(ReadByte(inStream, item.CompressionMethod)); - RINOK(ReadByte(inStream, item.Flags)); - RINOK(ReadUInt32(inStream, item.Time)); - RINOK(ReadByte(inStream, item.ExtraFlags)); - RINOK(ReadByte(inStream, item.HostOS)); - CCRC crc; - crc.Update(&signature, 2); - crc.UpdateByte(item.CompressionMethod); - crc.UpdateByte(item.Flags); - crc.UpdateUInt32(item.Time); - crc.UpdateByte(item.ExtraFlags); - crc.UpdateByte(item.HostOS); - + RINOK(ReadByte(inStream, item.CompressionMethod, crc)); + RINOK(ReadByte(inStream, item.Flags, crc)); + RINOK(ReadUInt32(inStream, item.Time, crc)); + RINOK(ReadByte(inStream, item.ExtraFlags, crc)); + RINOK(ReadByte(inStream, item.HostOS, crc)); + if (item.ExtraFieldIsPresent()) { UInt16 extraSize; - RINOK(ReadUInt16(inStream, extraSize)); - crc.UpdateUInt16(extraSize); + RINOK(ReadUInt16(inStream, extraSize, crc)); item.Extra.SetCapacity(extraSize); RINOK(ReadBytes(inStream, item.Extra, extraSize)); - crc.Update(item.Extra, extraSize); + crc = CrcUpdate(crc, item.Extra, extraSize); } if (item.NameIsPresent()) RINOK(ReadZeroTerminatedString(inStream, item.Name, crc)); @@ -105,8 +104,9 @@ HRESULT CInArchive::ReadHeader(ISequentialInStream *inStream, CItem &item) if (item.HeaderCRCIsPresent()) { UInt16 headerCRC; - RINOK(ReadUInt16(inStream, headerCRC)); - if ((UInt16)crc.GetDigest() != headerCRC) + UInt32 dummy = 0; + RINOK(ReadUInt16(inStream, headerCRC, dummy)); + if ((UInt16)CRC_GET_DIGEST(crc) != headerCRC) return S_FALSE; } return S_OK; @@ -114,8 +114,9 @@ HRESULT CInArchive::ReadHeader(ISequentialInStream *inStream, CItem &item) HRESULT CInArchive::ReadPostHeader(ISequentialInStream *inStream, CItem &item) { - RINOK(ReadUInt32(inStream, item.FileCRC)); - return ReadUInt32(inStream, item.UnPackSize32); + UInt32 dummy = 0; + RINOK(ReadUInt32(inStream, item.FileCRC, dummy)); + return ReadUInt32(inStream, item.UnPackSize32, dummy); } }} diff --git a/CPP/7zip/Archive/GZip/GZipIn.h b/CPP/7zip/Archive/GZip/GZipIn.h index 998470e0..c2e07490 100755 --- a/CPP/7zip/Archive/GZip/GZipIn.h +++ b/CPP/7zip/Archive/GZip/GZipIn.h @@ -5,7 +5,6 @@ #include "GZipHeader.h" #include "GZipItem.h" -#include "Common/CRC.h" #include "../../IStream.h" namespace NArchive { @@ -16,10 +15,10 @@ class CInArchive UInt64 m_Position; HRESULT ReadBytes(ISequentialInStream *inStream, void *data, UInt32 size); - HRESULT ReadZeroTerminatedString(ISequentialInStream *inStream, AString &resString, CCRC &crc); - HRESULT ReadByte(ISequentialInStream *inStream, Byte &value); - HRESULT ReadUInt16(ISequentialInStream *inStream, UInt16 &value); - HRESULT ReadUInt32(ISequentialInStream *inStream, UInt32 &value); + HRESULT ReadZeroTerminatedString(ISequentialInStream *inStream, AString &resString, UInt32 &crc); + HRESULT ReadByte(ISequentialInStream *inStream, Byte &value, UInt32 &crc); + HRESULT ReadUInt16(ISequentialInStream *inStream, UInt16 &value, UInt32 &crc); + HRESULT ReadUInt32(ISequentialInStream *inStream, UInt32 &value, UInt32 &crc); public: HRESULT ReadHeader(ISequentialInStream *inStream, CItem &item); HRESULT ReadPostHeader(ISequentialInStream *inStream, CItem &item); diff --git a/CPP/7zip/Archive/GZip/GZipOut.cpp b/CPP/7zip/Archive/GZip/GZipOut.cpp index afa8a931..af01c79f 100755 --- a/CPP/7zip/Archive/GZip/GZipOut.cpp +++ b/CPP/7zip/Archive/GZip/GZipOut.cpp @@ -3,7 +3,7 @@ #include "StdAfx.h" #include "GZipOut.h" -#include "Common/CRC.h" + #include "Windows/Defs.h" #include "../../Common/StreamUtils.h" diff --git a/CPP/7zip/Archive/GZip/GZipRegister.cpp b/CPP/7zip/Archive/GZip/GZipRegister.cpp new file mode 100755 index 00000000..e293cfc3 --- /dev/null +++ b/CPP/7zip/Archive/GZip/GZipRegister.cpp @@ -0,0 +1,18 @@ +// GZipRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "GZipHandler.h" +static IInArchive *CreateArc() { return new NArchive::NGZip::CHandler; } +#ifndef EXTRACT_ONLY +static IOutArchive *CreateArcOut() { return new NArchive::NGZip::CHandler; } +#else +#define CreateArcOut 0 +#endif + +static CArcInfo g_ArcInfo = + { L"GZip", L"gz gzip tgz tpz", L"* * .tar .tar", 0xEF, { 0x1F, 0x8B }, 2, true, CreateArc, CreateArcOut }; + +REGISTER_ARC(GZip) diff --git a/CPP/7zip/Archive/GZip/GZipUpdate.cpp b/CPP/7zip/Archive/GZip/GZipUpdate.cpp index 45e6e985..c9567245 100755 --- a/CPP/7zip/Archive/GZip/GZipUpdate.cpp +++ b/CPP/7zip/Archive/GZip/GZipUpdate.cpp @@ -12,26 +12,21 @@ #include "../../ICoder.h" #include "../../Common/ProgressUtils.h" +#include "../../Common/CreateCoder.h" #include "../../Compress/Copy/CopyCoder.h" #include "../Common/InStreamWithCRC.h" -#ifdef COMPRESS_DEFLATE -#include "../../Compress/Deflate/DeflateEncoder.h" -#else -// {23170F69-40C1-278B-0401-080000000100} -DEFINE_GUID(CLSID_CCompressDeflateEncoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00); -#include "../Common/CoderLoader.h" -extern CSysString GetDeflateCodecPath(); -#endif - namespace NArchive { namespace NGZip { +static const CMethodId kMethodId_Deflate = 0x040108; + static const Byte kHostOS = NFileHeader::NHostOS::kFAT; -HRESULT UpdateArchive(IInStream * /* inStream */, +HRESULT UpdateArchive( + DECL_EXTERNAL_CODECS_LOC_VARS + IInStream * /* inStream */, UInt64 unpackSize, ISequentialOutStream *outStream, const CItem &newItem, @@ -45,9 +40,6 @@ HRESULT UpdateArchive(IInStream * /* inStream */, RINOK(updateCallback->SetTotal(complexity)); - #ifndef COMPRESS_DEFLATE - CCoderLibrary lib; - #endif CMyComPtr<ICompressCoder> deflateEncoder; complexity = 0; @@ -83,12 +75,11 @@ HRESULT UpdateArchive(IInStream * /* inStream */, localCompressProgressSpec->Init(localProgress, &complexity, NULL); { - #ifdef COMPRESS_DEFLATE - deflateEncoder = new NCompress::NDeflate::NEncoder::CCOMCoder; - #else - RINOK(lib.LoadAndCreateCoder(GetDeflateCodecPath(), - CLSID_CCompressDeflateEncoder, &deflateEncoder)); - #endif + RINOK(CreateCoder( + EXTERNAL_CODECS_LOC_VARS + kMethodId_Deflate, deflateEncoder, true)); + if (!deflateEncoder) + return E_NOTIMPL; NWindows::NCOM::CPropVariant properties[] = { diff --git a/CPP/7zip/Archive/GZip/GZipUpdate.h b/CPP/7zip/Archive/GZip/GZipUpdate.h index c06e8a4c..7ab92848 100755 --- a/CPP/7zip/Archive/GZip/GZipUpdate.h +++ b/CPP/7zip/Archive/GZip/GZipUpdate.h @@ -5,6 +5,8 @@ #include "../IArchive.h" +#include "../../Common/CreateCoder.h" + #include "GZipOut.h" #include "GZipItem.h" @@ -19,7 +21,9 @@ struct CCompressionMethodMode UInt32 NumMatchFinderCycles; }; -HRESULT UpdateArchive(IInStream *inStream, +HRESULT UpdateArchive( + DECL_EXTERNAL_CODECS_LOC_VARS + IInStream *inStream, UInt64 unpackSize, ISequentialOutStream *outStream, const CItem &newItem, diff --git a/CPP/7zip/Archive/GZip/makefile b/CPP/7zip/Archive/GZip/makefile deleted file mode 100755 index abc3f1e4..00000000 --- a/CPP/7zip/Archive/GZip/makefile +++ /dev/null @@ -1,60 +0,0 @@ -PROG = gz.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -GZ_OBJS = \ - $O\GZipHandler.obj \ - $O\GZipHandlerOut.obj \ - $O\GZipHeader.obj \ - $O\GZipIn.obj \ - $O\GZipOut.obj \ - $O\GZipUpdate.obj \ - $O\DllExports.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CodecsPath.obj \ - $O\InStreamWithCRC.obj \ - $O\OutStreamWithCRC.obj \ - $O\ParseProperties.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(GZ_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(GZ_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/GZip/resource.rc b/CPP/7zip/Archive/GZip/resource.rc deleted file mode 100755 index 29fb4825..00000000 --- a/CPP/7zip/Archive/GZip/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("GZip Plugin", "gz") - -101 ICON "gz.ico" diff --git a/CPP/7zip/Archive/Iso/DllExports.cpp b/CPP/7zip/Archive/Iso/DllExports.cpp deleted file mode 100755 index f746eea1..00000000 --- a/CPP/7zip/Archive/Iso/DllExports.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "IsoHandler.h" - -// {23170F69-40C1-278A-1000-000110E70000} -DEFINE_GUID(CLSID_CIsoHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xE7, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /* lpReserved */) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CIsoHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - // int needOut = *interfaceID == IID_IOutArchive; - if (needIn /*|| needOut */) - { - NArchive::NIso::CHandler *temp = new NArchive::NIso::CHandler; - if (needIn) - { - CMyComPtr<IInArchive> inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - /* - else - { - CMyComPtr<IOutArchive> outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - */ - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Iso"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CIsoHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"iso"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const unsigned char sig[] = { 'C', 'D', '0', '0', '1', 0x1 }; - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)sig, 7)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/Iso/Iso.dsp b/CPP/7zip/Archive/Iso/Iso.dsp deleted file mode 100755 index a204e9cd..00000000 --- a/CPP/7zip/Archive/Iso/Iso.dsp +++ /dev/null @@ -1,273 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Iso" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Iso - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Iso.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Iso.mak" CFG="Iso - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Iso - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Iso - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Iso - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\Iso.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Iso - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\Iso.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Iso - Win32 Release" -# Name "Iso - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\Iso.ico -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\IsoHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\IsoHandler.h -# End Source File -# Begin Source File - -SOURCE=.\IsoHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\IsoHeader.h -# End Source File -# Begin Source File - -SOURCE=.\IsoIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\IsoIn.h -# End Source File -# Begin Source File - -SOURCE=.\IsoItem.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# End Target -# End Project diff --git a/CPP/7zip/Archive/Iso/Iso.dsw b/CPP/7zip/Archive/Iso/Iso.dsw deleted file mode 100755 index 27728dd2..00000000 --- a/CPP/7zip/Archive/Iso/Iso.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Iso"=.\Iso.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Iso/IsoHandler.cpp b/CPP/7zip/Archive/Iso/IsoHandler.cpp index 1831e913..1b20f257 100755 --- a/CPP/7zip/Archive/Iso/IsoHandler.cpp +++ b/CPP/7zip/Archive/Iso/IsoHandler.cpp @@ -139,7 +139,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val switch(propID) { case kpidPath: - if (item.FileId.GetCapacity() >= 0) + // if (item.FileId.GetCapacity() >= 0) { UString s; if (_archive.IsJoliet()) diff --git a/CPP/7zip/Archive/Iso/IsoRegister.cpp b/CPP/7zip/Archive/Iso/IsoRegister.cpp new file mode 100755 index 00000000..b43caba3 --- /dev/null +++ b/CPP/7zip/Archive/Iso/IsoRegister.cpp @@ -0,0 +1,13 @@ +// IsoRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "IsoHandler.h" +static IInArchive *CreateArc() { return new NArchive::NIso::CHandler; } + +static CArcInfo g_ArcInfo = + { L"Iso", L"iso", 0, 0xE7, { 'C', 'D', '0', '0', '1', 0x1 }, 7, false, CreateArc, 0 }; + +REGISTER_ARC(Iso) diff --git a/CPP/7zip/Archive/Iso/makefile b/CPP/7zip/Archive/Iso/makefile deleted file mode 100755 index 100a3cd0..00000000 --- a/CPP/7zip/Archive/Iso/makefile +++ /dev/null @@ -1,55 +0,0 @@ -PROG = iso.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -TAR_OBJS = \ - $O\DllExports.obj \ - $O\IsoHandler.obj \ - $O\IsoHeader.obj \ - $O\IsoIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\LimitedStreams.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(TAR_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_TAR_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(TAR_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/Iso/resource.rc b/CPP/7zip/Archive/Iso/resource.rc deleted file mode 100755 index 86929b0e..00000000 --- a/CPP/7zip/Archive/Iso/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Iso Plugin", "iso") - -101 ICON "iso.ico" diff --git a/CPP/7zip/Archive/Lzh/DllExports.cpp b/CPP/7zip/Archive/Lzh/DllExports.cpp deleted file mode 100755 index c2b30945..00000000 --- a/CPP/7zip/Archive/Lzh/DllExports.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "LzhHandler.h" - -// {23170F69-40C1-278A-1000-000110060000} -DEFINE_GUID(CLSID_CLzhHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x06, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /* lpReserved */) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CLzhHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr<IInArchive> inArchive = (IInArchive *)new NArchive::NLzh::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Lzh"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CLzhHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"lzh lha"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const unsigned char sig[] = { '-', 'l' }; - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)sig, 2)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/Lzh/Lzh.def b/CPP/7zip/Archive/Lzh/Lzh.def deleted file mode 100755 index e240b3f2..00000000 --- a/CPP/7zip/Archive/Lzh/Lzh.def +++ /dev/null @@ -1,7 +0,0 @@ -; Arj.def - -LIBRARY Arj.dll - -EXPORTS - CreateObject PRIVATE - GetHandlerProperty PRIVATE diff --git a/CPP/7zip/Archive/Lzh/Lzh.dsp b/CPP/7zip/Archive/Lzh/Lzh.dsp deleted file mode 100755 index ad00699c..00000000 --- a/CPP/7zip/Archive/Lzh/Lzh.dsp +++ /dev/null @@ -1,333 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Lzh" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Lzh - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "lzh.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "lzh.mak" CFG="Lzh - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Lzh - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Lzh - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Lzh - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\lzh.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Lzh - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARJ_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\lzh.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Lzh - Win32 Release" -# Name "Lzh - Win32 Debug" -# Begin Group "spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\LzhCRC.cpp -# End Source File -# Begin Source File - -SOURCE=.\LzhCRC.h -# End Source File -# Begin Source File - -SOURCE=.\LzhHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\LzhHandler.h -# End Source File -# Begin Source File - -SOURCE=.\LzhHeader.h -# End Source File -# Begin Source File - -SOURCE=.\LzhIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\LzhIn.h -# End Source File -# Begin Source File - -SOURCE=.\LzhItem.h -# End Source File -# Begin Source File - -SOURCE=.\LzhOutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=.\LzhOutStreamWithCRC.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "Codecs" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Lzh\LzhDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Lzh\LzhDecoder.h -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# Begin Group "Copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Huffman" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Huffman\HuffmanDecoder.h -# End Source File -# End Group -# End Group -# Begin Group "7zip common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\lzh.ico -# End Source File -# End Target -# End Project diff --git a/CPP/7zip/Archive/Lzh/Lzh.dsw b/CPP/7zip/Archive/Lzh/Lzh.dsw deleted file mode 100755 index 41ab2218..00000000 --- a/CPP/7zip/Archive/Lzh/Lzh.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "lzh"=.\lzh.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Lzh/LzhIn.cpp b/CPP/7zip/Archive/Lzh/LzhIn.cpp index 42ef50e4..9c531848 100755 --- a/CPP/7zip/Archive/Lzh/LzhIn.cpp +++ b/CPP/7zip/Archive/Lzh/LzhIn.cpp @@ -1,10 +1,9 @@ -// Archive/arj/InEngine.cpp +// Archive/LzhIn.cpp #include "StdAfx.h" #include "Common/StringConvert.h" #include "Common/Buffer.h" -#include "Common/CRC.h" #include "../../Common/StreamUtils.h" diff --git a/CPP/7zip/Archive/Lzh/LzhRegister.cpp b/CPP/7zip/Archive/Lzh/LzhRegister.cpp new file mode 100755 index 00000000..b9b1d473 --- /dev/null +++ b/CPP/7zip/Archive/Lzh/LzhRegister.cpp @@ -0,0 +1,13 @@ +// LzhRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "LzhHandler.h" +static IInArchive *CreateArc() { return new NArchive::NLzh::CHandler; } + +static CArcInfo g_ArcInfo = + { L"Lzh", L"lzh lha", 0, 6, { '-', 'l' }, 2, false, CreateArc, 0 }; + +REGISTER_ARC(Lzh) diff --git a/CPP/7zip/Archive/Lzh/makefile b/CPP/7zip/Archive/Lzh/makefile deleted file mode 100755 index 6f8fd2a0..00000000 --- a/CPP/7zip/Archive/Lzh/makefile +++ /dev/null @@ -1,65 +0,0 @@ -PROG = lzh.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -LZH_OBJS = \ - $O\DllExports.obj \ - $O\LzhCRC.obj \ - $O\LzhHandler.obj \ - $O\LzhIn.obj \ - $O\LzhOutStreamWithCRC.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\LimitedStreams.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - -COMPRESS_LZH_OBJS = \ - $O\LzhDecoder.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(LZH_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_LZH_OBJS) \ - $O\CopyCoder.obj \ - $O\LZOutWindow.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(LZH_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(COMPRESS_LZH_OBJS): ../../Compress/Lzh/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) -$O\LZOutWindow.obj: ../../Compress/LZ/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/Lzh/resource.rc b/CPP/7zip/Archive/Lzh/resource.rc deleted file mode 100755 index 2870e520..00000000 --- a/CPP/7zip/Archive/Lzh/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Lzh Plugin", "lzh") - -101 ICON "lzh.ico" diff --git a/CPP/7zip/Archive/Nsis/DllExports.cpp b/CPP/7zip/Archive/Nsis/DllExports.cpp deleted file mode 100755 index f10f56ea..00000000 --- a/CPP/7zip/Archive/Nsis/DllExports.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "NsisHandler.h" - -// {23170F69-40C1-278A-1000-000110090000} -DEFINE_GUID(CLSID_CNsisHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x09, 0x00, 0x00); - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - } - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CNsisHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - // int needOut = *interfaceID == IID_IOutArchive; - if (needIn /*|| needOut */) - { - NArchive::NNsis::CHandler *temp = new NArchive::NNsis::CHandler; - if (needIn) - { - CMyComPtr<IInArchive> inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - /* - else - { - CMyComPtr<IOutArchive> outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - */ - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Nsis"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CNsisHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"exe"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kStartSignature: - { - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)NArchive::NNsis::kSignature, - NArchive::NNsis::kSignatureSize)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kAssociate: - { - propVariant = false; - break; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/Nsis/Nsis.dsp b/CPP/7zip/Archive/Nsis/Nsis.dsp deleted file mode 100755 index 45ce0386..00000000 --- a/CPP/7zip/Archive/Nsis/Nsis.dsp +++ /dev/null @@ -1,337 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Nsis" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Nsis - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Nsis.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Nsis.mak" CFG="Nsis - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Nsis - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Nsis - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Nsis - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\nsis.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Nsis - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\nsis.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Nsis - Win32 Release" -# Name "Nsis - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\Nsis.ico -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\NsisDecode.cpp -# End Source File -# Begin Source File - -SOURCE=.\NsisDecode.h -# End Source File -# Begin Source File - -SOURCE=.\NsisHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\NsisHandler.h -# End Source File -# Begin Source File - -SOURCE=.\NsisIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\NsisIn.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\CodecsPath.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CodecsPath.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.h -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethods.cpp -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethods.h -# End Source File -# End Group -# End Target -# End Project diff --git a/CPP/7zip/Archive/Nsis/Nsis.dsw b/CPP/7zip/Archive/Nsis/Nsis.dsw deleted file mode 100755 index d3df6d27..00000000 --- a/CPP/7zip/Archive/Nsis/Nsis.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Nsis"=.\Nsis.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Nsis/NsisDecode.cpp b/CPP/7zip/Archive/Nsis/NsisDecode.cpp index d49b2312..b50ec5e0 100755 --- a/CPP/7zip/Archive/Nsis/NsisDecode.cpp +++ b/CPP/7zip/Archive/Nsis/NsisDecode.cpp @@ -6,23 +6,21 @@ #include "../../Common/StreamUtils.h" -#include "../7z/7zMethods.h" +#include "../../Common/MethodId.h" +#include "../../Common/CreateCoder.h" namespace NArchive { namespace NNsis { -static const N7z::CMethodID k_Copy = { { 0x0 }, 1 }; -static const N7z::CMethodID k_Deflate = { { 0x4, 0x9, 0x1 }, 3 }; -static const N7z::CMethodID k_BZip2 = { { 0x4, 0x9, 0x2 }, 3 }; -static const N7z::CMethodID k_LZMA = { { 0x3, 0x1, 0x1 }, 3 }; -static const N7z::CMethodID k_BCJ_X86 = { { 0x3, 0x3, 0x1, 0x3 }, 4 }; +static const CMethodId k_Copy = 0x0; +static const CMethodId k_Deflate = 0x040901; +static const CMethodId k_BZip2 = 0x040902; +static const CMethodId k_LZMA = 0x030101; +static const CMethodId k_BCJ_X86 = 0x03030103; -CDecoder::CDecoder() -{ - N7z::LoadMethodMap(); -} - -HRESULT CDecoder::Init(IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter) +HRESULT CDecoder::Init( + DECL_EXTERNAL_CODECS_LOC_VARS + IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter) { useFilter = false; CObjectVector< CMyComPtr<ISequentialInStream> > inStreams; @@ -33,29 +31,21 @@ HRESULT CDecoder::Init(IInStream *inStream, NMethodType::EEnum method, bool ther _method = method; if (!_codecInStream) { - const NArchive::N7z::CMethodID *methodID = 0; + CMethodId methodID; switch (method) { - case NMethodType::kCopy: - methodID = &k_Copy; - break; - case NMethodType::kDeflate: - methodID = &k_Deflate; - break; - case NMethodType::kBZip2: - methodID = &k_BZip2; - break; - case NMethodType::kLZMA: - methodID = &k_LZMA; - break; - default: - return E_NOTIMPL; + case NMethodType::kCopy: methodID = k_Copy; break; + case NMethodType::kDeflate: methodID = k_Deflate; break; + case NMethodType::kBZip2: methodID = k_BZip2; break; + case NMethodType::kLZMA: methodID = k_LZMA; break; + default: return E_NOTIMPL; } - N7z::CMethodInfo methodInfo; - if (!N7z::GetMethodInfo(*methodID, methodInfo)) - return E_NOTIMPL; CMyComPtr<ICompressCoder> coder; - RINOK(_libraries.CreateCoder(methodInfo.FilePath, methodInfo.Decoder, &coder)); + RINOK(CreateCoder( + EXTERNAL_CODECS_LOC_VARS + methodID, coder, false)); + if (!coder) + return E_NOTIMPL; coder.QueryInterface(IID_ISequentialInStream, &_codecInStream); if (!_codecInStream) return E_NOTIMPL; @@ -77,11 +67,12 @@ HRESULT CDecoder::Init(IInStream *inStream, NMethodType::EEnum method, bool ther { if (!_filterInStream) { - N7z::CMethodInfo methodInfo; - if (!N7z::GetMethodInfo(k_BCJ_X86, methodInfo)) - return E_NOTIMPL; CMyComPtr<ICompressCoder> coder; - RINOK(_libraries.CreateCoderSpec(methodInfo.FilePath, methodInfo.Decoder, &coder)); + RINOK(CreateCoder( + EXTERNAL_CODECS_LOC_VARS + k_BCJ_X86, coder, false)); + if (!coder) + return E_NOTIMPL; coder.QueryInterface(IID_ISequentialInStream, &_filterInStream); if (!_filterInStream) return E_NOTIMPL; diff --git a/CPP/7zip/Archive/Nsis/NsisDecode.h b/CPP/7zip/Archive/Nsis/NsisDecode.h index 1bec178f..1a2fa41f 100755 --- a/CPP/7zip/Archive/Nsis/NsisDecode.h +++ b/CPP/7zip/Archive/Nsis/NsisDecode.h @@ -5,7 +5,7 @@ #include "../../IStream.h" -#include "../Common/CoderLoader.h" +#include "../../Common/CreateCoder.h" namespace NArchive { namespace NNsis { @@ -24,21 +24,21 @@ namespace NMethodType class CDecoder { NMethodType::EEnum _method; - CCoderLibraries _libraries; CMyComPtr<ISequentialInStream> _filterInStream; CMyComPtr<ISequentialInStream> _codecInStream; CMyComPtr<ISequentialInStream> _decoderInStream; public: - CDecoder(); void Release() { _filterInStream.Release(); _codecInStream.Release(); _decoderInStream.Release(); } - HRESULT Init(IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter); + HRESULT Init( + DECL_EXTERNAL_CODECS_LOC_VARS + IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter); HRESULT Read(void *data, UInt32 size, UInt32 *processedSize); }; diff --git a/CPP/7zip/Archive/Nsis/NsisHandler.cpp b/CPP/7zip/Archive/Nsis/NsisHandler.cpp index 0d840479..07fd2c4e 100755 --- a/CPP/7zip/Archive/Nsis/NsisHandler.cpp +++ b/CPP/7zip/Archive/Nsis/NsisHandler.cpp @@ -77,12 +77,15 @@ STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 /* index */, return E_INVALIDARG; } -STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 * maxCheckStartPosition, IArchiveOpenCallback * /* openArchiveCallback */) +STDMETHODIMP CHandler::Open( + IInStream *stream, const UInt64 * maxCheckStartPosition, IArchiveOpenCallback * /* openArchiveCallback */) { COM_TRY_BEGIN Close(); { - if(_archive.Open(stream, maxCheckStartPosition) != S_OK) + if(_archive.Open( + EXTERNAL_CODECS_VARS + stream, maxCheckStartPosition) != S_OK) return S_FALSE; _inStream = stream; } @@ -314,7 +317,9 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, { RINOK(_inStream->Seek(_archive.StreamOffset, STREAM_SEEK_SET, NULL)); bool useFilter; - RINOK(_archive.Decoder.Init(_inStream, _archive.Method, _archive.FilterFlag, useFilter)); + RINOK(_archive.Decoder.Init( + EXTERNAL_CODECS_VARS + _inStream, _archive.Method, _archive.FilterFlag, useFilter)); } bool dataError = false; @@ -404,7 +409,9 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, { needDecompress = true; bool useFilter; - RINOK(_archive.Decoder.Init(_inStream, _archive.Method, _archive.FilterFlag, useFilter)); + RINOK(_archive.Decoder.Init( + EXTERNAL_CODECS_VARS + _inStream, _archive.Method, _archive.FilterFlag, useFilter)); fullSize = GetUInt32FromMemLE(buffer); } else @@ -481,4 +488,6 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, COM_TRY_END } +IMPL_ISetCompressCodecsInfo + }} diff --git a/CPP/7zip/Archive/Nsis/NsisHandler.h b/CPP/7zip/Archive/Nsis/NsisHandler.h index 1ff8b776..e57cbad8 100755 --- a/CPP/7zip/Archive/Nsis/NsisHandler.h +++ b/CPP/7zip/Archive/Nsis/NsisHandler.h @@ -8,21 +8,30 @@ #include "NsisIn.h" +#include "../../Common/CreateCoder.h" + namespace NArchive { namespace NNsis { class CHandler: public IInArchive, + PUBLIC_ISetCompressCodecsInfo public CMyUnknownImp { CMyComPtr<IInStream> _inStream; CInArchive _archive; + DECL_EXTERNAL_CODECS_VARS + bool GetUncompressedSize(int index, UInt32 &size); bool GetCompressedSize(int index, UInt32 &size); public: - MY_UNKNOWN_IMP1(IInArchive) + MY_QUERYINTERFACE_BEGIN + MY_QUERYINTERFACE_ENTRY(IInArchive) + QUERY_ENTRY_ISetCompressCodecsInfo + MY_QUERYINTERFACE_END + MY_ADDREF_RELEASE STDMETHOD(Open)(IInStream *stream, const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *openArchiveCallback); STDMETHOD(Close)(); @@ -34,6 +43,8 @@ public: STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType); STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties); STDMETHOD(GetArchivePropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType); + + DECL_ISetCompressCodecsInfo }; }} diff --git a/CPP/7zip/Archive/Nsis/NsisIn.cpp b/CPP/7zip/Archive/Nsis/NsisIn.cpp index 0db6ccfd..f14bf47c 100755 --- a/CPP/7zip/Archive/Nsis/NsisIn.cpp +++ b/CPP/7zip/Archive/Nsis/NsisIn.cpp @@ -995,7 +995,9 @@ static bool IsLZMA(const Byte *p, UInt32 &dictionary, bool &thereIsFlag) return false; } -HRESULT CInArchive::Open2() +HRESULT CInArchive::Open2( + DECL_EXTERNAL_CODECS_LOC_VARS2 + ) { RINOK(_stream->Seek(0, STREAM_SEEK_CUR, &StreamOffset)); @@ -1053,7 +1055,9 @@ HRESULT CInArchive::Open2() { // unpackSize = (1 << 23); _data.SetCapacity(unpackSize); - RINOK(Decoder.Init(_stream, Method, FilterFlag, UseFilter)); + RINOK(Decoder.Init( + EXTERNAL_CODECS_LOC_VARS + _stream, Method, FilterFlag, UseFilter)); UInt32 processedSize; RINOK(Decoder.Read(_data, unpackSize, &processedSize)); if (processedSize != unpackSize) @@ -1108,7 +1112,9 @@ FirstHeader } */ -HRESULT CInArchive::Open(IInStream *inStream, const UInt64 *maxCheckStartPosition) +HRESULT CInArchive::Open( + DECL_EXTERNAL_CODECS_LOC_VARS + IInStream *inStream, const UInt64 *maxCheckStartPosition) { Clear(); UInt64 pos; @@ -1152,7 +1158,12 @@ HRESULT CInArchive::Open(IInStream *inStream, const UInt64 *maxCheckStartPositio _stream = inStream; HRESULT res = S_FALSE; - try { res = Open2(); } + try + { + res = Open2( + EXTERNAL_CODECS_LOC_VARS2 + ); + } catch(...) { Clear(); res = S_FALSE; } _stream.Release(); return res; diff --git a/CPP/7zip/Archive/Nsis/NsisIn.h b/CPP/7zip/Archive/Nsis/NsisIn.h index d75a9e6e..22c050f1 100755 --- a/CPP/7zip/Archive/Nsis/NsisIn.h +++ b/CPP/7zip/Archive/Nsis/NsisIn.h @@ -11,6 +11,8 @@ #include "NsisDecode.h" +#include "../../Common/CreateCoder.h" + // #define NSIS_SCRIPT namespace NArchive { @@ -99,7 +101,9 @@ class CInArchive Byte ReadByte(); UInt32 ReadUInt32(); - HRESULT Open2(); + HRESULT Open2( + DECL_EXTERNAL_CODECS_LOC_VARS2 + ); void ReadBlockHeader(CBlockHeader &bh); AString ReadString(UInt32 pos); AString ReadString2(UInt32 pos); @@ -117,7 +121,9 @@ class CInArchive bool _headerIsCompressed; UInt32 _nonSolidStartOffset; public: - HRESULT Open(IInStream *inStream, const UInt64 *maxCheckStartPosition); + HRESULT Open( + DECL_EXTERNAL_CODECS_LOC_VARS + IInStream *inStream, const UInt64 *maxCheckStartPosition); void Clear(); UInt64 StreamOffset; diff --git a/CPP/7zip/Archive/Nsis/NsisRegister.cpp b/CPP/7zip/Archive/Nsis/NsisRegister.cpp new file mode 100755 index 00000000..81dd2c82 --- /dev/null +++ b/CPP/7zip/Archive/Nsis/NsisRegister.cpp @@ -0,0 +1,14 @@ +// NsisRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "NsisHandler.h" +static IInArchive *CreateArc() { return new NArchive::NNsis::CHandler; } + +static CArcInfo g_ArcInfo = + { L"Nsis", 0, 0, 0x9, { 0xEF, 0xBE, 0xAD, 0xDE, +0x4E, 0x75, 0x6C, 0x6C, 0x73, 0x6F, 0x66, 0x74, 0x49, 0x6E, 0x73, 0x74}, 16, false, CreateArc, 0 }; + +REGISTER_ARC(Nsis) diff --git a/CPP/7zip/Archive/Nsis/makefile b/CPP/7zip/Archive/Nsis/makefile deleted file mode 100755 index 69fcf523..00000000 --- a/CPP/7zip/Archive/Nsis/makefile +++ /dev/null @@ -1,67 +0,0 @@ -PROG = nsis.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -TAR_OBJS = \ - $O\DllExports.obj \ - $O\NsisDecode.obj \ - $O\NsisHandler.obj \ - $O\NsisIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\FileFind.obj \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\LimitedStreams.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CodecsPath.obj \ - $O\CoderLoader.obj \ - $O\ItemNameUtils.obj \ - $O\FilterCoder.obj \ - -7Z_OBJS = \ - $O\7zMethodID.obj \ - $O\7zMethods.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(TAR_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(COMPRESS_TAR_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(TAR_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(7Z_OBJS): ../7z/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/Nsis/resource.rc b/CPP/7zip/Archive/Nsis/resource.rc deleted file mode 100755 index 487eb4ee..00000000 --- a/CPP/7zip/Archive/Nsis/resource.rc +++ /dev/null @@ -1,3 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Nsis Plugin", "nsis") diff --git a/CPP/7zip/Archive/RPM/DllExports.cpp b/CPP/7zip/Archive/RPM/DllExports.cpp deleted file mode 100755 index ed21e64f..00000000 --- a/CPP/7zip/Archive/RPM/DllExports.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "RpmHandler.h" - -// {23170F69-40C1-278A-1000-000110EB0000} -DEFINE_GUID(CLSID_CRpmHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xEB, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /* lpReserved */) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CRpmHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr<IInArchive> inArchive = (IInArchive *)new NArchive::NRpm::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Rpm"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CRpmHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"rpm"; - break; - case NArchive::kAddExtension: - propVariant = L".cpio.gz"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/RPM/Rpm.dsp b/CPP/7zip/Archive/RPM/Rpm.dsp deleted file mode 100755 index 085fe137..00000000 --- a/CPP/7zip/Archive/RPM/Rpm.dsp +++ /dev/null @@ -1,205 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Rpm" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Rpm - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Rpm.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Rpm.mak" CFG="Rpm - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Rpm - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Rpm - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Rpm - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RPM_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RPM_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-zip\Formats\rpm.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Rpm - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RPM_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RPM_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-zip\Formats\rpm.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Rpm - Win32 Release" -# Name "Rpm - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\Rpm.ico -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "7-zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\RpmHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\RpmHandler.h -# End Source File -# Begin Source File - -SOURCE=.\RpmHeader.h -# End Source File -# Begin Source File - -SOURCE=.\RpmIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\RpmIn.h -# End Source File -# End Target -# End Project diff --git a/CPP/7zip/Archive/RPM/Rpm.dsw b/CPP/7zip/Archive/RPM/Rpm.dsw deleted file mode 100755 index a67232ed..00000000 --- a/CPP/7zip/Archive/RPM/Rpm.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Rpm"=.\Rpm.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/RPM/RpmRegister.cpp b/CPP/7zip/Archive/RPM/RpmRegister.cpp new file mode 100755 index 00000000..76eb2470 --- /dev/null +++ b/CPP/7zip/Archive/RPM/RpmRegister.cpp @@ -0,0 +1,13 @@ +// RpmRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "RpmHandler.h" +static IInArchive *CreateArc() { return new NArchive::NRpm::CHandler; } + +static CArcInfo g_ArcInfo = + { L"Rpm", L"rpm", L".cpio.gz", 0xEB, { 0}, 0, false, CreateArc, 0 }; + +REGISTER_ARC(Rpm) diff --git a/CPP/7zip/Archive/RPM/makefile b/CPP/7zip/Archive/RPM/makefile deleted file mode 100755 index afda1289..00000000 --- a/CPP/7zip/Archive/RPM/makefile +++ /dev/null @@ -1,42 +0,0 @@ -PROG = rpm.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib - -RPM_OBJS = \ - $O\DllExports.obj \ - $O\RpmHandler.obj \ - $O\RpmIn.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(RPM_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(RPM_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/RPM/resource.rc b/CPP/7zip/Archive/RPM/resource.rc deleted file mode 100755 index 926f09aa..00000000 --- a/CPP/7zip/Archive/RPM/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Rpm Plugin", "rpm") - -101 ICON "rpm.ico" diff --git a/CPP/7zip/Archive/Rar/DllExports.cpp b/CPP/7zip/Archive/Rar/DllExports.cpp deleted file mode 100755 index 921bffb2..00000000 --- a/CPP/7zip/Archive/Rar/DllExports.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "../../IPassword.h" -#include "../Common/CodecsPath.h" - -// {23170F69-40C1-278B-0601-010000000000} -DEFINE_GUID(CLSID_CCrypto_AES128_Decoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); - -#include "RarHandler.h" - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -void GetCryptoFolderPrefix(TCHAR *path) -{ - CSysString s = GetCodecsFolderPrefix(); - lstrcpy(path, s); -} - - -// {23170F69-40C1-278B-0403-010000000000} -DEFINE_GUID(CLSID_CCompressRar15Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0403-020000000000} -DEFINE_GUID(CLSID_CCompressRar20Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0403-030000000000} -DEFINE_GUID(CLSID_CCompressRar29Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00); - -/* -// {23170F69-40C1-278B-06F1-0302000000000} -DEFINE_GUID(CLSID_CCryptoRar20Decoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-06F1-0303000000000} -DEFINE_GUID(CLSID_CCryptoRar29Decoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00); -*/ - -// {23170F69-40C1-278A-1000-000110030000} -DEFINE_GUID(CLSID_CRarHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x03, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - } - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CRarHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - if (needIn) - { - NArchive::NRar::CHandler *temp = new NArchive::NRar::CHandler; - if (needIn) - { - CMyComPtr<IInArchive> inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - else - { - CMyComPtr<IOutArchive> outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Rar"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CRarHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"rar"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)NArchive::NRar::NHeader::kMarker, - NArchive::NRar::NHeader::kMarkerSize)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/Rar/Rar.dsp b/CPP/7zip/Archive/Rar/Rar.dsp deleted file mode 100755 index 739024da..00000000 --- a/CPP/7zip/Archive/Rar/Rar.dsp +++ /dev/null @@ -1,459 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Rar" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Rar - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Rar.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Rar.mak" CFG="Rar - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Rar - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Rar - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Rar - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAR_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAR_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-ZIP\Formats\rar.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Rar - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAR_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAR_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-ZIP\Formats\rar.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Rar - Win32 Release" -# Name "Rar - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\DynamicBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Types.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\UTFConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\CodecsPath.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CodecsPath.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.h -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\Common\IArchiveHandler.h -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Handle.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Thread.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\RarHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\RarHandler.h -# End Source File -# Begin Source File - -SOURCE=.\RarHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\RarHeader.h -# End Source File -# Begin Source File - -SOURCE=.\RarIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\RarIn.h -# End Source File -# Begin Source File - -SOURCE=.\RarItem.cpp -# End Source File -# Begin Source File - -SOURCE=.\RarItem.h -# End Source File -# Begin Source File - -SOURCE=.\RarVolumeInStream.cpp -# End Source File -# Begin Source File - -SOURCE=.\RarVolumeInStream.h -# End Source File -# End Group -# Begin Group "Crypto" - -# PROP Default_Filter "" -# Begin Group "Rar29" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\RarAES\RarAES.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\RarAES\RarAES.h -# End Source File -# End Group -# Begin Group "Rar20" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\Rar20\Rar20Cipher.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Rar20\Rar20Cipher.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Rar20\Rar20Crypto.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Rar20\Rar20Crypto.h -# End Source File -# End Group -# Begin Group "Hash" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha1.cpp - -!IF "$(CFG)" == "Rar - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Rar - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha1.h -# End Source File -# End Group -# End Group -# Begin Group "7-zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethods.cpp -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethods.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\Rar.ico -# End Source File -# End Target -# End Project diff --git a/CPP/7zip/Archive/Rar/Rar.dsw b/CPP/7zip/Archive/Rar/Rar.dsw deleted file mode 100755 index 3dab87aa..00000000 --- a/CPP/7zip/Archive/Rar/Rar.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Rar"=.\Rar.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Rar/RarHandler.cpp b/CPP/7zip/Archive/Rar/RarHandler.cpp index 3389f0e2..5cd3c15d 100755 --- a/CPP/7zip/Archive/Rar/RarHandler.cpp +++ b/CPP/7zip/Archive/Rar/RarHandler.cpp @@ -12,37 +12,19 @@ #include "Windows/Time.h" #include "../../IPassword.h" - -#include "../../Common//ProgressUtils.h" +#include "../../Common/ProgressUtils.h" +#include "../../Common/CreateCoder.h" +#include "../../Common/MethodID.h" +#include "../../Common/FilterCoder.h" #include "../../Compress/Copy/CopyCoder.h" - #include "../../Crypto/Rar20/Rar20Cipher.h" #include "../../Crypto/RarAES/RarAES.h" - #include "../Common/OutStreamWithCRC.h" -#include "../Common/CoderLoader.h" -#include "../Common/CodecsPath.h" -#include "../Common/FilterCoder.h" #include "../Common/ItemNameUtils.h" -#include "../7z/7zMethods.h" - using namespace NWindows; using namespace NTime; -// {23170F69-40C1-278B-0403-010000000000} -DEFINE_GUID(CLSID_CCompressRar15Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0403-020000000000} -DEFINE_GUID(CLSID_CCompressRar20Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0403-030000000000} -DEFINE_GUID(CLSID_CCompressRar29Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00); - - namespace NArchive { namespace NRar { @@ -588,32 +570,11 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, UInt64 currentImportantTotalPacked = 0; UInt64 currentUnPackSize, currentPackSize; - /* - CSysString path = GetCodecsFolderPrefix() + TEXT("Rar29.dll"); - TCHAR compressLibPath[MAX_PATH + 64]; - if (!GetCompressFolderPrefix(compressLibPath)) - return ::GetLastError(); - lstrcat(compressLibPath, TEXT("Rar29.dll")); - */ - N7z::LoadMethodMap(); - CCoderLibraries libraries; CObjectVector<CMethodItem> methodItems; - /* - CCoderLibrary compressLib; - CMyComPtr<ICompressCoder> decoder15; - CMyComPtr<ICompressCoder> decoder20; - CMyComPtr<ICompressCoder> decoder29; - */ - NCompress::CCopyCoder *copyCoderSpec = NULL; CMyComPtr<ICompressCoder> copyCoder; - // CCoderMixer *mixerCoderSpec; - // CMyComPtr<ICompressCoder> mixerCoder; - // bool mixerCoderStoreMethod; - // int mixerCryptoVersion; - CFilterCoder *filterStreamSpec = new CFilterCoder; CMyComPtr<ISequentialInStream> filterStream = filterStreamSpec; @@ -625,6 +586,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, CFolderInStream *folderInStreamSpec = NULL; CMyComPtr<ISequentialInStream> folderInStream; + bool solidStart = true; for(int i = 0; i < importantIndexes.Size(); i++, currentImportantTotalUnPacked += currentUnPackSize, currentImportantTotalPacked += currentPackSize) @@ -654,6 +616,8 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, RINOK(extractCallback->GetStream(index, &realOutStream, askMode)); + if (!IsSolid(index)) + solidStart = true; if(item.IsDirectory()) { RINOK(extractCallback->PrepareOperation(askMode)); @@ -839,25 +803,27 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, { CMethodItem mi; mi.RarUnPackVersion = item.UnPackVersion; - N7z::CMethodID methodID = { { 0x04, 0x03 } , 3 }; - - Byte myID; - if (item.UnPackVersion < 20) - myID = 1; - else if (item.UnPackVersion < 29) - myID = 2; - else - myID = 3; - methodID.ID[2] = myID; - N7z::CMethodInfo methodInfo; - if (!N7z::GetMethodInfo(methodID, methodInfo)) + + mi.Coder.Release(); + if (item.UnPackVersion <= 30) { - RINOK(extractCallback->SetOperationResult( - NArchive::NExtract::NOperationResult::kUnSupportedMethod)); + UInt32 methodID = 0x040300; + if (item.UnPackVersion < 20) + methodID += 1; + else if (item.UnPackVersion < 29) + methodID += 2; + else + methodID += 3; + RINOK(CreateCoder(EXTERNAL_CODECS_VARS methodID, mi.Coder, false)); + } + + if (mi.Coder == 0) + { + outStream.Release(); + RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod)); continue; } - RINOK(libraries.CreateCoder(methodInfo.FilePath, - methodInfo.Decoder, &mi.Coder)); + m = methodItems.Add(mi); } CMyComPtr<ICompressCoder> decoder = methodItems[m].Coder; @@ -867,6 +833,12 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, &compressSetDecoderProperties)); Byte isSolid = (Byte)((IsSolid(index) || item.IsSplitBefore()) ? 1: 0); + if (solidStart) + { + isSolid = false; + solidStart = false; + } + RINOK(compressSetDecoderProperties->SetDecoderProperties2(&isSolid, 1)); @@ -924,18 +896,6 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, COM_TRY_END } -/* -STDMETHODIMP CHandler::ExtractAllItems(Int32 testMode, - IArchiveExtractCallback *extractCallback) -{ - COM_TRY_BEGIN - CRecordVector<UInt32> indices; - indices.Reserve(_refItems.Size()); - for(int i = 0; i < _refItems.Size(); i++) - indices.Add(i); - return Extract(&indices.Front(), _refItems.Size(), testMode, extractCallback); - COM_TRY_END -} -*/ +IMPL_ISetCompressCodecsInfo }} diff --git a/CPP/7zip/Archive/Rar/RarHandler.h b/CPP/7zip/Archive/Rar/RarHandler.h index ea13e01e..d54fd4e5 100755 --- a/CPP/7zip/Archive/Rar/RarHandler.h +++ b/CPP/7zip/Archive/Rar/RarHandler.h @@ -7,15 +7,21 @@ #include "RarIn.h" #include "RarVolumeInStream.h" +#include "../../Common/CreateCoder.h" + namespace NArchive { namespace NRar { class CHandler: public IInArchive, + PUBLIC_ISetCompressCodecsInfo public CMyUnknownImp { public: - MY_UNKNOWN_IMP + MY_QUERYINTERFACE_BEGIN + QUERY_ENTRY_ISetCompressCodecsInfo + MY_QUERYINTERFACE_END + MY_ADDREF_RELEASE STDMETHOD(Open)(IInStream *aStream, const UInt64 *aMaxCheckStartPosition, @@ -36,12 +42,16 @@ public: STDMETHOD(GetArchivePropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType); + DECL_ISetCompressCodecsInfo + private: CRecordVector<CRefItem> _refItems; CObjectVector<CItemEx> _items; CObjectVector<CInArchive> _archives; NArchive::NRar::CInArchiveInfo _archiveInfo; + DECL_EXTERNAL_CODECS_VARS + UInt64 GetPackSize(int refIndex) const; // NArchive::NRar::CInArchive _archive; diff --git a/CPP/7zip/Archive/Rar/RarIn.cpp b/CPP/7zip/Archive/Rar/RarIn.cpp index 9a88feb7..b87199ce 100755 --- a/CPP/7zip/Archive/Rar/RarIn.cpp +++ b/CPP/7zip/Archive/Rar/RarIn.cpp @@ -3,13 +3,17 @@ #include "StdAfx.h" #include "Common/StringConvert.h" -#include "Common/CRC.h" #include "Common/UTFConvert.h" #include "RarIn.h" #include "../../Common/LimitedStreams.h" #include "../../Common/StreamUtils.h" +extern "C" +{ + #include "../../../../C/7zCrc.h" +} + namespace NArchive { namespace NRar { @@ -137,6 +141,23 @@ HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 *processedSize) return result; } +static UInt32 CrcUpdateUInt16(UInt32 crc, UInt16 v) +{ + crc = CRC_UPDATE_BYTE(crc, (Byte)(v & 0xFF)); + crc = CRC_UPDATE_BYTE(crc, (Byte)((v >> 8) & 0xFF)); + return crc; +} + +static UInt32 CrcUpdateUInt32(UInt32 crc, UInt32 v) +{ + crc = CRC_UPDATE_BYTE(crc, (Byte)(v & 0xFF)); + crc = CRC_UPDATE_BYTE(crc, (Byte)((v >> 8) & 0xFF)); + crc = CRC_UPDATE_BYTE(crc, (Byte)((v >> 16) & 0xFF)); + crc = CRC_UPDATE_BYTE(crc, (Byte)((v >> 24) & 0xFF)); + return crc; +} + + bool CInArchive::ReadMarkerAndArchiveHeader(const UInt64 *searchHeaderSizeLimit) { if (!FindAndReadMarker(searchHeaderSizeLimit)) @@ -159,22 +180,22 @@ bool CInArchive::ReadMarkerAndArchiveHeader(const UInt64 *searchHeaderSizeLimit) m_ArchiveHeader.Reserved2 = ReadUInt32(); m_ArchiveHeader.EncryptVersion = 0; - CCRC crc; - crc.UpdateByte(m_ArchiveHeader.Type); - crc.UpdateUInt16(m_ArchiveHeader.Flags); - crc.UpdateUInt16(m_ArchiveHeader.Size); - crc.UpdateUInt16(m_ArchiveHeader.Reserved1); - crc.UpdateUInt32(m_ArchiveHeader.Reserved2); + UInt32 crc = CRC_INIT_VAL; + crc = CRC_UPDATE_BYTE(crc, m_ArchiveHeader.Type); + crc = CrcUpdateUInt16(crc, m_ArchiveHeader.Flags); + crc = CrcUpdateUInt16(crc, m_ArchiveHeader.Size); + crc = CrcUpdateUInt16(crc, m_ArchiveHeader.Reserved1); + crc = CrcUpdateUInt32(crc, m_ArchiveHeader.Reserved2); if (m_ArchiveHeader.IsThereEncryptVer() && m_ArchiveHeader.Size > NHeader::NArchive::kArchiveHeaderSize) { ReadBytes(&m_ArchiveHeader.EncryptVersion, 1, &processedSize); if (processedSize != 1) return false; - crc.UpdateByte(m_ArchiveHeader.EncryptVersion); + crc = CRC_UPDATE_BYTE(crc, m_ArchiveHeader.EncryptVersion); } - if(m_ArchiveHeader.CRC != (crc.GetDigest() & 0xFFFF)) + if(m_ArchiveHeader.CRC != (CRC_GET_DIGEST(crc) & 0xFFFF)) ThrowExceptionWithCode(CInArchiveException::kArchiveHeaderCRCError); if (m_ArchiveHeader.Type != NHeader::NBlockType::kArchiveHeader) return false; @@ -478,7 +499,7 @@ HRESULT CInArchive::GetNextItem(CItemEx &item, ICryptoGetTextPassword *getTextPa m_PosLimit = m_BlockHeader.HeadSize; ReadBytesAndTestResult(m_CurData + m_CurPos, m_BlockHeader.HeadSize - 7); ReadHeaderReal(item); - if ((CCRC::CalculateDigest(m_CurData + 2, + if ((CrcCalc(m_CurData + 2, m_BlockHeader.HeadSize - item.CommentSize - 2) & 0xFFFF) != m_BlockHeader.CRC) ThrowExceptionWithCode(CInArchiveException::kFileHeaderCRCError); diff --git a/CPP/7zip/Archive/Rar/RarRegister.cpp b/CPP/7zip/Archive/Rar/RarRegister.cpp new file mode 100755 index 00000000..def6e480 --- /dev/null +++ b/CPP/7zip/Archive/Rar/RarRegister.cpp @@ -0,0 +1,13 @@ +// RarRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "RarHandler.h" +static IInArchive *CreateArc() { return new NArchive::NRar::CHandler; } + +static CArcInfo g_ArcInfo = + { L"Rar", L"rar", 0, 3, {0x52 , 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00}, 7, false, CreateArc, 0, }; + +REGISTER_ARC(Rar) diff --git a/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp b/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp index 32078e6d..aeb52ecc 100755 --- a/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp +++ b/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp @@ -7,6 +7,11 @@ #include "Windows/Defs.h" #include "Common/Defs.h" +extern "C" +{ + #include "../../../../C/7zCrc.h" +} + namespace NArchive { namespace NRar { @@ -32,7 +37,7 @@ HRESULT CFolderInStream::OpenStream() CreateLimitedStream(item.GetDataPosition(), item.PackSize)); _curIndex++; _fileIsOpen = true; - _crc.Init(); + _crc = CRC_INIT_VAL; return S_OK; } return S_OK; @@ -40,7 +45,7 @@ HRESULT CFolderInStream::OpenStream() HRESULT CFolderInStream::CloseStream() { - CRCs.Add(_crc.GetDigest()); + CRCs.Add(CRC_GET_DIGEST(_crc)); _stream.Release(); _fileIsOpen = false; return S_OK; @@ -56,7 +61,7 @@ STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSiz UInt32 localProcessedSize; RINOK(_stream->Read( ((Byte *)data) + realProcessedSize, size, &localProcessedSize)); - _crc.Update(((Byte *)data) + realProcessedSize, localProcessedSize); + _crc = CrcUpdate(_crc, ((Byte *)data) + realProcessedSize, localProcessedSize); if (localProcessedSize == 0) { RINOK(CloseStream()); diff --git a/CPP/7zip/Archive/Rar/RarVolumeInStream.h b/CPP/7zip/Archive/Rar/RarVolumeInStream.h index 4c9a9e96..7c5902b5 100755 --- a/CPP/7zip/Archive/Rar/RarVolumeInStream.h +++ b/CPP/7zip/Archive/Rar/RarVolumeInStream.h @@ -4,7 +4,6 @@ #define __RAR_VOLUME_IN_STREAM_H #include "../../IStream.h" -#include "Common/CRC.h" #include "RarIn.h" namespace NArchive { @@ -31,7 +30,7 @@ private: const CObjectVector<CItemEx> *_items; CRefItem _refItem; int _curIndex; - CCRC _crc; + UInt32 _crc; bool _fileIsOpen; CMyComPtr<ISequentialInStream> _stream; diff --git a/CPP/7zip/Archive/Rar/makefile b/CPP/7zip/Archive/Rar/makefile deleted file mode 100755 index 678dd412..00000000 --- a/CPP/7zip/Archive/Rar/makefile +++ /dev/null @@ -1,90 +0,0 @@ -PROG = rar.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -RAR_OBJS = \ - $O\DllExports.obj \ - $O\RarHandler.obj \ - $O\RarHeader.obj \ - $O\RarIn.obj \ - $O\RarItem.obj \ - $O\RarVolumeInStream.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\UTFConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\FileFind.obj \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\LimitedStreams.obj \ - $O\ProgressUtils.obj \ - $O\StreamObjects.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CodecsPath.obj \ - $O\FilterCoder.obj \ - $O\InStreamWithCRC.obj \ - $O\OutStreamWithCRC.obj \ - -7Z_OBJS = \ - $O\7zMethodID.obj \ - $O\7zMethods.obj \ - -CRYPTO_HASH_OBJS = \ - $O\Sha1.obj \ - -CRYPTO_RAR20_OBJS = \ - $O\Rar20Cipher.obj \ - $O\Rar20Crypto.obj \ - -CRYPTO_RARAES_OBJS = \ - $O\RarAES.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(RAR_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(CRYPTO_HASH_OBJS) \ - $(CRYPTO_RAR20_OBJS) \ - $(CRYPTO_RARAES_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(RAR_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(7Z_OBJS): ../7z/$(*B).cpp - $(COMPL) -$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp - $(COMPL_O2) -$(CRYPTO_RAR20_OBJS): ../../Crypto/Rar20/$(*B).cpp - $(COMPL) -$(CRYPTO_RARAES_OBJS): ../../Crypto/RarAES/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/Rar/resource.rc b/CPP/7zip/Archive/Rar/resource.rc deleted file mode 100755 index 94b4198b..00000000 --- a/CPP/7zip/Archive/Rar/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Rar Plugin", "rar") - -101 ICON "rar.ico" diff --git a/CPP/7zip/Archive/Split/DllExports.cpp b/CPP/7zip/Archive/Split/DllExports.cpp deleted file mode 100755 index e28f64ce..00000000 --- a/CPP/7zip/Archive/Split/DllExports.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "SplitHandler.h" -#include "../../ICoder.h" - -// {23170F69-40C1-278A-1000-000110EA0000} -DEFINE_GUID(CLSID_CSplitHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xEA, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /* lpReserved */) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CSplitHandler) - return CLASS_E_CLASSNOTAVAILABLE; - if (*interfaceID != IID_IInArchive) - return E_NOINTERFACE; - CMyComPtr<IInArchive> inArchive = (IInArchive *)new NArchive::NSplit::CHandler; - *outObject = inArchive.Detach(); - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Split"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CSplitHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"001"; - break; - case NArchive::kUpdate: - propVariant = false; - break; - case NArchive::kKeepName: - propVariant = true; - break; - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/Split/Split.dsp b/CPP/7zip/Archive/Split/Split.dsp deleted file mode 100755 index d6229d98..00000000 --- a/CPP/7zip/Archive/Split/Split.dsp +++ /dev/null @@ -1,237 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Split" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Split - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Split.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Split.mak" CFG="Split - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Split - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Split - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Split - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPLIT_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPLIT_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\split.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Split - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPLIT_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SPLIT_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\split.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Split - Win32 Release" -# Name "Split - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\Split.ico -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\MultiStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\MultiStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Interface" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\IArchive.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\SplitHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\SplitHandler.h -# End Source File -# Begin Source File - -SOURCE=.\SplitHandlerOut.cpp -# End Source File -# End Target -# End Project diff --git a/CPP/7zip/Archive/Split/Split.dsw b/CPP/7zip/Archive/Split/Split.dsw deleted file mode 100755 index 988ca30a..00000000 --- a/CPP/7zip/Archive/Split/Split.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Split"=.\Split.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Split/SplitRegister.cpp b/CPP/7zip/Archive/Split/SplitRegister.cpp new file mode 100755 index 00000000..56ddba29 --- /dev/null +++ b/CPP/7zip/Archive/Split/SplitRegister.cpp @@ -0,0 +1,20 @@ +// SplitRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "SplitHandler.h" +static IInArchive *CreateArc() { return new NArchive::NSplit::CHandler; } +/* +#ifndef EXTRACT_ONLY +static IOutArchive *CreateArcOut() { return new NArchive::NSplit::CHandler; } +#else +#define CreateArcOut 0 +#endif +*/ + +static CArcInfo g_ArcInfo = +{ L"Split", L"001", 0, 0xEA, { 0 }, 0, false, CreateArc, 0 }; + +REGISTER_ARC(Split) diff --git a/CPP/7zip/Archive/Split/makefile b/CPP/7zip/Archive/Split/makefile deleted file mode 100755 index 650c750b..00000000 --- a/CPP/7zip/Archive/Split/makefile +++ /dev/null @@ -1,51 +0,0 @@ -PROG = split.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -SPLIT_OBJS = \ - $O\DllExports.obj \ - $O\SplitHandler.obj \ - $O\SplitHandlerOut.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\MultiStream.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(SPLIT_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(SPLIT_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/Split/resource.rc b/CPP/7zip/Archive/Split/resource.rc deleted file mode 100755 index 3e301754..00000000 --- a/CPP/7zip/Archive/Split/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Split Plugin", "split") - -101 ICON "Split.ico" diff --git a/CPP/7zip/Archive/StdAfx.h b/CPP/7zip/Archive/StdAfx.h new file mode 100755 index 00000000..99a8aa46 --- /dev/null +++ b/CPP/7zip/Archive/StdAfx.h @@ -0,0 +1,8 @@ +// StdAfx.h + +#ifndef __STDAFX_H +#define __STDAFX_H + +#include "../../Common/MyWindows.h" + +#endif diff --git a/CPP/7zip/Archive/Tar/DllExports.cpp b/CPP/7zip/Archive/Tar/DllExports.cpp deleted file mode 100755 index afa2fd24..00000000 --- a/CPP/7zip/Archive/Tar/DllExports.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "TarHandler.h" - -// {23170F69-40C1-278A-1000-000110EE0000} -DEFINE_GUID(CLSID_CTarHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0xEE, 0x00, 0x00); - -extern "C" -BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /* lpReserved */) -{ - return TRUE; -} - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CTarHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - int needOut = *interfaceID == IID_IOutArchive; - if (needIn || needOut) - { - NArchive::NTar::CHandler *temp = new NArchive::NTar::CHandler; - if (needIn) - { - CMyComPtr<IInArchive> inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - else - { - CMyComPtr<IOutArchive> outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Tar"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CTarHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"tar"; - break; - case NArchive::kUpdate: - propVariant = true; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const unsigned char sig[] = { 'u', 's', 't', 'a', 'r' }; - if ((value->bstrVal = ::SysAllocStringByteLen((const char *)sig, 5)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/Tar/Tar.dsp b/CPP/7zip/Archive/Tar/Tar.dsp deleted file mode 100755 index c01e7383..00000000 --- a/CPP/7zip/Archive/Tar/Tar.dsp +++ /dev/null @@ -1,297 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Tar" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Tar - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Tar.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Tar.mak" CFG="Tar - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Tar - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Tar - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Tar - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\tar.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Tar - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAR_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\tar.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Tar - Win32 Release" -# Name "Tar - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\Tar.ico -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\TarHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\TarHandler.h -# End Source File -# Begin Source File - -SOURCE=.\TarHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\TarHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\TarHeader.h -# End Source File -# Begin Source File - -SOURCE=.\TarIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\TarIn.h -# End Source File -# Begin Source File - -SOURCE=.\TarItem.h -# End Source File -# Begin Source File - -SOURCE=.\TarOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\TarOut.h -# End Source File -# Begin Source File - -SOURCE=.\TarUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=.\TarUpdate.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# End Group -# Begin Group "7zip Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# End Target -# End Project diff --git a/CPP/7zip/Archive/Tar/Tar.dsw b/CPP/7zip/Archive/Tar/Tar.dsw deleted file mode 100755 index 318cce1c..00000000 --- a/CPP/7zip/Archive/Tar/Tar.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Tar"=.\Tar.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Tar/TarRegister.cpp b/CPP/7zip/Archive/Tar/TarRegister.cpp new file mode 100755 index 00000000..3cc0d605 --- /dev/null +++ b/CPP/7zip/Archive/Tar/TarRegister.cpp @@ -0,0 +1,18 @@ +// TarRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "TarHandler.h" +static IInArchive *CreateArc() { return new NArchive::NTar::CHandler; } +#ifndef EXTRACT_ONLY +static IOutArchive *CreateArcOut() { return new NArchive::NTar::CHandler; } +#else +#define CreateArcOut 0 +#endif + +static CArcInfo g_ArcInfo = +{ L"Tar", L"tar", 0, 0xEE, { 'u', 's', 't', 'a', 'r' }, 5, false, CreateArc, CreateArcOut }; + +REGISTER_ARC(Tar) diff --git a/CPP/7zip/Archive/Tar/makefile b/CPP/7zip/Archive/Tar/makefile deleted file mode 100755 index f892c303..00000000 --- a/CPP/7zip/Archive/Tar/makefile +++ /dev/null @@ -1,59 +0,0 @@ -PROG = tar.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib user32.lib - -TAR_OBJS = \ - $O\DllExports.obj \ - $O\TarHandler.obj \ - $O\TarHandlerOut.obj \ - $O\TarHeader.obj \ - $O\TarIn.obj \ - $O\TarOut.obj \ - $O\TarUpdate.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\LimitedStreams.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\ItemNameUtils.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(TAR_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_TAR_OBJS) \ - $O\CopyCoder.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(TAR_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/Tar/resource.rc b/CPP/7zip/Archive/Tar/resource.rc deleted file mode 100755 index 3d37f440..00000000 --- a/CPP/7zip/Archive/Tar/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Tar Plugin", "tar") - -101 ICON "tar.ico" diff --git a/CPP/7zip/Archive/Z/Z.dsp b/CPP/7zip/Archive/Z/Z.dsp deleted file mode 100755 index e1f72522..00000000 --- a/CPP/7zip/Archive/Z/Z.dsp +++ /dev/null @@ -1,237 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Z" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Z - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Z.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Z.mak" CFG="Z - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Z - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Z - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Z - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\z.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Z - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BZIP2_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\z.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Z - Win32 Release" -# Name "Z - Win32 Debug" -# Begin Group "Spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"StdAfx.h" -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# Begin Source File - -SOURCE=.\Z.ico -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# End Group -# Begin Group "Compression" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Z\ZDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Z\ZDecoder.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\DummyOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\DummyOutStream.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ZHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZHandler.h -# End Source File -# End Group -# Begin Group "7zip common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\z.ico -# End Source File -# End Target -# End Project diff --git a/CPP/7zip/Archive/Z/Z.dsw b/CPP/7zip/Archive/Z/Z.dsw deleted file mode 100755 index 1f67186a..00000000 --- a/CPP/7zip/Archive/Z/Z.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Z"=.\Z.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Z/ZRegister.cpp b/CPP/7zip/Archive/Z/ZRegister.cpp new file mode 100755 index 00000000..288dc6ca --- /dev/null +++ b/CPP/7zip/Archive/Z/ZRegister.cpp @@ -0,0 +1,13 @@ +// ZRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "ZHandler.h" +static IInArchive *CreateArc() { return new NArchive::NZ::CHandler; } + +static CArcInfo g_ArcInfo = + { L"Z", L"z taz", L"* .tar", 5, { 0x1F, 0x9D }, 2, false, CreateArc, 0 }; + +REGISTER_ARC(Z) diff --git a/CPP/7zip/Archive/Z/makefile b/CPP/7zip/Archive/Z/makefile deleted file mode 100755 index aff4fc42..00000000 --- a/CPP/7zip/Archive/Z/makefile +++ /dev/null @@ -1,52 +0,0 @@ -PROG = z.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -LIBS = $(LIBS) oleaut32.lib - -Z_OBJS = \ - $O\DllExports.obj \ - $O\ZHandler.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\NewHandler.obj \ - -WIN_OBJS = \ - $O\PropVariant.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\OutBuffer.obj \ - $O\ProgressUtils.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\DummyOutStream.obj \ - -COMPRESS_Z_OBJS = \ - $O\ZDecoder.obj \ - -OBJS = \ - $O\StdAfx.obj \ - $(Z_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(COMPRESS_Z_OBJS) \ - $O\resource.res - -!include "../../../Build.mak" - -$(Z_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(COMPRESS_Z_OBJS): ../../Compress/Z/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/Z/resource.rc b/CPP/7zip/Archive/Z/resource.rc deleted file mode 100755 index 05a81423..00000000 --- a/CPP/7zip/Archive/Z/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Z Plugin", "z") - -101 ICON "Z.ico" diff --git a/CPP/7zip/Archive/Zip/DllExports.cpp b/CPP/7zip/Archive/Zip/DllExports.cpp deleted file mode 100755 index da2a15a4..00000000 --- a/CPP/7zip/Archive/Zip/DllExports.cpp +++ /dev/null @@ -1,152 +0,0 @@ -// DLLExports.cpp - -#include "StdAfx.h" - -#include "Common/MyInitGuid.h" -#include "Common/ComTry.h" -#include "ZipHandler.h" -#include "Windows/PropVariant.h" -#include "../../ICoder.h" -#include "../../IPassword.h" -#include "../../Crypto/WzAES/WzAES.h" -#include "../Common/CodecsPath.h" - -// {23170F69-40C1-278B-0401-080000000100} -DEFINE_GUID(CLSID_CCompressDeflateEncoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-0401-080000000000} -DEFINE_GUID(CLSID_CCompressDeflateDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0401-090000000100} -DEFINE_GUID(CLSID_CCompressDeflate64Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-0401-090000000000} -DEFINE_GUID(CLSID_CCompressDeflate64Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0402-020000000100} -DEFINE_GUID(CLSID_CCompressBZip2Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-0402-020000000000} -DEFINE_GUID(CLSID_CCompressBZip2Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-0401-060000000000} -DEFINE_GUID(CLSID_CCompressImplodeDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278B-06F1-0101000000100} -DEFINE_GUID(CLSID_CCryptoZipEncoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00); - -// {23170F69-40C1-278B-06F1-0101000000000} -DEFINE_GUID(CLSID_CCryptoZipDecoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00); - -// {23170F69-40C1-278A-1000-000110010000} -DEFINE_GUID(CLSID_CZipHandler, - 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x01, 0x00, 0x00); - -HINSTANCE g_hInstance; -#ifndef _UNICODE -bool g_IsNT = false; -static bool IsItWindowsNT() -{ - OSVERSIONINFO versionInfo; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - if (!::GetVersionEx(&versionInfo)) - return false; - return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT); -} -#endif - -void GetCryptoFolderPrefix(TCHAR *path) -{ - CSysString s = GetCodecsFolderPrefix(); - lstrcpy(path, s); -} - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) -{ - if (dwReason == DLL_PROCESS_ATTACH) - { - g_hInstance = hInstance; - #ifndef _UNICODE - g_IsNT = IsItWindowsNT(); - #endif - } - return TRUE; -} - - -STDAPI CreateObject( - const GUID *classID, - const GUID *interfaceID, - void **outObject) -{ - COM_TRY_BEGIN - *outObject = 0; - if (*classID != CLSID_CZipHandler) - return CLASS_E_CLASSNOTAVAILABLE; - int needIn = *interfaceID == IID_IInArchive; - int needOut = *interfaceID == IID_IOutArchive; - if (needIn || needOut) - { - NArchive::NZip::CHandler *temp = new NArchive::NZip::CHandler; - if (needIn) - { - CMyComPtr<IInArchive> inArchive = (IInArchive *)temp; - *outObject = inArchive.Detach(); - } - else - { - CMyComPtr<IOutArchive> outArchive = (IOutArchive *)temp; - *outObject = outArchive.Detach(); - } - } - else - return E_NOINTERFACE; - COM_TRY_END - return S_OK; -} - -STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant propVariant; - switch(propID) - { - case NArchive::kName: - propVariant = L"Zip"; - break; - case NArchive::kClassID: - { - if ((value->bstrVal = ::SysAllocStringByteLen( - (const char *)&CLSID_CZipHandler, sizeof(GUID))) != 0) - value->vt = VT_BSTR; - return S_OK; - } - case NArchive::kExtension: - propVariant = L"zip jar xpi"; - break; - case NArchive::kUpdate: - propVariant = true; - break; - case NArchive::kKeepName: - propVariant = false; - break; - case NArchive::kStartSignature: - { - const char sig[] = { 0x50, 0x4B, 0x03, 0x04 }; - if ((value->bstrVal = ::SysAllocStringByteLen(sig, 4)) != 0) - value->vt = VT_BSTR; - return S_OK; - } - } - propVariant.Detach(value); - return S_OK; -} diff --git a/CPP/7zip/Archive/Zip/Zip.dsp b/CPP/7zip/Archive/Zip/Zip.dsp deleted file mode 100755 index 2ac27f4f..00000000 --- a/CPP/7zip/Archive/Zip/Zip.dsp +++ /dev/null @@ -1,651 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Zip" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Zip - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Zip.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Zip.mak" CFG="Zip - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Zip - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Zip - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Zip - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZIP_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZIP_EXPORTS" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Formats\zip.dll" /opt:NOWIN98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Zip - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 1 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZIP_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZIP_EXPORTS" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Formats\zip.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Zip - Win32 Release" -# Name "Zip - Win32 Debug" -# Begin Group "spec" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Archive.def -# End Source File -# Begin Source File - -SOURCE=.\DllExports.cpp -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Alloc.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\AutoPtr.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\CRC.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\IntToString.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\NewHandler.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Random.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Random.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\String.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringConvert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\StringToInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Common\Vector.h -# End Source File -# End Group -# Begin Group "Windows" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\DLL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\FileFind.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\PropVariant.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Synchronization.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\Windows\Thread.h -# End Source File -# End Group -# Begin Group "Archive Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\Common\CodecsPath.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CodecsPath.h -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\CoderLoader.h -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\FilterCoder.h -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\InStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ItemNameUtils.h -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\OutStreamWithCRC.h -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.cpp -# End Source File -# Begin Source File - -SOURCE=..\Common\ParseProperties.h -# End Source File -# End Group -# Begin Group "7zip common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Common\InBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\InBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LimitedStreams.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\LSBFDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MemBlocks.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\MemBlocks.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OffsetStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OffsetStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutMemStream.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\OutMemStream.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressMt.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressMt.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\ProgressUtils.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamObjects.h -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Common\StreamUtils.h -# End Source File -# End Group -# Begin Group "Engine" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ZipAddCommon.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipAddCommon.h -# End Source File -# Begin Source File - -SOURCE=.\ZipCompressionMode.h -# End Source File -# Begin Source File - -SOURCE=.\ZipHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipHandler.h -# End Source File -# Begin Source File - -SOURCE=.\ZipHandlerOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipHeader.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipHeader.h -# End Source File -# Begin Source File - -SOURCE=.\ZipIn.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipIn.h -# End Source File -# Begin Source File - -SOURCE=.\ZipItem.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipItem.h -# End Source File -# Begin Source File - -SOURCE=.\ZipItemEx.h -# End Source File -# Begin Source File - -SOURCE=.\ZipOut.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipOut.h -# End Source File -# Begin Source File - -SOURCE=.\ZipUpdate.cpp -# End Source File -# Begin Source File - -SOURCE=.\ZipUpdate.h -# End Source File -# End Group -# Begin Group "Crypto" - -# PROP Default_Filter "" -# Begin Group "WzAes" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\WzAES\WzAES.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\WzAES\WzAES.h -# End Source File -# End Group -# Begin Group "Hash" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Crypto\Hash\HmacSha1.cpp - -!IF "$(CFG)" == "Zip - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Zip - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\HmacSha1.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Pbkdf2HmacSha1.cpp - -!IF "$(CFG)" == "Zip - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Zip - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Pbkdf2HmacSha1.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\RandGen.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\RandGen.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\RotateDefs.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha1.cpp - -!IF "$(CFG)" == "Zip - Win32 Release" - -# ADD CPP /O2 -# SUBTRACT CPP /YX /Yc /Yu - -!ELSEIF "$(CFG)" == "Zip - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Hash\Sha1.h -# End Source File -# End Group -# Begin Source File - -SOURCE=..\..\Crypto\Zip\ZipCipher.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Zip\ZipCipher.h -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Zip\ZipCrypto.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Crypto\Zip\ZipCrypto.h -# End Source File -# End Group -# Begin Group "7z" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\7z\7zMethodID.cpp -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethodID.h -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethods.cpp -# End Source File -# Begin Source File - -SOURCE=..\7z\7zMethods.h -# End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "Shrink" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Shrink\ShrinkDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Shrink\ShrinkDecoder.h -# End Source File -# End Group -# Begin Group "copy" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Copy\CopyCoder.h -# End Source File -# End Group -# Begin Group "Implode" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\Implode\ImplodeDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Implode\ImplodeDecoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Implode\ImplodeHuffmanDecoder.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\Implode\ImplodeHuffmanDecoder.h -# End Source File -# End Group -# Begin Group "LZ" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZ\LZOutWindow.h -# End Source File -# End Group -# End Group -# Begin Source File - -SOURCE=.\zip.ico -# End Source File -# End Target -# End Project diff --git a/CPP/7zip/Archive/Zip/Zip.dsw b/CPP/7zip/Archive/Zip/Zip.dsw deleted file mode 100755 index 0a355329..00000000 --- a/CPP/7zip/Archive/Zip/Zip.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Zip"=.\Zip.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/CPP/7zip/Archive/Zip/ZipAddCommon.cpp b/CPP/7zip/Archive/Zip/ZipAddCommon.cpp index 7eb2787f..9d8737d8 100755 --- a/CPP/7zip/Archive/Zip/ZipAddCommon.cpp +++ b/CPP/7zip/Archive/Zip/ZipAddCommon.cpp @@ -2,53 +2,27 @@ #include "StdAfx.h" -#include "Common/CRC.h" +extern "C" +{ +#include "../../../../C/7zCrc.h" +} + #include "Windows/PropVariant.h" #include "Windows/Defs.h" #include "../../ICoder.h" #include "../../IPassword.h" +#include "../../Common/CreateCoder.h" #include "../Common/InStreamWithCRC.h" -#include "../7z/7zMethods.h" #include "ZipAddCommon.h" #include "ZipHeader.h" -#ifdef COMPRESS_DEFLATE -#include "../../Compress/Deflate/DeflateEncoder.h" -#else -// {23170F69-40C1-278B-0401-080000000100} -DEFINE_GUID(CLSID_CCompressDeflateEncoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00); -#endif - -#ifdef COMPRESS_DEFLATE64 -#include "../../Compress/Deflate/DeflateEncoder.h" -#else -// {23170F69-40C1-278B-0401-090000000100} -DEFINE_GUID(CLSID_CCompressDeflate64Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00); -#endif - -#ifdef COMPRESS_BZIP2 -#include "../../Compress/BZip2/BZip2Encoder.h" -#else -// {23170F69-40C1-278B-0402-020000000100} -DEFINE_GUID(CLSID_CCompressBZip2Encoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00); -#endif - - -#ifdef CRYPTO_ZIP -#include "../../Crypto/Zip/ZipCipher.h" -#else -// {23170F69-40C1-278B-06F1-0101000000100} -DEFINE_GUID(CLSID_CCryptoZipEncoder, -0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00); -#endif - namespace NArchive { namespace NZip { +static const CMethodId kMethodId_ZipBase = 0x040100; +static const CMethodId kMethodId_BZip2 = 0x040202; + CAddCommon::CAddCommon(const CCompressionMethodMode &options): _options(options), _copyCoderSpec(NULL), @@ -57,8 +31,7 @@ CAddCommon::CAddCommon(const CCompressionMethodMode &options): static HRESULT GetStreamCRC(ISequentialInStream *inStream, UInt32 &resultCRC) { - CCRC crc; - crc.Init(); + UInt32 crc = CRC_INIT_VAL; const UInt32 kBufferSize = (1 << 14); Byte buffer[kBufferSize]; for (;;) @@ -67,15 +40,17 @@ static HRESULT GetStreamCRC(ISequentialInStream *inStream, UInt32 &resultCRC) RINOK(inStream->Read(buffer, kBufferSize, &realProcessedSize)); if(realProcessedSize == 0) { - resultCRC = crc.GetDigest(); + resultCRC = CRC_GET_DIGEST(crc); return S_OK; } - crc.Update(buffer, realProcessedSize); + crc = CrcUpdate(crc, buffer, realProcessedSize); } } -HRESULT CAddCommon::Compress(ISequentialInStream *inStream, IOutStream *outStream, - ICompressProgressInfo *progress, CCompressingResult &operationResult) +HRESULT CAddCommon::Compress( + DECL_EXTERNAL_CODECS_LOC_VARS + ISequentialInStream *inStream, IOutStream *outStream, + ICompressProgressInfo *progress, CCompressingResult &operationResult) { CSequentialInStreamWithCRC *inSecCrcStreamSpec = 0; CInStreamWithCRC *inCrcStreamSpec = 0; @@ -170,48 +145,21 @@ HRESULT CAddCommon::Compress(ISequentialInStream *inStream, IOutStream *outStrea { if(!_compressEncoder) { - // RINOK(m_MatchFinder.CoCreateInstance(CLSID_CMatchFinderBT3)); - #ifndef COMPRESS_DEFLATE - UString methodName; - N7z::LoadMethodMap(); - #endif + CMethodId methodId; switch(method) { - case NFileHeader::NCompressionMethod::kDeflated: - { - #ifdef COMPRESS_DEFLATE - _compressEncoder = new NCompress::NDeflate::NEncoder::CCOMCoder; - #else - methodName = L"Deflate"; - #endif - break; - } - case NFileHeader::NCompressionMethod::kDeflated64: - { - #ifdef COMPRESS_DEFLATE64 - _compressEncoder = new NCompress::NDeflate::NEncoder::CCOMCoder64; - #else - methodName = L"Deflate64"; - #endif - break; - } case NFileHeader::NCompressionMethod::kBZip2: - { - #ifdef COMPRESS_BZIP2 - _compressEncoder = new NCompress::NBZip2::CEncoder; - #else - methodName = L"BZip2"; - #endif + methodId = kMethodId_BZip2; + break; + default: + methodId = kMethodId_ZipBase + method; break; - } } - #ifndef COMPRESS_DEFLATE - N7z::CMethodInfo2 methodInfo; - if (!N7z::GetMethodInfo(methodName, methodInfo)) + RINOK(CreateCoder( + EXTERNAL_CODECS_LOC_VARS + methodId, _compressEncoder, true)); + if (!_compressEncoder) return E_NOTIMPL; - RINOK(_compressLib.LoadAndCreateCoder( - methodInfo.FilePath, methodInfo.Encoder, &_compressEncoder)); - #endif if (method == NFileHeader::NCompressionMethod::kDeflated || method == NFileHeader::NCompressionMethod::kDeflated64) diff --git a/CPP/7zip/Archive/Zip/ZipAddCommon.h b/CPP/7zip/Archive/Zip/ZipAddCommon.h index 26cec643..7bce0cbe 100755 --- a/CPP/7zip/Archive/Zip/ZipAddCommon.h +++ b/CPP/7zip/Archive/Zip/ZipAddCommon.h @@ -6,14 +6,14 @@ #include "../../ICoder.h" #include "../../IProgress.h" #include "../../Compress/Copy/CopyCoder.h" -#ifndef COMPRESS_DEFLATE -#include "../Common/CoderLoader.h" -#endif -#include "../Common/FilterCoder.h" -#include "ZipCompressionMode.h" + +#include "../../Common/CreateCoder.h" +#include "../../Common/FilterCoder.h" #include "../../Crypto/Zip/ZipCipher.h" #include "../../Crypto/WzAES/WzAES.h" +#include "ZipCompressionMode.h" + namespace NArchive { namespace NZip { @@ -32,9 +32,6 @@ class CAddCommon NCompress::CCopyCoder *_copyCoderSpec; CMyComPtr<ICompressCoder> _copyCoder; - #ifndef COMPRESS_DEFLATE - CCoderLibrary _compressLib; - #endif CMyComPtr<ICompressCoder> _compressEncoder; CFilterCoder *_cryptoStreamSpec; @@ -49,7 +46,9 @@ class CAddCommon public: CAddCommon(const CCompressionMethodMode &options); - HRESULT Compress(ISequentialInStream *inStream, IOutStream *outStream, + HRESULT Compress( + DECL_EXTERNAL_CODECS_LOC_VARS + ISequentialInStream *inStream, IOutStream *outStream, ICompressProgressInfo *progress, CCompressingResult &operationResult); }; diff --git a/CPP/7zip/Archive/Zip/ZipHandler.cpp b/CPP/7zip/Archive/Zip/ZipHandler.cpp index 4672d768..7f906999 100755 --- a/CPP/7zip/Archive/Zip/ZipHandler.cpp +++ b/CPP/7zip/Archive/Zip/ZipHandler.cpp @@ -5,7 +5,6 @@ #include "ZipHandler.h" #include "Common/Defs.h" -#include "Common/CRC.h" #include "Common/StringConvert.h" #include "Common/ComTry.h" #include "Common/IntToString.h" @@ -17,63 +16,31 @@ #include "../../Common/ProgressUtils.h" #include "../../Common/StreamObjects.h" +#include "../../Common/CreateCoder.h" +#include "../../Common/FilterCoder.h" #include "../../Compress/Copy/CopyCoder.h" #include "../Common/ItemNameUtils.h" #include "../Common/OutStreamWithCRC.h" -#include "../Common/FilterCoder.h" -#include "../7z/7zMethods.h" #include "../../Compress/Shrink/ShrinkDecoder.h" #include "../../Compress/Implode/ImplodeDecoder.h" -#ifdef COMPRESS_DEFLATE -#include "../../Compress/Deflate/DeflateDecoder.h" -#else -// {23170F69-40C1-278B-0401-080000000000} -DEFINE_GUID(CLSID_CCompressDeflateDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00); -#endif - -#ifdef COMPRESS_DEFLATE64 -#include "../../Compress/Deflate/DeflateDecoder.h" -#else -// {23170F69-40C1-278B-0401-090000000000} -DEFINE_GUID(CLSID_CCompressDeflate64Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00); -#endif - -/* -#ifdef COMPRESS_IMPLODE -#else -// {23170F69-40C1-278B-0401-060000000000} -DEFINE_GUID(CLSID_CCompressImplodeDecoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00); -#endif -*/ - -#ifdef COMPRESS_BZIP2 -#include "../../Compress/BZip2/BZip2Decoder.h" -#else -// {23170F69-40C1-278B-0402-020000000000} -DEFINE_GUID(CLSID_CCompressBZip2Decoder, -0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00); -#endif #include "../../Crypto/Zip/ZipCipher.h" #include "../../Crypto/WzAES/WzAES.h" -#ifndef EXCLUDE_COM -#include "../Common/CoderLoader.h" -#endif - using namespace NWindows; using namespace NTime; namespace NArchive { namespace NZip { +static const CMethodId kMethodId_Store = 0; +static const CMethodId kMethodId_ZipBase = 0x040100; +static const CMethodId kMethodId_BZip2 = 0x040202; + const wchar_t *kHostOS[] = { L"FAT", @@ -389,29 +356,23 @@ class CZipDecoder CFilterCoder *filterStreamSpec; CMyComPtr<ISequentialInStream> filterStream; CMyComPtr<ICryptoGetTextPassword> getTextPassword; - #ifndef EXCLUDE_COM - CCoderLibraries libraries; - #endif CObjectVector<CMethodItem> methodItems; public: CZipDecoder(): _zipCryptoDecoderSpec(0), _aesDecoderSpec(0), filterStreamSpec(0) {} - static void Init() - { - #ifndef EXCLUDE_COM - N7z::LoadMethodMap(); - #endif - } - - HRESULT Decode(CInArchive &archive, const CItemEx &item, + HRESULT Decode( + DECL_EXTERNAL_CODECS_LOC_VARS + CInArchive &archive, const CItemEx &item, ISequentialOutStream *realOutStream, IArchiveExtractCallback *extractCallback, ICompressProgressInfo *compressProgress, UInt32 numThreads, Int32 &res); }; -HRESULT CZipDecoder::Decode(CInArchive &archive, const CItemEx &item, +HRESULT CZipDecoder::Decode( + DECL_EXTERNAL_CODECS_LOC_VARS + CInArchive &archive, const CItemEx &item, ISequentialOutStream *realOutStream, IArchiveExtractCallback *extractCallback, ICompressProgressInfo *compressProgress, @@ -544,49 +505,26 @@ HRESULT CZipDecoder::Decode(CInArchive &archive, const CItemEx &item, mi.Coder = new NCompress::NImplode::NDecoder::CCoder; else { - #ifdef EXCLUDE_COM - switch(methodId) - { - case NFileHeader::NCompressionMethod::kDeflated: - mi.Coder = new NCompress::NDeflate::NDecoder::CCOMCoder; - break; - case NFileHeader::NCompressionMethod::kDeflated64: - mi.Coder = new NCompress::NDeflate::NDecoder::CCOMCoder64; - break; - case NFileHeader::NCompressionMethod::kBZip2: - mi.Coder = new NCompress::NBZip2::CDecoder; - break; - default: - res = NArchive::NExtract::NOperationResult::kUnSupportedMethod; - return S_OK; - } - #else - N7z::CMethodID methodID = { { 0x04, 0x01 } , 3 }; - if (methodId > 0xFF) - { - res = NArchive::NExtract::NOperationResult::kUnSupportedMethod; - return S_OK; - } - methodID.ID[2] = (Byte)methodId; - if (methodId == NFileHeader::NCompressionMethod::kStored) - { - methodID.ID[0] = 0; - methodID.IDSize = 1; - } - else if (methodId == NFileHeader::NCompressionMethod::kBZip2) + CMethodId szMethodID; + if (methodId == NFileHeader::NCompressionMethod::kBZip2) + szMethodID = kMethodId_BZip2; + else { - methodID.ID[1] = 0x02; - methodID.ID[2] = 0x02; + if (methodId > 0xFF) + { + res = NArchive::NExtract::NOperationResult::kUnSupportedMethod; + return S_OK; + } + szMethodID = kMethodId_ZipBase + (Byte)methodId; } - - N7z::CMethodInfo methodInfo; - if (!N7z::GetMethodInfo(methodID, methodInfo)) + + RINOK(CreateCoder(EXTERNAL_CODECS_LOC_VARS szMethodID, mi.Coder, false)); + + if (mi.Coder == 0) { res = NArchive::NExtract::NOperationResult::kUnSupportedMethod; return S_OK; } - RINOK(libraries.CreateCoder(methodInfo.FilePath, methodInfo.Decoder, &mi.Coder)); - #endif } m = methodItems.Add(mi); } @@ -696,8 +634,6 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, CLocalCompressProgressInfo *localCompressProgressSpec = new CLocalCompressProgressInfo; CMyComPtr<ICompressProgressInfo> compressProgress = localCompressProgressSpec; - CZipDecoder::Init(); - for (i = 0; i < numItems; i++, currentTotalUnPacked += currentItemUnPacked, currentTotalPacked += currentItemPacked) { @@ -753,7 +689,9 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, localCompressProgressSpec->Init(progress, ¤tTotalPacked, ¤tTotalUnPacked); Int32 res; - RINOK(myDecoder.Decode(m_Archive, item, realOutStream, extractCallback, + RINOK(myDecoder.Decode( + EXTERNAL_CODECS_VARS + m_Archive, item, realOutStream, extractCallback, compressProgress, _numThreads, res)); realOutStream.Release(); @@ -763,4 +701,6 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, COM_TRY_END } +IMPL_ISetCompressCodecsInfo + }} diff --git a/CPP/7zip/Archive/Zip/ZipHandler.h b/CPP/7zip/Archive/Zip/ZipHandler.h index ea6becd0..45dc8ad6 100755 --- a/CPP/7zip/Archive/Zip/ZipHandler.h +++ b/CPP/7zip/Archive/Zip/ZipHandler.h @@ -7,6 +7,8 @@ #include "../../ICoder.h" #include "../IArchive.h" +#include "../../Common/CreateCoder.h" + #include "ZipIn.h" #include "ZipCompressionMode.h" @@ -21,14 +23,17 @@ class CHandler: public IInArchive, public IOutArchive, public ISetProperties, + PUBLIC_ISetCompressCodecsInfo public CMyUnknownImp { public: - MY_UNKNOWN_IMP3( - IInArchive, - IOutArchive, - ISetProperties - ) + MY_QUERYINTERFACE_BEGIN + MY_QUERYINTERFACE_ENTRY(IInArchive) + MY_QUERYINTERFACE_ENTRY(IOutArchive) + MY_QUERYINTERFACE_ENTRY(ISetProperties) + QUERY_ENTRY_ISetCompressCodecsInfo + MY_QUERYINTERFACE_END + MY_ADDREF_RELEASE STDMETHOD(Open)(IInStream *aStream, const UInt64 *aMaxCheckStartPosition, @@ -57,6 +62,8 @@ public: // ISetProperties STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties); + DECL_ISetCompressCodecsInfo + CHandler(); private: CObjectVector<CItemEx> m_Items; @@ -78,6 +85,8 @@ private: UInt32 _numThreads; #endif + DECL_EXTERNAL_CODECS_VARS + void InitMethodProperties() { m_Level = -1; diff --git a/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp b/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp index e2394172..ba5199dc 100755 --- a/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp +++ b/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp @@ -264,7 +264,9 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt kBZip2DicSizeX1)); } - return Update(m_Items, updateItems, outStream, + return Update( + EXTERNAL_CODECS_VARS + m_Items, updateItems, outStream, m_ArchiveIsOpen ? &m_Archive : NULL, &options, updateCallback); COM_TRY_END } diff --git a/CPP/7zip/Archive/Zip/ZipIn.cpp b/CPP/7zip/Archive/Zip/ZipIn.cpp index c9e3a7d1..7c5ecbfb 100755 --- a/CPP/7zip/Archive/Zip/ZipIn.cpp +++ b/CPP/7zip/Archive/Zip/ZipIn.cpp @@ -43,6 +43,22 @@ static inline bool TestMarkerCandidate(const Byte *p, UInt32 &value) (value == NSignature::kEndOfCentralDir); } +static const UInt32 kNumMarkerAddtionalBytes = 2; +static inline bool TestMarkerCandidate2(const Byte *p, UInt32 &value) +{ + value = p[0] | (((UInt32)p[1]) << 8) | (((UInt32)p[2]) << 16) | (((UInt32)p[3]) << 24); + if (value == NSignature::kEndOfCentralDir) + { + UInt16 nextWord = p[0] | (((UInt16)p[1]) << 8); + return (nextWord == 0); + } + if (value != NSignature::kLocalFileHeader) + return false; + if (p[0] > 128) + return false; + return true; +} + bool CInArchive::FindAndReadMarker(const UInt64 *searchHeaderSizeLimit) { m_ArchiveInfo.Clear(); @@ -73,12 +89,13 @@ bool CInArchive::FindAndReadMarker(const UInt64 *searchHeaderSizeLimit) UInt32 numReadBytes = kSearchMarkerBufferSize - numBytesPrev; ReadBytes(buffer + numBytesPrev, numReadBytes, &processedSize); UInt32 numBytesInBuffer = numBytesPrev + processedSize; - if (numBytesInBuffer < NSignature::kMarkerSize) + const UInt32 kMarker2Size = NSignature::kMarkerSize + kNumMarkerAddtionalBytes; + if (numBytesInBuffer < kMarker2Size) break; - UInt32 numTests = numBytesInBuffer - NSignature::kMarkerSize + 1; + UInt32 numTests = numBytesInBuffer - kMarker2Size + 1; for(UInt32 pos = 0; pos < numTests; pos++, curTestPos++) { - if (TestMarkerCandidate(buffer + pos, m_Signature)) + if (TestMarkerCandidate2(buffer + pos, m_Signature)) { m_ArchiveInfo.StartPosition = curTestPos; // m_ArchiveInfo.Base = m_ArchiveInfo.StartPosition; @@ -324,8 +341,11 @@ HRESULT CInArchive::ReadLocalItemAfterCdItem(CItemEx &item) RINOK(ReadLocalItem(localItem)); if (item.Flags != localItem.Flags) { - if (item.CompressionMethod != NFileHeader::NCompressionMethod::kDeflated || - (item.Flags & 0xFFFC) != (localItem.Flags & 0xFFFC)) + if ((item.CompressionMethod != NFileHeader::NCompressionMethod::kDeflated || + (item.Flags & 0x7FFC) != (localItem.Flags & 0x7FFC)) && + ((item.CompressionMethod != NFileHeader::NCompressionMethod::kStored || + (item.Flags & 0x7FFF) != (localItem.Flags & 0x7FFF)) + )) return S_FALSE; } diff --git a/CPP/7zip/Archive/Zip/ZipOut.cpp b/CPP/7zip/Archive/Zip/ZipOut.cpp index 7575d320..1f108235 100755 --- a/CPP/7zip/Archive/Zip/ZipOut.cpp +++ b/CPP/7zip/Archive/Zip/ZipOut.cpp @@ -4,7 +4,6 @@ #include "ZipOut.h" #include "Common/StringConvert.h" -#include "Common/CRC.h" #include "../../Common/OffsetStream.h" #include "../../Common/StreamUtils.h" diff --git a/CPP/7zip/Archive/Zip/ZipRegister.cpp b/CPP/7zip/Archive/Zip/ZipRegister.cpp new file mode 100755 index 00000000..12db3e44 --- /dev/null +++ b/CPP/7zip/Archive/Zip/ZipRegister.cpp @@ -0,0 +1,18 @@ +// ZipRegister.cpp + +#include "StdAfx.h" + +#include "../../Common/RegisterArc.h" + +#include "ZipHandler.h" +static IInArchive *CreateArc() { return new NArchive::NZip::CHandler; } +#ifndef EXTRACT_ONLY +static IOutArchive *CreateArcOut() { return new NArchive::NZip::CHandler; } +#else +#define CreateArcOut 0 +#endif + +static CArcInfo g_ArcInfo = + { L"Zip", L"zip jar xpi", 0, 1, { 0x50, 0x4B, 0x03, 0x04 }, 4, false, CreateArc, CreateArcOut }; + +REGISTER_ARC(Zip) diff --git a/CPP/7zip/Archive/Zip/ZipUpdate.cpp b/CPP/7zip/Archive/Zip/ZipUpdate.cpp index f66fcef9..e14cd693 100755 --- a/CPP/7zip/Archive/Zip/ZipUpdate.cpp +++ b/CPP/7zip/Archive/Zip/ZipUpdate.cpp @@ -20,6 +20,7 @@ #endif #include "../../Common/LimitedStreams.h" #include "../../Common/OutMemStream.h" +#include "../../Common/CreateCoder.h" #include "../../Compress/Copy/CopyCoder.h" @@ -138,6 +139,11 @@ static DWORD WINAPI CoderThread(void *threadCoderInfo); struct CThreadInfo { + #ifdef EXTERNAL_CODECS + CMyComPtr<ICompressCodecsInfo> _codecsInfo; + const CObjectVector<CCodecInfoEx> *_externalCodecs; + #endif + NWindows::CThread Thread; CAutoResetEvent *CompressEvent; CAutoResetEvent *CompressionCompletedEvent; @@ -203,7 +209,11 @@ void CThreadInfo::WaitAndCode() CompressEvent->Lock(); if (ExitThread) return; - Result = Coder.Compress(InStream, OutStream, Progress, CompressingResult); + Result = Coder.Compress( + #ifdef EXTERNAL_CODECS + _codecsInfo, _externalCodecs, + #endif + InStream, OutStream, Progress, CompressingResult); if (Result == S_OK && Progress) Result = Progress->SetRatioInfo(&CompressingResult.UnpackSize, &CompressingResult.PackSize); CompressionCompletedEvent->Set(); @@ -301,7 +311,9 @@ static HRESULT WriteDirHeader(COutArchive &archive, const CCompressionMethodMode return archive.WriteLocalHeader(item); } -static HRESULT Update2St(COutArchive &archive, +static HRESULT Update2St( + DECL_EXTERNAL_CODECS_LOC_VARS + COutArchive &archive, CInArchive *inArchive, IInStream *inStream, const CObjectVector<CItemEx> &inputItems, @@ -360,7 +372,9 @@ static HRESULT Update2St(COutArchive &archive, CMyComPtr<IOutStream> outStream; archive.CreateStreamForCompressing(&outStream); localCompressProgressSpec->Init(localProgress, &complexity, NULL); - RINOK(compressor.Compress(fileInStream, outStream, compressProgress, compressingResult)); + RINOK(compressor.Compress( + EXTERNAL_CODECS_LOC_VARS + fileInStream, outStream, compressProgress, compressingResult)); SetItemInfoFromCompressingResult(compressingResult, options->IsAesMode, options->AesKeyMode, item); RINOK(archive.WriteLocalHeader(item)); RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK)); @@ -379,7 +393,9 @@ static HRESULT Update2St(COutArchive &archive, return S_OK; } -static HRESULT Update2(COutArchive &archive, +static HRESULT Update2( + DECL_EXTERNAL_CODECS_LOC_VARS + COutArchive &archive, CInArchive *inArchive, IInStream *inStream, const CObjectVector<CItemEx> &inputItems, @@ -472,7 +488,9 @@ static HRESULT Update2(COutArchive &archive, if (!mtMode) #endif - return Update2St(archive, inArchive,inStream, + return Update2St( + EXTERNAL_CODECS_LOC_VARS + archive, inArchive,inStream, inputItems, updateItems, options, comment, updateCallback); @@ -512,6 +530,10 @@ static HRESULT Update2(COutArchive &archive, for (i = 0; i < numThreads; i++) { CThreadInfo &threadInfo = threads.Threads[i]; + #ifdef EXTERNAL_CODECS + threadInfo._codecsInfo = codecsInfo; + threadInfo._externalCodecs = externalCodecs; + #endif threadInfo.CreateEvents(); threadInfo.OutStreamSpec = new COutMemStream(&memManager); threadInfo.OutStream = threadInfo.OutStreamSpec; @@ -572,6 +594,11 @@ static HRESULT Update2(COutArchive &archive, { threadInfo.IsFree = false; threadInfo.InStream = fileInStream; + + // !!!!! we must release ref before sending event + // BUG was here in v4.43 and v4.44. It could change ref counter in two threads in same time + fileInStream.Release(); + threadInfo.OutStreamSpec->Init(); threadInfo.ProgressSpec->Reinit(); threadInfo.CompressEvent->Set(); @@ -690,6 +717,7 @@ static HRESULT Update2(COutArchive &archive, } HRESULT Update( + DECL_EXTERNAL_CODECS_LOC_VARS const CObjectVector<CItemEx> &inputItems, const CObjectVector<CUpdateItem> &updateItems, ISequentialOutStream *seqOutStream, @@ -725,7 +753,9 @@ HRESULT Update( if(inArchive != 0) inStream.Attach(inArchive->CreateStream()); - return Update2(outArchive, inArchive, inStream, + return Update2( + EXTERNAL_CODECS_LOC_VARS + outArchive, inArchive, inStream, inputItems, updateItems, compressionMethodMode, archiveInfo.Comment, updateCallback); diff --git a/CPP/7zip/Archive/Zip/ZipUpdate.h b/CPP/7zip/Archive/Zip/ZipUpdate.h index d846b05f..8b03cfa3 100755 --- a/CPP/7zip/Archive/Zip/ZipUpdate.h +++ b/CPP/7zip/Archive/Zip/ZipUpdate.h @@ -9,6 +9,8 @@ #include "../../ICoder.h" #include "../IArchive.h" +#include "../../Common/CreateCoder.h" + #include "ZipCompressionMode.h" #include "ZipIn.h" @@ -40,6 +42,7 @@ struct CUpdateItem }; HRESULT Update( + DECL_EXTERNAL_CODECS_LOC_VARS const CObjectVector<CItemEx> &inputItems, const CObjectVector<CUpdateItem> &updateItems, ISequentialOutStream *seqOutStream, diff --git a/CPP/7zip/Archive/Zip/makefile b/CPP/7zip/Archive/Zip/makefile deleted file mode 100755 index eaf1031f..00000000 --- a/CPP/7zip/Archive/Zip/makefile +++ /dev/null @@ -1,124 +0,0 @@ -PROG = zip.dll -DEF_FILE = ../Archive.def -CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MT -LIBS = $(LIBS) oleaut32.lib user32.lib - -ZIP_OBJS = \ - $O\DllExports.obj \ - $O\ZipAddCommon.obj \ - $O\ZipHandler.obj \ - $O\ZipHandlerOut.obj \ - $O\ZipHeader.obj \ - $O\ZipIn.obj \ - $O\ZipItem.obj \ - $O\ZipOut.obj \ - $O\ZipUpdate.obj \ - -COMMON_OBJS = \ - $O\Alloc.obj \ - $O\CRC.obj \ - $O\IntToString.obj \ - $O\NewHandler.obj \ - $O\String.obj \ - $O\StringConvert.obj \ - $O\StringToInt.obj \ - $O\Vector.obj \ - -WIN_OBJS = \ - $O\DLL.obj \ - $O\FileFind.obj \ - $O\PropVariant.obj \ - $O\Synchronization.obj \ - -7ZIP_COMMON_OBJS = \ - $O\InBuffer.obj \ - $O\LimitedStreams.obj \ - $O\LSBFDecoder.obj \ - $O\MemBlocks.obj \ - $O\OffsetStream.obj \ - $O\OutBuffer.obj \ - $O\OutMemStream.obj \ - $O\ProgressMt.obj \ - $O\ProgressUtils.obj \ - $O\StreamObjects.obj \ - $O\StreamUtils.obj \ - -AR_COMMON_OBJS = \ - $O\CodecsPath.obj \ - $O\CoderLoader.obj \ - $O\FilterCoder.obj \ - $O\InStreamWithCRC.obj \ - $O\ItemNameUtils.obj \ - $O\OutStreamWithCRC.obj \ - $O\ParseProperties.obj \ - -7Z_OBJS = \ - $O\7zMethodID.obj \ - $O\7zMethods.obj \ - -IMPLODE_OBJS = \ - $O\ImplodeDecoder.obj \ - $O\ImplodeHuffmanDecoder.obj \ - -SHRINK_OBJS = \ - $O\ShrinkDecoder.obj \ - -CRYPTO_HASH_OBJS = \ - $O\HmacSha1.obj \ - $O\Pbkdf2HmacSha1.obj \ - $O\RandGen.obj \ - $O\Sha1.obj \ - -CRYPTO_WZAES_OBJS = \ - $O\WzAES.obj \ - -CRYPTO_ZIP_OBJS = \ - $O\ZipCipher.obj \ - $O\ZipCrypto.obj \ - - -OBJS = \ - $O\StdAfx.obj \ - $(ZIP_OBJS) \ - $(COMMON_OBJS) \ - $(WIN_OBJS) \ - $(7ZIP_COMMON_OBJS) \ - $(AR_COMMON_OBJS) \ - $(7Z_OBJS) \ - $(CRYPTO_HASH_OBJS) \ - $(CRYPTO_WZAES_OBJS) \ - $(CRYPTO_ZIP_OBJS) \ - $(IMPLODE_OBJS) \ - $(SHRINK_OBJS) \ - $O\CopyCoder.obj \ - $O\LZOutWindow.obj \ - $O\resource.res - -!include "../../../Build.mak" - -$(ZIP_OBJS): $(*B).cpp - $(COMPL) -$(COMMON_OBJS): ../../../Common/$(*B).cpp - $(COMPL) -$(WIN_OBJS): ../../../Windows/$(*B).cpp - $(COMPL) -$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp - $(COMPL) -$(AR_COMMON_OBJS): ../Common/$(*B).cpp - $(COMPL) -$(7Z_OBJS): ../7z/$(*B).cpp - $(COMPL) -$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp - $(COMPL_O2) -$(CRYPTO_ZIP_OBJS): ../../Crypto/Zip/$(*B).cpp - $(COMPL) -$(CRYPTO_WZAES_OBJS): ../../Crypto/WzAES/$(*B).cpp - $(COMPL_O2) -$(IMPLODE_OBJS): ../../Compress/Implode/$(*B).cpp - $(COMPL) -$(SHRINK_OBJS): ../../Compress/Shrink/$(*B).cpp - $(COMPL) -$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp - $(COMPL) -$O\LZOutWindow.obj: ../../Compress/LZ/$(*B).cpp - $(COMPL) diff --git a/CPP/7zip/Archive/Zip/resource.rc b/CPP/7zip/Archive/Zip/resource.rc deleted file mode 100755 index 388f349e..00000000 --- a/CPP/7zip/Archive/Zip/resource.rc +++ /dev/null @@ -1,5 +0,0 @@ -#include "../../MyVersionInfo.rc" - -MY_VERSION_INFO_DLL("Zip Plugin", "zip") - -101 ICON "zip.ico" |