seven_zip_ruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +25 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +39 -0
- data/README.md +176 -0
- data/Rakefile +47 -0
- data/ext/C/Types.h +254 -0
- data/ext/CPP/7zip/Archive/IArchive.h +234 -0
- data/ext/CPP/7zip/IDecl.h +15 -0
- data/ext/CPP/7zip/IPassword.h +24 -0
- data/ext/CPP/7zip/IProgress.h +33 -0
- data/ext/CPP/7zip/IStream.h +58 -0
- data/ext/CPP/7zip/PropID.h +76 -0
- data/ext/CPP/Common/MyCom.h +225 -0
- data/ext/CPP/Common/MyGuidDef.h +54 -0
- data/ext/CPP/Common/MyInitGuid.h +22 -0
- data/ext/CPP/Common/MyUnknown.h +13 -0
- data/ext/CPP/Common/MyWindows.h +204 -0
- data/ext/CPP/Common/Types.h +11 -0
- data/ext/CPP/Windows/PropVariant.h +56 -0
- data/ext/CPP/include_windows/basetyps.h +19 -0
- data/ext/CPP/include_windows/tchar.h +89 -0
- data/ext/CPP/include_windows/windows.h +194 -0
- data/ext/p7zip/Asm/x64/7zCrcT8U.asm +103 -0
- data/ext/p7zip/Asm/x86/7zCrcT8U.asm +101 -0
- data/ext/p7zip/C/7zBuf.h +39 -0
- data/ext/p7zip/C/7zBuf2.c +45 -0
- data/ext/p7zip/C/7zCrc.c +76 -0
- data/ext/p7zip/C/7zCrc.h +25 -0
- data/ext/p7zip/C/7zCrcOpt.c +34 -0
- data/ext/p7zip/C/7zCrcT8.c +43 -0
- data/ext/p7zip/C/7zStream.c +169 -0
- data/ext/p7zip/C/7zVersion.h +7 -0
- data/ext/p7zip/C/Aes.c +284 -0
- data/ext/p7zip/C/Aes.h +38 -0
- data/ext/p7zip/C/Alloc.back3 +238 -0
- data/ext/p7zip/C/Alloc.c +280 -0
- data/ext/p7zip/C/Alloc.c.back +243 -0
- data/ext/p7zip/C/Alloc.c.back2 +222 -0
- data/ext/p7zip/C/Alloc.h +27 -0
- data/ext/p7zip/C/Bra.c +133 -0
- data/ext/p7zip/C/Bra.h +68 -0
- data/ext/p7zip/C/Bra86.c +85 -0
- data/ext/p7zip/C/BraIA64.c +67 -0
- data/ext/p7zip/C/BwtSort.c +516 -0
- data/ext/p7zip/C/BwtSort.h +30 -0
- data/ext/p7zip/C/CpuArch.c +168 -0
- data/ext/p7zip/C/CpuArch.h +155 -0
- data/ext/p7zip/C/Delta.c +62 -0
- data/ext/p7zip/C/Delta.h +23 -0
- data/ext/p7zip/C/HuffEnc.c +146 -0
- data/ext/p7zip/C/HuffEnc.h +27 -0
- data/ext/p7zip/C/LzFind.c +761 -0
- data/ext/p7zip/C/LzFind.h +115 -0
- data/ext/p7zip/C/LzFindMt.c +793 -0
- data/ext/p7zip/C/LzFindMt.h +105 -0
- data/ext/p7zip/C/LzHash.h +54 -0
- data/ext/p7zip/C/Lzma2Dec.c +356 -0
- data/ext/p7zip/C/Lzma2Dec.h +84 -0
- data/ext/p7zip/C/Lzma2Enc.c +477 -0
- data/ext/p7zip/C/Lzma2Enc.h +66 -0
- data/ext/p7zip/C/LzmaDec.c +999 -0
- data/ext/p7zip/C/LzmaDec.h +231 -0
- data/ext/p7zip/C/LzmaEnc.c +2268 -0
- data/ext/p7zip/C/LzmaEnc.h +80 -0
- data/ext/p7zip/C/LzmaUtil/Lzma86Dec.c +61 -0
- data/ext/p7zip/C/LzmaUtil/Lzma86Dec.h +51 -0
- data/ext/p7zip/C/LzmaUtil/Lzma86Enc.c +113 -0
- data/ext/p7zip/C/LzmaUtil/Lzma86Enc.h +78 -0
- data/ext/p7zip/C/MtCoder.c +327 -0
- data/ext/p7zip/C/MtCoder.h +98 -0
- data/ext/p7zip/C/Ppmd.h +85 -0
- data/ext/p7zip/C/Ppmd7.c +708 -0
- data/ext/p7zip/C/Ppmd7.h +140 -0
- data/ext/p7zip/C/Ppmd7Dec.c +187 -0
- data/ext/p7zip/C/Ppmd7Enc.c +185 -0
- data/ext/p7zip/C/Ppmd8.c +1120 -0
- data/ext/p7zip/C/Ppmd8.h +133 -0
- data/ext/p7zip/C/Ppmd8Dec.c +155 -0
- data/ext/p7zip/C/Ppmd8Enc.c +161 -0
- data/ext/p7zip/C/RotateDefs.h +20 -0
- data/ext/p7zip/C/Sha256.c +204 -0
- data/ext/p7zip/C/Sha256.h +26 -0
- data/ext/p7zip/C/Sort.c +93 -0
- data/ext/p7zip/C/Sort.h +20 -0
- data/ext/p7zip/C/Threads.c +582 -0
- data/ext/p7zip/C/Threads.h +123 -0
- data/ext/p7zip/C/Types.h +254 -0
- data/ext/p7zip/C/Xz.c +88 -0
- data/ext/p7zip/C/Xz.h +252 -0
- data/ext/p7zip/C/XzCrc64.c +33 -0
- data/ext/p7zip/C/XzCrc64.h +26 -0
- data/ext/p7zip/C/XzDec.c +875 -0
- data/ext/p7zip/C/XzEnc.c +497 -0
- data/ext/p7zip/C/XzEnc.h +25 -0
- data/ext/p7zip/C/XzIn.c +306 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zCompressionMode.cpp +3 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zCompressionMode.h +50 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.cpp +332 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.h +68 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.cpp +444 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.h +55 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zExtract.cpp +270 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.cpp +123 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.h +58 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.cpp +149 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.h +58 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.cpp +482 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.h +119 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHandlerOut.cpp +483 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.cpp +14 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.h +97 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.cpp +1276 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.h +245 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zItem.h +268 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.cpp +866 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.h +152 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zProperties.cpp +164 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zProperties.h +22 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zRegister.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.cpp +24 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.h +35 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.cpp +1216 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.h +88 -0
- data/ext/p7zip/CPP/7zip/Archive/ApmHandler.cpp +356 -0
- data/ext/p7zip/CPP/7zip/Archive/ArchiveExports.cpp +135 -0
- data/ext/p7zip/CPP/7zip/Archive/ArjHandler.cpp +798 -0
- data/ext/p7zip/CPP/7zip/Archive/Bz2Handler.cpp +423 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.cpp +189 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.h +44 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.cpp +929 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.h +28 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.cpp +15 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.h +44 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.cpp +272 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.h +161 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabItem.h +63 -0
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.cpp +721 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.h +29 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.cpp +24 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.h +28 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.cpp +937 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.h +244 -0
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.cpp +239 -0
- data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.h +28 -0
- data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.cpp +389 -0
- data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.h +119 -0
- data/ext/p7zip/CPP/7zip/Archive/Com/ComRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.cpp +121 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.h +174 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.cpp +240 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.h +80 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.cpp +239 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.h +88 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.cpp +15 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.h +37 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.cpp +22 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.h +24 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.cpp +62 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.h +12 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.cpp +623 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.h +87 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +42 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/InStreamWithCRC.h +67 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.cpp +61 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.h +24 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.cpp +190 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.h +84 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.h +36 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.h +36 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.cpp +177 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.h +18 -0
- data/ext/p7zip/CPP/7zip/Archive/CpioHandler.cpp +624 -0
- data/ext/p7zip/CPP/7zip/Archive/CramfsHandler.cpp +644 -0
- data/ext/p7zip/CPP/7zip/Archive/DebHandler.cpp +413 -0
- data/ext/p7zip/CPP/7zip/Archive/DeflateProps.cpp +118 -0
- data/ext/p7zip/CPP/7zip/Archive/DeflateProps.h +35 -0
- data/ext/p7zip/CPP/7zip/Archive/DllExports2.cpp +76 -0
- data/ext/p7zip/CPP/7zip/Archive/DmgHandler.cpp +918 -0
- data/ext/p7zip/CPP/7zip/Archive/ElfHandler.cpp +534 -0
- data/ext/p7zip/CPP/7zip/Archive/FatHandler.cpp +996 -0
- data/ext/p7zip/CPP/7zip/Archive/FlvHandler.cpp +544 -0
- data/ext/p7zip/CPP/7zip/Archive/GzHandler.cpp +698 -0
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.cpp +243 -0
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.h +26 -0
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.cpp +480 -0
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.h +154 -0
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/IArchive.h +234 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.cpp +326 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.h +30 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.cpp +21 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.h +61 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.cpp +453 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.h +315 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoItem.h +141 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/LzhHandler.cpp +775 -0
- data/ext/p7zip/CPP/7zip/Archive/LzmaHandler.cpp +430 -0
- data/ext/p7zip/CPP/7zip/Archive/MachoHandler.cpp +500 -0
- data/ext/p7zip/CPP/7zip/Archive/MbrHandler.cpp +507 -0
- data/ext/p7zip/CPP/7zip/Archive/MslzHandler.cpp +257 -0
- data/ext/p7zip/CPP/7zip/Archive/MubHandler.cpp +266 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.cpp +130 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.h +47 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.cpp +510 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.h +43 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.cpp +1461 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.h +181 -0
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/NtfsHandler.cpp +1764 -0
- data/ext/p7zip/CPP/7zip/Archive/PeHandler.cpp +1752 -0
- data/ext/p7zip/CPP/7zip/Archive/PpmdHandler.cpp +456 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.cpp +869 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.h +66 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.cpp +21 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.h +205 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.cpp +478 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.h +123 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.cpp +55 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.h +79 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp +78 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.h +49 -0
- data/ext/p7zip/CPP/7zip/Archive/RpmHandler.cpp +292 -0
- data/ext/p7zip/CPP/7zip/Archive/SplitHandler.cpp +366 -0
- data/ext/p7zip/CPP/7zip/Archive/SquashfsHandler.cpp +2155 -0
- data/ext/p7zip/CPP/7zip/Archive/SwfHandler.cpp +706 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.cpp +386 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.h +61 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandlerOut.cpp +122 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.cpp +25 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.h +108 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.cpp +207 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.h +17 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarItem.h +72 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.cpp +187 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.h +28 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarRegister.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.cpp +139 -0
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.h +34 -0
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.cpp +451 -0
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.h +37 -0
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.cpp +876 -0
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.h +375 -0
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfRegister.cpp +13 -0
- data/ext/p7zip/CPP/7zip/Archive/VhdHandler.cpp +734 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.cpp +660 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.h +77 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandlerOut.cpp +639 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.cpp +855 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.h +297 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimRegister.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Archive/XarHandler.cpp +588 -0
- data/ext/p7zip/CPP/7zip/Archive/XzHandler.cpp +707 -0
- data/ext/p7zip/CPP/7zip/Archive/ZHandler.cpp +161 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.cpp +379 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.h +56 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipCompressionMode.h +42 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.cpp +822 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.h +101 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp +537 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.cpp +36 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.h +284 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.cpp +893 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.h +125 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.cpp +181 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.h +281 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItemEx.h +34 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.cpp +289 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.h +56 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipRegister.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.cpp +1076 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.h +58 -0
- data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile +328 -0
- data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.depend +4962 -0
- data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.list +265 -0
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zFM.txt +163 -0
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zG.txt +131 -0
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7za.txt +253 -0
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_ALL.txt +32 -0
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_Format7zFree.txt +290 -0
- data/ext/p7zip/CPP/7zip/CMAKE/generate.sh +37 -0
- data/ext/p7zip/CPP/7zip/CMAKE/generate_xcode.sh +32 -0
- data/ext/p7zip/CPP/7zip/Common/CWrappers.cpp +226 -0
- data/ext/p7zip/CPP/7zip/Common/CWrappers.h +109 -0
- data/ext/p7zip/CPP/7zip/Common/CreateCoder.cpp +293 -0
- data/ext/p7zip/CPP/7zip/Common/CreateCoder.h +98 -0
- data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.cpp +55 -0
- data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.h +10 -0
- data/ext/p7zip/CPP/7zip/Common/FileStreams.cpp +273 -0
- data/ext/p7zip/CPP/7zip/Common/FileStreams.h +134 -0
- data/ext/p7zip/CPP/7zip/Common/FilterCoder.cpp +247 -0
- data/ext/p7zip/CPP/7zip/Common/FilterCoder.h +128 -0
- data/ext/p7zip/CPP/7zip/Common/InBuffer.cpp +83 -0
- data/ext/p7zip/CPP/7zip/Common/InBuffer.h +81 -0
- data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.cpp +122 -0
- data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.h +48 -0
- data/ext/p7zip/CPP/7zip/Common/LimitedStreams.cpp +154 -0
- data/ext/p7zip/CPP/7zip/Common/LimitedStreams.h +125 -0
- data/ext/p7zip/CPP/7zip/Common/LockedStream.cpp +23 -0
- data/ext/p7zip/CPP/7zip/Common/LockedStream.h +38 -0
- data/ext/p7zip/CPP/7zip/Common/MemBlocks.cpp +183 -0
- data/ext/p7zip/CPP/7zip/Common/MemBlocks.h +71 -0
- data/ext/p7zip/CPP/7zip/Common/MethodId.cpp +27 -0
- data/ext/p7zip/CPP/7zip/Common/MethodId.h +10 -0
- data/ext/p7zip/CPP/7zip/Common/MethodProps.cpp +99 -0
- data/ext/p7zip/CPP/7zip/Common/MethodProps.h +41 -0
- data/ext/p7zip/CPP/7zip/Common/OffsetStream.cpp +35 -0
- data/ext/p7zip/CPP/7zip/Common/OffsetStream.h +25 -0
- data/ext/p7zip/CPP/7zip/Common/OutBuffer.cpp +116 -0
- data/ext/p7zip/CPP/7zip/Common/OutBuffer.h +64 -0
- data/ext/p7zip/CPP/7zip/Common/OutMemStream.cpp +142 -0
- data/ext/p7zip/CPP/7zip/Common/OutMemStream.h +96 -0
- data/ext/p7zip/CPP/7zip/Common/ProgressMt.cpp +53 -0
- data/ext/p7zip/CPP/7zip/Common/ProgressMt.h +46 -0
- data/ext/p7zip/CPP/7zip/Common/ProgressUtils.cpp +42 -0
- data/ext/p7zip/CPP/7zip/Common/ProgressUtils.h +34 -0
- data/ext/p7zip/CPP/7zip/Common/RegisterArc.h +32 -0
- data/ext/p7zip/CPP/7zip/Common/RegisterCodec.h +33 -0
- data/ext/p7zip/CPP/7zip/Common/StreamBinder.cpp +152 -0
- data/ext/p7zip/CPP/7zip/Common/StreamBinder.h +38 -0
- data/ext/p7zip/CPP/7zip/Common/StreamObjects.cpp +221 -0
- data/ext/p7zip/CPP/7zip/Common/StreamObjects.h +135 -0
- data/ext/p7zip/CPP/7zip/Common/StreamUtils.cpp +56 -0
- data/ext/p7zip/CPP/7zip/Common/StreamUtils.h +13 -0
- data/ext/p7zip/CPP/7zip/Common/VirtThread.cpp +46 -0
- data/ext/p7zip/CPP/7zip/Common/VirtThread.h +23 -0
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.cpp +309 -0
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.h +98 -0
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.cpp +90 -0
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.h +59 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Const.h +54 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Crc.cpp +26 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Crc.h +31 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.cpp +943 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.h +205 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.cpp +895 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.h +245 -0
- data/ext/p7zip/CPP/7zip/Compress/BZip2Register.cpp +20 -0
- data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.cpp +386 -0
- data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.h +115 -0
- data/ext/p7zip/CPP/7zip/Compress/Bcj2Register.cpp +19 -0
- data/ext/p7zip/CPP/7zip/Compress/BcjCoder.cpp +15 -0
- data/ext/p7zip/CPP/7zip/Compress/BcjCoder.h +19 -0
- data/ext/p7zip/CPP/7zip/Compress/BcjRegister.cpp +19 -0
- data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.cpp +24 -0
- data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.h +141 -0
- data/ext/p7zip/CPP/7zip/Compress/BitlEncoder.h +57 -0
- data/ext/p7zip/CPP/7zip/Compress/BitmDecoder.h +66 -0
- data/ext/p7zip/CPP/7zip/Compress/BitmEncoder.h +50 -0
- data/ext/p7zip/CPP/7zip/Compress/BranchCoder.cpp +19 -0
- data/ext/p7zip/CPP/7zip/Compress/BranchCoder.h +44 -0
- data/ext/p7zip/CPP/7zip/Compress/BranchMisc.cpp +37 -0
- data/ext/p7zip/CPP/7zip/Compress/BranchMisc.h +14 -0
- data/ext/p7zip/CPP/7zip/Compress/BranchRegister.cpp +30 -0
- data/ext/p7zip/CPP/7zip/Compress/ByteSwap.cpp +73 -0
- data/ext/p7zip/CPP/7zip/Compress/CodecExports.cpp +160 -0
- data/ext/p7zip/CPP/7zip/Compress/CopyCoder.cpp +67 -0
- data/ext/p7zip/CPP/7zip/Compress/CopyCoder.h +34 -0
- data/ext/p7zip/CPP/7zip/Compress/CopyRegister.cpp +14 -0
- data/ext/p7zip/CPP/7zip/Compress/Deflate64Register.cpp +20 -0
- data/ext/p7zip/CPP/7zip/Compress/DeflateConst.h +134 -0
- data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.cpp +353 -0
- data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.h +157 -0
- data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.cpp +986 -0
- data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.h +211 -0
- data/ext/p7zip/CPP/7zip/Compress/DeflateRegister.cpp +21 -0
- data/ext/p7zip/CPP/7zip/Compress/DeltaFilter.cpp +112 -0
- data/ext/p7zip/CPP/7zip/Compress/DllExports.cpp +39 -0
- data/ext/p7zip/CPP/7zip/Compress/DllExports2.cpp +28 -0
- data/ext/p7zip/CPP/7zip/Compress/HuffmanDecoder.h +89 -0
- data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.cpp +219 -0
- data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.h +57 -0
- data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp +89 -0
- data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.h +34 -0
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp +531 -0
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp +1018 -0
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h +48 -0
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp +311 -0
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h +20 -0
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/makefile +173 -0
- data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.cpp +14 -0
- data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.h +66 -0
- data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.cpp +220 -0
- data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.h +106 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.cpp +189 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.h +73 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.cpp +94 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.h +36 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Register.cpp +20 -0
- data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.cpp +252 -0
- data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.h +84 -0
- data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.cpp +149 -0
- data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.h +36 -0
- data/ext/p7zip/CPP/7zip/Compress/LzmaRegister.cpp +20 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzx.h +61 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.cpp +90 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.h +46 -0
- data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.cpp +387 -0
- data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.h +159 -0
- data/ext/p7zip/CPP/7zip/Compress/Mtf8.h +193 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdDecoder.cpp +167 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdDecoder.h +78 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.cpp +119 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.h +48 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdRegister.cpp +21 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdZip.cpp +223 -0
- data/ext/p7zip/CPP/7zip/Compress/PpmdZip.h +72 -0
- data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.cpp +175 -0
- data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.h +264 -0
- data/ext/p7zip/CPP/7zip/Compress/RangeCoder.h +205 -0
- data/ext/p7zip/CPP/7zip/Compress/RangeCoderBit.h +114 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar/makefile +34 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.depend +158 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.list +64 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.cpp +480 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.h +88 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.cpp +391 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.h +174 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.cpp +897 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.h +267 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.cpp +1091 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.h +179 -0
- data/ext/p7zip/CPP/7zip/Compress/RarCodecsRegister.cpp +26 -0
- data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.cpp +145 -0
- data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.h +38 -0
- data/ext/p7zip/CPP/7zip/Compress/ZDecoder.cpp +159 -0
- data/ext/p7zip/CPP/7zip/Compress/ZDecoder.h +42 -0
- data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.cpp +89 -0
- data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.h +48 -0
- data/ext/p7zip/CPP/7zip/Compress/ZlibEncoder.cpp +61 -0
- data/ext/p7zip/CPP/7zip/Compress/ZlibEncoder.h +48 -0
- data/ext/p7zip/CPP/7zip/Crypto/7zAes.cpp +244 -0
- data/ext/p7zip/CPP/7zip/Crypto/7zAes.h +117 -0
- data/ext/p7zip/CPP/7zip/Crypto/7zAesRegister.cpp +18 -0
- data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.cpp +109 -0
- data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.h +39 -0
- data/ext/p7zip/CPP/7zip/Crypto/MyAes.cpp +48 -0
- data/ext/p7zip/CPP/7zip/Crypto/MyAes.h +38 -0
- data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp +83 -0
- data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.h +21 -0
- data/ext/p7zip/CPP/7zip/Crypto/RandGen.cpp +107 -0
- data/ext/p7zip/CPP/7zip/Crypto/RandGen.h +21 -0
- data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.cpp +133 -0
- data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.h +50 -0
- data/ext/p7zip/CPP/7zip/Crypto/RarAes.cpp +134 -0
- data/ext/p7zip/CPP/7zip/Crypto/RarAes.h +47 -0
- data/ext/p7zip/CPP/7zip/Crypto/Sha1.cpp +229 -0
- data/ext/p7zip/CPP/7zip/Crypto/Sha1.h +68 -0
- data/ext/p7zip/CPP/7zip/Crypto/WzAes.cpp +221 -0
- data/ext/p7zip/CPP/7zip/Crypto/WzAes.h +125 -0
- data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.cpp +88 -0
- data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.h +56 -0
- data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.cpp +164 -0
- data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.h +47 -0
- data/ext/p7zip/CPP/7zip/Guid.txt +170 -0
- data/ext/p7zip/CPP/7zip/ICoder.h +186 -0
- data/ext/p7zip/CPP/7zip/IDecl.h +15 -0
- data/ext/p7zip/CPP/7zip/IPassword.h +24 -0
- data/ext/p7zip/CPP/7zip/IProgress.h +33 -0
- data/ext/p7zip/CPP/7zip/IStream.h +58 -0
- data/ext/p7zip/CPP/7zip/MyVersion.h +11 -0
- data/ext/p7zip/CPP/7zip/PREMAKE/generate.sh +18 -0
- data/ext/p7zip/CPP/7zip/PREMAKE/premake4.lua +263 -0
- data/ext/p7zip/CPP/7zip/PropID.h +76 -0
- data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA.pro +228 -0
- data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA_osx.pro +228 -0
- data/ext/p7zip/CPP/7zip/QMAKE/test_emul/test_emul.pro +26 -0
- data/ext/p7zip/CPP/7zip/TEST/TestUI/TestUI.cpp +560 -0
- data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile +33 -0
- data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.depend +577 -0
- data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.list +16 -0
- data/ext/p7zip/CPP/Common/AutoPtr.h +35 -0
- data/ext/p7zip/CPP/Common/Buffer.h +77 -0
- data/ext/p7zip/CPP/Common/CRC.cpp +7 -0
- data/ext/p7zip/CPP/Common/C_FileIO.cpp +88 -0
- data/ext/p7zip/CPP/Common/C_FileIO.h +47 -0
- data/ext/p7zip/CPP/Common/ComTry.h +18 -0
- data/ext/p7zip/CPP/Common/CommandLineParser.cpp +230 -0
- data/ext/p7zip/CPP/Common/CommandLineParser.h +72 -0
- data/ext/p7zip/CPP/Common/Defs.h +20 -0
- data/ext/p7zip/CPP/Common/DynamicBuffer.h +50 -0
- data/ext/p7zip/CPP/Common/IntToString.cpp +77 -0
- data/ext/p7zip/CPP/Common/IntToString.h +19 -0
- data/ext/p7zip/CPP/Common/Lang.cpp +130 -0
- data/ext/p7zip/CPP/Common/Lang.h +28 -0
- data/ext/p7zip/CPP/Common/ListFileUtils.cpp +75 -0
- data/ext/p7zip/CPP/Common/ListFileUtils.h +11 -0
- data/ext/p7zip/CPP/Common/MyCom.h +225 -0
- data/ext/p7zip/CPP/Common/MyException.h +14 -0
- data/ext/p7zip/CPP/Common/MyGuidDef.h +54 -0
- data/ext/p7zip/CPP/Common/MyInitGuid.h +22 -0
- data/ext/p7zip/CPP/Common/MyMap.cpp +140 -0
- data/ext/p7zip/CPP/Common/MyMap.h +28 -0
- data/ext/p7zip/CPP/Common/MyString.cpp +206 -0
- data/ext/p7zip/CPP/Common/MyString.h +601 -0
- data/ext/p7zip/CPP/Common/MyUnknown.h +13 -0
- data/ext/p7zip/CPP/Common/MyVector.cpp +87 -0
- data/ext/p7zip/CPP/Common/MyVector.h +266 -0
- data/ext/p7zip/CPP/Common/MyWindows.cpp +111 -0
- data/ext/p7zip/CPP/Common/MyWindows.h +218 -0
- data/ext/p7zip/CPP/Common/MyXml.cpp +209 -0
- data/ext/p7zip/CPP/Common/MyXml.h +40 -0
- data/ext/p7zip/CPP/Common/NewHandler.h +16 -0
- data/ext/p7zip/CPP/Common/StdInStream.cpp +100 -0
- data/ext/p7zip/CPP/Common/StdInStream.h +32 -0
- data/ext/p7zip/CPP/Common/StdOutStream.cpp +93 -0
- data/ext/p7zip/CPP/Common/StdOutStream.h +35 -0
- data/ext/p7zip/CPP/Common/StringConvert.cpp +181 -0
- data/ext/p7zip/CPP/Common/StringConvert.h +73 -0
- data/ext/p7zip/CPP/Common/StringToInt.cpp +90 -0
- data/ext/p7zip/CPP/Common/StringToInt.h +18 -0
- data/ext/p7zip/CPP/Common/TextConfig.cpp +138 -0
- data/ext/p7zip/CPP/Common/TextConfig.h +22 -0
- data/ext/p7zip/CPP/Common/Types.h +11 -0
- data/ext/p7zip/CPP/Common/UTFConvert.cpp +145 -0
- data/ext/p7zip/CPP/Common/UTFConvert.h +11 -0
- data/ext/p7zip/CPP/Common/Wildcard.cpp +462 -0
- data/ext/p7zip/CPP/Common/Wildcard.h +80 -0
- data/ext/p7zip/CPP/Windows/COM.cpp +37 -0
- data/ext/p7zip/CPP/Windows/COM.h +69 -0
- data/ext/p7zip/CPP/Windows/Clipboard.cpp +160 -0
- data/ext/p7zip/CPP/Windows/Clipboard.h +28 -0
- data/ext/p7zip/CPP/Windows/CommonDialog.h +19 -0
- data/ext/p7zip/CPP/Windows/Control/ComboBox.h +82 -0
- data/ext/p7zip/CPP/Windows/Control/Controls.cpp +515 -0
- data/ext/p7zip/CPP/Windows/Control/Dialog.cpp +560 -0
- data/ext/p7zip/CPP/Windows/Control/Dialog.h +179 -0
- data/ext/p7zip/CPP/Windows/Control/DialogImpl.h +73 -0
- data/ext/p7zip/CPP/Windows/Control/Edit.h +24 -0
- data/ext/p7zip/CPP/Windows/Control/ListView.h +164 -0
- data/ext/p7zip/CPP/Windows/Control/ProgressBar.h +34 -0
- data/ext/p7zip/CPP/Windows/Control/Static.h +23 -0
- data/ext/p7zip/CPP/Windows/Control/StatusBar.h +56 -0
- data/ext/p7zip/CPP/Windows/Control/Window2.cpp +211 -0
- data/ext/p7zip/CPP/Windows/Control/Window2.h +111 -0
- data/ext/p7zip/CPP/Windows/DLL.cpp +193 -0
- data/ext/p7zip/CPP/Windows/DLL.h +48 -0
- data/ext/p7zip/CPP/Windows/Defs.h +17 -0
- data/ext/p7zip/CPP/Windows/Error.cpp +58 -0
- data/ext/p7zip/CPP/Windows/Error.h +33 -0
- data/ext/p7zip/CPP/Windows/FileDir.cpp +927 -0
- data/ext/p7zip/CPP/Windows/FileDir.h +115 -0
- data/ext/p7zip/CPP/Windows/FileFind.cpp +604 -0
- data/ext/p7zip/CPP/Windows/FileFind.h +126 -0
- data/ext/p7zip/CPP/Windows/FileIO.cpp +475 -0
- data/ext/p7zip/CPP/Windows/FileIO.h +110 -0
- data/ext/p7zip/CPP/Windows/FileName.cpp +50 -0
- data/ext/p7zip/CPP/Windows/FileName.h +27 -0
- data/ext/p7zip/CPP/Windows/Menu.h +4 -0
- data/ext/p7zip/CPP/Windows/NtCheck.h +44 -0
- data/ext/p7zip/CPP/Windows/PropVariant.cpp +243 -0
- data/ext/p7zip/CPP/Windows/PropVariant.h +56 -0
- data/ext/p7zip/CPP/Windows/PropVariantConversions.cpp +142 -0
- data/ext/p7zip/CPP/Windows/PropVariantConversions.h +14 -0
- data/ext/p7zip/CPP/Windows/PropVariantUtils.cpp +78 -0
- data/ext/p7zip/CPP/Windows/PropVariantUtils.h +28 -0
- data/ext/p7zip/CPP/Windows/Registry.cpp +313 -0
- data/ext/p7zip/CPP/Windows/Registry.h +113 -0
- data/ext/p7zip/CPP/Windows/ResourceString.h +22 -0
- data/ext/p7zip/CPP/Windows/Shell.h +21 -0
- data/ext/p7zip/CPP/Windows/Synchronization.cpp +157 -0
- data/ext/p7zip/CPP/Windows/Synchronization.h +187 -0
- data/ext/p7zip/CPP/Windows/Synchronization2.h +218 -0
- data/ext/p7zip/CPP/Windows/System.cpp +166 -0
- data/ext/p7zip/CPP/Windows/System.h +16 -0
- data/ext/p7zip/CPP/Windows/Thread.h +41 -0
- data/ext/p7zip/CPP/Windows/Time.cpp +88 -0
- data/ext/p7zip/CPP/Windows/Time.h +21 -0
- data/ext/p7zip/CPP/Windows/Window.cpp +101 -0
- data/ext/p7zip/CPP/Windows/Window.h +43 -0
- data/ext/p7zip/CPP/include_windows/basetyps.h +19 -0
- data/ext/p7zip/CPP/include_windows/tchar.h +89 -0
- data/ext/p7zip/CPP/include_windows/windows.h +194 -0
- data/ext/p7zip/CPP/myWindows/StdAfx.h +124 -0
- data/ext/p7zip/CPP/myWindows/config.h +67 -0
- data/ext/p7zip/CPP/myWindows/initguid.h +4 -0
- data/ext/p7zip/CPP/myWindows/makefile +21 -0
- data/ext/p7zip/CPP/myWindows/makefile.depend +32 -0
- data/ext/p7zip/CPP/myWindows/makefile.list +28 -0
- data/ext/p7zip/CPP/myWindows/myAddExeFlag.cpp +20 -0
- data/ext/p7zip/CPP/myWindows/myGetTickCount.cpp +8 -0
- data/ext/p7zip/CPP/myWindows/myPrivate.h +17 -0
- data/ext/p7zip/CPP/myWindows/mySplitCommandLine.cpp +82 -0
- data/ext/p7zip/CPP/myWindows/test_emul.cpp +745 -0
- data/ext/p7zip/CPP/myWindows/wine_GetXXXDefaultLangID.cpp +741 -0
- data/ext/p7zip/CPP/myWindows/wine_date_and_time.cpp +434 -0
- data/ext/p7zip/ChangeLog +914 -0
- data/ext/p7zip/DOCS/7zC.txt +194 -0
- data/ext/p7zip/DOCS/7zFormat.txt +469 -0
- data/ext/p7zip/DOCS/License.txt +52 -0
- data/ext/p7zip/DOCS/MANUAL/commands/add.htm +87 -0
- data/ext/p7zip/DOCS/MANUAL/commands/bench.htm +79 -0
- data/ext/p7zip/DOCS/MANUAL/commands/delete.htm +59 -0
- data/ext/p7zip/DOCS/MANUAL/commands/extract.htm +91 -0
- data/ext/p7zip/DOCS/MANUAL/commands/extract_full.htm +68 -0
- data/ext/p7zip/DOCS/MANUAL/commands/index.htm +33 -0
- data/ext/p7zip/DOCS/MANUAL/commands/list.htm +77 -0
- data/ext/p7zip/DOCS/MANUAL/commands/style.css +232 -0
- data/ext/p7zip/DOCS/MANUAL/commands/test.htm +46 -0
- data/ext/p7zip/DOCS/MANUAL/commands/update.htm +66 -0
- data/ext/p7zip/DOCS/MANUAL/exit_codes.htm +27 -0
- data/ext/p7zip/DOCS/MANUAL/index.htm +29 -0
- data/ext/p7zip/DOCS/MANUAL/style.css +232 -0
- data/ext/p7zip/DOCS/MANUAL/switches/ar_exclude.htm +56 -0
- data/ext/p7zip/DOCS/MANUAL/switches/ar_include.htm +83 -0
- data/ext/p7zip/DOCS/MANUAL/switches/ar_no.htm +52 -0
- data/ext/p7zip/DOCS/MANUAL/switches/charset.htm +49 -0
- data/ext/p7zip/DOCS/MANUAL/switches/exclude.htm +60 -0
- data/ext/p7zip/DOCS/MANUAL/switches/include.htm +87 -0
- data/ext/p7zip/DOCS/MANUAL/switches/index.htm +64 -0
- data/ext/p7zip/DOCS/MANUAL/switches/large_pages.htm +50 -0
- data/ext/p7zip/DOCS/MANUAL/switches/list_tech.htm +36 -0
- data/ext/p7zip/DOCS/MANUAL/switches/method.htm +625 -0
- data/ext/p7zip/DOCS/MANUAL/switches/output_dir.htm +53 -0
- data/ext/p7zip/DOCS/MANUAL/switches/overwrite.htm +56 -0
- data/ext/p7zip/DOCS/MANUAL/switches/password.htm +54 -0
- data/ext/p7zip/DOCS/MANUAL/switches/recurse.htm +83 -0
- data/ext/p7zip/DOCS/MANUAL/switches/sfx.htm +156 -0
- data/ext/p7zip/DOCS/MANUAL/switches/ssc.htm +50 -0
- data/ext/p7zip/DOCS/MANUAL/switches/stdin.htm +55 -0
- data/ext/p7zip/DOCS/MANUAL/switches/stdout.htm +50 -0
- data/ext/p7zip/DOCS/MANUAL/switches/stop_switch.htm +31 -0
- data/ext/p7zip/DOCS/MANUAL/switches/style.css +232 -0
- data/ext/p7zip/DOCS/MANUAL/switches/type.htm +83 -0
- data/ext/p7zip/DOCS/MANUAL/switches/update.htm +176 -0
- data/ext/p7zip/DOCS/MANUAL/switches/volume.htm +49 -0
- data/ext/p7zip/DOCS/MANUAL/switches/working_dir.htm +55 -0
- data/ext/p7zip/DOCS/MANUAL/switches/yes.htm +48 -0
- data/ext/p7zip/DOCS/MANUAL/syntax.htm +120 -0
- data/ext/p7zip/DOCS/Methods.txt +152 -0
- data/ext/p7zip/DOCS/copying.txt +504 -0
- data/ext/p7zip/DOCS/history.txt +456 -0
- data/ext/p7zip/DOCS/lzma.txt +598 -0
- data/ext/p7zip/DOCS/readme.txt +181 -0
- data/ext/p7zip/DOCS/unRarLicense.txt +41 -0
- data/ext/p7zip/README +358 -0
- data/ext/p7zip/TODO +39 -0
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/ChangeLog +41 -0
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme +21 -0
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme.u7z +30 -0
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/u7z +133 -0
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/README +21 -0
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/check.sh +117 -0
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/files.tar +0 -0
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1 +33 -0
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/p7zip +144 -0
- data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-shared +14 -0
- data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-static +10 -0
- data/ext/p7zip/install.sh +206 -0
- data/ext/p7zip/install_local_context_menu.sh +18 -0
- data/ext/p7zip/integration_context_menu.txt +51 -0
- data/ext/p7zip/makefile +181 -0
- data/ext/p7zip/makefile.aix_gcc +22 -0
- data/ext/p7zip/makefile.beos +18 -0
- data/ext/p7zip/makefile.crc32 +8 -0
- data/ext/p7zip/makefile.cygwin +20 -0
- data/ext/p7zip/makefile.cygwin_asm +21 -0
- data/ext/p7zip/makefile.djgpp_old +21 -0
- data/ext/p7zip/makefile.djgpp_watt +47 -0
- data/ext/p7zip/makefile.freebsd5 +20 -0
- data/ext/p7zip/makefile.freebsd6 +20 -0
- data/ext/p7zip/makefile.glb +39 -0
- data/ext/p7zip/makefile.gprof +18 -0
- data/ext/p7zip/makefile.hpux-acc +17 -0
- data/ext/p7zip/makefile.hpux-acc_64 +19 -0
- data/ext/p7zip/makefile.hpux-gcc +21 -0
- data/ext/p7zip/makefile.linux_amd64 +22 -0
- data/ext/p7zip/makefile.linux_amd64_asm +24 -0
- data/ext/p7zip/makefile.linux_amd64_asm_icc +27 -0
- data/ext/p7zip/makefile.linux_any_cpu +22 -0
- data/ext/p7zip/makefile.linux_any_cpu_gcc_4.X +24 -0
- data/ext/p7zip/makefile.linux_clang_amd64 +22 -0
- data/ext/p7zip/makefile.linux_cross_arm +22 -0
- data/ext/p7zip/makefile.linux_gcc_2.95_no_need_for_libstdc +20 -0
- data/ext/p7zip/makefile.linux_other +23 -0
- data/ext/p7zip/makefile.linux_s390x +23 -0
- data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X +26 -0
- data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X_fltk +26 -0
- data/ext/p7zip/makefile.linux_x86_asm_gcc_mudflap_4.X +26 -0
- data/ext/p7zip/makefile.linux_x86_asm_icc +25 -0
- data/ext/p7zip/makefile.linux_x86_icc +24 -0
- data/ext/p7zip/makefile.machine_base +22 -0
- data/ext/p7zip/makefile.macosx_32bits +20 -0
- data/ext/p7zip/makefile.macosx_32bits_asm +23 -0
- data/ext/p7zip/makefile.macosx_32bits_ppc +21 -0
- data/ext/p7zip/makefile.macosx_64bits +20 -0
- data/ext/p7zip/makefile.macosx_llvm_64bits +20 -0
- data/ext/p7zip/makefile.netbsd +21 -0
- data/ext/p7zip/makefile.netware_asm_gcc_3.X +41 -0
- data/ext/p7zip/makefile.oldmake +174 -0
- data/ext/p7zip/makefile.openbsd +20 -0
- data/ext/p7zip/makefile.openbsd_no_port +20 -0
- data/ext/p7zip/makefile.qnx_shared.bin +21 -0
- data/ext/p7zip/makefile.qnx_static +21 -0
- data/ext/p7zip/makefile.rules +661 -0
- data/ext/p7zip/makefile.solaris_sparc_CC_32 +21 -0
- data/ext/p7zip/makefile.solaris_sparc_CC_64 +23 -0
- data/ext/p7zip/makefile.solaris_sparc_gcc +21 -0
- data/ext/p7zip/makefile.solaris_x86 +19 -0
- data/ext/p7zip/makefile.tru64 +22 -0
- data/ext/seven_zip_ruby/depend +5 -0
- data/ext/seven_zip_ruby/extconf.rb +131 -0
- data/ext/seven_zip_ruby/guid_defs.h +29 -0
- data/ext/seven_zip_ruby/mutex.h +10 -0
- data/ext/seven_zip_ruby/posix/mutex.h +94 -0
- data/ext/seven_zip_ruby/seven_zip_archive.cpp +1614 -0
- data/ext/seven_zip_ruby/seven_zip_archive.h +515 -0
- data/ext/seven_zip_ruby/util_common.h +444 -0
- data/ext/seven_zip_ruby/utils.cpp +576 -0
- data/ext/seven_zip_ruby/utils.h +25 -0
- data/ext/seven_zip_ruby/win32/mutex.h +130 -0
- data/lib/seven_zip_ruby.rb +16 -0
- data/lib/seven_zip_ruby/7z.dll +0 -0
- data/lib/seven_zip_ruby/7z64.dll +0 -0
- data/lib/seven_zip_ruby/archive_info.rb +21 -0
- data/lib/seven_zip_ruby/entry_info.rb +45 -0
- data/lib/seven_zip_ruby/exception.rb +7 -0
- data/lib/seven_zip_ruby/seven_zip_reader.rb +180 -0
- data/lib/seven_zip_ruby/seven_zip_writer.rb +143 -0
- data/lib/seven_zip_ruby/update_info.rb +116 -0
- data/lib/seven_zip_ruby/version.rb +3 -0
- data/seven_zip_ruby.gemspec +26 -0
- data/spec/seven_zip_ruby_spec.rb +490 -0
- data/spec/seven_zip_ruby_spec_helper.rb +122 -0
- metadata +820 -0
@@ -0,0 +1,996 @@
|
|
1
|
+
// FatHandler.cpp
|
2
|
+
|
3
|
+
#include "StdAfx.h"
|
4
|
+
|
5
|
+
// #include <stdio.h>
|
6
|
+
|
7
|
+
#include "../../../C/CpuArch.h"
|
8
|
+
|
9
|
+
#include "Common/Buffer.h"
|
10
|
+
#include "Common/ComTry.h"
|
11
|
+
#include "Common/IntToString.h"
|
12
|
+
#include "Common/MyCom.h"
|
13
|
+
#include "Common/StringConvert.h"
|
14
|
+
|
15
|
+
#include "Windows/PropVariant.h"
|
16
|
+
#include "Windows/Time.h"
|
17
|
+
|
18
|
+
#include "../Common/LimitedStreams.h"
|
19
|
+
#include "../Common/ProgressUtils.h"
|
20
|
+
#include "../Common/RegisterArc.h"
|
21
|
+
#include "../Common/StreamUtils.h"
|
22
|
+
|
23
|
+
#include "../Compress/CopyCoder.h"
|
24
|
+
|
25
|
+
#include "Common/DummyOutStream.h"
|
26
|
+
|
27
|
+
#define Get16(p) GetUi16(p)
|
28
|
+
#define Get32(p) GetUi32(p)
|
29
|
+
|
30
|
+
#define PRF(x) /* x */
|
31
|
+
|
32
|
+
namespace NArchive {
|
33
|
+
namespace NFat {
|
34
|
+
|
35
|
+
static const UInt32 kFatItemUsedByDirMask = (UInt32)1 << 31;
|
36
|
+
|
37
|
+
struct CHeader
|
38
|
+
{
|
39
|
+
UInt32 NumSectors;
|
40
|
+
UInt16 NumReservedSectors;
|
41
|
+
Byte NumFats;
|
42
|
+
UInt32 NumFatSectors;
|
43
|
+
UInt32 RootDirSector;
|
44
|
+
UInt32 NumRootDirSectors;
|
45
|
+
UInt32 DataSector;
|
46
|
+
|
47
|
+
UInt32 FatSize;
|
48
|
+
UInt32 BadCluster;
|
49
|
+
|
50
|
+
Byte NumFatBits;
|
51
|
+
Byte SectorSizeLog;
|
52
|
+
Byte SectorsPerClusterLog;
|
53
|
+
Byte ClusterSizeLog;
|
54
|
+
|
55
|
+
UInt16 SectorsPerTrack;
|
56
|
+
UInt16 NumHeads;
|
57
|
+
UInt32 NumHiddenSectors;
|
58
|
+
|
59
|
+
bool VolFieldsDefined;
|
60
|
+
|
61
|
+
UInt32 VolId;
|
62
|
+
// Byte VolName[11];
|
63
|
+
// Byte FileSys[8];
|
64
|
+
|
65
|
+
// Byte OemName[5];
|
66
|
+
Byte MediaType;
|
67
|
+
|
68
|
+
// 32-bit FAT
|
69
|
+
UInt16 Flags;
|
70
|
+
UInt16 FsInfoSector;
|
71
|
+
UInt32 RootCluster;
|
72
|
+
|
73
|
+
bool IsFat32() const { return NumFatBits == 32; }
|
74
|
+
UInt64 GetPhySize() const { return (UInt64)NumSectors << SectorSizeLog; }
|
75
|
+
UInt32 SectorSize() const { return (UInt32)1 << SectorSizeLog; }
|
76
|
+
UInt32 ClusterSize() const { return (UInt32)1 << ClusterSizeLog; }
|
77
|
+
UInt32 ClusterToSector(UInt32 c) const { return DataSector + ((c - 2) << SectorsPerClusterLog); }
|
78
|
+
UInt32 IsEoc(UInt32 c) const { return c > BadCluster; }
|
79
|
+
UInt32 IsEocAndUnused(UInt32 c) const { return c > BadCluster && (c & kFatItemUsedByDirMask) == 0; }
|
80
|
+
UInt32 IsValidCluster(UInt32 c) const { return c >= 2 && c < FatSize; }
|
81
|
+
UInt32 SizeToSectors(UInt32 size) const { return (size + SectorSize() - 1) >> SectorSizeLog; }
|
82
|
+
UInt32 CalcFatSizeInSectors() const { return SizeToSectors((FatSize * (NumFatBits / 4) + 1) / 2); }
|
83
|
+
|
84
|
+
UInt32 GetFatSector() const
|
85
|
+
{
|
86
|
+
UInt32 index = (IsFat32() && (Flags & 0x80) != 0) ? (Flags & 0xF) : 0;
|
87
|
+
if (index > NumFats)
|
88
|
+
index = 0;
|
89
|
+
return NumReservedSectors + index * NumFatSectors;
|
90
|
+
}
|
91
|
+
|
92
|
+
UInt64 GetFilePackSize(UInt32 unpackSize) const
|
93
|
+
{
|
94
|
+
UInt64 mask = ClusterSize() - 1;
|
95
|
+
return (unpackSize + mask) & ~mask;
|
96
|
+
}
|
97
|
+
|
98
|
+
UInt32 GetNumClusters(UInt32 size) const
|
99
|
+
{ return (UInt32)(((UInt64)size + ClusterSize() - 1) >> ClusterSizeLog); }
|
100
|
+
|
101
|
+
bool Parse(const Byte *p);
|
102
|
+
};
|
103
|
+
|
104
|
+
static int GetLog(UInt32 num)
|
105
|
+
{
|
106
|
+
for (int i = 0; i < 31; i++)
|
107
|
+
if (((UInt32)1 << i) == num)
|
108
|
+
return i;
|
109
|
+
return -1;
|
110
|
+
}
|
111
|
+
|
112
|
+
bool CHeader::Parse(const Byte *p)
|
113
|
+
{
|
114
|
+
if (p[0x1FE] != 0x55 || p[0x1FF] != 0xAA)
|
115
|
+
return false;
|
116
|
+
|
117
|
+
int codeOffset = 0;
|
118
|
+
switch (p[0])
|
119
|
+
{
|
120
|
+
case 0xE9: codeOffset = 3 + (Int16)Get16(p + 1); break;
|
121
|
+
case 0xEB: if (p[2] != 0x90) return false; codeOffset = 2 + (signed char)p[1]; break;
|
122
|
+
default: return false;
|
123
|
+
}
|
124
|
+
{
|
125
|
+
int s = GetLog(Get16(p + 11));
|
126
|
+
if (s < 9 || s > 12)
|
127
|
+
return false;
|
128
|
+
SectorSizeLog = (Byte)s;
|
129
|
+
s = GetLog(p[13]);
|
130
|
+
if (s < 0)
|
131
|
+
return false;
|
132
|
+
SectorsPerClusterLog = (Byte)s;
|
133
|
+
ClusterSizeLog = SectorSizeLog + SectorsPerClusterLog;
|
134
|
+
}
|
135
|
+
|
136
|
+
NumReservedSectors = Get16(p + 14);
|
137
|
+
if (NumReservedSectors == 0)
|
138
|
+
return false;
|
139
|
+
|
140
|
+
NumFats = p[16];
|
141
|
+
if (NumFats < 1 || NumFats > 4)
|
142
|
+
return false;
|
143
|
+
|
144
|
+
UInt16 numRootDirEntries = Get16(p + 17);
|
145
|
+
if (numRootDirEntries == 0)
|
146
|
+
{
|
147
|
+
if (codeOffset < 90)
|
148
|
+
return false;
|
149
|
+
NumFatBits = 32;
|
150
|
+
NumRootDirSectors = 0;
|
151
|
+
}
|
152
|
+
else
|
153
|
+
{
|
154
|
+
if (codeOffset < 62)
|
155
|
+
return false;
|
156
|
+
NumFatBits = 0;
|
157
|
+
UInt32 mask = (1 << (SectorSizeLog - 5)) - 1;
|
158
|
+
if ((numRootDirEntries & mask) != 0)
|
159
|
+
return false;
|
160
|
+
NumRootDirSectors = (numRootDirEntries + mask) >> (SectorSizeLog - 5);
|
161
|
+
}
|
162
|
+
|
163
|
+
NumSectors = Get16(p + 19);
|
164
|
+
if (NumSectors == 0)
|
165
|
+
NumSectors = Get32(p + 32);
|
166
|
+
else if (IsFat32())
|
167
|
+
return false;
|
168
|
+
|
169
|
+
MediaType = p[21];
|
170
|
+
NumFatSectors = Get16(p + 22);
|
171
|
+
SectorsPerTrack = Get16(p + 24);
|
172
|
+
NumHeads = Get16(p + 26);
|
173
|
+
NumHiddenSectors = Get32(p + 28);
|
174
|
+
|
175
|
+
// memcpy(OemName, p + 3, 5);
|
176
|
+
|
177
|
+
p += 36;
|
178
|
+
if (IsFat32())
|
179
|
+
{
|
180
|
+
if (NumFatSectors != 0)
|
181
|
+
return false;
|
182
|
+
NumFatSectors = Get32(p);
|
183
|
+
if (NumFatSectors >= (1 << 24))
|
184
|
+
return false;
|
185
|
+
|
186
|
+
Flags = Get16(p + 4);
|
187
|
+
if (Get16(p + 6) != 0)
|
188
|
+
return false;
|
189
|
+
RootCluster = Get32(p + 8);
|
190
|
+
FsInfoSector = Get16(p + 12);
|
191
|
+
for (int i = 16; i < 28; i++)
|
192
|
+
if (p[i] != 0)
|
193
|
+
return false;
|
194
|
+
p += 28;
|
195
|
+
}
|
196
|
+
|
197
|
+
// DriveNumber = p[0];
|
198
|
+
VolFieldsDefined = (p[2] == 0x29); // ExtendedBootSig
|
199
|
+
VolId = Get32(p + 3);
|
200
|
+
// memcpy(VolName, p + 7, 11);
|
201
|
+
// memcpy(FileSys, p + 18, 8);
|
202
|
+
|
203
|
+
if (NumFatSectors == 0)
|
204
|
+
return false;
|
205
|
+
RootDirSector = NumReservedSectors + NumFatSectors * NumFats;
|
206
|
+
DataSector = RootDirSector + NumRootDirSectors;
|
207
|
+
if (NumSectors < DataSector)
|
208
|
+
return false;
|
209
|
+
UInt32 numDataSectors = NumSectors - DataSector;
|
210
|
+
UInt32 numClusters = numDataSectors >> SectorsPerClusterLog;
|
211
|
+
|
212
|
+
BadCluster = 0x0FFFFFF7;
|
213
|
+
if (numClusters < 0xFFF5)
|
214
|
+
{
|
215
|
+
if (NumFatBits == 32)
|
216
|
+
return false;
|
217
|
+
NumFatBits = (numClusters < 0xFF5) ? 12: 16;
|
218
|
+
BadCluster &= ((1 << NumFatBits) - 1);
|
219
|
+
}
|
220
|
+
else if (NumFatBits != 32)
|
221
|
+
return false;
|
222
|
+
|
223
|
+
FatSize = numClusters + 2;
|
224
|
+
if (FatSize > BadCluster || CalcFatSizeInSectors() > NumFatSectors)
|
225
|
+
return false;
|
226
|
+
return true;
|
227
|
+
}
|
228
|
+
|
229
|
+
struct CItem
|
230
|
+
{
|
231
|
+
UString UName;
|
232
|
+
char DosName[11];
|
233
|
+
Byte CTime2;
|
234
|
+
UInt32 CTime;
|
235
|
+
UInt32 MTime;
|
236
|
+
UInt16 ADate;
|
237
|
+
Byte Attrib;
|
238
|
+
Byte Flags;
|
239
|
+
UInt32 Size;
|
240
|
+
UInt32 Cluster;
|
241
|
+
Int32 Parent;
|
242
|
+
|
243
|
+
// NT uses Flags to store Low Case status
|
244
|
+
bool NameIsLow() const { return (Flags & 0x8) != 0; }
|
245
|
+
bool ExtIsLow() const { return (Flags & 0x10) != 0; }
|
246
|
+
bool IsDir() const { return (Attrib & 0x10) != 0; }
|
247
|
+
UString GetShortName() const;
|
248
|
+
UString GetName() const;
|
249
|
+
UString GetVolName() const;
|
250
|
+
};
|
251
|
+
|
252
|
+
static int CopyAndTrim(char *dest, const char *src, int size, bool toLower)
|
253
|
+
{
|
254
|
+
int i;
|
255
|
+
memcpy(dest, src, size);
|
256
|
+
if (toLower)
|
257
|
+
for (i = 0; i < size; i++)
|
258
|
+
{
|
259
|
+
char c = dest[i];
|
260
|
+
if (c >= 'A' && c <= 'Z')
|
261
|
+
dest[i] = c + 0x20;
|
262
|
+
}
|
263
|
+
for (i = size - 1; i >= 0 && dest[i] == ' '; i--);
|
264
|
+
return i + 1;
|
265
|
+
}
|
266
|
+
|
267
|
+
static UString FatStringToUnicode(const char *s)
|
268
|
+
{
|
269
|
+
return MultiByteToUnicodeString(s, CP_OEMCP);
|
270
|
+
}
|
271
|
+
|
272
|
+
UString CItem::GetShortName() const
|
273
|
+
{
|
274
|
+
char s[16];
|
275
|
+
int i = CopyAndTrim(s, DosName, 8, NameIsLow());
|
276
|
+
s[i++] = '.';
|
277
|
+
int j = CopyAndTrim(s + i, DosName + 8, 3, ExtIsLow());
|
278
|
+
if (j == 0)
|
279
|
+
j--;
|
280
|
+
s[i + j] = 0;
|
281
|
+
return FatStringToUnicode(s);
|
282
|
+
}
|
283
|
+
|
284
|
+
UString CItem::GetName() const
|
285
|
+
{
|
286
|
+
if (!UName.IsEmpty())
|
287
|
+
return UName;
|
288
|
+
return GetShortName();
|
289
|
+
}
|
290
|
+
|
291
|
+
UString CItem::GetVolName() const
|
292
|
+
{
|
293
|
+
if (!UName.IsEmpty())
|
294
|
+
return UName;
|
295
|
+
char s[12];
|
296
|
+
int i = CopyAndTrim(s, DosName, 11, false);
|
297
|
+
s[i] = 0;
|
298
|
+
return FatStringToUnicode(s);
|
299
|
+
}
|
300
|
+
|
301
|
+
struct CDatabase
|
302
|
+
{
|
303
|
+
CHeader Header;
|
304
|
+
CObjectVector<CItem> Items;
|
305
|
+
UInt32 *Fat;
|
306
|
+
CMyComPtr<IInStream> InStream;
|
307
|
+
IArchiveOpenCallback *OpenCallback;
|
308
|
+
|
309
|
+
UInt32 NumFreeClusters;
|
310
|
+
bool VolItemDefined;
|
311
|
+
CItem VolItem;
|
312
|
+
UInt32 NumDirClusters;
|
313
|
+
CByteBuffer ByteBuf;
|
314
|
+
UInt64 NumCurUsedBytes;
|
315
|
+
|
316
|
+
CDatabase(): Fat(0) {}
|
317
|
+
~CDatabase() { ClearAndClose(); }
|
318
|
+
|
319
|
+
void Clear();
|
320
|
+
void ClearAndClose();
|
321
|
+
HRESULT OpenProgressFat(bool changeTotal = true);
|
322
|
+
HRESULT OpenProgress();
|
323
|
+
|
324
|
+
UString GetItemPath(Int32 index) const;
|
325
|
+
HRESULT Open();
|
326
|
+
HRESULT ReadDir(Int32 parent, UInt32 cluster, int level);
|
327
|
+
|
328
|
+
UInt64 GetHeadersSize() const
|
329
|
+
{
|
330
|
+
return (UInt64)(Header.DataSector + (NumDirClusters << Header.SectorsPerClusterLog)) << Header.SectorSizeLog;
|
331
|
+
}
|
332
|
+
HRESULT SeekToSector(UInt32 sector);
|
333
|
+
HRESULT SeekToCluster(UInt32 cluster) { return SeekToSector(Header.ClusterToSector(cluster)); }
|
334
|
+
};
|
335
|
+
|
336
|
+
HRESULT CDatabase::SeekToSector(UInt32 sector)
|
337
|
+
{
|
338
|
+
return InStream->Seek((UInt64)sector << Header.SectorSizeLog, STREAM_SEEK_SET, NULL);
|
339
|
+
}
|
340
|
+
|
341
|
+
void CDatabase::Clear()
|
342
|
+
{
|
343
|
+
VolItemDefined = false;
|
344
|
+
NumDirClusters = 0;
|
345
|
+
NumCurUsedBytes = 0;
|
346
|
+
|
347
|
+
Items.Clear();
|
348
|
+
delete []Fat;
|
349
|
+
Fat = 0;
|
350
|
+
}
|
351
|
+
|
352
|
+
void CDatabase::ClearAndClose()
|
353
|
+
{
|
354
|
+
Clear();
|
355
|
+
InStream.Release();
|
356
|
+
}
|
357
|
+
|
358
|
+
HRESULT CDatabase::OpenProgressFat(bool changeTotal)
|
359
|
+
{
|
360
|
+
if (!OpenCallback)
|
361
|
+
return S_OK;
|
362
|
+
if (changeTotal)
|
363
|
+
{
|
364
|
+
UInt64 numTotalBytes = (Header.CalcFatSizeInSectors() << Header.SectorSizeLog) +
|
365
|
+
((UInt64)(Header.FatSize - NumFreeClusters) << Header.ClusterSizeLog);
|
366
|
+
RINOK(OpenCallback->SetTotal(NULL, &numTotalBytes));
|
367
|
+
}
|
368
|
+
return OpenCallback->SetCompleted(NULL, &NumCurUsedBytes);
|
369
|
+
}
|
370
|
+
|
371
|
+
HRESULT CDatabase::OpenProgress()
|
372
|
+
{
|
373
|
+
if (!OpenCallback)
|
374
|
+
return S_OK;
|
375
|
+
UInt64 numItems = Items.Size();
|
376
|
+
return OpenCallback->SetCompleted(&numItems, &NumCurUsedBytes);
|
377
|
+
}
|
378
|
+
|
379
|
+
UString CDatabase::GetItemPath(Int32 index) const
|
380
|
+
{
|
381
|
+
const CItem *item = &Items[index];
|
382
|
+
UString name = item->GetName();
|
383
|
+
for (;;)
|
384
|
+
{
|
385
|
+
index = item->Parent;
|
386
|
+
if (index < 0)
|
387
|
+
return name;
|
388
|
+
item = &Items[index];
|
389
|
+
name = item->GetName() + WCHAR_PATH_SEPARATOR + name;
|
390
|
+
}
|
391
|
+
}
|
392
|
+
|
393
|
+
static wchar_t *AddSubStringToName(wchar_t *dest, const Byte *p, int numChars)
|
394
|
+
{
|
395
|
+
for (int i = 0; i < numChars; i++)
|
396
|
+
{
|
397
|
+
wchar_t c = Get16(p + i * 2);
|
398
|
+
if (c != 0 && c != 0xFFFF)
|
399
|
+
*dest++ = c;
|
400
|
+
}
|
401
|
+
*dest = 0;
|
402
|
+
return dest;
|
403
|
+
}
|
404
|
+
|
405
|
+
HRESULT CDatabase::ReadDir(Int32 parent, UInt32 cluster, int level)
|
406
|
+
{
|
407
|
+
int startIndex = Items.Size();
|
408
|
+
if (startIndex >= (1 << 30) || level > 256)
|
409
|
+
return S_FALSE;
|
410
|
+
|
411
|
+
UInt32 sectorIndex = 0;
|
412
|
+
UInt32 blockSize = Header.ClusterSize();
|
413
|
+
bool clusterMode = (Header.IsFat32() || parent >= 0);
|
414
|
+
if (!clusterMode)
|
415
|
+
{
|
416
|
+
blockSize = Header.SectorSize();
|
417
|
+
RINOK(SeekToSector(Header.RootDirSector));
|
418
|
+
}
|
419
|
+
|
420
|
+
ByteBuf.SetCapacity(blockSize);
|
421
|
+
UString curName;
|
422
|
+
int checkSum = -1;
|
423
|
+
int numLongRecords = -1;
|
424
|
+
for (UInt32 pos = blockSize;; pos += 32)
|
425
|
+
{
|
426
|
+
if (pos == blockSize)
|
427
|
+
{
|
428
|
+
pos = 0;
|
429
|
+
|
430
|
+
if ((NumDirClusters & 0xFF) == 0)
|
431
|
+
{
|
432
|
+
RINOK(OpenProgress());
|
433
|
+
}
|
434
|
+
|
435
|
+
if (clusterMode)
|
436
|
+
{
|
437
|
+
if (Header.IsEoc(cluster))
|
438
|
+
break;
|
439
|
+
if (!Header.IsValidCluster(cluster))
|
440
|
+
return S_FALSE;
|
441
|
+
PRF(printf("\nCluster = %4X", cluster));
|
442
|
+
RINOK(SeekToCluster(cluster));
|
443
|
+
UInt32 newCluster = Fat[cluster];
|
444
|
+
if ((newCluster & kFatItemUsedByDirMask) != 0)
|
445
|
+
return S_FALSE;
|
446
|
+
Fat[cluster] |= kFatItemUsedByDirMask;
|
447
|
+
cluster = newCluster;
|
448
|
+
NumDirClusters++;
|
449
|
+
NumCurUsedBytes += Header.ClusterSize();
|
450
|
+
}
|
451
|
+
else if (sectorIndex++ >= Header.NumRootDirSectors)
|
452
|
+
break;
|
453
|
+
|
454
|
+
RINOK(ReadStream_FALSE(InStream, ByteBuf, blockSize));
|
455
|
+
}
|
456
|
+
const Byte *p = ByteBuf + pos;
|
457
|
+
if (p[0] == 0)
|
458
|
+
{
|
459
|
+
/*
|
460
|
+
// FreeDOS formats FAT partition with cluster chain longer than required.
|
461
|
+
if (clusterMode && !Header.IsEoc(cluster))
|
462
|
+
return S_FALSE;
|
463
|
+
*/
|
464
|
+
break;
|
465
|
+
}
|
466
|
+
if (p[0] == 0xE5)
|
467
|
+
{
|
468
|
+
if (numLongRecords > 0)
|
469
|
+
return S_FALSE;
|
470
|
+
continue;
|
471
|
+
}
|
472
|
+
|
473
|
+
Byte attrib = p[11];
|
474
|
+
if ((attrib & 0x3F) == 0xF)
|
475
|
+
{
|
476
|
+
if (p[0] > 0x7F || Get16(p + 26) != 0)
|
477
|
+
return S_FALSE;
|
478
|
+
int longIndex = p[0] & 0x3F;
|
479
|
+
if (longIndex == 0)
|
480
|
+
return S_FALSE;
|
481
|
+
bool isLast = (p[0] & 0x40) != 0;
|
482
|
+
if (numLongRecords < 0)
|
483
|
+
{
|
484
|
+
if (!isLast)
|
485
|
+
return S_FALSE;
|
486
|
+
numLongRecords = longIndex;
|
487
|
+
}
|
488
|
+
else if (isLast || numLongRecords != longIndex)
|
489
|
+
return S_FALSE;
|
490
|
+
|
491
|
+
numLongRecords--;
|
492
|
+
|
493
|
+
if (p[12] == 0)
|
494
|
+
{
|
495
|
+
wchar_t nameBuf[14];
|
496
|
+
wchar_t *dest;
|
497
|
+
|
498
|
+
dest = AddSubStringToName(nameBuf, p + 1, 5);
|
499
|
+
dest = AddSubStringToName(dest, p + 14, 6);
|
500
|
+
AddSubStringToName(dest, p + 28, 2);
|
501
|
+
curName = nameBuf + curName;
|
502
|
+
if (isLast)
|
503
|
+
checkSum = p[13];
|
504
|
+
if (checkSum != p[13])
|
505
|
+
return S_FALSE;
|
506
|
+
}
|
507
|
+
}
|
508
|
+
else
|
509
|
+
{
|
510
|
+
if (numLongRecords > 0)
|
511
|
+
return S_FALSE;
|
512
|
+
CItem item;
|
513
|
+
memcpy(item.DosName, p, 11);
|
514
|
+
|
515
|
+
if (checkSum >= 0)
|
516
|
+
{
|
517
|
+
Byte sum = 0;
|
518
|
+
for (int i = 0; i < 11; i++)
|
519
|
+
sum = ((sum & 1) ? 0x80 : 0) + (sum >> 1) + (Byte)item.DosName[i];
|
520
|
+
if (sum == checkSum)
|
521
|
+
item.UName = curName;
|
522
|
+
}
|
523
|
+
|
524
|
+
if (item.DosName[0] == 5)
|
525
|
+
item.DosName[0] = (char)(Byte)0xE5;
|
526
|
+
item.Attrib = attrib;
|
527
|
+
item.Flags = p[12];
|
528
|
+
item.Size = Get32(p + 28);
|
529
|
+
item.Cluster = Get16(p + 26);
|
530
|
+
if (Header.NumFatBits > 16)
|
531
|
+
item.Cluster |= ((UInt32)Get16(p + 20) << 16);
|
532
|
+
else
|
533
|
+
{
|
534
|
+
// OS/2 and WinNT probably can store EA (extended atributes) in that field.
|
535
|
+
}
|
536
|
+
|
537
|
+
item.CTime = Get32(p + 14);
|
538
|
+
item.CTime2 = p[13];
|
539
|
+
item.ADate = Get16(p + 18);
|
540
|
+
item.MTime = Get32(p + 22);
|
541
|
+
item.Parent = parent;
|
542
|
+
|
543
|
+
if (attrib == 8)
|
544
|
+
{
|
545
|
+
VolItem = item;
|
546
|
+
VolItemDefined = true;
|
547
|
+
}
|
548
|
+
else
|
549
|
+
if (memcmp(item.DosName, ". ", 11) != 0 &&
|
550
|
+
memcmp(item.DosName, ".. ", 11) != 0)
|
551
|
+
{
|
552
|
+
if (!item.IsDir())
|
553
|
+
NumCurUsedBytes += Header.GetFilePackSize(item.Size);
|
554
|
+
Items.Add(item);
|
555
|
+
PRF(printf("\n%7d: %S", Items.Size(), GetItemPath(Items.Size() - 1)));
|
556
|
+
}
|
557
|
+
numLongRecords = -1;
|
558
|
+
curName.Empty();
|
559
|
+
checkSum = -1;
|
560
|
+
}
|
561
|
+
}
|
562
|
+
|
563
|
+
int finishIndex = Items.Size();
|
564
|
+
for (int i = startIndex; i < finishIndex; i++)
|
565
|
+
{
|
566
|
+
const CItem &item = Items[i];
|
567
|
+
if (item.IsDir())
|
568
|
+
{
|
569
|
+
PRF(printf("\n%S", GetItemPath(i)));
|
570
|
+
RINOK(CDatabase::ReadDir(i, item.Cluster, level + 1));
|
571
|
+
}
|
572
|
+
}
|
573
|
+
return S_OK;
|
574
|
+
}
|
575
|
+
|
576
|
+
HRESULT CDatabase::Open()
|
577
|
+
{
|
578
|
+
Clear();
|
579
|
+
bool numFreeClustersDefined = false;
|
580
|
+
{
|
581
|
+
static const UInt32 kHeaderSize = 512;
|
582
|
+
Byte buf[kHeaderSize];
|
583
|
+
RINOK(ReadStream_FALSE(InStream, buf, kHeaderSize));
|
584
|
+
if (!Header.Parse(buf))
|
585
|
+
return S_FALSE;
|
586
|
+
UInt64 fileSize;
|
587
|
+
RINOK(InStream->Seek(0, STREAM_SEEK_END, &fileSize));
|
588
|
+
|
589
|
+
/* we comment that check to support truncated images */
|
590
|
+
/*
|
591
|
+
if (fileSize < Header.GetPhySize())
|
592
|
+
return S_FALSE;
|
593
|
+
*/
|
594
|
+
|
595
|
+
if (Header.IsFat32())
|
596
|
+
{
|
597
|
+
SeekToSector(Header.FsInfoSector);
|
598
|
+
RINOK(ReadStream_FALSE(InStream, buf, kHeaderSize));
|
599
|
+
if (buf[0x1FE] != 0x55 || buf[0x1FF] != 0xAA)
|
600
|
+
return S_FALSE;
|
601
|
+
if (Get32(buf) == 0x41615252 && Get32(buf + 484) == 0x61417272)
|
602
|
+
{
|
603
|
+
NumFreeClusters = Get32(buf + 488);
|
604
|
+
numFreeClustersDefined = (NumFreeClusters <= Header.FatSize);
|
605
|
+
}
|
606
|
+
}
|
607
|
+
}
|
608
|
+
|
609
|
+
// numFreeClustersDefined = false; // to recalculate NumFreeClusters
|
610
|
+
if (!numFreeClustersDefined)
|
611
|
+
NumFreeClusters = 0;
|
612
|
+
|
613
|
+
CByteBuffer byteBuf;
|
614
|
+
Fat = new UInt32[Header.FatSize];
|
615
|
+
|
616
|
+
RINOK(OpenProgressFat());
|
617
|
+
RINOK(SeekToSector(Header.GetFatSector()));
|
618
|
+
if (Header.NumFatBits == 32)
|
619
|
+
{
|
620
|
+
const UInt32 kBufSize = (1 << 15);
|
621
|
+
byteBuf.SetCapacity(kBufSize);
|
622
|
+
for (UInt32 i = 0; i < Header.FatSize;)
|
623
|
+
{
|
624
|
+
UInt32 size = Header.FatSize - i;
|
625
|
+
const UInt32 kBufSize32 = kBufSize / 4;
|
626
|
+
if (size > kBufSize32)
|
627
|
+
size = kBufSize32;
|
628
|
+
UInt32 readSize = Header.SizeToSectors(size * 4) << Header.SectorSizeLog;
|
629
|
+
RINOK(ReadStream_FALSE(InStream, byteBuf, readSize));
|
630
|
+
NumCurUsedBytes += readSize;
|
631
|
+
|
632
|
+
const UInt32 *src = (const UInt32 *)(const Byte *)byteBuf;
|
633
|
+
UInt32 *dest = Fat + i;
|
634
|
+
if (numFreeClustersDefined)
|
635
|
+
for (UInt32 j = 0; j < size; j++)
|
636
|
+
dest[j] = Get32(src + j) & 0x0FFFFFFF;
|
637
|
+
else
|
638
|
+
{
|
639
|
+
UInt32 numFreeClusters = 0;
|
640
|
+
for (UInt32 j = 0; j < size; j++)
|
641
|
+
{
|
642
|
+
UInt32 v = Get32(src + j) & 0x0FFFFFFF;
|
643
|
+
numFreeClusters += (UInt32)(v - 1) >> 31;
|
644
|
+
dest[j] = v;
|
645
|
+
}
|
646
|
+
NumFreeClusters += numFreeClusters;
|
647
|
+
}
|
648
|
+
i += size;
|
649
|
+
if ((i & 0xFFFFF) == 0)
|
650
|
+
{
|
651
|
+
RINOK(OpenProgressFat(!numFreeClustersDefined));
|
652
|
+
}
|
653
|
+
}
|
654
|
+
}
|
655
|
+
else
|
656
|
+
{
|
657
|
+
const UInt32 kBufSize = (UInt32)Header.CalcFatSizeInSectors() << Header.SectorSizeLog;
|
658
|
+
NumCurUsedBytes += kBufSize;
|
659
|
+
byteBuf.SetCapacity(kBufSize);
|
660
|
+
Byte *p = byteBuf;
|
661
|
+
RINOK(ReadStream_FALSE(InStream, p, kBufSize));
|
662
|
+
UInt32 fatSize = Header.FatSize;
|
663
|
+
UInt32 *fat = &Fat[0];
|
664
|
+
if (Header.NumFatBits == 16)
|
665
|
+
for (UInt32 j = 0; j < fatSize; j++)
|
666
|
+
fat[j] = Get16(p + j * 2);
|
667
|
+
else
|
668
|
+
for (UInt32 j = 0; j < fatSize; j++)
|
669
|
+
fat[j] = (Get16(p + j * 3 / 2) >> ((j & 1) << 2)) & 0xFFF;
|
670
|
+
|
671
|
+
if (!numFreeClustersDefined)
|
672
|
+
{
|
673
|
+
UInt32 numFreeClusters = 0;
|
674
|
+
for (UInt32 i = 0; i < fatSize; i++)
|
675
|
+
numFreeClusters += (UInt32)(fat[i] - 1) >> 31;
|
676
|
+
NumFreeClusters = numFreeClusters;
|
677
|
+
}
|
678
|
+
}
|
679
|
+
|
680
|
+
RINOK(OpenProgressFat());
|
681
|
+
|
682
|
+
if ((Fat[0] & 0xFF) != Header.MediaType)
|
683
|
+
return S_FALSE;
|
684
|
+
|
685
|
+
return ReadDir(-1, Header.RootCluster, 0);
|
686
|
+
}
|
687
|
+
|
688
|
+
class CHandler:
|
689
|
+
public IInArchive,
|
690
|
+
public IInArchiveGetStream,
|
691
|
+
public CMyUnknownImp,
|
692
|
+
CDatabase
|
693
|
+
{
|
694
|
+
public:
|
695
|
+
MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
|
696
|
+
INTERFACE_IInArchive(;)
|
697
|
+
STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
|
698
|
+
};
|
699
|
+
|
700
|
+
STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
|
701
|
+
{
|
702
|
+
COM_TRY_BEGIN
|
703
|
+
*stream = 0;
|
704
|
+
const CItem &item = Items[index];
|
705
|
+
CClusterInStream *streamSpec = new CClusterInStream;
|
706
|
+
CMyComPtr<ISequentialInStream> streamTemp = streamSpec;
|
707
|
+
streamSpec->Stream = InStream;
|
708
|
+
streamSpec->StartOffset = Header.DataSector << Header.SectorSizeLog;
|
709
|
+
streamSpec->BlockSizeLog = Header.ClusterSizeLog;
|
710
|
+
streamSpec->Size = item.Size;
|
711
|
+
|
712
|
+
UInt32 numClusters = Header.GetNumClusters(item.Size);
|
713
|
+
streamSpec->Vector.Reserve(numClusters);
|
714
|
+
UInt32 cluster = item.Cluster;
|
715
|
+
UInt32 size = item.Size;
|
716
|
+
|
717
|
+
if (size == 0)
|
718
|
+
{
|
719
|
+
if (cluster != 0)
|
720
|
+
return S_FALSE;
|
721
|
+
}
|
722
|
+
else
|
723
|
+
{
|
724
|
+
UInt32 clusterSize = Header.ClusterSize();
|
725
|
+
for (;; size -= clusterSize)
|
726
|
+
{
|
727
|
+
if (!Header.IsValidCluster(cluster))
|
728
|
+
return S_FALSE;
|
729
|
+
streamSpec->Vector.Add(cluster - 2);
|
730
|
+
cluster = Fat[cluster];
|
731
|
+
if (size <= clusterSize)
|
732
|
+
break;
|
733
|
+
}
|
734
|
+
if (!Header.IsEocAndUnused(cluster))
|
735
|
+
return S_FALSE;
|
736
|
+
}
|
737
|
+
RINOK(streamSpec->InitAndSeek());
|
738
|
+
*stream = streamTemp.Detach();
|
739
|
+
return S_OK;
|
740
|
+
COM_TRY_END
|
741
|
+
}
|
742
|
+
|
743
|
+
STATPROPSTG kProps[] =
|
744
|
+
{
|
745
|
+
{ NULL, kpidPath, VT_BSTR},
|
746
|
+
{ NULL, kpidIsDir, VT_BOOL},
|
747
|
+
{ NULL, kpidSize, VT_UI8},
|
748
|
+
{ NULL, kpidPackSize, VT_UI8},
|
749
|
+
{ NULL, kpidMTime, VT_FILETIME},
|
750
|
+
{ NULL, kpidCTime, VT_FILETIME},
|
751
|
+
{ NULL, kpidATime, VT_FILETIME},
|
752
|
+
{ NULL, kpidAttrib, VT_UI8},
|
753
|
+
{ NULL, kpidShortName, VT_BSTR}
|
754
|
+
};
|
755
|
+
|
756
|
+
enum
|
757
|
+
{
|
758
|
+
kpidNumFats = kpidUserDefined
|
759
|
+
// kpidOemName,
|
760
|
+
// kpidVolName,
|
761
|
+
// kpidFileSysType
|
762
|
+
};
|
763
|
+
|
764
|
+
STATPROPSTG kArcProps[] =
|
765
|
+
{
|
766
|
+
{ NULL, kpidFileSystem, VT_BSTR},
|
767
|
+
{ NULL, kpidClusterSize, VT_UI4},
|
768
|
+
{ NULL, kpidPhySize, VT_UI8},
|
769
|
+
{ NULL, kpidFreeSpace, VT_UI8},
|
770
|
+
{ NULL, kpidHeadersSize, VT_UI8},
|
771
|
+
{ NULL, kpidMTime, VT_FILETIME},
|
772
|
+
{ NULL, kpidVolumeName, VT_BSTR},
|
773
|
+
|
774
|
+
{ L"FATs", kpidNumFats, VT_UI4},
|
775
|
+
{ NULL, kpidSectorSize, VT_UI4},
|
776
|
+
{ NULL, kpidId, VT_UI4},
|
777
|
+
// { L"OEM Name", kpidOemName, VT_BSTR},
|
778
|
+
// { L"Volume Name", kpidVolName, VT_BSTR},
|
779
|
+
// { L"File System Type", kpidFileSysType, VT_BSTR}
|
780
|
+
// { NULL, kpidSectorsPerTrack, VT_UI4},
|
781
|
+
// { NULL, kpidNumHeads, VT_UI4},
|
782
|
+
// { NULL, kpidHiddenSectors, VT_UI4}
|
783
|
+
};
|
784
|
+
|
785
|
+
IMP_IInArchive_Props
|
786
|
+
IMP_IInArchive_ArcProps_WITH_NAME
|
787
|
+
|
788
|
+
static void FatTimeToProp(UInt32 dosTime, UInt32 ms10, NWindows::NCOM::CPropVariant &prop)
|
789
|
+
{
|
790
|
+
FILETIME localFileTime, utc;
|
791
|
+
if (NWindows::NTime::DosTimeToFileTime(dosTime, localFileTime))
|
792
|
+
if (LocalFileTimeToFileTime(&localFileTime, &utc))
|
793
|
+
{
|
794
|
+
UInt64 t64 = (((UInt64)utc.dwHighDateTime) << 32) + utc.dwLowDateTime;
|
795
|
+
t64 += ms10 * 100000;
|
796
|
+
utc.dwLowDateTime = (DWORD)t64;
|
797
|
+
utc.dwHighDateTime = (DWORD)(t64 >> 32);
|
798
|
+
prop = utc;
|
799
|
+
}
|
800
|
+
}
|
801
|
+
|
802
|
+
/*
|
803
|
+
static void StringToProp(const Byte *src, int size, NWindows::NCOM::CPropVariant &prop)
|
804
|
+
{
|
805
|
+
char dest[32];
|
806
|
+
memcpy(dest, src, size);
|
807
|
+
dest[size] = 0;
|
808
|
+
prop = FatStringToUnicode(dest);
|
809
|
+
}
|
810
|
+
|
811
|
+
#define STRING_TO_PROP(s, p) StringToProp(s, sizeof(s), prop)
|
812
|
+
*/
|
813
|
+
|
814
|
+
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
815
|
+
{
|
816
|
+
COM_TRY_BEGIN
|
817
|
+
NWindows::NCOM::CPropVariant prop;
|
818
|
+
switch(propID)
|
819
|
+
{
|
820
|
+
case kpidFileSystem:
|
821
|
+
{
|
822
|
+
wchar_t s[32] = { L'F', L'A', L'T' };
|
823
|
+
ConvertUInt32ToString(Header.NumFatBits, s + 3);
|
824
|
+
prop = s;
|
825
|
+
break;
|
826
|
+
}
|
827
|
+
case kpidClusterSize: prop = Header.ClusterSize(); break;
|
828
|
+
case kpidPhySize: prop = Header.GetPhySize(); break;
|
829
|
+
case kpidFreeSpace: prop = (UInt64)NumFreeClusters << Header.ClusterSizeLog; break;
|
830
|
+
case kpidHeadersSize: prop = GetHeadersSize(); break;
|
831
|
+
case kpidMTime: if (VolItemDefined) FatTimeToProp(VolItem.MTime, 0, prop); break;
|
832
|
+
case kpidVolumeName: if (VolItemDefined) prop = VolItem.GetVolName(); break;
|
833
|
+
case kpidNumFats: if (Header.NumFats != 2) prop = Header.NumFats; break;
|
834
|
+
case kpidSectorSize: prop = (UInt32)1 << Header.SectorSizeLog; break;
|
835
|
+
// case kpidSectorsPerTrack: prop = Header.SectorsPerTrack; break;
|
836
|
+
// case kpidNumHeads: prop = Header.NumHeads; break;
|
837
|
+
// case kpidOemName: STRING_TO_PROP(Header.OemName, prop); break;
|
838
|
+
case kpidId: if (Header.VolFieldsDefined) prop = Header.VolId; break;
|
839
|
+
// case kpidVolName: if (Header.VolFieldsDefined) STRING_TO_PROP(Header.VolName, prop); break;
|
840
|
+
// case kpidFileSysType: if (Header.VolFieldsDefined) STRING_TO_PROP(Header.FileSys, prop); break;
|
841
|
+
// case kpidHiddenSectors: prop = Header.NumHiddenSectors; break;
|
842
|
+
}
|
843
|
+
prop.Detach(value);
|
844
|
+
return S_OK;
|
845
|
+
COM_TRY_END
|
846
|
+
}
|
847
|
+
|
848
|
+
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
|
849
|
+
{
|
850
|
+
COM_TRY_BEGIN
|
851
|
+
NWindows::NCOM::CPropVariant prop;
|
852
|
+
const CItem &item = Items[index];
|
853
|
+
switch(propID)
|
854
|
+
{
|
855
|
+
case kpidPath: prop = GetItemPath(index); break;
|
856
|
+
case kpidShortName: prop = item.GetShortName(); break;
|
857
|
+
case kpidIsDir: prop = item.IsDir(); break;
|
858
|
+
case kpidMTime: FatTimeToProp(item.MTime, 0, prop); break;
|
859
|
+
case kpidCTime: FatTimeToProp(item.CTime, item.CTime2, prop); break;
|
860
|
+
case kpidATime: FatTimeToProp(((UInt32)item.ADate << 16), 0, prop); break;
|
861
|
+
case kpidAttrib: prop = (UInt32)item.Attrib; break;
|
862
|
+
case kpidSize: if (!item.IsDir()) prop = item.Size; break;
|
863
|
+
case kpidPackSize: if (!item.IsDir()) prop = Header.GetFilePackSize(item.Size); break;
|
864
|
+
}
|
865
|
+
prop.Detach(value);
|
866
|
+
return S_OK;
|
867
|
+
COM_TRY_END
|
868
|
+
}
|
869
|
+
|
870
|
+
STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 *, IArchiveOpenCallback *callback)
|
871
|
+
{
|
872
|
+
COM_TRY_BEGIN
|
873
|
+
{
|
874
|
+
OpenCallback = callback;
|
875
|
+
InStream = stream;
|
876
|
+
HRESULT res;
|
877
|
+
try
|
878
|
+
{
|
879
|
+
res = CDatabase::Open();
|
880
|
+
if (res == S_OK)
|
881
|
+
return S_OK;
|
882
|
+
}
|
883
|
+
catch(...)
|
884
|
+
{
|
885
|
+
Close();
|
886
|
+
throw;
|
887
|
+
}
|
888
|
+
Close();
|
889
|
+
return res;
|
890
|
+
}
|
891
|
+
COM_TRY_END
|
892
|
+
}
|
893
|
+
|
894
|
+
STDMETHODIMP CHandler::Close()
|
895
|
+
{
|
896
|
+
ClearAndClose();
|
897
|
+
return S_OK;
|
898
|
+
}
|
899
|
+
|
900
|
+
STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
901
|
+
Int32 testMode, IArchiveExtractCallback *extractCallback)
|
902
|
+
{
|
903
|
+
COM_TRY_BEGIN
|
904
|
+
bool allFilesMode = (numItems == (UInt32)-1);
|
905
|
+
if (allFilesMode)
|
906
|
+
numItems = Items.Size();
|
907
|
+
if (numItems == 0)
|
908
|
+
return S_OK;
|
909
|
+
UInt32 i;
|
910
|
+
UInt64 totalSize = 0;
|
911
|
+
for (i = 0; i < numItems; i++)
|
912
|
+
{
|
913
|
+
const CItem &item = Items[allFilesMode ? i : indices[i]];
|
914
|
+
if (!item.IsDir())
|
915
|
+
totalSize += item.Size;
|
916
|
+
}
|
917
|
+
RINOK(extractCallback->SetTotal(totalSize));
|
918
|
+
|
919
|
+
UInt64 totalPackSize;
|
920
|
+
totalSize = totalPackSize = 0;
|
921
|
+
|
922
|
+
NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
|
923
|
+
CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
|
924
|
+
|
925
|
+
CLocalProgress *lps = new CLocalProgress;
|
926
|
+
CMyComPtr<ICompressProgressInfo> progress = lps;
|
927
|
+
lps->Init(extractCallback, false);
|
928
|
+
|
929
|
+
CDummyOutStream *outStreamSpec = new CDummyOutStream;
|
930
|
+
CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
|
931
|
+
|
932
|
+
for (i = 0; i < numItems; i++)
|
933
|
+
{
|
934
|
+
lps->InSize = totalPackSize;
|
935
|
+
lps->OutSize = totalSize;
|
936
|
+
RINOK(lps->SetCur());
|
937
|
+
CMyComPtr<ISequentialOutStream> realOutStream;
|
938
|
+
Int32 askMode = testMode ?
|
939
|
+
NExtract::NAskMode::kTest :
|
940
|
+
NExtract::NAskMode::kExtract;
|
941
|
+
Int32 index = allFilesMode ? i : indices[i];
|
942
|
+
const CItem &item = Items[index];
|
943
|
+
RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
|
944
|
+
|
945
|
+
if (item.IsDir())
|
946
|
+
{
|
947
|
+
RINOK(extractCallback->PrepareOperation(askMode));
|
948
|
+
RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kOK));
|
949
|
+
continue;
|
950
|
+
}
|
951
|
+
|
952
|
+
totalPackSize += Header.GetFilePackSize(item.Size);
|
953
|
+
totalSize += item.Size;
|
954
|
+
|
955
|
+
if (!testMode && !realOutStream)
|
956
|
+
continue;
|
957
|
+
RINOK(extractCallback->PrepareOperation(askMode));
|
958
|
+
|
959
|
+
outStreamSpec->SetStream(realOutStream);
|
960
|
+
realOutStream.Release();
|
961
|
+
outStreamSpec->Init();
|
962
|
+
|
963
|
+
int res = NExtract::NOperationResult::kDataError;
|
964
|
+
CMyComPtr<ISequentialInStream> inStream;
|
965
|
+
HRESULT hres = GetStream(index, &inStream);
|
966
|
+
if (hres != S_FALSE)
|
967
|
+
{
|
968
|
+
RINOK(hres);
|
969
|
+
if (inStream)
|
970
|
+
{
|
971
|
+
RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
|
972
|
+
if (copyCoderSpec->TotalSize == item.Size)
|
973
|
+
res = NExtract::NOperationResult::kOK;
|
974
|
+
}
|
975
|
+
}
|
976
|
+
outStreamSpec->ReleaseStream();
|
977
|
+
RINOK(extractCallback->SetOperationResult(res));
|
978
|
+
}
|
979
|
+
return S_OK;
|
980
|
+
COM_TRY_END
|
981
|
+
}
|
982
|
+
|
983
|
+
STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
|
984
|
+
{
|
985
|
+
*numItems = Items.Size();
|
986
|
+
return S_OK;
|
987
|
+
}
|
988
|
+
|
989
|
+
static IInArchive *CreateArc() { return new CHandler; }
|
990
|
+
|
991
|
+
static CArcInfo g_ArcInfo =
|
992
|
+
{ L"FAT", L"fat img", 0, 0xDA, { 0x55, 0xAA }, 2, false, CreateArc, 0 };
|
993
|
+
|
994
|
+
REGISTER_ARC(Fat)
|
995
|
+
|
996
|
+
}}
|