Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xAsm/x64/7zCrcT8U.asm101
-rwxr-xr-xAsm/x86/7zCrcT8U.asm101
-rwxr-xr-xC/7zCrc.c123
-rwxr-xr-xC/7zCrc.h24
-rwxr-xr-xC/7zCrcT8.c40
-rwxr-xr-xC/Alloc.c (renamed from CPP/Common/Alloc.cpp)75
-rwxr-xr-xC/Alloc.h (renamed from CPP/Common/Alloc.h)14
-rwxr-xr-xC/Archive/7z/7zAlloc.h20
-rwxr-xr-xC/Archive/7z/7zBuffer.h19
-rwxr-xr-xC/Archive/7z/7zDecode.h21
-rwxr-xr-xC/Archive/7z/7zExtract.c4
-rwxr-xr-xC/Archive/7z/7zExtract.h40
-rwxr-xr-xC/Archive/7z/7zHeader.h55
-rwxr-xr-xC/Archive/7z/7zIn.c27
-rwxr-xr-xC/Archive/7z/7zIn.h55
-rwxr-xr-xC/Archive/7z/7zItem.h90
-rwxr-xr-xC/Archive/7z/7zMain.c8
-rwxr-xr-xC/Archive/7z/7zMethodID.h18
-rwxr-xr-xC/Archive/7z/7z_C.dsp12
-rwxr-xr-xC/Archive/7z/makefile13
-rwxr-xr-xC/Archive/7z/makefile.gcc8
-rwxr-xr-xC/Compress/Branch/BranchARM.c2
-rwxr-xr-xC/Compress/Branch/BranchARMThumb.c2
-rwxr-xr-xC/Compress/Branch/BranchIA64.c29
-rwxr-xr-xC/Compress/Branch/BranchSPARC.c2
-rwxr-xr-xC/Compress/Branch/BranchSPARC.h2
-rwxr-xr-xC/Compress/Branch/BranchTypes.h13
-rwxr-xr-xC/Compress/Lz/MatchFinderMt.c4
-rwxr-xr-xC/Compress/Lz/MatchFinderMt.h2
-rwxr-xr-xC/Types.h20
-rwxr-xr-xCPP/7zip/Archive/7z/7z.dsp120
-rwxr-xr-xCPP/7zip/Archive/7z/7zCompressionMode.h16
-rwxr-xr-xCPP/7zip/Archive/7z/7zDecode.cpp172
-rwxr-xr-xCPP/7zip/Archive/7z/7zDecode.h15
-rwxr-xr-xCPP/7zip/Archive/7z/7zEncode.cpp257
-rwxr-xr-xCPP/7zip/Archive/7z/7zEncode.h23
-rwxr-xr-xCPP/7zip/Archive/7z/7zExtract.cpp2
-rwxr-xr-xCPP/7zip/Archive/7z/7zHandler.cpp109
-rwxr-xr-xCPP/7zip/Archive/7z/7zHandler.h20
-rwxr-xr-xCPP/7zip/Archive/7z/7zHandlerOut.cpp161
-rwxr-xr-xCPP/7zip/Archive/7z/7zHeader.h2
-rwxr-xr-xCPP/7zip/Archive/7z/7zIn.cpp78
-rwxr-xr-xCPP/7zip/Archive/7z/7zIn.h23
-rwxr-xr-xCPP/7zip/Archive/7z/7zItem.h12
-rwxr-xr-xCPP/7zip/Archive/7z/7zMethodID.cpp76
-rwxr-xr-xCPP/7zip/Archive/7z/7zMethodID.h29
-rwxr-xr-xCPP/7zip/Archive/7z/7zMethods.cpp174
-rwxr-xr-xCPP/7zip/Archive/7z/7zMethods.h36
-rwxr-xr-xCPP/7zip/Archive/7z/7zOut.cpp256
-rwxr-xr-xCPP/7zip/Archive/7z/7zOut.h31
-rwxr-xr-xCPP/7zip/Archive/7z/7zRegister.cpp18
-rwxr-xr-xCPP/7zip/Archive/7z/7zUpdate.cpp69
-rwxr-xr-xCPP/7zip/Archive/7z/7zUpdate.h1
-rwxr-xr-xCPP/7zip/Archive/7z/DllExports.cpp113
-rwxr-xr-xCPP/7zip/Archive/7z/makefile33
-rwxr-xr-xCPP/7zip/Archive/Archive.def3
-rwxr-xr-xCPP/7zip/Archive/Archive2.def8
-rwxr-xr-xCPP/7zip/Archive/ArchiveExports.cpp130
-rwxr-xr-xCPP/7zip/Archive/Arj/Arj.dsp329
-rwxr-xr-xCPP/7zip/Archive/Arj/Arj.dsw29
-rwxr-xr-xCPP/7zip/Archive/Arj/ArjHandler.cpp1
-rwxr-xr-xCPP/7zip/Archive/Arj/ArjIn.cpp10
-rwxr-xr-xCPP/7zip/Archive/Arj/ArjRegister.cpp13
-rwxr-xr-xCPP/7zip/Archive/Arj/DllExports.cpp72
-rwxr-xr-xCPP/7zip/Archive/Arj/makefile66
-rwxr-xr-xCPP/7zip/Archive/Arj/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/BZip2/BZip2.dsp281
-rwxr-xr-xCPP/7zip/Archive/BZip2/BZip2.dsw29
-rwxr-xr-xCPP/7zip/Archive/BZip2/BZip2Handler.cpp40
-rwxr-xr-xCPP/7zip/Archive/BZip2/BZip2Handler.h19
-rwxr-xr-xCPP/7zip/Archive/BZip2/BZip2HandlerOut.cpp12
-rwxr-xr-xCPP/7zip/Archive/BZip2/BZip2Update.cpp32
-rwxr-xr-xCPP/7zip/Archive/BZip2/BZip2Update.h2
-rwxr-xr-xCPP/7zip/Archive/BZip2/DllExports.cpp127
-rwxr-xr-xCPP/7zip/Archive/BZip2/bz2Register.cpp18
-rwxr-xr-xCPP/7zip/Archive/BZip2/makefile55
-rwxr-xr-xCPP/7zip/Archive/BZip2/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/Cab/Cab.dsp395
-rwxr-xr-xCPP/7zip/Archive/Cab/Cab.dsw29
-rwxr-xr-xCPP/7zip/Archive/Cab/CabBlockInStream.cpp6
-rwxr-xr-xCPP/7zip/Archive/Cab/CabHandler.cpp1
-rwxr-xr-xCPP/7zip/Archive/Cab/CabRegister.cpp13
-rwxr-xr-xCPP/7zip/Archive/Cab/DllExports.cpp72
-rwxr-xr-xCPP/7zip/Archive/Cab/makefile70
-rwxr-xr-xCPP/7zip/Archive/Cab/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/Chm/Chm.dsp337
-rwxr-xr-xCPP/7zip/Archive/Chm/Chm.dsw29
-rwxr-xr-xCPP/7zip/Archive/Chm/ChmRegister.cpp13
-rwxr-xr-xCPP/7zip/Archive/Chm/DllExports.cpp77
-rwxr-xr-xCPP/7zip/Archive/Chm/makefile68
-rwxr-xr-xCPP/7zip/Archive/Chm/resource.rc3
-rwxr-xr-xCPP/7zip/Archive/Common/CodecsPath.cpp34
-rwxr-xr-xCPP/7zip/Archive/Common/CodecsPath.h12
-rwxr-xr-xCPP/7zip/Archive/Common/CoderLoader.cpp31
-rwxr-xr-xCPP/7zip/Archive/Common/CoderLoader.h147
-rwxr-xr-xCPP/7zip/Archive/Common/CoderMixer2MT.cpp2
-rwxr-xr-xCPP/7zip/Archive/Common/InStreamWithCRC.cpp9
-rwxr-xr-xCPP/7zip/Archive/Common/InStreamWithCRC.h18
-rwxr-xr-xCPP/7zip/Archive/Common/OutStreamWithCRC.cpp2
-rwxr-xr-xCPP/7zip/Archive/Common/OutStreamWithCRC.h14
-rwxr-xr-xCPP/7zip/Archive/Cpio/CpioRegister.cpp13
-rwxr-xr-xCPP/7zip/Archive/Cpio/DllExports.cpp65
-rwxr-xr-xCPP/7zip/Archive/Cpio/cpio.dsp265
-rwxr-xr-xCPP/7zip/Archive/Cpio/cpio.dsw29
-rwxr-xr-xCPP/7zip/Archive/Cpio/makefile55
-rwxr-xr-xCPP/7zip/Archive/Cpio/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/Deb/Deb.dsp269
-rwxr-xr-xCPP/7zip/Archive/Deb/Deb.dsw29
-rwxr-xr-xCPP/7zip/Archive/Deb/DebRegister.cpp13
-rwxr-xr-xCPP/7zip/Archive/Deb/DllExports.cpp73
-rwxr-xr-xCPP/7zip/Archive/Deb/makefile54
-rwxr-xr-xCPP/7zip/Archive/Deb/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/DllExports.cpp52
-rwxr-xr-xCPP/7zip/Archive/DllExports2.cpp74
-rwxr-xr-xCPP/7zip/Archive/GZip/DllExports.cpp125
-rwxr-xr-xCPP/7zip/Archive/GZip/GZip.dsp321
-rwxr-xr-xCPP/7zip/Archive/GZip/GZip.dsw29
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipHandler.cpp34
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipHandler.h19
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipHandlerOut.cpp4
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipIn.cpp61
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipIn.h9
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipOut.cpp2
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipRegister.cpp18
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipUpdate.cpp31
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipUpdate.h6
-rwxr-xr-xCPP/7zip/Archive/GZip/makefile60
-rwxr-xr-xCPP/7zip/Archive/GZip/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/Iso/DllExports.cpp88
-rwxr-xr-xCPP/7zip/Archive/Iso/Iso.dsp273
-rwxr-xr-xCPP/7zip/Archive/Iso/Iso.dsw29
-rwxr-xr-xCPP/7zip/Archive/Iso/IsoHandler.cpp2
-rwxr-xr-xCPP/7zip/Archive/Iso/IsoRegister.cpp13
-rwxr-xr-xCPP/7zip/Archive/Iso/makefile55
-rwxr-xr-xCPP/7zip/Archive/Iso/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/Lzh/DllExports.cpp72
-rwxr-xr-xCPP/7zip/Archive/Lzh/Lzh.def7
-rwxr-xr-xCPP/7zip/Archive/Lzh/Lzh.dsp333
-rwxr-xr-xCPP/7zip/Archive/Lzh/Lzh.dsw29
-rwxr-xr-xCPP/7zip/Archive/Lzh/LzhIn.cpp3
-rwxr-xr-xCPP/7zip/Archive/Lzh/LzhRegister.cpp13
-rwxr-xr-xCPP/7zip/Archive/Lzh/makefile65
-rwxr-xr-xCPP/7zip/Archive/Lzh/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/Nsis/DllExports.cpp110
-rwxr-xr-xCPP/7zip/Archive/Nsis/Nsis.dsp337
-rwxr-xr-xCPP/7zip/Archive/Nsis/Nsis.dsw29
-rwxr-xr-xCPP/7zip/Archive/Nsis/NsisDecode.cpp61
-rwxr-xr-xCPP/7zip/Archive/Nsis/NsisDecode.h8
-rwxr-xr-xCPP/7zip/Archive/Nsis/NsisHandler.cpp17
-rwxr-xr-xCPP/7zip/Archive/Nsis/NsisHandler.h13
-rwxr-xr-xCPP/7zip/Archive/Nsis/NsisIn.cpp19
-rwxr-xr-xCPP/7zip/Archive/Nsis/NsisIn.h10
-rwxr-xr-xCPP/7zip/Archive/Nsis/NsisRegister.cpp14
-rwxr-xr-xCPP/7zip/Archive/Nsis/makefile67
-rwxr-xr-xCPP/7zip/Archive/Nsis/resource.rc3
-rwxr-xr-xCPP/7zip/Archive/RPM/DllExports.cpp68
-rwxr-xr-xCPP/7zip/Archive/RPM/Rpm.dsp205
-rwxr-xr-xCPP/7zip/Archive/RPM/Rpm.dsw29
-rwxr-xr-xCPP/7zip/Archive/RPM/RpmRegister.cpp13
-rwxr-xr-xCPP/7zip/Archive/RPM/makefile42
-rwxr-xr-xCPP/7zip/Archive/RPM/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/Rar/DllExports.cpp142
-rwxr-xr-xCPP/7zip/Archive/Rar/Rar.dsp459
-rwxr-xr-xCPP/7zip/Archive/Rar/Rar.dsw29
-rwxr-xr-xCPP/7zip/Archive/Rar/RarHandler.cpp104
-rwxr-xr-xCPP/7zip/Archive/Rar/RarHandler.h12
-rwxr-xr-xCPP/7zip/Archive/Rar/RarIn.cpp41
-rwxr-xr-xCPP/7zip/Archive/Rar/RarRegister.cpp13
-rwxr-xr-xCPP/7zip/Archive/Rar/RarVolumeInStream.cpp11
-rwxr-xr-xCPP/7zip/Archive/Rar/RarVolumeInStream.h3
-rwxr-xr-xCPP/7zip/Archive/Rar/makefile90
-rwxr-xr-xCPP/7zip/Archive/Rar/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/Split/DllExports.cpp65
-rwxr-xr-xCPP/7zip/Archive/Split/Split.dsp237
-rwxr-xr-xCPP/7zip/Archive/Split/Split.dsw29
-rwxr-xr-xCPP/7zip/Archive/Split/SplitRegister.cpp20
-rwxr-xr-xCPP/7zip/Archive/Split/makefile51
-rwxr-xr-xCPP/7zip/Archive/Split/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/StdAfx.h8
-rwxr-xr-xCPP/7zip/Archive/Tar/DllExports.cpp86
-rwxr-xr-xCPP/7zip/Archive/Tar/Tar.dsp297
-rwxr-xr-xCPP/7zip/Archive/Tar/Tar.dsw29
-rwxr-xr-xCPP/7zip/Archive/Tar/TarRegister.cpp18
-rwxr-xr-xCPP/7zip/Archive/Tar/makefile59
-rwxr-xr-xCPP/7zip/Archive/Tar/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/Z/Z.dsp237
-rwxr-xr-xCPP/7zip/Archive/Z/Z.dsw29
-rwxr-xr-xCPP/7zip/Archive/Z/ZRegister.cpp13
-rwxr-xr-xCPP/7zip/Archive/Z/makefile52
-rwxr-xr-xCPP/7zip/Archive/Z/resource.rc5
-rwxr-xr-xCPP/7zip/Archive/Zip/DllExports.cpp152
-rwxr-xr-xCPP/7zip/Archive/Zip/Zip.dsp651
-rwxr-xr-xCPP/7zip/Archive/Zip/Zip.dsw29
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipAddCommon.cpp102
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipAddCommon.h17
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipHandler.cpp122
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipHandler.h19
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipHandlerOut.cpp4
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipIn.cpp30
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipOut.cpp1
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipRegister.cpp18
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipUpdate.cpp42
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipUpdate.h3
-rwxr-xr-xCPP/7zip/Archive/Zip/makefile124
-rwxr-xr-xCPP/7zip/Archive/Zip/resource.rc5
-rwxr-xr-xCPP/7zip/Bundles/Alone/Alone.dsp299
-rwxr-xr-xCPP/7zip/Bundles/Alone/makefile100
-rwxr-xr-xCPP/7zip/Bundles/Alone7z/Alone.dsp319
-rwxr-xr-xCPP/7zip/Bundles/Alone7z/makefile64
-rwxr-xr-xCPP/7zip/Bundles/Format7z/Format7z.dsp1006
-rwxr-xr-xCPP/7zip/Bundles/Format7z/makefile89
-rwxr-xr-xCPP/7zip/Bundles/Format7zExtract/Format7z.dsp813
-rwxr-xr-xCPP/7zip/Bundles/Format7zExtract/Format7z.dsw29
-rwxr-xr-xCPP/7zip/Bundles/Format7zExtract/makefile89
-rwxr-xr-xCPP/7zip/Bundles/Format7zExtractR/makefile73
-rwxr-xr-xCPP/7zip/Bundles/Format7zF/Format7z.dsp2350
-rwxr-xr-xCPP/7zip/Bundles/Format7zF/Format7z.dsw (renamed from CPP/7zip/Bundles/Format7z/Format7z.dsw)0
-rwxr-xr-xCPP/7zip/Bundles/Format7zF/StdAfx.cpp (renamed from CPP/7zip/Compress/BZip2Original/StdAfx.cpp)0
-rwxr-xr-xCPP/7zip/Bundles/Format7zF/StdAfx.h9
-rwxr-xr-xCPP/7zip/Bundles/Format7zF/makefile498
-rwxr-xr-xCPP/7zip/Bundles/Format7zF/resource.rc26
-rwxr-xr-xCPP/7zip/Bundles/Format7zR/makefile68
-rwxr-xr-xCPP/7zip/Bundles/SFXCon/Main.cpp29
-rwxr-xr-xCPP/7zip/Bundles/SFXCon/SFXCon.dsp125
-rwxr-xr-xCPP/7zip/Bundles/SFXCon/makefile52
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp2
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp3
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/ExtractEngine.h2
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/Main.cpp11
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/SFXSetup.dsp109
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/makefile50
-rwxr-xr-xCPP/7zip/Bundles/SFXWin/Main.cpp11
-rwxr-xr-xCPP/7zip/Bundles/SFXWin/SFXWin.dsp119
-rwxr-xr-xCPP/7zip/Bundles/SFXWin/makefile55
-rwxr-xr-xCPP/7zip/Bundles/makefile1
-rwxr-xr-xCPP/7zip/Common/CreateCoder.cpp292
-rwxr-xr-xCPP/7zip/Common/CreateCoder.h98
-rwxr-xr-xCPP/7zip/Common/FilterCoder.cpp (renamed from CPP/7zip/Archive/Common/FilterCoder.cpp)9
-rwxr-xr-xCPP/7zip/Common/FilterCoder.h (renamed from CPP/7zip/Archive/Common/FilterCoder.h)6
-rwxr-xr-xCPP/7zip/Common/InBuffer.cpp5
-rwxr-xr-xCPP/7zip/Common/MemBlocks.h6
-rwxr-xr-xCPP/7zip/Common/MethodId.cpp27
-rwxr-xr-xCPP/7zip/Common/MethodId.h10
-rwxr-xr-xCPP/7zip/Common/OutBuffer.cpp5
-rwxr-xr-xCPP/7zip/Common/OutMemStream.cpp11
-rwxr-xr-xCPP/7zip/Common/OutMemStream.h4
-rwxr-xr-xCPP/7zip/Common/RegisterArc.h36
-rwxr-xr-xCPP/7zip/Common/RegisterCodec.h33
-rwxr-xr-xCPP/7zip/Common/StreamBinder.cpp2
-rwxr-xr-xCPP/7zip/Compress/BWT/BlockSort.cpp1
-rwxr-xr-xCPP/7zip/Compress/BZip2/BZip2.dsp31
-rwxr-xr-xCPP/7zip/Compress/BZip2/BZip2Decoder.cpp14
-rwxr-xr-xCPP/7zip/Compress/BZip2/BZip2Decoder.h1
-rwxr-xr-xCPP/7zip/Compress/BZip2/BZip2Encoder.cpp13
-rwxr-xr-xCPP/7zip/Compress/BZip2/BZip2Encoder.h1
-rwxr-xr-xCPP/7zip/Compress/BZip2/BZip2Register.cpp19
-rwxr-xr-xCPP/7zip/Compress/BZip2/DllExports.cpp93
-rwxr-xr-xCPP/7zip/Compress/BZip2/makefile18
-rwxr-xr-xCPP/7zip/Compress/BZip2Original/BZip2Decoder.cpp131
-rwxr-xr-xCPP/7zip/Compress/BZip2Original/BZip2Decoder.h38
-rwxr-xr-xCPP/7zip/Compress/BZip2Original/BZip2Encoder.cpp120
-rwxr-xr-xCPP/7zip/Compress/BZip2Original/BZip2Encoder.h30
-rwxr-xr-xCPP/7zip/Compress/BZip2Original/BZip2Error.cpp10
-rwxr-xr-xCPP/7zip/Compress/BZip2Original/DllExports.cpp86
-rwxr-xr-xCPP/7zip/Compress/Branch/ARM.cpp5
-rwxr-xr-xCPP/7zip/Compress/Branch/ARMThumb.cpp6
-rwxr-xr-xCPP/7zip/Compress/Branch/BCJ2Register.cpp18
-rwxr-xr-xCPP/7zip/Compress/Branch/BCJRegister.cpp18
-rwxr-xr-xCPP/7zip/Compress/Branch/Branch.dsp143
-rwxr-xr-xCPP/7zip/Compress/Branch/BranchCoder.h9
-rwxr-xr-xCPP/7zip/Compress/Branch/BranchRegister.cpp34
-rwxr-xr-xCPP/7zip/Compress/Branch/DllExports.cpp152
-rwxr-xr-xCPP/7zip/Compress/Branch/IA64.cpp5
-rwxr-xr-xCPP/7zip/Compress/Branch/PPC.cpp6
-rwxr-xr-xCPP/7zip/Compress/Branch/SPARC.cpp6
-rwxr-xr-xCPP/7zip/Compress/Branch/makefile29
-rwxr-xr-xCPP/7zip/Compress/Branch/x86.cpp4
-rwxr-xr-xCPP/7zip/Compress/Branch/x86.h3
-rwxr-xr-xCPP/7zip/Compress/Branch/x86_2.cpp5
-rwxr-xr-xCPP/7zip/Compress/ByteSwap/ByteSwap.dsp10
-rwxr-xr-xCPP/7zip/Compress/ByteSwap/ByteSwapRegister.cpp17
-rwxr-xr-xCPP/7zip/Compress/ByteSwap/DllExports.cpp91
-rwxr-xr-xCPP/7zip/Compress/ByteSwap/makefile8
-rwxr-xr-xCPP/7zip/Compress/CodecExports.cpp157
-rwxr-xr-xCPP/7zip/Compress/Copy/Copy.dsp23
-rwxr-xr-xCPP/7zip/Compress/Copy/CopyCoder.cpp6
-rwxr-xr-xCPP/7zip/Compress/Copy/CopyRegister.cpp13
-rwxr-xr-xCPP/7zip/Compress/Copy/DllExports.cpp70
-rwxr-xr-xCPP/7zip/Compress/Copy/makefile21
-rwxr-xr-xCPP/7zip/Compress/Deflate/Deflate.dsp43
-rwxr-xr-xCPP/7zip/Compress/Deflate/Deflate64Register.cpp19
-rwxr-xr-xCPP/7zip/Compress/Deflate/DeflateDecoder.cpp2
-rwxr-xr-xCPP/7zip/Compress/Deflate/DeflateDecoder.h6
-rwxr-xr-xCPP/7zip/Compress/Deflate/DeflateEncoder.cpp5
-rwxr-xr-xCPP/7zip/Compress/Deflate/DeflateNsisRegister.cpp13
-rwxr-xr-xCPP/7zip/Compress/Deflate/DeflateRegister.cpp19
-rwxr-xr-xCPP/7zip/Compress/Deflate/DllExports.cpp157
-rwxr-xr-xCPP/7zip/Compress/Deflate/makefile22
-rwxr-xr-xCPP/7zip/Compress/DllExports.cpp37
-rwxr-xr-xCPP/7zip/Compress/DllExports2.cpp28
-rwxr-xr-xCPP/7zip/Compress/Implode/DllExports.cpp65
-rwxr-xr-xCPP/7zip/Compress/Implode/ImplodeDecoder.cpp2
-rwxr-xr-xCPP/7zip/Compress/LZ/LZOutWindow.cpp1
-rwxr-xr-xCPP/7zip/Compress/LZMA/DllExports.cpp109
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMA.dsp151
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMADecoder.cpp2
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMADecoder.h12
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMAEncoder.cpp18
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMAEncoder.h50
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMARegister.cpp19
-rwxr-xr-xCPP/7zip/Compress/LZMA/makefile39
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp65
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp73
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp1018
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/LzmaBench.h43
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp298
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h20
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/makefile15
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/makefile.gcc11
-rwxr-xr-xCPP/7zip/Compress/Lzx/LzxDecoder.cpp5
-rwxr-xr-xCPP/7zip/Compress/PPMD/DllExports.cpp93
-rwxr-xr-xCPP/7zip/Compress/PPMD/PPMD.dsp21
-rwxr-xr-xCPP/7zip/Compress/PPMD/PPMDDecoder.cpp2
-rwxr-xr-xCPP/7zip/Compress/PPMD/PPMDDecoder.h6
-rwxr-xr-xCPP/7zip/Compress/PPMD/PPMDRegister.cpp19
-rwxr-xr-xCPP/7zip/Compress/PPMD/PPMDSubAlloc.h5
-rwxr-xr-xCPP/7zip/Compress/PPMD/makefile22
-rwxr-xr-xCPP/7zip/Compress/Quantum/StdAfx.h (renamed from CPP/7zip/Compress/BZip2Original/StdAfx.h)0
-rwxr-xr-xCPP/7zip/Compress/Rar/DllExports.cpp91
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar29.dsp48
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar3Decoder.cpp6
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar3Vm.cpp34
-rwxr-xr-xCPP/7zip/Compress/Rar/RarCodecsRegister.cpp26
-rwxr-xr-xCPP/7zip/Compress/Rar/makefile19
-rwxr-xr-xCPP/7zip/Compress/Shrink/DllExports.cpp64
-rwxr-xr-xCPP/7zip/Compress/Shrink/ShrinkDecoder.cpp35
-rwxr-xr-xCPP/7zip/Compress/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/Z/ZDecoder.cpp6
-rwxr-xr-xCPP/7zip/Crc.mak15
-rwxr-xr-xCPP/7zip/Crc2.mak7
-rwxr-xr-xCPP/7zip/Crypto/7zAES/7zAES.cpp65
-rwxr-xr-xCPP/7zip/Crypto/7zAES/7zAES.dsp123
-rwxr-xr-xCPP/7zip/Crypto/7zAES/7zAES.h15
-rwxr-xr-xCPP/7zip/Crypto/7zAES/7zAESRegister.cpp18
-rwxr-xr-xCPP/7zip/Crypto/7zAES/makefile32
-rwxr-xr-xCPP/7zip/Crypto/Rar20/Rar20Crypto.cpp11
-rwxr-xr-xCPP/7zip/Crypto/RarAES/RarAES.cpp51
-rwxr-xr-xCPP/7zip/Crypto/RarAES/RarAES.h13
-rwxr-xr-xCPP/7zip/Crypto/WzAES/WzAES.cpp17
-rwxr-xr-xCPP/7zip/Crypto/WzAES/WzAES.h10
-rwxr-xr-xCPP/7zip/Crypto/Zip/ZipCrypto.cpp14
-rwxr-xr-xCPP/7zip/Crypto/makefile1
-rwxr-xr-xCPP/7zip/FileManager/FM.cpp21
-rwxr-xr-xCPP/7zip/FileManager/FM.dsp180
-rwxr-xr-xCPP/7zip/FileManager/FilePlugins.cpp18
-rwxr-xr-xCPP/7zip/FileManager/FilePlugins.h2
-rwxr-xr-xCPP/7zip/FileManager/IFolder.h17
-rwxr-xr-xCPP/7zip/FileManager/MyLoadMenu.cpp4
-rwxr-xr-xCPP/7zip/FileManager/PanelCrc.cpp20
-rwxr-xr-xCPP/7zip/FileManager/PanelSplitFile.cpp6
-rwxr-xr-xCPP/7zip/FileManager/PhysDriveFolder.cpp125
-rwxr-xr-xCPP/7zip/FileManager/PhysDriveFolder.h3
-rwxr-xr-xCPP/7zip/FileManager/RegistryAssociations.cpp49
-rwxr-xr-xCPP/7zip/FileManager/RegistryAssociations.h4
-rwxr-xr-xCPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp976
-rwxr-xr-xCPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp4
-rwxr-xr-xCPP/7zip/FileManager/Resource/SystemPage/SystemPage.cpp45
-rwxr-xr-xCPP/7zip/FileManager/Resource/SystemPage/resource.rc7
-rwxr-xr-xCPP/7zip/FileManager/makefile29
-rwxr-xr-xCPP/7zip/FileManager/resource.rc1
-rwxr-xr-xCPP/7zip/Guid.txt28
-rwxr-xr-xCPP/7zip/ICoder.h16
-rwxr-xr-xCPP/7zip/MyVersion.h8
-rwxr-xr-xCPP/7zip/MyVersionInfo.rc4
-rwxr-xr-xCPP/7zip/UI/Agent/Agent.cpp25
-rwxr-xr-xCPP/7zip/UI/Agent/Agent.h50
-rwxr-xr-xCPP/7zip/UI/Agent/AgentOut.cpp32
-rwxr-xr-xCPP/7zip/UI/Agent/ArchiveFolderOpen.cpp100
-rwxr-xr-xCPP/7zip/UI/Agent/ArchiveFolderOut.cpp3
-rwxr-xr-xCPP/7zip/UI/Agent/IFolderArchive.h18
-rwxr-xr-xCPP/7zip/UI/Client7z/Client7z.cpp4
-rwxr-xr-xCPP/7zip/UI/Client7z/makefile2
-rwxr-xr-xCPP/7zip/UI/Common/ArchiveCommandLine.cpp159
-rwxr-xr-xCPP/7zip/UI/Common/ArchiveCommandLine.h13
-rwxr-xr-xCPP/7zip/UI/Common/ArchiverInfo.cpp372
-rwxr-xr-xCPP/7zip/UI/Common/ArchiverInfo.h66
-rwxr-xr-xCPP/7zip/UI/Common/CompressCall.cpp8
-rwxr-xr-xCPP/7zip/UI/Common/CompressCall.h2
-rwxr-xr-xCPP/7zip/UI/Common/Extract.cpp7
-rwxr-xr-xCPP/7zip/UI/Common/Extract.h7
-rwxr-xr-xCPP/7zip/UI/Common/LoadCodecs.cpp621
-rwxr-xr-xCPP/7zip/UI/Common/LoadCodecs.h215
-rwxr-xr-xCPP/7zip/UI/Common/OpenArchive.cpp292
-rwxr-xr-xCPP/7zip/UI/Common/OpenArchive.h73
-rwxr-xr-xCPP/7zip/UI/Common/Update.cpp125
-rwxr-xr-xCPP/7zip/UI/Common/Update.h16
-rwxr-xr-xCPP/7zip/UI/Common/ZipRegistry.cpp29
-rwxr-xr-xCPP/7zip/UI/Common/ZipRegistry.h7
-rwxr-xr-xCPP/7zip/UI/Console/Console.dsp82
-rwxr-xr-xCPP/7zip/UI/Console/ExtractCallbackConsole.cpp6
-rwxr-xr-xCPP/7zip/UI/Console/List.cpp6
-rwxr-xr-xCPP/7zip/UI/Console/List.h5
-rwxr-xr-xCPP/7zip/UI/Console/Main.cpp210
-rwxr-xr-xCPP/7zip/UI/Console/MainAr.cpp17
-rwxr-xr-xCPP/7zip/UI/Console/PercentPrinter.cpp2
-rwxr-xr-xCPP/7zip/UI/Console/makefile29
-rwxr-xr-xCPP/7zip/UI/Explorer/ContextMenu.cpp61
-rwxr-xr-xCPP/7zip/UI/Explorer/Explorer.dsp137
-rwxr-xr-xCPP/7zip/UI/Explorer/SystemPage/SystemPage.h4
-rwxr-xr-xCPP/7zip/UI/Explorer/makefile7
-rwxr-xr-xCPP/7zip/UI/Far/ExtractEngine.cpp8
-rwxr-xr-xCPP/7zip/UI/Far/Far.dsp50
-rwxr-xr-xCPP/7zip/UI/Far/FarUtils.cpp2
-rwxr-xr-xCPP/7zip/UI/Far/Main.cpp9
-rwxr-xr-xCPP/7zip/UI/Far/Messages.h2
-rwxr-xr-xCPP/7zip/UI/Far/Plugin.cpp42
-rwxr-xr-xCPP/7zip/UI/Far/Plugin.h1
-rwxr-xr-xCPP/7zip/UI/Far/PluginDelete.cpp3
-rwxr-xr-xCPP/7zip/UI/Far/PluginWrite.cpp79
-rwxr-xr-xCPP/7zip/UI/Far/ProgressBox.cpp7
-rwxr-xr-xCPP/7zip/UI/Far/StdAfx.h1
-rwxr-xr-xCPP/7zip/UI/Far/UpdateCallback100.cpp6
-rwxr-xr-xCPP/7zip/UI/Far/makefile8
-rwxr-xr-xCPP/7zip/UI/GUI/CompressDialog.cpp335
-rwxr-xr-xCPP/7zip/UI/GUI/CompressDialog.h39
-rwxr-xr-xCPP/7zip/UI/GUI/ExtractGUI.cpp8
-rwxr-xr-xCPP/7zip/UI/GUI/ExtractGUI.h1
-rwxr-xr-xCPP/7zip/UI/GUI/GUI.cpp30
-rwxr-xr-xCPP/7zip/UI/GUI/GUI.dsp505
-rwxr-xr-xCPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.cpp584
-rwxr-xr-xCPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.h (renamed from CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.h)72
-rwxr-xr-xCPP/7zip/UI/GUI/Resource/BenchmarkDialog/StdAfx.h (renamed from CPP/7zip/FileManager/Resource/BenchmarkDialog/StdAfx.h)0
-rwxr-xr-xCPP/7zip/UI/GUI/Resource/BenchmarkDialog/resource.h (renamed from CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.h)26
-rwxr-xr-xCPP/7zip/UI/GUI/Resource/BenchmarkDialog/resource.rc (renamed from CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.rc)69
-rwxr-xr-xCPP/7zip/UI/GUI/UpdateGUI.cpp71
-rwxr-xr-xCPP/7zip/UI/GUI/UpdateGUI.h1
-rwxr-xr-xCPP/7zip/UI/GUI/makefile34
-rwxr-xr-xCPP/7zip/UI/GUI/resource.h3
-rwxr-xr-xCPP/7zip/UI/GUI/resource.rc4
-rwxr-xr-xCPP/7zip/UI/Resource/CompressDialog/resource.h14
-rwxr-xr-xCPP/7zip/UI/Resource/CompressDialog/resource.rc36
-rwxr-xr-xCPP/7zip/makefile3
-rwxr-xr-xCPP/Build.mak15
-rwxr-xr-xCPP/Common/CRC.cpp55
-rwxr-xr-xCPP/Common/CRC.h36
-rwxr-xr-xCPP/Common/MyCom.h2
-rwxr-xr-xCPP/Common/MyGuidDef.h8
-rwxr-xr-xCPP/Common/StdOutStream.h2
-rwxr-xr-xCPP/Common/String.h12
-rwxr-xr-xCPP/Windows/ResourceString.cpp19
-rwxr-xr-xCPP/Windows/ResourceString.h6
-rwxr-xr-xCPP/Windows/System.h27
-rwxr-xr-xDOC/7zip.nsi104
-rwxr-xr-xDOC/7zip.wxs41
-rwxr-xr-xDOC/License.txt10
-rwxr-xr-xDOC/Methods.txt27
-rwxr-xr-xDOC/history.txt7
-rwxr-xr-xDOC/readme.txt2
458 files changed, 12859 insertions, 18323 deletions
diff --git a/Asm/x64/7zCrcT8U.asm b/Asm/x64/7zCrcT8U.asm
new file mode 100755
index 00000000..9f5084d0
--- /dev/null
+++ b/Asm/x64/7zCrcT8U.asm
@@ -0,0 +1,101 @@
+.code
+
+
+
+
+CRC1b macro
+ movzx EDX, BYTE PTR [RSI]
+ inc RSI
+ movzx EBX, AL
+ xor EDX, EBX
+ shr EAX, 8
+ xor EAX, [RDI + RDX * 4]
+ dec R8
+endm
+
+
+
+
+align 16
+CrcUpdateT8 PROC
+
+ push RBX
+ push RSI
+ push RDI
+ push RBP
+
+ mov EAX, ECX
+ mov RSI, RDX
+ mov RDI, R9
+
+
+ test R8, R8
+ jz sl_end
+ sl:
+ test RSI, 7
+ jz sl_end
+ CRC1b
+ jnz sl
+ sl_end:
+
+ cmp R8, 16
+ jb crc_end
+ mov R9, R8
+ and R8, 7
+ add R8, 8
+ sub R9, R8
+
+ add R9, RSI
+ xor EAX, [RSI]
+ mov EBX, [RSI + 4]
+ movzx ECX, BL
+ align 16
+ main_loop:
+ mov EDX, [RDI + RCX*4 + 0C00h]
+ movzx EBP, BH
+ xor EDX, [RDI + RBP*4 + 0800h]
+ shr EBX, 16
+ movzx ECX, BL
+ xor EDX, [RSI + 8]
+ xor EDX, [RDI + RCX*4 + 0400h]
+ movzx ECX, AL
+ movzx EBP, BH
+ xor EDX, [RDI + RBP*4 + 0000h]
+
+ mov EBX, [RSI + 12]
+
+ xor EDX, [RDI + RCX*4 + 01C00h]
+ movzx EBP, AH
+ shr EAX, 16
+ movzx ECX, AL
+ xor EDX, [RDI + RBP*4 + 01800h]
+ movzx EBP, AH
+ mov EAX, [RDI + RCX*4 + 01400h]
+ add RSI, 8
+ xor EAX, [RDI + RBP*4 + 01000h]
+ movzx ECX, BL
+ xor EAX,EDX
+
+ cmp RSI, R9
+ jne main_loop
+ xor EAX, [RSI]
+
+
+
+ crc_end:
+
+ test R8, R8
+ jz fl_end
+ fl:
+ CRC1b
+ jnz fl
+ fl_end:
+
+ pop RBP
+ pop RDI
+ pop RSI
+ pop RBX
+ ret
+CrcUpdateT8 ENDP
+
+end
diff --git a/Asm/x86/7zCrcT8U.asm b/Asm/x86/7zCrcT8U.asm
new file mode 100755
index 00000000..f8ba77c4
--- /dev/null
+++ b/Asm/x86/7zCrcT8U.asm
@@ -0,0 +1,101 @@
+.386
+.model flat
+
+_TEXT$00 SEGMENT PARA PUBLIC 'CODE'
+
+CRC1b macro
+ movzx EDX, BYTE PTR [ESI]
+ inc ESI
+ movzx EBX, AL
+ xor EDX, EBX
+ shr EAX, 8
+ xor EAX, [EBP + EDX * 4]
+ dec EDI
+endm
+
+data_size equ (4 + 4*4)
+crc_table equ (data_size + 4)
+
+align 16
+public @CrcUpdateT8@16
+@CrcUpdateT8@16:
+ push EBX
+ push ESI
+ push EDI
+ push EBP
+
+ mov EAX, ECX
+ mov ESI, EDX
+ mov EDI, [ESP + data_size]
+ mov EBP, [ESP + crc_table]
+
+ test EDI, EDI
+ jz sl_end
+ sl:
+ test ESI, 7
+ jz sl_end
+ CRC1b
+ jnz sl
+ sl_end:
+
+ cmp EDI, 16
+ jb crc_end
+ mov [ESP + data_size], EDI
+ sub EDI, 8
+ and EDI, NOT 7
+ sub [ESP + data_size], EDI
+
+ add EDI, ESI
+ xor EAX, [ESI]
+ mov EBX, [ESI + 4]
+ movzx ECX, BL
+ align 16
+ main_loop:
+ mov EDX, [EBP + ECX*4 + 0C00h]
+ movzx ECX, BH
+ xor EDX, [EBP + ECX*4 + 0800h]
+ shr EBX, 16
+ movzx ECX, BL
+ xor EDX, [EBP + ECX*4 + 0400h]
+ xor EDX, [ESI + 8]
+ movzx ECX, AL
+ movzx EBX, BH
+ xor EDX, [EBP + EBX*4 + 0000h]
+
+ mov EBX, [ESI + 12]
+
+ xor EDX, [EBP + ECX*4 + 01C00h]
+ movzx ECX, AH
+ add ESI, 8
+ shr EAX, 16
+ xor EDX, [EBP + ECX*4 + 01800h]
+ movzx ECX, AL
+ xor EDX, [EBP + ECX*4 + 01400h]
+ movzx ECX, AH
+ mov EAX, [EBP + ECX*4 + 01000h]
+ movzx ECX, BL
+ xor EAX,EDX
+
+ cmp ESI, EDI
+ jne main_loop
+ xor EAX, [ESI]
+
+ mov EDI, [ESP + data_size]
+
+ crc_end:
+
+ test EDI, EDI
+ jz fl_end
+ fl:
+ CRC1b
+ jnz fl
+ fl_end:
+
+ pop EBP
+ pop EDI
+ pop ESI
+ pop EBX
+ ret 8
+
+
+end
diff --git a/C/7zCrc.c b/C/7zCrc.c
index 136ac2e0..61050dd4 100755
--- a/C/7zCrc.c
+++ b/C/7zCrc.c
@@ -3,12 +3,9 @@
#include "7zCrc.h"
#define kCrcPoly 0xEDB88320
+UInt32 g_CrcTable[256];
-UInt32 g_CrcTable[256]
-
-#ifdef CRC_GENERATE_TABLE
-;
-void CrcGenerateTable()
+void MY_FAST_CALL CrcGenerateTable()
{
UInt32 i;
for (i = 0; i < 256; i++)
@@ -16,122 +13,20 @@ void CrcGenerateTable()
UInt32 r = i;
int j;
for (j = 0; j < 8; j++)
- if (r & 1)
- r = (r >> 1) ^ kCrcPoly;
- else
- r >>= 1;
+ r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
g_CrcTable[i] = r;
}
}
-#else
-
-= {
- 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
- 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
- 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
- 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
- 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
- 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
- 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
- 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
- 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
- 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
- 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
- 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
- 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
- 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
- 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
- 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
- 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
- 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
- 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
- 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
- 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
- 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
- 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
- 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
- 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
- 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
- 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
- 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
- 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
- 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
- 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
- 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
- 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
- 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
- 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
- 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
- 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
- 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
- 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
- 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
- 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
- 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
- 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
- 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
- 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
- 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
- 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
- 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
- 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
- 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
- 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
- 0x2d02ef8dL
-};
-
-#endif
-
-void CrcInit(UInt32 *crc) { *crc = 0xFFFFFFFF; }
-UInt32 CrcGetDigest(UInt32 *crc) { return *crc ^ 0xFFFFFFFF; }
-
-void CrcUpdateByte(UInt32 *crc, Byte b)
-{
- *crc = g_CrcTable[((Byte)(*crc)) ^ b] ^ (*crc >> 8);
-}
-
-void CrcUpdateUInt16(UInt32 *crc, UInt16 v)
-{
- CrcUpdateByte(crc, (Byte)v);
- CrcUpdateByte(crc, (Byte)(v >> 8));
-}
-
-void CrcUpdateUInt32(UInt32 *crc, UInt32 v)
-{
- int i;
- for (i = 0; i < 4; i++)
- CrcUpdateByte(crc, (Byte)(v >> (8 * i)));
-}
-
-void CrcUpdateUInt64(UInt32 *crc, UInt64 v)
-{
- int i;
- for (i = 0; i < 8; i++)
- {
- CrcUpdateByte(crc, (Byte)(v));
- v >>= 8;
- }
-}
-
-void CrcUpdate(UInt32 *crc, const void *data, size_t size)
+UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
{
- UInt32 v = *crc;
const Byte *p = (const Byte *)data;
- for (; size > 0 ; size--, p++)
- v = g_CrcTable[((Byte)(v)) ^ *p] ^ (v >> 8);
- *crc = v;
-}
-
-UInt32 CrcCalculateDigest(const void *data, size_t size)
-{
- UInt32 crc;
- CrcInit(&crc);
- CrcUpdate(&crc, data, size);
- return CrcGetDigest(&crc);
+ for (; size > 0 ; size--, p++)
+ v = CRC_UPDATE_BYTE(v, *p);
+ return v;
}
-int CrcVerifyDigest(UInt32 digest, const void *data, size_t size)
+UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size)
{
- return (CrcCalculateDigest(data, size) == digest);
+ return CrcUpdate(CRC_INIT_VAL, data, size) ^ 0xFFFFFFFF;
}
diff --git a/C/7zCrc.h b/C/7zCrc.h
index 370b2a0f..bb3d481f 100755
--- a/C/7zCrc.h
+++ b/C/7zCrc.h
@@ -7,25 +7,15 @@
#include "Types.h"
-extern UInt32 g_CrcTable[256];
+extern UInt32 g_CrcTable[];
-// #define CRC_GENERATE_TABLE
+void MY_FAST_CALL CrcGenerateTable();
-#ifdef CRC_GENERATE_TABLE
-void CrcGenerateTable();
-#else
-#define CrcGenerateTable()
-#endif
+#define CRC_INIT_VAL 0xFFFFFFFF
+#define CRC_GET_DIGEST(crc) ((crc) ^ 0xFFFFFFFF)
+#define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
-void CrcInit(UInt32 *crc);
-UInt32 CrcGetDigest(UInt32 *crc);
-void CrcUpdateByte(UInt32 *crc, Byte v);
-void CrcUpdateUInt16(UInt32 *crc, UInt16 v);
-void CrcUpdateUInt32(UInt32 *crc, UInt32 v);
-void CrcUpdateUInt64(UInt32 *crc, UInt64 v);
-void CrcUpdate(UInt32 *crc, const void *data, size_t size);
-
-UInt32 CrcCalculateDigest(const void *data, size_t size);
-int CrcVerifyDigest(UInt32 digest, const void *data, size_t size);
+UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size);
+UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size);
#endif
diff --git a/C/7zCrcT8.c b/C/7zCrcT8.c
new file mode 100755
index 00000000..0619e21c
--- /dev/null
+++ b/C/7zCrcT8.c
@@ -0,0 +1,40 @@
+/* 7zCrc.c */
+
+#include "7zCrc.h"
+
+#define kCrcPoly 0xEDB88320
+#define CRC_NUM_TABLES 8
+
+UInt32 g_CrcTable[256 * CRC_NUM_TABLES];
+
+void MY_FAST_CALL CrcGenerateTable()
+{
+ UInt32 i;
+ for (i = 0; i < 256; i++)
+ {
+ UInt32 r = i;
+ int j;
+ for (j = 0; j < 8; j++)
+ r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
+ g_CrcTable[i] = r;
+ }
+ #if CRC_NUM_TABLES > 1
+ for (; i < 256 * CRC_NUM_TABLES; i++)
+ {
+ UInt32 r = g_CrcTable[i - 256];
+ g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8);
+ }
+ #endif
+}
+
+UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
+
+UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
+{
+ return CrcUpdateT8(v, data, size, g_CrcTable);
+}
+
+UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size)
+{
+ return CrcUpdateT8(CRC_INIT_VAL, data, size, g_CrcTable) ^ 0xFFFFFFFF;
+}
diff --git a/CPP/Common/Alloc.cpp b/C/Alloc.c
index e4fc6a81..7046bcf4 100755
--- a/CPP/Common/Alloc.cpp
+++ b/C/Alloc.c
@@ -1,16 +1,14 @@
-// Common/Alloc.cpp
-
-#include "StdAfx.h"
+// Common/Alloc.c
#ifdef _WIN32
-#include "MyWindows.h"
-#else
-#include <stdlib.h>
+#include <windows.h>
#endif
+#include <stdlib.h>
#include "Alloc.h"
-/* #define _SZ_ALLOC_DEBUG */
+// #define _SZ_ALLOC_DEBUG
+
/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
#ifdef _SZ_ALLOC_DEBUG
#include <stdio.h>
@@ -19,39 +17,38 @@ int g_allocCountMid = 0;
int g_allocCountBig = 0;
#endif
-void *MyAlloc(size_t size) throw()
+void *MyAlloc(size_t size)
{
if (size == 0)
return 0;
#ifdef _SZ_ALLOC_DEBUG
fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount++);
#endif
- return ::malloc(size);
+ return malloc(size);
}
-void MyFree(void *address) throw()
+void MyFree(void *address)
{
#ifdef _SZ_ALLOC_DEBUG
if (address != 0)
fprintf(stderr, "\nFree; count = %10d", --g_allocCount);
#endif
-
- ::free(address);
+ free(address);
}
#ifdef _WIN32
-void *MidAlloc(size_t size) throw()
+void *MidAlloc(size_t size)
{
if (size == 0)
return 0;
#ifdef _SZ_ALLOC_DEBUG
fprintf(stderr, "\nAlloc_Mid %10d bytes; count = %10d", size, g_allocCountMid++);
#endif
- return ::VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
+ return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
}
-void MidFree(void *address) throw()
+void MidFree(void *address)
{
#ifdef _SZ_ALLOC_DEBUG
if (address != 0)
@@ -59,46 +56,36 @@ void MidFree(void *address) throw()
#endif
if (address == 0)
return;
- ::VirtualFree(address, 0, MEM_RELEASE);
+ VirtualFree(address, 0, MEM_RELEASE);
}
-
#ifndef MEM_LARGE_PAGES
-#define _7ZIP_NO_LARGE_PAGES
+wedeed
+#undef _7ZIP_LARGE_PAGES
#endif
-// define _7ZIP_NO_LARGE_PAGES if you don't need LARGE_PAGES support
-// #define _7ZIP_NO_LARGE_PAGES
-
-
-#ifndef _7ZIP_NO_LARGE_PAGES
-static SIZE_T g_LargePageSize =
- #ifdef _WIN64
- (1 << 21);
- #else
- (1 << 22);
- #endif
-
+#ifdef _7ZIP_LARGE_PAGES
+SIZE_T g_LargePageSize = 0;
typedef SIZE_T (WINAPI *GetLargePageMinimumP)();
#endif
-bool SetLargePageSize()
+void SetLargePageSize()
{
- #ifndef _7ZIP_NO_LARGE_PAGES
+ #ifdef _7ZIP_LARGE_PAGES
+ SIZE_T size = 0;
GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP)
- ::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
+ GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
if (largePageMinimum == 0)
- return false;
- SIZE_T size = largePageMinimum();
+ return;
+ size = largePageMinimum();
if (size == 0 || (size & (size - 1)) != 0)
- return false;
+ return;
g_LargePageSize = size;
#endif
- return true;
}
-void *BigAlloc(size_t size) throw()
+void *BigAlloc(size_t size)
{
if (size == 0)
return 0;
@@ -106,19 +93,19 @@ void *BigAlloc(size_t size) throw()
fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++);
#endif
- #ifndef _7ZIP_NO_LARGE_PAGES
- if (size >= (1 << 18))
+ #ifdef _7ZIP_LARGE_PAGES
+ if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18))
{
- void *res = ::VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),
+ void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),
MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE);
if (res != 0)
return res;
}
#endif
- return ::VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
+ return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
}
-void BigFree(void *address) throw()
+void BigFree(void *address)
{
#ifdef _SZ_ALLOC_DEBUG
if (address != 0)
@@ -127,7 +114,7 @@ void BigFree(void *address) throw()
if (address == 0)
return;
- ::VirtualFree(address, 0, MEM_RELEASE);
+ VirtualFree(address, 0, MEM_RELEASE);
}
#endif
diff --git a/CPP/Common/Alloc.h b/C/Alloc.h
index d444f631..ab0b9234 100755
--- a/CPP/Common/Alloc.h
+++ b/C/Alloc.h
@@ -5,17 +5,17 @@
#include <stddef.h>
-void *MyAlloc(size_t size) throw();
-void MyFree(void *address) throw();
+void *MyAlloc(size_t size);
+void MyFree(void *address);
#ifdef _WIN32
-bool SetLargePageSize();
+void SetLargePageSize();
-void *MidAlloc(size_t size) throw();
-void MidFree(void *address) throw();
-void *BigAlloc(size_t size) throw();
-void BigFree(void *address) throw();
+void *MidAlloc(size_t size);
+void MidFree(void *address);
+void *BigAlloc(size_t size);
+void BigFree(void *address);
#else
diff --git a/C/Archive/7z/7zAlloc.h b/C/Archive/7z/7zAlloc.h
new file mode 100755
index 00000000..4ca4170c
--- /dev/null
+++ b/C/Archive/7z/7zAlloc.h
@@ -0,0 +1,20 @@
+/* 7zAlloc.h */
+
+#ifndef __7Z_ALLOC_H
+#define __7Z_ALLOC_H
+
+#include <stddef.h>
+
+typedef struct _ISzAlloc
+{
+ void *(*Alloc)(size_t size);
+ void (*Free)(void *address); /* address can be 0 */
+} ISzAlloc;
+
+void *SzAlloc(size_t size);
+void SzFree(void *address);
+
+void *SzAllocTemp(size_t size);
+void SzFreeTemp(void *address);
+
+#endif
diff --git a/C/Archive/7z/7zBuffer.h b/C/Archive/7z/7zBuffer.h
new file mode 100755
index 00000000..05c6d748
--- /dev/null
+++ b/C/Archive/7z/7zBuffer.h
@@ -0,0 +1,19 @@
+/* 7zBuffer.h */
+
+#ifndef __7Z_BUFFER_H
+#define __7Z_BUFFER_H
+
+#include <stddef.h>
+#include "../../Types.h"
+
+typedef struct _CSzByteBuffer
+{
+ size_t Capacity;
+ Byte *Items;
+}CSzByteBuffer;
+
+void SzByteBufferInit(CSzByteBuffer *buffer);
+int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size));
+void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *));
+
+#endif
diff --git a/C/Archive/7z/7zDecode.h b/C/Archive/7z/7zDecode.h
new file mode 100755
index 00000000..74bb180f
--- /dev/null
+++ b/C/Archive/7z/7zDecode.h
@@ -0,0 +1,21 @@
+/* 7zDecode.h */
+
+#ifndef __7Z_DECODE_H
+#define __7Z_DECODE_H
+
+#include "7zItem.h"
+#include "7zAlloc.h"
+#ifdef _LZMA_IN_CB
+#include "7zIn.h"
+#endif
+
+SZ_RESULT SzDecode(const CFileSize *packSizes, const CFolder *folder,
+ #ifdef _LZMA_IN_CB
+ ISzInStream *stream,
+ #else
+ const Byte *inBuffer,
+ #endif
+ Byte *outBuffer, size_t outSize,
+ size_t *outSizeProcessed, ISzAlloc *allocMain);
+
+#endif
diff --git a/C/Archive/7z/7zExtract.c b/C/Archive/7z/7zExtract.c
index 748591a5..75733fd1 100755
--- a/C/Archive/7z/7zExtract.c
+++ b/C/Archive/7z/7zExtract.c
@@ -83,7 +83,7 @@ SZ_RESULT SzExtract(
{
if (folder->UnPackCRCDefined)
{
- if (!CrcVerifyDigest(folder->UnPackCRC, *outBuffer, (size_t)unPackSize))
+ if (CrcCalc(*outBuffer, (size_t)unPackSize) != folder->UnPackCRC)
res = SZE_FAIL;
}
}
@@ -109,7 +109,7 @@ SZ_RESULT SzExtract(
{
if (fileItem->IsFileCRCDefined)
{
- if (!CrcVerifyDigest(fileItem->FileCRC, *outBuffer + *offset, *outSizeProcessed))
+ if (CrcCalc(*outBuffer + *offset, *outSizeProcessed) != fileItem->FileCRC)
res = SZE_FAIL;
}
}
diff --git a/C/Archive/7z/7zExtract.h b/C/Archive/7z/7zExtract.h
new file mode 100755
index 00000000..e9a4fb4e
--- /dev/null
+++ b/C/Archive/7z/7zExtract.h
@@ -0,0 +1,40 @@
+/* 7zExtract.h */
+
+#ifndef __7Z_EXTRACT_H
+#define __7Z_EXTRACT_H
+
+#include "7zIn.h"
+
+/*
+ SzExtract extracts file from archive
+
+ *outBuffer must be 0 before first call for each new archive.
+
+ Extracting cache:
+ If you need to decompress more than one file, you can send
+ these values from previous call:
+ *blockIndex,
+ *outBuffer,
+ *outBufferSize
+ You can consider "*outBuffer" as cache of solid block. If your archive is solid,
+ it will increase decompression speed.
+
+ If you use external function, you can declare these 3 cache variables
+ (blockIndex, outBuffer, outBufferSize) as static in that external function.
+
+ Free *outBuffer and set *outBuffer to 0, if you want to flush cache.
+*/
+
+SZ_RESULT SzExtract(
+ ISzInStream *inStream,
+ CArchiveDatabaseEx *db,
+ UInt32 fileIndex, /* index of file */
+ UInt32 *blockIndex, /* index of solid block */
+ Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
+ size_t *outBufferSize, /* buffer size for output buffer */
+ size_t *offset, /* offset of stream for required file in *outBuffer */
+ size_t *outSizeProcessed, /* size of file in *outBuffer */
+ ISzAlloc *allocMain,
+ ISzAlloc *allocTemp);
+
+#endif
diff --git a/C/Archive/7z/7zHeader.h b/C/Archive/7z/7zHeader.h
new file mode 100755
index 00000000..3e67cf57
--- /dev/null
+++ b/C/Archive/7z/7zHeader.h
@@ -0,0 +1,55 @@
+/* 7zHeader.h */
+
+#ifndef __7Z_HEADER_H
+#define __7Z_HEADER_H
+
+#include "../../Types.h"
+
+#define k7zSignatureSize 6
+extern Byte k7zSignature[k7zSignatureSize];
+
+#define k7zMajorVersion 0
+
+#define k7zStartHeaderSize 0x20
+
+enum EIdEnum
+{
+ k7zIdEnd,
+
+ k7zIdHeader,
+
+ k7zIdArchiveProperties,
+
+ k7zIdAdditionalStreamsInfo,
+ k7zIdMainStreamsInfo,
+ k7zIdFilesInfo,
+
+ k7zIdPackInfo,
+ k7zIdUnPackInfo,
+ k7zIdSubStreamsInfo,
+
+ k7zIdSize,
+ k7zIdCRC,
+
+ k7zIdFolder,
+
+ k7zIdCodersUnPackSize,
+ k7zIdNumUnPackStream,
+
+ k7zIdEmptyStream,
+ k7zIdEmptyFile,
+ k7zIdAnti,
+
+ k7zIdName,
+ k7zIdCreationTime,
+ k7zIdLastAccessTime,
+ k7zIdLastWriteTime,
+ k7zIdWinAttributes,
+ k7zIdComment,
+
+ k7zIdEncodedHeader,
+
+ k7zIdStartPos
+};
+
+#endif
diff --git a/C/Archive/7z/7zIn.c b/C/Archive/7z/7zIn.c
index 8f3d7cae..04e83a8e 100755
--- a/C/Archive/7z/7zIn.c
+++ b/C/Archive/7z/7zIn.c
@@ -208,7 +208,7 @@ SZ_RESULT SafeReadDirectByte(ISzInStream *inStream, Byte *data)
return SafeReadDirect(inStream, data, 1);
}
-SZ_RESULT SafeReadDirectUInt32(ISzInStream *inStream, UInt32 *value)
+SZ_RESULT SafeReadDirectUInt32(ISzInStream *inStream, UInt32 *value, UInt32 *crc)
{
int i;
*value = 0;
@@ -217,11 +217,12 @@ SZ_RESULT SafeReadDirectUInt32(ISzInStream *inStream, UInt32 *value)
Byte b;
RINOK(SafeReadDirectByte(inStream, &b));
*value |= ((UInt32)b << (8 * i));
+ *crc = CRC_UPDATE_BYTE(*crc, b);
}
return SZ_OK;
}
-SZ_RESULT SafeReadDirectUInt64(ISzInStream *inStream, UInt64 *value)
+SZ_RESULT SafeReadDirectUInt64(ISzInStream *inStream, UInt64 *value, UInt32 *crc)
{
int i;
*value = 0;
@@ -230,6 +231,7 @@ SZ_RESULT SafeReadDirectUInt64(ISzInStream *inStream, UInt64 *value)
Byte b;
RINOK(SafeReadDirectByte(inStream, &b));
*value |= ((UInt64)b << (8 * i));
+ *crc = CRC_UPDATE_BYTE(*crc, b);
}
return SZ_OK;
}
@@ -1133,7 +1135,7 @@ SZ_RESULT SzReadAndDecodePackedStreams2(
if (outRealSize != (UInt32)unPackSize)
return SZE_FAIL;
if (folder->UnPackCRCDefined)
- if (!CrcVerifyDigest(folder->UnPackCRC, outBuffer->Items, (size_t)unPackSize))
+ if (CrcCalc(outBuffer->Items, (size_t)unPackSize) != folder->UnPackCRC)
return SZE_FAIL;
return SZ_OK;
}
@@ -1182,7 +1184,7 @@ SZ_RESULT SzArchiveOpen2(
UInt64 nextHeaderOffset;
UInt64 nextHeaderSize;
UInt32 nextHeaderCRC;
- UInt32 crc;
+ UInt32 crc = 0;
CFileSize pos = 0;
CSzByteBuffer buffer;
CSzData sd;
@@ -1202,20 +1204,17 @@ SZ_RESULT SzArchiveOpen2(
return SZE_ARCHIVE_ERROR;
RINOK(SafeReadDirectByte(inStream, &version));
- RINOK(SafeReadDirectUInt32(inStream, &crcFromArchive));
+ RINOK(SafeReadDirectUInt32(inStream, &crcFromArchive, &crc));
- CrcInit(&crc);
- RINOK(SafeReadDirectUInt64(inStream, &nextHeaderOffset));
- CrcUpdateUInt64(&crc, nextHeaderOffset);
- RINOK(SafeReadDirectUInt64(inStream, &nextHeaderSize));
- CrcUpdateUInt64(&crc, nextHeaderSize);
- RINOK(SafeReadDirectUInt32(inStream, &nextHeaderCRC));
- CrcUpdateUInt32(&crc, nextHeaderCRC);
+ crc = CRC_INIT_VAL;
+ RINOK(SafeReadDirectUInt64(inStream, &nextHeaderOffset, &crc));
+ RINOK(SafeReadDirectUInt64(inStream, &nextHeaderSize, &crc));
+ RINOK(SafeReadDirectUInt32(inStream, &nextHeaderCRC, &crc));
pos = k7zStartHeaderSize;
db->ArchiveInfo.StartPositionAfterHeader = pos;
- if (CrcGetDigest(&crc) != crcFromArchive)
+ if (CRC_GET_DIGEST(crc) != crcFromArchive)
return SZE_ARCHIVE_ERROR;
if (nextHeaderSize == 0)
@@ -1230,7 +1229,7 @@ SZ_RESULT SzArchiveOpen2(
if (res == SZ_OK)
{
res = SZE_ARCHIVE_ERROR;
- if (CrcVerifyDigest(nextHeaderCRC, buffer.Items, (UInt32)nextHeaderSize))
+ if (CrcCalc(buffer.Items, (UInt32)nextHeaderSize) == nextHeaderCRC)
{
for (;;)
{
diff --git a/C/Archive/7z/7zIn.h b/C/Archive/7z/7zIn.h
new file mode 100755
index 00000000..6bfa2a70
--- /dev/null
+++ b/C/Archive/7z/7zIn.h
@@ -0,0 +1,55 @@
+/* 7zIn.h */
+
+#ifndef __7Z_IN_H
+#define __7Z_IN_H
+
+#include "7zHeader.h"
+#include "7zItem.h"
+#include "7zAlloc.h"
+
+typedef struct _CInArchiveInfo
+{
+ CFileSize StartPositionAfterHeader;
+ CFileSize DataStartPosition;
+}CInArchiveInfo;
+
+typedef struct _CArchiveDatabaseEx
+{
+ CArchiveDatabase Database;
+ CInArchiveInfo ArchiveInfo;
+ UInt32 *FolderStartPackStreamIndex;
+ CFileSize *PackStreamStartPositions;
+ UInt32 *FolderStartFileIndex;
+ UInt32 *FileIndexToFolderIndexMap;
+}CArchiveDatabaseEx;
+
+void SzArDbExInit(CArchiveDatabaseEx *db);
+void SzArDbExFree(CArchiveDatabaseEx *db, void (*freeFunc)(void *));
+CFileSize SzArDbGetFolderStreamPos(CArchiveDatabaseEx *db, UInt32 folderIndex, UInt32 indexInFolder);
+CFileSize SzArDbGetFolderFullPackSize(CArchiveDatabaseEx *db, UInt32 folderIndex);
+
+typedef struct _ISzInStream
+{
+ #ifdef _LZMA_IN_CB
+ SZ_RESULT (*Read)(
+ void *object, /* pointer to ISzInStream itself */
+ void **buffer, /* out: pointer to buffer with data */
+ size_t maxRequiredSize, /* max required size to read */
+ size_t *processedSize); /* real processed size.
+ processedSize can be less than maxRequiredSize.
+ If processedSize == 0, then there are no more
+ bytes in stream. */
+ #else
+ SZ_RESULT (*Read)(void *object, void *buffer, size_t size, size_t *processedSize);
+ #endif
+ SZ_RESULT (*Seek)(void *object, CFileSize pos);
+} ISzInStream;
+
+
+int SzArchiveOpen(
+ ISzInStream *inStream,
+ CArchiveDatabaseEx *db,
+ ISzAlloc *allocMain,
+ ISzAlloc *allocTemp);
+
+#endif
diff --git a/C/Archive/7z/7zItem.h b/C/Archive/7z/7zItem.h
new file mode 100755
index 00000000..876539a9
--- /dev/null
+++ b/C/Archive/7z/7zItem.h
@@ -0,0 +1,90 @@
+/* 7zItem.h */
+
+#ifndef __7Z_ITEM_H
+#define __7Z_ITEM_H
+
+#include "7zMethodID.h"
+#include "7zHeader.h"
+#include "7zBuffer.h"
+
+typedef struct _CCoderInfo
+{
+ UInt32 NumInStreams;
+ UInt32 NumOutStreams;
+ CMethodID MethodID;
+ CSzByteBuffer Properties;
+}CCoderInfo;
+
+void SzCoderInfoInit(CCoderInfo *coder);
+void SzCoderInfoFree(CCoderInfo *coder, void (*freeFunc)(void *p));
+
+typedef struct _CBindPair
+{
+ UInt32 InIndex;
+ UInt32 OutIndex;
+}CBindPair;
+
+typedef struct _CFolder
+{
+ UInt32 NumCoders;
+ CCoderInfo *Coders;
+ UInt32 NumBindPairs;
+ CBindPair *BindPairs;
+ UInt32 NumPackStreams;
+ UInt32 *PackStreams;
+ CFileSize *UnPackSizes;
+ int UnPackCRCDefined;
+ UInt32 UnPackCRC;
+
+ UInt32 NumUnPackStreams;
+}CFolder;
+
+void SzFolderInit(CFolder *folder);
+CFileSize SzFolderGetUnPackSize(CFolder *folder);
+int SzFolderFindBindPairForInStream(CFolder *folder, UInt32 inStreamIndex);
+UInt32 SzFolderGetNumOutStreams(CFolder *folder);
+CFileSize SzFolderGetUnPackSize(CFolder *folder);
+
+/* #define CArchiveFileTime UInt64 */
+
+typedef struct _CFileItem
+{
+ /*
+ CArchiveFileTime LastWriteTime;
+ CFileSize StartPos;
+ UInt32 Attributes;
+ */
+ CFileSize Size;
+ UInt32 FileCRC;
+ char *Name;
+
+ Byte IsFileCRCDefined;
+ Byte HasStream;
+ Byte IsDirectory;
+ Byte IsAnti;
+ /*
+ int AreAttributesDefined;
+ int IsLastWriteTimeDefined;
+ int IsStartPosDefined;
+ */
+}CFileItem;
+
+void SzFileInit(CFileItem *fileItem);
+
+typedef struct _CArchiveDatabase
+{
+ UInt32 NumPackStreams;
+ CFileSize *PackSizes;
+ Byte *PackCRCsDefined;
+ UInt32 *PackCRCs;
+ UInt32 NumFolders;
+ CFolder *Folders;
+ UInt32 NumFiles;
+ CFileItem *Files;
+}CArchiveDatabase;
+
+void SzArchiveDatabaseInit(CArchiveDatabase *db);
+void SzArchiveDatabaseFree(CArchiveDatabase *db, void (*freeFunc)(void *));
+
+
+#endif
diff --git a/C/Archive/7z/7zMain.c b/C/Archive/7z/7zMain.c
index 0a789639..efd3624d 100755
--- a/C/Archive/7z/7zMain.c
+++ b/C/Archive/7z/7zMain.c
@@ -159,7 +159,11 @@ SZ_RESULT SzFileSeekImp(void *object, CFileSize pos)
{
LARGE_INTEGER value;
value.LowPart = (DWORD)pos;
- value.HighPart = (LONG)(pos >> 32);
+ value.HighPart = (LONG)((UInt64)pos >> 32);
+ #ifdef _SZ_FILE_SIZE_32
+ // VC 6.0 has bug with >> 32 shifts.
+ value.HighPart = 0;
+ #endif
value.LowPart = SetFilePointer(s->File, value.LowPart, &value.HighPart, FILE_BEGIN);
if (value.LowPart == 0xFFFFFFFF)
if(GetLastError() != NO_ERROR)
@@ -187,7 +191,7 @@ int main(int numargs, char *args[])
ISzAlloc allocImp;
ISzAlloc allocTempImp;
- printf("\n7z ANSI-C Decoder 4.44 Copyright (c) 1999-2006 Igor Pavlov 2006-08-27\n");
+ printf("\n7z ANSI-C Decoder 4.45 Copyright (c) 1999-2007 Igor Pavlov 2007-03-15\n");
if (numargs == 1)
{
printf(
diff --git a/C/Archive/7z/7zMethodID.h b/C/Archive/7z/7zMethodID.h
new file mode 100755
index 00000000..8eb301da
--- /dev/null
+++ b/C/Archive/7z/7zMethodID.h
@@ -0,0 +1,18 @@
+/* 7zMethodID.h */
+
+#ifndef __7Z_METHOD_ID_H
+#define __7Z_METHOD_ID_H
+
+#include "../../Types.h"
+
+#define kMethodIDSize 15
+
+typedef struct _CMethodID
+{
+ Byte ID[kMethodIDSize];
+ Byte IDSize;
+} CMethodID;
+
+int AreMethodsEqual(CMethodID *a1, CMethodID *a2);
+
+#endif
diff --git a/C/Archive/7z/7z_C.dsp b/C/Archive/7z/7z_C.dsp
index 699384ef..e53d1d0a 100755
--- a/C/Archive/7z/7z_C.dsp
+++ b/C/Archive/7z/7z_C.dsp
@@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W4 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_LZMA_PROB32" /D "_LZMA_IN_CB" /D "_SZ_FILE_SIZE_64" /YX /FD /c
+# ADD CPP /nologo /W4 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_LZMA_PROB32" /D "_LZMA_IN_CB" /YX /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -66,7 +66,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_LZMA_PROB32" /D "_LZMA_IN_CB" /D "_SZ_FILE_SIZE_64" /YX /FD /GZ /c
+# ADD CPP /nologo /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_LZMA_PROB32" /D "_LZMA_IN_CB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -109,6 +109,10 @@ SOURCE=..\..\7zCrc.c
SOURCE=..\..\7zCrc.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Types.h
+# End Source File
# End Group
# Begin Source File
@@ -178,9 +182,5 @@ SOURCE=.\7zMethodID.c
SOURCE=.\7zMethodID.h
# End Source File
-# Begin Source File
-
-SOURCE=.\7zTypes.h
-# End Source File
# End Target
# End Project
diff --git a/C/Archive/7z/makefile b/C/Archive/7z/makefile
index 9ce2c346..d6181717 100755
--- a/C/Archive/7z/makefile
+++ b/C/Archive/7z/makefile
@@ -8,11 +8,11 @@ O=O
!ENDIF
!ENDIF
-CFLAGS = $(CFLAGS) -nologo -c -Fo$O/ -GS-
+CFLAGS = $(CFLAGS) -nologo -c -Fo$O/ -GS- -WX -Gy
CFLAGS_O1 = $(CFLAGS) -O1
CFLAGS_O2 = $(CFLAGS) -O2
-LFLAGS = $(LFLAGS) -nologo -OPT:NOWIN98
+LFLAGS = $(LFLAGS) -nologo -OPT:NOWIN98 -OPT:REF
PROGPATH = $O\$(PROG)
@@ -20,11 +20,13 @@ COMPL_O1 = $(CPP) $(CFLAGS_O1) $**
COMPL_O2 = $(CPP) $(CFLAGS_O2) $**
COMPL = $(CPP) $(CFLAGS_O1) $**
+C_OBJS = \
+ $O\7zCrc.obj \
+
7Z_OBJS = \
$O\7zAlloc.obj \
$O\7zBuffer.obj \
- $O\7zCrc.obj \
$O\7zDecode.obj \
$O\7zExtract.obj \
$O\7zHeader.obj \
@@ -36,6 +38,7 @@ COMPL = $(CPP) $(CFLAGS_O1) $**
OBJS = \
$(7Z_OBJS) \
$O\LzmaDecode.obj \
+ $(C_OBJS) \
all: $(PROGPATH)
@@ -51,5 +54,7 @@ $(PROGPATH): $O $(OBJS)
$(7Z_OBJS): $(*B).c
$(COMPL)
-$O\LzmaDecode.obj: ../../Compress/LZMA_C/$(*B).c
+$O\LzmaDecode.obj: ../../Compress/Lzma/$(*B).c
+ $(COMPL_O2)
+$(C_OBJS): ../../$(*B).c
$(COMPL_O2)
diff --git a/C/Archive/7z/makefile.gcc b/C/Archive/7z/makefile.gcc
index 21b7df47..8de50b72 100755
--- a/C/Archive/7z/makefile.gcc
+++ b/C/Archive/7z/makefile.gcc
@@ -17,8 +17,8 @@ $(PROG): $(OBJS)
7zBuffer.o: 7zBuffer.c
$(CXX) $(CFLAGS) 7zBuffer.c
-7zCrc.o: 7zCrc.c
- $(CXX) $(CFLAGS) 7zCrc.c
+7zCrc.o: ../../7zCrc.c
+ $(CXX) $(CFLAGS) ../../7zCrc.c
7zDecode.o: 7zDecode.c
$(CXX) $(CFLAGS) 7zDecode.c
@@ -41,8 +41,8 @@ $(PROG): $(OBJS)
7zMethodID.o: 7zMethodID.c
$(CXX) $(CFLAGS) 7zMethodID.c
-LzmaDecode.o: ../../Compress/LZMA_C/LzmaDecode.c
- $(CXX) $(CFLAGS) ../../Compress/LZMA_C/LzmaDecode.c
+LzmaDecode.o: ../../Compress/Lzma/LzmaDecode.c
+ $(CXX) $(CFLAGS) ../../Compress/Lzma/LzmaDecode.c
clean:
diff --git a/C/Compress/Branch/BranchARM.c b/C/Compress/Branch/BranchARM.c
index 6d4e3672..da7db261 100755
--- a/C/Compress/Branch/BranchARM.c
+++ b/C/Compress/Branch/BranchARM.c
@@ -9,9 +9,9 @@ UInt32 ARM_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
{
if (data[i + 3] == 0xEB)
{
+ UInt32 dest;
UInt32 src = (data[i + 2] << 16) | (data[i + 1] << 8) | (data[i + 0]);
src <<= 2;
- UInt32 dest;
if (encoding)
dest = nowPos + i + 8 + src;
else
diff --git a/C/Compress/Branch/BranchARMThumb.c b/C/Compress/Branch/BranchARMThumb.c
index aab9c7a1..fa30e439 100755
--- a/C/Compress/Branch/BranchARMThumb.c
+++ b/C/Compress/Branch/BranchARMThumb.c
@@ -10,6 +10,7 @@ UInt32 ARMThumb_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
if ((data[i + 1] & 0xF8) == 0xF0 &&
(data[i + 3] & 0xF8) == 0xF8)
{
+ UInt32 dest;
UInt32 src =
((data[i + 1] & 0x7) << 19) |
(data[i + 0] << 11) |
@@ -17,7 +18,6 @@ UInt32 ARMThumb_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
(data[i + 2]);
src <<= 1;
- UInt32 dest;
if (encoding)
dest = nowPos + i + 4 + src;
else
diff --git a/C/Compress/Branch/BranchIA64.c b/C/Compress/Branch/BranchIA64.c
index e7775564..009086b1 100755
--- a/C/Compress/Branch/BranchIA64.c
+++ b/C/Compress/Branch/BranchIA64.c
@@ -18,29 +18,32 @@ UInt32 IA64_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
UInt32 instrTemplate = data[i] & 0x1F;
UInt32 mask = kBranchTable[instrTemplate];
UInt32 bitPos = 5;
- for (int slot = 0; slot < 3; slot++, bitPos += 41)
+ int slot;
+ for (slot = 0; slot < 3; slot++, bitPos += 41)
{
+ UInt32 bytePos, bitRes;
+ UInt64 instruction, instNorm;
+ int j;
if (((mask >> slot) & 1) == 0)
continue;
- UInt32 bytePos = (bitPos >> 3);
- UInt32 bitRes = bitPos & 0x7;
- UInt64 instruction = 0;
- int j;
+ bytePos = (bitPos >> 3);
+ bitRes = bitPos & 0x7;
+ instruction = 0;
for (j = 0; j < 6; j++)
instruction += (UInt64)(data[i + j + bytePos]) << (8 * j);
- UInt64 instNorm = instruction >> bitRes;
+ instNorm = instruction >> bitRes;
if (((instNorm >> 37) & 0xF) == 0x5
&& ((instNorm >> 9) & 0x7) == 0
/* && (instNorm & 0x3F)== 0 */
)
{
- UInt32 src = UInt32((instNorm >> 13) & 0xFFFFF);
- src |= ((instNorm >> 36) & 1) << 20;
+ UInt32 src = (UInt32)((instNorm >> 13) & 0xFFFFF);
+ UInt32 dest;
+ src |= ((UInt32)(instNorm >> 36) & 1) << 20;
src <<= 4;
- UInt32 dest;
if (encoding)
dest = nowPos + i + src;
else
@@ -48,14 +51,14 @@ UInt32 IA64_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
dest >>= 4;
- instNorm &= ~(UInt64(0x8FFFFF) << 13);
- instNorm |= (UInt64(dest & 0xFFFFF) << 13);
- instNorm |= (UInt64(dest & 0x100000) << (36 - 20));
+ instNorm &= ~((UInt64)(0x8FFFFF) << 13);
+ instNorm |= ((UInt64)(dest & 0xFFFFF) << 13);
+ instNorm |= ((UInt64)(dest & 0x100000) << (36 - 20));
instruction &= (1 << bitRes) - 1;
instruction |= (instNorm << bitRes);
for (j = 0; j < 6; j++)
- data[i + j + bytePos] = Byte(instruction >> (8 * j));
+ data[i + j + bytePos] = (Byte)(instruction >> (8 * j));
}
}
}
diff --git a/C/Compress/Branch/BranchSPARC.c b/C/Compress/Branch/BranchSPARC.c
index c175875b..79da2ea7 100755
--- a/C/Compress/Branch/BranchSPARC.c
+++ b/C/Compress/Branch/BranchSPARC.c
@@ -15,9 +15,9 @@ UInt32 SPARC_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
((UInt32)data[i + 1] << 16) |
((UInt32)data[i + 2] << 8) |
((UInt32)data[i + 3]);
+ UInt32 dest;
src <<= 2;
- UInt32 dest;
if (encoding)
dest = nowPos + i + src;
else
diff --git a/C/Compress/Branch/BranchSPARC.h b/C/Compress/Branch/BranchSPARC.h
index fbe9e673..67f44411 100755
--- a/C/Compress/Branch/BranchSPARC.h
+++ b/C/Compress/Branch/BranchSPARC.h
@@ -5,6 +5,6 @@
#include "BranchTypes.h"
-UInt32 SPARC_B_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding);
+UInt32 SPARC_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding);
#endif
diff --git a/C/Compress/Branch/BranchTypes.h b/C/Compress/Branch/BranchTypes.h
index f7ad3abc..bdf75131 100755
--- a/C/Compress/Branch/BranchTypes.h
+++ b/C/Compress/Branch/BranchTypes.h
@@ -22,4 +22,17 @@ typedef unsigned int UInt32;
#endif
#endif
+#ifndef _7ZIP_UINT64_DEFINED
+#define _7ZIP_UINT64_DEFINED
+#ifdef _SZ_NO_INT_64
+typedef unsigned long UInt64;
+#else
+#ifdef _MSC_VER
+typedef unsigned __int64 UInt64;
+#else
+typedef unsigned long long int UInt64;
+#endif
+#endif
+#endif
+
#endif
diff --git a/C/Compress/Lz/MatchFinderMt.c b/C/Compress/Lz/MatchFinderMt.c
index 4ab90d9a..69ac686a 100755
--- a/C/Compress/Lz/MatchFinderMt.c
+++ b/C/Compress/Lz/MatchFinderMt.c
@@ -1,6 +1,6 @@
/* MatchFinderMt.c */
-#include <stdio.h>
+#include <malloc.h>
#include "../../7zCrc.h"
#include "LzHash.h"
@@ -460,7 +460,7 @@ void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAlloc *alloc)
#define kBtBufferSize (kMtBtBlockSize * kMtBtNumBlocks)
static unsigned StdCall HashThreadFunc2(void *p) { HashThreadFunc((CMatchFinderMt *)p); return 0; }
-static unsigned StdCall BtThreadFunc2(void *p) { BtThreadFunc((CMatchFinderMt *)p); return 0; }
+static unsigned StdCall BtThreadFunc2(void *p) { alloca(0x180); BtThreadFunc((CMatchFinderMt *)p); return 0; }
HRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,
UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAlloc *alloc)
diff --git a/C/Compress/Lz/MatchFinderMt.h b/C/Compress/Lz/MatchFinderMt.h
index a99cc45f..a9d9372f 100755
--- a/C/Compress/Lz/MatchFinderMt.h
+++ b/C/Compress/Lz/MatchFinderMt.h
@@ -6,8 +6,6 @@
#include "../../Threads.h"
#include "MatchFinder.h"
-#define _LZ_MT
-
#define kMtHashBlockSize (1 << 13)
#define kMtHashNumBlocks (1 << 3)
#define kMtHashNumBlocksMask (kMtHashNumBlocks - 1)
diff --git a/C/Types.h b/C/Types.h
index 9052a030..a781f481 100755
--- a/C/Types.h
+++ b/C/Types.h
@@ -48,14 +48,14 @@ typedef unsigned long long int UInt64;
#endif
-/* #define _SZ_FILE_SIZE_64 */
-/* Use _SZ_FILE_SIZE_64 if you need support for files larger than 4 GB*/
+/* #define _SZ_FILE_SIZE_32 */
+/* You can define _SZ_FILE_SIZE_32, if you don't need support for files larger than 4 GB*/
#ifndef CFileSize
-#ifdef _SZ_FILE_SIZE_64
-typedef UInt64 CFileSize;
-#else
+#ifdef _SZ_FILE_SIZE_32
typedef UInt32 CFileSize;
+#else
+typedef UInt64 CFileSize;
#endif
#endif
@@ -76,7 +76,7 @@ typedef int HRes;
#ifndef RINOK
-#define RINOK(x) { int __result_ = (x); if(__result_ != 0) return __result_; }
+#define RINOK(x) { HRes __result_ = (x); if(__result_ != 0) return __result_; }
#endif
typedef int Bool;
@@ -89,4 +89,12 @@ typedef int Bool;
#define StdCall
#endif
+#if _MSC_VER >= 1300
+#define MY_FAST_CALL __declspec(noinline) __fastcall
+#elif defined( _MSC_VER)
+#define MY_FAST_CALL __fastcall
+#else
+#define MY_FAST_CALL
+#endif
+
#endif
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/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, &currentTotalPacked, &currentTotalUnPacked);
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"
diff --git a/CPP/7zip/Bundles/Alone/Alone.dsp b/CPP/7zip/Bundles/Alone/Alone.dsp
index 982cfb31..f7ceb6b8 100755
--- a/CPP/7zip/Bundles/Alone/Alone.dsp
+++ b/CPP/7zip/Bundles/Alone/Alone.dsp
@@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "FORMAT_Z" /D "FORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_DEFLATE64" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /D "BREAK_HANDLER" /D "_7ZIP_LARGE_PAGES" /D "BENCH_MT" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "FORMAT_Z" /D "FORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_DEFLATE64" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /D "BREAK_HANDLER" /D "_7ZIP_LARGE_PAGES" /D "BENCH_MT" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -94,7 +94,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /Yu"StdAfx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "FORMAT_Z" /D "FORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_DEFLATE64" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /D "BREAK_HANDLER" /D "_7ZIP_LARGE_PAGES" /D "BENCH_MT" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -121,7 +121,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
-# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "FORMAT_Z" /D "FORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_DEFLATE64" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /D "BREAK_HANDLER" /D "_7ZIP_LARGE_PAGES" /D "BENCH_MT" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -245,14 +245,6 @@ SOURCE=..\..\..\Common\AlignedBuffer.h
# End Source File
# 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
@@ -277,10 +269,6 @@ SOURCE=..\..\..\Common\CRC.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\CRC.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\..\Common\Defs.h
# End Source File
# Begin Source File
@@ -525,6 +513,14 @@ SOURCE=..\..\..\Windows\Time.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=..\..\Archive\Common\CrossThreadProgress.cpp
# End Source File
# Begin Source File
@@ -549,6 +545,14 @@ SOURCE=..\..\Common\FileStreams.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\InBuffer.cpp
# End Source File
# Begin Source File
@@ -601,6 +605,14 @@ SOURCE=..\..\Common\MemBlocks.cpp
# 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\MSBFDecoder.h
# End Source File
# Begin Source File
@@ -680,6 +692,30 @@ SOURCE=..\..\Common\StreamUtils.h
# PROP Default_Filter ""
# Begin Source File
+SOURCE=..\..\Compress\Branch\ARM.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\ARM.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\ARMThumb.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\ARMThumb.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\BCJ2Register.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\BCJRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Compress\Branch\BranchCoder.cpp
# End Source File
# Begin Source File
@@ -688,10 +724,38 @@ SOURCE=..\..\Compress\Branch\BranchCoder.h
# End Source File
# Begin Source File
+SOURCE=..\..\Compress\Branch\BranchRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Compress\Branch\Coder.h
# End Source File
# Begin Source File
+SOURCE=..\..\Compress\Branch\IA64.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\IA64.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\PPC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\PPC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\SPARC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\SPARC.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Compress\Branch\x86.cpp
!IF "$(CFG)" == "Alone - Win32 Release"
@@ -802,6 +866,10 @@ SOURCE=..\..\Compress\BZip2\BZip2Encoder.cpp
SOURCE=..\..\Compress\BZip2\BZip2Encoder.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\BZip2\BZip2Register.cpp
+# End Source File
# End Group
# Begin Group "Copy"
@@ -814,12 +882,20 @@ SOURCE=..\..\Compress\Copy\CopyCoder.cpp
SOURCE=..\..\Compress\Copy\CopyCoder.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Copy\CopyRegister.cpp
+# End Source File
# End Group
# Begin Group "Deflate"
# PROP Default_Filter ""
# Begin Source File
+SOURCE=..\..\Compress\Deflate\Deflate64Register.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Compress\Deflate\DeflateConst.h
# End Source File
# Begin Source File
@@ -876,6 +952,10 @@ SOURCE=..\..\Compress\Deflate\DeflateEncoder.h
SOURCE=..\..\Compress\Deflate\DeflateExtConst.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Deflate\DeflateRegister.cpp
+# End Source File
# End Group
# Begin Group "Huffman"
@@ -1025,6 +1105,10 @@ SOURCE=..\..\Compress\LZMA\LZMAEncoder.cpp
SOURCE=..\..\Compress\LZMA\LZMAEncoder.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA\LZMARegister.cpp
+# End Source File
# End Group
# Begin Group "PPMd"
@@ -1093,6 +1177,10 @@ SOURCE=..\..\Compress\PPMD\PPMDEncoder.h
# End Source File
# Begin Source File
+SOURCE=..\..\Compress\PPMD\PPMDRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Compress\PPMD\PPMDSubAlloc.h
# End Source File
# Begin Source File
@@ -1232,6 +1320,26 @@ SOURCE=..\..\Compress\Quantum\QuantumDecoder.cpp
SOURCE=..\..\Compress\Quantum\QuantumDecoder.h
# End Source File
# End Group
+# Begin Group "LZMA_Alone"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.h
+# End Source File
+# End Group
# End Group
# Begin Group "Archive"
@@ -1317,14 +1425,6 @@ SOURCE=..\..\Archive\7z\7zItem.h
# End Source File
# Begin Source File
-SOURCE=..\..\Archive\7z\7zMethodID.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zMethodID.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\Archive\7z\7zOut.cpp
# End Source File
# Begin Source File
@@ -1341,6 +1441,10 @@ SOURCE=..\..\Archive\7z\7zProperties.h
# End Source File
# Begin Source File
+SOURCE=..\..\Archive\7z\7zRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Archive\7z\7zSpecStream.cpp
# End Source File
# Begin Source File
@@ -1361,6 +1465,10 @@ SOURCE=..\..\Archive\7z\7zUpdate.h
# PROP Default_Filter ""
# Begin Source File
+SOURCE=..\..\Archive\BZip2\bz2Register.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Archive\BZip2\BZip2Handler.cpp
# End Source File
# Begin Source File
@@ -1429,6 +1537,10 @@ SOURCE=..\..\Archive\GZip\GZipOut.h
# End Source File
# Begin Source File
+SOURCE=..\..\Archive\GZip\GZipRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Archive\GZip\GZipUpdate.cpp
# End Source File
# Begin Source File
@@ -1481,6 +1593,10 @@ SOURCE=..\..\Archive\Tar\TarOut.h
# End Source File
# Begin Source File
+SOURCE=..\..\Archive\Tar\TarRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Archive\Tar\TarUpdate.cpp
# End Source File
# Begin Source File
@@ -1553,6 +1669,10 @@ SOURCE=..\..\Archive\Zip\ZipOut.h
# End Source File
# Begin Source File
+SOURCE=..\..\Archive\Zip\ZipRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Archive\Zip\ZipUpdate.cpp
# End Source File
# Begin Source File
@@ -1565,6 +1685,10 @@ SOURCE=..\..\Archive\Zip\ZipUpdate.h
# PROP Default_Filter ""
# Begin Source File
+SOURCE=..\..\Archive\Common\CoderLoader.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Archive\Common\CoderMixer2.cpp
# End Source File
# Begin Source File
@@ -1597,14 +1721,6 @@ SOURCE=..\..\Archive\Common\DummyOutStream.h
# End Source File
# Begin Source File
-SOURCE=..\..\Archive\Common\FilterCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\FilterCoder.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\Archive\Common\InStreamWithCRC.cpp
# End Source File
# Begin Source File
@@ -1655,6 +1771,10 @@ SOURCE=..\..\Archive\Split\SplitHandler.cpp
SOURCE=..\..\Archive\Split\SplitHandler.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Split\SplitRegister.cpp
+# End Source File
# End Group
# Begin Group "Z Format"
@@ -1667,6 +1787,10 @@ SOURCE=..\..\Archive\Z\ZHandler.cpp
SOURCE=..\..\Archive\Z\ZHandler.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Z\ZRegister.cpp
+# End Source File
# End Group
# Begin Group "cab"
@@ -1707,6 +1831,10 @@ SOURCE=..\..\Archive\Cab\CabIn.h
SOURCE=..\..\Archive\Cab\CabItem.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cab\CabRegister.cpp
+# End Source File
# End Group
# End Group
# Begin Group "UI Common"
@@ -1738,14 +1866,6 @@ SOURCE=..\..\UI\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
-SOURCE=..\..\UI\Common\ArchiverInfo.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\ArchiverInfo.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\UI\Common\DefaultName.cpp
# End Source File
# Begin Source File
@@ -1778,6 +1898,14 @@ SOURCE=..\..\UI\Common\ExtractingFilePath.h
# End Source File
# Begin Source File
+SOURCE=..\..\UI\Common\LoadCodecs.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\UI\Common\LoadCodecs.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\UI\Common\OpenArchive.cpp
# End Source File
# Begin Source File
@@ -2066,6 +2194,10 @@ SOURCE=..\..\Crypto\7zAES\7zAES.cpp
SOURCE=..\..\Crypto\7zAES\7zAES.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\7zAES\7zAESRegister.cpp
+# End Source File
# End Group
# Begin Group "WzAES"
@@ -2214,6 +2346,31 @@ SOURCE=..\..\PropID.h
# Begin Group "C-Compress"
# PROP Default_Filter ""
+# Begin Group "C Lz"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\LzHash.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinder.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.h
+# End Source File
+# End Group
+# Begin Group "C Huffman"
+
+# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\..\C\Compress\Huffman\HuffmanEncode.c
@@ -2223,24 +2380,69 @@ SOURCE=..\..\..\..\C\Compress\Huffman\HuffmanEncode.c
SOURCE=..\..\..\..\C\Compress\Huffman\HuffmanEncode.h
# End Source File
+# End Group
+# Begin Group "C Branch"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\..\C\Compress\Lz\LzHash.h
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARM.c
+# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
-SOURCE=..\..\..\..\C\Compress\Lz\MatchFinder.c
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARM.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARMThumb.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
-SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.c
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARMThumb.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchIA64.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
-SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.h
+SOURCE=..\..\..\..\C\Compress\Branch\BranchIA64.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchPPC.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchPPC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchSPARC.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchSPARC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchTypes.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.h
+# End Source File
+# End Group
# End Group
# Begin Source File
@@ -2253,6 +2455,15 @@ 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
+# Begin Source File
+
SOURCE=..\..\..\..\C\IStream.h
# End Source File
# Begin Source File
diff --git a/CPP/7zip/Bundles/Alone/makefile b/CPP/7zip/Bundles/Alone/makefile
index e076ed3a..eeec13a2 100755
--- a/CPP/7zip/Bundles/Alone/makefile
+++ b/CPP/7zip/Bundles/Alone/makefile
@@ -1,34 +1,14 @@
PROG = 7za.exe
LIBS = $(LIBS) user32.lib oleaut32.lib Advapi32.lib
-CFLAGS = $(CFLAGS) -I ../../../ \
- -DEXCLUDE_COM \
- -DNO_REGISTRY \
+CFLAGS = $(CFLAGS) -I ../../../ \
-DWIN_LONG_PATH \
- -DFORMAT_7Z \
- -DFORMAT_BZIP2 \
- -DFORMAT_CAB \
- -DFORMAT_GZIP \
- -DFORMAT_SPLIT \
- -DFORMAT_TAR \
- -DFORMAT_Z \
- -DFORMAT_ZIP \
-DCOMPRESS_MT \
- -DCOMPRESS_BCJ_X86 \
- -DCOMPRESS_BCJ2 \
- -DCOMPRESS_BZIP2 \
-DCOMPRESS_BZIP2_MT \
- -DCOMPRESS_COPY \
- -DCOMPRESS_DEFLATE \
- -DCOMPRESS_DEFLATE64 \
- -DCOMPRESS_IMPLODE \
- -DCOMPRESS_LZMA \
-DCOMPRESS_MF_MT \
- -DCOMPRESS_PPMD \
- -DCRYPTO_7ZAES \
- -DCRYPTO_AES \
- -DCRYPTO_ZIP \
-
+ -D_7ZIP_LARGE_PAGES \
+ -DBREAK_HANDLER \
+ -DBENCH_MT \
CONSOLE_OBJS = \
$O\ConsoleClose.obj \
@@ -42,7 +22,6 @@ CONSOLE_OBJS = \
$O\UserInputUtils.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\IntToString.obj \
@@ -70,8 +49,10 @@ WIN_OBJS = \
$O\Synchronization.obj
7ZIP_COMMON_OBJS = \
+ $O\CreateCoder.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
+ $O\FilterCoder.obj \
$O\InBuffer.obj \
$O\InOutTempBuffer.obj \
$O\LimitedStreams.obj \
@@ -79,6 +60,7 @@ WIN_OBJS = \
$O\LSBFDecoder.obj \
$O\LSBFEncoder.obj \
$O\MemBlocks.obj \
+ $O\MethodId.obj \
$O\OffsetStream.obj \
$O\OutBuffer.obj \
$O\OutMemStream.obj \
@@ -92,11 +74,11 @@ UI_COMMON_OBJS = \
$O\ArchiveCommandLine.obj \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
- $O\ArchiverInfo.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
+ $O\LoadCodecs.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
$O\SetProperties.obj \
@@ -114,7 +96,6 @@ AR_COMMON_OBJS = \
$O\CoderMixer2MT.obj \
$O\CrossThreadProgress.obj \
$O\DummyOutStream.obj \
- $O\FilterCoder.obj \
$O\InStreamWithCRC.obj \
$O\ItemNameUtils.obj \
$O\MultiStream.obj \
@@ -133,22 +114,24 @@ AR_COMMON_OBJS = \
$O\7zHandlerOut.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
- $O\7zMethodID.obj \
$O\7zOut.obj \
$O\7zProperties.obj \
$O\7zSpecStream.obj \
$O\7zUpdate.obj \
+ $O\7zRegister.obj \
BZ2_OBJS = \
$O\BZip2Handler.obj \
$O\BZip2HandlerOut.obj \
$O\BZip2Update.obj \
+ $O\bz2Register.obj \
CAB_OBJS = \
$O\CabBlockInStream.obj \
$O\CabHandler.obj \
$O\CabHeader.obj \
$O\CabIn.obj \
+ $O\CabRegister.obj \
GZ_OBJS = \
$O\GZipHandler.obj \
@@ -157,10 +140,12 @@ GZ_OBJS = \
$O\GZipIn.obj \
$O\GZipOut.obj \
$O\GZipUpdate.obj \
+ $O\GZipRegister.obj \
SPLIT_OBJS = \
$O\SplitHandler.obj \
$O\SplitHandlerOut.obj \
+ $O\SplitRegister.obj \
TAR_OBJS = \
$O\TarHandler.obj \
@@ -169,9 +154,11 @@ TAR_OBJS = \
$O\TarIn.obj \
$O\TarOut.obj \
$O\TarUpdate.obj \
+ $O\TarRegister.obj \
Z_OBJS = \
$O\ZHandler.obj \
+ $O\ZRegister.obj \
ZIP_OBJS = \
$O\ZipAddCommon.obj \
@@ -182,23 +169,43 @@ ZIP_OBJS = \
$O\ZipItem.obj \
$O\ZipOut.obj \
$O\ZipUpdate.obj \
+ $O\ZipRegister.obj \
BRANCH_OPT_OBJS = \
$O\BranchCoder.obj \
$O\x86.obj \
$O\x86_2.obj \
+ $O\ARM.obj \
+ $O\ARMThumb.obj \
+ $O\IA64.obj \
+ $O\PPC.obj \
+ $O\SPARC.obj \
+ $O\BranchRegister.obj \
+ $O\BCJRegister.obj \
+ $O\BCJ2Register.obj \
+
+SWAP_OPT_OBJS = \
+ $O\ByteSwap.obj \
+ $O\ByteSwapRegister.obj \
BZIP2_OBJS = \
$O\BZip2CRC.obj \
+ $O\BZip2Register.obj \
BZIP2_OPT_OBJS = \
$O\BZip2Decoder.obj \
$O\BZip2Encoder.obj \
+COPY_OBJS = \
+ $O\CopyCoder.obj \
+ $O\CopyRegister.obj \
+
DEFLATE_OPT_OBJS = \
$O\DeflateDecoder.obj \
$O\DeflateEncoder.obj \
+ $O\DeflateRegister.obj \
+ $O\Deflate64Register.obj \
LZ_OBJS = \
$O\LzOutWindow.obj \
@@ -206,6 +213,11 @@ LZ_OBJS = \
LZMA_OPT_OBJS = \
$O\LZMADecoder.obj \
$O\LZMAEncoder.obj \
+ $O\LZMARegister.obj \
+
+LZMA_BENCH_OBJS = \
+ $O\LzmaBench.obj \
+ $O\LzmaBenchCon.obj \
LZX_OBJS = \
$O\LzxDecoder.obj \
@@ -218,6 +230,7 @@ IMPLODE_OBJS = \
PPMD_OPT_OBJS = \
$O\PPMDDecoder.obj \
$O\PPMDEncoder.obj \
+ $O\PPMDRegister.obj \
SHRINK_OBJS = \
$O\ShrinkDecoder.obj \
@@ -228,6 +241,7 @@ COMPRESS_Z_OBJS = \
7ZAES_OPT_OBJS = \
$O\7zAES.obj \
+ $O\7zAESRegister.obj \
AES_OPT_OBJS = \
$O\MyAES.obj \
@@ -252,7 +266,7 @@ CRYPTO_ZIP_OBJS = \
$O\ZipCrypto.obj \
C_OBJS = \
- $O\7zCrc.obj \
+ $O\Alloc.obj \
$O\Sort.obj \
$O\Threads.obj \
@@ -260,11 +274,21 @@ C_LZ_OBJS = \
$O\MatchFinder.obj \
$O\MatchFinderMt.obj \
+C_BRANCH_OBJS = \
+ $O\BranchARM.obj \
+ $O\BranchARMThumb.obj \
+ $O\BranchIA64.obj \
+ $O\BranchPPC.obj \
+ $O\BranchSPARC.obj \
+ $O\BranchX86.obj \
+
+!include "../../Crc2.mak"
OBJS = \
$O\StdAfx.obj \
$(CONSOLE_OBJS) \
$(COMMON_OBJS) \
+ $(COMMON_OBJS_O2) \
$(WIN_OBJS) \
$(7ZIP_COMMON_OBJS) \
$(UI_COMMON_OBJS) \
@@ -280,18 +304,21 @@ OBJS = \
$(BZIP2_OBJS) \
$(BZIP2_OPT_OBJS) \
$(BRANCH_OPT_OBJS) \
+ $(SWAP_OPT_OBJS) \
+ $(COPY_OBJS) \
$(DEFLATE_OPT_OBJS) \
$(IMPLODE_OBJS) \
$(LZ_OBJS) \
$(LZMA_OPT_OBJS) \
+ $(LZMA_BENCH_OBJS) \
$(LZX_OBJS) \
$(PPMD_OPT_OBJS) \
$(SHRINK_OBJS) \
$(COMPRESS_Z_OBJS) \
$(C_OBJS) \
$(C_LZ_OBJS) \
+ $(C_BRANCH_OBJS) \
$O\BlockSort.obj \
- $O\CopyCoder.obj \
$O\HuffmanEncode.obj \
$O\RangeCoderBit.obj \
$(7ZAES_OPT_OBJS) \
@@ -301,6 +328,7 @@ OBJS = \
$(CRYPTO_ZIP_OBJS) \
$(CRYPTO_WZAES_OBJS) \
$O\QuantumDecoder.obj \
+ $(CRC_OBJS) \
$O\resource.res
@@ -339,10 +367,14 @@ $(ZIP_OBJS): ../../Archive/Zip/$(*B).cpp
$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp
$(COMPL_O2)
+$(SWAP_OPT_OBJS): ../../Compress/ByteSwap/$(*B).cpp
+ $(COMPL_O2)
$(BZIP2_OBJS): ../../Compress/BZip2/$(*B).cpp
$(COMPL)
$(BZIP2_OPT_OBJS): ../../Compress/BZip2/$(*B).cpp
$(COMPL_O2)
+$(COPY_OBJS): ../../Compress/Copy/$(*B).cpp
+ $(COMPL)
$(DEFLATE_OPT_OBJS): ../../Compress/Deflate/$(*B).cpp
$(COMPL_O2)
$(IMPLODE_OBJS): ../../Compress/Implode/$(*B).cpp
@@ -351,6 +383,9 @@ $(LZ_OBJS): ../../Compress/LZ/$(*B).cpp
$(COMPL_O2)
$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp
$(COMPL_O2)
+$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp
+ $(COMPL)
+
$(LZX_OBJS): ../../Compress/Lzx/$(*B).cpp
$(COMPL_O2)
$(PPMD_OPT_OBJS): ../../Compress/PPMD/$(*B).cpp
@@ -362,8 +397,6 @@ $(COMPRESS_Z_OBJS): ../../Compress/Z/$(*B).cpp
$O\BlockSort.obj: ../../Compress/BWT/$(*B).cpp
$(COMPL_O2)
-$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
- $(COMPL)
$O\RangeCoderBit.obj: ../../Compress/RangeCoder/$(*B).cpp
$(COMPL)
$O\QuantumDecoder.obj: ../../Compress/Quantum/$(*B).cpp
@@ -386,5 +419,8 @@ $(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
$(C_LZ_OBJS): ../../../../C/Compress/Lz/$(*B).c
$(COMPL_O2)
+$(C_BRANCH_OBJS): ../../../../C/Compress/Branch/$(*B).c
+ $(COMPL_O2)
$O\HuffmanEncode.obj: ../../../../C/Compress/Huffman/$(*B).c
$(COMPL_O2)
+!include "../../Crc.mak" \ No newline at end of file
diff --git a/CPP/7zip/Bundles/Alone7z/Alone.dsp b/CPP/7zip/Bundles/Alone7z/Alone.dsp
index 5ff71f2c..e0c46273 100755
--- a/CPP/7zip/Bundles/Alone7z/Alone.dsp
+++ b/CPP/7zip/Bundles/Alone7z/Alone.dsp
@@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMFORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "_NO_CRYPTO" /D "BREAK_HANDLER" /D "BENCH_MT" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMFORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "_NO_CRYPTO" /D "BREAK_HANDLER" /D "BENCH_MT" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -94,7 +94,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /Yu"StdAfx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMFORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "_NO_CRYPTO" /D "BREAK_HANDLER" /D "BENCH_MT" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -121,7 +121,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
-# ADD CPP /nologo /Gz /W4 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMFORMAT_SPLIT" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /W4 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "_NO_CRYPTO" /D "BREAK_HANDLER" /D "BENCH_MT" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -245,14 +245,6 @@ SOURCE=..\..\..\Common\AlignedBuffer.h
# End Source File
# 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
@@ -277,10 +269,6 @@ SOURCE=..\..\..\Common\CRC.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\CRC.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\..\Common\Defs.h
# End Source File
# Begin Source File
@@ -525,6 +513,14 @@ SOURCE=..\..\..\Windows\Time.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=..\..\Archive\Common\CrossThreadProgress.cpp
# End Source File
# Begin Source File
@@ -549,6 +545,14 @@ SOURCE=..\..\Common\FileStreams.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\InBuffer.cpp
# End Source File
# Begin Source File
@@ -597,6 +601,14 @@ SOURCE=..\..\Common\LSBFEncoder.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\MSBFDecoder.h
# End Source File
# Begin Source File
@@ -637,6 +649,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
@@ -740,96 +760,16 @@ SOURCE=..\..\Compress\Copy\CopyCoder.cpp
SOURCE=..\..\Compress\Copy\CopyCoder.h
# End Source File
-# End Group
-# Begin Group "LZ"
-
-# PROP Default_Filter ""
-# Begin Group "MT"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Compress\LZ\MT\MT.cpp
-
-!IF "$(CFG)" == "Alone - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "Alone - Win32 Debug"
-
-!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "Alone - Win32 DebugU"
-
-!ENDIF
-
-# End Source File
# Begin Source File
-SOURCE=..\..\Compress\LZ\MT\MT.h
+SOURCE=..\..\Compress\Copy\CopyRegister.cpp
# End Source File
# End Group
-# Begin Group "HC"
+# Begin Group "LZ"
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\Compress\LZ\HashChain\HC.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZ\HashChain\HC2.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZ\HashChain\HC3.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZ\HashChain\HC4.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZ\HashChain\HC4b.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZ\HashChain\HCMain.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\..\Compress\LZ\IMatchFinder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZ\LZInWindow.cpp
-
-!IF "$(CFG)" == "Alone - Win32 Release"
-
-# ADD CPP /O1
-
-!ELSEIF "$(CFG)" == "Alone - Win32 Debug"
-
-!ELSEIF "$(CFG)" == "Alone - Win32 ReleaseU"
-
-# ADD CPP /O1
-
-!ELSEIF "$(CFG)" == "Alone - Win32 DebugU"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZ\LZInWindow.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\Compress\LZ\LZOutWindow.cpp
!IF "$(CFG)" == "Alone - Win32 Release"
@@ -909,6 +849,10 @@ SOURCE=..\..\Compress\LZMA\LZMAEncoder.cpp
SOURCE=..\..\Compress\LZMA\LZMAEncoder.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA\LZMARegister.cpp
+# End Source File
# End Group
# Begin Group "RangeCoder"
@@ -949,6 +893,26 @@ SOURCE=..\..\Compress\RangeCoder\RangeCoderBitTree.h
SOURCE=..\..\Compress\RangeCoder\RangeCoderOpt.h
# End Source File
# End Group
+# Begin Group "LZMA_Alone"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.h
+# End Source File
+# End Group
# End Group
# Begin Group "Archive"
@@ -1034,14 +998,6 @@ SOURCE=..\..\Archive\7z\7zItem.h
# End Source File
# Begin Source File
-SOURCE=..\..\Archive\7z\7zMethodID.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zMethodID.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\Archive\7z\7zOut.cpp
# End Source File
# Begin Source File
@@ -1058,6 +1014,10 @@ SOURCE=..\..\Archive\7z\7zProperties.h
# End Source File
# Begin Source File
+SOURCE=..\..\Archive\7z\7zRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Archive\7z\7zSpecStream.cpp
# End Source File
# Begin Source File
@@ -1110,14 +1070,6 @@ SOURCE=..\..\Archive\Common\DummyOutStream.h
# End Source File
# Begin Source File
-SOURCE=..\..\Archive\Common\FilterCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\FilterCoder.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\Archive\Common\InStreamWithCRC.cpp
# End Source File
# Begin Source File
@@ -1199,14 +1151,6 @@ SOURCE=..\..\UI\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
-SOURCE=..\..\UI\Common\ArchiverInfo.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\ArchiverInfo.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\UI\Common\DefaultName.cpp
# End Source File
# Begin Source File
@@ -1239,6 +1183,14 @@ SOURCE=..\..\UI\Common\ExtractingFilePath.h
# End Source File
# Begin Source File
+SOURCE=..\..\UI\Common\LoadCodecs.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\UI\Common\LoadCodecs.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\UI\Common\OpenArchive.cpp
# End Source File
# Begin Source File
@@ -1354,5 +1306,128 @@ SOURCE=..\..\IStream.h
SOURCE=..\..\PropID.h
# End Source File
# End Group
+# Begin Group "C"
+
+# PROP Default_Filter ""
+# Begin Group "C Branch"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARM.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARM.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARMThumb.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARMThumb.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchIA64.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchIA64.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchPPC.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchPPC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchSPARC.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchSPARC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchTypes.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.h
+# End Source File
+# End Group
+# 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
+# Begin Source File
+
+SOURCE=..\..\..\..\C\IStream.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\LzHash.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinder.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Types.h
+# End Source File
+# End Group
# End Target
# End Project
diff --git a/CPP/7zip/Bundles/Alone7z/makefile b/CPP/7zip/Bundles/Alone7z/makefile
index 9bec8059..4ae28d39 100755
--- a/CPP/7zip/Bundles/Alone7z/makefile
+++ b/CPP/7zip/Bundles/Alone7z/makefile
@@ -2,18 +2,13 @@ PROG = 7za.exe
LIBS = $(LIBS) user32.lib oleaut32.lib Advapi32.lib
CFLAGS = $(CFLAGS) -I ../../../ \
- -DEXCLUDE_COM \
- -DNO_REGISTRY \
-D_NO_CRYPTO \
-DWIN_LONG_PATH \
- -DFORMAT_7Z \
-DCOMPRESS_MT \
- -DCOMPRESS_BCJ_X86 \
- -DCOMPRESS_BCJ2 \
- -DCOMPRESS_COPY \
- -DCOMPRESS_LZMA \
-DCOMPRESS_MF_MT \
- -D_NO_CRYPTO
+ -D_NO_CRYPTO \
+ -DBREAK_HANDLER \
+ -DBENCH_MT \
CONSOLE_OBJS = \
@@ -28,7 +23,6 @@ CONSOLE_OBJS = \
$O\UserInputUtils.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\IntToString.obj \
@@ -56,12 +50,15 @@ WIN_OBJS = \
$O\Synchronization.obj
7ZIP_COMMON_OBJS = \
+ $O\CreateCoder.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\InBuffer.obj \
$O\InOutTempBuffer.obj \
+ $O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\LockedStream.obj \
+ $O\MethodId.obj \
$O\OffsetStream.obj \
$O\OutBuffer.obj \
$O\ProgressUtils.obj \
@@ -73,11 +70,11 @@ UI_COMMON_OBJS = \
$O\ArchiveCommandLine.obj \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
- $O\ArchiverInfo.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
+ $O\LoadCodecs.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
$O\SetProperties.obj \
@@ -95,7 +92,6 @@ AR_COMMON_OBJS = \
$O\CoderMixer2MT.obj \
$O\CrossThreadProgress.obj \
$O\DummyOutStream.obj \
- $O\FilterCoder.obj \
$O\InStreamWithCRC.obj \
$O\ItemNameUtils.obj \
$O\MultiStream.obj \
@@ -114,9 +110,9 @@ AR_COMMON_OBJS = \
$O\7zHandlerOut.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
- $O\7zMethodID.obj \
$O\7zOut.obj \
$O\7zProperties.obj \
+ $O\7zRegister.obj \
$O\7zSpecStream.obj \
$O\7zUpdate.obj \
@@ -125,6 +121,22 @@ BRANCH_OPT_OBJS = \
$O\BranchCoder.obj \
$O\x86.obj \
$O\x86_2.obj \
+ $O\ARM.obj \
+ $O\ARMThumb.obj \
+ $O\IA64.obj \
+ $O\PPC.obj \
+ $O\SPARC.obj \
+ $O\BranchRegister.obj \
+ $O\BCJRegister.obj \
+ $O\BCJ2Register.obj \
+
+SWAP_OPT_OBJS = \
+ $O\ByteSwap.obj \
+ $O\ByteSwapRegister.obj \
+
+COPY_OBJS = \
+ $O\CopyCoder.obj \
+ $O\CopyRegister.obj \
LZ_OBJS = \
$O\LZOutWindow.obj \
@@ -132,8 +144,14 @@ LZ_OBJS = \
LZMA_OPT_OBJS = \
$O\LZMADecoder.obj \
$O\LZMAEncoder.obj \
+ $O\LZMARegister.obj \
+
+LZMA_BENCH_OBJS = \
+ $O\LzmaBench.obj \
+ $O\LzmaBenchCon.obj \
C_OBJS = \
+ $O\Alloc.obj \
$O\7zCrc.obj \
$O\Sort.obj \
$O\Threads.obj \
@@ -142,6 +160,14 @@ C_LZ_OBJS = \
$O\MatchFinder.obj \
$O\MatchFinderMt.obj \
+C_BRANCH_OBJS = \
+ $O\BranchARM.obj \
+ $O\BranchARMThumb.obj \
+ $O\BranchIA64.obj \
+ $O\BranchPPC.obj \
+ $O\BranchSPARC.obj \
+ $O\BranchX86.obj \
+
OBJS = \
$O\StdAfx.obj \
$(CONSOLE_OBJS) \
@@ -152,12 +178,16 @@ OBJS = \
$(AR_COMMON_OBJS) \
$(7Z_OBJS) \
$(BRANCH_OPT_OBJS) \
+ $(SWAP_OPT_OBJS) \
+ $(COPY_OBJS) \
$(LZ_OBJS) \
$(LZMA_OPT_OBJS) \
+ $(LZMA_BENCH_OBJS) \
$(C_OBJS) \
$(C_LZ_OBJS) \
- $O\CopyCoder.obj \
+ $(C_BRANCH_OBJS) \
$O\RangeCoderBit.obj \
+ $(CRC_OBJS) \
$O\resource.res
@@ -181,11 +211,15 @@ $(7Z_OBJS): ../../Archive/7z/$(*B).cpp
$(COMPL)
$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp
$(COMPL_O2)
+$(SWAP_OPT_OBJS): ../../Compress/ByteSwap/$(*B).cpp
+ $(COMPL_O2)
+$(COPY_OBJS): ../../Compress/Copy/$(*B).cpp
+ $(COMPL)
$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp
$(COMPL)
$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp
$(COMPL_O2)
-$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
+$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp
$(COMPL)
$O\RangeCoderBit.obj: ../../Compress/RangeCoder/$(*B).cpp
$(COMPL)
@@ -194,3 +228,5 @@ $(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
$(C_LZ_OBJS): ../../../../C/Compress/Lz/$(*B).c
$(COMPL_O2)
+$(C_BRANCH_OBJS): ../../../../C/Compress/Branch/$(*B).c
+ $(COMPL_O2)
diff --git a/CPP/7zip/Bundles/Format7z/Format7z.dsp b/CPP/7zip/Bundles/Format7z/Format7z.dsp
deleted file mode 100755
index a59cd581..00000000
--- a/CPP/7zip/Bundles/Format7z/Format7z.dsp
+++ /dev/null
@@ -1,1006 +0,0 @@
-# Microsoft Developer Studio Project File - Name="7z" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=7z - 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 "Format7z.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 "Format7z.mak" CFG="7z - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "7z - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "7z - 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)" == "7z - 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 "MY7Z_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE_DECODER" /D "COMPRESS_BZIP2_DECODER" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_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\7za.dll" /opt:NOWIN98
-# SUBTRACT LINK32 /pdb:none /debug
-
-!ELSEIF "$(CFG)" == "7z - 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 "MY7Z_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\SDK" /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE_DECODER" /D "COMPRESS_BZIP2_DECODER" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_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\7za.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "7z - Win32 Release"
-# Name "7z - Win32 Debug"
-# Begin Group "Spec"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7z.ico
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Archive.def
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\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\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\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
-# Begin Source File
-
-SOURCE=..\..\..\Common\Wildcard.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Wildcard.h
-# End Source File
-# End Group
-# Begin Group "Windows"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileDir.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileDir.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\FileIO.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileIO.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
-# End Group
-# Begin Group "Archive common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CoderMixer2.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CoderMixer2.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CoderMixer2MT.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CoderMixer2MT.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CrossThreadProgress.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CrossThreadProgress.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\FilterCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\FilterCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\InStreamWithCRC.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\InStreamWithCRC.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\ItemNameUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\ItemNameUtils.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\OutStreamWithCRC.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\ParseProperties.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\ParseProperties.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 "PPMD"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDContext.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDDecode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDDecoder.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDDecoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDEncode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDEncoder.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDEncoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDSubAlloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDType.h
-# End Source File
-# End Group
-# Begin Group "Branch"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Compress\Branch\BranchCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\Branch\BranchCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\Branch\x86.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\Branch\x86.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\Branch\x86_2.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\Branch\x86_2.h
-# End Source File
-# End Group
-# Begin Group "LZMA"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Compress\LZMA\LZMA.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZMA\LZMADecoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZMA\LZMAEncoder.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZMA\LZMAEncoder.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 "RangeCoder"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoder\RangeCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoder\RangeCoderBitTree.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoder\RangeCoderOpt.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)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - 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 "BZip2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Compress\BZip2\BZip2Const.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BZip2\BZip2CRC.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BZip2\BZip2CRC.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BZip2\BZip2Decoder.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BZip2\BZip2Decoder.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Crypto"
-
-# PROP Default_Filter ""
-# Begin Group "AES"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\aes.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\AES_CBC.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\aescpp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\aescrypt.c
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\aeskey.c
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\aesopt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\aestab.c
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\MyAES.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\MyAES.h
-# End Source File
-# End Group
-# Begin Group "7zAES"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Crypto\7zAES\7zAES.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\7zAES\7zAES.h
-# End Source File
-# End Group
-# Begin Group "Hash"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Crypto\Hash\Sha256.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\Hash\Sha256.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "7z"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zCompressionMode.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zCompressionMode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zDecode.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zDecode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zEncode.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zEncode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zExtract.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zFolderInStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zFolderInStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zFolderOutStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zFolderOutStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHandler.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHandler.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHandlerOut.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHeader.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHeader.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zIn.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zIn.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zItem.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zMethodID.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zMethodID.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zMethods.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zOut.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zOut.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zProperties.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zProperties.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zSpecStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zSpecStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zUpdate.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zUpdate.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zUpdateItem.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\InOutTempBuffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\InOutTempBuffer.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\LockedStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\LockedStream.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\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\StreamBinder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamBinder.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 "C"
-
-# PROP Default_Filter ""
-# Begin Group "C-Lz"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Compress\Lz\LzHash.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Compress\Lz\MatchFinder.c
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Compress\Lz\MatchFinder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.c
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\..\..\..\C\7zCrc.c
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\7zCrc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Threads.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Threads.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/CPP/7zip/Bundles/Format7z/makefile b/CPP/7zip/Bundles/Format7z/makefile
index 1134faee..f74602ae 100755
--- a/CPP/7zip/Bundles/Format7z/makefile
+++ b/CPP/7zip/Bundles/Format7z/makefile
@@ -1,25 +1,14 @@
PROG = 7za.dll
-DEF_FILE = ../../Archive/Archive.def
+DEF_FILE = ../../Archive/Archive2.def
LIBS = $(LIBS) user32.lib oleaut32.lib
CFLAGS = $(CFLAGS) -I ../../../ \
- -DEXCLUDE_COM \
- -DNO_REGISTRY \
- -DFORMAT_7Z \
-DCOMPRESS_MT \
- -DCOMPRESS_BCJ_X86 \
- -DCOMPRESS_BCJ2 \
- -DCOMPRESS_BZIP2_DECODER \
- -DCOMPRESS_BZIP2_MT \
- -DCOMPRESS_COPY \
- -DCOMPRESS_DEFLATE_DECODER \
- -DCOMPRESS_LZMA \
-DCOMPRESS_MF_MT \
- -DCOMPRESS_PPMD \
- -DCRYPTO_7ZAES \
- -DCRYPTO_AES \
+ -DCOMPRESS_BZIP2_MT \
+ -DDEFLATE_EXTRACT_ONLY \
+ -DBZIP2_EXTRACT_ONLY \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\CRC.obj \
$O\IntToString.obj \
$O\NewHandler.obj \
@@ -37,22 +26,28 @@ WIN_OBJS = \
$O\Synchronization.obj
7ZIP_COMMON_OBJS = \
+ $O\CreateCoder.obj \
$O\InBuffer.obj \
$O\InOutTempBuffer.obj \
+ $O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\LockedStream.obj \
$O\LSBFDecoder.obj \
+ $O\MethodId.obj \
$O\OutBuffer.obj \
$O\ProgressUtils.obj \
$O\StreamBinder.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
+AR_OBJS = \
+ $O\ArchiveExports.obj \
+ $O\DllExports2.obj \
+
AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\CoderMixer2MT.obj \
$O\CrossThreadProgress.obj \
- $O\FilterCoder.obj \
$O\InStreamWithCRC.obj \
$O\ItemNameUtils.obj \
$O\OutStreamWithCRC.obj \
@@ -60,7 +55,6 @@ AR_COMMON_OBJS = \
7Z_OBJS = \
- $O\DllExports.obj \
$O\7zCompressionMode.obj \
$O\7zDecode.obj \
$O\7zEncode.obj \
@@ -71,26 +65,47 @@ AR_COMMON_OBJS = \
$O\7zHandlerOut.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
- $O\7zMethodID.obj \
$O\7zOut.obj \
$O\7zProperties.obj \
$O\7zSpecStream.obj \
$O\7zUpdate.obj \
+ $O\7zRegister.obj \
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
+
BRANCH_OPT_OBJS = \
$O\BranchCoder.obj \
$O\x86.obj \
$O\x86_2.obj \
+ $O\ARM.obj \
+ $O\ARMThumb.obj \
+ $O\IA64.obj \
+ $O\PPC.obj \
+ $O\SPARC.obj \
+ $O\BranchRegister.obj \
+ $O\BCJRegister.obj \
+ $O\BCJ2Register.obj \
+
+SWAP_OPT_OBJS = \
+ $O\ByteSwap.obj \
+ $O\ByteSwapRegister.obj \
BZIP2_OBJS = \
$O\BZip2CRC.obj \
+ $O\BZip2Register.obj \
BZIP2_OPT_OBJS = \
$O\BZip2Decoder.obj \
+COPY_OBJS = \
+ $O\CopyCoder.obj \
+ $O\CopyRegister.obj \
+
DEFLATE_OPT_OBJS = \
$O\DeflateDecoder.obj \
+ $O\DeflateRegister.obj \
LZ_OBJS = \
$O\LZOutWindow.obj \
@@ -98,14 +113,17 @@ LZ_OBJS = \
LZMA_OPT_OBJS = \
$O\LZMADecoder.obj \
$O\LZMAEncoder.obj \
+ $O\LZMARegister.obj \
PPMD_OPT_OBJS = \
$O\PPMDDecoder.obj \
$O\PPMDEncoder.obj \
+ $O\PPMDRegister.obj \
7ZAES_OPT_OBJS = \
$O\7zAES.obj \
+ $O\7zAESRegister.obj \
AES_OPT_OBJS = \
$O\MyAES.obj \
@@ -119,36 +137,51 @@ CRYPTO_HASH_OBJS = \
$O\Sha256.obj \
C_OBJS = \
- $O\7zCrc.obj \
+ $O\Alloc.obj \
$O\Threads.obj \
C_LZ_OBJS = \
$O\MatchFinder.obj \
$O\MatchFinderMt.obj \
+C_BRANCH_OBJS = \
+ $O\BranchARM.obj \
+ $O\BranchARMThumb.obj \
+ $O\BranchIA64.obj \
+ $O\BranchPPC.obj \
+ $O\BranchSPARC.obj \
+ $O\BranchX86.obj \
+
+!include "../../Crc2.mak"
+
OBJS = \
$O\StdAfx.obj \
$(CONSOLE_OBJS) \
$(COMMON_OBJS) \
$(WIN_OBJS) \
$(7ZIP_COMMON_OBJS) \
+ $(AR_OBJS) \
$(AR_COMMON_OBJS) \
$(7Z_OBJS) \
+ $(COMPRESS_OBJS) \
+ $(BRANCH_OPT_OBJS) \
+ $(SWAP_OPT_OBJS) \
$(BZIP2_OBJS) \
$(BZIP2_OPT_OBJS) \
- $(BRANCH_OPT_OBJS) \
+ $(COPY_OBJS) \
$(DEFLATE_OPT_OBJS) \
$(LZ_OBJS) \
$(LZMA_OPT_OBJS) \
$(PPMD_OPT_OBJS) \
$(C_OBJS) \
$(C_LZ_OBJS) \
- $O\CopyCoder.obj \
+ $(C_BRANCH_OBJS) \
$O\RangeCoderBit.obj \
$(7ZAES_OPT_OBJS) \
$(AES_OPT_OBJS) \
$(AES_ORIG_OBJS) \
$(CRYPTO_HASH_OBJS) \
+ $(CRC_OBJS) \
$O\resource.res
@@ -160,18 +193,26 @@ $(WIN_OBJS): ../../../Windows/$(*B).cpp
$(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
+$(AR_OBJS): ../../Archive/$(*B).cpp
+ $(COMPL)
$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp
$(COMPL)
$(7Z_OBJS): ../../Archive/7z/$(*B).cpp
$(COMPL)
+$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
+ $(COMPL)
$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp
$(COMPL_O2)
+$(SWAP_OPT_OBJS): ../../Compress/ByteSwap/$(*B).cpp
+ $(COMPL_O2)
$(BZIP2_OBJS): ../../Compress/BZip2/$(*B).cpp
$(COMPL)
$(BZIP2_OPT_OBJS): ../../Compress/BZip2/$(*B).cpp
$(COMPL_O2)
+$(COPY_OBJS): ../../Compress/Copy/$(*B).cpp
+ $(COMPL)
$(DEFLATE_OPT_OBJS): ../../Compress/Deflate/$(*B).cpp
$(COMPL_O2)
$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp
@@ -181,8 +222,6 @@ $(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp
$(PPMD_OPT_OBJS): ../../Compress/PPMD/$(*B).cpp
$(COMPL_O2)
-$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
- $(COMPL)
$O\RangeCoderBit.obj: ../../Compress/RangeCoder/$(*B).cpp
$(COMPL)
@@ -197,5 +236,9 @@ $(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
+$(C_BRANCH_OBJS): ../../../../C/Compress/Branch/$(*B).c
+ $(COMPL_O2)
$(C_LZ_OBJS): ../../../../C/Compress/Lz/$(*B).c
$(COMPL_O2)
+
+!include "../../Crc.mak"
diff --git a/CPP/7zip/Bundles/Format7zExtract/Format7z.dsp b/CPP/7zip/Bundles/Format7zExtract/Format7z.dsp
deleted file mode 100755
index d049d00c..00000000
--- a/CPP/7zip/Bundles/Format7zExtract/Format7z.dsp
+++ /dev/null
@@ -1,813 +0,0 @@
-# Microsoft Developer Studio Project File - Name="7z" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=7z - 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 "Format7z.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 "Format7z.mak" CFG="7z - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "7z - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "7z - 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)" == "7z - 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 "MY7Z_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "EXTRACT_ONLY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE_DECODER" /D "COMPRESS_BZIP2_DECODER" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_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\7zxa.dll" /opt:NOWIN98
-# SUBTRACT LINK32 /pdb:none /debug
-
-!ELSEIF "$(CFG)" == "7z - 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 "MY7Z_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\SDK" /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "EXTRACT_ONLY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_MT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE_DECODER" /D "COMPRESS_BZIP2_DECODER" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_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\7zxa.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "7z - Win32 Release"
-# Name "7z - Win32 Debug"
-# Begin Group "Spec"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7z.ico
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Archive.def
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\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\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\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
-# Begin Source File
-
-SOURCE=..\..\..\Common\Wildcard.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Wildcard.h
-# End Source File
-# End Group
-# Begin Group "Windows"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileDir.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileDir.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\FileIO.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Windows\FileIO.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
-# End Group
-# Begin Group "Archive common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CoderMixer2.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CoderMixer2.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CoderMixer2MT.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CoderMixer2MT.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CrossThreadProgress.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\CrossThreadProgress.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\FilterCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\FilterCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\ItemNameUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\ItemNameUtils.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\OutStreamWithCRC.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\ParseProperties.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\ParseProperties.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 "PPMD"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDContext.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDDecode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDDecoder.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDDecoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDSubAlloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\PPMD\PPMDType.h
-# End Source File
-# End Group
-# Begin Group "Branch"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Compress\Branch\BranchCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\Branch\BranchCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\Branch\x86.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\Branch\x86.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\Branch\x86_2.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\Branch\x86_2.h
-# End Source File
-# End Group
-# Begin Group "LZMA"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Compress\LZMA\LZMA.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\LZMA\LZMADecoder.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 "RangeCoder"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoder\RangeCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoder\RangeCoderBitTree.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\RangeCoder\RangeCoderOpt.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)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - 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 "BZip2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Compress\BZip2\BZip2Const.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BZip2\BZip2CRC.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BZip2\BZip2CRC.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BZip2\BZip2Decoder.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Compress\BZip2\BZip2Decoder.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Crypto"
-
-# PROP Default_Filter ""
-# Begin Group "AES"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\aes.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\AES_CBC.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\aescpp.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\aescrypt.c
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\aeskey.c
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\aesopt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\aestab.c
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\MyAES.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\AES\MyAES.h
-# End Source File
-# End Group
-# Begin Group "7zAES"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Crypto\7zAES\7zAES.cpp
-
-!IF "$(CFG)" == "7z - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "7z - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\7zAES\7zAES.h
-# End Source File
-# End Group
-# Begin Group "Hash"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Crypto\Hash\Sha256.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Crypto\Hash\Sha256.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "7z"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zDecode.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zDecode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zExtract.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zFolderOutStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zFolderOutStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHandler.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHandler.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHeader.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zHeader.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zIn.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zIn.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zItem.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zMethodID.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zMethodID.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zMethods.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zProperties.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zProperties.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\LockedStream.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\LockedStream.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\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\StreamBinder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamBinder.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
-# End Target
-# End Project
diff --git a/CPP/7zip/Bundles/Format7zExtract/Format7z.dsw b/CPP/7zip/Bundles/Format7zExtract/Format7z.dsw
deleted file mode 100755
index 324dab1f..00000000
--- a/CPP/7zip/Bundles/Format7zExtract/Format7z.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: "7z"=.\Format7z.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/CPP/7zip/Bundles/Format7zExtract/makefile b/CPP/7zip/Bundles/Format7zExtract/makefile
index e52ab019..a8549741 100755
--- a/CPP/7zip/Bundles/Format7zExtract/makefile
+++ b/CPP/7zip/Bundles/Format7zExtract/makefile
@@ -1,25 +1,12 @@
PROG = 7zxa.dll
-DEF_FILE = ../../Archive/Archive.def
+DEF_FILE = ../../Archive/Archive2.def
LIBS = $(LIBS) user32.lib oleaut32.lib
CFLAGS = $(CFLAGS) -I ../../../ \
- -DEXCLUDE_COM \
- -DNO_REGISTRY \
-DEXTRACT_ONLY \
- -DFORMAT_7Z \
-DCOMPRESS_MT \
- -DCOMPRESS_BCJ_X86 \
- -DCOMPRESS_BCJ2 \
- -DCOMPRESS_BZIP2_DECODER \
-DCOMPRESS_BZIP2_MT \
- -DCOMPRESS_COPY \
- -DCOMPRESS_DEFLATE_DECODER \
- -DCOMPRESS_LZMA \
- -DCOMPRESS_PPMD \
- -DCRYPTO_7ZAES \
- -DCRYPTO_AES \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\CRC.obj \
$O\IntToString.obj \
$O\NewHandler.obj \
@@ -37,29 +24,33 @@ WIN_OBJS = \
$O\Synchronization.obj
7ZIP_COMMON_OBJS = \
+ $O\CreateCoder.obj \
$O\InBuffer.obj \
$O\InOutTempBuffer.obj \
+ $O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\LockedStream.obj \
$O\LSBFDecoder.obj \
+ $O\MethodId.obj \
$O\OutBuffer.obj \
$O\ProgressUtils.obj \
$O\StreamBinder.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
+AR_OBJS = \
+ $O\ArchiveExports.obj \
+ $O\DllExports2.obj \
+
AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\CoderMixer2MT.obj \
$O\CrossThreadProgress.obj \
- $O\FilterCoder.obj \
$O\ItemNameUtils.obj \
$O\OutStreamWithCRC.obj \
$O\ParseProperties.obj \
-
7Z_OBJS = \
- $O\DllExports.obj \
$O\7zCompressionMode.obj \
$O\7zDecode.obj \
$O\7zExtract.obj \
@@ -67,36 +58,60 @@ AR_COMMON_OBJS = \
$O\7zHandler.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
- $O\7zMethodID.obj \
$O\7zProperties.obj \
+ $O\7zRegister.obj \
+
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
BRANCH_OPT_OBJS = \
$O\BranchCoder.obj \
$O\x86.obj \
$O\x86_2.obj \
+ $O\ARM.obj \
+ $O\ARMThumb.obj \
+ $O\IA64.obj \
+ $O\PPC.obj \
+ $O\SPARC.obj \
+ $O\BranchRegister.obj \
+ $O\BCJRegister.obj \
+ $O\BCJ2Register.obj \
+
+SWAP_OPT_OBJS = \
+ $O\ByteSwap.obj \
+ $O\ByteSwapRegister.obj \
BZIP2_OBJS = \
$O\BZip2CRC.obj \
+ $O\BZip2Register.obj \
BZIP2_OPT_OBJS = \
$O\BZip2Decoder.obj \
+COPY_OBJS = \
+ $O\CopyCoder.obj \
+ $O\CopyRegister.obj \
+
DEFLATE_OPT_OBJS = \
$O\DeflateDecoder.obj \
+ $O\DeflateRegister.obj \
LZ_OBJS = \
$O\LZOutWindow.obj \
LZMA_OPT_OBJS = \
$O\LZMADecoder.obj \
+ $O\LZMARegister.obj \
PPMD_OPT_OBJS = \
$O\PPMDDecoder.obj \
+ $O\PPMDRegister.obj \
7ZAES_OPT_OBJS = \
$O\7zAES.obj \
+ $O\7zAESRegister.obj \
AES_OPT_OBJS = \
$O\MyAES.obj \
@@ -109,26 +124,45 @@ AES_ORIG_OBJS = \
CRYPTO_HASH_OBJS = \
$O\Sha256.obj \
+C_OBJS = \
+ $O\Alloc.obj \
+
+C_BRANCH_OBJS = \
+ $O\BranchARM.obj \
+ $O\BranchARMThumb.obj \
+ $O\BranchIA64.obj \
+ $O\BranchPPC.obj \
+ $O\BranchSPARC.obj \
+ $O\BranchX86.obj \
+
+!include "../../Crc2.mak"
+
OBJS = \
$O\StdAfx.obj \
$(CONSOLE_OBJS) \
$(COMMON_OBJS) \
$(WIN_OBJS) \
$(7ZIP_COMMON_OBJS) \
+ $(AR_OBJS) \
$(AR_COMMON_OBJS) \
$(7Z_OBJS) \
+ $(COMPRESS_OBJS) \
+ $(SWAP_OPT_OBJS) \
$(BZIP2_OBJS) \
$(BZIP2_OPT_OBJS) \
$(BRANCH_OPT_OBJS) \
+ $(COPY_OBJS) \
$(DEFLATE_OPT_OBJS) \
$(LZ_OBJS) \
$(LZMA_OPT_OBJS) \
$(PPMD_OPT_OBJS) \
- $O\CopyCoder.obj \
$(7ZAES_OPT_OBJS) \
$(AES_OPT_OBJS) \
$(AES_ORIG_OBJS) \
$(CRYPTO_HASH_OBJS) \
+ $(C_OBJS) \
+ $(C_BRANCH_OBJS) \
+ $(CRC_OBJS) \
$O\resource.res
@@ -140,18 +174,26 @@ $(WIN_OBJS): ../../../Windows/$(*B).cpp
$(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
+$(AR_OBJS): ../../Archive/$(*B).cpp
+ $(COMPL)
$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp
$(COMPL)
$(7Z_OBJS): ../../Archive/7z/$(*B).cpp
$(COMPL)
+$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
+ $(COMPL)
$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp
$(COMPL_O2)
+$(SWAP_OPT_OBJS): ../../Compress/ByteSwap/$(*B).cpp
+ $(COMPL_O2)
$(BZIP2_OBJS): ../../Compress/BZip2/$(*B).cpp
$(COMPL)
$(BZIP2_OPT_OBJS): ../../Compress/BZip2/$(*B).cpp
$(COMPL_O2)
+$(COPY_OBJS): ../../Compress/Copy/$(*B).cpp
+ $(COMPL)
$(DEFLATE_OPT_OBJS): ../../Compress/Deflate/$(*B).cpp
$(COMPL_O2)
$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp
@@ -161,9 +203,6 @@ $(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp
$(PPMD_OPT_OBJS): ../../Compress/PPMD/$(*B).cpp
$(COMPL_O2)
-$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
- $(COMPL)
-
$(AES_OPT_OBJS): ../../Crypto/AES/$(*B).cpp
$(COMPL_O2)
$(AES_ORIG_OBJS): ../../Crypto/AES/$(*B).c
@@ -172,3 +211,9 @@ $(7ZAES_OPT_OBJS): ../../Crypto/7zAES/$(*B).cpp
$(COMPL_O2)
$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp
$(COMPL_O2)
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
+$(C_BRANCH_OBJS): ../../../../C/Compress/Branch/$(*B).c
+ $(COMPL_O2)
+
+!include "../../Crc.mak"
diff --git a/CPP/7zip/Bundles/Format7zExtractR/makefile b/CPP/7zip/Bundles/Format7zExtractR/makefile
index b8bfde85..17a836dc 100755
--- a/CPP/7zip/Bundles/Format7zExtractR/makefile
+++ b/CPP/7zip/Bundles/Format7zExtractR/makefile
@@ -1,20 +1,12 @@
PROG = 7zxr.dll
-DEF_FILE = ../../Archive/Archive.def
+DEF_FILE = ../../Archive/Archive2.def
LIBS = $(LIBS) user32.lib oleaut32.lib
CFLAGS = $(CFLAGS) -I ../../../ \
- -DEXCLUDE_COM \
- -DNO_REGISTRY \
-DEXTRACT_ONLY \
- -DFORMAT_7Z \
-DCOMPRESS_MT \
- -DCOMPRESS_BCJ_X86 \
- -DCOMPRESS_BCJ2 \
- -DCOMPRESS_COPY \
- -DCOMPRESS_LZMA \
-D_NO_CRYPTO
COMMON_OBJS = \
- $O\Alloc.obj \
$O\CRC.obj \
$O\IntToString.obj \
$O\NewHandler.obj \
@@ -32,28 +24,33 @@ WIN_OBJS = \
$O\Synchronization.obj
7ZIP_COMMON_OBJS = \
+ $O\CreateCoder.obj \
$O\InBuffer.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 \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
+AR_OBJS = \
+ $O\ArchiveExports.obj \
+ $O\DllExports2.obj \
+
AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\CoderMixer2MT.obj \
$O\CrossThreadProgress.obj \
- $O\FilterCoder.obj \
$O\ItemNameUtils.obj \
$O\OutStreamWithCRC.obj \
$O\ParseProperties.obj \
7Z_OBJS = \
- $O\DllExports.obj \
$O\7zCompressionMode.obj \
$O\7zDecode.obj \
$O\7zExtract.obj \
@@ -61,21 +58,52 @@ AR_COMMON_OBJS = \
$O\7zHandler.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
- $O\7zMethodID.obj \
$O\7zProperties.obj \
+ $O\7zRegister.obj \
+
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
+
+SWAP_OPT_OBJS = \
+ $O\ByteSwap.obj \
+ $O\ByteSwapRegister.obj \
BRANCH_OPT_OBJS = \
$O\BranchCoder.obj \
$O\x86.obj \
$O\x86_2.obj \
+ $O\ARM.obj \
+ $O\ARMThumb.obj \
+ $O\IA64.obj \
+ $O\PPC.obj \
+ $O\SPARC.obj \
+ $O\BranchRegister.obj \
+ $O\BCJRegister.obj \
+ $O\BCJ2Register.obj \
+
+COPY_OBJS = \
+ $O\CopyCoder.obj \
+ $O\CopyRegister.obj \
LZ_OBJS = \
$O\LZOutWindow.obj \
LZMA_OPT_OBJS = \
$O\LZMADecoder.obj \
+ $O\LZMARegister.obj \
+
+C_OBJS = \
+ $O\Alloc.obj \
+ $O\7zCrc.obj
+C_BRANCH_OBJS = \
+ $O\BranchARM.obj \
+ $O\BranchARMThumb.obj \
+ $O\BranchIA64.obj \
+ $O\BranchPPC.obj \
+ $O\BranchSPARC.obj \
+ $O\BranchX86.obj \
OBJS = \
$O\StdAfx.obj \
@@ -83,12 +111,17 @@ OBJS = \
$(COMMON_OBJS) \
$(WIN_OBJS) \
$(7ZIP_COMMON_OBJS) \
+ $(AR_OBJS) \
$(AR_COMMON_OBJS) \
$(7Z_OBJS) \
+ $(COMPRESS_OBJS) \
$(BRANCH_OPT_OBJS) \
+ $(SWAP_OPT_OBJS) \
+ $(COPY_OBJS) \
$(LZ_OBJS) \
$(LZMA_OPT_OBJS) \
- $O\CopyCoder.obj \
+ $(C_OBJS) \
+ $(C_BRANCH_OBJS) \
$O\resource.res
@@ -100,18 +133,28 @@ $(WIN_OBJS): ../../../Windows/$(*B).cpp
$(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
+$(AR_OBJS): ../../Archive/$(*B).cpp
+ $(COMPL)
$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp
$(COMPL)
$(7Z_OBJS): ../../Archive/7z/$(*B).cpp
$(COMPL)
+$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
+ $(COMPL)
$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp
$(COMPL_O2)
+$(SWAP_OPT_OBJS): ../../Compress/ByteSwap/$(*B).cpp
+ $(COMPL_O2)
+$(COPY_OBJS): ../../Compress/Copy/$(*B).cpp
+ $(COMPL)
$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp
$(COMPL)
$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp
$(COMPL_O2)
-$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
- $(COMPL)
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
+$(C_BRANCH_OBJS): ../../../../C/Compress/Branch/$(*B).c
+ $(COMPL_O2)
diff --git a/CPP/7zip/Bundles/Format7zF/Format7z.dsp b/CPP/7zip/Bundles/Format7zF/Format7z.dsp
new file mode 100755
index 00000000..164fc24b
--- /dev/null
+++ b/CPP/7zip/Bundles/Format7zF/Format7z.dsp
@@ -0,0 +1,2350 @@
+# Microsoft Developer Studio Project File - Name="7z" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=7z - 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 "Format7z.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 "Format7z.mak" CFG="7z - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "7z - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "7z - 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)" == "7z - 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 "MY7Z_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "NO_REGISTRY" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /D "EXTERNAL_CODECS" /D "_7ZIP_LARGE_PAGES" /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\7z.dll" /opt:NOWIN98
+# SUBTRACT LINK32 /pdb:none /debug
+
+!ELSEIF "$(CFG)" == "7z - 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 "MY7Z_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\SDK" /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "NO_REGISTRY" /D "COMPRESS_MF_MT" /D "COMPRESS_MT" /D "COMPRESS_BZIP2_MT" /D "EXTERNAL_CODECS" /D "_7ZIP_LARGE_PAGES" /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\7z.dll" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "7z - Win32 Release"
+# Name "7z - Win32 Debug"
+# Begin Group "Spec"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7z.ico
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Archive2.def
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\ArchiveExports.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\CodecExports.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\DllExports2.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\CRC.cpp
+# 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\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\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
+# Begin Source File
+
+SOURCE=..\..\..\Common\Wildcard.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\Common\Wildcard.h
+# End Source File
+# End Group
+# Begin Group "Windows"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\Windows\FileDir.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\Windows\FileDir.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\FileIO.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\Windows\FileIO.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
+# 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 "PPMD"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\PPMD\PPMDContext.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\PPMD\PPMDDecode.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\PPMD\PPMDDecoder.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\PPMD\PPMDDecoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\PPMD\PPMDEncode.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\PPMD\PPMDEncoder.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\PPMD\PPMDEncoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\PPMD\PPMDRegister.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\PPMD\PPMDSubAlloc.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\PPMD\PPMDType.h
+# End Source File
+# End Group
+# Begin Group "Branch"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\ARM.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\ARM.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\ARMThumb.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\ARMThumb.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\BCJ2Register.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\BCJRegister.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\BranchCoder.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\BranchCoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\BranchRegister.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\IA64.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\IA64.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\PPC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\PPC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\SPARC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\SPARC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\x86.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\x86.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\x86_2.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\x86_2.h
+# End Source File
+# End Group
+# Begin Group "LZMA"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA\LZMA.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA\LZMADecoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA\LZMAEncoder.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA\LZMAEncoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA\LZMARegister.cpp
+# 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
+# Begin Source File
+
+SOURCE=..\..\Compress\Copy\CopyRegister.cpp
+# End Source File
+# End Group
+# Begin Group "RangeCoder"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\RangeCoder\RangeCoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\RangeCoder\RangeCoderBit.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\RangeCoder\RangeCoderBitTree.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\RangeCoder\RangeCoderOpt.h
+# End Source File
+# End Group
+# Begin Group "Deflate"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\Deflate\Deflate64Register.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Deflate\DeflateConst.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Deflate\DeflateDecoder.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Deflate\DeflateDecoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Deflate\DeflateEncoder.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Deflate\DeflateEncoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Deflate\DeflateNsisRegister.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Deflate\DeflateRegister.cpp
+# End Source File
+# End Group
+# Begin Group "BZip2"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\BZip2\BZip2Const.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\BZip2\BZip2CRC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\BZip2\BZip2CRC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\BZip2\BZip2Decoder.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\BZip2\BZip2Decoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\BZip2\BZip2Encoder.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\BZip2\BZip2Encoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\BZip2\BZip2Register.cpp
+# End Source File
+# End Group
+# Begin Group "Rar Codecs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\Rar\Rar1Decoder.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Rar\Rar1Decoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Rar\Rar2Decoder.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Rar\Rar2Decoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Rar\Rar3Decoder.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Rar\Rar3Decoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Rar\Rar3Vm.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Rar\Rar3Vm.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Rar\RarCodecsRegister.cpp
+# End Source File
+# End Group
+# Begin Group "BWT"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\BWT\BlockSort.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\BWT\BlockSort.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\BWT\Mtf8.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 "Lzx"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\Lzx\Lzx.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Lzx\Lzx86Converter.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Lzx\Lzx86Converter.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Lzx\LzxDecoder.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Lzx\LzxDecoder.h
+# End Source File
+# End Group
+# Begin Group "Z Codec"
+
+# 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 "Arj 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 "ByteSwap"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\ByteSwap\ByteSwap.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\ByteSwap\ByteSwap.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\ByteSwap\ByteSwapRegister.cpp
+# End Source File
+# End Group
+# 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 "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 "Lzh Codecs"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\Lzh\Lzh1Decoder.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Lzh\Lzh1Decoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Lzh\LzhDecoder.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Lzh\LzhDecoder.h
+# End Source File
+# End Group
+# End Group
+# Begin Group "Crypto"
+
+# PROP Default_Filter ""
+# Begin Group "AES"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Crypto\AES\aes.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\AES\AES_CBC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\AES\aescpp.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\AES\aescrypt.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\AES\aeskey.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\AES\aesopt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\AES\aestab.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\AES\MyAES.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\AES\MyAES.h
+# End Source File
+# End Group
+# Begin Group "7zAES"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Crypto\7zAES\7zAES.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\7zAES\7zAES.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\7zAES\7zAESRegister.cpp
+# End Source File
+# End Group
+# Begin Group "Hash"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Crypto\Hash\HmacSha1.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - 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)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - 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
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\Hash\RandGen.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\Hash\Sha1.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\Hash\Sha1.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\Hash\Sha256.cpp
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\Hash\Sha256.h
+# End Source File
+# End Group
+# Begin Group "RarAES"
+
+# 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 "RarCrypto"
+
+# 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 "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 "ZipCrypto"
+
+# PROP Default_Filter ""
+# 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
+# End Group
+# Begin Group "7zip Common"
+
+# 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\InBuffer.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\InBuffer.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\InOutTempBuffer.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\InOutTempBuffer.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\LockedStream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\LockedStream.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\LSBFEncoder.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\LSBFEncoder.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\MethodId.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\MethodId.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\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
+
+SOURCE=..\..\Common\StreamBinder.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 "C"
+
+# PROP Default_Filter ""
+# Begin Group "Compress C"
+
+# PROP Default_Filter ""
+# Begin Group "C-Lz"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\LzHash.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinder.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.h
+# End Source File
+# End Group
+# Begin Group "Huffman"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Huffman\HuffmanEncode.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Huffman\HuffmanEncode.h
+# End Source File
+# End Group
+# Begin Group "C Branch"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARM.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARM.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARMThumb.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARMThumb.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchIA64.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchIA64.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchPPC.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchPPC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchSPARC.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchSPARC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchTypes.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.h
+# End Source File
+# End Group
+# End Group
+# Begin Source File
+
+SOURCE=..\..\..\..\C\7zCrc.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# 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
+# Begin Source File
+
+SOURCE=..\..\..\..\C\IStream.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Sort.c
+
+!IF "$(CFG)" == "7z - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7z - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Sort.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Types.h
+# End Source File
+# End Group
+# Begin Group "Archive"
+
+# PROP Default_Filter ""
+# Begin Group "7z"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zCompressionMode.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zCompressionMode.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zDecode.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zDecode.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zEncode.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zEncode.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zExtract.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zFolderInStream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zFolderInStream.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zFolderOutStream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zFolderOutStream.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zHandlerOut.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zHeader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zItem.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zOut.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zOut.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zProperties.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zProperties.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zRegister.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zSpecStream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zSpecStream.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zUpdate.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zUpdate.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\7z\7zUpdateItem.h
+# End Source File
+# End Group
+# Begin Group "Rar"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Rar\RarHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Rar\RarHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Rar\RarHeader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Rar\RarHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Rar\RarIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Rar\RarIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Rar\RarItem.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Rar\RarItem.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Rar\RarRegister.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Rar\RarVolumeInStream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Rar\RarVolumeInStream.h
+# End Source File
+# End Group
+# Begin Group "Arj"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Arj\ArjHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Arj\ArjHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Arj\ArjHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Arj\ArjIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Arj\ArjIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Arj\ArjItem.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Arj\ArjRegister.cpp
+# End Source File
+# End Group
+# Begin Group "bz2"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\BZip2\bz2Register.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\BZip2\BZip2Handler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\BZip2\BZip2Handler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\BZip2\BZip2HandlerOut.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\BZip2\BZip2Item.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\BZip2\BZip2Update.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\BZip2\BZip2Update.h
+# End Source File
+# End Group
+# Begin Group "Cab"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Cab\CabBlockInStream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cab\CabBlockInStream.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cab\CabHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cab\CabHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cab\CabHeader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cab\CabHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cab\CabIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cab\CabIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cab\CabItem.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cab\CabRegister.cpp
+# End Source File
+# End Group
+# Begin Group "Chm"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Chm\ChmHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Chm\ChmHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Chm\ChmHeader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Chm\ChmHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Chm\ChmIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Chm\ChmIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Chm\ChmRegister.cpp
+# End Source File
+# End Group
+# Begin Group "Archive common"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\CoderMixer2.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\CoderMixer2.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\CoderMixer2MT.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\CoderMixer2MT.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\CrossThreadProgress.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\CrossThreadProgress.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\DummyOutStream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\DummyOutStream.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\InStreamWithCRC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\InStreamWithCRC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\ItemNameUtils.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\ItemNameUtils.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\MultiStream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\MultiStream.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\OutStreamWithCRC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\ParseProperties.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\ParseProperties.h
+# End Source File
+# End Group
+# Begin Group "Cpio"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Cpio\CpioHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cpio\CpioHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cpio\CpioHeader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cpio\CpioHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cpio\CpioIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cpio\CpioIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cpio\CpioItem.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Cpio\CpioRegister.cpp
+# End Source File
+# End Group
+# Begin Group "Deb"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Deb\DebHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Deb\DebHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Deb\DebHeader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Deb\DebHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Deb\DebIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Deb\DebIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Deb\DebItem.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Deb\DebRegister.cpp
+# End Source File
+# End Group
+# Begin Group "GZip"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipHandlerOut.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipHeader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipItem.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipOut.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipOut.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipRegister.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipUpdate.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\GZip\GZipUpdate.h
+# End Source File
+# End Group
+# Begin Group "Iso"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Iso\IsoHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Iso\IsoHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Iso\IsoHeader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Iso\IsoHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Iso\IsoIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Iso\IsoIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Iso\IsoItem.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Iso\IsoRegister.cpp
+# End Source File
+# End Group
+# Begin Group "Lzh"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Lzh\LzhCRC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Lzh\LzhCRC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Lzh\LzhHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Lzh\LzhHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Lzh\LzhHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Lzh\LzhIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Lzh\LzhIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Lzh\LzhItem.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Lzh\LzhOutStreamWithCRC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Lzh\LzhOutStreamWithCRC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Lzh\LzhRegister.cpp
+# End Source File
+# End Group
+# Begin Group "Nsis"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Nsis\NsisDecode.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Nsis\NsisDecode.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Nsis\NsisHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Nsis\NsisHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Nsis\NsisIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Nsis\NsisIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Nsis\NsisRegister.cpp
+# End Source File
+# End Group
+# Begin Group "RPM"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\RPM\RpmHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\RPM\RpmHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\RPM\RpmHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\RPM\RpmIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\RPM\RpmIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\RPM\RpmRegister.cpp
+# End Source File
+# End Group
+# Begin Group "Split"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Split\SplitHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Split\SplitHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Split\SplitHandlerOut.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Split\SplitRegister.cpp
+# End Source File
+# End Group
+# Begin Group "Tar"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarHandlerOut.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarHeader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarItem.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarOut.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarOut.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarRegister.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarUpdate.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Tar\TarUpdate.h
+# End Source File
+# End Group
+# Begin Group "Z"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Z\ZHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Z\ZHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Z\ZRegister.cpp
+# End Source File
+# End Group
+# Begin Group "Zip"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipAddCommon.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipAddCommon.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipCompressionMode.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipHandler.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipHandler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipHandlerOut.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipHeader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipIn.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipIn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipItem.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipItem.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipItemEx.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipOut.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipOut.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipRegister.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipUpdate.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Zip\ZipUpdate.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=..\..\Archive\IArchive.h
+# End Source File
+# End Group
+# Begin Group "7zip"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\ICoder.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\IPassword.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\IProgress.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/CPP/7zip/Bundles/Format7z/Format7z.dsw b/CPP/7zip/Bundles/Format7zF/Format7z.dsw
index 324dab1f..324dab1f 100755
--- a/CPP/7zip/Bundles/Format7z/Format7z.dsw
+++ b/CPP/7zip/Bundles/Format7zF/Format7z.dsw
diff --git a/CPP/7zip/Compress/BZip2Original/StdAfx.cpp b/CPP/7zip/Bundles/Format7zF/StdAfx.cpp
index d0feea85..d0feea85 100755
--- a/CPP/7zip/Compress/BZip2Original/StdAfx.cpp
+++ b/CPP/7zip/Bundles/Format7zF/StdAfx.cpp
diff --git a/CPP/7zip/Bundles/Format7zF/StdAfx.h b/CPP/7zip/Bundles/Format7zF/StdAfx.h
new file mode 100755
index 00000000..2e4be10b
--- /dev/null
+++ b/CPP/7zip/Bundles/Format7zF/StdAfx.h
@@ -0,0 +1,9 @@
+// StdAfx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#include "../../../Common/MyWindows.h"
+#include "../../../Common/NewHandler.h"
+
+#endif
diff --git a/CPP/7zip/Bundles/Format7zF/makefile b/CPP/7zip/Bundles/Format7zF/makefile
new file mode 100755
index 00000000..52554f24
--- /dev/null
+++ b/CPP/7zip/Bundles/Format7zF/makefile
@@ -0,0 +1,498 @@
+PROG = 7z.dll
+DEF_FILE = ../../Archive/Archive2.def
+LIBS = $(LIBS) user32.lib oleaut32.lib
+CFLAGS = $(CFLAGS) -I ../../../ \
+ -DEXTERNAL_CODECS \
+ -DCOMPRESS_MT \
+ -DCOMPRESS_BZIP2_MT \
+ -DCOMPRESS_MF_MT \
+ -D_7ZIP_LARGE_PAGES \
+
+COMMON_OBJS = \
+ $O\CRC.obj \
+ $O\IntToString.obj \
+ $O\NewHandler.obj \
+ $O\String.obj \
+ $O\StringConvert.obj \
+ $O\StringToInt.obj \
+ $O\Vector.obj \
+ $O\UTFConvert.obj \
+ $O\Wildcard.obj \
+
+WIN_OBJS = \
+ $O\FileDir.obj \
+ $O\FileFind.obj \
+ $O\FileIO.obj \
+ $O\PropVariant.obj \
+ $O\Synchronization.obj
+
+7ZIP_COMMON_OBJS = \
+ $O\InBuffer.obj \
+ $O\InOutTempBuffer.obj \
+ $O\CreateCoder.obj \
+ $O\FilterCoder.obj \
+ $O\LimitedStreams.obj \
+ $O\LockedStream.obj \
+ $O\LSBFDecoder.obj \
+ $O\LSBFEncoder.obj \
+ $O\MethodId.obj \
+ $O\MemBlocks.obj \
+ $O\OffsetStream.obj \
+ $O\OutBuffer.obj \
+ $O\OutMemStream.obj \
+ $O\ProgressMt.obj \
+ $O\ProgressUtils.obj \
+ $O\StreamBinder.obj \
+ $O\StreamObjects.obj \
+ $O\StreamUtils.obj \
+
+AR_OBJS = \
+ $O\ArchiveExports.obj \
+ $O\DllExports2.obj \
+
+AR_COMMON_OBJS = \
+ $O\CoderMixer2.obj \
+ $O\CoderMixer2MT.obj \
+ $O\CrossThreadProgress.obj \
+ $O\DummyOutStream.obj \
+ $O\InStreamWithCRC.obj \
+ $O\ItemNameUtils.obj \
+ $O\MultiStream.obj \
+ $O\OutStreamWithCRC.obj \
+ $O\ParseProperties.obj \
+
+
+7Z_OBJS = \
+ $O\7zCompressionMode.obj \
+ $O\7zDecode.obj \
+ $O\7zEncode.obj \
+ $O\7zExtract.obj \
+ $O\7zFolderInStream.obj \
+ $O\7zFolderOutStream.obj \
+ $O\7zHandler.obj \
+ $O\7zHandlerOut.obj \
+ $O\7zHeader.obj \
+ $O\7zIn.obj \
+ $O\7zOut.obj \
+ $O\7zProperties.obj \
+ $O\7zSpecStream.obj \
+ $O\7zUpdate.obj \
+ $O\7zRegister.obj \
+
+ARJ_OBJS = \
+ $O\ArjHandler.obj \
+ $O\ArjIn.obj \
+ $O\ArjRegister.obj \
+
+BZ2_OBJS = \
+ $O\BZip2Handler.obj \
+ $O\BZip2HandlerOut.obj \
+ $O\BZip2Update.obj \
+ $O\bz2Register.obj \
+
+CAB_OBJS = \
+ $O\CabBlockInStream.obj \
+ $O\CabHandler.obj \
+ $O\CabHeader.obj \
+ $O\CabIn.obj \
+ $O\CabRegister.obj \
+
+CHM_OBJS = \
+ $O\ChmHandler.obj \
+ $O\ChmHeader.obj \
+ $O\ChmIn.obj \
+ $O\ChmRegister.obj \
+
+CPIO_OBJS = \
+ $O\CpioHandler.obj \
+ $O\CpioHeader.obj \
+ $O\CpioIn.obj \
+ $O\CpioRegister.obj \
+
+DEB_OBJS = \
+ $O\DebHandler.obj \
+ $O\DebHeader.obj \
+ $O\DebIn.obj \
+ $O\DebRegister.obj \
+
+GZ_OBJS = \
+ $O\GZipHandler.obj \
+ $O\GZipHandlerOut.obj \
+ $O\GZipHeader.obj \
+ $O\GZipIn.obj \
+ $O\GZipOut.obj \
+ $O\GZipUpdate.obj \
+ $O\GZipRegister.obj \
+
+ISO_OBJS = \
+ $O\IsoHandler.obj \
+ $O\IsoHeader.obj \
+ $O\IsoIn.obj \
+ $O\IsoRegister.obj \
+
+LZH_OBJS = \
+ $O\LzhCRC.obj \
+ $O\LzhHandler.obj \
+ $O\LzhIn.obj \
+ $O\LzhOutStreamWithCRC.obj \
+ $O\LzhRegister.obj \
+
+NSIS_OBJS = \
+ $O\NsisDecode.obj \
+ $O\NsisHandler.obj \
+ $O\NsisIn.obj \
+ $O\NsisRegister.obj \
+
+RAR_OBJS = \
+ $O\RarHandler.obj \
+ $O\RarHeader.obj \
+ $O\RarIn.obj \
+ $O\RarItem.obj \
+ $O\RarVolumeInStream.obj \
+ $O\RarRegister.obj \
+
+RPM_OBJS = \
+ $O\RpmHandler.obj \
+ $O\RpmIn.obj \
+ $O\RpmRegister.obj \
+
+SPLIT_OBJS = \
+ $O\SplitHandler.obj \
+ $O\SplitHandlerOut.obj \
+ $O\SplitRegister.obj \
+
+TAR_OBJS = \
+ $O\TarHandler.obj \
+ $O\TarHandlerOut.obj \
+ $O\TarHeader.obj \
+ $O\TarIn.obj \
+ $O\TarOut.obj \
+ $O\TarUpdate.obj \
+ $O\TarRegister.obj \
+
+Z_OBJS = \
+ $O\ZHandler.obj \
+ $O\ZRegister.obj \
+
+ZIP_OBJS = \
+ $O\ZipAddCommon.obj \
+ $O\ZipHandler.obj \
+ $O\ZipHandlerOut.obj \
+ $O\ZipHeader.obj \
+ $O\ZipIn.obj \
+ $O\ZipItem.obj \
+ $O\ZipOut.obj \
+ $O\ZipUpdate.obj \
+ $O\ZipRegister.obj \
+
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
+
+BRANCH_OPT_OBJS = \
+ $O\BranchCoder.obj \
+ $O\BranchRegister.obj \
+ $O\BCJRegister.obj \
+ $O\BCJ2Register.obj \
+ $O\x86.obj \
+ $O\x86_2.obj \
+ $O\ARM.obj \
+ $O\ARMThumb.obj \
+ $O\IA64.obj \
+ $O\PPC.obj \
+ $O\SPARC.obj \
+
+SWAP_OPT_OBJS = \
+ $O\ByteSwap.obj \
+ $O\ByteSwapRegister.obj \
+
+BZIP2_OBJS = \
+ $O\BZip2CRC.obj \
+ $O\BZip2Register.obj \
+
+BZIP2_OPT_OBJS = \
+ $O\BZip2Decoder.obj \
+ $O\BZip2Encoder.obj \
+
+COPY_OBJS = \
+ $O\CopyCoder.obj \
+ $O\CopyRegister.obj \
+
+DEFLATE_OPT_OBJS = \
+ $O\DeflateDecoder.obj \
+ $O\DeflateEncoder.obj \
+ $O\DeflateRegister.obj \
+ $O\Deflate64Register.obj \
+ $O\DeflateNsisRegister.obj \
+
+IMPLODE_OBJS = \
+ $O\ImplodeDecoder.obj \
+ $O\ImplodeHuffmanDecoder.obj \
+
+LZ_OBJS = \
+ $O\LZOutWindow.obj \
+
+LZMA_OPT_OBJS = \
+ $O\LZMADecoder.obj \
+ $O\LZMAEncoder.obj \
+ $O\LZMARegister.obj \
+
+LZX_OBJS = \
+ $O\LzxDecoder.obj \
+ $O\Lzx86Converter.obj \
+
+PPMD_OPT_OBJS = \
+ $O\PPMDDecoder.obj \
+ $O\PPMDEncoder.obj \
+ $O\PPMDRegister.obj \
+
+RAR29_OPT_OBJS = \
+ $O\Rar1Decoder.obj \
+ $O\Rar2Decoder.obj \
+ $O\Rar3Decoder.obj \
+ $O\Rar3Vm.obj \
+ $O\RarCodecsRegister.obj \
+
+SHRINK_OBJS = \
+ $O\ShrinkDecoder.obj \
+
+COMPRESS_ARJ_OBJS = \
+ $O\ArjDecoder1.obj \
+ $O\ArjDecoder2.obj \
+
+COMPRESS_LZH_OBJS = \
+ $O\LzhDecoder.obj \
+
+COMPRESS_Z_OBJS = \
+ $O\ZDecoder.obj \
+
+7ZAES_OPT_OBJS = \
+ $O\7zAES.obj \
+ $O\7zAESRegister.obj \
+
+AES_OPT_OBJS = \
+ $O\MyAES.obj \
+
+AES_ORIG_OBJS = \
+ $O\aescrypt.obj \
+ $O\aeskey.obj \
+ $O\aestab.obj \
+
+CRYPTO_HASH_OBJS = \
+ $O\HmacSha1.obj \
+ $O\Pbkdf2HmacSha1.obj \
+ $O\RandGen.obj \
+ $O\Sha1.obj \
+ $O\Sha256.obj \
+
+CRYPTO_WZAES_OBJS = \
+ $O\WzAES.obj \
+
+CRYPTO_ZIP_OBJS = \
+ $O\ZipCipher.obj \
+ $O\ZipCrypto.obj \
+
+CRYPTO_RAR20_OBJS = \
+ $O\Rar20Cipher.obj \
+ $O\Rar20Crypto.obj \
+
+CRYPTO_RARAES_OBJS = \
+ $O\RarAES.obj \
+
+
+C_OBJS = \
+ $O\Alloc.obj \
+ $O\Threads.obj \
+ $O\Sort.obj \
+
+C_LZ_OBJS = \
+ $O\MatchFinder.obj \
+ $O\MatchFinderMt.obj \
+
+C_BRANCH_OBJS = \
+ $O\BranchARM.obj \
+ $O\BranchARMThumb.obj \
+ $O\BranchIA64.obj \
+ $O\BranchPPC.obj \
+ $O\BranchSPARC.obj \
+ $O\BranchX86.obj \
+
+!include "../../Crc2.mak"
+
+OBJS = \
+ $O\StdAfx.obj \
+ $(CONSOLE_OBJS) \
+ $(COMMON_OBJS) \
+ $(WIN_OBJS) \
+ $(7ZIP_COMMON_OBJS) \
+ $(AR_OBJS) \
+ $(AR_COMMON_OBJS) \
+ $(7Z_OBJS) \
+ $(ARJ_OBJS) \
+ $(BZ2_OBJS) \
+ $(CAB_OBJS) \
+ $(CHM_OBJS) \
+ $(CPIO_OBJS) \
+ $(DEB_OBJS) \
+ $(GZ_OBJS) \
+ $(ISO_OBJS) \
+ $(LZH_OBJS) \
+ $(NSIS_OBJS) \
+ $(RAR_OBJS) \
+ $(RPM_OBJS) \
+ $(SPLIT_OBJS) \
+ $(TAR_OBJS) \
+ $(Z_OBJS) \
+ $(ZIP_OBJS) \
+ $(BZIP2_OBJS) \
+ $(BZIP2_OPT_OBJS) \
+ $(COMPRESS_OBJS) \
+ $(BRANCH_OPT_OBJS) \
+ $(SWAP_OPT_OBJS) \
+ $(COPY_OBJS) \
+ $(DEFLATE_OPT_OBJS) \
+ $(IMPLODE_OBJS) \
+ $(LZ_OBJS) \
+ $(LZMA_OPT_OBJS) \
+ $(LZX_OBJS) \
+ $(PPMD_OPT_OBJS) \
+ $(RAR29_OPT_OBJS) \
+ $(SHRINK_OBJS) \
+ $(COMPRESS_ARJ_OBJS) \
+ $(COMPRESS_LZH_OBJS) \
+ $(COMPRESS_Z_OBJS) \
+ $O\QuantumDecoder.obj \
+ $(C_OBJS) \
+ $(C_LZ_OBJS) \
+ $(C_BRANCH_OBJS) \
+ $O\HuffmanEncode.obj \
+ $O\BlockSort.obj \
+ $O\RangeCoderBit.obj \
+ $(7ZAES_OPT_OBJS) \
+ $(AES_OPT_OBJS) \
+ $(AES_ORIG_OBJS) \
+ $(CRYPTO_ZIP_OBJS) \
+ $(CRYPTO_WZAES_OBJS) \
+ $(CRYPTO_HASH_OBJS) \
+ $(CRYPTO_RAR20_OBJS) \
+ $(CRYPTO_RARAES_OBJS) \
+ $(CRC_OBJS) \
+ $O\resource.res
+
+
+!include "../../../Build.mak"
+
+$(COMMON_OBJS): ../../../Common/$(*B).cpp
+ $(COMPL)
+$(WIN_OBJS): ../../../Windows/$(*B).cpp
+ $(COMPL)
+$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
+ $(COMPL)
+$(AR_OBJS): ../../Archive/$(*B).cpp
+ $(COMPL)
+$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp
+ $(COMPL)
+
+$(7Z_OBJS): ../../Archive/7z/$(*B).cpp
+ $(COMPL)
+$(ARJ_OBJS): ../../Archive/Arj/$(*B).cpp
+ $(COMPL)
+$(BZ2_OBJS): ../../Archive/BZip2/$(*B).cpp
+ $(COMPL)
+$(CAB_OBJS): ../../Archive/Cab/$(*B).cpp
+ $(COMPL)
+$(CHM_OBJS): ../../Archive/Chm/$(*B).cpp
+ $(COMPL)
+$(CPIO_OBJS): ../../Archive/Cpio/$(*B).cpp
+ $(COMPL)
+$(DEB_OBJS): ../../Archive/Deb/$(*B).cpp
+ $(COMPL)
+$(GZ_OBJS): ../../Archive/GZip/$(*B).cpp
+ $(COMPL)
+$(ISO_OBJS): ../../Archive/Iso/$(*B).cpp
+ $(COMPL)
+$(LZH_OBJS): ../../Archive/Lzh/$(*B).cpp
+ $(COMPL)
+$(NSIS_OBJS): ../../Archive/Nsis/$(*B).cpp
+ $(COMPL)
+$(RAR_OBJS): ../../Archive/Rar/$(*B).cpp
+ $(COMPL)
+$(RPM_OBJS): ../../Archive/Rpm/$(*B).cpp
+ $(COMPL)
+$(SPLIT_OBJS): ../../Archive/Split/$(*B).cpp
+ $(COMPL)
+$(TAR_OBJS): ../../Archive/Tar/$(*B).cpp
+ $(COMPL)
+$(Z_OBJS): ../../Archive/Z/$(*B).cpp
+ $(COMPL)
+$(ZIP_OBJS): ../../Archive/Zip/$(*B).cpp
+ $(COMPL)
+
+$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
+ $(COMPL)
+$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp
+ $(COMPL_O2)
+$(SWAP_OPT_OBJS): ../../Compress/ByteSwap/$(*B).cpp
+ $(COMPL_O2)
+$(BZIP2_OBJS): ../../Compress/BZip2/$(*B).cpp
+ $(COMPL)
+$(BZIP2_OPT_OBJS): ../../Compress/BZip2/$(*B).cpp
+ $(COMPL_O2)
+$(COPY_OBJS): ../../Compress/Copy/$(*B).cpp
+ $(COMPL)
+$(DEFLATE_OPT_OBJS): ../../Compress/Deflate/$(*B).cpp
+ $(COMPL_O2)
+$(IMPLODE_OBJS): ../../Compress/Implode/$(*B).cpp
+ $(COMPL)
+$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp
+ $(COMPL)
+$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp
+ $(COMPL_O2)
+$(LZX_OBJS): ../../Compress/Lzx/$(*B).cpp
+ $(COMPL_O2)
+$(PPMD_OPT_OBJS): ../../Compress/PPMD/$(*B).cpp
+ $(COMPL_O2)
+$(RAR29_OPT_OBJS): ../../Compress/Rar/$(*B).cpp
+ $(COMPL_O2)
+$(SHRINK_OBJS): ../../Compress/Shrink/$(*B).cpp
+ $(COMPL)
+$(COMPRESS_ARJ_OBJS): ../../Compress/Arj/$(*B).cpp
+ $(COMPL)
+$(COMPRESS_LZH_OBJS): ../../Compress/Lzh/$(*B).cpp
+ $(COMPL)
+$(COMPRESS_Z_OBJS): ../../Compress/Z/$(*B).cpp
+ $(COMPL)
+$O\QuantumDecoder.obj: ../../Compress/Quantum/$(*B).cpp
+ $(COMPL)
+
+$O\BlockSort.obj: ../../Compress/BWT/$(*B).cpp
+ $(COMPL_O2)
+$O\RangeCoderBit.obj: ../../Compress/RangeCoder/$(*B).cpp
+ $(COMPL)
+
+$(AES_OPT_OBJS): ../../Crypto/AES/$(*B).cpp
+ $(COMPL_O2)
+$(AES_ORIG_OBJS): ../../Crypto/AES/$(*B).c
+ $(COMPL_O2_W3)
+$(7ZAES_OPT_OBJS): ../../Crypto/7zAES/$(*B).cpp
+ $(COMPL_O2)
+$(CRYPTO_ZIP_OBJS): ../../Crypto/Zip/$(*B).cpp
+ $(COMPL)
+$(CRYPTO_WZAES_OBJS): ../../Crypto/WzAES/$(*B).cpp
+ $(COMPL_O2)
+$(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)
+
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
+$(C_LZ_OBJS): ../../../../C/Compress/Lz/$(*B).c
+ $(COMPL_O2)
+$(C_BRANCH_OBJS): ../../../../C/Compress/Branch/$(*B).c
+ $(COMPL_O2)
+$O\HuffmanEncode.obj: ../../../../C/Compress/Huffman/$(*B).c
+ $(COMPL_O2)
+
+!include "../../Crc.mak"
diff --git a/CPP/7zip/Bundles/Format7zF/resource.rc b/CPP/7zip/Bundles/Format7zF/resource.rc
new file mode 100755
index 00000000..9bf56129
--- /dev/null
+++ b/CPP/7zip/Bundles/Format7zF/resource.rc
@@ -0,0 +1,26 @@
+#include "../../MyVersionInfo.rc"
+
+MY_VERSION_INFO_DLL("7z Standalone Plugin", "7za")
+
+
+0 ICON "../../Archive/7z/7z.ico"
+1 ICON "../../Archive/Zip/zip.ico"
+2 ICON "../../Archive/BZip2/bz2.ico"
+3 ICON "../../Archive/Rar/rar.ico"
+4 ICON "../../Archive/Arj/arj.ico"
+5 ICON "../../Archive/Z/z.ico"
+6 ICON "../../Archive/Lzh/lzh.ico"
+7 ICON "../../Archive/Cab/cab.ico"
+8 ICON "../../Archive/Iso/iso.ico"
+9 ICON "../../Archive/Split/split.ico"
+10 ICON "../../Archive/RPM/rpm.ico"
+11 ICON "../../Archive/Deb/deb.ico"
+12 ICON "../../Archive/Cpio/cpio.ico"
+13 ICON "../../Archive/Tar/tar.ico"
+14 ICON "../../Archive/GZip/gz.ico"
+
+
+STRINGTABLE
+BEGIN
+ 100 "7z:0 zip:1 bz2:2 bzip2:2 tbz2:2 tbz:2 rar:3 arj:4 z:5 taz:5 lzh:6 lha:6 cab:7 iso:8 split:9 rpm:10 deb:11 cpio:12 tar:13 gz:14 gzip:14 tgz:14 tpz:14"
+END
diff --git a/CPP/7zip/Bundles/Format7zR/makefile b/CPP/7zip/Bundles/Format7zR/makefile
index d3cc3d55..3175e7f2 100755
--- a/CPP/7zip/Bundles/Format7zR/makefile
+++ b/CPP/7zip/Bundles/Format7zR/makefile
@@ -1,20 +1,12 @@
PROG = 7zra.dll
-DEF_FILE = ../../Archive/Archive.def
+DEF_FILE = ../../Archive/Archive2.def
LIBS = $(LIBS) user32.lib oleaut32.lib
CFLAGS = $(CFLAGS) -I ../../../ \
- -DEXCLUDE_COM \
- -DNO_REGISTRY \
- -DFORMAT_7Z \
-DCOMPRESS_MT \
- -DCOMPRESS_BCJ_X86 \
- -DCOMPRESS_BCJ2 \
- -DCOMPRESS_COPY \
- -DCOMPRESS_LZMA \
-DCOMPRESS_MF_MT \
-D_NO_CRYPTO
COMMON_OBJS = \
- $O\Alloc.obj \
$O\CRC.obj \
$O\IntToString.obj \
$O\NewHandler.obj \
@@ -32,21 +24,27 @@ WIN_OBJS = \
$O\Synchronization.obj
7ZIP_COMMON_OBJS = \
+ $O\CreateCoder.obj \
$O\InBuffer.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 \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
+AR_OBJS = \
+ $O\ArchiveExports.obj \
+ $O\DllExports2.obj \
+
AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\CoderMixer2MT.obj \
$O\CrossThreadProgress.obj \
- $O\FilterCoder.obj \
$O\InStreamWithCRC.obj \
$O\ItemNameUtils.obj \
$O\OutStreamWithCRC.obj \
@@ -54,7 +52,6 @@ AR_COMMON_OBJS = \
7Z_OBJS = \
- $O\DllExports.obj \
$O\7zCompressionMode.obj \
$O\7zDecode.obj \
$O\7zEncode.obj \
@@ -65,17 +62,36 @@ AR_COMMON_OBJS = \
$O\7zHandlerOut.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
- $O\7zMethodID.obj \
$O\7zOut.obj \
$O\7zProperties.obj \
$O\7zSpecStream.obj \
$O\7zUpdate.obj \
+ $O\7zRegister.obj \
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
+
BRANCH_OPT_OBJS = \
$O\BranchCoder.obj \
$O\x86.obj \
$O\x86_2.obj \
+ $O\ARM.obj \
+ $O\ARMThumb.obj \
+ $O\IA64.obj \
+ $O\PPC.obj \
+ $O\SPARC.obj \
+ $O\BranchRegister.obj \
+ $O\BCJRegister.obj \
+ $O\BCJ2Register.obj \
+
+SWAP_OPT_OBJS = \
+ $O\ByteSwap.obj \
+ $O\ByteSwapRegister.obj \
+
+COPY_OBJS = \
+ $O\CopyCoder.obj \
+ $O\CopyRegister.obj \
LZ_OBJS = \
$O\LZOutWindow.obj \
@@ -83,8 +99,10 @@ LZ_OBJS = \
LZMA_OPT_OBJS = \
$O\LZMADecoder.obj \
$O\LZMAEncoder.obj \
+ $O\LZMARegister.obj \
C_OBJS = \
+ $O\Alloc.obj \
$O\7zCrc.obj \
$O\Sort.obj \
$O\Threads.obj \
@@ -93,24 +111,36 @@ C_LZ_OBJS = \
$O\MatchFinder.obj \
$O\MatchFinderMt.obj \
+C_BRANCH_OBJS = \
+ $O\BranchARM.obj \
+ $O\BranchARMThumb.obj \
+ $O\BranchIA64.obj \
+ $O\BranchPPC.obj \
+ $O\BranchSPARC.obj \
+ $O\BranchX86.obj \
+
OBJS = \
$O\StdAfx.obj \
$(CONSOLE_OBJS) \
$(COMMON_OBJS) \
$(WIN_OBJS) \
$(7ZIP_COMMON_OBJS) \
+ $(AR_OBJS) \
$(AR_COMMON_OBJS) \
$(7Z_OBJS) \
$(BZIP2_OBJS) \
$(BZIP2_OPT_OBJS) \
+ $(COMPRESS_OBJS) \
$(BRANCH_OPT_OBJS) \
+ $(SWAP_OPT_OBJS) \
+ $(COPY_OBJS) \
$(DEFLATE_OPT_OBJS) \
$(LZ_OBJS) \
$(LZMA_OPT_OBJS) \
$(PPMD_OPT_OBJS) \
$(C_OBJS) \
$(C_LZ_OBJS) \
- $O\CopyCoder.obj \
+ $(C_BRANCH_OBJS) \
$O\RangeCoderBit.obj \
$(7ZAES_OPT_OBJS) \
$(AES_OPT_OBJS) \
@@ -127,20 +157,26 @@ $(WIN_OBJS): ../../../Windows/$(*B).cpp
$(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
+$(AR_OBJS): ../../Archive/$(*B).cpp
+ $(COMPL)
$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp
$(COMPL)
$(7Z_OBJS): ../../Archive/7z/$(*B).cpp
$(COMPL)
+$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
+ $(COMPL)
$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp
$(COMPL_O2)
+$(SWAP_OPT_OBJS): ../../Compress/ByteSwap/$(*B).cpp
+ $(COMPL_O2)
+$(COPY_OBJS): ../../Compress/Copy/$(*B).cpp
+ $(COMPL)
$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp
$(COMPL)
$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp
$(COMPL_O2)
-$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
- $(COMPL)
$O\RangeCoderBit.obj: ../../Compress/RangeCoder/$(*B).cpp
$(COMPL)
@@ -148,3 +184,5 @@ $(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
$(C_LZ_OBJS): ../../../../C/Compress/Lz/$(*B).c
$(COMPL_O2)
+$(C_BRANCH_OBJS): ../../../../C/Compress/Branch/$(*B).c
+ $(COMPL_O2)
diff --git a/CPP/7zip/Bundles/SFXCon/Main.cpp b/CPP/7zip/Bundles/SFXCon/Main.cpp
index 65ed8931..97efd2b8 100755
--- a/CPP/7zip/Bundles/SFXCon/Main.cpp
+++ b/CPP/7zip/Bundles/SFXCon/Main.cpp
@@ -66,7 +66,7 @@ enum EEnum
kNonRecursed,
};
}
-
+/*
static const char kRecursedIDChar = 'R';
static const wchar_t *kRecursedPostCharSet = L"0-";
@@ -83,7 +83,7 @@ static const char kImmediateNameID = '!';
static const char kSomeCludePostStringMinSize = 2; // at least <@|!><N>ame must be
static const char kSomeCludeAfterRecursedPostStringMinSize = 2; // at least <@|!><N>ame must be
-
+*/
static const CSwitchForm kSwitchForms[kNumSwitches] =
{
{ L"?", NSwitchType::kSimple, false },
@@ -120,12 +120,12 @@ static const NRecursedType::EEnum kCommandRecursedDefault[kNumCommandForms] =
NRecursedType::kRecursed
};
-static const bool kTestExtractRecursedDefault = true;
-static const bool kAddRecursedDefault = false;
+// static const bool kTestExtractRecursedDefault = true;
+// static const bool kAddRecursedDefault = false;
static const int kMaxCmdLineSize = 1000;
static const wchar_t *kUniversalWildcard = L"*";
-static const int kMinNonSwitchWords = 1;
+// static const int kMinNonSwitchWords = 1;
static const int kCommandIndex = 0;
static const char *kHelpString =
@@ -146,13 +146,13 @@ static const char *kHelpString =
// exception messages
static const char *kUserErrorMessage = "Incorrect command line"; // NExitCode::kUserError
-static const char *kIncorrectListFile = "Incorrect wildcard in listfile";
+// static const char *kIncorrectListFile = "Incorrect wildcard in listfile";
static const char *kIncorrectWildCardInCommandLine = "Incorrect wildcard in command line";
// static const CSysString kFileIsNotArchiveMessageBefore = "File \"";
// static const CSysString kFileIsNotArchiveMessageAfter = "\" is not archive";
-static const char *kProcessArchiveMessage = " archive: ";
+// static const char *kProcessArchiveMessage = " archive: ";
static const char *kCantFindSFX = " cannot find sfx";
@@ -353,6 +353,19 @@ int Main2(
v2.Add(archiveName);
const NWildcard::CCensorNode &wildcardCensorHead =
wildcardCensor.Pairs.Front().Head;
+
+ CCodecs *codecs = new CCodecs;
+ CMyComPtr<
+ #ifdef EXTERNAL_CODECS
+ ICompressCodecsInfo
+ #else
+ IUnknown
+ #endif
+ > compressCodecsInfo = codecs;
+ HRESULT result = codecs->Load();
+ if (result != S_OK)
+ throw CSystemException(result);
+
if(command.CommandType != NCommandType::kList)
{
CExtractCallbackConsole *ecs = new CExtractCallbackConsole;
@@ -379,6 +392,7 @@ int Main2(
UString errorMessage;
HRESULT result = DecompressArchives(
+ codecs,
v1, v2,
wildcardCensorHead,
eo, &openCallback, ecs, errorMessage);
@@ -403,6 +417,7 @@ int Main2(
else
{
HRESULT result = ListArchives(
+ codecs,
v1, v2,
wildcardCensorHead,
true, false,
diff --git a/CPP/7zip/Bundles/SFXCon/SFXCon.dsp b/CPP/7zip/Bundles/SFXCon/SFXCon.dsp
index 5b61dae3..17ffd0df 100755
--- a/CPP/7zip/Bundles/SFXCon/SFXCon.dsp
+++ b/CPP/7zip/Bundles/SFXCon/SFXCon.dsp
@@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "COMPRESS_BCJ2" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "COMPRESS_BCJ2" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "EXTRACT_ONLY" /D "_SFX" /D "NO_READ_FROM_CODER" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -67,7 +67,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "..\..\..\..\\" /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "..\..\..\..\\" /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "EXTRACT_ONLY" /D "_SFX" /D "NO_READ_FROM_CODER" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -141,14 +141,6 @@ SOURCE=..\..\Archive\Common\CrossThreadProgress.h
# End Source File
# Begin Source File
-SOURCE=..\..\Archive\Common\FilterCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\FilterCoder.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\Archive\Common\ItemNameUtils.cpp
# End Source File
# Begin Source File
@@ -265,11 +257,7 @@ SOURCE=..\..\Archive\7z\7zItem.h
# End Source File
# Begin Source File
-SOURCE=..\..\Archive\7z\7zMethodID.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zMethodID.h
+SOURCE=..\..\Archive\7z\7zRegister.cpp
# End Source File
# End Group
# Begin Group "Compress"
@@ -282,12 +270,24 @@ SOURCE=..\..\Archive\7z\7zMethodID.h
SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA\LZMARegister.cpp
+# End Source File
# End Group
# Begin Group "Branch"
# PROP Default_Filter ""
# Begin Source File
+SOURCE=..\..\Compress\Branch\BCJ2Register.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\BCJRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Compress\Branch\BranchCoder.cpp
# End Source File
# Begin Source File
@@ -310,6 +310,10 @@ SOURCE=..\..\Compress\Branch\x86_2.cpp
SOURCE=..\..\Compress\PPMD\PPMDDecoder.cpp
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\PPMD\PPMDRegister.cpp
+# End Source File
# End Group
# Begin Group "LZ"
@@ -334,6 +338,10 @@ SOURCE=..\..\Compress\Copy\CopyCoder.cpp
SOURCE=..\..\Compress\Copy\CopyCoder.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Copy\CopyRegister.cpp
+# End Source File
# End Group
# End Group
# Begin Group "Crypto"
@@ -350,6 +358,10 @@ SOURCE=..\..\Crypto\7zAES\7zAES.cpp
SOURCE=..\..\Crypto\7zAES\7zAES.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Crypto\7zAES\7zAESRegister.cpp
+# End Source File
# End Group
# Begin Group "AES"
@@ -411,10 +423,6 @@ SOURCE=..\..\Crypto\Hash\Sha256.h
# End Source File
# End Group
# End Group
-# Begin Group "SDK"
-
-# PROP Default_Filter ""
-# End Group
# Begin Group "Windows"
# PROP Default_Filter ""
@@ -488,14 +496,6 @@ SOURCE=..\..\..\Windows\Synchronization.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\CommandLineParser.cpp
# End Source File
# Begin Source File
@@ -580,6 +580,14 @@ SOURCE=..\..\..\Common\Wildcard.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\FilePathAutoRename.cpp
# End Source File
# Begin Source File
@@ -596,6 +604,14 @@ SOURCE=..\..\Common\FileStreams.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\InBuffer.cpp
# End Source File
# Begin Source File
@@ -691,14 +707,6 @@ SOURCE=..\..\UI\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
-SOURCE=..\..\UI\Common\ArchiverInfo.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\ArchiverInfo.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\UI\Common\DefaultName.cpp
# End Source File
# Begin Source File
@@ -731,6 +739,14 @@ SOURCE=..\..\UI\Common\ExtractMode.h
# End Source File
# Begin Source File
+SOURCE=..\..\UI\Common\LoadCodecs.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\UI\Common\LoadCodecs.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\UI\Common\OpenArchive.cpp
# End Source File
# Begin Source File
@@ -747,6 +763,45 @@ SOURCE=..\..\UI\Common\PropIDUtils.h
# End Source File
# End Group
# End Group
+# Begin Group "C"
+
+# PROP Default_Filter ""
+# Begin Group "C Branch"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchTypes.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.h
+# End Source File
+# End Group
+# 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/Bundles/SFXCon/makefile b/CPP/7zip/Bundles/SFXCon/makefile
index 7501a497..61edd86b 100755
--- a/CPP/7zip/Bundles/SFXCon/makefile
+++ b/CPP/7zip/Bundles/SFXCon/makefile
@@ -1,18 +1,9 @@
PROG = 7zCon.sfx
LIBS = $(LIBS) user32.lib oleaut32.lib
CFLAGS = $(CFLAGS) -I ../../../ \
- -DEXCLUDE_COM \
- -DNO_REGISTRY \
-DEXTRACT_ONLY \
+ -DNO_READ_FROM_CODER \
-D_SFX \
- -DFORMAT_7Z \
- -DCOMPRESS_BCJ_X86 \
- -DCOMPRESS_BCJ2 \
- -DCOMPRESS_COPY \
- -DCOMPRESS_LZMA \
- -DCOMPRESS_PPMD \
- -DCRYPTO_7ZAES \
- -DCRYPTO_AES \
SFX_CONSOLE_OBJS = \
$O\Main.obj \
@@ -26,7 +17,6 @@ CONSOLE_OBJS = \
$O\UserInputUtils.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\IntToString.obj \
@@ -49,9 +39,11 @@ WIN_OBJS = \
$O\Synchronization.obj
7ZIP_COMMON_OBJS = \
+ $O\CreateCoder.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\InBuffer.obj \
+ $O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\LockedStream.obj \
$O\OutBuffer.obj \
@@ -63,8 +55,8 @@ WIN_OBJS = \
UI_COMMON_OBJS = \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
- $O\ArchiverInfo.obj \
$O\DefaultName.obj \
+ $O\LoadCodecs.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
$O\OpenArchive.obj \
@@ -74,7 +66,6 @@ AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\CoderMixer2MT.obj \
$O\CrossThreadProgress.obj \
- $O\FilterCoder.obj \
$O\ItemNameUtils.obj \
$O\OutStreamWithCRC.obj \
@@ -86,24 +77,33 @@ AR_COMMON_OBJS = \
$O\7zHandler.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
- $O\7zMethodID.obj \
+ $O\7zRegister.obj \
BRANCH_OPT_OBJS = \
$O\BranchCoder.obj \
$O\x86.obj \
$O\x86_2.obj \
+ $O\BCJRegister.obj \
+ $O\BCJ2Register.obj \
+
+COPY_OBJS = \
+ $O\CopyCoder.obj \
+ $O\CopyRegister.obj \
LZ_OBJS = \
$O\LZOutWindow.obj \
LZMA_OPT_OBJS = \
$O\LZMADecoder.obj \
+ $O\LZMARegister.obj \
PPMD_OPT_OBJS = \
$O\PPMDDecoder.obj \
+ $O\PPMDRegister.obj \
7ZAES_OPT_OBJS = \
$O\7zAES.obj \
+ $O\7zAESRegister.obj \
AES_OPT_OBJS = \
$O\MyAES.obj \
@@ -116,6 +116,14 @@ AES_ORIG_OBJS = \
CRYPTO_HASH_OBJS = \
$O\Sha256.obj \
+C_OBJS = \
+ $O\Alloc.obj \
+
+C_BRANCH_OBJS = \
+ $O\BranchX86.obj \
+
+!include "../../Crc2.mak"
+
OBJS = \
$O\StdAfx.obj \
$(SFX_CONSOLE_OBJS) \
@@ -127,14 +135,17 @@ OBJS = \
$(AR_COMMON_OBJS) \
$(7Z_OBJS) \
$(BRANCH_OPT_OBJS) \
+ $(COPY_OBJS) \
$(LZ_OBJS) \
$(LZMA_OPT_OBJS) \
$(PPMD_OPT_OBJS) \
- $O\CopyCoder.obj \
$(7ZAES_OPT_OBJS) \
$(AES_OPT_OBJS) \
$(AES_ORIG_OBJS) \
$(CRYPTO_HASH_OBJS) \
+ $(C_OBJS) \
+ $(C_BRANCH_OBJS) \
+ $(CRC_OBJS) \
$O\resource.res
@@ -160,6 +171,8 @@ $(7Z_OBJS): ../../Archive/7z/$(*B).cpp
$(COMPL)
$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp
$(COMPL)
+$(COPY_OBJS): ../../Compress/Copy/$(*B).cpp
+ $(COMPL)
$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp
$(COMPL)
$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp
@@ -167,9 +180,6 @@ $(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp
$(PPMD_OPT_OBJS): ../../Compress/PPMD/$(*B).cpp
$(COMPL)
-$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
- $(COMPL)
-
$(AES_OPT_OBJS): ../../Crypto/AES/$(*B).cpp
$(COMPL)
$(AES_ORIG_OBJS): ../../Crypto/AES/$(*B).c
@@ -178,3 +188,9 @@ $(7ZAES_OPT_OBJS): ../../Crypto/7zAES/$(*B).cpp
$(COMPL)
$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp
$(COMPL)
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
+$(C_BRANCH_OBJS): ../../../../C/Compress/Branch/$(*B).c
+ $(COMPL_O2)
+
+!include "../../Crc.mak"
diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp b/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp
index 6294516c..7051b9cd 100755
--- a/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp
+++ b/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp
@@ -19,7 +19,7 @@
using namespace NWindows;
using namespace NFile;
-static LPCWSTR kErrorTitle = L"7-Zip";
+// static LPCWSTR kErrorTitle = L"7-Zip";
static LPCWSTR kCantDeleteFile = L"Can not delete output file";
static LPCWSTR kCantOpenFile = L"Can not open output file";
static LPCWSTR kUnsupportedMethod = L"Unsupported Method";
diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp
index 19fcb0d2..a0df3042 100755
--- a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp
+++ b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp
@@ -51,6 +51,7 @@ static const LPCWSTR kCantFindArchive = L"Can not find archive file";
static const LPCWSTR kCantOpenArchive = L"File is not correct archive";
HRESULT ExtractArchive(
+ CCodecs *codecs,
const UString &fileName,
const UString &folderName,
COpenCallbackGUI *openCallback,
@@ -68,7 +69,7 @@ HRESULT ExtractArchive(
CThreadExtracting extracter;
- HRESULT result = MyOpenArchive(fileName, extracter.ArchiveLink, openCallback);
+ HRESULT result = MyOpenArchive(codecs, fileName, extracter.ArchiveLink, openCallback);
if (result != S_OK)
{
diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h
index 595d2b29..a042270b 100755
--- a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h
+++ b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h
@@ -5,8 +5,10 @@
#include "Common/String.h"
#include "../../UI/GUI/OpenCallbackGUI.h"
+#include "../../UI/Common/LoadCodecs.h"
HRESULT ExtractArchive(
+ CCodecs *codecs,
const UString &fileName,
const UString &folderName,
COpenCallbackGUI *openCallback,
diff --git a/CPP/7zip/Bundles/SFXSetup/Main.cpp b/CPP/7zip/Bundles/SFXSetup/Main.cpp
index 12de5c01..ff20b304 100755
--- a/CPP/7zip/Bundles/SFXSetup/Main.cpp
+++ b/CPP/7zip/Bundles/SFXSetup/Main.cpp
@@ -210,13 +210,22 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /
return 1;
}
+ CCodecs *codecs = new CCodecs;
+ CMyComPtr<IUnknown> compressCodecsInfo = codecs;
+ HRESULT result = codecs->Load();
+ if (result != S_OK)
+ {
+ MyMessageBox(L"Can not load codecs");
+ return 1;
+ }
+
COpenCallbackGUI openCallback;
UString tempDirPath = GetUnicodeString(tempDir.GetPath());
{
bool isCorrupt = false;
UString errorMessage;
- HRESULT result = ExtractArchive(fullPath, tempDirPath, &openCallback, showProgress,
+ HRESULT result = ExtractArchive(codecs, fullPath, tempDirPath, &openCallback, showProgress,
isCorrupt, errorMessage);
if (result != S_OK)
diff --git a/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp b/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp
index a58feab5..bf0194b9 100755
--- a/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp
+++ b/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp
@@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "_SFX" /D "_NO_CRYPTO" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "NO_REGISTRY" /D "_SFX" /D "_NO_CRYPTO" /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"
@@ -71,7 +71,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "_SFX" /D "_NO_CRYPTO" /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 "EXTRACT_ONLY" /D "NO_REGISTRY" /D "_SFX" /D "_NO_CRYPTO" /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"
@@ -98,7 +98,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "_SFX" /Yu"StdAfx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "_SFX" /D "_NO_CRYPTO" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "NO_REGISTRY" /D "_SFX" /D "_NO_CRYPTO" /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"
@@ -193,11 +193,7 @@ SOURCE=..\..\Archive\7z\7zItem.h
# End Source File
# Begin Source File
-SOURCE=..\..\Archive\7z\7zMethodID.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zMethodID.h
+SOURCE=..\..\Archive\7z\7zRegister.cpp
# End Source File
# End Group
# Begin Group "Archive Common"
@@ -229,14 +225,6 @@ SOURCE=..\..\Archive\Common\CrossThreadProgress.h
# End Source File
# Begin Source File
-SOURCE=..\..\Archive\Common\FilterCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\FilterCoder.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\Archive\Common\ItemNameUtils.cpp
# End Source File
# Begin Source File
@@ -262,12 +250,24 @@ SOURCE=..\..\Archive\Common\OutStreamWithCRC.h
SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA\LZMARegister.cpp
+# End Source File
# End Group
# Begin Group "Branch"
# PROP Default_Filter ""
# Begin Source File
+SOURCE=..\..\Compress\Branch\BCJ2Register.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\BCJRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Compress\Branch\BranchCoder.cpp
# End Source File
# Begin Source File
@@ -294,6 +294,10 @@ SOURCE=..\..\Compress\Copy\CopyCoder.cpp
SOURCE=..\..\Compress\Copy\CopyCoder.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Copy\CopyRegister.cpp
+# End Source File
# End Group
# Begin Group "LZ"
@@ -308,23 +312,11 @@ SOURCE=..\..\Compress\LZ\LZOutWindow.h
# End Source File
# End Group
# End Group
-# Begin Group "SDK"
-
-# PROP Default_Filter ""
-# 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\CommandLineParser.cpp
# End Source File
# Begin Source File
@@ -505,6 +497,14 @@ SOURCE=..\..\..\Windows\Window.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\FileStreams.cpp
# End Source File
# Begin Source File
@@ -513,6 +513,14 @@ SOURCE=..\..\Common\FileStreams.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\InBuffer.cpp
# End Source File
# Begin Source File
@@ -604,23 +612,23 @@ SOURCE=..\..\UI\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
-SOURCE=..\..\UI\Common\ArchiverInfo.cpp
+SOURCE=..\..\UI\Common\DefaultName.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\UI\Common\ArchiverInfo.h
+SOURCE=..\..\UI\Common\DefaultName.h
# End Source File
# Begin Source File
-SOURCE=..\..\UI\Common\DefaultName.cpp
+SOURCE=..\..\UI\Common\ExtractMode.h
# End Source File
# Begin Source File
-SOURCE=..\..\UI\Common\DefaultName.h
+SOURCE=..\..\UI\Common\LoadCodecs.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\UI\Common\ExtractMode.h
+SOURCE=..\..\UI\Common\LoadCodecs.h
# End Source File
# Begin Source File
@@ -668,6 +676,41 @@ SOURCE=..\..\FileManager\FormatUtils.cpp
SOURCE=..\..\FileManager\FormatUtils.h
# End Source File
# End Group
+# Begin Group "C"
+
+# PROP Default_Filter ""
+# Begin Group "C Branch"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.h
+# End Source File
+# End Group
+# 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=.\ExtractCallback.cpp
diff --git a/CPP/7zip/Bundles/SFXSetup/makefile b/CPP/7zip/Bundles/SFXSetup/makefile
index 1f86c42c..129d60cf 100755
--- a/CPP/7zip/Bundles/SFXSetup/makefile
+++ b/CPP/7zip/Bundles/SFXSetup/makefile
@@ -1,16 +1,11 @@
PROG = 7zS.sfx
LIBS = $(LIBS) user32.lib oleaut32.lib shell32.lib ole32.lib comctl32.lib
CFLAGS = $(CFLAGS) -I ../../../ \
- -DEXCLUDE_COM \
-DNO_REGISTRY \
-DEXTRACT_ONLY \
+ -DNO_READ_FROM_CODER \
-D_SFX \
- -DFORMAT_7Z \
- -DCOMPRESS_BCJ_X86 \
- -DCOMPRESS_BCJ2 \
- -DCOMPRESS_COPY \
- -DCOMPRESS_LZMA \
- -D_NO_CRYPTO
+ -D_NO_CRYPTO \
SFX_WIN_OBJS = \
$O\Main.obj \
@@ -21,7 +16,6 @@ GUI_OBJS = \
$O\OpenCallbackGUI.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\IntToString.obj \
@@ -49,8 +43,10 @@ WIN_CTRL_OBJS = \
$O\Dialog.obj \
7ZIP_COMMON_OBJS = \
+ $O\CreateCoder.obj \
$O\FileStreams.obj \
$O\InBuffer.obj \
+ $O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\LockedStream.obj \
$O\OutBuffer.obj \
@@ -61,8 +57,8 @@ WIN_CTRL_OBJS = \
UI_COMMON_OBJS = \
$O\ArchiveOpenCallback.obj \
- $O\ArchiverInfo.obj \
$O\DefaultName.obj \
+ $O\LoadCodecs.obj \
$O\OpenArchive.obj \
FM_OBJS = \
@@ -72,7 +68,6 @@ AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\CoderMixer2MT.obj \
$O\CrossThreadProgress.obj \
- $O\FilterCoder.obj \
$O\ItemNameUtils.obj \
$O\OutStreamWithCRC.obj \
@@ -83,18 +78,33 @@ AR_COMMON_OBJS = \
$O\7zHandler.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
- $O\7zMethodID.obj \
+ $O\7zRegister.obj \
BRANCH_OPT_OBJS = \
$O\BranchCoder.obj \
$O\x86.obj \
$O\x86_2.obj \
+ $O\BCJRegister.obj \
+ $O\BCJ2Register.obj \
+
+COPY_OBJS = \
+ $O\CopyCoder.obj \
+ $O\CopyRegister.obj \
LZ_OBJS = \
$O\LZOutWindow.obj \
LZMA_OPT_OBJS = \
$O\LZMADecoder.obj \
+ $O\LZMARegister.obj \
+
+C_OBJS = \
+ $O\Alloc.obj \
+
+C_BRANCH_OBJS = \
+ $O\BranchX86.obj \
+
+!include "../../Crc2.mak"
OBJS = \
$O\StdAfx.obj \
@@ -109,11 +119,14 @@ OBJS = \
$(AR_COMMON_OBJS) \
$(7Z_OBJS) \
$(BRANCH_OPT_OBJS) \
+ $(COPY_OBJS) \
$(LZ_OBJS) \
$(LZMA_OPT_OBJS) \
- $O\CopyCoder.obj \
$O\MyMessages.obj \
$O\ProgressDialog.obj \
+ $(C_OBJS) \
+ $(C_BRANCH_OBJS) \
+ $(CRC_OBJS) \
$O\resource.res
@@ -143,14 +156,23 @@ $(7Z_OBJS): ../../Archive/7z/$(*B).cpp
$(COMPL)
$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp
$(COMPL)
+$(COPY_OBJS): ../../Compress/Copy/$(*B).cpp
+ $(COMPL)
$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp
$(COMPL)
$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp
$(COMPL)
-$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
- $(COMPL)
$O\MyMessages.obj: ../../UI/Explorer/MyMessages.cpp
$(COMPL)
$O\ProgressDialog.obj: ../../FileManager/Resource/ProgressDialog/$(*B).cpp
$(COMPL)
+
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
+
+$(C_BRANCH_OBJS): ../../../../C/Compress/Branch/$(*B).c
+ $(COMPL_O2)
+
+!include "../../Crc.mak"
+
diff --git a/CPP/7zip/Bundles/SFXWin/Main.cpp b/CPP/7zip/Bundles/SFXWin/Main.cpp
index 166d58cb..9c85d6b7 100755
--- a/CPP/7zip/Bundles/SFXWin/Main.cpp
+++ b/CPP/7zip/Bundles/SFXWin/Main.cpp
@@ -72,6 +72,15 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /
return 1;
}
+ CCodecs *codecs = new CCodecs;
+ CMyComPtr<IUnknown> compressCodecsInfo = codecs;
+ HRESULT result = codecs->Load();
+ if (result != S_OK)
+ {
+ ShowErrorMessage(0, result);
+ return S_OK;
+ }
+
COpenCallbackGUI openCallback;
openCallback.PasswordIsDefined = !password.IsEmpty();
@@ -99,7 +108,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /
NWildcard::CCensorNode wildcardCensor;
wildcardCensor.AddItem(true, L"*", true, true, true);
- HRESULT result = ExtractGUI(v1, v2,
+ result = ExtractGUI(codecs, v1, v2,
wildcardCensor, eo, (assumeYes ? false: true), &openCallback, ecs);
/*
diff --git a/CPP/7zip/Bundles/SFXWin/SFXWin.dsp b/CPP/7zip/Bundles/SFXWin/SFXWin.dsp
index ead66bc6..3e9b5c33 100755
--- a/CPP/7zip/Bundles/SFXWin/SFXWin.dsp
+++ b/CPP/7zip/Bundles/SFXWin/SFXWin.dsp
@@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_SFXWIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "NO_REGISTRY" /D "NO_READ_FROM_CODER" /D "_SFX" /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"
@@ -71,7 +71,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_SFXWIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "NO_REGISTRY" /D "NO_READ_FROM_CODER" /D "_SFX" /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"
@@ -98,7 +98,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /Gz /MT /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_PPMD" /D "_SFX" /D "CRYPTO_7ZAES" /D "CRYPTO_AES" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_SFXWIN32" /D "_WINDOWS" /D "_MBCS" /D "EXTRACT_ONLY" /D "NO_REGISTRY" /D "NO_READ_FROM_CODER" /D "_SFX" /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"
@@ -181,11 +181,7 @@ SOURCE=..\..\Archive\7z\7zIn.h
# End Source File
# Begin Source File
-SOURCE=..\..\Archive\7z\7zMethodID.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\7z\7zMethodID.h
+SOURCE=..\..\Archive\7z\7zRegister.cpp
# End Source File
# End Group
# Begin Group "Archive Common"
@@ -217,14 +213,6 @@ SOURCE=..\..\Archive\Common\CrossThreadProgress.h
# End Source File
# Begin Source File
-SOURCE=..\..\Archive\Common\FilterCoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Archive\Common\FilterCoder.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\Archive\Common\ItemNameUtils.cpp
# End Source File
# Begin Source File
@@ -250,12 +238,24 @@ SOURCE=..\..\Archive\Common\OutStreamWithCRC.h
SOURCE=..\..\Compress\LZMA\LZMADecoder.cpp
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA\LZMARegister.cpp
+# End Source File
# End Group
# Begin Group "Branch"
# PROP Default_Filter ""
# Begin Source File
+SOURCE=..\..\Compress\Branch\BCJ2Register.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Branch\BCJRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Compress\Branch\BranchCoder.cpp
# End Source File
# Begin Source File
@@ -292,6 +292,10 @@ SOURCE=..\..\Compress\PPMD\PPMDDecoder.h
# End Source File
# Begin Source File
+SOURCE=..\..\Compress\PPMD\PPMDRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Compress\PPMD\PPMDSubAlloc.h
# End Source File
# Begin Source File
@@ -322,6 +326,10 @@ SOURCE=..\..\Compress\Copy\CopyCoder.cpp
SOURCE=..\..\Compress\Copy\CopyCoder.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\Copy\CopyRegister.cpp
+# End Source File
# End Group
# End Group
# Begin Group "Crypto"
@@ -383,6 +391,10 @@ SOURCE=..\..\Crypto\7zAES\7zAES.h
# End Source File
# Begin Source File
+SOURCE=..\..\Crypto\7zAES\7zAESRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Crypto\7zAES\MySHA256.h
# End Source File
# End Group
@@ -444,6 +456,14 @@ SOURCE=..\..\FileManager\Resource\ProgressDialog\ProgressDialog.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\FilePathAutoRename.cpp
# End Source File
# Begin Source File
@@ -460,6 +480,14 @@ SOURCE=..\..\Common\FileStreams.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\InBuffer.cpp
# End Source File
# Begin Source File
@@ -660,14 +688,6 @@ SOURCE=..\..\..\Windows\Window.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\CommandLineParser.cpp
# End Source File
# Begin Source File
@@ -747,14 +767,6 @@ SOURCE=..\..\UI\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
-SOURCE=..\..\UI\Common\ArchiverInfo.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\UI\Common\ArchiverInfo.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\UI\Common\DefaultName.cpp
# End Source File
# Begin Source File
@@ -779,6 +791,14 @@ SOURCE=..\..\UI\Common\ExtractingFilePath.h
# End Source File
# Begin Source File
+SOURCE=..\..\UI\Common\LoadCodecs.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\UI\Common\LoadCodecs.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\UI\Common\OpenArchive.cpp
# End Source File
# Begin Source File
@@ -827,6 +847,41 @@ SOURCE=..\..\UI\Explorer\MyMessages.h
# End Source File
# End Group
# End Group
+# Begin Group "C"
+
+# PROP Default_Filter ""
+# Begin Group "C Branch"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.h
+# End Source File
+# End Group
+# 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/Bundles/SFXWin/makefile b/CPP/7zip/Bundles/SFXWin/makefile
index 00d3ecc6..b883bcf5 100755
--- a/CPP/7zip/Bundles/SFXWin/makefile
+++ b/CPP/7zip/Bundles/SFXWin/makefile
@@ -1,19 +1,10 @@
PROG = 7z.sfx
LIBS = $(LIBS) user32.lib oleaut32.lib shell32.lib ole32.lib
CFLAGS = $(CFLAGS) -I ../../../ \
- -DEXCLUDE_COM \
-DNO_REGISTRY \
-DEXTRACT_ONLY \
+ -DNO_READ_FROM_CODER \
-D_SFX \
- -DFORMAT_7Z \
- -DCOMPRESS_BCJ_X86 \
- -DCOMPRESS_BCJ2 \
- -DCOMPRESS_COPY \
- -DCOMPRESS_LZMA \
- -DCOMPRESS_PPMD \
- -DCRYPTO_AES \
- -DCRYPTO_7ZAES \
-
SFX_WIN_OBJS = \
$O\Main.obj \
@@ -24,9 +15,8 @@ GUI_OBJS = \
$O\OpenCallbackGUI.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
- $O\CommandLineParser.obj \
$O\CRC.obj \
+ $O\CommandLineParser.obj \
$O\IntToString.obj \
$O\NewHandler.obj \
$O\String.obj \
@@ -52,9 +42,11 @@ WIN_CTRL_OBJS = \
$O\Dialog.obj \
7ZIP_COMMON_OBJS = \
+ $O\CreateCoder.obj \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\InBuffer.obj \
+ $O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\LockedStream.obj \
$O\OutBuffer.obj \
@@ -66,10 +58,10 @@ WIN_CTRL_OBJS = \
UI_COMMON_OBJS = \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
- $O\ArchiverInfo.obj \
$O\DefaultName.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
+ $O\LoadCodecs.obj \
$O\OpenArchive.obj \
FM_OBJS = \
@@ -80,7 +72,6 @@ AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\CoderMixer2MT.obj \
$O\CrossThreadProgress.obj \
- $O\FilterCoder.obj \
$O\ItemNameUtils.obj \
$O\OutStreamWithCRC.obj \
@@ -91,24 +82,33 @@ AR_COMMON_OBJS = \
$O\7zHandler.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
- $O\7zMethodID.obj \
+ $O\7zRegister.obj \
BRANCH_OPT_OBJS = \
$O\BranchCoder.obj \
$O\x86.obj \
$O\x86_2.obj \
+ $O\BCJRegister.obj \
+ $O\BCJ2Register.obj \
+
+COPY_OBJS = \
+ $O\CopyCoder.obj \
+ $O\CopyRegister.obj \
LZ_OBJS = \
$O\LZOutWindow.obj \
LZMA_OPT_OBJS = \
$O\LZMADecoder.obj \
+ $O\LZMARegister.obj \
PPMD_OPT_OBJS = \
$O\PPMDDecoder.obj \
+ $O\PPMDRegister.obj \
7ZAES_OPT_OBJS = \
$O\7zAES.obj \
+ $O\7zAESRegister.obj \
AES_OPT_OBJS = \
$O\MyAES.obj \
@@ -121,6 +121,14 @@ AES_ORIG_OBJS = \
CRYPTO_HASH_OBJS = \
$O\Sha256.obj \
+C_OBJS = \
+ $O\Alloc.obj \
+
+C_BRANCH_OBJS = \
+ $O\BranchX86.obj \
+
+!include "../../Crc2.mak"
+
OBJS = \
$O\StdAfx.obj \
$(SFX_WIN_OBJS) \
@@ -134,10 +142,10 @@ OBJS = \
$(AR_COMMON_OBJS) \
$(7Z_OBJS) \
$(BRANCH_OPT_OBJS) \
+ $(COPY_OBJS) \
$(LZ_OBJS) \
$(LZMA_OPT_OBJS) \
$(PPMD_OPT_OBJS) \
- $O\CopyCoder.obj \
$(CRYPTO_HASH_OBJS) \
$(7ZAES_OPT_OBJS) \
$(AES_OPT_OBJS) \
@@ -147,6 +155,9 @@ OBJS = \
$O\OverwriteDialog.obj \
$O\PasswordDialog.obj \
$O\ProgressDialog.obj \
+ $(C_OBJS) \
+ $(C_BRANCH_OBJS) \
+ $(CRC_OBJS) \
$O\resource.res
@@ -176,6 +187,8 @@ $(7Z_OBJS): ../../Archive/7z/$(*B).cpp
$(COMPL)
$(BRANCH_OPT_OBJS): ../../Compress/Branch/$(*B).cpp
$(COMPL)
+$(COPY_OBJS): ../../Compress/Copy/$(*B).cpp
+ $(COMPL)
$(LZ_OBJS): ../../Compress/LZ/$(*B).cpp
$(COMPL)
$(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp
@@ -183,9 +196,6 @@ $(LZMA_OPT_OBJS): ../../Compress/LZMA/$(*B).cpp
$(PPMD_OPT_OBJS): ../../Compress/PPMD/$(*B).cpp
$(COMPL)
-$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
- $(COMPL)
-
$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp
$(COMPL)
$(7ZAES_OPT_OBJS): ../../Crypto/7zAES/$(*B).cpp
@@ -205,3 +215,10 @@ $O\PasswordDialog.obj: ../../FileManager/Resource/PasswordDialog/$(*B).cpp
$(COMPL)
$O\ProgressDialog.obj: ../../FileManager/Resource/ProgressDialog/$(*B).cpp
$(COMPL)
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
+$(C_BRANCH_OBJS): ../../../../C/Compress/Branch/$(*B).c
+ $(COMPL_O2)
+
+!include "../../Crc.mak"
+ \ No newline at end of file
diff --git a/CPP/7zip/Bundles/makefile b/CPP/7zip/Bundles/makefile
index 7e7d7cdc..fd95af31 100755
--- a/CPP/7zip/Bundles/makefile
+++ b/CPP/7zip/Bundles/makefile
@@ -2,6 +2,7 @@ DIRS = \
Alone\~ \
Alone7z\~ \
Format7z\~ \
+ Format7zF\~ \
Format7zR\~ \
Format7zExtract\~ \
Format7zExtractR\~ \
diff --git a/CPP/7zip/Common/CreateCoder.cpp b/CPP/7zip/Common/CreateCoder.cpp
new file mode 100755
index 00000000..ae0f98fd
--- /dev/null
+++ b/CPP/7zip/Common/CreateCoder.cpp
@@ -0,0 +1,292 @@
+// CreateCoder.cpp
+
+#include "StdAfx.h"
+
+#include "CreateCoder.h"
+
+#include "../../Windows/PropVariant.h"
+#include "../../Windows/Defs.h"
+#include "FilterCoder.h"
+#include "RegisterCodec.h"
+
+static const unsigned int kNumCodecsMax = 64;
+unsigned int g_NumCodecs = 0;
+const CCodecInfo *g_Codecs[kNumCodecsMax];
+void RegisterCodec(const CCodecInfo *codecInfo)
+{
+ if (g_NumCodecs < kNumCodecsMax)
+ g_Codecs[g_NumCodecs++] = codecInfo;
+}
+
+#ifdef EXTERNAL_CODECS
+static HRESULT ReadNumberOfStreams(ICompressCodecsInfo *codecsInfo, UInt32 index, PROPID propID, UInt32 &res)
+{
+ NWindows::NCOM::CPropVariant prop;
+ RINOK(codecsInfo->GetProperty(index, propID, &prop));
+ if (prop.vt == VT_EMPTY)
+ res = 1;
+ else if (prop.vt == VT_UI4)
+ res = prop.ulVal;
+ else
+ return E_INVALIDARG;
+ return S_OK;
+}
+
+static HRESULT ReadIsAssignedProp(ICompressCodecsInfo *codecsInfo, UInt32 index, PROPID propID, bool &res)
+{
+ NWindows::NCOM::CPropVariant prop;
+ RINOK(codecsInfo->GetProperty(index, propID, &prop));
+ if (prop.vt == VT_EMPTY)
+ res = true;
+ else if (prop.vt == VT_BOOL)
+ res = VARIANT_BOOLToBool(prop.boolVal);
+ else
+ return E_INVALIDARG;
+ return S_OK;
+}
+
+HRESULT LoadExternalCodecs(ICompressCodecsInfo *codecsInfo, CObjectVector<CCodecInfoEx> &externalCodecs)
+{
+ UInt32 num;
+ RINOK(codecsInfo->GetNumberOfMethods(&num));
+ for (UInt32 i = 0; i < num; i++)
+ {
+ CCodecInfoEx info;
+ NWindows::NCOM::CPropVariant prop;
+ RINOK(codecsInfo->GetProperty(i, NMethodPropID::kID, &prop));
+ // if (prop.vt != VT_BSTR)
+ // info.Id.IDSize = (Byte)SysStringByteLen(prop.bstrVal);
+ // memmove(info.Id.ID, prop.bstrVal, info.Id.IDSize);
+ if (prop.vt != VT_UI8)
+ {
+ continue; // old Interface
+ // return E_INVALIDARG;
+ }
+ info.Id = prop.uhVal.QuadPart;
+ prop.Clear();
+
+ RINOK(codecsInfo->GetProperty(i, NMethodPropID::kName, &prop));
+ if (prop.vt == VT_BSTR)
+ info.Name = prop.bstrVal;
+ else if (prop.vt != VT_EMPTY)
+ return E_INVALIDARG;;
+
+ RINOK(ReadNumberOfStreams(codecsInfo, i, NMethodPropID::kInStreams, info.NumInStreams));
+ RINOK(ReadNumberOfStreams(codecsInfo, i, NMethodPropID::kOutStreams, info.NumOutStreams));
+ RINOK(ReadIsAssignedProp(codecsInfo, i, NMethodPropID::kEncoderIsAssigned, info.EncoderIsAssigned));
+ RINOK(ReadIsAssignedProp(codecsInfo, i, NMethodPropID::kDecoderIsAssigned, info.DecoderIsAssigned));
+
+ externalCodecs.Add(info);
+ }
+ return S_OK;
+}
+
+#endif
+
+bool FindMethod(
+ #ifdef EXTERNAL_CODECS
+ ICompressCodecsInfo * /* codecsInfo */, const CObjectVector<CCodecInfoEx> *externalCodecs,
+ #endif
+ const UString &name,
+ CMethodId &methodId, UInt32 &numInStreams, UInt32 &numOutStreams)
+{
+ UInt32 i;
+ for (i = 0; i < g_NumCodecs; i++)
+ {
+ const CCodecInfo &codec = *g_Codecs[i];
+ if (name.CompareNoCase(codec.Name) == 0)
+ {
+ methodId = codec.Id;
+ numInStreams = codec.NumInStreams;
+ numOutStreams = 1;
+ return true;
+ }
+ }
+ #ifdef EXTERNAL_CODECS
+ if (externalCodecs)
+ for (i = 0; i < (UInt32)externalCodecs->Size(); i++)
+ {
+ const CCodecInfoEx &codec = (*externalCodecs)[i];
+ if (codec.Name.CompareNoCase(name) == 0)
+ {
+ methodId = codec.Id;
+ numInStreams = codec.NumInStreams;
+ numOutStreams = codec.NumOutStreams;
+ return true;
+ }
+ }
+ #endif
+ return false;
+}
+
+bool FindMethod(
+ #ifdef EXTERNAL_CODECS
+ ICompressCodecsInfo * /* codecsInfo */, const CObjectVector<CCodecInfoEx> *externalCodecs,
+ #endif
+ CMethodId methodId, UString &name)
+{
+ UInt32 i;
+ for (i = 0; i < g_NumCodecs; i++)
+ {
+ const CCodecInfo &codec = *g_Codecs[i];
+ if (methodId == codec.Id)
+ {
+ name = codec.Name;
+ return true;
+ }
+ }
+ #ifdef EXTERNAL_CODECS
+ if (externalCodecs)
+ for (i = 0; i < (UInt32)externalCodecs->Size(); i++)
+ {
+ const CCodecInfoEx &codec = (*externalCodecs)[i];
+ if (methodId == codec.Id)
+ {
+ name = codec.Name;
+ return true;
+ }
+ }
+ #endif
+ return false;
+}
+
+HRESULT CreateCoder(
+ DECL_EXTERNAL_CODECS_LOC_VARS
+ CMethodId methodId,
+ CMyComPtr<ICompressFilter> &filter,
+ CMyComPtr<ICompressCoder> &coder,
+ CMyComPtr<ICompressCoder2> &coder2,
+ bool encode, bool onlyCoder)
+{
+ bool created = false;
+ UInt32 i;
+ for (i = 0; i < g_NumCodecs; i++)
+ {
+ const CCodecInfo &codec = *g_Codecs[i];
+ if (codec.Id == methodId)
+ {
+ if (encode)
+ {
+ if (codec.CreateEncoder)
+ {
+ void *p = codec.CreateEncoder();
+ if (codec.IsFilter) filter = (ICompressFilter *)p;
+ else if (codec.NumInStreams == 1) coder = (ICompressCoder *)p;
+ else coder2 = (ICompressCoder2 *)p;
+ created = (p != 0);
+ break;
+ }
+ }
+ else
+ if (codec.CreateDecoder)
+ {
+ void *p = codec.CreateDecoder();
+ if (codec.IsFilter) filter = (ICompressFilter *)p;
+ else if (codec.NumInStreams == 1) coder = (ICompressCoder *)p;
+ else coder2 = (ICompressCoder2 *)p;
+ created = (p != 0);
+ break;
+ }
+ }
+ }
+
+ #ifdef EXTERNAL_CODECS
+ if (!created && externalCodecs)
+ for (i = 0; i < (UInt32)externalCodecs->Size(); i++)
+ {
+ const CCodecInfoEx &codec = (*externalCodecs)[i];
+ if (codec.Id == methodId)
+ {
+ if (encode)
+ {
+ if (codec.EncoderIsAssigned)
+ {
+ if (codec.IsSimpleCodec())
+ {
+ HRESULT result = codecsInfo->CreateEncoder(i, &IID_ICompressCoder, (void **)&coder);
+ if (result != S_OK && result != E_NOINTERFACE && result != CLASS_E_CLASSNOTAVAILABLE)
+ return result;
+ if (!coder)
+ {
+ RINOK(codecsInfo->CreateEncoder(i, &IID_ICompressFilter, (void **)&filter));
+ }
+ }
+ else
+ {
+ RINOK(codecsInfo->CreateEncoder(i, &IID_ICompressCoder2, (void **)&coder2));
+ }
+ break;
+ }
+ }
+ else
+ if (codec.DecoderIsAssigned)
+ {
+ if (codec.IsSimpleCodec())
+ {
+ HRESULT result = codecsInfo->CreateDecoder(i, &IID_ICompressCoder, (void **)&coder);
+ if (result != S_OK && result != E_NOINTERFACE && result != CLASS_E_CLASSNOTAVAILABLE)
+ return result;
+ if (!coder)
+ {
+ RINOK(codecsInfo->CreateDecoder(i, &IID_ICompressFilter, (void **)&filter));
+ }
+ }
+ else
+ {
+ RINOK(codecsInfo->CreateDecoder(i, &IID_ICompressCoder2, (void **)&coder2));
+ }
+ break;
+ }
+ }
+ }
+ #endif
+
+ if (onlyCoder && filter)
+ {
+ CFilterCoder *coderSpec = new CFilterCoder;
+ coder = coderSpec;
+ coderSpec->Filter = filter;
+ }
+ return S_OK;
+}
+
+HRESULT CreateCoder(
+ DECL_EXTERNAL_CODECS_LOC_VARS
+ CMethodId methodId,
+ CMyComPtr<ICompressCoder> &coder,
+ CMyComPtr<ICompressCoder2> &coder2,
+ bool encode)
+{
+ CMyComPtr<ICompressFilter> filter;
+ return CreateCoder(
+ EXTERNAL_CODECS_LOC_VARS
+ methodId,
+ filter, coder, coder2, encode, true);
+}
+
+HRESULT CreateCoder(
+ DECL_EXTERNAL_CODECS_LOC_VARS
+ CMethodId methodId,
+ CMyComPtr<ICompressCoder> &coder, bool encode)
+{
+ CMyComPtr<ICompressFilter> filter;
+ CMyComPtr<ICompressCoder2> coder2;
+ return CreateCoder(
+ EXTERNAL_CODECS_LOC_VARS
+ methodId,
+ coder, coder2, encode);
+}
+
+HRESULT CreateFilter(
+ DECL_EXTERNAL_CODECS_LOC_VARS
+ CMethodId methodId,
+ CMyComPtr<ICompressFilter> &filter,
+ bool encode)
+{
+ CMyComPtr<ICompressCoder> coder;
+ CMyComPtr<ICompressCoder2> coder2;
+ return CreateCoder(
+ EXTERNAL_CODECS_LOC_VARS
+ methodId,
+ filter, coder, coder2, encode, false);
+}
diff --git a/CPP/7zip/Common/CreateCoder.h b/CPP/7zip/Common/CreateCoder.h
new file mode 100755
index 00000000..9b2f3869
--- /dev/null
+++ b/CPP/7zip/Common/CreateCoder.h
@@ -0,0 +1,98 @@
+// CreateCoder.h
+
+#ifndef __CREATECODER_H
+#define __CREATECODER_H
+
+#include "Common/MyCom.h"
+#include "Common/String.h"
+#include "../ICoder.h"
+
+#include "MethodId.h"
+
+#ifdef EXTERNAL_CODECS
+
+struct CCodecInfoEx
+{
+ UString Name;
+ CMethodId Id;
+ UInt32 NumInStreams;
+ UInt32 NumOutStreams;
+ bool EncoderIsAssigned;
+ bool DecoderIsAssigned;
+ bool IsSimpleCodec() const { return NumOutStreams == 1 && NumInStreams == 1; }
+ CCodecInfoEx(): EncoderIsAssigned(false), DecoderIsAssigned(false) {}
+};
+
+HRESULT LoadExternalCodecs(ICompressCodecsInfo *codecsInfo, CObjectVector<CCodecInfoEx> &externalCodecs);
+
+#define PUBLIC_ISetCompressCodecsInfo public ISetCompressCodecsInfo,
+#define QUERY_ENTRY_ISetCompressCodecsInfo MY_QUERYINTERFACE_ENTRY(ISetCompressCodecsInfo)
+#define DECL_ISetCompressCodecsInfo STDMETHOD(SetCompressCodecsInfo)(ICompressCodecsInfo *compressCodecsInfo);
+#define IMPL_ISetCompressCodecsInfo2(x) \
+STDMETHODIMP x::SetCompressCodecsInfo(ICompressCodecsInfo *compressCodecsInfo) { \
+ _codecsInfo = compressCodecsInfo; return LoadExternalCodecs(_codecsInfo, _externalCodecs); }
+#define IMPL_ISetCompressCodecsInfo IMPL_ISetCompressCodecsInfo2(CHandler)
+
+#define EXTERNAL_CODECS_VARS2 _codecsInfo, &_externalCodecs
+
+#define DECL_EXTERNAL_CODECS_VARS CMyComPtr<ICompressCodecsInfo> _codecsInfo; CObjectVector<CCodecInfoEx> _externalCodecs;
+#define EXTERNAL_CODECS_VARS EXTERNAL_CODECS_VARS2,
+
+#define DECL_EXTERNAL_CODECS_LOC_VARS2 ICompressCodecsInfo *codecsInfo, const CObjectVector<CCodecInfoEx> *externalCodecs
+#define EXTERNAL_CODECS_LOC_VARS2 codecsInfo, externalCodecs
+
+#define DECL_EXTERNAL_CODECS_LOC_VARS DECL_EXTERNAL_CODECS_LOC_VARS2,
+#define EXTERNAL_CODECS_LOC_VARS EXTERNAL_CODECS_LOC_VARS2,
+
+#else
+
+#define PUBLIC_ISetCompressCodecsInfo
+#define QUERY_ENTRY_ISetCompressCodecsInfo
+#define DECL_ISetCompressCodecsInfo
+#define IMPL_ISetCompressCodecsInfo
+#define EXTERNAL_CODECS_VARS2
+#define DECL_EXTERNAL_CODECS_VARS
+#define EXTERNAL_CODECS_VARS EXTERNAL_CODECS_VARS2
+#define DECL_EXTERNAL_CODECS_LOC_VARS2
+#define EXTERNAL_CODECS_LOC_VARS2
+#define DECL_EXTERNAL_CODECS_LOC_VARS
+#define EXTERNAL_CODECS_LOC_VARS
+
+#endif
+
+bool FindMethod(
+ DECL_EXTERNAL_CODECS_LOC_VARS
+ const UString &name, CMethodId &methodId, UInt32 &numInStreams, UInt32 &numOutStreams);
+
+bool FindMethod(
+ DECL_EXTERNAL_CODECS_LOC_VARS
+ CMethodId methodId, UString &name);
+
+
+HRESULT CreateCoder(
+ DECL_EXTERNAL_CODECS_LOC_VARS
+ CMethodId methodId,
+ CMyComPtr<ICompressFilter> &filter,
+ CMyComPtr<ICompressCoder> &coder,
+ CMyComPtr<ICompressCoder2> &coder2,
+ bool encode, bool onlyCoder);
+
+HRESULT CreateCoder(
+ DECL_EXTERNAL_CODECS_LOC_VARS
+ CMethodId methodId,
+ CMyComPtr<ICompressCoder> &coder,
+ CMyComPtr<ICompressCoder2> &coder2,
+ bool encode);
+
+HRESULT CreateCoder(
+ DECL_EXTERNAL_CODECS_LOC_VARS
+ CMethodId methodId,
+ CMyComPtr<ICompressCoder> &coder, bool encode);
+
+HRESULT CreateFilter(
+ DECL_EXTERNAL_CODECS_LOC_VARS
+ CMethodId methodId,
+ CMyComPtr<ICompressFilter> &filter,
+ bool encode);
+
+#endif
diff --git a/CPP/7zip/Archive/Common/FilterCoder.cpp b/CPP/7zip/Common/FilterCoder.cpp
index 5e104c84..9b019c7d 100755
--- a/CPP/7zip/Archive/Common/FilterCoder.cpp
+++ b/CPP/7zip/Common/FilterCoder.cpp
@@ -3,9 +3,12 @@
#include "StdAfx.h"
#include "FilterCoder.h"
-#include "../../../Common/Alloc.h"
-#include "../../../Common/Defs.h"
-#include "../../Common/StreamUtils.h"
+extern "C"
+{
+#include "../../../C/Alloc.h"
+}
+#include "../../Common/Defs.h"
+#include "StreamUtils.h"
static const int kBufferSize = 1 << 17;
diff --git a/CPP/7zip/Archive/Common/FilterCoder.h b/CPP/7zip/Common/FilterCoder.h
index 45618172..36334364 100755
--- a/CPP/7zip/Archive/Common/FilterCoder.h
+++ b/CPP/7zip/Common/FilterCoder.h
@@ -3,9 +3,9 @@
#ifndef __FILTERCODER_H
#define __FILTERCODER_H
-#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../../IPassword.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)) \
diff --git a/CPP/7zip/Common/InBuffer.cpp b/CPP/7zip/Common/InBuffer.cpp
index 02f2adfa..5c4361a3 100755
--- a/CPP/7zip/Common/InBuffer.cpp
+++ b/CPP/7zip/Common/InBuffer.cpp
@@ -4,7 +4,10 @@
#include "InBuffer.h"
-#include "../../Common/Alloc.h"
+extern "C"
+{
+ #include "../../../C/Alloc.h"
+}
CInBuffer::CInBuffer():
_buffer(0),
diff --git a/CPP/7zip/Common/MemBlocks.h b/CPP/7zip/Common/MemBlocks.h
index 31cd3546..c33f712c 100755
--- a/CPP/7zip/Common/MemBlocks.h
+++ b/CPP/7zip/Common/MemBlocks.h
@@ -3,7 +3,11 @@
#ifndef __MEMBLOCKS_H
#define __MEMBLOCKS_H
-#include "Common/Alloc.h"
+extern "C"
+{
+#include "../../../C/Alloc.h"
+}
+
#include "Common/Types.h"
#include "Common/Vector.h"
diff --git a/CPP/7zip/Common/MethodId.cpp b/CPP/7zip/Common/MethodId.cpp
new file mode 100755
index 00000000..5a0c80aa
--- /dev/null
+++ b/CPP/7zip/Common/MethodId.cpp
@@ -0,0 +1,27 @@
+// MethodID.cpp
+
+#include "StdAfx.h"
+
+#include "MethodID.h"
+#include "../../Common/String.h"
+
+static inline wchar_t GetHex(Byte value)
+{
+ return (wchar_t)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
+}
+
+UString ConvertMethodIdToString(UInt64 id)
+{
+ wchar_t s[32];
+ int len = 32;
+ s[--len] = 0;
+ do
+ {
+ s[--len] = GetHex((Byte)id & 0xF);
+ id >>= 4;
+ s[--len] = GetHex((Byte)id & 0xF);
+ id >>= 4;
+ }
+ while (id != 0);
+ return s + len;
+}
diff --git a/CPP/7zip/Common/MethodId.h b/CPP/7zip/Common/MethodId.h
new file mode 100755
index 00000000..42306326
--- /dev/null
+++ b/CPP/7zip/Common/MethodId.h
@@ -0,0 +1,10 @@
+// MethodID.h
+
+#ifndef __7Z_METHOD_ID_H
+#define __7Z_METHOD_ID_H
+
+#include "../../Common/Types.h"
+
+typedef UInt64 CMethodId;
+
+#endif
diff --git a/CPP/7zip/Common/OutBuffer.cpp b/CPP/7zip/Common/OutBuffer.cpp
index a73fa7c5..a63862b9 100755
--- a/CPP/7zip/Common/OutBuffer.cpp
+++ b/CPP/7zip/Common/OutBuffer.cpp
@@ -4,7 +4,10 @@
#include "OutBuffer.h"
-#include "../../Common/Alloc.h"
+extern "C"
+{
+ #include "../../../C/Alloc.h"
+}
bool COutBuffer::Create(UInt32 bufferSize)
{
diff --git a/CPP/7zip/Common/OutMemStream.cpp b/CPP/7zip/Common/OutMemStream.cpp
index 2953afd8..ddc31486 100755
--- a/CPP/7zip/Common/OutMemStream.cpp
+++ b/CPP/7zip/Common/OutMemStream.cpp
@@ -65,8 +65,8 @@ STDMETHODIMP COutMemStream::Write(const void *data, UInt32 size, UInt32 *process
}
continue;
}
- HANDLE events[4] = { StopWritingEvent, WriteToRealStreamEvent, NoLockEvent, _memManager->Semaphore };
- DWORD waitResult = ::WaitForMultipleObjects((Blocks.LockMode ? 4 : 2), events, FALSE, INFINITE);
+ HANDLE events[3] = { StopWritingEvent, WriteToRealStreamEvent, /* NoLockEvent, */ _memManager->Semaphore };
+ DWORD waitResult = ::WaitForMultipleObjects((Blocks.LockMode ? 3 : 2), events, FALSE, INFINITE);
switch (waitResult)
{
case (WAIT_OBJECT_0 + 0):
@@ -81,18 +81,23 @@ STDMETHODIMP COutMemStream::Write(const void *data, UInt32 size, UInt32 *process
*processedSize += processedSize2;
return res;
}
+ /*
case (WAIT_OBJECT_0 + 2):
{
+ // it has bug: no write.
if (!Blocks.SwitchToNoLockMode(_memManager))
return E_FAIL;
break;
}
- case (WAIT_OBJECT_0 + 3):
+ */
+ case (WAIT_OBJECT_0 + 2):
break;
default:
return E_FAIL;
}
Blocks.Blocks.Add(_memManager->AllocateBlock());
+ if (Blocks.Blocks.Back() == 0)
+ return E_FAIL;
}
return S_OK;
}
diff --git a/CPP/7zip/Common/OutMemStream.h b/CPP/7zip/Common/OutMemStream.h
index ea98de17..a8bd1711 100755
--- a/CPP/7zip/Common/OutMemStream.h
+++ b/CPP/7zip/Common/OutMemStream.h
@@ -18,7 +18,7 @@ class COutMemStream:
bool _unlockEventWasSent;
NWindows::NSynchronization::CAutoResetEvent StopWritingEvent;
NWindows::NSynchronization::CAutoResetEvent WriteToRealStreamEvent;
- NWindows::NSynchronization::CAutoResetEvent NoLockEvent;
+ // NWindows::NSynchronization::CAutoResetEvent NoLockEvent;
HRESULT StopWriteResult;
CMemLockBlocks Blocks;
@@ -66,11 +66,13 @@ public:
WriteToRealStreamEvent.Set();
}
+ /*
void SetNoLockMode()
{
_unlockEventWasSent = true;
NoLockEvent.Set();
}
+ */
void StopWriting(HRESULT res)
{
diff --git a/CPP/7zip/Common/RegisterArc.h b/CPP/7zip/Common/RegisterArc.h
new file mode 100755
index 00000000..57730214
--- /dev/null
+++ b/CPP/7zip/Common/RegisterArc.h
@@ -0,0 +1,36 @@
+// RegisterArc.h
+
+#ifndef __REGISTERARC_H
+#define __REGISTERARC_H
+
+#include "../Archive/IArchive.h"
+
+typedef IInArchive * (*CreateInArchiveP)();
+typedef IOutArchive * (*CreateOutArchiveP)();
+
+struct CArcInfo
+{
+ const wchar_t *Name;
+ const wchar_t *Ext;
+ const wchar_t *AddExt;
+ Byte ClassId;
+ Byte Signature[16];
+ int SignatureSize;
+ bool KeepName;
+ CreateInArchiveP CreateInArchive;
+ CreateOutArchiveP CreateOutArchive;
+};
+
+void RegisterArc(const CArcInfo *arcInfo);
+
+#define REGISTER_ARC_NAME(x) CRegister ## x
+
+#define REGISTER_ARC_DEC_SIG(x) struct REGISTER_ARC_NAME(x) { \
+ REGISTER_ARC_NAME(x)() { g_ArcInfo.Signature[0]--; RegisterArc(&g_ArcInfo); }}; \
+ static REGISTER_ARC_NAME(x) g_RegisterArc;
+
+#define REGISTER_ARC(x) struct REGISTER_ARC_NAME(x) { \
+ REGISTER_ARC_NAME(x)() { RegisterArc(&g_ArcInfo); }}; \
+ static REGISTER_ARC_NAME(x) g_RegisterArc;
+
+#endif
diff --git a/CPP/7zip/Common/RegisterCodec.h b/CPP/7zip/Common/RegisterCodec.h
new file mode 100755
index 00000000..6ce4a7f8
--- /dev/null
+++ b/CPP/7zip/Common/RegisterCodec.h
@@ -0,0 +1,33 @@
+// RegisterCodec.h
+
+#ifndef __REGISTERCODEC_H
+#define __REGISTERCODEC_H
+
+#include "../Common/MethodID.h"
+
+typedef void * (*CreateCodecP)();
+struct CCodecInfo
+{
+ CreateCodecP CreateDecoder;
+ CreateCodecP CreateEncoder;
+ CMethodId Id;
+ const wchar_t *Name;
+ UInt32 NumInStreams;
+ bool IsFilter;
+};
+
+void RegisterCodec(const CCodecInfo *codecInfo);
+
+#define REGISTER_CODEC_NAME(x) CRegisterCodec ## x
+
+#define REGISTER_CODEC(x) struct REGISTER_CODEC_NAME(x) { \
+ REGISTER_CODEC_NAME(x)() { RegisterCodec(&g_CodecInfo); }}; \
+ static REGISTER_CODEC_NAME(x) g_RegisterCodec;
+
+#define REGISTER_CODECS_NAME(x) CRegisterCodecs ## x
+#define REGISTER_CODECS(x) struct REGISTER_CODECS_NAME(x) { \
+ REGISTER_CODECS_NAME(x)() { for (int i = 0; i < sizeof(g_CodecsInfo) / sizeof(g_CodecsInfo[0]); i++) \
+ RegisterCodec(&g_CodecsInfo[i]); }}; \
+ static REGISTER_CODECS_NAME(x) g_RegisterCodecs;
+
+#endif
diff --git a/CPP/7zip/Common/StreamBinder.cpp b/CPP/7zip/Common/StreamBinder.cpp
index 2984c2d9..f83939cb 100755
--- a/CPP/7zip/Common/StreamBinder.cpp
+++ b/CPP/7zip/Common/StreamBinder.cpp
@@ -145,7 +145,7 @@ HRESULT CStreamBinder::Write(const void *data, UInt32 size, UInt32 *processedSiz
if (waitResult != WAIT_OBJECT_0 + 0)
{
// ReadingWasClosed = true;
- return E_FAIL;
+ return S_FALSE;
}
// if(!_allBytesAreWritenEvent.Lock())
// return E_FAIL;
diff --git a/CPP/7zip/Compress/BWT/BlockSort.cpp b/CPP/7zip/Compress/BWT/BlockSort.cpp
index 9e28c85f..283d8302 100755
--- a/CPP/7zip/Compress/BWT/BlockSort.cpp
+++ b/CPP/7zip/Compress/BWT/BlockSort.cpp
@@ -27,7 +27,6 @@ static const int kNumHashBytes = 2;
static const UInt32 kNumHashValues = 1 << (kNumHashBytes * 8);
static const int kNumRefBitsMax = 12; // must be < (kNumHashBytes * 8) = 16
-static const UInt32 kNumRefsMax = (1 << kNumRefBitsMax);
#define BS_TEMP_SIZE kNumHashValues
diff --git a/CPP/7zip/Compress/BZip2/BZip2.dsp b/CPP/7zip/Compress/BZip2/BZip2.dsp
index 121602d8..e26819a0 100755
--- a/CPP/7zip/Compress/BZip2/BZip2.dsp
+++ b/CPP/7zip/Compress/BZip2/BZip2.dsp
@@ -97,7 +97,11 @@ SOURCE=..\Codec.def
# End Source File
# Begin Source File
-SOURCE=.\DllExports.cpp
+SOURCE=..\CodecExports.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\DllExports.cpp
# End Source File
# Begin Source File
@@ -118,14 +122,6 @@ SOURCE=.\StdAfx.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\NewHandler.cpp
# End Source File
# Begin Source File
@@ -251,6 +247,19 @@ SOURCE=..\..\..\Windows\Synchronization.h
SOURCE=..\..\..\Windows\Thread.h
# End Source File
# End Group
+# Begin Group "Ñ"
+
+# PROP Default_Filter ""
+# 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=.\BZip2Const.h
@@ -299,5 +308,9 @@ SOURCE=.\BZip2Encoder.cpp
SOURCE=.\BZip2Encoder.h
# End Source File
+# Begin Source File
+
+SOURCE=.\BZip2Register.cpp
+# End Source File
# End Target
# End Project
diff --git a/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp b/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp
index a0b16b18..703d528b 100755
--- a/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp
+++ b/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp
@@ -4,7 +4,11 @@
#include "BZip2Decoder.h"
-#include "../../../Common/Alloc.h"
+extern "C"
+{
+#include "../../../../C/Alloc.h"
+}
+
#include "../../../Common/Defs.h"
#include "../BWT/Mtf8.h"
#include "BZip2CRC.h"
@@ -423,7 +427,6 @@ CDecoder::CDecoder():
{
m_NumThreadsPrev = 0;
NumThreads = 1;
- CS.Enter();
}
CDecoder::~CDecoder()
@@ -467,7 +470,7 @@ void CDecoder::Free()
if (!m_States)
return;
CloseThreads = true;
- CS.Leave();
+ CanProcessEvent.Set();
for (UInt32 t = 0; t < NumThreads; t++)
{
CState &s = m_States[t];
@@ -555,11 +558,11 @@ HRESULT CDecoder::DecodeFile(bool &isBZ, ICompressProgressInfo *progress)
m_States[0].CanWriteEvent.Set();
BlockSizeMax = dicSize;
Result1 = Result2 = S_OK;
- CS.Leave();
+ CanProcessEvent.Set();
UInt32 t;
for (t = 0; t < NumThreads; t++)
m_States[t].StreamWasFinishedEvent.Lock();
- CS.Enter();
+ CanProcessEvent.Reset();
CanStartWaitingEvent.Set();
for (t = 0; t < NumThreads; t++)
m_States[t].WaitingWasStartedEvent.Lock();
@@ -654,6 +657,7 @@ void CState::ThreadFunc()
{
for (;;)
{
+ Decoder->CanProcessEvent.Lock();
Decoder->CS.Enter();
if (Decoder->CloseThreads)
{
diff --git a/CPP/7zip/Compress/BZip2/BZip2Decoder.h b/CPP/7zip/Compress/BZip2/BZip2Decoder.h
index 2375b755..f7a1c6bb 100755
--- a/CPP/7zip/Compress/BZip2/BZip2Decoder.h
+++ b/CPP/7zip/Compress/BZip2/BZip2Decoder.h
@@ -109,6 +109,7 @@ public:
ICompressProgressInfo *Progress;
CState *m_States;
+ NWindows::NSynchronization::CManualResetEvent CanProcessEvent;
NWindows::NSynchronization::CCriticalSection CS;
UInt32 NumThreads;
bool MtMode;
diff --git a/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp b/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp
index 1542b07c..5e555813 100755
--- a/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp
+++ b/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp
@@ -2,7 +2,10 @@
#include "StdAfx.h"
-#include "../../../Common/Alloc.h"
+extern "C"
+{
+#include "../../../../C/Alloc.h"
+}
#include "BZip2Encoder.h"
@@ -66,6 +69,7 @@ DWORD CThreadInfo::ThreadFunc()
{
for (;;)
{
+ Encoder->CanProcessEvent.Lock();
Encoder->CS.Enter();
if (Encoder->CloseThreads)
{
@@ -122,7 +126,6 @@ CEncoder::CEncoder():
ThreadsInfo = 0;
m_NumThreadsPrev = 0;
NumThreads = 1;
- CS.Enter();
#endif
}
@@ -166,7 +169,7 @@ void CEncoder::Free()
if (!ThreadsInfo)
return;
CloseThreads = true;
- CS.Leave();
+ CanProcessEvent.Set();
for (UInt32 t = 0; t < NumThreads; t++)
{
CThreadInfo &ti = ThreadsInfo[t];
@@ -764,11 +767,11 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream,
{
ThreadsInfo[0].CanWriteEvent.Set();
Result = S_OK;
- CS.Leave();
+ CanProcessEvent.Set();
UInt32 t;
for (t = 0; t < NumThreads; t++)
ThreadsInfo[t].StreamWasFinishedEvent.Lock();
- CS.Enter();
+ CanProcessEvent.Reset();
CanStartWaitingEvent.Set();
for (t = 0; t < NumThreads; t++)
ThreadsInfo[t].WaitingWasStartedEvent.Lock();
diff --git a/CPP/7zip/Compress/BZip2/BZip2Encoder.h b/CPP/7zip/Compress/BZip2/BZip2Encoder.h
index 62b255d4..c05a0481 100755
--- a/CPP/7zip/Compress/BZip2/BZip2Encoder.h
+++ b/CPP/7zip/Compress/BZip2/BZip2Encoder.h
@@ -164,6 +164,7 @@ public:
#ifdef COMPRESS_BZIP2_MT
CThreadInfo *ThreadsInfo;
+ NWindows::NSynchronization::CManualResetEvent CanProcessEvent;
NWindows::NSynchronization::CCriticalSection CS;
UInt32 NumThreads;
bool MtMode;
diff --git a/CPP/7zip/Compress/BZip2/BZip2Register.cpp b/CPP/7zip/Compress/BZip2/BZip2Register.cpp
new file mode 100755
index 00000000..9da3fde8
--- /dev/null
+++ b/CPP/7zip/Compress/BZip2/BZip2Register.cpp
@@ -0,0 +1,19 @@
+// Bzip2Register.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "BZip2Decoder.h"
+static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NBZip2::CDecoder); }
+#if !defined(EXTRACT_ONLY) && !defined(DEFLATE_EXTRACT_ONLY)
+#include "BZip2Encoder.h"
+static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NBZip2::CEncoder); }
+#else
+#define CreateCodecOut 0
+#endif
+
+static CCodecInfo g_CodecInfo =
+ { CreateCodec, CreateCodecOut, 0x040202, L"BZip2", 1, false };
+
+REGISTER_CODEC(BZip2)
diff --git a/CPP/7zip/Compress/BZip2/DllExports.cpp b/CPP/7zip/Compress/BZip2/DllExports.cpp
deleted file mode 100755
index 57a3ae65..00000000
--- a/CPP/7zip/Compress/BZip2/DllExports.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyInitGuid.h"
-#include "Common/ComTry.h"
-#ifdef _WIN32
-#include "Common/Alloc.h"
-#endif
-
-#include "BZip2Encoder.h"
-#include "BZip2Decoder.h"
-
-// {23170F69-40C1-278B-0402-020000000000}
-DEFINE_GUID(CLSID_CCompressBZip2Decoder,
-0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 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);
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID /*lpReserved*/)
-{
- #ifdef _WIN32
- if (dwReason == DLL_PROCESS_ATTACH)
- SetLargePageSize();
- #endif
- return TRUE;
-}
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- COM_TRY_BEGIN
- *outObject = 0;
- int correctInterface = (*iid == IID_ICompressCoder);
- CMyComPtr<ICompressCoder> coder;
- if (*clsid == CLSID_CCompressBZip2Decoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NBZip2::CDecoder;
- }
- else if (*clsid == CLSID_CCompressBZip2Encoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NBZip2::CEncoder;
- }
- else
- return CLASS_E_CLASSNOTAVAILABLE;
- *outObject = coder.Detach();
- COM_TRY_END
- return S_OK;
-}
-
-STDAPI GetNumberOfMethods(UINT32 *numMethods)
-{
- *numMethods = 1;
- return S_OK;
-}
-
-STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
-{
- if (index != 0)
- return E_INVALIDARG;
- ::VariantClear((tagVARIANT *)value);
- switch(propID)
- {
- case NMethodPropID::kID:
- {
- const char id[] = { 0x04, 0x02, 0x02 };
- if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- case NMethodPropID::kName:
- if ((value->bstrVal = ::SysAllocString(L"BZip2")) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kDecoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)&CLSID_CCompressBZip2Decoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kEncoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)&CLSID_CCompressBZip2Encoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- return S_OK;
-}
diff --git a/CPP/7zip/Compress/BZip2/makefile b/CPP/7zip/Compress/BZip2/makefile
index 9e8cbdcb..6e467583 100755
--- a/CPP/7zip/Compress/BZip2/makefile
+++ b/CPP/7zip/Compress/BZip2/makefile
@@ -1,19 +1,20 @@
PROG = BZip2.dll
DEF_FILE = ../Codec.def
-CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_BZIP2_MT
+CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_BZIP2_MT -D_7ZIP_LARGE_PAGES
LIBS = $(LIBS) oleaut32.lib
-BZIP2_OBJS = \
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
$O\DllExports.obj \
+
+BZIP2_OBJS = \
$O\BZip2CRC.obj \
+ $O\BZip2Register.obj \
BZIP2_OPT_OBJS = \
$O\BZip2Decoder.obj \
$O\BZip2Encoder.obj \
-COMMON_OBJS = \
- $O\Alloc.obj \
-
WIN_OBJS = \
$O\Synchronization.obj
@@ -22,13 +23,14 @@ WIN_OBJS = \
$O\OutBuffer.obj \
C_OBJS = \
+ $O\Alloc.obj \
$O\Sort.obj \
OBJS = \
$O\StdAfx.obj \
+ $(COMPRESS_OBJS) \
$(BZIP2_OBJS) \
$(BZIP2_OPT_OBJS) \
- $(COMMON_OBJS) \
$(WIN_OBJS) \
$(7ZIP_COMMON_OBJS) \
$O\BlockSort.obj \
@@ -38,12 +40,12 @@ OBJS = \
!include "../../../Build.mak"
+$(COMPRESS_OBJS): ../$(*B).cpp
+ $(COMPL)
$(BZIP2_OBJS): $(*B).cpp
$(COMPL)
$(BZIP2_OPT_OBJS): $(*B).cpp
$(COMPL_O2)
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
- $(COMPL)
$(WIN_OBJS): ../../../Windows/$(*B).cpp
$(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
diff --git a/CPP/7zip/Compress/BZip2Original/BZip2Decoder.cpp b/CPP/7zip/Compress/BZip2Original/BZip2Decoder.cpp
deleted file mode 100755
index 5fb77d01..00000000
--- a/CPP/7zip/Compress/BZip2Original/BZip2Decoder.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-// BZip2Decoder.cpp
-
-#include "StdAfx.h"
-
-#include "BZip2Decoder.h"
-
-#include "../../../Common/Alloc.h"
-#include "Original/bzlib.h"
-
-namespace NCompress {
-namespace NBZip2 {
-
-static const UInt32 kBufferSize = (1 << 20);
-
-CDecoder::~CDecoder()
-{
- BigFree(m_InBuffer);
-}
-
-struct CBZip2Decompressor: public bz_stream
-{
- int Init(int verbosity, int small) { return BZ2_bzDecompressInit(this, verbosity, small); }
- int Decompress() { return BZ2_bzDecompress(this); }
- int End() { return BZ2_bzDecompressEnd(this); }
- UInt64 GetTotalIn() const { return (UInt64(total_in_hi32) << 32) + total_in_lo32; }
- UInt64 GetTotalOut() const { return (UInt64(total_out_hi32) << 32) + total_out_lo32; }
-};
-
-class CBZip2DecompressorReleaser
-{
- CBZip2Decompressor *m_Decompressor;
-public:
- CBZip2DecompressorReleaser(CBZip2Decompressor *decompressor): m_Decompressor(decompressor) {}
- void Diable() { m_Decompressor = NULL; }
- ~CBZip2DecompressorReleaser() { if (m_Decompressor != NULL) m_Decompressor->End(); }
-};
-
-STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
-{
- m_InSize = 0;
- if (m_InBuffer == 0)
- {
- m_InBuffer = (Byte *)BigAlloc(kBufferSize * 2);
- if (m_InBuffer == 0)
- return E_OUTOFMEMORY;
- }
- Byte *outBuffer = m_InBuffer + kBufferSize;
-
- CBZip2Decompressor bzStream;
- bzStream.bzalloc = NULL;
- bzStream.bzfree = NULL;
- bzStream.opaque = NULL;
-
- int result = bzStream.Init(0, 0);
- switch(result)
- {
- case BZ_OK:
- break;
- case BZ_MEM_ERROR:
- return E_OUTOFMEMORY;
- default:
- return E_FAIL;
- }
- CBZip2DecompressorReleaser releaser(&bzStream);
- bzStream.avail_in = 0;
- for (;;)
- {
- if (bzStream.avail_in == 0)
- {
- bzStream.next_in = (char *)m_InBuffer;
- UInt32 processedSize;
- RINOK(inStream->Read(m_InBuffer, kBufferSize, &processedSize));
- bzStream.avail_in = processedSize;
- }
-
- bzStream.next_out = (char *)outBuffer;
- bzStream.avail_out = kBufferSize;
- result = bzStream.Decompress();
- UInt32 numBytesToWrite = kBufferSize - bzStream.avail_out;
- if (numBytesToWrite > 0)
- {
- UInt32 processedSize;
- RINOK(outStream->Write(outBuffer, numBytesToWrite, &processedSize));
- if (numBytesToWrite != processedSize)
- return E_FAIL;
- }
-
- if (result == BZ_STREAM_END)
- break;
- switch(result)
- {
- case BZ_DATA_ERROR:
- case BZ_DATA_ERROR_MAGIC:
- return S_FALSE;
- case BZ_OK:
- break;
- case BZ_MEM_ERROR:
- return E_OUTOFMEMORY;
- default:
- return E_FAIL;
- }
- if (progress != NULL)
- {
- UInt64 totalIn = bzStream.GetTotalIn();
- UInt64 totalOut = bzStream.GetTotalOut();
- RINOK(progress->SetRatioInfo(&totalIn, &totalOut));
- }
- }
- m_InSize = bzStream.GetTotalIn();
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(...) { return S_FALSE; }
-}
-
-STDMETHODIMP CDecoder::GetInStreamProcessedSize(UInt64 *value)
-{
- if (value == NULL)
- return E_INVALIDARG;
- *value = m_InSize;
- return S_OK;
-}
-
-}}
diff --git a/CPP/7zip/Compress/BZip2Original/BZip2Decoder.h b/CPP/7zip/Compress/BZip2Original/BZip2Decoder.h
deleted file mode 100755
index e41f730f..00000000
--- a/CPP/7zip/Compress/BZip2Original/BZip2Decoder.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Compress/BZip2/Decoder.h
-
-#ifndef __COMPRESS_BZIP2_DECODER_H
-#define __COMPRESS_BZIP2_DECODER_H
-
-#include "../../ICoder.h"
-#include "../../../Common/MyCom.h"
-
-namespace NCompress {
-namespace NBZip2 {
-
-class CDecoder :
- public ICompressCoder,
- public ICompressGetInStreamProcessedSize,
- public CMyUnknownImp
-{
- Byte *m_InBuffer;
- UInt64 m_InSize;
-public:
- CDecoder(): m_InBuffer(0), m_InSize(0) {};
- ~CDecoder();
-
- MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize)
-
- STDMETHOD(CodeReal)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
- STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
-};
-
-}}
-
-#endif
diff --git a/CPP/7zip/Compress/BZip2Original/BZip2Encoder.cpp b/CPP/7zip/Compress/BZip2Original/BZip2Encoder.cpp
deleted file mode 100755
index bcd7dec0..00000000
--- a/CPP/7zip/Compress/BZip2Original/BZip2Encoder.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-// BZip2Encoder.cpp
-
-#include "StdAfx.h"
-
-#include "BZip2Encoder.h"
-
-#include "../../../Common/Alloc.h"
-#include "Original/bzlib.h"
-
-namespace NCompress {
-namespace NBZip2 {
-
-static const UInt32 kBufferSize = (1 << 20);
-
-CEncoder::~CEncoder()
-{
- BigFree(m_InBuffer);
-}
-
-struct CBZip2Compressor: public bz_stream
-{
- int Init(int blockSize100k, int verbosity, int small)
- { return BZ2_bzCompressInit(this, blockSize100k, verbosity, small); }
- int Compress(int action ) { return BZ2_bzCompress(this, action ); }
- int End() { return BZ2_bzCompressEnd(this); }
- UInt64 GetTotalIn() const { return (UInt64(total_in_hi32) << 32) + total_in_lo32; }
- UInt64 GetTotalOut() const { return (UInt64(total_out_hi32) << 32) + total_out_lo32; }
-};
-
-class CBZip2CompressorReleaser
-{
- CBZip2Compressor *m_Compressor;
-public:
- CBZip2CompressorReleaser(CBZip2Compressor *compressor): m_Compressor(compressor) {}
- void Disable() { m_Compressor = NULL; }
- ~CBZip2CompressorReleaser() { if (m_Compressor != NULL) m_Compressor->End(); }
-};
-
-
-STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
-{
- if (m_InBuffer == 0)
- {
- m_InBuffer = (Byte *)BigAlloc(kBufferSize * 2);
- if (m_InBuffer == 0)
- return E_OUTOFMEMORY;
- }
- Byte *outBuffer = m_InBuffer + kBufferSize;
-
- CBZip2Compressor bzStream;
- bzStream.bzalloc = NULL;
- bzStream.bzfree = NULL;
- bzStream.opaque = NULL;
-
- int result = bzStream.Init(9, 0, 0);
- switch(result)
- {
- case BZ_OK:
- break;
- case BZ_MEM_ERROR:
- return E_OUTOFMEMORY;
- default:
- return E_FAIL;
- }
- CBZip2CompressorReleaser releaser(&bzStream);
- bzStream.avail_in = 0;
- for (;;)
- {
- if (bzStream.avail_in == 0)
- {
- bzStream.next_in = (char *)m_InBuffer;
- UInt32 processedSize;
- RINOK(inStream->Read(m_InBuffer, kBufferSize, &processedSize));
- bzStream.avail_in = processedSize;
- }
-
- bzStream.next_out = (char *)outBuffer;
- bzStream.avail_out = kBufferSize;
- bool askFinish = (bzStream.avail_in == 0);
- result = bzStream.Compress(askFinish ? BZ_FINISH : BZ_RUN);
- UInt32 numBytesToWrite = kBufferSize - bzStream.avail_out;
- if (numBytesToWrite > 0)
- {
- UInt32 processedSize;
- RINOK(outStream->Write(outBuffer, numBytesToWrite, &processedSize));
- if (numBytesToWrite != processedSize)
- return E_FAIL;
- }
-
- if (result == BZ_STREAM_END)
- break;
- switch(result)
- {
- case BZ_RUN_OK:
- if (!askFinish)
- break;
- return E_FAIL;
- case BZ_FINISH_OK:
- if (askFinish)
- break;
- return E_FAIL;
- case BZ_MEM_ERROR:
- return E_OUTOFMEMORY;
- default:
- return E_FAIL;
- }
- if (progress != NULL)
- {
- UInt64 totalIn = bzStream.GetTotalIn();
- UInt64 totalOut = bzStream.GetTotalOut();
- RINOK(progress->SetRatioInfo(&totalIn, &totalOut));
- }
- }
- // result = bzStream.End();
- return S_OK;
-}
-
-}}
diff --git a/CPP/7zip/Compress/BZip2Original/BZip2Encoder.h b/CPP/7zip/Compress/BZip2Original/BZip2Encoder.h
deleted file mode 100755
index c451a08d..00000000
--- a/CPP/7zip/Compress/BZip2Original/BZip2Encoder.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Compress/BZip2/Encoder.h
-
-#ifndef __COMPRESS_BZIP2_ENCODER_H
-#define __COMPRESS_BZIP2_ENCODER_H
-
-#include "../../ICoder.h"
-#include "../../../Common/MyCom.h"
-
-namespace NCompress {
-namespace NBZip2 {
-
-class CEncoder :
- public ICompressCoder,
- public CMyUnknownImp
-{
- Byte *m_InBuffer;
-public:
- CEncoder(): m_InBuffer(0) {};
- ~CEncoder();
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-};
-
-}}
-
-#endif
diff --git a/CPP/7zip/Compress/BZip2Original/BZip2Error.cpp b/CPP/7zip/Compress/BZip2Original/BZip2Error.cpp
deleted file mode 100755
index c8a912dc..00000000
--- a/CPP/7zip/Compress/BZip2Original/BZip2Error.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "StdAfx.h"
-
-#include "Original/bzlib.h"
-
-extern "C"
-
-void bz_internal_error (int errcode)
-{
- throw "error";
-} \ No newline at end of file
diff --git a/CPP/7zip/Compress/BZip2Original/DllExports.cpp b/CPP/7zip/Compress/BZip2Original/DllExports.cpp
deleted file mode 100755
index 572d1fda..00000000
--- a/CPP/7zip/Compress/BZip2Original/DllExports.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyInitGuid.h"
-#include "Common/ComTry.h"
-
-#include "BZip2Encoder.h"
-#include "BZip2Decoder.h"
-
-// {23170F69-40C1-278B-0402-020000000000}
-DEFINE_GUID(CLSID_CCompressBZip2Decoder,
-0x23170F69, 0x40C1, 0x278B, 0x04, 0x02, 0x02, 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);
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
-{
- return TRUE;
-}
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- COM_TRY_BEGIN
- *outObject = 0;
- int correctInterface = (*iid == IID_ICompressCoder);
- CMyComPtr<ICompressCoder> coder;
- if (*clsid == CLSID_CCompressBZip2Decoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NBZip2::CDecoder;
- }
- else if (*clsid == CLSID_CCompressBZip2Encoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NBZip2::CEncoder;
- }
- else
- return CLASS_E_CLASSNOTAVAILABLE;
- *outObject = coder.Detach();
- COM_TRY_END
- return S_OK;
-}
-
-STDAPI GetNumberOfMethods(UINT32 *numMethods)
-{
- *numMethods = 1;
- return S_OK;
-}
-
-STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
-{
- if (index != 0)
- return E_INVALIDARG;
- ::VariantClear((tagVARIANT *)value);
- switch(propID)
- {
- case NMethodPropID::kID:
- {
- const char id[] = { 0x04, 0x02, 0x02 };
- if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- case NMethodPropID::kName:
- if ((value->bstrVal = ::SysAllocString(L"BZip2")) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kDecoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)&CLSID_CCompressBZip2Decoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kEncoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)&CLSID_CCompressBZip2Encoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- return S_OK;
-}
diff --git a/CPP/7zip/Compress/Branch/ARM.cpp b/CPP/7zip/Compress/Branch/ARM.cpp
index 0918cfb7..5870bc03 100755
--- a/CPP/7zip/Compress/Branch/ARM.cpp
+++ b/CPP/7zip/Compress/Branch/ARM.cpp
@@ -3,7 +3,10 @@
#include "StdAfx.h"
#include "ARM.h"
-#include "../../../../C/Compress/Branch/BranchARM.c"
+extern "C"
+{
+#include "../../../../C/Compress/Branch/BranchARM.h"
+}
UInt32 CBC_ARM_Encoder::SubFilter(Byte *data, UInt32 size)
{
diff --git a/CPP/7zip/Compress/Branch/ARMThumb.cpp b/CPP/7zip/Compress/Branch/ARMThumb.cpp
index 50189adb..7df641ac 100755
--- a/CPP/7zip/Compress/Branch/ARMThumb.cpp
+++ b/CPP/7zip/Compress/Branch/ARMThumb.cpp
@@ -1,9 +1,13 @@
// ARMThumb.cpp
#include "StdAfx.h"
+
#include "ARMThumb.h"
-#include "../../../../C/Compress/Branch/BranchARMThumb.c"
+extern "C"
+{
+#include "../../../../C/Compress/Branch/BranchARMThumb.h"
+}
UInt32 CBC_ARMThumb_Encoder::SubFilter(Byte *data, UInt32 size)
{
diff --git a/CPP/7zip/Compress/Branch/BCJ2Register.cpp b/CPP/7zip/Compress/Branch/BCJ2Register.cpp
new file mode 100755
index 00000000..24855dd7
--- /dev/null
+++ b/CPP/7zip/Compress/Branch/BCJ2Register.cpp
@@ -0,0 +1,18 @@
+// BranchRegister.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "x86_2.h"
+static void *CreateCodec() { return (void *)(ICompressCoder2 *)(new CBCJ2_x86_Decoder()); }
+#ifndef EXTRACT_ONLY
+static void *CreateCodecOut() { return (void *)(ICompressCoder2 *)(new CBCJ2_x86_Encoder()); }
+#else
+#define CreateCodecOut 0
+#endif
+
+static CCodecInfo g_CodecInfo =
+ { CreateCodec, CreateCodecOut, 0x0303011B, L"BCJ2", 4, false };
+
+REGISTER_CODEC(BCJ2)
diff --git a/CPP/7zip/Compress/Branch/BCJRegister.cpp b/CPP/7zip/Compress/Branch/BCJRegister.cpp
new file mode 100755
index 00000000..a62d964d
--- /dev/null
+++ b/CPP/7zip/Compress/Branch/BCJRegister.cpp
@@ -0,0 +1,18 @@
+// BranchRegister.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "x86.h"
+static void *CreateCodec() { return (void *)(ICompressFilter *)(new CBCJ_x86_Decoder()); }
+#ifndef EXTRACT_ONLY
+static void *CreateCodecOut() { return (void *)(ICompressFilter *)(new CBCJ_x86_Encoder()); }
+#else
+#define CreateCodecOut 0
+#endif
+
+static CCodecInfo g_CodecInfo =
+ { CreateCodec, CreateCodecOut, 0x03030103, L"BCJ", 1, true };
+
+REGISTER_CODEC(BCJ)
diff --git a/CPP/7zip/Compress/Branch/Branch.dsp b/CPP/7zip/Compress/Branch/Branch.dsp
index 220cb8ab..795a534a 100755
--- a/CPP/7zip/Compress/Branch/Branch.dsp
+++ b/CPP/7zip/Compress/Branch/Branch.dsp
@@ -98,7 +98,11 @@ SOURCE=..\Codec.def
# End Source File
# Begin Source File
-SOURCE=.\DllExports.cpp
+SOURCE=..\CodecExports.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\DllExports.cpp
# End Source File
# Begin Source File
@@ -155,6 +159,14 @@ SOURCE=.\ARMThumb.h
# End Source File
# Begin Source File
+SOURCE=.\BCJ2Register.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\BCJRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\BranchCoder.cpp
# End Source File
# Begin Source File
@@ -163,6 +175,10 @@ SOURCE=.\BranchCoder.h
# End Source File
# Begin Source File
+SOURCE=.\BranchRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\BranchTypes.h
# End Source File
# Begin Source File
@@ -282,16 +298,135 @@ SOURCE=..\RangeCoder\RangeCoder.h
SOURCE=..\RangeCoder\RangeCoderBit.h
# End Source File
# End Group
-# Begin Group "Common"
+# Begin Group "C"
# PROP Default_Filter ""
+# Begin Group "C Branch"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARM.c
+
+!IF "$(CFG)" == "Branch - Win32 Release"
+
+!ELSEIF "$(CFG)" == "Branch - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARM.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARMThumb.c
+
+!IF "$(CFG)" == "Branch - Win32 Release"
+
+!ELSEIF "$(CFG)" == "Branch - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchARMThumb.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchIA64.c
+
+!IF "$(CFG)" == "Branch - Win32 Release"
+
+!ELSEIF "$(CFG)" == "Branch - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchIA64.h
+# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Alloc.cpp
+SOURCE=..\..\..\..\C\Compress\Branch\BranchPPC.c
+
+!IF "$(CFG)" == "Branch - Win32 Release"
+
+!ELSEIF "$(CFG)" == "Branch - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchPPC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchSPARC.c
+
+!IF "$(CFG)" == "Branch - Win32 Release"
+
+!ELSEIF "$(CFG)" == "Branch - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchSPARC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchTypes.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.c
+
+!IF "$(CFG)" == "Branch - Win32 Release"
+
+!ELSEIF "$(CFG)" == "Branch - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.h
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Alloc.c
+
+!IF "$(CFG)" == "Branch - Win32 Release"
+
+!ELSEIF "$(CFG)" == "Branch - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Alloc.h
+SOURCE=..\..\..\..\C\Alloc.h
# End Source File
# End Group
# End Target
diff --git a/CPP/7zip/Compress/Branch/BranchCoder.h b/CPP/7zip/Compress/Branch/BranchCoder.h
index 4b53b6cb..102f0dab 100755
--- a/CPP/7zip/Compress/Branch/BranchCoder.h
+++ b/CPP/7zip/Compress/Branch/BranchCoder.h
@@ -5,7 +5,6 @@
#include "Common/MyCom.h"
#include "Common/Types.h"
-#include "Common/Alloc.h"
#include "../../ICoder.h"
@@ -35,20 +34,12 @@ public:
#define MyClassDecoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \
{ public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT};
-#define MyClass2b(Name, id, subId, encodingId) \
-DEFINE_GUID(CLSID_CCompressConvert ## Name, \
-0x23170F69, 0x40C1, 0x278B, 0x03, 0x03, id, subId, 0x00, 0x00, encodingId, 0x00);
-
#define MyClassA(Name, id, subId) \
-MyClass2b(Name ## _Encoder, id, subId, 0x01) \
MyClassEncoderA(Name ## _Encoder) \
-MyClass2b(Name ## _Decoder, id, subId, 0x00) \
MyClassDecoderA(Name ## _Decoder)
#define MyClassB(Name, id, subId, ADD_ITEMS, ADD_INIT) \
-MyClass2b(Name ## _Encoder, id, subId, 0x01) \
MyClassEncoderB(Name ## _Encoder, ADD_ITEMS, ADD_INIT) \
-MyClass2b(Name ## _Decoder, id, subId, 0x00) \
MyClassDecoderB(Name ## _Decoder, ADD_ITEMS, ADD_INIT)
#endif
diff --git a/CPP/7zip/Compress/Branch/BranchRegister.cpp b/CPP/7zip/Compress/Branch/BranchRegister.cpp
new file mode 100755
index 00000000..2ccdcc64
--- /dev/null
+++ b/CPP/7zip/Compress/Branch/BranchRegister.cpp
@@ -0,0 +1,34 @@
+// BranchRegister.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "PPC.h"
+#include "IA64.h"
+#include "ARM.h"
+#include "ARMThumb.h"
+#include "SPARC.h"
+
+#define CREATE_CODEC(x) \
+ static void *CreateCodec ## x() { return (void *)(ICompressFilter *)(new C ## x ## _Decoder); } \
+ static void *CreateCodec ## x ## Out() { return (void *)(ICompressFilter *)(new C ## x ## _Encoder); }
+
+CREATE_CODEC(BC_PPC_B)
+CREATE_CODEC(BC_IA64)
+CREATE_CODEC(BC_ARM)
+CREATE_CODEC(BC_ARMThumb)
+CREATE_CODEC(BC_SPARC)
+
+#define METHOD_ITEM(x, id1, id2, name) { CreateCodec ## x, CreateCodec ## x ## Out, 0x03030000 + (id1 * 256) + id2, name, 1, true }
+
+static CCodecInfo g_CodecsInfo[] =
+{
+ METHOD_ITEM(BC_PPC_B, 0x02, 0x05, L"BC_PPC_B"),
+ METHOD_ITEM(BC_IA64, 0x04, 1, L"BC_IA64"),
+ METHOD_ITEM(BC_ARM, 0x05, 1, L"BC_ARM"),
+ METHOD_ITEM(BC_ARMThumb,0x07, 1, L"BC_ARMThumb"),
+ METHOD_ITEM(BC_SPARC, 0x08, 0x05, L"BC_SPARC")
+};
+
+REGISTER_CODECS(Branch)
diff --git a/CPP/7zip/Compress/Branch/DllExports.cpp b/CPP/7zip/Compress/Branch/DllExports.cpp
deleted file mode 100755
index e7928f75..00000000
--- a/CPP/7zip/Compress/Branch/DllExports.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyInitGuid.h"
-#include "Common/ComTry.h"
-
-#include "x86.h"
-#include "PPC.h"
-#include "IA64.h"
-#include "ARM.h"
-#include "ARMThumb.h"
-#include "x86_2.h"
-#include "SPARC.h"
-
-#define MY_CreateClass0(n) \
-if (*clsid == CLSID_CCompressConvert ## n ## _Encoder) { \
- if (!correctInterface) \
- return E_NOINTERFACE; \
- filter = (ICompressFilter *)new C ## n ## _Encoder(); \
- } else if (*clsid == CLSID_CCompressConvert ## n ## _Decoder){ \
- if (!correctInterface) \
- return E_NOINTERFACE; \
- filter = (ICompressFilter *)new C ## n ## _Decoder(); \
- }
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/)
-{
- return TRUE;
-}
-
-STDAPI CreateObject(
- const GUID *clsid,
- const GUID *interfaceID,
- void **outObject)
-{
- COM_TRY_BEGIN
- *outObject = 0;
- int correctInterface = (*interfaceID == IID_ICompressFilter);
- CMyComPtr<ICompressFilter> filter;
- MY_CreateClass0(BCJ_x86)
- else
- MY_CreateClass0(BC_ARM)
- else
- MY_CreateClass0(BC_PPC_B)
- else
- MY_CreateClass0(BC_IA64)
- else
- MY_CreateClass0(BC_ARMThumb)
- else
- MY_CreateClass0(BC_SPARC)
- else
- {
- CMyComPtr<ICompressCoder2> coder2;
- correctInterface = (*interfaceID == IID_ICompressCoder2);
- if (*clsid == CLSID_CCompressConvertBCJ2_x86_Encoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder2 = (ICompressCoder2 *)new CBCJ2_x86_Encoder();
- }
- else if (*clsid == CLSID_CCompressConvertBCJ2_x86_Decoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder2 = (ICompressCoder2 *)new CBCJ2_x86_Decoder();
- }
- else
- return CLASS_E_CLASSNOTAVAILABLE;
- *outObject = coder2.Detach();
- return S_OK;
- }
- *outObject = filter.Detach();
- return S_OK;
-
- COM_TRY_END
-}
-
-struct CBranchMethodItem
-{
- char ID[4];
- const wchar_t *UserName;
- const GUID *Decoder;
- const GUID *Encoder;
- UINT32 NumInStreams;
-};
-
-#define METHOD_ITEM(Name, id, subId, UserName, NumInStreams) \
- { { 0x03, 0x03, id, subId }, UserName, \
- &CLSID_CCompressConvert ## Name ## _Decoder, \
- &CLSID_CCompressConvert ## Name ## _Encoder, NumInStreams }
-
-
-static CBranchMethodItem g_Methods[] =
-{
- METHOD_ITEM(BCJ_x86, 0x01, 0x03, L"BCJ", 1),
- METHOD_ITEM(BCJ2_x86, 0x01, 0x1B, L"BCJ2", 4),
- METHOD_ITEM(BC_PPC_B, 0x02, 0x05, L"BC_PPC_B", 1),
- // METHOD_ITEM(BC_Alpha, 0x03, 1, L"BC_Alpha", 1),
- METHOD_ITEM(BC_IA64, 0x04, 1, L"BC_IA64", 1),
- METHOD_ITEM(BC_ARM, 0x05, 1, L"BC_ARM", 1),
- // METHOD_ITEM(BC_M68_B, 0x06, 5, L"BC_M68_B", 1),
- METHOD_ITEM(BC_ARMThumb, 0x07, 1, L"BC_ARMThumb", 1),
- METHOD_ITEM(BC_SPARC, 0x08, 0x05, L"BC_SPARC", 1)
-};
-
-STDAPI GetNumberOfMethods(UINT32 *numMethods)
-{
- *numMethods = sizeof(g_Methods) / sizeof(g_Methods[1]);
- return S_OK;
-}
-
-STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
-{
- if (index > sizeof(g_Methods) / sizeof(g_Methods[1]))
- return E_INVALIDARG;
- VariantClear((tagVARIANT *)value);
- const CBranchMethodItem &method = g_Methods[index];
- switch(propID)
- {
- case NMethodPropID::kID:
- if ((value->bstrVal = ::SysAllocStringByteLen(method.ID,
- sizeof(method.ID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kName:
- if ((value->bstrVal = ::SysAllocString(method.UserName)) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kDecoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)method.Decoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kEncoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)method.Encoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kInStreams:
- {
- if (method.NumInStreams != 1)
- {
- value->vt = VT_UI4;
- value->ulVal = method.NumInStreams;
- }
- return S_OK;
- }
- }
- return S_OK;
-}
diff --git a/CPP/7zip/Compress/Branch/IA64.cpp b/CPP/7zip/Compress/Branch/IA64.cpp
index 4d57916c..ae4766a3 100755
--- a/CPP/7zip/Compress/Branch/IA64.cpp
+++ b/CPP/7zip/Compress/Branch/IA64.cpp
@@ -3,7 +3,10 @@
#include "StdAfx.h"
#include "IA64.h"
-#include "../../../../C/Compress/Branch/BranchIA64.c"
+extern "C"
+{
+#include "../../../../C/Compress/Branch/BranchIA64.h"
+}
UInt32 CBC_IA64_Encoder::SubFilter(Byte *data, UInt32 size)
{
diff --git a/CPP/7zip/Compress/Branch/PPC.cpp b/CPP/7zip/Compress/Branch/PPC.cpp
index 08c436e1..ecd4b3d8 100755
--- a/CPP/7zip/Compress/Branch/PPC.cpp
+++ b/CPP/7zip/Compress/Branch/PPC.cpp
@@ -3,8 +3,10 @@
#include "StdAfx.h"
#include "PPC.h"
-#include "Windows/Defs.h"
-#include "../../../../C/Compress/Branch/BranchPPC.c"
+extern "C"
+{
+#include "../../../../C/Compress/Branch/BranchPPC.h"
+}
UInt32 CBC_PPC_B_Encoder::SubFilter(Byte *data, UInt32 size)
{
diff --git a/CPP/7zip/Compress/Branch/SPARC.cpp b/CPP/7zip/Compress/Branch/SPARC.cpp
index 7a218fe4..5678eb31 100755
--- a/CPP/7zip/Compress/Branch/SPARC.cpp
+++ b/CPP/7zip/Compress/Branch/SPARC.cpp
@@ -3,8 +3,10 @@
#include "StdAfx.h"
#include "SPARC.h"
-#include "Windows/Defs.h"
-#include "../../../../C/Compress/Branch/BranchSPARC.c"
+extern "C"
+{
+#include "../../../../C/Compress/Branch/BranchSPARC.h"
+}
UInt32 CBC_SPARC_Encoder::SubFilter(Byte *data, UInt32 size)
{
diff --git a/CPP/7zip/Compress/Branch/makefile b/CPP/7zip/Compress/Branch/makefile
index 6857d39f..73ae75b2 100755
--- a/CPP/7zip/Compress/Branch/makefile
+++ b/CPP/7zip/Compress/Branch/makefile
@@ -3,7 +3,8 @@ DEF_FILE = ../Codec.def
CFLAGS = $(CFLAGS) -I ../../../
LIBS = $(LIBS) oleaut32.lib
-BRANCH_OBJS = \
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
$O\DllExports.obj \
BRANCH_OPT_OBJS = \
@@ -15,10 +16,21 @@ BRANCH_OPT_OBJS = \
$O\SPARC.obj \
$O\x86.obj \
$O\x86_2.obj \
+ $O\BranchRegister.obj \
+ $O\BCJRegister.obj \
+ $O\BCJ2Register.obj \
-COMMON_OBJS = \
+C_OBJS = \
$O\Alloc.obj \
+C_BRANCH_OBJS = \
+ $O\BranchARM.obj \
+ $O\BranchARMThumb.obj \
+ $O\BranchIA64.obj \
+ $O\BranchPPC.obj \
+ $O\BranchSPARC.obj \
+ $O\BranchX86.obj \
+
7ZIP_COMMON_OBJS = \
$O\InBuffer.obj \
$O\OutBuffer.obj \
@@ -26,23 +38,26 @@ COMMON_OBJS = \
OBJS = \
$O\StdAfx.obj \
- $(BRANCH_OBJS) \
+ $(COMPRESS_OBJS) \
$(BRANCH_OPT_OBJS) \
- $(COMMON_OBJS) \
$(7ZIP_COMMON_OBJS) \
$O\RangeCoderBit.obj \
+ $(C_OBJS) \
+ $(C_BRANCH_OBJS) \
$O\resource.res
!include "../../../Build.mak"
-$(BRANCH_OBJS): $(*B).cpp
+$(COMPRESS_OBJS): ../$(*B).cpp
$(COMPL)
$(BRANCH_OPT_OBJS): $(*B).cpp
$(COMPL_O2)
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
- $(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
$O\RangeCoderBit.obj: ../RangeCoder/$(*B).cpp
$(COMPL)
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
+$(C_BRANCH_OBJS): ../../../../C/Compress/Branch/$(*B).c
+ $(COMPL_O2)
diff --git a/CPP/7zip/Compress/Branch/x86.cpp b/CPP/7zip/Compress/Branch/x86.cpp
index 60640d29..c4d11a75 100755
--- a/CPP/7zip/Compress/Branch/x86.cpp
+++ b/CPP/7zip/Compress/Branch/x86.cpp
@@ -3,10 +3,6 @@
#include "StdAfx.h"
#include "x86.h"
-#include "Windows/Defs.h"
-
-#include "../../../../C/Compress/Branch/BranchX86.c"
-
UInt32 CBCJ_x86_Encoder::SubFilter(Byte *data, UInt32 size)
{
return ::x86_Convert(data, size, _bufferPos, &_prevMask, &_prevPos, 1);
diff --git a/CPP/7zip/Compress/Branch/x86.h b/CPP/7zip/Compress/Branch/x86.h
index f795e778..39ba5ae5 100755
--- a/CPP/7zip/Compress/Branch/x86.h
+++ b/CPP/7zip/Compress/Branch/x86.h
@@ -4,7 +4,10 @@
#define __X86_H
#include "BranchCoder.h"
+extern "C"
+{
#include "../../../../C/Compress/Branch/BranchX86.h"
+}
struct CBranch86
{
diff --git a/CPP/7zip/Compress/Branch/x86_2.cpp b/CPP/7zip/Compress/Branch/x86_2.cpp
index ca37ab83..6f3a2f3c 100755
--- a/CPP/7zip/Compress/Branch/x86_2.cpp
+++ b/CPP/7zip/Compress/Branch/x86_2.cpp
@@ -3,7 +3,10 @@
#include "StdAfx.h"
#include "x86_2.h"
-#include "../../../Common/Alloc.h"
+extern "C"
+{
+#include "../../../../C/Alloc.h"
+}
static const int kBufferSize = 1 << 17;
diff --git a/CPP/7zip/Compress/ByteSwap/ByteSwap.dsp b/CPP/7zip/Compress/ByteSwap/ByteSwap.dsp
index 1a73d67f..14c42981 100755
--- a/CPP/7zip/Compress/ByteSwap/ByteSwap.dsp
+++ b/CPP/7zip/Compress/ByteSwap/ByteSwap.dsp
@@ -97,7 +97,11 @@ SOURCE=..\Codec.def
# End Source File
# Begin Source File
-SOURCE=.\DllExports.cpp
+SOURCE=..\CodecExports.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\DllExports.cpp
# End Source File
# Begin Source File
@@ -121,5 +125,9 @@ SOURCE=.\ByteSwap.cpp
SOURCE=.\ByteSwap.h
# End Source File
+# Begin Source File
+
+SOURCE=.\ByteSwapRegister.cpp
+# End Source File
# End Target
# End Project
diff --git a/CPP/7zip/Compress/ByteSwap/ByteSwapRegister.cpp b/CPP/7zip/Compress/ByteSwap/ByteSwapRegister.cpp
new file mode 100755
index 00000000..b1cf8fa6
--- /dev/null
+++ b/CPP/7zip/Compress/ByteSwap/ByteSwapRegister.cpp
@@ -0,0 +1,17 @@
+// ByteSwapRegister.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "ByteSwap.h"
+static void *CreateCodec2() { return (void *)(ICompressFilter *)(new CByteSwap2); }
+static void *CreateCodec4() { return (void *)(ICompressFilter *)(new CByteSwap4); }
+
+static CCodecInfo g_CodecsInfo[] =
+{
+ { CreateCodec2, CreateCodec4, 0x020302, L"Swap2", 1, true },
+ { CreateCodec4, CreateCodec4, 0x020304, L"Swap4", 1, true }
+};
+
+REGISTER_CODECS(ByteSwap)
diff --git a/CPP/7zip/Compress/ByteSwap/DllExports.cpp b/CPP/7zip/Compress/ByteSwap/DllExports.cpp
deleted file mode 100755
index cc737590..00000000
--- a/CPP/7zip/Compress/ByteSwap/DllExports.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyInitGuid.h"
-#include "Common/ComTry.h"
-#include "ByteSwap.h"
-#include "../../ICoder.h"
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/)
-{
- return TRUE;
-}
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- COM_TRY_BEGIN
- *outObject = 0;
- int correctInterface = (*iid == IID_ICompressFilter);
- CMyComPtr<ICompressFilter> coder;
- if (*clsid == CLSID_CCompressConvertByteSwap2)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressFilter *)new CByteSwap2();
- }
- else if (*clsid == CLSID_CCompressConvertByteSwap4)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressFilter *)new CByteSwap4();
- }
- else
- return CLASS_E_CLASSNOTAVAILABLE;
- *outObject = coder.Detach();
- COM_TRY_END
- return S_OK;
-}
-
-struct CSwapMethodInfo
-{
- char ID[3];
- const wchar_t *Name;
- const GUID *clsid;
-};
-
-static CSwapMethodInfo g_Methods[] =
-{
- { { 0x2, 0x03, 0x02 }, L"Swap2", &CLSID_CCompressConvertByteSwap2 },
- { { 0x2, 0x03, 0x04 }, L"Swap4", &CLSID_CCompressConvertByteSwap4 }
-};
-
-STDAPI GetNumberOfMethods(UINT32 *numMethods)
-{
- *numMethods = sizeof(g_Methods) / sizeof(g_Methods[1]);
- return S_OK;
-}
-
-STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
-{
- if (index > sizeof(g_Methods) / sizeof(g_Methods[1]))
- return E_INVALIDARG;
- ::VariantClear((tagVARIANT *)value);
- const CSwapMethodInfo &method = g_Methods[index];
- switch(propID)
- {
- case NMethodPropID::kID:
- {
- if ((value->bstrVal = ::SysAllocStringByteLen(method.ID,
- sizeof(method.ID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- case NMethodPropID::kName:
- {
- if ((value->bstrVal = ::SysAllocString(method.Name)) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- case NMethodPropID::kDecoder:
- case NMethodPropID::kEncoder:
- {
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)method.clsid, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- }
- return S_OK;
-}
diff --git a/CPP/7zip/Compress/ByteSwap/makefile b/CPP/7zip/Compress/ByteSwap/makefile
index f73a8079..80e8af78 100755
--- a/CPP/7zip/Compress/ByteSwap/makefile
+++ b/CPP/7zip/Compress/ByteSwap/makefile
@@ -3,21 +3,23 @@ DEF_FILE = ../Codec.def
CFLAGS = $(CFLAGS) -I ../../../
LIBS = $(LIBS) oleaut32.lib
-SWAP_OBJS = \
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
$O\DllExports.obj \
SWAP_OPT_OBJS = \
$O\ByteSwap.obj \
+ $O\ByteSwapRegister.obj \
OBJS = \
$O\StdAfx.obj \
- $(SWAP_OBJS) \
+ $(COMPRESS_OBJS) \
$(SWAP_OPT_OBJS) \
$O\resource.res
!include "../../../Build.mak"
-$(SWAP_OBJS): $(*B).cpp
+$(COMPRESS_OBJS): ../$(*B).cpp
$(COMPL)
$(SWAP_OPT_OBJS): $(*B).cpp
$(COMPL_O2)
diff --git a/CPP/7zip/Compress/CodecExports.cpp b/CPP/7zip/Compress/CodecExports.cpp
new file mode 100755
index 00000000..a4a85b64
--- /dev/null
+++ b/CPP/7zip/Compress/CodecExports.cpp
@@ -0,0 +1,157 @@
+// CodecExports.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/ComTry.h"
+#include "../../Windows/PropVariant.h"
+#include "../Common/RegisterCodec.h"
+#include "../ICoder.h"
+
+extern unsigned int g_NumCodecs;
+extern const CCodecInfo *g_Codecs[];
+
+static const UInt16 kDecodeId = 0x2790;
+
+DEFINE_GUID(CLSID_CCodec,
+0x23170F69, 0x40C1, kDecodeId, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
+
+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);
+}
+
+static HRESULT SetClassID(CMethodId id, bool encode, PROPVARIANT *value)
+{
+ GUID clsId = CLSID_CCodec;
+ for (int i = 0; i < sizeof(id); i++, id >>= 8)
+ clsId.Data4[i] = (Byte)(id & 0xFF);
+ if (encode)
+ clsId.Data3++;
+ return SetPropGUID(clsId, value);
+}
+
+static HRESULT FindCodecClassId(const GUID *clsID, UInt32 isCoder2, bool isFilter, bool &encode, int &index)
+{
+ index = -1;
+ if (clsID->Data1 != CLSID_CCodec.Data1 ||
+ clsID->Data2 != CLSID_CCodec.Data2 ||
+ (clsID->Data3 & ~1) != kDecodeId)
+ return S_OK;
+ encode = (clsID->Data3 != kDecodeId);
+ UInt64 id = 0;
+ for (int j = 0; j < 8; j++)
+ id |= ((UInt64)clsID->Data4[j]) << (8 * j);
+ for (UInt32 i = 0; i < g_NumCodecs; i++)
+ {
+ const CCodecInfo &codec = *g_Codecs[i];
+ if (id != codec.Id || encode && !codec.CreateEncoder || !encode && !codec.CreateDecoder)
+ continue;
+ if (!isFilter && codec.IsFilter || isFilter && !codec.IsFilter ||
+ codec.NumInStreams != 1 && !isCoder2 || codec.NumInStreams == 1 && isCoder2)
+ return E_NOINTERFACE;
+ index = i;
+ return S_OK;
+ }
+ return S_OK;
+}
+
+STDAPI CreateCoder2(bool encode, UInt32 index, const GUID *iid, void **outObject)
+{
+ COM_TRY_BEGIN
+ *outObject = 0;
+ bool isCoder = (*iid == IID_ICompressCoder) != 0;
+ bool isCoder2 = (*iid == IID_ICompressCoder2) != 0;
+ bool isFilter = (*iid == IID_ICompressFilter) != 0;
+ const CCodecInfo &codec = *g_Codecs[index];
+ if (!isFilter && codec.IsFilter || isFilter && !codec.IsFilter ||
+ codec.NumInStreams != 1 && !isCoder2 || codec.NumInStreams == 1 && isCoder2)
+ return E_NOINTERFACE;
+ if (encode)
+ {
+ if (!codec.CreateEncoder)
+ return CLASS_E_CLASSNOTAVAILABLE;
+ *outObject = codec.CreateEncoder();
+ }
+ else
+ {
+ if (!codec.CreateDecoder)
+ return CLASS_E_CLASSNOTAVAILABLE;
+ *outObject = codec.CreateDecoder();
+ }
+ if (isCoder)
+ ((ICompressCoder *)*outObject)->AddRef();
+ else if (isCoder2)
+ ((ICompressCoder2 *)*outObject)->AddRef();
+ else
+ ((ICompressFilter *)*outObject)->AddRef();
+ return S_OK;
+ COM_TRY_END
+}
+
+STDAPI CreateCoder(const GUID *clsid, const GUID *iid, void **outObject)
+{
+ *outObject = 0;
+ bool isCoder = (*iid == IID_ICompressCoder) != 0;
+ bool isCoder2 = (*iid == IID_ICompressCoder2) != 0;
+ bool isFilter = (*iid == IID_ICompressFilter) != 0;
+ if (!isCoder && !isCoder2 && !isFilter)
+ return E_NOINTERFACE;
+ bool encode;
+ int codecIndex;
+ HRESULT res = FindCodecClassId(clsid, isCoder2, isFilter, encode, codecIndex);
+ if (res != S_OK)
+ return res;
+ if (codecIndex < 0)
+ return CLASS_E_CLASSNOTAVAILABLE;
+ return CreateCoder2(encode, codecIndex, iid, outObject);
+}
+
+STDAPI GetMethodProperty(UInt32 codecIndex, PROPID propID, PROPVARIANT *value)
+{
+ ::VariantClear((VARIANTARG *)value);
+ const CCodecInfo &codec = *g_Codecs[codecIndex];
+ switch(propID)
+ {
+ case NMethodPropID::kID:
+ {
+ value->uhVal.QuadPart = (UInt64)codec.Id;
+ value->vt = VT_UI8;
+ break;
+ }
+ case NMethodPropID::kName:
+ if ((value->bstrVal = ::SysAllocString(codec.Name)) != 0)
+ value->vt = VT_BSTR;
+ break;
+ case NMethodPropID::kDecoder:
+ if (codec.CreateDecoder)
+ return SetClassID(codec.Id, false, value);
+ break;
+ case NMethodPropID::kEncoder:
+ if (codec.CreateEncoder)
+ return SetClassID(codec.Id, true, value);
+ break;
+ case NMethodPropID::kInStreams:
+ {
+ if (codec.NumInStreams != 1)
+ {
+ value->vt = VT_UI4;
+ value->ulVal = codec.NumInStreams;
+ }
+ break;
+ }
+ }
+ return S_OK;
+}
+
+STDAPI GetNumberOfMethods(UINT32 *numCodecs)
+{
+ *numCodecs = g_NumCodecs;
+ return S_OK;
+}
diff --git a/CPP/7zip/Compress/Copy/Copy.dsp b/CPP/7zip/Compress/Copy/Copy.dsp
index 099a433d..efbc5e31 100755
--- a/CPP/7zip/Compress/Copy/Copy.dsp
+++ b/CPP/7zip/Compress/Copy/Copy.dsp
@@ -97,7 +97,11 @@ SOURCE=..\Codec.def
# End Source File
# Begin Source File
-SOURCE=.\DllExports.cpp
+SOURCE=..\CodecExports.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\DllExports.cpp
# End Source File
# Begin Source File
@@ -113,28 +117,29 @@ SOURCE=.\StdAfx.cpp
SOURCE=.\StdAfx.h
# End Source File
# End Group
-# Begin Group "Common"
+# Begin Group "7-Zip Common"
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Common\Alloc.cpp
+SOURCE=..\..\Common\StreamUtils.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Alloc.h
+SOURCE=..\..\Common\StreamUtils.h
# End Source File
# End Group
-# Begin Group "7-Zip Common"
+# Begin Group "Ñ"
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\Common\StreamUtils.cpp
+SOURCE=..\..\..\..\C\Alloc.c
+# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
-SOURCE=..\..\Common\StreamUtils.h
+SOURCE=..\..\..\..\C\Alloc.h
# End Source File
# End Group
# Begin Source File
@@ -145,5 +150,9 @@ SOURCE=.\CopyCoder.cpp
SOURCE=.\CopyCoder.h
# End Source File
+# Begin Source File
+
+SOURCE=.\CopyRegister.cpp
+# End Source File
# End Target
# End Project
diff --git a/CPP/7zip/Compress/Copy/CopyCoder.cpp b/CPP/7zip/Compress/Copy/CopyCoder.cpp
index ce1bde03..141bcf3f 100755
--- a/CPP/7zip/Compress/Copy/CopyCoder.cpp
+++ b/CPP/7zip/Compress/Copy/CopyCoder.cpp
@@ -2,8 +2,12 @@
#include "StdAfx.h"
+extern "C"
+{
+#include "../../../../C/Alloc.h"
+}
+
#include "CopyCoder.h"
-#include "../../../Common/Alloc.h"
#include "../../Common/StreamUtils.h"
namespace NCompress {
diff --git a/CPP/7zip/Compress/Copy/CopyRegister.cpp b/CPP/7zip/Compress/Copy/CopyRegister.cpp
new file mode 100755
index 00000000..1e688b7c
--- /dev/null
+++ b/CPP/7zip/Compress/Copy/CopyRegister.cpp
@@ -0,0 +1,13 @@
+// LZMARegister.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "CopyCoder.h"
+static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::CCopyCoder); }
+
+static CCodecInfo g_CodecInfo =
+{ CreateCodec, CreateCodec, 0x00, L"Copy", 1, false };
+
+REGISTER_CODEC(Copy)
diff --git a/CPP/7zip/Compress/Copy/DllExports.cpp b/CPP/7zip/Compress/Copy/DllExports.cpp
deleted file mode 100755
index 756dcc9c..00000000
--- a/CPP/7zip/Compress/Copy/DllExports.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "../../../Common/MyInitGuid.h"
-#include "../../../Common/ComTry.h"
-
-#include "CopyCoder.h"
-
-// {23170F69-40C1-278B-0000-000000000000}
-DEFINE_GUID(CLSID_CCompressCopyCoder,
-0x23170F69, 0x40C1, 0x278B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/)
-{
- return TRUE;
-}
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- COM_TRY_BEGIN
- *outObject = 0;
- if (*clsid != CLSID_CCompressCopyCoder)
- return CLASS_E_CLASSNOTAVAILABLE;
- if (*iid != IID_ICompressCoder)
- return E_NOINTERFACE;
- CMyComPtr<ICompressCoder> coder = (ICompressCoder *)new NCompress::CCopyCoder();
- *outObject = coder.Detach();
- COM_TRY_END
- return S_OK;
-}
-
-STDAPI GetNumberOfMethods(UINT32 *numMethods)
-{
- *numMethods = 1;
- return S_OK;
-}
-
-STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
-{
- if (index != 0)
- return E_INVALIDARG;
- // ::VariantClear((tagVARIANT *)value);
- switch(propID)
- {
- case NMethodPropID::kID:
- {
- const char id[] = { 0x0 };
- if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- case NMethodPropID::kName:
- {
- if ((value->bstrVal = ::SysAllocString(L"Copy")) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- case NMethodPropID::kDecoder:
- case NMethodPropID::kEncoder:
- {
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)&CLSID_CCompressCopyCoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- }
- return S_OK;
-}
diff --git a/CPP/7zip/Compress/Copy/makefile b/CPP/7zip/Compress/Copy/makefile
index 8c108fbc..4588a341 100755
--- a/CPP/7zip/Compress/Copy/makefile
+++ b/CPP/7zip/Compress/Copy/makefile
@@ -3,28 +3,35 @@ DEF_FILE = ../Codec.def
CFLAGS = $(CFLAGS) -I ../../../
LIBS = $(LIBS) oleaut32.lib
-COPY_OBJS = \
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
$O\DllExports.obj \
- $O\CopyCoder.obj \
-COMMON_OBJS = \
- $O\Alloc.obj \
+COPY_OBJS = \
+ $O\CopyCoder.obj \
+ $O\CopyRegister.obj \
7ZIP_COMMON_OBJS = \
$O\StreamUtils.obj \
+C_OBJS = \
+ $O\Alloc.obj \
+
OBJS = \
$O\StdAfx.obj \
+ $(COMPRESS_OBJS) \
$(COPY_OBJS) \
- $(COMMON_OBJS) \
$(7ZIP_COMMON_OBJS) \
+ $(C_OBJS) \
$O\resource.res
!include "../../../Build.mak"
-$(COPY_OBJS): $(*B).cpp
+$(COMPRESS_OBJS): ../$(*B).cpp
$(COMPL)
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
+$(COPY_OBJS): $(*B).cpp
$(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
diff --git a/CPP/7zip/Compress/Deflate/Deflate.dsp b/CPP/7zip/Compress/Deflate/Deflate.dsp
index a1baccad..11854458 100755
--- a/CPP/7zip/Compress/Deflate/Deflate.dsp
+++ b/CPP/7zip/Compress/Deflate/Deflate.dsp
@@ -97,7 +97,11 @@ SOURCE=..\Codec.def
# End Source File
# Begin Source File
-SOURCE=.\DllExports.cpp
+SOURCE=..\CodecExports.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\DllExports.cpp
# End Source File
# Begin Source File
@@ -166,22 +170,6 @@ SOURCE=..\..\Common\OutBuffer.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\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
@@ -230,6 +218,15 @@ 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
+# Begin Source File
+
SOURCE=..\..\..\..\C\Compress\Lz\LzHash.h
# End Source File
# Begin Source File
@@ -299,6 +296,10 @@ SOURCE=..\..\..\..\C\Sort.h
# End Group
# Begin Source File
+SOURCE=.\Deflate64Register.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\DeflateConst.h
# End Source File
# Begin Source File
@@ -337,5 +338,13 @@ SOURCE=.\DeflateEncoder.cpp
SOURCE=.\DeflateEncoder.h
# End Source File
+# Begin Source File
+
+SOURCE=.\DeflateNsisRegister.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\DeflateRegister.cpp
+# End Source File
# End Target
# End Project
diff --git a/CPP/7zip/Compress/Deflate/Deflate64Register.cpp b/CPP/7zip/Compress/Deflate/Deflate64Register.cpp
new file mode 100755
index 00000000..554e0153
--- /dev/null
+++ b/CPP/7zip/Compress/Deflate/Deflate64Register.cpp
@@ -0,0 +1,19 @@
+// Deflate64Register.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "DeflateDecoder.h"
+static void *CreateCodecDeflate64() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NDecoder::CCOMCoder64); }
+#if !defined(EXTRACT_ONLY) && !defined(DEFLATE_EXTRACT_ONLY)
+#include "DeflateEncoder.h"
+static void *CreateCodecOutDeflate64() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NEncoder::CCOMCoder64); }
+#else
+#define CreateCodecOutDeflate64 0
+#endif
+
+static CCodecInfo g_CodecInfo =
+ { CreateCodecDeflate64, CreateCodecOutDeflate64, 0x040109, L"Deflate64", 1, false };
+
+REGISTER_CODEC(Deflate64)
diff --git a/CPP/7zip/Compress/Deflate/DeflateDecoder.cpp b/CPP/7zip/Compress/Deflate/DeflateDecoder.cpp
index 0de5534b..7569df38 100755
--- a/CPP/7zip/Compress/Deflate/DeflateDecoder.cpp
+++ b/CPP/7zip/Compress/Deflate/DeflateDecoder.cpp
@@ -318,7 +318,7 @@ STDMETHODIMP CCoder::SetOutStreamSize(const UInt64 * /* outSize */)
return S_OK;
}
-#ifdef _ST_MODE
+#ifndef NO_READ_FROM_CODER
STDMETHODIMP CCoder::Read(void *data, UInt32 size, UInt32 *processedSize)
{
diff --git a/CPP/7zip/Compress/Deflate/DeflateDecoder.h b/CPP/7zip/Compress/Deflate/DeflateDecoder.h
index 99928b72..eebe52f0 100755
--- a/CPP/7zip/Compress/Deflate/DeflateDecoder.h
+++ b/CPP/7zip/Compress/Deflate/DeflateDecoder.h
@@ -20,7 +20,7 @@ namespace NDecoder {
class CCoder:
public ICompressCoder,
public ICompressGetInStreamProcessedSize,
- #ifdef _ST_MODE
+ #ifndef NO_READ_FROM_CODER
public ICompressSetInStream,
public ICompressSetOutStreamSize,
public ISequentialInStream,
@@ -83,7 +83,7 @@ public:
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress);
- #ifdef _ST_MODE
+ #ifndef NO_READ_FROM_CODER
MY_UNKNOWN_IMP4(
ICompressGetInStreamProcessedSize,
ICompressSetInStream,
@@ -103,7 +103,7 @@ public:
STDMETHOD(ReleaseInStream)();
STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
- #ifdef _ST_MODE
+ #ifndef NO_READ_FROM_CODER
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
#endif
diff --git a/CPP/7zip/Compress/Deflate/DeflateEncoder.cpp b/CPP/7zip/Compress/Deflate/DeflateEncoder.cpp
index 4e9ffe6d..a574fa3c 100755
--- a/CPP/7zip/Compress/Deflate/DeflateEncoder.cpp
+++ b/CPP/7zip/Compress/Deflate/DeflateEncoder.cpp
@@ -6,7 +6,10 @@
#include "Windows/Defs.h"
#include "Common/ComTry.h"
-#include "../../../Common/Alloc.h"
+extern "C"
+{
+#include "../../../../C/Alloc.h"
+}
// #include "../LZ/BinTree/BinTree3Z.h"
#if _MSC_VER >= 1300
diff --git a/CPP/7zip/Compress/Deflate/DeflateNsisRegister.cpp b/CPP/7zip/Compress/Deflate/DeflateNsisRegister.cpp
new file mode 100755
index 00000000..db181021
--- /dev/null
+++ b/CPP/7zip/Compress/Deflate/DeflateNsisRegister.cpp
@@ -0,0 +1,13 @@
+// DeflateNsisRegister.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "DeflateDecoder.h"
+static void *CreateCodecDeflateNsis() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NDecoder::CNsisCOMCoder); }
+
+static CCodecInfo g_CodecInfo =
+ { CreateCodecDeflateNsis, 0, 0x040901, L"DeflateNSIS", 1, false };
+
+REGISTER_CODEC(DeflateNsis)
diff --git a/CPP/7zip/Compress/Deflate/DeflateRegister.cpp b/CPP/7zip/Compress/Deflate/DeflateRegister.cpp
new file mode 100755
index 00000000..ab3789fd
--- /dev/null
+++ b/CPP/7zip/Compress/Deflate/DeflateRegister.cpp
@@ -0,0 +1,19 @@
+// DeflateRegister.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "DeflateDecoder.h"
+static void *CreateCodecDeflate() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NDecoder::CCOMCoder); }
+#if !defined(EXTRACT_ONLY) && !defined(DEFLATE_EXTRACT_ONLY)
+#include "DeflateEncoder.h"
+static void *CreateCodecOutDeflate() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NEncoder::CCOMCoder); }
+#else
+#define CreateCodecOutDeflate 0
+#endif
+
+static CCodecInfo g_CodecInfo =
+ { CreateCodecDeflate, CreateCodecOutDeflate, 0x040108, L"Deflate", 1, false };
+
+REGISTER_CODEC(Deflate)
diff --git a/CPP/7zip/Compress/Deflate/DllExports.cpp b/CPP/7zip/Compress/Deflate/DllExports.cpp
deleted file mode 100755
index a0b23562..00000000
--- a/CPP/7zip/Compress/Deflate/DllExports.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyInitGuid.h"
-#include "Common/ComTry.h"
-
-#include "DeflateEncoder.h"
-#include "DeflateDecoder.h"
-
-#ifdef CRC_GENERATE_TABLE
-extern "C"
-{
- #include "../../../../C/7zCrc.h"
-}
-#endif
-
-// {23170F69-40C1-278B-0401-080000000000}
-DEFINE_GUID(CLSID_CCompressDeflateDecoder,
-0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-// {23170F69-40C1-278B-0401-090000000000}
-DEFINE_GUID(CLSID_CCompressDeflate64Decoder,
-0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 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-090000000100}
-DEFINE_GUID(CLSID_CCompressDeflate64Encoder,
-0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00);
-
-
-// {23170F69-40C1-278B-0409-010000000000}
-DEFINE_GUID(CLSID_CCompressDeflateNsisDecoder,
-0x23170F69, 0x40C1, 0x278B, 0x04, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID /*lpReserved*/)
-{
- if (dwReason == DLL_PROCESS_ATTACH)
- {
- #ifdef CRC_GENERATE_TABLE
- CrcGenerateTable();
- #endif
- }
- return TRUE;
-}
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- COM_TRY_BEGIN
- *outObject = 0;
- int correctInterface = (*iid == IID_ICompressCoder);
- CMyComPtr<ICompressCoder> coder;
- if (*clsid == CLSID_CCompressDeflateDecoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NDeflate::NDecoder::CCOMCoder();
- }
- else if (*clsid == CLSID_CCompressDeflateNsisDecoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NDeflate::NDecoder::CNsisCOMCoder();
- }
- else if (*clsid == CLSID_CCompressDeflateEncoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NDeflate::NEncoder::CCOMCoder();
- }
- else if (*clsid == CLSID_CCompressDeflate64Decoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NDeflate::NDecoder::CCOMCoder64();
- }
- else if (*clsid == CLSID_CCompressDeflate64Encoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NDeflate::NEncoder::CCOMCoder64();
- }
- else
- return CLASS_E_CLASSNOTAVAILABLE;
- *outObject = coder.Detach();
- COM_TRY_END
- return S_OK;
-}
-
-struct CDeflateMethodItem
-{
- char ID[3];
- const wchar_t *UserName;
- const GUID *Decoder;
- const GUID *Encoder;
-};
-
-#define METHOD_ITEM(Name, id, UserName) \
- { { 0x04, 0x01, id }, UserName, \
- &CLSID_CCompress ## Name ## Decoder, \
- &CLSID_CCompress ## Name ## Encoder }
-
-#define METHOD_ITEM_DE(Name, id1, id2, UserName) \
- { { 0x04, id1, id2 }, UserName, \
- &CLSID_CCompress ## Name ## Decoder, NULL }
-
-
-static CDeflateMethodItem g_Methods[] =
-{
- METHOD_ITEM(Deflate, 0x08, L"Deflate"),
- METHOD_ITEM(Deflate64, 0x09, L"Deflate64"),
- METHOD_ITEM_DE(DeflateNsis, 0x09, 0x01, L"DeflateNSIS")
-};
-
-STDAPI GetNumberOfMethods(UINT32 *numMethods)
-{
- *numMethods = sizeof(g_Methods) / sizeof(g_Methods[0]);
- return S_OK;
-}
-
-STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
-{
- if (index > sizeof(g_Methods) / sizeof(g_Methods[0]))
- return E_INVALIDARG;
- VariantClear((tagVARIANT *)value);
- const CDeflateMethodItem &method = g_Methods[index];
- switch(propID)
- {
- case NMethodPropID::kID:
- if ((value->bstrVal = ::SysAllocStringByteLen(method.ID,
- sizeof(method.ID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kName:
- if ((value->bstrVal = ::SysAllocString(method.UserName)) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kDecoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)method.Decoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kEncoder:
- if (method.Encoder)
- {
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)method.Encoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- }
- return S_OK;
- }
- return S_OK;
-}
diff --git a/CPP/7zip/Compress/Deflate/makefile b/CPP/7zip/Compress/Deflate/makefile
index c533d7cc..302d2888 100755
--- a/CPP/7zip/Compress/Deflate/makefile
+++ b/CPP/7zip/Compress/Deflate/makefile
@@ -1,18 +1,18 @@
PROG = Deflate.dll
DEF_FILE = ../Codec.def
-CFLAGS = $(CFLAGS) -I ../../../ -D_ST_MODE
+CFLAGS = $(CFLAGS) -I ../../../
LIBS = $(LIBS) oleaut32.lib
-DEFLATE_OBJS = \
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
$O\DllExports.obj \
DEFLATE_OPT_OBJS = \
$O\DeflateDecoder.obj \
$O\DeflateEncoder.obj \
-
-COMMON_OBJS = \
- $O\Alloc.obj \
- $O\CRC.obj \
+ $O\DeflateRegister.obj \
+ $O\Deflate64Register.obj \
+ $O\DeflateNsisRegister.obj \
7ZIP_COMMON_OBJS = \
$O\InBuffer.obj \
@@ -24,18 +24,19 @@ LZ_OBJS = \
$O\LZOutWindow.obj \
C_OBJS = \
+ $O\Alloc.obj \
$O\7zCrc.obj \
$O\Sort.obj \
C_LZ_OBJS = \
$O\MatchFinder.obj \
+!include "../../Crc2.mak"
OBJS = \
$O\StdAfx.obj \
- $(DEFLATE_OBJS) \
+ $(COMPRESS_OBJS) \
$(DEFLATE_OPT_OBJS) \
- $(COMMON_OBJS) \
$(7ZIP_COMMON_OBJS) \
$(LZ_OBJS) \
$(C_OBJS) \
@@ -45,12 +46,10 @@ OBJS = \
!include "../../../Build.mak"
-$(DEFLATE_OBJS): $(*B).cpp
+$(COMPRESS_OBJS): ../$(*B).cpp
$(COMPL)
$(DEFLATE_OPT_OBJS): $(*B).cpp
$(COMPL_O2)
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
- $(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
$(LZ_OBJS): ../LZ/$(*B).cpp
@@ -61,3 +60,4 @@ $(C_LZ_OBJS): ../../../../C/Compress/Lz/$(*B).c
$(COMPL_O2)
$O\HuffmanEncode.obj: ../../../../C/Compress/Huffman/$(*B).c
$(COMPL_O2)
+!include "../../Crc.mak"
diff --git a/CPP/7zip/Compress/DllExports.cpp b/CPP/7zip/Compress/DllExports.cpp
new file mode 100755
index 00000000..66f7a7f8
--- /dev/null
+++ b/CPP/7zip/Compress/DllExports.cpp
@@ -0,0 +1,37 @@
+// DllExports.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/MyInitGuid.h"
+
+#include "../ICoder.h"
+
+#include "../Common/RegisterCodec.h"
+
+static const unsigned int kNumCodecsMax = 32;
+unsigned int g_NumCodecs = 0;
+const CCodecInfo *g_Codecs[kNumCodecsMax];
+void RegisterCodec(const CCodecInfo *codecInfo)
+{
+ if (g_NumCodecs < kNumCodecsMax)
+ g_Codecs[g_NumCodecs++] = codecInfo;
+}
+
+extern "C"
+BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/)
+{
+ return TRUE;
+}
+
+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 CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
+{
+ return CreateCoder(clsid, iid, outObject);
+}
+
diff --git a/CPP/7zip/Compress/DllExports2.cpp b/CPP/7zip/Compress/DllExports2.cpp
new file mode 100755
index 00000000..8519d1cc
--- /dev/null
+++ b/CPP/7zip/Compress/DllExports2.cpp
@@ -0,0 +1,28 @@
+// DllExports.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/MyInitGuid.h"
+
+#include "../ICoder.h"
+
+#include "../Common/RegisterCodec.h"
+
+extern "C"
+BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/)
+{
+ return TRUE;
+}
+
+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 CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
+{
+ return CreateCoder(clsid, iid, outObject);
+}
+
diff --git a/CPP/7zip/Compress/Implode/DllExports.cpp b/CPP/7zip/Compress/Implode/DllExports.cpp
deleted file mode 100755
index ff8cbe64..00000000
--- a/CPP/7zip/Compress/Implode/DllExports.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyInitGuid.h"
-#include "Common/ComTry.h"
-#include "ImplodeDecoder.h"
-
-// {23170F69-40C1-278B-0401-060000000000}
-DEFINE_GUID(CLSID_CCompressImplodeDecoder,
-0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
-{
- return TRUE;
-}
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- COM_TRY_BEGIN
- *outObject = 0;
- if (*clsid != CLSID_CCompressImplodeDecoder)
- return CLASS_E_CLASSNOTAVAILABLE;
- if (*iid != IID_ICompressCoder)
- return E_NOINTERFACE;
- CMyComPtr<ICompressCoder> coder = (ICompressCoder *)new
- NCompress::NImplode::NDecoder::CCoder;
- *outObject = coder.Detach();
- COM_TRY_END
- return S_OK;
-}
-
-STDAPI GetNumberOfMethods(UINT32 *numMethods)
-{
- *numMethods = 1;
- return S_OK;
-}
-
-STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
-{
- if (index != 0)
- return E_INVALIDARG;
- ::VariantClear((tagVARIANT *)value);
- switch(propID)
- {
- case NMethodPropID::kID:
- {
- const char id[] = { 0x04, 0x01, 0x06 };
- if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- case NMethodPropID::kName:
- if ((value->bstrVal = ::SysAllocString(L"Implode")) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kDecoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)&CLSID_CCompressImplodeDecoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- return S_OK;
-}
diff --git a/CPP/7zip/Compress/Implode/ImplodeDecoder.cpp b/CPP/7zip/Compress/Implode/ImplodeDecoder.cpp
index 19634c5c..326afc0d 100755
--- a/CPP/7zip/Compress/Implode/ImplodeDecoder.cpp
+++ b/CPP/7zip/Compress/Implode/ImplodeDecoder.cpp
@@ -190,7 +190,7 @@ STDMETHODIMP CCoder::CodeReal(ISequentialInStream *inStream,
}
}
if (pos > unPackSize)
- throw CException(CException::kData);
+ return S_FALSE;
return m_OutWindowStream.Flush();
}
diff --git a/CPP/7zip/Compress/LZ/LZOutWindow.cpp b/CPP/7zip/Compress/LZ/LZOutWindow.cpp
index e2d6aba1..9de2d06f 100755
--- a/CPP/7zip/Compress/LZ/LZOutWindow.cpp
+++ b/CPP/7zip/Compress/LZ/LZOutWindow.cpp
@@ -2,7 +2,6 @@
#include "StdAfx.h"
-#include "../../../Common/Alloc.h"
#include "LZOutWindow.h"
void CLZOutWindow::Init(bool solid)
diff --git a/CPP/7zip/Compress/LZMA/DllExports.cpp b/CPP/7zip/Compress/LZMA/DllExports.cpp
deleted file mode 100755
index 1fc65b84..00000000
--- a/CPP/7zip/Compress/LZMA/DllExports.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "../../../Common/MyInitGuid.h"
-#include "../../../Common/ComTry.h"
-#ifdef _WIN32
-#include "../../../Common/Alloc.h"
-#endif
-
-#include "LZMAEncoder.h"
-#include "LZMADecoder.h"
-
-#ifdef CRC_GENERATE_TABLE
-extern "C"
-{
- #include "../../../../C/7zCrc.h"
-}
-#endif
-
-// {23170F69-40C1-278B-0301-010000000000}
-DEFINE_GUID(CLSID_CLZMADecoder,
-0x23170F69, 0x40C1, 0x278B, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-// {23170F69-40C1-278B-0301-010000000100}
-DEFINE_GUID(CLSID_CLZMAEncoder,
-0x23170F69, 0x40C1, 0x278B, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00);
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID /*lpReserved*/)
-{
- if (dwReason == DLL_PROCESS_ATTACH)
- {
- // NCompress::NRangeCoder::g_PriceTables.Init();
- #ifdef CRC_GENERATE_TABLE
- CrcGenerateTable();
- #endif
- #ifdef _WIN32
- SetLargePageSize();
- #endif
- }
- return TRUE;
-}
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- // NCompress::NRangeCoder::g_PriceTables.Init();
- // CCRC::InitTable();
- COM_TRY_BEGIN
- *outObject = 0;
- int correctInterface = (*iid == IID_ICompressCoder);
- CMyComPtr<ICompressCoder> coder;
- if (*clsid == CLSID_CLZMADecoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NLZMA::CDecoder();
- }
- else if (*clsid == CLSID_CLZMAEncoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NLZMA::CEncoder();
- }
- else
- return CLASS_E_CLASSNOTAVAILABLE;
- *outObject = coder.Detach();
- COM_TRY_END
- return S_OK;
-}
-
-STDAPI GetNumberOfMethods(UINT32 *numMethods)
-{
- *numMethods = 1;
- return S_OK;
-}
-
-STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
-{
- if (index != 0)
- return E_INVALIDARG;
- // ::VariantClear((tagVARIANT *)value);
- switch(propID)
- {
- case NMethodPropID::kID:
- {
- const char id[] = { 0x03, 0x01, 0x01 };
- if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- case NMethodPropID::kName:
- if ((value->bstrVal = ::SysAllocString(L"LZMA")) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kDecoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)&CLSID_CLZMADecoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kEncoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)&CLSID_CLZMAEncoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- return S_OK;
-}
-
diff --git a/CPP/7zip/Compress/LZMA/LZMA.dsp b/CPP/7zip/Compress/LZMA/LZMA.dsp
index 3d51f1ff..2e699d43 100755
--- a/CPP/7zip/Compress/LZMA/LZMA.dsp
+++ b/CPP/7zip/Compress/LZMA/LZMA.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 "LZMA_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /D "_ST_MODE" /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 "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /D "_7ZIP_LARGE_PAGES" /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 "LZMA_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 "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /D "_ST_MODE" /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 "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /D "_7ZIP_LARGE_PAGES" /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=..\Codec.def
# End Source File
# Begin Source File
-SOURCE=.\DllExports.cpp
+SOURCE=..\CodecExports.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\DllExports.cpp
# End Source File
# Begin Source File
@@ -174,88 +178,12 @@ SOURCE=..\..\ICoder.h
# End Source File
# Begin Source File
-SOURCE=..\MatchFinders\IMatchFinder.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\IStream.h
# End Source File
# End Group
# Begin Group "LZ"
# PROP Default_Filter ""
-# Begin Group "BT"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\LZ\BinTree\BinTree.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\BinTree\BinTree2.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\BinTree\BinTree3.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\BinTree\BinTree4.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\BinTree\BinTreeBase.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\BinTree\BinTreeD.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\BinTree\BinTreeD4.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\BinTree\BinTreeDMain.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\BinTree\BinTreeMain.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\BinTree\BinTreeR.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\BinTree\BinTreeR4.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\BinTree\BinTreeRMain.h
-# End Source File
-# End Group
-# Begin Group "HC"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\LZ\HashChain\HC4.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\HashChain\HCMain.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=..\LZ\IMatchFinder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\LZInWindow.h
-# End Source File
# Begin Source File
SOURCE=..\LZ\LZOutWindow.cpp
@@ -270,34 +198,10 @@ SOURCE=..\LZ\LZOutWindow.h
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Common\AlignedBuffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\AlignedBuffer.h
-# End Source File
-# 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\ComTry.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\Defs.h
# End Source File
# Begin Source File
@@ -316,34 +220,6 @@ SOURCE=..\..\..\Common\MyUnknown.h
SOURCE=..\..\..\Common\MyWindows.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 Group "Windows"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\Windows\Handle.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 "C"
@@ -418,6 +294,15 @@ 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
+# Begin Source File
+
SOURCE=..\..\..\..\C\IStream.h
# End Source File
# Begin Source File
@@ -474,5 +359,9 @@ SOURCE=.\LZMAEncoder.cpp
SOURCE=.\LZMAEncoder.h
# End Source File
+# Begin Source File
+
+SOURCE=.\LZMARegister.cpp
+# End Source File
# End Target
# End Project
diff --git a/CPP/7zip/Compress/LZMA/LZMADecoder.cpp b/CPP/7zip/Compress/LZMA/LZMADecoder.cpp
index 75de2245..1b73855c 100755
--- a/CPP/7zip/Compress/LZMA/LZMADecoder.cpp
+++ b/CPP/7zip/Compress/LZMA/LZMADecoder.cpp
@@ -317,7 +317,7 @@ STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
return S_OK;
}
-#ifdef _ST_MODE
+#ifndef NO_READ_FROM_CODER
STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize)
{
diff --git a/CPP/7zip/Compress/LZMA/LZMADecoder.h b/CPP/7zip/Compress/LZMA/LZMADecoder.h
index 1c10409f..bc44a5a9 100755
--- a/CPP/7zip/Compress/LZMA/LZMADecoder.h
+++ b/CPP/7zip/Compress/LZMA/LZMADecoder.h
@@ -4,11 +4,15 @@
#define __LZMA_DECODER_H
#include "../../../Common/MyCom.h"
-#include "../../../Common/Alloc.h"
#include "../../ICoder.h"
#include "../LZ/LZOutWindow.h"
#include "../RangeCoder/RangeCoderBitTree.h"
+extern "C"
+{
+ #include "../../../../C/Alloc.h"
+}
+
#include "LZMA.h"
namespace NCompress {
@@ -146,7 +150,7 @@ class CDecoder:
public ICompressCoder,
public ICompressSetDecoderProperties2,
public ICompressGetInStreamProcessedSize,
- #ifdef _ST_MODE
+ #ifndef NO_READ_FROM_CODER
public ICompressSetInStream,
public ICompressSetOutStreamSize,
public ISequentialInStream,
@@ -187,7 +191,7 @@ class CDecoder:
HRESULT CodeSpec(UInt32 size);
public:
- #ifdef _ST_MODE
+ #ifndef NO_READ_FROM_CODER
MY_UNKNOWN_IMP5(
ICompressSetDecoderProperties2,
ICompressGetInStreamProcessedSize,
@@ -238,7 +242,7 @@ public:
STDMETHOD(ReleaseInStream)();
STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
- #ifdef _ST_MODE
+ #ifndef NO_READ_FROM_CODER
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
#endif
diff --git a/CPP/7zip/Compress/LZMA/LZMAEncoder.cpp b/CPP/7zip/Compress/LZMA/LZMAEncoder.cpp
index 0589f8a1..a57b2a74 100755
--- a/CPP/7zip/Compress/LZMA/LZMAEncoder.cpp
+++ b/CPP/7zip/Compress/LZMA/LZMAEncoder.cpp
@@ -3,6 +3,7 @@
#include "StdAfx.h"
#include <stdio.h>
+#include <malloc.h>
#include "../../../Common/Defs.h"
#include "../../Common/StreamUtils.h"
@@ -22,7 +23,8 @@ namespace NLZMA {
const int kDefaultDictionaryLogSize = 22;
const UInt32 kNumFastBytesDefault = 0x20;
-Byte g_FastPos[1 << 11];
+#ifndef LZMA_LOG_BSR
+Byte g_FastPos[1 << kNumLogBits];
class CFastPosInit
{
@@ -30,7 +32,7 @@ public:
CFastPosInit() { Init(); }
void Init()
{
- const Byte kFastSlots = 22;
+ const Byte kFastSlots = kNumLogBits * 2;
int c = 2;
g_FastPos[0] = 0;
g_FastPos[1] = 1;
@@ -43,6 +45,7 @@ public:
}
}
} g_FastPosInit;
+#endif
void CLiteralEncoder2::Encode(NRangeCoder::CEncoder *rangeEncoder, Byte symbol)
{
@@ -343,35 +346,37 @@ STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
return E_INVALIDARG;
break;
}
- #ifdef COMPRESS_MF_MT
case NCoderPropID::kMultiThread:
{
if (prop.vt != VT_BOOL)
return E_INVALIDARG;
+ #ifdef COMPRESS_MF_MT
Bool newMultiThread = (prop.boolVal == VARIANT_TRUE);
if (newMultiThread != _multiThread)
{
ReleaseMatchFinder();
_multiThread = newMultiThread;
}
+ #endif
break;
}
case NCoderPropID::kNumThreads:
{
if (prop.vt != VT_UI4)
return E_INVALIDARG;
+ #ifdef COMPRESS_MF_MT
Bool newMultiThread = (prop.ulVal > 1) ? True : False;
if (newMultiThread != _multiThread)
{
ReleaseMatchFinder();
_multiThread = newMultiThread;
}
+ #endif
break;
}
- #endif
case NCoderPropID::kDictionarySize:
{
- const int kDicLogSizeMaxCompress = 30;
+ const int kDicLogSizeMaxCompress = 30; // must be <= ((kNumLogBits - 1) * 2) + 7 = 31;
if (prop.vt != VT_UI4)
return E_INVALIDARG;
UInt32 dictionarySize = prop.ulVal;
@@ -1260,6 +1265,9 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream,
ICompressProgressInfo *progress)
{
// _needReleaseMFStream = false;
+ #ifdef COMPRESS_MF_MT
+ alloca(0x300);
+ #endif
CCoderReleaser coderReleaser(this);
RINOK(SetStreams(inStream, outStream, inSize, outSize));
for (;;)
diff --git a/CPP/7zip/Compress/LZMA/LZMAEncoder.h b/CPP/7zip/Compress/LZMA/LZMAEncoder.h
index c1dc7a69..da159795 100755
--- a/CPP/7zip/Compress/LZMA/LZMAEncoder.h
+++ b/CPP/7zip/Compress/LZMA/LZMAEncoder.h
@@ -4,11 +4,11 @@
#define __LZMA_ENCODER_H
#include "../../../Common/MyCom.h"
-#include "../../../Common/Alloc.h"
#include "../../ICoder.h"
extern "C"
{
+ #include "../../../../C/Alloc.h"
#include "../../../../C/Compress/Lz/MatchFinder.h"
#ifdef COMPRESS_MF_MT
#include "../../../../C/Compress/Lz/MatchFinderMt.h"
@@ -59,23 +59,53 @@ struct COptimal
};
-extern Byte g_FastPos[1 << 11];
+// #define LZMA_LOG_BRANCH
+
+#if _MSC_VER >= 1400
+// Must give gain in core 2. but slower ~2% on k8.
+// #define LZMA_LOG_BSR
+#endif
+
+#ifndef LZMA_LOG_BSR
+static const int kNumLogBits = 13; // don't change it !
+extern Byte g_FastPos[];
+#endif
inline UInt32 GetPosSlot(UInt32 pos)
{
- if (pos < (1 << 11))
+ #ifdef LZMA_LOG_BSR
+ if (pos < 2)
+ return pos;
+ unsigned long index;
+ _BitScanReverse(&index, pos);
+ return (index + index) + ((pos >> (index - 1)) & 1);
+ #else
+ if (pos < (1 << kNumLogBits))
return g_FastPos[pos];
- if (pos < (1 << 21))
- return g_FastPos[pos >> 10] + 20;
- return g_FastPos[pos >> 20] + 40;
+ if (pos < (1 << (kNumLogBits * 2 - 1)))
+ return g_FastPos[pos >> (kNumLogBits - 1)] + (kNumLogBits - 1) * 2;
+ return g_FastPos[pos >> (kNumLogBits - 1) * 2] + (kNumLogBits - 1) * 4;
+ #endif
}
inline UInt32 GetPosSlot2(UInt32 pos)
{
- if (pos < (1 << 17))
+ #ifdef LZMA_LOG_BSR
+ unsigned long index;
+ _BitScanReverse(&index, pos);
+ return (index + index) + ((pos >> (index - 1)) & 1);
+ #else
+ #ifdef LZMA_LOG_BRANCH
+ if (pos < (1 << (kNumLogBits + 6)))
return g_FastPos[pos >> 6] + 12;
- if (pos < (1 << 27))
- return g_FastPos[pos >> 16] + 32;
- return g_FastPos[pos >> 26] + 52;
+ if (pos < (1 << (kNumLogBits * 2 + 5)))
+ return g_FastPos[pos >> (kNumLogBits + 5)] + (kNumLogBits + 5) * 2;
+ return g_FastPos[pos >> (kNumLogBits * 2 + 4)] + (kNumLogBits * 2 + 4) * 2;
+ #else
+ // it's faster with VC6-32bit.
+ UInt32 s = 6 + ((kNumLogBits - 1) & (UInt32)((Int32)(((1 << (kNumLogBits + 6)) - 1) - pos) >> 31));
+ return g_FastPos[pos >> s] + (s * 2);
+ #endif
+ #endif
}
const UInt32 kIfinityPrice = 0xFFFFFFF;
diff --git a/CPP/7zip/Compress/LZMA/LZMARegister.cpp b/CPP/7zip/Compress/LZMA/LZMARegister.cpp
new file mode 100755
index 00000000..bc8f7262
--- /dev/null
+++ b/CPP/7zip/Compress/LZMA/LZMARegister.cpp
@@ -0,0 +1,19 @@
+// LZMARegister.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "LZMADecoder.h"
+static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NLZMA::CDecoder); }
+#ifndef EXTRACT_ONLY
+#include "LZMAEncoder.h"
+static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NLZMA::CEncoder); }
+#else
+#define CreateCodecOut 0
+#endif
+
+static CCodecInfo g_CodecInfo =
+ { CreateCodec, CreateCodecOut, 0x030101, L"LZMA", 1, false };
+
+REGISTER_CODEC(LZMA)
diff --git a/CPP/7zip/Compress/LZMA/makefile b/CPP/7zip/Compress/LZMA/makefile
index 0b692541..4a108b42 100755
--- a/CPP/7zip/Compress/LZMA/makefile
+++ b/CPP/7zip/Compress/LZMA/makefile
@@ -1,21 +1,22 @@
PROG = LZMA.dll
DEF_FILE = ../Codec.def
-CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MF_MT -D_ST_MODE
+CFLAGS = $(CFLAGS) -I ../../../ \
+ -DCOMPRESS_MF_MT \
+ -D_7ZIP_LARGE_PAGES \
+
LIBS = $(LIBS) oleaut32.lib
-LZMA_OBJS = \
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
$O\DllExports.obj \
+COMMON_OBJS = \
+ $O\CRC.obj \
+
LZMA_OPT_OBJS = \
$O\LZMADecoder.obj \
$O\LZMAEncoder.obj \
-
-COMMON_OBJS = \
- $O\Alloc.obj \
- $O\CRC.obj \
-
-WIN_OBJS = \
- $O\Synchronization.obj
+ $O\LZMARegister.obj \
7ZIP_COMMON_OBJS = \
$O\InBuffer.obj \
@@ -26,37 +27,36 @@ LZ_OBJS = \
$O\LZOutWindow.obj \
C_OBJS = \
- $O\7zCrc.obj \
- $O\Sort.obj \
$O\Threads.obj \
+ $O\Alloc.obj \
C_LZ_OBJS = \
$O\MatchFinder.obj \
$O\MatchFinderMt.obj \
+!include "../../Crc2.mak"
+
OBJS = \
$O\StdAfx.obj \
- $(LZMA_OBJS) \
- $(LZMA_OPT_OBJS) \
+ $(COMPRESS_OBJS) \
$(COMMON_OBJS) \
- $(WIN_OBJS) \
+ $(LZMA_OPT_OBJS) \
$(7ZIP_COMMON_OBJS) \
$(LZ_OBJS) \
$(C_OBJS) \
$(C_LZ_OBJS) \
+ $(CRC_OBJS) \
$O\RangeCoderBit.obj \
$O\resource.res
!include "../../../Build.mak"
-$(LZMA_OBJS): $(*B).cpp
+$(COMPRESS_OBJS): ../$(*B).cpp
$(COMPL)
-$(LZMA_OPT_OBJS): $(*B).cpp
- $(COMPL_O2)
$(COMMON_OBJS): ../../../Common/$(*B).cpp
$(COMPL)
-$(WIN_OBJS): ../../../Windows/$(*B).cpp
- $(COMPL)
+$(LZMA_OPT_OBJS): $(*B).cpp
+ $(COMPL_O2)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
$(LZ_OBJS): ../LZ/$(*B).cpp
@@ -67,3 +67,4 @@ $(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
$(C_LZ_OBJS): ../../../../C/Compress/Lz/$(*B).c
$(COMPL_O2)
+!include "../../Crc.mak"
diff --git a/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp b/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp
index 6401206c..dbfa6b59 100755
--- a/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp
+++ b/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp
@@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "BENCH_MT" /FAcs /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "BENCH_MT" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -94,7 +94,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /Yu"StdAfx.h" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\\" /D "NDEBUG" /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "BENCH_MT" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -121,7 +121,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "EXCLUDE_COM" /D "NO_REGISTRY" /D "FORMAT_7Z" /D "FORMAT_BZIP2" /D "FORMAT_ZIP" /D "FORMAT_TAR" /D "FORMAT_GZIP" /D "COMPRESS_LZMA" /D "COMPRESS_BCJ_X86" /D "COMPRESS_BCJ2" /D "COMPRESS_COPY" /D "COMPRESS_MF_PAT" /D "COMPRESS_MF_BT" /D "COMPRESS_PPMD" /D "COMPRESS_DEFLATE" /D "COMPRESS_IMPLODE" /D "COMPRESS_BZIP2" /D "CRYPTO_ZIP" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MF_MT" /D "BENCH_MT" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -227,18 +227,22 @@ SOURCE=..\..\..\Windows\FileIO.cpp
SOURCE=..\..\..\Windows\FileIO.h
# End Source File
-# End Group
-# Begin Group "Common"
+# Begin Source File
-# PROP Default_Filter ""
+SOURCE=..\..\..\Windows\Synchronization.cpp
+# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Alloc.cpp
+SOURCE=..\..\..\Windows\Synchronization.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Alloc.h
+SOURCE=..\..\..\Windows\Thread.h
# End Source File
+# End Group
+# Begin Group "Common"
+
+# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\Common\CommandLineParser.cpp
@@ -253,10 +257,6 @@ SOURCE=..\..\..\Common\CRC.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\CRC.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\..\Common\Defs.h
# End Source File
# Begin Source File
@@ -367,6 +367,24 @@ SOURCE=..\..\..\..\C\Compress\Lz\MatchFinder.c
SOURCE=..\..\..\..\C\Compress\Lz\MatchFinder.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.h
+# End Source File
# End Group
# Begin Group "LZMA_C"
@@ -411,6 +429,19 @@ SOURCE=..\..\..\..\C\7zCrc.c
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
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Types.h
+# End Source File
# End Group
# Begin Source File
@@ -430,6 +461,14 @@ SOURCE=.\LzmaBench.h
# End Source File
# Begin Source File
+SOURCE=.\LzmaBenchCon.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\LzmaBenchCon.h
+# End Source File
+# Begin Source File
+
SOURCE=.\LzmaRam.cpp
# End Source File
# Begin Source File
diff --git a/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp b/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
index f5ad65da..69a06207 100755
--- a/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
+++ b/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
@@ -25,9 +25,13 @@
#include "../LZMA/LZMADecoder.h"
#include "../LZMA/LZMAEncoder.h"
-#include "LzmaBench.h"
+#include "LzmaBenchCon.h"
#include "LzmaRam.h"
+#ifdef COMPRESS_MF_MT
+#include "Windows/System.h"
+#endif
+
extern "C"
{
#include "LzmaRamDecode.h"
@@ -64,6 +68,7 @@ enum Enum
kLitPos,
kPosBits,
kMatchFinder,
+ kMultiThread,
kEOS,
kStdIn,
kStdOut,
@@ -83,6 +88,7 @@ static const CSwitchForm kSwitchForms[] =
{ L"LP", NSwitchType::kUnLimitedPostString, false, 1 },
{ L"PB", NSwitchType::kUnLimitedPostString, false, 1 },
{ L"MF", NSwitchType::kUnLimitedPostString, false, 1 },
+ { L"MT", NSwitchType::kUnLimitedPostString, false, 0 },
{ L"EOS", NSwitchType::kSimple, false },
{ L"SI", NSwitchType::kSimple, false },
{ L"SO", NSwitchType::kSimple, false },
@@ -106,6 +112,7 @@ static void PrintHelp()
" -lp{N}: set number of literal pos bits - [0, 4], default: 0\n"
" -pb{N}: set number of pos bits - [0, 4], default: 2\n"
" -mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, hc4], default: bt4\n"
+ " -mt{N}: set number of CPU threads\n"
" -eos: write End Of Stream marker\n"
" -si: read data from stdin\n"
" -so: write data to stdout\n"
@@ -152,7 +159,7 @@ int main2(int n, const char *args[])
g_IsNT = IsItWindowsNT();
#endif
- fprintf(stderr, "\nLZMA 4.44 Copyright (c) 1999-2006 Igor Pavlov 2006-12-26\n");
+ fprintf(stderr, "\nLZMA 4.45 Copyright (c) 1999-2007 Igor Pavlov 2007-04-03\n");
if (n == 1)
{
@@ -192,7 +199,7 @@ int main2(int n, const char *args[])
const UString &command = nonSwitchStrings[paramIndex++];
bool dictionaryIsDefined = false;
- UInt32 dictionary = 1 << 21;
+ UInt32 dictionary = (UInt32)-1;
if(parser[NKey::kDictionary].ThereIs)
{
UInt32 dicLog;
@@ -205,18 +212,36 @@ int main2(int n, const char *args[])
if (parser[NKey::kMatchFinder].ThereIs)
mf = parser[NKey::kMatchFinder].PostStrings[0];
+ UInt32 numThreads = (UInt32)-1;
+
+ #ifdef COMPRESS_MF_MT
+ if (parser[NKey::kMultiThread].ThereIs)
+ {
+ UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors();
+ const UString &s = parser[NKey::kMultiThread].PostStrings[0];
+ if (s.IsEmpty())
+ numThreads = numCPUs;
+ else
+ if (!GetNumber(s, numThreads))
+ IncorrectCommand();
+ }
+ #endif
+
if (command.CompareNoCase(L"b") == 0)
{
- const UInt32 kNumDefaultItereations = 10;
+ const UInt32 kNumDefaultItereations = 1;
UInt32 numIterations = kNumDefaultItereations;
{
if (paramIndex < nonSwitchStrings.Size())
if (!GetNumber(nonSwitchStrings[paramIndex++], numIterations))
numIterations = kNumDefaultItereations;
}
- return LzmaBenchmark(stderr, numIterations, dictionary);
+ return LzmaBenchCon(stderr, numIterations, numThreads, dictionary);
}
+ if (numThreads == (UInt32)-1)
+ numThreads = 1;
+
bool encodeMode = false;
if (command.CompareNoCase(L"e") == 0)
encodeMode = true;
@@ -393,41 +418,35 @@ int main2(int n, const char *args[])
NCoderPropID::kNumFastBytes,
NCoderPropID::kMatchFinder,
NCoderPropID::kEndMarker,
- NCoderPropID::kMatchFinderCycles
+ NCoderPropID::kNumThreads,
+ NCoderPropID::kMatchFinderCycles,
};
const int kNumPropsMax = sizeof(propIDs) / sizeof(propIDs[0]);
- /*
- NWindows::NCOM::CPropVariant properties[kNumProps];
- properties[0] = UInt32(dictionary);
- properties[1] = UInt32(posStateBits);
- properties[2] = UInt32(litContextBits);
-
- properties[3] = UInt32(litPosBits);
- properties[4] = UInt32(algorithm);
- properties[5] = UInt32(numFastBytes);
- properties[6] = mf;
- properties[7] = eos;
- */
+
PROPVARIANT properties[kNumPropsMax];
for (int p = 0; p < 6; p++)
properties[p].vt = VT_UI4;
- properties[0].ulVal = UInt32(dictionary);
- properties[1].ulVal = UInt32(posStateBits);
- properties[2].ulVal = UInt32(litContextBits);
- properties[3].ulVal = UInt32(litPosBits);
- properties[4].ulVal = UInt32(algorithm);
- properties[5].ulVal = UInt32(numFastBytes);
+ properties[0].ulVal = (UInt32)dictionary;
+ properties[1].ulVal = (UInt32)posStateBits;
+ properties[2].ulVal = (UInt32)litContextBits;
+ properties[3].ulVal = (UInt32)litPosBits;
+ properties[4].ulVal = (UInt32)algorithm;
+ properties[5].ulVal = (UInt32)numFastBytes;
- properties[8].vt = VT_UI4;
- properties[8].ulVal = UInt32(matchFinderCycles);
-
properties[6].vt = VT_BSTR;
properties[6].bstrVal = (BSTR)(const wchar_t *)mf;
properties[7].vt = VT_BOOL;
properties[7].boolVal = eos ? VARIANT_TRUE : VARIANT_FALSE;
+ properties[8].vt = VT_UI4;
+ properties[8].ulVal = (UInt32)numThreads;
+
+ // it must be last in property list
+ properties[9].vt = VT_UI4;
+ properties[9].ulVal = (UInt32)matchFinderCycles;
+
int numProps = kNumPropsMax;
if (!matchFinderCyclesDefined)
numProps--;
diff --git a/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp b/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp
index f9924165..e8816184 100755
--- a/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp
+++ b/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp
@@ -8,19 +8,32 @@
#include <time.h>
#endif
-#include "../../../Common/CRC.h"
-#include "../LZMA/LZMADecoder.h"
-#include "../LZMA/LZMAEncoder.h"
+#include <malloc.h>
+
+extern "C"
+{
+#include "../../../../C/Alloc.h"
+#include "../../../../C/7zCrc.h"
+}
+#include "../../../Common/MyCom.h"
+#include "../../ICoder.h"
-static const UInt32 kAdditionalSize =
-#ifdef _WIN32_WCE
-(1 << 20);
+#ifdef BENCH_MT
+#include "Windows/Thread.h"
+#include "Windows/Synchronization.h"
+#endif
+
+#ifdef EXTERNAL_LZMA
+#include "Windows/PropVariant.h"
#else
-(6 << 20);
+#include "../LZMA/LZMADecoder.h"
+#include "../LZMA/LZMAEncoder.h"
#endif
+static const UInt32 kUncompressMinBlockSize = 1 << 26;
+static const UInt32 kAdditionalSize = (1 << 16);
static const UInt32 kCompressedAdditionalSize = (1 << 10);
-static const UInt32 kMaxLzmaPropSize = 10;
+static const UInt32 kMaxLzmaPropSize = 5;
class CRandomGenerator
{
@@ -32,125 +45,98 @@ public:
UInt32 GetRnd()
{
return
- ((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) ^
+ ((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) +
((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)) );
}
};
-class CBitRandomGenerator
-{
- CRandomGenerator RG;
- UInt32 Value;
- int NumBits;
-public:
- void Init()
- {
- Value = 0;
- NumBits = 0;
- }
- UInt32 GetRnd(int numBits)
- {
- if (NumBits > numBits)
- {
- UInt32 result = Value & ((1 << numBits) - 1);
- Value >>= numBits;
- NumBits -= numBits;
- return result;
- }
- numBits -= NumBits;
- UInt32 result = (Value << numBits);
- Value = RG.GetRnd();
- result |= Value & ((1 << numBits) - 1);
- Value >>= numBits;
- NumBits = 32 - numBits;
- return result;
- }
-};
-
-class CBenchRandomGenerator
+class CBenchBuffer
{
- CBitRandomGenerator RG;
- UInt32 Pos;
- UInt32 Rep0;
public:
- UInt32 BufferSize;
+ size_t BufferSize;
Byte *Buffer;
- CBenchRandomGenerator(): Buffer(0) {}
- ~CBenchRandomGenerator() { Free(); }
+ CBenchBuffer(): Buffer(0) {}
+ virtual ~CBenchBuffer() { Free(); }
void Free()
{
::MidFree(Buffer);
Buffer = 0;
}
- bool Alloc(UInt32 bufferSize)
+ bool Alloc(size_t bufferSize)
{
if (Buffer != 0 && BufferSize == bufferSize)
return true;
Free();
Buffer = (Byte *)::MidAlloc(bufferSize);
- Pos = 0;
BufferSize = bufferSize;
return (Buffer != 0);
}
- UInt32 GetRndBit() { return RG.GetRnd(1); }
- /*
- UInt32 GetLogRand(int maxLen)
- {
- UInt32 len = GetRnd() % (maxLen + 1);
- return GetRnd() & ((1 << len) - 1);
- }
- */
- UInt32 GetLogRandBits(int numBits)
+};
+
+class CBenchRandomGenerator: public CBenchBuffer
+{
+ CRandomGenerator *RG;
+public:
+ void Set(CRandomGenerator *rg) { RG = rg; }
+ UInt32 GetVal(UInt32 &res, int numBits)
{
- UInt32 len = RG.GetRnd(numBits);
- return RG.GetRnd(len);
+ UInt32 val = res & (((UInt32)1 << numBits) - 1);
+ res >>= numBits;
+ return val;
}
- UInt32 GetOffset()
- {
- if (GetRndBit() == 0)
- return GetLogRandBits(4);
- return (GetLogRandBits(4) << 10) | RG.GetRnd(10);
+ UInt32 GetLen(UInt32 &res)
+ {
+ UInt32 len = GetVal(res, 2);
+ return GetVal(res, 1 + len);
}
- UInt32 GetLen1() { return RG.GetRnd(1 + (int)RG.GetRnd(2)); }
- UInt32 GetLen2() { return RG.GetRnd(2 + (int)RG.GetRnd(2)); }
void Generate()
{
- RG.Init();
- Rep0 = 1;
- while(Pos < BufferSize)
+ UInt32 pos = 0;
+ UInt32 rep0 = 1;
+ while (pos < BufferSize)
{
- if (GetRndBit() == 0 || Pos < 1)
- Buffer[Pos++] = (Byte)RG.GetRnd(8);
+ UInt32 res = RG->GetRnd();
+ res >>= 1;
+ if (GetVal(res, 1) == 0 || pos < 1024)
+ Buffer[pos++] = (Byte)(res & 0xFF);
else
{
UInt32 len;
- if (RG.GetRnd(3) == 0)
- len = 1 + GetLen1();
- else
+ len = 1 + GetLen(res);
+ if (GetVal(res, 3) != 0)
{
+ len += GetLen(res);
do
- Rep0 = GetOffset();
- while (Rep0 >= Pos);
- Rep0++;
- len = 2 + GetLen2();
+ {
+ UInt32 ppp = GetVal(res, 5) + 6;
+ res = RG->GetRnd();
+ if (ppp > 30)
+ continue;
+ rep0 = /* (1 << ppp) +*/ GetVal(res, ppp);
+ res = RG->GetRnd();
+ }
+ while (rep0 >= pos);
+ rep0++;
}
- for (UInt32 i = 0; i < len && Pos < BufferSize; i++, Pos++)
- Buffer[Pos] = Buffer[Pos - Rep0];
+
+ for (UInt32 i = 0; i < len && pos < BufferSize; i++, pos++)
+ Buffer[pos] = Buffer[pos - rep0];
}
}
}
};
+
class CBenchmarkInStream:
public ISequentialInStream,
public CMyUnknownImp
{
const Byte *Data;
- UInt32 Pos;
- UInt32 Size;
+ size_t Pos;
+ size_t Size;
public:
MY_UNKNOWN_IMP
- void Init(const Byte *data, UInt32 size)
+ void Init(const Byte *data, size_t size)
{
Data = data;
Size = size;
@@ -161,9 +147,12 @@ public:
STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
{
- UInt32 remain = Size - Pos;
+ size_t remain = Size - Pos;
+ UInt32 kMaxBlockSize = (1 << 20);
+ if (size > kMaxBlockSize)
+ size = kMaxBlockSize;
if (size > remain)
- size = remain;
+ size = (UInt32)remain;
for (UInt32 i = 0; i < size; i++)
((Byte *)data)[i] = Data[Pos + i];
Pos += size;
@@ -174,23 +163,17 @@ STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processed
class CBenchmarkOutStream:
public ISequentialOutStream,
+ public CBenchBuffer,
public CMyUnknownImp
{
- UInt32 BufferSize;
- FILE *_f;
+ // bool _overflow;
public:
UInt32 Pos;
- Byte *Buffer;
- CBenchmarkOutStream(): _f(0), Buffer(0) {}
- virtual ~CBenchmarkOutStream() { delete []Buffer; }
- void Init(FILE *f, UInt32 bufferSize)
+ // CBenchmarkOutStream(): _overflow(false) {}
+ void Init()
{
- delete []Buffer;
- Buffer = 0;
- Buffer = new Byte[bufferSize];
+ // _overflow = false;
Pos = 0;
- BufferSize = bufferSize;
- _f = f;
}
MY_UNKNOWN_IMP
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
@@ -198,14 +181,16 @@ public:
STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
- UInt32 i;
- for (i = 0; i < size && Pos < BufferSize; i++)
- Buffer[Pos++] = ((const Byte *)data)[i];
+ size_t curSize = BufferSize - Pos;
+ if (curSize > size)
+ curSize = size;
+ memcpy(Buffer + Pos, data, curSize);
+ Pos += (UInt32)curSize;
if(processedSize != NULL)
- *processedSize = i;
- if (i != size)
+ *processedSize = (UInt32)curSize;
+ if (curSize != size)
{
- fprintf(_f, "\nERROR: Buffer is full\n");
+ // _overflow = true;
return E_FAIL;
}
return S_OK;
@@ -216,16 +201,16 @@ class CCrcOutStream:
public CMyUnknownImp
{
public:
- CCRC CRC;
+ UInt32 Crc;
MY_UNKNOWN_IMP
- void Init() { CRC.Init(); }
+ void Init() { Crc = CRC_INIT_VAL; }
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
};
STDMETHODIMP CCrcOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
- CRC.Update(data, size);
- if(processedSize != NULL)
+ Crc = CrcUpdate(Crc, data, size);
+ if (processedSize != NULL)
*processedSize = size;
return S_OK;
}
@@ -233,9 +218,11 @@ STDMETHODIMP CCrcOutStream::Write(const void *data, UInt32 size, UInt32 *process
static UInt64 GetTimeCount()
{
#ifdef _WIN32
+ /*
LARGE_INTEGER value;
if (::QueryPerformanceCounter(&value))
return value.QuadPart;
+ */
return GetTickCount();
#else
return clock();
@@ -245,39 +232,115 @@ static UInt64 GetTimeCount()
static UInt64 GetFreq()
{
#ifdef _WIN32
+ /*
LARGE_INTEGER value;
if (::QueryPerformanceFrequency(&value))
return value.QuadPart;
+ */
return 1000;
#else
return CLOCKS_PER_SEC;
#endif
}
-struct CProgressInfo:
- public ICompressProgressInfo,
- public CMyUnknownImp
+UInt64 GetUserTime()
{
- UInt64 ApprovedStart;
- UInt64 InSize;
- UInt64 Time;
- void Init()
+ #ifdef _WIN32
+ FILETIME creationTime, exitTime, kernelTime, userTime;
+ ::GetProcessTimes(::GetCurrentProcess(), &creationTime, &exitTime, &kernelTime, &userTime);
+ return ((UInt64)userTime.dwHighDateTime << 32) | userTime.dwLowDateTime;
+ #else
+ return clock();
+ #endif
+}
+
+static UInt64 GetUserFreq()
+{
+ #ifdef _WIN32
+ return 10000000;
+ #else
+ return CLOCKS_PER_SEC;
+ #endif
+}
+
+class CBenchProgressStatus
+{
+ #ifdef BENCH_MT
+ NWindows::NSynchronization::CCriticalSection CS;
+ #endif
+public:
+ HRESULT Res;
+ bool EncodeMode;
+ void SetResult(HRESULT res)
+ {
+ #ifdef BENCH_MT
+ NWindows::NSynchronization::CCriticalSectionLock lock(CS);
+ #endif
+ Res = res;
+ }
+ HRESULT GetResult()
{
- InSize = 0;
- Time = 0;
+ #ifdef BENCH_MT
+ NWindows::NSynchronization::CCriticalSectionLock lock(CS);
+ #endif
+ return Res;
}
+};
+
+class CBenchProgressInfo:
+ public ICompressProgressInfo,
+ public CMyUnknownImp
+{
+public:
+ CBenchProgressStatus *Status;
+ CBenchInfo BenchInfo;
+ HRESULT Res;
+ IBenchCallback *callback;
+ CBenchProgressInfo(): callback(0) {}
MY_UNKNOWN_IMP
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
};
-STDMETHODIMP CProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 * /* outSize */)
+void SetStartTime(CBenchInfo &bi)
+{
+ bi.GlobalFreq = GetFreq();
+ bi.UserFreq = GetUserFreq();
+ bi.GlobalTime = ::GetTimeCount();
+ bi.UserTime = ::GetUserTime();
+}
+
+void SetFinishTime(const CBenchInfo &biStart, CBenchInfo &dest)
+{
+ dest.GlobalFreq = GetFreq();
+ dest.UserFreq = GetUserFreq();
+ dest.GlobalTime = ::GetTimeCount() - biStart.GlobalTime;
+ dest.UserTime = ::GetUserTime() - biStart.UserTime;
+}
+
+STDMETHODIMP CBenchProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
{
- if (*inSize >= ApprovedStart && InSize == 0)
+ HRESULT res = Status->GetResult();
+ if (res != S_OK)
+ return res;
+ if (!callback)
+ return res;
+ CBenchInfo info = BenchInfo;
+ SetFinishTime(BenchInfo, info);
+ if (Status->EncodeMode)
{
- Time = ::GetTimeCount();
- InSize = *inSize;
+ info.UnpackSize = *inSize;
+ info.PackSize = *outSize;
+ res = callback->SetEncodeResult(info, false);
}
- return S_OK;
+ else
+ {
+ info.PackSize = BenchInfo.PackSize + *inSize;
+ info.UnpackSize = BenchInfo.UnpackSize + *outSize;
+ res = callback->SetDecodeResult(info, false);
+ }
+ if (res != S_OK)
+ Status->SetResult(res);
+ return res;
}
static const int kSubBits = 8;
@@ -291,216 +354,623 @@ static UInt32 GetLogSize(UInt32 size)
return (32 << kSubBits);
}
-static UInt64 MyMultDiv64(UInt64 value, UInt64 elapsedTime)
+static void NormalizeVals(UInt64 &v1, UInt64 &v2)
{
- UInt64 freq = GetFreq();
- UInt64 elTime = elapsedTime;
- while(freq > 1000000)
+ while (v1 > 1000000)
{
- freq >>= 1;
- elTime >>= 1;
+ v1 >>= 1;
+ v2 >>= 1;
}
- if (elTime == 0)
- elTime = 1;
- return value * freq / elTime;
}
-static UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 size)
+UInt64 GetUsage(const CBenchInfo &info)
{
- UInt64 t = GetLogSize(dictionarySize) - (18 << kSubBits);
- UInt64 numCommandsForOne = 1060 + ((t * t * 10) >> (2 * kSubBits));
- UInt64 numCommands = (UInt64)(size) * numCommandsForOne;
- return MyMultDiv64(numCommands, elapsedTime);
+ UInt64 userTime = info.UserTime;
+ UInt64 userFreq = info.UserFreq;
+ UInt64 globalTime = info.GlobalTime;
+ UInt64 globalFreq = info.GlobalFreq;
+ NormalizeVals(userTime, userFreq);
+ NormalizeVals(globalFreq, globalTime);
+ if (userFreq == 0)
+ userFreq = 1;
+ if (globalTime == 0)
+ globalTime = 1;
+ return userTime * globalFreq * 1000000 / userFreq / globalTime;
}
-static UInt64 GetDecompressRating(UInt64 elapsedTime,
- UInt64 outSize, UInt64 inSize)
+UInt64 GetRatingPerUsage(const CBenchInfo &info, UInt64 rating)
{
- UInt64 numCommands = inSize * 220 + outSize * 20;
- return MyMultDiv64(numCommands, elapsedTime);
+ UInt64 userTime = info.UserTime;
+ UInt64 userFreq = info.UserFreq;
+ UInt64 globalTime = info.GlobalTime;
+ UInt64 globalFreq = info.GlobalFreq;
+ NormalizeVals(userFreq, userTime);
+ NormalizeVals(globalTime, globalFreq);
+ if (globalFreq == 0)
+ globalFreq = 1;
+ if (userTime == 0)
+ userTime = 1;
+ return userFreq * globalTime / globalFreq * rating / userTime;
}
-/*
-static UInt64 GetTotalRating(
- UInt32 dictionarySize,
- bool isBT4,
- UInt64 elapsedTimeEn, UInt64 sizeEn,
- UInt64 elapsedTimeDe,
- UInt64 inSizeDe, UInt64 outSizeDe)
+static UInt64 MyMultDiv64(UInt64 value, UInt64 elapsedTime, UInt64 freq)
{
- return (GetCompressRating(dictionarySize, isBT4, elapsedTimeEn, sizeEn) +
- GetDecompressRating(elapsedTimeDe, inSizeDe, outSizeDe)) / 2;
+ UInt64 elTime = elapsedTime;
+ NormalizeVals(freq, elTime);
+ if (elTime == 0)
+ elTime = 1;
+ return value * freq / elTime;
}
-*/
-static void PrintRating(FILE *f, UInt64 rating)
+UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 freq, UInt64 size)
{
- fprintf(f, "%5d MIPS", (unsigned int)(rating / 1000000));
-}
+ UInt64 t = GetLogSize(dictionarySize) - (kBenchMinDicLogSize << kSubBits);
+ // UInt64 numCommandsForOne = 1000 + ((t * t * 7) >> (2 * kSubBits)); // AMD K8
+ UInt64 numCommandsForOne = 870 + ((t * t * 5) >> (2 * kSubBits)); // Intel Core2
-static void PrintResults(
- FILE *f,
- UInt32 dictionarySize,
- UInt64 elapsedTime,
- UInt64 size,
- bool decompressMode, UInt64 secondSize)
-{
- UInt64 speed = MyMultDiv64(size, elapsedTime);
- fprintf(f, "%6d KB/s ", (unsigned int)(speed / 1024));
- UInt64 rating;
- if (decompressMode)
- rating = GetDecompressRating(elapsedTime, size, secondSize);
- else
- rating = GetCompressRating(dictionarySize, elapsedTime, size);
- PrintRating(f, rating);
+ UInt64 numCommands = (UInt64)(size) * numCommandsForOne;
+ return MyMultDiv64(numCommands, elapsedTime, freq);
}
-static void ThrowError(FILE *f, HRESULT result, const char *s)
+UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations)
{
- fprintf(f, "\nError: ");
- if (result == E_ABORT)
- fprintf(f, "User break");
- if (result == E_OUTOFMEMORY)
- fprintf(f, "Can not allocate memory");
- else
- fprintf(f, s);
- fprintf(f, "\n");
+ // UInt64 numCommands = (inSize * 216 + outSize * 14) * numIterations; // AMD K8
+ UInt64 numCommands = (inSize * 220 + outSize * 14) * numIterations; // Intel Core2
+ return MyMultDiv64(numCommands, elapsedTime, freq);
}
-const wchar_t *bt2 = L"BT2";
-const wchar_t *bt4 = L"BT4";
+#ifdef EXTERNAL_LZMA
+typedef UInt32 (WINAPI * CreateObjectPointer)(const GUID *clsID,
+ const GUID *interfaceID, void **outObject);
+#endif
+
+struct CEncoderInfo;
-int LzmaBenchmark(FILE *f, UInt32 numIterations, UInt32 dictionarySize)
+struct CEncoderInfo
{
- if (numIterations == 0)
+ #ifdef BENCH_MT
+ NWindows::CThread thread[2];
+ #endif
+ CMyComPtr<ICompressCoder> encoder;
+ CBenchProgressInfo *progressInfoSpec[2];
+ CMyComPtr<ICompressProgressInfo> progressInfo[2];
+ UInt32 NumIterations;
+ size_t AllocaSize;
+
+ struct CDecoderInfo
+ {
+ CEncoderInfo *Encoder;
+ UInt32 DecoderIndex;
+ size_t AllocaSize;
+ bool CallbackMode;
+ };
+ CDecoderInfo decodersInfo[2];
+
+ CMyComPtr<ICompressCoder> decoders[2];
+ HRESULT Results[2];
+ CBenchmarkOutStream *outStreamSpec;
+ CMyComPtr<ISequentialOutStream> outStream;
+ IBenchCallback *callback;
+ UInt32 crc;
+ UInt32 kBufferSize;
+ UInt32 compressedSize;
+ CBenchRandomGenerator rg;
+ CBenchmarkOutStream *propStreamSpec;
+ CMyComPtr<ISequentialOutStream> propStream;
+ HRESULT Init(UInt32 dictionarySize, UInt32 numThreads, CRandomGenerator *rg);
+ HRESULT Encode();
+ HRESULT Decode(UInt32 decoderIndex);
+
+ CEncoderInfo(): outStreamSpec(0), callback(0), propStreamSpec(0) {}
+
+ #ifdef BENCH_MT
+ static DWORD WINAPI EncodeThreadFunction(void *param)
+ {
+ CEncoderInfo *encoder = (CEncoderInfo *)param;
+ alloca(encoder->AllocaSize);
+ HRESULT res = encoder->Encode();
+ encoder->Results[0] = res;
+ if (res != S_OK)
+ encoder->progressInfoSpec[0]->Status->SetResult(res);
+
+ return 0;
+ }
+ static DWORD WINAPI DecodeThreadFunction(void *param)
+ {
+ CDecoderInfo *decoder = (CDecoderInfo *)param;
+ alloca(decoder->AllocaSize);
+ CEncoderInfo *encoder = decoder->Encoder;
+ encoder->Results[decoder->DecoderIndex] = encoder->Decode(decoder->DecoderIndex);
return 0;
- if (dictionarySize < (1 << 18))
+ }
+
+ HRESULT CreateEncoderThread(size_t allocaSize)
{
- fprintf(f, "\nError: dictionary size for benchmark must be >= 19 (512 KB)\n");
- return 1;
+ AllocaSize = allocaSize;
+ if (!thread[0].Create(EncodeThreadFunction, this))
+ return ::GetLastError();
+ return 0;
}
- fprintf(f, "\n Compressing Decompressing\n\n");
- NCompress::NLZMA::CEncoder *encoderSpec = new NCompress::NLZMA::CEncoder;
- CMyComPtr<ICompressCoder> encoder = encoderSpec;
- NCompress::NLZMA::CDecoder *decoderSpec = new NCompress::NLZMA::CDecoder;
- CMyComPtr<ICompressCoder> decoder = decoderSpec;
+ HRESULT CreateDecoderThread(int index, bool callbackMode, size_t allocaSize)
+ {
+ CDecoderInfo &decoder = decodersInfo[index];
+ decoder.DecoderIndex = index;
+ decoder.Encoder = this;
+ decoder.AllocaSize = allocaSize;
+ decoder.CallbackMode = callbackMode;
+ if (!thread[index].Create(DecodeThreadFunction, &decoder))
+ return ::GetLastError();
+ return 0;
+ }
+ #endif
+};
- CBenchmarkOutStream *propStreamSpec = new CBenchmarkOutStream;
- CMyComPtr<ISequentialOutStream> propStream = propStreamSpec;
- propStreamSpec->Init(f, kMaxLzmaPropSize);
+HRESULT CEncoderInfo::Init(UInt32 dictionarySize, UInt32 numThreads, CRandomGenerator *rgLoc)
+{
+ rg.Set(rgLoc);
+ kBufferSize = dictionarySize + kAdditionalSize;
+ UInt32 kCompressedBufferSize = (kBufferSize / 2) + kCompressedAdditionalSize;
+ if (!rg.Alloc(kBufferSize))
+ return E_OUTOFMEMORY;
+ rg.Generate();
+ crc = CrcCalc(rg.Buffer, rg.BufferSize);
+
+ outStreamSpec = new CBenchmarkOutStream;
+ if (!outStreamSpec->Alloc(kCompressedBufferSize))
+ return E_OUTOFMEMORY;
+
+ outStream = outStreamSpec;
+
+ propStreamSpec = 0;
+ if (!propStream)
+ {
+ propStreamSpec = new CBenchmarkOutStream;
+ propStream = propStreamSpec;
+ }
+ if (!propStreamSpec->Alloc(kMaxLzmaPropSize))
+ return E_OUTOFMEMORY;
+ propStreamSpec->Init();
PROPID propIDs[] =
{
- NCoderPropID::kDictionarySize
+ NCoderPropID::kDictionarySize,
+ NCoderPropID::kMultiThread
};
const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]);
PROPVARIANT properties[kNumProps];
properties[0].vt = VT_UI4;
- properties[0].ulVal = UInt32(dictionarySize);
+ properties[0].ulVal = (UInt32)dictionarySize;
- const UInt32 kBufferSize = dictionarySize + kAdditionalSize;
- const UInt32 kCompressedBufferSize = (kBufferSize / 2) + kCompressedAdditionalSize;
+ properties[1].vt = VT_BOOL;
+ properties[1].boolVal = (numThreads > 1) ? VARIANT_TRUE : VARIANT_FALSE;
- if (encoderSpec->SetCoderProperties(propIDs, properties, kNumProps) != S_OK)
{
- fprintf(f, "\nError: Incorrect command\n");
- return 1;
+ CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
+ RINOK(encoder.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties));
+ if (!setCoderProperties)
+ return E_FAIL;
+ RINOK(setCoderProperties->SetCoderProperties(propIDs, properties, kNumProps));
+
+ CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
+ encoder.QueryInterface(IID_ICompressWriteCoderProperties, &writeCoderProperties);
+ if (writeCoderProperties)
+ {
+ RINOK(writeCoderProperties->WriteCoderProperties(propStream));
+ }
}
- encoderSpec->WriteCoderProperties(propStream);
+ return S_OK;
+}
- CBenchRandomGenerator rg;
- if (!rg.Alloc(kBufferSize))
+HRESULT CEncoderInfo::Encode()
+{
+ CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
+ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
+ inStreamSpec->Init(rg.Buffer, rg.BufferSize);
+ outStreamSpec->Init();
+
+ RINOK(encoder->Code(inStream, outStream, 0, 0, progressInfo[0]));
+ compressedSize = outStreamSpec->Pos;
+ encoder.Release();
+ return S_OK;
+}
+
+HRESULT CEncoderInfo::Decode(UInt32 decoderIndex)
+{
+ CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
+ CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
+ CMyComPtr<ICompressCoder> &decoder = decoders[decoderIndex];
+
+ CMyComPtr<ICompressSetDecoderProperties2> compressSetDecoderProperties;
+ decoder.QueryInterface(IID_ICompressSetDecoderProperties2, &compressSetDecoderProperties);
+ if (!compressSetDecoderProperties)
+ return E_FAIL;
+
+ CCrcOutStream *crcOutStreamSpec = new CCrcOutStream;
+ CMyComPtr<ISequentialOutStream> crcOutStream = crcOutStreamSpec;
+
+ CBenchProgressInfo *pi = progressInfoSpec[decoderIndex];
+ pi->BenchInfo.UnpackSize = 0;
+ pi->BenchInfo.PackSize = 0;
+
+ for (UInt32 j = 0; j < NumIterations; j++)
{
- fprintf(f, "\nError: Can't allocate memory\n");
- return 1;
+ inStreamSpec->Init(outStreamSpec->Buffer, compressedSize);
+ crcOutStreamSpec->Init();
+
+ RINOK(compressSetDecoderProperties->SetDecoderProperties2(propStreamSpec->Buffer, propStreamSpec->Pos));
+ UInt64 outSize = kBufferSize;
+ RINOK(decoder->Code(inStream, crcOutStream, 0, &outSize, progressInfo[decoderIndex]));
+ if (CRC_GET_DIGEST(crcOutStreamSpec->Crc) != crc)
+ return S_FALSE;
+ pi->BenchInfo.UnpackSize += kBufferSize;
+ pi->BenchInfo.PackSize += compressedSize;
}
+ decoder.Release();
+ return S_OK;
+}
- rg.Generate();
- CCRC crc;
- crc.Update(rg.Buffer, rg.BufferSize);
+static const UInt32 kNumThreadsMax = (1 << 16);
+
+struct CBenchEncoders
+{
+ CEncoderInfo *encoders;
+ CBenchEncoders(UInt32 num): encoders(0) { encoders = new CEncoderInfo[num]; }
+ ~CBenchEncoders() { delete []encoders; }
+};
- CProgressInfo *progressInfoSpec = new CProgressInfo;
- CMyComPtr<ICompressProgressInfo> progressInfo = progressInfoSpec;
+HRESULT LzmaBench(
+ #ifdef EXTERNAL_LZMA
+ CCodecs *codecs,
+ #endif
+ UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback)
+{
+ UInt32 numEncoderThreads =
+ #ifdef BENCH_MT
+ (numThreads > 1 ? numThreads / 2 : 1);
+ #else
+ 1;
+ #endif
+ UInt32 numSubDecoderThreads =
+ #ifdef BENCH_MT
+ (numThreads > 1 ? 2 : 1);
+ #else
+ 1;
+ #endif
+ if (dictionarySize < (1 << kBenchMinDicLogSize) || numThreads < 1 || numEncoderThreads > kNumThreadsMax)
+ {
+ return E_INVALIDARG;
+ }
- progressInfoSpec->ApprovedStart = dictionarySize;
+ CBenchEncoders encodersSpec(numEncoderThreads);
+ CEncoderInfo *encoders = encodersSpec.encoders;
- UInt64 totalBenchSize = 0;
- UInt64 totalEncodeTime = 0;
- UInt64 totalDecodeTime = 0;
- UInt64 totalCompressedSize = 0;
+ #ifdef EXTERNAL_LZMA
+ UString name = L"LZMA";
+ #endif
- for (UInt32 i = 0; i < numIterations; i++)
+ UInt32 i;
+ for (i = 0; i < numEncoderThreads; i++)
{
- progressInfoSpec->Init();
- CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
- inStreamSpec->Init(rg.Buffer, rg.BufferSize);
- CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
- CBenchmarkOutStream *outStreamSpec = new CBenchmarkOutStream;
- outStreamSpec->Init(f, kCompressedBufferSize);
- CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
- HRESULT result = encoder->Code(inStream, outStream, 0, 0, progressInfo);
- UInt64 encodeTime = ::GetTimeCount() - progressInfoSpec->Time;
- UInt32 compressedSize = outStreamSpec->Pos;
- if(result != S_OK)
+ CEncoderInfo &encoder = encoders[i];
+ encoder.callback = (i == 0) ? callback : 0;
+
+ #ifdef EXTERNAL_LZMA
+ RINOK(codecs->CreateCoder(name, true, encoder.encoder));
+ #else
+ encoder.encoder = new NCompress::NLZMA::CEncoder;
+ #endif
+ for (UInt32 j = 0; j < numSubDecoderThreads; j++)
{
- ThrowError(f, result, "Encoder Error");
- return 1;
+ #ifdef EXTERNAL_LZMA
+ RINOK(codecs->CreateCoder(name, false, encoder.decoders[j]));
+ #else
+ encoder.decoders[j] = new NCompress::NLZMA::CDecoder;
+ #endif
}
- if (progressInfoSpec->InSize == 0)
+ }
+
+ CRandomGenerator rg;
+ rg.Init();
+ for (i = 0; i < numEncoderThreads; i++)
+ {
+ RINOK(encoders[i].Init(dictionarySize, numThreads, &rg));
+ }
+
+ CBenchProgressStatus status;
+ status.Res = S_OK;
+ status.EncodeMode = true;
+
+ for (i = 0; i < numEncoderThreads; i++)
+ {
+ CEncoderInfo &encoder = encoders[i];
+ for (int j = 0; j < 2; j++)
{
- fprintf(f, "\nError: Internal ERROR 1282\n");
- return 1;
+ encoder.progressInfo[j] = encoder.progressInfoSpec[j] = new CBenchProgressInfo;
+ encoder.progressInfoSpec[j]->Status = &status;
}
-
- ///////////////////////
- // Decompressing
-
- CCrcOutStream *crcOutStreamSpec = new CCrcOutStream;
- CMyComPtr<ISequentialOutStream> crcOutStream = crcOutStreamSpec;
-
- UInt64 decodeTime = 0;
- for (int j = 0; j < 2; j++)
+ if (i == 0)
{
- inStreamSpec->Init(outStreamSpec->Buffer, compressedSize);
- crcOutStreamSpec->Init();
-
- if (decoderSpec->SetDecoderProperties2(propStreamSpec->Buffer, propStreamSpec->Pos) != S_OK)
- {
- fprintf(f, "\nError: Set Decoder Properties Error\n");
- return 1;
- }
- UInt64 outSize = kBufferSize;
- UInt64 startTime = ::GetTimeCount();
- result = decoder->Code(inStream, crcOutStream, 0, &outSize, 0);
- decodeTime = ::GetTimeCount() - startTime;
- if(result != S_OK)
+ encoder.progressInfoSpec[0]->callback = callback;
+ encoder.progressInfoSpec[0]->BenchInfo.NumIterations = numEncoderThreads;
+ SetStartTime(encoder.progressInfoSpec[0]->BenchInfo);
+ }
+
+ #ifdef BENCH_MT
+ if (numEncoderThreads > 1)
+ {
+ size_t allocaSize = (i * 16 * 21) & 0x7FF;
+ RINOK(encoder.CreateEncoderThread(allocaSize))
+ }
+ else
+ #endif
+ {
+ RINOK(encoder.Encode());
+ }
+ }
+ #ifdef BENCH_MT
+ if (numEncoderThreads > 1)
+ for (i = 0; i < numEncoderThreads; i++)
+ encoders[i].thread[0].Wait();
+ #endif
+
+ RINOK(status.Res);
+
+ CBenchInfo info;
+
+ SetFinishTime(encoders[0].progressInfoSpec[0]->BenchInfo, info);
+ info.UnpackSize = 0;
+ info.PackSize = 0;
+ info.NumIterations = 1; // progressInfoSpec->NumIterations;
+ for (i = 0; i < numEncoderThreads; i++)
+ {
+ CEncoderInfo &encoder = encoders[i];
+ info.UnpackSize += encoder.kBufferSize;
+ info.PackSize += encoder.compressedSize;
+ }
+ RINOK(callback->SetEncodeResult(info, true));
+
+
+ status.Res = S_OK;
+ status.EncodeMode = false;
+
+ UInt32 numDecoderThreads = numEncoderThreads * numSubDecoderThreads;
+ for (i = 0; i < numEncoderThreads; i++)
+ {
+ CEncoderInfo &encoder = encoders[i];
+ encoder.NumIterations = 2 + kUncompressMinBlockSize / encoder.kBufferSize;
+
+ if (i == 0)
+ {
+ encoder.progressInfoSpec[0]->callback = callback;
+ encoder.progressInfoSpec[0]->BenchInfo.NumIterations = numDecoderThreads;
+ SetStartTime(encoder.progressInfoSpec[0]->BenchInfo);
+ }
+
+ #ifdef BENCH_MT
+ if (numDecoderThreads > 1)
+ {
+ for (UInt32 j = 0; j < numSubDecoderThreads; j++)
{
- ThrowError(f, result, "Decode Error");
- return 1;
+ size_t allocaSize = ((i * numSubDecoderThreads + j) * 16 * 21) & 0x7FF;
+ RINOK(encoder.CreateDecoderThread(j, (i == 0 && j == 0), allocaSize))
}
- if (crcOutStreamSpec->CRC.GetDigest() != crc.GetDigest())
+ }
+ else
+ #endif
+ {
+ RINOK(encoder.Decode(0));
+ }
+ }
+ #ifdef BENCH_MT
+ HRESULT res = S_OK;
+ if (numDecoderThreads > 1)
+ for (i = 0; i < numEncoderThreads; i++)
+ for (UInt32 j = 0; j < numSubDecoderThreads; j++)
{
- fprintf(f, "\nError: CRC Error\n");
- return 1;
+ CEncoderInfo &encoder = encoders[i];
+ encoder.thread[j].Wait();
+ if (encoder.Results[j] != S_OK)
+ res = encoder.Results[j];
}
- }
- UInt64 benchSize = kBufferSize - progressInfoSpec->InSize;
- PrintResults(f, dictionarySize, encodeTime, benchSize, false, 0);
- fprintf(f, " ");
- PrintResults(f, dictionarySize, decodeTime, kBufferSize, true, compressedSize);
- fprintf(f, "\n");
-
- totalBenchSize += benchSize;
- totalEncodeTime += encodeTime;
- totalDecodeTime += decodeTime;
- totalCompressedSize += compressedSize;
- }
- fprintf(f, "---------------------------------------------------\n");
- PrintResults(f, dictionarySize, totalEncodeTime, totalBenchSize, false, 0);
- fprintf(f, " ");
- PrintResults(f, dictionarySize, totalDecodeTime,
- kBufferSize * numIterations, true, totalCompressedSize);
- fprintf(f, " Average\n");
+ RINOK(res);
+ #endif
+ RINOK(status.Res);
+ SetFinishTime(encoders[0].progressInfoSpec[0]->BenchInfo, info);
+ info.UnpackSize = 0;
+ info.PackSize = 0;
+ info.NumIterations = numSubDecoderThreads * encoders[0].NumIterations;
+ for (i = 0; i < numEncoderThreads; i++)
+ {
+ CEncoderInfo &encoder = encoders[i];
+ info.UnpackSize += encoder.kBufferSize;
+ info.PackSize += encoder.compressedSize;
+ }
+ RINOK(callback->SetDecodeResult(info, false));
+ RINOK(callback->SetDecodeResult(info, true));
+ return S_OK;
+}
+
+
+inline UInt64 GetLZMAUsage(bool multiThread, UInt32 dictionary)
+{
+ UInt32 hs = dictionary - 1;
+ hs |= (hs >> 1);
+ hs |= (hs >> 2);
+ hs |= (hs >> 4);
+ hs |= (hs >> 8);
+ hs >>= 1;
+ hs |= 0xFFFF;
+ if (hs > (1 << 24))
+ hs >>= 1;
+ hs++;
+ return ((hs + (1 << 16)) + (UInt64)dictionary * 2) * 4 + (UInt64)dictionary * 3 / 2 +
+ (1 << 20) + (multiThread ? (6 << 20) : 0);
+}
+
+UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary)
+{
+ const UInt32 kBufferSize = dictionary;
+ const UInt32 kCompressedBufferSize = (kBufferSize / 2);
+ UInt32 numSubThreads = (numThreads > 1) ? 2 : 1;
+ UInt32 numBigThreads = numThreads / numSubThreads;
+ return (kBufferSize + kCompressedBufferSize +
+ GetLZMAUsage((numThreads > 1), dictionary) + (2 << 20)) * numBigThreads;
+}
+
+static bool CrcBig(const void *data, UInt32 size, UInt32 numCycles, UInt32 crcBase)
+{
+ for (UInt32 i = 0; i < numCycles; i++)
+ if (CrcCalc(data, size) != crcBase)
+ return false;
+ return true;
+}
+
+#ifdef BENCH_MT
+struct CCrcInfo
+{
+ NWindows::CThread Thread;
+ const Byte *Data;
+ UInt32 Size;
+ UInt32 NumCycles;
+ UInt32 Crc;
+ bool Res;
+ void Wait()
+ {
+ Thread.Wait();
+ Thread.Close();
+ }
+};
+
+static DWORD WINAPI CrcThreadFunction(void *param)
+{
+ CCrcInfo *p = (CCrcInfo *)param;
+ p->Res = CrcBig(p->Data, p->Size, p->NumCycles, p->Crc);
return 0;
}
+
+struct CCrcThreads
+{
+ UInt32 NumThreads;
+ CCrcInfo *Items;
+ CCrcThreads(): Items(0), NumThreads(0) {}
+ void WaitAll()
+ {
+ for (UInt32 i = 0; i < NumThreads; i++)
+ Items[i].Wait();
+ NumThreads = 0;
+ }
+ ~CCrcThreads()
+ {
+ WaitAll();
+ delete []Items;
+ }
+};
+#endif
+
+static UInt32 CrcCalc1(const Byte *buf, UInt32 size)
+{
+ UInt32 crc = CRC_INIT_VAL;;
+ for (UInt32 i = 0; i < size; i++)
+ crc = CRC_UPDATE_BYTE(crc, buf[i]);
+ return CRC_GET_DIGEST(crc);
+}
+
+static void RandGen(Byte *buf, UInt32 size, CRandomGenerator &RG)
+{
+ for (UInt32 i = 0; i < size; i++)
+ buf[i] = (Byte)RG.GetRnd();
+}
+
+static UInt32 RandGenCrc(Byte *buf, UInt32 size, CRandomGenerator &RG)
+{
+ RandGen(buf, size, RG);
+ return CrcCalc1(buf, size);
+}
+
+bool CrcInternalTest()
+{
+ CBenchBuffer buffer;
+ const UInt32 kBufferSize0 = (1 << 8);
+ const UInt32 kBufferSize1 = (1 << 10);
+ const UInt32 kCheckSize = (1 << 5);
+ if (!buffer.Alloc(kBufferSize0 + kBufferSize1))
+ return false;
+ Byte *buf = buffer.Buffer;
+ UInt32 i;
+ for (i = 0; i < kBufferSize0; i++)
+ buf[i] = (Byte)i;
+ UInt32 crc1 = CrcCalc1(buf, kBufferSize0);
+ if (crc1 != 0x29058C73)
+ return false;
+ CRandomGenerator RG;
+ RandGen(buf + kBufferSize0, kBufferSize1, RG);
+ for (i = 0; i < kBufferSize0 + kBufferSize1 - kCheckSize; i++)
+ for (UInt32 j = 0; j < kCheckSize; j++)
+ if (CrcCalc1(buf + i, j) != CrcCalc(buf + i, j))
+ return false;
+ return true;
+}
+
+HRESULT CrcBench(UInt32 numThreads, UInt32 bufferSize, UInt64 &speed)
+{
+ if (numThreads == 0)
+ numThreads = 1;
+
+ CBenchBuffer buffer;
+ size_t totalSize = (size_t)bufferSize * numThreads;
+ if (totalSize / numThreads != bufferSize)
+ return E_OUTOFMEMORY;
+ if (!buffer.Alloc(totalSize))
+ return E_OUTOFMEMORY;
+
+ Byte *buf = buffer.Buffer;
+ CRandomGenerator RG;
+ UInt32 numCycles = ((UInt32)1 << 30) / ((bufferSize >> 2) + 1) + 1;
+
+ UInt64 timeVal;
+ #ifdef BENCH_MT
+ CCrcThreads threads;
+ if (numThreads > 1)
+ {
+ threads.Items = new CCrcInfo[numThreads];
+ UInt32 i;
+ for (i = 0; i < numThreads; i++)
+ {
+ CCrcInfo &info = threads.Items[i];
+ Byte *data = buf + (size_t)bufferSize * i;
+ info.Data = data;
+ info.NumCycles = numCycles;
+ info.Size = bufferSize;
+ info.Crc = RandGenCrc(data, bufferSize, RG);
+ }
+ timeVal = GetTimeCount();
+ for (i = 0; i < numThreads; i++)
+ {
+ CCrcInfo &info = threads.Items[i];
+ if (!info.Thread.Create(CrcThreadFunction, &info))
+ return ::GetLastError();
+ threads.NumThreads++;
+ }
+ threads.WaitAll();
+ for (i = 0; i < numThreads; i++)
+ if (!threads.Items[i].Res)
+ return S_FALSE;
+ }
+ else
+ #endif
+ {
+ UInt32 crc = RandGenCrc(buf, bufferSize, RG);
+ timeVal = GetTimeCount();
+ if (!CrcBig(buf, bufferSize, numCycles, crc))
+ return S_FALSE;
+ }
+ timeVal = GetTimeCount() - timeVal;
+ if (timeVal == 0)
+ timeVal = 1;
+
+ UInt64 size = (UInt64)numCycles * totalSize;
+ speed = MyMultDiv64(size, timeVal, GetFreq());
+ return S_OK;
+}
+
diff --git a/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h b/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h
index a6a0e82e..d57e7977 100755
--- a/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h
+++ b/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h
@@ -1,11 +1,48 @@
// LzmaBench.h
-#ifndef __LzmaBench_h
-#define __LzmaBench_h
+#ifndef __LZMABENCH_H
+#define __LZMABENCH_H
#include <stdio.h>
#include "../../../Common/Types.h"
+#ifdef EXTERNAL_LZMA
+#include "../../UI/Common/LoadCodecs.h"
+#endif
+
+struct CBenchInfo
+{
+ UInt64 GlobalTime;
+ UInt64 GlobalFreq;
+ UInt64 UserTime;
+ UInt64 UserFreq;
+ UInt64 UnpackSize;
+ UInt64 PackSize;
+ UInt32 NumIterations;
+ CBenchInfo(): NumIterations(0) {}
+};
+
+struct IBenchCallback
+{
+ virtual HRESULT SetEncodeResult(const CBenchInfo &info, bool final) = 0;
+ virtual HRESULT SetDecodeResult(const CBenchInfo &info, bool final) = 0;
+};
+
+UInt64 GetUsage(const CBenchInfo &benchOnfo);
+UInt64 GetRatingPerUsage(const CBenchInfo &info, UInt64 rating);
+UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 freq, UInt64 size);
+UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations);
+
+HRESULT LzmaBench(
+ #ifdef EXTERNAL_LZMA
+ CCodecs *codecs,
+ #endif
+ UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback);
+
+const int kBenchMinDicLogSize = 18;
+
+UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary);
-int LzmaBenchmark(FILE *f, UInt32 numIterations, UInt32 dictionarySize);
+bool CrcInternalTest();
+HRESULT CrcBench(UInt32 numThreads, UInt32 bufferSize, UInt64 &speed);
#endif
diff --git a/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp b/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp
new file mode 100755
index 00000000..669cbf98
--- /dev/null
+++ b/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp
@@ -0,0 +1,298 @@
+// LzmaBenchCon.cpp
+
+#include "StdAfx.h"
+
+#include <stdio.h>
+
+#include "LzmaBench.h"
+#include "LzmaBenchCon.h"
+
+#if defined(BENCH_MT) || defined(_WIN32)
+#include "Windows/System.h"
+#endif
+
+#ifdef BREAK_HANDLER
+#include "../../UI/Console/ConsoleClose.h"
+#endif
+#include "../../../Common/MyCom.h"
+
+struct CTotalBenchRes
+{
+ UInt64 NumIterations;
+ UInt64 Rating;
+ UInt64 Usage;
+ UInt64 RPU;
+ void Init() { NumIterations = 0; Rating = 0; Usage = 0; RPU = 0; }
+ void Normalize()
+ {
+ if (NumIterations == 0)
+ return;
+ Rating /= NumIterations;
+ Usage /= NumIterations;
+ RPU /= NumIterations;
+ NumIterations = 1;
+ }
+ void SetMid(const CTotalBenchRes &r1, const CTotalBenchRes &r2)
+ {
+ Rating = (r1.Rating + r2.Rating) / 2;
+ Usage = (r1.Usage + r2.Usage) / 2;
+ RPU = (r1.RPU + r2.RPU) / 2;
+ NumIterations = (r1.NumIterations + r2.NumIterations) / 2;
+ }
+};
+
+struct CBenchCallback: public IBenchCallback
+{
+ CTotalBenchRes EncodeRes;
+ CTotalBenchRes DecodeRes;
+ FILE *f;
+ void Init() { EncodeRes.Init(); DecodeRes.Init(); }
+ void Normalize() { EncodeRes.Normalize(); DecodeRes.Normalize(); }
+ UInt32 dictionarySize;
+ HRESULT SetEncodeResult(const CBenchInfo &info, bool final);
+ HRESULT SetDecodeResult(const CBenchInfo &info, bool final);
+};
+
+static void NormalizeVals(UInt64 &v1, UInt64 &v2)
+{
+ while (v1 > 1000000)
+ {
+ v1 >>= 1;
+ v2 >>= 1;
+ }
+}
+
+static UInt64 MyMultDiv64(UInt64 value, UInt64 elapsedTime, UInt64 freq)
+{
+ UInt64 elTime = elapsedTime;
+ NormalizeVals(freq, elTime);
+ if (elTime == 0)
+ elTime = 1;
+ return value * freq / elTime;
+}
+
+static void PrintRating(FILE *f, UInt64 rating)
+{
+ fprintf(f, " %6d", (unsigned int)(rating / 1000000));
+}
+
+static void PrintResults(FILE *f, UInt64 usage, UInt64 rpu, UInt64 rating)
+{
+ fprintf(f, " %5d", (usage + 5000) / 10000);
+ PrintRating(f, rpu);
+ PrintRating(f, rating);
+}
+
+
+static void PrintResults(FILE *f, const CBenchInfo &info, UInt64 rating, CTotalBenchRes &res)
+{
+ UInt64 speed = MyMultDiv64(info.UnpackSize, info.GlobalTime, info.GlobalFreq);
+ fprintf(f, "%7d", (unsigned int)(speed / 1024));
+ UInt64 usage = GetUsage(info);
+ UInt64 rpu = GetRatingPerUsage(info, rating);
+ PrintResults(f, usage, rpu, rating);
+ res.NumIterations++;
+ res.RPU += rpu;
+ res.Rating += rating;
+ res.Usage += usage;
+}
+
+static void PrintTotals(FILE *f, const CTotalBenchRes &res)
+{
+ fprintf(f, " ");
+ PrintResults(f, res.Usage, res.RPU, res.Rating);
+}
+
+
+HRESULT CBenchCallback::SetEncodeResult(const CBenchInfo &info, bool final)
+{
+ #ifdef BREAK_HANDLER
+ if (NConsoleClose::TestBreakSignal())
+ return E_ABORT;
+ #endif
+
+ if (final)
+ {
+ UInt64 rating = GetCompressRating(dictionarySize, info.GlobalTime, info.GlobalFreq, info.UnpackSize);
+ PrintResults(f, info, rating, EncodeRes);
+ }
+ return S_OK;
+}
+
+static const char *kSep = " | ";
+
+
+HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
+{
+ #ifdef BREAK_HANDLER
+ if (NConsoleClose::TestBreakSignal())
+ return E_ABORT;
+ #endif
+ if (final)
+ {
+ UInt64 rating = GetDecompressRating(info.GlobalTime, info.GlobalFreq, info.UnpackSize, info.PackSize, info.NumIterations);
+ fprintf(f, kSep);
+ CBenchInfo info2 = info;
+ info2.GlobalTime /= info.NumIterations;
+ info2.UserTime /= info.NumIterations;
+ PrintResults(f, info2, rating, DecodeRes);
+ }
+ return S_OK;
+}
+
+static void PtintRequirements(FILE *f, const char *sizeString, UInt64 size, const char *threadsString, UInt32 numThreads)
+{
+ fprintf(f, "\nRAM %s %5d MB, # %s %3d", sizeString,
+ (unsigned int)(size >> 20), threadsString, (unsigned int)numThreads);
+}
+
+HRESULT LzmaBenchCon(
+ #ifdef EXTERNAL_LZMA
+ CCodecs *codecs,
+ #endif
+ FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary)
+{
+ if (!CrcInternalTest())
+ return S_FALSE;
+ #ifdef BENCH_MT
+ UInt64 ramSize = NWindows::NSystem::GetRamSize(); //
+ UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors();
+ PtintRequirements(f, "size: ", ramSize, "CPU hardware threads:", numCPUs);
+ if (numThreads == (UInt32)-1)
+ numThreads = numCPUs;
+ if (numThreads > 1)
+ numThreads &= ~1;
+ if (dictionary == (UInt32)-1)
+ {
+ int dicSizeLog;
+ for (dicSizeLog = 25; dicSizeLog > kBenchMinDicLogSize; dicSizeLog--)
+ if (GetBenchMemoryUsage(numThreads, ((UInt32)1 << dicSizeLog)) + (8 << 20) <= ramSize)
+ break;
+ dictionary = (1 << dicSizeLog);
+ }
+ #else
+ if (dictionary == (UInt32)-1)
+ dictionary = (1 << 22);
+ numThreads = 1;
+ #endif
+
+ PtintRequirements(f, "usage:", GetBenchMemoryUsage(numThreads, dictionary), "Benchmark threads: ", numThreads);
+
+ CBenchCallback callback;
+ callback.Init();
+ callback.f = f;
+
+ fprintf(f, "\n\nDict Compressing | Decompressing\n ");
+ int j;
+ for (j = 0; j < 2; j++)
+ {
+ fprintf(f, " Speed Usage R/U Rating");
+ if (j == 0)
+ fprintf(f, kSep);
+ }
+ fprintf(f, "\n ");
+ for (j = 0; j < 2; j++)
+ {
+ fprintf(f, " KB/s %% MIPS MIPS");
+ if (j == 0)
+ fprintf(f, kSep);
+ }
+ fprintf(f, "\n\n");
+ for (UInt32 i = 0; i < numIterations; i++)
+ {
+ const int kStartDicLog = 22;
+ int pow = (dictionary < ((UInt32)1 << kStartDicLog)) ? kBenchMinDicLogSize : kStartDicLog;
+ while (((UInt32)1 << pow) > dictionary)
+ pow--;
+ for (; ((UInt32)1 << pow) <= dictionary; pow++)
+ {
+ fprintf(f, "%2d: ", pow);
+ callback.dictionarySize = (UInt32)1 << pow;
+ HRESULT res = LzmaBench(
+ #ifdef EXTERNAL_LZMA
+ codecs,
+ #endif
+ numThreads, callback.dictionarySize, &callback);
+ fprintf(f, "\n");
+ RINOK(res);
+ }
+ }
+ callback.Normalize();
+ fprintf(f, "----------------------------------------------------------------\nAvr:");
+ PrintTotals(f, callback.EncodeRes);
+ fprintf(f, " ");
+ PrintTotals(f, callback.DecodeRes);
+ fprintf(f, "\nTot:");
+ CTotalBenchRes midRes;
+ midRes.SetMid(callback.EncodeRes, callback.DecodeRes);
+ PrintTotals(f, midRes);
+ fprintf(f, "\n");
+ return S_OK;
+}
+
+struct CTempValues
+{
+ UInt64 *Values;
+ CTempValues(UInt32 num) { Values = new UInt64[num]; }
+ ~CTempValues() { delete []Values; }
+};
+
+HRESULT CrcBenchCon(FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary)
+{
+ if (!CrcInternalTest())
+ return S_FALSE;
+
+ #ifdef BENCH_MT
+ UInt64 ramSize = NWindows::NSystem::GetRamSize();
+ UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors();
+ PtintRequirements(f, "size: ", ramSize, "CPU hardware threads:", numCPUs);
+ if (numThreads == (UInt32)-1)
+ numThreads = numCPUs;
+ #else
+ numThreads = 1;
+ #endif
+ if (dictionary == (UInt32)-1)
+ dictionary = (1 << 24);
+
+ CTempValues speedTotals(numThreads);
+ fprintf(f, "\n\nSize");
+ for (UInt32 ti = 0; ti < numThreads; ti++)
+ {
+ fprintf(f, " %5d", ti + 1);
+ speedTotals.Values[ti] = 0;
+ }
+ fprintf(f, "\n\n");
+
+ UInt64 numSteps = 0;
+ for (UInt32 i = 0; i < numIterations; i++)
+ {
+ for (int pow = 10; pow < 32; pow++)
+ {
+ UInt32 bufSize = (UInt32)1 << pow;
+ if (bufSize > dictionary)
+ break;
+ fprintf(f, "%2d: ", pow);
+ UInt64 speed;
+ for (UInt32 ti = 0; ti < numThreads; ti++)
+ {
+ #ifdef BREAK_HANDLER
+ if (NConsoleClose::TestBreakSignal())
+ return E_ABORT;
+ #endif
+ RINOK(CrcBench(ti + 1, bufSize, speed));
+ fprintf(f, " %5d", (unsigned int)(speed >> 20));
+ speedTotals.Values[ti] += speed;
+ }
+ fprintf(f, "\n");
+ numSteps++;
+ }
+ }
+ if (numSteps != 0)
+ {
+ fprintf(f, "\nAvg:");
+ for (UInt32 ti = 0; ti < numThreads; ti++)
+ fprintf(f, " %5d", (unsigned int)((speedTotals.Values[ti] / numSteps) >> 20));
+ fprintf(f, "\n");
+ }
+ return S_OK;
+}
diff --git a/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h b/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h
new file mode 100755
index 00000000..ea8539d1
--- /dev/null
+++ b/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h
@@ -0,0 +1,20 @@
+// LzmaBenchCon.h
+
+#ifndef __LZMABENCHCON_H
+#define __LZMABENCHCON_H
+
+#include <stdio.h>
+#include "../../../Common/Types.h"
+#ifdef EXTERNAL_LZMA
+#include "../../UI/Common/LoadCodecs.h"
+#endif
+HRESULT LzmaBenchCon(
+ #ifdef EXTERNAL_LZMA
+ CCodecs *codecs,
+ #endif
+ FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary);
+
+HRESULT CrcBenchCon(FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary);
+
+#endif
+
diff --git a/CPP/7zip/Compress/LZMA_Alone/makefile b/CPP/7zip/Compress/LZMA_Alone/makefile
index d3d80d88..a41a3c53 100755
--- a/CPP/7zip/Compress/LZMA_Alone/makefile
+++ b/CPP/7zip/Compress/LZMA_Alone/makefile
@@ -1,5 +1,8 @@
PROG = lzma.exe
-CFLAGS = $(CFLAGS) -I ../../../
+CFLAGS = $(CFLAGS) -I ../../../ \
+ -DCOMPRESS_MF_MT \
+ -DBENCH_MT \
+
LIBS = $(LIBS) oleaut32.lib user32.lib
!IFDEF CPU
@@ -23,8 +26,7 @@ CFLAGS = $(CFLAGS) -MT
CFLAGS = $(CFLAGS) -MD
!ENDIF
-
-CFLAGS = $(CFLAGS) -nologo -EHsc -c -Fo$O/ -WX
+CFLAGS = $(CFLAGS) -nologo -EHsc -c -Fo$O/
CFLAGS_O1 = $(CFLAGS) -O1
CFLAGS_O2 = $(CFLAGS) -O2
@@ -40,6 +42,7 @@ COMPL = $(CPP) $(CFLAGS_O1) $**
LZMA_OBJS = \
$O\LzmaAlone.obj \
$O\LzmaBench.obj \
+ $O\LzmaBenchCon.obj \
$O\LzmaRam.obj \
LZMA_OPT_OBJS = \
@@ -47,9 +50,8 @@ LZMA_OPT_OBJS = \
$O\LZMAEncoder.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
- $O\CRC.obj \
$O\CommandLineParser.obj \
+ $O\CRC.obj \
$O\String.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
@@ -64,10 +66,13 @@ LZ_OBJS = \
$O\LZOutWindow.obj \
C_OBJS = \
+ $O\Alloc.obj \
$O\7zCrc.obj \
+ $O\Threads.obj \
C_LZ_OBJS = \
$O\MatchFinder.obj \
+ $O\MatchFinderMt.obj \
OBJS = \
$(LZMA_OBJS) \
diff --git a/CPP/7zip/Compress/LZMA_Alone/makefile.gcc b/CPP/7zip/Compress/LZMA_Alone/makefile.gcc
index b83717a5..0c52cdc8 100755
--- a/CPP/7zip/Compress/LZMA_Alone/makefile.gcc
+++ b/CPP/7zip/Compress/LZMA_Alone/makefile.gcc
@@ -8,6 +8,7 @@ CFLAGS = -c -I ../../../
OBJS = \
LzmaAlone.o \
LzmaBench.o \
+ LzmaBenchCon.o \
LzmaRam.o \
LzmaRamDecode.o \
LzmaDecode.o \
@@ -43,6 +44,9 @@ LzmaAlone.o: LzmaAlone.cpp
LzmaBench.o: LzmaBench.cpp
$(CXX) $(CFLAGS) LzmaBench.cpp
+LzmaBenchCon.o: LzmaBenchCon.cpp
+ $(CXX) $(CFLAGS) LzmaBenchCon.cpp
+
LzmaRam.o: LzmaRam.cpp
$(CXX) $(CFLAGS) LzmaRam.cpp
@@ -67,6 +71,10 @@ MatchFinder.o: ../../../../C/Compress/Lz/MatchFinder.c
7zCrc.o: ../../../../C/7zCrc.c
$(CXX_C) $(CFLAGS) ../../../../C/7zCrc.c
+Alloc.o: ../../../../Alloc.cpp
+ $(CXX) $(CFLAGS) ../../../../Alloc.c
+
+
LZOutWindow.o: ../LZ/LZOutWindow.cpp
$(CXX) $(CFLAGS) ../LZ/LZOutWindow.cpp
@@ -85,9 +93,6 @@ FileStreams.o: ../../Common/FileStreams.cpp
StreamUtils.o: ../../Common/StreamUtils.cpp
$(CXX) $(CFLAGS) ../../Common/StreamUtils.cpp
-Alloc.o: ../../../Common/Alloc.cpp
- $(CXX) $(CFLAGS) ../../../Common/Alloc.cpp
-
C_FileIO.o: ../../../Common/C_FileIO.cpp
$(CXX) $(CFLAGS) ../../../Common/C_FileIO.cpp
diff --git a/CPP/7zip/Compress/Lzx/LzxDecoder.cpp b/CPP/7zip/Compress/Lzx/LzxDecoder.cpp
index e854af32..0ba4b822 100755
--- a/CPP/7zip/Compress/Lzx/LzxDecoder.cpp
+++ b/CPP/7zip/Compress/Lzx/LzxDecoder.cpp
@@ -5,7 +5,10 @@
#include "LzxDecoder.h"
#include "Common/Defs.h"
-#include "Common/Alloc.h"
+extern "C"
+{
+#include "../../../../C/Alloc.h"
+}
#include "Windows/Defs.h"
namespace NCompress {
diff --git a/CPP/7zip/Compress/PPMD/DllExports.cpp b/CPP/7zip/Compress/PPMD/DllExports.cpp
deleted file mode 100755
index 8159a2f8..00000000
--- a/CPP/7zip/Compress/PPMD/DllExports.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyInitGuid.h"
-#include "Common/ComTry.h"
-#ifdef _WIN32
-#include "Common/Alloc.h"
-#endif
-
-#include "PPMDEncoder.h"
-#include "PPMDDecoder.h"
-
-// {23170F69-40C1-278B-0304-010000000000}
-DEFINE_GUID(CLSID_CCompressPPMDDecoder,
-0x23170F69, 0x40C1, 0x278B, 0x03, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-// {23170F69-40C1-278B-0304-010000000100}
-DEFINE_GUID(CLSID_CCompressPPMDEncoder,
-0x23170F69, 0x40C1, 0x278B, 0x03, 0x04, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00);
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID /*lpReserved*/)
-{
- #ifdef _WIN32
- if (dwReason == DLL_PROCESS_ATTACH)
- SetLargePageSize();
- #endif
- return TRUE;
-}
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- COM_TRY_BEGIN
- *outObject = 0;
- int correctInterface = (*iid == IID_ICompressCoder);
- CMyComPtr<ICompressCoder> coder;
- if (*clsid == CLSID_CCompressPPMDDecoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NPPMD::CDecoder();
- }
- else if (*clsid == CLSID_CCompressPPMDEncoder)
- {
- if (!correctInterface)
- return E_NOINTERFACE;
- coder = (ICompressCoder *)new NCompress::NPPMD::CEncoder();
- }
- else
- return CLASS_E_CLASSNOTAVAILABLE;
- *outObject = coder.Detach();
- COM_TRY_END
- return S_OK;
-}
-
-STDAPI GetNumberOfMethods(UINT32 *numMethods)
-{
- *numMethods = 1;
- return S_OK;
-}
-
-STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
-{
- if (index != 0)
- return E_INVALIDARG;
- ::VariantClear((tagVARIANT *)value);
- switch(propID)
- {
- case NMethodPropID::kID:
- {
- const char id[] = { 0x03, 0x04, 0x01 };
- if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- case NMethodPropID::kName:
- if ((value->bstrVal = ::SysAllocString(L"PPMD")) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kDecoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)&CLSID_CCompressPPMDDecoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kEncoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)&CLSID_CCompressPPMDEncoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- return S_OK;
-}
diff --git a/CPP/7zip/Compress/PPMD/PPMD.dsp b/CPP/7zip/Compress/PPMD/PPMD.dsp
index 9e512f6c..c98d809d 100755
--- a/CPP/7zip/Compress/PPMD/PPMD.dsp
+++ b/CPP/7zip/Compress/PPMD/PPMD.dsp
@@ -97,7 +97,11 @@ SOURCE=..\Codec.def
# End Source File
# Begin Source File
-SOURCE=.\DllExports.cpp
+SOURCE=..\CodecExports.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\DllExports.cpp
# End Source File
# Begin Source File
@@ -166,6 +170,10 @@ SOURCE=.\PPMDEncoder.h
# End Source File
# Begin Source File
+SOURCE=.\PPMDRegister.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\PPMDSubAlloc.h
# End Source File
# Begin Source File
@@ -214,15 +222,20 @@ SOURCE=..\RangeCoder\RangeCoder.h
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Common\Alloc.cpp
+SOURCE=..\..\..\Common\Types.h
# End Source File
+# End Group
+# Begin Group "Ñ"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Common\Alloc.h
+SOURCE=..\..\..\..\C\Alloc.c
+# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Types.h
+SOURCE=..\..\..\..\C\Alloc.h
# End Source File
# End Group
# End Target
diff --git a/CPP/7zip/Compress/PPMD/PPMDDecoder.cpp b/CPP/7zip/Compress/PPMD/PPMDDecoder.cpp
index 2d0a2f52..f24c2408 100755
--- a/CPP/7zip/Compress/PPMD/PPMDDecoder.cpp
+++ b/CPP/7zip/Compress/PPMD/PPMDDecoder.cpp
@@ -164,7 +164,7 @@ STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
return S_OK;
}
-#ifdef _ST_MODE
+#ifndef NO_READ_FROM_CODER
STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize)
{
diff --git a/CPP/7zip/Compress/PPMD/PPMDDecoder.h b/CPP/7zip/Compress/PPMD/PPMDDecoder.h
index 8e30c35c..cbb88ad5 100755
--- a/CPP/7zip/Compress/PPMD/PPMDDecoder.h
+++ b/CPP/7zip/Compress/PPMD/PPMDDecoder.h
@@ -17,7 +17,7 @@ namespace NPPMD {
class CDecoder :
public ICompressCoder,
public ICompressSetDecoderProperties2,
- #ifdef _ST_MODE
+ #ifndef NO_READ_FROM_CODER
public ICompressSetInStream,
public ICompressSetOutStreamSize,
public ISequentialInStream,
@@ -41,7 +41,7 @@ class CDecoder :
HRESULT CodeSpec(UInt32 num, Byte *memStream);
public:
- #ifdef _ST_MODE
+ #ifndef NO_READ_FROM_CODER
MY_UNKNOWN_IMP4(
ICompressSetDecoderProperties2,
ICompressSetInStream,
@@ -76,7 +76,7 @@ public:
STDMETHOD(ReleaseInStream)();
STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
- #ifdef _ST_MODE
+ #ifndef NO_READ_FROM_CODER
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
#endif
diff --git a/CPP/7zip/Compress/PPMD/PPMDRegister.cpp b/CPP/7zip/Compress/PPMD/PPMDRegister.cpp
new file mode 100755
index 00000000..2f6dd7cd
--- /dev/null
+++ b/CPP/7zip/Compress/PPMD/PPMDRegister.cpp
@@ -0,0 +1,19 @@
+// PPMDRegister.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "PPMDDecoder.h"
+static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NPPMD::CDecoder); }
+#ifndef EXTRACT_ONLY
+#include "PPMDEncoder.h"
+static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NPPMD::CEncoder); }
+#else
+#define CreateCodecOut 0
+#endif
+
+static CCodecInfo g_CodecInfo =
+ { CreateCodec, CreateCodecOut, 0x030401, L"PPMD", 1, false };
+
+REGISTER_CODEC(PPMD)
diff --git a/CPP/7zip/Compress/PPMD/PPMDSubAlloc.h b/CPP/7zip/Compress/PPMD/PPMDSubAlloc.h
index dce765d6..5162f0a1 100755
--- a/CPP/7zip/Compress/PPMD/PPMDSubAlloc.h
+++ b/CPP/7zip/Compress/PPMD/PPMDSubAlloc.h
@@ -6,7 +6,10 @@
#include "PPMDType.h"
-#include "../../../Common/Alloc.h"
+extern "C"
+{
+#include "../../../../C/Alloc.h"
+}
const UINT N1=4, N2=4, N3=4, N4=(128+3-1*N1-2*N2-3*N3)/4;
const UINT UNIT_SIZE=12, N_INDEXES=N1+N2+N3+N4;
diff --git a/CPP/7zip/Compress/PPMD/makefile b/CPP/7zip/Compress/PPMD/makefile
index 2e687a70..f146edb0 100755
--- a/CPP/7zip/Compress/PPMD/makefile
+++ b/CPP/7zip/Compress/PPMD/makefile
@@ -1,41 +1,43 @@
PROG = PPMd.dll
DEF_FILE = ../Codec.def
-CFLAGS = $(CFLAGS) -I ../../../
+CFLAGS = $(CFLAGS) -I ../../../ -D_7ZIP_LARGE_PAGES
LIBS = $(LIBS) oleaut32.lib
-PPMD_OBJS = \
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
$O\DllExports.obj \
PPMD_OPT_OBJS = \
$O\PPMDDecoder.obj \
$O\PPMDEncoder.obj \
-
-COMMON_OBJS = \
- $O\Alloc.obj \
+ $O\PPMDRegister.obj \
7ZIP_COMMON_OBJS = \
$O\InBuffer.obj \
$O\OutBuffer.obj \
$O\StreamUtils.obj \
+C_OBJS = \
+ $O\Alloc.obj \
OBJS = \
$O\StdAfx.obj \
- $(PPMD_OBJS) \
+ $(COMPRESS_OBJS) \
$(PPMD_OPT_OBJS) \
- $(COMMON_OBJS) \
$(7ZIP_COMMON_OBJS) \
+ $(C_OBJS) \
$O\resource.res
!include "../../../Build.mak"
-$(PPMD_OBJS): $(*B).cpp
+$(COMPRESS_OBJS): ../$(*B).cpp
$(COMPL)
$(PPMD_OPT_OBJS): $(*B).cpp
$(COMPL_O2)
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
- $(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
+
diff --git a/CPP/7zip/Compress/BZip2Original/StdAfx.h b/CPP/7zip/Compress/Quantum/StdAfx.h
index e7fb6986..e7fb6986 100755
--- a/CPP/7zip/Compress/BZip2Original/StdAfx.h
+++ b/CPP/7zip/Compress/Quantum/StdAfx.h
diff --git a/CPP/7zip/Compress/Rar/DllExports.cpp b/CPP/7zip/Compress/Rar/DllExports.cpp
deleted file mode 100755
index acc3068e..00000000
--- a/CPP/7zip/Compress/Rar/DllExports.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyInitGuid.h"
-#include "Common/ComTry.h"
-
-#include "Rar1Decoder.h"
-#include "Rar2Decoder.h"
-#include "Rar3Decoder.h"
-// #include "Rar29Decoder.h"
-
-#define RarClassId(ver) CLSID_CCompressRar ## ver ## Decoder
-
-#define MyClassRar(ver) DEFINE_GUID(RarClassId(ver), \
-0x23170F69, 0x40C1, 0x278B, 0x04, 0x03, ver, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-MyClassRar(1);
-MyClassRar(2);
-MyClassRar(3);
-
-#define CreateCoder(ver) if (*clsid == RarClassId(ver)) \
-{ if (!correctInterface) return E_NOINTERFACE; \
-coder = (ICompressCoder *)new NCompress::NRar ## ver::CDecoder; }
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/)
-{
- return TRUE;
-}
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- COM_TRY_BEGIN
- *outObject = 0;
- int correctInterface = (*iid == IID_ICompressCoder);
- CMyComPtr<ICompressCoder> coder;
- CreateCoder(1) else
- CreateCoder(2) else
- CreateCoder(3) else
- return CLASS_E_CLASSNOTAVAILABLE;
- *outObject = coder.Detach();
- COM_TRY_END
- return S_OK;
-}
-
-struct CRarMethodItem
-{
- char ID[3];
- const wchar_t *UserName;
- const GUID *Decoder;
-};
-
-static CRarMethodItem g_Methods[] =
-{
- { { 0x04, 0x03, 0x01 }, L"Rar15", &RarClassId(1) },
- { { 0x04, 0x03, 0x02 }, L"Rar20", &RarClassId(2) },
- { { 0x04, 0x03, 0x03 }, L"Rar29", &RarClassId(3) }
-};
-
-STDAPI GetNumberOfMethods(UINT32 *numMethods)
-{
- *numMethods = sizeof(g_Methods) / sizeof(g_Methods[1]);
- return S_OK;
-}
-
-STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
-{
- if (index > sizeof(g_Methods) / sizeof(g_Methods[1]))
- return E_INVALIDARG;
- VariantClear((tagVARIANT *)value);
- const CRarMethodItem &method = g_Methods[index];
- switch(propID)
- {
- case NMethodPropID::kID:
- if ((value->bstrVal = ::SysAllocStringByteLen(method.ID,
- sizeof(method.ID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kName:
- if ((value->bstrVal = ::SysAllocString(method.UserName)) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kDecoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)method.Decoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- return S_OK;
-}
diff --git a/CPP/7zip/Compress/Rar/Rar29.dsp b/CPP/7zip/Compress/Rar/Rar29.dsp
index 9a0b86bb..c5ee2228 100755
--- a/CPP/7zip/Compress/Rar/Rar29.dsp
+++ b/CPP/7zip/Compress/Rar/Rar29.dsp
@@ -97,7 +97,11 @@ SOURCE=..\Codec.def
# End Source File
# Begin Source File
-SOURCE=.\DllExports.cpp
+SOURCE=..\CodecExports.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\DllExports.cpp
# End Source File
# Begin Source File
@@ -138,6 +142,10 @@ SOURCE=..\..\Common\OutBuffer.h
# End Source File
# Begin Source File
+SOURCE=..\..\Common\RegisterCodec.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Common\StreamUtils.cpp
# End Source File
# Begin Source File
@@ -170,22 +178,10 @@ SOURCE=..\Huffman\HuffmanDecoder.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\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
@@ -292,6 +288,32 @@ SOURCE=.\Rar3Vm.cpp
SOURCE=.\Rar3Vm.h
# End Source File
+# Begin Source File
+
+SOURCE=.\RarCodecsRegister.cpp
+# 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
# End Target
# End Project
diff --git a/CPP/7zip/Compress/Rar/Rar3Decoder.cpp b/CPP/7zip/Compress/Rar/Rar3Decoder.cpp
index 478b6587..77b73ba8 100755
--- a/CPP/7zip/Compress/Rar/Rar3Decoder.cpp
+++ b/CPP/7zip/Compress/Rar/Rar3Decoder.cpp
@@ -409,7 +409,10 @@ HRESULT CDecoder::DecodePPM(Int32 num, bool &keepDecompressing)
{
RINOK(WriteBuf());
if (_writtenFileSize > _unpackSize)
+ {
+ keepDecompressing = false;
return S_OK;
+ }
}
int c = DecodePpmSymbol();
if (c == -1)
@@ -616,7 +619,10 @@ HRESULT CDecoder::DecodeLZ(bool &keepDecompressing)
{
RINOK(WriteBuf());
if (_writtenFileSize > _unpackSize)
+ {
+ keepDecompressing = false;
return S_OK;
+ }
}
UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream);
if (number < 256)
diff --git a/CPP/7zip/Compress/Rar/Rar3Vm.cpp b/CPP/7zip/Compress/Rar/Rar3Vm.cpp
index 69918d94..6d0c176c 100755
--- a/CPP/7zip/Compress/Rar/Rar3Vm.cpp
+++ b/CPP/7zip/Compress/Rar/Rar3Vm.cpp
@@ -14,8 +14,12 @@ Note:
#include "StdAfx.h"
#include "Rar3Vm.h"
-#include "Common/CRC.h"
-#include "Common/Alloc.h"
+
+extern "C"
+{
+#include "../../../../C/Alloc.h"
+#include "../../../../C/7zCrc.h"
+}
namespace NCompress {
namespace NRar3 {
@@ -42,19 +46,21 @@ UInt32 CMemBitDecoder::ReadBit() { return ReadBits(1); }
namespace NVm {
-const UInt32 kStackRegIndex = kNumRegs - 1;
+static const UInt32 kStackRegIndex = kNumRegs - 1;
-enum EFlags {FLAG_C = 1, FLAG_Z = 2, FLAG_S = 0x80000000};
+static const UInt32 FLAG_C = 1;
+static const UInt32 FLAG_Z = 2;
+static const UInt32 FLAG_S = 0x80000000;
-const Byte CF_OP0 = 0;
-const Byte CF_OP1 = 1;
-const Byte CF_OP2 = 2;
-const Byte CF_OPMASK = 3;
-const Byte CF_BYTEMODE = 4;
-const Byte CF_JUMP = 8;
-const Byte CF_PROC = 16;
-const Byte CF_USEFLAGS = 32;
-const Byte CF_CHFLAGS = 64;
+static const Byte CF_OP0 = 0;
+static const Byte CF_OP1 = 1;
+static const Byte CF_OP2 = 2;
+static const Byte CF_OPMASK = 3;
+static const Byte CF_BYTEMODE = 4;
+static const Byte CF_JUMP = 8;
+static const Byte CF_PROC = 16;
+static const Byte CF_USEFLAGS = 32;
+static const Byte CF_CHFLAGS = 64;
static Byte kCmdFlags[]=
{
@@ -787,7 +793,7 @@ kStdFilters[]=
static int FindStandardFilter(const Byte *code, UInt32 codeSize)
{
- UInt32 crc = CCRC::CalculateDigest(code, codeSize);
+ UInt32 crc = CrcCalc(code, codeSize);
for (int i = 0; i < sizeof(kStdFilters) / sizeof(kStdFilters[0]); i++)
{
StandardFilterSignature &sfs = kStdFilters[i];
diff --git a/CPP/7zip/Compress/Rar/RarCodecsRegister.cpp b/CPP/7zip/Compress/Rar/RarCodecsRegister.cpp
new file mode 100755
index 00000000..5cf32ac8
--- /dev/null
+++ b/CPP/7zip/Compress/Rar/RarCodecsRegister.cpp
@@ -0,0 +1,26 @@
+// RarCodecsRegister.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "Rar1Decoder.h"
+#include "Rar2Decoder.h"
+#include "Rar3Decoder.h"
+
+#define CREATE_CODEC(x) static void *CreateCodec ## x() { return (void *)(ICompressCoder *)(new NCompress::NRar ## x::CDecoder); }
+
+CREATE_CODEC(1)
+CREATE_CODEC(2)
+CREATE_CODEC(3)
+
+#define RAR_CODEC(x, name) { CreateCodec ## x, 0, 0x040300 + x, L"Rar" name, 1, false }
+
+static CCodecInfo g_CodecsInfo[] =
+{
+ RAR_CODEC(1, L"1"),
+ RAR_CODEC(2, L"2"),
+ RAR_CODEC(3, L"3"),
+};
+
+REGISTER_CODECS(Rar)
diff --git a/CPP/7zip/Compress/Rar/makefile b/CPP/7zip/Compress/Rar/makefile
index 4d8d5304..f55bf17e 100755
--- a/CPP/7zip/Compress/Rar/makefile
+++ b/CPP/7zip/Compress/Rar/makefile
@@ -3,7 +3,8 @@ DEF_FILE = ../Codec.def
CFLAGS = $(CFLAGS) -I ../../../
LIBS = $(LIBS) oleaut32.lib
-RAR29_OBJS = \
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
$O\DllExports.obj \
RAR29_OPT_OBJS = \
@@ -11,9 +12,9 @@ RAR29_OPT_OBJS = \
$O\Rar2Decoder.obj \
$O\Rar3Decoder.obj \
$O\Rar3Vm.obj \
+ $O\RarCodecsRegister.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\CRC.obj \
$O\Vector.obj \
@@ -25,19 +26,25 @@ COMMON_OBJS = \
LZ_OBJS = \
$O\LZOutWindow.obj \
+C_OBJS = \
+ $O\Alloc.obj \
+
+!include "../../Crc2.mak"
OBJS = \
$O\StdAfx.obj \
- $(RAR29_OBJS) \
+ $(COMPRESS_OBJS) \
$(RAR29_OPT_OBJS) \
$(COMMON_OBJS) \
$(7ZIP_COMMON_OBJS) \
$(LZ_OBJS) \
+ $(C_OBJS) \
+ $(CRC_OBJS) \
$O\resource.res
!include "../../../Build.mak"
-$(RAR29_OBJS): $(*B).cpp
+$(COMPRESS_OBJS): ../$(*B).cpp
$(COMPL)
$(RAR29_OPT_OBJS): $(*B).cpp
$(COMPL_O2)
@@ -47,3 +54,7 @@ $(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
$(LZ_OBJS): ../LZ/$(*B).cpp
$(COMPL)
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
+
+!include "../../Crc.mak"
diff --git a/CPP/7zip/Compress/Shrink/DllExports.cpp b/CPP/7zip/Compress/Shrink/DllExports.cpp
deleted file mode 100755
index 61bd5e69..00000000
--- a/CPP/7zip/Compress/Shrink/DllExports.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyInitGuid.h"
-#include "Common/ComTry.h"
-#include "ShrinkDecoder.h"
-
-// {23170F69-40C1-278B-0401-010000000000}
-DEFINE_GUID(CLSID_CCompressShrinkDecoder,
-0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
-{
- return TRUE;
-}
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- COM_TRY_BEGIN
- *outObject = 0;
- if (*clsid != CLSID_CCompressShrinkDecoder)
- return CLASS_E_CLASSNOTAVAILABLE;
- if (*iid != IID_ICompressCoder)
- return E_NOINTERFACE;
- CMyComPtr<ICompressCoder> coder = (ICompressCoder *)new NCompress::NShrink::CDecoder;
- *outObject = coder.Detach();
- COM_TRY_END
- return S_OK;
-}
-
-STDAPI GetNumberOfMethods(UINT32 *numMethods)
-{
- *numMethods = 1;
- return S_OK;
-}
-
-STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
-{
- if (index != 0)
- return E_INVALIDARG;
- ::VariantClear((tagVARIANT *)value);
- switch(propID)
- {
- case NMethodPropID::kID:
- {
- const char id[] = { 0x04, 0x01, 0x01 };
- if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- case NMethodPropID::kName:
- if ((value->bstrVal = ::SysAllocString(L"Shrink")) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- case NMethodPropID::kDecoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
- (const char *)&CLSID_CCompressShrinkDecoder, sizeof(GUID))) != 0)
- value->vt = VT_BSTR;
- return S_OK;
- }
- return S_OK;
-}
diff --git a/CPP/7zip/Compress/Shrink/ShrinkDecoder.cpp b/CPP/7zip/Compress/Shrink/ShrinkDecoder.cpp
index 12d1b8d0..187fa3a9 100755
--- a/CPP/7zip/Compress/Shrink/ShrinkDecoder.cpp
+++ b/CPP/7zip/Compress/Shrink/ShrinkDecoder.cpp
@@ -4,7 +4,10 @@
#include "ShrinkDecoder.h"
-#include "../../../Common/Alloc.h"
+extern "C"
+{
+#include "../../../../C/Alloc.h"
+}
#include "../../Common/InBuffer.h"
#include "../../Common/OutBuffer.h"
#include "../../Common/LSBFDecoder.h"
@@ -36,22 +39,21 @@ STDMETHODIMP CDecoder ::CodeReal(ISequentialInStream *inStream,
UInt64 prevPos = 0;
int numBits = kNumMinBits;
UInt32 head = 257;
-
bool needPrev = false;
-
- _parents[256] = 0; // virus protection
- _suffixes[256] = 0;
+ UInt32 lastSymbol = 0;
int i;
+ for (i = 0; i < kNumItems; i++)
+ _parents[i] = 0;
+ for (i = 0; i < kNumItems; i++)
+ _suffixes[i] = 0;
for (i = 0; i < 257; i++)
_isFree[i] = false;
for (; i < kNumItems; i++)
_isFree[i] = true;
- UInt32 lastSymbol = 0;
for (;;)
{
- outBuffer.Flush();
UInt32 symbol = inBuffer.ReadBits(numBits);
if (inBuffer.ExtraBitsWereRead())
break;
@@ -59,7 +61,6 @@ STDMETHODIMP CDecoder ::CodeReal(ISequentialInStream *inStream,
return S_FALSE;
if (symbol == 256)
{
- // fix it;
UInt32 symbol = inBuffer.ReadBits(numBits);
if (symbol == 1)
{
@@ -68,11 +69,8 @@ STDMETHODIMP CDecoder ::CodeReal(ISequentialInStream *inStream,
}
else if (symbol == 2)
{
- /*
- maybe need delete prev also ?
if (needPrev)
_isFree[head - 1] = true;
- */
for (i = 257; i < kNumItems; i++)
_isParent[i] = false;
for (i = 257; i < kNumItems; i++)
@@ -82,9 +80,9 @@ STDMETHODIMP CDecoder ::CodeReal(ISequentialInStream *inStream,
if (!_isParent[i])
_isFree[i] = true;
head = 257;
- while(head < ((UInt32)1 << numBits) && !_isFree[head])
+ while (head < kNumItems && !_isFree[head])
head++;
- if (head < ((UInt32)1 << numBits))
+ if (head < kNumItems)
{
needPrev = true;
_isFree[head] = false;
@@ -98,8 +96,11 @@ STDMETHODIMP CDecoder ::CodeReal(ISequentialInStream *inStream,
}
UInt32 cur = symbol;
i = 0;
+ int corectionIndex = -1;
while (cur >= 256)
{
+ if (cur == head - 1)
+ corectionIndex = i;
_stack[i++] = _suffixes[cur];
cur = _parents[cur];
}
@@ -107,14 +108,14 @@ STDMETHODIMP CDecoder ::CodeReal(ISequentialInStream *inStream,
if (needPrev)
{
_suffixes[head - 1] = (Byte)cur;
- if (symbol == head - 1)
- _stack[0] = (Byte)cur;
+ if (corectionIndex >= 0)
+ _stack[corectionIndex] = (Byte)cur;
}
while (i > 0)
outBuffer.WriteByte((_stack[--i]));
- while(head < ((UInt32)1 << numBits) && !_isFree[head])
+ while (head < kNumItems && !_isFree[head])
head++;
- if (head < ((UInt32)1 << numBits))
+ if (head < kNumItems)
{
needPrev = true;
_isFree[head] = false;
diff --git a/CPP/7zip/Compress/StdAfx.h b/CPP/7zip/Compress/StdAfx.h
new file mode 100755
index 00000000..99a8aa46
--- /dev/null
+++ b/CPP/7zip/Compress/StdAfx.h
@@ -0,0 +1,8 @@
+// StdAfx.h
+
+#ifndef __STDAFX_H
+#define __STDAFX_H
+
+#include "../../Common/MyWindows.h"
+
+#endif
diff --git a/CPP/7zip/Compress/Z/ZDecoder.cpp b/CPP/7zip/Compress/Z/ZDecoder.cpp
index 2415efd8..144d0878 100755
--- a/CPP/7zip/Compress/Z/ZDecoder.cpp
+++ b/CPP/7zip/Compress/Z/ZDecoder.cpp
@@ -4,7 +4,11 @@
#include "ZDecoder.h"
-#include "../../../Common/Alloc.h"
+extern "C"
+{
+#include "../../../../C/Alloc.h"
+}
+
#include "../../Common/InBuffer.h"
#include "../../Common/OutBuffer.h"
#include "../../Common/LSBFDecoder.h"
diff --git a/CPP/7zip/Crc.mak b/CPP/7zip/Crc.mak
new file mode 100755
index 00000000..99c370b8
--- /dev/null
+++ b/CPP/7zip/Crc.mak
@@ -0,0 +1,15 @@
+!IF "$(CPU)" != "IA64"
+!IF "$(CPU)" != "AMD64"
+$O\7zCrcT8U.obj: ../../../../Asm/x86/$(*B).asm
+ $(COMPL_ASM)
+!ELSE
+$O\7zCrcT8U.obj: ../../../../Asm/x64/$(*B).asm
+ $(COMPL_ASM)
+!ENDIF
+$O\7zCrcT8.obj: ../../../../C/$(*B).c
+ $(COMPL_O2)
+!ELSE
+$(CRC_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
+!ENDIF
+
diff --git a/CPP/7zip/Crc2.mak b/CPP/7zip/Crc2.mak
new file mode 100755
index 00000000..44d264f7
--- /dev/null
+++ b/CPP/7zip/Crc2.mak
@@ -0,0 +1,7 @@
+CRC_OBJS = \
+!IF "$(CPU)" != "IA64"
+ $O\7zCrcT8U.obj \
+ $O\7zCrcT8.obj \
+!ELSE
+ $O\7zCrc.obj \
+!ENDIF
diff --git a/CPP/7zip/Crypto/7zAES/7zAES.cpp b/CPP/7zip/Crypto/7zAES/7zAES.cpp
index 843d9027..ae9854e4 100755
--- a/CPP/7zip/Crypto/7zAES/7zAES.cpp
+++ b/CPP/7zip/Crypto/7zAES/7zAES.cpp
@@ -6,21 +6,12 @@
#include "Windows/Synchronization.h"
#include "../../Common/StreamObjects.h"
#include "../../Common/StreamUtils.h"
-
-#include "7zAES.h"
-// #include "../../Hash/Common/CryptoHashInterface.h"
-
-#ifdef CRYPTO_AES
#include "../AES/MyAES.h"
-#endif
-
#include "../Hash/Sha256.h"
-using namespace NWindows;
+#include "7zAES.h"
-#ifndef CRYPTO_AES
-extern HINSTANCE g_hInstance;
-#endif
+using namespace NWindows;
namespace NCrypto {
namespace NSevenZ {
@@ -219,36 +210,6 @@ STDMETHODIMP CBaseCoder::CryptoSetPassword(const Byte *data, UInt32 size)
return S_OK;
}
-/*
-static Byte *WideToRaw(const wchar_t *src, Byte *dest, int destSize=0x10000000)
-{
- for (int i = 0; i < destSize; i++, src++)
- {
- dest[i * 2] = (Byte)*src;
- dest[i * 2 + 1]= (Byte)(*src >> 8);
- if (*src == 0)
- break;
- }
- return(dest);
-}
-*/
-
-#ifndef CRYPTO_AES
-bool GetAESLibPath(TCHAR *path)
-{
- TCHAR fullPath[MAX_PATH + 1];
- if (::GetModuleFileName(g_hInstance, fullPath, MAX_PATH) == 0)
- return false;
- LPTSTR fileNamePointer;
- DWORD needLength = ::GetFullPathName(fullPath, MAX_PATH + 1,
- path, &fileNamePointer);
- if (needLength == 0 || needLength >= MAX_PATH)
- return false;
- lstrcpy(fileNamePointer, TEXT("AES.dll"));
- return true;
-}
-#endif
-
STDMETHODIMP CBaseCoder::Init()
{
CalculateDigest();
@@ -268,38 +229,16 @@ STDMETHODIMP_(UInt32) CBaseCoder::Filter(Byte *data, UInt32 size)
return _aesFilter->Filter(data, size);
}
-#ifndef CRYPTO_AES
-HRESULT CBaseCoder::CreateFilterFromDLL(REFCLSID clsID)
-{
- if (!_aesLibrary)
- {
- TCHAR filePath[MAX_PATH + 2];
- if (!GetAESLibPath(filePath))
- return ::GetLastError();
- return _aesLibrary.LoadAndCreateFilter(filePath, clsID, &_aesFilter);
- }
- return S_OK;
-}
-#endif
-
HRESULT CEncoder::CreateFilter()
{
- #ifdef CRYPTO_AES
_aesFilter = new CAES_CBC_Encoder;
return S_OK;
- #else
- return CreateFilterFromDLL(CLSID_CCrypto_AES_CBC_Encoder);
- #endif
}
HRESULT CDecoder::CreateFilter()
{
- #ifdef CRYPTO_AES
_aesFilter = new CAES_CBC_Decoder;
return S_OK;
- #else
- return CreateFilterFromDLL(CLSID_CCrypto_AES_CBC_Decoder);
- #endif
}
}}
diff --git a/CPP/7zip/Crypto/7zAES/7zAES.dsp b/CPP/7zip/Crypto/7zAES/7zAES.dsp
index 37cd7792..868c0356 100755
--- a/CPP/7zip/Crypto/7zAES/7zAES.dsp
+++ b/CPP/7zip/Crypto/7zAES/7zAES.dsp
@@ -97,7 +97,11 @@ SOURCE=..\Codec.def
# End Source File
# Begin Source File
-SOURCE=.\DllExports.cpp
+SOURCE=..\..\Compress\CodecExports.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\DllExports.cpp
# End Source File
# Begin Source File
@@ -118,14 +122,6 @@ SOURCE=.\StdAfx.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\NewHandler.cpp
# End Source File
# Begin Source File
@@ -174,39 +170,70 @@ SOURCE=..\..\..\Common\StringConvert.h
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Windows\DLL.cpp
+SOURCE=..\..\..\Windows\Synchronization.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\DLL.h
+SOURCE=..\..\..\Windows\Synchronization.h
# End Source File
+# End Group
+# Begin Group "Hash"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Windows\Synchronization.cpp
+SOURCE=..\Hash\RotateDefs.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Synchronization.h
+SOURCE=..\Hash\Sha256.cpp
+
+!IF "$(CFG)" == "7zAES - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7zAES - Win32 Debug"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\Hash\Sha256.h
# End Source File
# End Group
-# Begin Group "Archive Common"
+# Begin Group "Ñ"
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\Archive\Common\CoderLoader.h
+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 Group "Hash"
+# Begin Group "AES"
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\Hash\RotateDefs.h
+SOURCE=..\AES\aes.h
# End Source File
# Begin Source File
-SOURCE=..\Hash\Sha256.cpp
+SOURCE=..\AES\AES_CBC.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\AES\aescpp.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\AES\aescrypt.c
!IF "$(CFG)" == "7zAES - Win32 Release"
@@ -215,12 +242,66 @@ SOURCE=..\Hash\Sha256.cpp
!ELSEIF "$(CFG)" == "7zAES - Win32 Debug"
+# SUBTRACT CPP /YX /Yc /Yu
+
!ENDIF
# End Source File
# Begin Source File
-SOURCE=..\Hash\Sha256.h
+SOURCE=..\AES\aeskey.c
+
+!IF "$(CFG)" == "7zAES - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7zAES - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\AES\aesopt.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\AES\aestab.c
+
+!IF "$(CFG)" == "7zAES - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7zAES - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\AES\MyAES.cpp
+
+!IF "$(CFG)" == "7zAES - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "7zAES - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\AES\MyAES.h
# End Source File
# End Group
# Begin Source File
@@ -241,5 +322,9 @@ SOURCE=.\7zAES.cpp
SOURCE=.\7zAES.h
# End Source File
+# Begin Source File
+
+SOURCE=.\7zAESRegister.cpp
+# End Source File
# End Target
# End Project
diff --git a/CPP/7zip/Crypto/7zAES/7zAES.h b/CPP/7zip/Crypto/7zAES/7zAES.h
index f312f7e6..e8cedccf 100755
--- a/CPP/7zip/Crypto/7zAES/7zAES.h
+++ b/CPP/7zip/Crypto/7zAES/7zAES.h
@@ -1,4 +1,4 @@
-// 7z_AES.h
+// 7zAES.h
#ifndef __CRYPTO_7Z_AES_H
#define __CRYPTO_7Z_AES_H
@@ -11,16 +11,6 @@
#include "../../ICoder.h"
#include "../../IPassword.h"
-#ifndef CRYPTO_AES
-#include "../../Archive/Common/CoderLoader.h"
-#endif
-
-DEFINE_GUID(CLSID_CCrypto_AES_CBC_Encoder,
-0x23170F69, 0x40C1, 0x278B, 0x06, 0x01, 0xC1, 0x00, 0x00, 0x00, 0x01, 0x00);
-
-DEFINE_GUID(CLSID_CCrypto_AES_CBC_Decoder,
-0x23170F69, 0x40C1, 0x278B, 0x06, 0x01, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00);
-
namespace NCrypto {
namespace NSevenZ {
@@ -77,9 +67,6 @@ class CBaseCoder:
public CBase
{
protected:
- #ifndef CRYPTO_AES
- CCoderLibrary _aesLibrary;
- #endif
CMyComPtr<ICompressFilter> _aesFilter;
virtual HRESULT CreateFilter() = 0;
diff --git a/CPP/7zip/Crypto/7zAES/7zAESRegister.cpp b/CPP/7zip/Crypto/7zAES/7zAESRegister.cpp
new file mode 100755
index 00000000..a85fdbdf
--- /dev/null
+++ b/CPP/7zip/Crypto/7zAES/7zAESRegister.cpp
@@ -0,0 +1,18 @@
+// BranchRegister.cpp
+
+#include "StdAfx.h"
+
+#include "../../Common/RegisterCodec.h"
+
+#include "7zAES.h"
+static void *CreateCodec() { return (void *)(ICompressFilter *)(new NCrypto::NSevenZ::CDecoder()); }
+#ifndef EXTRACT_ONLY
+static void *CreateCodecOut() { return (void *)(ICompressFilter *)(new NCrypto::NSevenZ::CEncoder()); }
+#else
+#define CreateCodecOut 0
+#endif
+
+static CCodecInfo g_CodecInfo =
+ { CreateCodec, CreateCodecOut, 0x06F10701, L"7zAES", 1, true };
+
+REGISTER_CODEC(7zAES)
diff --git a/CPP/7zip/Crypto/7zAES/makefile b/CPP/7zip/Crypto/7zAES/makefile
index c3d9a51d..d060d4ee 100755
--- a/CPP/7zip/Crypto/7zAES/makefile
+++ b/CPP/7zip/Crypto/7zAES/makefile
@@ -3,45 +3,63 @@ DEF_FILE = ../Codec.def
CFLAGS = $(CFLAGS) -I ../../../
LIBS = $(LIBS) oleaut32.lib user32.lib
-7ZAES_OBJS = \
+COMPRESS_OBJS = \
+ $O\CodecExports.obj \
$O\DllExports.obj \
7ZAES_OPT_OBJS = \
$O\7zAES.obj \
+ $O\7zAESRegister.obj \
+
+AES_OPT_OBJS = \
+ $O\MyAES.obj \
+
+AES_ORIG_OBJS = \
+ $O\aescrypt.obj \
+ $O\aeskey.obj \
+ $O\aestab.obj \
CRYPTO_HASH_OBJS = \
$O\Sha256.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\NewHandler.obj \
$O\StringConvert.obj \
$O\Vector.obj \
WIN_OBJS = \
- $O\DLL.obj \
$O\Synchronization.obj
7ZIP_COMMON_OBJS = \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
+C_OBJS = \
+ $O\Alloc.obj \
+
OBJS = \
$O\StdAfx.obj \
- $(7ZAES_OBJS) \
+ $(COMPRESS_OBJS) \
$(7ZAES_OPT_OBJS) \
+ $(AES_OPT_OBJS) \
+ $(AES_ORIG_OBJS) \
$(CRYPTO_HASH_OBJS) \
$(COMMON_OBJS) \
$(WIN_OBJS) \
$(7ZIP_COMMON_OBJS) \
+ $(C_OBJS) \
$O\resource.res
!include "../../../Build.mak"
-$(7ZAES_OBJS): $(*B).cpp
+$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
$(COMPL)
+$(AES_OPT_OBJS): ../AES/$(*B).cpp
+ $(COMPL_O2)
+$(AES_ORIG_OBJS): ../AES/$(*B).c
+ $(COMPL_O2_W3)
$(7ZAES_OPT_OBJS): $(*B).cpp
- $(COMPL)
+ $(COMPL_O2)
$(CRYPTO_HASH_OBJS): ../../Crypto/Hash/$(*B).cpp
$(COMPL_O2)
$(COMMON_OBJS): ../../../Common/$(*B).cpp
@@ -50,3 +68,5 @@ $(WIN_OBJS): ../../../Windows/$(*B).cpp
$(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
diff --git a/CPP/7zip/Crypto/Rar20/Rar20Crypto.cpp b/CPP/7zip/Crypto/Rar20/Rar20Crypto.cpp
index d8be2279..6cd2d450 100755
--- a/CPP/7zip/Crypto/Rar20/Rar20Crypto.cpp
+++ b/CPP/7zip/Crypto/Rar20/Rar20Crypto.cpp
@@ -3,7 +3,10 @@
#include "StdAfx.h"
#include "Rar20Crypto.h"
-#include "../../../Common/CRC.h"
+extern "C"
+{
+ #include "../../../../C/7zCrc.h"
+}
#define rol(x,n) (((x) << (n)) | ((x) >> (8 * sizeof(x) - (n))))
#define ror(x,n) (((x) >> (n)) | ((x) << (8 * sizeof(x) - (n))))
@@ -36,7 +39,7 @@ void CData::UpdateKeys(const Byte *data)
{
for (int i = 0; i < 16; i += 4)
for (int j = 0; j < 4; j++)
- Keys[j] ^= CCRC::Table[data[i + j]];
+ Keys[j] ^= g_CrcTable[data[i + j]];
}
static void Swap(Byte *b1, Byte *b2)
@@ -64,8 +67,8 @@ void CData::SetPassword(const Byte *password, UInt32 passwordLength)
for (UInt32 j = 0; j < 256; j++)
for (UInt32 i = 0; i < passwordLength; i += 2)
{
- UInt32 n2 = (Byte)CCRC::Table[(psw[i + 1] + j) & 0xFF];
- UInt32 n1 = (Byte)CCRC::Table[(psw[i] - j) & 0xFF];
+ UInt32 n2 = (Byte)g_CrcTable[(psw[i + 1] + j) & 0xFF];
+ UInt32 n1 = (Byte)g_CrcTable[(psw[i] - j) & 0xFF];
for (UInt32 k = 1; (n1 & 0xFF) != n2; n1++, k++)
Swap(&SubstTable[n1 & 0xFF], &SubstTable[(n1 + i + k) & 0xFF]);
}
diff --git a/CPP/7zip/Crypto/RarAES/RarAES.cpp b/CPP/7zip/Crypto/RarAES/RarAES.cpp
index ae22bb2a..bf14d65d 100755
--- a/CPP/7zip/Crypto/RarAES/RarAES.cpp
+++ b/CPP/7zip/Crypto/RarAES/RarAES.cpp
@@ -1,12 +1,12 @@
-// Crypto/RarAES/RarAES.h
+// RarAES.cpp
// This code is based on UnRar sources
#include "StdAfx.h"
#include "RarAES.h"
+#include "../../Common/MethodID.h"
#include "../Hash/Sha1.h"
-
-extern void GetCryptoFolderPrefix(TCHAR *path);
+#include "../AES/MyAES.h"
namespace NCrypto {
namespace NRar29 {
@@ -77,7 +77,8 @@ STDMETHODIMP CDecoder::CryptoSetPassword(const Byte *data, UInt32 size)
STDMETHODIMP CDecoder::Init()
{
Calculate();
- RINOK(CreateFilter());
+ if (!_aesFilter)
+ _aesFilter = new CAES_CBC_Decoder;
CMyComPtr<ICryptoProperties> cp;
RINOK(_aesFilter.QueryInterface(IID_ICryptoProperties, &cp));
RINOK(cp->SetKey(aesKey, 16));
@@ -86,16 +87,6 @@ STDMETHODIMP CDecoder::Init()
return S_OK;
}
-HRESULT CDecoder::CreateFilter()
-{
- if (_aesFilter)
- return S_OK;
- TCHAR aesLibPath[MAX_PATH + 64];
- GetCryptoFolderPrefix(aesLibPath);
- lstrcat(aesLibPath, TEXT("AES.dll"));
- return _aesLib.LoadAndCreateFilter(aesLibPath, CLSID_CCrypto_AES_CBC_Decoder, &_aesFilter);
-}
-
STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
{
return _aesFilter->Filter(data, size);
@@ -152,36 +143,4 @@ void CDecoder::Calculate()
_needCalculate = false;
}
-
-
-/*
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, UInt64 const *inSize,
- const UInt64 *outSize,ICompressProgressInfo *progress)
-{
- Calculate();
- TCHAR aesLibPath[MAX_PATH + 64];
- GetCryptoFolderPrefix(aesLibPath);
- lstrcat(aesLibPath, TEXT("AES.dll"));
- CCoderLibrary aesLib;
- CMyComPtr<ICompressCoder2> aesDecoder;
- RINOK(aesLib.LoadAndCreateCoder2(aesLibPath, CLSID_CCrypto_AES128_Decoder, &aesDecoder));
-
- CSequentialInStreamImp *ivStreamSpec = new CSequentialInStreamImp;
- CMyComPtr<ISequentialInStream> ivStream(ivStreamSpec);
- ivStreamSpec->Init(aesInit, 16);
-
- CSequentialInStreamImp *keyStreamSpec = new CSequentialInStreamImp;
- CMyComPtr<ISequentialInStream> keyStream(keyStreamSpec);
- keyStreamSpec->Init(aesKey, 16);
-
- ISequentialInStream *inStreams[3] = { inStream, ivStream, keyStream };
- UInt64 ivSize = 16;
- UInt64 keySize = 16;
- const UInt64 *inSizes[3] = { inSize, &ivSize, &ivSize, };
- return aesDecoder->Code(inStreams, inSizes, 3,
- &outStream, &outSize, 1, progress);
-}
-*/
-
}}
diff --git a/CPP/7zip/Crypto/RarAES/RarAES.h b/CPP/7zip/Crypto/RarAES/RarAES.h
index 4b435b5e..d52557f6 100755
--- a/CPP/7zip/Crypto/RarAES/RarAES.h
+++ b/CPP/7zip/Crypto/RarAES/RarAES.h
@@ -1,18 +1,14 @@
-// Crypto/CRarAES/RarAES.h
+// RarAES.h
#ifndef __CRYPTO_RARAES_H
#define __CRYPTO_RARAES_H
#include "Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../../IPassword.h"
-#include "../../Archive/Common/CoderLoader.h"
-
#include "Common/Types.h"
#include "Common/Buffer.h"
-DEFINE_GUID(CLSID_CCrypto_AES_CBC_Decoder,
-0x23170F69, 0x40C1, 0x278B, 0x06, 0x01, 0xC1, 0x00, 0x00, 0x00, 0x00, 0x00);
+#include "../../ICoder.h"
+#include "../../IPassword.h"
namespace NCrypto {
namespace NRar29 {
@@ -30,13 +26,11 @@ class CDecoder:
Byte aesInit[16];
bool _needCalculate;
- CCoderLibrary _aesLib;
CMyComPtr<ICompressFilter> _aesFilter;
bool _rar350Mode;
void Calculate();
- HRESULT CreateFilter();
public:
@@ -45,6 +39,7 @@ public:
ICompressSetDecoderProperties2)
STDMETHOD(Init)();
+
STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
STDMETHOD(CryptoSetPassword)(const Byte *aData, UInt32 aSize);
diff --git a/CPP/7zip/Crypto/WzAES/WzAES.cpp b/CPP/7zip/Crypto/WzAES/WzAES.cpp
index 8bf53b43..693989cc 100755
--- a/CPP/7zip/Crypto/WzAES/WzAES.cpp
+++ b/CPP/7zip/Crypto/WzAES/WzAES.cpp
@@ -14,11 +14,7 @@ specified in password Based File Encryption Utility.
#include "WzAES.h"
-#ifdef CRYPTO_AES
#include "../AES/MyAES.h"
-#else
-extern void GetCryptoFolderPrefix(TCHAR *path);
-#endif
// define it if you don't want to use speed-optimized version of Pbkdf2HmacSha1
// #define _NO_WZAES_OPTIMIZATIONS
@@ -226,20 +222,7 @@ STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
HRESULT CBaseCoder::CreateFilters()
{
if (!_aesFilter)
- {
- #ifdef CRYPTO_AES
-
_aesFilter = new CAES_ECB_Encoder;
-
- #else
-
- TCHAR aesLibPath[MAX_PATH + 64];
- GetCryptoFolderPrefix(aesLibPath);
- lstrcat(aesLibPath, TEXT("AES.dll"));
- RINOK(_aesLibrary.LoadAndCreateFilter(aesLibPath, CLSID_CCrypto_AES_ECB_Encoder, &_aesFilter));
-
- #endif
- }
return S_OK;
}
diff --git a/CPP/7zip/Crypto/WzAES/WzAES.h b/CPP/7zip/Crypto/WzAES/WzAES.h
index c27bd326..81ca3f4c 100755
--- a/CPP/7zip/Crypto/WzAES/WzAES.h
+++ b/CPP/7zip/Crypto/WzAES/WzAES.h
@@ -21,13 +21,6 @@ specified in password Based File Encryption Utility:
#include "../../ICoder.h"
#include "../../IPassword.h"
-#ifndef CRYPTO_AES
-#include "../../Archive/Common/CoderLoader.h"
-#endif
-
-DEFINE_GUID(CLSID_CCrypto_AES_ECB_Encoder,
-0x23170F69, 0x40C1, 0x278B, 0x06, 0x01, 0xC0, 0x00, 0x00, 0x00, 0x01, 0x00);
-
namespace NCrypto {
namespace NWzAES {
@@ -71,9 +64,6 @@ protected:
void EncryptData(Byte *data, UInt32 size);
- #ifndef CRYPTO_AES
- CCoderLibrary _aesLibrary;
- #endif
CMyComPtr<ICompressFilter> _aesFilter;
HRESULT CreateFilters();
diff --git a/CPP/7zip/Crypto/Zip/ZipCrypto.cpp b/CPP/7zip/Crypto/Zip/ZipCrypto.cpp
index 79f0953c..7389ba25 100755
--- a/CPP/7zip/Crypto/Zip/ZipCrypto.cpp
+++ b/CPP/7zip/Crypto/Zip/ZipCrypto.cpp
@@ -3,22 +3,20 @@
#include "StdAfx.h"
#include "ZipCipher.h"
-#include "../../../Common/CRC.h"
+extern "C"
+{
+#include "../../../../C/7zCrc.h"
+}
namespace NCrypto {
namespace NZip {
-static inline UInt32 ZipCRC32(UInt32 c, Byte b)
-{
- return CCRC::Table[(c ^ b) & 0xFF] ^ (c >> 8);
-}
-
void CCipher::UpdateKeys(Byte b)
{
- Keys[0] = ZipCRC32(Keys[0], b);
+ Keys[0] = CRC_UPDATE_BYTE(Keys[0], b);
Keys[1] += Keys[0] & 0xff;
Keys[1] = Keys[1] * 134775813L + 1;
- Keys[2] = ZipCRC32(Keys[2], (Byte)(Keys[1] >> 24));
+ Keys[2] = CRC_UPDATE_BYTE(Keys[2], (Byte)(Keys[1] >> 24));
}
void CCipher::SetPassword(const Byte *password, UInt32 passwordLength)
diff --git a/CPP/7zip/Crypto/makefile b/CPP/7zip/Crypto/makefile
index 61f59603..2969f309 100755
--- a/CPP/7zip/Crypto/makefile
+++ b/CPP/7zip/Crypto/makefile
@@ -1,6 +1,5 @@
DIRS = \
7zAES\~ \
- AES\~ \
all: $(DIRS)
diff --git a/CPP/7zip/FileManager/FM.cpp b/CPP/7zip/FileManager/FM.cpp
index c64f0b51..17670423 100755
--- a/CPP/7zip/FileManager/FM.cpp
+++ b/CPP/7zip/FileManager/FM.cpp
@@ -1,13 +1,17 @@
-// FAM.cpp
+// FM.cpp
#include "StdAfx.h"
#include "resource.h"
#include "Panel.h"
+extern "C"
+{
+ #include "../../../C/Alloc.h"
+}
+
#include "Common/Defs.h"
#include "Common/StringConvert.h"
-#include "Common/Alloc.h"
// #include "Common/CommandLineParser.h"
#include "Windows/Control/Toolbar.h"
@@ -33,8 +37,6 @@ using namespace NFile;
using namespace NFind;
// using namespace NCommandLineParser;
-// NWindows::NCOM::CComInitializer aComInitializer;
-
#define MAX_LOADSTRING 100
#define MENU_HEIGHT 26
@@ -602,8 +604,17 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
g_App.CreateDragTarget();
bool archiveIsOpened;
bool encrypted;
+ bool needOpenFile = false;
+ if (!g_MainPath.IsEmpty() /* && g_OpenArchive */)
+ {
+ NFile::NFind::CFileInfoW fileInfo;
+ if (NFile::NFind::FindFile(g_MainPath, fileInfo))
+ if (!fileInfo.IsDirectory())
+ needOpenFile = true;
+ }
g_App.Create(hWnd, g_MainPath, xSizes, archiveIsOpened, encrypted);
- if (!archiveIsOpened && g_OpenArchive)
+
+ if (needOpenFile && !archiveIsOpened)
{
UString message;
if (encrypted)
diff --git a/CPP/7zip/FileManager/FM.dsp b/CPP/7zip/FileManager/FM.dsp
index 75c95ead..f84d19d1 100755
--- a/CPP/7zip/FileManager/FM.dsp
+++ b/CPP/7zip/FileManager/FM.dsp
@@ -489,18 +489,6 @@ SOURCE=.\Resource\AboutDialog\AboutDialog.cpp
SOURCE=.\Resource\AboutDialog\AboutDialog.h
# End Source File
# End Group
-# Begin Group "Benchmark"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\Resource\BenchmarkDialog\BenchmarkDialog.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\Resource\BenchmarkDialog\BenchmarkDialog.h
-# End Source File
-# End Group
# Begin Group "Split"
# PROP Default_Filter ""
@@ -606,9 +594,93 @@ SOURCE=.\UpdateCallback100.cpp
SOURCE=.\UpdateCallback100.h
# End Source File
# End Group
-# Begin Group "SDK"
+# Begin Group "UI Common"
# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\UI\Common\ArchiveName.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\UI\Common\ArchiveName.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\UI\Common\CompressCall.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\UI\Common\CompressCall.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\UI\Common\PropIDUtils.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\UI\Common\PropIDUtils.h
+# End Source File
+# End Group
+# Begin Group "7-Zip Common"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\Common\FilePathAutoRename.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common\FilePathAutoRename.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common\FileStreams.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common\FileStreams.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common\StreamObjects.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common\StreamObjects.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
+# Begin Source File
+
+SOURCE=..\..\..\C\Sort.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\C\Sort.h
+# End Source File
+# End Group
# Begin Group "Windows"
# PROP Default_Filter ""
@@ -894,14 +966,6 @@ SOURCE=..\..\Windows\Window.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
@@ -922,10 +986,6 @@ SOURCE=..\..\Common\CRC.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\Common\CRC.h
-# End Source File
-# Begin Source File
-
SOURCE=..\..\Common\Defs.h
# End Source File
# Begin Source File
@@ -1049,76 +1109,6 @@ SOURCE=..\..\Common\Wildcard.cpp
SOURCE=..\..\Common\Wildcard.h
# End Source File
# End Group
-# End Group
-# Begin Group "UI Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\UI\Common\ArchiveName.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\UI\Common\ArchiveName.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\UI\Common\CompressCall.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\UI\Common\CompressCall.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\UI\Common\PropIDUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\UI\Common\PropIDUtils.h
-# End Source File
-# End Group
-# Begin Group "7-Zip Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\Common\FilePathAutoRename.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\Common\FilePathAutoRename.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\Common\FileStreams.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\Common\FileStreams.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\Common\StreamObjects.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\Common\StreamObjects.h
-# End Source File
-# End Group
-# Begin Group "C"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\C\Sort.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\C\Sort.h
-# End Source File
-# End Group
# Begin Source File
SOURCE=.\7zFM.exe.manifest
diff --git a/CPP/7zip/FileManager/FilePlugins.cpp b/CPP/7zip/FileManager/FilePlugins.cpp
index 524b6aa7..0ae8279d 100755
--- a/CPP/7zip/FileManager/FilePlugins.cpp
+++ b/CPP/7zip/FileManager/FilePlugins.cpp
@@ -59,17 +59,15 @@ void CExtDatabase::Read()
if (pluginLibrary.LoadAndCreateManager(pluginInfo.FilePath,
pluginInfo.ClassID, &folderManager) != S_OK)
continue;
- CMyComBSTR typesString;
- if (folderManager->GetTypes(&typesString) != S_OK)
- continue;
- UStringVector types;
- SplitString((const wchar_t *)typesString, types);
- for (int typeIndex = 0; typeIndex < types.Size(); typeIndex++)
+ CMyComBSTR extBSTR;
+ if (folderManager->GetExtensions(&extBSTR) != S_OK)
+ return;
+ const UString ext2 = (const wchar_t *)extBSTR;
+ UStringVector exts;
+ SplitString(ext2, exts);
+ for (int i = 0; i < exts.Size(); i++)
{
- CMyComBSTR extTemp;
- if (folderManager->GetExtension(types[typeIndex], &extTemp) != S_OK)
- continue;
- const UString ext = (const wchar_t *)extTemp;
+ const UString &ext = exts[i];
int index = FindExtInfoBig(ext);
if (index < 0)
{
diff --git a/CPP/7zip/FileManager/FilePlugins.h b/CPP/7zip/FileManager/FilePlugins.h
index 805cac2a..1becb9d1 100755
--- a/CPP/7zip/FileManager/FilePlugins.h
+++ b/CPP/7zip/FileManager/FilePlugins.h
@@ -23,7 +23,7 @@ struct CExtInfoBig
for (int i = 0; i < PluginsPairs.Size(); i++)
if (PluginsPairs[i].Index == pluginIndex)
return i;
- return -1;
+ return -1;
}
};
diff --git a/CPP/7zip/FileManager/IFolder.h b/CPP/7zip/FileManager/IFolder.h
index aa50a39d..4758ea5b 100755
--- a/CPP/7zip/FileManager/IFolder.h
+++ b/CPP/7zip/FileManager/IFolder.h
@@ -155,18 +155,23 @@ DEFINE_GUID(IID_ ## i, \
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x09, 0x00, x, 0x00, 0x00); \
struct i: public IUnknown
-FOLDER_MANAGER_INTERFACE(IFolderManager, 0x00)
+// old interfaces 00, 01
+
+FOLDER_MANAGER_INTERFACE(IFolderManager, 0x02)
{
STDMETHOD(OpenFolderFile)(const wchar_t *filePath, IFolderFolder **resultFolder, IProgress *progress) PURE;
- STDMETHOD(GetTypes)(BSTR *types) PURE;
- STDMETHOD(GetExtension)(const wchar_t *type, BSTR *extension) PURE;
- STDMETHOD(CreateFolderFile)(const wchar_t *type, const wchar_t *filePath, IProgress *progress) PURE;
+ STDMETHOD(GetExtensions)(BSTR *extensions) PURE;
+ STDMETHOD(GetIconPath)(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex) PURE;
+ // STDMETHOD(GetTypes)(BSTR *types) PURE;
+ // STDMETHOD(GetExtensions)(const wchar_t *type, BSTR *extensions) PURE;
+ // STDMETHOD(CreateFolderFile)(const wchar_t *type, const wchar_t *filePath, IProgress *progress) PURE;
};
-FOLDER_MANAGER_INTERFACE(IFolderManagerGetIconPath, 0x01)
+/*
+FOLDER_MANAGER_INTERFACE(IFolderManagerGetIconPath, 0x03)
{
- STDMETHOD(GetIconPath)(const wchar_t *type, BSTR *iconPath) PURE;
};
+*;/
/*
FOLDER_INTERFACE(IFolderExtract, 0x05, 0x0A);
diff --git a/CPP/7zip/FileManager/MyLoadMenu.cpp b/CPP/7zip/FileManager/MyLoadMenu.cpp
index 8be1e28f..41b0ace0 100755
--- a/CPP/7zip/FileManager/MyLoadMenu.cpp
+++ b/CPP/7zip/FileManager/MyLoadMenu.cpp
@@ -12,7 +12,7 @@
#include "resource.h"
#include "App.h"
#include "Resource/AboutDialog/AboutDialog.h"
-#include "Resource/BenchmarkDialog/BenchmarkDialog.h"
+#include "../UI/Common/CompressCall.h"
#include "HelpUtils.h"
#include "LangUtils.h"
@@ -662,7 +662,7 @@ bool OnMenuCommand(HWND hWnd, int id)
break;
case IDM_BENCHMARK:
- Benchmark(hWnd);
+ Benchmark();
break;
// Help
case IDM_HELP_CONTENTS:
diff --git a/CPP/7zip/FileManager/PanelCrc.cpp b/CPP/7zip/FileManager/PanelCrc.cpp
index 12dcee55..7a190840 100755
--- a/CPP/7zip/FileManager/PanelCrc.cpp
+++ b/CPP/7zip/FileManager/PanelCrc.cpp
@@ -4,8 +4,12 @@
#include "resource.h"
-#include "Common/Alloc.h"
-#include "Common/CRC.h"
+extern "C"
+{
+ #include "../../../C/Alloc.h"
+ #include "../../../C/7zCrc.h"
+}
+
#include "Common/IntToString.h"
#include "Common/StringConvert.h"
@@ -194,7 +198,7 @@ struct CThreadCrc
if (!filled)
break;
- CCRC crc;
+ UInt32 crc = CRC_INIT_VAL;
if (fileInfo.IsDirectory())
NumFolders++;
else
@@ -221,21 +225,21 @@ struct CThreadCrc
}
if (processedSize == 0)
break;
- crc.Update(buffer, processedSize);
+ crc = CrcUpdate(crc, buffer, processedSize);
DataSize += processedSize;
Result = ProgressDialog->ProgressSynch.SetPosAndCheckPaused(DataSize);
if (Result != S_OK)
return;
}
- DataCrcSum += crc.GetDigest();
+ DataCrcSum += CRC_GET_DIGEST(crc);
}
for (int i = 0; i < resPath.Length(); i++)
{
wchar_t c = resPath[i];
- crc.UpdateByte((Byte)(c & 0xFF));
- crc.UpdateByte((Byte)((c >> 8) & 0xFF));
+ crc = CRC_UPDATE_BYTE(crc, ((Byte)(c & 0xFF)));
+ crc = CRC_UPDATE_BYTE(crc, ((Byte)((c >> 8) & 0xFF)));
}
- DataNameCrcSum += crc.GetDigest();
+ DataNameCrcSum += CRC_GET_DIGEST(crc);
Result = ProgressDialog->ProgressSynch.SetPosAndCheckPaused(DataSize);
if (Result != S_OK)
return;
diff --git a/CPP/7zip/FileManager/PanelSplitFile.cpp b/CPP/7zip/FileManager/PanelSplitFile.cpp
index 8e095628..7d4309d8 100755
--- a/CPP/7zip/FileManager/PanelSplitFile.cpp
+++ b/CPP/7zip/FileManager/PanelSplitFile.cpp
@@ -4,7 +4,11 @@
#include "resource.h"
-#include "Common/Alloc.h"
+extern "C"
+{
+ #include "../../../C/Alloc.h"
+}
+
#include "Common/Types.h"
#include "Common/IntToString.h"
diff --git a/CPP/7zip/FileManager/PhysDriveFolder.cpp b/CPP/7zip/FileManager/PhysDriveFolder.cpp
index b69d3cb3..fc5045eb 100755
--- a/CPP/7zip/FileManager/PhysDriveFolder.cpp
+++ b/CPP/7zip/FileManager/PhysDriveFolder.cpp
@@ -2,10 +2,12 @@
#include "StdAfx.h"
-#include "PhysDriveFolder.h"
-
-#include "Common/Alloc.h"
+extern "C"
+{
+ #include "../../../C/Alloc.h"
+}
+#include "PhysDriveFolder.h"
#include "Windows/PropVariant.h"
#include "Windows/FileDevice.h"
#include "Windows/FileSystem.h"
@@ -22,12 +24,6 @@ static STATPROPSTG kProperties[] =
{ NULL, kpidSize, VT_UI8}
};
-CPhysDriveFolder::~CPhysDriveFolder()
-{
- if (_buffer != 0)
- MyFree(_buffer);
-}
-
HRESULT CPhysDriveFolder::Init(const UString &path)
{
_prefix = L"\\\\.\\";
@@ -186,6 +182,65 @@ HRESULT CPhysDriveFolder::GetLength(UInt64 &length) const
return S_OK;
}
+struct CPhysTempBuffer
+{
+ void *buffer;
+ CPhysTempBuffer(): buffer(0) {}
+ ~CPhysTempBuffer() { MyFree(buffer); }
+};
+
+HRESULT CopyFileSpec(LPCWSTR fromPath, LPCWSTR toPath, bool writeToDisk, UInt64 fileSize, UInt32 bufferSize, IProgress *progress)
+{
+ NFile::NIO::CInFile inFile;
+ if (!inFile.Open(fromPath))
+ return GetLastError();
+ if (fileSize == (UInt64)(Int64)-1)
+ {
+ if (!inFile.GetLength(fileSize))
+ ::GetLastError();
+ }
+ NFile::NIO::COutFile outFile;
+ if (writeToDisk)
+ {
+ if (!outFile.Open(toPath, FILE_SHARE_WRITE, OPEN_EXISTING, 0))
+ return GetLastError();
+ }
+ else
+ if (!outFile.Create(toPath, true))
+ return GetLastError();
+ CPhysTempBuffer tempBuffer;
+ tempBuffer.buffer = MyAlloc(bufferSize);
+ if (tempBuffer.buffer == 0)
+ return E_OUTOFMEMORY;
+
+ for (UInt64 pos = 0; pos < fileSize;)
+ {
+ RINOK(progress->SetCompleted(&pos));
+ UInt64 rem = fileSize - pos;
+ UInt32 curSize = (UInt32)MyMin(rem, (UInt64)bufferSize);
+ UInt32 processedSize;
+ if (!inFile.Read(tempBuffer.buffer, curSize, processedSize))
+ return GetLastError();
+ if (processedSize == 0)
+ break;
+ curSize = processedSize;
+ if (writeToDisk)
+ {
+ const UInt32 kMask = 0x1FF;
+ curSize = (curSize + kMask) & ~kMask;
+ if (curSize > bufferSize)
+ return E_FAIL;
+ }
+
+ if (!outFile.Write(tempBuffer.buffer, curSize, processedSize))
+ return GetLastError();
+ if (curSize != processedSize)
+ return E_FAIL;
+ pos += curSize;
+ }
+ return S_OK;
+}
+
STDMETHODIMP CPhysDriveFolder::CopyTo(const UInt32 * /* indices */, UInt32 numItems,
const wchar_t *path, IFolderOperationsExtractCallback *callback)
{
@@ -217,41 +272,9 @@ STDMETHODIMP CPhysDriveFolder::CopyTo(const UInt32 * /* indices */, UInt32 numIt
return S_OK;
RINOK(callback->SetCurrentFilePath(GetFullPathWithName()));
-
- NFile::NDevice::CInFile inFile;
- if (!inFile.Open(GetFullPath()))
- return GetLastError();
- NFile::NIO::COutFile outFile;
- if (!outFile.Create(destPathResult, true))
- return GetLastError();
- if (_buffer == 0)
- {
- _buffer = MyAlloc(kBufferSize);
- if (_buffer == 0)
- return E_OUTOFMEMORY;
- }
- UInt64 pos = 0;
- UInt32 bufferSize = kBufferSize;
- if (_driveType == DRIVE_REMOVABLE)
- bufferSize = (18 << 10) * 4;
- pos = 0;
- while(pos < fileSize)
- {
- RINOK(callback->SetCompleted(&pos));
- UInt32 curSize = (UInt32)MyMin(fileSize - pos, (UInt64)bufferSize);
- UInt32 processedSize;
- if (!inFile.Read(_buffer, curSize, processedSize))
- return GetLastError();
- if (processedSize == 0)
- break;
- curSize = processedSize;
- if (!outFile.Write(_buffer, curSize, processedSize))
- return GetLastError();
- if (curSize != processedSize)
- return E_FAIL;
- pos += curSize;
- }
- return S_OK;
+
+ UInt32 bufferSize = (_driveType == DRIVE_REMOVABLE) ? (18 << 10) * 4 : kBufferSize;
+ return CopyFileSpec(GetFullPath(), destPathResult, false, fileSize, bufferSize, callback);
}
/////////////////////////////////////////////////
@@ -267,8 +290,16 @@ STDMETHODIMP CPhysDriveFolder::MoveTo(
}
STDMETHODIMP CPhysDriveFolder::CopyFrom(
- const wchar_t * /* fromFolderPath */,
- const wchar_t ** /* itemsPaths */, UInt32 /* numItems */, IProgress * /* progress */)
+ const wchar_t * fromFolderPath,
+ const wchar_t ** itemsPaths, UInt32 numItems, IProgress *callback)
{
- return E_NOTIMPL;
+ if (numItems == 0)
+ return S_OK;
+ if (numItems != 1)
+ return E_INVALIDARG;
+ if (_driveType != DRIVE_REMOVABLE /* && _driveType != DRIVE_CDROM */)
+ return E_NOTIMPL;
+ UInt32 bufferSize = (_driveType == DRIVE_REMOVABLE) ? (18 << 10) * 4 : kBufferSize;
+ // MessageBoxW(0, fromFolderPath, itemsPaths[0], 0);
+ return CopyFileSpec((UString)fromFolderPath + itemsPaths[0], GetFullPath(), true, (UInt64)(Int64)-1, bufferSize, callback);
}
diff --git a/CPP/7zip/FileManager/PhysDriveFolder.h b/CPP/7zip/FileManager/PhysDriveFolder.h
index 076b0718..db339af4 100755
--- a/CPP/7zip/FileManager/PhysDriveFolder.h
+++ b/CPP/7zip/FileManager/PhysDriveFolder.h
@@ -73,7 +73,6 @@ private:
UString GetFullPath() const { return _prefix + _path; }
UString GetFullPathWithName() const { return GetFullPath() + L'\\' + _name; }
CMyComPtr<IFolderFolder> _parentFolder;
- void *_buffer;
UINT _driveType;
DISK_GEOMETRY geom;
@@ -82,8 +81,6 @@ private:
public:
HRESULT Init(const UString &path);
HRESULT GetLength(UInt64 &size) const;
- CPhysDriveFolder(): _buffer(0) {}
- ~CPhysDriveFolder();
};
#endif
diff --git a/CPP/7zip/FileManager/RegistryAssociations.cpp b/CPP/7zip/FileManager/RegistryAssociations.cpp
index b4b35c67..fe5cfae8 100755
--- a/CPP/7zip/FileManager/RegistryAssociations.cpp
+++ b/CPP/7zip/FileManager/RegistryAssociations.cpp
@@ -5,6 +5,8 @@
#include "RegistryAssociations.h"
#include "Common/StringConvert.h"
+#include "Common/IntToString.h"
+#include "Common/StringToInt.h"
#include "Windows/COM.h"
#include "Windows/Synchronization.h"
@@ -114,8 +116,10 @@ static CSysString GetExtProgramKeyName(const CSysString &extension)
return CSysString(TEXT("7-Zip.")) + extension;
}
-static bool CheckShellExtensionInfo2(const CSysString &extension)
+static bool CheckShellExtensionInfo2(const CSysString &extension, UString &iconPath, int &iconIndex)
{
+ iconIndex = -1;
+ iconPath.Empty();
NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
CKey extKey;
if (extKey.Open(HKEY_CLASSES_ROOT, GetExtensionKeyName(extension), KEY_READ) != ERROR_SUCCESS)
@@ -124,13 +128,34 @@ static bool CheckShellExtensionInfo2(const CSysString &extension)
if (extKey.QueryValue(NULL, programNameValue) != ERROR_SUCCESS)
return false;
CSysString extProgramKeyName = GetExtProgramKeyName(extension);
- return (programNameValue.CompareNoCase(extProgramKeyName) == 0);
+ if (programNameValue.CompareNoCase(extProgramKeyName) != 0)
+ return false;
+ CKey iconKey;
+ if (extKey.Open(HKEY_CLASSES_ROOT, extProgramKeyName + CSysString(TEXT('\\')) + kDefaultIconKeyName, KEY_READ) != ERROR_SUCCESS)
+ return false;
+ UString value;
+ if (extKey.QueryValue(NULL, value) == ERROR_SUCCESS)
+ {
+ int pos = value.ReverseFind(L',');
+ iconPath = value;
+ if (pos >= 0)
+ {
+ const wchar_t *end;
+ UInt64 index = ConvertStringToUInt64((const wchar_t *)value + pos + 1, &end);
+ if (*end == 0)
+ {
+ iconIndex = (int)index;
+ iconPath = value.Left(pos);
+ }
+ }
+ }
+ return true;
}
-bool CheckShellExtensionInfo(const CSysString &extension)
+bool CheckShellExtensionInfo(const CSysString &extension, UString &iconPath, int &iconIndex)
{
NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
- if (!CheckShellExtensionInfo2(extension))
+ if (!CheckShellExtensionInfo2(extension, iconPath, iconIndex))
return false;
CKey extProgKey;
return (extProgKey.Open(HKEY_CLASSES_ROOT, GetExtProgramKeyName(extension), KEY_READ) == ERROR_SUCCESS);
@@ -156,7 +181,9 @@ static void DeleteShellExtensionProgramKey(const CSysString &extension)
void DeleteShellExtensionInfo(const CSysString &extension)
{
- if (CheckShellExtensionInfo2(extension))
+ UString iconPath;
+ int iconIndex;
+ if (CheckShellExtensionInfo2(extension, iconPath, iconIndex))
DeleteShellExtensionKey(extension);
DeleteShellExtensionProgramKey(extension);
}
@@ -164,7 +191,7 @@ void DeleteShellExtensionInfo(const CSysString &extension)
void AddShellExtensionInfo(const CSysString &extension,
const UString &programTitle,
const UString &programOpenCommand,
- const UString &iconPath,
+ const UString &iconPath, int iconIndex,
const void *shellNewData, int shellNewDataSize)
{
DeleteShellExtensionKey(extension);
@@ -188,7 +215,15 @@ void AddShellExtensionInfo(const CSysString &extension,
{
CKey iconKey;
iconKey.Create(programKey, kDefaultIconKeyName);
- iconKey.SetValue(NULL, iconPath);
+ UString iconPathFull = iconPath;
+ if (iconIndex >= 0)
+ {
+ iconPathFull += L",";
+ wchar_t s[32];
+ ConvertUInt64ToString((UInt64)iconIndex, s);
+ iconPathFull += s;
+ }
+ iconKey.SetValue(NULL, iconPathFull);
}
CKey shellKey;
diff --git a/CPP/7zip/FileManager/RegistryAssociations.h b/CPP/7zip/FileManager/RegistryAssociations.h
index c225aca4..91613f79 100755
--- a/CPP/7zip/FileManager/RegistryAssociations.h
+++ b/CPP/7zip/FileManager/RegistryAssociations.h
@@ -18,7 +18,7 @@ namespace NRegistryAssociations {
void ReadInternalAssociations(CObjectVector<CExtInfo> &items);
void WriteInternalAssociations(const CObjectVector<CExtInfo> &items);
- bool CheckShellExtensionInfo(const CSysString &extension);
+ bool CheckShellExtensionInfo(const CSysString &extension, UString &iconPath, int &iconIndex);
// void ReadCompressionInfo(NZipSettings::NCompression::CInfo &anInfo,
void DeleteShellExtensionInfo(const CSysString &extension);
@@ -26,7 +26,7 @@ namespace NRegistryAssociations {
void AddShellExtensionInfo(const CSysString &extension,
const UString &programTitle,
const UString &programOpenCommand,
- const UString &iconPath,
+ const UString &iconPath, int iconIndex,
const void *shellNewData, int shellNewDataSize);
diff --git a/CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp b/CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp
deleted file mode 100755
index 1083fc4c..00000000
--- a/CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.cpp
+++ /dev/null
@@ -1,976 +0,0 @@
-// BenchmarkDialog.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringToInt.h"
-#include "Common/Exception.h"
-#include "Common/Alloc.h"
-#include "Windows/Thread.h"
-#include "Windows/PropVariant.h"
-#include "Windows/Error.h"
-#include "Windows/DLL.h"
-#include "Windows/FileFind.h"
-#include "../../ProgramLocation.h"
-#include "../../HelpUtils.h"
-#include "../../../Common/StreamObjects.h"
-#include "resource.h"
-#include "BenchmarkDialog.h"
-#include "Common/CRC.h"
-
-using namespace NWindows;
-
-static LPCWSTR kHelpTopic = L"fm/benchmark.htm";
-
-static const UINT_PTR kTimerID = 4;
-static const UINT kTimerElapse = 1000;
-
-static const UInt32 kAdditionalSize = (6 << 20);
-static const UInt32 kCompressedAdditionalSize = (1 << 10);
-static const int kSubBits = 8;
-
-#ifdef LANG
-#include "../../LangUtils.h"
-#endif
-
-using namespace NWindows;
-
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDC_BENCHMARK_DICTIONARY, 0x02000D0C },
- { IDC_BENCHMARK_MEMORY, 0x03080001 },
- { IDC_BENCHMARK_MULTITHREADING, 0x02000D09 },
- { IDC_BENCHMARK_SPEED_LABEL, 0x03080004 },
- { IDC_BENCHMARK_RATING_LABEL, 0x03080005 },
- { IDC_BENCHMARK_COMPRESSING, 0x03080002 },
- { IDC_BENCHMARK_DECOMPRESSING, 0x03080003 },
- { IDC_BENCHMARK_CURRENT, 0x03080007 },
- { IDC_BENCHMARK_RESULTING, 0x03080008 },
- { IDC_BENCHMARK_CURRENT2, 0x03080007 },
- { IDC_BENCHMARK_RESULTING2, 0x03080008 },
- { IDC_BENCHMARK_TOTAL_RATING, 0x03080006 },
- { IDC_BENCHMARK_ELAPSED, 0x02000C01 },
- { IDC_BENCHMARK_SIZE, 0x02000C03 },
- { IDC_BENCHMARK_PASSES, 0x03080009 },
- { IDC_BENCHMARK_ERRORS, 0x0308000A },
- { IDC_BUTTON_STOP, 0x02000714 },
- { IDC_BUTTON_RESTART, 0x02000715 },
- { IDHELP, 0x02000720 },
- { IDCANCEL, 0x02000710 }
-};
-#endif
-
-static void MyMessageBoxError(HWND hwnd, LPCWSTR message)
-{
- MessageBoxW(hwnd, message, L"7-Zip", MB_ICONERROR);
-}
-
-UInt64 GetTimeCount()
-{
- return GetTickCount();
- /*
- LARGE_INTEGER value;
- if (::QueryPerformanceCounter(&value))
- return value.QuadPart;
- return GetTickCount();
- */
-}
-
-UInt64 GetFreq()
-{
- return 1000;
- /*
- LARGE_INTEGER value;
- if (::QueryPerformanceFrequency(&value))
- return value.QuadPart;
- return 1000;
- */
-}
-
-class CRandomGenerator
-{
- UInt32 A1;
- UInt32 A2;
-public:
- CRandomGenerator() { Init(); }
- void Init() { A1 = 362436069; A2 = 521288629;}
- UInt32 GetRnd()
- {
- return
- ((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) ^
- ((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)) );
- }
-};
-
-class CBitRandomGenerator
-{
- CRandomGenerator RG;
- UInt32 Value;
- int NumBits;
-public:
- void Init()
- {
- Value = 0;
- NumBits = 0;
- }
- UInt32 GetRnd(int numBits)
- {
- if (NumBits > numBits)
- {
- UInt32 result = Value & ((1 << numBits) - 1);
- Value >>= numBits;
- NumBits -= numBits;
- return result;
- }
- numBits -= NumBits;
- UInt32 result = (Value << numBits);
- Value = RG.GetRnd();
- result |= Value & ((1 << numBits) - 1);
- Value >>= numBits;
- NumBits = 32 - numBits;
- return result;
- }
-};
-
-class CBenchRandomGenerator
-{
- CBitRandomGenerator RG;
- UInt32 Pos;
- UInt32 Rep0;
-public:
- UInt32 BufferSize;
- Byte *Buffer;
- CBenchRandomGenerator(): Buffer(0) {}
- ~CBenchRandomGenerator() { Free(); }
- void Free()
- {
- ::MidFree(Buffer);
- Buffer = 0;
- }
- bool Alloc(UInt32 bufferSize)
- {
- if (Buffer != 0 && BufferSize == bufferSize)
- return true;
- Free();
- Buffer = (Byte *)::MidAlloc(bufferSize);
- Pos = 0;
- BufferSize = bufferSize;
- return (Buffer != 0);
- }
- UInt32 GetRndBit() { return RG.GetRnd(1); }
- /*
- UInt32 GetLogRand(int maxLen)
- {
- UInt32 len = GetRnd() % (maxLen + 1);
- return GetRnd() & ((1 << len) - 1);
- }
- */
- UInt32 GetLogRandBits(int numBits)
- {
- UInt32 len = RG.GetRnd(numBits);
- return RG.GetRnd(len);
- }
- UInt32 GetOffset()
- {
- if (GetRndBit() == 0)
- return GetLogRandBits(4);
- return (GetLogRandBits(4) << 10) | RG.GetRnd(10);
- }
- UInt32 GetLen1() { return RG.GetRnd(1 + RG.GetRnd(2)); }
- UInt32 GetLen2() { return RG.GetRnd(2 + RG.GetRnd(2)); }
- void Generate()
- {
- RG.Init();
- Rep0 = 1;
- while(Pos < BufferSize)
- {
- if (GetRndBit() == 0 || Pos < 1)
- Buffer[Pos++] = Byte(RG.GetRnd(8));
- else
- {
- UInt32 len;
- if (RG.GetRnd(3) == 0)
- len = 1 + GetLen1();
- else
- {
- do
- Rep0 = GetOffset();
- while (Rep0 >= Pos);
- Rep0++;
- len = 2 + GetLen2();
- }
- for (UInt32 i = 0; i < len && Pos < BufferSize; i++, Pos++)
- Buffer[Pos] = Buffer[Pos - Rep0];
- }
- }
- }
-};
-
-const LPCTSTR kProcessingString = TEXT("...");
-const LPCTSTR kMB = TEXT(" MB");
-const LPCTSTR kMIPS = TEXT(" MIPS");
-const LPCTSTR kKBs = TEXT(" KB/s");
-
-bool CBenchmarkDialog::OnInit()
-{
- #ifdef LANG
- LangSetWindowText(HWND(*this), 0x03080000);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- #endif
-
- m_Dictionary.Attach(GetItem(IDC_BENCHMARK_COMBO_DICTIONARY));
- for (int i = kNumBenchDictionaryBitsStart; i <= 30; i++)
- for (int j = 0; j < 2; j++)
- {
- UInt32 dictionary = (1 << i) + (j << (i - 1));
- if(dictionary >
- #ifdef _WIN64
- (1 << 30)
- #else
- (1 << 27)
- #endif
- )
- continue;
- TCHAR s[40];
- ConvertUInt64ToString((dictionary >> 20), s);
- lstrcat(s, kMB);
- int index = (int)m_Dictionary.AddString(s);
- m_Dictionary.SetItemData(index, dictionary);
- }
- m_Dictionary.SetCurSel(0);
- OnChangeSettings();
-
- _syncInfo.Init();
- _syncInfo.InitSettings();
-
- _syncInfo._startEvent.Set();
- _timer = SetTimer(kTimerID, kTimerElapse);
- return CModalDialog::OnInit();
-}
-
-static UInt64 GetLZMAUsage(UInt32 dictionary)
-{
- UInt32 hs = dictionary - 1;
- hs |= (hs >> 1);
- hs |= (hs >> 2);
- hs |= (hs >> 4);
- hs |= (hs >> 8);
- hs >>= 1;
- hs |= 0xFFFF;
- if (hs > (1 << 24))
- hs >>= 1;
- hs++;
- return ((hs + (1 << 16)) + (UInt64)dictionary * 2) * 4 + (UInt64)dictionary * 3 / 2 + (1 << 20);
-}
-
-static UInt64 GetMemoryUsage(UInt32 dictionary, bool mtMode)
-{
- const UInt32 kBufferSize = dictionary + kAdditionalSize;
- const UInt32 kCompressedBufferSize = (kBufferSize / 2) + kCompressedAdditionalSize;
- return (mtMode ? (6 << 20) : 0 )+ kBufferSize + kCompressedBufferSize +
- GetLZMAUsage(dictionary) + dictionary + (2 << 20);
-}
-
-UInt32 CBenchmarkDialog::OnChangeDictionary()
-{
- UInt32 dictionary = (UInt32)m_Dictionary.GetItemData(m_Dictionary.GetCurSel());
- UInt64 memUsage = GetMemoryUsage(dictionary, IsButtonCheckedBool(IDC_BENCHMARK_MULTITHREADING));
- memUsage = (memUsage + (1 << 20) - 1) >> 20;
- TCHAR s[40];
- ConvertUInt64ToString(memUsage, s);
- lstrcat(s, kMB);
- SetItemText(IDC_BENCHMARK_MEMORY_VALUE, s);
- return dictionary;
-}
-
-void CBenchmarkDialog::OnChangeSettings()
-{
- EnableItem(IDC_BUTTON_STOP, true);
- UInt32 dictionary = OnChangeDictionary();
- SetItemText(IDC_BENCHMARK_COMPRESSING_SPEED, kProcessingString);
- SetItemText(IDC_BENCHMARK_COMPRESSING_SPEED2, kProcessingString);
- SetItemText(IDC_BENCHMARK_COMPRESSING_RATING, kProcessingString);
- SetItemText(IDC_BENCHMARK_COMPRESSING_RATING2, kProcessingString);
- SetItemText(IDC_BENCHMARK_DECOMPRESSING_SPEED, kProcessingString);
- SetItemText(IDC_BENCHMARK_DECOMPRESSING_SPEED2, kProcessingString);
- SetItemText(IDC_BENCHMARK_DECOMPRESSING_RATING, kProcessingString);
- SetItemText(IDC_BENCHMARK_DECOMPRESSING_RATING2, kProcessingString);
- SetItemText(IDC_BENCHMARK_TOTAL_RATING_VALUE, kProcessingString);
- _startTime = GetTickCount();
- PrintTime();
- NWindows::NSynchronization::CCriticalSectionLock lock(_syncInfo.CS);
- _syncInfo.Init();
- _syncInfo.DictionarySize = dictionary;
- _syncInfo.Changed = true;
- _syncInfo.MultiThread = IsButtonCheckedBool(IDC_BENCHMARK_MULTITHREADING);
-}
-
-void CBenchmarkDialog::OnRestartButton()
-{
- OnChangeSettings();
-}
-
-void CBenchmarkDialog::OnStopButton()
-{
- EnableItem(IDC_BUTTON_STOP, false);
- _syncInfo.Pause();
-}
-
-void CBenchmarkDialog::OnHelp()
-{
- ShowHelpWindow(NULL, kHelpTopic);
-}
-
-void CBenchmarkDialog::OnCancel()
-{
- _syncInfo.Stop();
- KillTimer(_timer);
- CModalDialog::OnCancel();
-}
-
-static void GetTimeString(UInt64 timeValue, TCHAR *s)
-{
- wsprintf(s, TEXT("%02d:%02d:%02d"),
- UInt32(timeValue / 3600),
- UInt32((timeValue / 60) % 60),
- UInt32(timeValue % 60));
-}
-
-void CBenchmarkDialog::PrintTime()
-{
- UInt32 curTime = ::GetTickCount();
- UInt32 elapsedTime = (curTime - _startTime);
- UInt32 elapsedSec = elapsedTime / 1000;
- TCHAR s[40];
- GetTimeString(elapsedSec, s);
- SetItemText(IDC_BENCHMARK_ELAPSED_VALUE, s);
-}
-
-static UInt32 GetLogSize(UInt32 size)
-{
- for (int i = kSubBits; i < 32; i++)
- for (UInt32 j = 0; j < (1 << kSubBits); j++)
- if (size <= (((UInt32)1) << i) + (j << (i - kSubBits)))
- return (i << kSubBits) + j;
- return (32 << kSubBits);
-}
-
-static UInt64 GetCompressRating(UInt32 dictionarySize,
- UInt64 elapsedTime, UInt64 size)
-{
- if (elapsedTime == 0)
- elapsedTime = 1;
- UInt64 t = GetLogSize(dictionarySize) - (18 << kSubBits);
- UInt64 numCommandsForOne = 1060 + ((t * t * 10) >> (2 * kSubBits));
- UInt64 numCommands = (UInt64)(size) * numCommandsForOne;
- return numCommands * GetFreq() / elapsedTime;
-}
-
-static UInt64 GetDecompressRating(UInt64 elapsedTime,
- UInt64 outSize, UInt64 inSize)
-{
- if (elapsedTime == 0)
- elapsedTime = 1;
- UInt64 numCommands = inSize * 220 + outSize * 20;
- return numCommands * GetFreq() / elapsedTime;
-}
-
-static UInt64 GetTotalRating(
- UInt32 dictionarySize,
- UInt64 elapsedTimeEn, UInt64 sizeEn,
- UInt64 elapsedTimeDe,
- UInt64 inSizeDe, UInt64 outSizeDe)
-{
- return (GetCompressRating(dictionarySize, elapsedTimeEn, sizeEn) +
- GetDecompressRating(elapsedTimeDe, inSizeDe, outSizeDe)) / 2;
-}
-
-void CBenchmarkDialog::PrintRating(UInt64 rating, UINT controlID)
-{
- TCHAR s[40];
- ConvertUInt64ToString(rating / 1000000, s);
- lstrcat(s, kMIPS);
- SetItemText(controlID, s);
-}
-
-void CBenchmarkDialog::PrintResults(
- UInt32 dictionarySize,
- UInt64 elapsedTime,
- UInt64 size, UINT speedID, UINT ratingID,
- bool decompressMode, UInt64 secondSize)
-{
- TCHAR s[40];
- UInt64 speed = size * GetFreq() / elapsedTime;
- ConvertUInt64ToString(speed / 1024, s);
- lstrcat(s, kKBs);
- SetItemText(speedID, s);
- UInt64 rating;
- if (decompressMode)
- rating = GetDecompressRating(elapsedTime, size, secondSize);
- else
- rating = GetCompressRating(dictionarySize, elapsedTime, size);
- PrintRating(rating, ratingID);
-}
-
-bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
-{
- PrintTime();
- NWindows::NSynchronization::CCriticalSectionLock lock(_syncInfo.CS);
-
- TCHAR s[40];
- ConvertUInt64ToString((_syncInfo.ProcessedSize >> 20), s);
- lstrcat(s, kMB);
- SetItemText(IDC_BENCHMARK_SIZE_VALUE, s);
-
- ConvertUInt64ToString(_syncInfo.NumPasses, s);
- SetItemText(IDC_BENCHMARK_PASSES_VALUE, s);
-
- ConvertUInt64ToString(_syncInfo.NumErrors, s);
- SetItemText(IDC_BENCHMARK_ERRORS_VALUE, s);
-
- UInt64 elapsedTime = _syncInfo.CompressingInfoTemp.Time;
- if (elapsedTime >= 1)
- {
- UInt32 dicSizeTemp = (UInt32)MyMax(_syncInfo.ProcessedSize, UInt64(1) << 20);
- dicSizeTemp = MyMin(dicSizeTemp, _syncInfo.DictionarySize),
- PrintResults(dicSizeTemp, elapsedTime,
- _syncInfo.CompressingInfoTemp.InSize,
- IDC_BENCHMARK_COMPRESSING_SPEED,
- IDC_BENCHMARK_COMPRESSING_RATING);
- }
-
- if (_syncInfo.CompressingInfo.Time >= 1)
- {
- PrintResults(
- _syncInfo.DictionarySize,
- _syncInfo.CompressingInfo.Time,
- _syncInfo.CompressingInfo.InSize,
- IDC_BENCHMARK_COMPRESSING_SPEED2,
- IDC_BENCHMARK_COMPRESSING_RATING2);
- }
-
- if (_syncInfo.DecompressingInfoTemp.Time >= 1)
- {
- PrintResults(
- _syncInfo.DictionarySize,
- _syncInfo.DecompressingInfoTemp.Time,
- _syncInfo.DecompressingInfoTemp.OutSize,
- IDC_BENCHMARK_DECOMPRESSING_SPEED,
- IDC_BENCHMARK_DECOMPRESSING_RATING,
- true,
- _syncInfo.DecompressingInfoTemp.InSize);
- }
- if (_syncInfo.DecompressingInfo.Time >= 1)
- {
- PrintResults(
- _syncInfo.DictionarySize,
- _syncInfo.DecompressingInfo.Time,
- _syncInfo.DecompressingInfo.OutSize,
- IDC_BENCHMARK_DECOMPRESSING_SPEED2,
- IDC_BENCHMARK_DECOMPRESSING_RATING2,
- true,
- _syncInfo.DecompressingInfo.InSize);
- if (_syncInfo.CompressingInfo.Time >= 1)
- {
- PrintRating(GetTotalRating(
- _syncInfo.DictionarySize,
- _syncInfo.CompressingInfo.Time,
- _syncInfo.CompressingInfo.InSize,
- _syncInfo.DecompressingInfo.Time,
- _syncInfo.DecompressingInfo.OutSize,
- _syncInfo.DecompressingInfo.InSize),
- IDC_BENCHMARK_TOTAL_RATING_VALUE);
- }
- }
- return true;
-}
-
-bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam)
-{
- if (code == CBN_SELCHANGE && itemID == IDC_BENCHMARK_COMBO_DICTIONARY)
- {
- OnChangeSettings();
- return true;
- }
- return CModalDialog::OnCommand(code, itemID, lParam);
-}
-
-bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
- switch(buttonID)
- {
- case IDC_BUTTON_RESTART:
- OnRestartButton();
- return true;
- case IDC_BUTTON_STOP:
- OnStopButton();
- return true;
- case IDC_BENCHMARK_MULTITHREADING:
- OnChangeSettings();
- return true;
- }
- return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
-}
-
-class CBenchmarkInStream:
- public ISequentialInStream,
- public CMyUnknownImp
-{
- const Byte *Data;
- UInt32 Pos;
- UInt32 Size;
-public:
- MY_UNKNOWN_IMP
- void Init(const Byte *data, UInt32 size)
- {
- Data = data;
- Size = size;
- Pos = 0;
- }
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 remain = Size - Pos;
- if (size > remain)
- size = remain;
- for (UInt32 i = 0; i < size; i++)
- {
- ((Byte *)data)[i] = Data[Pos + i];
- }
- Pos += size;
- if(processedSize != NULL)
- *processedSize = size;
- return S_OK;
-}
-
-class CBenchmarkOutStream:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- UInt32 BufferSize;
-public:
- UInt32 Pos;
- Byte *Buffer;
- CBenchmarkOutStream(): Buffer(0) {}
- ~CBenchmarkOutStream() { Free(); }
- void Free()
- {
- ::MidFree(Buffer);
- Buffer = 0;
- }
-
- bool Alloc(UInt32 bufferSize)
- {
- if (Buffer != 0 && BufferSize == bufferSize)
- return true;
- Free();
- Buffer = (Byte *)::MidAlloc(bufferSize);
- Init();
- BufferSize = bufferSize;
- return (Buffer != 0);
- }
-
- void Init()
- {
- Pos = 0;
- }
-
- MY_UNKNOWN_IMP
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 i;
- for (i = 0; i < size && Pos < BufferSize; i++)
- Buffer[Pos++] = ((const Byte *)data)[i];
- if(processedSize != NULL)
- *processedSize = i;
- if (i != size)
- {
- MessageBoxW(0, L"Buffer is full", L"7-zip error", 0);
- return E_FAIL;
- }
- return S_OK;
-}
-
-class CCompareOutStream:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
-public:
- CCRC CRC;
- MY_UNKNOWN_IMP
- void Init() { CRC.Init(); }
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-STDMETHODIMP CCompareOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- CRC.Update(data, size);
- if(processedSize != NULL)
- *processedSize = size;
- return S_OK;
-}
-
-typedef UInt32 (WINAPI * CreateObjectPointer)(const GUID *clsID,
- const GUID *interfaceID, void **outObject);
-
-struct CDecoderProgressInfo:
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
- CProgressSyncInfo *SyncInfo;
- MY_UNKNOWN_IMP
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-STDMETHODIMP CDecoderProgressInfo::SetRatioInfo(
- const UInt64 * /* inSize */, const UInt64 * /* outSize */)
-{
- NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
- if (SyncInfo->Changed)
- return E_ABORT;
- return S_OK;
-}
-
-struct CThreadBenchmark:
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
- CProgressSyncInfo *SyncInfo;
- UInt64 _startTime;
- UInt64 _approvedStart;
- NDLL::CLibrary Library;
- CMyComPtr<ICompressCoder> Encoder;
- CMyComPtr<ICompressCoder> Decoder;
- HRESULT Process();
- HRESULT Result;
- static DWORD WINAPI MyThreadFunction(void *param)
- {
- ((CThreadBenchmark *)param)->Result = ((CThreadBenchmark *)param)->Process();
- return 0;
- }
- MY_UNKNOWN_IMP
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-HRESULT CThreadBenchmark::Process()
-{
- try
- {
- SyncInfo->WaitCreating();
- CBenchRandomGenerator randomGenerator;
- CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
- Encoder.QueryInterface(IID_ICompressWriteCoderProperties,
- &writeCoderProperties);
- CMyComPtr<ICompressSetDecoderProperties2> compressSetDecoderProperties;
- Decoder.QueryInterface(
- IID_ICompressSetDecoderProperties2, &compressSetDecoderProperties);
- CSequentialOutStreamImp *propStreamSpec = 0;
- CMyComPtr<ISequentialOutStream> propStream;
- if (writeCoderProperties != NULL)
- {
- propStreamSpec = new CSequentialOutStreamImp;
- propStream = propStreamSpec;
- }
-
- CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
- Encoder.QueryInterface(IID_ICompressSetCoderProperties,
- &setCoderProperties);
-
- CDecoderProgressInfo *decoderProgressInfoSpec = new
- CDecoderProgressInfo;
- CMyComPtr<ICompressProgressInfo> decoderProgress = decoderProgressInfoSpec;
- decoderProgressInfoSpec->SyncInfo = SyncInfo;
-
- for (;;)
- {
- if (SyncInfo->WasStopped())
- return 0;
- if (SyncInfo->WasPaused())
- {
- Sleep(200);
- continue;
- }
- UInt32 dictionarySize;
- bool multiThread;
- {
- NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
- dictionarySize = SyncInfo->DictionarySize;
- multiThread = SyncInfo->MultiThread;
- if (SyncInfo->Changed)
- SyncInfo->Init();
- }
-
- const UInt32 kBufferSize = dictionarySize + kAdditionalSize;
- const UInt32 kCompressedBufferSize = (kBufferSize / 2) + kCompressedAdditionalSize;
-
- if (setCoderProperties)
- {
- PROPID propIDs[] =
- {
- NCoderPropID::kDictionarySize,
- NCoderPropID::kMultiThread
- };
- const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]);
- NWindows::NCOM::CPropVariant properties[kNumProps];
- properties[0] = UInt32(dictionarySize);
- properties[1] = bool(multiThread);
- HRESULT res = setCoderProperties->SetCoderProperties(propIDs,
- properties, kNumProps);
- if (res != S_OK)
- {
- // SyncInfo->Pause();
- MessageBox(0, NError::MyFormatMessage(res), TEXT("7-Zip"), MB_ICONERROR);
- return res;
- }
- }
-
- if (propStream)
- {
- propStreamSpec->Init();
- writeCoderProperties->WriteCoderProperties(propStream);
- }
-
- if (!randomGenerator.Alloc(kBufferSize))
- return E_OUTOFMEMORY;
-
- randomGenerator.Generate();
- CCRC crc;
-
- // randomGenerator.BufferSize
- crc.Update(randomGenerator.Buffer, randomGenerator.BufferSize);
-
- {
- NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
- if (SyncInfo->Changed)
- continue;
- }
-
- CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
- CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
- CBenchmarkOutStream *outStreamSpec = new CBenchmarkOutStream;
- CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
- if (!outStreamSpec->Alloc(kCompressedBufferSize))
- return E_OUTOFMEMORY;
-
- {
- // this code is for reducing time of memory allocationg
- inStreamSpec->Init(randomGenerator.Buffer, MyMin((UInt32)1, randomGenerator.BufferSize));
- outStreamSpec->Init();
- /* HRESULT result = */ Encoder->Code(inStream, outStream, 0, 0, NULL);
- }
-
- inStreamSpec->Init(randomGenerator.Buffer, randomGenerator.BufferSize);
- outStreamSpec->Init();
-
- _approvedStart = dictionarySize;
- _startTime = ::GetTimeCount();
- HRESULT result = Encoder->Code(inStream, outStream, 0, 0, this);
- UInt64 tickCount = ::GetTimeCount() - _startTime;
- UInt32 compressedSize = outStreamSpec->Pos;
- {
- NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
- if (result == S_OK)
- {
- if (SyncInfo->ApprovedInfo.InSize != 0)
- {
- SyncInfo->CompressingInfoTemp.InSize = kBufferSize - SyncInfo->ApprovedInfo.InSize;
- SyncInfo->CompressingInfoTemp.OutSize = compressedSize - SyncInfo->ApprovedInfo.OutSize;
- SyncInfo->CompressingInfoTemp.Time = tickCount - SyncInfo->ApprovedInfo.Time;
- if (SyncInfo->CompressingInfo.Time == 0)
- SyncInfo->CompressingInfo = SyncInfo->CompressingInfoTemp;
- }
- }
- SyncInfo->ApprovedInfo.Init();
- }
- if(result != S_OK)
- {
- if (result != E_ABORT)
- {
- SyncInfo->Pause();
- MessageBox(0, NError::MyFormatMessage(result), TEXT("7-Zip"), MB_ICONERROR);
- }
- continue;
- }
- {
- NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
- SyncInfo->NumPasses++;
- }
-
- ///////////////////////
- // Decompressing
-
-
- CCompareOutStream *outCompareStreamSpec = new CCompareOutStream;
- CMyComPtr<ISequentialOutStream> outCompareStream = outCompareStreamSpec;
-
- for (int i = 0; i < 2; i++)
- {
- inStreamSpec->Init(outStreamSpec->Buffer, compressedSize);
- outCompareStreamSpec->Init();
-
- if (compressSetDecoderProperties)
- {
- RINOK(compressSetDecoderProperties->SetDecoderProperties2(
- propStreamSpec->GetBuffer(), (UInt32)propStreamSpec->GetSize()));
- }
-
- UInt64 outSize = kBufferSize;
- UInt64 startTime = ::GetTimeCount();
- result = Decoder->Code(inStream, outCompareStream, 0, &outSize, decoderProgress);
- tickCount = ::GetTimeCount() - startTime;
- {
- NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
- if (result == S_OK)
- {
- SyncInfo->DecompressingInfoTemp.InSize = compressedSize;
- SyncInfo->DecompressingInfoTemp.OutSize = kBufferSize;
- SyncInfo->DecompressingInfoTemp.Time = tickCount;
- if (SyncInfo->DecompressingInfo.Time == 0 && i >= 1)
- SyncInfo->DecompressingInfo = SyncInfo->DecompressingInfoTemp;
- if (outCompareStreamSpec->CRC.GetDigest() != crc.GetDigest())
- {
- SyncInfo->NumErrors++;
- break;
- }
- }
- else
- {
- if(result != E_ABORT)
- {
- SyncInfo->NumErrors++;
- break;
- }
- }
- }
- }
- }
- }
- catch(CSystemException &e)
- {
- MessageBox(0, NError::MyFormatMessage(e.ErrorCode), TEXT("7-Zip"), MB_ICONERROR);
- return E_FAIL;
- }
- catch(...)
- {
- MyMessageBoxError(0, L"Some error");
- return E_FAIL;
- }
-}
-
-STDMETHODIMP CThreadBenchmark::SetRatioInfo(
- const UInt64 *inSize, const UInt64 *outSize)
-{
- NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
- if (SyncInfo->Changed || SyncInfo->WasPaused() || SyncInfo->WasStopped())
- return E_ABORT;
- CProgressInfo ci;
- ci.InSize = *inSize;
- ci.OutSize = *outSize;
- ci.Time = ::GetTimeCount() - _startTime;
- SyncInfo->ProcessedSize = *inSize;
-
- UInt64 deltaTime = ci.Time - SyncInfo->CompressingInfoPrev.Time;
- if (deltaTime >= GetFreq())
- {
- SyncInfo->CompressingInfoTemp.Time = deltaTime;
- SyncInfo->CompressingInfoTemp.InSize = ci.InSize - SyncInfo->CompressingInfoPrev.InSize;
- SyncInfo->CompressingInfoTemp.OutSize = ci.InSize - SyncInfo->CompressingInfoPrev.OutSize;
- SyncInfo->CompressingInfoPrev = ci;
- }
- if (*inSize >= _approvedStart && SyncInfo->ApprovedInfo.InSize == 0)
- SyncInfo->ApprovedInfo = ci;
- return S_OK;
-}
-
-static bool GetCoderPath(UString &path)
-{
- if (!GetProgramFolderPath(path))
- return false;
- path += L"Codecs\\LZMA.dll";
- return true;
-}
-
-typedef UInt32 (WINAPI *GetMethodPropertyFunc)(
- UInt32 index, PROPID propID, PROPVARIANT *value);
-
-static bool LoadCoder(
- const UString &filePath,
- NWindows::NDLL::CLibrary &library,
- CLSID &encoder, CLSID &decoder)
-{
- if (!library.Load(filePath))
- return false;
- GetMethodPropertyFunc getMethodProperty = (GetMethodPropertyFunc)
- library.GetProcAddress("GetMethodProperty");
- if (getMethodProperty == NULL)
- return false;
-
- NWindows::NCOM::CPropVariant propVariant;
- if (getMethodProperty (0, NMethodPropID::kEncoder, &propVariant) != S_OK)
- return false;
- if (propVariant.vt != VT_BSTR)
- return false;
- encoder = *(const GUID *)propVariant.bstrVal;
- propVariant.Clear();
-
- if (getMethodProperty (0, NMethodPropID::kDecoder, &propVariant) != S_OK)
- return false;
- if (propVariant.vt != VT_BSTR)
- return false;
- decoder = *(const GUID *)propVariant.bstrVal;
- propVariant.Clear();
- return true;
-}
-
-void Benchmark(HWND hwnd)
-{
- UString path;
- if (!GetCoderPath(path))
- {
- MyMessageBoxError(hwnd, L"Can't find LZMA.dll");
- return;
- }
- CLSID encoder;
- CLSID decoder;
- CThreadBenchmark benchmarker;
- if (!LoadCoder(path, benchmarker.Library, encoder, decoder))
- {
- MyMessageBoxError(hwnd, L"Can't load LZMA.dll");
- return;
- }
-
- CreateObjectPointer createObject = (CreateObjectPointer)
- benchmarker.Library.GetProcAddress("CreateObject");
- if (createObject == NULL)
- {
- MyMessageBoxError(hwnd, L"Incorrect LZMA.dll");
- return;
- }
- if (createObject(&encoder, &IID_ICompressCoder, (void **)&benchmarker.Encoder) != S_OK)
- {
- MyMessageBoxError(hwnd, L"Can't create codec");
- return;
- }
- if (createObject(&decoder, &IID_ICompressCoder, (void **)&benchmarker.Decoder) != S_OK)
- {
- MyMessageBoxError(hwnd, L"Can't create codec");
- return;
- }
-
- CBenchmarkDialog benchmarkDialog;
- benchmarker.SyncInfo = &benchmarkDialog._syncInfo;
- CThread thread;
- if (!thread.Create(CThreadBenchmark::MyThreadFunction, &benchmarker))
- {
- MyMessageBoxError(hwnd, L"error");
- return;
- }
- benchmarkDialog.Create(hwnd);
- WaitForSingleObject(thread, INFINITE);
-}
diff --git a/CPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp b/CPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp
index ea0f6fd6..81504ca5 100755
--- a/CPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp
+++ b/CPP/7zip/FileManager/Resource/ProgressDialog/ProgressDialog.cpp
@@ -25,12 +25,12 @@ static CIDLangPair kIDLangPairs[] =
#ifndef _SFX
CProgressDialog::~CProgressDialog()
{
- AddToTitle(TEXT(""));
+ AddToTitle(L"");
}
void CProgressDialog::AddToTitle(LPCWSTR s)
{
if (MainWindow != 0)
- ::MySetWindowText(MainWindow, UString(s) + MainTitle);
+ MySetWindowText(MainWindow, UString(s) + MainTitle);
}
#endif
diff --git a/CPP/7zip/FileManager/Resource/SystemPage/SystemPage.cpp b/CPP/7zip/FileManager/Resource/SystemPage/SystemPage.cpp
index ca3b7432..80bed2c3 100755
--- a/CPP/7zip/FileManager/Resource/SystemPage/SystemPage.cpp
+++ b/CPP/7zip/FileManager/Resource/SystemPage/SystemPage.cpp
@@ -9,6 +9,7 @@
#include "Windows/Defs.h"
#include "Windows/Control/ListView.h"
+#include "Windows/FileFind.h"
#include "../../IFolder.h"
#include "../../HelpUtils.h"
@@ -85,7 +86,11 @@ bool CSystemPage::OnInit()
item.iSubItem = 0;
int itemIndex = _listViewExt.InsertItem(&item);
- extInfo.Associated = NRegistryAssociations::CheckShellExtensionInfo(GetSystemString(extInfo.Ext));
+ UString iconPath;
+ int iconIndex;
+ extInfo.Associated = NRegistryAssociations::CheckShellExtensionInfo(GetSystemString(extInfo.Ext), iconPath, iconIndex);
+ if (extInfo.Associated && !NWindows::NFile::NFind::DoesFileExist(iconPath))
+ extInfo.Associated = false;
_listViewExt.SetCheckState(itemIndex, extInfo.Associated);
SetMainPluginText(itemIndex, i);
@@ -125,33 +130,29 @@ static UString GetProgramCommand()
}
static UString GetIconPath(const UString &filePath,
- const CLSID &clsID, const UString &extension)
+ const CLSID &clsID, const UString &extension, Int32 &iconIndex)
{
CPluginLibrary library;
CMyComPtr<IFolderManager> folderManager;
CMyComPtr<IFolderFolder> folder;
if (library.LoadAndCreateManager(filePath, clsID, &folderManager) != S_OK)
return UString();
- CMyComBSTR typesString;
- if (folderManager->GetTypes(&typesString) != S_OK)
+ CMyComBSTR extBSTR;
+ if (folderManager->GetExtensions(&extBSTR) != S_OK)
return UString();
- UStringVector types;
- SplitString((const wchar_t *)typesString, types);
- for (int typeIndex = 0; typeIndex < types.Size(); typeIndex++)
+ const UString ext2 = (const wchar_t *)extBSTR;
+ UStringVector exts;
+ SplitString(ext2, exts);
+ for (int i = 0; i < exts.Size(); i++)
{
- const UString &type = types[typeIndex];
- CMyComBSTR extTemp;
- if (folderManager->GetExtension(type, &extTemp) != S_OK)
- continue;
- if (extension.CompareNoCase((const wchar_t *)extTemp) == 0)
+ const UString &plugExt = exts[i];
+ if (extension.CompareNoCase((const wchar_t *)plugExt) == 0)
{
- CMyComPtr<IFolderManagerGetIconPath> getIconPath;
- if (folderManager.QueryInterface(IID_IFolderManagerGetIconPath, &getIconPath) != S_OK)
- break;
CMyComBSTR iconPathTemp;
- if (getIconPath->GetIconPath(type, &iconPathTemp) != S_OK)
+ if (folderManager->GetIconPath(plugExt, &iconPathTemp, &iconIndex) != S_OK)
break;
- return (const wchar_t *)iconPathTemp;
+ if (iconPathTemp != 0)
+ return (const wchar_t *)iconPathTemp;
}
}
return UString();
@@ -171,16 +172,14 @@ LONG CSystemPage::OnApply()
UString title = extInfo.Ext + UString(L" Archive");
UString command = GetProgramCommand();
UString iconPath;
+ Int32 iconIndex = -1;
if (!extInfo.PluginsPairs.IsEmpty())
{
const CPluginInfo &plugin = _extDatabase.Plugins[extInfo.PluginsPairs[0].Index];
- iconPath = GetIconPath(plugin.FilePath, plugin.ClassID, extInfo.Ext);
+ iconPath = GetIconPath(plugin.FilePath, plugin.ClassID, extInfo.Ext, iconIndex);
}
- NRegistryAssociations::AddShellExtensionInfo(
- GetSystemString(extInfo.Ext),
- title,
- command,
- iconPath, NULL, 0);
+ NRegistryAssociations::AddShellExtensionInfo(GetSystemString(extInfo.Ext),
+ title, command, iconPath, iconIndex, NULL, 0);
}
else
NRegistryAssociations::DeleteShellExtensionInfo(GetSystemString(extInfo.Ext));
diff --git a/CPP/7zip/FileManager/Resource/SystemPage/resource.rc b/CPP/7zip/FileManager/Resource/SystemPage/resource.rc
index cf19d11b..caa9fcbb 100755
--- a/CPP/7zip/FileManager/Resource/SystemPage/resource.rc
+++ b/CPP/7zip/FileManager/Resource/SystemPage/resource.rc
@@ -6,7 +6,7 @@
#define xSize (xSize2 + marg + marg)
#define ySize (ySize2 + marg + marg)
#define gSpace 30
-#define g0Size 110
+#define g0Size 160
#define gYSize (ySize2 - 20 - bYSize)
@@ -16,11 +16,8 @@ MY_FONT
BEGIN
LTEXT "Associate 7-Zip with:", IDC_SYSTEM_STATIC_ASSOCIATE, marg, marg, xSize2, 8
CONTROL "List1", IDC_SYSTEM_LIST_ASSOCIATE, "SysListView32",
- LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
+ LVS_LIST | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
marg, 20, g0Size, gYSize
- CONTROL "List1", IDC_SYSTEM_LIST_PLUGINS, "SysListView32",
- LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | NOT WS_VISIBLE | WS_BORDER | WS_TABSTOP,
- marg + g0Size + gSpace, 20, xSize2 - gSpace - g0Size, gYSize
PUSHBUTTON "Select all", IDC_SYSTEM_SELECT_ALL, marg, (ySize - marg - bYSize), 90, bYSize
END
diff --git a/CPP/7zip/FileManager/makefile b/CPP/7zip/FileManager/makefile
index 42619e0a..da745fe2 100755
--- a/CPP/7zip/FileManager/makefile
+++ b/CPP/7zip/FileManager/makefile
@@ -1,6 +1,8 @@
PROG = 7zFM.exe
LIBS = $(LIBS) user32.lib oleaut32.lib advapi32.lib shell32.lib ole32.lib comctl32.lib htmlhelp.lib Mpr.lib Gdi32.lib comdlg32.lib
-CFLAGS = $(CFLAGS) -I../../ -DLANG -DWIN_LONG_PATH
+CFLAGS = $(CFLAGS) -I../../ \
+ -DLANG \
+ -DWIN_LONG_PATH \
FM_OBJS = \
$O\App.obj \
@@ -49,7 +51,6 @@ FM_OBJS = \
$O\ViewSettings.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\CRC.obj \
$O\IntToString.obj \
$O\Lang.obj \
@@ -108,7 +109,9 @@ UI_COMMON_OBJS = \
C_OBJS = \
$O\Sort.obj \
+ $O\Alloc.obj \
+!include "../Crc2.mak"
OBJS = \
$O\StdAfx.obj \
@@ -119,7 +122,6 @@ OBJS = \
$(7ZIP_COMMON_OBJS) \
$(UI_COMMON_OBJS) \
$O\AboutDialog.obj \
- $O\BenchmarkDialog.obj \
$O\ComboDialog.obj \
$O\CopyDialog.obj \
$O\EditPage.obj \
@@ -133,8 +135,9 @@ OBJS = \
$O\SettingsPage.obj \
$O\SplitDialog.obj \
$O\SystemPage.obj \
- $O\resource.res \
+ $(CRC_OBJS) \
$(C_OBJS) \
+ $O\resource.res \
!include "../../Build.mak"
@@ -153,8 +156,6 @@ $(UI_COMMON_OBJS): ../UI/Common/$(*B).cpp
$O\AboutDialog.obj: Resource/AboutDialog/AboutDialog.cpp
$(COMPL)
-$O\BenchmarkDialog.obj: Resource/BenchmarkDialog/BenchmarkDialog.cpp
- $(COMPL)
$O\ComboDialog.obj: Resource/ComboDialog/ComboDialog.cpp
$(COMPL)
$O\CopyDialog.obj: Resource/CopyDialog/CopyDialog.cpp
@@ -185,3 +186,19 @@ $(C_OBJS): ../../../C/$(*B).c
$(COMPL_O2)
+!IF "$(CPU)" != "IA64"
+!IF "$(CPU)" != "AMD64"
+$O\7zCrcT8U.obj: ../../../Asm/x86/$(*B).asm
+ $(COMPL_ASM)
+!ELSE
+$O\7zCrcT8U.obj: ../../../Asm/x64/$(*B).asm
+ $(COMPL_ASM)
+!ENDIF
+$O\7zCrcT8.obj: ../../../C/$(*B).c
+ $(COMPL_O2)
+!ELSE
+$(CRC_OBJS): ../../../C/$(*B).c
+ $(COMPL_O2)
+!ENDIF
+
+
diff --git a/CPP/7zip/FileManager/resource.rc b/CPP/7zip/FileManager/resource.rc
index ed56cd48..43494581 100755
--- a/CPP/7zip/FileManager/resource.rc
+++ b/CPP/7zip/FileManager/resource.rc
@@ -222,7 +222,6 @@ END
#include "Resource/PasswordDialog/resource.rc"
#include "Resource/SplitDialog/resource.rc"
#include "Resource/ProgressDialog2/resource.rc"
-#include "Resource/BenchmarkDialog/resource.rc"
#include "Resource/AboutDialog/resource.rc"
#include "Resource/LangPage/resource.rc"
#include "Resource/PluginsPage/resource.rc"
diff --git a/CPP/7zip/Guid.txt b/CPP/7zip/Guid.txt
index 8fa5a291..fd91e292 100755
--- a/CPP/7zip/Guid.txt
+++ b/CPP/7zip/Guid.txt
@@ -32,6 +32,8 @@
33 ICompressSetInStreamSize
34 ICompressSetOutStreamSize
40 ICompressFilter
+60 ICompressCodecsInfo
+61 ISetCompressCodecsInfo
80 ICryptoProperties
90 ICryptoSetPassword
A0 ICryptoSetCRC
@@ -130,28 +132,10 @@ EF GZip
{23170F69-40C1-278A-1000-000100030000} CAgentArchiveHandle
{23170F69-40C1-278A-1000-000100020000} ContextMenu.h::CZipContextMenu
-{23170F69-40C1-278B-
-
-0000-000000000000} Copy
-0203-020000000000} Swap2
-0203-040000000000} Swap4
-0301-01000000ee00} LZMA
-0303-xxdd0000ee00} Branch
-0304-01000000ee00} PPMD
-0401-01000000ee00} Shrink
-0401-06000000ee00} Implode
-0401-08000000ee00} Deflate
-0401-09000000ee00} Deflate64
-0402-02000000ee00} Bzip2
-0402-050000000000} Z
-0403-010000000000} Rar15
-0403-020000000000} Rar20
-0403-030000000000} Rar29
-0601-01000000ee00} AES128_CBC
-0601-81000000ee00} AES256_CBC
-06F1-070100000000} 7zAES
-
-
+{23170F69-40C1-278B- old codecs clsids
{23170F69-40C1-278D-1000-000100020000} OptionsDialog.h::CLSID_CSevenZipOptions
+{23170F69-40C1-2790-id} Codec Decoders
+{23170F69-40C1-2791-id} Codec Encoders
+
diff --git a/CPP/7zip/ICoder.h b/CPP/7zip/ICoder.h
index d84575dc..e7de64b1 100755
--- a/CPP/7zip/ICoder.h
+++ b/CPP/7zip/ICoder.h
@@ -128,6 +128,18 @@ CODER_INTERFACE(ICompressFilter, 0x40)
// (it's for crypto block algorithms).
};
+CODER_INTERFACE(ICompressCodecsInfo, 0x60)
+{
+ STDMETHOD(GetNumberOfMethods)(UInt32 *numMethods) PURE;
+ STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) PURE;
+ STDMETHOD(CreateDecoder)(UInt32 index, const GUID *iid, void **coder) PURE;
+ STDMETHOD(CreateEncoder)(UInt32 index, const GUID *iid, void **coder) PURE;
+};
+CODER_INTERFACE(ISetCompressCodecsInfo, 0x61)
+{
+ STDMETHOD(SetCompressCodecsInfo)(ICompressCodecsInfo *compressCodecsInfo) PURE;
+};
+
CODER_INTERFACE(ICryptoProperties, 0x80)
{
STDMETHOD(SetKey)(const Byte *data, UInt32 size) PURE;
@@ -156,7 +168,9 @@ namespace NMethodPropID
kEncoder,
kInStreams,
kOutStreams,
- kDescription
+ kDescription,
+ kDecoderIsAssigned,
+ kEncoderIsAssigned
};
}
diff --git a/CPP/7zip/MyVersion.h b/CPP/7zip/MyVersion.h
index 7243563c..3c47b2ab 100755
--- a/CPP/7zip/MyVersion.h
+++ b/CPP/7zip/MyVersion.h
@@ -1,8 +1,8 @@
#define MY_VER_MAJOR 4
-#define MY_VER_MINOR 44
+#define MY_VER_MINOR 45
#define MY_VER_BUILD 3
-#define MY_VERSION "4.44 beta"
-#define MY_7ZIP_VERSION "7-Zip 4.44 beta"
-#define MY_DATE "2007-01-20"
+#define MY_VERSION "4.45 beta"
+#define MY_7ZIP_VERSION "7-Zip 4.45 beta"
+#define MY_DATE "2007-04-17"
#define MY_COPYRIGHT "Copyright (c) 1999-2007 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
diff --git a/CPP/7zip/MyVersionInfo.rc b/CPP/7zip/MyVersionInfo.rc
index fd52d6aa..c3712b16 100755
--- a/CPP/7zip/MyVersionInfo.rc
+++ b/CPP/7zip/MyVersionInfo.rc
@@ -34,6 +34,10 @@ BEGIN \
VALUE "ProductVersion", MY_VERSION \
END \
END \
+ BLOCK "VarFileInfo" \
+ BEGIN \
+ VALUE "Translation", 0x409, 1200 \
+ END \
END
#define MY_VERSION_INFO_APP(descr, intName) MY_VERSION_INFO(VFT_APP, descr, intName, intName ".exe")
diff --git a/CPP/7zip/UI/Agent/Agent.cpp b/CPP/7zip/UI/Agent/Agent.cpp
index f983e2f9..25cc42e4 100755
--- a/CPP/7zip/UI/Agent/Agent.cpp
+++ b/CPP/7zip/UI/Agent/Agent.cpp
@@ -13,10 +13,6 @@
#include "Agent.h"
-#ifdef FORMAT_7Z
-#include "../../Archive/7z/7zHandler.h"
-#endif
-
extern "C"
{
#include "../../../../C/Sort.h"
@@ -407,7 +403,8 @@ STDMETHODIMP CAgentFolder::Extract(const UINT32 *indices,
// CAgent
CAgent::CAgent():
- _proxyArchive(NULL)
+ _proxyArchive(NULL),
+ _codecs(0)
{
}
@@ -430,11 +427,17 @@ STDMETHODIMP CAgent::Open(
return ::GetLastError();
if (fileInfo.IsDirectory())
return E_FAIL;
- CArchiverInfo archiverInfo0, archiverInfo1;
- HRESULT res = OpenArchive(_archiveFilePath, _archiveLink, openArchiveCallback);
+ CArcInfoEx archiverInfo0, archiverInfo1;
+
+ _compressCodecsInfo.Release();
+ _codecs = new CCodecs;
+ _compressCodecsInfo = _codecs;
+ RINOK(_codecs->Load());
+
+ HRESULT res = OpenArchive(_codecs, _archiveFilePath, _archiveLink, openArchiveCallback);
// _archive = _archiveLink.GetArchive();
DefaultName = _archiveLink.GetDefaultItemName();
- const CArchiverInfo &ai = _archiveLink.GetArchiverInfo();
+ const CArcInfoEx &ai = _codecs->Formats[_archiveLink.GetArchiverIndex()];
RINOK(res);
DefaultTime = fileInfo.LastWriteTime;
@@ -449,9 +452,7 @@ STDMETHODIMP CAgent::Open(
COM_TRY_END
}
-STDMETHODIMP CAgent::ReOpen(
- // const wchar_t *filePath,
- IArchiveOpenCallback * /* openArchiveCallback */)
+STDMETHODIMP CAgent::ReOpen(IArchiveOpenCallback * /* openArchiveCallback */)
{
COM_TRY_BEGIN
if (_proxyArchive != NULL)
@@ -459,7 +460,7 @@ STDMETHODIMP CAgent::ReOpen(
delete _proxyArchive;
_proxyArchive = NULL;
}
- RINOK(ReOpenArchive(_archiveLink, _archiveFilePath));
+ RINOK(ReOpenArchive(_codecs, _archiveLink, _archiveFilePath));
return ReadItems();
COM_TRY_END
}
diff --git a/CPP/7zip/UI/Agent/Agent.h b/CPP/7zip/UI/Agent/Agent.h
index 41f80266..1be181a6 100755
--- a/CPP/7zip/UI/Agent/Agent.h
+++ b/CPP/7zip/UI/Agent/Agent.h
@@ -7,17 +7,14 @@
#include "Windows/PropVariant.h"
#include "../Common/UpdateAction.h"
-#include "../Common/ArchiverInfo.h"
#include "../Common/OpenArchive.h"
#include "IFolderArchive.h"
#include "AgentProxy.h"
-#ifndef EXCLUDE_COM
-#include "Windows/DLL.h"
-#endif
#ifdef NEW_FOLDER_INTERFACE
#include "../../FileManager/IFolder.h"
+#include "../Common/LoadCodecs.h"
#endif
class CAgentFolder;
@@ -184,21 +181,10 @@ public:
STDMETHOD(Open)(
const wchar_t *filePath,
- // CLSID *clsIDResult,
BSTR *archiveType,
IArchiveOpenCallback *openArchiveCallback);
- STDMETHOD(ReOpen)(
- // const wchar_t *filePath,
- IArchiveOpenCallback *openArchiveCallback);
- /*
- STDMETHOD(ReOpen)(IInStream *stream,
- const wchar_t *defaultName,
- const FILETIME *defaultTime,
- UINT32 defaultAttributes,
- const UINT64 *maxCheckStartPosition,
- IArchiveOpenCallback *openArchiveCallback);
- */
+ STDMETHOD(ReOpen)(IArchiveOpenCallback *openArchiveCallback);
STDMETHOD(Close)();
STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value);
STDMETHOD(GetNumberOfProperties)(UINT32 *numProperties);
@@ -221,8 +207,13 @@ public:
STDMETHOD(DeleteItems)(const wchar_t *newArchiveName, const UINT32 *indices,
UINT32 numItems, IFolderArchiveUpdateCallback *updateCallback);
STDMETHOD(DoOperation)(
- const wchar_t *filePath,
- const CLSID *clsID,
+ CCodecs *codecs,
+ int formatIndex,
+ const wchar_t *newArchiveName,
+ const Byte *stateActions,
+ const wchar_t *sfxModule,
+ IFolderArchiveUpdateCallback *updateCallback);
+ STDMETHOD(DoOperation2)(
const wchar_t *newArchiveName,
const Byte *stateActions,
const wchar_t *sfxModule,
@@ -248,6 +239,9 @@ public:
STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, INT32 numProperties);
#endif
+ CCodecs *_codecs;
+ CMyComPtr<ICompressCodecsInfo> _compressCodecsInfo;
+
CAgent();
~CAgent();
private:
@@ -288,26 +282,22 @@ public:
#ifdef NEW_FOLDER_INTERFACE
class CArchiveFolderManager:
public IFolderManager,
- public IFolderManagerGetIconPath,
public CMyUnknownImp
{
public:
- MY_UNKNOWN_IMP2(
- IFolderManager,
- IFolderManagerGetIconPath
- )
+ MY_UNKNOWN_IMP1(IFolderManager)
// IFolderManager
STDMETHOD(OpenFolderFile)(const wchar_t *filePath, IFolderFolder **resultFolder, IProgress *progress);
- STDMETHOD(GetTypes)(BSTR *types);
- STDMETHOD(GetExtension)(const wchar_t *type, BSTR *extension);
- STDMETHOD(CreateFolderFile)(const wchar_t *type, const wchar_t *filePath, IProgress *progress);
- STDMETHOD(GetIconPath)(const wchar_t *type, BSTR *iconPath);
- CArchiveFolderManager(): _formatsLoaded(false) {}
+ STDMETHOD(GetExtensions)(BSTR *extensions);
+ STDMETHOD(GetIconPath)(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex);
+ // STDMETHOD(GetTypes)(BSTR *types);
+ // STDMETHOD(CreateFolderFile)(const wchar_t *type, const wchar_t *filePath, IProgress *progress);
+ CArchiveFolderManager(): _codecs(0) {}
private:
void LoadFormats();
int FindFormat(const UString &type);
- bool _formatsLoaded;
- CObjectVector<CArchiverInfo> _formats;
+ CCodecs *_codecs;
+ CMyComPtr<ICompressCodecsInfo> _compressCodecsInfo;
};
#endif
diff --git a/CPP/7zip/UI/Agent/AgentOut.cpp b/CPP/7zip/UI/Agent/AgentOut.cpp
index 25d65bb2..a9e4ee8f 100755
--- a/CPP/7zip/UI/Agent/AgentOut.cpp
+++ b/CPP/7zip/UI/Agent/AgentOut.cpp
@@ -141,8 +141,8 @@ static HRESULT EnumerateArchiveItems(CAgent *agent,
}
STDMETHODIMP CAgent::DoOperation(
- const wchar_t *filePath,
- const CLSID *clsID,
+ CCodecs *codecs,
+ int formatIndex,
const wchar_t *newArchiveName,
const Byte *stateActions,
const wchar_t *sfxModule,
@@ -167,8 +167,6 @@ STDMETHODIMP CAgent::DoOperation(
return errorCodes.Front();
}
- NWindows::NDLL::CLibrary library;
-
CMyComPtr<IOutArchive> outArchive;
if (GetArchive())
{
@@ -176,9 +174,20 @@ STDMETHODIMP CAgent::DoOperation(
}
else
{
- CHandlerLoader loader;
- RINOK(loader.CreateHandler(filePath, *clsID, (void **)&outArchive, true));
- library.Attach(loader.Detach());
+ if (formatIndex < 0)
+ return E_FAIL;
+ RINOK(codecs->CreateOutArchive(formatIndex, outArchive));
+ #ifdef EXTERNAL_CODECS
+ {
+ CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
+ outArchive.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
+ if (setCompressCodecsInfo)
+ {
+ RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecs));
+ }
+ }
+ #endif
+
}
NFileTimeType::EEnum fileTimeType;
@@ -281,6 +290,15 @@ STDMETHODIMP CAgent::DoOperation(
return outArchive->UpdateItems(outStream, updatePairs2.Size(),updateCallback);
}
+STDMETHODIMP CAgent::DoOperation2(
+ const wchar_t *newArchiveName,
+ const Byte *stateActions,
+ const wchar_t *sfxModule,
+ IFolderArchiveUpdateCallback *updateCallback100)
+{
+ return DoOperation(_codecs, -1, newArchiveName,
+ stateActions, sfxModule, updateCallback100);
+}
HRESULT CAgent::CommonUpdate(
const wchar_t *newArchiveName,
diff --git a/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp b/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
index ce423941..01eb4fed 100755
--- a/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
+++ b/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
@@ -15,15 +15,17 @@ static inline UINT GetCurrentFileCodePage()
void CArchiveFolderManager::LoadFormats()
{
- if (!_formatsLoaded)
- ReadArchiverInfoList(_formats);
+ if (!_codecs)
+ {
+ _compressCodecsInfo = _codecs = new CCodecs;
+ _codecs->Load();
+ }
}
int CArchiveFolderManager::FindFormat(const UString &type)
{
- // LoadFormats();
- for (int i = 0; i < _formats.Size(); i++)
- if (type.CompareNoCase(_formats[i].Name) == 0)
+ for (int i = 0; i < _codecs->Formats.Size(); i++)
+ if (type.CompareNoCase(_codecs->Formats[i].Name) == 0)
return i;
return -1;
}
@@ -51,48 +53,80 @@ HRESULT CAgent::FolderReOpen(
}
*/
-STDMETHODIMP CArchiveFolderManager::GetTypes(BSTR *types)
+
+/*
+STDMETHODIMP CArchiveFolderManager::GetExtensions(const wchar_t *type, BSTR *extensions)
+{
+ *extensions = 0;
+ int formatIndex = FindFormat(type);
+ if (formatIndex < 0)
+ return E_INVALIDARG;
+ CMyComBSTR valueTemp = _codecs.Formats[formatIndex].GetAllExtensions(); // Exts[0].Ext;
+ *extensions = valueTemp.Detach();
+ return S_OK;
+}
+*/
+STDMETHODIMP CArchiveFolderManager::GetExtensions(BSTR *extensions)
{
LoadFormats();
- UString typesStrings;
- for(int i = 0; i < _formats.Size(); i++)
+ *extensions = 0;
+ UString res;
+ for (int i = 0; i < _codecs->Libs.Size(); i++)
{
- const CArchiverInfo &ai = _formats[i];
- if (!ai.Associate)
- continue;
- if (i != 0)
- typesStrings += L' ';
- typesStrings += ai.Name;
+ const CCodecLib &lib = _codecs->Libs[i];
+ for (int j = 0; j < lib.IconPairs.Size(); j++)
+ {
+ if (!res.IsEmpty())
+ res += L' ';
+ res += lib.IconPairs[j].Ext;
+ }
}
- CMyComBSTR valueTemp = typesStrings;
- *types = valueTemp.Detach();
+ CMyComBSTR valueTemp = res;
+ *extensions = valueTemp.Detach();
return S_OK;
}
-STDMETHODIMP CArchiveFolderManager::GetExtension(const wchar_t *type, BSTR *extension)
+STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex)
{
- *extension = 0;
- int formatIndex = FindFormat(type);
- if (formatIndex < 0)
- return E_INVALIDARG;
- CMyComBSTR valueTemp = _formats[formatIndex].Extensions[0].Ext;
- *extension = valueTemp.Detach();
+ LoadFormats();
+ *iconPath = 0;
+ *iconIndex = 0;
+ for (int i = 0; i < _codecs->Libs.Size(); i++)
+ {
+ const CCodecLib &lib = _codecs->Libs[i];
+ int ii = lib.FindIconIndex(ext);
+ if (ii >= 0)
+ {
+ CMyComBSTR iconPathTemp = GetUnicodeString(lib.Path, GetCurrentFileCodePage());
+ *iconIndex = ii;
+ *iconPath = iconPathTemp.Detach();
+ return S_OK;
+ }
+ }
return S_OK;
}
-STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *type, BSTR *iconPath)
+/*
+STDMETHODIMP CArchiveFolderManager::GetTypes(BSTR *types)
{
- *iconPath = 0;
- int formatIndex = FindFormat(type);
- if (formatIndex < 0)
- return E_INVALIDARG;
- CMyComBSTR iconPathTemp = _formats[formatIndex].FilePath;
- *iconPath = iconPathTemp.Detach();
+ LoadFormats();
+ UString typesStrings;
+ for(int i = 0; i < _codecs.Formats.Size(); i++)
+ {
+ const CArcInfoEx &ai = _codecs.Formats[i];
+ if (ai.AssociateExts.Size() == 0)
+ continue;
+ if (i != 0)
+ typesStrings += L' ';
+ typesStrings += ai.Name;
+ }
+ CMyComBSTR valueTemp = typesStrings;
+ *types = valueTemp.Detach();
return S_OK;
}
-
-STDMETHODIMP CArchiveFolderManager::CreateFolderFile(const wchar_t * /* type */,
- const wchar_t * /* filePath */, IProgress * /* progress */)
+STDMETHODIMP CArchiveFolderManager::CreateFolderFile(const wchar_t * type,
+ const wchar_t * filePath, IProgress progress)
{
return E_NOTIMPL;
}
+*/
diff --git a/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp b/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp
index 4d66d86d..336f5fda 100755
--- a/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp
+++ b/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp
@@ -88,8 +88,7 @@ HRESULT CAgentFolder::CommonUpdateOperation(
Byte actionSetByte[NUpdateArchive::NPairState::kNumValues];
for (int i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
actionSetByte[i] = (Byte)actionSet->StateActions[i];
- result = _agentSpec->DoOperation(NULL, NULL,
- tempFileName, actionSetByte, NULL, updateCallback100);
+ result = _agentSpec->DoOperation2(tempFileName, actionSetByte, NULL, updateCallback100);
}
if (result != S_OK)
diff --git a/CPP/7zip/UI/Agent/IFolderArchive.h b/CPP/7zip/UI/Agent/IFolderArchive.h
index 41d9eb22..ece56112 100755
--- a/CPP/7zip/UI/Agent/IFolderArchive.h
+++ b/CPP/7zip/UI/Agent/IFolderArchive.h
@@ -8,6 +8,7 @@
#include "../../FileManager/IFolder.h"
#include "../Common/IFileExtractCallback.h"
#include "../Common/ExtractMode.h"
+#include "../../UI/Common/LoadCodecs.h"
// {23170F69-40C1-278A-0000-000100050000}
DEFINE_GUID(IID_IArchiveFolder,
@@ -31,7 +32,8 @@ MIDL_INTERFACE("23170F69-40C1-278A-0000-000100060000")
IInFolderArchive: public IUnknown
{
public:
- STDMETHOD(Open)(const wchar_t *filePath,
+ STDMETHOD(Open)(
+ const wchar_t *filePath,
// CLSID *clsIDResult,
BSTR *archiveType,
IArchiveOpenCallback *openArchiveCallback) PURE;
@@ -68,10 +70,9 @@ public:
STDMETHOD(UpdateErrorMessage)(const wchar_t *message) PURE;
};
-// {23170F69-40C1-278A-0000-0001000A0000}
DEFINE_GUID(IID_IOutFolderArchive,
-0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0A, 0x00, 0x00);
-MIDL_INTERFACE("23170F69-40C1-278A-0000-0001000A0000")
+0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0A, 0x00, 0x02);
+MIDL_INTERFACE("23170F69-40C1-278A-0000-0001000A0002")
IOutFolderArchive: public IUnknown
{
STDMETHOD(SetFolder)(IFolderFolder *folder) PURE;
@@ -79,8 +80,13 @@ IOutFolderArchive: public IUnknown
STDMETHOD(DeleteItems)(const wchar_t *newArchiveName,
const UINT32 *indices, UINT32 numItems, IFolderArchiveUpdateCallback *updateCallback) PURE;
STDMETHOD(DoOperation)(
- const wchar_t *filePath,
- const CLSID *clsID,
+ CCodecs *codecs,
+ int index,
+ const wchar_t *newArchiveName,
+ const Byte *stateActions,
+ const wchar_t *sfxModule,
+ IFolderArchiveUpdateCallback *updateCallback) PURE;
+ STDMETHOD(DoOperation2)(
const wchar_t *newArchiveName,
const Byte *stateActions,
const wchar_t *sfxModule,
diff --git a/CPP/7zip/UI/Client7z/Client7z.cpp b/CPP/7zip/UI/Client7z/Client7z.cpp
index 46bdb727..43aec4f8 100755
--- a/CPP/7zip/UI/Client7z/Client7z.cpp
+++ b/CPP/7zip/UI/Client7z/Client7z.cpp
@@ -23,7 +23,7 @@ DEFINE_GUID(CLSID_CFormat7z,
using namespace NWindows;
-static const char *kCopyrightString = "7-Zip 4.43 (7za.DLL client example) (c) 1999-2006 Igor Pavlov 2006-08-10\n";
+static const char *kCopyrightString = "7-Zip (7za.DLL client example) (c) 1999-2007 Igor Pavlov 2007-03-30\n";
static const char *kHelpString =
"Usage: Client7z.exe [a | l | x ] archive.7z [fileName ...]\n"
"Examples:\n"
@@ -56,7 +56,7 @@ void PrintString(const UString &s)
void PrintString(const AString &s)
{
- printf("%s", s);
+ printf("%s", (LPCSTR)s);
}
void PrintNewLine()
diff --git a/CPP/7zip/UI/Client7z/makefile b/CPP/7zip/UI/Client7z/makefile
index c4ae0aaf..4650c293 100755
--- a/CPP/7zip/UI/Client7z/makefile
+++ b/CPP/7zip/UI/Client7z/makefile
@@ -1,6 +1,6 @@
PROG = 7z.exe
LIBS = $(LIBS) user32.lib oleaut32.lib advapi32.lib
-CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MT
+CFLAGS = $(CFLAGS) -I ../../../
CONSOLE_OBJS = \
$O\Client7z.obj \
diff --git a/CPP/7zip/UI/Common/ArchiveCommandLine.cpp b/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
index 6f951a27..f9548024 100755
--- a/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
+++ b/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
@@ -19,7 +19,6 @@
#include "ArchiveCommandLine.h"
#include "UpdateAction.h"
#include "Update.h"
-#include "ArchiverInfo.h"
#include "SortUtils.h"
#include "EnumDirItems.h"
@@ -68,14 +67,6 @@ enum Enum
static const wchar_t kRecursedIDChar = 'R';
static const wchar_t *kRecursedPostCharSet = L"0-";
-static const wchar_t *kDefaultArchiveType = L"7z";
-static const wchar_t *kSFXExtension =
- #ifdef _WIN32
- L"exe";
- #else
- L"";
- #endif
-
namespace NRecursedPostCharIndex {
enum EEnum
{
@@ -111,21 +102,21 @@ static const CSwitchForm kSwitchForms[kNumSwitches] =
{ L"T", NSwitchType::kUnLimitedPostString, false, 1 },
{ L"Y", NSwitchType::kSimple, false },
{ L"P", NSwitchType::kUnLimitedPostString, false, 0 },
- { L"M", NSwitchType::kUnLimitedPostString, true, 1 },
+ { L"M", NSwitchType::kUnLimitedPostString, true, 1 },
{ L"O", NSwitchType::kUnLimitedPostString, false, 1 },
{ L"W", NSwitchType::kUnLimitedPostString, false, 0 },
{ L"I", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize},
{ L"X", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize},
- { L"AI", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize},
- { L"AX", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize},
+ { L"AI", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize},
+ { L"AX", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize},
{ L"AN", NSwitchType::kSimple, false },
{ L"U", NSwitchType::kUnLimitedPostString, true, 1},
{ L"V", NSwitchType::kUnLimitedPostString, true, 1},
{ L"R", NSwitchType::kPostChar, false, 0, 0, kRecursedPostCharSet },
{ L"SFX", NSwitchType::kUnLimitedPostString, false, 0 },
- { L"SI", NSwitchType::kUnLimitedPostString, false, 0 },
- { L"SO", NSwitchType::kSimple, false, 0 },
- { L"AO", NSwitchType::kPostChar, false, 1, 1, kOverwritePostCharSet},
+ { L"SI", NSwitchType::kUnLimitedPostString, false, 0 },
+ { L"SO", NSwitchType::kSimple, false, 0 },
+ { L"AO", NSwitchType::kPostChar, false, 1, 1, kOverwritePostCharSet},
{ L"SEML", NSwitchType::kUnLimitedPostString, false, 0},
{ L"AD", NSwitchType::kSimple, false },
{ L"SLP", NSwitchType::kUnLimitedPostString, false, 0},
@@ -133,9 +124,8 @@ static const CSwitchForm kSwitchForms[kNumSwitches] =
{ L"SLT", NSwitchType::kSimple, false }
};
-static const int kNumCommandForms = 7;
-static const CCommandForm g_CommandForms[kNumCommandForms] =
+static const CCommandForm g_CommandForms[] =
{
{ L"A", false },
{ L"U", false },
@@ -143,9 +133,13 @@ static const CCommandForm g_CommandForms[kNumCommandForms] =
{ L"T", false },
{ L"E", false },
{ L"X", false },
- { L"L", false }
+ { L"L", false },
+ { L"B", false },
+ { L"I", false }
};
+static const int kNumCommandForms = sizeof(g_CommandForms) / sizeof(g_CommandForms[0]);
+
static const int kMaxCmdLineSize = 1000;
static const wchar_t *kUniversalWildcard = L"*";
static const int kMinNonSwitchWords = 1;
@@ -155,7 +149,7 @@ static const int kCommandIndex = 0;
// exception messages
static const char *kUserErrorMessage = "Incorrect command line";
-static const char *kIncorrectListFile = "Incorrect wildcard in listfile";
+static const char *kIncorrectListFile = "Incorrect item in listfile.\nCheck charset encoding and -scs switch.";
static const char *kIncorrectWildCardInListFile = "Incorrect wildcard in listfile";
static const char *kIncorrectWildCardInCommandLine = "Incorrect wildcard in command line";
static const char *kTerminalOutError = "I won't write compressed data to a terminal";
@@ -545,9 +539,7 @@ static void ParseUpdateCommandString(CUpdateOptions &options,
UString archivePath = postString.Mid(1);
if (archivePath.IsEmpty())
ThrowUserErrorException();
- uc.ArchivePath.BaseExtension = options.ArchivePath.BaseExtension;
- uc.ArchivePath.VolExtension = options.ArchivePath.VolExtension;
- uc.ArchivePath.ParseFromPath(archivePath);
+ uc.UserArchivePath = archivePath;
uc.ActionSet = actionSet;
options.Commands.Add(uc);
}
@@ -674,42 +666,6 @@ static void SetMethodOptions(const CParser &parser, CObjectVector<CProperty> &pr
}
}
-
-static void SetArchiveType(const UString &archiveType,
-#ifndef EXCLUDE_COM
- UString &filePath, CLSID &classID,
-#else
- UString &formatName,
-#endif
- UString &archiveExtension)
-{
- CObjectVector<CArchiverInfo> archiverInfoVector;
- ReadArchiverInfoList(archiverInfoVector);
- if (archiverInfoVector.Size() == 0)
- ThrowException("There are no installed archive handlers");
- if (archiveType.IsEmpty())
- ThrowException("Incorrect archive type was assigned");
- for (int i = 0; i < archiverInfoVector.Size(); i++)
- {
- const CArchiverInfo &archiverInfo = archiverInfoVector[i];
- if (archiverInfo.Name.CompareNoCase(archiveType) == 0)
- {
- #ifndef EXCLUDE_COM
- classID = archiverInfo.ClassID;
- filePath = archiverInfo.FilePath;
- #else
- formatName = archiverInfo.Name;
-
- #endif
-
- archiveExtension = archiverInfo.GetMainExtension();
- return;
- }
- }
- ThrowException("Incorrect archive type was assigned");
-}
-
-
CArchiveCommandLineParser::CArchiveCommandLineParser(): parser(kNumSwitches) {}
void CArchiveCommandLineParser::Parse1(const UStringVector &commandStrings,
@@ -757,6 +713,18 @@ static CCodePagePair g_CodePagePairs[] =
static const int kNumCodePages = sizeof(g_CodePagePairs) / sizeof(g_CodePagePairs[0]);
+static bool ConvertStringToUInt32(const wchar_t *s, UInt32 &v)
+{
+ const wchar_t *end;
+ UInt64 number = ConvertStringToUInt64(s, &end);
+ if (*end != 0)
+ return false;
+ if (number > (UInt32)0xFFFFFFFF)
+ return false;
+ v = (UInt32)number;
+ return true;
+}
+
void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
{
const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
@@ -806,7 +774,9 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
parser[NKey::kExclude].PostStrings, false, recursedType, codePage);
int curCommandIndex = kCommandIndex + 1;
- bool thereIsArchiveName = !parser[NKey::kNoArName].ThereIs;
+ bool thereIsArchiveName = !parser[NKey::kNoArName].ThereIs &&
+ options.Command.CommandType != NCommandType::kBenchmark &&
+ options.Command.CommandType != NCommandType::kInfo;
if (thereIsArchiveName)
{
if(curCommandIndex >= numNonSwitchStrings)
@@ -918,28 +888,9 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
{
CUpdateOptions &updateOptions = options.UpdateOptions;
- UString archiveType;
if(parser[NKey::kArchiveType].ThereIs)
- archiveType = parser[NKey::kArchiveType].PostStrings[0];
- else
- archiveType = kDefaultArchiveType;
+ options.ArcType = parser[NKey::kArchiveType].PostStrings[0];
- UString typeExtension;
- if (!archiveType.IsEmpty())
- {
- #ifndef EXCLUDE_COM
- SetArchiveType(archiveType, updateOptions.MethodMode.FilePath,
- updateOptions.MethodMode.ClassID, typeExtension);
- #else
- SetArchiveType(archiveType, updateOptions.MethodMode.Name, typeExtension);
- #endif
- }
- UString extension = typeExtension;
- if(parser[NKey::kSfx].ThereIs)
- extension = kSFXExtension;
- updateOptions.ArchivePath.BaseExtension = extension;
- updateOptions.ArchivePath.VolExtension = typeExtension;
- updateOptions.ArchivePath.ParseFromPath(options.ArchiveName);
SetAddCommandOptions(options.Command.CommandType, parser, updateOptions);
SetMethodOptions(parser, updateOptions.MethodMode.Properties);
@@ -979,6 +930,56 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
ConvertToLongNames(options.WildcardCensor);
#endif
}
+ else if(options.Command.CommandType == NCommandType::kBenchmark)
+ {
+ options.NumThreads = (UInt32)-1;
+ options.DictionarySize = (UInt32)-1;
+ options.NumIterations = 1;
+ if (curCommandIndex < numNonSwitchStrings)
+ {
+ if (!ConvertStringToUInt32(nonSwitchStrings[curCommandIndex++], options.NumIterations))
+ ThrowUserErrorException();
+ }
+ for (int i = 0; i < parser[NKey::kProperty].PostStrings.Size(); i++)
+ {
+ UString postString = parser[NKey::kProperty].PostStrings[i];
+ postString.MakeUpper();
+ if (postString.Length() < 2)
+ ThrowUserErrorException();
+ if (postString[0] == 'D')
+ {
+ int pos = 1;
+ if (postString[pos] == '=')
+ pos++;
+ UInt32 logSize;
+ if (!ConvertStringToUInt32((const wchar_t *)postString + pos, logSize))
+ ThrowUserErrorException();
+ if (logSize > 31)
+ ThrowUserErrorException();
+ options.DictionarySize = 1 << logSize;
+ }
+ else if (postString[0] == 'M' && postString[1] == 'T' )
+ {
+ int pos = 2;
+ if (postString[pos] == '=')
+ pos++;
+ if (postString[pos] != 0)
+ if (!ConvertStringToUInt32((const wchar_t *)postString + pos, options.NumThreads))
+ ThrowUserErrorException();
+ }
+ else if (postString[0] == 'M' && postString[1] == '=' )
+ {
+ int pos = 2;
+ if (postString[pos] != 0)
+ options.Method = postString.Mid(2);
+ }
+ else
+ ThrowUserErrorException();
+ }
+ }
+ else if(options.Command.CommandType == NCommandType::kInfo)
+ {
+ }
else
ThrowUserErrorException();
options.WildcardCensor.ExtendExclude();
diff --git a/CPP/7zip/UI/Common/ArchiveCommandLine.h b/CPP/7zip/UI/Common/ArchiveCommandLine.h
index daa66fb6..7183de9b 100755
--- a/CPP/7zip/UI/Common/ArchiveCommandLine.h
+++ b/CPP/7zip/UI/Common/ArchiveCommandLine.h
@@ -22,7 +22,9 @@ namespace NCommandType { enum EEnum
kTest,
kExtract,
kFullExtract,
- kList
+ kList,
+ kBenchmark,
+ kInfo
};}
namespace NRecursedType { enum EEnum
@@ -77,10 +79,17 @@ struct CArchiveCommandLineOptions
CObjectVector<CProperty> ExtractProperties;
CUpdateOptions UpdateOptions;
+ UString ArcType;
bool EnablePercents;
- CArchiveCommandLineOptions(): StdInMode(false), StdOutMode(false) {};
+ // Benchmark
+ UInt32 NumIterations;
+ UInt32 NumThreads;
+ UInt32 DictionarySize;
+ UString Method;
+
+ CArchiveCommandLineOptions(): StdInMode(false), StdOutMode(false) {};
};
class CArchiveCommandLineParser
diff --git a/CPP/7zip/UI/Common/ArchiverInfo.cpp b/CPP/7zip/UI/Common/ArchiverInfo.cpp
deleted file mode 100755
index 7833ed3c..00000000
--- a/CPP/7zip/UI/Common/ArchiverInfo.cpp
+++ /dev/null
@@ -1,372 +0,0 @@
-// ArchiverInfo.cpp
-
-#include "StdAfx.h"
-
-#include "ArchiverInfo.h"
-
-#ifndef EXCLUDE_COM
-
-#include "Common/StringConvert.h"
-#include "Windows/FileFind.h"
-#include "Windows/FileName.h"
-#include "Windows/DLL.h"
-#ifdef _WIN32
-#include "Windows/Registry.h"
-#endif
-#include "Windows/PropVariant.h"
-#include "../../Archive/IArchive.h"
-
-using namespace NWindows;
-using namespace NFile;
-
-#endif
-
-extern HINSTANCE g_hInstance;
-
-#ifndef EXCLUDE_COM
-
-static void SplitString(const UString &srcString, UStringVector &destStrings)
-{
- destStrings.Clear();
- UString string;
- int len = srcString.Length();
- if (len == 0)
- return;
- for (int i = 0; i < len; i++)
- {
- wchar_t c = srcString[i];
- if (c == L' ')
- {
- if (!string.IsEmpty())
- {
- destStrings.Add(string);
- string.Empty();
- }
- }
- else
- string += c;
- }
- if (!string.IsEmpty())
- destStrings.Add(string);
-}
-
-typedef UInt32 (WINAPI * GetHandlerPropertyFunc)(
- PROPID propID, PROPVARIANT *value);
-
-static UString GetModuleFolderPrefix()
-{
- UString path;
- NDLL::MyGetModuleFileName(g_hInstance, path);
- int pos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
- return path.Left(pos + 1);
-}
-
-static wchar_t *kFormatFolderName = L"Formats";
-
-#ifdef _WIN32
-static LPCTSTR kRegistryPath = TEXT("Software\\7-zip");
-static LPCWSTR kProgramPathValue = L"Path";
-static bool ReadPathFromRegistry(HKEY baseKey, UString &path)
-{
- NRegistry::CKey key;
- if(key.Open(baseKey, kRegistryPath, KEY_READ) == ERROR_SUCCESS)
- if (key.QueryValue(kProgramPathValue, path) == ERROR_SUCCESS)
- {
- NName::NormalizeDirPathPrefix(path);
- return true;
- }
- return false;
-}
-#endif
-
-static UString GetBaseFolderPrefixFromRegistry()
-{
- UString moduleFolderPrefix = GetModuleFolderPrefix();
- NFind::CFileInfoW fileInfo;
- if (NFind::FindFile(moduleFolderPrefix + kFormatFolderName, fileInfo))
- if (fileInfo.IsDirectory())
- return moduleFolderPrefix;
- UString path;
- #ifdef _WIN32
- if(ReadPathFromRegistry(HKEY_CURRENT_USER, path))
- return path;
- if(ReadPathFromRegistry(HKEY_LOCAL_MACHINE, path))
- return path;
- #endif
- return moduleFolderPrefix;
-}
-
-typedef UInt32 (WINAPI *CreateObjectPointer)(
- const GUID *clsID,
- const GUID *interfaceID,
- void **outObject);
-
-#endif
-
-#ifndef _SFX
-static inline void SetBuffer(CByteBuffer &bb, const Byte *data, int size)
-{
- bb.SetCapacity(size);
- memmove((Byte *)bb, data, size);
-}
-#endif
-
-void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
-{
- archivers.Clear();
-
- #ifdef EXCLUDE_COM
-
- #ifdef FORMAT_7Z
- {
- CArchiverInfo item;
- item.UpdateEnabled = true;
- item.Name = L"7z";
- item.Extensions.Add(CArchiverExtInfo(L"7z"));
- #ifndef _SFX
- const unsigned char kSig[] = {'7' , 'z', 0xBC, 0xAF, 0x27, 0x1C};
- SetBuffer(item.StartSignature, kSig, 6);
- #endif
- archivers.Add(item);
- }
- #endif
-
- #ifdef FORMAT_BZIP2
- {
- CArchiverInfo item;
- item.UpdateEnabled = true;
- item.KeepName = true;
- item.Name = L"BZip2";
- item.Extensions.Add(CArchiverExtInfo(L"bz2"));
- item.Extensions.Add(CArchiverExtInfo(L"tbz2", L".tar"));
- #ifndef _SFX
- const unsigned char sig[] = {'B' , 'Z', 'h' };
- SetBuffer(item.StartSignature, sig, 3);
- #endif
- archivers.Add(item);
- }
- #endif
-
- #ifdef FORMAT_CAB
- {
- CArchiverInfo item;
- item.Name = L"Cab";
- item.Extensions.Add(CArchiverExtInfo(L"cab"));
- #ifndef _SFX
- const unsigned char sig[] = { 0x4D, 0x53, 0x43, 0x46 };
- SetBuffer(item.StartSignature, sig, 4);
- #endif
- archivers.Add(item);
- }
- #endif
-
- #ifdef FORMAT_GZIP
- {
- CArchiverInfo item;
- item.UpdateEnabled = true;
- item.Name = L"GZip";
- item.Extensions.Add(CArchiverExtInfo(L"gz"));
- item.Extensions.Add(CArchiverExtInfo(L"tgz", L".tar"));
- #ifndef _SFX
- const unsigned char sig[] = { 0x1F, 0x8B };
- SetBuffer(item.StartSignature, sig, 2);
- #endif
- archivers.Add(item);
- }
- #endif
-
- #ifdef FORMAT_SPLIT
- {
- CArchiverInfo item;
- item.UpdateEnabled = false;
- item.KeepName = true;
- item.Name = L"Split";
- item.Extensions.Add(CArchiverExtInfo(L"001"));
- archivers.Add(item);
- }
- #endif
-
- #ifdef FORMAT_TAR
- {
- CArchiverInfo item;
- item.UpdateEnabled = true;
- item.Name = L"Tar";
- item.Extensions.Add(CArchiverExtInfo(L"tar"));
- archivers.Add(item);
- }
- #endif
-
- #ifdef FORMAT_ZIP
- {
- CArchiverInfo item;
- item.UpdateEnabled = true;
- item.Name = L"Zip";
- item.Extensions.Add(CArchiverExtInfo(L"zip"));
- #ifndef _SFX
- const unsigned char sig[] = { 0x50, 0x4B, 0x03, 0x04 };
- SetBuffer(item.StartSignature, sig, 4);
- #endif
- archivers.Add(item);
- }
- #endif
-
- #ifdef FORMAT_CPIO
- {
- CArchiverInfo item;
- item.Name = L"Cpio";
- item.Extensions.Add(CArchiverExtInfo(L"cpio"));
- archivers.Add(item);
- }
- #endif
-
- #ifdef FORMAT_RPM
- {
- CArchiverInfo item;
- item.Name = L"Rpm";
- item.Extensions.Add(CArchiverExtInfo(L"rpm", L".cpio.gz"));
- archivers.Add(item);
- }
- #endif
-
- #ifdef FORMAT_ARJ
- {
- CArchiverInfo item;
- item.Name = L"Arj";
- item.Extensions.Add(CArchiverExtInfo(L"arj"));
- #ifndef _SFX
- const unsigned char sig[] = { 0x60, 0xEA };
- SetBuffer(item.StartSignature, sig, 2);
- #endif
- archivers.Add(item);
- }
- #endif
-
- #ifdef FORMAT_Z
- {
- CArchiverInfo item;
- item.Name = L"Z";
- item.Extensions.Add(CArchiverExtInfo(L"Z"));
- #ifndef _SFX
- const unsigned char sig[] = { 0x1F, 0x9D };
- SetBuffer(item.StartSignature, sig, 2);
- #endif
- archivers.Add(item);
- }
- #endif
-
- #else
-
- UString folderPath = GetBaseFolderPrefixFromRegistry() +
- (UString)kFormatFolderName + (UString)WSTRING_PATH_SEPARATOR;
- NFind::CEnumeratorW enumerator(folderPath + L"*");
- NFind::CFileInfoW fileInfo;
- while (enumerator.Next(fileInfo))
- {
- if (fileInfo.IsDirectory())
- continue;
- UString filePath = folderPath + fileInfo.Name;
- {
- NDLL::CLibrary library;
- if (!library.LoadEx(filePath, LOAD_LIBRARY_AS_DATAFILE))
- continue;
- }
-
- NDLL::CLibrary library;
- if (!library.Load(filePath))
- continue;
- GetHandlerPropertyFunc getHandlerProperty = (GetHandlerPropertyFunc)
- library.GetProcAddress("GetHandlerProperty");
- if (getHandlerProperty == NULL)
- continue;
-
- CArchiverInfo item;
- item.FilePath = filePath;
-
- NWindows::NCOM::CPropVariant prop;
- if (getHandlerProperty(NArchive::kName, &prop) != S_OK)
- continue;
- if (prop.vt != VT_BSTR)
- continue;
- item.Name = prop.bstrVal;
- prop.Clear();
-
- if (getHandlerProperty(NArchive::kClassID, &prop) != S_OK)
- continue;
- if (prop.vt != VT_BSTR)
- continue;
- item.ClassID = *(const GUID *)prop.bstrVal;
- prop.Clear();
-
- if (getHandlerProperty(NArchive::kExtension, &prop) != S_OK)
- continue;
- if (prop.vt != VT_BSTR)
- continue;
-
- UString ext = prop.bstrVal;
- UString addExt;
-
- prop.Clear();
-
- if (getHandlerProperty(NArchive::kAddExtension, &prop) != S_OK)
- continue;
- if (prop.vt == VT_BSTR)
- {
- addExt = prop.bstrVal;
- }
- else if (prop.vt != VT_EMPTY)
- continue;
- prop.Clear();
-
- UStringVector exts, addExts;
- SplitString(ext, exts);
- SplitString(addExt, addExts);
-
- prop.Clear();
- for (int i = 0; i < exts.Size(); i++)
- {
- CArchiverExtInfo extInfo;
- extInfo.Ext = exts[i];
- if (addExts.Size() > 0)
- extInfo.AddExt = addExts[i];
- if (extInfo.AddExt == L"*")
- extInfo.AddExt.Empty();
- item.Extensions.Add(extInfo);
- }
-
- if (getHandlerProperty(NArchive::kUpdate, &prop) == S_OK)
- if (prop.vt == VT_BOOL)
- item.UpdateEnabled = VARIANT_BOOLToBool(prop.boolVal);
- prop.Clear();
-
- if (item.UpdateEnabled)
- {
- if (getHandlerProperty(NArchive::kKeepName, &prop) == S_OK)
- if (prop.vt == VT_BOOL)
- item.KeepName = VARIANT_BOOLToBool(prop.boolVal);
- prop.Clear();
- }
-
- if (getHandlerProperty(NArchive::kStartSignature, &prop) == S_OK)
- {
- if (prop.vt == VT_BSTR)
- {
- UINT len = ::SysStringByteLen(prop.bstrVal);
- item.StartSignature.SetCapacity(len);
- memmove(item.StartSignature, prop.bstrVal, len);
- }
- }
- prop.Clear();
-
- if (getHandlerProperty(NArchive::kAssociate, &prop) == S_OK)
- if (prop.vt == VT_BOOL)
- item.Associate = VARIANT_BOOLToBool(prop.boolVal);
- prop.Clear();
-
-
- archivers.Add(item);
- }
-
- #endif
-}
-
-
diff --git a/CPP/7zip/UI/Common/ArchiverInfo.h b/CPP/7zip/UI/Common/ArchiverInfo.h
deleted file mode 100755
index 3b829518..00000000
--- a/CPP/7zip/UI/Common/ArchiverInfo.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// ArchiverInfo.h
-
-#ifndef __ARCHIVERINFO_H
-#define __ARCHIVERINFO_H
-
-#include "Common/String.h"
-#include "Common/Types.h"
-#include "Common/Buffer.h"
-
-struct CArchiverExtInfo
-{
- UString Ext;
- UString AddExt;
- CArchiverExtInfo() {}
- CArchiverExtInfo(const UString &ext): Ext(ext) {}
- CArchiverExtInfo(const UString &ext, const UString &addExt): Ext(ext), AddExt(addExt) {}
-};
-
-struct CArchiverInfo
-{
- #ifndef EXCLUDE_COM
- UString FilePath;
- CLSID ClassID;
- #endif
- UString Name;
- CObjectVector<CArchiverExtInfo> Extensions;
- #ifndef _SFX
- CByteBuffer StartSignature;
- CByteBuffer FinishSignature;
- bool Associate;
- #endif
- int FindExtension(const UString &ext) const
- {
- for (int i = 0; i < Extensions.Size(); i++)
- if (ext.CompareNoCase(Extensions[i].Ext) == 0)
- return i;
- return -1;
- }
- UString GetAllExtensions() const
- {
- UString s;
- for (int i = 0; i < Extensions.Size(); i++)
- {
- if (i > 0)
- s += ' ';
- s += Extensions[i].Ext;
- }
- return s;
- }
- const UString &GetMainExtension() const
- {
- return Extensions[0].Ext;
- }
- bool UpdateEnabled;
- bool KeepName;
-
- CArchiverInfo(): UpdateEnabled(false), KeepName(false)
- #ifndef _SFX
- ,Associate(true)
- #endif
- {}
-};
-
-void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers);
-
-#endif
diff --git a/CPP/7zip/UI/Common/CompressCall.cpp b/CPP/7zip/UI/Common/CompressCall.cpp
index 86bdd297..8b858bd3 100755
--- a/CPP/7zip/UI/Common/CompressCall.cpp
+++ b/CPP/7zip/UI/Common/CompressCall.cpp
@@ -365,3 +365,11 @@ HRESULT TestArchives(const UStringVector &archivePaths)
params += L" t";
return ExtractGroupCommand(archivePaths, params);
}
+
+HRESULT Benchmark()
+{
+ UString params;
+ params = Get7zGuiPath();
+ params += L" b";
+ return MyCreateProcess(params, 0, false, NULL);
+}
diff --git a/CPP/7zip/UI/Common/CompressCall.h b/CPP/7zip/UI/Common/CompressCall.h
index 95be95c3..23e68838 100755
--- a/CPP/7zip/UI/Common/CompressCall.h
+++ b/CPP/7zip/UI/Common/CompressCall.h
@@ -24,5 +24,7 @@ HRESULT ExtractArchives(
HRESULT TestArchives(const UStringVector &archivePaths);
+HRESULT Benchmark();
+
#endif
diff --git a/CPP/7zip/UI/Common/Extract.cpp b/CPP/7zip/UI/Common/Extract.cpp
index 34fb383b..8d3df8e1 100755
--- a/CPP/7zip/UI/Common/Extract.cpp
+++ b/CPP/7zip/UI/Common/Extract.cpp
@@ -10,10 +10,6 @@
#include "OpenArchive.h"
#include "SetProperties.h"
-#ifndef EXCLUDE_COM
-#include "Windows/DLL.h"
-#endif
-
using namespace NWindows;
HRESULT DecompressArchive(
@@ -85,6 +81,7 @@ HRESULT DecompressArchive(
}
HRESULT DecompressArchives(
+ CCodecs *codecs,
UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
const CExtractOptions &optionsSpec,
@@ -111,7 +108,7 @@ HRESULT DecompressArchives(
RINOK(extractCallback->BeforeOpen(archivePath));
CArchiveLink archiveLink;
- HRESULT result = MyOpenArchive(archivePath, archiveLink, openCallback);
+ HRESULT result = MyOpenArchive(codecs, archivePath, archiveLink, openCallback);
bool crypted = false;
#ifndef _NO_CRYPTO
diff --git a/CPP/7zip/UI/Common/Extract.h b/CPP/7zip/UI/Common/Extract.h
index c7b47c84..232f988f 100755
--- a/CPP/7zip/UI/Common/Extract.h
+++ b/CPP/7zip/UI/Common/Extract.h
@@ -13,6 +13,8 @@
#include "ExtractMode.h"
#include "Property.h"
+#include "../Common/LoadCodecs.h"
+
class CExtractOptions
{
public:
@@ -34,6 +36,10 @@ public:
NExtract::NOverwriteMode::EEnum OverwriteMode;
+ #ifdef EXTERNAL_CODECS
+ CCodecs *Codecs;
+ #endif
+
CExtractOptions():
StdOutMode(false),
YesToAll(false),
@@ -49,6 +55,7 @@ public:
};
HRESULT DecompressArchives(
+ CCodecs *codecs,
UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
const CExtractOptions &options,
diff --git a/CPP/7zip/UI/Common/LoadCodecs.cpp b/CPP/7zip/UI/Common/LoadCodecs.cpp
new file mode 100755
index 00000000..bb6b9696
--- /dev/null
+++ b/CPP/7zip/UI/Common/LoadCodecs.cpp
@@ -0,0 +1,621 @@
+// LoadCodecs.cpp
+
+#include "StdAfx.h"
+
+#include "LoadCodecs.h"
+
+#include "../../../Common/MyCom.h"
+#ifdef NEW_FOLDER_INTERFACE
+#include "../../../Common/StringToInt.h"
+#endif
+#include "../../../Windows/PropVariant.h"
+
+#include "../../ICoder.h"
+#include "../../Common/RegisterArc.h"
+
+#ifdef EXTERNAL_CODECS
+#include "../../../Windows/FileFind.h"
+#include "../../../Windows/DLL.h"
+#ifdef NEW_FOLDER_INTERFACE
+#include "../../../Windows/ResourceString.h"
+static const UINT kIconTypesResId = 100;
+#endif
+
+#ifdef _WIN32
+#include "Windows/Registry.h"
+#endif
+
+using namespace NWindows;
+using namespace NFile;
+
+extern HINSTANCE g_hInstance;
+
+static CSysString GetLibraryFolderPrefix()
+{
+ TCHAR fullPath[MAX_PATH + 1];
+ ::GetModuleFileName(g_hInstance, fullPath, MAX_PATH);
+ CSysString path = fullPath;
+ int pos = path.ReverseFind(TEXT(CHAR_PATH_SEPARATOR));
+ return path.Left(pos + 1);
+}
+
+#define kCodecsFolderName TEXT("Codecs")
+#define kFormatsFolderName TEXT("Formats")
+static TCHAR *kMainDll = TEXT("7z.dll");
+
+#ifdef _WIN32
+static LPCTSTR kRegistryPath = TEXT("Software\\7-zip");
+static LPCTSTR kProgramPathValue = TEXT("Path");
+static bool ReadPathFromRegistry(HKEY baseKey, CSysString &path)
+{
+ NRegistry::CKey key;
+ if(key.Open(baseKey, kRegistryPath, KEY_READ) == ERROR_SUCCESS)
+ if (key.QueryValue(kProgramPathValue, path) == ERROR_SUCCESS)
+ {
+ NName::NormalizeDirPathPrefix(path);
+ return true;
+ }
+ return false;
+}
+
+CSysString GetBaseFolderPrefixFromRegistry()
+{
+ CSysString moduleFolderPrefix = GetLibraryFolderPrefix();
+ NFind::CFileInfo fileInfo;
+ if (NFind::FindFile(moduleFolderPrefix + kMainDll, fileInfo))
+ if (!fileInfo.IsDirectory())
+ return moduleFolderPrefix;
+ if (NFind::FindFile(moduleFolderPrefix + kCodecsFolderName, fileInfo))
+ if (fileInfo.IsDirectory())
+ return moduleFolderPrefix;
+ if (NFind::FindFile(moduleFolderPrefix + kFormatsFolderName, fileInfo))
+ if (fileInfo.IsDirectory())
+ return moduleFolderPrefix;
+ CSysString path;
+ #ifdef _WIN32
+ if (ReadPathFromRegistry(HKEY_CURRENT_USER, path))
+ return path;
+ if (ReadPathFromRegistry(HKEY_LOCAL_MACHINE, path))
+ return path;
+ #endif
+ return moduleFolderPrefix;
+}
+
+#endif
+
+
+typedef UInt32 (WINAPI *GetNumberOfMethodsFunc)(UInt32 *numMethods);
+typedef UInt32 (WINAPI *GetNumberOfFormatsFunc)(UInt32 *numFormats);
+typedef UInt32 (WINAPI *GetHandlerPropertyFunc)(PROPID propID, PROPVARIANT *value);
+typedef UInt32 (WINAPI *GetHandlerPropertyFunc2)(UInt32 index, PROPID propID, PROPVARIANT *value);
+typedef UINT32 (WINAPI *CreateObjectFunc)(const GUID *clsID, const GUID *iid, void **outObject);
+
+
+static HRESULT GetCoderClass(GetMethodPropertyFunc getMethodProperty, UInt32 index,
+ PROPID propId, CLSID &clsId, bool &isAssigned)
+{
+ NWindows::NCOM::CPropVariant prop;
+ isAssigned = false;
+ RINOK(getMethodProperty(index, propId, &prop));
+ if (prop.vt == VT_BSTR)
+ {
+ isAssigned = true;
+ clsId = *(const GUID *)prop.bstrVal;
+ }
+ else if (prop.vt != VT_EMPTY)
+ return E_FAIL;
+ return S_OK;
+}
+
+HRESULT CCodecs::LoadCodecs()
+{
+ CCodecLib &lib = Libs.Back();
+ lib.GetMethodProperty = (GetMethodPropertyFunc)lib.Lib.GetProcAddress("GetMethodProperty");
+ if (lib.GetMethodProperty == NULL)
+ return S_OK;
+
+ UInt32 numMethods = 1;
+ GetNumberOfMethodsFunc getNumberOfMethodsFunc = (GetNumberOfMethodsFunc)lib.Lib.GetProcAddress("GetNumberOfMethods");
+ if (getNumberOfMethodsFunc != NULL)
+ {
+ RINOK(getNumberOfMethodsFunc(&numMethods));
+ }
+
+ for(UInt32 i = 0; i < numMethods; i++)
+ {
+ CDllCodecInfo info;
+ info.LibIndex = Libs.Size() - 1;
+ info.CodecIndex = i;
+
+ RINOK(GetCoderClass(lib.GetMethodProperty, i, NMethodPropID::kEncoder, info.Encoder, info.EncoderIsAssigned));
+ RINOK(GetCoderClass(lib.GetMethodProperty, i, NMethodPropID::kDecoder, info.Decoder, info.DecoderIsAssigned));
+
+ Codecs.Add(info);
+ }
+ return S_OK;
+}
+
+static HRESULT ReadProp(
+ GetHandlerPropertyFunc getProp,
+ GetHandlerPropertyFunc2 getProp2,
+ UInt32 index, PROPID propID, NCOM::CPropVariant &prop)
+{
+ if (getProp2)
+ return getProp2(index, propID, &prop);;
+ return getProp(propID, &prop);
+}
+
+static HRESULT ReadBoolProp(
+ GetHandlerPropertyFunc getProp,
+ GetHandlerPropertyFunc2 getProp2,
+ UInt32 index, PROPID propID, bool &res)
+{
+ NCOM::CPropVariant prop;
+ RINOK(ReadProp(getProp, getProp2, index, propID, prop));
+ if (prop.vt == VT_BOOL)
+ res = VARIANT_BOOLToBool(prop.boolVal);
+ else if (prop.vt != VT_EMPTY)
+ return E_FAIL;
+ return S_OK;
+}
+
+static HRESULT ReadStringProp(
+ GetHandlerPropertyFunc getProp,
+ GetHandlerPropertyFunc2 getProp2,
+ UInt32 index, PROPID propID, UString &res)
+{
+ NCOM::CPropVariant prop;
+ RINOK(ReadProp(getProp, getProp2, index, propID, prop));
+ if (prop.vt == VT_BSTR)
+ res = prop.bstrVal;
+ else if (prop.vt != VT_EMPTY)
+ return E_FAIL;
+ return S_OK;
+}
+
+#endif
+
+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;
+}
+
+static void SplitString(const UString &srcString, UStringVector &destStrings)
+{
+ destStrings.Clear();
+ UString s;
+ int len = srcString.Length();
+ if (len == 0)
+ return;
+ for (int i = 0; i < len; i++)
+ {
+ wchar_t c = srcString[i];
+ if (c == L' ')
+ {
+ if (!s.IsEmpty())
+ {
+ destStrings.Add(s);
+ s.Empty();
+ }
+ }
+ else
+ s += c;
+ }
+ if (!s.IsEmpty())
+ destStrings.Add(s);
+}
+
+void CArcInfoEx::AddExts(const wchar_t* ext, const wchar_t* addExt)
+{
+ UStringVector exts, addExts;
+ SplitString(ext, exts);
+ if (addExt != 0)
+ SplitString(addExt, addExts);
+ for (int i = 0; i < exts.Size(); i++)
+ {
+ CArcExtInfo extInfo;
+ extInfo.Ext = exts[i];
+ if (i < addExts.Size())
+ {
+ extInfo.AddExt = addExts[i];
+ if (extInfo.AddExt == L"*")
+ extInfo.AddExt.Empty();
+ }
+ Exts.Add(extInfo);
+ }
+}
+
+#ifdef EXTERNAL_CODECS
+
+HRESULT CCodecs::LoadFormats()
+{
+ const NDLL::CLibrary &lib = Libs.Back().Lib;
+ GetHandlerPropertyFunc getProp = 0;
+ GetHandlerPropertyFunc2 getProp2 = (GetHandlerPropertyFunc2)
+ lib.GetProcAddress("GetHandlerProperty2");
+ if (getProp2 == NULL)
+ {
+ getProp = (GetHandlerPropertyFunc)
+ lib.GetProcAddress("GetHandlerProperty");
+ if (getProp == NULL)
+ return S_OK;
+ }
+
+ UInt32 numFormats = 1;
+ GetNumberOfFormatsFunc getNumberOfFormats = (GetNumberOfFormatsFunc)
+ lib.GetProcAddress("GetNumberOfFormats");
+ if (getNumberOfFormats != NULL)
+ {
+ RINOK(getNumberOfFormats(&numFormats));
+ }
+ if (getProp2 == NULL)
+ numFormats = 1;
+
+ for(UInt32 i = 0; i < numFormats; i++)
+ {
+ CArcInfoEx item;
+ item.LibIndex = Libs.Size() - 1;
+ item.FormatIndex = i;
+
+ RINOK(ReadStringProp(getProp, getProp2, i, NArchive::kName, item.Name));
+
+ NCOM::CPropVariant prop;
+ if (ReadProp(getProp, getProp2, i, NArchive::kClassID, prop) != S_OK)
+ continue;
+ if (prop.vt != VT_BSTR)
+ continue;
+ item.ClassID = *(const GUID *)prop.bstrVal;
+ prop.Clear();
+
+ UString ext, addExt;
+ RINOK(ReadStringProp(getProp, getProp2, i, NArchive::kExtension, ext));
+ RINOK(ReadStringProp(getProp, getProp2, i, NArchive::kAddExtension, addExt));
+ item.AddExts(ext, addExt);
+
+ ReadBoolProp(getProp, getProp2, i, NArchive::kUpdate, item.UpdateEnabled);
+ if (item.UpdateEnabled)
+ ReadBoolProp(getProp, getProp2, i, NArchive::kKeepName, item.KeepName);
+
+ if (ReadProp(getProp, getProp2, i, NArchive::kStartSignature, prop) == S_OK)
+ if (prop.vt == VT_BSTR)
+ {
+ UINT len = ::SysStringByteLen(prop.bstrVal);
+ item.StartSignature.SetCapacity(len);
+ memmove(item.StartSignature, prop.bstrVal, len);
+ }
+ Formats.Add(item);
+ }
+ return S_OK;
+}
+
+#ifdef NEW_FOLDER_INTERFACE
+void CCodecLib::LoadIcons()
+{
+ UString iconTypes = MyLoadStringW((HMODULE)Lib, kIconTypesResId);
+ UStringVector pairs;
+ SplitString(iconTypes, pairs);
+ for (int i = 0; i < pairs.Size(); i++)
+ {
+ const UString &s = pairs[i];
+ int pos = s.Find(L':');
+ if (pos < 0)
+ continue;
+ CIconPair iconPair;
+ const wchar_t *end;
+ UString num = s.Mid(pos + 1);
+ iconPair.IconIndex = (UInt32)ConvertStringToUInt64(num, &end);
+ if (*end != L'\0')
+ continue;
+ iconPair.Ext = s.Left(pos);
+ IconPairs.Add(iconPair);
+ }
+}
+
+int CCodecLib::FindIconIndex(const UString &ext) const
+{
+ for (int i = 0; i < IconPairs.Size(); i++)
+ {
+ const CIconPair &pair = IconPairs[i];
+ if (ext.CompareNoCase(pair.Ext) == 0)
+ return pair.IconIndex;
+ }
+ return -1;
+}
+#endif
+
+HRESULT CCodecs::LoadDll(const CSysString &dllPath)
+{
+ {
+ NDLL::CLibrary library;
+ if (!library.LoadEx(dllPath, LOAD_LIBRARY_AS_DATAFILE))
+ return S_OK;
+ }
+ Libs.Add(CCodecLib());
+ CCodecLib &lib = Libs.Back();
+ #ifdef NEW_FOLDER_INTERFACE
+ lib.Path = dllPath;
+ #endif
+ bool used = false;
+ HRESULT res = S_OK;
+ if (lib.Lib.Load(dllPath))
+ {
+ #ifdef NEW_FOLDER_INTERFACE
+ lib.LoadIcons();
+ #endif
+ lib.CreateObject = (CreateObjectFunc)lib.Lib.GetProcAddress("CreateObject");
+ if (lib.CreateObject != 0)
+ {
+ int startSize = Codecs.Size();
+ res = LoadCodecs();
+ used = (Codecs.Size() != startSize);
+ if (res == S_OK)
+ {
+ startSize = Formats.Size();
+ res = LoadFormats();
+ used = used || (Formats.Size() != startSize);
+ }
+ }
+ }
+ if (!used)
+ Libs.DeleteBack();
+ return res;
+}
+
+HRESULT CCodecs::LoadDllsFromFolder(const CSysString &folderPrefix)
+{
+ NFile::NFind::CEnumerator enumerator(folderPrefix + CSysString(TEXT("*")));
+ NFile::NFind::CFileInfo fileInfo;
+ while (enumerator.Next(fileInfo))
+ {
+ if (fileInfo.IsDirectory())
+ continue;
+ RINOK(LoadDll(folderPrefix + fileInfo.Name));
+ }
+ return S_OK;
+}
+
+#endif
+
+#ifndef _SFX
+static inline void SetBuffer(CByteBuffer &bb, const Byte *data, int size)
+{
+ bb.SetCapacity(size);
+ memmove((Byte *)bb, data, size);
+}
+#endif
+
+HRESULT CCodecs::Load()
+{
+ Formats.Clear();
+ #ifdef EXTERNAL_CODECS
+ Codecs.Clear();
+ #endif
+ for (UInt32 i = 0; i < g_NumArcs; i++)
+ {
+ const CArcInfo &arc = *g_Arcs[i];
+ CArcInfoEx item;
+ item.Name = arc.Name;
+ item.CreateInArchive = arc.CreateInArchive;
+ item.CreateOutArchive = arc.CreateOutArchive;
+ item.AddExts(arc.Ext, arc.AddExt);
+ item.UpdateEnabled = (arc.CreateOutArchive != 0);
+ item.KeepName = arc.KeepName;
+
+ #ifndef _SFX
+ SetBuffer(item.StartSignature, arc.Signature, arc.SignatureSize);
+ #endif
+ Formats.Add(item);
+ }
+ #ifdef EXTERNAL_CODECS
+ const CSysString baseFolder = GetBaseFolderPrefixFromRegistry();
+ RINOK(LoadDll(baseFolder + kMainDll));
+ RINOK(LoadDllsFromFolder(baseFolder + kCodecsFolderName TEXT(STRING_PATH_SEPARATOR)));
+ RINOK(LoadDllsFromFolder(baseFolder + kFormatsFolderName TEXT(STRING_PATH_SEPARATOR)));
+ #endif
+ return S_OK;
+}
+
+int CCodecs::FindFormatForArchiveName(const UString &archivePath) const
+{
+ int slashPos1 = archivePath.ReverseFind(L'\\');
+ int slashPos2 = archivePath.ReverseFind(L'.');
+ int dotPos = archivePath.ReverseFind(L'.');
+ if (dotPos < 0 || dotPos < slashPos1 || dotPos < slashPos2)
+ return -1;
+ UString ext = archivePath.Mid(dotPos + 1);
+ for (int i = 0; i < Formats.Size(); i++)
+ {
+ const CArcInfoEx &arc = Formats[i];
+ if (!arc.UpdateEnabled)
+ continue;
+ // if (arc.FindExtension(ext) >= 0)
+ UString mainExt = arc.GetMainExt();
+ if (!mainExt.IsEmpty() && ext.CompareNoCase(mainExt) == 0)
+ return i;
+ }
+ return -1;
+}
+
+int CCodecs::FindFormatForArchiveType(const UString &arcType) const
+{
+ for (int i = 0; i < Formats.Size(); i++)
+ {
+ const CArcInfoEx &arc = Formats[i];
+ if (!arc.UpdateEnabled)
+ continue;
+ if (arc.Name.CompareNoCase(arcType) == 0)
+ return i;
+ }
+ return -1;
+}
+
+#ifdef EXTERNAL_CODECS
+
+#ifdef EXPORT_CODECS
+extern unsigned int g_NumCodecs;
+STDAPI CreateCoder2(bool encode, UInt32 index, const GUID *iid, void **outObject);
+STDAPI GetMethodProperty(UInt32 codecIndex, PROPID propID, PROPVARIANT *value);
+// STDAPI GetNumberOfMethods(UINT32 *numCodecs);
+#endif
+
+STDMETHODIMP CCodecs::GetNumberOfMethods(UINT32 *numMethods)
+{
+ *numMethods =
+ #ifdef EXPORT_CODECS
+ g_NumCodecs +
+ #endif
+ Codecs.Size();
+ return S_OK;
+}
+
+STDMETHODIMP CCodecs::GetProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
+{
+ #ifdef EXPORT_CODECS
+ if (index < g_NumCodecs)
+ return GetMethodProperty(index, propID, value);
+ #endif
+
+ const CDllCodecInfo &ci = Codecs[index
+ #ifdef EXPORT_CODECS
+ - g_NumCodecs
+ #endif
+ ];
+
+ if (propID == NMethodPropID::kDecoderIsAssigned)
+ {
+ NWindows::NCOM::CPropVariant propVariant;
+ propVariant = ci.DecoderIsAssigned;
+ propVariant.Detach(value);
+ return S_OK;
+ }
+ if (propID == NMethodPropID::kEncoderIsAssigned)
+ {
+ NWindows::NCOM::CPropVariant propVariant;
+ propVariant = ci.EncoderIsAssigned;
+ propVariant.Detach(value);
+ return S_OK;
+ }
+ return Libs[ci.LibIndex].GetMethodProperty(ci.CodecIndex, propID, value);
+}
+
+STDMETHODIMP CCodecs::CreateDecoder(UINT32 index, const GUID *iid, void **coder)
+{
+ #ifdef EXPORT_CODECS
+ if (index < g_NumCodecs)
+ return CreateCoder2(false, index, iid, coder);
+ #endif
+ const CDllCodecInfo &ci = Codecs[index
+ #ifdef EXPORT_CODECS
+ - g_NumCodecs
+ #endif
+ ];
+ if (ci.DecoderIsAssigned)
+ return Libs[ci.LibIndex].CreateObject(&ci.Decoder, iid, (void **)coder);
+ return S_OK;
+}
+
+STDMETHODIMP CCodecs::CreateEncoder(UINT32 index, const GUID *iid, void **coder)
+{
+ #ifdef EXPORT_CODECS
+ if (index < g_NumCodecs)
+ return CreateCoder2(true, index, iid, coder);
+ #endif
+ const CDllCodecInfo &ci = Codecs[index
+ #ifdef EXPORT_CODECS
+ - g_NumCodecs
+ #endif
+ ];
+ if (ci.EncoderIsAssigned)
+ return Libs[ci.LibIndex].CreateObject(&ci.Encoder, iid, (void **)coder);
+ return S_OK;
+}
+
+HRESULT CCodecs::CreateCoder(const UString &name, bool encode, CMyComPtr<ICompressCoder> &coder) const
+{
+ for (int i = 0; i < Codecs.Size(); i++)
+ {
+ const CDllCodecInfo &codec = Codecs[i];
+ if (encode && !codec.EncoderIsAssigned || !encode && !codec.DecoderIsAssigned)
+ continue;
+ const CCodecLib &lib = Libs[codec.LibIndex];
+ UString res;
+ NWindows::NCOM::CPropVariant prop;
+ RINOK(lib.GetMethodProperty(codec.CodecIndex, NMethodPropID::kName, &prop));
+ if (prop.vt == VT_BSTR)
+ res = prop.bstrVal;
+ else if (prop.vt != VT_EMPTY)
+ continue;
+ if (name.CompareNoCase(res) == 0)
+ return lib.CreateObject(encode ? &codec.Encoder : &codec.Decoder, &IID_ICompressCoder, (void **)&coder);
+ }
+ return CLASS_E_CLASSNOTAVAILABLE;
+}
+
+int CCodecs::GetCodecLibIndex(UInt32 index)
+{
+ #ifdef EXPORT_CODECS
+ if (index < g_NumCodecs)
+ return -1;
+ #endif
+ #ifdef EXTERNAL_CODECS
+ const CDllCodecInfo &ci = Codecs[index
+ #ifdef EXPORT_CODECS
+ - g_NumCodecs
+ #endif
+ ];
+ return ci.LibIndex;
+ #else
+ return -1;
+ #endif
+}
+
+bool CCodecs::GetCodecEncoderIsAssigned(UInt32 index)
+{
+ #ifdef EXPORT_CODECS
+ if (index < g_NumCodecs)
+ {
+ NWindows::NCOM::CPropVariant prop;
+ if (GetProperty(index, NMethodPropID::kEncoder, &prop) == S_OK)
+ if (prop.vt != VT_EMPTY)
+ return true;
+ return false;
+ }
+ #endif
+ #ifdef EXTERNAL_CODECS
+ const CDllCodecInfo &ci = Codecs[index
+ #ifdef EXPORT_CODECS
+ - g_NumCodecs
+ #endif
+ ];
+ return ci.EncoderIsAssigned;
+ #else
+ return false;
+ #endif
+}
+
+HRESULT CCodecs::GetCodecId(UInt32 index, UInt64 &id)
+{
+ UString s;
+ NWindows::NCOM::CPropVariant prop;
+ RINOK(GetProperty(index, NMethodPropID::kID, &prop));
+ if (prop.vt != VT_UI8)
+ return E_INVALIDARG;
+ id = prop.uhVal.QuadPart;
+ return S_OK;
+}
+
+UString CCodecs::GetCodecName(UInt32 index)
+{
+ UString s;
+ NWindows::NCOM::CPropVariant prop;
+ if (GetProperty(index, NMethodPropID::kName, &prop) == S_OK)
+ if (prop.vt == VT_BSTR)
+ s = prop.bstrVal;
+ return s;
+}
+
+#endif
diff --git a/CPP/7zip/UI/Common/LoadCodecs.h b/CPP/7zip/UI/Common/LoadCodecs.h
new file mode 100755
index 00000000..28cc7dad
--- /dev/null
+++ b/CPP/7zip/UI/Common/LoadCodecs.h
@@ -0,0 +1,215 @@
+// LoadCodecs.h
+
+#ifndef __LOADCODECS_H
+#define __LOADCODECS_H
+
+#include "../../../Common/Types.h"
+#include "../../../Common/MyCom.h"
+#include "../../../Common/String.h"
+#include "../../../Common/Buffer.h"
+#include "../../ICoder.h"
+
+#ifdef EXTERNAL_CODECS
+#include "../../../Windows/DLL.h"
+#endif
+
+struct CDllCodecInfo
+{
+ CLSID Encoder;
+ CLSID Decoder;
+ bool EncoderIsAssigned;
+ bool DecoderIsAssigned;
+ int LibIndex;
+ UInt32 CodecIndex;
+};
+
+#include "../../Archive/IArchive.h"
+
+typedef IInArchive * (*CreateInArchiveP)();
+typedef IOutArchive * (*CreateOutArchiveP)();
+
+struct CArcExtInfo
+{
+ UString Ext;
+ UString AddExt;
+ CArcExtInfo() {}
+ CArcExtInfo(const UString &ext): Ext(ext) {}
+ CArcExtInfo(const UString &ext, const UString &addExt): Ext(ext), AddExt(addExt) {}
+};
+
+
+struct CArcInfoEx
+{
+ #ifdef EXTERNAL_CODECS
+ int LibIndex;
+ UInt32 FormatIndex;
+ CLSID ClassID;
+ #endif
+ bool UpdateEnabled;
+ CreateInArchiveP CreateInArchive;
+ CreateOutArchiveP CreateOutArchive;
+ UString Name;
+ CObjectVector<CArcExtInfo> Exts;
+ #ifndef _SFX
+ CByteBuffer StartSignature;
+ // CByteBuffer FinishSignature;
+ #ifdef NEW_FOLDER_INTERFACE
+ UStringVector AssociateExts;
+ #endif
+ #endif
+ bool KeepName;
+ UString GetMainExt() const
+ {
+ if (Exts.IsEmpty())
+ return UString();
+ return Exts[0].Ext;
+ }
+ int FindExtension(const UString &ext) const
+ {
+ for (int i = 0; i < Exts.Size(); i++)
+ if (ext.CompareNoCase(Exts[i].Ext) == 0)
+ return i;
+ return -1;
+ }
+ UString GetAllExtensions() const
+ {
+ UString s;
+ for (int i = 0; i < Exts.Size(); i++)
+ {
+ if (i > 0)
+ s += ' ';
+ s += Exts[i].Ext;
+ }
+ return s;
+ }
+
+ void AddExts(const wchar_t* ext, const wchar_t* addExt);
+
+ CArcInfoEx():
+ #ifdef EXTERNAL_CODECS
+ LibIndex(-1),
+ #endif
+ UpdateEnabled(false),
+ CreateInArchive(0), CreateOutArchive(0),
+ KeepName(false)
+ #ifndef _SFX
+ #endif
+ {}
+};
+
+#ifdef EXTERNAL_CODECS
+typedef UInt32 (WINAPI *GetMethodPropertyFunc)(UInt32 index, PROPID propID, PROPVARIANT *value);
+typedef UInt32 (WINAPI *CreateObjectFunc)(const GUID *clsID, const GUID *interfaceID, void **outObject);
+
+
+struct CCodecLib
+{
+ NWindows::NDLL::CLibrary Lib;
+ GetMethodPropertyFunc GetMethodProperty;
+ CreateObjectFunc CreateObject;
+ #ifdef NEW_FOLDER_INTERFACE
+ struct CIconPair
+ {
+ UString Ext;
+ UInt32 IconIndex;
+ };
+ CSysString Path;
+ CObjectVector<CIconPair> IconPairs;
+ void LoadIcons();
+ int FindIconIndex(const UString &ext) const;
+ #endif
+ CCodecLib(): GetMethodProperty(0) {}
+};
+#endif
+
+class CCodecs:
+ #ifdef EXTERNAL_CODECS
+ public ICompressCodecsInfo,
+ #else
+ public IUnknown,
+ #endif
+ public CMyUnknownImp
+{
+public:
+ #ifdef EXTERNAL_CODECS
+ CObjectVector<CCodecLib> Libs;
+ CObjectVector<CDllCodecInfo> Codecs;
+ HRESULT LoadCodecs();
+ HRESULT LoadFormats();
+ HRESULT LoadDll(const CSysString &path);
+ HRESULT LoadDllsFromFolder(const CSysString &folderPrefix);
+
+ HRESULT CreateArchiveHandler(const CArcInfoEx &ai, void **archive, bool outHandler) const
+ {
+ return Libs[ai.LibIndex].CreateObject(&ai.ClassID, outHandler ? &IID_IOutArchive : &IID_IInArchive, (void **)archive);
+ }
+ #endif
+
+public:
+ CObjectVector<CArcInfoEx> Formats;
+ HRESULT Load();
+ int FindFormatForArchiveName(const UString &archivePath) const;
+ int FindFormatForArchiveType(const UString &arcType) const;
+
+ MY_UNKNOWN_IMP
+
+ #ifdef EXTERNAL_CODECS
+ STDMETHOD(GetNumberOfMethods)(UINT32 *numMethods);
+ STDMETHOD(GetProperty)(UINT32 index, PROPID propID, PROPVARIANT *value);
+ STDMETHOD(CreateDecoder)(UINT32 index, const GUID *interfaceID, void **coder);
+ STDMETHOD(CreateEncoder)(UINT32 index, const GUID *interfaceID, void **coder);
+ #endif
+
+ int GetCodecLibIndex(UInt32 index);
+ bool GetCodecEncoderIsAssigned(UInt32 index);
+ HRESULT GetCodecId(UInt32 index, UInt64 &id);
+ UString GetCodecName(UInt32 index);
+
+ HRESULT CreateInArchive(int formatIndex, CMyComPtr<IInArchive> &archive) const
+ {
+ const CArcInfoEx &ai = Formats[formatIndex];
+ #ifdef EXTERNAL_CODECS
+ if (ai.LibIndex < 0)
+ #endif
+ {
+ archive = ai.CreateInArchive();
+ return S_OK;
+ }
+ #ifdef EXTERNAL_CODECS
+ return CreateArchiveHandler(ai, (void **)&archive, false);
+ #endif
+ }
+ HRESULT CreateOutArchive(int formatIndex, CMyComPtr<IOutArchive> &archive) const
+ {
+ const CArcInfoEx &ai = Formats[formatIndex];
+ #ifdef EXTERNAL_CODECS
+ if (ai.LibIndex < 0)
+ #endif
+ {
+ archive = ai.CreateOutArchive();
+ return S_OK;
+ }
+ #ifdef EXTERNAL_CODECS
+ return CreateArchiveHandler(ai, (void **)&archive, true);
+ #endif
+ }
+ int FindOutFormatFromName(const UString &name) const
+ {
+ for (int i = 0; i < Formats.Size(); i++)
+ {
+ const CArcInfoEx &arc = Formats[i];
+ if (!arc.UpdateEnabled)
+ continue;
+ if (arc.Name.CompareNoCase(name) == 0)
+ return i;
+ }
+ return -1;
+ }
+
+ #ifdef EXTERNAL_CODECS
+ HRESULT CreateCoder(const UString &name, bool encode, CMyComPtr<ICompressCoder> &coder) const;
+ #endif
+
+};
+
+#endif
diff --git a/CPP/7zip/UI/Common/OpenArchive.cpp b/CPP/7zip/UI/Common/OpenArchive.cpp
index ce1a6de3..0f73890f 100755
--- a/CPP/7zip/UI/Common/OpenArchive.cpp
+++ b/CPP/7zip/UI/Common/OpenArchive.cpp
@@ -16,42 +16,6 @@
#include "Common/StringConvert.h"
-#ifdef FORMAT_7Z
-#include "../../Archive/7z/7zHandler.h"
-#endif
-
-#ifdef FORMAT_BZIP2
-#include "../../Archive/BZip2/BZip2Handler.h"
-#endif
-
-#ifdef FORMAT_CAB
-#include "../../Archive/Cab/CabHandler.h"
-#endif
-
-#ifdef FORMAT_GZIP
-#include "../../Archive/GZip/GZipHandler.h"
-#endif
-
-#ifdef FORMAT_SPLIT
-#include "../../Archive/Split/SplitHandler.h"
-#endif
-
-#ifdef FORMAT_TAR
-#include "../../Archive/Tar/TarHandler.h"
-#endif
-
-#ifdef FORMAT_ZIP
-#include "../../Archive/Zip/ZipHandler.h"
-#endif
-
-#ifdef FORMAT_Z
-#include "../../Archive/Z/ZHandler.h"
-#endif
-
-#ifndef EXCLUDE_COM
-#include "HandlerLoader.h"
-#endif
-
#include "DefaultName.h"
using namespace NWindows;
@@ -136,19 +100,15 @@ static inline bool TestSignature(const Byte *p1, const Byte *p2, size_t size)
#endif
HRESULT OpenArchive(
+ CCodecs *codecs,
IInStream *inStream,
const UString &fileName,
- #ifndef EXCLUDE_COM
- HMODULE *module,
- #endif
IInArchive **archiveResult,
- CArchiverInfo &archiverInfoResult,
+ int &formatIndex,
UString &defaultItemName,
IArchiveOpenCallback *openArchiveCallback)
{
*archiveResult = NULL;
- CObjectVector<CArchiverInfo> archiverInfoList;
- ReadArchiverInfoList(archiverInfoList);
UString extension;
{
int dotPos = fileName.ReverseFind(L'.');
@@ -157,21 +117,17 @@ HRESULT OpenArchive(
}
CIntVector orderIndices;
int i;
- bool finded = false;
- for(i = 0; i < archiverInfoList.Size(); i++)
- {
- if (archiverInfoList[i].FindExtension(extension) >= 0)
- {
- orderIndices.Insert(0, i);
- finded = true;
- }
+ int numFinded = 0;
+ for (i = 0; i < codecs->Formats.Size(); i++)
+ if (codecs->Formats[i].FindExtension(extension) >= 0)
+ orderIndices.Insert(numFinded++, i);
else
orderIndices.Add(i);
- }
#ifndef _SFX
- if (!finded)
+ if (numFinded != 1)
{
+ CIntVector orderIndices2;
CByteBuffer byteBuffer;
const UInt32 kBufferSize = (200 << 10);
byteBuffer.SetCapacity(kBufferSize);
@@ -179,13 +135,12 @@ HRESULT OpenArchive(
RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
UInt32 processedSize;
RINOK(ReadStream(inStream, buffer, kBufferSize, &processedSize));
- int numFinded = 0;
- for (int pos = (int)processedSize; pos >= 0 ; pos--)
+ for (UInt32 pos = 0; pos < processedSize; pos++)
{
- for(int i = numFinded; i < orderIndices.Size(); i++)
+ for (int i = 0; i < orderIndices.Size(); i++)
{
int index = orderIndices[i];
- const CArchiverInfo &ai = archiverInfoList[index];
+ const CArcInfoEx &ai = codecs->Formats[index];
const CByteBuffer &sig = ai.StartSignature;
if (sig.GetCapacity() == 0)
continue;
@@ -193,12 +148,13 @@ HRESULT OpenArchive(
continue;
if (TestSignature(buffer + pos, sig, sig.GetCapacity()))
{
- orderIndices.Delete(i);
- orderIndices.Insert(0, index);
- numFinded++;
+ orderIndices2.Add(index);
+ orderIndices.Delete(i--);
}
}
}
+ orderIndices2 += orderIndices;
+ orderIndices = orderIndices2;
}
#endif
@@ -206,68 +162,27 @@ HRESULT OpenArchive(
for(i = 0; i < orderIndices.Size(); i++)
{
inStream->Seek(0, STREAM_SEEK_SET, NULL);
- const CArchiverInfo &archiverInfo = archiverInfoList[orderIndices[i]];
- #ifndef EXCLUDE_COM
- CHandlerLoader loader;
- #endif
- CMyComPtr<IInArchive> archive;
-
- #ifdef FORMAT_7Z
- if (archiverInfo.Name.CompareNoCase(L"7z") == 0)
- archive = new NArchive::N7z::CHandler;
- #endif
-
- #ifdef FORMAT_BZIP2
- if (archiverInfo.Name.CompareNoCase(L"BZip2") == 0)
- archive = new NArchive::NBZip2::CHandler;
- #endif
-
- #ifdef FORMAT_CAB
- if (archiverInfo.Name.CompareNoCase(L"Cab") == 0)
- archive = new NArchive::NCab::CHandler;
- #endif
-
- #ifdef FORMAT_GZIP
- if (archiverInfo.Name.CompareNoCase(L"GZip") == 0)
- archive = new NArchive::NGZip::CHandler;
- #endif
-
- #ifdef FORMAT_SPLIT
- if (archiverInfo.Name.CompareNoCase(L"Split") == 0)
- archive = new NArchive::NSplit::CHandler;
- #endif
-
- #ifdef FORMAT_TAR
- if (archiverInfo.Name.CompareNoCase(L"Tar") == 0)
- archive = new NArchive::NTar::CHandler;
- #endif
-
- #ifdef FORMAT_ZIP
- if (archiverInfo.Name.CompareNoCase(L"Zip") == 0)
- archive = new NArchive::NZip::CHandler;
- #endif
-
- #ifdef FORMAT_Z
- if (archiverInfo.Name.CompareNoCase(L"Z") == 0)
- archive = new NArchive::NZ::CHandler;
- #endif
+ CMyComPtr<IInArchive> archive;
- #ifndef EXCLUDE_COM
+ formatIndex = orderIndices[i];
+ RINOK(codecs->CreateInArchive(formatIndex, archive));
if (!archive)
+ continue;
+
+ #ifdef EXTERNAL_CODECS
{
- HRESULT result = loader.CreateHandler(archiverInfo.FilePath,
- archiverInfo.ClassID, (void **)&archive, false);
- if (result != S_OK)
- continue;
+ CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
+ archive.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
+ if (setCompressCodecsInfo)
+ {
+ RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecs));
+ }
}
#endif
-
- if (!archive)
- return E_FAIL;
-
+
HRESULT result = archive->Open(inStream, &kMaxCheckStartPosition, openArchiveCallback);
- if(result == S_FALSE)
+ if (result == S_FALSE)
continue;
if(result != S_OK)
{
@@ -277,17 +192,20 @@ HRESULT OpenArchive(
continue;
}
*archiveResult = archive.Detach();
- #ifndef EXCLUDE_COM
- *module = loader.Detach();
- #endif
- archiverInfoResult = archiverInfo;
- int subExtIndex = archiverInfo.FindExtension(extension);
- if (subExtIndex < 0)
- subExtIndex = 0;
- defaultItemName = GetDefaultName2(fileName,
- archiverInfo.Extensions[subExtIndex].Ext,
- archiverInfo.Extensions[subExtIndex].AddExt);
-
+ const CArcInfoEx &format = codecs->Formats[formatIndex];
+ if (format.Exts.Size() == 0)
+ {
+ defaultItemName = GetDefaultName2(fileName, L"", L"");
+ }
+ else
+ {
+ int subExtIndex = format.FindExtension(extension);
+ if (subExtIndex < 0)
+ subExtIndex = 0;
+ defaultItemName = GetDefaultName2(fileName,
+ format.Exts[subExtIndex].Ext,
+ format.Exts[subExtIndex].AddExt);
+ }
return S_OK;
}
if (badResult != S_OK)
@@ -295,12 +213,11 @@ HRESULT OpenArchive(
return S_FALSE;
}
-HRESULT OpenArchive(const UString &filePath,
- #ifndef EXCLUDE_COM
- HMODULE *module,
- #endif
+HRESULT OpenArchive(
+ CCodecs *codecs,
+ const UString &filePath,
IInArchive **archiveResult,
- CArchiverInfo &archiverInfo,
+ int &formatIndex,
UString &defaultItemName,
IArchiveOpenCallback *openArchiveCallback)
{
@@ -308,11 +225,8 @@ HRESULT OpenArchive(const UString &filePath,
CMyComPtr<IInStream> inStream(inStreamSpec);
if (!inStreamSpec->Open(filePath))
return GetLastError();
- return OpenArchive(inStream, ExtractFileNameFromPath(filePath),
- #ifndef EXCLUDE_COM
- module,
- #endif
- archiveResult, archiverInfo,
+ return OpenArchive(codecs, inStream, ExtractFileNameFromPath(filePath),
+ archiveResult, formatIndex,
defaultItemName, openArchiveCallback);
}
@@ -330,24 +244,19 @@ static void MakeDefaultName(UString &name)
name = name.Left(dotPos);
}
-HRESULT OpenArchive(const UString &fileName,
- #ifndef EXCLUDE_COM
- HMODULE *module0,
- HMODULE *module1,
- #endif
+HRESULT OpenArchive(
+ CCodecs *codecs,
+ const UString &fileName,
IInArchive **archive0,
IInArchive **archive1,
- CArchiverInfo &archiverInfo0,
- CArchiverInfo &archiverInfo1,
+ int &formatIndex0,
+ int &formatIndex1,
UString &defaultItemName0,
UString &defaultItemName1,
IArchiveOpenCallback *openArchiveCallback)
{
- HRESULT result = OpenArchive(fileName,
- #ifndef EXCLUDE_COM
- module0,
- #endif
- archive0, archiverInfo0, defaultItemName0, openArchiveCallback);
+ HRESULT result = OpenArchive(codecs, fileName,
+ archive0, formatIndex0, defaultItemName0, openArchiveCallback);
RINOK(result);
CMyComPtr<IInArchiveGetStream> getStream;
result = (*archive0)->QueryInterface(IID_IInArchiveGetStream, (void **)&getStream);
@@ -376,7 +285,8 @@ HRESULT OpenArchive(const UString &fileName,
{
MakeDefaultName(defaultItemName0);
subPath = defaultItemName0;
- if (archiverInfo0.Name.CompareNoCase(L"7z") == 0)
+ const CArcInfoEx &format = codecs->Formats[formatIndex0];
+ if (format.Name.CompareNoCase(L"7z") == 0)
{
if (subPath.Right(3).CompareNoCase(L".7z") != 0)
subPath += L".7z";
@@ -390,21 +300,15 @@ HRESULT OpenArchive(const UString &fileName,
if (setSubArchiveName)
setSubArchiveName->SetSubArchiveName(subPath);
- result = OpenArchive(subStream, subPath,
- #ifndef EXCLUDE_COM
- module1,
- #endif
- archive1, archiverInfo1, defaultItemName1, openArchiveCallback);
+ result = OpenArchive(codecs, subStream, subPath,
+ archive1, formatIndex1, defaultItemName1, openArchiveCallback);
return S_OK;
}
-HRESULT MyOpenArchive(const UString &archiveName,
- #ifndef EXCLUDE_COM
- HMODULE *module,
- #endif
- IInArchive **archive,
- UString &defaultItemName,
- IOpenCallbackUI *openCallbackUI)
+HRESULT MyOpenArchive(
+ CCodecs *codecs,
+ const UString &archiveName,
+ IInArchive **archive, UString &defaultItemName, IOpenCallbackUI *openCallbackUI)
{
COpenCallbackImp *openCallbackSpec = new COpenCallbackImp;
CMyComPtr<IArchiveOpenCallback> openCallback = openCallbackSpec;
@@ -417,22 +321,13 @@ HRESULT MyOpenArchive(const UString &archiveName,
fullName.Left(fileNamePartStartIndex),
fullName.Mid(fileNamePartStartIndex));
- CArchiverInfo archiverInfo;
- return OpenArchive(archiveName,
- #ifndef EXCLUDE_COM
- module,
- #endif
- archive,
- archiverInfo,
- defaultItemName,
- openCallback);
+ int formatInfo;
+ return OpenArchive(codecs, archiveName, archive, formatInfo, defaultItemName, openCallback);
}
-HRESULT MyOpenArchive(const UString &archiveName,
- #ifndef EXCLUDE_COM
- HMODULE *module0,
- HMODULE *module1,
- #endif
+HRESULT MyOpenArchive(
+ CCodecs *codecs,
+ const UString &archiveName,
IInArchive **archive0,
IInArchive **archive1,
UString &defaultItemName0,
@@ -451,20 +346,15 @@ HRESULT MyOpenArchive(const UString &archiveName,
UString name = fullName.Mid(fileNamePartStartIndex);
openCallbackSpec->Init(prefix, name);
- CArchiverInfo archiverInfo0, archiverInfo1;
- HRESULT result = OpenArchive(archiveName,
- #ifndef EXCLUDE_COM
- module0,
- module1,
- #endif
+ int formatIndex0, formatIndex1;
+ RINOK(OpenArchive(codecs, archiveName,
archive0,
archive1,
- archiverInfo0,
- archiverInfo1,
+ formatIndex0,
+ formatIndex1,
defaultItemName0,
defaultItemName1,
- openCallback);
- RINOK(result);
+ openCallback));
volumePaths.Add(prefix + name);
for (int i = 0; i < openCallbackSpec->FileNames.Size(); i++)
volumePaths.Add(prefix + openCallbackSpec->FileNames[i]);
@@ -482,50 +372,40 @@ HRESULT CArchiveLink::Close()
void CArchiveLink::Release()
{
- if (Archive1 != 0)
- Archive1.Release();
- if (Archive0 != 0)
- Archive0.Release();
- #ifndef EXCLUDE_COM
- Library1.Free();
- Library0.Free();
- #endif
+ Archive1.Release();
+ Archive0.Release();
}
-HRESULT OpenArchive(const UString &archiveName,
+HRESULT OpenArchive(
+ CCodecs *codecs,
+ const UString &archiveName,
CArchiveLink &archiveLink,
IArchiveOpenCallback *openCallback)
{
- return OpenArchive(archiveName,
- #ifndef EXCLUDE_COM
- &archiveLink.Library0, &archiveLink.Library1,
- #endif
+ return OpenArchive(codecs, archiveName,
&archiveLink.Archive0, &archiveLink.Archive1,
- archiveLink.ArchiverInfo0, archiveLink.ArchiverInfo1,
+ archiveLink.FormatIndex0, archiveLink.FormatIndex1,
archiveLink.DefaultItemName0, archiveLink.DefaultItemName1,
openCallback);
}
-HRESULT MyOpenArchive(const UString &archiveName,
+HRESULT MyOpenArchive(CCodecs *codecs,
+ const UString &archiveName,
CArchiveLink &archiveLink,
IOpenCallbackUI *openCallbackUI)
{
- return MyOpenArchive(archiveName,
- #ifndef EXCLUDE_COM
- &archiveLink.Library0, &archiveLink.Library1,
- #endif
+ return MyOpenArchive(codecs, archiveName,
&archiveLink.Archive0, &archiveLink.Archive1,
archiveLink.DefaultItemName0, archiveLink.DefaultItemName1,
archiveLink.VolumePaths,
openCallbackUI);
}
-HRESULT ReOpenArchive(CArchiveLink &archiveLink,
- const UString &fileName)
+HRESULT ReOpenArchive(CCodecs *codecs, CArchiveLink &archiveLink, const UString &fileName)
{
if (archiveLink.GetNumLevels() > 1)
return E_NOTIMPL;
if (archiveLink.GetNumLevels() == 0)
- return MyOpenArchive(fileName, archiveLink, 0);
+ return MyOpenArchive(codecs, fileName, archiveLink, 0);
return ReOpenArchive(archiveLink.GetArchive(), fileName);
}
diff --git a/CPP/7zip/UI/Common/OpenArchive.h b/CPP/7zip/UI/Common/OpenArchive.h
index f96b1ebf..d43c22b3 100755
--- a/CPP/7zip/UI/Common/OpenArchive.h
+++ b/CPP/7zip/UI/Common/OpenArchive.h
@@ -7,13 +7,9 @@
#include "Windows/FileFind.h"
#include "../../Archive/IArchive.h"
-#include "ArchiverInfo.h"
+#include "LoadCodecs.h"
#include "ArchiveOpenCallback.h"
-#ifndef EXCLUDE_COM
-#include "Windows/DLL.h"
-#endif
-
HRESULT GetArchiveItemPath(IInArchive *archive, UInt32 index, UString &result);
HRESULT GetArchiveItemPath(IInArchive *archive, UInt32 index, const UString &defaultName, UString &result);
HRESULT GetArchiveItemFileTime(IInArchive *archive, UInt32 index,
@@ -27,55 +23,46 @@ struct ISetSubArchiveName
};
HRESULT OpenArchive(
+ CCodecs *codecs,
IInStream *inStream,
const UString &fileName,
- #ifndef EXCLUDE_COM
- HMODULE *module,
- #endif
IInArchive **archiveResult,
- CArchiverInfo &archiverInfoResult,
+ int &formatIndex,
UString &defaultItemName,
IArchiveOpenCallback *openArchiveCallback);
-HRESULT OpenArchive(const UString &filePath,
- #ifndef EXCLUDE_COM
- HMODULE *module,
- #endif
+HRESULT OpenArchive(
+ CCodecs *codecs,
+ const UString &filePath,
IInArchive **archive,
- CArchiverInfo &archiverInfo,
+ int &formatIndex,
UString &defaultItemName,
IArchiveOpenCallback *openArchiveCallback);
-HRESULT OpenArchive(const UString &filePath,
- #ifndef EXCLUDE_COM
- HMODULE *module0,
- HMODULE *module1,
- #endif
+HRESULT OpenArchive(
+ CCodecs *codecs,
+ const UString &filePath,
IInArchive **archive0,
IInArchive **archive1,
- CArchiverInfo &archiverInfo0,
- CArchiverInfo &archiverInfo1,
+ int &formatIndex0,
+ int &formatIndex1,
UString &defaultItemName0,
UString &defaultItemName1,
IArchiveOpenCallback *openArchiveCallback);
-HRESULT ReOpenArchive(IInArchive *archive,
- const UString &fileName);
+HRESULT ReOpenArchive(IInArchive *archive, const UString &fileName);
-HRESULT MyOpenArchive(const UString &archiveName,
- #ifndef EXCLUDE_COM
- HMODULE *module,
- #endif
+HRESULT MyOpenArchive(
+ CCodecs *codecs,
+ const UString &archiveName,
IInArchive **archive,
UString &defaultItemName,
IOpenCallbackUI *openCallbackUI);
-HRESULT MyOpenArchive(const UString &archiveName,
- #ifndef EXCLUDE_COM
- HMODULE *module0,
- HMODULE *module1,
- #endif
+HRESULT MyOpenArchive(
+ CCodecs *codecs,
+ const UString &archiveName,
IInArchive **archive0,
IInArchive **archive1,
UString &defaultItemName0,
@@ -85,17 +72,13 @@ HRESULT MyOpenArchive(const UString &archiveName,
struct CArchiveLink
{
- #ifndef EXCLUDE_COM
- NWindows::NDLL::CLibrary Library0;
- NWindows::NDLL::CLibrary Library1;
- #endif
CMyComPtr<IInArchive> Archive0;
CMyComPtr<IInArchive> Archive1;
UString DefaultItemName0;
UString DefaultItemName1;
- CArchiverInfo ArchiverInfo0;
- CArchiverInfo ArchiverInfo1;
+ int FormatIndex0;
+ int FormatIndex1;
UStringVector VolumePaths;
@@ -114,20 +97,26 @@ struct CArchiveLink
IInArchive *GetArchive() { return Archive1 != 0 ? Archive1: Archive0; }
UString GetDefaultItemName() { return Archive1 != 0 ? DefaultItemName1: DefaultItemName0; }
- const CArchiverInfo &GetArchiverInfo() { return Archive1 != 0 ? ArchiverInfo1: ArchiverInfo0; }
+ const int GetArchiverIndex() const { return Archive1 != 0 ? FormatIndex1: FormatIndex0; }
HRESULT Close();
void Release();
};
-HRESULT OpenArchive(const UString &archiveName,
+HRESULT OpenArchive(
+ CCodecs *codecs,
+ const UString &archiveName,
CArchiveLink &archiveLink,
IArchiveOpenCallback *openCallback);
-HRESULT MyOpenArchive(const UString &archiveName,
+HRESULT MyOpenArchive(
+ CCodecs *codecs,
+ const UString &archiveName,
CArchiveLink &archiveLink,
IOpenCallbackUI *openCallbackUI);
-HRESULT ReOpenArchive(CArchiveLink &archiveLink,
+HRESULT ReOpenArchive(
+ CCodecs *codecs,
+ CArchiveLink &archiveLink,
const UString &fileName);
#endif
diff --git a/CPP/7zip/UI/Common/Update.cpp b/CPP/7zip/UI/Common/Update.cpp
index cd7975d0..3772b676 100755
--- a/CPP/7zip/UI/Common/Update.cpp
+++ b/CPP/7zip/UI/Common/Update.cpp
@@ -37,30 +37,6 @@
#include "EnumDirItems.h"
#include "SetProperties.h"
-#ifdef FORMAT_7Z
-#include "../../Archive/7z/7zHandler.h"
-#endif
-
-#ifdef FORMAT_BZIP2
-#include "../../Archive/BZip2/BZip2Handler.h"
-#endif
-
-#ifdef FORMAT_GZIP
-#include "../../Archive/GZip/GZipHandler.h"
-#endif
-
-#ifdef FORMAT_TAR
-#include "../../Archive/Tar/TarHandler.h"
-#endif
-
-#ifdef FORMAT_ZIP
-#include "../../Archive/Zip/ZipHandler.h"
-#endif
-
-#ifndef EXCLUDE_COM
-#include "../Common/HandlerLoader.h"
-#endif
-
static const char *kUpdateIsNotSupoorted =
"update operations are not supported for this archive";
@@ -255,8 +231,47 @@ STDMETHODIMP COutMultiVolStream::SetSize(Int64 newSize)
return S_OK;
}
+static const wchar_t *kDefaultArchiveType = L"7z";
+static const wchar_t *kSFXExtension =
+ #ifdef _WIN32
+ L"exe";
+ #else
+ L"";
+ #endif
+
+bool CUpdateOptions::Init(const CCodecs *codecs, const UString &arcPath, const UString &arcType)
+{
+ if (!arcType.IsEmpty())
+ MethodMode.FormatIndex = codecs->FindFormatForArchiveType(arcType);
+ else
+ {
+ MethodMode.FormatIndex = codecs->FindFormatForArchiveName(arcPath);
+ if (MethodMode.FormatIndex < 0)
+ MethodMode.FormatIndex = codecs->FindFormatForArchiveType(kDefaultArchiveType);
+ }
+ if (MethodMode.FormatIndex < 0)
+ return false;
+ const CArcInfoEx &arcInfo = codecs->Formats[MethodMode.FormatIndex];
+ UString typeExt = arcInfo.GetMainExt();
+ UString ext = typeExt;
+ if (SfxMode)
+ ext = kSFXExtension;
+ ArchivePath.BaseExtension = ext;
+ ArchivePath.VolExtension = typeExt;
+ ArchivePath.ParseFromPath(arcPath);
+ for (int i = 0; i < Commands.Size(); i++)
+ {
+ CUpdateArchiveCommand &uc = Commands[i];
+ uc.ArchivePath.BaseExtension = ext;
+ uc.ArchivePath.VolExtension = typeExt;
+ uc.ArchivePath.ParseFromPath(uc.UserArchivePath);
+ }
+ return true;
+}
+
static HRESULT Compress(
+ CCodecs *codecs,
const CActionSet &actionSet,
IInArchive *archive,
const CCompressionMethodMode &compressionMethod,
@@ -273,10 +288,6 @@ static HRESULT Compress(
CUpdateErrorInfo &errorInfo,
IUpdateCallbackUI *callback)
{
- #ifndef EXCLUDE_COM
- CHandlerLoader loader;
- #endif
-
CMyComPtr<IOutArchive> outArchive;
if(archive != NULL)
{
@@ -287,38 +298,18 @@ static HRESULT Compress(
}
else
{
- #ifndef EXCLUDE_COM
-
- if (loader.CreateHandler(compressionMethod.FilePath,
- compressionMethod.ClassID, (void **)&outArchive, true) != S_OK)
- throw kUpdateIsNotSupoorted;
- #endif
-
- #ifdef FORMAT_7Z
- if (compressionMethod.Name.CompareNoCase(L"7z") == 0)
- outArchive = new NArchive::N7z::CHandler;
- #endif
-
- #ifdef FORMAT_BZIP2
- if (compressionMethod.Name.CompareNoCase(L"BZip2") == 0)
- outArchive = new NArchive::NBZip2::CHandler;
- #endif
+ RINOK(codecs->CreateOutArchive(compressionMethod.FormatIndex, outArchive));
- #ifdef FORMAT_GZIP
- if (compressionMethod.Name.CompareNoCase(L"GZip") == 0)
- outArchive = new NArchive::NGZip::CHandler;
- #endif
-
- #ifdef FORMAT_TAR
- if (compressionMethod.Name.CompareNoCase(L"Tar") == 0)
- outArchive = new NArchive::NTar::CHandler;
- #endif
-
- #ifdef FORMAT_ZIP
- if (compressionMethod.Name.CompareNoCase(L"Zip") == 0)
- outArchive = new NArchive::NZip::CHandler;
+ #ifdef EXTERNAL_CODECS
+ {
+ CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
+ outArchive.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
+ if (setCompressCodecsInfo)
+ {
+ RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecs));
+ }
+ }
#endif
-
}
if (outArchive == 0)
throw kUpdateIsNotSupoorted;
@@ -460,14 +451,11 @@ static HRESULT Compress(
RINOK(CopyBlock(sfxStream, sfxOutStream));
}
- HRESULT result = outArchive->UpdateItems(outStream, updatePairs2.Size(),
- updateCallback);
+ HRESULT result = outArchive->UpdateItems(outStream, updatePairs2.Size(), updateCallback);
callback->Finilize();
return result;
}
-
-
HRESULT EnumerateInArchiveItems(const NWildcard::CCensor &censor,
IInArchive *archive,
const UString &defaultItemName,
@@ -502,6 +490,7 @@ HRESULT EnumerateInArchiveItems(const NWildcard::CCensor &censor,
static HRESULT UpdateWithItemLists(
+ CCodecs *codecs,
CUpdateOptions &options,
IInArchive *archive,
const CObjectVector<CArchiveItem> &archiveItems,
@@ -523,7 +512,9 @@ static HRESULT UpdateWithItemLists(
i == 0 && options.UpdateArchiveItself && archive != 0));
}
- RINOK(Compress(command.ActionSet, archive,
+ RINOK(Compress(
+ codecs,
+ command.ActionSet, archive,
options.MethodMode,
command.ArchivePath,
archiveItems,
@@ -561,7 +552,9 @@ struct CEnumDirItemUpdateCallback: public IEnumDirItemCallback
HRESULT CheckBreak() { return Callback->CheckBreak(); }
};
-HRESULT UpdateArchive(const NWildcard::CCensor &censor,
+HRESULT UpdateArchive(
+ CCodecs *codecs,
+ const NWildcard::CCensor &censor,
CUpdateOptions &options,
CUpdateErrorInfo &errorInfo,
IOpenCallbackUI *openCallback,
@@ -605,7 +598,7 @@ HRESULT UpdateArchive(const NWildcard::CCensor &censor,
throw "there is no such archive";
if (options.VolumesSizes.Size() > 0)
return E_NOTIMPL;
- HRESULT result = MyOpenArchive(archiveName, archiveLink, openCallback);
+ HRESULT result = MyOpenArchive(codecs, archiveName, archiveLink, openCallback);
RINOK(callback->OpenResult(archiveName, result));
RINOK(result);
if (archiveLink.VolumePaths.Size() > 1)
@@ -731,7 +724,7 @@ HRESULT UpdateArchive(const NWildcard::CCensor &censor,
archive, defaultItemName, archiveFileInfo, archiveItems));
}
- RINOK(UpdateWithItemLists(options, archive, archiveItems, dirItems,
+ RINOK(UpdateWithItemLists(codecs, options, archive, archiveItems, dirItems,
tempFiles, errorInfo, callback));
if (archive != NULL)
diff --git a/CPP/7zip/UI/Common/Update.h b/CPP/7zip/UI/Common/Update.h
index 465acc24..284f8657 100755
--- a/CPP/7zip/UI/Common/Update.h
+++ b/CPP/7zip/UI/Common/Update.h
@@ -11,6 +11,7 @@
#include "ArchiveOpenCallback.h"
#include "UpdateCallback.h"
#include "Property.h"
+#include "LoadCodecs.h"
struct CArchivePath
{
@@ -75,19 +76,16 @@ struct CArchivePath
struct CUpdateArchiveCommand
{
+ UString UserArchivePath;
CArchivePath ArchivePath;
NUpdateArchive::CActionSet ActionSet;
};
struct CCompressionMethodMode
{
- #ifndef EXCLUDE_COM
- UString FilePath;
- CLSID ClassID;
- #else
- UString Name;
- #endif
+ int FormatIndex;
CObjectVector<CProperty> Properties;
+ CCompressionMethodMode(): FormatIndex(-1) {}
};
struct CUpdateOptions
@@ -111,6 +109,8 @@ struct CUpdateOptions
UString WorkingDir;
+ bool Init(const CCodecs *codecs, const UString &arcPath, const UString &arcType);
+
CUpdateOptions():
UpdateArchiveItself(true),
SfxMode(false),
@@ -149,7 +149,9 @@ struct IUpdateCallbackUI2: public IUpdateCallbackUI
virtual HRESULT FinishArchive() = 0;
};
-HRESULT UpdateArchive(const NWildcard::CCensor &censor,
+HRESULT UpdateArchive(
+ CCodecs *codecs,
+ const NWildcard::CCensor &censor,
CUpdateOptions &options,
CUpdateErrorInfo &errorInfo,
IOpenCallbackUI *openCallback,
diff --git a/CPP/7zip/UI/Common/ZipRegistry.cpp b/CPP/7zip/UI/Common/ZipRegistry.cpp
index e449d6b4..8969a4ab 100755
--- a/CPP/7zip/UI/Common/ZipRegistry.cpp
+++ b/CPP/7zip/UI/Common/ZipRegistry.cpp
@@ -17,8 +17,6 @@ using namespace NRegistry;
static const TCHAR *kCUBasePath = TEXT("Software\\7-ZIP");
-// static const TCHAR *kArchiversKeyName = TEXT("Archivers");
-
static NSynchronization::CCriticalSection g_RegistryOperationsCriticalSection;
//////////////////////
@@ -126,7 +124,6 @@ static const TCHAR *kCompressionLevelValueName = TEXT("Level");
static const TCHAR *kCompressionLastFormatValueName = TEXT("Archiver");
static const TCHAR *kCompressionShowPasswordValueName = TEXT("ShowPassword");
static const TCHAR *kCompressionEncryptHeadersValueName = TEXT("EncryptHeaders");
-// static const TCHAR *kCompressionMaximizeValueName = TEXT("Maximize");
static const TCHAR *kCompressionOptionsKeyName = TEXT("Options");
static const TCHAR *kSolid = TEXT("Solid");
@@ -138,6 +135,8 @@ static const WCHAR *kCompressionMethod = L"Method";
static const WCHAR *kEncryptionMethod = L"EncryptionMethod";
static const TCHAR *kCompressionDictionary = TEXT("Dictionary");
static const TCHAR *kCompressionOrder = TEXT("Order");
+static const TCHAR *kCompressionNumThreads = TEXT("NumThreads");
+static const TCHAR *kCompressionBlockSize = TEXT("BlockSize");
static void SetRegString(CKey &key, const WCHAR *name, const UString &value)
@@ -186,8 +185,8 @@ void SaveCompressionInfo(const NCompression::CInfo &info)
}
}
- compressionKey.SetValue(kSolid, info.Solid);
- compressionKey.SetValue(kMultiThread, info.MultiThread);
+ // compressionKey.SetValue(kSolid, info.Solid);
+ // compressionKey.SetValue(kMultiThread, info.MultiThread);
compressionKey.RecurseDeleteKey(kCompressionOptionsKeyName);
{
CKey optionsKey;
@@ -205,31 +204,25 @@ void SaveCompressionInfo(const NCompression::CInfo &info)
SetRegUInt32(formatKey, kCompressionLevel, fo.Level);
SetRegUInt32(formatKey, kCompressionDictionary, fo.Dictionary);
SetRegUInt32(formatKey, kCompressionOrder, fo.Order);
+ SetRegUInt32(formatKey, kCompressionBlockSize, fo.BlockLogSize);
+ SetRegUInt32(formatKey, kCompressionNumThreads, fo.NumThreads);
}
}
compressionKey.SetValue(kCompressionLevelValueName, UInt32(info.Level));
- compressionKey.SetValue(kCompressionLastFormatValueName,
- GetSystemString(info.ArchiveType));
+ compressionKey.SetValue(kCompressionLastFormatValueName, GetSystemString(info.ArchiveType));
compressionKey.SetValue(kCompressionShowPasswordValueName, info.ShowPassword);
compressionKey.SetValue(kCompressionEncryptHeadersValueName, info.EncryptHeaders);
// compressionKey.SetValue(kCompressionMaximizeValueName, info.Maximize);
}
-static bool IsMultiProcessor()
-{
- SYSTEM_INFO systemInfo;
- GetSystemInfo(&systemInfo);
- return systemInfo.dwNumberOfProcessors > 1;
-}
-
void ReadCompressionInfo(NCompression::CInfo &info)
{
info.HistoryArchives.Clear();
- info.Solid = true;
- info.MultiThread = IsMultiProcessor();
+ // info.Solid = true;
+ // info.MultiThread = IsMultiProcessor();
info.FormatOptionsVector.Clear();
info.Level = 5;
@@ -263,12 +256,14 @@ void ReadCompressionInfo(NCompression::CInfo &info)
}
+ /*
bool solid = false;
if (compressionKey.QueryValue(kSolid, solid) == ERROR_SUCCESS)
info.Solid = solid;
bool multiThread = false;
if (compressionKey.QueryValue(kMultiThread, multiThread) == ERROR_SUCCESS)
info.MultiThread = multiThread;
+ */
{
CKey optionsKey;
@@ -291,6 +286,8 @@ void ReadCompressionInfo(NCompression::CInfo &info)
GetRegUInt32(formatKey, kCompressionLevel, fo.Level);
GetRegUInt32(formatKey, kCompressionDictionary, fo.Dictionary);
GetRegUInt32(formatKey, kCompressionOrder, fo.Order);
+ GetRegUInt32(formatKey, kCompressionBlockSize, fo.BlockLogSize);
+ GetRegUInt32(formatKey, kCompressionNumThreads, fo.NumThreads);
info.FormatOptionsVector.Add(fo);
}
diff --git a/CPP/7zip/UI/Common/ZipRegistry.h b/CPP/7zip/UI/Common/ZipRegistry.h
index 30e7ee44..fcb0cce4 100755
--- a/CPP/7zip/UI/Common/ZipRegistry.h
+++ b/CPP/7zip/UI/Common/ZipRegistry.h
@@ -29,9 +29,11 @@ namespace NCompression {
UInt32 Level;
UInt32 Dictionary;
UInt32 Order;
+ UInt32 BlockLogSize;
+ UInt32 NumThreads;
void ResetForLevelChange()
{
- Level = Dictionary = Order = UInt32(-1);
+ BlockLogSize = NumThreads = Level = Dictionary = Order = UInt32(-1);
Method.Empty();
// EncryptionMethod.Empty();
// Options.Empty();
@@ -42,12 +44,9 @@ namespace NCompression {
struct CInfo
{
UStringVector HistoryArchives;
- // bool LevelIsDefined;
UInt32 Level;
UString ArchiveType;
- bool Solid;
- bool MultiThread;
CObjectVector<CFormatOptions> FormatOptionsVector;
bool ShowPassword;
diff --git a/CPP/7zip/UI/Console/Console.dsp b/CPP/7zip/UI/Console/Console.dsp
index e457008c..75c71330 100755
--- a/CPP/7zip/UI/Console/Console.dsp
+++ b/CPP/7zip/UI/Console/Console.dsp
@@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BREAK_HANDLER" /D "BENCH_MT" /D "_7ZIP_LARGE_PAGES" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BREAK_HANDLER" /D "BENCH_MT" /D "_7ZIP_LARGE_PAGES" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -94,7 +94,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"StdAfx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BREAK_HANDLER" /D "BENCH_MT" /D "_7ZIP_LARGE_PAGES" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -120,7 +120,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "../../../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
-# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BREAK_HANDLER" /D "BENCH_MT" /D "_7ZIP_LARGE_PAGES" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -316,14 +316,6 @@ SOURCE=..\..\..\Windows\Time.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
@@ -340,6 +332,10 @@ SOURCE=..\..\..\Common\ComTry.h
# End Source File
# Begin Source File
+SOURCE=..\..\..\Common\CRC.cpp
+# End Source File
+# Begin Source File
+
SOURCE=..\..\..\Common\Defs.h
# End Source File
# Begin Source File
@@ -468,14 +464,6 @@ SOURCE=..\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
-SOURCE=..\Common\ArchiverInfo.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\Common\ArchiverInfo.h
-# End Source File
-# Begin Source File
-
SOURCE=..\Common\CompressionMode.h
# End Source File
# Begin Source File
@@ -528,6 +516,14 @@ SOURCE=..\Common\IFileExtractCallback.h
# End Source File
# Begin Source File
+SOURCE=..\Common\LoadCodecs.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common\LoadCodecs.h
+# End Source File
+# Begin Source File
+
SOURCE=..\Common\OpenArchive.cpp
# End Source File
# Begin Source File
@@ -644,6 +640,10 @@ SOURCE=..\..\Common\FileStreams.h
# End Source File
# Begin Source File
+SOURCE=..\..\Common\RegisterArc.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\Common\StreamUtils.cpp
# End Source File
# Begin Source File
@@ -654,6 +654,26 @@ SOURCE=..\..\Common\StreamUtils.h
# Begin Group "Compress"
# PROP Default_Filter ""
+# Begin Group "LzmaBench"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.h
+# End Source File
+# End Group
# Begin Source File
SOURCE=..\..\Compress\Copy\CopyCoder.cpp
@@ -663,5 +683,27 @@ 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
# End Target
# End Project
diff --git a/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp b/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp
index 9bd605ec..f4badb78 100755
--- a/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp
+++ b/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp
@@ -28,9 +28,9 @@ static const char *kTestingString = "Testing ";
static const char *kExtractingString = "Extracting ";
static const char *kSkippingString = "Skipping ";
-static const char *kCantAutoRename = "can not create file with auto name\n";
-static const char *kCantRenameFile = "can not rename existing file\n";
-static const char *kCantDeleteOutputFile = "can not delete output file ";
+// static const char *kCantAutoRename = "can not create file with auto name\n";
+// static const char *kCantRenameFile = "can not rename existing file\n";
+// static const char *kCantDeleteOutputFile = "can not delete output file ";
static const char *kError = "ERROR: ";
static const char *kMemoryExceptionMessage = "Can't allocate required memory!";
diff --git a/CPP/7zip/UI/Console/List.cpp b/CPP/7zip/UI/Console/List.cpp
index 6001e114..3d7001d2 100755
--- a/CPP/7zip/UI/Console/List.cpp
+++ b/CPP/7zip/UI/Console/List.cpp
@@ -392,7 +392,9 @@ bool GetUInt64Value(IInArchive *archive, UInt32 index, PROPID propID, UInt64 &va
return true;
}
-HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFull,
+HRESULT ListArchives(
+ CCodecs *codecs,
+ UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
bool enableHeaders, bool techMode, bool &passwordEnabled, UString &password)
{
@@ -427,7 +429,7 @@ HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFul
openCallback.PasswordIsDefined = passwordEnabled;
openCallback.Password = password;
- HRESULT result = MyOpenArchive(archiveName, archiveLink, &openCallback);
+ HRESULT result = MyOpenArchive(codecs, archiveName, archiveLink, &openCallback);
if (result != S_OK)
{
g_StdOut << endl << "Error: " << archiveName << " is not supported archive" << endl;
diff --git a/CPP/7zip/UI/Console/List.h b/CPP/7zip/UI/Console/List.h
index 201a4128..2827bceb 100755
--- a/CPP/7zip/UI/Console/List.h
+++ b/CPP/7zip/UI/Console/List.h
@@ -4,8 +4,11 @@
#define __LIST_H
#include "Common/Wildcard.h"
+#include "../Common/LoadCodecs.h"
-HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFull,
+HRESULT ListArchives(
+ CCodecs *codecs,
+ UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
bool enableHeaders, bool techMode, bool &passwordEnabled, UString &password);
diff --git a/CPP/7zip/UI/Console/Main.cpp b/CPP/7zip/UI/Console/Main.cpp
index 387b8c2a..392bef03 100755
--- a/CPP/7zip/UI/Console/Main.cpp
+++ b/CPP/7zip/UI/Console/Main.cpp
@@ -5,32 +5,37 @@
#include <io.h>
#include "Common/MyInitGuid.h"
+
#include "Common/CommandLineParser.h"
-#include "Common/StdOutStream.h"
-#include "Common/Wildcard.h"
+#include "Common/Exception.h"
+#include "Common/IntToString.h"
#include "Common/ListFileUtils.h"
-#include "Common/StringConvert.h"
#include "Common/StdInStream.h"
+#include "Common/StdOutStream.h"
+#include "Common/StringConvert.h"
#include "Common/StringToInt.h"
-#include "Common/Exception.h"
+#include "Common/Wildcard.h"
#include "Windows/FileDir.h"
#include "Windows/FileName.h"
#include "Windows/Defs.h"
#include "Windows/Error.h"
-// #include "Windows/System.h"
#ifdef _WIN32
#include "Windows/MemoryLock.h"
#endif
#include "../../IPassword.h"
#include "../../ICoder.h"
-#include "../Common/ArchiverInfo.h"
#include "../Common/UpdateAction.h"
#include "../Common/Update.h"
#include "../Common/Extract.h"
#include "../Common/ArchiveCommandLine.h"
#include "../Common/ExitCode.h"
+#ifdef EXTERNAL_CODECS
+#include "../Common/LoadCodecs.h"
+#endif
+
+#include "../../Compress/LZMA_Alone/LzmaBenchCon.h"
#include "List.h"
#include "OpenCallbackConsole.h"
@@ -39,8 +44,11 @@
#include "../../MyVersion.h"
-#ifndef EXCLUDE_COM
-#include "Windows/DLL.h"
+#if defined( _WIN32) && defined( _7ZIP_LARGE_PAGES)
+extern "C"
+{
+#include "../../../../C/Alloc.h"
+}
#endif
using namespace NWindows;
@@ -51,12 +59,12 @@ HINSTANCE g_hInstance = 0;
extern CStdOutStream *g_StdStream;
static const char *kCopyrightString = "\n7-Zip"
-#ifdef EXCLUDE_COM
+#ifndef EXTERNAL_CODECS
" (A)"
#endif
-#ifdef UNICODE
-" [NT]"
+#ifdef _WIN64
+" [64]"
#endif
" " MY_VERSION_COPYRIGHT_DATE "\n";
@@ -65,14 +73,17 @@ static const char *kHelpString =
"\nUsage: 7z"
#ifdef _NO_CRYPTO
"r"
-#elif EXCLUDE_COM
+#else
+#ifndef EXTERNAL_CODECS
"a"
#endif
+#endif
" <command> [<switches>...] <archive_name> [<file_names>...]\n"
" [<@listfiles...>]\n"
"\n"
"<Commands>\n"
" a: Add files to archive\n"
+ " b: Benchmark\n"
" d: Delete files from archive\n"
" e: Extract files from archive (without using directory names)\n"
" l: List contents of archive\n"
@@ -151,6 +162,29 @@ static void ShowCopyrightAndHelp(CStdOutStream &s, bool needHelp)
s << kHelpString;
}
+#ifdef EXTERNAL_CODECS
+static void PrintString(CStdOutStream &stdStream, const AString &s, int size)
+{
+ int len = s.Length();
+ stdStream << s;
+ for (int i = len; i < size; i++)
+ stdStream << ' ';
+}
+#endif
+
+static void PrintString(CStdOutStream &stdStream, const UString &s, int size)
+{
+ int len = s.Length();
+ stdStream << s;
+ for (int i = len; i < size; i++)
+ stdStream << ' ';
+}
+
+static inline char GetHex(Byte value)
+{
+ return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
+}
+
int Main2(
#ifndef _WIN32
int numArguments, const char *arguments[]
@@ -187,9 +221,12 @@ int Main2(
return 0;
}
- #ifdef _WIN32
+ #if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
if (options.LargePages)
+ {
+ SetLargePageSize();
NSecurity::EnableLockMemoryPrivilege();
+ }
#endif
CStdOutStream &stdStream = options.StdOutMode ? g_StdErr : g_StdOut;
@@ -200,9 +237,145 @@ int Main2(
parser.Parse2(options);
+ CCodecs *codecs = new CCodecs;
+ CMyComPtr<
+ #ifdef EXTERNAL_CODECS
+ ICompressCodecsInfo
+ #else
+ IUnknown
+ #endif
+ > compressCodecsInfo = codecs;
+ HRESULT result = codecs->Load();
+ if (result != S_OK)
+ throw CSystemException(result);
+
bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
- if(isExtractGroupCommand ||
- options.Command.CommandType == NCommandType::kList)
+ if (options.Command.CommandType == NCommandType::kInfo)
+ {
+ stdStream << endl << "Formats:" << endl;
+ int i;
+ for (i = 0; i < codecs->Formats.Size(); i++)
+ {
+ const CArcInfoEx &arc = codecs->Formats[i];
+ #ifdef EXTERNAL_CODECS
+ if (arc.LibIndex >= 0)
+ {
+ char s[32];
+ ConvertUInt64ToString(arc.LibIndex, s);
+ PrintString(stdStream, s, 2);
+ }
+ else
+ #endif
+ stdStream << " ";
+ stdStream << ' ';
+ stdStream << (char)(arc.UpdateEnabled ? 'C' : ' ');
+ stdStream << (char)(arc.KeepName ? 'K' : ' ');
+ stdStream << " ";
+ PrintString(stdStream, arc.Name, 6);
+ stdStream << " ";
+ UString s;
+ for (int t = 0; t < arc.Exts.Size(); t++)
+ {
+ const CArcExtInfo &ext = arc.Exts[t];
+ s += ext.Ext;
+ if (!ext.AddExt.IsEmpty())
+ {
+ s += L" (";
+ s += ext.AddExt;
+ s += L')';
+ }
+ s += L' ';
+ }
+ PrintString(stdStream, s, 14);
+ stdStream << " ";
+ const CByteBuffer &sig = arc.StartSignature;
+ for (size_t j = 0; j < sig.GetCapacity(); j++)
+ {
+ Byte b = sig[j];
+ if (b > 0x20 && b < 0x80)
+ {
+ stdStream << (char)b;
+ }
+ else
+ {
+ stdStream << GetHex((Byte)((b >> 4) & 0xF));
+ stdStream << GetHex((Byte)(b & 0xF));
+ }
+ stdStream << ' ';
+ }
+ stdStream << endl;
+ }
+ stdStream << endl << "Codecs:" << endl;
+
+ #ifdef EXTERNAL_CODECS
+ UINT32 numMethods;
+ if (codecs->GetNumberOfMethods(&numMethods) == S_OK)
+ for (UInt32 j = 0; j < numMethods; j++)
+ {
+ int libIndex = codecs->GetCodecLibIndex(j);
+ if (libIndex >= 0)
+ {
+ char s[32];
+ ConvertUInt64ToString(libIndex, s);
+ PrintString(stdStream, s, 2);
+ }
+ else
+ stdStream << " ";
+ stdStream << ' ';
+ stdStream << (char)(codecs->GetCodecEncoderIsAssigned(j) ? 'C' : ' ');
+ UInt64 id;
+ stdStream << " ";
+ HRESULT res = codecs->GetCodecId(j, id);
+ if (res != S_OK)
+ id = (UInt64)(Int64)-1;
+ char s[32];
+ ConvertUInt64ToString(id, s, 16);
+ PrintString(stdStream, s, 8);
+ stdStream << " ";
+ PrintString(stdStream, codecs->GetCodecName(j), 11);
+ stdStream << endl;
+ /*
+ if (res != S_OK)
+ throw "incorrect Codec ID";
+ */
+ }
+ #endif
+ return S_OK;
+ }
+ else if (options.Command.CommandType == NCommandType::kBenchmark)
+ {
+ if (options.Method.CompareNoCase(L"CRC") == 0)
+ {
+ HRESULT res = CrcBenchCon((FILE *)stdStream, options.NumIterations, options.NumThreads, options.DictionarySize);
+ if (res != S_OK)
+ {
+ if (res == S_FALSE)
+ {
+ stdStream << "\nCRC Error\n";
+ return NExitCode::kFatalError;
+ }
+ throw CSystemException(res);
+ }
+ }
+ else
+ {
+ HRESULT res = LzmaBenchCon(
+ #ifdef EXTERNAL_LZMA
+ codecs,
+ #endif
+ (FILE *)stdStream, options.NumIterations, options.NumThreads, options.DictionarySize);
+ if (res != S_OK)
+ {
+ if (res == S_FALSE)
+ {
+ stdStream << "\nDecoding Error\n";
+ return NExitCode::kFatalError;
+ }
+ throw CSystemException(res);
+ }
+ }
+ }
+ else if (isExtractGroupCommand || options.Command.CommandType == NCommandType::kList)
{
if(isExtractGroupCommand)
{
@@ -231,6 +404,7 @@ int Main2(
#endif
UString errorMessage;
HRESULT result = DecompressArchives(
+ codecs,
options.ArchivePathsSorted,
options.ArchivePathsFullSorted,
options.WildcardCensor.Pairs.Front().Head,
@@ -266,6 +440,7 @@ int Main2(
else
{
HRESULT result = ListArchives(
+ codecs,
options.ArchivePathsSorted,
options.ArchivePathsFullSorted,
options.WildcardCensor.Pairs.Front().Head,
@@ -303,7 +478,10 @@ int Main2(
CUpdateErrorInfo errorInfo;
- HRESULT result = UpdateArchive(options.WildcardCensor, uo,
+ if (!uo.Init(codecs, options.ArchiveName, options.ArcType))
+ throw "Unsupported archive type";
+ HRESULT result = UpdateArchive(codecs,
+ options.WildcardCensor, uo,
errorInfo, &openCallback, &callback);
int exitCode = NExitCode::kSuccess;
diff --git a/CPP/7zip/UI/Console/MainAr.cpp b/CPP/7zip/UI/Console/MainAr.cpp
index 4bdf813a..06f602ce 100755
--- a/CPP/7zip/UI/Console/MainAr.cpp
+++ b/CPP/7zip/UI/Console/MainAr.cpp
@@ -10,21 +10,11 @@
#include "Common/NewHandler.h"
#include "Common/Exception.h"
#include "Common/StringConvert.h"
-#ifdef _WIN32
-#include "Common/Alloc.h"
-#endif
#include "../Common/ExitCode.h"
#include "../Common/ArchiveCommandLine.h"
#include "ConsoleClose.h"
-#ifdef CRC_GENERATE_TABLE
-extern "C"
-{
- #include "../../../../C/7zCrc.h"
-}
-#endif
-
using namespace NWindows;
CStdOutStream *g_StdStream = 0;
@@ -66,9 +56,6 @@ int numArguments, const char *arguments[]
#endif
)
{
- #ifdef CRC_GENERATE_TABLE
- CrcGenerateTable();
- #endif
g_StdStream = &g_StdOut;
#ifdef _UNICODE
if (!IsItWindowsNT())
@@ -80,10 +67,6 @@ int numArguments, const char *arguments[]
g_IsNT = IsItWindowsNT();
#endif
- #ifdef _WIN32
- SetLargePageSize();
- #endif
-
// setlocale(LC_COLLATE, ".OCP");
NConsoleClose::CCtrlHandlerSetter ctrlHandlerSetter;
int res = 0;
diff --git a/CPP/7zip/UI/Console/PercentPrinter.cpp b/CPP/7zip/UI/Console/PercentPrinter.cpp
index ec87b5d4..d6324303 100755
--- a/CPP/7zip/UI/Console/PercentPrinter.cpp
+++ b/CPP/7zip/UI/Console/PercentPrinter.cpp
@@ -75,7 +75,7 @@ void CPercentPrinter::RePrintRatio()
m_NumExtraChars = extraSize;
for (; size < m_NumExtraChars; size++)
*p++ = ' ';
- strcpy(p, s);
+ MyStringCopy(p, s);
(*OutStream) << fullString;
OutStream->Flush();
m_PrevValue = m_CurValue;
diff --git a/CPP/7zip/UI/Console/makefile b/CPP/7zip/UI/Console/makefile
index 54e83ea1..466e5c56 100755
--- a/CPP/7zip/UI/Console/makefile
+++ b/CPP/7zip/UI/Console/makefile
@@ -1,6 +1,13 @@
PROG = 7z.exe
LIBS = $(LIBS) user32.lib oleaut32.lib advapi32.lib
-CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MT -DWIN_LONG_PATH
+CFLAGS = $(CFLAGS) -I ../../../ \
+ -DCOMPRESS_MT \
+ -DWIN_LONG_PATH \
+ -DEXTERNAL_LZMA \
+ -DEXTERNAL_CODECS \
+ -DBREAK_HANDLER \
+ -DBENCH_MT \
+ -D_7ZIP_LARGE_PAGES \
CONSOLE_OBJS = \
$O\ConsoleClose.obj \
@@ -14,8 +21,8 @@ CONSOLE_OBJS = \
$O\UserInputUtils.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\CommandLineParser.obj \
+ $O\CRC.obj \
$O\IntToString.obj \
$O\ListFileUtils.obj \
$O\NewHandler.obj \
@@ -49,11 +56,11 @@ UI_COMMON_OBJS = \
$O\ArchiveCommandLine.obj \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
- $O\ArchiverInfo.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
+ $O\LoadCodecs.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
$O\SetProperties.obj \
@@ -66,6 +73,14 @@ UI_COMMON_OBJS = \
$O\UpdateProduce.obj \
$O\WorkDir.obj \
+LZMA_BENCH_OBJS = \
+ $O\LzmaBench.obj \
+ $O\LzmaBenchCon.obj \
+
+C_OBJS = \
+ $O\Alloc.obj \
+
+!include "../../Crc2.mak"
OBJS = \
$O\StdAfx.obj \
@@ -75,6 +90,9 @@ OBJS = \
$(7ZIP_COMMON_OBJS) \
$(UI_COMMON_OBJS) \
$O\CopyCoder.obj \
+ $(LZMA_BENCH_OBJS) \
+ $(C_OBJS) \
+ $(CRC_OBJS) \
$O\resource.res
!include "../../../Build.mak"
@@ -91,3 +109,8 @@ $(UI_COMMON_OBJS): ../Common/$(*B).cpp
$(COMPL)
$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
$(COMPL)
+$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp
+ $(COMPL)
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
+!include "../../Crc.mak"
diff --git a/CPP/7zip/UI/Explorer/ContextMenu.cpp b/CPP/7zip/UI/Explorer/ContextMenu.cpp
index fd40add5..01305fba 100755
--- a/CPP/7zip/UI/Explorer/ContextMenu.cpp
+++ b/CPP/7zip/UI/Explorer/ContextMenu.cpp
@@ -260,13 +260,45 @@ static bool MyInsertMenu(CMenu &menu, int pos, UINT id, const UString &s)
return menu.InsertItem(pos, true, menuItem);
}
+static const wchar_t *kArcExts[] =
+{
+ L"7z",
+ L"bz2",
+ L"gz",
+ L"rar",
+ L"zip"
+};
+
+static bool IsItArcExt(const UString &ext2)
+{
+ UString ext = ext2;
+ ext.MakeLower();
+ for (int i = 0; i < sizeof(kArcExts) / sizeof(kArcExts[0]); i++)
+ if (ext.Compare(kArcExts[i]) == 0)
+ return true;
+ return false;
+}
+
static UString GetSubFolderNameForExtract(const UString &archiveName)
{
int dotPos = archiveName.ReverseFind(L'.');
if (dotPos < 0)
return archiveName + UString(L"~");
+ const UString ext = archiveName.Mid(dotPos + 1);
UString res = archiveName.Left(dotPos);
res.TrimRight();
+ dotPos = res.ReverseFind(L'.');
+ if (dotPos > 0)
+ {
+ const UString ext2 = res.Mid(dotPos + 1);
+ if (ext.CompareNoCase(L"rar") == 0 &&
+ (ext2.CompareNoCase(L"part001") == 0 ||
+ ext2.CompareNoCase(L"part01") == 0 ||
+ ext2.CompareNoCase(L"part1") == 0) ||
+ IsItArcExt(ext2) && ext.CompareNoCase(L"001") == 0)
+ res = res.Left(dotPos);
+ res.TrimRight();
+ }
return res;
}
@@ -279,6 +311,25 @@ static UString GetReducedString(const UString &s)
return s.Left(kFirstPartSize) + UString(L" ... ") + s.Right(kMaxSize - kFirstPartSize);
}
+static const wchar_t *kExtractExludeExtensions[] =
+{
+ L"txt", L"htm", L"html", L"xml", L"doc", L"xls",
+ L"bmp", L"gif", L"jpeg", L"jpg"
+};
+
+static bool DoNeedExtract(const UString &name)
+{
+ int extPos = name.ReverseFind('.');
+ if (extPos < 0)
+ return true;
+ UString ext = name.Mid(extPos + 1);
+ ext.MakeLower();
+ for (int i = 0; i < sizeof(kExtractExludeExtensions) / sizeof(kExtractExludeExtensions[0]); i++)
+ if (ext.Compare(kExtractExludeExtensions[i]) == 0)
+ return false;
+ return true;
+}
+
STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
UINT commandIDFirst, UINT commandIDLast, UINT flags)
{
@@ -332,7 +383,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
NFile::NFind::CFileInfoW fileInfo;
if (!NFile::NFind::FindFile(fileName, fileInfo))
return E_FAIL;
- if (!fileInfo.IsDirectory())
+ if (!fileInfo.IsDirectory() && DoNeedExtract(fileInfo.Name))
{
// Open
if ((contextMenuFlags & NContextMenuFlags::kOpen) != 0)
@@ -347,17 +398,17 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
if(_fileNames.Size() > 0 && currentCommandID + 10 <= commandIDLast)
{
- bool thereAreFolders = false;
+ bool needExtract = false;
for(int i = 0; i < _fileNames.Size(); i++)
{
NFile::NFind::CFileInfoW fileInfo;
if (!NFile::NFind::FindFile(_fileNames[i], fileInfo))
return E_FAIL;
- if (fileInfo.IsDirectory())
- thereAreFolders = true;
+ if (!fileInfo.IsDirectory() && DoNeedExtract(fileInfo.Name))
+ needExtract = true;
}
const UString &fileName = _fileNames.Front();
- if (!thereAreFolders)
+ if (needExtract)
{
UString folderPrefix;
NFile::NDirectory::GetOnlyDirPrefix(fileName, folderPrefix);
diff --git a/CPP/7zip/UI/Explorer/Explorer.dsp b/CPP/7zip/UI/Explorer/Explorer.dsp
index c395c6d2..724ed0d9 100755
--- a/CPP/7zip/UI/Explorer/Explorer.dsp
+++ b/CPP/7zip/UI/Explorer/Explorer.dsp
@@ -45,7 +45,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 "EXPLORER_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "NEW_FOLDER_INTERFACE" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "NEW_FOLDER_INTERFACE" /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"
@@ -72,7 +72,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 "EXPLORER_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "NEW_FOLDER_INTERFACE" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "NEW_FOLDER_INTERFACE" /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"
@@ -99,7 +99,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "_MBCS" /Yu"StdAfx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "NEW_FOLDER_INTERFACE" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "NEW_FOLDER_INTERFACE" /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"
@@ -128,7 +128,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
-# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "NEW_FOLDER_INTERFACE" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "EXPLORER_EXPORTS" /D "LANG" /D "NEW_FOLDER_INTERFACE" /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"
@@ -206,14 +206,6 @@ SOURCE=..\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
-SOURCE=..\Common\ArchiverInfo.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\Common\ArchiverInfo.h
-# End Source File
-# Begin Source File
-
SOURCE=..\Common\CompressCall.cpp
# End Source File
# Begin Source File
@@ -250,6 +242,14 @@ SOURCE=..\Common\HandlerLoader.h
# End Source File
# Begin Source File
+SOURCE=..\Common\LoadCodecs.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common\LoadCodecs.h
+# End Source File
+# Begin Source File
+
SOURCE=..\Common\OpenArchive.cpp
# End Source File
# Begin Source File
@@ -473,20 +473,71 @@ SOURCE=..\..\FileManager\RegistryUtils.cpp
SOURCE=..\..\FileManager\RegistryUtils.h
# End Source File
# End Group
-# Begin Group "SDK"
+# Begin Group "7-zip common"
# PROP Default_Filter ""
-# Begin Group "Common"
+# Begin Source File
+
+SOURCE=..\..\Common\FilePathAutoRename.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\FilePathAutoRename.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\FileStreams.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Common\FileStreams.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 "C"
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Common\Alloc.cpp
+SOURCE=..\..\..\..\C\Alloc.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Alloc.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Sort.c
+# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Alloc.h
+SOURCE=..\..\..\..\C\Sort.h
# End Source File
+# End Group
+# Begin Group "Common"
+
+# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\Common\IntToString.cpp
@@ -736,60 +787,6 @@ SOURCE=..\..\..\Windows\Window.cpp
SOURCE=..\..\..\Windows\Window.h
# End Source File
# End Group
-# End Group
-# Begin Group "7-zip common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Common\FilePathAutoRename.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\FilePathAutoRename.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\FileStreams.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\FileStreams.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 "C"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Sort.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Sort.h
-# End Source File
-# End Group
# Begin Source File
SOURCE=".\7-zip.dll.manifest"
diff --git a/CPP/7zip/UI/Explorer/SystemPage/SystemPage.h b/CPP/7zip/UI/Explorer/SystemPage/SystemPage.h
index a7de7c79..75130189 100755
--- a/CPP/7zip/UI/Explorer/SystemPage/SystemPage.h
+++ b/CPP/7zip/UI/Explorer/SystemPage/SystemPage.h
@@ -6,12 +6,12 @@
#include "Windows/Control/PropertyPage.h"
#include "Windows/Control/ListView.h"
-#include "../../Common/ArchiverInfo.h"
+#include "../../Common/LoadCodecs.h"
class CSystemPage: public NWindows::NControl::CPropertyPage
{
bool _initMode;
- CObjectVector<CArchiverInfo> m_Archivers;
+ CObjectVector<CArcInfoEx> m_Archivers;
NWindows::NControl::CListView m_ListView;
public:
virtual bool OnInit();
diff --git a/CPP/7zip/UI/Explorer/makefile b/CPP/7zip/UI/Explorer/makefile
index 0fcc57e4..21ace854 100755
--- a/CPP/7zip/UI/Explorer/makefile
+++ b/CPP/7zip/UI/Explorer/makefile
@@ -4,7 +4,8 @@ LIBS = $(LIBS) user32.lib oleaut32.lib advapi32.lib htmlhelp.lib shell32.lib com
CFLAGS = $(CFLAGS) -I ../../../ \
-DLANG \
-DNEW_FOLDER_INTERFACE \
- -DWIN_LONG_PATH
+ -DWIN_LONG_PATH \
+ -DEXTERNAL_CODECS \
EXPLORER_OBJS = \
$O\DllExports.obj \
@@ -14,7 +15,6 @@ EXPLORER_OBJS = \
$O\RegistryContextMenu.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\IntToString.obj \
$O\Lang.obj \
$O\ListFileUtils.obj \
@@ -58,11 +58,11 @@ UI_COMMON_OBJS = \
$O\ArchiveExtractCallback.obj \
$O\ArchiveName.obj \
$O\ArchiveOpenCallback.obj \
- $O\ArchiverInfo.obj \
$O\CompressCall.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\ExtractingFilePath.obj \
+ $O\LoadCodecs.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
$O\SortUtils.obj \
@@ -91,6 +91,7 @@ FM_COMMON_OBJS = \
$O\RegistryUtils.obj \
C_OBJS = \
+ $O\Alloc.obj \
$O\Sort.obj \
OBJS = \
diff --git a/CPP/7zip/UI/Far/ExtractEngine.cpp b/CPP/7zip/UI/Far/ExtractEngine.cpp
index e85df5e1..15548949 100755
--- a/CPP/7zip/UI/Far/ExtractEngine.cpp
+++ b/CPP/7zip/UI/Far/ExtractEngine.cpp
@@ -134,10 +134,14 @@ STDMETHODIMP CExtractCallBackImp::SetOperationResult(INT32 operationResult, bool
idMessage = NMessageID::kExtractUnsupportedMethod;
break;
case NArchive::NExtract::NOperationResult::kCRCError:
- idMessage = NMessageID::kExtractCRCFailed;
+ idMessage = encrypted ?
+ NMessageID::kExtractCRCFailedEncrypted :
+ NMessageID::kExtractCRCFailed;
break;
case NArchive::NExtract::NOperationResult::kDataError:
- idMessage = NMessageID::kExtractDataError;
+ idMessage = encrypted ?
+ NMessageID::kExtractDataErrorEncrypted :
+ NMessageID::kExtractDataError;
break;
default:
return E_FAIL;
diff --git a/CPP/7zip/UI/Far/Far.dsp b/CPP/7zip/UI/Far/Far.dsp
index 47c44c69..fa540ed2 100755
--- a/CPP/7zip/UI/Far/Far.dsp
+++ b/CPP/7zip/UI/Far/Far.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 "FAR_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FAR_EXPORTS" /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 "FAR_EXPORTS" /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 "FAR_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 "FAR_EXPORTS" /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 "FAR_EXPORTS" /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"
@@ -118,14 +118,6 @@ SOURCE=.\StdAfx.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\IntToString.cpp
# End Source File
# Begin Source File
@@ -366,14 +358,6 @@ SOURCE=..\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
-SOURCE=..\Common\ArchiverInfo.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\Common\ArchiverInfo.h
-# End Source File
-# Begin Source File
-
SOURCE=..\Common\DefaultName.cpp
# End Source File
# Begin Source File
@@ -410,6 +394,14 @@ SOURCE=..\Common\HandlerLoader.h
# End Source File
# Begin Source File
+SOURCE=..\Common\LoadCodecs.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\Common\LoadCodecs.h
+# End Source File
+# Begin Source File
+
SOURCE=..\Common\OpenArchive.cpp
# End Source File
# Begin Source File
@@ -557,5 +549,27 @@ SOURCE=..\..\Common\StreamUtils.cpp
SOURCE=..\..\Common\StreamUtils.h
# End Source File
# End Group
+# Begin Group "C"
+
+# PROP Default_Filter ""
+# 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
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Sort.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Sort.h
+# End Source File
+# End Group
# End Target
# End Project
diff --git a/CPP/7zip/UI/Far/FarUtils.cpp b/CPP/7zip/UI/Far/FarUtils.cpp
index abbb6817..c4a30524 100755
--- a/CPP/7zip/UI/Far/FarUtils.cpp
+++ b/CPP/7zip/UI/Far/FarUtils.cpp
@@ -353,7 +353,7 @@ void CScreenRestorer::Restore()
static AString DWORDToString(DWORD number)
{
char buffer[32];
- ultoa(number, buffer, 10);
+ _ultoa(number, buffer, 10);
return buffer;
}
diff --git a/CPP/7zip/UI/Far/Main.cpp b/CPP/7zip/UI/Far/Main.cpp
index a7994b6d..70d9117c 100755
--- a/CPP/7zip/UI/Far/Main.cpp
+++ b/CPP/7zip/UI/Far/Main.cpp
@@ -355,9 +355,6 @@ HRESULT OpenArchive(const CSysString &fileName,
IArchiveOpenCallback *openArchiveCallback)
{
HRESULT OpenArchive(const CSysString &fileName,
- #ifndef EXCLUDE_COM
- HMODULE *module,
- #endif
IInArchive **archive,
CArchiverInfo &archiverInfoResult,
IArchiveOpenCallback *openArchiveCallback);
@@ -451,7 +448,7 @@ HANDLE WINAPI OpenPlugin(int openFrom, int item)
MY_TRY_BEGIN;
if(openFrom == OPEN_COMMANDLINE)
{
- CSysString fileName = (const char *)item;
+ CSysString fileName = (const char *)(UINT_PTR)item;
if(fileName.IsEmpty())
return INVALID_HANDLE_VALUE;
if (fileName.Length() >= 2 &&
@@ -478,7 +475,7 @@ HANDLE WINAPI OpenPlugin(int openFrom, int item)
throw 142134;
if (CompressFiles(pluginPanelItem) == S_OK)
{
- int t = g_StartupInfo.ControlClearPanelSelection();
+ /* int t = */ g_StartupInfo.ControlClearPanelSelection();
g_StartupInfo.ControlRequestActivePanel(FCTL_UPDATEPANEL, NULL);
g_StartupInfo.ControlRequestActivePanel(FCTL_REDRAWPANEL, NULL);
g_StartupInfo.ControlRequestActivePanel(FCTL_UPDATEANOTHERPANEL, NULL);
@@ -554,7 +551,7 @@ void WINAPI GetPluginInfo(struct PluginInfo *info)
MY_TRY_END1("GetPluginInfo");
}
-int WINAPI Configure(int itemNumber)
+int WINAPI Configure(int /* itemNumber */)
{
MY_TRY_BEGIN;
diff --git a/CPP/7zip/UI/Far/Messages.h b/CPP/7zip/UI/Far/Messages.h
index 8b6e2a49..7a36ab30 100755
--- a/CPP/7zip/UI/Far/Messages.h
+++ b/CPP/7zip/UI/Far/Messages.h
@@ -79,6 +79,8 @@ enum EEnum
kExtractUnsupportedMethod,
kExtractCRCFailed,
kExtractDataError,
+ kExtractCRCFailedEncrypted,
+ kExtractDataErrorEncrypted,
kOverwriteTitle,
kOverwriteMessage1,
diff --git a/CPP/7zip/UI/Far/Plugin.cpp b/CPP/7zip/UI/Far/Plugin.cpp
index 0d4b150e..fde53756 100755
--- a/CPP/7zip/UI/Far/Plugin.cpp
+++ b/CPP/7zip/UI/Far/Plugin.cpp
@@ -79,7 +79,7 @@ void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UINT32 itemIndex)
throw 272340;
CSysString oemString = UnicodeStringToMultiByte(propVariant.bstrVal, CP_OEMCP);
- strcpy(panelItem.FindData.cFileName, oemString);
+ MyStringCopy(panelItem.FindData.cFileName, (const char *)oemString);
panelItem.FindData.cAlternateFileName[0] = 0;
if (_folder->GetProperty(itemIndex, kpidAttributes, &propVariant) != S_OK)
@@ -204,7 +204,7 @@ void CPlugin::EnterToDirectory(const UString &aDirName)
_folder = newFolder;
}
-int CPlugin::SetDirectory(const char *aszDir, int opMode)
+int CPlugin::SetDirectory(const char *aszDir, int /* opMode */)
{
UString path = MultiByteToUnicodeString(aszDir, CP_OEMCP);
if (path == L"\\")
@@ -361,12 +361,14 @@ static int FindPropertyInfo(PROPID propID)
*/
// char *g_Titles[] = { "a", "f", "v" };
-static void SmartAddToString(AString &aDestString, const char *aSrcString)
+/*
+static void SmartAddToString(AString &destString, const char *srcString)
{
- if (!aDestString.IsEmpty())
- aDestString += ',';
- aDestString += aSrcString;
+ if (!destString.IsEmpty())
+ destString += ',';
+ destString += srcString;
}
+*/
/*
void CPlugin::AddColumn(PROPID propID)
@@ -401,10 +403,10 @@ void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info)
UINT codePage = ::AreFileApisANSI() ? CP_ACP : CP_OEMCP;
- strcpy(m_FileNameBuffer, UnicodeStringToMultiByte(m_FileName, codePage));
+ MyStringCopy(m_FileNameBuffer, (const char *)UnicodeStringToMultiByte(m_FileName, codePage));
info->HostFile = m_FileNameBuffer; // test it it is not static
- strcpy(m_CurrentDirBuffer, UnicodeStringToMultiByte(m_CurrentDir, CP_OEMCP));
+ MyStringCopy(m_CurrentDirBuffer, (const char *)UnicodeStringToMultiByte(m_CurrentDir, CP_OEMCP));
info->CurDir = m_CurrentDirBuffer;
info->Format = kPluginFormatName;
@@ -429,15 +431,15 @@ void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info)
m_PannelTitle += m_CurrentDir;
}
- strcpy(m_PannelTitleBuffer, UnicodeStringToMultiByte(m_PannelTitle, CP_OEMCP));
+ MyStringCopy(m_PannelTitleBuffer, (const char *)UnicodeStringToMultiByte(m_PannelTitle, CP_OEMCP));
info->PanelTitle = m_PannelTitleBuffer;
memset(m_InfoLines,0,sizeof(m_InfoLines));
- strcpy(m_InfoLines[0].Text,"");
+ MyStringCopy(m_InfoLines[0].Text,"");
m_InfoLines[0].Separator = TRUE;
- strcpy(m_InfoLines[1].Text, g_StartupInfo.GetMsgString(NMessageID::kArchiveType));
- strcpy(m_InfoLines[1].Data, UnicodeStringToMultiByte(_archiveTypeName, CP_OEMCP));
+ MyStringCopy(m_InfoLines[1].Text, g_StartupInfo.GetMsgString(NMessageID::kArchiveType));
+ MyStringCopy(m_InfoLines[1].Data, (const char *)UnicodeStringToMultiByte(_archiveTypeName, CP_OEMCP));
int numItems = 2;
UINT32 numProps;
@@ -456,19 +458,19 @@ void CPlugin::GetOpenPluginInfo(struct OpenPluginInfo *info)
if (index < 0)
{
if (name != 0)
- strcpy(item.Text, UnicodeStringToMultiByte(
+ MyStringCopy(item.Text, (const char *)UnicodeStringToMultiByte(
(const wchar_t *)name, CP_OEMCP));
else
- strcpy(item.Text, "");
+ MyStringCopy(item.Text, "");
}
else
- strcpy(item.Text, g_StartupInfo.GetMsgString(kPROPIDToName[index].PluginID));
+ MyStringCopy(item.Text, g_StartupInfo.GetMsgString(kPROPIDToName[index].PluginID));
NCOM::CPropVariant propVariant;
if (m_ArchiveHandler->GetArchiveProperty(propID, &propVariant) != S_OK)
continue;
CSysString s = ConvertPropertyToString2(propVariant, propID);
- strcpy(item.Data, s);
+ MyStringCopy(item.Data, (const char *)s);
numItems++;
}
}
@@ -577,8 +579,6 @@ HRESULT CPlugin::ShowAttributesWindow()
}
*/
- const int kPathIndex = 2;
- const int kOkButtonIndex = 4;
int size = 2;
CRecordVector<CInitDialogItem> initDialogItems;
@@ -637,7 +637,7 @@ HRESULT CPlugin::ShowAttributesWindow()
for (i = 0; i < numLines; i++)
{
FarDialogItem &dialogItem = dialogItems[1 + i * 2];
- int len = strlen(dialogItem.Data);
+ int len = (int)strlen(dialogItem.Data);
if (len > maxLen)
maxLen = len;
}
@@ -646,7 +646,7 @@ HRESULT CPlugin::ShowAttributesWindow()
for (i = 0; i < numLines; i++)
{
FarDialogItem &dialogItem = dialogItems[1 + i * 2 + 1];
- int len = strlen(dialogItem.Data);
+ int len = (int)strlen(dialogItem.Data);
if (len > maxLen2)
maxLen2 = len;
dialogItem.X1 = maxLen + kSpace;
@@ -657,7 +657,7 @@ HRESULT CPlugin::ShowAttributesWindow()
aFirstDialogItem.Y2 = size - 2;
aFirstDialogItem.X2 = xSize - 4;
- int askCode = g_StartupInfo.ShowDialog(xSize, size, NULL, &dialogItems.Front(), numDialogItems);
+ /* int askCode = */ g_StartupInfo.ShowDialog(xSize, size, NULL, &dialogItems.Front(), numDialogItems);
return S_OK;
}
diff --git a/CPP/7zip/UI/Far/Plugin.h b/CPP/7zip/UI/Far/Plugin.h
index 0b617cfb..736fc7d0 100755
--- a/CPP/7zip/UI/Far/Plugin.h
+++ b/CPP/7zip/UI/Far/Plugin.h
@@ -9,7 +9,6 @@
#include "Windows/FileFind.h"
#include "Windows/PropVariant.h"
-#include "../Common/ArchiverInfo.h"
#include "../Agent/IFolderArchive.h"
#include "FarUtils.h"
diff --git a/CPP/7zip/UI/Far/PluginDelete.cpp b/CPP/7zip/UI/Far/PluginDelete.cpp
index 6a969c15..95e43a36 100755
--- a/CPP/7zip/UI/Far/PluginDelete.cpp
+++ b/CPP/7zip/UI/Far/PluginDelete.cpp
@@ -89,7 +89,8 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems,
CRecordVector<UINT32> indices;
indices.Reserve(numItems);
- for(int i = 0; i < numItems; i++)
+ int i;
+ for(i = 0; i < numItems; i++)
indices.Add(panelItems[i].UserData);
////////////////////////////
diff --git a/CPP/7zip/UI/Far/PluginWrite.cpp b/CPP/7zip/UI/Far/PluginWrite.cpp
index d6730985..a159a476 100755
--- a/CPP/7zip/UI/Far/PluginWrite.cpp
+++ b/CPP/7zip/UI/Far/PluginWrite.cpp
@@ -80,7 +80,8 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
ReadCompressionInfo(compressionInfo);
int methodIndex = 0;
- for (int i = sizeof(g_MethodMap) / sizeof(g_MethodMap[0]) - 1; i >= 0; i--)
+ int i;
+ for (i = sizeof(g_MethodMap) / sizeof(g_MethodMap[0]) - 1; i >= 0; i--)
if (compressionInfo.Level >= g_MethodMap[i])
{
methodIndex = i;
@@ -226,7 +227,7 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
&fileNamePointers.Front(), fileNamePointers.Size());
BYTE actionSetByte[NUpdateArchive::NPairState::kNumValues];
for (i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
- actionSetByte[i] = actionSet->StateActions[i];
+ actionSetByte[i] = (BYTE)actionSet->StateActions[i];
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec );
@@ -236,8 +237,7 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
if (SetOutProperties(outArchive, compressionInfo.Level) != S_OK)
return NFileOperationReturnCode::kError;
- result = outArchive->DoOperation(NULL, NULL,
- tempFileName, actionSetByte, NULL, updateCallback);
+ result = outArchive->DoOperation2(tempFileName, actionSetByte, NULL, updateCallback);
updateCallback.Release();
outArchive.Release();
@@ -332,7 +332,8 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
return E_FAIL;
UStringVector fileNames;
- for(int i = 0; i < pluginPanelItems.Size(); i++)
+ int i;
+ for(i = 0; i < pluginPanelItems.Size(); i++)
{
const PluginPanelItem &panelItem = pluginPanelItems[i];
CSysString fullName;
@@ -353,23 +354,23 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
int archiverIndex = 0;
- CObjectVector<CArchiverInfo> archiverInfoList;
+ CCodecs *codecs = new CCodecs;
+ CMyComPtr<ICompressCodecsInfo> compressCodecsInfo = codecs;
+ if (codecs->Load() != S_OK)
+ throw "Can't load 7-Zip codecs";
{
- CObjectVector<CArchiverInfo> fullArchiverInfoList;
- ReadArchiverInfoList(fullArchiverInfoList);
- for (int i = 0; i < fullArchiverInfoList.Size(); i++)
+ for (int i = 0; i < codecs->Formats.Size(); i++)
{
- const CArchiverInfo &archiverInfo = fullArchiverInfoList[i];
- if (archiverInfo.UpdateEnabled)
+ const CArcInfoEx &arcInfo = codecs->Formats[i];
+ if (arcInfo.UpdateEnabled)
{
- if (archiverInfo.Name.CompareNoCase(compressionInfo.ArchiveType) == 0)
- archiverIndex = archiverInfoList.Size();
- archiverInfoList.Add(archiverInfo);
+ if (archiverIndex == -1)
+ archiverIndex = i;
+ if (arcInfo.Name.CompareNoCase(compressionInfo.ArchiveType) == 0)
+ archiverIndex = i;
}
}
}
- if (archiverInfoList.IsEmpty())
- throw "There is no update achivers";
UString resultPath;
@@ -392,10 +393,10 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
UString archiveNameSrc = resultPath;
UString archiveName = archiveNameSrc;
- const CArchiverInfo &archiverInfo = archiverInfoList[archiverIndex];
+ const CArcInfoEx &arcInfo = codecs->Formats[archiverIndex];
int prevFormat = archiverIndex;
- if (!archiverInfo.KeepName)
+ if (!arcInfo.KeepName)
{
int dotPos = archiveName.ReverseFind('.');
int slashPos = MyMax(archiveName.ReverseFind('\\'), archiveName.ReverseFind('/'));
@@ -403,7 +404,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
archiveName = archiveName.Left(dotPos);
}
archiveName += L'.';
- archiveName += archiverInfo.GetMainExtension();
+ archiveName += arcInfo.GetMainExt();
const CActionSet *actionSet = &kAddActionSet;
@@ -417,14 +418,15 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
const int kMethodRadioIndex = kArchiveNameIndex + 2;
const int kModeRadioIndex = kMethodRadioIndex + 7;
- const CArchiverInfo &archiverInfo = archiverInfoList[archiverIndex];
+ const CArcInfoEx &arcInfo = codecs->Formats[archiverIndex];
char updateAddToArchiveString[512];
sprintf(updateAddToArchiveString,
- g_StartupInfo.GetMsgString(NMessageID::kUpdateAddToArchive), GetSystemString(archiverInfo.Name), CP_OEMCP);
+ g_StartupInfo.GetMsgString(NMessageID::kUpdateAddToArchive), GetSystemString(arcInfo.Name), CP_OEMCP);
int methodIndex = 0;
- for (int i = sizeof(g_MethodMap) / sizeof(g_MethodMap[0]) - 1; i >= 0; i--)
+ int i;
+ for (i = sizeof(g_MethodMap) / sizeof(g_MethodMap[0]) - 1; i >= 0; i--)
if (compressionInfo.Level >= g_MethodMap[i])
{
methodIndex = i;
@@ -507,20 +509,27 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
if (askCode == kSelectarchiverButtonIndex)
{
+ CIntVector indices;
CSysStringVector archiverNames;
- for(int i = 0; i < archiverInfoList.Size(); i++)
- archiverNames.Add(GetSystemString(archiverInfoList[i].Name,
- CP_OEMCP));
+ for(int i = 0; i < codecs->Formats.Size(); i++)
+ {
+ const CArcInfoEx &arc = codecs->Formats[i];
+ if (arc.UpdateEnabled)
+ {
+ indices.Add(i);
+ archiverNames.Add(GetSystemString(arc.Name, CP_OEMCP));
+ }
+ }
int index = g_StartupInfo.Menu(FMENU_AUTOHIGHLIGHT,
g_StartupInfo.GetMsgString(NMessageID::kUpdateSelectArchiverMenuTitle),
NULL, archiverNames, archiverIndex);
if(index >= 0)
{
- const CArchiverInfo &prevArchiverInfo = archiverInfoList[prevFormat];
+ const CArcInfoEx &prevArchiverInfo = codecs->Formats[prevFormat];
if (prevArchiverInfo.KeepName)
{
- const UString &prevExtension = prevArchiverInfo.GetMainExtension();
+ const UString &prevExtension = prevArchiverInfo.GetMainExt();
const int prevExtensionLen = prevExtension.Length();
if (archiveName.Right(prevExtensionLen).CompareNoCase(prevExtension) == 0)
{
@@ -535,12 +544,11 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
}
}
- archiverIndex = index;
- const CArchiverInfo &archiverInfo =
- archiverInfoList[archiverIndex];
+ archiverIndex = indices[index];
+ const CArcInfoEx &arcInfo = codecs->Formats[archiverIndex];
prevFormat = archiverIndex;
- if (archiverInfo.KeepName)
+ if (arcInfo.KeepName)
archiveName = archiveNameSrc;
else
{
@@ -550,7 +558,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
archiveName = archiveName.Left(dotPos);
}
archiveName += L'.';
- archiveName += archiverInfo.GetMainExtension();
+ archiveName += arcInfo.GetMainExt();
}
continue;
}
@@ -561,7 +569,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
break;
}
- const CArchiverInfo &archiverInfoFinal = archiverInfoList[archiverIndex];
+ const CArcInfoEx &archiverInfoFinal = codecs->Formats[archiverIndex];
compressionInfo.ArchiveType = archiverInfoFinal.Name;
SaveCompressionInfo(compressionInfo);
@@ -651,7 +659,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
&fileNamePointers.Front(), fileNamePointers.Size());
BYTE actionSetByte[NUpdateArchive::NPairState::kNumValues];
for (i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
- actionSetByte[i] = actionSet->StateActions[i];
+ actionSetByte[i] = (BYTE)actionSet->StateActions[i];
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec );
@@ -662,8 +670,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
RINOK(SetOutProperties(outArchive, compressionInfo.Level));
HRESULT result = outArchive->DoOperation(
- GetUnicodeString(archiverInfoFinal.FilePath, CP_OEMCP),
- &archiverInfoFinal.ClassID,
+ codecs, archiverIndex,
tempFileName, actionSetByte,
NULL, updateCallback);
updateCallback.Release();
diff --git a/CPP/7zip/UI/Far/ProgressBox.cpp b/CPP/7zip/UI/Far/ProgressBox.cpp
index 64e0e09d..d708331a 100755
--- a/CPP/7zip/UI/Far/ProgressBox.cpp
+++ b/CPP/7zip/UI/Far/ProgressBox.cpp
@@ -12,7 +12,8 @@ using namespace NFar;
static void CopySpaces(char *destString, int numSpaces)
{
- for(int i = 0; i < numSpaces; i++)
+ int i;
+ for(i = 0; i < numSpaces; i++)
destString[i] = ' ';
destString[i] = '\0';
}
@@ -47,11 +48,11 @@ void CMessageBox::ShowProcessMessages(const char *messages[])
for (int i = 0; i < m_NumStrings; i++)
{
char *formattedMessage = formattedMessages[i];
- int len = strlen(messages[i]);
+ int len = (int)strlen(messages[i]);
int size = MyMax(m_Width, len);
int startPos = (size - len) / 2;
CopySpaces(formattedMessage, startPos);
- strcpy(formattedMessage + startPos, messages[i]);
+ MyStringCopy(formattedMessage + startPos, messages[i]);
CopySpaces(formattedMessage + startPos + len, size - startPos - len);
msgItems[kNumStaticStrings + i] = formattedMessage;
}
diff --git a/CPP/7zip/UI/Far/StdAfx.h b/CPP/7zip/UI/Far/StdAfx.h
index 0a7c347b..ae0e328a 100755
--- a/CPP/7zip/UI/Far/StdAfx.h
+++ b/CPP/7zip/UI/Far/StdAfx.h
@@ -3,6 +3,7 @@
#ifndef __STDAFX_H
#define __STDAFX_H
+#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#include <stdio.h>
diff --git a/CPP/7zip/UI/Far/UpdateCallback100.cpp b/CPP/7zip/UI/Far/UpdateCallback100.cpp
index f1a2946e..96699174 100755
--- a/CPP/7zip/UI/Far/UpdateCallback100.cpp
+++ b/CPP/7zip/UI/Far/UpdateCallback100.cpp
@@ -29,17 +29,17 @@ STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UINT64 *aCompleteValue)
return S_OK;
}
-STDMETHODIMP CUpdateCallback100Imp::CompressOperation(const wchar_t *aName)
+STDMETHODIMP CUpdateCallback100Imp::CompressOperation(const wchar_t* /* name */)
{
return S_OK;
}
-STDMETHODIMP CUpdateCallback100Imp::DeleteOperation(const wchar_t *aName)
+STDMETHODIMP CUpdateCallback100Imp::DeleteOperation(const wchar_t* /* name */)
{
return S_OK;
}
-STDMETHODIMP CUpdateCallback100Imp::OperationResult(INT32 aOperationResult)
+STDMETHODIMP CUpdateCallback100Imp::OperationResult(INT32 /* operationResult */)
{
return S_OK;
}
diff --git a/CPP/7zip/UI/Far/makefile b/CPP/7zip/UI/Far/makefile
index 4dbd1988..42c5a0a7 100755
--- a/CPP/7zip/UI/Far/makefile
+++ b/CPP/7zip/UI/Far/makefile
@@ -1,7 +1,9 @@
PROG = 7-ZipFar.dll
DEF_FILE = Far.def
LIBS = $(LIBS) user32.lib oleaut32.lib advapi32.lib ole32.lib
-CFLAGS = $(CFLAGS) -I ../../../ -DWIN_LONG_PATH
+CFLAGS = $(CFLAGS) -I ../../../ \
+ -DWIN_LONG_PATH \
+ -DEXTERNAL_CODECS
FAR_OBJS = \
$O\CLSIDConst.obj \
@@ -18,7 +20,6 @@ FAR_OBJS = \
$O\UpdateCallback100.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\IntToString.obj \
$O\NewHandler.obj \
$O\String.obj \
@@ -47,10 +48,10 @@ WIN_OBJS = \
UI_COMMON_OBJS = \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
- $O\ArchiverInfo.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\ExtractingFilePath.obj \
+ $O\LoadCodecs.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
$O\SortUtils.obj \
@@ -68,6 +69,7 @@ AGENT_OBJS = \
$O\UpdateCallbackAgent.obj \
C_OBJS = \
+ $O\Alloc.obj \
$O\Sort.obj \
OBJS = \
diff --git a/CPP/7zip/UI/GUI/CompressDialog.cpp b/CPP/7zip/UI/GUI/CompressDialog.cpp
index f49bb078..de182923 100755
--- a/CPP/7zip/UI/GUI/CompressDialog.cpp
+++ b/CPP/7zip/UI/GUI/CompressDialog.cpp
@@ -45,8 +45,8 @@ static CIDLangPair kIDLangPairs[] =
{ IDC_STATIC_COMPRESS_ORDER, 0x02000D0D },
{ IDC_STATIC_COMPRESS_MEMORY, 0x02000D0E },
{ IDC_STATIC_COMPRESS_MEMORY_DE, 0x02000D0F },
- { IDC_COMPRESS_SOLID, 0x02000D05 },
- { IDC_COMPRESS_MULTI_THREAD, 0x02000D09 },
+ { IDC_STATIC_COMPRESS_THREADS, 0x02000D12 },
+ { IDC_STATIC_COMPRESS_SOLID, 0x02000D13 },
{ IDC_STATIC_COMPRESS_VOLUME, 0x02000D40 },
{ IDC_STATIC_COMPRESS_PARAMETERS, 0x02000D06 },
@@ -221,38 +221,9 @@ static bool IsMethodSupportedBySfx(int methodID)
return false;
};
-#ifndef _WIN64
-typedef BOOL (WINAPI *GlobalMemoryStatusExP)(LPMEMORYSTATUSEX lpBuffer);
-#endif
-
-static UInt64 GetPhysicalRamSize()
-{
- MEMORYSTATUSEX stat;
- stat.dwLength = sizeof(stat);
- // return (128 << 20);
- #ifdef _WIN64
- if (!::GlobalMemoryStatusEx(&stat))
- return 0;
- return stat.ullTotalPhys;
- #else
- GlobalMemoryStatusExP globalMemoryStatusEx = (GlobalMemoryStatusExP)
- ::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")),
- "GlobalMemoryStatusEx");
- if (globalMemoryStatusEx != 0)
- if (globalMemoryStatusEx(&stat))
- return stat.ullTotalPhys;
- {
- MEMORYSTATUS stat;
- stat.dwLength = sizeof(stat);
- GlobalMemoryStatus(&stat);
- return stat.dwTotalPhys;
- }
- #endif
-}
-
static UInt64 GetMaxRamSizeForProgram()
{
- UInt64 physSize = GetPhysicalRamSize();
+ UInt64 physSize = NSystem::GetRamSize();
const UInt64 kMinSysSize = (1 << 24);
if (physSize <= kMinSysSize)
physSize = 0;
@@ -282,6 +253,8 @@ bool CCompressDialog::OnInit()
m_Method.Attach(GetItem(IDC_COMPRESS_COMBO_METHOD));
m_Dictionary.Attach(GetItem(IDC_COMPRESS_COMBO_DICTIONARY));
m_Order.Attach(GetItem(IDC_COMPRESS_COMBO_ORDER));
+ m_Solid.Attach(GetItem(IDC_COMPRESS_COMBO_SOLID));
+ m_NumThreads.Attach(GetItem(IDC_COMPRESS_COMBO_THREADS));
m_UpdateMode.Attach(GetItem(IDC_COMPRESS_COMBO_UPDATE_MODE));
m_Volume.Attach(GetItem(IDC_COMPRESS_COMBO_VOLUME));
@@ -299,7 +272,7 @@ bool CCompressDialog::OnInit()
int i;
for(i = 0; i < m_ArchiverInfoList.Size(); i++)
{
- const CArchiverInfo &ai = m_ArchiverInfoList[i];
+ const CArcInfoEx &ai = m_ArchiverInfoList[i];
m_Format.AddString(ai.Name);
if (ai.Name.CompareNoCase(m_RegistryInfo.ArchiveType) == 0)
Info.ArchiverInfoIndex = i;
@@ -320,11 +293,13 @@ bool CCompressDialog::OnInit()
m_UpdateMode.SetCurSel(0);
- Info.Solid = m_RegistryInfo.Solid;
- Info.MultiThread = m_RegistryInfo.MultiThread;
+ SetSolidBlockSize();
+ SetNumThreads();
+
+ TCHAR s[40] = { TEXT('/'), TEXT(' '), 0 };
+ ConvertUInt64ToString(NSystem::GetNumberOfProcessors(), s + 2);
+ SetItemText(IDC_COMPRESS_HARDWARE_THREADS, s);
- CheckButton(IDC_COMPRESS_SOLID, Info.Solid);
- CheckButton(IDC_COMPRESS_MULTI_THREAD, Info.MultiThread);
CheckButton(IDC_COMPRESS_SFX, Info.SFXMode);
CheckControlsEnable();
@@ -380,20 +355,10 @@ bool CCompressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
UpdatePasswordControl();
return true;
}
- case IDC_COMPRESS_MULTI_THREAD:
- {
- SetMemoryUsage();
- return true;
- }
}
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
}
-static bool IsMultiProcessor()
-{
- return NSystem::GetNumberOfProcessors() > 1;
-}
-
void CCompressDialog::CheckSFXControlsEnable()
{
const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
@@ -419,13 +384,13 @@ void CCompressDialog::CheckVolumeEnable()
void CCompressDialog::CheckControlsEnable()
{
const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- Info.SolidIsAllowed = fi.Solid;
- bool multiThreadEnable = fi.MultiThread & IsMultiProcessor();
+ Info.SolidIsSpecified = fi.Solid;
+ bool multiThreadEnable = fi.MultiThread;
Info.MultiThreadIsAllowed = multiThreadEnable;
Info.EncryptHeadersIsAllowed = fi.EncryptFileNames;
- EnableItem(IDC_COMPRESS_SOLID, fi.Solid);
- EnableItem(IDC_COMPRESS_MULTI_THREAD, multiThreadEnable);
+ EnableItem(IDC_COMPRESS_COMBO_SOLID, fi.Solid);
+ EnableItem(IDC_COMPRESS_COMBO_THREADS, multiThreadEnable);
CheckSFXControlsEnable();
CheckVolumeEnable();
@@ -563,14 +528,17 @@ void CCompressDialog::OnOK()
Info.Dictionary = GetDictionarySpec();
Info.Order = GetOrderSpec();
Info.OrderMode = GetOrderMode();
+ Info.NumThreads = GetNumThreadsSpec();
+
+ UInt32 solidLogSize = GetBlockSizeSpec();
+ Info.SolidBlockSize = 0;
+ if (solidLogSize > 0)
+ Info.SolidBlockSize = (solidLogSize >= 64) ? (UInt64)(Int64)-1 : ((UInt64)1 << solidLogSize);
+
Info.Method = GetMethodSpec();
Info.EncryptionMethod = GetEncryptionMethodSpec();
-
Info.ArchiverInfoIndex = m_Format.GetCurSel();
-
Info.SFXMode = IsSFX();
- m_RegistryInfo.Solid = Info.Solid = IsButtonCheckedBool(IDC_COMPRESS_SOLID);
- m_RegistryInfo.MultiThread = Info.MultiThread = IsMultiThread();
m_RegistryInfo.EncryptHeaders = Info.EncryptHeaders = IsButtonCheckedBool(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES);
m_Params.GetText(Info.Options);
@@ -609,12 +577,7 @@ void CCompressDialog::OnOK()
if (m_RegistryInfo.HistoryArchives.Size() > kHistorySize)
m_RegistryInfo.HistoryArchives.DeleteBack();
- ////////////////////
- // Method
-
- m_RegistryInfo.Level = Info.Level;
m_RegistryInfo.ArchiveType = m_ArchiverInfoList[Info.ArchiverInfoIndex].Name;
-
m_RegistryInfo.ShowPassword = IsShowPasswordChecked();
SaveCompressionInfo(m_RegistryInfo);
@@ -642,11 +605,13 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
}
case IDC_COMPRESS_COMBO_LEVEL:
{
- const CArchiverInfo &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
int index = FindRegistryFormatAlways(ai.Name);
NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
fo.ResetForLevelChange();
SetMethod();
+ SetSolidBlockSize();
+ SetNumThreads();
CheckSFXNameChange();
return true;
}
@@ -654,12 +619,20 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
{
SetDictionary();
SetOrder();
+ SetSolidBlockSize();
+ SetNumThreads();
CheckSFXNameChange();
return true;
}
case IDC_COMPRESS_COMBO_DICTIONARY:
case IDC_COMPRESS_COMBO_ORDER:
{
+ SetSolidBlockSize();
+ SetMemoryUsage();
+ return true;
+ }
+ case IDC_COMPRESS_COMBO_THREADS:
+ {
SetMemoryUsage();
return true;
}
@@ -680,10 +653,10 @@ void CCompressDialog::SetArchiveName2(bool prevWasSFX)
{
UString fileName;
m_ArchivePath.GetText(fileName);
- const CArchiverInfo &prevArchiverInfo = m_ArchiverInfoList[m_PrevFormat];
+ const CArcInfoEx &prevArchiverInfo = m_ArchiverInfoList[m_PrevFormat];
if (prevArchiverInfo.KeepName || Info.KeepName)
{
- UString prevExtension = prevArchiverInfo.GetMainExtension();
+ UString prevExtension = prevArchiverInfo.GetMainExt();
if (prevWasSFX)
prevExtension = kExeExt;
else
@@ -701,6 +674,8 @@ void CCompressDialog::OnChangeFormat()
bool isSFX = IsSFX();
SaveOptionsInMem();
SetLevel();
+ SetSolidBlockSize();
+ SetNumThreads();
SetParams();
CheckControlsEnable();
SetArchiveName2(isSFX);
@@ -715,7 +690,7 @@ void CCompressDialog::SetArchiveName(const UString &name)
{
UString fileName = name;
Info.ArchiverInfoIndex = m_Format.GetCurSel();
- const CArchiverInfo &ai = m_ArchiverInfoList[Info.ArchiverInfoIndex];
+ const CArcInfoEx &ai = m_ArchiverInfoList[Info.ArchiverInfoIndex];
m_PrevFormat = Info.ArchiverInfoIndex;
if (ai.KeepName)
{
@@ -737,7 +712,7 @@ void CCompressDialog::SetArchiveName(const UString &name)
else
{
fileName += L'.';
- fileName += ai.GetMainExtension();
+ fileName += ai.GetMainExt();
}
m_ArchivePath.SetText(fileName);
}
@@ -768,15 +743,14 @@ int CCompressDialog::FindRegistryFormatAlways(const UString &name)
int CCompressDialog::GetStaticFormatIndex()
{
int formatIndex = m_Format.GetCurSel();
- const CArchiverInfo &ai = m_ArchiverInfoList[formatIndex];
+ const CArcInfoEx &ai = m_ArchiverInfoList[formatIndex];
for (int i = 0; i < MY_SIZE_OF_ARRAY(g_Formats); i++)
if (ai.Name.CompareNoCase(g_Formats[i].Name) == 0)
return i;
return 0; // -1;
}
-void CCompressDialog::SetNearestSelectComboBox(
- NControl::CComboBox &comboBox, UInt32 value)
+void CCompressDialog::SetNearestSelectComboBox(NControl::CComboBox &comboBox, UInt32 value)
{
for (int i = comboBox.GetCount() - 1; i >= 0; i--)
if ((UInt32)comboBox.GetItemData(i) <= value)
@@ -792,7 +766,7 @@ void CCompressDialog::SetLevel()
{
m_Level.ResetContent();
const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- const CArchiverInfo &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
int index = FindRegistryFormat(ai.Name);
UInt32 level = kNormal;
if (index >= 0)
@@ -817,50 +791,18 @@ void CCompressDialog::SetLevel()
SetMethod();
}
-int CCompressDialog::GetLevel()
-{
- if (m_Level.GetCount() <= 0)
- return -1;
- return (int)m_Level.GetItemData(m_Level.GetCurSel());
-}
-
-int CCompressDialog::GetLevelSpec()
-{
- if (m_Level.GetCount() <= 1)
- return -1;
- return GetLevel();
-}
-
-int CCompressDialog::GetLevel2()
-{
- int level = GetLevel();
- if (level < 0)
- level = 5;
- return level;
-}
-
-bool CCompressDialog::IsMultiThread()
-{
- /*
- const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- bool multiThreadEnable = fi.MultiThread & IsMultiProcessor();
- if (!multiThreadEnable)
- return false;
- */
- return IsButtonCheckedBool(IDC_COMPRESS_MULTI_THREAD);
-}
-
void CCompressDialog::SetMethod()
{
m_Method.ResetContent();
- if (GetLevel() <= 0)
+ UInt32 level = GetLevel();
+ if (level == 0)
{
SetDictionary();
SetOrder();
return;
}
const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- const CArchiverInfo &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
int index = FindRegistryFormat(ai.Name);
UString defaultMethod;
if (index >= 0)
@@ -886,14 +828,14 @@ void CCompressDialog::SetMethod()
bool CCompressDialog::IsZipFormat()
{
- const CArchiverInfo &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
return (ai.Name.CompareNoCase(L"zip") == 0);
}
void CCompressDialog::SetEncryptionMethod()
{
_encryptionMethod.ResetContent();
- const CArchiverInfo &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
if (ai.Name.CompareNoCase(L"7z") == 0)
{
_encryptionMethod.AddString(TEXT("AES-256"));
@@ -935,7 +877,7 @@ UString CCompressDialog::GetMethodSpec()
UString CCompressDialog::GetEncryptionMethodSpec()
{
- if (m_Method.GetCount() <= 1)
+ if (_encryptionMethod.GetCount() <= 1)
return UString();
if (_encryptionMethod.GetCurSel() <= 0)
return UString();
@@ -981,7 +923,7 @@ int CCompressDialog::AddDictionarySize(UInt32 size)
void CCompressDialog::SetDictionary()
{
m_Dictionary.ResetContent();
- const CArchiverInfo &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
int index = FindRegistryFormat(ai.Name);
UInt32 defaultDictionary = UInt32(-1);
if (index >= 0)
@@ -991,7 +933,7 @@ void CCompressDialog::SetDictionary()
defaultDictionary = fo.Dictionary;
}
int methodID = GetMethodID();
- int level = GetLevel2();
+ UInt32 level = GetLevel2();
if (methodID < 0)
{
SetMemoryUsage();
@@ -1005,16 +947,11 @@ void CCompressDialog::SetDictionary()
static const UInt32 kMinDicSize = (1 << 16);
if (defaultDictionary == UInt32(-1))
{
- if (level >= 9)
- defaultDictionary = (1 << 26);
- else if (level >= 7)
- defaultDictionary = (1 << 24);
- else if (level >= 5)
- defaultDictionary = (1 << 22);
- else if (level >= 3)
- defaultDictionary = (1 << 20);
- else
- defaultDictionary = (kMinDicSize);
+ if (level >= 9) defaultDictionary = (1 << 26);
+ else if (level >= 7) defaultDictionary = (1 << 25);
+ else if (level >= 5) defaultDictionary = (1 << 24);
+ else if (level >= 3) defaultDictionary = (1 << 20);
+ else defaultDictionary = (kMinDicSize);
}
int i;
AddDictionarySize(kMinDicSize);
@@ -1029,13 +966,13 @@ void CCompressDialog::SetDictionary()
#ifdef _WIN64
(1 << 30)
#else
- (1 << 27)
+ (1 << 26)
#endif
)
continue;
AddDictionarySize(dictionary);
UInt64 decomprSize;
- UInt64 requiredComprSize = GetMemoryUsage(dictionary, false, decomprSize);
+ UInt64 requiredComprSize = GetMemoryUsage(dictionary, decomprSize);
if (dictionary <= defaultDictionary && requiredComprSize <= maxRamSize)
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
}
@@ -1047,14 +984,10 @@ void CCompressDialog::SetDictionary()
{
if (defaultDictionary == UInt32(-1))
{
- if (level >= 9)
- defaultDictionary = (192 << 20);
- else if (level >= 7)
- defaultDictionary = (64 << 20);
- else if (level >= 5)
- defaultDictionary = (16 << 20);
- else
- defaultDictionary = (4 << 20);
+ if (level >= 9) defaultDictionary = (192 << 20);
+ else if (level >= 7) defaultDictionary = ( 64 << 20);
+ else if (level >= 5) defaultDictionary = ( 16 << 20);
+ else defaultDictionary = ( 4 << 20);
}
int i;
for (i = 20; i < 31; i++)
@@ -1067,7 +1000,7 @@ void CCompressDialog::SetDictionary()
continue;
AddDictionarySize(dictionary);
UInt64 decomprSize;
- UInt64 requiredComprSize = GetMemoryUsage(dictionary, false, decomprSize);
+ UInt64 requiredComprSize = GetMemoryUsage(dictionary, decomprSize);
if (dictionary <= defaultDictionary && requiredComprSize <= maxRamSize || m_Dictionary.GetCount() == 0)
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
}
@@ -1108,18 +1041,19 @@ void CCompressDialog::SetDictionary()
SetMemoryUsage();
}
-UInt32 CCompressDialog::GetDictionary()
+UInt32 CCompressDialog::GetComboValue(NWindows::NControl::CComboBox &c, int defMax)
{
- if (m_Dictionary.GetCount() <= 0)
+ if (c.GetCount() <= defMax)
return (UInt32)-1;
- return (UInt32)m_Dictionary.GetItemData(m_Dictionary.GetCurSel());
+ return (UInt32)c.GetItemData(c.GetCurSel());
}
-UInt32 CCompressDialog::GetDictionarySpec()
+UInt32 CCompressDialog::GetLevel2()
{
- if (m_Dictionary.GetCount() <= 1)
- return (UInt32)-1;
- return GetDictionary();
+ UInt32 level = GetLevel();
+ if (level == (UInt32)-1)
+ level = 5;
+ return level;
}
int CCompressDialog::AddOrder(UInt32 size)
@@ -1134,7 +1068,7 @@ int CCompressDialog::AddOrder(UInt32 size)
void CCompressDialog::SetOrder()
{
m_Order.ResetContent();
- const CArchiverInfo &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
int index = FindRegistryFormat(ai.Name);
UInt32 defaultOrder = UInt32(-1);
if (index >= 0)
@@ -1144,7 +1078,7 @@ void CCompressDialog::SetOrder()
defaultOrder = fo.Order;
}
int methodID = GetMethodID();
- int level = GetLevel2();
+ UInt32 level = GetLevel2();
if (methodID < 0)
{
SetMemoryUsage();
@@ -1236,24 +1170,107 @@ bool CCompressDialog::GetOrderMode()
return false;
}
-UInt32 CCompressDialog::GetOrder()
+static const UInt32 kNoSolidBlockSize = 0;
+static const UInt32 kSolidBlockSize = 64;
+
+void CCompressDialog::SetSolidBlockSize()
{
- if (m_Order.GetCount() <= 0)
- return (UInt32)-1;
- return (UInt32)m_Order.GetItemData(m_Order.GetCurSel());
+ m_Solid.ResetContent();
+ const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
+ if (!fi.Solid)
+ return;
+
+ UInt32 dictionary = GetDictionarySpec();
+ if (dictionary == UInt32(-1))
+ dictionary = 1;
+
+ UInt32 defaultBlockSize = (UInt32)-1;
+
+ const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ int index = FindRegistryFormat(ai.Name);
+ if (index >= 0)
+ {
+ const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
+ if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
+ defaultBlockSize = fo.BlockLogSize;
+ }
+
+ index = (int)m_Solid.AddString(LangString(IDS_COMPRESS_NON_SOLID, 0x02000D14));
+ m_Solid.SetItemData(index, (UInt32)kNoSolidBlockSize);
+ m_Solid.SetCurSel(0);
+ bool needSet = defaultBlockSize == (UInt32)-1;
+ for (int i = 20; i <= 36; i++)
+ {
+ if (needSet && dictionary >= (((UInt64)1 << (i - 7))) && i <= 32)
+ defaultBlockSize = i;
+ TCHAR s[40];
+ ConvertUInt64ToString(1 << (i % 10), s);
+ if (i < 30) lstrcat(s, TEXT(" M"));
+ else lstrcat(s, TEXT(" G"));
+ lstrcat(s, TEXT("B"));
+ int index = (int)m_Solid.AddString(s);
+ m_Solid.SetItemData(index, (UInt32)i);
+ }
+ index = (int)m_Solid.AddString(LangString(IDS_COMPRESS_SOLID, 0x02000D15));
+ m_Solid.SetItemData(index, kSolidBlockSize);
+ if (defaultBlockSize == (UInt32)-1)
+ defaultBlockSize = kSolidBlockSize;
+ if (defaultBlockSize != kNoSolidBlockSize)
+ SetNearestSelectComboBox(m_Solid, defaultBlockSize);
}
-UInt32 CCompressDialog::GetOrderSpec()
+void CCompressDialog::SetNumThreads()
{
- if (m_Order.GetCount() <= 1)
- return (UInt32)-1;
- return GetOrder();
+ m_NumThreads.ResetContent();
+
+ const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
+ if (!fi.MultiThread)
+ return;
+
+ UInt32 numHardwareThreads = NSystem::GetNumberOfProcessors();
+ UInt32 defaultValue = numHardwareThreads;
+
+ const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ int index = FindRegistryFormat(ai.Name);
+ if (index >= 0)
+ {
+ const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
+ if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
+ defaultValue = fo.NumThreads;
+ }
+
+ UInt32 numAlgoThreadsMax = 1;
+ int methodID = GetMethodID();
+ switch (methodID)
+ {
+ case kLZMA:
+ {
+ numAlgoThreadsMax = 2;
+ break;
+ }
+ case kBZip2:
+ {
+ numAlgoThreadsMax = 32;
+ break;
+ }
+ }
+ if (IsZipFormat())
+ numAlgoThreadsMax = 128;
+ for (UInt32 i = 1; i <= numHardwareThreads * 2 && i <= numAlgoThreadsMax; i++)
+ {
+ TCHAR s[40];
+ ConvertUInt64ToString(i, s);
+ int index = (int)m_NumThreads.AddString(s);
+ m_NumThreads.SetItemData(index, (UInt32)i);
+ }
+ SetNearestSelectComboBox(m_NumThreads, defaultValue);
}
-UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, bool isMultiThread, UInt64 &decompressMemory)
+
+UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemory)
{
decompressMemory = UInt64(Int64(-1));
- int level = GetLevel2();
+ UInt32 level = GetLevel2();
if (level == 0)
{
decompressMemory = (1 << 20);
@@ -1264,6 +1281,12 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, bool isMultiThread, UI
const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
if (fi.Filter && level >= 9)
size += (12 << 20) * 2 + (5 << 20);
+ UInt32 numThreads = GetNumThreads2();
+ if (IsZipFormat())
+ {
+ if (numThreads > 1)
+ size += (UInt64)numThreads << 25;
+ }
switch (GetMethodID())
{
case kLZMA:
@@ -1283,7 +1306,7 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, bool isMultiThread, UI
if (level >= 5)
size += dictionary * 4;
size += (2 << 20);
- if (isMultiThread && level >= 5)
+ if (numThreads > 1 && level >= 5)
size += (2 << 20) + (4 << 20);
decompressMemory = dictionary + (2 << 20);
@@ -1310,9 +1333,7 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, bool isMultiThread, UI
{
decompressMemory = (7 << 20);
UInt64 memForOneThread = (10 << 20);
- if (isMultiThread)
- memForOneThread *= NSystem::GetNumberOfProcessors();
- return size + (10 << 20);
+ return size + memForOneThread * numThreads;
}
}
return UInt64(Int64(-1));
@@ -1320,7 +1341,7 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, bool isMultiThread, UI
UInt64 CCompressDialog::GetMemoryUsage(UInt64 &decompressMemory)
{
- return GetMemoryUsage(GetDictionary(), IsMultiThread(), decompressMemory);
+ return GetMemoryUsage(GetDictionary(), decompressMemory);
}
void CCompressDialog::PrintMemUsage(UINT res, UInt64 value)
@@ -1347,7 +1368,7 @@ void CCompressDialog::SetMemoryUsage()
void CCompressDialog::SetParams()
{
- const CArchiverInfo &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
m_Params.SetText(TEXT(""));
int index = FindRegistryFormat(ai.Name);
if (index >= 0)
@@ -1359,7 +1380,7 @@ void CCompressDialog::SetParams()
void CCompressDialog::SaveOptionsInMem()
{
- const CArchiverInfo &ai = m_ArchiverInfoList[Info.ArchiverInfoIndex];
+ const CArcInfoEx &ai = m_ArchiverInfoList[Info.ArchiverInfoIndex];
int index = FindRegistryFormatAlways(ai.Name);
m_Params.GetText(Info.Options);
Info.Options.Trim();
@@ -1370,4 +1391,6 @@ void CCompressDialog::SaveOptionsInMem()
fo.Order = GetOrderSpec();
fo.Method = GetMethodSpec();
fo.EncryptionMethod = GetEncryptionMethodSpec();
+ fo.NumThreads = GetNumThreadsSpec();
+ fo.BlockLogSize = GetBlockSizeSpec();
}
diff --git a/CPP/7zip/UI/GUI/CompressDialog.h b/CPP/7zip/UI/GUI/CompressDialog.h
index 87cf5d79..1ff20cd0 100755
--- a/CPP/7zip/UI/GUI/CompressDialog.h
+++ b/CPP/7zip/UI/GUI/CompressDialog.h
@@ -4,7 +4,7 @@
#define __COMPRESSDIALOG_H
#include "../Common/ZipRegistry.h"
-#include "../Common/ArchiverInfo.h"
+#include "../Common/LoadCodecs.h"
#include "../Resource/CompressDialog/resource.h"
#include "Windows/Control/Dialog.h"
@@ -26,11 +26,10 @@ namespace NCompressDialog
struct CInfo
{
NUpdateMode::EEnum UpdateMode;
- bool SolidIsAllowed;
- bool Solid;
-
+ bool SolidIsSpecified;
bool MultiThreadIsAllowed;
- bool MultiThread;
+ UInt64 SolidBlockSize;
+ UInt32 NumThreads;
CRecordVector<UInt64> VolumeSizes;
@@ -80,6 +79,8 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
NWindows::NControl::CComboBox m_Method;
NWindows::NControl::CComboBox m_Dictionary;
NWindows::NControl::CComboBox m_Order;
+ NWindows::NControl::CComboBox m_Solid;
+ NWindows::NControl::CComboBox m_NumThreads;
NWindows::NControl::CComboBox m_UpdateMode;
NWindows::NControl::CComboBox m_Volume;
NWindows::NControl::CDialogChildControl m_Params;
@@ -104,10 +105,6 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
void SetNearestSelectComboBox(NWindows::NControl::CComboBox &comboBox, UInt32 value);
void SetLevel();
- int GetLevel();
- int GetLevelSpec();
- int GetLevel2();
- bool IsMultiThread();
void SetMethod();
int GetMethodID();
@@ -122,16 +119,28 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
int AddDictionarySize(UInt32 size);
void SetDictionary();
- UInt32 GetDictionary();
- UInt32 GetDictionarySpec();
+
+ UInt32 GetComboValue(NWindows::NControl::CComboBox &c, int defMax = 0);
+
+ UInt32 GetLevel() { return GetComboValue(m_Level); }
+ UInt32 GetLevelSpec() { return GetComboValue(m_Level, 1); }
+ UInt32 GetLevel2();
+ UInt32 GetDictionary() { return GetComboValue(m_Dictionary); }
+ UInt32 GetDictionarySpec() { return GetComboValue(m_Dictionary, 1); }
+ UInt32 GetOrder() { return GetComboValue(m_Order); }
+ UInt32 GetOrderSpec() { return GetComboValue(m_Order, 1); }
+ UInt32 GetNumThreadsSpec() { return GetComboValue(m_NumThreads, 1); }
+ UInt32 GetNumThreads2() { UInt32 num = GetNumThreadsSpec(); if (num == UInt32(-1)) num = 1; return num; }
+ UInt32 GetBlockSizeSpec() { return GetComboValue(m_Solid, 1); }
int AddOrder(UInt32 size);
void SetOrder();
bool GetOrderMode();
- UInt32 GetOrder();
- UInt32 GetOrderSpec();
- UInt64 GetMemoryUsage(UInt32 dictionary, bool isMultiThread, UInt64 &decompressMemory);
+ void SetSolidBlockSize();
+ void SetNumThreads();
+
+ UInt64 GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemory);
UInt64 GetMemoryUsage(UInt64 &decompressMemory);
void PrintMemUsage(UINT res, UInt64 value);
void SetMemoryUsage();
@@ -142,7 +151,7 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
bool IsShowPasswordChecked() const
{ return IsButtonChecked(IDC_COMPRESS_CHECK_SHOW_PASSWORD) == BST_CHECKED; }
public:
- CObjectVector<CArchiverInfo> m_ArchiverInfoList;
+ CObjectVector<CArcInfoEx> m_ArchiverInfoList;
NCompressDialog::CInfo Info;
UString OriginalFileName; // for bzip2, gzip2
diff --git a/CPP/7zip/UI/GUI/ExtractGUI.cpp b/CPP/7zip/UI/GUI/ExtractGUI.cpp
index 395df5a9..3edb1229 100755
--- a/CPP/7zip/UI/GUI/ExtractGUI.cpp
+++ b/CPP/7zip/UI/GUI/ExtractGUI.cpp
@@ -28,8 +28,8 @@ static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
struct CThreadExtracting
{
+ CCodecs *codecs;
CExtractCallbackImp *ExtractCallbackSpec;
-
UStringVector *ArchivePaths;
UStringVector *ArchivePathsFull;
const NWildcard::CCensorNode *WildcardCensor;
@@ -45,7 +45,9 @@ struct CThreadExtracting
ExtractCallbackSpec->ProgressDialog.WaitCreating();
try
{
- Result = DecompressArchives(*ArchivePaths, *ArchivePathsFull,
+ Result = DecompressArchives(
+ codecs,
+ *ArchivePaths, *ArchivePathsFull,
*WildcardCensor, *Options, OpenCallback, ExtractCallback, ErrorMessage);
}
catch(const UString &s)
@@ -77,6 +79,7 @@ struct CThreadExtracting
};
HRESULT ExtractGUI(
+ CCodecs *codecs,
UStringVector &archivePaths,
UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
@@ -86,6 +89,7 @@ HRESULT ExtractGUI(
CExtractCallbackImp *extractCallback)
{
CThreadExtracting extracter;
+ extracter.codecs = codecs;
if (!options.TestMode)
{
diff --git a/CPP/7zip/UI/GUI/ExtractGUI.h b/CPP/7zip/UI/GUI/ExtractGUI.h
index 5a0b157d..281fcc43 100755
--- a/CPP/7zip/UI/GUI/ExtractGUI.h
+++ b/CPP/7zip/UI/GUI/ExtractGUI.h
@@ -9,6 +9,7 @@
#include "../../FileManager/ExtractCallback.h"
HRESULT ExtractGUI(
+ CCodecs *codecs,
UStringVector &archivePaths,
UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
diff --git a/CPP/7zip/UI/GUI/GUI.cpp b/CPP/7zip/UI/GUI/GUI.cpp
index fe956dbd..ad58a451 100755
--- a/CPP/7zip/UI/GUI/GUI.cpp
+++ b/CPP/7zip/UI/GUI/GUI.cpp
@@ -4,6 +4,11 @@
#include <initguid.h>
+extern "C"
+{
+ #include "../../../../C/Alloc.h"
+}
+
#include "Common/NewHandler.h"
#include "Common/StringConvert.h"
#include "Common/CommandLineParser.h"
@@ -17,7 +22,6 @@
#include "Windows/FileName.h"
#ifdef _WIN32
#include "Windows/MemoryLock.h"
-#include "Common/Alloc.h"
#endif
#include "../../IStream.h"
@@ -33,6 +37,7 @@
#include "ExtractGUI.h"
#include "UpdateGUI.h"
+#include "Resource/BenchmarkDialog/BenchmarkDialog.h"
using namespace NWindows;
@@ -83,10 +88,26 @@ int Main2()
if (options.LargePages)
NSecurity::EnableLockMemoryPrivilege();
#endif
+
+ CCodecs *codecs = new CCodecs;
+ CMyComPtr<IUnknown> compressCodecsInfo = codecs;
+ HRESULT result = codecs->Load();
+ if (result != S_OK)
+ throw CSystemException(result);
bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
- if (isExtractGroupCommand)
+ if (options.Command.CommandType == NCommandType::kBenchmark)
+ {
+ HRESULT res = Benchmark(
+ #ifdef EXTERNAL_LZMA
+ codecs,
+ #endif
+ options.NumThreads, options.DictionarySize);
+ if (res != S_OK)
+ throw CSystemException(res);
+ }
+ else if (isExtractGroupCommand)
{
CExtractCallbackImp *ecs = new CExtractCallbackImp;
CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
@@ -109,7 +130,7 @@ int Main2()
eo.Properties = options.ExtractProperties;
#endif
- HRESULT result = ExtractGUI(
+ HRESULT result = ExtractGUI(codecs,
options.ArchivePathsSorted,
options.ArchivePathsFullSorted,
options.WildcardCensor.Pairs.Front().Head,
@@ -138,7 +159,10 @@ int Main2()
CUpdateErrorInfo errorInfo;
+ if (!options.UpdateOptions.Init(codecs, options.ArchiveName, options.ArcType))
+ throw "Unsupported archive type";
HRESULT result = UpdateGUI(
+ codecs,
options.WildcardCensor, options.UpdateOptions,
options.ShowDialog,
errorInfo, &openCallback, &callback);
diff --git a/CPP/7zip/UI/GUI/GUI.dsp b/CPP/7zip/UI/GUI/GUI.dsp
index dadb9648..ccfe98ab 100755
--- a/CPP/7zip/UI/GUI/GUI.dsp
+++ b/CPP/7zip/UI/GUI/GUI.dsp
@@ -45,7 +45,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_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"
@@ -72,7 +72,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_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"
@@ -99,7 +99,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_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"
@@ -127,7 +127,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_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"
@@ -176,728 +176,789 @@ SOURCE=.\StdAfx.cpp
SOURCE=.\StdAfx.h
# End Source File
# End Group
-# Begin Group "SDK"
-
-# PROP Default_Filter ""
-# Begin Group "Common"
+# Begin Group "UI Common"
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Common\Alloc.cpp
+SOURCE=..\Common\ArchiveCommandLine.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Alloc.h
+SOURCE=..\Common\ArchiveCommandLine.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\CommandLineParser.cpp
+SOURCE=..\Common\ArchiveExtractCallback.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\CommandLineParser.h
+SOURCE=..\Common\ArchiveExtractCallback.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\IntToString.cpp
+SOURCE=..\Common\ArchiveOpenCallback.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\IntToString.h
+SOURCE=..\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Lang.cpp
+SOURCE=..\Common\DefaultName.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Lang.h
+SOURCE=..\Common\DefaultName.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\ListFileUtils.cpp
+SOURCE=..\Common\DirItem.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\ListFileUtils.h
+SOURCE=..\Common\EnumDirItems.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\NewHandler.cpp
+SOURCE=..\Common\EnumDirItems.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\NewHandler.h
+SOURCE=..\Common\ExitCode.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\StdInStream.cpp
+SOURCE=..\Common\Extract.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\StdInStream.h
+SOURCE=..\Common\Extract.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\String.cpp
+SOURCE=..\Common\ExtractingFilePath.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\String.h
+SOURCE=..\Common\ExtractingFilePath.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\StringConvert.cpp
+SOURCE=..\Common\ExtractMode.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\StringConvert.h
+SOURCE=..\Common\HandlerLoader.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\StringToInt.cpp
+SOURCE=..\Common\IFileExtractCallback.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\StringToInt.h
+SOURCE=..\Common\LoadCodecs.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\TextConfig.cpp
+SOURCE=..\Common\LoadCodecs.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\TextConfig.h
+SOURCE=..\Common\OpenArchive.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\UTFConvert.cpp
+SOURCE=..\Common\OpenArchive.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\UTFConvert.h
+SOURCE=..\Common\Property.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Vector.cpp
+SOURCE=..\Common\PropIDUtils.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Vector.h
+SOURCE=..\Common\PropIDUtils.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Wildcard.cpp
+SOURCE=..\Common\SetProperties.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Common\Wildcard.h
+SOURCE=..\Common\SetProperties.h
# End Source File
-# End Group
-# Begin Group "Windows"
-
-# PROP Default_Filter ""
-# Begin Group "Control"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Windows\Control\ComboBox.cpp
+SOURCE=..\Common\SortUtils.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Control\ComboBox.h
+SOURCE=..\Common\SortUtils.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Control\Dialog.cpp
+SOURCE=..\Common\TempFiles.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Control\Dialog.h
+SOURCE=..\Common\TempFiles.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Control\Edit.h
+SOURCE=..\Common\Update.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Control\ListView.cpp
+SOURCE=..\Common\Update.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Control\ListView.h
+SOURCE=..\Common\UpdateAction.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Control\ProgressBar.h
+SOURCE=..\Common\UpdateAction.h
# End Source File
-# End Group
# Begin Source File
-SOURCE=..\..\..\Windows\CommonDialog.cpp
+SOURCE=..\Common\UpdateCallback.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\CommonDialog.h
+SOURCE=..\Common\UpdateCallback.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\DLL.cpp
+SOURCE=..\Common\UpdatePair.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\DLL.h
+SOURCE=..\Common\UpdatePair.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Error.cpp
+SOURCE=..\Common\UpdateProduce.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Error.h
+SOURCE=..\Common\UpdateProduce.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\FileDir.cpp
+SOURCE=..\Common\WorkDir.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\FileDir.h
+SOURCE=..\Common\WorkDir.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\FileFind.cpp
+SOURCE=..\Common\ZipRegistry.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\FileFind.h
+SOURCE=..\Common\ZipRegistry.h
# End Source File
+# End Group
+# Begin Group "Explorer"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Windows\FileIO.cpp
+SOURCE=..\Explorer\MyMessages.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\FileIO.h
+SOURCE=..\Explorer\MyMessages.h
# End Source File
+# End Group
+# Begin Group "Dialogs"
+
+# PROP Default_Filter ""
+# Begin Group "Progress"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Windows\FileName.cpp
+SOURCE=..\..\FileManager\Resource\ProgressDialog2\ProgressDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\FileName.h
+SOURCE=..\..\FileManager\Resource\ProgressDialog2\ProgressDialog.h
# End Source File
+# End Group
+# Begin Group "Messages"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Windows\MemoryLock.cpp
+SOURCE=..\..\FileManager\Resource\MessagesDialog\MessagesDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\MemoryLock.h
+SOURCE=..\..\FileManager\Resource\MessagesDialog\MessagesDialog.h
# End Source File
+# End Group
+# Begin Group "Overwtite"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Windows\PropVariant.cpp
+SOURCE=..\..\FileManager\Resource\OverwriteDialog\OverwriteDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\PropVariant.h
+SOURCE=..\..\FileManager\Resource\OverwriteDialog\OverwriteDialog.h
# End Source File
+# End Group
+# Begin Group "Password"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Windows\PropVariantConversions.cpp
+SOURCE=..\..\FileManager\Resource\PasswordDialog\PasswordDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\PropVariantConversions.h
+SOURCE=..\..\FileManager\Resource\PasswordDialog\PasswordDialog.h
# End Source File
+# End Group
+# Begin Group "Compress Dialog"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Windows\Registry.cpp
+SOURCE=.\CompressDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Registry.h
+SOURCE=.\CompressDialog.h
# End Source File
+# End Group
+# Begin Group "Extract Dialog"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Windows\ResourceString.cpp
+SOURCE=.\ExtractDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\ResourceString.h
+SOURCE=.\ExtractDialog.h
# End Source File
+# End Group
+# Begin Group "Benchmark Dialog"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Windows\Shell.cpp
+SOURCE=.\Resource\BenchmarkDialog\BenchmarkDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Shell.h
+SOURCE=.\Resource\BenchmarkDialog\BenchmarkDialog.h
# End Source File
+# End Group
+# End Group
+# Begin Group "FM Common"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\..\Windows\Synchronization.cpp
+SOURCE=..\..\FileManager\ExtractCallback.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Synchronization.h
+SOURCE=..\..\FileManager\ExtractCallback.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Window.cpp
+SOURCE=..\..\FileManager\FolderInterface.h
# End Source File
# Begin Source File
-SOURCE=..\..\..\Windows\Window.h
+SOURCE=..\..\FileManager\FormatUtils.cpp
# End Source File
-# End Group
-# End Group
-# Begin Group "UI Common"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\Common\ArchiveCommandLine.cpp
+SOURCE=..\..\FileManager\FormatUtils.h
# End Source File
# Begin Source File
-SOURCE=..\Common\ArchiveCommandLine.h
+SOURCE=..\..\FileManager\HelpUtils.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\ArchiveExtractCallback.cpp
+SOURCE=..\..\FileManager\HelpUtils.h
# End Source File
# Begin Source File
-SOURCE=..\Common\ArchiveExtractCallback.h
+SOURCE=..\..\FileManager\LangUtils.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\ArchiveOpenCallback.cpp
+SOURCE=..\..\FileManager\LangUtils.h
# End Source File
# Begin Source File
-SOURCE=..\Common\ArchiveOpenCallback.h
+SOURCE=..\..\FileManager\OpenCallback.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\ArchiverInfo.cpp
+SOURCE=..\..\FileManager\OpenCallback.h
# End Source File
# Begin Source File
-SOURCE=..\Common\ArchiverInfo.h
+SOURCE=..\..\FileManager\ProgramLocation.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\DefaultName.cpp
+SOURCE=..\..\FileManager\ProgramLocation.h
# End Source File
# Begin Source File
-SOURCE=..\Common\DefaultName.h
+SOURCE=..\..\FileManager\RegistryUtils.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\DirItem.h
+SOURCE=..\..\FileManager\RegistryUtils.h
# End Source File
# Begin Source File
-SOURCE=..\Common\EnumDirItems.cpp
+SOURCE=..\..\FileManager\SplitUtils.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\EnumDirItems.h
+SOURCE=..\..\FileManager\SplitUtils.h
# End Source File
# Begin Source File
-SOURCE=..\Common\ExitCode.h
+SOURCE=..\..\FileManager\StringUtils.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\Extract.cpp
+SOURCE=..\..\FileManager\StringUtils.h
# End Source File
# Begin Source File
-SOURCE=..\Common\Extract.h
+SOURCE=..\..\FileManager\UpdateCallback100.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\ExtractingFilePath.cpp
+SOURCE=..\..\FileManager\UpdateCallback100.h
# End Source File
+# End Group
+# Begin Group "Engine"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\Common\ExtractingFilePath.h
+SOURCE=.\ExtractGUI.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\ExtractMode.h
+SOURCE=.\ExtractGUI.h
# End Source File
# Begin Source File
-SOURCE=..\Common\HandlerLoader.h
+SOURCE=.\GUI.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\IFileExtractCallback.h
+SOURCE=.\OpenCallbackGUI.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\OpenArchive.cpp
+SOURCE=.\OpenCallbackGUI.h
# End Source File
# Begin Source File
-SOURCE=..\Common\OpenArchive.h
+SOURCE=.\UpdateCallbackGUI.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\Property.h
+SOURCE=.\UpdateCallbackGUI.h
# End Source File
# Begin Source File
-SOURCE=..\Common\PropIDUtils.cpp
+SOURCE=.\UpdateGUI.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\PropIDUtils.h
+SOURCE=.\UpdateGUI.h
# End Source File
+# End Group
+# Begin Group "7-zip Common"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\Common\SetProperties.cpp
+SOURCE=..\..\Common\FilePathAutoRename.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\SetProperties.h
+SOURCE=..\..\Common\FilePathAutoRename.h
# End Source File
# Begin Source File
-SOURCE=..\Common\SortUtils.cpp
+SOURCE=..\..\Common\FileStreams.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\SortUtils.h
+SOURCE=..\..\Common\FileStreams.h
# End Source File
# Begin Source File
-SOURCE=..\Common\TempFiles.cpp
+SOURCE=..\..\Common\StreamUtils.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\TempFiles.h
+SOURCE=..\..\Common\StreamUtils.h
# End Source File
+# End Group
+# Begin Group "Compress"
+
+# PROP Default_Filter ""
+# Begin Group "LZMA Bench"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\Common\Update.cpp
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\Update.h
+SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.h
# End Source File
+# End Group
# Begin Source File
-SOURCE=..\Common\UpdateAction.cpp
+SOURCE=..\..\Compress\Copy\CopyCoder.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\UpdateAction.h
+SOURCE=..\..\Compress\Copy\CopyCoder.h
# End Source File
+# End Group
+# Begin Group "C"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\Common\UpdateCallback.cpp
+SOURCE=..\..\..\..\C\7zCrc.c
+
+!IF "$(CFG)" == "GUI - Win32 Release"
+
+# ADD CPP /O2
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "GUI - Win32 Debug"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "GUI - Win32 ReleaseU"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ELSEIF "$(CFG)" == "GUI - Win32 DebugU"
+
+# SUBTRACT CPP /YX /Yc /Yu
+
+!ENDIF
+
# End Source File
# Begin Source File
-SOURCE=..\Common\UpdateCallback.h
+SOURCE=..\..\..\..\C\7zCrc.h
# End Source File
# Begin Source File
-SOURCE=..\Common\UpdatePair.cpp
+SOURCE=..\..\..\..\C\Alloc.c
+# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
-SOURCE=..\Common\UpdatePair.h
+SOURCE=..\..\..\..\C\Alloc.h
# End Source File
+# End Group
+# Begin Group "Common"
+
+# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\Common\UpdateProduce.cpp
+SOURCE=..\..\..\Common\CommandLineParser.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\UpdateProduce.h
+SOURCE=..\..\..\Common\CommandLineParser.h
# End Source File
# Begin Source File
-SOURCE=..\Common\WorkDir.cpp
+SOURCE=..\..\..\Common\CRC.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\WorkDir.h
+SOURCE=..\..\..\Common\IntToString.cpp
# End Source File
# Begin Source File
-SOURCE=..\Common\ZipRegistry.cpp
+SOURCE=..\..\..\Common\IntToString.h
# End Source File
# Begin Source File
-SOURCE=..\Common\ZipRegistry.h
+SOURCE=..\..\..\Common\Lang.cpp
# End Source File
-# End Group
-# Begin Group "Explorer"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\Explorer\MyMessages.cpp
+SOURCE=..\..\..\Common\Lang.h
# End Source File
# Begin Source File
-SOURCE=..\Explorer\MyMessages.h
+SOURCE=..\..\..\Common\ListFileUtils.cpp
# End Source File
-# End Group
-# Begin Group "Dialogs"
+# Begin Source File
-# PROP Default_Filter ""
-# Begin Group "Progress"
+SOURCE=..\..\..\Common\ListFileUtils.h
+# End Source File
+# Begin Source File
-# PROP Default_Filter ""
+SOURCE=..\..\..\Common\NewHandler.cpp
+# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\Resource\ProgressDialog2\ProgressDialog.cpp
+SOURCE=..\..\..\Common\NewHandler.h
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\Resource\ProgressDialog2\ProgressDialog.h
+SOURCE=..\..\..\Common\StdInStream.cpp
# End Source File
-# End Group
-# Begin Group "Messages"
+# Begin Source File
-# PROP Default_Filter ""
+SOURCE=..\..\..\Common\StdInStream.h
+# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\Resource\MessagesDialog\MessagesDialog.cpp
+SOURCE=..\..\..\Common\String.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\Resource\MessagesDialog\MessagesDialog.h
+SOURCE=..\..\..\Common\String.h
# End Source File
-# End Group
-# Begin Group "Overwtite"
+# Begin Source File
-# PROP Default_Filter ""
+SOURCE=..\..\..\Common\StringConvert.cpp
+# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\Resource\OverwriteDialog\OverwriteDialog.cpp
+SOURCE=..\..\..\Common\StringConvert.h
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\Resource\OverwriteDialog\OverwriteDialog.h
+SOURCE=..\..\..\Common\StringToInt.cpp
# End Source File
-# End Group
-# Begin Group "Password"
+# Begin Source File
-# PROP Default_Filter ""
+SOURCE=..\..\..\Common\StringToInt.h
+# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\Resource\PasswordDialog\PasswordDialog.cpp
+SOURCE=..\..\..\Common\TextConfig.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\Resource\PasswordDialog\PasswordDialog.h
+SOURCE=..\..\..\Common\TextConfig.h
# End Source File
-# End Group
-# Begin Group "Compress Dialog"
+# Begin Source File
-# PROP Default_Filter ""
+SOURCE=..\..\..\Common\UTFConvert.cpp
+# End Source File
# Begin Source File
-SOURCE=.\CompressDialog.cpp
+SOURCE=..\..\..\Common\UTFConvert.h
# End Source File
# Begin Source File
-SOURCE=.\CompressDialog.h
+SOURCE=..\..\..\Common\Vector.cpp
# End Source File
-# End Group
-# Begin Group "Extract Dialog"
+# Begin Source File
-# PROP Default_Filter ""
+SOURCE=..\..\..\Common\Vector.h
+# End Source File
# Begin Source File
-SOURCE=.\ExtractDialog.cpp
+SOURCE=..\..\..\Common\Wildcard.cpp
# End Source File
# Begin Source File
-SOURCE=.\ExtractDialog.h
+SOURCE=..\..\..\Common\Wildcard.h
# End Source File
# End Group
-# End Group
-# Begin Group "FM Common"
+# Begin Group "Windows"
+
+# PROP Default_Filter ""
+# Begin Group "Control"
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\FileManager\ExtractCallback.cpp
+SOURCE=..\..\..\Windows\Control\ComboBox.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\ExtractCallback.h
+SOURCE=..\..\..\Windows\Control\ComboBox.h
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\FolderInterface.h
+SOURCE=..\..\..\Windows\Control\Dialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\FormatUtils.cpp
+SOURCE=..\..\..\Windows\Control\Dialog.h
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\FormatUtils.h
+SOURCE=..\..\..\Windows\Control\Edit.h
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\HelpUtils.cpp
+SOURCE=..\..\..\Windows\Control\ListView.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\HelpUtils.h
+SOURCE=..\..\..\Windows\Control\ListView.h
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\LangUtils.cpp
+SOURCE=..\..\..\Windows\Control\ProgressBar.h
# End Source File
+# End Group
# Begin Source File
-SOURCE=..\..\FileManager\LangUtils.h
+SOURCE=..\..\..\Windows\CommonDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\OpenCallback.cpp
+SOURCE=..\..\..\Windows\CommonDialog.h
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\OpenCallback.h
+SOURCE=..\..\..\Windows\DLL.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\ProgramLocation.cpp
+SOURCE=..\..\..\Windows\DLL.h
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\ProgramLocation.h
+SOURCE=..\..\..\Windows\Error.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\RegistryUtils.cpp
+SOURCE=..\..\..\Windows\Error.h
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\RegistryUtils.h
+SOURCE=..\..\..\Windows\FileDir.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\SplitUtils.cpp
+SOURCE=..\..\..\Windows\FileDir.h
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\SplitUtils.h
+SOURCE=..\..\..\Windows\FileFind.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\StringUtils.cpp
+SOURCE=..\..\..\Windows\FileFind.h
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\StringUtils.h
+SOURCE=..\..\..\Windows\FileIO.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\UpdateCallback100.cpp
+SOURCE=..\..\..\Windows\FileIO.h
# End Source File
# Begin Source File
-SOURCE=..\..\FileManager\UpdateCallback100.h
+SOURCE=..\..\..\Windows\FileName.cpp
# End Source File
-# End Group
-# Begin Group "Engine"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\ExtractGUI.cpp
+SOURCE=..\..\..\Windows\FileName.h
# End Source File
# Begin Source File
-SOURCE=.\ExtractGUI.h
+SOURCE=..\..\..\Windows\MemoryLock.cpp
# End Source File
# Begin Source File
-SOURCE=.\GUI.cpp
+SOURCE=..\..\..\Windows\MemoryLock.h
# End Source File
# Begin Source File
-SOURCE=.\OpenCallbackGUI.cpp
+SOURCE=..\..\..\Windows\PropVariant.cpp
# End Source File
# Begin Source File
-SOURCE=.\OpenCallbackGUI.h
+SOURCE=..\..\..\Windows\PropVariant.h
# End Source File
# Begin Source File
-SOURCE=.\UpdateCallbackGUI.cpp
+SOURCE=..\..\..\Windows\PropVariantConversions.cpp
# End Source File
# Begin Source File
-SOURCE=.\UpdateCallbackGUI.h
+SOURCE=..\..\..\Windows\PropVariantConversions.h
# End Source File
# Begin Source File
-SOURCE=.\UpdateGUI.cpp
+SOURCE=..\..\..\Windows\Registry.cpp
# End Source File
# Begin Source File
-SOURCE=.\UpdateGUI.h
+SOURCE=..\..\..\Windows\Registry.h
# End Source File
-# End Group
-# Begin Group "7-zip Common"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\Common\FilePathAutoRename.cpp
+SOURCE=..\..\..\Windows\ResourceString.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\Common\FilePathAutoRename.h
+SOURCE=..\..\..\Windows\ResourceString.h
# End Source File
# Begin Source File
-SOURCE=..\..\Common\FileStreams.cpp
+SOURCE=..\..\..\Windows\Shell.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\Common\FileStreams.h
+SOURCE=..\..\..\Windows\Shell.h
# End Source File
# Begin Source File
-SOURCE=..\..\Common\StreamUtils.cpp
+SOURCE=..\..\..\Windows\Synchronization.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\Common\StreamUtils.h
+SOURCE=..\..\..\Windows\Synchronization.h
# End Source File
-# End Group
-# Begin Group "Compress"
+# Begin Source File
-# PROP Default_Filter ""
+SOURCE=..\..\..\Windows\System.h
+# End Source File
# Begin Source File
-SOURCE=..\..\Compress\Copy\CopyCoder.cpp
+SOURCE=..\..\..\Windows\Window.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\Compress\Copy\CopyCoder.h
+SOURCE=..\..\..\Windows\Window.h
# End Source File
# End Group
# End Target
diff --git a/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.cpp b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.cpp
new file mode 100755
index 00000000..15d6ee39
--- /dev/null
+++ b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.cpp
@@ -0,0 +1,584 @@
+// BenchmarkDialog.cpp
+
+#include "StdAfx.h"
+
+#include "Common/IntToString.h"
+#include "Common/StringToInt.h"
+#include "Common/Exception.h"
+#include "Windows/Thread.h"
+#include "Windows/Error.h"
+#include "Windows/System.h"
+#include "../../../../FileManager/HelpUtils.h"
+#include "resource.h"
+#include "BenchmarkDialog.h"
+
+using namespace NWindows;
+
+// const int kNumBenchDictionaryBitsStart = 21;
+
+static LPCWSTR kHelpTopic = L"fm/benchmark.htm";
+
+static const UINT_PTR kTimerID = 4;
+static const UINT kTimerElapse = 1000;
+
+#ifdef LANG
+#include "../../../../FileManager/LangUtils.h"
+#endif
+
+using namespace NWindows;
+
+#ifdef LANG
+static CIDLangPair kIDLangPairs[] =
+{
+ { IDC_BENCHMARK_DICTIONARY, 0x02000D0C },
+ { IDC_BENCHMARK_MEMORY, 0x03080001 },
+ { IDC_BENCHMARK_NUM_THREADS, 0x02000D12 },
+ { IDC_BENCHMARK_SPEED_LABEL, 0x03080004 },
+ { IDC_BENCHMARK_RATING_LABEL, 0x03080005 },
+ { IDC_BENCHMARK_COMPRESSING, 0x03080002 },
+ { IDC_BENCHMARK_DECOMPRESSING, 0x03080003 },
+ { IDC_BENCHMARK_CURRENT, 0x03080007 },
+ { IDC_BENCHMARK_RESULTING, 0x03080008 },
+ { IDC_BENCHMARK_CURRENT2, 0x03080007 },
+ { IDC_BENCHMARK_RESULTING2, 0x03080008 },
+ { IDC_BENCHMARK_TOTAL_RATING, 0x03080006 },
+ { IDC_BENCHMARK_ELAPSED, 0x02000C01 },
+ { IDC_BENCHMARK_SIZE, 0x02000C03 },
+ { IDC_BENCHMARK_PASSES, 0x03080009 },
+ // { IDC_BENCHMARK_ERRORS, 0x0308000A },
+ { IDC_BENCHMARK_USAGE_LABEL, 0x0308000B },
+ { IDC_BENCHMARK_RPU_LABEL, 0x0308000C },
+ { IDC_BENCHMARK_COMBO_NUM_THREADS, 0x02000D12},
+
+ { IDC_BUTTON_STOP, 0x02000714 },
+ { IDC_BUTTON_RESTART, 0x02000715 },
+ { IDHELP, 0x02000720 },
+ { IDCANCEL, 0x02000710 }
+};
+#endif
+
+static void MyMessageBoxError(HWND hwnd, LPCWSTR message)
+{
+ MessageBoxW(hwnd, message, L"7-Zip", MB_ICONERROR);
+}
+
+const LPCTSTR kProcessingString = TEXT("...");
+const LPCTSTR kMB = TEXT(" MB");
+const LPCTSTR kMIPS = TEXT(" MIPS");
+const LPCTSTR kKBs = TEXT(" KB/s");
+
+static const int kMinDicLogSize = 21;
+static const UInt32 kMinDicSize = (1 << kMinDicLogSize);
+static const UInt32 kMaxDicSize =
+ #ifdef _WIN64
+ (1 << 30);
+ #else
+ (1 << 27);
+ #endif
+
+static const int kDefaultDictionary = 22;
+
+bool CBenchmarkDialog::OnInit()
+{
+ #ifdef LANG
+ LangSetWindowText(HWND(*this), 0x03080000);
+ LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
+ #endif
+
+ _syncInfo.Init();
+
+ m_Dictionary.Attach(GetItem(IDC_BENCHMARK_COMBO_DICTIONARY));
+ int cur = 0;
+ // _syncInfo.DictionarySize = (1 << kNumBenchDictionaryBitsStart);
+
+ UInt32 numCPUs = NSystem::GetNumberOfProcessors();
+ if (numCPUs < 1)
+ numCPUs = 1;
+ numCPUs = MyMin(numCPUs, (UInt32)(1 << 8));
+ cur = 0;
+ bool setDefaultThreads = (_syncInfo.NumThreads == (UInt32)(-1));
+ if (setDefaultThreads)
+ {
+ _syncInfo.NumThreads = numCPUs;
+ if (_syncInfo.NumThreads > 1)
+ _syncInfo.NumThreads &= ~1;
+ }
+
+ UInt64 ramSize = NSystem::GetRamSize();
+ bool setDefaultDictionary = (_syncInfo.DictionarySize == (UInt32)(-1));
+ if (setDefaultDictionary)
+ {
+ int dicSizeLog;
+ for (dicSizeLog = 25; dicSizeLog >= kBenchMinDicLogSize; dicSizeLog--)
+ if (GetBenchMemoryUsage(_syncInfo.NumThreads, ((UInt32)1 << dicSizeLog)) + (8 << 20) <= ramSize)
+ break;
+ _syncInfo.DictionarySize = (1 << dicSizeLog);
+ }
+ if (_syncInfo.DictionarySize < kMinDicSize)
+ _syncInfo.DictionarySize = kMinDicSize;
+ if (_syncInfo.DictionarySize > kMaxDicSize)
+ _syncInfo.DictionarySize = kMaxDicSize;
+
+ for (int i = kMinDicLogSize; i <= 30; i++)
+ for (int j = 0; j < 2; j++)
+ {
+ UInt32 dictionary = (1 << i) + (j << (i - 1));
+ if (dictionary > kMaxDicSize)
+ continue;
+ TCHAR s[40];
+ ConvertUInt64ToString((dictionary >> 20), s);
+ lstrcat(s, kMB);
+ int index = (int)m_Dictionary.AddString(s);
+ m_Dictionary.SetItemData(index, dictionary);
+ if (dictionary <= _syncInfo.DictionarySize)
+ cur = index;
+ }
+ m_Dictionary.SetCurSel(cur);
+
+ m_NumThreads.Attach(GetItem(IDC_BENCHMARK_COMBO_NUM_THREADS));
+ for (UInt32 num = 1; ;)
+ {
+ if (num > numCPUs * 2)
+ break;
+ TCHAR s[40];
+ ConvertUInt64ToString(num, s);
+ int index = (int)m_NumThreads.AddString(s);
+ m_NumThreads.SetItemData(index, num);
+ if (num <= numCPUs && setDefaultThreads)
+ {
+ _syncInfo.NumThreads = num;
+ cur = index;
+ }
+ if (num > 1)
+ num++;
+ num++;
+ }
+ m_NumThreads.SetCurSel(cur);
+
+ OnChangeSettings();
+
+ _syncInfo._startEvent.Set();
+ _timer = SetTimer(kTimerID, kTimerElapse);
+ return CModalDialog::OnInit();
+}
+
+UInt32 CBenchmarkDialog::GetNumberOfThreads()
+{
+ return (UInt32)m_NumThreads.GetItemData(m_NumThreads.GetCurSel());
+}
+
+UInt32 CBenchmarkDialog::OnChangeDictionary()
+{
+ UInt32 dictionary = (UInt32)m_Dictionary.GetItemData(m_Dictionary.GetCurSel());
+ UInt64 memUsage = GetBenchMemoryUsage(GetNumberOfThreads(), dictionary);
+ memUsage = (memUsage + (1 << 20) - 1) >> 20;
+ TCHAR s[40];
+ ConvertUInt64ToString(memUsage, s);
+ lstrcat(s, kMB);
+ SetItemText(IDC_BENCHMARK_MEMORY_VALUE, s);
+ return dictionary;
+}
+
+static const UInt32 g_IDs[] =
+{
+ IDC_BENCHMARK_COMPRESSING_USAGE,
+ IDC_BENCHMARK_COMPRESSING_USAGE2,
+ IDC_BENCHMARK_COMPRESSING_SPEED,
+ IDC_BENCHMARK_COMPRESSING_SPEED2,
+ IDC_BENCHMARK_COMPRESSING_RATING,
+ IDC_BENCHMARK_COMPRESSING_RATING2,
+ IDC_BENCHMARK_COMPRESSING_RPU,
+ IDC_BENCHMARK_COMPRESSING_RPU2,
+
+ IDC_BENCHMARK_DECOMPRESSING_SPEED,
+ IDC_BENCHMARK_DECOMPRESSING_SPEED2,
+ IDC_BENCHMARK_DECOMPRESSING_RATING,
+ IDC_BENCHMARK_DECOMPRESSING_RATING2,
+ IDC_BENCHMARK_DECOMPRESSING_USAGE,
+ IDC_BENCHMARK_DECOMPRESSING_USAGE2,
+ IDC_BENCHMARK_DECOMPRESSING_RPU,
+ IDC_BENCHMARK_DECOMPRESSING_RPU2,
+
+ IDC_BENCHMARK_TOTAL_USAGE_VALUE,
+ IDC_BENCHMARK_TOTAL_RATING_VALUE,
+ IDC_BENCHMARK_TOTAL_RPU_VALUE
+};
+
+void CBenchmarkDialog::OnChangeSettings()
+{
+ EnableItem(IDC_BUTTON_STOP, true);
+ UInt32 dictionary = OnChangeDictionary();
+ TCHAR s[40] = { TEXT('/'), TEXT(' '), 0 };
+ ConvertUInt64ToString(NSystem::GetNumberOfProcessors(), s + 2);
+ SetItemText(IDC_BENCHMARK_HARDWARE_THREADS, s);
+ for (int i = 0; i < sizeof(g_IDs) / sizeof(g_IDs[0]); i++)
+ SetItemText(g_IDs[i], kProcessingString);
+ _startTime = GetTickCount();
+ PrintTime();
+ NWindows::NSynchronization::CCriticalSectionLock lock(_syncInfo.CS);
+ _syncInfo.Init();
+ _syncInfo.DictionarySize = dictionary;
+ _syncInfo.Changed = true;
+ _syncInfo.NumThreads = GetNumberOfThreads();
+}
+
+void CBenchmarkDialog::OnRestartButton()
+{
+ OnChangeSettings();
+}
+
+void CBenchmarkDialog::OnStopButton()
+{
+ EnableItem(IDC_BUTTON_STOP, false);
+ _syncInfo.Pause();
+}
+
+void CBenchmarkDialog::OnHelp()
+{
+ ShowHelpWindow(NULL, kHelpTopic);
+}
+
+void CBenchmarkDialog::OnCancel()
+{
+ _syncInfo.Stop();
+ KillTimer(_timer);
+ CModalDialog::OnCancel();
+}
+
+static void GetTimeString(UInt64 timeValue, TCHAR *s)
+{
+ wsprintf(s, TEXT("%02d:%02d:%02d"),
+ UInt32(timeValue / 3600),
+ UInt32((timeValue / 60) % 60),
+ UInt32(timeValue % 60));
+}
+
+void CBenchmarkDialog::PrintTime()
+{
+ UInt32 curTime = ::GetTickCount();
+ UInt32 elapsedTime = (curTime - _startTime);
+ UInt32 elapsedSec = elapsedTime / 1000;
+ if (elapsedSec != 0 && _syncInfo.WasPaused())
+ return;
+ TCHAR s[40];
+ GetTimeString(elapsedSec, s);
+ SetItemText(IDC_BENCHMARK_ELAPSED_VALUE, s);
+}
+
+void CBenchmarkDialog::PrintRating(UInt64 rating, UINT controlID)
+{
+ TCHAR s[40];
+ ConvertUInt64ToString(rating / 1000000, s);
+ lstrcat(s, kMIPS);
+ SetItemText(controlID, s);
+}
+
+void CBenchmarkDialog::PrintUsage(UInt64 usage, UINT controlID)
+{
+ TCHAR s[40];
+ ConvertUInt64ToString((usage + 5000) / 10000, s);
+ lstrcat(s, TEXT("%"));
+ SetItemText(controlID, s);
+}
+
+void CBenchmarkDialog::PrintResults(
+ UInt32 dictionarySize,
+ const CBenchInfo2 &info,
+ UINT usageID, UINT speedID, UINT rpuID, UINT ratingID,
+ bool decompressMode)
+{
+ if (info.GlobalTime == 0)
+ return;
+
+ UInt64 size = info.UnpackSize;
+ TCHAR s[40];
+ {
+ UInt64 speed = size * info.GlobalFreq / info.GlobalTime;
+ ConvertUInt64ToString(speed / 1024, s);
+ lstrcat(s, kKBs);
+ SetItemText(speedID, s);
+ }
+ UInt64 rating;
+ if (decompressMode)
+ rating = GetDecompressRating(info.GlobalTime, info.GlobalFreq, size, info.PackSize, 1);
+ else
+ rating = GetCompressRating(dictionarySize, info.GlobalTime, info.GlobalFreq, size * info.NumIterations);
+
+ PrintRating(rating, ratingID);
+ PrintRating(GetRatingPerUsage(info, rating), rpuID);
+ PrintUsage(GetUsage(info), usageID);
+}
+
+bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
+{
+ PrintTime();
+ NWindows::NSynchronization::CCriticalSectionLock lock(_syncInfo.CS);
+
+ TCHAR s[40];
+ ConvertUInt64ToString((_syncInfo.ProcessedSize >> 20), s);
+ lstrcat(s, kMB);
+ SetItemText(IDC_BENCHMARK_SIZE_VALUE, s);
+
+ ConvertUInt64ToString(_syncInfo.NumPasses, s);
+ SetItemText(IDC_BENCHMARK_PASSES_VALUE, s);
+
+ /*
+ ConvertUInt64ToString(_syncInfo.NumErrors, s);
+ SetItemText(IDC_BENCHMARK_ERRORS_VALUE, s);
+ */
+
+ {
+ UInt32 dicSizeTemp = (UInt32)MyMax(_syncInfo.ProcessedSize, UInt64(1) << 20);
+ dicSizeTemp = MyMin(dicSizeTemp, _syncInfo.DictionarySize),
+ PrintResults(dicSizeTemp,
+ _syncInfo.CompressingInfoTemp,
+ IDC_BENCHMARK_COMPRESSING_USAGE,
+ IDC_BENCHMARK_COMPRESSING_SPEED,
+ IDC_BENCHMARK_COMPRESSING_RPU,
+ IDC_BENCHMARK_COMPRESSING_RATING);
+ }
+
+ {
+ PrintResults(
+ _syncInfo.DictionarySize,
+ _syncInfo.CompressingInfo,
+ IDC_BENCHMARK_COMPRESSING_USAGE2,
+ IDC_BENCHMARK_COMPRESSING_SPEED2,
+ IDC_BENCHMARK_COMPRESSING_RPU2,
+ IDC_BENCHMARK_COMPRESSING_RATING2);
+ }
+
+ {
+ PrintResults(
+ _syncInfo.DictionarySize,
+ _syncInfo.DecompressingInfoTemp,
+ IDC_BENCHMARK_DECOMPRESSING_USAGE,
+ IDC_BENCHMARK_DECOMPRESSING_SPEED,
+ IDC_BENCHMARK_DECOMPRESSING_RPU,
+ IDC_BENCHMARK_DECOMPRESSING_RATING,
+ true);
+ }
+ {
+ PrintResults(
+ _syncInfo.DictionarySize,
+ _syncInfo.DecompressingInfo,
+ IDC_BENCHMARK_DECOMPRESSING_USAGE2,
+ IDC_BENCHMARK_DECOMPRESSING_SPEED2,
+ IDC_BENCHMARK_DECOMPRESSING_RPU2,
+ IDC_BENCHMARK_DECOMPRESSING_RATING2,
+ true);
+ if (_syncInfo.DecompressingInfo.GlobalTime > 0 &&
+ _syncInfo.CompressingInfo.GlobalTime > 0)
+ {
+ UInt64 comprRating = GetCompressRating(_syncInfo.DictionarySize,
+ _syncInfo.CompressingInfo.GlobalTime, _syncInfo.CompressingInfo.GlobalFreq, _syncInfo.CompressingInfo.UnpackSize);
+ UInt64 decomprRating = GetDecompressRating(_syncInfo.DecompressingInfo.GlobalTime,
+ _syncInfo.DecompressingInfo.GlobalFreq, _syncInfo.DecompressingInfo.UnpackSize,
+ _syncInfo.DecompressingInfo.PackSize, 1);
+ PrintRating((comprRating + decomprRating) / 2, IDC_BENCHMARK_TOTAL_RATING_VALUE);
+ PrintRating((
+ GetRatingPerUsage(_syncInfo.CompressingInfo, comprRating) +
+ GetRatingPerUsage(_syncInfo.DecompressingInfo, decomprRating)) / 2, IDC_BENCHMARK_TOTAL_RPU_VALUE);
+ PrintUsage((GetUsage(_syncInfo.CompressingInfo) + GetUsage(_syncInfo.DecompressingInfo)) / 2, IDC_BENCHMARK_TOTAL_USAGE_VALUE);
+ }
+ }
+ return true;
+}
+
+bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam)
+{
+ if (code == CBN_SELCHANGE &&
+ (itemID == IDC_BENCHMARK_COMBO_DICTIONARY ||
+ itemID == IDC_BENCHMARK_COMBO_NUM_THREADS))
+ {
+ OnChangeSettings();
+ return true;
+ }
+ return CModalDialog::OnCommand(code, itemID, lParam);
+}
+
+bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+{
+ switch(buttonID)
+ {
+ case IDC_BUTTON_RESTART:
+ OnRestartButton();
+ return true;
+ case IDC_BUTTON_STOP:
+ OnStopButton();
+ return true;
+ }
+ return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
+}
+
+struct CThreadBenchmark
+{
+ CProgressSyncInfo *SyncInfo;
+ UInt64 _startTime;
+ #ifdef EXTERNAL_LZMA
+ CCodecs *codecs;
+ #endif
+ // UInt32 dictionarySize;
+ // UInt32 numThreads;
+
+ HRESULT Process();
+ HRESULT Result;
+ static DWORD WINAPI MyThreadFunction(void *param)
+ {
+ ((CThreadBenchmark *)param)->Result = ((CThreadBenchmark *)param)->Process();
+ return 0;
+ }
+};
+
+struct CBenchCallback: public IBenchCallback
+{
+ UInt32 dictionarySize;
+ CProgressSyncInfo *SyncInfo;
+ HRESULT SetEncodeResult(const CBenchInfo &info, bool final);
+ HRESULT SetDecodeResult(const CBenchInfo &info, bool final);
+};
+
+HRESULT CBenchCallback::SetEncodeResult(const CBenchInfo &info, bool final)
+{
+ NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
+ if (SyncInfo->Changed || SyncInfo->Paused || SyncInfo->Stopped)
+ return E_ABORT;
+ SyncInfo->ProcessedSize = info.UnpackSize;
+ if (final && SyncInfo->CompressingInfo.GlobalTime == 0)
+ {
+ (CBenchInfo&)SyncInfo->CompressingInfo = info;
+ if (SyncInfo->CompressingInfo.GlobalTime == 0)
+ SyncInfo->CompressingInfo.GlobalTime = 1;
+ }
+ else
+ (CBenchInfo&)SyncInfo->CompressingInfoTemp = info;
+
+ return S_OK;
+}
+
+HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
+{
+ NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
+ if (SyncInfo->Changed || SyncInfo->Paused || SyncInfo->Stopped)
+ return E_ABORT;
+ CBenchInfo info2 = info;
+ if (info2.NumIterations == 0)
+ info2.NumIterations = 1;
+
+ info2.GlobalTime /= info2.NumIterations;
+ info2.UserTime /= info2.NumIterations;
+
+ if (final && SyncInfo->DecompressingInfo.GlobalTime == 0)
+ {
+ (CBenchInfo&)SyncInfo->DecompressingInfo = info2;
+ if (SyncInfo->DecompressingInfo.GlobalTime == 0)
+ SyncInfo->DecompressingInfo.GlobalTime = 1;
+ }
+ else
+ (CBenchInfo&)SyncInfo->DecompressingInfoTemp = info2;
+ return S_OK;
+}
+
+HRESULT CThreadBenchmark::Process()
+{
+ try
+ {
+ SyncInfo->WaitCreating();
+ for (;;)
+ {
+ if (SyncInfo->WasStopped())
+ return 0;
+ if (SyncInfo->WasPaused())
+ {
+ Sleep(200);
+ continue;
+ }
+ UInt32 dictionarySize;
+ UInt32 numThreads;
+ {
+ NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
+ if (SyncInfo->Stopped || SyncInfo->Paused)
+ continue;
+ if (SyncInfo->Changed)
+ SyncInfo->Init();
+ dictionarySize = SyncInfo->DictionarySize;
+ numThreads = SyncInfo->NumThreads;
+ }
+
+ CBenchCallback callback;
+ callback.dictionarySize = dictionarySize;
+ callback.SyncInfo = SyncInfo;
+ HRESULT result;
+ try
+ {
+ result = LzmaBench(
+ #ifdef EXTERNAL_LZMA
+ codecs,
+ #endif
+ numThreads, dictionarySize, &callback);
+ }
+ catch(...)
+ {
+ result = E_FAIL;
+ }
+
+ if (result != S_OK)
+ {
+ if (result != E_ABORT)
+ {
+ // SyncInfo->NumErrors++;
+ {
+ NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
+ SyncInfo->Pause();
+ }
+ CSysString message;
+ if (result == S_FALSE)
+ message = TEXT("Decoding error");
+ else
+ message = NError::MyFormatMessage(result);
+ MessageBox(0, message, TEXT("7-Zip"), MB_ICONERROR);
+ }
+ }
+ else
+ {
+ NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
+ SyncInfo->NumPasses++;
+ }
+ }
+ // return S_OK;
+ }
+ catch(CSystemException &e)
+ {
+ MessageBox(0, NError::MyFormatMessage(e.ErrorCode), TEXT("7-Zip"), MB_ICONERROR);
+ return E_FAIL;
+ }
+ catch(...)
+ {
+ MyMessageBoxError(0, L"Some error");
+ return E_FAIL;
+ }
+}
+
+HRESULT Benchmark(
+ #ifdef EXTERNAL_LZMA
+ CCodecs *codecs,
+ #endif
+ UInt32 numThreads, UInt32 dictionarySize)
+{
+ CThreadBenchmark benchmarker;
+ #ifdef EXTERNAL_LZMA
+ benchmarker.codecs = codecs;
+ #endif
+
+ CBenchmarkDialog benchmarkDialog;
+ benchmarkDialog._syncInfo.DictionarySize = dictionarySize;
+ benchmarkDialog._syncInfo.NumThreads = numThreads;
+
+ benchmarker.SyncInfo = &benchmarkDialog._syncInfo;
+ CThread thread;
+ if (!thread.Create(CThreadBenchmark::MyThreadFunction, &benchmarker))
+ return E_FAIL;
+ benchmarkDialog.Create(0);
+ thread.Wait();
+ return S_OK;
+}
diff --git a/CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.h b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.h
index 244e7fe5..716d0f55 100755
--- a/CPP/7zip/FileManager/Resource/BenchmarkDialog/BenchmarkDialog.h
+++ b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.h
@@ -5,54 +5,45 @@
#include "resource.h"
-#include "Common/MyCom.h"
#include "Windows/Control/Dialog.h"
#include "Windows/Control/ComboBox.h"
#include "Windows/Synchronization.h"
-#include "../../../ICoder.h"
+#include "../../../../Compress/LZMA_Alone/LzmaBench.h"
-const int kNumBenchDictionaryBitsStart = 21;
+#ifdef EXTERNAL_LZMA
+#include "../../../../UI/Common/LoadCodecs.h"
+#endif
-struct CProgressInfo
+struct CBenchInfo2 : public CBenchInfo
{
- UINT64 InSize;
- UINT64 OutSize;
- UINT64 Time;
- void Init()
- {
- InSize = 0;
- OutSize = 0;
- Time = 0;
- }
+ void Init() { GlobalTime = UserTime = 0; }
};
class CProgressSyncInfo
{
+public:
bool Stopped;
bool Paused;
-public:
bool Changed;
- UINT32 DictionarySize;
- bool MultiThread;
- UINT64 NumPasses;
- UINT64 NumErrors;
+ UInt32 DictionarySize;
+ UInt32 NumThreads;
+ UInt64 NumPasses;
+ // UInt64 NumErrors;
NWindows::NSynchronization::CManualResetEvent _startEvent;
NWindows::NSynchronization::CCriticalSection CS;
- CProgressInfo ApprovedInfo;
- CProgressInfo CompressingInfoPrev;
- CProgressInfo CompressingInfoTemp;
- CProgressInfo CompressingInfo;
- UINT64 ProcessedSize;
+ CBenchInfo2 CompressingInfoTemp;
+ CBenchInfo2 CompressingInfo;
+ UInt64 ProcessedSize;
- CProgressInfo DecompressingInfoTemp;
- CProgressInfo DecompressingInfo;
+ CBenchInfo2 DecompressingInfoTemp;
+ CBenchInfo2 DecompressingInfo;
void Init()
{
Changed = false;
- ApprovedInfo.Init();
- CompressingInfoPrev.Init();
+ Stopped = false;
+ Paused = false;
CompressingInfoTemp.Init();
CompressingInfo.Init();
ProcessedSize = 0;
@@ -60,15 +51,8 @@ public:
DecompressingInfoTemp.Init();
DecompressingInfo.Init();
- Stopped = false;
- Paused = false;
NumPasses = 0;
- NumErrors = 0;
- }
- void InitSettings()
- {
- DictionarySize = (1 << kNumBenchDictionaryBitsStart);
- MultiThread = false;
+ // NumErrors = 0;
}
void Stop()
{
@@ -102,6 +86,7 @@ class CBenchmarkDialog:
public NWindows::NControl::CModalDialog
{
NWindows::NControl::CComboBox m_Dictionary;
+ NWindows::NControl::CComboBox m_NumThreads;
UINT_PTR _timer;
UINT32 _startTime;
@@ -115,14 +100,15 @@ class CBenchmarkDialog:
bool OnCommand(int code, int itemID, LPARAM lParam);
void PrintTime();
- void PrintRating(UINT64 rating, UINT controlID);
+ void PrintRating(UInt64 rating, UINT controlID);
+ void PrintUsage(UInt64 usage, UINT controlID);
void PrintResults(
UINT32 dictionarySize,
- UINT64 elapsedTime,
- UINT64 size, UINT speedID, UINT ratingID,
- bool decompressMode = false, UINT64 secondSize = 0);
+ const CBenchInfo2 &info, UINT usageID, UINT speedID, UINT rpuID, UINT ratingID,
+ bool decompressMode = false);
- UINT32 OnChangeDictionary();
+ UInt32 GetNumberOfThreads();
+ UInt32 OnChangeDictionary();
void OnChangeSettings();
public:
CProgressSyncInfo _syncInfo;
@@ -131,6 +117,10 @@ public:
INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_BENCHMARK, wndParent); }
};
-void Benchmark(HWND hwnd);
+HRESULT Benchmark(
+ #ifdef EXTERNAL_LZMA
+ CCodecs *codecs,
+ #endif
+ UInt32 dictionarySize, UInt32 numThreads);
#endif
diff --git a/CPP/7zip/FileManager/Resource/BenchmarkDialog/StdAfx.h b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/StdAfx.h
index a444ca31..a444ca31 100755
--- a/CPP/7zip/FileManager/Resource/BenchmarkDialog/StdAfx.h
+++ b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/StdAfx.h
diff --git a/CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.h b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/resource.h
index d720058d..6ef52188 100755
--- a/CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.h
+++ b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/resource.h
@@ -5,7 +5,10 @@
#define IDC_BENCHMARK_COMBO_DICTIONARY 1011
#define IDC_BENCHMARK_MEMORY 1012
#define IDC_BENCHMARK_MEMORY_VALUE 1013
-#define IDC_BENCHMARK_MULTITHREADING 1014
+#define IDC_BENCHMARK_NUM_THREADS 1014
+#define IDC_BENCHMARK_COMBO_NUM_THREADS 1015
+#define IDC_BENCHMARK_HARDWARE_THREADS 1016
+
#define IDC_BENCHMARK_SPEED_LABEL 1020
#define IDC_BENCHMARK_RATING_LABEL 1021
#define IDC_BENCHMARK_COMPRESSING 1022
@@ -14,21 +17,38 @@
#define IDC_BENCHMARK_RESULTING 1025
#define IDC_BENCHMARK_CURRENT2 1026
#define IDC_BENCHMARK_RESULTING2 1027
+#define IDC_BENCHMARK_USAGE_LABEL 1028
+#define IDC_BENCHMARK_RPU_LABEL 1029
+
#define IDC_BENCHMARK_COMPRESSING_SPEED 1030
#define IDC_BENCHMARK_COMPRESSING_SPEED2 1031
#define IDC_BENCHMARK_COMPRESSING_RATING 1032
#define IDC_BENCHMARK_COMPRESSING_RATING2 1033
+#define IDC_BENCHMARK_COMPRESSING_USAGE 1034
+#define IDC_BENCHMARK_COMPRESSING_USAGE2 1035
+#define IDC_BENCHMARK_COMPRESSING_RPU 1036
+#define IDC_BENCHMARK_COMPRESSING_RPU2 1037
+
+
#define IDC_BENCHMARK_DECOMPRESSING_SPEED 1040
#define IDC_BENCHMARK_DECOMPRESSING_SPEED2 1041
#define IDC_BENCHMARK_DECOMPRESSING_RATING 1042
#define IDC_BENCHMARK_DECOMPRESSING_RATING2 1043
+#define IDC_BENCHMARK_DECOMPRESSING_USAGE 1044
+#define IDC_BENCHMARK_DECOMPRESSING_USAGE2 1045
+#define IDC_BENCHMARK_DECOMPRESSING_RPU 1046
+#define IDC_BENCHMARK_DECOMPRESSING_RPU2 1047
+
+
#define IDC_BENCHMARK_TOTAL_RATING 1050
+
#define IDC_BENCHMARK_TOTAL_RATING_VALUE 1051
+#define IDC_BENCHMARK_TOTAL_RPU_VALUE 1052
+#define IDC_BENCHMARK_TOTAL_USAGE_VALUE 1053
+
#define IDC_BENCHMARK_ELAPSED 1060
#define IDC_BENCHMARK_ELAPSED_VALUE 1061
#define IDC_BENCHMARK_SIZE 1062
#define IDC_BENCHMARK_SIZE_VALUE 1063
-#define IDC_BENCHMARK_ERRORS 1064
-#define IDC_BENCHMARK_ERRORS_VALUE 1065
#define IDC_BENCHMARK_PASSES 1066
#define IDC_BENCHMARK_PASSES_VALUE 1067
diff --git a/CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.rc b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/resource.rc
index 5ab220e5..43b59be8 100755
--- a/CPP/7zip/FileManager/Resource/BenchmarkDialog/resource.rc
+++ b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/resource.rc
@@ -1,12 +1,19 @@
#include "resource.h"
-#include "../../../GuiCommon.rc"
+#include "../../../../GuiCommon.rc"
-#define xSize2 210
+#define xSize2 330
#define ySize2 228
#define xSize (xSize2 + marg + marg)
#define ySize (ySize2 + marg + marg)
+#undef g0XSize
+#undef g1XPos
+#undef g1XSize
+#undef g2XSize
+#undef g3XPos
+#undef g3XSize
+
#define bXPos1 (xSize - marg - bXSize)
#define bXPos2 (bXPos1 - 10 - bXSize)
@@ -15,17 +22,26 @@
#define gSize 160
#define gSpace 24
-#define g0XSize 75
+#define g0XSize 90
#define g1XSize 44
#define g1XPos (marg + g0XSize)
+#define gc2XPos (g1XPos + g1XSize + 10)
+#define gc2XSize 80
#define g10XPos (marg + marg)
-#define gRatingSize 51
-#define gSpeedSize 64
+
+#define gRatingSize 60
+#define gSpeedSize 60
+#define gUsageSize 60
+#define gRpuSize 60
+
#define gRatingPos (xSize - marg - marg - gRatingSize)
-#define gSpeedPos (gRatingPos - gSpeedSize)
-#define gLabelSize (gSpeedPos - g10XPos)
-#define gTotalRatingSize (gRatingSize + marg + marg)
+#define gRpuPos (gRatingPos - gRpuSize)
+#define gUsagePos (gRpuPos - gUsageSize)
+#define gSpeedPos (gUsagePos - gSpeedSize)
+
+#define gLabelSize (gUsagePos - g10XPos)
+#define gTotalRatingSize (gUsageSize + gRpuSize + gRatingSize + marg + marg)
#define gTotalRatingPos (xSize - marg - gTotalRatingSize)
#define g2XSize 58
@@ -45,43 +61,56 @@ BEGIN
LTEXT "&Dictionary size:", IDC_BENCHMARK_DICTIONARY, marg, marg + 1, g0XSize, 8
COMBOBOX IDC_BENCHMARK_COMBO_DICTIONARY, g1XPos, marg, g1XSize, 140, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "Memory usage:", IDC_BENCHMARK_MEMORY, marg, 25, g0XSize, 8
- LTEXT "0 MB", IDC_BENCHMARK_MEMORY_VALUE, g1XPos,25,g1XSize,8
- CONTROL "Multi-threading", IDC_BENCHMARK_MULTITHREADING, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
- marg, 41, g0XSize, 10
- RTEXT "Speed", IDC_BENCHMARK_SPEED_LABEL, gSpeedPos, 53, gSpeedSize, 8
+ LTEXT "&Number of CPU threads:", IDC_BENCHMARK_NUM_THREADS, marg, 24, g0XSize, 8
+ COMBOBOX IDC_BENCHMARK_COMBO_NUM_THREADS, g1XPos, 23, g1XSize, 140, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+
+ LTEXT "Memory usage:", IDC_BENCHMARK_MEMORY, gc2XPos, marg + 1, gc2XSize, 8
+ LTEXT "0 MB", IDC_BENCHMARK_MEMORY_VALUE, gc2XPos + gc2XSize, marg + 1, 40, 8
+ LTEXT "1", IDC_BENCHMARK_HARDWARE_THREADS, gc2XPos, 24, 40, 8
+
+ RTEXT "CPU Usage", IDC_BENCHMARK_USAGE_LABEL, gUsagePos, 53, gUsageSize, 8
+ RTEXT "Speed", IDC_BENCHMARK_SPEED_LABEL, gSpeedPos, 53, gSpeedSize, 8
+ RTEXT "Rating / Usage", IDC_BENCHMARK_RPU_LABEL, gRpuPos, 53, gRpuSize, 8
RTEXT "Rating", IDC_BENCHMARK_RATING_LABEL, gRatingPos, 53, gRatingSize, 8
GROUPBOX "Compressing", IDC_BENCHMARK_COMPRESSING, marg, 64, xSize2, 40
- LTEXT "Current", IDC_BENCHMARK_CURRENT, g10XPos, 76, gLabelSize, 8
- RTEXT "100 KB/s", IDC_BENCHMARK_COMPRESSING_SPEED, gSpeedPos, 76, gSpeedSize, 8
+ LTEXT "Current", IDC_BENCHMARK_CURRENT, g10XPos, 76, gLabelSize, 8
+ RTEXT "100%", IDC_BENCHMARK_COMPRESSING_USAGE, gUsagePos, 76, gUsageSize, 8
+ RTEXT "100 KB/s", IDC_BENCHMARK_COMPRESSING_SPEED, gSpeedPos, 76, gSpeedSize, 8
+ RTEXT "0", IDC_BENCHMARK_COMPRESSING_RPU, gRpuPos, 76, gRpuSize, 8
RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING, gRatingPos, 76, gRatingSize, 8
- LTEXT "Resulting", IDC_BENCHMARK_RESULTING, g10XPos, 89, gLabelSize, 8
- RTEXT "100 KB/s", IDC_BENCHMARK_COMPRESSING_SPEED2, gSpeedPos, 89, gSpeedSize, 8
+ LTEXT "Resulting", IDC_BENCHMARK_RESULTING, g10XPos, 89, gLabelSize, 8
+ RTEXT "100%", IDC_BENCHMARK_COMPRESSING_USAGE2, gUsagePos, 89, gUsageSize, 8
+ RTEXT "100 KB/s", IDC_BENCHMARK_COMPRESSING_SPEED2, gSpeedPos, 89, gSpeedSize, 8
+ RTEXT "0", IDC_BENCHMARK_COMPRESSING_RPU2, gRpuPos, 89, gRpuSize, 8
RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING2, gRatingPos, 89, gRatingSize, 8
- GROUPBOX "Decompressing", IDC_BENCHMARK_DECOMPRESSING, marg, 111, xSize2, 40
+ GROUPBOX "Decompressing", IDC_BENCHMARK_DECOMPRESSING, marg, 111, xSize2, 40
LTEXT "Current", IDC_BENCHMARK_CURRENT2, g10XPos, 123, gLabelSize, 8
+ RTEXT "100%", IDC_BENCHMARK_DECOMPRESSING_USAGE, gUsagePos, 123, gUsageSize, 8
RTEXT "100 KB/s", IDC_BENCHMARK_DECOMPRESSING_SPEED, gSpeedPos, 123, gSpeedSize, 8
+ RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RPU, gRpuPos, 123, gRpuSize, 8
RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING, gRatingPos, 123, gRatingSize, 8
LTEXT "Resulting", IDC_BENCHMARK_RESULTING2, g10XPos, 136, gLabelSize, 8
+ RTEXT "100%", IDC_BENCHMARK_DECOMPRESSING_USAGE2, gUsagePos, 136, gUsageSize, 8
RTEXT "100 KB/s", IDC_BENCHMARK_DECOMPRESSING_SPEED2, gSpeedPos, 136, gSpeedSize, 8
+ RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RPU2, gRpuPos, 136, gRpuSize, 8
RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING2, gRatingPos, 136, gRatingSize, 8
GROUPBOX "Total Rating", IDC_BENCHMARK_TOTAL_RATING, gTotalRatingPos, 163, gTotalRatingSize, 38
+ RTEXT "0", IDC_BENCHMARK_TOTAL_USAGE_VALUE, gUsagePos, 181, gUsageSize, 8
+ RTEXT "0", IDC_BENCHMARK_TOTAL_RPU_VALUE, gRpuPos, 181, gRpuSize, 8
RTEXT "0", IDC_BENCHMARK_TOTAL_RATING_VALUE, gRatingPos, 181, gRatingSize, 8
LTEXT "Elapsed time:", IDC_BENCHMARK_ELAPSED, marg, 163, g2XSize, 8
LTEXT "Size:", IDC_BENCHMARK_SIZE, marg, 176, g2XSize, 8
LTEXT "Passes:", IDC_BENCHMARK_PASSES, marg, 189, g2XSize, 8
- LTEXT "Errors:", IDC_BENCHMARK_ERRORS, marg, 202, g2XSize, 8
RTEXT "00:00:00", IDC_BENCHMARK_ELAPSED_VALUE, g3XPos, 163, g3XSize, 8
RTEXT "0", IDC_BENCHMARK_SIZE_VALUE, g3XPos, 176, g3XSize, 8
RTEXT "0", IDC_BENCHMARK_PASSES_VALUE, g3XPos, 189, g3XSize, 8
- RTEXT "0", IDC_BENCHMARK_ERRORS_VALUE, g3XPos, 202, g3XSize, 8
END
diff --git a/CPP/7zip/UI/GUI/UpdateGUI.cpp b/CPP/7zip/UI/GUI/UpdateGUI.cpp
index e39e7faf..1150804e 100755
--- a/CPP/7zip/UI/GUI/UpdateGUI.cpp
+++ b/CPP/7zip/UI/GUI/UpdateGUI.cpp
@@ -36,8 +36,9 @@ static const wchar_t *kSFXExtension = L"exe";
struct CThreadUpdating
{
- CUpdateCallbackGUI *UpdateCallbackGUI;
+ CCodecs *codecs;
+ CUpdateCallbackGUI *UpdateCallbackGUI;
const NWildcard::CCensor *WildcardCensor;
CUpdateOptions *Options;
COpenCallbackGUI *OpenCallback;
@@ -50,7 +51,7 @@ struct CThreadUpdating
UpdateCallbackGUI->ProgressDialog.WaitCreating();
try
{
- Result = UpdateArchive(*WildcardCensor, *Options,
+ Result = UpdateArchive(codecs, *WildcardCensor, *Options,
*ErrorInfo, OpenCallback, UpdateCallbackGUI);
}
catch(const UString &s)
@@ -81,8 +82,7 @@ struct CThreadUpdating
}
};
-static void AddProp(CObjectVector<CProperty> &properties,
- const UString &name, const UString &value)
+static void AddProp(CObjectVector<CProperty> &properties, const UString &name, const UString &value)
{
CProperty prop;
prop.Name = name;
@@ -90,16 +90,14 @@ static void AddProp(CObjectVector<CProperty> &properties,
properties.Add(prop);
}
-static void AddProp(CObjectVector<CProperty> &properties,
- const UString &name, UInt32 value)
+static void AddProp(CObjectVector<CProperty> &properties, const UString &name, UInt32 value)
{
wchar_t tmp[32];
ConvertUInt64ToString(value, tmp);
AddProp(properties, name, tmp);
}
-static void AddProp(CObjectVector<CProperty> &properties,
- const UString &name, bool value)
+static void AddProp(CObjectVector<CProperty> &properties, const UString &name, bool value)
{
AddProp(properties, name, value ? UString(L"on"): UString(L"off"));
}
@@ -149,6 +147,16 @@ static void ParseAndAddPropertires(CObjectVector<CProperty> &properties,
}
}
+static UString GetNumInBytesString(UInt64 v)
+{
+ wchar_t s[32];
+ ConvertUInt64ToString(v, s);
+ size_t len = wcslen(s);
+ s[len++] = L'B';
+ s[len] = L'\0';
+ return s;
+}
+
static void SetOutProperties(
CObjectVector<CProperty> &properties,
bool is7z,
@@ -158,8 +166,8 @@ static void SetOutProperties(
UInt32 dictionary,
bool orderMode,
UInt32 order,
- bool solidModeIsAllowed, bool solidMode,
- bool multiThreadIsAllowed, bool multiThread,
+ bool solidIsSpecified, UInt64 solidBlockSize,
+ bool multiThreadIsAllowed, UInt32 numThreads,
const UString &encryptionMethod,
bool encryptHeadersIsAllowed, bool encryptHeaders,
bool /* sfxMode */)
@@ -179,12 +187,7 @@ static void SetOutProperties(
name += L"mem";
else
name += L"d";
- wchar_t s[32];
- ConvertUInt64ToString(dictionary, s);
- size_t len = wcslen(s);
- s[len++] = L'B';
- s[len] = L'\0';
- AddProp(properties, name, UString(s));
+ AddProp(properties, name, GetNumInBytesString(dictionary));
}
if (order != (UInt32)(Int32)-1)
{
@@ -204,20 +207,19 @@ static void SetOutProperties(
if (encryptHeadersIsAllowed)
AddProp(properties, L"he", encryptHeaders);
- if (solidModeIsAllowed)
- AddProp(properties, L"s", solidMode);
+ if (solidIsSpecified)
+ AddProp(properties, L"s", GetNumInBytesString(solidBlockSize));
if (multiThreadIsAllowed)
- AddProp(properties, L"mt", multiThread);
+ AddProp(properties, L"mt", numThreads);
}
-static HRESULT ShowDialog(const NWildcard::CCensor &censor,
+static HRESULT ShowDialog(
+ CCodecs *codecs,
+ const NWildcard::CCensor &censor,
CUpdateOptions &options, CUpdateCallbackGUI *callback)
{
if (options.Commands.Size() != 1)
throw "It must be one command";
- CObjectVector<CArchiverInfo> archivers;
- CArchiverInfo archiverInfo;
- ReadArchiverInfoList(archivers);
UString currentDirPrefix;
{
if (!NDirectory::MyGetCurrentDirectory(currentDirPrefix))
@@ -253,9 +255,9 @@ static HRESULT ShowDialog(const NWildcard::CCensor &censor,
CCompressDialog dialog;
NCompressDialog::CInfo &di = dialog.Info;
- for(int i = 0; i < archivers.Size(); i++)
+ for(int i = 0; i < codecs->Formats.Size(); i++)
{
- const CArchiverInfo &ai = archivers[i];
+ const CArcInfoEx &ai = codecs->Formats[i];
if (ai.UpdateEnabled && (oneFile || !ai.KeepName))
dialog.m_ArchiverInfoList.Add(ai);
}
@@ -272,9 +274,6 @@ static HRESULT ShowDialog(const NWildcard::CCensor &censor,
di.CurrentDirPrefix = currentDirPrefix;
di.SFXMode = options.SfxMode;
- di.Solid = true;
- di.MultiThread = false;
-
if (callback->PasswordIsDefined)
di.Password = callback->Password;
@@ -311,7 +310,7 @@ static HRESULT ShowDialog(const NWildcard::CCensor &censor,
default:
throw 1091756;
}
- archiverInfo = dialog.m_ArchiverInfoList[di.ArchiverInfoIndex];
+ const CArcInfoEx &archiverInfo = dialog.m_ArchiverInfoList[di.ArchiverInfoIndex];
callback->PasswordIsDefined = (!di.Password.IsEmpty());
if (callback->PasswordIsDefined)
callback->Password = di.Password;
@@ -329,8 +328,8 @@ static HRESULT ShowDialog(const NWildcard::CCensor &censor,
di.Method,
di.Dictionary,
di.OrderMode, di.Order,
- di.SolidIsAllowed, di.Solid,
- di.MultiThreadIsAllowed, di.MultiThread,
+ di.SolidIsSpecified, di.SolidBlockSize,
+ di.MultiThreadIsAllowed, di.NumThreads,
di.EncryptionMethod,
di.EncryptHeadersIsAllowed, di.EncryptHeaders,
di.SFXMode);
@@ -339,10 +338,9 @@ static HRESULT ShowDialog(const NWildcard::CCensor &censor,
if (di.SFXMode)
options.SfxMode = true;
- options.MethodMode.FilePath = archiverInfo.FilePath;
- options.MethodMode.ClassID = archiverInfo.ClassID;
+ options.MethodMode.FormatIndex = archiverInfo.FormatIndex;
- options.ArchivePath.VolExtension = archiverInfo.GetMainExtension();
+ options.ArchivePath.VolExtension = archiverInfo.GetMainExt();
if(di.SFXMode)
options.ArchivePath.BaseExtension = kSFXExtension;
else
@@ -363,6 +361,7 @@ static HRESULT ShowDialog(const NWildcard::CCensor &censor,
}
HRESULT UpdateGUI(
+ CCodecs *codecs,
const NWildcard::CCensor &censor,
CUpdateOptions &options,
bool showDialog,
@@ -372,13 +371,15 @@ HRESULT UpdateGUI(
{
if (showDialog)
{
- RINOK(ShowDialog(censor, options, callback));
+ RINOK(ShowDialog(codecs, censor, options, callback));
}
if (options.SfxMode && options.SfxModule.IsEmpty())
options.SfxModule = kDefaultSfxModule;
CThreadUpdating tu;
+ tu.codecs = codecs;
+
tu.UpdateCallbackGUI = callback;
tu.UpdateCallbackGUI->Init();
diff --git a/CPP/7zip/UI/GUI/UpdateGUI.h b/CPP/7zip/UI/GUI/UpdateGUI.h
index c5061aca..0d9d7bcd 100755
--- a/CPP/7zip/UI/GUI/UpdateGUI.h
+++ b/CPP/7zip/UI/GUI/UpdateGUI.h
@@ -10,6 +10,7 @@
#include "../../FileManager/UpdateCallback100.h"
HRESULT UpdateGUI(
+ CCodecs *codecs,
const NWildcard::CCensor &censor,
CUpdateOptions &options,
bool showDialog,
diff --git a/CPP/7zip/UI/GUI/makefile b/CPP/7zip/UI/GUI/makefile
index bc6af149..cac56df0 100755
--- a/CPP/7zip/UI/GUI/makefile
+++ b/CPP/7zip/UI/GUI/makefile
@@ -1,6 +1,13 @@
PROG = 7zG.exe
LIBS = $(LIBS) user32.lib advapi32.lib oleaut32.lib shell32.lib comctl32.lib htmlhelp.lib ole32.lib comdlg32.lib
-CFLAGS = $(CFLAGS) -I ../../../ -DLANG -DCOMPRESS_MT -DWIN_LONG_PATH
+CFLAGS = $(CFLAGS) -I ../../../ \
+ -DLANG \
+ -DCOMPRESS_MT \
+ -DWIN_LONG_PATH \
+ -DEXTERNAL_LZMA \
+ -DEXTERNAL_CODECS \
+ -DBENCH_MT \
+ -D_7ZIP_LARGE_PAGES \
GUI_OBJS = \
$O\CompressDialog.obj \
@@ -12,8 +19,8 @@ GUI_OBJS = \
$O\UpdateGUI.obj \
COMMON_OBJS = \
- $O\Alloc.obj \
$O\CommandLineParser.obj \
+ $O\CRC.obj \
$O\IntToString.obj \
$O\Lang.obj \
$O\ListFileUtils.obj \
@@ -58,11 +65,11 @@ UI_COMMON_OBJS = \
$O\ArchiveCommandLine.obj \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
- $O\ArchiverInfo.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
+ $O\LoadCodecs.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
$O\SetProperties.obj \
@@ -76,6 +83,9 @@ UI_COMMON_OBJS = \
$O\WorkDir.obj \
$O\ZipRegistry.obj \
+LZMA_BENCH_OBJS = \
+ $O\LzmaBench.obj \
+
FM_OBJS = \
$O\ExtractCallback.obj \
$O\FormatUtils.obj \
@@ -88,6 +98,11 @@ FM_OBJS = \
$O\StringUtils.obj \
$O\UpdateCallback100.obj \
+C_OBJS = \
+ $O\Alloc.obj \
+
+!include "../../Crc2.mak"
+
OBJS = \
$O\StdAfx.obj \
$(GUI_OBJS) \
@@ -102,7 +117,11 @@ OBJS = \
$O\OverwriteDialog.obj \
$O\PasswordDialog.obj \
$O\ProgressDialog.obj \
+ $O\BenchmarkDialog.obj \
$O\CopyCoder.obj \
+ $(LZMA_BENCH_OBJS) \
+ $(C_OBJS) \
+ $(CRC_OBJS) \
$O\resource.res
!include "../../../Build.mak"
@@ -131,5 +150,14 @@ $O\PasswordDialog.obj: ../../FileManager/Resource/PasswordDialog/$(*B).cpp
$(COMPL)
$O\ProgressDialog.obj: ../../FileManager/Resource/ProgressDialog2/$(*B).cpp
$(COMPL)
+$O\BenchmarkDialog.obj: Resource/BenchmarkDialog/$(*B).cpp
+ $(COMPL)
+
+
$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
$(COMPL)
+$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp
+ $(COMPL)
+$(C_OBJS): ../../../../C/$(*B).c
+ $(COMPL_O2)
+!include "../../Crc.mak"
diff --git a/CPP/7zip/UI/GUI/resource.h b/CPP/7zip/UI/GUI/resource.h
index d88af787..d505afe0 100755
--- a/CPP/7zip/UI/GUI/resource.h
+++ b/CPP/7zip/UI/GUI/resource.h
@@ -17,6 +17,9 @@
#define IDS_METHOD_FASTEST 85
#define IDS_METHOD_ULTRA 86
+#define IDS_COMPRESS_NON_SOLID 88
+#define IDS_COMPRESS_SOLID 89
+
#define IDS_COMPRESS_UPDATE_MODE_ADD 90
#define IDS_COMPRESS_UPDATE_MODE_UPDATE 91
#define IDS_COMPRESS_UPDATE_MODE_FRESH 92
diff --git a/CPP/7zip/UI/GUI/resource.rc b/CPP/7zip/UI/GUI/resource.rc
index 19f7e61b..ba93ac43 100755
--- a/CPP/7zip/UI/GUI/resource.rc
+++ b/CPP/7zip/UI/GUI/resource.rc
@@ -27,6 +27,9 @@ BEGIN
IDS_METHOD_FAST "Fast"
IDS_METHOD_FASTEST "Fastest"
IDS_METHOD_ULTRA "Ultra"
+ IDS_COMPRESS_NON_SOLID "Non-solid"
+ IDS_COMPRESS_SOLID "Solid"
+
IDS_COMPRESS_UPDATE_MODE_ADD "Add and replace files"
IDS_COMPRESS_UPDATE_MODE_UPDATE "Update and add files"
IDS_COMPRESS_UPDATE_MODE_FRESH "Freshen existing files"
@@ -55,3 +58,4 @@ END
#include "../Resource/Extract/resource.rc"
#include "../Resource/ExtractDialog/resource.rc"
#include "../Resource/CompressDialog/resource.rc"
+#include "Resource/BenchmarkDialog/resource.rc"
diff --git a/CPP/7zip/UI/Resource/CompressDialog/resource.h b/CPP/7zip/UI/Resource/CompressDialog/resource.h
index 847bb3f9..a7401e2f 100755
--- a/CPP/7zip/UI/Resource/CompressDialog/resource.h
+++ b/CPP/7zip/UI/Resource/CompressDialog/resource.h
@@ -12,10 +12,17 @@
#define IDC_COMPRESS_COMBO_METHOD 1078
#define IDC_COMPRESS_COMBO_DICTIONARY 1079
#define IDC_COMPRESS_COMBO_ORDER 1080
+
+#define IDC_COMPRESS_COMBO_SOLID 1081
+#define IDC_COMPRESS_COMBO_THREADS 1082
+#define IDC_COMPRESS_HARDWARE_THREADS 1083
+
#define IDC_COMPRESS_SFX 1090
#define IDC_COMPRESS_EDIT_PARAMETERS 1091
-#define IDC_COMPRESS_SOLID 1092
-#define IDC_COMPRESS_MULTI_THREAD 1093
+
+// #define IDC_COMPRESS_SOLID 1092
+// #define IDC_COMPRESS_MULTI_THREAD 1093
+
#define IDC_STATIC_COMPRESS_ARCHIVE 1097
#define IDC_STATIC_COMPRESS_FORMAT 1098
#define IDC_STATIC_COMPRESS_LEVEL 1099
@@ -27,6 +34,9 @@
#define IDC_STATIC_COMPRESS_DICTIONARY 1105
#define IDC_STATIC_COMPRESS_ORDER 1106
+#define IDC_STATIC_COMPRESS_SOLID 1107
+#define IDC_STATIC_COMPRESS_THREADS 1108
+
#define IDC_COMPRESS_ENCRYPTION 1110
#define IDC_STATIC_COMPRESS_PASSWORD1 1111
#define IDC_COMPRESS_EDIT_PASSWORD1 1112
diff --git a/CPP/7zip/UI/Resource/CompressDialog/resource.rc b/CPP/7zip/UI/Resource/CompressDialog/resource.rc
index 9019a1af..109c7e14 100755
--- a/CPP/7zip/UI/Resource/CompressDialog/resource.rc
+++ b/CPP/7zip/UI/Resource/CompressDialog/resource.rc
@@ -1,8 +1,8 @@
#include "resource.h"
#include "../../../GuiCommon.rc"
-#define xSize2 344
-#define ySize2 295
+#define xSize2 380
+#define ySize2 305
#define xSize (xSize2 + marg + marg)
#define ySize (ySize2 + marg + marg)
@@ -24,10 +24,10 @@
#undef bXPos3
#undef bYPos
-#define gSize 160
+#define gSize 180
#define gSpace 24
-#define g0XSize 82
+#define g0XSize 100
#define g1XPos (marg + g0XSize)
#define g1XSize (gSize - g0XSize)
@@ -69,24 +69,26 @@ BEGIN
LTEXT "&Word size:",IDC_STATIC_COMPRESS_ORDER, marg, 125, g0XSize, 8
COMBOBOX IDC_COMPRESS_COMBO_ORDER, g1XPos, 123, g1XSize, 141, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "&Solid Block size:",IDC_STATIC_COMPRESS_SOLID, marg, 146, g0XSize, 8
+ COMBOBOX IDC_COMPRESS_COMBO_SOLID, g1XPos, 144, g1XSize, 140, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+
+ LTEXT "&Number of CPU threads:",IDC_STATIC_COMPRESS_THREADS, marg, 167, g0XSize, 8
+ COMBOBOX IDC_COMPRESS_COMBO_THREADS, g1XPos, 165, g1XSize - 35, 140, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ RTEXT "1", IDC_COMPRESS_HARDWARE_THREADS, g1XPos + g1XSize - 35 + 10, 167, 25, 8
+
- LTEXT "Memory usage for Compressing:", IDC_STATIC_COMPRESS_MEMORY, marg, 149, g2XSize, 8
- RTEXT "0", IDC_STATIC_COMPRESS_MEMORY_VALUE, g3XPos, 149, g3XSize, 8
+ LTEXT "Memory usage for Compressing:", IDC_STATIC_COMPRESS_MEMORY, marg, 190, g2XSize, 8
+ RTEXT "0", IDC_STATIC_COMPRESS_MEMORY_VALUE, g3XPos, 190, g3XSize, 8
- LTEXT "Memory usage for Decompressing:", IDC_STATIC_COMPRESS_MEMORY_DE, marg, 163, g2XSize, 8
- RTEXT "0",IDC_STATIC_COMPRESS_MEMORY_DE_VALUE, g3XPos, 163, g3XSize, 8
-
+ LTEXT "Memory usage for Decompressing:", IDC_STATIC_COMPRESS_MEMORY_DE, marg, 206, g2XSize, 8
+ RTEXT "0",IDC_STATIC_COMPRESS_MEMORY_DE_VALUE, g3XPos, 206, g3XSize, 8
- CONTROL "Create &Solid archive", IDC_COMPRESS_SOLID,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
- marg, 181, gSize, 10
- CONTROL "Multi-threading", IDC_COMPRESS_MULTI_THREAD, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
- marg, 195, gSize, 10
- LTEXT "Split to &volumes, bytes:", IDC_STATIC_COMPRESS_VOLUME, marg, 215, gSize, 8
- COMBOBOX IDC_COMPRESS_COMBO_VOLUME, marg, 227, gSize, 73, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Split to &volumes, bytes:", IDC_STATIC_COMPRESS_VOLUME, marg, 225, gSize, 8
+ COMBOBOX IDC_COMPRESS_COMBO_VOLUME, marg, 237, gSize, 73, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
- LTEXT "&Parameters:",IDC_STATIC_COMPRESS_PARAMETERS, marg, 250, xSize2, 8
- EDITTEXT IDC_COMPRESS_EDIT_PARAMETERS, marg, 262, xSize2, 14, ES_AUTOHSCROLL
+ LTEXT "&Parameters:",IDC_STATIC_COMPRESS_PARAMETERS, marg, 260, xSize2, 8
+ EDITTEXT IDC_COMPRESS_EDIT_PARAMETERS, marg, 272, xSize2, 14, ES_AUTOHSCROLL
LTEXT "&Update mode:",IDC_STATIC_COMPRESS_UPDATE_MODE, g4XPos, 39, g4XSize, 8
COMBOBOX IDC_COMPRESS_COMBO_UPDATE_MODE, g4XPos, 51, g4XSize, 80, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
diff --git a/CPP/7zip/makefile b/CPP/7zip/makefile
index 1db4c9ad..500c779a 100755
--- a/CPP/7zip/makefile
+++ b/CPP/7zip/makefile
@@ -1,7 +1,4 @@
DIRS = \
- Compress\~ \
- Crypto\~ \
- Archive\~ \
UI\~ \
Bundles\~ \
diff --git a/CPP/Build.mak b/CPP/Build.mak
index 4f25c853..aea13a71 100755
--- a/CPP/Build.mak
+++ b/CPP/Build.mak
@@ -11,7 +11,18 @@ O=O
!ENDIF
!ENDIF
-CFLAGS = $(CFLAGS) -nologo -c -Fo$O/ -EHsc -Gz -WX
+!IF "$(CPU)" != "IA64"
+!IF "$(CPU)" != "AMD64"
+MY_ML = ml
+!ELSE
+MY_ML = ml64
+!ENDIF
+!ENDIF
+
+COMPL_ASM = $(MY_ML) -c -Fo$O/ $**
+
+CFLAGS = $(CFLAGS) -nologo -c -Fo$O/ -EHsc -Gz -WX -Gy
+
!IFDEF MY_STATIC_LINK
!IFNDEF MY_SINGLE_THREAD
CFLAGS = $(CFLAGS) -MT
@@ -31,7 +42,7 @@ CFLAGS_O2 = $(CFLAGS) -O2 -W3
CFLAGS_O1_W3 = $(CFLAGS) -O1 -W3
CFLAGS_O2_W3 = $(CFLAGS) -O2 -W3
-LFLAGS = $(LFLAGS) -nologo -OPT:NOWIN98
+LFLAGS = $(LFLAGS) -nologo -OPT:NOWIN98 -OPT:REF
!IFDEF DEF_FILE
LFLAGS = $(LFLAGS) -DLL -DEF:$(DEF_FILE)
diff --git a/CPP/Common/CRC.cpp b/CPP/Common/CRC.cpp
index 35e1a187..b768128c 100755
--- a/CPP/Common/CRC.cpp
+++ b/CPP/Common/CRC.cpp
@@ -2,60 +2,13 @@
#include "StdAfx.h"
-#include "CRC.h"
-
-static const UInt32 kCRCPoly = 0xEDB88320;
-
-UInt32 CCRC::Table[256];
-
-void CCRC::InitTable()
-{
- for (UInt32 i = 0; i < 256; i++)
- {
- UInt32 r = i;
- for (int j = 0; j < 8; j++)
- if (r & 1)
- r = (r >> 1) ^ kCRCPoly;
- else
- r >>= 1;
- CCRC::Table[i] = r;
- }
+extern "C"
+{
+#include "../../C/7zCrc.h"
}
class CCRCTableInit
{
public:
- CCRCTableInit() { CCRC::InitTable(); }
+ CCRCTableInit() { CrcGenerateTable(); }
} g_CRCTableInit;
-
-void CCRC::UpdateByte(Byte b)
-{
- _value = Table[((Byte)(_value)) ^ b] ^ (_value >> 8);
-}
-
-void CCRC::UpdateUInt16(UInt16 v)
-{
- UpdateByte(Byte(v));
- UpdateByte(Byte(v >> 8));
-}
-
-void CCRC::UpdateUInt32(UInt32 v)
-{
- for (int i = 0; i < 4; i++)
- UpdateByte((Byte)(v >> (8 * i)));
-}
-
-void CCRC::UpdateUInt64(UInt64 v)
-{
- for (int i = 0; i < 8; i++)
- UpdateByte((Byte)(v >> (8 * i)));
-}
-
-void CCRC::Update(const void *data, size_t size)
-{
- UInt32 v = _value;
- const Byte *p = (const Byte *)data;
- for (; size > 0 ; size--, p++)
- v = Table[((Byte)(v)) ^ *p] ^ (v >> 8);
- _value = v;
-}
diff --git a/CPP/Common/CRC.h b/CPP/Common/CRC.h
deleted file mode 100755
index 277ae673..00000000
--- a/CPP/Common/CRC.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Common/CRC.h
-
-#ifndef __COMMON_CRC_H
-#define __COMMON_CRC_H
-
-#include <stddef.h>
-#include "Types.h"
-
-class CCRC
-{
- UInt32 _value;
-public:
- static UInt32 Table[256];
- static void InitTable();
-
- CCRC(): _value(0xFFFFFFFF){};
- void Init() { _value = 0xFFFFFFFF; }
- void UpdateByte(Byte v);
- void UpdateUInt16(UInt16 v);
- void UpdateUInt32(UInt32 v);
- void UpdateUInt64(UInt64 v);
- void Update(const void *data, size_t size);
- UInt32 GetDigest() const { return _value ^ 0xFFFFFFFF; }
- static UInt32 CalculateDigest(const void *data, size_t size)
- {
- CCRC crc;
- crc.Update(data, size);
- return crc.GetDigest();
- }
- static bool VerifyDigest(UInt32 digest, const void *data, size_t size)
- {
- return (CalculateDigest(data, size) == digest);
- }
-};
-
-#endif
diff --git a/CPP/Common/MyCom.h b/CPP/Common/MyCom.h
index e9034930..07e8fb66 100755
--- a/CPP/Common/MyCom.h
+++ b/CPP/Common/MyCom.h
@@ -5,7 +5,9 @@
#include "MyWindows.h"
+#ifndef RINOK
#define RINOK(x) { HRESULT __result_ = (x); if(__result_ != S_OK) return __result_; }
+#endif
template <class T>
class CMyComPtr
diff --git a/CPP/Common/MyGuidDef.h b/CPP/Common/MyGuidDef.h
index 2c954f81..19562696 100755
--- a/CPP/Common/MyGuidDef.h
+++ b/CPP/Common/MyGuidDef.h
@@ -22,14 +22,14 @@ typedef struct {
#define REFIID REFGUID
#ifdef __cplusplus
-inline bool operator==(REFGUID g1, REFGUID g2)
+inline int operator==(REFGUID g1, REFGUID g2)
{
for (int i = 0; i < (int)sizeof(g1); i++)
if (((unsigned char *)&g1)[i] != ((unsigned char *)&g2)[i])
- return false;
- return true;
+ return 0;
+ return 1;
}
-inline bool operator!=(REFGUID g1, REFGUID g2) { return !(g1 == g2); }
+inline int operator!=(REFGUID g1, REFGUID g2) { return !(g1 == g2); }
#endif
#ifdef __cplusplus
diff --git a/CPP/Common/StdOutStream.h b/CPP/Common/StdOutStream.h
index a3b11979..84907365 100755
--- a/CPP/Common/StdOutStream.h
+++ b/CPP/Common/StdOutStream.h
@@ -15,10 +15,10 @@ public:
CStdOutStream (): _streamIsOpen(false), _stream(0) {};
CStdOutStream (FILE *stream): _streamIsOpen(false), _stream(stream) {};
~CStdOutStream ();
+ operator FILE *() { return _stream; }
bool Open(const char *fileName);
bool Close();
bool Flush();
-
CStdOutStream & operator<<(CStdOutStream & (* aFunction)(CStdOutStream &));
CStdOutStream & operator<<(const char *string);
CStdOutStream & operator<<(const wchar_t *string);
diff --git a/CPP/Common/String.h b/CPP/Common/String.h
index cbc6ee26..6ec5b8f3 100755
--- a/CPP/Common/String.h
+++ b/CPP/Common/String.h
@@ -12,8 +12,6 @@
#include "MyWindows.h"
#endif
-static const char *kTrimDefaultCharSet = " \n\t";
-
template <class T>
inline int MyStringLen(const T *s)
{
@@ -55,7 +53,7 @@ inline char MyCharUpper(char c)
{ return (char)(unsigned int)(UINT_PTR)CharUpperA((LPSTR)(UINT_PTR)(unsigned int)(unsigned char)c); }
#ifdef _UNICODE
inline wchar_t MyCharUpper(wchar_t c)
- { return (wchar_t)CharUpperW((LPWSTR)c); }
+ { return (wchar_t)(unsigned int)(UINT_PTR)CharUpperW((LPWSTR)(UINT_PTR)(unsigned int)c); }
#else
wchar_t MyCharUpper(wchar_t c);
#endif
@@ -64,7 +62,7 @@ inline char MyCharLower(char c)
{ return (char)(unsigned int)(UINT_PTR)CharLowerA((LPSTR)(UINT_PTR)(unsigned int)(unsigned char)c); }
#ifdef _UNICODE
inline wchar_t MyCharLower(wchar_t c)
- { return (wchar_t)CharLowerW((LPWSTR)c); }
+ { return (wchar_t)(unsigned int)(UINT_PTR)CharLowerW((LPWSTR)(UINT_PTR)(unsigned int)c); }
#else
wchar_t MyCharLower(wchar_t c);
#endif
@@ -431,9 +429,9 @@ public:
CStringBase GetTrimDefaultCharSet()
{
CStringBase<T> charSet;
- for(int i = 0; i < (int)(sizeof(kTrimDefaultCharSet) /
- sizeof(kTrimDefaultCharSet[0])); i++)
- charSet += (T)kTrimDefaultCharSet[i];
+ charSet += (T)' ';
+ charSet += (T)'\n';
+ charSet += (T)'\t';
return charSet;
}
public:
diff --git a/CPP/Windows/ResourceString.cpp b/CPP/Windows/ResourceString.cpp
index 48dd4936..42cc477e 100755
--- a/CPP/Windows/ResourceString.cpp
+++ b/CPP/Windows/ResourceString.cpp
@@ -14,7 +14,7 @@ extern bool g_IsNT;
namespace NWindows {
-CSysString MyLoadString(UINT resourceID)
+CSysString MyLoadString(HINSTANCE hInstance, UINT resourceID)
{
CSysString s;
int size = 256;
@@ -22,15 +22,20 @@ CSysString MyLoadString(UINT resourceID)
do
{
size += 256;
- len = ::LoadString(g_hInstance, resourceID, s.GetBuffer(size - 1), size);
+ len = ::LoadString(hInstance, resourceID, s.GetBuffer(size - 1), size);
}
while (size - len <= 1);
s.ReleaseBuffer();
return s;
}
+CSysString MyLoadString(UINT resourceID)
+{
+ return MyLoadString(g_hInstance, resourceID);
+}
+
#ifndef _UNICODE
-UString MyLoadStringW(UINT resourceID)
+UString MyLoadStringW(HINSTANCE hInstance, UINT resourceID)
{
if (g_IsNT)
{
@@ -40,7 +45,7 @@ UString MyLoadStringW(UINT resourceID)
do
{
size += 256;
- len = ::LoadStringW(g_hInstance, resourceID, s.GetBuffer(size - 1), size);
+ len = ::LoadStringW(hInstance, resourceID, s.GetBuffer(size - 1), size);
}
while (size - len <= 1);
s.ReleaseBuffer();
@@ -48,6 +53,12 @@ UString MyLoadStringW(UINT resourceID)
}
return GetUnicodeString(MyLoadString(resourceID));
}
+
+UString MyLoadStringW(UINT resourceID)
+{
+ return MyLoadStringW(g_hInstance, resourceID);
+}
+
#endif
}
diff --git a/CPP/Windows/ResourceString.h b/CPP/Windows/ResourceString.h
index a74f925d..1bfc88ab 100755
--- a/CPP/Windows/ResourceString.h
+++ b/CPP/Windows/ResourceString.h
@@ -7,11 +7,13 @@
namespace NWindows {
+CSysString MyLoadString(HINSTANCE hInstance, UINT resourceID);
CSysString MyLoadString(UINT resourceID);
#ifdef _UNICODE
-inline UString MyLoadStringW(UINT resourceID)
- { return MyLoadString(resourceID); }
+inline UString MyLoadStringW(HINSTANCE hInstance, UINT resourceID) { return MyLoadString(hInstance, resourceID); }
+inline UString MyLoadStringW(UINT resourceID) { return MyLoadString(resourceID); }
#else
+UString MyLoadStringW(HINSTANCE hInstance, UINT resourceID);
UString MyLoadStringW(UINT resourceID);
#endif
diff --git a/CPP/Windows/System.h b/CPP/Windows/System.h
index e1a5abac..a81aba98 100755
--- a/CPP/Windows/System.h
+++ b/CPP/Windows/System.h
@@ -15,6 +15,33 @@ inline UInt32 GetNumberOfProcessors()
return (UInt32)systemInfo.dwNumberOfProcessors;
}
+#ifndef _WIN64
+typedef BOOL (WINAPI *GlobalMemoryStatusExP)(LPMEMORYSTATUSEX lpBuffer);
+#endif
+
+inline UInt64 GetRamSize()
+{
+ MEMORYSTATUSEX stat;
+ stat.dwLength = sizeof(stat);
+ #ifdef _WIN64
+ if (!::GlobalMemoryStatusEx(&stat))
+ return 0;
+ return stat.ullTotalPhys;
+ #else
+ GlobalMemoryStatusExP globalMemoryStatusEx = (GlobalMemoryStatusExP)
+ ::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")),
+ "GlobalMemoryStatusEx");
+ if (globalMemoryStatusEx != 0)
+ if (globalMemoryStatusEx(&stat))
+ return stat.ullTotalPhys;
+ {
+ MEMORYSTATUS stat;
+ stat.dwLength = sizeof(stat);
+ GlobalMemoryStatus(&stat);
+ return stat.dwTotalPhys;
+ }
+ #endif
+}
}}
diff --git a/DOC/7zip.nsi b/DOC/7zip.nsi
index 0d5456e5..d2903602 100755
--- a/DOC/7zip.nsi
+++ b/DOC/7zip.nsi
@@ -2,7 +2,7 @@
;Defines
!define VERSION_MAJOR 4
-!define VERSION_MINOR 44
+!define VERSION_MINOR 45
!define VERSION_POSTFIX_FULL " beta"
!ifdef WIN64
!ifdef IA64
@@ -115,12 +115,45 @@ Section
Delete $INSTDIR\7zC.sfx
Delete $INSTDIR\7-zipn.dll
Delete $INSTDIR\7zipDoc.txt
+ Delete $INSTDIR\file_id.diz
+
+ Delete $INSTDIR\Codecs\7zAES.dll
+ Delete $INSTDIR\Codecs\AES.dll
+ Delete $INSTDIR\Codecs\Branch.dll
+ Delete $INSTDIR\Codecs\BZip2.dll
+ Delete $INSTDIR\Codecs\Copy.dll
+ Delete $INSTDIR\Codecs\Deflate.dll
Delete $INSTDIR\Codecs\Implode.dll
+ Delete $INSTDIR\Codecs\LZMA.dll
+ Delete $INSTDIR\Codecs\PPMD.dll
+ Delete $INSTDIR\Codecs\Rar29.dll
+ Delete $INSTDIR\Codecs\Swap.dll
+
+ RMDir $INSTDIR\Codecs
+
+ Delete $INSTDIR\Formats\7z.dll
+ Delete $INSTDIR\Formats\arj.dll
+ Delete $INSTDIR\Formats\bz2.dll
+ Delete $INSTDIR\Formats\cab.dll
+ Delete $INSTDIR\Formats\chm.dll
+ Delete $INSTDIR\Formats\cpio.dll
+ Delete $INSTDIR\Formats\deb.dll
+ Delete $INSTDIR\Formats\gz.dll
+ Delete $INSTDIR\Formats\iso.dll
+ Delete $INSTDIR\Formats\lzh.dll
+ Delete $INSTDIR\Formats\nsis.dll
+ Delete $INSTDIR\Formats\rar.dll
+ Delete $INSTDIR\Formats\rpm.dll
+ Delete $INSTDIR\Formats\split.dll
+ Delete $INSTDIR\Formats\tar.dll
+ Delete $INSTDIR\Formats\z.dll
+ Delete $INSTDIR\Formats\zip.dll
+
+ RMDir $INSTDIR\Formats
# install files
SetOutPath "$INSTDIR"
- File file_id.diz
File descript.ion
File History.txt
File License.txt
@@ -144,38 +177,7 @@ Section
File 7-zip.chm
- SetOutPath $INSTDIR\Formats
-
File 7z.dll
- File arj.dll
- File bz2.dll
- File cab.dll
- File chm.dll
- File cpio.dll
- File deb.dll
- File gz.dll
- File iso.dll
- File lzh.dll
- File nsis.dll
- File rar.dll
- File rpm.dll
- File split.dll
- File tar.dll
- File z.dll
- File zip.dll
-
- SetOutPath $INSTDIR\Codecs
-
- File LZMA.dll
- File Rar29.dll
- File Deflate.dll
- File Branch.dll
- File Swap.dll
- File Copy.dll
- File PPMD.dll
- File BZip2.dll
- File AES.dll
- File 7zAES.dll
SetOutPath $INSTDIR\Lang
@@ -191,6 +193,7 @@ Section
File br.txt
File ca.txt
File cs.txt
+ File cy.txt
File da.txt
File de.txt
File el.txt
@@ -338,7 +341,6 @@ Section "Uninstall"
# delete files
- Delete $INSTDIR\file_id.diz
Delete $INSTDIR\descript.ion
Delete $INSTDIR\History.txt
Delete $INSTDIR\License.txt
@@ -360,38 +362,7 @@ Section "Uninstall"
Delete $INSTDIR\7-zip.chm
- Delete $INSTDIR\Formats\7z.dll
- Delete $INSTDIR\Formats\arj.dll
- Delete $INSTDIR\Formats\bz2.dll
- Delete $INSTDIR\Formats\cab.dll
- Delete $INSTDIR\Formats\chm.dll
- Delete $INSTDIR\Formats\cpio.dll
- Delete $INSTDIR\Formats\deb.dll
- Delete $INSTDIR\Formats\gz.dll
- Delete $INSTDIR\Formats\iso.dll
- Delete $INSTDIR\Formats\lzh.dll
- Delete $INSTDIR\Formats\nsis.dll
- Delete $INSTDIR\Formats\rar.dll
- Delete $INSTDIR\Formats\rpm.dll
- Delete $INSTDIR\Formats\split.dll
- Delete $INSTDIR\Formats\tar.dll
- Delete $INSTDIR\Formats\z.dll
- Delete $INSTDIR\Formats\zip.dll
-
- RMDir $INSTDIR\Formats
-
- Delete $INSTDIR\Codecs\LZMA.dll
- Delete $INSTDIR\Codecs\Rar29.dll
- Delete $INSTDIR\Codecs\Deflate.dll
- Delete $INSTDIR\Codecs\Branch.dll
- Delete $INSTDIR\Codecs\Swap.dll
- Delete $INSTDIR\Codecs\Copy.dll
- Delete $INSTDIR\Codecs\PPMD.dll
- Delete $INSTDIR\Codecs\BZip2.dll
- Delete $INSTDIR\Codecs\AES.dll
- Delete $INSTDIR\Codecs\7zAES.dll
-
- RMDir $INSTDIR\Codecs
+ Delete $INSTDIR\7z.dll
Delete $INSTDIR\Lang\en.ttt
Delete $INSTDIR\Lang\af.txt
@@ -405,6 +376,7 @@ Section "Uninstall"
Delete $INSTDIR\Lang\br.txt
Delete $INSTDIR\Lang\ca.txt
Delete $INSTDIR\Lang\cs.txt
+ Delete $INSTDIR\Lang\cy.txt
Delete $INSTDIR\Lang\da.txt
Delete $INSTDIR\Lang\de.txt
Delete $INSTDIR\Lang\el.txt
diff --git a/DOC/7zip.wxs b/DOC/7zip.wxs
index c2b4e9d9..4d3a9107 100755
--- a/DOC/7zip.wxs
+++ b/DOC/7zip.wxs
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?define VerMajor = "4" ?>
-<?define VerMinor = "44" ?>
+<?define VerMinor = "45" ?>
<?define VerBuild = "03" ?>
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
<?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?>
@@ -227,42 +227,9 @@
</File>
</Component>
- <Directory Id="Formats" Name="Formats">
- <Component Id="Formats" Guid="$(var.CompFormats)" DiskId="1" Win64="$(var.Is64)">
+ <Component Id="Formats" Guid="$(var.CompFormats)" DiskId="1" Win64="$(var.Is64)">
<File Id="_7z.dll" Name="7z.dll" />
- <File Id="arj.dll" Name="arj.dll" />
- <File Id="bz2.dll" Name="bz2.dll" />
- <File Id="cab.dll" Name="cab.dll" />
- <File Id="chm.dll" Name="chm.dll" />
- <File Id="cpio.dll" Name="cpio.dll" />
- <File Id="deb.dll" Name="deb.dll" />
- <File Id="gz.dll" Name="gz.dll" />
- <File Id="iso.dll" Name="iso.dll" />
- <File Id="lzh.dll" Name="lzh.dll" />
- <File Id="nsis.dll" Name="nsis.dll" />
- <File Id="rar.dll" Name="rar.dll" />
- <File Id="rpm.dll" Name="rpm.dll" />
- <File Id="split.dll" Name="split.dll" />
- <File Id="tar.dll" Name="tar.dll" />
- <File Id="z.dll" Name="z.dll" />
- <File Id="zip.dll" Name="zip.dll" />
- </Component>
- </Directory>
-
- <Directory Id="Codecs" Name="Codecs">
- <Component Id="Codecs" Guid="$(var.CompCodecs)" DiskId="1" Win64="$(var.Is64)">
- <File Id="_7zAES.dll" Name="7zAES.dll" />
- <File Id="AES.dll" Name="AES.dll" />
- <File Id="Branch.dll" Name="Branch.dll" />
- <File Id="BZip2.dll" Name="BZip2.dll" />
- <File Id="Copy.dll" Name="Copy.dll" />
- <File Id="Deflate.dll" Name="Deflate.dll" />
- <File Id="LZMA.dll" Name="LZMA.dll" />
- <File Id="PPMd.dll" Name="PPMd.dll" />
- <File Id="Rar29.dll" Name="Rar29.dll" />
- <File Id="Swap.dll" Name="Swap.dll" />
- </Component>
- </Directory>
+ </Component>
<Directory Id="MyLang" Name="Lang">
<Component Id="Lang" Guid="$(var.CompLang)" DiskId="1" Win64="$(var.Is64)">
@@ -278,6 +245,7 @@
<File Id="br.txt" Name="br.txt" />
<File Id="ca.txt" Name="ca.txt" />
<File Id="cs.txt" Name="cs.txt" />
+ <File Id="cy.txt" Name="cy.txt" />
<File Id="da.txt" Name="da.txt" />
<File Id="de.txt" Name="de.txt" />
<File Id="el.txt" Name="el.txt" />
@@ -361,7 +329,6 @@
<ComponentRef Id="Gui" />
<ComponentRef Id="GuiSfx" />
<ComponentRef Id="ConSfx" />
- <ComponentRef Id="Codecs" />
<ComponentRef Id="Formats" />
<ComponentRef Id="Docs" />
<ComponentRef Id="Help" />
diff --git a/DOC/License.txt b/DOC/License.txt
index 1cadc586..b02c21ee 100755
--- a/DOC/License.txt
+++ b/DOC/License.txt
@@ -1,5 +1,5 @@
- 7-Zip
- ~~~~~
+ 7-Zip source code
+ ~~~~~~~~~~~~~~~~~
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -7,9 +7,9 @@
Licenses for files are:
- 1) Rar29.dll: GNU LGPL + unRAR restriction
- 2) AES.dll and 7za.exe: GNU LGPL + AES code license
- 3) All other files: GNU LGPL
+ 1) CPP/7zip/Compress/Rar files: GNU LGPL + unRAR restriction
+ 2) CPP/7zip/Crypto/AES files: GNU LGPL + AES code license
+ 3) All other files: GNU LGPL
GNU LGPL + unRAR restriction means that you must follow both GNU LGPL rules
and unRAR restriction rules.
diff --git a/DOC/Methods.txt b/DOC/Methods.txt
index ab750599..4cec657d 100755
--- a/DOC/Methods.txt
+++ b/DOC/Methods.txt
@@ -1,24 +1,23 @@
-Compression method IDs (4.43)
------------------------------
+7-Zip method IDs (4.45)
+-----------------------
-Each compression method in 7z has unique binary value (ID).
-The length of ID in bytes is arbitrary but it can not exceed 15 bytes.
+Each compression or crypto method in 7z has unique binary value (ID).
+The length of ID in bytes is arbitrary but it can not exceed 63 bits (8 bytes).
If you want to add some new ID, you have two ways:
1) Write request for allocating IDs to 7-zip developers.
-2) Use such random ID:
- 03 E0 ZZ ... ZZ MM ... MM VV ... VV
+2) Generate 8-bytes ID:
- ZZ != 0, MM != 0, VV != 0
+ 7F ZZ ZZ ZZ ZZ ZZ MM MM
- 03 E0 - Prefix for random IDs
- ZZ ... ZZ - Developer ID. (length >= 4). Use real random bytes.
- You can notify 7-Zip developers about your Developer ID.
- MM ... MM - Method ID (length >= 1)
- VV ... VV - Version (length >= 1)
+ 7F - Prefix for random IDs (1 byte)
+ ZZ ZZ ZZ ZZ ZZ - Developer ID (5 bytes). Use real random bytes.
+
+ MM MM - Method ID (2 bytes)
- Note: Use new ID (MM ... MM VV .. VV) only if old codec can not decode
- data encoded with new version.
+ You can notify 7-Zip developers about your Developer ID / Method ID.
+
+ Note: Use new ID only if old codec can not decode data encoded with new version.
List of defined IDs
diff --git a/DOC/history.txt b/DOC/history.txt
index 0b71d52a..03a728c5 100755
--- a/DOC/history.txt
+++ b/DOC/history.txt
@@ -1,6 +1,13 @@
Sources history of the 7-Zip
----------------------------
+ Version 4.45 beta 2007-04-16
+ --------------------------------------
+ - 7-Zip now uses C version of CRC, so you must call CrcGenerateTable at
+ stratup code, or you must add CPP/Common/CRC.cpp to your project.
+ - Method ID in .7z now is 63-bit integer (UInt64).
+
+
Version 4.30 beta 2005-11-18
--------------------------------------
- Security.h::AddLockMemoryPrivilege - installs "Large pages" feature
diff --git a/DOC/readme.txt b/DOC/readme.txt
index 20b0f881..88a6a366 100755
--- a/DOC/readme.txt
+++ b/DOC/readme.txt
@@ -10,7 +10,7 @@ License Info
------------
7-Zip is free software distributed under the GNU LGPL
-(except for files Rar29.dll and AES code).
+(except for unRar code and AES code).
read License.txt for more infomation about license.
Notes about unRAR license: