seven_zip_ruby_am 1.2.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (734) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +26 -0
  3. data/.travis.yml +35 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +39 -0
  6. data/README.md +210 -0
  7. data/Rakefile +67 -0
  8. data/ext/C/Types.h +254 -0
  9. data/ext/CPP/7zip/Archive/IArchive.h +234 -0
  10. data/ext/CPP/7zip/IDecl.h +15 -0
  11. data/ext/CPP/7zip/IPassword.h +24 -0
  12. data/ext/CPP/7zip/IProgress.h +33 -0
  13. data/ext/CPP/7zip/IStream.h +58 -0
  14. data/ext/CPP/7zip/PropID.h +76 -0
  15. data/ext/CPP/Common/MyCom.h +225 -0
  16. data/ext/CPP/Common/MyGuidDef.h +54 -0
  17. data/ext/CPP/Common/MyInitGuid.h +22 -0
  18. data/ext/CPP/Common/MyUnknown.h +13 -0
  19. data/ext/CPP/Common/MyWindows.h +204 -0
  20. data/ext/CPP/Common/Types.h +11 -0
  21. data/ext/CPP/Windows/PropVariant.h +56 -0
  22. data/ext/CPP/include_windows/basetyps.h +19 -0
  23. data/ext/CPP/include_windows/tchar.h +89 -0
  24. data/ext/CPP/include_windows/windows.h +194 -0
  25. data/ext/p7zip/Asm/x64/7zCrcT8U.asm +103 -0
  26. data/ext/p7zip/Asm/x86/7zCrcT8U.asm +101 -0
  27. data/ext/p7zip/C/7zBuf.h +39 -0
  28. data/ext/p7zip/C/7zBuf2.c +45 -0
  29. data/ext/p7zip/C/7zCrc.c +76 -0
  30. data/ext/p7zip/C/7zCrc.h +25 -0
  31. data/ext/p7zip/C/7zCrcOpt.c +34 -0
  32. data/ext/p7zip/C/7zCrcT8.c +43 -0
  33. data/ext/p7zip/C/7zStream.c +169 -0
  34. data/ext/p7zip/C/7zVersion.h +7 -0
  35. data/ext/p7zip/C/Aes.c +284 -0
  36. data/ext/p7zip/C/Aes.h +38 -0
  37. data/ext/p7zip/C/Alloc.back3 +238 -0
  38. data/ext/p7zip/C/Alloc.c +280 -0
  39. data/ext/p7zip/C/Alloc.c.back +243 -0
  40. data/ext/p7zip/C/Alloc.c.back2 +222 -0
  41. data/ext/p7zip/C/Alloc.h +27 -0
  42. data/ext/p7zip/C/Bra.c +133 -0
  43. data/ext/p7zip/C/Bra.h +68 -0
  44. data/ext/p7zip/C/Bra86.c +85 -0
  45. data/ext/p7zip/C/BraIA64.c +67 -0
  46. data/ext/p7zip/C/BwtSort.c +516 -0
  47. data/ext/p7zip/C/BwtSort.h +30 -0
  48. data/ext/p7zip/C/CpuArch.c +168 -0
  49. data/ext/p7zip/C/CpuArch.h +155 -0
  50. data/ext/p7zip/C/Delta.c +62 -0
  51. data/ext/p7zip/C/Delta.h +23 -0
  52. data/ext/p7zip/C/HuffEnc.c +146 -0
  53. data/ext/p7zip/C/HuffEnc.h +27 -0
  54. data/ext/p7zip/C/LzFind.c +761 -0
  55. data/ext/p7zip/C/LzFind.h +115 -0
  56. data/ext/p7zip/C/LzFindMt.c +793 -0
  57. data/ext/p7zip/C/LzFindMt.h +105 -0
  58. data/ext/p7zip/C/LzHash.h +54 -0
  59. data/ext/p7zip/C/Lzma2Dec.c +356 -0
  60. data/ext/p7zip/C/Lzma2Dec.h +84 -0
  61. data/ext/p7zip/C/Lzma2Enc.c +477 -0
  62. data/ext/p7zip/C/Lzma2Enc.h +66 -0
  63. data/ext/p7zip/C/LzmaDec.c +999 -0
  64. data/ext/p7zip/C/LzmaDec.h +231 -0
  65. data/ext/p7zip/C/LzmaEnc.c +2268 -0
  66. data/ext/p7zip/C/LzmaEnc.h +80 -0
  67. data/ext/p7zip/C/LzmaUtil/Lzma86Dec.c +61 -0
  68. data/ext/p7zip/C/LzmaUtil/Lzma86Dec.h +51 -0
  69. data/ext/p7zip/C/LzmaUtil/Lzma86Enc.c +113 -0
  70. data/ext/p7zip/C/LzmaUtil/Lzma86Enc.h +78 -0
  71. data/ext/p7zip/C/MtCoder.c +327 -0
  72. data/ext/p7zip/C/MtCoder.h +98 -0
  73. data/ext/p7zip/C/Ppmd.h +85 -0
  74. data/ext/p7zip/C/Ppmd7.c +708 -0
  75. data/ext/p7zip/C/Ppmd7.h +140 -0
  76. data/ext/p7zip/C/Ppmd7Dec.c +187 -0
  77. data/ext/p7zip/C/Ppmd7Enc.c +185 -0
  78. data/ext/p7zip/C/Ppmd8.c +1120 -0
  79. data/ext/p7zip/C/Ppmd8.h +133 -0
  80. data/ext/p7zip/C/Ppmd8Dec.c +155 -0
  81. data/ext/p7zip/C/Ppmd8Enc.c +161 -0
  82. data/ext/p7zip/C/RotateDefs.h +20 -0
  83. data/ext/p7zip/C/Sha256.c +204 -0
  84. data/ext/p7zip/C/Sha256.h +26 -0
  85. data/ext/p7zip/C/Sort.c +93 -0
  86. data/ext/p7zip/C/Sort.h +20 -0
  87. data/ext/p7zip/C/Threads.c +582 -0
  88. data/ext/p7zip/C/Threads.h +123 -0
  89. data/ext/p7zip/C/Types.h +254 -0
  90. data/ext/p7zip/C/Xz.c +88 -0
  91. data/ext/p7zip/C/Xz.h +252 -0
  92. data/ext/p7zip/C/XzCrc64.c +33 -0
  93. data/ext/p7zip/C/XzCrc64.h +26 -0
  94. data/ext/p7zip/C/XzDec.c +875 -0
  95. data/ext/p7zip/C/XzEnc.c +497 -0
  96. data/ext/p7zip/C/XzEnc.h +25 -0
  97. data/ext/p7zip/C/XzIn.c +306 -0
  98. data/ext/p7zip/CPP/7zip/Archive/7z/7zCompressionMode.cpp +3 -0
  99. data/ext/p7zip/CPP/7zip/Archive/7z/7zCompressionMode.h +50 -0
  100. data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.cpp +332 -0
  101. data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.h +68 -0
  102. data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.cpp +444 -0
  103. data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.h +55 -0
  104. data/ext/p7zip/CPP/7zip/Archive/7z/7zExtract.cpp +270 -0
  105. data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.cpp +123 -0
  106. data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.h +58 -0
  107. data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.cpp +149 -0
  108. data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.h +58 -0
  109. data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.cpp +482 -0
  110. data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.h +119 -0
  111. data/ext/p7zip/CPP/7zip/Archive/7z/7zHandlerOut.cpp +483 -0
  112. data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.cpp +14 -0
  113. data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.h +97 -0
  114. data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.cpp +1276 -0
  115. data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.h +245 -0
  116. data/ext/p7zip/CPP/7zip/Archive/7z/7zItem.h +268 -0
  117. data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.cpp +866 -0
  118. data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.h +152 -0
  119. data/ext/p7zip/CPP/7zip/Archive/7z/7zProperties.cpp +164 -0
  120. data/ext/p7zip/CPP/7zip/Archive/7z/7zProperties.h +22 -0
  121. data/ext/p7zip/CPP/7zip/Archive/7z/7zRegister.cpp +18 -0
  122. data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.cpp +24 -0
  123. data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.h +35 -0
  124. data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.cpp +1216 -0
  125. data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.h +88 -0
  126. data/ext/p7zip/CPP/7zip/Archive/ApmHandler.cpp +356 -0
  127. data/ext/p7zip/CPP/7zip/Archive/ArchiveExports.cpp +135 -0
  128. data/ext/p7zip/CPP/7zip/Archive/ArjHandler.cpp +798 -0
  129. data/ext/p7zip/CPP/7zip/Archive/Bz2Handler.cpp +423 -0
  130. data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.cpp +189 -0
  131. data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.h +44 -0
  132. data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.cpp +929 -0
  133. data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.h +28 -0
  134. data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.cpp +15 -0
  135. data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.h +44 -0
  136. data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.cpp +272 -0
  137. data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.h +161 -0
  138. data/ext/p7zip/CPP/7zip/Archive/Cab/CabItem.h +63 -0
  139. data/ext/p7zip/CPP/7zip/Archive/Cab/CabRegister.cpp +13 -0
  140. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.cpp +721 -0
  141. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.h +29 -0
  142. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.cpp +24 -0
  143. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.h +28 -0
  144. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.cpp +937 -0
  145. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.h +244 -0
  146. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmRegister.cpp +13 -0
  147. data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.cpp +239 -0
  148. data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.h +28 -0
  149. data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.cpp +389 -0
  150. data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.h +119 -0
  151. data/ext/p7zip/CPP/7zip/Archive/Com/ComRegister.cpp +13 -0
  152. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.cpp +121 -0
  153. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.h +174 -0
  154. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.cpp +240 -0
  155. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.h +80 -0
  156. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.cpp +239 -0
  157. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.h +88 -0
  158. data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.cpp +15 -0
  159. data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.h +37 -0
  160. data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.cpp +22 -0
  161. data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.h +24 -0
  162. data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.cpp +62 -0
  163. data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.h +12 -0
  164. data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.cpp +623 -0
  165. data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.h +87 -0
  166. data/ext/p7zip/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +42 -0
  167. data/ext/p7zip/CPP/7zip/Archive/Common/InStreamWithCRC.h +67 -0
  168. data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.cpp +61 -0
  169. data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.h +24 -0
  170. data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.cpp +190 -0
  171. data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.h +84 -0
  172. data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +18 -0
  173. data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.h +36 -0
  174. data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp +18 -0
  175. data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.h +36 -0
  176. data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.cpp +177 -0
  177. data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.h +18 -0
  178. data/ext/p7zip/CPP/7zip/Archive/CpioHandler.cpp +624 -0
  179. data/ext/p7zip/CPP/7zip/Archive/CramfsHandler.cpp +644 -0
  180. data/ext/p7zip/CPP/7zip/Archive/DebHandler.cpp +413 -0
  181. data/ext/p7zip/CPP/7zip/Archive/DeflateProps.cpp +118 -0
  182. data/ext/p7zip/CPP/7zip/Archive/DeflateProps.h +35 -0
  183. data/ext/p7zip/CPP/7zip/Archive/DllExports2.cpp +76 -0
  184. data/ext/p7zip/CPP/7zip/Archive/DmgHandler.cpp +918 -0
  185. data/ext/p7zip/CPP/7zip/Archive/ElfHandler.cpp +534 -0
  186. data/ext/p7zip/CPP/7zip/Archive/FatHandler.cpp +996 -0
  187. data/ext/p7zip/CPP/7zip/Archive/FlvHandler.cpp +544 -0
  188. data/ext/p7zip/CPP/7zip/Archive/GzHandler.cpp +698 -0
  189. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.cpp +243 -0
  190. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.h +26 -0
  191. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.cpp +480 -0
  192. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.h +154 -0
  193. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsRegister.cpp +13 -0
  194. data/ext/p7zip/CPP/7zip/Archive/IArchive.h +234 -0
  195. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.cpp +326 -0
  196. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.h +30 -0
  197. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.cpp +21 -0
  198. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.h +61 -0
  199. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.cpp +453 -0
  200. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.h +315 -0
  201. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoItem.h +141 -0
  202. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoRegister.cpp +13 -0
  203. data/ext/p7zip/CPP/7zip/Archive/LzhHandler.cpp +775 -0
  204. data/ext/p7zip/CPP/7zip/Archive/LzmaHandler.cpp +430 -0
  205. data/ext/p7zip/CPP/7zip/Archive/MachoHandler.cpp +500 -0
  206. data/ext/p7zip/CPP/7zip/Archive/MbrHandler.cpp +507 -0
  207. data/ext/p7zip/CPP/7zip/Archive/MslzHandler.cpp +257 -0
  208. data/ext/p7zip/CPP/7zip/Archive/MubHandler.cpp +266 -0
  209. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.cpp +130 -0
  210. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.h +47 -0
  211. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.cpp +510 -0
  212. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.h +43 -0
  213. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.cpp +1461 -0
  214. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.h +181 -0
  215. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisRegister.cpp +13 -0
  216. data/ext/p7zip/CPP/7zip/Archive/NtfsHandler.cpp +1764 -0
  217. data/ext/p7zip/CPP/7zip/Archive/PeHandler.cpp +1752 -0
  218. data/ext/p7zip/CPP/7zip/Archive/PpmdHandler.cpp +456 -0
  219. data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.cpp +869 -0
  220. data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.h +66 -0
  221. data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.cpp +21 -0
  222. data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.h +205 -0
  223. data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.cpp +478 -0
  224. data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.h +123 -0
  225. data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.cpp +55 -0
  226. data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.h +79 -0
  227. data/ext/p7zip/CPP/7zip/Archive/Rar/RarRegister.cpp +13 -0
  228. data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp +78 -0
  229. data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.h +49 -0
  230. data/ext/p7zip/CPP/7zip/Archive/RpmHandler.cpp +292 -0
  231. data/ext/p7zip/CPP/7zip/Archive/SplitHandler.cpp +366 -0
  232. data/ext/p7zip/CPP/7zip/Archive/SquashfsHandler.cpp +2155 -0
  233. data/ext/p7zip/CPP/7zip/Archive/SwfHandler.cpp +706 -0
  234. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.cpp +386 -0
  235. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.h +61 -0
  236. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandlerOut.cpp +122 -0
  237. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.cpp +25 -0
  238. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.h +108 -0
  239. data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.cpp +207 -0
  240. data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.h +17 -0
  241. data/ext/p7zip/CPP/7zip/Archive/Tar/TarItem.h +72 -0
  242. data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.cpp +187 -0
  243. data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.h +28 -0
  244. data/ext/p7zip/CPP/7zip/Archive/Tar/TarRegister.cpp +18 -0
  245. data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.cpp +139 -0
  246. data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.h +34 -0
  247. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.cpp +451 -0
  248. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.h +37 -0
  249. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.cpp +876 -0
  250. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.h +375 -0
  251. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfRegister.cpp +13 -0
  252. data/ext/p7zip/CPP/7zip/Archive/VhdHandler.cpp +734 -0
  253. data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.cpp +660 -0
  254. data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.h +77 -0
  255. data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandlerOut.cpp +639 -0
  256. data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.cpp +855 -0
  257. data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.h +297 -0
  258. data/ext/p7zip/CPP/7zip/Archive/Wim/WimRegister.cpp +18 -0
  259. data/ext/p7zip/CPP/7zip/Archive/XarHandler.cpp +588 -0
  260. data/ext/p7zip/CPP/7zip/Archive/XzHandler.cpp +707 -0
  261. data/ext/p7zip/CPP/7zip/Archive/ZHandler.cpp +161 -0
  262. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.cpp +379 -0
  263. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.h +56 -0
  264. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipCompressionMode.h +42 -0
  265. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.cpp +822 -0
  266. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.h +101 -0
  267. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp +537 -0
  268. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.cpp +36 -0
  269. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.h +284 -0
  270. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.cpp +893 -0
  271. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.h +125 -0
  272. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.cpp +181 -0
  273. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.h +281 -0
  274. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItemEx.h +34 -0
  275. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.cpp +289 -0
  276. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.h +56 -0
  277. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipRegister.cpp +18 -0
  278. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.cpp +1076 -0
  279. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.h +58 -0
  280. data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile +328 -0
  281. data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.depend +4962 -0
  282. data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.list +265 -0
  283. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zFM.txt +163 -0
  284. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zG.txt +131 -0
  285. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7za.txt +253 -0
  286. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_ALL.txt +32 -0
  287. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_Format7zFree.txt +290 -0
  288. data/ext/p7zip/CPP/7zip/CMAKE/generate.sh +37 -0
  289. data/ext/p7zip/CPP/7zip/CMAKE/generate_xcode.sh +32 -0
  290. data/ext/p7zip/CPP/7zip/Common/CWrappers.cpp +226 -0
  291. data/ext/p7zip/CPP/7zip/Common/CWrappers.h +109 -0
  292. data/ext/p7zip/CPP/7zip/Common/CreateCoder.cpp +293 -0
  293. data/ext/p7zip/CPP/7zip/Common/CreateCoder.h +98 -0
  294. data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.cpp +55 -0
  295. data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.h +10 -0
  296. data/ext/p7zip/CPP/7zip/Common/FileStreams.cpp +273 -0
  297. data/ext/p7zip/CPP/7zip/Common/FileStreams.h +134 -0
  298. data/ext/p7zip/CPP/7zip/Common/FilterCoder.cpp +247 -0
  299. data/ext/p7zip/CPP/7zip/Common/FilterCoder.h +128 -0
  300. data/ext/p7zip/CPP/7zip/Common/InBuffer.cpp +83 -0
  301. data/ext/p7zip/CPP/7zip/Common/InBuffer.h +81 -0
  302. data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.cpp +122 -0
  303. data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.h +48 -0
  304. data/ext/p7zip/CPP/7zip/Common/LimitedStreams.cpp +154 -0
  305. data/ext/p7zip/CPP/7zip/Common/LimitedStreams.h +125 -0
  306. data/ext/p7zip/CPP/7zip/Common/LockedStream.cpp +23 -0
  307. data/ext/p7zip/CPP/7zip/Common/LockedStream.h +38 -0
  308. data/ext/p7zip/CPP/7zip/Common/MemBlocks.cpp +183 -0
  309. data/ext/p7zip/CPP/7zip/Common/MemBlocks.h +71 -0
  310. data/ext/p7zip/CPP/7zip/Common/MethodId.cpp +27 -0
  311. data/ext/p7zip/CPP/7zip/Common/MethodId.h +10 -0
  312. data/ext/p7zip/CPP/7zip/Common/MethodProps.cpp +99 -0
  313. data/ext/p7zip/CPP/7zip/Common/MethodProps.h +41 -0
  314. data/ext/p7zip/CPP/7zip/Common/OffsetStream.cpp +35 -0
  315. data/ext/p7zip/CPP/7zip/Common/OffsetStream.h +25 -0
  316. data/ext/p7zip/CPP/7zip/Common/OutBuffer.cpp +116 -0
  317. data/ext/p7zip/CPP/7zip/Common/OutBuffer.h +64 -0
  318. data/ext/p7zip/CPP/7zip/Common/OutMemStream.cpp +142 -0
  319. data/ext/p7zip/CPP/7zip/Common/OutMemStream.h +96 -0
  320. data/ext/p7zip/CPP/7zip/Common/ProgressMt.cpp +53 -0
  321. data/ext/p7zip/CPP/7zip/Common/ProgressMt.h +46 -0
  322. data/ext/p7zip/CPP/7zip/Common/ProgressUtils.cpp +42 -0
  323. data/ext/p7zip/CPP/7zip/Common/ProgressUtils.h +34 -0
  324. data/ext/p7zip/CPP/7zip/Common/RegisterArc.h +32 -0
  325. data/ext/p7zip/CPP/7zip/Common/RegisterCodec.h +33 -0
  326. data/ext/p7zip/CPP/7zip/Common/StreamBinder.cpp +152 -0
  327. data/ext/p7zip/CPP/7zip/Common/StreamBinder.h +38 -0
  328. data/ext/p7zip/CPP/7zip/Common/StreamObjects.cpp +221 -0
  329. data/ext/p7zip/CPP/7zip/Common/StreamObjects.h +135 -0
  330. data/ext/p7zip/CPP/7zip/Common/StreamUtils.cpp +56 -0
  331. data/ext/p7zip/CPP/7zip/Common/StreamUtils.h +13 -0
  332. data/ext/p7zip/CPP/7zip/Common/VirtThread.cpp +46 -0
  333. data/ext/p7zip/CPP/7zip/Common/VirtThread.h +23 -0
  334. data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.cpp +309 -0
  335. data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.h +98 -0
  336. data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.cpp +90 -0
  337. data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.h +59 -0
  338. data/ext/p7zip/CPP/7zip/Compress/BZip2Const.h +54 -0
  339. data/ext/p7zip/CPP/7zip/Compress/BZip2Crc.cpp +26 -0
  340. data/ext/p7zip/CPP/7zip/Compress/BZip2Crc.h +31 -0
  341. data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.cpp +943 -0
  342. data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.h +205 -0
  343. data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.cpp +895 -0
  344. data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.h +245 -0
  345. data/ext/p7zip/CPP/7zip/Compress/BZip2Register.cpp +20 -0
  346. data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.cpp +386 -0
  347. data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.h +115 -0
  348. data/ext/p7zip/CPP/7zip/Compress/Bcj2Register.cpp +19 -0
  349. data/ext/p7zip/CPP/7zip/Compress/BcjCoder.cpp +15 -0
  350. data/ext/p7zip/CPP/7zip/Compress/BcjCoder.h +19 -0
  351. data/ext/p7zip/CPP/7zip/Compress/BcjRegister.cpp +19 -0
  352. data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.cpp +24 -0
  353. data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.h +141 -0
  354. data/ext/p7zip/CPP/7zip/Compress/BitlEncoder.h +57 -0
  355. data/ext/p7zip/CPP/7zip/Compress/BitmDecoder.h +66 -0
  356. data/ext/p7zip/CPP/7zip/Compress/BitmEncoder.h +50 -0
  357. data/ext/p7zip/CPP/7zip/Compress/BranchCoder.cpp +19 -0
  358. data/ext/p7zip/CPP/7zip/Compress/BranchCoder.h +44 -0
  359. data/ext/p7zip/CPP/7zip/Compress/BranchMisc.cpp +37 -0
  360. data/ext/p7zip/CPP/7zip/Compress/BranchMisc.h +14 -0
  361. data/ext/p7zip/CPP/7zip/Compress/BranchRegister.cpp +30 -0
  362. data/ext/p7zip/CPP/7zip/Compress/ByteSwap.cpp +73 -0
  363. data/ext/p7zip/CPP/7zip/Compress/CodecExports.cpp +160 -0
  364. data/ext/p7zip/CPP/7zip/Compress/CopyCoder.cpp +67 -0
  365. data/ext/p7zip/CPP/7zip/Compress/CopyCoder.h +34 -0
  366. data/ext/p7zip/CPP/7zip/Compress/CopyRegister.cpp +14 -0
  367. data/ext/p7zip/CPP/7zip/Compress/Deflate64Register.cpp +20 -0
  368. data/ext/p7zip/CPP/7zip/Compress/DeflateConst.h +134 -0
  369. data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.cpp +353 -0
  370. data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.h +157 -0
  371. data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.cpp +986 -0
  372. data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.h +211 -0
  373. data/ext/p7zip/CPP/7zip/Compress/DeflateRegister.cpp +21 -0
  374. data/ext/p7zip/CPP/7zip/Compress/DeltaFilter.cpp +112 -0
  375. data/ext/p7zip/CPP/7zip/Compress/DllExports.cpp +39 -0
  376. data/ext/p7zip/CPP/7zip/Compress/DllExports2.cpp +28 -0
  377. data/ext/p7zip/CPP/7zip/Compress/HuffmanDecoder.h +89 -0
  378. data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.cpp +219 -0
  379. data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.h +57 -0
  380. data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp +89 -0
  381. data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.h +34 -0
  382. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp +531 -0
  383. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp +1018 -0
  384. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h +48 -0
  385. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp +311 -0
  386. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h +20 -0
  387. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/makefile +173 -0
  388. data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.cpp +14 -0
  389. data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.h +66 -0
  390. data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.cpp +220 -0
  391. data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.h +106 -0
  392. data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.cpp +189 -0
  393. data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.h +73 -0
  394. data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.cpp +94 -0
  395. data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.h +36 -0
  396. data/ext/p7zip/CPP/7zip/Compress/Lzma2Register.cpp +20 -0
  397. data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.cpp +252 -0
  398. data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.h +84 -0
  399. data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.cpp +149 -0
  400. data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.h +36 -0
  401. data/ext/p7zip/CPP/7zip/Compress/LzmaRegister.cpp +20 -0
  402. data/ext/p7zip/CPP/7zip/Compress/Lzx.h +61 -0
  403. data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.cpp +90 -0
  404. data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.h +46 -0
  405. data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.cpp +387 -0
  406. data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.h +159 -0
  407. data/ext/p7zip/CPP/7zip/Compress/Mtf8.h +193 -0
  408. data/ext/p7zip/CPP/7zip/Compress/PpmdDecoder.cpp +167 -0
  409. data/ext/p7zip/CPP/7zip/Compress/PpmdDecoder.h +78 -0
  410. data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.cpp +119 -0
  411. data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.h +48 -0
  412. data/ext/p7zip/CPP/7zip/Compress/PpmdRegister.cpp +21 -0
  413. data/ext/p7zip/CPP/7zip/Compress/PpmdZip.cpp +223 -0
  414. data/ext/p7zip/CPP/7zip/Compress/PpmdZip.h +72 -0
  415. data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.cpp +175 -0
  416. data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.h +264 -0
  417. data/ext/p7zip/CPP/7zip/Compress/RangeCoder.h +205 -0
  418. data/ext/p7zip/CPP/7zip/Compress/RangeCoderBit.h +114 -0
  419. data/ext/p7zip/CPP/7zip/Compress/Rar/makefile +34 -0
  420. data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.depend +158 -0
  421. data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.list +64 -0
  422. data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.cpp +480 -0
  423. data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.h +88 -0
  424. data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.cpp +391 -0
  425. data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.h +174 -0
  426. data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.cpp +897 -0
  427. data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.h +267 -0
  428. data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.cpp +1091 -0
  429. data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.h +179 -0
  430. data/ext/p7zip/CPP/7zip/Compress/RarCodecsRegister.cpp +26 -0
  431. data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.cpp +145 -0
  432. data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.h +38 -0
  433. data/ext/p7zip/CPP/7zip/Compress/ZDecoder.cpp +159 -0
  434. data/ext/p7zip/CPP/7zip/Compress/ZDecoder.h +42 -0
  435. data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.cpp +89 -0
  436. data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.h +48 -0
  437. data/ext/p7zip/CPP/7zip/Compress/ZlibEncoder.cpp +61 -0
  438. data/ext/p7zip/CPP/7zip/Compress/ZlibEncoder.h +48 -0
  439. data/ext/p7zip/CPP/7zip/Crypto/7zAes.cpp +244 -0
  440. data/ext/p7zip/CPP/7zip/Crypto/7zAes.h +117 -0
  441. data/ext/p7zip/CPP/7zip/Crypto/7zAesRegister.cpp +18 -0
  442. data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.cpp +109 -0
  443. data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.h +39 -0
  444. data/ext/p7zip/CPP/7zip/Crypto/MyAes.cpp +48 -0
  445. data/ext/p7zip/CPP/7zip/Crypto/MyAes.h +38 -0
  446. data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp +83 -0
  447. data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.h +21 -0
  448. data/ext/p7zip/CPP/7zip/Crypto/RandGen.cpp +107 -0
  449. data/ext/p7zip/CPP/7zip/Crypto/RandGen.h +21 -0
  450. data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.cpp +133 -0
  451. data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.h +50 -0
  452. data/ext/p7zip/CPP/7zip/Crypto/RarAes.cpp +134 -0
  453. data/ext/p7zip/CPP/7zip/Crypto/RarAes.h +47 -0
  454. data/ext/p7zip/CPP/7zip/Crypto/Sha1.cpp +229 -0
  455. data/ext/p7zip/CPP/7zip/Crypto/Sha1.h +68 -0
  456. data/ext/p7zip/CPP/7zip/Crypto/WzAes.cpp +221 -0
  457. data/ext/p7zip/CPP/7zip/Crypto/WzAes.h +125 -0
  458. data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.cpp +88 -0
  459. data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.h +56 -0
  460. data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.cpp +164 -0
  461. data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.h +47 -0
  462. data/ext/p7zip/CPP/7zip/Guid.txt +170 -0
  463. data/ext/p7zip/CPP/7zip/ICoder.h +186 -0
  464. data/ext/p7zip/CPP/7zip/IDecl.h +15 -0
  465. data/ext/p7zip/CPP/7zip/IPassword.h +24 -0
  466. data/ext/p7zip/CPP/7zip/IProgress.h +33 -0
  467. data/ext/p7zip/CPP/7zip/IStream.h +58 -0
  468. data/ext/p7zip/CPP/7zip/MyVersion.h +11 -0
  469. data/ext/p7zip/CPP/7zip/PREMAKE/generate.sh +18 -0
  470. data/ext/p7zip/CPP/7zip/PREMAKE/premake4.lua +263 -0
  471. data/ext/p7zip/CPP/7zip/PropID.h +76 -0
  472. data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA.pro +228 -0
  473. data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA_osx.pro +228 -0
  474. data/ext/p7zip/CPP/7zip/QMAKE/test_emul/test_emul.pro +26 -0
  475. data/ext/p7zip/CPP/7zip/TEST/TestUI/TestUI.cpp +560 -0
  476. data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile +33 -0
  477. data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.depend +577 -0
  478. data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.list +16 -0
  479. data/ext/p7zip/CPP/Common/AutoPtr.h +35 -0
  480. data/ext/p7zip/CPP/Common/Buffer.h +77 -0
  481. data/ext/p7zip/CPP/Common/CRC.cpp +7 -0
  482. data/ext/p7zip/CPP/Common/C_FileIO.cpp +88 -0
  483. data/ext/p7zip/CPP/Common/C_FileIO.h +47 -0
  484. data/ext/p7zip/CPP/Common/ComTry.h +18 -0
  485. data/ext/p7zip/CPP/Common/CommandLineParser.cpp +230 -0
  486. data/ext/p7zip/CPP/Common/CommandLineParser.h +72 -0
  487. data/ext/p7zip/CPP/Common/Defs.h +20 -0
  488. data/ext/p7zip/CPP/Common/DynamicBuffer.h +50 -0
  489. data/ext/p7zip/CPP/Common/IntToString.cpp +77 -0
  490. data/ext/p7zip/CPP/Common/IntToString.h +19 -0
  491. data/ext/p7zip/CPP/Common/Lang.cpp +130 -0
  492. data/ext/p7zip/CPP/Common/Lang.h +28 -0
  493. data/ext/p7zip/CPP/Common/ListFileUtils.cpp +75 -0
  494. data/ext/p7zip/CPP/Common/ListFileUtils.h +11 -0
  495. data/ext/p7zip/CPP/Common/MyCom.h +225 -0
  496. data/ext/p7zip/CPP/Common/MyException.h +14 -0
  497. data/ext/p7zip/CPP/Common/MyGuidDef.h +54 -0
  498. data/ext/p7zip/CPP/Common/MyInitGuid.h +22 -0
  499. data/ext/p7zip/CPP/Common/MyMap.cpp +140 -0
  500. data/ext/p7zip/CPP/Common/MyMap.h +28 -0
  501. data/ext/p7zip/CPP/Common/MyString.cpp +206 -0
  502. data/ext/p7zip/CPP/Common/MyString.h +601 -0
  503. data/ext/p7zip/CPP/Common/MyUnknown.h +13 -0
  504. data/ext/p7zip/CPP/Common/MyVector.cpp +87 -0
  505. data/ext/p7zip/CPP/Common/MyVector.h +266 -0
  506. data/ext/p7zip/CPP/Common/MyWindows.cpp +111 -0
  507. data/ext/p7zip/CPP/Common/MyWindows.h +218 -0
  508. data/ext/p7zip/CPP/Common/MyXml.cpp +209 -0
  509. data/ext/p7zip/CPP/Common/MyXml.h +40 -0
  510. data/ext/p7zip/CPP/Common/NewHandler.h +16 -0
  511. data/ext/p7zip/CPP/Common/StdInStream.cpp +100 -0
  512. data/ext/p7zip/CPP/Common/StdInStream.h +32 -0
  513. data/ext/p7zip/CPP/Common/StdOutStream.cpp +93 -0
  514. data/ext/p7zip/CPP/Common/StdOutStream.h +35 -0
  515. data/ext/p7zip/CPP/Common/StringConvert.cpp +181 -0
  516. data/ext/p7zip/CPP/Common/StringConvert.h +73 -0
  517. data/ext/p7zip/CPP/Common/StringToInt.cpp +90 -0
  518. data/ext/p7zip/CPP/Common/StringToInt.h +18 -0
  519. data/ext/p7zip/CPP/Common/TextConfig.cpp +138 -0
  520. data/ext/p7zip/CPP/Common/TextConfig.h +22 -0
  521. data/ext/p7zip/CPP/Common/Types.h +11 -0
  522. data/ext/p7zip/CPP/Common/UTFConvert.cpp +145 -0
  523. data/ext/p7zip/CPP/Common/UTFConvert.h +11 -0
  524. data/ext/p7zip/CPP/Common/Wildcard.cpp +462 -0
  525. data/ext/p7zip/CPP/Common/Wildcard.h +80 -0
  526. data/ext/p7zip/CPP/Windows/COM.cpp +37 -0
  527. data/ext/p7zip/CPP/Windows/COM.h +69 -0
  528. data/ext/p7zip/CPP/Windows/Clipboard.cpp +160 -0
  529. data/ext/p7zip/CPP/Windows/Clipboard.h +28 -0
  530. data/ext/p7zip/CPP/Windows/CommonDialog.h +19 -0
  531. data/ext/p7zip/CPP/Windows/Control/ComboBox.h +82 -0
  532. data/ext/p7zip/CPP/Windows/Control/Controls.cpp +515 -0
  533. data/ext/p7zip/CPP/Windows/Control/Dialog.cpp +560 -0
  534. data/ext/p7zip/CPP/Windows/Control/Dialog.h +179 -0
  535. data/ext/p7zip/CPP/Windows/Control/DialogImpl.h +73 -0
  536. data/ext/p7zip/CPP/Windows/Control/Edit.h +24 -0
  537. data/ext/p7zip/CPP/Windows/Control/ListView.h +164 -0
  538. data/ext/p7zip/CPP/Windows/Control/ProgressBar.h +34 -0
  539. data/ext/p7zip/CPP/Windows/Control/Static.h +23 -0
  540. data/ext/p7zip/CPP/Windows/Control/StatusBar.h +56 -0
  541. data/ext/p7zip/CPP/Windows/Control/Window2.cpp +211 -0
  542. data/ext/p7zip/CPP/Windows/Control/Window2.h +111 -0
  543. data/ext/p7zip/CPP/Windows/DLL.cpp +193 -0
  544. data/ext/p7zip/CPP/Windows/DLL.h +48 -0
  545. data/ext/p7zip/CPP/Windows/Defs.h +17 -0
  546. data/ext/p7zip/CPP/Windows/Error.cpp +58 -0
  547. data/ext/p7zip/CPP/Windows/Error.h +33 -0
  548. data/ext/p7zip/CPP/Windows/FileDir.cpp +927 -0
  549. data/ext/p7zip/CPP/Windows/FileDir.h +115 -0
  550. data/ext/p7zip/CPP/Windows/FileFind.cpp +604 -0
  551. data/ext/p7zip/CPP/Windows/FileFind.h +126 -0
  552. data/ext/p7zip/CPP/Windows/FileIO.cpp +475 -0
  553. data/ext/p7zip/CPP/Windows/FileIO.h +110 -0
  554. data/ext/p7zip/CPP/Windows/FileName.cpp +50 -0
  555. data/ext/p7zip/CPP/Windows/FileName.h +27 -0
  556. data/ext/p7zip/CPP/Windows/Menu.h +4 -0
  557. data/ext/p7zip/CPP/Windows/NtCheck.h +44 -0
  558. data/ext/p7zip/CPP/Windows/PropVariant.cpp +243 -0
  559. data/ext/p7zip/CPP/Windows/PropVariant.h +56 -0
  560. data/ext/p7zip/CPP/Windows/PropVariantConversions.cpp +142 -0
  561. data/ext/p7zip/CPP/Windows/PropVariantConversions.h +14 -0
  562. data/ext/p7zip/CPP/Windows/PropVariantUtils.cpp +78 -0
  563. data/ext/p7zip/CPP/Windows/PropVariantUtils.h +28 -0
  564. data/ext/p7zip/CPP/Windows/Registry.cpp +313 -0
  565. data/ext/p7zip/CPP/Windows/Registry.h +113 -0
  566. data/ext/p7zip/CPP/Windows/ResourceString.h +22 -0
  567. data/ext/p7zip/CPP/Windows/Shell.h +21 -0
  568. data/ext/p7zip/CPP/Windows/Synchronization.cpp +157 -0
  569. data/ext/p7zip/CPP/Windows/Synchronization.h +187 -0
  570. data/ext/p7zip/CPP/Windows/Synchronization2.h +218 -0
  571. data/ext/p7zip/CPP/Windows/System.cpp +166 -0
  572. data/ext/p7zip/CPP/Windows/System.h +16 -0
  573. data/ext/p7zip/CPP/Windows/Thread.h +41 -0
  574. data/ext/p7zip/CPP/Windows/Time.cpp +88 -0
  575. data/ext/p7zip/CPP/Windows/Time.h +21 -0
  576. data/ext/p7zip/CPP/Windows/Window.cpp +101 -0
  577. data/ext/p7zip/CPP/Windows/Window.h +43 -0
  578. data/ext/p7zip/CPP/include_windows/basetyps.h +19 -0
  579. data/ext/p7zip/CPP/include_windows/tchar.h +89 -0
  580. data/ext/p7zip/CPP/include_windows/windows.h +194 -0
  581. data/ext/p7zip/CPP/myWindows/StdAfx.h +124 -0
  582. data/ext/p7zip/CPP/myWindows/config.h +67 -0
  583. data/ext/p7zip/CPP/myWindows/initguid.h +4 -0
  584. data/ext/p7zip/CPP/myWindows/makefile +21 -0
  585. data/ext/p7zip/CPP/myWindows/makefile.depend +32 -0
  586. data/ext/p7zip/CPP/myWindows/makefile.list +28 -0
  587. data/ext/p7zip/CPP/myWindows/myAddExeFlag.cpp +20 -0
  588. data/ext/p7zip/CPP/myWindows/myGetTickCount.cpp +8 -0
  589. data/ext/p7zip/CPP/myWindows/myPrivate.h +17 -0
  590. data/ext/p7zip/CPP/myWindows/mySplitCommandLine.cpp +82 -0
  591. data/ext/p7zip/CPP/myWindows/test_emul.cpp +745 -0
  592. data/ext/p7zip/CPP/myWindows/wine_GetXXXDefaultLangID.cpp +741 -0
  593. data/ext/p7zip/CPP/myWindows/wine_date_and_time.cpp +434 -0
  594. data/ext/p7zip/ChangeLog +914 -0
  595. data/ext/p7zip/DOCS/7zC.txt +194 -0
  596. data/ext/p7zip/DOCS/7zFormat.txt +469 -0
  597. data/ext/p7zip/DOCS/License.txt +52 -0
  598. data/ext/p7zip/DOCS/MANUAL/commands/add.htm +87 -0
  599. data/ext/p7zip/DOCS/MANUAL/commands/bench.htm +79 -0
  600. data/ext/p7zip/DOCS/MANUAL/commands/delete.htm +59 -0
  601. data/ext/p7zip/DOCS/MANUAL/commands/extract.htm +91 -0
  602. data/ext/p7zip/DOCS/MANUAL/commands/extract_full.htm +68 -0
  603. data/ext/p7zip/DOCS/MANUAL/commands/index.htm +33 -0
  604. data/ext/p7zip/DOCS/MANUAL/commands/list.htm +77 -0
  605. data/ext/p7zip/DOCS/MANUAL/commands/style.css +232 -0
  606. data/ext/p7zip/DOCS/MANUAL/commands/test.htm +46 -0
  607. data/ext/p7zip/DOCS/MANUAL/commands/update.htm +66 -0
  608. data/ext/p7zip/DOCS/MANUAL/exit_codes.htm +27 -0
  609. data/ext/p7zip/DOCS/MANUAL/index.htm +29 -0
  610. data/ext/p7zip/DOCS/MANUAL/style.css +232 -0
  611. data/ext/p7zip/DOCS/MANUAL/switches/ar_exclude.htm +56 -0
  612. data/ext/p7zip/DOCS/MANUAL/switches/ar_include.htm +83 -0
  613. data/ext/p7zip/DOCS/MANUAL/switches/ar_no.htm +52 -0
  614. data/ext/p7zip/DOCS/MANUAL/switches/charset.htm +49 -0
  615. data/ext/p7zip/DOCS/MANUAL/switches/exclude.htm +60 -0
  616. data/ext/p7zip/DOCS/MANUAL/switches/include.htm +87 -0
  617. data/ext/p7zip/DOCS/MANUAL/switches/index.htm +64 -0
  618. data/ext/p7zip/DOCS/MANUAL/switches/large_pages.htm +50 -0
  619. data/ext/p7zip/DOCS/MANUAL/switches/list_tech.htm +36 -0
  620. data/ext/p7zip/DOCS/MANUAL/switches/method.htm +625 -0
  621. data/ext/p7zip/DOCS/MANUAL/switches/output_dir.htm +53 -0
  622. data/ext/p7zip/DOCS/MANUAL/switches/overwrite.htm +56 -0
  623. data/ext/p7zip/DOCS/MANUAL/switches/password.htm +54 -0
  624. data/ext/p7zip/DOCS/MANUAL/switches/recurse.htm +83 -0
  625. data/ext/p7zip/DOCS/MANUAL/switches/sfx.htm +156 -0
  626. data/ext/p7zip/DOCS/MANUAL/switches/ssc.htm +50 -0
  627. data/ext/p7zip/DOCS/MANUAL/switches/stdin.htm +55 -0
  628. data/ext/p7zip/DOCS/MANUAL/switches/stdout.htm +50 -0
  629. data/ext/p7zip/DOCS/MANUAL/switches/stop_switch.htm +31 -0
  630. data/ext/p7zip/DOCS/MANUAL/switches/style.css +232 -0
  631. data/ext/p7zip/DOCS/MANUAL/switches/type.htm +83 -0
  632. data/ext/p7zip/DOCS/MANUAL/switches/update.htm +176 -0
  633. data/ext/p7zip/DOCS/MANUAL/switches/volume.htm +49 -0
  634. data/ext/p7zip/DOCS/MANUAL/switches/working_dir.htm +55 -0
  635. data/ext/p7zip/DOCS/MANUAL/switches/yes.htm +48 -0
  636. data/ext/p7zip/DOCS/MANUAL/syntax.htm +120 -0
  637. data/ext/p7zip/DOCS/Methods.txt +152 -0
  638. data/ext/p7zip/DOCS/copying.txt +504 -0
  639. data/ext/p7zip/DOCS/history.txt +456 -0
  640. data/ext/p7zip/DOCS/lzma.txt +598 -0
  641. data/ext/p7zip/DOCS/readme.txt +181 -0
  642. data/ext/p7zip/DOCS/unRarLicense.txt +41 -0
  643. data/ext/p7zip/README +358 -0
  644. data/ext/p7zip/TODO +39 -0
  645. data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/ChangeLog +41 -0
  646. data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme +21 -0
  647. data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme.u7z +30 -0
  648. data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/u7z +133 -0
  649. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/README +21 -0
  650. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/check.sh +117 -0
  651. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/files.tar +0 -0
  652. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1 +33 -0
  653. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/p7zip +144 -0
  654. data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-shared +14 -0
  655. data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-static +10 -0
  656. data/ext/p7zip/install.sh +206 -0
  657. data/ext/p7zip/install_local_context_menu.sh +18 -0
  658. data/ext/p7zip/integration_context_menu.txt +51 -0
  659. data/ext/p7zip/makefile +181 -0
  660. data/ext/p7zip/makefile.aix_gcc +22 -0
  661. data/ext/p7zip/makefile.beos +18 -0
  662. data/ext/p7zip/makefile.crc32 +8 -0
  663. data/ext/p7zip/makefile.cygwin +20 -0
  664. data/ext/p7zip/makefile.cygwin_asm +21 -0
  665. data/ext/p7zip/makefile.djgpp_old +21 -0
  666. data/ext/p7zip/makefile.djgpp_watt +47 -0
  667. data/ext/p7zip/makefile.freebsd5 +20 -0
  668. data/ext/p7zip/makefile.freebsd6 +20 -0
  669. data/ext/p7zip/makefile.glb +39 -0
  670. data/ext/p7zip/makefile.gprof +18 -0
  671. data/ext/p7zip/makefile.hpux-acc +17 -0
  672. data/ext/p7zip/makefile.hpux-acc_64 +19 -0
  673. data/ext/p7zip/makefile.hpux-gcc +21 -0
  674. data/ext/p7zip/makefile.linux_amd64 +22 -0
  675. data/ext/p7zip/makefile.linux_amd64_asm +24 -0
  676. data/ext/p7zip/makefile.linux_amd64_asm_icc +27 -0
  677. data/ext/p7zip/makefile.linux_any_cpu +22 -0
  678. data/ext/p7zip/makefile.linux_any_cpu_gcc_4.X +24 -0
  679. data/ext/p7zip/makefile.linux_clang_amd64 +22 -0
  680. data/ext/p7zip/makefile.linux_cross_arm +22 -0
  681. data/ext/p7zip/makefile.linux_gcc_2.95_no_need_for_libstdc +20 -0
  682. data/ext/p7zip/makefile.linux_other +23 -0
  683. data/ext/p7zip/makefile.linux_s390x +23 -0
  684. data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X +26 -0
  685. data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X_fltk +26 -0
  686. data/ext/p7zip/makefile.linux_x86_asm_gcc_mudflap_4.X +26 -0
  687. data/ext/p7zip/makefile.linux_x86_asm_icc +25 -0
  688. data/ext/p7zip/makefile.linux_x86_icc +24 -0
  689. data/ext/p7zip/makefile.machine_base +22 -0
  690. data/ext/p7zip/makefile.macosx_32bits +20 -0
  691. data/ext/p7zip/makefile.macosx_32bits_asm +23 -0
  692. data/ext/p7zip/makefile.macosx_32bits_ppc +21 -0
  693. data/ext/p7zip/makefile.macosx_64bits +20 -0
  694. data/ext/p7zip/makefile.macosx_llvm_64bits +20 -0
  695. data/ext/p7zip/makefile.netbsd +21 -0
  696. data/ext/p7zip/makefile.netware_asm_gcc_3.X +41 -0
  697. data/ext/p7zip/makefile.oldmake +174 -0
  698. data/ext/p7zip/makefile.openbsd +20 -0
  699. data/ext/p7zip/makefile.openbsd_no_port +20 -0
  700. data/ext/p7zip/makefile.qnx_shared.bin +21 -0
  701. data/ext/p7zip/makefile.qnx_static +21 -0
  702. data/ext/p7zip/makefile.rules +661 -0
  703. data/ext/p7zip/makefile.solaris_sparc_CC_32 +21 -0
  704. data/ext/p7zip/makefile.solaris_sparc_CC_64 +23 -0
  705. data/ext/p7zip/makefile.solaris_sparc_gcc +21 -0
  706. data/ext/p7zip/makefile.solaris_x86 +19 -0
  707. data/ext/p7zip/makefile.tru64 +22 -0
  708. data/ext/seven_zip_ruby/extconf.rb +194 -0
  709. data/ext/seven_zip_ruby/guid_defs.h +29 -0
  710. data/ext/seven_zip_ruby/mutex.h +10 -0
  711. data/ext/seven_zip_ruby/posix/mutex.h +94 -0
  712. data/ext/seven_zip_ruby/seven_zip_archive.cpp +1854 -0
  713. data/ext/seven_zip_ruby/seven_zip_archive.h +548 -0
  714. data/ext/seven_zip_ruby/util_common.cpp +28 -0
  715. data/ext/seven_zip_ruby/util_common.h +467 -0
  716. data/ext/seven_zip_ruby/utils.cpp +575 -0
  717. data/ext/seven_zip_ruby/utils.h +25 -0
  718. data/ext/seven_zip_ruby/win32/mutex.h +130 -0
  719. data/lib/seven_zip_ruby.rb +27 -0
  720. data/lib/seven_zip_ruby/7z.dll +0 -0
  721. data/lib/seven_zip_ruby/7z.sfx +0 -0
  722. data/lib/seven_zip_ruby/7z64.dll +0 -0
  723. data/lib/seven_zip_ruby/7zCon.sfx +0 -0
  724. data/lib/seven_zip_ruby/archive_info.rb +21 -0
  725. data/lib/seven_zip_ruby/entry_info.rb +46 -0
  726. data/lib/seven_zip_ruby/exception.rb +10 -0
  727. data/lib/seven_zip_ruby/seven_zip_reader.rb +537 -0
  728. data/lib/seven_zip_ruby/seven_zip_writer.rb +502 -0
  729. data/lib/seven_zip_ruby/update_info.rb +116 -0
  730. data/lib/seven_zip_ruby/version.rb +3 -0
  731. data/seven_zip_ruby.gemspec +34 -0
  732. data/spec/seven_zip_ruby_spec.rb +702 -0
  733. data/spec/seven_zip_ruby_spec_helper.rb +129 -0
  734. metadata +823 -0
