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.
Files changed (1327) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +293 -2
  3. package/THIRD_PARTY_NOTICES.md +23 -0
  4. package/bench/args.mts +69 -0
  5. package/bench/benchmark.mts +102 -0
  6. package/bench/compare.mts +546 -0
  7. package/bench/concurrency.mts +196 -0
  8. package/binding.gyp +51 -0
  9. package/dist/index.cjs +528 -0
  10. package/dist/index.d.cts +63 -0
  11. package/dist/index.d.mts +63 -0
  12. package/dist/index.d.ts +63 -0
  13. package/dist/index.mjs +524 -0
  14. package/docs/architecture.md +112 -0
  15. package/examples/basic.mts +19 -0
  16. package/native/addon.cpp +2154 -0
  17. package/package.json +85 -5
  18. package/prebuilds/darwin-arm64/7zip_native.node +0 -0
  19. package/prebuilds/darwin-arm64/lib7z.dylib +0 -0
  20. package/prebuilds/darwin-x64/7zip_native.node +0 -0
  21. package/prebuilds/darwin-x64/lib7z.dylib +0 -0
  22. package/prebuilds/linux-arm/7z.so +0 -0
  23. package/prebuilds/linux-arm/7zip_native.node +0 -0
  24. package/prebuilds/linux-arm64/7z.so +0 -0
  25. package/prebuilds/linux-arm64/7zip_native.node +0 -0
  26. package/prebuilds/linux-ia32/7z.so +0 -0
  27. package/prebuilds/linux-ia32/7zip_native.node +0 -0
  28. package/prebuilds/linux-x64/7z.so +0 -0
  29. package/prebuilds/linux-x64/7zip_native.node +0 -0
  30. package/prebuilds/win32-arm64/7z.dll +0 -0
  31. package/prebuilds/win32-arm64/7zip_native.node +0 -0
  32. package/prebuilds/win32-x64/7z.dll +0 -0
  33. package/prebuilds/win32-x64/7zip_native.node +0 -0
  34. package/vendor/7zip/.gitattributes +2 -0
  35. package/vendor/7zip/Asm/arm/7zCrcOpt.asm +100 -0
  36. package/vendor/7zip/Asm/arm64/7zAsm.S +187 -0
  37. package/vendor/7zip/Asm/arm64/LzmaDecOpt.S +1487 -0
  38. package/vendor/7zip/Asm/x86/7zAsm.asm +341 -0
  39. package/vendor/7zip/Asm/x86/7zCrcOpt.asm +258 -0
  40. package/vendor/7zip/Asm/x86/AesOpt.asm +742 -0
  41. package/vendor/7zip/Asm/x86/LzFindOpt.asm +540 -0
  42. package/vendor/7zip/Asm/x86/LzmaDecOpt.asm +1339 -0
  43. package/vendor/7zip/Asm/x86/Sha1Opt.asm +263 -0
  44. package/vendor/7zip/Asm/x86/Sha256Opt.asm +275 -0
  45. package/vendor/7zip/Asm/x86/Sort.asm +860 -0
  46. package/vendor/7zip/Asm/x86/XzCrc64Opt.asm +523 -0
  47. package/vendor/7zip/C/7z.h +204 -0
  48. package/vendor/7zip/C/7zAlloc.c +89 -0
  49. package/vendor/7zip/C/7zAlloc.h +19 -0
  50. package/vendor/7zip/C/7zArcIn.c +1701 -0
  51. package/vendor/7zip/C/7zBuf.c +36 -0
  52. package/vendor/7zip/C/7zBuf.h +35 -0
  53. package/vendor/7zip/C/7zBuf2.c +52 -0
  54. package/vendor/7zip/C/7zCrc.c +420 -0
  55. package/vendor/7zip/C/7zCrc.h +28 -0
  56. package/vendor/7zip/C/7zCrcOpt.c +199 -0
  57. package/vendor/7zip/C/7zDec.c +672 -0
  58. package/vendor/7zip/C/7zFile.c +443 -0
  59. package/vendor/7zip/C/7zFile.h +91 -0
  60. package/vendor/7zip/C/7zStream.c +199 -0
  61. package/vendor/7zip/C/7zTypes.h +600 -0
  62. package/vendor/7zip/C/7zVersion.h +27 -0
  63. package/vendor/7zip/C/7zVersion.rc +55 -0
  64. package/vendor/7zip/C/7zWindows.h +107 -0
  65. package/vendor/7zip/C/7zip_gcc_c.mak +366 -0
  66. package/vendor/7zip/C/Aes.c +429 -0
  67. package/vendor/7zip/C/Aes.h +60 -0
  68. package/vendor/7zip/C/AesOpt.c +1002 -0
  69. package/vendor/7zip/C/Alloc.c +774 -0
  70. package/vendor/7zip/C/Alloc.h +76 -0
  71. package/vendor/7zip/C/Asm_c.mak +12 -0
  72. package/vendor/7zip/C/Bcj2.c +290 -0
  73. package/vendor/7zip/C/Bcj2.h +332 -0
  74. package/vendor/7zip/C/Bcj2Enc.c +509 -0
  75. package/vendor/7zip/C/Blake2.h +105 -0
  76. package/vendor/7zip/C/Blake2s.c +2672 -0
  77. package/vendor/7zip/C/Bra.c +709 -0
  78. package/vendor/7zip/C/Bra.h +105 -0
  79. package/vendor/7zip/C/Bra86.c +187 -0
  80. package/vendor/7zip/C/BraIA64.c +14 -0
  81. package/vendor/7zip/C/BwtSort.c +630 -0
  82. package/vendor/7zip/C/BwtSort.h +27 -0
  83. package/vendor/7zip/C/Compiler.h +287 -0
  84. package/vendor/7zip/C/CpuArch.c +970 -0
  85. package/vendor/7zip/C/CpuArch.h +719 -0
  86. package/vendor/7zip/C/Delta.c +169 -0
  87. package/vendor/7zip/C/Delta.h +19 -0
  88. package/vendor/7zip/C/DllSecur.c +99 -0
  89. package/vendor/7zip/C/DllSecur.h +20 -0
  90. package/vendor/7zip/C/HuffEnc.c +361 -0
  91. package/vendor/7zip/C/HuffEnc.h +23 -0
  92. package/vendor/7zip/C/LzFind.c +1746 -0
  93. package/vendor/7zip/C/LzFind.h +160 -0
  94. package/vendor/7zip/C/LzFindMt.c +1422 -0
  95. package/vendor/7zip/C/LzFindMt.h +114 -0
  96. package/vendor/7zip/C/LzFindOpt.c +578 -0
  97. package/vendor/7zip/C/LzHash.h +34 -0
  98. package/vendor/7zip/C/Lzma2Dec.c +493 -0
  99. package/vendor/7zip/C/Lzma2Dec.h +121 -0
  100. package/vendor/7zip/C/Lzma2DecMt.c +1095 -0
  101. package/vendor/7zip/C/Lzma2DecMt.h +81 -0
  102. package/vendor/7zip/C/Lzma2Enc.c +799 -0
  103. package/vendor/7zip/C/Lzma2Enc.h +58 -0
  104. package/vendor/7zip/C/Lzma86.h +111 -0
  105. package/vendor/7zip/C/Lzma86Dec.c +53 -0
  106. package/vendor/7zip/C/Lzma86Enc.c +103 -0
  107. package/vendor/7zip/C/LzmaDec.c +1367 -0
  108. package/vendor/7zip/C/LzmaDec.h +237 -0
  109. package/vendor/7zip/C/LzmaEnc.c +3154 -0
  110. package/vendor/7zip/C/LzmaEnc.h +85 -0
  111. package/vendor/7zip/C/LzmaLib.c +42 -0
  112. package/vendor/7zip/C/LzmaLib.h +138 -0
  113. package/vendor/7zip/C/Md5.c +206 -0
  114. package/vendor/7zip/C/Md5.h +34 -0
  115. package/vendor/7zip/C/MtCoder.c +604 -0
  116. package/vendor/7zip/C/MtCoder.h +144 -0
  117. package/vendor/7zip/C/MtDec.c +1124 -0
  118. package/vendor/7zip/C/MtDec.h +202 -0
  119. package/vendor/7zip/C/Ppmd.h +169 -0
  120. package/vendor/7zip/C/Ppmd7.c +1131 -0
  121. package/vendor/7zip/C/Ppmd7.h +181 -0
  122. package/vendor/7zip/C/Ppmd7Dec.c +312 -0
  123. package/vendor/7zip/C/Ppmd7Enc.c +340 -0
  124. package/vendor/7zip/C/Ppmd7aDec.c +295 -0
  125. package/vendor/7zip/C/Ppmd8.c +1574 -0
  126. package/vendor/7zip/C/Ppmd8.h +181 -0
  127. package/vendor/7zip/C/Ppmd8Dec.c +295 -0
  128. package/vendor/7zip/C/Ppmd8Enc.c +337 -0
  129. package/vendor/7zip/C/Precomp.h +127 -0
  130. package/vendor/7zip/C/RotateDefs.h +50 -0
  131. package/vendor/7zip/C/Sha1.c +441 -0
  132. package/vendor/7zip/C/Sha1.h +86 -0
  133. package/vendor/7zip/C/Sha1Opt.c +424 -0
  134. package/vendor/7zip/C/Sha256.c +492 -0
  135. package/vendor/7zip/C/Sha256.h +86 -0
  136. package/vendor/7zip/C/Sha256Opt.c +451 -0
  137. package/vendor/7zip/C/Sha3.c +359 -0
  138. package/vendor/7zip/C/Sha3.h +36 -0
  139. package/vendor/7zip/C/Sha512.c +711 -0
  140. package/vendor/7zip/C/Sha512.h +86 -0
  141. package/vendor/7zip/C/Sha512Opt.c +395 -0
  142. package/vendor/7zip/C/Sort.c +268 -0
  143. package/vendor/7zip/C/Sort.h +15 -0
  144. package/vendor/7zip/C/SwapBytes.c +835 -0
  145. package/vendor/7zip/C/SwapBytes.h +17 -0
  146. package/vendor/7zip/C/Threads.c +826 -0
  147. package/vendor/7zip/C/Threads.h +260 -0
  148. package/vendor/7zip/C/Util/7z/7z.dsp +249 -0
  149. package/vendor/7zip/C/Util/7z/7z.dsw +29 -0
  150. package/vendor/7zip/C/Util/7z/7zMain.c +1210 -0
  151. package/vendor/7zip/C/Util/7z/Precomp.c +4 -0
  152. package/vendor/7zip/C/Util/7z/Precomp.h +13 -0
  153. package/vendor/7zip/C/Util/7z/makefile +44 -0
  154. package/vendor/7zip/C/Util/7z/makefile.gcc +32 -0
  155. package/vendor/7zip/C/Util/7zipInstall/7zip.ico +0 -0
  156. package/vendor/7zip/C/Util/7zipInstall/7zipInstall.c +1699 -0
  157. package/vendor/7zip/C/Util/7zipInstall/7zipInstall.dsp +248 -0
  158. package/vendor/7zip/C/Util/7zipInstall/7zipInstall.dsw +29 -0
  159. package/vendor/7zip/C/Util/7zipInstall/7zipInstall.manifest +18 -0
  160. package/vendor/7zip/C/Util/7zipInstall/Precomp.c +4 -0
  161. package/vendor/7zip/C/Util/7zipInstall/Precomp.h +13 -0
  162. package/vendor/7zip/C/Util/7zipInstall/makefile +47 -0
  163. package/vendor/7zip/C/Util/7zipInstall/resource.h +9 -0
  164. package/vendor/7zip/C/Util/7zipInstall/resource.rc +48 -0
  165. package/vendor/7zip/C/Util/7zipUninstall/7zipUninstall.c +1234 -0
  166. package/vendor/7zip/C/Util/7zipUninstall/7zipUninstall.dsp +132 -0
  167. package/vendor/7zip/C/Util/7zipUninstall/7zipUninstall.dsw +29 -0
  168. package/vendor/7zip/C/Util/7zipUninstall/7zipUninstall.ico +0 -0
  169. package/vendor/7zip/C/Util/7zipUninstall/7zipUninstall.manifest +18 -0
  170. package/vendor/7zip/C/Util/7zipUninstall/Precomp.c +4 -0
  171. package/vendor/7zip/C/Util/7zipUninstall/Precomp.h +13 -0
  172. package/vendor/7zip/C/Util/7zipUninstall/makefile +18 -0
  173. package/vendor/7zip/C/Util/7zipUninstall/resource.h +9 -0
  174. package/vendor/7zip/C/Util/7zipUninstall/resource.rc +48 -0
  175. package/vendor/7zip/C/Util/Lzma/LzmaUtil.c +313 -0
  176. package/vendor/7zip/C/Util/Lzma/LzmaUtil.dsp +192 -0
  177. package/vendor/7zip/C/Util/Lzma/LzmaUtil.dsw +29 -0
  178. package/vendor/7zip/C/Util/Lzma/Precomp.h +13 -0
  179. package/vendor/7zip/C/Util/Lzma/makefile +30 -0
  180. package/vendor/7zip/C/Util/Lzma/makefile.gcc +21 -0
  181. package/vendor/7zip/C/Util/LzmaLib/LzmaLib.def +4 -0
  182. package/vendor/7zip/C/Util/LzmaLib/LzmaLib.dsp +206 -0
  183. package/vendor/7zip/C/Util/LzmaLib/LzmaLib.dsw +29 -0
  184. package/vendor/7zip/C/Util/LzmaLib/LzmaLibExports.c +15 -0
  185. package/vendor/7zip/C/Util/LzmaLib/Precomp.c +4 -0
  186. package/vendor/7zip/C/Util/LzmaLib/Precomp.h +13 -0
  187. package/vendor/7zip/C/Util/LzmaLib/makefile +59 -0
  188. package/vendor/7zip/C/Util/LzmaLib/resource.rc +3 -0
  189. package/vendor/7zip/C/Util/SfxSetup/Precomp.c +4 -0
  190. package/vendor/7zip/C/Util/SfxSetup/Precomp.h +13 -0
  191. package/vendor/7zip/C/Util/SfxSetup/SfxSetup.c +657 -0
  192. package/vendor/7zip/C/Util/SfxSetup/SfxSetup.dsp +231 -0
  193. package/vendor/7zip/C/Util/SfxSetup/SfxSetup.dsw +29 -0
  194. package/vendor/7zip/C/Util/SfxSetup/makefile +44 -0
  195. package/vendor/7zip/C/Util/SfxSetup/makefile_con +40 -0
  196. package/vendor/7zip/C/Util/SfxSetup/resource.rc +5 -0
  197. package/vendor/7zip/C/Util/SfxSetup/setup.ico +0 -0
  198. package/vendor/7zip/C/Xxh64.c +389 -0
  199. package/vendor/7zip/C/Xxh64.h +50 -0
  200. package/vendor/7zip/C/Xz.c +92 -0
  201. package/vendor/7zip/C/Xz.h +542 -0
  202. package/vendor/7zip/C/XzCrc64.c +140 -0
  203. package/vendor/7zip/C/XzCrc64.h +26 -0
  204. package/vendor/7zip/C/XzCrc64Opt.c +261 -0
  205. package/vendor/7zip/C/XzDec.c +2865 -0
  206. package/vendor/7zip/C/XzEnc.c +1374 -0
  207. package/vendor/7zip/C/XzEnc.h +62 -0
  208. package/vendor/7zip/C/XzIn.c +385 -0
  209. package/vendor/7zip/C/ZstdDec.c +4067 -0
  210. package/vendor/7zip/C/ZstdDec.h +173 -0
  211. package/vendor/7zip/C/var_clang.mak +11 -0
  212. package/vendor/7zip/C/var_clang_arm64.mak +12 -0
  213. package/vendor/7zip/C/var_clang_x64.mak +11 -0
  214. package/vendor/7zip/C/var_clang_x86.mak +11 -0
  215. package/vendor/7zip/C/var_gcc.mak +12 -0
  216. package/vendor/7zip/C/var_gcc_arm64.mak +12 -0
  217. package/vendor/7zip/C/var_gcc_x64.mak +10 -0
  218. package/vendor/7zip/C/var_gcc_x86.mak +10 -0
  219. package/vendor/7zip/C/var_mac_arm64.mak +13 -0
  220. package/vendor/7zip/C/var_mac_x64.mak +13 -0
  221. package/vendor/7zip/C/warn_clang.mak +1 -0
  222. package/vendor/7zip/C/warn_clang_mac.mak +1 -0
  223. package/vendor/7zip/C/warn_gcc.mak +51 -0
  224. package/vendor/7zip/CPP/7zip/7zip.mak +240 -0
  225. package/vendor/7zip/CPP/7zip/7zip_gcc.mak +1376 -0
  226. package/vendor/7zip/CPP/7zip/Aes.mak +10 -0
  227. package/vendor/7zip/CPP/7zip/Archive/7z/7z.dsp +650 -0
  228. package/vendor/7zip/CPP/7zip/Archive/7z/7z.dsw +29 -0
  229. package/vendor/7zip/CPP/7zip/Archive/7z/7zCompressionMode.cpp +3 -0
  230. package/vendor/7zip/CPP/7zip/Archive/7z/7zCompressionMode.h +92 -0
  231. package/vendor/7zip/CPP/7zip/Archive/7z/7zDecode.cpp +599 -0
  232. package/vendor/7zip/CPP/7zip/Archive/7z/7zDecode.h +73 -0
  233. package/vendor/7zip/CPP/7zip/Archive/7z/7zEncode.cpp +702 -0
  234. package/vendor/7zip/CPP/7zip/Archive/7z/7zEncode.h +95 -0
  235. package/vendor/7zip/CPP/7zip/Archive/7z/7zExtract.cpp +444 -0
  236. package/vendor/7zip/CPP/7zip/Archive/7z/7zFolderInStream.cpp +264 -0
  237. package/vendor/7zip/CPP/7zip/Archive/7z/7zFolderInStream.h +101 -0
  238. package/vendor/7zip/CPP/7zip/Archive/7z/7zHandler.cpp +800 -0
  239. package/vendor/7zip/CPP/7zip/Archive/7z/7zHandler.h +178 -0
  240. package/vendor/7zip/CPP/7zip/Archive/7z/7zHandlerOut.cpp +1162 -0
  241. package/vendor/7zip/CPP/7zip/Archive/7z/7zHeader.cpp +19 -0
  242. package/vendor/7zip/CPP/7zip/Archive/7z/7zHeader.h +156 -0
  243. package/vendor/7zip/CPP/7zip/Archive/7z/7zIn.cpp +1815 -0
  244. package/vendor/7zip/CPP/7zip/Archive/7z/7zIn.h +454 -0
  245. package/vendor/7zip/CPP/7zip/Archive/7z/7zItem.h +207 -0
  246. package/vendor/7zip/CPP/7zip/Archive/7z/7zOut.cpp +1026 -0
  247. package/vendor/7zip/CPP/7zip/Archive/7z/7zOut.h +346 -0
  248. package/vendor/7zip/CPP/7zip/Archive/7z/7zProperties.cpp +182 -0
  249. package/vendor/7zip/CPP/7zip/Archive/7z/7zProperties.h +26 -0
  250. package/vendor/7zip/CPP/7zip/Archive/7z/7zRegister.cpp +27 -0
  251. package/vendor/7zip/CPP/7zip/Archive/7z/7zSpecStream.cpp +31 -0
  252. package/vendor/7zip/CPP/7zip/Archive/7z/7zSpecStream.h +49 -0
  253. package/vendor/7zip/CPP/7zip/Archive/7z/7zUpdate.cpp +3087 -0
  254. package/vendor/7zip/CPP/7zip/Archive/7z/7zUpdate.h +167 -0
  255. package/vendor/7zip/CPP/7zip/Archive/7z/StdAfx.cpp +3 -0
  256. package/vendor/7zip/CPP/7zip/Archive/7z/StdAfx.h +11 -0
  257. package/vendor/7zip/CPP/7zip/Archive/7z/makefile +81 -0
  258. package/vendor/7zip/CPP/7zip/Archive/7z/resource.rc +11 -0
  259. package/vendor/7zip/CPP/7zip/Archive/ApfsHandler.cpp +4470 -0
  260. package/vendor/7zip/CPP/7zip/Archive/ApmHandler.cpp +420 -0
  261. package/vendor/7zip/CPP/7zip/Archive/ArHandler.cpp +844 -0
  262. package/vendor/7zip/CPP/7zip/Archive/Archive.def +15 -0
  263. package/vendor/7zip/CPP/7zip/Archive/Archive2.def +22 -0
  264. package/vendor/7zip/CPP/7zip/Archive/ArchiveExports.cpp +158 -0
  265. package/vendor/7zip/CPP/7zip/Archive/ArjHandler.cpp +977 -0
  266. package/vendor/7zip/CPP/7zip/Archive/AvbHandler.cpp +616 -0
  267. package/vendor/7zip/CPP/7zip/Archive/Base64Handler.cpp +488 -0
  268. package/vendor/7zip/CPP/7zip/Archive/Bz2Handler.cpp +482 -0
  269. package/vendor/7zip/CPP/7zip/Archive/Cab/CabBlockInStream.cpp +122 -0
  270. package/vendor/7zip/CPP/7zip/Archive/Cab/CabBlockInStream.h +28 -0
  271. package/vendor/7zip/CPP/7zip/Archive/Cab/CabHandler.cpp +1270 -0
  272. package/vendor/7zip/CPP/7zip/Archive/Cab/CabHandler.h +29 -0
  273. package/vendor/7zip/CPP/7zip/Archive/Cab/CabHeader.cpp +15 -0
  274. package/vendor/7zip/CPP/7zip/Archive/Cab/CabHeader.h +41 -0
  275. package/vendor/7zip/CPP/7zip/Archive/Cab/CabIn.cpp +485 -0
  276. package/vendor/7zip/CPP/7zip/Archive/Cab/CabIn.h +169 -0
  277. package/vendor/7zip/CPP/7zip/Archive/Cab/CabItem.h +69 -0
  278. package/vendor/7zip/CPP/7zip/Archive/Cab/CabRegister.cpp +19 -0
  279. package/vendor/7zip/CPP/7zip/Archive/Cab/StdAfx.h +11 -0
  280. package/vendor/7zip/CPP/7zip/Archive/Chm/ChmHandler.cpp +790 -0
  281. package/vendor/7zip/CPP/7zip/Archive/Chm/ChmHandler.h +27 -0
  282. package/vendor/7zip/CPP/7zip/Archive/Chm/ChmIn.cpp +1026 -0
  283. package/vendor/7zip/CPP/7zip/Archive/Chm/ChmIn.h +282 -0
  284. package/vendor/7zip/CPP/7zip/Archive/Chm/StdAfx.h +11 -0
  285. package/vendor/7zip/CPP/7zip/Archive/ComHandler.cpp +1449 -0
  286. package/vendor/7zip/CPP/7zip/Archive/Common/CoderMixer2.cpp +1144 -0
  287. package/vendor/7zip/CPP/7zip/Archive/Common/CoderMixer2.h +447 -0
  288. package/vendor/7zip/CPP/7zip/Archive/Common/DummyOutStream.cpp +17 -0
  289. package/vendor/7zip/CPP/7zip/Archive/Common/DummyOutStream.h +23 -0
  290. package/vendor/7zip/CPP/7zip/Archive/Common/FindSignature.cpp +90 -0
  291. package/vendor/7zip/CPP/7zip/Archive/Common/FindSignature.h +12 -0
  292. package/vendor/7zip/CPP/7zip/Archive/Common/HandlerOut.cpp +315 -0
  293. package/vendor/7zip/CPP/7zip/Archive/Common/HandlerOut.h +169 -0
  294. package/vendor/7zip/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +57 -0
  295. package/vendor/7zip/CPP/7zip/Archive/Common/InStreamWithCRC.h +64 -0
  296. package/vendor/7zip/CPP/7zip/Archive/Common/ItemNameUtils.cpp +140 -0
  297. package/vendor/7zip/CPP/7zip/Archive/Common/ItemNameUtils.h +33 -0
  298. package/vendor/7zip/CPP/7zip/Archive/Common/MultiStream.cpp +193 -0
  299. package/vendor/7zip/CPP/7zip/Archive/Common/MultiStream.h +86 -0
  300. package/vendor/7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +18 -0
  301. package/vendor/7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.h +35 -0
  302. package/vendor/7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp +29 -0
  303. package/vendor/7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.h +61 -0
  304. package/vendor/7zip/CPP/7zip/Archive/Common/ParseProperties.cpp +3 -0
  305. package/vendor/7zip/CPP/7zip/Archive/Common/ParseProperties.h +6 -0
  306. package/vendor/7zip/CPP/7zip/Archive/Common/StdAfx.h +11 -0
  307. package/vendor/7zip/CPP/7zip/Archive/CpioHandler.cpp +1110 -0
  308. package/vendor/7zip/CPP/7zip/Archive/CramfsHandler.cpp +784 -0
  309. package/vendor/7zip/CPP/7zip/Archive/DeflateProps.cpp +3 -0
  310. package/vendor/7zip/CPP/7zip/Archive/DeflateProps.h +6 -0
  311. package/vendor/7zip/CPP/7zip/Archive/DllExports.cpp +96 -0
  312. package/vendor/7zip/CPP/7zip/Archive/DllExports2.cpp +184 -0
  313. package/vendor/7zip/CPP/7zip/Archive/DmgHandler.cpp +2336 -0
  314. package/vendor/7zip/CPP/7zip/Archive/ElfHandler.cpp +1284 -0
  315. package/vendor/7zip/CPP/7zip/Archive/ExtHandler.cpp +2860 -0
  316. package/vendor/7zip/CPP/7zip/Archive/FatHandler.cpp +1325 -0
  317. package/vendor/7zip/CPP/7zip/Archive/FlvHandler.cpp +521 -0
  318. package/vendor/7zip/CPP/7zip/Archive/GptHandler.cpp +473 -0
  319. package/vendor/7zip/CPP/7zip/Archive/GzHandler.cpp +1200 -0
  320. package/vendor/7zip/CPP/7zip/Archive/HandlerCont.cpp +320 -0
  321. package/vendor/7zip/CPP/7zip/Archive/HandlerCont.h +134 -0
  322. package/vendor/7zip/CPP/7zip/Archive/HfsHandler.cpp +2631 -0
  323. package/vendor/7zip/CPP/7zip/Archive/HfsHandler.h +87 -0
  324. package/vendor/7zip/CPP/7zip/Archive/IArchive.h +755 -0
  325. package/vendor/7zip/CPP/7zip/Archive/Icons/7z.ico +0 -0
  326. package/vendor/7zip/CPP/7zip/Archive/Icons/apfs.ico +0 -0
  327. package/vendor/7zip/CPP/7zip/Archive/Icons/arj.ico +0 -0
  328. package/vendor/7zip/CPP/7zip/Archive/Icons/bz2.ico +0 -0
  329. package/vendor/7zip/CPP/7zip/Archive/Icons/cab.ico +0 -0
  330. package/vendor/7zip/CPP/7zip/Archive/Icons/cpio.ico +0 -0
  331. package/vendor/7zip/CPP/7zip/Archive/Icons/deb.ico +0 -0
  332. package/vendor/7zip/CPP/7zip/Archive/Icons/dmg.ico +0 -0
  333. package/vendor/7zip/CPP/7zip/Archive/Icons/fat.ico +0 -0
  334. package/vendor/7zip/CPP/7zip/Archive/Icons/gz.ico +0 -0
  335. package/vendor/7zip/CPP/7zip/Archive/Icons/hfs.ico +0 -0
  336. package/vendor/7zip/CPP/7zip/Archive/Icons/iso.ico +0 -0
  337. package/vendor/7zip/CPP/7zip/Archive/Icons/lzh.ico +0 -0
  338. package/vendor/7zip/CPP/7zip/Archive/Icons/lzma.ico +0 -0
  339. package/vendor/7zip/CPP/7zip/Archive/Icons/ntfs.ico +0 -0
  340. package/vendor/7zip/CPP/7zip/Archive/Icons/rar.ico +0 -0
  341. package/vendor/7zip/CPP/7zip/Archive/Icons/rpm.ico +0 -0
  342. package/vendor/7zip/CPP/7zip/Archive/Icons/split.ico +0 -0
  343. package/vendor/7zip/CPP/7zip/Archive/Icons/squashfs.ico +0 -0
  344. package/vendor/7zip/CPP/7zip/Archive/Icons/tar.ico +0 -0
  345. package/vendor/7zip/CPP/7zip/Archive/Icons/vhd.ico +0 -0
  346. package/vendor/7zip/CPP/7zip/Archive/Icons/wim.ico +0 -0
  347. package/vendor/7zip/CPP/7zip/Archive/Icons/xar.ico +0 -0
  348. package/vendor/7zip/CPP/7zip/Archive/Icons/xz.ico +0 -0
  349. package/vendor/7zip/CPP/7zip/Archive/Icons/z.ico +0 -0
  350. package/vendor/7zip/CPP/7zip/Archive/Icons/zip.ico +0 -0
  351. package/vendor/7zip/CPP/7zip/Archive/Icons/zst.ico +0 -0
  352. package/vendor/7zip/CPP/7zip/Archive/IhexHandler.cpp +493 -0
  353. package/vendor/7zip/CPP/7zip/Archive/Iso/IsoHandler.cpp +498 -0
  354. package/vendor/7zip/CPP/7zip/Archive/Iso/IsoHandler.h +24 -0
  355. package/vendor/7zip/CPP/7zip/Archive/Iso/IsoHeader.cpp +12 -0
  356. package/vendor/7zip/CPP/7zip/Archive/Iso/IsoHeader.h +64 -0
  357. package/vendor/7zip/CPP/7zip/Archive/Iso/IsoIn.cpp +801 -0
  358. package/vendor/7zip/CPP/7zip/Archive/Iso/IsoIn.h +328 -0
  359. package/vendor/7zip/CPP/7zip/Archive/Iso/IsoItem.h +316 -0
  360. package/vendor/7zip/CPP/7zip/Archive/Iso/IsoRegister.cpp +21 -0
  361. package/vendor/7zip/CPP/7zip/Archive/Iso/StdAfx.h +11 -0
  362. package/vendor/7zip/CPP/7zip/Archive/LpHandler.cpp +1172 -0
  363. package/vendor/7zip/CPP/7zip/Archive/LvmHandler.cpp +1108 -0
  364. package/vendor/7zip/CPP/7zip/Archive/LzhHandler.cpp +719 -0
  365. package/vendor/7zip/CPP/7zip/Archive/LzmaHandler.cpp +606 -0
  366. package/vendor/7zip/CPP/7zip/Archive/MachoHandler.cpp +1075 -0
  367. package/vendor/7zip/CPP/7zip/Archive/MbrHandler.cpp +648 -0
  368. package/vendor/7zip/CPP/7zip/Archive/MslzHandler.cpp +389 -0
  369. package/vendor/7zip/CPP/7zip/Archive/MubHandler.cpp +248 -0
  370. package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisDecode.cpp +295 -0
  371. package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisDecode.h +97 -0
  372. package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisHandler.cpp +703 -0
  373. package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisHandler.h +30 -0
  374. package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisIn.cpp +6231 -0
  375. package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisIn.h +462 -0
  376. package/vendor/7zip/CPP/7zip/Archive/Nsis/NsisRegister.cpp +20 -0
  377. package/vendor/7zip/CPP/7zip/Archive/Nsis/StdAfx.h +11 -0
  378. package/vendor/7zip/CPP/7zip/Archive/NtfsHandler.cpp +2944 -0
  379. package/vendor/7zip/CPP/7zip/Archive/PeHandler.cpp +3427 -0
  380. package/vendor/7zip/CPP/7zip/Archive/PpmdHandler.cpp +414 -0
  381. package/vendor/7zip/CPP/7zip/Archive/QcowHandler.cpp +713 -0
  382. package/vendor/7zip/CPP/7zip/Archive/Rar/Rar5Handler.cpp +3483 -0
  383. package/vendor/7zip/CPP/7zip/Archive/Rar/Rar5Handler.h +527 -0
  384. package/vendor/7zip/CPP/7zip/Archive/Rar/RarHandler.cpp +1775 -0
  385. package/vendor/7zip/CPP/7zip/Archive/Rar/RarHandler.h +115 -0
  386. package/vendor/7zip/CPP/7zip/Archive/Rar/RarHeader.h +209 -0
  387. package/vendor/7zip/CPP/7zip/Archive/Rar/RarItem.h +97 -0
  388. package/vendor/7zip/CPP/7zip/Archive/Rar/RarVol.h +136 -0
  389. package/vendor/7zip/CPP/7zip/Archive/Rar/StdAfx.cpp +3 -0
  390. package/vendor/7zip/CPP/7zip/Archive/Rar/StdAfx.h +11 -0
  391. package/vendor/7zip/CPP/7zip/Archive/RpmHandler.cpp +775 -0
  392. package/vendor/7zip/CPP/7zip/Archive/SparseHandler.cpp +558 -0
  393. package/vendor/7zip/CPP/7zip/Archive/SplitHandler.cpp +353 -0
  394. package/vendor/7zip/CPP/7zip/Archive/SquashfsHandler.cpp +2373 -0
  395. package/vendor/7zip/CPP/7zip/Archive/StdAfx.h +11 -0
  396. package/vendor/7zip/CPP/7zip/Archive/SwfHandler.cpp +996 -0
  397. package/vendor/7zip/CPP/7zip/Archive/Tar/StdAfx.h +11 -0
  398. package/vendor/7zip/CPP/7zip/Archive/Tar/TarHandler.cpp +1105 -0
  399. package/vendor/7zip/CPP/7zip/Archive/Tar/TarHandler.h +57 -0
  400. package/vendor/7zip/CPP/7zip/Archive/Tar/TarHandlerOut.cpp +332 -0
  401. package/vendor/7zip/CPP/7zip/Archive/Tar/TarHeader.cpp +99 -0
  402. package/vendor/7zip/CPP/7zip/Archive/Tar/TarHeader.h +90 -0
  403. package/vendor/7zip/CPP/7zip/Archive/Tar/TarIn.cpp +1151 -0
  404. package/vendor/7zip/CPP/7zip/Archive/Tar/TarIn.h +151 -0
  405. package/vendor/7zip/CPP/7zip/Archive/Tar/TarItem.h +365 -0
  406. package/vendor/7zip/CPP/7zip/Archive/Tar/TarOut.cpp +644 -0
  407. package/vendor/7zip/CPP/7zip/Archive/Tar/TarOut.h +53 -0
  408. package/vendor/7zip/CPP/7zip/Archive/Tar/TarRegister.cpp +31 -0
  409. package/vendor/7zip/CPP/7zip/Archive/Tar/TarUpdate.cpp +563 -0
  410. package/vendor/7zip/CPP/7zip/Archive/Tar/TarUpdate.h +74 -0
  411. package/vendor/7zip/CPP/7zip/Archive/Udf/StdAfx.h +11 -0
  412. package/vendor/7zip/CPP/7zip/Archive/Udf/UdfHandler.cpp +427 -0
  413. package/vendor/7zip/CPP/7zip/Archive/Udf/UdfHandler.h +32 -0
  414. package/vendor/7zip/CPP/7zip/Archive/Udf/UdfIn.cpp +1756 -0
  415. package/vendor/7zip/CPP/7zip/Archive/Udf/UdfIn.h +508 -0
  416. package/vendor/7zip/CPP/7zip/Archive/UefiHandler.cpp +1884 -0
  417. package/vendor/7zip/CPP/7zip/Archive/VdiHandler.cpp +433 -0
  418. package/vendor/7zip/CPP/7zip/Archive/VhdHandler.cpp +1106 -0
  419. package/vendor/7zip/CPP/7zip/Archive/VhdxHandler.cpp +2085 -0
  420. package/vendor/7zip/CPP/7zip/Archive/VmdkHandler.cpp +1530 -0
  421. package/vendor/7zip/CPP/7zip/Archive/Wim/StdAfx.h +11 -0
  422. package/vendor/7zip/CPP/7zip/Archive/Wim/WimHandler.cpp +1291 -0
  423. package/vendor/7zip/CPP/7zip/Archive/Wim/WimHandler.h +117 -0
  424. package/vendor/7zip/CPP/7zip/Archive/Wim/WimHandlerOut.cpp +2008 -0
  425. package/vendor/7zip/CPP/7zip/Archive/Wim/WimIn.cpp +2104 -0
  426. package/vendor/7zip/CPP/7zip/Archive/Wim/WimIn.h +719 -0
  427. package/vendor/7zip/CPP/7zip/Archive/Wim/WimRegister.cpp +29 -0
  428. package/vendor/7zip/CPP/7zip/Archive/XarHandler.cpp +1316 -0
  429. package/vendor/7zip/CPP/7zip/Archive/XzHandler.cpp +1452 -0
  430. package/vendor/7zip/CPP/7zip/Archive/XzHandler.h +11 -0
  431. package/vendor/7zip/CPP/7zip/Archive/ZHandler.cpp +208 -0
  432. package/vendor/7zip/CPP/7zip/Archive/Zip/StdAfx.h +11 -0
  433. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipAddCommon.cpp +484 -0
  434. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipAddCommon.h +76 -0
  435. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipCompressionMode.h +62 -0
  436. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipHandler.cpp +1679 -0
  437. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipHandler.h +94 -0
  438. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp +626 -0
  439. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipHeader.h +201 -0
  440. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipIn.cpp +3474 -0
  441. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipIn.h +456 -0
  442. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipItem.cpp +464 -0
  443. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipItem.h +356 -0
  444. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipOut.cpp +428 -0
  445. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipOut.h +103 -0
  446. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipRegister.cpp +38 -0
  447. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipUpdate.cpp +2165 -0
  448. package/vendor/7zip/CPP/7zip/Archive/Zip/ZipUpdate.h +107 -0
  449. package/vendor/7zip/CPP/7zip/Archive/ZstdHandler.cpp +1147 -0
  450. package/vendor/7zip/CPP/7zip/Archive/makefile +23 -0
  451. package/vendor/7zip/CPP/7zip/Asm.mak +12 -0
  452. package/vendor/7zip/CPP/7zip/Bundles/Alone/Alone.dsp +3324 -0
  453. package/vendor/7zip/CPP/7zip/Bundles/Alone/Alone.dsw +29 -0
  454. package/vendor/7zip/CPP/7zip/Bundles/Alone/StdAfx.cpp +3 -0
  455. package/vendor/7zip/CPP/7zip/Bundles/Alone/StdAfx.h +11 -0
  456. package/vendor/7zip/CPP/7zip/Bundles/Alone/makefile +245 -0
  457. package/vendor/7zip/CPP/7zip/Bundles/Alone/makefile.gcc +354 -0
  458. package/vendor/7zip/CPP/7zip/Bundles/Alone/resource.rc +7 -0
  459. package/vendor/7zip/CPP/7zip/Bundles/Alone2/StdAfx.cpp +3 -0
  460. package/vendor/7zip/CPP/7zip/Bundles/Alone2/StdAfx.h +11 -0
  461. package/vendor/7zip/CPP/7zip/Bundles/Alone2/makefile +31 -0
  462. package/vendor/7zip/CPP/7zip/Bundles/Alone2/makefile.gcc +108 -0
  463. package/vendor/7zip/CPP/7zip/Bundles/Alone2/resource.rc +7 -0
  464. package/vendor/7zip/CPP/7zip/Bundles/Alone7z/Alone.dsp +2090 -0
  465. package/vendor/7zip/CPP/7zip/Bundles/Alone7z/Alone.dsw +29 -0
  466. package/vendor/7zip/CPP/7zip/Bundles/Alone7z/StdAfx.cpp +3 -0
  467. package/vendor/7zip/CPP/7zip/Bundles/Alone7z/StdAfx.h +11 -0
  468. package/vendor/7zip/CPP/7zip/Bundles/Alone7z/makefile +168 -0
  469. package/vendor/7zip/CPP/7zip/Bundles/Alone7z/makefile.gcc +276 -0
  470. package/vendor/7zip/CPP/7zip/Bundles/Alone7z/resource.rc +7 -0
  471. package/vendor/7zip/CPP/7zip/Bundles/Fm/FM.dsp +2275 -0
  472. package/vendor/7zip/CPP/7zip/Bundles/Fm/FM.dsw +29 -0
  473. package/vendor/7zip/CPP/7zip/Bundles/Fm/StdAfx.cpp +3 -0
  474. package/vendor/7zip/CPP/7zip/Bundles/Fm/StdAfx.h +6 -0
  475. package/vendor/7zip/CPP/7zip/Bundles/Fm/makefile +82 -0
  476. package/vendor/7zip/CPP/7zip/Bundles/Fm/resource.rc +7 -0
  477. package/vendor/7zip/CPP/7zip/Bundles/Format7z/StdAfx.cpp +3 -0
  478. package/vendor/7zip/CPP/7zip/Bundles/Format7z/StdAfx.h +11 -0
  479. package/vendor/7zip/CPP/7zip/Bundles/Format7z/makefile +148 -0
  480. package/vendor/7zip/CPP/7zip/Bundles/Format7z/resource.rc +5 -0
  481. package/vendor/7zip/CPP/7zip/Bundles/Format7zExtract/StdAfx.cpp +3 -0
  482. package/vendor/7zip/CPP/7zip/Bundles/Format7zExtract/StdAfx.h +11 -0
  483. package/vendor/7zip/CPP/7zip/Bundles/Format7zExtract/makefile +116 -0
  484. package/vendor/7zip/CPP/7zip/Bundles/Format7zExtract/resource.rc +5 -0
  485. package/vendor/7zip/CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp +3 -0
  486. package/vendor/7zip/CPP/7zip/Bundles/Format7zExtractR/StdAfx.h +11 -0
  487. package/vendor/7zip/CPP/7zip/Bundles/Format7zExtractR/makefile +98 -0
  488. package/vendor/7zip/CPP/7zip/Bundles/Format7zExtractR/resource.rc +5 -0
  489. package/vendor/7zip/CPP/7zip/Bundles/Format7zF/Arc.mak +310 -0
  490. package/vendor/7zip/CPP/7zip/Bundles/Format7zF/Arc_gcc.mak +395 -0
  491. package/vendor/7zip/CPP/7zip/Bundles/Format7zF/Format7z.dsp +3486 -0
  492. package/vendor/7zip/CPP/7zip/Bundles/Format7zF/Format7z.dsw +29 -0
  493. package/vendor/7zip/CPP/7zip/Bundles/Format7zF/StdAfx.cpp +3 -0
  494. package/vendor/7zip/CPP/7zip/Bundles/Format7zF/StdAfx.h +11 -0
  495. package/vendor/7zip/CPP/7zip/Bundles/Format7zF/makefile +20 -0
  496. package/vendor/7zip/CPP/7zip/Bundles/Format7zF/makefile.gcc +55 -0
  497. package/vendor/7zip/CPP/7zip/Bundles/Format7zF/resource.rc +39 -0
  498. package/vendor/7zip/CPP/7zip/Bundles/Format7zR/StdAfx.cpp +3 -0
  499. package/vendor/7zip/CPP/7zip/Bundles/Format7zR/StdAfx.h +11 -0
  500. package/vendor/7zip/CPP/7zip/Bundles/Format7zR/makefile +121 -0
  501. package/vendor/7zip/CPP/7zip/Bundles/Format7zR/resource.rc +5 -0
  502. package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp +815 -0
  503. package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp +540 -0
  504. package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsw +29 -0
  505. package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/StdAfx.cpp +3 -0
  506. package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/StdAfx.h +11 -0
  507. package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/makefile +68 -0
  508. package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/makefile.gcc +131 -0
  509. package/vendor/7zip/CPP/7zip/Bundles/LzmaCon/resource.rc +3 -0
  510. package/vendor/7zip/CPP/7zip/Bundles/SFXCon/7z.ico +0 -0
  511. package/vendor/7zip/CPP/7zip/Bundles/SFXCon/SFXCon.dsp +1017 -0
  512. package/vendor/7zip/CPP/7zip/Bundles/SFXCon/SFXCon.dsw +29 -0
  513. package/vendor/7zip/CPP/7zip/Bundles/SFXCon/SfxCon.cpp +521 -0
  514. package/vendor/7zip/CPP/7zip/Bundles/SFXCon/StdAfx.cpp +3 -0
  515. package/vendor/7zip/CPP/7zip/Bundles/SFXCon/StdAfx.h +11 -0
  516. package/vendor/7zip/CPP/7zip/Bundles/SFXCon/makefile +137 -0
  517. package/vendor/7zip/CPP/7zip/Bundles/SFXCon/makefile.gcc +215 -0
  518. package/vendor/7zip/CPP/7zip/Bundles/SFXCon/resource.rc +9 -0
  519. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.cpp +246 -0
  520. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.h +83 -0
  521. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp +135 -0
  522. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h +11 -0
  523. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp +872 -0
  524. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsw +29 -0
  525. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp +359 -0
  526. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/StdAfx.cpp +3 -0
  527. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/StdAfx.h +6 -0
  528. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/makefile +121 -0
  529. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/resource.h +6 -0
  530. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/resource.rc +16 -0
  531. package/vendor/7zip/CPP/7zip/Bundles/SFXSetup/setup.ico +0 -0
  532. package/vendor/7zip/CPP/7zip/Bundles/SFXWin/7z.ico +0 -0
  533. package/vendor/7zip/CPP/7zip/Bundles/SFXWin/SFXWin.dsp +1074 -0
  534. package/vendor/7zip/CPP/7zip/Bundles/SFXWin/SFXWin.dsw +29 -0
  535. package/vendor/7zip/CPP/7zip/Bundles/SFXWin/SfxWin.cpp +268 -0
  536. package/vendor/7zip/CPP/7zip/Bundles/SFXWin/StdAfx.cpp +3 -0
  537. package/vendor/7zip/CPP/7zip/Bundles/SFXWin/StdAfx.h +6 -0
  538. package/vendor/7zip/CPP/7zip/Bundles/SFXWin/makefile +159 -0
  539. package/vendor/7zip/CPP/7zip/Bundles/SFXWin/resource.h +1 -0
  540. package/vendor/7zip/CPP/7zip/Bundles/SFXWin/resource.rc +55 -0
  541. package/vendor/7zip/CPP/7zip/Bundles/makefile +19 -0
  542. package/vendor/7zip/CPP/7zip/Common/CWrappers.cpp +358 -0
  543. package/vendor/7zip/CPP/7zip/Common/CWrappers.h +182 -0
  544. package/vendor/7zip/CPP/7zip/Common/CreateCoder.cpp +548 -0
  545. package/vendor/7zip/CPP/7zip/Common/CreateCoder.h +200 -0
  546. package/vendor/7zip/CPP/7zip/Common/FilePathAutoRename.cpp +46 -0
  547. package/vendor/7zip/CPP/7zip/Common/FilePathAutoRename.h +10 -0
  548. package/vendor/7zip/CPP/7zip/Common/FileStreams.cpp +923 -0
  549. package/vendor/7zip/CPP/7zip/Common/FileStreams.h +205 -0
  550. package/vendor/7zip/CPP/7zip/Common/FilterCoder.cpp +582 -0
  551. package/vendor/7zip/CPP/7zip/Common/FilterCoder.h +201 -0
  552. package/vendor/7zip/CPP/7zip/Common/InBuffer.cpp +182 -0
  553. package/vendor/7zip/CPP/7zip/Common/InBuffer.h +121 -0
  554. package/vendor/7zip/CPP/7zip/Common/InOutTempBuffer.cpp +237 -0
  555. package/vendor/7zip/CPP/7zip/Common/InOutTempBuffer.h +45 -0
  556. package/vendor/7zip/CPP/7zip/Common/LimitedStreams.cpp +395 -0
  557. package/vendor/7zip/CPP/7zip/Common/LimitedStreams.h +221 -0
  558. package/vendor/7zip/CPP/7zip/Common/LockedStream.cpp +3 -0
  559. package/vendor/7zip/CPP/7zip/Common/LockedStream.h +6 -0
  560. package/vendor/7zip/CPP/7zip/Common/MemBlocks.cpp +215 -0
  561. package/vendor/7zip/CPP/7zip/Common/MemBlocks.h +72 -0
  562. package/vendor/7zip/CPP/7zip/Common/MethodId.cpp +3 -0
  563. package/vendor/7zip/CPP/7zip/Common/MethodId.h +10 -0
  564. package/vendor/7zip/CPP/7zip/Common/MethodProps.cpp +765 -0
  565. package/vendor/7zip/CPP/7zip/Common/MethodProps.h +348 -0
  566. package/vendor/7zip/CPP/7zip/Common/MultiOutStream.cpp +855 -0
  567. package/vendor/7zip/CPP/7zip/Common/MultiOutStream.h +160 -0
  568. package/vendor/7zip/CPP/7zip/Common/OffsetStream.cpp +37 -0
  569. package/vendor/7zip/CPP/7zip/Common/OffsetStream.h +22 -0
  570. package/vendor/7zip/CPP/7zip/Common/OutBuffer.cpp +111 -0
  571. package/vendor/7zip/CPP/7zip/Common/OutBuffer.h +133 -0
  572. package/vendor/7zip/CPP/7zip/Common/OutMemStream.cpp +158 -0
  573. package/vendor/7zip/CPP/7zip/Common/OutMemStream.h +104 -0
  574. package/vendor/7zip/CPP/7zip/Common/ProgressMt.cpp +53 -0
  575. package/vendor/7zip/CPP/7zip/Common/ProgressMt.h +43 -0
  576. package/vendor/7zip/CPP/7zip/Common/ProgressUtils.cpp +51 -0
  577. package/vendor/7zip/CPP/7zip/Common/ProgressUtils.h +33 -0
  578. package/vendor/7zip/CPP/7zip/Common/PropId.cpp +115 -0
  579. package/vendor/7zip/CPP/7zip/Common/RegisterArc.h +80 -0
  580. package/vendor/7zip/CPP/7zip/Common/RegisterCodec.h +106 -0
  581. package/vendor/7zip/CPP/7zip/Common/StdAfx.h +11 -0
  582. package/vendor/7zip/CPP/7zip/Common/StreamBinder.cpp +151 -0
  583. package/vendor/7zip/CPP/7zip/Common/StreamBinder.h +78 -0
  584. package/vendor/7zip/CPP/7zip/Common/StreamObjects.cpp +290 -0
  585. package/vendor/7zip/CPP/7zip/Common/StreamObjects.h +146 -0
  586. package/vendor/7zip/CPP/7zip/Common/StreamUtils.cpp +101 -0
  587. package/vendor/7zip/CPP/7zip/Common/StreamUtils.h +31 -0
  588. package/vendor/7zip/CPP/7zip/Common/UniqBlocks.cpp +57 -0
  589. package/vendor/7zip/CPP/7zip/Common/UniqBlocks.h +41 -0
  590. package/vendor/7zip/CPP/7zip/Common/VirtThread.cpp +47 -0
  591. package/vendor/7zip/CPP/7zip/Common/VirtThread.h +24 -0
  592. package/vendor/7zip/CPP/7zip/Compress/BZip2Const.h +71 -0
  593. package/vendor/7zip/CPP/7zip/Compress/BZip2Crc.cpp +28 -0
  594. package/vendor/7zip/CPP/7zip/Compress/BZip2Crc.h +31 -0
  595. package/vendor/7zip/CPP/7zip/Compress/BZip2Decoder.cpp +1777 -0
  596. package/vendor/7zip/CPP/7zip/Compress/BZip2Decoder.h +388 -0
  597. package/vendor/7zip/CPP/7zip/Compress/BZip2Encoder.cpp +1116 -0
  598. package/vendor/7zip/CPP/7zip/Compress/BZip2Encoder.h +273 -0
  599. package/vendor/7zip/CPP/7zip/Compress/BZip2Register.cpp +25 -0
  600. package/vendor/7zip/CPP/7zip/Compress/Bcj2Coder.cpp +867 -0
  601. package/vendor/7zip/CPP/7zip/Compress/Bcj2Coder.h +127 -0
  602. package/vendor/7zip/CPP/7zip/Compress/Bcj2Register.cpp +24 -0
  603. package/vendor/7zip/CPP/7zip/Compress/BcjCoder.cpp +24 -0
  604. package/vendor/7zip/CPP/7zip/Compress/BcjCoder.h +37 -0
  605. package/vendor/7zip/CPP/7zip/Compress/BcjRegister.cpp +17 -0
  606. package/vendor/7zip/CPP/7zip/Compress/BitlDecoder.cpp +32 -0
  607. package/vendor/7zip/CPP/7zip/Compress/BitlDecoder.h +225 -0
  608. package/vendor/7zip/CPP/7zip/Compress/BitlEncoder.h +57 -0
  609. package/vendor/7zip/CPP/7zip/Compress/BitmDecoder.h +106 -0
  610. package/vendor/7zip/CPP/7zip/Compress/BitmEncoder.h +90 -0
  611. package/vendor/7zip/CPP/7zip/Compress/BranchMisc.cpp +106 -0
  612. package/vendor/7zip/CPP/7zip/Compress/BranchMisc.h +59 -0
  613. package/vendor/7zip/CPP/7zip/Compress/BranchRegister.cpp +58 -0
  614. package/vendor/7zip/CPP/7zip/Compress/ByteSwap.cpp +91 -0
  615. package/vendor/7zip/CPP/7zip/Compress/Codec.def +7 -0
  616. package/vendor/7zip/CPP/7zip/Compress/CodecExports.cpp +378 -0
  617. package/vendor/7zip/CPP/7zip/Compress/CopyCoder.cpp +153 -0
  618. package/vendor/7zip/CPP/7zip/Compress/CopyCoder.h +34 -0
  619. package/vendor/7zip/CPP/7zip/Compress/CopyRegister.cpp +15 -0
  620. package/vendor/7zip/CPP/7zip/Compress/Deflate64Register.cpp +25 -0
  621. package/vendor/7zip/CPP/7zip/Compress/DeflateConst.h +131 -0
  622. package/vendor/7zip/CPP/7zip/Compress/DeflateDecoder.cpp +566 -0
  623. package/vendor/7zip/CPP/7zip/Compress/DeflateDecoder.h +154 -0
  624. package/vendor/7zip/CPP/7zip/Compress/DeflateEncoder.cpp +1045 -0
  625. package/vendor/7zip/CPP/7zip/Compress/DeflateEncoder.h +203 -0
  626. package/vendor/7zip/CPP/7zip/Compress/DeflateRegister.cpp +25 -0
  627. package/vendor/7zip/CPP/7zip/Compress/DeltaFilter.cpp +126 -0
  628. package/vendor/7zip/CPP/7zip/Compress/DllExports2Compress.cpp +38 -0
  629. package/vendor/7zip/CPP/7zip/Compress/DllExportsCompress.cpp +59 -0
  630. package/vendor/7zip/CPP/7zip/Compress/HuffmanDecoder.h +528 -0
  631. package/vendor/7zip/CPP/7zip/Compress/ImplodeDecoder.cpp +250 -0
  632. package/vendor/7zip/CPP/7zip/Compress/ImplodeDecoder.h +61 -0
  633. package/vendor/7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp +3 -0
  634. package/vendor/7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.h +6 -0
  635. package/vendor/7zip/CPP/7zip/Compress/LzOutWindow.cpp +14 -0
  636. package/vendor/7zip/CPP/7zip/Compress/LzOutWindow.h +102 -0
  637. package/vendor/7zip/CPP/7zip/Compress/LzfseDecoder.cpp +950 -0
  638. package/vendor/7zip/CPP/7zip/Compress/LzfseDecoder.h +63 -0
  639. package/vendor/7zip/CPP/7zip/Compress/LzhDecoder.cpp +220 -0
  640. package/vendor/7zip/CPP/7zip/Compress/LzhDecoder.h +68 -0
  641. package/vendor/7zip/CPP/7zip/Compress/Lzma2Decoder.cpp +267 -0
  642. package/vendor/7zip/CPP/7zip/Compress/Lzma2Decoder.h +87 -0
  643. package/vendor/7zip/CPP/7zip/Compress/Lzma2Encoder.cpp +134 -0
  644. package/vendor/7zip/CPP/7zip/Compress/Lzma2Encoder.h +30 -0
  645. package/vendor/7zip/CPP/7zip/Compress/Lzma2Register.cpp +22 -0
  646. package/vendor/7zip/CPP/7zip/Compress/LzmaDecoder.cpp +350 -0
  647. package/vendor/7zip/CPP/7zip/Compress/LzmaDecoder.h +113 -0
  648. package/vendor/7zip/CPP/7zip/Compress/LzmaEncoder.cpp +374 -0
  649. package/vendor/7zip/CPP/7zip/Compress/LzmaEncoder.h +45 -0
  650. package/vendor/7zip/CPP/7zip/Compress/LzmaRegister.cpp +22 -0
  651. package/vendor/7zip/CPP/7zip/Compress/LzmsDecoder.cpp +619 -0
  652. package/vendor/7zip/CPP/7zip/Compress/LzmsDecoder.h +209 -0
  653. package/vendor/7zip/CPP/7zip/Compress/Lzx.h +61 -0
  654. package/vendor/7zip/CPP/7zip/Compress/LzxDecoder.cpp +1517 -0
  655. package/vendor/7zip/CPP/7zip/Compress/LzxDecoder.h +106 -0
  656. package/vendor/7zip/CPP/7zip/Compress/Mtf8.h +225 -0
  657. package/vendor/7zip/CPP/7zip/Compress/PpmdDecoder.cpp +219 -0
  658. package/vendor/7zip/CPP/7zip/Compress/PpmdDecoder.h +87 -0
  659. package/vendor/7zip/CPP/7zip/Compress/PpmdEncoder.cpp +193 -0
  660. package/vendor/7zip/CPP/7zip/Compress/PpmdEncoder.h +49 -0
  661. package/vendor/7zip/CPP/7zip/Compress/PpmdRegister.cpp +22 -0
  662. package/vendor/7zip/CPP/7zip/Compress/PpmdZip.cpp +309 -0
  663. package/vendor/7zip/CPP/7zip/Compress/PpmdZip.h +78 -0
  664. package/vendor/7zip/CPP/7zip/Compress/QuantumDecoder.cpp +355 -0
  665. package/vendor/7zip/CPP/7zip/Compress/QuantumDecoder.h +60 -0
  666. package/vendor/7zip/CPP/7zip/Compress/Rar1Decoder.cpp +518 -0
  667. package/vendor/7zip/CPP/7zip/Compress/Rar1Decoder.h +70 -0
  668. package/vendor/7zip/CPP/7zip/Compress/Rar2Decoder.cpp +472 -0
  669. package/vendor/7zip/CPP/7zip/Compress/Rar2Decoder.h +111 -0
  670. package/vendor/7zip/CPP/7zip/Compress/Rar3Decoder.cpp +939 -0
  671. package/vendor/7zip/CPP/7zip/Compress/Rar3Decoder.h +283 -0
  672. package/vendor/7zip/CPP/7zip/Compress/Rar3Vm.cpp +1153 -0
  673. package/vendor/7zip/CPP/7zip/Compress/Rar3Vm.h +195 -0
  674. package/vendor/7zip/CPP/7zip/Compress/Rar5Decoder.cpp +2060 -0
  675. package/vendor/7zip/CPP/7zip/Compress/Rar5Decoder.h +132 -0
  676. package/vendor/7zip/CPP/7zip/Compress/RarCodecsRegister.cpp +33 -0
  677. package/vendor/7zip/CPP/7zip/Compress/ShrinkDecoder.cpp +290 -0
  678. package/vendor/7zip/CPP/7zip/Compress/ShrinkDecoder.h +38 -0
  679. package/vendor/7zip/CPP/7zip/Compress/StdAfx.h +11 -0
  680. package/vendor/7zip/CPP/7zip/Compress/XpressDecoder.cpp +399 -0
  681. package/vendor/7zip/CPP/7zip/Compress/XpressDecoder.h +18 -0
  682. package/vendor/7zip/CPP/7zip/Compress/XzDecoder.cpp +151 -0
  683. package/vendor/7zip/CPP/7zip/Compress/XzDecoder.h +86 -0
  684. package/vendor/7zip/CPP/7zip/Compress/XzEncoder.cpp +243 -0
  685. package/vendor/7zip/CPP/7zip/Compress/XzEncoder.h +35 -0
  686. package/vendor/7zip/CPP/7zip/Compress/ZDecoder.cpp +392 -0
  687. package/vendor/7zip/CPP/7zip/Compress/ZDecoder.h +41 -0
  688. package/vendor/7zip/CPP/7zip/Compress/ZlibDecoder.cpp +136 -0
  689. package/vendor/7zip/CPP/7zip/Compress/ZlibDecoder.h +78 -0
  690. package/vendor/7zip/CPP/7zip/Compress/ZlibEncoder.cpp +61 -0
  691. package/vendor/7zip/CPP/7zip/Compress/ZlibEncoder.h +42 -0
  692. package/vendor/7zip/CPP/7zip/Compress/ZstdDecoder.cpp +437 -0
  693. package/vendor/7zip/CPP/7zip/Compress/ZstdDecoder.h +98 -0
  694. package/vendor/7zip/CPP/7zip/Compress/makefile +7 -0
  695. package/vendor/7zip/CPP/7zip/Crc.mak +8 -0
  696. package/vendor/7zip/CPP/7zip/Crc64.mak +8 -0
  697. package/vendor/7zip/CPP/7zip/Crypto/7zAes.cpp +315 -0
  698. package/vendor/7zip/CPP/7zip/Crypto/7zAes.h +130 -0
  699. package/vendor/7zip/CPP/7zip/Crypto/7zAesRegister.cpp +17 -0
  700. package/vendor/7zip/CPP/7zip/Crypto/Codec.def +4 -0
  701. package/vendor/7zip/CPP/7zip/Crypto/HmacSha1.cpp +94 -0
  702. package/vendor/7zip/CPP/7zip/Crypto/HmacSha1.h +31 -0
  703. package/vendor/7zip/CPP/7zip/Crypto/HmacSha256.cpp +53 -0
  704. package/vendor/7zip/CPP/7zip/Crypto/HmacSha256.h +27 -0
  705. package/vendor/7zip/CPP/7zip/Crypto/MyAes.cpp +277 -0
  706. package/vendor/7zip/CPP/7zip/Crypto/MyAes.h +122 -0
  707. package/vendor/7zip/CPP/7zip/Crypto/MyAesReg.cpp +29 -0
  708. package/vendor/7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp +48 -0
  709. package/vendor/7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.h +19 -0
  710. package/vendor/7zip/CPP/7zip/Crypto/RandGen.cpp +242 -0
  711. package/vendor/7zip/CPP/7zip/Crypto/RandGen.h +41 -0
  712. package/vendor/7zip/CPP/7zip/Crypto/Rar20Crypto.cpp +130 -0
  713. package/vendor/7zip/CPP/7zip/Crypto/Rar20Crypto.h +54 -0
  714. package/vendor/7zip/CPP/7zip/Crypto/Rar5Aes.cpp +273 -0
  715. package/vendor/7zip/CPP/7zip/Crypto/Rar5Aes.h +97 -0
  716. package/vendor/7zip/CPP/7zip/Crypto/RarAes.cpp +202 -0
  717. package/vendor/7zip/CPP/7zip/Crypto/RarAes.h +54 -0
  718. package/vendor/7zip/CPP/7zip/Crypto/Sha1Cls.h +37 -0
  719. package/vendor/7zip/CPP/7zip/Crypto/StdAfx.h +11 -0
  720. package/vendor/7zip/CPP/7zip/Crypto/WzAes.cpp +231 -0
  721. package/vendor/7zip/CPP/7zip/Crypto/WzAes.h +161 -0
  722. package/vendor/7zip/CPP/7zip/Crypto/ZipCrypto.cpp +114 -0
  723. package/vendor/7zip/CPP/7zip/Crypto/ZipCrypto.h +80 -0
  724. package/vendor/7zip/CPP/7zip/Crypto/ZipStrong.cpp +265 -0
  725. package/vendor/7zip/CPP/7zip/Crypto/ZipStrong.h +73 -0
  726. package/vendor/7zip/CPP/7zip/GuiCommon.rc +119 -0
  727. package/vendor/7zip/CPP/7zip/Guid.txt +243 -0
  728. package/vendor/7zip/CPP/7zip/ICoder.h +480 -0
  729. package/vendor/7zip/CPP/7zip/IDecl.h +76 -0
  730. package/vendor/7zip/CPP/7zip/IPassword.h +54 -0
  731. package/vendor/7zip/CPP/7zip/IProgress.h +20 -0
  732. package/vendor/7zip/CPP/7zip/IStream.h +210 -0
  733. package/vendor/7zip/CPP/7zip/LzFindOpt.mak +7 -0
  734. package/vendor/7zip/CPP/7zip/LzmaDec.mak +7 -0
  735. package/vendor/7zip/CPP/7zip/LzmaDec_gcc.mak +14 -0
  736. package/vendor/7zip/CPP/7zip/MyVersion.h +2 -0
  737. package/vendor/7zip/CPP/7zip/MyVersionInfo.rc +2 -0
  738. package/vendor/7zip/CPP/7zip/PropID.h +178 -0
  739. package/vendor/7zip/CPP/7zip/Sha1.mak +13 -0
  740. package/vendor/7zip/CPP/7zip/Sha256.mak +13 -0
  741. package/vendor/7zip/CPP/7zip/Sort.mak +6 -0
  742. package/vendor/7zip/CPP/7zip/SubBuild.mak +3 -0
  743. package/vendor/7zip/CPP/7zip/UI/Agent/Agent.cpp +2003 -0
  744. package/vendor/7zip/CPP/7zip/UI/Agent/Agent.h +365 -0
  745. package/vendor/7zip/CPP/7zip/UI/Agent/AgentOut.cpp +776 -0
  746. package/vendor/7zip/CPP/7zip/UI/Agent/AgentProxy.cpp +1098 -0
  747. package/vendor/7zip/CPP/7zip/UI/Agent/AgentProxy.h +198 -0
  748. package/vendor/7zip/CPP/7zip/UI/Agent/ArchiveFolder.cpp +57 -0
  749. package/vendor/7zip/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp +243 -0
  750. package/vendor/7zip/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp +457 -0
  751. package/vendor/7zip/CPP/7zip/UI/Agent/IFolderArchive.h +123 -0
  752. package/vendor/7zip/CPP/7zip/UI/Agent/StdAfx.h +11 -0
  753. package/vendor/7zip/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp +208 -0
  754. package/vendor/7zip/CPP/7zip/UI/Agent/UpdateCallbackAgent.h +22 -0
  755. package/vendor/7zip/CPP/7zip/UI/Client7z/Client7z.cpp +1145 -0
  756. package/vendor/7zip/CPP/7zip/UI/Client7z/Client7z.dsp +331 -0
  757. package/vendor/7zip/CPP/7zip/UI/Client7z/Client7z.dsw +29 -0
  758. package/vendor/7zip/CPP/7zip/UI/Client7z/StdAfx.cpp +3 -0
  759. package/vendor/7zip/CPP/7zip/UI/Client7z/StdAfx.h +11 -0
  760. package/vendor/7zip/CPP/7zip/UI/Client7z/makefile +29 -0
  761. package/vendor/7zip/CPP/7zip/UI/Client7z/makefile.gcc +72 -0
  762. package/vendor/7zip/CPP/7zip/UI/Client7z/resource.rc +3 -0
  763. package/vendor/7zip/CPP/7zip/UI/Common/ArchiveCommandLine.cpp +1913 -0
  764. package/vendor/7zip/CPP/7zip/UI/Common/ArchiveCommandLine.h +170 -0
  765. package/vendor/7zip/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp +3243 -0
  766. package/vendor/7zip/CPP/7zip/UI/Common/ArchiveExtractCallback.h +640 -0
  767. package/vendor/7zip/CPP/7zip/UI/Common/ArchiveName.cpp +176 -0
  768. package/vendor/7zip/CPP/7zip/UI/Common/ArchiveName.h +16 -0
  769. package/vendor/7zip/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp +403 -0
  770. package/vendor/7zip/CPP/7zip/UI/Common/ArchiveOpenCallback.h +182 -0
  771. package/vendor/7zip/CPP/7zip/UI/Common/Bench.cpp +5036 -0
  772. package/vendor/7zip/CPP/7zip/UI/Common/Bench.h +121 -0
  773. package/vendor/7zip/CPP/7zip/UI/Common/CompressCall.cpp +343 -0
  774. package/vendor/7zip/CPP/7zip/UI/Common/CompressCall.h +28 -0
  775. package/vendor/7zip/CPP/7zip/UI/Common/CompressCall2.cpp +327 -0
  776. package/vendor/7zip/CPP/7zip/UI/Common/DefaultName.cpp +37 -0
  777. package/vendor/7zip/CPP/7zip/UI/Common/DefaultName.h +11 -0
  778. package/vendor/7zip/CPP/7zip/UI/Common/DirItem.h +407 -0
  779. package/vendor/7zip/CPP/7zip/UI/Common/EnumDirItems.cpp +1637 -0
  780. package/vendor/7zip/CPP/7zip/UI/Common/EnumDirItems.h +38 -0
  781. package/vendor/7zip/CPP/7zip/UI/Common/ExitCode.h +27 -0
  782. package/vendor/7zip/CPP/7zip/UI/Common/Extract.cpp +593 -0
  783. package/vendor/7zip/CPP/7zip/UI/Common/Extract.h +118 -0
  784. package/vendor/7zip/CPP/7zip/UI/Common/ExtractMode.h +44 -0
  785. package/vendor/7zip/CPP/7zip/UI/Common/ExtractingFilePath.cpp +299 -0
  786. package/vendor/7zip/CPP/7zip/UI/Common/ExtractingFilePath.h +31 -0
  787. package/vendor/7zip/CPP/7zip/UI/Common/HashCalc.cpp +2273 -0
  788. package/vendor/7zip/CPP/7zip/UI/Common/HashCalc.h +322 -0
  789. package/vendor/7zip/CPP/7zip/UI/Common/IFileExtractCallback.h +112 -0
  790. package/vendor/7zip/CPP/7zip/UI/Common/LoadCodecs.cpp +1354 -0
  791. package/vendor/7zip/CPP/7zip/UI/Common/LoadCodecs.h +482 -0
  792. package/vendor/7zip/CPP/7zip/UI/Common/OpenArchive.cpp +3690 -0
  793. package/vendor/7zip/CPP/7zip/UI/Common/OpenArchive.h +469 -0
  794. package/vendor/7zip/CPP/7zip/UI/Common/PropIDUtils.cpp +746 -0
  795. package/vendor/7zip/CPP/7zip/UI/Common/PropIDUtils.h +18 -0
  796. package/vendor/7zip/CPP/7zip/UI/Common/Property.h +14 -0
  797. package/vendor/7zip/CPP/7zip/UI/Common/SetProperties.cpp +88 -0
  798. package/vendor/7zip/CPP/7zip/UI/Common/SetProperties.h +10 -0
  799. package/vendor/7zip/CPP/7zip/UI/Common/SortUtils.cpp +25 -0
  800. package/vendor/7zip/CPP/7zip/UI/Common/SortUtils.h +10 -0
  801. package/vendor/7zip/CPP/7zip/UI/Common/StdAfx.h +11 -0
  802. package/vendor/7zip/CPP/7zip/UI/Common/TempFiles.cpp +20 -0
  803. package/vendor/7zip/CPP/7zip/UI/Common/TempFiles.h +19 -0
  804. package/vendor/7zip/CPP/7zip/UI/Common/Update.cpp +1931 -0
  805. package/vendor/7zip/CPP/7zip/UI/Common/Update.h +221 -0
  806. package/vendor/7zip/CPP/7zip/UI/Common/UpdateAction.cpp +64 -0
  807. package/vendor/7zip/CPP/7zip/UI/Common/UpdateAction.h +66 -0
  808. package/vendor/7zip/CPP/7zip/UI/Common/UpdateCallback.cpp +1078 -0
  809. package/vendor/7zip/CPP/7zip/UI/Common/UpdateCallback.h +197 -0
  810. package/vendor/7zip/CPP/7zip/UI/Common/UpdatePair.cpp +303 -0
  811. package/vendor/7zip/CPP/7zip/UI/Common/UpdatePair.h +27 -0
  812. package/vendor/7zip/CPP/7zip/UI/Common/UpdateProduce.cpp +75 -0
  813. package/vendor/7zip/CPP/7zip/UI/Common/UpdateProduce.h +60 -0
  814. package/vendor/7zip/CPP/7zip/UI/Common/WorkDir.cpp +84 -0
  815. package/vendor/7zip/CPP/7zip/UI/Common/WorkDir.h +30 -0
  816. package/vendor/7zip/CPP/7zip/UI/Common/ZipRegistry.cpp +599 -0
  817. package/vendor/7zip/CPP/7zip/UI/Common/ZipRegistry.h +212 -0
  818. package/vendor/7zip/CPP/7zip/UI/Console/BenchCon.cpp +41 -0
  819. package/vendor/7zip/CPP/7zip/UI/Console/BenchCon.h +14 -0
  820. package/vendor/7zip/CPP/7zip/UI/Console/Console.dsp +1052 -0
  821. package/vendor/7zip/CPP/7zip/UI/Console/Console.dsw +29 -0
  822. package/vendor/7zip/CPP/7zip/UI/Console/Console.mak +45 -0
  823. package/vendor/7zip/CPP/7zip/UI/Console/Console.manifest +16 -0
  824. package/vendor/7zip/CPP/7zip/UI/Console/ConsoleClose.cpp +98 -0
  825. package/vendor/7zip/CPP/7zip/UI/Console/ConsoleClose.h +39 -0
  826. package/vendor/7zip/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp +954 -0
  827. package/vendor/7zip/CPP/7zip/UI/Console/ExtractCallbackConsole.h +211 -0
  828. package/vendor/7zip/CPP/7zip/UI/Console/HashCon.cpp +426 -0
  829. package/vendor/7zip/CPP/7zip/UI/Console/HashCon.h +58 -0
  830. package/vendor/7zip/CPP/7zip/UI/Console/List.cpp +1417 -0
  831. package/vendor/7zip/CPP/7zip/UI/Console/List.h +42 -0
  832. package/vendor/7zip/CPP/7zip/UI/Console/Main.cpp +1663 -0
  833. package/vendor/7zip/CPP/7zip/UI/Console/MainAr.cpp +235 -0
  834. package/vendor/7zip/CPP/7zip/UI/Console/OpenCallbackConsole.cpp +115 -0
  835. package/vendor/7zip/CPP/7zip/UI/Console/OpenCallbackConsole.h +73 -0
  836. package/vendor/7zip/CPP/7zip/UI/Console/PercentPrinter.cpp +186 -0
  837. package/vendor/7zip/CPP/7zip/UI/Console/PercentPrinter.h +66 -0
  838. package/vendor/7zip/CPP/7zip/UI/Console/StdAfx.cpp +3 -0
  839. package/vendor/7zip/CPP/7zip/UI/Console/StdAfx.h +11 -0
  840. package/vendor/7zip/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp +1012 -0
  841. package/vendor/7zip/CPP/7zip/UI/Console/UpdateCallbackConsole.h +148 -0
  842. package/vendor/7zip/CPP/7zip/UI/Console/UserInputUtils.cpp +118 -0
  843. package/vendor/7zip/CPP/7zip/UI/Console/UserInputUtils.h +27 -0
  844. package/vendor/7zip/CPP/7zip/UI/Console/makefile +68 -0
  845. package/vendor/7zip/CPP/7zip/UI/Console/makefile.gcc +184 -0
  846. package/vendor/7zip/CPP/7zip/UI/Console/resource.rc +7 -0
  847. package/vendor/7zip/CPP/7zip/UI/Explorer/7-zip.dll.manifest +1 -0
  848. package/vendor/7zip/CPP/7zip/UI/Explorer/ContextMenu.cpp +1837 -0
  849. package/vendor/7zip/CPP/7zip/UI/Explorer/ContextMenu.h +173 -0
  850. package/vendor/7zip/CPP/7zip/UI/Explorer/ContextMenuFlags.h +27 -0
  851. package/vendor/7zip/CPP/7zip/UI/Explorer/DllExportsExplorer.cpp +268 -0
  852. package/vendor/7zip/CPP/7zip/UI/Explorer/Explorer.def +9 -0
  853. package/vendor/7zip/CPP/7zip/UI/Explorer/Explorer.dsp +620 -0
  854. package/vendor/7zip/CPP/7zip/UI/Explorer/Explorer.dsw +29 -0
  855. package/vendor/7zip/CPP/7zip/UI/Explorer/MenuLogo.bmp +0 -0
  856. package/vendor/7zip/CPP/7zip/UI/Explorer/MyExplorerCommand.h +217 -0
  857. package/vendor/7zip/CPP/7zip/UI/Explorer/MyMessages.cpp +43 -0
  858. package/vendor/7zip/CPP/7zip/UI/Explorer/MyMessages.h +16 -0
  859. package/vendor/7zip/CPP/7zip/UI/Explorer/RegistryContextMenu.cpp +225 -0
  860. package/vendor/7zip/CPP/7zip/UI/Explorer/RegistryContextMenu.h +13 -0
  861. package/vendor/7zip/CPP/7zip/UI/Explorer/StdAfx.cpp +3 -0
  862. package/vendor/7zip/CPP/7zip/UI/Explorer/StdAfx.h +6 -0
  863. package/vendor/7zip/CPP/7zip/UI/Explorer/makefile +76 -0
  864. package/vendor/7zip/CPP/7zip/UI/Explorer/resource.h +15 -0
  865. package/vendor/7zip/CPP/7zip/UI/Explorer/resource.rc +10 -0
  866. package/vendor/7zip/CPP/7zip/UI/Explorer/resource2.rc +19 -0
  867. package/vendor/7zip/CPP/7zip/UI/Far/ExtractEngine.cpp +274 -0
  868. package/vendor/7zip/CPP/7zip/UI/Far/ExtractEngine.h +43 -0
  869. package/vendor/7zip/CPP/7zip/UI/Far/Far.cpp +588 -0
  870. package/vendor/7zip/CPP/7zip/UI/Far/Far.def +35 -0
  871. package/vendor/7zip/CPP/7zip/UI/Far/Far.dsp +831 -0
  872. package/vendor/7zip/CPP/7zip/UI/Far/Far.dsw +29 -0
  873. package/vendor/7zip/CPP/7zip/UI/Far/FarPlugin.h +560 -0
  874. package/vendor/7zip/CPP/7zip/UI/Far/FarUtils.cpp +523 -0
  875. package/vendor/7zip/CPP/7zip/UI/Far/FarUtils.h +203 -0
  876. package/vendor/7zip/CPP/7zip/UI/Far/Messages.h +136 -0
  877. package/vendor/7zip/CPP/7zip/UI/Far/OverwriteDialogFar.cpp +145 -0
  878. package/vendor/7zip/CPP/7zip/UI/Far/OverwriteDialogFar.h +37 -0
  879. package/vendor/7zip/CPP/7zip/UI/Far/Plugin.cpp +937 -0
  880. package/vendor/7zip/CPP/7zip/UI/Far/Plugin.h +97 -0
  881. package/vendor/7zip/CPP/7zip/UI/Far/PluginCommon.cpp +50 -0
  882. package/vendor/7zip/CPP/7zip/UI/Far/PluginDelete.cpp +144 -0
  883. package/vendor/7zip/CPP/7zip/UI/Far/PluginRead.cpp +301 -0
  884. package/vendor/7zip/CPP/7zip/UI/Far/PluginWrite.cpp +840 -0
  885. package/vendor/7zip/CPP/7zip/UI/Far/ProgressBox.cpp +305 -0
  886. package/vendor/7zip/CPP/7zip/UI/Far/ProgressBox.h +85 -0
  887. package/vendor/7zip/CPP/7zip/UI/Far/StdAfx.cpp +3 -0
  888. package/vendor/7zip/CPP/7zip/UI/Far/StdAfx.h +11 -0
  889. package/vendor/7zip/CPP/7zip/UI/Far/UpdateCallbackFar.cpp +327 -0
  890. package/vendor/7zip/CPP/7zip/UI/Far/UpdateCallbackFar.h +58 -0
  891. package/vendor/7zip/CPP/7zip/UI/Far/makefile +105 -0
  892. package/vendor/7zip/CPP/7zip/UI/Far/resource.rc +3 -0
  893. package/vendor/7zip/CPP/7zip/UI/FileManager/7zFM.exe.manifest +23 -0
  894. package/vendor/7zip/CPP/7zip/UI/FileManager/7zipLogo.ico +0 -0
  895. package/vendor/7zip/CPP/7zip/UI/FileManager/AboutDialog.cpp +81 -0
  896. package/vendor/7zip/CPP/7zip/UI/FileManager/AboutDialog.h +19 -0
  897. package/vendor/7zip/CPP/7zip/UI/FileManager/AboutDialog.rc +26 -0
  898. package/vendor/7zip/CPP/7zip/UI/FileManager/AboutDialogRes.h +8 -0
  899. package/vendor/7zip/CPP/7zip/UI/FileManager/Add.bmp +0 -0
  900. package/vendor/7zip/CPP/7zip/UI/FileManager/Add2.bmp +0 -0
  901. package/vendor/7zip/CPP/7zip/UI/FileManager/AltStreamsFolder.cpp +865 -0
  902. package/vendor/7zip/CPP/7zip/UI/FileManager/AltStreamsFolder.h +92 -0
  903. package/vendor/7zip/CPP/7zip/UI/FileManager/App.cpp +1004 -0
  904. package/vendor/7zip/CPP/7zip/UI/FileManager/App.h +314 -0
  905. package/vendor/7zip/CPP/7zip/UI/FileManager/AppState.h +95 -0
  906. package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog.cpp +1132 -0
  907. package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog.h +32 -0
  908. package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog.rc +25 -0
  909. package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog2.cpp +1873 -0
  910. package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog2.h +10 -0
  911. package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog2.rc +32 -0
  912. package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialog2Res.h +9 -0
  913. package/vendor/7zip/CPP/7zip/UI/FileManager/BrowseDialogRes.h +9 -0
  914. package/vendor/7zip/CPP/7zip/UI/FileManager/ClassDefs.cpp +12 -0
  915. package/vendor/7zip/CPP/7zip/UI/FileManager/ComboDialog.cpp +64 -0
  916. package/vendor/7zip/CPP/7zip/UI/FileManager/ComboDialog.h +28 -0
  917. package/vendor/7zip/CPP/7zip/UI/FileManager/ComboDialog.rc +16 -0
  918. package/vendor/7zip/CPP/7zip/UI/FileManager/ComboDialogRes.h +4 -0
  919. package/vendor/7zip/CPP/7zip/UI/FileManager/Copy.bmp +0 -0
  920. package/vendor/7zip/CPP/7zip/UI/FileManager/Copy2.bmp +0 -0
  921. package/vendor/7zip/CPP/7zip/UI/FileManager/CopyDialog.cpp +103 -0
  922. package/vendor/7zip/CPP/7zip/UI/FileManager/CopyDialog.h +31 -0
  923. package/vendor/7zip/CPP/7zip/UI/FileManager/CopyDialog.rc +20 -0
  924. package/vendor/7zip/CPP/7zip/UI/FileManager/CopyDialogRes.h +8 -0
  925. package/vendor/7zip/CPP/7zip/UI/FileManager/Delete.bmp +0 -0
  926. package/vendor/7zip/CPP/7zip/UI/FileManager/Delete2.bmp +0 -0
  927. package/vendor/7zip/CPP/7zip/UI/FileManager/DialogSize.h +16 -0
  928. package/vendor/7zip/CPP/7zip/UI/FileManager/EditDialog.cpp +57 -0
  929. package/vendor/7zip/CPP/7zip/UI/FileManager/EditDialog.h +25 -0
  930. package/vendor/7zip/CPP/7zip/UI/FileManager/EditDialog.rc +15 -0
  931. package/vendor/7zip/CPP/7zip/UI/FileManager/EditDialogRes.h +2 -0
  932. package/vendor/7zip/CPP/7zip/UI/FileManager/EditPage.cpp +159 -0
  933. package/vendor/7zip/CPP/7zip/UI/FileManager/EditPage.h +30 -0
  934. package/vendor/7zip/CPP/7zip/UI/FileManager/EditPage.rc +19 -0
  935. package/vendor/7zip/CPP/7zip/UI/FileManager/EditPage2.rc +14 -0
  936. package/vendor/7zip/CPP/7zip/UI/FileManager/EditPageRes.h +15 -0
  937. package/vendor/7zip/CPP/7zip/UI/FileManager/EnumFormatEtc.cpp +109 -0
  938. package/vendor/7zip/CPP/7zip/UI/FileManager/EnumFormatEtc.h +10 -0
  939. package/vendor/7zip/CPP/7zip/UI/FileManager/Extract.bmp +0 -0
  940. package/vendor/7zip/CPP/7zip/UI/FileManager/Extract2.bmp +0 -0
  941. package/vendor/7zip/CPP/7zip/UI/FileManager/ExtractCallback.cpp +1284 -0
  942. package/vendor/7zip/CPP/7zip/UI/FileManager/ExtractCallback.h +347 -0
  943. package/vendor/7zip/CPP/7zip/UI/FileManager/FM.cpp +1230 -0
  944. package/vendor/7zip/CPP/7zip/UI/FileManager/FM.dsp +1699 -0
  945. package/vendor/7zip/CPP/7zip/UI/FileManager/FM.dsw +29 -0
  946. package/vendor/7zip/CPP/7zip/UI/FileManager/FM.ico +0 -0
  947. package/vendor/7zip/CPP/7zip/UI/FileManager/FM.mak +102 -0
  948. package/vendor/7zip/CPP/7zip/UI/FileManager/FSDrives.cpp +512 -0
  949. package/vendor/7zip/CPP/7zip/UI/FileManager/FSDrives.h +52 -0
  950. package/vendor/7zip/CPP/7zip/UI/FileManager/FSFolder.cpp +1179 -0
  951. package/vendor/7zip/CPP/7zip/UI/FileManager/FSFolder.h +220 -0
  952. package/vendor/7zip/CPP/7zip/UI/FileManager/FSFolderCopy.cpp +871 -0
  953. package/vendor/7zip/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp +394 -0
  954. package/vendor/7zip/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h +27 -0
  955. package/vendor/7zip/CPP/7zip/UI/FileManager/FilePlugins.cpp +78 -0
  956. package/vendor/7zip/CPP/7zip/UI/FileManager/FilePlugins.h +33 -0
  957. package/vendor/7zip/CPP/7zip/UI/FileManager/FoldersPage.cpp +172 -0
  958. package/vendor/7zip/CPP/7zip/UI/FileManager/FoldersPage.h +32 -0
  959. package/vendor/7zip/CPP/7zip/UI/FileManager/FoldersPage.rc +23 -0
  960. package/vendor/7zip/CPP/7zip/UI/FileManager/FoldersPage2.rc +11 -0
  961. package/vendor/7zip/CPP/7zip/UI/FileManager/FoldersPageRes.h +12 -0
  962. package/vendor/7zip/CPP/7zip/UI/FileManager/FormatUtils.cpp +28 -0
  963. package/vendor/7zip/CPP/7zip/UI/FileManager/FormatUtils.h +14 -0
  964. package/vendor/7zip/CPP/7zip/UI/FileManager/HelpUtils.cpp +78 -0
  965. package/vendor/7zip/CPP/7zip/UI/FileManager/HelpUtils.h +10 -0
  966. package/vendor/7zip/CPP/7zip/UI/FileManager/IFolder.h +187 -0
  967. package/vendor/7zip/CPP/7zip/UI/FileManager/Info.bmp +0 -0
  968. package/vendor/7zip/CPP/7zip/UI/FileManager/Info2.bmp +0 -0
  969. package/vendor/7zip/CPP/7zip/UI/FileManager/LangPage.cpp +359 -0
  970. package/vendor/7zip/CPP/7zip/UI/FileManager/LangPage.h +36 -0
  971. package/vendor/7zip/CPP/7zip/UI/FileManager/LangPage.rc +40 -0
  972. package/vendor/7zip/CPP/7zip/UI/FileManager/LangPageRes.h +9 -0
  973. package/vendor/7zip/CPP/7zip/UI/FileManager/LangUtils.cpp +333 -0
  974. package/vendor/7zip/CPP/7zip/UI/FileManager/LangUtils.h +48 -0
  975. package/vendor/7zip/CPP/7zip/UI/FileManager/LinkDialog.cpp +402 -0
  976. package/vendor/7zip/CPP/7zip/UI/FileManager/LinkDialog.h +34 -0
  977. package/vendor/7zip/CPP/7zip/UI/FileManager/LinkDialog.rc +38 -0
  978. package/vendor/7zip/CPP/7zip/UI/FileManager/LinkDialogRes.h +22 -0
  979. package/vendor/7zip/CPP/7zip/UI/FileManager/ListViewDialog.cpp +321 -0
  980. package/vendor/7zip/CPP/7zip/UI/FileManager/ListViewDialog.h +46 -0
  981. package/vendor/7zip/CPP/7zip/UI/FileManager/ListViewDialog.rc +14 -0
  982. package/vendor/7zip/CPP/7zip/UI/FileManager/ListViewDialogRes.h +2 -0
  983. package/vendor/7zip/CPP/7zip/UI/FileManager/MemDialog.cpp +218 -0
  984. package/vendor/7zip/CPP/7zip/UI/FileManager/MemDialog.h +48 -0
  985. package/vendor/7zip/CPP/7zip/UI/FileManager/MemDialog.rc +49 -0
  986. package/vendor/7zip/CPP/7zip/UI/FileManager/MemDialogRes.h +13 -0
  987. package/vendor/7zip/CPP/7zip/UI/FileManager/MenuPage.cpp +439 -0
  988. package/vendor/7zip/CPP/7zip/UI/FileManager/MenuPage.h +57 -0
  989. package/vendor/7zip/CPP/7zip/UI/FileManager/MenuPage.rc +24 -0
  990. package/vendor/7zip/CPP/7zip/UI/FileManager/MenuPage2.rc +28 -0
  991. package/vendor/7zip/CPP/7zip/UI/FileManager/MenuPageRes.h +15 -0
  992. package/vendor/7zip/CPP/7zip/UI/FileManager/MessagesDialog.cpp +76 -0
  993. package/vendor/7zip/CPP/7zip/UI/FileManager/MessagesDialog.h +25 -0
  994. package/vendor/7zip/CPP/7zip/UI/FileManager/MessagesDialog.rc +14 -0
  995. package/vendor/7zip/CPP/7zip/UI/FileManager/MessagesDialogRes.h +3 -0
  996. package/vendor/7zip/CPP/7zip/UI/FileManager/Move.bmp +0 -0
  997. package/vendor/7zip/CPP/7zip/UI/FileManager/Move2.bmp +0 -0
  998. package/vendor/7zip/CPP/7zip/UI/FileManager/MyCom2.h +46 -0
  999. package/vendor/7zip/CPP/7zip/UI/FileManager/MyLoadMenu.cpp +964 -0
  1000. package/vendor/7zip/CPP/7zip/UI/FileManager/MyLoadMenu.h +40 -0
  1001. package/vendor/7zip/CPP/7zip/UI/FileManager/MyWindowsNew.h +119 -0
  1002. package/vendor/7zip/CPP/7zip/UI/FileManager/NetFolder.cpp +276 -0
  1003. package/vendor/7zip/CPP/7zip/UI/FileManager/NetFolder.h +36 -0
  1004. package/vendor/7zip/CPP/7zip/UI/FileManager/OpenCallback.cpp +86 -0
  1005. package/vendor/7zip/CPP/7zip/UI/FileManager/OpenCallback.h +69 -0
  1006. package/vendor/7zip/CPP/7zip/UI/FileManager/OptionsDialog.cpp +89 -0
  1007. package/vendor/7zip/CPP/7zip/UI/FileManager/OverwriteDialog.cpp +288 -0
  1008. package/vendor/7zip/CPP/7zip/UI/FileManager/OverwriteDialog.h +89 -0
  1009. package/vendor/7zip/CPP/7zip/UI/FileManager/OverwriteDialog.rc +93 -0
  1010. package/vendor/7zip/CPP/7zip/UI/FileManager/OverwriteDialogRes.h +19 -0
  1011. package/vendor/7zip/CPP/7zip/UI/FileManager/Panel.cpp +1177 -0
  1012. package/vendor/7zip/CPP/7zip/UI/FileManager/Panel.h +1020 -0
  1013. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelCopy.cpp +477 -0
  1014. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelCrc.cpp +422 -0
  1015. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelDrag.cpp +3006 -0
  1016. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelFolderChange.cpp +1122 -0
  1017. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelItemOpen.cpp +1836 -0
  1018. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelItems.cpp +1476 -0
  1019. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelKey.cpp +357 -0
  1020. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelListNotify.cpp +838 -0
  1021. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelMenu.cpp +1160 -0
  1022. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelOperations.cpp +533 -0
  1023. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelSelect.cpp +317 -0
  1024. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelSort.cpp +288 -0
  1025. package/vendor/7zip/CPP/7zip/UI/FileManager/PanelSplitFile.cpp +562 -0
  1026. package/vendor/7zip/CPP/7zip/UI/FileManager/PasswordDialog.cpp +58 -0
  1027. package/vendor/7zip/CPP/7zip/UI/FileManager/PasswordDialog.h +28 -0
  1028. package/vendor/7zip/CPP/7zip/UI/FileManager/PasswordDialog.rc +18 -0
  1029. package/vendor/7zip/CPP/7zip/UI/FileManager/PasswordDialogRes.h +5 -0
  1030. package/vendor/7zip/CPP/7zip/UI/FileManager/PluginInterface.h +32 -0
  1031. package/vendor/7zip/CPP/7zip/UI/FileManager/PluginLoader.h +33 -0
  1032. package/vendor/7zip/CPP/7zip/UI/FileManager/ProgramLocation.cpp +3 -0
  1033. package/vendor/7zip/CPP/7zip/UI/FileManager/ProgramLocation.h +6 -0
  1034. package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog.cpp +201 -0
  1035. package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog.h +171 -0
  1036. package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog.rc +12 -0
  1037. package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog2.cpp +1484 -0
  1038. package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog2.h +355 -0
  1039. package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog2.rc +40 -0
  1040. package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog2Res.h +49 -0
  1041. package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialog2a.rc +85 -0
  1042. package/vendor/7zip/CPP/7zip/UI/FileManager/ProgressDialogRes.h +3 -0
  1043. package/vendor/7zip/CPP/7zip/UI/FileManager/PropertyName.cpp +23 -0
  1044. package/vendor/7zip/CPP/7zip/UI/FileManager/PropertyName.h +10 -0
  1045. package/vendor/7zip/CPP/7zip/UI/FileManager/PropertyName.rc +109 -0
  1046. package/vendor/7zip/CPP/7zip/UI/FileManager/PropertyNameRes.h +104 -0
  1047. package/vendor/7zip/CPP/7zip/UI/FileManager/RegistryAssociations.cpp +167 -0
  1048. package/vendor/7zip/CPP/7zip/UI/FileManager/RegistryAssociations.h +31 -0
  1049. package/vendor/7zip/CPP/7zip/UI/FileManager/RegistryPlugins.cpp +145 -0
  1050. package/vendor/7zip/CPP/7zip/UI/FileManager/RegistryPlugins.h +29 -0
  1051. package/vendor/7zip/CPP/7zip/UI/FileManager/RegistryUtils.cpp +194 -0
  1052. package/vendor/7zip/CPP/7zip/UI/FileManager/RegistryUtils.h +50 -0
  1053. package/vendor/7zip/CPP/7zip/UI/FileManager/RootFolder.cpp +342 -0
  1054. package/vendor/7zip/CPP/7zip/UI/FileManager/RootFolder.h +24 -0
  1055. package/vendor/7zip/CPP/7zip/UI/FileManager/SettingsPage.cpp +453 -0
  1056. package/vendor/7zip/CPP/7zip/UI/FileManager/SettingsPage.h +37 -0
  1057. package/vendor/7zip/CPP/7zip/UI/FileManager/SettingsPage.rc +22 -0
  1058. package/vendor/7zip/CPP/7zip/UI/FileManager/SettingsPage2.rc +37 -0
  1059. package/vendor/7zip/CPP/7zip/UI/FileManager/SettingsPageRes.h +23 -0
  1060. package/vendor/7zip/CPP/7zip/UI/FileManager/SplitDialog.cpp +114 -0
  1061. package/vendor/7zip/CPP/7zip/UI/FileManager/SplitDialog.h +28 -0
  1062. package/vendor/7zip/CPP/7zip/UI/FileManager/SplitDialog.rc +16 -0
  1063. package/vendor/7zip/CPP/7zip/UI/FileManager/SplitDialogRes.h +8 -0
  1064. package/vendor/7zip/CPP/7zip/UI/FileManager/SplitUtils.cpp +96 -0
  1065. package/vendor/7zip/CPP/7zip/UI/FileManager/SplitUtils.h +15 -0
  1066. package/vendor/7zip/CPP/7zip/UI/FileManager/StdAfx.cpp +3 -0
  1067. package/vendor/7zip/CPP/7zip/UI/FileManager/StdAfx.h +67 -0
  1068. package/vendor/7zip/CPP/7zip/UI/FileManager/StringUtils.cpp +39 -0
  1069. package/vendor/7zip/CPP/7zip/UI/FileManager/StringUtils.h +11 -0
  1070. package/vendor/7zip/CPP/7zip/UI/FileManager/SysIconUtils.cpp +352 -0
  1071. package/vendor/7zip/CPP/7zip/UI/FileManager/SysIconUtils.h +65 -0
  1072. package/vendor/7zip/CPP/7zip/UI/FileManager/SystemPage.cpp +472 -0
  1073. package/vendor/7zip/CPP/7zip/UI/FileManager/SystemPage.h +126 -0
  1074. package/vendor/7zip/CPP/7zip/UI/FileManager/SystemPage.rc +43 -0
  1075. package/vendor/7zip/CPP/7zip/UI/FileManager/SystemPageRes.h +9 -0
  1076. package/vendor/7zip/CPP/7zip/UI/FileManager/Test.bmp +0 -0
  1077. package/vendor/7zip/CPP/7zip/UI/FileManager/Test2.bmp +0 -0
  1078. package/vendor/7zip/CPP/7zip/UI/FileManager/TextPairs.cpp +193 -0
  1079. package/vendor/7zip/CPP/7zip/UI/FileManager/TextPairs.h +32 -0
  1080. package/vendor/7zip/CPP/7zip/UI/FileManager/UpdateCallback100.cpp +147 -0
  1081. package/vendor/7zip/CPP/7zip/UI/FileManager/UpdateCallback100.h +49 -0
  1082. package/vendor/7zip/CPP/7zip/UI/FileManager/VerCtrl.cpp +428 -0
  1083. package/vendor/7zip/CPP/7zip/UI/FileManager/ViewSettings.cpp +315 -0
  1084. package/vendor/7zip/CPP/7zip/UI/FileManager/ViewSettings.h +115 -0
  1085. package/vendor/7zip/CPP/7zip/UI/FileManager/makefile +110 -0
  1086. package/vendor/7zip/CPP/7zip/UI/FileManager/resource.h +199 -0
  1087. package/vendor/7zip/CPP/7zip/UI/FileManager/resource.rc +296 -0
  1088. package/vendor/7zip/CPP/7zip/UI/FileManager/resourceGui.h +25 -0
  1089. package/vendor/7zip/CPP/7zip/UI/FileManager/resourceGui.rc +30 -0
  1090. package/vendor/7zip/CPP/7zip/UI/GUI/7zG.exe.manifest +23 -0
  1091. package/vendor/7zip/CPP/7zip/UI/GUI/BenchmarkDialog.cpp +1921 -0
  1092. package/vendor/7zip/CPP/7zip/UI/GUI/BenchmarkDialog.h +15 -0
  1093. package/vendor/7zip/CPP/7zip/UI/GUI/BenchmarkDialog.rc +288 -0
  1094. package/vendor/7zip/CPP/7zip/UI/GUI/BenchmarkDialogRes.h +79 -0
  1095. package/vendor/7zip/CPP/7zip/UI/GUI/CompressDialog.cpp +3821 -0
  1096. package/vendor/7zip/CPP/7zip/UI/GUI/CompressDialog.h +483 -0
  1097. package/vendor/7zip/CPP/7zip/UI/GUI/CompressDialog.rc +233 -0
  1098. package/vendor/7zip/CPP/7zip/UI/GUI/CompressDialogRes.h +125 -0
  1099. package/vendor/7zip/CPP/7zip/UI/GUI/CompressOptionsDialog.rc +79 -0
  1100. package/vendor/7zip/CPP/7zip/UI/GUI/Extract.rc +59 -0
  1101. package/vendor/7zip/CPP/7zip/UI/GUI/ExtractDialog.cpp +420 -0
  1102. package/vendor/7zip/CPP/7zip/UI/GUI/ExtractDialog.h +113 -0
  1103. package/vendor/7zip/CPP/7zip/UI/GUI/ExtractDialog.rc +98 -0
  1104. package/vendor/7zip/CPP/7zip/UI/GUI/ExtractDialogRes.h +24 -0
  1105. package/vendor/7zip/CPP/7zip/UI/GUI/ExtractGUI.cpp +297 -0
  1106. package/vendor/7zip/CPP/7zip/UI/GUI/ExtractGUI.h +39 -0
  1107. package/vendor/7zip/CPP/7zip/UI/GUI/ExtractRes.h +51 -0
  1108. package/vendor/7zip/CPP/7zip/UI/GUI/FM.ico +0 -0
  1109. package/vendor/7zip/CPP/7zip/UI/GUI/GUI.cpp +502 -0
  1110. package/vendor/7zip/CPP/7zip/UI/GUI/GUI.dsp +1275 -0
  1111. package/vendor/7zip/CPP/7zip/UI/GUI/GUI.dsw +29 -0
  1112. package/vendor/7zip/CPP/7zip/UI/GUI/HashGUI.cpp +341 -0
  1113. package/vendor/7zip/CPP/7zip/UI/GUI/HashGUI.h +27 -0
  1114. package/vendor/7zip/CPP/7zip/UI/GUI/StdAfx.cpp +3 -0
  1115. package/vendor/7zip/CPP/7zip/UI/GUI/StdAfx.h +6 -0
  1116. package/vendor/7zip/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp +295 -0
  1117. package/vendor/7zip/CPP/7zip/UI/GUI/UpdateCallbackGUI.h +31 -0
  1118. package/vendor/7zip/CPP/7zip/UI/GUI/UpdateCallbackGUI2.cpp +130 -0
  1119. package/vendor/7zip/CPP/7zip/UI/GUI/UpdateCallbackGUI2.h +53 -0
  1120. package/vendor/7zip/CPP/7zip/UI/GUI/UpdateGUI.cpp +605 -0
  1121. package/vendor/7zip/CPP/7zip/UI/GUI/UpdateGUI.h +33 -0
  1122. package/vendor/7zip/CPP/7zip/UI/GUI/makefile +148 -0
  1123. package/vendor/7zip/CPP/7zip/UI/GUI/resource.rc +26 -0
  1124. package/vendor/7zip/CPP/7zip/UI/GUI/resource2.h +2 -0
  1125. package/vendor/7zip/CPP/7zip/UI/GUI/resource2.rc +10 -0
  1126. package/vendor/7zip/CPP/7zip/UI/GUI/resource3.h +10 -0
  1127. package/vendor/7zip/CPP/7zip/UI/GUI/resource3.rc +15 -0
  1128. package/vendor/7zip/CPP/7zip/UI/makefile +12 -0
  1129. package/vendor/7zip/CPP/7zip/cmpl_clang.mak +3 -0
  1130. package/vendor/7zip/CPP/7zip/cmpl_clang_arm64.mak +3 -0
  1131. package/vendor/7zip/CPP/7zip/cmpl_clang_x64.mak +3 -0
  1132. package/vendor/7zip/CPP/7zip/cmpl_clang_x86.mak +3 -0
  1133. package/vendor/7zip/CPP/7zip/cmpl_gcc.mak +3 -0
  1134. package/vendor/7zip/CPP/7zip/cmpl_gcc_arm.mak +3 -0
  1135. package/vendor/7zip/CPP/7zip/cmpl_gcc_arm64.mak +3 -0
  1136. package/vendor/7zip/CPP/7zip/cmpl_gcc_x64.mak +3 -0
  1137. package/vendor/7zip/CPP/7zip/cmpl_gcc_x86.mak +3 -0
  1138. package/vendor/7zip/CPP/7zip/cmpl_mac_arm64.mak +3 -0
  1139. package/vendor/7zip/CPP/7zip/cmpl_mac_x64.mak +3 -0
  1140. package/vendor/7zip/CPP/7zip/makefile +10 -0
  1141. package/vendor/7zip/CPP/7zip/var_clang.mak +11 -0
  1142. package/vendor/7zip/CPP/7zip/var_clang_arm64.mak +19 -0
  1143. package/vendor/7zip/CPP/7zip/var_clang_x64.mak +11 -0
  1144. package/vendor/7zip/CPP/7zip/var_clang_x86.mak +11 -0
  1145. package/vendor/7zip/CPP/7zip/var_gcc.mak +12 -0
  1146. package/vendor/7zip/CPP/7zip/var_gcc_arm.mak +34 -0
  1147. package/vendor/7zip/CPP/7zip/var_gcc_arm64.mak +12 -0
  1148. package/vendor/7zip/CPP/7zip/var_gcc_x64.mak +11 -0
  1149. package/vendor/7zip/CPP/7zip/var_gcc_x86.mak +10 -0
  1150. package/vendor/7zip/CPP/7zip/var_mac_arm64.mak +13 -0
  1151. package/vendor/7zip/CPP/7zip/var_mac_x64.mak +13 -0
  1152. package/vendor/7zip/CPP/7zip/warn_clang.mak +3 -0
  1153. package/vendor/7zip/CPP/7zip/warn_clang_mac.mak +9 -0
  1154. package/vendor/7zip/CPP/7zip/warn_gcc.mak +55 -0
  1155. package/vendor/7zip/CPP/Build.mak +259 -0
  1156. package/vendor/7zip/CPP/Common/AutoPtr.h +46 -0
  1157. package/vendor/7zip/CPP/Common/CRC.cpp +7 -0
  1158. package/vendor/7zip/CPP/Common/C_FileIO.cpp +3 -0
  1159. package/vendor/7zip/CPP/Common/C_FileIO.h +6 -0
  1160. package/vendor/7zip/CPP/Common/CksumReg.cpp +55 -0
  1161. package/vendor/7zip/CPP/Common/ComTry.h +21 -0
  1162. package/vendor/7zip/CPP/Common/CommandLineParser.cpp +231 -0
  1163. package/vendor/7zip/CPP/Common/CommandLineParser.h +63 -0
  1164. package/vendor/7zip/CPP/Common/Common.h +28 -0
  1165. package/vendor/7zip/CPP/Common/Common0.h +342 -0
  1166. package/vendor/7zip/CPP/Common/CrcReg.cpp +77 -0
  1167. package/vendor/7zip/CPP/Common/Defs.h +16 -0
  1168. package/vendor/7zip/CPP/Common/DynLimBuf.cpp +93 -0
  1169. package/vendor/7zip/CPP/Common/DynLimBuf.h +41 -0
  1170. package/vendor/7zip/CPP/Common/DynamicBuffer.h +76 -0
  1171. package/vendor/7zip/CPP/Common/IntToString.cpp +215 -0
  1172. package/vendor/7zip/CPP/Common/IntToString.h +54 -0
  1173. package/vendor/7zip/CPP/Common/Lang.cpp +173 -0
  1174. package/vendor/7zip/CPP/Common/Lang.h +30 -0
  1175. package/vendor/7zip/CPP/Common/ListFileUtils.cpp +150 -0
  1176. package/vendor/7zip/CPP/Common/ListFileUtils.h +18 -0
  1177. package/vendor/7zip/CPP/Common/LzFindPrepare.cpp +7 -0
  1178. package/vendor/7zip/CPP/Common/Md5Reg.cpp +44 -0
  1179. package/vendor/7zip/CPP/Common/MyBuffer.h +343 -0
  1180. package/vendor/7zip/CPP/Common/MyBuffer2.h +185 -0
  1181. package/vendor/7zip/CPP/Common/MyCom.h +693 -0
  1182. package/vendor/7zip/CPP/Common/MyException.h +14 -0
  1183. package/vendor/7zip/CPP/Common/MyGuidDef.h +63 -0
  1184. package/vendor/7zip/CPP/Common/MyInitGuid.h +57 -0
  1185. package/vendor/7zip/CPP/Common/MyLinux.h +75 -0
  1186. package/vendor/7zip/CPP/Common/MyMap.cpp +140 -0
  1187. package/vendor/7zip/CPP/Common/MyMap.h +28 -0
  1188. package/vendor/7zip/CPP/Common/MyString.cpp +1842 -0
  1189. package/vendor/7zip/CPP/Common/MyString.h +1079 -0
  1190. package/vendor/7zip/CPP/Common/MyTypes.h +38 -0
  1191. package/vendor/7zip/CPP/Common/MyUnknown.h +8 -0
  1192. package/vendor/7zip/CPP/Common/MyVector.cpp +3 -0
  1193. package/vendor/7zip/CPP/Common/MyVector.h +772 -0
  1194. package/vendor/7zip/CPP/Common/MyWindows.cpp +292 -0
  1195. package/vendor/7zip/CPP/Common/MyWindows.h +325 -0
  1196. package/vendor/7zip/CPP/Common/MyXml.cpp +349 -0
  1197. package/vendor/7zip/CPP/Common/MyXml.h +45 -0
  1198. package/vendor/7zip/CPP/Common/NewHandler.cpp +340 -0
  1199. package/vendor/7zip/CPP/Common/NewHandler.h +121 -0
  1200. package/vendor/7zip/CPP/Common/Random.cpp +28 -0
  1201. package/vendor/7zip/CPP/Common/Random.h +14 -0
  1202. package/vendor/7zip/CPP/Common/Sha1Prepare.cpp +7 -0
  1203. package/vendor/7zip/CPP/Common/Sha1Reg.cpp +67 -0
  1204. package/vendor/7zip/CPP/Common/Sha256Prepare.cpp +7 -0
  1205. package/vendor/7zip/CPP/Common/Sha256Reg.cpp +67 -0
  1206. package/vendor/7zip/CPP/Common/Sha3Reg.cpp +76 -0
  1207. package/vendor/7zip/CPP/Common/Sha512Prepare.cpp +7 -0
  1208. package/vendor/7zip/CPP/Common/Sha512Reg.cpp +83 -0
  1209. package/vendor/7zip/CPP/Common/StdAfx.h +8 -0
  1210. package/vendor/7zip/CPP/Common/StdInStream.cpp +98 -0
  1211. package/vendor/7zip/CPP/Common/StdInStream.h +46 -0
  1212. package/vendor/7zip/CPP/Common/StdOutStream.cpp +271 -0
  1213. package/vendor/7zip/CPP/Common/StdOutStream.h +87 -0
  1214. package/vendor/7zip/CPP/Common/StringConvert.cpp +762 -0
  1215. package/vendor/7zip/CPP/Common/StringConvert.h +110 -0
  1216. package/vendor/7zip/CPP/Common/StringToInt.cpp +154 -0
  1217. package/vendor/7zip/CPP/Common/StringToInt.h +38 -0
  1218. package/vendor/7zip/CPP/Common/TextConfig.cpp +123 -0
  1219. package/vendor/7zip/CPP/Common/TextConfig.h +19 -0
  1220. package/vendor/7zip/CPP/Common/UTFConvert.cpp +863 -0
  1221. package/vendor/7zip/CPP/Common/UTFConvert.h +384 -0
  1222. package/vendor/7zip/CPP/Common/Wildcard.cpp +789 -0
  1223. package/vendor/7zip/CPP/Common/Wildcard.h +231 -0
  1224. package/vendor/7zip/CPP/Common/Xxh64Reg.cpp +97 -0
  1225. package/vendor/7zip/CPP/Common/XzCrc64Init.cpp +7 -0
  1226. package/vendor/7zip/CPP/Common/XzCrc64Reg.cpp +39 -0
  1227. package/vendor/7zip/CPP/Windows/COM.cpp +41 -0
  1228. package/vendor/7zip/CPP/Windows/COM.h +86 -0
  1229. package/vendor/7zip/CPP/Windows/Clipboard.cpp +130 -0
  1230. package/vendor/7zip/CPP/Windows/Clipboard.h +28 -0
  1231. package/vendor/7zip/CPP/Windows/CommonDialog.cpp +269 -0
  1232. package/vendor/7zip/CPP/Windows/CommonDialog.h +43 -0
  1233. package/vendor/7zip/CPP/Windows/Console.cpp +10 -0
  1234. package/vendor/7zip/CPP/Windows/Console.h +52 -0
  1235. package/vendor/7zip/CPP/Windows/Control/ComboBox.cpp +75 -0
  1236. package/vendor/7zip/CPP/Windows/Control/ComboBox.h +79 -0
  1237. package/vendor/7zip/CPP/Windows/Control/CommandBar.h +52 -0
  1238. package/vendor/7zip/CPP/Windows/Control/Dialog.cpp +446 -0
  1239. package/vendor/7zip/CPP/Windows/Control/Dialog.h +213 -0
  1240. package/vendor/7zip/CPP/Windows/Control/Edit.h +19 -0
  1241. package/vendor/7zip/CPP/Windows/Control/ImageList.cpp +10 -0
  1242. package/vendor/7zip/CPP/Windows/Control/ImageList.h +87 -0
  1243. package/vendor/7zip/CPP/Windows/Control/ListView.cpp +162 -0
  1244. package/vendor/7zip/CPP/Windows/Control/ListView.h +156 -0
  1245. package/vendor/7zip/CPP/Windows/Control/ProgressBar.h +35 -0
  1246. package/vendor/7zip/CPP/Windows/Control/PropertyPage.cpp +165 -0
  1247. package/vendor/7zip/CPP/Windows/Control/PropertyPage.h +50 -0
  1248. package/vendor/7zip/CPP/Windows/Control/ReBar.h +34 -0
  1249. package/vendor/7zip/CPP/Windows/Control/Static.h +28 -0
  1250. package/vendor/7zip/CPP/Windows/Control/StatusBar.h +42 -0
  1251. package/vendor/7zip/CPP/Windows/Control/StdAfx.h +11 -0
  1252. package/vendor/7zip/CPP/Windows/Control/ToolBar.h +43 -0
  1253. package/vendor/7zip/CPP/Windows/Control/Trackbar.h +27 -0
  1254. package/vendor/7zip/CPP/Windows/Control/Window2.cpp +202 -0
  1255. package/vendor/7zip/CPP/Windows/Control/Window2.h +53 -0
  1256. package/vendor/7zip/CPP/Windows/DLL.cpp +178 -0
  1257. package/vendor/7zip/CPP/Windows/DLL.h +103 -0
  1258. package/vendor/7zip/CPP/Windows/ErrorMsg.cpp +133 -0
  1259. package/vendor/7zip/CPP/Windows/ErrorMsg.h +16 -0
  1260. package/vendor/7zip/CPP/Windows/FileDir.cpp +1388 -0
  1261. package/vendor/7zip/CPP/Windows/FileDir.h +173 -0
  1262. package/vendor/7zip/CPP/Windows/FileFind.cpp +1458 -0
  1263. package/vendor/7zip/CPP/Windows/FileFind.h +345 -0
  1264. package/vendor/7zip/CPP/Windows/FileIO.cpp +1188 -0
  1265. package/vendor/7zip/CPP/Windows/FileIO.h +508 -0
  1266. package/vendor/7zip/CPP/Windows/FileLink.cpp +697 -0
  1267. package/vendor/7zip/CPP/Windows/FileMapping.cpp +12 -0
  1268. package/vendor/7zip/CPP/Windows/FileMapping.h +66 -0
  1269. package/vendor/7zip/CPP/Windows/FileName.cpp +911 -0
  1270. package/vendor/7zip/CPP/Windows/FileName.h +142 -0
  1271. package/vendor/7zip/CPP/Windows/FileSystem.cpp +187 -0
  1272. package/vendor/7zip/CPP/Windows/FileSystem.h +31 -0
  1273. package/vendor/7zip/CPP/Windows/Handle.h +39 -0
  1274. package/vendor/7zip/CPP/Windows/MemoryGlobal.cpp +36 -0
  1275. package/vendor/7zip/CPP/Windows/MemoryGlobal.h +55 -0
  1276. package/vendor/7zip/CPP/Windows/MemoryLock.cpp +127 -0
  1277. package/vendor/7zip/CPP/Windows/MemoryLock.h +40 -0
  1278. package/vendor/7zip/CPP/Windows/Menu.cpp +265 -0
  1279. package/vendor/7zip/CPP/Windows/Menu.h +170 -0
  1280. package/vendor/7zip/CPP/Windows/NationalTime.cpp +37 -0
  1281. package/vendor/7zip/CPP/Windows/NationalTime.h +20 -0
  1282. package/vendor/7zip/CPP/Windows/Net.cpp +398 -0
  1283. package/vendor/7zip/CPP/Windows/Net.h +87 -0
  1284. package/vendor/7zip/CPP/Windows/NtCheck.h +58 -0
  1285. package/vendor/7zip/CPP/Windows/ProcessMessages.cpp +22 -0
  1286. package/vendor/7zip/CPP/Windows/ProcessMessages.h +12 -0
  1287. package/vendor/7zip/CPP/Windows/ProcessUtils.cpp +102 -0
  1288. package/vendor/7zip/CPP/Windows/ProcessUtils.h +138 -0
  1289. package/vendor/7zip/CPP/Windows/PropVariant.cpp +393 -0
  1290. package/vendor/7zip/CPP/Windows/PropVariant.h +173 -0
  1291. package/vendor/7zip/CPP/Windows/PropVariantConv.cpp +274 -0
  1292. package/vendor/7zip/CPP/Windows/PropVariantConv.h +47 -0
  1293. package/vendor/7zip/CPP/Windows/PropVariantUtils.cpp +161 -0
  1294. package/vendor/7zip/CPP/Windows/PropVariantUtils.h +34 -0
  1295. package/vendor/7zip/CPP/Windows/Registry.cpp +474 -0
  1296. package/vendor/7zip/CPP/Windows/Registry.h +96 -0
  1297. package/vendor/7zip/CPP/Windows/ResourceString.cpp +103 -0
  1298. package/vendor/7zip/CPP/Windows/ResourceString.h +17 -0
  1299. package/vendor/7zip/CPP/Windows/SecurityUtils.cpp +186 -0
  1300. package/vendor/7zip/CPP/Windows/SecurityUtils.h +154 -0
  1301. package/vendor/7zip/CPP/Windows/Shell.cpp +839 -0
  1302. package/vendor/7zip/CPP/Windows/Shell.h +129 -0
  1303. package/vendor/7zip/CPP/Windows/StdAfx.h +11 -0
  1304. package/vendor/7zip/CPP/Windows/Synchronization.cpp +87 -0
  1305. package/vendor/7zip/CPP/Windows/Synchronization.h +386 -0
  1306. package/vendor/7zip/CPP/Windows/System.cpp +423 -0
  1307. package/vendor/7zip/CPP/Windows/System.h +209 -0
  1308. package/vendor/7zip/CPP/Windows/SystemInfo.cpp +1312 -0
  1309. package/vendor/7zip/CPP/Windows/SystemInfo.h +19 -0
  1310. package/vendor/7zip/CPP/Windows/Thread.h +46 -0
  1311. package/vendor/7zip/CPP/Windows/TimeUtils.cpp +467 -0
  1312. package/vendor/7zip/CPP/Windows/TimeUtils.h +154 -0
  1313. package/vendor/7zip/CPP/Windows/WinDefs.h +17 -0
  1314. package/vendor/7zip/CPP/Windows/Window.cpp +179 -0
  1315. package/vendor/7zip/CPP/Windows/Window.h +363 -0
  1316. package/vendor/7zip/DOC/7zC.txt +187 -0
  1317. package/vendor/7zip/DOC/7zFormat.txt +469 -0
  1318. package/vendor/7zip/DOC/7zip.hhp +84 -0
  1319. package/vendor/7zip/DOC/7zip.wxs +403 -0
  1320. package/vendor/7zip/DOC/License.txt +151 -0
  1321. package/vendor/7zip/DOC/Methods.txt +177 -0
  1322. package/vendor/7zip/DOC/copying.txt +502 -0
  1323. package/vendor/7zip/DOC/lzma.txt +345 -0
  1324. package/vendor/7zip/DOC/readme.txt +299 -0
  1325. package/vendor/7zip/DOC/src-history.txt +884 -0
  1326. package/vendor/7zip/DOC/unRarLicense.txt +41 -0
  1327. package/vendor/7zip/README.md +2 -0
