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/Zip | |
parent | d9666cf046a8453b33b3e2fbf4d82295a9f87df3 (diff) |
4.45 beta
Diffstat (limited to 'CPP/7zip/Archive/Zip')
-rwxr-xr-x | CPP/7zip/Archive/Zip/DllExports.cpp | 152 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/Zip.dsp | 651 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/Zip.dsw | 29 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipAddCommon.cpp | 102 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipAddCommon.h | 17 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipHandler.cpp | 122 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipHandler.h | 19 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipHandlerOut.cpp | 4 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipIn.cpp | 30 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipOut.cpp | 1 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipRegister.cpp | 18 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipUpdate.cpp | 42 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipUpdate.h | 3 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/makefile | 124 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/resource.rc | 5 |
15 files changed, 163 insertions, 1156 deletions
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" |