@@ -0,0 +1,29 @@
1
+ // ChmHandler.h
2
+
3
+ #ifndef __ARCHIVE_CHM_HANDLER_H
4
+ #define __ARCHIVE_CHM_HANDLER_H
5
+
6
+ #include "Common/MyCom.h"
7
+ #include "../IArchive.h"
8
+ #include "ChmIn.h"
9
+
10
+ namespace NArchive {
11
+ namespace NChm {
12
+
13
+ class CHandler:
14
+ public IInArchive,
15
+ public CMyUnknownImp
16
+ {
17
+ public:
18
+ MY_UNKNOWN_IMP1(IInArchive)
19
+
20
+ INTERFACE_IInArchive(;)
21
+
22
+ private:
23
+ CFilesDatabase m_Database;
24
+ CMyComPtr<IInStream> m_Stream;
25
+ };
26
+
27
+ }}
28
+
29
+ #endif
@@ -0,0 +1,24 @@
1
+ // Archive/Chm/Header.h
2
+
3
+ #include "StdAfx.h"
4
+
5
+ #include "ChmHeader.h"
6
+
7
+ namespace NArchive{
8
+ namespace NChm{
9
+ namespace NHeader{
10
+
11
+ UInt32 kItsfSignature = 0x46535449 + 1;
12
+ UInt32 kItolSignature = 0x4C4F5449 + 1;
13
+ static class CSignatureInitializer
14
+ {
15
+ public:
16
+ CSignatureInitializer()
17
+ {
18
+ kItsfSignature--;
19
+ kItolSignature--;
20
+ }
21
+ }g_SignatureInitializer;
22
+
23
+
24
+ }}}
@@ -0,0 +1,28 @@
1
+ // Archive/Chm/Header.h
2
+
3
+ #ifndef __ARCHIVE_CHM_HEADER_H
4
+ #define __ARCHIVE_CHM_HEADER_H
5
+
6
+ #include "Common/Types.h"
7
+
8
+ namespace NArchive {
9
+ namespace NChm {
10
+ namespace NHeader{
11
+
12
+ const UInt32 kItspSignature = 0x50535449;
13
+ const UInt32 kPmglSignature = 0x4C474D50;
14
+ const UInt32 kLzxcSignature = 0x43585A4C;
15
+
16
+ const UInt32 kIfcmSignature = 0x4D434649;
17
+ const UInt32 kAollSignature = 0x4C4C4F41;
18
+ const UInt32 kCaolSignature = 0x4C4F4143;
19
+
20
+ extern UInt32 kItsfSignature;
21
+
22
+ extern UInt32 kItolSignature;
23
+ const UInt32 kItlsSignature = 0x534C5449;
24
+ UInt64 inline GetHxsSignature() { return ((UInt64)kItlsSignature << 32) | kItolSignature; }
25
+
26
+ }}}
27
+
28
+ #endif
@@ -0,0 +1,937 @@
1
+ // Archive/ChmIn.cpp
2
+
3
+ #include "StdAfx.h"
4
+
5
+ #include "Common/IntToString.h"
6
+ #include "Common/UTFConvert.h"
7
+
8
+ #include "../../Common/LimitedStreams.h"
9
+
10
+ #include "ChmIn.h"
11
+
12
+ namespace NArchive {
13
+ namespace NChm {
14
+
15
+ // define CHM_LOW, if you want to see low level items
16
+ // #define CHM_LOW
17
+
18
+ static const GUID kChmLzxGuid = { 0x7FC28940, 0x9D31, 0x11D0, { 0x9B, 0x27, 0x00, 0xA0, 0xC9, 0x1E, 0x9C, 0x7C } };
19
+ static const GUID kHelp2LzxGuid = { 0x0A9007C6, 0x4076, 0x11D3, { 0x87, 0x89, 0x00, 0x00, 0xF8, 0x10, 0x57, 0x54 } };
20
+ static const GUID kDesGuid = { 0x67F6E4A2, 0x60BF, 0x11D3, { 0x85, 0x40, 0x00, 0xC0, 0x4F, 0x58, 0xC3, 0xCF } };
21
+
22
+ static bool AreGuidsEqual(REFGUID g1, REFGUID g2)
23
+ {
24
+ if (g1.Data1 != g2.Data1 ||
25
+ g1.Data2 != g2.Data2 ||
26
+ g1.Data3 != g2.Data3)
27
+ return false;
28
+ for (int i = 0; i < 8; i++)
29
+ if (g1.Data4[i] != g2.Data4[i])
30
+ return false;
31
+ return true;
32
+ }
33
+
34
+ static char GetHex(Byte value)
35
+ {
36
+ return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
37
+ }
38
+
39
+ static void PrintByte(Byte b, AString &s)
40
+ {
41
+ s += GetHex(b >> 4);
42
+ s += GetHex(b & 0xF);
43
+ }
44
+
45
+ static void PrintUInt16(UInt16 v, AString &s)
46
+ {
47
+ PrintByte((Byte)(v >> 8), s);
48
+ PrintByte((Byte)v, s);
49
+ }
50
+
51
+ static void PrintUInt32(UInt32 v, AString &s)
52
+ {
53
+ PrintUInt16((UInt16)(v >> 16), s);
54
+ PrintUInt16((UInt16)v, s);
55
+ }
56
+
57
+ AString CMethodInfo::GetGuidString() const
58
+ {
59
+ AString s;
60
+ s += '{';
61
+ PrintUInt32(Guid.Data1, s);
62
+ s += '-';
63
+ PrintUInt16(Guid.Data2, s);
64
+ s += '-';
65
+ PrintUInt16(Guid.Data3, s);
66
+ s += '-';
67
+ PrintByte(Guid.Data4[0], s);
68
+ PrintByte(Guid.Data4[1], s);
69
+ s += '-';
70
+ for (int i = 2; i < 8; i++)
71
+ PrintByte(Guid.Data4[i], s);
72
+ s += '}';
73
+ return s;
74
+ }
75
+
76
+ bool CMethodInfo::IsLzx() const
77
+ {
78
+ if (AreGuidsEqual(Guid, kChmLzxGuid))
79
+ return true;
80
+ return AreGuidsEqual(Guid, kHelp2LzxGuid);
81
+ }
82
+
83
+ bool CMethodInfo::IsDes() const
84
+ {
85
+ return AreGuidsEqual(Guid, kDesGuid);
86
+ }
87
+
88
+ UString CMethodInfo::GetName() const
89
+ {
90
+ UString s;
91
+ if (IsLzx())
92
+ {
93
+ s = L"LZX:";
94
+ wchar_t temp[16];
95
+ ConvertUInt32ToString(LzxInfo.GetNumDictBits(), temp);
96
+ s += temp;
97
+ }
98
+ else
99
+ {
100
+ AString s2;
101
+ if (IsDes())
102
+ s2 = "DES";
103
+ else
104
+ {
105
+ s2 = GetGuidString();
106
+ if (ControlData.GetCapacity() > 0)
107
+ {
108
+ s2 += ':';
109
+ for (size_t i = 0; i < ControlData.GetCapacity(); i++)
110
+ PrintByte(ControlData[i], s2);
111
+ }
112
+ }
113
+ ConvertUTF8ToUnicode(s2, s);
114
+ }
115
+ return s;
116
+ }
117
+
118
+ bool CSectionInfo::IsLzx() const
119
+ {
120
+ if (Methods.Size() != 1)
121
+ return false;
122
+ return Methods[0].IsLzx();
123
+ }
124
+
125
+ UString CSectionInfo::GetMethodName() const
126
+ {
127
+ UString s;
128
+ if (!IsLzx())
129
+ {
130
+ UString temp;
131
+ if (ConvertUTF8ToUnicode(Name, temp))
132
+ s += temp;
133
+ s += L": ";
134
+ }
135
+ for (int i = 0; i < Methods.Size(); i++)
136
+ {
137
+ if (i != 0)
138
+ s += L' ';
139
+ s += Methods[i].GetName();
140
+ }
141
+ return s;
142
+ }
143
+
144
+ Byte CInArchive::ReadByte()
145
+ {
146
+ Byte b;
147
+ if (!_inBuffer.ReadByte(b))
148
+ throw 1;
149
+ return b;
150
+ }
151
+
152
+ void CInArchive::Skip(size_t size)
153
+ {
154
+ while (size-- != 0)
155
+ ReadByte();
156
+ }
157
+
158
+ void CInArchive::ReadBytes(Byte *data, UInt32 size)
159
+ {
160
+ for (UInt32 i = 0; i < size; i++)
161
+ data[i] = ReadByte();
162
+ }
163
+
164
+ UInt16 CInArchive::ReadUInt16()
165
+ {
166
+ UInt16 value = 0;
167
+ for (int i = 0; i < 2; i++)
168
+ value |= ((UInt16)(ReadByte()) << (8 * i));
169
+ return value;
170
+ }
171
+
172
+ UInt32 CInArchive::ReadUInt32()
173
+ {
174
+ UInt32 value = 0;
175
+ for (int i = 0; i < 4; i++)
176
+ value |= ((UInt32)(ReadByte()) << (8 * i));
177
+ return value;
178
+ }
179
+
180
+ UInt64 CInArchive::ReadUInt64()
181
+ {
182
+ UInt64 value = 0;
183
+ for (int i = 0; i < 8; i++)
184
+ value |= ((UInt64)(ReadByte()) << (8 * i));
185
+ return value;
186
+ }
187
+
188
+ UInt64 CInArchive::ReadEncInt()
189
+ {
190
+ UInt64 val = 0;;
191
+ for (int i = 0; i < 10; i++)
192
+ {
193
+ Byte b = ReadByte();
194
+ val |= (b & 0x7F);
195
+ if (b < 0x80)
196
+ return val;
197
+ val <<= 7;
198
+ }
199
+ throw 1;
200
+ }
201
+
202
+ void CInArchive::ReadGUID(GUID &g)
203
+ {
204
+ g.Data1 = ReadUInt32();
205
+ g.Data2 = ReadUInt16();
206
+ g.Data3 = ReadUInt16();
207
+ ReadBytes(g.Data4, 8);
208
+ }
209
+
210
+ void CInArchive::ReadString(int size, AString &s)
211
+ {
212
+ s.Empty();
213
+ while(size-- != 0)
214
+ {
215
+ char c = (char)ReadByte();
216
+ if (c == 0)
217
+ {
218
+ Skip(size);
219
+ return;
220
+ }
221
+ s += c;
222
+ }
223
+ }
224
+
225
+ void CInArchive::ReadUString(int size, UString &s)
226
+ {
227
+ s.Empty();
228
+ while(size-- != 0)
229
+ {
230
+ wchar_t c = ReadUInt16();
231
+ if (c == 0)
232
+ {
233
+ Skip(2 * size);
234
+ return;
235
+ }
236
+ s += c;
237
+ }
238
+ }
239
+
240
+ HRESULT CInArchive::ReadChunk(IInStream *inStream, UInt64 pos, UInt64 size)
241
+ {
242
+ RINOK(inStream->Seek(pos, STREAM_SEEK_SET, NULL));
243
+ CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
244
+ CMyComPtr<ISequentialInStream> limitedStream(streamSpec);
245
+ streamSpec->SetStream(inStream);
246
+ streamSpec->Init(size);
247
+ _inBuffer.SetStream(limitedStream);
248
+ _inBuffer.Init();
249
+ return S_OK;
250
+ }
251
+
252
+ HRESULT CInArchive::ReadDirEntry(CDatabase &database)
253
+ {
254
+ CItem item;
255
+ UInt64 nameLength = ReadEncInt();
256
+ if (nameLength == 0 || nameLength >= 0x10000000)
257
+ return S_FALSE;
258
+ ReadString((int)nameLength, item.Name);
259
+ item.Section = ReadEncInt();
260
+ item.Offset = ReadEncInt();
261
+ item.Size = ReadEncInt();
262
+ database.Items.Add(item);
263
+ return S_OK;
264
+ }
265
+
266
+ HRESULT CInArchive::OpenChm(IInStream *inStream, CDatabase &database)
267
+ {
268
+ UInt32 headerSize = ReadUInt32();
269
+ if (headerSize != 0x60)
270
+ return S_FALSE;
271
+ UInt32 unknown1 = ReadUInt32();
272
+ if (unknown1 != 0 && unknown1 != 1) // it's 0 in one .sll file
273
+ return S_FALSE;
274
+ /* UInt32 timeStamp = */ ReadUInt32();
275
+ // Considered as a big-endian DWORD, it appears to contain seconds (MSB) and
276
+ // fractional seconds (second byte).
277
+ // The third and fourth bytes may contain even more fractional bits.
278
+ // The 4 least significant bits in the last byte are constant.
279
+ /* UInt32 lang = */ ReadUInt32();
280
+ GUID g;
281
+ ReadGUID(g); // {7C01FD10-7BAA-11D0-9E0C-00A0-C922-E6EC}
282
+ ReadGUID(g); // {7C01FD11-7BAA-11D0-9E0C-00A0-C922-E6EC}
283
+ const int kNumSections = 2;
284
+ UInt64 sectionOffsets[kNumSections];
285
+ UInt64 sectionSizes[kNumSections];
286
+ int i;
287
+ for (i = 0; i < kNumSections; i++)
288
+ {
289
+ sectionOffsets[i] = ReadUInt64();
290
+ sectionSizes[i] = ReadUInt64();
291
+ }
292
+ // if (chmVersion == 3)
293
+ database.ContentOffset = ReadUInt64();
294
+ /*
295
+ else
296
+ database.ContentOffset = _startPosition + 0x58
297
+ */
298
+
299
+ /*
300
+ // Section 0
301
+ ReadChunk(inStream, sectionOffsets[0], sectionSizes[0]);
302
+ if (sectionSizes[0] != 0x18)
303
+ return S_FALSE;
304
+ ReadUInt32(); // unknown: 01FE
305
+ ReadUInt32(); // unknown: 0
306
+ UInt64 fileSize = ReadUInt64();
307
+ ReadUInt32(); // unknown: 0
308
+ ReadUInt32(); // unknown: 0
309
+ */
310
+
311
+ // Section 1: The Directory Listing
312
+ ReadChunk(inStream, sectionOffsets[1], sectionSizes[1]);
313
+ if (ReadUInt32() != NHeader::kItspSignature)
314
+ return S_FALSE;
315
+ if (ReadUInt32() != 1) // version
316
+ return S_FALSE;
317
+ /* UInt32 dirHeaderSize = */ ReadUInt32();
318
+ ReadUInt32(); // 0x0A (unknown)
319
+ UInt32 dirChunkSize = ReadUInt32(); // $1000
320
+ if (dirChunkSize < 32)
321
+ return S_FALSE;
322
+ /* UInt32 density = */ ReadUInt32(); // "Density" of quickref section, usually 2.
323
+ /* UInt32 depth = */ ReadUInt32(); // Depth of the index tree: 1 there is no index,
324
+ // 2 if there is one level of PMGI chunks.
325
+
326
+ /* UInt32 chunkNumber = */ ReadUInt32(); // Chunk number of root index chunk, -1 if there is none
327
+ // (though at least one file has 0 despite there being no
328
+ // index chunk, probably a bug.)
329
+ /* UInt32 firstPmglChunkNumber = */ ReadUInt32(); // Chunk number of first PMGL (listing) chunk
330
+ /* UInt32 lastPmglChunkNumber = */ ReadUInt32(); // Chunk number of last PMGL (listing) chunk
331
+ ReadUInt32(); // -1 (unknown)
332
+ UInt32 numDirChunks = ReadUInt32(); // Number of directory chunks (total)
333
+ /* UInt32 windowsLangId = */ ReadUInt32();
334
+ ReadGUID(g); // {5D02926A-212E-11D0-9DF9-00A0C922E6EC}
335
+ ReadUInt32(); // 0x54 (This is the length again)
336
+ ReadUInt32(); // -1 (unknown)
337
+ ReadUInt32(); // -1 (unknown)
338
+ ReadUInt32(); // -1 (unknown)
339
+
340
+ for (UInt32 ci = 0; ci < numDirChunks; ci++)
341
+ {
342
+ UInt64 chunkPos = _inBuffer.GetProcessedSize();
343
+ if (ReadUInt32() == NHeader::kPmglSignature)
344
+ {
345
+ // The quickref area is written backwards from the end of the chunk.
346
+ // One quickref entry exists for every n entries in the file, where n
347
+ // is calculated as 1 + (1 << quickref density). So for density = 2, n = 5.
348
+
349
+ UInt32 quickrefLength = ReadUInt32(); // Length of free space and/or quickref area at end of directory chunk
350
+ if (quickrefLength > dirChunkSize || quickrefLength < 2)
351
+ return S_FALSE;
352
+ ReadUInt32(); // Always 0
353
+ ReadUInt32(); // Chunk number of previous listing chunk when reading
354
+ // directory in sequence (-1 if this is the first listing chunk)
355
+ ReadUInt32(); // Chunk number of next listing chunk when reading
356
+ // directory in sequence (-1 if this is the last listing chunk)
357
+ int numItems = 0;
358
+ for (;;)
359
+ {
360
+ UInt64 offset = _inBuffer.GetProcessedSize() - chunkPos;
361
+ UInt32 offsetLimit = dirChunkSize - quickrefLength;
362
+ if (offset > offsetLimit)
363
+ return S_FALSE;
364
+ if (offset == offsetLimit)
365
+ break;
366
+ RINOK(ReadDirEntry(database));
367
+ numItems++;
368
+ }
369
+ Skip(quickrefLength - 2);
370
+ if (ReadUInt16() != numItems)
371
+ return S_FALSE;
372
+ }
373
+ else
374
+ Skip(dirChunkSize - 4);
375
+ }
376
+ return S_OK;
377
+ }
378
+
379
+ HRESULT CInArchive::OpenHelp2(IInStream *inStream, CDatabase &database)
380
+ {
381
+ if (ReadUInt32() != 1) // version
382
+ return S_FALSE;
383
+ if (ReadUInt32() != 0x28) // Location of header section table
384
+ return S_FALSE;
385
+ UInt32 numHeaderSections = ReadUInt32();
386
+ const int kNumHeaderSectionsMax = 5;
387
+ if (numHeaderSections != kNumHeaderSectionsMax)
388
+ return S_FALSE;
389
+ ReadUInt32(); // Length of post-header table
390
+ GUID g;
391
+ ReadGUID(g); // {0A9007C1-4076-11D3-8789-0000F8105754}
392
+
393
+ // header section table
394
+ UInt64 sectionOffsets[kNumHeaderSectionsMax];
395
+ UInt64 sectionSizes[kNumHeaderSectionsMax];
396
+ UInt32 i;
397
+ for (i = 0; i < numHeaderSections; i++)
398
+ {
399
+ sectionOffsets[i] = ReadUInt64();
400
+ sectionSizes[i] = ReadUInt64();
401
+ }
402
+
403
+ // Post-Header
404
+ ReadUInt32(); // 2
405
+ ReadUInt32(); // 0x98: offset to CAOL from beginning of post-header)
406
+ // ----- Directory information
407
+ ReadUInt64(); // Chunk number of top-level AOLI chunk in directory, or -1
408
+ ReadUInt64(); // Chunk number of first AOLL chunk in directory
409
+ ReadUInt64(); // Chunk number of last AOLL chunk in directory
410
+ ReadUInt64(); // 0 (unknown)
411
+ ReadUInt32(); // $2000 (Directory chunk size of directory)
412
+ ReadUInt32(); // Quickref density for main directory, usually 2
413
+ ReadUInt32(); // 0 (unknown)
414
+ ReadUInt32(); // Depth of main directory index tree
415
+ // 1 there is no index, 2 if there is one level of AOLI chunks.
416
+ ReadUInt64(); // 0 (unknown)
417
+ UInt64 numDirEntries = ReadUInt64(); // Number of directory entries
418
+ // ----- Directory Index Information
419
+ ReadUInt64(); // -1 (unknown, probably chunk number of top-level AOLI in directory index)
420
+ ReadUInt64(); // Chunk number of first AOLL chunk in directory index
421
+ ReadUInt64(); // Chunk number of last AOLL chunk in directory index
422
+ ReadUInt64(); // 0 (unknown)
423
+ ReadUInt32(); // $200 (Directory chunk size of directory index)
424
+ ReadUInt32(); // Quickref density for directory index, usually 2
425
+ ReadUInt32(); // 0 (unknown)
426
+ ReadUInt32(); // Depth of directory index index tree.
427
+ ReadUInt64(); // Possibly flags -- sometimes 1, sometimes 0.
428
+ ReadUInt64(); // Number of directory index entries (same as number of AOLL
429
+ // chunks in main directory)
430
+
431
+ // (The obvious guess for the following two fields, which recur in a number
432
+ // of places, is they are maximum sizes for the directory and directory index.
433
+ // However, I have seen no direct evidence that this is the case.)
434
+
435
+ ReadUInt32(); // $100000 (Same as field following chunk size in directory)
436
+ ReadUInt32(); // $20000 (Same as field following chunk size in directory index)
437
+
438
+ ReadUInt64(); // 0 (unknown)
439
+ if (ReadUInt32() != NHeader::kCaolSignature)
440
+ return S_FALSE;
441
+ if (ReadUInt32() != 2) // (Most likely a version number)
442
+ return S_FALSE;
443
+ UInt32 caolLength = ReadUInt32(); // $50 (Length of the CAOL section, which includes the ITSF section)
444
+ if (caolLength >= 0x2C)
445
+ {
446
+ /* UInt32 c7 = */ ReadUInt16(); // Unknown. Remains the same when identical files are built.
447
+ // Does not appear to be a checksum. Many files have
448
+ // 'HH' (HTML Help?) here, indicating this may be a compiler ID
449
+ // field. But at least one ITOL/ITLS compiler does not set this
450
+ // field to a constant value.
451
+ ReadUInt16(); // 0 (Unknown. Possibly part of 00A4 field)
452
+ ReadUInt32(); // Unknown. Two values have been seen -- $43ED, and 0.
453
+ ReadUInt32(); // $2000 (Directory chunk size of directory)
454
+ ReadUInt32(); // $200 (Directory chunk size of directory index)
455
+ ReadUInt32(); // $100000 (Same as field following chunk size in directory)
456
+ ReadUInt32(); // $20000 (Same as field following chunk size in directory index)
457
+ ReadUInt32(); // 0 (unknown)
458
+ ReadUInt32(); // 0 (Unknown)
459
+ if (caolLength == 0x2C)
460
+ {
461
+ database.ContentOffset = 0;
462
+ database.NewFormat = true;
463
+ }
464
+ else if (caolLength == 0x50)
465
+ {
466
+ ReadUInt32(); // 0 (Unknown)
467
+ if (ReadUInt32() != NHeader::kItsfSignature)
468
+ return S_FALSE;
469
+ if (ReadUInt32() != 4) // $4 (Version number -- CHM uses 3)
470
+ return S_FALSE;
471
+ if (ReadUInt32() != 0x20) // $20 (length of ITSF)
472
+ return S_FALSE;
473
+ UInt32 unknown = ReadUInt32();
474
+ if (unknown != 0 && unknown != 1) // = 0 for some HxW files, 1 in other cases;
475
+ return S_FALSE;
476
+ database.ContentOffset = _startPosition + ReadUInt64();
477
+ /* UInt32 timeStamp = */ ReadUInt32();
478
+ // A timestamp of some sort.
479
+ // Considered as a big-endian DWORD, it appears to contain
480
+ // seconds (MSB) and fractional seconds (second byte).
481
+ // The third and fourth bytes may contain even more fractional
482
+ // bits. The 4 least significant bits in the last byte are constant.
483
+ /* UInt32 lang = */ ReadUInt32(); // BE?
484
+ }
485
+ else
486
+ return S_FALSE;
487
+ }
488
+
489
+ /*
490
+ // Section 0
491
+ ReadChunk(inStream, _startPosition + sectionOffsets[0], sectionSizes[0]);
492
+ if (sectionSizes[0] != 0x18)
493
+ return S_FALSE;
494
+ ReadUInt32(); // unknown: 01FE
495
+ ReadUInt32(); // unknown: 0
496
+ UInt64 fileSize = ReadUInt64();
497
+ ReadUInt32(); // unknown: 0
498
+ ReadUInt32(); // unknown: 0
499
+ */
500
+
501
+ // Section 1: The Directory Listing
502
+ ReadChunk(inStream, _startPosition + sectionOffsets[1], sectionSizes[1]);
503
+ if (ReadUInt32() != NHeader::kIfcmSignature)
504
+ return S_FALSE;
505
+ if (ReadUInt32() != 1) // (probably a version number)
506
+ return S_FALSE;
507
+ UInt32 dirChunkSize = ReadUInt32(); // $2000
508
+ if (dirChunkSize < 64)
509
+ return S_FALSE;
510
+ ReadUInt32(); // $100000 (unknown)
511
+ ReadUInt32(); // -1 (unknown)
512
+ ReadUInt32(); // -1 (unknown)
513
+ UInt32 numDirChunks = ReadUInt32();
514
+ ReadUInt32(); // 0 (unknown, probably high word of above)
515
+
516
+ for (UInt32 ci = 0; ci < numDirChunks; ci++)
517
+ {
518
+ UInt64 chunkPos = _inBuffer.GetProcessedSize();
519
+ if (ReadUInt32() == NHeader::kAollSignature)
520
+ {
521
+ UInt32 quickrefLength = ReadUInt32(); // Length of quickref area at end of directory chunk
522
+ if (quickrefLength > dirChunkSize || quickrefLength < 2)
523
+ return S_FALSE;
524
+ ReadUInt64(); // Directory chunk number
525
+ // This must match physical position in file, that is
526
+ // the chunk size times the chunk number must be the
527
+ // offset from the end of the directory header.
528
+ ReadUInt64(); // Chunk number of previous listing chunk when reading
529
+ // directory in sequence (-1 if first listing chunk)
530
+ ReadUInt64(); // Chunk number of next listing chunk when reading
531
+ // directory in sequence (-1 if last listing chunk)
532
+ ReadUInt64(); // Number of first listing entry in this chunk
533
+ ReadUInt32(); // 1 (unknown -- other values have also been seen here)
534
+ ReadUInt32(); // 0 (unknown)
535
+
536
+ int numItems = 0;
537
+ for (;;)
538
+ {
539
+ UInt64 offset = _inBuffer.GetProcessedSize() - chunkPos;
540
+ UInt32 offsetLimit = dirChunkSize - quickrefLength;
541
+ if (offset > offsetLimit)
542
+ return S_FALSE;
543
+ if (offset == offsetLimit)
544
+ break;
545
+ if (database.NewFormat)
546
+ {
547
+ UInt16 nameLength = ReadUInt16();
548
+ if (nameLength == 0)
549
+ return S_FALSE;
550
+ UString name;
551
+ ReadUString((int)nameLength, name);
552
+ AString s;
553
+ ConvertUnicodeToUTF8(name, s);
554
+ Byte b = ReadByte();
555
+ s += ' ';
556
+ PrintByte(b, s);
557
+ s += ' ';
558
+ UInt64 len = ReadEncInt();
559
+ // then number of items ?
560
+ // then length ?
561
+ // then some data (binary encoding?)
562
+ while (len-- != 0)
563
+ {
564
+ b = ReadByte();
565
+ PrintByte(b, s);
566
+ }
567
+ database.NewFormatString += s;
568
+ database.NewFormatString += "\r\n";
569
+ }
570
+ else
571
+ {
572
+ RINOK(ReadDirEntry(database));
573
+ }
574
+ numItems++;
575
+ }
576
+ Skip(quickrefLength - 2);
577
+ if (ReadUInt16() != numItems)
578
+ return S_FALSE;
579
+ if (numItems > numDirEntries)
580
+ return S_FALSE;
581
+ numDirEntries -= numItems;
582
+ }
583
+ else
584
+ Skip(dirChunkSize - 4);
585
+ }
586
+ return numDirEntries == 0 ? S_OK : S_FALSE;
587
+ }
588
+
589
+ HRESULT CInArchive::DecompressStream(IInStream *inStream, const CDatabase &database, const AString &name)
590
+ {
591
+ int index = database.FindItem(name);
592
+ if (index < 0)
593
+ return S_FALSE;
594
+ const CItem &item = database.Items[index];
595
+ _chunkSize = item.Size;
596
+ return ReadChunk(inStream, database.ContentOffset + item.Offset, item.Size);
597
+ }
598
+
599
+
600
+ #define DATA_SPACE "::DataSpace/"
601
+ static const char *kNameList = DATA_SPACE "NameList";
602
+ static const char *kStorage = DATA_SPACE "Storage/";
603
+ static const char *kContent = "Content";
604
+ static const char *kControlData = "ControlData";
605
+ static const char *kSpanInfo = "SpanInfo";
606
+ static const char *kTransform = "Transform/";
607
+ static const char *kResetTable = "/InstanceData/ResetTable";
608
+ static const char *kTransformList = "List";
609
+
610
+ static AString GetSectionPrefix(const AString &name)
611
+ {
612
+ return AString(kStorage) + name + AString("/");
613
+ }
614
+
615
+ #define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; }
616
+
617
+ static int CompareFiles(const int *p1, const int *p2, void *param)
618
+ {
619
+ const CObjectVector<CItem> &items = *(const CObjectVector<CItem> *)param;
620
+ const CItem &item1 = items[*p1];
621
+ const CItem &item2 = items[*p2];
622
+ bool isDir1 = item1.IsDir();
623
+ bool isDir2 = item2.IsDir();
624
+ if (isDir1 && !isDir2)
625
+ return -1;
626
+ if (isDir2)
627
+ {
628
+ if (isDir1)
629
+ return MyCompare(*p1, *p2);
630
+ return 1;
631
+ }
632
+ RINOZ(MyCompare(item1.Section, item2.Section));
633
+ RINOZ(MyCompare(item1.Offset, item2.Offset));
634
+ RINOZ(MyCompare(item1.Size, item2.Size));
635
+ return MyCompare(*p1, *p2);
636
+ }
637
+
638
+ void CFilesDatabase::SetIndices()
639
+ {
640
+ for (int i = 0; i < Items.Size(); i++)
641
+ {
642
+ const CItem &item = Items[i];
643
+ if (item.IsUserItem() && item.Name.Length() != 1)
644
+ Indices.Add(i);
645
+ }
646
+ }
647
+
648
+ void CFilesDatabase::Sort()
649
+ {
650
+ Indices.Sort(CompareFiles, (void *)&Items);
651
+ }
652
+
653
+ bool CFilesDatabase::Check()
654
+ {
655
+ UInt64 maxPos = 0;
656
+ UInt64 prevSection = 0;
657
+ for(int i = 0; i < Indices.Size(); i++)
658
+ {
659
+ const CItem &item = Items[Indices[i]];
660
+ if (item.Section == 0 || item.IsDir())
661
+ continue;
662
+ if (item.Section != prevSection)
663
+ {
664
+ prevSection = item.Section;
665
+ maxPos = 0;
666
+ continue;
667
+ }
668
+ if (item.Offset < maxPos)
669
+ return false;
670
+ maxPos = item.Offset + item.Size;
671
+ if (maxPos < item.Offset)
672
+ return false;
673
+ }
674
+ return true;
675
+ }
676
+
677
+ HRESULT CInArchive::OpenHighLevel(IInStream *inStream, CFilesDatabase &database)
678
+ {
679
+ {
680
+ // The NameList file
681
+ RINOK(DecompressStream(inStream, database, kNameList));
682
+ /* UInt16 length = */ ReadUInt16();
683
+ UInt16 numSections = ReadUInt16();
684
+ for (int i = 0; i < numSections; i++)
685
+ {
686
+ CSectionInfo section;
687
+ UInt16 nameLength = ReadUInt16();
688
+ UString name;
689
+ ReadUString(nameLength, name);
690
+ if (ReadUInt16() != 0)
691
+ return S_FALSE;
692
+ if (!ConvertUnicodeToUTF8(name, section.Name))
693
+ return S_FALSE;
694
+ database.Sections.Add(section);
695
+ }
696
+ }
697
+
698
+ int i;
699
+ for (i = 1; i < database.Sections.Size(); i++)
700
+ {
701
+ CSectionInfo &section = database.Sections[i];
702
+ AString sectionPrefix = GetSectionPrefix(section.Name);
703
+ {
704
+ // Content
705
+ int index = database.FindItem(sectionPrefix + kContent);
706
+ if (index < 0)
707
+ return S_FALSE;
708
+ const CItem &item = database.Items[index];
709
+ section.Offset = item.Offset;
710
+ section.CompressedSize = item.Size;
711
+ }
712
+ AString transformPrefix = sectionPrefix + kTransform;
713
+ if (database.Help2Format)
714
+ {
715
+ // Transform List
716
+ RINOK(DecompressStream(inStream, database, transformPrefix + kTransformList));
717
+ if ((_chunkSize & 0xF) != 0)
718
+ return S_FALSE;
719
+ int numGuids = (int)(_chunkSize / 0x10);
720
+ if (numGuids < 1)
721
+ return S_FALSE;
722
+ for (int i = 0; i < numGuids; i++)
723
+ {
724
+ CMethodInfo method;
725
+ ReadGUID(method.Guid);
726
+ section.Methods.Add(method);
727
+ }
728
+ }
729
+ else
730
+ {
731
+ CMethodInfo method;
732
+ method.Guid = kChmLzxGuid;
733
+ section.Methods.Add(method);
734
+ }
735
+
736
+ {
737
+ // Control Data
738
+ RINOK(DecompressStream(inStream, database, sectionPrefix + kControlData));
739
+ for (int mi = 0; mi < section.Methods.Size(); mi++)
740
+ {
741
+ CMethodInfo &method = section.Methods[mi];
742
+ UInt32 numDWORDS = ReadUInt32();
743
+ if (method.IsLzx())
744
+ {
745
+ if (numDWORDS < 5)
746
+ return S_FALSE;
747
+ if (ReadUInt32() != NHeader::kLzxcSignature)
748
+ return S_FALSE;
749
+ CLzxInfo &li = method.LzxInfo;
750
+ li.Version = ReadUInt32();
751
+ if (li.Version != 2 && li.Version != 3)
752
+ return S_FALSE;
753
+ li.ResetInterval = ReadUInt32();
754
+ li.WindowSize = ReadUInt32();
755
+ li.CacheSize = ReadUInt32();
756
+ if (
757
+ li.ResetInterval != 1 &&
758
+ li.ResetInterval != 2 &&
759
+ li.ResetInterval != 4 &&
760
+ li.ResetInterval != 8 &&
761
+ li.ResetInterval != 16 &&
762
+ li.ResetInterval != 32 &&
763
+ li.ResetInterval != 64)
764
+ return S_FALSE;
765
+ if (
766
+ li.WindowSize != 1 &&
767
+ li.WindowSize != 2 &&
768
+ li.WindowSize != 4 &&
769
+ li.WindowSize != 8 &&
770
+ li.WindowSize != 16 &&
771
+ li.WindowSize != 32 &&
772
+ li.WindowSize != 64)
773
+ return S_FALSE;
774
+ numDWORDS -= 5;
775
+ while (numDWORDS-- != 0)
776
+ ReadUInt32();
777
+ }
778
+ else
779
+ {
780
+ UInt32 numBytes = numDWORDS * 4;
781
+ method.ControlData.SetCapacity(numBytes);
782
+ ReadBytes(method.ControlData, numBytes);
783
+ }
784
+ }
785
+ }
786
+
787
+ {
788
+ // SpanInfo
789
+ RINOK(DecompressStream(inStream, database, sectionPrefix + kSpanInfo));
790
+ section.UncompressedSize = ReadUInt64();
791
+ }
792
+
793
+ // read ResetTable for LZX
794
+ for (int mi = 0; mi < section.Methods.Size(); mi++)
795
+ {
796
+ CMethodInfo &method = section.Methods[mi];
797
+ if (method.IsLzx())
798
+ {
799
+ // ResetTable;
800
+ RINOK(DecompressStream(inStream, database, transformPrefix +
801
+ method.GetGuidString() + kResetTable));
802
+ CResetTable &rt = method.LzxInfo.ResetTable;
803
+ if (_chunkSize < 4)
804
+ {
805
+ if (_chunkSize != 0)
806
+ return S_FALSE;
807
+ // ResetTable is empty in .chw files
808
+ if (section.UncompressedSize != 0)
809
+ return S_FALSE;
810
+ rt.UncompressedSize = 0;
811
+ rt.CompressedSize = 0;
812
+ rt.BlockSize = 0;
813
+ }
814
+ else
815
+ {
816
+ UInt32 ver = ReadUInt32(); // 2 unknown (possibly a version number)
817
+ if (ver != 2 && ver != 3)
818
+ return S_FALSE;
819
+ UInt32 numEntries = ReadUInt32();
820
+ if (ReadUInt32() != 8) // Size of table entry (bytes)
821
+ return S_FALSE;
822
+ if (ReadUInt32() != 0x28) // Length of table header
823
+ return S_FALSE;
824
+ rt.UncompressedSize = ReadUInt64();
825
+ rt.CompressedSize = ReadUInt64();
826
+ rt.BlockSize = ReadUInt64(); // 0x8000 block size for locations below
827
+ if (rt.BlockSize != 0x8000)
828
+ return S_FALSE;
829
+ rt.ResetOffsets.Reserve(numEntries);
830
+ for (UInt32 i = 0; i < numEntries; i++)
831
+ rt.ResetOffsets.Add(ReadUInt64());
832
+ }
833
+ }
834
+ }
835
+ }
836
+
837
+ database.SetIndices();
838
+ database.Sort();
839
+ return database.Check() ? S_OK : S_FALSE;
840
+ }
841
+
842
+ HRESULT CInArchive::Open2(IInStream *inStream,
843
+ const UInt64 *searchHeaderSizeLimit,
844
+ CFilesDatabase &database)
845
+ {
846
+ database.Clear();
847
+
848
+ RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &_startPosition));
849
+
850
+ database.Help2Format = false;
851
+ const UInt32 chmVersion = 3;
852
+ {
853
+ if (!_inBuffer.Create(1 << 14))
854
+ return E_OUTOFMEMORY;
855
+ _inBuffer.SetStream(inStream);
856
+ _inBuffer.Init();
857
+ UInt64 value = 0;
858
+ const int kSignatureSize = 8;
859
+ UInt64 hxsSignature = NHeader::GetHxsSignature();
860
+ UInt64 chmSignature = ((UInt64)chmVersion << 32)| NHeader::kItsfSignature;
861
+ UInt64 limit = 1 << 18;
862
+ if (searchHeaderSizeLimit)
863
+ if (limit > *searchHeaderSizeLimit)
864
+ limit = *searchHeaderSizeLimit;
865
+
866
+ for (;;)
867
+ {
868
+ Byte b;
869
+ if (!_inBuffer.ReadByte(b))
870
+ return S_FALSE;
871
+ value >>= 8;
872
+ value |= ((UInt64)b) << ((kSignatureSize - 1) * 8);
873
+ if (_inBuffer.GetProcessedSize() >= kSignatureSize)
874
+ {
875
+ if (value == chmSignature)
876
+ break;
877
+ if (value == hxsSignature)
878
+ {
879
+ database.Help2Format = true;
880
+ break;
881
+ }
882
+ if (_inBuffer.GetProcessedSize() > limit)
883
+ return S_FALSE;
884
+ }
885
+ }
886
+ _startPosition += _inBuffer.GetProcessedSize() - kSignatureSize;
887
+ }
888
+
889
+ if (database.Help2Format)
890
+ {
891
+ RINOK(OpenHelp2(inStream, database));
892
+ if (database.NewFormat)
893
+ return S_OK;
894
+ }
895
+ else
896
+ {
897
+ RINOK(OpenChm(inStream, database));
898
+ }
899
+
900
+ #ifndef CHM_LOW
901
+ try
902
+ {
903
+ HRESULT res = OpenHighLevel(inStream, database);
904
+ if (res == S_FALSE)
905
+ {
906
+ database.HighLevelClear();
907
+ return S_OK;
908
+ }
909
+ RINOK(res);
910
+ database.LowLevel = false;
911
+ }
912
+ catch(...)
913
+ {
914
+ return S_OK;
915
+ }
916
+ #endif
917
+ return S_OK;
918
+ }
919
+
920
+ HRESULT CInArchive::Open(IInStream *inStream,
921
+ const UInt64 *searchHeaderSizeLimit,
922
+ CFilesDatabase &database)
923
+ {
924
+ try
925
+ {
926
+ HRESULT res = Open2(inStream, searchHeaderSizeLimit, database);
927
+ _inBuffer.ReleaseStream();
928
+ return res;
929
+ }
930
+ catch(...)
931
+ {
932
+ _inBuffer.ReleaseStream();
933
+ throw;
934
+ }
935
+ }
936
+
937
+ }}