7zip-native 0.0.0-stage → 0.0.5
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 +293 -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 +528 -0
- package/dist/index.d.cts +63 -0
- package/dist/index.d.mts +63 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.mjs +524 -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/darwin-arm64/7zip_native.node +0 -0
- package/prebuilds/darwin-arm64/lib7z.dylib +0 -0
- package/prebuilds/darwin-x64/7zip_native.node +0 -0
- package/prebuilds/darwin-x64/lib7z.dylib +0 -0
- package/prebuilds/linux-arm/7z.so +0 -0
- package/prebuilds/linux-arm/7zip_native.node +0 -0
- package/prebuilds/linux-arm64/7z.so +0 -0
- package/prebuilds/linux-arm64/7zip_native.node +0 -0
- package/prebuilds/linux-ia32/7z.so +0 -0
- package/prebuilds/linux-ia32/7zip_native.node +0 -0
- package/prebuilds/linux-x64/7z.so +0 -0
- package/prebuilds/linux-x64/7zip_native.node +0 -0
- package/prebuilds/win32-arm64/7z.dll +0 -0
- package/prebuilds/win32-arm64/7zip_native.node +0 -0
- package/prebuilds/win32-x64/7z.dll +0 -0
- package/prebuilds/win32-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
|
@@ -0,0 +1,3427 @@
|
|
|
1
|
+
// PeHandler.cpp
|
|
2
|
+
|
|
3
|
+
#include "StdAfx.h"
|
|
4
|
+
|
|
5
|
+
// #include <stdio.h>
|
|
6
|
+
|
|
7
|
+
#include "../../../C/CpuArch.h"
|
|
8
|
+
|
|
9
|
+
#include "../../Common/DynamicBuffer.h"
|
|
10
|
+
#include "../../Common/ComTry.h"
|
|
11
|
+
#include "../../Common/IntToString.h"
|
|
12
|
+
#include "../../Common/StringConvert.h"
|
|
13
|
+
|
|
14
|
+
#include "../../Windows/PropVariantUtils.h"
|
|
15
|
+
#include "../../Windows/TimeUtils.h"
|
|
16
|
+
|
|
17
|
+
#include "../Common/LimitedStreams.h"
|
|
18
|
+
#include "../Common/ProgressUtils.h"
|
|
19
|
+
#include "../Common/RegisterArc.h"
|
|
20
|
+
#include "../Common/StreamObjects.h"
|
|
21
|
+
#include "../Common/StreamUtils.h"
|
|
22
|
+
|
|
23
|
+
#include "../Compress/CopyCoder.h"
|
|
24
|
+
|
|
25
|
+
#define Get16(p) GetUi16(p)
|
|
26
|
+
#define Get32(p) GetUi32(p)
|
|
27
|
+
#define Get64(p) GetUi64(p)
|
|
28
|
+
|
|
29
|
+
#define G16(offs, v) v = Get16(p + (offs))
|
|
30
|
+
#define G32(offs, v) v = Get32(p + (offs))
|
|
31
|
+
#define G32_signed(offs, v) v = (Int32)Get32(p + (offs))
|
|
32
|
+
#define G64(offs, v) v = Get64(p + (offs))
|
|
33
|
+
|
|
34
|
+
#define RINOZ(x) { int _tt_ = (x); if (_tt_ != 0) return _tt_; }
|
|
35
|
+
|
|
36
|
+
using namespace NWindows;
|
|
37
|
+
|
|
38
|
+
namespace NArchive {
|
|
39
|
+
namespace NPe {
|
|
40
|
+
|
|
41
|
+
static const UInt32 k_Signature32 = 0x00004550;
|
|
42
|
+
|
|
43
|
+
static HRESULT CalcCheckSum(ISequentialInStream *stream, UInt32 size, UInt32 excludePos, UInt32 &res)
|
|
44
|
+
{
|
|
45
|
+
const UInt32 kBufSizeMax = (UInt32)1 << 15;
|
|
46
|
+
UInt32 bufSize = kBufSizeMax;
|
|
47
|
+
CByteBuffer buffer(bufSize);
|
|
48
|
+
Byte *buf = buffer;
|
|
49
|
+
UInt32 sum = 0;
|
|
50
|
+
UInt32 pos = 0;
|
|
51
|
+
for (;;)
|
|
52
|
+
{
|
|
53
|
+
UInt32 rem = size - pos;
|
|
54
|
+
if (rem > bufSize)
|
|
55
|
+
rem = bufSize;
|
|
56
|
+
if (rem == 0)
|
|
57
|
+
break;
|
|
58
|
+
size_t processed = rem;
|
|
59
|
+
RINOK(ReadStream(stream, buf, &processed))
|
|
60
|
+
|
|
61
|
+
for (unsigned j = 0; j < 4; j++)
|
|
62
|
+
{
|
|
63
|
+
UInt32 e = excludePos + j;
|
|
64
|
+
if (pos <= e)
|
|
65
|
+
{
|
|
66
|
+
e -= pos;
|
|
67
|
+
if (e < processed)
|
|
68
|
+
buf[e] = 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const unsigned kStep = (1 << 4);
|
|
73
|
+
{
|
|
74
|
+
for (size_t i = processed; (i & (kStep - 1)) != 0; i++)
|
|
75
|
+
buf[i] = 0;
|
|
76
|
+
}
|
|
77
|
+
{
|
|
78
|
+
const Byte *buf2 = buf;
|
|
79
|
+
const Byte *bufLimit = buf + processed;
|
|
80
|
+
UInt64 sum2 = 0;
|
|
81
|
+
for (; buf2 < bufLimit; buf2 += kStep)
|
|
82
|
+
{
|
|
83
|
+
UInt64 sum3 = (UInt64)Get32(buf2)
|
|
84
|
+
+ Get32(buf2 + 4)
|
|
85
|
+
+ Get32(buf2 + 8)
|
|
86
|
+
+ Get32(buf2 + 12);
|
|
87
|
+
sum2 += sum3;
|
|
88
|
+
}
|
|
89
|
+
sum2 = (UInt32)(sum2) + (UInt64)(sum2 >> 32);
|
|
90
|
+
UInt32 sum3 = ((UInt32)sum2 + (UInt32)(sum2 >> 32));
|
|
91
|
+
sum += (sum3 & 0xFFFF) + (sum3 >> 16);
|
|
92
|
+
sum = (sum & 0xFFFF) + (sum >> 16);
|
|
93
|
+
sum = (sum & 0xFFFF) + (sum >> 16);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
pos += (UInt32)processed;
|
|
97
|
+
if (rem != processed)
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
res = sum + pos;
|
|
101
|
+
return S_OK;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
struct CVersion
|
|
106
|
+
{
|
|
107
|
+
UInt16 Major;
|
|
108
|
+
UInt16 Minor;
|
|
109
|
+
|
|
110
|
+
void Parse(const Byte *p)
|
|
111
|
+
{
|
|
112
|
+
G16(0, Major);
|
|
113
|
+
G16(2, Minor);
|
|
114
|
+
}
|
|
115
|
+
void ToProp(NCOM::CPropVariant &prop);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
void CVersion::ToProp(NCOM::CPropVariant &prop)
|
|
119
|
+
{
|
|
120
|
+
char sz[32];
|
|
121
|
+
ConvertUInt32ToString(Major, sz);
|
|
122
|
+
unsigned len = MyStringLen(sz);
|
|
123
|
+
sz[len] = '.';
|
|
124
|
+
ConvertUInt32ToString(Minor, sz + len + 1);
|
|
125
|
+
prop = sz;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
static const unsigned kCoffHeaderSize = 20;
|
|
129
|
+
static const unsigned kPeHeaderSize = 4 + kCoffHeaderSize;
|
|
130
|
+
static const unsigned k_OptHeader32_Size_MIN = 96;
|
|
131
|
+
static const unsigned k_OptHeader64_Size_MIN = 112;
|
|
132
|
+
|
|
133
|
+
static const UInt32 PE_IMAGE_FILE_DLL = (1 << 13);
|
|
134
|
+
|
|
135
|
+
struct CHeader
|
|
136
|
+
{
|
|
137
|
+
UInt16 Machine;
|
|
138
|
+
UInt16 NumSections;
|
|
139
|
+
UInt32 Time;
|
|
140
|
+
UInt32 PointerToSymbolTable;
|
|
141
|
+
UInt32 NumSymbols;
|
|
142
|
+
UInt16 OptHeaderSize;
|
|
143
|
+
UInt16 Flags;
|
|
144
|
+
|
|
145
|
+
void ParseBase(const Byte *p);
|
|
146
|
+
bool ParseCoff(const Byte *p);
|
|
147
|
+
bool ParsePe(const Byte *p);
|
|
148
|
+
bool IsDll() const { return (Flags & PE_IMAGE_FILE_DLL) != 0; }
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
void CHeader::ParseBase(const Byte *p)
|
|
152
|
+
{
|
|
153
|
+
G16( 0, Machine);
|
|
154
|
+
G16( 2, NumSections);
|
|
155
|
+
G32( 4, Time);
|
|
156
|
+
G32( 8, PointerToSymbolTable);
|
|
157
|
+
G32(12, NumSymbols);
|
|
158
|
+
G16(16, OptHeaderSize);
|
|
159
|
+
G16(18, Flags);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
bool CHeader::ParsePe(const Byte *p)
|
|
163
|
+
{
|
|
164
|
+
if (Get32(p) != k_Signature32)
|
|
165
|
+
return false;
|
|
166
|
+
ParseBase(p + 4);
|
|
167
|
+
return OptHeaderSize >= k_OptHeader32_Size_MIN;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
struct CDirLink
|
|
171
|
+
{
|
|
172
|
+
UInt32 Va;
|
|
173
|
+
UInt32 Size;
|
|
174
|
+
|
|
175
|
+
CDirLink(): Va(0), Size(0) {}
|
|
176
|
+
void Parse(const Byte *p)
|
|
177
|
+
{
|
|
178
|
+
G32(0, Va);
|
|
179
|
+
G32(4, Size);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
// IMAGE_DIRECTORY_ENTRY_*
|
|
185
|
+
static const char * const g_Dir_Names[] =
|
|
186
|
+
{
|
|
187
|
+
"EXPORT"
|
|
188
|
+
, "IMPORT"
|
|
189
|
+
, "RESOURCE"
|
|
190
|
+
, "EXCEPTION"
|
|
191
|
+
, "SECURITY"
|
|
192
|
+
, "BASERELOC"
|
|
193
|
+
, "DEBUG"
|
|
194
|
+
, "ARCHITECTURE" // "COPYRIGHT"
|
|
195
|
+
, "GLOBALPTR"
|
|
196
|
+
, "TLS"
|
|
197
|
+
, "LOAD_CONFIG"
|
|
198
|
+
, "BOUND_IMPORT"
|
|
199
|
+
, "IAT"
|
|
200
|
+
, "DELAY_IMPORT"
|
|
201
|
+
, "COM_DESCRIPTOR"
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
enum
|
|
205
|
+
{
|
|
206
|
+
kDirLink_EXCEPTION = 3,
|
|
207
|
+
kDirLink_Certificate = 4,
|
|
208
|
+
kDirLink_BASERELOC = 5,
|
|
209
|
+
kDirLink_Debug = 6
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
static const UInt32 kNumDirItemsMax = 16;
|
|
213
|
+
|
|
214
|
+
struct CDebugEntry
|
|
215
|
+
{
|
|
216
|
+
UInt32 Flags;
|
|
217
|
+
UInt32 Time;
|
|
218
|
+
CVersion Ver;
|
|
219
|
+
UInt32 Type;
|
|
220
|
+
UInt32 Size;
|
|
221
|
+
UInt32 Va;
|
|
222
|
+
UInt32 Pa;
|
|
223
|
+
|
|
224
|
+
void Parse(const Byte *p)
|
|
225
|
+
{
|
|
226
|
+
G32(0, Flags);
|
|
227
|
+
G32(4, Time);
|
|
228
|
+
Ver.Parse(p + 8);
|
|
229
|
+
G32(12, Type);
|
|
230
|
+
G32(16, Size);
|
|
231
|
+
G32(20, Va);
|
|
232
|
+
G32(24, Pa);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
static const UInt32 k_CheckSum_Field_Offset = 64;
|
|
237
|
+
|
|
238
|
+
static const UInt32 PE_OptHeader_Magic_32 = 0x10B;
|
|
239
|
+
static const UInt32 PE_OptHeader_Magic_64 = 0x20B;
|
|
240
|
+
|
|
241
|
+
static const UInt32 k_SubSystems_EFI_First = 10;
|
|
242
|
+
static const UInt32 k_SubSystems_EFI_Last = 13;
|
|
243
|
+
|
|
244
|
+
struct COptHeader
|
|
245
|
+
{
|
|
246
|
+
UInt16 Magic;
|
|
247
|
+
Byte LinkerVerMajor;
|
|
248
|
+
Byte LinkerVerMinor;
|
|
249
|
+
|
|
250
|
+
UInt32 CodeSize;
|
|
251
|
+
UInt32 InitDataSize;
|
|
252
|
+
UInt32 UninitDataSize;
|
|
253
|
+
|
|
254
|
+
// UInt32 AddressOfEntryPoint;
|
|
255
|
+
// UInt32 BaseOfCode; // VA(.text) == 0x1000 in most cases
|
|
256
|
+
// UInt32 BaseOfData32;
|
|
257
|
+
UInt64 ImageBase;
|
|
258
|
+
|
|
259
|
+
UInt32 SectAlign;
|
|
260
|
+
UInt32 FileAlign;
|
|
261
|
+
|
|
262
|
+
CVersion OsVer;
|
|
263
|
+
CVersion ImageVer;
|
|
264
|
+
CVersion SubsysVer;
|
|
265
|
+
|
|
266
|
+
UInt32 ImageSize;
|
|
267
|
+
UInt32 HeadersSize;
|
|
268
|
+
UInt32 CheckSum;
|
|
269
|
+
UInt16 SubSystem;
|
|
270
|
+
UInt16 DllCharacts;
|
|
271
|
+
|
|
272
|
+
UInt64 StackReserve;
|
|
273
|
+
UInt64 StackCommit;
|
|
274
|
+
UInt64 HeapReserve;
|
|
275
|
+
UInt64 HeapCommit;
|
|
276
|
+
|
|
277
|
+
UInt32 NumDirItems;
|
|
278
|
+
CDirLink DirItems[kNumDirItemsMax];
|
|
279
|
+
|
|
280
|
+
bool Is64Bit() const { return Magic == PE_OptHeader_Magic_64; }
|
|
281
|
+
bool Parse(const Byte *p, UInt32 size);
|
|
282
|
+
|
|
283
|
+
int GetNumFileAlignBits() const
|
|
284
|
+
{
|
|
285
|
+
for (unsigned i = 0; i < 32; i++)
|
|
286
|
+
if (((UInt32)1 << i) == FileAlign)
|
|
287
|
+
return (int)i;
|
|
288
|
+
return -1;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
bool IsSybSystem_EFI() const
|
|
292
|
+
{
|
|
293
|
+
return
|
|
294
|
+
SubSystem >= k_SubSystems_EFI_First &&
|
|
295
|
+
SubSystem <= k_SubSystems_EFI_Last;
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// size is 16-bit
|
|
300
|
+
bool COptHeader::Parse(const Byte *p, UInt32 size)
|
|
301
|
+
{
|
|
302
|
+
if (size < k_OptHeader32_Size_MIN)
|
|
303
|
+
return false;
|
|
304
|
+
Magic = Get16(p);
|
|
305
|
+
switch (Magic)
|
|
306
|
+
{
|
|
307
|
+
case PE_OptHeader_Magic_32:
|
|
308
|
+
case PE_OptHeader_Magic_64:
|
|
309
|
+
break;
|
|
310
|
+
default:
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
LinkerVerMajor = p[2];
|
|
314
|
+
LinkerVerMinor = p[3];
|
|
315
|
+
|
|
316
|
+
G32( 4, CodeSize);
|
|
317
|
+
G32( 8, InitDataSize);
|
|
318
|
+
G32(12, UninitDataSize);
|
|
319
|
+
// G32(16, AddressOfEntryPoint);
|
|
320
|
+
// G32(20, BaseOfCode);
|
|
321
|
+
|
|
322
|
+
G32(32, SectAlign);
|
|
323
|
+
G32(36, FileAlign);
|
|
324
|
+
|
|
325
|
+
OsVer.Parse(p + 40);
|
|
326
|
+
ImageVer.Parse(p + 44);
|
|
327
|
+
SubsysVer.Parse(p + 48);
|
|
328
|
+
|
|
329
|
+
// reserved = Get32(p + 52);
|
|
330
|
+
|
|
331
|
+
G32(56, ImageSize);
|
|
332
|
+
G32(60, HeadersSize);
|
|
333
|
+
G32(64, CheckSum);
|
|
334
|
+
G16(68, SubSystem);
|
|
335
|
+
G16(70, DllCharacts);
|
|
336
|
+
|
|
337
|
+
UInt32 pos;
|
|
338
|
+
if (Is64Bit())
|
|
339
|
+
{
|
|
340
|
+
if (size < k_OptHeader64_Size_MIN)
|
|
341
|
+
return false;
|
|
342
|
+
// BaseOfData32 = 0;
|
|
343
|
+
G64(24, ImageBase);
|
|
344
|
+
G64(72, StackReserve);
|
|
345
|
+
G64(80, StackCommit);
|
|
346
|
+
G64(88, HeapReserve);
|
|
347
|
+
G64(96, HeapCommit);
|
|
348
|
+
pos = 108;
|
|
349
|
+
}
|
|
350
|
+
else
|
|
351
|
+
{
|
|
352
|
+
// G32(24, BaseOfData32);
|
|
353
|
+
G32(28, ImageBase);
|
|
354
|
+
G32(72, StackReserve);
|
|
355
|
+
G32(76, StackCommit);
|
|
356
|
+
G32(80, HeapReserve);
|
|
357
|
+
G32(84, HeapCommit);
|
|
358
|
+
pos = 92;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
UInt32 numDirItems;
|
|
362
|
+
G32(pos, numDirItems);
|
|
363
|
+
NumDirItems = numDirItems;
|
|
364
|
+
if (numDirItems > (1 << 13))
|
|
365
|
+
return false;
|
|
366
|
+
pos += 4;
|
|
367
|
+
if (pos + 8 * numDirItems > size)
|
|
368
|
+
return false;
|
|
369
|
+
memset((void *)DirItems, 0, sizeof(DirItems));
|
|
370
|
+
if (numDirItems > kNumDirItemsMax)
|
|
371
|
+
numDirItems = kNumDirItemsMax;
|
|
372
|
+
for (UInt32 i = 0; i < numDirItems; i++)
|
|
373
|
+
DirItems[i].Parse(p + pos + i * 8);
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
static const UInt32 kSectionSize = 40;
|
|
378
|
+
|
|
379
|
+
struct CSection
|
|
380
|
+
{
|
|
381
|
+
AString Name;
|
|
382
|
+
|
|
383
|
+
UInt32 ExtractSize;
|
|
384
|
+
UInt32 VSize;
|
|
385
|
+
UInt32 Va;
|
|
386
|
+
UInt32 PSize;
|
|
387
|
+
UInt32 Pa;
|
|
388
|
+
UInt32 Flags;
|
|
389
|
+
UInt32 Time;
|
|
390
|
+
// UInt16 NumRelocs; // is set to zero for executable images
|
|
391
|
+
bool IsRealSect;
|
|
392
|
+
bool IsDebug;
|
|
393
|
+
bool IsAdditionalSection;
|
|
394
|
+
|
|
395
|
+
CSection():
|
|
396
|
+
ExtractSize(0),
|
|
397
|
+
IsRealSect(false),
|
|
398
|
+
IsDebug(false),
|
|
399
|
+
IsAdditionalSection(false)
|
|
400
|
+
// , NumRelocs(0)
|
|
401
|
+
{}
|
|
402
|
+
|
|
403
|
+
void Set_Size_for_all(UInt32 size)
|
|
404
|
+
{
|
|
405
|
+
PSize = VSize = ExtractSize = size;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
UInt32 GetSize_Extract() const
|
|
409
|
+
{
|
|
410
|
+
return ExtractSize;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
void UpdateTotalSize(UInt32 &totalSize) const
|
|
414
|
+
{
|
|
415
|
+
const UInt32 t = Pa + PSize;
|
|
416
|
+
if (totalSize < t)
|
|
417
|
+
totalSize = t;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
void Parse(const Byte *p);
|
|
421
|
+
|
|
422
|
+
int Compare(const CSection &s) const
|
|
423
|
+
{
|
|
424
|
+
RINOZ(MyCompare(Pa, s.Pa))
|
|
425
|
+
const UInt32 size1 = GetSize_Extract();
|
|
426
|
+
const UInt32 size2 = s.GetSize_Extract();
|
|
427
|
+
return MyCompare(size1, size2);
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
static const unsigned kNameSize = 8;
|
|
432
|
+
|
|
433
|
+
static void GetName(const Byte *name, AString &res)
|
|
434
|
+
{
|
|
435
|
+
res.SetFrom_CalcLen((const char *)name, kNameSize);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
void CSection::Parse(const Byte *p)
|
|
439
|
+
{
|
|
440
|
+
GetName(p, Name);
|
|
441
|
+
G32( 8, VSize);
|
|
442
|
+
G32(12, Va);
|
|
443
|
+
G32(16, PSize);
|
|
444
|
+
G32(20, Pa);
|
|
445
|
+
// G16(32, NumRelocs);
|
|
446
|
+
G32(36, Flags);
|
|
447
|
+
// v24.08: we extract only useful data (without extra padding bytes).
|
|
448
|
+
// VSize == 0 is not expected, but we support that case too.
|
|
449
|
+
// return (VSize && VSize < PSize) ? VSize : PSize;
|
|
450
|
+
ExtractSize = (VSize && VSize < PSize) ? VSize : PSize;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
// IMAGE_FILE_*
|
|
456
|
+
|
|
457
|
+
static const CUInt32PCharPair g_HeaderCharacts[] =
|
|
458
|
+
{
|
|
459
|
+
{ 1, "Executable" },
|
|
460
|
+
{ 13, "DLL" },
|
|
461
|
+
{ 8, "32-bit" },
|
|
462
|
+
{ 5, "LargeAddress" },
|
|
463
|
+
{ 0, "NoRelocs" },
|
|
464
|
+
{ 2, "NoLineNums" },
|
|
465
|
+
{ 3, "NoLocalSyms" },
|
|
466
|
+
{ 4, "AggressiveWsTrim" },
|
|
467
|
+
{ 9, "NoDebugInfo" },
|
|
468
|
+
{ 10, "RemovableRun" },
|
|
469
|
+
{ 11, "NetRun" },
|
|
470
|
+
{ 12, "System" },
|
|
471
|
+
{ 14, "UniCPU" },
|
|
472
|
+
{ 7, "Little-Endian" },
|
|
473
|
+
{ 15, "Big-Endian" }
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
// IMAGE_DLLCHARACTERISTICS_*
|
|
477
|
+
|
|
478
|
+
static const char * const g_DllCharacts[] =
|
|
479
|
+
{
|
|
480
|
+
NULL
|
|
481
|
+
, NULL
|
|
482
|
+
, NULL
|
|
483
|
+
, NULL
|
|
484
|
+
, NULL
|
|
485
|
+
, "HighEntropyVA"
|
|
486
|
+
, "Relocated"
|
|
487
|
+
, "Integrity"
|
|
488
|
+
, "NX-Compatible"
|
|
489
|
+
, "NoIsolation"
|
|
490
|
+
, "NoSEH"
|
|
491
|
+
, "NoBind"
|
|
492
|
+
, "AppContainer"
|
|
493
|
+
, "WDM"
|
|
494
|
+
, "GuardCF"
|
|
495
|
+
, "TerminalServerAware"
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
// IMAGE_SCN_* constants:
|
|
500
|
+
|
|
501
|
+
static const char * const g_SectFlags[] =
|
|
502
|
+
{
|
|
503
|
+
NULL
|
|
504
|
+
, NULL
|
|
505
|
+
, NULL
|
|
506
|
+
, "NoPad"
|
|
507
|
+
, NULL
|
|
508
|
+
, "Code"
|
|
509
|
+
, "InitializedData"
|
|
510
|
+
, "UninitializedData"
|
|
511
|
+
, "Other"
|
|
512
|
+
, "Comments"
|
|
513
|
+
, NULL // OVER
|
|
514
|
+
, "Remove"
|
|
515
|
+
, "COMDAT"
|
|
516
|
+
, NULL
|
|
517
|
+
, "NO_DEFER_SPEC_EXC"
|
|
518
|
+
, "GP" // MEM_FARDATA
|
|
519
|
+
, NULL // SYSHEAP
|
|
520
|
+
, "PURGEABLE" // 16BIT
|
|
521
|
+
, "LOCKED"
|
|
522
|
+
, "PRELOAD"
|
|
523
|
+
, NULL
|
|
524
|
+
, NULL
|
|
525
|
+
, NULL
|
|
526
|
+
, NULL
|
|
527
|
+
, "ExtendedRelocations"
|
|
528
|
+
, "Discardable"
|
|
529
|
+
, "NotCached"
|
|
530
|
+
, "NotPaged"
|
|
531
|
+
, "Shared"
|
|
532
|
+
, "Execute"
|
|
533
|
+
, "Read"
|
|
534
|
+
, "Write"
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
static const CUInt32PCharPair g_MachinePairs[] =
|
|
538
|
+
{
|
|
539
|
+
{ 0x014C, "x86" },
|
|
540
|
+
{ 0x014D, "I860" },
|
|
541
|
+
{ 0x0162, "MIPS-R3000" },
|
|
542
|
+
{ 0x0166, "MIPS-R4000" },
|
|
543
|
+
{ 0x0168, "MIPS-R10000" },
|
|
544
|
+
{ 0x0169, "MIPS-V2" },
|
|
545
|
+
{ 0x0184, "Alpha" },
|
|
546
|
+
{ 0x01A2, "SH3" },
|
|
547
|
+
{ 0x01A3, "SH3-DSP" },
|
|
548
|
+
{ 0x01A4, "SH3E" },
|
|
549
|
+
{ 0x01A6, "SH4" },
|
|
550
|
+
{ 0x01A8, "SH5" },
|
|
551
|
+
{ 0x01C0, "ARM" },
|
|
552
|
+
{ 0x01C2, "ARM-Thumb" },
|
|
553
|
+
{ 0x01C4, "ARM-NT" },
|
|
554
|
+
{ 0x01D3, "AM33" },
|
|
555
|
+
{ 0x01F0, "PPC" },
|
|
556
|
+
{ 0x01F1, "PPC-FP" },
|
|
557
|
+
{ 0x01F2, "PPC-BE" },
|
|
558
|
+
{ 0x0200, "IA-64" },
|
|
559
|
+
{ 0x0266, "MIPS-16" },
|
|
560
|
+
{ 0x0284, "Alpha-64" },
|
|
561
|
+
{ 0x0366, "MIPS-FPU" },
|
|
562
|
+
{ 0x0466, "MIPS-FPU16" },
|
|
563
|
+
{ 0x0520, "TriCore" },
|
|
564
|
+
{ 0x0CEF, "CEF" },
|
|
565
|
+
{ 0x0EBC, "EFI" },
|
|
566
|
+
{ 0x5032, "RISCV32" },
|
|
567
|
+
{ 0x5064, "RISCV64" },
|
|
568
|
+
// { 0x5128, "RISCV128" },
|
|
569
|
+
{ 0x6232, "LOONGARCH32" },
|
|
570
|
+
{ 0x6264, "LOONGARCH64" },
|
|
571
|
+
{ 0x8664, "x64" },
|
|
572
|
+
{ 0x9041, "M32R" },
|
|
573
|
+
{ 0xA641, "ARM64EC" },
|
|
574
|
+
{ 0xA64e, "ARM64X" },
|
|
575
|
+
{ 0xAA64, "ARM64" },
|
|
576
|
+
{ 0xC0EE, "CEE" }
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
static const char * const g_SubSystems[] =
|
|
580
|
+
{
|
|
581
|
+
"Unknown"
|
|
582
|
+
, "Native"
|
|
583
|
+
, "Windows GUI"
|
|
584
|
+
, "Windows CUI"
|
|
585
|
+
, NULL // "Old Windows CE"
|
|
586
|
+
, "OS2"
|
|
587
|
+
, NULL
|
|
588
|
+
, "Posix"
|
|
589
|
+
, "Win9x"
|
|
590
|
+
, "Windows CE"
|
|
591
|
+
, "EFI"
|
|
592
|
+
, "EFI Boot"
|
|
593
|
+
, "EFI Runtime"
|
|
594
|
+
, "EFI ROM"
|
|
595
|
+
, "XBOX"
|
|
596
|
+
, NULL
|
|
597
|
+
, "Windows Boot"
|
|
598
|
+
, "XBOX Catalog" // 17
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
static const char * const g_ResTypes[] =
|
|
602
|
+
{
|
|
603
|
+
NULL
|
|
604
|
+
, "CURSOR"
|
|
605
|
+
, "BITMAP"
|
|
606
|
+
, "ICON"
|
|
607
|
+
, "MENU"
|
|
608
|
+
, "DIALOG"
|
|
609
|
+
, "STRING"
|
|
610
|
+
, "FONTDIR"
|
|
611
|
+
, "FONT"
|
|
612
|
+
, "ACCELERATOR"
|
|
613
|
+
, "RCDATA"
|
|
614
|
+
, "MESSAGETABLE"
|
|
615
|
+
, "GROUP_CURSOR"
|
|
616
|
+
, NULL
|
|
617
|
+
, "GROUP_ICON"
|
|
618
|
+
, NULL
|
|
619
|
+
, "VERSION"
|
|
620
|
+
, "DLGINCLUDE"
|
|
621
|
+
, NULL
|
|
622
|
+
, "PLUGPLAY"
|
|
623
|
+
, "VXD"
|
|
624
|
+
, "ANICURSOR"
|
|
625
|
+
, "ANIICON"
|
|
626
|
+
, "HTML"
|
|
627
|
+
, "MANIFEST"
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
static const UInt32 kFlag = (UInt32)1 << 31;
|
|
631
|
+
static const UInt32 kMask = ~kFlag;
|
|
632
|
+
|
|
633
|
+
struct CTableItem
|
|
634
|
+
{
|
|
635
|
+
UInt32 Offset;
|
|
636
|
+
UInt32 ID;
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
static const UInt32 kBmpHeaderSize = 14;
|
|
641
|
+
static const UInt32 kIconHeaderSize = 22;
|
|
642
|
+
|
|
643
|
+
struct CResItem
|
|
644
|
+
{
|
|
645
|
+
UInt32 Type;
|
|
646
|
+
UInt32 ID;
|
|
647
|
+
UInt32 Lang;
|
|
648
|
+
|
|
649
|
+
UInt32 Size;
|
|
650
|
+
UInt32 Offset;
|
|
651
|
+
|
|
652
|
+
UInt32 HeaderSize;
|
|
653
|
+
Byte Header[kIconHeaderSize]; // it must be enough for max size header.
|
|
654
|
+
bool Enabled;
|
|
655
|
+
|
|
656
|
+
bool IsNameEqual(const CResItem &item) const { return Lang == item.Lang; }
|
|
657
|
+
UInt32 GetSize() const { return Size + HeaderSize; }
|
|
658
|
+
bool IsBmp() const { return Type == 2; }
|
|
659
|
+
bool IsIcon() const { return Type == 3; }
|
|
660
|
+
bool IsString() const { return Type == 6; }
|
|
661
|
+
bool IsRcData() const { return Type == 10; }
|
|
662
|
+
bool IsVersion() const { return Type == 16; }
|
|
663
|
+
bool IsRcDataOrUnknown() const { return IsRcData() || Type > 64; }
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
struct CTextFile
|
|
667
|
+
{
|
|
668
|
+
CByteDynamicBuffer Buf;
|
|
669
|
+
|
|
670
|
+
size_t FinalSize() const { return Buf.GetPos(); }
|
|
671
|
+
|
|
672
|
+
void AddChar(char c);
|
|
673
|
+
void AddWChar(UInt16 c);
|
|
674
|
+
void AddWChar_Smart(UInt16 c);
|
|
675
|
+
void NewLine();
|
|
676
|
+
void AddString(const char *s);
|
|
677
|
+
void AddSpaces(int num);
|
|
678
|
+
void AddBytes(const Byte *p, size_t size)
|
|
679
|
+
{
|
|
680
|
+
Buf.AddData(p, size);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
void OpenBlock(int num)
|
|
684
|
+
{
|
|
685
|
+
AddSpaces(num);
|
|
686
|
+
AddChar('{');
|
|
687
|
+
NewLine();
|
|
688
|
+
}
|
|
689
|
+
void CloseBlock(int num)
|
|
690
|
+
{
|
|
691
|
+
AddSpaces(num);
|
|
692
|
+
AddChar('}');
|
|
693
|
+
NewLine();
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
void CTextFile::AddChar(char c)
|
|
698
|
+
{
|
|
699
|
+
Byte *p = Buf.GetCurPtrAndGrow(2);
|
|
700
|
+
p[0] = (Byte)c;
|
|
701
|
+
p[1] = 0;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
void CTextFile::AddWChar(UInt16 c)
|
|
705
|
+
{
|
|
706
|
+
Byte *p = Buf.GetCurPtrAndGrow(2);
|
|
707
|
+
SetUi16(p, c)
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
void CTextFile::AddWChar_Smart(UInt16 c)
|
|
711
|
+
{
|
|
712
|
+
if (c == '\n')
|
|
713
|
+
{
|
|
714
|
+
AddChar('\\');
|
|
715
|
+
c = 'n';
|
|
716
|
+
}
|
|
717
|
+
AddWChar(c);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
void CTextFile::NewLine()
|
|
721
|
+
{
|
|
722
|
+
AddChar(0x0D);
|
|
723
|
+
AddChar(0x0A);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
void CTextFile::AddString(const char *s)
|
|
727
|
+
{
|
|
728
|
+
for (;; s++)
|
|
729
|
+
{
|
|
730
|
+
char c = *s;
|
|
731
|
+
if (c == 0)
|
|
732
|
+
return;
|
|
733
|
+
AddChar(c);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
void CTextFile::AddSpaces(int num)
|
|
738
|
+
{
|
|
739
|
+
for (int i = 0; i < num; i++)
|
|
740
|
+
AddChar(' ');
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
struct CStringItem: public CTextFile
|
|
744
|
+
{
|
|
745
|
+
UInt32 Lang;
|
|
746
|
+
};
|
|
747
|
+
|
|
748
|
+
struct CByteBuffer_WithLang: public CByteBuffer
|
|
749
|
+
{
|
|
750
|
+
UInt32 Lang;
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
struct CMixItem
|
|
755
|
+
{
|
|
756
|
+
int SectionIndex;
|
|
757
|
+
int ResourceIndex;
|
|
758
|
+
int StringIndex;
|
|
759
|
+
int VersionIndex;
|
|
760
|
+
|
|
761
|
+
void Construct()
|
|
762
|
+
{
|
|
763
|
+
SectionIndex = -1;
|
|
764
|
+
ResourceIndex = -1;
|
|
765
|
+
StringIndex = -1;
|
|
766
|
+
VersionIndex = -1;
|
|
767
|
+
}
|
|
768
|
+
bool IsSectionItem() const { return ResourceIndex < 0 && StringIndex < 0 && VersionIndex < 0; }
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
struct CUsedBitmap
|
|
772
|
+
{
|
|
773
|
+
CByteBuffer Buf;
|
|
774
|
+
public:
|
|
775
|
+
void Alloc(size_t size)
|
|
776
|
+
{
|
|
777
|
+
size = (size + 7) / 8;
|
|
778
|
+
Buf.Alloc(size);
|
|
779
|
+
memset(Buf, 0, size);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
void Free()
|
|
783
|
+
{
|
|
784
|
+
Buf.Free();
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
bool SetRange(size_t from, unsigned size)
|
|
788
|
+
{
|
|
789
|
+
for (unsigned i = 0; i < size; i++)
|
|
790
|
+
{
|
|
791
|
+
size_t pos = (from + i) >> 3;
|
|
792
|
+
Byte mask = (Byte)(1 << ((from + i) & 7));
|
|
793
|
+
Byte b = Buf[pos];
|
|
794
|
+
if ((b & mask) != 0)
|
|
795
|
+
return false;
|
|
796
|
+
Buf[pos] = (Byte)(b | mask);
|
|
797
|
+
}
|
|
798
|
+
return true;
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
struct CStringKeyValue
|
|
803
|
+
{
|
|
804
|
+
UString Key;
|
|
805
|
+
UString Value;
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
Z7_CLASS_IMP_CHandler_IInArchive_2(
|
|
810
|
+
IInArchiveGetStream,
|
|
811
|
+
IArchiveAllowTail
|
|
812
|
+
)
|
|
813
|
+
CMyComPtr<IInStream> _stream;
|
|
814
|
+
CObjectVector<CSection> _sections;
|
|
815
|
+
CHeader _header;
|
|
816
|
+
UInt32 _totalSize;
|
|
817
|
+
Int32 _mainSubfile;
|
|
818
|
+
|
|
819
|
+
CRecordVector<CMixItem> _mixItems;
|
|
820
|
+
CRecordVector<CResItem> _items;
|
|
821
|
+
CObjectVector<CStringItem> _strings;
|
|
822
|
+
CObjectVector<CByteBuffer_WithLang> _versionFiles;
|
|
823
|
+
UString _versionFullString;
|
|
824
|
+
UString _versionShortString;
|
|
825
|
+
UString _originalFilename;
|
|
826
|
+
CObjectVector<CStringKeyValue> _versionKeys;
|
|
827
|
+
|
|
828
|
+
CByteBuffer _buf;
|
|
829
|
+
|
|
830
|
+
bool _oneLang;
|
|
831
|
+
// bool _parseResources;
|
|
832
|
+
bool _checksumError;
|
|
833
|
+
bool _sectionsError;
|
|
834
|
+
|
|
835
|
+
bool _coffMode;
|
|
836
|
+
bool _allowTail;
|
|
837
|
+
|
|
838
|
+
UString _resourcesPrefix;
|
|
839
|
+
CUsedBitmap _usedRes;
|
|
840
|
+
|
|
841
|
+
bool IsOpt() const { return _header.OptHeaderSize != 0; }
|
|
842
|
+
|
|
843
|
+
COptHeader _optHeader;
|
|
844
|
+
|
|
845
|
+
HRESULT LoadDebugSections(IInStream *stream, bool &thereIsSection);
|
|
846
|
+
HRESULT Open2(IInStream *stream, IArchiveOpenCallback *callback);
|
|
847
|
+
|
|
848
|
+
void AddResNameToString(UString &s, UInt32 id) const;
|
|
849
|
+
void AddLangPrefix(UString &s, UInt32 lang) const;
|
|
850
|
+
HRESULT ReadString(UInt32 offset, UString &dest) const;
|
|
851
|
+
HRESULT ReadTable(UInt32 offset, CRecordVector<CTableItem> &items);
|
|
852
|
+
bool ParseStringRes(UInt32 id, UInt32 lang, const Byte *src, UInt32 size);
|
|
853
|
+
HRESULT OpenResources(unsigned sectIndex, IInStream *stream, IArchiveOpenCallback *callback);
|
|
854
|
+
void CloseResources();
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
bool CheckItem(const CSection §, const CResItem &item, size_t offset) const
|
|
858
|
+
{
|
|
859
|
+
return item.Offset >= sect.Va && offset <= _buf.Size() && _buf.Size() - offset >= item.Size;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
public:
|
|
863
|
+
CHandler(bool coffMode = false):
|
|
864
|
+
_coffMode(coffMode),
|
|
865
|
+
_allowTail(coffMode)
|
|
866
|
+
{}
|
|
867
|
+
};
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
enum
|
|
871
|
+
{
|
|
872
|
+
kpidSectAlign = kpidUserDefined,
|
|
873
|
+
kpidFileAlign,
|
|
874
|
+
kpidLinkerVer,
|
|
875
|
+
kpidOsVer,
|
|
876
|
+
kpidImageVer,
|
|
877
|
+
kpidSubsysVer,
|
|
878
|
+
kpidCodeSize,
|
|
879
|
+
kpidImageSize,
|
|
880
|
+
kpidInitDataSize,
|
|
881
|
+
kpidUnInitDataSize,
|
|
882
|
+
kpidHeadersSizeUnInitDataSize,
|
|
883
|
+
kpidSubSystem,
|
|
884
|
+
kpidDllCharacts,
|
|
885
|
+
kpidStackReserve,
|
|
886
|
+
kpidStackCommit,
|
|
887
|
+
kpidHeapReserve,
|
|
888
|
+
kpidHeapCommit
|
|
889
|
+
// , kpidImageBase
|
|
890
|
+
// , kpidAddressOfEntryPoint
|
|
891
|
+
// , kpidBaseOfCode
|
|
892
|
+
// , kpidBaseOfData32
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
static const CStatProp kArcProps[] =
|
|
896
|
+
{
|
|
897
|
+
// { NULL, kpidWarning, VT_BSTR},
|
|
898
|
+
{ NULL, kpidCpu, VT_BSTR},
|
|
899
|
+
{ NULL, kpidBit64, VT_BOOL},
|
|
900
|
+
{ NULL, kpidCharacts, VT_BSTR},
|
|
901
|
+
{ NULL, kpidCTime, VT_FILETIME},
|
|
902
|
+
{ NULL, kpidHeadersSize, VT_UI4},
|
|
903
|
+
{ NULL, kpidChecksum, VT_UI4},
|
|
904
|
+
{ NULL, kpidName, VT_BSTR},
|
|
905
|
+
|
|
906
|
+
{ "Image Size", kpidImageSize, VT_UI4},
|
|
907
|
+
{ "Section Alignment", kpidSectAlign, VT_UI4},
|
|
908
|
+
{ "File Alignment", kpidFileAlign, VT_UI4},
|
|
909
|
+
{ "Code Size", kpidCodeSize, VT_UI4},
|
|
910
|
+
{ "Initialized Data Size", kpidInitDataSize, VT_UI4},
|
|
911
|
+
{ "Uninitialized Data Size", kpidUnInitDataSize, VT_UI4},
|
|
912
|
+
{ "Linker Version", kpidLinkerVer, VT_BSTR},
|
|
913
|
+
{ "OS Version", kpidOsVer, VT_BSTR},
|
|
914
|
+
{ "Image Version", kpidImageVer, VT_BSTR},
|
|
915
|
+
{ "Subsystem Version", kpidSubsysVer, VT_BSTR},
|
|
916
|
+
{ "Subsystem", kpidSubSystem, VT_BSTR},
|
|
917
|
+
{ "DLL Characteristics", kpidDllCharacts, VT_BSTR},
|
|
918
|
+
{ "Stack Reserve", kpidStackReserve, VT_UI8},
|
|
919
|
+
{ "Stack Commit", kpidStackCommit, VT_UI8},
|
|
920
|
+
{ "Heap Reserve", kpidHeapReserve, VT_UI8},
|
|
921
|
+
{ "Heap Commit", kpidHeapCommit, VT_UI8},
|
|
922
|
+
{ NULL, kpidVa, VT_UI8 }, // "Image Base", kpidImageBase, VT_UI8
|
|
923
|
+
{ NULL, kpidComment, VT_BSTR}
|
|
924
|
+
|
|
925
|
+
// , { "Address Of Entry Point", kpidAddressOfEntryPoint, VT_UI8}
|
|
926
|
+
// , { "Base Of Code", kpidBaseOfCode, VT_UI8}
|
|
927
|
+
// , { "Base Of Data", kpidBaseOfData32, VT_UI8}
|
|
928
|
+
};
|
|
929
|
+
|
|
930
|
+
// #define kpid_NumRelocs 250
|
|
931
|
+
|
|
932
|
+
static const Byte kProps[] =
|
|
933
|
+
{
|
|
934
|
+
kpidPath,
|
|
935
|
+
kpidSize,
|
|
936
|
+
kpidPackSize,
|
|
937
|
+
kpidVirtualSize,
|
|
938
|
+
kpidCharacts,
|
|
939
|
+
kpidOffset,
|
|
940
|
+
kpidVa
|
|
941
|
+
// , kpid_NumRelocs
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
IMP_IInArchive_Props
|
|
945
|
+
IMP_IInArchive_ArcProps_WITH_NAME
|
|
946
|
+
|
|
947
|
+
static void TimeToProp(UInt32 unixTime, NCOM::CPropVariant &prop)
|
|
948
|
+
{
|
|
949
|
+
if (unixTime != 0)
|
|
950
|
+
PropVariant_SetFrom_UnixTime(prop, unixTime);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
Z7_COM7F_IMF(CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value))
|
|
954
|
+
{
|
|
955
|
+
COM_TRY_BEGIN
|
|
956
|
+
NCOM::CPropVariant prop;
|
|
957
|
+
switch (propID)
|
|
958
|
+
{
|
|
959
|
+
case kpidPhySize: prop = _totalSize; break;
|
|
960
|
+
case kpidComment:
|
|
961
|
+
{
|
|
962
|
+
UString s (_versionFullString);
|
|
963
|
+
s.Add_LF();
|
|
964
|
+
s += "Data Directories: ";
|
|
965
|
+
s.Add_UInt32(_optHeader.NumDirItems);
|
|
966
|
+
s.Add_LF();
|
|
967
|
+
s.Add_Char('{');
|
|
968
|
+
s.Add_LF();
|
|
969
|
+
for (unsigned i = 0; i < _optHeader.NumDirItems
|
|
970
|
+
&& i < Z7_ARRAY_SIZE(_optHeader.DirItems); i++)
|
|
971
|
+
{
|
|
972
|
+
const CDirLink &di = _optHeader.DirItems[i];
|
|
973
|
+
if (di.Va == 0 && di.Size == 0)
|
|
974
|
+
continue;
|
|
975
|
+
s += "index=";
|
|
976
|
+
s.Add_UInt32(i);
|
|
977
|
+
|
|
978
|
+
if (i < Z7_ARRAY_SIZE(g_Dir_Names))
|
|
979
|
+
{
|
|
980
|
+
s += " name=";
|
|
981
|
+
s += g_Dir_Names[i];
|
|
982
|
+
}
|
|
983
|
+
s += " VA=0x";
|
|
984
|
+
char temp[16];
|
|
985
|
+
ConvertUInt32ToHex(di.Va, temp);
|
|
986
|
+
s += temp;
|
|
987
|
+
s += " Size=";
|
|
988
|
+
s.Add_UInt32(di.Size);
|
|
989
|
+
s.Add_LF();
|
|
990
|
+
}
|
|
991
|
+
s.Add_Char('}');
|
|
992
|
+
s.Add_LF();
|
|
993
|
+
prop = s;
|
|
994
|
+
break;
|
|
995
|
+
}
|
|
996
|
+
case kpidShortComment:
|
|
997
|
+
if (!_versionShortString.IsEmpty())
|
|
998
|
+
prop = _versionShortString;
|
|
999
|
+
else
|
|
1000
|
+
{
|
|
1001
|
+
PAIR_TO_PROP(g_MachinePairs, _header.Machine, prop);
|
|
1002
|
+
}
|
|
1003
|
+
break;
|
|
1004
|
+
|
|
1005
|
+
case kpidName: if (!_originalFilename.IsEmpty()) prop = _originalFilename; break;
|
|
1006
|
+
|
|
1007
|
+
// case kpidIsSelfExe: prop = !_header.IsDll(); break;
|
|
1008
|
+
// case kpidError:
|
|
1009
|
+
case kpidWarning: if (_checksumError) prop = "Checksum error"; break;
|
|
1010
|
+
|
|
1011
|
+
case kpidWarningFlags:
|
|
1012
|
+
{
|
|
1013
|
+
UInt32 v = 0;
|
|
1014
|
+
if (_sectionsError) v |= kpv_ErrorFlags_HeadersError;
|
|
1015
|
+
if (v != 0)
|
|
1016
|
+
prop = v;
|
|
1017
|
+
break;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
case kpidCpu: PAIR_TO_PROP(g_MachinePairs, _header.Machine, prop); break;
|
|
1021
|
+
case kpidMTime:
|
|
1022
|
+
case kpidCTime: TimeToProp(_header.Time, prop); break;
|
|
1023
|
+
case kpidCharacts: FLAGS_TO_PROP(g_HeaderCharacts, _header.Flags, prop); break;
|
|
1024
|
+
case kpidMainSubfile: if (_mainSubfile >= 0) prop = (UInt32)_mainSubfile; break;
|
|
1025
|
+
|
|
1026
|
+
default:
|
|
1027
|
+
if (IsOpt())
|
|
1028
|
+
switch (propID)
|
|
1029
|
+
{
|
|
1030
|
+
|
|
1031
|
+
case kpidSectAlign: prop = _optHeader.SectAlign; break;
|
|
1032
|
+
case kpidFileAlign: prop = _optHeader.FileAlign; break;
|
|
1033
|
+
case kpidLinkerVer:
|
|
1034
|
+
{
|
|
1035
|
+
CVersion v = { _optHeader.LinkerVerMajor, _optHeader.LinkerVerMinor };
|
|
1036
|
+
v.ToProp(prop);
|
|
1037
|
+
break;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
case kpidOsVer: _optHeader.OsVer.ToProp(prop); break;
|
|
1041
|
+
case kpidImageVer: _optHeader.ImageVer.ToProp(prop); break;
|
|
1042
|
+
case kpidSubsysVer: _optHeader.SubsysVer.ToProp(prop); break;
|
|
1043
|
+
case kpidCodeSize: prop = _optHeader.CodeSize; break;
|
|
1044
|
+
case kpidInitDataSize: prop = _optHeader.InitDataSize; break;
|
|
1045
|
+
case kpidUnInitDataSize: prop = _optHeader.UninitDataSize; break;
|
|
1046
|
+
case kpidImageSize: prop = _optHeader.ImageSize; break;
|
|
1047
|
+
case kpidHeadersSize: prop = _optHeader.HeadersSize; break;
|
|
1048
|
+
case kpidChecksum: prop = _optHeader.CheckSum; break;
|
|
1049
|
+
|
|
1050
|
+
case kpidExtension:
|
|
1051
|
+
if (_header.IsDll())
|
|
1052
|
+
prop = "dll";
|
|
1053
|
+
else if (_optHeader.IsSybSystem_EFI())
|
|
1054
|
+
prop = "efi";
|
|
1055
|
+
break;
|
|
1056
|
+
|
|
1057
|
+
case kpidBit64: if (_optHeader.Is64Bit()) prop = true; break;
|
|
1058
|
+
case kpidSubSystem: TYPE_TO_PROP(g_SubSystems, _optHeader.SubSystem, prop); break;
|
|
1059
|
+
|
|
1060
|
+
case kpidDllCharacts: FLAGS_TO_PROP(g_DllCharacts, _optHeader.DllCharacts, prop); break;
|
|
1061
|
+
case kpidStackReserve: prop = _optHeader.StackReserve; break;
|
|
1062
|
+
case kpidStackCommit: prop = _optHeader.StackCommit; break;
|
|
1063
|
+
case kpidHeapReserve: prop = _optHeader.HeapReserve; break;
|
|
1064
|
+
case kpidHeapCommit: prop = _optHeader.HeapCommit; break;
|
|
1065
|
+
case kpidVa: prop = _optHeader.ImageBase; break; // kpidImageBase:
|
|
1066
|
+
// case kpidAddressOfEntryPoint: prop = _optHeader.AddressOfEntryPoint; break;
|
|
1067
|
+
// case kpidBaseOfCode: prop = _optHeader.BaseOfCode; break;
|
|
1068
|
+
// case kpidBaseOfData32: if (!_optHeader.Is64Bit()) prop = _optHeader.BaseOfData32; break;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
prop.Detach(value);
|
|
1072
|
+
return S_OK;
|
|
1073
|
+
COM_TRY_END
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
HRESULT CHandler::ReadString(UInt32 offset, UString &dest) const
|
|
1077
|
+
{
|
|
1078
|
+
if ((offset & 1) != 0 || offset >= _buf.Size())
|
|
1079
|
+
return S_FALSE;
|
|
1080
|
+
size_t rem = _buf.Size() - offset;
|
|
1081
|
+
if (rem < 2)
|
|
1082
|
+
return S_FALSE;
|
|
1083
|
+
unsigned len = Get16(_buf + offset);
|
|
1084
|
+
if ((rem - 2) / 2 < len)
|
|
1085
|
+
return S_FALSE;
|
|
1086
|
+
dest.Empty();
|
|
1087
|
+
wchar_t *destBuf = dest.GetBuf(len);
|
|
1088
|
+
offset += 2;
|
|
1089
|
+
const Byte *src = _buf + offset;
|
|
1090
|
+
unsigned i;
|
|
1091
|
+
for (i = 0; i < len; i++)
|
|
1092
|
+
{
|
|
1093
|
+
wchar_t c = (wchar_t)Get16(src + i * 2);
|
|
1094
|
+
if (c == 0)
|
|
1095
|
+
break;
|
|
1096
|
+
destBuf[i] = c;
|
|
1097
|
+
}
|
|
1098
|
+
destBuf[i] = 0;
|
|
1099
|
+
dest.ReleaseBuf_SetLen(i);
|
|
1100
|
+
return S_OK;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
void CHandler::AddResNameToString(UString &s, UInt32 id) const
|
|
1104
|
+
{
|
|
1105
|
+
if ((id & kFlag) != 0)
|
|
1106
|
+
{
|
|
1107
|
+
UString name;
|
|
1108
|
+
if (ReadString(id & kMask, name) == S_OK)
|
|
1109
|
+
{
|
|
1110
|
+
const wchar_t *str = L"[]";
|
|
1111
|
+
if (name.Len() > 1 && name[0] == '"' && name.Back() == '"')
|
|
1112
|
+
{
|
|
1113
|
+
if (name.Len() != 2)
|
|
1114
|
+
{
|
|
1115
|
+
name.DeleteBack();
|
|
1116
|
+
str = name.Ptr(1);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
else if (!name.IsEmpty())
|
|
1120
|
+
str = name;
|
|
1121
|
+
s += str;
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
s.Add_UInt32(id);
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
void CHandler::AddLangPrefix(UString &s, UInt32 lang) const
|
|
1129
|
+
{
|
|
1130
|
+
if (!_oneLang)
|
|
1131
|
+
{
|
|
1132
|
+
AddResNameToString(s, lang);
|
|
1133
|
+
s.Add_PathSepar();
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
Z7_COM7F_IMF(CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value))
|
|
1138
|
+
{
|
|
1139
|
+
COM_TRY_BEGIN
|
|
1140
|
+
NCOM::CPropVariant prop;
|
|
1141
|
+
const CMixItem &mixItem = _mixItems[index];
|
|
1142
|
+
if (mixItem.StringIndex >= 0)
|
|
1143
|
+
{
|
|
1144
|
+
const CStringItem &item = _strings[mixItem.StringIndex];
|
|
1145
|
+
switch (propID)
|
|
1146
|
+
{
|
|
1147
|
+
case kpidPath:
|
|
1148
|
+
{
|
|
1149
|
+
UString s = _resourcesPrefix;
|
|
1150
|
+
AddLangPrefix(s, item.Lang);
|
|
1151
|
+
s += "string.txt";
|
|
1152
|
+
prop = s;
|
|
1153
|
+
break;
|
|
1154
|
+
}
|
|
1155
|
+
case kpidSize:
|
|
1156
|
+
case kpidPackSize:
|
|
1157
|
+
prop = (UInt64)item.FinalSize(); break;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
else if (mixItem.VersionIndex >= 0)
|
|
1161
|
+
{
|
|
1162
|
+
const CByteBuffer_WithLang &item = _versionFiles[mixItem.VersionIndex];
|
|
1163
|
+
switch (propID)
|
|
1164
|
+
{
|
|
1165
|
+
case kpidPath:
|
|
1166
|
+
{
|
|
1167
|
+
UString s = _resourcesPrefix;
|
|
1168
|
+
AddLangPrefix(s, item.Lang);
|
|
1169
|
+
s += "version.txt";
|
|
1170
|
+
prop = s;
|
|
1171
|
+
break;
|
|
1172
|
+
}
|
|
1173
|
+
case kpidSize:
|
|
1174
|
+
case kpidPackSize:
|
|
1175
|
+
prop = (UInt64)item.Size(); break;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
else if (mixItem.ResourceIndex >= 0)
|
|
1179
|
+
{
|
|
1180
|
+
const CResItem &item = _items[mixItem.ResourceIndex];
|
|
1181
|
+
switch (propID)
|
|
1182
|
+
{
|
|
1183
|
+
case kpidPath:
|
|
1184
|
+
{
|
|
1185
|
+
UString s = _resourcesPrefix;
|
|
1186
|
+
AddLangPrefix(s, item.Lang);
|
|
1187
|
+
{
|
|
1188
|
+
const char *p = NULL;
|
|
1189
|
+
if (item.Type < Z7_ARRAY_SIZE(g_ResTypes))
|
|
1190
|
+
p = g_ResTypes[item.Type];
|
|
1191
|
+
if (p)
|
|
1192
|
+
s += p;
|
|
1193
|
+
else
|
|
1194
|
+
AddResNameToString(s, item.Type);
|
|
1195
|
+
}
|
|
1196
|
+
s.Add_PathSepar();
|
|
1197
|
+
AddResNameToString(s, item.ID);
|
|
1198
|
+
if (item.HeaderSize != 0)
|
|
1199
|
+
{
|
|
1200
|
+
if (item.IsBmp())
|
|
1201
|
+
s += ".bmp";
|
|
1202
|
+
else if (item.IsIcon())
|
|
1203
|
+
s += ".ico";
|
|
1204
|
+
}
|
|
1205
|
+
prop = s;
|
|
1206
|
+
break;
|
|
1207
|
+
}
|
|
1208
|
+
case kpidSize: prop = (UInt64)item.GetSize(); break;
|
|
1209
|
+
case kpidPackSize: prop = (UInt64)item.Size; break;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
else
|
|
1213
|
+
{
|
|
1214
|
+
const CSection &item = _sections[mixItem.SectionIndex];
|
|
1215
|
+
switch (propID)
|
|
1216
|
+
{
|
|
1217
|
+
case kpidPath:
|
|
1218
|
+
{
|
|
1219
|
+
AString s = item.Name;
|
|
1220
|
+
s.Replace('/', '_');
|
|
1221
|
+
s.Replace('\\', '_');
|
|
1222
|
+
prop = MultiByteToUnicodeString(s);
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
case kpidSize: prop = (UInt64)item.GetSize_Extract(); break;
|
|
1226
|
+
// case kpid_NumRelocs: prop = (UInt32)item.NumRelocs; break;
|
|
1227
|
+
case kpidPackSize: prop = (UInt64)item.PSize; break;
|
|
1228
|
+
case kpidVirtualSize: prop = (UInt64)item.VSize; break;
|
|
1229
|
+
case kpidOffset: prop = item.Pa; break;
|
|
1230
|
+
case kpidVa: if (item.IsRealSect) prop = item.Va; break;
|
|
1231
|
+
case kpidMTime:
|
|
1232
|
+
case kpidCTime:
|
|
1233
|
+
TimeToProp(item.IsDebug ? item.Time : _header.Time, prop); break;
|
|
1234
|
+
case kpidCharacts:
|
|
1235
|
+
if (item.IsRealSect)
|
|
1236
|
+
{
|
|
1237
|
+
UInt32 flags = item.Flags;
|
|
1238
|
+
const UInt32 MY_IMAGE_SCN_ALIGN_MASK = 0x00F00000;
|
|
1239
|
+
AString s = FlagsToString(g_SectFlags, Z7_ARRAY_SIZE(g_SectFlags), item.Flags & ~MY_IMAGE_SCN_ALIGN_MASK);
|
|
1240
|
+
const UInt32 align = ((flags >> 20) & 0xF);
|
|
1241
|
+
if (align != 0)
|
|
1242
|
+
{
|
|
1243
|
+
char sz[32];
|
|
1244
|
+
ConvertUInt32ToString(1 << (align - 1), sz);
|
|
1245
|
+
s.Add_Space();
|
|
1246
|
+
s += "align_";
|
|
1247
|
+
s += sz;
|
|
1248
|
+
}
|
|
1249
|
+
prop = s;
|
|
1250
|
+
}
|
|
1251
|
+
break;
|
|
1252
|
+
case kpidZerosTailIsAllowed: if (!item.IsRealSect) prop = true; break;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
prop.Detach(value);
|
|
1256
|
+
return S_OK;
|
|
1257
|
+
COM_TRY_END
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
HRESULT CHandler::LoadDebugSections(IInStream *stream, bool &thereIsSection)
|
|
1261
|
+
{
|
|
1262
|
+
thereIsSection = false;
|
|
1263
|
+
const CDirLink &debugLink = _optHeader.DirItems[kDirLink_Debug];
|
|
1264
|
+
if (debugLink.Size == 0)
|
|
1265
|
+
return S_OK;
|
|
1266
|
+
const unsigned kEntrySize = 28;
|
|
1267
|
+
UInt32 numItems = debugLink.Size / kEntrySize;
|
|
1268
|
+
if (numItems > 16)
|
|
1269
|
+
return S_FALSE;
|
|
1270
|
+
|
|
1271
|
+
// MAC's EFI file: numItems can be incorrect. Only first CDebugEntry entry is correct.
|
|
1272
|
+
// debugLink.Size = kEntrySize + some_data, pointed by entry[0].
|
|
1273
|
+
if (numItems * kEntrySize != debugLink.Size)
|
|
1274
|
+
{
|
|
1275
|
+
// return S_FALSE;
|
|
1276
|
+
if (numItems > 1)
|
|
1277
|
+
numItems = 1;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
UInt64 pa = 0;
|
|
1281
|
+
unsigned i;
|
|
1282
|
+
for (i = 0; i < _sections.Size(); i++)
|
|
1283
|
+
{
|
|
1284
|
+
const CSection § = _sections[i];
|
|
1285
|
+
if (sect.Va <= debugLink.Va && debugLink.Va + debugLink.Size <= sect.Va + sect.PSize)
|
|
1286
|
+
{
|
|
1287
|
+
pa = sect.Pa + (debugLink.Va - sect.Va);
|
|
1288
|
+
break;
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
if (i == _sections.Size())
|
|
1292
|
+
{
|
|
1293
|
+
// Exe for ARM requires S_OK
|
|
1294
|
+
// return S_FALSE;
|
|
1295
|
+
return S_OK;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
CByteBuffer buffer(debugLink.Size);
|
|
1299
|
+
Byte *buf = buffer;
|
|
1300
|
+
|
|
1301
|
+
RINOK(InStream_SeekSet(stream, pa))
|
|
1302
|
+
RINOK(ReadStream_FALSE(stream, buf, debugLink.Size))
|
|
1303
|
+
|
|
1304
|
+
for (i = 0; i < numItems; i++)
|
|
1305
|
+
{
|
|
1306
|
+
CDebugEntry de;
|
|
1307
|
+
de.Parse(buf);
|
|
1308
|
+
|
|
1309
|
+
if (de.Size == 0)
|
|
1310
|
+
continue;
|
|
1311
|
+
|
|
1312
|
+
UInt32 totalSize = de.Pa + de.Size;
|
|
1313
|
+
if (totalSize > _totalSize)
|
|
1314
|
+
{
|
|
1315
|
+
_totalSize = totalSize;
|
|
1316
|
+
thereIsSection = true;
|
|
1317
|
+
|
|
1318
|
+
CSection § = _sections.AddNew();
|
|
1319
|
+
sect.Name = ".debug";
|
|
1320
|
+
sect.Name.Add_UInt32(i);
|
|
1321
|
+
sect.IsDebug = true;
|
|
1322
|
+
sect.Time = de.Time;
|
|
1323
|
+
sect.Va = de.Va;
|
|
1324
|
+
sect.Pa = de.Pa;
|
|
1325
|
+
sect.Set_Size_for_all(de.Size);
|
|
1326
|
+
}
|
|
1327
|
+
buf += kEntrySize;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
return S_OK;
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
HRESULT CHandler::ReadTable(UInt32 offset, CRecordVector<CTableItem> &items)
|
|
1334
|
+
{
|
|
1335
|
+
if ((offset & 3) != 0 || offset >= _buf.Size())
|
|
1336
|
+
return S_FALSE;
|
|
1337
|
+
size_t rem = _buf.Size() - offset;
|
|
1338
|
+
if (rem < 16)
|
|
1339
|
+
return S_FALSE;
|
|
1340
|
+
unsigned numNameItems = Get16(_buf + offset + 12);
|
|
1341
|
+
unsigned numIdItems = Get16(_buf + offset + 14);
|
|
1342
|
+
unsigned numItems = numNameItems + numIdItems;
|
|
1343
|
+
if ((rem - 16) / 8 < numItems)
|
|
1344
|
+
return S_FALSE;
|
|
1345
|
+
if (!_usedRes.SetRange(offset, 16 + numItems * 8))
|
|
1346
|
+
return S_FALSE;
|
|
1347
|
+
offset += 16;
|
|
1348
|
+
items.ClearAndReserve(numItems);
|
|
1349
|
+
for (unsigned i = 0; i < numItems; i++, offset += 8)
|
|
1350
|
+
{
|
|
1351
|
+
const Byte *buf = _buf + offset;
|
|
1352
|
+
CTableItem item;
|
|
1353
|
+
item.ID = Get32(buf + 0);
|
|
1354
|
+
if ((bool)((item.ID & kFlag) != 0) != (bool)(i < numNameItems))
|
|
1355
|
+
return S_FALSE;
|
|
1356
|
+
item.Offset = Get32(buf + 4);
|
|
1357
|
+
items.AddInReserved(item);
|
|
1358
|
+
}
|
|
1359
|
+
return S_OK;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
static const UInt32 kFileSizeMax = (UInt32)1 << 31;
|
|
1363
|
+
static const unsigned kNumResItemsMax = (unsigned)1 << 23;
|
|
1364
|
+
static const unsigned kNumStringLangsMax = 256;
|
|
1365
|
+
|
|
1366
|
+
// BITMAPINFOHEADER
|
|
1367
|
+
struct CBitmapInfoHeader
|
|
1368
|
+
{
|
|
1369
|
+
// UInt32 HeaderSize;
|
|
1370
|
+
UInt32 XSize;
|
|
1371
|
+
Int32 YSize;
|
|
1372
|
+
UInt16 Planes;
|
|
1373
|
+
UInt16 BitCount;
|
|
1374
|
+
UInt32 Compression;
|
|
1375
|
+
UInt32 SizeImage;
|
|
1376
|
+
|
|
1377
|
+
bool Parse(const Byte *p, size_t size);
|
|
1378
|
+
};
|
|
1379
|
+
|
|
1380
|
+
static const UInt32 kBitmapInfoHeader_Size = 0x28;
|
|
1381
|
+
|
|
1382
|
+
bool CBitmapInfoHeader::Parse(const Byte *p, size_t size)
|
|
1383
|
+
{
|
|
1384
|
+
if (size < kBitmapInfoHeader_Size || Get32(p) != kBitmapInfoHeader_Size)
|
|
1385
|
+
return false;
|
|
1386
|
+
G32( 4, XSize);
|
|
1387
|
+
G32_signed( 8, YSize);
|
|
1388
|
+
G16(12, Planes);
|
|
1389
|
+
G16(14, BitCount);
|
|
1390
|
+
G32(16, Compression);
|
|
1391
|
+
G32(20, SizeImage);
|
|
1392
|
+
return true;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
static UInt32 GetImageSize(UInt32 xSize, UInt32 ySize, UInt32 bitCount)
|
|
1396
|
+
{
|
|
1397
|
+
return ((xSize * bitCount + 7) / 8 + 3) / 4 * 4 * ySize;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
static UInt32 SetBitmapHeader(Byte *dest, const Byte *src, UInt32 size)
|
|
1401
|
+
{
|
|
1402
|
+
CBitmapInfoHeader h;
|
|
1403
|
+
if (!h.Parse(src, size))
|
|
1404
|
+
return 0;
|
|
1405
|
+
if (h.YSize < 0)
|
|
1406
|
+
h.YSize = -h.YSize;
|
|
1407
|
+
if (h.XSize > (1 << 26)
|
|
1408
|
+
|| h.YSize > (1 << 26)
|
|
1409
|
+
|| h.YSize < 0
|
|
1410
|
+
|| h.Planes != 1 || h.BitCount > 32)
|
|
1411
|
+
return 0;
|
|
1412
|
+
if (h.SizeImage == 0)
|
|
1413
|
+
{
|
|
1414
|
+
if (h.Compression != 0) // BI_RGB
|
|
1415
|
+
return 0;
|
|
1416
|
+
h.SizeImage = GetImageSize(h.XSize, (UInt32)h.YSize, h.BitCount);
|
|
1417
|
+
}
|
|
1418
|
+
UInt32 totalSize = kBmpHeaderSize + size;
|
|
1419
|
+
UInt32 offBits = totalSize - h.SizeImage;
|
|
1420
|
+
// BITMAPFILEHEADER
|
|
1421
|
+
SetUi16(dest, 0x4D42)
|
|
1422
|
+
SetUi32(dest + 2, totalSize)
|
|
1423
|
+
SetUi32(dest + 6, 0)
|
|
1424
|
+
SetUi32(dest + 10, offBits)
|
|
1425
|
+
return kBmpHeaderSize;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
static UInt32 SetIconHeader(Byte *dest, const Byte *src, UInt32 size)
|
|
1429
|
+
{
|
|
1430
|
+
CBitmapInfoHeader h;
|
|
1431
|
+
if (!h.Parse(src, size))
|
|
1432
|
+
return 0;
|
|
1433
|
+
if (h.YSize < 0)
|
|
1434
|
+
h.YSize = -h.YSize;
|
|
1435
|
+
if (h.XSize > (1 << 26)
|
|
1436
|
+
|| h.YSize > (1 << 26)
|
|
1437
|
+
|| h.YSize < 0
|
|
1438
|
+
|| h.Planes != 1
|
|
1439
|
+
|| h.Compression != 0) // BI_RGB
|
|
1440
|
+
return 0;
|
|
1441
|
+
|
|
1442
|
+
const UInt32 numBitCount = h.BitCount;
|
|
1443
|
+
if (numBitCount != 1 &&
|
|
1444
|
+
numBitCount != 4 &&
|
|
1445
|
+
numBitCount != 8 &&
|
|
1446
|
+
numBitCount != 24 &&
|
|
1447
|
+
numBitCount != 32)
|
|
1448
|
+
return 0;
|
|
1449
|
+
|
|
1450
|
+
if ((h.YSize & 1) != 0)
|
|
1451
|
+
return 0;
|
|
1452
|
+
h.YSize /= 2;
|
|
1453
|
+
if (h.XSize > 0x100 || h.YSize > 0x100)
|
|
1454
|
+
return 0;
|
|
1455
|
+
|
|
1456
|
+
UInt32 imageSize;
|
|
1457
|
+
// imageSize is not correct if AND mask array contains zeros
|
|
1458
|
+
// in this case it is equal image1Size
|
|
1459
|
+
|
|
1460
|
+
// UInt32 imageSize = h.SizeImage;
|
|
1461
|
+
// if (imageSize == 0)
|
|
1462
|
+
// {
|
|
1463
|
+
const UInt32 image1Size = GetImageSize(h.XSize, (UInt32)h.YSize, h.BitCount);
|
|
1464
|
+
const UInt32 image2Size = GetImageSize(h.XSize, (UInt32)h.YSize, 1);
|
|
1465
|
+
imageSize = image1Size + image2Size;
|
|
1466
|
+
// }
|
|
1467
|
+
UInt32 numColors = 0;
|
|
1468
|
+
if (numBitCount < 16)
|
|
1469
|
+
numColors = 1 << numBitCount;
|
|
1470
|
+
|
|
1471
|
+
SetUi16(dest, 0) // Reserved
|
|
1472
|
+
SetUi16(dest + 2, 1) // RES_ICON
|
|
1473
|
+
SetUi16(dest + 4, 1) // ResCount
|
|
1474
|
+
|
|
1475
|
+
dest[6] = (Byte)h.XSize; // Width
|
|
1476
|
+
dest[7] = (Byte)h.YSize; // Height
|
|
1477
|
+
dest[8] = (Byte)numColors; // ColorCount
|
|
1478
|
+
dest[9] = 0; // Reserved
|
|
1479
|
+
|
|
1480
|
+
SetUi32(dest + 10, 0) // Reserved1 / Reserved2
|
|
1481
|
+
|
|
1482
|
+
UInt32 numQuadsBytes = numColors * 4;
|
|
1483
|
+
UInt32 BytesInRes = kBitmapInfoHeader_Size + numQuadsBytes + imageSize;
|
|
1484
|
+
SetUi32(dest + 14, BytesInRes)
|
|
1485
|
+
SetUi32(dest + 18, kIconHeaderSize)
|
|
1486
|
+
|
|
1487
|
+
/*
|
|
1488
|
+
Description = DWORDToString(xSize) +
|
|
1489
|
+
kDelimiterChar + DWORDToString(ySize) +
|
|
1490
|
+
kDelimiterChar + DWORDToString(numBitCount);
|
|
1491
|
+
*/
|
|
1492
|
+
return kIconHeaderSize;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
bool CHandler::ParseStringRes(UInt32 id, UInt32 lang, const Byte *src, UInt32 size)
|
|
1496
|
+
{
|
|
1497
|
+
if ((size & 1) != 0)
|
|
1498
|
+
return false;
|
|
1499
|
+
|
|
1500
|
+
unsigned i;
|
|
1501
|
+
for (i = 0; i < _strings.Size(); i++)
|
|
1502
|
+
if (_strings[i].Lang == lang)
|
|
1503
|
+
break;
|
|
1504
|
+
if (i == _strings.Size())
|
|
1505
|
+
{
|
|
1506
|
+
if (_strings.Size() >= kNumStringLangsMax)
|
|
1507
|
+
return false;
|
|
1508
|
+
CStringItem &item = _strings.AddNew();
|
|
1509
|
+
item.Lang = lang;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
CStringItem &item = _strings[i];
|
|
1513
|
+
id = (id - 1) << 4;
|
|
1514
|
+
UInt32 pos = 0;
|
|
1515
|
+
for (i = 0; i < 16; i++)
|
|
1516
|
+
{
|
|
1517
|
+
if (size - pos < 2)
|
|
1518
|
+
return false;
|
|
1519
|
+
UInt32 len = Get16(src + pos);
|
|
1520
|
+
pos += 2;
|
|
1521
|
+
if (len != 0)
|
|
1522
|
+
{
|
|
1523
|
+
if (size - pos < len * 2)
|
|
1524
|
+
return false;
|
|
1525
|
+
char temp[32];
|
|
1526
|
+
ConvertUInt32ToString(id + i, temp);
|
|
1527
|
+
size_t tempLen = strlen(temp);
|
|
1528
|
+
size_t j;
|
|
1529
|
+
for (j = 0; j < tempLen; j++)
|
|
1530
|
+
item.AddChar(temp[j]);
|
|
1531
|
+
item.AddChar('\t');
|
|
1532
|
+
for (j = 0; j < len; j++, pos += 2)
|
|
1533
|
+
item.AddWChar_Smart(Get16(src + pos));
|
|
1534
|
+
item.NewLine();
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
if (size == pos)
|
|
1538
|
+
return true;
|
|
1539
|
+
|
|
1540
|
+
// Some rare case files have additional ZERO.
|
|
1541
|
+
if (size == pos + 2 && Get16(src + pos) == 0)
|
|
1542
|
+
return true;
|
|
1543
|
+
|
|
1544
|
+
return false;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
// ---------- VERSION ----------
|
|
1549
|
+
|
|
1550
|
+
static const UInt32 kMy_VS_FFI_SIGNATURE = 0xFEEF04BD;
|
|
1551
|
+
|
|
1552
|
+
struct CMy_VS_FIXEDFILEINFO
|
|
1553
|
+
{
|
|
1554
|
+
// UInt32 Signature;
|
|
1555
|
+
// UInt32 StrucVersion;
|
|
1556
|
+
UInt32 VersionMS;
|
|
1557
|
+
UInt32 VersionLS;
|
|
1558
|
+
UInt32 ProductVersionMS;
|
|
1559
|
+
UInt32 ProductVersionLS;
|
|
1560
|
+
UInt32 FlagsMask;
|
|
1561
|
+
UInt32 Flags;
|
|
1562
|
+
UInt32 OS;
|
|
1563
|
+
UInt32 Type;
|
|
1564
|
+
UInt32 Subtype;
|
|
1565
|
+
// UInt32 DateMS;
|
|
1566
|
+
// UInt32 DateLS;
|
|
1567
|
+
|
|
1568
|
+
bool Parse(const Byte *p);
|
|
1569
|
+
void PrintToTextFile(CTextFile &f, CObjectVector<CStringKeyValue> &keys);
|
|
1570
|
+
};
|
|
1571
|
+
|
|
1572
|
+
bool CMy_VS_FIXEDFILEINFO::Parse(const Byte *p)
|
|
1573
|
+
{
|
|
1574
|
+
if (Get32(p) != kMy_VS_FFI_SIGNATURE) // signature;
|
|
1575
|
+
return false;
|
|
1576
|
+
// G32(0x04, StrucVersion);
|
|
1577
|
+
G32(0x08, VersionMS);
|
|
1578
|
+
G32(0x0C, VersionLS);
|
|
1579
|
+
G32(0x10, ProductVersionMS);
|
|
1580
|
+
G32(0x14, ProductVersionLS);
|
|
1581
|
+
G32(0x18, FlagsMask);
|
|
1582
|
+
G32(0x1C, Flags);
|
|
1583
|
+
G32(0x20, OS);
|
|
1584
|
+
G32(0x24, Type);
|
|
1585
|
+
G32(0x28, Subtype);
|
|
1586
|
+
// G32(0x2C, DateMS);
|
|
1587
|
+
// G32(0x30, DateLS);
|
|
1588
|
+
return true;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
static void PrintUInt32(CTextFile &f, UInt32 v)
|
|
1592
|
+
{
|
|
1593
|
+
char s[16];
|
|
1594
|
+
ConvertUInt32ToString(v, s);
|
|
1595
|
+
f.AddString(s);
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
static inline void PrintUInt32(UString &dest, UInt32 v)
|
|
1599
|
+
{
|
|
1600
|
+
dest.Add_UInt32(v);
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
static void PrintHex(CTextFile &f, UInt32 val)
|
|
1604
|
+
{
|
|
1605
|
+
char temp[16];
|
|
1606
|
+
temp[0] = '0';
|
|
1607
|
+
temp[1] = 'x';
|
|
1608
|
+
ConvertUInt32ToHex(val, temp + 2);
|
|
1609
|
+
f.AddString(temp);
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
static void PrintVersion(CTextFile &f, UInt32 ms, UInt32 ls)
|
|
1613
|
+
{
|
|
1614
|
+
PrintUInt32(f, HIWORD(ms)); f.AddChar(',');
|
|
1615
|
+
PrintUInt32(f, LOWORD(ms)); f.AddChar(',');
|
|
1616
|
+
PrintUInt32(f, HIWORD(ls)); f.AddChar(',');
|
|
1617
|
+
PrintUInt32(f, LOWORD(ls));
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
static void PrintVersion(UString &s, UInt32 ms, UInt32 ls)
|
|
1621
|
+
{
|
|
1622
|
+
PrintUInt32(s, HIWORD(ms)); s.Add_Dot();
|
|
1623
|
+
PrintUInt32(s, LOWORD(ms)); s.Add_Dot();
|
|
1624
|
+
PrintUInt32(s, HIWORD(ls)); s.Add_Dot();
|
|
1625
|
+
PrintUInt32(s, LOWORD(ls));
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
static const char * const k_VS_FileFlags[] =
|
|
1629
|
+
{
|
|
1630
|
+
"DEBUG"
|
|
1631
|
+
, "PRERELEASE"
|
|
1632
|
+
, "PATCHED"
|
|
1633
|
+
, "PRIVATEBUILD"
|
|
1634
|
+
, "INFOINFERRED"
|
|
1635
|
+
, "SPECIALBUILD"
|
|
1636
|
+
};
|
|
1637
|
+
|
|
1638
|
+
static const CUInt32PCharPair k_VS_FileOS[] =
|
|
1639
|
+
{
|
|
1640
|
+
{ 0x10001, "VOS_DOS_WINDOWS16" },
|
|
1641
|
+
{ 0x10004, "VOS_DOS_WINDOWS32" },
|
|
1642
|
+
{ 0x20002, "VOS_OS216_PM16" },
|
|
1643
|
+
{ 0x30003, "VOS_OS232_PM32" },
|
|
1644
|
+
{ 0x40004, "VOS_NT_WINDOWS32" }
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1647
|
+
static const char * const k_VS_FileOS_High[] =
|
|
1648
|
+
{
|
|
1649
|
+
"VOS_UNKNOWN"
|
|
1650
|
+
, "VOS_DOS"
|
|
1651
|
+
, "VOS_OS216"
|
|
1652
|
+
, "VOS_OS232"
|
|
1653
|
+
, "VOS_NT"
|
|
1654
|
+
, "VOS_WINCE"
|
|
1655
|
+
};
|
|
1656
|
+
|
|
1657
|
+
static const UInt32 kMY_VFT_DRV = 3;
|
|
1658
|
+
static const UInt32 kMY_VFT_FONT = 4;
|
|
1659
|
+
|
|
1660
|
+
static const char * const k_VS_FileOS_Low[] =
|
|
1661
|
+
{
|
|
1662
|
+
"VOS__BASE"
|
|
1663
|
+
, "VOS__WINDOWS16"
|
|
1664
|
+
, "VOS__PM16"
|
|
1665
|
+
, "VOS__PM32"
|
|
1666
|
+
, "VOS__WINDOWS32"
|
|
1667
|
+
};
|
|
1668
|
+
|
|
1669
|
+
static const char * const k_VS_FileType[] =
|
|
1670
|
+
{
|
|
1671
|
+
"VFT_UNKNOWN"
|
|
1672
|
+
, "VFT_APP"
|
|
1673
|
+
, "VFT_DLL"
|
|
1674
|
+
, "VFT_DRV"
|
|
1675
|
+
, "VFT_FONT"
|
|
1676
|
+
, "VFT_VXD"
|
|
1677
|
+
, "0x6"
|
|
1678
|
+
, "VFT_STATIC_LIB"
|
|
1679
|
+
};
|
|
1680
|
+
|
|
1681
|
+
// Subtype for VFT_DRV Type
|
|
1682
|
+
static const char * const k_VS_FileSubType_DRV[] =
|
|
1683
|
+
{
|
|
1684
|
+
"0"
|
|
1685
|
+
, "PRINTER"
|
|
1686
|
+
, "KEYBOARD"
|
|
1687
|
+
, "LANGUAGE"
|
|
1688
|
+
, "DISPLAY"
|
|
1689
|
+
, "MOUSE"
|
|
1690
|
+
, "NETWORK"
|
|
1691
|
+
, "SYSTEM"
|
|
1692
|
+
, "INSTALLABLE"
|
|
1693
|
+
, "SOUND"
|
|
1694
|
+
, "COMM"
|
|
1695
|
+
, "INPUTMETHOD"
|
|
1696
|
+
, "VERSIONED_PRINTER"
|
|
1697
|
+
};
|
|
1698
|
+
|
|
1699
|
+
// Subtype for VFT_FONT Type
|
|
1700
|
+
static const char * const k_VS_FileSubType_FONT[] =
|
|
1701
|
+
{
|
|
1702
|
+
"0"
|
|
1703
|
+
, "VFT2_FONT_RASTER"
|
|
1704
|
+
, "VFT2_FONT_VECTOR"
|
|
1705
|
+
, "VFT2_FONT_TRUETYPE"
|
|
1706
|
+
};
|
|
1707
|
+
|
|
1708
|
+
static int FindKey(CObjectVector<CStringKeyValue> &v, const char *key)
|
|
1709
|
+
{
|
|
1710
|
+
FOR_VECTOR (i, v)
|
|
1711
|
+
if (v[i].Key.IsEqualTo(key))
|
|
1712
|
+
return (int)i;
|
|
1713
|
+
return -1;
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
static void AddToUniqueUStringVector(CObjectVector<CStringKeyValue> &v, const UString &key, const UString &value)
|
|
1717
|
+
{
|
|
1718
|
+
bool needInsert = false;
|
|
1719
|
+
unsigned i;
|
|
1720
|
+
for (i = 0; i < v.Size(); i++)
|
|
1721
|
+
{
|
|
1722
|
+
if (v[i].Key == key)
|
|
1723
|
+
{
|
|
1724
|
+
if (v[i].Value == value)
|
|
1725
|
+
return;
|
|
1726
|
+
needInsert = true;
|
|
1727
|
+
}
|
|
1728
|
+
else if (needInsert)
|
|
1729
|
+
break;
|
|
1730
|
+
}
|
|
1731
|
+
CStringKeyValue &pair = v.InsertNew(i);
|
|
1732
|
+
pair.Key = key;
|
|
1733
|
+
pair.Value = value;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
void CMy_VS_FIXEDFILEINFO::PrintToTextFile(CTextFile &f, CObjectVector<CStringKeyValue> &keys)
|
|
1737
|
+
{
|
|
1738
|
+
f.AddString("FILEVERSION ");
|
|
1739
|
+
PrintVersion(f, VersionMS, VersionLS);
|
|
1740
|
+
f.NewLine();
|
|
1741
|
+
|
|
1742
|
+
f.AddString("PRODUCTVERSION ");
|
|
1743
|
+
PrintVersion(f, ProductVersionMS, ProductVersionLS);
|
|
1744
|
+
f.NewLine();
|
|
1745
|
+
|
|
1746
|
+
{
|
|
1747
|
+
UString s;
|
|
1748
|
+
PrintVersion(s, VersionMS, VersionLS);
|
|
1749
|
+
AddToUniqueUStringVector(keys, L"FileVersion", s);
|
|
1750
|
+
}
|
|
1751
|
+
{
|
|
1752
|
+
UString s;
|
|
1753
|
+
PrintVersion(s, ProductVersionMS, ProductVersionLS);
|
|
1754
|
+
AddToUniqueUStringVector(keys, L"ProductVersion", s);
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
f.AddString("FILEFLAGSMASK ");
|
|
1758
|
+
PrintHex(f, FlagsMask);
|
|
1759
|
+
f.NewLine();
|
|
1760
|
+
|
|
1761
|
+
f.AddString("FILEFLAGS ");
|
|
1762
|
+
{
|
|
1763
|
+
bool wasPrinted = false;
|
|
1764
|
+
for (unsigned i = 0; i < Z7_ARRAY_SIZE(k_VS_FileFlags); i++)
|
|
1765
|
+
{
|
|
1766
|
+
if ((Flags & ((UInt32)1 << i)) != 0)
|
|
1767
|
+
{
|
|
1768
|
+
if (wasPrinted)
|
|
1769
|
+
f.AddString(" | ");
|
|
1770
|
+
f.AddString("VS_FF_");
|
|
1771
|
+
f.AddString(k_VS_FileFlags[i]);
|
|
1772
|
+
wasPrinted = true;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
UInt32 v = Flags & ~(((UInt32)1 << Z7_ARRAY_SIZE(k_VS_FileFlags)) - 1);
|
|
1776
|
+
if (v != 0 || !wasPrinted)
|
|
1777
|
+
{
|
|
1778
|
+
if (wasPrinted)
|
|
1779
|
+
f.AddString(" | ");
|
|
1780
|
+
PrintHex(f, v);
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
f.NewLine();
|
|
1784
|
+
|
|
1785
|
+
// OS = 0x111230;
|
|
1786
|
+
f.AddString("FILEOS ");
|
|
1787
|
+
unsigned i;
|
|
1788
|
+
for (i = 0; i < Z7_ARRAY_SIZE(k_VS_FileOS); i++)
|
|
1789
|
+
{
|
|
1790
|
+
const CUInt32PCharPair &pair = k_VS_FileOS[i];
|
|
1791
|
+
if (OS == pair.Value)
|
|
1792
|
+
{
|
|
1793
|
+
// continue;
|
|
1794
|
+
// f.AddString("VOS_");
|
|
1795
|
+
f.AddString(pair.Name);
|
|
1796
|
+
break;
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
if (i == Z7_ARRAY_SIZE(k_VS_FileOS))
|
|
1800
|
+
{
|
|
1801
|
+
UInt32 high = OS >> 16;
|
|
1802
|
+
if (high < Z7_ARRAY_SIZE(k_VS_FileOS_High))
|
|
1803
|
+
f.AddString(k_VS_FileOS_High[high]);
|
|
1804
|
+
else
|
|
1805
|
+
PrintHex(f, high << 16);
|
|
1806
|
+
UInt32 low = OS & 0xFFFF;
|
|
1807
|
+
if (low != 0)
|
|
1808
|
+
{
|
|
1809
|
+
f.AddString(" | ");
|
|
1810
|
+
if (low < Z7_ARRAY_SIZE(k_VS_FileOS_Low))
|
|
1811
|
+
f.AddString(k_VS_FileOS_Low[low]);
|
|
1812
|
+
else
|
|
1813
|
+
PrintHex(f, low);
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
f.NewLine();
|
|
1817
|
+
|
|
1818
|
+
f.AddString("FILETYPE ");
|
|
1819
|
+
if (Type < Z7_ARRAY_SIZE(k_VS_FileType))
|
|
1820
|
+
f.AddString(k_VS_FileType[Type]);
|
|
1821
|
+
else
|
|
1822
|
+
PrintHex(f, Type);
|
|
1823
|
+
f.NewLine();
|
|
1824
|
+
|
|
1825
|
+
f.AddString("FILESUBTYPE ");
|
|
1826
|
+
bool needPrintSubType = true;
|
|
1827
|
+
if (Type == kMY_VFT_DRV)
|
|
1828
|
+
{
|
|
1829
|
+
if (Subtype != 0 && Subtype < Z7_ARRAY_SIZE(k_VS_FileSubType_DRV))
|
|
1830
|
+
{
|
|
1831
|
+
f.AddString("VFT2_DRV_");
|
|
1832
|
+
f.AddString(k_VS_FileSubType_DRV[Subtype]);
|
|
1833
|
+
needPrintSubType = false;
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
else if (Type == kMY_VFT_FONT)
|
|
1837
|
+
{
|
|
1838
|
+
if (Subtype != 0 && Subtype < Z7_ARRAY_SIZE(k_VS_FileSubType_FONT))
|
|
1839
|
+
{
|
|
1840
|
+
f.AddString(k_VS_FileSubType_FONT[Subtype]);
|
|
1841
|
+
needPrintSubType = false;
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
if (needPrintSubType)
|
|
1845
|
+
PrintHex(f, Subtype);
|
|
1846
|
+
f.NewLine();
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
static void CopyToUString(const Byte *p, UString &s)
|
|
1850
|
+
{
|
|
1851
|
+
for (;;)
|
|
1852
|
+
{
|
|
1853
|
+
const wchar_t c = (wchar_t)Get16(p);
|
|
1854
|
+
p += 2;
|
|
1855
|
+
if (c == 0)
|
|
1856
|
+
return;
|
|
1857
|
+
s += c;
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
static void CopyToUString_ByLen16(const Byte *p, unsigned numChars16, UString &s)
|
|
1862
|
+
{
|
|
1863
|
+
for (; numChars16; numChars16--)
|
|
1864
|
+
{
|
|
1865
|
+
const wchar_t c = (wchar_t)Get16(p);
|
|
1866
|
+
p += 2;
|
|
1867
|
+
s += c;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
static bool CompareWStrStrings(const Byte *p, const char *s)
|
|
1872
|
+
{
|
|
1873
|
+
unsigned pos = 0;
|
|
1874
|
+
for (;;)
|
|
1875
|
+
{
|
|
1876
|
+
const Byte c = (Byte)*s++;
|
|
1877
|
+
if (Get16(p + pos) != c)
|
|
1878
|
+
return false;
|
|
1879
|
+
pos += 2;
|
|
1880
|
+
if (c == 0)
|
|
1881
|
+
return true;
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
struct CVersionBlock
|
|
1886
|
+
{
|
|
1887
|
+
UInt32 TotalLen;
|
|
1888
|
+
UInt32 ValueLen;
|
|
1889
|
+
unsigned IsTextValue;
|
|
1890
|
+
unsigned StrSize;
|
|
1891
|
+
|
|
1892
|
+
bool Parse(const Byte *p, UInt32 size);
|
|
1893
|
+
};
|
|
1894
|
+
|
|
1895
|
+
static int Get_Utf16Str_Len_InBytes(const Byte *p, size_t size)
|
|
1896
|
+
{
|
|
1897
|
+
unsigned pos = 0;
|
|
1898
|
+
for (;;)
|
|
1899
|
+
{
|
|
1900
|
+
if (pos + 1 >= size)
|
|
1901
|
+
return -1;
|
|
1902
|
+
if (Get16(p + pos) == 0)
|
|
1903
|
+
return (int)pos;
|
|
1904
|
+
pos += 2;
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
static int Get_Utf16Str_Len_InBytes_AllowNonZeroTail(const Byte *p, size_t size)
|
|
1909
|
+
{
|
|
1910
|
+
unsigned pos = 0;
|
|
1911
|
+
for (;;)
|
|
1912
|
+
{
|
|
1913
|
+
if (pos + 1 >= size)
|
|
1914
|
+
{
|
|
1915
|
+
if (pos == size)
|
|
1916
|
+
return (int)pos;
|
|
1917
|
+
return -1;
|
|
1918
|
+
}
|
|
1919
|
+
if (Get16(p + pos) == 0)
|
|
1920
|
+
return (int)pos;
|
|
1921
|
+
pos += 2;
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
static const unsigned k_ResoureBlockHeader_Size = 6;
|
|
1926
|
+
|
|
1927
|
+
bool CVersionBlock::Parse(const Byte *p, UInt32 size)
|
|
1928
|
+
{
|
|
1929
|
+
if (size < k_ResoureBlockHeader_Size)
|
|
1930
|
+
return false;
|
|
1931
|
+
TotalLen = Get16(p);
|
|
1932
|
+
ValueLen = Get16(p + 2);
|
|
1933
|
+
if (TotalLen < k_ResoureBlockHeader_Size || TotalLen > size)
|
|
1934
|
+
return false;
|
|
1935
|
+
IsTextValue = Get16(p + 4);
|
|
1936
|
+
if (IsTextValue > 1)
|
|
1937
|
+
return false;
|
|
1938
|
+
StrSize = 0;
|
|
1939
|
+
const int t = Get_Utf16Str_Len_InBytes(p + k_ResoureBlockHeader_Size,
|
|
1940
|
+
TotalLen - k_ResoureBlockHeader_Size);
|
|
1941
|
+
if (t < 0)
|
|
1942
|
+
return false;
|
|
1943
|
+
StrSize = (unsigned)t;
|
|
1944
|
+
return true;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
static void AddParamString(CTextFile &f, const Byte *p, size_t sLen)
|
|
1948
|
+
{
|
|
1949
|
+
f.AddChar(' ');
|
|
1950
|
+
f.AddChar('\"');
|
|
1951
|
+
f.AddBytes(p, sLen);
|
|
1952
|
+
f.AddChar('\"');
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
static bool ParseVersion(const Byte *p, UInt32 size, CTextFile &f, CObjectVector<CStringKeyValue> &keys)
|
|
1956
|
+
{
|
|
1957
|
+
UInt32 pos;
|
|
1958
|
+
{
|
|
1959
|
+
const unsigned k_sizeof_VS_FIXEDFILEINFO = 13 * 4;
|
|
1960
|
+
|
|
1961
|
+
CVersionBlock vb;
|
|
1962
|
+
if (!vb.Parse(p, size))
|
|
1963
|
+
return false;
|
|
1964
|
+
if (vb.ValueLen != k_sizeof_VS_FIXEDFILEINFO) // maybe 0 is allowed here?
|
|
1965
|
+
return false;
|
|
1966
|
+
if (vb.IsTextValue)
|
|
1967
|
+
return false;
|
|
1968
|
+
pos = k_ResoureBlockHeader_Size;
|
|
1969
|
+
if (!CompareWStrStrings(p + pos, "VS_VERSION_INFO"))
|
|
1970
|
+
return false;
|
|
1971
|
+
pos += vb.StrSize + 2;
|
|
1972
|
+
pos += (4 - pos) & 3;
|
|
1973
|
+
if (pos + vb.ValueLen > vb.TotalLen)
|
|
1974
|
+
return false;
|
|
1975
|
+
/* sometimes resource contains zeros in remainder.
|
|
1976
|
+
So we don't check that size != vb.TotalLen
|
|
1977
|
+
// if (size != vb.TotalLen) return false;
|
|
1978
|
+
*/
|
|
1979
|
+
if (size > vb.TotalLen)
|
|
1980
|
+
size = vb.TotalLen;
|
|
1981
|
+
CMy_VS_FIXEDFILEINFO FixedFileInfo;
|
|
1982
|
+
if (!FixedFileInfo.Parse(p + pos))
|
|
1983
|
+
return false;
|
|
1984
|
+
FixedFileInfo.PrintToTextFile(f, keys);
|
|
1985
|
+
pos += vb.ValueLen;
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
f.OpenBlock(0);
|
|
1989
|
+
|
|
1990
|
+
for (;;)
|
|
1991
|
+
{
|
|
1992
|
+
pos += (4 - pos) & 3;
|
|
1993
|
+
if (pos >= size)
|
|
1994
|
+
break;
|
|
1995
|
+
|
|
1996
|
+
CVersionBlock vb;
|
|
1997
|
+
if (!vb.Parse(p + pos, size - pos))
|
|
1998
|
+
return false;
|
|
1999
|
+
if (vb.ValueLen != 0)
|
|
2000
|
+
return false;
|
|
2001
|
+
const UInt32 endPos = pos + vb.TotalLen;
|
|
2002
|
+
pos += k_ResoureBlockHeader_Size;
|
|
2003
|
+
|
|
2004
|
+
f.AddSpaces(2);
|
|
2005
|
+
f.AddString("BLOCK");
|
|
2006
|
+
AddParamString(f, p + pos, vb.StrSize);
|
|
2007
|
+
|
|
2008
|
+
f.NewLine();
|
|
2009
|
+
f.OpenBlock(2);
|
|
2010
|
+
|
|
2011
|
+
if (CompareWStrStrings(p + pos, "VarFileInfo"))
|
|
2012
|
+
{
|
|
2013
|
+
pos += vb.StrSize + 2;
|
|
2014
|
+
for (;;)
|
|
2015
|
+
{
|
|
2016
|
+
pos += (4 - pos) & 3;
|
|
2017
|
+
if (pos >= endPos)
|
|
2018
|
+
break;
|
|
2019
|
+
CVersionBlock vb2;
|
|
2020
|
+
if (!vb2.Parse(p + pos, endPos - pos))
|
|
2021
|
+
return false;
|
|
2022
|
+
const UInt32 endPos2 = pos + vb2.TotalLen;
|
|
2023
|
+
if (vb2.IsTextValue)
|
|
2024
|
+
return false;
|
|
2025
|
+
pos += k_ResoureBlockHeader_Size;
|
|
2026
|
+
f.AddSpaces(4);
|
|
2027
|
+
f.AddString("VALUE");
|
|
2028
|
+
AddParamString(f, p + pos, vb2.StrSize);
|
|
2029
|
+
if (!CompareWStrStrings(p + pos, "Translation"))
|
|
2030
|
+
return false;
|
|
2031
|
+
pos += vb2.StrSize + 2;
|
|
2032
|
+
pos += (4 - pos) & 3;
|
|
2033
|
+
if (pos + vb2.ValueLen != endPos2)
|
|
2034
|
+
return false;
|
|
2035
|
+
if ((vb2.ValueLen & 3) != 0)
|
|
2036
|
+
return false;
|
|
2037
|
+
UInt32 num = (vb2.ValueLen >> 2);
|
|
2038
|
+
for (; num != 0; num--, pos += 4)
|
|
2039
|
+
{
|
|
2040
|
+
const UInt32 dw = Get32(p + pos);
|
|
2041
|
+
const UInt32 lang = LOWORD(dw);
|
|
2042
|
+
const UInt32 codePage = HIWORD(dw);
|
|
2043
|
+
|
|
2044
|
+
f.AddString(", ");
|
|
2045
|
+
PrintHex(f, lang);
|
|
2046
|
+
f.AddString(", ");
|
|
2047
|
+
PrintUInt32(f, codePage);
|
|
2048
|
+
}
|
|
2049
|
+
f.NewLine();
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
else
|
|
2053
|
+
{
|
|
2054
|
+
if (!CompareWStrStrings(p + pos, "StringFileInfo"))
|
|
2055
|
+
return false;
|
|
2056
|
+
pos += vb.StrSize + 2;
|
|
2057
|
+
for (;;)
|
|
2058
|
+
{
|
|
2059
|
+
pos += (4 - pos) & 3;
|
|
2060
|
+
if (pos >= endPos)
|
|
2061
|
+
break;
|
|
2062
|
+
CVersionBlock vb2;
|
|
2063
|
+
if (!vb2.Parse(p + pos, endPos - pos))
|
|
2064
|
+
return false;
|
|
2065
|
+
const UInt32 endPos2 = pos + vb2.TotalLen;
|
|
2066
|
+
if (vb2.ValueLen != 0)
|
|
2067
|
+
return false;
|
|
2068
|
+
pos += k_ResoureBlockHeader_Size;
|
|
2069
|
+
|
|
2070
|
+
f.AddSpaces(4);
|
|
2071
|
+
f.AddString("BLOCK");
|
|
2072
|
+
AddParamString(f, p + pos, vb2.StrSize);
|
|
2073
|
+
pos += vb2.StrSize + 2;
|
|
2074
|
+
|
|
2075
|
+
f.NewLine();
|
|
2076
|
+
f.OpenBlock(4);
|
|
2077
|
+
|
|
2078
|
+
for (;;)
|
|
2079
|
+
{
|
|
2080
|
+
pos += (4 - pos) & 3;
|
|
2081
|
+
if (pos >= endPos2)
|
|
2082
|
+
break;
|
|
2083
|
+
|
|
2084
|
+
CVersionBlock vb3;
|
|
2085
|
+
if (!vb3.Parse(p + pos, endPos2 - pos))
|
|
2086
|
+
return false;
|
|
2087
|
+
// ValueLen is a number of 16-bit characters (usually it includes zero tail character).
|
|
2088
|
+
const UInt32 endPos3 = pos + vb3.TotalLen;
|
|
2089
|
+
pos += k_ResoureBlockHeader_Size;
|
|
2090
|
+
|
|
2091
|
+
// we don't write string if it's not text
|
|
2092
|
+
if (vb3.IsTextValue)
|
|
2093
|
+
{
|
|
2094
|
+
f.AddSpaces(6);
|
|
2095
|
+
f.AddString("VALUE");
|
|
2096
|
+
AddParamString(f, p + pos, vb3.StrSize);
|
|
2097
|
+
UString key;
|
|
2098
|
+
UString value;
|
|
2099
|
+
CopyToUString(p + pos, key);
|
|
2100
|
+
pos += vb3.StrSize + 2;
|
|
2101
|
+
|
|
2102
|
+
pos += (4 - pos) & 3;
|
|
2103
|
+
if (vb3.ValueLen != 0 && pos /* + 2 */ <= endPos3)
|
|
2104
|
+
{
|
|
2105
|
+
f.AddChar(',');
|
|
2106
|
+
f.AddSpaces((34 - (int)vb3.StrSize) / 2);
|
|
2107
|
+
// vb3.TotalLen for some PE files (not from msvc) doesn't include tail zero at the end of Value string.
|
|
2108
|
+
// we allow that minor error.
|
|
2109
|
+
const int sLen = Get_Utf16Str_Len_InBytes_AllowNonZeroTail(p + pos, endPos3 - pos);
|
|
2110
|
+
if (sLen < 0)
|
|
2111
|
+
return false;
|
|
2112
|
+
/*
|
|
2113
|
+
if (vb3.ValueLen - 1 != (unsigned)sLen / 2 &&
|
|
2114
|
+
vb3.ValueLen != (unsigned)sLen / 2)
|
|
2115
|
+
return false;
|
|
2116
|
+
*/
|
|
2117
|
+
AddParamString(f, p + pos, (unsigned)sLen);
|
|
2118
|
+
CopyToUString_ByLen16(p + pos, (unsigned)sLen / 2, value);
|
|
2119
|
+
// pos += (unsigned)sLen + 2;
|
|
2120
|
+
}
|
|
2121
|
+
AddToUniqueUStringVector(keys, key, value);
|
|
2122
|
+
}
|
|
2123
|
+
pos = endPos3;
|
|
2124
|
+
f.NewLine();
|
|
2125
|
+
}
|
|
2126
|
+
pos = endPos2;
|
|
2127
|
+
f.CloseBlock(4);
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
f.CloseBlock(2);
|
|
2131
|
+
pos = endPos;
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
f.CloseBlock(0);
|
|
2135
|
+
return true;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
|
|
2139
|
+
HRESULT CHandler::OpenResources(unsigned sectionIndex, IInStream *stream, IArchiveOpenCallback *callback)
|
|
2140
|
+
{
|
|
2141
|
+
const CSection § = _sections[sectionIndex];
|
|
2142
|
+
size_t fileSize = sect.PSize;
|
|
2143
|
+
{
|
|
2144
|
+
size_t fileSizeMin = sect.PSize;
|
|
2145
|
+
|
|
2146
|
+
if (sect.VSize < sect.PSize)
|
|
2147
|
+
{
|
|
2148
|
+
fileSize = fileSizeMin = sect.VSize;
|
|
2149
|
+
const int numBits = _optHeader.GetNumFileAlignBits();
|
|
2150
|
+
if (numBits > 0)
|
|
2151
|
+
{
|
|
2152
|
+
const UInt32 mask = ((UInt32)1 << numBits) - 1;
|
|
2153
|
+
const size_t end = (size_t)((sect.VSize + mask) & (UInt32)~mask);
|
|
2154
|
+
if (end > sect.VSize)
|
|
2155
|
+
{
|
|
2156
|
+
if (end <= sect.PSize)
|
|
2157
|
+
fileSize = end;
|
|
2158
|
+
else
|
|
2159
|
+
fileSize = sect.PSize;
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
if (fileSize > kFileSizeMax)
|
|
2165
|
+
return S_FALSE;
|
|
2166
|
+
|
|
2167
|
+
{
|
|
2168
|
+
const UInt64 fileSize64 = fileSize;
|
|
2169
|
+
if (callback)
|
|
2170
|
+
RINOK(callback->SetTotal(NULL, &fileSize64))
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
RINOK(InStream_SeekSet(stream, sect.Pa))
|
|
2174
|
+
|
|
2175
|
+
_buf.Alloc(fileSize);
|
|
2176
|
+
|
|
2177
|
+
size_t pos;
|
|
2178
|
+
|
|
2179
|
+
for (pos = 0; pos < fileSize;)
|
|
2180
|
+
{
|
|
2181
|
+
{
|
|
2182
|
+
const UInt64 offset64 = pos;
|
|
2183
|
+
if (callback)
|
|
2184
|
+
RINOK(callback->SetCompleted(NULL, &offset64))
|
|
2185
|
+
}
|
|
2186
|
+
size_t rem = MyMin(fileSize - pos, (size_t)(1 << 22));
|
|
2187
|
+
RINOK(ReadStream(stream, _buf + pos, &rem))
|
|
2188
|
+
if (rem == 0)
|
|
2189
|
+
{
|
|
2190
|
+
if (pos < fileSizeMin)
|
|
2191
|
+
return S_FALSE;
|
|
2192
|
+
break;
|
|
2193
|
+
}
|
|
2194
|
+
pos += rem;
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
if (pos < fileSize)
|
|
2198
|
+
memset(_buf + pos, 0, fileSize - pos);
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
_usedRes.Alloc(fileSize);
|
|
2202
|
+
CRecordVector<CTableItem> specItems;
|
|
2203
|
+
RINOK(ReadTable(0, specItems))
|
|
2204
|
+
|
|
2205
|
+
_oneLang = true;
|
|
2206
|
+
bool stringsOk = true;
|
|
2207
|
+
size_t maxOffset = 0;
|
|
2208
|
+
|
|
2209
|
+
FOR_VECTOR (i, specItems)
|
|
2210
|
+
{
|
|
2211
|
+
const CTableItem &item1 = specItems[i];
|
|
2212
|
+
if ((item1.Offset & kFlag) == 0)
|
|
2213
|
+
return S_FALSE;
|
|
2214
|
+
|
|
2215
|
+
CRecordVector<CTableItem> specItems2;
|
|
2216
|
+
RINOK(ReadTable(item1.Offset & kMask, specItems2))
|
|
2217
|
+
|
|
2218
|
+
FOR_VECTOR (j, specItems2)
|
|
2219
|
+
{
|
|
2220
|
+
const CTableItem &item2 = specItems2[j];
|
|
2221
|
+
if ((item2.Offset & kFlag) == 0)
|
|
2222
|
+
return S_FALSE;
|
|
2223
|
+
|
|
2224
|
+
CRecordVector<CTableItem> specItems3;
|
|
2225
|
+
RINOK(ReadTable(item2.Offset & kMask, specItems3))
|
|
2226
|
+
|
|
2227
|
+
CResItem item;
|
|
2228
|
+
item.Type = item1.ID;
|
|
2229
|
+
item.ID = item2.ID;
|
|
2230
|
+
|
|
2231
|
+
FOR_VECTOR (k, specItems3)
|
|
2232
|
+
{
|
|
2233
|
+
if (_items.Size() >= kNumResItemsMax)
|
|
2234
|
+
return S_FALSE;
|
|
2235
|
+
const CTableItem &item3 = specItems3[k];
|
|
2236
|
+
if ((item3.Offset & kFlag) != 0)
|
|
2237
|
+
return S_FALSE;
|
|
2238
|
+
if (item3.Offset >= _buf.Size() || _buf.Size() - item3.Offset < 16)
|
|
2239
|
+
return S_FALSE;
|
|
2240
|
+
const Byte *buf = _buf + item3.Offset;
|
|
2241
|
+
item.Lang = item3.ID;
|
|
2242
|
+
item.Offset = Get32(buf + 0);
|
|
2243
|
+
item.Size = Get32(buf + 4);
|
|
2244
|
+
// UInt32 codePage = Get32(buf + 8);
|
|
2245
|
+
if (Get32(buf + 12) != 0)
|
|
2246
|
+
return S_FALSE;
|
|
2247
|
+
if (!_items.IsEmpty() && _oneLang && !item.IsNameEqual(_items.Back()))
|
|
2248
|
+
_oneLang = false;
|
|
2249
|
+
|
|
2250
|
+
item.HeaderSize = 0;
|
|
2251
|
+
|
|
2252
|
+
size_t offset = item.Offset - sect.Va;
|
|
2253
|
+
if (offset > maxOffset)
|
|
2254
|
+
maxOffset = offset;
|
|
2255
|
+
if (offset + item.Size > maxOffset)
|
|
2256
|
+
maxOffset = offset + item.Size;
|
|
2257
|
+
|
|
2258
|
+
if (CheckItem(sect, item, offset))
|
|
2259
|
+
{
|
|
2260
|
+
const Byte *data = _buf + offset;
|
|
2261
|
+
if (item.IsBmp())
|
|
2262
|
+
item.HeaderSize = SetBitmapHeader(item.Header, data, item.Size);
|
|
2263
|
+
else if (item.IsIcon())
|
|
2264
|
+
item.HeaderSize = SetIconHeader(item.Header, data, item.Size);
|
|
2265
|
+
else if (item.IsString())
|
|
2266
|
+
{
|
|
2267
|
+
if (stringsOk)
|
|
2268
|
+
stringsOk = ParseStringRes(item.ID, item.Lang, data, item.Size);
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
if (item.IsVersion())
|
|
2273
|
+
{
|
|
2274
|
+
if (offset > _buf.Size() || _buf.Size() - offset < item.Size)
|
|
2275
|
+
continue;
|
|
2276
|
+
CTextFile f;
|
|
2277
|
+
if (ParseVersion((const Byte *)_buf + offset, item.Size, f, _versionKeys))
|
|
2278
|
+
{
|
|
2279
|
+
CMixItem mixItem;
|
|
2280
|
+
mixItem.Construct();
|
|
2281
|
+
mixItem.VersionIndex = (int)_versionFiles.Size();
|
|
2282
|
+
mixItem.SectionIndex = (int)sectionIndex; // check it !!!!
|
|
2283
|
+
CByteBuffer_WithLang &vf = _versionFiles.AddNew();
|
|
2284
|
+
vf.Lang = item.Lang;
|
|
2285
|
+
vf.CopyFrom(f.Buf, f.Buf.GetPos());
|
|
2286
|
+
_mixItems.Add(mixItem);
|
|
2287
|
+
continue;
|
|
2288
|
+
}
|
|
2289
|
+
// PrintError("ver.Parse error");
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
item.Enabled = true;
|
|
2293
|
+
_items.Add(item);
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
if (stringsOk && !_strings.IsEmpty())
|
|
2299
|
+
{
|
|
2300
|
+
unsigned i;
|
|
2301
|
+
for (i = 0; i < _items.Size(); i++)
|
|
2302
|
+
{
|
|
2303
|
+
CResItem &item = _items[i];
|
|
2304
|
+
if (item.IsString())
|
|
2305
|
+
item.Enabled = false;
|
|
2306
|
+
}
|
|
2307
|
+
for (i = 0; i < _strings.Size(); i++)
|
|
2308
|
+
{
|
|
2309
|
+
if (_strings[i].FinalSize() == 0)
|
|
2310
|
+
continue;
|
|
2311
|
+
CMixItem mixItem;
|
|
2312
|
+
mixItem.Construct();
|
|
2313
|
+
mixItem.StringIndex = (int)i;
|
|
2314
|
+
mixItem.SectionIndex = (int)sectionIndex;
|
|
2315
|
+
_mixItems.Add(mixItem);
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
_usedRes.Free();
|
|
2320
|
+
|
|
2321
|
+
{
|
|
2322
|
+
// PSize can be much larger than VSize in some exe installers.
|
|
2323
|
+
// it contains archive data after PE resources.
|
|
2324
|
+
// So we need to use PSize here!
|
|
2325
|
+
if (maxOffset < sect.PSize)
|
|
2326
|
+
{
|
|
2327
|
+
size_t end = fileSize;
|
|
2328
|
+
|
|
2329
|
+
// we skip Zeros to start of aligned block
|
|
2330
|
+
size_t i;
|
|
2331
|
+
for (i = maxOffset; i < end; i++)
|
|
2332
|
+
if (_buf[i] != 0)
|
|
2333
|
+
break;
|
|
2334
|
+
if (i == end)
|
|
2335
|
+
maxOffset = end;
|
|
2336
|
+
|
|
2337
|
+
CSection sect2;
|
|
2338
|
+
sect2.Flags = 0;
|
|
2339
|
+
sect2.Pa = sect.Pa + (UInt32)maxOffset;
|
|
2340
|
+
sect2.Va = sect.Va + (UInt32)maxOffset;
|
|
2341
|
+
|
|
2342
|
+
// 9.29: we use sect.PSize instead of sect.VSize to support some CAB-SFX
|
|
2343
|
+
// the code for .rsrc_2 is commented.
|
|
2344
|
+
sect2.PSize = sect.PSize - (UInt32)maxOffset;
|
|
2345
|
+
|
|
2346
|
+
if (sect2.PSize != 0)
|
|
2347
|
+
{
|
|
2348
|
+
sect2.ExtractSize = sect2.VSize = sect2.PSize;
|
|
2349
|
+
sect2.Name = ".rsrc_1";
|
|
2350
|
+
sect2.Time = 0;
|
|
2351
|
+
sect2.IsAdditionalSection = true;
|
|
2352
|
+
_sections.Add(sect2);
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
return S_OK;
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
bool CHeader::ParseCoff(const Byte *p)
|
|
2362
|
+
{
|
|
2363
|
+
ParseBase(p);
|
|
2364
|
+
if (PointerToSymbolTable < kCoffHeaderSize)
|
|
2365
|
+
return false;
|
|
2366
|
+
if (NumSymbols >= (1 << 24))
|
|
2367
|
+
return false;
|
|
2368
|
+
if (OptHeaderSize != 0 && OptHeaderSize < k_OptHeader32_Size_MIN)
|
|
2369
|
+
return false;
|
|
2370
|
+
|
|
2371
|
+
// 18.04: we reduce false detections
|
|
2372
|
+
if (NumSections == 0 && OptHeaderSize == 0)
|
|
2373
|
+
return false;
|
|
2374
|
+
|
|
2375
|
+
for (unsigned i = 0; i < Z7_ARRAY_SIZE(g_MachinePairs); i++)
|
|
2376
|
+
if (Machine == g_MachinePairs[i].Value)
|
|
2377
|
+
return true;
|
|
2378
|
+
if (Machine == 0)
|
|
2379
|
+
return true;
|
|
2380
|
+
|
|
2381
|
+
return false;
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
|
|
2385
|
+
static inline bool CheckPeOffset(UInt32 pe)
|
|
2386
|
+
{
|
|
2387
|
+
// ((pe & 7) == 0) is for most PE files. But there is unusual EFI-PE file that uses unaligned pe value.
|
|
2388
|
+
return pe >= 0x40 && pe <= 0x1000 /* && (pe & 7) == 0 */ ;
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
static const unsigned kStartSize = 0x40;
|
|
2392
|
+
|
|
2393
|
+
API_FUNC_static_IsArc IsArc_Pe(const Byte *p, size_t size)
|
|
2394
|
+
{
|
|
2395
|
+
if (size < 2)
|
|
2396
|
+
return k_IsArc_Res_NEED_MORE;
|
|
2397
|
+
if (p[0] != 'M' || p[1] != 'Z')
|
|
2398
|
+
return k_IsArc_Res_NO;
|
|
2399
|
+
if (size < kStartSize)
|
|
2400
|
+
return k_IsArc_Res_NEED_MORE;
|
|
2401
|
+
UInt32 pe = Get32(p + 0x3C);
|
|
2402
|
+
if (!CheckPeOffset(pe))
|
|
2403
|
+
return k_IsArc_Res_NO;
|
|
2404
|
+
if (pe + kPeHeaderSize > size)
|
|
2405
|
+
return k_IsArc_Res_NEED_MORE;
|
|
2406
|
+
CHeader header;
|
|
2407
|
+
if (!header.ParsePe(p + pe))
|
|
2408
|
+
return k_IsArc_Res_NO;
|
|
2409
|
+
return k_IsArc_Res_YES;
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
|
|
2414
|
+
{
|
|
2415
|
+
UInt32 coffOffset = 0;
|
|
2416
|
+
if (_coffMode)
|
|
2417
|
+
{
|
|
2418
|
+
Byte h[kCoffHeaderSize];
|
|
2419
|
+
RINOK(ReadStream_FALSE(stream, h, kCoffHeaderSize))
|
|
2420
|
+
if (!_header.ParseCoff(h))
|
|
2421
|
+
return S_FALSE;
|
|
2422
|
+
}
|
|
2423
|
+
else
|
|
2424
|
+
{
|
|
2425
|
+
UInt32 _peOffset;
|
|
2426
|
+
{
|
|
2427
|
+
Byte h[kStartSize];
|
|
2428
|
+
RINOK(ReadStream_FALSE(stream, h, kStartSize))
|
|
2429
|
+
if (h[0] != 'M' || h[1] != 'Z')
|
|
2430
|
+
return S_FALSE;
|
|
2431
|
+
/* most of PE files contain 0x0090 at offset 2.
|
|
2432
|
+
But some rare PE files contain another values. So we don't use that check.
|
|
2433
|
+
if (Get16(h + 2) != 0x90) return false; */
|
|
2434
|
+
_peOffset = Get32(h + 0x3C);
|
|
2435
|
+
if (!CheckPeOffset(_peOffset))
|
|
2436
|
+
return S_FALSE;
|
|
2437
|
+
coffOffset = _peOffset + 4;
|
|
2438
|
+
}
|
|
2439
|
+
{
|
|
2440
|
+
Byte h[kPeHeaderSize];
|
|
2441
|
+
RINOK(InStream_SeekSet(stream, _peOffset))
|
|
2442
|
+
RINOK(ReadStream_FALSE(stream, h, kPeHeaderSize))
|
|
2443
|
+
if (!_header.ParsePe(h))
|
|
2444
|
+
return S_FALSE;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
const UInt32 optStart = coffOffset + kCoffHeaderSize;
|
|
2449
|
+
const UInt32 bufSize = _header.OptHeaderSize + (UInt32)_header.NumSections * kSectionSize;
|
|
2450
|
+
_totalSize = optStart + bufSize;
|
|
2451
|
+
CByteBuffer buffer(bufSize);
|
|
2452
|
+
|
|
2453
|
+
RINOK(ReadStream_FALSE(stream, buffer, bufSize))
|
|
2454
|
+
|
|
2455
|
+
// memset((void *)&_optHeader, 0, sizeof(_optHeader));
|
|
2456
|
+
if (_header.OptHeaderSize != 0)
|
|
2457
|
+
if (!_optHeader.Parse(buffer, _header.OptHeaderSize))
|
|
2458
|
+
return S_FALSE;
|
|
2459
|
+
|
|
2460
|
+
UInt32 pos = _header.OptHeaderSize;
|
|
2461
|
+
unsigned i;
|
|
2462
|
+
for (i = 0; i < _header.NumSections; i++, pos += kSectionSize)
|
|
2463
|
+
{
|
|
2464
|
+
CSection § = _sections.AddNew();
|
|
2465
|
+
sect.Parse(buffer + pos);
|
|
2466
|
+
sect.IsRealSect = true;
|
|
2467
|
+
if (sect.Name.IsEqualTo(".reloc"))
|
|
2468
|
+
{
|
|
2469
|
+
const CDirLink &dl = _optHeader.DirItems[kDirLink_BASERELOC];
|
|
2470
|
+
if (dl.Va == sect.Va &&
|
|
2471
|
+
dl.Size <= sect.PSize)
|
|
2472
|
+
sect.ExtractSize = dl.Size;
|
|
2473
|
+
}
|
|
2474
|
+
else if (sect.Name.IsEqualTo(".pdata"))
|
|
2475
|
+
{
|
|
2476
|
+
const CDirLink &dl = _optHeader.DirItems[kDirLink_EXCEPTION];
|
|
2477
|
+
if (dl.Va == sect.Va &&
|
|
2478
|
+
dl.Size <= sect.PSize)
|
|
2479
|
+
sect.ExtractSize = dl.Size;
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
/* PE pre-file in .hxs file has errors:
|
|
2483
|
+
PSize of resource is larger than real size.
|
|
2484
|
+
So it overlaps next ".its" section.
|
|
2485
|
+
7-zip before 22.02: we corrected it.
|
|
2486
|
+
|
|
2487
|
+
22.02: another bad case is possible in incorrect pe (exe) file:
|
|
2488
|
+
PSize in .rsrc section is correct,
|
|
2489
|
+
but next .reloc section has incorrect (Pa) that overlaps with .rsrc.
|
|
2490
|
+
*/
|
|
2491
|
+
|
|
2492
|
+
if (i != 0)
|
|
2493
|
+
{
|
|
2494
|
+
const CSection &prev = _sections[i - 1];
|
|
2495
|
+
if (prev.Pa < sect.Pa
|
|
2496
|
+
&& prev.Pa + prev.PSize > sect.Pa
|
|
2497
|
+
&& sect.PSize != 0
|
|
2498
|
+
&& prev.PSize != 0)
|
|
2499
|
+
{
|
|
2500
|
+
_sectionsError = true;
|
|
2501
|
+
// PRF(printf("\n !!!! Section correction: %s\n ", prev.Name));
|
|
2502
|
+
|
|
2503
|
+
/* we corrected that case in 7-zip before 22.02: */
|
|
2504
|
+
// prev.PSize = sect.Pa - prev.Pa;
|
|
2505
|
+
|
|
2506
|
+
/* 22.02: here we can try to change bad section position to expected postion.
|
|
2507
|
+
but original Windows code probably will not do same things. */
|
|
2508
|
+
// if (prev.PSize <= sect.Va - prev.Va) sect.Pa = prev.Pa + prev.PSize;
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
/* last ".its" section in hxs file has incorrect sect.PSize.
|
|
2512
|
+
7-zip before 22.02: we reduced section to real sect.VSize */
|
|
2513
|
+
/*
|
|
2514
|
+
if (sect.VSize == 24 && sect.PSize == 512 && i == (unsigned)_header.NumSections - 1)
|
|
2515
|
+
sect.PSize = sect.VSize;
|
|
2516
|
+
*/
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
for (i = 0; i < _sections.Size(); i++)
|
|
2520
|
+
_sections[i].UpdateTotalSize(_totalSize);
|
|
2521
|
+
|
|
2522
|
+
bool thereISDebug = false;
|
|
2523
|
+
if (IsOpt())
|
|
2524
|
+
{
|
|
2525
|
+
RINOK(LoadDebugSections(stream, thereISDebug))
|
|
2526
|
+
|
|
2527
|
+
const CDirLink &certLink = _optHeader.DirItems[kDirLink_Certificate];
|
|
2528
|
+
if (certLink.Size != 0)
|
|
2529
|
+
{
|
|
2530
|
+
CSection § = _sections.AddNew();
|
|
2531
|
+
sect.Name = "CERTIFICATE";
|
|
2532
|
+
sect.Va = 0;
|
|
2533
|
+
sect.Pa = certLink.Va;
|
|
2534
|
+
sect.Set_Size_for_all(certLink.Size);
|
|
2535
|
+
sect.UpdateTotalSize(_totalSize);
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
if (thereISDebug)
|
|
2539
|
+
{
|
|
2540
|
+
/* sometime there is some data after debug section.
|
|
2541
|
+
We don't see any reference in exe file to that data.
|
|
2542
|
+
But we suppose that it's part of EXE file */
|
|
2543
|
+
|
|
2544
|
+
const UInt32 kAlign = 1 << 12;
|
|
2545
|
+
UInt32 alignPos = _totalSize & (kAlign - 1);
|
|
2546
|
+
if (alignPos != 0)
|
|
2547
|
+
{
|
|
2548
|
+
UInt32 size = kAlign - alignPos;
|
|
2549
|
+
RINOK(InStream_SeekSet(stream, _totalSize))
|
|
2550
|
+
buffer.Alloc(kAlign);
|
|
2551
|
+
Byte *buf = buffer;
|
|
2552
|
+
size_t processed = size;
|
|
2553
|
+
RINOK(ReadStream(stream, buf, &processed))
|
|
2554
|
+
|
|
2555
|
+
/*
|
|
2556
|
+
if (processed != 0)
|
|
2557
|
+
{
|
|
2558
|
+
printf("\ndata after debug %d, %d \n", (int)size, (int)processed);
|
|
2559
|
+
fflush(stdout);
|
|
2560
|
+
}
|
|
2561
|
+
*/
|
|
2562
|
+
|
|
2563
|
+
size_t k;
|
|
2564
|
+
for (k = 0; k < processed; k++)
|
|
2565
|
+
if (buf[k] != 0)
|
|
2566
|
+
break;
|
|
2567
|
+
if (processed < size && processed < 100)
|
|
2568
|
+
_totalSize += (UInt32)processed;
|
|
2569
|
+
else if (((_totalSize + k) & 0x1FF) == 0 || processed < size)
|
|
2570
|
+
_totalSize += (UInt32)k;
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
if (_header.NumSymbols > 0 && _header.PointerToSymbolTable >= optStart)
|
|
2576
|
+
{
|
|
2577
|
+
if (_header.NumSymbols >= (1 << 24))
|
|
2578
|
+
return S_FALSE;
|
|
2579
|
+
UInt32 size = _header.NumSymbols * 18;
|
|
2580
|
+
RINOK(InStream_SeekSet(stream, (UInt64)_header.PointerToSymbolTable + size))
|
|
2581
|
+
Byte buf[4];
|
|
2582
|
+
RINOK(ReadStream_FALSE(stream, buf, 4))
|
|
2583
|
+
UInt32 size2 = Get32(buf);
|
|
2584
|
+
if (size2 >= (1 << 28))
|
|
2585
|
+
return S_FALSE;
|
|
2586
|
+
size += size2;
|
|
2587
|
+
|
|
2588
|
+
CSection § = _sections.AddNew();
|
|
2589
|
+
sect.Name = "COFF_SYMBOLS";
|
|
2590
|
+
sect.Va = 0;
|
|
2591
|
+
sect.Pa = _header.PointerToSymbolTable;
|
|
2592
|
+
sect.Set_Size_for_all(size);
|
|
2593
|
+
sect.UpdateTotalSize(_totalSize);
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
{
|
|
2597
|
+
CObjectVector<CSection> sections = _sections;
|
|
2598
|
+
sections.Sort();
|
|
2599
|
+
UInt32 limit = (1 << 12);
|
|
2600
|
+
unsigned num = 0;
|
|
2601
|
+
FOR_VECTOR (k, sections)
|
|
2602
|
+
{
|
|
2603
|
+
const CSection &s = sections[k];
|
|
2604
|
+
if (s.Pa > limit)
|
|
2605
|
+
{
|
|
2606
|
+
CSection &s2 = _sections.AddNew();
|
|
2607
|
+
s2.Pa = s2.Va = limit;
|
|
2608
|
+
s2.Set_Size_for_all(s.Pa - limit);
|
|
2609
|
+
s2.IsAdditionalSection = true;
|
|
2610
|
+
s2.Name.Add_Char('[');
|
|
2611
|
+
s2.Name.Add_UInt32(num++);
|
|
2612
|
+
s2.Name.Add_Char(']');
|
|
2613
|
+
limit = s.Pa;
|
|
2614
|
+
}
|
|
2615
|
+
UInt32 next = s.Pa + s.PSize;
|
|
2616
|
+
if (next < s.Pa)
|
|
2617
|
+
break;
|
|
2618
|
+
if (next >= limit)
|
|
2619
|
+
limit = next;
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
|
|
2624
|
+
if (IsOpt())
|
|
2625
|
+
if (_optHeader.CheckSum != 0)
|
|
2626
|
+
{
|
|
2627
|
+
RINOK(InStream_SeekToBegin(stream))
|
|
2628
|
+
UInt32 checkSum = 0;
|
|
2629
|
+
RINOK(CalcCheckSum(stream, _totalSize, optStart + k_CheckSum_Field_Offset, checkSum))
|
|
2630
|
+
_checksumError = (checkSum != _optHeader.CheckSum);
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
|
|
2634
|
+
if (!_allowTail)
|
|
2635
|
+
{
|
|
2636
|
+
UInt64 fileSize;
|
|
2637
|
+
RINOK(InStream_GetSize_SeekToEnd(stream, fileSize))
|
|
2638
|
+
if (fileSize > _totalSize)
|
|
2639
|
+
return S_FALSE;
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
bool _parseResources = true;
|
|
2643
|
+
// _parseResources = false; // for debug
|
|
2644
|
+
|
|
2645
|
+
UInt64 mainSize = 0, mainSize2 = 0;
|
|
2646
|
+
|
|
2647
|
+
for (i = 0; i < _sections.Size(); i++)
|
|
2648
|
+
{
|
|
2649
|
+
const CSection § = _sections[i];
|
|
2650
|
+
if (IsOpt())
|
|
2651
|
+
if (_parseResources && sect.Name.IsEqualTo(".rsrc"))
|
|
2652
|
+
{
|
|
2653
|
+
// 20.01: we try to parse only first copy of .rsrc section.
|
|
2654
|
+
_parseResources = false;
|
|
2655
|
+
const unsigned numMixItems = _mixItems.Size();
|
|
2656
|
+
HRESULT res = OpenResources(i, stream, callback);
|
|
2657
|
+
if (res == S_OK)
|
|
2658
|
+
{
|
|
2659
|
+
_resourcesPrefix = sect.Name.Ptr();
|
|
2660
|
+
_resourcesPrefix.Add_PathSepar();
|
|
2661
|
+
FOR_VECTOR (j, _items)
|
|
2662
|
+
{
|
|
2663
|
+
const CResItem &item = _items[j];
|
|
2664
|
+
if (item.Enabled)
|
|
2665
|
+
{
|
|
2666
|
+
CMixItem mixItem;
|
|
2667
|
+
mixItem.Construct();
|
|
2668
|
+
mixItem.SectionIndex = (int)i;
|
|
2669
|
+
mixItem.ResourceIndex = (int)j;
|
|
2670
|
+
if (item.IsRcDataOrUnknown())
|
|
2671
|
+
{
|
|
2672
|
+
if (item.Size >= mainSize)
|
|
2673
|
+
{
|
|
2674
|
+
mainSize2 = mainSize;
|
|
2675
|
+
mainSize = item.Size;
|
|
2676
|
+
_mainSubfile = (Int32)(int)_mixItems.Size();
|
|
2677
|
+
}
|
|
2678
|
+
else if (item.Size >= mainSize2)
|
|
2679
|
+
mainSize2 = item.Size;
|
|
2680
|
+
}
|
|
2681
|
+
_mixItems.Add(mixItem);
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
// 9.29: .rsrc_2 code was commented.
|
|
2685
|
+
// .rsrc_1 now must include that .rsrc_2 block.
|
|
2686
|
+
/*
|
|
2687
|
+
if (sect.PSize > sect.VSize)
|
|
2688
|
+
{
|
|
2689
|
+
int numBits = _optHeader.GetNumFileAlignBits();
|
|
2690
|
+
if (numBits >= 0)
|
|
2691
|
+
{
|
|
2692
|
+
UInt32 mask = (1 << numBits) - 1;
|
|
2693
|
+
UInt32 end = ((sect.VSize + mask) & ~mask);
|
|
2694
|
+
|
|
2695
|
+
if (sect.PSize > end)
|
|
2696
|
+
{
|
|
2697
|
+
CSection §2 = _sections.AddNew();
|
|
2698
|
+
sect2.Flags = 0;
|
|
2699
|
+
sect2.Pa = sect.Pa + end;
|
|
2700
|
+
sect2.Va = sect.Va + end;
|
|
2701
|
+
sect2.PSize = sect.PSize - end;
|
|
2702
|
+
sect2.VSize = sect2.PSize;
|
|
2703
|
+
sect2.Name = ".rsrc_2";
|
|
2704
|
+
sect2.Time = 0;
|
|
2705
|
+
sect2.IsAdditionalSection = true;
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
*/
|
|
2710
|
+
continue;
|
|
2711
|
+
}
|
|
2712
|
+
if (res != S_FALSE)
|
|
2713
|
+
return res;
|
|
2714
|
+
_mixItems.DeleteFrom(numMixItems);
|
|
2715
|
+
CloseResources();
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
if (sect.IsAdditionalSection)
|
|
2719
|
+
{
|
|
2720
|
+
if (sect.PSize >= mainSize)
|
|
2721
|
+
{
|
|
2722
|
+
mainSize2 = mainSize;
|
|
2723
|
+
mainSize = sect.PSize;
|
|
2724
|
+
_mainSubfile = (Int32)(int)_mixItems.Size();
|
|
2725
|
+
}
|
|
2726
|
+
else if (sect.PSize >= mainSize2)
|
|
2727
|
+
mainSize2 = sect.PSize;
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
CMixItem mixItem;
|
|
2731
|
+
mixItem.Construct();
|
|
2732
|
+
mixItem.SectionIndex = (int)i;
|
|
2733
|
+
_mixItems.Add(mixItem);
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
if (mainSize2 >= (1 << 20) && mainSize < mainSize2 * 2)
|
|
2737
|
+
_mainSubfile = -1;
|
|
2738
|
+
|
|
2739
|
+
for (i = 0; i < _mixItems.Size(); i++)
|
|
2740
|
+
{
|
|
2741
|
+
const CMixItem &mixItem = _mixItems[i];
|
|
2742
|
+
if (mixItem.StringIndex < 0 && mixItem.ResourceIndex < 0 && _sections[mixItem.SectionIndex].Name.IsEqualTo("_winzip_"))
|
|
2743
|
+
{
|
|
2744
|
+
_mainSubfile = (Int32)(int)i;
|
|
2745
|
+
break;
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
for (i = 0; i < _versionKeys.Size(); i++)
|
|
2750
|
+
{
|
|
2751
|
+
if (i != 0)
|
|
2752
|
+
_versionFullString.Add_LF();
|
|
2753
|
+
const CStringKeyValue &k = _versionKeys[i];
|
|
2754
|
+
_versionFullString += k.Key;
|
|
2755
|
+
_versionFullString += ": ";
|
|
2756
|
+
_versionFullString += k.Value;
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
{
|
|
2760
|
+
int keyIndex = FindKey(_versionKeys, "OriginalFilename");
|
|
2761
|
+
if (keyIndex >= 0)
|
|
2762
|
+
_originalFilename = _versionKeys[keyIndex].Value;
|
|
2763
|
+
}
|
|
2764
|
+
{
|
|
2765
|
+
int keyIndex = FindKey(_versionKeys, "FileDescription");
|
|
2766
|
+
if (keyIndex >= 0)
|
|
2767
|
+
_versionShortString = _versionKeys[keyIndex].Value;
|
|
2768
|
+
}
|
|
2769
|
+
{
|
|
2770
|
+
int keyIndex = FindKey(_versionKeys, "FileVersion");
|
|
2771
|
+
if (keyIndex >= 0)
|
|
2772
|
+
{
|
|
2773
|
+
_versionShortString.Add_Space();
|
|
2774
|
+
_versionShortString += _versionKeys[keyIndex].Value;
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
|
|
2778
|
+
return S_OK;
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
Z7_COM7F_IMF(CHandler::Open(IInStream *inStream, const UInt64 *, IArchiveOpenCallback *callback))
|
|
2782
|
+
{
|
|
2783
|
+
COM_TRY_BEGIN
|
|
2784
|
+
Close();
|
|
2785
|
+
RINOK(Open2(inStream, callback))
|
|
2786
|
+
_stream = inStream;
|
|
2787
|
+
return S_OK;
|
|
2788
|
+
COM_TRY_END
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
void CHandler::CloseResources()
|
|
2792
|
+
{
|
|
2793
|
+
_usedRes.Free();
|
|
2794
|
+
_items.Clear();
|
|
2795
|
+
_strings.Clear();
|
|
2796
|
+
_versionFiles.Clear();
|
|
2797
|
+
_buf.Free();
|
|
2798
|
+
_versionFullString.Empty();
|
|
2799
|
+
_versionShortString.Empty();
|
|
2800
|
+
_originalFilename.Empty();
|
|
2801
|
+
_versionKeys.Clear();
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2804
|
+
Z7_COM7F_IMF(CHandler::Close())
|
|
2805
|
+
{
|
|
2806
|
+
_totalSize = 0;
|
|
2807
|
+
_checksumError = false;
|
|
2808
|
+
_sectionsError = false;
|
|
2809
|
+
_mainSubfile = -1;
|
|
2810
|
+
|
|
2811
|
+
_stream.Release();
|
|
2812
|
+
_sections.Clear();
|
|
2813
|
+
_mixItems.Clear();
|
|
2814
|
+
CloseResources();
|
|
2815
|
+
return S_OK;
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
Z7_COM7F_IMF(CHandler::GetNumberOfItems(UInt32 *numItems))
|
|
2819
|
+
{
|
|
2820
|
+
*numItems = _mixItems.Size();
|
|
2821
|
+
return S_OK;
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
Z7_COM7F_IMF(CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
2825
|
+
Int32 testMode, IArchiveExtractCallback *extractCallback))
|
|
2826
|
+
{
|
|
2827
|
+
COM_TRY_BEGIN
|
|
2828
|
+
const bool allFilesMode = (numItems == (UInt32)(Int32)-1);
|
|
2829
|
+
if (allFilesMode)
|
|
2830
|
+
numItems = _mixItems.Size();
|
|
2831
|
+
if (numItems == 0)
|
|
2832
|
+
return S_OK;
|
|
2833
|
+
UInt64 totalSize = 0;
|
|
2834
|
+
UInt32 i;
|
|
2835
|
+
for (i = 0; i < numItems; i++)
|
|
2836
|
+
{
|
|
2837
|
+
const CMixItem &mixItem = _mixItems[allFilesMode ? i : indices[i]];
|
|
2838
|
+
UInt64 size;
|
|
2839
|
+
if (mixItem.StringIndex >= 0)
|
|
2840
|
+
size = _strings[mixItem.StringIndex].FinalSize();
|
|
2841
|
+
else if (mixItem.VersionIndex >= 0)
|
|
2842
|
+
size = _versionFiles[mixItem.VersionIndex].Size();
|
|
2843
|
+
else if (mixItem.ResourceIndex >= 0)
|
|
2844
|
+
size = _items[mixItem.ResourceIndex].GetSize();
|
|
2845
|
+
else
|
|
2846
|
+
size = _sections[mixItem.SectionIndex].GetSize_Extract();
|
|
2847
|
+
totalSize += size;
|
|
2848
|
+
}
|
|
2849
|
+
RINOK(extractCallback->SetTotal(totalSize))
|
|
2850
|
+
|
|
2851
|
+
CMyComPtr2_Create<ICompressCoder, NCompress::CCopyCoder> copyCoder;
|
|
2852
|
+
CMyComPtr2_Create<ICompressProgressInfo, CLocalProgress> lps;
|
|
2853
|
+
lps->Init(extractCallback, false);
|
|
2854
|
+
CMyComPtr2_Create<ISequentialInStream, CLimitedSequentialInStream> inStream;
|
|
2855
|
+
inStream->SetStream(_stream);
|
|
2856
|
+
|
|
2857
|
+
totalSize = 0;
|
|
2858
|
+
UInt64 currentItemSize;
|
|
2859
|
+
|
|
2860
|
+
for (i = 0;; i++, totalSize += currentItemSize)
|
|
2861
|
+
{
|
|
2862
|
+
lps->InSize = lps->OutSize = totalSize;
|
|
2863
|
+
RINOK(lps->SetCur())
|
|
2864
|
+
if (i >= numItems)
|
|
2865
|
+
break;
|
|
2866
|
+
const Int32 askMode = testMode ?
|
|
2867
|
+
NExtract::NAskMode::kTest :
|
|
2868
|
+
NExtract::NAskMode::kExtract;
|
|
2869
|
+
const UInt32 index = allFilesMode ? i : indices[i];
|
|
2870
|
+
|
|
2871
|
+
CMyComPtr<ISequentialOutStream> outStream;
|
|
2872
|
+
RINOK(extractCallback->GetStream(index, &outStream, askMode))
|
|
2873
|
+
const CMixItem &mixItem = _mixItems[index];
|
|
2874
|
+
|
|
2875
|
+
const CSection § = _sections[mixItem.SectionIndex];
|
|
2876
|
+
bool isOk = true;
|
|
2877
|
+
if (mixItem.StringIndex >= 0)
|
|
2878
|
+
{
|
|
2879
|
+
const CStringItem &item = _strings[mixItem.StringIndex];
|
|
2880
|
+
currentItemSize = item.FinalSize();
|
|
2881
|
+
if (!testMode && !outStream)
|
|
2882
|
+
continue;
|
|
2883
|
+
|
|
2884
|
+
RINOK(extractCallback->PrepareOperation(askMode))
|
|
2885
|
+
if (outStream)
|
|
2886
|
+
RINOK(WriteStream(outStream, item.Buf, item.FinalSize()))
|
|
2887
|
+
}
|
|
2888
|
+
else if (mixItem.VersionIndex >= 0)
|
|
2889
|
+
{
|
|
2890
|
+
const CByteBuffer &item = _versionFiles[mixItem.VersionIndex];
|
|
2891
|
+
currentItemSize = item.Size();
|
|
2892
|
+
if (!testMode && !outStream)
|
|
2893
|
+
continue;
|
|
2894
|
+
|
|
2895
|
+
RINOK(extractCallback->PrepareOperation(askMode))
|
|
2896
|
+
if (outStream)
|
|
2897
|
+
RINOK(WriteStream(outStream, item, item.Size()))
|
|
2898
|
+
}
|
|
2899
|
+
else if (mixItem.ResourceIndex >= 0)
|
|
2900
|
+
{
|
|
2901
|
+
const CResItem &item = _items[mixItem.ResourceIndex];
|
|
2902
|
+
currentItemSize = item.GetSize();
|
|
2903
|
+
if (!testMode && !outStream)
|
|
2904
|
+
continue;
|
|
2905
|
+
|
|
2906
|
+
RINOK(extractCallback->PrepareOperation(askMode))
|
|
2907
|
+
size_t offset = item.Offset - sect.Va;
|
|
2908
|
+
if (!CheckItem(sect, item, offset))
|
|
2909
|
+
isOk = false;
|
|
2910
|
+
else if (outStream)
|
|
2911
|
+
{
|
|
2912
|
+
if (item.HeaderSize != 0)
|
|
2913
|
+
RINOK(WriteStream(outStream, item.Header, item.HeaderSize))
|
|
2914
|
+
RINOK(WriteStream(outStream, _buf + offset, item.Size))
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
else
|
|
2918
|
+
{
|
|
2919
|
+
currentItemSize = sect.GetSize_Extract();
|
|
2920
|
+
if (!testMode && !outStream)
|
|
2921
|
+
continue;
|
|
2922
|
+
|
|
2923
|
+
RINOK(extractCallback->PrepareOperation(askMode))
|
|
2924
|
+
RINOK(InStream_SeekSet(_stream, sect.Pa))
|
|
2925
|
+
inStream->Init(currentItemSize);
|
|
2926
|
+
RINOK(copyCoder.Interface()->Code(inStream, outStream, NULL, NULL, lps))
|
|
2927
|
+
isOk = (copyCoder->TotalSize == currentItemSize);
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2930
|
+
outStream.Release();
|
|
2931
|
+
RINOK(extractCallback->SetOperationResult(isOk ?
|
|
2932
|
+
NExtract::NOperationResult::kOK :
|
|
2933
|
+
NExtract::NOperationResult::kDataError))
|
|
2934
|
+
}
|
|
2935
|
+
return S_OK;
|
|
2936
|
+
COM_TRY_END
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
Z7_COM7F_IMF(CHandler::GetStream(UInt32 index, ISequentialInStream **stream))
|
|
2940
|
+
{
|
|
2941
|
+
COM_TRY_BEGIN
|
|
2942
|
+
*stream = NULL;
|
|
2943
|
+
|
|
2944
|
+
const CMixItem &mixItem = _mixItems[index];
|
|
2945
|
+
const CSection § = _sections[mixItem.SectionIndex];
|
|
2946
|
+
if (mixItem.IsSectionItem())
|
|
2947
|
+
return CreateLimitedInStream(_stream, sect.Pa, sect.GetSize_Extract(), stream);
|
|
2948
|
+
|
|
2949
|
+
CBufInStream *inStreamSpec = new CBufInStream;
|
|
2950
|
+
CMyComPtr<ISequentialInStream> streamTemp = inStreamSpec;
|
|
2951
|
+
CReferenceBuf *referenceBuf = new CReferenceBuf;
|
|
2952
|
+
CMyComPtr<IUnknown> ref = referenceBuf;
|
|
2953
|
+
if (mixItem.StringIndex >= 0)
|
|
2954
|
+
{
|
|
2955
|
+
const CStringItem &item = _strings[mixItem.StringIndex];
|
|
2956
|
+
referenceBuf->Buf.CopyFrom(item.Buf, item.FinalSize());
|
|
2957
|
+
}
|
|
2958
|
+
else if (mixItem.VersionIndex >= 0)
|
|
2959
|
+
{
|
|
2960
|
+
const CByteBuffer &item = _versionFiles[mixItem.VersionIndex];
|
|
2961
|
+
referenceBuf->Buf.CopyFrom(item, item.Size());
|
|
2962
|
+
}
|
|
2963
|
+
else
|
|
2964
|
+
{
|
|
2965
|
+
const CResItem &item = _items[mixItem.ResourceIndex];
|
|
2966
|
+
size_t offset = item.Offset - sect.Va;
|
|
2967
|
+
if (!CheckItem(sect, item, offset))
|
|
2968
|
+
return S_FALSE;
|
|
2969
|
+
if (item.HeaderSize == 0)
|
|
2970
|
+
{
|
|
2971
|
+
CBufInStream *streamSpec = new CBufInStream;
|
|
2972
|
+
CMyComPtr<IInStream> streamTemp2 = streamSpec;
|
|
2973
|
+
streamSpec->Init(_buf + offset, item.Size, (IInArchive *)this);
|
|
2974
|
+
*stream = streamTemp2.Detach();
|
|
2975
|
+
return S_OK;
|
|
2976
|
+
}
|
|
2977
|
+
referenceBuf->Buf.Alloc(item.HeaderSize + item.Size);
|
|
2978
|
+
memcpy(referenceBuf->Buf, item.Header, item.HeaderSize);
|
|
2979
|
+
if (item.Size != 0)
|
|
2980
|
+
memcpy(referenceBuf->Buf + item.HeaderSize, _buf + offset, item.Size);
|
|
2981
|
+
}
|
|
2982
|
+
inStreamSpec->Init(referenceBuf);
|
|
2983
|
+
|
|
2984
|
+
*stream = streamTemp.Detach();
|
|
2985
|
+
return S_OK;
|
|
2986
|
+
COM_TRY_END
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
Z7_COM7F_IMF(CHandler::AllowTail(Int32 allowTail))
|
|
2990
|
+
{
|
|
2991
|
+
_allowTail = IntToBool(allowTail);
|
|
2992
|
+
return S_OK;
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2995
|
+
static const Byte k_Signature[] = { 'M', 'Z' };
|
|
2996
|
+
|
|
2997
|
+
REGISTER_ARC_I(
|
|
2998
|
+
"PE", "exe dll sys", NULL, 0xDD,
|
|
2999
|
+
k_Signature,
|
|
3000
|
+
0,
|
|
3001
|
+
NArcInfoFlags::kPreArc,
|
|
3002
|
+
IsArc_Pe)
|
|
3003
|
+
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
namespace NCoff {
|
|
3007
|
+
|
|
3008
|
+
API_FUNC_static_IsArc IsArc_Coff(const Byte *p, size_t size)
|
|
3009
|
+
{
|
|
3010
|
+
if (size < NPe::kCoffHeaderSize)
|
|
3011
|
+
return k_IsArc_Res_NEED_MORE;
|
|
3012
|
+
NPe::CHeader header;
|
|
3013
|
+
if (!header.ParseCoff(p))
|
|
3014
|
+
return k_IsArc_Res_NO;
|
|
3015
|
+
return k_IsArc_Res_YES;
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
|
|
3019
|
+
/*
|
|
3020
|
+
static const Byte k_Signature[] =
|
|
3021
|
+
{
|
|
3022
|
+
2, 0x4C, 0x01, // x86
|
|
3023
|
+
2, 0x64, 0x86, // x64
|
|
3024
|
+
2, 0x64, 0xAA // ARM64
|
|
3025
|
+
};
|
|
3026
|
+
REGISTER_ARC_I_CLS(
|
|
3027
|
+
*/
|
|
3028
|
+
|
|
3029
|
+
REGISTER_ARC_I_CLS_NO_SIG(
|
|
3030
|
+
NPe::CHandler(true),
|
|
3031
|
+
"COFF", "obj", NULL, 0xC6,
|
|
3032
|
+
// k_Signature,
|
|
3033
|
+
0,
|
|
3034
|
+
// NArcInfoFlags::kMultiSignature |
|
|
3035
|
+
NArcInfoFlags::kStartOpen,
|
|
3036
|
+
IsArc_Coff)
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
|
|
3040
|
+
namespace NTe {
|
|
3041
|
+
|
|
3042
|
+
// Terse Executable (TE) image
|
|
3043
|
+
|
|
3044
|
+
struct CDataDir
|
|
3045
|
+
{
|
|
3046
|
+
UInt32 Va;
|
|
3047
|
+
UInt32 Size;
|
|
3048
|
+
|
|
3049
|
+
void Parse(const Byte *p)
|
|
3050
|
+
{
|
|
3051
|
+
G32(0, Va);
|
|
3052
|
+
G32(4, Size);
|
|
3053
|
+
}
|
|
3054
|
+
};
|
|
3055
|
+
|
|
3056
|
+
static const UInt32 kHeaderSize = 40;
|
|
3057
|
+
|
|
3058
|
+
static bool FindValue(const CUInt32PCharPair *pairs, unsigned num, UInt32 value)
|
|
3059
|
+
{
|
|
3060
|
+
for (unsigned i = 0; i < num; i++)
|
|
3061
|
+
if (pairs[i].Value == value)
|
|
3062
|
+
return true;
|
|
3063
|
+
return false;
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
#define MY_FIND_VALUE(pairs, val) FindValue(pairs, Z7_ARRAY_SIZE(pairs), val)
|
|
3067
|
+
#define MY_FIND_VALUE_2(strings, val) (val < Z7_ARRAY_SIZE(strings) && strings[val])
|
|
3068
|
+
|
|
3069
|
+
static const UInt32 kNumSection_MAX = 32;
|
|
3070
|
+
|
|
3071
|
+
struct CHeader
|
|
3072
|
+
{
|
|
3073
|
+
UInt16 Machine;
|
|
3074
|
+
Byte NumSections;
|
|
3075
|
+
Byte SubSystem;
|
|
3076
|
+
UInt16 StrippedSize;
|
|
3077
|
+
/*
|
|
3078
|
+
UInt32 AddressOfEntryPoint;
|
|
3079
|
+
UInt32 BaseOfCode;
|
|
3080
|
+
UInt64 ImageBase;
|
|
3081
|
+
*/
|
|
3082
|
+
CDataDir DataDir[2]; // base relocation and debug directory
|
|
3083
|
+
|
|
3084
|
+
bool ConvertPa(UInt32 &pa) const
|
|
3085
|
+
{
|
|
3086
|
+
if (pa < StrippedSize)
|
|
3087
|
+
return false;
|
|
3088
|
+
pa = pa - StrippedSize + kHeaderSize;
|
|
3089
|
+
return true;
|
|
3090
|
+
}
|
|
3091
|
+
bool Parse(const Byte *p);
|
|
3092
|
+
};
|
|
3093
|
+
|
|
3094
|
+
bool CHeader::Parse(const Byte *p)
|
|
3095
|
+
{
|
|
3096
|
+
NumSections = p[4];
|
|
3097
|
+
if (NumSections > kNumSection_MAX)
|
|
3098
|
+
return false;
|
|
3099
|
+
SubSystem = p[5];
|
|
3100
|
+
G16(2, Machine);
|
|
3101
|
+
G16(6, StrippedSize);
|
|
3102
|
+
/*
|
|
3103
|
+
G32(8, AddressOfEntryPoint);
|
|
3104
|
+
G32(12, BaseOfCode);
|
|
3105
|
+
G64(16, ImageBase);
|
|
3106
|
+
*/
|
|
3107
|
+
for (unsigned i = 0; i < 2; i++)
|
|
3108
|
+
{
|
|
3109
|
+
CDataDir &dd = DataDir[i];
|
|
3110
|
+
dd.Parse(p + 24 + i * 8);
|
|
3111
|
+
if (dd.Size >= ((UInt32)1 << 28))
|
|
3112
|
+
return false;
|
|
3113
|
+
}
|
|
3114
|
+
return
|
|
3115
|
+
MY_FIND_VALUE(NPe::g_MachinePairs, Machine) &&
|
|
3116
|
+
MY_FIND_VALUE_2(NPe::g_SubSystems, SubSystem);
|
|
3117
|
+
}
|
|
3118
|
+
|
|
3119
|
+
API_FUNC_static_IsArc IsArc_Te(const Byte *p, size_t size)
|
|
3120
|
+
{
|
|
3121
|
+
if (size < 2)
|
|
3122
|
+
return k_IsArc_Res_NEED_MORE;
|
|
3123
|
+
if (p[0] != 'V' || p[1] != 'Z')
|
|
3124
|
+
return k_IsArc_Res_NO;
|
|
3125
|
+
if (size < kHeaderSize)
|
|
3126
|
+
return k_IsArc_Res_NEED_MORE;
|
|
3127
|
+
|
|
3128
|
+
CHeader h;
|
|
3129
|
+
if (!h.Parse(p))
|
|
3130
|
+
return k_IsArc_Res_NO;
|
|
3131
|
+
return k_IsArc_Res_YES;
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3135
|
+
|
|
3136
|
+
struct CSection
|
|
3137
|
+
{
|
|
3138
|
+
Byte Name[NPe::kNameSize];
|
|
3139
|
+
|
|
3140
|
+
UInt32 ExtractSize;
|
|
3141
|
+
UInt32 VSize;
|
|
3142
|
+
UInt32 Va;
|
|
3143
|
+
UInt32 PSize;
|
|
3144
|
+
UInt32 Pa;
|
|
3145
|
+
UInt32 Flags;
|
|
3146
|
+
// UInt16 NumRelocs;
|
|
3147
|
+
|
|
3148
|
+
void Parse(const Byte *p)
|
|
3149
|
+
{
|
|
3150
|
+
memcpy(Name, p, NPe::kNameSize);
|
|
3151
|
+
G32(8, VSize);
|
|
3152
|
+
G32(12, Va);
|
|
3153
|
+
G32(16, PSize);
|
|
3154
|
+
G32(20, Pa);
|
|
3155
|
+
// G32(p + 32, NumRelocs);
|
|
3156
|
+
G32(36, Flags);
|
|
3157
|
+
ExtractSize = (VSize && VSize < PSize) ? VSize : PSize;
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
bool Check() const
|
|
3161
|
+
{
|
|
3162
|
+
return
|
|
3163
|
+
Pa <= ((UInt32)1 << 30) &&
|
|
3164
|
+
PSize <= ((UInt32)1 << 30);
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
UInt32 GetSize_Extract() const
|
|
3168
|
+
{
|
|
3169
|
+
return ExtractSize;
|
|
3170
|
+
}
|
|
3171
|
+
|
|
3172
|
+
void UpdateTotalSize(UInt32 &totalSize)
|
|
3173
|
+
{
|
|
3174
|
+
const UInt32 t = Pa + PSize;
|
|
3175
|
+
if (totalSize < t)
|
|
3176
|
+
totalSize = t;
|
|
3177
|
+
}
|
|
3178
|
+
};
|
|
3179
|
+
|
|
3180
|
+
|
|
3181
|
+
Z7_CLASS_IMP_CHandler_IInArchive_2(
|
|
3182
|
+
IInArchiveGetStream,
|
|
3183
|
+
IArchiveAllowTail
|
|
3184
|
+
)
|
|
3185
|
+
CRecordVector<CSection> _items;
|
|
3186
|
+
CMyComPtr<IInStream> _stream;
|
|
3187
|
+
UInt32 _totalSize;
|
|
3188
|
+
bool _allowTail;
|
|
3189
|
+
CHeader _h;
|
|
3190
|
+
|
|
3191
|
+
HRESULT Open2(IInStream *stream);
|
|
3192
|
+
public:
|
|
3193
|
+
CHandler(): _allowTail(false) {}
|
|
3194
|
+
};
|
|
3195
|
+
|
|
3196
|
+
static const Byte kProps[] =
|
|
3197
|
+
{
|
|
3198
|
+
kpidPath,
|
|
3199
|
+
kpidSize,
|
|
3200
|
+
kpidPackSize,
|
|
3201
|
+
kpidVirtualSize,
|
|
3202
|
+
kpidCharacts,
|
|
3203
|
+
kpidOffset,
|
|
3204
|
+
kpidVa
|
|
3205
|
+
};
|
|
3206
|
+
|
|
3207
|
+
enum
|
|
3208
|
+
{
|
|
3209
|
+
kpidSubSystem = kpidUserDefined
|
|
3210
|
+
// , kpidImageBase
|
|
3211
|
+
};
|
|
3212
|
+
|
|
3213
|
+
static const CStatProp kArcProps[] =
|
|
3214
|
+
{
|
|
3215
|
+
// { NULL, kpidHeadersSize, VT_UI4 },
|
|
3216
|
+
{ NULL, kpidCpu, VT_BSTR},
|
|
3217
|
+
{ "Subsystem", kpidSubSystem, VT_BSTR },
|
|
3218
|
+
// { "Image Base", kpidImageBase, VT_UI8 }
|
|
3219
|
+
};
|
|
3220
|
+
|
|
3221
|
+
IMP_IInArchive_Props
|
|
3222
|
+
IMP_IInArchive_ArcProps_WITH_NAME
|
|
3223
|
+
|
|
3224
|
+
Z7_COM7F_IMF(CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value))
|
|
3225
|
+
{
|
|
3226
|
+
COM_TRY_BEGIN
|
|
3227
|
+
NCOM::CPropVariant prop;
|
|
3228
|
+
switch (propID)
|
|
3229
|
+
{
|
|
3230
|
+
case kpidPhySize: prop = _totalSize; break;
|
|
3231
|
+
case kpidCpu: PAIR_TO_PROP(NPe::g_MachinePairs, _h.Machine, prop); break;
|
|
3232
|
+
case kpidSubSystem: TYPE_TO_PROP(NPe::g_SubSystems, _h.SubSystem, prop); break;
|
|
3233
|
+
/*
|
|
3234
|
+
case kpidImageBase: prop = _h.ImageBase; break;
|
|
3235
|
+
case kpidAddressOfEntryPoint: prop = _h.AddressOfEntryPoint; break;
|
|
3236
|
+
case kpidBaseOfCode: prop = _h.BaseOfCode; break;
|
|
3237
|
+
*/
|
|
3238
|
+
}
|
|
3239
|
+
prop.Detach(value);
|
|
3240
|
+
return S_OK;
|
|
3241
|
+
COM_TRY_END
|
|
3242
|
+
}
|
|
3243
|
+
|
|
3244
|
+
Z7_COM7F_IMF(CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value))
|
|
3245
|
+
{
|
|
3246
|
+
COM_TRY_BEGIN
|
|
3247
|
+
NCOM::CPropVariant prop;
|
|
3248
|
+
{
|
|
3249
|
+
const CSection &item = _items[index];
|
|
3250
|
+
switch (propID)
|
|
3251
|
+
{
|
|
3252
|
+
case kpidPath:
|
|
3253
|
+
{
|
|
3254
|
+
AString name;
|
|
3255
|
+
NPe::GetName(item.Name, name);
|
|
3256
|
+
prop = MultiByteToUnicodeString(name);
|
|
3257
|
+
break;
|
|
3258
|
+
}
|
|
3259
|
+
case kpidSize: prop = (UInt64)item.GetSize_Extract(); break;
|
|
3260
|
+
case kpidPackSize: prop = (UInt64)item.PSize; break;
|
|
3261
|
+
case kpidVirtualSize: prop = (UInt64)item.VSize; break;
|
|
3262
|
+
case kpidOffset: prop = item.Pa; break;
|
|
3263
|
+
case kpidVa: prop = item.Va; break;
|
|
3264
|
+
case kpidCharacts: FLAGS_TO_PROP(NPe::g_SectFlags, item.Flags, prop); break;
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
prop.Detach(value);
|
|
3268
|
+
return S_OK;
|
|
3269
|
+
COM_TRY_END
|
|
3270
|
+
}
|
|
3271
|
+
|
|
3272
|
+
HRESULT CHandler::Open2(IInStream *stream)
|
|
3273
|
+
{
|
|
3274
|
+
Byte h[kHeaderSize];
|
|
3275
|
+
RINOK(ReadStream_FALSE(stream, h, kHeaderSize))
|
|
3276
|
+
if (h[0] != 'V' || h[1] != 'Z')
|
|
3277
|
+
return S_FALSE;
|
|
3278
|
+
if (!_h.Parse(h))
|
|
3279
|
+
return S_FALSE;
|
|
3280
|
+
|
|
3281
|
+
UInt32 headerSize = NPe::kSectionSize * (UInt32)_h.NumSections;
|
|
3282
|
+
CByteArr buf(headerSize);
|
|
3283
|
+
RINOK(ReadStream_FALSE(stream, buf, headerSize))
|
|
3284
|
+
headerSize += kHeaderSize;
|
|
3285
|
+
|
|
3286
|
+
_totalSize = headerSize;
|
|
3287
|
+
_items.ClearAndReserve(_h.NumSections);
|
|
3288
|
+
for (UInt32 i = 0; i < _h.NumSections; i++)
|
|
3289
|
+
{
|
|
3290
|
+
CSection sect;
|
|
3291
|
+
sect.Parse(buf + i * NPe::kSectionSize);
|
|
3292
|
+
if (!_h.ConvertPa(sect.Pa))
|
|
3293
|
+
return S_FALSE;
|
|
3294
|
+
if (sect.Pa < headerSize)
|
|
3295
|
+
return S_FALSE;
|
|
3296
|
+
if (!sect.Check())
|
|
3297
|
+
return S_FALSE;
|
|
3298
|
+
_items.AddInReserved(sect);
|
|
3299
|
+
sect.UpdateTotalSize(_totalSize);
|
|
3300
|
+
}
|
|
3301
|
+
|
|
3302
|
+
if (!_allowTail)
|
|
3303
|
+
{
|
|
3304
|
+
UInt64 fileSize;
|
|
3305
|
+
RINOK(InStream_GetSize_SeekToEnd(stream, fileSize))
|
|
3306
|
+
if (fileSize > _totalSize)
|
|
3307
|
+
return S_FALSE;
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3310
|
+
return S_OK;
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
Z7_COM7F_IMF(CHandler::Open(IInStream *inStream,
|
|
3314
|
+
const UInt64 * /* maxCheckStartPosition */,
|
|
3315
|
+
IArchiveOpenCallback * /* openArchiveCallback */))
|
|
3316
|
+
{
|
|
3317
|
+
COM_TRY_BEGIN
|
|
3318
|
+
Close();
|
|
3319
|
+
// try
|
|
3320
|
+
{
|
|
3321
|
+
if (Open2(inStream) != S_OK)
|
|
3322
|
+
return S_FALSE;
|
|
3323
|
+
_stream = inStream;
|
|
3324
|
+
}
|
|
3325
|
+
// catch(...) { return S_FALSE; }
|
|
3326
|
+
return S_OK;
|
|
3327
|
+
COM_TRY_END
|
|
3328
|
+
}
|
|
3329
|
+
|
|
3330
|
+
Z7_COM7F_IMF(CHandler::Close())
|
|
3331
|
+
{
|
|
3332
|
+
_totalSize = 0;
|
|
3333
|
+
_stream.Release();
|
|
3334
|
+
_items.Clear();
|
|
3335
|
+
return S_OK;
|
|
3336
|
+
}
|
|
3337
|
+
|
|
3338
|
+
Z7_COM7F_IMF(CHandler::GetNumberOfItems(UInt32 *numItems))
|
|
3339
|
+
{
|
|
3340
|
+
*numItems = _items.Size();
|
|
3341
|
+
return S_OK;
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
Z7_COM7F_IMF(CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
|
3345
|
+
Int32 testMode, IArchiveExtractCallback *extractCallback))
|
|
3346
|
+
{
|
|
3347
|
+
COM_TRY_BEGIN
|
|
3348
|
+
const bool allFilesMode = (numItems == (UInt32)(Int32)-1);
|
|
3349
|
+
if (allFilesMode)
|
|
3350
|
+
numItems = _items.Size();
|
|
3351
|
+
if (numItems == 0)
|
|
3352
|
+
return S_OK;
|
|
3353
|
+
UInt64 totalSize = 0;
|
|
3354
|
+
UInt32 i;
|
|
3355
|
+
for (i = 0; i < numItems; i++)
|
|
3356
|
+
totalSize += _items[allFilesMode ? i : indices[i]].GetSize_Extract();
|
|
3357
|
+
RINOK(extractCallback->SetTotal(totalSize))
|
|
3358
|
+
|
|
3359
|
+
CMyComPtr2_Create<ICompressCoder, NCompress::CCopyCoder> copyCoder;
|
|
3360
|
+
CMyComPtr2_Create<ICompressProgressInfo, CLocalProgress> lps;
|
|
3361
|
+
lps->Init(extractCallback, false);
|
|
3362
|
+
CMyComPtr2_Create<ISequentialInStream, CLimitedSequentialInStream> inStream;
|
|
3363
|
+
inStream->SetStream(_stream);
|
|
3364
|
+
|
|
3365
|
+
totalSize = 0;
|
|
3366
|
+
|
|
3367
|
+
for (i = 0;; i++)
|
|
3368
|
+
{
|
|
3369
|
+
lps->InSize = lps->OutSize = totalSize;
|
|
3370
|
+
RINOK(lps->SetCur())
|
|
3371
|
+
if (i >= numItems)
|
|
3372
|
+
break;
|
|
3373
|
+
int opRes;
|
|
3374
|
+
{
|
|
3375
|
+
CMyComPtr<ISequentialOutStream> realOutStream;
|
|
3376
|
+
const Int32 askMode = testMode ?
|
|
3377
|
+
NExtract::NAskMode::kTest :
|
|
3378
|
+
NExtract::NAskMode::kExtract;
|
|
3379
|
+
const UInt32 index = allFilesMode ? i : indices[i];
|
|
3380
|
+
const CSection &item = _items[index];
|
|
3381
|
+
RINOK(extractCallback->GetStream(index, &realOutStream, askMode))
|
|
3382
|
+
const UInt32 size = item.GetSize_Extract();
|
|
3383
|
+
totalSize += size;
|
|
3384
|
+
|
|
3385
|
+
if (!testMode && !realOutStream)
|
|
3386
|
+
continue;
|
|
3387
|
+
RINOK(extractCallback->PrepareOperation(askMode))
|
|
3388
|
+
RINOK(InStream_SeekSet(_stream, item.Pa))
|
|
3389
|
+
inStream->Init(size);
|
|
3390
|
+
RINOK(copyCoder.Interface()->Code(inStream, realOutStream, NULL, NULL, lps))
|
|
3391
|
+
|
|
3392
|
+
opRes = (copyCoder->TotalSize == size) ?
|
|
3393
|
+
NExtract::NOperationResult::kOK : (copyCoder->TotalSize < size) ?
|
|
3394
|
+
NExtract::NOperationResult::kUnexpectedEnd :
|
|
3395
|
+
NExtract::NOperationResult::kDataError;
|
|
3396
|
+
}
|
|
3397
|
+
RINOK(extractCallback->SetOperationResult(opRes))
|
|
3398
|
+
}
|
|
3399
|
+
return S_OK;
|
|
3400
|
+
COM_TRY_END
|
|
3401
|
+
}
|
|
3402
|
+
|
|
3403
|
+
Z7_COM7F_IMF(CHandler::GetStream(UInt32 index, ISequentialInStream **stream))
|
|
3404
|
+
{
|
|
3405
|
+
COM_TRY_BEGIN
|
|
3406
|
+
const CSection &item = _items[index];
|
|
3407
|
+
return CreateLimitedInStream(_stream, item.Pa, item.GetSize_Extract(), stream);
|
|
3408
|
+
COM_TRY_END
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
Z7_COM7F_IMF(CHandler::AllowTail(Int32 allowTail))
|
|
3412
|
+
{
|
|
3413
|
+
_allowTail = IntToBool(allowTail);
|
|
3414
|
+
return S_OK;
|
|
3415
|
+
}
|
|
3416
|
+
|
|
3417
|
+
static const Byte k_Signature[] = { 'V', 'Z' };
|
|
3418
|
+
|
|
3419
|
+
REGISTER_ARC_I(
|
|
3420
|
+
"TE", "te", NULL, 0xCF,
|
|
3421
|
+
k_Signature,
|
|
3422
|
+
0,
|
|
3423
|
+
NArcInfoFlags::kPreArc,
|
|
3424
|
+
IsArc_Te)
|
|
3425
|
+
|
|
3426
|
+
}
|
|
3427
|
+
}
|