7zip-native 0.0.0-stage → 0.0.1
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.
- package/LICENSE +21 -0
- package/README.md +103 -2
- package/THIRD_PARTY_NOTICES.md +23 -0
- package/bench/args.mts +69 -0
- package/bench/benchmark.mts +102 -0
- package/bench/compare.mts +546 -0
- package/bench/concurrency.mts +196 -0
- package/binding.gyp +51 -0
- package/dist/index.cjs +433 -0
- package/dist/index.d.cts +59 -0
- package/dist/index.d.mts +59 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.mjs +429 -0
- package/docs/architecture.md +112 -0
- package/examples/basic.mts +19 -0
- package/native/addon.cpp +2154 -0
- package/package.json +85 -5
- package/prebuilds/linux-x64/7z.so +0 -0
- package/prebuilds/linux-x64/7zip_native.node +0 -0
- package/vendor/7zip/.gitattributes +2 -0
- package/vendor/7zip/Asm/arm/7zCrcOpt.asm +100 -0
- package/vendor/7zip/Asm/arm64/7zAsm.S +187 -0
- package/vendor/7zip/Asm/arm64/LzmaDecOpt.S +1487 -0
- package/vendor/7zip/Asm/x86/7zAsm.asm +341 -0
- package/vendor/7zip/Asm/x86/7zCrcOpt.asm +258 -0
- package/vendor/7zip/Asm/x86/AesOpt.asm +742 -0
- package/vendor/7zip/Asm/x86/LzFindOpt.asm +540 -0
- package/vendor/7zip/Asm/x86/LzmaDecOpt.asm +1339 -0
- package/vendor/7zip/Asm/x86/Sha1Opt.asm +263 -0
- package/vendor/7zip/Asm/x86/Sha256Opt.asm +275 -0
- package/vendor/7zip/Asm/x86/Sort.asm +860 -0
- package/vendor/7zip/Asm/x86/XzCrc64Opt.asm +523 -0
- package/vendor/7zip/C/7z.h +204 -0
- package/vendor/7zip/C/7zAlloc.c +89 -0
- package/vendor/7zip/C/7zAlloc.h +19 -0
- package/vendor/7zip/C/7zArcIn.c +1701 -0
- package/vendor/7zip/C/7zBuf.c +36 -0
- package/vendor/7zip/C/7zBuf.h +35 -0
- package/vendor/7zip/C/7zBuf2.c +52 -0
- package/vendor/7zip/C/7zCrc.c +420 -0
- package/vendor/7zip/C/7zCrc.h +28 -0
- package/vendor/7zip/C/7zCrcOpt.c +199 -0
- package/vendor/7zip/C/7zDec.c +672 -0
- package/vendor/7zip/C/7zFile.c +443 -0
- package/vendor/7zip/C/7zFile.h +91 -0
- package/vendor/7zip/C/7zStream.c +199 -0
- package/vendor/7zip/C/7zTypes.h +600 -0
- package/vendor/7zip/C/7zVersion.h +27 -0
- package/vendor/7zip/C/7zVersion.rc +55 -0
- package/vendor/7zip/C/7zWindows.h +107 -0
- package/vendor/7zip/C/7zip_gcc_c.mak +366 -0
- package/vendor/7zip/C/Aes.c +429 -0
- package/vendor/7zip/C/Aes.h +60 -0
- package/vendor/7zip/C/AesOpt.c +1002 -0
- package/vendor/7zip/C/Alloc.c +774 -0
- package/vendor/7zip/C/Alloc.h +76 -0
- package/vendor/7zip/C/Asm_c.mak +12 -0
- package/vendor/7zip/C/Bcj2.c +290 -0
- package/vendor/7zip/C/Bcj2.h +332 -0
- package/vendor/7zip/C/Bcj2Enc.c +509 -0
- package/vendor/7zip/C/Blake2.h +105 -0
- package/vendor/7zip/C/Blake2s.c +2672 -0
- package/vendor/7zip/C/Bra.c +709 -0
- package/vendor/7zip/C/Bra.h +105 -0
- package/vendor/7zip/C/Bra86.c +187 -0
- package/vendor/7zip/C/BraIA64.c +14 -0
- package/vendor/7zip/C/BwtSort.c +630 -0
- package/vendor/7zip/C/BwtSort.h +27 -0
- package/vendor/7zip/C/Compiler.h +287 -0
- package/vendor/7zip/C/CpuArch.c +970 -0
- package/vendor/7zip/C/CpuArch.h +719 -0
- package/vendor/7zip/C/Delta.c +169 -0
- package/vendor/7zip/C/Delta.h +19 -0
- package/vendor/7zip/C/DllSecur.c +99 -0
- package/vendor/7zip/C/DllSecur.h +20 -0
- package/vendor/7zip/C/HuffEnc.c +361 -0
- package/vendor/7zip/C/HuffEnc.h +23 -0
- package/vendor/7zip/C/LzFind.c +1746 -0
- package/vendor/7zip/C/LzFind.h +160 -0
- package/vendor/7zip/C/LzFindMt.c +1422 -0
- package/vendor/7zip/C/LzFindMt.h +114 -0
- package/vendor/7zip/C/LzFindOpt.c +578 -0
- package/vendor/7zip/C/LzHash.h +34 -0
- package/vendor/7zip/C/Lzma2Dec.c +493 -0
- package/vendor/7zip/C/Lzma2Dec.h +121 -0
- package/vendor/7zip/C/Lzma2DecMt.c +1095 -0
- package/vendor/7zip/C/Lzma2DecMt.h +81 -0
- package/vendor/7zip/C/Lzma2Enc.c +799 -0
- package/vendor/7zip/C/Lzma2Enc.h +58 -0
- package/vendor/7zip/C/Lzma86.h +111 -0
- package/vendor/7zip/C/Lzma86Dec.c +53 -0
- package/vendor/7zip/C/Lzma86Enc.c +103 -0
- package/vendor/7zip/C/LzmaDec.c +1367 -0
- package/vendor/7zip/C/LzmaDec.h +237 -0
- package/vendor/7zip/C/LzmaEnc.c +3154 -0
- package/vendor/7zip/C/LzmaEnc.h +85 -0
- package/vendor/7zip/C/LzmaLib.c +42 -0
- package/vendor/7zip/C/LzmaLib.h +138 -0
- package/vendor/7zip/C/Md5.c +206 -0
- package/vendor/7zip/C/Md5.h +34 -0
- package/vendor/7zip/C/MtCoder.c +604 -0
- package/vendor/7zip/C/MtCoder.h +144 -0
- package/vendor/7zip/C/MtDec.c +1124 -0
- package/vendor/7zip/C/MtDec.h +202 -0
- package/vendor/7zip/C/Ppmd.h +169 -0
- package/vendor/7zip/C/Ppmd7.c +1131 -0
- package/vendor/7zip/C/Ppmd7.h +181 -0
- package/vendor/7zip/C/Ppmd7Dec.c +312 -0
- package/vendor/7zip/C/Ppmd7Enc.c +340 -0
- package/vendor/7zip/C/Ppmd7aDec.c +295 -0
- package/vendor/7zip/C/Ppmd8.c +1574 -0
- package/vendor/7zip/C/Ppmd8.h +181 -0
- package/vendor/7zip/C/Ppmd8Dec.c +295 -0
- package/vendor/7zip/C/Ppmd8Enc.c +337 -0
- package/vendor/7zip/C/Precomp.h +127 -0
- package/vendor/7zip/C/RotateDefs.h +50 -0
- package/vendor/7zip/C/Sha1.c +441 -0
- package/vendor/7zip/C/Sha1.h +86 -0
- package/vendor/7zip/C/Sha1Opt.c +424 -0
- package/vendor/7zip/C/Sha256.c +492 -0
- package/vendor/7zip/C/Sha256.h +86 -0
- package/vendor/7zip/C/Sha256Opt.c +451 -0
- package/vendor/7zip/C/Sha3.c +359 -0
- package/vendor/7zip/C/Sha3.h +36 -0
- package/vendor/7zip/C/Sha512.c +711 -0
- package/vendor/7zip/C/Sha512.h +86 -0
- package/vendor/7zip/C/Sha512Opt.c +395 -0
- package/vendor/7zip/C/Sort.c +268 -0
- package/vendor/7zip/C/Sort.h +15 -0
- package/vendor/7zip/C/SwapBytes.c +835 -0
- package/vendor/7zip/C/SwapBytes.h +17 -0
- package/vendor/7zip/C/Threads.c +826 -0
- package/vendor/7zip/C/Threads.h +260 -0
- package/vendor/7zip/C/Util/7z/7z.dsp +249 -0
- package/vendor/7zip/C/Util/7z/7z.dsw +29 -0
- package/vendor/7zip/C/Util/7z/7zMain.c +1210 -0
- package/vendor/7zip/C/Util/7z/Precomp.c +4 -0
- package/vendor/7zip/C/Util/7z/Precomp.h +13 -0
- package/vendor/7zip/C/Util/7z/makefile +44 -0
- package/vendor/7zip/C/Util/7z/makefile.gcc +32 -0
- package/vendor/7zip/C/Util/7zipInstall/7zip.ico +0 -0
- package/vendor/7zip/C/Util/7zipInstall/7zipInstall.c +1699 -0
- package/vendor/7zip/C/Util/7zipInstall/7zipInstall.dsp +248 -0
- package/vendor/7zip/C/Util/7zipInstall/7zipInstall.dsw +29 -0
- package/vendor/7zip/C/Util/7zipInstall/7zipInstall.manifest +18 -0
- package/vendor/7zip/C/Util/7zipInstall/Precomp.c +4 -0
- package/vendor/7zip/C/Util/7zipInstall/Precomp.h +13 -0
- package/vendor/7zip/C/Util/7zipInstall/makefile +47 -0
- package/vendor/7zip/C/Util/7zipInstall/resource.h +9 -0
- package/vendor/7zip/C/Util/7zipInstall/resource.rc +48 -0
- package/vendor/7zip/C/Util/7zipUninstall/7zipUninstall.c +1234 -0
- package/vendor/7zip/C/Util/7zipUninstall/7zipUninstall.dsp +132 -0
- package/vendor/7zip/C/Util/7zipUninstall/7zipUninstall.dsw +29 -0
- package/vendor/7zip/C/Util/7zipUninstall/7zipUninstall.ico +0 -0
- package/vendor/7zip/C/Util/7zipUninstall/7zipUninstall.manifest +18 -0
- package/vendor/7zip/C/Util/7zipUninstall/Precomp.c +4 -0
- package/vendor/7zip/C/Util/7zipUninstall/Precomp.h +13 -0
- package/vendor/7zip/C/Util/7zipUninstall/makefile +18 -0
- package/vendor/7zip/C/Util/7zipUninstall/resource.h +9 -0
- package/vendor/7zip/C/Util/7zipUninstall/resource.rc +48 -0
- package/vendor/7zip/C/Util/Lzma/LzmaUtil.c +313 -0
- package/vendor/7zip/C/Util/Lzma/LzmaUtil.dsp +192 -0
- package/vendor/7zip/C/Util/Lzma/LzmaUtil.dsw +29 -0
- package/vendor/7zip/C/Util/Lzma/Precomp.h +13 -0
- package/vendor/7zip/C/Util/Lzma/makefile +30 -0
- package/vendor/7zip/C/Util/Lzma/makefile.gcc +21 -0
- package/vendor/7zip/C/Util/LzmaLib/LzmaLib.def +4 -0
- package/vendor/7zip/C/Util/LzmaLib/LzmaLib.dsp +206 -0
- package/vendor/7zip/C/Util/LzmaLib/LzmaLib.dsw +29 -0
- package/vendor/7zip/C/Util/LzmaLib/LzmaLibExports.c +15 -0
- package/vendor/7zip/C/Util/LzmaLib/Precomp.c +4 -0
- package/vendor/7zip/C/Util/LzmaLib/Precomp.h +13 -0
- package/vendor/7zip/C/Util/LzmaLib/makefile +59 -0
- package/vendor/7zip/C/Util/LzmaLib/resource.rc +3 -0
- package/vendor/7zip/C/Util/SfxSetup/Precomp.c +4 -0
- package/vendor/7zip/C/Util/SfxSetup/Precomp.h +13 -0
- package/vendor/7zip/C/Util/SfxSetup/SfxSetup.c +657 -0
- package/vendor/7zip/C/Util/SfxSetup/SfxSetup.dsp +231 -0
- package/vendor/7zip/C/Util/SfxSetup/SfxSetup.dsw +29 -0
- package/vendor/7zip/C/Util/SfxSetup/makefile +44 -0
- package/vendor/7zip/C/Util/SfxSetup/makefile_con +40 -0
- package/vendor/7zip/C/Util/SfxSetup/resource.rc +5 -0
- package/vendor/7zip/C/Util/SfxSetup/setup.ico +0 -0
- package/vendor/7zip/C/Xxh64.c +389 -0
- package/vendor/7zip/C/Xxh64.h +50 -0
- package/vendor/7zip/C/Xz.c +92 -0
- package/vendor/7zip/C/Xz.h +542 -0
- package/vendor/7zip/C/XzCrc64.c +140 -0
- package/vendor/7zip/C/XzCrc64.h +26 -0
- package/vendor/7zip/C/XzCrc64Opt.c +261 -0
- package/vendor/7zip/C/XzDec.c +2865 -0
- package/vendor/7zip/C/XzEnc.c +1374 -0
- package/vendor/7zip/C/XzEnc.h +62 -0
- package/vendor/7zip/C/XzIn.c +385 -0
- package/vendor/7zip/C/ZstdDec.c +4067 -0
- package/vendor/7zip/C/ZstdDec.h +173 -0
- package/vendor/7zip/C/var_clang.mak +11 -0
- package/vendor/7zip/C/var_clang_arm64.mak +12 -0
- package/vendor/7zip/C/var_clang_x64.mak +11 -0
- package/vendor/7zip/C/var_clang_x86.mak +11 -0
- package/vendor/7zip/C/var_gcc.mak +12 -0
- package/vendor/7zip/C/var_gcc_arm64.mak +12 -0
- package/vendor/7zip/C/var_gcc_x64.mak +10 -0
- package/vendor/7zip/C/var_gcc_x86.mak +10 -0
- package/vendor/7zip/C/var_mac_arm64.mak +13 -0
- package/vendor/7zip/C/var_mac_x64.mak +13 -0
- package/vendor/7zip/C/warn_clang.mak +1 -0
- package/vendor/7zip/C/warn_clang_mac.mak +1 -0
- package/vendor/7zip/C/warn_gcc.mak +51 -0
- package/vendor/7zip/CPP/7zip/7zip.mak +240 -0
- package/vendor/7zip/CPP/7zip/7zip_gcc.mak +1376 -0
- package/vendor/7zip/CPP/7zip/Aes.mak +10 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7z.dsp +650 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7z.dsw +29 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zCompressionMode.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zCompressionMode.h +92 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zDecode.cpp +599 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zDecode.h +73 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zEncode.cpp +702 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zEncode.h +95 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zExtract.cpp +444 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zFolderInStream.cpp +264 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zFolderInStream.h +101 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zHandler.cpp +800 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zHandler.h +178 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zHandlerOut.cpp +1162 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zHeader.cpp +19 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zHeader.h +156 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zIn.cpp +1815 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zIn.h +454 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zItem.h +207 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zOut.cpp +1026 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zOut.h +346 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zProperties.cpp +182 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zProperties.h +26 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zRegister.cpp +27 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zSpecStream.cpp +31 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zSpecStream.h +49 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zUpdate.cpp +3087 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/7zUpdate.h +167 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/makefile +81 -0
- package/vendor/7zip/CPP/7zip/Archive/7z/resource.rc +11 -0
- package/vendor/7zip/CPP/7zip/Archive/ApfsHandler.cpp +4470 -0
- package/vendor/7zip/CPP/7zip/Archive/ApmHandler.cpp +420 -0
- package/vendor/7zip/CPP/7zip/Archive/ArHandler.cpp +844 -0
- package/vendor/7zip/CPP/7zip/Archive/Archive.def +15 -0
- package/vendor/7zip/CPP/7zip/Archive/Archive2.def +22 -0
- package/vendor/7zip/CPP/7zip/Archive/ArchiveExports.cpp +158 -0
- package/vendor/7zip/CPP/7zip/Archive/ArjHandler.cpp +977 -0
- package/vendor/7zip/CPP/7zip/Archive/AvbHandler.cpp +616 -0
- package/vendor/7zip/CPP/7zip/Archive/Base64Handler.cpp +488 -0
- package/vendor/7zip/CPP/7zip/Archive/Bz2Handler.cpp +482 -0
- package/vendor/7zip/CPP/7zip/Archive/Cab/CabBlockInStream.cpp +122 -0
- package/vendor/7zip/CPP/7zip/Archive/Cab/CabBlockInStream.h +28 -0
- package/vendor/7zip/CPP/7zip/Archive/Cab/CabHandler.cpp +1270 -0
- package/vendor/7zip/CPP/7zip/Archive/Cab/CabHandler.h +29 -0
- package/vendor/7zip/CPP/7zip/Archive/Cab/CabHeader.cpp +15 -0
- package/vendor/7zip/CPP/7zip/Archive/Cab/CabHeader.h +41 -0
- package/vendor/7zip/CPP/7zip/Archive/Cab/CabIn.cpp +485 -0
- package/vendor/7zip/CPP/7zip/Archive/Cab/CabIn.h +169 -0
- package/vendor/7zip/CPP/7zip/Archive/Cab/CabItem.h +69 -0
- package/vendor/7zip/CPP/7zip/Archive/Cab/CabRegister.cpp +19 -0
- package/vendor/7zip/CPP/7zip/Archive/Cab/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/Chm/ChmHandler.cpp +790 -0
- package/vendor/7zip/CPP/7zip/Archive/Chm/ChmHandler.h +27 -0
- package/vendor/7zip/CPP/7zip/Archive/Chm/ChmIn.cpp +1026 -0
- package/vendor/7zip/CPP/7zip/Archive/Chm/ChmIn.h +282 -0
- package/vendor/7zip/CPP/7zip/Archive/Chm/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/ComHandler.cpp +1449 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/CoderMixer2.cpp +1144 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/CoderMixer2.h +447 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/DummyOutStream.cpp +17 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/DummyOutStream.h +23 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/FindSignature.cpp +90 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/FindSignature.h +12 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/HandlerOut.cpp +315 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/HandlerOut.h +169 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +57 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/InStreamWithCRC.h +64 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/ItemNameUtils.cpp +140 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/ItemNameUtils.h +33 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/MultiStream.cpp +193 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/MultiStream.h +86 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +18 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.h +35 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp +29 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.h +61 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/ParseProperties.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/ParseProperties.h +6 -0
- package/vendor/7zip/CPP/7zip/Archive/Common/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/CpioHandler.cpp +1110 -0
- package/vendor/7zip/CPP/7zip/Archive/CramfsHandler.cpp +784 -0
- package/vendor/7zip/CPP/7zip/Archive/DeflateProps.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Archive/DeflateProps.h +6 -0
- package/vendor/7zip/CPP/7zip/Archive/DllExports.cpp +96 -0
- package/vendor/7zip/CPP/7zip/Archive/DllExports2.cpp +184 -0
- package/vendor/7zip/CPP/7zip/Archive/DmgHandler.cpp +2336 -0
- package/vendor/7zip/CPP/7zip/Archive/ElfHandler.cpp +1284 -0
- package/vendor/7zip/CPP/7zip/Archive/ExtHandler.cpp +2860 -0
- package/vendor/7zip/CPP/7zip/Archive/FatHandler.cpp +1325 -0
- package/vendor/7zip/CPP/7zip/Archive/FlvHandler.cpp +521 -0
- package/vendor/7zip/CPP/7zip/Archive/GptHandler.cpp +473 -0
- package/vendor/7zip/CPP/7zip/Archive/GzHandler.cpp +1200 -0
- package/vendor/7zip/CPP/7zip/Archive/HandlerCont.cpp +320 -0
- package/vendor/7zip/CPP/7zip/Archive/HandlerCont.h +134 -0
- package/vendor/7zip/CPP/7zip/Archive/HfsHandler.cpp +2631 -0
- package/vendor/7zip/CPP/7zip/Archive/HfsHandler.h +87 -0
- package/vendor/7zip/CPP/7zip/Archive/IArchive.h +755 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/7z.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/apfs.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/arj.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/bz2.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/cab.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/cpio.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/deb.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/dmg.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/fat.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/gz.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/hfs.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/iso.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/lzh.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/lzma.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/ntfs.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/rar.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/rpm.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/split.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/squashfs.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/tar.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/vhd.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/wim.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/xar.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/xz.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/z.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/zip.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/Icons/zst.ico +0 -0
- package/vendor/7zip/CPP/7zip/Archive/IhexHandler.cpp +493 -0
- package/vendor/7zip/CPP/7zip/Archive/Iso/IsoHandler.cpp +498 -0
- package/vendor/7zip/CPP/7zip/Archive/Iso/IsoHandler.h +24 -0
- package/vendor/7zip/CPP/7zip/Archive/Iso/IsoHeader.cpp +12 -0
- package/vendor/7zip/CPP/7zip/Archive/Iso/IsoHeader.h +64 -0
- package/vendor/7zip/CPP/7zip/Archive/Iso/IsoIn.cpp +801 -0
- package/vendor/7zip/CPP/7zip/Archive/Iso/IsoIn.h +328 -0
- package/vendor/7zip/CPP/7zip/Archive/Iso/IsoItem.h +316 -0
- package/vendor/7zip/CPP/7zip/Archive/Iso/IsoRegister.cpp +21 -0
- package/vendor/7zip/CPP/7zip/Archive/Iso/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/LpHandler.cpp +1172 -0
- package/vendor/7zip/CPP/7zip/Archive/LvmHandler.cpp +1108 -0
- package/vendor/7zip/CPP/7zip/Archive/LzhHandler.cpp +719 -0
- package/vendor/7zip/CPP/7zip/Archive/LzmaHandler.cpp +606 -0
- package/vendor/7zip/CPP/7zip/Archive/MachoHandler.cpp +1075 -0
- package/vendor/7zip/CPP/7zip/Archive/MbrHandler.cpp +648 -0
- package/vendor/7zip/CPP/7zip/Archive/MslzHandler.cpp +389 -0
- package/vendor/7zip/CPP/7zip/Archive/MubHandler.cpp +248 -0
- package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisDecode.cpp +295 -0
- package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisDecode.h +97 -0
- package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisHandler.cpp +703 -0
- package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisHandler.h +30 -0
- package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisIn.cpp +6231 -0
- package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisIn.h +462 -0
- package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisRegister.cpp +20 -0
- package/vendor/7zip/CPP/7zip/Archive/Nsis/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/NtfsHandler.cpp +2944 -0
- package/vendor/7zip/CPP/7zip/Archive/PeHandler.cpp +3427 -0
- package/vendor/7zip/CPP/7zip/Archive/PpmdHandler.cpp +414 -0
- package/vendor/7zip/CPP/7zip/Archive/QcowHandler.cpp +713 -0
- package/vendor/7zip/CPP/7zip/Archive/Rar/Rar5Handler.cpp +3483 -0
- package/vendor/7zip/CPP/7zip/Archive/Rar/Rar5Handler.h +527 -0
- package/vendor/7zip/CPP/7zip/Archive/Rar/RarHandler.cpp +1775 -0
- package/vendor/7zip/CPP/7zip/Archive/Rar/RarHandler.h +115 -0
- package/vendor/7zip/CPP/7zip/Archive/Rar/RarHeader.h +209 -0
- package/vendor/7zip/CPP/7zip/Archive/Rar/RarItem.h +97 -0
- package/vendor/7zip/CPP/7zip/Archive/Rar/RarVol.h +136 -0
- package/vendor/7zip/CPP/7zip/Archive/Rar/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Archive/Rar/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/RpmHandler.cpp +775 -0
- package/vendor/7zip/CPP/7zip/Archive/SparseHandler.cpp +558 -0
- package/vendor/7zip/CPP/7zip/Archive/SplitHandler.cpp +353 -0
- package/vendor/7zip/CPP/7zip/Archive/SquashfsHandler.cpp +2373 -0
- package/vendor/7zip/CPP/7zip/Archive/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/SwfHandler.cpp +996 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarHandler.cpp +1105 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarHandler.h +57 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarHandlerOut.cpp +332 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarHeader.cpp +99 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarHeader.h +90 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarIn.cpp +1151 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarIn.h +151 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarItem.h +365 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarOut.cpp +644 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarOut.h +53 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarRegister.cpp +31 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarUpdate.cpp +563 -0
- package/vendor/7zip/CPP/7zip/Archive/Tar/TarUpdate.h +74 -0
- package/vendor/7zip/CPP/7zip/Archive/Udf/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/Udf/UdfHandler.cpp +427 -0
- package/vendor/7zip/CPP/7zip/Archive/Udf/UdfHandler.h +32 -0
- package/vendor/7zip/CPP/7zip/Archive/Udf/UdfIn.cpp +1756 -0
- package/vendor/7zip/CPP/7zip/Archive/Udf/UdfIn.h +508 -0
- package/vendor/7zip/CPP/7zip/Archive/UefiHandler.cpp +1884 -0
- package/vendor/7zip/CPP/7zip/Archive/VdiHandler.cpp +433 -0
- package/vendor/7zip/CPP/7zip/Archive/VhdHandler.cpp +1106 -0
- package/vendor/7zip/CPP/7zip/Archive/VhdxHandler.cpp +2085 -0
- package/vendor/7zip/CPP/7zip/Archive/VmdkHandler.cpp +1530 -0
- package/vendor/7zip/CPP/7zip/Archive/Wim/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/Wim/WimHandler.cpp +1291 -0
- package/vendor/7zip/CPP/7zip/Archive/Wim/WimHandler.h +117 -0
- package/vendor/7zip/CPP/7zip/Archive/Wim/WimHandlerOut.cpp +2008 -0
- package/vendor/7zip/CPP/7zip/Archive/Wim/WimIn.cpp +2104 -0
- package/vendor/7zip/CPP/7zip/Archive/Wim/WimIn.h +719 -0
- package/vendor/7zip/CPP/7zip/Archive/Wim/WimRegister.cpp +29 -0
- package/vendor/7zip/CPP/7zip/Archive/XarHandler.cpp +1316 -0
- package/vendor/7zip/CPP/7zip/Archive/XzHandler.cpp +1452 -0
- package/vendor/7zip/CPP/7zip/Archive/XzHandler.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/ZHandler.cpp +208 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipAddCommon.cpp +484 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipAddCommon.h +76 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipCompressionMode.h +62 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipHandler.cpp +1679 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipHandler.h +94 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp +626 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipHeader.h +201 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipIn.cpp +3474 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipIn.h +456 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipItem.cpp +464 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipItem.h +356 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipOut.cpp +428 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipOut.h +103 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipRegister.cpp +38 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipUpdate.cpp +2165 -0
- package/vendor/7zip/CPP/7zip/Archive/Zip/ZipUpdate.h +107 -0
- package/vendor/7zip/CPP/7zip/Archive/ZstdHandler.cpp +1147 -0
- package/vendor/7zip/CPP/7zip/Archive/makefile +23 -0
- package/vendor/7zip/CPP/7zip/Asm.mak +12 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone/Alone.dsp +3324 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone/Alone.dsw +29 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone/makefile +245 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone/makefile.gcc +354 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone/resource.rc +7 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone2/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone2/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone2/makefile +31 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone2/makefile.gcc +108 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone2/resource.rc +7 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone7z/Alone.dsp +2090 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone7z/Alone.dsw +29 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone7z/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone7z/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone7z/makefile +168 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone7z/makefile.gcc +276 -0
- package/vendor/7zip/CPP/7zip/Bundles/Alone7z/resource.rc +7 -0
- package/vendor/7zip/CPP/7zip/Bundles/Fm/FM.dsp +2275 -0
- package/vendor/7zip/CPP/7zip/Bundles/Fm/FM.dsw +29 -0
- package/vendor/7zip/CPP/7zip/Bundles/Fm/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/Fm/StdAfx.h +6 -0
- package/vendor/7zip/CPP/7zip/Bundles/Fm/makefile +82 -0
- package/vendor/7zip/CPP/7zip/Bundles/Fm/resource.rc +7 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7z/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7z/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7z/makefile +148 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7z/resource.rc +5 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zExtract/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zExtract/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zExtract/makefile +116 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zExtract/resource.rc +5 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zExtractR/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zExtractR/makefile +98 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zExtractR/resource.rc +5 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/Arc.mak +310 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/Arc_gcc.mak +395 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/Format7z.dsp +3486 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/Format7z.dsw +29 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/makefile +20 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/makefile.gcc +55 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zF/resource.rc +39 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zR/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zR/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zR/makefile +121 -0
- package/vendor/7zip/CPP/7zip/Bundles/Format7zR/resource.rc +5 -0
- package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp +815 -0
- package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp +540 -0
- package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsw +29 -0
- package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/makefile +68 -0
- package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/makefile.gcc +131 -0
- package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/resource.rc +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXCon/7z.ico +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXCon/SFXCon.dsp +1017 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXCon/SFXCon.dsw +29 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXCon/SfxCon.cpp +521 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXCon/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXCon/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXCon/makefile +137 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXCon/makefile.gcc +215 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXCon/resource.rc +9 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.cpp +246 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.h +83 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp +135 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h +11 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp +872 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsw +29 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp +359 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/StdAfx.h +6 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/makefile +121 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/resource.h +6 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/resource.rc +16 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/setup.ico +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXWin/7z.ico +0 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXWin/SFXWin.dsp +1074 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXWin/SFXWin.dsw +29 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXWin/SfxWin.cpp +268 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXWin/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXWin/StdAfx.h +6 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXWin/makefile +159 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXWin/resource.h +1 -0
- package/vendor/7zip/CPP/7zip/Bundles/SFXWin/resource.rc +55 -0
- package/vendor/7zip/CPP/7zip/Bundles/makefile +19 -0
- package/vendor/7zip/CPP/7zip/Common/CWrappers.cpp +358 -0
- package/vendor/7zip/CPP/7zip/Common/CWrappers.h +182 -0
- package/vendor/7zip/CPP/7zip/Common/CreateCoder.cpp +548 -0
- package/vendor/7zip/CPP/7zip/Common/CreateCoder.h +200 -0
- package/vendor/7zip/CPP/7zip/Common/FilePathAutoRename.cpp +46 -0
- package/vendor/7zip/CPP/7zip/Common/FilePathAutoRename.h +10 -0
- package/vendor/7zip/CPP/7zip/Common/FileStreams.cpp +923 -0
- package/vendor/7zip/CPP/7zip/Common/FileStreams.h +205 -0
- package/vendor/7zip/CPP/7zip/Common/FilterCoder.cpp +582 -0
- package/vendor/7zip/CPP/7zip/Common/FilterCoder.h +201 -0
- package/vendor/7zip/CPP/7zip/Common/InBuffer.cpp +182 -0
- package/vendor/7zip/CPP/7zip/Common/InBuffer.h +121 -0
- package/vendor/7zip/CPP/7zip/Common/InOutTempBuffer.cpp +237 -0
- package/vendor/7zip/CPP/7zip/Common/InOutTempBuffer.h +45 -0
- package/vendor/7zip/CPP/7zip/Common/LimitedStreams.cpp +395 -0
- package/vendor/7zip/CPP/7zip/Common/LimitedStreams.h +221 -0
- package/vendor/7zip/CPP/7zip/Common/LockedStream.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Common/LockedStream.h +6 -0
- package/vendor/7zip/CPP/7zip/Common/MemBlocks.cpp +215 -0
- package/vendor/7zip/CPP/7zip/Common/MemBlocks.h +72 -0
- package/vendor/7zip/CPP/7zip/Common/MethodId.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Common/MethodId.h +10 -0
- package/vendor/7zip/CPP/7zip/Common/MethodProps.cpp +765 -0
- package/vendor/7zip/CPP/7zip/Common/MethodProps.h +348 -0
- package/vendor/7zip/CPP/7zip/Common/MultiOutStream.cpp +855 -0
- package/vendor/7zip/CPP/7zip/Common/MultiOutStream.h +160 -0
- package/vendor/7zip/CPP/7zip/Common/OffsetStream.cpp +37 -0
- package/vendor/7zip/CPP/7zip/Common/OffsetStream.h +22 -0
- package/vendor/7zip/CPP/7zip/Common/OutBuffer.cpp +111 -0
- package/vendor/7zip/CPP/7zip/Common/OutBuffer.h +133 -0
- package/vendor/7zip/CPP/7zip/Common/OutMemStream.cpp +158 -0
- package/vendor/7zip/CPP/7zip/Common/OutMemStream.h +104 -0
- package/vendor/7zip/CPP/7zip/Common/ProgressMt.cpp +53 -0
- package/vendor/7zip/CPP/7zip/Common/ProgressMt.h +43 -0
- package/vendor/7zip/CPP/7zip/Common/ProgressUtils.cpp +51 -0
- package/vendor/7zip/CPP/7zip/Common/ProgressUtils.h +33 -0
- package/vendor/7zip/CPP/7zip/Common/PropId.cpp +115 -0
- package/vendor/7zip/CPP/7zip/Common/RegisterArc.h +80 -0
- package/vendor/7zip/CPP/7zip/Common/RegisterCodec.h +106 -0
- package/vendor/7zip/CPP/7zip/Common/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Common/StreamBinder.cpp +151 -0
- package/vendor/7zip/CPP/7zip/Common/StreamBinder.h +78 -0
- package/vendor/7zip/CPP/7zip/Common/StreamObjects.cpp +290 -0
- package/vendor/7zip/CPP/7zip/Common/StreamObjects.h +146 -0
- package/vendor/7zip/CPP/7zip/Common/StreamUtils.cpp +101 -0
- package/vendor/7zip/CPP/7zip/Common/StreamUtils.h +31 -0
- package/vendor/7zip/CPP/7zip/Common/UniqBlocks.cpp +57 -0
- package/vendor/7zip/CPP/7zip/Common/UniqBlocks.h +41 -0
- package/vendor/7zip/CPP/7zip/Common/VirtThread.cpp +47 -0
- package/vendor/7zip/CPP/7zip/Common/VirtThread.h +24 -0
- package/vendor/7zip/CPP/7zip/Compress/BZip2Const.h +71 -0
- package/vendor/7zip/CPP/7zip/Compress/BZip2Crc.cpp +28 -0
- package/vendor/7zip/CPP/7zip/Compress/BZip2Crc.h +31 -0
- package/vendor/7zip/CPP/7zip/Compress/BZip2Decoder.cpp +1777 -0
- package/vendor/7zip/CPP/7zip/Compress/BZip2Decoder.h +388 -0
- package/vendor/7zip/CPP/7zip/Compress/BZip2Encoder.cpp +1116 -0
- package/vendor/7zip/CPP/7zip/Compress/BZip2Encoder.h +273 -0
- package/vendor/7zip/CPP/7zip/Compress/BZip2Register.cpp +25 -0
- package/vendor/7zip/CPP/7zip/Compress/Bcj2Coder.cpp +867 -0
- package/vendor/7zip/CPP/7zip/Compress/Bcj2Coder.h +127 -0
- package/vendor/7zip/CPP/7zip/Compress/Bcj2Register.cpp +24 -0
- package/vendor/7zip/CPP/7zip/Compress/BcjCoder.cpp +24 -0
- package/vendor/7zip/CPP/7zip/Compress/BcjCoder.h +37 -0
- package/vendor/7zip/CPP/7zip/Compress/BcjRegister.cpp +17 -0
- package/vendor/7zip/CPP/7zip/Compress/BitlDecoder.cpp +32 -0
- package/vendor/7zip/CPP/7zip/Compress/BitlDecoder.h +225 -0
- package/vendor/7zip/CPP/7zip/Compress/BitlEncoder.h +57 -0
- package/vendor/7zip/CPP/7zip/Compress/BitmDecoder.h +106 -0
- package/vendor/7zip/CPP/7zip/Compress/BitmEncoder.h +90 -0
- package/vendor/7zip/CPP/7zip/Compress/BranchMisc.cpp +106 -0
- package/vendor/7zip/CPP/7zip/Compress/BranchMisc.h +59 -0
- package/vendor/7zip/CPP/7zip/Compress/BranchRegister.cpp +58 -0
- package/vendor/7zip/CPP/7zip/Compress/ByteSwap.cpp +91 -0
- package/vendor/7zip/CPP/7zip/Compress/Codec.def +7 -0
- package/vendor/7zip/CPP/7zip/Compress/CodecExports.cpp +378 -0
- package/vendor/7zip/CPP/7zip/Compress/CopyCoder.cpp +153 -0
- package/vendor/7zip/CPP/7zip/Compress/CopyCoder.h +34 -0
- package/vendor/7zip/CPP/7zip/Compress/CopyRegister.cpp +15 -0
- package/vendor/7zip/CPP/7zip/Compress/Deflate64Register.cpp +25 -0
- package/vendor/7zip/CPP/7zip/Compress/DeflateConst.h +131 -0
- package/vendor/7zip/CPP/7zip/Compress/DeflateDecoder.cpp +566 -0
- package/vendor/7zip/CPP/7zip/Compress/DeflateDecoder.h +154 -0
- package/vendor/7zip/CPP/7zip/Compress/DeflateEncoder.cpp +1045 -0
- package/vendor/7zip/CPP/7zip/Compress/DeflateEncoder.h +203 -0
- package/vendor/7zip/CPP/7zip/Compress/DeflateRegister.cpp +25 -0
- package/vendor/7zip/CPP/7zip/Compress/DeltaFilter.cpp +126 -0
- package/vendor/7zip/CPP/7zip/Compress/DllExports2Compress.cpp +38 -0
- package/vendor/7zip/CPP/7zip/Compress/DllExportsCompress.cpp +59 -0
- package/vendor/7zip/CPP/7zip/Compress/HuffmanDecoder.h +528 -0
- package/vendor/7zip/CPP/7zip/Compress/ImplodeDecoder.cpp +250 -0
- package/vendor/7zip/CPP/7zip/Compress/ImplodeDecoder.h +61 -0
- package/vendor/7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp +3 -0
- package/vendor/7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.h +6 -0
- package/vendor/7zip/CPP/7zip/Compress/LzOutWindow.cpp +14 -0
- package/vendor/7zip/CPP/7zip/Compress/LzOutWindow.h +102 -0
- package/vendor/7zip/CPP/7zip/Compress/LzfseDecoder.cpp +950 -0
- package/vendor/7zip/CPP/7zip/Compress/LzfseDecoder.h +63 -0
- package/vendor/7zip/CPP/7zip/Compress/LzhDecoder.cpp +220 -0
- package/vendor/7zip/CPP/7zip/Compress/LzhDecoder.h +68 -0
- package/vendor/7zip/CPP/7zip/Compress/Lzma2Decoder.cpp +267 -0
- package/vendor/7zip/CPP/7zip/Compress/Lzma2Decoder.h +87 -0
- package/vendor/7zip/CPP/7zip/Compress/Lzma2Encoder.cpp +134 -0
- package/vendor/7zip/CPP/7zip/Compress/Lzma2Encoder.h +30 -0
- package/vendor/7zip/CPP/7zip/Compress/Lzma2Register.cpp +22 -0
- package/vendor/7zip/CPP/7zip/Compress/LzmaDecoder.cpp +350 -0
- package/vendor/7zip/CPP/7zip/Compress/LzmaDecoder.h +113 -0
- package/vendor/7zip/CPP/7zip/Compress/LzmaEncoder.cpp +374 -0
- package/vendor/7zip/CPP/7zip/Compress/LzmaEncoder.h +45 -0
- package/vendor/7zip/CPP/7zip/Compress/LzmaRegister.cpp +22 -0
- package/vendor/7zip/CPP/7zip/Compress/LzmsDecoder.cpp +619 -0
- package/vendor/7zip/CPP/7zip/Compress/LzmsDecoder.h +209 -0
- package/vendor/7zip/CPP/7zip/Compress/Lzx.h +61 -0
- package/vendor/7zip/CPP/7zip/Compress/LzxDecoder.cpp +1517 -0
- package/vendor/7zip/CPP/7zip/Compress/LzxDecoder.h +106 -0
- package/vendor/7zip/CPP/7zip/Compress/Mtf8.h +225 -0
- package/vendor/7zip/CPP/7zip/Compress/PpmdDecoder.cpp +219 -0
- package/vendor/7zip/CPP/7zip/Compress/PpmdDecoder.h +87 -0
- package/vendor/7zip/CPP/7zip/Compress/PpmdEncoder.cpp +193 -0
- package/vendor/7zip/CPP/7zip/Compress/PpmdEncoder.h +49 -0
- package/vendor/7zip/CPP/7zip/Compress/PpmdRegister.cpp +22 -0
- package/vendor/7zip/CPP/7zip/Compress/PpmdZip.cpp +309 -0
- package/vendor/7zip/CPP/7zip/Compress/PpmdZip.h +78 -0
- package/vendor/7zip/CPP/7zip/Compress/QuantumDecoder.cpp +355 -0
- package/vendor/7zip/CPP/7zip/Compress/QuantumDecoder.h +60 -0
- package/vendor/7zip/CPP/7zip/Compress/Rar1Decoder.cpp +518 -0
- package/vendor/7zip/CPP/7zip/Compress/Rar1Decoder.h +70 -0
- package/vendor/7zip/CPP/7zip/Compress/Rar2Decoder.cpp +472 -0
- package/vendor/7zip/CPP/7zip/Compress/Rar2Decoder.h +111 -0
- package/vendor/7zip/CPP/7zip/Compress/Rar3Decoder.cpp +939 -0
- package/vendor/7zip/CPP/7zip/Compress/Rar3Decoder.h +283 -0
- package/vendor/7zip/CPP/7zip/Compress/Rar3Vm.cpp +1153 -0
- package/vendor/7zip/CPP/7zip/Compress/Rar3Vm.h +195 -0
- package/vendor/7zip/CPP/7zip/Compress/Rar5Decoder.cpp +2060 -0
- package/vendor/7zip/CPP/7zip/Compress/Rar5Decoder.h +132 -0
- package/vendor/7zip/CPP/7zip/Compress/RarCodecsRegister.cpp +33 -0
- package/vendor/7zip/CPP/7zip/Compress/ShrinkDecoder.cpp +290 -0
- package/vendor/7zip/CPP/7zip/Compress/ShrinkDecoder.h +38 -0
- package/vendor/7zip/CPP/7zip/Compress/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Compress/XpressDecoder.cpp +399 -0
- package/vendor/7zip/CPP/7zip/Compress/XpressDecoder.h +18 -0
- package/vendor/7zip/CPP/7zip/Compress/XzDecoder.cpp +151 -0
- package/vendor/7zip/CPP/7zip/Compress/XzDecoder.h +86 -0
- package/vendor/7zip/CPP/7zip/Compress/XzEncoder.cpp +243 -0
- package/vendor/7zip/CPP/7zip/Compress/XzEncoder.h +35 -0
- package/vendor/7zip/CPP/7zip/Compress/ZDecoder.cpp +392 -0
- package/vendor/7zip/CPP/7zip/Compress/ZDecoder.h +41 -0
- package/vendor/7zip/CPP/7zip/Compress/ZlibDecoder.cpp +136 -0
- package/vendor/7zip/CPP/7zip/Compress/ZlibDecoder.h +78 -0
- package/vendor/7zip/CPP/7zip/Compress/ZlibEncoder.cpp +61 -0
- package/vendor/7zip/CPP/7zip/Compress/ZlibEncoder.h +42 -0
- package/vendor/7zip/CPP/7zip/Compress/ZstdDecoder.cpp +437 -0
- package/vendor/7zip/CPP/7zip/Compress/ZstdDecoder.h +98 -0
- package/vendor/7zip/CPP/7zip/Compress/makefile +7 -0
- package/vendor/7zip/CPP/7zip/Crc.mak +8 -0
- package/vendor/7zip/CPP/7zip/Crc64.mak +8 -0
- package/vendor/7zip/CPP/7zip/Crypto/7zAes.cpp +315 -0
- package/vendor/7zip/CPP/7zip/Crypto/7zAes.h +130 -0
- package/vendor/7zip/CPP/7zip/Crypto/7zAesRegister.cpp +17 -0
- package/vendor/7zip/CPP/7zip/Crypto/Codec.def +4 -0
- package/vendor/7zip/CPP/7zip/Crypto/HmacSha1.cpp +94 -0
- package/vendor/7zip/CPP/7zip/Crypto/HmacSha1.h +31 -0
- package/vendor/7zip/CPP/7zip/Crypto/HmacSha256.cpp +53 -0
- package/vendor/7zip/CPP/7zip/Crypto/HmacSha256.h +27 -0
- package/vendor/7zip/CPP/7zip/Crypto/MyAes.cpp +277 -0
- package/vendor/7zip/CPP/7zip/Crypto/MyAes.h +122 -0
- package/vendor/7zip/CPP/7zip/Crypto/MyAesReg.cpp +29 -0
- package/vendor/7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp +48 -0
- package/vendor/7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.h +19 -0
- package/vendor/7zip/CPP/7zip/Crypto/RandGen.cpp +242 -0
- package/vendor/7zip/CPP/7zip/Crypto/RandGen.h +41 -0
- package/vendor/7zip/CPP/7zip/Crypto/Rar20Crypto.cpp +130 -0
- package/vendor/7zip/CPP/7zip/Crypto/Rar20Crypto.h +54 -0
- package/vendor/7zip/CPP/7zip/Crypto/Rar5Aes.cpp +273 -0
- package/vendor/7zip/CPP/7zip/Crypto/Rar5Aes.h +97 -0
- package/vendor/7zip/CPP/7zip/Crypto/RarAes.cpp +202 -0
- package/vendor/7zip/CPP/7zip/Crypto/RarAes.h +54 -0
- package/vendor/7zip/CPP/7zip/Crypto/Sha1Cls.h +37 -0
- package/vendor/7zip/CPP/7zip/Crypto/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/Crypto/WzAes.cpp +231 -0
- package/vendor/7zip/CPP/7zip/Crypto/WzAes.h +161 -0
- package/vendor/7zip/CPP/7zip/Crypto/ZipCrypto.cpp +114 -0
- package/vendor/7zip/CPP/7zip/Crypto/ZipCrypto.h +80 -0
- package/vendor/7zip/CPP/7zip/Crypto/ZipStrong.cpp +265 -0
- package/vendor/7zip/CPP/7zip/Crypto/ZipStrong.h +73 -0
- package/vendor/7zip/CPP/7zip/GuiCommon.rc +119 -0
- package/vendor/7zip/CPP/7zip/Guid.txt +243 -0
- package/vendor/7zip/CPP/7zip/ICoder.h +480 -0
- package/vendor/7zip/CPP/7zip/IDecl.h +76 -0
- package/vendor/7zip/CPP/7zip/IPassword.h +54 -0
- package/vendor/7zip/CPP/7zip/IProgress.h +20 -0
- package/vendor/7zip/CPP/7zip/IStream.h +210 -0
- package/vendor/7zip/CPP/7zip/LzFindOpt.mak +7 -0
- package/vendor/7zip/CPP/7zip/LzmaDec.mak +7 -0
- package/vendor/7zip/CPP/7zip/LzmaDec_gcc.mak +14 -0
- package/vendor/7zip/CPP/7zip/MyVersion.h +2 -0
- package/vendor/7zip/CPP/7zip/MyVersionInfo.rc +2 -0
- package/vendor/7zip/CPP/7zip/PropID.h +178 -0
- package/vendor/7zip/CPP/7zip/Sha1.mak +13 -0
- package/vendor/7zip/CPP/7zip/Sha256.mak +13 -0
- package/vendor/7zip/CPP/7zip/Sort.mak +6 -0
- package/vendor/7zip/CPP/7zip/SubBuild.mak +3 -0
- package/vendor/7zip/CPP/7zip/UI/Agent/Agent.cpp +2003 -0
- package/vendor/7zip/CPP/7zip/UI/Agent/Agent.h +365 -0
- package/vendor/7zip/CPP/7zip/UI/Agent/AgentOut.cpp +776 -0
- package/vendor/7zip/CPP/7zip/UI/Agent/AgentProxy.cpp +1098 -0
- package/vendor/7zip/CPP/7zip/UI/Agent/AgentProxy.h +198 -0
- package/vendor/7zip/CPP/7zip/UI/Agent/ArchiveFolder.cpp +57 -0
- package/vendor/7zip/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp +243 -0
- package/vendor/7zip/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp +457 -0
- package/vendor/7zip/CPP/7zip/UI/Agent/IFolderArchive.h +123 -0
- package/vendor/7zip/CPP/7zip/UI/Agent/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp +208 -0
- package/vendor/7zip/CPP/7zip/UI/Agent/UpdateCallbackAgent.h +22 -0
- package/vendor/7zip/CPP/7zip/UI/Client7z/Client7z.cpp +1145 -0
- package/vendor/7zip/CPP/7zip/UI/Client7z/Client7z.dsp +331 -0
- package/vendor/7zip/CPP/7zip/UI/Client7z/Client7z.dsw +29 -0
- package/vendor/7zip/CPP/7zip/UI/Client7z/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/UI/Client7z/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/UI/Client7z/makefile +29 -0
- package/vendor/7zip/CPP/7zip/UI/Client7z/makefile.gcc +72 -0
- package/vendor/7zip/CPP/7zip/UI/Client7z/resource.rc +3 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ArchiveCommandLine.cpp +1913 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ArchiveCommandLine.h +170 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp +3243 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ArchiveExtractCallback.h +640 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ArchiveName.cpp +176 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ArchiveName.h +16 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp +403 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ArchiveOpenCallback.h +182 -0
- package/vendor/7zip/CPP/7zip/UI/Common/Bench.cpp +5036 -0
- package/vendor/7zip/CPP/7zip/UI/Common/Bench.h +121 -0
- package/vendor/7zip/CPP/7zip/UI/Common/CompressCall.cpp +343 -0
- package/vendor/7zip/CPP/7zip/UI/Common/CompressCall.h +28 -0
- package/vendor/7zip/CPP/7zip/UI/Common/CompressCall2.cpp +327 -0
- package/vendor/7zip/CPP/7zip/UI/Common/DefaultName.cpp +37 -0
- package/vendor/7zip/CPP/7zip/UI/Common/DefaultName.h +11 -0
- package/vendor/7zip/CPP/7zip/UI/Common/DirItem.h +407 -0
- package/vendor/7zip/CPP/7zip/UI/Common/EnumDirItems.cpp +1637 -0
- package/vendor/7zip/CPP/7zip/UI/Common/EnumDirItems.h +38 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ExitCode.h +27 -0
- package/vendor/7zip/CPP/7zip/UI/Common/Extract.cpp +593 -0
- package/vendor/7zip/CPP/7zip/UI/Common/Extract.h +118 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ExtractMode.h +44 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ExtractingFilePath.cpp +299 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ExtractingFilePath.h +31 -0
- package/vendor/7zip/CPP/7zip/UI/Common/HashCalc.cpp +2273 -0
- package/vendor/7zip/CPP/7zip/UI/Common/HashCalc.h +322 -0
- package/vendor/7zip/CPP/7zip/UI/Common/IFileExtractCallback.h +112 -0
- package/vendor/7zip/CPP/7zip/UI/Common/LoadCodecs.cpp +1354 -0
- package/vendor/7zip/CPP/7zip/UI/Common/LoadCodecs.h +482 -0
- package/vendor/7zip/CPP/7zip/UI/Common/OpenArchive.cpp +3690 -0
- package/vendor/7zip/CPP/7zip/UI/Common/OpenArchive.h +469 -0
- package/vendor/7zip/CPP/7zip/UI/Common/PropIDUtils.cpp +746 -0
- package/vendor/7zip/CPP/7zip/UI/Common/PropIDUtils.h +18 -0
- package/vendor/7zip/CPP/7zip/UI/Common/Property.h +14 -0
- package/vendor/7zip/CPP/7zip/UI/Common/SetProperties.cpp +88 -0
- package/vendor/7zip/CPP/7zip/UI/Common/SetProperties.h +10 -0
- package/vendor/7zip/CPP/7zip/UI/Common/SortUtils.cpp +25 -0
- package/vendor/7zip/CPP/7zip/UI/Common/SortUtils.h +10 -0
- package/vendor/7zip/CPP/7zip/UI/Common/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/UI/Common/TempFiles.cpp +20 -0
- package/vendor/7zip/CPP/7zip/UI/Common/TempFiles.h +19 -0
- package/vendor/7zip/CPP/7zip/UI/Common/Update.cpp +1931 -0
- package/vendor/7zip/CPP/7zip/UI/Common/Update.h +221 -0
- package/vendor/7zip/CPP/7zip/UI/Common/UpdateAction.cpp +64 -0
- package/vendor/7zip/CPP/7zip/UI/Common/UpdateAction.h +66 -0
- package/vendor/7zip/CPP/7zip/UI/Common/UpdateCallback.cpp +1078 -0
- package/vendor/7zip/CPP/7zip/UI/Common/UpdateCallback.h +197 -0
- package/vendor/7zip/CPP/7zip/UI/Common/UpdatePair.cpp +303 -0
- package/vendor/7zip/CPP/7zip/UI/Common/UpdatePair.h +27 -0
- package/vendor/7zip/CPP/7zip/UI/Common/UpdateProduce.cpp +75 -0
- package/vendor/7zip/CPP/7zip/UI/Common/UpdateProduce.h +60 -0
- package/vendor/7zip/CPP/7zip/UI/Common/WorkDir.cpp +84 -0
- package/vendor/7zip/CPP/7zip/UI/Common/WorkDir.h +30 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ZipRegistry.cpp +599 -0
- package/vendor/7zip/CPP/7zip/UI/Common/ZipRegistry.h +212 -0
- package/vendor/7zip/CPP/7zip/UI/Console/BenchCon.cpp +41 -0
- package/vendor/7zip/CPP/7zip/UI/Console/BenchCon.h +14 -0
- package/vendor/7zip/CPP/7zip/UI/Console/Console.dsp +1052 -0
- package/vendor/7zip/CPP/7zip/UI/Console/Console.dsw +29 -0
- package/vendor/7zip/CPP/7zip/UI/Console/Console.mak +45 -0
- package/vendor/7zip/CPP/7zip/UI/Console/Console.manifest +16 -0
- package/vendor/7zip/CPP/7zip/UI/Console/ConsoleClose.cpp +98 -0
- package/vendor/7zip/CPP/7zip/UI/Console/ConsoleClose.h +39 -0
- package/vendor/7zip/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp +954 -0
- package/vendor/7zip/CPP/7zip/UI/Console/ExtractCallbackConsole.h +211 -0
- package/vendor/7zip/CPP/7zip/UI/Console/HashCon.cpp +426 -0
- package/vendor/7zip/CPP/7zip/UI/Console/HashCon.h +58 -0
- package/vendor/7zip/CPP/7zip/UI/Console/List.cpp +1417 -0
- package/vendor/7zip/CPP/7zip/UI/Console/List.h +42 -0
- package/vendor/7zip/CPP/7zip/UI/Console/Main.cpp +1663 -0
- package/vendor/7zip/CPP/7zip/UI/Console/MainAr.cpp +235 -0
- package/vendor/7zip/CPP/7zip/UI/Console/OpenCallbackConsole.cpp +115 -0
- package/vendor/7zip/CPP/7zip/UI/Console/OpenCallbackConsole.h +73 -0
- package/vendor/7zip/CPP/7zip/UI/Console/PercentPrinter.cpp +186 -0
- package/vendor/7zip/CPP/7zip/UI/Console/PercentPrinter.h +66 -0
- package/vendor/7zip/CPP/7zip/UI/Console/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/UI/Console/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp +1012 -0
- package/vendor/7zip/CPP/7zip/UI/Console/UpdateCallbackConsole.h +148 -0
- package/vendor/7zip/CPP/7zip/UI/Console/UserInputUtils.cpp +118 -0
- package/vendor/7zip/CPP/7zip/UI/Console/UserInputUtils.h +27 -0
- package/vendor/7zip/CPP/7zip/UI/Console/makefile +68 -0
- package/vendor/7zip/CPP/7zip/UI/Console/makefile.gcc +184 -0
- package/vendor/7zip/CPP/7zip/UI/Console/resource.rc +7 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/7-zip.dll.manifest +1 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/ContextMenu.cpp +1837 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/ContextMenu.h +173 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/ContextMenuFlags.h +27 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/DllExportsExplorer.cpp +268 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/Explorer.def +9 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/Explorer.dsp +620 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/Explorer.dsw +29 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/MenuLogo.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/MyExplorerCommand.h +217 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/MyMessages.cpp +43 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/MyMessages.h +16 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/RegistryContextMenu.cpp +225 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/RegistryContextMenu.h +13 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/StdAfx.h +6 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/makefile +76 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/resource.h +15 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/resource.rc +10 -0
- package/vendor/7zip/CPP/7zip/UI/Explorer/resource2.rc +19 -0
- package/vendor/7zip/CPP/7zip/UI/Far/ExtractEngine.cpp +274 -0
- package/vendor/7zip/CPP/7zip/UI/Far/ExtractEngine.h +43 -0
- package/vendor/7zip/CPP/7zip/UI/Far/Far.cpp +588 -0
- package/vendor/7zip/CPP/7zip/UI/Far/Far.def +35 -0
- package/vendor/7zip/CPP/7zip/UI/Far/Far.dsp +831 -0
- package/vendor/7zip/CPP/7zip/UI/Far/Far.dsw +29 -0
- package/vendor/7zip/CPP/7zip/UI/Far/FarPlugin.h +560 -0
- package/vendor/7zip/CPP/7zip/UI/Far/FarUtils.cpp +523 -0
- package/vendor/7zip/CPP/7zip/UI/Far/FarUtils.h +203 -0
- package/vendor/7zip/CPP/7zip/UI/Far/Messages.h +136 -0
- package/vendor/7zip/CPP/7zip/UI/Far/OverwriteDialogFar.cpp +145 -0
- package/vendor/7zip/CPP/7zip/UI/Far/OverwriteDialogFar.h +37 -0
- package/vendor/7zip/CPP/7zip/UI/Far/Plugin.cpp +937 -0
- package/vendor/7zip/CPP/7zip/UI/Far/Plugin.h +97 -0
- package/vendor/7zip/CPP/7zip/UI/Far/PluginCommon.cpp +50 -0
- package/vendor/7zip/CPP/7zip/UI/Far/PluginDelete.cpp +144 -0
- package/vendor/7zip/CPP/7zip/UI/Far/PluginRead.cpp +301 -0
- package/vendor/7zip/CPP/7zip/UI/Far/PluginWrite.cpp +840 -0
- package/vendor/7zip/CPP/7zip/UI/Far/ProgressBox.cpp +305 -0
- package/vendor/7zip/CPP/7zip/UI/Far/ProgressBox.h +85 -0
- package/vendor/7zip/CPP/7zip/UI/Far/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/UI/Far/StdAfx.h +11 -0
- package/vendor/7zip/CPP/7zip/UI/Far/UpdateCallbackFar.cpp +327 -0
- package/vendor/7zip/CPP/7zip/UI/Far/UpdateCallbackFar.h +58 -0
- package/vendor/7zip/CPP/7zip/UI/Far/makefile +105 -0
- package/vendor/7zip/CPP/7zip/UI/Far/resource.rc +3 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/7zFM.exe.manifest +23 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/7zipLogo.ico +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/AboutDialog.cpp +81 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/AboutDialog.h +19 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/AboutDialog.rc +26 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/AboutDialogRes.h +8 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Add.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Add2.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/AltStreamsFolder.cpp +865 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/AltStreamsFolder.h +92 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/App.cpp +1004 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/App.h +314 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/AppState.h +95 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog.cpp +1132 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog.h +32 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog.rc +25 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog2.cpp +1873 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog2.h +10 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog2.rc +32 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog2Res.h +9 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialogRes.h +9 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ClassDefs.cpp +12 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ComboDialog.cpp +64 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ComboDialog.h +28 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ComboDialog.rc +16 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ComboDialogRes.h +4 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Copy.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Copy2.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/CopyDialog.cpp +103 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/CopyDialog.h +31 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/CopyDialog.rc +20 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/CopyDialogRes.h +8 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Delete.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Delete2.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/DialogSize.h +16 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/EditDialog.cpp +57 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/EditDialog.h +25 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/EditDialog.rc +15 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/EditDialogRes.h +2 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/EditPage.cpp +159 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/EditPage.h +30 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/EditPage.rc +19 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/EditPage2.rc +14 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/EditPageRes.h +15 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/EnumFormatEtc.cpp +109 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/EnumFormatEtc.h +10 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Extract.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Extract2.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ExtractCallback.cpp +1284 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ExtractCallback.h +347 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FM.cpp +1230 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FM.dsp +1699 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FM.dsw +29 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FM.ico +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FM.mak +102 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FSDrives.cpp +512 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FSDrives.h +52 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FSFolder.cpp +1179 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FSFolder.h +220 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FSFolderCopy.cpp +871 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp +394 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h +27 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FilePlugins.cpp +78 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FilePlugins.h +33 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FoldersPage.cpp +172 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FoldersPage.h +32 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FoldersPage.rc +23 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FoldersPage2.rc +11 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FoldersPageRes.h +12 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FormatUtils.cpp +28 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/FormatUtils.h +14 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/HelpUtils.cpp +78 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/HelpUtils.h +10 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/IFolder.h +187 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Info.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Info2.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/LangPage.cpp +359 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/LangPage.h +36 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/LangPage.rc +40 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/LangPageRes.h +9 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/LangUtils.cpp +333 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/LangUtils.h +48 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/LinkDialog.cpp +402 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/LinkDialog.h +34 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/LinkDialog.rc +38 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/LinkDialogRes.h +22 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ListViewDialog.cpp +321 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ListViewDialog.h +46 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ListViewDialog.rc +14 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ListViewDialogRes.h +2 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MemDialog.cpp +218 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MemDialog.h +48 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MemDialog.rc +49 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MemDialogRes.h +13 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MenuPage.cpp +439 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MenuPage.h +57 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MenuPage.rc +24 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MenuPage2.rc +28 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MenuPageRes.h +15 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MessagesDialog.cpp +76 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MessagesDialog.h +25 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MessagesDialog.rc +14 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MessagesDialogRes.h +3 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Move.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Move2.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MyCom2.h +46 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MyLoadMenu.cpp +964 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MyLoadMenu.h +40 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/MyWindowsNew.h +119 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/NetFolder.cpp +276 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/NetFolder.h +36 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/OpenCallback.cpp +86 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/OpenCallback.h +69 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/OptionsDialog.cpp +89 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/OverwriteDialog.cpp +288 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/OverwriteDialog.h +89 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/OverwriteDialog.rc +93 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/OverwriteDialogRes.h +19 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Panel.cpp +1177 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Panel.h +1020 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelCopy.cpp +477 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelCrc.cpp +422 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelDrag.cpp +3006 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelFolderChange.cpp +1122 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelItemOpen.cpp +1836 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelItems.cpp +1476 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelKey.cpp +357 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelListNotify.cpp +838 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelMenu.cpp +1160 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelOperations.cpp +533 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelSelect.cpp +317 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelSort.cpp +288 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PanelSplitFile.cpp +562 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PasswordDialog.cpp +58 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PasswordDialog.h +28 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PasswordDialog.rc +18 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PasswordDialogRes.h +5 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PluginInterface.h +32 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PluginLoader.h +33 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ProgramLocation.cpp +3 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ProgramLocation.h +6 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog.cpp +201 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog.h +171 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog.rc +12 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog2.cpp +1484 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog2.h +355 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog2.rc +40 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog2Res.h +49 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog2a.rc +85 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialogRes.h +3 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PropertyName.cpp +23 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PropertyName.h +10 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PropertyName.rc +109 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/PropertyNameRes.h +104 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/RegistryAssociations.cpp +167 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/RegistryAssociations.h +31 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/RegistryPlugins.cpp +145 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/RegistryPlugins.h +29 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/RegistryUtils.cpp +194 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/RegistryUtils.h +50 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/RootFolder.cpp +342 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/RootFolder.h +24 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SettingsPage.cpp +453 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SettingsPage.h +37 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SettingsPage.rc +22 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SettingsPage2.rc +37 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SettingsPageRes.h +23 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SplitDialog.cpp +114 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SplitDialog.h +28 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SplitDialog.rc +16 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SplitDialogRes.h +8 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SplitUtils.cpp +96 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SplitUtils.h +15 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/StdAfx.h +67 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/StringUtils.cpp +39 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/StringUtils.h +11 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SysIconUtils.cpp +352 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SysIconUtils.h +65 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SystemPage.cpp +472 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SystemPage.h +126 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SystemPage.rc +43 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/SystemPageRes.h +9 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Test.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/Test2.bmp +0 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/TextPairs.cpp +193 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/TextPairs.h +32 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/UpdateCallback100.cpp +147 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/UpdateCallback100.h +49 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/VerCtrl.cpp +428 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ViewSettings.cpp +315 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/ViewSettings.h +115 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/makefile +110 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/resource.h +199 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/resource.rc +296 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/resourceGui.h +25 -0
- package/vendor/7zip/CPP/7zip/UI/FileManager/resourceGui.rc +30 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/7zG.exe.manifest +23 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/BenchmarkDialog.cpp +1921 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/BenchmarkDialog.h +15 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/BenchmarkDialog.rc +288 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/BenchmarkDialogRes.h +79 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/CompressDialog.cpp +3821 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/CompressDialog.h +483 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/CompressDialog.rc +233 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/CompressDialogRes.h +125 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/CompressOptionsDialog.rc +79 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/Extract.rc +59 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/ExtractDialog.cpp +420 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/ExtractDialog.h +113 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/ExtractDialog.rc +98 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/ExtractDialogRes.h +24 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/ExtractGUI.cpp +297 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/ExtractGUI.h +39 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/ExtractRes.h +51 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/FM.ico +0 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/GUI.cpp +502 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/GUI.dsp +1275 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/GUI.dsw +29 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/HashGUI.cpp +341 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/HashGUI.h +27 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/StdAfx.cpp +3 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/StdAfx.h +6 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp +295 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/UpdateCallbackGUI.h +31 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/UpdateCallbackGUI2.cpp +130 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/UpdateCallbackGUI2.h +53 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/UpdateGUI.cpp +605 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/UpdateGUI.h +33 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/makefile +148 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/resource.rc +26 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/resource2.h +2 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/resource2.rc +10 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/resource3.h +10 -0
- package/vendor/7zip/CPP/7zip/UI/GUI/resource3.rc +15 -0
- package/vendor/7zip/CPP/7zip/UI/makefile +12 -0
- package/vendor/7zip/CPP/7zip/cmpl_clang.mak +3 -0
- package/vendor/7zip/CPP/7zip/cmpl_clang_arm64.mak +3 -0
- package/vendor/7zip/CPP/7zip/cmpl_clang_x64.mak +3 -0
- package/vendor/7zip/CPP/7zip/cmpl_clang_x86.mak +3 -0
- package/vendor/7zip/CPP/7zip/cmpl_gcc.mak +3 -0
- package/vendor/7zip/CPP/7zip/cmpl_gcc_arm.mak +3 -0
- package/vendor/7zip/CPP/7zip/cmpl_gcc_arm64.mak +3 -0
- package/vendor/7zip/CPP/7zip/cmpl_gcc_x64.mak +3 -0
- package/vendor/7zip/CPP/7zip/cmpl_gcc_x86.mak +3 -0
- package/vendor/7zip/CPP/7zip/cmpl_mac_arm64.mak +3 -0
- package/vendor/7zip/CPP/7zip/cmpl_mac_x64.mak +3 -0
- package/vendor/7zip/CPP/7zip/makefile +10 -0
- package/vendor/7zip/CPP/7zip/var_clang.mak +11 -0
- package/vendor/7zip/CPP/7zip/var_clang_arm64.mak +19 -0
- package/vendor/7zip/CPP/7zip/var_clang_x64.mak +11 -0
- package/vendor/7zip/CPP/7zip/var_clang_x86.mak +11 -0
- package/vendor/7zip/CPP/7zip/var_gcc.mak +12 -0
- package/vendor/7zip/CPP/7zip/var_gcc_arm.mak +34 -0
- package/vendor/7zip/CPP/7zip/var_gcc_arm64.mak +12 -0
- package/vendor/7zip/CPP/7zip/var_gcc_x64.mak +11 -0
- package/vendor/7zip/CPP/7zip/var_gcc_x86.mak +10 -0
- package/vendor/7zip/CPP/7zip/var_mac_arm64.mak +13 -0
- package/vendor/7zip/CPP/7zip/var_mac_x64.mak +13 -0
- package/vendor/7zip/CPP/7zip/warn_clang.mak +3 -0
- package/vendor/7zip/CPP/7zip/warn_clang_mac.mak +9 -0
- package/vendor/7zip/CPP/7zip/warn_gcc.mak +55 -0
- package/vendor/7zip/CPP/Build.mak +259 -0
- package/vendor/7zip/CPP/Common/AutoPtr.h +46 -0
- package/vendor/7zip/CPP/Common/CRC.cpp +7 -0
- package/vendor/7zip/CPP/Common/C_FileIO.cpp +3 -0
- package/vendor/7zip/CPP/Common/C_FileIO.h +6 -0
- package/vendor/7zip/CPP/Common/CksumReg.cpp +55 -0
- package/vendor/7zip/CPP/Common/ComTry.h +21 -0
- package/vendor/7zip/CPP/Common/CommandLineParser.cpp +231 -0
- package/vendor/7zip/CPP/Common/CommandLineParser.h +63 -0
- package/vendor/7zip/CPP/Common/Common.h +28 -0
- package/vendor/7zip/CPP/Common/Common0.h +342 -0
- package/vendor/7zip/CPP/Common/CrcReg.cpp +77 -0
- package/vendor/7zip/CPP/Common/Defs.h +16 -0
- package/vendor/7zip/CPP/Common/DynLimBuf.cpp +93 -0
- package/vendor/7zip/CPP/Common/DynLimBuf.h +41 -0
- package/vendor/7zip/CPP/Common/DynamicBuffer.h +76 -0
- package/vendor/7zip/CPP/Common/IntToString.cpp +215 -0
- package/vendor/7zip/CPP/Common/IntToString.h +54 -0
- package/vendor/7zip/CPP/Common/Lang.cpp +173 -0
- package/vendor/7zip/CPP/Common/Lang.h +30 -0
- package/vendor/7zip/CPP/Common/ListFileUtils.cpp +150 -0
- package/vendor/7zip/CPP/Common/ListFileUtils.h +18 -0
- package/vendor/7zip/CPP/Common/LzFindPrepare.cpp +7 -0
- package/vendor/7zip/CPP/Common/Md5Reg.cpp +44 -0
- package/vendor/7zip/CPP/Common/MyBuffer.h +343 -0
- package/vendor/7zip/CPP/Common/MyBuffer2.h +185 -0
- package/vendor/7zip/CPP/Common/MyCom.h +693 -0
- package/vendor/7zip/CPP/Common/MyException.h +14 -0
- package/vendor/7zip/CPP/Common/MyGuidDef.h +63 -0
- package/vendor/7zip/CPP/Common/MyInitGuid.h +57 -0
- package/vendor/7zip/CPP/Common/MyLinux.h +75 -0
- package/vendor/7zip/CPP/Common/MyMap.cpp +140 -0
- package/vendor/7zip/CPP/Common/MyMap.h +28 -0
- package/vendor/7zip/CPP/Common/MyString.cpp +1842 -0
- package/vendor/7zip/CPP/Common/MyString.h +1079 -0
- package/vendor/7zip/CPP/Common/MyTypes.h +38 -0
- package/vendor/7zip/CPP/Common/MyUnknown.h +8 -0
- package/vendor/7zip/CPP/Common/MyVector.cpp +3 -0
- package/vendor/7zip/CPP/Common/MyVector.h +772 -0
- package/vendor/7zip/CPP/Common/MyWindows.cpp +292 -0
- package/vendor/7zip/CPP/Common/MyWindows.h +325 -0
- package/vendor/7zip/CPP/Common/MyXml.cpp +349 -0
- package/vendor/7zip/CPP/Common/MyXml.h +45 -0
- package/vendor/7zip/CPP/Common/NewHandler.cpp +340 -0
- package/vendor/7zip/CPP/Common/NewHandler.h +121 -0
- package/vendor/7zip/CPP/Common/Random.cpp +28 -0
- package/vendor/7zip/CPP/Common/Random.h +14 -0
- package/vendor/7zip/CPP/Common/Sha1Prepare.cpp +7 -0
- package/vendor/7zip/CPP/Common/Sha1Reg.cpp +67 -0
- package/vendor/7zip/CPP/Common/Sha256Prepare.cpp +7 -0
- package/vendor/7zip/CPP/Common/Sha256Reg.cpp +67 -0
- package/vendor/7zip/CPP/Common/Sha3Reg.cpp +76 -0
- package/vendor/7zip/CPP/Common/Sha512Prepare.cpp +7 -0
- package/vendor/7zip/CPP/Common/Sha512Reg.cpp +83 -0
- package/vendor/7zip/CPP/Common/StdAfx.h +8 -0
- package/vendor/7zip/CPP/Common/StdInStream.cpp +98 -0
- package/vendor/7zip/CPP/Common/StdInStream.h +46 -0
- package/vendor/7zip/CPP/Common/StdOutStream.cpp +271 -0
- package/vendor/7zip/CPP/Common/StdOutStream.h +87 -0
- package/vendor/7zip/CPP/Common/StringConvert.cpp +762 -0
- package/vendor/7zip/CPP/Common/StringConvert.h +110 -0
- package/vendor/7zip/CPP/Common/StringToInt.cpp +154 -0
- package/vendor/7zip/CPP/Common/StringToInt.h +38 -0
- package/vendor/7zip/CPP/Common/TextConfig.cpp +123 -0
- package/vendor/7zip/CPP/Common/TextConfig.h +19 -0
- package/vendor/7zip/CPP/Common/UTFConvert.cpp +863 -0
- package/vendor/7zip/CPP/Common/UTFConvert.h +384 -0
- package/vendor/7zip/CPP/Common/Wildcard.cpp +789 -0
- package/vendor/7zip/CPP/Common/Wildcard.h +231 -0
- package/vendor/7zip/CPP/Common/Xxh64Reg.cpp +97 -0
- package/vendor/7zip/CPP/Common/XzCrc64Init.cpp +7 -0
- package/vendor/7zip/CPP/Common/XzCrc64Reg.cpp +39 -0
- package/vendor/7zip/CPP/Windows/COM.cpp +41 -0
- package/vendor/7zip/CPP/Windows/COM.h +86 -0
- package/vendor/7zip/CPP/Windows/Clipboard.cpp +130 -0
- package/vendor/7zip/CPP/Windows/Clipboard.h +28 -0
- package/vendor/7zip/CPP/Windows/CommonDialog.cpp +269 -0
- package/vendor/7zip/CPP/Windows/CommonDialog.h +43 -0
- package/vendor/7zip/CPP/Windows/Console.cpp +10 -0
- package/vendor/7zip/CPP/Windows/Console.h +52 -0
- package/vendor/7zip/CPP/Windows/Control/ComboBox.cpp +75 -0
- package/vendor/7zip/CPP/Windows/Control/ComboBox.h +79 -0
- package/vendor/7zip/CPP/Windows/Control/CommandBar.h +52 -0
- package/vendor/7zip/CPP/Windows/Control/Dialog.cpp +446 -0
- package/vendor/7zip/CPP/Windows/Control/Dialog.h +213 -0
- package/vendor/7zip/CPP/Windows/Control/Edit.h +19 -0
- package/vendor/7zip/CPP/Windows/Control/ImageList.cpp +10 -0
- package/vendor/7zip/CPP/Windows/Control/ImageList.h +87 -0
- package/vendor/7zip/CPP/Windows/Control/ListView.cpp +162 -0
- package/vendor/7zip/CPP/Windows/Control/ListView.h +156 -0
- package/vendor/7zip/CPP/Windows/Control/ProgressBar.h +35 -0
- package/vendor/7zip/CPP/Windows/Control/PropertyPage.cpp +165 -0
- package/vendor/7zip/CPP/Windows/Control/PropertyPage.h +50 -0
- package/vendor/7zip/CPP/Windows/Control/ReBar.h +34 -0
- package/vendor/7zip/CPP/Windows/Control/Static.h +28 -0
- package/vendor/7zip/CPP/Windows/Control/StatusBar.h +42 -0
- package/vendor/7zip/CPP/Windows/Control/StdAfx.h +11 -0
- package/vendor/7zip/CPP/Windows/Control/ToolBar.h +43 -0
- package/vendor/7zip/CPP/Windows/Control/Trackbar.h +27 -0
- package/vendor/7zip/CPP/Windows/Control/Window2.cpp +202 -0
- package/vendor/7zip/CPP/Windows/Control/Window2.h +53 -0
- package/vendor/7zip/CPP/Windows/DLL.cpp +178 -0
- package/vendor/7zip/CPP/Windows/DLL.h +103 -0
- package/vendor/7zip/CPP/Windows/ErrorMsg.cpp +133 -0
- package/vendor/7zip/CPP/Windows/ErrorMsg.h +16 -0
- package/vendor/7zip/CPP/Windows/FileDir.cpp +1388 -0
- package/vendor/7zip/CPP/Windows/FileDir.h +173 -0
- package/vendor/7zip/CPP/Windows/FileFind.cpp +1458 -0
- package/vendor/7zip/CPP/Windows/FileFind.h +345 -0
- package/vendor/7zip/CPP/Windows/FileIO.cpp +1188 -0
- package/vendor/7zip/CPP/Windows/FileIO.h +508 -0
- package/vendor/7zip/CPP/Windows/FileLink.cpp +697 -0
- package/vendor/7zip/CPP/Windows/FileMapping.cpp +12 -0
- package/vendor/7zip/CPP/Windows/FileMapping.h +66 -0
- package/vendor/7zip/CPP/Windows/FileName.cpp +911 -0
- package/vendor/7zip/CPP/Windows/FileName.h +142 -0
- package/vendor/7zip/CPP/Windows/FileSystem.cpp +187 -0
- package/vendor/7zip/CPP/Windows/FileSystem.h +31 -0
- package/vendor/7zip/CPP/Windows/Handle.h +39 -0
- package/vendor/7zip/CPP/Windows/MemoryGlobal.cpp +36 -0
- package/vendor/7zip/CPP/Windows/MemoryGlobal.h +55 -0
- package/vendor/7zip/CPP/Windows/MemoryLock.cpp +127 -0
- package/vendor/7zip/CPP/Windows/MemoryLock.h +40 -0
- package/vendor/7zip/CPP/Windows/Menu.cpp +265 -0
- package/vendor/7zip/CPP/Windows/Menu.h +170 -0
- package/vendor/7zip/CPP/Windows/NationalTime.cpp +37 -0
- package/vendor/7zip/CPP/Windows/NationalTime.h +20 -0
- package/vendor/7zip/CPP/Windows/Net.cpp +398 -0
- package/vendor/7zip/CPP/Windows/Net.h +87 -0
- package/vendor/7zip/CPP/Windows/NtCheck.h +58 -0
- package/vendor/7zip/CPP/Windows/ProcessMessages.cpp +22 -0
- package/vendor/7zip/CPP/Windows/ProcessMessages.h +12 -0
- package/vendor/7zip/CPP/Windows/ProcessUtils.cpp +102 -0
- package/vendor/7zip/CPP/Windows/ProcessUtils.h +138 -0
- package/vendor/7zip/CPP/Windows/PropVariant.cpp +393 -0
- package/vendor/7zip/CPP/Windows/PropVariant.h +173 -0
- package/vendor/7zip/CPP/Windows/PropVariantConv.cpp +274 -0
- package/vendor/7zip/CPP/Windows/PropVariantConv.h +47 -0
- package/vendor/7zip/CPP/Windows/PropVariantUtils.cpp +161 -0
- package/vendor/7zip/CPP/Windows/PropVariantUtils.h +34 -0
- package/vendor/7zip/CPP/Windows/Registry.cpp +474 -0
- package/vendor/7zip/CPP/Windows/Registry.h +96 -0
- package/vendor/7zip/CPP/Windows/ResourceString.cpp +103 -0
- package/vendor/7zip/CPP/Windows/ResourceString.h +17 -0
- package/vendor/7zip/CPP/Windows/SecurityUtils.cpp +186 -0
- package/vendor/7zip/CPP/Windows/SecurityUtils.h +154 -0
- package/vendor/7zip/CPP/Windows/Shell.cpp +839 -0
- package/vendor/7zip/CPP/Windows/Shell.h +129 -0
- package/vendor/7zip/CPP/Windows/StdAfx.h +11 -0
- package/vendor/7zip/CPP/Windows/Synchronization.cpp +87 -0
- package/vendor/7zip/CPP/Windows/Synchronization.h +386 -0
- package/vendor/7zip/CPP/Windows/System.cpp +423 -0
- package/vendor/7zip/CPP/Windows/System.h +209 -0
- package/vendor/7zip/CPP/Windows/SystemInfo.cpp +1312 -0
- package/vendor/7zip/CPP/Windows/SystemInfo.h +19 -0
- package/vendor/7zip/CPP/Windows/Thread.h +46 -0
- package/vendor/7zip/CPP/Windows/TimeUtils.cpp +467 -0
- package/vendor/7zip/CPP/Windows/TimeUtils.h +154 -0
- package/vendor/7zip/CPP/Windows/WinDefs.h +17 -0
- package/vendor/7zip/CPP/Windows/Window.cpp +179 -0
- package/vendor/7zip/CPP/Windows/Window.h +363 -0
- package/vendor/7zip/DOC/7zC.txt +187 -0
- package/vendor/7zip/DOC/7zFormat.txt +469 -0
- package/vendor/7zip/DOC/7zip.hhp +84 -0
- package/vendor/7zip/DOC/7zip.wxs +403 -0
- package/vendor/7zip/DOC/License.txt +151 -0
- package/vendor/7zip/DOC/Methods.txt +177 -0
- package/vendor/7zip/DOC/copying.txt +502 -0
- package/vendor/7zip/DOC/lzma.txt +345 -0
- package/vendor/7zip/DOC/readme.txt +299 -0
- package/vendor/7zip/DOC/src-history.txt +884 -0
- package/vendor/7zip/DOC/unRarLicense.txt +41 -0
- package/vendor/7zip/README.md +2 -0
package/native/addon.cpp
ADDED
|
@@ -0,0 +1,2154 @@
|
|
|
1
|
+
#include <napi.h>
|
|
2
|
+
|
|
3
|
+
#include <algorithm>
|
|
4
|
+
#include <atomic>
|
|
5
|
+
#include <cctype>
|
|
6
|
+
#include <cmath>
|
|
7
|
+
#include <codecvt>
|
|
8
|
+
#include <condition_variable>
|
|
9
|
+
#include <cstdint>
|
|
10
|
+
#include <cstring>
|
|
11
|
+
#include <cwctype>
|
|
12
|
+
#include <deque>
|
|
13
|
+
#include <filesystem>
|
|
14
|
+
#include <fstream>
|
|
15
|
+
#include <limits>
|
|
16
|
+
#include <locale>
|
|
17
|
+
#include <map>
|
|
18
|
+
#include <memory>
|
|
19
|
+
#include <mutex>
|
|
20
|
+
#include <optional>
|
|
21
|
+
#include <stdexcept>
|
|
22
|
+
#include <string>
|
|
23
|
+
#include <thread>
|
|
24
|
+
#include <unordered_map>
|
|
25
|
+
#include <utility>
|
|
26
|
+
#include <vector>
|
|
27
|
+
|
|
28
|
+
#ifndef _WIN32
|
|
29
|
+
#include <dlfcn.h>
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
#include "Common/MyInitGuid.h"
|
|
33
|
+
#include "Common/MyCom.h"
|
|
34
|
+
#include "Common/StringConvert.h"
|
|
35
|
+
#include "7zip/Archive/IArchive.h"
|
|
36
|
+
#include "7zip/IPassword.h"
|
|
37
|
+
#include "Windows/PropVariant.h"
|
|
38
|
+
|
|
39
|
+
namespace {
|
|
40
|
+
|
|
41
|
+
constexpr std::uint64_t kMaxPendingOperations = 128;
|
|
42
|
+
constexpr std::uint32_t kMaxExtractionConcurrency = 128;
|
|
43
|
+
constexpr std::uint64_t kMaxEntries = 1'000'000;
|
|
44
|
+
constexpr std::uint64_t kMaxSingleOutputBytes = 256ULL * 1024 * 1024;
|
|
45
|
+
constexpr std::uint64_t kMaxConcurrentOutputBytes = 512ULL * 1024 * 1024;
|
|
46
|
+
constexpr std::uint64_t kMaxReadBytes = 64ULL * 1024 * 1024;
|
|
47
|
+
constexpr std::size_t kMaxPasswordBytes = 1024 * 1024;
|
|
48
|
+
|
|
49
|
+
using CreateObjectFunction = HRESULT (STDAPICALLTYPE *)(const GUID *, const GUID *, void **);
|
|
50
|
+
using GetHandlerPropertyFunction = HRESULT (STDAPICALLTYPE *)(UInt32, PROPID, PROPVARIANT *);
|
|
51
|
+
using GetNumberOfFormatsFunction = HRESULT (STDAPICALLTYPE *)(UInt32 *);
|
|
52
|
+
using GetIsArcFunction = HRESULT (STDAPICALLTYPE *)(UInt32, Func_IsArc *);
|
|
53
|
+
|
|
54
|
+
std::wstring FromUtf8(const std::string& value);
|
|
55
|
+
|
|
56
|
+
#ifdef _WIN32
|
|
57
|
+
using EngineModule = HMODULE;
|
|
58
|
+
#else
|
|
59
|
+
using EngineModule = void *;
|
|
60
|
+
#endif
|
|
61
|
+
|
|
62
|
+
std::atomic<std::uint64_t> g_pendingOperations{0};
|
|
63
|
+
std::atomic<std::uint32_t> g_extractionConcurrency{1};
|
|
64
|
+
std::atomic<std::uint64_t> g_nextHandle{1};
|
|
65
|
+
std::atomic<std::uint64_t> g_nextStreamId{1};
|
|
66
|
+
std::mutex g_handlesMutex;
|
|
67
|
+
std::unordered_map<std::uint64_t, std::shared_ptr<class ArchiveEngine>> g_handles;
|
|
68
|
+
std::mutex g_streamsMutex;
|
|
69
|
+
std::unordered_map<std::uint64_t, std::shared_ptr<class NativeStreamState>> g_streams;
|
|
70
|
+
std::mutex g_outputBudgetMutex;
|
|
71
|
+
std::condition_variable g_outputBudgetAvailable;
|
|
72
|
+
std::uint64_t g_reservedOutputBytes = 0;
|
|
73
|
+
std::mutex g_engineMutex;
|
|
74
|
+
EngineModule g_engineModule = nullptr;
|
|
75
|
+
std::string g_enginePath;
|
|
76
|
+
CreateObjectFunction g_createObject = nullptr;
|
|
77
|
+
GetHandlerPropertyFunction g_getHandlerProperty = nullptr;
|
|
78
|
+
GetNumberOfFormatsFunction g_getNumberOfFormats = nullptr;
|
|
79
|
+
GetIsArcFunction g_getIsArc = nullptr;
|
|
80
|
+
class ExtractionPool;
|
|
81
|
+
ExtractionPool *g_extractionPool = nullptr;
|
|
82
|
+
|
|
83
|
+
template<typename Function>
|
|
84
|
+
Function LoadEngineFunction(const char *name)
|
|
85
|
+
{
|
|
86
|
+
#ifdef _WIN32
|
|
87
|
+
return reinterpret_cast<Function>(::GetProcAddress(g_engineModule, name));
|
|
88
|
+
#else
|
|
89
|
+
return reinterpret_cast<Function>(::dlsym(g_engineModule, name));
|
|
90
|
+
#endif
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
std::uint64_t RegisterStream(std::shared_ptr<class NativeStreamState> stream);
|
|
94
|
+
std::shared_ptr<class NativeStreamState> FindStream(std::uint64_t streamId);
|
|
95
|
+
void RemoveStream(std::uint64_t streamId);
|
|
96
|
+
|
|
97
|
+
void EnsureEngineLoaded(const std::string& path)
|
|
98
|
+
{
|
|
99
|
+
std::lock_guard<std::mutex> lock(g_engineMutex);
|
|
100
|
+
if (g_engineModule != nullptr) {
|
|
101
|
+
if (g_enginePath != path) {
|
|
102
|
+
throw std::runtime_error("Only one 7-Zip engine path can be loaded per process");
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
#ifdef _WIN32
|
|
107
|
+
const auto widePath = FromUtf8(path);
|
|
108
|
+
g_engineModule = ::LoadLibraryW(widePath.c_str());
|
|
109
|
+
if (g_engineModule == nullptr) {
|
|
110
|
+
throw std::runtime_error("Unable to load the bundled 7-Zip engine DLL");
|
|
111
|
+
}
|
|
112
|
+
#else
|
|
113
|
+
g_engineModule = ::dlopen(path.c_str(), RTLD_NOW | RTLD_LOCAL);
|
|
114
|
+
if (g_engineModule == nullptr) {
|
|
115
|
+
const auto *error = ::dlerror();
|
|
116
|
+
throw std::runtime_error(
|
|
117
|
+
std::string("Unable to load the bundled 7-Zip engine: ")
|
|
118
|
+
+ (error == nullptr ? "unknown loader error" : error));
|
|
119
|
+
}
|
|
120
|
+
#endif
|
|
121
|
+
g_createObject = LoadEngineFunction<CreateObjectFunction>("CreateObject");
|
|
122
|
+
g_getHandlerProperty = LoadEngineFunction<GetHandlerPropertyFunction>("GetHandlerProperty2");
|
|
123
|
+
g_getNumberOfFormats = LoadEngineFunction<GetNumberOfFormatsFunction>("GetNumberOfFormats");
|
|
124
|
+
g_getIsArc = LoadEngineFunction<GetIsArcFunction>("GetIsArc");
|
|
125
|
+
if (g_createObject == nullptr || g_getHandlerProperty == nullptr
|
|
126
|
+
|| g_getNumberOfFormats == nullptr || g_getIsArc == nullptr) {
|
|
127
|
+
#ifdef _WIN32
|
|
128
|
+
::FreeLibrary(g_engineModule);
|
|
129
|
+
#else
|
|
130
|
+
::dlclose(g_engineModule);
|
|
131
|
+
#endif
|
|
132
|
+
g_engineModule = nullptr;
|
|
133
|
+
g_createObject = nullptr;
|
|
134
|
+
g_getHandlerProperty = nullptr;
|
|
135
|
+
g_getNumberOfFormats = nullptr;
|
|
136
|
+
g_getIsArc = nullptr;
|
|
137
|
+
throw std::runtime_error("The bundled 7-Zip engine is missing required exports");
|
|
138
|
+
}
|
|
139
|
+
g_enginePath = path;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
bool ReserveOperation()
|
|
143
|
+
{
|
|
144
|
+
auto pending = g_pendingOperations.load(std::memory_order_relaxed);
|
|
145
|
+
while (pending < kMaxPendingOperations) {
|
|
146
|
+
if (g_pendingOperations.compare_exchange_weak(
|
|
147
|
+
pending, pending + 1, std::memory_order_acq_rel, std::memory_order_relaxed)) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
std::wstring FromUtf8(const std::string& value)
|
|
155
|
+
{
|
|
156
|
+
#ifdef _WIN32
|
|
157
|
+
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
|
158
|
+
#else
|
|
159
|
+
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
|
160
|
+
#endif
|
|
161
|
+
return converter.from_bytes(value);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
template<typename Character>
|
|
165
|
+
void SecureErase(std::basic_string<Character>& value) noexcept
|
|
166
|
+
{
|
|
167
|
+
volatile Character *characters = value.empty() ? nullptr : value.data();
|
|
168
|
+
for (std::size_t i = 0; i < value.size(); ++i) {
|
|
169
|
+
characters[i] = Character{};
|
|
170
|
+
}
|
|
171
|
+
value.clear();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
std::filesystem::path NativePath(const std::string& path)
|
|
175
|
+
{
|
|
176
|
+
#ifdef _WIN32
|
|
177
|
+
return std::filesystem::path(FromUtf8(path));
|
|
178
|
+
#else
|
|
179
|
+
return std::filesystem::path(path);
|
|
180
|
+
#endif
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
struct FileStamp {
|
|
184
|
+
std::uintmax_t size;
|
|
185
|
+
std::filesystem::file_time_type modified;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
struct StreamMessage {
|
|
189
|
+
enum class Kind {
|
|
190
|
+
Chunk,
|
|
191
|
+
End,
|
|
192
|
+
Error
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
Kind kind;
|
|
196
|
+
std::vector<std::uint8_t> data;
|
|
197
|
+
std::string error;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
void StreamMessageToJs(Napi::Env env, Napi::Function callback, StreamMessage *message);
|
|
201
|
+
|
|
202
|
+
class NativeStreamState {
|
|
203
|
+
public:
|
|
204
|
+
void Resume()
|
|
205
|
+
{
|
|
206
|
+
{
|
|
207
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
208
|
+
if (!cancelled_) {
|
|
209
|
+
demand_ = true;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
available_.notify_one();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
void Cancel()
|
|
216
|
+
{
|
|
217
|
+
{
|
|
218
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
219
|
+
cancelled_ = true;
|
|
220
|
+
}
|
|
221
|
+
available_.notify_all();
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
bool IsCancelled() const
|
|
225
|
+
{
|
|
226
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
227
|
+
return cancelled_;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
bool WaitForDemand()
|
|
231
|
+
{
|
|
232
|
+
std::unique_lock<std::mutex> lock(mutex_);
|
|
233
|
+
available_.wait(lock, [this]() { return cancelled_ || demand_; });
|
|
234
|
+
if (cancelled_) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
demand_ = false;
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
bool Send(std::unique_ptr<StreamMessage> message)
|
|
242
|
+
{
|
|
243
|
+
const auto status = callback.BlockingCall(message.get(), StreamMessageToJs);
|
|
244
|
+
if (status != napi_ok) {
|
|
245
|
+
Cancel();
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
message.release();
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
void ReleaseCallback()
|
|
253
|
+
{
|
|
254
|
+
if (!callbackReleased_.exchange(true, std::memory_order_acq_rel)) {
|
|
255
|
+
callback.Release();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
std::uint64_t id = 0;
|
|
260
|
+
Napi::ThreadSafeFunction callback;
|
|
261
|
+
|
|
262
|
+
private:
|
|
263
|
+
mutable std::mutex mutex_;
|
|
264
|
+
std::condition_variable available_;
|
|
265
|
+
bool cancelled_ = false;
|
|
266
|
+
bool demand_ = false;
|
|
267
|
+
std::atomic<bool> callbackReleased_{false};
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
std::uint64_t RegisterStream(std::shared_ptr<NativeStreamState> stream)
|
|
271
|
+
{
|
|
272
|
+
const auto streamId = g_nextStreamId.fetch_add(1, std::memory_order_relaxed);
|
|
273
|
+
if (streamId == 0) {
|
|
274
|
+
throw std::overflow_error("Native stream handle space exhausted");
|
|
275
|
+
}
|
|
276
|
+
std::lock_guard<std::mutex> lock(g_streamsMutex);
|
|
277
|
+
stream->id = streamId;
|
|
278
|
+
g_streams.emplace(streamId, std::move(stream));
|
|
279
|
+
return streamId;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
std::shared_ptr<NativeStreamState> FindStream(std::uint64_t streamId)
|
|
283
|
+
{
|
|
284
|
+
std::lock_guard<std::mutex> lock(g_streamsMutex);
|
|
285
|
+
const auto found = g_streams.find(streamId);
|
|
286
|
+
return found == g_streams.end() ? nullptr : found->second;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
void RemoveStream(std::uint64_t streamId)
|
|
290
|
+
{
|
|
291
|
+
std::lock_guard<std::mutex> lock(g_streamsMutex);
|
|
292
|
+
g_streams.erase(streamId);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
FileStamp GetFileStamp(const std::string& path)
|
|
296
|
+
{
|
|
297
|
+
std::error_code error;
|
|
298
|
+
const auto size = std::filesystem::file_size(NativePath(path), error);
|
|
299
|
+
if (error) {
|
|
300
|
+
throw std::runtime_error("Unable to read archive file size");
|
|
301
|
+
}
|
|
302
|
+
const auto modified = std::filesystem::last_write_time(NativePath(path), error);
|
|
303
|
+
if (error) {
|
|
304
|
+
throw std::runtime_error("Unable to read archive modification time");
|
|
305
|
+
}
|
|
306
|
+
return {size, modified};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
class OutputReservation {
|
|
310
|
+
public:
|
|
311
|
+
~OutputReservation()
|
|
312
|
+
{
|
|
313
|
+
if (reserved_ == 0) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
{
|
|
317
|
+
std::lock_guard<std::mutex> lock(g_outputBudgetMutex);
|
|
318
|
+
g_reservedOutputBytes -= reserved_;
|
|
319
|
+
}
|
|
320
|
+
g_outputBudgetAvailable.notify_all();
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
void Acquire(std::uint64_t bytes)
|
|
324
|
+
{
|
|
325
|
+
if (bytes > kMaxConcurrentOutputBytes) {
|
|
326
|
+
throw std::length_error("Requested output exceeds the concurrent memory limit");
|
|
327
|
+
}
|
|
328
|
+
if (bytes == 0) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
std::unique_lock<std::mutex> lock(g_outputBudgetMutex);
|
|
332
|
+
g_outputBudgetAvailable.wait(lock, [bytes]() {
|
|
333
|
+
return bytes <= kMaxConcurrentOutputBytes - g_reservedOutputBytes;
|
|
334
|
+
});
|
|
335
|
+
g_reservedOutputBytes += bytes;
|
|
336
|
+
reserved_ = bytes;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
private:
|
|
340
|
+
std::uint64_t reserved_ = 0;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
HRESULT GetPasswordBstr(const std::optional<std::string>& password, BSTR *result)
|
|
344
|
+
{
|
|
345
|
+
if (result == nullptr) {
|
|
346
|
+
return E_INVALIDARG;
|
|
347
|
+
}
|
|
348
|
+
*result = nullptr;
|
|
349
|
+
if (!password) {
|
|
350
|
+
return E_ABORT;
|
|
351
|
+
}
|
|
352
|
+
std::wstring widePassword;
|
|
353
|
+
try {
|
|
354
|
+
widePassword = FromUtf8(*password);
|
|
355
|
+
} catch (...) {
|
|
356
|
+
return E_INVALIDARG;
|
|
357
|
+
}
|
|
358
|
+
struct WipeOnExit {
|
|
359
|
+
std::wstring& value;
|
|
360
|
+
~WipeOnExit() { SecureErase(value); }
|
|
361
|
+
} wipe{widePassword};
|
|
362
|
+
if (widePassword.size() > std::numeric_limits<UINT>::max()) {
|
|
363
|
+
return E_INVALIDARG;
|
|
364
|
+
}
|
|
365
|
+
*result = ::SysAllocStringLen(
|
|
366
|
+
widePassword.data(),
|
|
367
|
+
static_cast<UINT>(widePassword.size()));
|
|
368
|
+
return *result == nullptr ? E_OUTOFMEMORY : S_OK;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
std::string ToUtf8(const wchar_t *value)
|
|
372
|
+
{
|
|
373
|
+
if (value == nullptr) {
|
|
374
|
+
return {};
|
|
375
|
+
}
|
|
376
|
+
#ifdef _WIN32
|
|
377
|
+
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
|
378
|
+
#else
|
|
379
|
+
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
|
380
|
+
#endif
|
|
381
|
+
return converter.to_bytes(value);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
std::string LowerAscii(std::string value)
|
|
385
|
+
{
|
|
386
|
+
std::transform(value.begin(), value.end(), value.begin(), [](unsigned char ch) {
|
|
387
|
+
return static_cast<char>(std::tolower(ch));
|
|
388
|
+
});
|
|
389
|
+
return value;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
std::string Extension(const std::string& path)
|
|
393
|
+
{
|
|
394
|
+
const auto separator = path.find_last_of("/\\");
|
|
395
|
+
const auto dot = path.find_last_of('.');
|
|
396
|
+
if (dot == std::string::npos || (separator != std::string::npos && dot < separator)) {
|
|
397
|
+
return {};
|
|
398
|
+
}
|
|
399
|
+
return LowerAscii(path.substr(dot + 1));
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
std::vector<std::string> SplitExtensions(const std::wstring& value)
|
|
403
|
+
{
|
|
404
|
+
std::wstring normalized = value;
|
|
405
|
+
for (auto& ch : normalized) {
|
|
406
|
+
if (ch == L';' || ch == L',' || ch == L'*' || ch == L'.') {
|
|
407
|
+
ch = L' ';
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
std::vector<std::string> result;
|
|
411
|
+
std::wstring token;
|
|
412
|
+
for (const auto ch : normalized) {
|
|
413
|
+
if (std::iswspace(ch)) {
|
|
414
|
+
if (!token.empty()) {
|
|
415
|
+
result.push_back(LowerAscii(ToUtf8(token.c_str())));
|
|
416
|
+
token.clear();
|
|
417
|
+
}
|
|
418
|
+
} else {
|
|
419
|
+
token.push_back(ch);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
if (!token.empty()) {
|
|
423
|
+
result.push_back(LowerAscii(ToUtf8(token.c_str())));
|
|
424
|
+
}
|
|
425
|
+
return result;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
bool ReadUnsigned(const Napi::Value& value, std::uint64_t& result)
|
|
429
|
+
{
|
|
430
|
+
if (value.IsBigInt()) {
|
|
431
|
+
bool lossless = false;
|
|
432
|
+
result = value.As<Napi::BigInt>().Uint64Value(&lossless);
|
|
433
|
+
return lossless;
|
|
434
|
+
}
|
|
435
|
+
if (!value.IsNumber()) {
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
const double number = value.As<Napi::Number>().DoubleValue();
|
|
439
|
+
if (!std::isfinite(number) || number < 0 || std::floor(number) != number
|
|
440
|
+
|| number > 9007199254740991.0) {
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
result = static_cast<std::uint64_t>(number);
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
std::uint64_t GetHandle(const Napi::Value& value)
|
|
448
|
+
{
|
|
449
|
+
std::uint64_t handle = 0;
|
|
450
|
+
if (!ReadUnsigned(value, handle) || handle == 0) {
|
|
451
|
+
throw Napi::TypeError::New(value.Env(), "Invalid archive handle");
|
|
452
|
+
}
|
|
453
|
+
return handle;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
std::shared_ptr<class ArchiveEngine> FindArchive(std::uint64_t handle)
|
|
457
|
+
{
|
|
458
|
+
std::lock_guard<std::mutex> lock(g_handlesMutex);
|
|
459
|
+
const auto found = g_handles.find(handle);
|
|
460
|
+
if (found == g_handles.end()) {
|
|
461
|
+
return {};
|
|
462
|
+
}
|
|
463
|
+
return found->second;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
std::uint64_t RegisterArchive(std::shared_ptr<class ArchiveEngine> archive)
|
|
467
|
+
{
|
|
468
|
+
const auto handle = g_nextHandle.fetch_add(1, std::memory_order_relaxed);
|
|
469
|
+
if (handle == 0) {
|
|
470
|
+
throw std::runtime_error("Archive handle space exhausted");
|
|
471
|
+
}
|
|
472
|
+
std::lock_guard<std::mutex> lock(g_handlesMutex);
|
|
473
|
+
g_handles.emplace(handle, std::move(archive));
|
|
474
|
+
return handle;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
struct Entry {
|
|
478
|
+
std::uint32_t id = 0;
|
|
479
|
+
std::string path;
|
|
480
|
+
std::uint64_t size = 0;
|
|
481
|
+
std::uint64_t compressedSize = 0;
|
|
482
|
+
std::uint32_t attributes = 0;
|
|
483
|
+
std::uint32_t crc = 0;
|
|
484
|
+
bool hasCrc = false;
|
|
485
|
+
bool directory = false;
|
|
486
|
+
bool encrypted = false;
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
std::uint64_t GetPropUInt64(IInArchive *archive, std::uint32_t index, PROPID propId)
|
|
490
|
+
{
|
|
491
|
+
NWindows::NCOM::CPropVariant value;
|
|
492
|
+
if (archive->GetProperty(index, propId, &value) != S_OK) {
|
|
493
|
+
return 0;
|
|
494
|
+
}
|
|
495
|
+
if (value.vt == VT_UI8) {
|
|
496
|
+
return value.uhVal.QuadPart;
|
|
497
|
+
}
|
|
498
|
+
if (value.vt == VT_UI4) {
|
|
499
|
+
return value.ulVal;
|
|
500
|
+
}
|
|
501
|
+
if (value.vt == VT_I8 && value.hVal.QuadPart >= 0) {
|
|
502
|
+
return static_cast<std::uint64_t>(value.hVal.QuadPart);
|
|
503
|
+
}
|
|
504
|
+
if (value.vt == VT_I4 && value.lVal >= 0) {
|
|
505
|
+
return static_cast<std::uint64_t>(value.lVal);
|
|
506
|
+
}
|
|
507
|
+
return 0;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
bool GetPropBool(IInArchive *archive, std::uint32_t index, PROPID propId)
|
|
511
|
+
{
|
|
512
|
+
NWindows::NCOM::CPropVariant value;
|
|
513
|
+
if (archive->GetProperty(index, propId, &value) != S_OK || value.vt != VT_BOOL) {
|
|
514
|
+
return false;
|
|
515
|
+
}
|
|
516
|
+
return value.boolVal != VARIANT_FALSE;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
std::string GetPropString(IInArchive *archive, std::uint32_t index, PROPID propId)
|
|
520
|
+
{
|
|
521
|
+
NWindows::NCOM::CPropVariant value;
|
|
522
|
+
if (archive->GetProperty(index, propId, &value) != S_OK || value.vt != VT_BSTR) {
|
|
523
|
+
return {};
|
|
524
|
+
}
|
|
525
|
+
return ToUtf8(value.bstrVal);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
struct OutputRequest {
|
|
529
|
+
std::uint32_t id = 0;
|
|
530
|
+
std::uint64_t offset = 0;
|
|
531
|
+
std::uint64_t length = 0;
|
|
532
|
+
std::uint64_t entrySize = 0;
|
|
533
|
+
bool encrypted = false;
|
|
534
|
+
std::vector<std::uint8_t> data;
|
|
535
|
+
std::int32_t operationResult = NArchive::NExtract::NOperationResult::kUnavailable;
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
class FileInStream final : public IInStream, public CMyUnknownImp {
|
|
539
|
+
Z7_COM_QI_BEGIN2(IInStream)
|
|
540
|
+
Z7_COM_QI_ENTRY(ISequentialInStream)
|
|
541
|
+
Z7_COM_QI_END
|
|
542
|
+
Z7_COM_ADDREF_RELEASE
|
|
543
|
+
|
|
544
|
+
Z7_IFACE_COM7_IMP(ISequentialInStream)
|
|
545
|
+
Z7_IFACE_COM7_IMP(IInStream)
|
|
546
|
+
|
|
547
|
+
public:
|
|
548
|
+
bool Open(const std::string& path)
|
|
549
|
+
{
|
|
550
|
+
file_.open(NativePath(path), std::ios::binary);
|
|
551
|
+
if (!file_.is_open()) {
|
|
552
|
+
return false;
|
|
553
|
+
}
|
|
554
|
+
file_.seekg(0, std::ios::end);
|
|
555
|
+
const auto end = file_.tellg();
|
|
556
|
+
if (end < 0 || static_cast<std::uint64_t>(end) > static_cast<std::uint64_t>(INT64_MAX)) {
|
|
557
|
+
file_.close();
|
|
558
|
+
return false;
|
|
559
|
+
}
|
|
560
|
+
length_ = static_cast<std::uint64_t>(end);
|
|
561
|
+
file_.clear();
|
|
562
|
+
file_.seekg(0, std::ios::beg);
|
|
563
|
+
return file_.good();
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
private:
|
|
567
|
+
std::mutex mutex_;
|
|
568
|
+
std::ifstream file_;
|
|
569
|
+
std::uint64_t length_ = 0;
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
Z7_COM7F_IMF(FileInStream::Read(void *data, UInt32 size, UInt32 *processedSize))
|
|
573
|
+
{
|
|
574
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
575
|
+
file_.clear();
|
|
576
|
+
file_.read(static_cast<char *>(data), static_cast<std::streamsize>(size));
|
|
577
|
+
const auto count = file_.gcount();
|
|
578
|
+
if (processedSize != nullptr) {
|
|
579
|
+
*processedSize = static_cast<UInt32>(count);
|
|
580
|
+
}
|
|
581
|
+
if (file_.bad()) {
|
|
582
|
+
return E_FAIL;
|
|
583
|
+
}
|
|
584
|
+
return S_OK;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
Z7_COM7F_IMF(FileInStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition))
|
|
588
|
+
{
|
|
589
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
590
|
+
std::uint64_t base = 0;
|
|
591
|
+
switch (seekOrigin) {
|
|
592
|
+
case 0:
|
|
593
|
+
break;
|
|
594
|
+
case 1: {
|
|
595
|
+
file_.clear();
|
|
596
|
+
const auto current = file_.tellg();
|
|
597
|
+
if (current < 0) {
|
|
598
|
+
return E_FAIL;
|
|
599
|
+
}
|
|
600
|
+
base = static_cast<std::uint64_t>(current);
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
case 2:
|
|
604
|
+
base = length_;
|
|
605
|
+
break;
|
|
606
|
+
default:
|
|
607
|
+
return E_INVALIDARG;
|
|
608
|
+
}
|
|
609
|
+
std::uint64_t target = 0;
|
|
610
|
+
if (offset >= 0) {
|
|
611
|
+
const auto advance = static_cast<std::uint64_t>(offset);
|
|
612
|
+
if (advance > static_cast<std::uint64_t>(INT64_MAX) - base) {
|
|
613
|
+
return E_INVALIDARG;
|
|
614
|
+
}
|
|
615
|
+
target = base + advance;
|
|
616
|
+
} else {
|
|
617
|
+
const auto retreat = static_cast<std::uint64_t>(-(offset + 1)) + 1;
|
|
618
|
+
if (retreat > base) {
|
|
619
|
+
return E_INVALIDARG;
|
|
620
|
+
}
|
|
621
|
+
target = base - retreat;
|
|
622
|
+
}
|
|
623
|
+
file_.clear();
|
|
624
|
+
file_.seekg(static_cast<std::streamoff>(target), std::ios::beg);
|
|
625
|
+
if (!file_.good()) {
|
|
626
|
+
return E_FAIL;
|
|
627
|
+
}
|
|
628
|
+
if (newPosition != nullptr) {
|
|
629
|
+
*newPosition = target;
|
|
630
|
+
}
|
|
631
|
+
return S_OK;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
class ArchiveOpenCallback final :
|
|
635
|
+
public IArchiveOpenCallback,
|
|
636
|
+
public ICryptoGetTextPassword,
|
|
637
|
+
public CMyUnknownImp {
|
|
638
|
+
Z7_COM_QI_BEGIN2(IArchiveOpenCallback)
|
|
639
|
+
Z7_COM_QI_ENTRY(ICryptoGetTextPassword)
|
|
640
|
+
Z7_COM_QI_END
|
|
641
|
+
Z7_COM_ADDREF_RELEASE
|
|
642
|
+
|
|
643
|
+
Z7_IFACE_COM7_IMP(IArchiveOpenCallback)
|
|
644
|
+
Z7_IFACE_COM7_IMP(ICryptoGetTextPassword)
|
|
645
|
+
|
|
646
|
+
public:
|
|
647
|
+
explicit ArchiveOpenCallback(const std::optional<std::string>& password)
|
|
648
|
+
: password_(password), passwordRequested_(false) {}
|
|
649
|
+
|
|
650
|
+
bool PasswordRequested() const
|
|
651
|
+
{
|
|
652
|
+
return passwordRequested_.load(std::memory_order_acquire);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
private:
|
|
656
|
+
const std::optional<std::string>& password_;
|
|
657
|
+
std::atomic<bool> passwordRequested_;
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
Z7_COM7F_IMF(ArchiveOpenCallback::SetTotal(const UInt64 *, const UInt64 *))
|
|
661
|
+
{
|
|
662
|
+
return S_OK;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
Z7_COM7F_IMF(ArchiveOpenCallback::SetCompleted(const UInt64 *, const UInt64 *))
|
|
666
|
+
{
|
|
667
|
+
return S_OK;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
Z7_COM7F_IMF(ArchiveOpenCallback::CryptoGetTextPassword(BSTR *password))
|
|
671
|
+
{
|
|
672
|
+
passwordRequested_.store(true, std::memory_order_release);
|
|
673
|
+
return GetPasswordBstr(password_, password);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
class VectorOutStream final : public ISequentialOutStream, public CMyUnknownImp {
|
|
677
|
+
Z7_COM_UNKNOWN_IMP_1(ISequentialOutStream)
|
|
678
|
+
Z7_COM7F_IMP(Write(const void *data, UInt32 size, UInt32 *processedSize))
|
|
679
|
+
|
|
680
|
+
public:
|
|
681
|
+
explicit VectorOutStream(OutputRequest *request): request_(request), seen_(0) {}
|
|
682
|
+
|
|
683
|
+
private:
|
|
684
|
+
OutputRequest *request_;
|
|
685
|
+
std::uint64_t seen_;
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
Z7_COM7F_IMF(VectorOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize))
|
|
689
|
+
{
|
|
690
|
+
const auto start = seen_;
|
|
691
|
+
const auto end = start + size;
|
|
692
|
+
if (end < start) {
|
|
693
|
+
return E_FAIL;
|
|
694
|
+
}
|
|
695
|
+
const auto wantedStart = request_->offset;
|
|
696
|
+
const auto wantedEnd = wantedStart + request_->length;
|
|
697
|
+
const auto copyStart = std::max(start, wantedStart);
|
|
698
|
+
const auto copyEnd = std::min(end, wantedEnd);
|
|
699
|
+
if (copyEnd > copyStart) {
|
|
700
|
+
const auto count = copyEnd - copyStart;
|
|
701
|
+
if (count > kMaxSingleOutputBytes - request_->data.size()) {
|
|
702
|
+
return E_OUTOFMEMORY;
|
|
703
|
+
}
|
|
704
|
+
const auto *bytes = static_cast<const std::uint8_t *>(data);
|
|
705
|
+
request_->data.insert(
|
|
706
|
+
request_->data.end(),
|
|
707
|
+
bytes + static_cast<std::size_t>(copyStart - start),
|
|
708
|
+
bytes + static_cast<std::size_t>(copyEnd - start));
|
|
709
|
+
}
|
|
710
|
+
seen_ = end;
|
|
711
|
+
if (processedSize != nullptr) {
|
|
712
|
+
*processedSize = size;
|
|
713
|
+
}
|
|
714
|
+
return S_OK;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
class ExtractCallback final :
|
|
718
|
+
public IArchiveExtractCallback,
|
|
719
|
+
public ICryptoGetTextPassword,
|
|
720
|
+
public CMyUnknownImp {
|
|
721
|
+
Z7_COM_QI_BEGIN2(IArchiveExtractCallback)
|
|
722
|
+
Z7_COM_QI_ENTRY(IProgress)
|
|
723
|
+
Z7_COM_QI_ENTRY(ICryptoGetTextPassword)
|
|
724
|
+
Z7_COM_QI_END
|
|
725
|
+
Z7_COM_ADDREF_RELEASE
|
|
726
|
+
|
|
727
|
+
Z7_IFACE_COM7_IMP(IProgress)
|
|
728
|
+
Z7_IFACE_COM7_IMP(IArchiveExtractCallback)
|
|
729
|
+
Z7_IFACE_COM7_IMP(ICryptoGetTextPassword)
|
|
730
|
+
|
|
731
|
+
public:
|
|
732
|
+
ExtractCallback(
|
|
733
|
+
std::vector<OutputRequest>& requests,
|
|
734
|
+
const std::unordered_map<std::uint32_t, std::size_t>& requestById,
|
|
735
|
+
const std::optional<std::string>& password)
|
|
736
|
+
: requests_(requests),
|
|
737
|
+
requestById_(requestById),
|
|
738
|
+
password_(password),
|
|
739
|
+
currentRequest_(nullptr),
|
|
740
|
+
passwordRequested_(false) {}
|
|
741
|
+
|
|
742
|
+
bool PasswordRequested() const
|
|
743
|
+
{
|
|
744
|
+
return passwordRequested_.load(std::memory_order_acquire);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
private:
|
|
748
|
+
std::vector<OutputRequest>& requests_;
|
|
749
|
+
const std::unordered_map<std::uint32_t, std::size_t>& requestById_;
|
|
750
|
+
const std::optional<std::string>& password_;
|
|
751
|
+
OutputRequest *currentRequest_;
|
|
752
|
+
std::vector<CMyComPtr<ISequentialOutStream>> streams_;
|
|
753
|
+
std::atomic<bool> passwordRequested_;
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
Z7_COM7F_IMF(ExtractCallback::SetTotal(UInt64))
|
|
757
|
+
{
|
|
758
|
+
return S_OK;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
Z7_COM7F_IMF(ExtractCallback::SetCompleted(const UInt64 *))
|
|
762
|
+
{
|
|
763
|
+
return S_OK;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
Z7_COM7F_IMF(ExtractCallback::GetStream(
|
|
767
|
+
UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode))
|
|
768
|
+
{
|
|
769
|
+
*outStream = nullptr;
|
|
770
|
+
currentRequest_ = nullptr;
|
|
771
|
+
if (askExtractMode != NArchive::NExtract::NAskMode::kExtract) {
|
|
772
|
+
return S_OK;
|
|
773
|
+
}
|
|
774
|
+
const auto found = requestById_.find(index);
|
|
775
|
+
if (found == requestById_.end()) {
|
|
776
|
+
return S_OK;
|
|
777
|
+
}
|
|
778
|
+
auto& request = requests_[found->second];
|
|
779
|
+
currentRequest_ = &request;
|
|
780
|
+
CMyComPtr<ISequentialOutStream> stream = new VectorOutStream(&request);
|
|
781
|
+
streams_.push_back(stream);
|
|
782
|
+
*outStream = stream;
|
|
783
|
+
(*outStream)->AddRef();
|
|
784
|
+
return S_OK;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
Z7_COM7F_IMF(ExtractCallback::PrepareOperation(Int32))
|
|
788
|
+
{
|
|
789
|
+
return S_OK;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
Z7_COM7F_IMF(ExtractCallback::SetOperationResult(Int32 operationResult))
|
|
793
|
+
{
|
|
794
|
+
if (currentRequest_ != nullptr) {
|
|
795
|
+
currentRequest_->operationResult = operationResult;
|
|
796
|
+
}
|
|
797
|
+
return S_OK;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
Z7_COM7F_IMF(ExtractCallback::CryptoGetTextPassword(BSTR *password))
|
|
801
|
+
{
|
|
802
|
+
passwordRequested_.store(true, std::memory_order_release);
|
|
803
|
+
return GetPasswordBstr(password_, password);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
class StreamingOutStream final : public ISequentialOutStream, public CMyUnknownImp {
|
|
807
|
+
Z7_COM_UNKNOWN_IMP_1(ISequentialOutStream)
|
|
808
|
+
Z7_COM7F_IMP(Write(const void *data, UInt32 size, UInt32 *processedSize))
|
|
809
|
+
|
|
810
|
+
public:
|
|
811
|
+
explicit StreamingOutStream(std::shared_ptr<NativeStreamState> stream)
|
|
812
|
+
: stream_(std::move(stream)) {}
|
|
813
|
+
|
|
814
|
+
private:
|
|
815
|
+
std::shared_ptr<NativeStreamState> stream_;
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
Z7_COM7F_IMF(StreamingOutStream::Write(
|
|
819
|
+
const void *data, UInt32 size, UInt32 *processedSize))
|
|
820
|
+
{
|
|
821
|
+
constexpr UInt32 kStreamChunkSize = 64 * 1024;
|
|
822
|
+
const auto *bytes = static_cast<const std::uint8_t *>(data);
|
|
823
|
+
UInt32 offset = 0;
|
|
824
|
+
try {
|
|
825
|
+
while (offset < size) {
|
|
826
|
+
if (!stream_->WaitForDemand()) {
|
|
827
|
+
return E_ABORT;
|
|
828
|
+
}
|
|
829
|
+
const auto count = std::min(kStreamChunkSize, size - offset);
|
|
830
|
+
auto message = std::make_unique<StreamMessage>();
|
|
831
|
+
message->kind = StreamMessage::Kind::Chunk;
|
|
832
|
+
message->data.assign(bytes + offset, bytes + offset + count);
|
|
833
|
+
if (!stream_->Send(std::move(message))) {
|
|
834
|
+
return E_ABORT;
|
|
835
|
+
}
|
|
836
|
+
offset += count;
|
|
837
|
+
}
|
|
838
|
+
} catch (...) {
|
|
839
|
+
return E_OUTOFMEMORY;
|
|
840
|
+
}
|
|
841
|
+
if (processedSize != nullptr) {
|
|
842
|
+
*processedSize = size;
|
|
843
|
+
}
|
|
844
|
+
return S_OK;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
class StreamingExtractCallback final :
|
|
848
|
+
public IArchiveExtractCallback,
|
|
849
|
+
public ICryptoGetTextPassword,
|
|
850
|
+
public CMyUnknownImp {
|
|
851
|
+
Z7_COM_QI_BEGIN2(IArchiveExtractCallback)
|
|
852
|
+
Z7_COM_QI_ENTRY(IProgress)
|
|
853
|
+
Z7_COM_QI_ENTRY(ICryptoGetTextPassword)
|
|
854
|
+
Z7_COM_QI_END
|
|
855
|
+
Z7_COM_ADDREF_RELEASE
|
|
856
|
+
|
|
857
|
+
Z7_IFACE_COM7_IMP(IProgress)
|
|
858
|
+
Z7_IFACE_COM7_IMP(IArchiveExtractCallback)
|
|
859
|
+
Z7_IFACE_COM7_IMP(ICryptoGetTextPassword)
|
|
860
|
+
|
|
861
|
+
public:
|
|
862
|
+
StreamingExtractCallback(
|
|
863
|
+
std::uint32_t id,
|
|
864
|
+
std::shared_ptr<NativeStreamState> stream,
|
|
865
|
+
const std::optional<std::string>& password)
|
|
866
|
+
: id_(id),
|
|
867
|
+
stream_(std::move(stream)),
|
|
868
|
+
password_(password),
|
|
869
|
+
operationResult_(NArchive::NExtract::NOperationResult::kUnavailable),
|
|
870
|
+
passwordRequested_(false) {}
|
|
871
|
+
|
|
872
|
+
std::int32_t OperationResult() const
|
|
873
|
+
{
|
|
874
|
+
return operationResult_;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
bool PasswordRequested() const
|
|
878
|
+
{
|
|
879
|
+
return passwordRequested_.load(std::memory_order_acquire);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
private:
|
|
883
|
+
std::uint32_t id_;
|
|
884
|
+
std::shared_ptr<NativeStreamState> stream_;
|
|
885
|
+
const std::optional<std::string>& password_;
|
|
886
|
+
std::int32_t operationResult_;
|
|
887
|
+
std::vector<CMyComPtr<ISequentialOutStream>> streams_;
|
|
888
|
+
std::atomic<bool> passwordRequested_;
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
Z7_COM7F_IMF(StreamingExtractCallback::SetTotal(UInt64))
|
|
892
|
+
{
|
|
893
|
+
return S_OK;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
Z7_COM7F_IMF(StreamingExtractCallback::SetCompleted(const UInt64 *))
|
|
897
|
+
{
|
|
898
|
+
return S_OK;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
Z7_COM7F_IMF(StreamingExtractCallback::GetStream(
|
|
902
|
+
UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode))
|
|
903
|
+
{
|
|
904
|
+
*outStream = nullptr;
|
|
905
|
+
if (askExtractMode != NArchive::NExtract::NAskMode::kExtract || index != id_) {
|
|
906
|
+
return S_OK;
|
|
907
|
+
}
|
|
908
|
+
CMyComPtr<ISequentialOutStream> stream = new StreamingOutStream(stream_);
|
|
909
|
+
streams_.push_back(stream);
|
|
910
|
+
*outStream = stream;
|
|
911
|
+
(*outStream)->AddRef();
|
|
912
|
+
return S_OK;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
Z7_COM7F_IMF(StreamingExtractCallback::PrepareOperation(Int32))
|
|
916
|
+
{
|
|
917
|
+
return S_OK;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
Z7_COM7F_IMF(StreamingExtractCallback::SetOperationResult(Int32 operationResult))
|
|
921
|
+
{
|
|
922
|
+
operationResult_ = operationResult;
|
|
923
|
+
return S_OK;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
Z7_COM7F_IMF(StreamingExtractCallback::CryptoGetTextPassword(BSTR *password))
|
|
927
|
+
{
|
|
928
|
+
passwordRequested_.store(true, std::memory_order_release);
|
|
929
|
+
return GetPasswordBstr(password_, password);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
class ArchiveEngine {
|
|
933
|
+
struct ArchiveContext {
|
|
934
|
+
CMyComPtr<IInArchive> archive;
|
|
935
|
+
CMyComPtr<IInStream> stream;
|
|
936
|
+
bool busy = false;
|
|
937
|
+
|
|
938
|
+
~ArchiveContext()
|
|
939
|
+
{
|
|
940
|
+
if (archive) {
|
|
941
|
+
archive->Close();
|
|
942
|
+
archive.Release();
|
|
943
|
+
}
|
|
944
|
+
stream.Release();
|
|
945
|
+
}
|
|
946
|
+
};
|
|
947
|
+
|
|
948
|
+
struct ContextLease {
|
|
949
|
+
ArchiveEngine *owner;
|
|
950
|
+
ArchiveContext *context;
|
|
951
|
+
|
|
952
|
+
ContextLease(ArchiveEngine *owner, ArchiveContext *context)
|
|
953
|
+
: owner(owner), context(context) {}
|
|
954
|
+
|
|
955
|
+
ContextLease(const ContextLease&) = delete;
|
|
956
|
+
ContextLease& operator=(const ContextLease&) = delete;
|
|
957
|
+
|
|
958
|
+
ContextLease(ContextLease&& other) noexcept
|
|
959
|
+
: owner(other.owner), context(other.context)
|
|
960
|
+
{
|
|
961
|
+
other.context = nullptr;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
~ContextLease()
|
|
965
|
+
{
|
|
966
|
+
if (context != nullptr) {
|
|
967
|
+
owner->ReleaseContext(context);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
ArchiveContext *operator->() const { return context; }
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
public:
|
|
975
|
+
~ArchiveEngine()
|
|
976
|
+
{
|
|
977
|
+
std::lock_guard<std::mutex> lock(contextMutex_);
|
|
978
|
+
contexts_.clear();
|
|
979
|
+
if (password_) {
|
|
980
|
+
SecureErase(*password_);
|
|
981
|
+
password_.reset();
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
void Open(
|
|
986
|
+
const std::string& path,
|
|
987
|
+
std::optional<std::string> password,
|
|
988
|
+
const std::string& enginePath)
|
|
989
|
+
{
|
|
990
|
+
EnsureEngineLoaded(enginePath);
|
|
991
|
+
path_ = path;
|
|
992
|
+
password_ = std::move(password);
|
|
993
|
+
const auto extension = Extension(path);
|
|
994
|
+
UInt32 formatCount = 0;
|
|
995
|
+
if (g_getNumberOfFormats(&formatCount) != S_OK || formatCount == 0) {
|
|
996
|
+
throw std::runtime_error("The 7-Zip handler bundle contains no formats");
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
struct Format {
|
|
1000
|
+
UInt32 index;
|
|
1001
|
+
GUID classId;
|
|
1002
|
+
std::string name;
|
|
1003
|
+
bool extensionMatch;
|
|
1004
|
+
bool hasSignatureFunction;
|
|
1005
|
+
bool signatureMatch;
|
|
1006
|
+
};
|
|
1007
|
+
std::vector<Format> formats;
|
|
1008
|
+
formats.reserve(formatCount);
|
|
1009
|
+
std::vector<Byte> header(64 * 1024);
|
|
1010
|
+
auto *probeFile = new FileInStream();
|
|
1011
|
+
CMyComPtr<IInStream> probe = probeFile;
|
|
1012
|
+
if (!probeFile->Open(path)) {
|
|
1013
|
+
throw std::runtime_error("Unable to open archive path");
|
|
1014
|
+
}
|
|
1015
|
+
UInt32 headerSize = 0;
|
|
1016
|
+
if (probe->Read(header.data(), static_cast<UInt32>(header.size()), &headerSize) != S_OK) {
|
|
1017
|
+
throw std::runtime_error("Unable to read archive signature");
|
|
1018
|
+
}
|
|
1019
|
+
if (headerSize == 0) {
|
|
1020
|
+
throw std::runtime_error("Archive file is empty");
|
|
1021
|
+
}
|
|
1022
|
+
for (UInt32 i = 0; i < formatCount; ++i) {
|
|
1023
|
+
NWindows::NCOM::CPropVariant classIdValue;
|
|
1024
|
+
if (g_getHandlerProperty(i, NArchive::NHandlerPropID::kClassID, &classIdValue) != S_OK
|
|
1025
|
+
|| classIdValue.vt != VT_BSTR
|
|
1026
|
+
|| ::SysStringByteLen(classIdValue.bstrVal) != sizeof(GUID)) {
|
|
1027
|
+
continue;
|
|
1028
|
+
}
|
|
1029
|
+
GUID classId;
|
|
1030
|
+
std::memcpy(&classId, classIdValue.bstrVal, sizeof(classId));
|
|
1031
|
+
NWindows::NCOM::CPropVariant nameValue;
|
|
1032
|
+
std::string name;
|
|
1033
|
+
if (g_getHandlerProperty(i, NArchive::NHandlerPropID::kName, &nameValue) == S_OK
|
|
1034
|
+
&& nameValue.vt == VT_BSTR) {
|
|
1035
|
+
name = ToUtf8(nameValue.bstrVal);
|
|
1036
|
+
}
|
|
1037
|
+
bool match = false;
|
|
1038
|
+
for (const auto propId : {
|
|
1039
|
+
NArchive::NHandlerPropID::kExtension,
|
|
1040
|
+
NArchive::NHandlerPropID::kAddExtension
|
|
1041
|
+
}) {
|
|
1042
|
+
NWindows::NCOM::CPropVariant extensions;
|
|
1043
|
+
if (g_getHandlerProperty(i, propId, &extensions) == S_OK
|
|
1044
|
+
&& extensions.vt == VT_BSTR && !extension.empty()) {
|
|
1045
|
+
const auto list = SplitExtensions(extensions.bstrVal);
|
|
1046
|
+
match = match || std::find(list.begin(), list.end(), extension) != list.end();
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
Func_IsArc isArchive = nullptr;
|
|
1050
|
+
const bool hasSignatureFunction = g_getIsArc(i, &isArchive) == S_OK && isArchive != nullptr;
|
|
1051
|
+
const bool signatureMatch = hasSignatureFunction
|
|
1052
|
+
&& isArchive(header.data(), header.size()) != 0;
|
|
1053
|
+
formats.push_back({i, classId, std::move(name), match, hasSignatureFunction, signatureMatch});
|
|
1054
|
+
}
|
|
1055
|
+
const bool hasSignatureMatch = std::any_of(
|
|
1056
|
+
formats.begin(), formats.end(), [](const Format& format) { return format.signatureMatch; });
|
|
1057
|
+
const bool hasExtensionMatch = std::any_of(
|
|
1058
|
+
formats.begin(), formats.end(), [](const Format& format) { return format.extensionMatch; });
|
|
1059
|
+
if (hasSignatureMatch) {
|
|
1060
|
+
formats.erase(
|
|
1061
|
+
std::remove_if(formats.begin(), formats.end(), [](const Format& format) {
|
|
1062
|
+
return !format.signatureMatch
|
|
1063
|
+
&& !(format.extensionMatch && !format.hasSignatureFunction);
|
|
1064
|
+
}),
|
|
1065
|
+
formats.end());
|
|
1066
|
+
} else if (hasExtensionMatch && std::any_of(
|
|
1067
|
+
formats.begin(), formats.end(), [](const Format& format) {
|
|
1068
|
+
return format.extensionMatch && !format.hasSignatureFunction;
|
|
1069
|
+
})) {
|
|
1070
|
+
formats.erase(
|
|
1071
|
+
std::remove_if(formats.begin(), formats.end(), [](const Format& format) {
|
|
1072
|
+
return !format.extensionMatch || format.hasSignatureFunction;
|
|
1073
|
+
}),
|
|
1074
|
+
formats.end());
|
|
1075
|
+
} else if (hasExtensionMatch) {
|
|
1076
|
+
formats.clear();
|
|
1077
|
+
}
|
|
1078
|
+
if (formats.empty()) {
|
|
1079
|
+
throw std::runtime_error("No registered 7-Zip handler recognizes this archive");
|
|
1080
|
+
}
|
|
1081
|
+
std::stable_sort(formats.begin(), formats.end(), [](const Format& left, const Format& right) {
|
|
1082
|
+
return left.extensionMatch && !right.extensionMatch;
|
|
1083
|
+
});
|
|
1084
|
+
|
|
1085
|
+
bool passwordRequested = false;
|
|
1086
|
+
HRESULT lastOpenResult = E_FAIL;
|
|
1087
|
+
UInt32 lastFormatIndex = 0;
|
|
1088
|
+
std::string lastFormatName;
|
|
1089
|
+
for (const auto& format : formats) {
|
|
1090
|
+
lastFormatIndex = format.index;
|
|
1091
|
+
lastFormatName = format.name;
|
|
1092
|
+
auto *inputFile = new FileInStream();
|
|
1093
|
+
CMyComPtr<IInStream> input = inputFile;
|
|
1094
|
+
if (!inputFile->Open(path)) {
|
|
1095
|
+
throw std::runtime_error("Unable to open archive path");
|
|
1096
|
+
}
|
|
1097
|
+
void *created = nullptr;
|
|
1098
|
+
const auto createResult = g_createObject(&format.classId, &IID_IInArchive, &created);
|
|
1099
|
+
if (createResult != S_OK || created == nullptr) {
|
|
1100
|
+
continue;
|
|
1101
|
+
}
|
|
1102
|
+
CMyComPtr<IInArchive> candidate;
|
|
1103
|
+
candidate.Attach(static_cast<IInArchive *>(created));
|
|
1104
|
+
const UInt64 maxCheckStartPosition = 0;
|
|
1105
|
+
auto *openCallbackObject = new ArchiveOpenCallback(password_);
|
|
1106
|
+
CMyComPtr<IArchiveOpenCallback> openCallback = openCallbackObject;
|
|
1107
|
+
lastOpenResult = candidate->Open(input, &maxCheckStartPosition, openCallback);
|
|
1108
|
+
if (lastOpenResult != S_OK) {
|
|
1109
|
+
passwordRequested = passwordRequested || openCallbackObject->PasswordRequested();
|
|
1110
|
+
candidate->Close();
|
|
1111
|
+
continue;
|
|
1112
|
+
}
|
|
1113
|
+
auto context = std::make_unique<ArchiveContext>();
|
|
1114
|
+
context->archive = candidate;
|
|
1115
|
+
context->stream = input;
|
|
1116
|
+
archiveClassId_ = format.classId;
|
|
1117
|
+
contexts_.push_back(std::move(context));
|
|
1118
|
+
LoadEntries(contexts_.front()->archive);
|
|
1119
|
+
fileStamp_ = GetFileStamp(path_);
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
if (passwordRequested) {
|
|
1123
|
+
throw std::runtime_error("Archive password is missing or incorrect");
|
|
1124
|
+
}
|
|
1125
|
+
throw std::runtime_error(
|
|
1126
|
+
"No 7-Zip archive handler recognized this file (format "
|
|
1127
|
+
+ lastFormatName
|
|
1128
|
+
+ " "
|
|
1129
|
+
+ std::to_string(lastFormatIndex)
|
|
1130
|
+
+ ", HRESULT "
|
|
1131
|
+
+ std::to_string(static_cast<std::uint32_t>(lastOpenResult))
|
|
1132
|
+
+ ")");
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
const std::vector<Entry>& Entries() const
|
|
1136
|
+
{
|
|
1137
|
+
return entries_;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
std::vector<std::vector<std::uint8_t>> Extract(
|
|
1141
|
+
const std::vector<std::uint32_t>& ids,
|
|
1142
|
+
bool partial,
|
|
1143
|
+
std::uint64_t offset,
|
|
1144
|
+
std::uint64_t length,
|
|
1145
|
+
OutputReservation& outputReservation)
|
|
1146
|
+
{
|
|
1147
|
+
if (contexts_.empty()) {
|
|
1148
|
+
throw std::runtime_error("Archive is closed");
|
|
1149
|
+
}
|
|
1150
|
+
std::unordered_map<std::uint32_t, std::size_t> requestById;
|
|
1151
|
+
requestById.reserve(ids.size());
|
|
1152
|
+
std::uint64_t totalRequested = 0;
|
|
1153
|
+
for (std::size_t requestIndex = 0; requestIndex < ids.size(); ++requestIndex) {
|
|
1154
|
+
const auto id = ids[requestIndex];
|
|
1155
|
+
if (id >= entries_.size()) {
|
|
1156
|
+
throw std::out_of_range("Entry ID is out of range");
|
|
1157
|
+
}
|
|
1158
|
+
const auto& entry = entries_[id];
|
|
1159
|
+
if (entry.directory) {
|
|
1160
|
+
throw std::invalid_argument("Cannot read a directory entry");
|
|
1161
|
+
}
|
|
1162
|
+
const auto start = partial ? std::min(offset, entry.size) : 0;
|
|
1163
|
+
const auto available = entry.size - start;
|
|
1164
|
+
const auto requested = partial ? std::min(length, available) : entry.size;
|
|
1165
|
+
if (!requestById.emplace(id, requestIndex).second) {
|
|
1166
|
+
throw std::invalid_argument("Duplicate entry IDs are not allowed in a batch");
|
|
1167
|
+
}
|
|
1168
|
+
if (requested > kMaxSingleOutputBytes
|
|
1169
|
+
|| requested > kMaxSingleOutputBytes - totalRequested) {
|
|
1170
|
+
throw std::length_error("Entry exceeds the in-memory output limit");
|
|
1171
|
+
}
|
|
1172
|
+
totalRequested += requested;
|
|
1173
|
+
}
|
|
1174
|
+
outputReservation.Acquire(totalRequested);
|
|
1175
|
+
std::vector<OutputRequest> requests;
|
|
1176
|
+
requests.reserve(ids.size());
|
|
1177
|
+
for (const auto id : ids) {
|
|
1178
|
+
const auto& entry = entries_[id];
|
|
1179
|
+
const auto start = partial ? std::min(offset, entry.size) : 0;
|
|
1180
|
+
const auto available = entry.size - start;
|
|
1181
|
+
const auto requested = partial ? std::min(length, available) : entry.size;
|
|
1182
|
+
OutputRequest request;
|
|
1183
|
+
request.id = id;
|
|
1184
|
+
request.offset = start;
|
|
1185
|
+
request.length = requested;
|
|
1186
|
+
request.entrySize = entry.size;
|
|
1187
|
+
request.encrypted = entry.encrypted;
|
|
1188
|
+
request.data.reserve(static_cast<std::size_t>(requested));
|
|
1189
|
+
requests.push_back(std::move(request));
|
|
1190
|
+
}
|
|
1191
|
+
std::vector<UInt32> sortedIds;
|
|
1192
|
+
sortedIds.reserve(requestById.size());
|
|
1193
|
+
for (const auto& item : requestById) {
|
|
1194
|
+
sortedIds.push_back(item.first);
|
|
1195
|
+
}
|
|
1196
|
+
if (std::all_of(requests.begin(), requests.end(), [](const OutputRequest& request) {
|
|
1197
|
+
return request.length == 0;
|
|
1198
|
+
})) {
|
|
1199
|
+
return std::vector<std::vector<std::uint8_t>>(ids.size());
|
|
1200
|
+
}
|
|
1201
|
+
std::sort(sortedIds.begin(), sortedIds.end());
|
|
1202
|
+
auto context = AcquireContext();
|
|
1203
|
+
auto *extractCallbackObject = new ExtractCallback(requests, requestById, password_);
|
|
1204
|
+
CMyComPtr<IArchiveExtractCallback> callback = extractCallbackObject;
|
|
1205
|
+
const auto result = context->archive->Extract(
|
|
1206
|
+
sortedIds.empty() ? nullptr : sortedIds.data(),
|
|
1207
|
+
static_cast<UInt32>(sortedIds.size()),
|
|
1208
|
+
0,
|
|
1209
|
+
callback);
|
|
1210
|
+
if (result != S_OK) {
|
|
1211
|
+
if (extractCallbackObject->PasswordRequested()) {
|
|
1212
|
+
throw std::runtime_error("Archive password is missing or incorrect");
|
|
1213
|
+
}
|
|
1214
|
+
throw std::runtime_error("7-Zip failed to extract the requested entries");
|
|
1215
|
+
}
|
|
1216
|
+
for (const auto& request : requests) {
|
|
1217
|
+
if (request.operationResult != NArchive::NExtract::NOperationResult::kOK) {
|
|
1218
|
+
if (request.encrypted && extractCallbackObject->PasswordRequested()) {
|
|
1219
|
+
throw std::runtime_error("Archive password is incorrect or encrypted data is invalid");
|
|
1220
|
+
}
|
|
1221
|
+
if (request.operationResult == NArchive::NExtract::NOperationResult::kWrongPassword) {
|
|
1222
|
+
throw std::runtime_error("Archive password is incorrect");
|
|
1223
|
+
}
|
|
1224
|
+
throw std::runtime_error("Entry extraction failed (unsupported method, integrity error, or password required)");
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
std::vector<std::vector<std::uint8_t>> resultData;
|
|
1228
|
+
resultData.reserve(ids.size());
|
|
1229
|
+
for (const auto id : ids) {
|
|
1230
|
+
resultData.push_back(std::move(requests[requestById.at(id)].data));
|
|
1231
|
+
}
|
|
1232
|
+
return resultData;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
void ExtractStream(std::uint32_t id, const std::shared_ptr<NativeStreamState>& stream)
|
|
1236
|
+
{
|
|
1237
|
+
if (contexts_.empty()) {
|
|
1238
|
+
throw std::runtime_error("Archive is closed");
|
|
1239
|
+
}
|
|
1240
|
+
if (id >= entries_.size()) {
|
|
1241
|
+
throw std::out_of_range("Entry ID is out of range");
|
|
1242
|
+
}
|
|
1243
|
+
if (entries_[id].directory) {
|
|
1244
|
+
throw std::invalid_argument("Cannot read a directory entry");
|
|
1245
|
+
}
|
|
1246
|
+
auto context = AcquireContext();
|
|
1247
|
+
auto *extractCallbackObject = new StreamingExtractCallback(id, stream, password_);
|
|
1248
|
+
CMyComPtr<IArchiveExtractCallback> callback = extractCallbackObject;
|
|
1249
|
+
const UInt32 itemIndex = id;
|
|
1250
|
+
const auto result = context->archive->Extract(&itemIndex, 1, 0, callback);
|
|
1251
|
+
if (result != S_OK) {
|
|
1252
|
+
if (extractCallbackObject->PasswordRequested()) {
|
|
1253
|
+
throw std::runtime_error("Archive password is missing or incorrect");
|
|
1254
|
+
}
|
|
1255
|
+
throw std::runtime_error("7-Zip failed to stream the requested entry");
|
|
1256
|
+
}
|
|
1257
|
+
if (extractCallbackObject->OperationResult() != NArchive::NExtract::NOperationResult::kOK) {
|
|
1258
|
+
if (extractCallbackObject->PasswordRequested()) {
|
|
1259
|
+
throw std::runtime_error("Archive password is incorrect or encrypted data is invalid");
|
|
1260
|
+
}
|
|
1261
|
+
if (extractCallbackObject->OperationResult()
|
|
1262
|
+
== NArchive::NExtract::NOperationResult::kWrongPassword) {
|
|
1263
|
+
throw std::runtime_error("Archive password is incorrect");
|
|
1264
|
+
}
|
|
1265
|
+
throw std::runtime_error(
|
|
1266
|
+
"Entry streaming failed (unsupported method, integrity error, or password required)");
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
private:
|
|
1271
|
+
ContextLease AcquireContext()
|
|
1272
|
+
{
|
|
1273
|
+
std::unique_lock<std::mutex> lock(contextMutex_);
|
|
1274
|
+
while (true) {
|
|
1275
|
+
for (const auto& context : contexts_) {
|
|
1276
|
+
if (!context->busy) {
|
|
1277
|
+
context->busy = true;
|
|
1278
|
+
return ContextLease(this, context.get());
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
const auto contextLimit = std::max<std::uint32_t>(
|
|
1282
|
+
1, g_extractionConcurrency.load(std::memory_order_acquire));
|
|
1283
|
+
if (contexts_.size() + contextsCreating_ < contextLimit) {
|
|
1284
|
+
++contextsCreating_;
|
|
1285
|
+
lock.unlock();
|
|
1286
|
+
std::unique_ptr<ArchiveContext> context;
|
|
1287
|
+
try {
|
|
1288
|
+
context = OpenAdditionalContext();
|
|
1289
|
+
} catch (...) {
|
|
1290
|
+
lock.lock();
|
|
1291
|
+
--contextsCreating_;
|
|
1292
|
+
contextAvailable_.notify_all();
|
|
1293
|
+
throw;
|
|
1294
|
+
}
|
|
1295
|
+
lock.lock();
|
|
1296
|
+
--contextsCreating_;
|
|
1297
|
+
context->busy = true;
|
|
1298
|
+
auto *result = context.get();
|
|
1299
|
+
contexts_.push_back(std::move(context));
|
|
1300
|
+
contextAvailable_.notify_all();
|
|
1301
|
+
return ContextLease(this, result);
|
|
1302
|
+
}
|
|
1303
|
+
contextAvailable_.wait(lock);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
void ReleaseContext(ArchiveContext *context)
|
|
1308
|
+
{
|
|
1309
|
+
{
|
|
1310
|
+
std::lock_guard<std::mutex> lock(contextMutex_);
|
|
1311
|
+
context->busy = false;
|
|
1312
|
+
}
|
|
1313
|
+
contextAvailable_.notify_one();
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
std::unique_ptr<ArchiveContext> OpenAdditionalContext()
|
|
1317
|
+
{
|
|
1318
|
+
const auto beforeOpen = GetFileStamp(path_);
|
|
1319
|
+
if (beforeOpen.size != fileStamp_.size
|
|
1320
|
+
|| beforeOpen.modified != fileStamp_.modified) {
|
|
1321
|
+
throw std::runtime_error("Archive file changed since opening; reopen it before extracting");
|
|
1322
|
+
}
|
|
1323
|
+
auto *inputFile = new FileInStream();
|
|
1324
|
+
CMyComPtr<IInStream> input = inputFile;
|
|
1325
|
+
if (!inputFile->Open(path_)) {
|
|
1326
|
+
throw std::runtime_error("Unable to reopen archive path for concurrent extraction");
|
|
1327
|
+
}
|
|
1328
|
+
void *created = nullptr;
|
|
1329
|
+
const auto createResult = g_createObject(&archiveClassId_, &IID_IInArchive, &created);
|
|
1330
|
+
if (createResult != S_OK || created == nullptr) {
|
|
1331
|
+
throw std::runtime_error("Unable to create an independent 7-Zip decoder context");
|
|
1332
|
+
}
|
|
1333
|
+
CMyComPtr<IInArchive> archive;
|
|
1334
|
+
archive.Attach(static_cast<IInArchive *>(created));
|
|
1335
|
+
const UInt64 maxCheckStartPosition = 0;
|
|
1336
|
+
auto *openCallbackObject = new ArchiveOpenCallback(password_);
|
|
1337
|
+
CMyComPtr<IArchiveOpenCallback> openCallback = openCallbackObject;
|
|
1338
|
+
const auto openResult = archive->Open(input, &maxCheckStartPosition, openCallback);
|
|
1339
|
+
if (openResult != S_OK) {
|
|
1340
|
+
const bool passwordRequested = openCallbackObject->PasswordRequested();
|
|
1341
|
+
archive->Close();
|
|
1342
|
+
if (passwordRequested) {
|
|
1343
|
+
throw std::runtime_error("Archive password is missing or incorrect");
|
|
1344
|
+
}
|
|
1345
|
+
throw std::runtime_error("Unable to open an independent 7-Zip decoder context");
|
|
1346
|
+
}
|
|
1347
|
+
const auto stamp = GetFileStamp(path_);
|
|
1348
|
+
if (stamp.size != fileStamp_.size || stamp.modified != fileStamp_.modified) {
|
|
1349
|
+
archive->Close();
|
|
1350
|
+
throw std::runtime_error("Archive file changed during concurrent extraction setup");
|
|
1351
|
+
}
|
|
1352
|
+
auto context = std::make_unique<ArchiveContext>();
|
|
1353
|
+
context->archive = archive;
|
|
1354
|
+
context->stream = input;
|
|
1355
|
+
return context;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
void LoadEntries(IInArchive *archive)
|
|
1359
|
+
{
|
|
1360
|
+
UInt32 count = 0;
|
|
1361
|
+
if (archive->GetNumberOfItems(&count) != S_OK || count > kMaxEntries) {
|
|
1362
|
+
throw std::runtime_error("Invalid or excessively large archive index");
|
|
1363
|
+
}
|
|
1364
|
+
entries_.reserve(count);
|
|
1365
|
+
for (UInt32 i = 0; i < count; ++i) {
|
|
1366
|
+
Entry entry;
|
|
1367
|
+
entry.id = i;
|
|
1368
|
+
entry.path = GetPropString(archive, i, kpidPath);
|
|
1369
|
+
std::replace(entry.path.begin(), entry.path.end(), '\\', '/');
|
|
1370
|
+
entry.size = GetPropUInt64(archive, i, kpidSize);
|
|
1371
|
+
entry.compressedSize = GetPropUInt64(archive, i, kpidPackSize);
|
|
1372
|
+
entry.attributes = static_cast<std::uint32_t>(GetPropUInt64(archive, i, kpidAttrib));
|
|
1373
|
+
entry.directory = GetPropBool(archive, i, kpidIsDir);
|
|
1374
|
+
entry.encrypted = GetPropBool(archive, i, kpidEncrypted);
|
|
1375
|
+
NWindows::NCOM::CPropVariant crc;
|
|
1376
|
+
if (archive->GetProperty(i, kpidCRC, &crc) == S_OK && crc.vt == VT_UI4) {
|
|
1377
|
+
entry.crc = crc.ulVal;
|
|
1378
|
+
entry.hasCrc = true;
|
|
1379
|
+
}
|
|
1380
|
+
entries_.push_back(std::move(entry));
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
std::mutex contextMutex_;
|
|
1385
|
+
std::condition_variable contextAvailable_;
|
|
1386
|
+
std::vector<std::unique_ptr<ArchiveContext>> contexts_;
|
|
1387
|
+
std::size_t contextsCreating_ = 0;
|
|
1388
|
+
std::string path_;
|
|
1389
|
+
GUID archiveClassId_{};
|
|
1390
|
+
FileStamp fileStamp_{};
|
|
1391
|
+
std::optional<std::string> password_;
|
|
1392
|
+
std::vector<Entry> entries_;
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
Napi::Object EntryToJs(Napi::Env env, const Entry& entry)
|
|
1396
|
+
{
|
|
1397
|
+
Napi::Object result = Napi::Object::New(env);
|
|
1398
|
+
result.Set("id", Napi::Number::New(env, entry.id));
|
|
1399
|
+
result.Set("path", Napi::String::New(env, entry.path));
|
|
1400
|
+
result.Set("size", Napi::BigInt::New(env, entry.size));
|
|
1401
|
+
result.Set("compressedSize", Napi::BigInt::New(env, entry.compressedSize));
|
|
1402
|
+
result.Set("isDirectory", Napi::Boolean::New(env, entry.directory));
|
|
1403
|
+
result.Set("encrypted", Napi::Boolean::New(env, entry.encrypted));
|
|
1404
|
+
result.Set("attributes", Napi::Number::New(env, entry.attributes));
|
|
1405
|
+
if (entry.hasCrc) {
|
|
1406
|
+
result.Set("crc", Napi::Number::New(env, entry.crc));
|
|
1407
|
+
}
|
|
1408
|
+
return result;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
Napi::Buffer<std::uint8_t> TakeBuffer(Napi::Env env, std::vector<std::uint8_t> data)
|
|
1412
|
+
{
|
|
1413
|
+
if (data.empty()) {
|
|
1414
|
+
return Napi::Buffer<std::uint8_t>::New(env, 0);
|
|
1415
|
+
}
|
|
1416
|
+
auto *owned = new std::vector<std::uint8_t>(std::move(data));
|
|
1417
|
+
return Napi::Buffer<std::uint8_t>::New(
|
|
1418
|
+
env,
|
|
1419
|
+
owned->data(),
|
|
1420
|
+
owned->size(),
|
|
1421
|
+
[](Napi::Env, std::uint8_t *, std::vector<std::uint8_t> *hint) {
|
|
1422
|
+
delete hint;
|
|
1423
|
+
},
|
|
1424
|
+
owned);
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
void StreamMessageToJs(Napi::Env env, Napi::Function callback, StreamMessage *message)
|
|
1428
|
+
{
|
|
1429
|
+
std::unique_ptr<StreamMessage> owned(message);
|
|
1430
|
+
if (env == nullptr || !callback) {
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
if (message->kind == StreamMessage::Kind::Chunk) {
|
|
1434
|
+
callback.Call({
|
|
1435
|
+
TakeBuffer(env, std::move(message->data)),
|
|
1436
|
+
env.Undefined(),
|
|
1437
|
+
Napi::Boolean::New(env, false)
|
|
1438
|
+
});
|
|
1439
|
+
} else if (message->kind == StreamMessage::Kind::Error) {
|
|
1440
|
+
callback.Call({
|
|
1441
|
+
env.Undefined(),
|
|
1442
|
+
Napi::Error::New(env, message->error).Value(),
|
|
1443
|
+
Napi::Boolean::New(env, false)
|
|
1444
|
+
});
|
|
1445
|
+
} else {
|
|
1446
|
+
callback.Call({
|
|
1447
|
+
env.Undefined(),
|
|
1448
|
+
env.Undefined(),
|
|
1449
|
+
Napi::Boolean::New(env, true)
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
class BoundedAsyncWorker : public Napi::AsyncWorker {
|
|
1455
|
+
public:
|
|
1456
|
+
BoundedAsyncWorker(Napi::Env env, Napi::Promise::Deferred deferred)
|
|
1457
|
+
: Napi::AsyncWorker(env), deferred_(deferred) {}
|
|
1458
|
+
|
|
1459
|
+
~BoundedAsyncWorker() override
|
|
1460
|
+
{
|
|
1461
|
+
g_pendingOperations.fetch_sub(1, std::memory_order_acq_rel);
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
void OnError(const Napi::Error& error) override
|
|
1465
|
+
{
|
|
1466
|
+
deferred_.Reject(error.Value());
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
protected:
|
|
1470
|
+
Napi::Promise::Deferred deferred_;
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1473
|
+
class OpenWorker final : public BoundedAsyncWorker {
|
|
1474
|
+
public:
|
|
1475
|
+
OpenWorker(
|
|
1476
|
+
Napi::Env env,
|
|
1477
|
+
Napi::Promise::Deferred deferred,
|
|
1478
|
+
std::string path,
|
|
1479
|
+
std::optional<std::string> password,
|
|
1480
|
+
std::string enginePath)
|
|
1481
|
+
: BoundedAsyncWorker(env, deferred),
|
|
1482
|
+
path_(std::move(path)),
|
|
1483
|
+
password_(std::move(password)),
|
|
1484
|
+
enginePath_(std::move(enginePath)) {}
|
|
1485
|
+
|
|
1486
|
+
~OpenWorker() override
|
|
1487
|
+
{
|
|
1488
|
+
if (password_) {
|
|
1489
|
+
SecureErase(*password_);
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
void Execute() override
|
|
1494
|
+
{
|
|
1495
|
+
try {
|
|
1496
|
+
archive_ = std::make_shared<ArchiveEngine>();
|
|
1497
|
+
archive_->Open(path_, std::move(password_), enginePath_);
|
|
1498
|
+
} catch (const std::exception& error) {
|
|
1499
|
+
SetError(error.what());
|
|
1500
|
+
} catch (...) {
|
|
1501
|
+
SetError("Unknown native archive open failure");
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
void OnOK() override
|
|
1506
|
+
{
|
|
1507
|
+
try {
|
|
1508
|
+
const auto handle = RegisterArchive(std::move(archive_));
|
|
1509
|
+
deferred_.Resolve(Napi::BigInt::New(Env(), handle));
|
|
1510
|
+
} catch (const std::exception& error) {
|
|
1511
|
+
deferred_.Reject(Napi::Error::New(Env(), error.what()).Value());
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
private:
|
|
1516
|
+
std::string path_;
|
|
1517
|
+
std::optional<std::string> password_;
|
|
1518
|
+
std::string enginePath_;
|
|
1519
|
+
std::shared_ptr<ArchiveEngine> archive_;
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
class EntriesWorker final : public BoundedAsyncWorker {
|
|
1523
|
+
public:
|
|
1524
|
+
EntriesWorker(
|
|
1525
|
+
Napi::Env env,
|
|
1526
|
+
Napi::Promise::Deferred deferred,
|
|
1527
|
+
std::shared_ptr<ArchiveEngine> archive)
|
|
1528
|
+
: BoundedAsyncWorker(env, deferred), archive_(std::move(archive)) {}
|
|
1529
|
+
|
|
1530
|
+
void Execute() override
|
|
1531
|
+
{
|
|
1532
|
+
entries_ = archive_->Entries();
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
void OnOK() override
|
|
1536
|
+
{
|
|
1537
|
+
Napi::Array result = Napi::Array::New(Env(), entries_.size());
|
|
1538
|
+
for (std::size_t i = 0; i < entries_.size(); ++i) {
|
|
1539
|
+
result.Set(i, EntryToJs(Env(), entries_[i]));
|
|
1540
|
+
}
|
|
1541
|
+
deferred_.Resolve(result);
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
private:
|
|
1545
|
+
std::shared_ptr<ArchiveEngine> archive_;
|
|
1546
|
+
std::vector<Entry> entries_;
|
|
1547
|
+
};
|
|
1548
|
+
|
|
1549
|
+
class ExtractionTask {
|
|
1550
|
+
public:
|
|
1551
|
+
virtual ~ExtractionTask() = default;
|
|
1552
|
+
virtual void Execute() noexcept = 0;
|
|
1553
|
+
virtual void Complete(Napi::Env env) = 0;
|
|
1554
|
+
};
|
|
1555
|
+
|
|
1556
|
+
class ExtractWorker final : public ExtractionTask {
|
|
1557
|
+
public:
|
|
1558
|
+
ExtractWorker(
|
|
1559
|
+
Napi::Promise::Deferred deferred,
|
|
1560
|
+
std::shared_ptr<ArchiveEngine> archive,
|
|
1561
|
+
std::vector<std::uint32_t> ids,
|
|
1562
|
+
bool partial,
|
|
1563
|
+
std::uint64_t offset,
|
|
1564
|
+
std::uint64_t length)
|
|
1565
|
+
: deferred_(deferred),
|
|
1566
|
+
archive_(std::move(archive)),
|
|
1567
|
+
ids_(std::move(ids)),
|
|
1568
|
+
partial_(partial),
|
|
1569
|
+
offset_(offset),
|
|
1570
|
+
length_(length) {}
|
|
1571
|
+
|
|
1572
|
+
~ExtractWorker() override
|
|
1573
|
+
{
|
|
1574
|
+
g_pendingOperations.fetch_sub(1, std::memory_order_acq_rel);
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
void Execute() noexcept override
|
|
1578
|
+
{
|
|
1579
|
+
try {
|
|
1580
|
+
outputs_ = archive_->Extract(ids_, partial_, offset_, length_, outputReservation_);
|
|
1581
|
+
} catch (const std::exception& error) {
|
|
1582
|
+
error_ = error.what();
|
|
1583
|
+
} catch (...) {
|
|
1584
|
+
error_ = "Unknown native extraction failure";
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
void Complete(Napi::Env env) override
|
|
1589
|
+
{
|
|
1590
|
+
try {
|
|
1591
|
+
if (!error_.empty()) {
|
|
1592
|
+
deferred_.Reject(Napi::Error::New(env, error_).Value());
|
|
1593
|
+
return;
|
|
1594
|
+
}
|
|
1595
|
+
if (partial_) {
|
|
1596
|
+
deferred_.Resolve(TakeBuffer(env, std::move(outputs_.front())));
|
|
1597
|
+
return;
|
|
1598
|
+
}
|
|
1599
|
+
Napi::Array result = Napi::Array::New(env, outputs_.size());
|
|
1600
|
+
for (std::size_t i = 0; i < outputs_.size(); ++i) {
|
|
1601
|
+
result.Set(i, TakeBuffer(env, std::move(outputs_[i])));
|
|
1602
|
+
}
|
|
1603
|
+
deferred_.Resolve(result);
|
|
1604
|
+
} catch (const Napi::Error& error) {
|
|
1605
|
+
deferred_.Reject(error.Value());
|
|
1606
|
+
} catch (const std::exception& error) {
|
|
1607
|
+
deferred_.Reject(Napi::Error::New(env, error.what()).Value());
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
private:
|
|
1612
|
+
Napi::Promise::Deferred deferred_;
|
|
1613
|
+
OutputReservation outputReservation_;
|
|
1614
|
+
std::shared_ptr<ArchiveEngine> archive_;
|
|
1615
|
+
std::vector<std::uint32_t> ids_;
|
|
1616
|
+
bool partial_;
|
|
1617
|
+
std::uint64_t offset_;
|
|
1618
|
+
std::uint64_t length_;
|
|
1619
|
+
std::vector<std::vector<std::uint8_t>> outputs_;
|
|
1620
|
+
std::string error_;
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
class StreamWorker final : public ExtractionTask {
|
|
1624
|
+
public:
|
|
1625
|
+
StreamWorker(
|
|
1626
|
+
std::shared_ptr<ArchiveEngine> archive,
|
|
1627
|
+
std::uint32_t entryId,
|
|
1628
|
+
std::shared_ptr<NativeStreamState> stream)
|
|
1629
|
+
: archive_(std::move(archive)),
|
|
1630
|
+
entryId_(entryId),
|
|
1631
|
+
stream_(std::move(stream)) {}
|
|
1632
|
+
|
|
1633
|
+
~StreamWorker() override
|
|
1634
|
+
{
|
|
1635
|
+
if (!completed_) {
|
|
1636
|
+
stream_->Cancel();
|
|
1637
|
+
RemoveStream(stream_->id);
|
|
1638
|
+
stream_->ReleaseCallback();
|
|
1639
|
+
}
|
|
1640
|
+
g_pendingOperations.fetch_sub(1, std::memory_order_acq_rel);
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
void Execute() noexcept override
|
|
1644
|
+
{
|
|
1645
|
+
try {
|
|
1646
|
+
archive_->ExtractStream(entryId_, stream_);
|
|
1647
|
+
if (!stream_->IsCancelled()) {
|
|
1648
|
+
SendMessage(StreamMessage::Kind::End, {});
|
|
1649
|
+
}
|
|
1650
|
+
} catch (const std::exception& error) {
|
|
1651
|
+
if (!stream_->IsCancelled()) {
|
|
1652
|
+
SendMessage(StreamMessage::Kind::Error, error.what());
|
|
1653
|
+
}
|
|
1654
|
+
} catch (...) {
|
|
1655
|
+
if (!stream_->IsCancelled()) {
|
|
1656
|
+
SendMessage(StreamMessage::Kind::Error, "Unknown native archive streaming failure");
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
void Complete(Napi::Env) override
|
|
1662
|
+
{
|
|
1663
|
+
completed_ = true;
|
|
1664
|
+
RemoveStream(stream_->id);
|
|
1665
|
+
stream_->ReleaseCallback();
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
private:
|
|
1669
|
+
void SendMessage(StreamMessage::Kind kind, const std::string& error) noexcept
|
|
1670
|
+
{
|
|
1671
|
+
try {
|
|
1672
|
+
auto message = std::make_unique<StreamMessage>();
|
|
1673
|
+
message->kind = kind;
|
|
1674
|
+
message->error = error;
|
|
1675
|
+
stream_->Send(std::move(message));
|
|
1676
|
+
} catch (...) {
|
|
1677
|
+
stream_->Cancel();
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
std::shared_ptr<ArchiveEngine> archive_;
|
|
1682
|
+
std::uint32_t entryId_;
|
|
1683
|
+
std::shared_ptr<NativeStreamState> stream_;
|
|
1684
|
+
bool completed_ = false;
|
|
1685
|
+
};
|
|
1686
|
+
|
|
1687
|
+
class ExtractionPool {
|
|
1688
|
+
public:
|
|
1689
|
+
void Initialize(Napi::Env env)
|
|
1690
|
+
{
|
|
1691
|
+
const auto callback = Napi::Function::New(env, [](const Napi::CallbackInfo& info) {
|
|
1692
|
+
return info.Env().Undefined();
|
|
1693
|
+
});
|
|
1694
|
+
completion_ = Napi::ThreadSafeFunction::New(
|
|
1695
|
+
env, callback, "7zip-native extraction completion", 0, 1);
|
|
1696
|
+
completion_.Unref(env);
|
|
1697
|
+
if (napi_add_env_cleanup_hook(env, Cleanup, this) != napi_ok) {
|
|
1698
|
+
completion_.Release();
|
|
1699
|
+
throw std::runtime_error("Unable to register native extraction pool cleanup");
|
|
1700
|
+
}
|
|
1701
|
+
initialized_ = true;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
~ExtractionPool()
|
|
1705
|
+
{
|
|
1706
|
+
Shutdown();
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
void SetConcurrency(std::uint32_t concurrency)
|
|
1710
|
+
{
|
|
1711
|
+
if (concurrency == 0 || concurrency > kMaxExtractionConcurrency) {
|
|
1712
|
+
throw std::out_of_range("Concurrency must be between 1 and 128");
|
|
1713
|
+
}
|
|
1714
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
1715
|
+
if (stopping_) {
|
|
1716
|
+
throw std::runtime_error("Native extraction pool is shutting down");
|
|
1717
|
+
}
|
|
1718
|
+
for (std::size_t i = threads_.size(); i < concurrency; ++i) {
|
|
1719
|
+
threads_.emplace_back([this]() {
|
|
1720
|
+
WorkerLoop();
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
concurrency_ = concurrency;
|
|
1724
|
+
g_extractionConcurrency.store(concurrency, std::memory_order_release);
|
|
1725
|
+
available_.notify_all();
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
std::uint32_t Concurrency() const
|
|
1729
|
+
{
|
|
1730
|
+
return g_extractionConcurrency.load(std::memory_order_acquire);
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
void Queue(Napi::Env env, ExtractionTask *task)
|
|
1734
|
+
{
|
|
1735
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
1736
|
+
if (stopping_ || concurrency_ == 0) {
|
|
1737
|
+
throw std::runtime_error("Native extraction pool is not available");
|
|
1738
|
+
}
|
|
1739
|
+
const bool wasIdle = pending_ == 0;
|
|
1740
|
+
if (wasIdle) {
|
|
1741
|
+
completion_.Ref(env);
|
|
1742
|
+
}
|
|
1743
|
+
try {
|
|
1744
|
+
tasks_.push_back(task);
|
|
1745
|
+
} catch (...) {
|
|
1746
|
+
if (wasIdle) {
|
|
1747
|
+
completion_.Unref(env);
|
|
1748
|
+
}
|
|
1749
|
+
throw;
|
|
1750
|
+
}
|
|
1751
|
+
++pending_;
|
|
1752
|
+
available_.notify_one();
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
void Finished(Napi::Env env)
|
|
1756
|
+
{
|
|
1757
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
1758
|
+
if (pending_ > 0 && --pending_ == 0) {
|
|
1759
|
+
completion_.Unref(env);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
private:
|
|
1764
|
+
static void Cleanup(void *data)
|
|
1765
|
+
{
|
|
1766
|
+
auto *pool = static_cast<ExtractionPool *>(data);
|
|
1767
|
+
pool->Shutdown();
|
|
1768
|
+
if (g_extractionPool == pool) {
|
|
1769
|
+
g_extractionPool = nullptr;
|
|
1770
|
+
}
|
|
1771
|
+
delete pool;
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
void Shutdown()
|
|
1775
|
+
{
|
|
1776
|
+
{
|
|
1777
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
1778
|
+
if (stopping_) {
|
|
1779
|
+
return;
|
|
1780
|
+
}
|
|
1781
|
+
stopping_ = true;
|
|
1782
|
+
}
|
|
1783
|
+
available_.notify_all();
|
|
1784
|
+
for (auto& thread : threads_) {
|
|
1785
|
+
if (thread.joinable()) {
|
|
1786
|
+
thread.join();
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
threads_.clear();
|
|
1790
|
+
if (initialized_) {
|
|
1791
|
+
completion_.Release();
|
|
1792
|
+
initialized_ = false;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
void WorkerLoop()
|
|
1797
|
+
{
|
|
1798
|
+
while (true) {
|
|
1799
|
+
ExtractionTask *task = nullptr;
|
|
1800
|
+
{
|
|
1801
|
+
std::unique_lock<std::mutex> lock(mutex_);
|
|
1802
|
+
available_.wait(lock, [this]() {
|
|
1803
|
+
return (stopping_ && tasks_.empty())
|
|
1804
|
+
|| (!tasks_.empty() && activeWorkers_ < concurrency_);
|
|
1805
|
+
});
|
|
1806
|
+
if (stopping_ && tasks_.empty()) {
|
|
1807
|
+
return;
|
|
1808
|
+
}
|
|
1809
|
+
task = tasks_.front();
|
|
1810
|
+
tasks_.pop_front();
|
|
1811
|
+
++activeWorkers_;
|
|
1812
|
+
}
|
|
1813
|
+
task->Execute();
|
|
1814
|
+
const auto status = completion_.NonBlockingCall(
|
|
1815
|
+
task,
|
|
1816
|
+
[](Napi::Env env, Napi::Function, ExtractionTask *completed) {
|
|
1817
|
+
std::unique_ptr<ExtractionTask> task(completed);
|
|
1818
|
+
task->Complete(env);
|
|
1819
|
+
if (g_extractionPool != nullptr) {
|
|
1820
|
+
g_extractionPool->Finished(env);
|
|
1821
|
+
}
|
|
1822
|
+
});
|
|
1823
|
+
if (status != napi_ok) {
|
|
1824
|
+
delete task;
|
|
1825
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
1826
|
+
if (pending_ > 0) {
|
|
1827
|
+
--pending_;
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
{
|
|
1831
|
+
std::lock_guard<std::mutex> lock(mutex_);
|
|
1832
|
+
--activeWorkers_;
|
|
1833
|
+
}
|
|
1834
|
+
available_.notify_one();
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
Napi::ThreadSafeFunction completion_;
|
|
1839
|
+
std::vector<std::thread> threads_;
|
|
1840
|
+
std::deque<ExtractionTask *> tasks_;
|
|
1841
|
+
std::mutex mutex_;
|
|
1842
|
+
std::condition_variable available_;
|
|
1843
|
+
std::uint32_t concurrency_ = 0;
|
|
1844
|
+
std::size_t activeWorkers_ = 0;
|
|
1845
|
+
std::size_t pending_ = 0;
|
|
1846
|
+
bool stopping_ = false;
|
|
1847
|
+
bool initialized_ = false;
|
|
1848
|
+
};
|
|
1849
|
+
|
|
1850
|
+
Napi::Value Open(const Napi::CallbackInfo& info)
|
|
1851
|
+
{
|
|
1852
|
+
const auto env = info.Env();
|
|
1853
|
+
if (info.Length() != 3 || !info[0].IsString()
|
|
1854
|
+
|| (!info[1].IsUndefined() && !info[1].IsString()) || !info[2].IsString()) {
|
|
1855
|
+
throw Napi::TypeError::New(env, "open(path, password?, enginePath) expects path, optional password, and engine path");
|
|
1856
|
+
}
|
|
1857
|
+
std::optional<std::string> password;
|
|
1858
|
+
if (info[1].IsString()) {
|
|
1859
|
+
password = info[1].As<Napi::String>().Utf8Value();
|
|
1860
|
+
if (password->size() > kMaxPasswordBytes) {
|
|
1861
|
+
throw Napi::RangeError::New(env, "Password exceeds the 1 MiB native password limit");
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
if (!ReserveOperation()) {
|
|
1865
|
+
throw Napi::Error::New(env, "Native operation queue is full");
|
|
1866
|
+
}
|
|
1867
|
+
Napi::Promise::Deferred deferred = Napi::Promise::Deferred::New(env);
|
|
1868
|
+
auto *worker = new OpenWorker(
|
|
1869
|
+
env,
|
|
1870
|
+
deferred,
|
|
1871
|
+
info[0].As<Napi::String>().Utf8Value(),
|
|
1872
|
+
std::move(password),
|
|
1873
|
+
info[2].As<Napi::String>().Utf8Value());
|
|
1874
|
+
worker->Queue();
|
|
1875
|
+
return deferred.Promise();
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
Napi::Value Entries(const Napi::CallbackInfo& info)
|
|
1879
|
+
{
|
|
1880
|
+
const auto env = info.Env();
|
|
1881
|
+
if (info.Length() != 1) {
|
|
1882
|
+
throw Napi::TypeError::New(env, "entries(handle) expects an archive handle");
|
|
1883
|
+
}
|
|
1884
|
+
const auto handle = GetHandle(info[0]);
|
|
1885
|
+
auto archive = FindArchive(handle);
|
|
1886
|
+
if (!archive) {
|
|
1887
|
+
throw Napi::Error::New(env, "Archive is closed");
|
|
1888
|
+
}
|
|
1889
|
+
if (!ReserveOperation()) {
|
|
1890
|
+
throw Napi::Error::New(env, "Native operation queue is full");
|
|
1891
|
+
}
|
|
1892
|
+
auto deferred = Napi::Promise::Deferred::New(env);
|
|
1893
|
+
(new EntriesWorker(env, deferred, std::move(archive)))->Queue();
|
|
1894
|
+
return deferred.Promise();
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
Napi::Value QueueExtraction(
|
|
1898
|
+
Napi::Env env,
|
|
1899
|
+
Napi::Promise::Deferred deferred,
|
|
1900
|
+
std::shared_ptr<ArchiveEngine> archive,
|
|
1901
|
+
std::vector<std::uint32_t> ids,
|
|
1902
|
+
bool partial,
|
|
1903
|
+
std::uint64_t offset,
|
|
1904
|
+
std::uint64_t length)
|
|
1905
|
+
{
|
|
1906
|
+
if (!ReserveOperation()) {
|
|
1907
|
+
throw Napi::Error::New(env, "Native operation queue is full");
|
|
1908
|
+
}
|
|
1909
|
+
ExtractWorker *worker = nullptr;
|
|
1910
|
+
try {
|
|
1911
|
+
if (g_extractionPool == nullptr) {
|
|
1912
|
+
throw std::runtime_error("Native extraction pool is not initialized");
|
|
1913
|
+
}
|
|
1914
|
+
worker = new ExtractWorker(
|
|
1915
|
+
deferred, std::move(archive), std::move(ids), partial, offset, length);
|
|
1916
|
+
g_extractionPool->Queue(env, worker);
|
|
1917
|
+
} catch (const std::exception& error) {
|
|
1918
|
+
if (worker != nullptr) {
|
|
1919
|
+
delete worker;
|
|
1920
|
+
} else {
|
|
1921
|
+
g_pendingOperations.fetch_sub(1, std::memory_order_acq_rel);
|
|
1922
|
+
}
|
|
1923
|
+
throw Napi::Error::New(env, error.what());
|
|
1924
|
+
} catch (...) {
|
|
1925
|
+
if (worker != nullptr) {
|
|
1926
|
+
delete worker;
|
|
1927
|
+
} else {
|
|
1928
|
+
g_pendingOperations.fetch_sub(1, std::memory_order_acq_rel);
|
|
1929
|
+
}
|
|
1930
|
+
throw Napi::Error::New(env, "Unable to queue native extraction");
|
|
1931
|
+
}
|
|
1932
|
+
return deferred.Promise();
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
Napi::Value Extract(const Napi::CallbackInfo& info)
|
|
1936
|
+
{
|
|
1937
|
+
const auto env = info.Env();
|
|
1938
|
+
if (info.Length() != 2 || !info[1].IsArray()) {
|
|
1939
|
+
throw Napi::TypeError::New(env, "extract(handle, ids) expects an array of entry IDs");
|
|
1940
|
+
}
|
|
1941
|
+
const auto handle = GetHandle(info[0]);
|
|
1942
|
+
auto archive = FindArchive(handle);
|
|
1943
|
+
if (!archive) {
|
|
1944
|
+
throw Napi::Error::New(env, "Archive is closed");
|
|
1945
|
+
}
|
|
1946
|
+
std::vector<std::uint32_t> ids;
|
|
1947
|
+
const auto inputIds = info[1].As<Napi::Array>();
|
|
1948
|
+
ids.reserve(inputIds.Length());
|
|
1949
|
+
for (std::uint32_t i = 0; i < inputIds.Length(); ++i) {
|
|
1950
|
+
std::uint64_t id = 0;
|
|
1951
|
+
if (!ReadUnsigned(inputIds.Get(i), id) || id > std::numeric_limits<std::uint32_t>::max()) {
|
|
1952
|
+
throw Napi::TypeError::New(env, "Entry IDs must be non-negative 32-bit integers");
|
|
1953
|
+
}
|
|
1954
|
+
ids.push_back(static_cast<std::uint32_t>(id));
|
|
1955
|
+
}
|
|
1956
|
+
auto deferred = Napi::Promise::Deferred::New(env);
|
|
1957
|
+
return QueueExtraction(
|
|
1958
|
+
env, deferred, std::move(archive), std::move(ids), false, 0, 0);
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
Napi::Value StartStream(const Napi::CallbackInfo& info)
|
|
1962
|
+
{
|
|
1963
|
+
const auto env = info.Env();
|
|
1964
|
+
if (info.Length() != 3 || !info[2].IsFunction()) {
|
|
1965
|
+
throw Napi::TypeError::New(
|
|
1966
|
+
env, "startStream(handle, id, callback) expects an archive handle, entry ID, and callback");
|
|
1967
|
+
}
|
|
1968
|
+
const auto handle = GetHandle(info[0]);
|
|
1969
|
+
auto archive = FindArchive(handle);
|
|
1970
|
+
if (!archive) {
|
|
1971
|
+
throw Napi::Error::New(env, "Archive is closed");
|
|
1972
|
+
}
|
|
1973
|
+
std::uint64_t entryId = 0;
|
|
1974
|
+
if (!ReadUnsigned(info[1], entryId) || entryId > std::numeric_limits<std::uint32_t>::max()) {
|
|
1975
|
+
throw Napi::TypeError::New(env, "Entry ID must be a non-negative 32-bit integer");
|
|
1976
|
+
}
|
|
1977
|
+
if (g_extractionPool == nullptr) {
|
|
1978
|
+
throw Napi::Error::New(env, "Native extraction pool is not initialized");
|
|
1979
|
+
}
|
|
1980
|
+
if (!ReserveOperation()) {
|
|
1981
|
+
throw Napi::Error::New(env, "Native operation queue is full");
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
std::shared_ptr<NativeStreamState> stream;
|
|
1985
|
+
StreamWorker *worker = nullptr;
|
|
1986
|
+
std::uint64_t streamId = 0;
|
|
1987
|
+
bool callbackCreated = false;
|
|
1988
|
+
try {
|
|
1989
|
+
stream = std::make_shared<NativeStreamState>();
|
|
1990
|
+
stream->callback = Napi::ThreadSafeFunction::New(
|
|
1991
|
+
env,
|
|
1992
|
+
info[2].As<Napi::Function>(),
|
|
1993
|
+
"7zip-native archive entry stream",
|
|
1994
|
+
1,
|
|
1995
|
+
1);
|
|
1996
|
+
callbackCreated = true;
|
|
1997
|
+
streamId = RegisterStream(stream);
|
|
1998
|
+
const auto result = Napi::BigInt::New(env, streamId);
|
|
1999
|
+
worker = new StreamWorker(
|
|
2000
|
+
std::move(archive),
|
|
2001
|
+
static_cast<std::uint32_t>(entryId),
|
|
2002
|
+
stream);
|
|
2003
|
+
g_extractionPool->Queue(env, worker);
|
|
2004
|
+
worker = nullptr;
|
|
2005
|
+
return result;
|
|
2006
|
+
} catch (...) {
|
|
2007
|
+
if (worker != nullptr) {
|
|
2008
|
+
delete worker;
|
|
2009
|
+
} else {
|
|
2010
|
+
if (streamId != 0) {
|
|
2011
|
+
RemoveStream(streamId);
|
|
2012
|
+
}
|
|
2013
|
+
if (stream) {
|
|
2014
|
+
stream->Cancel();
|
|
2015
|
+
if (callbackCreated) {
|
|
2016
|
+
stream->ReleaseCallback();
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
g_pendingOperations.fetch_sub(1, std::memory_order_acq_rel);
|
|
2020
|
+
}
|
|
2021
|
+
throw;
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
Napi::Value ResumeStream(const Napi::CallbackInfo& info)
|
|
2026
|
+
{
|
|
2027
|
+
const auto env = info.Env();
|
|
2028
|
+
std::uint64_t streamId = 0;
|
|
2029
|
+
if (info.Length() != 1 || !ReadUnsigned(info[0], streamId) || streamId == 0) {
|
|
2030
|
+
throw Napi::TypeError::New(env, "resumeStream(streamId) expects a positive stream ID");
|
|
2031
|
+
}
|
|
2032
|
+
if (const auto stream = FindStream(streamId)) {
|
|
2033
|
+
stream->Resume();
|
|
2034
|
+
}
|
|
2035
|
+
return env.Undefined();
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
Napi::Value CancelStream(const Napi::CallbackInfo& info)
|
|
2039
|
+
{
|
|
2040
|
+
const auto env = info.Env();
|
|
2041
|
+
std::uint64_t streamId = 0;
|
|
2042
|
+
if (info.Length() != 1 || !ReadUnsigned(info[0], streamId) || streamId == 0) {
|
|
2043
|
+
throw Napi::TypeError::New(env, "cancelStream(streamId) expects a positive stream ID");
|
|
2044
|
+
}
|
|
2045
|
+
if (const auto stream = FindStream(streamId)) {
|
|
2046
|
+
stream->Cancel();
|
|
2047
|
+
}
|
|
2048
|
+
return env.Undefined();
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
Napi::Value Read(const Napi::CallbackInfo& info)
|
|
2052
|
+
{
|
|
2053
|
+
const auto env = info.Env();
|
|
2054
|
+
if (info.Length() != 4) {
|
|
2055
|
+
throw Napi::TypeError::New(env, "read(handle, id, offset, length) expects four arguments");
|
|
2056
|
+
}
|
|
2057
|
+
const auto handle = GetHandle(info[0]);
|
|
2058
|
+
auto archive = FindArchive(handle);
|
|
2059
|
+
if (!archive) {
|
|
2060
|
+
throw Napi::Error::New(env, "Archive is closed");
|
|
2061
|
+
}
|
|
2062
|
+
std::uint64_t id = 0;
|
|
2063
|
+
std::uint64_t offset = 0;
|
|
2064
|
+
std::uint64_t length = 0;
|
|
2065
|
+
if (!ReadUnsigned(info[1], id) || id > std::numeric_limits<std::uint32_t>::max()
|
|
2066
|
+
|| !ReadUnsigned(info[2], offset) || !ReadUnsigned(info[3], length)) {
|
|
2067
|
+
throw Napi::TypeError::New(env, "Entry ID, offset, and length must be non-negative safe integers or bigints");
|
|
2068
|
+
}
|
|
2069
|
+
if (length > kMaxReadBytes || offset > std::numeric_limits<std::uint64_t>::max() - length) {
|
|
2070
|
+
throw Napi::RangeError::New(env, "Requested range exceeds the native read limit");
|
|
2071
|
+
}
|
|
2072
|
+
auto deferred = Napi::Promise::Deferred::New(env);
|
|
2073
|
+
return QueueExtraction(
|
|
2074
|
+
env,
|
|
2075
|
+
deferred,
|
|
2076
|
+
std::move(archive),
|
|
2077
|
+
{static_cast<std::uint32_t>(id)},
|
|
2078
|
+
true,
|
|
2079
|
+
offset,
|
|
2080
|
+
length);
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
Napi::Value Concurrency(const Napi::CallbackInfo& info)
|
|
2084
|
+
{
|
|
2085
|
+
const auto env = info.Env();
|
|
2086
|
+
if (info.Length() > 1) {
|
|
2087
|
+
throw Napi::TypeError::New(env, "concurrency() accepts at most one integer");
|
|
2088
|
+
}
|
|
2089
|
+
if (g_extractionPool == nullptr) {
|
|
2090
|
+
throw Napi::Error::New(env, "Native extraction pool is not initialized");
|
|
2091
|
+
}
|
|
2092
|
+
if (info.Length() == 0) {
|
|
2093
|
+
return Napi::Number::New(env, g_extractionPool->Concurrency());
|
|
2094
|
+
}
|
|
2095
|
+
if (!info[0].IsNumber()) {
|
|
2096
|
+
throw Napi::TypeError::New(env, "Concurrency must be a positive integer");
|
|
2097
|
+
}
|
|
2098
|
+
const double value = info[0].As<Napi::Number>().DoubleValue();
|
|
2099
|
+
if (!std::isfinite(value) || std::floor(value) != value
|
|
2100
|
+
|| value < 1 || value > kMaxExtractionConcurrency) {
|
|
2101
|
+
throw Napi::RangeError::New(env, "Concurrency must be between 1 and 128");
|
|
2102
|
+
}
|
|
2103
|
+
try {
|
|
2104
|
+
g_extractionPool->SetConcurrency(static_cast<std::uint32_t>(value));
|
|
2105
|
+
} catch (const std::exception& error) {
|
|
2106
|
+
throw Napi::Error::New(env, error.what());
|
|
2107
|
+
}
|
|
2108
|
+
return Napi::Number::New(env, value);
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
Napi::Value Close(const Napi::CallbackInfo& info)
|
|
2112
|
+
{
|
|
2113
|
+
const auto env = info.Env();
|
|
2114
|
+
if (info.Length() != 1) {
|
|
2115
|
+
throw Napi::TypeError::New(env, "close(handle) expects an archive handle");
|
|
2116
|
+
}
|
|
2117
|
+
const auto handle = GetHandle(info[0]);
|
|
2118
|
+
{
|
|
2119
|
+
std::lock_guard<std::mutex> lock(g_handlesMutex);
|
|
2120
|
+
if (g_handles.erase(handle) == 0) {
|
|
2121
|
+
throw Napi::Error::New(env, "Archive is already closed");
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
return env.Undefined();
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
Napi::Object Init(Napi::Env env, Napi::Object exports)
|
|
2128
|
+
{
|
|
2129
|
+
if (g_extractionPool != nullptr) {
|
|
2130
|
+
throw Napi::Error::New(env, "The native extraction pool is already initialized");
|
|
2131
|
+
}
|
|
2132
|
+
g_extractionPool = new ExtractionPool();
|
|
2133
|
+
try {
|
|
2134
|
+
g_extractionPool->Initialize(env);
|
|
2135
|
+
} catch (...) {
|
|
2136
|
+
delete g_extractionPool;
|
|
2137
|
+
g_extractionPool = nullptr;
|
|
2138
|
+
throw;
|
|
2139
|
+
}
|
|
2140
|
+
exports.Set("open", Napi::Function::New(env, Open));
|
|
2141
|
+
exports.Set("entries", Napi::Function::New(env, Entries));
|
|
2142
|
+
exports.Set("extract", Napi::Function::New(env, Extract));
|
|
2143
|
+
exports.Set("startStream", Napi::Function::New(env, StartStream));
|
|
2144
|
+
exports.Set("resumeStream", Napi::Function::New(env, ResumeStream));
|
|
2145
|
+
exports.Set("cancelStream", Napi::Function::New(env, CancelStream));
|
|
2146
|
+
exports.Set("read", Napi::Function::New(env, Read));
|
|
2147
|
+
exports.Set("concurrency", Napi::Function::New(env, Concurrency));
|
|
2148
|
+
exports.Set("close", Napi::Function::New(env, Close));
|
|
2149
|
+
return exports;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
} // namespace
|
|
2153
|
+
|
|
2154
|
+
NODE_API_MODULE(7zip_native, Init)
|