react-native-update 10.34.2 → 10.34.4

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 (746) hide show
  1. package/.gitmodules +4 -4
  2. package/harmony/pushy/src/main/cpp/HDiffPatch/CHANGELOG.md +153 -0
  3. package/harmony/pushy/src/main/cpp/HDiffPatch/LICENSE +48 -0
  4. package/harmony/pushy/src/main/cpp/HDiffPatch/Makefile +157 -0
  5. package/harmony/pushy/src/main/cpp/HDiffPatch/README.md +307 -0
  6. package/harmony/pushy/src/main/cpp/HDiffPatch/_atosize.h +83 -0
  7. package/harmony/pushy/src/main/cpp/HDiffPatch/_clock_for_demo.h +47 -0
  8. package/harmony/pushy/src/main/cpp/HDiffPatch/_dir_ignore.h +191 -0
  9. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/Android.mk +37 -0
  10. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/Application.mk +7 -0
  11. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/build_libs.bat +1 -0
  12. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/build_libs.sh +1 -0
  13. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch.c +18 -0
  14. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch.h +20 -0
  15. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/hpatch_jni.c +28 -0
  16. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/android_ndk_jni_mk/java/com/github/sisong/HPatch.java +8 -0
  17. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/codeblocks/HDiffPatch.workspace +8 -0
  18. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/codeblocks/HDiffZ.cbp +219 -0
  19. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/codeblocks/HPatchZ.cbp +156 -0
  20. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/codeblocks/unitTest.cbp +65 -0
  21. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HDiffPatch.sln +105 -0
  22. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HDiffZ.vcxproj +237 -0
  23. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HDiffZ.vcxproj.user +3 -0
  24. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HPatchZ.vcxproj +318 -0
  25. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/HPatchZ.vcxproj.user +3 -0
  26. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/unitTest.vcxproj +182 -0
  27. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/vc/unitTest.vcxproj.user +3 -0
  28. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/contents.xcworkspacedata +30 -0
  29. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/HDiffPatch.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  30. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/bestParams.xcodeproj/project.pbxproj +408 -0
  31. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/hdiffz.xcodeproj/project.pbxproj +573 -0
  32. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/hpatchz.xcodeproj/project.pbxproj +396 -0
  33. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/lz4.xcodeproj/project.pbxproj +268 -0
  34. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/lzma.xcodeproj/project.pbxproj +361 -0
  35. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/testHashClash.xcodeproj/project.pbxproj +301 -0
  36. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/unitTest.xcodeproj/project.pbxproj +411 -0
  37. package/harmony/pushy/src/main/cpp/HDiffPatch/builds/xcode/zstd.xcodeproj/project.pbxproj +504 -0
  38. package/harmony/pushy/src/main/cpp/HDiffPatch/checksum_plugin_demo.h +344 -0
  39. package/harmony/pushy/src/main/cpp/HDiffPatch/compress_parallel.cpp +166 -0
  40. package/harmony/pushy/src/main/cpp/HDiffPatch/compress_parallel.h +59 -0
  41. package/harmony/pushy/src/main/cpp/HDiffPatch/compress_plugin_demo.h +1152 -0
  42. package/harmony/pushy/src/main/cpp/HDiffPatch/decompress_plugin_demo.h +995 -0
  43. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff.cpp +797 -0
  44. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff.h +65 -0
  45. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff_tools.cpp +200 -0
  46. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_diff_tools.h +178 -0
  47. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_manifest.cpp +357 -0
  48. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/dir_manifest.h +87 -0
  49. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_diff/file_for_dirDiff.h +151 -0
  50. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch.c +770 -0
  51. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch.h +236 -0
  52. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_private.h +47 -0
  53. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_tools.c +112 -0
  54. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_tools.h +53 -0
  55. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/dir_patch_types.h +61 -0
  56. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_dir_output.c +331 -0
  57. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_dir_output.h +144 -0
  58. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_stream.c +176 -0
  59. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/new_stream.h +84 -0
  60. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/ref_stream.c +146 -0
  61. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/ref_stream.h +61 -0
  62. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/res_handle_limit.c +152 -0
  63. package/harmony/pushy/src/main/cpp/HDiffPatch/dirDiffPatch/dir_patch/res_handle_limit.h +76 -0
  64. package/harmony/pushy/src/main/cpp/HDiffPatch/file_for_patch.c +524 -0
  65. package/harmony/pushy/src/main/cpp/HDiffPatch/file_for_patch.h +259 -0
  66. package/harmony/pushy/src/main/cpp/HDiffPatch/hdiffz.cpp +1570 -0
  67. package/harmony/pushy/src/main/cpp/HDiffPatch/hpatch_dir_listener.h +290 -0
  68. package/harmony/pushy/src/main/cpp/HDiffPatch/hpatchz.c +1221 -0
  69. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff.cpp +1025 -0
  70. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff.h +116 -0
  71. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/diff_types.h +72 -0
  72. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.cpp +213 -0
  73. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/bytes_rle.h +63 -0
  74. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.cpp +170 -0
  75. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/compress_detect.h +86 -0
  76. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/config.h +89 -0
  77. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c +13 -0
  78. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.c.inc.h +398 -0
  79. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.h +194 -0
  80. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.c +13 -0
  81. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort64.h +204 -0
  82. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort_private.h +207 -0
  83. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/sssort.c.inc.h +815 -0
  84. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/trsort.c.inc.h +586 -0
  85. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/utils.c.inc.h +381 -0
  86. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.c +352 -0
  87. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/adler_roll.h +137 -0
  88. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/bloom_filter.h +137 -0
  89. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/covers.h +70 -0
  90. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.cpp +628 -0
  91. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/digest_matcher.h +87 -0
  92. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.cpp +363 -0
  93. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/limit_mem_diff/stream_serialize.h +139 -0
  94. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/mem_buf.h +68 -0
  95. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/pack_uint.h +115 -0
  96. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.cpp +342 -0
  97. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HDiff/private_diff/suffix_string.h +94 -0
  98. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/checksum_plugin.h +52 -0
  99. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch.c +2292 -0
  100. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch.h +215 -0
  101. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch_private.h +165 -0
  102. package/harmony/pushy/src/main/cpp/HDiffPatch/libHDiffPatch/HPatch/patch_types.h +251 -0
  103. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_channel.cpp +174 -0
  104. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_channel.h +73 -0
  105. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_import.cpp +367 -0
  106. package/harmony/pushy/src/main/cpp/HDiffPatch/libParallel/parallel_import.h +92 -0
  107. package/harmony/pushy/src/main/cpp/HDiffPatch/test/_private_searchBestParams.cpp +301 -0
  108. package/harmony/pushy/src/main/cpp/HDiffPatch/test/hpatchz_test.cpp +292 -0
  109. package/harmony/pushy/src/main/cpp/HDiffPatch/test/testHashClash.cpp +436 -0
  110. package/harmony/pushy/src/main/cpp/HDiffPatch/test/unit_test.cpp +417 -0
  111. package/harmony/pushy/src/main/cpp/lzma/Asm/arm/7zCrcOpt.asm +100 -0
  112. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/7zAsm.asm +147 -0
  113. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/7zCrcOpt.asm +147 -0
  114. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/AesOpt.asm +237 -0
  115. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/LzmaDecOpt.asm +1258 -0
  116. package/harmony/pushy/src/main/cpp/lzma/Asm/x86/XzCrc64Opt.asm +205 -0
  117. package/harmony/pushy/src/main/cpp/lzma/C/7z.h +202 -0
  118. package/harmony/pushy/src/main/cpp/lzma/C/7zAlloc.c +80 -0
  119. package/harmony/pushy/src/main/cpp/lzma/C/7zAlloc.h +19 -0
  120. package/harmony/pushy/src/main/cpp/lzma/C/7zArcIn.c +1771 -0
  121. package/harmony/pushy/src/main/cpp/lzma/C/7zBuf.c +36 -0
  122. package/harmony/pushy/src/main/cpp/lzma/C/7zBuf.h +35 -0
  123. package/harmony/pushy/src/main/cpp/lzma/C/7zBuf2.c +52 -0
  124. package/harmony/pushy/src/main/cpp/lzma/C/7zCrc.c +128 -0
  125. package/harmony/pushy/src/main/cpp/lzma/C/7zCrc.h +25 -0
  126. package/harmony/pushy/src/main/cpp/lzma/C/7zCrcOpt.c +115 -0
  127. package/harmony/pushy/src/main/cpp/lzma/C/7zDec.c +591 -0
  128. package/harmony/pushy/src/main/cpp/lzma/C/7zFile.c +286 -0
  129. package/harmony/pushy/src/main/cpp/lzma/C/7zFile.h +83 -0
  130. package/harmony/pushy/src/main/cpp/lzma/C/7zStream.c +176 -0
  131. package/harmony/pushy/src/main/cpp/lzma/C/7zTypes.h +375 -0
  132. package/harmony/pushy/src/main/cpp/lzma/C/7zVersion.h +27 -0
  133. package/harmony/pushy/src/main/cpp/lzma/C/7zVersion.rc +55 -0
  134. package/harmony/pushy/src/main/cpp/lzma/C/Aes.c +306 -0
  135. package/harmony/pushy/src/main/cpp/lzma/C/Aes.h +38 -0
  136. package/harmony/pushy/src/main/cpp/lzma/C/AesOpt.c +184 -0
  137. package/harmony/pushy/src/main/cpp/lzma/C/Alloc.c +455 -0
  138. package/harmony/pushy/src/main/cpp/lzma/C/Alloc.h +51 -0
  139. package/harmony/pushy/src/main/cpp/lzma/C/Bcj2.c +257 -0
  140. package/harmony/pushy/src/main/cpp/lzma/C/Bcj2.h +146 -0
  141. package/harmony/pushy/src/main/cpp/lzma/C/Bcj2Enc.c +311 -0
  142. package/harmony/pushy/src/main/cpp/lzma/C/Bra.c +230 -0
  143. package/harmony/pushy/src/main/cpp/lzma/C/Bra.h +64 -0
  144. package/harmony/pushy/src/main/cpp/lzma/C/Bra86.c +82 -0
  145. package/harmony/pushy/src/main/cpp/lzma/C/BraIA64.c +53 -0
  146. package/harmony/pushy/src/main/cpp/lzma/C/Compiler.h +33 -0
  147. package/harmony/pushy/src/main/cpp/lzma/C/CpuArch.c +218 -0
  148. package/harmony/pushy/src/main/cpp/lzma/C/CpuArch.h +336 -0
  149. package/harmony/pushy/src/main/cpp/lzma/C/Delta.c +64 -0
  150. package/harmony/pushy/src/main/cpp/lzma/C/Delta.h +19 -0
  151. package/harmony/pushy/src/main/cpp/lzma/C/DllSecur.c +108 -0
  152. package/harmony/pushy/src/main/cpp/lzma/C/DllSecur.h +20 -0
  153. package/harmony/pushy/src/main/cpp/lzma/C/LzFind.c +1127 -0
  154. package/harmony/pushy/src/main/cpp/lzma/C/LzFind.h +121 -0
  155. package/harmony/pushy/src/main/cpp/lzma/C/LzFindMt.c +853 -0
  156. package/harmony/pushy/src/main/cpp/lzma/C/LzFindMt.h +101 -0
  157. package/harmony/pushy/src/main/cpp/lzma/C/LzHash.h +57 -0
  158. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Dec.c +488 -0
  159. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Dec.h +120 -0
  160. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2DecMt.c +1082 -0
  161. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2DecMt.h +79 -0
  162. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Enc.c +803 -0
  163. package/harmony/pushy/src/main/cpp/lzma/C/Lzma2Enc.h +55 -0
  164. package/harmony/pushy/src/main/cpp/lzma/C/Lzma86.h +111 -0
  165. package/harmony/pushy/src/main/cpp/lzma/C/Lzma86Dec.c +54 -0
  166. package/harmony/pushy/src/main/cpp/lzma/C/Lzma86Enc.c +106 -0
  167. package/harmony/pushy/src/main/cpp/lzma/C/LzmaDec.c +1185 -0
  168. package/harmony/pushy/src/main/cpp/lzma/C/LzmaDec.h +234 -0
  169. package/harmony/pushy/src/main/cpp/lzma/C/LzmaEnc.c +2976 -0
  170. package/harmony/pushy/src/main/cpp/lzma/C/LzmaEnc.h +76 -0
  171. package/harmony/pushy/src/main/cpp/lzma/C/LzmaLib.c +40 -0
  172. package/harmony/pushy/src/main/cpp/lzma/C/LzmaLib.h +131 -0
  173. package/harmony/pushy/src/main/cpp/lzma/C/MtCoder.c +601 -0
  174. package/harmony/pushy/src/main/cpp/lzma/C/MtCoder.h +141 -0
  175. package/harmony/pushy/src/main/cpp/lzma/C/MtDec.c +1138 -0
  176. package/harmony/pushy/src/main/cpp/lzma/C/MtDec.h +201 -0
  177. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd.h +85 -0
  178. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7.c +712 -0
  179. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7.h +142 -0
  180. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7Dec.c +191 -0
  181. package/harmony/pushy/src/main/cpp/lzma/C/Ppmd7Enc.c +187 -0
  182. package/harmony/pushy/src/main/cpp/lzma/C/Precomp.h +10 -0
  183. package/harmony/pushy/src/main/cpp/lzma/C/RotateDefs.h +30 -0
  184. package/harmony/pushy/src/main/cpp/lzma/C/Sha256.c +248 -0
  185. package/harmony/pushy/src/main/cpp/lzma/C/Sha256.h +26 -0
  186. package/harmony/pushy/src/main/cpp/lzma/C/Sort.c +141 -0
  187. package/harmony/pushy/src/main/cpp/lzma/C/Sort.h +18 -0
  188. package/harmony/pushy/src/main/cpp/lzma/C/Threads.c +95 -0
  189. package/harmony/pushy/src/main/cpp/lzma/C/Threads.h +70 -0
  190. package/harmony/pushy/src/main/cpp/lzma/C/ThreadsP.c +396 -0
  191. package/harmony/pushy/src/main/cpp/lzma/C/ThreadsP.h +31 -0
  192. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/7z.dsp +241 -0
  193. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/7z.dsw +29 -0
  194. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/7zMain.c +686 -0
  195. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/Precomp.c +4 -0
  196. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/Precomp.h +10 -0
  197. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/makefile +40 -0
  198. package/harmony/pushy/src/main/cpp/lzma/C/Util/7z/makefile.gcc +75 -0
  199. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.c +258 -0
  200. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.dsp +168 -0
  201. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/LzmaUtil.dsw +29 -0
  202. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/makefile +28 -0
  203. package/harmony/pushy/src/main/cpp/lzma/C/Util/Lzma/makefile.gcc +44 -0
  204. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.def +4 -0
  205. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.dsp +178 -0
  206. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLib.dsw +29 -0
  207. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/LzmaLibExports.c +14 -0
  208. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/makefile +34 -0
  209. package/harmony/pushy/src/main/cpp/lzma/C/Util/LzmaLib/resource.rc +3 -0
  210. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/Precomp.c +4 -0
  211. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/Precomp.h +10 -0
  212. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.c +640 -0
  213. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.dsp +231 -0
  214. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/SfxSetup.dsw +29 -0
  215. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/makefile +37 -0
  216. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/makefile_con +38 -0
  217. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/resource.rc +5 -0
  218. package/harmony/pushy/src/main/cpp/lzma/C/Util/SfxSetup/setup.ico +0 -0
  219. package/harmony/pushy/src/main/cpp/lzma/C/Xz.c +90 -0
  220. package/harmony/pushy/src/main/cpp/lzma/C/Xz.h +460 -0
  221. package/harmony/pushy/src/main/cpp/lzma/C/XzCrc64.c +86 -0
  222. package/harmony/pushy/src/main/cpp/lzma/C/XzCrc64.h +26 -0
  223. package/harmony/pushy/src/main/cpp/lzma/C/XzCrc64Opt.c +69 -0
  224. package/harmony/pushy/src/main/cpp/lzma/C/XzDec.c +2766 -0
  225. package/harmony/pushy/src/main/cpp/lzma/C/XzEnc.c +1329 -0
  226. package/harmony/pushy/src/main/cpp/lzma/C/XzEnc.h +60 -0
  227. package/harmony/pushy/src/main/cpp/lzma/C/XzIn.c +319 -0
  228. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/7zip.mak +240 -0
  229. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Aes.mak +7 -0
  230. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zCompressionMode.cpp +3 -0
  231. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zCompressionMode.h +76 -0
  232. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zDecode.cpp +569 -0
  233. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zDecode.h +70 -0
  234. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zEncode.cpp +678 -0
  235. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zEncode.h +92 -0
  236. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zExtract.cpp +423 -0
  237. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zFolderInStream.cpp +139 -0
  238. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zFolderInStream.h +61 -0
  239. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandler.cpp +763 -0
  240. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandler.h +181 -0
  241. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHandlerOut.cpp +942 -0
  242. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHeader.cpp +19 -0
  243. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zHeader.h +148 -0
  244. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zIn.cpp +1666 -0
  245. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zIn.h +445 -0
  246. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zItem.h +202 -0
  247. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zOut.cpp +901 -0
  248. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zOut.h +335 -0
  249. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zProperties.cpp +174 -0
  250. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zProperties.h +22 -0
  251. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zRegister.cpp +21 -0
  252. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zSpecStream.cpp +22 -0
  253. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zSpecStream.h +35 -0
  254. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp +2500 -0
  255. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/7zUpdate.h +139 -0
  256. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/StdAfx.cpp +3 -0
  257. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/7z/StdAfx.h +8 -0
  258. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Archive.def +12 -0
  259. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Archive2.def +19 -0
  260. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/ArchiveExports.cpp +151 -0
  261. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/CoderMixer2.cpp +1125 -0
  262. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/CoderMixer2.h +447 -0
  263. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/DummyOutStream.cpp +17 -0
  264. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/DummyOutStream.h +25 -0
  265. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/HandlerOut.cpp +232 -0
  266. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/HandlerOut.h +110 -0
  267. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +46 -0
  268. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/InStreamWithCRC.h +67 -0
  269. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ItemNameUtils.cpp +88 -0
  270. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ItemNameUtils.h +28 -0
  271. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/MultiStream.cpp +191 -0
  272. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/MultiStream.h +89 -0
  273. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +18 -0
  274. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/OutStreamWithCRC.h +37 -0
  275. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ParseProperties.cpp +3 -0
  276. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/ParseProperties.h +6 -0
  277. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Common/StdAfx.h +8 -0
  278. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/DllExports2.cpp +122 -0
  279. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/IArchive.h +608 -0
  280. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/Icons/7z.ico +0 -0
  281. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/LzmaHandler.cpp +629 -0
  282. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/SplitHandler.cpp +359 -0
  283. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/StdAfx.h +8 -0
  284. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/XzHandler.cpp +1308 -0
  285. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Archive/XzHandler.h +11 -0
  286. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Asm.mak +9 -0
  287. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsp +1910 -0
  288. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/Alone.dsw +29 -0
  289. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.cpp +3 -0
  290. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/StdAfx.h +8 -0
  291. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/makefile +154 -0
  292. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Alone7z/resource.rc +7 -0
  293. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.cpp +3 -0
  294. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/StdAfx.h +8 -0
  295. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/makefile +96 -0
  296. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zExtractR/resource.rc +5 -0
  297. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.cpp +3 -0
  298. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/StdAfx.h +8 -0
  299. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/makefile +116 -0
  300. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/Format7zR/resource.rc +5 -0
  301. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp +799 -0
  302. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp +477 -0
  303. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsw +29 -0
  304. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/StdAfx.cpp +3 -0
  305. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/StdAfx.h +8 -0
  306. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/makefile +59 -0
  307. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/makefile.gcc +195 -0
  308. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaCon/resource.rc +3 -0
  309. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/LzmaSpec/LzmaSpec.cpp +715 -0
  310. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/7z.ico +0 -0
  311. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsp +912 -0
  312. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SFXCon.dsw +29 -0
  313. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/SfxCon.cpp +482 -0
  314. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/StdAfx.cpp +3 -0
  315. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/StdAfx.h +8 -0
  316. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/makefile +134 -0
  317. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXCon/resource.rc +5 -0
  318. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.cpp +246 -0
  319. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractCallbackSfx.h +86 -0
  320. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp +137 -0
  321. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h +11 -0
  322. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp +803 -0
  323. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsw +29 -0
  324. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp +364 -0
  325. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/StdAfx.cpp +3 -0
  326. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/StdAfx.h +13 -0
  327. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/makefile +117 -0
  328. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/resource.h +6 -0
  329. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/resource.rc +16 -0
  330. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXSetup/setup.ico +0 -0
  331. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/7z.ico +0 -0
  332. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsp +988 -0
  333. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SFXWin.dsw +29 -0
  334. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/SfxWin.cpp +241 -0
  335. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/StdAfx.cpp +3 -0
  336. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/StdAfx.h +14 -0
  337. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/makefile +153 -0
  338. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/resource.h +1 -0
  339. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Bundles/SFXWin/resource.rc +50 -0
  340. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CWrappers.cpp +250 -0
  341. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CWrappers.h +120 -0
  342. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CreateCoder.cpp +536 -0
  343. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/CreateCoder.h +192 -0
  344. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilePathAutoRename.cpp +46 -0
  345. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilePathAutoRename.h +10 -0
  346. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FileStreams.cpp +475 -0
  347. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FileStreams.h +166 -0
  348. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilterCoder.cpp +435 -0
  349. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/FilterCoder.h +205 -0
  350. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InBuffer.cpp +163 -0
  351. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InBuffer.h +92 -0
  352. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InOutTempBuffer.cpp +127 -0
  353. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/InOutTempBuffer.h +48 -0
  354. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LimitedStreams.cpp +367 -0
  355. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LimitedStreams.h +252 -0
  356. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LockedStream.cpp +3 -0
  357. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/LockedStream.h +6 -0
  358. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodId.cpp +3 -0
  359. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodId.h +10 -0
  360. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodProps.cpp +509 -0
  361. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/MethodProps.h +264 -0
  362. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OffsetStream.cpp +39 -0
  363. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OffsetStream.h +26 -0
  364. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OutBuffer.cpp +111 -0
  365. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/OutBuffer.h +66 -0
  366. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/ProgressUtils.cpp +51 -0
  367. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/ProgressUtils.h +35 -0
  368. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/PropId.cpp +108 -0
  369. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/RegisterArc.h +78 -0
  370. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/RegisterCodec.h +106 -0
  371. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StdAfx.h +8 -0
  372. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamBinder.cpp +156 -0
  373. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamBinder.h +60 -0
  374. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamObjects.cpp +285 -0
  375. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamObjects.h +157 -0
  376. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamUtils.cpp +56 -0
  377. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/StreamUtils.h +13 -0
  378. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/UniqBlocks.cpp +57 -0
  379. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/UniqBlocks.h +26 -0
  380. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/VirtThread.cpp +48 -0
  381. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Common/VirtThread.h +24 -0
  382. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Coder.cpp +666 -0
  383. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Coder.h +120 -0
  384. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Bcj2Register.cpp +24 -0
  385. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BcjCoder.cpp +24 -0
  386. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BcjCoder.h +31 -0
  387. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BcjRegister.cpp +17 -0
  388. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BranchMisc.cpp +23 -0
  389. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BranchMisc.h +35 -0
  390. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/BranchRegister.cpp +41 -0
  391. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/ByteSwap.cpp +92 -0
  392. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CodecExports.cpp +344 -0
  393. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CopyCoder.cpp +120 -0
  394. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CopyCoder.h +49 -0
  395. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/CopyRegister.cpp +15 -0
  396. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/DeltaFilter.cpp +128 -0
  397. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Decoder.cpp +265 -0
  398. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Decoder.h +96 -0
  399. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Encoder.cpp +122 -0
  400. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Encoder.h +42 -0
  401. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/Lzma2Register.cpp +22 -0
  402. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaDecoder.cpp +343 -0
  403. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaDecoder.h +113 -0
  404. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaEncoder.cpp +182 -0
  405. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaEncoder.h +46 -0
  406. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/LzmaRegister.cpp +22 -0
  407. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdDecoder.cpp +170 -0
  408. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdDecoder.h +86 -0
  409. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdEncoder.cpp +152 -0
  410. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdEncoder.h +58 -0
  411. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/PpmdRegister.cpp +22 -0
  412. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/StdAfx.h +8 -0
  413. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzDecoder.cpp +150 -0
  414. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzDecoder.h +92 -0
  415. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzEncoder.cpp +245 -0
  416. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Compress/XzEncoder.h +46 -0
  417. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crc.mak +8 -0
  418. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crc64.mak +8 -0
  419. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/7zAes.cpp +280 -0
  420. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/7zAes.h +118 -0
  421. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/7zAesRegister.cpp +17 -0
  422. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/MyAes.cpp +112 -0
  423. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/MyAes.h +57 -0
  424. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/MyAesReg.cpp +16 -0
  425. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/RandGen.cpp +233 -0
  426. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/RandGen.h +40 -0
  427. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Crypto/StdAfx.h +8 -0
  428. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/GuiCommon.rc +84 -0
  429. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/Guid.txt +220 -0
  430. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/ICoder.h +399 -0
  431. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IDecl.h +28 -0
  432. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IPassword.h +23 -0
  433. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IProgress.h +19 -0
  434. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/IStream.h +127 -0
  435. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/LzmaDec.mak +5 -0
  436. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/MyVersion.h +2 -0
  437. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/MyVersionInfo.rc +2 -0
  438. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/PropID.h +127 -0
  439. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/SubBuild.mak +3 -0
  440. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.cpp +993 -0
  441. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.dsp +235 -0
  442. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/Client7z.dsw +29 -0
  443. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/StdAfx.cpp +3 -0
  444. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/StdAfx.h +8 -0
  445. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/makefile +28 -0
  446. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Client7z/resource.rc +3 -0
  447. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp +1295 -0
  448. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.h +136 -0
  449. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp +1715 -0
  450. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveExtractCallback.h +403 -0
  451. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveName.cpp +155 -0
  452. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveName.h +10 -0
  453. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp +161 -0
  454. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.h +112 -0
  455. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Bench.cpp +3618 -0
  456. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Bench.h +77 -0
  457. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/DefaultName.cpp +37 -0
  458. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/DefaultName.h +11 -0
  459. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/DirItem.h +190 -0
  460. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/EnumDirItems.cpp +1096 -0
  461. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/EnumDirItems.h +42 -0
  462. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExitCode.h +27 -0
  463. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Extract.cpp +482 -0
  464. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Extract.h +94 -0
  465. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractMode.h +34 -0
  466. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractingFilePath.cpp +280 -0
  467. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ExtractingFilePath.h +31 -0
  468. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/HashCalc.cpp +347 -0
  469. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/HashCalc.h +110 -0
  470. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/IFileExtractCallback.h +114 -0
  471. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/LoadCodecs.cpp +1074 -0
  472. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/LoadCodecs.h +424 -0
  473. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/OpenArchive.cpp +3553 -0
  474. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/OpenArchive.h +436 -0
  475. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/PropIDUtils.cpp +668 -0
  476. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/PropIDUtils.h +18 -0
  477. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Property.h +14 -0
  478. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SetProperties.cpp +80 -0
  479. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SetProperties.h +10 -0
  480. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SortUtils.cpp +25 -0
  481. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/SortUtils.h +10 -0
  482. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/StdAfx.h +8 -0
  483. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/TempFiles.cpp +19 -0
  484. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/TempFiles.h +16 -0
  485. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Update.cpp +1704 -0
  486. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/Update.h +200 -0
  487. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateAction.cpp +64 -0
  488. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateAction.h +66 -0
  489. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateCallback.cpp +771 -0
  490. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateCallback.h +162 -0
  491. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdatePair.cpp +233 -0
  492. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdatePair.h +27 -0
  493. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateProduce.cpp +70 -0
  494. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/UpdateProduce.h +55 -0
  495. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/WorkDir.cpp +94 -0
  496. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/WorkDir.h +26 -0
  497. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Common/ZipRegistry.h +130 -0
  498. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/BenchCon.cpp +41 -0
  499. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/BenchCon.h +14 -0
  500. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/Console.mak +43 -0
  501. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/Console.manifest +13 -0
  502. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ConsoleClose.cpp +69 -0
  503. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ConsoleClose.h +33 -0
  504. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp +825 -0
  505. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/ExtractCallbackConsole.h +164 -0
  506. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/HashCon.cpp +367 -0
  507. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/HashCon.h +48 -0
  508. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/List.cpp +1359 -0
  509. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/List.h +27 -0
  510. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/Main.cpp +1154 -0
  511. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/MainAr.cpp +175 -0
  512. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.cpp +115 -0
  513. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/OpenCallbackConsole.h +66 -0
  514. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/PercentPrinter.cpp +183 -0
  515. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/PercentPrinter.h +62 -0
  516. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/StdAfx.cpp +3 -0
  517. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/StdAfx.h +8 -0
  518. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp +702 -0
  519. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UpdateCallbackConsole.h +124 -0
  520. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UserInputUtils.cpp +110 -0
  521. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/UserInputUtils.h +27 -0
  522. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/makefile +64 -0
  523. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Console/resource.rc +7 -0
  524. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Explorer/MyMessages.cpp +37 -0
  525. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/Explorer/MyMessages.h +16 -0
  526. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp +1025 -0
  527. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h +21 -0
  528. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/BrowseDialogRes.h +9 -0
  529. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp +64 -0
  530. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialog.h +28 -0
  531. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ComboDialogRes.h +4 -0
  532. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/DialogSize.h +16 -0
  533. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp +1037 -0
  534. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h +328 -0
  535. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/FormatUtils.cpp +28 -0
  536. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/FormatUtils.h +14 -0
  537. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/LangUtils.h +40 -0
  538. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h +76 -0
  539. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp +122 -0
  540. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h +69 -0
  541. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.rc +91 -0
  542. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/OverwriteDialogRes.h +17 -0
  543. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp +58 -0
  544. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h +28 -0
  545. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialog.rc +14 -0
  546. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PasswordDialogRes.h +5 -0
  547. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp +196 -0
  548. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h +170 -0
  549. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog.rc +12 -0
  550. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp +1337 -0
  551. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h +351 -0
  552. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.rc +40 -0
  553. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h +48 -0
  554. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc +80 -0
  555. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/ProgressDialogRes.h +3 -0
  556. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyName.cpp +23 -0
  557. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyName.h +10 -0
  558. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h +95 -0
  559. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp +255 -0
  560. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h +62 -0
  561. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/resource.h +177 -0
  562. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/FileManager/resourceGui.h +15 -0
  563. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/Extract.rc +59 -0
  564. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.cpp +418 -0
  565. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.h +113 -0
  566. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialog.rc +98 -0
  567. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractDialogRes.h +24 -0
  568. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractGUI.cpp +280 -0
  569. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractGUI.h +38 -0
  570. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/ExtractRes.h +51 -0
  571. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/HashGUI.h +27 -0
  572. package/harmony/pushy/src/main/cpp/lzma/CPP/7zip/UI/GUI/resource2.h +2 -0
  573. package/harmony/pushy/src/main/cpp/lzma/CPP/Build.mak +156 -0
  574. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/AutoPtr.h +35 -0
  575. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CRC.cpp +7 -0
  576. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/C_FileIO.cpp +92 -0
  577. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/C_FileIO.h +53 -0
  578. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/ComTry.h +21 -0
  579. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CommandLineParser.cpp +197 -0
  580. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CommandLineParser.h +63 -0
  581. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Common.h +43 -0
  582. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/CrcReg.cpp +98 -0
  583. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Defs.h +15 -0
  584. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/DynamicBuffer.h +64 -0
  585. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/IntToString.cpp +193 -0
  586. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/IntToString.h +28 -0
  587. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Lang.h +23 -0
  588. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/ListFileUtils.cpp +132 -0
  589. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/ListFileUtils.h +18 -0
  590. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyBuffer.h +259 -0
  591. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyBuffer2.h +100 -0
  592. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyCom.h +277 -0
  593. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyException.h +14 -0
  594. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyGuidDef.h +54 -0
  595. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyInitGuid.h +45 -0
  596. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyLinux.h +42 -0
  597. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyString.cpp +1659 -0
  598. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyString.h +868 -0
  599. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyTypes.h +35 -0
  600. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyUnknown.h +17 -0
  601. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyVector.cpp +3 -0
  602. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyVector.h +634 -0
  603. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyWindows.cpp +145 -0
  604. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/MyWindows.h +231 -0
  605. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/NewHandler.cpp +163 -0
  606. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/NewHandler.h +88 -0
  607. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Sha256Reg.cpp +40 -0
  608. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdAfx.h +8 -0
  609. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdInStream.cpp +89 -0
  610. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdInStream.h +38 -0
  611. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdOutStream.cpp +163 -0
  612. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StdOutStream.h +71 -0
  613. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringConvert.cpp +319 -0
  614. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringConvert.h +88 -0
  615. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringToInt.cpp +144 -0
  616. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/StringToInt.h +21 -0
  617. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/TextConfig.cpp +124 -0
  618. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/TextConfig.h +19 -0
  619. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/UTFConvert.cpp +288 -0
  620. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/UTFConvert.h +12 -0
  621. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Wildcard.cpp +676 -0
  622. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/Wildcard.h +149 -0
  623. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/XzCrc64Init.cpp +7 -0
  624. package/harmony/pushy/src/main/cpp/lzma/CPP/Common/XzCrc64Reg.cpp +42 -0
  625. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/COM.h +70 -0
  626. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/CommonDialog.cpp +185 -0
  627. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/CommonDialog.h +23 -0
  628. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ComboBox.cpp +66 -0
  629. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ComboBox.h +65 -0
  630. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/CommandBar.h +52 -0
  631. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Dialog.cpp +251 -0
  632. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Dialog.h +170 -0
  633. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Edit.h +19 -0
  634. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ImageList.cpp +10 -0
  635. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ImageList.h +87 -0
  636. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ListView.cpp +155 -0
  637. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ListView.h +146 -0
  638. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ProgressBar.h +35 -0
  639. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/PropertyPage.cpp +143 -0
  640. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/PropertyPage.h +50 -0
  641. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ReBar.h +34 -0
  642. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Static.h +28 -0
  643. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/StatusBar.h +42 -0
  644. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/StdAfx.h +8 -0
  645. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/ToolBar.h +43 -0
  646. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Trackbar.h +27 -0
  647. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Window2.cpp +200 -0
  648. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Control/Window2.h +51 -0
  649. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/DLL.cpp +109 -0
  650. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/DLL.h +58 -0
  651. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Defs.h +17 -0
  652. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ErrorMsg.cpp +66 -0
  653. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ErrorMsg.h +15 -0
  654. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileDir.cpp +714 -0
  655. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileDir.h +117 -0
  656. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileFind.cpp +749 -0
  657. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileFind.h +161 -0
  658. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileIO.cpp +432 -0
  659. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileIO.h +212 -0
  660. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileLink.cpp +440 -0
  661. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileMapping.cpp +12 -0
  662. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileMapping.h +66 -0
  663. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileName.cpp +839 -0
  664. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileName.h +115 -0
  665. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileSystem.cpp +131 -0
  666. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/FileSystem.h +27 -0
  667. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Handle.h +37 -0
  668. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/MemoryLock.cpp +112 -0
  669. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/MemoryLock.h +40 -0
  670. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/NtCheck.h +46 -0
  671. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariant.cpp +347 -0
  672. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariant.h +114 -0
  673. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariantConv.cpp +138 -0
  674. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/PropVariantConv.h +37 -0
  675. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Registry.cpp +390 -0
  676. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Registry.h +84 -0
  677. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ResourceString.cpp +103 -0
  678. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/ResourceString.h +16 -0
  679. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/SecurityUtils.cpp +181 -0
  680. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/SecurityUtils.h +167 -0
  681. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Shell.cpp +358 -0
  682. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Shell.h +94 -0
  683. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/StdAfx.h +8 -0
  684. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Synchronization.cpp +10 -0
  685. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Synchronization.h +164 -0
  686. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/System.cpp +142 -0
  687. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/System.h +40 -0
  688. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Thread.h +38 -0
  689. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/TimeUtils.cpp +213 -0
  690. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/TimeUtils.h +32 -0
  691. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Window.cpp +179 -0
  692. package/harmony/pushy/src/main/cpp/lzma/CPP/Windows/Window.h +284 -0
  693. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Common/CRC.cs +55 -0
  694. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Common/CommandLineParser.cs +274 -0
  695. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Common/InBuffer.cs +72 -0
  696. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Common/OutBuffer.cs +47 -0
  697. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZ/IMatchFinder.cs +24 -0
  698. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZ/LzBinTree.cs +367 -0
  699. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZ/LzInWindow.cs +132 -0
  700. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZ/LzOutWindow.cs +110 -0
  701. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZMA/LzmaBase.cs +76 -0
  702. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZMA/LzmaDecoder.cs +398 -0
  703. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LZMA/LzmaEncoder.cs +1480 -0
  704. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.cs +364 -0
  705. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.csproj +90 -0
  706. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaAlone.sln +20 -0
  707. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/LzmaBench.cs +340 -0
  708. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/Properties/AssemblyInfo.cs +29 -0
  709. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/Properties/Resources.cs +70 -0
  710. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/LzmaAlone/Properties/Settings.cs +42 -0
  711. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/RangeCoder/RangeCoder.cs +234 -0
  712. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/RangeCoder/RangeCoderBit.cs +117 -0
  713. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/Compress/RangeCoder/RangeCoderBitTree.cs +157 -0
  714. package/harmony/pushy/src/main/cpp/lzma/CS/7zip/ICoder.cs +157 -0
  715. package/harmony/pushy/src/main/cpp/lzma/DOC/7zC.txt +187 -0
  716. package/harmony/pushy/src/main/cpp/lzma/DOC/7zFormat.txt +469 -0
  717. package/harmony/pushy/src/main/cpp/lzma/DOC/Methods.txt +173 -0
  718. package/harmony/pushy/src/main/cpp/lzma/DOC/installer.txt +166 -0
  719. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma-history.txt +446 -0
  720. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma-sdk.txt +357 -0
  721. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma-specification.txt +1176 -0
  722. package/harmony/pushy/src/main/cpp/lzma/DOC/lzma.txt +328 -0
  723. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/CRC.java +52 -0
  724. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZ/BinTree.java +382 -0
  725. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZ/InWindow.java +131 -0
  726. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZ/OutWindow.java +85 -0
  727. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZMA/Base.java +88 -0
  728. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZMA/Decoder.java +329 -0
  729. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/LZMA/Encoder.java +1416 -0
  730. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeDecoder.java +55 -0
  731. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/BitTreeEncoder.java +99 -0
  732. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/Decoder.java +88 -0
  733. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/Compression/RangeCoder/Encoder.java +151 -0
  734. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/ICodeProgress.java +6 -0
  735. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/LzmaAlone.java +253 -0
  736. package/harmony/pushy/src/main/cpp/lzma/Java/SevenZip/LzmaBench.java +392 -0
  737. package/harmony/pushy/src/main/cpp/lzma/bin/7zS2.sfx +0 -0
  738. package/harmony/pushy/src/main/cpp/lzma/bin/7zS2con.sfx +0 -0
  739. package/harmony/pushy/src/main/cpp/lzma/bin/7zSD.sfx +0 -0
  740. package/harmony/pushy/src/main/cpp/lzma/bin/7zdec.exe +0 -0
  741. package/harmony/pushy/src/main/cpp/lzma/bin/7zr.exe +0 -0
  742. package/harmony/pushy/src/main/cpp/lzma/bin/installer/config.txt +5 -0
  743. package/harmony/pushy/src/main/cpp/lzma/bin/installer/cr.bat +5 -0
  744. package/harmony/pushy/src/main/cpp/lzma/bin/lzma.exe +0 -0
  745. package/harmony/pushy/src/main/cpp/lzma/bin/x64/7zr.exe +0 -0
  746. package/package.json +1 -1
