seven-zip 1.4.2 → 1.7.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +49 -0
- data/.github/workflows/release.yml +21 -0
- data/README.md +13 -2
- data/Rakefile +2 -0
- data/ext/p7zip/C/7zBuf.h +4 -8
- data/ext/p7zip/C/7zBuf2.c +9 -3
- data/ext/p7zip/C/7zCrc.c +84 -32
- data/ext/p7zip/C/7zCrc.h +2 -2
- data/ext/p7zip/C/7zCrcOpt.c +89 -8
- data/ext/p7zip/C/7zStream.c +4 -2
- data/ext/p7zip/C/{Types.h → 7zTypes.h} +8 -6
- data/ext/p7zip/C/7zVersion.h +21 -6
- data/ext/p7zip/C/Aes.c +28 -15
- data/ext/p7zip/C/Aes.h +2 -2
- data/ext/p7zip/C/Alloc.c +60 -12
- data/ext/p7zip/C/Alloc.h +6 -7
- data/ext/p7zip/C/Bcj2.c +256 -0
- data/ext/p7zip/C/Bcj2.h +146 -0
- data/ext/p7zip/C/Bcj2Enc.c +312 -0
- data/ext/p7zip/C/Blake2.h +48 -0
- data/ext/p7zip/C/Blake2s.c +244 -0
- data/ext/p7zip/C/Bra.c +2 -0
- data/ext/p7zip/C/Bra.h +4 -8
- data/ext/p7zip/C/Bra86.c +48 -51
- data/ext/p7zip/C/BraIA64.c +3 -1
- data/ext/p7zip/C/BwtSort.c +3 -4
- data/ext/p7zip/C/BwtSort.h +4 -8
- data/ext/p7zip/C/Compiler.h +32 -0
- data/ext/p7zip/C/CpuArch.c +50 -7
- data/ext/p7zip/C/CpuArch.h +112 -41
- data/ext/p7zip/C/Delta.c +2 -0
- data/ext/p7zip/C/Delta.h +4 -8
- data/ext/p7zip/C/HuffEnc.c +8 -6
- data/ext/p7zip/C/HuffEnc.h +4 -8
- data/ext/p7zip/C/LzFind.c +391 -108
- data/ext/p7zip/C/LzFind.h +20 -18
- data/ext/p7zip/C/LzFindMt.c +100 -90
- data/ext/p7zip/C/LzFindMt.h +4 -8
- data/ext/p7zip/C/LzHash.h +23 -20
- data/ext/p7zip/C/Lzma2Dec.c +48 -26
- data/ext/p7zip/C/Lzma2Dec.h +4 -8
- data/ext/p7zip/C/Lzma2Enc.c +58 -15
- data/ext/p7zip/C/Lzma2Enc.h +3 -7
- data/ext/p7zip/C/{LzmaUtil/Lzma86Enc.h → Lzma86.h} +47 -14
- data/ext/p7zip/C/{LzmaUtil/Lzma86Dec.c → Lzma86Dec.c} +6 -13
- data/ext/p7zip/C/{LzmaUtil/Lzma86Enc.c → Lzma86Enc.c} +8 -15
- data/ext/p7zip/C/LzmaDec.c +180 -79
- data/ext/p7zip/C/LzmaDec.h +4 -8
- data/ext/p7zip/C/LzmaEnc.c +230 -147
- data/ext/p7zip/C/LzmaEnc.h +6 -8
- data/ext/p7zip/C/MtCoder.c +3 -3
- data/ext/p7zip/C/Ppmd.h +5 -5
- data/ext/p7zip/C/Ppmd7.c +9 -7
- data/ext/p7zip/C/Ppmd7.h +3 -3
- data/ext/p7zip/C/Ppmd7Dec.c +2 -0
- data/ext/p7zip/C/Ppmd7Enc.c +4 -2
- data/ext/p7zip/C/Ppmd8.c +34 -31
- data/ext/p7zip/C/Ppmd8.h +5 -1
- data/ext/p7zip/C/Ppmd8Dec.c +2 -0
- data/ext/p7zip/C/Ppmd8Enc.c +2 -0
- data/ext/p7zip/C/Precomp.h +10 -0
- data/ext/p7zip/C/RotateDefs.h +11 -1
- data/ext/p7zip/C/Sha1.c +340 -0
- data/ext/p7zip/C/Sha1.h +38 -0
- data/ext/p7zip/C/Sha256.c +107 -63
- data/ext/p7zip/C/Sha256.h +2 -2
- data/ext/p7zip/C/Sort.c +59 -11
- data/ext/p7zip/C/Sort.h +8 -10
- data/ext/p7zip/C/Threads.h +1 -1
- data/ext/p7zip/C/Xz.c +7 -5
- data/ext/p7zip/C/Xz.h +40 -17
- data/ext/p7zip/C/XzCrc64.c +69 -16
- data/ext/p7zip/C/XzCrc64.h +2 -2
- data/ext/p7zip/C/XzCrc64Opt.c +69 -0
- data/ext/p7zip/C/XzDec.c +93 -55
- data/ext/p7zip/C/XzEnc.c +206 -165
- data/ext/p7zip/C/XzEnc.h +23 -9
- data/ext/p7zip/C/XzIn.c +50 -43
- data/ext/p7zip/CPP/7zip/Archive/7z/7zCompressionMode.h +37 -13
- data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.cpp +392 -181
- data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.h +29 -29
- data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.cpp +424 -212
- data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.h +53 -16
- data/ext/p7zip/CPP/7zip/Archive/7z/7zExtract.cpp +312 -174
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.cpp +74 -61
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.h +22 -19
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.cpp +505 -232
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.h +70 -16
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHandlerOut.cpp +602 -172
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.cpp +5 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.h +54 -3
- data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.cpp +981 -616
- data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.h +275 -89
- data/ext/p7zip/CPP/7zip/Archive/7z/7zItem.h +77 -162
- data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.cpp +288 -238
- data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.h +189 -20
- data/ext/p7zip/CPP/7zip/Archive/7z/7zProperties.cpp +59 -49
- data/ext/p7zip/CPP/7zip/Archive/7z/7zRegister.cpp +12 -9
- data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.cpp +4 -6
- data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.h +5 -5
- data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.cpp +1743 -447
- data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.h +61 -10
- data/ext/p7zip/CPP/7zip/Archive/ApmHandler.cpp +84 -120
- data/ext/p7zip/CPP/7zip/Archive/ArHandler.cpp +854 -0
- data/ext/p7zip/CPP/7zip/Archive/ArchiveExports.cpp +48 -32
- data/ext/p7zip/CPP/7zip/Archive/ArjHandler.cpp +519 -340
- data/ext/p7zip/CPP/7zip/Archive/Bz2Handler.cpp +223 -203
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.cpp +50 -139
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.h +17 -18
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.cpp +566 -234
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.h +10 -1
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.cpp +2 -2
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.h +12 -15
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.cpp +341 -122
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.h +81 -66
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabItem.h +17 -14
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabRegister.cpp +10 -4
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.cpp +190 -83
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.h +7 -1
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.cpp +292 -174
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.h +73 -47
- data/ext/p7zip/CPP/7zip/Archive/ComHandler.cpp +886 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.cpp +994 -71
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.h +364 -101
- data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.cpp +7 -12
- data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.h +4 -3
- data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.cpp +6 -6
- data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.h +2 -2
- data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.cpp +77 -543
- data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.h +31 -51
- data/ext/p7zip/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +18 -14
- data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.cpp +34 -7
- data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.h +5 -2
- data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.cpp +25 -24
- data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.h +8 -3
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.h +1 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp +2 -2
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.h +5 -5
- data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.cpp +0 -174
- data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.h +2 -14
- data/ext/p7zip/CPP/7zip/Archive/CpioHandler.cpp +506 -335
- data/ext/p7zip/CPP/7zip/Archive/CramfsHandler.cpp +227 -84
- data/ext/p7zip/CPP/7zip/Archive/DeflateProps.cpp +0 -115
- data/ext/p7zip/CPP/7zip/Archive/DeflateProps.h +0 -29
- data/ext/p7zip/CPP/7zip/Archive/DllExports2.cpp +63 -17
- data/ext/p7zip/CPP/7zip/Archive/DmgHandler.cpp +1007 -339
- data/ext/p7zip/CPP/7zip/Archive/ElfHandler.cpp +618 -177
- data/ext/p7zip/CPP/7zip/Archive/ExtHandler.cpp +2867 -0
- data/ext/p7zip/CPP/7zip/Archive/FatHandler.cpp +136 -76
- data/ext/p7zip/CPP/7zip/Archive/FlvHandler.cpp +132 -150
- data/ext/p7zip/CPP/7zip/Archive/GptHandler.cpp +405 -0
- data/ext/p7zip/CPP/7zip/Archive/GzHandler.cpp +560 -214
- data/ext/p7zip/CPP/7zip/Archive/HandlerCont.cpp +288 -0
- data/ext/p7zip/CPP/7zip/Archive/HandlerCont.h +116 -0
- data/ext/p7zip/CPP/7zip/Archive/HfsHandler.cpp +1880 -0
- data/ext/p7zip/CPP/7zip/Archive/IArchive.h +415 -51
- data/ext/p7zip/CPP/7zip/Archive/IhexHandler.cpp +497 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.cpp +158 -71
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.h +2 -1
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.cpp +0 -9
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.h +8 -5
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.cpp +311 -91
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.h +101 -83
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoItem.h +48 -39
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoRegister.cpp +12 -4
- data/ext/p7zip/CPP/7zip/Archive/LzhHandler.cpp +127 -114
- data/ext/p7zip/CPP/7zip/Archive/LzmaHandler.cpp +264 -121
- data/ext/p7zip/CPP/7zip/Archive/MachoHandler.cpp +402 -242
- data/ext/p7zip/CPP/7zip/Archive/MbrHandler.cpp +56 -114
- data/ext/p7zip/CPP/7zip/Archive/MslzHandler.cpp +230 -90
- data/ext/p7zip/CPP/7zip/Archive/MubHandler.cpp +129 -153
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.cpp +179 -58
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.h +36 -7
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.cpp +407 -237
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.h +9 -16
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.cpp +5535 -1098
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.h +345 -81
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisRegister.cpp +11 -4
- data/ext/p7zip/CPP/7zip/Archive/NtfsHandler.cpp +1424 -434
- data/ext/p7zip/CPP/7zip/Archive/PeHandler.cpp +1831 -521
- data/ext/p7zip/CPP/7zip/Archive/PpmdHandler.cpp +50 -35
- data/ext/p7zip/CPP/7zip/Archive/QcowHandler.cpp +615 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/Rar5Handler.cpp +2746 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/Rar5Handler.h +411 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.cpp +1241 -355
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.h +70 -20
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.h +38 -34
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.h +34 -16
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarVol.h +129 -0
- data/ext/p7zip/CPP/7zip/Archive/RpmHandler.cpp +641 -194
- data/ext/p7zip/CPP/7zip/Archive/SplitHandler.cpp +174 -181
- data/ext/p7zip/CPP/7zip/Archive/SquashfsHandler.cpp +237 -174
- data/ext/p7zip/CPP/7zip/Archive/SwfHandler.cpp +471 -192
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.cpp +350 -59
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.h +24 -7
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandlerOut.cpp +79 -27
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.cpp +5 -7
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.h +20 -44
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.cpp +279 -64
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.h +10 -1
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarItem.h +34 -8
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.cpp +145 -87
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.h +13 -5
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarRegister.cpp +14 -9
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.cpp +154 -27
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.h +10 -6
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.cpp +53 -128
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.h +6 -5
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.cpp +384 -119
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.h +40 -21
- data/ext/p7zip/CPP/7zip/Archive/UefiHandler.cpp +1618 -0
- data/ext/p7zip/CPP/7zip/Archive/VdiHandler.cpp +362 -0
- data/ext/p7zip/CPP/7zip/Archive/VhdHandler.cpp +438 -247
- data/ext/p7zip/CPP/7zip/Archive/VmdkHandler.cpp +1518 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.cpp +837 -249
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.h +73 -47
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandlerOut.cpp +1614 -351
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.cpp +1519 -513
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.h +498 -139
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimRegister.cpp +13 -9
- data/ext/p7zip/CPP/7zip/Archive/XarHandler.cpp +272 -128
- data/ext/p7zip/CPP/7zip/Archive/XzHandler.cpp +502 -253
- data/ext/p7zip/CPP/7zip/Archive/XzHandler.h +65 -0
- data/ext/p7zip/CPP/7zip/Archive/ZHandler.cpp +114 -39
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.cpp +118 -134
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.h +6 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipCompressionMode.h +40 -20
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.cpp +541 -274
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.h +13 -40
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp +165 -254
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.h +70 -178
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.cpp +1934 -550
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.h +294 -63
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.cpp +160 -86
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.h +139 -110
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.cpp +177 -154
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.h +50 -18
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipRegister.cpp +18 -9
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.cpp +367 -201
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.h +11 -10
- data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile +2 -319
- data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.depend +0 -4962
- data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.list +1004 -259
- data/ext/p7zip/CPP/7zip/Common/CWrappers.cpp +26 -22
- data/ext/p7zip/CPP/7zip/Common/CWrappers.h +19 -14
- data/ext/p7zip/CPP/7zip/Common/CreateCoder.cpp +298 -130
- data/ext/p7zip/CPP/7zip/Common/CreateCoder.h +118 -34
- data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.cpp +24 -28
- data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.h +5 -5
- data/ext/p7zip/CPP/7zip/Common/FileStreams.cpp +268 -65
- data/ext/p7zip/CPP/7zip/Common/FileStreams.h +70 -33
- data/ext/p7zip/CPP/7zip/Common/FilterCoder.cpp +302 -131
- data/ext/p7zip/CPP/7zip/Common/FilterCoder.h +141 -43
- data/ext/p7zip/CPP/7zip/Common/InBuffer.cpp +87 -35
- data/ext/p7zip/CPP/7zip/Common/InBuffer.h +54 -45
- data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.cpp +22 -17
- data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.h +5 -5
- data/ext/p7zip/CPP/7zip/Common/LimitedStreams.cpp +256 -43
- data/ext/p7zip/CPP/7zip/Common/LimitedStreams.h +135 -8
- data/ext/p7zip/CPP/7zip/Common/MemBlocks.cpp +5 -5
- data/ext/p7zip/CPP/7zip/Common/MemBlocks.h +3 -3
- data/ext/p7zip/CPP/7zip/Common/MethodId.cpp +0 -24
- data/ext/p7zip/CPP/7zip/Common/MethodId.h +1 -1
- data/ext/p7zip/CPP/7zip/Common/MethodProps.cpp +430 -71
- data/ext/p7zip/CPP/7zip/Common/MethodProps.h +170 -17
- data/ext/p7zip/CPP/7zip/Common/OffsetStream.cpp +8 -4
- data/ext/p7zip/CPP/7zip/Common/OffsetStream.h +4 -3
- data/ext/p7zip/CPP/7zip/Common/OutBuffer.cpp +26 -31
- data/ext/p7zip/CPP/7zip/Common/OutBuffer.h +17 -18
- data/ext/p7zip/CPP/7zip/Common/OutMemStream.cpp +5 -5
- data/ext/p7zip/CPP/7zip/Common/OutMemStream.h +5 -4
- data/ext/p7zip/CPP/7zip/Common/ProgressUtils.cpp +22 -13
- data/ext/p7zip/CPP/7zip/Common/ProgressUtils.h +4 -3
- data/ext/p7zip/CPP/7zip/Common/PropId.cpp +108 -0
- data/ext/p7zip/CPP/7zip/Common/RegisterArc.h +63 -17
- data/ext/p7zip/CPP/7zip/Common/RegisterCodec.h +79 -6
- data/ext/p7zip/CPP/7zip/Common/StreamBinder.cpp +95 -90
- data/ext/p7zip/CPP/7zip/Common/StreamBinder.h +46 -23
- data/ext/p7zip/CPP/7zip/Common/StreamObjects.cpp +88 -24
- data/ext/p7zip/CPP/7zip/Common/StreamObjects.h +36 -14
- data/ext/p7zip/CPP/7zip/Common/StreamUtils.cpp +4 -4
- data/ext/p7zip/CPP/7zip/Common/StreamUtils.h +6 -6
- data/ext/p7zip/CPP/7zip/Common/UniqBlocks.cpp +57 -0
- data/ext/p7zip/CPP/7zip/Common/UniqBlocks.h +26 -0
- data/ext/p7zip/CPP/7zip/Common/VirtThread.cpp +8 -6
- data/ext/p7zip/CPP/7zip/Common/VirtThread.h +6 -5
- data/ext/p7zip/CPP/7zip/Compress/BZip2Const.h +13 -12
- data/ext/p7zip/CPP/7zip/Compress/BZip2Crc.h +1 -1
- data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.cpp +198 -147
- data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.h +60 -27
- data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.cpp +111 -116
- data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.h +53 -59
- data/ext/p7zip/CPP/7zip/Compress/BZip2Register.cpp +12 -7
- data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.cpp +554 -282
- data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.h +73 -71
- data/ext/p7zip/CPP/7zip/Compress/Bcj2Register.cpp +10 -5
- data/ext/p7zip/CPP/7zip/Compress/BcjCoder.cpp +13 -4
- data/ext/p7zip/CPP/7zip/Compress/BcjCoder.h +17 -5
- data/ext/p7zip/CPP/7zip/Compress/BcjRegister.cpp +7 -9
- data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.cpp +2 -2
- data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.h +58 -61
- data/ext/p7zip/CPP/7zip/Compress/BitlEncoder.h +24 -25
- data/ext/p7zip/CPP/7zip/Compress/BitmDecoder.h +46 -17
- data/ext/p7zip/CPP/7zip/Compress/BitmEncoder.h +18 -19
- data/ext/p7zip/CPP/7zip/Compress/BranchMisc.cpp +14 -28
- data/ext/p7zip/CPP/7zip/Compress/BranchMisc.h +27 -6
- data/ext/p7zip/CPP/7zip/Compress/BranchRegister.cpp +26 -15
- data/ext/p7zip/CPP/7zip/Compress/ByteSwap.cpp +45 -26
- data/ext/p7zip/CPP/7zip/Compress/CodecExports.cpp +254 -70
- data/ext/p7zip/CPP/7zip/Compress/CopyCoder.cpp +65 -17
- data/ext/p7zip/CPP/7zip/Compress/CopyCoder.h +15 -3
- data/ext/p7zip/CPP/7zip/Compress/CopyRegister.cpp +5 -4
- data/ext/p7zip/CPP/7zip/Compress/Deflate64Register.cpp +12 -6
- data/ext/p7zip/CPP/7zip/Compress/DeflateConst.h +43 -46
- data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.cpp +145 -81
- data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.h +31 -33
- data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.cpp +179 -162
- data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.h +35 -30
- data/ext/p7zip/CPP/7zip/Compress/DeflateRegister.cpp +11 -7
- data/ext/p7zip/CPP/7zip/Compress/DeltaFilter.cpp +55 -39
- data/ext/p7zip/CPP/7zip/Compress/{DllExports2.cpp → DllExports2Compress.cpp} +8 -8
- data/ext/p7zip/CPP/7zip/Compress/DllExportsCompress.cpp +48 -0
- data/ext/p7zip/CPP/7zip/Compress/HuffmanDecoder.h +220 -49
- data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.cpp +14 -9
- data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.h +2 -3
- data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp +7 -7
- data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.h +1 -1
- data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.cpp +1 -1
- data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.h +21 -18
- data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.cpp +171 -141
- data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.h +32 -64
- data/ext/p7zip/CPP/7zip/Compress/Lzham/LICENSE +22 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/LzhamRegister.cpp +783 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/README.md +211 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/include/lzham.h +803 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/include/lzham_dynamic_lib.h +156 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/include/lzham_exports.inc +31 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/include/lzham_static_lib.h +59 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/include/zlib.h +2 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/CMakeLists.txt +69 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_comp.h +38 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzbase.cpp +244 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzbase.h +46 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzcomp.cpp +750 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzcomp_internal.cpp +2240 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzcomp_internal.h +503 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzcomp_state.cpp +1684 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_match_accel.cpp +947 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_match_accel.h +164 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_null_threading.h +98 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_pthreads_threading.cpp +214 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_pthreads_threading.h +535 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_threading.h +12 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_win32_threading.cpp +232 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_win32_threading.h +387 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzhamcomp.vcxproj +208 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/CMakeLists.txt +86 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_assert.cpp +80 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_assert.h +58 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_checksum.cpp +73 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_checksum.h +13 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_config.h +25 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_core.h +303 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_decomp.h +37 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_helpers.h +54 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_huffman_codes.cpp +286 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_huffman_codes.h +32 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_lzdecomp.cpp +1586 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_lzdecompbase.cpp +131 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_lzdecompbase.h +89 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_math.h +142 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_mem.cpp +463 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_mem.h +115 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_platform.cpp +159 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_platform.h +284 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_prefix_coding.cpp +431 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_prefix_coding.h +157 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_symbol_codec.cpp +1527 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_symbol_codec.h +494 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_timer.cpp +147 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_timer.h +99 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_traits.h +141 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_types.h +72 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_utils.h +58 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_vector.cpp +83 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_vector.h +628 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzhamdecomp.vcxproj +224 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamlib/lzham_lib.cpp +179 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamlib/lzhamlib.vcxproj +187 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/makefile +10 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/makefile.depend +0 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/makefile.list +129 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.cpp +123 -46
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.h +29 -14
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.cpp +14 -9
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.h +1 -1
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Register.cpp +9 -7
- data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.cpp +24 -8
- data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.h +8 -1
- data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.cpp +30 -27
- data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.h +3 -1
- data/ext/p7zip/CPP/7zip/Compress/LzmaRegister.cpp +9 -7
- data/ext/p7zip/CPP/7zip/Compress/LzmsDecoder.cpp +576 -0
- data/ext/p7zip/CPP/7zip/Compress/LzmsDecoder.h +271 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzx.h +32 -36
- data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.cpp +380 -238
- data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.h +170 -83
- data/ext/p7zip/CPP/7zip/Compress/Mtf8.h +7 -9
- data/ext/p7zip/CPP/7zip/Compress/PpmdDecoder.cpp +1 -5
- data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.cpp +51 -18
- data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.h +18 -8
- data/ext/p7zip/CPP/7zip/Compress/PpmdRegister.cpp +9 -8
- data/ext/p7zip/CPP/7zip/Compress/PpmdZip.cpp +61 -25
- data/ext/p7zip/CPP/7zip/Compress/PpmdZip.h +21 -6
- data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.cpp +122 -102
- data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.h +68 -157
- data/ext/p7zip/CPP/7zip/Compress/Rar/makefile +33 -18
- data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.depend +0 -158
- data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.list +105 -56
- data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.cpp +34 -21
- data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.h +2 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.cpp +77 -67
- data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.h +12 -10
- data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.cpp +139 -118
- data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.h +48 -33
- data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.cpp +148 -113
- data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.h +35 -19
- data/ext/p7zip/CPP/7zip/Compress/Rar5Decoder.cpp +961 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar5Decoder.h +335 -0
- data/ext/p7zip/CPP/7zip/Compress/RarCodecsRegister.cpp +13 -6
- data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.cpp +91 -71
- data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.h +2 -4
- data/ext/p7zip/CPP/7zip/Compress/XpressDecoder.cpp +129 -0
- data/ext/p7zip/CPP/7zip/Compress/XpressDecoder.h +13 -0
- data/ext/p7zip/CPP/7zip/Compress/ZDecoder.cpp +98 -20
- data/ext/p7zip/CPP/7zip/Compress/ZDecoder.h +19 -7
- data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.cpp +14 -11
- data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.h +32 -1
- data/ext/p7zip/CPP/7zip/Crypto/7zAes.cpp +137 -101
- data/ext/p7zip/CPP/7zip/Crypto/7zAes.h +31 -30
- data/ext/p7zip/CPP/7zip/Crypto/7zAesRegister.cpp +8 -9
- data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.cpp +39 -28
- data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.h +3 -3
- data/ext/p7zip/CPP/7zip/Crypto/HmacSha256.cpp +62 -0
- data/ext/p7zip/CPP/7zip/Crypto/HmacSha256.h +27 -0
- data/ext/p7zip/CPP/7zip/Crypto/MyAes.cpp +73 -7
- data/ext/p7zip/CPP/7zip/Crypto/MyAes.h +25 -8
- data/ext/p7zip/CPP/7zip/Crypto/MyAesReg.cpp +16 -0
- data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp +29 -15
- data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.h +2 -1
- data/ext/p7zip/CPP/7zip/Crypto/RandGen.cpp +49 -34
- data/ext/p7zip/CPP/7zip/Crypto/RandGen.h +2 -2
- data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.cpp +36 -39
- data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.h +15 -17
- data/ext/p7zip/CPP/7zip/Crypto/Rar5Aes.cpp +257 -0
- data/ext/p7zip/CPP/7zip/Crypto/Rar5Aes.h +84 -0
- data/ext/p7zip/CPP/7zip/Crypto/RarAes.cpp +70 -71
- data/ext/p7zip/CPP/7zip/Crypto/RarAes.h +24 -19
- data/ext/p7zip/CPP/7zip/Crypto/Sha1Cls.h +51 -0
- data/ext/p7zip/CPP/7zip/Crypto/WzAes.cpp +68 -54
- data/ext/p7zip/CPP/7zip/Crypto/WzAes.h +37 -27
- data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.cpp +60 -34
- data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.h +28 -11
- data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.cpp +90 -28
- data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.h +13 -2
- data/ext/p7zip/CPP/7zip/Guid.txt +57 -11
- data/ext/p7zip/CPP/7zip/ICoder.h +202 -17
- data/ext/p7zip/CPP/7zip/IDecl.h +16 -3
- data/ext/p7zip/CPP/7zip/IPassword.h +1 -2
- data/ext/p7zip/CPP/7zip/IProgress.h +2 -16
- data/ext/p7zip/CPP/7zip/IStream.h +82 -13
- data/ext/p7zip/CPP/7zip/MyVersion.h +2 -11
- data/ext/p7zip/CPP/7zip/PropID.h +60 -9
- data/ext/p7zip/CPP/Common/C_FileIO.cpp +5 -1
- data/ext/p7zip/CPP/Common/C_FileIO.h +7 -1
- data/ext/p7zip/CPP/Common/CommandLineParser.cpp +122 -148
- data/ext/p7zip/CPP/Common/CommandLineParser.h +20 -29
- data/ext/p7zip/CPP/Common/Common.h +13 -0
- data/ext/p7zip/CPP/Common/CrcReg.cpp +98 -0
- data/ext/p7zip/CPP/Common/Defs.h +5 -10
- data/ext/p7zip/CPP/Common/DynLimBuf.cpp +93 -0
- data/ext/p7zip/CPP/Common/DynLimBuf.h +40 -0
- data/ext/p7zip/CPP/Common/DynamicBuffer.h +45 -31
- data/ext/p7zip/CPP/Common/IntToString.cpp +109 -40
- data/ext/p7zip/CPP/Common/IntToString.h +14 -9
- data/ext/p7zip/CPP/Common/Lang.cpp +120 -87
- data/ext/p7zip/CPP/Common/Lang.h +10 -15
- data/ext/p7zip/CPP/Common/ListFileUtils.cpp +82 -40
- data/ext/p7zip/CPP/Common/ListFileUtils.h +7 -4
- data/ext/p7zip/CPP/Common/MyBuffer.h +244 -0
- data/ext/p7zip/CPP/Common/MyCom.h +65 -28
- data/ext/p7zip/CPP/Common/MyGuidDef.h +1 -1
- data/ext/p7zip/CPP/Common/MyInitGuid.h +23 -0
- data/ext/p7zip/CPP/Common/MyLinux.h +42 -0
- data/ext/p7zip/CPP/Common/MyMap.cpp +8 -8
- data/ext/p7zip/CPP/Common/MyMap.h +2 -2
- data/ext/p7zip/CPP/Common/MyString.cpp +1643 -117
- data/ext/p7zip/CPP/Common/MyString.h +677 -486
- data/ext/p7zip/CPP/Common/MyTypes.h +38 -0
- data/ext/p7zip/CPP/Common/MyUnknown.h +4 -0
- data/ext/p7zip/CPP/Common/MyVector.cpp +0 -84
- data/ext/p7zip/CPP/Common/MyVector.h +472 -112
- data/ext/p7zip/CPP/Common/MyWindows.cpp +18 -1
- data/ext/p7zip/CPP/Common/MyWindows.h +8 -0
- data/ext/p7zip/CPP/Common/MyXml.cpp +169 -118
- data/ext/p7zip/CPP/Common/MyXml.h +14 -11
- data/ext/p7zip/CPP/Common/NewHandler.cpp +39 -0
- data/ext/p7zip/CPP/Common/NewHandler.h +55 -2
- data/ext/p7zip/CPP/Common/Random.h +14 -0
- data/ext/p7zip/CPP/Common/Sha1Reg.cpp +40 -0
- data/ext/p7zip/CPP/Common/Sha256Reg.cpp +40 -0
- data/ext/p7zip/CPP/Common/StdInStream.cpp +46 -27
- data/ext/p7zip/CPP/Common/StdInStream.h +11 -10
- data/ext/p7zip/CPP/Common/StdOutStream.cpp +48 -35
- data/ext/p7zip/CPP/Common/StdOutStream.h +44 -17
- data/ext/p7zip/CPP/Common/StringConvert.cpp +56 -17
- data/ext/p7zip/CPP/Common/StringConvert.h +7 -3
- data/ext/p7zip/CPP/Common/StringToInt.cpp +102 -48
- data/ext/p7zip/CPP/Common/StringToInt.h +13 -10
- data/ext/p7zip/CPP/Common/TextConfig.cpp +33 -47
- data/ext/p7zip/CPP/Common/TextConfig.h +3 -6
- data/ext/p7zip/CPP/Common/UTFConvert.cpp +218 -75
- data/ext/p7zip/CPP/Common/UTFConvert.h +4 -3
- data/ext/p7zip/CPP/Common/Wildcard.cpp +345 -125
- data/ext/p7zip/CPP/Common/Wildcard.h +82 -13
- data/ext/p7zip/CPP/Common/XzCrc64Reg.cpp +42 -0
- data/ext/p7zip/CPP/Windows/FileDir.cpp +427 -475
- data/ext/p7zip/CPP/Windows/FileDir.h +94 -72
- data/ext/p7zip/CPP/Windows/FileFind.cpp +235 -244
- data/ext/p7zip/CPP/Windows/FileFind.h +63 -59
- data/ext/p7zip/CPP/Windows/FileIO.cpp +29 -46
- data/ext/p7zip/CPP/Windows/FileIO.h +40 -42
- data/ext/p7zip/CPP/Windows/FileName.cpp +696 -17
- data/ext/p7zip/CPP/Windows/FileName.h +11 -3
- data/ext/p7zip/CPP/Windows/NtCheck.h +2 -0
- data/ext/p7zip/CPP/Windows/PropVariant.cpp +134 -30
- data/ext/p7zip/CPP/Windows/PropVariant.h +80 -24
- data/ext/p7zip/CPP/Windows/PropVariantUtils.cpp +89 -18
- data/ext/p7zip/CPP/Windows/PropVariantUtils.h +12 -7
- data/ext/p7zip/CPP/Windows/System.cpp +20 -15
- data/ext/p7zip/CPP/Windows/System.h +3 -2
- data/ext/p7zip/CPP/Windows/TimeUtils.cpp +203 -0
- data/ext/p7zip/CPP/Windows/TimeUtils.h +24 -0
- data/ext/p7zip/CPP/include_windows/basetyps.h +4 -4
- data/ext/p7zip/CPP/include_windows/windows.h +17 -11
- data/ext/p7zip/CPP/myWindows/StdAfx.h +97 -5
- data/ext/p7zip/CPP/myWindows/config.h +20 -5
- data/ext/p7zip/CPP/myWindows/myPrivate.h +8 -0
- data/ext/p7zip/CPP/myWindows/wine_date_and_time.cpp +34 -0
- data/ext/p7zip/ChangeLog +283 -35
- data/ext/p7zip/{DOCS → DOC}/7zC.txt +6 -13
- data/ext/p7zip/{DOCS → DOC}/License.txt +3 -2
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/add.htm +93 -87
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/bench.htm +88 -79
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/delete.htm +62 -59
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/extract.htm +96 -91
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/extract_full.htm +73 -68
- data/ext/p7zip/DOC/MANUAL/cmdline/commands/hash.htm +65 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/index.htm +36 -33
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/list.htm +78 -77
- data/ext/p7zip/DOC/MANUAL/cmdline/commands/rename.htm +51 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/style.css +232 -232
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/test.htm +47 -46
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/update.htm +71 -66
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/exit_codes.htm +27 -27
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/index.htm +29 -29
- data/ext/p7zip/{DOCS/MANUAL/switches → DOC/MANUAL/cmdline}/style.css +232 -232
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/ar_exclude.htm +56 -56
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/ar_include.htm +80 -83
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/ar_no.htm +52 -52
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/bb.htm +61 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/bs.htm +67 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/charset.htm +61 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/exclude.htm +71 -60
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/include.htm +89 -87
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/index.htm +95 -64
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/large_pages.htm +59 -50
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/list_tech.htm +36 -36
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/method.htm +738 -625
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/output_dir.htm +53 -53
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/overwrite.htm +56 -56
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/password.htm +55 -54
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/recurse.htm +85 -83
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/sa.htm +58 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/scc.htm +42 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/scrc.htm +53 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/sdel.htm +39 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/sfx.htm +153 -156
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/shared.htm +40 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/sni.htm +56 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/sns.htm +77 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/spf.htm +80 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/ssc.htm +50 -50
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/stdin.htm +56 -55
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/stdout.htm +54 -50
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/stl.htm +39 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/stop_switch.htm +31 -31
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/stx.htm +50 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline/switches}/style.css +232 -232
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/type.htm +121 -83
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/update.htm +177 -176
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/volume.htm +49 -49
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/working_dir.htm +56 -55
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/yes.htm +48 -48
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/syntax.htm +120 -120
- data/ext/p7zip/DOC/MANUAL/fm/about.htm +21 -0
- data/ext/p7zip/DOC/MANUAL/fm/benchmark.htm +56 -0
- data/ext/p7zip/DOC/MANUAL/fm/index.htm +54 -0
- data/ext/p7zip/DOC/MANUAL/fm/menu.htm +154 -0
- data/ext/p7zip/DOC/MANUAL/fm/options.htm +152 -0
- data/ext/p7zip/DOC/MANUAL/fm/plugins/7-zip/add.htm +311 -0
- data/ext/p7zip/DOC/MANUAL/fm/plugins/7-zip/extract.htm +78 -0
- data/ext/p7zip/DOC/MANUAL/fm/plugins/7-zip/index.htm +63 -0
- data/ext/p7zip/DOC/MANUAL/fm/plugins/7-zip/style.css +232 -0
- data/ext/p7zip/DOC/MANUAL/fm/plugins/index.htm +22 -0
- data/ext/p7zip/DOC/MANUAL/fm/plugins/style.css +232 -0
- data/ext/p7zip/DOC/MANUAL/fm/style.css +232 -0
- data/ext/p7zip/DOC/MANUAL/general/7z.htm +117 -0
- data/ext/p7zip/DOC/MANUAL/general/faq.htm +125 -0
- data/ext/p7zip/DOC/MANUAL/general/formats.htm +100 -0
- data/ext/p7zip/DOC/MANUAL/general/index.htm +27 -0
- data/ext/p7zip/DOC/MANUAL/general/license.htm +30 -0
- data/ext/p7zip/DOC/MANUAL/general/performance.htm +98 -0
- data/ext/p7zip/DOC/MANUAL/general/style.css +232 -0
- data/ext/p7zip/DOC/MANUAL/general/thanks.htm +43 -0
- data/ext/p7zip/DOC/MANUAL/start.htm +37 -0
- data/ext/p7zip/DOC/MANUAL/style.css +232 -0
- data/ext/p7zip/DOC/Methods.txt +158 -0
- data/ext/p7zip/{DOCS → DOC}/copying.txt +9 -11
- data/ext/p7zip/DOC/lzma.txt +328 -0
- data/ext/p7zip/{DOCS → DOC}/readme.txt +42 -65
- data/ext/p7zip/{DOCS/history.txt → DOC/src-history.txt} +88 -2
- data/ext/p7zip/README +117 -91
- data/ext/p7zip/TODO +0 -2
- data/ext/p7zip/install.sh +31 -29
- data/ext/p7zip/last_error +1 -0
- data/ext/p7zip/makefile +29 -125
- data/ext/p7zip/makefile.afl +23 -0
- data/ext/p7zip/makefile.aix_gcc +5 -4
- data/ext/p7zip/makefile.android_arm +49 -0
- data/ext/p7zip/makefile.beos +5 -4
- data/ext/p7zip/makefile.common +150 -0
- data/ext/p7zip/makefile.crc32 +3 -3
- data/ext/p7zip/makefile.cygwin +5 -4
- data/ext/p7zip/makefile.cygwin64 +21 -0
- data/ext/p7zip/makefile.cygwin64_asm +22 -0
- data/ext/p7zip/makefile.cygwin_asm +6 -4
- data/ext/p7zip/makefile.cygwin_clang +21 -0
- data/ext/p7zip/makefile.cygwin_clang_asm +23 -0
- data/ext/p7zip/{makefile.djgpp_old → makefile.djgpp} +5 -4
- data/ext/p7zip/makefile.djgpp_watt +7 -5
- data/ext/p7zip/makefile.freebsd5 +5 -4
- data/ext/p7zip/{makefile.freebsd6 → makefile.freebsd6+} +6 -5
- data/ext/p7zip/makefile.glb +27 -18
- data/ext/p7zip/makefile.gprof +3 -2
- data/ext/p7zip/makefile.haiku +19 -0
- data/ext/p7zip/makefile.hpux-acc +3 -2
- data/ext/p7zip/makefile.hpux-acc_64 +3 -2
- data/ext/p7zip/makefile.hpux-gcc +5 -4
- data/ext/p7zip/makefile.linux_amd64 +5 -4
- data/ext/p7zip/makefile.linux_amd64_asm +12 -5
- data/ext/p7zip/makefile.linux_amd64_asm_icc +5 -3
- data/ext/p7zip/makefile.linux_amd64_sanitizer +26 -0
- data/ext/p7zip/makefile.linux_any_cpu +5 -4
- data/ext/p7zip/makefile.linux_any_cpu_gcc_4.X +7 -4
- data/ext/p7zip/makefile.linux_clang_amd64_asm +25 -0
- data/ext/p7zip/makefile.linux_clang_amd64_asm_sanitize +27 -0
- data/ext/p7zip/makefile.linux_cross_aarch64 +25 -0
- data/ext/p7zip/makefile.linux_cross_arm +7 -4
- data/ext/p7zip/makefile.linux_cross_djgpp +27 -0
- data/ext/p7zip/makefile.linux_cross_m68k +26 -0
- data/ext/p7zip/makefile.linux_cross_mipsel +27 -0
- data/ext/p7zip/makefile.linux_cross_ppc +25 -0
- data/ext/p7zip/makefile.linux_cross_ppc64 +25 -0
- data/ext/p7zip/makefile.linux_cross_ppc64le +25 -0
- data/ext/p7zip/makefile.linux_cross_s390x +25 -0
- data/ext/p7zip/makefile.linux_cross_sparc64 +25 -0
- data/ext/p7zip/makefile.linux_gcc6_sanitize +23 -0
- data/ext/p7zip/makefile.linux_gcc_2.95_no_need_for_libstdc +6 -4
- data/ext/p7zip/makefile.linux_other +6 -5
- data/ext/p7zip/makefile.linux_s390x +5 -4
- data/ext/p7zip/{makefile.machine_base → makefile.linux_scan-build} +5 -4
- data/ext/p7zip/makefile.linux_valgrind +25 -0
- data/ext/p7zip/{makefile.linux_clang_amd64 → makefile.linux_x32} +6 -5
- data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X +10 -5
- data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X_fltk +8 -4
- data/ext/p7zip/makefile.linux_x86_asm_gcc_mudflap_4.X +4 -2
- data/ext/p7zip/makefile.linux_x86_asm_icc +4 -2
- data/ext/p7zip/makefile.linux_x86_icc +3 -2
- data/ext/p7zip/makefile.macosx_arm64 +17 -0
- data/ext/p7zip/{makefile.macosx_32bits → makefile.macosx_gcc_32bits} +3 -2
- data/ext/p7zip/{makefile.macosx_32bits_asm → makefile.macosx_gcc_32bits_asm} +5 -3
- data/ext/p7zip/{makefile.macosx_32bits_ppc → makefile.macosx_gcc_32bits_ppc} +3 -2
- data/ext/p7zip/{makefile.macosx_64bits → makefile.macosx_gcc_64bits} +3 -2
- data/ext/p7zip/makefile.macosx_llvm_64bits +9 -3
- data/ext/p7zip/makefile.netbsd +5 -4
- data/ext/p7zip/makefile.netware_asm_gcc_3.X +6 -4
- data/ext/p7zip/makefile.oldmake +41 -130
- data/ext/p7zip/makefile.openbsd +7 -3
- data/ext/p7zip/makefile.openbsd_no_port +9 -5
- data/ext/p7zip/makefile.qnx_shared.bin +5 -4
- data/ext/p7zip/makefile.qnx_static +5 -4
- data/ext/p7zip/makefile.solaris_sparc_CC_32 +5 -4
- data/ext/p7zip/makefile.solaris_sparc_CC_64 +6 -4
- data/ext/p7zip/makefile.solaris_sparc_gcc +7 -6
- data/ext/p7zip/makefile.solaris_x86 +5 -4
- data/ext/p7zip/makefile.tru64 +5 -4
- data/ext/seven_zip_ruby/extconf.rb +92 -6
- data/ext/seven_zip_ruby/seven_zip_archive.cpp +40 -17
- data/ext/seven_zip_ruby/seven_zip_archive.h +1 -1
- data/ext/seven_zip_ruby/utils.cpp +267 -124
- data/ext/seven_zip_ruby/utils.h +2 -0
- data/lib/seven_zip_ruby/7z.dll +0 -0
- data/lib/seven_zip_ruby/7z.sfx +0 -0
- data/lib/seven_zip_ruby/7z64.dll +0 -0
- data/lib/seven_zip_ruby/7zCon.sfx +0 -0
- data/lib/seven_zip_ruby/seven_zip_reader.rb +16 -1
- data/lib/seven_zip_ruby/version.rb +1 -1
- data/p7zip/.gitignore +7 -0
- data/p7zip/README.txt +29 -0
- data/p7zip/extract.sh +134 -0
- data/spec/seven_zip_ruby_spec.rb +22 -13
- data/test/res/The Flying Spaghetti Monster.txt +3 -0
- data/test/res/The Three Little Pigs.txt +5 -0
- data/test/res/UTF_content.txt +3 -0
- data/test/res/test_reader_data.7z +0 -0
- data/test/res/test_reader_filename_cp932.7z +0 -0
- data/test/res/test_reader_files.7z +0 -0
- data/test/test_seven_zip_reader.rb +187 -0
- data/test/test_seven_zip_writer.rb +184 -0
- metadata +267 -219
- data/.github/workflows/test-and-release.yml +0 -43
- data/ext/C/Types.h +0 -254
- data/ext/CPP/7zip/Archive/IArchive.h +0 -234
- data/ext/CPP/7zip/IDecl.h +0 -15
- data/ext/CPP/7zip/IPassword.h +0 -24
- data/ext/CPP/7zip/IProgress.h +0 -33
- data/ext/CPP/7zip/IStream.h +0 -58
- data/ext/CPP/7zip/PropID.h +0 -76
- data/ext/CPP/Common/MyCom.h +0 -225
- data/ext/CPP/Common/MyGuidDef.h +0 -54
- data/ext/CPP/Common/MyInitGuid.h +0 -22
- data/ext/CPP/Common/MyUnknown.h +0 -13
- data/ext/CPP/Common/MyWindows.h +0 -204
- data/ext/CPP/Common/Types.h +0 -11
- data/ext/CPP/Windows/PropVariant.h +0 -56
- data/ext/CPP/include_windows/basetyps.h +0 -19
- data/ext/CPP/include_windows/tchar.h +0 -89
- data/ext/CPP/include_windows/windows.h +0 -194
- data/ext/p7zip/Asm/x64/7zCrcT8U.asm +0 -103
- data/ext/p7zip/Asm/x86/7zCrcT8U.asm +0 -101
- data/ext/p7zip/C/7zCrcT8.c +0 -43
- data/ext/p7zip/C/Alloc.back3 +0 -238
- data/ext/p7zip/C/Alloc.c.back +0 -243
- data/ext/p7zip/C/Alloc.c.back2 +0 -222
- data/ext/p7zip/C/LzmaUtil/Lzma86Dec.h +0 -51
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.cpp +0 -149
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.h +0 -58
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.cpp +0 -24
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.h +0 -28
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmRegister.cpp +0 -13
- data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.cpp +0 -239
- data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.h +0 -28
- data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.cpp +0 -389
- data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.h +0 -119
- data/ext/p7zip/CPP/7zip/Archive/Com/ComRegister.cpp +0 -13
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.cpp +0 -240
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.h +0 -80
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.cpp +0 -239
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.h +0 -88
- data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.cpp +0 -15
- data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.h +0 -37
- data/ext/p7zip/CPP/7zip/Archive/DebHandler.cpp +0 -413
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.cpp +0 -243
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.h +0 -26
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.cpp +0 -480
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.h +0 -154
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsRegister.cpp +0 -13
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.cpp +0 -21
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.cpp +0 -478
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.h +0 -123
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.cpp +0 -55
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarRegister.cpp +0 -13
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp +0 -78
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.h +0 -49
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfRegister.cpp +0 -13
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.cpp +0 -36
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItemEx.h +0 -34
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zFM.txt +0 -163
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zG.txt +0 -131
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7za.txt +0 -253
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_ALL.txt +0 -32
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_Format7zFree.txt +0 -290
- data/ext/p7zip/CPP/7zip/CMAKE/generate.sh +0 -37
- data/ext/p7zip/CPP/7zip/CMAKE/generate_xcode.sh +0 -32
- data/ext/p7zip/CPP/7zip/Common/LockedStream.cpp +0 -23
- data/ext/p7zip/CPP/7zip/Common/LockedStream.h +0 -38
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.cpp +0 -309
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.h +0 -98
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.cpp +0 -90
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.h +0 -59
- data/ext/p7zip/CPP/7zip/Compress/BranchCoder.cpp +0 -19
- data/ext/p7zip/CPP/7zip/Compress/BranchCoder.h +0 -44
- data/ext/p7zip/CPP/7zip/Compress/DllExports.cpp +0 -39
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp +0 -531
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp +0 -1018
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h +0 -48
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp +0 -311
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h +0 -20
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/makefile +0 -173
- data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.cpp +0 -90
- data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.h +0 -46
- data/ext/p7zip/CPP/7zip/Compress/RangeCoder.h +0 -205
- data/ext/p7zip/CPP/7zip/Compress/RangeCoderBit.h +0 -114
- data/ext/p7zip/CPP/7zip/Crypto/Sha1.cpp +0 -229
- data/ext/p7zip/CPP/7zip/Crypto/Sha1.h +0 -68
- data/ext/p7zip/CPP/7zip/PREMAKE/generate.sh +0 -18
- data/ext/p7zip/CPP/7zip/PREMAKE/premake4.lua +0 -263
- data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA.pro +0 -228
- data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA_osx.pro +0 -228
- data/ext/p7zip/CPP/7zip/QMAKE/test_emul/test_emul.pro +0 -26
- data/ext/p7zip/CPP/7zip/TEST/TestUI/TestUI.cpp +0 -560
- data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile +0 -33
- data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.depend +0 -577
- data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.list +0 -16
- data/ext/p7zip/CPP/Common/Buffer.h +0 -77
- data/ext/p7zip/CPP/Common/Types.h +0 -11
- data/ext/p7zip/CPP/Windows/COM.cpp +0 -37
- data/ext/p7zip/CPP/Windows/COM.h +0 -69
- data/ext/p7zip/CPP/Windows/Clipboard.cpp +0 -160
- data/ext/p7zip/CPP/Windows/Clipboard.h +0 -28
- data/ext/p7zip/CPP/Windows/CommonDialog.h +0 -19
- data/ext/p7zip/CPP/Windows/Control/ComboBox.h +0 -82
- data/ext/p7zip/CPP/Windows/Control/Controls.cpp +0 -515
- data/ext/p7zip/CPP/Windows/Control/Dialog.cpp +0 -560
- data/ext/p7zip/CPP/Windows/Control/Dialog.h +0 -179
- data/ext/p7zip/CPP/Windows/Control/DialogImpl.h +0 -73
- data/ext/p7zip/CPP/Windows/Control/Edit.h +0 -24
- data/ext/p7zip/CPP/Windows/Control/ListView.h +0 -164
- data/ext/p7zip/CPP/Windows/Control/ProgressBar.h +0 -34
- data/ext/p7zip/CPP/Windows/Control/Static.h +0 -23
- data/ext/p7zip/CPP/Windows/Control/StatusBar.h +0 -56
- data/ext/p7zip/CPP/Windows/Control/Window2.cpp +0 -211
- data/ext/p7zip/CPP/Windows/Control/Window2.h +0 -111
- data/ext/p7zip/CPP/Windows/DLL.cpp +0 -193
- data/ext/p7zip/CPP/Windows/DLL.h +0 -48
- data/ext/p7zip/CPP/Windows/Error.cpp +0 -58
- data/ext/p7zip/CPP/Windows/Error.h +0 -33
- data/ext/p7zip/CPP/Windows/Menu.h +0 -4
- data/ext/p7zip/CPP/Windows/PropVariantConversions.cpp +0 -142
- data/ext/p7zip/CPP/Windows/PropVariantConversions.h +0 -14
- data/ext/p7zip/CPP/Windows/Registry.cpp +0 -313
- data/ext/p7zip/CPP/Windows/Registry.h +0 -113
- data/ext/p7zip/CPP/Windows/ResourceString.h +0 -22
- data/ext/p7zip/CPP/Windows/Shell.h +0 -21
- data/ext/p7zip/CPP/Windows/Time.cpp +0 -88
- data/ext/p7zip/CPP/Windows/Time.h +0 -21
- data/ext/p7zip/CPP/Windows/Window.cpp +0 -101
- data/ext/p7zip/CPP/Windows/Window.h +0 -43
- data/ext/p7zip/CPP/myWindows/initguid.h +0 -4
- data/ext/p7zip/CPP/myWindows/makefile +0 -21
- data/ext/p7zip/CPP/myWindows/makefile.depend +0 -32
- data/ext/p7zip/CPP/myWindows/makefile.list +0 -28
- data/ext/p7zip/CPP/myWindows/myAddExeFlag.cpp +0 -20
- data/ext/p7zip/CPP/myWindows/myGetTickCount.cpp +0 -8
- data/ext/p7zip/CPP/myWindows/mySplitCommandLine.cpp +0 -82
- data/ext/p7zip/CPP/myWindows/test_emul.cpp +0 -745
- data/ext/p7zip/CPP/myWindows/wine_GetXXXDefaultLangID.cpp +0 -741
- data/ext/p7zip/DOCS/MANUAL/switches/charset.htm +0 -49
- data/ext/p7zip/DOCS/Methods.txt +0 -152
- data/ext/p7zip/DOCS/lzma.txt +0 -598
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/ChangeLog +0 -41
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme +0 -21
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme.u7z +0 -30
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/u7z +0 -133
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/README +0 -21
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/check.sh +0 -117
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/files.tar +0 -0
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1 +0 -33
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/p7zip +0 -144
- data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-shared +0 -14
- data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-static +0 -10
- data/ext/p7zip/integration_context_menu.txt +0 -51
- data/ext/p7zip/makefile.rules +0 -661
- /data/ext/p7zip/{DOCS → DOC}/7zFormat.txt +0 -0
- /data/ext/p7zip/{DOCS → DOC}/unRarLicense.txt +0 -0
@@ -2,50 +2,109 @@
|
|
2
2
|
|
3
3
|
#include "StdAfx.h"
|
4
4
|
|
5
|
-
#include "
|
6
|
-
#include "Common/IntToString.h"
|
7
|
-
#include "Common/StringConvert.h"
|
5
|
+
#include "../../../../C/CpuArch.h"
|
8
6
|
|
9
|
-
#include "
|
10
|
-
#include "
|
11
|
-
#include "
|
7
|
+
#include "../../../Common/ComTry.h"
|
8
|
+
#include "../../../Common/IntToString.h"
|
9
|
+
#include "../../../Common/UTFConvert.h"
|
10
|
+
|
11
|
+
#include "../../../Windows/PropVariantUtils.h"
|
12
|
+
#include "../../../Windows/TimeUtils.h"
|
12
13
|
|
13
14
|
#include "../../IPassword.h"
|
14
15
|
|
15
16
|
#include "../../Common/CreateCoder.h"
|
16
17
|
#include "../../Common/FilterCoder.h"
|
18
|
+
#include "../../Common/LimitedStreams.h"
|
17
19
|
#include "../../Common/MethodId.h"
|
18
20
|
#include "../../Common/ProgressUtils.h"
|
21
|
+
#include "../../Common/RegisterArc.h"
|
22
|
+
#include "../../Common/StreamUtils.h"
|
19
23
|
|
20
24
|
#include "../../Compress/CopyCoder.h"
|
21
25
|
|
22
26
|
#include "../../Crypto/Rar20Crypto.h"
|
23
27
|
#include "../../Crypto/RarAes.h"
|
24
28
|
|
29
|
+
#include "../Common/FindSignature.h"
|
25
30
|
#include "../Common/ItemNameUtils.h"
|
26
31
|
#include "../Common/OutStreamWithCRC.h"
|
27
32
|
|
33
|
+
#include "../HandlerCont.h"
|
34
|
+
|
35
|
+
#include "RarVol.h"
|
28
36
|
#include "RarHandler.h"
|
29
37
|
|
30
38
|
using namespace NWindows;
|
31
|
-
|
39
|
+
|
40
|
+
#define Get16(p) GetUi16(p)
|
41
|
+
#define Get32(p) GetUi32(p)
|
32
42
|
|
33
43
|
namespace NArchive {
|
34
44
|
namespace NRar {
|
35
45
|
|
36
|
-
|
46
|
+
#define SIGNATURE { 0x52 , 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00 }
|
47
|
+
|
48
|
+
static const Byte kMarker[NHeader::kMarkerSize] = SIGNATURE;
|
49
|
+
|
50
|
+
const unsigned kPasswordLen_MAX = 127;
|
51
|
+
|
52
|
+
bool CItem::IgnoreItem() const
|
37
53
|
{
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
}
|
54
|
+
switch (HostOS)
|
55
|
+
{
|
56
|
+
case NHeader::NFile::kHostMSDOS:
|
57
|
+
case NHeader::NFile::kHostOS2:
|
58
|
+
case NHeader::NFile::kHostWin32:
|
59
|
+
return ((Attrib & NHeader::NFile::kLabelFileAttribute) != 0);
|
60
|
+
}
|
61
|
+
return false;
|
62
|
+
}
|
45
63
|
|
46
|
-
|
64
|
+
bool CItem::IsDir() const
|
65
|
+
{
|
66
|
+
if (GetDictSize() == NHeader::NFile::kDictDirectoryValue)
|
67
|
+
return true;
|
68
|
+
switch (HostOS)
|
69
|
+
{
|
70
|
+
case NHeader::NFile::kHostMSDOS:
|
71
|
+
case NHeader::NFile::kHostOS2:
|
72
|
+
case NHeader::NFile::kHostWin32:
|
73
|
+
if ((Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0)
|
74
|
+
return true;
|
75
|
+
}
|
76
|
+
return false;
|
77
|
+
}
|
47
78
|
|
48
|
-
|
79
|
+
UInt32 CItem::GetWinAttrib() const
|
80
|
+
{
|
81
|
+
UInt32 a;
|
82
|
+
switch (HostOS)
|
83
|
+
{
|
84
|
+
case NHeader::NFile::kHostMSDOS:
|
85
|
+
case NHeader::NFile::kHostOS2:
|
86
|
+
case NHeader::NFile::kHostWin32:
|
87
|
+
a = Attrib;
|
88
|
+
break;
|
89
|
+
default:
|
90
|
+
a = 0; // must be converted from unix value;
|
91
|
+
}
|
92
|
+
if (IsDir())
|
93
|
+
a |= NHeader::NFile::kWinFileDirectoryAttributeMask;
|
94
|
+
return a;
|
95
|
+
}
|
96
|
+
|
97
|
+
static const char * const kHostOS[] =
|
98
|
+
{
|
99
|
+
"MS DOS"
|
100
|
+
, "OS/2"
|
101
|
+
, "Win32"
|
102
|
+
, "Unix"
|
103
|
+
, "Mac OS"
|
104
|
+
, "BeOS"
|
105
|
+
};
|
106
|
+
|
107
|
+
static const char *kUnknownOS = "Unknown";
|
49
108
|
|
50
109
|
static const CUInt32PCharPair k_Flags[] =
|
51
110
|
{
|
@@ -61,75 +120,798 @@ static const CUInt32PCharPair k_Flags[] =
|
|
61
120
|
{ 9, "EncryptVer" }
|
62
121
|
};
|
63
122
|
|
64
|
-
|
65
|
-
{
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
123
|
+
enum EErrorType
|
124
|
+
{
|
125
|
+
k_ErrorType_OK,
|
126
|
+
k_ErrorType_Corrupted,
|
127
|
+
k_ErrorType_UnexpectedEnd,
|
128
|
+
k_ErrorType_DecryptionError
|
129
|
+
};
|
130
|
+
|
131
|
+
class CInArchive
|
132
|
+
{
|
133
|
+
IInStream *m_Stream;
|
134
|
+
UInt64 m_StreamStartPosition;
|
135
|
+
CBuffer<wchar_t> _unicodeNameBuffer;
|
136
|
+
CByteBuffer _comment;
|
137
|
+
CByteBuffer m_FileHeaderData;
|
138
|
+
NHeader::NBlock::CBlock m_BlockHeader;
|
139
|
+
NCrypto::NRar3::CDecoder *m_RarAESSpec;
|
140
|
+
CMyComPtr<ICompressFilter> m_RarAES;
|
141
|
+
CBuffer<Byte> m_DecryptedData;
|
142
|
+
Byte *m_DecryptedDataAligned;
|
143
|
+
UInt32 m_DecryptedDataSize;
|
144
|
+
bool m_CryptoMode;
|
145
|
+
UInt32 m_CryptoPos;
|
146
|
+
|
147
|
+
|
148
|
+
HRESULT ReadBytesSpec(void *data, size_t *size);
|
149
|
+
bool ReadBytesAndTestSize(void *data, UInt32 size);
|
150
|
+
void ReadName(const Byte *p, unsigned nameSize, CItem &item);
|
151
|
+
bool ReadHeaderReal(const Byte *p, unsigned size, CItem &item);
|
152
|
+
|
153
|
+
HRESULT Open2(IInStream *stream, const UInt64 *searchHeaderSizeLimit);
|
154
|
+
|
155
|
+
void AddToSeekValue(UInt64 addValue)
|
156
|
+
{
|
157
|
+
m_Position += addValue;
|
158
|
+
}
|
159
|
+
|
160
|
+
void FinishCryptoBlock()
|
161
|
+
{
|
162
|
+
if (m_CryptoMode)
|
163
|
+
while ((m_CryptoPos & 0xF) != 0)
|
164
|
+
{
|
165
|
+
m_CryptoPos++;
|
166
|
+
m_Position++;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
public:
|
171
|
+
UInt64 m_Position;
|
172
|
+
CInArcInfo ArcInfo;
|
173
|
+
bool HeaderErrorWarning;
|
174
|
+
|
175
|
+
HRESULT Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit);
|
176
|
+
HRESULT GetNextItem(CItem &item, ICryptoGetTextPassword *getTextPassword,
|
177
|
+
bool &filled, EErrorType &error);
|
178
|
+
};
|
179
|
+
|
180
|
+
static bool CheckHeaderCrc(const Byte *header, size_t headerSize)
|
181
|
+
{
|
182
|
+
return Get16(header) == (UInt16)(CrcCalc(header + 2, headerSize - 2) & 0xFFFF);
|
183
|
+
}
|
184
|
+
|
185
|
+
HRESULT CInArchive::Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit)
|
186
|
+
{
|
187
|
+
HeaderErrorWarning = false;
|
188
|
+
m_CryptoMode = false;
|
189
|
+
RINOK(stream->Seek(0, STREAM_SEEK_CUR, &m_StreamStartPosition));
|
190
|
+
RINOK(stream->Seek(0, STREAM_SEEK_END, &ArcInfo.FileSize));
|
191
|
+
RINOK(stream->Seek(m_StreamStartPosition, STREAM_SEEK_SET, NULL));
|
192
|
+
m_Position = m_StreamStartPosition;
|
193
|
+
|
194
|
+
UInt64 arcStartPos = m_StreamStartPosition;
|
195
|
+
{
|
196
|
+
Byte marker[NHeader::kMarkerSize];
|
197
|
+
RINOK(ReadStream_FALSE(stream, marker, NHeader::kMarkerSize));
|
198
|
+
if (memcmp(marker, kMarker, NHeader::kMarkerSize) == 0)
|
199
|
+
m_Position += NHeader::kMarkerSize;
|
200
|
+
else
|
201
|
+
{
|
202
|
+
if (searchHeaderSizeLimit && *searchHeaderSizeLimit == 0)
|
203
|
+
return S_FALSE;
|
204
|
+
RINOK(stream->Seek(m_StreamStartPosition, STREAM_SEEK_SET, NULL));
|
205
|
+
RINOK(FindSignatureInStream(stream, kMarker, NHeader::kMarkerSize,
|
206
|
+
searchHeaderSizeLimit, arcStartPos));
|
207
|
+
m_Position = arcStartPos + NHeader::kMarkerSize;
|
208
|
+
RINOK(stream->Seek(m_Position, STREAM_SEEK_SET, NULL));
|
209
|
+
}
|
210
|
+
}
|
211
|
+
Byte buf[NHeader::NArchive::kArchiveHeaderSize + 1];
|
212
|
+
|
213
|
+
RINOK(ReadStream_FALSE(stream, buf, NHeader::NArchive::kArchiveHeaderSize));
|
214
|
+
AddToSeekValue(NHeader::NArchive::kArchiveHeaderSize);
|
215
|
+
|
216
|
+
|
217
|
+
UInt32 blockSize = Get16(buf + 5);
|
218
|
+
|
219
|
+
ArcInfo.EncryptVersion = 0;
|
220
|
+
ArcInfo.Flags = Get16(buf + 3);
|
221
|
+
|
222
|
+
UInt32 headerSize = NHeader::NArchive::kArchiveHeaderSize;
|
223
|
+
|
224
|
+
/*
|
225
|
+
if (ArcInfo.IsThereEncryptVer())
|
226
|
+
{
|
227
|
+
if (blockSize <= headerSize)
|
228
|
+
return S_FALSE;
|
229
|
+
RINOK(ReadStream_FALSE(stream, buf + NHeader::NArchive::kArchiveHeaderSize, 1));
|
230
|
+
AddToSeekValue(1);
|
231
|
+
ArcInfo.EncryptVersion = buf[NHeader::NArchive::kArchiveHeaderSize];
|
232
|
+
headerSize += 1;
|
233
|
+
}
|
234
|
+
*/
|
235
|
+
|
236
|
+
if (blockSize < headerSize
|
237
|
+
|| buf[2] != NHeader::NBlockType::kArchiveHeader
|
238
|
+
|| !CheckHeaderCrc(buf, headerSize))
|
239
|
+
return S_FALSE;
|
240
|
+
|
241
|
+
size_t commentSize = blockSize - headerSize;
|
242
|
+
_comment.Alloc(commentSize);
|
243
|
+
RINOK(ReadStream_FALSE(stream, _comment, commentSize));
|
244
|
+
AddToSeekValue(commentSize);
|
245
|
+
m_Stream = stream;
|
246
|
+
ArcInfo.StartPos = arcStartPos;
|
247
|
+
return S_OK;
|
248
|
+
}
|
249
|
+
|
250
|
+
HRESULT CInArchive::ReadBytesSpec(void *data, size_t *resSize)
|
251
|
+
{
|
252
|
+
if (m_CryptoMode)
|
253
|
+
{
|
254
|
+
size_t size = *resSize;
|
255
|
+
*resSize = 0;
|
256
|
+
const Byte *bufData = m_DecryptedDataAligned;
|
257
|
+
UInt32 bufSize = m_DecryptedDataSize;
|
258
|
+
size_t i;
|
259
|
+
for (i = 0; i < size && m_CryptoPos < bufSize; i++)
|
260
|
+
((Byte *)data)[i] = bufData[m_CryptoPos++];
|
261
|
+
*resSize = i;
|
262
|
+
return S_OK;
|
263
|
+
}
|
264
|
+
return ReadStream(m_Stream, data, resSize);
|
265
|
+
}
|
266
|
+
|
267
|
+
bool CInArchive::ReadBytesAndTestSize(void *data, UInt32 size)
|
268
|
+
{
|
269
|
+
size_t processed = size;
|
270
|
+
if (ReadBytesSpec(data, &processed) != S_OK)
|
271
|
+
return false;
|
272
|
+
return processed == size;
|
273
|
+
}
|
274
|
+
|
275
|
+
static void DecodeUnicodeFileName(const Byte *name, const Byte *encName,
|
276
|
+
unsigned encSize, wchar_t *unicodeName, unsigned maxDecSize)
|
277
|
+
{
|
278
|
+
unsigned encPos = 0;
|
279
|
+
unsigned decPos = 0;
|
280
|
+
unsigned flagBits = 0;
|
281
|
+
Byte flags = 0;
|
282
|
+
Byte highByte = encName[encPos++];
|
283
|
+
while (encPos < encSize && decPos < maxDecSize)
|
284
|
+
{
|
285
|
+
if (flagBits == 0)
|
286
|
+
{
|
287
|
+
flags = encName[encPos++];
|
288
|
+
flagBits = 8;
|
289
|
+
}
|
290
|
+
switch (flags >> 6)
|
291
|
+
{
|
292
|
+
case 0:
|
293
|
+
unicodeName[decPos++] = encName[encPos++];
|
294
|
+
break;
|
295
|
+
case 1:
|
296
|
+
unicodeName[decPos++] = (wchar_t)(encName[encPos++] + (highByte << 8));
|
297
|
+
break;
|
298
|
+
case 2:
|
299
|
+
unicodeName[decPos++] = (wchar_t)(encName[encPos] + (encName[encPos + 1] << 8));
|
300
|
+
encPos += 2;
|
301
|
+
break;
|
302
|
+
case 3:
|
303
|
+
{
|
304
|
+
unsigned len = encName[encPos++];
|
305
|
+
if (len & 0x80)
|
306
|
+
{
|
307
|
+
Byte correction = encName[encPos++];
|
308
|
+
for (len = (len & 0x7f) + 2;
|
309
|
+
len > 0 && decPos < maxDecSize; len--, decPos++)
|
310
|
+
unicodeName[decPos] = (wchar_t)(((name[decPos] + correction) & 0xff) + (highByte << 8));
|
311
|
+
}
|
312
|
+
else
|
313
|
+
for (len += 2; len > 0 && decPos < maxDecSize; len--, decPos++)
|
314
|
+
unicodeName[decPos] = name[decPos];
|
315
|
+
}
|
316
|
+
break;
|
317
|
+
}
|
318
|
+
flags <<= 2;
|
319
|
+
flagBits -= 2;
|
320
|
+
}
|
321
|
+
unicodeName[decPos < maxDecSize ? decPos : maxDecSize - 1] = 0;
|
322
|
+
}
|
323
|
+
|
324
|
+
void CInArchive::ReadName(const Byte *p, unsigned nameSize, CItem &item)
|
325
|
+
{
|
326
|
+
item.UnicodeName.Empty();
|
327
|
+
if (nameSize > 0)
|
328
|
+
{
|
329
|
+
unsigned i;
|
330
|
+
for (i = 0; i < nameSize && p[i] != 0; i++);
|
331
|
+
item.Name.SetFrom((const char *)p, i);
|
332
|
+
|
333
|
+
if (item.HasUnicodeName())
|
334
|
+
{
|
335
|
+
if (i < nameSize)
|
336
|
+
{
|
337
|
+
i++;
|
338
|
+
unsigned uNameSizeMax = MyMin(nameSize, (unsigned)0x400);
|
339
|
+
_unicodeNameBuffer.AllocAtLeast(uNameSizeMax + 1);
|
340
|
+
DecodeUnicodeFileName(p, p + i, nameSize - i, _unicodeNameBuffer, uNameSizeMax);
|
341
|
+
item.UnicodeName = _unicodeNameBuffer;
|
342
|
+
}
|
343
|
+
else if (!ConvertUTF8ToUnicode(item.Name, item.UnicodeName))
|
344
|
+
item.UnicodeName.Empty();
|
345
|
+
}
|
346
|
+
}
|
347
|
+
else
|
348
|
+
item.Name.Empty();
|
349
|
+
}
|
350
|
+
|
351
|
+
static int ReadTime(const Byte *p, unsigned size, Byte mask, CRarTime &rarTime)
|
352
|
+
{
|
353
|
+
rarTime.LowSecond = (Byte)(((mask & 4) != 0) ? 1 : 0);
|
354
|
+
unsigned numDigits = (mask & 3);
|
355
|
+
rarTime.SubTime[0] =
|
356
|
+
rarTime.SubTime[1] =
|
357
|
+
rarTime.SubTime[2] = 0;
|
358
|
+
if (numDigits > size)
|
359
|
+
return -1;
|
360
|
+
for (unsigned i = 0; i < numDigits; i++)
|
361
|
+
rarTime.SubTime[3 - numDigits + i] = p[i];
|
362
|
+
return numDigits;
|
363
|
+
}
|
364
|
+
|
365
|
+
#define READ_TIME(_mask_, _ttt_) \
|
366
|
+
{ int size2 = ReadTime(p, size, _mask_, _ttt_); if (size2 < 0) return false; p += (unsigned)size2, size -= (unsigned)size2; }
|
367
|
+
|
368
|
+
#define READ_TIME_2(_mask_, _def_, _ttt_) \
|
369
|
+
_def_ = ((_mask_ & 8) != 0); if (_def_) \
|
370
|
+
{ if (size < 4) return false; \
|
371
|
+
_ttt_ .DosTime = Get32(p); p += 4; size -= 4; \
|
372
|
+
READ_TIME(_mask_, _ttt_); } \
|
373
|
+
|
374
|
+
|
375
|
+
bool CInArchive::ReadHeaderReal(const Byte *p, unsigned size, CItem &item)
|
376
|
+
{
|
377
|
+
const Byte *pStart = p;
|
378
|
+
|
379
|
+
item.Clear();
|
380
|
+
item.Flags = m_BlockHeader.Flags;
|
381
|
+
|
382
|
+
const unsigned kFileHeaderSize = 25;
|
383
|
+
|
384
|
+
if (size < kFileHeaderSize)
|
385
|
+
return false;
|
386
|
+
|
387
|
+
item.PackSize = Get32(p);
|
388
|
+
item.Size = Get32(p + 4);
|
389
|
+
item.HostOS = p[8];
|
390
|
+
item.FileCRC = Get32(p + 9);
|
391
|
+
item.MTime.DosTime = Get32(p + 13);
|
392
|
+
item.UnPackVersion = p[17];
|
393
|
+
item.Method = p[18];
|
394
|
+
unsigned nameSize = Get16(p + 19);
|
395
|
+
item.Attrib = Get32(p + 21);
|
396
|
+
|
397
|
+
item.MTime.LowSecond = 0;
|
398
|
+
item.MTime.SubTime[0] =
|
399
|
+
item.MTime.SubTime[1] =
|
400
|
+
item.MTime.SubTime[2] = 0;
|
401
|
+
|
402
|
+
p += kFileHeaderSize;
|
403
|
+
size -= kFileHeaderSize;
|
404
|
+
if ((item.Flags & NHeader::NFile::kSize64Bits) != 0)
|
405
|
+
{
|
406
|
+
if (size < 8)
|
407
|
+
return false;
|
408
|
+
item.PackSize |= ((UInt64)Get32(p) << 32);
|
409
|
+
item.Size |= ((UInt64)Get32(p + 4) << 32);
|
410
|
+
p += 8;
|
411
|
+
size -= 8;
|
412
|
+
}
|
413
|
+
if (nameSize > size)
|
414
|
+
return false;
|
415
|
+
ReadName(p, nameSize, item);
|
416
|
+
p += nameSize;
|
417
|
+
size -= nameSize;
|
418
|
+
|
419
|
+
/*
|
420
|
+
// It was commented, since it's difficult to support alt Streams for solid archives.
|
421
|
+
if (m_BlockHeader.Type == NHeader::NBlockType::kSubBlock)
|
422
|
+
{
|
423
|
+
if (item.HasSalt())
|
424
|
+
{
|
425
|
+
if (size < sizeof(item.Salt))
|
426
|
+
return false;
|
427
|
+
size -= sizeof(item.Salt);
|
428
|
+
p += sizeof(item.Salt);
|
429
|
+
}
|
430
|
+
if (item.Name == "ACL" && size == 0)
|
431
|
+
{
|
432
|
+
item.IsAltStream = true;
|
433
|
+
item.Name.Empty();
|
434
|
+
item.UnicodeName.SetFromAscii(".ACL");
|
435
|
+
}
|
436
|
+
else if (item.Name == "STM" && size != 0 && (size & 1) == 0)
|
437
|
+
{
|
438
|
+
item.IsAltStream = true;
|
439
|
+
item.Name.Empty();
|
440
|
+
for (UInt32 i = 0; i < size; i += 2)
|
441
|
+
{
|
442
|
+
wchar_t c = Get16(p + i);
|
443
|
+
if (c == 0)
|
444
|
+
return false;
|
445
|
+
item.UnicodeName += c;
|
446
|
+
}
|
447
|
+
}
|
448
|
+
}
|
449
|
+
*/
|
450
|
+
|
451
|
+
if (item.HasSalt())
|
452
|
+
{
|
453
|
+
if (size < sizeof(item.Salt))
|
454
|
+
return false;
|
455
|
+
for (unsigned i = 0; i < sizeof(item.Salt); i++)
|
456
|
+
item.Salt[i] = p[i];
|
457
|
+
p += sizeof(item.Salt);
|
458
|
+
size -= sizeof(item.Salt);
|
459
|
+
}
|
460
|
+
|
461
|
+
// some rar archives have HasExtTime flag without field.
|
462
|
+
if (size >= 2 && item.HasExtTime())
|
463
|
+
{
|
464
|
+
Byte aMask = (Byte)(p[0] >> 4);
|
465
|
+
Byte b = p[1];
|
466
|
+
p += 2;
|
467
|
+
size -= 2;
|
468
|
+
Byte mMask = (Byte)(b >> 4);
|
469
|
+
Byte cMask = (Byte)(b & 0xF);
|
470
|
+
if ((mMask & 8) != 0)
|
471
|
+
{
|
472
|
+
READ_TIME(mMask, item.MTime);
|
473
|
+
}
|
474
|
+
READ_TIME_2(cMask, item.CTimeDefined, item.CTime);
|
475
|
+
READ_TIME_2(aMask, item.ATimeDefined, item.ATime);
|
476
|
+
}
|
477
|
+
|
478
|
+
unsigned fileHeaderWithNameSize = 7 + (unsigned)(p - pStart);
|
479
|
+
|
480
|
+
item.Position = m_Position;
|
481
|
+
item.MainPartSize = fileHeaderWithNameSize;
|
482
|
+
item.CommentSize = (UInt16)(m_BlockHeader.HeadSize - fileHeaderWithNameSize);
|
483
|
+
|
484
|
+
if (m_CryptoMode)
|
485
|
+
item.AlignSize = (UInt16)((16 - ((m_BlockHeader.HeadSize) & 0xF)) & 0xF);
|
486
|
+
else
|
487
|
+
item.AlignSize = 0;
|
488
|
+
AddToSeekValue(m_BlockHeader.HeadSize);
|
489
|
+
|
490
|
+
// return (m_BlockHeader.Type != NHeader::NBlockType::kSubBlock || item.IsAltStream);
|
491
|
+
return true;
|
492
|
+
}
|
493
|
+
|
494
|
+
HRESULT CInArchive::GetNextItem(CItem &item, ICryptoGetTextPassword *getTextPassword, bool &filled, EErrorType &error)
|
495
|
+
{
|
496
|
+
filled = false;
|
497
|
+
error = k_ErrorType_OK;
|
498
|
+
for (;;)
|
499
|
+
{
|
500
|
+
m_Stream->Seek(m_Position, STREAM_SEEK_SET, NULL);
|
501
|
+
ArcInfo.EndPos = m_Position;
|
502
|
+
if (!m_CryptoMode && (ArcInfo.Flags &
|
503
|
+
NHeader::NArchive::kBlockHeadersAreEncrypted) != 0)
|
504
|
+
{
|
505
|
+
m_CryptoMode = false;
|
506
|
+
if (getTextPassword == 0)
|
507
|
+
{
|
508
|
+
error = k_ErrorType_DecryptionError;
|
509
|
+
return S_OK; // return S_FALSE;
|
510
|
+
}
|
511
|
+
if (!m_RarAES)
|
512
|
+
{
|
513
|
+
m_RarAESSpec = new NCrypto::NRar3::CDecoder;
|
514
|
+
m_RarAES = m_RarAESSpec;
|
515
|
+
}
|
516
|
+
// m_RarAESSpec->SetRar350Mode(ArcInfo.IsEncryptOld());
|
517
|
+
|
518
|
+
// Salt
|
519
|
+
const UInt32 kSaltSize = 8;
|
520
|
+
Byte salt[kSaltSize];
|
521
|
+
if (!ReadBytesAndTestSize(salt, kSaltSize))
|
522
|
+
return S_FALSE;
|
523
|
+
m_Position += kSaltSize;
|
524
|
+
RINOK(m_RarAESSpec->SetDecoderProperties2(salt, kSaltSize))
|
525
|
+
// Password
|
526
|
+
CMyComBSTR password;
|
527
|
+
RINOK(getTextPassword->CryptoGetTextPassword(&password))
|
528
|
+
unsigned len = 0;
|
529
|
+
if (password)
|
530
|
+
len = MyStringLen(password);
|
531
|
+
if (len > kPasswordLen_MAX)
|
532
|
+
len = kPasswordLen_MAX;
|
533
|
+
|
534
|
+
CByteArr buffer(len * 2);
|
535
|
+
for (unsigned i = 0; i < len; i++)
|
536
|
+
{
|
537
|
+
wchar_t c = password[i];
|
538
|
+
((Byte *)buffer)[i * 2] = (Byte)c;
|
539
|
+
((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8);
|
540
|
+
}
|
541
|
+
|
542
|
+
m_RarAESSpec->SetPassword((const Byte *)buffer, len * 2);
|
543
|
+
|
544
|
+
const UInt32 kDecryptedBufferSize = (1 << 12);
|
545
|
+
if (m_DecryptedData.Size() == 0)
|
546
|
+
{
|
547
|
+
const UInt32 kAlign = 16;
|
548
|
+
m_DecryptedData.Alloc(kDecryptedBufferSize + kAlign);
|
549
|
+
m_DecryptedDataAligned = (Byte *)((ptrdiff_t)((Byte *)m_DecryptedData + kAlign - 1) & ~(ptrdiff_t)(kAlign - 1));
|
550
|
+
}
|
551
|
+
RINOK(m_RarAES->Init());
|
552
|
+
size_t decryptedDataSizeT = kDecryptedBufferSize;
|
553
|
+
RINOK(ReadStream(m_Stream, m_DecryptedDataAligned, &decryptedDataSizeT));
|
554
|
+
m_DecryptedDataSize = (UInt32)decryptedDataSizeT;
|
555
|
+
m_DecryptedDataSize = m_RarAES->Filter(m_DecryptedDataAligned, m_DecryptedDataSize);
|
556
|
+
|
557
|
+
m_CryptoMode = true;
|
558
|
+
m_CryptoPos = 0;
|
559
|
+
}
|
560
|
+
|
561
|
+
m_FileHeaderData.AllocAtLeast(7);
|
562
|
+
size_t processed = 7;
|
563
|
+
RINOK(ReadBytesSpec((Byte *)m_FileHeaderData, &processed));
|
564
|
+
if (processed != 7)
|
565
|
+
{
|
566
|
+
if (processed != 0)
|
567
|
+
error = k_ErrorType_UnexpectedEnd;
|
568
|
+
ArcInfo.EndPos = m_Position + processed; // test it
|
569
|
+
return S_OK;
|
570
|
+
}
|
571
|
+
|
572
|
+
const Byte *p = m_FileHeaderData;
|
573
|
+
m_BlockHeader.CRC = Get16(p + 0);
|
574
|
+
m_BlockHeader.Type = p[2];
|
575
|
+
m_BlockHeader.Flags = Get16(p + 3);
|
576
|
+
m_BlockHeader.HeadSize = Get16(p + 5);
|
577
|
+
|
578
|
+
if (m_BlockHeader.HeadSize < 7)
|
579
|
+
{
|
580
|
+
error = k_ErrorType_Corrupted;
|
581
|
+
return S_OK;
|
582
|
+
// ThrowExceptionWithCode(CInArchiveException::kIncorrectArchive);
|
583
|
+
}
|
584
|
+
|
585
|
+
if (m_BlockHeader.Type < NHeader::NBlockType::kFileHeader ||
|
586
|
+
m_BlockHeader.Type > NHeader::NBlockType::kEndOfArchive)
|
587
|
+
{
|
588
|
+
error = m_CryptoMode ?
|
589
|
+
k_ErrorType_DecryptionError :
|
590
|
+
k_ErrorType_Corrupted;
|
591
|
+
return S_OK;
|
592
|
+
}
|
593
|
+
|
594
|
+
if (m_BlockHeader.Type == NHeader::NBlockType::kEndOfArchive)
|
595
|
+
{
|
596
|
+
bool footerError = false;
|
597
|
+
|
598
|
+
unsigned expectHeadLen = 7;
|
599
|
+
if (m_BlockHeader.Flags & NHeader::NArchive::kEndOfArc_Flags_DataCRC)
|
600
|
+
expectHeadLen += 4;
|
601
|
+
if (m_BlockHeader.Flags & NHeader::NArchive::kEndOfArc_Flags_VolNumber)
|
602
|
+
expectHeadLen += 2;
|
603
|
+
if (m_BlockHeader.Flags & NHeader::NArchive::kEndOfArc_Flags_RevSpace)
|
604
|
+
expectHeadLen += 7;
|
605
|
+
|
606
|
+
// rar 5.0 beta 1 writes incorrect RevSpace and headSize
|
607
|
+
|
608
|
+
if (m_BlockHeader.HeadSize < expectHeadLen)
|
609
|
+
HeaderErrorWarning = true;
|
610
|
+
|
611
|
+
if (m_BlockHeader.HeadSize > 7)
|
612
|
+
{
|
613
|
+
/* We suppose that EndOfArchive header is always small.
|
614
|
+
It's only 20 bytes for multivolume
|
615
|
+
Fix the limit, if larger footers are possible */
|
616
|
+
if (m_BlockHeader.HeadSize > (1 << 8))
|
617
|
+
footerError = true;
|
618
|
+
else
|
619
|
+
{
|
620
|
+
if (m_FileHeaderData.Size() < m_BlockHeader.HeadSize)
|
621
|
+
m_FileHeaderData.ChangeSize_KeepData(m_BlockHeader.HeadSize, 7);
|
622
|
+
UInt32 afterSize = m_BlockHeader.HeadSize - 7;
|
623
|
+
if (ReadBytesAndTestSize(m_FileHeaderData + 7, afterSize))
|
624
|
+
processed += afterSize;
|
625
|
+
else
|
626
|
+
{
|
627
|
+
if (!m_CryptoMode)
|
628
|
+
{
|
629
|
+
error = k_ErrorType_UnexpectedEnd;
|
630
|
+
return S_OK;
|
631
|
+
}
|
632
|
+
footerError = true;
|
633
|
+
}
|
634
|
+
}
|
635
|
+
}
|
636
|
+
|
637
|
+
if (footerError || !CheckHeaderCrc(m_FileHeaderData, m_BlockHeader.HeadSize))
|
638
|
+
{
|
639
|
+
error = m_CryptoMode ?
|
640
|
+
k_ErrorType_DecryptionError :
|
641
|
+
k_ErrorType_Corrupted;
|
642
|
+
}
|
643
|
+
else
|
644
|
+
{
|
645
|
+
ArcInfo.EndFlags = m_BlockHeader.Flags;
|
646
|
+
UInt32 offset = 7;
|
647
|
+
|
648
|
+
if (m_BlockHeader.Flags & NHeader::NArchive::kEndOfArc_Flags_DataCRC)
|
649
|
+
{
|
650
|
+
if (processed < offset + 4)
|
651
|
+
error = k_ErrorType_Corrupted;
|
652
|
+
else
|
653
|
+
ArcInfo.DataCRC = Get32(m_FileHeaderData + offset);
|
654
|
+
offset += 4;
|
655
|
+
}
|
656
|
+
|
657
|
+
if (m_BlockHeader.Flags & NHeader::NArchive::kEndOfArc_Flags_VolNumber)
|
658
|
+
{
|
659
|
+
if (processed < offset + 2)
|
660
|
+
error = k_ErrorType_Corrupted;
|
661
|
+
ArcInfo.VolNumber = (UInt32)Get16(m_FileHeaderData + offset);
|
662
|
+
}
|
663
|
+
|
664
|
+
ArcInfo.EndOfArchive_was_Read = true;
|
665
|
+
}
|
666
|
+
|
667
|
+
m_Position += processed;
|
668
|
+
FinishCryptoBlock();
|
669
|
+
ArcInfo.EndPos = m_Position;
|
670
|
+
return S_OK;
|
671
|
+
}
|
672
|
+
|
673
|
+
if (m_BlockHeader.Type == NHeader::NBlockType::kFileHeader
|
674
|
+
/* || m_BlockHeader.Type == NHeader::NBlockType::kSubBlock */)
|
675
|
+
{
|
676
|
+
if (m_FileHeaderData.Size() < m_BlockHeader.HeadSize)
|
677
|
+
m_FileHeaderData.ChangeSize_KeepData(m_BlockHeader.HeadSize, 7);
|
678
|
+
// m_CurData = (Byte *)m_FileHeaderData;
|
679
|
+
// m_PosLimit = m_BlockHeader.HeadSize;
|
680
|
+
if (!ReadBytesAndTestSize(m_FileHeaderData + 7, m_BlockHeader.HeadSize - 7))
|
681
|
+
{
|
682
|
+
error = k_ErrorType_UnexpectedEnd;
|
683
|
+
return S_OK;
|
684
|
+
}
|
685
|
+
|
686
|
+
bool okItem = ReadHeaderReal(m_FileHeaderData + 7, m_BlockHeader.HeadSize - 7, item);
|
687
|
+
if (okItem)
|
688
|
+
{
|
689
|
+
if (!CheckHeaderCrc(m_FileHeaderData, (unsigned)m_BlockHeader.HeadSize - item.CommentSize))
|
690
|
+
{
|
691
|
+
error = k_ErrorType_Corrupted; // ThrowExceptionWithCode(CInArchiveException::kFileHeaderCRCError);
|
692
|
+
return S_OK;
|
693
|
+
}
|
694
|
+
filled = true;
|
695
|
+
}
|
696
|
+
|
697
|
+
FinishCryptoBlock();
|
698
|
+
m_CryptoMode = false;
|
699
|
+
// Move Position to compressed Data;
|
700
|
+
m_Stream->Seek(m_Position, STREAM_SEEK_SET, NULL);
|
701
|
+
AddToSeekValue(item.PackSize); // m_Position points to next header;
|
702
|
+
// if (okItem)
|
703
|
+
return S_OK;
|
704
|
+
/*
|
705
|
+
else
|
706
|
+
continue;
|
707
|
+
*/
|
708
|
+
}
|
709
|
+
|
710
|
+
if (m_CryptoMode && m_BlockHeader.HeadSize > (1 << 10))
|
711
|
+
{
|
712
|
+
error = k_ErrorType_DecryptionError;
|
713
|
+
return S_OK;
|
714
|
+
}
|
715
|
+
|
716
|
+
if ((m_BlockHeader.Flags & NHeader::NBlock::kLongBlock) != 0)
|
717
|
+
{
|
718
|
+
if (m_FileHeaderData.Size() < 7 + 4)
|
719
|
+
m_FileHeaderData.ChangeSize_KeepData(7 + 4, 7);
|
720
|
+
if (!ReadBytesAndTestSize(m_FileHeaderData + 7, 4))
|
721
|
+
{
|
722
|
+
error = k_ErrorType_UnexpectedEnd;
|
723
|
+
return S_OK;
|
724
|
+
}
|
725
|
+
UInt32 dataSize = Get32(m_FileHeaderData + 7);
|
726
|
+
AddToSeekValue(dataSize);
|
727
|
+
if (m_CryptoMode && dataSize > (1 << 27))
|
728
|
+
{
|
729
|
+
error = k_ErrorType_DecryptionError;
|
730
|
+
return S_OK;
|
731
|
+
}
|
732
|
+
m_CryptoPos = m_BlockHeader.HeadSize;
|
733
|
+
}
|
734
|
+
else
|
735
|
+
m_CryptoPos = 0;
|
736
|
+
|
737
|
+
{
|
738
|
+
UInt64 newPos = m_Position + m_BlockHeader.HeadSize;
|
739
|
+
if (newPos > ArcInfo.FileSize)
|
740
|
+
{
|
741
|
+
error = k_ErrorType_UnexpectedEnd;
|
742
|
+
return S_OK;
|
743
|
+
}
|
744
|
+
}
|
745
|
+
AddToSeekValue(m_BlockHeader.HeadSize);
|
746
|
+
FinishCryptoBlock();
|
747
|
+
m_CryptoMode = false;
|
748
|
+
}
|
749
|
+
}
|
750
|
+
|
751
|
+
|
752
|
+
static const Byte kProps[] =
|
753
|
+
{
|
754
|
+
kpidPath,
|
755
|
+
kpidIsDir,
|
756
|
+
kpidSize,
|
757
|
+
kpidPackSize,
|
758
|
+
kpidMTime,
|
759
|
+
kpidCTime,
|
760
|
+
kpidATime,
|
761
|
+
kpidAttrib,
|
762
|
+
|
763
|
+
kpidEncrypted,
|
764
|
+
kpidSolid,
|
765
|
+
kpidCommented,
|
766
|
+
kpidSplitBefore,
|
767
|
+
kpidSplitAfter,
|
768
|
+
kpidCRC,
|
769
|
+
kpidHostOS,
|
770
|
+
kpidMethod,
|
771
|
+
kpidUnpackVer
|
84
772
|
};
|
85
773
|
|
86
|
-
static const
|
774
|
+
static const Byte kArcProps[] =
|
87
775
|
{
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
776
|
+
kpidTotalPhySize,
|
777
|
+
kpidCharacts,
|
778
|
+
kpidSolid,
|
779
|
+
kpidNumBlocks,
|
780
|
+
// kpidEncrypted,
|
781
|
+
kpidIsVolume,
|
782
|
+
kpidVolumeIndex,
|
783
|
+
kpidNumVolumes
|
784
|
+
// kpidCommented
|
96
785
|
};
|
97
786
|
|
98
787
|
IMP_IInArchive_Props
|
99
788
|
IMP_IInArchive_ArcProps
|
100
789
|
|
101
|
-
UInt64 CHandler::GetPackSize(
|
790
|
+
UInt64 CHandler::GetPackSize(unsigned refIndex) const
|
102
791
|
{
|
103
792
|
const CRefItem &refItem = _refItems[refIndex];
|
104
793
|
UInt64 totalPackSize = 0;
|
105
|
-
for (
|
794
|
+
for (unsigned i = 0; i < refItem.NumItems; i++)
|
106
795
|
totalPackSize += _items[refItem.ItemIndex + i].PackSize;
|
107
796
|
return totalPackSize;
|
108
797
|
}
|
109
798
|
|
799
|
+
bool CHandler::IsSolid(unsigned refIndex) const
|
800
|
+
{
|
801
|
+
const CItem &item = _items[_refItems[refIndex].ItemIndex];
|
802
|
+
if (item.UnPackVersion < 20)
|
803
|
+
{
|
804
|
+
if (_arcInfo.IsSolid())
|
805
|
+
return (refIndex > 0);
|
806
|
+
return false;
|
807
|
+
}
|
808
|
+
return item.IsSolid();
|
809
|
+
}
|
810
|
+
|
110
811
|
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
111
812
|
{
|
112
813
|
COM_TRY_BEGIN
|
113
|
-
|
114
|
-
switch(propID)
|
814
|
+
NCOM::CPropVariant prop;
|
815
|
+
switch (propID)
|
115
816
|
{
|
116
|
-
case
|
117
|
-
case
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
817
|
+
case kpidVolumeIndex: if (_arcInfo.Is_VolNumber_Defined()) prop = (UInt32)_arcInfo.VolNumber; break;
|
818
|
+
case kpidSolid: prop = _arcInfo.IsSolid(); break;
|
819
|
+
case kpidCharacts:
|
820
|
+
{
|
821
|
+
AString s = FlagsToString(k_Flags, ARRAY_SIZE(k_Flags), _arcInfo.Flags);
|
822
|
+
// FLAGS_TO_PROP(k_Flags, _arcInfo.Flags, prop);
|
823
|
+
if (_arcInfo.Is_DataCRC_Defined())
|
824
|
+
{
|
825
|
+
s.Add_Space_if_NotEmpty();
|
826
|
+
s += "VolCRC";
|
827
|
+
}
|
828
|
+
prop = s;
|
829
|
+
break;
|
830
|
+
}
|
831
|
+
// case kpidEncrypted: prop = _arcInfo.IsEncrypted(); break; // it's for encrypted names.
|
832
|
+
case kpidIsVolume: prop = _arcInfo.IsVolume(); break;
|
833
|
+
case kpidNumVolumes: prop = (UInt32)_arcs.Size(); break;
|
834
|
+
case kpidOffset: if (_arcs.Size() == 1 && _arcInfo.StartPos != 0) prop = _arcInfo.StartPos; break;
|
835
|
+
|
836
|
+
case kpidTotalPhySize:
|
837
|
+
{
|
838
|
+
if (_arcs.Size() > 1)
|
839
|
+
{
|
840
|
+
UInt64 sum = 0;
|
841
|
+
FOR_VECTOR (v, _arcs)
|
842
|
+
sum += _arcs[v].PhySize;
|
843
|
+
prop = sum;
|
844
|
+
}
|
845
|
+
break;
|
846
|
+
}
|
847
|
+
|
848
|
+
case kpidPhySize:
|
849
|
+
{
|
850
|
+
if (_arcs.Size() != 0)
|
851
|
+
prop = _arcInfo.GetPhySize();
|
852
|
+
break;
|
853
|
+
}
|
854
|
+
|
855
|
+
// case kpidCommented: prop = _arcInfo.IsCommented(); break;
|
856
|
+
|
123
857
|
case kpidNumBlocks:
|
124
858
|
{
|
125
859
|
UInt32 numBlocks = 0;
|
126
|
-
|
860
|
+
FOR_VECTOR (i, _refItems)
|
127
861
|
if (!IsSolid(i))
|
128
862
|
numBlocks++;
|
129
863
|
prop = (UInt32)numBlocks;
|
130
864
|
break;
|
131
865
|
}
|
132
|
-
|
866
|
+
|
867
|
+
|
868
|
+
case kpidError:
|
869
|
+
{
|
870
|
+
// if (!_errorMessage.IsEmpty()) prop = _errorMessage; break;
|
871
|
+
|
872
|
+
if (/* &_missingVol || */ !_missingVolName.IsEmpty())
|
873
|
+
{
|
874
|
+
UString s;
|
875
|
+
s.SetFromAscii("Missing volume : ");
|
876
|
+
s += _missingVolName;
|
877
|
+
prop = s;
|
878
|
+
}
|
879
|
+
break;
|
880
|
+
}
|
881
|
+
|
882
|
+
case kpidErrorFlags:
|
883
|
+
{
|
884
|
+
UInt32 v = _errorFlags;
|
885
|
+
if (!_isArc)
|
886
|
+
v |= kpv_ErrorFlags_IsNotArc;
|
887
|
+
prop = v;
|
888
|
+
break;
|
889
|
+
}
|
890
|
+
|
891
|
+
case kpidWarningFlags:
|
892
|
+
{
|
893
|
+
if (_warningFlags != 0)
|
894
|
+
prop = _warningFlags;
|
895
|
+
break;
|
896
|
+
}
|
897
|
+
|
898
|
+
case kpidExtension:
|
899
|
+
if (_arcs.Size() == 1)
|
900
|
+
{
|
901
|
+
if (_arcInfo.Is_VolNumber_Defined())
|
902
|
+
{
|
903
|
+
char sz[16];
|
904
|
+
ConvertUInt32ToString((UInt32)_arcInfo.VolNumber + 1, sz);
|
905
|
+
unsigned len = MyStringLen(sz);
|
906
|
+
AString s = "part";
|
907
|
+
for (; len < 2; len++)
|
908
|
+
s += '0';
|
909
|
+
s += sz;
|
910
|
+
s += ".rar";
|
911
|
+
prop = s;
|
912
|
+
}
|
913
|
+
}
|
914
|
+
break;
|
133
915
|
}
|
134
916
|
prop.Detach(value);
|
135
917
|
return S_OK;
|
@@ -144,7 +926,7 @@ STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
|
|
144
926
|
|
145
927
|
static bool RarTimeToFileTime(const CRarTime &rarTime, FILETIME &result)
|
146
928
|
{
|
147
|
-
if (!DosTimeToFileTime(rarTime.DosTime, result))
|
929
|
+
if (!NTime::DosTimeToFileTime(rarTime.DosTime, result))
|
148
930
|
return false;
|
149
931
|
UInt64 value = (((UInt64)result.dwHighDateTime) << 32) + result.dwLowDateTime;
|
150
932
|
value += (UInt64)rarTime.LowSecond * 10000000;
|
@@ -156,7 +938,7 @@ static bool RarTimeToFileTime(const CRarTime &rarTime, FILETIME &result)
|
|
156
938
|
return true;
|
157
939
|
}
|
158
940
|
|
159
|
-
static void RarTimeToProp(const CRarTime &rarTime,
|
941
|
+
static void RarTimeToProp(const CRarTime &rarTime, NCOM::CPropVariant &prop)
|
160
942
|
{
|
161
943
|
FILETIME localFileTime, utcFileTime;
|
162
944
|
if (RarTimeToFileTime(rarTime, localFileTime))
|
@@ -169,31 +951,39 @@ static void RarTimeToProp(const CRarTime &rarTime, NWindows::NCOM::CPropVariant
|
|
169
951
|
prop = utcFileTime;
|
170
952
|
}
|
171
953
|
|
172
|
-
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID,
|
954
|
+
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
|
173
955
|
{
|
174
956
|
COM_TRY_BEGIN
|
175
|
-
|
957
|
+
NCOM::CPropVariant prop;
|
176
958
|
const CRefItem &refItem = _refItems[index];
|
177
|
-
const
|
178
|
-
|
959
|
+
const CItem &item = _items[refItem.ItemIndex];
|
960
|
+
const CItem &lastItem = _items[refItem.ItemIndex + refItem.NumItems - 1];
|
961
|
+
|
962
|
+
/*
|
963
|
+
const CItem *mainItem = &item;
|
964
|
+
if (item.BaseFileIndex >= 0)
|
965
|
+
mainItem = &_items[_refItems[item.BaseFileIndex].ItemIndex];
|
966
|
+
*/
|
967
|
+
switch (propID)
|
179
968
|
{
|
180
969
|
case kpidPath:
|
181
970
|
{
|
971
|
+
/*
|
182
972
|
UString u;
|
183
|
-
if (item.
|
184
|
-
u =
|
185
|
-
|
186
|
-
|
187
|
-
prop = (const wchar_t *)NItemName::WinNameToOSName(
|
973
|
+
if (item.BaseFileIndex >= 0)
|
974
|
+
u = mainItem->GetName();
|
975
|
+
u += item.GetName();
|
976
|
+
*/
|
977
|
+
prop = (const wchar_t *)NItemName::WinNameToOSName(item.GetName());
|
188
978
|
break;
|
189
979
|
}
|
190
980
|
case kpidIsDir: prop = item.IsDir(); break;
|
191
|
-
case kpidSize: prop =
|
981
|
+
case kpidSize: if (lastItem.Is_Size_Defined()) prop = lastItem.Size; break;
|
192
982
|
case kpidPackSize: prop = GetPackSize(index); break;
|
193
983
|
case kpidMTime: RarTimeToProp(item.MTime, prop); break;
|
194
984
|
case kpidCTime: if (item.CTimeDefined) RarTimeToProp(item.CTime, prop); break;
|
195
985
|
case kpidATime: if (item.ATimeDefined) RarTimeToProp(item.ATime, prop); break;
|
196
|
-
case kpidAttrib: prop = item.
|
986
|
+
case kpidAttrib: prop = item.GetWinAttrib(); break;
|
197
987
|
case kpidEncrypted: prop = item.IsEncrypted(); break;
|
198
988
|
case kpidSolid: prop = IsSolid(index); break;
|
199
989
|
case kpidCommented: prop = item.IsCommented(); break;
|
@@ -201,144 +991,37 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
|
|
201
991
|
case kpidSplitAfter: prop = _items[refItem.ItemIndex + refItem.NumItems - 1].IsSplitAfter(); break;
|
202
992
|
case kpidCRC:
|
203
993
|
{
|
204
|
-
const CItemEx &lastItem = _items[refItem.ItemIndex + refItem.NumItems - 1];
|
205
994
|
prop = ((lastItem.IsSplitAfter()) ? item.FileCRC : lastItem.FileCRC);
|
206
995
|
break;
|
207
996
|
}
|
208
997
|
case kpidUnpackVer: prop = item.UnPackVersion; break;
|
209
998
|
case kpidMethod:
|
210
999
|
{
|
211
|
-
|
212
|
-
|
1000
|
+
char s[16];
|
1001
|
+
Byte m = item.Method;
|
1002
|
+
if (m < (Byte)'0' || m > (Byte)'5')
|
1003
|
+
ConvertUInt32ToString(m, s);
|
1004
|
+
else
|
213
1005
|
{
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
method += temp;
|
1006
|
+
s[0] = 'm';
|
1007
|
+
s[1] = (char)m;
|
1008
|
+
s[2] = 0;
|
218
1009
|
if (!item.IsDir())
|
219
1010
|
{
|
220
|
-
|
221
|
-
|
222
|
-
method += temp;
|
1011
|
+
s[2] = ':';
|
1012
|
+
ConvertUInt32ToString(16 + item.GetDictSize(), &s[3]);
|
223
1013
|
}
|
224
1014
|
}
|
225
|
-
|
226
|
-
{
|
227
|
-
wchar_t temp[32];
|
228
|
-
ConvertUInt64ToString(item.Method, temp);
|
229
|
-
method += temp;
|
230
|
-
}
|
231
|
-
prop = method;
|
1015
|
+
prop = s;
|
232
1016
|
break;
|
233
1017
|
}
|
234
|
-
case kpidHostOS: prop = (item.HostOS <
|
1018
|
+
case kpidHostOS: prop = (item.HostOS < ARRAY_SIZE(kHostOS)) ? kHostOS[item.HostOS] : kUnknownOS; break;
|
235
1019
|
}
|
236
1020
|
prop.Detach(value);
|
237
1021
|
return S_OK;
|
238
1022
|
COM_TRY_END
|
239
1023
|
}
|
240
1024
|
|
241
|
-
class CVolumeName
|
242
|
-
{
|
243
|
-
bool _first;
|
244
|
-
bool _newStyle;
|
245
|
-
UString _unchangedPart;
|
246
|
-
UString _changedPart;
|
247
|
-
UString _afterPart;
|
248
|
-
public:
|
249
|
-
CVolumeName(): _newStyle(true) {};
|
250
|
-
|
251
|
-
bool InitName(const UString &name, bool newStyle)
|
252
|
-
{
|
253
|
-
_first = true;
|
254
|
-
_newStyle = newStyle;
|
255
|
-
int dotPos = name.ReverseFind('.');
|
256
|
-
UString basePart = name;
|
257
|
-
if (dotPos >= 0)
|
258
|
-
{
|
259
|
-
UString ext = name.Mid(dotPos + 1);
|
260
|
-
if (ext.CompareNoCase(L"rar") == 0)
|
261
|
-
{
|
262
|
-
_afterPart = name.Mid(dotPos);
|
263
|
-
basePart = name.Left(dotPos);
|
264
|
-
}
|
265
|
-
else if (ext.CompareNoCase(L"exe") == 0)
|
266
|
-
{
|
267
|
-
_afterPart = L".rar";
|
268
|
-
basePart = name.Left(dotPos);
|
269
|
-
}
|
270
|
-
else if (!_newStyle)
|
271
|
-
{
|
272
|
-
if (ext.CompareNoCase(L"000") == 0 ||
|
273
|
-
ext.CompareNoCase(L"001") == 0 ||
|
274
|
-
ext.CompareNoCase(L"r00") == 0 ||
|
275
|
-
ext.CompareNoCase(L"r01") == 0)
|
276
|
-
{
|
277
|
-
_afterPart.Empty();
|
278
|
-
_first = false;
|
279
|
-
_changedPart = ext;
|
280
|
-
_unchangedPart = name.Left(dotPos + 1);
|
281
|
-
return true;
|
282
|
-
}
|
283
|
-
}
|
284
|
-
}
|
285
|
-
|
286
|
-
if (!_newStyle)
|
287
|
-
{
|
288
|
-
_afterPart.Empty();
|
289
|
-
_unchangedPart = basePart + UString(L".");
|
290
|
-
_changedPart = L"r00";
|
291
|
-
return true;
|
292
|
-
}
|
293
|
-
|
294
|
-
int numLetters = 1;
|
295
|
-
if (basePart.Right(numLetters) == L"1" || basePart.Right(numLetters) == L"0")
|
296
|
-
{
|
297
|
-
while (numLetters < basePart.Length())
|
298
|
-
{
|
299
|
-
if (basePart[basePart.Length() - numLetters - 1] != '0')
|
300
|
-
break;
|
301
|
-
numLetters++;
|
302
|
-
}
|
303
|
-
}
|
304
|
-
else
|
305
|
-
return false;
|
306
|
-
_unchangedPart = basePart.Left(basePart.Length() - numLetters);
|
307
|
-
_changedPart = basePart.Right(numLetters);
|
308
|
-
return true;
|
309
|
-
}
|
310
|
-
|
311
|
-
UString GetNextName()
|
312
|
-
{
|
313
|
-
UString newName;
|
314
|
-
if (_newStyle || !_first)
|
315
|
-
{
|
316
|
-
int i;
|
317
|
-
int numLetters = _changedPart.Length();
|
318
|
-
for (i = numLetters - 1; i >= 0; i--)
|
319
|
-
{
|
320
|
-
wchar_t c = _changedPart[i];
|
321
|
-
if (c == L'9')
|
322
|
-
{
|
323
|
-
c = L'0';
|
324
|
-
newName = c + newName;
|
325
|
-
if (i == 0)
|
326
|
-
newName = UString(L'1') + newName;
|
327
|
-
continue;
|
328
|
-
}
|
329
|
-
c++;
|
330
|
-
newName = UString(c) + newName;
|
331
|
-
i--;
|
332
|
-
for (; i >= 0; i--)
|
333
|
-
newName = _changedPart[i] + newName;
|
334
|
-
break;
|
335
|
-
}
|
336
|
-
_changedPart = newName;
|
337
|
-
}
|
338
|
-
_first = false;
|
339
|
-
return _unchangedPart + _changedPart + _afterPart;
|
340
|
-
}
|
341
|
-
};
|
342
1025
|
|
343
1026
|
HRESULT CHandler::Open2(IInStream *stream,
|
344
1027
|
const UInt64 *maxCheckStartPosition,
|
@@ -347,7 +1030,6 @@ HRESULT CHandler::Open2(IInStream *stream,
|
|
347
1030
|
{
|
348
1031
|
CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
|
349
1032
|
CMyComPtr<ICryptoGetTextPassword> getTextPassword;
|
350
|
-
CMyComPtr<IArchiveOpenCallback> openArchiveCallbackWrap = openCallback;
|
351
1033
|
|
352
1034
|
CVolumeName seqName;
|
353
1035
|
|
@@ -356,21 +1038,25 @@ HRESULT CHandler::Open2(IInStream *stream,
|
|
356
1038
|
|
357
1039
|
if (openCallback)
|
358
1040
|
{
|
359
|
-
|
360
|
-
|
1041
|
+
openCallback->QueryInterface(IID_IArchiveOpenVolumeCallback, (void **)&openVolumeCallback);
|
1042
|
+
openCallback->QueryInterface(IID_ICryptoGetTextPassword, (void **)&getTextPassword);
|
361
1043
|
}
|
362
1044
|
|
1045
|
+
bool nextVol_is_Required = false;
|
1046
|
+
|
1047
|
+
CInArchive archive;
|
1048
|
+
|
363
1049
|
for (;;)
|
364
1050
|
{
|
365
1051
|
CMyComPtr<IInStream> inStream;
|
366
|
-
if (!
|
1052
|
+
if (!_arcs.IsEmpty())
|
367
1053
|
{
|
368
1054
|
if (!openVolumeCallback)
|
369
1055
|
break;
|
370
1056
|
|
371
|
-
if (
|
1057
|
+
if (_arcs.Size() == 1)
|
372
1058
|
{
|
373
|
-
if (!
|
1059
|
+
if (!_arcInfo.IsVolume())
|
374
1060
|
break;
|
375
1061
|
UString baseName;
|
376
1062
|
{
|
@@ -380,60 +1066,99 @@ HRESULT CHandler::Open2(IInStream *stream,
|
|
380
1066
|
break;
|
381
1067
|
baseName = prop.bstrVal;
|
382
1068
|
}
|
383
|
-
seqName.InitName(baseName,
|
1069
|
+
if (!seqName.InitName(baseName, _arcInfo.HaveNewVolumeName()))
|
1070
|
+
break;
|
1071
|
+
/*
|
1072
|
+
if (_arcInfo.HaveNewVolumeName() && !_arcInfo.IsFirstVolume())
|
1073
|
+
{
|
1074
|
+
seqName.MakeBeforeFirstName();
|
1075
|
+
}
|
1076
|
+
*/
|
384
1077
|
}
|
385
1078
|
|
386
|
-
UString
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
if (result != S_OK)
|
1079
|
+
const UString volName = seqName.GetNextName();
|
1080
|
+
|
1081
|
+
HRESULT result = openVolumeCallback->GetStream(volName, &inStream);
|
1082
|
+
|
1083
|
+
if (result != S_OK && result != S_FALSE)
|
391
1084
|
return result;
|
392
|
-
|
1085
|
+
|
1086
|
+
if (!inStream || result != S_OK)
|
1087
|
+
{
|
1088
|
+
if (nextVol_is_Required)
|
1089
|
+
_missingVolName = volName;
|
393
1090
|
break;
|
1091
|
+
}
|
394
1092
|
}
|
395
1093
|
else
|
396
1094
|
inStream = stream;
|
397
1095
|
|
398
1096
|
UInt64 endPos = 0;
|
399
|
-
RINOK(
|
400
|
-
RINOK(
|
1097
|
+
RINOK(inStream->Seek(0, STREAM_SEEK_END, &endPos));
|
1098
|
+
RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
|
401
1099
|
if (openCallback)
|
402
1100
|
{
|
403
1101
|
totalBytes += endPos;
|
404
1102
|
RINOK(openCallback->SetTotal(NULL, &totalBytes));
|
405
1103
|
}
|
406
1104
|
|
407
|
-
NArchive::NRar::CInArchive archive;
|
408
1105
|
RINOK(archive.Open(inStream, maxCheckStartPosition));
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
CItemEx item;
|
1106
|
+
_isArc = true;
|
1107
|
+
CItem item;
|
1108
|
+
|
414
1109
|
for (;;)
|
415
1110
|
{
|
416
1111
|
if (archive.m_Position > endPos)
|
417
1112
|
{
|
418
|
-
|
1113
|
+
_errorFlags |= kpv_ErrorFlags_UnexpectedEnd;
|
419
1114
|
break;
|
420
1115
|
}
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
1116
|
+
|
1117
|
+
EErrorType error;
|
1118
|
+
// bool decryptionError;
|
1119
|
+
// AString errorMessageLoc;
|
1120
|
+
bool filled;
|
1121
|
+
HRESULT result = archive.GetNextItem(item, getTextPassword, filled, error);
|
1122
|
+
|
1123
|
+
if (error != k_ErrorType_OK)
|
1124
|
+
{
|
1125
|
+
if (error == k_ErrorType_UnexpectedEnd)
|
1126
|
+
_errorFlags |= kpv_ErrorFlags_UnexpectedEnd;
|
1127
|
+
else if (error == k_ErrorType_Corrupted)
|
1128
|
+
_errorFlags |= kpv_ErrorFlags_HeadersError;
|
1129
|
+
else if (error == k_ErrorType_DecryptionError)
|
1130
|
+
_errorFlags |= kpv_ErrorFlags_EncryptedHeadersError;
|
1131
|
+
|
1132
|
+
// AddErrorMessage(errorMessageLoc);
|
1133
|
+
}
|
1134
|
+
RINOK(result);
|
1135
|
+
|
1136
|
+
if (!filled)
|
427
1137
|
{
|
428
|
-
if (
|
1138
|
+
if (error == k_ErrorType_DecryptionError && _items.IsEmpty())
|
429
1139
|
return S_FALSE;
|
1140
|
+
|
1141
|
+
if (archive.ArcInfo.ExtraZeroTail_is_Possible())
|
1142
|
+
{
|
1143
|
+
/* if there is recovery record for multivolume archive,
|
1144
|
+
RAR adds 18 bytes (ZERO bytes) at the end for alignment.
|
1145
|
+
We must skip these bytes to prevent phySize warning. */
|
1146
|
+
RINOK(inStream->Seek(archive.ArcInfo.EndPos, STREAM_SEEK_SET, NULL));
|
1147
|
+
bool areThereNonZeros;
|
1148
|
+
UInt64 numZeros;
|
1149
|
+
const UInt64 maxSize = 1 << 12;
|
1150
|
+
RINOK(ReadZeroTail(inStream, areThereNonZeros, numZeros, maxSize));
|
1151
|
+
if (!areThereNonZeros && numZeros != 0 && numZeros <= maxSize)
|
1152
|
+
archive.ArcInfo.EndPos += numZeros;
|
1153
|
+
}
|
430
1154
|
break;
|
431
1155
|
}
|
432
|
-
|
1156
|
+
|
433
1157
|
if (item.IgnoreItem())
|
434
1158
|
continue;
|
435
1159
|
|
436
1160
|
bool needAdd = true;
|
1161
|
+
|
437
1162
|
if (item.IsSplitBefore())
|
438
1163
|
{
|
439
1164
|
if (!_refItems.IsEmpty())
|
@@ -443,15 +1168,18 @@ HRESULT CHandler::Open2(IInStream *stream,
|
|
443
1168
|
needAdd = false;
|
444
1169
|
}
|
445
1170
|
}
|
1171
|
+
|
446
1172
|
if (needAdd)
|
447
1173
|
{
|
448
1174
|
CRefItem refItem;
|
449
1175
|
refItem.ItemIndex = _items.Size();
|
450
1176
|
refItem.NumItems = 1;
|
451
|
-
refItem.VolumeIndex =
|
1177
|
+
refItem.VolumeIndex = _arcs.Size();
|
452
1178
|
_refItems.Add(refItem);
|
453
1179
|
}
|
1180
|
+
|
454
1181
|
_items.Add(item);
|
1182
|
+
|
455
1183
|
if (openCallback && _items.Size() % 100 == 0)
|
456
1184
|
{
|
457
1185
|
UInt64 numFiles = _items.Size();
|
@@ -459,10 +1187,50 @@ HRESULT CHandler::Open2(IInStream *stream,
|
|
459
1187
|
RINOK(openCallback->SetCompleted(&numFiles, &numBytes));
|
460
1188
|
}
|
461
1189
|
}
|
1190
|
+
|
1191
|
+
if (archive.HeaderErrorWarning)
|
1192
|
+
_warningFlags |= kpv_ErrorFlags_HeadersError;
|
1193
|
+
|
1194
|
+
/*
|
1195
|
+
if (archive.m_Position < endPos)
|
1196
|
+
_warningFlags |= kpv_ErrorFlags_DataAfterEnd;
|
1197
|
+
*/
|
1198
|
+
if (_arcs.IsEmpty())
|
1199
|
+
_arcInfo = archive.ArcInfo;
|
1200
|
+
// _arcInfo.EndPos = archive.EndPos;
|
1201
|
+
|
462
1202
|
curBytes += endPos;
|
463
|
-
|
1203
|
+
{
|
1204
|
+
CArc &arc = _arcs.AddNew();
|
1205
|
+
arc.PhySize = archive.ArcInfo.GetPhySize();
|
1206
|
+
arc.Stream = inStream;
|
1207
|
+
}
|
1208
|
+
|
1209
|
+
nextVol_is_Required = false;
|
1210
|
+
|
1211
|
+
if (!archive.ArcInfo.IsVolume())
|
1212
|
+
break;
|
1213
|
+
|
1214
|
+
if (archive.ArcInfo.EndOfArchive_was_Read)
|
1215
|
+
{
|
1216
|
+
if (!archive.ArcInfo.AreMoreVolumes())
|
1217
|
+
break;
|
1218
|
+
nextVol_is_Required = true;
|
1219
|
+
}
|
464
1220
|
}
|
465
1221
|
}
|
1222
|
+
|
1223
|
+
/*
|
1224
|
+
int baseFileIndex = -1;
|
1225
|
+
for (unsigned i = 0; i < _refItems.Size(); i++)
|
1226
|
+
{
|
1227
|
+
CItem &item = _items[_refItems[i].ItemIndex];
|
1228
|
+
if (item.IsAltStream)
|
1229
|
+
item.BaseFileIndex = baseFileIndex;
|
1230
|
+
else
|
1231
|
+
baseFileIndex = i;
|
1232
|
+
}
|
1233
|
+
*/
|
466
1234
|
return S_OK;
|
467
1235
|
}
|
468
1236
|
|
@@ -472,25 +1240,32 @@ STDMETHODIMP CHandler::Open(IInStream *stream,
|
|
472
1240
|
{
|
473
1241
|
COM_TRY_BEGIN
|
474
1242
|
Close();
|
475
|
-
try
|
1243
|
+
// try
|
476
1244
|
{
|
477
1245
|
HRESULT res = Open2(stream, maxCheckStartPosition, openCallback);
|
1246
|
+
/*
|
478
1247
|
if (res != S_OK)
|
479
1248
|
Close();
|
1249
|
+
*/
|
1250
|
+
|
480
1251
|
return res;
|
481
1252
|
}
|
482
|
-
catch(const CInArchiveException &) { Close(); return S_FALSE; }
|
483
|
-
catch(...) { Close(); throw; }
|
1253
|
+
// catch(const CInArchiveException &) { Close(); return S_FALSE; }
|
1254
|
+
// catch(...) { Close(); throw; }
|
484
1255
|
COM_TRY_END
|
485
1256
|
}
|
486
1257
|
|
487
1258
|
STDMETHODIMP CHandler::Close()
|
488
1259
|
{
|
489
1260
|
COM_TRY_BEGIN
|
490
|
-
_errorMessage.Empty();
|
1261
|
+
// _errorMessage.Empty();
|
1262
|
+
_missingVolName.Empty();
|
1263
|
+
_errorFlags = 0;
|
1264
|
+
_warningFlags = 0;
|
1265
|
+
_isArc = false;
|
491
1266
|
_refItems.Clear();
|
492
1267
|
_items.Clear();
|
493
|
-
|
1268
|
+
_arcs.Clear();
|
494
1269
|
return S_OK;
|
495
1270
|
COM_TRY_END
|
496
1271
|
}
|
@@ -502,6 +1277,94 @@ struct CMethodItem
|
|
502
1277
|
};
|
503
1278
|
|
504
1279
|
|
1280
|
+
class CVolsInStream:
|
1281
|
+
public ISequentialInStream,
|
1282
|
+
public CMyUnknownImp
|
1283
|
+
{
|
1284
|
+
UInt64 _rem;
|
1285
|
+
ISequentialInStream *_stream;
|
1286
|
+
const CObjectVector<CArc> *_arcs;
|
1287
|
+
const CObjectVector<CItem> *_items;
|
1288
|
+
CRefItem _refItem;
|
1289
|
+
unsigned _curIndex;
|
1290
|
+
UInt32 _crc;
|
1291
|
+
bool _calcCrc;
|
1292
|
+
|
1293
|
+
public:
|
1294
|
+
MY_UNKNOWN_IMP
|
1295
|
+
|
1296
|
+
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
|
1297
|
+
|
1298
|
+
void Init(const CObjectVector<CArc> *arcs,
|
1299
|
+
const CObjectVector<CItem> *items,
|
1300
|
+
const CRefItem &refItem)
|
1301
|
+
{
|
1302
|
+
_arcs = arcs;
|
1303
|
+
_items = items;
|
1304
|
+
_refItem = refItem;
|
1305
|
+
_curIndex = 0;
|
1306
|
+
_stream = NULL;
|
1307
|
+
CrcIsOK = true;
|
1308
|
+
}
|
1309
|
+
|
1310
|
+
bool CrcIsOK;
|
1311
|
+
};
|
1312
|
+
|
1313
|
+
|
1314
|
+
STDMETHODIMP CVolsInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
1315
|
+
{
|
1316
|
+
if (processedSize)
|
1317
|
+
*processedSize = 0;
|
1318
|
+
UInt32 realProcessedSize = 0;
|
1319
|
+
|
1320
|
+
while (size != 0)
|
1321
|
+
{
|
1322
|
+
if (!_stream)
|
1323
|
+
{
|
1324
|
+
if (_curIndex >= _refItem.NumItems)
|
1325
|
+
break;
|
1326
|
+
const CItem &item = (*_items)[_refItem.ItemIndex + _curIndex];
|
1327
|
+
IInStream *s = (*_arcs)[_refItem.VolumeIndex + _curIndex].Stream;
|
1328
|
+
RINOK(s->Seek(item.GetDataPosition(), STREAM_SEEK_SET, NULL));
|
1329
|
+
_stream = s;
|
1330
|
+
_calcCrc = (CrcIsOK && item.IsSplitAfter());
|
1331
|
+
_crc = CRC_INIT_VAL;
|
1332
|
+
_rem = item.PackSize;
|
1333
|
+
}
|
1334
|
+
{
|
1335
|
+
UInt32 cur = size;
|
1336
|
+
if (cur > _rem)
|
1337
|
+
cur = (UInt32)_rem;
|
1338
|
+
UInt32 num = cur;
|
1339
|
+
HRESULT res = _stream->Read(data, cur, &cur);
|
1340
|
+
if (_calcCrc)
|
1341
|
+
_crc = CrcUpdate(_crc, data, cur);
|
1342
|
+
realProcessedSize += cur;
|
1343
|
+
if (processedSize)
|
1344
|
+
*processedSize = realProcessedSize;
|
1345
|
+
data = (Byte *)data + cur;
|
1346
|
+
size -= cur;
|
1347
|
+
_rem -= cur;
|
1348
|
+
if (_rem == 0)
|
1349
|
+
{
|
1350
|
+
const CItem &item = (*_items)[_refItem.ItemIndex + _curIndex];
|
1351
|
+
_curIndex++;
|
1352
|
+
if (_calcCrc && CRC_GET_DIGEST(_crc) != item.FileCRC)
|
1353
|
+
CrcIsOK = false;
|
1354
|
+
_stream = NULL;
|
1355
|
+
}
|
1356
|
+
if (res != S_OK)
|
1357
|
+
return res;
|
1358
|
+
if (realProcessedSize != 0)
|
1359
|
+
return S_OK;
|
1360
|
+
if (cur == 0 && num != 0)
|
1361
|
+
return S_OK;
|
1362
|
+
}
|
1363
|
+
}
|
1364
|
+
|
1365
|
+
return S_OK;
|
1366
|
+
}
|
1367
|
+
|
505
1368
|
STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
506
1369
|
Int32 testMode, IArchiveExtractCallback *extractCallback)
|
507
1370
|
{
|
@@ -511,43 +1374,61 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
511
1374
|
// censoredTotalPacked = 0,
|
512
1375
|
importantTotalUnPacked = 0;
|
513
1376
|
// importantTotalPacked = 0;
|
514
|
-
bool allFilesMode = (numItems == (UInt32)-1);
|
1377
|
+
bool allFilesMode = (numItems == (UInt32)(Int32)-1);
|
515
1378
|
if (allFilesMode)
|
516
1379
|
numItems = _refItems.Size();
|
517
1380
|
if (numItems == 0)
|
518
1381
|
return S_OK;
|
519
|
-
|
520
|
-
CRecordVector<
|
1382
|
+
unsigned lastIndex = 0;
|
1383
|
+
CRecordVector<unsigned> importantIndexes;
|
521
1384
|
CRecordVector<bool> extractStatuses;
|
522
1385
|
|
1386
|
+
bool isThereUndefinedSize = false;
|
1387
|
+
|
523
1388
|
for (UInt32 t = 0; t < numItems; t++)
|
524
1389
|
{
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
1390
|
+
unsigned index = allFilesMode ? t : indices[t];
|
1391
|
+
|
1392
|
+
{
|
1393
|
+
const CRefItem &refItem = _refItems[index];
|
1394
|
+
const CItem &item = _items[refItem.ItemIndex + refItem.NumItems - 1];
|
1395
|
+
|
1396
|
+
if (item.Is_Size_Defined())
|
1397
|
+
censoredTotalUnPacked += item.Size;
|
1398
|
+
else
|
1399
|
+
isThereUndefinedSize = true;
|
1400
|
+
|
1401
|
+
// censoredTotalPacked += item.PackSize;
|
1402
|
+
}
|
1403
|
+
|
1404
|
+
unsigned j;
|
531
1405
|
for (j = lastIndex; j <= index; j++)
|
532
1406
|
// if (!_items[_refItems[j].ItemIndex].IsSolid())
|
533
1407
|
if (!IsSolid(j))
|
534
1408
|
lastIndex = j;
|
1409
|
+
|
535
1410
|
for (j = lastIndex; j <= index; j++)
|
536
1411
|
{
|
537
1412
|
const CRefItem &refItem = _refItems[j];
|
538
|
-
const
|
1413
|
+
const CItem &item = _items[refItem.ItemIndex + refItem.NumItems - 1];
|
539
1414
|
|
540
|
-
|
541
|
-
|
542
|
-
|
1415
|
+
if (item.Is_Size_Defined())
|
1416
|
+
importantTotalUnPacked += item.Size;
|
1417
|
+
else
|
1418
|
+
isThereUndefinedSize = true;
|
543
1419
|
// importantTotalPacked += item.PackSize;
|
544
1420
|
importantIndexes.Add(j);
|
545
1421
|
extractStatuses.Add(j == index);
|
546
1422
|
}
|
1423
|
+
|
547
1424
|
lastIndex = index + 1;
|
548
1425
|
}
|
549
1426
|
|
550
|
-
|
1427
|
+
if (importantTotalUnPacked != 0 || !isThereUndefinedSize)
|
1428
|
+
{
|
1429
|
+
RINOK(extractCallback->SetTotal(importantTotalUnPacked));
|
1430
|
+
}
|
1431
|
+
|
551
1432
|
UInt64 currentImportantTotalUnPacked = 0;
|
552
1433
|
UInt64 currentImportantTotalPacked = 0;
|
553
1434
|
UInt64 currentUnPackSize, currentPackSize;
|
@@ -557,29 +1438,35 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
557
1438
|
NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder;
|
558
1439
|
CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
|
559
1440
|
|
560
|
-
CFilterCoder *filterStreamSpec = new CFilterCoder;
|
1441
|
+
CFilterCoder *filterStreamSpec = new CFilterCoder(false);
|
561
1442
|
CMyComPtr<ISequentialInStream> filterStream = filterStreamSpec;
|
562
1443
|
|
563
|
-
NCrypto::
|
1444
|
+
NCrypto::NRar2::CDecoder *rar20CryptoDecoderSpec = NULL;
|
564
1445
|
CMyComPtr<ICompressFilter> rar20CryptoDecoder;
|
565
|
-
NCrypto::
|
566
|
-
CMyComPtr<ICompressFilter>
|
1446
|
+
NCrypto::NRar3::CDecoder *rar3CryptoDecoderSpec = NULL;
|
1447
|
+
CMyComPtr<ICompressFilter> rar3CryptoDecoder;
|
567
1448
|
|
568
|
-
|
569
|
-
CMyComPtr<ISequentialInStream>
|
1449
|
+
CVolsInStream *volsInStreamSpec = NULL;
|
1450
|
+
CMyComPtr<ISequentialInStream> volsInStream;
|
570
1451
|
|
571
1452
|
CLocalProgress *lps = new CLocalProgress;
|
572
1453
|
CMyComPtr<ICompressProgressInfo> progress = lps;
|
573
1454
|
lps->Init(extractCallback, false);
|
574
1455
|
|
575
1456
|
bool solidStart = true;
|
576
|
-
|
1457
|
+
|
1458
|
+
for (unsigned i = 0;;
|
1459
|
+
i++,
|
577
1460
|
currentImportantTotalUnPacked += currentUnPackSize,
|
578
1461
|
currentImportantTotalPacked += currentPackSize)
|
579
1462
|
{
|
580
1463
|
lps->InSize = currentImportantTotalPacked;
|
581
1464
|
lps->OutSize = currentImportantTotalUnPacked;
|
582
1465
|
RINOK(lps->SetCur());
|
1466
|
+
|
1467
|
+
if (i >= importantIndexes.Size())
|
1468
|
+
break;
|
1469
|
+
|
583
1470
|
CMyComPtr<ISequentialOutStream> realOutStream;
|
584
1471
|
|
585
1472
|
Int32 askMode;
|
@@ -593,9 +1480,16 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
593
1480
|
UInt32 index = importantIndexes[i];
|
594
1481
|
|
595
1482
|
const CRefItem &refItem = _refItems[index];
|
596
|
-
const
|
597
|
-
|
598
|
-
|
1483
|
+
const CItem &item = _items[refItem.ItemIndex];
|
1484
|
+
const CItem &lastItem = _items[refItem.ItemIndex + refItem.NumItems - 1];
|
1485
|
+
|
1486
|
+
UInt64 outSize = (UInt64)(Int64)-1;
|
1487
|
+
currentUnPackSize = 0;
|
1488
|
+
if (lastItem.Is_Size_Defined())
|
1489
|
+
{
|
1490
|
+
outSize = lastItem.Size;
|
1491
|
+
currentUnPackSize = outSize;
|
1492
|
+
}
|
599
1493
|
|
600
1494
|
currentPackSize = GetPackSize(index);
|
601
1495
|
|
@@ -617,7 +1511,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
617
1511
|
if (i < importantIndexes.Size() - 1)
|
618
1512
|
{
|
619
1513
|
// const CRefItem &nextRefItem = _refItems[importantIndexes[i + 1]];
|
620
|
-
// const
|
1514
|
+
// const CItem &nextItemInfo = _items[nextRefItem.ItemIndex];
|
621
1515
|
// mustBeProcessedAnywhere = nextItemInfo.IsSolid();
|
622
1516
|
mustBeProcessedAnywhere = IsSolid(importantIndexes[i + 1]);
|
623
1517
|
}
|
@@ -636,26 +1530,13 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
636
1530
|
outStreamSpec->Init();
|
637
1531
|
realOutStream.Release();
|
638
1532
|
|
639
|
-
|
640
|
-
for (int partIndex = 0; partIndex < 1; partIndex++)
|
1533
|
+
if (!volsInStream)
|
641
1534
|
{
|
642
|
-
|
643
|
-
|
644
|
-
// item redefinition
|
645
|
-
const CItemEx &item = _items[refItem.ItemIndex + partIndex];
|
646
|
-
|
647
|
-
NArchive::NRar::CInArchive &archive = _archives[refItem.VolumeIndex + partIndex];
|
648
|
-
|
649
|
-
inStream.Attach(archive.CreateLimitedStream(item.GetDataPosition(),
|
650
|
-
item.PackSize));
|
651
|
-
*/
|
652
|
-
if (!folderInStream)
|
653
|
-
{
|
654
|
-
folderInStreamSpec = new CFolderInStream;
|
655
|
-
folderInStream = folderInStreamSpec;
|
1535
|
+
volsInStreamSpec = new CVolsInStream;
|
1536
|
+
volsInStream = volsInStreamSpec;
|
656
1537
|
}
|
657
1538
|
|
658
|
-
|
1539
|
+
volsInStreamSpec->Init(&_arcs, &_items, refItem);
|
659
1540
|
|
660
1541
|
UInt64 packSize = currentPackSize;
|
661
1542
|
|
@@ -663,85 +1544,108 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
663
1544
|
// unpackedPos += 0;
|
664
1545
|
|
665
1546
|
CMyComPtr<ISequentialInStream> inStream;
|
1547
|
+
|
666
1548
|
if (item.IsEncrypted())
|
667
1549
|
{
|
668
|
-
CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
|
1550
|
+
// CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
|
1551
|
+
|
669
1552
|
if (item.UnPackVersion >= 29)
|
670
1553
|
{
|
671
|
-
if (!
|
1554
|
+
if (!rar3CryptoDecoder)
|
672
1555
|
{
|
673
|
-
|
674
|
-
|
675
|
-
// RINOK(rar29CryptoDecoder.CoCreateInstance(CLSID_CCryptoRar29Decoder));
|
1556
|
+
rar3CryptoDecoderSpec = new NCrypto::NRar3::CDecoder;
|
1557
|
+
rar3CryptoDecoder = rar3CryptoDecoderSpec;
|
676
1558
|
}
|
677
|
-
|
1559
|
+
// rar3CryptoDecoderSpec->SetRar350Mode(item.UnPackVersion < 36);
|
1560
|
+
/*
|
678
1561
|
CMyComPtr<ICompressSetDecoderProperties2> cryptoProperties;
|
679
|
-
RINOK(
|
1562
|
+
RINOK(rar3CryptoDecoder.QueryInterface(IID_ICompressSetDecoderProperties2,
|
680
1563
|
&cryptoProperties));
|
681
|
-
|
682
|
-
|
1564
|
+
*/
|
1565
|
+
RINOK(rar3CryptoDecoderSpec->SetDecoderProperties2(item.Salt, item.HasSalt() ? sizeof(item.Salt) : 0));
|
1566
|
+
filterStreamSpec->Filter = rar3CryptoDecoder;
|
683
1567
|
}
|
684
1568
|
else if (item.UnPackVersion >= 20)
|
685
1569
|
{
|
686
1570
|
if (!rar20CryptoDecoder)
|
687
1571
|
{
|
688
|
-
rar20CryptoDecoderSpec = new NCrypto::
|
1572
|
+
rar20CryptoDecoderSpec = new NCrypto::NRar2::CDecoder;
|
689
1573
|
rar20CryptoDecoder = rar20CryptoDecoderSpec;
|
690
|
-
// RINOK(rar20CryptoDecoder.CoCreateInstance(CLSID_CCryptoRar20Decoder));
|
691
1574
|
}
|
692
1575
|
filterStreamSpec->Filter = rar20CryptoDecoder;
|
693
1576
|
}
|
694
1577
|
else
|
695
1578
|
{
|
696
1579
|
outStream.Release();
|
697
|
-
RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::
|
1580
|
+
RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kUnsupportedMethod));
|
698
1581
|
continue;
|
699
1582
|
}
|
700
|
-
|
701
|
-
|
1583
|
+
|
1584
|
+
// RINOK(filterStreamSpec->Filter.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword));
|
702
1585
|
|
703
1586
|
if (!getTextPassword)
|
704
1587
|
extractCallback->QueryInterface(IID_ICryptoGetTextPassword, (void **)&getTextPassword);
|
705
|
-
|
1588
|
+
|
1589
|
+
if (!getTextPassword)
|
1590
|
+
{
|
1591
|
+
outStream.Release();
|
1592
|
+
RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kUnsupportedMethod));
|
1593
|
+
continue;
|
1594
|
+
}
|
1595
|
+
|
1596
|
+
// if (getTextPassword)
|
706
1597
|
{
|
707
1598
|
CMyComBSTR password;
|
708
1599
|
RINOK(getTextPassword->CryptoGetTextPassword(&password));
|
1600
|
+
|
709
1601
|
if (item.UnPackVersion >= 29)
|
710
1602
|
{
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
1603
|
+
unsigned len = 0;
|
1604
|
+
if (password)
|
1605
|
+
len = MyStringLen(password);
|
1606
|
+
if (len > kPasswordLen_MAX)
|
1607
|
+
len = kPasswordLen_MAX;
|
1608
|
+
CByteArr buffer(len * 2);
|
1609
|
+
for (unsigned k = 0; k < len; k++)
|
716
1610
|
{
|
717
|
-
wchar_t c =
|
718
|
-
((Byte *)buffer)[
|
719
|
-
((Byte *)buffer)[
|
1611
|
+
wchar_t c = password[k];
|
1612
|
+
((Byte *)buffer)[k * 2] = (Byte)c;
|
1613
|
+
((Byte *)buffer)[k * 2 + 1] = (Byte)(c >> 8);
|
720
1614
|
}
|
721
|
-
|
722
|
-
(const Byte *)buffer, sizeInBytes));
|
1615
|
+
rar3CryptoDecoderSpec->SetPassword((const Byte *)buffer, len * 2);
|
723
1616
|
}
|
724
1617
|
else
|
725
1618
|
{
|
726
|
-
AString oemPassword
|
727
|
-
|
728
|
-
|
729
|
-
|
1619
|
+
AString oemPassword;
|
1620
|
+
if (password)
|
1621
|
+
{
|
1622
|
+
UString unicode = (LPCOLESTR)password;
|
1623
|
+
if (unicode.Len() > kPasswordLen_MAX)
|
1624
|
+
unicode.DeleteFrom(kPasswordLen_MAX);
|
1625
|
+
oemPassword = UnicodeStringToMultiByte(unicode, CP_OEMCP);
|
1626
|
+
}
|
1627
|
+
rar20CryptoDecoderSpec->SetPassword((const Byte *)(const char *)oemPassword, oemPassword.Len());
|
730
1628
|
}
|
731
1629
|
}
|
1630
|
+
/*
|
732
1631
|
else
|
733
1632
|
{
|
734
|
-
RINOK(cryptoSetPassword->CryptoSetPassword(
|
1633
|
+
RINOK(cryptoSetPassword->CryptoSetPassword(NULL, 0));
|
735
1634
|
}
|
736
|
-
|
1635
|
+
*/
|
1636
|
+
|
1637
|
+
filterStreamSpec->SetInStream(volsInStream);
|
1638
|
+
filterStreamSpec->SetOutStreamSize(NULL);
|
737
1639
|
inStream = filterStream;
|
738
1640
|
}
|
739
1641
|
else
|
740
1642
|
{
|
741
|
-
inStream =
|
1643
|
+
inStream = volsInStream;
|
742
1644
|
}
|
1645
|
+
|
743
1646
|
CMyComPtr<ICompressCoder> commonCoder;
|
744
|
-
|
1647
|
+
|
1648
|
+
switch (item.Method)
|
745
1649
|
{
|
746
1650
|
case '0':
|
747
1651
|
{
|
@@ -754,15 +1658,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
754
1658
|
case '4':
|
755
1659
|
case '5':
|
756
1660
|
{
|
757
|
-
|
758
|
-
if (item.UnPackVersion >= 29)
|
759
|
-
{
|
760
|
-
outStream.Release();
|
761
|
-
RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kUnSupportedMethod));
|
762
|
-
continue;
|
763
|
-
}
|
764
|
-
*/
|
765
|
-
int m;
|
1661
|
+
unsigned m;
|
766
1662
|
for (m = 0; m < methodItems.Size(); m++)
|
767
1663
|
if (methodItems[m].RarUnPackVersion == item.UnPackVersion)
|
768
1664
|
break;
|
@@ -772,22 +1668,22 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
772
1668
|
mi.RarUnPackVersion = item.UnPackVersion;
|
773
1669
|
|
774
1670
|
mi.Coder.Release();
|
775
|
-
if (item.UnPackVersion <=
|
1671
|
+
if (item.UnPackVersion <= 40)
|
776
1672
|
{
|
777
|
-
UInt32 methodID =
|
1673
|
+
UInt32 methodID = 0x40300;
|
778
1674
|
if (item.UnPackVersion < 20)
|
779
1675
|
methodID += 1;
|
780
1676
|
else if (item.UnPackVersion < 29)
|
781
1677
|
methodID += 2;
|
782
1678
|
else
|
783
1679
|
methodID += 3;
|
784
|
-
RINOK(CreateCoder(EXTERNAL_CODECS_VARS methodID, mi.Coder
|
1680
|
+
RINOK(CreateCoder(EXTERNAL_CODECS_VARS methodID, false, mi.Coder));
|
785
1681
|
}
|
786
1682
|
|
787
1683
|
if (mi.Coder == 0)
|
788
1684
|
{
|
789
1685
|
outStream.Release();
|
790
|
-
RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::
|
1686
|
+
RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kUnsupportedMethod));
|
791
1687
|
continue;
|
792
1688
|
}
|
793
1689
|
|
@@ -802,7 +1698,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
802
1698
|
Byte isSolid = (Byte)((IsSolid(index) || item.IsSplitBefore()) ? 1: 0);
|
803
1699
|
if (solidStart)
|
804
1700
|
{
|
805
|
-
isSolid =
|
1701
|
+
isSolid = 0;
|
806
1702
|
solidStart = false;
|
807
1703
|
}
|
808
1704
|
|
@@ -814,56 +1710,46 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
814
1710
|
}
|
815
1711
|
default:
|
816
1712
|
outStream.Release();
|
817
|
-
RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::
|
1713
|
+
RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kUnsupportedMethod));
|
818
1714
|
continue;
|
819
1715
|
}
|
820
|
-
|
1716
|
+
|
1717
|
+
HRESULT result = commonCoder->Code(inStream, outStream, &packSize, &outSize, progress);
|
1718
|
+
|
821
1719
|
if (item.IsEncrypted())
|
822
1720
|
filterStreamSpec->ReleaseInStream();
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kDataError));
|
827
|
-
continue;
|
828
|
-
}
|
829
|
-
if (result != S_OK)
|
830
|
-
return result;
|
1721
|
+
|
1722
|
+
if (outSize == (UInt64)(Int64)-1)
|
1723
|
+
currentUnPackSize = outStreamSpec->GetSize();
|
831
1724
|
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
bool crcOK = outStreamSpec->GetCRC() == lastItem.FileCRC;
|
839
|
-
outStream.Release();
|
840
|
-
RINOK(extractCallback->SetOperationResult(crcOK ?
|
841
|
-
NExtract::NOperationResult::kOK:
|
842
|
-
NExtract::NOperationResult::kCRCError));
|
843
|
-
}
|
844
|
-
/*
|
845
|
-
else
|
1725
|
+
int opRes = (volsInStreamSpec->CrcIsOK && outStreamSpec->GetCRC() == lastItem.FileCRC) ?
|
1726
|
+
NExtract::NOperationResult::kOK:
|
1727
|
+
NExtract::NOperationResult::kCRCError;
|
1728
|
+
outStream.Release();
|
1729
|
+
|
1730
|
+
if (result != S_OK)
|
846
1731
|
{
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
crcOK = false;
|
854
|
-
break;
|
855
|
-
}
|
856
|
-
}
|
857
|
-
RINOK(extractCallback->SetOperationResult(crcOK ?
|
858
|
-
NExtract::NOperationResult::kOK:
|
859
|
-
NExtract::NOperationResult::kCRCError));
|
1732
|
+
if (result == S_FALSE)
|
1733
|
+
opRes = NExtract::NOperationResult::kDataError;
|
1734
|
+
else if (result == E_NOTIMPL)
|
1735
|
+
opRes = NExtract::NOperationResult::kUnsupportedMethod;
|
1736
|
+
else
|
1737
|
+
return result;
|
860
1738
|
}
|
861
|
-
|
1739
|
+
RINOK(extractCallback->SetOperationResult(opRes));
|
862
1740
|
}
|
1741
|
+
|
863
1742
|
return S_OK;
|
864
1743
|
COM_TRY_END
|
865
1744
|
}
|
866
1745
|
|
867
1746
|
IMPL_ISetCompressCodecsInfo
|
868
1747
|
|
1748
|
+
REGISTER_ARC_I(
|
1749
|
+
"Rar", "rar r00", 0, 3,
|
1750
|
+
kMarker,
|
1751
|
+
0,
|
1752
|
+
NArcInfoFlags::kFindSignature,
|
1753
|
+
NULL)
|
1754
|
+
|
869
1755
|
}}
|