@@ -0,0 +1,3474 @@
1
+ // Archive/ZipIn.cpp
2
+
3
+ #include "StdAfx.h"
4
+
5
+ // #include <stdio.h>
6
+
7
+ #include "../../../Common/DynamicBuffer.h"
8
+ #include "../../../Common/IntToString.h"
9
+ #include "../../../Common/MyException.h"
10
+ #include "../../../Common/StringToInt.h"
11
+
12
+ #include "../../../Windows/PropVariant.h"
13
+
14
+ #include "../IArchive.h"
15
+
16
+ #include "ZipIn.h"
17
+
18
+ #define Get16(p) GetUi16(p)
19
+ #define Get32(p) GetUi32(p)
20
+ #define Get64(p) GetUi64(p)
21
+
22
+ #define G16(offs, v) v = Get16(p + (offs))
23
+ #define G32(offs, v) v = Get32(p + (offs))
24
+ #define G64(offs, v) v = Get64(p + (offs))
25
+
26
+ namespace NArchive {
27
+ namespace NZip {
28
+
29
+ /* we try to use same size of Buffer (1 << 17) for all tasks.
30
+ it allow to avoid reallocations and cache clearing. */
31
+
32
+ static const size_t kSeqBufferSize = (size_t)1 << 17;
33
+
34
+ /*
35
+ Open()
36
+ {
37
+ _inBufMode = false;
38
+ ReadVols()
39
+ FindCd();
40
+ TryEcd64()
41
+ SeekToVol()
42
+ FindMarker()
43
+ _inBufMode = true;
44
+ ReadHeaders()
45
+ _inBufMode = false;
46
+ ReadCd()
47
+ FindCd()
48
+ TryEcd64()
49
+ TryReadCd()
50
+ {
51
+ SeekToVol();
52
+ _inBufMode = true;
53
+ }
54
+ _inBufMode = true;
55
+ ReadLocals()
56
+ ReadCdItem()
57
+ ....
58
+ }
59
+ FindCd() writes to Buffer without touching (_inBufMode)
60
+ */
61
+
62
+ /*
63
+ if (not defined ZIP_SELF_CHECK) : it reads CD and if error in first pass CD reading, it reads LOCALS-CD-MODE
64
+ if ( defined ZIP_SELF_CHECK) : it always reads CD and LOCALS-CD-MODE
65
+ use ZIP_SELF_CHECK to check LOCALS-CD-MODE for any zip archive
66
+ */
67
+
68
+ // #define ZIP_SELF_CHECK
69
+
70
+
71
+ struct CEcd
72
+ {
73
+ UInt16 ThisDisk;
74
+ UInt16 CdDisk;
75
+ UInt16 NumEntries_in_ThisDisk;
76
+ UInt16 NumEntries;
77
+ UInt32 Size;
78
+ UInt32 Offset;
79
+ UInt16 CommentSize;
80
+
81
+ bool IsEmptyArc() const
82
+ {
83
+ return ThisDisk == 0
84
+ && CdDisk == 0
85
+ && NumEntries_in_ThisDisk == 0
86
+ && NumEntries == 0
87
+ && Size == 0
88
+ && Offset == 0 // test it
89
+ ;
90
+ }
91
+
92
+ void Parse(const Byte *p); // (p) doesn't include signature
93
+ };
94
+
95
+ void CEcd::Parse(const Byte *p)
96
+ {
97
+ // (p) doesn't include signature
98
+ G16(0, ThisDisk);
99
+ G16(2, CdDisk);
100
+ G16(4, NumEntries_in_ThisDisk);
101
+ G16(6, NumEntries);
102
+ G32(8, Size);
103
+ G32(12, Offset);
104
+ G16(16, CommentSize);
105
+ }
106
+
107
+
108
+ void CCdInfo::ParseEcd32(const Byte *p)
109
+ {
110
+ IsFromEcd64 = false;
111
+ // (p) includes signature
112
+ p += 4;
113
+ G16(0, ThisDisk);
114
+ G16(2, CdDisk);
115
+ G16(4, NumEntries_in_ThisDisk);
116
+ G16(6, NumEntries);
117
+ G32(8, Size);
118
+ G32(12, Offset);
119
+ G16(16, CommentSize);
120
+ }
121
+
122
+ void CCdInfo::ParseEcd64e(const Byte *p)
123
+ {
124
+ IsFromEcd64 = true;
125
+ // (p) exclude signature
126
+ G16(0, VersionMade);
127
+ G16(2, VersionNeedExtract);
128
+ G32(4, ThisDisk);
129
+ G32(8, CdDisk);
130
+
131
+ G64(12, NumEntries_in_ThisDisk);
132
+ G64(20, NumEntries);
133
+ G64(28, Size);
134
+ G64(36, Offset);
135
+ }
136
+
137
+
138
+ struct CLocator
139
+ {
140
+ UInt32 Ecd64Disk;
141
+ UInt32 NumDisks;
142
+ UInt64 Ecd64Offset;
143
+
144
+ CLocator(): Ecd64Disk(0), NumDisks(0), Ecd64Offset(0) {}
145
+
146
+ void Parse(const Byte *p)
147
+ {
148
+ G32(0, Ecd64Disk);
149
+ G64(4, Ecd64Offset);
150
+ G32(12, NumDisks);
151
+ }
152
+
153
+ bool Is_Ecd64Offset_Overflow() const { return Ecd64Offset >= (UInt64)1 << 63; }
154
+ bool IsEmptyArc() const
155
+ {
156
+ return Ecd64Disk == 0 && NumDisks == 0 && Ecd64Offset == 0;
157
+ }
158
+ };
159
+
160
+
161
+
162
+
163
+ void CInArchive::ClearRefs()
164
+ {
165
+ StreamRef.Release();
166
+ Stream = NULL;
167
+ StartStream = NULL;
168
+ Callback = NULL;
169
+
170
+ Vols.Clear();
171
+ }
172
+
173
+ void CInArchive::Close()
174
+ {
175
+ _cnt = 0;
176
+ DisableBufMode();
177
+
178
+ IsArcOpen = false;
179
+
180
+ IsArc = false;
181
+ IsZip64 = false;
182
+
183
+ IsApk = false;
184
+ IsCdUnsorted = false;
185
+
186
+ HeadersError = false;
187
+ HeadersWarning = false;
188
+ ExtraMinorError = false;
189
+
190
+ UnexpectedEnd = false;
191
+ LocalsWereRead = false;
192
+ LocalsCenterMerged = false;
193
+ NoCentralDir = false;
194
+ Overflow32bit = false;
195
+ Cd_NumEntries_Overflow_16bit = false;
196
+
197
+ MarkerIsFound = false;
198
+ MarkerIsSafe = false;
199
+
200
+ IsMultiVol = false;
201
+ UseDisk_in_SingleVol = false;
202
+ EcdVolIndex = 0;
203
+
204
+ ArcInfo.Clear();
205
+
206
+ ClearRefs();
207
+ }
208
+
209
+
210
+
211
+ HRESULT CInArchive::Seek_SavePos(UInt64 offset)
212
+ {
213
+ // InitBuf();
214
+ // if (!Stream) return S_FALSE;
215
+ return Stream->Seek((Int64)offset, STREAM_SEEK_SET, &_streamPos);
216
+ }
217
+
218
+
219
+ /* SeekToVol() will keep the cached mode, if new volIndex is
220
+ same Vols.StreamIndex volume, and offset doesn't go out of cached region */
221
+
222
+ HRESULT CInArchive::SeekToVol(int volIndex, UInt64 offset)
223
+ {
224
+ if (volIndex != Vols.StreamIndex)
225
+ {
226
+ if (IsMultiVol && volIndex >= 0)
227
+ {
228
+ if ((unsigned)volIndex >= Vols.Streams.Size())
229
+ return S_FALSE;
230
+ if (!Vols.Streams[(unsigned)volIndex].Stream)
231
+ return S_FALSE;
232
+ Stream = Vols.Streams[(unsigned)volIndex].Stream;
233
+ }
234
+ else if (volIndex == -2)
235
+ {
236
+ if (!Vols.ZipStream)
237
+ return S_FALSE;
238
+ Stream = Vols.ZipStream;
239
+ }
240
+ else
241
+ Stream = StartStream;
242
+ Vols.StreamIndex = volIndex;
243
+ }
244
+ else
245
+ {
246
+ if (offset <= _streamPos)
247
+ {
248
+ const UInt64 back = _streamPos - offset;
249
+ if (back <= _bufCached)
250
+ {
251
+ _bufPos = _bufCached - (size_t)back;
252
+ return S_OK;
253
+ }
254
+ }
255
+ }
256
+ InitBuf();
257
+ return Seek_SavePos(offset);
258
+ }
259
+
260
+
261
+ HRESULT CInArchive::AllocateBuffer(size_t size)
262
+ {
263
+ if (size <= Buffer.Size())
264
+ return S_OK;
265
+ /* in cached mode virtual_pos is not equal to phy_pos (_streamPos)
266
+ so we change _streamPos and do Seek() to virtual_pos before cache clearing */
267
+ if (_bufPos != _bufCached)
268
+ {
269
+ RINOK(Seek_SavePos(GetVirtStreamPos()))
270
+ }
271
+ InitBuf();
272
+ Buffer.AllocAtLeast(size);
273
+ if (!Buffer.IsAllocated())
274
+ return E_OUTOFMEMORY;
275
+ return S_OK;
276
+ }
277
+
278
+ // ---------- ReadFromCache ----------
279
+ // reads from cache and from Stream
280
+ // move to next volume can be allowed if (CanStartNewVol) and only before first byte reading
281
+
282
+ HRESULT CInArchive::ReadFromCache(Byte *data, unsigned size, unsigned &processed)
283
+ {
284
+ HRESULT result = S_OK;
285
+ processed = 0;
286
+
287
+ for (;;)
288
+ {
289
+ if (size == 0)
290
+ return S_OK;
291
+
292
+ const size_t avail = GetAvail();
293
+
294
+ if (avail != 0)
295
+ {
296
+ unsigned cur = size;
297
+ if (cur > avail)
298
+ cur = (unsigned)avail;
299
+ memcpy(data, (const Byte *)Buffer + _bufPos, cur);
300
+
301
+ data += cur;
302
+ size -= cur;
303
+ processed += cur;
304
+
305
+ _bufPos += cur;
306
+ _cnt += cur;
307
+
308
+ CanStartNewVol = false;
309
+
310
+ continue;
311
+ }
312
+
313
+ InitBuf();
314
+
315
+ if (_inBufMode)
316
+ {
317
+ UInt32 cur = 0;
318
+ result = Stream->Read(Buffer, (UInt32)Buffer.Size(), &cur);
319
+ _bufPos = 0;
320
+ _bufCached = cur;
321
+ _streamPos += cur;
322
+ if (cur != 0)
323
+ CanStartNewVol = false;
324
+ if (result != S_OK)
325
+ break;
326
+ if (cur != 0)
327
+ continue;
328
+ }
329
+ else
330
+ {
331
+ size_t cur = size;
332
+ result = ReadStream(Stream, data, &cur);
333
+ data += cur;
334
+ size -= (unsigned)cur;
335
+ processed += (unsigned)cur;
336
+ _streamPos += cur;
337
+ _cnt += cur;
338
+ if (cur != 0)
339
+ {
340
+ CanStartNewVol = false;
341
+ break;
342
+ }
343
+ if (result != S_OK)
344
+ break;
345
+ }
346
+
347
+ if ( !IsMultiVol
348
+ || !CanStartNewVol
349
+ || Vols.StreamIndex < 0
350
+ || (unsigned)Vols.StreamIndex + 1 >= Vols.Streams.Size())
351
+ break;
352
+
353
+ const CVols::CSubStreamInfo &s = Vols.Streams[(unsigned)Vols.StreamIndex + 1];
354
+ if (!s.Stream)
355
+ break;
356
+ result = s.SeekToStart();
357
+ if (result != S_OK)
358
+ break;
359
+ Vols.StreamIndex++;
360
+ _streamPos = 0;
361
+ // Vols.NeedSeek = false;
362
+
363
+ Stream = s.Stream;
364
+ }
365
+
366
+ return result;
367
+ }
368
+
369
+
370
+ HRESULT CInArchive::ReadFromCache_FALSE(Byte *data, unsigned size)
371
+ {
372
+ unsigned processed;
373
+ HRESULT res = ReadFromCache(data, size, processed);
374
+ if (res == S_OK && size != processed)
375
+ return S_FALSE;
376
+ return res;
377
+ }
378
+
379
+
380
+ static bool CheckDosTime(UInt32 dosTime)
381
+ {
382
+ if (dosTime == 0)
383
+ return true;
384
+ unsigned month = (dosTime >> 21) & 0xF;
385
+ unsigned day = (dosTime >> 16) & 0x1F;
386
+ unsigned hour = (dosTime >> 11) & 0x1F;
387
+ unsigned min = (dosTime >> 5) & 0x3F;
388
+ unsigned sec = (dosTime & 0x1F) * 2;
389
+ if (month < 1 || month > 12 || day < 1 || day > 31 || hour > 23 || min > 59 || sec > 59)
390
+ return false;
391
+ return true;
392
+ }
393
+
394
+ API_FUNC_IsArc IsArc_Zip(const Byte *p, size_t size)
395
+ {
396
+ if (size < 8)
397
+ return k_IsArc_Res_NEED_MORE;
398
+ if (p[0] != 'P')
399
+ return k_IsArc_Res_NO;
400
+
401
+ UInt32 sig = Get32(p);
402
+
403
+ if (sig == NSignature::kNoSpan || sig == NSignature::kSpan)
404
+ {
405
+ p += 4;
406
+ size -= 4;
407
+ }
408
+
409
+ sig = Get32(p);
410
+
411
+ if (sig == NSignature::kEcd64)
412
+ {
413
+ if (size < kEcd64_FullSize)
414
+ return k_IsArc_Res_NEED_MORE;
415
+
416
+ const UInt64 recordSize = Get64(p + 4);
417
+ if ( recordSize < kEcd64_MainSize
418
+ || recordSize > kEcd64_MainSize + (1 << 20))
419
+ return k_IsArc_Res_NO;
420
+ CCdInfo cdInfo;
421
+ cdInfo.ParseEcd64e(p + 12);
422
+ if (!cdInfo.IsEmptyArc())
423
+ return k_IsArc_Res_NO;
424
+ return k_IsArc_Res_YES; // k_IsArc_Res_YES_2;
425
+ }
426
+
427
+ if (sig == NSignature::kEcd)
428
+ {
429
+ if (size < kEcdSize)
430
+ return k_IsArc_Res_NEED_MORE;
431
+ CEcd ecd;
432
+ ecd.Parse(p + 4);
433
+ // if (ecd.cdSize != 0)
434
+ if (!ecd.IsEmptyArc())
435
+ return k_IsArc_Res_NO;
436
+ return k_IsArc_Res_YES; // k_IsArc_Res_YES_2;
437
+ }
438
+
439
+ if (sig != NSignature::kLocalFileHeader)
440
+ return k_IsArc_Res_NO;
441
+
442
+ if (size < kLocalHeaderSize)
443
+ return k_IsArc_Res_NEED_MORE;
444
+
445
+ p += 4;
446
+
447
+ {
448
+ const unsigned kPureHeaderSize = kLocalHeaderSize - 4;
449
+ unsigned i;
450
+ for (i = 0; i < kPureHeaderSize && p[i] == 0; i++);
451
+ if (i == kPureHeaderSize)
452
+ return k_IsArc_Res_NEED_MORE;
453
+ }
454
+
455
+ /*
456
+ if (p[0] >= 128) // ExtractVersion.Version;
457
+ return k_IsArc_Res_NO;
458
+ */
459
+
460
+ // ExtractVersion.Version = p[0];
461
+ // ExtractVersion.HostOS = p[1];
462
+ // Flags = Get16(p + 2);
463
+ // Method = Get16(p + 4);
464
+ /*
465
+ // 9.33: some zip archives contain incorrect value in timestamp. So we don't check it now
466
+ UInt32 dosTime = Get32(p + 6);
467
+ if (!CheckDosTime(dosTime))
468
+ return k_IsArc_Res_NO;
469
+ */
470
+ // Crc = Get32(p + 10);
471
+ // PackSize = Get32(p + 14);
472
+ // Size = Get32(p + 18);
473
+ const unsigned nameSize = Get16(p + 22);
474
+ unsigned extraSize = Get16(p + 24);
475
+ const UInt32 extraOffset = kLocalHeaderSize + (UInt32)nameSize;
476
+
477
+ /*
478
+ // 21.02: fixed. we don't use the following check
479
+ if (extraOffset + extraSize > (1 << 16))
480
+ return k_IsArc_Res_NO;
481
+ */
482
+
483
+ p -= 4;
484
+
485
+ {
486
+ size_t rem = size - kLocalHeaderSize;
487
+ if (rem > nameSize)
488
+ rem = nameSize;
489
+ const Byte *p2 = p + kLocalHeaderSize;
490
+ for (size_t i = 0; i < rem; i++)
491
+ if (p2[i] == 0)
492
+ {
493
+ // we support some "bad" zip archives that contain zeros after name
494
+ for (size_t k = i + 1; k < rem; k++)
495
+ if (p2[k] != 0)
496
+ return k_IsArc_Res_NO;
497
+ break;
498
+ /*
499
+ if (i != nameSize - 1)
500
+ return k_IsArc_Res_NO;
501
+ */
502
+ }
503
+ }
504
+
505
+ if (size < extraOffset)
506
+ return k_IsArc_Res_NEED_MORE;
507
+
508
+ if (extraSize > 0)
509
+ {
510
+ p += extraOffset;
511
+ size -= extraOffset;
512
+ while (extraSize != 0)
513
+ {
514
+ if (extraSize < 4)
515
+ {
516
+ // 7-Zip before 9.31 created incorrect WzAES Extra in folder's local headers.
517
+ // so we return k_IsArc_Res_YES to support such archives.
518
+ // return k_IsArc_Res_NO; // do we need to support such extra ?
519
+ return k_IsArc_Res_YES;
520
+ }
521
+ if (size < 4)
522
+ return k_IsArc_Res_NEED_MORE;
523
+ unsigned dataSize = Get16(p + 2);
524
+ size -= 4;
525
+ extraSize -= 4;
526
+ p += 4;
527
+ if (dataSize > extraSize)
528
+ {
529
+ // It can be error on header.
530
+ // We want to support such rare case bad archives.
531
+ // We use additional checks to reduce false-positive probability.
532
+ if (nameSize == 0
533
+ || nameSize > (1 << 9)
534
+ || extraSize > (1 << 9))
535
+ return k_IsArc_Res_NO;
536
+ return k_IsArc_Res_YES;
537
+ }
538
+ if (dataSize > size)
539
+ return k_IsArc_Res_NEED_MORE;
540
+ size -= dataSize;
541
+ extraSize -= dataSize;
542
+ p += dataSize;
543
+ }
544
+ }
545
+
546
+ return k_IsArc_Res_YES;
547
+ }
548
+
549
+ static UInt32 IsArc_Zip_2(const Byte *p, size_t size, bool isFinal)
550
+ {
551
+ UInt32 res = IsArc_Zip(p, size);
552
+ if (res == k_IsArc_Res_NEED_MORE && isFinal)
553
+ return k_IsArc_Res_NO;
554
+ return res;
555
+ }
556
+
557
+
558
+
559
+ /* FindPK_4() is allowed to access data up to and including &limit[3].
560
+ limit[4] access is not allowed.
561
+ return:
562
+ (return_ptr < limit) : "PK" was found at (return_ptr)
563
+ (return_ptr >= limit) : limit was reached or crossed. So no "PK" found before limit
564
+ */
565
+ Z7_NO_INLINE
566
+ static const Byte *FindPK_4(const Byte *p Z7_lifetimebound, const Byte *limit Z7_lifetimebound)
567
+ {
568
+ for (;;)
569
+ {
570
+ for (;;)
571
+ {
572
+ if (p >= limit)
573
+ return limit;
574
+ Byte b = p[1];
575
+ if (b == 0x4B) { if (p[0] == 0x50) { return p; } p += 1; break; }
576
+ if (b == 0x50) { if (p[2] == 0x4B) { return p + 1; } p += 2; break; }
577
+ b = p[3];
578
+ p += 4;
579
+ if (b == 0x4B) { if (p[-2]== 0x50) { return p - 2; } p -= 1; break; }
580
+ if (b == 0x50) { if (p[0] == 0x4B) { return p - 1; } break; }
581
+ }
582
+ }
583
+ /*
584
+ for (;;)
585
+ {
586
+ for (;;)
587
+ {
588
+ if (p >= limit)
589
+ return limit;
590
+ if (*p++ == 0x50) break;
591
+ if (*p++ == 0x50) break;
592
+ if (*p++ == 0x50) break;
593
+ if (*p++ == 0x50) break;
594
+ }
595
+ if (*p == 0x4B)
596
+ return p - 1;
597
+ }
598
+ */
599
+ }
600
+
601
+
602
+ /*
603
+ ---------- FindMarker ----------
604
+ returns:
605
+ S_OK:
606
+ ArcInfo.MarkerVolIndex : volume of marker
607
+ ArcInfo.MarkerPos : Pos of first signature
608
+ ArcInfo.MarkerPos2 : Pos of main signature (local item signature in most cases)
609
+ _streamPos : stream pos
610
+ _cnt : The number of virtal Bytes after start of search to offset after signature
611
+ _signature : main signature
612
+
613
+ S_FALSE: can't find marker, or there is some non-zip data after marker
614
+
615
+ Error code: stream reading error.
616
+ */
617
+
618
+ HRESULT CInArchive::FindMarker(const UInt64 *searchLimit)
619
+ {
620
+ ArcInfo.MarkerPos = GetVirtStreamPos();
621
+ ArcInfo.MarkerPos2 = ArcInfo.MarkerPos;
622
+ ArcInfo.MarkerVolIndex = Vols.StreamIndex;
623
+
624
+ _cnt = 0;
625
+
626
+ CanStartNewVol = false;
627
+
628
+ if (searchLimit && *searchLimit == 0)
629
+ {
630
+ Byte startBuf[kMarkerSize];
631
+ RINOK(ReadFromCache_FALSE(startBuf, kMarkerSize))
632
+
633
+ UInt32 marker = Get32(startBuf);
634
+ _signature = marker;
635
+
636
+ if ( marker == NSignature::kNoSpan
637
+ || marker == NSignature::kSpan)
638
+ {
639
+ RINOK(ReadFromCache_FALSE(startBuf, kMarkerSize))
640
+ _signature = Get32(startBuf);
641
+ }
642
+
643
+ if ( _signature != NSignature::kEcd
644
+ && _signature != NSignature::kEcd64
645
+ && _signature != NSignature::kLocalFileHeader)
646
+ return S_FALSE;
647
+
648
+ ArcInfo.MarkerPos2 = GetVirtStreamPos() - 4;
649
+ ArcInfo.IsSpanMode = (marker == NSignature::kSpan);
650
+
651
+ // we use weak test in case of (*searchLimit == 0)
652
+ // since error will be detected later in Open function
653
+ return S_OK;
654
+ }
655
+
656
+ // zip specification: (_zip_header_size < (1 << 16))
657
+ // so we need such size to check header
658
+ const size_t kCheckSize = (size_t)1 << 16;
659
+ const size_t kBufSize = (size_t)1 << 17; // (kBufSize must be > kCheckSize)
660
+
661
+ RINOK(AllocateBuffer(kBufSize))
662
+
663
+ _inBufMode = true;
664
+
665
+ UInt64 progressPrev = 0;
666
+
667
+ for (;;)
668
+ {
669
+ RINOK(LookAhead(kBufSize))
670
+
671
+ const size_t avail = GetAvail();
672
+
673
+ size_t limitPos;
674
+ // (avail > kBufSize) is possible, if (Buffer.Size() > kBufSize)
675
+ const bool isFinished = (avail < kBufSize);
676
+ if (isFinished)
677
+ {
678
+ const unsigned kMinAllowed = 4;
679
+ if (avail <= kMinAllowed)
680
+ {
681
+ if ( !IsMultiVol
682
+ || Vols.StreamIndex < 0
683
+ || (unsigned)Vols.StreamIndex + 1 >= Vols.Streams.Size())
684
+ break;
685
+
686
+ SkipLookahed(avail);
687
+
688
+ const CVols::CSubStreamInfo &s = Vols.Streams[(unsigned)Vols.StreamIndex + 1];
689
+ if (!s.Stream)
690
+ break;
691
+
692
+ RINOK(s.SeekToStart())
693
+
694
+ InitBuf();
695
+ Vols.StreamIndex++;
696
+ _streamPos = 0;
697
+ Stream = s.Stream;
698
+ continue;
699
+ }
700
+ limitPos = avail - kMinAllowed;
701
+ }
702
+ else
703
+ limitPos = (avail - kCheckSize);
704
+
705
+ // we don't check at (limitPos) for good fast aligned operations
706
+
707
+ if (searchLimit)
708
+ {
709
+ if (_cnt > *searchLimit)
710
+ break;
711
+ UInt64 rem = *searchLimit - _cnt;
712
+ if (limitPos > rem)
713
+ limitPos = (size_t)rem + 1;
714
+ }
715
+
716
+ if (limitPos == 0)
717
+ break;
718
+
719
+ const Byte * const pStart = Buffer + _bufPos;
720
+ const Byte * p = pStart;
721
+ const Byte * const limit = pStart + limitPos;
722
+
723
+ for (;; p++)
724
+ {
725
+ p = FindPK_4(p, limit);
726
+ if (p >= limit)
727
+ break;
728
+ size_t rem = (size_t)(pStart + avail - p);
729
+ /* 22.02 : we limit check size with kCheckSize to be consistent for
730
+ any different combination of _bufPos in Buffer and size of Buffer. */
731
+ if (rem > kCheckSize)
732
+ rem = kCheckSize;
733
+ const UInt32 res = IsArc_Zip_2(p, rem, isFinished);
734
+ if (res != k_IsArc_Res_NO)
735
+ {
736
+ if (rem < kMarkerSize)
737
+ return S_FALSE;
738
+ _signature = Get32(p);
739
+ SkipLookahed((size_t)(p - pStart));
740
+ ArcInfo.MarkerVolIndex = Vols.StreamIndex;
741
+ ArcInfo.MarkerPos = GetVirtStreamPos();
742
+ ArcInfo.MarkerPos2 = ArcInfo.MarkerPos;
743
+ SkipLookahed(4);
744
+ if ( _signature == NSignature::kNoSpan
745
+ || _signature == NSignature::kSpan)
746
+ {
747
+ if (rem < kMarkerSize * 2)
748
+ return S_FALSE;
749
+ ArcInfo.IsSpanMode = (_signature == NSignature::kSpan);
750
+ _signature = Get32(p + 4);
751
+ ArcInfo.MarkerPos2 += 4;
752
+ SkipLookahed(4);
753
+ }
754
+ return S_OK;
755
+ }
756
+ }
757
+
758
+ if (!IsMultiVol && isFinished)
759
+ break;
760
+
761
+ SkipLookahed((size_t)(p - pStart));
762
+
763
+ if (Callback && (_cnt - progressPrev) >= ((UInt32)1 << 23))
764
+ {
765
+ progressPrev = _cnt;
766
+ // const UInt64 numFiles64 = 0;
767
+ RINOK(Callback->SetCompleted(NULL, &_cnt))
768
+ }
769
+ }
770
+
771
+ return S_FALSE;
772
+ }
773
+
774
+
775
+ /*
776
+ ---------- IncreaseRealPosition ----------
777
+ moves virtual offset in virtual stream.
778
+ changing to new volumes is allowed
779
+ */
780
+
781
+ HRESULT CInArchive::IncreaseRealPosition(UInt64 offset, bool &isFinished)
782
+ {
783
+ isFinished = false;
784
+
785
+ for (;;)
786
+ {
787
+ const size_t avail = GetAvail();
788
+
789
+ if (offset <= avail)
790
+ {
791
+ _bufPos += (size_t)offset;
792
+ _cnt += offset;
793
+ return S_OK;
794
+ }
795
+
796
+ _cnt += avail;
797
+ offset -= avail;
798
+
799
+ _bufCached = 0;
800
+ _bufPos = 0;
801
+
802
+ if (!_inBufMode)
803
+ break;
804
+
805
+ CanStartNewVol = true;
806
+ LookAhead(1);
807
+
808
+ if (GetAvail() == 0)
809
+ return S_OK;
810
+ }
811
+
812
+ // cache is empty
813
+
814
+ if (!IsMultiVol)
815
+ {
816
+ _cnt += offset;
817
+ return Stream->Seek((Int64)offset, STREAM_SEEK_CUR, &_streamPos);
818
+ }
819
+
820
+ for (;;)
821
+ {
822
+ if (offset == 0)
823
+ return S_OK;
824
+
825
+ if (Vols.StreamIndex < 0)
826
+ return S_FALSE;
827
+ if ((unsigned)Vols.StreamIndex >= Vols.Streams.Size())
828
+ {
829
+ isFinished = true;
830
+ return S_OK;
831
+ }
832
+ {
833
+ const CVols::CSubStreamInfo &s = Vols.Streams[(unsigned)Vols.StreamIndex];
834
+ if (!s.Stream)
835
+ {
836
+ isFinished = true;
837
+ return S_OK;
838
+ }
839
+ if (_streamPos > s.Size)
840
+ return S_FALSE;
841
+ const UInt64 rem = s.Size - _streamPos;
842
+ if ((UInt64)offset <= rem)
843
+ {
844
+ _cnt += offset;
845
+ return Stream->Seek((Int64)offset, STREAM_SEEK_CUR, &_streamPos);
846
+ }
847
+ RINOK(Seek_SavePos(s.Size))
848
+ offset -= rem;
849
+ _cnt += rem;
850
+ }
851
+
852
+ Stream = NULL;
853
+ _streamPos = 0;
854
+ Vols.StreamIndex++;
855
+ if ((unsigned)Vols.StreamIndex >= Vols.Streams.Size())
856
+ {
857
+ isFinished = true;
858
+ return S_OK;
859
+ }
860
+ const CVols::CSubStreamInfo &s2 = Vols.Streams[(unsigned)Vols.StreamIndex];
861
+ if (!s2.Stream)
862
+ {
863
+ isFinished = true;
864
+ return S_OK;
865
+ }
866
+ Stream = s2.Stream;
867
+ RINOK(Seek_SavePos(0))
868
+ }
869
+ }
870
+
871
+
872
+
873
+ /*
874
+ ---------- LookAhead ----------
875
+ Reads data to buffer, if required.
876
+
877
+ It can read from volumes as long as Buffer.Size().
878
+ But it moves to new volume, only if it's required to provide minRequired bytes in buffer.
879
+
880
+ in:
881
+ (minRequired <= Buffer.Size())
882
+
883
+ return:
884
+ S_OK : if (GetAvail() < minRequired) after function return, it's end of stream(s) data, or no new volume stream.
885
+ Error codes: IInStream::Read() error or IInStream::Seek() error for multivol
886
+ */
887
+
888
+ HRESULT CInArchive::LookAhead(size_t minRequired)
889
+ {
890
+ for (;;)
891
+ {
892
+ const size_t avail = GetAvail();
893
+
894
+ if (minRequired <= avail)
895
+ return S_OK;
896
+
897
+ if (_bufPos != 0)
898
+ {
899
+ if (avail != 0)
900
+ memmove(Buffer, Buffer + _bufPos, avail);
901
+ _bufPos = 0;
902
+ _bufCached = avail;
903
+ }
904
+
905
+ const size_t pos = _bufCached;
906
+ UInt32 processed = 0;
907
+ HRESULT res = Stream->Read(Buffer + pos, (UInt32)(Buffer.Size() - pos), &processed);
908
+ _streamPos += processed;
909
+ _bufCached += processed;
910
+
911
+ if (res != S_OK)
912
+ return res;
913
+
914
+ if (processed != 0)
915
+ continue;
916
+
917
+ if ( !IsMultiVol
918
+ || !CanStartNewVol
919
+ || Vols.StreamIndex < 0
920
+ || (unsigned)Vols.StreamIndex + 1 >= Vols.Streams.Size())
921
+ return S_OK;
922
+
923
+ const CVols::CSubStreamInfo &s = Vols.Streams[(unsigned)Vols.StreamIndex + 1];
924
+ if (!s.Stream)
925
+ return S_OK;
926
+
927
+ RINOK(s.SeekToStart())
928
+
929
+ Vols.StreamIndex++;
930
+ _streamPos = 0;
931
+ Stream = s.Stream;
932
+ // Vols.NeedSeek = false;
933
+ }
934
+ }
935
+
936
+
937
+ class CUnexpectEnd {};
938
+
939
+
940
+ /*
941
+ ---------- SafeRead ----------
942
+
943
+ reads data of exact size from stream(s)
944
+
945
+ in:
946
+ _inBufMode
947
+ if (CanStartNewVol) it can go to next volume before first byte reading, if there is end of volume data.
948
+
949
+ in, out:
950
+ _streamPos : position in Stream
951
+ Stream
952
+ Vols : if (IsMultiVol)
953
+ _cnt
954
+
955
+ out:
956
+ (CanStartNewVol == false), if some data was read
957
+
958
+ return:
959
+ S_OK : success reading of requested data
960
+
961
+ exceptions:
962
+ CSystemException() - stream reading error
963
+ CUnexpectEnd() : could not read data of requested size
964
+ */
965
+
966
+ void CInArchive::SafeRead(Byte *data, unsigned size)
967
+ {
968
+ unsigned processed;
969
+ HRESULT result = ReadFromCache(data, size, processed);
970
+ if (result != S_OK)
971
+ throw CSystemException(result);
972
+ if (size != processed)
973
+ throw CUnexpectEnd();
974
+ }
975
+
976
+ void CInArchive::ReadBuffer(CByteBuffer &buffer, unsigned size)
977
+ {
978
+ buffer.Alloc(size);
979
+ if (size != 0)
980
+ SafeRead(buffer, size);
981
+ }
982
+
983
+ // Byte CInArchive::ReadByte () { Byte b; SafeRead(&b, 1); return b; }
984
+ // UInt16 CInArchive::ReadUInt16() { Byte buf[2]; SafeRead(buf, 2); return Get16(buf); }
985
+ UInt32 CInArchive::ReadUInt32() { Byte buf[4]; SafeRead(buf, 4); return Get32(buf); }
986
+ UInt64 CInArchive::ReadUInt64() { Byte buf[8]; SafeRead(buf, 8); return Get64(buf); }
987
+
988
+ void CInArchive::ReadSignature()
989
+ {
990
+ CanStartNewVol = true;
991
+ _signature = ReadUInt32();
992
+ // CanStartNewVol = false; // it's already changed in SafeRead
993
+ }
994
+
995
+
996
+ // we Skip() inside headers only, so no need for stream change in multivol.
997
+
998
+ void CInArchive::Skip(size_t num)
999
+ {
1000
+ while (num != 0)
1001
+ {
1002
+ const unsigned kBufSize = (size_t)1 << 10;
1003
+ Byte buf[kBufSize];
1004
+ unsigned step = kBufSize;
1005
+ if (step > num)
1006
+ step = (unsigned)num;
1007
+ SafeRead(buf, step);
1008
+ num -= step;
1009
+ }
1010
+ }
1011
+
1012
+ /*
1013
+ HRESULT CInArchive::Callback_Completed(unsigned numFiles)
1014
+ {
1015
+ const UInt64 numFiles64 = numFiles;
1016
+ return Callback->SetCompleted(&numFiles64, &_cnt);
1017
+ }
1018
+ */
1019
+
1020
+ HRESULT CInArchive::Skip64(UInt64 num, unsigned numFiles)
1021
+ {
1022
+ if (num == 0)
1023
+ return S_OK;
1024
+
1025
+ for (;;)
1026
+ {
1027
+ size_t step = (size_t)1 << 24;
1028
+ if (step > num)
1029
+ step = (size_t)num;
1030
+ Skip(step);
1031
+ num -= step;
1032
+ if (num == 0)
1033
+ return S_OK;
1034
+ if (Callback)
1035
+ {
1036
+ const UInt64 numFiles64 = numFiles;
1037
+ RINOK(Callback->SetCompleted(&numFiles64, &_cnt))
1038
+ }
1039
+ }
1040
+ }
1041
+
1042
+
1043
+ bool CInArchive::ReadFileName(unsigned size, AString &s)
1044
+ {
1045
+ if (size == 0)
1046
+ {
1047
+ s.Empty();
1048
+ return true;
1049
+ }
1050
+ char *p = s.GetBuf(size);
1051
+ SafeRead((Byte *)p, size);
1052
+ unsigned i = size;
1053
+ do
1054
+ {
1055
+ if (p[i - 1] != 0)
1056
+ break;
1057
+ }
1058
+ while (--i);
1059
+ s.ReleaseBuf_CalcLen(size);
1060
+ return s.Len() == i;
1061
+ }
1062
+
1063
+
1064
+ #define ZIP64_IS_32_MAX(n) ((n) == 0xFFFFFFFF)
1065
+ #define ZIP64_IS_16_MAX(n) ((n) == 0xFFFF)
1066
+
1067
+
1068
+ bool CInArchive::ReadExtra(const CLocalItem &item, unsigned extraSize, CExtraBlock &extra,
1069
+ UInt64 &unpackSize, UInt64 &packSize,
1070
+ CItem *cdItem)
1071
+ {
1072
+ extra.Clear();
1073
+
1074
+ while (extraSize >= 4)
1075
+ {
1076
+ CExtraSubBlock subBlock;
1077
+ const UInt32 pair = ReadUInt32();
1078
+ subBlock.ID = (pair & 0xFFFF);
1079
+ unsigned size = (unsigned)(pair >> 16);
1080
+ // const unsigned origSize = size;
1081
+
1082
+ extraSize -= 4;
1083
+
1084
+ if (size > extraSize)
1085
+ {
1086
+ // it's error in extra
1087
+ HeadersWarning = true;
1088
+ extra.Error = true;
1089
+ Skip(extraSize);
1090
+ return false;
1091
+ }
1092
+
1093
+ extraSize -= size;
1094
+
1095
+ if (subBlock.ID == NFileHeader::NExtraID::kZip64)
1096
+ {
1097
+ extra.IsZip64 = true;
1098
+ bool isOK = true;
1099
+
1100
+ if (!cdItem
1101
+ && size == 16
1102
+ && !ZIP64_IS_32_MAX(unpackSize)
1103
+ && !ZIP64_IS_32_MAX(packSize))
1104
+ {
1105
+ /* Win10 Explorer's "Send to Zip" for big (3500 MiB) files
1106
+ creates Zip64 Extra in local file header.
1107
+ But if both uncompressed and compressed sizes are smaller than 4 GiB,
1108
+ Win10 doesn't store 0xFFFFFFFF in 32-bit fields as expected by zip specification.
1109
+ 21.04: we ignore these minor errors in Win10 zip archives. */
1110
+ if (ReadUInt64() != unpackSize)
1111
+ isOK = false;
1112
+ if (ReadUInt64() != packSize)
1113
+ isOK = false;
1114
+ size = 0;
1115
+ }
1116
+ else
1117
+ {
1118
+ if (ZIP64_IS_32_MAX(unpackSize))
1119
+ { if (size < 8) isOK = false; else { size -= 8; unpackSize = ReadUInt64(); }}
1120
+
1121
+ if (isOK && ZIP64_IS_32_MAX(packSize))
1122
+ { if (size < 8) isOK = false; else { size -= 8; packSize = ReadUInt64(); }}
1123
+
1124
+ if (cdItem)
1125
+ {
1126
+ if (isOK)
1127
+ {
1128
+ if (ZIP64_IS_32_MAX(cdItem->LocalHeaderPos))
1129
+ { if (size < 8) isOK = false; else { size -= 8; cdItem->LocalHeaderPos = ReadUInt64(); }}
1130
+ /*
1131
+ else if (size == 8)
1132
+ {
1133
+ size -= 8;
1134
+ const UInt64 v = ReadUInt64();
1135
+ // soong_zip, an AOSP tool (written in the Go) writes incorrect value.
1136
+ // we can ignore that minor error here
1137
+ if (v != cdItem->LocalHeaderPos)
1138
+ isOK = false; // ignore error
1139
+ // isOK = false; // force error
1140
+ }
1141
+ */
1142
+ }
1143
+
1144
+ if (isOK && ZIP64_IS_16_MAX(cdItem->Disk))
1145
+ { if (size < 4) isOK = false; else { size -= 4; cdItem->Disk = ReadUInt32(); }}
1146
+ }
1147
+ }
1148
+
1149
+ // we can ignore errors, when some zip archiver still write all fields to zip64 extra in local header
1150
+ // if (&& (cdItem || !isOK || origSize != 8 * 3 + 4 || size != 8 * 1 + 4))
1151
+ if (!isOK || size != 0)
1152
+ {
1153
+ HeadersWarning = true;
1154
+ extra.Error = true;
1155
+ extra.IsZip64_Error = true;
1156
+ }
1157
+ Skip(size);
1158
+ }
1159
+ else
1160
+ {
1161
+ ReadBuffer(subBlock.Data, size);
1162
+ extra.SubBlocks.Add(subBlock);
1163
+ if (subBlock.ID == NFileHeader::NExtraID::kIzUnicodeName)
1164
+ {
1165
+ if (!subBlock.CheckIzUnicode(item.Name))
1166
+ extra.Error = true;
1167
+ }
1168
+ }
1169
+ }
1170
+
1171
+ if (extraSize != 0)
1172
+ {
1173
+ ExtraMinorError = true;
1174
+ extra.MinorError = true;
1175
+ // 7-Zip before 9.31 created incorrect WzAES Extra in folder's local headers.
1176
+ // so we don't return false, but just set warning flag
1177
+ // return false;
1178
+ Skip(extraSize);
1179
+ }
1180
+
1181
+ return true;
1182
+ }
1183
+
1184
+
1185
+ bool CInArchive::ReadLocalItem(CItemEx &item)
1186
+ {
1187
+ item.Disk = 0;
1188
+ if (IsMultiVol && Vols.StreamIndex >= 0)
1189
+ item.Disk = (UInt32)Vols.StreamIndex;
1190
+ const unsigned kPureHeaderSize = kLocalHeaderSize - 4;
1191
+ Byte p[kPureHeaderSize];
1192
+ SafeRead(p, kPureHeaderSize);
1193
+ {
1194
+ unsigned i;
1195
+ for (i = 0; i < kPureHeaderSize && p[i] == 0; i++);
1196
+ if (i == kPureHeaderSize)
1197
+ return false;
1198
+ }
1199
+
1200
+ item.ExtractVersion.Version = p[0];
1201
+ item.ExtractVersion.HostOS = p[1];
1202
+ G16(2, item.Flags);
1203
+ G16(4, item.Method);
1204
+ G32(6, item.Time);
1205
+ G32(10, item.Crc);
1206
+ G32(14, item.PackSize);
1207
+ G32(18, item.Size);
1208
+ const unsigned nameSize = Get16(p + 22);
1209
+ const unsigned extraSize = Get16(p + 24);
1210
+ bool isOkName = ReadFileName(nameSize, item.Name);
1211
+ item.LocalFullHeaderSize = kLocalHeaderSize + (UInt32)nameSize + extraSize;
1212
+ item.DescriptorWasRead = false;
1213
+
1214
+ /*
1215
+ if (item.IsDir())
1216
+ item.Size = 0; // check It
1217
+ */
1218
+
1219
+ if (extraSize > 0)
1220
+ {
1221
+ if (!ReadExtra(item, extraSize, item.LocalExtra, item.Size, item.PackSize, NULL))
1222
+ {
1223
+ /* Most of archives are OK for Extra. But there are some rare cases
1224
+ that have error. And if error in first item, it can't open archive.
1225
+ So we ignore that error */
1226
+ // return false;
1227
+ }
1228
+ }
1229
+
1230
+ if (!CheckDosTime(item.Time))
1231
+ {
1232
+ HeadersWarning = true;
1233
+ // return false;
1234
+ }
1235
+
1236
+ if (item.Name.Len() != nameSize)
1237
+ {
1238
+ // we support some "bad" zip archives that contain zeros after name
1239
+ if (!isOkName)
1240
+ return false;
1241
+ HeadersWarning = true;
1242
+ }
1243
+
1244
+ // return item.LocalFullHeaderSize <= ((UInt32)1 << 16);
1245
+ return true;
1246
+ }
1247
+
1248
+
1249
+ static bool FlagsAreSame(const CItem &i1, const CItem &i2_cd)
1250
+ {
1251
+ if (i1.Method != i2_cd.Method)
1252
+ return false;
1253
+
1254
+ UInt32 mask = i1.Flags ^ i2_cd.Flags;
1255
+ if (mask == 0)
1256
+ return true;
1257
+ switch (i1.Method)
1258
+ {
1259
+ case NFileHeader::NCompressionMethod::kDeflate:
1260
+ mask &= 0x7FF9;
1261
+ break;
1262
+ default:
1263
+ if (i1.Method <= NFileHeader::NCompressionMethod::kImplode)
1264
+ mask &= 0x7FFF;
1265
+ }
1266
+
1267
+ // we can ignore utf8 flag, if name is ascii, or if only cdItem has utf8 flag
1268
+ if (mask & NFileHeader::NFlags::kUtf8)
1269
+ if ((i1.Name.IsAscii() && i2_cd.Name.IsAscii())
1270
+ || (i2_cd.Flags & NFileHeader::NFlags::kUtf8))
1271
+ mask &= ~NFileHeader::NFlags::kUtf8;
1272
+
1273
+ // some bad archive in rare case can use descriptor without descriptor flag in Central Dir
1274
+ // if (i1.HasDescriptor())
1275
+ mask &= ~NFileHeader::NFlags::kDescriptorUsedMask;
1276
+
1277
+ return (mask == 0);
1278
+ }
1279
+
1280
+
1281
+ // #ifdef _WIN32
1282
+ static bool AreEqualPaths_IgnoreSlashes(const char *s1, const char *s2)
1283
+ {
1284
+ for (;;)
1285
+ {
1286
+ char c1 = *s1++;
1287
+ char c2 = *s2++;
1288
+ if (c1 == c2)
1289
+ {
1290
+ if (c1 == 0)
1291
+ return true;
1292
+ }
1293
+ else
1294
+ {
1295
+ if (c1 == '\\') c1 = '/';
1296
+ if (c2 == '\\') c2 = '/';
1297
+ if (c1 != c2)
1298
+ return false;
1299
+ }
1300
+ }
1301
+ }
1302
+ // #endif
1303
+
1304
+
1305
+ static bool AreItemsEqual(const CItemEx &localItem, const CItemEx &cdItem)
1306
+ {
1307
+ if (!FlagsAreSame(localItem, cdItem))
1308
+ return false;
1309
+ if (!localItem.HasDescriptor())
1310
+ {
1311
+ if (cdItem.PackSize != localItem.PackSize
1312
+ || cdItem.Size != localItem.Size
1313
+ || (cdItem.Crc != localItem.Crc && cdItem.Crc != 0)) // some program writes 0 to crc field in central directory
1314
+ return false;
1315
+ }
1316
+ /* pkzip 2.50 creates incorrect archives. It uses
1317
+ - WIN encoding for name in local header
1318
+ - OEM encoding for name in central header
1319
+ We don't support these strange items. */
1320
+
1321
+ /* if (cdItem.Name.Len() != localItem.Name.Len())
1322
+ return false;
1323
+ */
1324
+ if (cdItem.Name != localItem.Name)
1325
+ {
1326
+ // #ifdef _WIN32
1327
+ // some xap files use backslash in central dir items.
1328
+ // we can ignore such errors in windows, where all slashes are converted to backslashes
1329
+ unsigned hostOs = cdItem.GetHostOS();
1330
+
1331
+ if (hostOs == NFileHeader::NHostOS::kFAT ||
1332
+ hostOs == NFileHeader::NHostOS::kNTFS)
1333
+ {
1334
+ if (!AreEqualPaths_IgnoreSlashes(cdItem.Name, localItem.Name))
1335
+ {
1336
+ // pkzip 2.50 uses DOS encoding in central dir and WIN encoding in local header.
1337
+ // so we ignore that error
1338
+ if (hostOs != NFileHeader::NHostOS::kFAT
1339
+ || cdItem.MadeByVersion.Version < 25
1340
+ || cdItem.MadeByVersion.Version > 40)
1341
+ return false;
1342
+ }
1343
+ }
1344
+ /*
1345
+ else
1346
+ #endif
1347
+ return false;
1348
+ */
1349
+ }
1350
+ return true;
1351
+ }
1352
+
1353
+
1354
+ HRESULT CInArchive::Read_LocalItem_After_CdItem(CItemEx &item, bool &isAvail, bool &headersError)
1355
+ {
1356
+ isAvail = true;
1357
+ headersError = false;
1358
+ if (item.FromLocal)
1359
+ return S_OK;
1360
+ try
1361
+ {
1362
+ UInt64 offset = item.LocalHeaderPos;
1363
+
1364
+ if (IsMultiVol)
1365
+ {
1366
+ if (item.Disk >= Vols.Streams.Size())
1367
+ {
1368
+ isAvail = false;
1369
+ return S_FALSE;
1370
+ }
1371
+ Stream = Vols.Streams[item.Disk].Stream;
1372
+ Vols.StreamIndex = (int)item.Disk;
1373
+ if (!Stream)
1374
+ {
1375
+ isAvail = false;
1376
+ return S_FALSE;
1377
+ }
1378
+ }
1379
+ else
1380
+ {
1381
+ if (UseDisk_in_SingleVol && item.Disk != EcdVolIndex)
1382
+ {
1383
+ isAvail = false;
1384
+ return S_FALSE;
1385
+ }
1386
+ Stream = StreamRef;
1387
+
1388
+ offset = (UInt64)((Int64)offset + ArcInfo.Base);
1389
+ if (ArcInfo.Base < 0 && (Int64)offset < 0)
1390
+ {
1391
+ isAvail = false;
1392
+ return S_FALSE;
1393
+ }
1394
+ }
1395
+
1396
+ _inBufMode = false;
1397
+ RINOK(Seek_SavePos(offset))
1398
+ InitBuf();
1399
+ /*
1400
+ // we can use buf mode with small buffer to reduce
1401
+ // the number of Read() calls in ReadLocalItem()
1402
+ _inBufMode = true;
1403
+ Buffer.Alloc(1 << 10);
1404
+ if (!Buffer.IsAllocated())
1405
+ return E_OUTOFMEMORY;
1406
+ */
1407
+
1408
+ CItemEx localItem;
1409
+ if (ReadUInt32() != NSignature::kLocalFileHeader)
1410
+ return S_FALSE;
1411
+ ReadLocalItem(localItem);
1412
+ if (!AreItemsEqual(localItem, item))
1413
+ return S_FALSE;
1414
+ item.LocalFullHeaderSize = localItem.LocalFullHeaderSize;
1415
+ item.LocalExtra = localItem.LocalExtra;
1416
+ if (item.Crc != localItem.Crc && !localItem.HasDescriptor())
1417
+ {
1418
+ item.Crc = localItem.Crc;
1419
+ headersError = true;
1420
+ }
1421
+ if ((item.Flags ^ localItem.Flags) & NFileHeader::NFlags::kDescriptorUsedMask)
1422
+ {
1423
+ item.Flags = (UInt16)(item.Flags ^ NFileHeader::NFlags::kDescriptorUsedMask);
1424
+ headersError = true;
1425
+ }
1426
+ item.FromLocal = true;
1427
+ }
1428
+ catch(...) { return S_FALSE; }
1429
+ return S_OK;
1430
+ }
1431
+
1432
+
1433
+ /*
1434
+ ---------- FindDescriptor ----------
1435
+
1436
+ in:
1437
+ _streamPos : position in Stream
1438
+ Stream :
1439
+ Vols : if (IsMultiVol)
1440
+
1441
+ action:
1442
+ searches descriptor in input stream(s).
1443
+ sets
1444
+ item.DescriptorWasRead = true;
1445
+ item.Size
1446
+ item.PackSize
1447
+ item.Crc
1448
+ if descriptor was found
1449
+
1450
+ out:
1451
+ S_OK:
1452
+ if ( item.DescriptorWasRead) : if descriptor was found
1453
+ if (!item.DescriptorWasRead) : if descriptor was not found : unexpected end of stream(s)
1454
+
1455
+ S_FALSE: if no items or there is just one item with strange properies that doesn't look like real archive.
1456
+
1457
+ another error code: Callback error.
1458
+
1459
+ exceptions :
1460
+ CSystemException() : stream reading error
1461
+ */
1462
+
1463
+ HRESULT CInArchive::FindDescriptor(CItemEx &item, unsigned numFiles)
1464
+ {
1465
+ // const size_t kBufSize = (size_t)1 << 5; // don't increase it too much. It reads data look ahead.
1466
+
1467
+ // Buffer.Alloc(kBufSize);
1468
+ // Byte *buf = Buffer;
1469
+
1470
+ UInt64 packedSize = 0;
1471
+
1472
+ UInt64 progressPrev = _cnt;
1473
+
1474
+ for (;;)
1475
+ {
1476
+ /* appnote specification claims that we must use 64-bit descriptor, if there is zip64 extra.
1477
+ But some old third-party xps archives used 64-bit descriptor without zip64 extra. */
1478
+ // unsigned descriptorSize = kDataDescriptorSize64 + kNextSignatureSize;
1479
+
1480
+ // const unsigned kNextSignatureSize = 0; // we can disable check for next signatuire
1481
+ const unsigned kNextSignatureSize = 4; // we check also for signature for next File headear
1482
+
1483
+ const unsigned descriptorSize4 = item.GetDescriptorSize() + kNextSignatureSize;
1484
+
1485
+ if (descriptorSize4 > Buffer.Size()) return E_FAIL;
1486
+
1487
+ // size_t processedSize;
1488
+ CanStartNewVol = true;
1489
+ RINOK(LookAhead(descriptorSize4))
1490
+ const size_t avail = GetAvail();
1491
+
1492
+ if (avail < descriptorSize4)
1493
+ {
1494
+ // we write to packSize all these available bytes.
1495
+ // later it's simpler to work with such value than with 0
1496
+ // if (item.PackSize == 0)
1497
+ item.PackSize = packedSize + avail;
1498
+ if (item.Method == 0)
1499
+ item.Size = item.PackSize;
1500
+ SkipLookahed(avail);
1501
+ return S_OK;
1502
+ }
1503
+
1504
+ const Byte * const pStart = Buffer + _bufPos;
1505
+ const Byte * p = pStart;
1506
+ const Byte * const limit = pStart + (avail - descriptorSize4);
1507
+
1508
+ for (; p <= limit; p++)
1509
+ {
1510
+ // descriptor signature field is Info-ZIP's extension to pkware Zip specification.
1511
+ // New ZIP specification also allows descriptorSignature.
1512
+
1513
+ p = FindPK_4(p, limit + 1);
1514
+ if (p > limit)
1515
+ break;
1516
+
1517
+ /*
1518
+ if (*p != 0x50)
1519
+ continue;
1520
+ */
1521
+
1522
+ if (Get32(p) != NSignature::kDataDescriptor)
1523
+ continue;
1524
+
1525
+ // we check next signatuire after descriptor
1526
+ // maybe we need check only 2 bytes "PK" instead of 4 bytes, if some another type of header is possible after descriptor
1527
+ const UInt32 sig = Get32(p + descriptorSize4 - kNextSignatureSize);
1528
+ if ( sig != NSignature::kLocalFileHeader
1529
+ && sig != NSignature::kCentralFileHeader)
1530
+ continue;
1531
+
1532
+ const UInt64 packSizeCur = packedSize + (size_t)(p - pStart);
1533
+ if (descriptorSize4 == kDataDescriptorSize64 + kNextSignatureSize) // if (item.LocalExtra.IsZip64)
1534
+ {
1535
+ const UInt64 descriptorPackSize = Get64(p + 8);
1536
+ if (descriptorPackSize != packSizeCur)
1537
+ continue;
1538
+ item.Size = Get64(p + 16);
1539
+ }
1540
+ else
1541
+ {
1542
+ const UInt32 descriptorPackSize = Get32(p + 8);
1543
+ if (descriptorPackSize != (UInt32)packSizeCur)
1544
+ continue;
1545
+ item.Size = Get32(p + 12);
1546
+ // that item.Size can be truncated to 32-bit value here
1547
+ }
1548
+ // We write calculated 64-bit packSize, even if descriptor64 was not used
1549
+ item.PackSize = packSizeCur;
1550
+
1551
+ item.DescriptorWasRead = true;
1552
+ item.Crc = Get32(p + 4);
1553
+
1554
+ const size_t skip = (size_t)(p - pStart) + descriptorSize4 - kNextSignatureSize;
1555
+
1556
+ SkipLookahed(skip);
1557
+
1558
+ return S_OK;
1559
+ }
1560
+
1561
+ const size_t skip = (size_t)(p - pStart);
1562
+ SkipLookahed(skip);
1563
+
1564
+ packedSize += skip;
1565
+
1566
+ if (Callback)
1567
+ if (_cnt - progressPrev >= ((UInt32)1 << 22))
1568
+ {
1569
+ progressPrev = _cnt;
1570
+ const UInt64 numFiles64 = numFiles;
1571
+ RINOK(Callback->SetCompleted(&numFiles64, &_cnt))
1572
+ }
1573
+ }
1574
+ }
1575
+
1576
+
1577
+ HRESULT CInArchive::CheckDescriptor(const CItemEx &item)
1578
+ {
1579
+ if (!item.HasDescriptor())
1580
+ return S_OK;
1581
+
1582
+ // pkzip's version without descriptor signature is not supported
1583
+
1584
+ bool isFinished = false;
1585
+ RINOK(IncreaseRealPosition(item.PackSize, isFinished))
1586
+ if (isFinished)
1587
+ return S_FALSE;
1588
+
1589
+ /*
1590
+ if (!IsMultiVol)
1591
+ {
1592
+ RINOK(Seek_SavePos(ArcInfo.Base + item.GetDataPosition() + item.PackSize));
1593
+ }
1594
+ */
1595
+
1596
+ Byte buf[kDataDescriptorSize64];
1597
+ try
1598
+ {
1599
+ CanStartNewVol = true;
1600
+ SafeRead(buf, item.GetDescriptorSize());
1601
+ }
1602
+ catch (const CSystemException &e) { return e.ErrorCode; }
1603
+ // catch (const CUnexpectEnd &)
1604
+ catch(...)
1605
+ {
1606
+ return S_FALSE;
1607
+ }
1608
+ // RINOK(ReadStream_FALSE(Stream, buf, item.GetDescriptorSize()));
1609
+
1610
+ if (Get32(buf) != NSignature::kDataDescriptor)
1611
+ return S_FALSE;
1612
+ UInt32 crc = Get32(buf + 4);
1613
+ UInt64 packSize, unpackSize;
1614
+
1615
+ if (item.LocalExtra.IsZip64)
1616
+ {
1617
+ packSize = Get64(buf + 8);
1618
+ unpackSize = Get64(buf + 16);
1619
+ }
1620
+ else
1621
+ {
1622
+ packSize = Get32(buf + 8);
1623
+ unpackSize = Get32(buf + 12);
1624
+ }
1625
+
1626
+ if (crc != item.Crc || item.PackSize != packSize || item.Size != unpackSize)
1627
+ return S_FALSE;
1628
+ return S_OK;
1629
+ }
1630
+
1631
+
1632
+ HRESULT CInArchive::Read_LocalItem_After_CdItem_Full(CItemEx &item)
1633
+ {
1634
+ if (item.FromLocal)
1635
+ return S_OK;
1636
+ try
1637
+ {
1638
+ bool isAvail = true;
1639
+ bool headersError = false;
1640
+ RINOK(Read_LocalItem_After_CdItem(item, isAvail, headersError))
1641
+ if (headersError)
1642
+ return S_FALSE;
1643
+ if (item.HasDescriptor())
1644
+ return CheckDescriptor(item);
1645
+ }
1646
+ catch(...) { return S_FALSE; }
1647
+ return S_OK;
1648
+ }
1649
+
1650
+
1651
+ HRESULT CInArchive::ReadCdItem(CItemEx &item)
1652
+ {
1653
+ item.FromCentral = true;
1654
+ Byte p[kCentralHeaderSize - 4];
1655
+ SafeRead(p, kCentralHeaderSize - 4);
1656
+
1657
+ item.MadeByVersion.Version = p[0];
1658
+ item.MadeByVersion.HostOS = p[1];
1659
+ item.ExtractVersion.Version = p[2];
1660
+ item.ExtractVersion.HostOS = p[3];
1661
+ G16(4, item.Flags);
1662
+ G16(6, item.Method);
1663
+ G32(8, item.Time);
1664
+ G32(12, item.Crc);
1665
+ G32(16, item.PackSize);
1666
+ G32(20, item.Size);
1667
+ const unsigned nameSize = Get16(p + 24);
1668
+ const unsigned extraSize = Get16(p + 26);
1669
+ const unsigned commentSize = Get16(p + 28);
1670
+ G16(30, item.Disk);
1671
+ G16(32, item.InternalAttrib);
1672
+ G32(34, item.ExternalAttrib);
1673
+ G32(38, item.LocalHeaderPos);
1674
+ ReadFileName(nameSize, item.Name);
1675
+
1676
+ if (extraSize > 0)
1677
+ ReadExtra(item, extraSize, item.CentralExtra, item.Size, item.PackSize, &item);
1678
+
1679
+ // May be these strings must be deleted
1680
+ /*
1681
+ if (item.IsDir())
1682
+ item.Size = 0;
1683
+ */
1684
+
1685
+ ReadBuffer(item.Comment, commentSize);
1686
+ return S_OK;
1687
+ }
1688
+
1689
+
1690
+ /*
1691
+ TryEcd64()
1692
+ (_inBufMode == false) is expected here
1693
+ so TryEcd64() can't change the Buffer.
1694
+ if (Ecd64 is not covered by cached region),
1695
+ TryEcd64() can change cached region ranges (_bufCached, _bufPos) and _streamPos.
1696
+ */
1697
+
1698
+ HRESULT CInArchive::TryEcd64(UInt64 offset, CCdInfo &cdInfo)
1699
+ {
1700
+ if (offset >= ((UInt64)1 << 63))
1701
+ return S_FALSE;
1702
+ Byte buf[kEcd64_FullSize];
1703
+
1704
+ RINOK(SeekToVol(Vols.StreamIndex, offset))
1705
+ RINOK(ReadFromCache_FALSE(buf, kEcd64_FullSize))
1706
+
1707
+ if (Get32(buf) != NSignature::kEcd64)
1708
+ return S_FALSE;
1709
+ const UInt64 mainSize = Get64(buf + 4);
1710
+ if (mainSize < kEcd64_MainSize || mainSize > ((UInt64)1 << 40))
1711
+ return S_FALSE;
1712
+ cdInfo.ParseEcd64e(buf + 12);
1713
+ if (cdInfo.AreOverflowValues())
1714
+ return S_FALSE;
1715
+ return S_OK;
1716
+ }
1717
+
1718
+
1719
+ /* FindCd() doesn't use previous cached region,
1720
+ but it uses Buffer. So it sets new cached region */
1721
+
1722
+ HRESULT CInArchive::FindCd(bool checkOffsetMode)
1723
+ {
1724
+ // There are no useful data in cache in most cases here.
1725
+ // So here we don't use cache data from previous operations.
1726
+ InitBuf();
1727
+ UInt64 endPos;
1728
+ RINOK(InStream_GetSize_SeekToEnd(Stream, endPos))
1729
+ _streamPos = endPos;
1730
+ const size_t kBufSizeMax = (size_t)1 << 17; // must be larger than
1731
+ // (1 << 16) + kEcdSize + kEcd64Locator_Size + kEcd64_FullSize
1732
+ const size_t bufSize = (endPos < kBufSizeMax) ? (size_t)endPos : kBufSizeMax;
1733
+ if (bufSize < kEcdSize)
1734
+ return S_FALSE;
1735
+ RINOK(AllocateBuffer(kBufSizeMax))
1736
+ {
1737
+ RINOK(Seek_SavePos(endPos - bufSize))
1738
+ size_t processed = bufSize;
1739
+ const HRESULT res = ReadStream(Stream, Buffer, &processed);
1740
+ _streamPos += processed;
1741
+ _bufCached = processed;
1742
+ _bufPos = 0;
1743
+ _cnt += processed;
1744
+ if (res != S_OK)
1745
+ return res;
1746
+ if (processed != bufSize)
1747
+ return S_FALSE;
1748
+ }
1749
+
1750
+ CCdInfo &cdInfo = Vols.ecd;
1751
+
1752
+ for (size_t i = bufSize - kEcdSize + 1;;)
1753
+ {
1754
+ const Byte *buf = Buffer;
1755
+ {
1756
+ const Byte *p = buf + i;
1757
+ do
1758
+ if (p == buf)
1759
+ return S_FALSE;
1760
+ while (*(--p) != 0x50);
1761
+
1762
+ i = (size_t)(p - buf);
1763
+ if (Get32(p) != NSignature::kEcd)
1764
+ continue;
1765
+ cdInfo.ParseEcd32(p);
1766
+ }
1767
+
1768
+ if (i >= kEcd64Locator_Size)
1769
+ {
1770
+ const size_t locatorIndex = i - kEcd64Locator_Size;
1771
+ if (Get32(buf + locatorIndex) == NSignature::kEcd64Locator)
1772
+ {
1773
+ CLocator locator;
1774
+ locator.Parse(buf + locatorIndex + 4);
1775
+ UInt32 numDisks = locator.NumDisks;
1776
+ // we ignore the error, where some zip creators use (NumDisks == 0)
1777
+ if (numDisks == 0)
1778
+ numDisks = 1;
1779
+ if ((cdInfo.ThisDisk == numDisks - 1 || ZIP64_IS_16_MAX(cdInfo.ThisDisk))
1780
+ && locator.Ecd64Disk < numDisks
1781
+ && !locator.Is_Ecd64Offset_Overflow())
1782
+ {
1783
+ if (locator.Ecd64Disk != cdInfo.ThisDisk && !ZIP64_IS_16_MAX(cdInfo.ThisDisk))
1784
+ return E_NOTIMPL;
1785
+
1786
+ // Most of the zip64 use fixed size Zip64 ECD
1787
+ // we try relative backward reading.
1788
+ const UInt64 absEcd64 = endPos - bufSize + i - (kEcd64Locator_Size + kEcd64_FullSize);
1789
+
1790
+ if (locatorIndex >= kEcd64_FullSize)
1791
+ if (checkOffsetMode || absEcd64 == locator.Ecd64Offset)
1792
+ {
1793
+ const Byte *ecd64 = buf + locatorIndex - kEcd64_FullSize;
1794
+ if (Get32(ecd64) == NSignature::kEcd64 &&
1795
+ Get64(ecd64 + 4) == kEcd64_MainSize)
1796
+ {
1797
+ cdInfo.ParseEcd64e(ecd64 + 12);
1798
+ if (cdInfo.AreOverflowValues())
1799
+ return S_FALSE;
1800
+ ArcInfo.Base = (Int64)(absEcd64 - locator.Ecd64Offset);
1801
+ // ArcInfo.BaseVolIndex = cdInfo.ThisDisk;
1802
+ return S_OK;
1803
+ }
1804
+ }
1805
+
1806
+ // some zip64 use variable size Zip64 ECD.
1807
+ // we try to use absolute offset from locator.
1808
+ if (absEcd64 != locator.Ecd64Offset)
1809
+ {
1810
+ if (TryEcd64(locator.Ecd64Offset, cdInfo) == S_OK)
1811
+ {
1812
+ ArcInfo.Base = 0;
1813
+ // ArcInfo.BaseVolIndex = cdInfo.ThisDisk;
1814
+ return S_OK;
1815
+ }
1816
+ }
1817
+
1818
+ // for variable Zip64 ECD with for archives with offset != 0.
1819
+
1820
+ if (checkOffsetMode
1821
+ && ArcInfo.MarkerPos != 0
1822
+ && ArcInfo.MarkerPos + locator.Ecd64Offset != absEcd64)
1823
+ {
1824
+ if (TryEcd64(ArcInfo.MarkerPos + locator.Ecd64Offset, cdInfo) == S_OK)
1825
+ {
1826
+ ArcInfo.Base = (Int64)ArcInfo.MarkerPos;
1827
+ // ArcInfo.BaseVolIndex = cdInfo.ThisDisk;
1828
+ return S_OK;
1829
+ }
1830
+ }
1831
+ }
1832
+ }
1833
+ }
1834
+
1835
+ // bool isVolMode = (Vols.EndVolIndex != -1);
1836
+ // UInt32 searchDisk = (isVolMode ? Vols.EndVolIndex : 0);
1837
+
1838
+ if (/* searchDisk == thisDisk && */ cdInfo.CdDisk <= cdInfo.ThisDisk)
1839
+ {
1840
+ // if (isVolMode)
1841
+ {
1842
+ if (cdInfo.CdDisk != cdInfo.ThisDisk)
1843
+ return S_OK;
1844
+ }
1845
+
1846
+ UInt64 absEcdPos = endPos - bufSize + i;
1847
+ UInt64 cdEnd = cdInfo.Size + cdInfo.Offset;
1848
+ ArcInfo.Base = 0;
1849
+ // ArcInfo.BaseVolIndex = cdInfo.ThisDisk;
1850
+ if (absEcdPos != cdEnd)
1851
+ {
1852
+ /*
1853
+ if (cdInfo.Offset <= 16 && cdInfo.Size != 0)
1854
+ {
1855
+ // here we support some rare ZIP files with Central directory at the start
1856
+ ArcInfo.Base = 0;
1857
+ }
1858
+ else
1859
+ */
1860
+ ArcInfo.Base = (Int64)(absEcdPos - cdEnd);
1861
+ }
1862
+ return S_OK;
1863
+ }
1864
+ }
1865
+ }
1866
+
1867
+
1868
+ HRESULT CInArchive::TryReadCd(CObjectVector<CItemEx> &items, const CCdInfo &cdInfo, UInt64 cdOffset, UInt64 cdSize)
1869
+ {
1870
+ items.Clear();
1871
+ IsCdUnsorted = false;
1872
+
1873
+ if ((Int64)cdOffset < 0)
1874
+ return S_FALSE;
1875
+
1876
+ // _startLocalFromCd_Disk = (UInt32)(Int32)-1;
1877
+ // _startLocalFromCd_Offset = (UInt64)(Int64)-1;
1878
+
1879
+ RINOK(SeekToVol(IsMultiVol ? (int)cdInfo.CdDisk : -1, cdOffset))
1880
+
1881
+ _inBufMode = true;
1882
+ _cnt = 0;
1883
+
1884
+ if (Callback)
1885
+ {
1886
+ RINOK(Callback->SetTotal(&cdInfo.NumEntries, IsMultiVol ? &Vols.TotalBytesSize : NULL))
1887
+ }
1888
+ UInt64 numFileExpected = cdInfo.NumEntries;
1889
+ const UInt64 *totalFilesPtr = &numFileExpected;
1890
+ bool isCorrect_NumEntries = (cdInfo.IsFromEcd64 || numFileExpected >= ((UInt32)1 << 16));
1891
+
1892
+ while (_cnt < cdSize)
1893
+ {
1894
+ CanStartNewVol = true;
1895
+ if (ReadUInt32() != NSignature::kCentralFileHeader)
1896
+ return S_FALSE;
1897
+ CanStartNewVol = false;
1898
+ {
1899
+ CItemEx cdItem;
1900
+ RINOK(ReadCdItem(cdItem))
1901
+
1902
+ /*
1903
+ if (cdItem.Disk < _startLocalFromCd_Disk ||
1904
+ cdItem.Disk == _startLocalFromCd_Disk &&
1905
+ cdItem.LocalHeaderPos < _startLocalFromCd_Offset)
1906
+ {
1907
+ _startLocalFromCd_Disk = cdItem.Disk;
1908
+ _startLocalFromCd_Offset = cdItem.LocalHeaderPos;
1909
+ }
1910
+ */
1911
+
1912
+ if (items.Size() > 0 && !IsCdUnsorted)
1913
+ {
1914
+ const CItemEx &prev = items.Back();
1915
+ if (cdItem.Disk < prev.Disk
1916
+ || (cdItem.Disk == prev.Disk &&
1917
+ cdItem.LocalHeaderPos < prev.LocalHeaderPos))
1918
+ IsCdUnsorted = true;
1919
+ }
1920
+
1921
+ items.Add(cdItem);
1922
+ }
1923
+ if (Callback && (items.Size() & 0xFFF) == 0)
1924
+ {
1925
+ const UInt64 numFiles = items.Size();
1926
+
1927
+ if (numFiles > numFileExpected && totalFilesPtr)
1928
+ {
1929
+ if (isCorrect_NumEntries)
1930
+ totalFilesPtr = NULL;
1931
+ else
1932
+ while (numFiles > numFileExpected)
1933
+ numFileExpected += (UInt32)1 << 16;
1934
+ RINOK(Callback->SetTotal(totalFilesPtr, NULL))
1935
+ }
1936
+
1937
+ RINOK(Callback->SetCompleted(&numFiles, &_cnt))
1938
+ }
1939
+ }
1940
+
1941
+ CanStartNewVol = true;
1942
+
1943
+ return (_cnt == cdSize) ? S_OK : S_FALSE;
1944
+ }
1945
+
1946
+
1947
+ /*
1948
+ static int CompareCdItems(void *const *elem1, void *const *elem2, void *)
1949
+ {
1950
+ const CItemEx *i1 = *(const CItemEx **)elem1;
1951
+ const CItemEx *i2 = *(const CItemEx **)elem2;
1952
+
1953
+ if (i1->Disk < i2->Disk) return -1;
1954
+ if (i1->Disk > i2->Disk) return 1;
1955
+ if (i1->LocalHeaderPos < i2->LocalHeaderPos) return -1;
1956
+ if (i1->LocalHeaderPos > i2->LocalHeaderPos) return 1;
1957
+ if (i1 < i2) return -1;
1958
+ if (i1 > i2) return 1;
1959
+ return 0;
1960
+ }
1961
+ */
1962
+
1963
+ HRESULT CInArchive::ReadCd(CObjectVector<CItemEx> &items, UInt32 &cdDisk, UInt64 &cdOffset, UInt64 &cdSize)
1964
+ {
1965
+ bool checkOffsetMode = true;
1966
+
1967
+ if (IsMultiVol)
1968
+ {
1969
+ if (Vols.EndVolIndex == -1)
1970
+ return S_FALSE;
1971
+ Stream = Vols.Streams[(unsigned)Vols.EndVolIndex].Stream;
1972
+ if (!Vols.StartIsZip)
1973
+ checkOffsetMode = false;
1974
+ }
1975
+ else
1976
+ Stream = StartStream;
1977
+
1978
+ if (!Vols.ecd_wasRead)
1979
+ {
1980
+ RINOK(FindCd(checkOffsetMode))
1981
+ }
1982
+
1983
+ CCdInfo &cdInfo = Vols.ecd;
1984
+
1985
+ HRESULT res = S_FALSE;
1986
+
1987
+ cdSize = cdInfo.Size;
1988
+ cdOffset = cdInfo.Offset;
1989
+ cdDisk = cdInfo.CdDisk;
1990
+
1991
+ if (!IsMultiVol)
1992
+ {
1993
+ if (cdInfo.ThisDisk != cdInfo.CdDisk)
1994
+ return S_FALSE;
1995
+ }
1996
+
1997
+ const UInt64 base = (IsMultiVol ? 0 : (UInt64)ArcInfo.Base);
1998
+ res = TryReadCd(items, cdInfo, base + cdOffset, cdSize);
1999
+
2000
+ if (res == S_FALSE && !IsMultiVol && base != ArcInfo.MarkerPos)
2001
+ {
2002
+ // do we need that additional attempt to read cd?
2003
+ res = TryReadCd(items, cdInfo, ArcInfo.MarkerPos + cdOffset, cdSize);
2004
+ if (res == S_OK)
2005
+ ArcInfo.Base = (Int64)ArcInfo.MarkerPos;
2006
+ }
2007
+
2008
+ // Some rare case files are unsorted
2009
+ // items.Sort(CompareCdItems, NULL);
2010
+ return res;
2011
+ }
2012
+
2013
+
2014
+ static int FindItem(const CObjectVector<CItemEx> &items, const CItemEx &item)
2015
+ {
2016
+ unsigned left = 0, right = items.Size();
2017
+ for (;;)
2018
+ {
2019
+ if (left >= right)
2020
+ return -1;
2021
+ const unsigned index = (unsigned)(((size_t)left + (size_t)right) / 2);
2022
+ const CItemEx &item2 = items[index];
2023
+ if (item.Disk < item2.Disk)
2024
+ right = index;
2025
+ else if (item.Disk > item2.Disk)
2026
+ left = index + 1;
2027
+ else if (item.LocalHeaderPos == item2.LocalHeaderPos)
2028
+ return (int)index;
2029
+ else if (item.LocalHeaderPos < item2.LocalHeaderPos)
2030
+ right = index;
2031
+ else
2032
+ left = index + 1;
2033
+ }
2034
+ }
2035
+
2036
+ static bool IsStrangeItem(const CItem &item)
2037
+ {
2038
+ return item.Name.Len() > (1 << 14) || item.Method > (1 << 8);
2039
+ }
2040
+
2041
+
2042
+
2043
+ /*
2044
+ ---------- ReadLocals ----------
2045
+
2046
+ in:
2047
+ (_signature == NSignature::kLocalFileHeader)
2048
+ VirtStreamPos : after _signature : position in Stream
2049
+ Stream :
2050
+ Vols : if (IsMultiVol)
2051
+ (_inBufMode == false)
2052
+
2053
+ action:
2054
+ it parses local items.
2055
+
2056
+ if ( IsMultiVol) it writes absolute offsets to CItemEx::LocalHeaderPos
2057
+ if (!IsMultiVol) it writes relative (from ArcInfo.Base) offsets to CItemEx::LocalHeaderPos
2058
+ later we can correct CItemEx::LocalHeaderPos values, if
2059
+ some new value for ArcInfo.Base will be detected
2060
+ out:
2061
+ S_OK:
2062
+ (_signature != NSignature::kLocalFileHeade)
2063
+ _streamPos : after _signature
2064
+
2065
+ S_FALSE: if no items or there is just one item with strange properies that doesn't look like real archive.
2066
+
2067
+ another error code: stream reading error or Callback error.
2068
+
2069
+ CUnexpectEnd() exception : it's not fatal exception here.
2070
+ It means that reading was interrupted by unexpected end of input stream,
2071
+ but some CItemEx items were parsed OK.
2072
+ We can stop further archive parsing.
2073
+ But we can use all filled CItemEx items.
2074
+ */
2075
+
2076
+ HRESULT CInArchive::ReadLocals(CObjectVector<CItemEx> &items)
2077
+ {
2078
+ items.Clear();
2079
+
2080
+ UInt64 progressPrev = _cnt;
2081
+
2082
+ if (Callback)
2083
+ {
2084
+ RINOK(Callback->SetTotal(NULL, IsMultiVol ? &Vols.TotalBytesSize : NULL))
2085
+ }
2086
+
2087
+ while (_signature == NSignature::kLocalFileHeader)
2088
+ {
2089
+ CItemEx item;
2090
+
2091
+ item.LocalHeaderPos = GetVirtStreamPos() - 4;
2092
+ if (!IsMultiVol)
2093
+ item.LocalHeaderPos = (UInt64)((Int64)item.LocalHeaderPos - ArcInfo.Base);
2094
+
2095
+ try
2096
+ {
2097
+ ReadLocalItem(item);
2098
+ item.FromLocal = true;
2099
+ bool isFinished = false;
2100
+
2101
+ if (item.HasDescriptor())
2102
+ {
2103
+ RINOK(FindDescriptor(item, items.Size()))
2104
+ isFinished = !item.DescriptorWasRead;
2105
+ }
2106
+ else
2107
+ {
2108
+ if (item.PackSize >= ((UInt64)1 << 62))
2109
+ throw CUnexpectEnd();
2110
+ RINOK(IncreaseRealPosition(item.PackSize, isFinished))
2111
+ }
2112
+
2113
+ items.Add(item);
2114
+
2115
+ if (isFinished)
2116
+ throw CUnexpectEnd();
2117
+
2118
+ ReadSignature();
2119
+ }
2120
+ catch (CUnexpectEnd &)
2121
+ {
2122
+ if (items.IsEmpty() || (items.Size() == 1 && IsStrangeItem(items[0])))
2123
+ return S_FALSE;
2124
+ throw;
2125
+ }
2126
+
2127
+
2128
+ if (Callback)
2129
+ if ((items.Size() & 0xFF) == 0
2130
+ || _cnt - progressPrev >= ((UInt32)1 << 22))
2131
+ {
2132
+ progressPrev = _cnt;
2133
+ const UInt64 numFiles = items.Size();
2134
+ RINOK(Callback->SetCompleted(&numFiles, &_cnt))
2135
+ }
2136
+ }
2137
+
2138
+ if (items.Size() == 1 && _signature != NSignature::kCentralFileHeader)
2139
+ if (IsStrangeItem(items[0]))
2140
+ return S_FALSE;
2141
+
2142
+ return S_OK;
2143
+ }
2144
+
2145
+
2146
+
2147
+ HRESULT CVols::ParseArcName(IArchiveOpenVolumeCallback *volCallback)
2148
+ {
2149
+ UString name;
2150
+ {
2151
+ NWindows::NCOM::CPropVariant prop;
2152
+ RINOK(volCallback->GetProperty(kpidName, &prop))
2153
+ if (prop.vt != VT_BSTR)
2154
+ return S_OK;
2155
+ name = prop.bstrVal;
2156
+ }
2157
+
2158
+ const int dotPos = name.ReverseFind_Dot();
2159
+ if (dotPos < 0)
2160
+ return S_OK;
2161
+ const UString ext = name.Ptr((unsigned)(dotPos + 1));
2162
+ name.DeleteFrom((unsigned)(dotPos + 1));
2163
+
2164
+ StartVolIndex = (Int32)(-1);
2165
+
2166
+ if (ext.IsEmpty())
2167
+ return S_OK;
2168
+ {
2169
+ wchar_t c = ext[0];
2170
+ IsUpperCase = (c >= 'A' && c <= 'Z');
2171
+ if (ext.IsEqualTo_Ascii_NoCase("zip"))
2172
+ {
2173
+ BaseName = name;
2174
+ StartIsZ = true;
2175
+ StartIsZip = true;
2176
+ return S_OK;
2177
+ }
2178
+ else if (ext.IsEqualTo_Ascii_NoCase("exe"))
2179
+ {
2180
+ /* possible cases:
2181
+ - exe with zip inside
2182
+ - sfx: a.exe, a.z02, a.z03,... , a.zip
2183
+ a.exe is start volume.
2184
+ - zip renamed to exe
2185
+ */
2186
+
2187
+ StartIsExe = true;
2188
+ BaseName = name;
2189
+ StartVolIndex = 0;
2190
+ /* sfx-zip can use both arc.exe and arc.zip
2191
+ We can open arc.zip, if it was requesed to open arc.exe.
2192
+ But it's possible that arc.exe and arc.zip are not parts of same archive.
2193
+ So we can disable such operation */
2194
+
2195
+ // 18.04: we still want to open zip renamed to exe.
2196
+ /*
2197
+ {
2198
+ UString volName = name;
2199
+ volName += IsUpperCase ? "Z01" : "z01";
2200
+ {
2201
+ CMyComPtr<IInStream> stream;
2202
+ HRESULT res2 = volCallback->GetStream(volName, &stream);
2203
+ if (res2 == S_OK)
2204
+ DisableVolsSearch = true;
2205
+ }
2206
+ }
2207
+ */
2208
+ DisableVolsSearch = true;
2209
+ return S_OK;
2210
+ }
2211
+ else if (ext[0] == 'z' || ext[0] == 'Z')
2212
+ {
2213
+ if (ext.Len() < 3)
2214
+ return S_OK;
2215
+ const wchar_t *end = NULL;
2216
+ UInt32 volNum = ConvertStringToUInt32(ext.Ptr(1), &end);
2217
+ if (*end != 0 || volNum < 1 || volNum > ((UInt32)1 << 30))
2218
+ return S_OK;
2219
+ StartVolIndex = (Int32)(volNum - 1);
2220
+ BaseName = name;
2221
+ StartIsZ = true;
2222
+ }
2223
+ else
2224
+ return S_OK;
2225
+ }
2226
+
2227
+ UString volName = BaseName;
2228
+ volName += (IsUpperCase ? "ZIP" : "zip");
2229
+
2230
+ HRESULT res = volCallback->GetStream(volName, &ZipStream);
2231
+
2232
+ if (res == S_FALSE || !ZipStream)
2233
+ {
2234
+ if (MissingName.IsEmpty())
2235
+ {
2236
+ MissingZip = true;
2237
+ MissingName = volName;
2238
+ }
2239
+ return S_OK;
2240
+ }
2241
+
2242
+ return res;
2243
+ }
2244
+
2245
+
2246
+ HRESULT CInArchive::ReadVols2(IArchiveOpenVolumeCallback *volCallback,
2247
+ unsigned start, int lastDisk, int zipDisk, unsigned numMissingVolsMax, unsigned &numMissingVols)
2248
+ {
2249
+ if (Vols.DisableVolsSearch)
2250
+ return S_OK;
2251
+
2252
+ numMissingVols = 0;
2253
+
2254
+ for (unsigned i = start;; i++)
2255
+ {
2256
+ if (lastDisk >= 0 && i >= (unsigned)lastDisk)
2257
+ break;
2258
+
2259
+ if (i < Vols.Streams.Size())
2260
+ if (Vols.Streams[i].Stream)
2261
+ continue;
2262
+
2263
+ CMyComPtr<IInStream> stream;
2264
+
2265
+ if ((int)i == zipDisk)
2266
+ {
2267
+ stream = Vols.ZipStream;
2268
+ }
2269
+ else if ((int)i == Vols.StartVolIndex)
2270
+ {
2271
+ stream = StartStream;
2272
+ }
2273
+ else
2274
+ {
2275
+ UString volName = Vols.BaseName;
2276
+ {
2277
+ volName.Add_Char(Vols.IsUpperCase ? 'Z' : 'z');
2278
+ const unsigned v = i + 1;
2279
+ if (v < 10)
2280
+ volName.Add_Char('0');
2281
+ volName.Add_UInt32(v);
2282
+ }
2283
+
2284
+ HRESULT res = volCallback->GetStream(volName, &stream);
2285
+ if (res != S_OK && res != S_FALSE)
2286
+ return res;
2287
+ if (res == S_FALSE || !stream)
2288
+ {
2289
+ if (i == 0)
2290
+ {
2291
+ UString volName_exe = Vols.BaseName;
2292
+ volName_exe += (Vols.IsUpperCase ? "EXE" : "exe");
2293
+
2294
+ HRESULT res2 = volCallback->GetStream(volName_exe, &stream);
2295
+ if (res2 != S_OK && res2 != S_FALSE)
2296
+ return res2;
2297
+ res = res2;
2298
+ }
2299
+ }
2300
+ if (res == S_FALSE || !stream)
2301
+ {
2302
+ if (i == 1 && Vols.StartIsExe)
2303
+ return S_OK;
2304
+ if (Vols.MissingName.IsEmpty())
2305
+ Vols.MissingName = volName;
2306
+ numMissingVols++;
2307
+ if (numMissingVols > numMissingVolsMax)
2308
+ return S_OK;
2309
+ if (lastDisk == -1 && numMissingVols != 0)
2310
+ return S_OK;
2311
+ continue;
2312
+ }
2313
+ }
2314
+
2315
+ UInt64 pos, size;
2316
+ RINOK(InStream_GetPos_GetSize(stream, pos, size))
2317
+
2318
+ while (i >= Vols.Streams.Size())
2319
+ Vols.Streams.AddNew();
2320
+
2321
+ CVols::CSubStreamInfo &ss = Vols.Streams[i];
2322
+ Vols.NumVols++;
2323
+ Vols.TotalBytesSize += size;
2324
+
2325
+ ss.Stream = stream;
2326
+ ss.Size = size;
2327
+
2328
+ if ((int)i == zipDisk)
2329
+ {
2330
+ Vols.EndVolIndex = (int)(Vols.Streams.Size() - 1);
2331
+ break;
2332
+ }
2333
+ }
2334
+
2335
+ return S_OK;
2336
+ }
2337
+
2338
+
2339
+ HRESULT CInArchive::ReadVols()
2340
+ {
2341
+ CMyComPtr<IArchiveOpenVolumeCallback> volCallback;
2342
+
2343
+ Callback->QueryInterface(IID_IArchiveOpenVolumeCallback, (void **)&volCallback);
2344
+ if (!volCallback)
2345
+ return S_OK;
2346
+
2347
+ RINOK(Vols.ParseArcName(volCallback))
2348
+
2349
+ // const int startZIndex = Vols.StartVolIndex;
2350
+
2351
+ if (!Vols.StartIsZ)
2352
+ {
2353
+ if (!Vols.StartIsExe)
2354
+ return S_OK;
2355
+ }
2356
+
2357
+ int zipDisk = -1;
2358
+ int cdDisk = -1;
2359
+
2360
+ if (Vols.StartIsZip)
2361
+ Vols.ZipStream = StartStream;
2362
+
2363
+ if (Vols.ZipStream)
2364
+ {
2365
+ Stream = Vols.ZipStream;
2366
+
2367
+ if (Vols.StartIsZip)
2368
+ Vols.StreamIndex = -1;
2369
+ else
2370
+ {
2371
+ Vols.StreamIndex = -2;
2372
+ InitBuf();
2373
+ }
2374
+
2375
+ HRESULT res = FindCd(true);
2376
+
2377
+ CCdInfo &ecd = Vols.ecd;
2378
+ if (res == S_OK)
2379
+ {
2380
+ zipDisk = (int)ecd.ThisDisk;
2381
+ Vols.ecd_wasRead = true;
2382
+
2383
+ // if is not multivol or bad multivol, we return to main single stream code
2384
+ if (ecd.ThisDisk == 0
2385
+ || ecd.ThisDisk >= ((UInt32)1 << 30)
2386
+ || ecd.ThisDisk < ecd.CdDisk)
2387
+ return S_OK;
2388
+
2389
+ cdDisk = (int)ecd.CdDisk;
2390
+ if (Vols.StartVolIndex < 0)
2391
+ Vols.StartVolIndex = (Int32)ecd.ThisDisk;
2392
+ else if ((UInt32)Vols.StartVolIndex >= ecd.ThisDisk)
2393
+ return S_OK;
2394
+
2395
+ // Vols.StartVolIndex = ecd.ThisDisk;
2396
+ // Vols.EndVolIndex = ecd.ThisDisk;
2397
+ unsigned numMissingVols;
2398
+ if (cdDisk != zipDisk)
2399
+ {
2400
+ // get volumes required for cd.
2401
+ RINOK(ReadVols2(volCallback, (unsigned)cdDisk, zipDisk, zipDisk, 0, numMissingVols))
2402
+ // if (numMissingVols) cdOK = false;
2403
+ }
2404
+ }
2405
+ else if (res != S_FALSE)
2406
+ return res;
2407
+ }
2408
+
2409
+ if (Vols.StartVolIndex < 0)
2410
+ {
2411
+ // is not mutivol;
2412
+ return S_OK;
2413
+ }
2414
+
2415
+ /*
2416
+ if (!Vols.Streams.IsEmpty())
2417
+ IsMultiVol = true;
2418
+ */
2419
+
2420
+ unsigned numMissingVols;
2421
+
2422
+ if (cdDisk != 0)
2423
+ {
2424
+ // get volumes that were no requested still
2425
+ const unsigned kNumMissingVolsMax = 1 << 12;
2426
+ RINOK(ReadVols2(volCallback, 0, cdDisk < 0 ? -1 : cdDisk, zipDisk, kNumMissingVolsMax, numMissingVols))
2427
+ }
2428
+
2429
+ // if (Vols.StartVolIndex >= 0)
2430
+ {
2431
+ if (Vols.Streams.IsEmpty())
2432
+ if (Vols.StartVolIndex > (1 << 20))
2433
+ return S_OK;
2434
+ if ((unsigned)Vols.StartVolIndex >= Vols.Streams.Size()
2435
+ || !Vols.Streams[(unsigned)Vols.StartVolIndex].Stream)
2436
+ {
2437
+ // we get volumes starting from StartVolIndex, if they we not requested before know the volume index (if FindCd() was ok)
2438
+ RINOK(ReadVols2(volCallback, (unsigned)Vols.StartVolIndex, zipDisk, zipDisk, 0, numMissingVols))
2439
+ }
2440
+ }
2441
+
2442
+ if (Vols.ZipStream)
2443
+ {
2444
+ // if there is no another volumes and volumeIndex is too big, we don't use multivol mode
2445
+ if (Vols.Streams.IsEmpty())
2446
+ if (zipDisk > (1 << 10))
2447
+ return S_OK;
2448
+ if (zipDisk >= 0)
2449
+ {
2450
+ // we create item in Streams for ZipStream, if we know the volume index (if FindCd() was ok)
2451
+ RINOK(ReadVols2(volCallback, (unsigned)zipDisk, zipDisk + 1, zipDisk, 0, numMissingVols))
2452
+ }
2453
+ }
2454
+
2455
+ if (!Vols.Streams.IsEmpty())
2456
+ {
2457
+ IsMultiVol = true;
2458
+ /*
2459
+ if (cdDisk)
2460
+ IsMultiVol = true;
2461
+ */
2462
+ const int startZIndex = Vols.StartVolIndex;
2463
+ if (startZIndex >= 0)
2464
+ {
2465
+ // if all volumes before start volume are OK, we can start parsing from 0
2466
+ // if there are missing volumes before startZIndex, we start parsing in current startZIndex
2467
+ if ((unsigned)startZIndex < Vols.Streams.Size())
2468
+ {
2469
+ for (unsigned i = 0; i <= (unsigned)startZIndex; i++)
2470
+ if (!Vols.Streams[i].Stream)
2471
+ {
2472
+ Vols.StartParsingVol = startZIndex;
2473
+ break;
2474
+ }
2475
+ }
2476
+ }
2477
+ }
2478
+
2479
+ return S_OK;
2480
+ }
2481
+
2482
+
2483
+
2484
+ HRESULT CVols::Read(void *data, UInt32 size, UInt32 *processedSize)
2485
+ {
2486
+ if (processedSize)
2487
+ *processedSize = 0;
2488
+ if (size == 0)
2489
+ return S_OK;
2490
+
2491
+ for (;;)
2492
+ {
2493
+ if (StreamIndex < 0)
2494
+ return S_OK;
2495
+ if ((unsigned)StreamIndex >= Streams.Size())
2496
+ return S_OK;
2497
+ const CVols::CSubStreamInfo &s = Streams[(unsigned)StreamIndex];
2498
+ if (!s.Stream)
2499
+ return S_FALSE;
2500
+ if (NeedSeek)
2501
+ {
2502
+ RINOK(s.SeekToStart())
2503
+ NeedSeek = false;
2504
+ }
2505
+ UInt32 realProcessedSize = 0;
2506
+ HRESULT res = s.Stream->Read(data, size, &realProcessedSize);
2507
+ if (processedSize)
2508
+ *processedSize = realProcessedSize;
2509
+ if (res != S_OK)
2510
+ return res;
2511
+ if (realProcessedSize != 0)
2512
+ return res;
2513
+ StreamIndex++;
2514
+ NeedSeek = true;
2515
+ }
2516
+ }
2517
+
2518
+ Z7_COM7F_IMF(CVolStream::Read(void *data, UInt32 size, UInt32 *processedSize))
2519
+ {
2520
+ return Vols->Read(data, size, processedSize);
2521
+ }
2522
+
2523
+
2524
+
2525
+
2526
+ #define COPY_ECD_ITEM_16(n) if (!isZip64 || !ZIP64_IS_16_MAX(ecd. n)) cdInfo. n = ecd. n;
2527
+ #define COPY_ECD_ITEM_32(n) if (!isZip64 || !ZIP64_IS_32_MAX(ecd. n)) cdInfo. n = ecd. n;
2528
+
2529
+
2530
+ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items)
2531
+ {
2532
+ // buffer that can be used for cd reading
2533
+ RINOK(AllocateBuffer(kSeqBufferSize))
2534
+
2535
+ // here we can read small records. So we switch off _inBufMode.
2536
+ _inBufMode = false;
2537
+
2538
+ HRESULT res = S_OK;
2539
+
2540
+ bool localsWereRead = false;
2541
+
2542
+ /* we try to open archive with the following modes:
2543
+ 1) CD-MODE : fast mode : we read backward ECD and CD, compare CD items with first Local item.
2544
+ 2) LOCALS-CD-MODE : slow mode, if CD-MODE fails : we sequentially read all Locals and then CD.
2545
+ Then we read sequentially ECD64, Locator, ECD again at the end.
2546
+
2547
+ - in LOCALS-CD-MODE we use use the following
2548
+ variables (with real cd properties) to set Base archive offset
2549
+ and check real cd properties with values from ECD/ECD64.
2550
+ */
2551
+
2552
+ UInt64 cdSize = 0;
2553
+ UInt64 cdRelatOffset = 0;
2554
+ UInt32 cdDisk = 0;
2555
+
2556
+ UInt64 cdAbsOffset = 0; // absolute cd offset, for LOCALS-CD-MODE only.
2557
+
2558
+ if (Force_ReadLocals_Mode)
2559
+ {
2560
+ IsArc = true;
2561
+ res = S_FALSE; // we will use LOCALS-CD-MODE mode
2562
+ }
2563
+ else
2564
+ {
2565
+ if (!MarkerIsFound || !MarkerIsSafe)
2566
+ {
2567
+ IsArc = true;
2568
+ res = ReadCd(items, cdDisk, cdRelatOffset, cdSize);
2569
+ if (res == S_OK)
2570
+ ReadSignature();
2571
+ else if (res != S_FALSE)
2572
+ return res;
2573
+ }
2574
+ else // (MarkerIsFound && MarkerIsSafe)
2575
+ {
2576
+
2577
+ // _signature must be kLocalFileHeader or kEcd or kEcd64
2578
+
2579
+ SeekToVol(ArcInfo.MarkerVolIndex, ArcInfo.MarkerPos2 + 4);
2580
+
2581
+ CanStartNewVol = false;
2582
+
2583
+ if (_signature == NSignature::kEcd64)
2584
+ {
2585
+ // UInt64 ecd64Offset = GetVirtStreamPos() - 4;
2586
+ IsZip64 = true;
2587
+ {
2588
+ const UInt64 recordSize = ReadUInt64();
2589
+ if (recordSize < kEcd64_MainSize
2590
+ || recordSize >= ((UInt64)1 << 62))
2591
+ return S_FALSE;
2592
+ {
2593
+ Byte buf[kEcd64_MainSize];
2594
+ SafeRead(buf, kEcd64_MainSize);
2595
+ CCdInfo cdInfo;
2596
+ cdInfo.ParseEcd64e(buf);
2597
+ if (!cdInfo.IsEmptyArc())
2598
+ return S_FALSE;
2599
+ }
2600
+ RINOK(Skip64(recordSize - kEcd64_MainSize, 0))
2601
+ }
2602
+
2603
+ ReadSignature();
2604
+ if (_signature != NSignature::kEcd64Locator)
2605
+ return S_FALSE;
2606
+ {
2607
+ const unsigned kBufSize = kEcd64Locator_Size - 4;
2608
+ Byte buf[kBufSize];
2609
+ SafeRead(buf, kBufSize);
2610
+ CLocator locator;
2611
+ locator.Parse(buf);
2612
+ if (!locator.IsEmptyArc())
2613
+ return S_FALSE;
2614
+ }
2615
+
2616
+ ReadSignature();
2617
+ if (_signature != NSignature::kEcd)
2618
+ return S_FALSE;
2619
+ }
2620
+
2621
+ if (_signature == NSignature::kEcd)
2622
+ {
2623
+ // It must be empty archive or backware archive
2624
+ // we don't support backware archive still
2625
+
2626
+ const unsigned kBufSize = kEcdSize - 4;
2627
+ Byte buf[kBufSize];
2628
+ SafeRead(buf, kBufSize);
2629
+ CEcd ecd;
2630
+ ecd.Parse(buf);
2631
+ // if (ecd.cdSize != 0)
2632
+ // Do we need also to support the case where empty zip archive with PK00 uses cdOffset = 4 ??
2633
+ if (!ecd.IsEmptyArc())
2634
+ return S_FALSE;
2635
+
2636
+ ArcInfo.Base = (Int64)ArcInfo.MarkerPos;
2637
+ IsArc = true; // check it: we need more tests?
2638
+
2639
+ RINOK(SeekToVol(ArcInfo.MarkerVolIndex, ArcInfo.MarkerPos2))
2640
+ ReadSignature();
2641
+ }
2642
+ else
2643
+ {
2644
+ CItemEx firstItem;
2645
+ try
2646
+ {
2647
+ try
2648
+ {
2649
+ if (!ReadLocalItem(firstItem))
2650
+ return S_FALSE;
2651
+ }
2652
+ catch(CUnexpectEnd &)
2653
+ {
2654
+ return S_FALSE;
2655
+ }
2656
+
2657
+ IsArc = true;
2658
+ res = ReadCd(items, cdDisk, cdRelatOffset, cdSize);
2659
+ if (res == S_OK)
2660
+ ReadSignature();
2661
+ }
2662
+ catch(CUnexpectEnd &) { res = S_FALSE; }
2663
+
2664
+ if (res != S_FALSE && res != S_OK)
2665
+ return res;
2666
+
2667
+ if (res == S_OK && items.Size() == 0)
2668
+ res = S_FALSE;
2669
+
2670
+ if (res == S_OK)
2671
+ {
2672
+ // we can't read local items here to keep _inBufMode state
2673
+ if ((Int64)ArcInfo.MarkerPos2 < ArcInfo.Base)
2674
+ res = S_FALSE;
2675
+ else
2676
+ {
2677
+ firstItem.LocalHeaderPos = (UInt64)((Int64)ArcInfo.MarkerPos2 - ArcInfo.Base);
2678
+ int index = -1;
2679
+
2680
+ UInt32 min_Disk = (UInt32)(Int32)-1;
2681
+ UInt64 min_LocalHeaderPos = (UInt64)(Int64)-1;
2682
+
2683
+ if (!IsCdUnsorted)
2684
+ index = FindItem(items, firstItem);
2685
+ else
2686
+ {
2687
+ FOR_VECTOR (i, items)
2688
+ {
2689
+ const CItemEx &cdItem = items[i];
2690
+ if (cdItem.Disk == firstItem.Disk
2691
+ && (cdItem.LocalHeaderPos == firstItem.LocalHeaderPos))
2692
+ index = (int)i;
2693
+
2694
+ if (i == 0
2695
+ || cdItem.Disk < min_Disk
2696
+ || (cdItem.Disk == min_Disk && cdItem.LocalHeaderPos < min_LocalHeaderPos))
2697
+ {
2698
+ min_Disk = cdItem.Disk;
2699
+ min_LocalHeaderPos = cdItem.LocalHeaderPos;
2700
+ }
2701
+ }
2702
+ }
2703
+
2704
+ if (index == -1)
2705
+ res = S_FALSE;
2706
+ else if (!AreItemsEqual(firstItem, items[(unsigned)index]))
2707
+ res = S_FALSE;
2708
+ else
2709
+ {
2710
+ ArcInfo.CdWasRead = true;
2711
+ if (IsCdUnsorted)
2712
+ ArcInfo.FirstItemRelatOffset = min_LocalHeaderPos;
2713
+ else
2714
+ ArcInfo.FirstItemRelatOffset = items[0].LocalHeaderPos;
2715
+
2716
+ // ArcInfo.FirstItemRelatOffset = _startLocalFromCd_Offset;
2717
+ }
2718
+ }
2719
+ }
2720
+ }
2721
+ } // (MarkerIsFound && MarkerIsSafe)
2722
+
2723
+ } // (!onlyLocalsMode)
2724
+
2725
+
2726
+ CObjectVector<CItemEx> cdItems;
2727
+
2728
+ bool needSetBase = false; // we set needSetBase only for LOCALS_CD_MODE
2729
+ unsigned numCdItems = items.Size();
2730
+
2731
+ #ifdef ZIP_SELF_CHECK
2732
+ res = S_FALSE; // if uncommented, it uses additional LOCALS-CD-MODE mode to check the code
2733
+ #endif
2734
+
2735
+ if (res != S_OK)
2736
+ {
2737
+ // ---------- LOCALS-CD-MODE ----------
2738
+ // CD doesn't match firstItem,
2739
+ // so we clear items and read Locals and CD.
2740
+
2741
+ items.Clear();
2742
+ localsWereRead = true;
2743
+
2744
+ HeadersError = false;
2745
+ HeadersWarning = false;
2746
+ ExtraMinorError = false;
2747
+
2748
+ /* we can use any mode: with buffer and without buffer
2749
+ without buffer : skips packed data : fast for big files : slow for small files
2750
+ with buffer : reads packed data : slow for big files : fast for small files
2751
+ Buffer mode is more effective. */
2752
+ // _inBufMode = false;
2753
+ _inBufMode = true;
2754
+ // we could change the buffer size here, if we want smaller Buffer.
2755
+ // RINOK(ReAllocateBuffer(kSeqBufferSize));
2756
+ // InitBuf()
2757
+
2758
+ ArcInfo.Base = 0;
2759
+
2760
+ if (!Disable_FindMarker)
2761
+ {
2762
+ if (!MarkerIsFound)
2763
+ {
2764
+ if (!IsMultiVol)
2765
+ return S_FALSE;
2766
+ if (Vols.StartParsingVol != 0)
2767
+ return S_FALSE;
2768
+ // if (StartParsingVol == 0) and we didn't find marker, we use default zero marker.
2769
+ // so we suppose that there is no sfx stub
2770
+ RINOK(SeekToVol(0, ArcInfo.MarkerPos2))
2771
+ }
2772
+ else
2773
+ {
2774
+ if (ArcInfo.MarkerPos != 0)
2775
+ {
2776
+ /*
2777
+ If multi-vol or there is (No)Span-marker at start of stream, we set (Base) as 0.
2778
+ In another caes:
2779
+ (No)Span-marker is supposed as false positive. So we set (Base) as main marker (MarkerPos2).
2780
+ The (Base) can be corrected later after ECD reading.
2781
+ But sfx volume with stub and (No)Span-marker in (!IsMultiVol) mode will have incorrect (Base) here.
2782
+ */
2783
+ ArcInfo.Base = (Int64)ArcInfo.MarkerPos2;
2784
+ }
2785
+ RINOK(SeekToVol(ArcInfo.MarkerVolIndex, ArcInfo.MarkerPos2))
2786
+ }
2787
+ }
2788
+ _cnt = 0;
2789
+
2790
+ ReadSignature();
2791
+
2792
+ LocalsWereRead = true;
2793
+
2794
+ RINOK(ReadLocals(items))
2795
+
2796
+ if (_signature != NSignature::kCentralFileHeader)
2797
+ {
2798
+ // GetVirtStreamPos() - 4
2799
+ if (items.IsEmpty())
2800
+ return S_FALSE;
2801
+
2802
+ bool isError = true;
2803
+
2804
+ const UInt32 apkSize = _signature;
2805
+ const unsigned kApkFooterSize = 16 + 8;
2806
+ if (apkSize >= kApkFooterSize && apkSize <= (1 << 20))
2807
+ {
2808
+ if (ReadUInt32() == 0)
2809
+ {
2810
+ CByteBuffer apk;
2811
+ apk.Alloc(apkSize);
2812
+ SafeRead(apk, apkSize);
2813
+ ReadSignature();
2814
+ const Byte *footer = apk + apkSize - kApkFooterSize;
2815
+ if (_signature == NSignature::kCentralFileHeader)
2816
+ if (GetUi64(footer) == apkSize)
2817
+ if (memcmp(footer + 8, "APK Sig Block 42", 16) == 0)
2818
+ {
2819
+ isError = false;
2820
+ IsApk = true;
2821
+ }
2822
+ }
2823
+ }
2824
+
2825
+ if (isError)
2826
+ {
2827
+ NoCentralDir = true;
2828
+ HeadersError = true;
2829
+ return S_OK;
2830
+ }
2831
+ }
2832
+
2833
+ _inBufMode = true;
2834
+
2835
+ cdAbsOffset = GetVirtStreamPos() - 4;
2836
+ cdDisk = (UInt32)Vols.StreamIndex;
2837
+
2838
+ #ifdef ZIP_SELF_CHECK
2839
+ if (!IsMultiVol && _cnt != GetVirtStreamPos() - ArcInfo.MarkerPos2)
2840
+ return E_FAIL;
2841
+ #endif
2842
+
2843
+ const UInt64 processedCnt_start = _cnt;
2844
+
2845
+ for (;;)
2846
+ {
2847
+ CItemEx cdItem;
2848
+
2849
+ RINOK(ReadCdItem(cdItem))
2850
+
2851
+ cdItems.Add(cdItem);
2852
+ if (Callback && (cdItems.Size() & 0xFFF) == 0)
2853
+ {
2854
+ const UInt64 numFiles = items.Size();
2855
+ const UInt64 numBytes = _cnt;
2856
+ RINOK(Callback->SetCompleted(&numFiles, &numBytes))
2857
+ }
2858
+ ReadSignature();
2859
+ if (_signature != NSignature::kCentralFileHeader)
2860
+ break;
2861
+ }
2862
+
2863
+ cdSize = _cnt - processedCnt_start;
2864
+
2865
+ #ifdef ZIP_SELF_CHECK
2866
+ if (!IsMultiVol)
2867
+ {
2868
+ if (_cnt != GetVirtStreamPos() - ArcInfo.MarkerPos2)
2869
+ return E_FAIL;
2870
+ if (cdSize != (GetVirtStreamPos() - 4) - cdAbsOffset)
2871
+ return E_FAIL;
2872
+ }
2873
+ #endif
2874
+
2875
+ needSetBase = true;
2876
+ numCdItems = cdItems.Size();
2877
+ cdRelatOffset = (UInt64)((Int64)cdAbsOffset - ArcInfo.Base);
2878
+
2879
+ if (!cdItems.IsEmpty())
2880
+ {
2881
+ ArcInfo.CdWasRead = true;
2882
+ ArcInfo.FirstItemRelatOffset = cdItems[0].LocalHeaderPos;
2883
+ }
2884
+ }
2885
+
2886
+
2887
+
2888
+ CCdInfo cdInfo;
2889
+ CLocator locator;
2890
+ bool isZip64 = false;
2891
+ const UInt64 ecd64AbsOffset = GetVirtStreamPos() - 4;
2892
+ int ecd64Disk = -1;
2893
+
2894
+ if (_signature == NSignature::kEcd64)
2895
+ {
2896
+ ecd64Disk = Vols.StreamIndex;
2897
+ IsZip64 = isZip64 = true;
2898
+ {
2899
+ const UInt64 recordSize = ReadUInt64();
2900
+ if (recordSize < kEcd64_MainSize
2901
+ || recordSize >= ((UInt64)1 << 62))
2902
+ {
2903
+ HeadersError = true;
2904
+ return S_OK;
2905
+ }
2906
+ Byte buf[kEcd64_MainSize];
2907
+ SafeRead(buf, kEcd64_MainSize);
2908
+ cdInfo.ParseEcd64e(buf);
2909
+ if (cdInfo.AreOverflowValues())
2910
+ {
2911
+ HeadersError = true;
2912
+ return S_OK;
2913
+ }
2914
+ RINOK(Skip64(recordSize - kEcd64_MainSize, items.Size()))
2915
+ }
2916
+
2917
+ ReadSignature();
2918
+ if (_signature != NSignature::kEcd64Locator)
2919
+ {
2920
+ HeadersError = true;
2921
+ return S_OK;
2922
+ }
2923
+
2924
+ {
2925
+ const unsigned kBufSize = kEcd64Locator_Size - 4;
2926
+ Byte buf[kBufSize];
2927
+ SafeRead(buf, kBufSize);
2928
+ locator.Parse(buf);
2929
+ if (locator.Is_Ecd64Offset_Overflow())
2930
+ {
2931
+ // locator.Ecd64Offset = ecd64AbsOffset; // normalize incorrect value
2932
+ HeadersError = true;
2933
+ return S_OK;
2934
+ }
2935
+ // we ignore the error, where some zip creators use (NumDisks == 0)
2936
+ // if (locator.NumDisks == 0) HeadersWarning = true;
2937
+ }
2938
+
2939
+ ReadSignature();
2940
+ }
2941
+
2942
+
2943
+ if (_signature != NSignature::kEcd)
2944
+ {
2945
+ HeadersError = true;
2946
+ return S_OK;
2947
+ }
2948
+
2949
+
2950
+ CanStartNewVol = false;
2951
+
2952
+ // ---------- ECD ----------
2953
+
2954
+ CEcd ecd;
2955
+ {
2956
+ const unsigned kBufSize = kEcdSize - 4;
2957
+ Byte buf[kBufSize];
2958
+ SafeRead(buf, kBufSize);
2959
+ ecd.Parse(buf);
2960
+ }
2961
+
2962
+ COPY_ECD_ITEM_16(ThisDisk)
2963
+ COPY_ECD_ITEM_16(CdDisk)
2964
+ COPY_ECD_ITEM_16(NumEntries_in_ThisDisk)
2965
+ COPY_ECD_ITEM_16(NumEntries)
2966
+ COPY_ECD_ITEM_32(Size)
2967
+ COPY_ECD_ITEM_32(Offset)
2968
+
2969
+ bool cdOK = true;
2970
+
2971
+ if ((UInt32)cdInfo.Size != (UInt32)cdSize)
2972
+ {
2973
+ // return S_FALSE;
2974
+ cdOK = false;
2975
+ }
2976
+
2977
+ if (isZip64)
2978
+ {
2979
+ if (cdInfo.NumEntries != numCdItems
2980
+ || cdInfo.Size != cdSize)
2981
+ {
2982
+ cdOK = false;
2983
+ }
2984
+ }
2985
+
2986
+
2987
+ if (IsMultiVol)
2988
+ {
2989
+ if (cdDisk != cdInfo.CdDisk)
2990
+ HeadersError = true;
2991
+ }
2992
+ else if (needSetBase && cdOK)
2993
+ {
2994
+ const UInt64 oldBase = (UInt64)ArcInfo.Base;
2995
+ // localsWereRead == true
2996
+ // ArcInfo.Base == ArcInfo.MarkerPos2
2997
+ // cdRelatOffset == (cdAbsOffset - ArcInfo.Base)
2998
+
2999
+ if (isZip64)
3000
+ {
3001
+ if (ecd64Disk == Vols.StartVolIndex)
3002
+ {
3003
+ const Int64 newBase = (Int64)ecd64AbsOffset - (Int64)locator.Ecd64Offset;
3004
+ if (newBase <= (Int64)ecd64AbsOffset)
3005
+ {
3006
+ if (!localsWereRead || newBase <= (Int64)ArcInfo.MarkerPos2)
3007
+ {
3008
+ ArcInfo.Base = newBase;
3009
+ cdRelatOffset = (UInt64)((Int64)cdAbsOffset - newBase);
3010
+ }
3011
+ else
3012
+ cdOK = false;
3013
+ }
3014
+ }
3015
+ }
3016
+ else if (numCdItems != 0) // we can't use ecd.Offset in empty archive?
3017
+ {
3018
+ if ((int)cdDisk == Vols.StartVolIndex)
3019
+ {
3020
+ const Int64 newBase = (Int64)cdAbsOffset - (Int64)cdInfo.Offset;
3021
+ if (newBase <= (Int64)cdAbsOffset)
3022
+ {
3023
+ if (!localsWereRead || newBase <= (Int64)ArcInfo.MarkerPos2)
3024
+ {
3025
+ // cd can be more accurate, when it points before Locals
3026
+ // so we change Base and cdRelatOffset
3027
+ ArcInfo.Base = newBase;
3028
+ cdRelatOffset = cdInfo.Offset;
3029
+ }
3030
+ else
3031
+ {
3032
+ // const UInt64 delta = ((UInt64)cdRelatOffset - cdInfo.Offset);
3033
+ const UInt64 delta = ((UInt64)(newBase - ArcInfo.Base));
3034
+ if ((UInt32)delta == 0)
3035
+ {
3036
+ // we set Overflow32bit mode, only if there is (x<<32) offset
3037
+ // between real_CD_offset_from_MarkerPos and CD_Offset_in_ECD.
3038
+ // Base and cdRelatOffset unchanged
3039
+ Overflow32bit = true;
3040
+ }
3041
+ else
3042
+ cdOK = false;
3043
+ }
3044
+ }
3045
+ else
3046
+ cdOK = false;
3047
+ }
3048
+ }
3049
+ // cdRelatOffset = cdAbsOffset - ArcInfo.Base;
3050
+
3051
+ if (localsWereRead)
3052
+ {
3053
+ const UInt64 delta = (UInt64)((Int64)oldBase - ArcInfo.Base);
3054
+ if (delta != 0)
3055
+ {
3056
+ FOR_VECTOR (i, items)
3057
+ items[i].LocalHeaderPos += delta;
3058
+ }
3059
+ }
3060
+ }
3061
+
3062
+ if (!cdOK)
3063
+ HeadersError = true;
3064
+
3065
+ EcdVolIndex = cdInfo.ThisDisk;
3066
+
3067
+ if (!IsMultiVol)
3068
+ {
3069
+ if (EcdVolIndex == 0 && Vols.MissingZip && Vols.StartIsExe)
3070
+ {
3071
+ Vols.MissingName.Empty();
3072
+ Vols.MissingZip = false;
3073
+ }
3074
+
3075
+ if (localsWereRead)
3076
+ {
3077
+ if (EcdVolIndex != 0)
3078
+ {
3079
+ FOR_VECTOR (i, items)
3080
+ items[i].Disk = EcdVolIndex;
3081
+ }
3082
+ }
3083
+
3084
+ UseDisk_in_SingleVol = true;
3085
+ }
3086
+
3087
+ if (isZip64)
3088
+ {
3089
+ if ((cdInfo.ThisDisk == 0 && ecd64AbsOffset != (UInt64)(ArcInfo.Base + (Int64)locator.Ecd64Offset))
3090
+ // || cdInfo.NumEntries_in_ThisDisk != numCdItems
3091
+ || cdInfo.NumEntries != numCdItems
3092
+ || cdInfo.Size != cdSize
3093
+ || (cdInfo.Offset != cdRelatOffset && !items.IsEmpty()))
3094
+ {
3095
+ HeadersError = true;
3096
+ return S_OK;
3097
+ }
3098
+ }
3099
+
3100
+ if (cdOK && !cdItems.IsEmpty())
3101
+ {
3102
+ // ---------- merge Central Directory Items ----------
3103
+
3104
+ CRecordVector<unsigned> items2;
3105
+
3106
+ int nextLocalIndex = 0;
3107
+
3108
+ LocalsCenterMerged = true;
3109
+
3110
+ FOR_VECTOR (i, cdItems)
3111
+ {
3112
+ if (Callback)
3113
+ if ((i & 0x3FFF) == 0)
3114
+ {
3115
+ const UInt64 numFiles64 = items.Size() + items2.Size();
3116
+ RINOK(Callback->SetCompleted(&numFiles64, &_cnt))
3117
+ }
3118
+
3119
+ const CItemEx &cdItem = cdItems[i];
3120
+
3121
+ int index = -1;
3122
+
3123
+ if (nextLocalIndex != -1)
3124
+ {
3125
+ if ((unsigned)nextLocalIndex < items.Size())
3126
+ {
3127
+ CItemEx &item = items[(unsigned)nextLocalIndex];
3128
+ if (item.Disk == cdItem.Disk &&
3129
+ (item.LocalHeaderPos == cdItem.LocalHeaderPos
3130
+ || (Overflow32bit && (UInt32)item.LocalHeaderPos == cdItem.LocalHeaderPos)))
3131
+ index = nextLocalIndex++;
3132
+ else
3133
+ nextLocalIndex = -1;
3134
+ }
3135
+ }
3136
+
3137
+ if (index == -1)
3138
+ index = FindItem(items, cdItem);
3139
+
3140
+ // index = -1;
3141
+
3142
+ if (index == -1)
3143
+ {
3144
+ items2.Add(i);
3145
+ HeadersError = true;
3146
+ continue;
3147
+ }
3148
+
3149
+ CItemEx &item = items[(unsigned)index];
3150
+ if (item.Name != cdItem.Name
3151
+ // || item.Name.Len() != cdItem.Name.Len()
3152
+ || item.PackSize != cdItem.PackSize
3153
+ || item.Size != cdItem.Size
3154
+ // item.ExtractVersion != cdItem.ExtractVersion
3155
+ || !FlagsAreSame(item, cdItem)
3156
+ || item.Crc != cdItem.Crc)
3157
+ {
3158
+ HeadersError = true;
3159
+ continue;
3160
+ }
3161
+
3162
+ // item.Name = cdItem.Name;
3163
+ item.MadeByVersion = cdItem.MadeByVersion;
3164
+ item.CentralExtra = cdItem.CentralExtra;
3165
+ item.InternalAttrib = cdItem.InternalAttrib;
3166
+ item.ExternalAttrib = cdItem.ExternalAttrib;
3167
+ item.Comment = cdItem.Comment;
3168
+ item.FromCentral = cdItem.FromCentral;
3169
+ // 22.02: we force utf8 flag, if central header has utf8 flag
3170
+ if (cdItem.Flags & NFileHeader::NFlags::kUtf8)
3171
+ item.Flags |= NFileHeader::NFlags::kUtf8;
3172
+ }
3173
+
3174
+ FOR_VECTOR (k, items2)
3175
+ items.Add(cdItems[items2[k]]);
3176
+ }
3177
+
3178
+ if (ecd.NumEntries < ecd.NumEntries_in_ThisDisk)
3179
+ HeadersError = true;
3180
+
3181
+ if (ecd.ThisDisk == 0)
3182
+ {
3183
+ // if (isZip64)
3184
+ {
3185
+ if (ecd.NumEntries != ecd.NumEntries_in_ThisDisk)
3186
+ HeadersError = true;
3187
+ }
3188
+ }
3189
+
3190
+ if (isZip64)
3191
+ {
3192
+ if (cdInfo.NumEntries != items.Size()
3193
+ || (ecd.NumEntries != items.Size() && ecd.NumEntries != 0xFFFF))
3194
+ HeadersError = true;
3195
+ }
3196
+ else
3197
+ {
3198
+ // old 7-zip could store 32-bit number of CD items to 16-bit field.
3199
+ // if (ecd.NumEntries != items.Size())
3200
+ if (ecd.NumEntries > items.Size())
3201
+ HeadersError = true;
3202
+
3203
+ if (cdInfo.NumEntries != numCdItems)
3204
+ {
3205
+ if ((UInt16)cdInfo.NumEntries != (UInt16)numCdItems)
3206
+ HeadersError = true;
3207
+ else
3208
+ Cd_NumEntries_Overflow_16bit = true;
3209
+ }
3210
+ }
3211
+
3212
+ {
3213
+ CByteBuffer comment;
3214
+ ReadBuffer(comment, ecd.CommentSize);
3215
+ ArcInfo.Comment = comment;
3216
+ }
3217
+
3218
+ _inBufMode = false;
3219
+
3220
+ // DisableBufMode();
3221
+ // Buffer.Free();
3222
+ /* we can't clear buf varibles. we need them to calculate PhySize of archive */
3223
+
3224
+ if ((UInt16)cdInfo.NumEntries != (UInt16)numCdItems
3225
+ || (UInt32)cdInfo.Size != (UInt32)cdSize
3226
+ || ((UInt32)cdInfo.Offset != (UInt32)cdRelatOffset && !items.IsEmpty()))
3227
+ {
3228
+ // return S_FALSE;
3229
+ HeadersError = true;
3230
+ }
3231
+
3232
+ #ifdef ZIP_SELF_CHECK
3233
+ if (localsWereRead)
3234
+ {
3235
+ const UInt64 endPos = ArcInfo.MarkerPos2 + _cnt;
3236
+ if (endPos != (IsMultiVol ? Vols.TotalBytesSize : ArcInfo.FileEndPos))
3237
+ {
3238
+ // there are some data after the end of archive or error in code;
3239
+ return E_FAIL;
3240
+ }
3241
+ }
3242
+ #endif
3243
+
3244
+ // printf("\nOpen OK");
3245
+ return S_OK;
3246
+ }
3247
+
3248
+
3249
+
3250
+ HRESULT CInArchive::Open(IInStream *stream, const UInt64 *searchLimit,
3251
+ IArchiveOpenCallback *callback, CObjectVector<CItemEx> &items)
3252
+ {
3253
+ items.Clear();
3254
+
3255
+ Close();
3256
+
3257
+ UInt64 startPos;
3258
+ RINOK(InStream_GetPos(stream, startPos))
3259
+ RINOK(InStream_GetSize_SeekToEnd(stream, ArcInfo.FileEndPos))
3260
+ _streamPos = ArcInfo.FileEndPos;
3261
+
3262
+ StartStream = stream;
3263
+ Stream = stream;
3264
+ Callback = callback;
3265
+
3266
+ DisableBufMode();
3267
+
3268
+ bool volWasRequested = false;
3269
+
3270
+ if (!Disable_VolsRead)
3271
+ if (callback
3272
+ && (startPos == 0 || !searchLimit || *searchLimit != 0))
3273
+ {
3274
+ // we try to read volumes only if it's first call (offset == 0) or scan is allowed.
3275
+ volWasRequested = true;
3276
+ RINOK(ReadVols())
3277
+ }
3278
+
3279
+ if (Disable_FindMarker)
3280
+ {
3281
+ RINOK(SeekToVol(-1, startPos))
3282
+ StreamRef = stream;
3283
+ Stream = stream;
3284
+ MarkerIsFound = true;
3285
+ MarkerIsSafe = true;
3286
+ ArcInfo.MarkerPos = startPos;
3287
+ ArcInfo.MarkerPos2 = startPos;
3288
+ }
3289
+ else
3290
+ if (IsMultiVol && Vols.StartParsingVol == 0 && (unsigned)Vols.StartParsingVol < Vols.Streams.Size())
3291
+ {
3292
+ // only StartParsingVol = 0 is safe search.
3293
+ RINOK(SeekToVol(0, 0))
3294
+ // if (Stream)
3295
+ {
3296
+ // UInt64 limit = 1 << 22; // for sfx
3297
+ UInt64 limit = 0; // without sfx
3298
+
3299
+ HRESULT res = FindMarker(&limit);
3300
+
3301
+ if (res == S_OK)
3302
+ {
3303
+ MarkerIsFound = true;
3304
+ MarkerIsSafe = true;
3305
+ }
3306
+ else if (res != S_FALSE)
3307
+ return res;
3308
+ }
3309
+ }
3310
+ else
3311
+ {
3312
+ // printf("\nOpen offset = %u\n", (unsigned)startPos);
3313
+ if (IsMultiVol
3314
+ && (unsigned)Vols.StartParsingVol < Vols.Streams.Size()
3315
+ && Vols.Streams[(unsigned)Vols.StartParsingVol].Stream)
3316
+ {
3317
+ RINOK(SeekToVol(Vols.StartParsingVol, Vols.StreamIndex == Vols.StartVolIndex ? startPos : 0))
3318
+ }
3319
+ else
3320
+ {
3321
+ RINOK(SeekToVol(-1, startPos))
3322
+ }
3323
+
3324
+ // UInt64 limit = 1 << 22;
3325
+ // HRESULT res = FindMarker(&limit);
3326
+
3327
+ HRESULT res = FindMarker(searchLimit);
3328
+
3329
+ // const UInt64 curPos = GetVirtStreamPos();
3330
+ const UInt64 curPos = ArcInfo.MarkerPos2 + 4;
3331
+
3332
+ if (res == S_OK)
3333
+ MarkerIsFound = true;
3334
+ else if (!IsMultiVol)
3335
+ {
3336
+ /*
3337
+ // if (startPos != 0), probably CD could be already tested with another call with (startPos == 0).
3338
+ // so we don't want to try to open CD again in that case.
3339
+ if (startPos != 0)
3340
+ return res;
3341
+ // we can try to open CD, if there is no Marker and (startPos == 0).
3342
+ // is it OK to open such files as ZIP, or big number of false positive, when CD can be find in end of file ?
3343
+ */
3344
+ return res;
3345
+ }
3346
+
3347
+ if (ArcInfo.IsSpanMode && !volWasRequested)
3348
+ {
3349
+ RINOK(ReadVols())
3350
+ if (IsMultiVol && MarkerIsFound && ArcInfo.MarkerVolIndex < 0)
3351
+ ArcInfo.MarkerVolIndex = Vols.StartVolIndex;
3352
+ }
3353
+
3354
+ MarkerIsSafe = !IsMultiVol
3355
+ || (ArcInfo.MarkerVolIndex == 0 && ArcInfo.MarkerPos == 0)
3356
+ ;
3357
+
3358
+
3359
+ if (IsMultiVol)
3360
+ {
3361
+ if ((unsigned)Vols.StartVolIndex < Vols.Streams.Size())
3362
+ {
3363
+ Stream = Vols.Streams[(unsigned)Vols.StartVolIndex].Stream;
3364
+ if (Stream)
3365
+ {
3366
+ RINOK(Seek_SavePos(curPos))
3367
+ }
3368
+ else
3369
+ IsMultiVol = false;
3370
+ }
3371
+ else
3372
+ IsMultiVol = false;
3373
+ }
3374
+
3375
+ if (!IsMultiVol)
3376
+ {
3377
+ if (Vols.StreamIndex != -1)
3378
+ {
3379
+ Stream = StartStream;
3380
+ Vols.StreamIndex = -1;
3381
+ InitBuf();
3382
+ RINOK(Seek_SavePos(curPos))
3383
+ }
3384
+
3385
+ ArcInfo.MarkerVolIndex = -1;
3386
+ StreamRef = stream;
3387
+ Stream = stream;
3388
+ }
3389
+ }
3390
+
3391
+
3392
+ if (!IsMultiVol)
3393
+ Vols.ClearRefs();
3394
+
3395
+ {
3396
+ HRESULT res;
3397
+ try
3398
+ {
3399
+ res = ReadHeaders(items);
3400
+ }
3401
+ catch (const CSystemException &e) { res = e.ErrorCode; }
3402
+ catch (const CUnexpectEnd &)
3403
+ {
3404
+ if (items.IsEmpty())
3405
+ return S_FALSE;
3406
+ UnexpectedEnd = true;
3407
+ res = S_OK;
3408
+ }
3409
+ catch (...)
3410
+ {
3411
+ DisableBufMode();
3412
+ throw;
3413
+ }
3414
+
3415
+ if (IsMultiVol)
3416
+ {
3417
+ ArcInfo.FinishPos = ArcInfo.FileEndPos;
3418
+ if ((unsigned)Vols.StreamIndex < Vols.Streams.Size())
3419
+ if (GetVirtStreamPos() < Vols.Streams[(unsigned)Vols.StreamIndex].Size)
3420
+ ArcInfo.ThereIsTail = true;
3421
+ }
3422
+ else
3423
+ {
3424
+ ArcInfo.FinishPos = GetVirtStreamPos();
3425
+ ArcInfo.ThereIsTail = (ArcInfo.FileEndPos > ArcInfo.FinishPos);
3426
+ }
3427
+
3428
+ DisableBufMode();
3429
+
3430
+ IsArcOpen = true;
3431
+ if (!IsMultiVol)
3432
+ Vols.Streams.Clear();
3433
+ return res;
3434
+ }
3435
+ }
3436
+
3437
+
3438
+ HRESULT CInArchive::GetItemStream(const CItemEx &item, bool seekPackData, CMyComPtr<ISequentialInStream> &stream)
3439
+ {
3440
+ stream.Release();
3441
+
3442
+ UInt64 pos = item.LocalHeaderPos;
3443
+ if (seekPackData)
3444
+ pos += item.LocalFullHeaderSize;
3445
+
3446
+ if (!IsMultiVol)
3447
+ {
3448
+ if (UseDisk_in_SingleVol && item.Disk != EcdVolIndex)
3449
+ return S_OK;
3450
+ pos = (UInt64)((Int64)pos + ArcInfo.Base);
3451
+ RINOK(InStream_SeekSet(StreamRef, pos))
3452
+ stream = StreamRef;
3453
+ return S_OK;
3454
+ }
3455
+
3456
+ if (item.Disk >= Vols.Streams.Size())
3457
+ return S_OK;
3458
+
3459
+ IInStream *str2 = Vols.Streams[item.Disk].Stream;
3460
+ if (!str2)
3461
+ return S_OK;
3462
+ RINOK(InStream_SeekSet(str2, pos))
3463
+
3464
+ Vols.NeedSeek = false;
3465
+ Vols.StreamIndex = (int)item.Disk;
3466
+
3467
+ CVolStream *volsStreamSpec = new CVolStream;
3468
+ volsStreamSpec->Vols = &Vols;
3469
+ stream = volsStreamSpec;
3470
+
3471
+ return S_OK;
3472
+ }
3473
+
3474
+ }}