@@ -0,0 +1,3553 @@
1
+ // OpenArchive.cpp
2
+
3
+ #include "StdAfx.h"
4
+
5
+ // #define SHOW_DEBUG_INFO
6
+
7
+ #ifdef SHOW_DEBUG_INFO
8
+ #include <stdio.h>
9
+ #endif
10
+
11
+ #include "../../../../C/CpuArch.h"
12
+
13
+ #include "../../../Common/ComTry.h"
14
+ #include "../../../Common/IntToString.h"
15
+ #include "../../../Common/StringConvert.h"
16
+ #include "../../../Common/StringToInt.h"
17
+ #include "../../../Common/Wildcard.h"
18
+
19
+ #include "../../../Windows/FileDir.h"
20
+
21
+ #include "../../Common/FileStreams.h"
22
+ #include "../../Common/LimitedStreams.h"
23
+ #include "../../Common/ProgressUtils.h"
24
+ #include "../../Common/StreamUtils.h"
25
+
26
+ #include "../../Compress/CopyCoder.h"
27
+
28
+ #include "DefaultName.h"
29
+ #include "OpenArchive.h"
30
+
31
+ #ifndef _SFX
32
+ #include "SetProperties.h"
33
+ #endif
34
+
35
+ #ifdef SHOW_DEBUG_INFO
36
+ #define PRF(x) x
37
+ #else
38
+ #define PRF(x)
39
+ #endif
40
+
41
+ // increase it, if you need to support larger SFX stubs
42
+ static const UInt64 kMaxCheckStartPosition = 1 << 23;
43
+
44
+ /*
45
+ Open:
46
+ - formatIndex >= 0 (exact Format)
47
+ 1) Open with main type. Archive handler is allowed to use archive start finder.
48
+ Warning, if there is tail.
49
+
50
+ - formatIndex = -1 (Parser:0) (default)
51
+ - same as #1 but doesn't return Parser
52
+
53
+ - formatIndex = -2 (#1)
54
+ - file has supported extension (like a.7z)
55
+ Open with that main type (only starting from start of file).
56
+ - open OK:
57
+ - if there is no tail - return OK
58
+ - if there is tail:
59
+ - archive is not "Self Exe" - return OK with Warning, that there is tail
60
+ - archive is "Self Exe"
61
+ ignore "Self Exe" stub, and tries to open tail
62
+ - tail can be open as archive - shows that archive and stub size property.
63
+ - tail can't be open as archive - shows Parser ???
64
+ - open FAIL:
65
+ Try to open with all other types from offset 0 only.
66
+ If some open type is OK and physical archive size is uequal or larger
67
+ than file size, then return that archive with warning that can not be open as [extension type].
68
+ If extension was EXE, it will try to open as unknown_extension case
69
+ - file has unknown extension (like a.hhh)
70
+ It tries to open via parser code.
71
+ - if there is full archive or tail archive and unknown block or "Self Exe"
72
+ at front, it shows tail archive and stub size property.
73
+ - in another cases, if there is some archive inside file, it returns parser/
74
+ - in another cases, it retuens S_FALSE
75
+
76
+
77
+ - formatIndex = -3 (#2)
78
+ - same as #1, but
79
+ - stub (EXE) + archive is open in Parser
80
+
81
+ - formatIndex = -4 (#3)
82
+ - returns only Parser. skip full file archive. And show other sub-archives
83
+
84
+ - formatIndex = -5 (#4)
85
+ - returns only Parser. skip full file archive. And show other sub-archives for each byte pos
86
+
87
+ */
88
+
89
+
90
+
91
+
92
+ using namespace NWindows;
93
+
94
+ /*
95
+ #ifdef _SFX
96
+ #define OPEN_PROPS_PARAM
97
+ #else
98
+ #define OPEN_PROPS_PARAM , props
99
+ #endif
100
+ */
101
+
102
+ /*
103
+ CArc::~CArc()
104
+ {
105
+ GetRawProps.Release();
106
+ Archive.Release();
107
+ printf("\nCArc::~CArc()\n");
108
+ }
109
+ */
110
+
111
+ #ifndef _SFX
112
+
113
+ namespace NArchive {
114
+ namespace NParser {
115
+
116
+ struct CParseItem
117
+ {
118
+ UInt64 Offset;
119
+ UInt64 Size;
120
+ // UInt64 OkSize;
121
+ UString Name;
122
+ UString Extension;
123
+ FILETIME FileTime;
124
+ UString Comment;
125
+ UString ArcType;
126
+
127
+ bool FileTime_Defined;
128
+ bool UnpackSize_Defined;
129
+ bool NumSubDirs_Defined;
130
+ bool NumSubFiles_Defined;
131
+
132
+ bool IsSelfExe;
133
+ bool IsNotArcType;
134
+
135
+ UInt64 UnpackSize;
136
+ UInt64 NumSubDirs;
137
+ UInt64 NumSubFiles;
138
+
139
+ int FormatIndex;
140
+
141
+ bool LenIsUnknown;
142
+
143
+ CParseItem():
144
+ LenIsUnknown(false),
145
+ FileTime_Defined(false),
146
+ UnpackSize_Defined(false),
147
+ NumSubFiles_Defined(false),
148
+ NumSubDirs_Defined(false),
149
+ IsSelfExe(false),
150
+ IsNotArcType(false)
151
+ // OkSize(0)
152
+ {}
153
+
154
+ /*
155
+ bool IsEqualTo(const CParseItem &item) const
156
+ {
157
+ return Offset == item.Offset && Size == item.Size;
158
+ }
159
+ */
160
+
161
+ void NormalizeOffset()
162
+ {
163
+ if ((Int64)Offset < 0)
164
+ {
165
+ Size += Offset;
166
+ // OkSize += Offset;
167
+ Offset = 0;
168
+ }
169
+ }
170
+ };
171
+
172
+ class CHandler:
173
+ public IInArchive,
174
+ public IInArchiveGetStream,
175
+ public CMyUnknownImp
176
+ {
177
+ public:
178
+ CObjectVector<CParseItem> _items;
179
+ UInt64 _maxEndOffset;
180
+ CMyComPtr<IInStream> _stream;
181
+
182
+ MY_UNKNOWN_IMP2(
183
+ IInArchive,
184
+ IInArchiveGetStream)
185
+
186
+ INTERFACE_IInArchive(;)
187
+ STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
188
+
189
+ UInt64 GetLastEnd() const
190
+ {
191
+ if (_items.IsEmpty())
192
+ return 0;
193
+ const CParseItem &back = _items.Back();
194
+ return back.Offset + back.Size;
195
+ }
196
+
197
+ void AddUnknownItem(UInt64 next);
198
+ int FindInsertPos(const CParseItem &item) const;
199
+ void AddItem(const CParseItem &item);
200
+
201
+ CHandler(): _maxEndOffset(0) {}
202
+ };
203
+
204
+ int CHandler::FindInsertPos(const CParseItem &item) const
205
+ {
206
+ unsigned left = 0, right = _items.Size();
207
+ while (left != right)
208
+ {
209
+ unsigned mid = (left + right) / 2;
210
+ const CParseItem & midItem = _items[mid];
211
+ if (item.Offset < midItem.Offset)
212
+ right = mid;
213
+ else if (item.Offset > midItem.Offset)
214
+ left = mid + 1;
215
+ else if (item.Size < midItem.Size)
216
+ right = mid;
217
+ else if (item.Size > midItem.Size)
218
+ left = mid + 1;
219
+ else
220
+ {
221
+ left = mid + 1;
222
+ // return -1;
223
+ }
224
+ }
225
+ return left;
226
+ }
227
+
228
+ void CHandler::AddUnknownItem(UInt64 next)
229
+ {
230
+ /*
231
+ UInt64 prevEnd = 0;
232
+ if (!_items.IsEmpty())
233
+ {
234
+ const CParseItem &back = _items.Back();
235
+ prevEnd = back.Offset + back.Size;
236
+ }
237
+ */
238
+ if (_maxEndOffset < next)
239
+ {
240
+ CParseItem item2;
241
+ item2.Offset = _maxEndOffset;
242
+ item2.Size = next - _maxEndOffset;
243
+ _maxEndOffset = next;
244
+ _items.Add(item2);
245
+ }
246
+ else if (_maxEndOffset > next && !_items.IsEmpty())
247
+ {
248
+ CParseItem &back = _items.Back();
249
+ if (back.LenIsUnknown)
250
+ {
251
+ back.Size = next - back.Offset;
252
+ _maxEndOffset = next;
253
+ }
254
+ }
255
+ }
256
+
257
+ void CHandler::AddItem(const CParseItem &item)
258
+ {
259
+ AddUnknownItem(item.Offset);
260
+ int pos = FindInsertPos(item);
261
+ if (pos >= 0)
262
+ {
263
+ _items.Insert(pos, item);
264
+ UInt64 next = item.Offset + item.Size;
265
+ if (_maxEndOffset < next)
266
+ _maxEndOffset = next;
267
+ }
268
+ }
269
+
270
+ /*
271
+ static const CStatProp kProps[] =
272
+ {
273
+ { NULL, kpidPath, VT_BSTR},
274
+ { NULL, kpidSize, VT_UI8},
275
+ { NULL, kpidMTime, VT_FILETIME},
276
+ { NULL, kpidType, VT_BSTR},
277
+ { NULL, kpidComment, VT_BSTR},
278
+ { NULL, kpidOffset, VT_UI8},
279
+ { NULL, kpidUnpackSize, VT_UI8},
280
+ // { NULL, kpidNumSubDirs, VT_UI8},
281
+ };
282
+ */
283
+
284
+ static const Byte kProps[] =
285
+ {
286
+ kpidPath,
287
+ kpidSize,
288
+ kpidMTime,
289
+ kpidType,
290
+ kpidComment,
291
+ kpidOffset,
292
+ kpidUnpackSize
293
+ };
294
+
295
+ IMP_IInArchive_Props
296
+ IMP_IInArchive_ArcProps_NO
297
+
298
+ STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 *, IArchiveOpenCallback * /* openArchiveCallback */)
299
+ {
300
+ COM_TRY_BEGIN
301
+ {
302
+ Close();
303
+ _stream = stream;
304
+ }
305
+ return S_OK;
306
+ COM_TRY_END
307
+ }
308
+
309
+ STDMETHODIMP CHandler::Close()
310
+ {
311
+ _items.Clear();
312
+ _stream.Release();
313
+ return S_OK;
314
+ }
315
+
316
+ STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
317
+ {
318
+ *numItems = _items.Size();
319
+ return S_OK;
320
+ }
321
+
322
+ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
323
+ {
324
+ COM_TRY_BEGIN
325
+ NCOM::CPropVariant prop;
326
+
327
+ const CParseItem &item = _items[index];
328
+
329
+ switch (propID)
330
+ {
331
+ case kpidPath:
332
+ {
333
+ char sz[32];
334
+ ConvertUInt32ToString(index + 1, sz);
335
+ UString s(sz);
336
+ if (!item.Name.IsEmpty())
337
+ {
338
+ s += '.';
339
+ s += item.Name;
340
+ }
341
+ if (!item.Extension.IsEmpty())
342
+ {
343
+ s += '.';
344
+ s += item.Extension;
345
+ }
346
+ prop = s; break;
347
+ }
348
+ case kpidSize:
349
+ case kpidPackSize: prop = item.Size; break;
350
+ case kpidOffset: prop = item.Offset; break;
351
+ case kpidUnpackSize: if (item.UnpackSize_Defined) prop = item.UnpackSize; break;
352
+ case kpidNumSubFiles: if (item.NumSubFiles_Defined) prop = item.NumSubFiles; break;
353
+ case kpidNumSubDirs: if (item.NumSubDirs_Defined) prop = item.NumSubDirs; break;
354
+ case kpidMTime: if (item.FileTime_Defined) prop = item.FileTime; break;
355
+ case kpidComment: if (!item.Comment.IsEmpty()) prop = item.Comment; break;
356
+ case kpidType: if (!item.ArcType.IsEmpty()) prop = item.ArcType; break;
357
+ }
358
+ prop.Detach(value);
359
+ return S_OK;
360
+ COM_TRY_END
361
+ }
362
+
363
+ HRESULT CHandler::Extract(const UInt32 *indices, UInt32 numItems,
364
+ Int32 testMode, IArchiveExtractCallback *extractCallback)
365
+ {
366
+ COM_TRY_BEGIN
367
+
368
+ bool allFilesMode = (numItems == (UInt32)(Int32)-1);
369
+ if (allFilesMode)
370
+ numItems = _items.Size();
371
+ if (_stream && numItems == 0)
372
+ return S_OK;
373
+ UInt64 totalSize = 0;
374
+ UInt32 i;
375
+ for (i = 0; i < numItems; i++)
376
+ totalSize += _items[allFilesMode ? i : indices[i]].Size;
377
+ extractCallback->SetTotal(totalSize);
378
+
379
+ totalSize = 0;
380
+
381
+ CLocalProgress *lps = new CLocalProgress;
382
+ CMyComPtr<ICompressProgressInfo> progress = lps;
383
+ lps->Init(extractCallback, false);
384
+
385
+ CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
386
+ CMyComPtr<ISequentialInStream> inStream(streamSpec);
387
+ streamSpec->SetStream(_stream);
388
+
389
+ CLimitedSequentialOutStream *outStreamSpec = new CLimitedSequentialOutStream;
390
+ CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
391
+
392
+ NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
393
+ CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
394
+
395
+ for (i = 0; i < numItems; i++)
396
+ {
397
+ lps->InSize = totalSize;
398
+ lps->OutSize = totalSize;
399
+ RINOK(lps->SetCur());
400
+ CMyComPtr<ISequentialOutStream> realOutStream;
401
+ Int32 askMode = testMode ?
402
+ NExtract::NAskMode::kTest :
403
+ NExtract::NAskMode::kExtract;
404
+ Int32 index = allFilesMode ? i : indices[i];
405
+ const CParseItem &item = _items[index];
406
+
407
+ RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
408
+ UInt64 unpackSize = item.Size;
409
+ totalSize += unpackSize;
410
+ bool skipMode = false;
411
+ if (!testMode && !realOutStream)
412
+ continue;
413
+ RINOK(extractCallback->PrepareOperation(askMode));
414
+
415
+ outStreamSpec->SetStream(realOutStream);
416
+ realOutStream.Release();
417
+ outStreamSpec->Init(skipMode ? 0 : unpackSize, true);
418
+
419
+ Int32 opRes = NExtract::NOperationResult::kOK;
420
+ RINOK(_stream->Seek(item.Offset, STREAM_SEEK_SET, NULL));
421
+ streamSpec->Init(unpackSize);
422
+ RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
423
+
424
+ if (outStreamSpec->GetRem() != 0)
425
+ opRes = NExtract::NOperationResult::kDataError;
426
+ outStreamSpec->ReleaseStream();
427
+ RINOK(extractCallback->SetOperationResult(opRes));
428
+ }
429
+
430
+ return S_OK;
431
+
432
+ COM_TRY_END
433
+ }
434
+
435
+
436
+ STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
437
+ {
438
+ COM_TRY_BEGIN
439
+ const CParseItem &item = _items[index];
440
+ return CreateLimitedInStream(_stream, item.Offset, item.Size, stream);
441
+ COM_TRY_END
442
+ }
443
+
444
+ }}
445
+
446
+ #endif
447
+
448
+ HRESULT Archive_GetItemBoolProp(IInArchive *arc, UInt32 index, PROPID propID, bool &result) throw()
449
+ {
450
+ NCOM::CPropVariant prop;
451
+ result = false;
452
+ RINOK(arc->GetProperty(index, propID, &prop));
453
+ if (prop.vt == VT_BOOL)
454
+ result = VARIANT_BOOLToBool(prop.boolVal);
455
+ else if (prop.vt != VT_EMPTY)
456
+ return E_FAIL;
457
+ return S_OK;
458
+ }
459
+
460
+ HRESULT Archive_IsItem_Dir(IInArchive *arc, UInt32 index, bool &result) throw()
461
+ {
462
+ return Archive_GetItemBoolProp(arc, index, kpidIsDir, result);
463
+ }
464
+
465
+ HRESULT Archive_IsItem_Aux(IInArchive *arc, UInt32 index, bool &result) throw()
466
+ {
467
+ return Archive_GetItemBoolProp(arc, index, kpidIsAux, result);
468
+ }
469
+
470
+ HRESULT Archive_IsItem_AltStream(IInArchive *arc, UInt32 index, bool &result) throw()
471
+ {
472
+ return Archive_GetItemBoolProp(arc, index, kpidIsAltStream, result);
473
+ }
474
+
475
+ HRESULT Archive_IsItem_Deleted(IInArchive *arc, UInt32 index, bool &result) throw()
476
+ {
477
+ return Archive_GetItemBoolProp(arc, index, kpidIsDeleted, result);
478
+ }
479
+
480
+ static HRESULT Archive_GetArcBoolProp(IInArchive *arc, PROPID propid, bool &result) throw()
481
+ {
482
+ NCOM::CPropVariant prop;
483
+ result = false;
484
+ RINOK(arc->GetArchiveProperty(propid, &prop));
485
+ if (prop.vt == VT_BOOL)
486
+ result = VARIANT_BOOLToBool(prop.boolVal);
487
+ else if (prop.vt != VT_EMPTY)
488
+ return E_FAIL;
489
+ return S_OK;
490
+ }
491
+
492
+ static HRESULT Archive_GetArcProp_UInt(IInArchive *arc, PROPID propid, UInt64 &result, bool &defined)
493
+ {
494
+ defined = false;
495
+ NCOM::CPropVariant prop;
496
+ RINOK(arc->GetArchiveProperty(propid, &prop));
497
+ switch (prop.vt)
498
+ {
499
+ case VT_UI4: result = prop.ulVal; defined = true; break;
500
+ case VT_I4: result = (Int64)prop.lVal; defined = true; break;
501
+ case VT_UI8: result = (UInt64)prop.uhVal.QuadPart; defined = true; break;
502
+ case VT_I8: result = (UInt64)prop.hVal.QuadPart; defined = true; break;
503
+ case VT_EMPTY: break;
504
+ default: return E_FAIL;
505
+ }
506
+ return S_OK;
507
+ }
508
+
509
+ static HRESULT Archive_GetArcProp_Int(IInArchive *arc, PROPID propid, Int64 &result, bool &defined)
510
+ {
511
+ defined = false;
512
+ NCOM::CPropVariant prop;
513
+ RINOK(arc->GetArchiveProperty(propid, &prop));
514
+ switch (prop.vt)
515
+ {
516
+ case VT_UI4: result = prop.ulVal; defined = true; break;
517
+ case VT_I4: result = prop.lVal; defined = true; break;
518
+ case VT_UI8: result = (Int64)prop.uhVal.QuadPart; defined = true; break;
519
+ case VT_I8: result = (Int64)prop.hVal.QuadPart; defined = true; break;
520
+ case VT_EMPTY: break;
521
+ default: return E_FAIL;
522
+ }
523
+ return S_OK;
524
+ }
525
+
526
+ #ifndef _SFX
527
+
528
+ HRESULT CArc::GetItemPathToParent(UInt32 index, UInt32 parent, UStringVector &parts) const
529
+ {
530
+ if (!GetRawProps)
531
+ return E_FAIL;
532
+ if (index == parent)
533
+ return S_OK;
534
+ UInt32 curIndex = index;
535
+
536
+ UString s;
537
+
538
+ bool prevWasAltStream = false;
539
+
540
+ for (;;)
541
+ {
542
+ #ifdef MY_CPU_LE
543
+ const void *p;
544
+ UInt32 size;
545
+ UInt32 propType;
546
+ RINOK(GetRawProps->GetRawProp(curIndex, kpidName, &p, &size, &propType));
547
+ if (p && propType == PROP_DATA_TYPE_wchar_t_PTR_Z_LE)
548
+ s = (const wchar_t *)p;
549
+ else
550
+ #endif
551
+ {
552
+ NCOM::CPropVariant prop;
553
+ RINOK(Archive->GetProperty(curIndex, kpidName, &prop));
554
+ if (prop.vt == VT_BSTR && prop.bstrVal)
555
+ s.SetFromBstr(prop.bstrVal);
556
+ else if (prop.vt == VT_EMPTY)
557
+ s.Empty();
558
+ else
559
+ return E_FAIL;
560
+ }
561
+
562
+ UInt32 curParent = (UInt32)(Int32)-1;
563
+ UInt32 parentType = 0;
564
+ RINOK(GetRawProps->GetParent(curIndex, &curParent, &parentType));
565
+
566
+ // 18.06: fixed : we don't want to split name to parts
567
+ /*
568
+ if (parentType != NParentType::kAltStream)
569
+ {
570
+ for (;;)
571
+ {
572
+ int pos = s.ReverseFind_PathSepar();
573
+ if (pos < 0)
574
+ {
575
+ break;
576
+ }
577
+ parts.Insert(0, s.Ptr(pos + 1));
578
+ s.DeleteFrom(pos);
579
+ }
580
+ }
581
+ */
582
+
583
+ parts.Insert(0, s);
584
+
585
+ if (prevWasAltStream)
586
+ {
587
+ {
588
+ UString &s2 = parts[parts.Size() - 2];
589
+ s2 += ':';
590
+ s2 += parts.Back();
591
+ }
592
+ parts.DeleteBack();
593
+ }
594
+
595
+ if (parent == curParent)
596
+ return S_OK;
597
+
598
+ prevWasAltStream = false;
599
+ if (parentType == NParentType::kAltStream)
600
+ prevWasAltStream = true;
601
+
602
+ if (curParent == (UInt32)(Int32)-1)
603
+ return E_FAIL;
604
+ curIndex = curParent;
605
+ }
606
+ }
607
+
608
+ #endif
609
+
610
+ HRESULT CArc::GetItemPath(UInt32 index, UString &result) const
611
+ {
612
+ #ifdef MY_CPU_LE
613
+ if (GetRawProps)
614
+ {
615
+ const void *p;
616
+ UInt32 size;
617
+ UInt32 propType;
618
+ if (!IsTree)
619
+ {
620
+ if (GetRawProps->GetRawProp(index, kpidPath, &p, &size, &propType) == S_OK &&
621
+ propType == NPropDataType::kUtf16z)
622
+ {
623
+ unsigned len = size / 2 - 1;
624
+ wchar_t *s = result.GetBuf(len);
625
+ for (unsigned i = 0; i < len; i++)
626
+ {
627
+ wchar_t c = GetUi16(p);
628
+ p = (const void *)((const Byte *)p + 2);
629
+ #if WCHAR_PATH_SEPARATOR != L'/'
630
+ if (c == L'/')
631
+ c = WCHAR_PATH_SEPARATOR;
632
+ #endif
633
+ *s++ = c;
634
+ }
635
+ *s = 0;
636
+ result.ReleaseBuf_SetLen(len);
637
+ if (len != 0)
638
+ return S_OK;
639
+ }
640
+ }
641
+ /*
642
+ else if (GetRawProps->GetRawProp(index, kpidName, &p, &size, &propType) == S_OK &&
643
+ p && propType == NPropDataType::kUtf16z)
644
+ {
645
+ size -= 2;
646
+ UInt32 totalSize = size;
647
+ bool isOK = false;
648
+
649
+ {
650
+ UInt32 index2 = index;
651
+ for (;;)
652
+ {
653
+ UInt32 parent = (UInt32)(Int32)-1;
654
+ UInt32 parentType = 0;
655
+ if (GetRawProps->GetParent(index2, &parent, &parentType) != S_OK)
656
+ break;
657
+ if (parent == (UInt32)(Int32)-1)
658
+ {
659
+ if (parentType != 0)
660
+ totalSize += 2;
661
+ isOK = true;
662
+ break;
663
+ }
664
+ index2 = parent;
665
+ UInt32 size2;
666
+ const void *p2;
667
+ if (GetRawProps->GetRawProp(index2, kpidName, &p2, &size2, &propType) != S_OK &&
668
+ p2 && propType == NPropDataType::kUtf16z)
669
+ break;
670
+ totalSize += size2;
671
+ }
672
+ }
673
+
674
+ if (isOK)
675
+ {
676
+ wchar_t *sz = result.GetBuf_SetEnd(totalSize / 2);
677
+ UInt32 pos = totalSize - size;
678
+ memcpy((Byte *)sz + pos, p, size);
679
+ UInt32 index2 = index;
680
+ for (;;)
681
+ {
682
+ UInt32 parent = (UInt32)(Int32)-1;
683
+ UInt32 parentType = 0;
684
+ if (GetRawProps->GetParent(index2, &parent, &parentType) != S_OK)
685
+ break;
686
+ if (parent == (UInt32)(Int32)-1)
687
+ {
688
+ if (parentType != 0)
689
+ sz[pos / 2 - 1] = L':';
690
+ break;
691
+ }
692
+ index2 = parent;
693
+ UInt32 size2;
694
+ const void *p2;
695
+ if (GetRawProps->GetRawProp(index2, kpidName, &p2, &size2, &propType) != S_OK)
696
+ break;
697
+ pos -= size2;
698
+ memcpy((Byte *)sz + pos, p2, size2);
699
+ sz[(pos + size2 - 2) / 2] = (parentType == 0) ? WCHAR_PATH_SEPARATOR : L':';
700
+ }
701
+ #ifdef _WIN32
702
+ // result.Replace(L'/', WCHAR_PATH_SEPARATOR);
703
+ #endif
704
+ return S_OK;
705
+ }
706
+ }
707
+ */
708
+ }
709
+ #endif
710
+
711
+ {
712
+ NCOM::CPropVariant prop;
713
+ RINOK(Archive->GetProperty(index, kpidPath, &prop));
714
+ if (prop.vt == VT_BSTR && prop.bstrVal)
715
+ result.SetFromBstr(prop.bstrVal);
716
+ else if (prop.vt == VT_EMPTY)
717
+ result.Empty();
718
+ else
719
+ return E_FAIL;
720
+ }
721
+
722
+ if (result.IsEmpty())
723
+ return GetDefaultItemPath(index, result);
724
+ return S_OK;
725
+ }
726
+
727
+ HRESULT CArc::GetDefaultItemPath(UInt32 index, UString &result) const
728
+ {
729
+ result.Empty();
730
+ bool isDir;
731
+ RINOK(Archive_IsItem_Dir(Archive, index, isDir));
732
+ if (!isDir)
733
+ {
734
+ result = DefaultName;
735
+ NCOM::CPropVariant prop;
736
+ RINOK(Archive->GetProperty(index, kpidExtension, &prop));
737
+ if (prop.vt == VT_BSTR)
738
+ {
739
+ result += '.';
740
+ result += prop.bstrVal;
741
+ }
742
+ else if (prop.vt != VT_EMPTY)
743
+ return E_FAIL;
744
+ }
745
+ return S_OK;
746
+ }
747
+
748
+ HRESULT CArc::GetItemPath2(UInt32 index, UString &result) const
749
+ {
750
+ RINOK(GetItemPath(index, result));
751
+ if (Ask_Deleted)
752
+ {
753
+ bool isDeleted = false;
754
+ RINOK(Archive_IsItem_Deleted(Archive, index, isDeleted));
755
+ if (isDeleted)
756
+ result.Insert(0, L"[DELETED]" WSTRING_PATH_SEPARATOR);
757
+ }
758
+ return S_OK;
759
+ }
760
+
761
+ #ifdef SUPPORT_ALT_STREAMS
762
+
763
+ int FindAltStreamColon_in_Path(const wchar_t *path)
764
+ {
765
+ unsigned i = 0;
766
+ int colonPos = -1;
767
+ for (;; i++)
768
+ {
769
+ wchar_t c = path[i];
770
+ if (c == 0)
771
+ return colonPos;
772
+ if (c == ':')
773
+ {
774
+ if (colonPos < 0)
775
+ colonPos = i;
776
+ continue;
777
+ }
778
+ if (c == WCHAR_PATH_SEPARATOR)
779
+ colonPos = -1;
780
+ }
781
+ }
782
+
783
+ #endif
784
+
785
+ HRESULT CArc::GetItem(UInt32 index, CReadArcItem &item) const
786
+ {
787
+ #ifdef SUPPORT_ALT_STREAMS
788
+ item.IsAltStream = false;
789
+ item.AltStreamName.Empty();
790
+ item.MainPath.Empty();
791
+ #endif
792
+
793
+ item.IsDir = false;
794
+ item.Path.Empty();
795
+ item.ParentIndex = (UInt32)(Int32)-1;
796
+
797
+ item.PathParts.Clear();
798
+
799
+ RINOK(Archive_IsItem_Dir(Archive, index, item.IsDir));
800
+ item.MainIsDir = item.IsDir;
801
+
802
+ RINOK(GetItemPath2(index, item.Path));
803
+
804
+ #ifndef _SFX
805
+ UInt32 mainIndex = index;
806
+ #endif
807
+
808
+ #ifdef SUPPORT_ALT_STREAMS
809
+
810
+ item.MainPath = item.Path;
811
+ if (Ask_AltStream)
812
+ {
813
+ RINOK(Archive_IsItem_AltStream(Archive, index, item.IsAltStream));
814
+ }
815
+
816
+ bool needFindAltStream = false;
817
+
818
+ if (item.IsAltStream)
819
+ {
820
+ needFindAltStream = true;
821
+ if (GetRawProps)
822
+ {
823
+ UInt32 parentType = 0;
824
+ UInt32 parentIndex;
825
+ RINOK(GetRawProps->GetParent(index, &parentIndex, &parentType));
826
+ if (parentType == NParentType::kAltStream)
827
+ {
828
+ NCOM::CPropVariant prop;
829
+ RINOK(Archive->GetProperty(index, kpidName, &prop));
830
+ if (prop.vt == VT_BSTR && prop.bstrVal)
831
+ item.AltStreamName.SetFromBstr(prop.bstrVal);
832
+ else if (prop.vt != VT_EMPTY)
833
+ return E_FAIL;
834
+ else
835
+ {
836
+ // item.IsAltStream = false;
837
+ }
838
+ /*
839
+ if (item.AltStreamName.IsEmpty())
840
+ item.IsAltStream = false;
841
+ */
842
+
843
+ needFindAltStream = false;
844
+ item.ParentIndex = parentIndex;
845
+ mainIndex = parentIndex;
846
+
847
+ if (parentIndex == (UInt32)(Int32)-1)
848
+ {
849
+ item.MainPath.Empty();
850
+ item.MainIsDir = true;
851
+ }
852
+ else
853
+ {
854
+ RINOK(GetItemPath2(parentIndex, item.MainPath));
855
+ RINOK(Archive_IsItem_Dir(Archive, parentIndex, item.MainIsDir));
856
+ }
857
+ }
858
+ }
859
+ }
860
+
861
+ if (item.WriteToAltStreamIfColon || needFindAltStream)
862
+ {
863
+ /* Good handler must support GetRawProps::GetParent for alt streams.
864
+ So the following code currently is not used */
865
+ int colon = FindAltStreamColon_in_Path(item.Path);
866
+ if (colon >= 0)
867
+ {
868
+ item.MainPath.DeleteFrom(colon);
869
+ item.AltStreamName = item.Path.Ptr(colon + 1);
870
+ item.MainIsDir = (colon == 0 || IsPathSepar(item.Path[(unsigned)colon - 1]));
871
+ item.IsAltStream = true;
872
+ }
873
+ }
874
+
875
+ #endif
876
+
877
+ #ifndef _SFX
878
+ if (item._use_baseParentFolder_mode)
879
+ {
880
+ RINOK(GetItemPathToParent(mainIndex, item._baseParentFolder, item.PathParts));
881
+
882
+ #ifdef SUPPORT_ALT_STREAMS
883
+ if ((item.WriteToAltStreamIfColon || needFindAltStream) && !item.PathParts.IsEmpty())
884
+ {
885
+ int colon;
886
+ {
887
+ UString &s = item.PathParts.Back();
888
+ colon = FindAltStreamColon_in_Path(s);
889
+ if (colon >= 0)
890
+ {
891
+ item.AltStreamName = s.Ptr(colon + 1);
892
+ item.MainIsDir = (colon == 0 || IsPathSepar(s[(unsigned)colon - 1]));
893
+ item.IsAltStream = true;
894
+ s.DeleteFrom(colon);
895
+ }
896
+ }
897
+ if (colon == 0)
898
+ item.PathParts.DeleteBack();
899
+ }
900
+ #endif
901
+
902
+ }
903
+ else
904
+ #endif
905
+ SplitPathToParts(
906
+ #ifdef SUPPORT_ALT_STREAMS
907
+ item.MainPath
908
+ #else
909
+ item.Path
910
+ #endif
911
+ , item.PathParts);
912
+
913
+ return S_OK;
914
+ }
915
+
916
+ #ifndef _SFX
917
+
918
+ static HRESULT Archive_GetItem_Size(IInArchive *archive, UInt32 index, UInt64 &size, bool &defined)
919
+ {
920
+ NCOM::CPropVariant prop;
921
+ defined = false;
922
+ size = 0;
923
+ RINOK(archive->GetProperty(index, kpidSize, &prop));
924
+ switch (prop.vt)
925
+ {
926
+ case VT_UI1: size = prop.bVal; break;
927
+ case VT_UI2: size = prop.uiVal; break;
928
+ case VT_UI4: size = prop.ulVal; break;
929
+ case VT_UI8: size = (UInt64)prop.uhVal.QuadPart; break;
930
+ case VT_EMPTY: return S_OK;
931
+ default: return E_FAIL;
932
+ }
933
+ defined = true;
934
+ return S_OK;
935
+ }
936
+
937
+ #endif
938
+
939
+ HRESULT CArc::GetItemSize(UInt32 index, UInt64 &size, bool &defined) const
940
+ {
941
+ NCOM::CPropVariant prop;
942
+ defined = false;
943
+ size = 0;
944
+ RINOK(Archive->GetProperty(index, kpidSize, &prop));
945
+ switch (prop.vt)
946
+ {
947
+ case VT_UI1: size = prop.bVal; break;
948
+ case VT_UI2: size = prop.uiVal; break;
949
+ case VT_UI4: size = prop.ulVal; break;
950
+ case VT_UI8: size = (UInt64)prop.uhVal.QuadPart; break;
951
+ case VT_EMPTY: return S_OK;
952
+ default: return E_FAIL;
953
+ }
954
+ defined = true;
955
+ return S_OK;
956
+ }
957
+
958
+ HRESULT CArc::GetItemMTime(UInt32 index, FILETIME &ft, bool &defined) const
959
+ {
960
+ NCOM::CPropVariant prop;
961
+ defined = false;
962
+ ft.dwHighDateTime = ft.dwLowDateTime = 0;
963
+ RINOK(Archive->GetProperty(index, kpidMTime, &prop));
964
+ if (prop.vt == VT_FILETIME)
965
+ {
966
+ ft = prop.filetime;
967
+ defined = true;
968
+ }
969
+ else if (prop.vt != VT_EMPTY)
970
+ return E_FAIL;
971
+ else if (MTimeDefined)
972
+ {
973
+ ft = MTime;
974
+ defined = true;
975
+ }
976
+ return S_OK;
977
+ }
978
+
979
+ #ifndef _SFX
980
+
981
+ static inline bool TestSignature(const Byte *p1, const Byte *p2, size_t size)
982
+ {
983
+ for (size_t i = 0; i < size; i++)
984
+ if (p1[i] != p2[i])
985
+ return false;
986
+ return true;
987
+ }
988
+
989
+ static void MakeCheckOrder(CCodecs *codecs,
990
+ CIntVector &orderIndices, unsigned numTypes, CIntVector &orderIndices2,
991
+ const Byte *data, size_t dataSize)
992
+ {
993
+ for (unsigned i = 0; i < numTypes; i++)
994
+ {
995
+ int index = orderIndices[i];
996
+ if (index < 0)
997
+ continue;
998
+ const CArcInfoEx &ai = codecs->Formats[(unsigned)index];
999
+ if (ai.SignatureOffset != 0)
1000
+ {
1001
+ orderIndices2.Add(index);
1002
+ orderIndices[i] = -1;
1003
+ continue;
1004
+ }
1005
+
1006
+ const CObjectVector<CByteBuffer> &sigs = ai.Signatures;
1007
+ FOR_VECTOR (k, sigs)
1008
+ {
1009
+ const CByteBuffer &sig = sigs[k];
1010
+ if (sig.Size() == 0 && dataSize == 0 ||
1011
+ sig.Size() != 0 && sig.Size() <= dataSize &&
1012
+ TestSignature(data, sig, sig.Size()))
1013
+ {
1014
+ orderIndices2.Add(index);
1015
+ orderIndices[i] = -1;
1016
+ break;
1017
+ }
1018
+ }
1019
+ }
1020
+ }
1021
+
1022
+ #endif
1023
+
1024
+ #ifdef UNDER_CE
1025
+ static const unsigned kNumHashBytes = 1;
1026
+ #define HASH_VAL(buf) ((buf)[0])
1027
+ #else
1028
+ static const unsigned kNumHashBytes = 2;
1029
+ // #define HASH_VAL(buf) ((buf)[0] | ((UInt32)(buf)[1] << 8))
1030
+ #define HASH_VAL(buf) GetUi16(buf)
1031
+ #endif
1032
+
1033
+
1034
+ #ifndef _SFX
1035
+
1036
+ static bool IsExeExt(const UString &ext)
1037
+ {
1038
+ return ext.IsEqualTo_Ascii_NoCase("exe");
1039
+ }
1040
+
1041
+ static const char * const k_PreArcFormats[] =
1042
+ {
1043
+ "pe"
1044
+ , "elf"
1045
+ , "macho"
1046
+ , "mub"
1047
+ , "te"
1048
+ };
1049
+
1050
+ static bool IsNameFromList(const UString &s, const char * const names[], size_t num)
1051
+ {
1052
+ for (unsigned i = 0; i < num; i++)
1053
+ if (StringsAreEqualNoCase_Ascii(s, names[i]))
1054
+ return true;
1055
+ return false;
1056
+ }
1057
+
1058
+
1059
+ static bool IsPreArcFormat(const CArcInfoEx &ai)
1060
+ {
1061
+ if (ai.Flags_PreArc())
1062
+ return true;
1063
+ return IsNameFromList(ai.Name, k_PreArcFormats, ARRAY_SIZE(k_PreArcFormats));
1064
+ }
1065
+
1066
+ static const char * const k_Formats_with_simple_signuature[] =
1067
+ {
1068
+ "7z"
1069
+ , "xz"
1070
+ , "rar"
1071
+ , "bzip2"
1072
+ , "gzip"
1073
+ , "cab"
1074
+ , "wim"
1075
+ , "rpm"
1076
+ , "vhd"
1077
+ , "xar"
1078
+ };
1079
+
1080
+ static bool IsNewStyleSignature(const CArcInfoEx &ai)
1081
+ {
1082
+ // if (ai.Version >= 0x91F)
1083
+ if (ai.NewInterface)
1084
+ return true;
1085
+ return IsNameFromList(ai.Name, k_Formats_with_simple_signuature, ARRAY_SIZE(k_Formats_with_simple_signuature));
1086
+ }
1087
+
1088
+ class CArchiveOpenCallback_Offset:
1089
+ public IArchiveOpenCallback,
1090
+ public IArchiveOpenVolumeCallback,
1091
+ #ifndef _NO_CRYPTO
1092
+ public ICryptoGetTextPassword,
1093
+ #endif
1094
+ public CMyUnknownImp
1095
+ {
1096
+ public:
1097
+ CMyComPtr<IArchiveOpenCallback> Callback;
1098
+ CMyComPtr<IArchiveOpenVolumeCallback> OpenVolumeCallback;
1099
+ UInt64 Files;
1100
+ UInt64 Offset;
1101
+
1102
+ #ifndef _NO_CRYPTO
1103
+ CMyComPtr<ICryptoGetTextPassword> GetTextPassword;
1104
+ #endif
1105
+
1106
+ MY_QUERYINTERFACE_BEGIN2(IArchiveOpenCallback)
1107
+ MY_QUERYINTERFACE_ENTRY(IArchiveOpenVolumeCallback)
1108
+ #ifndef _NO_CRYPTO
1109
+ MY_QUERYINTERFACE_ENTRY(ICryptoGetTextPassword)
1110
+ #endif
1111
+ MY_QUERYINTERFACE_END
1112
+ MY_ADDREF_RELEASE
1113
+
1114
+ INTERFACE_IArchiveOpenCallback(;)
1115
+ INTERFACE_IArchiveOpenVolumeCallback(;)
1116
+ #ifndef _NO_CRYPTO
1117
+ STDMETHOD(CryptoGetTextPassword)(BSTR *password);
1118
+ #endif
1119
+ };
1120
+
1121
+ #ifndef _NO_CRYPTO
1122
+ STDMETHODIMP CArchiveOpenCallback_Offset::CryptoGetTextPassword(BSTR *password)
1123
+ {
1124
+ COM_TRY_BEGIN
1125
+ if (GetTextPassword)
1126
+ return GetTextPassword->CryptoGetTextPassword(password);
1127
+ return E_NOTIMPL;
1128
+ COM_TRY_END
1129
+ }
1130
+ #endif
1131
+
1132
+ STDMETHODIMP CArchiveOpenCallback_Offset::SetTotal(const UInt64 *, const UInt64 *)
1133
+ {
1134
+ return S_OK;
1135
+ }
1136
+
1137
+ STDMETHODIMP CArchiveOpenCallback_Offset::SetCompleted(const UInt64 *, const UInt64 *bytes)
1138
+ {
1139
+ if (!Callback)
1140
+ return S_OK;
1141
+ UInt64 value = Offset;
1142
+ if (bytes)
1143
+ value += *bytes;
1144
+ return Callback->SetCompleted(&Files, &value);
1145
+ }
1146
+
1147
+ STDMETHODIMP CArchiveOpenCallback_Offset::GetProperty(PROPID propID, PROPVARIANT *value)
1148
+ {
1149
+ if (OpenVolumeCallback)
1150
+ return OpenVolumeCallback->GetProperty(propID, value);
1151
+ NCOM::PropVariant_Clear(value);
1152
+ return S_OK;
1153
+ // return E_NOTIMPL;
1154
+ }
1155
+
1156
+ STDMETHODIMP CArchiveOpenCallback_Offset::GetStream(const wchar_t *name, IInStream **inStream)
1157
+ {
1158
+ if (OpenVolumeCallback)
1159
+ return OpenVolumeCallback->GetStream(name, inStream);
1160
+ return S_FALSE;
1161
+ }
1162
+
1163
+ #endif
1164
+
1165
+
1166
+ UInt32 GetOpenArcErrorFlags(const NCOM::CPropVariant &prop, bool *isDefinedProp)
1167
+ {
1168
+ if (isDefinedProp != NULL)
1169
+ *isDefinedProp = false;
1170
+
1171
+ switch (prop.vt)
1172
+ {
1173
+ case VT_UI8: if (isDefinedProp) *isDefinedProp = true; return (UInt32)prop.uhVal.QuadPart;
1174
+ case VT_UI4: if (isDefinedProp) *isDefinedProp = true; return prop.ulVal;
1175
+ case VT_EMPTY: return 0;
1176
+ default: throw 151199;
1177
+ }
1178
+ }
1179
+
1180
+ void CArcErrorInfo::ClearErrors()
1181
+ {
1182
+ // ErrorFormatIndex = -1; // we don't need to clear ErrorFormatIndex here !!!
1183
+
1184
+ ThereIsTail = false;
1185
+ UnexpecedEnd = false;
1186
+ IgnoreTail = false;
1187
+ // NonZerosTail = false;
1188
+ ErrorFlags_Defined = false;
1189
+ ErrorFlags = 0;
1190
+ WarningFlags = 0;
1191
+ TailSize = 0;
1192
+
1193
+ ErrorMessage.Empty();
1194
+ WarningMessage.Empty();
1195
+ }
1196
+
1197
+ HRESULT CArc::ReadBasicProps(IInArchive *archive, UInt64 startPos, HRESULT openRes)
1198
+ {
1199
+ // OkPhySize_Defined = false;
1200
+ PhySizeDefined = false;
1201
+ PhySize = 0;
1202
+ Offset = 0;
1203
+ AvailPhySize = FileSize - startPos;
1204
+
1205
+ ErrorInfo.ClearErrors();
1206
+ {
1207
+ NCOM::CPropVariant prop;
1208
+ RINOK(archive->GetArchiveProperty(kpidErrorFlags, &prop));
1209
+ ErrorInfo.ErrorFlags = GetOpenArcErrorFlags(prop, &ErrorInfo.ErrorFlags_Defined);
1210
+ }
1211
+ {
1212
+ NCOM::CPropVariant prop;
1213
+ RINOK(archive->GetArchiveProperty(kpidWarningFlags, &prop));
1214
+ ErrorInfo.WarningFlags = GetOpenArcErrorFlags(prop);
1215
+ }
1216
+
1217
+ {
1218
+ NCOM::CPropVariant prop;
1219
+ RINOK(archive->GetArchiveProperty(kpidError, &prop));
1220
+ if (prop.vt != VT_EMPTY)
1221
+ ErrorInfo.ErrorMessage = (prop.vt == VT_BSTR ? prop.bstrVal : L"Unknown error");
1222
+ }
1223
+
1224
+ {
1225
+ NCOM::CPropVariant prop;
1226
+ RINOK(archive->GetArchiveProperty(kpidWarning, &prop));
1227
+ if (prop.vt != VT_EMPTY)
1228
+ ErrorInfo.WarningMessage = (prop.vt == VT_BSTR ? prop.bstrVal : L"Unknown warning");
1229
+ }
1230
+
1231
+ if (openRes == S_OK || ErrorInfo.IsArc_After_NonOpen())
1232
+ {
1233
+ RINOK(Archive_GetArcProp_UInt(archive, kpidPhySize, PhySize, PhySizeDefined));
1234
+ /*
1235
+ RINOK(Archive_GetArcProp_UInt(archive, kpidOkPhySize, OkPhySize, OkPhySize_Defined));
1236
+ if (!OkPhySize_Defined)
1237
+ {
1238
+ OkPhySize_Defined = PhySizeDefined;
1239
+ OkPhySize = PhySize;
1240
+ }
1241
+ */
1242
+
1243
+ bool offsetDefined;
1244
+ RINOK(Archive_GetArcProp_Int(archive, kpidOffset, Offset, offsetDefined));
1245
+
1246
+ Int64 globalOffset = startPos + Offset;
1247
+ AvailPhySize = FileSize - globalOffset;
1248
+ if (PhySizeDefined)
1249
+ {
1250
+ UInt64 endPos = globalOffset + PhySize;
1251
+ if (endPos < FileSize)
1252
+ {
1253
+ AvailPhySize = PhySize;
1254
+ ErrorInfo.ThereIsTail = true;
1255
+ ErrorInfo.TailSize = FileSize - endPos;
1256
+ }
1257
+ else if (endPos > FileSize)
1258
+ ErrorInfo.UnexpecedEnd = true;
1259
+ }
1260
+ }
1261
+
1262
+ return S_OK;
1263
+ }
1264
+
1265
+ /*
1266
+ static PrintNumber(const char *s, int n)
1267
+ {
1268
+ char temp[100];
1269
+ sprintf(temp, "%s %d", s, n);
1270
+ OutputDebugStringA(temp);
1271
+ }
1272
+ */
1273
+
1274
+ HRESULT CArc::PrepareToOpen(const COpenOptions &op, unsigned formatIndex, CMyComPtr<IInArchive> &archive)
1275
+ {
1276
+ // OutputDebugStringA("a1");
1277
+ // PrintNumber("formatIndex", formatIndex);
1278
+
1279
+ RINOK(op.codecs->CreateInArchive(formatIndex, archive));
1280
+ // OutputDebugStringA("a2");
1281
+ if (!archive)
1282
+ return S_OK;
1283
+
1284
+ #ifdef EXTERNAL_CODECS
1285
+ if (op.codecs->NeedSetLibCodecs)
1286
+ {
1287
+ const CArcInfoEx &ai = op.codecs->Formats[formatIndex];
1288
+ if (ai.LibIndex >= 0 ?
1289
+ !op.codecs->Libs[ai.LibIndex].SetCodecs :
1290
+ !op.codecs->Libs.IsEmpty())
1291
+ {
1292
+ CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
1293
+ archive.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
1294
+ if (setCompressCodecsInfo)
1295
+ {
1296
+ RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(op.codecs));
1297
+ }
1298
+ }
1299
+ }
1300
+ #endif
1301
+
1302
+
1303
+ #ifndef _SFX
1304
+
1305
+ const CArcInfoEx &ai = op.codecs->Formats[formatIndex];
1306
+
1307
+ // OutputDebugStringW(ai.Name);
1308
+ // OutputDebugStringA("a3");
1309
+
1310
+ if (ai.Flags_PreArc())
1311
+ {
1312
+ /* we notify parsers that extract executables, that they don't need
1313
+ to open archive, if there is tail after executable (for SFX cases) */
1314
+ CMyComPtr<IArchiveAllowTail> allowTail;
1315
+ archive.QueryInterface(IID_IArchiveAllowTail, (void **)&allowTail);
1316
+ if (allowTail)
1317
+ allowTail->AllowTail(BoolToInt(true));
1318
+ }
1319
+
1320
+ if (op.props)
1321
+ {
1322
+ /*
1323
+ FOR_VECTOR (y, op.props)
1324
+ {
1325
+ const COptionalOpenProperties &optProps = (*op.props)[y];
1326
+ if (optProps.FormatName.IsEmpty() || optProps.FormatName.CompareNoCase(ai.Name) == 0)
1327
+ {
1328
+ RINOK(SetProperties(archive, optProps.Props));
1329
+ break;
1330
+ }
1331
+ }
1332
+ */
1333
+ RINOK(SetProperties(archive, *op.props));
1334
+ }
1335
+
1336
+ #endif
1337
+ return S_OK;
1338
+ }
1339
+
1340
+ #ifndef _SFX
1341
+
1342
+ static HRESULT ReadParseItemProps(IInArchive *archive, const CArcInfoEx &ai, NArchive::NParser::CParseItem &pi)
1343
+ {
1344
+ pi.Extension = ai.GetMainExt();
1345
+ pi.FileTime_Defined = false;
1346
+ pi.ArcType = ai.Name;
1347
+
1348
+ RINOK(Archive_GetArcBoolProp(archive, kpidIsNotArcType, pi.IsNotArcType));
1349
+
1350
+ // RINOK(Archive_GetArcBoolProp(archive, kpidIsSelfExe, pi.IsSelfExe));
1351
+ pi.IsSelfExe = ai.Flags_PreArc();
1352
+
1353
+ {
1354
+ NCOM::CPropVariant prop;
1355
+ RINOK(archive->GetArchiveProperty(kpidMTime, &prop));
1356
+ if (prop.vt == VT_FILETIME)
1357
+ {
1358
+ pi.FileTime_Defined = true;
1359
+ pi.FileTime = prop.filetime;
1360
+ }
1361
+ }
1362
+
1363
+ if (!pi.FileTime_Defined)
1364
+ {
1365
+ NCOM::CPropVariant prop;
1366
+ RINOK(archive->GetArchiveProperty(kpidCTime, &prop));
1367
+ if (prop.vt == VT_FILETIME)
1368
+ {
1369
+ pi.FileTime_Defined = true;
1370
+ pi.FileTime = prop.filetime;
1371
+ }
1372
+ }
1373
+
1374
+ {
1375
+ NCOM::CPropVariant prop;
1376
+ RINOK(archive->GetArchiveProperty(kpidName, &prop));
1377
+ if (prop.vt == VT_BSTR)
1378
+ {
1379
+ pi.Name.SetFromBstr(prop.bstrVal);
1380
+ pi.Extension.Empty();
1381
+ }
1382
+ else
1383
+ {
1384
+ RINOK(archive->GetArchiveProperty(kpidExtension, &prop));
1385
+ if (prop.vt == VT_BSTR)
1386
+ pi.Extension.SetFromBstr(prop.bstrVal);
1387
+ }
1388
+ }
1389
+
1390
+ {
1391
+ NCOM::CPropVariant prop;
1392
+ RINOK(archive->GetArchiveProperty(kpidShortComment, &prop));
1393
+ if (prop.vt == VT_BSTR)
1394
+ pi.Comment.SetFromBstr(prop.bstrVal);
1395
+ }
1396
+
1397
+
1398
+ UInt32 numItems;
1399
+ RINOK(archive->GetNumberOfItems(&numItems));
1400
+
1401
+ // pi.NumSubFiles = numItems;
1402
+ // RINOK(Archive_GetArcProp_UInt(archive, kpidUnpackSize, pi.UnpackSize, pi.UnpackSize_Defined));
1403
+ // if (!pi.UnpackSize_Defined)
1404
+ {
1405
+ pi.NumSubFiles = 0;
1406
+ pi.NumSubDirs = 0;
1407
+ pi.UnpackSize = 0;
1408
+ for (UInt32 i = 0; i < numItems; i++)
1409
+ {
1410
+ UInt64 size = 0;
1411
+ bool defined = false;
1412
+ Archive_GetItem_Size(archive, i, size, defined);
1413
+ if (defined)
1414
+ {
1415
+ pi.UnpackSize_Defined = true;
1416
+ pi.UnpackSize += size;
1417
+ }
1418
+
1419
+ bool isDir = false;
1420
+ Archive_IsItem_Dir(archive, i, isDir);
1421
+ if (isDir)
1422
+ pi.NumSubDirs++;
1423
+ else
1424
+ pi.NumSubFiles++;
1425
+ }
1426
+ if (pi.NumSubDirs != 0)
1427
+ pi.NumSubDirs_Defined = true;
1428
+ pi.NumSubFiles_Defined = true;
1429
+ }
1430
+
1431
+ return S_OK;
1432
+ }
1433
+
1434
+ #endif
1435
+
1436
+ HRESULT CArc::CheckZerosTail(const COpenOptions &op, UInt64 offset)
1437
+ {
1438
+ if (!op.stream)
1439
+ return S_OK;
1440
+ RINOK(op.stream->Seek(offset, STREAM_SEEK_SET, NULL));
1441
+ const UInt32 kBufSize = 1 << 11;
1442
+ Byte buf[kBufSize];
1443
+
1444
+ for (;;)
1445
+ {
1446
+ UInt32 processed = 0;
1447
+ RINOK(op.stream->Read(buf, kBufSize, &processed));
1448
+ if (processed == 0)
1449
+ {
1450
+ // ErrorInfo.NonZerosTail = false;
1451
+ ErrorInfo.IgnoreTail = true;
1452
+ return S_OK;
1453
+ }
1454
+ for (size_t i = 0; i < processed; i++)
1455
+ {
1456
+ if (buf[i] != 0)
1457
+ {
1458
+ // ErrorInfo.IgnoreTail = false;
1459
+ // ErrorInfo.NonZerosTail = true;
1460
+ return S_OK;
1461
+ }
1462
+ }
1463
+ }
1464
+ }
1465
+
1466
+ #ifndef _SFX
1467
+
1468
+ class CExtractCallback_To_OpenCallback:
1469
+ public IArchiveExtractCallback,
1470
+ public ICompressProgressInfo,
1471
+ public CMyUnknownImp
1472
+ {
1473
+ public:
1474
+ CMyComPtr<IArchiveOpenCallback> Callback;
1475
+ UInt64 Files;
1476
+ UInt64 Offset;
1477
+
1478
+ MY_UNKNOWN_IMP2(IArchiveExtractCallback, ICompressProgressInfo)
1479
+ INTERFACE_IArchiveExtractCallback(;)
1480
+ STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
1481
+ void Init(IArchiveOpenCallback *callback)
1482
+ {
1483
+ Callback = callback;
1484
+ Files = 0;
1485
+ Offset = 0;
1486
+ }
1487
+ };
1488
+
1489
+ STDMETHODIMP CExtractCallback_To_OpenCallback::SetTotal(UInt64 /* size */)
1490
+ {
1491
+ return S_OK;
1492
+ }
1493
+
1494
+ STDMETHODIMP CExtractCallback_To_OpenCallback::SetCompleted(const UInt64 * /* completeValue */)
1495
+ {
1496
+ return S_OK;
1497
+ }
1498
+
1499
+ STDMETHODIMP CExtractCallback_To_OpenCallback::SetRatioInfo(const UInt64 *inSize, const UInt64 * /* outSize */)
1500
+ {
1501
+ if (Callback)
1502
+ {
1503
+ UInt64 value = Offset;
1504
+ if (inSize)
1505
+ value += *inSize;
1506
+ return Callback->SetCompleted(&Files, &value);
1507
+ }
1508
+ return S_OK;
1509
+ }
1510
+
1511
+ STDMETHODIMP CExtractCallback_To_OpenCallback::GetStream(UInt32 /* index */, ISequentialOutStream **outStream, Int32 /* askExtractMode */)
1512
+ {
1513
+ *outStream = 0;
1514
+ return S_OK;
1515
+ }
1516
+
1517
+ STDMETHODIMP CExtractCallback_To_OpenCallback::PrepareOperation(Int32 /* askExtractMode */)
1518
+ {
1519
+ return S_OK;
1520
+ }
1521
+
1522
+ STDMETHODIMP CExtractCallback_To_OpenCallback::SetOperationResult(Int32 /* operationResult */)
1523
+ {
1524
+ return S_OK;
1525
+ }
1526
+
1527
+ static HRESULT OpenArchiveSpec(IInArchive *archive, bool needPhySize,
1528
+ IInStream *stream, const UInt64 *maxCheckStartPosition,
1529
+ IArchiveOpenCallback *openCallback,
1530
+ IArchiveExtractCallback *extractCallback)
1531
+ {
1532
+ /*
1533
+ if (needPhySize)
1534
+ {
1535
+ CMyComPtr<IArchiveOpen2> open2;
1536
+ archive->QueryInterface(IID_IArchiveOpen2, (void **)&open2);
1537
+ if (open2)
1538
+ return open2->ArcOpen2(stream, kOpenFlags_RealPhySize, openCallback);
1539
+ }
1540
+ */
1541
+ RINOK(archive->Open(stream, maxCheckStartPosition, openCallback));
1542
+ if (needPhySize)
1543
+ {
1544
+ bool phySize_Defined = false;
1545
+ UInt64 phySize = 0;
1546
+ RINOK(Archive_GetArcProp_UInt(archive, kpidPhySize, phySize, phySize_Defined));
1547
+ if (phySize_Defined)
1548
+ return S_OK;
1549
+
1550
+ bool phySizeCantBeDetected = false;;
1551
+ RINOK(Archive_GetArcBoolProp(archive, kpidPhySizeCantBeDetected, phySizeCantBeDetected));
1552
+
1553
+ if (!phySizeCantBeDetected)
1554
+ {
1555
+ RINOK(archive->Extract(0, (UInt32)(Int32)-1, BoolToInt(true), extractCallback));
1556
+ }
1557
+ }
1558
+ return S_OK;
1559
+ }
1560
+
1561
+ static int FindFormatForArchiveType(CCodecs *codecs, CIntVector orderIndices, const char *name)
1562
+ {
1563
+ FOR_VECTOR (i, orderIndices)
1564
+ if (StringsAreEqualNoCase_Ascii(codecs->Formats[orderIndices[i]].Name, name))
1565
+ return i;
1566
+ return -1;
1567
+ }
1568
+
1569
+ #endif
1570
+
1571
+ HRESULT CArc::OpenStream2(const COpenOptions &op)
1572
+ {
1573
+ // fprintf(stdout, "\nOpen: %S", Path); fflush(stdout);
1574
+
1575
+ Archive.Release();
1576
+ GetRawProps.Release();
1577
+ GetRootProps.Release();
1578
+
1579
+ ErrorInfo.ClearErrors();
1580
+ ErrorInfo.ErrorFormatIndex = -1;
1581
+
1582
+ IsParseArc = false;
1583
+ ArcStreamOffset = 0;
1584
+
1585
+ // OutputDebugStringA("1");
1586
+ // OutputDebugStringW(Path);
1587
+
1588
+ const UString fileName = ExtractFileNameFromPath(Path);
1589
+ UString extension;
1590
+ {
1591
+ int dotPos = fileName.ReverseFind_Dot();
1592
+ if (dotPos >= 0)
1593
+ extension = fileName.Ptr(dotPos + 1);
1594
+ }
1595
+
1596
+ CIntVector orderIndices;
1597
+
1598
+ bool searchMarkerInHandler = false;
1599
+ #ifdef _SFX
1600
+ searchMarkerInHandler = true;
1601
+ #endif
1602
+
1603
+ CBoolArr isMainFormatArr(op.codecs->Formats.Size());
1604
+ {
1605
+ FOR_VECTOR(i, op.codecs->Formats)
1606
+ isMainFormatArr[i] = false;
1607
+ }
1608
+
1609
+ UInt64 maxStartOffset =
1610
+ op.openType.MaxStartOffset_Defined ?
1611
+ op.openType.MaxStartOffset :
1612
+ kMaxCheckStartPosition;
1613
+
1614
+ #ifndef _SFX
1615
+ bool isUnknownExt = false;
1616
+ #endif
1617
+
1618
+ bool isForced = false;
1619
+ unsigned numMainTypes = 0;
1620
+ int formatIndex = op.openType.FormatIndex;
1621
+
1622
+ if (formatIndex >= 0)
1623
+ {
1624
+ isForced = true;
1625
+ orderIndices.Add(formatIndex);
1626
+ numMainTypes = 1;
1627
+ isMainFormatArr[(unsigned)formatIndex] = true;
1628
+
1629
+ searchMarkerInHandler = true;
1630
+ }
1631
+ else
1632
+ {
1633
+ unsigned numFinded = 0;
1634
+ #ifndef _SFX
1635
+ bool isPrearcExt = false;
1636
+ #endif
1637
+
1638
+ {
1639
+ #ifndef _SFX
1640
+
1641
+ bool isZip = false;
1642
+ bool isRar = false;
1643
+
1644
+ const wchar_t c = extension[0];
1645
+ if (c == 'z' || c == 'Z' || c == 'r' || c == 'R')
1646
+ {
1647
+ bool isNumber = false;
1648
+ for (unsigned k = 1;; k++)
1649
+ {
1650
+ const wchar_t d = extension[k];
1651
+ if (d == 0)
1652
+ break;
1653
+ if (d < '0' || d > '9')
1654
+ {
1655
+ isNumber = false;
1656
+ break;
1657
+ }
1658
+ isNumber = true;
1659
+ }
1660
+ if (isNumber)
1661
+ if (c == 'z' || c == 'Z')
1662
+ isZip = true;
1663
+ else
1664
+ isRar = true;
1665
+ }
1666
+
1667
+ #endif
1668
+
1669
+ FOR_VECTOR (i, op.codecs->Formats)
1670
+ {
1671
+ const CArcInfoEx &ai = op.codecs->Formats[i];
1672
+
1673
+ if (IgnoreSplit || !op.openType.CanReturnArc)
1674
+ if (ai.IsSplit())
1675
+ continue;
1676
+ if (op.excludedFormats->FindInSorted(i) >= 0)
1677
+ continue;
1678
+
1679
+ #ifndef _SFX
1680
+ if (IsPreArcFormat(ai))
1681
+ isPrearcExt = true;
1682
+ #endif
1683
+
1684
+ if (ai.FindExtension(extension) >= 0
1685
+ #ifndef _SFX
1686
+ || isZip && StringsAreEqualNoCase_Ascii(ai.Name, "zip")
1687
+ || isRar && StringsAreEqualNoCase_Ascii(ai.Name, "rar")
1688
+ #endif
1689
+ )
1690
+ {
1691
+ // PrintNumber("orderIndices.Insert", i);
1692
+ orderIndices.Insert(numFinded++, i);
1693
+ isMainFormatArr[i] = true;
1694
+ }
1695
+ else
1696
+ orderIndices.Add(i);
1697
+ }
1698
+ }
1699
+
1700
+ if (!op.stream)
1701
+ {
1702
+ if (numFinded != 1)
1703
+ return E_NOTIMPL;
1704
+ orderIndices.DeleteFrom(1);
1705
+ }
1706
+ // PrintNumber("numFinded", numFinded );
1707
+
1708
+ /*
1709
+ if (op.openOnlySpecifiedByExtension)
1710
+ {
1711
+ if (numFinded != 0 && !IsExeExt(extension))
1712
+ orderIndices.DeleteFrom(numFinded);
1713
+ }
1714
+ */
1715
+
1716
+ #ifndef _SFX
1717
+
1718
+ if (op.stream && orderIndices.Size() >= 2)
1719
+ {
1720
+ RINOK(op.stream->Seek(0, STREAM_SEEK_SET, NULL));
1721
+ CByteBuffer byteBuffer;
1722
+ CIntVector orderIndices2;
1723
+ if (numFinded == 0 || IsExeExt(extension))
1724
+ {
1725
+ // signature search was here
1726
+ }
1727
+ else if (extension.IsEqualTo("000") || extension.IsEqualTo("001"))
1728
+ {
1729
+ int i = FindFormatForArchiveType(op.codecs, orderIndices, "rar");
1730
+ if (i >= 0)
1731
+ {
1732
+ const size_t kBufSize = (1 << 10);
1733
+ byteBuffer.Alloc(kBufSize);
1734
+ size_t processedSize = kBufSize;
1735
+ RINOK(ReadStream(op.stream, byteBuffer, &processedSize));
1736
+ if (processedSize >= 16)
1737
+ {
1738
+ const Byte *buf = byteBuffer;
1739
+ const Byte kRarHeader[] = { 0x52 , 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00 };
1740
+ if (TestSignature(buf, kRarHeader, 7) && buf[9] == 0x73 && (buf[10] & 1) != 0)
1741
+ {
1742
+ orderIndices2.Add(orderIndices[i]);
1743
+ orderIndices[i] = -1;
1744
+ if (i >= (int)numFinded)
1745
+ numFinded++;
1746
+ }
1747
+ }
1748
+ }
1749
+ }
1750
+ else
1751
+ {
1752
+ const size_t kBufSize = (1 << 10);
1753
+ byteBuffer.Alloc(kBufSize);
1754
+ size_t processedSize = kBufSize;
1755
+ RINOK(ReadStream(op.stream, byteBuffer, &processedSize));
1756
+ if (processedSize == 0)
1757
+ return S_FALSE;
1758
+
1759
+ /*
1760
+ check type order:
1761
+ 1) matched extension, no signuature
1762
+ 2) matched extension, matched signuature
1763
+ // 3) no signuature
1764
+ // 4) matched signuature
1765
+ */
1766
+
1767
+ MakeCheckOrder(op.codecs, orderIndices, numFinded, orderIndices2, NULL, 0);
1768
+ MakeCheckOrder(op.codecs, orderIndices, numFinded, orderIndices2, byteBuffer, processedSize);
1769
+ // MakeCheckOrder(op.codecs, orderIndices, orderIndices.Size(), orderIndices2, NULL, 0);
1770
+ // MakeCheckOrder(op.codecs, orderIndices, orderIndices.Size(), orderIndices2, byteBuffer, processedSize);
1771
+ }
1772
+
1773
+ FOR_VECTOR (i, orderIndices)
1774
+ {
1775
+ int val = orderIndices[i];
1776
+ if (val != -1)
1777
+ orderIndices2.Add(val);
1778
+ }
1779
+ orderIndices = orderIndices2;
1780
+ }
1781
+
1782
+ if (orderIndices.Size() >= 2)
1783
+ {
1784
+ int iIso = FindFormatForArchiveType(op.codecs, orderIndices, "iso");
1785
+ int iUdf = FindFormatForArchiveType(op.codecs, orderIndices, "udf");
1786
+ if (iUdf > iIso && iIso >= 0)
1787
+ {
1788
+ int isoIndex = orderIndices[iIso];
1789
+ int udfIndex = orderIndices[iUdf];
1790
+ orderIndices[iUdf] = isoIndex;
1791
+ orderIndices[iIso] = udfIndex;
1792
+ }
1793
+ }
1794
+
1795
+ numMainTypes = numFinded;
1796
+ isUnknownExt = (numMainTypes == 0) || isPrearcExt;
1797
+
1798
+ #else // _SFX
1799
+
1800
+ numMainTypes = orderIndices.Size();
1801
+
1802
+ // we need correct numMainTypes for mutlivolume SFX (if some volume is missing)
1803
+ if (numFinded != 0)
1804
+ numMainTypes = numFinded;
1805
+
1806
+ #endif
1807
+ }
1808
+
1809
+ UInt64 fileSize = 0;
1810
+ if (op.stream)
1811
+ {
1812
+ RINOK(op.stream->Seek(0, STREAM_SEEK_END, &fileSize));
1813
+ RINOK(op.stream->Seek(0, STREAM_SEEK_SET, NULL));
1814
+ }
1815
+ FileSize = fileSize;
1816
+
1817
+
1818
+ #ifndef _SFX
1819
+
1820
+ CBoolArr skipFrontalFormat(op.codecs->Formats.Size());
1821
+ {
1822
+ FOR_VECTOR(i, op.codecs->Formats)
1823
+ skipFrontalFormat[i] = false;
1824
+ }
1825
+
1826
+ #endif
1827
+
1828
+ const COpenType &mode = op.openType;
1829
+
1830
+
1831
+
1832
+
1833
+
1834
+ if (mode.CanReturnArc)
1835
+ {
1836
+ // ---------- OPEN main type by extenssion ----------
1837
+
1838
+ unsigned numCheckTypes = orderIndices.Size();
1839
+ if (formatIndex >= 0)
1840
+ numCheckTypes = numMainTypes;
1841
+
1842
+ for (unsigned i = 0; i < numCheckTypes; i++)
1843
+ {
1844
+ FormatIndex = orderIndices[i];
1845
+
1846
+ bool exactOnly = false;
1847
+
1848
+ #ifndef _SFX
1849
+
1850
+ const CArcInfoEx &ai = op.codecs->Formats[FormatIndex];
1851
+ // OutputDebugStringW(ai.Name);
1852
+ if (i >= numMainTypes)
1853
+ {
1854
+ if (!ai.Flags_BackwardOpen()
1855
+ // && !ai.Flags_PureStartOpen()
1856
+ )
1857
+ continue;
1858
+ exactOnly = true;
1859
+ }
1860
+
1861
+ #endif
1862
+
1863
+ // Some handlers do not set total bytes. So we set it here
1864
+ if (op.callback)
1865
+ RINOK(op.callback->SetTotal(NULL, &fileSize));
1866
+
1867
+ if (op.stream)
1868
+ {
1869
+ RINOK(op.stream->Seek(0, STREAM_SEEK_SET, NULL));
1870
+ }
1871
+
1872
+ CMyComPtr<IInArchive> archive;
1873
+
1874
+ RINOK(PrepareToOpen(op, FormatIndex, archive));
1875
+ if (!archive)
1876
+ continue;
1877
+
1878
+ HRESULT result;
1879
+ if (op.stream)
1880
+ {
1881
+ UInt64 searchLimit = (!exactOnly && searchMarkerInHandler) ? maxStartOffset: 0;
1882
+ result = archive->Open(op.stream, &searchLimit, op.callback);
1883
+ }
1884
+ else
1885
+ {
1886
+ CMyComPtr<IArchiveOpenSeq> openSeq;
1887
+ archive.QueryInterface(IID_IArchiveOpenSeq, (void **)&openSeq);
1888
+ if (!openSeq)
1889
+ return E_NOTIMPL;
1890
+ result = openSeq->OpenSeq(op.seqStream);
1891
+ }
1892
+
1893
+ RINOK(ReadBasicProps(archive, 0, result));
1894
+
1895
+ if (result == S_FALSE)
1896
+ {
1897
+ bool isArc = ErrorInfo.IsArc_After_NonOpen();
1898
+
1899
+ #ifndef _SFX
1900
+ // if it's archive, we allow another open attempt for parser
1901
+ if (!mode.CanReturnParser || !isArc)
1902
+ skipFrontalFormat[(unsigned)FormatIndex] = true;
1903
+ #endif
1904
+
1905
+ if (exactOnly)
1906
+ continue;
1907
+
1908
+ if (i == 0 && numMainTypes == 1)
1909
+ {
1910
+ // we set NonOpenErrorInfo, only if there is only one main format (defined by extension).
1911
+ ErrorInfo.ErrorFormatIndex = FormatIndex;
1912
+ NonOpen_ErrorInfo = ErrorInfo;
1913
+
1914
+ if (!mode.CanReturnParser && isArc)
1915
+ {
1916
+ // if (formatIndex < 0 && !searchMarkerInHandler)
1917
+ {
1918
+ // if bad archive was detected, we don't need additional open attempts
1919
+ #ifndef _SFX
1920
+ if (!IsPreArcFormat(ai) /* || !mode.SkipSfxStub */)
1921
+ #endif
1922
+ return S_FALSE;
1923
+ }
1924
+ }
1925
+ }
1926
+
1927
+ /*
1928
+ #ifndef _SFX
1929
+ if (IsExeExt(extension) || ai.Flags_PreArc())
1930
+ {
1931
+ // openOnlyFullArc = false;
1932
+ // canReturnTailArc = true;
1933
+ // limitSignatureSearch = true;
1934
+ }
1935
+ #endif
1936
+ */
1937
+
1938
+ continue;
1939
+ }
1940
+
1941
+ RINOK(result);
1942
+
1943
+ #ifndef _SFX
1944
+
1945
+ bool isMainFormat = isMainFormatArr[(unsigned)FormatIndex];
1946
+ const COpenSpecFlags &specFlags = mode.GetSpec(isForced, isMainFormat, isUnknownExt);
1947
+
1948
+ bool thereIsTail = ErrorInfo.ThereIsTail;
1949
+ if (thereIsTail && mode.ZerosTailIsAllowed)
1950
+ {
1951
+ RINOK(CheckZerosTail(op, Offset + PhySize));
1952
+ if (ErrorInfo.IgnoreTail)
1953
+ thereIsTail = false;
1954
+ }
1955
+
1956
+ if (Offset > 0)
1957
+ {
1958
+ if (exactOnly
1959
+ || !searchMarkerInHandler
1960
+ || !specFlags.CanReturn_NonStart()
1961
+ || (mode.MaxStartOffset_Defined && (UInt64)Offset > mode.MaxStartOffset))
1962
+ continue;
1963
+ }
1964
+ if (thereIsTail)
1965
+ {
1966
+ if (Offset > 0)
1967
+ {
1968
+ if (!specFlags.CanReturnMid)
1969
+ continue;
1970
+ }
1971
+ else if (!specFlags.CanReturnFrontal)
1972
+ continue;
1973
+ }
1974
+
1975
+ if (Offset > 0 || thereIsTail)
1976
+ {
1977
+ if (formatIndex < 0)
1978
+ {
1979
+ if (IsPreArcFormat(ai))
1980
+ {
1981
+ // openOnlyFullArc = false;
1982
+ // canReturnTailArc = true;
1983
+ /*
1984
+ if (mode.SkipSfxStub)
1985
+ limitSignatureSearch = true;
1986
+ */
1987
+ // if (mode.SkipSfxStub)
1988
+ {
1989
+ // skipFrontalFormat[FormatIndex] = true;
1990
+ continue;
1991
+ }
1992
+ }
1993
+ }
1994
+ }
1995
+
1996
+ #endif
1997
+
1998
+ Archive = archive;
1999
+ return S_OK;
2000
+ }
2001
+ }
2002
+
2003
+
2004
+
2005
+ #ifndef _SFX
2006
+
2007
+ if (!op.stream)
2008
+ return S_FALSE;
2009
+
2010
+ if (formatIndex >= 0 && !mode.CanReturnParser)
2011
+ {
2012
+ if (mode.MaxStartOffset_Defined)
2013
+ {
2014
+ if (mode.MaxStartOffset == 0)
2015
+ return S_FALSE;
2016
+ }
2017
+ else
2018
+ {
2019
+ const CArcInfoEx &ai = op.codecs->Formats[(unsigned)formatIndex];
2020
+ if (ai.FindExtension(extension) >= 0)
2021
+ {
2022
+ if (ai.Flags_FindSignature() && searchMarkerInHandler)
2023
+ return S_FALSE;
2024
+ }
2025
+ }
2026
+ }
2027
+
2028
+ NArchive::NParser::CHandler *handlerSpec = new NArchive::NParser::CHandler;
2029
+ CMyComPtr<IInArchive> handler = handlerSpec;
2030
+
2031
+ CExtractCallback_To_OpenCallback *extractCallback_To_OpenCallback_Spec = new CExtractCallback_To_OpenCallback;
2032
+ CMyComPtr<IArchiveExtractCallback> extractCallback_To_OpenCallback = extractCallback_To_OpenCallback_Spec;
2033
+ extractCallback_To_OpenCallback_Spec->Init(op.callback);
2034
+
2035
+ {
2036
+ // ---------- Check all possible START archives ----------
2037
+ // this code is better for full file archives than Parser's code.
2038
+
2039
+ CByteBuffer byteBuffer;
2040
+ bool endOfFile = false;
2041
+ size_t processedSize;
2042
+ {
2043
+ size_t bufSize = 1 << 20; // it must be larger than max signature offset or IsArcFunc offset ((1 << 19) + x for UDF)
2044
+ if (bufSize > fileSize)
2045
+ {
2046
+ bufSize = (size_t)fileSize;
2047
+ endOfFile = true;
2048
+ }
2049
+ byteBuffer.Alloc(bufSize);
2050
+ RINOK(op.stream->Seek(0, STREAM_SEEK_SET, NULL));
2051
+ processedSize = bufSize;
2052
+ RINOK(ReadStream(op.stream, byteBuffer, &processedSize));
2053
+ if (processedSize == 0)
2054
+ return S_FALSE;
2055
+ if (processedSize < bufSize)
2056
+ endOfFile = true;
2057
+ }
2058
+ CUIntVector sortedFormats;
2059
+
2060
+ unsigned i;
2061
+
2062
+ int splitIndex = -1;
2063
+
2064
+ for (i = 0; i < orderIndices.Size(); i++)
2065
+ {
2066
+ unsigned form = orderIndices[i];
2067
+ if (skipFrontalFormat[form])
2068
+ continue;
2069
+ const CArcInfoEx &ai = op.codecs->Formats[form];
2070
+ if (ai.IsSplit())
2071
+ {
2072
+ splitIndex = form;
2073
+ continue;
2074
+ }
2075
+
2076
+ if (ai.IsArcFunc)
2077
+ {
2078
+ UInt32 isArcRes = ai.IsArcFunc(byteBuffer, processedSize);
2079
+ if (isArcRes == k_IsArc_Res_NO)
2080
+ continue;
2081
+ if (isArcRes == k_IsArc_Res_NEED_MORE && endOfFile)
2082
+ continue;
2083
+ // if (isArcRes == k_IsArc_Res_YES_LOW_PROB) continue;
2084
+ sortedFormats.Insert(0, form);
2085
+ continue;
2086
+ }
2087
+
2088
+ bool isNewStyleSignature = IsNewStyleSignature(ai);
2089
+ bool needCheck = !isNewStyleSignature
2090
+ || ai.Signatures.IsEmpty()
2091
+ || ai.Flags_PureStartOpen()
2092
+ || ai.Flags_StartOpen()
2093
+ || ai.Flags_BackwardOpen();
2094
+
2095
+ if (isNewStyleSignature && !ai.Signatures.IsEmpty())
2096
+ {
2097
+ unsigned k;
2098
+ for (k = 0; k < ai.Signatures.Size(); k++)
2099
+ {
2100
+ const CByteBuffer &sig = ai.Signatures[k];
2101
+ UInt32 signatureEnd = ai.SignatureOffset + (UInt32)sig.Size();
2102
+ if (processedSize < signatureEnd)
2103
+ {
2104
+ if (!endOfFile)
2105
+ needCheck = true;
2106
+ }
2107
+ else if (memcmp(sig, byteBuffer + ai.SignatureOffset, sig.Size()) == 0)
2108
+ break;
2109
+ }
2110
+ if (k != ai.Signatures.Size())
2111
+ {
2112
+ sortedFormats.Insert(0, form);
2113
+ continue;
2114
+ }
2115
+ }
2116
+ if (needCheck)
2117
+ sortedFormats.Add(form);
2118
+ }
2119
+
2120
+ if (splitIndex >= 0)
2121
+ sortedFormats.Insert(0, splitIndex);
2122
+
2123
+ for (i = 0; i < sortedFormats.Size(); i++)
2124
+ {
2125
+ FormatIndex = sortedFormats[i];
2126
+ const CArcInfoEx &ai = op.codecs->Formats[FormatIndex];
2127
+
2128
+ if (op.callback)
2129
+ RINOK(op.callback->SetTotal(NULL, &fileSize));
2130
+
2131
+ RINOK(op.stream->Seek(0, STREAM_SEEK_SET, NULL));
2132
+
2133
+ CMyComPtr<IInArchive> archive;
2134
+ RINOK(PrepareToOpen(op, FormatIndex, archive));
2135
+ if (!archive)
2136
+ continue;
2137
+
2138
+ PRF(printf("\nSorted Open %S", (const wchar_t *)ai.Name));
2139
+ HRESULT result;
2140
+ {
2141
+ UInt64 searchLimit = 0;
2142
+ /*
2143
+ if (mode.CanReturnArc)
2144
+ result = archive->Open(op.stream, &searchLimit, op.callback);
2145
+ else
2146
+ */
2147
+ result = OpenArchiveSpec(archive, !mode.CanReturnArc, op.stream, &searchLimit, op.callback, extractCallback_To_OpenCallback);
2148
+ }
2149
+
2150
+ if (result == S_FALSE)
2151
+ {
2152
+ skipFrontalFormat[(unsigned)FormatIndex] = true;
2153
+ // FIXME: maybe we must use LenIsUnknown.
2154
+ // printf(" OpenForSize Error");
2155
+ continue;
2156
+ }
2157
+ RINOK(result);
2158
+
2159
+ RINOK(ReadBasicProps(archive, 0, result));
2160
+
2161
+ if (Offset > 0)
2162
+ {
2163
+ continue; // good handler doesn't return such Offset > 0
2164
+ // but there are some cases like false prefixed PK00 archive, when
2165
+ // we can support it?
2166
+ }
2167
+
2168
+ NArchive::NParser::CParseItem pi;
2169
+ pi.Offset = Offset;
2170
+ pi.Size = AvailPhySize;
2171
+
2172
+ // bool needScan = false;
2173
+
2174
+ if (!PhySizeDefined)
2175
+ {
2176
+ // it's for Z format
2177
+ pi.LenIsUnknown = true;
2178
+ // needScan = true;
2179
+ // phySize = arcRem;
2180
+ // nextNeedCheckStartOpen = false;
2181
+ }
2182
+
2183
+ /*
2184
+ if (OkPhySize_Defined)
2185
+ pi.OkSize = pi.OkPhySize;
2186
+ else
2187
+ pi.OkSize = pi.Size;
2188
+ */
2189
+
2190
+ pi.NormalizeOffset();
2191
+ // printf(" phySize = %8d", (unsigned)phySize);
2192
+
2193
+
2194
+ if (mode.CanReturnArc)
2195
+ {
2196
+ bool isMainFormat = isMainFormatArr[(unsigned)FormatIndex];
2197
+ const COpenSpecFlags &specFlags = mode.GetSpec(isForced, isMainFormat, isUnknownExt);
2198
+ bool openCur = false;
2199
+
2200
+ if (!ErrorInfo.ThereIsTail)
2201
+ openCur = true;
2202
+ else
2203
+ {
2204
+ if (mode.ZerosTailIsAllowed)
2205
+ {
2206
+ RINOK(CheckZerosTail(op, Offset + PhySize));
2207
+ if (ErrorInfo.IgnoreTail)
2208
+ openCur = true;
2209
+ }
2210
+ if (!openCur)
2211
+ {
2212
+ openCur = specFlags.CanReturnFrontal;
2213
+ if (formatIndex < 0) // format is not forced
2214
+ {
2215
+ if (IsPreArcFormat(ai))
2216
+ {
2217
+ // if (mode.SkipSfxStub)
2218
+ {
2219
+ openCur = false;
2220
+ }
2221
+ }
2222
+ }
2223
+ }
2224
+ }
2225
+
2226
+ if (openCur)
2227
+ {
2228
+ InStream = op.stream;
2229
+ Archive = archive;
2230
+ return S_OK;
2231
+ }
2232
+ }
2233
+
2234
+ skipFrontalFormat[(unsigned)FormatIndex] = true;
2235
+
2236
+
2237
+ // if (!mode.CanReturnArc)
2238
+ /*
2239
+ if (!ErrorInfo.ThereIsTail)
2240
+ continue;
2241
+ */
2242
+ if (pi.Offset == 0 && !pi.LenIsUnknown && pi.Size >= FileSize)
2243
+ continue;
2244
+
2245
+ // printf("\nAdd offset = %d", (int)pi.Offset);
2246
+ RINOK(ReadParseItemProps(archive, ai, pi));
2247
+ handlerSpec->AddItem(pi);
2248
+ }
2249
+ }
2250
+
2251
+
2252
+
2253
+
2254
+
2255
+ // ---------- PARSER ----------
2256
+
2257
+ CUIntVector arc2sig; // formatIndex to signatureIndex
2258
+ CUIntVector sig2arc; // signatureIndex to formatIndex;
2259
+ {
2260
+ unsigned sum = 0;
2261
+ FOR_VECTOR (i, op.codecs->Formats)
2262
+ {
2263
+ arc2sig.Add(sum);
2264
+ const CObjectVector<CByteBuffer> &sigs = op.codecs->Formats[i].Signatures;
2265
+ sum += sigs.Size();
2266
+ FOR_VECTOR (k, sigs)
2267
+ sig2arc.Add(i);
2268
+ }
2269
+ }
2270
+
2271
+ {
2272
+ const size_t kBeforeSize = 1 << 16;
2273
+ const size_t kAfterSize = 1 << 20;
2274
+ const size_t kBufSize = 1 << 22; // it must be more than kBeforeSize + kAfterSize
2275
+
2276
+ const UInt32 kNumVals = (UInt32)1 << (kNumHashBytes * 8);
2277
+ CByteArr hashBuffer(kNumVals);
2278
+ Byte *hash = hashBuffer;
2279
+ memset(hash, 0xFF, kNumVals);
2280
+ Byte prevs[256];
2281
+ memset(prevs, 0xFF, sizeof(prevs));
2282
+ if (sig2arc.Size() >= 0xFF)
2283
+ return S_FALSE;
2284
+
2285
+ CUIntVector difficultFormats;
2286
+ CBoolArr difficultBools(256);
2287
+ {
2288
+ for (unsigned i = 0; i < 256; i++)
2289
+ difficultBools[i] = false;
2290
+ }
2291
+
2292
+ bool thereAreHandlersForSearch = false;
2293
+
2294
+ // UInt32 maxSignatureEnd = 0;
2295
+
2296
+ FOR_VECTOR (i, orderIndices)
2297
+ {
2298
+ int index = orderIndices[i];
2299
+ if (index < 0)
2300
+ continue;
2301
+ const CArcInfoEx &ai = op.codecs->Formats[(unsigned)index];
2302
+ bool isDifficult = false;
2303
+ // if (ai.Version < 0x91F) // we don't use parser with old DLL (before 9.31)
2304
+ if (!ai.NewInterface)
2305
+ isDifficult = true;
2306
+ else
2307
+ {
2308
+ if (ai.Flags_StartOpen())
2309
+ isDifficult = true;
2310
+ FOR_VECTOR (k, ai.Signatures)
2311
+ {
2312
+ const CByteBuffer &sig = ai.Signatures[k];
2313
+ /*
2314
+ UInt32 signatureEnd = ai.SignatureOffset + (UInt32)sig.Size();
2315
+ if (maxSignatureEnd < signatureEnd)
2316
+ maxSignatureEnd = signatureEnd;
2317
+ */
2318
+ if (sig.Size() < kNumHashBytes)
2319
+ {
2320
+ isDifficult = true;
2321
+ continue;
2322
+ }
2323
+ thereAreHandlersForSearch = true;
2324
+ UInt32 v = HASH_VAL(sig);
2325
+ unsigned sigIndex = arc2sig[(unsigned)index] + k;
2326
+ prevs[sigIndex] = hash[v];
2327
+ hash[v] = (Byte)sigIndex;
2328
+ }
2329
+ }
2330
+ if (isDifficult)
2331
+ {
2332
+ difficultFormats.Add(index);
2333
+ difficultBools[(unsigned)index] = true;
2334
+ }
2335
+ }
2336
+
2337
+ if (!thereAreHandlersForSearch)
2338
+ {
2339
+ // openOnlyFullArc = true;
2340
+ // canReturnTailArc = true;
2341
+ }
2342
+
2343
+ RINOK(op.stream->Seek(0, STREAM_SEEK_SET, NULL));
2344
+
2345
+ CLimitedCachedInStream *limitedStreamSpec = new CLimitedCachedInStream;
2346
+ CMyComPtr<IInStream> limitedStream = limitedStreamSpec;
2347
+ limitedStreamSpec->SetStream(op.stream);
2348
+
2349
+ CArchiveOpenCallback_Offset *openCallback_Offset_Spec = NULL;
2350
+ CMyComPtr<IArchiveOpenCallback> openCallback_Offset;
2351
+ if (op.callback)
2352
+ {
2353
+ openCallback_Offset_Spec = new CArchiveOpenCallback_Offset;
2354
+ openCallback_Offset = openCallback_Offset_Spec;
2355
+ openCallback_Offset_Spec->Callback = op.callback;
2356
+ openCallback_Offset_Spec->Callback.QueryInterface(IID_IArchiveOpenVolumeCallback, &openCallback_Offset_Spec->OpenVolumeCallback);
2357
+ #ifndef _NO_CRYPTO
2358
+ openCallback_Offset_Spec->Callback.QueryInterface(IID_ICryptoGetTextPassword, &openCallback_Offset_Spec->GetTextPassword);
2359
+ #endif
2360
+ }
2361
+
2362
+ if (op.callback)
2363
+ RINOK(op.callback->SetTotal(NULL, &fileSize));
2364
+
2365
+ CByteBuffer &byteBuffer = limitedStreamSpec->Buffer;
2366
+ byteBuffer.Alloc(kBufSize);
2367
+
2368
+ UInt64 callbackPrev = 0;
2369
+ bool needCheckStartOpen = true; // = true, if we need to test all archives types for current pos.
2370
+
2371
+ bool endOfFile = false;
2372
+ UInt64 bufPhyPos = 0;
2373
+ size_t bytesInBuf = 0;
2374
+ // UInt64 prevPos = 0;
2375
+
2376
+ // ---------- Main Scan Loop ----------
2377
+
2378
+ UInt64 pos = 0;
2379
+
2380
+ if (!mode.EachPos && handlerSpec->_items.Size() == 1)
2381
+ {
2382
+ NArchive::NParser::CParseItem &pi = handlerSpec->_items[0];
2383
+ if (!pi.LenIsUnknown && pi.Offset == 0)
2384
+ pos = pi.Size;
2385
+ }
2386
+
2387
+ for (;;)
2388
+ {
2389
+ // printf("\nPos = %d", (int)pos);
2390
+ UInt64 posInBuf = pos - bufPhyPos;
2391
+
2392
+ // if (pos > ((UInt64)1 << 35)) break;
2393
+
2394
+ if (!endOfFile)
2395
+ {
2396
+ if (bytesInBuf < kBufSize)
2397
+ {
2398
+ size_t processedSize = kBufSize - bytesInBuf;
2399
+ // printf("\nRead ask = %d", (unsigned)processedSize);
2400
+ UInt64 seekPos = bufPhyPos + bytesInBuf;
2401
+ RINOK(op.stream->Seek(bufPhyPos + bytesInBuf, STREAM_SEEK_SET, NULL));
2402
+ RINOK(ReadStream(op.stream, byteBuffer + bytesInBuf, &processedSize));
2403
+ // printf(" processed = %d", (unsigned)processedSize);
2404
+ if (processedSize == 0)
2405
+ {
2406
+ fileSize = seekPos;
2407
+ endOfFile = true;
2408
+ }
2409
+ else
2410
+ {
2411
+ bytesInBuf += processedSize;
2412
+ limitedStreamSpec->SetCache(processedSize, (size_t)bufPhyPos);
2413
+ }
2414
+ continue;
2415
+ }
2416
+
2417
+ if (bytesInBuf < posInBuf)
2418
+ {
2419
+ UInt64 skipSize = posInBuf - bytesInBuf;
2420
+ if (skipSize <= kBeforeSize)
2421
+ {
2422
+ size_t keepSize = (size_t)(kBeforeSize - skipSize);
2423
+ // printf("\nmemmove skip = %d", (int)keepSize);
2424
+ memmove(byteBuffer, byteBuffer + bytesInBuf - keepSize, keepSize);
2425
+ bytesInBuf = keepSize;
2426
+ bufPhyPos = pos - keepSize;
2427
+ continue;
2428
+ }
2429
+ // printf("\nSkip %d", (int)(skipSize - kBeforeSize));
2430
+ // RINOK(op.stream->Seek(skipSize - kBeforeSize, STREAM_SEEK_CUR, NULL));
2431
+ bytesInBuf = 0;
2432
+ bufPhyPos = pos - kBeforeSize;
2433
+ continue;
2434
+ }
2435
+
2436
+ if (bytesInBuf - posInBuf < kAfterSize)
2437
+ {
2438
+ size_t beg = (size_t)posInBuf - kBeforeSize;
2439
+ // printf("\nmemmove for after beg = %d", (int)beg);
2440
+ memmove(byteBuffer, byteBuffer + beg, bytesInBuf - beg);
2441
+ bufPhyPos += beg;
2442
+ bytesInBuf -= beg;
2443
+ continue;
2444
+ }
2445
+ }
2446
+
2447
+ if (bytesInBuf <= (size_t)posInBuf)
2448
+ break;
2449
+
2450
+ bool useOffsetCallback = false;
2451
+ if (openCallback_Offset)
2452
+ {
2453
+ openCallback_Offset_Spec->Files = handlerSpec->_items.Size();
2454
+ openCallback_Offset_Spec->Offset = pos;
2455
+
2456
+ useOffsetCallback = (!op.openType.CanReturnArc || handlerSpec->_items.Size() > 1);
2457
+
2458
+ if (pos >= callbackPrev + (1 << 23))
2459
+ {
2460
+ RINOK(openCallback_Offset_Spec->SetCompleted(NULL, NULL));
2461
+ callbackPrev = pos;
2462
+ }
2463
+ }
2464
+
2465
+ {
2466
+ UInt64 endPos = bufPhyPos + bytesInBuf;
2467
+ if (fileSize < endPos)
2468
+ {
2469
+ FileSize = fileSize; // why ????
2470
+ fileSize = endPos;
2471
+ }
2472
+ }
2473
+
2474
+ size_t availSize = bytesInBuf - (size_t)posInBuf;
2475
+ if (availSize < kNumHashBytes)
2476
+ break;
2477
+ size_t scanSize = availSize -
2478
+ ((availSize >= kAfterSize) ? kAfterSize : kNumHashBytes);
2479
+
2480
+ {
2481
+ /*
2482
+ UInt64 scanLimit = openOnlyFullArc ?
2483
+ maxSignatureEnd :
2484
+ op.openType.ScanSize + maxSignatureEnd;
2485
+ */
2486
+ if (!mode.CanReturnParser)
2487
+ {
2488
+ if (pos > maxStartOffset)
2489
+ break;
2490
+ UInt64 remScan = maxStartOffset - pos;
2491
+ if (scanSize > remScan)
2492
+ scanSize = (size_t)remScan;
2493
+ }
2494
+ }
2495
+
2496
+ scanSize++;
2497
+
2498
+ const Byte *buf = byteBuffer + (size_t)posInBuf;
2499
+ const Byte *bufLimit = buf + scanSize;
2500
+ size_t ppp = 0;
2501
+
2502
+ if (!needCheckStartOpen)
2503
+ {
2504
+ for (; buf < bufLimit && hash[HASH_VAL(buf)] == 0xFF; buf++);
2505
+ ppp = buf - (byteBuffer + (size_t)posInBuf);
2506
+ pos += ppp;
2507
+ if (buf == bufLimit)
2508
+ continue;
2509
+ }
2510
+
2511
+ UInt32 v = HASH_VAL(buf);
2512
+ bool nextNeedCheckStartOpen = true;
2513
+ unsigned i = hash[v];
2514
+ unsigned indexOfDifficult = 0;
2515
+
2516
+ // ---------- Open Loop for Current Pos ----------
2517
+ bool wasOpen = false;
2518
+
2519
+ for (;;)
2520
+ {
2521
+ unsigned index;
2522
+ bool isDifficult;
2523
+ if (needCheckStartOpen && indexOfDifficult < difficultFormats.Size())
2524
+ {
2525
+ index = difficultFormats[indexOfDifficult++];
2526
+ isDifficult = true;
2527
+ }
2528
+ else
2529
+ {
2530
+ if (i == 0xFF)
2531
+ break;
2532
+ index = sig2arc[i];
2533
+ unsigned sigIndex = i - arc2sig[index];
2534
+ i = prevs[i];
2535
+ if (needCheckStartOpen && difficultBools[index])
2536
+ continue;
2537
+ const CArcInfoEx &ai = op.codecs->Formats[index];
2538
+
2539
+ if (pos < ai.SignatureOffset)
2540
+ continue;
2541
+
2542
+ /*
2543
+ if (openOnlyFullArc)
2544
+ if (pos != ai.SignatureOffset)
2545
+ continue;
2546
+ */
2547
+
2548
+ const CByteBuffer &sig = ai.Signatures[sigIndex];
2549
+
2550
+ if (ppp + sig.Size() > availSize
2551
+ || !TestSignature(buf, sig, sig.Size()))
2552
+ continue;
2553
+ // printf("\nSignature OK: %10S %8x %5d", (const wchar_t *)ai.Name, (int)pos, (int)(pos - prevPos));
2554
+ // prevPos = pos;
2555
+ isDifficult = false;
2556
+ }
2557
+
2558
+ const CArcInfoEx &ai = op.codecs->Formats[index];
2559
+
2560
+
2561
+ if ((isDifficult && pos == 0) || ai.SignatureOffset == pos)
2562
+ {
2563
+ // we don't check same archive second time */
2564
+ if (skipFrontalFormat[index])
2565
+ continue;
2566
+ }
2567
+
2568
+ UInt64 startArcPos = pos;
2569
+ if (!isDifficult)
2570
+ {
2571
+ if (pos < ai.SignatureOffset)
2572
+ continue;
2573
+ startArcPos = pos - ai.SignatureOffset;
2574
+ /*
2575
+ // we don't need the check for Z files
2576
+ if (startArcPos < handlerSpec->GetLastEnd())
2577
+ continue;
2578
+ */
2579
+ }
2580
+
2581
+ if (ai.IsArcFunc && startArcPos >= bufPhyPos)
2582
+ {
2583
+ size_t offsetInBuf = (size_t)(startArcPos - bufPhyPos);
2584
+ if (offsetInBuf < bytesInBuf)
2585
+ {
2586
+ UInt32 isArcRes = ai.IsArcFunc(byteBuffer + offsetInBuf, bytesInBuf - offsetInBuf);
2587
+ if (isArcRes == k_IsArc_Res_NO)
2588
+ continue;
2589
+ if (isArcRes == k_IsArc_Res_NEED_MORE && endOfFile)
2590
+ continue;
2591
+ /*
2592
+ if (isArcRes == k_IsArc_Res_YES_LOW_PROB)
2593
+ {
2594
+ // if (pos != ai.SignatureOffset)
2595
+ continue;
2596
+ }
2597
+ */
2598
+ }
2599
+ // printf("\nIsArc OK: %S", (const wchar_t *)ai.Name);
2600
+ }
2601
+
2602
+ /*
2603
+ if (pos == 67109888)
2604
+ pos = pos;
2605
+ */
2606
+ PRF(printf("\npos = %9I64d : %S", pos, (const wchar_t *)ai.Name));
2607
+
2608
+ bool isMainFormat = isMainFormatArr[index];
2609
+ const COpenSpecFlags &specFlags = mode.GetSpec(isForced, isMainFormat, isUnknownExt);
2610
+
2611
+ CMyComPtr<IInArchive> archive;
2612
+ RINOK(PrepareToOpen(op, index, archive));
2613
+ if (!archive)
2614
+ return E_FAIL;
2615
+
2616
+ // OutputDebugStringW(ai.Name);
2617
+
2618
+ UInt64 rem = fileSize - startArcPos;
2619
+
2620
+ UInt64 arcStreamOffset = 0;
2621
+
2622
+ if (ai.Flags_UseGlobalOffset())
2623
+ {
2624
+ limitedStreamSpec->InitAndSeek(0, fileSize);
2625
+ limitedStream->Seek(startArcPos, STREAM_SEEK_SET, NULL);
2626
+ }
2627
+ else
2628
+ {
2629
+ limitedStreamSpec->InitAndSeek(startArcPos, rem);
2630
+ arcStreamOffset = startArcPos;
2631
+ }
2632
+
2633
+ UInt64 maxCheckStartPosition = 0;
2634
+
2635
+ if (openCallback_Offset)
2636
+ {
2637
+ openCallback_Offset_Spec->Files = handlerSpec->_items.Size();
2638
+ openCallback_Offset_Spec->Offset = startArcPos;
2639
+ }
2640
+
2641
+ // HRESULT result = archive->Open(limitedStream, &maxCheckStartPosition, openCallback_Offset);
2642
+ extractCallback_To_OpenCallback_Spec->Files = 0;
2643
+ extractCallback_To_OpenCallback_Spec->Offset = startArcPos;
2644
+
2645
+ HRESULT result = OpenArchiveSpec(archive, true, limitedStream, &maxCheckStartPosition,
2646
+ useOffsetCallback ? (IArchiveOpenCallback *)openCallback_Offset : (IArchiveOpenCallback *)op.callback,
2647
+ extractCallback_To_OpenCallback);
2648
+
2649
+ RINOK(ReadBasicProps(archive, ai.Flags_UseGlobalOffset() ? 0 : startArcPos, result));
2650
+
2651
+ bool isOpen = false;
2652
+ if (result == S_FALSE)
2653
+ {
2654
+ if (!mode.CanReturnParser)
2655
+ {
2656
+ if (formatIndex < 0 && ErrorInfo.IsArc_After_NonOpen())
2657
+ {
2658
+ ErrorInfo.ErrorFormatIndex = index;
2659
+ NonOpen_ErrorInfo = ErrorInfo;
2660
+ // if archive was detected, we don't need additional open attempts
2661
+ return S_FALSE;
2662
+ }
2663
+ continue;
2664
+ }
2665
+ if (!ErrorInfo.IsArc_After_NonOpen() || !PhySizeDefined || PhySize == 0)
2666
+ continue;
2667
+ }
2668
+ else
2669
+ {
2670
+ isOpen = true;
2671
+ RINOK(result);
2672
+ PRF(printf(" OK "));
2673
+ }
2674
+
2675
+ // fprintf(stderr, "\n %8X %S", startArcPos, Path);
2676
+ // printf("\nOpen OK: %S", ai.Name);
2677
+
2678
+
2679
+ NArchive::NParser::CParseItem pi;
2680
+ pi.Offset = startArcPos;
2681
+
2682
+ if (ai.Flags_UseGlobalOffset())
2683
+ pi.Offset = Offset;
2684
+ else if (Offset != 0)
2685
+ return E_FAIL;
2686
+ UInt64 arcRem = FileSize - pi.Offset;
2687
+ UInt64 phySize = arcRem;
2688
+ bool phySizeDefined = PhySizeDefined;
2689
+ if (phySizeDefined)
2690
+ {
2691
+ if (pi.Offset + PhySize > FileSize)
2692
+ {
2693
+ // ErrorInfo.ThereIsTail = true;
2694
+ PhySize = FileSize - pi.Offset;
2695
+ }
2696
+ phySize = PhySize;
2697
+ }
2698
+ if (phySize == 0 || (UInt64)phySize > ((UInt64)1 << 63))
2699
+ return E_FAIL;
2700
+
2701
+ /*
2702
+ if (!ai.UseGlobalOffset)
2703
+ {
2704
+ if (phySize > arcRem)
2705
+ {
2706
+ ThereIsTail = true;
2707
+ phySize = arcRem;
2708
+ }
2709
+ }
2710
+ */
2711
+
2712
+ bool needScan = false;
2713
+
2714
+
2715
+ if (isOpen && !phySizeDefined)
2716
+ {
2717
+ // it's for Z format
2718
+ pi.LenIsUnknown = true;
2719
+ needScan = true;
2720
+ phySize = arcRem;
2721
+ nextNeedCheckStartOpen = false;
2722
+ }
2723
+
2724
+ pi.Size = phySize;
2725
+ /*
2726
+ if (OkPhySize_Defined)
2727
+ pi.OkSize = OkPhySize;
2728
+ */
2729
+ pi.NormalizeOffset();
2730
+ // printf(" phySize = %8d", (unsigned)phySize);
2731
+
2732
+ /*
2733
+ if (needSkipFullArc)
2734
+ if (pi.Offset == 0 && phySizeDefined && pi.Size >= fileSize)
2735
+ continue;
2736
+ */
2737
+ if (pi.Offset == 0 && !pi.LenIsUnknown && pi.Size >= FileSize)
2738
+ {
2739
+ // it's possible for dmg archives
2740
+ if (!mode.CanReturnArc)
2741
+ continue;
2742
+ }
2743
+
2744
+ if (mode.EachPos)
2745
+ pos++;
2746
+ else if (needScan)
2747
+ {
2748
+ pos++;
2749
+ /*
2750
+ if (!OkPhySize_Defined)
2751
+ pos++;
2752
+ else
2753
+ pos = pi.Offset + pi.OkSize;
2754
+ */
2755
+ }
2756
+ else
2757
+ pos = pi.Offset + pi.Size;
2758
+
2759
+
2760
+ RINOK(ReadParseItemProps(archive, ai, pi));
2761
+
2762
+ if (pi.Offset < startArcPos && !mode.EachPos /* && phySizeDefined */)
2763
+ {
2764
+ /* It's for DMG format.
2765
+ This code deletes all previous items that are included to current item */
2766
+
2767
+ while (!handlerSpec->_items.IsEmpty())
2768
+ {
2769
+ {
2770
+ const NArchive::NParser::CParseItem &back = handlerSpec->_items.Back();
2771
+ if (back.Offset < pi.Offset)
2772
+ break;
2773
+ if (back.Offset + back.Size > pi.Offset + pi.Size)
2774
+ break;
2775
+ }
2776
+ handlerSpec->_items.DeleteBack();
2777
+ }
2778
+ }
2779
+
2780
+
2781
+ if (isOpen && mode.CanReturnArc && phySizeDefined)
2782
+ {
2783
+ // if (pi.Offset + pi.Size >= fileSize)
2784
+ bool openCur = false;
2785
+
2786
+ bool thereIsTail = ErrorInfo.ThereIsTail;
2787
+ if (thereIsTail && mode.ZerosTailIsAllowed)
2788
+ {
2789
+ RINOK(CheckZerosTail(op, arcStreamOffset + Offset + PhySize));
2790
+ if (ErrorInfo.IgnoreTail)
2791
+ thereIsTail = false;
2792
+ }
2793
+
2794
+ if (pi.Offset != 0)
2795
+ {
2796
+ if (!pi.IsNotArcType)
2797
+ if (thereIsTail)
2798
+ openCur = specFlags.CanReturnMid;
2799
+ else
2800
+ openCur = specFlags.CanReturnTail;
2801
+ }
2802
+ else
2803
+ {
2804
+ if (!thereIsTail)
2805
+ openCur = true;
2806
+ else
2807
+ openCur = specFlags.CanReturnFrontal;
2808
+
2809
+
2810
+ if (formatIndex >= -2)
2811
+ openCur = true;
2812
+ }
2813
+ if (formatIndex < 0 && pi.IsSelfExe /* && mode.SkipSfxStub */)
2814
+ openCur = false;
2815
+
2816
+ // We open file as SFX, if there is front archive or first archive is "Self Executable"
2817
+ if (!openCur && !pi.IsSelfExe && !thereIsTail &&
2818
+ (!pi.IsNotArcType || pi.Offset == 0))
2819
+ {
2820
+ if (handlerSpec->_items.IsEmpty())
2821
+ {
2822
+ if (specFlags.CanReturnTail)
2823
+ openCur = true;
2824
+ }
2825
+ else if (handlerSpec->_items.Size() == 1)
2826
+ {
2827
+ if (handlerSpec->_items[0].IsSelfExe)
2828
+ {
2829
+ if (mode.SpecUnknownExt.CanReturnTail)
2830
+ openCur = true;
2831
+ }
2832
+ }
2833
+ }
2834
+
2835
+ if (openCur)
2836
+ {
2837
+ InStream = op.stream;
2838
+ Archive = archive;
2839
+ FormatIndex = index;
2840
+ ArcStreamOffset = arcStreamOffset;
2841
+ return S_OK;
2842
+ }
2843
+ }
2844
+
2845
+ /*
2846
+ if (openOnlyFullArc)
2847
+ {
2848
+ ErrorInfo.ClearErrors();
2849
+ return S_FALSE;
2850
+ }
2851
+ */
2852
+
2853
+ pi.FormatIndex = index;
2854
+
2855
+ // printf("\nAdd offset = %d", (int)pi.Offset);
2856
+ handlerSpec->AddItem(pi);
2857
+ wasOpen = true;
2858
+ break;
2859
+ }
2860
+ // ---------- End of Open Loop for Current Pos ----------
2861
+
2862
+ if (!wasOpen)
2863
+ pos++;
2864
+ needCheckStartOpen = (nextNeedCheckStartOpen && wasOpen);
2865
+ }
2866
+ // ---------- End of Main Scan Loop ----------
2867
+
2868
+ /*
2869
+ if (handlerSpec->_items.Size() == 1)
2870
+ {
2871
+ const NArchive::NParser::CParseItem &pi = handlerSpec->_items[0];
2872
+ if (pi.Size == fileSize && pi.Offset == 0)
2873
+ {
2874
+ Archive = archive;
2875
+ FormatIndex2 = pi.FormatIndex;
2876
+ return S_OK;
2877
+ }
2878
+ }
2879
+ */
2880
+
2881
+ if (mode.CanReturnParser)
2882
+ {
2883
+ bool returnParser = (handlerSpec->_items.Size() == 1); // it's possible if fileSize was not correct at start of parsing
2884
+ handlerSpec->AddUnknownItem(fileSize);
2885
+ if (handlerSpec->_items.Size() == 0)
2886
+ return S_FALSE;
2887
+ if (returnParser || handlerSpec->_items.Size() != 1)
2888
+ {
2889
+ // return S_FALSE;
2890
+ handlerSpec->_stream = op.stream;
2891
+ Archive = handler;
2892
+ ErrorInfo.ClearErrors();
2893
+ IsParseArc = true;
2894
+ FormatIndex = -1; // It's parser
2895
+ Offset = 0;
2896
+ return S_OK;
2897
+ }
2898
+ }
2899
+ }
2900
+
2901
+ #endif
2902
+
2903
+ if (!Archive)
2904
+ return S_FALSE;
2905
+ return S_OK;
2906
+ }
2907
+
2908
+ HRESULT CArc::OpenStream(const COpenOptions &op)
2909
+ {
2910
+ RINOK(OpenStream2(op));
2911
+ // PrintNumber("op.formatIndex 3", op.formatIndex);
2912
+
2913
+ if (Archive)
2914
+ {
2915
+ GetRawProps.Release();
2916
+ GetRootProps.Release();
2917
+ Archive->QueryInterface(IID_IArchiveGetRawProps, (void **)&GetRawProps);
2918
+ Archive->QueryInterface(IID_IArchiveGetRootProps, (void **)&GetRootProps);
2919
+
2920
+ RINOK(Archive_GetArcBoolProp(Archive, kpidIsTree, IsTree));
2921
+ RINOK(Archive_GetArcBoolProp(Archive, kpidIsDeleted, Ask_Deleted));
2922
+ RINOK(Archive_GetArcBoolProp(Archive, kpidIsAltStream, Ask_AltStream));
2923
+ RINOK(Archive_GetArcBoolProp(Archive, kpidIsAux, Ask_Aux));
2924
+ RINOK(Archive_GetArcBoolProp(Archive, kpidINode, Ask_INode));
2925
+ RINOK(Archive_GetArcBoolProp(Archive, kpidReadOnly, IsReadOnly));
2926
+
2927
+ const UString fileName = ExtractFileNameFromPath(Path);
2928
+ UString extension;
2929
+ {
2930
+ int dotPos = fileName.ReverseFind_Dot();
2931
+ if (dotPos >= 0)
2932
+ extension = fileName.Ptr(dotPos + 1);
2933
+ }
2934
+
2935
+ DefaultName.Empty();
2936
+ if (FormatIndex >= 0)
2937
+ {
2938
+ const CArcInfoEx &ai = op.codecs->Formats[FormatIndex];
2939
+ if (ai.Exts.Size() == 0)
2940
+ DefaultName = GetDefaultName2(fileName, UString(), UString());
2941
+ else
2942
+ {
2943
+ int subExtIndex = ai.FindExtension(extension);
2944
+ if (subExtIndex < 0)
2945
+ subExtIndex = 0;
2946
+ const CArcExtInfo &extInfo = ai.Exts[subExtIndex];
2947
+ DefaultName = GetDefaultName2(fileName, extInfo.Ext, extInfo.AddExt);
2948
+ }
2949
+ }
2950
+ }
2951
+
2952
+ return S_OK;
2953
+ }
2954
+
2955
+ #ifdef _SFX
2956
+
2957
+ #ifdef _WIN32
2958
+ #define k_ExeExt ".exe"
2959
+ static const unsigned k_ExeExt_Len = 4;
2960
+ #else
2961
+ #define k_ExeExt ""
2962
+ static const unsigned k_ExeExt_Len = 0;
2963
+ #endif
2964
+
2965
+ #endif
2966
+
2967
+ HRESULT CArc::OpenStreamOrFile(COpenOptions &op)
2968
+ {
2969
+ CMyComPtr<IInStream> fileStream;
2970
+ CMyComPtr<ISequentialInStream> seqStream;
2971
+ CInFileStream *fileStreamSpec = NULL;
2972
+
2973
+ if (op.stdInMode)
2974
+ {
2975
+ seqStream = new CStdInFileStream;
2976
+ op.seqStream = seqStream;
2977
+ }
2978
+ else if (!op.stream)
2979
+ {
2980
+ fileStreamSpec = new CInFileStream;
2981
+ fileStream = fileStreamSpec;
2982
+ Path = filePath;
2983
+ if (!fileStreamSpec->Open(us2fs(Path)))
2984
+ {
2985
+ return GetLastError();
2986
+ }
2987
+ op.stream = fileStream;
2988
+ #ifdef _SFX
2989
+ IgnoreSplit = true;
2990
+ #endif
2991
+ }
2992
+
2993
+ /*
2994
+ if (callback)
2995
+ {
2996
+ UInt64 fileSize;
2997
+ RINOK(op.stream->Seek(0, STREAM_SEEK_END, &fileSize));
2998
+ RINOK(op.callback->SetTotal(NULL, &fileSize))
2999
+ }
3000
+ */
3001
+
3002
+ HRESULT res = OpenStream(op);
3003
+ IgnoreSplit = false;
3004
+
3005
+ #ifdef _SFX
3006
+
3007
+ if (res != S_FALSE
3008
+ || !fileStreamSpec
3009
+ || !op.callbackSpec
3010
+ || NonOpen_ErrorInfo.IsArc_After_NonOpen())
3011
+ return res;
3012
+
3013
+ {
3014
+ if (filePath.Len() > k_ExeExt_Len
3015
+ && StringsAreEqualNoCase_Ascii(filePath.RightPtr(k_ExeExt_Len), k_ExeExt))
3016
+ {
3017
+ const UString path2 = filePath.Left(filePath.Len() - k_ExeExt_Len);
3018
+ FOR_VECTOR (i, op.codecs->Formats)
3019
+ {
3020
+ const CArcInfoEx &ai = op.codecs->Formats[i];
3021
+ if (ai.IsSplit())
3022
+ continue;
3023
+ UString path3 = path2;
3024
+ path3 += '.';
3025
+ path3 += ai.GetMainExt(); // "7z" for SFX.
3026
+ Path = path3;
3027
+ Path += ".001";
3028
+ bool isOk = op.callbackSpec->SetSecondFileInfo(us2fs(Path));
3029
+ if (!isOk)
3030
+ {
3031
+ Path = path3;
3032
+ isOk = op.callbackSpec->SetSecondFileInfo(us2fs(Path));
3033
+ }
3034
+ if (isOk)
3035
+ {
3036
+ if (fileStreamSpec->Open(us2fs(Path)))
3037
+ {
3038
+ op.stream = fileStream;
3039
+ NonOpen_ErrorInfo.ClearErrors_Full();
3040
+ if (OpenStream(op) == S_OK)
3041
+ return S_OK;
3042
+ }
3043
+ }
3044
+ }
3045
+ }
3046
+ }
3047
+
3048
+ #endif
3049
+
3050
+ return res;
3051
+ }
3052
+
3053
+ void CArchiveLink::KeepModeForNextOpen()
3054
+ {
3055
+ for (unsigned i = Arcs.Size(); i != 0;)
3056
+ {
3057
+ i--;
3058
+ CMyComPtr<IArchiveKeepModeForNextOpen> keep;
3059
+ Arcs[i].Archive->QueryInterface(IID_IArchiveKeepModeForNextOpen, (void **)&keep);
3060
+ if (keep)
3061
+ keep->KeepModeForNextOpen();
3062
+ }
3063
+ }
3064
+
3065
+ HRESULT CArchiveLink::Close()
3066
+ {
3067
+ for (unsigned i = Arcs.Size(); i != 0;)
3068
+ {
3069
+ i--;
3070
+ RINOK(Arcs[i].Close());
3071
+ }
3072
+ IsOpen = false;
3073
+ // ErrorsText.Empty();
3074
+ return S_OK;
3075
+ }
3076
+
3077
+ void CArchiveLink::Release()
3078
+ {
3079
+ // NonOpenErrorFormatIndex = -1;
3080
+ NonOpen_ErrorInfo.ClearErrors();
3081
+ NonOpen_ArcPath.Empty();
3082
+ while (!Arcs.IsEmpty())
3083
+ Arcs.DeleteBack();
3084
+ }
3085
+
3086
+ /*
3087
+ void CArchiveLink::Set_ErrorsText()
3088
+ {
3089
+ FOR_VECTOR(i, Arcs)
3090
+ {
3091
+ const CArc &arc = Arcs[i];
3092
+ if (!arc.ErrorFlagsText.IsEmpty())
3093
+ {
3094
+ if (!ErrorsText.IsEmpty())
3095
+ ErrorsText.Add_LF();
3096
+ ErrorsText += GetUnicodeString(arc.ErrorFlagsText);
3097
+ }
3098
+ if (!arc.ErrorMessage.IsEmpty())
3099
+ {
3100
+ if (!ErrorsText.IsEmpty())
3101
+ ErrorsText.Add_LF();
3102
+ ErrorsText += arc.ErrorMessage;
3103
+ }
3104
+
3105
+ if (!arc.WarningMessage.IsEmpty())
3106
+ {
3107
+ if (!ErrorsText.IsEmpty())
3108
+ ErrorsText.Add_LF();
3109
+ ErrorsText += arc.WarningMessage;
3110
+ }
3111
+ }
3112
+ }
3113
+ */
3114
+
3115
+ HRESULT CArchiveLink::Open(COpenOptions &op)
3116
+ {
3117
+ Release();
3118
+ if (op.types->Size() >= 32)
3119
+ return E_NOTIMPL;
3120
+
3121
+ HRESULT resSpec;
3122
+
3123
+ for (;;)
3124
+ {
3125
+ resSpec = S_OK;
3126
+
3127
+ op.openType = COpenType();
3128
+ if (op.types->Size() >= 1)
3129
+ {
3130
+ COpenType latest;
3131
+ if (Arcs.Size() < op.types->Size())
3132
+ latest = (*op.types)[op.types->Size() - Arcs.Size() - 1];
3133
+ else
3134
+ {
3135
+ latest = (*op.types)[0];
3136
+ if (!latest.Recursive)
3137
+ break;
3138
+ }
3139
+ op.openType = latest;
3140
+ }
3141
+ else if (Arcs.Size() >= 32)
3142
+ break;
3143
+
3144
+ /*
3145
+ op.formatIndex = -1;
3146
+ if (op.types->Size() >= 1)
3147
+ {
3148
+ int latest;
3149
+ if (Arcs.Size() < op.types->Size())
3150
+ latest = (*op.types)[op.types->Size() - Arcs.Size() - 1];
3151
+ else
3152
+ {
3153
+ latest = (*op.types)[0];
3154
+ if (latest != -2 && latest != -3)
3155
+ break;
3156
+ }
3157
+ if (latest >= 0)
3158
+ op.formatIndex = latest;
3159
+ else if (latest == -1 || latest == -2)
3160
+ {
3161
+ // default
3162
+ }
3163
+ else if (latest == -3)
3164
+ op.formatIndex = -2;
3165
+ else
3166
+ op.formatIndex = latest + 2;
3167
+ }
3168
+ else if (Arcs.Size() >= 32)
3169
+ break;
3170
+ */
3171
+
3172
+ if (Arcs.IsEmpty())
3173
+ {
3174
+ CArc arc;
3175
+ arc.filePath = op.filePath;
3176
+ arc.Path = op.filePath;
3177
+ arc.SubfileIndex = (UInt32)(Int32)-1;
3178
+ HRESULT result = arc.OpenStreamOrFile(op);
3179
+ if (result != S_OK)
3180
+ {
3181
+ if (result == S_FALSE)
3182
+ {
3183
+ NonOpen_ErrorInfo = arc.NonOpen_ErrorInfo;
3184
+ // NonOpenErrorFormatIndex = arc.ErrorFormatIndex;
3185
+ NonOpen_ArcPath = arc.Path;
3186
+ }
3187
+ return result;
3188
+ }
3189
+ Arcs.Add(arc);
3190
+ continue;
3191
+ }
3192
+
3193
+ // PrintNumber("op.formatIndex 11", op.formatIndex);
3194
+
3195
+ const CArc &arc = Arcs.Back();
3196
+
3197
+ if (op.types->Size() > Arcs.Size())
3198
+ resSpec = E_NOTIMPL;
3199
+
3200
+ UInt32 mainSubfile;
3201
+ {
3202
+ NCOM::CPropVariant prop;
3203
+ RINOK(arc.Archive->GetArchiveProperty(kpidMainSubfile, &prop));
3204
+ if (prop.vt == VT_UI4)
3205
+ mainSubfile = prop.ulVal;
3206
+ else
3207
+ break;
3208
+ UInt32 numItems;
3209
+ RINOK(arc.Archive->GetNumberOfItems(&numItems));
3210
+ if (mainSubfile >= numItems)
3211
+ break;
3212
+ }
3213
+
3214
+
3215
+ CMyComPtr<IInArchiveGetStream> getStream;
3216
+ if (arc.Archive->QueryInterface(IID_IInArchiveGetStream, (void **)&getStream) != S_OK || !getStream)
3217
+ break;
3218
+
3219
+ CMyComPtr<ISequentialInStream> subSeqStream;
3220
+ if (getStream->GetStream(mainSubfile, &subSeqStream) != S_OK || !subSeqStream)
3221
+ break;
3222
+
3223
+ CMyComPtr<IInStream> subStream;
3224
+ if (subSeqStream.QueryInterface(IID_IInStream, &subStream) != S_OK || !subStream)
3225
+ break;
3226
+
3227
+ CArc arc2;
3228
+ RINOK(arc.GetItemPath(mainSubfile, arc2.Path));
3229
+
3230
+ bool zerosTailIsAllowed;
3231
+ RINOK(Archive_GetItemBoolProp(arc.Archive, mainSubfile, kpidZerosTailIsAllowed, zerosTailIsAllowed));
3232
+
3233
+
3234
+ if (op.callback)
3235
+ {
3236
+ CMyComPtr<IArchiveOpenSetSubArchiveName> setSubArchiveName;
3237
+ op.callback->QueryInterface(IID_IArchiveOpenSetSubArchiveName, (void **)&setSubArchiveName);
3238
+ if (setSubArchiveName)
3239
+ setSubArchiveName->SetSubArchiveName(arc2.Path);
3240
+ }
3241
+
3242
+ arc2.SubfileIndex = mainSubfile;
3243
+
3244
+ // CIntVector incl;
3245
+ CIntVector excl;
3246
+
3247
+ COpenOptions op2;
3248
+ #ifndef _SFX
3249
+ op2.props = op.props;
3250
+ #endif
3251
+ op2.codecs = op.codecs;
3252
+ // op2.types = &incl;
3253
+ op2.openType = op.openType;
3254
+ op2.openType.ZerosTailIsAllowed = zerosTailIsAllowed;
3255
+ op2.excludedFormats = &excl;
3256
+ op2.stdInMode = false;
3257
+ op2.stream = subStream;
3258
+ op2.filePath = arc2.Path;
3259
+ op2.callback = op.callback;
3260
+ op2.callbackSpec = op.callbackSpec;
3261
+
3262
+
3263
+ HRESULT result = arc2.OpenStream(op2);
3264
+ resSpec = (op.types->Size() == 0 ? S_OK : S_FALSE);
3265
+ if (result == S_FALSE)
3266
+ {
3267
+ NonOpen_ErrorInfo = arc2.ErrorInfo;
3268
+ NonOpen_ArcPath = arc2.Path;
3269
+ break;
3270
+ }
3271
+ RINOK(result);
3272
+ RINOK(arc.GetItemMTime(mainSubfile, arc2.MTime, arc2.MTimeDefined));
3273
+ Arcs.Add(arc2);
3274
+ }
3275
+ IsOpen = !Arcs.IsEmpty();
3276
+ return resSpec;
3277
+ }
3278
+
3279
+ HRESULT CArchiveLink::Open2(COpenOptions &op, IOpenCallbackUI *callbackUI)
3280
+ {
3281
+ VolumesSize = 0;
3282
+ COpenCallbackImp *openCallbackSpec = new COpenCallbackImp;
3283
+ CMyComPtr<IArchiveOpenCallback> callback = openCallbackSpec;
3284
+ openCallbackSpec->Callback = callbackUI;
3285
+
3286
+ FString prefix, name;
3287
+
3288
+ if (!op.stream && !op.stdInMode)
3289
+ {
3290
+ NFile::NDir::GetFullPathAndSplit(us2fs(op.filePath), prefix, name);
3291
+ openCallbackSpec->Init(prefix, name);
3292
+ }
3293
+ else
3294
+ {
3295
+ openCallbackSpec->SetSubArchiveName(op.filePath);
3296
+ }
3297
+
3298
+ op.callback = callback;
3299
+ op.callbackSpec = openCallbackSpec;
3300
+
3301
+ HRESULT res = Open(op);
3302
+
3303
+ PasswordWasAsked = openCallbackSpec->PasswordWasAsked;
3304
+ // Password = openCallbackSpec->Password;
3305
+
3306
+ RINOK(res);
3307
+ // VolumePaths.Add(fs2us(prefix + name));
3308
+
3309
+ FOR_VECTOR (i, openCallbackSpec->FileNames_WasUsed)
3310
+ {
3311
+ if (openCallbackSpec->FileNames_WasUsed[i])
3312
+ {
3313
+ VolumePaths.Add(fs2us(prefix) + openCallbackSpec->FileNames[i]);
3314
+ VolumesSize += openCallbackSpec->FileSizes[i];
3315
+ }
3316
+ }
3317
+ // VolumesSize = openCallbackSpec->TotalSize;
3318
+ return S_OK;
3319
+ }
3320
+
3321
+ HRESULT CArc::ReOpen(const COpenOptions &op)
3322
+ {
3323
+ ErrorInfo.ClearErrors();
3324
+ ErrorInfo.ErrorFormatIndex = -1;
3325
+
3326
+ UInt64 fileSize = 0;
3327
+ if (op.stream)
3328
+ {
3329
+ RINOK(op.stream->Seek(0, STREAM_SEEK_END, &fileSize));
3330
+ RINOK(op.stream->Seek(0, STREAM_SEEK_SET, NULL));
3331
+ }
3332
+ FileSize = fileSize;
3333
+
3334
+ CMyComPtr<IInStream> stream2;
3335
+ Int64 globalOffset = GetGlobalOffset();
3336
+ if (globalOffset <= 0)
3337
+ stream2 = op.stream;
3338
+ else
3339
+ {
3340
+ CTailInStream *tailStreamSpec = new CTailInStream;
3341
+ stream2 = tailStreamSpec;
3342
+ tailStreamSpec->Stream = op.stream;
3343
+ tailStreamSpec->Offset = globalOffset;
3344
+ tailStreamSpec->Init();
3345
+ RINOK(tailStreamSpec->SeekToStart());
3346
+ }
3347
+
3348
+ // There are archives with embedded STUBs (like ZIP), so we must support signature scanning
3349
+ // But for another archives we can use 0 here. So the code can be fixed !!!
3350
+ UInt64 maxStartPosition = kMaxCheckStartPosition;
3351
+ HRESULT res = Archive->Open(stream2, &maxStartPosition, op.callback);
3352
+
3353
+ if (res == S_OK)
3354
+ {
3355
+ RINOK(ReadBasicProps(Archive, globalOffset, res));
3356
+ ArcStreamOffset = globalOffset;
3357
+ if (ArcStreamOffset != 0)
3358
+ InStream = op.stream;
3359
+ }
3360
+ return res;
3361
+ }
3362
+
3363
+ HRESULT CArchiveLink::Open3(COpenOptions &op, IOpenCallbackUI *callbackUI)
3364
+ {
3365
+ HRESULT res = Open2(op, callbackUI);
3366
+ if (callbackUI)
3367
+ {
3368
+ RINOK(callbackUI->Open_Finished());
3369
+ }
3370
+ return res;
3371
+ }
3372
+
3373
+ HRESULT CArchiveLink::ReOpen(COpenOptions &op)
3374
+ {
3375
+ if (Arcs.Size() > 1)
3376
+ return E_NOTIMPL;
3377
+
3378
+ CObjectVector<COpenType> inc;
3379
+ CIntVector excl;
3380
+
3381
+ op.types = &inc;
3382
+ op.excludedFormats = &excl;
3383
+ op.stdInMode = false;
3384
+ op.stream = NULL;
3385
+ if (Arcs.Size() == 0) // ???
3386
+ return Open2(op, NULL);
3387
+
3388
+ COpenCallbackImp *openCallbackSpec = new COpenCallbackImp;
3389
+ CMyComPtr<IArchiveOpenCallback> openCallbackNew = openCallbackSpec;
3390
+
3391
+ openCallbackSpec->Callback = NULL;
3392
+ openCallbackSpec->ReOpenCallback = op.callback;
3393
+ {
3394
+ FString dirPrefix, fileName;
3395
+ NFile::NDir::GetFullPathAndSplit(us2fs(op.filePath), dirPrefix, fileName);
3396
+ openCallbackSpec->Init(dirPrefix, fileName);
3397
+ }
3398
+
3399
+
3400
+ CInFileStream *fileStreamSpec = new CInFileStream;
3401
+ CMyComPtr<IInStream> stream(fileStreamSpec);
3402
+ if (!fileStreamSpec->Open(us2fs(op.filePath)))
3403
+ return GetLastError();
3404
+ op.stream = stream;
3405
+
3406
+ CArc &arc = Arcs[0];
3407
+ HRESULT res = arc.ReOpen(op);
3408
+
3409
+ PasswordWasAsked = openCallbackSpec->PasswordWasAsked;
3410
+ // Password = openCallbackSpec->Password;
3411
+
3412
+ IsOpen = (res == S_OK);
3413
+ return res;
3414
+ }
3415
+
3416
+ #ifndef _SFX
3417
+
3418
+ bool ParseComplexSize(const wchar_t *s, UInt64 &result)
3419
+ {
3420
+ result = 0;
3421
+ const wchar_t *end;
3422
+ UInt64 number = ConvertStringToUInt64(s, &end);
3423
+ if (end == s)
3424
+ return false;
3425
+ if (*end == 0)
3426
+ {
3427
+ result = number;
3428
+ return true;
3429
+ }
3430
+ if (end[1] != 0)
3431
+ return false;
3432
+ unsigned numBits;
3433
+ switch (MyCharLower_Ascii(*end))
3434
+ {
3435
+ case 'b': result = number; return true;
3436
+ case 'k': numBits = 10; break;
3437
+ case 'm': numBits = 20; break;
3438
+ case 'g': numBits = 30; break;
3439
+ case 't': numBits = 40; break;
3440
+ default: return false;
3441
+ }
3442
+ if (number >= ((UInt64)1 << (64 - numBits)))
3443
+ return false;
3444
+ result = number << numBits;
3445
+ return true;
3446
+ }
3447
+
3448
+ static bool ParseTypeParams(const UString &s, COpenType &type)
3449
+ {
3450
+ if (s[0] == 0)
3451
+ return true;
3452
+ if (s[1] == 0)
3453
+ {
3454
+ switch ((unsigned)(Byte)s[0])
3455
+ {
3456
+ case 'e': type.EachPos = true; return true;
3457
+ case 'a': type.CanReturnArc = true; return true;
3458
+ case 'r': type.Recursive = true; return true;
3459
+ }
3460
+ return false;
3461
+ }
3462
+ if (s[0] == 's')
3463
+ {
3464
+ UInt64 result;
3465
+ if (!ParseComplexSize(s.Ptr(1), result))
3466
+ return false;
3467
+ type.MaxStartOffset = result;
3468
+ type.MaxStartOffset_Defined = true;
3469
+ return true;
3470
+ }
3471
+
3472
+ return false;
3473
+ }
3474
+
3475
+ bool ParseType(CCodecs &codecs, const UString &s, COpenType &type)
3476
+ {
3477
+ int pos2 = s.Find(L':');
3478
+
3479
+ {
3480
+ UString name;
3481
+ if (pos2 < 0)
3482
+ {
3483
+ name = s;
3484
+ pos2 = s.Len();
3485
+ }
3486
+ else
3487
+ {
3488
+ name = s.Left(pos2);
3489
+ pos2++;
3490
+ }
3491
+
3492
+ int index = codecs.FindFormatForArchiveType(name);
3493
+ type.Recursive = false;
3494
+
3495
+ if (index < 0)
3496
+ {
3497
+ if (name[0] == '*')
3498
+ {
3499
+ if (name[1] != 0)
3500
+ return false;
3501
+ }
3502
+ else if (name[0] == '#')
3503
+ {
3504
+ if (name[1] != 0)
3505
+ return false;
3506
+ type.CanReturnArc = false;
3507
+ type.CanReturnParser = true;
3508
+ }
3509
+ else
3510
+ return false;
3511
+ }
3512
+
3513
+ type.FormatIndex = index;
3514
+
3515
+ }
3516
+
3517
+ for (unsigned i = pos2; i < s.Len();)
3518
+ {
3519
+ int next = s.Find(L':', i);
3520
+ if (next < 0)
3521
+ next = s.Len();
3522
+ const UString name = s.Mid(i, next - i);
3523
+ if (name.IsEmpty())
3524
+ return false;
3525
+ if (!ParseTypeParams(name, type))
3526
+ return false;
3527
+ i = next + 1;
3528
+ }
3529
+
3530
+ return true;
3531
+ }
3532
+
3533
+ bool ParseOpenTypes(CCodecs &codecs, const UString &s, CObjectVector<COpenType> &types)
3534
+ {
3535
+ types.Clear();
3536
+ for (unsigned pos = 0; pos < s.Len();)
3537
+ {
3538
+ int pos2 = s.Find(L'.', pos);
3539
+ if (pos2 < 0)
3540
+ pos2 = s.Len();
3541
+ UString name = s.Mid(pos, pos2 - pos);
3542
+ if (name.IsEmpty())
3543
+ return false;
3544
+ COpenType type;
3545
+ if (!ParseType(codecs, name, type))
3546
+ return false;
3547
+ types.Add(type);
3548
+ pos = pos2 + 1;
3549
+ }
3550
+ return true;
3551
+ }
3552
+
3553
+ #endif