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
@@ -4,85 +4,127 @@
|
|
4
4
|
|
5
5
|
#include "../../../C/CpuArch.h"
|
6
6
|
|
7
|
-
#include "Common/
|
8
|
-
#include "Common/
|
9
|
-
#include "Common/
|
10
|
-
#include "Common/
|
11
|
-
#include "Common/UTFConvert.h"
|
7
|
+
#include "../../Common/ComTry.h"
|
8
|
+
#include "../../Common/IntToString.h"
|
9
|
+
#include "../../Common/MyXml.h"
|
10
|
+
#include "../../Common/UTFConvert.h"
|
12
11
|
|
13
|
-
#include "Windows/PropVariant.h"
|
12
|
+
#include "../../Windows/PropVariant.h"
|
14
13
|
|
15
14
|
#include "../Common/LimitedStreams.h"
|
16
15
|
#include "../Common/ProgressUtils.h"
|
17
16
|
#include "../Common/RegisterArc.h"
|
17
|
+
#include "../Common/StreamObjects.h"
|
18
18
|
#include "../Common/StreamUtils.h"
|
19
19
|
|
20
20
|
#include "../Compress/BZip2Decoder.h"
|
21
21
|
#include "../Compress/CopyCoder.h"
|
22
22
|
#include "../Compress/ZlibDecoder.h"
|
23
23
|
|
24
|
+
#include "Common/OutStreamWithCRC.h"
|
25
|
+
|
24
26
|
// #define DMG_SHOW_RAW
|
25
27
|
|
26
28
|
// #include <stdio.h>
|
27
29
|
#define PRF(x) // x
|
28
30
|
|
31
|
+
#define Get16(p) GetBe16(p)
|
29
32
|
#define Get32(p) GetBe32(p)
|
30
33
|
#define Get64(p) GetBe64(p)
|
31
34
|
|
32
|
-
static
|
35
|
+
static const Byte k_Base64Table[256] =
|
33
36
|
{
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
66,77,77,77,77,77,77,77,77,65,65,77,77,65,77,77,
|
38
|
+
77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
|
39
|
+
65,77,77,77,77,77,77,77,77,77,77,62,77,77,77,63,
|
40
|
+
52,53,54,55,56,57,58,59,60,61,77,77,77,64,77,77,
|
41
|
+
77, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,
|
42
|
+
15,16,17,18,19,20,21,22,23,24,25,77,77,77,77,77,
|
43
|
+
77,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,
|
44
|
+
41,42,43,44,45,46,47,48,49,50,51,77,77,77,77,77,
|
45
|
+
77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
|
46
|
+
77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
|
47
|
+
77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
|
48
|
+
77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
|
49
|
+
77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
|
50
|
+
77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
|
51
|
+
77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,
|
52
|
+
77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77
|
53
|
+
};
|
42
54
|
|
43
|
-
static
|
55
|
+
static Byte *Base64ToBin(Byte *dest, const char *src)
|
44
56
|
{
|
45
|
-
|
46
|
-
|
47
|
-
|
57
|
+
UInt32 val = 1;
|
58
|
+
|
59
|
+
for (;;)
|
48
60
|
{
|
49
|
-
|
50
|
-
|
51
|
-
|
61
|
+
UInt32 c = k_Base64Table[(Byte)(*src++)];
|
62
|
+
|
63
|
+
if (c < 64)
|
52
64
|
{
|
53
|
-
|
54
|
-
if (
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
65
|
+
val = (val << 6) | c;
|
66
|
+
if ((val & ((UInt32)1 << 24)) == 0)
|
67
|
+
continue;
|
68
|
+
dest[0] = (Byte)(val >> 16);
|
69
|
+
dest[1] = (Byte)(val >> 8);
|
70
|
+
dest[2] = (Byte)(val);
|
71
|
+
dest += 3;
|
72
|
+
val = 1;
|
73
|
+
continue;
|
60
74
|
}
|
61
|
-
|
62
|
-
if (
|
63
|
-
|
75
|
+
|
76
|
+
if (c == 65) // space
|
77
|
+
continue;
|
78
|
+
|
79
|
+
if (c == 64) // '='
|
80
|
+
break;
|
81
|
+
|
82
|
+
if (c == 66 && val == 1) // end of string
|
83
|
+
return dest;
|
84
|
+
|
85
|
+
return NULL;
|
64
86
|
}
|
65
|
-
return destPos;
|
66
|
-
}
|
67
87
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
88
|
+
if (val < (1 << 12))
|
89
|
+
return NULL;
|
90
|
+
|
91
|
+
if (val & (1 << 18))
|
92
|
+
{
|
93
|
+
*dest++ = (Byte)(val >> 10);
|
94
|
+
*dest++ = (Byte)(val >> 2);
|
95
|
+
}
|
96
|
+
else if (k_Base64Table[(Byte)(*src++)] != 64) // '='
|
97
|
+
return NULL;
|
98
|
+
else
|
99
|
+
*dest++ = (Byte)(val >> 4);
|
100
|
+
|
101
|
+
for (;;)
|
102
|
+
{
|
103
|
+
Byte c = k_Base64Table[(Byte)(*src++)];
|
104
|
+
if (c == 65) // space
|
105
|
+
continue;
|
106
|
+
if (c == 66) // end of string
|
107
|
+
return dest;
|
108
|
+
return NULL;
|
109
|
+
}
|
81
110
|
}
|
82
111
|
|
112
|
+
|
83
113
|
namespace NArchive {
|
84
114
|
namespace NDmg {
|
85
115
|
|
116
|
+
enum
|
117
|
+
{
|
118
|
+
METHOD_ZERO_0 = 0,
|
119
|
+
METHOD_COPY = 1,
|
120
|
+
METHOD_ZERO_2 = 2, // without file CRC calculation
|
121
|
+
METHOD_ADC = 0x80000004,
|
122
|
+
METHOD_ZLIB = 0x80000005,
|
123
|
+
METHOD_BZIP2 = 0x80000006,
|
124
|
+
METHOD_COMMENT = 0x7FFFFFFE, // is used to comment "+beg" and "+end" in extra field.
|
125
|
+
METHOD_END = 0xFFFFFFFF
|
126
|
+
};
|
127
|
+
|
86
128
|
struct CBlock
|
87
129
|
{
|
88
130
|
UInt32 Type;
|
@@ -92,176 +134,247 @@ struct CBlock
|
|
92
134
|
UInt64 PackSize;
|
93
135
|
|
94
136
|
UInt64 GetNextPackOffset() const { return PackPos + PackSize; }
|
137
|
+
UInt64 GetNextUnpPos() const { return UnpPos + UnpSize; }
|
138
|
+
|
139
|
+
bool IsZeroMethod() const { return Type == METHOD_ZERO_0 || Type == METHOD_ZERO_2; }
|
140
|
+
bool ThereAreDataInBlock() const { return Type != METHOD_COMMENT && Type != METHOD_END; }
|
141
|
+
};
|
142
|
+
|
143
|
+
static const UInt32 kCheckSumType_CRC = 2;
|
144
|
+
|
145
|
+
static const size_t kChecksumSize_Max = 0x80;
|
146
|
+
|
147
|
+
struct CChecksum
|
148
|
+
{
|
149
|
+
UInt32 Type;
|
150
|
+
UInt32 NumBits;
|
151
|
+
Byte Data[kChecksumSize_Max];
|
152
|
+
|
153
|
+
bool IsCrc32() const { return Type == kCheckSumType_CRC && NumBits == 32; }
|
154
|
+
UInt32 GetCrc32() const { return Get32(Data); }
|
155
|
+
void Parse(const Byte *p);
|
156
|
+
};
|
157
|
+
|
158
|
+
void CChecksum::Parse(const Byte *p)
|
159
|
+
{
|
160
|
+
Type = Get32(p);
|
161
|
+
NumBits = Get32(p + 4);
|
162
|
+
memcpy(Data, p + 8, kChecksumSize_Max);
|
95
163
|
};
|
96
164
|
|
97
165
|
struct CFile
|
98
166
|
{
|
99
|
-
|
167
|
+
UInt64 Size;
|
168
|
+
UInt64 PackSize;
|
100
169
|
UInt64 StartPos;
|
170
|
+
AString Name;
|
101
171
|
CRecordVector<CBlock> Blocks;
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
return size;
|
108
|
-
};
|
109
|
-
UInt64 GetPackSize() const
|
110
|
-
{
|
111
|
-
UInt64 size = 0;
|
112
|
-
for (int i = 0; i < Blocks.Size(); i++)
|
113
|
-
size += Blocks[i].PackSize;
|
114
|
-
return size;
|
115
|
-
};
|
172
|
+
CChecksum Checksum;
|
173
|
+
bool FullFileChecksum;
|
174
|
+
|
175
|
+
HRESULT Parse(const Byte *p, UInt32 size);
|
176
|
+
};
|
116
177
|
|
178
|
+
#ifdef DMG_SHOW_RAW
|
179
|
+
struct CExtraFile
|
180
|
+
{
|
181
|
+
CByteBuffer Data;
|
117
182
|
AString Name;
|
118
183
|
};
|
184
|
+
#endif
|
119
185
|
|
120
186
|
class CHandler:
|
121
187
|
public IInArchive,
|
188
|
+
public IInArchiveGetStream,
|
122
189
|
public CMyUnknownImp
|
123
190
|
{
|
124
191
|
CMyComPtr<IInStream> _inStream;
|
125
|
-
|
126
|
-
AString _xml;
|
127
192
|
CObjectVector<CFile> _files;
|
128
|
-
|
193
|
+
bool _masterCrcError;
|
194
|
+
|
195
|
+
UInt64 _startPos;
|
196
|
+
UInt64 _phySize;
|
197
|
+
|
198
|
+
#ifdef DMG_SHOW_RAW
|
199
|
+
CObjectVector<CExtraFile> _extras;
|
200
|
+
#endif
|
129
201
|
|
130
202
|
HRESULT Open2(IInStream *stream);
|
131
203
|
HRESULT Extract(IInStream *stream);
|
132
204
|
public:
|
133
|
-
|
205
|
+
MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
|
134
206
|
INTERFACE_IInArchive(;)
|
207
|
+
STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
|
135
208
|
};
|
136
209
|
|
137
|
-
|
138
|
-
|
139
|
-
enum
|
140
|
-
{
|
141
|
-
METHOD_ZERO_0 = 0,
|
142
|
-
METHOD_COPY = 1,
|
143
|
-
METHOD_ZERO_2 = 2,
|
144
|
-
METHOD_ADC = 0x80000004,
|
145
|
-
METHOD_ZLIB = 0x80000005,
|
146
|
-
METHOD_BZIP2 = 0x80000006,
|
147
|
-
METHOD_DUMMY = 0x7FFFFFFE,
|
148
|
-
METHOD_END = 0xFFFFFFFF
|
149
|
-
};
|
150
|
-
|
151
|
-
struct CMethodStat
|
152
|
-
{
|
153
|
-
UInt32 NumBlocks;
|
154
|
-
UInt64 PackSize;
|
155
|
-
UInt64 UnpSize;
|
156
|
-
CMethodStat(): NumBlocks(0), PackSize(0), UnpSize(0) {}
|
157
|
-
};
|
210
|
+
// that limit can be increased, if there are such dmg files
|
211
|
+
static const size_t kXmlSizeMax = 0xFFFF0000; // 4 GB - 64 KB;
|
158
212
|
|
159
213
|
struct CMethods
|
160
214
|
{
|
161
|
-
CRecordVector<CMethodStat> Stats;
|
162
215
|
CRecordVector<UInt32> Types;
|
216
|
+
CRecordVector<UInt32> ChecksumTypes;
|
217
|
+
|
163
218
|
void Update(const CFile &file);
|
164
|
-
|
219
|
+
void GetString(AString &s) const;
|
165
220
|
};
|
166
221
|
|
167
222
|
void CMethods::Update(const CFile &file)
|
168
223
|
{
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
int index = Types.FindInSorted(b.Type);
|
173
|
-
if (index < 0)
|
174
|
-
{
|
175
|
-
index = Types.AddToUniqueSorted(b.Type);
|
176
|
-
Stats.Insert(index, CMethodStat());
|
177
|
-
}
|
178
|
-
CMethodStat &m = Stats[index];
|
179
|
-
m.PackSize += b.PackSize;
|
180
|
-
m.UnpSize += b.UnpSize;
|
181
|
-
m.NumBlocks++;
|
182
|
-
}
|
224
|
+
ChecksumTypes.AddToUniqueSorted(file.Checksum.Type);
|
225
|
+
FOR_VECTOR (i, file.Blocks)
|
226
|
+
Types.AddToUniqueSorted(file.Blocks[i].Type);
|
183
227
|
}
|
184
228
|
|
185
|
-
|
229
|
+
void CMethods::GetString(AString &res) const
|
186
230
|
{
|
187
|
-
|
188
|
-
|
231
|
+
res.Empty();
|
232
|
+
|
233
|
+
unsigned i;
|
234
|
+
|
235
|
+
for (i = 0; i < Types.Size(); i++)
|
189
236
|
{
|
190
|
-
if (i != 0)
|
191
|
-
res += L' ';
|
192
|
-
wchar_t buf[32];
|
193
|
-
const wchar_t *s;
|
194
|
-
const CMethodStat &m = Stats[i];
|
195
|
-
bool showPack = true;
|
196
237
|
UInt32 type = Types[i];
|
197
|
-
|
238
|
+
if (type == METHOD_COMMENT || type == METHOD_END)
|
239
|
+
continue;
|
240
|
+
char buf[16];
|
241
|
+
const char *s;
|
242
|
+
switch (type)
|
198
243
|
{
|
199
|
-
case METHOD_ZERO_0: s =
|
200
|
-
case METHOD_ZERO_2: s =
|
201
|
-
case METHOD_COPY: s =
|
202
|
-
case METHOD_ADC: s =
|
203
|
-
case METHOD_ZLIB: s =
|
204
|
-
case METHOD_BZIP2: s =
|
205
|
-
default:
|
244
|
+
case METHOD_ZERO_0: s = "Zero0"; break;
|
245
|
+
case METHOD_ZERO_2: s = "Zero2"; break;
|
246
|
+
case METHOD_COPY: s = "Copy"; break;
|
247
|
+
case METHOD_ADC: s = "ADC"; break;
|
248
|
+
case METHOD_ZLIB: s = "ZLIB"; break;
|
249
|
+
case METHOD_BZIP2: s = "BZip2"; break;
|
250
|
+
default: ConvertUInt32ToString(type, buf); s = buf;
|
206
251
|
}
|
252
|
+
res.Add_Space_if_NotEmpty();
|
207
253
|
res += s;
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
res += GetSizeString(m.UnpSize);
|
217
|
-
if (showPack)
|
254
|
+
}
|
255
|
+
|
256
|
+
for (i = 0; i < ChecksumTypes.Size(); i++)
|
257
|
+
{
|
258
|
+
UInt32 type = ChecksumTypes[i];
|
259
|
+
char buf[32];
|
260
|
+
const char *s;
|
261
|
+
switch (type)
|
218
262
|
{
|
219
|
-
|
220
|
-
|
263
|
+
case kCheckSumType_CRC: s = "CRC"; break;
|
264
|
+
default:
|
265
|
+
ConvertUInt32ToString(type, MyStpCpy(buf, "Check"));
|
266
|
+
s = buf;
|
221
267
|
}
|
268
|
+
res.Add_Space_if_NotEmpty();
|
269
|
+
res += s;
|
222
270
|
}
|
223
|
-
return res;
|
224
271
|
}
|
225
272
|
|
226
|
-
|
273
|
+
struct CAppleName
|
274
|
+
{
|
275
|
+
bool IsFs;
|
276
|
+
const char *Ext;
|
277
|
+
const char *AppleName;
|
278
|
+
};
|
279
|
+
|
280
|
+
static const CAppleName k_Names[] =
|
227
281
|
{
|
228
|
-
{
|
229
|
-
{
|
230
|
-
{
|
231
|
-
{
|
232
|
-
{
|
282
|
+
{ true, "hfs", "Apple_HFS" },
|
283
|
+
{ true, "hfsx", "Apple_HFSX" },
|
284
|
+
{ true, "ufs", "Apple_UFS" },
|
285
|
+
{ false, "free", "Apple_Free" },
|
286
|
+
{ false, "ddm", "DDM" },
|
287
|
+
{ false, NULL, "Apple_partition_map" },
|
288
|
+
{ false, NULL, " GPT " },
|
289
|
+
{ false, NULL, "MBR" },
|
290
|
+
{ false, NULL, "Driver" },
|
291
|
+
{ false, NULL, "Patches" }
|
292
|
+
};
|
293
|
+
|
294
|
+
static const unsigned kNumAppleNames = ARRAY_SIZE(k_Names);
|
295
|
+
|
296
|
+
static const Byte kProps[] =
|
297
|
+
{
|
298
|
+
kpidPath,
|
299
|
+
kpidSize,
|
300
|
+
kpidPackSize,
|
301
|
+
kpidCRC,
|
302
|
+
kpidComment,
|
303
|
+
kpidMethod
|
233
304
|
};
|
234
305
|
|
235
306
|
IMP_IInArchive_Props
|
236
307
|
|
237
|
-
|
308
|
+
static const Byte kArcProps[] =
|
238
309
|
{
|
239
|
-
|
240
|
-
|
310
|
+
kpidMethod,
|
311
|
+
kpidNumBlocks
|
241
312
|
};
|
242
313
|
|
243
314
|
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
244
315
|
{
|
245
316
|
COM_TRY_BEGIN
|
246
317
|
NWindows::NCOM::CPropVariant prop;
|
247
|
-
switch(propID)
|
318
|
+
switch (propID)
|
248
319
|
{
|
249
320
|
case kpidMethod:
|
250
321
|
{
|
251
322
|
CMethods m;
|
252
|
-
|
323
|
+
FOR_VECTOR (i, _files)
|
253
324
|
m.Update(_files[i]);
|
254
|
-
|
325
|
+
AString s;
|
326
|
+
m.GetString(s);
|
327
|
+
if (!s.IsEmpty())
|
328
|
+
prop = s;
|
255
329
|
break;
|
256
330
|
}
|
257
331
|
case kpidNumBlocks:
|
258
332
|
{
|
259
333
|
UInt64 numBlocks = 0;
|
260
|
-
|
334
|
+
FOR_VECTOR (i, _files)
|
261
335
|
numBlocks += _files[i].Blocks.Size();
|
262
336
|
prop = numBlocks;
|
263
337
|
break;
|
264
338
|
}
|
339
|
+
case kpidMainSubfile:
|
340
|
+
{
|
341
|
+
int mainIndex = -1;
|
342
|
+
unsigned numFS = 0;
|
343
|
+
unsigned numUnknown = 0;
|
344
|
+
FOR_VECTOR (i, _files)
|
345
|
+
{
|
346
|
+
const AString &name = _files[i].Name;
|
347
|
+
unsigned n;
|
348
|
+
for (n = 0; n < kNumAppleNames; n++)
|
349
|
+
{
|
350
|
+
const CAppleName &appleName = k_Names[n];
|
351
|
+
// if (name.Find(appleName.AppleName) >= 0)
|
352
|
+
if (strstr(name, appleName.AppleName))
|
353
|
+
{
|
354
|
+
if (appleName.IsFs)
|
355
|
+
{
|
356
|
+
numFS++;
|
357
|
+
mainIndex = i;
|
358
|
+
}
|
359
|
+
break;
|
360
|
+
}
|
361
|
+
}
|
362
|
+
if (n == kNumAppleNames)
|
363
|
+
{
|
364
|
+
mainIndex = i;
|
365
|
+
numUnknown++;
|
366
|
+
}
|
367
|
+
}
|
368
|
+
if (numFS + numUnknown == 1)
|
369
|
+
prop = (UInt32)mainIndex;
|
370
|
+
break;
|
371
|
+
}
|
372
|
+
case kpidWarning:
|
373
|
+
if (_masterCrcError)
|
374
|
+
prop = "Master CRC error";
|
375
|
+
break;
|
376
|
+
case kpidOffset: prop = _startPos; break;
|
377
|
+
case kpidPhySize: prop = _phySize; break;
|
265
378
|
}
|
266
379
|
prop.Detach(value);
|
267
380
|
return S_OK;
|
@@ -270,9 +383,87 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
|
270
383
|
|
271
384
|
IMP_IInArchive_ArcProps
|
272
385
|
|
386
|
+
HRESULT CFile::Parse(const Byte *p, UInt32 size)
|
387
|
+
{
|
388
|
+
const UInt32 kHeadSize = 0xCC;
|
389
|
+
if (size < kHeadSize)
|
390
|
+
return S_FALSE;
|
391
|
+
if (Get32(p) != 0x6D697368) // "mish" signature
|
392
|
+
return S_FALSE;
|
393
|
+
if (Get32(p + 4) != 1) // version
|
394
|
+
return S_FALSE;
|
395
|
+
// UInt64 firstSectorNumber = Get64(p + 8);
|
396
|
+
UInt64 numSectors = Get64(p + 0x10);
|
397
|
+
|
398
|
+
StartPos = Get64(p + 0x18);
|
399
|
+
|
400
|
+
// UInt32 decompressedBufRequested = Get32(p + 0x20); // ???
|
401
|
+
// UInt32 blocksDescriptor = Get32(p + 0x24); // number starting from -1?
|
402
|
+
// char Reserved1[24];
|
403
|
+
|
404
|
+
Checksum.Parse(p + 0x40);
|
405
|
+
PRF(printf("\n\nChecksum Type = %2d", Checksum.Type));
|
406
|
+
|
407
|
+
UInt32 numBlocks = Get32(p + 0xC8);
|
408
|
+
if (numBlocks > ((UInt32)1 << 28))
|
409
|
+
return S_FALSE;
|
410
|
+
|
411
|
+
const UInt32 kRecordSize = 40;
|
412
|
+
if (numBlocks * kRecordSize + kHeadSize != size)
|
413
|
+
return S_FALSE;
|
414
|
+
|
415
|
+
PackSize = 0;
|
416
|
+
Size = 0;
|
417
|
+
Blocks.ClearAndReserve(numBlocks);
|
418
|
+
FullFileChecksum = true;
|
419
|
+
|
420
|
+
p += kHeadSize;
|
421
|
+
UInt32 i;
|
422
|
+
|
423
|
+
for (i = 0; i < numBlocks; i++, p += kRecordSize)
|
424
|
+
{
|
425
|
+
CBlock b;
|
426
|
+
b.Type = Get32(p);
|
427
|
+
b.UnpPos = Get64(p + 0x08) << 9;
|
428
|
+
b.UnpSize = Get64(p + 0x10) << 9;
|
429
|
+
b.PackPos = Get64(p + 0x18);
|
430
|
+
b.PackSize = Get64(p + 0x20);
|
431
|
+
|
432
|
+
// b.PackPos can be 0 for some types. So we don't check it
|
433
|
+
if (!Blocks.IsEmpty())
|
434
|
+
if (b.UnpPos != Blocks.Back().GetNextUnpPos())
|
435
|
+
return S_FALSE;
|
436
|
+
|
437
|
+
PRF(printf("\nType=%8x m[1]=%8x uPos=%8x uSize=%7x pPos=%8x pSize=%7x",
|
438
|
+
b.Type, Get32(p + 4), (UInt32)b.UnpPos, (UInt32)b.UnpSize, (UInt32)b.PackPos, (UInt32)b.PackSize));
|
439
|
+
|
440
|
+
if (b.Type == METHOD_COMMENT)
|
441
|
+
continue;
|
442
|
+
if (b.Type == METHOD_END)
|
443
|
+
break;
|
444
|
+
PackSize += b.PackSize;
|
445
|
+
|
446
|
+
if (b.UnpSize != 0)
|
447
|
+
{
|
448
|
+
if (b.Type == METHOD_ZERO_2)
|
449
|
+
FullFileChecksum = false;
|
450
|
+
Blocks.AddInReserved(b);
|
451
|
+
}
|
452
|
+
}
|
453
|
+
|
454
|
+
if (i != numBlocks - 1)
|
455
|
+
return S_FALSE;
|
456
|
+
if (!Blocks.IsEmpty())
|
457
|
+
Size = Blocks.Back().GetNextUnpPos();
|
458
|
+
if (Size != (numSectors << 9))
|
459
|
+
return S_FALSE;
|
460
|
+
|
461
|
+
return S_OK;
|
462
|
+
}
|
463
|
+
|
273
464
|
static int FindKeyPair(const CXmlItem &item, const AString &key, const AString &nextTag)
|
274
465
|
{
|
275
|
-
for (
|
466
|
+
for (unsigned i = 0; i + 1 < item.SubItems.Size(); i++)
|
276
467
|
{
|
277
468
|
const CXmlItem &si = item.SubItems[i];
|
278
469
|
if (si.IsTagged("key") && si.GetSubString() == key && item.SubItems[i + 1].IsTagged(nextTag))
|
@@ -281,134 +472,308 @@ static int FindKeyPair(const CXmlItem &item, const AString &key, const AString &
|
|
281
472
|
return -1;
|
282
473
|
}
|
283
474
|
|
284
|
-
static AString GetStringFromKeyPair(const CXmlItem &item, const AString &key, const AString &nextTag)
|
475
|
+
static const AString *GetStringFromKeyPair(const CXmlItem &item, const AString &key, const AString &nextTag)
|
285
476
|
{
|
286
477
|
int index = FindKeyPair(item, key, nextTag);
|
287
478
|
if (index >= 0)
|
288
|
-
return item.SubItems[index].
|
289
|
-
return
|
479
|
+
return item.SubItems[index].GetSubStringPtr();
|
480
|
+
return NULL;
|
481
|
+
}
|
482
|
+
|
483
|
+
static const unsigned HEADER_SIZE = 0x200;
|
484
|
+
|
485
|
+
static const Byte k_Signature[] = { 'k','o','l','y', 0, 0, 0, 4, 0, 0, 2, 0 };
|
486
|
+
|
487
|
+
static inline bool IsKoly(const Byte *p)
|
488
|
+
{
|
489
|
+
return memcmp(p, k_Signature, ARRAY_SIZE(k_Signature)) == 0;
|
490
|
+
/*
|
491
|
+
if (Get32(p) != 0x6B6F6C79) // "koly" signature
|
492
|
+
return false;
|
493
|
+
if (Get32(p + 4) != 4) // version
|
494
|
+
return false;
|
495
|
+
if (Get32(p + 8) != HEADER_SIZE)
|
496
|
+
return false;
|
497
|
+
return true;
|
498
|
+
*/
|
290
499
|
}
|
291
500
|
|
292
501
|
HRESULT CHandler::Open2(IInStream *stream)
|
293
502
|
{
|
294
|
-
|
503
|
+
RINOK(stream->Seek(0, STREAM_SEEK_CUR, &_startPos));
|
295
504
|
|
296
|
-
UInt64 headerPos;
|
297
|
-
RINOK(stream->Seek(-HEADER_SIZE, STREAM_SEEK_END, &headerPos));
|
298
505
|
Byte buf[HEADER_SIZE];
|
299
506
|
RINOK(ReadStream_FALSE(stream, buf, HEADER_SIZE));
|
300
|
-
UInt64 address1 = Get64(buf + 0);
|
301
|
-
UInt64 address2 = Get64(buf + 0xB8);
|
302
|
-
UInt64 size64 = Get64(buf + 0xC0);
|
303
|
-
if (address1 != address2 || size64 >= kXmlSizeMax || size64 == 0 ||
|
304
|
-
address1 >= headerPos || address1 + size64 > headerPos)
|
305
|
-
return S_FALSE;
|
306
|
-
RINOK(stream->Seek(address1, STREAM_SEEK_SET, NULL));
|
307
|
-
size_t size = (size_t)size64;
|
308
507
|
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
508
|
+
UInt64 headerPos;
|
509
|
+
if (IsKoly(buf))
|
510
|
+
headerPos = _startPos;
|
511
|
+
else
|
512
|
+
{
|
513
|
+
RINOK(stream->Seek(0, STREAM_SEEK_END, &headerPos));
|
514
|
+
if (headerPos < HEADER_SIZE)
|
515
|
+
return S_FALSE;
|
516
|
+
headerPos -= HEADER_SIZE;
|
517
|
+
RINOK(stream->Seek(headerPos, STREAM_SEEK_SET, NULL));
|
518
|
+
RINOK(ReadStream_FALSE(stream, buf, HEADER_SIZE));
|
519
|
+
if (!IsKoly(buf))
|
520
|
+
return S_FALSE;
|
521
|
+
}
|
313
522
|
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
523
|
+
// UInt32 flags = Get32(buf + 12);
|
524
|
+
// UInt64 runningDataForkOffset = Get64(buf + 0x10);
|
525
|
+
UInt64 dataForkOffset = Get64(buf + 0x18);
|
526
|
+
UInt64 dataForkLen = Get64(buf + 0x20);
|
527
|
+
UInt64 rsrcOffset = Get64(buf + 0x28);
|
528
|
+
UInt64 rsrcLen = Get64(buf + 0x30);
|
529
|
+
// UInt32 segmentNumber = Get32(buf + 0x38);
|
530
|
+
// UInt32 segmentCount = Get32(buf + 0x3C);
|
531
|
+
// Byte segmentGUID[16];
|
532
|
+
// CChecksum dataForkChecksum;
|
533
|
+
// dataForkChecksum.Parse(buf + 0x50);
|
534
|
+
UInt64 xmlOffset = Get64(buf + 0xD8);
|
535
|
+
UInt64 xmlLen = Get64(buf + 0xE0);
|
536
|
+
|
537
|
+
if ( headerPos < dataForkOffset
|
538
|
+
|| headerPos - dataForkOffset < dataForkLen
|
539
|
+
|| headerPos < rsrcOffset
|
540
|
+
|| headerPos - rsrcOffset < rsrcLen
|
541
|
+
|| headerPos < xmlOffset
|
542
|
+
|| headerPos - xmlOffset < xmlLen)
|
322
543
|
return S_FALSE;
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
if (rfDictIndex < 0)
|
327
|
-
return S_FALSE;
|
328
|
-
|
329
|
-
const CXmlItem &rfDictItem = dictItem.SubItems[rfDictIndex];
|
330
|
-
int arrIndex = FindKeyPair(rfDictItem, "blkx", "array");
|
331
|
-
if (arrIndex < 0)
|
544
|
+
|
545
|
+
UInt64 totalLen = dataForkLen + rsrcLen + xmlLen;
|
546
|
+
if (totalLen > headerPos)
|
332
547
|
return S_FALSE;
|
548
|
+
_startPos = headerPos - totalLen;
|
549
|
+
_phySize = totalLen + HEADER_SIZE;
|
550
|
+
headerPos = totalLen;
|
551
|
+
|
552
|
+
// Byte reserved[0x78]
|
553
|
+
|
554
|
+
CChecksum masterChecksum;
|
555
|
+
masterChecksum.Parse(buf + 0x160);
|
333
556
|
|
334
|
-
|
557
|
+
// UInt32 imageVariant = Get32(buf + 0x1E8);
|
558
|
+
// UInt64 numSectors = Get64(buf + 0x1EC);
|
559
|
+
// Byte reserved[0x12]
|
335
560
|
|
336
|
-
|
337
|
-
|
561
|
+
const UInt32 RSRC_HEAD_SIZE = 0x100;
|
562
|
+
|
563
|
+
// We don't know the size of the field "offset" in rsrc.
|
564
|
+
// We suppose that it uses 24 bits. So we use Rsrc, only if the rsrcLen < (1 << 24).
|
565
|
+
bool useRsrc = (rsrcLen > RSRC_HEAD_SIZE && rsrcLen < ((UInt32)1 << 24));
|
566
|
+
// useRsrc = false;
|
567
|
+
|
568
|
+
if (useRsrc)
|
338
569
|
{
|
339
|
-
|
340
|
-
|
341
|
-
|
570
|
+
#ifdef DMG_SHOW_RAW
|
571
|
+
CExtraFile &extra = _extras.AddNew();
|
572
|
+
extra.Name = "rsrc.bin";
|
573
|
+
CByteBuffer &rsrcBuf = extra.Data;
|
574
|
+
#else
|
575
|
+
CByteBuffer rsrcBuf;
|
576
|
+
#endif
|
342
577
|
|
343
|
-
|
344
|
-
|
578
|
+
size_t rsrcLenT = (size_t)rsrcLen;
|
579
|
+
rsrcBuf.Alloc(rsrcLenT);
|
580
|
+
RINOK(stream->Seek(_startPos + rsrcOffset, STREAM_SEEK_SET, NULL));
|
581
|
+
RINOK(ReadStream_FALSE(stream, rsrcBuf, rsrcLenT));
|
582
|
+
|
583
|
+
const Byte *p = rsrcBuf;
|
584
|
+
UInt32 headSize = Get32(p + 0);
|
585
|
+
UInt32 footerOffset = Get32(p + 4);
|
586
|
+
UInt32 mainDataSize = Get32(p + 8);
|
587
|
+
UInt32 footerSize = Get32(p + 12);
|
588
|
+
if (headSize != RSRC_HEAD_SIZE ||
|
589
|
+
footerOffset >= rsrcLenT ||
|
590
|
+
mainDataSize >= rsrcLenT ||
|
591
|
+
footerOffset + footerSize != rsrcLenT ||
|
592
|
+
footerOffset != headSize + mainDataSize)
|
593
|
+
return S_FALSE;
|
594
|
+
if (footerSize < 16)
|
595
|
+
return S_FALSE;
|
596
|
+
if (memcmp(p, p + footerOffset, 16) != 0)
|
597
|
+
return S_FALSE;
|
345
598
|
|
346
|
-
|
347
|
-
{
|
348
|
-
AString dataString;
|
349
|
-
AString name = GetStringFromKeyPair(item, "Name", "string");
|
350
|
-
if (name.IsEmpty())
|
351
|
-
name = GetStringFromKeyPair(item, "CFName", "string");
|
352
|
-
file.Name = name;
|
353
|
-
dataString = GetStringFromKeyPair(item, "Data", "data");
|
354
|
-
|
355
|
-
destLen = Base64ToBin(NULL, dataString, dataString.Length());
|
356
|
-
file.Raw.SetCapacity(destLen);
|
357
|
-
Base64ToBin(file.Raw, dataString, dataString.Length());
|
358
|
-
}
|
599
|
+
p += footerOffset;
|
359
600
|
|
360
|
-
if (
|
601
|
+
if ((UInt32)Get16(p + 0x18) != 0x1C)
|
602
|
+
return S_FALSE;
|
603
|
+
UInt32 namesOffset = Get16(p + 0x1A);
|
604
|
+
if (namesOffset > footerSize)
|
605
|
+
return S_FALSE;
|
606
|
+
|
607
|
+
UInt32 numItems = (UInt32)Get16(p + 0x1C) + 1;
|
608
|
+
if (numItems * 8 + 0x1E > namesOffset)
|
609
|
+
return S_FALSE;
|
610
|
+
|
611
|
+
for (UInt32 i = 0; i < numItems; i++)
|
361
612
|
{
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
continue;
|
613
|
+
const Byte *p2 = p + 0x1E + i * 8;
|
614
|
+
|
615
|
+
UInt32 typeId = Get32(p2);
|
616
|
+
if (typeId != 0x626C6B78) // blkx
|
617
|
+
continue;
|
618
|
+
|
619
|
+
UInt32 numFiles = (UInt32)Get16(p2 + 4) + 1;
|
620
|
+
UInt32 offs = Get16(p2 + 6);
|
621
|
+
if (0x1C + offs + 12 * numFiles > namesOffset)
|
622
|
+
return S_FALSE;
|
373
623
|
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
624
|
+
for (UInt32 k = 0; k < numFiles; k++)
|
625
|
+
{
|
626
|
+
const Byte *p3 = p + 0x1C + offs + k * 12;
|
627
|
+
// UInt32 id = Get16(p3);
|
628
|
+
UInt32 namePos = Get16(p3 + 2);
|
629
|
+
// Byte attributes = p3[4]; // = 0x50 for blkx
|
630
|
+
// we don't know how many bits we can use. So we use 24 bits only
|
631
|
+
UInt32 blockOffset = Get32(p3 + 4);
|
632
|
+
blockOffset &= (((UInt32)1 << 24) - 1);
|
633
|
+
// UInt32 unknown2 = Get32(p3 + 8); // ???
|
634
|
+
if (blockOffset + 4 >= mainDataSize)
|
635
|
+
return S_FALSE;
|
636
|
+
const Byte *pBlock = rsrcBuf + headSize + blockOffset;
|
637
|
+
UInt32 blockSize = Get32(pBlock);
|
638
|
+
|
639
|
+
#ifdef DMG_SHOW_RAW
|
640
|
+
{
|
641
|
+
CExtraFile &extra = _extras.AddNew();
|
642
|
+
{
|
643
|
+
char extraName[16];
|
644
|
+
ConvertUInt32ToString(_files.Size(), extraName);
|
645
|
+
extra.Name = extraName;
|
646
|
+
}
|
647
|
+
extra.Data.CopyFrom(pBlock + 4, blockSize);
|
648
|
+
}
|
649
|
+
#endif
|
650
|
+
|
651
|
+
CFile &file = _files.AddNew();
|
652
|
+
if (namePos != 0xFFFF)
|
653
|
+
{
|
654
|
+
UInt32 namesBlockSize = footerSize - namesOffset;
|
655
|
+
if (namePos >= namesBlockSize)
|
656
|
+
return S_FALSE;
|
657
|
+
const Byte *namePtr = p + namesOffset + namePos;
|
658
|
+
UInt32 nameLen = *namePtr;
|
659
|
+
if (namesBlockSize - namePos <= nameLen)
|
660
|
+
return S_FALSE;
|
661
|
+
for (UInt32 r = 1; r <= nameLen; r++)
|
662
|
+
{
|
663
|
+
Byte c = namePtr[r];
|
664
|
+
if (c < 0x20 || c >= 0x80)
|
665
|
+
break;
|
666
|
+
file.Name += (char)c;
|
667
|
+
}
|
668
|
+
}
|
669
|
+
RINOK(file.Parse(pBlock + 4, blockSize));
|
670
|
+
}
|
671
|
+
}
|
672
|
+
}
|
673
|
+
else
|
674
|
+
{
|
675
|
+
if (xmlLen >= kXmlSizeMax || xmlLen == 0)
|
676
|
+
return S_FALSE;
|
677
|
+
size_t size = (size_t)xmlLen;
|
678
|
+
if (size != xmlLen)
|
679
|
+
return S_FALSE;
|
378
680
|
|
379
|
-
|
681
|
+
RINOK(stream->Seek(_startPos + dataForkLen, STREAM_SEEK_SET, NULL));
|
682
|
+
|
683
|
+
CXml xml;
|
684
|
+
{
|
685
|
+
CObjArray<char> xmlStr(size + 1);
|
686
|
+
RINOK(ReadStream_FALSE(stream, xmlStr, size));
|
687
|
+
xmlStr[size] = 0;
|
688
|
+
// if (strlen(xmlStr) != size) return S_FALSE;
|
689
|
+
if (!xml.Parse(xmlStr))
|
690
|
+
return S_FALSE;
|
380
691
|
|
381
|
-
|
382
|
-
|
383
|
-
|
692
|
+
#ifdef DMG_SHOW_RAW
|
693
|
+
CExtraFile &extra = _extras.AddNew();
|
694
|
+
extra.Name = "a.xml";
|
695
|
+
extra.Data.CopyFrom((const Byte *)(const char *)xmlStr, size);
|
696
|
+
#endif
|
384
697
|
}
|
385
|
-
|
386
|
-
if (
|
698
|
+
|
699
|
+
if (xml.Root.Name != "plist")
|
700
|
+
return S_FALSE;
|
701
|
+
|
702
|
+
int dictIndex = xml.Root.FindSubTag("dict");
|
703
|
+
if (dictIndex < 0)
|
704
|
+
return S_FALSE;
|
705
|
+
|
706
|
+
const CXmlItem &dictItem = xml.Root.SubItems[dictIndex];
|
707
|
+
int rfDictIndex = FindKeyPair(dictItem, "resource-fork", "dict");
|
708
|
+
if (rfDictIndex < 0)
|
709
|
+
return S_FALSE;
|
710
|
+
|
711
|
+
const CXmlItem &rfDictItem = dictItem.SubItems[rfDictIndex];
|
712
|
+
int arrIndex = FindKeyPair(rfDictItem, "blkx", "array");
|
713
|
+
if (arrIndex < 0)
|
714
|
+
return S_FALSE;
|
715
|
+
|
716
|
+
const CXmlItem &arrItem = rfDictItem.SubItems[arrIndex];
|
717
|
+
|
718
|
+
FOR_VECTOR (i, arrItem.SubItems)
|
387
719
|
{
|
388
|
-
|
389
|
-
|
720
|
+
const CXmlItem &item = arrItem.SubItems[i];
|
721
|
+
if (!item.IsTagged("dict"))
|
722
|
+
continue;
|
723
|
+
|
724
|
+
CByteBuffer rawBuf;
|
725
|
+
unsigned destLen = 0;
|
726
|
+
{
|
727
|
+
const AString *dataString = GetStringFromKeyPair(item, "Data", "data");
|
728
|
+
if (!dataString)
|
729
|
+
return S_FALSE;
|
730
|
+
destLen = dataString->Len() / 4 * 3 + 4;
|
731
|
+
rawBuf.Alloc(destLen);
|
732
|
+
{
|
733
|
+
const Byte *endPtr = Base64ToBin(rawBuf, *dataString);
|
734
|
+
if (!endPtr)
|
735
|
+
return S_FALSE;
|
736
|
+
destLen = (unsigned)(endPtr - rawBuf);
|
737
|
+
}
|
738
|
+
|
739
|
+
#ifdef DMG_SHOW_RAW
|
740
|
+
CExtraFile &extra = _extras.AddNew();
|
741
|
+
{
|
742
|
+
char extraName[16];
|
743
|
+
ConvertUInt32ToString(_files.Size(), extraName);
|
744
|
+
extra.Name = extraName;
|
745
|
+
}
|
746
|
+
extra.Data.CopyFrom(rawBuf, destLen);
|
747
|
+
#endif
|
748
|
+
}
|
749
|
+
CFile &file = _files.AddNew();
|
750
|
+
{
|
751
|
+
const AString *name = GetStringFromKeyPair(item, "Name", "string");
|
752
|
+
if (!name || name->IsEmpty())
|
753
|
+
name = GetStringFromKeyPair(item, "CFName", "string");
|
754
|
+
if (name)
|
755
|
+
file.Name = *name;
|
756
|
+
}
|
757
|
+
RINOK(file.Parse(rawBuf, destLen));
|
390
758
|
}
|
391
759
|
}
|
392
|
-
|
393
|
-
// PackPos for each new file is 0 in some DMG files. So we use additional StartPos
|
394
760
|
|
395
|
-
|
396
|
-
for (i = 0; i < _files.Size(); i++)
|
397
|
-
{
|
398
|
-
const CFile &file = _files[i];
|
399
|
-
if (!file.Blocks.IsEmpty() && file.Blocks[0].PackPos != 0)
|
400
|
-
allStartAreZeros = false;
|
401
|
-
}
|
402
|
-
UInt64 startPos = 0;
|
403
|
-
if (allStartAreZeros)
|
761
|
+
if (masterChecksum.IsCrc32())
|
404
762
|
{
|
763
|
+
UInt32 crc = CRC_INIT_VAL;
|
764
|
+
unsigned i;
|
405
765
|
for (i = 0; i < _files.Size(); i++)
|
406
766
|
{
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
767
|
+
const CChecksum &cs = _files[i].Checksum;
|
768
|
+
if ((cs.NumBits & 0x7) != 0)
|
769
|
+
break;
|
770
|
+
UInt32 len = cs.NumBits >> 3;
|
771
|
+
if (len > kChecksumSize_Max)
|
772
|
+
break;
|
773
|
+
crc = CrcUpdate(crc, cs.Data, (size_t)len);
|
411
774
|
}
|
775
|
+
if (i == _files.Size())
|
776
|
+
_masterCrcError = (CRC_GET_DIGEST(crc) != masterChecksum.GetCrc32());
|
412
777
|
}
|
413
778
|
|
414
779
|
return S_OK;
|
@@ -431,24 +796,27 @@ STDMETHODIMP CHandler::Open(IInStream *stream,
|
|
431
796
|
|
432
797
|
STDMETHODIMP CHandler::Close()
|
433
798
|
{
|
799
|
+
_phySize = 0;
|
434
800
|
_inStream.Release();
|
435
|
-
_fileIndices.Clear();
|
436
801
|
_files.Clear();
|
437
|
-
|
802
|
+
_masterCrcError = false;
|
803
|
+
#ifdef DMG_SHOW_RAW
|
804
|
+
_extras.Clear();
|
805
|
+
#endif
|
438
806
|
return S_OK;
|
439
807
|
}
|
440
808
|
|
441
809
|
STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
|
442
810
|
{
|
443
|
-
*numItems =
|
811
|
+
*numItems = _files.Size()
|
444
812
|
#ifdef DMG_SHOW_RAW
|
445
|
-
+
|
813
|
+
+ _extras.Size()
|
446
814
|
#endif
|
447
815
|
;
|
448
816
|
return S_OK;
|
449
817
|
}
|
450
818
|
|
451
|
-
#define RAW_PREFIX
|
819
|
+
#define RAW_PREFIX "raw" STRING_PATH_SEPARATOR
|
452
820
|
|
453
821
|
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
|
454
822
|
{
|
@@ -456,69 +824,58 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
|
456
824
|
NWindows::NCOM::CPropVariant prop;
|
457
825
|
|
458
826
|
#ifdef DMG_SHOW_RAW
|
459
|
-
if (
|
827
|
+
if (index >= _files.Size())
|
460
828
|
{
|
461
|
-
|
829
|
+
const CExtraFile &extra = _extras[index - _files.Size()];
|
830
|
+
switch (propID)
|
462
831
|
{
|
463
832
|
case kpidPath:
|
464
|
-
prop = RAW_PREFIX
|
833
|
+
prop = (AString)RAW_PREFIX + extra.Name;
|
465
834
|
break;
|
466
835
|
case kpidSize:
|
467
836
|
case kpidPackSize:
|
468
|
-
prop = (UInt64)
|
837
|
+
prop = (UInt64)extra.Data.Size();
|
469
838
|
break;
|
470
839
|
}
|
471
840
|
}
|
472
|
-
else
|
841
|
+
else
|
842
|
+
#endif
|
473
843
|
{
|
474
|
-
|
475
|
-
switch(propID)
|
844
|
+
const CFile &item = _files[index];
|
845
|
+
switch (propID)
|
476
846
|
{
|
477
|
-
case
|
847
|
+
case kpidSize: prop = item.Size; break;
|
848
|
+
case kpidPackSize: prop = item.PackSize; break;
|
849
|
+
case kpidCRC:
|
478
850
|
{
|
479
|
-
|
480
|
-
|
481
|
-
prop = s;
|
851
|
+
if (item.Checksum.IsCrc32() && item.FullFileChecksum)
|
852
|
+
prop = item.Checksum.GetCrc32();
|
482
853
|
break;
|
483
854
|
}
|
484
|
-
|
485
|
-
case kpidPackSize:
|
486
|
-
prop = (UInt64)_files[rawIndex].Raw.GetCapacity();
|
487
|
-
break;
|
488
|
-
}
|
489
|
-
}
|
490
|
-
else
|
491
|
-
#endif
|
492
|
-
{
|
493
|
-
int itemIndex = _fileIndices[index];
|
494
|
-
const CFile &item = _files[itemIndex];
|
495
|
-
switch(propID)
|
496
|
-
{
|
855
|
+
|
497
856
|
case kpidMethod:
|
498
857
|
{
|
499
858
|
CMethods m;
|
500
859
|
m.Update(item);
|
501
|
-
|
502
|
-
|
503
|
-
|
860
|
+
AString s;
|
861
|
+
m.GetString(s);
|
862
|
+
if (!s.IsEmpty())
|
863
|
+
prop = s;
|
504
864
|
break;
|
505
865
|
}
|
506
866
|
|
507
|
-
// case kpidExtension: prop = L"hfs"; break;
|
508
|
-
|
509
867
|
case kpidPath:
|
510
868
|
{
|
511
|
-
// break;
|
512
869
|
UString name;
|
513
|
-
wchar_t s[
|
514
|
-
|
870
|
+
wchar_t s[16];
|
871
|
+
ConvertUInt32ToString(index, s);
|
515
872
|
name = s;
|
516
|
-
|
517
|
-
|
518
|
-
for (numDigits = 1; num <
|
873
|
+
unsigned num = 10;
|
874
|
+
unsigned numDigits;
|
875
|
+
for (numDigits = 1; num < _files.Size(); numDigits++)
|
519
876
|
num *= 10;
|
520
|
-
while (name.
|
521
|
-
name
|
877
|
+
while (name.Len() < numDigits)
|
878
|
+
name.InsertAtFront(L'0');
|
522
879
|
|
523
880
|
AString subName;
|
524
881
|
int pos1 = item.Name.Find('(');
|
@@ -528,23 +885,27 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
|
528
885
|
int pos2 = item.Name.Find(')', pos1);
|
529
886
|
if (pos2 >= 0)
|
530
887
|
{
|
531
|
-
subName
|
888
|
+
subName.SetFrom(item.Name.Ptr(pos1), pos2 - pos1);
|
532
889
|
pos1 = subName.Find(':');
|
533
890
|
if (pos1 >= 0)
|
534
|
-
subName
|
891
|
+
subName.DeleteFrom(pos1);
|
535
892
|
}
|
536
893
|
}
|
537
894
|
subName.Trim();
|
538
895
|
if (!subName.IsEmpty())
|
539
896
|
{
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
897
|
+
for (unsigned n = 0; n < kNumAppleNames; n++)
|
898
|
+
{
|
899
|
+
const CAppleName &appleName = k_Names[n];
|
900
|
+
if (appleName.Ext)
|
901
|
+
{
|
902
|
+
if (subName == appleName.AppleName)
|
903
|
+
{
|
904
|
+
subName = appleName.Ext;
|
905
|
+
break;
|
906
|
+
}
|
907
|
+
}
|
908
|
+
}
|
548
909
|
UString name2;
|
549
910
|
ConvertUTF8ToUnicode(subName, name2);
|
550
911
|
name += L'.';
|
@@ -555,12 +916,13 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
|
555
916
|
UString name2;
|
556
917
|
ConvertUTF8ToUnicode(item.Name, name2);
|
557
918
|
if (!name2.IsEmpty())
|
558
|
-
name
|
919
|
+
name.AddAscii(" - ");
|
559
920
|
name += name2;
|
560
921
|
}
|
561
922
|
prop = name;
|
562
923
|
break;
|
563
924
|
}
|
925
|
+
|
564
926
|
case kpidComment:
|
565
927
|
{
|
566
928
|
UString name;
|
@@ -568,9 +930,6 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
|
568
930
|
prop = name;
|
569
931
|
break;
|
570
932
|
}
|
571
|
-
|
572
|
-
case kpidSize: prop = item.GetUnpackSize(); break;
|
573
|
-
case kpidPackSize: prop = item.GetPackSize(); break;
|
574
933
|
}
|
575
934
|
}
|
576
935
|
prop.Detach(value);
|
@@ -585,11 +944,13 @@ class CAdcDecoder:
|
|
585
944
|
CLzOutWindow m_OutWindowStream;
|
586
945
|
CInBuffer m_InStream;
|
587
946
|
|
947
|
+
/*
|
588
948
|
void ReleaseStreams()
|
589
949
|
{
|
590
950
|
m_OutWindowStream.ReleaseStream();
|
591
951
|
m_InStream.ReleaseStream();
|
592
952
|
}
|
953
|
+
*/
|
593
954
|
|
594
955
|
class CCoderReleaser
|
595
956
|
{
|
@@ -601,7 +962,7 @@ class CAdcDecoder:
|
|
601
962
|
{
|
602
963
|
if (NeedFlush)
|
603
964
|
m_Coder->m_OutWindowStream.Flush();
|
604
|
-
m_Coder->ReleaseStreams();
|
965
|
+
// m_Coder->ReleaseStreams();
|
605
966
|
}
|
606
967
|
};
|
607
968
|
friend class CCoderReleaser;
|
@@ -711,24 +1072,23 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
711
1072
|
Int32 testMode, IArchiveExtractCallback *extractCallback)
|
712
1073
|
{
|
713
1074
|
COM_TRY_BEGIN
|
714
|
-
bool allFilesMode = (numItems == (UInt32)-1);
|
1075
|
+
bool allFilesMode = (numItems == (UInt32)(Int32)-1);
|
715
1076
|
if (allFilesMode)
|
716
1077
|
numItems = _files.Size();
|
717
1078
|
if (numItems == 0)
|
718
1079
|
return S_OK;
|
719
1080
|
UInt64 totalSize = 0;
|
720
1081
|
UInt32 i;
|
1082
|
+
|
721
1083
|
for (i = 0; i < numItems; i++)
|
722
1084
|
{
|
723
|
-
|
1085
|
+
UInt32 index = (allFilesMode ? i : indices[i]);
|
724
1086
|
#ifdef DMG_SHOW_RAW
|
725
|
-
if (index
|
726
|
-
totalSize +=
|
727
|
-
else if (index > _fileIndices.Size())
|
728
|
-
totalSize += _files[index - (_fileIndices.Size() + 1)].Raw.GetCapacity();
|
1087
|
+
if (index >= _files.Size())
|
1088
|
+
totalSize += _extras[index - _files.Size()].Data.Size();
|
729
1089
|
else
|
730
1090
|
#endif
|
731
|
-
totalSize += _files[
|
1091
|
+
totalSize += _files[index].Size;
|
732
1092
|
}
|
733
1093
|
extractCallback->SetTotal(totalSize);
|
734
1094
|
|
@@ -738,8 +1098,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
738
1098
|
UInt64 currentUnpSize = 0;
|
739
1099
|
|
740
1100
|
const UInt32 kZeroBufSize = (1 << 14);
|
741
|
-
CByteBuffer zeroBuf;
|
742
|
-
zeroBuf.SetCapacity(kZeroBufSize);
|
1101
|
+
CByteBuffer zeroBuf(kZeroBufSize);
|
743
1102
|
memset(zeroBuf, 0, kZeroBufSize);
|
744
1103
|
|
745
1104
|
NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
|
@@ -773,53 +1132,56 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
773
1132
|
Int32 askMode = testMode ?
|
774
1133
|
NExtract::NAskMode::kTest :
|
775
1134
|
NExtract::NAskMode::kExtract;
|
776
|
-
|
777
|
-
// const CItemEx &item = _files[index];
|
1135
|
+
UInt32 index = allFilesMode ? i : indices[i];
|
778
1136
|
RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
|
779
|
-
|
780
|
-
|
1137
|
+
|
781
1138
|
if (!testMode && !realOutStream)
|
782
1139
|
continue;
|
783
1140
|
RINOK(extractCallback->PrepareOperation(askMode));
|
784
1141
|
|
1142
|
+
|
1143
|
+
COutStreamWithCRC *outCrcStreamSpec = new COutStreamWithCRC;
|
1144
|
+
CMyComPtr<ISequentialOutStream> outCrcStream = outCrcStreamSpec;
|
1145
|
+
outCrcStreamSpec->SetStream(realOutStream);
|
1146
|
+
bool needCrc = false;
|
1147
|
+
outCrcStreamSpec->Init(needCrc);
|
1148
|
+
|
785
1149
|
CLimitedSequentialOutStream *outStreamSpec = new CLimitedSequentialOutStream;
|
786
1150
|
CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
|
787
|
-
outStreamSpec->SetStream(
|
1151
|
+
outStreamSpec->SetStream(outCrcStream);
|
788
1152
|
|
789
1153
|
realOutStream.Release();
|
790
1154
|
|
791
1155
|
Int32 opRes = NExtract::NOperationResult::kOK;
|
792
1156
|
#ifdef DMG_SHOW_RAW
|
793
|
-
if (index
|
794
|
-
{
|
795
|
-
const CByteBuffer &buf = _files[index - (_fileIndices.Size() + 1)].Raw;
|
796
|
-
outStreamSpec->Init(buf.GetCapacity());
|
797
|
-
RINOK(WriteStream(outStream, buf, buf.GetCapacity()));
|
798
|
-
currentPackSize = currentUnpSize = buf.GetCapacity();
|
799
|
-
}
|
800
|
-
else if (index == _fileIndices.Size())
|
1157
|
+
if (index >= _files.Size())
|
801
1158
|
{
|
802
|
-
|
803
|
-
|
804
|
-
|
1159
|
+
const CByteBuffer &buf = _extras[index - _files.Size()].Data;
|
1160
|
+
outStreamSpec->Init(buf.Size());
|
1161
|
+
RINOK(WriteStream(outStream, buf, buf.Size()));
|
1162
|
+
currentPackSize = currentUnpSize = buf.Size();
|
805
1163
|
}
|
806
1164
|
else
|
807
1165
|
#endif
|
808
1166
|
{
|
809
|
-
const CFile &item = _files[
|
810
|
-
currentPackSize = item.
|
811
|
-
currentUnpSize = item.
|
1167
|
+
const CFile &item = _files[index];
|
1168
|
+
currentPackSize = item.PackSize;
|
1169
|
+
currentUnpSize = item.Size;
|
1170
|
+
|
1171
|
+
needCrc = item.Checksum.IsCrc32();
|
812
1172
|
|
813
1173
|
UInt64 unpPos = 0;
|
814
1174
|
UInt64 packPos = 0;
|
815
1175
|
{
|
816
|
-
|
1176
|
+
FOR_VECTOR (j, item.Blocks)
|
817
1177
|
{
|
818
1178
|
lps->InSize = currentPackTotal + packPos;
|
819
1179
|
lps->OutSize = currentUnpTotal + unpPos;
|
820
1180
|
RINOK(lps->SetCur());
|
821
1181
|
|
822
1182
|
const CBlock &block = item.Blocks[j];
|
1183
|
+
if (!block.ThereAreDataInBlock())
|
1184
|
+
continue;
|
823
1185
|
|
824
1186
|
packPos += block.PackSize;
|
825
1187
|
if (block.UnpPos != unpPos)
|
@@ -828,26 +1190,28 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
828
1190
|
break;
|
829
1191
|
}
|
830
1192
|
|
831
|
-
RINOK(_inStream->Seek(item.StartPos + block.PackPos, STREAM_SEEK_SET, NULL));
|
1193
|
+
RINOK(_inStream->Seek(_startPos + item.StartPos + block.PackPos, STREAM_SEEK_SET, NULL));
|
832
1194
|
streamSpec->Init(block.PackSize);
|
833
|
-
// UInt64 startSize = outStreamSpec->GetSize();
|
834
1195
|
bool realMethod = true;
|
835
1196
|
outStreamSpec->Init(block.UnpSize);
|
836
1197
|
HRESULT res = S_OK;
|
837
1198
|
|
838
|
-
|
1199
|
+
outCrcStreamSpec->EnableCalc(needCrc);
|
1200
|
+
|
1201
|
+
switch (block.Type)
|
839
1202
|
{
|
840
1203
|
case METHOD_ZERO_0:
|
841
1204
|
case METHOD_ZERO_2:
|
842
1205
|
realMethod = false;
|
843
1206
|
if (block.PackSize != 0)
|
844
|
-
opRes = NExtract::NOperationResult::
|
1207
|
+
opRes = NExtract::NOperationResult::kUnsupportedMethod;
|
1208
|
+
outCrcStreamSpec->EnableCalc(block.Type == METHOD_ZERO_0);
|
845
1209
|
break;
|
846
1210
|
|
847
1211
|
case METHOD_COPY:
|
848
1212
|
if (block.UnpSize != block.PackSize)
|
849
1213
|
{
|
850
|
-
opRes = NExtract::NOperationResult::
|
1214
|
+
opRes = NExtract::NOperationResult::kUnsupportedMethod;
|
851
1215
|
break;
|
852
1216
|
}
|
853
1217
|
res = copyCoder->Code(inStream, outStream, NULL, NULL, progress);
|
@@ -862,6 +1226,9 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
862
1226
|
case METHOD_ZLIB:
|
863
1227
|
{
|
864
1228
|
res = zlibCoder->Code(inStream, outStream, NULL, NULL, progress);
|
1229
|
+
if (res == S_OK)
|
1230
|
+
if (zlibCoderSpec->GetInputProcessedSize() != block.PackSize)
|
1231
|
+
opRes = NExtract::NOperationResult::kDataError;
|
865
1232
|
break;
|
866
1233
|
}
|
867
1234
|
|
@@ -869,15 +1236,16 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
869
1236
|
{
|
870
1237
|
res = bzip2Coder->Code(inStream, outStream, NULL, NULL, progress);
|
871
1238
|
if (res == S_OK)
|
872
|
-
if (
|
1239
|
+
if (bzip2CoderSpec->GetInputProcessedSize() != block.PackSize)
|
873
1240
|
opRes = NExtract::NOperationResult::kDataError;
|
874
1241
|
break;
|
875
1242
|
}
|
876
1243
|
|
877
1244
|
default:
|
878
|
-
opRes = NExtract::NOperationResult::
|
1245
|
+
opRes = NExtract::NOperationResult::kUnsupportedMethod;
|
879
1246
|
break;
|
880
1247
|
}
|
1248
|
+
|
881
1249
|
if (res != S_OK)
|
882
1250
|
{
|
883
1251
|
if (res != S_FALSE)
|
@@ -885,7 +1253,9 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
885
1253
|
if (opRes == NExtract::NOperationResult::kOK)
|
886
1254
|
opRes = NExtract::NOperationResult::kDataError;
|
887
1255
|
}
|
1256
|
+
|
888
1257
|
unpPos += block.UnpSize;
|
1258
|
+
|
889
1259
|
if (!outStreamSpec->IsFinishedOK())
|
890
1260
|
{
|
891
1261
|
if (realMethod && opRes == NExtract::NOperationResult::kOK)
|
@@ -900,19 +1270,317 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
900
1270
|
}
|
901
1271
|
}
|
902
1272
|
}
|
1273
|
+
|
1274
|
+
if (needCrc && opRes == NExtract::NOperationResult::kOK)
|
1275
|
+
{
|
1276
|
+
if (outCrcStreamSpec->GetCRC() != item.Checksum.GetCrc32())
|
1277
|
+
opRes = NExtract::NOperationResult::kCRCError;
|
1278
|
+
}
|
903
1279
|
}
|
904
1280
|
outStream.Release();
|
905
1281
|
RINOK(extractCallback->SetOperationResult(opRes));
|
906
1282
|
}
|
1283
|
+
|
907
1284
|
return S_OK;
|
908
1285
|
COM_TRY_END
|
909
1286
|
}
|
910
1287
|
|
911
|
-
|
1288
|
+
struct CChunk
|
1289
|
+
{
|
1290
|
+
int BlockIndex;
|
1291
|
+
UInt64 AccessMark;
|
1292
|
+
CByteBuffer Buf;
|
1293
|
+
};
|
1294
|
+
|
1295
|
+
class CInStream:
|
1296
|
+
public IInStream,
|
1297
|
+
public CMyUnknownImp
|
1298
|
+
{
|
1299
|
+
UInt64 _virtPos;
|
1300
|
+
int _latestChunk;
|
1301
|
+
int _latestBlock;
|
1302
|
+
UInt64 _accessMark;
|
1303
|
+
CObjectVector<CChunk> _chunks;
|
1304
|
+
|
1305
|
+
NCompress::NBZip2::CDecoder *bzip2CoderSpec;
|
1306
|
+
CMyComPtr<ICompressCoder> bzip2Coder;
|
1307
|
+
|
1308
|
+
NCompress::NZlib::CDecoder *zlibCoderSpec;
|
1309
|
+
CMyComPtr<ICompressCoder> zlibCoder;
|
1310
|
+
|
1311
|
+
CAdcDecoder *adcCoderSpec;
|
1312
|
+
CMyComPtr<ICompressCoder> adcCoder;
|
1313
|
+
|
1314
|
+
CBufPtrSeqOutStream *outStreamSpec;
|
1315
|
+
CMyComPtr<ISequentialOutStream> outStream;
|
912
1316
|
|
913
|
-
|
914
|
-
|
1317
|
+
CLimitedSequentialInStream *limitedStreamSpec;
|
1318
|
+
CMyComPtr<ISequentialInStream> inStream;
|
1319
|
+
|
1320
|
+
public:
|
1321
|
+
CMyComPtr<IInStream> Stream;
|
1322
|
+
UInt64 Size;
|
1323
|
+
const CFile *File;
|
1324
|
+
UInt64 _startPos;
|
1325
|
+
|
1326
|
+
HRESULT InitAndSeek(UInt64 startPos)
|
1327
|
+
{
|
1328
|
+
_startPos = startPos;
|
1329
|
+
_virtPos = 0;
|
1330
|
+
_latestChunk = -1;
|
1331
|
+
_latestBlock = -1;
|
1332
|
+
_accessMark = 0;
|
1333
|
+
|
1334
|
+
limitedStreamSpec = new CLimitedSequentialInStream;
|
1335
|
+
inStream = limitedStreamSpec;
|
1336
|
+
limitedStreamSpec->SetStream(Stream);
|
1337
|
+
|
1338
|
+
outStreamSpec = new CBufPtrSeqOutStream;
|
1339
|
+
outStream = outStreamSpec;
|
1340
|
+
return S_OK;
|
1341
|
+
}
|
1342
|
+
|
1343
|
+
MY_UNKNOWN_IMP1(IInStream)
|
1344
|
+
|
1345
|
+
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
|
1346
|
+
STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
|
1347
|
+
};
|
1348
|
+
|
1349
|
+
|
1350
|
+
unsigned FindBlock(const CRecordVector<CBlock> &blocks, UInt64 pos)
|
1351
|
+
{
|
1352
|
+
unsigned left = 0, right = blocks.Size();
|
1353
|
+
for (;;)
|
1354
|
+
{
|
1355
|
+
unsigned mid = (left + right) / 2;
|
1356
|
+
if (mid == left)
|
1357
|
+
return left;
|
1358
|
+
if (pos < blocks[mid].UnpPos)
|
1359
|
+
right = mid;
|
1360
|
+
else
|
1361
|
+
left = mid;
|
1362
|
+
}
|
1363
|
+
}
|
1364
|
+
|
1365
|
+
STDMETHODIMP CInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
1366
|
+
{
|
1367
|
+
COM_TRY_BEGIN
|
1368
|
+
|
1369
|
+
if (processedSize)
|
1370
|
+
*processedSize = 0;
|
1371
|
+
if (size == 0)
|
1372
|
+
return S_OK;
|
1373
|
+
if (_virtPos >= Size)
|
1374
|
+
return S_OK; // (Size == _virtPos) ? S_OK: E_FAIL;
|
1375
|
+
{
|
1376
|
+
UInt64 rem = Size - _virtPos;
|
1377
|
+
if (size > rem)
|
1378
|
+
size = (UInt32)rem;
|
1379
|
+
}
|
1380
|
+
|
1381
|
+
if (_latestBlock >= 0)
|
1382
|
+
{
|
1383
|
+
const CBlock &block = File->Blocks[_latestBlock];
|
1384
|
+
if (_virtPos < block.UnpPos || (_virtPos - block.UnpPos) >= block.UnpSize)
|
1385
|
+
_latestBlock = -1;
|
1386
|
+
}
|
1387
|
+
|
1388
|
+
if (_latestBlock < 0)
|
1389
|
+
{
|
1390
|
+
_latestChunk = -1;
|
1391
|
+
unsigned blockIndex = FindBlock(File->Blocks, _virtPos);
|
1392
|
+
const CBlock &block = File->Blocks[blockIndex];
|
1393
|
+
|
1394
|
+
if (!block.IsZeroMethod() && block.Type != METHOD_COPY)
|
1395
|
+
{
|
1396
|
+
unsigned i;
|
1397
|
+
for (i = 0; i < _chunks.Size(); i++)
|
1398
|
+
if (_chunks[i].BlockIndex == (int)blockIndex)
|
1399
|
+
break;
|
1400
|
+
|
1401
|
+
if (i != _chunks.Size())
|
1402
|
+
_latestChunk = i;
|
1403
|
+
else
|
1404
|
+
{
|
1405
|
+
const unsigned kNumChunksMax = 128;
|
1406
|
+
unsigned chunkIndex;
|
1407
|
+
|
1408
|
+
if (_chunks.Size() != kNumChunksMax)
|
1409
|
+
chunkIndex = _chunks.Add(CChunk());
|
1410
|
+
else
|
1411
|
+
{
|
1412
|
+
chunkIndex = 0;
|
1413
|
+
for (i = 0; i < _chunks.Size(); i++)
|
1414
|
+
if (_chunks[i].AccessMark < _chunks[chunkIndex].AccessMark)
|
1415
|
+
chunkIndex = i;
|
1416
|
+
}
|
1417
|
+
|
1418
|
+
CChunk &chunk = _chunks[chunkIndex];
|
1419
|
+
chunk.BlockIndex = -1;
|
1420
|
+
chunk.AccessMark = 0;
|
1421
|
+
|
1422
|
+
if (chunk.Buf.Size() < block.UnpSize)
|
1423
|
+
{
|
1424
|
+
chunk.Buf.Free();
|
1425
|
+
if (block.UnpSize > ((UInt32)1 << 31))
|
1426
|
+
return E_FAIL;
|
1427
|
+
chunk.Buf.Alloc((size_t)block.UnpSize);
|
1428
|
+
}
|
1429
|
+
|
1430
|
+
outStreamSpec->Init(chunk.Buf, (size_t)block.UnpSize);
|
1431
|
+
|
1432
|
+
RINOK(Stream->Seek(_startPos + File->StartPos + block.PackPos, STREAM_SEEK_SET, NULL));
|
1433
|
+
|
1434
|
+
limitedStreamSpec->Init(block.PackSize);
|
1435
|
+
HRESULT res = S_OK;
|
1436
|
+
|
1437
|
+
switch (block.Type)
|
1438
|
+
{
|
1439
|
+
case METHOD_COPY:
|
1440
|
+
if (block.PackSize != block.UnpSize)
|
1441
|
+
return E_FAIL;
|
1442
|
+
res = ReadStream_FAIL(inStream, chunk.Buf, (size_t)block.UnpSize);
|
1443
|
+
break;
|
1444
|
+
|
1445
|
+
case METHOD_ADC:
|
1446
|
+
if (!adcCoder)
|
1447
|
+
{
|
1448
|
+
adcCoderSpec = new CAdcDecoder();
|
1449
|
+
adcCoder = adcCoderSpec;
|
1450
|
+
}
|
1451
|
+
res = adcCoder->Code(inStream, outStream, &block.PackSize, &block.UnpSize, NULL);
|
1452
|
+
break;
|
1453
|
+
|
1454
|
+
case METHOD_ZLIB:
|
1455
|
+
if (!zlibCoder)
|
1456
|
+
{
|
1457
|
+
zlibCoderSpec = new NCompress::NZlib::CDecoder();
|
1458
|
+
zlibCoder = zlibCoderSpec;
|
1459
|
+
}
|
1460
|
+
res = zlibCoder->Code(inStream, outStream, NULL, NULL, NULL);
|
1461
|
+
if (res == S_OK && zlibCoderSpec->GetInputProcessedSize() != block.PackSize)
|
1462
|
+
res = S_FALSE;
|
1463
|
+
break;
|
1464
|
+
|
1465
|
+
case METHOD_BZIP2:
|
1466
|
+
if (!bzip2Coder)
|
1467
|
+
{
|
1468
|
+
bzip2CoderSpec = new NCompress::NBZip2::CDecoder();
|
1469
|
+
bzip2Coder = bzip2CoderSpec;
|
1470
|
+
}
|
1471
|
+
res = bzip2Coder->Code(inStream, outStream, NULL, NULL, NULL);
|
1472
|
+
if (res == S_OK && bzip2CoderSpec->GetInputProcessedSize() != block.PackSize)
|
1473
|
+
res = S_FALSE;
|
1474
|
+
break;
|
1475
|
+
|
1476
|
+
default:
|
1477
|
+
return E_FAIL;
|
1478
|
+
}
|
1479
|
+
|
1480
|
+
if (res != S_OK)
|
1481
|
+
return res;
|
1482
|
+
if (block.Type != METHOD_COPY && outStreamSpec->GetPos() != block.UnpSize)
|
1483
|
+
return E_FAIL;
|
1484
|
+
chunk.BlockIndex = blockIndex;
|
1485
|
+
_latestChunk = chunkIndex;
|
1486
|
+
}
|
1487
|
+
|
1488
|
+
_chunks[_latestChunk].AccessMark = _accessMark++;
|
1489
|
+
}
|
1490
|
+
|
1491
|
+
_latestBlock = blockIndex;
|
1492
|
+
}
|
1493
|
+
|
1494
|
+
const CBlock &block = File->Blocks[_latestBlock];
|
1495
|
+
UInt64 offset = _virtPos - block.UnpPos;
|
1496
|
+
UInt64 rem = block.UnpSize - offset;
|
1497
|
+
if (size > rem)
|
1498
|
+
size = (UInt32)rem;
|
1499
|
+
|
1500
|
+
HRESULT res = S_OK;
|
1501
|
+
|
1502
|
+
if (block.Type == METHOD_COPY)
|
1503
|
+
{
|
1504
|
+
RINOK(Stream->Seek(_startPos + File->StartPos + block.PackPos + offset, STREAM_SEEK_SET, NULL));
|
1505
|
+
res = Stream->Read(data, size, &size);
|
1506
|
+
}
|
1507
|
+
else if (block.IsZeroMethod())
|
1508
|
+
memset(data, 0, size);
|
1509
|
+
else if (size != 0)
|
1510
|
+
memcpy(data, _chunks[_latestChunk].Buf + offset, size);
|
1511
|
+
|
1512
|
+
_virtPos += size;
|
1513
|
+
if (processedSize)
|
1514
|
+
*processedSize = size;
|
1515
|
+
|
1516
|
+
return res;
|
1517
|
+
COM_TRY_END
|
1518
|
+
}
|
1519
|
+
|
1520
|
+
STDMETHODIMP CInStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
|
1521
|
+
{
|
1522
|
+
switch (seekOrigin)
|
1523
|
+
{
|
1524
|
+
case STREAM_SEEK_SET: break;
|
1525
|
+
case STREAM_SEEK_CUR: offset += _virtPos; break;
|
1526
|
+
case STREAM_SEEK_END: offset += Size; break;
|
1527
|
+
default: return STG_E_INVALIDFUNCTION;
|
1528
|
+
}
|
1529
|
+
if (offset < 0)
|
1530
|
+
return HRESULT_WIN32_ERROR_NEGATIVE_SEEK;
|
1531
|
+
_virtPos = offset;
|
1532
|
+
if (newPosition)
|
1533
|
+
*newPosition = offset;
|
1534
|
+
return S_OK;
|
1535
|
+
}
|
1536
|
+
|
1537
|
+
STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
|
1538
|
+
{
|
1539
|
+
COM_TRY_BEGIN
|
1540
|
+
|
1541
|
+
#ifdef DMG_SHOW_RAW
|
1542
|
+
if (index >= (UInt32)_files.Size())
|
1543
|
+
return S_FALSE;
|
1544
|
+
#endif
|
1545
|
+
|
1546
|
+
CInStream *spec = new CInStream;
|
1547
|
+
CMyComPtr<ISequentialInStream> specStream = spec;
|
1548
|
+
spec->File = &_files[index];
|
1549
|
+
const CFile &file = *spec->File;
|
1550
|
+
|
1551
|
+
FOR_VECTOR (i, file.Blocks)
|
1552
|
+
{
|
1553
|
+
const CBlock &block = file.Blocks[i];
|
1554
|
+
switch (block.Type)
|
1555
|
+
{
|
1556
|
+
case METHOD_ZERO_0:
|
1557
|
+
case METHOD_ZERO_2:
|
1558
|
+
case METHOD_COPY:
|
1559
|
+
case METHOD_ADC:
|
1560
|
+
case METHOD_ZLIB:
|
1561
|
+
case METHOD_BZIP2:
|
1562
|
+
case METHOD_END:
|
1563
|
+
break;
|
1564
|
+
default:
|
1565
|
+
return S_FALSE;
|
1566
|
+
}
|
1567
|
+
}
|
1568
|
+
|
1569
|
+
spec->Stream = _inStream;
|
1570
|
+
spec->Size = spec->File->Size;
|
1571
|
+
RINOK(spec->InitAndSeek(_startPos));
|
1572
|
+
*stream = specStream.Detach();
|
1573
|
+
return S_OK;
|
1574
|
+
|
1575
|
+
COM_TRY_END
|
1576
|
+
}
|
915
1577
|
|
916
|
-
|
1578
|
+
REGISTER_ARC_I(
|
1579
|
+
"Dmg", "dmg", 0, 0xE4,
|
1580
|
+
k_Signature,
|
1581
|
+
0,
|
1582
|
+
NArcInfoFlags::kBackwardOpen |
|
1583
|
+
NArcInfoFlags::kUseGlobalOffset,
|
1584
|
+
NULL)
|
917
1585
|
|
918
1586
|
}}
|