summaryrefslogtreecommitdiffstats
path: root/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip
diff options
context:
space:
mode:
Diffstat (limited to 'installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip')
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zCompressionMode.cpp3
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zCompressionMode.h51
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zDecode.cpp332
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zDecode.h68
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zEncode.cpp453
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zEncode.h55
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zExtract.cpp278
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderInStream.cpp130
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderInStream.h66
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.cpp140
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.h56
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHandler.cpp497
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHandler.h119
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHandlerOut.cpp481
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHeader.cpp27
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHeader.h97
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zIn.cpp1257
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zIn.h245
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zItem.h258
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zOut.cpp874
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zOut.h156
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zProperties.cpp163
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zProperties.h22
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zRegister.cpp18
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zSpecStream.cpp24
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zSpecStream.h35
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zUpdate.cpp1208
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zUpdate.h88
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ArchiveExports.cpp127
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ArjHandler.cpp799
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Bz2Handler.cpp432
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabBlockInStream.cpp189
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabBlockInStream.h44
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHandler.cpp826
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHandler.h28
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHeader.cpp15
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHeader.h44
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabIn.cpp290
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabIn.h166
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabItem.h63
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabRegister.cpp13
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHandler.cpp721
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHandler.h29
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHeader.cpp24
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHeader.h28
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmIn.cpp940
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmIn.h244
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmRegister.cpp13
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComHandler.cpp239
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComHandler.h28
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComIn.cpp359
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComIn.h117
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComRegister.cpp13
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2.cpp121
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2.h175
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2MT.cpp230
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2MT.h80
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2ST.cpp239
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2ST.h88
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CrossThreadProgress.cpp15
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CrossThreadProgress.h37
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/DummyOutStream.cpp22
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/DummyOutStream.h24
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/FindSignature.cpp62
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/FindSignature.h12
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/HandlerOut.cpp623
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/HandlerOut.h87
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/InStreamWithCRC.cpp40
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/InStreamWithCRC.h67
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ItemNameUtils.cpp61
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ItemNameUtils.h24
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/MultiStream.cpp201
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/MultiStream.h76
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp18
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithCRC.h36
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp18
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithSha1.h36
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ParseProperties.cpp177
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ParseProperties.h18
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/CpioHandler.cpp625
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/DebHandler.cpp394
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/DllExports2.cpp74
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/DmgHandler.cpp778
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ElfHandler.cpp535
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/FatHandler.cpp983
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/GzHandler.cpp824
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsHandler.cpp244
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsHandler.h26
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsIn.cpp480
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsIn.h154
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsRegister.cpp13
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/IArchive.h234
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHandler.cpp278
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHandler.h30
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHeader.cpp21
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHeader.h61
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoIn.cpp452
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoIn.h300
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoItem.h141
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoRegister.cpp13
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/LzhHandler.cpp783
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/LzmaHandler.cpp440
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/MachoHandler.cpp468
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/MbrHandler.cpp508
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/MubHandler.cpp267
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisDecode.cpp141
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisDecode.h47
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisHandler.cpp489
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisHandler.h43
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisIn.cpp1448
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisIn.h184
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisRegister.cpp14
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/NtfsHandler.cpp1725
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/PeHandler.cpp912
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHandler.cpp838
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHandler.h60
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHeader.cpp21
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHeader.h224
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarIn.cpp511
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarIn.h126
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarItem.cpp55
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarItem.h79
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarRegister.cpp13
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp78
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarVolumeInStream.h49
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/RpmHandler.cpp297
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/SplitHandler.cpp374
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHandler.cpp342
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHandler.h59
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHandlerOut.cpp121
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHeader.cpp25
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHeader.h108
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarIn.cpp181
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarIn.h18
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarItem.h69
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarOut.cpp186
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarOut.h28
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarRegister.cpp18
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarUpdate.cpp139
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarUpdate.h34
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfHandler.cpp500
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfHandler.h38
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfIn.cpp876
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfIn.h375
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfRegister.cpp13
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/VhdHandler.cpp731
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.cpp619
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.h66
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.cpp570
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.h235
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimRegister.cpp13
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/XarHandler.cpp586
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/XzHandler.cpp718
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ZHandler.cpp176
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipAddCommon.cpp345
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipAddCommon.h59
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipCompressionMode.h39
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHandler.cpp827
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHandler.h96
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp508
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHeader.cpp36
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHeader.h276
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipIn.cpp851
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipIn.h123
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipItem.cpp181
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipItem.h281
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipItemEx.h34
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipOut.cpp280
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipOut.h56
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipRegister.cpp18
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipUpdate.cpp855
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipUpdate.h58
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Bundles/SFXCon/Main.cpp441
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/CMAKE/CMakeLists_Alone.txt251
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/CMAKE/generate.sh14
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CWrappers.cpp127
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CWrappers.h46
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CreateCoder.cpp292
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CreateCoder.h98
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilePathAutoRename.cpp55
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilePathAutoRename.h10
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FileStreams.cpp274
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FileStreams.h141
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilterCoder.cpp255
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilterCoder.h143
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InBuffer.cpp80
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InBuffer.h81
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InOutTempBuffer.cpp122
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InOutTempBuffer.h55
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LimitedStreams.cpp154
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LimitedStreams.h124
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LockedStream.cpp23
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LockedStream.h38
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MemBlocks.cpp183
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MemBlocks.h71
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodId.cpp27
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodId.h10
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodProps.cpp99
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodProps.h41
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OffsetStream.cpp35
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OffsetStream.h25
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutBuffer.cpp116
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutBuffer.h64
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutMemStream.cpp142
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutMemStream.h96
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressMt.cpp53
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressMt.h46
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressUtils.cpp42
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressUtils.h34
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/RegisterArc.h38
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/RegisterCodec.h35
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamBinder.cpp161
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamBinder.h48
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamObjects.cpp68
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamObjects.h117
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamUtils.cpp56
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamUtils.h13
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/VirtThread.cpp46
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/VirtThread.h23
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder1.cpp315
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder1.h98
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder2.cpp90
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder2.h59
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Const.h54
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Crc.cpp26
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Crc.h31
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Decoder.cpp813
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Decoder.h173
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Encoder.cpp895
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Encoder.h245
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Register.cpp20
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Bcj2Coder.cpp390
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Bcj2Coder.h125
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Bcj2Register.cpp19
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BcjCoder.cpp15
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BcjCoder.h19
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BcjRegister.cpp19
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitlDecoder.cpp24
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitlDecoder.h142
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitlEncoder.h60
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitmDecoder.h66
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitmEncoder.h52
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchCoder.cpp19
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchCoder.h44
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchMisc.cpp37
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchMisc.h14
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchRegister.cpp30
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ByteSwap.cpp73
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CodecExports.cpp160
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CopyCoder.cpp67
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CopyCoder.h34
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CopyRegister.cpp14
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Deflate64Register.cpp20
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateConst.h134
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateDecoder.cpp353
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateDecoder.h157
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateEncoder.cpp984
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateEncoder.h211
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateNsisRegister.cpp14
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateRegister.cpp21
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeltaFilter.cpp112
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DllExports.cpp39
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DllExports2.cpp28
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/HuffmanDecoder.h89
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeDecoder.cpp219
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeDecoder.h57
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp89
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeHuffmanDecoder.h34
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp531
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp1018
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h49
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp311
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h20
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzOutWindow.cpp14
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzOutWindow.h66
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzhDecoder.cpp220
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzhDecoder.h106
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Decoder.cpp189
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Decoder.h73
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Encoder.cpp94
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Encoder.h36
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Register.cpp20
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaDecoder.cpp239
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaDecoder.h76
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaEncoder.cpp149
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaEncoder.h36
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaRegister.cpp20
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzx.h61
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzx86Converter.cpp90
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzx86Converter.h46
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzxDecoder.cpp387
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzxDecoder.h161
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Mtf8.h196
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PPMD_Alone/PpmdAlone.cpp348
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdContext.h490
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdDecode.h156
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdDecoder.cpp183
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdDecoder.h87
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdEncode.h142
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdEncoder.cpp148
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdEncoder.h79
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdRegister.cpp21
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdSubAlloc.h293
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdType.h14
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/QuantumDecoder.cpp171
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/QuantumDecoder.h287
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/RangeCoder.h205
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/RangeCoderBit.h114
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar1Decoder.cpp478
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar1Decoder.h88
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar2Decoder.cpp389
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar2Decoder.h174
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Decoder.cpp834
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Decoder.h301
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Vm.cpp1091
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Vm.h179
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/RarCodecsRegister.cpp26
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ShrinkDecoder.cpp145
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ShrinkDecoder.h38
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZDecoder.cpp159
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZDecoder.h42
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZlibDecoder.cpp94
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZlibDecoder.h46
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/7zAes.cpp244
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/7zAes.h117
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/7zAesRegister.cpp18
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/HmacSha1.cpp109
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/HmacSha1.h39
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/MyAes.cpp57
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/MyAes.h45
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp83
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Pbkdf2HmacSha1.h21
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RandGen.cpp107
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RandGen.h21
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Rar20Crypto.cpp133
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Rar20Crypto.h50
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RarAes.cpp139
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RarAes.h59
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Sha1.cpp211
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Sha1.h68
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/WzAes.cpp209
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/WzAes.h116
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipCrypto.cpp128
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipCrypto.h71
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipStrong.cpp177
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipStrong.h53
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/ICoder.h179
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IDecl.h15
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IPassword.h24
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IProgress.h33
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IStream.h58
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/MyVersion.h11
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/PropID.h75
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/Agent.cpp615
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/Agent.h232
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/AgentOut.cpp535
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/AgentProxy.cpp246
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/AgentProxy.h53
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/ArchiveFolder.cpp59
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp121
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp214
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/IFolderArchive.h73
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp121
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/UpdateCallbackAgent.h19
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Client7z/Client7z.cpp853
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/ClientCodec/ClientCodec.cpp370
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveCommandLine.cpp1005
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveCommandLine.h107
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp494
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveExtractCallback.h143
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveName.cpp54
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveName.h10
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp137
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveOpenCallback.h104
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/CompressCall.cpp446
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/CompressCall.h30
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/DefaultName.cpp35
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/DefaultName.h11
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/DirItem.h69
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/EnumDirItems.cpp361
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/EnumDirItems.h26
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExitCode.h27
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Extract.cpp253
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Extract.h76
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExtractMode.h31
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExtractingFilePath.cpp141
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExtractingFilePath.h13
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/HandlerLoader.h38
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/IFileExtractCallback.h46
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/LoadCodecs.cpp697
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/LoadCodecs.h220
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/OpenArchive.cpp509
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/OpenArchive.h86
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/PropIDUtils.cpp96
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/PropIDUtils.h12
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Property.h14
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SetProperties.cpp79
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SetProperties.h10
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SortUtils.cpp22
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SortUtils.h10
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/TempFiles.cpp22
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/TempFiles.h16
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Update.cpp904
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Update.h166
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateAction.cpp64
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateAction.h57
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateCallback.cpp253
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateCallback.h76
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdatePair.cpp158
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdatePair.h25
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateProduce.cpp58
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateProduce.h36
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/WorkDir.cpp69
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/WorkDir.h10
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ZipRegistry.cpp417
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ZipRegistry.h98
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ConsoleClose.cpp49
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ConsoleClose.h26
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp228
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ExtractCallbackConsole.h73
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/List.cpp616
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/List.h20
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/Main.cpp642
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/MainAr.cpp157
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/OpenCallbackConsole.cpp58
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/OpenCallbackConsole.h24
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/PercentPrinter.cpp90
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/PercentPrinter.h31
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp261
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UpdateCallbackConsole.h63
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UserInputUtils.cpp92
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UserInputUtils.h24
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Explorer/MyMessages.cpp58
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Explorer/MyMessages.h28
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/App.cpp910
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/App.h344
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/AppState.h114
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ClassDefs.cpp17
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialog.cpp53
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialog.h25
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialogRes.h4
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialog_rc.cpp57
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialog.cpp82
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialog.h30
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialogRes.h8
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialog_rc.cpp73
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ExtractCallback.cpp478
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ExtractCallback.h150
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FM.cpp914
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FM_rc.cpp970
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSDrives.h.out49
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSFolder.cpp701
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSFolder.h120
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSFolderCopy.cpp523
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp165
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h9
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FormatUtils.cpp40
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FormatUtils.h18
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/HelpUtils.h10
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/IFolder.h157
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/LangUtils.cpp208
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/LangUtils.h41
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialog.cpp96
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialog.h32
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialogRes.h3
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialog_rc.cpp55
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialog.cpp76
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialog.h22
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialogRes.h3
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialog_rc.cpp81
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MyLoadMenu.cpp733
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MyLoadMenu.h20
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/NetFolder.h.OUT56
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OpenCallback.cpp122
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OpenCallback.h92
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialog.cpp126
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialog.h34
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialogRes.h19
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialog_rc.cpp96
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/Panel.cpp1100
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/Panel.h577
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelCopy.cpp228
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelCrc.cpp368
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelFolderChange.cpp597
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelItemOpen.cpp621
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelItems.cpp828
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelListNotify.cpp429
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelMenu.cpp621
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelOperations.cpp470
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelSelect.cpp305
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelSort.cpp163
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelSplitFile.cpp528
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialog.cpp50
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialog.h21
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialogRes.h4
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialog_rc.cpp63
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PluginInterface.h42
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PluginLoader.h32
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgramLocation.cpp20
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgramLocation.h10
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2.cpp507
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2.h242
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2Res.h26
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2_rc.cpp171
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialogRes.h3
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PropertyName.cpp109
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PropertyName.h10
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PropertyNameRes.h52
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryAssociations.cpp301
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryAssociations.h44
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryPlugins.h32
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryUtils.cpp152
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryUtils.h46
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RootFolder.cpp278
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RootFolder.h38
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialog.cpp89
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialog.h27
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialogRes.h8
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialog_rc.cpp79
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitUtils.cpp85
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitUtils.h15
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/StringUtils.cpp68
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/StringUtils.h13
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SysIconUtils.cpp167
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SysIconUtils.h51
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/TextPairs.cpp189
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/TextPairs.h31
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/UpdateCallback100.cpp106
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/UpdateCallback100.h72
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ViewSettings.cpp426
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ViewSettings.h100
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Add2PNG.h20
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/AddPNG.h22
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Copy2PNG.h22
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/CopyPNG.h26
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Delete2PNG.h23
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/DeletePNG.h26
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Extract2PNG.h18
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/ExtractPNG.h18
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Info2PNG.h21
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/InfoPNG.h22
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Move2PNG.h21
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/MovePNG.h25
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/ParentFolder.h91
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Test2PNG.h21
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/TestPNG.h25
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/resource.h168
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/wxFM.cpp345
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialog.cpp581
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialog.h131
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialogRes.h54
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialog_rc.cpp245
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialog.cpp1455
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialog.h184
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialogRes.h52
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialog_rc.cpp283
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialog.cpp374
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialog.h77
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialogRes.h28
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialog_rc.cpp145
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractGUI.cpp230
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractGUI.h20
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractRes.h19
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/GUI.cpp294
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp256
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateCallbackGUI.h53
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateGUI.cpp389
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateGUI.h19
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/resource.h49
-rw-r--r--installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/wxGUI.cpp575
570 files changed, 0 insertions, 108085 deletions
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zCompressionMode.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zCompressionMode.cpp
deleted file mode 100644
index 6774fc482..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zCompressionMode.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// CompressionMethod.cpp
-
-#include "StdAfx.h"
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zCompressionMode.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zCompressionMode.h
deleted file mode 100644
index 174b9ebf3..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zCompressionMode.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// 7zCompressionMode.h
-
-#ifndef __7Z_COMPRESSION_MODE_H
-#define __7Z_COMPRESSION_MODE_H
-
-#include "../../../Common/MyString.h"
-
-#include "../../../Windows/PropVariant.h"
-
-#include "../../Common/MethodProps.h"
-
-namespace NArchive {
-namespace N7z {
-
-struct CMethodFull: public CMethod
-{
- UInt32 NumInStreams;
- UInt32 NumOutStreams;
- bool IsSimpleCoder() const { return (NumInStreams == 1) && (NumOutStreams == 1); }
-};
-
-struct CBind
-{
- UInt32 InCoder;
- UInt32 InStream;
- UInt32 OutCoder;
- UInt32 OutStream;
-};
-
-struct CCompressionMethodMode
-{
- CObjectVector<CMethodFull> Methods;
- CRecordVector<CBind> Binds;
- #ifdef COMPRESS_MT
- UInt32 NumThreads;
- #endif
- bool PasswordIsDefined;
- UString Password;
-
- bool IsEmpty() const { return (Methods.IsEmpty() && !PasswordIsDefined); }
- CCompressionMethodMode():
- #ifdef COMPRESS_MT
- NumThreads(1),
- #endif
- PasswordIsDefined(false)
- {}
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zDecode.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zDecode.cpp
deleted file mode 100644
index 2d25ff2ec..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zDecode.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-// 7zDecode.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/LockedStream.h"
-#include "../../Common/ProgressUtils.h"
-#include "../../Common/StreamObjects.h"
-
-#include "7zDecode.h"
-
-namespace NArchive {
-namespace N7z {
-
-static void ConvertFolderItemInfoToBindInfo(const CFolder &folder,
- CBindInfoEx &bindInfo)
-{
- bindInfo.Clear();
- int i;
- for (i = 0; i < folder.BindPairs.Size(); i++)
- {
- NCoderMixer::CBindPair bindPair;
- bindPair.InIndex = (UInt32)folder.BindPairs[i].InIndex;
- bindPair.OutIndex = (UInt32)folder.BindPairs[i].OutIndex;
- bindInfo.BindPairs.Add(bindPair);
- }
- UInt32 outStreamIndex = 0;
- for (i = 0; i < folder.Coders.Size(); i++)
- {
- NCoderMixer::CCoderStreamsInfo coderStreamsInfo;
- const CCoderInfo &coderInfo = folder.Coders[i];
- coderStreamsInfo.NumInStreams = (UInt32)coderInfo.NumInStreams;
- coderStreamsInfo.NumOutStreams = (UInt32)coderInfo.NumOutStreams;
- bindInfo.Coders.Add(coderStreamsInfo);
- bindInfo.CoderMethodIDs.Add(coderInfo.MethodID);
- for (UInt32 j = 0; j < coderStreamsInfo.NumOutStreams; j++, outStreamIndex++)
- if (folder.FindBindPairForOutStream(outStreamIndex) < 0)
- bindInfo.OutStreams.Add(outStreamIndex);
- }
- for (i = 0; i < folder.PackStreams.Size(); i++)
- bindInfo.InStreams.Add((UInt32)folder.PackStreams[i]);
-}
-
-static bool AreCodersEqual(const NCoderMixer::CCoderStreamsInfo &a1,
- const NCoderMixer::CCoderStreamsInfo &a2)
-{
- return (a1.NumInStreams == a2.NumInStreams) &&
- (a1.NumOutStreams == a2.NumOutStreams);
-}
-
-static bool AreBindPairsEqual(const NCoderMixer::CBindPair &a1, const NCoderMixer::CBindPair &a2)
-{
- return (a1.InIndex == a2.InIndex) &&
- (a1.OutIndex == a2.OutIndex);
-}
-
-static bool AreBindInfoExEqual(const CBindInfoEx &a1, const CBindInfoEx &a2)
-{
- if (a1.Coders.Size() != a2.Coders.Size())
- return false;
- int i;
- for (i = 0; i < a1.Coders.Size(); i++)
- if (!AreCodersEqual(a1.Coders[i], a2.Coders[i]))
- return false;
- if (a1.BindPairs.Size() != a2.BindPairs.Size())
- return false;
- for (i = 0; i < a1.BindPairs.Size(); i++)
- if (!AreBindPairsEqual(a1.BindPairs[i], a2.BindPairs[i]))
- return false;
- for (i = 0; i < a1.CoderMethodIDs.Size(); i++)
- if (a1.CoderMethodIDs[i] != a2.CoderMethodIDs[i])
- return false;
- if (a1.InStreams.Size() != a2.InStreams.Size())
- return false;
- if (a1.OutStreams.Size() != a2.OutStreams.Size())
- return false;
- return true;
-}
-
-CDecoder::CDecoder(bool multiThread)
-{
- #ifndef _ST_MODE
- multiThread = true;
- #endif
- _multiThread = multiThread;
- _bindInfoExPrevIsDefined = false;
-}
-
-HRESULT CDecoder::Decode(
- DECL_EXTERNAL_CODECS_LOC_VARS
- IInStream *inStream,
- UInt64 startPos,
- const UInt64 *packSizes,
- const CFolder &folderInfo,
- ISequentialOutStream *outStream,
- ICompressProgressInfo *compressProgress
- #ifndef _NO_CRYPTO
- , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
- #endif
- #ifdef COMPRESS_MT
- , bool mtMode, UInt32 numThreads
- #endif
- )
-{
- if (!folderInfo.CheckStructure())
- return E_NOTIMPL;
- #ifndef _NO_CRYPTO
- passwordIsDefined = false;
- #endif
- CObjectVector< CMyComPtr<ISequentialInStream> > inStreams;
-
- CLockedInStream lockedInStream;
- lockedInStream.Init(inStream);
-
- for (int j = 0; j < folderInfo.PackStreams.Size(); j++)
- {
- CLockedSequentialInStreamImp *lockedStreamImpSpec = new
- CLockedSequentialInStreamImp;
- CMyComPtr<ISequentialInStream> lockedStreamImp = lockedStreamImpSpec;
- lockedStreamImpSpec->Init(&lockedInStream, startPos);
- startPos += packSizes[j];
-
- CLimitedSequentialInStream *streamSpec = new
- CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream = streamSpec;
- streamSpec->SetStream(lockedStreamImp);
- streamSpec->Init(packSizes[j]);
- inStreams.Add(inStream);
- }
-
- int numCoders = folderInfo.Coders.Size();
-
- CBindInfoEx bindInfo;
- ConvertFolderItemInfoToBindInfo(folderInfo, bindInfo);
- bool createNewCoders;
- if (!_bindInfoExPrevIsDefined)
- createNewCoders = true;
- else
- createNewCoders = !AreBindInfoExEqual(bindInfo, _bindInfoExPrev);
- if (createNewCoders)
- {
- int i;
- _decoders.Clear();
- // _decoders2.Clear();
-
- _mixerCoder.Release();
-
- if (_multiThread)
- {
- _mixerCoderMTSpec = new NCoderMixer::CCoderMixer2MT;
- _mixerCoder = _mixerCoderMTSpec;
- _mixerCoderCommon = _mixerCoderMTSpec;
- }
- else
- {
- #ifdef _ST_MODE
- _mixerCoderSTSpec = new NCoderMixer::CCoderMixer2ST;
- _mixerCoder = _mixerCoderSTSpec;
- _mixerCoderCommon = _mixerCoderSTSpec;
- #endif
- }
- RINOK(_mixerCoderCommon->SetBindInfo(bindInfo));
-
- for (i = 0; i < numCoders; i++)
- {
- const CCoderInfo &coderInfo = folderInfo.Coders[i];
-
-
- CMyComPtr<ICompressCoder> decoder;
- CMyComPtr<ICompressCoder2> decoder2;
- RINOK(CreateCoder(
- EXTERNAL_CODECS_LOC_VARS
- coderInfo.MethodID, decoder, decoder2, false));
- CMyComPtr<IUnknown> decoderUnknown;
- if (coderInfo.IsSimpleCoder())
- {
- if (decoder == 0)
- return E_NOTIMPL;
-
- decoderUnknown = (IUnknown *)decoder;
-
- if (_multiThread)
- _mixerCoderMTSpec->AddCoder(decoder);
- #ifdef _ST_MODE
- else
- _mixerCoderSTSpec->AddCoder(decoder, false);
- #endif
- }
- else
- {
- if (decoder2 == 0)
- return E_NOTIMPL;
- decoderUnknown = (IUnknown *)decoder2;
- if (_multiThread)
- _mixerCoderMTSpec->AddCoder2(decoder2);
- #ifdef _ST_MODE
- else
- _mixerCoderSTSpec->AddCoder2(decoder2, false);
- #endif
- }
- _decoders.Add(decoderUnknown);
- #ifdef EXTERNAL_CODECS
- CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
- decoderUnknown.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
- if (setCompressCodecsInfo)
- {
- RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecsInfo));
- }
- #endif
- }
- _bindInfoExPrev = bindInfo;
- _bindInfoExPrevIsDefined = true;
- }
- int i;
- _mixerCoderCommon->ReInit();
-
- UInt32 packStreamIndex = 0, unpackStreamIndex = 0;
- UInt32 coderIndex = 0;
- // UInt32 coder2Index = 0;
-
- for (i = 0; i < numCoders; i++)
- {
- const CCoderInfo &coderInfo = folderInfo.Coders[i];
- CMyComPtr<IUnknown> &decoder = _decoders[coderIndex];
-
- {
- CMyComPtr<ICompressSetDecoderProperties2> setDecoderProperties;
- decoder.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties);
- if (setDecoderProperties)
- {
- const CByteBuffer &props = coderInfo.Props;
- size_t size = props.GetCapacity();
- if (size > 0xFFFFFFFF)
- return E_NOTIMPL;
- if (size > 0)
- {
- RINOK(setDecoderProperties->SetDecoderProperties2((const Byte *)props, (UInt32)size));
- }
- }
- }
-
- #ifdef COMPRESS_MT
- if (mtMode)
- {
- CMyComPtr<ICompressSetCoderMt> setCoderMt;
- decoder.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt);
- if (setCoderMt)
- {
- RINOK(setCoderMt->SetNumberOfThreads(numThreads));
- }
- }
- #endif
-
- #ifndef _NO_CRYPTO
- {
- CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
- decoder.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword);
- if (cryptoSetPassword)
- {
- if (getTextPassword == 0)
- return E_FAIL;
- CMyComBSTR passwordBSTR;
- RINOK(getTextPassword->CryptoGetTextPassword(&passwordBSTR));
- CByteBuffer buffer;
- passwordIsDefined = true;
- const UString password(passwordBSTR);
- const UInt32 sizeInBytes = password.Length() * 2;
- buffer.SetCapacity(sizeInBytes);
- for (int i = 0; i < password.Length(); i++)
- {
- wchar_t c = password[i];
- ((Byte *)buffer)[i * 2] = (Byte)c;
- ((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8);
- }
- RINOK(cryptoSetPassword->CryptoSetPassword((const Byte *)buffer, sizeInBytes));
- }
- }
- #endif
-
- coderIndex++;
-
- UInt32 numInStreams = (UInt32)coderInfo.NumInStreams;
- UInt32 numOutStreams = (UInt32)coderInfo.NumOutStreams;
- CRecordVector<const UInt64 *> packSizesPointers;
- CRecordVector<const UInt64 *> unpackSizesPointers;
- packSizesPointers.Reserve(numInStreams);
- unpackSizesPointers.Reserve(numOutStreams);
- UInt32 j;
- for (j = 0; j < numOutStreams; j++, unpackStreamIndex++)
- unpackSizesPointers.Add(&folderInfo.UnpackSizes[unpackStreamIndex]);
-
- for (j = 0; j < numInStreams; j++, packStreamIndex++)
- {
- int bindPairIndex = folderInfo.FindBindPairForInStream(packStreamIndex);
- if (bindPairIndex >= 0)
- packSizesPointers.Add(
- &folderInfo.UnpackSizes[(UInt32)folderInfo.BindPairs[bindPairIndex].OutIndex]);
- else
- {
- int index = folderInfo.FindPackStreamArrayIndex(packStreamIndex);
- if (index < 0)
- return E_FAIL;
- packSizesPointers.Add(&packSizes[index]);
- }
- }
-
- _mixerCoderCommon->SetCoderInfo(i,
- &packSizesPointers.Front(),
- &unpackSizesPointers.Front());
- }
- UInt32 mainCoder, temp;
- bindInfo.FindOutStream(bindInfo.OutStreams[0], mainCoder, temp);
-
- if (_multiThread)
- _mixerCoderMTSpec->SetProgressCoderIndex(mainCoder);
- /*
- else
- _mixerCoderSTSpec->SetProgressCoderIndex(mainCoder);;
- */
-
- if (numCoders == 0)
- return 0;
- CRecordVector<ISequentialInStream *> inStreamPointers;
- inStreamPointers.Reserve(inStreams.Size());
- for (i = 0; i < inStreams.Size(); i++)
- inStreamPointers.Add(inStreams[i]);
- ISequentialOutStream *outStreamPointer = outStream;
- return _mixerCoder->Code(&inStreamPointers.Front(), NULL,
- inStreams.Size(), &outStreamPointer, NULL, 1, compressProgress);
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zDecode.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zDecode.h
deleted file mode 100644
index 1057a5258..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zDecode.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// 7zDecode.h
-
-#ifndef __7Z_DECODE_H
-#define __7Z_DECODE_H
-
-#include "../../IStream.h"
-#include "../../IPassword.h"
-
-#include "../Common/CoderMixer2.h"
-#include "../Common/CoderMixer2MT.h"
-#ifdef _ST_MODE
-#include "../Common/CoderMixer2ST.h"
-#endif
-
-#include "../../Common/CreateCoder.h"
-
-#include "7zItem.h"
-
-namespace NArchive {
-namespace N7z {
-
-struct CBindInfoEx: public NCoderMixer::CBindInfo
-{
- CRecordVector<CMethodId> CoderMethodIDs;
- void Clear()
- {
- CBindInfo::Clear();
- CoderMethodIDs.Clear();
- }
-};
-
-class CDecoder
-{
- bool _bindInfoExPrevIsDefined;
- CBindInfoEx _bindInfoExPrev;
-
- bool _multiThread;
- #ifdef _ST_MODE
- NCoderMixer::CCoderMixer2ST *_mixerCoderSTSpec;
- #endif
- NCoderMixer::CCoderMixer2MT *_mixerCoderMTSpec;
- NCoderMixer::CCoderMixer2 *_mixerCoderCommon;
-
- CMyComPtr<ICompressCoder2> _mixerCoder;
- CObjectVector<CMyComPtr<IUnknown> > _decoders;
- // CObjectVector<CMyComPtr<ICompressCoder2> > _decoders2;
-public:
- CDecoder(bool multiThread);
- HRESULT Decode(
- DECL_EXTERNAL_CODECS_LOC_VARS
- IInStream *inStream,
- UInt64 startPos,
- const UInt64 *packSizes,
- const CFolder &folder,
- ISequentialOutStream *outStream,
- ICompressProgressInfo *compressProgress
- #ifndef _NO_CRYPTO
- , ICryptoGetTextPassword *getTextPasswordSpec, bool &passwordIsDefined
- #endif
- #ifdef COMPRESS_MT
- , bool mtMode, UInt32 numThreads
- #endif
- );
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zEncode.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zEncode.cpp
deleted file mode 100644
index c97f893be..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zEncode.cpp
+++ /dev/null
@@ -1,453 +0,0 @@
-// 7zEncode.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/CreateCoder.h"
-#include "../../Common/FilterCoder.h"
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/InOutTempBuffer.h"
-#include "../../Common/ProgressUtils.h"
-#include "../../Common/StreamObjects.h"
-
-#include "7zEncode.h"
-#include "7zSpecStream.h"
-
-static const UInt64 k_Delta = 0x03;
-static const UInt64 k_BCJ = 0x03030103;
-static const UInt64 k_BCJ2 = 0x0303011B;
-static const UInt64 k_AES = 0x06F10701;
-
-namespace NArchive {
-namespace N7z {
-
-static void ConvertBindInfoToFolderItemInfo(const NCoderMixer::CBindInfo &bindInfo,
- const CRecordVector<CMethodId> decompressionMethods,
- CFolder &folder)
-{
- folder.Coders.Clear();
- // bindInfo.CoderMethodIDs.Clear();
- // folder.OutStreams.Clear();
- folder.PackStreams.Clear();
- folder.BindPairs.Clear();
- int i;
- for (i = 0; i < bindInfo.BindPairs.Size(); i++)
- {
- CBindPair bindPair;
- bindPair.InIndex = bindInfo.BindPairs[i].InIndex;
- bindPair.OutIndex = bindInfo.BindPairs[i].OutIndex;
- folder.BindPairs.Add(bindPair);
- }
- for (i = 0; i < bindInfo.Coders.Size(); i++)
- {
- CCoderInfo coderInfo;
- const NCoderMixer::CCoderStreamsInfo &coderStreamsInfo = bindInfo.Coders[i];
- coderInfo.NumInStreams = coderStreamsInfo.NumInStreams;
- coderInfo.NumOutStreams = coderStreamsInfo.NumOutStreams;
- coderInfo.MethodID = decompressionMethods[i];
- folder.Coders.Add(coderInfo);
- }
- for (i = 0; i < bindInfo.InStreams.Size(); i++)
- folder.PackStreams.Add(bindInfo.InStreams[i]);
-}
-
-HRESULT CEncoder::CreateMixerCoder(
- DECL_EXTERNAL_CODECS_LOC_VARS
- const UInt64 *inSizeForReduce)
-{
- _mixerCoderSpec = new NCoderMixer::CCoderMixer2MT;
- _mixerCoder = _mixerCoderSpec;
- RINOK(_mixerCoderSpec->SetBindInfo(_bindInfo));
- for (int i = 0; i < _options.Methods.Size(); i++)
- {
- const CMethodFull &methodFull = _options.Methods[i];
- _codersInfo.Add(CCoderInfo());
- CCoderInfo &encodingInfo = _codersInfo.Back();
- encodingInfo.MethodID = methodFull.Id;
- CMyComPtr<ICompressCoder> encoder;
- CMyComPtr<ICompressCoder2> encoder2;
-
-
- RINOK(CreateCoder(
- EXTERNAL_CODECS_LOC_VARS
- methodFull.Id, encoder, encoder2, true));
-
- if (!encoder && !encoder2)
- return E_FAIL;
-
- CMyComPtr<IUnknown> encoderCommon = encoder ? (IUnknown *)encoder : (IUnknown *)encoder2;
-
- #ifdef COMPRESS_MT
- {
- CMyComPtr<ICompressSetCoderMt> setCoderMt;
- encoderCommon.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt);
- if (setCoderMt)
- {
- RINOK(setCoderMt->SetNumberOfThreads(_options.NumThreads));
- }
- }
- #endif
-
-
- RINOK(SetMethodProperties(methodFull, inSizeForReduce, encoderCommon));
-
- /*
- CMyComPtr<ICryptoResetSalt> resetSalt;
- encoderCommon.QueryInterface(IID_ICryptoResetSalt, (void **)&resetSalt);
- if (resetSalt != NULL)
- {
- resetSalt->ResetSalt();
- }
- */
-
- #ifdef EXTERNAL_CODECS
- CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
- encoderCommon.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
- if (setCompressCodecsInfo)
- {
- RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecsInfo));
- }
- #endif
-
- CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
- encoderCommon.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword);
-
- if (cryptoSetPassword)
- {
- CByteBuffer buffer;
- const UInt32 sizeInBytes = _options.Password.Length() * 2;
- buffer.SetCapacity(sizeInBytes);
- for (int i = 0; i < _options.Password.Length(); i++)
- {
- wchar_t c = _options.Password[i];
- ((Byte *)buffer)[i * 2] = (Byte)c;
- ((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8);
- }
- RINOK(cryptoSetPassword->CryptoSetPassword((const Byte *)buffer, sizeInBytes));
- }
-
- if (encoder)
- _mixerCoderSpec->AddCoder(encoder);
- else
- _mixerCoderSpec->AddCoder2(encoder2);
- }
- return S_OK;
-}
-
-HRESULT CEncoder::Encode(
- DECL_EXTERNAL_CODECS_LOC_VARS
- ISequentialInStream *inStream,
- const UInt64 *inStreamSize, const UInt64 *inSizeForReduce,
- CFolder &folderItem,
- ISequentialOutStream *outStream,
- CRecordVector<UInt64> &packSizes,
- ICompressProgressInfo *compressProgress)
-{
- RINOK(EncoderConstr());
-
- if (_mixerCoderSpec == NULL)
- {
- RINOK(CreateMixerCoder(EXTERNAL_CODECS_LOC_VARS inSizeForReduce));
- }
- _mixerCoderSpec->ReInit();
- // _mixerCoderSpec->SetCoderInfo(0, NULL, NULL, progress);
-
- CObjectVector<CInOutTempBuffer> inOutTempBuffers;
- CObjectVector<CSequentialOutTempBufferImp *> tempBufferSpecs;
- CObjectVector<CMyComPtr<ISequentialOutStream> > tempBuffers;
- int numMethods = _bindInfo.Coders.Size();
- int i;
- for (i = 1; i < _bindInfo.OutStreams.Size(); i++)
- {
- inOutTempBuffers.Add(CInOutTempBuffer());
- inOutTempBuffers.Back().Create();
- inOutTempBuffers.Back().InitWriting();
- }
- for (i = 1; i < _bindInfo.OutStreams.Size(); i++)
- {
- CSequentialOutTempBufferImp *tempBufferSpec =
- new CSequentialOutTempBufferImp;
- CMyComPtr<ISequentialOutStream> tempBuffer = tempBufferSpec;
- tempBufferSpec->Init(&inOutTempBuffers[i - 1]);
- tempBuffers.Add(tempBuffer);
- tempBufferSpecs.Add(tempBufferSpec);
- }
-
- for (i = 0; i < numMethods; i++)
- _mixerCoderSpec->SetCoderInfo(i, NULL, NULL);
-
- if (_bindInfo.InStreams.IsEmpty())
- return E_FAIL;
- UInt32 mainCoderIndex, mainStreamIndex;
- _bindInfo.FindInStream(_bindInfo.InStreams[0], mainCoderIndex, mainStreamIndex);
-
- if (inStreamSize != NULL)
- {
- CRecordVector<const UInt64 *> sizePointers;
- for (UInt32 i = 0; i < _bindInfo.Coders[mainCoderIndex].NumInStreams; i++)
- if (i == mainStreamIndex)
- sizePointers.Add(inStreamSize);
- else
- sizePointers.Add(NULL);
- _mixerCoderSpec->SetCoderInfo(mainCoderIndex, &sizePointers.Front(), NULL);
- }
-
-
- // UInt64 outStreamStartPos;
- // RINOK(stream->Seek(0, STREAM_SEEK_CUR, &outStreamStartPos));
-
- CSequentialInStreamSizeCount2 *inStreamSizeCountSpec =
- new CSequentialInStreamSizeCount2;
- CMyComPtr<ISequentialInStream> inStreamSizeCount = inStreamSizeCountSpec;
- CSequentialOutStreamSizeCount *outStreamSizeCountSpec =
- new CSequentialOutStreamSizeCount;
- CMyComPtr<ISequentialOutStream> outStreamSizeCount = outStreamSizeCountSpec;
-
- inStreamSizeCountSpec->Init(inStream);
- outStreamSizeCountSpec->SetStream(outStream);
- outStreamSizeCountSpec->Init();
-
- CRecordVector<ISequentialInStream *> inStreamPointers;
- CRecordVector<ISequentialOutStream *> outStreamPointers;
- inStreamPointers.Add(inStreamSizeCount);
- outStreamPointers.Add(outStreamSizeCount);
- for (i = 1; i < _bindInfo.OutStreams.Size(); i++)
- outStreamPointers.Add(tempBuffers[i - 1]);
-
- for (i = 0; i < _codersInfo.Size(); i++)
- {
- CCoderInfo &encodingInfo = _codersInfo[i];
-
- CMyComPtr<ICryptoResetInitVector> resetInitVector;
- _mixerCoderSpec->_coders[i].QueryInterface(IID_ICryptoResetInitVector, (void **)&resetInitVector);
- if (resetInitVector != NULL)
- {
- resetInitVector->ResetInitVector();
- }
-
- CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
- _mixerCoderSpec->_coders[i].QueryInterface(IID_ICompressWriteCoderProperties, (void **)&writeCoderProperties);
- if (writeCoderProperties != NULL)
- {
- CSequentialOutStreamImp *outStreamSpec = new CSequentialOutStreamImp;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
- outStreamSpec->Init();
- writeCoderProperties->WriteCoderProperties(outStream);
- size_t size = outStreamSpec->GetSize();
- encodingInfo.Props.SetCapacity(size);
- memmove(encodingInfo.Props, outStreamSpec->GetBuffer(), size);
- }
- }
-
- UInt32 progressIndex = mainCoderIndex;
-
- for (i = 0; i + 1 < _codersInfo.Size(); i++)
- {
- UInt64 m = _codersInfo[i].MethodID;
- if (m == k_Delta || m == k_BCJ || m == k_BCJ2)
- progressIndex = i + 1;
- }
-
- _mixerCoderSpec->SetProgressCoderIndex(progressIndex);
-
- RINOK(_mixerCoder->Code(&inStreamPointers.Front(), NULL, 1,
- &outStreamPointers.Front(), NULL, outStreamPointers.Size(), compressProgress));
-
- ConvertBindInfoToFolderItemInfo(_decompressBindInfo, _decompressionMethods,
- folderItem);
-
- packSizes.Add(outStreamSizeCountSpec->GetSize());
-
- for (i = 1; i < _bindInfo.OutStreams.Size(); i++)
- {
- CInOutTempBuffer &inOutTempBuffer = inOutTempBuffers[i - 1];
- inOutTempBuffer.FlushWrite();
- inOutTempBuffer.InitReading();
- inOutTempBuffer.WriteToStream(outStream);
- packSizes.Add(inOutTempBuffer.GetDataSize());
- }
-
- for (i = 0; i < (int)_bindReverseConverter->NumSrcInStreams; i++)
- {
- int binder = _bindInfo.FindBinderForInStream(
- _bindReverseConverter->DestOutToSrcInMap[i]);
- UInt64 streamSize;
- if (binder < 0)
- streamSize = inStreamSizeCountSpec->GetSize();
- else
- streamSize = _mixerCoderSpec->GetWriteProcessedSize(binder);
- folderItem.UnpackSizes.Add(streamSize);
- }
- for (i = numMethods - 1; i >= 0; i--)
- folderItem.Coders[numMethods - 1 - i].Props = _codersInfo[i].Props;
- return S_OK;
-}
-
-
-CEncoder::CEncoder(const CCompressionMethodMode &options):
- _bindReverseConverter(0),
- _constructed(false)
-{
- if (options.IsEmpty())
- throw 1;
-
- _options = options;
- _mixerCoderSpec = NULL;
-}
-
-HRESULT CEncoder::EncoderConstr()
-{
- if (_constructed)
- return S_OK;
- if (_options.Methods.IsEmpty())
- {
- // it has only password method;
- if (!_options.PasswordIsDefined)
- throw 1;
- if (!_options.Binds.IsEmpty())
- throw 1;
- NCoderMixer::CCoderStreamsInfo coderStreamsInfo;
- CMethodFull method;
-
- method.NumInStreams = 1;
- method.NumOutStreams = 1;
- coderStreamsInfo.NumInStreams = 1;
- coderStreamsInfo.NumOutStreams = 1;
- method.Id = k_AES;
-
- _options.Methods.Add(method);
- _bindInfo.Coders.Add(coderStreamsInfo);
-
- _bindInfo.InStreams.Add(0);
- _bindInfo.OutStreams.Add(0);
- }
- else
- {
-
- UInt32 numInStreams = 0, numOutStreams = 0;
- int i;
- for (i = 0; i < _options.Methods.Size(); i++)
- {
- const CMethodFull &methodFull = _options.Methods[i];
- NCoderMixer::CCoderStreamsInfo coderStreamsInfo;
- coderStreamsInfo.NumInStreams = methodFull.NumOutStreams;
- coderStreamsInfo.NumOutStreams = methodFull.NumInStreams;
- if (_options.Binds.IsEmpty())
- {
- if (i < _options.Methods.Size() - 1)
- {
- NCoderMixer::CBindPair bindPair;
- bindPair.InIndex = numInStreams + coderStreamsInfo.NumInStreams;
- bindPair.OutIndex = numOutStreams;
- _bindInfo.BindPairs.Add(bindPair);
- }
- else
- _bindInfo.OutStreams.Insert(0, numOutStreams);
- for (UInt32 j = 1; j < coderStreamsInfo.NumOutStreams; j++)
- _bindInfo.OutStreams.Add(numOutStreams + j);
- }
-
- numInStreams += coderStreamsInfo.NumInStreams;
- numOutStreams += coderStreamsInfo.NumOutStreams;
-
- _bindInfo.Coders.Add(coderStreamsInfo);
- }
-
- if (!_options.Binds.IsEmpty())
- {
- for (i = 0; i < _options.Binds.Size(); i++)
- {
- NCoderMixer::CBindPair bindPair;
- const CBind &bind = _options.Binds[i];
- bindPair.InIndex = _bindInfo.GetCoderInStreamIndex(bind.InCoder) + bind.InStream;
- bindPair.OutIndex = _bindInfo.GetCoderOutStreamIndex(bind.OutCoder) + bind.OutStream;
- _bindInfo.BindPairs.Add(bindPair);
- }
- for (i = 0; i < (int)numOutStreams; i++)
- if (_bindInfo.FindBinderForOutStream(i) == -1)
- _bindInfo.OutStreams.Add(i);
- }
-
- for (i = 0; i < (int)numInStreams; i++)
- if (_bindInfo.FindBinderForInStream(i) == -1)
- _bindInfo.InStreams.Add(i);
-
- if (_bindInfo.InStreams.IsEmpty())
- throw 1; // this is error
-
- // Make main stream first in list
- int inIndex = _bindInfo.InStreams[0];
- for (;;)
- {
- UInt32 coderIndex, coderStreamIndex;
- _bindInfo.FindInStream(inIndex, coderIndex, coderStreamIndex);
- UInt32 outIndex = _bindInfo.GetCoderOutStreamIndex(coderIndex);
- int binder = _bindInfo.FindBinderForOutStream(outIndex);
- if (binder >= 0)
- {
- inIndex = _bindInfo.BindPairs[binder].InIndex;
- continue;
- }
- for (i = 0; i < _bindInfo.OutStreams.Size(); i++)
- if (_bindInfo.OutStreams[i] == outIndex)
- {
- _bindInfo.OutStreams.Delete(i);
- _bindInfo.OutStreams.Insert(0, outIndex);
- break;
- }
- break;
- }
-
- if (_options.PasswordIsDefined)
- {
- int numCryptoStreams = _bindInfo.OutStreams.Size();
-
- for (i = 0; i < numCryptoStreams; i++)
- {
- NCoderMixer::CBindPair bindPair;
- bindPair.InIndex = numInStreams + i;
- bindPair.OutIndex = _bindInfo.OutStreams[i];
- _bindInfo.BindPairs.Add(bindPair);
- }
- _bindInfo.OutStreams.Clear();
-
- /*
- if (numCryptoStreams == 0)
- numCryptoStreams = 1;
- */
-
- for (i = 0; i < numCryptoStreams; i++)
- {
- NCoderMixer::CCoderStreamsInfo coderStreamsInfo;
- CMethodFull method;
- method.NumInStreams = 1;
- method.NumOutStreams = 1;
- coderStreamsInfo.NumInStreams = method.NumOutStreams;
- coderStreamsInfo.NumOutStreams = method.NumInStreams;
- method.Id = k_AES;
-
- _options.Methods.Add(method);
- _bindInfo.Coders.Add(coderStreamsInfo);
- _bindInfo.OutStreams.Add(numOutStreams + i);
- }
- }
-
- }
-
- for (int i = _options.Methods.Size() - 1; i >= 0; i--)
- {
- const CMethodFull &methodFull = _options.Methods[i];
- _decompressionMethods.Add(methodFull.Id);
- }
-
- _bindReverseConverter = new NCoderMixer::CBindReverseConverter(_bindInfo);
- _bindReverseConverter->CreateReverseBindInfo(_decompressBindInfo);
- _constructed = true;
- return S_OK;
-}
-
-CEncoder::~CEncoder()
-{
- delete _bindReverseConverter;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zEncode.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zEncode.h
deleted file mode 100644
index 4909a6e89..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zEncode.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// 7zEncode.h
-
-#ifndef __7Z_ENCODE_H
-#define __7Z_ENCODE_H
-
-// #include "../../Common/StreamObjects.h"
-
-#include "7zCompressionMode.h"
-
-#include "../Common/CoderMixer2.h"
-#include "../Common/CoderMixer2MT.h"
-#ifdef _ST_MODE
-#include "../Common/CoderMixer2ST.h"
-#endif
-#include "7zItem.h"
-
-#include "../../Common/CreateCoder.h"
-
-namespace NArchive {
-namespace N7z {
-
-class CEncoder
-{
- NCoderMixer::CCoderMixer2MT *_mixerCoderSpec;
- CMyComPtr<ICompressCoder2> _mixerCoder;
-
- CObjectVector<CCoderInfo> _codersInfo;
-
- CCompressionMethodMode _options;
- NCoderMixer::CBindInfo _bindInfo;
- NCoderMixer::CBindInfo _decompressBindInfo;
- NCoderMixer::CBindReverseConverter *_bindReverseConverter;
- CRecordVector<CMethodId> _decompressionMethods;
-
- HRESULT CreateMixerCoder(DECL_EXTERNAL_CODECS_LOC_VARS
- const UInt64 *inSizeForReduce);
-
- bool _constructed;
-public:
- CEncoder(const CCompressionMethodMode &options);
- ~CEncoder();
- HRESULT EncoderConstr();
- HRESULT Encode(
- DECL_EXTERNAL_CODECS_LOC_VARS
- ISequentialInStream *inStream,
- const UInt64 *inStreamSize, const UInt64 *inSizeForReduce,
- CFolder &folderItem,
- ISequentialOutStream *outStream,
- CRecordVector<UInt64> &packSizes,
- ICompressProgressInfo *compressProgress);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zExtract.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zExtract.cpp
deleted file mode 100644
index 1e8949ef7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zExtract.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-// 7zExtract.cpp
-
-#include "StdAfx.h"
-
-#include "7zHandler.h"
-#include "7zFolderOutStream.h"
-#include "7zDecode.h"
-// #include "7z1Decode.h"
-
-#include "../../../Common/ComTry.h"
-#include "../../Common/StreamObjects.h"
-#include "../../Common/ProgressUtils.h"
-#include "../../Common/LimitedStreams.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-
-namespace NArchive {
-namespace N7z {
-
-struct CExtractFolderInfo
-{
- #ifdef _7Z_VOL
- int VolumeIndex;
- #endif
- CNum FileIndex;
- CNum FolderIndex;
- CBoolVector ExtractStatuses;
- UInt64 UnpackSize;
- CExtractFolderInfo(
- #ifdef _7Z_VOL
- int volumeIndex,
- #endif
- CNum fileIndex, CNum folderIndex):
- #ifdef _7Z_VOL
- VolumeIndex(volumeIndex),
- #endif
- FileIndex(fileIndex),
- FolderIndex(folderIndex),
- UnpackSize(0)
- {
- if (fileIndex != kNumNoIndex)
- {
- ExtractStatuses.Reserve(1);
- ExtractStatuses.Add(true);
- }
- };
-};
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 testModeSpec, IArchiveExtractCallback *extractCallbackSpec)
-{
- COM_TRY_BEGIN
- bool testMode = (testModeSpec != 0);
- CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
- UInt64 importantTotalUnpacked = 0;
-
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems =
- #ifdef _7Z_VOL
- _refs.Size();
- #else
- _db.Files.Size();
- #endif
-
- if(numItems == 0)
- return S_OK;
-
- /*
- if(_volumes.Size() != 1)
- return E_FAIL;
- const CVolume &volume = _volumes.Front();
- const CArchiveDatabaseEx &_db = volume.Database;
- IInStream *_inStream = volume.Stream;
- */
-
- CObjectVector<CExtractFolderInfo> extractFolderInfoVector;
- for(UInt32 ii = 0; ii < numItems; ii++)
- {
- // UInt32 fileIndex = allFilesMode ? indexIndex : indices[indexIndex];
- UInt32 ref2Index = allFilesMode ? ii : indices[ii];
- // const CRef2 &ref2 = _refs[ref2Index];
-
- // for(UInt32 ri = 0; ri < ref2.Refs.Size(); ri++)
- {
- #ifdef _7Z_VOL
- // const CRef &ref = ref2.Refs[ri];
- const CRef &ref = _refs[ref2Index];
-
- int volumeIndex = ref.VolumeIndex;
- const CVolume &volume = _volumes[volumeIndex];
- const CArchiveDatabaseEx &db = volume.Database;
- UInt32 fileIndex = ref.ItemIndex;
- #else
- const CArchiveDatabaseEx &db = _db;
- UInt32 fileIndex = ref2Index;
- #endif
-
- CNum folderIndex = db.FileIndexToFolderIndexMap[fileIndex];
- if (folderIndex == kNumNoIndex)
- {
- extractFolderInfoVector.Add(CExtractFolderInfo(
- #ifdef _7Z_VOL
- volumeIndex,
- #endif
- fileIndex, kNumNoIndex));
- continue;
- }
- if (extractFolderInfoVector.IsEmpty() ||
- folderIndex != extractFolderInfoVector.Back().FolderIndex
- #ifdef _7Z_VOL
- || volumeIndex != extractFolderInfoVector.Back().VolumeIndex
- #endif
- )
- {
- extractFolderInfoVector.Add(CExtractFolderInfo(
- #ifdef _7Z_VOL
- volumeIndex,
- #endif
- kNumNoIndex, folderIndex));
- const CFolder &folderInfo = db.Folders[folderIndex];
- UInt64 unpackSize = folderInfo.GetUnpackSize();
- importantTotalUnpacked += unpackSize;
- extractFolderInfoVector.Back().UnpackSize = unpackSize;
- }
-
- CExtractFolderInfo &efi = extractFolderInfoVector.Back();
-
- // const CFolderInfo &folderInfo = m_dam_Folders[folderIndex];
- CNum startIndex = db.FolderStartFileIndex[folderIndex];
- for (CNum index = efi.ExtractStatuses.Size();
- index <= fileIndex - startIndex; index++)
- {
- // UInt64 unpackSize = _db.Files[startIndex + index].UnpackSize;
- // Count partial_folder_size
- // efi.UnpackSize += unpackSize;
- // importantTotalUnpacked += unpackSize;
- efi.ExtractStatuses.Add(index == fileIndex - startIndex);
- }
- }
- }
-
- extractCallback->SetTotal(importantTotalUnpacked);
-
- CDecoder decoder(
- #ifdef _ST_MODE
- false
- #else
- true
- #endif
- );
- // CDecoder1 decoder;
-
- UInt64 currentTotalPacked = 0;
- UInt64 currentTotalUnpacked = 0;
- UInt64 totalFolderUnpacked;
- UInt64 totalFolderPacked;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- for(int i = 0; i < extractFolderInfoVector.Size(); i++,
- currentTotalUnpacked += totalFolderUnpacked,
- currentTotalPacked += totalFolderPacked)
- {
- lps->OutSize = currentTotalUnpacked;
- lps->InSize = currentTotalPacked;
- RINOK(lps->SetCur());
-
- const CExtractFolderInfo &efi = extractFolderInfoVector[i];
- totalFolderUnpacked = efi.UnpackSize;
-
- totalFolderPacked = 0;
-
- CFolderOutStream *folderOutStream = new CFolderOutStream;
- CMyComPtr<ISequentialOutStream> outStream(folderOutStream);
-
- #ifdef _7Z_VOL
- const CVolume &volume = _volumes[efi.VolumeIndex];
- const CArchiveDatabaseEx &db = volume.Database;
- #else
- const CArchiveDatabaseEx &db = _db;
- #endif
-
- CNum startIndex;
- if (efi.FileIndex != kNumNoIndex)
- startIndex = efi.FileIndex;
- else
- startIndex = db.FolderStartFileIndex[efi.FolderIndex];
-
-
- HRESULT result = folderOutStream->Init(&db,
- #ifdef _7Z_VOL
- volume.StartRef2Index,
- #else
- 0,
- #endif
- startIndex,
- &efi.ExtractStatuses, extractCallback, testMode, _crcSize != 0);
-
- RINOK(result);
-
- if (efi.FileIndex != kNumNoIndex)
- continue;
-
- CNum folderIndex = efi.FolderIndex;
- const CFolder &folderInfo = db.Folders[folderIndex];
-
- totalFolderPacked = _db.GetFolderFullPackSize(folderIndex);
-
- CNum packStreamIndex = db.FolderStartPackStreamIndex[folderIndex];
- UInt64 folderStartPackPos = db.GetFolderStreamPos(folderIndex, 0);
-
- #ifndef _NO_CRYPTO
- CMyComPtr<ICryptoGetTextPassword> getTextPassword;
- if (extractCallback)
- extractCallback.QueryInterface(IID_ICryptoGetTextPassword, &getTextPassword);
- #endif
-
- try
- {
- #ifndef _NO_CRYPTO
- bool passwordIsDefined;
- #endif
-
- HRESULT result = decoder.Decode(
- EXTERNAL_CODECS_VARS
- #ifdef _7Z_VOL
- volume.Stream,
- #else
- _inStream,
- #endif
- folderStartPackPos,
- &db.PackSizes[packStreamIndex],
- folderInfo,
- outStream,
- progress
- #ifndef _NO_CRYPTO
- , getTextPassword, passwordIsDefined
- #endif
- #ifdef COMPRESS_MT
- , true, _numThreads
- #endif
- );
-
- if (result == S_FALSE)
- {
- RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError));
- continue;
- }
- if (result == E_NOTIMPL)
- {
- RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
- continue;
- }
- if (result != S_OK)
- return result;
- if (folderOutStream->WasWritingFinished() != S_OK)
- {
- RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError));
- continue;
- }
- }
- catch(...)
- {
- RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError));
- continue;
- }
- }
- return S_OK;
- COM_TRY_END
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderInStream.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderInStream.cpp
deleted file mode 100644
index 6dcce665b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderInStream.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-// 7zFolderInStream.cpp
-
-#include "StdAfx.h"
-
-#include "7zFolderInStream.h"
-
-namespace NArchive {
-namespace N7z {
-
-CFolderInStream::CFolderInStream()
-{
- _inStreamWithHashSpec = new CSequentialInStreamWithCRC;
- _inStreamWithHash = _inStreamWithHashSpec;
-}
-
-void CFolderInStream::Init(IArchiveUpdateCallback *updateCallback,
- const UInt32 *fileIndices, UInt32 numFiles)
-{
- _updateCallback = updateCallback;
- _numFiles = numFiles;
- _fileIndex = 0;
- _fileIndices = fileIndices;
- Processed.Clear();
- CRCs.Clear();
- Sizes.Clear();
- _fileIsOpen = false;
- _currentSizeIsDefined = false;
-}
-
-HRESULT CFolderInStream::OpenStream()
-{
- _filePos = 0;
- while (_fileIndex < _numFiles)
- {
- _currentSizeIsDefined = false;
- CMyComPtr<ISequentialInStream> stream;
- HRESULT result = _updateCallback->GetStream(_fileIndices[_fileIndex], &stream);
- if (result != S_OK && result != S_FALSE)
- return result;
- _fileIndex++;
- _inStreamWithHashSpec->SetStream(stream);
- _inStreamWithHashSpec->Init();
- if (!stream)
- {
- RINOK(_updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
- Sizes.Add(0);
- Processed.Add(result == S_OK);
- AddDigest();
- continue;
- }
- CMyComPtr<IStreamGetSize> streamGetSize;
- if (stream.QueryInterface(IID_IStreamGetSize, &streamGetSize) == S_OK)
- {
- if(streamGetSize)
- {
- _currentSizeIsDefined = true;
- RINOK(streamGetSize->GetSize(&_currentSize));
- }
- }
-
- _fileIsOpen = true;
- return S_OK;
- }
- return S_OK;
-}
-
-void CFolderInStream::AddDigest()
-{
- CRCs.Add(_inStreamWithHashSpec->GetCRC());
-}
-
-HRESULT CFolderInStream::CloseStream()
-{
- RINOK(_updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
- _inStreamWithHashSpec->ReleaseStream();
- _fileIsOpen = false;
- Processed.Add(true);
- Sizes.Add(_filePos);
- AddDigest();
- return S_OK;
-}
-
-STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize = 0;
- while ((_fileIndex < _numFiles || _fileIsOpen) && size > 0)
- {
- if (_fileIsOpen)
- {
- UInt32 localProcessedSize;
- RINOK(_inStreamWithHash->Read(
- ((Byte *)data) + realProcessedSize, size, &localProcessedSize));
- if (localProcessedSize == 0)
- {
- RINOK(CloseStream());
- continue;
- }
- realProcessedSize += localProcessedSize;
- _filePos += localProcessedSize;
- size -= localProcessedSize;
- break;
- }
- else
- {
- RINOK(OpenStream());
- }
- }
- if (processedSize != 0)
- *processedSize = realProcessedSize;
- return S_OK;
-}
-
-STDMETHODIMP CFolderInStream::GetSubStreamSize(UInt64 subStream, UInt64 *value)
-{
- *value = 0;
- int subStreamIndex = (int)subStream;
- if (subStreamIndex < 0 || static_cast< Int64 >( subStream ) > Sizes.Size())
- return E_FAIL;
- if (subStreamIndex < Sizes.Size())
- {
- *value= Sizes[subStreamIndex];
- return S_OK;
- }
- if (!_currentSizeIsDefined)
- return S_FALSE;
- *value = _currentSize;
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderInStream.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderInStream.h
deleted file mode 100644
index 68e2b27ba..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderInStream.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// 7z/FolderInStream.h
-
-#ifndef __7Z_FOLDERINSTREAM_H
-#define __7Z_FOLDERINSTREAM_H
-
-#include "7zItem.h"
-#include "7zHeader.h"
-
-#include "../IArchive.h"
-#include "../Common/InStreamWithCRC.h"
-#include "../../IStream.h"
-#include "../../ICoder.h"
-
-namespace NArchive {
-namespace N7z {
-
-class CFolderInStream:
- public ISequentialInStream,
- public ICompressGetSubStreamSize,
- public CMyUnknownImp
-{
-public:
-
- MY_UNKNOWN_IMP1(ICompressGetSubStreamSize)
-
- CFolderInStream();
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-
- STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value);
-private:
- CSequentialInStreamWithCRC *_inStreamWithHashSpec;
- CMyComPtr<ISequentialInStream> _inStreamWithHash;
- CMyComPtr<IArchiveUpdateCallback> _updateCallback;
-
- bool _currentSizeIsDefined;
- UInt64 _currentSize;
-
- bool _fileIsOpen;
- UInt64 _filePos;
-
- const UInt32 *_fileIndices;
- UInt32 _numFiles;
- UInt32 _fileIndex;
-
- HRESULT OpenStream();
- HRESULT CloseStream();
- void AddDigest();
-public:
- void Init(IArchiveUpdateCallback *updateCallback,
- const UInt32 *fileIndices, UInt32 numFiles);
- CRecordVector<bool> Processed;
- CRecordVector<UInt32> CRCs;
- CRecordVector<UInt64> Sizes;
- UInt64 GetFullSize() const
- {
- UInt64 size = 0;
- for (int i = 0; i < Sizes.Size(); i++)
- size += Sizes[i];
- return size;
- }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.cpp
deleted file mode 100644
index 755058638..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-// 7zFolderOutStream.cpp
-
-#include "StdAfx.h"
-
-#include "7zFolderOutStream.h"
-
-namespace NArchive {
-namespace N7z {
-
-CFolderOutStream::CFolderOutStream()
-{
- _crcStreamSpec = new COutStreamWithCRC;
- _crcStream = _crcStreamSpec;
-}
-
-HRESULT CFolderOutStream::Init(
- const CArchiveDatabaseEx *archiveDatabase,
- UInt32 ref2Offset, UInt32 startIndex,
- const CBoolVector *extractStatuses,
- IArchiveExtractCallback *extractCallback,
- bool testMode, bool checkCrc)
-{
- _db = archiveDatabase;
- _ref2Offset = ref2Offset;
- _startIndex = startIndex;
-
- _extractStatuses = extractStatuses;
- _extractCallback = extractCallback;
- _testMode = testMode;
- _checkCrc = checkCrc;
-
- _currentIndex = 0;
- _fileIsOpen = false;
- return ProcessEmptyFiles();
-}
-
-HRESULT CFolderOutStream::OpenFile()
-{
- Int32 askMode = ((*_extractStatuses)[_currentIndex]) ? (_testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract):
- NArchive::NExtract::NAskMode::kSkip;
- CMyComPtr<ISequentialOutStream> realOutStream;
- UInt32 index = _startIndex + _currentIndex;
- RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode));
- _crcStreamSpec->SetStream(realOutStream);
- _crcStreamSpec->Init(_checkCrc);
- _fileIsOpen = true;
- const CFileItem &fi = _db->Files[index];
- _rem = fi.Size;
- if (askMode == NArchive::NExtract::NAskMode::kExtract && !realOutStream &&
- !_db->IsItemAnti(index) && !fi.IsDir)
- askMode = NArchive::NExtract::NAskMode::kSkip;
- return _extractCallback->PrepareOperation(askMode);
-}
-
-HRESULT CFolderOutStream::CloseFileAndSetResult(Int32 res)
-{
- _crcStreamSpec->ReleaseStream();
- _fileIsOpen = false;
- _currentIndex++;
- return _extractCallback->SetOperationResult(res);
-}
-
-HRESULT CFolderOutStream::CloseFileAndSetResult()
-{
- const CFileItem &fi = _db->Files[_startIndex + _currentIndex];
- return CloseFileAndSetResult(
- (fi.IsDir || !fi.CrcDefined || !_checkCrc || fi.Crc == _crcStreamSpec->GetCRC()) ?
- NArchive::NExtract::NOperationResult::kOK :
- NArchive::NExtract::NOperationResult::kCRCError);
-}
-
-HRESULT CFolderOutStream::ProcessEmptyFiles()
-{
- while (_currentIndex < _extractStatuses->Size() && _db->Files[_startIndex + _currentIndex].Size == 0)
- {
- RINOK(OpenFile());
- RINOK(CloseFileAndSetResult());
- }
- return S_OK;
-}
-
-STDMETHODIMP CFolderOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != NULL)
- *processedSize = 0;
- while (size != 0)
- {
- if (_fileIsOpen)
- {
- UInt32 cur = size < _rem ? size : (UInt32)_rem;
- RINOK(_crcStream->Write(data, cur, &cur));
- if (cur == 0)
- break;
- data = (const Byte *)data + cur;
- size -= cur;
- _rem -= cur;
- if (processedSize != NULL)
- *processedSize += cur;
- if (_rem == 0)
- {
- RINOK(CloseFileAndSetResult());
- RINOK(ProcessEmptyFiles());
- continue;
- }
- }
- else
- {
- RINOK(ProcessEmptyFiles());
- if (_currentIndex == _extractStatuses->Size())
- {
- // we support partial extracting
- if (processedSize != NULL)
- *processedSize += size;
- break;
- }
- RINOK(OpenFile());
- }
- }
- return S_OK;
-}
-
-HRESULT CFolderOutStream::FlushCorrupted(Int32 resultEOperationResult)
-{
- while (_currentIndex < _extractStatuses->Size())
- {
- if (_fileIsOpen)
- {
- RINOK(CloseFileAndSetResult(resultEOperationResult));
- }
- else
- {
- RINOK(OpenFile());
- }
- }
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.h
deleted file mode 100644
index e6e05b85c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zFolderOutStream.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// 7zFolderOutStream.h
-
-#ifndef __7Z_FOLDER_OUT_STREAM_H
-#define __7Z_FOLDER_OUT_STREAM_H
-
-#include "7zIn.h"
-
-#include "../../IStream.h"
-#include "../IArchive.h"
-#include "../Common/OutStreamWithCRC.h"
-
-namespace NArchive {
-namespace N7z {
-
-class CFolderOutStream:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- COutStreamWithCRC *_crcStreamSpec;
- CMyComPtr<ISequentialOutStream> _crcStream;
- const CArchiveDatabaseEx *_db;
- const CBoolVector *_extractStatuses;
- CMyComPtr<IArchiveExtractCallback> _extractCallback;
- UInt32 _ref2Offset;
- UInt32 _startIndex;
- int _currentIndex;
- bool _testMode;
- bool _checkCrc;
- bool _fileIsOpen;
- UInt64 _rem;
-
- HRESULT OpenFile();
- HRESULT CloseFileAndSetResult(Int32 res);
- HRESULT CloseFileAndSetResult();
- HRESULT ProcessEmptyFiles();
-public:
- MY_UNKNOWN_IMP
-
- CFolderOutStream();
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-
- HRESULT Init(
- const CArchiveDatabaseEx *archiveDatabase,
- UInt32 ref2Offset, UInt32 startIndex,
- const CBoolVector *extractStatuses,
- IArchiveExtractCallback *extractCallback,
- bool testMode, bool checkCrc);
- HRESULT FlushCorrupted(Int32 resultEOperationResult);
- HRESULT WasWritingFinished() const
- { return (_currentIndex == _extractStatuses->Size()) ? S_OK: E_FAIL; }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHandler.cpp
deleted file mode 100644
index 2eeb93052..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHandler.cpp
+++ /dev/null
@@ -1,497 +0,0 @@
-// 7zHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/CpuArch.h"
-
-#include "../../../Common/ComTry.h"
-#include "../../../Common/IntToString.h"
-
-#ifdef COMPRESS_MT
-#include "../../../Windows/System.h"
-#endif
-
-#include "../Common/ItemNameUtils.h"
-
-#include "7zHandler.h"
-#include "7zProperties.h"
-
-#ifdef __7Z_SET_PROPERTIES
-#ifdef EXTRACT_ONLY
-#include "../Common/ParseProperties.h"
-#endif
-#endif
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-extern UString ConvertMethodIdToString(UInt64 id);
-
-namespace NArchive {
-namespace N7z {
-
-CHandler::CHandler()
-{
- _crcSize = 4;
-
- #ifndef _NO_CRYPTO
- _passwordIsDefined = false;
- #endif
-
- #ifdef EXTRACT_ONLY
- #ifdef COMPRESS_MT
- _numThreads = NSystem::GetNumberOfProcessors();
- #endif
- #else
- Init();
- #endif
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _db.Files.Size();
- return S_OK;
-}
-
-#ifdef _SFX
-
-IMP_IInArchive_ArcProps_NO
-
-STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 * /* numProperties */)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP CHandler::GetPropertyInfo(UInt32 /* index */,
- BSTR * /* name */, PROPID * /* propID */, VARTYPE * /* varType */)
-{
- return E_NOTIMPL;
-}
-
-
-#else
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidSolid, VT_BOOL},
- { NULL, kpidNumBlocks, VT_UI4},
- { NULL, kpidPhySize, VT_UI8},
- { NULL, kpidHeadersSize, VT_UI8},
- { NULL, kpidOffset, VT_UI8}
-};
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidMethod:
- {
- UString resString;
- CRecordVector<UInt64> ids;
- int i;
- for (i = 0; i < _db.Folders.Size(); i++)
- {
- const CFolder &f = _db.Folders[i];
- for (int j = f.Coders.Size() - 1; j >= 0; j--)
- ids.AddToUniqueSorted(f.Coders[j].MethodID);
- }
-
- for (i = 0; i < ids.Size(); i++)
- {
- UInt64 id = ids[i];
- UString methodName;
- /* bool methodIsKnown = */ FindMethod(EXTERNAL_CODECS_VARS id, methodName);
- if (methodName.IsEmpty())
- methodName = ConvertMethodIdToString(id);
- if (!resString.IsEmpty())
- resString += L' ';
- resString += methodName;
- }
- prop = resString;
- break;
- }
- case kpidSolid: prop = _db.IsSolid(); break;
- case kpidNumBlocks: prop = (UInt32)_db.Folders.Size(); break;
- case kpidHeadersSize: prop = _db.HeadersSize; break;
- case kpidPhySize: prop = _db.PhySize; break;
- case kpidOffset: if (_db.ArchiveInfo.StartPosition != 0) prop = _db.ArchiveInfo.StartPosition; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-IMP_IInArchive_ArcProps
-
-#endif
-
-static void SetPropFromUInt64Def(CUInt64DefVector &v, int index, NCOM::CPropVariant &prop)
-{
- UInt64 value;
- if (v.GetItem(index, value))
- {
- FILETIME ft;
- ft.dwLowDateTime = (DWORD)value;
- ft.dwHighDateTime = (DWORD)(value >> 32);
- prop = ft;
- }
-}
-
-#ifndef _SFX
-
-static UString ConvertUInt32ToString(UInt32 value)
-{
- wchar_t buffer[32];
- ConvertUInt64ToString(value, buffer);
- return buffer;
-}
-
-static UString GetStringForSizeValue(UInt32 value)
-{
- for (int i = 31; i >= 0; i--)
- if ((UInt32(1) << i) == value)
- return ConvertUInt32ToString(i);
- UString result;
- if (value % (1 << 20) == 0)
- {
- result += ConvertUInt32ToString(value >> 20);
- result += L"m";
- }
- else if (value % (1 << 10) == 0)
- {
- result += ConvertUInt32ToString(value >> 10);
- result += L"k";
- }
- else
- {
- result += ConvertUInt32ToString(value);
- result += L"b";
- }
- return result;
-}
-
-static const UInt64 k_Copy = 0x0;
-static const UInt64 k_Delta = 3;
-static const UInt64 k_LZMA2 = 0x21;
-static const UInt64 k_LZMA = 0x030101;
-static const UInt64 k_PPMD = 0x030401;
-
-static wchar_t GetHex(Byte value)
-{
- return (wchar_t)((value < 10) ? (L'0' + value) : (L'A' + (value - 10)));
-}
-static inline void AddHexToString(UString &res, Byte value)
-{
- res += GetHex((Byte)(value >> 4));
- res += GetHex((Byte)(value & 0xF));
-}
-
-#endif
-
-static const UInt64 k_AES = 0x06F10701;
-
-bool CHandler::IsEncrypted(UInt32 index2) const
-{
- CNum folderIndex = _db.FileIndexToFolderIndexMap[index2];
- if (folderIndex != kNumNoIndex)
- {
- const CFolder &folderInfo = _db.Folders[folderIndex];
- for (int i = folderInfo.Coders.Size() - 1; i >= 0; i--)
- if (folderInfo.Coders[i].MethodID == k_AES)
- return true;
- }
- return false;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NCOM::CPropVariant prop;
-
- /*
- const CRef2 &ref2 = _refs[index];
- if (ref2.Refs.IsEmpty())
- return E_FAIL;
- const CRef &ref = ref2.Refs.Front();
- */
-
- const CFileItem &item = _db.Files[index];
- UInt32 index2 = index;
-
- switch(propID)
- {
- case kpidPath:
- if (!item.Name.IsEmpty())
- prop = NItemName::GetOSName(item.Name);
- break;
- case kpidIsDir: prop = item.IsDir; break;
- case kpidSize:
- {
- prop = item.Size;
- // prop = ref2.Size;
- break;
- }
- case kpidPackSize:
- {
- // prop = ref2.PackSize;
- {
- CNum folderIndex = _db.FileIndexToFolderIndexMap[index2];
- if (folderIndex != kNumNoIndex)
- {
- if (_db.FolderStartFileIndex[folderIndex] == (CNum)index2)
- prop = _db.GetFolderFullPackSize(folderIndex);
- /*
- else
- prop = (UInt64)0;
- */
- }
- else
- prop = (UInt64)0;
- }
- break;
- }
- case kpidPosition: { UInt64 v; if (_db.StartPos.GetItem(index2, v)) prop = v; break; }
- case kpidCTime: SetPropFromUInt64Def(_db.CTime, index2, prop); break;
- case kpidATime: SetPropFromUInt64Def(_db.ATime, index2, prop); break;
- case kpidMTime: SetPropFromUInt64Def(_db.MTime, index2, prop); break;
- case kpidAttrib: if (item.AttribDefined) prop = item.Attrib; break;
- case kpidCRC: if (item.CrcDefined) prop = item.Crc; break;
- case kpidEncrypted: prop = IsEncrypted(index2); break;
- case kpidIsAnti: prop = _db.IsItemAnti(index2); break;
- #ifndef _SFX
- case kpidMethod:
- {
- CNum folderIndex = _db.FileIndexToFolderIndexMap[index2];
- if (folderIndex != kNumNoIndex)
- {
- const CFolder &folderInfo = _db.Folders[folderIndex];
- UString methodsString;
- for (int i = folderInfo.Coders.Size() - 1; i >= 0; i--)
- {
- const CCoderInfo &coder = folderInfo.Coders[i];
- if (!methodsString.IsEmpty())
- methodsString += L' ';
-
- UString methodName, propsString;
- bool methodIsKnown = FindMethod(
- EXTERNAL_CODECS_VARS
- coder.MethodID, methodName);
-
- if (!methodIsKnown)
- methodsString += ConvertMethodIdToString(coder.MethodID);
- else
- {
- methodsString += methodName;
- if (coder.MethodID == k_Delta && coder.Props.GetCapacity() == 1)
- propsString = ConvertUInt32ToString((UInt32)coder.Props[0] + 1);
- else if (coder.MethodID == k_LZMA && coder.Props.GetCapacity() == 5)
- {
- UInt32 dicSize = GetUi32((const Byte *)coder.Props + 1);
- propsString = GetStringForSizeValue(dicSize);
- }
- else if (coder.MethodID == k_LZMA2 && coder.Props.GetCapacity() == 1)
- {
- Byte p = coder.Props[0];
- UInt32 dicSize = (((UInt32)2 | ((p) & 1)) << ((p) / 2 + 11));
- propsString = GetStringForSizeValue(dicSize);
- }
- else if (coder.MethodID == k_PPMD && coder.Props.GetCapacity() == 5)
- {
- Byte order = *(const Byte *)coder.Props;
- methodsString += L'o';
- methodsString += ConvertUInt32ToString(order);
- methodsString += L":mem";
- UInt32 dicSize = GetUi32((const Byte *)coder.Props + 1);
- propsString = GetStringForSizeValue(dicSize);
- }
- else if (coder.MethodID == k_AES && coder.Props.GetCapacity() >= 1)
- {
- const Byte *data = (const Byte *)coder.Props;
- Byte firstByte = *data++;
- UInt32 numCyclesPower = firstByte & 0x3F;
- propsString = ConvertUInt32ToString(numCyclesPower);
- /*
- if ((firstByte & 0xC0) != 0)
- {
- UInt32 saltSize = (firstByte >> 7) & 1;
- UInt32 ivSize = (firstByte >> 6) & 1;
- if (coder.Props.GetCapacity() >= 2)
- {
- Byte secondByte = *data++;
- saltSize += (secondByte >> 4);
- ivSize += (secondByte & 0x0F);
- }
- }
- */
- }
- }
- if (!propsString.IsEmpty())
- {
- methodsString += L':';
- methodsString += propsString;
- }
- else if (coder.Props.GetCapacity() > 0)
- {
- methodsString += L":[";
- for (size_t bi = 0; bi < coder.Props.GetCapacity(); bi++)
- {
- if (bi > 5 && bi + 1 < coder.Props.GetCapacity())
- {
- methodsString += L"..";
- break;
- }
- else
- AddHexToString(methodsString, coder.Props[bi]);
- }
- methodsString += L']';
- }
- }
- prop = methodsString;
- }
- }
- break;
- case kpidBlock:
- {
- CNum folderIndex = _db.FileIndexToFolderIndexMap[index2];
- if (folderIndex != kNumNoIndex)
- prop = (UInt32)folderIndex;
- }
- break;
- case kpidPackedSize0:
- case kpidPackedSize1:
- case kpidPackedSize2:
- case kpidPackedSize3:
- case kpidPackedSize4:
- {
- CNum folderIndex = _db.FileIndexToFolderIndexMap[index2];
- if (folderIndex != kNumNoIndex)
- {
- const CFolder &folderInfo = _db.Folders[folderIndex];
- if (_db.FolderStartFileIndex[folderIndex] == (CNum)index2 &&
- folderInfo.PackStreams.Size() > (int)(propID - kpidPackedSize0))
- {
- prop = _db.GetFolderPackStreamSize(folderIndex, propID - kpidPackedSize0);
- }
- else
- prop = (UInt64)0;
- }
- else
- prop = (UInt64)0;
- }
- break;
- #endif
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 *maxCheckStartPosition,
- IArchiveOpenCallback *openArchiveCallback)
-{
- COM_TRY_BEGIN
- Close();
- #ifndef _SFX
- _fileInfoPopIDs.Clear();
- #endif
- try
- {
- CMyComPtr<IArchiveOpenCallback> openArchiveCallbackTemp = openArchiveCallback;
-
- #ifndef _NO_CRYPTO
- CMyComPtr<ICryptoGetTextPassword> getTextPassword;
- if (openArchiveCallback)
- {
- openArchiveCallbackTemp.QueryInterface(
- IID_ICryptoGetTextPassword, &getTextPassword);
- }
- #endif
- CInArchive archive;
- RINOK(archive.Open(stream, maxCheckStartPosition));
- #ifndef _NO_CRYPTO
- _passwordIsDefined = false;
- UString password;
- #endif
- HRESULT result = archive.ReadDatabase(
- EXTERNAL_CODECS_VARS
- _db
- #ifndef _NO_CRYPTO
- , getTextPassword, _passwordIsDefined
- #endif
- );
- RINOK(result);
- _db.Fill();
- _inStream = stream;
- }
- catch(...)
- {
- Close();
- return S_FALSE;
- }
- // _inStream = stream;
- #ifndef _SFX
- FillPopIDs();
- #endif
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- COM_TRY_BEGIN
- _inStream.Release();
- _db.Clear();
- return S_OK;
- COM_TRY_END
-}
-
-#ifdef __7Z_SET_PROPERTIES
-#ifdef EXTRACT_ONLY
-
-STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties)
-{
- COM_TRY_BEGIN
- #ifdef COMPRESS_MT
- const UInt32 numProcessors = NSystem::GetNumberOfProcessors();
- _numThreads = numProcessors;
- #endif
-
- for (int i = 0; i < numProperties; i++)
- {
- UString name = names[i];
- name.MakeUpper();
- if (name.IsEmpty())
- return E_INVALIDARG;
- const PROPVARIANT &value = values[i];
- UInt32 number;
- int index = ParseStringToUInt32(name, number);
- if (index == 0)
- {
- if(name.Left(2).CompareNoCase(L"MT") == 0)
- {
- #ifdef COMPRESS_MT
- RINOK(ParseMtProp(name.Mid(2), value, numProcessors, _numThreads));
- #endif
- continue;
- }
- else
- return E_INVALIDARG;
- }
- }
- return S_OK;
- COM_TRY_END
-}
-
-#endif
-#endif
-
-IMPL_ISetCompressCodecsInfo
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHandler.h
deleted file mode 100644
index 68fb034f4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHandler.h
+++ /dev/null
@@ -1,119 +0,0 @@
-// 7z/Handler.h
-
-#ifndef __7Z_HANDLER_H
-#define __7Z_HANDLER_H
-
-#include "../../ICoder.h"
-#include "../IArchive.h"
-
-#include "../../Common/CreateCoder.h"
-
-#ifndef EXTRACT_ONLY
-#include "../Common/HandlerOut.h"
-#endif
-
-#include "7zCompressionMode.h"
-#include "7zIn.h"
-
-namespace NArchive {
-namespace N7z {
-
-#ifndef __7Z_SET_PROPERTIES
-
-#ifdef EXTRACT_ONLY
-#ifdef COMPRESS_MT
-#define __7Z_SET_PROPERTIES
-#endif
-#else
-#define __7Z_SET_PROPERTIES
-#endif
-
-#endif
-
-
-class CHandler:
- #ifndef EXTRACT_ONLY
- public NArchive::COutHandler,
- #endif
- public IInArchive,
- #ifdef __7Z_SET_PROPERTIES
- public ISetProperties,
- #endif
- #ifndef EXTRACT_ONLY
- public IOutArchive,
- #endif
- PUBLIC_ISetCompressCodecsInfo
- public CMyUnknownImp
-{
-public:
- MY_QUERYINTERFACE_BEGIN2(IInArchive)
- #ifdef __7Z_SET_PROPERTIES
- MY_QUERYINTERFACE_ENTRY(ISetProperties)
- #endif
- #ifndef EXTRACT_ONLY
- MY_QUERYINTERFACE_ENTRY(IOutArchive)
- #endif
- QUERY_ENTRY_ISetCompressCodecsInfo
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
- INTERFACE_IInArchive(;)
-
- #ifdef __7Z_SET_PROPERTIES
- STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties);
- #endif
-
- #ifndef EXTRACT_ONLY
- INTERFACE_IOutArchive(;)
- #endif
-
- DECL_ISetCompressCodecsInfo
-
- CHandler();
-
-private:
- CMyComPtr<IInStream> _inStream;
- NArchive::N7z::CArchiveDatabaseEx _db;
- #ifndef _NO_CRYPTO
- bool _passwordIsDefined;
- #endif
-
- #ifdef EXTRACT_ONLY
-
- #ifdef COMPRESS_MT
- UInt32 _numThreads;
- #endif
-
- UInt32 _crcSize;
-
- #else
-
- CRecordVector<CBind> _binds;
-
- HRESULT SetCompressionMethod(CCompressionMethodMode &method,
- CObjectVector<COneMethodInfo> &methodsInfo
- #ifdef COMPRESS_MT
- , UInt32 numThreads
- #endif
- );
-
- HRESULT SetCompressionMethod(
- CCompressionMethodMode &method,
- CCompressionMethodMode &headerMethod);
-
- #endif
-
- bool IsEncrypted(UInt32 index2) const;
- #ifndef _SFX
-
- CRecordVector<UInt64> _fileInfoPopIDs;
- void FillPopIDs();
-
- #endif
-
- DECL_EXTERNAL_CODECS_VARS
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHandlerOut.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHandlerOut.cpp
deleted file mode 100644
index 3c717116a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHandlerOut.cpp
+++ /dev/null
@@ -1,481 +0,0 @@
-// 7zHandlerOut.cpp
-
-#include "StdAfx.h"
-
-#include "../../../Windows/PropVariant.h"
-
-#include "../../../Common/ComTry.h"
-#include "../../../Common/StringToInt.h"
-
-#include "../../ICoder.h"
-
-#include "../Common/ItemNameUtils.h"
-#include "../Common/ParseProperties.h"
-
-#include "7zHandler.h"
-#include "7zOut.h"
-#include "7zUpdate.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace N7z {
-
-static const wchar_t *kLZMAMethodName = L"LZMA";
-static const wchar_t *kCopyMethod = L"Copy";
-static const wchar_t *kDefaultMethodName = kLZMAMethodName;
-
-static const UInt32 kLzmaAlgorithmX5 = 1;
-static const wchar_t *kLzmaMatchFinderForHeaders = L"BT2";
-static const UInt32 kDictionaryForHeaders = 1 << 20;
-static const UInt32 kNumFastBytesForHeaders = 273;
-static const UInt32 kAlgorithmForHeaders = kLzmaAlgorithmX5;
-
-static inline bool IsCopyMethod(const UString &methodName)
- { return (methodName.CompareNoCase(kCopyMethod) == 0); }
-
-STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type)
-{
- *type = NFileTimeType::kWindows;
- return S_OK;
-}
-
-HRESULT CHandler::SetCompressionMethod(
- CCompressionMethodMode &methodMode,
- CCompressionMethodMode &headerMethod)
-{
- HRESULT res = SetCompressionMethod(methodMode, _methods
- #ifdef COMPRESS_MT
- , _numThreads
- #endif
- );
- RINOK(res);
- methodMode.Binds = _binds;
-
- if (_compressHeaders)
- {
- // headerMethod.Methods.Add(methodMode.Methods.Back());
-
- CObjectVector<COneMethodInfo> headerMethodInfoVector;
- COneMethodInfo oneMethodInfo;
- oneMethodInfo.MethodName = kLZMAMethodName;
- {
- CProp prop;
- prop.Id = NCoderPropID::kMatchFinder;
- prop.Value = kLzmaMatchFinderForHeaders;
- oneMethodInfo.Props.Add(prop);
- }
- {
- CProp prop;
- prop.Id = NCoderPropID::kAlgorithm;
- prop.Value = kAlgorithmForHeaders;
- oneMethodInfo.Props.Add(prop);
- }
- {
- CProp prop;
- prop.Id = NCoderPropID::kNumFastBytes;
- prop.Value = (UInt32)kNumFastBytesForHeaders;
- oneMethodInfo.Props.Add(prop);
- }
- {
- CProp prop;
- prop.Id = NCoderPropID::kDictionarySize;
- prop.Value = (UInt32)kDictionaryForHeaders;
- oneMethodInfo.Props.Add(prop);
- }
- headerMethodInfoVector.Add(oneMethodInfo);
- HRESULT res = SetCompressionMethod(headerMethod, headerMethodInfoVector
- #ifdef COMPRESS_MT
- ,1
- #endif
- );
- RINOK(res);
- }
- return S_OK;
-}
-
-HRESULT CHandler::SetCompressionMethod(
- CCompressionMethodMode &methodMode,
- CObjectVector<COneMethodInfo> &methodsInfo
- #ifdef COMPRESS_MT
- , UInt32 numThreads
- #endif
- )
-{
- UInt32 level = _level;
-
- if (methodsInfo.IsEmpty())
- {
- COneMethodInfo oneMethodInfo;
- oneMethodInfo.MethodName = ((level == 0) ? kCopyMethod : kDefaultMethodName);
- methodsInfo.Add(oneMethodInfo);
- }
-
- bool needSolid = false;
- for(int i = 0; i < methodsInfo.Size(); i++)
- {
- COneMethodInfo &oneMethodInfo = methodsInfo[i];
- SetCompressionMethod2(oneMethodInfo
- #ifdef COMPRESS_MT
- , numThreads
- #endif
- );
-
- if (!IsCopyMethod(oneMethodInfo.MethodName))
- needSolid = true;
-
- CMethodFull methodFull;
-
- if (!FindMethod(
- EXTERNAL_CODECS_VARS
- oneMethodInfo.MethodName, methodFull.Id, methodFull.NumInStreams, methodFull.NumOutStreams))
- return E_INVALIDARG;
- methodFull.Props = oneMethodInfo.Props;
- methodMode.Methods.Add(methodFull);
-
- if (!_numSolidBytesDefined)
- {
- for (int j = 0; j < methodFull.Props.Size(); j++)
- {
- const CProp &prop = methodFull.Props[j];
- if ((prop.Id == NCoderPropID::kDictionarySize ||
- prop.Id == NCoderPropID::kUsedMemorySize) && prop.Value.vt == VT_UI4)
- {
- _numSolidBytes = ((UInt64)prop.Value.ulVal) << 7;
- const UInt64 kMinSize = (1 << 24);
- if (_numSolidBytes < kMinSize)
- _numSolidBytes = kMinSize;
- _numSolidBytesDefined = true;
- break;
- }
- }
- }
- }
-
- if (!needSolid && !_numSolidBytesDefined)
- {
- _numSolidBytesDefined = true;
- _numSolidBytes = 0;
- }
- return S_OK;
-}
-
-static HRESULT GetTime(IArchiveUpdateCallback *updateCallback, int index, bool writeTime, PROPID propID, UInt64 &ft, bool &ftDefined)
-{
- ft = 0;
- ftDefined = false;
- if (!writeTime)
- return S_OK;
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(index, propID, &prop));
- if (prop.vt == VT_FILETIME)
- {
- ft = prop.filetime.dwLowDateTime | ((UInt64)prop.filetime.dwHighDateTime << 32);
- ftDefined = true;
- }
- else if (prop.vt != VT_EMPTY)
- return E_INVALIDARG;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems,
- IArchiveUpdateCallback *updateCallback)
-{
- COM_TRY_BEGIN
-
- const CArchiveDatabaseEx *db = 0;
- #ifdef _7Z_VOL
- if (_volumes.Size() > 1)
- return E_FAIL;
- const CVolume *volume = 0;
- if (_volumes.Size() == 1)
- {
- volume = &_volumes.Front();
- db = &volume->Database;
- }
- #else
- if (_inStream != 0)
- db = &_db;
- #endif
-
- CObjectVector<CUpdateItem> updateItems;
-
- for (UInt32 i = 0; i < numItems; i++)
- {
- Int32 newData, newProps;
- UInt32 indexInArchive;
- if (!updateCallback)
- return E_FAIL;
- RINOK(updateCallback->GetUpdateItemInfo(i, &newData, &newProps, &indexInArchive));
- CUpdateItem ui;
- ui.NewProps = IntToBool(newProps);
- ui.NewData = IntToBool(newData);
- ui.IndexInArchive = indexInArchive;
- ui.IndexInClient = i;
- ui.IsAnti = false;
- ui.Size = 0;
-
- if (ui.IndexInArchive != -1)
- {
- if (db == 0 || ui.IndexInArchive >= db->Files.Size())
- return E_INVALIDARG;
- const CFileItem &fi = db->Files[ui.IndexInArchive];
- ui.Name = fi.Name;
- ui.IsDir = fi.IsDir;
- ui.Size = fi.Size;
- ui.IsAnti = db->IsItemAnti(ui.IndexInArchive);
-
- ui.CTimeDefined = db->CTime.GetItem(ui.IndexInArchive, ui.CTime);
- ui.ATimeDefined = db->ATime.GetItem(ui.IndexInArchive, ui.ATime);
- ui.MTimeDefined = db->MTime.GetItem(ui.IndexInArchive, ui.MTime);
- }
-
- if (ui.NewProps)
- {
- bool nameIsDefined;
- bool folderStatusIsDefined;
- {
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(i, kpidAttrib, &prop));
- if (prop.vt == VT_EMPTY)
- ui.AttribDefined = false;
- else if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- else
- {
- ui.Attrib = prop.ulVal;
- ui.AttribDefined = true;
- }
- }
-
- // we need MTime to sort files.
- RINOK(GetTime(updateCallback, i, WriteCTime, kpidCTime, ui.CTime, ui.CTimeDefined));
- RINOK(GetTime(updateCallback, i, WriteATime, kpidATime, ui.ATime, ui.ATimeDefined));
- RINOK(GetTime(updateCallback, i, true, kpidMTime, ui.MTime, ui.MTimeDefined));
-
- {
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(i, kpidPath, &prop));
- if (prop.vt == VT_EMPTY)
- nameIsDefined = false;
- else if (prop.vt != VT_BSTR)
- return E_INVALIDARG;
- else
- {
- ui.Name = NItemName::MakeLegalName(prop.bstrVal);
- nameIsDefined = true;
- }
- }
- {
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(i, kpidIsDir, &prop));
- if (prop.vt == VT_EMPTY)
- folderStatusIsDefined = false;
- else if (prop.vt != VT_BOOL)
- return E_INVALIDARG;
- else
- {
- ui.IsDir = (prop.boolVal != VARIANT_FALSE);
- folderStatusIsDefined = true;
- }
- }
-
- {
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(i, kpidIsAnti, &prop));
- if (prop.vt == VT_EMPTY)
- ui.IsAnti = false;
- else if (prop.vt != VT_BOOL)
- return E_INVALIDARG;
- else
- ui.IsAnti = (prop.boolVal != VARIANT_FALSE);
- }
-
- if (ui.IsAnti)
- {
- ui.AttribDefined = false;
-
- ui.CTimeDefined = false;
- ui.ATimeDefined = false;
- ui.MTimeDefined = false;
-
- ui.Size = 0;
- }
-
- if (!folderStatusIsDefined && ui.AttribDefined)
- ui.SetDirStatusFromAttrib();
- }
-
- if (ui.NewData)
- {
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(i, kpidSize, &prop));
- if (prop.vt != VT_UI8)
- return E_INVALIDARG;
- ui.Size = (UInt64)prop.uhVal.QuadPart;
- if (ui.Size != 0 && ui.IsAnti)
- return E_INVALIDARG;
- }
- updateItems.Add(ui);
- }
-
- CCompressionMethodMode methodMode, headerMethod;
- RINOK(SetCompressionMethod(methodMode, headerMethod));
- #ifdef COMPRESS_MT
- methodMode.NumThreads = _numThreads;
- headerMethod.NumThreads = 1;
- #endif
-
- CMyComPtr<ICryptoGetTextPassword2> getPassword2;
- updateCallback->QueryInterface(IID_ICryptoGetTextPassword2, (void **)&getPassword2);
-
- if (getPassword2)
- {
- CMyComBSTR password;
- Int32 passwordIsDefined;
- RINOK(getPassword2->CryptoGetTextPassword2(&passwordIsDefined, &password));
- methodMode.PasswordIsDefined = IntToBool(passwordIsDefined);
- if (methodMode.PasswordIsDefined)
- methodMode.Password = password;
- }
- else
- methodMode.PasswordIsDefined = false;
-
- bool compressMainHeader = _compressHeaders; // check it
-
- bool encryptHeaders = false;
-
- if (methodMode.PasswordIsDefined)
- {
- if (_encryptHeadersSpecified)
- encryptHeaders = _encryptHeaders;
- #ifndef _NO_CRYPTO
- else
- encryptHeaders = _passwordIsDefined;
- #endif
- compressMainHeader = true;
- if (encryptHeaders)
- {
- headerMethod.PasswordIsDefined = methodMode.PasswordIsDefined;
- headerMethod.Password = methodMode.Password;
- }
- }
-
- if (numItems < 2)
- compressMainHeader = false;
-
- CUpdateOptions options;
- options.Method = &methodMode;
- options.HeaderMethod = (_compressHeaders || encryptHeaders) ? &headerMethod : 0;
- options.UseFilters = _level != 0 && _autoFilter;
- options.MaxFilter = _level >= 8;
-
- options.HeaderOptions.CompressMainHeader = compressMainHeader;
- options.HeaderOptions.WriteCTime = WriteCTime;
- options.HeaderOptions.WriteATime = WriteATime;
- options.HeaderOptions.WriteMTime = WriteMTime;
-
- options.NumSolidFiles = _numSolidFiles;
- options.NumSolidBytes = _numSolidBytes;
- options.SolidExtension = _solidExtension;
- options.RemoveSfxBlock = _removeSfxBlock;
- options.VolumeMode = _volumeMode;
-
- COutArchive archive;
- CArchiveDatabase newDatabase;
-
- CMyComPtr<ICryptoGetTextPassword> getPassword;
- updateCallback->QueryInterface(IID_ICryptoGetTextPassword, (void **)&getPassword);
-
- HRESULT res = Update(
- EXTERNAL_CODECS_VARS
- #ifdef _7Z_VOL
- volume ? volume->Stream: 0,
- volume ? db : 0,
- #else
- _inStream,
- db,
- #endif
- updateItems,
- archive, newDatabase, outStream, updateCallback, options
- #ifndef _NO_CRYPTO
- , getPassword
- #endif
- );
-
- RINOK(res);
-
- updateItems.ClearAndFree();
-
- return archive.WriteDatabase(EXTERNAL_CODECS_VARS
- newDatabase, options.HeaderMethod, options.HeaderOptions);
-
- COM_TRY_END
-}
-
-static HRESULT GetBindInfoPart(UString &srcString, UInt32 &coder, UInt32 &stream)
-{
- stream = 0;
- int index = ParseStringToUInt32(srcString, coder);
- if (index == 0)
- return E_INVALIDARG;
- srcString.Delete(0, index);
- if (srcString[0] == 'S')
- {
- srcString.Delete(0);
- int index = ParseStringToUInt32(srcString, stream);
- if (index == 0)
- return E_INVALIDARG;
- srcString.Delete(0, index);
- }
- return S_OK;
-}
-
-static HRESULT GetBindInfo(UString &srcString, CBind &bind)
-{
- RINOK(GetBindInfoPart(srcString, bind.OutCoder, bind.OutStream));
- if (srcString[0] != ':')
- return E_INVALIDARG;
- srcString.Delete(0);
- RINOK(GetBindInfoPart(srcString, bind.InCoder, bind.InStream));
- if (!srcString.IsEmpty())
- return E_INVALIDARG;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties)
-{
- COM_TRY_BEGIN
- _binds.Clear();
- BeforeSetProperty();
-
- for (int i = 0; i < numProperties; i++)
- {
- UString name = names[i];
- name.MakeUpper();
- if (name.IsEmpty())
- return E_INVALIDARG;
-
- const PROPVARIANT &value = values[i];
-
- if (name[0] == 'B')
- {
- name.Delete(0);
- CBind bind;
- RINOK(GetBindInfo(name, bind));
- _binds.Add(bind);
- continue;
- }
-
- RINOK(SetProperty(name, value));
- }
-
- return S_OK;
- COM_TRY_END
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHeader.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHeader.cpp
deleted file mode 100644
index f232a23ee..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHeader.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// 7z/Header.cpp
-
-#include "StdAfx.h"
-#include "7zHeader.h"
-
-namespace NArchive {
-namespace N7z {
-
-Byte kSignature[kSignatureSize] = {'7' + 1, 'z', 0xBC, 0xAF, 0x27, 0x1C};
-#ifdef _7Z_VOL
-Byte kFinishSignature[kSignatureSize] = {'7' + 1, 'z', 0xBC, 0xAF, 0x27, 0x1C + 1};
-#endif
-
-class SignatureInitializer
-{
-public:
- SignatureInitializer()
- {
- kSignature[0]--;
- #ifdef _7Z_VOL
- kFinishSignature[0]--;
- #endif
- };
-} g_SignatureInitializer;
-
-}}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHeader.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHeader.h
deleted file mode 100644
index 30622b90e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zHeader.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// 7z/7zHeader.h
-
-#ifndef __7Z_HEADER_H
-#define __7Z_HEADER_H
-
-#include "../../../Common/Types.h"
-
-namespace NArchive {
-namespace N7z {
-
-const int kSignatureSize = 6;
-extern Byte kSignature[kSignatureSize];
-
-// #define _7Z_VOL
-// 7z-MultiVolume is not finished yet.
-// It can work already, but I still do not like some
-// things of that new multivolume format.
-// So please keep it commented.
-
-#ifdef _7Z_VOL
-extern Byte kFinishSignature[kSignatureSize];
-#endif
-
-struct CArchiveVersion
-{
- Byte Major;
- Byte Minor;
-};
-
-const Byte kMajorVersion = 0;
-
-struct CStartHeader
-{
- UInt64 NextHeaderOffset;
- UInt64 NextHeaderSize;
- UInt32 NextHeaderCRC;
-};
-
-const UInt32 kStartHeaderSize = 20;
-
-#ifdef _7Z_VOL
-struct CFinishHeader: public CStartHeader
-{
- UInt64 ArchiveStartOffset; // data offset from end if that struct
- UInt64 AdditionalStartBlockSize; // start signature & start header size
-};
-
-const UInt32 kFinishHeaderSize = kStartHeaderSize + 16;
-#endif
-
-namespace NID
-{
- enum EEnum
- {
- kEnd,
-
- kHeader,
-
- kArchiveProperties,
-
- kAdditionalStreamsInfo,
- kMainStreamsInfo,
- kFilesInfo,
-
- kPackInfo,
- kUnpackInfo,
- kSubStreamsInfo,
-
- kSize,
- kCRC,
-
- kFolder,
-
- kCodersUnpackSize,
- kNumUnpackStream,
-
- kEmptyStream,
- kEmptyFile,
- kAnti,
-
- kName,
- kCTime,
- kATime,
- kMTime,
- kWinAttributes,
- kComment,
-
- kEncodedHeader,
-
- kStartPos,
- kDummy
- };
-}
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zIn.cpp
deleted file mode 100644
index f1ededdc7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zIn.cpp
+++ /dev/null
@@ -1,1257 +0,0 @@
-// 7zIn.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/7zCrc.h"
-#include "../../../../C/CpuArch.h"
-
-#include "../../Common/StreamObjects.h"
-#include "../../Common/StreamUtils.h"
-
-#include "7zDecode.h"
-#include "7zIn.h"
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-#define Get64(p) GetUi64(p)
-
-// define FORMAT_7Z_RECOVERY if you want to recover multivolume archives with empty StartHeader
-#ifndef _SFX
-#define FORMAT_7Z_RECOVERY
-#endif
-
-namespace NArchive {
-namespace N7z {
-
-static void BoolVector_Fill_False(CBoolVector &v, int size)
-{
- v.Clear();
- v.Reserve(size);
- for (int i = 0; i < size; i++)
- v.Add(false);
-}
-
-static bool BoolVector_GetAndSet(CBoolVector &v, UInt32 index)
-{
- if (index >= (UInt32)v.Size())
- return true;
- bool res = v[index];
- v[index] = true;
- return res;
-}
-
-bool CFolder::CheckStructure() const
-{
- const int kNumCodersMax = sizeof(UInt32) * 8; // don't change it
- const int kMaskSize = sizeof(UInt32) * 8; // it must be >= kNumCodersMax
- const int kNumBindsMax = 32;
-
- if (Coders.Size() > kNumCodersMax || BindPairs.Size() > kNumBindsMax)
- return false;
-
- {
- CBoolVector v;
- BoolVector_Fill_False(v, BindPairs.Size() + PackStreams.Size());
-
- int i;
- for (i = 0; i < BindPairs.Size(); i++)
- if (BoolVector_GetAndSet(v, BindPairs[i].InIndex))
- return false;
- for (i = 0; i < PackStreams.Size(); i++)
- if (BoolVector_GetAndSet(v, PackStreams[i]))
- return false;
-
- BoolVector_Fill_False(v, UnpackSizes.Size());
- for (i = 0; i < BindPairs.Size(); i++)
- if (BoolVector_GetAndSet(v, BindPairs[i].OutIndex))
- return false;
- }
-
- UInt32 mask[kMaskSize];
- int i;
- for (i = 0; i < kMaskSize; i++)
- mask[i] = 0;
-
- {
- CIntVector inStreamToCoder, outStreamToCoder;
- for (i = 0; i < Coders.Size(); i++)
- {
- CNum j;
- const CCoderInfo &coder = Coders[i];
- for (j = 0; j < coder.NumInStreams; j++)
- inStreamToCoder.Add(i);
- for (j = 0; j < coder.NumOutStreams; j++)
- outStreamToCoder.Add(i);
- }
-
- for (i = 0; i < BindPairs.Size(); i++)
- {
- const CBindPair &bp = BindPairs[i];
- mask[inStreamToCoder[bp.InIndex]] |= (1 << outStreamToCoder[bp.OutIndex]);
- }
- }
-
- for (i = 0; i < kMaskSize; i++)
- for (int j = 0; j < kMaskSize; j++)
- if (((1 << j) & mask[i]) != 0)
- mask[i] |= mask[j];
-
- for (i = 0; i < kMaskSize; i++)
- if (((1 << i) & mask[i]) != 0)
- return false;
-
- return true;
-}
-
-class CInArchiveException {};
-
-static void ThrowException() { throw CInArchiveException(); }
-static inline void ThrowEndOfData() { ThrowException(); }
-static inline void ThrowUnsupported() { ThrowException(); }
-static inline void ThrowIncorrect() { ThrowException(); }
-static inline void ThrowUnsupportedVersion() { ThrowException(); }
-
-/*
-class CInArchiveException
-{
-public:
- enum CCauseType
- {
- kUnsupportedVersion = 0,
- kUnsupported,
- kIncorrect,
- kEndOfData,
- } Cause;
- CInArchiveException(CCauseType cause): Cause(cause) {};
-};
-
-static void ThrowException(CInArchiveException::CCauseType c) { throw CInArchiveException(c); }
-static void ThrowEndOfData() { ThrowException(CInArchiveException::kEndOfData); }
-static void ThrowUnsupported() { ThrowException(CInArchiveException::kUnsupported); }
-static void ThrowIncorrect() { ThrowException(CInArchiveException::kIncorrect); }
-static void ThrowUnsupportedVersion() { ThrowException(CInArchiveException::kUnsupportedVersion); }
-*/
-
-class CStreamSwitch
-{
- CInArchive *_archive;
- bool _needRemove;
-public:
- CStreamSwitch(): _needRemove(false) {}
- ~CStreamSwitch() { Remove(); }
- void Remove();
- void Set(CInArchive *archive, const Byte *data, size_t size);
- void Set(CInArchive *archive, const CByteBuffer &byteBuffer);
- void Set(CInArchive *archive, const CObjectVector<CByteBuffer> *dataVector);
-};
-
-void CStreamSwitch::Remove()
-{
- if (_needRemove)
- {
- _archive->DeleteByteStream();
- _needRemove = false;
- }
-}
-
-void CStreamSwitch::Set(CInArchive *archive, const Byte *data, size_t size)
-{
- Remove();
- _archive = archive;
- _archive->AddByteStream(data, size);
- _needRemove = true;
-}
-
-void CStreamSwitch::Set(CInArchive *archive, const CByteBuffer &byteBuffer)
-{
- Set(archive, byteBuffer, byteBuffer.GetCapacity());
-}
-
-void CStreamSwitch::Set(CInArchive *archive, const CObjectVector<CByteBuffer> *dataVector)
-{
- Remove();
- Byte external = archive->ReadByte();
- if (external != 0)
- {
- int dataIndex = (int)archive->ReadNum();
- if (dataIndex < 0 || dataIndex >= dataVector->Size())
- ThrowIncorrect();
- Set(archive, (*dataVector)[dataIndex]);
- }
-}
-
-Byte CInByte2::ReadByte()
-{
- if (_pos >= _size)
- ThrowEndOfData();
- return _buffer[_pos++];
-}
-
-void CInByte2::ReadBytes(Byte *data, size_t size)
-{
- if (size > _size - _pos)
- ThrowEndOfData();
- for (size_t i = 0; i < size; i++)
- data[i] = _buffer[_pos++];
-}
-
-void CInByte2::SkipData(UInt64 size)
-{
- if (size > _size - _pos)
- ThrowEndOfData();
- _pos += (size_t)size;
-}
-
-void CInByte2::SkipData()
-{
- SkipData(ReadNumber());
-}
-
-UInt64 CInByte2::ReadNumber()
-{
- if (_pos >= _size)
- ThrowEndOfData();
- Byte firstByte = _buffer[_pos++];
- Byte mask = 0x80;
- UInt64 value = 0;
- for (int i = 0; i < 8; i++)
- {
- if ((firstByte & mask) == 0)
- {
- UInt64 highPart = firstByte & (mask - 1);
- value += (highPart << (i * 8));
- return value;
- }
- if (_pos >= _size)
- ThrowEndOfData();
- value |= ((UInt64)_buffer[_pos++] << (8 * i));
- mask >>= 1;
- }
- return value;
-}
-
-CNum CInByte2::ReadNum()
-{
- UInt64 value = ReadNumber();
- if (value > kNumMax)
- ThrowUnsupported();
- return (CNum)value;
-}
-
-UInt32 CInByte2::ReadUInt32()
-{
- if (_pos + 4 > _size)
- ThrowEndOfData();
- UInt32 res = Get32(_buffer + _pos);
- _pos += 4;
- return res;
-}
-
-UInt64 CInByte2::ReadUInt64()
-{
- if (_pos + 8 > _size)
- ThrowEndOfData();
- UInt64 res = Get64(_buffer + _pos);
- _pos += 8;
- return res;
-}
-
-void CInByte2::ReadString(UString &s)
-{
- const Byte *buf = _buffer + _pos;
- size_t rem = (_size - _pos) / 2 * 2;
- {
- size_t i;
- for (i = 0; i < rem; i += 2)
- if (buf[i] == 0 && buf[i + 1] == 0)
- break;
- if (i == rem)
- ThrowEndOfData();
- rem = i;
- }
- int len = (int)(rem / 2);
- if (len < 0 || (size_t)len * 2 != rem)
- ThrowUnsupported();
- wchar_t *p = s.GetBuffer(len);
- int i;
- for (i = 0; i < len; i++, buf += 2)
- p[i] = (wchar_t)Get16(buf);
- s.ReleaseBuffer(len);
- _pos += rem + 2;
-}
-
-static inline bool TestSignatureCandidate(const Byte *p)
-{
- for (int i = 0; i < kSignatureSize; i++)
- if (p[i] != kSignature[i])
- return false;
- return (p[0x1A] == 0 && p[0x1B] == 0);
-}
-
-HRESULT CInArchive::FindAndReadSignature(IInStream *stream, const UInt64 *searchHeaderSizeLimit)
-{
- RINOK(ReadStream_FALSE(stream, _header, kHeaderSize));
-
- if (TestSignatureCandidate(_header))
- return S_OK;
-
- CByteBuffer byteBuffer;
- const UInt32 kBufferSize = (1 << 16);
- byteBuffer.SetCapacity(kBufferSize);
- Byte *buffer = byteBuffer;
- UInt32 numPrevBytes = kHeaderSize - 1;
- memcpy(buffer, _header + 1, numPrevBytes);
- UInt64 curTestPos = _arhiveBeginStreamPosition + 1;
- for (;;)
- {
- if (searchHeaderSizeLimit != NULL)
- if (curTestPos - _arhiveBeginStreamPosition > *searchHeaderSizeLimit)
- break;
- do
- {
- UInt32 numReadBytes = kBufferSize - numPrevBytes;
- UInt32 processedSize;
- RINOK(stream->Read(buffer + numPrevBytes, numReadBytes, &processedSize));
- numPrevBytes += processedSize;
- if (processedSize == 0)
- return S_FALSE;
- }
- while (numPrevBytes < kHeaderSize);
- UInt32 numTests = numPrevBytes - kHeaderSize + 1;
- for (UInt32 pos = 0; pos < numTests; pos++)
- {
- for (; buffer[pos] != '7' && pos < numTests; pos++);
- if (pos == numTests)
- break;
- if (TestSignatureCandidate(buffer + pos))
- {
- memcpy(_header, buffer + pos, kHeaderSize);
- curTestPos += pos;
- _arhiveBeginStreamPosition = curTestPos;
- return stream->Seek(curTestPos + kHeaderSize, STREAM_SEEK_SET, NULL);
- }
- }
- curTestPos += numTests;
- numPrevBytes -= numTests;
- memmove(buffer, buffer + numTests, numPrevBytes);
- }
- return S_FALSE;
-}
-
-// S_FALSE means that file is not archive
-HRESULT CInArchive::Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit)
-{
- HeadersSize = 0;
- Close();
- RINOK(stream->Seek(0, STREAM_SEEK_CUR, &_arhiveBeginStreamPosition))
- RINOK(FindAndReadSignature(stream, searchHeaderSizeLimit));
- _stream = stream;
- return S_OK;
-}
-
-void CInArchive::Close()
-{
- _stream.Release();
-}
-
-void CInArchive::ReadArchiveProperties(CInArchiveInfo & /* archiveInfo */)
-{
- for (;;)
- {
- if (ReadID() == NID::kEnd)
- break;
- SkipData();
- }
-}
-
-void CInArchive::GetNextFolderItem(CFolder &folder)
-{
- CNum numCoders = ReadNum();
-
- folder.Coders.Clear();
- folder.Coders.Reserve((int)numCoders);
- CNum numInStreams = 0;
- CNum numOutStreams = 0;
- CNum i;
- for (i = 0; i < numCoders; i++)
- {
- folder.Coders.Add(CCoderInfo());
- CCoderInfo &coder = folder.Coders.Back();
-
- {
- Byte mainByte = ReadByte();
- int idSize = (mainByte & 0xF);
- Byte longID[15];
- ReadBytes(longID, idSize);
- if (idSize > 8)
- ThrowUnsupported();
- UInt64 id = 0;
- for (int j = 0; j < idSize; j++)
- id |= (UInt64)longID[idSize - 1 - j] << (8 * j);
- coder.MethodID = id;
-
- if ((mainByte & 0x10) != 0)
- {
- coder.NumInStreams = ReadNum();
- coder.NumOutStreams = ReadNum();
- }
- else
- {
- coder.NumInStreams = 1;
- coder.NumOutStreams = 1;
- }
- if ((mainByte & 0x20) != 0)
- {
- CNum propsSize = ReadNum();
- coder.Props.SetCapacity((size_t)propsSize);
- ReadBytes((Byte *)coder.Props, (size_t)propsSize);
- }
- if ((mainByte & 0x80) != 0)
- ThrowUnsupported();
- }
- numInStreams += coder.NumInStreams;
- numOutStreams += coder.NumOutStreams;
- }
-
- CNum numBindPairs = numOutStreams - 1;
- folder.BindPairs.Clear();
- folder.BindPairs.Reserve(numBindPairs);
- for (i = 0; i < numBindPairs; i++)
- {
- CBindPair bp;
- bp.InIndex = ReadNum();
- bp.OutIndex = ReadNum();
- folder.BindPairs.Add(bp);
- }
-
- if (numInStreams < numBindPairs)
- ThrowUnsupported();
- CNum numPackStreams = numInStreams - numBindPairs;
- folder.PackStreams.Reserve(numPackStreams);
- if (numPackStreams == 1)
- {
- for (i = 0; i < numInStreams; i++)
- if (folder.FindBindPairForInStream(i) < 0)
- {
- folder.PackStreams.Add(i);
- break;
- }
- if (folder.PackStreams.Size() != 1)
- ThrowUnsupported();
- }
- else
- for (i = 0; i < numPackStreams; i++)
- folder.PackStreams.Add(ReadNum());
-}
-
-void CInArchive::WaitAttribute(UInt64 attribute)
-{
- for (;;)
- {
- UInt64 type = ReadID();
- if (type == attribute)
- return;
- if (type == NID::kEnd)
- ThrowIncorrect();
- SkipData();
- }
-}
-
-void CInArchive::ReadHashDigests(int numItems,
- CBoolVector &digestsDefined,
- CRecordVector<UInt32> &digests)
-{
- ReadBoolVector2(numItems, digestsDefined);
- digests.Clear();
- digests.Reserve(numItems);
- for (int i = 0; i < numItems; i++)
- {
- UInt32 crc = 0;
- if (digestsDefined[i])
- crc = ReadUInt32();
- digests.Add(crc);
- }
-}
-
-void CInArchive::ReadPackInfo(
- UInt64 &dataOffset,
- CRecordVector<UInt64> &packSizes,
- CBoolVector &packCRCsDefined,
- CRecordVector<UInt32> &packCRCs)
-{
- dataOffset = ReadNumber();
- CNum numPackStreams = ReadNum();
-
- WaitAttribute(NID::kSize);
- packSizes.Clear();
- packSizes.Reserve(numPackStreams);
- for (CNum i = 0; i < numPackStreams; i++)
- packSizes.Add(ReadNumber());
-
- UInt64 type;
- for (;;)
- {
- type = ReadID();
- if (type == NID::kEnd)
- break;
- if (type == NID::kCRC)
- {
- ReadHashDigests(numPackStreams, packCRCsDefined, packCRCs);
- continue;
- }
- SkipData();
- }
- if (packCRCsDefined.IsEmpty())
- {
- BoolVector_Fill_False(packCRCsDefined, numPackStreams);
- packCRCs.Reserve(numPackStreams);
- packCRCs.Clear();
- for (CNum i = 0; i < numPackStreams; i++)
- packCRCs.Add(0);
- }
-}
-
-void CInArchive::ReadUnpackInfo(
- const CObjectVector<CByteBuffer> *dataVector,
- CObjectVector<CFolder> &folders)
-{
- WaitAttribute(NID::kFolder);
- CNum numFolders = ReadNum();
-
- {
- CStreamSwitch streamSwitch;
- streamSwitch.Set(this, dataVector);
- folders.Clear();
- folders.Reserve(numFolders);
- for (CNum i = 0; i < numFolders; i++)
- {
- folders.Add(CFolder());
- GetNextFolderItem(folders.Back());
- }
- }
-
- WaitAttribute(NID::kCodersUnpackSize);
-
- CNum i;
- for (i = 0; i < numFolders; i++)
- {
- CFolder &folder = folders[i];
- CNum numOutStreams = folder.GetNumOutStreams();
- folder.UnpackSizes.Reserve(numOutStreams);
- for (CNum j = 0; j < numOutStreams; j++)
- folder.UnpackSizes.Add(ReadNumber());
- }
-
- for (;;)
- {
- UInt64 type = ReadID();
- if (type == NID::kEnd)
- return;
- if (type == NID::kCRC)
- {
- CBoolVector crcsDefined;
- CRecordVector<UInt32> crcs;
- ReadHashDigests(numFolders, crcsDefined, crcs);
- for (i = 0; i < numFolders; i++)
- {
- CFolder &folder = folders[i];
- folder.UnpackCRCDefined = crcsDefined[i];
- folder.UnpackCRC = crcs[i];
- }
- continue;
- }
- SkipData();
- }
-}
-
-void CInArchive::ReadSubStreamsInfo(
- const CObjectVector<CFolder> &folders,
- CRecordVector<CNum> &numUnpackStreamsInFolders,
- CRecordVector<UInt64> &unpackSizes,
- CBoolVector &digestsDefined,
- CRecordVector<UInt32> &digests)
-{
- numUnpackStreamsInFolders.Clear();
- numUnpackStreamsInFolders.Reserve(folders.Size());
- UInt64 type;
- for (;;)
- {
- type = ReadID();
- if (type == NID::kNumUnpackStream)
- {
- for (int i = 0; i < folders.Size(); i++)
- numUnpackStreamsInFolders.Add(ReadNum());
- continue;
- }
- if (type == NID::kCRC || type == NID::kSize)
- break;
- if (type == NID::kEnd)
- break;
- SkipData();
- }
-
- if (numUnpackStreamsInFolders.IsEmpty())
- for (int i = 0; i < folders.Size(); i++)
- numUnpackStreamsInFolders.Add(1);
-
- int i;
- for (i = 0; i < numUnpackStreamsInFolders.Size(); i++)
- {
- // v3.13 incorrectly worked with empty folders
- // v4.07: we check that folder is empty
- CNum numSubstreams = numUnpackStreamsInFolders[i];
- if (numSubstreams == 0)
- continue;
- UInt64 sum = 0;
- for (CNum j = 1; j < numSubstreams; j++)
- if (type == NID::kSize)
- {
- UInt64 size = ReadNumber();
- unpackSizes.Add(size);
- sum += size;
- }
- unpackSizes.Add(folders[i].GetUnpackSize() - sum);
- }
- if (type == NID::kSize)
- type = ReadID();
-
- int numDigests = 0;
- int numDigestsTotal = 0;
- for (i = 0; i < folders.Size(); i++)
- {
- CNum numSubstreams = numUnpackStreamsInFolders[i];
- if (numSubstreams != 1 || !folders[i].UnpackCRCDefined)
- numDigests += numSubstreams;
- numDigestsTotal += numSubstreams;
- }
-
- for (;;)
- {
- if (type == NID::kCRC)
- {
- CBoolVector digestsDefined2;
- CRecordVector<UInt32> digests2;
- ReadHashDigests(numDigests, digestsDefined2, digests2);
- int digestIndex = 0;
- for (i = 0; i < folders.Size(); i++)
- {
- CNum numSubstreams = numUnpackStreamsInFolders[i];
- const CFolder &folder = folders[i];
- if (numSubstreams == 1 && folder.UnpackCRCDefined)
- {
- digestsDefined.Add(true);
- digests.Add(folder.UnpackCRC);
- }
- else
- for (CNum j = 0; j < numSubstreams; j++, digestIndex++)
- {
- digestsDefined.Add(digestsDefined2[digestIndex]);
- digests.Add(digests2[digestIndex]);
- }
- }
- }
- else if (type == NID::kEnd)
- {
- if (digestsDefined.IsEmpty())
- {
- BoolVector_Fill_False(digestsDefined, numDigestsTotal);
- digests.Clear();
- for (int i = 0; i < numDigestsTotal; i++)
- digests.Add(0);
- }
- return;
- }
- else
- SkipData();
- type = ReadID();
- }
-}
-
-void CInArchive::ReadStreamsInfo(
- const CObjectVector<CByteBuffer> *dataVector,
- UInt64 &dataOffset,
- CRecordVector<UInt64> &packSizes,
- CBoolVector &packCRCsDefined,
- CRecordVector<UInt32> &packCRCs,
- CObjectVector<CFolder> &folders,
- CRecordVector<CNum> &numUnpackStreamsInFolders,
- CRecordVector<UInt64> &unpackSizes,
- CBoolVector &digestsDefined,
- CRecordVector<UInt32> &digests)
-{
- for (;;)
- {
- UInt64 type = ReadID();
- if (type > ((UInt32)1 << 30))
- ThrowIncorrect();
- switch((UInt32)type)
- {
- case NID::kEnd:
- return;
- case NID::kPackInfo:
- {
- ReadPackInfo(dataOffset, packSizes, packCRCsDefined, packCRCs);
- break;
- }
- case NID::kUnpackInfo:
- {
- ReadUnpackInfo(dataVector, folders);
- break;
- }
- case NID::kSubStreamsInfo:
- {
- ReadSubStreamsInfo(folders, numUnpackStreamsInFolders,
- unpackSizes, digestsDefined, digests);
- break;
- }
- default:
- ThrowIncorrect();
- }
- }
-}
-
-void CInArchive::ReadBoolVector(int numItems, CBoolVector &v)
-{
- v.Clear();
- v.Reserve(numItems);
- Byte b = 0;
- Byte mask = 0;
- for (int i = 0; i < numItems; i++)
- {
- if (mask == 0)
- {
- b = ReadByte();
- mask = 0x80;
- }
- v.Add((b & mask) != 0);
- mask >>= 1;
- }
-}
-
-void CInArchive::ReadBoolVector2(int numItems, CBoolVector &v)
-{
- Byte allAreDefined = ReadByte();
- if (allAreDefined == 0)
- {
- ReadBoolVector(numItems, v);
- return;
- }
- v.Clear();
- v.Reserve(numItems);
- for (int i = 0; i < numItems; i++)
- v.Add(true);
-}
-
-void CInArchive::ReadUInt64DefVector(const CObjectVector<CByteBuffer> &dataVector,
- CUInt64DefVector &v, int numFiles)
-{
- ReadBoolVector2(numFiles, v.Defined);
-
- CStreamSwitch streamSwitch;
- streamSwitch.Set(this, &dataVector);
- v.Values.Reserve(numFiles);
-
- for (int i = 0; i < numFiles; i++)
- {
- UInt64 t = 0;
- if (v.Defined[i])
- t = ReadUInt64();
- v.Values.Add(t);
- }
-}
-
-HRESULT CInArchive::ReadAndDecodePackedStreams(
- DECL_EXTERNAL_CODECS_LOC_VARS
- UInt64 baseOffset,
- UInt64 &dataOffset, CObjectVector<CByteBuffer> &dataVector
- #ifndef _NO_CRYPTO
- , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
- #endif
- )
-{
- CRecordVector<UInt64> packSizes;
- CBoolVector packCRCsDefined;
- CRecordVector<UInt32> packCRCs;
- CObjectVector<CFolder> folders;
-
- CRecordVector<CNum> numUnpackStreamsInFolders;
- CRecordVector<UInt64> unpackSizes;
- CBoolVector digestsDefined;
- CRecordVector<UInt32> digests;
-
- ReadStreamsInfo(NULL,
- dataOffset,
- packSizes,
- packCRCsDefined,
- packCRCs,
- folders,
- numUnpackStreamsInFolders,
- unpackSizes,
- digestsDefined,
- digests);
-
- // db.ArchiveInfo.DataStartPosition2 += db.ArchiveInfo.StartPositionAfterHeader;
-
- CNum packIndex = 0;
- CDecoder decoder(
- #ifdef _ST_MODE
- false
- #else
- true
- #endif
- );
- UInt64 dataStartPos = baseOffset + dataOffset;
- for (int i = 0; i < folders.Size(); i++)
- {
- const CFolder &folder = folders[i];
- dataVector.Add(CByteBuffer());
- CByteBuffer &data = dataVector.Back();
- UInt64 unpackSize64 = folder.GetUnpackSize();
- size_t unpackSize = (size_t)unpackSize64;
- if (unpackSize != unpackSize64)
- ThrowUnsupported();
- data.SetCapacity(unpackSize);
-
- CSequentialOutStreamImp2 *outStreamSpec = new CSequentialOutStreamImp2;
- CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
- outStreamSpec->Init(data, unpackSize);
-
- HRESULT result = decoder.Decode(
- EXTERNAL_CODECS_LOC_VARS
- _stream, dataStartPos,
- &packSizes[packIndex], folder, outStream, NULL
- #ifndef _NO_CRYPTO
- , getTextPassword, passwordIsDefined
- #endif
- #ifdef COMPRESS_MT
- , false, 1
- #endif
- );
- RINOK(result);
-
- if (folder.UnpackCRCDefined)
- if (CrcCalc(data, unpackSize) != folder.UnpackCRC)
- ThrowIncorrect();
- for (int j = 0; j < folder.PackStreams.Size(); j++)
- {
- UInt64 packSize = packSizes[packIndex++];
- dataStartPos += packSize;
- HeadersSize += packSize;
- }
- }
- return S_OK;
-}
-
-HRESULT CInArchive::ReadHeader(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CArchiveDatabaseEx &db
- #ifndef _NO_CRYPTO
- , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
- #endif
- )
-{
- UInt64 type = ReadID();
-
- if (type == NID::kArchiveProperties)
- {
- ReadArchiveProperties(db.ArchiveInfo);
- type = ReadID();
- }
-
- CObjectVector<CByteBuffer> dataVector;
-
- if (type == NID::kAdditionalStreamsInfo)
- {
- HRESULT result = ReadAndDecodePackedStreams(
- EXTERNAL_CODECS_LOC_VARS
- db.ArchiveInfo.StartPositionAfterHeader,
- db.ArchiveInfo.DataStartPosition2,
- dataVector
- #ifndef _NO_CRYPTO
- , getTextPassword, passwordIsDefined
- #endif
- );
- RINOK(result);
- db.ArchiveInfo.DataStartPosition2 += db.ArchiveInfo.StartPositionAfterHeader;
- type = ReadID();
- }
-
- CRecordVector<UInt64> unpackSizes;
- CBoolVector digestsDefined;
- CRecordVector<UInt32> digests;
-
- if (type == NID::kMainStreamsInfo)
- {
- ReadStreamsInfo(&dataVector,
- db.ArchiveInfo.DataStartPosition,
- db.PackSizes,
- db.PackCRCsDefined,
- db.PackCRCs,
- db.Folders,
- db.NumUnpackStreamsVector,
- unpackSizes,
- digestsDefined,
- digests);
- db.ArchiveInfo.DataStartPosition += db.ArchiveInfo.StartPositionAfterHeader;
- type = ReadID();
- }
- else
- {
- for (int i = 0; i < db.Folders.Size(); i++)
- {
- db.NumUnpackStreamsVector.Add(1);
- CFolder &folder = db.Folders[i];
- unpackSizes.Add(folder.GetUnpackSize());
- digestsDefined.Add(folder.UnpackCRCDefined);
- digests.Add(folder.UnpackCRC);
- }
- }
-
- db.Files.Clear();
-
- if (type == NID::kEnd)
- return S_OK;
- if (type != NID::kFilesInfo)
- ThrowIncorrect();
-
- CNum numFiles = ReadNum();
- db.Files.Reserve(numFiles);
- CNum i;
- for (i = 0; i < numFiles; i++)
- db.Files.Add(CFileItem());
-
- db.ArchiveInfo.FileInfoPopIDs.Add(NID::kSize);
- if (!db.PackSizes.IsEmpty())
- db.ArchiveInfo.FileInfoPopIDs.Add(NID::kPackInfo);
- if (numFiles > 0 && !digests.IsEmpty())
- db.ArchiveInfo.FileInfoPopIDs.Add(NID::kCRC);
-
- CBoolVector emptyStreamVector;
- BoolVector_Fill_False(emptyStreamVector, (int)numFiles);
- CBoolVector emptyFileVector;
- CBoolVector antiFileVector;
- CNum numEmptyStreams = 0;
-
- for (;;)
- {
- UInt64 type = ReadID();
- if (type == NID::kEnd)
- break;
- UInt64 size = ReadNumber();
- size_t ppp = _inByteBack->_pos;
- bool addPropIdToList = true;
- bool isKnownType = true;
- if (type > ((UInt32)1 << 30))
- isKnownType = false;
- else switch((UInt32)type)
- {
- case NID::kName:
- {
- CStreamSwitch streamSwitch;
- streamSwitch.Set(this, &dataVector);
- for (int i = 0; i < db.Files.Size(); i++)
- _inByteBack->ReadString(db.Files[i].Name);
- break;
- }
- case NID::kWinAttributes:
- {
- CBoolVector boolVector;
- ReadBoolVector2(db.Files.Size(), boolVector);
- CStreamSwitch streamSwitch;
- streamSwitch.Set(this, &dataVector);
- for (i = 0; i < numFiles; i++)
- {
- CFileItem &file = db.Files[i];
- file.AttribDefined = boolVector[i];
- if (file.AttribDefined)
- file.Attrib = ReadUInt32();
- }
- break;
- }
- case NID::kEmptyStream:
- {
- ReadBoolVector(numFiles, emptyStreamVector);
- for (i = 0; i < (CNum)emptyStreamVector.Size(); i++)
- if (emptyStreamVector[i])
- numEmptyStreams++;
-
- BoolVector_Fill_False(emptyFileVector, numEmptyStreams);
- BoolVector_Fill_False(antiFileVector, numEmptyStreams);
-
- break;
- }
- case NID::kEmptyFile: ReadBoolVector(numEmptyStreams, emptyFileVector); break;
- case NID::kAnti: ReadBoolVector(numEmptyStreams, antiFileVector); break;
- case NID::kStartPos: ReadUInt64DefVector(dataVector, db.StartPos, (int)numFiles); break;
- case NID::kCTime: ReadUInt64DefVector(dataVector, db.CTime, (int)numFiles); break;
- case NID::kATime: ReadUInt64DefVector(dataVector, db.ATime, (int)numFiles); break;
- case NID::kMTime: ReadUInt64DefVector(dataVector, db.MTime, (int)numFiles); break;
- case NID::kDummy:
- {
- for (UInt64 j = 0; j < size; j++)
- if (ReadByte() != 0)
- ThrowIncorrect();
- addPropIdToList = false;
- break;
- }
- default:
- addPropIdToList = isKnownType = false;
- }
- if (isKnownType)
- {
- if(addPropIdToList)
- db.ArchiveInfo.FileInfoPopIDs.Add(type);
- }
- else
- SkipData(size);
- bool checkRecordsSize = (db.ArchiveInfo.Version.Major > 0 ||
- db.ArchiveInfo.Version.Minor > 2);
- if (checkRecordsSize && _inByteBack->_pos - ppp != size)
- ThrowIncorrect();
- }
-
- CNum emptyFileIndex = 0;
- CNum sizeIndex = 0;
-
- CNum numAntiItems = 0;
- for (i = 0; i < numEmptyStreams; i++)
- if (antiFileVector[i])
- numAntiItems++;
-
- for (i = 0; i < numFiles; i++)
- {
- CFileItem &file = db.Files[i];
- bool isAnti;
- file.HasStream = !emptyStreamVector[i];
- if (file.HasStream)
- {
- file.IsDir = false;
- isAnti = false;
- file.Size = unpackSizes[sizeIndex];
- file.Crc = digests[sizeIndex];
- file.CrcDefined = digestsDefined[sizeIndex];
- sizeIndex++;
- }
- else
- {
- file.IsDir = !emptyFileVector[emptyFileIndex];
- isAnti = antiFileVector[emptyFileIndex];
- emptyFileIndex++;
- file.Size = 0;
- file.CrcDefined = false;
- }
- if (numAntiItems != 0)
- db.IsAnti.Add(isAnti);
- }
- return S_OK;
-}
-
-
-void CArchiveDatabaseEx::FillFolderStartPackStream()
-{
- FolderStartPackStreamIndex.Clear();
- FolderStartPackStreamIndex.Reserve(Folders.Size());
- CNum startPos = 0;
- for (int i = 0; i < Folders.Size(); i++)
- {
- FolderStartPackStreamIndex.Add(startPos);
- startPos += (CNum)Folders[i].PackStreams.Size();
- }
-}
-
-void CArchiveDatabaseEx::FillStartPos()
-{
- PackStreamStartPositions.Clear();
- PackStreamStartPositions.Reserve(PackSizes.Size());
- UInt64 startPos = 0;
- for (int i = 0; i < PackSizes.Size(); i++)
- {
- PackStreamStartPositions.Add(startPos);
- startPos += PackSizes[i];
- }
-}
-
-void CArchiveDatabaseEx::FillFolderStartFileIndex()
-{
- FolderStartFileIndex.Clear();
- FolderStartFileIndex.Reserve(Folders.Size());
- FileIndexToFolderIndexMap.Clear();
- FileIndexToFolderIndexMap.Reserve(Files.Size());
-
- int folderIndex = 0;
- CNum indexInFolder = 0;
- for (int i = 0; i < Files.Size(); i++)
- {
- const CFileItem &file = Files[i];
- bool emptyStream = !file.HasStream;
- if (emptyStream && indexInFolder == 0)
- {
- FileIndexToFolderIndexMap.Add(kNumNoIndex);
- continue;
- }
- if (indexInFolder == 0)
- {
- // v3.13 incorrectly worked with empty folders
- // v4.07: Loop for skipping empty folders
- for (;;)
- {
- if (folderIndex >= Folders.Size())
- ThrowIncorrect();
- FolderStartFileIndex.Add(i); // check it
- if (NumUnpackStreamsVector[folderIndex] != 0)
- break;
- folderIndex++;
- }
- }
- FileIndexToFolderIndexMap.Add(folderIndex);
- if (emptyStream)
- continue;
- indexInFolder++;
- if (indexInFolder >= NumUnpackStreamsVector[folderIndex])
- {
- folderIndex++;
- indexInFolder = 0;
- }
- }
-}
-
-HRESULT CInArchive::ReadDatabase2(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CArchiveDatabaseEx &db
- #ifndef _NO_CRYPTO
- , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
- #endif
- )
-{
- db.Clear();
- db.ArchiveInfo.StartPosition = _arhiveBeginStreamPosition;
-
- db.ArchiveInfo.Version.Major = _header[6];
- db.ArchiveInfo.Version.Minor = _header[7];
-
- if (db.ArchiveInfo.Version.Major != kMajorVersion)
- ThrowUnsupportedVersion();
-
- UInt32 crcFromArchive = Get32(_header + 8);
- UInt64 nextHeaderOffset = Get64(_header + 0xC);
- UInt64 nextHeaderSize = Get64(_header + 0x14);
- UInt32 nextHeaderCRC = Get32(_header + 0x1C);
- UInt32 crc = CrcCalc(_header + 0xC, 20);
-
- #ifdef FORMAT_7Z_RECOVERY
- if (crcFromArchive == 0 && nextHeaderOffset == 0 && nextHeaderSize == 0 && nextHeaderCRC == 0)
- {
- UInt64 cur, cur2;
- RINOK(_stream->Seek(0, STREAM_SEEK_CUR, &cur));
- const int kCheckSize = 500;
- Byte buf[kCheckSize];
- RINOK(_stream->Seek(0, STREAM_SEEK_END, &cur2));
- int checkSize = kCheckSize;
- if (cur2 - cur < static_cast< UInt64 >( kCheckSize ) )
- checkSize = (int)(cur2 - cur);
- RINOK(_stream->Seek(-checkSize, STREAM_SEEK_END, &cur2));
-
- RINOK(ReadStream_FALSE(_stream, buf, (size_t)checkSize));
-
- int i;
- for (i = (int)checkSize - 2; i >= 0; i--)
- if ((buf[i] == 0x17 && buf[i + 1] == 0x6) || (buf[i] == 0x01 && buf[i + 1] == 0x04))
- break;
- if (i < 0)
- return S_FALSE;
- nextHeaderSize = checkSize - i;
- nextHeaderOffset = cur2 - cur + i;
- nextHeaderCRC = CrcCalc(buf + i, (size_t)nextHeaderSize);
- RINOK(_stream->Seek(cur, STREAM_SEEK_SET, NULL));
- }
- #endif
-
- #ifdef FORMAT_7Z_RECOVERY
- crcFromArchive = crc;
- #endif
-
- db.ArchiveInfo.StartPositionAfterHeader = _arhiveBeginStreamPosition + kHeaderSize;
-
- if (crc != crcFromArchive)
- ThrowIncorrect();
-
- if (nextHeaderSize == 0)
- return S_OK;
-
- if (nextHeaderSize > (UInt64)0xFFFFFFFF)
- return S_FALSE;
-
- RINOK(_stream->Seek(nextHeaderOffset, STREAM_SEEK_CUR, NULL));
-
- CByteBuffer buffer2;
- buffer2.SetCapacity((size_t)nextHeaderSize);
-
- RINOK(ReadStream_FALSE(_stream, buffer2, (size_t)nextHeaderSize));
- HeadersSize += kHeaderSize + nextHeaderSize;
- db.PhySize = kHeaderSize + nextHeaderOffset + nextHeaderSize;
-
- if (CrcCalc(buffer2, (UInt32)nextHeaderSize) != nextHeaderCRC)
- ThrowIncorrect();
-
- CStreamSwitch streamSwitch;
- streamSwitch.Set(this, buffer2);
-
- CObjectVector<CByteBuffer> dataVector;
-
- UInt64 type = ReadID();
- if (type != NID::kHeader)
- {
- if (type != NID::kEncodedHeader)
- ThrowIncorrect();
- HRESULT result = ReadAndDecodePackedStreams(
- EXTERNAL_CODECS_LOC_VARS
- db.ArchiveInfo.StartPositionAfterHeader,
- db.ArchiveInfo.DataStartPosition2,
- dataVector
- #ifndef _NO_CRYPTO
- , getTextPassword, passwordIsDefined
- #endif
- );
- RINOK(result);
- if (dataVector.Size() == 0)
- return S_OK;
- if (dataVector.Size() > 1)
- ThrowIncorrect();
- streamSwitch.Remove();
- streamSwitch.Set(this, dataVector.Front());
- if (ReadID() != NID::kHeader)
- ThrowIncorrect();
- }
-
- db.HeadersSize = HeadersSize;
-
- return ReadHeader(
- EXTERNAL_CODECS_LOC_VARS
- db
- #ifndef _NO_CRYPTO
- , getTextPassword, passwordIsDefined
- #endif
- );
-}
-
-HRESULT CInArchive::ReadDatabase(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CArchiveDatabaseEx &db
- #ifndef _NO_CRYPTO
- , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
- #endif
- )
-{
- try
- {
- return ReadDatabase2(
- EXTERNAL_CODECS_LOC_VARS db
- #ifndef _NO_CRYPTO
- , getTextPassword, passwordIsDefined
- #endif
- );
- }
- catch(CInArchiveException &) { return S_FALSE; }
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zIn.h
deleted file mode 100644
index 971f27b2a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zIn.h
+++ /dev/null
@@ -1,245 +0,0 @@
-// 7zIn.h
-
-#ifndef __7Z_IN_H
-#define __7Z_IN_H
-
-#include "../../../Common/MyCom.h"
-
-#include "../../IPassword.h"
-#include "../../IStream.h"
-
-#include "../../Common/CreateCoder.h"
-#include "../../Common/InBuffer.h"
-
-#include "7zItem.h"
-
-namespace NArchive {
-namespace N7z {
-
-struct CInArchiveInfo
-{
- CArchiveVersion Version;
- UInt64 StartPosition;
- UInt64 StartPositionAfterHeader;
- UInt64 DataStartPosition;
- UInt64 DataStartPosition2;
- CRecordVector<UInt64> FileInfoPopIDs;
- void Clear()
- {
- FileInfoPopIDs.Clear();
- }
-};
-
-struct CArchiveDatabaseEx: public CArchiveDatabase
-{
- CInArchiveInfo ArchiveInfo;
- CRecordVector<UInt64> PackStreamStartPositions;
- CRecordVector<CNum> FolderStartPackStreamIndex;
- CRecordVector<CNum> FolderStartFileIndex;
- CRecordVector<CNum> FileIndexToFolderIndexMap;
-
- UInt64 HeadersSize;
- UInt64 PhySize;
-
- void Clear()
- {
- CArchiveDatabase::Clear();
- ArchiveInfo.Clear();
- PackStreamStartPositions.Clear();
- FolderStartPackStreamIndex.Clear();
- FolderStartFileIndex.Clear();
- FileIndexToFolderIndexMap.Clear();
-
- HeadersSize = 0;
- PhySize = 0;
- }
-
- void FillFolderStartPackStream();
- void FillStartPos();
- void FillFolderStartFileIndex();
-
- void Fill()
- {
- FillFolderStartPackStream();
- FillStartPos();
- FillFolderStartFileIndex();
- }
-
- UInt64 GetFolderStreamPos(int folderIndex, int indexInFolder) const
- {
- return ArchiveInfo.DataStartPosition +
- PackStreamStartPositions[FolderStartPackStreamIndex[folderIndex] + indexInFolder];
- }
-
- UInt64 GetFolderFullPackSize(int folderIndex) const
- {
- CNum packStreamIndex = FolderStartPackStreamIndex[folderIndex];
- const CFolder &folder = Folders[folderIndex];
- UInt64 size = 0;
- for (int i = 0; i < folder.PackStreams.Size(); i++)
- size += PackSizes[packStreamIndex + i];
- return size;
- }
-
- UInt64 GetFolderPackStreamSize(int folderIndex, int streamIndex) const
- {
- return PackSizes[FolderStartPackStreamIndex[folderIndex] + streamIndex];
- }
-
- UInt64 GetFilePackSize(CNum fileIndex) const
- {
- CNum folderIndex = FileIndexToFolderIndexMap[fileIndex];
- if (folderIndex != kNumNoIndex)
- if (FolderStartFileIndex[folderIndex] == fileIndex)
- return GetFolderFullPackSize(folderIndex);
- return 0;
- }
-};
-
-class CInByte2
-{
- const Byte *_buffer;
- size_t _size;
-public:
- size_t _pos;
- void Init(const Byte *buffer, size_t size)
- {
- _buffer = buffer;
- _size = size;
- _pos = 0;
- }
- Byte ReadByte();
- void ReadBytes(Byte *data, size_t size);
- void SkipData(UInt64 size);
- void SkipData();
- UInt64 ReadNumber();
- CNum ReadNum();
- UInt32 ReadUInt32();
- UInt64 ReadUInt64();
- void ReadString(UString &s);
-};
-
-class CStreamSwitch;
-
-const UInt32 kHeaderSize = 32;
-
-class CInArchive
-{
- friend class CStreamSwitch;
-
- CMyComPtr<IInStream> _stream;
-
- CObjectVector<CInByte2> _inByteVector;
- CInByte2 *_inByteBack;
-
- UInt64 _arhiveBeginStreamPosition;
-
- Byte _header[kHeaderSize];
-
- UInt64 HeadersSize;
-
- void AddByteStream(const Byte *buffer, size_t size)
- {
- _inByteVector.Add(CInByte2());
- _inByteBack = &_inByteVector.Back();
- _inByteBack->Init(buffer, size);
- }
-
- void DeleteByteStream()
- {
- _inByteVector.DeleteBack();
- if (!_inByteVector.IsEmpty())
- _inByteBack = &_inByteVector.Back();
- }
-
-private:
- HRESULT FindAndReadSignature(IInStream *stream, const UInt64 *searchHeaderSizeLimit);
-
- void ReadBytes(Byte *data, size_t size) { _inByteBack->ReadBytes(data, size); }
- Byte ReadByte() { return _inByteBack->ReadByte(); }
- UInt64 ReadNumber() { return _inByteBack->ReadNumber(); }
- CNum ReadNum() { return _inByteBack->ReadNum(); }
- UInt64 ReadID() { return _inByteBack->ReadNumber(); }
- UInt32 ReadUInt32() { return _inByteBack->ReadUInt32(); }
- UInt64 ReadUInt64() { return _inByteBack->ReadUInt64(); }
- void SkipData(UInt64 size) { _inByteBack->SkipData(size); }
- void SkipData() { _inByteBack->SkipData(); }
- void WaitAttribute(UInt64 attribute);
-
- void ReadArchiveProperties(CInArchiveInfo &archiveInfo);
- void GetNextFolderItem(CFolder &itemInfo);
- void ReadHashDigests(int numItems,
- CBoolVector &digestsDefined, CRecordVector<UInt32> &digests);
-
- void ReadPackInfo(
- UInt64 &dataOffset,
- CRecordVector<UInt64> &packSizes,
- CBoolVector &packCRCsDefined,
- CRecordVector<UInt32> &packCRCs);
-
- void ReadUnpackInfo(
- const CObjectVector<CByteBuffer> *dataVector,
- CObjectVector<CFolder> &folders);
-
- void ReadSubStreamsInfo(
- const CObjectVector<CFolder> &folders,
- CRecordVector<CNum> &numUnpackStreamsInFolders,
- CRecordVector<UInt64> &unpackSizes,
- CBoolVector &digestsDefined,
- CRecordVector<UInt32> &digests);
-
- void ReadStreamsInfo(
- const CObjectVector<CByteBuffer> *dataVector,
- UInt64 &dataOffset,
- CRecordVector<UInt64> &packSizes,
- CBoolVector &packCRCsDefined,
- CRecordVector<UInt32> &packCRCs,
- CObjectVector<CFolder> &folders,
- CRecordVector<CNum> &numUnpackStreamsInFolders,
- CRecordVector<UInt64> &unpackSizes,
- CBoolVector &digestsDefined,
- CRecordVector<UInt32> &digests);
-
-
- void ReadBoolVector(int numItems, CBoolVector &v);
- void ReadBoolVector2(int numItems, CBoolVector &v);
- void ReadUInt64DefVector(const CObjectVector<CByteBuffer> &dataVector,
- CUInt64DefVector &v, int numFiles);
- HRESULT ReadAndDecodePackedStreams(
- DECL_EXTERNAL_CODECS_LOC_VARS
- UInt64 baseOffset, UInt64 &dataOffset,
- CObjectVector<CByteBuffer> &dataVector
- #ifndef _NO_CRYPTO
- , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
- #endif
- );
- HRESULT ReadHeader(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CArchiveDatabaseEx &db
- #ifndef _NO_CRYPTO
- ,ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
- #endif
- );
- HRESULT ReadDatabase2(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CArchiveDatabaseEx &db
- #ifndef _NO_CRYPTO
- ,ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
- #endif
- );
-public:
- HRESULT Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit); // S_FALSE means is not archive
- void Close();
-
- HRESULT ReadDatabase(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CArchiveDatabaseEx &db
- #ifndef _NO_CRYPTO
- ,ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined
- #endif
- );
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zItem.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zItem.h
deleted file mode 100644
index 1c3068bb2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zItem.h
+++ /dev/null
@@ -1,258 +0,0 @@
-// 7zItem.h
-
-#ifndef __7Z_ITEM_H
-#define __7Z_ITEM_H
-
-#include "../../../Common/Buffer.h"
-#include "../../../Common/MyString.h"
-
-#include "../../Common/MethodId.h"
-
-#include "7zHeader.h"
-
-namespace NArchive {
-namespace N7z {
-
-typedef UInt32 CNum;
-const CNum kNumMax = 0x7FFFFFFF;
-const CNum kNumNoIndex = 0xFFFFFFFF;
-
-struct CCoderInfo
-{
- CMethodId MethodID;
- CByteBuffer Props;
- CNum NumInStreams;
- CNum NumOutStreams;
- bool IsSimpleCoder() const { return (NumInStreams == 1) && (NumOutStreams == 1); }
-};
-
-struct CBindPair
-{
- CNum InIndex;
- CNum OutIndex;
-};
-
-struct CFolder
-{
- CObjectVector<CCoderInfo> Coders;
- CRecordVector<CBindPair> BindPairs;
- CRecordVector<CNum> PackStreams;
- CRecordVector<UInt64> UnpackSizes;
- UInt32 UnpackCRC;
- bool UnpackCRCDefined;
-
- CFolder(): UnpackCRCDefined(false) {}
-
- UInt64 GetUnpackSize() const // test it
- {
- if (UnpackSizes.IsEmpty())
- return 0;
- for (int i = UnpackSizes.Size() - 1; i >= 0; i--)
- if (FindBindPairForOutStream(i) < 0)
- return UnpackSizes[i];
- throw 1;
- }
-
- CNum GetNumOutStreams() const
- {
- CNum result = 0;
- for (int i = 0; i < Coders.Size(); i++)
- result += Coders[i].NumOutStreams;
- return result;
- }
-
- int FindBindPairForInStream(CNum inStreamIndex) const
- {
- for(int i = 0; i < BindPairs.Size(); i++)
- if (BindPairs[i].InIndex == inStreamIndex)
- return i;
- return -1;
- }
- int FindBindPairForOutStream(CNum outStreamIndex) const
- {
- for(int i = 0; i < BindPairs.Size(); i++)
- if (BindPairs[i].OutIndex == outStreamIndex)
- return i;
- return -1;
- }
- int FindPackStreamArrayIndex(CNum inStreamIndex) const
- {
- for(int i = 0; i < PackStreams.Size(); i++)
- if (PackStreams[i] == inStreamIndex)
- return i;
- return -1;
- }
-
- bool CheckStructure() const;
-};
-
-struct CUInt64DefVector
-{
- CRecordVector<UInt64> Values;
- CRecordVector<bool> Defined;
-
- void Clear()
- {
- Values.Clear();
- Defined.Clear();
- }
-
- void ReserveDown()
- {
- Values.ReserveDown();
- Values.ReserveDown();
- }
-
- bool GetItem(int index, UInt64 &value) const
- {
- if (index < Defined.Size() && Defined[index])
- {
- value = Values[index];
- return true;
- }
- value = 0;
- return false;
- }
-
- void SetItem(int index, bool defined, UInt64 value)
- {
- while (index >= Defined.Size())
- Defined.Add(false);
- Defined[index] = defined;
- if (!defined)
- return;
- while (index >= Values.Size())
- Values.Add(0);
- Values[index] = value;
- }
-
- bool CheckSize(int size) const { return Defined.Size() == size || Defined.Size() == 0; }
-};
-
-struct CFileItem
-{
- UInt64 Size;
- UInt32 Attrib;
- UInt32 Crc;
- UString Name;
-
- bool HasStream; // Test it !!! it means that there is
- // stream in some folder. It can be empty stream
- bool IsDir;
- bool CrcDefined;
- bool AttribDefined;
-
- CFileItem():
- HasStream(true),
- IsDir(false),
- CrcDefined(false),
- AttribDefined(false)
- {}
- void SetAttrib(UInt32 attrib)
- {
- AttribDefined = true;
- Attrib = attrib;
- }
-};
-
-struct CFileItem2
-{
- UInt64 CTime;
- UInt64 ATime;
- UInt64 MTime;
- UInt64 StartPos;
- bool CTimeDefined;
- bool ATimeDefined;
- bool MTimeDefined;
- bool StartPosDefined;
- bool IsAnti;
-};
-
-struct CArchiveDatabase
-{
- CRecordVector<UInt64> PackSizes;
- CRecordVector<bool> PackCRCsDefined;
- CRecordVector<UInt32> PackCRCs;
- CObjectVector<CFolder> Folders;
- CRecordVector<CNum> NumUnpackStreamsVector;
- CObjectVector<CFileItem> Files;
-
- CUInt64DefVector CTime;
- CUInt64DefVector ATime;
- CUInt64DefVector MTime;
- CUInt64DefVector StartPos;
- CRecordVector<bool> IsAnti;
-
- void Clear()
- {
- PackSizes.Clear();
- PackCRCsDefined.Clear();
- PackCRCs.Clear();
- Folders.Clear();
- NumUnpackStreamsVector.Clear();
- Files.Clear();
- CTime.Clear();
- ATime.Clear();
- MTime.Clear();
- StartPos.Clear();
- IsAnti.Clear();
- }
-
- void ReserveDown()
- {
- PackSizes.ReserveDown();
- PackCRCsDefined.ReserveDown();
- PackCRCs.ReserveDown();
- Folders.ReserveDown();
- NumUnpackStreamsVector.ReserveDown();
- Files.ReserveDown();
- CTime.ReserveDown();
- ATime.ReserveDown();
- MTime.ReserveDown();
- StartPos.ReserveDown();
- IsAnti.ReserveDown();
- }
-
- bool IsEmpty() const
- {
- return (PackSizes.IsEmpty() &&
- PackCRCsDefined.IsEmpty() &&
- PackCRCs.IsEmpty() &&
- Folders.IsEmpty() &&
- NumUnpackStreamsVector.IsEmpty() &&
- Files.IsEmpty());
- }
-
- bool CheckNumFiles() const
- {
- int size = Files.Size();
- return (
- CTime.CheckSize(size) &&
- ATime.CheckSize(size) &&
- MTime.CheckSize(size) &&
- StartPos.CheckSize(size) &&
- (size == IsAnti.Size() || IsAnti.Size() == 0));
- }
-
- bool IsSolid() const
- {
- for (int i = 0; i < NumUnpackStreamsVector.Size(); i++)
- if (NumUnpackStreamsVector[i] > 1)
- return true;
- return false;
- }
- bool IsItemAnti(int index) const { return (index < IsAnti.Size() && IsAnti[index]); }
- void SetItemAnti(int index, bool isAnti)
- {
- while (index >= IsAnti.Size())
- IsAnti.Add(false);
- IsAnti[index] = isAnti;
- }
-
- void GetFile(int index, CFileItem &file, CFileItem2 &file2) const;
- void AddFile(const CFileItem &file, const CFileItem2 &file2);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zOut.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zOut.cpp
deleted file mode 100644
index 1bd8c4c36..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zOut.cpp
+++ /dev/null
@@ -1,874 +0,0 @@
-// 7zOut.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/7zCrc.h"
-
-#include "../../../Common/AutoPtr.h"
-
-#include "../../Common/StreamObjects.h"
-
-#include "7zOut.h"
-
-static HRESULT WriteBytes(ISequentialOutStream *stream, const void *data, size_t size)
-{
- while (size > 0)
- {
- UInt32 curSize = (UInt32)MyMin(size, (size_t)0xFFFFFFFF);
- UInt32 processedSize;
- RINOK(stream->Write(data, curSize, &processedSize));
- if (processedSize == 0)
- return E_FAIL;
- data = (const void *)((const Byte *)data + processedSize);
- size -= processedSize;
- }
- return S_OK;
-}
-
-namespace NArchive {
-namespace N7z {
-
-HRESULT COutArchive::WriteDirect(const void *data, UInt32 size)
-{
- return ::WriteBytes(SeqStream, data, size);
-}
-
-HRESULT COutArchive::WriteSignature()
-{
- Byte buf[8];
- memcpy(buf, kSignature, kSignatureSize);
- buf[kSignatureSize] = kMajorVersion;
- buf[kSignatureSize + 1] = 3;
- return WriteDirect(buf, 8);
-}
-
-#ifdef _7Z_VOL
-HRESULT COutArchive::WriteFinishSignature()
-{
- RINOK(WriteDirect(kFinishSignature, kSignatureSize));
- CArchiveVersion av;
- av.Major = kMajorVersion;
- av.Minor = 2;
- RINOK(WriteDirectByte(av.Major));
- return WriteDirectByte(av.Minor);
-}
-#endif
-
-static void SetUInt32(Byte *p, UInt32 d)
-{
- for (int i = 0; i < 4; i++, d >>= 8)
- p[i] = (Byte)d;
-}
-
-static void SetUInt64(Byte *p, UInt64 d)
-{
- for (int i = 0; i < 8; i++, d >>= 8)
- p[i] = (Byte)d;
-}
-
-HRESULT COutArchive::WriteStartHeader(const CStartHeader &h)
-{
- Byte buf[24];
- SetUInt64(buf + 4, h.NextHeaderOffset);
- SetUInt64(buf + 12, h.NextHeaderSize);
- SetUInt32(buf + 20, h.NextHeaderCRC);
- SetUInt32(buf, CrcCalc(buf + 4, 20));
- return WriteDirect(buf, 24);
-}
-
-#ifdef _7Z_VOL
-HRESULT COutArchive::WriteFinishHeader(const CFinishHeader &h)
-{
- CCRC crc;
- crc.UpdateUInt64(h.NextHeaderOffset);
- crc.UpdateUInt64(h.NextHeaderSize);
- crc.UpdateUInt32(h.NextHeaderCRC);
- crc.UpdateUInt64(h.ArchiveStartOffset);
- crc.UpdateUInt64(h.AdditionalStartBlockSize);
- RINOK(WriteDirectUInt32(crc.GetDigest()));
- RINOK(WriteDirectUInt64(h.NextHeaderOffset));
- RINOK(WriteDirectUInt64(h.NextHeaderSize));
- RINOK(WriteDirectUInt32(h.NextHeaderCRC));
- RINOK(WriteDirectUInt64(h.ArchiveStartOffset));
- return WriteDirectUInt64(h.AdditionalStartBlockSize);
-}
-#endif
-
-HRESULT COutArchive::Create(ISequentialOutStream *stream, bool endMarker)
-{
- Close();
- #ifdef _7Z_VOL
- // endMarker = false;
- _endMarker = endMarker;
- #endif
- SeqStream = stream;
- if (!endMarker)
- {
- SeqStream.QueryInterface(IID_IOutStream, &Stream);
- if (!Stream)
- {
- return E_NOTIMPL;
- // endMarker = true;
- }
- }
- #ifdef _7Z_VOL
- if (endMarker)
- {
- /*
- CStartHeader sh;
- sh.NextHeaderOffset = (UInt32)(Int32)-1;
- sh.NextHeaderSize = (UInt32)(Int32)-1;
- sh.NextHeaderCRC = 0;
- WriteStartHeader(sh);
- */
- }
- else
- #endif
- {
- if (!Stream)
- return E_FAIL;
- RINOK(WriteSignature());
- RINOK(Stream->Seek(0, STREAM_SEEK_CUR, &_prefixHeaderPos));
- }
- return S_OK;
-}
-
-void COutArchive::Close()
-{
- SeqStream.Release();
- Stream.Release();
-}
-
-HRESULT COutArchive::SkipPrefixArchiveHeader()
-{
- #ifdef _7Z_VOL
- if (_endMarker)
- return S_OK;
- #endif
- return Stream->Seek(24, STREAM_SEEK_CUR, NULL);
-}
-
-UInt64 COutArchive::GetPos() const
-{
- if (_countMode)
- return _countSize;
- if (_writeToStream)
- return _outByte.GetProcessedSize();
- return _outByte2.GetPos();
-}
-
-void COutArchive::WriteBytes(const void *data, size_t size)
-{
- if (_countMode)
- _countSize += size;
- else if (_writeToStream)
- {
- _outByte.WriteBytes(data, size);
- _crc = CrcUpdate(_crc, data, size);
- }
- else
- _outByte2.WriteBytes(data, size);
-}
-
-void COutArchive::WriteByte(Byte b)
-{
- if (_countMode)
- _countSize++;
- else if (_writeToStream)
- {
- _outByte.WriteByte(b);
- _crc = CRC_UPDATE_BYTE(_crc, b);
- }
- else
- _outByte2.WriteByte(b);
-}
-
-void COutArchive::WriteUInt32(UInt32 value)
-{
- for (int i = 0; i < 4; i++)
- {
- WriteByte((Byte)value);
- value >>= 8;
- }
-}
-
-void COutArchive::WriteUInt64(UInt64 value)
-{
- for (int i = 0; i < 8; i++)
- {
- WriteByte((Byte)value);
- value >>= 8;
- }
-}
-
-void COutArchive::WriteNumber(UInt64 value)
-{
- Byte firstByte = 0;
- Byte mask = 0x80;
- int i;
- for (i = 0; i < 8; i++)
- {
- if (value < ((UInt64(1) << ( 7 * (i + 1)))))
- {
- firstByte |= Byte(value >> (8 * i));
- break;
- }
- firstByte |= mask;
- mask >>= 1;
- }
- WriteByte(firstByte);
- for (;i > 0; i--)
- {
- WriteByte((Byte)value);
- value >>= 8;
- }
-}
-
-static UInt32 GetBigNumberSize(UInt64 value)
-{
- int i;
- for (i = 1; i < 9; i++)
- if (value < (((UInt64)1 << (i * 7))))
- break;
- return i;
-}
-
-#ifdef _7Z_VOL
-UInt32 COutArchive::GetVolHeadersSize(UInt64 dataSize, int nameLength, bool props)
-{
- UInt32 result = GetBigNumberSize(dataSize) * 2 + 41;
- if (nameLength != 0)
- {
- nameLength = (nameLength + 1) * 2;
- result += nameLength + GetBigNumberSize(nameLength) + 2;
- }
- if (props)
- {
- result += 20;
- }
- if (result >= 128)
- result++;
- result += kSignatureSize + 2 + kFinishHeaderSize;
- return result;
-}
-
-UInt64 COutArchive::GetVolPureSize(UInt64 volSize, int nameLength, bool props)
-{
- UInt32 headersSizeBase = COutArchive::GetVolHeadersSize(1, nameLength, props);
- int testSize;
- if (volSize > headersSizeBase)
- testSize = volSize - headersSizeBase;
- else
- testSize = 1;
- UInt32 headersSize = COutArchive::GetVolHeadersSize(testSize, nameLength, props);
- UInt64 pureSize = 1;
- if (volSize > headersSize)
- pureSize = volSize - headersSize;
- return pureSize;
-}
-#endif
-
-void COutArchive::WriteFolder(const CFolder &folder)
-{
- WriteNumber(folder.Coders.Size());
- int i;
- for (i = 0; i < folder.Coders.Size(); i++)
- {
- const CCoderInfo &coder = folder.Coders[i];
- {
- size_t propsSize = coder.Props.GetCapacity();
-
- UInt64 id = coder.MethodID;
- unsigned int idSize;
- for (idSize = 1; idSize < sizeof(id); idSize++)
- if ((id >> (8 * idSize)) == 0)
- break;
- BYTE longID[15];
- for (int t = idSize - 1; t >= 0 ; t--, id >>= 8)
- longID[t] = (Byte)(id & 0xFF);
- Byte b;
- b = (Byte)(idSize & 0xF);
- bool isComplex = !coder.IsSimpleCoder();
- b |= (isComplex ? 0x10 : 0);
- b |= ((propsSize != 0) ? 0x20 : 0 );
- WriteByte(b);
- WriteBytes(longID, idSize);
- if (isComplex)
- {
- WriteNumber(coder.NumInStreams);
- WriteNumber(coder.NumOutStreams);
- }
- if (propsSize == 0)
- continue;
- WriteNumber(propsSize);
- WriteBytes(coder.Props, propsSize);
- }
- }
- for (i = 0; i < folder.BindPairs.Size(); i++)
- {
- const CBindPair &bindPair = folder.BindPairs[i];
- WriteNumber(bindPair.InIndex);
- WriteNumber(bindPair.OutIndex);
- }
- if (folder.PackStreams.Size() > 1)
- for (i = 0; i < folder.PackStreams.Size(); i++)
- {
- WriteNumber(folder.PackStreams[i]);
- }
-}
-
-void COutArchive::WriteBoolVector(const CBoolVector &boolVector)
-{
- Byte b = 0;
- Byte mask = 0x80;
- for (int i = 0; i < boolVector.Size(); i++)
- {
- if (boolVector[i])
- b |= mask;
- mask >>= 1;
- if (mask == 0)
- {
- WriteByte(b);
- mask = 0x80;
- b = 0;
- }
- }
- if (mask != 0x80)
- WriteByte(b);
-}
-
-
-void COutArchive::WriteHashDigests(
- const CRecordVector<bool> &digestsDefined,
- const CRecordVector<UInt32> &digests)
-{
- int numDefined = 0;
- int i;
- for (i = 0; i < digestsDefined.Size(); i++)
- if (digestsDefined[i])
- numDefined++;
- if (numDefined == 0)
- return;
-
- WriteByte(NID::kCRC);
- if (numDefined == digestsDefined.Size())
- WriteByte(1);
- else
- {
- WriteByte(0);
- WriteBoolVector(digestsDefined);
- }
- for (i = 0; i < digests.Size(); i++)
- if (digestsDefined[i])
- WriteUInt32(digests[i]);
-}
-
-void COutArchive::WritePackInfo(
- UInt64 dataOffset,
- const CRecordVector<UInt64> &packSizes,
- const CRecordVector<bool> &packCRCsDefined,
- const CRecordVector<UInt32> &packCRCs)
-{
- if (packSizes.IsEmpty())
- return;
- WriteByte(NID::kPackInfo);
- WriteNumber(dataOffset);
- WriteNumber(packSizes.Size());
- WriteByte(NID::kSize);
- for (int i = 0; i < packSizes.Size(); i++)
- WriteNumber(packSizes[i]);
-
- WriteHashDigests(packCRCsDefined, packCRCs);
-
- WriteByte(NID::kEnd);
-}
-
-void COutArchive::WriteUnpackInfo(const CObjectVector<CFolder> &folders)
-{
- if (folders.IsEmpty())
- return;
-
- WriteByte(NID::kUnpackInfo);
-
- WriteByte(NID::kFolder);
- WriteNumber(folders.Size());
- {
- WriteByte(0);
- for (int i = 0; i < folders.Size(); i++)
- WriteFolder(folders[i]);
- }
-
- WriteByte(NID::kCodersUnpackSize);
- int i;
- for (i = 0; i < folders.Size(); i++)
- {
- const CFolder &folder = folders[i];
- for (int j = 0; j < folder.UnpackSizes.Size(); j++)
- WriteNumber(folder.UnpackSizes[j]);
- }
-
- CRecordVector<bool> unpackCRCsDefined;
- CRecordVector<UInt32> unpackCRCs;
- for (i = 0; i < folders.Size(); i++)
- {
- const CFolder &folder = folders[i];
- unpackCRCsDefined.Add(folder.UnpackCRCDefined);
- unpackCRCs.Add(folder.UnpackCRC);
- }
- WriteHashDigests(unpackCRCsDefined, unpackCRCs);
-
- WriteByte(NID::kEnd);
-}
-
-void COutArchive::WriteSubStreamsInfo(
- const CObjectVector<CFolder> &folders,
- const CRecordVector<CNum> &numUnpackStreamsInFolders,
- const CRecordVector<UInt64> &unpackSizes,
- const CRecordVector<bool> &digestsDefined,
- const CRecordVector<UInt32> &digests)
-{
- WriteByte(NID::kSubStreamsInfo);
-
- int i;
- for (i = 0; i < numUnpackStreamsInFolders.Size(); i++)
- {
- if (numUnpackStreamsInFolders[i] != 1)
- {
- WriteByte(NID::kNumUnpackStream);
- for (i = 0; i < numUnpackStreamsInFolders.Size(); i++)
- WriteNumber(numUnpackStreamsInFolders[i]);
- break;
- }
- }
-
-
- bool needFlag = true;
- CNum index = 0;
- for (i = 0; i < numUnpackStreamsInFolders.Size(); i++)
- for (CNum j = 0; j < numUnpackStreamsInFolders[i]; j++)
- {
- if (j + 1 != numUnpackStreamsInFolders[i])
- {
- if (needFlag)
- WriteByte(NID::kSize);
- needFlag = false;
- WriteNumber(unpackSizes[index]);
- }
- index++;
- }
-
- CRecordVector<bool> digestsDefined2;
- CRecordVector<UInt32> digests2;
-
- int digestIndex = 0;
- for (i = 0; i < folders.Size(); i++)
- {
- int numSubStreams = (int)numUnpackStreamsInFolders[i];
- if (numSubStreams == 1 && folders[i].UnpackCRCDefined)
- digestIndex++;
- else
- for (int j = 0; j < numSubStreams; j++, digestIndex++)
- {
- digestsDefined2.Add(digestsDefined[digestIndex]);
- digests2.Add(digests[digestIndex]);
- }
- }
- WriteHashDigests(digestsDefined2, digests2);
- WriteByte(NID::kEnd);
-}
-
-void COutArchive::SkipAlign(unsigned /* pos */, unsigned /* alignSize */)
-{
- return;
-}
-
-/*
-7-Zip 4.50 - 4.58 contain BUG, so they do not support .7z archives with Unknown field.
-
-void COutArchive::SkipAlign(unsigned pos, unsigned alignSize)
-{
- pos += (unsigned)GetPos();
- pos &= (alignSize - 1);
- if (pos == 0)
- return;
- unsigned skip = alignSize - pos;
- if (skip < 2)
- skip += alignSize;
- skip -= 2;
- WriteByte(NID::kDummy);
- WriteByte((Byte)skip);
- for (unsigned i = 0; i < skip; i++)
- WriteByte(0);
-}
-*/
-
-void COutArchive::WriteAlignedBoolHeader(const CBoolVector &v, int numDefined, Byte type, unsigned itemSize)
-{
- const UInt64 bvSize = (numDefined == v.Size()) ? 0 : (v.Size() + 7) / 8;
- const UInt64 dataSize = (UInt64)numDefined * itemSize + bvSize + 2;
- SkipAlign(3 + (unsigned)bvSize + (unsigned)GetBigNumberSize(dataSize), itemSize);
-
- WriteByte(type);
- WriteNumber(dataSize);
- if (numDefined == v.Size())
- WriteByte(1);
- else
- {
- WriteByte(0);
- WriteBoolVector(v);
- }
- WriteByte(0);
-}
-
-void COutArchive::WriteUInt64DefVector(const CUInt64DefVector &v, Byte type)
-{
- int numDefined = 0;
-
- int i;
- for (i = 0; i < v.Defined.Size(); i++)
- if (v.Defined[i])
- numDefined++;
-
- if (numDefined == 0)
- return;
-
- WriteAlignedBoolHeader(v.Defined, numDefined, type, 8);
-
- for (i = 0; i < v.Defined.Size(); i++)
- if (v.Defined[i])
- WriteUInt64(v.Values[i]);
-}
-
-HRESULT COutArchive::EncodeStream(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CEncoder &encoder, const Byte *data, size_t dataSize,
- CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders)
-{
- CSequentialInStreamImp *streamSpec = new CSequentialInStreamImp;
- CMyComPtr<ISequentialInStream> stream = streamSpec;
- streamSpec->Init(data, dataSize);
- CFolder folderItem;
- folderItem.UnpackCRCDefined = true;
- folderItem.UnpackCRC = CrcCalc(data, dataSize);
- UInt64 dataSize64 = dataSize;
- RINOK(encoder.Encode(
- EXTERNAL_CODECS_LOC_VARS
- stream, NULL, &dataSize64, folderItem, SeqStream, packSizes, NULL))
- folders.Add(folderItem);
- return S_OK;
-}
-
-HRESULT COutArchive::EncodeStream(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CEncoder &encoder, const CByteBuffer &data,
- CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders)
-{
- return EncodeStream(
- EXTERNAL_CODECS_LOC_VARS
- encoder, data, data.GetCapacity(), packSizes, folders);
-}
-
-void COutArchive::WriteHeader(
- const CArchiveDatabase &db,
- const CHeaderOptions &headerOptions,
- UInt64 &headerOffset)
-{
- int i;
-
- UInt64 packedSize = 0;
- for (i = 0; i < db.PackSizes.Size(); i++)
- packedSize += db.PackSizes[i];
-
- headerOffset = packedSize;
-
- WriteByte(NID::kHeader);
-
- // Archive Properties
-
- if (db.Folders.Size() > 0)
- {
- WriteByte(NID::kMainStreamsInfo);
- WritePackInfo(0, db.PackSizes,
- db.PackCRCsDefined,
- db.PackCRCs);
-
- WriteUnpackInfo(db.Folders);
-
- CRecordVector<UInt64> unpackSizes;
- CRecordVector<bool> digestsDefined;
- CRecordVector<UInt32> digests;
- for (i = 0; i < db.Files.Size(); i++)
- {
- const CFileItem &file = db.Files[i];
- if (!file.HasStream)
- continue;
- unpackSizes.Add(file.Size);
- digestsDefined.Add(file.CrcDefined);
- digests.Add(file.Crc);
- }
-
- WriteSubStreamsInfo(
- db.Folders,
- db.NumUnpackStreamsVector,
- unpackSizes,
- digestsDefined,
- digests);
- WriteByte(NID::kEnd);
- }
-
- if (db.Files.IsEmpty())
- {
- WriteByte(NID::kEnd);
- return;
- }
-
- WriteByte(NID::kFilesInfo);
- WriteNumber(db.Files.Size());
-
- {
- /* ---------- Empty Streams ---------- */
- CBoolVector emptyStreamVector;
- emptyStreamVector.Reserve(db.Files.Size());
- int numEmptyStreams = 0;
- for (i = 0; i < db.Files.Size(); i++)
- if (db.Files[i].HasStream)
- emptyStreamVector.Add(false);
- else
- {
- emptyStreamVector.Add(true);
- numEmptyStreams++;
- }
- if (numEmptyStreams > 0)
- {
- WriteByte(NID::kEmptyStream);
- WriteNumber((emptyStreamVector.Size() + 7) / 8);
- WriteBoolVector(emptyStreamVector);
-
- CBoolVector emptyFileVector, antiVector;
- emptyFileVector.Reserve(numEmptyStreams);
- antiVector.Reserve(numEmptyStreams);
- CNum numEmptyFiles = 0, numAntiItems = 0;
- for (i = 0; i < db.Files.Size(); i++)
- {
- const CFileItem &file = db.Files[i];
- if (!file.HasStream)
- {
- emptyFileVector.Add(!file.IsDir);
- if (!file.IsDir)
- numEmptyFiles++;
- bool isAnti = db.IsItemAnti(i);
- antiVector.Add(isAnti);
- if (isAnti)
- numAntiItems++;
- }
- }
-
- if (numEmptyFiles > 0)
- {
- WriteByte(NID::kEmptyFile);
- WriteNumber((emptyFileVector.Size() + 7) / 8);
- WriteBoolVector(emptyFileVector);
- }
-
- if (numAntiItems > 0)
- {
- WriteByte(NID::kAnti);
- WriteNumber((antiVector.Size() + 7) / 8);
- WriteBoolVector(antiVector);
- }
- }
- }
-
-
- {
- /* ---------- Names ---------- */
-
- int numDefined = 0;
- size_t namesDataSize = 0;
- for (int i = 0; i < db.Files.Size(); i++)
- {
- const UString &name = db.Files[i].Name;
- if (!name.IsEmpty())
- numDefined++;
- namesDataSize += (name.Length() + 1) * 2;
- }
-
- if (numDefined > 0)
- {
- namesDataSize++;
- SkipAlign(2 + GetBigNumberSize(namesDataSize), 2);
-
- WriteByte(NID::kName);
- WriteNumber(namesDataSize);
- WriteByte(0);
- for (int i = 0; i < db.Files.Size(); i++)
- {
- const UString &name = db.Files[i].Name;
- for (int t = 0; t <= name.Length(); t++)
- {
- wchar_t c = name[t];
- WriteByte((Byte)c);
- WriteByte((Byte)(c >> 8));
- }
- }
- }
- }
-
- if (headerOptions.WriteCTime) WriteUInt64DefVector(db.CTime, NID::kCTime);
- if (headerOptions.WriteATime) WriteUInt64DefVector(db.ATime, NID::kATime);
- if (headerOptions.WriteMTime) WriteUInt64DefVector(db.MTime, NID::kMTime);
- WriteUInt64DefVector(db.StartPos, NID::kStartPos);
-
- {
- /* ---------- Write Attrib ---------- */
- CBoolVector boolVector;
- boolVector.Reserve(db.Files.Size());
- int numDefined = 0;
- for (i = 0; i < db.Files.Size(); i++)
- {
- bool defined = db.Files[i].AttribDefined;
- boolVector.Add(defined);
- if (defined)
- numDefined++;
- }
- if (numDefined > 0)
- {
- WriteAlignedBoolHeader(boolVector, numDefined, NID::kWinAttributes, 4);
- for (i = 0; i < db.Files.Size(); i++)
- {
- const CFileItem &file = db.Files[i];
- if (file.AttribDefined)
- WriteUInt32(file.Attrib);
- }
- }
- }
-
- WriteByte(NID::kEnd); // for files
- WriteByte(NID::kEnd); // for headers
-}
-
-HRESULT COutArchive::WriteDatabase(
- DECL_EXTERNAL_CODECS_LOC_VARS
- const CArchiveDatabase &db,
- const CCompressionMethodMode *options,
- const CHeaderOptions &headerOptions)
-{
- if (!db.CheckNumFiles())
- return E_FAIL;
-
- UInt64 headerOffset;
- UInt32 headerCRC;
- UInt64 headerSize;
- if (db.IsEmpty())
- {
- headerSize = 0;
- headerOffset = 0;
- headerCRC = CrcCalc(0, 0);
- }
- else
- {
- bool encodeHeaders = false;
- if (options != 0)
- if (options->IsEmpty())
- options = 0;
- if (options != 0)
- if (options->PasswordIsDefined || headerOptions.CompressMainHeader)
- encodeHeaders = true;
-
- _outByte.SetStream(SeqStream);
- _outByte.Init();
- _crc = CRC_INIT_VAL;
- _countMode = encodeHeaders;
- _writeToStream = true;
- _countSize = 0;
- WriteHeader(db, headerOptions, headerOffset);
-
- if (encodeHeaders)
- {
- CByteBuffer buf;
- buf.SetCapacity(_countSize);
- _outByte2.Init((Byte *)buf, _countSize);
-
- _countMode = false;
- _writeToStream = false;
- WriteHeader(db, headerOptions, headerOffset);
-
- if (_countSize != _outByte2.GetPos())
- return E_FAIL;
-
- CCompressionMethodMode encryptOptions;
- encryptOptions.PasswordIsDefined = options->PasswordIsDefined;
- encryptOptions.Password = options->Password;
- CEncoder encoder(headerOptions.CompressMainHeader ? *options : encryptOptions);
- CRecordVector<UInt64> packSizes;
- CObjectVector<CFolder> folders;
- RINOK(EncodeStream(
- EXTERNAL_CODECS_LOC_VARS
- encoder, (const Byte *)buf,
- _countSize, packSizes, folders));
-
- _writeToStream = true;
-
- if (folders.Size() == 0)
- throw 1;
-
- WriteID(NID::kEncodedHeader);
- WritePackInfo(headerOffset, packSizes,
- CRecordVector<bool>(), CRecordVector<UInt32>());
- WriteUnpackInfo(folders);
- WriteByte(NID::kEnd);
- for (int i = 0; i < packSizes.Size(); i++)
- headerOffset += packSizes[i];
- }
- RINOK(_outByte.Flush());
- headerCRC = CRC_GET_DIGEST(_crc);
- headerSize = _outByte.GetProcessedSize();
- }
- #ifdef _7Z_VOL
- if (_endMarker)
- {
- CFinishHeader h;
- h.NextHeaderSize = headerSize;
- h.NextHeaderCRC = headerCRC;
- h.NextHeaderOffset =
- UInt64(0) - (headerSize +
- 4 + kFinishHeaderSize);
- h.ArchiveStartOffset = h.NextHeaderOffset - headerOffset;
- h.AdditionalStartBlockSize = 0;
- RINOK(WriteFinishHeader(h));
- return WriteFinishSignature();
- }
- else
- #endif
- {
- CStartHeader h;
- h.NextHeaderSize = headerSize;
- h.NextHeaderCRC = headerCRC;
- h.NextHeaderOffset = headerOffset;
- RINOK(Stream->Seek(_prefixHeaderPos, STREAM_SEEK_SET, NULL));
- return WriteStartHeader(h);
- }
-}
-
-void CArchiveDatabase::GetFile(int index, CFileItem &file, CFileItem2 &file2) const
-{
- file = Files[index];
- file2.CTimeDefined = CTime.GetItem(index, file2.CTime);
- file2.ATimeDefined = ATime.GetItem(index, file2.ATime);
- file2.MTimeDefined = MTime.GetItem(index, file2.MTime);
- file2.StartPosDefined = StartPos.GetItem(index, file2.StartPos);
- file2.IsAnti = IsItemAnti(index);
-}
-
-void CArchiveDatabase::AddFile(const CFileItem &file, const CFileItem2 &file2)
-{
- int index = Files.Size();
- CTime.SetItem(index, file2.CTimeDefined, file2.CTime);
- ATime.SetItem(index, file2.ATimeDefined, file2.ATime);
- MTime.SetItem(index, file2.MTimeDefined, file2.MTime);
- StartPos.SetItem(index, file2.StartPosDefined, file2.StartPos);
- SetItemAnti(index, file2.IsAnti);
- Files.Add(file);
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zOut.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zOut.h
deleted file mode 100644
index 9d8ef3083..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zOut.h
+++ /dev/null
@@ -1,156 +0,0 @@
-// 7zOut.h
-
-#ifndef __7Z_OUT_H
-#define __7Z_OUT_H
-
-#include "7zCompressionMode.h"
-#include "7zEncode.h"
-#include "7zHeader.h"
-#include "7zItem.h"
-
-#include "../../Common/OutBuffer.h"
-
-namespace NArchive {
-namespace N7z {
-
-class CWriteBufferLoc
-{
- Byte *_data;
- size_t _size;
- size_t _pos;
-public:
- CWriteBufferLoc(): _size(0), _pos(0) {}
- void Init(Byte *data, size_t size)
- {
- _data = data;
- _size = size;
- _pos = 0;
- }
- void WriteBytes(const void *data, size_t size)
- {
- if (size > _size - _pos)
- throw 1;
- memcpy(_data + _pos, data, size);
- _pos += size;
- }
- void WriteByte(Byte b)
- {
- if (_size == _pos)
- throw 1;
- _data[_pos++] = b;
- }
- size_t GetPos() const { return _pos; }
-};
-
-struct CHeaderOptions
-{
- bool CompressMainHeader;
- bool WriteCTime;
- bool WriteATime;
- bool WriteMTime;
-
- CHeaderOptions():
- CompressMainHeader(true),
- WriteCTime(false),
- WriteATime(false),
- WriteMTime(true)
- {}
-};
-
-class COutArchive
-{
- UInt64 _prefixHeaderPos;
-
- HRESULT WriteDirect(const void *data, UInt32 size);
-
- UInt64 GetPos() const;
- void WriteBytes(const void *data, size_t size);
- void WriteBytes(const CByteBuffer &data) { WriteBytes(data, data.GetCapacity()); }
- void WriteByte(Byte b);
- void WriteUInt32(UInt32 value);
- void WriteUInt64(UInt64 value);
- void WriteNumber(UInt64 value);
- void WriteID(UInt64 value) { WriteNumber(value); }
-
- void WriteFolder(const CFolder &folder);
- HRESULT WriteFileHeader(const CFileItem &itemInfo);
- void WriteBoolVector(const CBoolVector &boolVector);
- void WriteHashDigests(
- const CRecordVector<bool> &digestsDefined,
- const CRecordVector<UInt32> &hashDigests);
-
- void WritePackInfo(
- UInt64 dataOffset,
- const CRecordVector<UInt64> &packSizes,
- const CRecordVector<bool> &packCRCsDefined,
- const CRecordVector<UInt32> &packCRCs);
-
- void WriteUnpackInfo(const CObjectVector<CFolder> &folders);
-
- void WriteSubStreamsInfo(
- const CObjectVector<CFolder> &folders,
- const CRecordVector<CNum> &numUnpackStreamsInFolders,
- const CRecordVector<UInt64> &unpackSizes,
- const CRecordVector<bool> &digestsDefined,
- const CRecordVector<UInt32> &hashDigests);
-
- void SkipAlign(unsigned pos, unsigned alignSize);
- void WriteAlignedBoolHeader(const CBoolVector &v, int numDefined, Byte type, unsigned itemSize);
- void WriteUInt64DefVector(const CUInt64DefVector &v, Byte type);
-
- HRESULT EncodeStream(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CEncoder &encoder, const Byte *data, size_t dataSize,
- CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders);
- HRESULT EncodeStream(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CEncoder &encoder, const CByteBuffer &data,
- CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders);
- void WriteHeader(
- const CArchiveDatabase &db,
- const CHeaderOptions &headerOptions,
- UInt64 &headerOffset);
-
- bool _countMode;
- bool _writeToStream;
- size_t _countSize;
- UInt32 _crc;
- COutBuffer _outByte;
- CWriteBufferLoc _outByte2;
-
- #ifdef _7Z_VOL
- bool _endMarker;
- #endif
-
- HRESULT WriteSignature();
- #ifdef _7Z_VOL
- HRESULT WriteFinishSignature();
- #endif
- HRESULT WriteStartHeader(const CStartHeader &h);
- #ifdef _7Z_VOL
- HRESULT WriteFinishHeader(const CFinishHeader &h);
- #endif
- CMyComPtr<IOutStream> Stream;
-public:
-
- COutArchive() { _outByte.Create(1 << 16); }
- CMyComPtr<ISequentialOutStream> SeqStream;
- HRESULT Create(ISequentialOutStream *stream, bool endMarker);
- void Close();
- HRESULT SkipPrefixArchiveHeader();
- HRESULT WriteDatabase(
- DECL_EXTERNAL_CODECS_LOC_VARS
- const CArchiveDatabase &db,
- const CCompressionMethodMode *options,
- const CHeaderOptions &headerOptions);
-
- #ifdef _7Z_VOL
- static UInt32 GetVolHeadersSize(UInt64 dataSize, int nameLength = 0, bool props = false);
- static UInt64 GetVolPureSize(UInt64 volSize, int nameLength = 0, bool props = false);
- #endif
-
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zProperties.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zProperties.cpp
deleted file mode 100644
index 66d90785a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zProperties.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-// 7zProperties.cpp
-
-#include "StdAfx.h"
-
-#include "7zProperties.h"
-#include "7zHeader.h"
-#include "7zHandler.h"
-
-// #define _MULTI_PACK
-
-namespace NArchive {
-namespace N7z {
-
-struct CPropMap
-{
- UInt64 FilePropID;
- STATPROPSTG StatPROPSTG;
-};
-
-CPropMap kPropMap[] =
-{
- { NID::kName, NULL, kpidPath, VT_BSTR},
- { NID::kSize, NULL, kpidSize, VT_UI8},
- { NID::kPackInfo, NULL, kpidPackSize, VT_UI8},
-
- #ifdef _MULTI_PACK
- { 100, L"Pack0", kpidPackedSize0, VT_UI8},
- { 101, L"Pack1", kpidPackedSize1, VT_UI8},
- { 102, L"Pack2", kpidPackedSize2, VT_UI8},
- { 103, L"Pack3", kpidPackedSize3, VT_UI8},
- { 104, L"Pack4", kpidPackedSize4, VT_UI8},
- #endif
-
- { NID::kCTime, NULL, kpidCTime, VT_FILETIME},
- { NID::kMTime, NULL, kpidMTime, VT_FILETIME},
- { NID::kATime, NULL, kpidATime, VT_FILETIME},
- { NID::kWinAttributes, NULL, kpidAttrib, VT_UI4},
- { NID::kStartPos, NULL, kpidPosition, VT_UI4},
-
- { NID::kCRC, NULL, kpidCRC, VT_UI4},
-
- { NID::kAnti, NULL, kpidIsAnti, VT_BOOL},
-
- #ifndef _SFX
- { 97, NULL, kpidEncrypted, VT_BOOL},
- { 98, NULL, kpidMethod, VT_BSTR},
- { 99, NULL, kpidBlock, VT_UI4}
- #endif
-};
-
-static const int kPropMapSize = sizeof(kPropMap) / sizeof(kPropMap[0]);
-
-static int FindPropInMap(UInt64 filePropID)
-{
- for (int i = 0; i < kPropMapSize; i++)
- if (kPropMap[i].FilePropID == filePropID)
- return i;
- return -1;
-}
-
-static void CopyOneItem(CRecordVector<UInt64> &src,
- CRecordVector<UInt64> &dest, UInt32 item)
-{
- for (int i = 0; i < src.Size(); i++)
- if (src[i] == item)
- {
- dest.Add(item);
- src.Delete(i);
- return;
- }
-}
-
-static void RemoveOneItem(CRecordVector<UInt64> &src, UInt32 item)
-{
- for (int i = 0; i < src.Size(); i++)
- if (src[i] == item)
- {
- src.Delete(i);
- return;
- }
-}
-
-static void InsertToHead(CRecordVector<UInt64> &dest, UInt32 item)
-{
- for (int i = 0; i < dest.Size(); i++)
- if (dest[i] == item)
- {
- dest.Delete(i);
- break;
- }
- dest.Insert(0, item);
-}
-
-void CHandler::FillPopIDs()
-{
- _fileInfoPopIDs.Clear();
-
- #ifdef _7Z_VOL
- if(_volumes.Size() < 1)
- return;
- const CVolume &volume = _volumes.Front();
- const CArchiveDatabaseEx &_db = volume.Database;
- #endif
-
- CRecordVector<UInt64> fileInfoPopIDs = _db.ArchiveInfo.FileInfoPopIDs;
-
- RemoveOneItem(fileInfoPopIDs, NID::kEmptyStream);
- RemoveOneItem(fileInfoPopIDs, NID::kEmptyFile);
-
- CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kName);
- CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kAnti);
- CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kSize);
- CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kPackInfo);
- CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kCTime);
- CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kMTime);
- CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kATime);
- CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kWinAttributes);
- CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kCRC);
- CopyOneItem(fileInfoPopIDs, _fileInfoPopIDs, NID::kComment);
- _fileInfoPopIDs += fileInfoPopIDs;
-
- #ifndef _SFX
- _fileInfoPopIDs.Add(97);
- _fileInfoPopIDs.Add(98);
- _fileInfoPopIDs.Add(99);
- #endif
- #ifdef _MULTI_PACK
- _fileInfoPopIDs.Add(100);
- _fileInfoPopIDs.Add(101);
- _fileInfoPopIDs.Add(102);
- _fileInfoPopIDs.Add(103);
- _fileInfoPopIDs.Add(104);
- #endif
-
- #ifndef _SFX
- InsertToHead(_fileInfoPopIDs, NID::kMTime);
- InsertToHead(_fileInfoPopIDs, NID::kPackInfo);
- InsertToHead(_fileInfoPopIDs, NID::kSize);
- InsertToHead(_fileInfoPopIDs, NID::kName);
- #endif
-}
-
-STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties)
-{
- *numProperties = _fileInfoPopIDs.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType)
-{
- if ((int)index >= _fileInfoPopIDs.Size())
- return E_INVALIDARG;
- int indexInMap = FindPropInMap(_fileInfoPopIDs[index]);
- if (indexInMap == -1)
- return E_INVALIDARG;
- const STATPROPSTG &srcItem = kPropMap[indexInMap].StatPROPSTG;
- *propID = srcItem.propid;
- *varType = srcItem.vt;
- *name = 0;
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zProperties.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zProperties.h
deleted file mode 100644
index 661817954..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zProperties.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// 7zProperties.h
-
-#ifndef __7Z_PROPERTIES_H
-#define __7Z_PROPERTIES_H
-
-#include "../../PropID.h"
-
-namespace NArchive {
-namespace N7z {
-
-enum
-{
- kpidPackedSize0 = kpidUserDefined,
- kpidPackedSize1,
- kpidPackedSize2,
- kpidPackedSize3,
- kpidPackedSize4
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zRegister.cpp
deleted file mode 100644
index 5da289081..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zRegister.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// 7zRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "7zHandler.h"
-static IInArchive *CreateArc() { return new NArchive::N7z::CHandler; }
-#ifndef EXTRACT_ONLY
-static IOutArchive *CreateArcOut() { return new NArchive::N7z::CHandler; }
-#else
-#define CreateArcOut 0
-#endif
-
-static CArcInfo g_ArcInfo =
- { L"7z", L"7z", 0, 7, {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C}, 6, false, CreateArc, CreateArcOut };
-
-REGISTER_ARC(7z)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zSpecStream.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zSpecStream.cpp
deleted file mode 100644
index 06969636d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zSpecStream.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// 7zSpecStream.cpp
-
-#include "StdAfx.h"
-
-#include "7zSpecStream.h"
-
-STDMETHODIMP CSequentialInStreamSizeCount2::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize;
- HRESULT result = _stream->Read(data, size, &realProcessedSize);
- _size += realProcessedSize;
- if (processedSize != 0)
- *processedSize = realProcessedSize;
- return result;
-}
-
-STDMETHODIMP CSequentialInStreamSizeCount2::GetSubStreamSize(
- UInt64 subStream, UInt64 *value)
-{
- if (_getSubStreamSize == NULL)
- return E_NOTIMPL;
- return _getSubStreamSize->GetSubStreamSize(subStream, value);
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zSpecStream.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zSpecStream.h
deleted file mode 100644
index 2e26efd5c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zSpecStream.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// 7zSpecStream.h
-
-#ifndef __7Z_SPEC_STREAM_H
-#define __7Z_SPEC_STREAM_H
-
-#include "../../IStream.h"
-#include "../../ICoder.h"
-#include "../../../Common/MyCom.h"
-
-class CSequentialInStreamSizeCount2:
- public ISequentialInStream,
- public ICompressGetSubStreamSize,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialInStream> _stream;
- CMyComPtr<ICompressGetSubStreamSize> _getSubStreamSize;
- UInt64 _size;
-public:
- void Init(ISequentialInStream *stream)
- {
- _stream = stream;
- _getSubStreamSize = 0;
- _stream.QueryInterface(IID_ICompressGetSubStreamSize, &_getSubStreamSize);
- _size = 0;
- }
- UInt64 GetSize() const { return _size; }
-
- MY_UNKNOWN_IMP1(ICompressGetSubStreamSize)
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-
- STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zUpdate.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zUpdate.cpp
deleted file mode 100644
index 141654d8e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zUpdate.cpp
+++ /dev/null
@@ -1,1208 +0,0 @@
-// 7zUpdate.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/ProgressUtils.h"
-
-#include "../../Common/CreateCoder.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "../Common/ItemNameUtils.h"
-#include "../Common/OutStreamWithCRC.h"
-
-#include "7zDecode.h"
-#include "7zEncode.h"
-#include "7zFolderInStream.h"
-#include "7zHandler.h"
-#include "7zOut.h"
-#include "7zUpdate.h"
-
-#ifndef WIN32
-#include "Windows/FileIO.h"
-#endif
-
-namespace NArchive {
-namespace N7z {
-
-static const UInt64 k_LZMA = 0x030101;
-static const UInt64 k_BCJ = 0x03030103;
-static const UInt64 k_BCJ2 = 0x0303011B;
-static const UInt64 k_AES = 0x06F10701;
-
-static const wchar_t *kMatchFinderForBCJ2_LZMA = L"BT2";
-static const UInt32 kDictionaryForBCJ2_LZMA = 1 << 20;
-static const UInt32 kAlgorithmForBCJ2_LZMA = 1;
-static const UInt32 kNumFastBytesForBCJ2_LZMA = 64;
-
-static HRESULT WriteRange(IInStream *inStream, ISequentialOutStream *outStream,
- UInt64 position, UInt64 size, ICompressProgressInfo *progress)
-{
- RINOK(inStream->Seek(position, STREAM_SEEK_SET, 0));
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<CLimitedSequentialInStream> inStreamLimited(streamSpec);
- streamSpec->SetStream(inStream);
- streamSpec->Init(size);
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder;
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
- RINOK(copyCoder->Code(inStreamLimited, outStream, NULL, NULL, progress));
- return (copyCoderSpec->TotalSize == size ? S_OK : E_FAIL);
-}
-
-static int GetReverseSlashPos(const UString &name)
-{
- int slashPos = name.ReverseFind(L'/');
- #ifdef _WIN32
- int slash1Pos = name.ReverseFind(L'\\');
- slashPos = MyMax(slashPos, slash1Pos);
- #endif
- return slashPos;
-}
-
-int CUpdateItem::GetExtensionPos() const
-{
- int slashPos = GetReverseSlashPos(Name);
- int dotPos = Name.ReverseFind(L'.');
- if (dotPos < 0 || (dotPos < slashPos && slashPos >= 0))
- return Name.Length();
- return dotPos + 1;
-}
-
-UString CUpdateItem::GetExtension() const
-{
- return Name.Mid(GetExtensionPos());
-}
-
-#define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; }
-
-#define RINOZ_COMP(a, b) RINOZ(MyCompare(a, b))
-
-static int CompareBuffers(const CByteBuffer &a1, const CByteBuffer &a2)
-{
- size_t c1 = a1.GetCapacity();
- size_t c2 = a2.GetCapacity();
- RINOZ_COMP(c1, c2);
- for (size_t i = 0; i < c1; i++)
- RINOZ_COMP(a1[i], a2[i]);
- return 0;
-}
-
-static int CompareCoders(const CCoderInfo &c1, const CCoderInfo &c2)
-{
- RINOZ_COMP(c1.NumInStreams, c2.NumInStreams);
- RINOZ_COMP(c1.NumOutStreams, c2.NumOutStreams);
- RINOZ_COMP(c1.MethodID, c2.MethodID);
- return CompareBuffers(c1.Props, c2.Props);
-}
-
-static int CompareBindPairs(const CBindPair &b1, const CBindPair &b2)
-{
- RINOZ_COMP(b1.InIndex, b2.InIndex);
- return MyCompare(b1.OutIndex, b2.OutIndex);
-}
-
-static int CompareFolders(const CFolder &f1, const CFolder &f2)
-{
- int s1 = f1.Coders.Size();
- int s2 = f2.Coders.Size();
- RINOZ_COMP(s1, s2);
- int i;
- for (i = 0; i < s1; i++)
- RINOZ(CompareCoders(f1.Coders[i], f2.Coders[i]));
- s1 = f1.BindPairs.Size();
- s2 = f2.BindPairs.Size();
- RINOZ_COMP(s1, s2);
- for (i = 0; i < s1; i++)
- RINOZ(CompareBindPairs(f1.BindPairs[i], f2.BindPairs[i]));
- return 0;
-}
-
-/*
-static int CompareFiles(const CFileItem &f1, const CFileItem &f2)
-{
- return MyStringCompareNoCase(f1.Name, f2.Name);
-}
-*/
-
-struct CFolderRepack
-{
- int FolderIndex;
- int Group;
- CNum NumCopyFiles;
-};
-
-static int CompareFolderRepacks(const CFolderRepack *p1, const CFolderRepack *p2, void *param)
-{
- RINOZ_COMP(p1->Group, p2->Group);
- int i1 = p1->FolderIndex;
- int i2 = p2->FolderIndex;
- const CArchiveDatabaseEx &db = *(const CArchiveDatabaseEx *)param;
- RINOZ(CompareFolders(
- db.Folders[i1],
- db.Folders[i2]));
- return MyCompare(i1, i2);
- /*
- RINOZ_COMP(
- db.NumUnpackStreamsVector[i1],
- db.NumUnpackStreamsVector[i2]);
- if (db.NumUnpackStreamsVector[i1] == 0)
- return 0;
- return CompareFiles(
- db.Files[db.FolderStartFileIndex[i1]],
- db.Files[db.FolderStartFileIndex[i2]]);
- */
-}
-
-////////////////////////////////////////////////////////////
-
-static int CompareEmptyItems(const int *p1, const int *p2, void *param)
-{
- const CObjectVector<CUpdateItem> &updateItems = *(const CObjectVector<CUpdateItem> *)param;
- const CUpdateItem &u1 = updateItems[*p1];
- const CUpdateItem &u2 = updateItems[*p2];
- if (u1.IsDir != u2.IsDir)
- return (u1.IsDir) ? 1 : -1;
- if (u1.IsDir)
- {
- if (u1.IsAnti != u2.IsAnti)
- return (u1.IsAnti ? 1 : -1);
- int n = MyStringCompareNoCase(u1.Name, u2.Name);
- return -n;
- }
- if (u1.IsAnti != u2.IsAnti)
- return (u1.IsAnti ? 1 : -1);
- return MyStringCompareNoCase(u1.Name, u2.Name);
-}
-
-static const char *g_Exts =
- " lzma 7z ace arc arj bz bz2 deb lzo lzx gz pak rpm sit tgz tbz tbz2 tgz cab ha lha lzh rar zoo"
- " zip jar ear war msi"
- " 3gp avi mov mpeg mpg mpe wmv"
- " aac ape fla flac la mp3 m4a mp4 ofr ogg pac ra rm rka shn swa tta wv wma wav"
- " swf "
- " chm hxi hxs"
- " gif jpeg jpg jp2 png tiff bmp ico psd psp"
- " awg ps eps cgm dxf svg vrml wmf emf ai md"
- " cad dwg pps key sxi"
- " max 3ds"
- " iso bin nrg mdf img pdi tar cpio xpi"
- " vfd vhd vud vmc vsv"
- " vmdk dsk nvram vmem vmsd vmsn vmss vmtm"
- " inl inc idl acf asa h hpp hxx c cpp cxx rc java cs pas bas vb cls ctl frm dlg def"
- " f77 f f90 f95"
- " asm sql manifest dep "
- " mak clw csproj vcproj sln dsp dsw "
- " class "
- " bat cmd"
- " xml xsd xsl xslt hxk hxc htm html xhtml xht mht mhtml htw asp aspx css cgi jsp shtml"
- " awk sed hta js php php3 php4 php5 phptml pl pm py pyo rb sh tcl vbs"
- " text txt tex ans asc srt reg ini doc docx mcw dot rtf hlp xls xlr xlt xlw ppt pdf"
- " sxc sxd sxi sxg sxw stc sti stw stm odt ott odg otg odp otp ods ots odf"
- " abw afp cwk lwp wpd wps wpt wrf wri"
- " abf afm bdf fon mgf otf pcf pfa snf ttf"
- " dbf mdb nsf ntf wdb db fdb gdb"
- " exe dll ocx vbx sfx sys tlb awx com obj lib out o so "
- " pdb pch idb ncb opt";
-
-int GetExtIndex(const char *ext)
-{
- int extIndex = 1;
- const char *p = g_Exts;
- for (;;)
- {
- char c = *p++;
- if (c == 0)
- return extIndex;
- if (c == ' ')
- continue;
- int pos = 0;
- for (;;)
- {
- char c2 = ext[pos++];
- if (c2 == 0 && (c == 0 || c == ' '))
- return extIndex;
- if (c != c2)
- break;
- c = *p++;
- }
- extIndex++;
- for (;;)
- {
- if (c == 0)
- return extIndex;
- if (c == ' ')
- break;
- c = *p++;
- }
- }
-}
-
-struct CRefItem
-{
- const CUpdateItem *UpdateItem;
- UInt32 Index;
- UInt32 ExtensionPos;
- UInt32 NamePos;
- int ExtensionIndex;
- CRefItem(UInt32 index, const CUpdateItem &ui, bool sortByType):
- UpdateItem(&ui),
- Index(index),
- ExtensionPos(0),
- NamePos(0),
- ExtensionIndex(0)
- {
- if (sortByType)
- {
- int slashPos = GetReverseSlashPos(ui.Name);
- NamePos = ((slashPos >= 0) ? (slashPos + 1) : 0);
- int dotPos = ui.Name.ReverseFind(L'.');
- if (dotPos < 0 || (dotPos < slashPos && slashPos >= 0))
- ExtensionPos = ui.Name.Length();
- else
- {
- ExtensionPos = dotPos + 1;
- UString us = ui.Name.Mid(ExtensionPos);
- if (!us.IsEmpty())
- {
- us.MakeLower();
- int i;
- AString s;
- for (i = 0; i < us.Length(); i++)
- {
- wchar_t c = us[i];
- if (c >= 0x80)
- break;
- s += (char)c;
- }
- if (i == us.Length())
- ExtensionIndex = GetExtIndex(s);
- else
- ExtensionIndex = 0;
- }
- }
- }
- }
-};
-
-static int CompareUpdateItems(const CRefItem *p1, const CRefItem *p2, void *param)
-{
- const CRefItem &a1 = *p1;
- const CRefItem &a2 = *p2;
- const CUpdateItem &u1 = *a1.UpdateItem;
- const CUpdateItem &u2 = *a2.UpdateItem;
- int n;
- if (u1.IsDir != u2.IsDir)
- return (u1.IsDir) ? 1 : -1;
- if (u1.IsDir)
- {
- if (u1.IsAnti != u2.IsAnti)
- return (u1.IsAnti ? 1 : -1);
- n = MyStringCompareNoCase(u1.Name, u2.Name);
- return -n;
- }
- bool sortByType = *(bool *)param;
- if (sortByType)
- {
- RINOZ_COMP(a1.ExtensionIndex, a2.ExtensionIndex);
- RINOZ(MyStringCompareNoCase(u1.Name + a1.ExtensionPos, u2.Name + a2.ExtensionPos));
- RINOZ(MyStringCompareNoCase(u1.Name + a1.NamePos, u2.Name + a2.NamePos));
- if (!u1.MTimeDefined && u2.MTimeDefined) return 1;
- if (u1.MTimeDefined && !u2.MTimeDefined) return -1;
- if (u1.MTimeDefined && u2.MTimeDefined) RINOZ_COMP(u1.MTime, u2.MTime);
- RINOZ_COMP(u1.Size, u2.Size);
- }
- return MyStringCompareNoCase(u1.Name, u2.Name);
-}
-
-struct CSolidGroup
-{
- CRecordVector<UInt32> Indices;
-};
-
-#ifdef _WIN32
-static wchar_t *g_ExeExts[] =
-{
- L"dll",
- L"exe",
- L"ocx",
- L"sfx",
- L"sys"
-};
-
-static bool IsExeExt(const UString &ext)
-{
- for (int i = 0; i < sizeof(g_ExeExts) / sizeof(g_ExeExts[0]); i++)
- if (ext.CompareNoCase(g_ExeExts[i]) == 0)
- return true;
- return false;
-}
-#else
-static bool IsExeFile(const CUpdateItem &ui)
-{
- if (ui.Attrib & FILE_ATTRIBUTE_UNIX_EXTENSION) {
- unsigned short st_mode = ui.Attrib >> 16;
- if ((st_mode & 00111) && (ui.Size >= 2048))
- {
- // file has the execution flag and it's big enought
- // try to find if the file is a script
- NWindows::NFile::NIO::CInFile file;
- if (file.Open(ui.Name))
- {
- char buffer[512];
- UINT32 processedSize;
- if (file.Read(buffer,sizeof(buffer),processedSize))
- {
- for(UInt32 i = 0; i < processedSize ; i++)
- {
- if (buffer[i] == 0)
- {
- return true; // this file is not a text (ascii, utf8, ...) !
- }
- }
- }
- }
- }
- }
- return false;
-}
-#endif
-
-static void GetMethodFull(UInt64 methodID, UInt32 numInStreams, CMethodFull &methodResult)
-{
- methodResult.Id = methodID;
- methodResult.NumInStreams = numInStreams;
- methodResult.NumOutStreams = 1;
-}
-
-static void MakeExeMethod(const CCompressionMethodMode &method,
- bool bcj2Filter, CCompressionMethodMode &exeMethod)
-{
- exeMethod = method;
- if (bcj2Filter)
- {
- CMethodFull methodFull;
- GetMethodFull(k_BCJ2, 4, methodFull);
- exeMethod.Methods.Insert(0, methodFull);
- GetMethodFull(k_LZMA, 1, methodFull);
- {
- CProp prop;
- prop.Id = NCoderPropID::kAlgorithm;
- prop.Value = kAlgorithmForBCJ2_LZMA;
- methodFull.Props.Add(prop);
- }
- {
- CProp prop;
- prop.Id = NCoderPropID::kMatchFinder;
- prop.Value = kMatchFinderForBCJ2_LZMA;
- methodFull.Props.Add(prop);
- }
- {
- CProp prop;
- prop.Id = NCoderPropID::kDictionarySize;
- prop.Value = kDictionaryForBCJ2_LZMA;
- methodFull.Props.Add(prop);
- }
- {
- CProp prop;
- prop.Id = NCoderPropID::kNumFastBytes;
- prop.Value = kNumFastBytesForBCJ2_LZMA;
- methodFull.Props.Add(prop);
- }
-
- exeMethod.Methods.Add(methodFull);
- exeMethod.Methods.Add(methodFull);
- CBind bind;
-
- bind.OutCoder = 0;
- bind.InStream = 0;
-
- bind.InCoder = 1;
- bind.OutStream = 0;
- exeMethod.Binds.Add(bind);
-
- bind.InCoder = 2;
- bind.OutStream = 1;
- exeMethod.Binds.Add(bind);
-
- bind.InCoder = 3;
- bind.OutStream = 2;
- exeMethod.Binds.Add(bind);
- }
- else
- {
- CMethodFull methodFull;
- GetMethodFull(k_BCJ, 1, methodFull);
- exeMethod.Methods.Insert(0, methodFull);
- CBind bind;
- bind.OutCoder = 0;
- bind.InStream = 0;
- bind.InCoder = 1;
- bind.OutStream = 0;
- exeMethod.Binds.Add(bind);
- }
-}
-
-static void FromUpdateItemToFileItem(const CUpdateItem &ui,
- CFileItem &file, CFileItem2 &file2)
-{
- file.Name = NItemName::MakeLegalName(ui.Name);
- if (ui.AttribDefined)
- file.SetAttrib(ui.Attrib);
-
- file2.CTime = ui.CTime; file2.CTimeDefined = ui.CTimeDefined;
- file2.ATime = ui.ATime; file2.ATimeDefined = ui.ATimeDefined;
- file2.MTime = ui.MTime; file2.MTimeDefined = ui.MTimeDefined;
- file2.IsAnti = ui.IsAnti;
- file2.StartPosDefined = false;
-
- file.Size = ui.Size;
- file.IsDir = ui.IsDir;
- file.HasStream = ui.HasStream();
-}
-
-class CFolderOutStream2:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- COutStreamWithCRC *_crcStreamSpec;
- CMyComPtr<ISequentialOutStream> _crcStream;
- const CArchiveDatabaseEx *_db;
- const CBoolVector *_extractStatuses;
- CMyComPtr<ISequentialOutStream> _outStream;
- UInt32 _startIndex;
- int _currentIndex;
- bool _fileIsOpen;
- UInt64 _rem;
-
- void OpenFile();
- void CloseFile();
- HRESULT CloseFileAndSetResult();
- HRESULT ProcessEmptyFiles();
-public:
- MY_UNKNOWN_IMP
-
- CFolderOutStream2()
- {
- _crcStreamSpec = new COutStreamWithCRC;
- _crcStream = _crcStreamSpec;
- }
-
- HRESULT Init(const CArchiveDatabaseEx *db, UInt32 startIndex,
- const CBoolVector *extractStatuses, ISequentialOutStream *outStream);
- void ReleaseOutStream();
- HRESULT CheckFinishedState() const { return (_currentIndex == _extractStatuses->Size()) ? S_OK: E_FAIL; }
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-HRESULT CFolderOutStream2::Init(const CArchiveDatabaseEx *db, UInt32 startIndex,
- const CBoolVector *extractStatuses, ISequentialOutStream *outStream)
-{
- _db = db;
- _startIndex = startIndex;
- _extractStatuses = extractStatuses;
- _outStream = outStream;
-
- _currentIndex = 0;
- _fileIsOpen = false;
- return ProcessEmptyFiles();
-}
-
-void CFolderOutStream2::ReleaseOutStream()
-{
- _outStream.Release();
- _crcStreamSpec->ReleaseStream();
-}
-
-void CFolderOutStream2::OpenFile()
-{
- _crcStreamSpec->SetStream((*_extractStatuses)[_currentIndex] ? (ISequentialOutStream *)_outStream : NULL); // FIXED for gcc 2.95
- _crcStreamSpec->Init(true);
- _fileIsOpen = true;
- _rem = _db->Files[_startIndex + _currentIndex].Size;
-}
-
-void CFolderOutStream2::CloseFile()
-{
- _crcStreamSpec->ReleaseStream();
- _fileIsOpen = false;
- _currentIndex++;
-}
-
-HRESULT CFolderOutStream2::CloseFileAndSetResult()
-{
- const CFileItem &file = _db->Files[_startIndex + _currentIndex];
- CloseFile();
- return (file.IsDir || !file.CrcDefined || file.Crc == _crcStreamSpec->GetCRC()) ? S_OK: S_FALSE;
-}
-
-HRESULT CFolderOutStream2::ProcessEmptyFiles()
-{
- while (_currentIndex < _extractStatuses->Size() && _db->Files[_startIndex + _currentIndex].Size == 0)
- {
- OpenFile();
- RINOK(CloseFileAndSetResult());
- }
- return S_OK;
-}
-
-STDMETHODIMP CFolderOutStream2::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != NULL)
- *processedSize = 0;
- while (size != 0)
- {
- if (_fileIsOpen)
- {
- UInt32 cur = size < _rem ? size : (UInt32)_rem;
- RINOK(_crcStream->Write(data, cur, &cur));
- if (cur == 0)
- break;
- data = (const Byte *)data + cur;
- size -= cur;
- _rem -= cur;
- if (processedSize != NULL)
- *processedSize += cur;
- if (_rem == 0)
- {
- RINOK(CloseFileAndSetResult());
- RINOK(ProcessEmptyFiles());
- continue;
- }
- }
- else
- {
- RINOK(ProcessEmptyFiles());
- if (_currentIndex == _extractStatuses->Size())
- {
- // we don't support partial extracting
- return E_FAIL;
- }
- OpenFile();
- }
- }
- return S_OK;
-}
-
-class CThreadDecoder: public CVirtThread
-{
-public:
- HRESULT Result;
- CMyComPtr<IInStream> InStream;
-
- CFolderOutStream2 *FosSpec;
- CMyComPtr<ISequentialOutStream> Fos;
-
- UInt64 StartPos;
- const UInt64 *PackSizes;
- const CFolder *Folder;
- #ifndef _NO_CRYPTO
- CMyComPtr<ICryptoGetTextPassword> GetTextPassword;
- #endif
-
- DECL_EXTERNAL_CODECS_VARS
- CDecoder Decoder;
-
- #ifdef COMPRESS_MT
- bool MtMode;
- UInt32 NumThreads;
- #endif
-
- CThreadDecoder():
- Decoder(true)
- {
- #ifdef COMPRESS_MT
- MtMode = false;
- NumThreads = 1;
- #endif
- FosSpec = new CFolderOutStream2;
- Fos = FosSpec;
- Result = E_FAIL;
- }
- virtual void Execute();
-};
-
-void CThreadDecoder::Execute()
-{
- try
- {
- #ifndef _NO_CRYPTO
- bool passwordIsDefined;
- #endif
- Result = Decoder.Decode(
- EXTERNAL_CODECS_VARS
- InStream,
- StartPos,
- PackSizes,
- *Folder,
- Fos,
- NULL
- #ifndef _NO_CRYPTO
- , GetTextPassword, passwordIsDefined
- #endif
- #ifdef COMPRESS_MT
- , MtMode, NumThreads
- #endif
- );
- }
- catch(...)
- {
- Result = E_FAIL;
- }
- if (Result == S_OK)
- Result = FosSpec->CheckFinishedState();
- FosSpec->ReleaseOutStream();
-}
-
-bool static Is86FilteredFolder(const CFolder &f)
-{
- for (int i = 0; i < f.Coders.Size(); i++)
- {
- CMethodId m = f.Coders[i].MethodID;
- if (m == k_BCJ || m == k_BCJ2)
- return true;
- }
- return false;
-}
-
-bool static IsEncryptedFolder(const CFolder &f)
-{
- for (int i = 0; i < f.Coders.Size(); i++)
- {
- CMethodId m = f.Coders[i].MethodID;
- if (m == k_AES)
- return true;
- }
- return false;
-}
-
-#ifndef _NO_CRYPTO
-
-class CCryptoGetTextPassword:
- public ICryptoGetTextPassword,
- public CMyUnknownImp
-{
-public:
- UString Password;
-
- MY_UNKNOWN_IMP
- STDMETHOD(CryptoGetTextPassword)(BSTR *password);
-};
-
-STDMETHODIMP CCryptoGetTextPassword::CryptoGetTextPassword(BSTR *password)
-{
- return StringToBstr(Password, password);
-}
-
-#endif
-
-static const int kNumGroupsMax = 4;
-
-static bool Is86Group(int group) { return (group & 1) != 0; }
-static bool IsEncryptedGroup(int group) { return (group & 2) != 0; }
-static int GetGroupIndex(bool encrypted, int bcjFiltered)
- { return (encrypted ? 2 : 0) + (bcjFiltered ? 1 : 0); }
-
-HRESULT Update(
- DECL_EXTERNAL_CODECS_LOC_VARS
- IInStream *inStream,
- const CArchiveDatabaseEx *db,
- const CObjectVector<CUpdateItem> &updateItems,
- COutArchive &archive,
- CArchiveDatabase &newDatabase,
- ISequentialOutStream *seqOutStream,
- IArchiveUpdateCallback *updateCallback,
- const CUpdateOptions &options
- #ifndef _NO_CRYPTO
- , ICryptoGetTextPassword *getDecoderPassword
- #endif
- )
-{
- UInt64 numSolidFiles = options.NumSolidFiles;
- if (numSolidFiles == 0)
- numSolidFiles = 1;
- /*
- CMyComPtr<IOutStream> outStream;
- RINOK(seqOutStream->QueryInterface(IID_IOutStream, (void **)&outStream));
- if (!outStream)
- return E_NOTIMPL;
- */
-
- UInt64 startBlockSize = db != 0 ? db->ArchiveInfo.StartPosition: 0;
- if (startBlockSize > 0 && !options.RemoveSfxBlock)
- {
- RINOK(WriteRange(inStream, seqOutStream, 0, startBlockSize, NULL));
- }
-
- CRecordVector<int> fileIndexToUpdateIndexMap;
- CRecordVector<CFolderRepack> folderRefs;
- UInt64 complexity = 0;
- UInt64 inSizeForReduce2 = 0;
- bool needEncryptedRepack = false;
- if (db != 0)
- {
- fileIndexToUpdateIndexMap.Reserve(db->Files.Size());
- int i;
- for (i = 0; i < db->Files.Size(); i++)
- fileIndexToUpdateIndexMap.Add(-1);
-
- for (i = 0; i < updateItems.Size(); i++)
- {
- int index = updateItems[i].IndexInArchive;
- if (index != -1)
- fileIndexToUpdateIndexMap[index] = i;
- }
-
- for (i = 0; i < db->Folders.Size(); i++)
- {
- CNum indexInFolder = 0;
- CNum numCopyItems = 0;
- CNum numUnpackStreams = db->NumUnpackStreamsVector[i];
- UInt64 repackSize = 0;
- for (CNum fi = db->FolderStartFileIndex[i]; indexInFolder < numUnpackStreams; fi++)
- {
- const CFileItem &file = db->Files[fi];
- if (file.HasStream)
- {
- indexInFolder++;
- int updateIndex = fileIndexToUpdateIndexMap[fi];
- if (updateIndex >= 0 && !updateItems[updateIndex].NewData)
- {
- numCopyItems++;
- repackSize += file.Size;
- }
- }
- }
-
- if (numCopyItems == 0)
- continue;
-
- CFolderRepack rep;
- rep.FolderIndex = i;
- rep.NumCopyFiles = numCopyItems;
- const CFolder &f = db->Folders[i];
- bool isEncrypted = IsEncryptedFolder(f);
- rep.Group = GetGroupIndex(isEncrypted, Is86FilteredFolder(f));
- folderRefs.Add(rep);
- if (numCopyItems == numUnpackStreams)
- complexity += db->GetFolderFullPackSize(i);
- else
- {
- complexity += repackSize;
- if (repackSize > inSizeForReduce2)
- inSizeForReduce2 = repackSize;
- if (isEncrypted)
- needEncryptedRepack = true;
- }
- }
- folderRefs.Sort(CompareFolderRepacks, (void *)db);
- }
-
- UInt64 inSizeForReduce = 0;
- int i;
- for (i = 0; i < updateItems.Size(); i++)
- {
- const CUpdateItem &ui = updateItems[i];
- if (ui.NewData)
- {
- complexity += ui.Size;
- if (numSolidFiles != 1)
- inSizeForReduce += ui.Size;
- else if (ui.Size > inSizeForReduce)
- inSizeForReduce = ui.Size;
- }
- }
-
- if (inSizeForReduce2 > inSizeForReduce)
- inSizeForReduce = inSizeForReduce2;
-
- const UInt32 kMinReduceSize = (1 << 16);
- if (inSizeForReduce < kMinReduceSize)
- inSizeForReduce = kMinReduceSize;
-
- RINOK(updateCallback->SetTotal(complexity));
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(updateCallback, true);
-
- CThreadDecoder threadDecoder;
- if (!folderRefs.IsEmpty())
- {
- #ifdef EXTERNAL_CODECS
- threadDecoder._codecsInfo = codecsInfo;
- threadDecoder._externalCodecs = *externalCodecs;
- #endif
- RINOK(threadDecoder.Create());
- }
-
- CObjectVector<CSolidGroup> groups;
- for (i = 0; i < kNumGroupsMax; i++)
- groups.Add(CSolidGroup());
-
- {
- // ---------- Split files to 2 groups ----------
-
- bool useFilters = options.UseFilters;
- const CCompressionMethodMode &method = *options.Method;
- if (method.Methods.Size() != 1 || method.Binds.Size() != 0)
- useFilters = false;
- for (i = 0; i < updateItems.Size(); i++)
- {
- const CUpdateItem &ui = updateItems[i];
- if (!ui.NewData || !ui.HasStream())
- continue;
- bool filteredGroup = false;
- if (useFilters)
- {
-#ifdef _WIN32
- int dotPos = ui.Name.ReverseFind(L'.');
- if (dotPos >= 0)
- filteredGroup = IsExeExt(ui.Name.Mid(dotPos + 1));
-#else
- filteredGroup = IsExeFile(ui);
-#endif
- }
- groups[GetGroupIndex(method.PasswordIsDefined, filteredGroup)].Indices.Add(i);
- }
- }
-
- #ifndef _NO_CRYPTO
-
- CCryptoGetTextPassword *getPasswordSpec = NULL;
- if (needEncryptedRepack)
- {
- getPasswordSpec = new CCryptoGetTextPassword;
- threadDecoder.GetTextPassword = getPasswordSpec;
-
- if (options.Method->PasswordIsDefined)
- getPasswordSpec->Password = options.Method->Password;
- else
- {
- if (!getDecoderPassword)
- return E_NOTIMPL;
- CMyComBSTR password;
- RINOK(getDecoderPassword->CryptoGetTextPassword(&password));
- getPasswordSpec->Password = password;
- }
- }
-
- #endif
-
- // ---------- Compress ----------
-
- RINOK(archive.Create(seqOutStream, false));
- RINOK(archive.SkipPrefixArchiveHeader());
-
- int folderRefIndex = 0;
- lps->ProgressOffset = 0;
-
- for (int groupIndex = 0; groupIndex < kNumGroupsMax; groupIndex++)
- {
- const CSolidGroup &group = groups[groupIndex];
-
- CCompressionMethodMode method;
- if (Is86Group(groupIndex))
- MakeExeMethod(*options.Method, options.MaxFilter, method);
- else
- method = *options.Method;
-
- if (IsEncryptedGroup(groupIndex))
- {
- if (!method.PasswordIsDefined)
- {
- #ifndef _NO_CRYPTO
- if (getPasswordSpec)
- method.Password = getPasswordSpec->Password;
- #endif
- method.PasswordIsDefined = true;
- }
- }
- else
- {
- method.PasswordIsDefined = false;
- method.Password.Empty();
- }
-
- CEncoder encoder(method);
-
- for (; folderRefIndex < folderRefs.Size(); folderRefIndex++)
- {
- const CFolderRepack &rep = folderRefs[folderRefIndex];
- if (rep.Group != groupIndex)
- break;
- int folderIndex = rep.FolderIndex;
-
- if (rep.NumCopyFiles == db->NumUnpackStreamsVector[folderIndex])
- {
- UInt64 packSize = db->GetFolderFullPackSize(folderIndex);
- RINOK(WriteRange(inStream, archive.SeqStream,
- db->GetFolderStreamPos(folderIndex, 0), packSize, progress));
- lps->ProgressOffset += packSize;
-
- const CFolder &folder = db->Folders[folderIndex];
- CNum startIndex = db->FolderStartPackStreamIndex[folderIndex];
- for (int j = 0; j < folder.PackStreams.Size(); j++)
- {
- newDatabase.PackSizes.Add(db->PackSizes[startIndex + j]);
- // newDatabase.PackCRCsDefined.Add(db.PackCRCsDefined[startIndex + j]);
- // newDatabase.PackCRCs.Add(db.PackCRCs[startIndex + j]);
- }
- newDatabase.Folders.Add(folder);
- }
- else
- {
- CStreamBinder sb;
- RINOK(sb.CreateEvents());
- CMyComPtr<ISequentialOutStream> sbOutStream;
- CMyComPtr<ISequentialInStream> sbInStream;
- sb.CreateStreams(&sbInStream, &sbOutStream);
- CBoolVector extractStatuses;
-
- CNum numUnpackStreams = db->NumUnpackStreamsVector[folderIndex];
- CNum indexInFolder = 0;
-
- for (CNum fi = db->FolderStartFileIndex[folderIndex]; indexInFolder < numUnpackStreams; fi++)
- {
- bool needExtract = false;
- if (db->Files[fi].HasStream)
- {
- indexInFolder++;
- int updateIndex = fileIndexToUpdateIndexMap[fi];
- if (updateIndex >= 0 && !updateItems[updateIndex].NewData)
- needExtract = true;
- }
- extractStatuses.Add(needExtract);
- }
-
- RINOK(threadDecoder.FosSpec->Init(db, db->FolderStartFileIndex[folderIndex], &extractStatuses, sbOutStream));
- sbOutStream.Release();
-
- threadDecoder.InStream = inStream;
- threadDecoder.Folder = &db->Folders[folderIndex];
- threadDecoder.StartPos = db->GetFolderStreamPos(folderIndex, 0);
- threadDecoder.PackSizes = &db->PackSizes[db->FolderStartPackStreamIndex[folderIndex]];
-
- threadDecoder.Start();
-
- int startPackIndex = newDatabase.PackSizes.Size();
- CFolder newFolder;
- RINOK(encoder.Encode(
- EXTERNAL_CODECS_LOC_VARS
- sbInStream, NULL, &inSizeForReduce, newFolder,
- archive.SeqStream, newDatabase.PackSizes, progress));
-
- threadDecoder.WaitFinish();
-
- RINOK(threadDecoder.Result);
-
- for (; startPackIndex < newDatabase.PackSizes.Size(); startPackIndex++)
- lps->OutSize += newDatabase.PackSizes[startPackIndex];
- lps->InSize += newFolder.GetUnpackSize();
-
- newDatabase.Folders.Add(newFolder);
- }
-
- newDatabase.NumUnpackStreamsVector.Add(rep.NumCopyFiles);
-
- CNum numUnpackStreams = db->NumUnpackStreamsVector[folderIndex];
-
- CNum indexInFolder = 0;
- for (CNum fi = db->FolderStartFileIndex[folderIndex]; indexInFolder < numUnpackStreams; fi++)
- {
- CFileItem file;
- CFileItem2 file2;
- db->GetFile(fi, file, file2);
- if (file.HasStream)
- {
- indexInFolder++;
- int updateIndex = fileIndexToUpdateIndexMap[fi];
- if (updateIndex >= 0)
- {
- const CUpdateItem &ui = updateItems[updateIndex];
- if (ui.NewData)
- continue;
- if (ui.NewProps)
- {
- CFileItem uf;
- FromUpdateItemToFileItem(ui, uf, file2);
- uf.Size = file.Size;
- uf.Crc = file.Crc;
- uf.CrcDefined = file.CrcDefined;
- uf.HasStream = file.HasStream;
- file = uf;
- }
- newDatabase.AddFile(file, file2);
- }
- }
- }
- }
-
- int numFiles = group.Indices.Size();
- if (numFiles == 0)
- continue;
- CRecordVector<CRefItem> refItems;
- refItems.Reserve(numFiles);
- bool sortByType = (numSolidFiles > 1);
- for (i = 0; i < numFiles; i++)
- refItems.Add(CRefItem(group.Indices[i], updateItems[group.Indices[i]], sortByType));
- refItems.Sort(CompareUpdateItems, (void *)&sortByType);
-
- CRecordVector<UInt32> indices;
- indices.Reserve(numFiles);
-
- for (i = 0; i < numFiles; i++)
- {
- UInt32 index = refItems[i].Index;
- indices.Add(index);
- /*
- const CUpdateItem &ui = updateItems[index];
- CFileItem file;
- if (ui.NewProps)
- FromUpdateItemToFileItem(ui, file);
- else
- file = db.Files[ui.IndexInArchive];
- if (file.IsAnti || file.IsDir)
- return E_FAIL;
- newDatabase.Files.Add(file);
- */
- }
-
- for (i = 0; i < numFiles;)
- {
- UInt64 totalSize = 0;
- int numSubFiles;
- UString prevExtension;
- for (numSubFiles = 0; i + numSubFiles < numFiles &&
- static_cast< unsigned int >( numSubFiles ) < numSolidFiles; numSubFiles++)
- {
- const CUpdateItem &ui = updateItems[indices[i + numSubFiles]];
- totalSize += ui.Size;
- if (totalSize > options.NumSolidBytes)
- break;
- if (options.SolidExtension)
- {
- UString ext = ui.GetExtension();
- if (numSubFiles == 0)
- prevExtension = ext;
- else
- if (ext.CompareNoCase(prevExtension) != 0)
- break;
- }
- }
- if (numSubFiles < 1)
- numSubFiles = 1;
-
- CFolderInStream *inStreamSpec = new CFolderInStream;
- CMyComPtr<ISequentialInStream> solidInStream(inStreamSpec);
- inStreamSpec->Init(updateCallback, &indices[i], numSubFiles);
-
- CFolder folderItem;
-
- int startPackIndex = newDatabase.PackSizes.Size();
- RINOK(encoder.Encode(
- EXTERNAL_CODECS_LOC_VARS
- solidInStream, NULL, &inSizeForReduce, folderItem,
- archive.SeqStream, newDatabase.PackSizes, progress));
-
- for (; startPackIndex < newDatabase.PackSizes.Size(); startPackIndex++)
- lps->OutSize += newDatabase.PackSizes[startPackIndex];
-
- lps->InSize += folderItem.GetUnpackSize();
- // for ()
- // newDatabase.PackCRCsDefined.Add(false);
- // newDatabase.PackCRCs.Add(0);
-
- newDatabase.Folders.Add(folderItem);
-
- CNum numUnpackStreams = 0;
- for (int subIndex = 0; subIndex < numSubFiles; subIndex++)
- {
- const CUpdateItem &ui = updateItems[indices[i + subIndex]];
- CFileItem file;
- CFileItem2 file2;
- if (ui.NewProps)
- FromUpdateItemToFileItem(ui, file, file2);
- else
- db->GetFile(ui.IndexInArchive, file, file2);
- if (file2.IsAnti || file.IsDir)
- return E_FAIL;
-
- /*
- CFileItem &file = newDatabase.Files[
- startFileIndexInDatabase + i + subIndex];
- */
- if (!inStreamSpec->Processed[subIndex])
- {
- continue;
- // file.Name += L".locked";
- }
-
- file.Crc = inStreamSpec->CRCs[subIndex];
- file.Size = inStreamSpec->Sizes[subIndex];
- if (file.Size != 0)
- {
- file.CrcDefined = true;
- file.HasStream = true;
- numUnpackStreams++;
- }
- else
- {
- file.CrcDefined = false;
- file.HasStream = false;
- }
- newDatabase.AddFile(file, file2);
- }
- // numUnpackStreams = 0 is very bad case for locked files
- // v3.13 doesn't understand it.
- newDatabase.NumUnpackStreamsVector.Add(numUnpackStreams);
- i += numSubFiles;
- }
- }
-
- if (folderRefIndex != folderRefs.Size())
- return E_FAIL;
-
- /*
- folderRefs.ClearAndFree();
- fileIndexToUpdateIndexMap.ClearAndFree();
- groups.ClearAndFree();
- */
-
- {
- // ---------- Write Folders & Empty Files ----------
-
- CRecordVector<int> emptyRefs;
- for (i = 0; i < updateItems.Size(); i++)
- {
- const CUpdateItem &ui = updateItems[i];
- if (ui.NewData)
- {
- if (ui.HasStream())
- continue;
- }
- else if (ui.IndexInArchive != -1 && db->Files[ui.IndexInArchive].HasStream)
- continue;
- emptyRefs.Add(i);
- }
- emptyRefs.Sort(CompareEmptyItems, (void *)&updateItems);
- for (i = 0; i < emptyRefs.Size(); i++)
- {
- const CUpdateItem &ui = updateItems[emptyRefs[i]];
- CFileItem file;
- CFileItem2 file2;
- if (ui.NewProps)
- FromUpdateItemToFileItem(ui, file, file2);
- else
- db->GetFile(ui.IndexInArchive, file, file2);
- newDatabase.AddFile(file, file2);
- }
- }
-
- newDatabase.ReserveDown();
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zUpdate.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zUpdate.h
deleted file mode 100644
index 31e362246..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/7z/7zUpdate.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// 7zUpdate.h
-
-#ifndef __7Z_UPDATE_H
-#define __7Z_UPDATE_H
-
-#include "7zCompressionMode.h"
-#include "7zIn.h"
-#include "7zOut.h"
-
-#include "../IArchive.h"
-
-namespace NArchive {
-namespace N7z {
-
-struct CUpdateItem
-{
- int IndexInArchive;
- int IndexInClient;
-
- UInt64 CTime;
- UInt64 ATime;
- UInt64 MTime;
-
- UInt64 Size;
- UString Name;
-
- UInt32 Attrib;
-
- bool NewData;
- bool NewProps;
-
- bool IsAnti;
- bool IsDir;
-
- bool AttribDefined;
- bool CTimeDefined;
- bool ATimeDefined;
- bool MTimeDefined;
-
- bool HasStream() const { return !IsDir && !IsAnti && Size != 0; }
-
- CUpdateItem():
- IsAnti(false),
- IsDir(false),
- AttribDefined(false),
- CTimeDefined(false),
- ATimeDefined(false),
- MTimeDefined(false)
- {}
- void SetDirStatusFromAttrib() { IsDir = ((Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0); };
-
- int GetExtensionPos() const;
- UString GetExtension() const;
-};
-
-struct CUpdateOptions
-{
- const CCompressionMethodMode *Method;
- const CCompressionMethodMode *HeaderMethod;
- bool UseFilters;
- bool MaxFilter;
-
- CHeaderOptions HeaderOptions;
-
- UInt64 NumSolidFiles;
- UInt64 NumSolidBytes;
- bool SolidExtension;
- bool RemoveSfxBlock;
- bool VolumeMode;
-};
-
-HRESULT Update(
- DECL_EXTERNAL_CODECS_LOC_VARS
- IInStream *inStream,
- const CArchiveDatabaseEx *db,
- const CObjectVector<CUpdateItem> &updateItems,
- COutArchive &archive,
- CArchiveDatabase &newDatabase,
- ISequentialOutStream *seqOutStream,
- IArchiveUpdateCallback *updateCallback,
- const CUpdateOptions &options
- #ifndef _NO_CRYPTO
- , ICryptoGetTextPassword *getDecoderPassword
- #endif
- );
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ArchiveExports.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ArchiveExports.cpp
deleted file mode 100644
index f7bc9c694..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ArchiveExports.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-// ArchiveExports.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/ComTry.h"
-
-#include "../../Windows/PropVariant.h"
-
-#include "../Common/RegisterArc.h"
-
-static const unsigned int kNumArcsMax = 48;
-static unsigned int g_NumArcs = 0;
-static const CArcInfo *g_Arcs[kNumArcsMax];
-void RegisterArc(const CArcInfo *arcInfo)
-{
- if (g_NumArcs < kNumArcsMax)
- g_Arcs[g_NumArcs++] = arcInfo;
-}
-
-DEFINE_GUID(CLSID_CArchiveHandler,
-0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00);
-
-#define CLS_ARC_ID_ITEM(cls) ((cls).Data4[5])
-
-static inline HRESULT SetPropString(const char *s, unsigned int size, PROPVARIANT *value)
-{
- if ((value->bstrVal = ::SysAllocStringByteLen(s, size)) != 0)
- value->vt = VT_BSTR;
- return S_OK;
-}
-
-static inline HRESULT SetPropGUID(const GUID &guid, PROPVARIANT *value)
-{
- return SetPropString((const char *)&guid, sizeof(GUID), value);
-}
-
-int FindFormatCalssId(const GUID *clsID)
-{
- GUID cls = *clsID;
- CLS_ARC_ID_ITEM(cls) = 0;
- if (cls != CLSID_CArchiveHandler)
- return -1;
- Byte id = CLS_ARC_ID_ITEM(*clsID);
- for (unsigned i = 0; i < g_NumArcs; i++)
- if (g_Arcs[i]->ClassId == id)
- return (int)i;
- return -1;
-}
-
-STDAPI CreateArchiver(const GUID *clsid, const GUID *iid, void **outObject)
-{
- COM_TRY_BEGIN
- {
- int needIn = (*iid == IID_IInArchive);
- int needOut = (*iid == IID_IOutArchive);
- if (!needIn && !needOut)
- return E_NOINTERFACE;
- int formatIndex = FindFormatCalssId(clsid);
- if (formatIndex < 0)
- return CLASS_E_CLASSNOTAVAILABLE;
-
- const CArcInfo &arc = *g_Arcs[formatIndex];
- if (needIn)
- {
- *outObject = arc.CreateInArchive();
- ((IInArchive *)*outObject)->AddRef();
- }
- else
- {
- if (!arc.CreateOutArchive)
- return CLASS_E_CLASSNOTAVAILABLE;
- *outObject = arc.CreateOutArchive();
- ((IOutArchive *)*outObject)->AddRef();
- }
- }
- COM_TRY_END
- return S_OK;
-}
-
-STDAPI GetHandlerProperty2(UInt32 formatIndex, PROPID propID, PROPVARIANT *value)
-{
- if (formatIndex >= g_NumArcs)
- return E_INVALIDARG;
- const CArcInfo &arc = *g_Arcs[formatIndex];
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case NArchive::kName:
- prop = arc.Name;
- break;
- case NArchive::kClassID:
- {
- GUID clsId = CLSID_CArchiveHandler;
- CLS_ARC_ID_ITEM(clsId) = arc.ClassId;
- return SetPropGUID(clsId, value);
- }
- case NArchive::kExtension:
- if (arc.Ext != 0)
- prop = arc.Ext;
- break;
- case NArchive::kAddExtension:
- if (arc.AddExt != 0)
- prop = arc.AddExt;
- break;
- case NArchive::kUpdate:
- prop = (bool)(arc.CreateOutArchive != 0);
- break;
- case NArchive::kKeepName:
- prop = arc.KeepName;
- break;
- case NArchive::kStartSignature:
- return SetPropString((const char *)arc.Signature, arc.SignatureSize, value);
- }
- prop.Detach(value);
- return S_OK;
-}
-
-STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value)
-{
- return GetHandlerProperty2(0, propID, value);
-}
-
-STDAPI GetNumberOfFormats(UINT32 *numFormats)
-{
- *numFormats = g_NumArcs;
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ArjHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ArjHandler.cpp
deleted file mode 100644
index 66ad16776..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ArjHandler.cpp
+++ /dev/null
@@ -1,799 +0,0 @@
-// ArjHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/ComTry.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamObjects.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/ArjDecoder1.h"
-#include "../Compress/ArjDecoder2.h"
-#include "../Compress/CopyCoder.h"
-
-#include "Common/ItemNameUtils.h"
-#include "Common/OutStreamWithCRC.h"
-
-using namespace NWindows;
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-
-namespace NArchive {
-namespace NArj {
-
-const int kBlockSizeMin = 30;
-const int kBlockSizeMax = 2600;
-
-namespace NSignature
-{
- const Byte kSig0 = 0x60;
- const Byte kSig1 = 0xEA;
-}
-
-namespace NFileHeader
-{
- namespace NCompressionMethod
- {
- enum
- {
- kStored = 0,
- kCompressed1a = 1,
- kCompressed1b = 2,
- kCompressed1c = 3,
- kCompressed2 = 4,
- kNoDataNoCRC = 8,
- kNoData = 9
- };
- }
-
- namespace NFileType
- {
- enum
- {
- kBinary = 0,
- k7BitText = 1,
- kArchiveHeader = 2,
- kDirectory = 3,
- kVolumeLablel = 4,
- kChapterLabel = 5
- };
- }
-
- namespace NFlags
- {
- const Byte kGarbled = 1;
- const Byte kVolume = 4;
- const Byte kExtFile = 8;
- const Byte kPathSym = 0x10;
- const Byte kBackup = 0x20;
- }
-
- namespace NHostOS
- {
- enum EEnum
- {
- kMSDOS = 0, // filesystem used by MS-DOS, OS/2, Win32
- // pkarj 2.50 (FAT / VFAT / FAT32 file systems)
- kPRIMOS,
- kUnix,
- kAMIGA,
- kMac,
- kOS_2,
- kAPPLE_GS,
- kAtari_ST,
- kNext,
- kVAX_VMS,
- kWIN95
- };
- }
-}
-
-struct CArchiveHeader
-{
- // Byte ArchiverVersion;
- // Byte ExtractVersion;
- Byte HostOS;
- // Byte Flags;
- // Byte SecuryVersion;
- // Byte FileType;
- // Byte Reserved;
- UInt32 CTime;
- UInt32 MTime;
- UInt32 ArchiveSize;
- // UInt32 SecurityEnvelopeFilePosition;
- // UInt16 FilespecPositionInFilename;
- // UInt16 LengthOfSecurityEnvelopeSata;
- // Byte EncryptionVersion;
- // Byte LastChapter;
- AString Name;
- AString Comment;
-
- HRESULT Parse(const Byte *p, unsigned size);
-};
-
-static HRESULT ReadString(const Byte *p, unsigned &size, AString &res)
-{
- AString s;
- for (unsigned i = 0; i < size;)
- {
- char c = (char)p[i++];
- if (c == 0)
- {
- size = i;
- res = s;
- return S_OK;
- }
- s += c;
- }
- return S_FALSE;
-}
-
-HRESULT CArchiveHeader::Parse(const Byte *p, unsigned size)
-{
- if (size < kBlockSizeMin)
- return S_FALSE;
- Byte firstHeaderSize = p[0];
- if (firstHeaderSize > size)
- return S_FALSE;
- // ArchiverVersion = p[1];
- // ExtractVersion = p[2];
- HostOS = p[3];
- // Flags = p[4];
- // SecuryVersion = p[5];
- if (p[6] != NFileHeader::NFileType::kArchiveHeader)
- return S_FALSE;
- // Reserved = p[7];
- CTime = Get32(p + 8);
- MTime = Get32(p + 12);
- ArchiveSize = Get32(p + 16);
- // SecurityEnvelopeFilePosition = Get32(p + 20);
- // UInt16 filespecPositionInFilename = Get16(p + 24);
- // LengthOfSecurityEnvelopeSata = Get16(p + 26);
- // EncryptionVersion = p[28];
- // LastChapter = p[29];
- unsigned pos = firstHeaderSize;
- unsigned size1 = size - pos;
- RINOK(ReadString(p + pos, size1, Name));
- pos += size1;
- size1 = size - pos;
- RINOK(ReadString(p + pos, size1, Comment));
- pos += size1;
- return S_OK;
-}
-
-struct CItem
-{
- AString Name;
- AString Comment;
-
- UInt32 MTime;
- UInt32 PackSize;
- UInt32 Size;
- UInt32 FileCRC;
- UInt32 SplitPos;
-
- Byte Version;
- Byte ExtractVersion;
- Byte HostOS;
- Byte Flags;
- Byte Method;
- Byte FileType;
-
- // UInt16 FilespecPositionInFilename;
- UInt16 FileAccessMode;
- // Byte FirstChapter;
- // Byte LastChapter;
-
- UInt64 DataPosition;
-
- bool IsEncrypted() const { return (Flags & NFileHeader::NFlags::kGarbled) != 0; }
- bool IsDir() const { return (FileType == NFileHeader::NFileType::kDirectory); }
- bool IsSplitAfter() const { return (Flags & NFileHeader::NFlags::kVolume) != 0; }
- bool IsSplitBefore() const { return (Flags & NFileHeader::NFlags::kExtFile) != 0; }
- UInt32 GetWinAttributes() const
- {
- UInt32 winAtrributes;
- switch(HostOS)
- {
- case NFileHeader::NHostOS::kMSDOS:
- case NFileHeader::NHostOS::kWIN95:
- winAtrributes = FileAccessMode;
- break;
- default:
- winAtrributes = 0;
- }
- if (IsDir())
- winAtrributes |= FILE_ATTRIBUTE_DIRECTORY;
- return winAtrributes;
- }
-
- HRESULT Parse(const Byte *p, unsigned size);
-};
-
-HRESULT CItem::Parse(const Byte *p, unsigned size)
-{
- if (size < kBlockSizeMin)
- return S_FALSE;
-
- Byte firstHeaderSize = p[0];
-
- Version = p[1];
- ExtractVersion = p[2];
- HostOS = p[3];
- Flags = p[4];
- Method = p[5];
- FileType = p[6];
- // Reserved = p[7];
- MTime = Get32(p + 8);
- PackSize = Get32(p + 12);
- Size = Get32(p + 16);
- FileCRC = Get32(p + 20);
- // FilespecPositionInFilename = Get16(p + 24);
- FileAccessMode = Get16(p + 26);
- // FirstChapter = p[28];
- // FirstChapter = p[29];
-
- SplitPos = 0;
- if (IsSplitBefore() && firstHeaderSize >= 34)
- SplitPos = Get32(p + 30);
-
- unsigned pos = firstHeaderSize;
- unsigned size1 = size - pos;
- RINOK(ReadString(p + pos, size1, Name));
- pos += size1;
- size1 = size - pos;
- RINOK(ReadString(p + pos, size1, Comment));
- pos += size1;
-
- return S_OK;
-}
-
-struct CInArchiveException
-{
- enum CCauseType
- {
- kUnexpectedEndOfArchive = 0,
- kCRCError,
- kIncorrectArchive,
- }
- Cause;
- CInArchiveException(CCauseType cause): Cause(cause) {};
-};
-
-class CInArchive
-{
- UInt32 _blockSize;
- Byte _block[kBlockSizeMax + 4];
-
- HRESULT ReadBlock(bool &filled);
- HRESULT ReadSignatureAndBlock(bool &filled);
- HRESULT SkipExtendedHeaders();
-
- HRESULT SafeReadBytes(void *data, UInt32 size);
-
-public:
- CArchiveHeader Header;
-
- IInStream *Stream;
- IArchiveOpenCallback *Callback;
- UInt64 NumFiles;
- UInt64 NumBytes;
-
- HRESULT Open(const UInt64 *searchHeaderSizeLimit);
- HRESULT GetNextItem(bool &filled, CItem &item);
-};
-
-static inline bool TestMarkerCandidate(const Byte *p, unsigned maxSize)
-{
- if (p[0] != NSignature::kSig0 || p[1] != NSignature::kSig1)
- return false;
- UInt32 blockSize = Get16(p + 2);
- p += 4;
- if (p[6] != NFileHeader::NFileType::kArchiveHeader ||
- p[0] > blockSize ||
- maxSize < 2 + 2 + blockSize + 4 ||
- blockSize < kBlockSizeMin || blockSize > kBlockSizeMax ||
- p[28] > 8) // EncryptionVersion
- return false;
- // return (Get32(p + blockSize) == CrcCalc(p, blockSize));
- return true;
-}
-
-static HRESULT FindAndReadMarker(ISequentialInStream *stream, const UInt64 *searchHeaderSizeLimit, UInt64 &position)
-{
- position = 0;
-
- const int kMarkerSizeMin = 2 + 2 + kBlockSizeMin + 4;
- const int kMarkerSizeMax = 2 + 2 + kBlockSizeMax + 4;
-
- CByteBuffer byteBuffer;
- const UInt32 kBufSize = 1 << 16;
- byteBuffer.SetCapacity(kBufSize);
- Byte *buf = byteBuffer;
-
- size_t processedSize = kMarkerSizeMax;
- RINOK(ReadStream(stream, buf, &processedSize));
- if (processedSize < kMarkerSizeMin)
- return S_FALSE;
- if (TestMarkerCandidate(buf, (unsigned)processedSize))
- return S_OK;
-
- UInt32 numBytesPrev = (UInt32)processedSize - 1;
- memmove(buf, buf + 1, numBytesPrev);
- UInt64 curTestPos = 1;
- for (;;)
- {
- if (searchHeaderSizeLimit != NULL)
- if (curTestPos > *searchHeaderSizeLimit)
- return S_FALSE;
- processedSize = kBufSize - numBytesPrev;
- RINOK(ReadStream(stream, buf + numBytesPrev, &processedSize));
- UInt32 numBytesInBuffer = numBytesPrev + (UInt32)processedSize;
- if (numBytesInBuffer < kMarkerSizeMin)
- return S_FALSE;
- UInt32 numTests = numBytesInBuffer - kMarkerSizeMin + 1;
- UInt32 pos;
- for (pos = 0; pos < numTests; pos++)
- {
- for (; buf[pos] != NSignature::kSig0 && pos < numTests; pos++);
- if (pos == numTests)
- break;
- if (TestMarkerCandidate(buf + pos, numBytesInBuffer - pos))
- {
- position = curTestPos + pos;
- return S_OK;
- }
- }
- curTestPos += pos;
- numBytesPrev = numBytesInBuffer - numTests;
- memmove(buf, buf + numTests, numBytesPrev);
- }
-}
-
-HRESULT CInArchive::SafeReadBytes(void *data, UInt32 size)
-{
- size_t processed = size;
- RINOK(ReadStream(Stream, data, &processed));
- if (processed != size)
- throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive);
- return S_OK;
-}
-
-HRESULT CInArchive::ReadBlock(bool &filled)
-{
- filled = false;
- Byte buf[2];
- RINOK(SafeReadBytes(buf, 2));
- _blockSize = Get16(buf);
- if (_blockSize == 0)
- return S_OK;
- if (_blockSize > kBlockSizeMax)
- throw CInArchiveException(CInArchiveException::kIncorrectArchive);
- RINOK(SafeReadBytes(_block, _blockSize + 4));
- NumBytes += _blockSize + 6;
- if (Get32(_block + _blockSize) != CrcCalc(_block, _blockSize))
- throw CInArchiveException(CInArchiveException::kCRCError);
- filled = true;
- return S_OK;
-}
-
-HRESULT CInArchive::ReadSignatureAndBlock(bool &filled)
-{
- Byte id[2];
- RINOK(SafeReadBytes(id, 2));
- if (id[0] != NSignature::kSig0 || id[1] != NSignature::kSig1)
- throw CInArchiveException(CInArchiveException::kIncorrectArchive);
- return ReadBlock(filled);
-}
-
-HRESULT CInArchive::SkipExtendedHeaders()
-{
- for (UInt32 i = 0;; i++)
- {
- bool filled;
- RINOK(ReadBlock(filled));
- if (!filled)
- return S_OK;
- if (Callback && (i & 0xFF) == 0)
- RINOK(Callback->SetCompleted(&NumFiles, &NumBytes));
- }
-}
-
-HRESULT CInArchive::Open(const UInt64 *searchHeaderSizeLimit)
-{
- UInt64 position = 0;
- RINOK(FindAndReadMarker(Stream, searchHeaderSizeLimit, position));
- RINOK(Stream->Seek(position, STREAM_SEEK_SET, NULL));
- bool filled;
- RINOK(ReadSignatureAndBlock(filled));
- if (!filled)
- return S_FALSE;
- RINOK(Header.Parse(_block, _blockSize));
- return SkipExtendedHeaders();
-}
-
-HRESULT CInArchive::GetNextItem(bool &filled, CItem &item)
-{
- RINOK(ReadSignatureAndBlock(filled));
- if (!filled)
- return S_OK;
- filled = false;
- RINOK(item.Parse(_block, _blockSize));
- /*
- UInt32 extraData;
- if ((header.Flags & NFileHeader::NFlags::kExtFile) != 0)
- extraData = GetUi32(_block + pos);
- */
-
- RINOK(SkipExtendedHeaders());
- filled = true;
- return S_OK;
-}
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(IInArchive)
-
- INTERFACE_IInArchive(;)
-
- HRESULT Open2(IInStream *inStream, const UInt64 *maxCheckStartPosition,
- IArchiveOpenCallback *callback);
-private:
- CInArchive _archive;
- CObjectVector<CItem> _items;
- CMyComPtr<IInStream> _stream;
-};
-
-const wchar_t *kHostOS[] =
-{
- L"MSDOS",
- L"PRIMOS",
- L"UNIX",
- L"AMIGA",
- L"MAC",
- L"OS/2",
- L"APPLE GS",
- L"ATARI ST",
- L"NEXT",
- L"VAX VMS",
- L"WIN95"
-};
-
-const wchar_t *kUnknownOS = L"Unknown";
-
-const int kNumHostOSes = sizeof(kHostOS) / sizeof(kHostOS[0]);
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidName, VT_BSTR},
- { NULL, kpidCTime, VT_BSTR},
- { NULL, kpidMTime, VT_BSTR},
- { NULL, kpidHostOS, VT_BSTR},
- { NULL, kpidComment, VT_BSTR}
-};
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI4},
- { NULL, kpidPosition, VT_UI8},
- { NULL, kpidPackSize, VT_UI4},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidAttrib, VT_UI4},
- { NULL, kpidEncrypted, VT_BOOL},
- { NULL, kpidCRC, VT_UI4},
- { NULL, kpidMethod, VT_UI1},
- { NULL, kpidHostOS, VT_BSTR},
- { NULL, kpidComment, VT_BSTR}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-static void SetTime(UInt32 dosTime, NWindows::NCOM::CPropVariant &prop)
-{
- if (dosTime == 0)
- return;
- FILETIME localFileTime, utc;
- if (NTime::DosTimeToFileTime(dosTime, localFileTime))
- {
- if (!LocalFileTimeToFileTime(&localFileTime, &utc))
- utc.dwHighDateTime = utc.dwLowDateTime = 0;
- }
- else
- utc.dwHighDateTime = utc.dwLowDateTime = 0;
- prop = utc;
-}
-
-static void SetHostOS(Byte hostOS, NWindows::NCOM::CPropVariant &prop)
-{
- prop = hostOS < kNumHostOSes ? kHostOS[hostOS] : kUnknownOS;
-}
-
-static void SetUnicodeString(const AString &s, NWindows::NCOM::CPropVariant &prop)
-{
- if (!s.IsEmpty())
- prop = MultiByteToUnicodeString(s, CP_OEMCP);
-}
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidName: SetUnicodeString(_archive.Header.Name, prop); break;
- case kpidCTime: SetTime(_archive.Header.CTime, prop); break;
- case kpidMTime: SetTime(_archive.Header.MTime, prop); break;
- case kpidHostOS: SetHostOS(_archive.Header.HostOS, prop); break;
- case kpidComment: SetUnicodeString(_archive.Header.Comment, prop); break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _items.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- const CItem &item = _items[index];
- switch(propID)
- {
- case kpidPath: prop = NItemName::GetOSName(MultiByteToUnicodeString(item.Name, CP_OEMCP)); break;
- case kpidIsDir: prop = item.IsDir(); break;
- case kpidSize: prop = item.Size; break;
- case kpidPackSize: prop = item.PackSize; break;
- case kpidPosition: if (item.IsSplitBefore() || item.IsSplitAfter()) prop = (UInt64)item.SplitPos; break;
- case kpidAttrib: prop = item.GetWinAttributes(); break;
- case kpidEncrypted: prop = item.IsEncrypted(); break;
- case kpidCRC: prop = item.FileCRC; break;
- case kpidMethod: prop = item.Method; break;
- case kpidHostOS: SetHostOS(item.HostOS, prop); break;
- case kpidMTime: SetTime(item.MTime, prop); break;
- case kpidComment: SetUnicodeString(item.Comment, prop); break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-HRESULT CHandler::Open2(IInStream *inStream, const UInt64 *maxCheckStartPosition,
- IArchiveOpenCallback *callback)
-{
- Close();
-
- UInt64 endPos = 0;
- if (callback != NULL)
- {
- RINOK(inStream->Seek(0, STREAM_SEEK_END, &endPos));
- RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
- }
-
- _archive.Stream = inStream;
- _archive.Callback = callback;
- _archive.NumFiles = _archive.NumBytes = 0;
-
- RINOK(_archive.Open(maxCheckStartPosition));
- if (callback != NULL)
- RINOK(callback->SetTotal(NULL, &endPos));
- for (;;)
- {
- CItem item;
- bool filled;
-
-
- RINOK(_archive.GetNextItem(filled, item));
-
- RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &item.DataPosition));
-
- if (!filled)
- break;
- _items.Add(item);
-
- if (inStream->Seek(item.PackSize, STREAM_SEEK_CUR, NULL) != S_OK)
- throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive);
-
- _archive.NumFiles = _items.Size();
- _archive.NumBytes = item.DataPosition;
-
- if (callback != NULL && _items.Size() % 100 == 0)
- {
- RINOK(callback->SetCompleted(&_archive.NumFiles, &_archive.NumBytes));
- }
- }
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *callback)
-{
- COM_TRY_BEGIN
- HRESULT res;
- try
- {
- res = Open2(inStream, maxCheckStartPosition, callback);
- if (res == S_OK)
- {
- _stream = inStream;
- return S_OK;
- }
- }
- catch(const CInArchiveException &) { res = S_FALSE; }
- Close();
- return res;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _items.Clear();
- _stream.Release();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 testModeSpec, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (testModeSpec != 0);
- UInt64 totalUnpacked = 0, totalPacked = 0;
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _items.Size();
- if (numItems == 0)
- return S_OK;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- {
- const CItem &item = _items[allFilesMode ? i : indices[i]];
- totalUnpacked += item.Size;
- totalPacked += item.PackSize;
- }
- extractCallback->SetTotal(totalUnpacked);
-
- totalUnpacked = totalPacked = 0;
- UInt64 curUnpacked, curPacked;
-
- CMyComPtr<ICompressCoder> arj1Decoder;
- CMyComPtr<ICompressCoder> arj2Decoder;
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *inStreamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(inStreamSpec);
- inStreamSpec->SetStream(_stream);
-
- for (i = 0; i < numItems; i++, totalUnpacked += curUnpacked, totalPacked += curPacked)
- {
- lps->InSize = totalPacked;
- lps->OutSize = totalUnpacked;
- RINOK(lps->SetCur());
-
- curUnpacked = curPacked = 0;
-
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NExtract::NAskMode::kTest :
- NExtract::NAskMode::kExtract;
- Int32 index = allFilesMode ? i : indices[i];
- const CItem &item = _items[index];
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
- if (item.IsDir())
- {
- // if (!testMode)
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kOK));
- }
- continue;
- }
-
- if (!testMode && (!realOutStream))
- continue;
-
- RINOK(extractCallback->PrepareOperation(askMode));
- curUnpacked = item.Size;
- curPacked = item.PackSize;
-
- {
- COutStreamWithCRC *outStreamSpec = new COutStreamWithCRC;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
- outStreamSpec->SetStream(realOutStream);
- realOutStream.Release();
- outStreamSpec->Init();
-
- inStreamSpec->Init(item.PackSize);
-
- UInt64 pos;
- _stream->Seek(item.DataPosition, STREAM_SEEK_SET, &pos);
-
- HRESULT result = S_OK;
- Int32 opRes = NExtract::NOperationResult::kOK;
-
- if (item.IsEncrypted())
- opRes = NExtract::NOperationResult::kUnSupportedMethod;
- else
- {
- switch(item.Method)
- {
- case NFileHeader::NCompressionMethod::kStored:
- {
- result = copyCoder->Code(inStream, outStream, NULL, NULL, progress);
- if (result == S_OK && copyCoderSpec->TotalSize != item.PackSize)
- result = S_FALSE;
- break;
- }
- case NFileHeader::NCompressionMethod::kCompressed1a:
- case NFileHeader::NCompressionMethod::kCompressed1b:
- case NFileHeader::NCompressionMethod::kCompressed1c:
- {
- if (!arj1Decoder)
- arj1Decoder = new NCompress::NArj::NDecoder1::CCoder;
- result = arj1Decoder->Code(inStream, outStream, NULL, &curUnpacked, progress);
- break;
- }
- case NFileHeader::NCompressionMethod::kCompressed2:
- {
- if (!arj2Decoder)
- arj2Decoder = new NCompress::NArj::NDecoder2::CCoder;
- result = arj2Decoder->Code(inStream, outStream, NULL, &curUnpacked, progress);
- break;
- }
- default:
- opRes = NExtract::NOperationResult::kUnSupportedMethod;
- }
- }
- if (opRes == NExtract::NOperationResult::kOK)
- {
- if (result == S_FALSE)
- opRes = NExtract::NOperationResult::kDataError;
- else
- {
- RINOK(result);
- opRes = (outStreamSpec->GetCRC() == item.FileCRC) ?
- NExtract::NOperationResult::kOK:
- NExtract::NOperationResult::kCRCError;
- }
- }
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(opRes));
- }
- }
- return S_OK;
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Arj", L"arj", 0, 4, { 0x60, 0xEA }, 2, false, CreateArc, 0 };
-
-REGISTER_ARC(Arj)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Bz2Handler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Bz2Handler.cpp
deleted file mode 100644
index 515fa30ee..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Bz2Handler.cpp
+++ /dev/null
@@ -1,432 +0,0 @@
-// Bz2Handler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-
-#include "Windows/PropVariant.h"
-
-#ifdef COMPRESS_MT
-#include "../../Windows/System.h"
-#endif
-
-#include "../Common/CreateCoder.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/BZip2Decoder.h"
-#include "../Compress/BZip2Encoder.h"
-#include "../Compress/CopyCoder.h"
-
-#include "Common/DummyOutStream.h"
-#include "Common/ParseProperties.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NBz2 {
-
-static const UInt32 kNumPassesX1 = 1;
-static const UInt32 kNumPassesX7 = 2;
-static const UInt32 kNumPassesX9 = 7;
-
-static const UInt32 kDicSizeX1 = 100000;
-static const UInt32 kDicSizeX3 = 500000;
-static const UInt32 kDicSizeX5 = 900000;
-
-class CHandler:
- public IInArchive,
- public IArchiveOpenSeq,
- public IOutArchive,
- public ISetProperties,
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _stream;
- CMyComPtr<ISequentialInStream> _seqStream;
- UInt64 _packSize;
- UInt64 _startPosition;
- bool _packSizeDefined;
-
- UInt32 _level;
- UInt32 _dicSize;
- UInt32 _numPasses;
- #ifdef COMPRESS_MT
- UInt32 _numThreads;
- #endif
-
- void InitMethodProperties()
- {
- _level = 5;
- _dicSize =
- _numPasses = 0xFFFFFFFF;
- #ifdef COMPRESS_MT
- _numThreads = NWindows::NSystem::GetNumberOfProcessors();;
- #endif
- }
-
-public:
- MY_UNKNOWN_IMP4(IInArchive, IArchiveOpenSeq, IOutArchive, ISetProperties)
-
- INTERFACE_IInArchive(;)
- INTERFACE_IOutArchive(;)
- STDMETHOD(OpenSeq)(ISequentialInStream *stream);
- STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProps);
-
- CHandler() { InitMethodProperties(); }
-};
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPackSize, VT_UI8}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO_Table
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidPhySize: if (_packSizeDefined) prop = _packSize; break;
- }
- prop.Detach(value);
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = 1;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value)
-{
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidPackSize: if (_packSizeDefined) prop = _packSize; break;
- }
- prop.Detach(value);
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- try
- {
- Close();
- RINOK(stream->Seek(0, STREAM_SEEK_CUR, &_startPosition));
- const int kSignatureSize = 3;
- Byte buf[kSignatureSize];
- RINOK(ReadStream_FALSE(stream, buf, kSignatureSize));
- if (buf[0] != 'B' || buf[1] != 'Z' || buf[2] != 'h')
- return S_FALSE;
-
- UInt64 endPosition;
- RINOK(stream->Seek(0, STREAM_SEEK_END, &endPosition));
- _packSize = endPosition - _startPosition;
- _packSizeDefined = true;
- _stream = stream;
- _seqStream = stream;
- }
- catch(...) { return S_FALSE; }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::OpenSeq(ISequentialInStream *stream)
-{
- Close();
- _seqStream = stream;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _packSizeDefined = false;
- _seqStream.Release();
- _stream.Release();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool allFilesMode = (numItems == (UInt32)-1);
- if (!allFilesMode)
- {
- if (numItems == 0)
- return S_OK;
- if (numItems != 1 || indices[0] != 0)
- return E_INVALIDARG;
- }
-
- bool testMode = (_aTestMode != 0);
- if (_stream)
- extractCallback->SetTotal(_packSize);
- UInt64 currentTotalPacked = 0;
- RINOK(extractCallback->SetCompleted(&currentTotalPacked));
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- RINOK(extractCallback->GetStream(0, &realOutStream, askMode));
- if (!testMode && !realOutStream)
- return S_OK;
-
- extractCallback->PrepareOperation(askMode);
-
- NCompress::NBZip2::CDecoder *decoderSpec = new NCompress::NBZip2::CDecoder;
- CMyComPtr<ICompressCoder> decoder = decoderSpec;
-
- if (_stream)
- {
- RINOK(_stream->Seek(_startPosition, STREAM_SEEK_SET, NULL));
- }
-
- decoderSpec->SetInStream(_seqStream);
-
- #if defined( COMPRESS_MT) && defined( COMPRESS_BZIP2_MT)
- RINOK(decoderSpec->SetNumberOfThreads(_numThreads));
- #endif
-
- CDummyOutStream *outStreamSpec = new CDummyOutStream;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
- outStreamSpec->SetStream(realOutStream);
- outStreamSpec->Init();
-
- realOutStream.Release();
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, true);
-
- HRESULT result = S_OK;
-
- bool firstItem = true;
- for (;;)
- {
- lps->InSize = currentTotalPacked;
- lps->OutSize = outStreamSpec->GetSize();
-
- RINOK(lps->SetCur());
-
- bool isBz2;
- result = decoderSpec->CodeResume(outStream, isBz2, progress);
-
- if (result != S_OK)
- break;
- if (!isBz2)
- {
- if (firstItem)
- result = S_FALSE;
- break;
- }
- firstItem = false;
-
- _packSize = currentTotalPacked = decoderSpec->GetInputProcessedSize();
- _packSizeDefined = true;
- }
- decoderSpec->ReleaseInStream();
- outStream.Release();
-
- Int32 retResult;
- if (result == S_OK)
- retResult = NExtract::NOperationResult::kOK;
- else if (result == S_FALSE)
- retResult = NExtract::NOperationResult::kDataError;
- else
- return result;
- return extractCallback->SetOperationResult(retResult);
-
- COM_TRY_END
-}
-
-static HRESULT UpdateArchive(
- UInt64 unpackSize,
- ISequentialOutStream *outStream,
- int indexInClient,
- UInt32 dictionary,
- UInt32 numPasses,
- #ifdef COMPRESS_MT
- UInt32 numThreads,
- #endif
- IArchiveUpdateCallback *updateCallback)
-{
- RINOK(updateCallback->SetTotal(unpackSize));
- UInt64 complexity = 0;
- RINOK(updateCallback->SetCompleted(&complexity));
-
- CMyComPtr<ISequentialInStream> fileInStream;
-
- RINOK(updateCallback->GetStream(indexInClient, &fileInStream));
-
- CLocalProgress *localProgressSpec = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> localProgress = localProgressSpec;
- localProgressSpec->Init(updateCallback, true);
-
- NCompress::NBZip2::CEncoder *encoderSpec = new NCompress::NBZip2::CEncoder;
- CMyComPtr<ICompressCoder> encoder = encoderSpec;
- {
- NWindows::NCOM::CPropVariant properties[] =
- {
- dictionary,
- numPasses
- #ifdef COMPRESS_MT
- , numThreads
- #endif
- };
- PROPID propIDs[] =
- {
- NCoderPropID::kDictionarySize,
- NCoderPropID::kNumPasses
- #ifdef COMPRESS_MT
- , NCoderPropID::kNumThreads
- #endif
- };
- RINOK(encoderSpec->SetCoderProperties(propIDs, properties, sizeof(propIDs) / sizeof(propIDs[0])));
- }
-
- RINOK(encoder->Code(fileInStream, outStream, NULL, NULL, localProgress));
-
- return updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK);
-}
-
-STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type)
-{
- *type = NFileTimeType::kUnix;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems,
- IArchiveUpdateCallback *updateCallback)
-{
- if (numItems != 1)
- return E_INVALIDARG;
-
- Int32 newData, newProps;
- UInt32 indexInArchive;
- if (!updateCallback)
- return E_FAIL;
- RINOK(updateCallback->GetUpdateItemInfo(0, &newData, &newProps, &indexInArchive));
-
- if (IntToBool(newProps))
- {
- {
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(0, kpidIsDir, &prop));
- if (prop.vt == VT_BOOL)
- {
- if (prop.boolVal != VARIANT_FALSE)
- return E_INVALIDARG;
- }
- else if (prop.vt != VT_EMPTY)
- return E_INVALIDARG;
- }
- }
-
- if (IntToBool(newData))
- {
- UInt64 size;
- {
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(0, kpidSize, &prop));
- if (prop.vt != VT_UI8)
- return E_INVALIDARG;
- size = prop.uhVal.QuadPart;
- }
-
- UInt32 dicSize = _dicSize;
- if (dicSize == 0xFFFFFFFF)
- dicSize = (_level >= 5 ? kDicSizeX5 :
- (_level >= 3 ? kDicSizeX3 :
- kDicSizeX1));
-
- UInt32 numPasses = _numPasses;
- if (numPasses == 0xFFFFFFFF)
- numPasses = (_level >= 9 ? kNumPassesX9 :
- (_level >= 7 ? kNumPassesX7 :
- kNumPassesX1));
-
- return UpdateArchive(
- size, outStream, 0, dicSize, numPasses,
- #ifdef COMPRESS_MT
- _numThreads,
- #endif
- updateCallback);
- }
- if (indexInArchive != 0)
- return E_INVALIDARG;
- if (_stream)
- RINOK(_stream->Seek(_startPosition, STREAM_SEEK_SET, NULL));
- return NCompress::CopyStream(_stream, outStream, NULL);
-}
-
-STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProps)
-{
- InitMethodProperties();
- #ifdef COMPRESS_MT
- const UInt32 numProcessors = NSystem::GetNumberOfProcessors();
- _numThreads = numProcessors;
- #endif
-
- for (int i = 0; i < numProps; i++)
- {
- UString name = names[i];
- name.MakeUpper();
- if (name.IsEmpty())
- return E_INVALIDARG;
- const PROPVARIANT &prop = values[i];
- if (name[0] == L'X')
- {
- UInt32 level = 9;
- RINOK(ParsePropValue(name.Mid(1), prop, level));
- _level = level;
- }
- else if (name[0] == L'D')
- {
- UInt32 dicSize = kDicSizeX5;
- RINOK(ParsePropDictionaryValue(name.Mid(1), prop, dicSize));
- _dicSize = dicSize;
- }
- else if (name.Left(4) == L"PASS")
- {
- UInt32 num = kNumPassesX9;
- RINOK(ParsePropValue(name.Mid(4), prop, num));
- _numPasses = num;
- }
- else if (name.Left(2) == L"MT")
- {
- #ifdef COMPRESS_MT
- RINOK(ParseMtProp(name.Mid(2), prop, numProcessors, _numThreads));
- #endif
- }
- else
- return E_INVALIDARG;
- }
- return S_OK;
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-#ifndef EXTRACT_ONLY
-static IOutArchive *CreateArcOut() { return new CHandler; }
-#else
-#define CreateArcOut 0
-#endif
-
-static CArcInfo g_ArcInfo =
- { L"BZip2", L"bz2 bzip2 tbz2 tbz", L"* * .tar .tar", 2, { 'B', 'Z', 'h' }, 3, true, CreateArc, CreateArcOut };
-
-REGISTER_ARC(BZip2)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabBlockInStream.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabBlockInStream.cpp
deleted file mode 100644
index 12c73eb5f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabBlockInStream.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-// CabBlockInStream.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/Alloc.h"
-
-#include "Common/Defs.h"
-
-#include "../../Common/StreamUtils.h"
-
-#include "CabBlockInStream.h"
-
-namespace NArchive {
-namespace NCab {
-
-static const UInt32 kBlockSize = (1 << 16);
-
-bool CCabBlockInStream::Create()
-{
- if (!_buffer)
- _buffer = (Byte *)::MyAlloc(kBlockSize);
- return (_buffer != 0);
-}
-
-CCabBlockInStream::~CCabBlockInStream()
-{
- MyFree(_buffer);
-}
-
-class CCheckSum2
-{
- UInt32 m_Value;
- int m_Pos;
- Byte m_Hist[4];
-public:
- CCheckSum2(): m_Value(0){};
- void Init() { m_Value = 0; m_Pos = 0; }
- void Update(const void *data, UInt32 size);
- void FinishDataUpdate()
- {
- for (int i = 0; i < m_Pos; i++)
- m_Value ^= ((UInt32)(m_Hist[i])) << (8 * (m_Pos - i - 1));
- }
- void UpdateUInt32(UInt32 v) { m_Value ^= v; }
- UInt32 GetResult() const { return m_Value; }
-};
-
-void CCheckSum2::Update(const void *data, UInt32 size)
-{
- UInt32 checkSum = m_Value;
- const Byte *dataPointer = (const Byte *)data;
-
- while (size != 0 && m_Pos != 0)
- {
- m_Hist[m_Pos] = *dataPointer++;
- m_Pos = (m_Pos + 1) & 3;
- size--;
- if (m_Pos == 0)
- for (int i = 0; i < 4; i++)
- checkSum ^= ((UInt32)m_Hist[i]) << (8 * i);
- }
-
- int numWords = size / 4;
-
- while (numWords-- != 0)
- {
- UInt32 temp = *dataPointer++;
- temp |= ((UInt32)(*dataPointer++)) << 8;
- temp |= ((UInt32)(*dataPointer++)) << 16;
- temp |= ((UInt32)(*dataPointer++)) << 24;
- checkSum ^= temp;
- }
- m_Value = checkSum;
-
- size &= 3;
-
- while (size != 0)
- {
- m_Hist[m_Pos] = *dataPointer++;
- m_Pos = (m_Pos + 1) & 3;
- size--;
- }
-}
-
-static const UInt32 kDataBlockHeaderSize = 8;
-
-class CTempCabInBuffer2
-{
-public:
- Byte Buffer[kDataBlockHeaderSize];
- UInt32 Pos;
- Byte ReadByte()
- {
- return Buffer[Pos++];
- }
- UInt32 ReadUInt32()
- {
- UInt32 value = 0;
- for (int i = 0; i < 4; i++)
- value |= (((UInt32)ReadByte()) << (8 * i));
- return value;
- }
- UInt16 ReadUInt16()
- {
- UInt16 value = 0;
- for (int i = 0; i < 2; i++)
- value |= (((UInt16)ReadByte()) << (8 * i));
- return value;
- }
-};
-
-HRESULT CCabBlockInStream::PreRead(UInt32 &packSize, UInt32 &unpackSize)
-{
- CTempCabInBuffer2 inBuffer;
- inBuffer.Pos = 0;
- RINOK(ReadStream_FALSE(_stream, inBuffer.Buffer, kDataBlockHeaderSize))
-
- UInt32 checkSum = inBuffer.ReadUInt32();
- packSize = inBuffer.ReadUInt16();
- unpackSize = inBuffer.ReadUInt16();
- if (ReservedSize != 0)
- {
- RINOK(ReadStream_FALSE(_stream, _buffer, ReservedSize));
- }
- _pos = 0;
- CCheckSum2 checkSumCalc;
- checkSumCalc.Init();
- UInt32 packSize2 = packSize;
- if (MsZip && _size == 0)
- {
- if (packSize < 2)
- return S_FALSE; // bad block;
- Byte sig[2];
- RINOK(ReadStream_FALSE(_stream, sig, 2));
- if (sig[0] != 0x43 || sig[1] != 0x4B)
- return S_FALSE;
- packSize2 -= 2;
- checkSumCalc.Update(sig, 2);
- }
-
- if (kBlockSize - _size < packSize2)
- return S_FALSE;
-
- UInt32 curSize = packSize2;
- if (curSize != 0)
- {
- size_t processedSizeLoc = curSize;
- RINOK(ReadStream(_stream, _buffer + _size, &processedSizeLoc));
- checkSumCalc.Update(_buffer + _size, (UInt32)processedSizeLoc);
- _size += (UInt32)processedSizeLoc;
- if (processedSizeLoc != curSize)
- return S_FALSE;
- }
- TotalPackSize = _size;
-
- checkSumCalc.FinishDataUpdate();
-
- bool dataError;
- if (checkSum == 0)
- dataError = false;
- else
- {
- checkSumCalc.UpdateUInt32(packSize | (((UInt32)unpackSize) << 16));
- dataError = (checkSumCalc.GetResult() != checkSum);
- }
- DataError |= dataError;
- return dataError ? S_FALSE : S_OK;
-}
-
-STDMETHODIMP CCabBlockInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != 0)
- *processedSize = 0;
- if (size == 0)
- return S_OK;
- if (_size != 0)
- {
- size = MyMin(_size, size);
- memmove(data, _buffer + _pos, size);
- _pos += size;
- _size -= size;
- if (processedSize != 0)
- *processedSize = size;
- return S_OK;
- }
- return S_OK; // no blocks data
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabBlockInStream.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabBlockInStream.h
deleted file mode 100644
index a70dfdab4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabBlockInStream.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// CabBlockInStream.cpp
-
-#ifndef __CABBLOCKINSTREAM_H
-#define __CABBLOCKINSTREAM_H
-
-#include "Common/MyCom.h"
-#include "../../IStream.h"
-
-namespace NArchive {
-namespace NCab {
-
-class CCabBlockInStream:
- public ISequentialInStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialInStream> _stream;
- Byte *_buffer;
- UInt32 _pos;
- UInt32 _size;
-
-public:
- UInt32 TotalPackSize;
- UInt32 ReservedSize;
- bool DataError;
- bool MsZip;
-
- CCabBlockInStream(): _buffer(0), TotalPackSize(0), ReservedSize(0), DataError(false), MsZip(false) {}
- ~CCabBlockInStream();
- bool Create();
- void SetStream(ISequentialInStream *stream) { _stream = stream; }
-
- void InitForNewFolder() { TotalPackSize = 0; }
- void InitForNewBlock() { _size = 0; }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-
- HRESULT PreRead(UInt32 &packSize, UInt32 &unpackSize);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHandler.cpp
deleted file mode 100644
index c7d277e5f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHandler.cpp
+++ /dev/null
@@ -1,826 +0,0 @@
-// CabHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/Defs.h"
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-#include "Common/UTFConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../../Common/ProgressUtils.h"
-
-#include "../../Compress/CopyCoder.h"
-#include "../../Compress/DeflateDecoder.h"
-#include "../../Compress/LzxDecoder.h"
-#include "../../Compress/QuantumDecoder.h"
-
-#include "../Common/ItemNameUtils.h"
-
-#include "CabBlockInStream.h"
-#include "CabHandler.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NCab {
-
-// #define _CAB_DETAILS
-
-#ifdef _CAB_DETAILS
-enum
-{
- kpidBlockReal = kpidUserDefined
-};
-#endif
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidAttrib, VT_UI4},
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidBlock, VT_I4}
- #ifdef _CAB_DETAILS
- ,
- { L"BlockReal", kpidBlockReal, VT_UI4},
- { NULL, kpidOffset, VT_UI4},
- { NULL, kpidVolume, VT_UI4}
- #endif
-};
-
-static const wchar_t *kMethods[] =
-{
- L"None",
- L"MSZip",
- L"Quantum",
- L"LZX"
-};
-
-static const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]);
-static const wchar_t *kUnknownMethod = L"Unknown";
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidMethod, VT_BSTR},
- // { NULL, kpidSolid, VT_BOOL},
- { NULL, kpidNumBlocks, VT_UI4},
- { NULL, kpidNumVolumes, VT_UI4}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidMethod:
- {
- UString resString;
- CRecordVector<Byte> ids;
- int i;
- for (int v = 0; v < m_Database.Volumes.Size(); v++)
- {
- const CDatabaseEx &de = m_Database.Volumes[v];
- for (i = 0; i < de.Folders.Size(); i++)
- ids.AddToUniqueSorted(de.Folders[i].GetCompressionMethod());
- }
- for (i = 0; i < ids.Size(); i++)
- {
- Byte id = ids[i];
- UString method = (id < kNumMethods) ? kMethods[id] : kUnknownMethod;
- if (!resString.IsEmpty())
- resString += L' ';
- resString += method;
- }
- prop = resString;
- break;
- }
- // case kpidSolid: prop = _database.IsSolid(); break;
- case kpidNumBlocks:
- {
- UInt32 numFolders = 0;
- for (int v = 0; v < m_Database.Volumes.Size(); v++)
- numFolders += m_Database.Volumes[v].Folders.Size();
- prop = numFolders;
- break;
- }
- case kpidNumVolumes:
- {
- prop = (UInt32)m_Database.Volumes.Size();
- break;
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
-
- const CMvItem &mvItem = m_Database.Items[index];
- const CDatabaseEx &db = m_Database.Volumes[mvItem.VolumeIndex];
- int itemIndex = mvItem.ItemIndex;
- const CItem &item = db.Items[itemIndex];
- switch(propID)
- {
- case kpidPath:
- {
- UString unicodeName;
- if (item.IsNameUTF())
- ConvertUTF8ToUnicode(item.Name, unicodeName);
- else
- unicodeName = MultiByteToUnicodeString(item.Name, CP_ACP);
- prop = (const wchar_t *)NItemName::WinNameToOSName(unicodeName);
- break;
- }
- case kpidIsDir: prop = item.IsDir(); break;
- case kpidSize: prop = item.Size; break;
- case kpidAttrib: prop = item.GetWinAttributes(); break;
-
- case kpidMTime:
- {
- FILETIME localFileTime, utcFileTime;
- if (NTime::DosTimeToFileTime(item.Time, localFileTime))
- {
- if (!LocalFileTimeToFileTime(&localFileTime, &utcFileTime))
- utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0;
- }
- else
- utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0;
- prop = utcFileTime;
- break;
- }
-
- case kpidMethod:
- {
- UInt32 realFolderIndex = item.GetFolderIndex(db.Folders.Size());
- const CFolder &folder = db.Folders[realFolderIndex];
- int methodIndex = folder.GetCompressionMethod();
- UString method = (methodIndex < kNumMethods) ? kMethods[methodIndex] : kUnknownMethod;
- if (methodIndex == NHeader::NCompressionMethodMajor::kLZX ||
- methodIndex == NHeader::NCompressionMethodMajor::kQuantum)
- {
- method += L":";
- wchar_t temp[32];
- ConvertUInt64ToString(folder.CompressionTypeMinor, temp);
- method += temp;
- }
- prop = method;
- break;
- }
- case kpidBlock: prop = (Int32)m_Database.GetFolderIndex(&mvItem); break;
-
- #ifdef _CAB_DETAILS
-
- case kpidBlockReal: prop = (UInt32)item.FolderIndex; break;
- case kpidOffset: prop = (UInt32)item.Offset; break;
- case kpidVolume: prop = (UInt32)mvItem.VolumeIndex; break;
-
- #endif
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-/*
-class CProgressImp: public CProgressVirt
-{
- CMyComPtr<IArchiveOpenCallback> m_OpenArchiveCallback;
-public:
- STDMETHOD(SetTotal)(const UInt64 *numFiles);
- STDMETHOD(SetCompleted)(const UInt64 *numFiles);
- void Init(IArchiveOpenCallback *openArchiveCallback)
- { m_OpenArchiveCallback = openArchiveCallback; }
-};
-
-STDMETHODIMP CProgressImp::SetTotal(const UInt64 *numFiles)
-{
- if (m_OpenArchiveCallback)
- return m_OpenArchiveCallback->SetCompleted(numFiles, NULL);
- return S_OK;
-}
-
-STDMETHODIMP CProgressImp::SetCompleted(const UInt64 *numFiles)
-{
- if (m_OpenArchiveCallback)
- return m_OpenArchiveCallback->SetCompleted(numFiles, NULL);
- return S_OK;
-}
-*/
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 *maxCheckStartPosition,
- IArchiveOpenCallback *callback)
-{
- COM_TRY_BEGIN
- Close();
- HRESULT res = S_FALSE;
- CInArchive archive;
- CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
- {
- CMyComPtr<IArchiveOpenCallback> openArchiveCallbackWrap = callback;
- openArchiveCallbackWrap.QueryInterface(IID_IArchiveOpenVolumeCallback, &openVolumeCallback);
- }
-
- CMyComPtr<IInStream> nextStream = inStream;
- bool prevChecked = false;
- UInt64 numItems = 0;
- try
- {
- while(nextStream != 0)
- {
- CDatabaseEx db;
- db.Stream = nextStream;
- res = archive.Open(maxCheckStartPosition, db);
- if (res == S_OK)
- {
- if (!m_Database.Volumes.IsEmpty())
- {
- const CDatabaseEx &dbPrev = m_Database.Volumes[prevChecked ? m_Database.Volumes.Size() - 1 : 0];
- if (dbPrev.ArchiveInfo.SetID != db.ArchiveInfo.SetID ||
- dbPrev.ArchiveInfo.CabinetNumber + (prevChecked ? 1: - 1) !=
- db.ArchiveInfo.CabinetNumber)
- res = S_FALSE;
- }
- }
- if (res == S_OK)
- m_Database.Volumes.Insert(prevChecked ? m_Database.Volumes.Size() : 0, db);
- else if (res != S_FALSE)
- return res;
- else
- {
- if (m_Database.Volumes.IsEmpty())
- return S_FALSE;
- if (prevChecked)
- break;
- prevChecked = true;
- }
-
- numItems += db.Items.Size();
- RINOK(callback->SetCompleted(&numItems, NULL));
-
- nextStream = 0;
- for (;;)
- {
- const COtherArchive *otherArchive = 0;
- if (!prevChecked)
- {
- const CInArchiveInfo &ai = m_Database.Volumes.Front().ArchiveInfo;
- if (ai.IsTherePrev())
- otherArchive = &ai.PreviousArchive;
- else
- prevChecked = true;
- }
- if (otherArchive == 0)
- {
- const CInArchiveInfo &ai = m_Database.Volumes.Back().ArchiveInfo;
- if (ai.IsThereNext())
- otherArchive = &ai.NextArchive;
- }
- if (!otherArchive)
- break;
- const UString fullName = MultiByteToUnicodeString(otherArchive->FileName, CP_ACP);
- HRESULT result = openVolumeCallback->GetStream(fullName, &nextStream);
- if (result == S_OK)
- break;
- if (result != S_FALSE)
- return result;
- if (prevChecked)
- break;
- prevChecked = true;
- }
- }
- if (res == S_OK)
- {
- m_Database.FillSortAndShrink();
- if (!m_Database.Check())
- res = S_FALSE;
- }
- }
- catch(...)
- {
- res = S_FALSE;
- }
- if (res != S_OK)
- {
- Close();
- return res;
- }
- COM_TRY_END
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Close()
-{
- m_Database.Clear();
- return S_OK;
-}
-
-class CCabFolderOutStream:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-private:
- const CMvDatabaseEx *m_Database;
- const CRecordVector<bool> *m_ExtractStatuses;
- int m_StartIndex;
- int m_CurrentIndex;
- CMyComPtr<IArchiveExtractCallback> m_ExtractCallback;
- bool m_TestMode;
-
- CMyComPtr<ISequentialOutStream> m_RealOutStream;
-
- bool m_IsOk;
- bool m_FileIsOpen;
- UInt64 m_RemainFileSize;
- UInt64 m_FolderSize;
- UInt64 m_PosInFolder;
-
- HRESULT OpenFile();
- HRESULT Write2(const void *data, UInt32 size, UInt32 *processedSize, bool isOK);
-public:
- HRESULT WriteEmptyFiles();
-
- void Init(
- const CMvDatabaseEx *database,
- const CRecordVector<bool> *extractStatuses,
- int startIndex,
- UInt64 folderSize,
- IArchiveExtractCallback *extractCallback,
- bool testMode);
- HRESULT FlushCorrupted();
- HRESULT Unsupported();
-
- UInt64 GetRemain() const { return m_FolderSize - m_PosInFolder; }
- UInt64 GetPosInFolder() const { return m_PosInFolder; }
-};
-
-void CCabFolderOutStream::Init(
- const CMvDatabaseEx *database,
- const CRecordVector<bool> *extractStatuses,
- int startIndex,
- UInt64 folderSize,
- IArchiveExtractCallback *extractCallback,
- bool testMode)
-{
- m_Database = database;
- m_ExtractStatuses = extractStatuses;
- m_StartIndex = startIndex;
- m_FolderSize = folderSize;
-
- m_ExtractCallback = extractCallback;
- m_TestMode = testMode;
-
- m_CurrentIndex = 0;
- m_PosInFolder = 0;
- m_FileIsOpen = false;
- m_IsOk = true;
-}
-
-HRESULT CCabFolderOutStream::OpenFile()
-{
- Int32 askMode = (*m_ExtractStatuses)[m_CurrentIndex] ? (m_TestMode ?
- NExtract::NAskMode::kTest :
- NExtract::NAskMode::kExtract) :
- NExtract::NAskMode::kSkip;
- RINOK(m_ExtractCallback->GetStream(m_StartIndex + m_CurrentIndex, &m_RealOutStream, askMode));
- if (!m_RealOutStream && !m_TestMode)
- askMode = NArchive::NExtract::NAskMode::kSkip;
- return m_ExtractCallback->PrepareOperation(askMode);
-}
-
-HRESULT CCabFolderOutStream::WriteEmptyFiles()
-{
- if (m_FileIsOpen)
- return S_OK;
- for(;m_CurrentIndex < m_ExtractStatuses->Size(); m_CurrentIndex++)
- {
- const CMvItem &mvItem = m_Database->Items[m_StartIndex + m_CurrentIndex];
- const CItem &item = m_Database->Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex];
- UInt64 fileSize = item.Size;
- if (fileSize != 0)
- return S_OK;
- HRESULT result = OpenFile();
- m_RealOutStream.Release();
- RINOK(result);
- RINOK(m_ExtractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- }
- return S_OK;
-}
-
-// This is Write function
-HRESULT CCabFolderOutStream::Write2(const void *data, UInt32 size, UInt32 *processedSize, bool isOK)
-{
- UInt32 realProcessed = 0;
- if (processedSize != NULL)
- *processedSize = 0;
- while(size != 0)
- {
- if (m_FileIsOpen)
- {
- UInt32 numBytesToWrite = (UInt32)MyMin(m_RemainFileSize, (UInt64)(size));
- HRESULT res = S_OK;
- if (numBytesToWrite > 0)
- {
- if (!isOK)
- m_IsOk = false;
- if (m_RealOutStream)
- {
- UInt32 processedSizeLocal = 0;
- res = m_RealOutStream->Write((const Byte *)data, numBytesToWrite, &processedSizeLocal);
- numBytesToWrite = processedSizeLocal;
- }
- }
- realProcessed += numBytesToWrite;
- if (processedSize != NULL)
- *processedSize = realProcessed;
- data = (const void *)((const Byte *)data + numBytesToWrite);
- size -= numBytesToWrite;
- m_RemainFileSize -= numBytesToWrite;
- m_PosInFolder += numBytesToWrite;
- if (res != S_OK)
- return res;
- if (m_RemainFileSize == 0)
- {
- m_RealOutStream.Release();
- RINOK(m_ExtractCallback->SetOperationResult(
- m_IsOk ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kDataError));
- m_FileIsOpen = false;
- }
- if (realProcessed > 0)
- break; // with this break this function works as Write-Part
- }
- else
- {
- if (m_CurrentIndex >= m_ExtractStatuses->Size())
- return E_FAIL;
-
- const CMvItem &mvItem = m_Database->Items[m_StartIndex + m_CurrentIndex];
- const CItem &item = m_Database->Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex];
-
- m_RemainFileSize = item.Size;
-
- UInt32 fileOffset = item.Offset;
- if (fileOffset < m_PosInFolder)
- return E_FAIL;
- if (fileOffset > m_PosInFolder)
- {
- UInt32 numBytesToWrite = (UInt32)MyMin((UInt64)fileOffset - m_PosInFolder, UInt64(size));
- realProcessed += numBytesToWrite;
- if (processedSize != NULL)
- *processedSize = realProcessed;
- data = (const void *)((const Byte *)data + numBytesToWrite);
- size -= numBytesToWrite;
- m_PosInFolder += numBytesToWrite;
- }
- if (fileOffset == m_PosInFolder)
- {
- RINOK(OpenFile());
- m_FileIsOpen = true;
- m_CurrentIndex++;
- m_IsOk = true;
- }
- }
- }
- return WriteEmptyFiles();
-}
-
-STDMETHODIMP CCabFolderOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- return Write2(data, size, processedSize, true);
-}
-
-HRESULT CCabFolderOutStream::FlushCorrupted()
-{
- const UInt32 kBufferSize = (1 << 10);
- Byte buffer[kBufferSize];
- for (unsigned int i = 0; i < kBufferSize; i++)
- buffer[i] = 0;
- for (;;)
- {
- UInt64 remain = GetRemain();
- if (remain == 0)
- return S_OK;
- UInt32 size = (UInt32)MyMin(remain, (UInt64)kBufferSize);
- UInt32 processedSizeLocal = 0;
- RINOK(Write2(buffer, size, &processedSizeLocal, false));
- }
-}
-
-HRESULT CCabFolderOutStream::Unsupported()
-{
- while(m_CurrentIndex < m_ExtractStatuses->Size())
- {
- HRESULT result = OpenFile();
- if (result != S_FALSE && result != S_OK)
- return result;
- m_RealOutStream.Release();
- RINOK(m_ExtractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
- m_CurrentIndex++;
- }
- return S_OK;
-}
-
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool allFilesMode = (numItems == (UInt32)(-1));
- if (allFilesMode)
- numItems = m_Database.Items.Size();
- if(numItems == 0)
- return S_OK;
- bool testMode = (_aTestMode != 0);
- UInt64 totalUnPacked = 0;
-
- UInt32 i;
- int lastFolder = -2;
- UInt64 lastFolderSize = 0;
- for(i = 0; i < numItems; i++)
- {
- int index = allFilesMode ? i : indices[i];
- const CMvItem &mvItem = m_Database.Items[index];
- const CItem &item = m_Database.Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex];
- if (item.IsDir())
- continue;
- int folderIndex = m_Database.GetFolderIndex(&mvItem);
- if (folderIndex != lastFolder)
- totalUnPacked += lastFolderSize;
- lastFolder = folderIndex;
- lastFolderSize = item.GetEndOffset();
- }
- totalUnPacked += lastFolderSize;
-
- extractCallback->SetTotal(totalUnPacked);
-
- totalUnPacked = 0;
-
- UInt64 totalPacked = 0;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder;
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- NCompress::NDeflate::NDecoder::CCOMCoder *deflateDecoderSpec = NULL;
- CMyComPtr<ICompressCoder> deflateDecoder;
-
- NCompress::NLzx::CDecoder *lzxDecoderSpec = NULL;
- CMyComPtr<ICompressCoder> lzxDecoder;
-
- NCompress::NQuantum::CDecoder *quantumDecoderSpec = NULL;
- CMyComPtr<ICompressCoder> quantumDecoder;
-
- CCabBlockInStream *cabBlockInStreamSpec = new CCabBlockInStream();
- CMyComPtr<ISequentialInStream> cabBlockInStream = cabBlockInStreamSpec;
- if (!cabBlockInStreamSpec->Create())
- return E_OUTOFMEMORY;
-
- CRecordVector<bool> extractStatuses;
- for(i = 0; i < numItems;)
- {
- int index = allFilesMode ? i : indices[i];
-
- const CMvItem &mvItem = m_Database.Items[index];
- const CDatabaseEx &db = m_Database.Volumes[mvItem.VolumeIndex];
- int itemIndex = mvItem.ItemIndex;
- const CItem &item = db.Items[itemIndex];
-
- i++;
- if (item.IsDir())
- {
- Int32 askMode= testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- CMyComPtr<ISequentialOutStream> realOutStream;
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
- RINOK(extractCallback->PrepareOperation(askMode));
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
- int folderIndex = m_Database.GetFolderIndex(&mvItem);
- if (folderIndex < 0)
- {
- // If we need previous archive
- Int32 askMode= testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- CMyComPtr<ISequentialOutStream> realOutStream;
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
- RINOK(extractCallback->PrepareOperation(askMode));
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError));
- continue;
- }
- int startIndex2 = m_Database.FolderStartFileIndex[folderIndex];
- int startIndex = startIndex2;
- extractStatuses.Clear();
- for (; startIndex < index; startIndex++)
- extractStatuses.Add(false);
- extractStatuses.Add(true);
- startIndex++;
- UInt64 curUnpack = item.GetEndOffset();
- for(;i < numItems; i++)
- {
- int indexNext = allFilesMode ? i : indices[i];
- const CMvItem &mvItem = m_Database.Items[indexNext];
- const CItem &item = m_Database.Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex];
- if (item.IsDir())
- continue;
- int newFolderIndex = m_Database.GetFolderIndex(&mvItem);
-
- if (newFolderIndex != folderIndex)
- break;
- for (; startIndex < indexNext; startIndex++)
- extractStatuses.Add(false);
- extractStatuses.Add(true);
- startIndex++;
- curUnpack = item.GetEndOffset();
- }
-
- lps->OutSize = totalUnPacked;
- lps->InSize = totalPacked;
- RINOK(lps->SetCur());
-
- CCabFolderOutStream *cabFolderOutStream = new CCabFolderOutStream;
- CMyComPtr<ISequentialOutStream> outStream(cabFolderOutStream);
-
- const CFolder &folder = db.Folders[item.GetFolderIndex(db.Folders.Size())];
-
- cabFolderOutStream->Init(&m_Database, &extractStatuses, startIndex2,
- curUnpack, extractCallback, testMode);
-
- cabBlockInStreamSpec->MsZip = false;
- switch(folder.GetCompressionMethod())
- {
- case NHeader::NCompressionMethodMajor::kNone:
- break;
- case NHeader::NCompressionMethodMajor::kMSZip:
- if(deflateDecoderSpec == NULL)
- {
- deflateDecoderSpec = new NCompress::NDeflate::NDecoder::CCOMCoder;
- deflateDecoder = deflateDecoderSpec;
- }
- cabBlockInStreamSpec->MsZip = true;
- break;
- case NHeader::NCompressionMethodMajor::kLZX:
- if(lzxDecoderSpec == NULL)
- {
- lzxDecoderSpec = new NCompress::NLzx::CDecoder;
- lzxDecoder = lzxDecoderSpec;
- }
- RINOK(lzxDecoderSpec->SetParams(folder.CompressionTypeMinor));
- break;
- case NHeader::NCompressionMethodMajor::kQuantum:
- if(quantumDecoderSpec == NULL)
- {
- quantumDecoderSpec = new NCompress::NQuantum::CDecoder;
- quantumDecoder = quantumDecoderSpec;
- }
- quantumDecoderSpec->SetParams(folder.CompressionTypeMinor);
- break;
- default:
- {
- RINOK(cabFolderOutStream->Unsupported());
- totalUnPacked += curUnpack;
- continue;
- }
- }
-
- cabBlockInStreamSpec->InitForNewFolder();
-
- HRESULT res = S_OK;
-
- {
- int volIndex = mvItem.VolumeIndex;
- int locFolderIndex = item.GetFolderIndex(db.Folders.Size());
- bool keepHistory = false;
- bool keepInputBuffer = false;
- for (UInt32 f = 0; cabFolderOutStream->GetRemain() != 0;)
- {
- if (volIndex >= m_Database.Volumes.Size())
- {
- res = S_FALSE;
- break;
- }
-
- const CDatabaseEx &db = m_Database.Volumes[volIndex];
- const CFolder &folder = db.Folders[locFolderIndex];
- if (f == 0)
- {
- cabBlockInStreamSpec->SetStream(db.Stream);
- cabBlockInStreamSpec->ReservedSize = db.ArchiveInfo.GetDataBlockReserveSize();
- RINOK(db.Stream->Seek(db.StartPosition + folder.DataStart, STREAM_SEEK_SET, NULL));
- }
- if (f == folder.NumDataBlocks)
- {
- volIndex++;
- locFolderIndex = 0;
- f = 0;
- continue;
- }
- f++;
-
- cabBlockInStreamSpec->DataError = false;
-
- if (!keepInputBuffer)
- cabBlockInStreamSpec->InitForNewBlock();
-
- UInt32 packSize, unpackSize;
- res = cabBlockInStreamSpec->PreRead(packSize, unpackSize);
- if (res == S_FALSE)
- break;
- RINOK(res);
- keepInputBuffer = (unpackSize == 0);
- if (keepInputBuffer)
- continue;
-
- UInt64 totalUnPacked2 = totalUnPacked + cabFolderOutStream->GetPosInFolder();
- totalPacked += packSize;
-
- lps->OutSize = totalUnPacked2;
- lps->InSize = totalPacked;
- RINOK(lps->SetCur());
-
- UInt64 unpackRemain = cabFolderOutStream->GetRemain();
-
- const UInt32 kBlockSizeMax = (1 << 15);
- if (unpackRemain > kBlockSizeMax)
- unpackRemain = kBlockSizeMax;
- if (unpackRemain > unpackSize)
- unpackRemain = unpackSize;
-
- switch(folder.GetCompressionMethod())
- {
- case NHeader::NCompressionMethodMajor::kNone:
- res = copyCoder->Code(cabBlockInStream, outStream, NULL, &unpackRemain, NULL);
- break;
- case NHeader::NCompressionMethodMajor::kMSZip:
- deflateDecoderSpec->SetKeepHistory(keepHistory);
- res = deflateDecoder->Code(cabBlockInStream, outStream, NULL, &unpackRemain, NULL);
- break;
- case NHeader::NCompressionMethodMajor::kLZX:
- lzxDecoderSpec->SetKeepHistory(keepHistory);
- res = lzxDecoder->Code(cabBlockInStream, outStream, NULL, &unpackRemain, NULL);
- break;
- case NHeader::NCompressionMethodMajor::kQuantum:
- quantumDecoderSpec->SetKeepHistory(keepHistory);
- res = quantumDecoder->Code(cabBlockInStream, outStream, NULL, &unpackRemain, NULL);
- break;
- }
- if (res != S_OK)
- {
- if (res != S_FALSE)
- RINOK(res);
- break;
- }
- keepHistory = true;
- }
- if (res == S_OK)
- {
- RINOK(cabFolderOutStream->WriteEmptyFiles());
- }
- }
- if (res != S_OK || cabFolderOutStream->GetRemain() != 0)
- {
- RINOK(cabFolderOutStream->FlushCorrupted());
- }
- totalUnPacked += curUnpack;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = m_Database.Items.Size();
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHandler.h
deleted file mode 100644
index 1edcd11e2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHandler.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// CabHandler.h
-
-#ifndef __CAB_HANDLER_H
-#define __CAB_HANDLER_H
-
-#include "Common/MyCom.h"
-#include "../IArchive.h"
-#include "CabIn.h"
-
-namespace NArchive {
-namespace NCab {
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(IInArchive)
-
- INTERFACE_IInArchive(;)
-
-private:
- CMvDatabaseEx m_Database;
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHeader.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHeader.cpp
deleted file mode 100644
index d1f71df30..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHeader.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-// Archive/Cab/Header.h
-
-#include "StdAfx.h"
-
-#include "CabHeader.h"
-
-namespace NArchive{
-namespace NCab{
-namespace NHeader{
-
-Byte kMarker[kMarkerSize] = {'M' + 1, 'S', 'C', 'F', 0, 0, 0, 0 };
-
-struct SignatureInitializer { SignatureInitializer() { kMarker[0]--; }; } g_SignatureInitializer;
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHeader.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHeader.h
deleted file mode 100644
index 0f0d2af35..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabHeader.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Archive/Cab/Header.h
-
-#ifndef __ARCHIVE_CAB_HEADER_H
-#define __ARCHIVE_CAB_HEADER_H
-
-#include "Common/Types.h"
-
-namespace NArchive {
-namespace NCab {
-namespace NHeader {
-
-const unsigned kMarkerSize = 8;
-extern Byte kMarker[kMarkerSize];
-
-namespace NArchive
-{
- namespace NFlags
- {
- const int kPrevCabinet = 0x0001;
- const int kNextCabinet = 0x0002;
- const int kReservePresent = 0x0004;
- }
-}
-
-namespace NCompressionMethodMajor
-{
- const Byte kNone = 0;
- const Byte kMSZip = 1;
- const Byte kQuantum = 2;
- const Byte kLZX = 3;
-}
-
-const int kFileNameIsUTFAttributeMask = 0x80;
-
-namespace NFolderIndex
-{
- const int kContinuedFromPrev = 0xFFFD;
- const int kContinuedToNext = 0xFFFE;
- const int kContinuedPrevAndNext = 0xFFFF;
-}
-
-}}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabIn.cpp
deleted file mode 100644
index afc0faed4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabIn.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-// Archive/CabIn.cpp
-
-#include "StdAfx.h"
-
-#include "CabIn.h"
-
-#include "../Common/FindSignature.h"
-
-namespace NArchive {
-namespace NCab {
-
-Byte CInArchive::ReadByte()
-{
- Byte b;
- if (!inBuffer.ReadByte(b))
- throw CInArchiveException(CInArchiveException::kUnsupported);
- return b;
-}
-
-UInt16 CInArchive::ReadUInt16()
-{
- UInt16 value = 0;
- for (int i = 0; i < 2; i++)
- {
- Byte b = ReadByte();
- value |= (UInt16(b) << (8 * i));
- }
- return value;
-}
-
-UInt32 CInArchive::ReadUInt32()
-{
- UInt32 value = 0;
- for (int i = 0; i < 4; i++)
- {
- Byte b = ReadByte();
- value |= (UInt32(b) << (8 * i));
- }
- return value;
-}
-
-AString CInArchive::SafeReadName()
-{
- AString name;
- for (;;)
- {
- Byte b = ReadByte();
- if (b == 0)
- return name;
- name += (char)b;
- }
-}
-
-void CInArchive::ReadOtherArchive(COtherArchive &oa)
-{
- oa.FileName = SafeReadName();
- oa.DiskName = SafeReadName();
-}
-
-void CInArchive::Skip(size_t size)
-{
- while (size-- != 0)
- ReadByte();
-}
-
-HRESULT CInArchive::Open2(IInStream *stream,
- const UInt64 *searchHeaderSizeLimit,
- CDatabase &database)
-{
- database.Clear();
- RINOK(stream->Seek(0, STREAM_SEEK_SET, &database.StartPosition));
-
- RINOK(FindSignatureInStream(stream, NHeader::kMarker, NHeader::kMarkerSize,
- searchHeaderSizeLimit, database.StartPosition));
-
- RINOK(stream->Seek(database.StartPosition + NHeader::kMarkerSize, STREAM_SEEK_SET, NULL));
- if (!inBuffer.Create(1 << 17))
- return E_OUTOFMEMORY;
- inBuffer.SetStream(stream);
- inBuffer.Init();
-
- CInArchiveInfo &ai = database.ArchiveInfo;
-
- ai.Size = ReadUInt32();
- if (ReadUInt32() != 0)
- return S_FALSE;
- ai.FileHeadersOffset = ReadUInt32();
- if (ReadUInt32() != 0)
- return S_FALSE;
-
- ai.VersionMinor = ReadByte();
- ai.VersionMajor = ReadByte();
- ai.NumFolders = ReadUInt16();
- ai.NumFiles = ReadUInt16();
- ai.Flags = ReadUInt16();
- if (ai.Flags > 7)
- return S_FALSE;
- ai.SetID = ReadUInt16();
- ai.CabinetNumber = ReadUInt16();
-
- if (ai.ReserveBlockPresent())
- {
- ai.PerCabinetAreaSize = ReadUInt16();
- ai.PerFolderAreaSize = ReadByte();
- ai.PerDataBlockAreaSize = ReadByte();
-
- Skip(ai.PerCabinetAreaSize);
- }
-
- {
- if (ai.IsTherePrev())
- ReadOtherArchive(ai.PreviousArchive);
- if (ai.IsThereNext())
- ReadOtherArchive(ai.NextArchive);
- }
-
- int i;
- for (i = 0; i < ai.NumFolders; i++)
- {
- CFolder folder;
-
- folder.DataStart = ReadUInt32();
- folder.NumDataBlocks = ReadUInt16();
- folder.CompressionTypeMajor = ReadByte();
- folder.CompressionTypeMinor = ReadByte();
-
- Skip(ai.PerFolderAreaSize);
- database.Folders.Add(folder);
- }
-
- RINOK(stream->Seek(database.StartPosition + ai.FileHeadersOffset, STREAM_SEEK_SET, NULL));
-
- inBuffer.SetStream(stream);
- inBuffer.Init();
- for (i = 0; i < ai.NumFiles; i++)
- {
- CItem item;
- item.Size = ReadUInt32();
- item.Offset = ReadUInt32();
- item.FolderIndex = ReadUInt16();
- UInt16 pureDate = ReadUInt16();
- UInt16 pureTime = ReadUInt16();
- item.Time = ((UInt32(pureDate) << 16)) | pureTime;
- item.Attributes = ReadUInt16();
- item.Name = SafeReadName();
- int folderIndex = item.GetFolderIndex(database.Folders.Size());
- if (folderIndex >= database.Folders.Size())
- return S_FALSE;
- database.Items.Add(item);
- }
- return S_OK;
-}
-
-#define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; }
-
-HRESULT CInArchive::Open(
- const UInt64 *searchHeaderSizeLimit,
- CDatabaseEx &database)
-{
- return Open2(database.Stream, searchHeaderSizeLimit, database);
-}
-
-
-static int CompareMvItems2(const CMvItem *p1, const CMvItem *p2)
-{
- RINOZ(MyCompare(p1->VolumeIndex, p2->VolumeIndex));
- return MyCompare(p1->ItemIndex, p2->ItemIndex);
-}
-
-static int CompareMvItems(const CMvItem *p1, const CMvItem *p2, void *param)
-{
- const CMvDatabaseEx &mvDb = *(const CMvDatabaseEx *)param;
- const CDatabaseEx &db1 = mvDb.Volumes[p1->VolumeIndex];
- const CDatabaseEx &db2 = mvDb.Volumes[p2->VolumeIndex];
- const CItem &item1 = db1.Items[p1->ItemIndex];
- const CItem &item2 = db2.Items[p2->ItemIndex];;
- bool isDir1 = item1.IsDir();
- bool isDir2 = item2.IsDir();
- if (isDir1 && !isDir2)
- return -1;
- if (isDir2 && !isDir1)
- return 1;
- int f1 = mvDb.GetFolderIndex(p1);
- int f2 = mvDb.GetFolderIndex(p2);
- RINOZ(MyCompare(f1, f2));
- RINOZ(MyCompare(item1.Offset, item2.Offset));
- RINOZ(MyCompare(item1.Size, item2.Size));
- return CompareMvItems2(p1, p2);
-}
-
-bool CMvDatabaseEx::AreItemsEqual(int i1, int i2)
-{
- const CMvItem *p1 = &Items[i1];
- const CMvItem *p2 = &Items[i2];
- const CDatabaseEx &db1 = Volumes[p1->VolumeIndex];
- const CDatabaseEx &db2 = Volumes[p2->VolumeIndex];
- const CItem &item1 = db1.Items[p1->ItemIndex];
- const CItem &item2 = db2.Items[p2->ItemIndex];;
- return GetFolderIndex(p1) == GetFolderIndex(p2) &&
- item1.Offset == item2.Offset &&
- item1.Size == item2.Size &&
- item1.Name == item2.Name;
-}
-
-void CMvDatabaseEx::FillSortAndShrink()
-{
- Items.Clear();
- StartFolderOfVol.Clear();
- FolderStartFileIndex.Clear();
- int offset = 0;
- for (int v = 0; v < Volumes.Size(); v++)
- {
- const CDatabaseEx &db = Volumes[v];
- int curOffset = offset;
- if (db.IsTherePrevFolder())
- curOffset--;
- StartFolderOfVol.Add(curOffset);
- offset += db.GetNumberOfNewFolders();
-
- CMvItem mvItem;
- mvItem.VolumeIndex = v;
- for (int i = 0 ; i < db.Items.Size(); i++)
- {
- mvItem.ItemIndex = i;
- Items.Add(mvItem);
- }
- }
-
- Items.Sort(CompareMvItems, (void *)this);
- int j = 1;
- int i;
- for (i = 1; i < Items.Size(); i++)
- if (!AreItemsEqual(i, i -1))
- Items[j++] = Items[i];
- Items.DeleteFrom(j);
-
- for (i = 0; i < Items.Size(); i++)
- {
- const CMvItem &mvItem = Items[i];
- int folderIndex = GetFolderIndex(&mvItem);
- if (folderIndex >= FolderStartFileIndex.Size())
- FolderStartFileIndex.Add(i);
- }
-}
-
-bool CMvDatabaseEx::Check()
-{
- for (int v = 1; v < Volumes.Size(); v++)
- {
- const CDatabaseEx &db1 = Volumes[v];
- if (db1.IsTherePrevFolder())
- {
- const CDatabaseEx &db0 = Volumes[v - 1];
- if (db0.Folders.IsEmpty() || db1.Folders.IsEmpty())
- return false;
- const CFolder &f0 = db0.Folders.Back();
- const CFolder &f1 = db1.Folders.Front();
- if (f0.CompressionTypeMajor != f1.CompressionTypeMajor ||
- f0.CompressionTypeMinor != f1.CompressionTypeMinor)
- return false;
- }
- }
- UInt64 maxPos = 0;
- int prevFolder = -2;
- for (int i = 0; i < Items.Size(); i++)
- {
- const CMvItem &mvItem = Items[i];
- int fIndex = GetFolderIndex(&mvItem);
- if (fIndex >= FolderStartFileIndex.Size())
- return false;
- const CItem &item = Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex];
- if (item.IsDir())
- continue;
- int folderIndex = GetFolderIndex(&mvItem);
- if (folderIndex != prevFolder)
- {
- prevFolder = folderIndex;
- maxPos = 0;
- continue;
- }
- if (item.Offset < maxPos)
- return false;
- maxPos = item.GetEndOffset();
- if (maxPos < item.Offset)
- return false;
- }
- return true;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabIn.h
deleted file mode 100644
index c9cfcbdda..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabIn.h
+++ /dev/null
@@ -1,166 +0,0 @@
-// Archive/CabIn.h
-
-#ifndef __ARCHIVE_CAB_IN_H
-#define __ARCHIVE_CAB_IN_H
-
-#include "../../IStream.h"
-#include "../../Common/InBuffer.h"
-#include "CabHeader.h"
-#include "CabItem.h"
-
-namespace NArchive {
-namespace NCab {
-
-class CInArchiveException
-{
-public:
- enum CCauseType
- {
- kUnexpectedEndOfArchive = 0,
- kIncorrectArchive,
- kUnsupported
- } Cause;
- CInArchiveException(CCauseType cause) : Cause(cause) {}
-};
-
-struct COtherArchive
-{
- AString FileName;
- AString DiskName;
-};
-
-struct CArchiveInfo
-{
- Byte VersionMinor; /* cabinet file format version, minor */
- Byte VersionMajor; /* cabinet file format version, major */
- UInt16 NumFolders; /* number of CFFOLDER entries in this cabinet */
- UInt16 NumFiles; /* number of CFFILE entries in this cabinet */
- UInt16 Flags; /* cabinet file option indicators */
- UInt16 SetID; /* must be the same for all cabinets in a set */
- UInt16 CabinetNumber; /* number of this cabinet file in a set */
-
- bool ReserveBlockPresent() const { return (Flags & NHeader::NArchive::NFlags::kReservePresent) != 0; }
-
- bool IsTherePrev() const { return (Flags & NHeader::NArchive::NFlags::kPrevCabinet) != 0; }
- bool IsThereNext() const { return (Flags & NHeader::NArchive::NFlags::kNextCabinet) != 0; }
-
- UInt16 PerCabinetAreaSize; // (optional) size of per-cabinet reserved area
- Byte PerFolderAreaSize; // (optional) size of per-folder reserved area
- Byte PerDataBlockAreaSize; // (optional) size of per-datablock reserved area
-
- Byte GetDataBlockReserveSize() const { return (Byte)(ReserveBlockPresent() ? PerDataBlockAreaSize : 0); }
-
- COtherArchive PreviousArchive;
- COtherArchive NextArchive;
-
- CArchiveInfo()
- {
- Clear();
- }
-
- void Clear()
- {
- PerCabinetAreaSize = 0;
- PerFolderAreaSize = 0;
- PerDataBlockAreaSize = 0;
- }
-};
-
-struct CInArchiveInfo: public CArchiveInfo
-{
- UInt32 Size; /* size of this cabinet file in bytes */
- UInt32 FileHeadersOffset; // offset of the first CFFILE entry
-};
-
-
-class CDatabase
-{
-public:
- UInt64 StartPosition;
- CInArchiveInfo ArchiveInfo;
- CObjectVector<CFolder> Folders;
- CObjectVector<CItem> Items;
- void Clear()
- {
- ArchiveInfo.Clear();
- Folders.Clear();
- Items.Clear();
- }
- bool IsTherePrevFolder() const
- {
- for (int i = 0; i < Items.Size(); i++)
- if (Items[i].ContinuedFromPrev())
- return true;
- return false;
- }
- int GetNumberOfNewFolders() const
- {
- int res = Folders.Size();
- if (IsTherePrevFolder())
- res--;
- return res;
- }
- UInt32 GetFileOffset(int index) const { return Items[index].Offset; }
- UInt32 GetFileSize(int index) const { return Items[index].Size; }
-};
-
-class CDatabaseEx: public CDatabase
-{
-public:
- CMyComPtr<IInStream> Stream;
-};
-
-struct CMvItem
-{
- int VolumeIndex;
- int ItemIndex;
-};
-
-class CMvDatabaseEx
-{
- bool AreItemsEqual(int i1, int i2);
-public:
- CObjectVector<CDatabaseEx> Volumes;
- CRecordVector<CMvItem> Items;
- CRecordVector<int> StartFolderOfVol;
- CRecordVector<int> FolderStartFileIndex;
- int GetFolderIndex(const CMvItem *mvi) const
- {
- const CDatabaseEx &db = Volumes[mvi->VolumeIndex];
- return StartFolderOfVol[mvi->VolumeIndex] +
- db.Items[mvi->ItemIndex].GetFolderIndex(db.Folders.Size());
- }
- void Clear()
- {
- Volumes.Clear();
- Items.Clear();
- StartFolderOfVol.Clear();
- FolderStartFileIndex.Clear();
- }
- void FillSortAndShrink();
- bool Check();
-};
-
-class CInArchive
-{
- CInBuffer inBuffer;
-
- Byte ReadByte();
- UInt16 ReadUInt16();
- UInt32 ReadUInt32();
- AString SafeReadName();
- void Skip(size_t size);
- void ReadOtherArchive(COtherArchive &oa);
-
- HRESULT Open2(IInStream *inStream,
- const UInt64 *searchHeaderSizeLimit,
- CDatabase &database);
-public:
- HRESULT Open(
- const UInt64 *searchHeaderSizeLimit,
- CDatabaseEx &database);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabItem.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabItem.h
deleted file mode 100644
index 63a1e856c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabItem.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Archive/CabItem.h
-
-#ifndef __ARCHIVE_CAB_ITEM_H
-#define __ARCHIVE_CAB_ITEM_H
-
-#include "Common/Types.h"
-#include "Common/MyString.h"
-#include "CabHeader.h"
-
-namespace NArchive {
-namespace NCab {
-
-struct CFolder
-{
- UInt32 DataStart; // offset of the first CFDATA block in this folder
- UInt16 NumDataBlocks; // number of CFDATA blocks in this folder
- Byte CompressionTypeMajor;
- Byte CompressionTypeMinor;
- Byte GetCompressionMethod() const { return (Byte)(CompressionTypeMajor & 0xF); }
-};
-
-struct CItem
-{
- AString Name;
- UInt32 Offset;
- UInt32 Size;
- UInt32 Time;
- UInt16 FolderIndex;
- UInt16 Flags;
- UInt16 Attributes;
-
- UInt64 GetEndOffset() const { return (UInt64)Offset + Size; }
- UInt32 GetWinAttributes() const { return (Attributes & ~NHeader::kFileNameIsUTFAttributeMask); }
- bool IsNameUTF() const { return (Attributes & NHeader::kFileNameIsUTFAttributeMask) != 0; }
- bool IsDir() const { return (Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0; }
-
- bool ContinuedFromPrev() const
- {
- return
- (FolderIndex == NHeader::NFolderIndex::kContinuedFromPrev) ||
- (FolderIndex == NHeader::NFolderIndex::kContinuedPrevAndNext);
- }
-
- bool ContinuedToNext() const
- {
- return
- (FolderIndex == NHeader::NFolderIndex::kContinuedToNext) ||
- (FolderIndex == NHeader::NFolderIndex::kContinuedPrevAndNext);
- }
-
- int GetFolderIndex(int numFolders) const
- {
- if (ContinuedFromPrev())
- return 0;
- if (ContinuedToNext())
- return (numFolders - 1);
- return FolderIndex;
- }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabRegister.cpp
deleted file mode 100644
index 0ce8a87fb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Cab/CabRegister.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// CabRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "CabHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NCab::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Cab", L"cab", 0, 8, { 0x4D, 0x53, 0x43, 0x46 }, 4, false, CreateArc, 0 };
-
-REGISTER_ARC(Cab)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHandler.cpp
deleted file mode 100644
index 03bff8218..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHandler.cpp
+++ /dev/null
@@ -1,721 +0,0 @@
-// ChmHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/Defs.h"
-#include "Common/StringConvert.h"
-#include "Common/UTFConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/ProgressUtils.h"
-#include "../../Common/StreamUtils.h"
-
-#include "../../Compress/CopyCoder.h"
-#include "../../Compress/LzxDecoder.h"
-
-#include "../Common/ItemNameUtils.h"
-
-#include "ChmHandler.h"
-
-using namespace NWindows;
-using namespace NTime;
-
-namespace NArchive {
-namespace NChm {
-
-// #define _CHM_DETAILS
-
-#ifdef _CHM_DETAILS
-
-enum
-{
- kpidSection = kpidUserDefined
-};
-
-#endif
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidBlock, VT_UI4}
-
- #ifdef _CHM_DETAILS
- ,
- { L"Section", kpidSection, VT_UI4},
- { NULL, kpidOffset, VT_UI4}
- #endif
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidNumBlocks, VT_UI8}
-};
-
-IMP_IInArchive_Props
-
-IMP_IInArchive_ArcProps_NO
-/*
-IMP_IInArchive_ArcProps
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidNumBlocks:
- {
- UInt64 numBlocks = 0;
- for (int i = 0; i < m_Database.Sections.Size(); i++)
- {
- const CSectionInfo &s = m_Database.Sections[i];
- for (int j = 0; j < s.Methods.Size(); j++)
- {
- const CMethodInfo &m = s.Methods[j];
- if (m.IsLzx())
- numBlocks += m.LzxInfo.ResetTable.GetNumBlocks();
- }
- }
- prop = numBlocks;
- break;
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-*/
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- if (m_Database.NewFormat)
- {
- switch(propID)
- {
- case kpidSize:
- prop = (UInt64)m_Database.NewFormatString.Length();
- break;
- }
- prop.Detach(value);
- return S_OK;
- }
- int entryIndex;
- if (m_Database.LowLevel)
- entryIndex = index;
- else
- entryIndex = m_Database.Indices[index];
- const CItem &item = m_Database.Items[entryIndex];
- switch(propID)
- {
- case kpidPath:
- {
- UString us;
- if (ConvertUTF8ToUnicode(item.Name, us))
- {
- if (!m_Database.LowLevel)
- {
- if (us.Length() > 1)
- if (us[0] == L'/')
- us.Delete(0);
- }
- prop = NItemName::GetOSName2(us);
- }
- break;
- }
- case kpidIsDir: prop = item.IsDir(); break;
- case kpidSize: prop = item.Size; break;
- case kpidMethod:
- {
- if (!item.IsDir())
- if (item.Section == 0)
- prop = L"Copy";
- else if (item.Section < m_Database.Sections.Size())
- prop = m_Database.Sections[(int)item.Section].GetMethodName();
- break;
- }
- case kpidBlock:
- if (m_Database.LowLevel)
- prop = item.Section;
- else if (item.Section != 0)
- prop = m_Database.GetFolder(index);
- break;
-
- #ifdef _CHM_DETAILS
-
- case kpidSection: prop = (UInt32)item.Section; break;
- case kpidOffset: prop = (UInt32)item.Offset; break;
-
- #endif
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-class CProgressImp: public CProgressVirt
-{
- CMyComPtr<IArchiveOpenCallback> _callback;
-public:
- STDMETHOD(SetTotal)(const UInt64 *numFiles);
- STDMETHOD(SetCompleted)(const UInt64 *numFiles);
- CProgressImp(IArchiveOpenCallback *callback): _callback(callback) {};
-};
-
-STDMETHODIMP CProgressImp::SetTotal(const UInt64 *numFiles)
-{
- if (_callback)
- return _callback->SetCompleted(numFiles, NULL);
- return S_OK;
-}
-
-STDMETHODIMP CProgressImp::SetCompleted(const UInt64 *numFiles)
-{
- if (_callback)
- return _callback->SetCompleted(numFiles, NULL);
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 *maxCheckStartPosition,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- m_Stream.Release();
- try
- {
- CInArchive archive;
- // CProgressImp progressImp(openArchiveCallback);
- RINOK(archive.Open(inStream, maxCheckStartPosition, m_Database));
- /*
- if (m_Database.LowLevel)
- return S_FALSE;
- */
- m_Stream = inStream;
- }
- catch(...)
- {
- return S_FALSE;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- m_Database.Clear();
- m_Stream.Release();
- return S_OK;
-}
-
-class CChmFolderOutStream:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
-
- HRESULT Write2(const void *data, UInt32 size, UInt32 *processedSize, bool isOK);
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-
- UInt64 m_FolderSize;
- UInt64 m_PosInFolder;
- UInt64 m_PosInSection;
- const CRecordVector<bool> *m_ExtractStatuses;
- int m_StartIndex;
- int m_CurrentIndex;
- int m_NumFiles;
-
-private:
- const CFilesDatabase *m_Database;
- CMyComPtr<IArchiveExtractCallback> m_ExtractCallback;
- bool m_TestMode;
-
- bool m_IsOk;
- bool m_FileIsOpen;
- UInt64 m_RemainFileSize;
- CMyComPtr<ISequentialOutStream> m_RealOutStream;
-
- HRESULT OpenFile();
- HRESULT WriteEmptyFiles();
-public:
- void Init(
- const CFilesDatabase *database,
- IArchiveExtractCallback *extractCallback,
- bool testMode);
- HRESULT FlushCorrupted(UInt64 maxSize);
-};
-
-void CChmFolderOutStream::Init(
- const CFilesDatabase *database,
- IArchiveExtractCallback *extractCallback,
- bool testMode)
-{
- m_Database = database;
- m_ExtractCallback = extractCallback;
- m_TestMode = testMode;
-
- m_CurrentIndex = 0;
- m_FileIsOpen = false;
-}
-
-HRESULT CChmFolderOutStream::OpenFile()
-{
- Int32 askMode = (*m_ExtractStatuses)[m_CurrentIndex] ? (m_TestMode ?
- NExtract::NAskMode::kTest :
- NExtract::NAskMode::kExtract) :
- NExtract::NAskMode::kSkip;
- m_RealOutStream.Release();
- RINOK(m_ExtractCallback->GetStream(m_StartIndex + m_CurrentIndex, &m_RealOutStream, askMode));
- if (!m_RealOutStream && !m_TestMode)
- askMode = NArchive::NExtract::NAskMode::kSkip;
- return m_ExtractCallback->PrepareOperation(askMode);
-}
-
-HRESULT CChmFolderOutStream::WriteEmptyFiles()
-{
- if (m_FileIsOpen)
- return S_OK;
- for (;m_CurrentIndex < m_NumFiles; m_CurrentIndex++)
- {
- UInt64 fileSize = m_Database->GetFileSize(m_StartIndex + m_CurrentIndex);
- if (fileSize != 0)
- return S_OK;
- HRESULT result = OpenFile();
- m_RealOutStream.Release();
- RINOK(result);
- RINOK(m_ExtractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- }
- return S_OK;
-}
-
-// This is WritePart function
-HRESULT CChmFolderOutStream::Write2(const void *data, UInt32 size, UInt32 *processedSize, bool isOK)
-{
- UInt32 realProcessed = 0;
- if (processedSize != NULL)
- *processedSize = 0;
- while(size != 0)
- {
- if (m_FileIsOpen)
- {
- UInt32 numBytesToWrite = (UInt32)MyMin(m_RemainFileSize, (UInt64)(size));
- HRESULT res = S_OK;
- if (numBytesToWrite > 0)
- {
- if (!isOK)
- m_IsOk = false;
- if (m_RealOutStream)
- {
- UInt32 processedSizeLocal = 0;
- res = m_RealOutStream->Write((const Byte *)data, numBytesToWrite, &processedSizeLocal);
- numBytesToWrite = processedSizeLocal;
- }
- }
- realProcessed += numBytesToWrite;
- if (processedSize != NULL)
- *processedSize = realProcessed;
- data = (const void *)((const Byte *)data + numBytesToWrite);
- size -= numBytesToWrite;
- m_RemainFileSize -= numBytesToWrite;
- m_PosInSection += numBytesToWrite;
- m_PosInFolder += numBytesToWrite;
- if (res != S_OK)
- return res;
- if (m_RemainFileSize == 0)
- {
- m_RealOutStream.Release();
- RINOK(m_ExtractCallback->SetOperationResult(
- m_IsOk ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kDataError));
- m_FileIsOpen = false;
- }
- if (realProcessed > 0)
- break; // with this break this function works as write part
- }
- else
- {
- if (m_CurrentIndex >= m_NumFiles)
- return E_FAIL;
- int fullIndex = m_StartIndex + m_CurrentIndex;
- m_RemainFileSize = m_Database->GetFileSize(fullIndex);
- UInt64 fileOffset = m_Database->GetFileOffset(fullIndex);
- if (fileOffset < m_PosInSection)
- return E_FAIL;
- if (fileOffset > m_PosInSection)
- {
- UInt32 numBytesToWrite = (UInt32)MyMin(fileOffset - m_PosInSection, UInt64(size));
- realProcessed += numBytesToWrite;
- if (processedSize != NULL)
- *processedSize = realProcessed;
- data = (const void *)((const Byte *)data + numBytesToWrite);
- size -= numBytesToWrite;
- m_PosInSection += numBytesToWrite;
- m_PosInFolder += numBytesToWrite;
- }
- if (fileOffset == m_PosInSection)
- {
- RINOK(OpenFile());
- m_FileIsOpen = true;
- m_CurrentIndex++;
- m_IsOk = true;
- }
- }
- }
- return WriteEmptyFiles();
-}
-
-STDMETHODIMP CChmFolderOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- return Write2(data, size, processedSize, true);
-}
-
-HRESULT CChmFolderOutStream::FlushCorrupted(UInt64 maxSize)
-{
- const UInt32 kBufferSize = (1 << 10);
- Byte buffer[kBufferSize];
- for (int i = 0; i < kBufferSize; i++)
- buffer[i] = 0;
- if (maxSize > m_FolderSize)
- maxSize = m_FolderSize;
- while (m_PosInFolder < maxSize)
- {
- UInt32 size = (UInt32)MyMin(maxSize - m_PosInFolder, (UInt64)kBufferSize);
- UInt32 processedSizeLocal = 0;
- RINOK(Write2(buffer, size, &processedSizeLocal, false));
- if (processedSizeLocal == 0)
- return S_OK;
- }
- return S_OK;
-}
-
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool allFilesMode = (numItems == UInt32(-1));
-
- if (allFilesMode)
- numItems = m_Database.NewFormat ? 1:
- (m_Database.LowLevel ?
- m_Database.Items.Size():
- m_Database.Indices.Size());
- if (numItems == 0)
- return S_OK;
- bool testMode = (_aTestMode != 0);
-
- UInt64 currentTotalSize = 0;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
- UInt32 i;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- streamSpec->SetStream(m_Stream);
-
- if (m_Database.LowLevel)
- {
- UInt64 currentItemSize = 0;
- UInt64 totalSize = 0;
- if (m_Database.NewFormat)
- totalSize = m_Database.NewFormatString.Length();
- else
- for (i = 0; i < numItems; i++)
- totalSize += m_Database.Items[allFilesMode ? i : indices[i]].Size;
- extractCallback->SetTotal(totalSize);
-
- for (i = 0; i < numItems; i++, currentTotalSize += currentItemSize)
- {
- currentItemSize = 0;
- lps->InSize = currentTotalSize; // Change it
- lps->OutSize = currentTotalSize;
-
- RINOK(lps->SetCur());
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode= testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- Int32 index = allFilesMode ? i : indices[i];
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
- if (m_Database.NewFormat)
- {
- if (index != 0)
- return E_FAIL;
- if (!testMode && (!realOutStream))
- continue;
- if (!testMode)
- {
- UInt32 size = m_Database.NewFormatString.Length();
- RINOK(WriteStream(realOutStream, (const char *)m_Database.NewFormatString, size));
- }
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
- const CItem &item = m_Database.Items[index];
-
- currentItemSize = item.Size;
-
- if (!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- if (item.Section != 0)
- {
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
- continue;
- }
-
- if (testMode)
- {
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
-
- RINOK(m_Stream->Seek(m_Database.ContentOffset + item.Offset, STREAM_SEEK_SET, NULL));
- streamSpec->Init(item.Size);
-
- RINOK(copyCoder->Code(inStream, realOutStream, NULL, NULL, progress));
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult((copyCoderSpec->TotalSize == item.Size) ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kDataError));
- }
- return S_OK;
- }
-
- UInt64 lastFolderIndex = ((UInt64)0 - 1);
- for (i = 0; i < numItems; i++)
- {
- UInt32 index = allFilesMode ? i : indices[i];
- int entryIndex = m_Database.Indices[index];
- const CItem &item = m_Database.Items[entryIndex];
- UInt64 sectionIndex = item.Section;
- if (item.IsDir() || item.Size == 0)
- continue;
- if (sectionIndex == 0)
- {
- currentTotalSize += item.Size;
- continue;
- }
- const CSectionInfo &section = m_Database.Sections[(int)item.Section];
- if (section.IsLzx())
- {
- const CLzxInfo &lzxInfo = section.Methods[0].LzxInfo;
- UInt64 folderIndex = m_Database.GetFolder(index);
- if (lastFolderIndex == folderIndex)
- folderIndex++;
- lastFolderIndex = m_Database.GetLastFolder(index);
- for (; folderIndex <= lastFolderIndex; folderIndex++)
- currentTotalSize += lzxInfo.GetFolderSize();
- }
- }
-
- RINOK(extractCallback->SetTotal(currentTotalSize));
-
- NCompress::NLzx::CDecoder *lzxDecoderSpec = 0;
- CMyComPtr<ICompressCoder> lzxDecoder;
- CChmFolderOutStream *chmFolderOutStream = 0;
- CMyComPtr<ISequentialOutStream> outStream;
-
- currentTotalSize = 0;
-
- CRecordVector<bool> extractStatuses;
- for (i = 0; i < numItems;)
- {
- RINOK(extractCallback->SetCompleted(&currentTotalSize));
- UInt32 index = allFilesMode ? i : indices[i];
- i++;
- int entryIndex = m_Database.Indices[index];
- const CItem &item = m_Database.Items[entryIndex];
- UInt64 sectionIndex = item.Section;
- Int32 askMode= testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- if (item.IsDir())
- {
- CMyComPtr<ISequentialOutStream> realOutStream;
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
- RINOK(extractCallback->PrepareOperation(askMode));
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
-
- lps->InSize = currentTotalSize; // Change it
- lps->OutSize = currentTotalSize;
-
- if (item.Size == 0 || sectionIndex == 0)
- {
- CMyComPtr<ISequentialOutStream> realOutStream;
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
- if (!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- Int32 opRes = NArchive::NExtract::NOperationResult::kOK;
- if (!testMode && item.Size != 0)
- {
- RINOK(m_Stream->Seek(m_Database.ContentOffset + item.Offset, STREAM_SEEK_SET, NULL));
- streamSpec->Init(item.Size);
- RINOK(copyCoder->Code(inStream, realOutStream, NULL, NULL, progress));
- if (copyCoderSpec->TotalSize != item.Size)
- opRes = NArchive::NExtract::NOperationResult::kDataError;
- }
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(opRes));
- currentTotalSize += item.Size;
- continue;
- }
-
- const CSectionInfo &section = m_Database.Sections[(int)sectionIndex];
-
- if (!section.IsLzx())
- {
- CMyComPtr<ISequentialOutStream> realOutStream;
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
- if(!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
- continue;
- }
-
- const CLzxInfo &lzxInfo = section.Methods[0].LzxInfo;
-
- if (chmFolderOutStream == 0)
- {
- chmFolderOutStream = new CChmFolderOutStream;
- outStream = chmFolderOutStream;
- }
-
- chmFolderOutStream->Init(&m_Database, extractCallback, testMode);
-
- if(lzxDecoderSpec == NULL)
- {
- lzxDecoderSpec = new NCompress::NLzx::CDecoder;
- lzxDecoder = lzxDecoderSpec;
- }
-
- UInt64 folderIndex = m_Database.GetFolder(index);
-
- UInt64 compressedPos = m_Database.ContentOffset + section.Offset;
- UInt32 numDictBits = lzxInfo.GetNumDictBits();
- RINOK(lzxDecoderSpec->SetParams(numDictBits));
-
- const CItem *lastItem = &item;
- extractStatuses.Clear();
- extractStatuses.Add(true);
-
- for (;; folderIndex++)
- {
- RINOK(extractCallback->SetCompleted(&currentTotalSize));
-
- UInt64 startPos = lzxInfo.GetFolderPos(folderIndex);
- UInt64 finishPos = lastItem->Offset + lastItem->Size;
- UInt64 limitFolderIndex = lzxInfo.GetFolder(finishPos);
-
- lastFolderIndex = m_Database.GetLastFolder(index);
- UInt64 folderSize = lzxInfo.GetFolderSize();
- UInt64 unPackSize = folderSize;
- if (extractStatuses.IsEmpty())
- chmFolderOutStream->m_StartIndex = index + 1;
- else
- chmFolderOutStream->m_StartIndex = index;
- if (limitFolderIndex == folderIndex)
- {
- for (; i < numItems; i++)
- {
- UInt32 nextIndex = allFilesMode ? i : indices[i];
- int entryIndex = m_Database.Indices[nextIndex];
- const CItem &nextItem = m_Database.Items[entryIndex];
- if (nextItem.Section != sectionIndex)
- break;
- UInt64 nextFolderIndex = m_Database.GetFolder(nextIndex);
- if (nextFolderIndex != folderIndex)
- break;
- for (index++; index < nextIndex; index++)
- extractStatuses.Add(false);
- extractStatuses.Add(true);
- index = nextIndex;
- lastItem = &nextItem;
- if (nextItem.Size != 0)
- finishPos = nextItem.Offset + nextItem.Size;
- lastFolderIndex = m_Database.GetLastFolder(index);
- }
- }
- unPackSize = MyMin(finishPos - startPos, unPackSize);
-
- chmFolderOutStream->m_FolderSize = folderSize;
- chmFolderOutStream->m_PosInFolder = 0;
- chmFolderOutStream->m_PosInSection = startPos;
- chmFolderOutStream->m_ExtractStatuses = &extractStatuses;
- chmFolderOutStream->m_NumFiles = extractStatuses.Size();
- chmFolderOutStream->m_CurrentIndex = 0;
- try
- {
- UInt64 startBlock = lzxInfo.GetBlockIndexFromFolderIndex(folderIndex);
- const CResetTable &rt = lzxInfo.ResetTable;
- UInt32 numBlocks = (UInt32)rt.GetNumBlocks(unPackSize);
- for (UInt32 b = 0; b < numBlocks; b++)
- {
- UInt64 completedSize = currentTotalSize + chmFolderOutStream->m_PosInSection - startPos;
- RINOK(extractCallback->SetCompleted(&completedSize));
- UInt64 bCur = startBlock + b;
- if (bCur >= rt.ResetOffsets.Size())
- return E_FAIL;
- UInt64 offset = rt.ResetOffsets[(int)bCur];
- UInt64 compressedSize;
- rt.GetCompressedSizeOfBlock(bCur, compressedSize);
- UInt64 rem = finishPos - chmFolderOutStream->m_PosInSection;
- if (rem > rt.BlockSize)
- rem = rt.BlockSize;
- RINOK(m_Stream->Seek(compressedPos + offset, STREAM_SEEK_SET, NULL));
- streamSpec->SetStream(m_Stream);
- streamSpec->Init(compressedSize);
- lzxDecoderSpec->SetKeepHistory(b > 0);
- HRESULT res = lzxDecoder->Code(inStream, outStream, NULL, &rem, NULL);
- if (res != S_OK)
- {
- if (res != S_FALSE)
- return res;
- throw 1;
- }
- }
- }
- catch(...)
- {
- RINOK(chmFolderOutStream->FlushCorrupted(unPackSize));
- }
- currentTotalSize += folderSize;
- if (folderIndex == lastFolderIndex)
- break;
- extractStatuses.Clear();
- }
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = m_Database.NewFormat ? 1:
- (m_Database.LowLevel ?
- m_Database.Items.Size():
- m_Database.Indices.Size());
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHandler.h
deleted file mode 100644
index 440c50f11..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHandler.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// ChmHandler.h
-
-#ifndef __ARCHIVE_CHM_HANDLER_H
-#define __ARCHIVE_CHM_HANDLER_H
-
-#include "Common/MyCom.h"
-#include "../IArchive.h"
-#include "ChmIn.h"
-
-namespace NArchive {
-namespace NChm {
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(IInArchive)
-
- INTERFACE_IInArchive(;)
-
-private:
- CFilesDatabase m_Database;
- CMyComPtr<IInStream> m_Stream;
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHeader.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHeader.cpp
deleted file mode 100644
index e8dc9f3e8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHeader.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Archive/Chm/Header.h
-
-#include "StdAfx.h"
-
-#include "ChmHeader.h"
-
-namespace NArchive{
-namespace NChm{
-namespace NHeader{
-
-UInt32 kItsfSignature = 0x46535449 + 1;
-UInt32 kItolSignature = 0x4C4F5449 + 1;
-static class CSignatureInitializer
-{
-public:
- CSignatureInitializer()
- {
- kItsfSignature--;
- kItolSignature--;
- }
-}g_SignatureInitializer;
-
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHeader.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHeader.h
deleted file mode 100644
index 9f1bd42b6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmHeader.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Archive/Chm/Header.h
-
-#ifndef __ARCHIVE_CHM_HEADER_H
-#define __ARCHIVE_CHM_HEADER_H
-
-#include "Common/Types.h"
-
-namespace NArchive {
-namespace NChm {
-namespace NHeader{
-
-const UInt32 kItspSignature = 0x50535449;
-const UInt32 kPmglSignature = 0x4C474D50;
-const UInt32 kLzxcSignature = 0x43585A4C;
-
-const UInt32 kIfcmSignature = 0x4D434649;
-const UInt32 kAollSignature = 0x4C4C4F41;
-const UInt32 kCaolSignature = 0x4C4F4143;
-
-extern UInt32 kItsfSignature;
-
-extern UInt32 kItolSignature;
-const UInt32 kItlsSignature = 0x534C5449;
-UInt64 inline GetHxsSignature() { return ((UInt64)kItlsSignature << 32) | kItolSignature; }
-
-}}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmIn.cpp
deleted file mode 100644
index cc571937e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmIn.cpp
+++ /dev/null
@@ -1,940 +0,0 @@
-// Archive/ChmIn.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/UTFConvert.h"
-
-#include "../../Common/LimitedStreams.h"
-
-#include "ChmIn.h"
-
-namespace NArchive{
-namespace NChm{
-
-// define CHM_LOW, if you want to see low level items
-// #define CHM_LOW
-
-static const GUID kChmLzxGuid =
- { 0x7FC28940, 0x9D31, 0x11D0, 0x9B, 0x27, 0x00, 0xA0, 0xC9, 0x1E, 0x9C, 0x7C };
-static const GUID kHelp2LzxGuid =
- { 0x0A9007C6, 0x4076, 0x11D3, 0x87, 0x89, 0x00, 0x00, 0xF8, 0x10, 0x57, 0x54 };
-static const GUID kDesGuid =
- { 0x67F6E4A2, 0x60BF, 0x11D3, 0x85, 0x40, 0x00, 0xC0, 0x4F, 0x58, 0xC3, 0xCF };
-
-static bool AreGuidsEqual(REFGUID g1, REFGUID g2)
-{
- if (g1.Data1 != g2.Data1 ||
- g1.Data2 != g2.Data2 ||
- g1.Data3 != g2.Data3)
- return false;
- for (int i = 0; i < 8; i++)
- if (g1.Data4[i] != g2.Data4[i])
- return false;
- return true;
-}
-
-static char GetHex(Byte value)
-{
- return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
-}
-
-static void PrintByte(Byte b, AString &s)
-{
- s += GetHex(b >> 4);
- s += GetHex(b & 0xF);
-}
-
-static void PrintUInt16(UInt16 v, AString &s)
-{
- PrintByte((Byte)(v >> 8), s);
- PrintByte((Byte)v, s);
-}
-
-static void PrintUInt32(UInt32 v, AString &s)
-{
- PrintUInt16((UInt16)(v >> 16), s);
- PrintUInt16((UInt16)v, s);
-}
-
-AString CMethodInfo::GetGuidString() const
-{
- AString s;
- s += '{';
- PrintUInt32(Guid.Data1, s);
- s += '-';
- PrintUInt16(Guid.Data2, s);
- s += '-';
- PrintUInt16(Guid.Data3, s);
- s += '-';
- PrintByte(Guid.Data4[0], s);
- PrintByte(Guid.Data4[1], s);
- s += '-';
- for (int i = 2; i < 8; i++)
- PrintByte(Guid.Data4[i], s);
- s += '}';
- return s;
-}
-
-bool CMethodInfo::IsLzx() const
-{
- if (AreGuidsEqual(Guid, kChmLzxGuid))
- return true;
- return AreGuidsEqual(Guid, kHelp2LzxGuid);
-}
-
-bool CMethodInfo::IsDes() const
-{
- return AreGuidsEqual(Guid, kDesGuid);
-}
-
-UString CMethodInfo::GetName() const
-{
- UString s;
- if (IsLzx())
- {
- s = L"LZX:";
- wchar_t temp[16];
- ConvertUInt32ToString(LzxInfo.GetNumDictBits(), temp);
- s += temp;
- }
- else
- {
- AString s2;
- if (IsDes())
- s2 = "DES";
- else
- {
- s2 = GetGuidString();
- if (ControlData.GetCapacity() > 0)
- {
- s2 += ':';
- for (size_t i = 0; i < ControlData.GetCapacity(); i++)
- PrintByte(ControlData[i], s2);
- }
- }
- ConvertUTF8ToUnicode(s2, s);
- }
- return s;
-}
-
-bool CSectionInfo::IsLzx() const
-{
- if (Methods.Size() != 1)
- return false;
- return Methods[0].IsLzx();
-}
-
-UString CSectionInfo::GetMethodName() const
-{
- UString s;
- if (!IsLzx())
- {
- UString temp;
- if (ConvertUTF8ToUnicode(Name, temp))
- s += temp;
- s += L": ";
- }
- for (int i = 0; i < Methods.Size(); i++)
- {
- if (i != 0)
- s += L' ';
- s += Methods[i].GetName();
- }
- return s;
-}
-
-Byte CInArchive::ReadByte()
-{
- Byte b;
- if (!_inBuffer.ReadByte(b))
- throw 1;
- return b;
-}
-
-void CInArchive::Skip(size_t size)
-{
- while (size-- != 0)
- ReadByte();
-}
-
-void CInArchive::ReadBytes(Byte *data, UInt32 size)
-{
- for (UInt32 i = 0; i < size; i++)
- data[i] = ReadByte();
-}
-
-UInt16 CInArchive::ReadUInt16()
-{
- UInt16 value = 0;
- for (int i = 0; i < 2; i++)
- value |= ((UInt16)(ReadByte()) << (8 * i));
- return value;
-}
-
-UInt32 CInArchive::ReadUInt32()
-{
- UInt32 value = 0;
- for (int i = 0; i < 4; i++)
- value |= ((UInt32)(ReadByte()) << (8 * i));
- return value;
-}
-
-UInt64 CInArchive::ReadUInt64()
-{
- UInt64 value = 0;
- for (int i = 0; i < 8; i++)
- value |= ((UInt64)(ReadByte()) << (8 * i));
- return value;
-}
-
-UInt64 CInArchive::ReadEncInt()
-{
- UInt64 val = 0;;
- for (int i = 0; i < 10; i++)
- {
- Byte b = ReadByte();
- val |= (b & 0x7F);
- if (b < 0x80)
- return val;
- val <<= 7;
- }
- throw 1;
-}
-
-void CInArchive::ReadGUID(GUID &g)
-{
- g.Data1 = ReadUInt32();
- g.Data2 = ReadUInt16();
- g.Data3 = ReadUInt16();
- ReadBytes(g.Data4, 8);
-}
-
-void CInArchive::ReadString(int size, AString &s)
-{
- s.Empty();
- while(size-- != 0)
- {
- char c = (char)ReadByte();
- if (c == 0)
- {
- Skip(size);
- return;
- }
- s += c;
- }
-}
-
-void CInArchive::ReadUString(int size, UString &s)
-{
- s.Empty();
- while(size-- != 0)
- {
- wchar_t c = ReadUInt16();
- if (c == 0)
- {
- Skip(2 * size);
- return;
- }
- s += c;
- }
-}
-
-HRESULT CInArchive::ReadChunk(IInStream *inStream, UInt64 pos, UInt64 size)
-{
- RINOK(inStream->Seek(pos, STREAM_SEEK_SET, NULL));
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> limitedStream(streamSpec);
- streamSpec->SetStream(inStream);
- streamSpec->Init(size);
- _inBuffer.SetStream(limitedStream);
- _inBuffer.Init();
- return S_OK;
-}
-
-HRESULT CInArchive::ReadDirEntry(CDatabase &database)
-{
- CItem item;
- UInt64 nameLength = ReadEncInt();
- if (nameLength == 0 || nameLength >= 0x10000000)
- return S_FALSE;
- ReadString((int)nameLength, item.Name);
- item.Section = ReadEncInt();
- item.Offset = ReadEncInt();
- item.Size = ReadEncInt();
- database.Items.Add(item);
- return S_OK;
-}
-
-HRESULT CInArchive::OpenChm(IInStream *inStream, CDatabase &database)
-{
- UInt32 headerSize = ReadUInt32();
- if (headerSize != 0x60)
- return S_FALSE;
- UInt32 unknown1 = ReadUInt32();
- if (unknown1 != 0 && unknown1 != 1) // it's 0 in one .sll file
- return S_FALSE;
- /* UInt32 timeStamp = */ ReadUInt32();
- // Considered as a big-endian DWORD, it appears to contain seconds (MSB) and
- // fractional seconds (second byte).
- // The third and fourth bytes may contain even more fractional bits.
- // The 4 least significant bits in the last byte are constant.
- /* UInt32 lang = */ ReadUInt32();
- GUID g;
- ReadGUID(g); // {7C01FD10-7BAA-11D0-9E0C-00A0-C922-E6EC}
- ReadGUID(g); // {7C01FD11-7BAA-11D0-9E0C-00A0-C922-E6EC}
- const int kNumSections = 2;
- UInt64 sectionOffsets[kNumSections];
- UInt64 sectionSizes[kNumSections];
- int i;
- for (i = 0; i < kNumSections; i++)
- {
- sectionOffsets[i] = ReadUInt64();
- sectionSizes[i] = ReadUInt64();
- }
- // if (chmVersion == 3)
- database.ContentOffset = ReadUInt64();
- /*
- else
- database.ContentOffset = _startPosition + 0x58
- */
-
- /*
- // Section 0
- ReadChunk(inStream, sectionOffsets[0], sectionSizes[0]);
- if (sectionSizes[0] != 0x18)
- return S_FALSE;
- ReadUInt32(); // unknown: 01FE
- ReadUInt32(); // unknown: 0
- UInt64 fileSize = ReadUInt64();
- ReadUInt32(); // unknown: 0
- ReadUInt32(); // unknown: 0
- */
-
- // Section 1: The Directory Listing
- ReadChunk(inStream, sectionOffsets[1], sectionSizes[1]);
- if (ReadUInt32() != NHeader::kItspSignature)
- return S_FALSE;
- if (ReadUInt32() != 1) // version
- return S_FALSE;
- /* UInt32 dirHeaderSize = */ ReadUInt32();
- ReadUInt32(); // 0x0A (unknown)
- UInt32 dirChunkSize = ReadUInt32(); // $1000
- if (dirChunkSize < 32)
- return S_FALSE;
- /* UInt32 density = */ ReadUInt32(); // "Density" of quickref section, usually 2.
- /* UInt32 depth = */ ReadUInt32(); // Depth of the index tree: 1 there is no index,
- // 2 if there is one level of PMGI chunks.
-
- /* UInt32 chunkNumber = */ ReadUInt32(); // Chunk number of root index chunk, -1 if there is none
- // (though at least one file has 0 despite there being no
- // index chunk, probably a bug.)
- /* UInt32 firstPmglChunkNumber = */ ReadUInt32(); // Chunk number of first PMGL (listing) chunk
- /* UInt32 lastPmglChunkNumber = */ ReadUInt32(); // Chunk number of last PMGL (listing) chunk
- ReadUInt32(); // -1 (unknown)
- UInt32 numDirChunks = ReadUInt32(); // Number of directory chunks (total)
- /* UInt32 windowsLangId = */ ReadUInt32();
- ReadGUID(g); // {5D02926A-212E-11D0-9DF9-00A0C922E6EC}
- ReadUInt32(); // 0x54 (This is the length again)
- ReadUInt32(); // -1 (unknown)
- ReadUInt32(); // -1 (unknown)
- ReadUInt32(); // -1 (unknown)
-
- for (UInt32 ci = 0; ci < numDirChunks; ci++)
- {
- UInt64 chunkPos = _inBuffer.GetProcessedSize();
- if (ReadUInt32() == NHeader::kPmglSignature)
- {
- // The quickref area is written backwards from the end of the chunk.
- // One quickref entry exists for every n entries in the file, where n
- // is calculated as 1 + (1 << quickref density). So for density = 2, n = 5.
-
- UInt32 quickrefLength = ReadUInt32(); // Length of free space and/or quickref area at end of directory chunk
- if (quickrefLength > dirChunkSize || quickrefLength < 2)
- return S_FALSE;
- ReadUInt32(); // Always 0
- ReadUInt32(); // Chunk number of previous listing chunk when reading
- // directory in sequence (-1 if this is the first listing chunk)
- ReadUInt32(); // Chunk number of next listing chunk when reading
- // directory in sequence (-1 if this is the last listing chunk)
- int numItems = 0;
- for (;;)
- {
- UInt64 offset = _inBuffer.GetProcessedSize() - chunkPos;
- UInt32 offsetLimit = dirChunkSize - quickrefLength;
- if (offset > offsetLimit)
- return S_FALSE;
- if (offset == offsetLimit)
- break;
- RINOK(ReadDirEntry(database));
- numItems++;
- }
- Skip(quickrefLength - 2);
- if (ReadUInt16() != numItems)
- return S_FALSE;
- }
- else
- Skip(dirChunkSize - 4);
- }
- return S_OK;
-}
-
-HRESULT CInArchive::OpenHelp2(IInStream *inStream, CDatabase &database)
-{
- if (ReadUInt32() != 1) // version
- return S_FALSE;
- if (ReadUInt32() != 0x28) // Location of header section table
- return S_FALSE;
- UInt32 numHeaderSections = ReadUInt32();
- const int kNumHeaderSectionsMax = 5;
- if (numHeaderSections != kNumHeaderSectionsMax)
- return S_FALSE;
- ReadUInt32(); // Length of post-header table
- GUID g;
- ReadGUID(g); // {0A9007C1-4076-11D3-8789-0000F8105754}
-
- // header section table
- UInt64 sectionOffsets[kNumHeaderSectionsMax];
- UInt64 sectionSizes[kNumHeaderSectionsMax];
- UInt32 i;
- for (i = 0; i < numHeaderSections; i++)
- {
- sectionOffsets[i] = ReadUInt64();
- sectionSizes[i] = ReadUInt64();
- }
-
- // Post-Header
- ReadUInt32(); // 2
- ReadUInt32(); // 0x98: offset to CAOL from beginning of post-header)
- // ----- Directory information
- ReadUInt64(); // Chunk number of top-level AOLI chunk in directory, or -1
- ReadUInt64(); // Chunk number of first AOLL chunk in directory
- ReadUInt64(); // Chunk number of last AOLL chunk in directory
- ReadUInt64(); // 0 (unknown)
- ReadUInt32(); // $2000 (Directory chunk size of directory)
- ReadUInt32(); // Quickref density for main directory, usually 2
- ReadUInt32(); // 0 (unknown)
- ReadUInt32(); // Depth of main directory index tree
- // 1 there is no index, 2 if there is one level of AOLI chunks.
- ReadUInt64(); // 0 (unknown)
- UInt64 numDirEntries = ReadUInt64(); // Number of directory entries
- // ----- Directory Index Information
- ReadUInt64(); // -1 (unknown, probably chunk number of top-level AOLI in directory index)
- ReadUInt64(); // Chunk number of first AOLL chunk in directory index
- ReadUInt64(); // Chunk number of last AOLL chunk in directory index
- ReadUInt64(); // 0 (unknown)
- ReadUInt32(); // $200 (Directory chunk size of directory index)
- ReadUInt32(); // Quickref density for directory index, usually 2
- ReadUInt32(); // 0 (unknown)
- ReadUInt32(); // Depth of directory index index tree.
- ReadUInt64(); // Possibly flags -- sometimes 1, sometimes 0.
- ReadUInt64(); // Number of directory index entries (same as number of AOLL
- // chunks in main directory)
-
- // (The obvious guess for the following two fields, which recur in a number
- // of places, is they are maximum sizes for the directory and directory index.
- // However, I have seen no direct evidence that this is the case.)
-
- ReadUInt32(); // $100000 (Same as field following chunk size in directory)
- ReadUInt32(); // $20000 (Same as field following chunk size in directory index)
-
- ReadUInt64(); // 0 (unknown)
- if (ReadUInt32() != NHeader::kCaolSignature)
- return S_FALSE;
- if (ReadUInt32() != 2) // (Most likely a version number)
- return S_FALSE;
- UInt32 caolLength = ReadUInt32(); // $50 (Length of the CAOL section, which includes the ITSF section)
- if (caolLength >= 0x2C)
- {
- /* UInt32 c7 = */ ReadUInt16(); // Unknown. Remains the same when identical files are built.
- // Does not appear to be a checksum. Many files have
- // 'HH' (HTML Help?) here, indicating this may be a compiler ID
- // field. But at least one ITOL/ITLS compiler does not set this
- // field to a constant value.
- ReadUInt16(); // 0 (Unknown. Possibly part of 00A4 field)
- ReadUInt32(); // Unknown. Two values have been seen -- $43ED, and 0.
- ReadUInt32(); // $2000 (Directory chunk size of directory)
- ReadUInt32(); // $200 (Directory chunk size of directory index)
- ReadUInt32(); // $100000 (Same as field following chunk size in directory)
- ReadUInt32(); // $20000 (Same as field following chunk size in directory index)
- ReadUInt32(); // 0 (unknown)
- ReadUInt32(); // 0 (Unknown)
- if (caolLength == 0x2C)
- {
- database.ContentOffset = 0;
- database.NewFormat = true;
- }
- else if (caolLength == 0x50)
- {
- ReadUInt32(); // 0 (Unknown)
- if (ReadUInt32() != NHeader::kItsfSignature)
- return S_FALSE;
- if (ReadUInt32() != 4) // $4 (Version number -- CHM uses 3)
- return S_FALSE;
- if (ReadUInt32() != 0x20) // $20 (length of ITSF)
- return S_FALSE;
- UInt32 unknown = ReadUInt32();
- if (unknown != 0 && unknown != 1) // = 0 for some HxW files, 1 in other cases;
- return S_FALSE;
- database.ContentOffset = _startPosition + ReadUInt64();
- /* UInt32 timeStamp = */ ReadUInt32();
- // A timestamp of some sort.
- // Considered as a big-endian DWORD, it appears to contain
- // seconds (MSB) and fractional seconds (second byte).
- // The third and fourth bytes may contain even more fractional
- // bits. The 4 least significant bits in the last byte are constant.
- /* UInt32 lang = */ ReadUInt32(); // BE?
- }
- else
- return S_FALSE;
- }
-
- /*
- // Section 0
- ReadChunk(inStream, _startPosition + sectionOffsets[0], sectionSizes[0]);
- if (sectionSizes[0] != 0x18)
- return S_FALSE;
- ReadUInt32(); // unknown: 01FE
- ReadUInt32(); // unknown: 0
- UInt64 fileSize = ReadUInt64();
- ReadUInt32(); // unknown: 0
- ReadUInt32(); // unknown: 0
- */
-
- // Section 1: The Directory Listing
- ReadChunk(inStream, _startPosition + sectionOffsets[1], sectionSizes[1]);
- if (ReadUInt32() != NHeader::kIfcmSignature)
- return S_FALSE;
- if (ReadUInt32() != 1) // (probably a version number)
- return S_FALSE;
- UInt32 dirChunkSize = ReadUInt32(); // $2000
- if (dirChunkSize < 64)
- return S_FALSE;
- ReadUInt32(); // $100000 (unknown)
- ReadUInt32(); // -1 (unknown)
- ReadUInt32(); // -1 (unknown)
- UInt32 numDirChunks = ReadUInt32();
- ReadUInt32(); // 0 (unknown, probably high word of above)
-
- for (UInt32 ci = 0; ci < numDirChunks; ci++)
- {
- UInt64 chunkPos = _inBuffer.GetProcessedSize();
- if (ReadUInt32() == NHeader::kAollSignature)
- {
- UInt32 quickrefLength = ReadUInt32(); // Length of quickref area at end of directory chunk
- if (quickrefLength > dirChunkSize || quickrefLength < 2)
- return S_FALSE;
- ReadUInt64(); // Directory chunk number
- // This must match physical position in file, that is
- // the chunk size times the chunk number must be the
- // offset from the end of the directory header.
- ReadUInt64(); // Chunk number of previous listing chunk when reading
- // directory in sequence (-1 if first listing chunk)
- ReadUInt64(); // Chunk number of next listing chunk when reading
- // directory in sequence (-1 if last listing chunk)
- ReadUInt64(); // Number of first listing entry in this chunk
- ReadUInt32(); // 1 (unknown -- other values have also been seen here)
- ReadUInt32(); // 0 (unknown)
-
- int numItems = 0;
- for (;;)
- {
- UInt64 offset = _inBuffer.GetProcessedSize() - chunkPos;
- UInt32 offsetLimit = dirChunkSize - quickrefLength;
- if (offset > offsetLimit)
- return S_FALSE;
- if (offset == offsetLimit)
- break;
- if (database.NewFormat)
- {
- UInt16 nameLength = ReadUInt16();
- if (nameLength == 0)
- return S_FALSE;
- UString name;
- ReadUString((int)nameLength, name);
- AString s;
- ConvertUnicodeToUTF8(name, s);
- Byte b = ReadByte();
- s += ' ';
- PrintByte(b, s);
- s += ' ';
- UInt64 len = ReadEncInt();
- // then number of items ?
- // then length ?
- // then some data (binary encoding?)
- while (len-- != 0)
- {
- b = ReadByte();
- PrintByte(b, s);
- }
- database.NewFormatString += s;
- database.NewFormatString += "\r\n";
- }
- else
- {
- RINOK(ReadDirEntry(database));
- }
- numItems++;
- }
- Skip(quickrefLength - 2);
- if (ReadUInt16() != numItems)
- return S_FALSE;
- if (numItems > numDirEntries)
- return S_FALSE;
- numDirEntries -= numItems;
- }
- else
- Skip(dirChunkSize - 4);
- }
- return numDirEntries == 0 ? S_OK : S_FALSE;
-}
-
-HRESULT CInArchive::DecompressStream(IInStream *inStream, const CDatabase &database, const AString &name)
-{
- int index = database.FindItem(name);
- if (index < 0)
- return S_FALSE;
- const CItem &item = database.Items[index];
- _chunkSize = item.Size;
- return ReadChunk(inStream, database.ContentOffset + item.Offset, item.Size);
-}
-
-
-#define DATA_SPACE "::DataSpace/"
-static const char *kNameList = DATA_SPACE "NameList";
-static const char *kStorage = DATA_SPACE "Storage/";
-static const char *kContent = "Content";
-static const char *kControlData = "ControlData";
-static const char *kSpanInfo = "SpanInfo";
-static const char *kTransform = "Transform/";
-static const char *kResetTable = "/InstanceData/ResetTable";
-static const char *kTransformList = "List";
-
-static AString GetSectionPrefix(const AString &name)
-{
- return AString(kStorage) + name + AString("/");
-}
-
-#define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; }
-
-static int CompareFiles(const int *p1, const int *p2, void *param)
-{
- const CObjectVector<CItem> &items = *(const CObjectVector<CItem> *)param;
- const CItem &item1 = items[*p1];
- const CItem &item2 = items[*p2];
- bool isDir1 = item1.IsDir();
- bool isDir2 = item2.IsDir();
- if (isDir1 && !isDir2)
- return -1;
- if (isDir2)
- {
- if (isDir1)
- return MyCompare(*p1, *p2);
- return 1;
- }
- RINOZ(MyCompare(item1.Section, item2.Section));
- RINOZ(MyCompare(item1.Offset, item2.Offset));
- RINOZ(MyCompare(item1.Size, item2.Size));
- return MyCompare(*p1, *p2);
-}
-
-void CFilesDatabase::SetIndices()
-{
- for (int i = 0; i < Items.Size(); i++)
- {
- const CItem &item = Items[i];
- if (item.IsUserItem() && item.Name.Length() != 1)
- Indices.Add(i);
- }
-}
-
-void CFilesDatabase::Sort()
-{
- Indices.Sort(CompareFiles, (void *)&Items);
-}
-
-bool CFilesDatabase::Check()
-{
- UInt64 maxPos = 0;
- UInt64 prevSection = 0;
- for(int i = 0; i < Indices.Size(); i++)
- {
- const CItem &item = Items[Indices[i]];
- if (item.Section == 0 || item.IsDir())
- continue;
- if (item.Section != prevSection)
- {
- prevSection = item.Section;
- maxPos = 0;
- continue;
- }
- if (item.Offset < maxPos)
- return false;
- maxPos = item.Offset + item.Size;
- if (maxPos < item.Offset)
- return false;
- }
- return true;
-}
-
-HRESULT CInArchive::OpenHighLevel(IInStream *inStream, CFilesDatabase &database)
-{
- {
- // The NameList file
- RINOK(DecompressStream(inStream, database, kNameList));
- /* UInt16 length = */ ReadUInt16();
- UInt16 numSections = ReadUInt16();
- for (int i = 0; i < numSections; i++)
- {
- CSectionInfo section;
- UInt16 nameLength = ReadUInt16();
- UString name;
- ReadUString(nameLength, name);
- if (ReadUInt16() != 0)
- return S_FALSE;
- if (!ConvertUnicodeToUTF8(name, section.Name))
- return S_FALSE;
- database.Sections.Add(section);
- }
- }
-
- int i;
- for (i = 1; i < database.Sections.Size(); i++)
- {
- CSectionInfo &section = database.Sections[i];
- AString sectionPrefix = GetSectionPrefix(section.Name);
- {
- // Content
- int index = database.FindItem(sectionPrefix + kContent);
- if (index < 0)
- return S_FALSE;
- const CItem &item = database.Items[index];
- section.Offset = item.Offset;
- section.CompressedSize = item.Size;
- }
- AString transformPrefix = sectionPrefix + kTransform;
- if (database.Help2Format)
- {
- // Transform List
- RINOK(DecompressStream(inStream, database, transformPrefix + kTransformList));
- if ((_chunkSize & 0xF) != 0)
- return S_FALSE;
- int numGuids = (int)(_chunkSize / 0x10);
- if (numGuids < 1)
- return S_FALSE;
- for (int i = 0; i < numGuids; i++)
- {
- CMethodInfo method;
- ReadGUID(method.Guid);
- section.Methods.Add(method);
- }
- }
- else
- {
- CMethodInfo method;
- method.Guid = kChmLzxGuid;
- section.Methods.Add(method);
- }
-
- {
- // Control Data
- RINOK(DecompressStream(inStream, database, sectionPrefix + kControlData));
- for (int mi = 0; mi < section.Methods.Size(); mi++)
- {
- CMethodInfo &method = section.Methods[mi];
- UInt32 numDWORDS = ReadUInt32();
- if (method.IsLzx())
- {
- if (numDWORDS < 5)
- return S_FALSE;
- if (ReadUInt32() != NHeader::kLzxcSignature)
- return S_FALSE;
- CLzxInfo &li = method.LzxInfo;
- li.Version = ReadUInt32();
- if (li.Version != 2 && li.Version != 3)
- return S_FALSE;
- li.ResetInterval = ReadUInt32();
- li.WindowSize = ReadUInt32();
- li.CacheSize = ReadUInt32();
- if (
- li.ResetInterval != 1 &&
- li.ResetInterval != 2 &&
- li.ResetInterval != 4 &&
- li.ResetInterval != 8 &&
- li.ResetInterval != 16 &&
- li.ResetInterval != 32 &&
- li.ResetInterval != 64)
- return S_FALSE;
- if (
- li.WindowSize != 1 &&
- li.WindowSize != 2 &&
- li.WindowSize != 4 &&
- li.WindowSize != 8 &&
- li.WindowSize != 16 &&
- li.WindowSize != 32 &&
- li.WindowSize != 64)
- return S_FALSE;
- numDWORDS -= 5;
- while (numDWORDS-- != 0)
- ReadUInt32();
- }
- else
- {
- UInt32 numBytes = numDWORDS * 4;
- method.ControlData.SetCapacity(numBytes);
- ReadBytes(method.ControlData, numBytes);
- }
- }
- }
-
- {
- // SpanInfo
- RINOK(DecompressStream(inStream, database, sectionPrefix + kSpanInfo));
- section.UncompressedSize = ReadUInt64();
- }
-
- // read ResetTable for LZX
- for (int mi = 0; mi < section.Methods.Size(); mi++)
- {
- CMethodInfo &method = section.Methods[mi];
- if (method.IsLzx())
- {
- // ResetTable;
- RINOK(DecompressStream(inStream, database, transformPrefix +
- method.GetGuidString() + kResetTable));
- CResetTable &rt = method.LzxInfo.ResetTable;
- if (_chunkSize < 4)
- {
- if (_chunkSize != 0)
- return S_FALSE;
- // ResetTable is empty in .chw files
- if (section.UncompressedSize != 0)
- return S_FALSE;
- rt.UncompressedSize = 0;
- rt.CompressedSize = 0;
- rt.BlockSize = 0;
- }
- else
- {
- UInt32 ver = ReadUInt32(); // 2 unknown (possibly a version number)
- if (ver != 2 && ver != 3)
- return S_FALSE;
- UInt32 numEntries = ReadUInt32();
- if (ReadUInt32() != 8) // Size of table entry (bytes)
- return S_FALSE;
- if (ReadUInt32() != 0x28) // Length of table header
- return S_FALSE;
- rt.UncompressedSize = ReadUInt64();
- rt.CompressedSize = ReadUInt64();
- rt.BlockSize = ReadUInt64(); // 0x8000 block size for locations below
- if (rt.BlockSize != 0x8000)
- return S_FALSE;
- rt.ResetOffsets.Reserve(numEntries);
- for (UInt32 i = 0; i < numEntries; i++)
- rt.ResetOffsets.Add(ReadUInt64());
- }
- }
- }
- }
-
- database.SetIndices();
- database.Sort();
- return database.Check() ? S_OK : S_FALSE;
-}
-
-HRESULT CInArchive::Open2(IInStream *inStream,
- const UInt64 *searchHeaderSizeLimit,
- CFilesDatabase &database)
-{
- database.Clear();
-
- RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &_startPosition));
-
- database.Help2Format = false;
- const UInt32 chmVersion = 3;
- {
- if (!_inBuffer.Create(1 << 14))
- return E_OUTOFMEMORY;
- _inBuffer.SetStream(inStream);
- _inBuffer.Init();
- UInt64 value = 0;
- const int kSignatureSize = 8;
- UInt64 hxsSignature = NHeader::GetHxsSignature();
- UInt64 chmSignature = ((UInt64)chmVersion << 32)| NHeader::kItsfSignature;
- UInt64 limit = 1 << 18;
- if (searchHeaderSizeLimit)
- if (limit > *searchHeaderSizeLimit)
- limit = *searchHeaderSizeLimit;
-
- for (;;)
- {
- Byte b;
- if (!_inBuffer.ReadByte(b))
- return S_FALSE;
- value >>= 8;
- value |= ((UInt64)b) << ((kSignatureSize - 1) * 8);
- if (_inBuffer.GetProcessedSize() >= kSignatureSize)
- {
- if (value == chmSignature)
- break;
- if (value == hxsSignature)
- {
- database.Help2Format = true;
- break;
- }
- if (_inBuffer.GetProcessedSize() > limit)
- return S_FALSE;
- }
- }
- _startPosition += _inBuffer.GetProcessedSize() - kSignatureSize;
- }
-
- if (database.Help2Format)
- {
- RINOK(OpenHelp2(inStream, database));
- if (database.NewFormat)
- return S_OK;
- }
- else
- {
- RINOK(OpenChm(inStream, database));
- }
-
- #ifndef CHM_LOW
- try
- {
- HRESULT res = OpenHighLevel(inStream, database);
- if (res == S_FALSE)
- {
- database.HighLevelClear();
- return S_OK;
- }
- RINOK(res);
- database.LowLevel = false;
- }
- catch(...)
- {
- return S_OK;
- }
- #endif
- return S_OK;
-}
-
-HRESULT CInArchive::Open(IInStream *inStream,
- const UInt64 *searchHeaderSizeLimit,
- CFilesDatabase &database)
-{
- try
- {
- HRESULT res = Open2(inStream, searchHeaderSizeLimit, database);
- _inBuffer.ReleaseStream();
- return res;
- }
- catch(...)
- {
- _inBuffer.ReleaseStream();
- throw;
- }
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmIn.h
deleted file mode 100644
index 4719a484d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmIn.h
+++ /dev/null
@@ -1,244 +0,0 @@
-// Archive/ChmIn.h
-
-#ifndef __ARCHIVE_CHM_IN_H
-#define __ARCHIVE_CHM_IN_H
-
-#include "Common/Buffer.h"
-#include "Common/MyString.h"
-
-#include "../../IStream.h"
-#include "../../Common/InBuffer.h"
-
-#include "ChmHeader.h"
-
-namespace NArchive {
-namespace NChm {
-
-struct CItem
-{
- UInt64 Section;
- UInt64 Offset;
- UInt64 Size;
- AString Name;
-
- bool IsFormatRelatedItem() const
- {
- if (Name.Length() < 2)
- return false;
- return Name[0] == ':' && Name[1] == ':';
- }
-
- bool IsUserItem() const
- {
- if (Name.Length() < 2)
- return false;
- return Name[0] == '/';
- }
-
- bool IsDir() const
- {
- if (Name.Length() == 0)
- return false;
- return (Name[Name.Length() - 1] == '/');
- }
-};
-
-struct CDatabase
-{
- UInt64 ContentOffset;
- CObjectVector<CItem> Items;
- AString NewFormatString;
- bool Help2Format;
- bool NewFormat;
-
- int FindItem(const AString &name) const
- {
- for (int i = 0; i < Items.Size(); i++)
- if (Items[i].Name == name)
- return i;
- return -1;
- }
-
- void Clear()
- {
- NewFormat = false;
- NewFormatString.Empty();
- Help2Format = false;
- Items.Clear();
- }
-};
-
-struct CResetTable
-{
- UInt64 UncompressedSize;
- UInt64 CompressedSize;
- UInt64 BlockSize;
- CRecordVector<UInt64> ResetOffsets;
- bool GetCompressedSizeOfBlocks(UInt64 blockIndex, UInt32 numBlocks, UInt64 &size) const
- {
- if (blockIndex >= ResetOffsets.Size())
- return false;
- UInt64 startPos = ResetOffsets[(int)blockIndex];
- if (blockIndex + numBlocks >= ResetOffsets.Size())
- size = CompressedSize - startPos;
- else
- size = ResetOffsets[(int)(blockIndex + numBlocks)] - startPos;
- return true;
- }
- bool GetCompressedSizeOfBlock(UInt64 blockIndex, UInt64 &size) const
- {
- return GetCompressedSizeOfBlocks(blockIndex, 1, size);
- }
- UInt64 GetNumBlocks(UInt64 size) const
- {
- return (size + BlockSize - 1) / BlockSize;
- }
-};
-
-struct CLzxInfo
-{
- UInt32 Version;
- UInt32 ResetInterval;
- UInt32 WindowSize;
- UInt32 CacheSize;
- CResetTable ResetTable;
-
- UInt32 GetNumDictBits() const
- {
- if (Version == 2 || Version == 3)
- {
- for (int i = 0; i <= 31; i++)
- if (((UInt32)1 << i) >= WindowSize)
- return 15 + i;
- }
- return 0;
- }
-
- UInt64 GetFolderSize() const { return ResetTable.BlockSize * ResetInterval; };
- UInt64 GetFolder(UInt64 offset) const { return offset / GetFolderSize(); };
- UInt64 GetFolderPos(UInt64 folderIndex) const { return folderIndex * GetFolderSize(); };
- UInt64 GetBlockIndexFromFolderIndex(UInt64 folderIndex) const { return folderIndex * ResetInterval; };
- bool GetOffsetOfFolder(UInt64 folderIndex, UInt64 &offset) const
- {
- UInt64 blockIndex = GetBlockIndexFromFolderIndex(folderIndex);
- if (blockIndex >= ResetTable.ResetOffsets.Size())
- return false;
- offset = ResetTable.ResetOffsets[(int)blockIndex];
- return true;
- }
- bool GetCompressedSizeOfFolder(UInt64 folderIndex, UInt64 &size) const
- {
- UInt64 blockIndex = GetBlockIndexFromFolderIndex(folderIndex);
- return ResetTable.GetCompressedSizeOfBlocks(blockIndex, ResetInterval, size);
- }
-};
-
-struct CMethodInfo
-{
- GUID Guid;
- CByteBuffer ControlData;
- CLzxInfo LzxInfo;
- bool IsLzx() const;
- bool IsDes() const;
- AString GetGuidString() const;
- UString GetName() const;
-};
-
-struct CSectionInfo
-{
- UInt64 Offset;
- UInt64 CompressedSize;
- UInt64 UncompressedSize;
-
- AString Name;
- CObjectVector<CMethodInfo> Methods;
-
- bool IsLzx() const;
- UString GetMethodName() const;
-};
-
-class CFilesDatabase: public CDatabase
-{
-public:
- bool LowLevel;
- CRecordVector<int> Indices;
- CObjectVector<CSectionInfo> Sections;
-
- UInt64 GetFileSize(int fileIndex) const { return Items[Indices[fileIndex]].Size; }
- UInt64 GetFileOffset(int fileIndex) const { return Items[Indices[fileIndex]].Offset; }
-
- UInt64 GetFolder(int fileIndex) const
- {
- const CItem &item = Items[Indices[fileIndex]];
- const CSectionInfo &section = Sections[(int)item.Section];
- if (section.IsLzx())
- return section.Methods[0].LzxInfo.GetFolder(item.Offset);
- return 0;
- }
-
- UInt64 GetLastFolder(int fileIndex) const
- {
- const CItem &item = Items[Indices[fileIndex]];
- const CSectionInfo &section = Sections[(int)item.Section];
- if (section.IsLzx())
- return section.Methods[0].LzxInfo.GetFolder(item.Offset + item.Size - 1);
- return 0;
- }
-
- void HighLevelClear()
- {
- LowLevel = true;
- Indices.Clear();
- Sections.Clear();
- }
-
- void Clear()
- {
- CDatabase::Clear();
- HighLevelClear();
- }
- void SetIndices();
- void Sort();
- bool Check();
-};
-
-class CProgressVirt
-{
-public:
- STDMETHOD(SetTotal)(const UInt64 *numFiles) PURE;
- STDMETHOD(SetCompleted)(const UInt64 *numFiles) PURE;
-};
-
-class CInArchive
-{
- UInt64 _startPosition;
- ::CInBuffer _inBuffer;
- UInt64 _chunkSize;
-
- Byte ReadByte();
- void ReadBytes(Byte *data, UInt32 size);
- void Skip(size_t size);
- UInt16 ReadUInt16();
- UInt32 ReadUInt32();
- UInt64 ReadUInt64();
- UInt64 ReadEncInt();
- void ReadString(int size, AString &s);
- void ReadUString(int size, UString &s);
- void ReadGUID(GUID &g);
-
- HRESULT ReadChunk(IInStream *inStream, UInt64 pos, UInt64 size);
-
- HRESULT ReadDirEntry(CDatabase &database);
- HRESULT DecompressStream(IInStream *inStream, const CDatabase &database, const AString &name);
-
-public:
- HRESULT OpenChm(IInStream *inStream, CDatabase &database);
- HRESULT OpenHelp2(IInStream *inStream, CDatabase &database);
- HRESULT OpenHighLevel(IInStream *inStream, CFilesDatabase &database);
- HRESULT Open2(IInStream *inStream, const UInt64 *searchHeaderSizeLimit, CFilesDatabase &database);
- HRESULT Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit, CFilesDatabase &database);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmRegister.cpp
deleted file mode 100644
index abebe6c67..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Chm/ChmRegister.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// ChmRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "ChmHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NChm::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Chm", L"chm chi chq chw hxs hxi hxr hxq hxw lit", 0, 0xE9, { 'I', 'T', 'S', 'F' }, 4, false, CreateArc, 0 };
-
-REGISTER_ARC(Chm)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComHandler.cpp
deleted file mode 100644
index 287f61565..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComHandler.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-// ComHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/ProgressUtils.h"
-#include "../../Common/StreamUtils.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "ComHandler.h"
-
-namespace NArchive {
-namespace NCom {
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidMTime, VT_FILETIME}
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidClusterSize, VT_UI4},
- { NULL, kpidSectorSize, VT_UI4}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidClusterSize: prop = (UInt32)1 << _db.SectorSizeBits; break;
- case kpidSectorSize: prop = (UInt32)1 << _db.MiniSectorSizeBits; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- const CRef &ref = _db.Refs[index];
- const CItem &item = _db.Items[ref.Did];
-
- switch(propID)
- {
- case kpidPath: prop = _db.GetItemPath(index); break;
- case kpidIsDir: prop = item.IsDir(); break;
- case kpidCTime: prop = item.CTime; break;
- case kpidMTime: prop = item.MTime; break;
- case kpidPackSize: if (!item.IsDir()) prop = _db.GetItemPackSize(item.Size); break;
- case kpidSize: if (!item.IsDir()) prop = item.Size; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- Close();
- try
- {
- if (_db.Open(inStream) != S_OK)
- return S_FALSE;
- _stream = inStream;
- }
- catch(...) { return S_FALSE; }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _db.Clear();
- _stream.Release();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _db.Refs.Size();
- if (numItems == 0)
- return S_OK;
- UInt32 i;
- UInt64 totalSize = 0;
- for(i = 0; i < numItems; i++)
- {
- const CItem &item = _db.Items[_db.Refs[allFilesMode ? i : indices[i]].Did];
- if (!item.IsDir())
- totalSize += item.Size;
- }
- RINOK(extractCallback->SetTotal(totalSize));
-
- UInt64 totalPackSize;
- totalSize = totalPackSize = 0;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- for (i = 0; i < numItems; i++)
- {
- lps->InSize = totalPackSize;
- lps->OutSize = totalSize;
- RINOK(lps->SetCur());
- Int32 index = allFilesMode ? i : indices[i];
- const CItem &item = _db.Items[_db.Refs[index].Did];
-
- CMyComPtr<ISequentialOutStream> outStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- RINOK(extractCallback->GetStream(index, &outStream, askMode));
-
- if (item.IsDir())
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
-
- totalPackSize += _db.GetItemPackSize(item.Size);
- totalSize += item.Size;
-
- if (!testMode && (!outStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- Int32 res = NArchive::NExtract::NOperationResult::kDataError;
- CMyComPtr<ISequentialInStream> inStream;
- HRESULT hres = GetStream(index, &inStream);
- if (hres == S_FALSE)
- res = NArchive::NExtract::NOperationResult::kDataError;
- else if (hres == E_NOTIMPL)
- res = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- else
- {
- RINOK(hres);
- if (inStream)
- {
- RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
- if (copyCoderSpec->TotalSize == item.Size)
- res = NArchive::NExtract::NOperationResult::kOK;
- }
- }
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(res));
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _db.Refs.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
-{
- COM_TRY_BEGIN
- *stream = 0;
- const CItem &item = _db.Items[_db.Refs[index].Did];
- CClusterInStream *streamSpec = new CClusterInStream;
- CMyComPtr<ISequentialInStream> streamTemp = streamSpec;
- streamSpec->Stream = _stream;
- streamSpec->StartOffset = 0;
-
- bool isLargeStream = _db.IsLargeStream(item.Size);
- int bsLog = isLargeStream ? _db.SectorSizeBits : _db.MiniSectorSizeBits;
- streamSpec->BlockSizeLog = bsLog;
- streamSpec->Size = item.Size;
-
- UInt32 clusterSize = (UInt32)1 << bsLog;
- UInt64 numClusters64 = (item.Size + clusterSize - 1) >> bsLog;
- if (numClusters64 >= ((UInt32)1 << 31))
- return E_NOTIMPL;
- streamSpec->Vector.Reserve((int)numClusters64);
- UInt32 sid = item.Sid;
- UInt64 size = item.Size;
-
- if (size != 0)
- {
- for (;; size -= clusterSize)
- {
- if (isLargeStream)
- {
- if (sid >= _db.FatSize)
- return S_FALSE;
- streamSpec->Vector.Add(sid + 1);
- sid = _db.Fat[sid];
- }
- else
- {
- UInt64 val;
- if (sid >= _db.MatSize || !_db.GetMiniCluster(sid, val) || val >= (UInt64)1 << 32)
- return S_FALSE;
- streamSpec->Vector.Add((UInt32)val);
- sid = _db.Mat[sid];
- }
- if (size <= clusterSize)
- break;
- }
- }
- if (sid != NFatID::kEndOfChain)
- return S_FALSE;
- RINOK(streamSpec->InitAndSeek());
- *stream = streamTemp.Detach();
- return S_OK;
- COM_TRY_END
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComHandler.h
deleted file mode 100644
index f2b7de96d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComHandler.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// ComHandler.h
-
-#ifndef __ARCHIVE_COM_HANDLER_H
-#define __ARCHIVE_COM_HANDLER_H
-
-#include "Common/MyCom.h"
-#include "../IArchive.h"
-#include "ComIn.h"
-
-namespace NArchive {
-namespace NCom {
-
-class CHandler:
- public IInArchive,
- public IInArchiveGetStream,
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _stream;
- CDatabase _db;
-public:
- MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
- INTERFACE_IInArchive(;)
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComIn.cpp
deleted file mode 100644
index 8f6221221..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComIn.cpp
+++ /dev/null
@@ -1,359 +0,0 @@
-// Archive/ComIn.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/Alloc.h"
-#include "../../../../C/CpuArch.h"
-
-#include "Common/IntToString.h"
-#include "Common/MyCom.h"
-
-#include "../../Common/StreamUtils.h"
-
-#include "ComIn.h"
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-
-namespace NArchive{
-namespace NCom{
-
-static const UInt32 kSignatureSize = 8;
-static const Byte kSignature[kSignatureSize] = { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 };
-
-void CUInt32Buf::Free()
-{
- MyFree(_buf);
- _buf = 0;
-}
-
-bool CUInt32Buf::Allocate(UInt32 numItems)
-{
- Free();
- if (numItems == 0)
- return true;
- size_t newSize = (size_t)numItems * sizeof(UInt32);
- if (newSize / sizeof(UInt32) != numItems)
- return false;
- _buf = (UInt32 *)MyAlloc(newSize);
- return (_buf != 0);
-}
-
-static HRESULT ReadSector(IInStream *inStream, Byte *buf, int sectorSizeBits, UInt32 sid)
-{
- RINOK(inStream->Seek((((UInt64)sid + 1) << sectorSizeBits), STREAM_SEEK_SET, NULL));
- return ReadStream_FALSE(inStream, buf, (UInt32)1 << sectorSizeBits);
-}
-
-static HRESULT ReadIDs(IInStream *inStream, Byte *buf, int sectorSizeBits, UInt32 sid, UInt32 *dest)
-{
- RINOK(ReadSector(inStream, buf, sectorSizeBits, sid));
- UInt32 sectorSize = (UInt32)1 << sectorSizeBits;
- for (UInt32 t = 0; t < sectorSize; t += 4)
- *dest++ = Get32(buf + t);
- return S_OK;
-}
-
-static void GetFileTimeFromMem(const Byte *p, FILETIME *ft)
-{
- ft->dwLowDateTime = Get32(p);
- ft->dwHighDateTime = Get32(p + 4);
-}
-
-void CItem::Parse(const Byte *p, bool mode64bit)
-{
- memcpy(Name, p, kNameSizeMax);
- // NameSize = Get16(p + 64);
- Type = p[66];
- LeftDid = Get32(p + 68);
- RightDid = Get32(p + 72);
- SonDid = Get32(p + 76);
- // Flags = Get32(p + 96);
- GetFileTimeFromMem(p + 100, &CTime);
- GetFileTimeFromMem(p + 108, &MTime);
- Sid = Get32(p + 116);
- Size = Get32(p + 120);
- if (mode64bit)
- Size |= ((UInt64)Get32(p + 124) << 32);
-}
-
-void CDatabase::Clear()
-{
- Fat.Free();
- MiniSids.Free();
- Mat.Free();
- Items.Clear();
- Refs.Clear();
-}
-
-static const UInt32 kNoDid = 0xFFFFFFFF;
-
-HRESULT CDatabase::AddNode(int parent, UInt32 did)
-{
- if (did == kNoDid)
- return S_OK;
- if (did >= (UInt32)Items.Size())
- return S_FALSE;
- const CItem &item = Items[did];
- if (item.IsEmpty())
- return S_FALSE;
- CRef ref;
- ref.Parent = parent;
- ref.Did = did;
- int index = Refs.Add(ref);
- if (Refs.Size() > Items.Size())
- return S_FALSE;
- RINOK(AddNode(parent, item.LeftDid));
- RINOK(AddNode(parent, item.RightDid));
- if (item.IsDir())
- {
- RINOK(AddNode(index, item.SonDid));
- }
- return S_OK;
-}
-
-static const char kCharOpenBracket = '[';
-static const char kCharCloseBracket = ']';
-
-static UString CompoundNameToFileName(const UString &s)
-{
- UString res;
- for (int i = 0; i < s.Length(); i++)
- {
- wchar_t c = s[i];
- if (c < 0x20)
- {
- res += kCharOpenBracket;
- wchar_t buf[32];
- ConvertUInt32ToString(c, buf);
- res += buf;
- res += kCharCloseBracket;
- }
- else
- res += c;
- }
- return res;
-}
-
-static char g_MsiChars[] =
-"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._";
-
-static const wchar_t *kMsi_ID = L""; // L"{msi}";
-
-static const int kMsiNumBits = 6;
-static const UInt32 kMsiNumChars = 1 << kMsiNumBits;
-static const UInt32 kMsiCharMask = kMsiNumChars - 1;
-static const UInt32 kMsiStartUnicodeChar = 0x3800;
-static const UInt32 kMsiUnicodeRange = kMsiNumChars * (kMsiNumChars + 1);
-
-bool CompoundMsiNameToFileName(const UString &name, UString &resultName)
-{
- resultName.Empty();
- for (int i = 0; i < name.Length(); i++)
- {
- wchar_t c = name[i];
- if (c < kMsiStartUnicodeChar || c > kMsiStartUnicodeChar + kMsiUnicodeRange)
- return false;
- if (i == 0)
- resultName += kMsi_ID;
- c -= kMsiStartUnicodeChar;
-
- UInt32 c0 = c & kMsiCharMask;
- UInt32 c1 = c >> kMsiNumBits;
-
- if (c1 <= kMsiNumChars)
- {
- resultName += (wchar_t)g_MsiChars[c0];
- if (c1 == kMsiNumChars)
- break;
- resultName += (wchar_t)g_MsiChars[c1];
- }
- else
- resultName += L'!';
- }
- return true;
-}
-
-static UString ConvertName(const Byte *p)
-{
- UString s;
- for (int i = 0; i < kNameSizeMax; i += 2)
- {
- wchar_t c = (p[i] | (wchar_t)p[i + 1] << 8);
- if (c == 0)
- break;
- s += c;
- }
- UString msiName;
- if (CompoundMsiNameToFileName(s, msiName))
- return msiName;
- return CompoundNameToFileName(s);
-}
-
-UString CDatabase::GetItemPath(UInt32 index) const
-{
- UString s;
- while (index != kNoDid)
- {
- const CRef &ref = Refs[index];
- const CItem &item = Items[ref.Did];
- if (!s.IsEmpty())
- s = (UString)WCHAR_PATH_SEPARATOR + s;
- s = ConvertName(item.Name) + s;
- index = ref.Parent;
- }
- return s;
-}
-
-HRESULT CDatabase::Open(IInStream *inStream)
-{
- static const UInt32 kHeaderSize = 512;
- Byte p[kHeaderSize];
- RINOK(ReadStream_FALSE(inStream, p, kHeaderSize));
- if (memcmp(p, kSignature, kSignatureSize) != 0)
- return S_FALSE;
- if (Get16(p + 0x1A) > 4) // majorVer
- return S_FALSE;
- if (Get16(p + 0x1C) != 0xFFFE)
- return S_FALSE;
- int sectorSizeBits = Get16(p + 0x1E);
- bool mode64bit = (sectorSizeBits >= 12);
- int miniSectorSizeBits = Get16(p + 0x20);
- SectorSizeBits = sectorSizeBits;
- MiniSectorSizeBits = miniSectorSizeBits;
-
- if (sectorSizeBits > 28 || miniSectorSizeBits > 28 ||
- sectorSizeBits < 7 || miniSectorSizeBits < 2 || miniSectorSizeBits > sectorSizeBits)
- return S_FALSE;
- UInt32 numSectorsForFAT = Get32(p + 0x2C);
- LongStreamMinSize = Get32(p + 0x38);
-
- UInt32 sectSize = (UInt32)1 << (int)sectorSizeBits;
-
- CByteBuffer sect;
- sect.SetCapacity(sectSize);
-
- int ssb2 = (int)(sectorSizeBits - 2);
- UInt32 numSidsInSec = (UInt32)1 << ssb2;
- UInt32 numFatItems = numSectorsForFAT << ssb2;
- if ((numFatItems >> ssb2) != numSectorsForFAT)
- return S_FALSE;
- FatSize = numFatItems;
-
- {
- CUInt32Buf bat;
- UInt32 numSectorsForBat = Get32(p + 0x48);
- const UInt32 kNumHeaderBatItems = 109;
- UInt32 numBatItems = kNumHeaderBatItems + (numSectorsForBat << ssb2);
- if (numBatItems < kNumHeaderBatItems || ((numBatItems - kNumHeaderBatItems) >> ssb2) != numSectorsForBat)
- return S_FALSE;
- if (!bat.Allocate(numBatItems))
- return S_FALSE;
- UInt32 i;
- for (i = 0; i < kNumHeaderBatItems; i++)
- bat[i] = Get32(p + 0x4c + i * 4);
- UInt32 sid = Get32(p + 0x44);
- for (UInt32 s = 0; s < numSectorsForBat; s++)
- {
- RINOK(ReadIDs(inStream, sect, sectorSizeBits, sid, bat + i));
- i += numSidsInSec - 1;
- sid = bat[i];
- }
- numBatItems = i;
-
- if (!Fat.Allocate(numFatItems))
- return S_FALSE;
- UInt32 j = 0;
-
- for (i = 0; i < numFatItems; j++, i += numSidsInSec)
- {
- if (j >= numBatItems)
- return S_FALSE;
- RINOK(ReadIDs(inStream, sect, sectorSizeBits, bat[j], Fat + i));
- }
- }
-
- UInt32 numMatItems;
- {
- UInt32 numSectorsForMat = Get32(p + 0x40);
- numMatItems = (UInt32)numSectorsForMat << ssb2;
- if ((numMatItems >> ssb2) != numSectorsForMat)
- return S_FALSE;
- if (!Mat.Allocate(numMatItems))
- return S_FALSE;
- UInt32 i;
- UInt32 sid = Get32(p + 0x3C);
- for (i = 0; i < numMatItems; i += numSidsInSec)
- {
- RINOK(ReadIDs(inStream, sect, sectorSizeBits, sid, Mat + i));
- if (sid >= numFatItems)
- return S_FALSE;
- sid = Fat[sid];
- }
- if (sid != NFatID::kEndOfChain)
- return S_FALSE;
- }
-
- {
- UInt32 sid = Get32(p + 0x30);
- for (;;)
- {
- if (sid >= numFatItems)
- return S_FALSE;
- RINOK(ReadSector(inStream, sect, sectorSizeBits, sid));
- for (UInt32 i = 0; i < sectSize; i += 128)
- {
- CItem item;
- item.Parse(sect + i, mode64bit);
- Items.Add(item);
- }
- sid = Fat[sid];
- if (sid == NFatID::kEndOfChain)
- break;
- }
- }
-
- CItem root = Items[0];
-
- {
- UInt32 numSectorsInMiniStream;
- {
- UInt64 numSatSects64 = (root.Size + sectSize - 1) >> sectorSizeBits;
- if (numSatSects64 > NFatID::kMaxValue)
- return S_FALSE;
- numSectorsInMiniStream = (UInt32)numSatSects64;
- }
- NumSectorsInMiniStream = numSectorsInMiniStream;
- if (!MiniSids.Allocate(numSectorsInMiniStream))
- return S_FALSE;
- {
- UInt64 matSize64 = (root.Size + ((UInt64)1 << miniSectorSizeBits) - 1) >> miniSectorSizeBits;
- if (matSize64 > NFatID::kMaxValue)
- return S_FALSE;
- MatSize = (UInt32)matSize64;
- if (numMatItems < MatSize)
- return S_FALSE;
- }
-
- UInt32 sid = root.Sid;
- for (UInt32 i = 0; ; i++)
- {
- if (sid == NFatID::kEndOfChain)
- {
- if (i != numSectorsInMiniStream)
- return S_FALSE;
- break;
- }
- if (i >= numSectorsInMiniStream)
- return S_FALSE;
- MiniSids[i] = sid;
- if (sid >= numFatItems)
- return S_FALSE;
- sid = Fat[sid];
- }
- }
-
- return AddNode(-1, root.SonDid);
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComIn.h
deleted file mode 100644
index 05fc73870..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComIn.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// Archive/ComIn.h
-
-#ifndef __ARCHIVE_COM_IN_H
-#define __ARCHIVE_COM_IN_H
-
-#include "Common/MyString.h"
-#include "Common/Buffer.h"
-
-namespace NArchive {
-namespace NCom {
-
-struct CUInt32Buf
-{
- UInt32 *_buf;
-public:
- CUInt32Buf(): _buf(0) {}
- ~CUInt32Buf() { Free(); }
- void Free();
- bool Allocate(UInt32 numItems);
- operator UInt32 *() const { return _buf; };
-};
-
-namespace NFatID
-{
- const UInt32 kFree = 0xFFFFFFFF;
- const UInt32 kEndOfChain = 0xFFFFFFFE;
- const UInt32 kFatSector = 0xFFFFFFFD;
- const UInt32 kMatSector = 0xFFFFFFFC;
- const UInt32 kMaxValue = 0xFFFFFFFA;
-}
-
-namespace NItemType
-{
- const Byte kEmpty = 0;
- const Byte kStorage = 1;
- const Byte kStream = 2;
- const Byte kLockBytes = 3;
- const Byte kProperty = 4;
- const Byte kRootStorage = 5;
-}
-
-const UInt32 kNameSizeMax = 64;
-
-struct CItem
-{
- Byte Name[kNameSizeMax];
- // UInt16 NameSize;
- // UInt32 Flags;
- FILETIME CTime;
- FILETIME MTime;
- UInt64 Size;
- UInt32 LeftDid;
- UInt32 RightDid;
- UInt32 SonDid;
- UInt32 Sid;
- Byte Type;
-
- bool IsEmpty() const { return Type == NItemType::kEmpty; }
- bool IsDir() const { return Type == NItemType::kStorage || Type == NItemType::kRootStorage; }
-
- void Parse(const Byte *p, bool mode64bit);
-};
-
-struct CRef
-{
- int Parent;
- UInt32 Did;
-};
-
-class CDatabase
-{
- UInt32 NumSectorsInMiniStream;
- CUInt32Buf MiniSids;
-
- HRESULT AddNode(int parent, UInt32 did);
-public:
-
- CUInt32Buf Fat;
- UInt32 FatSize;
-
- CUInt32Buf Mat;
- UInt32 MatSize;
-
- CObjectVector<CItem> Items;
- CRecordVector<CRef> Refs;
-
- UInt32 LongStreamMinSize;
- int SectorSizeBits;
- int MiniSectorSizeBits;
-
- void Clear();
- bool IsLargeStream(UInt64 size) const { return size >= LongStreamMinSize; }
- UString GetItemPath(UInt32 index) const;
-
- UInt64 GetItemPackSize(UInt64 size) const
- {
- UInt64 mask = ((UInt64)1 << (IsLargeStream(size) ? SectorSizeBits : MiniSectorSizeBits)) - 1;
- return (size + mask) & ~mask;
- }
-
- bool GetMiniCluster(UInt32 sid, UInt64 &res) const
- {
- int subBits = SectorSizeBits - MiniSectorSizeBits;
- UInt32 fid = sid >> subBits;
- if (fid >= NumSectorsInMiniStream)
- return false;
- res = (((UInt64)MiniSids[fid] + 1) << subBits) + (sid & ((1 << subBits) - 1));
- return true;
- }
-
- HRESULT Open(IInStream *inStream);
-};
-
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComRegister.cpp
deleted file mode 100644
index c744b04fb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Com/ComRegister.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// ComRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "ComHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NCom::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Compound", L"msi doc xls ppt", 0, 0xE5, { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 }, 8, false, CreateArc, 0 };
-
-REGISTER_ARC(Com)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2.cpp
deleted file mode 100644
index aed94f9cf..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-// CoderMixer2.cpp
-
-#include "StdAfx.h"
-
-#include "CoderMixer2.h"
-
-namespace NCoderMixer {
-
-CBindReverseConverter::CBindReverseConverter(const CBindInfo &srcBindInfo):
- _srcBindInfo(srcBindInfo)
-{
- srcBindInfo.GetNumStreams(NumSrcInStreams, _numSrcOutStreams);
-
- UInt32 j;
- for (j = 0; j < NumSrcInStreams; j++)
- {
- _srcInToDestOutMap.Add(0);
- DestOutToSrcInMap.Add(0);
- }
- for (j = 0; j < _numSrcOutStreams; j++)
- {
- _srcOutToDestInMap.Add(0);
- _destInToSrcOutMap.Add(0);
- }
-
- UInt32 destInOffset = 0;
- UInt32 destOutOffset = 0;
- UInt32 srcInOffset = NumSrcInStreams;
- UInt32 srcOutOffset = _numSrcOutStreams;
-
- for (int i = srcBindInfo.Coders.Size() - 1; i >= 0; i--)
- {
- const CCoderStreamsInfo &srcCoderInfo = srcBindInfo.Coders[i];
-
- srcInOffset -= srcCoderInfo.NumInStreams;
- srcOutOffset -= srcCoderInfo.NumOutStreams;
-
- UInt32 j;
- for (j = 0; j < srcCoderInfo.NumInStreams; j++, destOutOffset++)
- {
- UInt32 index = srcInOffset + j;
- _srcInToDestOutMap[index] = destOutOffset;
- DestOutToSrcInMap[destOutOffset] = index;
- }
- for (j = 0; j < srcCoderInfo.NumOutStreams; j++, destInOffset++)
- {
- UInt32 index = srcOutOffset + j;
- _srcOutToDestInMap[index] = destInOffset;
- _destInToSrcOutMap[destInOffset] = index;
- }
- }
-}
-
-void CBindReverseConverter::CreateReverseBindInfo(CBindInfo &destBindInfo)
-{
- destBindInfo.Coders.Clear();
- destBindInfo.BindPairs.Clear();
- destBindInfo.InStreams.Clear();
- destBindInfo.OutStreams.Clear();
-
- int i;
- for (i = _srcBindInfo.Coders.Size() - 1; i >= 0; i--)
- {
- const CCoderStreamsInfo &srcCoderInfo = _srcBindInfo.Coders[i];
- CCoderStreamsInfo destCoderInfo;
- destCoderInfo.NumInStreams = srcCoderInfo.NumOutStreams;
- destCoderInfo.NumOutStreams = srcCoderInfo.NumInStreams;
- destBindInfo.Coders.Add(destCoderInfo);
- }
- for (i = _srcBindInfo.BindPairs.Size() - 1; i >= 0; i--)
- {
- const CBindPair &srcBindPair = _srcBindInfo.BindPairs[i];
- CBindPair destBindPair;
- destBindPair.InIndex = _srcOutToDestInMap[srcBindPair.OutIndex];
- destBindPair.OutIndex = _srcInToDestOutMap[srcBindPair.InIndex];
- destBindInfo.BindPairs.Add(destBindPair);
- }
- for (i = 0; i < _srcBindInfo.InStreams.Size(); i++)
- destBindInfo.OutStreams.Add(_srcInToDestOutMap[_srcBindInfo.InStreams[i]]);
- for (i = 0; i < _srcBindInfo.OutStreams.Size(); i++)
- destBindInfo.InStreams.Add(_srcOutToDestInMap[_srcBindInfo.OutStreams[i]]);
-}
-
-CCoderInfo2::CCoderInfo2(UInt32 numInStreams, UInt32 numOutStreams):
- NumInStreams(numInStreams),
- NumOutStreams(numOutStreams)
-{
- InSizes.Reserve(NumInStreams);
- InSizePointers.Reserve(NumInStreams);
- OutSizePointers.Reserve(NumOutStreams);
- OutSizePointers.Reserve(NumOutStreams);
-}
-
-static void SetSizes(const UInt64 **srcSizes, CRecordVector<UInt64> &sizes,
- CRecordVector<const UInt64 *> &sizePointers, UInt32 numItems)
-{
- sizes.Clear();
- sizePointers.Clear();
- for(UInt32 i = 0; i < numItems; i++)
- {
- if (srcSizes == 0 || srcSizes[i] == NULL)
- {
- sizes.Add(0);
- sizePointers.Add(NULL);
- }
- else
- {
- sizes.Add(*srcSizes[i]);
- sizePointers.Add(&sizes.Back());
- }
- }
-}
-
-void CCoderInfo2::SetCoderInfo(const UInt64 **inSizes,
- const UInt64 **outSizes)
-{
- SetSizes(inSizes, InSizes, InSizePointers, NumInStreams);
- SetSizes(outSizes, OutSizes, OutSizePointers, NumOutStreams);
-}
-
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2.h
deleted file mode 100644
index 386e83932..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2.h
+++ /dev/null
@@ -1,175 +0,0 @@
-// CoderMixer2.h
-
-#ifndef __CODER_MIXER2_H
-#define __CODER_MIXER2_H
-
-#include "../../../Common/MyVector.h"
-#include "../../../Common/Types.h"
-#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
-
-namespace NCoderMixer {
-
-struct CBindPair
-{
- UInt32 InIndex;
- UInt32 OutIndex;
-};
-
-struct CCoderStreamsInfo
-{
- UInt32 NumInStreams;
- UInt32 NumOutStreams;
-};
-
-struct CBindInfo
-{
- CRecordVector<CCoderStreamsInfo> Coders;
- CRecordVector<CBindPair> BindPairs;
- CRecordVector<UInt32> InStreams;
- CRecordVector<UInt32> OutStreams;
-
- void Clear()
- {
- Coders.Clear();
- BindPairs.Clear();
- InStreams.Clear();
- OutStreams.Clear();
- }
-
- /*
- UInt32 GetCoderStartOutStream(UInt32 coderIndex) const
- {
- UInt32 numOutStreams = 0;
- for (UInt32 i = 0; i < coderIndex; i++)
- numOutStreams += Coders[i].NumOutStreams;
- return numOutStreams;
- }
- */
-
-
- void GetNumStreams(UInt32 &numInStreams, UInt32 &numOutStreams) const
- {
- numInStreams = 0;
- numOutStreams = 0;
- for (int i = 0; i < Coders.Size(); i++)
- {
- const CCoderStreamsInfo &coderStreamsInfo = Coders[i];
- numInStreams += coderStreamsInfo.NumInStreams;
- numOutStreams += coderStreamsInfo.NumOutStreams;
- }
- }
-
- int FindBinderForInStream(UInt32 inStream) const
- {
- for (int i = 0; i < BindPairs.Size(); i++)
- if (BindPairs[i].InIndex == inStream)
- return i;
- return -1;
- }
- int FindBinderForOutStream(UInt32 outStream) const
- {
- for (int i = 0; i < BindPairs.Size(); i++)
- if (BindPairs[i].OutIndex == outStream)
- return i;
- return -1;
- }
-
- UInt32 GetCoderInStreamIndex(UInt32 coderIndex) const
- {
- UInt32 streamIndex = 0;
- for (UInt32 i = 0; i < coderIndex; i++)
- streamIndex += Coders[i].NumInStreams;
- return streamIndex;
- }
-
- UInt32 GetCoderOutStreamIndex(UInt32 coderIndex) const
- {
- UInt32 streamIndex = 0;
- for (UInt32 i = 0; i < coderIndex; i++)
- streamIndex += Coders[i].NumOutStreams;
- return streamIndex;
- }
-
-
- void FindInStream(UInt32 streamIndex, UInt32 &coderIndex,
- UInt32 &coderStreamIndex) const
- {
- for (coderIndex = 0; coderIndex < (UInt32)Coders.Size(); coderIndex++)
- {
- UInt32 curSize = Coders[coderIndex].NumInStreams;
- if (streamIndex < curSize)
- {
- coderStreamIndex = streamIndex;
- return;
- }
- streamIndex -= curSize;
- }
- throw 1;
- }
- void FindOutStream(UInt32 streamIndex, UInt32 &coderIndex,
- UInt32 &coderStreamIndex) const
- {
- for (coderIndex = 0; coderIndex < (UInt32)Coders.Size(); coderIndex++)
- {
- UInt32 curSize = Coders[coderIndex].NumOutStreams;
- if (streamIndex < curSize)
- {
- coderStreamIndex = streamIndex;
- return;
- }
- streamIndex -= curSize;
- }
- throw 1;
- }
-};
-
-class CBindReverseConverter
-{
- UInt32 _numSrcOutStreams;
- NCoderMixer::CBindInfo _srcBindInfo;
- CRecordVector<UInt32> _srcInToDestOutMap;
- CRecordVector<UInt32> _srcOutToDestInMap;
- CRecordVector<UInt32> _destInToSrcOutMap;
-public:
- UInt32 NumSrcInStreams;
- CRecordVector<UInt32> DestOutToSrcInMap;
-
- CBindReverseConverter(const NCoderMixer::CBindInfo &srcBindInfo);
- void CreateReverseBindInfo(NCoderMixer::CBindInfo &destBindInfo);
-};
-
-struct CCoderInfo2
-{
- CMyComPtr<ICompressCoder> Coder;
- CMyComPtr<ICompressCoder2> Coder2;
- UInt32 NumInStreams;
- UInt32 NumOutStreams;
-
- CRecordVector<UInt64> InSizes;
- CRecordVector<UInt64> OutSizes;
- CRecordVector<const UInt64 *> InSizePointers;
- CRecordVector<const UInt64 *> OutSizePointers;
-
- CCoderInfo2(UInt32 numInStreams, UInt32 numOutStreams);
- void SetCoderInfo(const UInt64 **inSizes, const UInt64 **outSizes);
-
- HRESULT QueryInterface(REFGUID iid, void** pp) const
- {
- IUnknown *p = Coder ? (IUnknown *)Coder : (IUnknown *)Coder2;
- return p->QueryInterface(iid, pp);
- }
-};
-
-class CCoderMixer2
-{
-public:
- virtual ~CCoderMixer2() {}
- virtual HRESULT SetBindInfo(const CBindInfo &bindInfo) = 0;
- virtual void ReInit() = 0;
- virtual void SetCoderInfo(UInt32 coderIndex, const UInt64 **inSizes, const UInt64 **outSizes) = 0;
-};
-
-}
-#endif
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2MT.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2MT.cpp
deleted file mode 100644
index 1265dfcde..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2MT.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-// CoderMixer2MT.cpp
-
-#include "StdAfx.h"
-
-#include "CoderMixer2MT.h"
-
-namespace NCoderMixer {
-
-CCoder2::CCoder2(UInt32 numInStreams, UInt32 numOutStreams):
- CCoderInfo2(numInStreams, numOutStreams)
-{
- InStreams.Reserve(NumInStreams);
- InStreamPointers.Reserve(NumInStreams);
- OutStreams.Reserve(NumOutStreams);
- OutStreamPointers.Reserve(NumOutStreams);
-}
-
-void CCoder2::Execute() { Code(NULL); }
-
-void CCoder2::Code(ICompressProgressInfo *progress)
-{
- InStreamPointers.Clear();
- OutStreamPointers.Clear();
- UInt32 i;
- for (i = 0; i < NumInStreams; i++)
- {
- if (InSizePointers[i] != NULL)
- InSizePointers[i] = &InSizes[i];
- InStreamPointers.Add((ISequentialInStream *)InStreams[i]);
- }
- for (i = 0; i < NumOutStreams; i++)
- {
- if (OutSizePointers[i] != NULL)
- OutSizePointers[i] = &OutSizes[i];
- OutStreamPointers.Add((ISequentialOutStream *)OutStreams[i]);
- }
- if (Coder)
- Result = Coder->Code(InStreamPointers[0], OutStreamPointers[0],
- InSizePointers[0], OutSizePointers[0], progress);
- else
- Result = Coder2->Code(&InStreamPointers.Front(), &InSizePointers.Front(), NumInStreams,
- &OutStreamPointers.Front(), &OutSizePointers.Front(), NumOutStreams, progress);
- {
- int i;
- for (i = 0; i < InStreams.Size(); i++)
- InStreams[i].Release();
- for (i = 0; i < OutStreams.Size(); i++)
- OutStreams[i].Release();
- }
-}
-
-static void SetSizes(const UInt64 **srcSizes, CRecordVector<UInt64> &sizes,
- CRecordVector<const UInt64 *> &sizePointers, UInt32 numItems)
-{
- sizes.Clear();
- sizePointers.Clear();
- for(UInt32 i = 0; i < numItems; i++)
- {
- if (srcSizes == 0 || srcSizes[i] == NULL)
- {
- sizes.Add(0);
- sizePointers.Add(NULL);
- }
- else
- {
- sizes.Add(*srcSizes[i]);
- sizePointers.Add(&sizes.Back());
- }
- }
-}
-
-
-void CCoder2::SetCoderInfo(const UInt64 **inSizes, const UInt64 **outSizes)
-{
- SetSizes(inSizes, InSizes, InSizePointers, NumInStreams);
- SetSizes(outSizes, OutSizes, OutSizePointers, NumOutStreams);
-}
-
-//////////////////////////////////////
-// CCoderMixer2MT
-
-HRESULT CCoderMixer2MT::SetBindInfo(const CBindInfo &bindInfo)
-{
- _bindInfo = bindInfo;
- _streamBinders.Clear();
- for(int i = 0; i < _bindInfo.BindPairs.Size(); i++)
- {
- _streamBinders.Add(CStreamBinder());
- RINOK(_streamBinders.Back().CreateEvents());
- }
- return S_OK;
-}
-
-void CCoderMixer2MT::AddCoderCommon()
-{
- const CCoderStreamsInfo &c = _bindInfo.Coders[_coders.Size()];
- CCoder2 threadCoderInfo(c.NumInStreams, c.NumOutStreams);
- _coders.Add(threadCoderInfo);
-}
-
-void CCoderMixer2MT::AddCoder(ICompressCoder *coder)
-{
- AddCoderCommon();
- _coders.Back().Coder = coder;
-}
-
-void CCoderMixer2MT::AddCoder2(ICompressCoder2 *coder)
-{
- AddCoderCommon();
- _coders.Back().Coder2 = coder;
-}
-
-
-void CCoderMixer2MT::ReInit()
-{
- for(int i = 0; i < _streamBinders.Size(); i++)
- _streamBinders[i].ReInit();
-}
-
-
-HRESULT CCoderMixer2MT::Init(ISequentialInStream **inStreams, ISequentialOutStream **outStreams)
-{
- /*
- if (_coders.Size() != _bindInfo.Coders.Size())
- throw 0;
- */
- int i;
- for(i = 0; i < _coders.Size(); i++)
- {
- CCoder2 &coderInfo = _coders[i];
- const CCoderStreamsInfo &coderStreamsInfo = _bindInfo.Coders[i];
- coderInfo.InStreams.Clear();
- UInt32 j;
- for(j = 0; j < coderStreamsInfo.NumInStreams; j++)
- coderInfo.InStreams.Add(NULL);
- coderInfo.OutStreams.Clear();
- for(j = 0; j < coderStreamsInfo.NumOutStreams; j++)
- coderInfo.OutStreams.Add(NULL);
- }
-
- for(i = 0; i < _bindInfo.BindPairs.Size(); i++)
- {
- const CBindPair &bindPair = _bindInfo.BindPairs[i];
- UInt32 inCoderIndex, inCoderStreamIndex;
- UInt32 outCoderIndex, outCoderStreamIndex;
- _bindInfo.FindInStream(bindPair.InIndex, inCoderIndex, inCoderStreamIndex);
- _bindInfo.FindOutStream(bindPair.OutIndex, outCoderIndex, outCoderStreamIndex);
-
- _streamBinders[i].CreateStreams(
- &_coders[inCoderIndex].InStreams[inCoderStreamIndex],
- &_coders[outCoderIndex].OutStreams[outCoderStreamIndex]);
- }
-
- for(i = 0; i < _bindInfo.InStreams.Size(); i++)
- {
- UInt32 inCoderIndex, inCoderStreamIndex;
- _bindInfo.FindInStream(_bindInfo.InStreams[i], inCoderIndex, inCoderStreamIndex);
- _coders[inCoderIndex].InStreams[inCoderStreamIndex] = inStreams[i];
- }
-
- for(i = 0; i < _bindInfo.OutStreams.Size(); i++)
- {
- UInt32 outCoderIndex, outCoderStreamIndex;
- _bindInfo.FindOutStream(_bindInfo.OutStreams[i], outCoderIndex, outCoderStreamIndex);
- _coders[outCoderIndex].OutStreams[outCoderStreamIndex] = outStreams[i];
- }
- return S_OK;
-}
-
-HRESULT CCoderMixer2MT::ReturnIfError(HRESULT code)
-{
- for (int i = 0; i < _coders.Size(); i++)
- if (_coders[i].Result == code)
- return code;
- return S_OK;
-}
-
-STDMETHODIMP CCoderMixer2MT::Code(ISequentialInStream **inStreams,
- const UInt64 ** /* inSizes */,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 ** /* outSizes */,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress)
-{
- if (numInStreams != (UInt32)_bindInfo.InStreams.Size() ||
- numOutStreams != (UInt32)_bindInfo.OutStreams.Size())
- return E_INVALIDARG;
-
- Init(inStreams, outStreams);
-
- int i;
- for (i = 0; i < _coders.Size(); i++)
- if (i != _progressCoderIndex)
- {
- RINOK(_coders[i].Create());
- }
-
- for (i = 0; i < _coders.Size(); i++)
- if (i != _progressCoderIndex)
- _coders[i].Start();
-
- _coders[_progressCoderIndex].Code(progress);
-
- for (i = 0; i < _coders.Size(); i++)
- if (i != _progressCoderIndex)
- _coders[i].WaitFinish();
-
- RINOK(ReturnIfError(E_ABORT));
- RINOK(ReturnIfError(E_OUTOFMEMORY));
-
- for (i = 0; i < _coders.Size(); i++)
- {
- HRESULT result = _coders[i].Result;
- if (result != S_OK && result != E_FAIL && result != S_FALSE)
- return result;
- }
-
- RINOK(ReturnIfError(S_FALSE));
-
- for (i = 0; i < _coders.Size(); i++)
- {
- HRESULT result = _coders[i].Result;
- if (result != S_OK)
- return result;
- }
- return S_OK;
-}
-
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2MT.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2MT.h
deleted file mode 100644
index d1c7f4d07..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2MT.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// CoderMixer2MT.h
-
-#ifndef __CODER_MIXER2_MT_H
-#define __CODER_MIXER2_MT_H
-
-#include "CoderMixer2.h"
-#include "../../../Common/MyCom.h"
-#include "../../Common/StreamBinder.h"
-#include "../../Common/VirtThread.h"
-
-namespace NCoderMixer {
-
-struct CCoder2: public CCoderInfo2, public CVirtThread
-{
- HRESULT Result;
- CObjectVector< CMyComPtr<ISequentialInStream> > InStreams;
- CObjectVector< CMyComPtr<ISequentialOutStream> > OutStreams;
- CRecordVector<ISequentialInStream*> InStreamPointers;
- CRecordVector<ISequentialOutStream*> OutStreamPointers;
-
- CCoder2(UInt32 numInStreams, UInt32 numOutStreams);
- void SetCoderInfo(const UInt64 **inSizes, const UInt64 **outSizes);
- virtual void Execute();
- void Code(ICompressProgressInfo *progress);
-};
-
-
-/*
- SetBindInfo()
- for each coder
- AddCoder[2]()
- SetProgressIndex(UInt32 coderIndex);
-
- for each file
- {
- ReInit()
- for each coder
- SetCoderInfo
- Code
- }
-*/
-
-class CCoderMixer2MT:
- public ICompressCoder2,
- public CCoderMixer2,
- public CMyUnknownImp
-{
- CBindInfo _bindInfo;
- CObjectVector<CStreamBinder> _streamBinders;
- int _progressCoderIndex;
-
- void AddCoderCommon();
- HRESULT Init(ISequentialInStream **inStreams, ISequentialOutStream **outStreams);
- HRESULT ReturnIfError(HRESULT code);
-public:
- CObjectVector<CCoder2> _coders;
- MY_UNKNOWN_IMP
-
- STDMETHOD(Code)(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress);
-
- HRESULT SetBindInfo(const CBindInfo &bindInfo);
- void AddCoder(ICompressCoder *coder);
- void AddCoder2(ICompressCoder2 *coder);
- void SetProgressCoderIndex(int coderIndex) { _progressCoderIndex = coderIndex; }
-
- void ReInit();
- void SetCoderInfo(UInt32 coderIndex, const UInt64 **inSizes, const UInt64 **outSizes)
- { _coders[coderIndex].SetCoderInfo(inSizes, outSizes); }
- UInt64 GetWriteProcessedSize(UInt32 binderIndex) const
- { return _streamBinders[binderIndex].ProcessedSize; }
-};
-
-}
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2ST.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2ST.cpp
deleted file mode 100644
index a59ce5fc0..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2ST.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-// CoderMixer2ST.cpp
-
-#include "StdAfx.h"
-
-#include "CoderMixer2ST.h"
-
-namespace NCoderMixer2 {
-
-CCoderMixer2ST::CCoderMixer2ST() {}
-
-CCoderMixer2ST::~CCoderMixer2ST(){ }
-
-HRESULT CCoderMixer2ST::SetBindInfo(const CBindInfo &bindInfo)
-{
- _bindInfo = bindInfo;
- return S_OK;
-}
-
-void CCoderMixer2ST::AddCoderCommon(bool isMain)
-{
- const CCoderStreamsInfo &csi = _bindInfo.Coders[_coders.Size()];
- _coders.Add(CSTCoderInfo(csi.NumInStreams, csi.NumOutStreams, isMain));
-}
-
-void CCoderMixer2ST::AddCoder(ICompressCoder *coder, bool isMain)
-{
- AddCoderCommon(isMain);
- _coders.Back().Coder = coder;
-}
-
-void CCoderMixer2ST::AddCoder2(ICompressCoder2 *coder, bool isMain)
-{
- AddCoderCommon(isMain);
- _coders.Back().Coder2 = coder;
-}
-
-void CCoderMixer2ST::ReInit() { }
-
-HRESULT CCoderMixer2ST::GetInStream(
- ISequentialInStream **inStreams, const UInt64 **inSizes,
- UInt32 streamIndex, ISequentialInStream **inStreamRes)
-{
- CMyComPtr<ISequentialInStream> seqInStream;
- int i;
- for(i = 0; i < _bindInfo.InStreams.Size(); i++)
- if (_bindInfo.InStreams[i] == streamIndex)
- {
- seqInStream = inStreams[i];
- *inStreamRes = seqInStream.Detach();
- return S_OK;
- }
- int binderIndex = _bindInfo.FindBinderForInStream(streamIndex);
- if (binderIndex < 0)
- return E_INVALIDARG;
-
- UInt32 coderIndex, coderStreamIndex;
- _bindInfo.FindOutStream(_bindInfo.BindPairs[binderIndex].OutIndex,
- coderIndex, coderStreamIndex);
-
- CCoderInfo &coder = _coders[coderIndex];
- if (!coder.Coder)
- return E_NOTIMPL;
- coder.Coder.QueryInterface(IID_ISequentialInStream, &seqInStream);
- if (!seqInStream)
- return E_NOTIMPL;
-
- UInt32 startIndex = _bindInfo.GetCoderInStreamIndex(coderIndex);
-
- CMyComPtr<ICompressSetInStream> setInStream;
- if (!coder.Coder)
- return E_NOTIMPL;
- coder.Coder.QueryInterface(IID_ICompressSetInStream, &setInStream);
- if (!setInStream)
- return E_NOTIMPL;
-
- if (coder.NumInStreams > 1)
- return E_NOTIMPL;
- for (i = 0; i < (int)coder.NumInStreams; i++)
- {
- CMyComPtr<ISequentialInStream> seqInStream2;
- RINOK(GetInStream(inStreams, inSizes, startIndex + i, &seqInStream2));
- RINOK(setInStream->SetInStream(seqInStream2));
- }
- *inStreamRes = seqInStream.Detach();
- return S_OK;
-}
-
-HRESULT CCoderMixer2ST::GetOutStream(
- ISequentialOutStream **outStreams, const UInt64 **outSizes,
- UInt32 streamIndex, ISequentialOutStream **outStreamRes)
-{
- CMyComPtr<ISequentialOutStream> seqOutStream;
- int i;
- for(i = 0; i < _bindInfo.OutStreams.Size(); i++)
- if (_bindInfo.OutStreams[i] == streamIndex)
- {
- seqOutStream = outStreams[i];
- *outStreamRes = seqOutStream.Detach();
- return S_OK;
- }
- int binderIndex = _bindInfo.FindBinderForOutStream(streamIndex);
- if (binderIndex < 0)
- return E_INVALIDARG;
-
- UInt32 coderIndex, coderStreamIndex;
- _bindInfo.FindInStream(_bindInfo.BindPairs[binderIndex].InIndex,
- coderIndex, coderStreamIndex);
-
- CCoderInfo &coder = _coders[coderIndex];
- if (!coder.Coder)
- return E_NOTIMPL;
- coder.Coder.QueryInterface(IID_ISequentialOutStream, &seqOutStream);
- if (!seqOutStream)
- return E_NOTIMPL;
-
- UInt32 startIndex = _bindInfo.GetCoderOutStreamIndex(coderIndex);
-
- CMyComPtr<ICompressSetOutStream> setOutStream;
- if (!coder.Coder)
- return E_NOTIMPL;
- coder.Coder.QueryInterface(IID_ICompressSetOutStream, &setOutStream);
- if (!setOutStream)
- return E_NOTIMPL;
-
- if (coder.NumOutStreams > 1)
- return E_NOTIMPL;
- for (i = 0; i < (int)coder.NumOutStreams; i++)
- {
- CMyComPtr<ISequentialOutStream> seqOutStream2;
- RINOK(GetOutStream(outStreams, outSizes, startIndex + i, &seqOutStream2));
- RINOK(setOutStream->SetOutStream(seqOutStream2));
- }
- *outStreamRes = seqOutStream.Detach();
- return S_OK;
-}
-
-
-STDMETHODIMP CCoderMixer2ST::Code(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress)
-{
- if (numInStreams != (UInt32)_bindInfo.InStreams.Size() ||
- numOutStreams != (UInt32)_bindInfo.OutStreams.Size())
- return E_INVALIDARG;
-
- // Find main coder
- int _mainCoderIndex = -1;
- int i;
- for (i = 0; i < _coders.Size(); i++)
- if (_coders[i].IsMain)
- {
- _mainCoderIndex = i;
- break;
- }
- if (_mainCoderIndex < 0)
- for (i = 0; i < _coders.Size(); i++)
- if (_coders[i].NumInStreams > 1)
- {
- if (_mainCoderIndex >= 0)
- return E_NOTIMPL;
- _mainCoderIndex = i;
- }
- if (_mainCoderIndex < 0)
- _mainCoderIndex = 0;
-
- // _mainCoderIndex = 0;
- // _mainCoderIndex = _coders.Size() - 1;
- CCoderInfo &mainCoder = _coders[_mainCoderIndex];
-
- CObjectVector< CMyComPtr<ISequentialInStream> > seqInStreams;
- CObjectVector< CMyComPtr<ISequentialOutStream> > seqOutStreams;
- UInt32 startInIndex = _bindInfo.GetCoderInStreamIndex(_mainCoderIndex);
- UInt32 startOutIndex = _bindInfo.GetCoderOutStreamIndex(_mainCoderIndex);
- for (i = 0; i < (int)mainCoder.NumInStreams; i++)
- {
- CMyComPtr<ISequentialInStream> seqInStream;
- RINOK(GetInStream(inStreams, inSizes, startInIndex + i, &seqInStream));
- seqInStreams.Add(seqInStream);
- }
- for (i = 0; i < (int)mainCoder.NumOutStreams; i++)
- {
- CMyComPtr<ISequentialOutStream> seqOutStream;
- RINOK(GetOutStream(outStreams, outSizes, startOutIndex + i, &seqOutStream));
- seqOutStreams.Add(seqOutStream);
- }
- CRecordVector< ISequentialInStream * > seqInStreamsSpec;
- CRecordVector< ISequentialOutStream * > seqOutStreamsSpec;
- for (i = 0; i < (int)mainCoder.NumInStreams; i++)
- seqInStreamsSpec.Add(seqInStreams[i]);
- for (i = 0; i < (int)mainCoder.NumOutStreams; i++)
- seqOutStreamsSpec.Add(seqOutStreams[i]);
-
- for (i = 0; i < _coders.Size(); i++)
- {
- if (i == _mainCoderIndex)
- continue;
- CCoderInfo &coder = _coders[i];
- CMyComPtr<ICompressSetOutStreamSize> setOutStreamSize;
- coder.Coder.QueryInterface(IID_ICompressSetOutStreamSize, &setOutStreamSize);
- if (setOutStreamSize)
- {
- RINOK(setOutStreamSize->SetOutStreamSize(coder.OutSizePointers[0]));
- }
- }
- if (mainCoder.Coder)
- {
- RINOK(mainCoder.Coder->Code(
- seqInStreamsSpec[0], seqOutStreamsSpec[0],
- mainCoder.InSizePointers[0], mainCoder.OutSizePointers[0],
- progress));
- }
- else
- {
- RINOK(mainCoder.Coder2->Code(
- &seqInStreamsSpec.Front(),
- &mainCoder.InSizePointers.Front(), mainCoder.NumInStreams,
- &seqOutStreamsSpec.Front(),
- &mainCoder.OutSizePointers.Front(), mainCoder.NumOutStreams,
- progress));
- }
- CMyComPtr<IOutStreamFlush> flush;
- seqOutStreams.Front().QueryInterface(IID_IOutStreamFlush, &flush);
- if (flush)
- return flush->Flush();
- return S_OK;
-}
-
-/*
-UInt64 CCoderMixer2ST::GetWriteProcessedSize(UInt32 binderIndex) const
-{
- return _streamBinders[binderIndex].ProcessedSize;
-}
-*/
-
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2ST.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2ST.h
deleted file mode 100644
index a4ea7e80d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CoderMixer2ST.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// CoderMixer2ST.h
-
-#ifndef __CODER_MIXER2_ST_H
-#define __CODER_MIXER2_ST_H
-
-#include "CoderMixer2.h"
-#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
-
-namespace NCoderMixer2 {
-
-// SetBindInfo()
-// for each coder
-// {
-// AddCoder[2]()
-// }
-//
-// for each file
-// {
-// ReInit()
-// for each coder
-// {
-// SetCoderInfo
-// }
-// SetProgressIndex(UInt32 coderIndex);
-// Code
-// }
-
-struct CSTCoderInfo: public CCoderInfo
-{
- bool IsMain;
- CSTCoderInfo(UInt32 numInStreams, UInt32 numOutStreams, bool isMain):
- CCoderInfo(numInStreams, numOutStreams),IsMain(isMain) {}
-};
-
-class CCoderMixer2ST:
- public ICompressCoder2,
- public CCoderMixer2,
- public CMyUnknownImp
-{
- MY_UNKNOWN_IMP
-
- HRESULT GetInStream(
- ISequentialInStream **inStreams, const UInt64 **inSizes,
- UInt32 streamIndex, ISequentialInStream **inStreamRes);
- HRESULT GetOutStream(
- ISequentialOutStream **outStreams, const UInt64 **outSizes,
- UInt32 streamIndex, ISequentialOutStream **outStreamRes);
-public:
- STDMETHOD(Code)(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress);
-
- CCoderMixer2ST();
- ~CCoderMixer2ST();
- void AddCoderCommon(bool isMain);
- void AddCoder(ICompressCoder *coder, bool isMain);
- void AddCoder2(ICompressCoder2 *coder, bool isMain);
-
- void ReInit();
- void SetCoderInfo(UInt32 coderIndex, const UInt64 **inSizes, const UInt64 **outSizes)
- {
- { _coders[coderIndex].SetCoderInfo(inSizes, outSizes); }
- }
-
- void SetProgressCoderIndex(UInt32 /*coderIndex*/)
- {
- // _progressCoderIndex = coderIndex;
- }
-
- // UInt64 GetWriteProcessedSize(UInt32 binderIndex) const;
-
-private:
- CBindInfo _bindInfo;
- CObjectVector<CSTCoderInfo> _coders;
- int _mainCoderIndex;
-public:
- HRESULT SetBindInfo(const CBindInfo &bindInfo);
-
-};
-
-}
-#endif
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CrossThreadProgress.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CrossThreadProgress.cpp
deleted file mode 100644
index a974b54c7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CrossThreadProgress.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-// CrossThreadProgress.cpp
-
-#include "StdAfx.h"
-
-#include "CrossThreadProgress.h"
-
-STDMETHODIMP CCrossThreadProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
- InSize = inSize;
- OutSize = outSize;
- ProgressEvent.Set();
- WaitEvent.Lock();
- return Result;
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CrossThreadProgress.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CrossThreadProgress.h
deleted file mode 100644
index 7e0b10538..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/CrossThreadProgress.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// CrossThreadProgress.h
-
-#ifndef __CROSSTHREADPROGRESS_H
-#define __CROSSTHREADPROGRESS_H
-
-#include "../../ICoder.h"
-#include "../../../Windows/Synchronization.h"
-#include "../../../Common/MyCom.h"
-
-class CCrossThreadProgress:
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
-public:
- const UInt64 *InSize;
- const UInt64 *OutSize;
- HRESULT Result;
- NWindows::NSynchronization::CAutoResetEvent ProgressEvent;
- NWindows::NSynchronization::CAutoResetEvent WaitEvent;
-
- HRes Create()
- {
- RINOK(ProgressEvent.CreateIfNotCreated());
- return WaitEvent.CreateIfNotCreated();
- }
- void Init()
- {
- ProgressEvent.Reset();
- WaitEvent.Reset();
- }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/DummyOutStream.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/DummyOutStream.cpp
deleted file mode 100644
index 54bcfec11..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/DummyOutStream.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// DummyOutStream.cpp
-
-#include "StdAfx.h"
-
-#include "DummyOutStream.h"
-
-STDMETHODIMP CDummyOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize;
- HRESULT result;
- if(!_stream)
- {
- realProcessedSize = size;
- result = S_OK;
- }
- else
- result = _stream->Write(data, size, &realProcessedSize);
- _size += realProcessedSize;
- if(processedSize != NULL)
- *processedSize = realProcessedSize;
- return result;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/DummyOutStream.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/DummyOutStream.h
deleted file mode 100644
index 13d5b62ca..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/DummyOutStream.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// DummyOutStream.h
-
-#ifndef __DUMMYOUTSTREAM_H
-#define __DUMMYOUTSTREAM_H
-
-#include "../../IStream.h"
-#include "Common/MyCom.h"
-
-class CDummyOutStream:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialOutStream> _stream;
- UInt64 _size;
-public:
- void SetStream(ISequentialOutStream *outStream) { _stream = outStream; }
- void ReleaseStream() { _stream.Release(); }
- void Init() { _size = 0; }
- MY_UNKNOWN_IMP
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- UInt64 GetSize() const { return _size; }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/FindSignature.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/FindSignature.cpp
deleted file mode 100644
index 15aa6ceae..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/FindSignature.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-// FindSignature.cpp
-
-#include "StdAfx.h"
-
-#include "Common/Buffer.h"
-
-#include "FindSignature.h"
-
-#include "../../Common/StreamUtils.h"
-
-HRESULT FindSignatureInStream(ISequentialInStream *stream,
- const Byte *signature, unsigned signatureSize,
- const UInt64 *limit, UInt64 &resPos)
-{
- resPos = 0;
- CByteBuffer byteBuffer2;
- byteBuffer2.SetCapacity(signatureSize);
- RINOK(ReadStream_FALSE(stream, byteBuffer2, signatureSize));
-
- if (memcmp(byteBuffer2, signature, signatureSize) == 0)
- return S_OK;
-
- const UInt32 kBufferSize = (1 << 16);
- CByteBuffer byteBuffer;
- byteBuffer.SetCapacity(kBufferSize);
- Byte *buffer = byteBuffer;
- UInt32 numPrevBytes = signatureSize - 1;
- memcpy(buffer, (const Byte *)byteBuffer2 + 1, numPrevBytes);
- resPos = 1;
- for (;;)
- {
- if (limit != NULL)
- if (resPos > *limit)
- return S_FALSE;
- do
- {
- UInt32 numReadBytes = kBufferSize - numPrevBytes;
- UInt32 processedSize;
- RINOK(stream->Read(buffer + numPrevBytes, numReadBytes, &processedSize));
- numPrevBytes += processedSize;
- if (processedSize == 0)
- return S_FALSE;
- }
- while (numPrevBytes < signatureSize);
- UInt32 numTests = numPrevBytes - signatureSize + 1;
- for (UInt32 pos = 0; pos < numTests; pos++)
- {
- Byte b = signature[0];
- for (; buffer[pos] != b && pos < numTests; pos++);
- if (pos == numTests)
- break;
- if (memcmp(buffer + pos, signature, signatureSize) == 0)
- {
- resPos += pos;
- return S_OK;
- }
- }
- resPos += numTests;
- numPrevBytes -= numTests;
- memmove(buffer, buffer + numTests, numPrevBytes);
- }
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/FindSignature.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/FindSignature.h
deleted file mode 100644
index e15af5732..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/FindSignature.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// FindSignature.h
-
-#ifndef __FINDSIGNATURE_H
-#define __FINDSIGNATURE_H
-
-#include "../../IStream.h"
-
-HRESULT FindSignatureInStream(ISequentialInStream *stream,
- const Byte *signature, unsigned signatureSize,
- const UInt64 *limit, UInt64 &resPos);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/HandlerOut.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/HandlerOut.cpp
deleted file mode 100644
index 1af239b51..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/HandlerOut.cpp
+++ /dev/null
@@ -1,623 +0,0 @@
-// HandlerOut.cpp
-
-#include "StdAfx.h"
-
-#include "../../../Common/StringToInt.h"
-
-#include "../../../Windows/PropVariant.h"
-
-#ifdef COMPRESS_MT
-#include "../../../Windows/System.h"
-#endif
-
-#include "../../ICoder.h"
-
-#include "../Common/ParseProperties.h"
-
-#include "HandlerOut.h"
-
-using namespace NWindows;
-
-namespace NArchive {
-
-//static const wchar_t *kCopyMethod = L"Copy";
-static const wchar_t *kLZMAMethodName = L"LZMA";
-static const wchar_t *kLZMA2MethodName = L"LZMA2";
-static const wchar_t *kBZip2MethodName = L"BZip2";
-static const wchar_t *kPpmdMethodName = L"PPMd";
-static const wchar_t *kDeflateMethodName = L"Deflate";
-static const wchar_t *kDeflate64MethodName = L"Deflate64";
-
-static const wchar_t *kLzmaMatchFinderX1 = L"HC4";
-static const wchar_t *kLzmaMatchFinderX5 = L"BT4";
-
-static const UInt32 kLzmaAlgoX1 = 0;
-static const UInt32 kLzmaAlgoX5 = 1;
-
-static const UInt32 kLzmaDicSizeX1 = 1 << 16;
-static const UInt32 kLzmaDicSizeX3 = 1 << 20;
-static const UInt32 kLzmaDicSizeX5 = 1 << 24;
-static const UInt32 kLzmaDicSizeX7 = 1 << 25;
-static const UInt32 kLzmaDicSizeX9 = 1 << 26;
-
-static const UInt32 kLzmaFastBytesX1 = 32;
-static const UInt32 kLzmaFastBytesX7 = 64;
-
-static const UInt32 kPpmdMemSizeX1 = (1 << 22);
-static const UInt32 kPpmdMemSizeX5 = (1 << 24);
-static const UInt32 kPpmdMemSizeX7 = (1 << 26);
-static const UInt32 kPpmdMemSizeX9 = (192 << 20);
-
-static const UInt32 kPpmdOrderX1 = 4;
-static const UInt32 kPpmdOrderX5 = 6;
-static const UInt32 kPpmdOrderX7 = 16;
-static const UInt32 kPpmdOrderX9 = 32;
-
-static const UInt32 kDeflateAlgoX1 = 0;
-static const UInt32 kDeflateAlgoX5 = 1;
-
-static const UInt32 kDeflateFastBytesX1 = 32;
-static const UInt32 kDeflateFastBytesX7 = 64;
-static const UInt32 kDeflateFastBytesX9 = 128;
-
-static const UInt32 kDeflatePassesX1 = 1;
-static const UInt32 kDeflatePassesX7 = 3;
-static const UInt32 kDeflatePassesX9 = 10;
-
-static const UInt32 kBZip2NumPassesX1 = 1;
-static const UInt32 kBZip2NumPassesX7 = 2;
-static const UInt32 kBZip2NumPassesX9 = 7;
-
-static const UInt32 kBZip2DicSizeX1 = 100000;
-static const UInt32 kBZip2DicSizeX3 = 500000;
-static const UInt32 kBZip2DicSizeX5 = 900000;
-
-static const wchar_t *kDefaultMethodName = kLZMAMethodName;
-
-//static const wchar_t *kLzmaMatchFinderForHeaders = L"BT2";
-static const UInt32 kDictionaryForHeaders = 1 << 20;
-static const UInt32 kNumFastBytesForHeaders = 273;
-static const UInt32 kAlgorithmForHeaders = kLzmaAlgoX5;
-
-static bool AreEqual(const UString &methodName, const wchar_t *s)
- { return (methodName.CompareNoCase(s) == 0); }
-
-bool COneMethodInfo::IsLzma() const
-{
- return
- AreEqual(MethodName, kLZMAMethodName) ||
- AreEqual(MethodName, kLZMA2MethodName);
-}
-
-static inline bool IsBZip2Method(const UString &methodName)
- { return AreEqual(methodName, kBZip2MethodName); }
-
-static inline bool IsPpmdMethod(const UString &methodName)
- { return AreEqual(methodName, kPpmdMethodName); }
-
-static inline bool IsDeflateMethod(const UString &methodName)
-{
- return
- AreEqual(methodName, kDeflateMethodName) ||
- AreEqual(methodName, kDeflate64MethodName);
-}
-
-struct CNameToPropID
-{
- PROPID PropID;
- VARTYPE VarType;
- const wchar_t *Name;
-};
-
-static CNameToPropID g_NameToPropID[] =
-{
- { NCoderPropID::kBlockSize, VT_UI4, L"C" },
- { NCoderPropID::kDictionarySize, VT_UI4, L"D" },
- { NCoderPropID::kUsedMemorySize, VT_UI4, L"MEM" },
-
- { NCoderPropID::kOrder, VT_UI4, L"O" },
- { NCoderPropID::kPosStateBits, VT_UI4, L"PB" },
- { NCoderPropID::kLitContextBits, VT_UI4, L"LC" },
- { NCoderPropID::kLitPosBits, VT_UI4, L"LP" },
- { NCoderPropID::kEndMarker, VT_BOOL, L"eos" },
-
- { NCoderPropID::kNumPasses, VT_UI4, L"Pass" },
- { NCoderPropID::kNumFastBytes, VT_UI4, L"fb" },
- { NCoderPropID::kMatchFinderCycles, VT_UI4, L"mc" },
- { NCoderPropID::kAlgorithm, VT_UI4, L"a" },
- { NCoderPropID::kMatchFinder, VT_BSTR, L"mf" },
- { NCoderPropID::kNumThreads, VT_UI4, L"mt" },
- { NCoderPropID::kDefaultProp, VT_UI4, L"" }
-};
-
-static bool ConvertProperty(PROPVARIANT srcProp, VARTYPE varType, NCOM::CPropVariant &destProp)
-{
- if (varType == srcProp.vt)
- {
- destProp = srcProp;
- return true;
- }
- if (varType == VT_UI1)
- {
- if (srcProp.vt == VT_UI4)
- {
- UInt32 value = srcProp.ulVal;
- if (value > 0xFF)
- return false;
- destProp = (Byte)value;
- return true;
- }
- }
- else if (varType == VT_BOOL)
- {
- bool res;
- if (SetBoolProperty(res, srcProp) != S_OK)
- return false;
- destProp = res;
- return true;
- }
- return false;
-}
-
-static int FindPropIdExact(const UString &name)
-{
- for (unsigned int i = 0; i < sizeof(g_NameToPropID) / sizeof(g_NameToPropID[0]); i++)
- if (name.CompareNoCase(g_NameToPropID[i].Name) == 0)
- return i;
- return -1;
-}
-
-static int FindPropIdStart(const UString &name)
-{
- for (unsigned int i = 0; i < sizeof(g_NameToPropID) / sizeof(g_NameToPropID[0]); i++)
- {
- UString t = g_NameToPropID[i].Name;
- if (t.CompareNoCase(name.Left(t.Length())) == 0)
- return i;
- }
- return -1;
-}
-
-static void SetMethodProp(COneMethodInfo &m, PROPID propID, const NCOM::CPropVariant &value)
-{
- for (int j = 0; j < m.Props.Size(); j++)
- if (m.Props[j].Id == propID)
- return;
- CProp prop;
- prop.Id = propID;
- prop.Value = value;
- m.Props.Add(prop);
-}
-
-void COutHandler::SetCompressionMethod2(COneMethodInfo &oneMethodInfo
- #ifdef COMPRESS_MT
- , UInt32 numThreads
- #endif
- )
-{
- UInt32 level = _level;
- if (oneMethodInfo.MethodName.IsEmpty())
- oneMethodInfo.MethodName = kDefaultMethodName;
-
- if (oneMethodInfo.IsLzma())
- {
- UInt32 dicSize =
- (level >= 9 ? kLzmaDicSizeX9 :
- (level >= 7 ? kLzmaDicSizeX7 :
- (level >= 5 ? kLzmaDicSizeX5 :
- (level >= 3 ? kLzmaDicSizeX3 :
- kLzmaDicSizeX1))));
-
- UInt32 algo =
- (level >= 5 ? kLzmaAlgoX5 :
- kLzmaAlgoX1);
-
- UInt32 fastBytes =
- (level >= 7 ? kLzmaFastBytesX7 :
- kLzmaFastBytesX1);
-
- const wchar_t *matchFinder =
- (level >= 5 ? kLzmaMatchFinderX5 :
- kLzmaMatchFinderX1);
-
- SetMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize);
- SetMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algo);
- SetMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, fastBytes);
- SetMethodProp(oneMethodInfo, NCoderPropID::kMatchFinder, matchFinder);
- #ifdef COMPRESS_MT
- SetMethodProp(oneMethodInfo, NCoderPropID::kNumThreads, numThreads);
- #endif
- }
- else if (IsDeflateMethod(oneMethodInfo.MethodName))
- {
- UInt32 fastBytes =
- (level >= 9 ? kDeflateFastBytesX9 :
- (level >= 7 ? kDeflateFastBytesX7 :
- kDeflateFastBytesX1));
-
- UInt32 numPasses =
- (level >= 9 ? kDeflatePassesX9 :
- (level >= 7 ? kDeflatePassesX7 :
- kDeflatePassesX1));
-
- UInt32 algo =
- (level >= 5 ? kDeflateAlgoX5 :
- kDeflateAlgoX1);
-
- SetMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algo);
- SetMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, fastBytes);
- SetMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, numPasses);
- }
- else if (IsBZip2Method(oneMethodInfo.MethodName))
- {
- UInt32 numPasses =
- (level >= 9 ? kBZip2NumPassesX9 :
- (level >= 7 ? kBZip2NumPassesX7 :
- kBZip2NumPassesX1));
-
- UInt32 dicSize =
- (level >= 5 ? kBZip2DicSizeX5 :
- (level >= 3 ? kBZip2DicSizeX3 :
- kBZip2DicSizeX1));
-
- SetMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, numPasses);
- SetMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize);
- #ifdef COMPRESS_MT
- SetMethodProp(oneMethodInfo, NCoderPropID::kNumThreads, numThreads);
- #endif
- }
- else if (IsPpmdMethod(oneMethodInfo.MethodName))
- {
- UInt32 useMemSize =
- (level >= 9 ? kPpmdMemSizeX9 :
- (level >= 7 ? kPpmdMemSizeX7 :
- (level >= 5 ? kPpmdMemSizeX5 :
- kPpmdMemSizeX1)));
-
- UInt32 order =
- (level >= 9 ? kPpmdOrderX9 :
- (level >= 7 ? kPpmdOrderX7 :
- (level >= 5 ? kPpmdOrderX5 :
- kPpmdOrderX1)));
-
- SetMethodProp(oneMethodInfo, NCoderPropID::kUsedMemorySize, useMemSize);
- SetMethodProp(oneMethodInfo, NCoderPropID::kOrder, order);
- }
-}
-
-static void SplitParams(const UString &srcString, UStringVector &subStrings)
-{
- subStrings.Clear();
- UString name;
- int len = srcString.Length();
- if (len == 0)
- return;
- for (int i = 0; i < len; i++)
- {
- wchar_t c = srcString[i];
- if (c == L':')
- {
- subStrings.Add(name);
- name.Empty();
- }
- else
- name += c;
- }
- subStrings.Add(name);
-}
-
-static void SplitParam(const UString &param, UString &name, UString &value)
-{
- int eqPos = param.Find(L'=');
- if (eqPos >= 0)
- {
- name = param.Left(eqPos);
- value = param.Mid(eqPos + 1);
- return;
- }
- for(int i = 0; i < param.Length(); i++)
- {
- wchar_t c = param[i];
- if (c >= L'0' && c <= L'9')
- {
- name = param.Left(i);
- value = param.Mid(i);
- return;
- }
- }
- name = param;
-}
-
-HRESULT COutHandler::SetParam(COneMethodInfo &oneMethodInfo, const UString &name, const UString &value)
-{
- CProp prop;
- int index = FindPropIdExact(name);
- if (index < 0)
- return E_INVALIDARG;
- const CNameToPropID &nameToPropID = g_NameToPropID[index];
- prop.Id = nameToPropID.PropID;
-
- if (prop.Id == NCoderPropID::kBlockSize ||
- prop.Id == NCoderPropID::kDictionarySize ||
- prop.Id == NCoderPropID::kUsedMemorySize)
- {
- UInt32 dicSize;
- RINOK(ParsePropDictionaryValue(value, dicSize));
- prop.Value = dicSize;
- }
- else
- {
- NCOM::CPropVariant propValue;
-
- if (nameToPropID.VarType == VT_BSTR)
- propValue = value;
- else if (nameToPropID.VarType == VT_BOOL)
- {
- bool res;
- if (!StringToBool(value, res))
- return E_INVALIDARG;
- propValue = res;
- }
- else
- {
- UInt32 number;
- if (ParseStringToUInt32(value, number) == value.Length())
- propValue = number;
- else
- propValue = value;
- }
-
- if (!ConvertProperty(propValue, nameToPropID.VarType, prop.Value))
- return E_INVALIDARG;
- }
- oneMethodInfo.Props.Add(prop);
- return S_OK;
-}
-
-HRESULT COutHandler::SetParams(COneMethodInfo &oneMethodInfo, const UString &srcString)
-{
- UStringVector params;
- SplitParams(srcString, params);
- if (params.Size() > 0)
- oneMethodInfo.MethodName = params[0];
- for (int i = 1; i < params.Size(); i++)
- {
- const UString &param = params[i];
- UString name, value;
- SplitParam(param, name, value);
- RINOK(SetParam(oneMethodInfo, name, value));
- }
- return S_OK;
-}
-
-HRESULT COutHandler::SetSolidSettings(const UString &s)
-{
- UString s2 = s;
- s2.MakeUpper();
- for (int i = 0; i < s2.Length();)
- {
- const wchar_t *start = ((const wchar_t *)s2) + i;
- const wchar_t *end;
- UInt64 v = ConvertStringToUInt64(start, &end);
- if (start == end)
- {
- if (s2[i++] != 'E')
- return E_INVALIDARG;
- _solidExtension = true;
- continue;
- }
- i += (int)(end - start);
- if (i == s2.Length())
- return E_INVALIDARG;
- wchar_t c = s2[i++];
- switch(c)
- {
- case 'F':
- if (v < 1)
- v = 1;
- _numSolidFiles = v;
- break;
- case 'B':
- _numSolidBytes = v;
- _numSolidBytesDefined = true;
- break;
- case 'K':
- _numSolidBytes = (v << 10);
- _numSolidBytesDefined = true;
- break;
- case 'M':
- _numSolidBytes = (v << 20);
- _numSolidBytesDefined = true;
- break;
- case 'G':
- _numSolidBytes = (v << 30);
- _numSolidBytesDefined = true;
- break;
- default:
- return E_INVALIDARG;
- }
- }
- return S_OK;
-}
-
-HRESULT COutHandler::SetSolidSettings(const PROPVARIANT &value)
-{
- bool isSolid;
- switch(value.vt)
- {
- case VT_EMPTY:
- isSolid = true;
- break;
- case VT_BOOL:
- isSolid = (value.boolVal != VARIANT_FALSE);
- break;
- case VT_BSTR:
- if (StringToBool(value.bstrVal, isSolid))
- break;
- return SetSolidSettings(value.bstrVal);
- default:
- return E_INVALIDARG;
- }
- if (isSolid)
- InitSolid();
- else
- _numSolidFiles = 1;
- return S_OK;
-}
-
-void COutHandler::Init()
-{
- _removeSfxBlock = false;
- _compressHeaders = true;
- _encryptHeadersSpecified = false;
- _encryptHeaders = false;
-
- WriteCTime = false;
- WriteATime = false;
- WriteMTime = true;
-
- #ifdef COMPRESS_MT
- _numThreads = NSystem::GetNumberOfProcessors();
- #endif
-
- _level = 5;
- _autoFilter = true;
- _volumeMode = false;
- _crcSize = 4;
- InitSolid();
-}
-
-void COutHandler::BeforeSetProperty()
-{
- Init();
- #ifdef COMPRESS_MT
- numProcessors = NSystem::GetNumberOfProcessors();
- #endif
-
- mainDicSize = 0xFFFFFFFF;
- mainDicMethodIndex = 0xFFFFFFFF;
- minNumber = 0;
- _crcSize = 4;
-}
-
-HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &value)
-{
- UString name = nameSpec;
- name.MakeUpper();
- if (name.IsEmpty())
- return E_INVALIDARG;
-
- if (name[0] == 'X')
- {
- name.Delete(0);
- _level = 9;
- return ParsePropValue(name, value, _level);
- }
-
- if (name[0] == L'S')
- {
- name.Delete(0);
- if (name.IsEmpty())
- return SetSolidSettings(value);
- if (value.vt != VT_EMPTY)
- return E_INVALIDARG;
- return SetSolidSettings(name);
- }
-
- if (name == L"CRC")
- {
- _crcSize = 4;
- name.Delete(0, 3);
- return ParsePropValue(name, value, _crcSize);
- }
-
- UInt32 number;
- int index = ParseStringToUInt32(name, number);
- UString realName = name.Mid(index);
- if (index == 0)
- {
- if(name.Left(2).CompareNoCase(L"MT") == 0)
- {
- #ifdef COMPRESS_MT
- RINOK(ParseMtProp(name.Mid(2), value, numProcessors, _numThreads));
- #endif
- return S_OK;
- }
- if (name.CompareNoCase(L"RSFX") == 0) return SetBoolProperty(_removeSfxBlock, value);
- if (name.CompareNoCase(L"F") == 0) return SetBoolProperty(_autoFilter, value);
- if (name.CompareNoCase(L"HC") == 0) return SetBoolProperty(_compressHeaders, value);
- if (name.CompareNoCase(L"HCF") == 0)
- {
- bool compressHeadersFull = true;
- RINOK(SetBoolProperty(compressHeadersFull, value));
- if (!compressHeadersFull)
- return E_INVALIDARG;
- return S_OK;
- }
- if (name.CompareNoCase(L"HE") == 0)
- {
- RINOK(SetBoolProperty(_encryptHeaders, value));
- _encryptHeadersSpecified = true;
- return S_OK;
- }
- if (name.CompareNoCase(L"TC") == 0) return SetBoolProperty(WriteCTime, value);
- if (name.CompareNoCase(L"TA") == 0) return SetBoolProperty(WriteATime, value);
- if (name.CompareNoCase(L"TM") == 0) return SetBoolProperty(WriteMTime, value);
- if (name.CompareNoCase(L"V") == 0) return SetBoolProperty(_volumeMode, value);
- number = 0;
- }
- if (number > 10000)
- return E_FAIL;
- if (number < minNumber)
- return E_INVALIDARG;
- number -= minNumber;
- for(int j = _methods.Size(); j <= (int)number; j++)
- {
- COneMethodInfo oneMethodInfo;
- _methods.Add(oneMethodInfo);
- }
-
- COneMethodInfo &oneMethodInfo = _methods[number];
-
- if (realName.Length() == 0)
- {
- if (value.vt != VT_BSTR)
- return E_INVALIDARG;
-
- RINOK(SetParams(oneMethodInfo, value.bstrVal));
- }
- else
- {
- int index = FindPropIdStart(realName);
- if (index < 0)
- return E_INVALIDARG;
- const CNameToPropID &nameToPropID = g_NameToPropID[index];
- CProp prop;
- prop.Id = nameToPropID.PropID;
-
- if (prop.Id == NCoderPropID::kBlockSize ||
- prop.Id == NCoderPropID::kDictionarySize ||
- prop.Id == NCoderPropID::kUsedMemorySize)
- {
- UInt32 dicSize;
- RINOK(ParsePropDictionaryValue(realName.Mid(MyStringLen(nameToPropID.Name)), value, dicSize));
- prop.Value = dicSize;
- if (number <= mainDicMethodIndex)
- mainDicSize = dicSize;
- }
- else
- {
- int index = FindPropIdExact(realName);
- if (index < 0)
- return E_INVALIDARG;
- const CNameToPropID &nameToPropID = g_NameToPropID[index];
- prop.Id = nameToPropID.PropID;
- if (!ConvertProperty(value, nameToPropID.VarType, prop.Value))
- return E_INVALIDARG;
- }
- oneMethodInfo.Props.Add(prop);
- }
- return S_OK;
-}
-
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/HandlerOut.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/HandlerOut.h
deleted file mode 100644
index 7ba22b242..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/HandlerOut.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// HandlerOut.h
-
-#ifndef __HANDLER_OUT_H
-#define __HANDLER_OUT_H
-
-#include "../../../Common/MyString.h"
-#include "../../Common/MethodProps.h"
-
-namespace NArchive {
-
-struct COneMethodInfo
-{
- CObjectVector<CProp> Props;
- UString MethodName;
-
- bool IsLzma() const;
-};
-
-class COutHandler
-{
-public:
- HRESULT SetProperty(const wchar_t *name, const PROPVARIANT &value);
-
- HRESULT SetSolidSettings(const UString &s);
- HRESULT SetSolidSettings(const PROPVARIANT &value);
-
- #ifdef COMPRESS_MT
- UInt32 _numThreads;
- #endif
-
- UInt32 _crcSize;
-
- CObjectVector<COneMethodInfo> _methods;
- bool _removeSfxBlock;
-
- UInt64 _numSolidFiles;
- UInt64 _numSolidBytes;
- bool _numSolidBytesDefined;
- bool _solidExtension;
-
- bool _compressHeaders;
- bool _encryptHeadersSpecified;
- bool _encryptHeaders;
-
- bool WriteCTime;
- bool WriteATime;
- bool WriteMTime;
-
- bool _autoFilter;
- UInt32 _level;
-
- bool _volumeMode;
-
- HRESULT SetParam(COneMethodInfo &oneMethodInfo, const UString &name, const UString &value);
- HRESULT SetParams(COneMethodInfo &oneMethodInfo, const UString &srcString);
-
- void SetCompressionMethod2(COneMethodInfo &oneMethodInfo
- #ifdef COMPRESS_MT
- , UInt32 numThreads
- #endif
- );
-
- void InitSolidFiles() { _numSolidFiles = (UInt64)(Int64)(-1); }
- void InitSolidSize() { _numSolidBytes = (UInt64)(Int64)(-1); }
- void InitSolid()
- {
- InitSolidFiles();
- InitSolidSize();
- _solidExtension = false;
- _numSolidBytesDefined = false;
- }
-
- void Init();
-
- COutHandler() { Init(); }
-
- void BeforeSetProperty();
-
- UInt32 minNumber;
- UInt32 numProcessors;
- UInt32 mainDicSize;
- UInt32 mainDicMethodIndex;
-};
-
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/InStreamWithCRC.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/InStreamWithCRC.cpp
deleted file mode 100644
index 1d9e55562..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/InStreamWithCRC.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// InStreamWithCRC.cpp
-
-#include "StdAfx.h"
-
-#include "InStreamWithCRC.h"
-
-STDMETHODIMP CSequentialInStreamWithCRC::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize;
- HRESULT result = _stream->Read(data, size, &realProcessedSize);
- _size += realProcessedSize;
- if (size > 0 && realProcessedSize == 0)
- _wasFinished = true;
- _crc = CrcUpdate(_crc, data, realProcessedSize);
- if(processedSize != NULL)
- *processedSize = realProcessedSize;
- return result;
-}
-
-STDMETHODIMP CInStreamWithCRC::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize;
- HRESULT result = _stream->Read(data, size, &realProcessedSize);
- if (size > 0 && realProcessedSize == 0)
- _wasFinished = true;
- _size += realProcessedSize;
- _crc = CrcUpdate(_crc, data, realProcessedSize);
- if(processedSize != NULL)
- *processedSize = realProcessedSize;
- return result;
-}
-
-STDMETHODIMP CInStreamWithCRC::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
- if (seekOrigin != STREAM_SEEK_SET || offset != 0)
- return E_FAIL;
- _size = 0;
- _crc = CRC_INIT_VAL;
- return _stream->Seek(offset, seekOrigin, newPosition);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/InStreamWithCRC.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/InStreamWithCRC.h
deleted file mode 100644
index 0492a5f8a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/InStreamWithCRC.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// InStreamWithCRC.h
-
-#ifndef __IN_STREAM_WITH_CRC_H
-#define __IN_STREAM_WITH_CRC_H
-
-#include "../../../../C/7zCrc.h"
-
-#include "../../../Common/MyCom.h"
-
-#include "../../IStream.h"
-
-class CSequentialInStreamWithCRC:
- public ISequentialInStream,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-private:
- CMyComPtr<ISequentialInStream> _stream;
- UInt64 _size;
- UInt32 _crc;
- bool _wasFinished;
-public:
- void SetStream(ISequentialInStream *stream) { _stream = stream; }
- void Init()
- {
- _size = 0;
- _wasFinished = false;
- _crc = CRC_INIT_VAL;
- }
- void ReleaseStream() { _stream.Release(); }
- UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); }
- UInt64 GetSize() const { return _size; }
- bool WasFinished() const { return _wasFinished; }
-};
-
-class CInStreamWithCRC:
- public IInStream,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(IInStream)
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-private:
- CMyComPtr<IInStream> _stream;
- UInt64 _size;
- UInt32 _crc;
- bool _wasFinished;
-public:
- void SetStream(IInStream *stream) { _stream = stream; }
- void Init()
- {
- _size = 0;
- _wasFinished = false;
- _crc = CRC_INIT_VAL;
- }
- void ReleaseStream() { _stream.Release(); }
- UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); }
- UInt64 GetSize() const { return _size; }
- bool WasFinished() const { return _wasFinished; }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ItemNameUtils.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ItemNameUtils.cpp
deleted file mode 100644
index 57d2e4e57..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ItemNameUtils.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// Archive/Common/ItemNameUtils.cpp
-
-#include "StdAfx.h"
-
-#include "ItemNameUtils.h"
-#include "Common/MyWindows.h"
-
-namespace NArchive {
-namespace NItemName {
-
-static const wchar_t kOSDirDelimiter = WCHAR_PATH_SEPARATOR;
-static const wchar_t kDirDelimiter = L'/';
-
-UString MakeLegalName(const UString &name)
-{
- UString zipName = name;
- zipName.Replace(kOSDirDelimiter, kDirDelimiter);
- return zipName;
-}
-
-UString GetOSName(const UString &name)
-{
- UString newName = name;
- newName.Replace(kDirDelimiter, kOSDirDelimiter);
- return newName;
-}
-
-UString GetOSName2(const UString &name)
-{
- if (name.IsEmpty())
- return UString();
- UString newName = GetOSName(name);
- if (newName[newName.Length() - 1] == kOSDirDelimiter)
- newName.Delete(newName.Length() - 1);
- return newName;
-}
-
-bool HasTailSlash(const AString &name, UINT codePage)
-{
- if (name.IsEmpty())
- return false;
- LPCSTR prev =
- #ifdef _WIN32
- CharPrevExA((WORD)codePage, name, &name[name.Length()], 0);
- #else
- (LPCSTR)(name) + (name.Length() - 1);
- (void)codePage;
- #endif
- return (*prev == '/');
-}
-
-#ifndef _WIN32
-UString WinNameToOSName(const UString &name)
-{
- UString newName = name;
- newName.Replace(L'\\', kOSDirDelimiter);
- return newName;
-}
-#endif
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ItemNameUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ItemNameUtils.h
deleted file mode 100644
index 5eafacb12..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ItemNameUtils.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Archive/Common/ItemNameUtils.h
-
-#ifndef __ARCHIVE_ITEMNAMEUTILS_H
-#define __ARCHIVE_ITEMNAMEUTILS_H
-
-#include "../../../Common/MyString.h"
-
-namespace NArchive {
-namespace NItemName {
-
- UString MakeLegalName(const UString &name);
- UString GetOSName(const UString &name);
- UString GetOSName2(const UString &name);
- bool HasTailSlash(const AString &name, UINT codePage);
-
- #ifdef _WIN32
- inline UString WinNameToOSName(const UString &name) { return name; }
- #else
- UString WinNameToOSName(const UString &name);
- #endif
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/MultiStream.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/MultiStream.cpp
deleted file mode 100644
index cf7dc0501..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/MultiStream.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-// MultiStream.cpp
-
-#include "StdAfx.h"
-
-#include "MultiStream.h"
-
-STDMETHODIMP CMultiStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if(processedSize != NULL)
- *processedSize = 0;
- while(_streamIndex < Streams.Size() && size > 0)
- {
- CSubStreamInfo &s = Streams[_streamIndex];
- if (_pos == s.Size)
- {
- _streamIndex++;
- _pos = 0;
- continue;
- }
- RINOK(s.Stream->Seek(s.Pos + _pos, STREAM_SEEK_SET, 0));
- UInt32 sizeToRead = UInt32(MyMin((UInt64)size, s.Size - _pos));
- UInt32 realProcessed;
- HRESULT result = s.Stream->Read(data, sizeToRead, &realProcessed);
- data = (void *)((Byte *)data + realProcessed);
- size -= realProcessed;
- if(processedSize != NULL)
- *processedSize += realProcessed;
- _pos += realProcessed;
- _seekPos += realProcessed;
- RINOK(result);
- break;
- }
- return S_OK;
-}
-
-STDMETHODIMP CMultiStream::Seek(Int64 offset, UInt32 seekOrigin,
- UInt64 *newPosition)
-{
- UInt64 newPos;
- switch(seekOrigin)
- {
- case STREAM_SEEK_SET:
- newPos = offset;
- break;
- case STREAM_SEEK_CUR:
- newPos = _seekPos + offset;
- break;
- case STREAM_SEEK_END:
- newPos = _totalLength + offset;
- break;
- default:
- return STG_E_INVALIDFUNCTION;
- }
- _seekPos = 0;
- for (_streamIndex = 0; _streamIndex < Streams.Size(); _streamIndex++)
- {
- UInt64 size = Streams[_streamIndex].Size;
- if (newPos < _seekPos + size)
- {
- _pos = newPos - _seekPos;
- _seekPos += _pos;
- if (newPosition != 0)
- *newPosition = newPos;
- return S_OK;
- }
- _seekPos += size;
- }
- if (newPos == _seekPos)
- {
- if (newPosition != 0)
- *newPosition = newPos;
- return S_OK;
- }
- return E_FAIL;
-}
-
-
-/*
-class COutVolumeStream:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- int _volIndex;
- UInt64 _volSize;
- UInt64 _curPos;
- CMyComPtr<ISequentialOutStream> _volumeStream;
- COutArchive _archive;
- CCRC _crc;
-
-public:
- MY_UNKNOWN_IMP
-
- CFileItem _file;
- CUpdateOptions _options;
- CMyComPtr<IArchiveUpdateCallback2> VolumeCallback;
- void Init(IArchiveUpdateCallback2 *volumeCallback,
- const UString &name)
- {
- _file.Name = name;
- _file.IsStartPosDefined = true;
- _file.StartPos = 0;
-
- VolumeCallback = volumeCallback;
- _volIndex = 0;
- _volSize = 0;
- }
-
- HRESULT Flush();
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-HRESULT COutVolumeStream::Flush()
-{
- if (_volumeStream)
- {
- _file.UnPackSize = _curPos;
- _file.FileCRC = _crc.GetDigest();
- RINOK(WriteVolumeHeader(_archive, _file, _options));
- _archive.Close();
- _volumeStream.Release();
- _file.StartPos += _file.UnPackSize;
- }
- return S_OK;
-}
-*/
-
-/*
-STDMETHODIMP COutMultiStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- if(processedSize != NULL)
- *processedSize = 0;
- while(size > 0)
- {
- if (_streamIndex >= Streams.Size())
- {
- CSubStreamInfo subStream;
- RINOK(VolumeCallback->GetVolumeSize(Streams.Size(), &subStream.Size));
- RINOK(VolumeCallback->GetVolumeStream(Streams.Size(), &subStream.Stream));
- subStream.Pos = 0;
- Streams.Add(subStream);
- continue;
- }
- CSubStreamInfo &subStream = Streams[_streamIndex];
- if (_offsetPos >= subStream.Size)
- {
- _offsetPos -= subStream.Size;
- _streamIndex++;
- continue;
- }
- if (_offsetPos != subStream.Pos)
- {
- CMyComPtr<IOutStream> outStream;
- RINOK(subStream.Stream.QueryInterface(IID_IOutStream, &outStream));
- RINOK(outStream->Seek(_offsetPos, STREAM_SEEK_SET, NULL));
- subStream.Pos = _offsetPos;
- }
-
- UInt32 curSize = (UInt32)MyMin((UInt64)size, subStream.Size - subStream.Pos);
- UInt32 realProcessed;
- RINOK(subStream.Stream->Write(data, curSize, &realProcessed));
- data = (void *)((Byte *)data + realProcessed);
- size -= realProcessed;
- subStream.Pos += realProcessed;
- _offsetPos += realProcessed;
- _absPos += realProcessed;
- if (_absPos > _length)
- _length = _absPos;
- if(processedSize != NULL)
- *processedSize += realProcessed;
- if (subStream.Pos == subStream.Size)
- {
- _streamIndex++;
- _offsetPos = 0;
- }
- if (realProcessed != curSize && realProcessed == 0)
- return E_FAIL;
- }
- return S_OK;
-}
-
-STDMETHODIMP COutMultiStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
- if(seekOrigin >= 3)
- return STG_E_INVALIDFUNCTION;
- switch(seekOrigin)
- {
- case STREAM_SEEK_SET:
- _absPos = offset;
- break;
- case STREAM_SEEK_CUR:
- _absPos += offset;
- break;
- case STREAM_SEEK_END:
- _absPos = _length + offset;
- break;
- }
- _offsetPos = _absPos;
- _streamIndex = 0;
- return S_OK;
-}
-*/
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/MultiStream.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/MultiStream.h
deleted file mode 100644
index 137c9400d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/MultiStream.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// MultiStream.h
-
-#ifndef __MULTISTREAM_H
-#define __MULTISTREAM_H
-
-#include "../../../Common/MyCom.h"
-#include "../../../Common/MyVector.h"
-#include "../../Archive/IArchive.h"
-
-class CMultiStream:
- public IInStream,
- public CMyUnknownImp
-{
- int _streamIndex;
- UInt64 _pos;
- UInt64 _seekPos;
- UInt64 _totalLength;
-public:
- struct CSubStreamInfo
- {
- CMyComPtr<IInStream> Stream;
- UInt64 Pos;
- UInt64 Size;
- };
- CObjectVector<CSubStreamInfo> Streams;
- void Init()
- {
- _streamIndex = 0;
- _pos = 0;
- _seekPos = 0;
- _totalLength = 0;
- for (int i = 0; i < Streams.Size(); i++)
- _totalLength += Streams[i].Size;
- }
-
- MY_UNKNOWN_IMP1(IInStream)
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-};
-
-/*
-class COutMultiStream:
- public IOutStream,
- public CMyUnknownImp
-{
- int _streamIndex; // required stream
- UInt64 _offsetPos; // offset from start of _streamIndex index
- UInt64 _absPos;
- UInt64 _length;
-
- struct CSubStreamInfo
- {
- CMyComPtr<ISequentialOutStream> Stream;
- UInt64 Size;
- UInt64 Pos;
- };
- CObjectVector<CSubStreamInfo> Streams;
-public:
- CMyComPtr<IArchiveUpdateCallback2> VolumeCallback;
- void Init()
- {
- _streamIndex = 0;
- _offsetPos = 0;
- _absPos = 0;
- _length = 0;
- }
-
- MY_UNKNOWN_IMP1(IOutStream)
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-};
-*/
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp
deleted file mode 100644
index f955c2254..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithCRC.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// OutStreamWithCRC.cpp
-
-#include "StdAfx.h"
-
-#include "OutStreamWithCRC.h"
-
-STDMETHODIMP COutStreamWithCRC::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- HRESULT result = S_OK;
- if (_stream)
- result = _stream->Write(data, size, &size);
- if (_calculate)
- _crc = CrcUpdate(_crc, data, size);
- _size += size;
- if (processedSize != NULL)
- *processedSize = size;
- return result;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithCRC.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithCRC.h
deleted file mode 100644
index 115b442aa..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithCRC.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// OutStreamWithCRC.h
-
-#ifndef __OUT_STREAM_WITH_CRC_H
-#define __OUT_STREAM_WITH_CRC_H
-
-#include "../../../../C/7zCrc.h"
-
-#include "../../../Common/MyCom.h"
-
-#include "../../IStream.h"
-
-class COutStreamWithCRC:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialOutStream> _stream;
- UInt64 _size;
- UInt32 _crc;
- bool _calculate;
-public:
- MY_UNKNOWN_IMP
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- void SetStream(ISequentialOutStream *stream) { _stream = stream; }
- void ReleaseStream() { _stream.Release(); }
- void Init(bool calculate = true)
- {
- _size = 0;
- _calculate = calculate;
- _crc = CRC_INIT_VAL;
- }
- void InitCRC() { _crc = CRC_INIT_VAL; }
- UInt64 GetSize() const { return _size; }
- UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp
deleted file mode 100644
index 0526c1b1d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// OutStreamWithSha1.cpp
-
-#include "StdAfx.h"
-
-#include "OutStreamWithSha1.h"
-
-STDMETHODIMP COutStreamWithSha1::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- HRESULT result = S_OK;
- if (_stream)
- result = _stream->Write(data, size, &size);
- if (_calculate)
- _sha.Update((const Byte *)data, size);
- _size += size;
- if (processedSize != NULL)
- *processedSize = size;
- return result;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithSha1.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithSha1.h
deleted file mode 100644
index 3bbfbbe19..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/OutStreamWithSha1.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// OutStreamWithSha1.h
-
-#ifndef __OUT_STREAM_WITH_SHA1_H
-#define __OUT_STREAM_WITH_SHA1_H
-
-#include "../../Crypto/Sha1.h"
-
-#include "../../../Common/MyCom.h"
-
-#include "../../IStream.h"
-
-class COutStreamWithSha1:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialOutStream> _stream;
- UInt64 _size;
- NCrypto::NSha1::CContext _sha;
- bool _calculate;
-public:
- MY_UNKNOWN_IMP
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- void SetStream(ISequentialOutStream *stream) { _stream = stream; }
- void ReleaseStream() { _stream.Release(); }
- void Init(bool calculate = true)
- {
- _size = 0;
- _calculate = calculate;
- _sha.Init();
- }
- void InitSha1() { _sha.Init(); }
- UInt64 GetSize() const { return _size; }
- void Final(Byte *digest) { _sha.Final(digest); }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ParseProperties.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ParseProperties.cpp
deleted file mode 100644
index 498f4ee5d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ParseProperties.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// ParseProperties.cpp
-
-#include "StdAfx.h"
-
-#include "ParseProperties.h"
-
-#include "Common/StringToInt.h"
-#include "Common/MyCom.h"
-
-HRESULT ParsePropValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue)
-{
- if (prop.vt == VT_UI4)
- {
- if (!name.IsEmpty())
- return E_INVALIDARG;
- resValue = prop.ulVal;
- }
- else if (prop.vt == VT_EMPTY)
- {
- if(!name.IsEmpty())
- {
- const wchar_t *start = name;
- const wchar_t *end;
- UInt64 v = ConvertStringToUInt64(start, &end);
- if (end - start != name.Length())
- return E_INVALIDARG;
- resValue = (UInt32)v;
- }
- }
- else
- return E_INVALIDARG;
- return S_OK;
-}
-
-static const int kLogarithmicSizeLimit = 32;
-static const wchar_t kByteSymbol = L'B';
-static const wchar_t kKiloByteSymbol = L'K';
-static const wchar_t kMegaByteSymbol = L'M';
-
-HRESULT ParsePropDictionaryValue(const UString &srcStringSpec, UInt32 &dicSize)
-{
- UString srcString = srcStringSpec;
- srcString.MakeUpper();
-
- const wchar_t *start = srcString;
- const wchar_t *end;
- UInt64 number = ConvertStringToUInt64(start, &end);
- int numDigits = (int)(end - start);
- if (numDigits == 0 || srcString.Length() > numDigits + 1)
- return E_INVALIDARG;
- if (srcString.Length() == numDigits)
- {
- if (number >= static_cast< UInt64 >( kLogarithmicSizeLimit ) )
- return E_INVALIDARG;
- dicSize = (UInt32)1 << (int)number;
- return S_OK;
- }
- switch (srcString[numDigits])
- {
- case kByteSymbol:
- if (number >= ((UInt64)1 << kLogarithmicSizeLimit))
- return E_INVALIDARG;
- dicSize = (UInt32)number;
- break;
- case kKiloByteSymbol:
- if (number >= ((UInt64)1 << (kLogarithmicSizeLimit - 10)))
- return E_INVALIDARG;
- dicSize = (UInt32)(number << 10);
- break;
- case kMegaByteSymbol:
- if (number >= ((UInt64)1 << (kLogarithmicSizeLimit - 20)))
- return E_INVALIDARG;
- dicSize = (UInt32)(number << 20);
- break;
- default:
- return E_INVALIDARG;
- }
- return S_OK;
-}
-
-HRESULT ParsePropDictionaryValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue)
-{
- if (name.IsEmpty())
- {
- if (prop.vt == VT_UI4)
- {
- UInt32 logDicSize = prop.ulVal;
- if (logDicSize >= 32)
- return E_INVALIDARG;
- resValue = (UInt32)1 << logDicSize;
- return S_OK;
- }
- if (prop.vt == VT_BSTR)
- return ParsePropDictionaryValue(prop.bstrVal, resValue);
- return E_INVALIDARG;
- }
- return ParsePropDictionaryValue(name, resValue);
-}
-
-bool StringToBool(const UString &s, bool &res)
-{
- if (s.IsEmpty() || s.CompareNoCase(L"ON") == 0 || s.Compare(L"+") == 0)
- {
- res = true;
- return true;
- }
- if (s.CompareNoCase(L"OFF") == 0 || s.Compare(L"-") == 0)
- {
- res = false;
- return true;
- }
- return false;
-}
-
-HRESULT SetBoolProperty(bool &dest, const PROPVARIANT &value)
-{
- switch(value.vt)
- {
- case VT_EMPTY:
- dest = true;
- return S_OK;
- case VT_BOOL:
- dest = (value.boolVal != VARIANT_FALSE);
- return S_OK;
- /*
- case VT_UI4:
- dest = (value.ulVal != 0);
- break;
- */
- case VT_BSTR:
- return StringToBool(value.bstrVal, dest) ? S_OK : E_INVALIDARG;
- }
- return E_INVALIDARG;
-}
-
-int ParseStringToUInt32(const UString &srcString, UInt32 &number)
-{
- const wchar_t *start = srcString;
- const wchar_t *end;
- UInt64 number64 = ConvertStringToUInt64(start, &end);
- if (number64 > 0xFFFFFFFF)
- {
- number = 0;
- return 0;
- }
- number = (UInt32)number64;
- return (int)(end - start);
-}
-
-HRESULT ParseMtProp(const UString &name, const PROPVARIANT &prop, UInt32 defaultNumThreads, UInt32 &numThreads)
-{
- if (name.IsEmpty())
- {
- switch(prop.vt)
- {
- case VT_UI4:
- numThreads = prop.ulVal;
- break;
- default:
- {
- bool val;
- RINOK(SetBoolProperty(val, prop));
- numThreads = (val ? defaultNumThreads : 1);
- break;
- }
- }
- }
- else
- {
- UInt32 number;
- int index = ParseStringToUInt32(name, number);
- if (index != name.Length())
- return E_INVALIDARG;
- numThreads = number;
- }
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ParseProperties.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ParseProperties.h
deleted file mode 100644
index 6f80f6344..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Common/ParseProperties.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// ParseProperties.h
-
-#ifndef __PARSEPROPERTIES_H
-#define __PARSEPROPERTIES_H
-
-#include "Common/MyString.h"
-#include "Common/Types.h"
-
-HRESULT ParsePropValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue);
-HRESULT ParsePropDictionaryValue(const UString &srcStringSpec, UInt32 &dicSize);
-HRESULT ParsePropDictionaryValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue);
-
-bool StringToBool(const UString &s, bool &res);
-HRESULT SetBoolProperty(bool &dest, const PROPVARIANT &value);
-int ParseStringToUInt32(const UString &srcString, UInt32 &number);
-HRESULT ParseMtProp(const UString &name, const PROPVARIANT &prop, UInt32 defaultNumThreads, UInt32 &numThreads);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/CpioHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/CpioHandler.cpp
deleted file mode 100644
index e5a32936c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/CpioHandler.cpp
+++ /dev/null
@@ -1,625 +0,0 @@
-// CpioHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/StringToInt.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-
-#include "Common/ItemNameUtils.h"
-
-namespace NArchive {
-namespace NCpio {
-
-namespace NFileHeader
-{
- namespace NMagic
- {
- extern const char *kMagic1 = "070701";
- extern const char *kMagic2 = "070702";
- extern const char *kMagic3 = "070707";
- extern const char *kEndName = "TRAILER!!!";
-
- const Byte kMagicForRecord2[2] = { 0xC7, 0x71 };
- }
-
- const UInt32 kRecord2Size = 26;
- /*
- struct CRecord2
- {
- unsigned short c_magic;
- short c_dev;
- unsigned short c_ino;
- unsigned short c_mode;
- unsigned short c_uid;
- unsigned short c_gid;
- unsigned short c_nlink;
- short c_rdev;
- unsigned short c_mtimes[2];
- unsigned short c_namesize;
- unsigned short c_filesizes[2];
- };
- */
-
- const UInt32 kRecordSize = 110;
- /*
- struct CRecord
- {
- char Magic[6]; // "070701" for "new" portable format, "070702" for CRC format
- char inode[8];
- char Mode[8];
- char UID[8];
- char GID[8];
- char nlink[8];
- char mtime[8];
- char Size[8]; // must be 0 for FIFOs and directories
- char DevMajor[8];
- char DevMinor[8];
- char RDevMajor[8]; //only valid for chr and blk special files
- char RDevMinor[8]; //only valid for chr and blk special files
- char NameSize[8]; // count includes terminating NUL in pathname
- char ChkSum[8]; // 0 for "new" portable format; for CRC format the sum of all the bytes in the file
- bool CheckMagic() const
- { return memcmp(Magic, NMagic::kMagic1, 6) == 0 ||
- memcmp(Magic, NMagic::kMagic2, 6) == 0; };
- };
- */
-
- const UInt32 kOctRecordSize = 76;
-
-}
-
-struct CItem
-{
- AString Name;
- UInt32 inode;
- UInt32 Mode;
- UInt32 UID;
- UInt32 GID;
- UInt32 Size;
- UInt32 MTime;
-
- // char LinkFlag;
- // AString LinkName; ?????
- char Magic[8];
- UInt32 NumLinks;
- UInt32 DevMajor;
- UInt32 DevMinor;
- UInt32 RDevMajor;
- UInt32 RDevMinor;
- UInt32 ChkSum;
-
- UInt32 Align;
-
- bool IsDir() const { return (Mode & 0170000) == 0040000; }
-};
-
-class CItemEx: public CItem
-{
-public:
- UInt64 HeaderPosition;
- UInt32 HeaderSize;
- UInt64 GetDataPosition() const { return HeaderPosition + HeaderSize; };
-};
-
-const UInt32 kMaxBlockSize = NFileHeader::kRecordSize;
-
-class CInArchive
-{
- CMyComPtr<IInStream> m_Stream;
- UInt64 m_Position;
-
- UInt16 _blockSize;
- Byte _block[kMaxBlockSize];
- UInt32 _blockPos;
- Byte ReadByte();
- UInt16 ReadUInt16();
- UInt32 ReadUInt32();
-
- bool ReadNumber(UInt32 &resultValue);
- bool ReadOctNumber(int size, UInt32 &resultValue);
-
- HRESULT ReadBytes(void *data, UInt32 size, UInt32 &processedSize);
-public:
- HRESULT Open(IInStream *inStream);
- HRESULT GetNextItem(bool &filled, CItemEx &itemInfo);
- HRESULT Skip(UInt64 numBytes);
- HRESULT SkipDataRecords(UInt64 dataSize, UInt32 align);
-};
-
-HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 &processedSize)
-{
- size_t realProcessedSize = size;
- RINOK(ReadStream(m_Stream, data, &realProcessedSize));
- processedSize = (UInt32)realProcessedSize;
- m_Position += processedSize;
- return S_OK;
-}
-
-Byte CInArchive::ReadByte()
-{
- if (_blockPos >= _blockSize)
- throw "Incorrect cpio archive";
- return _block[_blockPos++];
-}
-
-UInt16 CInArchive::ReadUInt16()
-{
- UInt16 value = 0;
- for (int i = 0; i < 2; i++)
- {
- Byte b = ReadByte();
- value |= (UInt16(b) << (8 * i));
- }
- return value;
-}
-
-UInt32 CInArchive::ReadUInt32()
-{
- UInt32 value = 0;
- for (int i = 0; i < 4; i++)
- {
- Byte b = ReadByte();
- value |= (UInt32(b) << (8 * i));
- }
- return value;
-}
-
-HRESULT CInArchive::Open(IInStream *inStream)
-{
- RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &m_Position));
- m_Stream = inStream;
- return S_OK;
-}
-
-bool CInArchive::ReadNumber(UInt32 &resultValue)
-{
- resultValue = 0;
- for (int i = 0; i < 8; i++)
- {
- char c = char(ReadByte());
- int d;
- if (c >= '0' && c <= '9')
- d = c - '0';
- else if (c >= 'A' && c <= 'F')
- d = 10 + c - 'A';
- else if (c >= 'a' && c <= 'f')
- d = 10 + c - 'a';
- else
- return false;
- resultValue *= 0x10;
- resultValue += d;
- }
- return true;
-}
-
-static bool OctalToNumber(const char *s, UInt64 &res)
-{
- const char *end;
- res = ConvertOctStringToUInt64(s, &end);
- return (*end == ' ' || *end == 0);
-}
-
-static bool OctalToNumber32(const char *s, UInt32 &res)
-{
- UInt64 res64;
- if (!OctalToNumber(s, res64))
- return false;
- res = (UInt32)res64;
- return (res64 <= 0xFFFFFFFF);
-}
-
-bool CInArchive::ReadOctNumber(int size, UInt32 &resultValue)
-{
- char sz[32 + 4];
- int i;
- for (i = 0; i < size && i < 32; i++)
- sz[i] = (char)ReadByte();
- sz[i] = 0;
- return OctalToNumber32(sz, resultValue);
-}
-
-#define GetFromHex(y) { if (!ReadNumber(y)) return S_FALSE; }
-#define GetFromOct6(y) { if (!ReadOctNumber(6, y)) return S_FALSE; }
-#define GetFromOct11(y) { if (!ReadOctNumber(11, y)) return S_FALSE; }
-
-static unsigned short ConvertValue(unsigned short value, bool convert)
-{
- if (!convert)
- return value;
- return (unsigned short)((((unsigned short)(value & 0xFF)) << 8) | (value >> 8));
-}
-
-static UInt32 GetAlignedSize(UInt32 size, UInt32 align)
-{
- while ((size & (align - 1)) != 0)
- size++;
- return size;
-}
-
-
-HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item)
-{
- filled = false;
-
- UInt32 processedSize;
- item.HeaderPosition = m_Position;
-
- _blockSize = kMaxBlockSize;
- RINOK(ReadBytes(_block, 2, processedSize));
- if (processedSize != 2)
- return S_FALSE;
- _blockPos = 0;
-
- UInt32 nameSize;
-
- bool oldBE =
- _block[0] == NFileHeader::NMagic::kMagicForRecord2[1] &&
- _block[1] == NFileHeader::NMagic::kMagicForRecord2[0];
-
- bool binMode = (_block[0] == NFileHeader::NMagic::kMagicForRecord2[0] &&
- _block[1] == NFileHeader::NMagic::kMagicForRecord2[1]) ||
- oldBE;
-
- if (binMode)
- {
- RINOK(ReadBytes(_block + 2, NFileHeader::kRecord2Size - 2, processedSize));
- if (processedSize != NFileHeader::kRecord2Size - 2)
- return S_FALSE;
- item.Align = 2;
- _blockPos = 2;
- item.DevMajor = 0;
- item.DevMinor = ConvertValue(ReadUInt16(), oldBE);
- item.inode = ConvertValue(ReadUInt16(), oldBE);
- item.Mode = ConvertValue(ReadUInt16(), oldBE);
- item.UID = ConvertValue(ReadUInt16(), oldBE);
- item.GID = ConvertValue(ReadUInt16(), oldBE);
- item.NumLinks = ConvertValue(ReadUInt16(), oldBE);
- item.RDevMajor =0;
- item.RDevMinor = ConvertValue(ReadUInt16(), oldBE);
- UInt16 timeHigh = ConvertValue(ReadUInt16(), oldBE);
- UInt16 timeLow = ConvertValue(ReadUInt16(), oldBE);
- item.MTime = (UInt32(timeHigh) << 16) + timeLow;
- nameSize = ConvertValue(ReadUInt16(), oldBE);
- UInt16 sizeHigh = ConvertValue(ReadUInt16(), oldBE);
- UInt16 sizeLow = ConvertValue(ReadUInt16(), oldBE);
- item.Size = (UInt32(sizeHigh) << 16) + sizeLow;
-
- item.ChkSum = 0;
- item.HeaderSize = GetAlignedSize(
- nameSize + NFileHeader::kRecord2Size, item.Align);
- nameSize = item.HeaderSize - NFileHeader::kRecord2Size;
- }
- else
- {
- RINOK(ReadBytes(_block + 2, 4, processedSize));
- if (processedSize != 4)
- return S_FALSE;
-
- bool magicOK =
- memcmp(_block, NFileHeader::NMagic::kMagic1, 6) == 0 ||
- memcmp(_block, NFileHeader::NMagic::kMagic2, 6) == 0;
- _blockPos = 6;
- if (magicOK)
- {
- RINOK(ReadBytes(_block + 6, NFileHeader::kRecordSize - 6, processedSize));
- if (processedSize != NFileHeader::kRecordSize - 6)
- return S_FALSE;
- item.Align = 4;
-
- GetFromHex(item.inode);
- GetFromHex(item.Mode);
- GetFromHex(item.UID);
- GetFromHex(item.GID);
- GetFromHex(item.NumLinks);
- UInt32 mTime;
- GetFromHex(mTime);
- item.MTime = mTime;
- GetFromHex(item.Size);
- GetFromHex(item.DevMajor);
- GetFromHex(item.DevMinor);
- GetFromHex(item.RDevMajor);
- GetFromHex(item.RDevMinor);
- GetFromHex(nameSize);
- GetFromHex(item.ChkSum);
- item.HeaderSize = GetAlignedSize(
- nameSize + NFileHeader::kRecordSize, item.Align);
- nameSize = item.HeaderSize - NFileHeader::kRecordSize;
- }
- else
- {
- if (!memcmp(_block, NFileHeader::NMagic::kMagic3, 6) == 0)
- return S_FALSE;
- RINOK(ReadBytes(_block + 6, NFileHeader::kOctRecordSize - 6, processedSize));
- if (processedSize != NFileHeader::kOctRecordSize - 6)
- return S_FALSE;
- item.Align = 1;
- item.DevMajor = 0;
- GetFromOct6(item.DevMinor);
- GetFromOct6(item.inode);
- GetFromOct6(item.Mode);
- GetFromOct6(item.UID);
- GetFromOct6(item.GID);
- GetFromOct6(item.NumLinks);
- item.RDevMajor = 0;
- GetFromOct6(item.RDevMinor);
- UInt32 mTime;
- GetFromOct11(mTime);
- item.MTime = mTime;
- GetFromOct6(nameSize);
- GetFromOct11(item.Size); // ?????
- item.HeaderSize = GetAlignedSize(
- nameSize + NFileHeader::kOctRecordSize, item.Align);
- nameSize = item.HeaderSize - NFileHeader::kOctRecordSize;
- }
- }
- if (nameSize == 0 || nameSize >= (1 << 27))
- return E_FAIL;
- RINOK(ReadBytes(item.Name.GetBuffer(nameSize), nameSize, processedSize));
- if (processedSize != nameSize)
- return E_FAIL;
- item.Name.ReleaseBuffer();
- if (strcmp(item.Name, NFileHeader::NMagic::kEndName) == 0)
- return S_OK;
- filled = true;
- return S_OK;
-}
-
-HRESULT CInArchive::Skip(UInt64 numBytes)
-{
- UInt64 newPostion;
- RINOK(m_Stream->Seek(numBytes, STREAM_SEEK_CUR, &newPostion));
- m_Position += numBytes;
- if (m_Position != newPostion)
- return E_FAIL;
- return S_OK;
-}
-
-HRESULT CInArchive::SkipDataRecords(UInt64 dataSize, UInt32 align)
-{
- while ((dataSize & (align - 1)) != 0)
- dataSize++;
- return Skip(dataSize);
-}
-
-
-class CHandler:
- public IInArchive,
- public IInArchiveGetStream,
- public CMyUnknownImp
-{
- CObjectVector<CItemEx> _items;
- CMyComPtr<IInStream> _stream;
-public:
- MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
- INTERFACE_IInArchive(;)
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-};
-
-/*
-enum
-{
- kpidinode = kpidUserDefined,
- kpidiChkSum
-};
-*/
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidPosixAttrib, VT_UI4},
- // { L"inode", kpidinode, VT_UI4}
- // { L"CheckSum", kpidiChkSum, VT_UI4}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO
-
-STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 *, IArchiveOpenCallback *callback)
-{
- COM_TRY_BEGIN
- // try
- {
- CInArchive archive;
-
- UInt64 endPos = 0;
- bool needSetTotal = true;
-
- if (callback != NULL)
- {
- RINOK(stream->Seek(0, STREAM_SEEK_END, &endPos));
- RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL));
- }
-
- RINOK(archive.Open(stream));
-
- _items.Clear();
-
- for (;;)
- {
- CItemEx item;
- bool filled;
- HRESULT result = archive.GetNextItem(filled, item);
- if (result == S_FALSE)
- return S_FALSE;
- if (result != S_OK)
- return S_FALSE;
- if (!filled)
- break;
- _items.Add(item);
- archive.SkipDataRecords(item.Size, item.Align);
- if (callback != NULL)
- {
- if (needSetTotal)
- {
- RINOK(callback->SetTotal(NULL, &endPos));
- needSetTotal = false;
- }
- if (_items.Size() % 100 == 0)
- {
- UInt64 numFiles = _items.Size();
- UInt64 numBytes = item.HeaderPosition;
- RINOK(callback->SetCompleted(&numFiles, &numBytes));
- }
- }
- }
- if (_items.Size() == 0)
- return S_FALSE;
-
- _stream = stream;
- }
- /*
- catch(...)
- {
- return S_FALSE;
- }
- */
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _items.Clear();
- _stream.Release();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _items.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- const CItemEx &item = _items[index];
-
- switch(propID)
- {
- case kpidPath: prop = NItemName::GetOSName(MultiByteToUnicodeString(item.Name, CP_OEMCP)); break;
- case kpidIsDir: prop = item.IsDir(); break;
- case kpidSize:
- case kpidPackSize:
- prop = (UInt64)item.Size;
- break;
- case kpidMTime:
- {
- if (item.MTime != 0)
- {
- FILETIME utc;
- NWindows::NTime::UnixTimeToFileTime(item.MTime, utc);
- prop = utc;
- }
- break;
- }
- case kpidPosixAttrib: prop = item.Mode; break;
- /*
- case kpidinode: prop = item.inode; break;
- case kpidiChkSum: prop = item.ChkSum; break;
- */
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _items.Size();
- if (numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- totalSize += _items[allFilesMode ? i : indices[i]].Size;
- extractCallback->SetTotal(totalSize);
-
- UInt64 currentTotalSize = 0;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- streamSpec->SetStream(_stream);
-
- for (i = 0; i < numItems; i++)
- {
- lps->InSize = lps->OutSize = currentTotalSize;
- RINOK(lps->SetCur());
- CMyComPtr<ISequentialOutStream> outStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- Int32 index = allFilesMode ? i : indices[i];
- const CItemEx &item = _items[index];
- RINOK(extractCallback->GetStream(index, &outStream, askMode));
- currentTotalSize += item.Size;
- if (item.IsDir())
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
- if (!testMode && !outStream)
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- if (testMode)
- {
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
- RINOK(_stream->Seek(item.GetDataPosition(), STREAM_SEEK_SET, NULL));
- streamSpec->Init(item.Size);
- RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
- outStream.Release();
- RINOK(extractCallback->SetOperationResult((copyCoderSpec->TotalSize == item.Size) ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kDataError));
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
-{
- COM_TRY_BEGIN
- const CItemEx &item = _items[index];
- return CreateLimitedInStream(_stream, item.GetDataPosition(), item.Size, stream);
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new NArchive::NCpio::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Cpio", L"cpio", 0, 0xED, { 0 }, 0, false, CreateArc, 0 };
-
-REGISTER_ARC(Cpio)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/DebHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/DebHandler.cpp
deleted file mode 100644
index 0381e0fd1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/DebHandler.cpp
+++ /dev/null
@@ -1,394 +0,0 @@
-// DebHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/Defs.h"
-#include "Common/NewHandler.h"
-#include "Common/StringConvert.h"
-#include "Common/StringToInt.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-
-#include "Common/ItemNameUtils.h"
-
-using namespace NWindows;
-using namespace NTime;
-
-namespace NArchive {
-namespace NDeb {
-
-namespace NHeader
-{
- const int kSignatureLen = 8;
-
- const char *kSignature = "!<arch>\n";
-
- const int kNameSize = 16;
- const int kTimeSize = 12;
- const int kModeSize = 8;
- const int kSizeSize = 10;
-
- /*
- struct CHeader
- {
- char Name[kNameSize];
- char MTime[kTimeSize];
- char Number0[6];
- char Number1[6];
- char Mode[kModeSize];
- char Size[kSizeSize];
- char Quote;
- char NewLine;
- };
- */
- const int kHeaderSize = kNameSize + kTimeSize + 6 + 6 + kModeSize + kSizeSize + 1 + 1;
-}
-
-struct CItem
-{
- AString Name;
- UInt64 Size;
- UInt32 MTime;
- UInt32 Mode;
-
- UInt64 HeaderPos;
- UInt64 GetDataPos() const { return HeaderPos + NHeader::kHeaderSize; };
- // UInt64 GetFullSize() const { return NFileHeader::kRecordSize + Size; };
-};
-
-class CInArchive
-{
- CMyComPtr<IInStream> m_Stream;
- UInt64 m_Position;
-
- HRESULT GetNextItemReal(bool &filled, CItem &itemInfo);
-public:
- HRESULT Open(IInStream *inStream);
- HRESULT GetNextItem(bool &filled, CItem &itemInfo);
- HRESULT SkipData(UInt64 dataSize);
-};
-
-HRESULT CInArchive::Open(IInStream *inStream)
-{
- RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &m_Position));
- char signature[NHeader::kSignatureLen];
- RINOK(ReadStream_FALSE(inStream, signature, NHeader::kSignatureLen));
- m_Position += NHeader::kSignatureLen;
- if (memcmp(signature, NHeader::kSignature, NHeader::kSignatureLen) != 0)
- return S_FALSE;
- m_Stream = inStream;
- return S_OK;
-}
-
-static void MyStrNCpy(char *dest, const char *src, int size)
-{
- for (int i = 0; i < size; i++)
- {
- char c = src[i];
- dest[i] = c;
- if (c == 0)
- break;
- }
-}
-
-static bool OctalToNumber(const char *s, int size, UInt64 &res)
-{
- char sz[32];
- MyStrNCpy(sz, s, size);
- sz[size] = 0;
- const char *end;
- int i;
- for (i = 0; sz[i] == ' '; i++);
- res = ConvertOctStringToUInt64(sz + i, &end);
- return (*end == ' ' || *end == 0);
-}
-
-static bool OctalToNumber32(const char *s, int size, UInt32 &res)
-{
- UInt64 res64;
- if (!OctalToNumber(s, size, res64))
- return false;
- res = (UInt32)res64;
- return (res64 <= 0xFFFFFFFF);
-}
-
-static bool DecimalToNumber(const char *s, int size, UInt64 &res)
-{
- char sz[32];
- MyStrNCpy(sz, s, size);
- sz[size] = 0;
- const char *end;
- int i;
- for (i = 0; sz[i] == ' '; i++);
- res = ConvertStringToUInt64(sz + i, &end);
- return (*end == ' ' || *end == 0);
-}
-
-static bool DecimalToNumber32(const char *s, int size, UInt32 &res)
-{
- UInt64 res64;
- if (!DecimalToNumber(s, size, res64))
- return false;
- res = (UInt32)res64;
- return (res64 <= 0xFFFFFFFF);
-}
-
-#define RIF(x) { if (!(x)) return S_FALSE; }
-
-
-HRESULT CInArchive::GetNextItemReal(bool &filled, CItem &item)
-{
- filled = false;
-
- char header[NHeader::kHeaderSize];
- const char *cur = header;
-
- size_t processedSize = sizeof(header);
- item.HeaderPos = m_Position;
- RINOK(ReadStream(m_Stream, header, &processedSize));
- m_Position += processedSize;
- if (processedSize != sizeof(header))
- return S_OK;
-
- char tempString[NHeader::kNameSize + 1];
- MyStrNCpy(tempString, cur, NHeader::kNameSize);
- cur += NHeader::kNameSize;
- tempString[NHeader::kNameSize] = '\0';
- item.Name = tempString;
- item.Name.Trim();
-
- for (int i = 0; i < item.Name.Length(); i++)
- if (((Byte)item.Name[i]) < 0x20)
- return S_FALSE;
-
- RIF(DecimalToNumber32(cur, NHeader::kTimeSize, item.MTime));
- cur += NHeader::kTimeSize;
-
- cur += 6 + 6;
-
- RIF(OctalToNumber32(cur, NHeader::kModeSize, item.Mode));
- cur += NHeader::kModeSize;
-
- RIF(DecimalToNumber(cur, NHeader::kSizeSize, item.Size));
- cur += NHeader::kSizeSize;
-
- filled = true;
- return S_OK;
-}
-
-HRESULT CInArchive::GetNextItem(bool &filled, CItem &item)
-{
- for (;;)
- {
- RINOK(GetNextItemReal(filled, item));
- if (!filled)
- return S_OK;
- if (item.Name.Compare("debian-binary") != 0)
- return S_OK;
- if (item.Size != 4)
- return S_OK;
- SkipData(item.Size);
- }
-}
-
-HRESULT CInArchive::SkipData(UInt64 dataSize)
-{
- return m_Stream->Seek((dataSize + 1) & (~((UInt64)0x1)), STREAM_SEEK_CUR, &m_Position);
-}
-
-class CHandler:
- public IInArchive,
- public IInArchiveGetStream,
- public CMyUnknownImp
-{
- CObjectVector<CItem> _items;
- CMyComPtr<IInStream> _stream;
-public:
- MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
- INTERFACE_IInArchive(;)
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-};
-
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback *openArchiveCallback)
-{
- COM_TRY_BEGIN
- {
- CInArchive archive;
- if(archive.Open(stream) != S_OK)
- return S_FALSE;
- _items.Clear();
-
- if (openArchiveCallback != NULL)
- {
- RINOK(openArchiveCallback->SetTotal(NULL, NULL));
- UInt64 numFiles = _items.Size();
- RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL));
- }
-
- for (;;)
- {
- CItem item;
- bool filled;
- HRESULT result = archive.GetNextItem(filled, item);
- if (result == S_FALSE)
- return S_FALSE;
- if (result != S_OK)
- return S_FALSE;
- if (!filled)
- break;
- _items.Add(item);
- archive.SkipData(item.Size);
- if (openArchiveCallback != NULL)
- {
- UInt64 numFiles = _items.Size();
- RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL));
- }
- }
- _stream = stream;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _stream.Release();
- _items.Clear();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _items.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- const CItem &item = _items[index];
-
- switch(propID)
- {
- case kpidPath: prop = (const wchar_t *)NItemName::GetOSName2(MultiByteToUnicodeString(item.Name, CP_OEMCP)); break;
- case kpidSize:
- case kpidPackSize:
- prop = item.Size;
- break;
- case kpidMTime:
- {
- if (item.MTime != 0)
- {
- FILETIME fileTime;
- NTime::UnixTimeToFileTime(item.MTime, fileTime);
- prop = fileTime;
- }
- break;
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _items.Size();
- if (numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- totalSize += _items[allFilesMode ? i : indices[i]].Size;
- extractCallback->SetTotal(totalSize);
-
- UInt64 currentTotalSize = 0;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- streamSpec->SetStream(_stream);
-
- for (i = 0; i < numItems; i++)
- {
- lps->InSize = lps->OutSize = currentTotalSize;
- RINOK(lps->SetCur());
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- Int32 index = allFilesMode ? i : indices[i];
- const CItem &item = _items[index];
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
- currentTotalSize += item.Size;
-
- if (!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- if (testMode)
- {
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
- RINOK(_stream->Seek(item.GetDataPos(), STREAM_SEEK_SET, NULL));
- streamSpec->Init(item.Size);
- RINOK(copyCoder->Code(inStream, realOutStream, NULL, NULL, progress));
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult((copyCoderSpec->TotalSize == item.Size) ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kDataError));
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
-{
- COM_TRY_BEGIN
- const CItem &item = _items[index];
- return CreateLimitedInStream(_stream, item.GetDataPos(), item.Size, stream);
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new NArchive::NDeb::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Deb", L"deb", 0, 0xEC, { '!', '<', 'a', 'r', 'c', 'h', '>', '\n' }, 8, false, CreateArc, 0 };
-
-REGISTER_ARC(Deb)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/DllExports2.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/DllExports2.cpp
deleted file mode 100644
index a21173ade..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/DllExports2.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-// DLLExports.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/MyInitGuid.h"
-#include "../../Common/ComTry.h"
-#include "../../Common/Types.h"
-#include "../../Windows/PropVariant.h"
-#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
-#include "../../../C/Alloc.h"
-#endif
-
-#include "IArchive.h"
-#include "../ICoder.h"
-#include "../IPassword.h"
-
-#ifndef _UNICODE
-#ifdef _WIN32
-bool g_IsNT = false;
-HINSTANCE g_hInstance;
-static bool IsItWindowsNT()
-{
- OSVERSIONINFO versionInfo;
- versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
- return false;
- return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-#endif
-#endif
-
-#ifdef _WIN32
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
-{
- if (dwReason == DLL_PROCESS_ATTACH)
- {
- g_hInstance = hInstance;
- #ifndef _UNICODE
- #ifdef _WIN32
- g_IsNT = IsItWindowsNT();
- #endif
- #endif
- }
- return TRUE;
-}
-#endif
-
-DEFINE_GUID(CLSID_CArchiveHandler,
-0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00);
-
-static const UInt16 kDecodeId = 0x2790;
-
-DEFINE_GUID(CLSID_CCodec,
-0x23170F69, 0x40C1, kDecodeId, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-STDAPI CreateCoder(const GUID *clsid, const GUID *iid, void **outObject);
-STDAPI CreateArchiver(const GUID *classID, const GUID *iid, void **outObject);
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- // COM_TRY_BEGIN
- *outObject = 0;
- if (*iid == IID_ICompressCoder || *iid == IID_ICompressCoder2 || *iid == IID_ICompressFilter)
- {
- return CreateCoder(clsid, iid, outObject);
- }
- else
- {
- return CreateArchiver(clsid, iid, outObject);
- }
- // COM_TRY_END
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/DmgHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/DmgHandler.cpp
deleted file mode 100644
index dd1e95ecc..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/DmgHandler.cpp
+++ /dev/null
@@ -1,778 +0,0 @@
-// DmgHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/Buffer.h"
-#include "Common/ComTry.h"
-#include "Common/IntToString.h"
-#include "Common/MyXml.h"
-#include "Common/UTFConvert.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/BZip2Decoder.h"
-#include "../Compress/CopyCoder.h"
-#include "../Compress/ZlibDecoder.h"
-
-// #define DMG_SHOW_RAW
-
-// #include <stdio.h>
-#define PRF(x) // x
-
-#define Get32(p) GetBe32(p)
-#define Get64(p) GetBe64(p)
-
-static int Base64ToByte(char c)
-{
- if (c >= 'A' && c <= 'Z') return c - 'A';
- if (c >= 'a' && c <= 'z') return c - 'a' + 26;
- if (c >= '0' && c <= '9') return c - '0' + 52;
- if (c == '+') return 62;
- if (c == '/') return 63;
- if (c == '=') return 0;
- return -1;
-}
-
-static int Base64ToBin(Byte *dest, const char *src, int srcLen)
-{
- int srcPos = 0;
- int destPos = 0;
- while (srcPos < srcLen)
- {
- Byte buf[4];
- int filled = 0;
- while (srcPos < srcLen)
- {
- int n = Base64ToByte(src[srcPos++]);
- if (n >= 0)
- {
- buf[filled++] = (Byte)n;
- if (filled == 4)
- break;
- }
- }
- if (filled >= 2) { if (dest) dest[destPos] = (buf[0] << 2) | (buf[1] >> 4); destPos++; }
- if (filled >= 3) { if (dest) dest[destPos] = (buf[1] << 4) | (buf[2] >> 2); destPos++; }
- if (filled >= 4) { if (dest) dest[destPos] = (buf[2] << 6) | (buf[3] ); destPos++; }
- }
- return destPos;
-}
-
-static UString GetSizeString(UInt64 value)
-{
- wchar_t s[32];
- wchar_t c;
- if (value < (UInt64)20000) c = 0;
- else if (value < ((UInt64)20000 << 10)) { value >>= 10; c = L'K'; }
- else if (value < ((UInt64)20000 << 20)) { value >>= 20; c = L'M'; }
- else { value >>= 30; c = L'G'; }
- ConvertUInt64ToString(value, s);
- int p = MyStringLen(s);
- s[p++] = c;
- s[p++] = L'\0';
- return s;
-}
-
-namespace NArchive {
-namespace NDmg {
-
-struct CBlock
-{
- UInt32 Type;
- UInt64 UnpPos;
- UInt64 UnpSize;
- UInt64 PackPos;
- UInt64 PackSize;
-};
-
-struct CFile
-{
- CByteBuffer Raw;
- // UInt64 StartPos;
- CRecordVector<CBlock> Blocks;
- UInt64 GetUnpackSize() const
- {
- UInt64 size = 0;
- for (int i = 0; i < Blocks.Size(); i++)
- size += Blocks[i].UnpSize;
- return size;
- };
- UInt64 GetPackSize() const
- {
- UInt64 size = 0;
- for (int i = 0; i < Blocks.Size(); i++)
- size += Blocks[i].PackSize;
- return size;
- };
-
- AString Name;
-};
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _inStream;
-
- AString _xml;
- CObjectVector<CFile> _files;
- CRecordVector<int> _fileIndices;
-
- HRESULT Open2(IInStream *stream);
- HRESULT Extract(IInStream *stream);
-public:
- MY_UNKNOWN_IMP1(IInArchive)
- INTERFACE_IInArchive(;)
-};
-
-const UInt32 kXmlSizeMax = ((UInt32)1 << 31) - (1 << 14);
-
-enum
-{
- METHOD_ZERO_0 = 0,
- METHOD_COPY = 1,
- METHOD_ZERO_2 = 2,
- METHOD_ZLIB = 0x80000005,
- METHOD_BZIP2 = 0x80000006,
- METHOD_DUMMY = 0x7FFFFFFE,
- METHOD_END = 0xFFFFFFFF
-};
-
-struct CMethodStat
-{
- UInt32 NumBlocks;
- UInt64 PackSize;
- UInt64 UnpSize;
- CMethodStat(): NumBlocks(0), PackSize(0), UnpSize(0) {}
-};
-
-struct CMethods
-{
- CRecordVector<CMethodStat> Stats;
- CRecordVector<UInt32> Types;
- void Update(const CFile &file);
- UString GetString() const;
-};
-
-void CMethods::Update(const CFile &file)
-{
- for (int i = 0; i < file.Blocks.Size(); i++)
- {
- const CBlock &b = file.Blocks[i];
- int index = Types.FindInSorted(b.Type);
- if (index < 0)
- {
- index = Types.AddToUniqueSorted(b.Type);
- Stats.Insert(index, CMethodStat());
- }
- CMethodStat &m = Stats[index];
- m.PackSize += b.PackSize;
- m.UnpSize += b.UnpSize;
- m.NumBlocks++;
- }
-}
-
-UString CMethods::GetString() const
-{
- UString res;
- for (int i = 0; i < Types.Size(); i++)
- {
- if (i != 0)
- res += L' ';
- wchar_t buf[32];
- const wchar_t *s;
- const CMethodStat &m = Stats[i];
- bool showPack = true;
- UInt32 type = Types[i];
- switch(type)
- {
- case METHOD_ZERO_0: s = L"zero0"; showPack = (m.PackSize != 0); break;
- case METHOD_ZERO_2: s = L"zero2"; showPack = (m.PackSize != 0); break;
- case METHOD_COPY: s = L"copy"; showPack = (m.UnpSize != m.PackSize); break;
- case METHOD_ZLIB: s = L"zlib"; break;
- case METHOD_BZIP2: s = L"bzip2"; break;
- default: ConvertUInt64ToString(type, buf); s = buf;
- }
- res += s;
- if (m.NumBlocks != 1)
- {
- res += L'[';
- ConvertUInt64ToString(m.NumBlocks, buf);
- res += buf;
- res += L']';
- }
- res += L'-';
- res += GetSizeString(m.UnpSize);
- if (showPack)
- {
- res += L'-';
- res += GetSizeString(m.PackSize);
- }
- }
- return res;
-}
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidComment, VT_BSTR},
- { NULL, kpidMethod, VT_BSTR}
-};
-
-IMP_IInArchive_Props
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidNumBlocks, VT_UI4}
-};
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidMethod:
- {
- CMethods m;
- for (int i = 0; i < _files.Size(); i++)
- m.Update(_files[i]);
- prop = m.GetString();
- break;
- }
- case kpidNumBlocks:
- {
- UInt64 numBlocks = 0;
- for (int i = 0; i < _files.Size(); i++)
- numBlocks += _files[i].Blocks.Size();
- prop = numBlocks;
- break;
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-IMP_IInArchive_ArcProps
-
-static int FindKeyPair(const CXmlItem &item, const AString &key, const AString &nextTag)
-{
- for (int i = 0; i + 1 < item.SubItems.Size(); i++)
- {
- const CXmlItem &si = item.SubItems[i];
- if (si.IsTagged("key") && si.GetSubString() == key && item.SubItems[i + 1].IsTagged(nextTag))
- return i + 1;
- }
- return -1;
-}
-
-static AString GetStringFromKeyPair(const CXmlItem &item, const AString &key, const AString &nextTag)
-{
- int index = FindKeyPair(item, key, nextTag);
- if (index >= 0)
- return item.SubItems[index].GetSubString();
- return AString();
-}
-
-HRESULT CHandler::Open2(IInStream *stream)
-{
- const int HEADER_SIZE = 0x1E0;
-
- UInt64 headerPos;
- RINOK(stream->Seek(-HEADER_SIZE, STREAM_SEEK_END, &headerPos));
- Byte buf[HEADER_SIZE];
- RINOK(ReadStream_FALSE(stream, buf, HEADER_SIZE));
- UInt64 address1 = Get64(buf + 0);
- UInt64 address2 = Get64(buf + 0xB8);
- UInt64 size64 = Get64(buf + 0xC0);
- if (address1 != address2 || size64 >= kXmlSizeMax || size64 == 0 ||
- address1 >= headerPos || address1 + size64 > headerPos)
- return S_FALSE;
- RINOK(stream->Seek(address1, STREAM_SEEK_SET, NULL));
- size_t size = (size_t)size64;
-
- char *ss = _xml.GetBuffer((int)size + 1);
- RINOK(ReadStream_FALSE(stream, ss, size));
- ss[size] = 0;
- _xml.ReleaseBuffer();
-
- CXml xml;
- if (!xml.Parse(_xml))
- return S_FALSE;
- if (xml.Root.Name != "plist")
- return S_FALSE;
-
- int dictIndex = xml.Root.FindSubTag("dict");
- if (dictIndex < 0)
- return S_FALSE;
-
- const CXmlItem &dictItem = xml.Root.SubItems[dictIndex];
- int rfDictIndex = FindKeyPair(dictItem, "resource-fork", "dict");
- if (rfDictIndex < 0)
- return S_FALSE;
-
- const CXmlItem &rfDictItem = dictItem.SubItems[rfDictIndex];
- int arrIndex = FindKeyPair(rfDictItem, "blkx", "array");
- if (arrIndex < 0)
- return S_FALSE;
-
- const CXmlItem &arrItem = rfDictItem.SubItems[arrIndex];
-
- /* some DMG file has BUG:
- PackPos for each new file is 0.
- So we use additional "StartPos" to fix that BUG */
-
- /*
- UInt64 startPos = 0;
- bool startPosIsDefined = false;
- */
-
-
- for (int i = 0; i < arrItem.SubItems.Size(); i++)
- {
- const CXmlItem &item = arrItem.SubItems[i];
- if (!item.IsTagged("dict"))
- continue;
-
- CFile file;
- // file.StartPos = startPos;
-
- int destLen;
- {
- AString dataString;
- AString name = GetStringFromKeyPair(item, "Name", "string");
- if (name.IsEmpty())
- name = GetStringFromKeyPair(item, "CFName", "string");
- file.Name = name;
- dataString = GetStringFromKeyPair(item, "Data", "data");
-
- destLen = Base64ToBin(NULL, dataString, dataString.Length());
- file.Raw.SetCapacity(destLen);
- Base64ToBin(file.Raw, dataString, dataString.Length());
- }
-
- if (destLen > 0xCC && Get32(file.Raw) == 0x6D697368)
- {
- PRF(printf("\n\n index = %d", _files.Size()));
- const int kRecordSize = 40;
- for (int offset = 0xCC; offset + kRecordSize <= destLen; offset += kRecordSize)
- {
- const Byte *p = (const Byte *)file.Raw + offset;
- CBlock b;
- b.Type = Get32(p);
- if (b.Type == METHOD_END)
- break;
- if (b.Type == METHOD_DUMMY)
- continue;
-
- b.UnpPos = Get64(p + 0x08) << 9;
- b.UnpSize = Get64(p + 0x10) << 9;
- b.PackPos = Get64(p + 0x18);
- b.PackSize = Get64(p + 0x20);
-
- /*
- if (startPosIsdefined)
- {
- }
- else
- {
- startPosIsdefined = true;
- startPos = b.PackPos;
- }
- startPos += b.PackSize;
- */
-
- file.Blocks.Add(b);
-
- PRF(printf("\nType=%8x m[1]=%8x uPos=%8x uSize=%7x pPos=%8x pSize=%7x",
- b.Type, Get32(p + 4), (UInt32)b.UnpPos, (UInt32)b.UnpSize, (UInt32)b.PackPos, (UInt32)b.PackSize));
- }
- }
- int itemIndex = _files.Add(file);
- if (file.Blocks.Size() > 0)
- {
- // if (file.Name.Find("HFS") >= 0)
- _fileIndices.Add(itemIndex);
- }
- }
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- {
- Close();
- if (Open2(stream) != S_OK)
- return S_FALSE;
- _inStream = stream;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _inStream.Release();
- _fileIndices.Clear();
- _files.Clear();
- _xml.Empty();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _fileIndices.Size()
- #ifdef DMG_SHOW_RAW
- + _files.Size() + 1;
- #endif
- ;
- return S_OK;
-}
-
-#define RAW_PREFIX L"raw" WSTRING_PATH_SEPARATOR
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
-
- #ifdef DMG_SHOW_RAW
- if ((int)index == _fileIndices.Size())
- {
- switch(propID)
- {
- case kpidPath:
- prop = RAW_PREFIX L"a.xml";
- break;
- case kpidSize:
- case kpidPackedSize:
- prop = (UInt64)_xml.Length();
- break;
- }
- }
- else if ((int)index > _fileIndices.Size())
- {
- int rawIndex = (int)index - (_fileIndices.Size() + 1);
- switch(propID)
- {
- case kpidPath:
- {
- wchar_t s[32] = RAW_PREFIX;
- ConvertUInt64ToString(rawIndex, s + MyStringLen(s));
- prop = s;
- break;
- }
- case kpidSize:
- case kpidPackedSize:
- prop = (UInt64)_files[rawIndex].Raw.GetCapacity();
- break;
- }
- }
- else
- #endif
- {
- int itemIndex = _fileIndices[index];
- const CFile &item = _files[itemIndex];
- switch(propID)
- {
- case kpidMethod:
- {
- CMethods m;
- m.Update(item);
- UString resString = m.GetString();
- if (!resString.IsEmpty())
- prop = resString;
- break;
- }
-
- // case kpidExtension: prop = L"hfs"; break;
-
- case kpidPath:
- {
- // break;
- UString name;
- wchar_t s[32];
- ConvertUInt64ToString(index, s);
- name = s;
- int num = 10;
- int numDigits;
- for (numDigits = 1; num < _fileIndices.Size(); numDigits++)
- num *= 10;
- while (name.Length() < numDigits)
- name = L'0' + name;
-
- AString subName;
- int pos1 = item.Name.Find('(');
- if (pos1 >= 0)
- {
- pos1++;
- int pos2 = item.Name.Find(')', pos1);
- if (pos2 >= 0)
- {
- subName = item.Name.Mid(pos1, pos2 - pos1);
- pos1 = subName.Find(':');
- if (pos1 >= 0)
- subName = subName.Left(pos1);
- }
- }
- subName.Trim();
- if (!subName.IsEmpty())
- {
- if (subName == "Apple_HFS")
- subName = "hfs";
- else if (subName == "Apple_HFSX")
- subName = "hfsx";
- else if (subName == "Apple_Free")
- subName = "free";
- else if (subName == "DDM")
- subName = "ddm";
- UString name2;
- ConvertUTF8ToUnicode(subName, name2);
- name += L'.';
- name += name2;
- }
- else
- {
- UString name2;
- ConvertUTF8ToUnicode(item.Name, name2);
- if (!name2.IsEmpty())
- name += L" - ";
- name += name2;
- }
- prop = name;
- break;
- }
- case kpidComment:
- {
- UString name;
- ConvertUTF8ToUnicode(item.Name, name);
- prop = name;
- break;
- }
-
- case kpidSize: prop = item.GetUnpackSize(); break;
- case kpidPackSize: prop = item.GetPackSize(); break;
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _files.Size();
- if (numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- {
- int index = (int)(allFilesMode ? i : indices[i]);
- #ifdef DMG_SHOW_RAW
- if (index == _fileIndices.Size())
- totalSize += _xml.Length();
- else if (index > _fileIndices.Size())
- totalSize += _files[index - (_fileIndices.Size() + 1)].Raw.GetCapacity();
- else
- #endif
- totalSize += _files[_fileIndices[index]].GetUnpackSize();
- }
- extractCallback->SetTotal(totalSize);
-
- UInt64 currentPackTotal = 0;
- UInt64 currentUnpTotal = 0;
- UInt64 currentPackSize = 0;
- UInt64 currentUnpSize = 0;
-
- const UInt32 kZeroBufSize = (1 << 14);
- CByteBuffer zeroBuf;
- zeroBuf.SetCapacity(kZeroBufSize);
- memset(zeroBuf, 0, kZeroBufSize);
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- NCompress::NBZip2::CDecoder *bzip2CoderSpec = new NCompress::NBZip2::CDecoder();
- CMyComPtr<ICompressCoder> bzip2Coder = bzip2CoderSpec;
-
- NCompress::NZlib::CDecoder *zlibCoderSpec = new NCompress::NZlib::CDecoder();
- CMyComPtr<ICompressCoder> zlibCoder = zlibCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- streamSpec->SetStream(_inStream);
-
- for (i = 0; i < numItems; i++, currentPackTotal += currentPackSize, currentUnpTotal += currentUnpSize)
- {
- lps->InSize = currentPackTotal;
- lps->OutSize = currentUnpTotal;
- currentPackSize = 0;
- currentUnpSize = 0;
- RINOK(lps->SetCur());
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- Int32 index = allFilesMode ? i : indices[i];
- // const CItemEx &item = _files[index];
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
-
- if (!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
-
- CLimitedSequentialOutStream *outStreamSpec = new CLimitedSequentialOutStream;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
- outStreamSpec->SetStream(realOutStream);
-
- realOutStream.Release();
-
- Int32 opRes = NArchive::NExtract::NOperationResult::kOK;
- #ifdef DMG_SHOW_RAW
- if (index > _fileIndices.Size())
- {
- const CByteBuffer &buf = _files[index - (_fileIndices.Size() + 1)].Raw;
- outStreamSpec->Init(buf.GetCapacity());
- RINOK(WriteStream(outStream, buf, buf.GetCapacity()));
- currentPackSize = currentUnpSize = buf.GetCapacity();
- }
- else if (index == _fileIndices.Size())
- {
- outStreamSpec->Init(_xml.Length());
- RINOK(WriteStream(outStream, (const char *)_xml, _xml.Length()));
- currentPackSize = currentUnpSize = _xml.Length();
- }
- else
- #endif
- {
- const CFile &item = _files[_fileIndices[index]];
- currentPackSize = item.GetPackSize();
- currentUnpSize = item.GetUnpackSize();
-
- UInt64 unpPos = 0;
- UInt64 packPos = 0;
- {
- for (int j = 0; j < item.Blocks.Size(); j++)
- {
- lps->InSize = currentPackTotal + packPos;
- lps->OutSize = currentUnpTotal + unpPos;
- RINOK(lps->SetCur());
-
- const CBlock &block = item.Blocks[j];
-
- packPos += block.PackSize;
- if (block.UnpPos != unpPos)
- {
- opRes = NArchive::NExtract::NOperationResult::kDataError;
- break;
- }
-
- RINOK(_inStream->Seek(block.PackPos, STREAM_SEEK_SET, NULL));
- streamSpec->Init(block.PackSize);
- // UInt64 startSize = outStreamSpec->GetSize();
- bool realMethod = true;
- outStreamSpec->Init(block.UnpSize);
- HRESULT res = S_OK;
-
- switch(block.Type)
- {
- case METHOD_ZERO_0:
- case METHOD_ZERO_2:
- realMethod = false;
- if (block.PackSize != 0)
- opRes = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- break;
-
- case METHOD_COPY:
- if (block.UnpSize != block.PackSize)
- {
- opRes = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- break;
- }
- res = copyCoder->Code(inStream, outStream, NULL, NULL, progress);
- break;
-
- case METHOD_ZLIB:
- {
- res = zlibCoder->Code(inStream, outStream, NULL, NULL, progress);
- if (res != S_OK)
- break;
- break;
- }
-
- case METHOD_BZIP2:
- {
- res = bzip2Coder->Code(inStream, outStream, NULL, NULL, progress);
- if (res == S_OK)
- if (streamSpec->GetSize() != block.PackSize)
- opRes = NArchive::NExtract::NOperationResult::kDataError;
- break;
- }
-
- default:
- opRes = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- break;
- }
- if (res != S_OK)
- {
- if (res != S_FALSE)
- return res;
- if (opRes == NArchive::NExtract::NOperationResult::kOK)
- opRes = NArchive::NExtract::NOperationResult::kDataError;
- }
- unpPos += block.UnpSize;
- if (!outStreamSpec->IsFinishedOK())
- {
- if (realMethod && opRes == NArchive::NExtract::NOperationResult::kOK)
- opRes = NArchive::NExtract::NOperationResult::kDataError;
-
- while (outStreamSpec->GetRem() != 0)
- {
- UInt64 rem = outStreamSpec->GetRem();
- UInt32 size = (UInt32)MyMin(rem, (UInt64)kZeroBufSize);
- RINOK(WriteStream(outStream, zeroBuf, size));
- }
- }
- }
- }
- }
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(opRes));
- }
- return S_OK;
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Dmg", L"dmg", 0, 0xE4, { 0 }, 0, false, CreateArc, 0 };
-
-REGISTER_ARC(Dmg)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ElfHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ElfHandler.cpp
deleted file mode 100644
index 66b18e7a7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ElfHandler.cpp
+++ /dev/null
@@ -1,535 +0,0 @@
-// ElfHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/Buffer.h"
-#include "Common/ComTry.h"
-#include "Common/IntToString.h"
-
-#include "Windows/PropVariantUtils.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-
-static UInt16 Get16(const Byte *p, int be) { if (be) return GetBe16(p); return GetUi16(p); }
-static UInt32 Get32(const Byte *p, int be) { if (be) return GetBe32(p); return GetUi32(p); }
-static UInt64 Get64(const Byte *p, int be) { if (be) return GetBe64(p); return GetUi64(p); }
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NElf {
-
-#define ELF_CLASS_32 1
-#define ELF_CLASS_64 2
-
-#define ELF_DATA_2LSB 1
-#define ELF_DATA_2MSB 2
-
-#define NUM_SCAN_SECTIONS_MAX (1 << 6)
-
-struct CHeader
-{
- bool Mode64;
- bool Be;
- Byte Os;
- Byte AbiVer;
-
- UInt16 Type;
- UInt16 Machine;
- // UInt32 Version;
-
- // UInt64 EntryVa;
- UInt64 ProgOffset;
- UInt64 SectOffset;
- UInt32 Flags;
- UInt16 ElfHeaderSize;
- UInt16 SegmentEntrySize;
- UInt16 NumSegments;
- UInt16 SectEntrySize;
- UInt16 NumSections;
- // UInt16 SectNameStringTableIndex;
-
- bool Parse(const Byte *buf);
-
- bool CheckSegmentEntrySize() const
- {
- return (Mode64 && SegmentEntrySize == 0x38) || (!Mode64 && SegmentEntrySize == 0x20);
- };
-
- UInt64 GetHeadersSize() const
- { return ElfHeaderSize +
- (UInt64)SegmentEntrySize * NumSegments +
- (UInt64)SectEntrySize * NumSections; }
-
-};
-
-bool CHeader::Parse(const Byte *p)
-{
- switch(p[4])
- {
- case ELF_CLASS_32: Mode64 = false; break;
- case ELF_CLASS_64: Mode64 = true; break;
- default: return false;
- }
- bool be;
- switch(p[5])
- {
- case ELF_DATA_2LSB: be = false; break;
- case ELF_DATA_2MSB: be = true; break;
- default: return false;
- }
- Be = be;
- if (p[6] != 1) // Version
- return false;
- Os = p[7];
- AbiVer = p[8];
- for (int i = 9; i < 16; i++)
- if (p[i] != 0)
- return false;
-
- Type = Get16(p + 0x10, be);
- Machine = Get16(p + 0x12, be);
- if (Get32(p + 0x14, be) != 1) // Version
- return false;
-
- if (Mode64)
- {
- // EntryVa = Get64(p + 0x18, be);
- ProgOffset = Get64(p + 0x20, be);
- SectOffset = Get64(p + 0x28, be);
- p += 0x30;
- }
- else
- {
- // EntryVa = Get32(p + 0x18, be);
- ProgOffset = Get32(p + 0x1C, be);
- SectOffset = Get32(p + 0x20, be);
- p += 0x24;
- }
-
- Flags = Get32(p + 0, be);
- ElfHeaderSize = Get16(p + 4, be);
- SegmentEntrySize = Get16(p + 6, be);
- NumSegments = Get16(p + 8, be);
- SectEntrySize = Get16(p + 10, be);
- NumSections = Get16(p + 12, be);
- // SectNameStringTableIndex = Get16(p + 14, be);
- return CheckSegmentEntrySize();
-}
-
-struct CSegment
-{
- UInt32 Type;
- UInt32 Flags;
- UInt64 Offset;
- UInt64 Va;
- // UInt64 Pa;
- UInt64 PSize;
- UInt64 VSize;
- // UInt64 Align;
-
- void UpdateTotalSize(UInt64 &totalSize)
- {
- UInt64 t = Offset + PSize;
- if (t > totalSize)
- totalSize = t;
- }
- void Parse(const Byte *p, bool mode64, bool be);
-};
-
-void CSegment::Parse(const Byte *p, bool mode64, bool be)
-{
- Type = Get32(p, be);
- if (mode64)
- {
- Flags = Get32(p + 4, be);
- Offset = Get64(p + 8, be);
- Va = Get64(p + 0x10, be);
- // Pa = Get64(p + 0x18, be);
- PSize = Get64(p + 0x20, be);
- VSize = Get64(p + 0x28, be);
- // Align = Get64(p + 0x30, be);
- }
- else
- {
- Offset = Get32(p + 4, be);
- Va = Get32(p + 8, be);
- // Pa = Get32(p + 12, be);
- PSize = Get32(p + 16, be);
- VSize = Get32(p + 20, be);
- Flags = Get32(p + 24, be);
- // Align = Get32(p + 28, be);
- }
-}
-
-static const CUInt32PCharPair g_MachinePairs[] =
-{
- { 0, "None" },
- { 1, "AT&T WE 32100" },
- { 2, "SPARC" },
- { 3, "Intel 386" },
- { 4, "Motorola 68000" },
- { 5, "Motorola 88000" },
- { 6, "Intel 486" },
- { 7, "Intel i860" },
- { 8, "MIPS" },
- { 9, "IBM S/370" },
- { 10, "MIPS RS3000 LE" },
- { 11, "RS6000" },
-
- { 15, "PA-RISC" },
- { 16, "nCUBE" },
- { 17, "Fujitsu VPP500" },
- { 18, "SPARC 32+" },
- { 19, "Intel i960" },
- { 20, "PowerPC" },
- { 21, "PowerPC 64-bit" },
- { 22, "IBM S/390" },
-
- { 36, "NEX v800" },
- { 37, "Fujitsu FR20" },
- { 38, "TRW RH-32" },
- { 39, "Motorola RCE" },
- { 40, "ARM" },
- { 41, "Alpha" },
- { 42, "Hitachi SH" },
- { 43, "SPARC-V9" },
- { 44, "Siemens Tricore" },
- { 45, "ARC" },
- { 46, "H8/300" },
- { 47, "H8/300H" },
- { 48, "H8S" },
- { 49, "H8/500" },
- { 50, "IA-64" },
- { 51, "Stanford MIPS-X" },
- { 52, "Motorola ColdFire" },
- { 53, "M68HC12" },
- { 54, "Fujitsu MMA" },
- { 55, "Siemens PCP" },
- { 56, "Sony nCPU" },
- { 57, "Denso NDR1" },
- { 58, "Motorola StarCore" },
- { 59, "Toyota ME16" },
- { 60, "ST100" },
- { 61, "Advanced Logic TinyJ" },
- { 62, "AMD64" },
- { 63, "Sony DSP" },
-
- { 66, "Siemens FX66" },
- { 67, "ST9+" },
- { 68, "ST7" },
- { 69, "MC68HC16" },
- { 70, "MC68HC11" },
- { 71, "MC68HC08" },
- { 72, "MC68HC05" },
- { 73, "Silicon Graphics SVx" },
- { 74, "ST19" },
- { 75, "Digital VAX" },
- { 76, "Axis CRIS" },
- { 77, "Infineon JAVELIN" },
- { 78, "Element 14 FirePath" },
- { 79, "LSI ZSP" },
- { 80, "MMIX" },
- { 81, "HUANY" },
- { 82, "SiTera Prism" },
- { 83, "Atmel AVR" },
- { 84, "Fujitsu FR30" },
- { 85, "Mitsubishi D10V" },
- { 86, "Mitsubishi D30V" },
- { 87, "NEC v850" },
- { 88, "Mitsubishi M32R" },
- { 89, "Matsushita MN10300" },
- { 90, "Matsushita MN10200" },
- { 91, "picoJava" },
- { 92, "OpenRISC" },
- { 93, "ARC Tangent-A5" },
- { 94, "Tensilica Xtensa" },
- { 0x9026, "Alpha" }
-};
-
-static const CUInt32PCharPair g_AbiOS[] =
-{
- { 0, "None" },
- { 1, "HP-UX" },
- { 2, "NetBSD" },
- { 3, "Linux" },
-
- { 6, "Solaris" },
- { 7, "AIX" },
- { 8, "IRIX" },
- { 9, "FreeBSD" },
- { 10, "TRU64" },
- { 11, "Novell Modesto" },
- { 12, "OpenBSD" },
- { 13, "OpenVMS" },
- { 14, "HP NSK" },
- { 15, "AROS" },
- { 97, "ARM" },
- { 255, "Standalone" }
-};
-
-static const CUInt32PCharPair g_SegmentFlags[] =
-{
- { 1 << 0, "Execute" },
- { 1 << 1, "Write" },
- { 1 << 2, "Read" }
-};
-
-static const char *g_Types[] =
-{
- "None",
- "Relocatable file",
- "Executable file",
- "Shared object file",
- "Core file"
-};
-
-static const char *g_SegnmentTypes[] =
-{
- "Unused",
- "Loadable segment",
- "Dynamic linking tables",
- "Program interpreter path name",
- "Note section",
- "SHLIB",
- "Program header table",
- "TLS"
-};
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _inStream;
- CObjectVector<CSegment> _sections;
- UInt32 _peOffset;
- CHeader _header;
- UInt64 _totalSize;
- HRESULT Open2(IInStream *stream);
- bool Parse(const Byte *buf, UInt32 size);
-public:
- MY_UNKNOWN_IMP1(IInArchive)
- INTERFACE_IInArchive(;)
-};
-
-#define ELF_PT_PHDR 6
-
-bool CHandler::Parse(const Byte *buf, UInt32 size)
-{
- if (size < 64)
- return false;
- if (!_header.Parse(buf))
- return false;
- if (_header.ProgOffset > size ||
- _header.ProgOffset + (UInt64)_header.SegmentEntrySize * _header.NumSegments > size ||
- _header.NumSegments > NUM_SCAN_SECTIONS_MAX)
- return false;
- const Byte *p = buf + _header.ProgOffset;
- _totalSize = _header.ProgOffset;
-
- for (int i = 0; i < _header.NumSegments; i++, p += _header.SegmentEntrySize)
- {
- CSegment sect;
- sect.Parse(p, _header.Mode64, _header.Be);
- sect.UpdateTotalSize(_totalSize);
- if (sect.Type != ELF_PT_PHDR)
- _sections.Add(sect);
- }
- UInt64 total2 = _header.SectOffset + (UInt64)_header.SectEntrySize * _header.NumSections;
- if (total2 > _totalSize)
- _totalSize = total2;
- return true;
-}
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidCpu, VT_BSTR},
- { NULL, kpidBit64, VT_BOOL},
- { NULL, kpidBigEndian, VT_BOOL},
- { NULL, kpidHostOS, VT_BSTR},
- { NULL, kpidCharacts, VT_BSTR},
- { NULL, kpidPhySize, VT_UI8},
- { NULL, kpidHeadersSize, VT_UI8}
- };
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidType, VT_BSTR},
- { NULL, kpidCharacts, VT_BSTR},
- { NULL, kpidOffset, VT_UI8},
- { NULL, kpidVa, VT_UI8}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidPhySize: prop = _totalSize; break;
- case kpidHeadersSize: prop = _header.GetHeadersSize(); break;
- case kpidBit64: if (_header.Mode64) prop = _header.Mode64; break;
- case kpidBigEndian: if (_header.Be) prop = _header.Be; break;
- case kpidCpu: PAIR_TO_PROP(g_MachinePairs, _header.Machine, prop); break;
- case kpidHostOS: PAIR_TO_PROP(g_AbiOS, _header.Os, prop); break;
- case kpidCharacts: TYPE_TO_PROP(g_Types, _header.Type, prop); break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NCOM::CPropVariant prop;
- const CSegment &item = _sections[index];
- switch(propID)
- {
- case kpidPath:
- {
- wchar_t sz[32];
- ConvertUInt64ToString(index, sz);
- prop = sz;
- break;
- }
- case kpidSize: prop = (UInt64)item.VSize; break;
- case kpidPackSize: prop = (UInt64)item.PSize; break;
- case kpidOffset: prop = item.Offset; break;
- case kpidVa: prop = item.Va; break;
- case kpidType: TYPE_TO_PROP(g_SegnmentTypes, item.Type, prop); break;
- case kpidCharacts: FLAGS_TO_PROP(g_SegmentFlags, item.Flags, prop); break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-HRESULT CHandler::Open2(IInStream *stream)
-{
- const UInt32 kBufSize = 1 << 18;
- const UInt32 kSigSize = 4;
-
- CByteBuffer buffer;
- buffer.SetCapacity(kBufSize);
- Byte *buf = buffer;
-
- size_t processed = kSigSize;
- RINOK(ReadStream_FALSE(stream, buf, processed));
- if (buf[0] != 0x7F || buf[1] != 'E' || buf[2] != 'L' || buf[3] != 'F')
- return S_FALSE;
- processed = kBufSize - kSigSize;
- RINOK(ReadStream(stream, buf + kSigSize, &processed));
- processed += kSigSize;
- if (!Parse(buf, (UInt32)processed))
- return S_FALSE;
- UInt64 fileSize;
- RINOK(stream->Seek(0, STREAM_SEEK_END, &fileSize));
- return (fileSize == _totalSize) ? S_OK : S_FALSE;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- Close();
- RINOK(Open2(inStream));
- _inStream = inStream;
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _inStream.Release();
- _sections.Clear();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _sections.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _sections.Size();
- if (numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- totalSize += _sections[allFilesMode ? i : indices[i]].PSize;
- extractCallback->SetTotal(totalSize);
-
- UInt64 currentTotalSize = 0;
- UInt64 currentItemSize;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- streamSpec->SetStream(_inStream);
-
- for (i = 0; i < numItems; i++, currentTotalSize += currentItemSize)
- {
- lps->InSize = lps->OutSize = currentTotalSize;
- RINOK(lps->SetCur());
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- UInt32 index = allFilesMode ? i : indices[i];
- const CSegment &item = _sections[index];
- currentItemSize = item.PSize;
-
- CMyComPtr<ISequentialOutStream> outStream;
- RINOK(extractCallback->GetStream(index, &outStream, askMode));
- if (!testMode && !outStream)
- continue;
-
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(_inStream->Seek(item.Offset, STREAM_SEEK_SET, NULL));
- streamSpec->Init(currentItemSize);
- RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(copyCoderSpec->TotalSize == currentItemSize ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kDataError));
- }
- return S_OK;
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"ELF", L"", 0, 0xDE, { 0 }, 0, false, CreateArc, 0 };
-
-REGISTER_ARC(Elf)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/FatHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/FatHandler.cpp
deleted file mode 100644
index f07d4ccb7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/FatHandler.cpp
+++ /dev/null
@@ -1,983 +0,0 @@
-// FatHandler.cpp
-
-#include "StdAfx.h"
-
-// #include <stdio.h>
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/Buffer.h"
-#include "Common/ComTry.h"
-#include "Common/IntToString.h"
-#include "Common/MyCom.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-
-#include "Common/DummyOutStream.h"
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-
-#define PRF(x) /* x */
-
-namespace NArchive {
-namespace NFat {
-
-static const UInt32 kFatItemUsedByDirMask = (UInt32)1 << 31;
-
-struct CHeader
-{
- UInt32 NumSectors;
- UInt16 NumReservedSectors;
- Byte NumFats;
- UInt32 NumFatSectors;
- UInt32 RootDirSector;
- UInt32 NumRootDirSectors;
- UInt32 DataSector;
-
- UInt32 FatSize;
- UInt32 BadCluster;
-
- Byte NumFatBits;
- Byte SectorSizeLog;
- Byte SectorsPerClusterLog;
- Byte ClusterSizeLog;
-
- UInt16 SectorsPerTrack;
- UInt16 NumHeads;
- UInt32 NumHiddenSectors;
-
- bool VolFieldsDefined;
-
- UInt32 VolId;
- // Byte VolName[11];
- // Byte FileSys[8];
-
- // Byte OemName[5];
- Byte MediaType;
-
- // 32-bit FAT
- UInt16 Flags;
- UInt16 FsInfoSector;
- UInt32 RootCluster;
-
- bool IsFat32() const { return NumFatBits == 32; }
- UInt64 GetPhySize() const { return (UInt64)NumSectors << SectorSizeLog; }
- UInt32 SectorSize() const { return (UInt32)1 << SectorSizeLog; }
- UInt32 ClusterSize() const { return (UInt32)1 << ClusterSizeLog; }
- UInt32 ClusterToSector(UInt32 c) const { return DataSector + ((c - 2) << SectorsPerClusterLog); }
- UInt32 IsEoc(UInt32 c) const { return c > BadCluster; }
- UInt32 IsEocAndUnused(UInt32 c) const { return c > BadCluster && (c & kFatItemUsedByDirMask) == 0; }
- UInt32 IsValidCluster(UInt32 c) const { return c >= 2 && c < FatSize; }
- UInt32 SizeToSectors(UInt32 size) const { return (size + SectorSize() - 1) >> SectorSizeLog; }
- UInt32 CalcFatSizeInSectors() const { return SizeToSectors((FatSize * (NumFatBits / 4) + 1) / 2); }
-
- UInt32 GetFatSector() const
- {
- UInt32 index = (IsFat32() && (Flags & 0x80) != 0) ? (Flags & 0xF) : 0;
- if (index > NumFats)
- index = 0;
- return NumReservedSectors + index * NumFatSectors;
- }
-
- UInt64 GetFilePackSize(UInt32 unpackSize) const
- {
- UInt64 mask = ClusterSize() - 1;
- return (unpackSize + mask) & ~mask;
- }
-
- UInt32 GetNumClusters(UInt32 size) const
- { return (UInt32)(((UInt64)size + ClusterSize() - 1) >> ClusterSizeLog); }
-
- bool Parse(const Byte *p);
-};
-
-static int GetLog(UInt32 num)
-{
- for (int i = 0; i < 31; i++)
- if (((UInt32)1 << i) == num)
- return i;
- return -1;
-}
-
-bool CHeader::Parse(const Byte *p)
-{
- if (p[0x1FE] != 0x55 || p[0x1FF] != 0xAA)
- return false;
-
- int codeOffset = 0;
- switch (p[0])
- {
- case 0xE9: codeOffset = 3 + (Int16)Get16(p + 1); break;
- case 0xEB: if (p[2] != 0x90) return false; codeOffset = 2 + (signed char)p[1]; break;
- default: return false;
- }
- {
- int s = GetLog(Get16(p + 11));
- if (s < 9 || s > 12)
- return false;
- SectorSizeLog = (Byte)s;
- s = GetLog(p[13]);
- if (s < 0)
- return false;
- SectorsPerClusterLog = (Byte)s;
- ClusterSizeLog = SectorSizeLog + SectorsPerClusterLog;
- }
-
- NumReservedSectors = Get16(p + 14);
- if (NumReservedSectors == 0)
- return false;
-
- NumFats = p[16];
- if (NumFats < 1 || NumFats > 4)
- return false;
-
- UInt16 numRootDirEntries = Get16(p + 17);
- if (numRootDirEntries == 0)
- {
- if (codeOffset < 90)
- return false;
- NumFatBits = 32;
- NumRootDirSectors = 0;
- }
- else
- {
- if (codeOffset < 62)
- return false;
- NumFatBits = 0;
- UInt32 mask = (1 << (SectorSizeLog - 5)) - 1;
- if ((numRootDirEntries & mask) != 0)
- return false;
- NumRootDirSectors = (numRootDirEntries + mask) >> (SectorSizeLog - 5);
- }
-
- NumSectors = Get16(p + 19);
- if (NumSectors == 0)
- NumSectors = Get32(p + 32);
- else if (IsFat32())
- return false;
-
- MediaType = p[21];
- NumFatSectors = Get16(p + 22);
- SectorsPerTrack = Get16(p + 24);
- NumHeads = Get16(p + 26);
- NumHiddenSectors = Get32(p + 28);
-
- // memcpy(OemName, p + 3, 5);
-
- p += 36;
- if (IsFat32())
- {
- if (NumFatSectors != 0)
- return false;
- NumFatSectors = Get32(p);
- if (NumFatSectors >= (1 << 24))
- return false;
-
- Flags = Get16(p + 4);
- if (Get16(p + 6) != 0)
- return false;
- RootCluster = Get32(p + 8);
- FsInfoSector = Get16(p + 12);
- for (int i = 16; i < 28; i++)
- if (p[i] != 0)
- return false;
- p += 28;
- }
-
- // DriveNumber = p[0];
- VolFieldsDefined = (p[2] == 0x29); // ExtendedBootSig
- VolId = Get32(p + 3);
- // memcpy(VolName, p + 7, 11);
- // memcpy(FileSys, p + 18, 8);
-
- if (NumFatSectors == 0)
- return false;
- RootDirSector = NumReservedSectors + NumFatSectors * NumFats;
- DataSector = RootDirSector + NumRootDirSectors;
- if (NumSectors < DataSector)
- return false;
- UInt32 numDataSectors = NumSectors - DataSector;
- UInt32 numClusters = numDataSectors >> SectorsPerClusterLog;
-
- BadCluster = 0x0FFFFFF7;
- if (numClusters < 0xFFF5)
- {
- if (NumFatBits == 32)
- return false;
- NumFatBits = (numClusters < 0xFF5) ? 12: 16;
- BadCluster &= ((1 << NumFatBits) - 1);
- }
- else if (NumFatBits != 32)
- return false;
-
- FatSize = numClusters + 2;
- if (FatSize > BadCluster || CalcFatSizeInSectors() > NumFatSectors)
- return false;
- return true;
-}
-
-struct CItem
-{
- UString UName;
- char DosName[11];
- Byte CTime2;
- UInt32 CTime;
- UInt32 MTime;
- UInt16 ADate;
- Byte Attrib;
- Byte Flags;
- UInt32 Size;
- UInt32 Cluster;
- Int32 Parent;
-
- // NT uses Flags to store Low Case status
- bool NameIsLow() const { return (Flags & 0x8) != 0; }
- bool ExtIsLow() const { return (Flags & 0x10) != 0; }
- bool IsDir() const { return (Attrib & 0x10) != 0; }
- UString GetShortName() const;
- UString GetName() const;
- UString GetVolName() const;
-};
-
-static int CopyAndTrim(char *dest, const char *src, int size, bool toLower)
-{
- int i;
- memcpy(dest, src, size);
- if (toLower)
- for (i = 0; i < size; i++)
- {
- char c = dest[i];
- if (c >= 'A' && c <= 'Z')
- dest[i] = c + 0x20;
- }
- for (i = size - 1; i >= 0 && dest[i] == ' '; i--);
- return i + 1;
-}
-
-static UString FatStringToUnicode(const char *s)
-{
- return MultiByteToUnicodeString(s, CP_OEMCP);
-}
-
-UString CItem::GetShortName() const
-{
- char s[16];
- int i = CopyAndTrim(s, DosName, 8, NameIsLow());
- s[i++] = '.';
- int j = CopyAndTrim(s + i, DosName + 8, 3, ExtIsLow());
- if (j == 0)
- j--;
- s[i + j] = 0;
- return FatStringToUnicode(s);
-}
-
-UString CItem::GetName() const
-{
- if (!UName.IsEmpty())
- return UName;
- return GetShortName();
-}
-
-UString CItem::GetVolName() const
-{
- if (!UName.IsEmpty())
- return UName;
- char s[12];
- int i = CopyAndTrim(s, DosName, 11, false);
- s[i] = 0;
- return FatStringToUnicode(s);
-}
-
-struct CDatabase
-{
- CHeader Header;
- CObjectVector<CItem> Items;
- UInt32 *Fat;
- CMyComPtr<IInStream> InStream;
- IArchiveOpenCallback *OpenCallback;
-
- UInt32 NumFreeClusters;
- bool VolItemDefined;
- CItem VolItem;
- UInt32 NumDirClusters;
- CByteBuffer ByteBuf;
- UInt64 NumCurUsedBytes;
-
- CDatabase(): Fat(0) {}
- ~CDatabase() { ClearAndClose(); }
-
- void Clear();
- void ClearAndClose();
- HRESULT OpenProgressFat(bool changeTotal = true);
- HRESULT OpenProgress();
-
- UString GetItemPath(Int32 index) const;
- HRESULT Open();
- HRESULT ReadDir(Int32 parent, UInt32 cluster, int level);
-
- UInt64 GetHeadersSize() const
- {
- return (UInt64)(Header.DataSector + (NumDirClusters << Header.SectorsPerClusterLog)) << Header.SectorSizeLog;
- }
- HRESULT SeekToSector(UInt32 sector);
- HRESULT SeekToCluster(UInt32 cluster) { return SeekToSector(Header.ClusterToSector(cluster)); }
-};
-
-HRESULT CDatabase::SeekToSector(UInt32 sector)
-{
- return InStream->Seek((UInt64)sector << Header.SectorSizeLog, STREAM_SEEK_SET, NULL);
-}
-
-void CDatabase::Clear()
-{
- VolItemDefined = false;
- NumDirClusters = 0;
- NumCurUsedBytes = 0;
-
- Items.Clear();
- delete []Fat;
- Fat = 0;
-}
-
-void CDatabase::ClearAndClose()
-{
- Clear();
- InStream.Release();
-}
-
-HRESULT CDatabase::OpenProgressFat(bool changeTotal)
-{
- if (!OpenCallback)
- return S_OK;
- if (changeTotal)
- {
- UInt64 numTotalBytes = (Header.CalcFatSizeInSectors() << Header.SectorSizeLog) +
- ((UInt64)(Header.FatSize - NumFreeClusters) << Header.ClusterSizeLog);
- RINOK(OpenCallback->SetTotal(NULL, &numTotalBytes));
- }
- return OpenCallback->SetCompleted(NULL, &NumCurUsedBytes);
-}
-
-HRESULT CDatabase::OpenProgress()
-{
- if (!OpenCallback)
- return S_OK;
- UInt64 numItems = Items.Size();
- return OpenCallback->SetCompleted(&numItems, &NumCurUsedBytes);
-}
-
-UString CDatabase::GetItemPath(Int32 index) const
-{
- const CItem *item = &Items[index];
- UString name = item->GetName();
- for (;;)
- {
- index = item->Parent;
- if (index < 0)
- return name;
- item = &Items[index];
- name = item->GetName() + WCHAR_PATH_SEPARATOR + name;
- }
-}
-
-static wchar_t *AddSubStringToName(wchar_t *dest, const Byte *p, int numChars)
-{
- for (int i = 0; i < numChars; i++)
- {
- wchar_t c = Get16(p + i * 2);
- if (c != 0 && c != 0xFFFF)
- *dest++ = c;
- }
- *dest = 0;
- return dest;
-}
-
-HRESULT CDatabase::ReadDir(Int32 parent, UInt32 cluster, int level)
-{
- int startIndex = Items.Size();
- if (startIndex >= (1 << 30) || level > 256)
- return S_FALSE;
-
- UInt32 sectorIndex = 0;
- UInt32 blockSize = Header.ClusterSize();
- bool clusterMode = (Header.IsFat32() || parent >= 0);
- if (!clusterMode)
- {
- blockSize = Header.SectorSize();
- RINOK(SeekToSector(Header.RootDirSector));
- }
-
- ByteBuf.SetCapacity(blockSize);
- UString curName;
- int checkSum = -1;
- int numLongRecords = -1;
- for (UInt32 pos = blockSize;; pos += 32)
- {
- if (pos == blockSize)
- {
- pos = 0;
-
- if ((NumDirClusters & 0xFF) == 0)
- {
- RINOK(OpenProgress());
- }
-
- if (clusterMode)
- {
- if (Header.IsEoc(cluster))
- break;
- if (!Header.IsValidCluster(cluster))
- return S_FALSE;
- PRF(printf("\nCluster = %4X", cluster));
- RINOK(SeekToCluster(cluster));
- UInt32 newCluster = Fat[cluster];
- if ((newCluster & kFatItemUsedByDirMask) != 0)
- return S_FALSE;
- Fat[cluster] |= kFatItemUsedByDirMask;
- cluster = newCluster;
- NumDirClusters++;
- NumCurUsedBytes += Header.ClusterSize();
- }
- else if (sectorIndex++ >= Header.NumRootDirSectors)
- break;
-
- RINOK(ReadStream_FALSE(InStream, ByteBuf, blockSize));
- }
- const Byte *p = ByteBuf + pos;
- if (p[0] == 0)
- {
- if (clusterMode && !Header.IsEoc(cluster))
- return S_FALSE;
- break;
- }
- if (p[0] == 0xE5)
- {
- if (numLongRecords > 0)
- return S_FALSE;
- continue;
- }
-
- Byte attrib = p[11];
- if ((attrib & 0x3F) == 0xF)
- {
- if (p[0] > 0x7F || Get16(p + 26) != 0)
- return S_FALSE;
- int longIndex = p[0] & 0x3F;
- if (longIndex == 0)
- return S_FALSE;
- bool isLast = (p[0] & 0x40) != 0;
- if (numLongRecords < 0)
- {
- if (!isLast)
- return S_FALSE;
- numLongRecords = longIndex;
- }
- else if (isLast || numLongRecords != longIndex)
- return S_FALSE;
-
- numLongRecords--;
-
- if (p[12] == 0)
- {
- wchar_t nameBuf[14];
- wchar_t *dest;
-
- dest = AddSubStringToName(nameBuf, p + 1, 5);
- dest = AddSubStringToName(dest, p + 14, 6);
- AddSubStringToName(dest, p + 28, 2);
- curName = nameBuf + curName;
- if (isLast)
- checkSum = p[13];
- if (checkSum != p[13])
- return S_FALSE;
- }
- }
- else
- {
- if (numLongRecords > 0)
- return S_FALSE;
- CItem item;
- memcpy(item.DosName, p, 11);
-
- if (checkSum >= 0)
- {
- Byte sum = 0;
- for (int i = 0; i < 11; i++)
- sum = ((sum & 1) ? 0x80 : 0) + (sum >> 1) + (Byte)item.DosName[i];
- if (sum == checkSum)
- item.UName = curName;
- }
-
- if (item.DosName[0] == 5)
- item.DosName[0] = (char)(Byte)0xE5;
- item.Attrib = attrib;
- item.Flags = p[12];
- item.Size = Get32(p + 28);
- item.Cluster = Get16(p + 26) | ((UInt32)Get16(p + 20) << 16);
- item.CTime = Get32(p + 14);
- item.CTime2 = p[13];
- item.ADate = Get16(p + 18);
- item.MTime = Get32(p + 22);
- item.Parent = parent;
-
- if (attrib == 8)
- {
- VolItem = item;
- VolItemDefined = true;
- }
- else
- if (memcmp(item.DosName, ". ", 11) != 0 &&
- memcmp(item.DosName, ".. ", 11) != 0)
- {
- if (!item.IsDir())
- NumCurUsedBytes += Header.GetFilePackSize(item.Size);
- Items.Add(item);
- PRF(printf("\n%7d: %S", Items.Size(), GetItemPath(Items.Size() - 1)));
- }
- numLongRecords = -1;
- curName.Empty();
- checkSum = -1;
- }
- }
-
- int finishIndex = Items.Size();
- for (int i = startIndex; i < finishIndex; i++)
- {
- const CItem &item = Items[i];
- if (item.IsDir())
- {
- PRF(printf("\n%S", GetItemPath(i)));
- RINOK(CDatabase::ReadDir(i, item.Cluster, level + 1));
- }
- }
- return S_OK;
-}
-
-HRESULT CDatabase::Open()
-{
- Clear();
- bool numFreeClustersDefined = false;
- {
- static const UInt32 kHeaderSize = 512;
- Byte buf[kHeaderSize];
- RINOK(ReadStream_FALSE(InStream, buf, kHeaderSize));
- if (!Header.Parse(buf))
- return S_FALSE;
- UInt64 fileSize;
- RINOK(InStream->Seek(0, STREAM_SEEK_END, &fileSize));
- if (fileSize < Header.GetPhySize())
- return S_FALSE;
-
- if (Header.IsFat32())
- {
- SeekToSector(Header.FsInfoSector);
- RINOK(ReadStream_FALSE(InStream, buf, kHeaderSize));
- if (buf[0x1FE] != 0x55 || buf[0x1FF] != 0xAA)
- return S_FALSE;
- if (Get32(buf) == 0x41615252 && Get32(buf + 484) == 0x61417272)
- {
- NumFreeClusters = Get32(buf + 488);
- numFreeClustersDefined = (NumFreeClusters <= Header.FatSize);
- }
- }
- }
-
- // numFreeClustersDefined = false; // to recalculate NumFreeClusters
- if (!numFreeClustersDefined)
- NumFreeClusters = 0;
-
- CByteBuffer byteBuf;
- Fat = new UInt32[Header.FatSize];
-
- RINOK(OpenProgressFat());
- RINOK(SeekToSector(Header.GetFatSector()));
- if (Header.NumFatBits == 32)
- {
- const UInt32 kBufSize = (1 << 15);
- byteBuf.SetCapacity(kBufSize);
- for (UInt32 i = 0; i < Header.FatSize;)
- {
- UInt32 size = Header.FatSize - i;
- const UInt32 kBufSize32 = kBufSize / 4;
- if (size > kBufSize32)
- size = kBufSize32;
- UInt32 readSize = Header.SizeToSectors(size * 4) << Header.SectorSizeLog;
- RINOK(ReadStream_FALSE(InStream, byteBuf, readSize));
- NumCurUsedBytes += readSize;
-
- const UInt32 *src = (const UInt32 *)(const Byte *)byteBuf;
- UInt32 *dest = Fat + i;
- if (numFreeClustersDefined)
- for (UInt32 j = 0; j < size; j++)
- dest[j] = Get32(src + j) & 0x0FFFFFFF;
- else
- {
- UInt32 numFreeClusters = 0;
- for (UInt32 j = 0; j < size; j++)
- {
- UInt32 v = Get32(src + j) & 0x0FFFFFFF;
- numFreeClusters += (UInt32)(v - 1) >> 31;
- dest[j] = v;
- }
- NumFreeClusters += numFreeClusters;
- }
- i += size;
- if ((i & 0xFFFFF) == 0)
- {
- RINOK(OpenProgressFat(!numFreeClustersDefined));
- }
- }
- }
- else
- {
- const UInt32 kBufSize = (UInt32)Header.CalcFatSizeInSectors() << Header.SectorSizeLog;
- NumCurUsedBytes += kBufSize;
- byteBuf.SetCapacity(kBufSize);
- Byte *p = byteBuf;
- RINOK(ReadStream_FALSE(InStream, p, kBufSize));
- UInt32 fatSize = Header.FatSize;
- UInt32 *fat = &Fat[0];
- if (Header.NumFatBits == 16)
- for (UInt32 j = 0; j < fatSize; j++)
- fat[j] = Get16(p + j * 2);
- else
- for (UInt32 j = 0; j < fatSize; j++)
- fat[j] = (Get16(p + j * 3 / 2) >> ((j & 1) << 2)) & 0xFFF;
-
- if (!numFreeClustersDefined)
- {
- UInt32 numFreeClusters = 0;
- for (UInt32 i = 0; i < fatSize; i++)
- numFreeClusters += (UInt32)(fat[i] - 1) >> 31;
- NumFreeClusters = numFreeClusters;
- }
- }
-
- RINOK(OpenProgressFat());
-
- if ((Fat[0] & 0xFF) != Header.MediaType)
- return S_FALSE;
-
- return ReadDir(-1, Header.RootCluster, 0);
-}
-
-class CHandler:
- public IInArchive,
- public IInArchiveGetStream,
- public CMyUnknownImp,
- CDatabase
-{
-public:
- MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
- INTERFACE_IInArchive(;)
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-};
-
-STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
-{
- COM_TRY_BEGIN
- *stream = 0;
- const CItem &item = Items[index];
- CClusterInStream *streamSpec = new CClusterInStream;
- CMyComPtr<ISequentialInStream> streamTemp = streamSpec;
- streamSpec->Stream = InStream;
- streamSpec->StartOffset = Header.DataSector << Header.SectorSizeLog;
- streamSpec->BlockSizeLog = Header.ClusterSizeLog;
- streamSpec->Size = item.Size;
-
- UInt32 numClusters = Header.GetNumClusters(item.Size);
- streamSpec->Vector.Reserve(numClusters);
- UInt32 cluster = item.Cluster;
- UInt32 size = item.Size;
-
- if (size == 0)
- {
- if (cluster != 0)
- return S_FALSE;
- }
- else
- {
- UInt32 clusterSize = Header.ClusterSize();
- for (;; size -= clusterSize)
- {
- if (!Header.IsValidCluster(cluster))
- return S_FALSE;
- streamSpec->Vector.Add(cluster - 2);
- cluster = Fat[cluster];
- if (size <= clusterSize)
- break;
- }
- if (!Header.IsEocAndUnused(cluster))
- return S_FALSE;
- }
- RINOK(streamSpec->InitAndSeek());
- *stream = streamTemp.Detach();
- return S_OK;
- COM_TRY_END
-}
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidATime, VT_FILETIME},
- { NULL, kpidAttrib, VT_UI8},
- { NULL, kpidShortName, VT_BSTR}
-};
-
-enum
-{
- kpidNumFats = kpidUserDefined
- // kpidOemName,
- // kpidVolName,
- // kpidFileSysType
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidFileSystem, VT_BSTR},
- { NULL, kpidClusterSize, VT_UI4},
- { NULL, kpidPhySize, VT_UI8},
- { NULL, kpidFreeSpace, VT_UI8},
- { NULL, kpidHeadersSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidVolumeName, VT_BSTR},
-
- { L"FATs", kpidNumFats, VT_UI4},
- { NULL, kpidSectorSize, VT_UI4},
- { NULL, kpidId, VT_UI4},
- // { L"OEM Name", kpidOemName, VT_BSTR},
- // { L"Volume Name", kpidVolName, VT_BSTR},
- // { L"File System Type", kpidFileSysType, VT_BSTR}
- // { NULL, kpidSectorsPerTrack, VT_UI4},
- // { NULL, kpidNumHeads, VT_UI4},
- // { NULL, kpidHiddenSectors, VT_UI4}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_WITH_NAME
-
-static void FatTimeToProp(UInt32 dosTime, UInt32 ms10, NWindows::NCOM::CPropVariant &prop)
-{
- FILETIME localFileTime, utc;
- if (NWindows::NTime::DosTimeToFileTime(dosTime, localFileTime))
- if (LocalFileTimeToFileTime(&localFileTime, &utc))
- {
- UInt64 t64 = (((UInt64)utc.dwHighDateTime) << 32) + utc.dwLowDateTime;
- t64 += ms10 * 100000;
- utc.dwLowDateTime = (DWORD)t64;
- utc.dwHighDateTime = (DWORD)(t64 >> 32);
- prop = utc;
- }
-}
-
-/*
-static void StringToProp(const Byte *src, int size, NWindows::NCOM::CPropVariant &prop)
-{
- char dest[32];
- memcpy(dest, src, size);
- dest[size] = 0;
- prop = FatStringToUnicode(dest);
-}
-
-#define STRING_TO_PROP(s, p) StringToProp(s, sizeof(s), prop)
-*/
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidFileSystem:
- {
- wchar_t s[32] = { L'F', L'A', L'T' };
- ConvertUInt32ToString(Header.NumFatBits, s + 3);
- prop = s;
- break;
- }
- case kpidClusterSize: prop = Header.ClusterSize(); break;
- case kpidPhySize: prop = Header.GetPhySize(); break;
- case kpidFreeSpace: prop = (UInt64)NumFreeClusters << Header.ClusterSizeLog; break;
- case kpidHeadersSize: prop = GetHeadersSize(); break;
- case kpidMTime: if (VolItemDefined) FatTimeToProp(VolItem.MTime, 0, prop); break;
- case kpidVolumeName: if (VolItemDefined) prop = VolItem.GetVolName(); break;
- case kpidNumFats: if (Header.NumFats != 2) prop = Header.NumFats; break;
- case kpidSectorSize: prop = (UInt32)1 << Header.SectorSizeLog; break;
- // case kpidSectorsPerTrack: prop = Header.SectorsPerTrack; break;
- // case kpidNumHeads: prop = Header.NumHeads; break;
- // case kpidOemName: STRING_TO_PROP(Header.OemName, prop); break;
- case kpidId: if (Header.VolFieldsDefined) prop = Header.VolId; break;
- // case kpidVolName: if (Header.VolFieldsDefined) STRING_TO_PROP(Header.VolName, prop); break;
- // case kpidFileSysType: if (Header.VolFieldsDefined) STRING_TO_PROP(Header.FileSys, prop); break;
- // case kpidHiddenSectors: prop = Header.NumHiddenSectors; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- const CItem &item = Items[index];
- switch(propID)
- {
- case kpidPath: prop = GetItemPath(index); break;
- case kpidShortName: prop = item.GetShortName(); break;
- case kpidIsDir: prop = item.IsDir(); break;
- case kpidMTime: FatTimeToProp(item.MTime, 0, prop); break;
- case kpidCTime: FatTimeToProp(item.CTime, item.CTime2, prop); break;
- case kpidATime: FatTimeToProp(((UInt32)item.ADate << 16), 0, prop); break;
- case kpidAttrib: prop = (UInt32)item.Attrib; break;
- case kpidSize: if (!item.IsDir()) prop = item.Size; break;
- case kpidPackSize: if (!item.IsDir()) prop = Header.GetFilePackSize(item.Size); break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 *, IArchiveOpenCallback *callback)
-{
- COM_TRY_BEGIN
- {
- OpenCallback = callback;
- InStream = stream;
- HRESULT res;
- try
- {
- res = CDatabase::Open();
- if (res == S_OK)
- return S_OK;
- }
- catch(...)
- {
- Close();
- throw;
- }
- Close();
- return res;
- }
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- ClearAndClose();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = Items.Size();
- if (numItems == 0)
- return S_OK;
- UInt32 i;
- UInt64 totalSize = 0;
- for (i = 0; i < numItems; i++)
- {
- const CItem &item = Items[allFilesMode ? i : indices[i]];
- if (!item.IsDir())
- totalSize += item.Size;
- }
- RINOK(extractCallback->SetTotal(totalSize));
-
- UInt64 totalPackSize;
- totalSize = totalPackSize = 0;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CDummyOutStream *outStreamSpec = new CDummyOutStream;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
-
- for (i = 0; i < numItems; i++)
- {
- lps->InSize = totalPackSize;
- lps->OutSize = totalSize;
- RINOK(lps->SetCur());
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- Int32 index = allFilesMode ? i : indices[i];
- const CItem &item = Items[index];
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
- if (item.IsDir())
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
-
- totalPackSize += Header.GetFilePackSize(item.Size);
- totalSize += item.Size;
-
- if (!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
-
- outStreamSpec->SetStream(realOutStream);
- realOutStream.Release();
- outStreamSpec->Init();
-
- int res = NArchive::NExtract::NOperationResult::kDataError;
- CMyComPtr<ISequentialInStream> inStream;
- HRESULT hres = GetStream(index, &inStream);
- if (hres != S_FALSE)
- {
- RINOK(hres);
- if (inStream)
- {
- RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
- if (copyCoderSpec->TotalSize == item.Size)
- res = NArchive::NExtract::NOperationResult::kOK;
- }
- }
- outStreamSpec->ReleaseStream();
- RINOK(extractCallback->SetOperationResult(res));
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = Items.Size();
- return S_OK;
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"FAT", L"fat img", 0, 0xDA, { 0x55, 0xAA }, 2, false, CreateArc, 0 };
-
-REGISTER_ARC(Fat)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/GzHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/GzHandler.cpp
deleted file mode 100644
index 8165f1e69..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/GzHandler.cpp
+++ /dev/null
@@ -1,824 +0,0 @@
-// GzHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/ComTry.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-#include "../Compress/DeflateDecoder.h"
-#include "../Compress/DeflateEncoder.h"
-
-#include "Common/InStreamWithCRC.h"
-#include "Common/OutStreamWithCRC.h"
-#include "Common/ParseProperties.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-#define Get32(p) GetUi32(p)
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NGz {
-
-static const UInt16 kSignature = 0x8B1F;
-
-namespace NHeader
-{
- namespace NFlags
- {
- const Byte kIsText = 1 << 0;
- const Byte kCrc = 1 << 1;
- const Byte kExtra = 1 << 2;
- const Byte kName = 1 << 3;
- const Byte kComment = 1 << 4;
- }
-
- namespace NExtraFlags
- {
- const Byte kMaximum = 2;
- const Byte kFastest = 4;
- }
-
- namespace NCompressionMethod
- {
- const Byte kDeflate = 8;
- }
-
- namespace NHostOS
- {
- enum EEnum
- {
- kFAT = 0,
- kAMIGA,
- kVMS,
- kUnix,
- kVM_CMS,
- kAtari,
- kHPFS,
- kMac,
- kZ_System,
- kCPM,
- kTOPS20,
- kNTFS,
- kQDOS,
- kAcorn,
- kVFAT,
- kMVS,
- kBeOS,
- kTandem,
-
- kUnknown = 255
- };
- }
-}
-
-static const char *kHostOSes[] =
-{
- "FAT",
- "AMIGA",
- "VMS",
- "Unix",
- "VM/CMS",
- "Atari",
- "HPFS",
- "Macintosh",
- "Z-System",
- "CP/M",
- "TOPS-20",
- "NTFS",
- "SMS/QDOS",
- "Acorn",
- "VFAT",
- "MVS",
- "BeOS",
- "Tandem",
- "OS/400",
- "OS/X"
-};
-
-static const char *kUnknownOS = "Unknown";
-
-class CItem
-{
- bool TestFlag(Byte flag) const { return (Flags & flag) != 0; }
-public:
- Byte Method;
- Byte Flags;
- Byte ExtraFlags;
- Byte HostOS;
- UInt32 Time;
- UInt32 Crc;
- UInt32 Size32;
-
- AString Name;
- AString Comment;
- // CByteBuffer Extra;
-
- // bool IsText() const { return TestFlag(NHeader::NFlags::kIsText); }
- bool HeaderCrcIsPresent() const { return TestFlag(NHeader::NFlags::kCrc); }
- bool ExtraFieldIsPresent() const { return TestFlag(NHeader::NFlags::kExtra); }
- bool NameIsPresent() const { return TestFlag(NHeader::NFlags::kName); }
- bool CommentIsPresent() const { return TestFlag(NHeader::NFlags::kComment); }
-
- void Clear()
- {
- Name.Empty();
- Comment.Empty();
- // Extra.SetCapacity(0);
- }
-
- HRESULT ReadHeader(NCompress::NDeflate::NDecoder::CCOMCoder *stream);
- HRESULT ReadFooter1(NCompress::NDeflate::NDecoder::CCOMCoder *stream);
- HRESULT ReadFooter2(ISequentialInStream *stream);
-
- HRESULT WriteHeader(ISequentialOutStream *stream);
- HRESULT WriteFooter(ISequentialOutStream *stream);
-};
-
-static HRESULT ReadBytes(NCompress::NDeflate::NDecoder::CCOMCoder *stream, Byte *data, UInt32 size)
-{
- for (UInt32 i = 0; i < size; i++)
- data[i] = stream->ReadByte();
- return stream->InputEofError() ? S_FALSE : S_OK;
-}
-
-static HRESULT SkipBytes(NCompress::NDeflate::NDecoder::CCOMCoder *stream, UInt32 size)
-{
- for (UInt32 i = 0; i < size; i++)
- stream->ReadByte();
- return stream->InputEofError() ? S_FALSE : S_OK;
-}
-
-static HRESULT ReadUInt16(NCompress::NDeflate::NDecoder::CCOMCoder *stream, UInt16 &value /* , UInt32 &crc */)
-{
- value = 0;
- for (int i = 0; i < 2; i++)
- {
- Byte b = stream->ReadByte();
- if (stream->InputEofError())
- return S_FALSE;
- // crc = CRC_UPDATE_BYTE(crc, b);
- value |= (UInt16(b) << (8 * i));
- }
- return S_OK;
-}
-
-static HRESULT ReadString(NCompress::NDeflate::NDecoder::CCOMCoder *stream, AString &s, UInt32 limit /* , UInt32 &crc */)
-{
- s.Empty();
- for (UInt32 i = 0; i < limit; i++)
- {
- Byte b = stream->ReadByte();
- if (stream->InputEofError())
- return S_FALSE;
- // crc = CRC_UPDATE_BYTE(crc, b);
- if (b == 0)
- return S_OK;
- s += (char)b;
- }
- return S_FALSE;
-}
-
-HRESULT CItem::ReadHeader(NCompress::NDeflate::NDecoder::CCOMCoder *stream)
-{
- Clear();
-
- // Header-CRC field had another meaning in old version of gzip!
- // UInt32 crc = CRC_INIT_VAL;
- Byte buf[10];
-
- RINOK(ReadBytes(stream, buf, 10));
-
- if (GetUi16(buf) != kSignature)
- return S_FALSE;
-
- Method = buf[2];
-
- if (Method != NHeader::NCompressionMethod::kDeflate)
- return S_FALSE;
-
- Flags = buf[3];
- Time = Get32(buf + 4);
- ExtraFlags = buf[8];
- HostOS = buf[9];
-
- // crc = CrcUpdate(crc, buf, 10);
-
- if (ExtraFieldIsPresent())
- {
- UInt16 extraSize;
- RINOK(ReadUInt16(stream, extraSize /* , crc */));
- RINOK(SkipBytes(stream, extraSize));
- // Extra.SetCapacity(extraSize);
- // RINOK(ReadStream_FALSE(stream, Extra, extraSize));
- // crc = CrcUpdate(crc, Extra, extraSize);
- }
- if (NameIsPresent())
- RINOK(ReadString(stream, Name, (1 << 10) /* , crc */));
- if (CommentIsPresent())
- RINOK(ReadString(stream, Comment, (1 << 16) /* , crc */));
-
- if (HeaderCrcIsPresent())
- {
- UInt16 headerCRC;
- // UInt32 dummy = 0;
- RINOK(ReadUInt16(stream, headerCRC /* , dummy */));
- /*
- if ((UInt16)CRC_GET_DIGEST(crc) != headerCRC)
- return S_FALSE;
- */
- }
- return stream->InputEofError() ? S_FALSE : S_OK;
-}
-
-HRESULT CItem::ReadFooter1(NCompress::NDeflate::NDecoder::CCOMCoder *stream)
-{
- Byte buf[8];
- RINOK(ReadBytes(stream, buf, 8));
- Crc = Get32(buf);
- Size32 = Get32(buf + 4);
- return stream->InputEofError() ? S_FALSE : S_OK;
-}
-
-HRESULT CItem::ReadFooter2(ISequentialInStream *stream)
-{
- Byte buf[8];
- RINOK(ReadStream_FALSE(stream, buf, 8));
- Crc = Get32(buf);
- Size32 = Get32(buf + 4);
- return S_OK;
-}
-
-HRESULT CItem::WriteHeader(ISequentialOutStream *stream)
-{
- Byte buf[10];
- SetUi16(buf, kSignature);
- buf[2] = Method;
- buf[3] = Flags & NHeader::NFlags::kName;
- // buf[3] |= NHeader::NFlags::kCrc;
- SetUi32(buf + 4, Time);
- buf[8] = ExtraFlags;
- buf[9] = HostOS;
- RINOK(WriteStream(stream, buf, 10));
- // crc = CrcUpdate(CRC_INIT_VAL, buf, 10);
- if (NameIsPresent())
- {
- // crc = CrcUpdate(crc, (const char *)Name, Name.Length() + 1);
- RINOK(WriteStream(stream, (const char *)Name, Name.Length() + 1));
- }
- // SetUi16(buf, (UInt16)CRC_GET_DIGEST(crc));
- // RINOK(WriteStream(stream, buf, 2));
- return S_OK;
-}
-
-HRESULT CItem::WriteFooter(ISequentialOutStream *stream)
-{
- Byte buf[8];
- SetUi32(buf, Crc);
- SetUi32(buf + 4, Size32);
- return WriteStream(stream, buf, 8);
-}
-
-static const UInt32 kAlgoX1 = 0;
-static const UInt32 kAlgoX5 = 1;
-
-static const UInt32 kNumPassesX1 = 1;
-static const UInt32 kNumPassesX7 = 3;
-static const UInt32 kNumPassesX9 = 10;
-
-static const UInt32 kNumFastBytesX1 = 32;
-static const UInt32 kNumFastBytesX7 = 64;
-static const UInt32 kNumFastBytesX9 = 128;
-
-struct CCompressMode
-{
- UInt32 NumPasses;
- UInt32 NumFastBytes;
- UInt32 Algo;
- UInt32 Mc;
- bool McDefined;
-
- bool IsMaximum() const { return Algo > 0; }
-
- void Init()
- {
- NumPasses = NumFastBytes = Mc = Algo = 0xFFFFFFFF;
- McDefined = false;
- }
-
- void Normalize(UInt32 level)
- {
- if (level == 0xFFFFFFFF)
- level = 5;
- if (NumPasses == 0xFFFFFFFF)
- NumPasses =
- (level >= 9 ? kNumPassesX9 :
- (level >= 7 ? kNumPassesX7 :
- kNumPassesX1));
- if (NumFastBytes == 0xFFFFFFFF)
- NumFastBytes =
- (level >= 9 ? kNumFastBytesX9 :
- (level >= 7 ? kNumFastBytesX7 :
- kNumFastBytesX1));
- if (Algo == 0xFFFFFFFF)
- Algo = (level >= 5 ?
- kAlgoX5 :
- kAlgoX1);
- }
-};
-
-class CHandler:
- public IInArchive,
- public IArchiveOpenSeq,
- public IOutArchive,
- public ISetProperties,
- public CMyUnknownImp
-{
- CItem _item;
- UInt64 _startPosition;
- UInt64 _headerSize;
- UInt64 _packSize;
- bool _packSizeDefined;
- CMyComPtr<IInStream> _stream;
- CMyComPtr<ICompressCoder> _decoder;
- NCompress::NDeflate::NDecoder::CCOMCoder *_decoderSpec;
-
- CCompressMode _method;
- UInt32 _level;
-
- void InitMethodProperties()
- {
- _level = 0xFFFFFFFF;
- _method.Init();
- }
-
-public:
- MY_UNKNOWN_IMP4(IInArchive, IArchiveOpenSeq, IOutArchive, ISetProperties)
- INTERFACE_IInArchive(;)
- INTERFACE_IOutArchive(;)
- STDMETHOD(OpenSeq)(ISequentialInStream *stream);
- STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProps);
-
- CHandler()
- {
- InitMethodProperties();
- _decoderSpec = new NCompress::NDeflate::NDecoder::CCOMCoder;
- _decoder = _decoderSpec;
- }
-};
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidHostOS, VT_BSTR},
- { NULL, kpidCRC, VT_UI4}
- // { NULL, kpidComment, VT_BSTR}
-}
-;
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO_Table
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidPhySize: if (_packSizeDefined) prop = _packSize; break;
- }
- prop.Detach(value);
- return S_OK;
-}
-
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = 1;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidPath:
- if (_item.NameIsPresent())
- prop = MultiByteToUnicodeString(_item.Name, CP_ACP);
- break;
- // case kpidComment: if (_item.CommentIsPresent()) prop = MultiByteToUnicodeString(_item.Comment, CP_ACP); break;
- case kpidMTime:
- {
- if (_item.Time != 0)
- {
- FILETIME utc;
- NTime::UnixTimeToFileTime(_item.Time, utc);
- prop = utc;
- }
- break;
- }
- case kpidSize: if (_stream) prop = (UInt64)_item.Size32; break;
- case kpidPackSize: if (_packSizeDefined) prop = _packSize; break;
- case kpidHostOS: prop = (_item.HostOS < sizeof(kHostOSes) / sizeof(kHostOSes[0])) ?
- kHostOSes[_item.HostOS] : kUnknownOS; break;
- case kpidCRC: if (_stream) prop = _item.Crc; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 *, IArchiveOpenCallback *)
-{
- COM_TRY_BEGIN
- HRESULT res;
- try
- {
- RINOK(stream->Seek(0, STREAM_SEEK_CUR, &_startPosition));
- res = OpenSeq(stream);
- if (res == S_OK)
- {
- UInt64 endPos;
- res = stream->Seek(-8, STREAM_SEEK_END, &endPos);
- _packSize = endPos + 8 - _startPosition;
- _packSizeDefined = true;
- if (res == S_OK)
- {
- res = _item.ReadFooter2(stream);
- _stream = stream;
- }
- }
- }
- catch(...) { res = S_FALSE; }
- if (res != S_OK)
- Close();
- return res;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::OpenSeq(ISequentialInStream *stream)
-{
- COM_TRY_BEGIN
- HRESULT res;
- try
- {
- Close();
- _decoderSpec->SetInStream(stream);
- _decoderSpec->InitInStream(true);
- res = _item.ReadHeader(_decoderSpec);
- _headerSize = _decoderSpec->GetInputProcessedSize();
- }
- catch(...) { res = S_FALSE; }
- if (res != S_OK)
- Close();
- return res;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _packSizeDefined = false;
- _stream.Release();
- _decoderSpec->ReleaseInStream();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool allFilesMode = (numItems == (UInt32)-1);
- if (!allFilesMode)
- {
- if (numItems == 0)
- return S_OK;
- if (numItems != 1 || indices[0] != 0)
- return E_INVALIDARG;
- }
-
- bool testMode = (_aTestMode != 0);
- if (_stream)
- extractCallback->SetTotal(_packSize);
- UInt64 currentTotalPacked = 0;
- RINOK(extractCallback->SetCompleted(&currentTotalPacked));
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- RINOK(extractCallback->GetStream(0, &realOutStream, askMode));
- if (!testMode && !realOutStream)
- return S_OK;
-
- extractCallback->PrepareOperation(askMode);
-
- COutStreamWithCRC *outStreamSpec = new COutStreamWithCRC;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
- outStreamSpec->SetStream(realOutStream);
- outStreamSpec->Init();
- realOutStream.Release();
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, true);
-
- if (_stream)
- {
- RINOK(_stream->Seek(_startPosition, STREAM_SEEK_SET, NULL));
- _decoderSpec->InitInStream(true);
- }
- bool firstItem = true;
- Int32 opRes = 0;
- for (;;)
- {
- lps->InSize = _packSize = _decoderSpec->GetInputProcessedSize();
- _packSizeDefined = true;
- lps->OutSize = outStreamSpec->GetSize();
- RINOK(lps->SetCur());
-
- CItem item;
- if (!firstItem || _stream)
- {
- HRESULT result = item.ReadHeader(_decoderSpec);
- if (result != S_OK)
- {
- if (result != S_FALSE)
- return result;
- opRes = firstItem ?
- NArchive::NExtract::NOperationResult::kDataError :
- NArchive::NExtract::NOperationResult::kOK;
- break;
- }
- }
- firstItem = false;
-
- UInt64 startOffset = outStreamSpec->GetSize();
- outStreamSpec->InitCRC();
-
- HRESULT result = _decoderSpec->CodeResume(outStream, NULL, progress);
- if (result != S_OK)
- {
- if (result != S_FALSE)
- return result;
- opRes = NArchive::NExtract::NOperationResult::kDataError;
- break;
- }
-
- _decoderSpec->AlignToByte();
- if (item.ReadFooter1(_decoderSpec) != S_OK)
- {
- opRes = NArchive::NExtract::NOperationResult::kDataError;
- break;
- }
- if (item.Crc != outStreamSpec->GetCRC() ||
- item.Size32 != (UInt32)(outStreamSpec->GetSize() - startOffset))
- {
- opRes = NArchive::NExtract::NOperationResult::kCRCError;
- break;
- }
- }
- outStream.Release();
- return extractCallback->SetOperationResult(opRes);
- COM_TRY_END
-}
-
-static const Byte kHostOS =
- #ifdef _WIN32
- NHeader::NHostOS::kFAT;
- #else
- NHeader::NHostOS::kUnix;
- #endif
-
-static HRESULT UpdateArchive(
- ISequentialOutStream *outStream,
- UInt64 unpackSize,
- const CItem &newItem,
- const CCompressMode &compressionMode,
- IArchiveUpdateCallback *updateCallback)
-{
- UInt64 complexity = 0;
- RINOK(updateCallback->SetTotal(unpackSize));
- RINOK(updateCallback->SetCompleted(&complexity));
-
- CMyComPtr<ISequentialInStream> fileInStream;
-
- RINOK(updateCallback->GetStream(0, &fileInStream));
-
- CSequentialInStreamWithCRC *inStreamSpec = new CSequentialInStreamWithCRC;
- CMyComPtr<ISequentialInStream> crcStream(inStreamSpec);
- inStreamSpec->SetStream(fileInStream);
- inStreamSpec->Init();
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(updateCallback, true);
-
- CItem item = newItem;
- item.Method = NHeader::NCompressionMethod::kDeflate;
- item.ExtraFlags = compressionMode.IsMaximum() ?
- NHeader::NExtraFlags::kMaximum :
- NHeader::NExtraFlags::kFastest;
-
- item.HostOS = kHostOS;
-
- RINOK(item.WriteHeader(outStream));
-
- NCompress::NDeflate::NEncoder::CCOMCoder *deflateEncoderSpec = new NCompress::NDeflate::NEncoder::CCOMCoder;
- CMyComPtr<ICompressCoder> deflateEncoder = deflateEncoderSpec;
- {
- NWindows::NCOM::CPropVariant props[] =
- {
- compressionMode.Algo,
- compressionMode.NumPasses,
- compressionMode.NumFastBytes,
- compressionMode.Mc
- };
- PROPID propIDs[] =
- {
- NCoderPropID::kAlgorithm,
- NCoderPropID::kNumPasses,
- NCoderPropID::kNumFastBytes,
- NCoderPropID::kMatchFinderCycles
- };
- int numProps = sizeof(propIDs) / sizeof(propIDs[0]);
- if (!compressionMode.McDefined)
- numProps--;
- RINOK(deflateEncoderSpec->SetCoderProperties(propIDs, props, numProps));
- }
- RINOK(deflateEncoder->Code(crcStream, outStream, NULL, NULL, progress));
-
- item.Crc = inStreamSpec->GetCRC();
- item.Size32 = (UInt32)inStreamSpec->GetSize();
- RINOK(item.WriteFooter(outStream));
- return updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK);
-}
-
-STDMETHODIMP CHandler::GetFileTimeType(UInt32 *timeType)
-{
- *timeType = NFileTimeType::kUnix;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems,
- IArchiveUpdateCallback *updateCallback)
-{
- if (numItems != 1)
- return E_INVALIDARG;
-
- Int32 newData, newProps;
- UInt32 indexInArchive;
- if (!updateCallback)
- return E_FAIL;
- RINOK(updateCallback->GetUpdateItemInfo(0, &newData, &newProps, &indexInArchive));
-
- CItem newItem = _item;
- newItem.ExtraFlags = 0;
- newItem.Flags = 0;
- if (IntToBool(newProps))
- {
- {
- FILETIME utcTime;
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(0, kpidMTime, &prop));
- if (prop.vt != VT_FILETIME)
- return E_INVALIDARG;
- utcTime = prop.filetime;
- if (!NTime::FileTimeToUnixTime(utcTime, newItem.Time))
- return E_INVALIDARG;
- }
- {
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(0, kpidPath, &prop));
- if (prop.vt == VT_BSTR)
- {
- UString name = prop.bstrVal;
- int dirDelimiterPos = name.ReverseFind(CHAR_PATH_SEPARATOR);
- if (dirDelimiterPos >= 0)
- name = name.Mid(dirDelimiterPos + 1);
- newItem.Name = UnicodeStringToMultiByte(name, CP_ACP);
- if (!newItem.Name.IsEmpty())
- newItem.Flags |= NHeader::NFlags::kName;
- }
- else if (prop.vt != VT_EMPTY)
- return E_INVALIDARG;
- }
- {
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(0, kpidIsDir, &prop));
- if (prop.vt == VT_BOOL)
- {
- if (prop.boolVal != VARIANT_FALSE)
- return E_INVALIDARG;
- }
- else if (prop.vt != VT_EMPTY)
- return E_INVALIDARG;
- }
- }
-
- if (IntToBool(newData))
- {
- UInt64 size;
- {
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(0, kpidSize, &prop));
- if (prop.vt != VT_UI8)
- return E_INVALIDARG;
- size = prop.uhVal.QuadPart;
- }
-
- _method.Normalize(_level);
- return UpdateArchive(outStream, size, newItem, _method, updateCallback);
- }
-
- if (indexInArchive != 0)
- return E_INVALIDARG;
-
- if (!_stream)
- return E_NOTIMPL;
-
- UInt64 offset = _startPosition;
- if (IntToBool(newProps))
- {
- newItem.WriteHeader(outStream);
- offset += _headerSize;
- }
- RINOK(_stream->Seek(offset, STREAM_SEEK_SET, NULL));
- return NCompress::CopyStream(_stream, outStream, NULL);
-}
-
-STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProps)
-{
- InitMethodProperties();
- for (int i = 0; i < numProps; i++)
- {
- UString name = names[i];
- name.MakeUpper();
- if (name.IsEmpty())
- return E_INVALIDARG;
- const PROPVARIANT &prop = values[i];
- if (name[0] == L'X')
- {
- UInt32 level = 9;
- RINOK(ParsePropValue(name.Mid(1), prop, level));
- _level = level;
- }
- else if (name.Left(4) == L"PASS")
- {
- UInt32 num = kNumPassesX9;
- RINOK(ParsePropValue(name.Mid(4), prop, num));
- _method.NumPasses = num;
- }
- else if (name.Left(2) == L"FB")
- {
- UInt32 num = kNumFastBytesX9;
- RINOK(ParsePropValue(name.Mid(2), prop, num));
- _method.NumFastBytes = num;
- }
- else if (name.Left(2) == L"MC")
- {
- UInt32 num = 0xFFFFFFFF;
- RINOK(ParsePropValue(name.Mid(2), prop, num));
- _method.Mc = num;
- _method.McDefined = true;
- }
- else if (name.Left(1) == L"A")
- {
- UInt32 num = kAlgoX5;
- RINOK(ParsePropValue(name.Mid(1), prop, num));
- _method.Algo = num;
- }
- else
- return E_INVALIDARG;
- }
- return S_OK;
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-#ifndef EXTRACT_ONLY
-static IOutArchive *CreateArcOut() { return new CHandler; }
-#else
-#define CreateArcOut 0
-#endif
-
-static CArcInfo g_ArcInfo =
- { L"GZip", L"gz gzip tgz tpz", L"* * .tar .tar", 0xEF, { 0x1F, 0x8B, 8 }, 3, true, CreateArc, CreateArcOut };
-
-REGISTER_ARC(GZip)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsHandler.cpp
deleted file mode 100644
index ade538770..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsHandler.cpp
+++ /dev/null
@@ -1,244 +0,0 @@
-// HfsHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Windows/PropVariant.h"
-#include "../../Common/StreamUtils.h"
-#include "HfsHandler.h"
-
-namespace NArchive {
-namespace NHfs {
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidATime, VT_FILETIME}
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidClusterSize, VT_UI4},
- { NULL, kpidFreeSpace, VT_UI8},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidMTime, VT_FILETIME}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-static void HfsTimeToProp(UInt32 hfsTime, NWindows::NCOM::CPropVariant &prop)
-{
- FILETIME ft;
- HfsTimeToFileTime(hfsTime, ft);
- prop = ft;
-}
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidMethod: prop = _db.Header.IsHfsX() ? L"HFSX" : L"HFS+"; break;
- case kpidClusterSize: prop = (UInt32)1 << _db.Header.BlockSizeLog; break;
- case kpidFreeSpace: prop = (UInt64)_db.Header.NumFreeBlocks << _db.Header.BlockSizeLog; break;
- case kpidMTime: HfsTimeToProp(_db.Header.MTime, prop); break;
- case kpidCTime:
- {
- FILETIME localFt, ft;
- HfsTimeToFileTime(_db.Header.CTime, localFt);
- if (LocalFileTimeToFileTime(&localFt, &ft))
- prop = ft;
- break;
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- const CItem &item = _db.Items[index];
- switch(propID)
- {
- case kpidPath: prop = _db.GetItemPath(index); break;
- case kpidIsDir: prop = item.IsDir(); break;
-
- case kpidCTime: HfsTimeToProp(item.CTime, prop); break;
- case kpidMTime: HfsTimeToProp(item.MTime, prop); break;
- case kpidATime: HfsTimeToProp(item.ATime, prop); break;
-
- case kpidPackSize: if (!item.IsDir()) prop = (UInt64)item.NumBlocks << _db.Header.BlockSizeLog; break;
- case kpidSize: if (!item.IsDir()) prop = item.Size; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-class CProgressImp: public CProgressVirt
-{
- CMyComPtr<IArchiveOpenCallback> _callback;
-public:
- HRESULT SetTotal(UInt64 numFiles);
- HRESULT SetCompleted(UInt64 numFiles);
- CProgressImp(IArchiveOpenCallback *callback): _callback(callback) {}
-};
-
-HRESULT CProgressImp::SetTotal(UInt64 numFiles)
-{
- if (_callback)
- return _callback->SetTotal(&numFiles, NULL);
- return S_OK;
-}
-
-HRESULT CProgressImp::SetCompleted(UInt64 numFiles)
-{
- if (_callback)
- return _callback->SetCompleted(&numFiles, NULL);
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback *callback)
-{
- COM_TRY_BEGIN
- Close();
- try
- {
- CProgressImp progressImp(callback);
- HRESULT res = _db.Open(inStream, &progressImp);
- if (res == E_ABORT)
- return res;
- if (res != S_OK)
- return S_FALSE;
- _stream = inStream;
- }
- catch(...) { return S_FALSE; }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _stream.Release();
- _db.Clear();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _db.Items.Size();
- if (numItems == 0)
- return S_OK;
- UInt32 i;
- UInt64 totalSize = 0;
- for (i = 0; i < numItems; i++)
- {
- const CItem &item = _db.Items[allFilesMode ? i : indices[i]];
- if (!item.IsDir())
- totalSize += item.Size;
- }
- RINOK(extractCallback->SetTotal(totalSize));
-
- UInt64 currentTotalSize = 0, currentItemSize = 0;
-
- CByteBuffer buf;
- const UInt32 kBufSize = (1 << 16);
- buf.SetCapacity(kBufSize);
-
- for (i = 0; i < numItems; i++, currentTotalSize += currentItemSize)
- {
- RINOK(extractCallback->SetCompleted(&currentTotalSize));
- Int32 index = allFilesMode ? i : indices[i];
- const CItem &item = _db.Items[index];
- currentItemSize = 0;
- if (!item.IsDir())
- currentItemSize = item.Size;
-
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
- if (item.IsDir())
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
- if (!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- UInt64 pos = 0;
- int res = NArchive::NExtract::NOperationResult::kOK;
- int i;
- for (i = 0; i < item.Extents.Size(); i++)
- {
- if (item.Size == pos)
- break;
- if (res != NArchive::NExtract::NOperationResult::kOK)
- break;
- const CExtent &e = item.Extents[i];
- RINOK(_stream->Seek((UInt64)e.Pos << _db.Header.BlockSizeLog, STREAM_SEEK_SET, NULL));
- UInt64 extentSize = (UInt64)e.NumBlocks << _db.Header.BlockSizeLog;
- for (;;)
- {
- if (extentSize == 0)
- break;
- UInt64 rem = item.Size - pos;
- if (rem == 0)
- {
- if (extentSize >= (UInt64)((UInt32)1 << _db.Header.BlockSizeLog))
- res = NArchive::NExtract::NOperationResult::kDataError;
- break;
- }
- UInt32 curSize = kBufSize;
- if (curSize > rem)
- curSize = (UInt32)rem;
- if (curSize > extentSize)
- curSize = (UInt32)extentSize;
- RINOK(ReadStream_FALSE(_stream, buf, curSize));
- if (realOutStream)
- {
- RINOK(WriteStream(realOutStream, buf, curSize));
- }
- pos += curSize;
- extentSize -= curSize;
- UInt64 processed = currentTotalSize + pos;
- RINOK(extractCallback->SetCompleted(&processed));
- }
- }
- if (i != item.Extents.Size() || item.Size != pos)
- res = NArchive::NExtract::NOperationResult::kDataError;
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(res));
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _db.Items.Size();
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsHandler.h
deleted file mode 100644
index 269af218e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsHandler.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// HfsHandler.h
-
-#ifndef __ARCHIVE_HFS_HANDLER_H
-#define __ARCHIVE_HFS_HANDLER_H
-
-#include "Common/MyCom.h"
-#include "../IArchive.h"
-#include "HfsIn.h"
-
-namespace NArchive {
-namespace NHfs {
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _stream;
- CDatabase _db;
-public:
- MY_UNKNOWN_IMP1(IInArchive)
- INTERFACE_IInArchive(;)
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsIn.cpp
deleted file mode 100644
index 8391dd936..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsIn.cpp
+++ /dev/null
@@ -1,480 +0,0 @@
-// HfsIn.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/StreamUtils.h"
-#include "Common/IntToString.h"
-
-#include "HfsIn.h"
-
-#include "../../../../C/CpuArch.h"
-
-#define Get16(p) GetBe16(p)
-#define Get32(p) GetBe32(p)
-#define Get64(p) GetBe64(p)
-
-namespace NArchive {
-namespace NHfs {
-
-#define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; }
-
-static int CompareIdToIndex(const CIdIndexPair *p1, const CIdIndexPair *p2, void * /* param */)
-{
- RINOZ(MyCompare(p1->ID, p2->ID));
- return MyCompare(p1->Index, p2->Index);
-}
-
-bool operator< (const CIdIndexPair &a1, const CIdIndexPair &a2) { return (a1.ID < a2.ID); }
-bool operator> (const CIdIndexPair &a1, const CIdIndexPair &a2) { return (a1.ID > a2.ID); }
-bool operator==(const CIdIndexPair &a1, const CIdIndexPair &a2) { return (a1.ID == a2.ID); }
-bool operator!=(const CIdIndexPair &a1, const CIdIndexPair &a2) { return (a1.ID != a2.ID); }
-
-static UString GetSpecName(const UString &name, UInt32 /* id */)
-{
- UString name2 = name;
- name2.Trim();
- if (name2.IsEmpty())
- {
- /*
- wchar_t s[32];
- ConvertUInt64ToString(id, s);
- return L"[" + (UString)s + L"]";
- */
- return L"[]";
- }
- return name;
-}
-
-UString CDatabase::GetItemPath(int index) const
-{
- const CItem *item = &Items[index];
- UString name = GetSpecName(item->Name, item->ID);
-
- for (int i = 0; i < 1000; i++)
- {
- if (item->ParentID < 16 && item->ParentID != 2)
- {
- if (item->ParentID != 1)
- break;
- return name;
- }
- CIdIndexPair pair;
- pair.ID = item->ParentID;
- pair.Index = 0;
- int indexInMap = IdToIndexMap.FindInSorted(pair);
- if (indexInMap < 0)
- break;
- item = &Items[IdToIndexMap[indexInMap].Index];
- name = GetSpecName(item->Name, item->ID) + WCHAR_PATH_SEPARATOR + name;
- }
- return (UString)L"Unknown" + WCHAR_PATH_SEPARATOR + name;
-}
-
-void CFork::Parse(const Byte *p)
-{
- Size = Get64(p);
- // ClumpSize = Get32(p + 8);
- NumBlocks = Get32(p + 0xC);
- for (int i = 0; i < 8; i++)
- {
- CExtent &e = Extents[i];
- e.Pos = Get32(p + 0x10 + i * 8);
- e.NumBlocks = Get32(p + 0x10 + i * 8 + 4);
- }
-}
-
-static HRESULT ReadExtent(int blockSizeLog, IInStream *inStream, Byte *buf, const CExtent &e)
-{
- RINOK(inStream->Seek((UInt64)e.Pos << blockSizeLog, STREAM_SEEK_SET, NULL));
- return ReadStream_FALSE(inStream, buf, (size_t)e.NumBlocks << blockSizeLog);
-}
-
-HRESULT CDatabase::ReadFile(const CFork &fork, CByteBuffer &buf, IInStream *inStream)
-{
- if (fork.NumBlocks >= Header.NumBlocks)
- return S_FALSE;
- size_t totalSize = (size_t)fork.NumBlocks << Header.BlockSizeLog;
- if ((totalSize >> Header.BlockSizeLog) != fork.NumBlocks)
- return S_FALSE;
- buf.SetCapacity(totalSize);
- UInt32 curBlock = 0;
- for (int i = 0; i < 8; i++)
- {
- if (curBlock >= fork.NumBlocks)
- break;
- const CExtent &e = fork.Extents[i];
- if (fork.NumBlocks - curBlock < e.NumBlocks || e.Pos >= Header.NumBlocks)
- return S_FALSE;
- RINOK(ReadExtent(Header.BlockSizeLog, inStream,
- (Byte *)buf + ((size_t)curBlock << Header.BlockSizeLog), e));
- curBlock += e.NumBlocks;
- }
- return S_OK;
-}
-
-struct CNodeDescriptor
-{
- UInt32 fLink;
- UInt32 bLink;
- Byte Kind;
- Byte Height;
- UInt16 NumRecords;
- // UInt16 Reserved;
- void Parse(const Byte *p);
-};
-
-void CNodeDescriptor::Parse(const Byte *p)
-{
- fLink = Get32(p);
- bLink = Get32(p + 4);
- Kind = p[8];
- Height = p[9];
- NumRecords = Get16(p + 10);
-}
-
-struct CHeaderRec
-{
- // UInt16 TreeDepth;
- // UInt32 RootNode;
- // UInt32 LeafRecords;
- UInt32 FirstLeafNode;
- // UInt32 LastLeafNode;
- int NodeSizeLog;
- // UInt16 MaxKeyLength;
- UInt32 TotalNodes;
- // UInt32 FreeNodes;
- // UInt16 Reserved1;
- // UInt32 ClumpSize;
- // Byte BtreeType;
- // Byte KeyCompareType;
- // UInt32 Attributes;
- // UInt32 Reserved3[16];
-
- HRESULT Parse(const Byte *p);
-};
-
-HRESULT CHeaderRec::Parse(const Byte *p)
-{
- // TreeDepth = Get16(p);
- // RootNode = Get32(p + 2);
- // LeafRecords = Get32(p + 6);
- FirstLeafNode = Get32(p + 0xA);
- // LastLeafNode = Get32(p + 0xE);
- UInt32 nodeSize = Get16(p + 0x12);
-
- int i;
- for (i = 9; ((UInt32)1 << i) != nodeSize; i++)
- if (i == 16)
- return S_FALSE;
- NodeSizeLog = i;
-
- // MaxKeyLength = Get16(p + 0x14);
- TotalNodes = Get32(p + 0x16);
- // FreeNodes = Get32(p + 0x1A);
- // Reserved1 = Get16(p + 0x1E);
- // ClumpSize = Get32(p + 0x20);
- // BtreeType = p[0x24];
- // KeyCompareType = p[0x25];
- // Attributes = Get32(p + 0x26);
- /*
- for (int i = 0; i < 16; i++)
- Reserved3[i] = Get32(p + 0x2A + i * 4);
- */
- return S_OK;
-}
-
-
-enum ENodeType
-{
- NODE_TYPE_LEAF = 0xFF,
- NODE_TYPE_INDEX = 0,
- NODE_TYPE_HEADER = 1,
- NODE_TYPE_MODE = 2
-};
-
-HRESULT CDatabase::LoadExtentFile(IInStream *inStream)
-{
- // FileExtents.Clear();
- // ResExtents.Clear();
-
- CByteBuffer extents;
- RINOK(ReadFile(Header.ExtentsFile, extents, inStream));
-
- const Byte *p = (const Byte *)extents;
-
- // CNodeDescriptor nodeDesc;
- // nodeDesc.Parse(p);
- CHeaderRec hr;
- RINOK(hr.Parse(p + 14));
-
- UInt32 node = hr.FirstLeafNode;
- if (node != 0)
- return S_FALSE;
- /*
- while (node != 0)
- {
- size_t nodeOffset = node * hr.NodeSize;
- if ((node + 1)* hr.NodeSize > CatalogBuf.GetCapacity())
- return S_FALSE;
- CNodeDescriptor desc;
- desc.Parse(p + nodeOffset);
- if (desc.Kind != NODE_TYPE_LEAF)
- return S_FALSE;
- UInt32 ptr = hr.NodeSize;
- for (int i = 0; i < desc.NumRecords; i++)
- {
- UInt32 offs = Get16(p + nodeOffset + hr.NodeSize - (i + 1) * 2);
- UInt32 offsNext = Get16(p + nodeOffset + hr.NodeSize - (i + 2) * 2);
-
- const Byte *r = p + nodeOffset + offs;
- int keyLength = Get16(r);
- Byte forkType = r[2];
- UInt32 id = Get16(r + 4);
- UInt32 startBlock = Get16(r + 4);
- CObjectVector<CIdExtents> *extents = (forkType == 0) ? &FileExtents : &ResExtents;
- if (extents->Size() == 0)
- extents->Add(CIdExtents());
- else
- {
- CIdExtents &e = extents->Back();
- if (e.ID != id)
- {
- if (e.ID > id)
- return S_FALSE;
- extents->Add(CIdExtents());
- }
- }
- CIdExtents &e = extents->Back();
- for (UInt32 k = offs + 10 + 2; k + 8 <= offsNext; k += 8)
- {
- CExtent ee;
- ee.Pos = Get32(p + nodeOffset + k);
- ee.NumBlocks = Get32(p + nodeOffset + k * 4);
- e.Extents.Add(ee);
- }
- }
- node = desc.fLink;
- }
- */
- return S_OK;
-}
-
-
-HRESULT CDatabase::LoadCatalog(IInStream *inStream, CProgressVirt *progress)
-{
- Items.Clear();
- IdToIndexMap.ClearAndFree();
-
- CByteBuffer catalogBuf;
- RINOK(ReadFile(Header.CatalogFile, catalogBuf, inStream));
- const Byte *p = (const Byte *)catalogBuf;
-
- // CNodeDescriptor nodeDesc;
- // nodeDesc.Parse(p);
- CHeaderRec hr;
- hr.Parse(p + 14);
-
- // CaseSensetive = (Header.IsHfsX() && hr.KeyCompareType == 0xBC);
-
- if ((catalogBuf.GetCapacity() >> hr.NodeSizeLog) < hr.TotalNodes)
- return S_FALSE;
-
- CByteBuffer usedBuf;
- usedBuf.SetCapacity(hr.TotalNodes);
- for (UInt32 i = 0; i < hr.TotalNodes; i++)
- usedBuf[i] = 0;
-
- UInt32 node = hr.FirstLeafNode;
- while (node != 0)
- {
- if (node >= hr.TotalNodes)
- return S_FALSE;
- if (usedBuf[node])
- return S_FALSE;
- usedBuf[node] = 1;
- size_t nodeOffset = (size_t)node << hr.NodeSizeLog;
- CNodeDescriptor desc;
- desc.Parse(p + nodeOffset);
- if (desc.Kind != NODE_TYPE_LEAF)
- return S_FALSE;
- for (int i = 0; i < desc.NumRecords; i++)
- {
- UInt32 nodeSize = (1 << hr.NodeSizeLog);
- UInt32 offs = Get16(p + nodeOffset + nodeSize - (i + 1) * 2);
- UInt32 offsNext = Get16(p + nodeOffset + nodeSize - (i + 2) * 2);
- UInt32 recSize = offsNext - offs;
- if (offsNext >= nodeSize || offsNext < offs || recSize < 6)
- return S_FALSE;
-
- CItem item;
-
- const Byte *r = p + nodeOffset + offs;
- UInt32 keyLength = Get16(r);
- item.ParentID = Get32(r + 2);
- UString name;
- if (keyLength < 6 || (keyLength & 1) != 0 || keyLength + 2 > recSize)
- return S_FALSE;
- r += 6;
- recSize -= 6;
- keyLength -= 6;
-
- int nameLength = Get16(r);
- if (nameLength * 2 != (int)keyLength)
- return S_FALSE;
- r += 2;
- recSize -= 2;
-
- wchar_t *pp = name.GetBuffer(nameLength + 1);
-
- int j;
- for (j = 0; j < nameLength; j++)
- pp[j] = ((wchar_t)r[j * 2] << 8) | r[j * 2 + 1];
- pp[j] = 0;
- name.ReleaseBuffer();
- r += j * 2;
- recSize -= j * 2;
-
- if (recSize < 2)
- return S_FALSE;
- item.Type = Get16(r);
-
- if (item.Type != RECORD_TYPE_FOLDER && item.Type != RECORD_TYPE_FILE)
- continue;
- if (recSize < 0x58)
- return S_FALSE;
-
- // item.Flags = Get16(r + 2);
- // item.Valence = Get32(r + 4);
- item.ID = Get32(r + 8);
- item.CTime = Get32(r + 0xC);
- item.MTime = Get32(r + 0x10);
- // item.AttrMTime = Get32(r + 0x14);
- item.ATime = Get32(r + 0x18);
- // item.BackupDate = Get32(r + 0x1C);
-
- /*
- item.OwnerID = Get32(r + 0x20);
- item.GroupID = Get32(r + 0x24);
- item.AdminFlags = r[0x28];
- item.OwnerFlags = r[0x29];
- item.FileMode = Get16(r + 0x2A);
- item.special.iNodeNum = Get16(r + 0x2C);
- */
-
- item.Name = name;
-
- if (item.IsDir())
- {
- CIdIndexPair pair;
- pair.ID = item.ID;
- pair.Index = Items.Size();
- IdToIndexMap.Add(pair);
- }
- else
- {
- CFork fd;
- recSize -= 0x58;
- r += 0x58;
- if (recSize < 0x50 * 2)
- return S_FALSE;
- fd.Parse(r);
- item.Size = fd.Size;
- item.NumBlocks = fd.NumBlocks;
- UInt32 curBlock = 0;
- for (int j = 0; j < 8; j++)
- {
- if (curBlock >= fd.NumBlocks)
- break;
- const CExtent &e = fd.Extents[j];
- item.Extents.Add(e);
- curBlock += e.NumBlocks;
- }
- }
- Items.Add(item);
- if (progress && Items.Size() % 100 == 0)
- {
- RINOK(progress->SetCompleted(Items.Size()));
- }
- }
- node = desc.fLink;
- }
- IdToIndexMap.Sort(CompareIdToIndex, NULL);
- return S_OK;
-}
-
-HRESULT CDatabase::Open(IInStream *inStream, CProgressVirt *progress)
-{
- static const UInt32 kHeaderSize = 1024 + 512;
- Byte buf[kHeaderSize];
- RINOK(ReadStream_FALSE(inStream, buf, kHeaderSize));
- int i;
- for (i = 0; i < 1024; i++)
- if (buf[i] != 0)
- return S_FALSE;
- const Byte *p = buf + 1024;
- CVolHeader &h = Header;
-
- h.Header[0] = p[0];
- h.Header[1] = p[1];
- if (p[0] != 'H' || (p[1] != '+' && p[1] != 'X'))
- return S_FALSE;
- h.Version = Get16(p + 2);
- if (h.Version < 4 || h.Version > 5)
- return S_FALSE;
-
- // h.Attr = Get32(p + 4);
- // h.LastMountedVersion = Get32(p + 8);
- // h.JournalInfoBlock = Get32(p + 0xC);
-
- h.CTime = Get32(p + 0x10);
- h.MTime = Get32(p + 0x14);
- // h.BackupTime = Get32(p + 0x18);
- // h.CheckedTime = Get32(p + 0x1C);
-
- // h.NumFiles = Get32(p + 0x20);
- // h.NumFolders = Get32(p + 0x24);
-
- UInt32 numFiles = Get32(p + 0x20);
- UInt32 numFolders = Get32(p + 0x24);;
- if (progress)
- {
- RINOK(progress->SetTotal(numFolders + numFiles));
- }
-
- UInt32 blockSize = Get32(p + 0x28);
-
- for (i = 9; ((UInt32)1 << i) != blockSize; i++)
- if (i == 31)
- return S_FALSE;
- h.BlockSizeLog = i;
-
- h.NumBlocks = Get32(p + 0x2C);
- h.NumFreeBlocks = Get32(p + 0x30);
-
- /*
- h.WriteCount = Get32(p + 0x44);
- for (i = 0; i < 6; i++)
- h.FinderInfo[i] = Get32(p + 0x50 + i * 4);
- h.VolID = Get64(p + 0x68);
- */
-
- UInt64 endPos;
- RINOK(inStream->Seek(0, STREAM_SEEK_END, &endPos));
- if ((endPos >> h.BlockSizeLog) < h.NumBlocks)
- return S_FALSE;
-
- // h.AllocationFile.Parse(p + 0x70 + 0x50 * 0);
- h.ExtentsFile.Parse( p + 0x70 + 0x50 * 1);
- h.CatalogFile.Parse( p + 0x70 + 0x50 * 2);
- // h.AttributesFile.Parse(p + 0x70 + 0x50 * 3);
- // h.StartupFile.Parse( p + 0x70 + 0x50 * 4);
-
- RINOK(LoadExtentFile(inStream));
- RINOK(LoadCatalog(inStream, progress));
-
- // if (Header.NumFiles + Header.NumFolders != (UInt32)Items.Size()) return S_OK;
-
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsIn.h
deleted file mode 100644
index c19539057..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsIn.h
+++ /dev/null
@@ -1,154 +0,0 @@
-// HfsIn.h
-
-#ifndef __ARCHIVE_HFS_IN_H
-#define __ARCHIVE_HFS_IN_H
-
-#include "Common/MyString.h"
-#include "Common/Buffer.h"
-
-namespace NArchive {
-namespace NHfs {
-
-struct CExtent
-{
- UInt32 Pos;
- UInt32 NumBlocks;
-};
-
-struct CFork
-{
- UInt64 Size;
- // UInt32 ClumpSize;
- UInt32 NumBlocks;
- CExtent Extents[8];
- void Parse(const Byte *p);
-};
-
-struct CVolHeader
-{
- Byte Header[2];
- UInt16 Version;
- // UInt32 Attr;
- // UInt32 LastMountedVersion;
- // UInt32 JournalInfoBlock;
-
- UInt32 CTime;
- UInt32 MTime;
- // UInt32 BackupTime;
- // UInt32 CheckedTime;
-
- // UInt32 NumFiles;
- // UInt32 NumFolders;
- int BlockSizeLog;
- UInt32 NumBlocks;
- UInt32 NumFreeBlocks;
-
- // UInt32 WriteCount;
- // UInt32 FinderInfo[8];
- // UInt64 VolID;
-
- // CFork AllocationFile;
- CFork ExtentsFile;
- CFork CatalogFile;
- // CFork AttributesFile;
- // CFork StartupFile;
-
- bool IsHfsX() const { return Version > 4; }
-};
-
-inline void HfsTimeToFileTime(UInt32 hfsTime, FILETIME &ft)
-{
- UInt64 v = ((UInt64)3600 * 24 * (365 * 303 + 24 * 3) + hfsTime) * 10000000;
- ft.dwLowDateTime = (DWORD)v;
- ft.dwHighDateTime = (DWORD)(v >> 32);
-}
-
-enum ERecordType
-{
- RECORD_TYPE_FOLDER = 1,
- RECORD_TYPE_FILE = 2,
- RECORD_TYPE_FOLDER_THREAD = 3,
- RECORD_TYPE_FILE_THREAD = 4
-};
-
-struct CItem
-{
- UString Name;
-
- UInt32 ParentID;
-
- UInt16 Type;
- // UInt16 Flags;
- // UInt32 Valence;
- UInt32 ID;
- UInt32 CTime;
- UInt32 MTime;
- // UInt32 AttrMTime;
- UInt32 ATime;
- // UInt32 BackupDate;
-
- /*
- UInt32 OwnerID;
- UInt32 GroupID;
- Byte AdminFlags;
- Byte OwnerFlags;
- UInt16 FileMode;
- union
- {
- UInt32 iNodeNum;
- UInt32 LinkCount;
- UInt32 RawDevice;
- } special;
- */
-
- UInt64 Size;
- UInt32 NumBlocks;
- CRecordVector<CExtent> Extents;
-
- bool IsDir() const { return Type == RECORD_TYPE_FOLDER; }
- CItem(): Size(0), NumBlocks(0) {}
-};
-
-struct CIdIndexPair
-{
- UInt32 ID;
- int Index;
-};
-
-struct CProgressVirt
-{
- virtual HRESULT SetTotal(UInt64 numFiles) PURE;
- virtual HRESULT SetCompleted(UInt64 numFiles) PURE;
-};
-
-class CDatabase
-{
- // CObjectVector<CIdExtents> FileExtents;
- // CObjectVector<CIdExtents> ResExtents;
- CRecordVector<CIdIndexPair> IdToIndexMap;
-
- HRESULT LoadExtentFile(IInStream *inStream);
- HRESULT LoadCatalog(IInStream *inStream, CProgressVirt *progress);
-
- HRESULT ReadFile(const CFork &fork, CByteBuffer &buf, IInStream *inStream);
-public:
- CVolHeader Header;
- CObjectVector<CItem> Items;
- // bool CaseSensetive;
-
- void Clear()
- {
- // CaseSensetive = false;
- Items.Clear();
- // FileExtents.Clear();
- // ResExtents.Clear();
- IdToIndexMap.Clear();
- }
-
- UString GetItemPath(int index) const;
- HRESULT Open(IInStream *inStream, CProgressVirt *progress);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsRegister.cpp
deleted file mode 100644
index 2d7069005..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Hfs/HfsRegister.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// HfsRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "HfsHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NHfs::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"HFS", L"hfs", 0, 0xE3, { 'H', '+', 0, 4 }, 4, false, CreateArc, 0 };
-
-REGISTER_ARC(Hfs)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/IArchive.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/IArchive.h
deleted file mode 100644
index 853202767..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/IArchive.h
+++ /dev/null
@@ -1,234 +0,0 @@
-// IArchive.h
-
-#ifndef __IARCHIVE_H
-#define __IARCHIVE_H
-
-#include "../IProgress.h"
-#include "../IStream.h"
-#include "../PropID.h"
-
-#define ARCHIVE_INTERFACE_SUB(i, base, x) DECL_INTERFACE_SUB(i, base, 6, x)
-#define ARCHIVE_INTERFACE(i, x) ARCHIVE_INTERFACE_SUB(i, IUnknown, x)
-
-namespace NFileTimeType
-{
- enum EEnum
- {
- kWindows,
- kUnix,
- kDOS
- };
-}
-
-namespace NArchive
-{
- enum
- {
- kName = 0,
- kClassID,
- kExtension,
- kAddExtension,
- kUpdate,
- kKeepName,
- kStartSignature,
- kFinishSignature,
- kAssociate
- };
-
- namespace NExtract
- {
- namespace NAskMode
- {
- enum
- {
- kExtract = 0,
- kTest,
- kSkip
- };
- }
- namespace NOperationResult
- {
- enum
- {
- kOK = 0,
- kUnSupportedMethod,
- kDataError,
- kCRCError
- };
- }
- }
- namespace NUpdate
- {
- namespace NOperationResult
- {
- enum
- {
- kOK = 0,
- kError
- };
- }
- }
-}
-
-#define INTERFACE_IArchiveOpenCallback(x) \
- STDMETHOD(SetTotal)(const UInt64 *files, const UInt64 *bytes) x; \
- STDMETHOD(SetCompleted)(const UInt64 *files, const UInt64 *bytes) x; \
-
-ARCHIVE_INTERFACE(IArchiveOpenCallback, 0x10)
-{
- INTERFACE_IArchiveOpenCallback(PURE);
-};
-
-
-#define INTERFACE_IArchiveExtractCallback(x) \
- INTERFACE_IProgress(x) \
- STDMETHOD(GetStream)(UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode) x; \
- STDMETHOD(PrepareOperation)(Int32 askExtractMode) x; \
- STDMETHOD(SetOperationResult)(Int32 resultEOperationResult) x; \
-
-ARCHIVE_INTERFACE_SUB(IArchiveExtractCallback, IProgress, 0x20)
-{
- INTERFACE_IArchiveExtractCallback(PURE)
-};
-
-
-#define INTERFACE_IArchiveOpenVolumeCallback(x) \
- STDMETHOD(GetProperty)(PROPID propID, PROPVARIANT *value) x; \
- STDMETHOD(GetStream)(const wchar_t *name, IInStream **inStream) x; \
-
-ARCHIVE_INTERFACE(IArchiveOpenVolumeCallback, 0x30)
-{
- INTERFACE_IArchiveOpenVolumeCallback(PURE);
-};
-
-
-ARCHIVE_INTERFACE(IInArchiveGetStream, 0x40)
-{
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream) PURE;
-};
-
-
-ARCHIVE_INTERFACE(IArchiveOpenSetSubArchiveName, 0x50)
-{
- STDMETHOD(SetSubArchiveName)(const wchar_t *name) PURE;
-};
-
-
-/*
-IInArchive::Extract:
- indices must be sorted
- numItems = 0xFFFFFFFF means "all files"
- testMode != 0 means "test files without writing to outStream"
-*/
-
-#define INTERFACE_IInArchive(x) \
- STDMETHOD(Open)(IInStream *stream, const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *openArchiveCallback) x; \
- STDMETHOD(Close)() x; \
- STDMETHOD(GetNumberOfItems)(UInt32 *numItems) x; \
- STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) x; \
- STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, Int32 testMode, IArchiveExtractCallback *extractCallback) x; \
- STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value) x; \
- STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties) x; \
- STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x; \
- STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties) x; \
- STDMETHOD(GetArchivePropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x;
-
-ARCHIVE_INTERFACE(IInArchive, 0x60)
-{
- INTERFACE_IInArchive(PURE)
-};
-
-ARCHIVE_INTERFACE(IArchiveOpenSeq, 0x61)
-{
- STDMETHOD(OpenSeq)(ISequentialInStream *stream) PURE;
-};
-
-#define INTERFACE_IArchiveUpdateCallback(x) \
- INTERFACE_IProgress(x); \
- STDMETHOD(GetUpdateItemInfo)(UInt32 index, \
- Int32 *newData, /*1 - new data, 0 - old data */ \
- Int32 *newProperties, /* 1 - new properties, 0 - old properties */ \
- UInt32 *indexInArchive /* -1 if there is no in archive, or if doesn't matter */ \
- ) x; \
- STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) x; \
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **inStream) x; \
- STDMETHOD(SetOperationResult)(Int32 operationResult) x; \
-
-ARCHIVE_INTERFACE_SUB(IArchiveUpdateCallback, IProgress, 0x80)
-{
- INTERFACE_IArchiveUpdateCallback(PURE);
-};
-
-#define INTERFACE_IArchiveUpdateCallback2(x) \
- INTERFACE_IArchiveUpdateCallback(x) \
- STDMETHOD(GetVolumeSize)(UInt32 index, UInt64 *size) x; \
- STDMETHOD(GetVolumeStream)(UInt32 index, ISequentialOutStream **volumeStream) x; \
-
-ARCHIVE_INTERFACE_SUB(IArchiveUpdateCallback2, IArchiveUpdateCallback, 0x82)
-{
- INTERFACE_IArchiveUpdateCallback2(PURE);
-};
-
-
-#define INTERFACE_IOutArchive(x) \
- STDMETHOD(UpdateItems)(ISequentialOutStream *outStream, UInt32 numItems, IArchiveUpdateCallback *updateCallback) x; \
- STDMETHOD(GetFileTimeType)(UInt32 *type) x;
-
-ARCHIVE_INTERFACE(IOutArchive, 0xA0)
-{
- INTERFACE_IOutArchive(PURE)
-};
-
-
-ARCHIVE_INTERFACE(ISetProperties, 0x03)
-{
- STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties) PURE;
-};
-
-
-#define IMP_IInArchive_GetProp(k) \
- (UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) \
- { if(index >= sizeof(k) / sizeof(k[0])) return E_INVALIDARG; \
- const STATPROPSTG &srcItem = k[index]; \
- *propID = srcItem.propid; *varType = srcItem.vt; *name = 0; return S_OK; } \
-
-#define IMP_IInArchive_GetProp_WITH_NAME(k) \
- (UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) \
- { if(index >= sizeof(k) / sizeof(k[0])) return E_INVALIDARG; \
- const STATPROPSTG &srcItem = k[index]; \
- *propID = srcItem.propid; *varType = srcItem.vt; \
- if (srcItem.lpwstrName == 0) *name = 0; else *name = ::SysAllocString(srcItem.lpwstrName); return S_OK; } \
-
-#define IMP_IInArchive_Props \
- STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) \
- { *numProperties = sizeof(kProps) / sizeof(kProps[0]); return S_OK; } \
- STDMETHODIMP CHandler::GetPropertyInfo IMP_IInArchive_GetProp(kProps)
-
-#define IMP_IInArchive_Props_WITH_NAME \
- STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) \
- { *numProperties = sizeof(kProps) / sizeof(kProps[0]); return S_OK; } \
- STDMETHODIMP CHandler::GetPropertyInfo IMP_IInArchive_GetProp_WITH_NAME(kProps)
-
-
-#define IMP_IInArchive_ArcProps \
- STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) \
- { *numProperties = sizeof(kArcProps) / sizeof(kArcProps[0]); return S_OK; } \
- STDMETHODIMP CHandler::GetArchivePropertyInfo IMP_IInArchive_GetProp(kArcProps)
-
-#define IMP_IInArchive_ArcProps_WITH_NAME \
- STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) \
- { *numProperties = sizeof(kArcProps) / sizeof(kArcProps[0]); return S_OK; } \
- STDMETHODIMP CHandler::GetArchivePropertyInfo IMP_IInArchive_GetProp_WITH_NAME(kArcProps)
-
-#define IMP_IInArchive_ArcProps_NO_Table \
- STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) \
- { *numProperties = 0; return S_OK; } \
- STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32, BSTR *, PROPID *, VARTYPE *) \
- { return E_NOTIMPL; } \
-
-#define IMP_IInArchive_ArcProps_NO \
- IMP_IInArchive_ArcProps_NO_Table \
- STDMETHODIMP CHandler::GetArchiveProperty(PROPID, PROPVARIANT *value) \
- { value->vt = VT_EMPTY; return S_OK; }
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHandler.cpp
deleted file mode 100644
index ed8da189a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHandler.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-// IsoHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/Defs.h"
-#include "Common/IntToString.h"
-#include "Common/NewHandler.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/ProgressUtils.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "../Common/ItemNameUtils.h"
-
-#include "IsoHandler.h"
-
-using namespace NWindows;
-using namespace NTime;
-
-namespace NArchive {
-namespace NIso {
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- Close();
- // try
- {
- if (_archive.Open(stream) != S_OK)
- return S_FALSE;
- _stream = stream;
- }
- // catch(...) { return S_FALSE; }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _archive.Clear();
- _stream.Release();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _archive.Refs.Size() + _archive.BootEntries.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- if (index >= (UInt32)_archive.Refs.Size())
- {
- index -= _archive.Refs.Size();
- const CBootInitialEntry &be = _archive.BootEntries[index];
- switch(propID)
- {
- case kpidPath:
- {
- // wchar_t name[32];
- // ConvertUInt64ToString(index + 1, name);
- UString s = L"[BOOT]" WSTRING_PATH_SEPARATOR;
- // s += name;
- // s += L"-";
- s += be.GetName();
- prop = (const wchar_t *)s;
- break;
- }
- case kpidIsDir:
- prop = false;
- break;
- case kpidSize:
- case kpidPackSize:
- prop = (UInt64)_archive.GetBootItemSize(index);
- break;
- }
- }
- else
- {
- const CRef &ref = _archive.Refs[index];
- const CDir &item = ref.Dir->_subItems[ref.Index];
- switch(propID)
- {
- case kpidPath:
- // if (item.FileId.GetCapacity() >= 0)
- {
- UString s;
- if (_archive.IsJoliet())
- s = item.GetPathU();
- else
- s = MultiByteToUnicodeString(item.GetPath(_archive.IsSusp, _archive.SuspSkipSize), CP_OEMCP);
-
- int pos = s.ReverseFind(L';');
- if (pos >= 0 && pos == s.Length() - 2)
- if (s[s.Length() - 1] == L'1')
- s = s.Left(pos);
- if (!s.IsEmpty())
- if (s[s.Length() - 1] == L'.')
- s = s.Left(s.Length() - 1);
- prop = (const wchar_t *)NItemName::GetOSName2(s);
- }
- break;
- case kpidIsDir:
- prop = item.IsDir();
- break;
- case kpidSize:
- case kpidPackSize:
- if (!item.IsDir())
- prop = (UInt64)item.DataLength;
- break;
- case kpidMTime:
- {
- FILETIME utcFileTime;
- if (item.DateTime.GetFileTime(utcFileTime))
- prop = utcFileTime;
- /*
- else
- {
- utcFileTime.dwLowDateTime = 0;
- utcFileTime.dwHighDateTime = 0;
- }
- */
- break;
- }
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _archive.Refs.Size();
- if (numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
- UInt32 i;
- for(i = 0; i < numItems; i++)
- {
- UInt32 index = (allFilesMode ? i : indices[i]);
- if (index < (UInt32)_archive.Refs.Size())
- {
- const CRef &ref = _archive.Refs[index];
- const CDir &item = ref.Dir->_subItems[ref.Index];
- totalSize += item.DataLength;
- }
- else
- {
- totalSize += _archive.GetBootItemSize(index - _archive.Refs.Size());
- }
- }
- extractCallback->SetTotal(totalSize);
-
- UInt64 currentTotalSize = 0;
- UInt64 currentItemSize;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- streamSpec->SetStream(_stream);
-
- CLimitedSequentialOutStream *outStreamSpec = new CLimitedSequentialOutStream;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
-
- for (i = 0; i < numItems; i++, currentTotalSize += currentItemSize)
- {
- lps->InSize = lps->OutSize = currentTotalSize;
- RINOK(lps->SetCur());
- currentItemSize = 0;
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode;
- askMode = testMode ? NArchive::NExtract::NAskMode::kTest : NArchive::NExtract::NAskMode::kExtract;
- UInt32 index = allFilesMode ? i : indices[i];
-
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
- UInt64 blockIndex;
- if (index < (UInt32)_archive.Refs.Size())
- {
- const CRef &ref = _archive.Refs[index];
- const CDir &item = ref.Dir->_subItems[ref.Index];
- if (item.IsDir())
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
- currentItemSize = item.DataLength;
- blockIndex = item.ExtentLocation;
- }
- else
- {
- int bootIndex = index - _archive.Refs.Size();
- const CBootInitialEntry &be = _archive.BootEntries[bootIndex];
- currentItemSize = _archive.GetBootItemSize(bootIndex);
- blockIndex = be.LoadRBA;
- }
-
- if (!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- outStreamSpec->SetStream(realOutStream);
- realOutStream.Release();
- outStreamSpec->Init(currentItemSize);
- RINOK(_stream->Seek(blockIndex * _archive.BlockSize, STREAM_SEEK_SET, NULL));
- streamSpec->Init(currentItemSize);
- RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
- outStreamSpec->ReleaseStream();
- RINOK(extractCallback->SetOperationResult(outStreamSpec->IsFinishedOK() ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kDataError));
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
-{
- COM_TRY_BEGIN
- *stream = 0;
- UInt64 blockIndex;
- UInt64 currentItemSize;
- if (index < (UInt32)_archive.Refs.Size())
- {
- const CRef &ref = _archive.Refs[index];
- const CDir &item = ref.Dir->_subItems[ref.Index];
- if (item.IsDir())
- return S_FALSE;
- currentItemSize = item.DataLength;
- blockIndex = item.ExtentLocation;
- }
- else
- {
- int bootIndex = index - _archive.Refs.Size();
- const CBootInitialEntry &be = _archive.BootEntries[bootIndex];
- currentItemSize = _archive.GetBootItemSize(bootIndex);
- blockIndex = be.LoadRBA;
- }
- return CreateLimitedInStream(_stream, blockIndex * _archive.BlockSize, currentItemSize, stream);
- COM_TRY_END
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHandler.h
deleted file mode 100644
index 1dcade8f9..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHandler.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// IsoHandler.h
-
-#ifndef __ISO_HANDLER_H
-#define __ISO_HANDLER_H
-
-#include "Common/MyCom.h"
-#include "../IArchive.h"
-
-#include "IsoIn.h"
-#include "IsoItem.h"
-
-namespace NArchive {
-namespace NIso {
-
-class CHandler:
- public IInArchive,
- public IInArchiveGetStream,
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _stream;
- CInArchive _archive;
-public:
- MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
- INTERFACE_IInArchive(;)
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHeader.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHeader.cpp
deleted file mode 100644
index b3e418bbc..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHeader.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// Archive/Iso/Header.h
-
-#include "StdAfx.h"
-
-#include "IsoHeader.h"
-
-namespace NArchive {
-namespace NIso {
-
-const char *kElToritoSpec = "EL TORITO SPECIFICATION\0\0\0\0\0\0\0\0\0";
-
-const wchar_t *kMediaTypes[5] =
-{
- L"NoEmulation",
- L"1.2M",
- L"1.44M",
- L"2.88M",
- L"HardDisk"
-};
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHeader.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHeader.h
deleted file mode 100644
index 9702d70ae..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoHeader.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Archive/IsoHeader.h
-
-#ifndef __ARCHIVE_ISO_HEADER_H
-#define __ARCHIVE_ISO_HEADER_H
-
-#include "Common/Types.h"
-
-namespace NArchive {
-namespace NIso {
-
-namespace NVolDescType
-{
- const Byte kBootRecord = 0;
- const Byte kPrimaryVol = 1;
- const Byte kSupplementaryVol = 2;
- const Byte kVolParttition = 3;
- const Byte kTerminator = 255;
-}
-
-const Byte kVersion = 1;
-
-namespace NFileFlags
-{
- const Byte kDirectory = 1 << 1;
-}
-
-extern const char *kElToritoSpec;
-
-const UInt32 kStartPos = 0x8000;
-
-namespace NBootEntryId
-{
- const Byte kValidationEntry = 1;
- const Byte kInitialEntryNotBootable = 0;
- const Byte kInitialEntryBootable = 0x88;
-}
-
-namespace NBootPlatformId
-{
- const Byte kX86 = 0;
- const Byte kPowerPC = 1;
- const Byte kMac = 2;
-}
-
-const BYTE kBootMediaTypeMask = 0xF;
-
-namespace NBootMediaType
-{
- const Byte kNoEmulation = 0;
- const Byte k1d2Floppy = 1;
- const Byte k1d44Floppy = 2;
- const Byte k2d88Floppy = 3;
- const Byte kHardDisk = 4;
-}
-
-const int kNumBootMediaTypes = 5;
-extern const wchar_t *kMediaTypes[];
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoIn.cpp
deleted file mode 100644
index 84143348b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoIn.cpp
+++ /dev/null
@@ -1,452 +0,0 @@
-// Archive/IsoIn.cpp
-
-#include "StdAfx.h"
-
-#include "IsoIn.h"
-
-#include "../../Common/StreamUtils.h"
-
-namespace NArchive {
-namespace NIso {
-
-Byte CInArchive::ReadByte()
-{
- if (m_BufferPos >= BlockSize)
- m_BufferPos = 0;
- if (m_BufferPos == 0)
- {
- size_t processedSize = BlockSize;
- if (ReadStream(_stream, m_Buffer, &processedSize) != S_OK)
- throw 1;
- if (processedSize != BlockSize)
- throw 1;
- }
- Byte b = m_Buffer[m_BufferPos++];
- _position++;
- return b;
-}
-
-void CInArchive::ReadBytes(Byte *data, UInt32 size)
-{
- for (UInt32 i = 0; i < size; i++)
- data[i] = ReadByte();
-}
-
-void CInArchive::Skip(size_t size)
-{
- while (size-- != 0)
- ReadByte();
-}
-
-void CInArchive::SkipZeros(size_t size)
-{
- while (size-- != 0)
- {
- Byte b = ReadByte();
- if (b != 0)
- throw 1;
- }
-}
-
-UInt16 CInArchive::ReadUInt16Spec()
-{
- UInt16 value = 0;
- for (int i = 0; i < 2; i++)
- value |= ((UInt16)(ReadByte()) << (8 * i));
- return value;
-}
-
-
-UInt16 CInArchive::ReadUInt16()
-{
- Byte b[4];
- ReadBytes(b, 4);
- UInt32 value = 0;
- for (int i = 0; i < 2; i++)
- {
- if (b[i] != b[3 - i])
- throw 1;
- value |= ((UInt16)(b[i]) << (8 * i));
- }
- return (UInt16)value;
-}
-
-UInt32 CInArchive::ReadUInt32Le()
-{
- UInt32 value = 0;
- for (int i = 0; i < 4; i++)
- value |= ((UInt32)(ReadByte()) << (8 * i));
- return value;
-}
-
-UInt32 CInArchive::ReadUInt32Be()
-{
- UInt32 value = 0;
- for (int i = 0; i < 4; i++)
- {
- value <<= 8;
- value |= ReadByte();
- }
- return value;
-}
-
-UInt32 CInArchive::ReadUInt32()
-{
- Byte b[8];
- ReadBytes(b, 8);
- UInt32 value = 0;
- for (int i = 0; i < 4; i++)
- {
- if (b[i] != b[7 - i])
- throw 1;
- value |= ((UInt32)(b[i]) << (8 * i));
- }
- return value;
-}
-
-UInt32 CInArchive::ReadDigits(int numDigits)
-{
- UInt32 res = 0;
- for (int i = 0; i < numDigits; i++)
- {
- Byte b = ReadByte();
- if (b < '0' || b > '9')
- {
- if (b == 0) // it's bug in some CD's
- b = '0';
- else
- throw 1;
- }
- UInt32 d = (UInt32)(b - '0');
- res *= 10;
- res += d;
- }
- return res;
-}
-
-void CInArchive::ReadDateTime(CDateTime &d)
-{
- d.Year = (UInt16)ReadDigits(4);
- d.Month = (Byte)ReadDigits(2);
- d.Day = (Byte)ReadDigits(2);
- d.Hour = (Byte)ReadDigits(2);
- d.Minute = (Byte)ReadDigits(2);
- d.Second = (Byte)ReadDigits(2);
- d.Hundredths = (Byte)ReadDigits(2);
- d.GmtOffset = (signed char)ReadByte();
-}
-
-void CInArchive::ReadBootRecordDescriptor(CBootRecordDescriptor &d)
-{
- ReadBytes(d.BootSystemId, sizeof(d.BootSystemId));
- ReadBytes(d.BootId, sizeof(d.BootId));
- ReadBytes(d.BootSystemUse, sizeof(d.BootSystemUse));
-}
-
-void CInArchive::ReadRecordingDateTime(CRecordingDateTime &t)
-{
- t.Year = ReadByte();
- t.Month = ReadByte();
- t.Day = ReadByte();
- t.Hour = ReadByte();
- t.Minute = ReadByte();
- t.Second = ReadByte();
- t.GmtOffset = (signed char)ReadByte();
-}
-
-void CInArchive::ReadDirRecord2(CDirRecord &r, Byte len)
-{
- r.ExtendedAttributeRecordLen = ReadByte();
- if (r.ExtendedAttributeRecordLen != 0)
- throw 1;
- r.ExtentLocation = ReadUInt32();
- r.DataLength = ReadUInt32();
- ReadRecordingDateTime(r.DateTime);
- r.FileFlags = ReadByte();
- r.FileUnitSize = ReadByte();
- r.InterleaveGapSize = ReadByte();
- r.VolSequenceNumber = ReadUInt16();
- Byte idLen = ReadByte();
- r.FileId.SetCapacity(idLen);
- ReadBytes((Byte *)r.FileId, idLen);
- int padSize = 1 - (idLen & 1);
-
- // SkipZeros(1 - (idLen & 1));
- Skip(1 - (idLen & 1)); // it's bug in some cd's. Must be zeros
-
- int curPos = 33 + idLen + padSize;
- if (curPos > len)
- throw 1;
- int rem = len - curPos;
- r.SystemUse.SetCapacity(rem);
- ReadBytes((Byte *)r.SystemUse, rem);
-}
-
-void CInArchive::ReadDirRecord(CDirRecord &r)
-{
- Byte len = ReadByte();
- // Some CDs can have incorrect value len = 48 ('0') in VolumeDescriptor.
- // But maybe we must use real "len" for other records.
- len = 34;
- ReadDirRecord2(r, len);
-}
-
-void CInArchive::ReadVolumeDescriptor(CVolumeDescriptor &d)
-{
- d.VolFlags = ReadByte();
- ReadBytes(d.SystemId, sizeof(d.SystemId));
- ReadBytes(d.VolumeId, sizeof(d.VolumeId));
- SkipZeros(8);
- d.VolumeSpaceSize = ReadUInt32();
- ReadBytes(d.EscapeSequence, sizeof(d.EscapeSequence));
- d.VolumeSetSize = ReadUInt16();
- d.VolumeSequenceNumber = ReadUInt16();
- d.LogicalBlockSize = ReadUInt16();
- d.PathTableSize = ReadUInt32();
- d.LPathTableLocation = ReadUInt32Le();
- d.LOptionalPathTableLocation = ReadUInt32Le();
- d.MPathTableLocation = ReadUInt32Be();
- d.MOptionalPathTableLocation = ReadUInt32Be();
- ReadDirRecord(d.RootDirRecord);
- ReadBytes(d.VolumeSetId, sizeof(d.VolumeSetId));
- ReadBytes(d.PublisherId, sizeof(d.PublisherId));
- ReadBytes(d.DataPreparerId, sizeof(d.DataPreparerId));
- ReadBytes(d.ApplicationId, sizeof(d.ApplicationId));
- ReadBytes(d.CopyrightFileId, sizeof(d.CopyrightFileId));
- ReadBytes(d.AbstractFileId, sizeof(d.AbstractFileId));
- ReadBytes(d.BibFileId, sizeof(d.BibFileId));
- ReadDateTime(d.CTime);
- ReadDateTime(d.MTime);
- ReadDateTime(d.ExpirationTime);
- ReadDateTime(d.EffectiveTime);
- d.FileStructureVersion = ReadByte(); // = 1
- SkipZeros(1);
- ReadBytes(d.ApplicationUse, sizeof(d.ApplicationUse));
- SkipZeros(653);
-}
-
-static const Byte kSig_CD001[5] = { 'C', 'D', '0', '0', '1' };
-
-static const Byte kSig_NSR02[5] = { 'N', 'S', 'R', '0', '2' };
-static const Byte kSig_NSR03[5] = { 'N', 'S', 'R', '0', '3' };
-static const Byte kSig_BEA01[5] = { 'B', 'E', 'A', '0', '1' };
-static const Byte kSig_TEA01[5] = { 'T', 'E', 'A', '0', '1' };
-
-static inline bool CheckSignature(const Byte *sig, const Byte *data)
-{
- for (int i = 0; i < 5; i++)
- if (sig[i] != data[i])
- return false;
- return true;
-}
-
-void CInArchive::SeekToBlock(UInt32 blockIndex)
-{
- if (_stream->Seek((UInt64)blockIndex * VolDescs[MainVolDescIndex].LogicalBlockSize, STREAM_SEEK_SET, &_position) != S_OK)
- throw 1;
- m_BufferPos = 0;
-}
-
-void CInArchive::ReadDir(CDir &d, int level)
-{
- if (!d.IsDir())
- return;
- SeekToBlock(d.ExtentLocation);
- UInt64 startPos = _position;
-
- bool firstItem = true;
- for (;;)
- {
- UInt64 offset = _position - startPos;
- if (offset >= d.DataLength)
- break;
- Byte len = ReadByte();
- if (len == 0)
- continue;
- CDir subItem;
- ReadDirRecord2(subItem, len);
- if (firstItem && level == 0)
- IsSusp = subItem.CheckSusp(SuspSkipSize);
-
- if (!subItem.IsSystemItem())
- d._subItems.Add(subItem);
-
- firstItem = false;
- }
- for (int i = 0; i < d._subItems.Size(); i++)
- ReadDir(d._subItems[i], level + 1);
-}
-
-void CInArchive::CreateRefs(CDir &d)
-{
- if (!d.IsDir())
- return;
- for (int i = 0; i < d._subItems.Size(); i++)
- {
- CRef ref;
- CDir &subItem = d._subItems[i];
- subItem.Parent = &d;
- ref.Dir = &d;
- ref.Index = i;
- Refs.Add(ref);
- CreateRefs(subItem);
- }
-}
-
-void CInArchive::ReadBootInfo()
-{
- if (!_bootIsDefined)
- return;
- if (memcmp(_bootDesc.BootSystemId, kElToritoSpec, sizeof(_bootDesc.BootSystemId)) != 0)
- return;
-
- const Byte *p = (const Byte *)_bootDesc.BootSystemUse;
- UInt32 blockIndex = p[0] | ((UInt32)p[1] << 8) | ((UInt32)p[2] << 16) | ((UInt32)p[3] << 24);
- SeekToBlock(blockIndex);
- Byte b = ReadByte();
- if (b != NBootEntryId::kValidationEntry)
- return;
- {
- CBootValidationEntry e;
- e.PlatformId = ReadByte();
- if (ReadUInt16Spec() != 0)
- throw 1;
- ReadBytes(e.Id, sizeof(e.Id));
- /* UInt16 checkSum = */ ReadUInt16Spec();
- if (ReadByte() != 0x55)
- throw 1;
- if (ReadByte() != 0xAA)
- throw 1;
- }
- b = ReadByte();
- if (b == NBootEntryId::kInitialEntryBootable || b == NBootEntryId::kInitialEntryNotBootable)
- {
- CBootInitialEntry e;
- e.Bootable = (b == NBootEntryId::kInitialEntryBootable);
- e.BootMediaType = ReadByte();
- e.LoadSegment = ReadUInt16Spec();
- e.SystemType = ReadByte();
- if (ReadByte() != 0)
- throw 1;
- e.SectorCount = ReadUInt16Spec();
- e.LoadRBA = ReadUInt32Le();
- if (ReadByte() != 0)
- throw 1;
- BootEntries.Add(e);
- }
- else
- return;
-}
-
-HRESULT CInArchive::Open2()
-{
- Clear();
- RINOK(_stream->Seek(kStartPos, STREAM_SEEK_CUR, &_position));
-
- m_BufferPos = 0;
- BlockSize = kBlockSize;
- for (;;)
- {
- Byte sig[7];
- ReadBytes(sig, 7);
- Byte ver = sig[6];
- if (!CheckSignature(kSig_CD001, sig + 1))
- {
- return S_FALSE;
- /*
- if (sig[0] != 0 || ver != 1)
- break;
- if (CheckSignature(kSig_BEA01, sig + 1))
- {
- }
- else if (CheckSignature(kSig_TEA01, sig + 1))
- {
- break;
- }
- else if (CheckSignature(kSig_NSR02, sig + 1))
- {
- }
- else
- break;
- SkipZeros(0x800 - 7);
- continue;
- */
- }
- // version = 2 for ISO 9660:1999?
- if (ver > 2)
- throw S_FALSE;
-
- if (sig[0] == NVolDescType::kTerminator)
- {
- break;
- // Skip(0x800 - 7);
- // continue;
- }
- switch(sig[0])
- {
- case NVolDescType::kBootRecord:
- {
- _bootIsDefined = true;
- ReadBootRecordDescriptor(_bootDesc);
- break;
- }
- case NVolDescType::kPrimaryVol:
- case NVolDescType::kSupplementaryVol:
- {
- // some ISOs have two PrimaryVols.
- CVolumeDescriptor vd;
- ReadVolumeDescriptor(vd);
- if (sig[0] == NVolDescType::kPrimaryVol)
- {
- // some burners write "Joliet" Escape Sequence to primary volume
- memset(vd.EscapeSequence, 0, sizeof(vd.EscapeSequence));
- }
- VolDescs.Add(vd);
- break;
- }
- default:
- break;
- }
- }
- if (VolDescs.IsEmpty())
- return S_FALSE;
- for (MainVolDescIndex = VolDescs.Size() - 1; MainVolDescIndex > 0; MainVolDescIndex--)
- if (VolDescs[MainVolDescIndex].IsJoliet())
- break;
- // MainVolDescIndex = 0; // to read primary volume
- const CVolumeDescriptor &vd = VolDescs[MainVolDescIndex];
- if (vd.LogicalBlockSize != kBlockSize)
- return S_FALSE;
- (CDirRecord &)_rootDir = vd.RootDirRecord;
- ReadDir(_rootDir, 0);
- CreateRefs(_rootDir);
- ReadBootInfo();
- return S_OK;
-}
-
-HRESULT CInArchive::Open(IInStream *inStream)
-{
- _stream = inStream;
- UInt64 pos;
- RINOK(_stream->Seek(0, STREAM_SEEK_CUR, &pos));
- RINOK(_stream->Seek(0, STREAM_SEEK_END, &_archiveSize));
- RINOK(_stream->Seek(pos, STREAM_SEEK_SET, &_position));
- HRESULT res = S_FALSE;
- try { res = Open2(); }
- catch(...) { Clear(); res = S_FALSE; }
- _stream.Release();
- return res;
-}
-
-void CInArchive::Clear()
-{
- Refs.Clear();
- _rootDir.Clear();
- VolDescs.Clear();
- _bootIsDefined = false;
- BootEntries.Clear();
- SuspSkipSize = 0;
- IsSusp = false;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoIn.h
deleted file mode 100644
index 49687e27a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoIn.h
+++ /dev/null
@@ -1,300 +0,0 @@
-// Archive/IsoIn.h
-
-#ifndef __ARCHIVE_ISO_IN_H
-#define __ARCHIVE_ISO_IN_H
-
-#include "Common/IntToString.h"
-#include "Common/MyCom.h"
-
-#include "../../IStream.h"
-
-#include "IsoHeader.h"
-#include "IsoItem.h"
-
-namespace NArchive {
-namespace NIso {
-
-struct CDir: public CDirRecord
-{
- CDir *Parent;
- CObjectVector<CDir> _subItems;
-
- void Clear()
- {
- Parent = 0;
- _subItems.Clear();
- }
-
- int GetLength(bool checkSusp, int skipSize) const
- {
- int len = GetLengthCur(checkSusp, skipSize);
- if (Parent != 0)
- if (Parent->Parent != 0)
- len += 1 + Parent->GetLength(checkSusp, skipSize);
- return len;
- }
-
- int GetLengthU() const
- {
- int len = (int)(FileId.GetCapacity() / 2);
- if (Parent != 0)
- if (Parent->Parent != 0)
- len += 1 + Parent->GetLengthU();
- return len;
- }
-
- AString GetPath(bool checkSusp, int skipSize) const
- {
- AString s;
- int len = GetLength(checkSusp, skipSize);
- char *p = s.GetBuffer(len + 1);
- p += len;
- *p = 0;
- const CDir *cur = this;
- for (;;)
- {
- int curLen = cur->GetLengthCur(checkSusp, skipSize);
- p -= curLen;
- memmove(p, (const char *)(const Byte *)cur->GetNameCur(checkSusp, skipSize), curLen);
- cur = cur->Parent;
- if (cur == 0)
- break;
- if (cur->Parent == 0)
- break;
- p--;
- *p = CHAR_PATH_SEPARATOR;
- }
- s.ReleaseBuffer();
- return s;
- }
-
- UString GetPathU() const
- {
- UString s;
- int len = GetLengthU();
- wchar_t *p = s.GetBuffer(len + 1);
- p += len;
- *p = 0;
- const CDir *cur = this;
- for (;;)
- {
- int curLen = (int)(cur->FileId.GetCapacity() / 2);
- p -= curLen;
- for (int i = 0; i < curLen; i++)
- {
- Byte b0 = ((const Byte *)cur->FileId)[i * 2];
- Byte b1 = ((const Byte *)cur->FileId)[i * 2 + 1];
- p[i] = (wchar_t)(((wchar_t)b0 << 8) | b1);
- }
- cur = cur->Parent;
- if (cur == 0)
- break;
- if (cur->Parent == 0)
- break;
- p--;
- *p = WCHAR_PATH_SEPARATOR;
- }
- s.ReleaseBuffer();
- return s;
- }
-};
-
-struct CDateTime
-{
- UInt16 Year;
- Byte Month;
- Byte Day;
- Byte Hour;
- Byte Minute;
- Byte Second;
- Byte Hundredths;
- signed char GmtOffset; // min intervals from -48 (West) to +52 (East) recorded.
- bool NotSpecified() const { return Year == 0 && Month == 0 && Day == 0 &&
- Hour == 0 && Minute == 0 && Second == 0 && GmtOffset == 0; }
-};
-
-struct CBootRecordDescriptor
-{
- Byte BootSystemId[32]; // a-characters
- Byte BootId[32]; // a-characters
- Byte BootSystemUse[1977];
-};
-
-struct CBootValidationEntry
-{
- Byte PlatformId;
- Byte Id[24]; // to identify the manufacturer/developer of the CD-ROM.
-};
-
-struct CBootInitialEntry
-{
- bool Bootable;
- Byte BootMediaType;
- UInt16 LoadSegment;
- /* This is the load segment for the initial boot image. If this
- value is 0 the system will use the traditional segment of 7C0. If this value
- is non-zero the system will use the specified segment. This applies to x86
- architectures only. For "flat" model architectures (such as Motorola) this
- is the address divided by 10. */
- Byte SystemType; // This must be a copy of byte 5 (System Type) from the
- // Partition Table found in the boot image.
- UInt16 SectorCount; // This is the number of virtual/emulated sectors the system
- // will store at Load Segment during the initial boot procedure.
- UInt32 LoadRBA; // This is the start address of the virtual disk. CD’s use
- // Relative/Logical block addressing.
-
- UInt64 GetSize() const
- {
- // if (BootMediaType == NBootMediaType::k1d44Floppy) (1440 << 10);
- return SectorCount * 512;
- }
-
- UString GetName() const
- {
- UString s;
- if (Bootable)
- s += L"Bootable";
- else
- s += L"NotBootable";
- s += L"_";
- if (BootMediaType >= kNumBootMediaTypes)
- {
- wchar_t name[16];
- ConvertUInt32ToString(BootMediaType, name);
- s += name;
- }
- else
- s += kMediaTypes[BootMediaType];
- s += L".img";
- return s;
- }
-};
-
-struct CVolumeDescriptor
-{
- Byte VolFlags;
- Byte SystemId[32]; // a-characters. An identification of a system
- // which can recognize and act upon the content of the Logical
- // Sectors with logical Sector Numbers 0 to 15 of the volume.
- Byte VolumeId[32]; // d-characters. An identification of the volume.
- UInt32 VolumeSpaceSize; // the number of Logical Blocks in which the Volume Space of the volume is recorded
- Byte EscapeSequence[32];
- UInt16 VolumeSetSize;
- UInt16 VolumeSequenceNumber; // the ordinal number of the volume in the Volume Set of which the volume is a member.
- UInt16 LogicalBlockSize;
- UInt32 PathTableSize;
- UInt32 LPathTableLocation;
- UInt32 LOptionalPathTableLocation;
- UInt32 MPathTableLocation;
- UInt32 MOptionalPathTableLocation;
- CDirRecord RootDirRecord;
- Byte VolumeSetId[128];
- Byte PublisherId[128];
- Byte DataPreparerId[128];
- Byte ApplicationId[128];
- Byte CopyrightFileId[37];
- Byte AbstractFileId[37];
- Byte BibFileId[37];
- CDateTime CTime;
- CDateTime MTime;
- CDateTime ExpirationTime;
- CDateTime EffectiveTime;
- Byte FileStructureVersion; // = 1;
- Byte ApplicationUse[512];
-
- bool IsJoliet() const
- {
- if ((VolFlags & 1) != 0)
- return false;
- Byte b = EscapeSequence[2];
- return (EscapeSequence[0] == 0x25 && EscapeSequence[1] == 0x2F &&
- (b == 0x40 || b == 0x43 || b == 0x45));
- }
-};
-
-struct CRef
-{
- CDir *Dir;
- UInt32 Index;
-};
-
-const UInt32 kBlockSize = 1 << 11;
-
-class CInArchive
-{
- CMyComPtr<IInStream> _stream;
- UInt64 _position;
-
- Byte m_Buffer[kBlockSize];
- UInt32 m_BufferPos;
-
- CDir _rootDir;
- bool _bootIsDefined;
- CBootRecordDescriptor _bootDesc;
-
- void Skip(size_t size);
- void SkipZeros(size_t size);
- Byte ReadByte();
- void ReadBytes(Byte *data, UInt32 size);
- UInt16 ReadUInt16Spec();
- UInt16 ReadUInt16();
- UInt32 ReadUInt32Le();
- UInt32 ReadUInt32Be();
- UInt32 ReadUInt32();
- UInt64 ReadUInt64();
- UInt32 ReadDigits(int numDigits);
- void ReadDateTime(CDateTime &d);
- void ReadRecordingDateTime(CRecordingDateTime &t);
- void ReadDirRecord2(CDirRecord &r, Byte len);
- void ReadDirRecord(CDirRecord &r);
-
- void ReadBootRecordDescriptor(CBootRecordDescriptor &d);
- void ReadVolumeDescriptor(CVolumeDescriptor &d);
-
- void SeekToBlock(UInt32 blockIndex);
- void ReadDir(CDir &d, int level);
- void CreateRefs(CDir &d);
-
- void ReadBootInfo();
- HRESULT Open2();
-public:
- HRESULT Open(IInStream *inStream);
- void Clear();
-
- UInt64 _archiveSize;
-
- CRecordVector<CRef> Refs;
- CObjectVector<CVolumeDescriptor> VolDescs;
- int MainVolDescIndex;
- UInt32 BlockSize;
- CObjectVector<CBootInitialEntry> BootEntries;
-
-
- bool IsJoliet() const { return VolDescs[MainVolDescIndex].IsJoliet(); }
-
- UInt64 GetBootItemSize(int index) const
- {
- const CBootInitialEntry &be = BootEntries[index];
- UInt64 size = be.GetSize();
- if (be.BootMediaType == NBootMediaType::k1d2Floppy)
- size = (1200 << 10);
- else if (be.BootMediaType == NBootMediaType::k1d44Floppy)
- size = (1440 << 10);
- else if (be.BootMediaType == NBootMediaType::k2d88Floppy)
- size = (2880 << 10);
- UInt64 startPos = be.LoadRBA * BlockSize;
- if (startPos < _archiveSize)
- {
- if (_archiveSize - startPos < size)
- size = _archiveSize - startPos;
- }
- return size;
- }
-
- bool IsSusp;
- int SuspSkipSize;
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoItem.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoItem.h
deleted file mode 100644
index f39c2f5d2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoItem.h
+++ /dev/null
@@ -1,141 +0,0 @@
-// Archive/IsoItem.h
-
-#ifndef __ARCHIVE_ISO_ITEM_H
-#define __ARCHIVE_ISO_ITEM_H
-
-#include "Common/Types.h"
-#include "Common/MyString.h"
-#include "Common/Buffer.h"
-
-#include "Windows/Time.h"
-
-#include "IsoHeader.h"
-
-namespace NArchive {
-namespace NIso {
-
-struct CRecordingDateTime
-{
- Byte Year;
- Byte Month;
- Byte Day;
- Byte Hour;
- Byte Minute;
- Byte Second;
- signed char GmtOffset; // min intervals from -48 (West) to +52 (East) recorded.
-
- bool GetFileTime(FILETIME &ft) const
- {
- UInt64 value;
- bool res = NWindows::NTime::GetSecondsSince1601(Year + 1900, Month, Day, Hour, Minute, Second, value);
- if (res)
- {
- value -= (UInt64)((Int64)GmtOffset * 15 * 60);
- value *= 10000000;
- }
- ft.dwLowDateTime = (DWORD)value;
- ft.dwHighDateTime = (DWORD)(value >> 32);
- return res;
- }
-};
-
-struct CDirRecord
-{
- Byte ExtendedAttributeRecordLen;
- UInt32 ExtentLocation;
- UInt32 DataLength;
- CRecordingDateTime DateTime;
- Byte FileFlags;
- Byte FileUnitSize;
- Byte InterleaveGapSize;
- UInt16 VolSequenceNumber;
- CByteBuffer FileId;
- CByteBuffer SystemUse;
-
- bool IsDir() const { return (FileFlags & NFileFlags::kDirectory) != 0; }
- bool IsSystemItem() const
- {
- if (FileId.GetCapacity() != 1)
- return false;
- Byte b = *(const Byte *)FileId;
- return (b == 0 || b == 1);
- }
-
- const Byte* FindSuspName(int skipSize, int &lenRes) const
- {
- lenRes = 0;
- const Byte *p = (const Byte *)SystemUse + skipSize;
- int length = (int)(SystemUse.GetCapacity() - skipSize);
- while (length >= 5)
- {
- int len = p[2];
- if (p[0] == 'N' && p[1] == 'M' && p[3] == 1)
- {
- lenRes = len - 5;
- return p + 5;
- }
- p += len;
- length -= len;
- }
- return 0;
- }
-
- int GetLengthCur(bool checkSusp, int skipSize) const
- {
- if (checkSusp)
- {
- int len;
- const Byte *res = FindSuspName(skipSize, len);
- if (res != 0)
- return len;
- }
- return (int)FileId.GetCapacity();
- }
-
- const Byte* GetNameCur(bool checkSusp, int skipSize) const
- {
- if (checkSusp)
- {
- int len;
- const Byte *res = FindSuspName(skipSize, len);
- if (res != 0)
- return res;
- }
- return (const Byte *)FileId;
- }
-
-
- bool CheckSusp(const Byte *p, int &startPos) const
- {
- if (p[0] == 'S' &&
- p[1] == 'P' &&
- p[2] == 0x7 &&
- p[3] == 0x1 &&
- p[4] == 0xBE &&
- p[5] == 0xEF)
- {
- startPos = p[6];
- return true;
- }
- return false;
- }
-
- bool CheckSusp(int &startPos) const
- {
- const Byte *p = (const Byte *)SystemUse;
- int length = (int)SystemUse.GetCapacity();
- const int kMinLen = 7;
- if (length < kMinLen)
- return false;
- if (CheckSusp(p, startPos))
- return true;
- const int kOffset2 = 14;
- if (length < kOffset2 + kMinLen)
- return false;
- return CheckSusp(p + kOffset2, startPos);
- }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoRegister.cpp
deleted file mode 100644
index b43caba37..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Iso/IsoRegister.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// IsoRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "IsoHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NIso::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Iso", L"iso", 0, 0xE7, { 'C', 'D', '0', '0', '1', 0x1 }, 7, false, CreateArc, 0 };
-
-REGISTER_ARC(Iso)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/LzhHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/LzhHandler.cpp
deleted file mode 100644
index 983d90ec6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/LzhHandler.cpp
+++ /dev/null
@@ -1,783 +0,0 @@
-// LzhHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/Buffer.h"
-#include "Common/ComTry.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../ICoder.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-#include "../Compress/LzhDecoder.h"
-
-#include "IArchive.h"
-
-#include "Common/ItemNameUtils.h"
-
-using namespace NWindows;
-using namespace NTime;
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-
-namespace NArchive {
-namespace NLzh{
-
-const int kMethodIdSize = 5;
-
-const Byte kExtIdFileName = 0x01;
-const Byte kExtIdDirName = 0x02;
-const Byte kExtIdUnixTime = 0x54;
-
-struct CExtension
-{
- Byte Type;
- CByteBuffer Data;
- AString GetString() const
- {
- AString s;
- for (size_t i = 0; i < Data.GetCapacity(); i++)
- {
- char c = (char)Data[i];
- if (c == 0)
- break;
- s += c;
- }
- return s;
- }
-};
-
-struct CItem
-{
- AString Name;
- Byte Method[kMethodIdSize];
- Byte Attributes;
- Byte Level;
- Byte OsId;
- UInt32 PackSize;
- UInt32 Size;
- UInt32 ModifiedTime;
- UInt16 CRC;
- CObjectVector<CExtension> Extensions;
-
- bool IsValidMethod() const { return (Method[0] == '-' && Method[1] == 'l' && Method[4] == '-'); }
- bool IsLhMethod() const {return (IsValidMethod() && Method[2] == 'h'); }
- bool IsDir() const {return (IsLhMethod() && Method[3] == 'd'); }
-
- bool IsCopyMethod() const
- {
- return (IsLhMethod() && Method[3] == '0') ||
- (IsValidMethod() && Method[2] == 'z' && Method[3] == '4');
- }
-
- bool IsLh1GroupMethod() const
- {
- if (!IsLhMethod())
- return false;
- switch(Method[3])
- {
- case '1':
- return true;
- }
- return false;
- }
-
- bool IsLh4GroupMethod() const
- {
- if (!IsLhMethod())
- return false;
- switch(Method[3])
- {
- case '4':
- case '5':
- case '6':
- case '7':
- return true;
- }
- return false;
- }
-
- int GetNumDictBits() const
- {
- if (!IsLhMethod())
- return 0;
- switch(Method[3])
- {
- case '1': return 12;
- case '2': return 13;
- case '3': return 13;
- case '4': return 12;
- case '5': return 13;
- case '6': return 15;
- case '7': return 16;
- }
- return 0;
- }
-
- int FindExt(Byte type) const
- {
- for (int i = 0; i < Extensions.Size(); i++)
- if (Extensions[i].Type == type)
- return i;
- return -1;
- }
- bool GetUnixTime(UInt32 &value) const
- {
- int index = FindExt(kExtIdUnixTime);
- if (index < 0)
- {
- if (Level == 2)
- {
- value = ModifiedTime;
- return true;
- }
- return false;
- }
- const Byte *data = (const Byte *)(Extensions[index].Data);
- value = GetUi32(data);
- return true;
- }
-
- AString GetDirName() const
- {
- int index = FindExt(kExtIdDirName);
- if (index < 0)
- return AString();
- return Extensions[index].GetString();
- }
-
- AString GetFileName() const
- {
- int index = FindExt(kExtIdFileName);
- if (index < 0)
- return Name;
- return Extensions[index].GetString();
- }
-
- AString GetName() const
- {
- AString dirName = GetDirName();
- dirName.Replace((char)(unsigned char)0xFF, CHAR_PATH_SEPARATOR);
- if (!dirName.IsEmpty())
- {
- char c = dirName[dirName.Length() - 1];
- if (c != CHAR_PATH_SEPARATOR)
- dirName += CHAR_PATH_SEPARATOR;
- }
- return dirName + GetFileName();
- }
-};
-
-struct CItemEx: public CItem
-{
- UInt64 DataPosition;
-};
-
-class CInArchive
-{
- CMyComPtr<IInStream> m_Stream;
- UInt64 m_Position;
-
- HRESULT ReadBytes(void *data, UInt32 size, UInt32 &processedSize);
- HRESULT CheckReadBytes(void *data, UInt32 size);
-public:
- HRESULT Open(IInStream *inStream);
- HRESULT GetNextItem(bool &filled, CItemEx &itemInfo);
- HRESULT Skip(UInt64 numBytes);
-};
-
-HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 &processedSize)
-{
- size_t realProcessedSize = size;
- RINOK(ReadStream(m_Stream, data, &realProcessedSize));
- processedSize = (UInt32)realProcessedSize;
- m_Position += processedSize;
- return S_OK;
-}
-
-HRESULT CInArchive::CheckReadBytes(void *data, UInt32 size)
-{
- UInt32 processedSize;
- RINOK(ReadBytes(data, size, processedSize));
- return (processedSize == size) ? S_OK: S_FALSE;
-}
-
-HRESULT CInArchive::Open(IInStream *inStream)
-{
- RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &m_Position));
- m_Stream = inStream;
- return S_OK;
-}
-
-static const Byte *ReadUInt16(const Byte *p, UInt16 &v)
-{
- v = Get16(p);
- return p + 2;
-}
-
-static const Byte *ReadString(const Byte *p, size_t size, AString &s)
-{
- s.Empty();
- for (size_t i = 0; i < size; i++)
- {
- char c = p[i];
- if (c == 0)
- break;
- s += c;
- }
- return p + size;
-}
-
-static Byte CalcSum(const Byte *data, size_t size)
-{
- Byte sum = 0;
- for (size_t i = 0; i < size; i++)
- sum = (Byte)(sum + data[i]);
- return sum;
-}
-
-HRESULT CInArchive::GetNextItem(bool &filled, CItemEx &item)
-{
- filled = false;
-
- UInt32 processedSize;
- Byte startHeader[2];
- RINOK(ReadBytes(startHeader, 2, processedSize))
- if (processedSize == 0)
- return S_OK;
- if (processedSize == 1)
- return (startHeader[0] == 0) ? S_OK: S_FALSE;
- if (startHeader[0] == 0 && startHeader[1] == 0)
- return S_OK;
-
- Byte header[256];
- const UInt32 kBasicPartSize = 22;
- RINOK(ReadBytes(header, kBasicPartSize, processedSize));
- if (processedSize != kBasicPartSize)
- return (startHeader[0] == 0) ? S_OK: S_FALSE;
-
- const Byte *p = header;
- memmove(item.Method, p, kMethodIdSize);
- if (!item.IsValidMethod())
- return S_OK;
- p += kMethodIdSize;
- item.PackSize = Get32(p);
- item.Size = Get32(p + 4);
- item.ModifiedTime = Get32(p + 8);
- item.Attributes = p[12];
- item.Level = p[13];
- p += 14;
- if (item.Level > 2)
- return S_FALSE;
- UInt32 headerSize;
- if (item.Level < 2)
- {
- headerSize = startHeader[0];
- if (headerSize < kBasicPartSize)
- return S_FALSE;
- UInt32 remain = headerSize - kBasicPartSize;
- RINOK(CheckReadBytes(header + kBasicPartSize, remain));
- if (startHeader[1] != CalcSum(header, headerSize))
- return S_FALSE;
- size_t nameLength = *p++;
- if ((p - header) + nameLength + 2 > headerSize)
- return S_FALSE;
- p = ReadString(p, nameLength, item.Name);
- }
- else
- headerSize = startHeader[0] | ((UInt32)startHeader[1] << 8);
- p = ReadUInt16(p, item.CRC);
- if (item.Level != 0)
- {
- if (item.Level == 2)
- {
- RINOK(CheckReadBytes(header + kBasicPartSize, 2));
- }
- if ((size_t)(p - header) + 3 > headerSize)
- return S_FALSE;
- item.OsId = *p++;
- UInt16 nextSize;
- p = ReadUInt16(p, nextSize);
- while (nextSize != 0)
- {
- if (nextSize < 3)
- return S_FALSE;
- if (item.Level == 1)
- {
- if (item.PackSize < nextSize)
- return S_FALSE;
- item.PackSize -= nextSize;
- }
- CExtension ext;
- RINOK(CheckReadBytes(&ext.Type, 1))
- nextSize -= 3;
- ext.Data.SetCapacity(nextSize);
- RINOK(CheckReadBytes((Byte *)ext.Data, nextSize))
- item.Extensions.Add(ext);
- Byte hdr2[2];
- RINOK(CheckReadBytes(hdr2, 2));
- ReadUInt16(hdr2, nextSize);
- }
- }
- item.DataPosition = m_Position;
- filled = true;
- return S_OK;
-}
-
-HRESULT CInArchive::Skip(UInt64 numBytes)
-{
- UInt64 newPostion;
- RINOK(m_Stream->Seek(numBytes, STREAM_SEEK_CUR, &newPostion));
- m_Position += numBytes;
- if (m_Position != newPostion)
- return E_FAIL;
- return S_OK;
-}
-
-struct COsPair
-{
- Byte Id;
- const char *Name;
-};
-
-static COsPair g_OsPairs[] =
-{
- { 0, "MS-DOS" },
- { 'M', "MS-DOS" },
- { '2', "OS/2" },
- { '9', "OS9" },
- { 'K', "OS/68K" },
- { '3', "OS/386" },
- { 'H', "HUMAN" },
- { 'U', "UNIX" },
- { 'C', "CP/M" },
- { 'F', "FLEX" },
- { 'm', "Mac" },
- { 'R', "Runser" },
- { 'T', "TownsOS" },
- { 'X', "XOSK" },
- { 'w', "Windows 95" },
- { 'W', "Windows NT" },
- { 'J', "Java VM" }
-};
-
-static const char *kUnknownOS = "Unknown";
-
-static const char *GetOS(Byte osId)
-{
- for (int i = 0; i < sizeof(g_OsPairs) / sizeof(g_OsPairs[0]); i++)
- if (g_OsPairs[i].Id == osId)
- return g_OsPairs[i].Name;
- return kUnknownOS;
-};
-
-static STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- // { NULL, kpidAttrib, VT_UI4},
- { NULL, kpidCRC, VT_UI4},
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidHostOS, VT_BSTR}
-};
-
-class CCRC
-{
- UInt16 _value;
-public:
- static UInt16 Table[256];
- static void InitTable();
-
- CCRC(): _value(0){};
- void Init() { _value = 0; }
- void Update(const void *data, size_t size);
- UInt16 GetDigest() const { return _value; }
-};
-
-static const UInt16 kCRCPoly = 0xA001;
-
-UInt16 CCRC::Table[256];
-
-void CCRC::InitTable()
-{
- for (UInt32 i = 0; i < 256; i++)
- {
- UInt32 r = i;
- for (int j = 0; j < 8; j++)
- if (r & 1)
- r = (r >> 1) ^ kCRCPoly;
- else
- r >>= 1;
- CCRC::Table[i] = (UInt16)r;
- }
-}
-
-class CCRCTableInit
-{
-public:
- CCRCTableInit() { CCRC::InitTable(); }
-} g_CRCTableInit;
-
-void CCRC::Update(const void *data, size_t size)
-{
- UInt16 v = _value;
- const Byte *p = (const Byte *)data;
- for (; size > 0; size--, p++)
- v = (UInt16)(Table[((Byte)(v)) ^ *p] ^ (v >> 8));
- _value = v;
-}
-
-
-class COutStreamWithCRC:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-private:
- CCRC _crc;
- CMyComPtr<ISequentialOutStream> _stream;
-public:
- void Init(ISequentialOutStream *stream)
- {
- _stream = stream;
- _crc.Init();
- }
- void ReleaseStream() { _stream.Release(); }
- UInt32 GetCRC() const { return _crc.GetDigest(); }
- void InitCRC() { _crc.Init(); }
-
-};
-
-STDMETHODIMP COutStreamWithCRC::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize;
- HRESULT result;
- if(!_stream)
- {
- realProcessedSize = size;
- result = S_OK;
- }
- else
- result = _stream->Write(data, size, &realProcessedSize);
- _crc.Update(data, realProcessedSize);
- if(processedSize != NULL)
- *processedSize = realProcessedSize;
- return result;
-}
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
- CObjectVector<CItemEx> _items;
- CMyComPtr<IInStream> _stream;
-public:
- MY_UNKNOWN_IMP1(IInArchive)
- INTERFACE_IInArchive(;)
- CHandler();
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO
-
-CHandler::CHandler() {}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _items.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- const CItemEx &item = _items[index];
- switch(propID)
- {
- case kpidPath:
- {
- UString s = NItemName::WinNameToOSName(MultiByteToUnicodeString(item.GetName(), CP_OEMCP));
- if (!s.IsEmpty())
- {
- if (s[s.Length() - 1] == WCHAR_PATH_SEPARATOR)
- s.Delete(s.Length() - 1);
- prop = s;
- }
- break;
- }
- case kpidIsDir: prop = item.IsDir(); break;
- case kpidSize: prop = item.Size; break;
- case kpidPackSize: prop = item.PackSize; break;
- case kpidCRC: prop = (UInt32)item.CRC; break;
- case kpidHostOS: prop = GetOS(item.OsId); break;
- case kpidMTime:
- {
- FILETIME utc;
- UInt32 unixTime;
- if (item.GetUnixTime(unixTime))
- NTime::UnixTimeToFileTime(unixTime, utc);
- else
- {
- FILETIME localFileTime;
- if (DosTimeToFileTime(item.ModifiedTime, localFileTime))
- {
- if (!LocalFileTimeToFileTime(&localFileTime, &utc))
- utc.dwHighDateTime = utc.dwLowDateTime = 0;
- }
- else
- utc.dwHighDateTime = utc.dwLowDateTime = 0;
- }
- prop = utc;
- break;
- }
- // case kpidAttrib: prop = (UInt32)item.Attributes; break;
- case kpidMethod:
- {
- char method2[kMethodIdSize + 1];
- method2[kMethodIdSize] = 0;
- memcpy(method2, item.Method, kMethodIdSize);
- prop = method2;
- break;
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 * /* maxCheckStartPosition */, IArchiveOpenCallback *callback)
-{
- COM_TRY_BEGIN
- try
- {
- _items.Clear();
- CInArchive archive;
-
- UInt64 endPos = 0;
- bool needSetTotal = true;
-
- if (callback != NULL)
- {
- RINOK(stream->Seek(0, STREAM_SEEK_END, &endPos));
- RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL));
- }
-
- RINOK(archive.Open(stream));
- for (;;)
- {
- CItemEx item;
- bool filled;
- HRESULT result = archive.GetNextItem(filled, item);
- if (result == S_FALSE)
- return S_FALSE;
- if (result != S_OK)
- return S_FALSE;
- if (!filled)
- break;
- _items.Add(item);
- archive.Skip(item.PackSize);
- if (callback != NULL)
- {
- if (needSetTotal)
- {
- RINOK(callback->SetTotal(NULL, &endPos));
- needSetTotal = false;
- }
- if (_items.Size() % 100 == 0)
- {
- UInt64 numFiles = _items.Size();
- UInt64 numBytes = item.DataPosition;
- RINOK(callback->SetCompleted(&numFiles, &numBytes));
- }
- }
- }
- if (_items.IsEmpty())
- return S_FALSE;
-
- _stream = stream;
- }
- catch(...)
- {
- return S_FALSE;
- }
- COM_TRY_END
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _items.Clear();
- _stream.Release();
- return S_OK;
-}
-
-
-
-//////////////////////////////////////
-// CHandler::DecompressItems
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 testModeSpec, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (testModeSpec != 0);
- UInt64 totalUnPacked = 0, totalPacked = 0;
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _items.Size();
- if(numItems == 0)
- return S_OK;
- UInt32 i;
- for(i = 0; i < numItems; i++)
- {
- const CItemEx &item = _items[allFilesMode ? i : indices[i]];
- totalUnPacked += item.Size;
- totalPacked += item.PackSize;
- }
- extractCallback->SetTotal(totalUnPacked);
-
- UInt64 currentTotalUnPacked = 0, currentTotalPacked = 0;
- UInt64 currentItemUnPacked, currentItemPacked;
-
- NCompress::NLzh::NDecoder::CCoder *lzhDecoderSpec = 0;
- CMyComPtr<ICompressCoder> lzhDecoder;
- CMyComPtr<ICompressCoder> lzh1Decoder;
- CMyComPtr<ICompressCoder> arj2Decoder;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- streamSpec->SetStream(_stream);
-
- for(i = 0; i < numItems; i++, currentTotalUnPacked += currentItemUnPacked,
- currentTotalPacked += currentItemPacked)
- {
- currentItemUnPacked = 0;
- currentItemPacked = 0;
-
- lps->InSize = currentTotalPacked;
- lps->OutSize = currentTotalUnPacked;
- RINOK(lps->SetCur());
-
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode;
- askMode = testMode ? NExtract::NAskMode::kTest :
- NExtract::NAskMode::kExtract;
- Int32 index = allFilesMode ? i : indices[i];
- const CItemEx &item = _items[index];
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
- if (item.IsDir())
- {
- // if (!testMode)
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kOK));
- }
- continue;
- }
-
- if (!testMode && (!realOutStream))
- continue;
-
- RINOK(extractCallback->PrepareOperation(askMode));
- currentItemUnPacked = item.Size;
- currentItemPacked = item.PackSize;
-
- {
- COutStreamWithCRC *outStreamSpec = new COutStreamWithCRC;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
- outStreamSpec->Init(realOutStream);
- realOutStream.Release();
-
- UInt64 pos;
- _stream->Seek(item.DataPosition, STREAM_SEEK_SET, &pos);
-
- streamSpec->Init(item.PackSize);
-
- HRESULT result = S_OK;
- Int32 opRes = NExtract::NOperationResult::kOK;
-
- if (item.IsCopyMethod())
- {
- result = copyCoder->Code(inStream, outStream, NULL, NULL, progress);
- if (result == S_OK && copyCoderSpec->TotalSize != item.PackSize)
- result = S_FALSE;
- }
- else if (item.IsLh4GroupMethod())
- {
- if (!lzhDecoder)
- {
- lzhDecoderSpec = new NCompress::NLzh::NDecoder::CCoder;
- lzhDecoder = lzhDecoderSpec;
- }
- lzhDecoderSpec->SetDictionary(item.GetNumDictBits());
- result = lzhDecoder->Code(inStream, outStream, NULL, &currentItemUnPacked, progress);
- }
- /*
- else if (item.IsLh1GroupMethod())
- {
- if (!lzh1Decoder)
- {
- lzh1DecoderSpec = new NCompress::NLzh1::NDecoder::CCoder;
- lzh1Decoder = lzh1DecoderSpec;
- }
- lzh1DecoderSpec->SetDictionary(item.GetNumDictBits());
- result = lzh1Decoder->Code(inStream, outStream, NULL, &currentItemUnPacked, progress);
- }
- */
- else
- opRes = NExtract::NOperationResult::kUnSupportedMethod;
-
- if (opRes == NExtract::NOperationResult::kOK)
- {
- if (result == S_FALSE)
- opRes = NExtract::NOperationResult::kDataError;
- else
- {
- RINOK(result);
- if (outStreamSpec->GetCRC() != item.CRC)
- opRes = NExtract::NOperationResult::kCRCError;
- }
- }
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(opRes));
- }
- }
- return S_OK;
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Lzh", L"lzh lha", 0, 6, { '-', 'l' }, 2, false, CreateArc, 0 };
-
-REGISTER_ARC(Lzh)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/LzmaHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/LzmaHandler.cpp
deleted file mode 100644
index a41b7d150..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/LzmaHandler.cpp
+++ /dev/null
@@ -1,440 +0,0 @@
-// LzmaHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/ComTry.h"
-#include "Common/IntToString.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../Common/CreateCoder.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/LzmaDecoder.h"
-
-#include "Common/DummyOutStream.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NLzma {
-
-static bool CheckDicSize(const Byte *p)
-{
- UInt32 dicSize = GetUi32(p);
- for (int i = 1; i <= 30; i++)
- if (dicSize == ((UInt32)2 << i) || dicSize == ((UInt32)3 << i))
- return true;
- return (dicSize == 0xFFFFFFFF);
-}
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMethod, VT_BSTR}
-};
-
-struct CHeader
-{
- UInt64 Size;
- Byte FilterID;
- Byte LzmaProps[5];
-
- UInt32 GetDicSize() const { return GetUi32(LzmaProps + 1); }
- bool HasSize() const { return (Size != (UInt64)(Int64)-1); }
- bool Parse(const Byte *buf, bool isThereFilter);
-};
-
-bool CHeader::Parse(const Byte *buf, bool isThereFilter)
-{
- FilterID = 0;
- if (isThereFilter)
- FilterID = buf[0];
- const Byte *sig = buf + (isThereFilter ? 1 : 0);
- for (int i = 0; i < 5; i++)
- LzmaProps[i] = sig[i];
- Size = GetUi64(sig + 5);
- return
- LzmaProps[0] < 5 * 5 * 9 &&
- FilterID < 2 &&
- (!HasSize() || Size < ((UInt64)1 << 56)) &&
- CheckDicSize(LzmaProps + 1);
-}
-
-class CDecoder
-{
- NCompress::NLzma::CDecoder *_lzmaDecoderSpec;
- CMyComPtr<ICompressCoder> _lzmaDecoder;
- CMyComPtr<ISequentialOutStream> _bcjStream;
-public:
- ~CDecoder();
- HRESULT Create(DECL_EXTERNAL_CODECS_LOC_VARS
- bool filtered, ISequentialInStream *inStream);
-
- HRESULT Code(const CHeader &header, ISequentialOutStream *outStream, ICompressProgressInfo *progress);
-
- UInt64 GetInputProcessedSize() const { return _lzmaDecoderSpec->GetInputProcessedSize(); }
-
- void ReleaseInStream() { if (_lzmaDecoder) _lzmaDecoderSpec->ReleaseInStream(); }
-
- HRESULT ReadInput(Byte *data, UInt32 size, UInt32 *processedSize)
- { return _lzmaDecoderSpec->ReadFromInputStream(data, size, processedSize); }
-};
-
-static const UInt64 k_BCJ = 0x03030103;
-
-HRESULT CDecoder::Create(
- DECL_EXTERNAL_CODECS_LOC_VARS
- bool filteredMode, ISequentialInStream *inStream)
-{
- if (!_lzmaDecoder)
- {
- _lzmaDecoderSpec = new NCompress::NLzma::CDecoder;
- _lzmaDecoder = _lzmaDecoderSpec;
- }
-
- if (filteredMode)
- {
- if (!_bcjStream)
- {
- CMyComPtr<ICompressCoder> coder;
- RINOK(CreateCoder(EXTERNAL_CODECS_LOC_VARS k_BCJ, coder, false));
- if (!coder)
- return E_NOTIMPL;
- coder.QueryInterface(IID_ISequentialOutStream, &_bcjStream);
- if (!_bcjStream)
- return E_NOTIMPL;
- }
- }
-
- return _lzmaDecoderSpec->SetInStream(inStream);
-}
-
-CDecoder::~CDecoder()
-{
- ReleaseInStream();
-}
-
-HRESULT CDecoder::Code(const CHeader &header, ISequentialOutStream *outStream,
- ICompressProgressInfo *progress)
-{
- if (header.FilterID > 1)
- return E_NOTIMPL;
-
- {
- CMyComPtr<ICompressSetDecoderProperties2> setDecoderProperties;
- _lzmaDecoder.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties);
- if (!setDecoderProperties)
- return E_NOTIMPL;
- RINOK(setDecoderProperties->SetDecoderProperties2(header.LzmaProps, 5));
- }
-
- CMyComPtr<ICompressSetOutStream> setOutStream;
-
- bool filteredMode = (header.FilterID == 1);
-
- if (filteredMode)
- {
- _bcjStream.QueryInterface(IID_ICompressSetOutStream, &setOutStream);
- if (!setOutStream)
- return E_NOTIMPL;
- RINOK(setOutStream->SetOutStream(outStream));
- outStream = _bcjStream;
- }
-
- const UInt64 *Size = header.HasSize() ? &header.Size : NULL;
- HRESULT res = _lzmaDecoderSpec->CodeResume(outStream, Size, progress);
-
- if (filteredMode)
- {
- CMyComPtr<IOutStreamFlush> flush;
- _bcjStream.QueryInterface(IID_IOutStreamFlush, &flush);
- if (flush)
- {
- HRESULT res2 = flush->Flush();
- if (res == S_OK)
- res = res2;
- }
- HRESULT res2 = setOutStream->ReleaseOutStream();
- if (res == S_OK)
- res = res2;
- }
- RINOK(res);
-
- return S_OK;
-}
-
-
-class CHandler:
- public IInArchive,
- public IArchiveOpenSeq,
- PUBLIC_ISetCompressCodecsInfo
- public CMyUnknownImp
-{
- CHeader _header;
- bool _lzma86;
- UInt64 _startPosition;
- UInt64 _packSize;
- bool _packSizeDefined;
- CMyComPtr<IInStream> _stream;
- CMyComPtr<ISequentialInStream> _seqStream;
-
- DECL_EXTERNAL_CODECS_VARS
- DECL_ISetCompressCodecsInfo
-
-public:
- MY_QUERYINTERFACE_BEGIN
- MY_QUERYINTERFACE_ENTRY(IInArchive)
- MY_QUERYINTERFACE_ENTRY(IArchiveOpenSeq)
- QUERY_ENTRY_ISetCompressCodecsInfo
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
- INTERFACE_IInArchive(;)
- STDMETHOD(OpenSeq)(ISequentialInStream *stream);
-
- CHandler(bool lzma86) { _lzma86 = lzma86; }
-
- unsigned GetHeaderSize() const { return 5 + 8 + (_lzma86 ? 1 : 0); }
-
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO_Table
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidPhySize: if (_packSizeDefined) prop = _packSize; break;
- }
- prop.Detach(value);
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = 1;
- return S_OK;
-}
-
-static void DictSizeToString(UInt32 value, char *s)
-{
- for (int i = 0; i <= 31; i++)
- if ((UInt32(1) << i) == value)
- {
- ::ConvertUInt32ToString(i, s);
- return;
- }
- char c = 'b';
- if ((value & ((1 << 20) - 1)) == 0)
- {
- value >>= 20;
- c = 'm';
- }
- else if ((value & ((1 << 10) - 1)) == 0)
- {
- value >>= 10;
- c = 'k';
- }
- ::ConvertUInt32ToString(value, s);
- int p = MyStringLen(s);
- s[p++] = c;
- s[p++] = '\0';
-}
-
-static void MyStrCat(char *d, const char *s)
-{
- MyStringCopy(d + MyStringLen(d), s);
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value)
-{
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidSize: if (_stream && _header.HasSize()) prop = _header.Size; break;
- case kpidPackSize: if (_packSizeDefined) prop = _packSize; break;
- case kpidMethod:
- if (_stream)
- {
- char s[64];
- s[0] = '\0';
- if (_header.FilterID != 0)
- MyStrCat(s, "BCJ ");
- MyStrCat(s, "LZMA:");
- DictSizeToString(_header.GetDicSize(), s + MyStringLen(s));
- prop = s;
- }
- break;
- }
- prop.Detach(value);
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream, const UInt64 *, IArchiveOpenCallback *)
-{
- RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &_startPosition));
-
- const UInt32 kBufSize = 1 + 5 + 8 + 1;
- Byte buf[kBufSize];
-
- RINOK(ReadStream_FALSE(inStream, buf, kBufSize));
-
- if (!_header.Parse(buf, _lzma86))
- return S_FALSE;
- const Byte *start = buf + GetHeaderSize();
- if (start[0] != 0)
- return S_FALSE;
-
- UInt64 endPos;
- RINOK(inStream->Seek(0, STREAM_SEEK_END, &endPos));
- _packSize = endPos - _startPosition;
- _packSizeDefined = true;
-
- _stream = inStream;
- _seqStream = inStream;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::OpenSeq(ISequentialInStream *stream)
-{
- Close();
- _seqStream = stream;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _packSizeDefined = false;
- _stream.Release();
- _seqStream.Release();
- return S_OK;
-}
-
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool allFilesMode = (numItems == (UInt32)-1);
- if (!allFilesMode)
- {
- if (numItems == 0)
- return S_OK;
- if (numItems != 1 || indices[0] != 0)
- return E_INVALIDARG;
- }
-
- bool testMode = (_aTestMode != 0);
- if (_stream)
- extractCallback->SetTotal(_packSize);
-
-
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- RINOK(extractCallback->GetStream(0, &realOutStream, askMode));
- if (!testMode && !realOutStream)
- return S_OK;
-
- extractCallback->PrepareOperation(askMode);
-
- CDummyOutStream *outStreamSpec = new CDummyOutStream;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
- outStreamSpec->SetStream(realOutStream);
- outStreamSpec->Init();
- realOutStream.Release();
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, true);
-
- if (_stream)
- {
- RINOK(_stream->Seek(_startPosition, STREAM_SEEK_SET, NULL));
- }
-
- CDecoder decoder;
- HRESULT result = decoder.Create(
- EXTERNAL_CODECS_VARS
- _lzma86, _seqStream);
- RINOK(result);
-
- Int32 opRes = NArchive::NExtract::NOperationResult::kOK;
- bool firstItem = true;
-
- for (;;)
- {
- lps->OutSize = outStreamSpec->GetSize();
- lps->InSize = _packSize = decoder.GetInputProcessedSize();
- _packSizeDefined = true;
- RINOK(lps->SetCur());
-
- CHeader st;
-
- const UInt32 kBufSize = 1 + 5 + 8;
- Byte buf[kBufSize];
- const UInt32 headerSize = GetHeaderSize();
- UInt32 processed;
- RINOK(decoder.ReadInput(buf, headerSize, &processed));
- if (processed != headerSize)
- break;
-
- if (!st.Parse(buf, _lzma86))
- break;
- firstItem = false;
-
- result = decoder.Code(st, outStream, progress);
- if (result == E_NOTIMPL)
- {
- opRes = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- break;
- }
- if (result == S_FALSE)
- {
- opRes = NArchive::NExtract::NOperationResult::kDataError;
- break;
- }
- RINOK(result);
- }
- if (firstItem)
- return E_FAIL;
- outStream.Release();
- return extractCallback->SetOperationResult(opRes);
- COM_TRY_END
-}
-
-IMPL_ISetCompressCodecsInfo
-
-static IInArchive *CreateArc() { return new CHandler(false); }
-static IInArchive *CreateArc86() { return new CHandler(true); }
-
-namespace NLzmaAr {
-
-static CArcInfo g_ArcInfo =
- { L"lzma", L"lzma", 0, 0xA, { 0 }, 0, true, CreateArc, NULL };
-REGISTER_ARC(Lzma)
-
-}
-
-namespace NLzma86Ar {
-
-static CArcInfo g_ArcInfo =
- { L"lzma86", L"lzma86", 0, 0xB, { 0 }, 0, true, CreateArc86, NULL };
-REGISTER_ARC(Lzma86)
-
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/MachoHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/MachoHandler.cpp
deleted file mode 100644
index 342a8e761..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/MachoHandler.cpp
+++ /dev/null
@@ -1,468 +0,0 @@
-// MachoHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/Buffer.h"
-#include "Common/ComTry.h"
-
-#include "Windows/PropVariantUtils.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-
-static UInt32 Get32(const Byte *p, int be) { if (be) return GetBe32(p); return GetUi32(p); }
-static UInt64 Get64(const Byte *p, int be) { if (be) return GetBe64(p); return GetUi64(p); }
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NMacho {
-
-#define MACH_ARCH_ABI64 (1 << 24)
-#define MACH_MACHINE_386 7
-#define MACH_MACHINE_ARM 12
-#define MACH_MACHINE_SPARC 14
-#define MACH_MACHINE_PPC 18
-
-#define MACH_MACHINE_PPC64 (MACH_ARCH_ABI64 | MACH_MACHINE_PPC)
-#define MACH_MACHINE_AMD64 (MACH_ARCH_ABI64 | MACH_MACHINE_386)
-
-#define MACH_CMD_SEGMENT_32 1
-#define MACH_CMD_SEGMENT_64 0x19
-
-#define MACH_SECT_TYPE_MASK 0x000000FF
-#define MACH_SECT_ATTR_MASK 0xFFFFFF00
-
-#define MACH_SECT_ATTR_ZEROFILL 1
-
-const char *g_SectTypes[] =
-{
- "REGULAR",
- "ZEROFILL",
- "CSTRINGS",
- "4BYTE_LITERALS",
- "8BYTE_LITERALS",
- "LITERAL_POINTERS",
- "NON_LAZY_SYMBOL_POINTERS",
- "LAZY_SYMBOL_POINTERS",
- "SYMBOL_STUBS",
- "MOD_INIT_FUNC_POINTERS",
- "MOD_TERM_FUNC_POINTERS",
- "COALESCED",
- "GB_ZEROFILL",
- "INTERPOSING",
- "16BYTE_LITERALS"
-};
-
-const char *g_FileTypes[] =
-{
- "0",
- "OBJECT",
- "EXECUTE",
- "FVMLIB",
- "CORE",
- "PRELOAD",
- "DYLIB",
- "DYLINKER",
- "BUNDLE",
- "DYLIB_STUB",
- "DSYM"
-};
-
-static const CUInt32PCharPair g_Flags[] =
-{
- { (UInt32)1 << 31, "PURE_INSTRUCTIONS" },
- { 1 << 30, "NO_TOC" },
- { 1 << 29, "STRIP_STATIC_SYMS" },
- { 1 << 28, "NO_DEAD_STRIP" },
- { 1 << 27, "LIVE_SUPPORT" },
- { 1 << 26, "SELF_MODIFYING_CODE" },
- { 1 << 25, "DEBUG" },
- { 1 << 10, "SOME_INSTRUCTIONS" },
- { 1 << 9, "EXT_RELOC" },
- { 1 << 8, "LOC_RELOC" }
-};
-
-static const CUInt32PCharPair g_MachinePairs[] =
-{
- { MACH_MACHINE_386, "x86" },
- { MACH_MACHINE_ARM, "ARM" },
- { MACH_MACHINE_SPARC, "SPARC" },
- { MACH_MACHINE_PPC, "PowerPC" },
- { MACH_MACHINE_PPC64, "PowerPC 64-bit" },
- { MACH_MACHINE_AMD64, "x64" }
-};
-
-static const int kNameSize = 16;
-
-struct CSegment
-{
- char Name[kNameSize];
-};
-
-struct CSection
-{
- char Name[kNameSize];
- char SegName[kNameSize];
- UInt64 Va;
- UInt64 Size;
- UInt32 Pa;
- UInt32 Flags;
- int SegmentIndex;
- UInt64 GetPackSize() const { return Flags == MACH_SECT_ATTR_ZEROFILL ? 0 : Size; }
-};
-
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _inStream;
- CObjectVector<CSegment> _segments;
- CObjectVector<CSection> _sections;
- bool _mode64;
- bool _be;
- UInt32 _machine;
- UInt32 _type;
- UInt32 _headersSize;
- UInt64 _totalSize;
- HRESULT Open2(ISequentialInStream *stream);
- bool Parse(const Byte *buf, UInt32 size);
-public:
- MY_UNKNOWN_IMP1(IInArchive)
- INTERFACE_IInArchive(;)
-};
-
-bool CHandler::Parse(const Byte *buf, UInt32 size)
-{
- bool mode64 = _mode64;
- bool be = _be;
-
- const Byte *bufStart = buf;
- bool reduceCommands = false;
- if (size < 512)
- return false;
-
- _machine = Get32(buf + 4, be);
- _type = Get32(buf + 0xC, be);
-
- UInt32 numCommands = Get32(buf + 0x10, be);
- UInt32 commandsSize = Get32(buf + 0x14, be);
- if (commandsSize > size)
- return false;
-
- if (commandsSize > (1 << 24) || numCommands > (1 << 18))
- return false;
-
- if (numCommands > 16)
- {
- reduceCommands = true;
- numCommands = 16;
- }
-
- _headersSize = 0;
-
- buf += 0x1C;
- size -= 0x1C;
-
- if (mode64)
- {
- buf += 4;
- size -= 4;
- }
-
- _totalSize = (UInt32)(buf - bufStart);
- if (commandsSize < size)
- size = commandsSize;
-
- for (UInt32 cmdIndex = 0; cmdIndex < numCommands; cmdIndex++)
- {
- if (size < 8)
- return false;
- UInt32 cmd = Get32(buf, be);
- UInt32 cmdSize = Get32(buf + 4, be);
- if (size < cmdSize)
- return false;
- if (cmd == MACH_CMD_SEGMENT_32 || cmd == MACH_CMD_SEGMENT_64)
- {
- UInt32 offs = (cmd == MACH_CMD_SEGMENT_64) ? 0x48 : 0x38;
- if (cmdSize < offs)
- break;
-
- {
- UInt64 vmAddr, vmSize, phAddr, phSize;
- if (cmd == MACH_CMD_SEGMENT_64)
- {
- vmAddr = Get64(buf + 0x18, be);
- vmSize = Get64(buf + 0x20, be);
- phAddr = Get64(buf + 0x28, be);
- phSize = Get64(buf + 0x30, be);
- }
- else
- {
- vmAddr = Get32(buf + 0x18, be);
- vmSize = Get32(buf + 0x1C, be);
- phAddr = Get32(buf + 0x20, be);
- phSize = Get32(buf + 0x24, be);
- }
- {
- UInt64 totalSize = phAddr + phSize;
- if (totalSize > _totalSize)
- _totalSize = totalSize;
- }
- }
-
- CSegment seg;
- memcpy(seg.Name, buf + 8, kNameSize);
- _segments.Add(seg);
-
- UInt32 numSections = Get32(buf + offs - 8, be);
- if (numSections > (1 << 8))
- return false;
-
- while (numSections-- != 0)
- {
- CSection section;
- UInt32 headerSize = (cmd == MACH_CMD_SEGMENT_64) ? 0x50 : 0x44;
- const Byte *p = buf + offs;
- if (cmdSize - offs < headerSize)
- break;
- if (cmd == MACH_CMD_SEGMENT_64)
- {
- section.Va = Get64(p + 0x20, be);
- section.Size = Get64(p + 0x28, be);
- section.Pa = Get32(p + 0x30, be);
- section.Flags = Get32(p + 0x40, be);
- }
- else
- {
- section.Va = Get32(p + 0x20, be);
- section.Size = Get32(p + 0x24, be);
- section.Pa = Get32(p + 0x28, be);
- section.Flags = Get32(p + 0x38, be);
- }
- memcpy(section.Name, p, kNameSize);
- memcpy(section.SegName, p + kNameSize, kNameSize);
- section.SegmentIndex = _segments.Size() - 1;
- _sections.Add(section);
- offs += headerSize;
- }
- if (offs != cmdSize)
- return false;
- }
- buf += cmdSize;
- size -= cmdSize;
- }
- _headersSize = (UInt32)(buf - bufStart);
- return reduceCommands || (size == 0);
-}
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidCpu, VT_BSTR},
- { NULL, kpidBit64, VT_BOOL},
- { NULL, kpidBigEndian, VT_BOOL},
- { NULL, kpidCharacts, VT_BSTR},
- { NULL, kpidPhySize, VT_UI8},
- { NULL, kpidHeadersSize, VT_UI4}
-};
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidCharacts, VT_BSTR},
- { NULL, kpidOffset, VT_UI8},
- { NULL, kpidVa, VT_UI8}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidCpu: PAIR_TO_PROP(g_MachinePairs, _machine, prop); break;
- case kpidCharacts: TYPE_TO_PROP(g_FileTypes, _type, prop); break;
- case kpidPhySize: prop = _totalSize; break;
- case kpidHeadersSize: prop = _headersSize; break;
- case kpidBit64: if (_mode64) prop = _mode64; break;
- case kpidBigEndian: if (_be) prop = _be; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-static AString GetName(const char *name)
-{
- char res[kNameSize + 1];
- memcpy(res, name, kNameSize);
- res[kNameSize] = 0;
- return res;
-}
-
-static AString SectFlagsToString(UInt32 flags)
-{
- AString res = TypeToString(g_SectTypes, sizeof(g_SectTypes) / sizeof(g_SectTypes[0]),
- flags & MACH_SECT_TYPE_MASK);
- AString s = FlagsToString(g_Flags, sizeof(g_Flags) / sizeof(g_Flags[0]),
- flags & MACH_SECT_ATTR_MASK);
- if (!s.IsEmpty())
- {
- res += ' ';
- res += s;
- }
- return res;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NCOM::CPropVariant prop;
- const CSection &item = _sections[index];
- switch(propID)
- {
- case kpidPath: StringToProp(GetName(_segments[item.SegmentIndex].Name) + GetName(item.Name), prop); break;
- case kpidSize: prop = (UInt64)item.Size; break;
- case kpidPackSize: prop = (UInt64)item.GetPackSize(); break;
- case kpidCharacts: StringToProp(SectFlagsToString(item.Flags), prop); break;
- case kpidOffset: prop = item.Pa; break;
- case kpidVa: prop = item.Va; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-HRESULT CHandler::Open2(ISequentialInStream *stream)
-{
- const UInt32 kBufSize = 1 << 18;
- const UInt32 kSigSize = 4;
-
- CByteBuffer buffer;
- buffer.SetCapacity(kBufSize);
- Byte *buf = buffer;
-
- size_t processed = kSigSize;
- RINOK(ReadStream_FALSE(stream, buf, processed));
- UInt32 sig = GetUi32(buf);
- bool be, mode64;
- switch(sig)
- {
- case 0xCEFAEDFE: be = true; mode64 = false; break;
- case 0xCFFAEDFE: be = true; mode64 = true; break;
- case 0xFEEDFACE: be = false; mode64 = false; break;
- case 0xFEEDFACF: be = false; mode64 = true; break;
- default: return S_FALSE;
- }
- processed = kBufSize - kSigSize;
- RINOK(ReadStream(stream, buf + kSigSize, &processed));
- _mode64 = mode64;
- _be = be;
- return Parse(buf, (UInt32)processed + kSigSize) ? S_OK : S_FALSE;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- Close();
- RINOK(Open2(inStream));
- _inStream = inStream;
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _inStream.Release();
- _sections.Clear();
- _segments.Clear();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _sections.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _sections.Size();
- if (numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- totalSize += _sections[allFilesMode ? i : indices[i]].GetPackSize();
- extractCallback->SetTotal(totalSize);
-
- UInt64 currentTotalSize = 0;
- UInt64 currentItemSize;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- streamSpec->SetStream(_inStream);
-
- for (i = 0; i < numItems; i++, currentTotalSize += currentItemSize)
- {
- lps->InSize = lps->OutSize = currentTotalSize;
- RINOK(lps->SetCur());
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- UInt32 index = allFilesMode ? i : indices[i];
- const CSection &item = _sections[index];
- currentItemSize = item.GetPackSize();
-
- CMyComPtr<ISequentialOutStream> outStream;
- RINOK(extractCallback->GetStream(index, &outStream, askMode));
- if (!testMode && !outStream)
- continue;
-
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(_inStream->Seek(item.Pa, STREAM_SEEK_SET, NULL));
- streamSpec->Init(currentItemSize);
- RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(copyCoderSpec->TotalSize == currentItemSize ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kDataError));
- }
- return S_OK;
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"MachO", L"", 0, 0xDF, { 0 }, 0, false, CreateArc, 0 };
-
-REGISTER_ARC(Macho)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/MbrHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/MbrHandler.cpp
deleted file mode 100644
index 47b18f15e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/MbrHandler.cpp
+++ /dev/null
@@ -1,508 +0,0 @@
-// MbrHandler.cpp
-
-#include "StdAfx.h"
-
-// #define SHOW_DEBUG_INFO
-
-#ifdef SHOW_DEBUG_INFO
-#include <stdio.h>
-#endif
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/Buffer.h"
-#include "Common/ComTry.h"
-#include "Common/IntToString.h"
-#include "Common/MyString.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-
-#ifdef SHOW_DEBUG_INFO
-#define PRF(x) x
-#else
-#define PRF(x)
-#endif
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NMbr {
-
-struct CChs
-{
- Byte Head;
- Byte SectCyl;
- Byte Cyl8;
-
- UInt32 GetSector() const { return SectCyl & 0x3F; }
- UInt32 GetCyl() const { return ((UInt32)SectCyl >> 6 << 8) | Cyl8; }
- void ToString(NCOM::CPropVariant &prop) const;
-
- void Parse(const Byte *p)
- {
- Head = p[0];
- SectCyl = p[1];
- Cyl8 = p[2];
- }
- bool Check() const { return GetSector() > 0; }
-};
-
-#define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; }
-
-static int CompareChs(const CChs &c1, const CChs &c2)
-{
- RINOZ(MyCompare(c1.GetCyl(), c2.GetCyl()));
- RINOZ(MyCompare(c1.Head, c2.Head));
- return MyCompare(c1.GetSector(), c2.GetSector());
-}
-
-static void AddUIntToString(UInt32 val, AString &res)
-{
- char s[16];
- ConvertUInt32ToString(val, s);
- res += s;
-}
-
-void CChs::ToString(NCOM::CPropVariant &prop) const
-{
- AString s;
- AddUIntToString(GetCyl(), s);
- s += '-';
- AddUIntToString(Head, s);
- s += '-';
- AddUIntToString(GetSector(), s);
- prop = s;
-}
-
-struct CPartition
-{
- Byte Status;
- CChs BeginChs;
- Byte Type;
- CChs EndChs;
- UInt32 Lba;
- UInt32 NumBlocks;
-
- CPartition() { memset (this, 0, sizeof(*this)); }
-
- bool IsEmpty() const { return Type == 0; }
- bool IsExtended() const { return Type == 5 || Type == 0xF; }
- UInt32 GetLimit() const { return Lba + NumBlocks; }
- // bool IsActive() const { return Status == 0x80; }
- UInt64 GetPos() const { return (UInt64)Lba * 512; }
- UInt64 GetSize() const { return (UInt64)NumBlocks * 512; }
-
- bool CheckLbaLimits() const { return (UInt32)0xFFFFFFFF - Lba >= NumBlocks; }
- bool Parse(const Byte *p)
- {
- Status = p[0];
- BeginChs.Parse(p + 1);
- Type = p[4];
- EndChs.Parse(p + 5);
- Lba = GetUi32(p + 8);
- NumBlocks = GetUi32(p + 12);
- if (Type == 0)
- return true;
- if (Status != 0 && Status != 0x80)
- return false;
- return
- BeginChs.Check() &&
- EndChs.Check() &&
- CompareChs(BeginChs, EndChs) <= 0 &&
- NumBlocks > 0 &&
- CheckLbaLimits();
- }
-
- #ifdef SHOW_DEBUG_INFO
- void Print() const
- {
- NCOM::CPropVariant prop, prop2;
- BeginChs.ToString(prop);
- EndChs.ToString(prop2);
- printf(" %2x %2x %8X %8X %12S %12S", (int)Status, (int)Type, Lba, NumBlocks, prop.bstrVal, prop2.bstrVal);
- }
- #endif
-};
-
-struct CPartType
-{
- UInt32 Id;
- const char *Ext;
- const char *Name;
-};
-
-static const char *kFat = "fat";
-
-static const CPartType kPartTypes[] =
-{
- { 0x01, kFat, "FAT12" },
- { 0x04, kFat, "FAT16 DOS 3.0+" },
- { 0x05, 0, "Extended" },
- { 0x06, kFat, "FAT16 DOS 3.31+" },
- { 0x07, "ntfs", "NTFS" },
- { 0x0B, kFat, "FAT32" },
- { 0x0C, kFat, "FAT32-LBA" },
- { 0x0E, kFat, "FAT16-LBA" },
- { 0x0F, 0, "Extended-LBA" },
- { 0x11, kFat, "FAT12-Hidden" },
- { 0x14, kFat, "FAT16-Hidden < 32 MB" },
- { 0x16, kFat, "FAT16-Hidden >= 32 MB" },
- { 0x1B, kFat, "FAT32-Hidden" },
- { 0x1C, kFat, "FAT32-LBA-Hidden" },
- { 0x1E, kFat, "FAT16-LBA-WIN95-Hidden" },
- { 0x82, 0, "Solaris x86 / Linux swap" },
- { 0x83, 0, "Linux" },
- { 0xBE, 0, "Solaris 8 boot" },
- { 0xBF, 0, "New Solaris x86" },
- { 0xC2, 0, "Linux-Hidden" },
- { 0xC3, 0, "Linux swap-Hidden" },
- { 0xEE, 0, "EFI-MBR" },
- { 0xEE, 0, "EFI" }
-};
-
-static int FindPartType(UInt32 type)
-{
- for (int i = 0; i < sizeof(kPartTypes) / sizeof(kPartTypes[0]); i++)
- if (kPartTypes[i].Id == type)
- return i;
- return -1;
-}
-
-struct CItem
-{
- bool IsReal;
- bool IsPrim;
- UInt64 Size;
- CPartition Part;
-};
-
-class CHandler:
- public IInArchive,
- public IInArchiveGetStream,
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _stream;
- CObjectVector<CItem> _items;
- UInt64 _totalSize;
- CByteBuffer _buffer;
-
- HRESULT ReadTables(IInStream *stream, UInt32 baseLba, UInt32 lba, int level);
-public:
- MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
- INTERFACE_IInArchive(;)
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-};
-
-HRESULT CHandler::ReadTables(IInStream *stream, UInt32 baseLba, UInt32 lba, int level)
-{
- if (level >= 128 || _items.Size() >= 128)
- return S_FALSE;
-
- const int kNumHeaderParts = 4;
- CPartition parts[kNumHeaderParts];
-
- {
- const UInt32 kSectorSize = 512;
- _buffer.SetCapacity(kSectorSize);
- Byte *buf = _buffer;
- UInt64 newPos = (UInt64)lba << 9;
- if (newPos + 512 > _totalSize)
- return S_FALSE;
- RINOK(stream->Seek(newPos, STREAM_SEEK_SET, NULL));
- RINOK(ReadStream_FALSE(stream, buf, kSectorSize));
-
- if (buf[0x1FE] != 0x55 || buf[0x1FF] != 0xAA)
- return S_FALSE;
-
- for (int i = 0; i < kNumHeaderParts; i++)
- if (!parts[i].Parse(buf + 0x1BE + 16 * i))
- return S_FALSE;
- }
-
- PRF(printf("\n# %8X", lba));
-
- UInt32 limLba = lba + 1;
- if (limLba == 0)
- return S_FALSE;
-
- for (int i = 0; i < kNumHeaderParts; i++)
- {
- CPartition &part = parts[i];
-
- if (part.IsEmpty())
- continue;
- PRF(printf("\n %2d ", (int)level));
- #ifdef SHOW_DEBUG_INFO
- part.Print();
- #endif
-
- int numItems = _items.Size();
- UInt32 newLba = lba + part.Lba;
-
- if (part.IsExtended())
- {
- // if (part.Type == 5) // Check it!
- newLba = baseLba + part.Lba;
- if (newLba < limLba)
- return S_FALSE;
- HRESULT res = ReadTables(stream, level < 1 ? newLba : baseLba, newLba, level + 1);
- if (res != S_FALSE && res != S_OK)
- return res;
- }
- if (newLba < limLba)
- return S_FALSE;
- part.Lba = newLba;
- if (!part.CheckLbaLimits())
- return S_FALSE;
-
- CItem n;
- n.Part = part;
- bool addItem = false;
- if (numItems == _items.Size())
- {
- n.IsPrim = (level == 0);
- n.IsReal = true;
- addItem = true;
- }
- else
- {
- const CItem &back = _items.Back();
- UInt32 backLimit = back.Part.GetLimit();
- UInt32 partLimit = part.GetLimit();
- if (backLimit < partLimit)
- {
- n.IsReal = false;
- n.Part.Lba = backLimit;
- n.Part.NumBlocks = partLimit - backLimit;
- addItem = true;
- }
- }
- if (addItem)
- {
- if (n.Part.GetLimit() < limLba)
- return S_FALSE;
- limLba = n.Part.GetLimit();
- n.Size = n.Part.GetSize();
- _items.Add(n);
- }
- }
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- Close();
- RINOK(stream->Seek(0, STREAM_SEEK_END, &_totalSize));
- RINOK(ReadTables(stream, 0, 0, 0));
- if (_items.IsEmpty())
- return S_FALSE;
- UInt32 lbaLimit = _items.Back().Part.GetLimit();
- UInt64 lim = (UInt64)lbaLimit << 9;
- if (lim < _totalSize)
- {
- CItem n;
- n.Part.Lba = lbaLimit;
- n.Size = _totalSize - lim;
- n.IsReal = false;
- _items.Add(n);
- }
- _stream = stream;
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _items.Clear();
- _stream.Release();
- return S_OK;
-}
-
-enum
-{
- kpidPrimary = kpidUserDefined,
- kpidBegChs,
- kpidEndChs,
-};
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidFileSystem, VT_BSTR},
- { NULL, kpidOffset, VT_UI8},
- { L"Primary", kpidPrimary, VT_BOOL},
- { L"Begin CHS", kpidBegChs, VT_BSTR},
- { L"End CHS", kpidEndChs, VT_BSTR}
-};
-
-IMP_IInArchive_Props_WITH_NAME
-IMP_IInArchive_ArcProps_NO_Table
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidMainSubfile:
- {
- int mainIndex = -1;
- for (int i = 0; i < _items.Size(); i++)
- if (_items[i].IsReal)
- {
- if (mainIndex >= 0)
- {
- mainIndex = -1;
- break;
- }
- mainIndex = i;
- }
- if (mainIndex >= 0)
- prop = (UInt32)mainIndex;
- break;
- }
- }
- prop.Detach(value);
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _items.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NCOM::CPropVariant prop;
-
- const CItem &item = _items[index];
- const CPartition &part = item.Part;
- switch(propID)
- {
- case kpidPath:
- {
- AString s;
- AddUIntToString(index, s);
- if (item.IsReal)
- {
- int typeIndex = FindPartType(part.Type);
- s += '.';
- const char *ext = "img";
- if (typeIndex >= 0 && kPartTypes[typeIndex].Ext != 0)
- ext = kPartTypes[typeIndex].Ext;
- s += ext;
- }
- prop = s;
- break;
- }
- case kpidFileSystem:
- if (item.IsReal)
- {
- char s[32];
- ConvertUInt32ToString(part.Type, s);
- const char *res = s;
- int typeIndex = FindPartType(part.Type);
- if (typeIndex >= 0 && kPartTypes[typeIndex].Name)
- res = kPartTypes[typeIndex].Name;
- prop = res;
- }
- break;
- case kpidSize: prop = item.Size; break;;
- case kpidPackSize: prop = item.Size; break;
- case kpidOffset: prop = part.GetPos(); break;
- case kpidPrimary: if (item.IsReal) prop = item.IsPrim; break;
- case kpidBegChs: if (item.IsReal) part.BeginChs.ToString(prop); break;
- case kpidEndChs: if (item.IsReal) part.EndChs.ToString(prop); break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _items.Size();
- if (numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- totalSize += _items[allFilesMode ? i : indices[i]].Size;
- extractCallback->SetTotal(totalSize);
-
- totalSize = 0;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- streamSpec->SetStream(_stream);
-
- for (i = 0; i < numItems; i++)
- {
- lps->InSize = totalSize;
- lps->OutSize = totalSize;
- RINOK(lps->SetCur());
- CMyComPtr<ISequentialOutStream> outStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- Int32 index = allFilesMode ? i : indices[i];
- const CItem &item = _items[index];
- const CPartition &part = item.Part;
- RINOK(extractCallback->GetStream(index, &outStream, askMode));
- totalSize += item.Size;
- if (!testMode && (!outStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
-
- RINOK(_stream->Seek(part.GetPos(), STREAM_SEEK_SET, NULL));
- streamSpec->Init(item.Size);
- RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(copyCoderSpec->TotalSize == item.Size ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kDataError));
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
-{
- COM_TRY_BEGIN
- const CItem &item = _items[index];
- return CreateLimitedInStream(_stream, item.Part.GetPos(), item.Size, stream);
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"MBR", L"mbr", 0, 0xDB, { 1, 1, 0 }, 3, false, CreateArc, 0 };
-
-REGISTER_ARC(Mbr)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/MubHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/MubHandler.cpp
deleted file mode 100644
index f099aad26..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/MubHandler.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-// MubHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/ComTry.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-
-#define Get32(p) GetBe32(p)
-
-namespace NArchive {
-namespace NMub {
-
-struct CItem
-{
- UInt32 Type;
- UInt32 SubType;
- UInt64 Offset;
- UInt64 Size;
- UInt32 Align;
- bool IsTail;
-};
-
-const UInt32 kNumFilesMax = 10;
-
-class CHandler:
- public IInArchive,
- public IInArchiveGetStream,
- public CMyUnknownImp
-{
- UInt64 _startPos;
- CMyComPtr<IInStream> _stream;
- UInt32 _numItems;
- CItem _items[kNumFilesMax + 1];
- HRESULT Open2(IInStream *stream);
-public:
- MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
- INTERFACE_IInArchive(;)
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-};
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidSize, VT_UI8}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO
-
-#define MACH_ARCH_ABI64 0x1000000
-#define MACH_MACHINE_386 7
-#define MACH_MACHINE_ARM 12
-#define MACH_MACHINE_SPARC 14
-#define MACH_MACHINE_PPC 18
-
-#define MACH_MACHINE_PPC64 (MACH_MACHINE_PPC | MACH_ARCH_ABI64)
-#define MACH_MACHINE_AMD64 (MACH_MACHINE_386 | MACH_ARCH_ABI64)
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- NWindows::NCOM::CPropVariant prop;
- const CItem &item = _items[index];
- switch(propID)
- {
- case kpidExtension:
- {
- const wchar_t *ext;
- if (item.IsTail)
- ext = L"tail";
- else
- {
- switch(item.Type)
- {
- case MACH_MACHINE_386: ext = L"86"; break;
- case MACH_MACHINE_ARM: ext = L"arm"; break;
- case MACH_MACHINE_SPARC: ext = L"sparc"; break;
- case MACH_MACHINE_PPC: ext = L"ppc"; break;
- case MACH_MACHINE_PPC64: ext = L"ppc64"; break;
- case MACH_MACHINE_AMD64: ext = L"x64"; break;
- default: ext = L"unknown"; break;
- }
- }
- prop = ext;
- break;
- }
- case kpidSize:
- case kpidPackSize:
- prop = (UInt64)item.Size;
- break;
- }
- prop.Detach(value);
- return S_OK;
-}
-
-#define MACH_TYPE_ABI64 (1 << 24)
-#define MACH_SUBTYPE_ABI64 (1 << 31)
-
-HRESULT CHandler::Open2(IInStream *stream)
-{
- RINOK(stream->Seek(0, STREAM_SEEK_SET, &_startPos));
-
- const UInt32 kHeaderSize = 8;
- const UInt32 kRecordSize = 5 * 4;
- const UInt32 kBufSize = kHeaderSize + kNumFilesMax * kRecordSize;
- Byte buf[kBufSize];
- size_t processed = kBufSize;
- RINOK(ReadStream(stream, buf, &processed));
- if (processed < kHeaderSize)
- return S_FALSE;
- UInt32 num = Get32(buf + 4);
- if (Get32(buf) != 0xCAFEBABE || num > kNumFilesMax || processed < kHeaderSize + num * kRecordSize)
- return S_FALSE;
- UInt64 endPosMax = kHeaderSize;
- for (UInt32 i = 0; i < num; i++)
- {
- const Byte *p = buf + kHeaderSize + i * kRecordSize;
- CItem &sb = _items[i];
- sb.IsTail = false;
- sb.Type = Get32(p);
- sb.SubType = Get32(p + 4);
- sb.Offset = Get32(p + 8);
- sb.Size = Get32(p + 12);
- sb.Align = Get32(p + 16);
-
- if ((sb.Type & ~MACH_TYPE_ABI64) >= 0x100 ||
- (sb.SubType & ~MACH_SUBTYPE_ABI64) >= 0x100 ||
- sb.Align > 31)
- return S_FALSE;
-
- UInt64 endPos = (UInt64)sb.Offset + sb.Size;
- if (endPos > endPosMax)
- endPosMax = endPos;
- }
- UInt64 fileSize;
- RINOK(stream->Seek(0, STREAM_SEEK_END, &fileSize));
- fileSize -= _startPos;
- _numItems = num;
- if (fileSize > endPosMax)
- {
- CItem &sb = _items[_numItems++];
- sb.IsTail = true;
- sb.Type = 0;
- sb.SubType = 0;
- sb.Offset = endPosMax;
- sb.Size = fileSize - endPosMax;
- sb.Align = 0;
- }
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- Close();
- try
- {
- if (Open2(inStream) != S_OK)
- return S_FALSE;
- _stream = inStream;
- }
- catch(...) { return S_FALSE; }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _stream.Release();
- _numItems = 0;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _numItems;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _numItems;
- if (numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- totalSize += _items[allFilesMode ? i : indices[i]].Size;
- extractCallback->SetTotal(totalSize);
-
- UInt64 currentTotalSize = 0;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- streamSpec->SetStream(_stream);
-
- for (i = 0; i < numItems; i++)
- {
- lps->InSize = lps->OutSize = currentTotalSize;
- RINOK(lps->SetCur());
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- UInt32 index = allFilesMode ? i : indices[i];
- const CItem &item = _items[index];
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
- currentTotalSize += item.Size;
-
- if (!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- if (testMode)
- {
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
- RINOK(_stream->Seek(_startPos + item.Offset, STREAM_SEEK_SET, NULL));
- streamSpec->Init(item.Size);
- RINOK(copyCoder->Code(inStream, realOutStream, NULL, NULL, progress));
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult((copyCoderSpec->TotalSize == item.Size) ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kDataError));
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
-{
- COM_TRY_BEGIN
- const CItem &item = _items[index];
- return CreateLimitedInStream(_stream, _startPos + item.Offset, item.Size, stream);
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Mub", L"", 0, 0xE2, { 0xCA, 0xFE, 0xBA, 0xBE, 0, 0, 0 }, 7, false, CreateArc, 0 };
-
-REGISTER_ARC(Mub)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisDecode.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisDecode.cpp
deleted file mode 100644
index 7e126bd44..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisDecode.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-// NsisDecode.cpp
-
-#include "StdAfx.h"
-
-#include "NsisDecode.h"
-
-#include "../../Common/StreamUtils.h"
-
-#include "../../Common/MethodId.h"
-#include "../../Common/CreateCoder.h"
-
-namespace NArchive {
-namespace NNsis {
-
-static const CMethodId k_Copy = 0x0;
-static const CMethodId k_Deflate = 0x040901;
-static const CMethodId k_BZip2 = 0x040902;
-static const CMethodId k_LZMA = 0x030101;
-static const CMethodId k_BCJ_X86 = 0x03030103;
-
-HRESULT CDecoder::Init(
- DECL_EXTERNAL_CODECS_LOC_VARS
- IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter)
-{
- useFilter = false;
- CObjectVector< CMyComPtr<ISequentialInStream> > inStreams;
-
- if (_decoderInStream)
- if (method != _method)
- Release();
- _method = method;
- if (!_codecInStream)
- {
- CMethodId methodID;
- switch (method)
- {
- case NMethodType::kCopy: methodID = k_Copy; break;
- case NMethodType::kDeflate: methodID = k_Deflate; break;
- case NMethodType::kBZip2: methodID = k_BZip2; break;
- case NMethodType::kLZMA: methodID = k_LZMA; break;
- default: return E_NOTIMPL;
- }
- CMyComPtr<ICompressCoder> coder;
- RINOK(CreateCoder(
- EXTERNAL_CODECS_LOC_VARS
- methodID, coder, false));
- if (!coder)
- return E_NOTIMPL;
- coder.QueryInterface(IID_ISequentialInStream, &_codecInStream);
- if (!_codecInStream)
- return E_NOTIMPL;
- }
-
- if (thereIsFilterFlag)
- {
- UInt32 processedSize;
- BYTE flag;
- RINOK(inStream->Read(&flag, 1, &processedSize));
- if (processedSize != 1)
- return E_FAIL;
- if (flag > 1)
- return E_NOTIMPL;
- useFilter = (flag != 0);
- }
-
- if (useFilter)
- {
- if (!_filterInStream)
- {
- CMyComPtr<ICompressCoder> coder;
- RINOK(CreateCoder(
- EXTERNAL_CODECS_LOC_VARS
- k_BCJ_X86, coder, false));
- if (!coder)
- return E_NOTIMPL;
- coder.QueryInterface(IID_ISequentialInStream, &_filterInStream);
- if (!_filterInStream)
- return E_NOTIMPL;
- }
- CMyComPtr<ICompressSetInStream> setInStream;
- _filterInStream.QueryInterface(IID_ICompressSetInStream, &setInStream);
- if (!setInStream)
- return E_NOTIMPL;
- RINOK(setInStream->SetInStream(_codecInStream));
- _decoderInStream = _filterInStream;
- }
- else
- _decoderInStream = _codecInStream;
-
- if (method == NMethodType::kLZMA)
- {
- CMyComPtr<ICompressSetDecoderProperties2> setDecoderProperties;
- _codecInStream.QueryInterface(IID_ICompressSetDecoderProperties2, &setDecoderProperties);
- if (setDecoderProperties)
- {
- static const UInt32 kPropertiesSize = 5;
- BYTE properties[kPropertiesSize];
- UInt32 processedSize;
- RINOK(inStream->Read(properties, kPropertiesSize, &processedSize));
- if (processedSize != kPropertiesSize)
- return E_FAIL;
- RINOK(setDecoderProperties->SetDecoderProperties2((const Byte *)properties, kPropertiesSize));
- }
- }
-
- {
- CMyComPtr<ICompressSetInStream> setInStream;
- _codecInStream.QueryInterface(IID_ICompressSetInStream, &setInStream);
- if (!setInStream)
- return E_NOTIMPL;
- RINOK(setInStream->SetInStream(inStream));
- }
-
- {
- CMyComPtr<ICompressSetOutStreamSize> setOutStreamSize;
- _codecInStream.QueryInterface(IID_ICompressSetOutStreamSize, &setOutStreamSize);
- if (!setOutStreamSize)
- return E_NOTIMPL;
- RINOK(setOutStreamSize->SetOutStreamSize(NULL));
- }
-
- if (useFilter)
- {
- /*
- CMyComPtr<ICompressSetOutStreamSize> setOutStreamSize;
- _filterInStream.QueryInterface(IID_ICompressSetOutStreamSize, &setOutStreamSize);
- if (!setOutStreamSize)
- return E_NOTIMPL;
- RINOK(setOutStreamSize->SetOutStreamSize(NULL));
- */
- }
-
- return S_OK;
-}
-
-HRESULT CDecoder::Read(void *data, size_t *processedSize)
-{
- return ReadStream(_decoderInStream, data, processedSize);;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisDecode.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisDecode.h
deleted file mode 100644
index 36aeb2b14..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisDecode.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// NsisDecode.h
-
-#ifndef __NSIS_DECODE_H
-#define __NSIS_DECODE_H
-
-#include "../../IStream.h"
-
-#include "../../Common/CreateCoder.h"
-
-namespace NArchive {
-namespace NNsis {
-
-namespace NMethodType
-{
- enum EEnum
- {
- kCopy,
- kDeflate,
- kBZip2,
- kLZMA
- };
-}
-
-class CDecoder
-{
- NMethodType::EEnum _method;
-
- CMyComPtr<ISequentialInStream> _filterInStream;
- CMyComPtr<ISequentialInStream> _codecInStream;
- CMyComPtr<ISequentialInStream> _decoderInStream;
-
-public:
- void Release()
- {
- _filterInStream.Release();
- _codecInStream.Release();
- _decoderInStream.Release();
- }
- HRESULT Init(
- DECL_EXTERNAL_CODECS_LOC_VARS
- IInStream *inStream, NMethodType::EEnum method, bool thereIsFilterFlag, bool &useFilter);
- HRESULT Read(void *data, size_t *processedSize);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisHandler.cpp
deleted file mode 100644
index f2e3aab62..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisHandler.cpp
+++ /dev/null
@@ -1,489 +0,0 @@
-// NSisHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/CpuArch.h"
-
-#include "Common/ComTry.h"
-#include "Common/IntToString.h"
-#include "Common/NewHandler.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../../Common/StreamUtils.h"
-
-#include "../Common/ItemNameUtils.h"
-
-#include "NsisHandler.h"
-
-#define Get32(p) GetUi32(p)
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NNsis {
-
-static const wchar_t *kBcjMethod = L"BCJ";
-static const wchar_t *kUnknownMethod = L"Unknown";
-
-static const wchar_t *kMethods[] =
-{
- L"Copy",
- L"Deflate",
- L"BZip2",
- L"LZMA"
-};
-
-static const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]);
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidSolid, VT_BOOL}
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidSolid, VT_BOOL}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidMethod:
- {
- UInt32 dict = 1;
- bool filter = false;
- for (int i = 0; i < _archive.Items.Size(); i++)
- {
- const CItem &item = _archive.Items[i];
- filter |= item.UseFilter;
- if (item.DictionarySize > dict)
- dict = item.DictionarySize;
- }
- prop = GetMethod(filter, dict);
- break;
- }
- case kpidSolid: prop = _archive.IsSolid; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-
-STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 * maxCheckStartPosition, IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- Close();
- {
- if(_archive.Open(
- EXTERNAL_CODECS_VARS
- stream, maxCheckStartPosition) != S_OK)
- return S_FALSE;
- _inStream = stream;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _archive.Clear();
- _archive.Release();
- _inStream.Release();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _archive.Items.Size()
- #ifdef NSIS_SCRIPT
- + 1
- #endif
- ;
- return S_OK;
-}
-
-static UString ConvertUInt32ToString(UInt32 value)
-{
- wchar_t buffer[32];
- ConvertUInt64ToString(value, buffer);
- return buffer;
-}
-
-static UString GetStringForSizeValue(UInt32 value)
-{
- for (int i = 31; i >= 0; i--)
- if ((UInt32(1) << i) == value)
- return ConvertUInt32ToString(i);
- UString result;
- if (value % (1 << 20) == 0)
- {
- result += ConvertUInt32ToString(value >> 20);
- result += L"m";
- }
- else if (value % (1 << 10) == 0)
- {
- result += ConvertUInt32ToString(value >> 10);
- result += L"k";
- }
- else
- {
- result += ConvertUInt32ToString(value);
- result += L"b";
- }
- return result;
-}
-
-UString CHandler::GetMethod(bool useItemFilter, UInt32 dictionary) const
-{
- NMethodType::EEnum methodIndex = _archive.Method;
- UString method;
- if (_archive.IsSolid && _archive.UseFilter || !_archive.IsSolid && useItemFilter)
- {
- method += kBcjMethod;
- method += L" ";
- }
- method += (methodIndex < kNumMethods) ? kMethods[methodIndex] : kUnknownMethod;
- if (methodIndex == NMethodType::kLZMA)
- {
- method += L":";
- method += GetStringForSizeValue(_archive.IsSolid ? _archive.DictionarySize: dictionary);
- }
- return method;
-}
-
-bool CHandler::GetUncompressedSize(int index, UInt32 &size)
-{
- size = 0;
- const CItem &item = _archive.Items[index];
- if (item.SizeIsDefined)
- size = item.Size;
- else if (_archive.IsSolid && item.EstimatedSizeIsDefined)
- size = item.EstimatedSize;
- else
- return false;
- return true;
-}
-
-bool CHandler::GetCompressedSize(int index, UInt32 &size)
-{
- size = 0;
- const CItem &item = _archive.Items[index];
- if (item.CompressedSizeIsDefined)
- size = item.CompressedSize;
- else
- {
- if (_archive.IsSolid)
- {
- if (index == 0)
- size = _archive.FirstHeader.GetDataSize();
- else
- return false;
- }
- else
- {
- if (!item.IsCompressed)
- size = item.Size;
- else
- return false;
- }
- }
- return true;
-}
-
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- #ifdef NSIS_SCRIPT
- if (index >= (UInt32)_archive.Items.Size())
- {
- switch(propID)
- {
- case kpidPath: prop = L"[NSIS].nsi"; break;
- case kpidSize:
- case kpidPackSize: prop = (UInt64)_archive.Script.Length(); break;
- case kpidSolid: prop = false; break;
- }
- }
- else
- #endif
- {
- const CItem &item = _archive.Items[index];
- switch(propID)
- {
- case kpidPath:
- {
- UString s = NItemName::WinNameToOSName(item.GetReducedName(_archive.IsUnicode));
- if (!s.IsEmpty())
- prop = (const wchar_t *)s;
- break;
- }
- case kpidSize:
- {
- UInt32 size;
- if (GetUncompressedSize(index, size))
- prop = (UInt64)size;
- break;
- }
- case kpidPackSize:
- {
- UInt32 size;
- if (GetCompressedSize(index, size))
- prop = (UInt64)size;
- break;
- }
- case kpidMTime:
- {
- if (item.MTime.dwHighDateTime > 0x01000000 &&
- item.MTime.dwHighDateTime < 0xFF000000)
- prop = item.MTime;
- break;
- }
- case kpidMethod: prop = GetMethod(item.UseFilter, item.DictionarySize); break;
- case kpidSolid: prop = _archive.IsSolid; break;
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- GetNumberOfItems(&numItems);
- if(numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
-
- UInt32 i;
- for(i = 0; i < numItems; i++)
- {
- UInt32 index = (allFilesMode ? i : indices[i]);
- #ifdef NSIS_SCRIPT
- if (index >= (UInt32)_archive.Items.Size())
- totalSize += _archive.Script.Length();
- else
- #endif
- {
- UInt32 size;
- if (_archive.IsSolid)
- {
- GetUncompressedSize(index, size);
- UInt64 pos = _archive.GetPosOfSolidItem(index);
- if (pos > totalSize)
- totalSize = pos + size;
- }
- else
- {
- GetCompressedSize(index, size);
- totalSize += size;
- }
- }
- }
- extractCallback->SetTotal(totalSize);
-
- UInt64 currentTotalSize = 0;
- UInt32 currentItemSize = 0;
-
- UInt64 streamPos = 0;
- if (_archive.IsSolid)
- {
- RINOK(_inStream->Seek(_archive.StreamOffset, STREAM_SEEK_SET, NULL));
- bool useFilter;
- RINOK(_archive.Decoder.Init(
- EXTERNAL_CODECS_VARS
- _inStream, _archive.Method, _archive.FilterFlag, useFilter));
- }
-
- CByteBuffer byteBuf;
- const UInt32 kBufferLength = 1 << 16;
- byteBuf.SetCapacity(kBufferLength);
- Byte *buffer = byteBuf;
-
- bool dataError = false;
- for (i = 0; i < numItems; i++, currentTotalSize += currentItemSize)
- {
- currentItemSize = 0;
- RINOK(extractCallback->SetCompleted(&currentTotalSize));
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode;
- askMode = testMode ? NArchive::NExtract::NAskMode::kTest : NArchive::NExtract::NAskMode::kExtract;
- UInt32 index = allFilesMode ? i : indices[i];
-
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
- #ifdef NSIS_SCRIPT
- if (index >= (UInt32)_archive.Items.Size())
- {
- currentItemSize = _archive.Script.Length();
- if(!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- if (!testMode)
- RINOK(WriteStream(realOutStream, (const char *)_archive.Script, (UInt32)_archive.Script.Length()));
- }
- else
- #endif
- {
- const CItem &item = _archive.Items[index];
-
- if (_archive.IsSolid)
- GetUncompressedSize(index, currentItemSize);
- else
- GetCompressedSize(index, currentItemSize);
-
- if(!testMode && (!realOutStream))
- continue;
-
- RINOK(extractCallback->PrepareOperation(askMode));
-
- if (!dataError)
- {
- bool needDecompress = false;
- bool sizeIsKnown = false;
- UInt32 fullSize = 0;
-
- if (_archive.IsSolid)
- {
- UInt64 pos = _archive.GetPosOfSolidItem(index);
- while(streamPos < pos)
- {
- size_t processedSize = (UInt32)MyMin(pos - streamPos, (UInt64)kBufferLength);
- HRESULT res = _archive.Decoder.Read(buffer, &processedSize);
- if (res != S_OK)
- {
- if (res != S_FALSE)
- return res;
- dataError = true;
- break;
- }
- if (processedSize == 0)
- {
- dataError = true;
- break;
- }
- streamPos += processedSize;
- }
- if (streamPos == pos)
- {
- Byte buffer2[4];
- size_t processedSize = 4;
- RINOK(_archive.Decoder.Read(buffer2, &processedSize));
- if (processedSize != 4)
- return E_FAIL;
- streamPos += processedSize;
- fullSize = Get32(buffer2);
- sizeIsKnown = true;
- needDecompress = true;
- }
- }
- else
- {
- RINOK(_inStream->Seek(_archive.GetPosOfNonSolidItem(index) + 4, STREAM_SEEK_SET, NULL));
- if (item.IsCompressed)
- {
- needDecompress = true;
- bool useFilter;
- RINOK(_archive.Decoder.Init(
- EXTERNAL_CODECS_VARS
- _inStream, _archive.Method, _archive.FilterFlag, useFilter));
- // fullSize = Get32(buffer); // It's bug !!!
- // Test it: what is exact fullSize?
- fullSize = 0xFFFFFFFF;
- }
- else
- fullSize = item.Size;
- }
- if (!dataError)
- {
- if (needDecompress)
- {
- UInt64 offset = 0;
- while(!sizeIsKnown || fullSize > 0)
- {
- UInt32 curSize = kBufferLength;
- if (sizeIsKnown && curSize > fullSize)
- curSize = fullSize;
- size_t processedSize = curSize;
- HRESULT res = _archive.Decoder.Read(buffer, &processedSize);
- if (res != S_OK)
- {
- if (res != S_FALSE)
- return res;
- dataError = true;
- break;
- }
- if (processedSize == 0)
- {
- if (sizeIsKnown)
- dataError = true;
- break;
- }
-
- fullSize -= (UInt32)processedSize;
- streamPos += processedSize;
- offset += processedSize;
-
- UInt64 completed;
- if (_archive.IsSolid)
- completed = currentTotalSize + offset;
- else
- completed = streamPos;
- RINOK(extractCallback->SetCompleted(&completed));
- if (!testMode)
- RINOK(WriteStream(realOutStream, buffer, processedSize));
- }
- }
- else
- {
- while(fullSize > 0)
- {
- UInt32 curSize = MyMin(fullSize, kBufferLength);
- UInt32 processedSize;
- RINOK(_inStream->Read(buffer, curSize, &processedSize));
- if (processedSize == 0)
- {
- dataError = true;
- break;
- }
- fullSize -= processedSize;
- streamPos += processedSize;
- if (!testMode)
- RINOK(WriteStream(realOutStream, buffer, processedSize));
- }
- }
- }
- }
- }
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(dataError ?
- NArchive::NExtract::NOperationResult::kDataError :
- NArchive::NExtract::NOperationResult::kOK));
- }
- return S_OK;
- COM_TRY_END
-}
-
-IMPL_ISetCompressCodecsInfo
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisHandler.h
deleted file mode 100644
index 95fea5d0d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisHandler.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// NSisHandler.h
-
-#ifndef __NSIS_HANDLER_H
-#define __NSIS_HANDLER_H
-
-#include "Common/MyCom.h"
-#include "../IArchive.h"
-
-#include "NsisIn.h"
-
-#include "../../Common/CreateCoder.h"
-
-namespace NArchive {
-namespace NNsis {
-
-class CHandler:
- public IInArchive,
- PUBLIC_ISetCompressCodecsInfo
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _inStream;
- CInArchive _archive;
-
- DECL_EXTERNAL_CODECS_VARS
-
- bool GetUncompressedSize(int index, UInt32 &size);
- bool GetCompressedSize(int index, UInt32 &size);
-
- UString GetMethod(bool useItemFilter, UInt32 dictionary) const;
-public:
- MY_QUERYINTERFACE_BEGIN2(IInArchive)
- QUERY_ENTRY_ISetCompressCodecsInfo
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
- INTERFACE_IInArchive(;)
-
- DECL_ISetCompressCodecsInfo
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisIn.cpp
deleted file mode 100644
index 9e7e89bb9..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisIn.cpp
+++ /dev/null
@@ -1,1448 +0,0 @@
-// Archive/NsisIn.cpp
-
-#include "StdAfx.h"
-
-// #include <stdio.h>
-
-#include "NsisIn.h"
-#include "NsisDecode.h"
-
-#include "Windows/Defs.h"
-
-#include "../../Common/StreamUtils.h"
-
-#include "Common/StringConvert.h"
-#include "Common/IntToString.h"
-
-#include "../../../../C/CpuArch.h"
-
-#define Get32(p) GetUi32(p)
-
-namespace NArchive {
-namespace NNsis {
-
-Byte kSignature[kSignatureSize] = { 0xEF + 1, 0xBE, 0xAD, 0xDE,
-0x4E, 0x75, 0x6C, 0x6C, 0x73, 0x6F, 0x66, 0x74, 0x49, 0x6E, 0x73, 0x74};
-
-struct CSignatureInit { CSignatureInit() { kSignature[0]--; } } g_SignatureInit;
-
-#ifdef NSIS_SCRIPT
-static const char *kCrLf = "\x0D\x0A";
-#endif
-
-#define NS_UN_SKIP_CODE 0xE000
-#define NS_UN_VAR_CODE 0xE001
-#define NS_UN_SHELL_CODE 0xE002
-#define NS_UN_LANG_CODE 0xE003
-#define NS_UN_CODES_START NS_UN_SKIP_CODE
-#define NS_UN_CODES_END NS_UN_LANG_CODE
-
-Byte CInArchive::ReadByte()
-{
- if (_posInData >= _size)
- throw 1;
- return _data[_posInData++];
-}
-
-UInt32 CInArchive::ReadUInt32()
-{
- UInt32 value = 0;
- for (int i = 0; i < 4; i++)
- value |= ((UInt32)(ReadByte()) << (8 * i));
- return value;
-}
-
-void CInArchive::ReadBlockHeader(CBlockHeader &bh)
-{
- bh.Offset = ReadUInt32();
- bh.Num = ReadUInt32();
-}
-
-#define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; }
-
-static int CompareItems(void *const *p1, void *const *p2, void * /* param */)
-{
- const CItem &i1 = **(CItem **)p1;
- const CItem &i2 = **(CItem **)p2;
- RINOZ(MyCompare(i1.Pos, i2.Pos));
- if (i1.IsUnicode)
- {
- RINOZ(i1.PrefixU.Compare(i2.PrefixU));
- RINOZ(i1.NameU.Compare(i2.NameU));
- }
- else
- {
- RINOZ(i1.PrefixA.Compare(i2.PrefixA));
- RINOZ(i1.NameA.Compare(i2.NameA));
- }
- return 0;
-}
-
-static AString UIntToString(UInt32 v)
-{
- char sz[32];
- ConvertUInt64ToString(v, sz);
- return sz;
-}
-
-static AString IntToString(Int32 v)
-{
- char sz[32];
- ConvertInt64ToString(v, sz);
- return sz;
-}
-
-AString CInArchive::ReadStringA(UInt32 pos) const
-{
- AString s;
- if (pos >= _size)
- return IntToString((Int32)pos);
- UInt32 offset = GetOffset() + _stringsPos + pos;
- for (;;)
- {
- if (offset >= _size)
- break; // throw 1;
- char c = _data[offset++];
- if (c == 0)
- break;
- s += c;
- }
- return s;
-}
-
-UString CInArchive::ReadStringU(UInt32 pos) const
-{
- UString s;
- UInt32 offset = GetOffset() + _stringsPos + (pos * 2);
- for (;;)
- {
- if (offset >= _size || offset + 1 >= _size)
- return s; // throw 1;
- char c0 = _data[offset++];
- char c1 = _data[offset++];
- wchar_t c = (c0 | ((wchar_t)c1 << 8));
- if (c == 0)
- break;
- s += c;
- }
- return s;
-}
-
-/*
-static AString ParsePrefix(const AString &prefix)
-{
- AString res = prefix;
- if (prefix.Length() >= 3)
- {
- if ((Byte)prefix[0] == 0xFD && (Byte)prefix[1] == 0x95 && (Byte)prefix[2] == 0x80)
- res = "$INSTDIR" + prefix.Mid(3);
- else if ((Byte)prefix[0] == 0xFD && (Byte)prefix[1] == 0x96 && (Byte)prefix[2] == 0x80)
- res = "$OUTDIR" + prefix.Mid(3);
- }
- return res;
-}
-*/
-
-#define SYSREGKEY "Software\\Microsoft\\Windows\\CurrentVersion"
-
-/*
-# define CSIDL_PROGRAMS 0x2
-# define CSIDL_PRINTERS 0x4
-# define CSIDL_PERSONAL 0x5
-# define CSIDL_FAVORITES 0x6
-# define CSIDL_STARTUP 0x7
-# define CSIDL_RECENT 0x8
-# define CSIDL_SENDTO 0x9
-# define CSIDL_STARTMENU 0xB
-# define CSIDL_MYMUSIC 0xD
-# define CSIDL_MYVIDEO 0xE
-
-# define CSIDL_DESKTOPDIRECTORY 0x10
-# define CSIDL_NETHOOD 0x13
-# define CSIDL_FONTS 0x14
-# define CSIDL_TEMPLATES 0x15
-# define CSIDL_COMMON_STARTMENU 0x16
-# define CSIDL_COMMON_PROGRAMS 0x17
-# define CSIDL_COMMON_STARTUP 0x18
-# define CSIDL_COMMON_DESKTOPDIRECTORY 0x19
-# define CSIDL_APPDATA 0x1A
-# define CSIDL_PRINTHOOD 0x1B
-# define CSIDL_LOCAL_APPDATA 0x1C
-# define CSIDL_ALTSTARTUP 0x1D
-# define CSIDL_COMMON_ALTSTARTUP 0x1E
-# define CSIDL_COMMON_FAVORITES 0x1F
-
-# define CSIDL_INTERNET_CACHE 0x20
-# define CSIDL_COOKIES 0x21
-# define CSIDL_HISTORY 0x22
-# define CSIDL_COMMON_APPDATA 0x23
-# define CSIDL_WINDOWS 0x24
-# define CSIDL_SYSTEM 0x25
-# define CSIDL_PROGRAM_FILES 0x26
-# define CSIDL_MYPICTURES 0x27
-# define CSIDL_PROFILE 0x28
-# define CSIDL_PROGRAM_FILES_COMMON 0x2B
-# define CSIDL_COMMON_TEMPLATES 0x2D
-# define CSIDL_COMMON_DOCUMENTS 0x2E
-# define CSIDL_COMMON_ADMINTOOLS 0x2F
-
-# define CSIDL_ADMINTOOLS 0x30
-# define CSIDL_COMMON_MUSIC 0x35
-# define CSIDL_COMMON_PICTURES 0x36
-# define CSIDL_COMMON_VIDEO 0x37
-# define CSIDL_RESOURCES 0x38
-# define CSIDL_RESOURCES_LOCALIZED 0x39
-# define CSIDL_CDBURN_AREA 0x3B
-*/
-
-struct CCommandPair
-{
- int NumParams;
- const char *Name;
-};
-
-enum
-{
- // 0
- EW_INVALID_OPCODE, // zero is invalid. useful for catching errors. (otherwise an all zeroes instruction
- // does nothing, which is easily ignored but means something is wrong.
- EW_RET, // return from function call
- EW_NOP, // Nop/Jump, do nothing: 1, [?new address+1:advance one]
- EW_ABORT, // Abort: 1 [status]
- EW_QUIT, // Quit: 0
- EW_CALL, // Call: 1 [new address+1]
- EW_UPDATETEXT, // Update status text: 2 [update str, ui_st_updateflag=?ui_st_updateflag:this]
- EW_SLEEP, // Sleep: 1 [sleep time in milliseconds]
- EW_BRINGTOFRONT, // BringToFront: 0
- EW_CHDETAILSVIEW, // SetDetailsView: 2 [listaction,buttonaction]
-
- // 10
- EW_SETFILEATTRIBUTES, // SetFileAttributes: 2 [filename, attributes]
- EW_CREATEDIR, // Create directory: 2, [path, ?update$INSTDIR]
- EW_IFFILEEXISTS, // IfFileExists: 3, [file name, jump amount if exists, jump amount if not exists]
- EW_SETFLAG, // Sets a flag: 2 [id, data]
- EW_IFFLAG, // If a flag: 4 [on, off, id, new value mask]
- EW_GETFLAG, // Gets a flag: 2 [output, id]
- EW_RENAME, // Rename: 3 [old, new, rebootok]
- EW_GETFULLPATHNAME, // GetFullPathName: 2 [output, input, ?lfn:sfn]
- EW_SEARCHPATH, // SearchPath: 2 [output, filename]
- EW_GETTEMPFILENAME, // GetTempFileName: 2 [output, base_dir]
-
- // 20
- EW_EXTRACTFILE, // File to extract: 6 [overwriteflag, output filename, compressed filedata, filedatetimelow, filedatetimehigh, allow ignore]
- // overwriteflag: 0x1 = no. 0x0=force, 0x2=try, 0x3=if date is newer
- EW_DELETEFILE, // Delete File: 2, [filename, rebootok]
- EW_MESSAGEBOX, // MessageBox: 5,[MB_flags,text,retv1:retv2,moveonretv1:moveonretv2]
- EW_RMDIR, // RMDir: 2 [path, recursiveflag]
- EW_STRLEN, // StrLen: 2 [output, input]
- EW_ASSIGNVAR, // Assign: 4 [variable (0-9) to assign, string to assign, maxlen, startpos]
- EW_STRCMP, // StrCmp: 5 [str1, str2, jump_if_equal, jump_if_not_equal, case-sensitive?]
- EW_READENVSTR, // ReadEnvStr/ExpandEnvStrings: 3 [output, string_with_env_variables, IsRead]
- EW_INTCMP, // IntCmp: 6 [val1, val2, equal, val1<val2, val1>val2, unsigned?]
- EW_INTOP, // IntOp: 4 [output, input1, input2, op] where op: 0=add, 1=sub, 2=mul, 3=div, 4=bor, 5=band, 6=bxor, 7=bnot input1, 8=lnot input1, 9=lor, 10=land], 11=1%2
-
- // 30
- EW_INTFMT, // IntFmt: [output, format, input]
- EW_PUSHPOP, // Push/Pop/Exchange: 3 [variable/string, ?pop:push, ?exch]
- EW_FINDWINDOW, // FindWindow: 5, [outputvar, window class,window name, window_parent, window_after]
- EW_SENDMESSAGE, // SendMessage: 6 [output, hwnd, msg, wparam, lparam, [wparamstring?1:0 | lparamstring?2:0 | timeout<<2]
- EW_ISWINDOW, // IsWindow: 3 [hwnd, jump_if_window, jump_if_notwindow]
- EW_GETDLGITEM, // GetDlgItem: 3: [outputvar, dialog, item_id]
- EW_SETCTLCOLORS, // SerCtlColors: 3: [hwnd, pointer to struct colors]
- EW_SETBRANDINGIMAGE, // SetBrandingImage: 1: [Bitmap file]
- EW_CREATEFONT, // CreateFont: 5: [handle output, face name, height, weight, flags]
- EW_SHOWWINDOW, // ShowWindow: 2: [hwnd, show state]
-
- // 40
- EW_SHELLEXEC, // ShellExecute program: 4, [shell action, complete commandline, parameters, showwindow]
- EW_EXECUTE, // Execute program: 3,[complete command line,waitflag,>=0?output errorcode]
- EW_GETFILETIME, // GetFileTime; 3 [file highout lowout]
- EW_GETDLLVERSION, // GetDLLVersion: 3 [file highout lowout]
- EW_REGISTERDLL, // Register DLL: 3,[DLL file name, string ptr of function to call, text to put in display (<0 if none/pass parms), 1 - no unload, 0 - unload]
- EW_CREATESHORTCUT, // Make Shortcut: 5, [link file, target file, parameters, icon file, iconindex|show mode<<8|hotkey<<16]
- EW_COPYFILES, // CopyFiles: 3 [source mask, destination location, flags]
- EW_REBOOT, // Reboot: 0
- EW_WRITEINI, // Write INI String: 4, [Section, Name, Value, INI File]
- EW_READINISTR, // ReadINIStr: 4 [output, section, name, ini_file]
-
- // 50
- EW_DELREG, // DeleteRegValue/DeleteRegKey: 4, [root key(int), KeyName, ValueName, delkeyonlyifempty]. ValueName is -1 if delete key
- EW_WRITEREG, // Write Registry value: 5, [RootKey(int),KeyName,ItemName,ItemData,typelen]
- // typelen=1 for str, 2 for dword, 3 for binary, 0 for expanded str
- EW_READREGSTR, // ReadRegStr: 5 [output, rootkey(int), keyname, itemname, ==1?int::str]
- EW_REGENUM, // RegEnum: 5 [output, rootkey, keyname, index, ?key:value]
- EW_FCLOSE, // FileClose: 1 [handle]
- EW_FOPEN, // FileOpen: 4 [name, openmode, createmode, outputhandle]
- EW_FPUTS, // FileWrite: 3 [handle, string, ?int:string]
- EW_FGETS, // FileRead: 4 [handle, output, maxlen, ?getchar:gets]
- EW_FSEEK, // FileSeek: 4 [handle, offset, mode, >=0?positionoutput]
- EW_FINDCLOSE, // FindClose: 1 [handle]
-
- // 60
- EW_FINDNEXT, // FindNext: 2 [output, handle]
- EW_FINDFIRST, // FindFirst: 2 [filespec, output, handleoutput]
- EW_WRITEUNINSTALLER, // WriteUninstaller: 3 [name, offset, icon_size]
- EW_LOG, // LogText: 2 [0, text] / LogSet: [1, logstate]
- EW_SECTIONSET, // SectionSetText: 3: [idx, 0, text]
- // SectionGetText: 3: [idx, 1, output]
- // SectionSetFlags: 3: [idx, 2, flags]
- // SectionGetFlags: 3: [idx, 3, output]
- EW_INSTTYPESET, // InstTypeSetFlags: 3: [idx, 0, flags]
- // InstTypeGetFlags: 3: [idx, 1, output]
- // instructions not actually implemented in exehead, but used in compiler.
- EW_GETLABELADDR, // both of these get converted to EW_ASSIGNVAR
- EW_GETFUNCTIONADDR,
-
- EW_LOCKWINDOW
-};
-
-#ifdef NSIS_SCRIPT
-static CCommandPair kCommandPairs[] =
-{
- { 0, "Invalid" },
- { 0, "Return" },
- { 1, "Goto" },
- { 0, "Abort" },
- { 0, "Quit" },
- { 1, "Call" },
- { 2, "UpdateSatusText" },
- { 1, "Sleep" },
- { 0, "BringToFront" },
- { 2, "SetDetailsView" },
-
- { 2, "SetFileAttributes" },
- { 2, "SetOutPath" },
- { 3, "IfFileExists" },
- { 2, "SetFlag" },
- { 4, "IfFlag" },
- { 2, "GetFlag" },
- { 3, "Rename" },
- { 2, "GetFullPathName" },
- { 2, "SearchPath" },
- { 2, "GetTempFileName" },
-
- { 6, "File" },
- { 2, "Delete" },
- { 5, "MessageBox" },
- { 2, "RMDir" },
- { 2, "StrLen" },
- { 4, "StrCpy" },
- { 5, "StrCmp" },
- { 3, "ReadEnvStr" },
- { 6, "IntCmp" },
- { 4, "IntOp" },
-
- { 3, "IntFmt" },
- { 3, "PushPop" },
- { 5, "FindWindow" },
- { 6, "SendMessage" },
- { 3, "IsWindow" },
- { 3, "GetDlgItem" },
- { 3, "SerCtlColors" },
- { 1, "SetBrandingImage" },
- { 5, "CreateFont" },
- { 2, "ShowWindow" },
-
- { 4, "ShellExecute" },
- { 3, "Execute" },
- { 3, "GetFileTime" },
- { 3, "GetDLLVersion" },
- { 3, "RegisterDLL" },
- { 5, "CreateShortCut" },
- { 3, "CopyFiles" },
- { 0, "Reboot" },
- { 4, "WriteINIStr" },
- { 4, "ReadINIStr" },
-
- { 4, "DelReg" },
- { 5, "WriteReg" },
- { 5, "ReadRegStr" },
- { 5, "RegEnum" },
- { 1, "FileClose" },
- { 4, "FileOpen" },
- { 3, "FileWrite" },
- { 4, "FileRead" },
- { 4, "FileSeek" },
- { 1, "FindClose" },
-
- { 2, "FindNext" },
- { 2, "FindFirst" },
- { 3, "WriteUninstaller" },
- { 2, "LogText" },
- { 3, "Section?etText" },
- { 3, "InstType?etFlags" },
- { 6, "GetLabelAddr" },
- { 2, "GetFunctionAddress" },
- { 6, "LockWindow" }
-};
-
-#endif
-
-static const char *kShellStrings[] =
-{
- "",
- "",
-
- "SMPROGRAMS",
- "",
- "PRINTERS",
- "DOCUMENTS",
- "FAVORITES",
- "SMSTARTUP",
- "RECENT",
- "SENDTO",
- "",
- "STARTMENU",
- "",
- "MUSIC",
- "VIDEO",
- "",
-
- "DESKTOP",
- "",
- "",
- "NETHOOD",
- "FONTS",
- "TEMPLATES",
- "COMMONSTARTMENU",
- "COMMONFILES",
- "COMMON_STARTUP",
- "COMMON_DESKTOPDIRECTORY",
- "QUICKLAUNCH",
- "PRINTHOOD",
- "LOCALAPPDATA",
- "ALTSTARTUP",
- "ALTSTARTUP",
- "FAVORITES",
-
- "INTERNET_CACHE",
- "COOKIES",
- "HISTORY",
- "APPDATA",
- "WINDIR",
- "SYSDIR",
- "PROGRAMFILES",
- "PICTURES",
- "PROFILE",
- "",
- "",
- "COMMONFILES",
- "",
- "TEMPLATES",
- "DOCUMENTS",
- "ADMINTOOLS",
-
- "ADMINTOOLS",
- "",
- "",
- "",
- "",
- "MUSIC",
- "PICTURES",
- "VIDEO",
- "RESOURCES",
- "RESOURCES_LOCALIZED",
- "",
- "CDBURN_AREA"
-};
-
-static const int kNumShellStrings = sizeof(kShellStrings) / sizeof(kShellStrings[0]);
-
-/*
-# define CMDLINE 20 // everything before here doesn't have trailing slash removal
-# define INSTDIR 21
-# define OUTDIR 22
-# define EXEDIR 23
-# define LANGUAGE 24
-# define TEMP 25
-# define PLUGINSDIR 26
-# define HWNDPARENT 27
-# define _CLICK 28
-# define _OUTDIR 29
-*/
-
-static const char *kVarStrings[] =
-{
- "CMDLINE",
- "INSTDIR",
- "OUTDIR",
- "EXEDIR",
- "LANGUAGE",
- "TEMP",
- "PLUGINSDIR",
- "EXEPATH", // test it
- "EXEFILE", // test it
- "HWNDPARENT",
- "_CLICK",
- "_OUTDIR"
-};
-
-static const int kNumVarStrings = sizeof(kVarStrings) / sizeof(kVarStrings[0]);
-
-
-static AString GetVar(UInt32 index)
-{
- AString res = "$";
- if (index < 10)
- res += UIntToString(index);
- else if (index < 20)
- {
- res += "R";
- res += UIntToString(index - 10);
- }
- else if (index < 20 + kNumVarStrings)
- res += kVarStrings[index - 20];
- else
- {
- res += "[";
- res += UIntToString(index);
- res += "]";
- }
- return res;
-}
-
-#define NS_SKIP_CODE 252
-#define NS_VAR_CODE 253
-#define NS_SHELL_CODE 254
-#define NS_LANG_CODE 255
-#define NS_CODES_START NS_SKIP_CODE
-
-static AString GetShellString(int index)
-{
- AString res = "$";
- if (index < kNumShellStrings)
- {
- const char *sz = kShellStrings[index];
- if (sz[0] != 0)
- return res + sz;
- }
- res += "SHELL[";
- res += UIntToString(index);
- res += "]";
- return res;
-}
-
-// Based on Dave Laundon's simplified process_string
-AString GetNsisString(const AString &s)
-{
- AString res;
- for (int i = 0; i < s.Length();)
- {
- unsigned char nVarIdx = s[i++];
- if (nVarIdx > NS_CODES_START && i + 2 <= s.Length())
- {
- int nData = s[i++] & 0x7F;
- unsigned char c1 = s[i++];
- nData |= (((int)(c1 & 0x7F)) << 7);
-
- if (nVarIdx == NS_SHELL_CODE)
- res += GetShellString(c1);
- else if (nVarIdx == NS_VAR_CODE)
- res += GetVar(nData);
- else if (nVarIdx == NS_LANG_CODE)
- res += "NS_LANG_CODE";
- }
- else if (nVarIdx == NS_SKIP_CODE)
- {
- if (i < s.Length())
- res += s[i++];
- }
- else // Normal char
- res += (char)nVarIdx;
- }
- return res;
-}
-
-UString GetNsisString(const UString &s)
-{
- UString res;
- for (int i = 0; i < s.Length();)
- {
- wchar_t nVarIdx = s[i++];
- if (nVarIdx > NS_UN_CODES_START && nVarIdx <= NS_UN_CODES_END)
- {
- if (i == s.Length())
- break;
- int nData = s[i++] & 0x7FFF;
-
- if (nVarIdx == NS_UN_SHELL_CODE)
- res += GetUnicodeString(GetShellString(nData >> 8));
- else if (nVarIdx == NS_UN_VAR_CODE)
- res += GetUnicodeString(GetVar(nData));
- else if (nVarIdx == NS_UN_LANG_CODE)
- res += L"NS_LANG_CODE";
- }
- else if (nVarIdx == NS_UN_SKIP_CODE)
- {
- if (i == s.Length())
- break;
- res += s[i++];
- }
- else // Normal char
- res += (char)nVarIdx;
- }
- return res;
-}
-
-AString CInArchive::ReadString2A(UInt32 pos) const
-{
- return GetNsisString(ReadStringA(pos));
-}
-
-UString CInArchive::ReadString2U(UInt32 pos) const
-{
- return GetNsisString(ReadStringU(pos));
-}
-
-AString CInArchive::ReadString2(UInt32 pos) const
-{
- if (IsUnicode)
- return UnicodeStringToMultiByte(ReadString2U(pos));
- else
- return ReadString2A(pos);
-}
-
-AString CInArchive::ReadString2Qw(UInt32 pos) const
-{
- return "\"" + ReadString2(pos) + "\"";
-}
-
-#define DEL_DIR 1
-#define DEL_RECURSE 2
-#define DEL_REBOOT 4
-// #define DEL_SIMPLE 8
-
-static const int kNumEntryParams = 6;
-
-struct CEntry
-{
- UInt32 Which;
- UInt32 Params[kNumEntryParams];
- AString GetParamsString(int numParams);
- CEntry()
- {
- Which = 0;
- for (UInt32 j = 0; j < kNumEntryParams; j++)
- Params[j] = 0;
- }
-};
-
-AString CEntry::GetParamsString(int numParams)
-{
- AString s;
- for (int i = 0; i < numParams; i++)
- {
- s += " ";
- UInt32 v = Params[i];
- if (v > 0xFFF00000)
- s += IntToString((Int32)Params[i]);
- else
- s += UIntToString(Params[i]);
- }
- return s;
-}
-
-#ifdef NSIS_SCRIPT
-
-static AString GetRegRootID(UInt32 val)
-{
- const char *s;
- switch(val)
- {
- case 0: s = "SHCTX"; break;
- case 0x80000000: s = "HKCR"; break;
- case 0x80000001: s = "HKCU"; break;
- case 0x80000002: s = "HKLM"; break;
- case 0x80000003: s = "HKU"; break;
- case 0x80000004: s = "HKPD"; break;
- case 0x80000005: s = "HKCC"; break;
- case 0x80000006: s = "HKDD"; break;
- case 0x80000050: s = "HKPT"; break;
- case 0x80000060: s = "HKPN"; break;
- default:
- return UIntToString(val); break;
- }
- return s;
-}
-
-#endif
-
-HRESULT CInArchive::ReadEntries(const CBlockHeader &bh)
-{
- _posInData = bh.Offset + GetOffset();
- AString prefixA;
- UString prefixU;
- for (UInt32 i = 0; i < bh.Num; i++)
- {
- CEntry e;
- e.Which = ReadUInt32();
- for (UInt32 j = 0; j < kNumEntryParams; j++)
- e.Params[j] = ReadUInt32();
- #ifdef NSIS_SCRIPT
- if (e.Which != EW_PUSHPOP && e.Which < sizeof(kCommandPairs) / sizeof(kCommandPairs[0]))
- {
- const CCommandPair &pair = kCommandPairs[e.Which];
- Script += pair.Name;
- }
- #endif
-
- switch (e.Which)
- {
- case EW_CREATEDIR:
- {
- if (IsUnicode)
- {
- prefixU.Empty();
- prefixU = ReadString2U(e.Params[0]);
- }
- else
- {
- prefixA.Empty();
- prefixA = ReadString2A(e.Params[0]);
- }
- #ifdef NSIS_SCRIPT
- Script += " ";
- if (IsUnicode)
- Script += UnicodeStringToMultiByte(prefixU);
- else
- Script += prefixA;
- #endif
- break;
- }
-
- case EW_EXTRACTFILE:
- {
- CItem item;
- item.IsUnicode = IsUnicode;
- if (IsUnicode)
- {
- item.PrefixU = prefixU;
- item.NameU = ReadString2U(e.Params[1]);
- }
- else
- {
- item.PrefixA = prefixA;
- item.NameA = ReadString2A(e.Params[1]);
- }
- /* UInt32 overwriteFlag = e.Params[0]; */
- item.Pos = e.Params[2];
- item.MTime.dwLowDateTime = e.Params[3];
- item.MTime.dwHighDateTime = e.Params[4];
- /* UInt32 allowIgnore = e.Params[5]; */
- if (Items.Size() > 0)
- {
- /*
- if (item.Pos == Items.Back().Pos)
- continue;
- */
- }
- Items.Add(item);
- #ifdef NSIS_SCRIPT
- Script += " ";
-
- if (IsUnicode)
- Script += UnicodeStringToMultiByte(item.NameU);
- else
- Script += item.NameA;
- #endif
- break;
- }
-
-
- #ifdef NSIS_SCRIPT
- case EW_UPDATETEXT:
- {
- Script += " ";
- Script += ReadString2(e.Params[0]);
- Script += " ";
- Script += UIntToString(e.Params[1]);
- break;
- }
- case EW_SETFILEATTRIBUTES:
- {
- Script += " ";
- Script += ReadString2(e.Params[0]);
- Script += " ";
- Script += UIntToString(e.Params[1]);
- break;
- }
- case EW_IFFILEEXISTS:
- {
- Script += " ";
- Script += ReadString2(e.Params[0]);
- Script += " ";
- Script += UIntToString(e.Params[1]);
- Script += " ";
- Script += UIntToString(e.Params[2]);
- break;
- }
- case EW_RENAME:
- {
- Script += " ";
- Script += ReadString2(e.Params[0]);
- Script += " ";
- Script += ReadString2(e.Params[1]);
- Script += " ";
- Script += UIntToString(e.Params[2]);
- break;
- }
- case EW_GETFULLPATHNAME:
- {
- Script += " ";
- Script += ReadString2(e.Params[0]);
- Script += " ";
- Script += ReadString2(e.Params[1]);
- Script += " ";
- Script += UIntToString(e.Params[2]);
- break;
- }
- case EW_SEARCHPATH:
- {
- Script += " ";
- Script += ReadString2(e.Params[0]);
- Script += " ";
- Script += ReadString2(e.Params[1]);
- break;
- }
- case EW_GETTEMPFILENAME:
- {
- AString s;
- Script += " ";
- Script += ReadString2(e.Params[0]);
- Script += " ";
- Script += ReadString2(e.Params[1]);
- break;
- }
-
- case EW_DELETEFILE:
- {
- UInt64 flag = e.Params[1];
- if (flag != 0)
- {
- Script += " ";
- if (flag == DEL_REBOOT)
- Script += "/REBOOTOK";
- else
- Script += UIntToString(e.Params[1]);
- }
- Script += " ";
- Script += ReadString2(e.Params[0]);
- break;
- }
- case EW_RMDIR:
- {
- UInt64 flag = e.Params[1];
- if (flag != 0)
- {
- if ((flag & DEL_REBOOT) != 0)
- Script += " /REBOOTOK";
- if ((flag & DEL_RECURSE) != 0)
- Script += " /r";
- }
- Script += " ";
- Script += ReadString2(e.Params[0]);
- break;
- }
- case EW_STRLEN:
- {
- Script += " ";
- Script += GetVar(e.Params[0]);;
- Script += " ";
- Script += ReadString2Qw(e.Params[1]);
- break;
- }
- case EW_ASSIGNVAR:
- {
- Script += " ";
- Script += GetVar(e.Params[0]);;
- Script += " ";
- Script += ReadString2Qw(e.Params[1]);
- AString maxLen, startOffset;
- if (e.Params[2] != 0)
- maxLen = ReadString2(e.Params[2]);
- if (e.Params[3] != 0)
- startOffset = ReadString2(e.Params[3]);
- if (!maxLen.IsEmpty() || !startOffset.IsEmpty())
- {
- Script += " ";
- if (maxLen.IsEmpty())
- Script += "\"\"";
- else
- Script += maxLen;
- if (!startOffset.IsEmpty())
- {
- Script += " ";
- Script += startOffset;
- }
- }
- break;
- }
- case EW_STRCMP:
- {
- Script += " ";
-
- Script += " ";
- Script += ReadString2Qw(e.Params[0]);
-
- Script += " ";
- Script += ReadString2Qw(e.Params[1]);
-
- for (int j = 2; j < 5; j++)
- {
- Script += " ";
- Script += UIntToString(e.Params[j]);
- }
- break;
- }
- case EW_INTCMP:
- {
- if (e.Params[5] != 0)
- Script += "U";
-
- Script += " ";
- Script += ReadString2(e.Params[0]);
- Script += " ";
- Script += ReadString2(e.Params[1]);
-
- for (int i = 2; i < 5; i++)
- {
- Script += " ";
- Script += UIntToString(e.Params[i]);
- }
- break;
- }
- case EW_INTOP:
- {
- Script += " ";
- Script += GetVar(e.Params[0]);
- Script += " ";
- int numOps = 2;
- AString op;
- switch (e.Params[3])
- {
- case 0: op = '+'; break;
- case 1: op = '-'; break;
- case 2: op = '*'; break;
- case 3: op = '/'; break;
- case 4: op = '|'; break;
- case 5: op = '&'; break;
- case 6: op = '^'; break;
- case 7: op = '~'; numOps = 1; break;
- case 8: op = '!'; numOps = 1; break;
- case 9: op = "||"; break;
- case 10: op = "&&"; break;
- case 11: op = '%'; break;
- default: op = UIntToString(e.Params[3]);
- }
- AString p1 = ReadString2(e.Params[1]);
- if (numOps == 1)
- {
- Script += op;
- Script += p1;
- }
- else
- {
- Script += p1;
- Script += " ";
- Script += op;
- Script += " ";
- Script += ReadString2(e.Params[2]);
- }
- break;
- }
-
- case EW_PUSHPOP:
- {
- int isPop = (e.Params[1] != 0);
- if (isPop)
- {
- Script += "Pop";
- Script += " ";
- Script += GetVar(e.Params[0]);;
- }
- else
- {
- int isExch = (e.Params[2] != 0);
- if (isExch)
- {
- Script += "Exch";
- }
- else
- {
- Script += "Push";
- Script += " ";
- Script += ReadString2(e.Params[0]);
- }
- }
- break;
- }
-
- case EW_SENDMESSAGE:
- {
- // SendMessage: 6 [output, hwnd, msg, wparam, lparam, [wparamstring?1:0 | lparamstring?2:0 | timeout<<2]
- Script += " ";
- // Script += ReadString2(e.Params[0]);
- // Script += " ";
- Script += ReadString2(e.Params[1]);
- Script += " ";
- Script += ReadString2(e.Params[2]);
-
- Script += " ";
- UInt32 spec = e.Params[5];
- // if (spec & 1)
- Script += IntToString(e.Params[3]);
- // else
- // Script += ReadString2(e.Params[3]);
-
- Script += " ";
- // if (spec & 2)
- Script += IntToString(e.Params[4]);
- // else
- // Script += ReadString2(e.Params[4]);
-
- if ((Int32)e.Params[0] >= 0)
- {
- Script += " ";
- Script += GetVar(e.Params[1]);
- }
-
- spec >>= 2;
- if (spec != 0)
- {
- Script += " /TIMEOUT=";
- Script += IntToString(spec);
- }
- break;
- }
-
- case EW_GETDLGITEM:
- {
- Script += " ";
- Script += GetVar(e.Params[0]);;
- Script += " ";
- Script += ReadString2(e.Params[1]);
- Script += " ";
- Script += ReadString2(e.Params[2]);
- break;
- }
-
-
- case EW_REGISTERDLL:
- {
- Script += " ";
- Script += ReadString2(e.Params[0]);
- Script += " ";
- Script += ReadString2(e.Params[1]);
- Script += " ";
- Script += UIntToString(e.Params[2]);
- break;
- }
-
- case EW_CREATESHORTCUT:
- {
- AString s;
-
- Script += " ";
- Script += ReadString2Qw(e.Params[0]);
-
- Script += " ";
- Script += ReadString2Qw(e.Params[1]);
-
- for (int j = 2; j < 5; j++)
- {
- Script += " ";
- Script += UIntToString(e.Params[j]);
- }
- break;
- }
-
- /*
- case EW_DELREG:
- {
- AString keyName, valueName;
- keyName = ReadString2(e.Params[1]);
- bool isValue = (e.Params[2] != -1);
- if (isValue)
- {
- valueName = ReadString2(e.Params[2]);
- Script += "Key";
- }
- else
- Script += "Value";
- Script += " ";
- Script += UIntToString(e.Params[0]);
- Script += " ";
- Script += keyName;
- if (isValue)
- {
- Script += " ";
- Script += valueName;
- }
- Script += " ";
- Script += UIntToString(e.Params[3]);
- break;
- }
- */
-
- case EW_WRITEREG:
- {
- AString s;
- switch(e.Params[4])
- {
- case 1: s = "Str"; break;
- case 2: s = "ExpandStr"; break;
- case 3: s = "Bin"; break;
- case 4: s = "DWORD"; break;
- default: s = "?" + UIntToString(e.Params[4]); break;
- }
- Script += s;
- Script += " ";
- Script += GetRegRootID(e.Params[0]);
- Script += " ";
-
- AString keyName, valueName;
- keyName = ReadString2Qw(e.Params[1]);
- Script += keyName;
- Script += " ";
-
- valueName = ReadString2Qw(e.Params[2]);
- Script += valueName;
- Script += " ";
-
- valueName = ReadString2Qw(e.Params[3]);
- Script += valueName;
- Script += " ";
-
- break;
- }
-
- case EW_WRITEUNINSTALLER:
- {
- Script += " ";
- Script += ReadString2(e.Params[0]);
- for (int j = 1; j < 3; j++)
- {
- Script += " ";
- Script += UIntToString(e.Params[j]);
- }
- break;
- }
-
- default:
- {
- int numParams = kNumEntryParams;
- if (e.Which < sizeof(kCommandPairs) / sizeof(kCommandPairs[0]))
- {
- const CCommandPair &pair = kCommandPairs[e.Which];
- // Script += pair.Name;
- numParams = pair.NumParams;
- }
- else
- {
- Script += "Unknown";
- Script += UIntToString(e.Which);
- }
- Script += e.GetParamsString(numParams);
- }
- #endif
- }
- #ifdef NSIS_SCRIPT
- Script += kCrLf;
- #endif
- }
-
- {
- Items.Sort(CompareItems, 0);
- int i;
- // if (IsSolid)
- for (i = 0; i + 1 < Items.Size();)
- {
- bool sameName = IsUnicode ?
- (Items[i].NameU == Items[i + 1].NameU) :
- (Items[i].NameA == Items[i + 1].NameA);
- if (Items[i].Pos == Items[i + 1].Pos && (IsSolid || sameName))
- Items.Delete(i + 1);
- else
- i++;
- }
- for (i = 0; i + 1 < Items.Size(); i++)
- {
- CItem &item = Items[i];
- item.EstimatedSizeIsDefined = true;
- item.EstimatedSize = Items[i + 1].Pos - item.Pos - 4;
- }
- if (!IsSolid)
- {
- for (i = 0; i < Items.Size(); i++)
- {
- CItem &item = Items[i];
- RINOK(_stream->Seek(GetPosOfNonSolidItem(i), STREAM_SEEK_SET, NULL));
- const UInt32 kSigSize = 4 + 1 + 5;
- BYTE sig[kSigSize];
- size_t processedSize = kSigSize;
- RINOK(ReadStream(_stream, sig, &processedSize));
- if (processedSize < 4)
- return S_FALSE;
- UInt32 size = Get32(sig);
- if ((size & 0x80000000) != 0)
- {
- item.IsCompressed = true;
- // is compressed;
- size &= ~0x80000000;
- if (Method == NMethodType::kLZMA)
- {
- if (processedSize < 9)
- return S_FALSE;
- if (FilterFlag)
- item.UseFilter = (sig[4] != 0);
- item.DictionarySize = Get32(sig + 5 + (FilterFlag ? 1 : 0));
- }
- }
- else
- {
- item.IsCompressed = false;
- item.Size = size;
- item.SizeIsDefined = true;
- }
- item.CompressedSize = size;
- item.CompressedSizeIsDefined = true;
- }
- }
- }
- return S_OK;
-}
-
-HRESULT CInArchive::Parse()
-{
- // UInt32 offset = ReadUInt32();
- // ???? offset == FirstHeader.HeaderLength
- /* UInt32 ehFlags = */ ReadUInt32();
- CBlockHeader bhPages, bhSections, bhEntries, bhStrings, bhLangTables, bhCtlColors, bhData;
- // CBlockHeader bgFont;
- ReadBlockHeader(bhPages);
- ReadBlockHeader(bhSections);
- ReadBlockHeader(bhEntries);
- ReadBlockHeader(bhStrings);
- ReadBlockHeader(bhLangTables);
- ReadBlockHeader(bhCtlColors);
- // ReadBlockHeader(bgFont);
- ReadBlockHeader(bhData);
-
- _stringsPos = bhStrings.Offset;
- UInt32 pos = GetOffset() + _stringsPos;
- int numZeros0 = 0;
- int numZeros1 = 0;
- int i;
- const int kBlockSize = 256;
- for (i = 0; i < kBlockSize; i++)
- {
- if (pos >= _size || pos + 1 >= _size)
- break;
- char c0 = _data[pos++];
- char c1 = _data[pos++];
- wchar_t c = (c0 | ((wchar_t)c1 << 8));
-
- if (c >= NS_UN_CODES_START && c < NS_UN_CODES_END)
- {
- if (pos >= _size || pos + 1 >= _size)
- break;
- pos += 2;
- numZeros1++;
- }
- else
- {
- if (c0 == 0 && c1 != 0)
- numZeros0++;
- if (c1 == 0)
- numZeros1++;
- }
- // printf("\nnumZeros0 = %2x %2x", _data[pos + 0], _data[pos + 1]);
- }
- IsUnicode = (numZeros1 > numZeros0 * 3 + kBlockSize / 16);
- // printf("\nnumZeros0 = %3d numZeros1 = %3d", numZeros0, numZeros1);
- return ReadEntries(bhEntries);
-}
-
-static bool IsLZMA(const Byte *p, UInt32 &dictionary)
-{
- dictionary = Get32(p + 1);
- return (p[0] == 0x5D && p[1] == 0x00 && p[2] == 0x00 && p[5] == 0x00);
-}
-
-static bool IsLZMA(const Byte *p, UInt32 &dictionary, bool &thereIsFlag)
-{
- if (IsLZMA(p, dictionary))
- {
- thereIsFlag = false;
- return true;
- }
- if (IsLZMA(p + 1, dictionary))
- {
- thereIsFlag = true;
- return true;
- }
- return false;
-}
-
-HRESULT CInArchive::Open2(
- DECL_EXTERNAL_CODECS_LOC_VARS2
- )
-{
- RINOK(_stream->Seek(0, STREAM_SEEK_CUR, &StreamOffset));
-
- const UInt32 kSigSize = 4 + 1 + 5 + 1; // size, flag, lzma props, lzma first byte
- BYTE sig[kSigSize];
- RINOK(ReadStream_FALSE(_stream, sig, kSigSize));
- UInt64 position;
- RINOK(_stream->Seek(StreamOffset, STREAM_SEEK_SET, &position));
-
- _headerIsCompressed = true;
- IsSolid = true;
- FilterFlag = false;
-
- UInt32 compressedHeaderSize = Get32(sig);
-
- if (compressedHeaderSize == FirstHeader.HeaderLength)
- {
- _headerIsCompressed = false;
- IsSolid = false;
- Method = NMethodType::kCopy;
- }
- else if (IsLZMA(sig, DictionarySize, FilterFlag))
- {
- Method = NMethodType::kLZMA;
- }
- else if (IsLZMA(sig + 4, DictionarySize, FilterFlag))
- {
- IsSolid = false;
- Method = NMethodType::kLZMA;
- }
- else if (sig[3] == 0x80)
- {
- IsSolid = false;
- Method = NMethodType::kDeflate;
- }
- else
- {
- Method = NMethodType::kDeflate;
- }
-
- _posInData = 0;
- if (!IsSolid)
- {
- _headerIsCompressed = ((compressedHeaderSize & 0x80000000) != 0);
- if (_headerIsCompressed)
- compressedHeaderSize &= ~0x80000000;
- _nonSolidStartOffset = compressedHeaderSize;
- RINOK(_stream->Seek(StreamOffset + 4, STREAM_SEEK_SET, NULL));
- }
- UInt32 unpackSize = FirstHeader.HeaderLength;
- if (_headerIsCompressed)
- {
- // unpackSize = (1 << 23);
- _data.SetCapacity(unpackSize);
- RINOK(Decoder.Init(
- EXTERNAL_CODECS_LOC_VARS
- _stream, Method, FilterFlag, UseFilter));
- size_t processedSize = unpackSize;
- RINOK(Decoder.Read(_data, &processedSize));
- if (processedSize != unpackSize)
- return S_FALSE;
- _size = processedSize;
- if (IsSolid)
- {
- UInt32 size2 = ReadUInt32();
- if (size2 < _size)
- _size = size2;
- }
- }
- else
- {
- _data.SetCapacity(unpackSize);
- _size = (size_t)unpackSize;
- RINOK(ReadStream_FALSE(_stream, (Byte *)_data, unpackSize));
- }
- return Parse();
-}
-
-/*
-NsisExe =
-{
- ExeStub
- Archive // must start from 512 * N
- #ifndef NSIS_CONFIG_CRC_ANAL
- {
- Some additional data
- }
-}
-
-Archive
-{
- FirstHeader
- Data
- #ifdef NSIS_CONFIG_CRC_SUPPORT && FirstHeader.ThereIsCrc()
- {
- CRC
- }
-}
-
-FirstHeader
-{
- UInt32 Flags;
- Byte Signature[16];
- // points to the header+sections+entries+stringtable in the datablock
- UInt32 HeaderLength;
- UInt32 ArchiveSize;
-}
-*/
-
-HRESULT CInArchive::Open(
- DECL_EXTERNAL_CODECS_LOC_VARS
- IInStream *inStream, const UInt64 *maxCheckStartPosition)
-{
- Clear();
- RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
- UInt64 maxSize = ((maxCheckStartPosition != 0) ? *maxCheckStartPosition : 0);
- const UInt32 kStep = 512;
- Byte buffer[kStep];
-
- UInt64 position = 0;
- for (; position <= maxSize; position += kStep)
- {
- RINOK(ReadStream_FALSE(inStream, buffer, kStep));
- if (memcmp(buffer + 4, kSignature, kSignatureSize) == 0)
- break;
- }
- if (position > maxSize)
- return S_FALSE;
- const UInt32 kStartHeaderSize = 4 * 7;
- RINOK(inStream->Seek(0, STREAM_SEEK_END, &_archiveSize));
- RINOK(inStream->Seek(position + kStartHeaderSize, STREAM_SEEK_SET, 0));
- FirstHeader.Flags = Get32(buffer);
- FirstHeader.HeaderLength = Get32(buffer + kSignatureSize + 4);
- FirstHeader.ArchiveSize = Get32(buffer + kSignatureSize + 8);
- if (_archiveSize - position < FirstHeader.ArchiveSize)
- return S_FALSE;
-
- try
- {
- _stream = inStream;
- HRESULT res = Open2(EXTERNAL_CODECS_LOC_VARS2);
- if (res != S_OK)
- Clear();
- _stream.Release();
- return res;
- }
- catch(...) { Clear(); return S_FALSE; }
-}
-
-void CInArchive::Clear()
-{
- #ifdef NSIS_SCRIPT
- Script.Empty();
- #endif
- Items.Clear();
- _stream.Release();
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisIn.h
deleted file mode 100644
index 1fa6b4a6d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisIn.h
+++ /dev/null
@@ -1,184 +0,0 @@
-// Archive/NsisIn.h
-
-#ifndef __ARCHIVE_NSIS_IN_H
-#define __ARCHIVE_NSIS_IN_H
-
-#include "Common/Buffer.h"
-#include "Common/IntToString.h"
-#include "Common/MyCom.h"
-#include "Common/StringConvert.h"
-
-#include "../../Common/CreateCoder.h"
-
-#include "../../IStream.h"
-
-#include "NsisDecode.h"
-
-// #define NSIS_SCRIPT
-
-namespace NArchive {
-namespace NNsis {
-
-const int kSignatureSize = 16;
-extern Byte kSignature[kSignatureSize];
-
-const UInt32 kFlagsMask = 0xF;
-namespace NFlags
-{
- const UInt32 kUninstall = 1;
- const UInt32 kSilent = 2;
- const UInt32 kNoCrc = 4;
- const UInt32 kForceCrc = 8;
-}
-
-struct CFirstHeader
-{
- UInt32 Flags;
- UInt32 HeaderLength;
-
- UInt32 ArchiveSize;
-
- bool ThereIsCrc() const
- {
- if ((Flags & NFlags::kForceCrc ) != 0)
- return true;
- return ((Flags & NFlags::kNoCrc) == 0);
- }
-
- UInt32 GetDataSize() const { return ArchiveSize - (ThereIsCrc() ? 4 : 0); }
-};
-
-
-struct CBlockHeader
-{
- UInt32 Offset;
- UInt32 Num;
-};
-
-struct CItem
-{
- AString PrefixA;
- UString PrefixU;
- AString NameA;
- UString NameU;
- FILETIME MTime;
- bool IsUnicode;
- bool UseFilter;
- bool IsCompressed;
- bool SizeIsDefined;
- bool CompressedSizeIsDefined;
- bool EstimatedSizeIsDefined;
- UInt32 Pos;
- UInt32 Size;
- UInt32 CompressedSize;
- UInt32 EstimatedSize;
- UInt32 DictionarySize;
-
- CItem(): IsUnicode(false), UseFilter(false), IsCompressed(true), SizeIsDefined(false),
- CompressedSizeIsDefined(false), EstimatedSizeIsDefined(false), Size(0) {}
-
- bool IsINSTDIR() const
- {
- return (PrefixA.Length() >= 3 || PrefixU.Length() >= 3);
- }
-
- UString GetReducedName(bool unicode) const
- {
- UString s;
- if (unicode)
- s = PrefixU;
- else
- s = MultiByteToUnicodeString(PrefixA);
- if (s.Length() > 0)
- if (s[s.Length() - 1] != L'\\')
- s += L'\\';
- if (unicode)
- s += NameU;
- else
- s += MultiByteToUnicodeString(NameA);
- const int len = 9;
- if (s.Left(len).CompareNoCase(L"$INSTDIR\\") == 0)
- s = s.Mid(len);
- return s;
- }
-};
-
-class CInArchive
-{
- UInt64 _archiveSize;
- CMyComPtr<IInStream> _stream;
-
- Byte ReadByte();
- UInt32 ReadUInt32();
- HRESULT Open2(
- DECL_EXTERNAL_CODECS_LOC_VARS2
- );
- void ReadBlockHeader(CBlockHeader &bh);
- AString ReadStringA(UInt32 pos) const;
- UString ReadStringU(UInt32 pos) const;
- AString ReadString2A(UInt32 pos) const;
- UString ReadString2U(UInt32 pos) const;
- AString ReadString2(UInt32 pos) const;
- AString ReadString2Qw(UInt32 pos) const;
- HRESULT ReadEntries(const CBlockHeader &bh);
- HRESULT Parse();
-
- CByteBuffer _data;
- UInt64 _size;
-
- size_t _posInData;
-
- UInt32 _stringsPos;
-
-
- bool _headerIsCompressed;
- UInt32 _nonSolidStartOffset;
-public:
- HRESULT Open(
- DECL_EXTERNAL_CODECS_LOC_VARS
- IInStream *inStream, const UInt64 *maxCheckStartPosition);
- void Clear();
-
- UInt64 StreamOffset;
- CDecoder Decoder;
- CObjectVector<CItem> Items;
- CFirstHeader FirstHeader;
- NMethodType::EEnum Method;
- UInt32 DictionarySize;
- bool IsSolid;
- bool UseFilter;
- bool FilterFlag;
- bool IsUnicode;
-
- #ifdef NSIS_SCRIPT
- AString Script;
- #endif
- UInt32 GetOffset() const { return IsSolid ? 4 : 0; }
- UInt64 GetDataPos(int index)
- {
- const CItem &item = Items[index];
- return GetOffset() + FirstHeader.HeaderLength + item.Pos;
- }
-
- UInt64 GetPosOfSolidItem(int index) const
- {
- const CItem &item = Items[index];
- return 4 + FirstHeader.HeaderLength + item.Pos;
- }
-
- UInt64 GetPosOfNonSolidItem(int index) const
- {
- const CItem &item = Items[index];
- return StreamOffset + _nonSolidStartOffset + 4 + item.Pos;
- }
-
- void Release()
- {
- Decoder.Release();
- }
-
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisRegister.cpp
deleted file mode 100644
index 7e6f7acbb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Nsis/NsisRegister.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// NsisRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "NsisHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NNsis::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Nsis", 0, 0, 0x9, { 0xEF, 0xBE, 0xAD, 0xDE,
-0x4E, 0x75, 0x6C, 0x6C, 0x73, 0x6F, 0x66, 0x74, 0x49, 0x6E, 0x73, 0x74}, 16, false, CreateArc, 0 };
-
-REGISTER_ARC(Nsis)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/NtfsHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/NtfsHandler.cpp
deleted file mode 100644
index 37847a245..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/NtfsHandler.cpp
+++ /dev/null
@@ -1,1725 +0,0 @@
-// NtfsHandler.cpp
-
-#include "StdAfx.h"
-
-// #define SHOW_DEBUG_INFO
-// #define SHOW_DEBUG_INFO2
-
-#if defined(SHOW_DEBUG_INFO) || defined(SHOW_DEBUG_INFO2)
-#include <stdio.h>
-#endif
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/Buffer.h"
-#include "Common/ComTry.h"
-#include "Common/IntToString.h"
-#include "Common/MyCom.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-
-#include "Common/DummyOutStream.h"
-
-#ifdef SHOW_DEBUG_INFO
-#define PRF(x) x
-#else
-#define PRF(x)
-#endif
-
-#ifdef SHOW_DEBUG_INFO2
-#define PRF2(x) x
-#else
-#define PRF2(x)
-#endif
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-#define Get64(p) GetUi64(p)
-
-#define G16(p, dest) dest = Get16(p);
-#define G32(p, dest) dest = Get32(p);
-#define G64(p, dest) dest = Get64(p);
-
-namespace NArchive {
-namespace Ntfs {
-
-static const UInt32 kNumSysRecs = 16;
-static const UInt32 kRecIndex_Volume = 3;
-static const UInt32 kRecIndex_BadClus = 8;
-
-struct CHeader
-{
- Byte SectorSizeLog;
- Byte ClusterSizeLog;
- // Byte MediaType;
- UInt32 NumHiddenSectors;
- UInt64 NumClusters;
- UInt64 MftCluster;
- UInt64 SerialNumber;
- UInt16 SectorsPerTrack;
- UInt16 NumHeads;
-
- UInt64 GetPhySize() const { return NumClusters << ClusterSizeLog; }
- UInt32 ClusterSize() const { return (UInt32)1 << ClusterSizeLog; }
- bool Parse(const Byte *p);
-};
-
-static int GetLog(UInt32 num)
-{
- for (int i = 0; i < 31; i++)
- if (((UInt32)1 << i) == num)
- return i;
- return -1;
-}
-
-bool CHeader::Parse(const Byte *p)
-{
- if (p[0x1FE] != 0x55 || p[0x1FF] != 0xAA)
- return false;
-
- int codeOffset = 0;
- switch (p[0])
- {
- case 0xE9: codeOffset = 3 + (Int16)Get16(p + 1); break;
- case 0xEB: if (p[2] != 0x90) return false; codeOffset = 2 + (signed char)p[1]; break;
- default: return false;
- }
- Byte sectorsPerClusterLog;
-
- if (memcmp(p + 3, "NTFS ", 8) != 0)
- return false;
- {
- int s = GetLog(Get16(p + 11));
- if (s < 9 || s > 12)
- return false;
- SectorSizeLog = (Byte)s;
- s = GetLog(p[13]);
- if (s < 0)
- return false;
- sectorsPerClusterLog = (Byte)s;
- ClusterSizeLog = SectorSizeLog + sectorsPerClusterLog;
- }
-
- for (int i = 14; i < 21; i++)
- if (p[i] != 0)
- return false;
-
- // MediaType = p[21];
- if (Get16(p + 22) != 0) // NumFatSectors
- return false;
- G16(p + 24, SectorsPerTrack);
- G16(p + 26, NumHeads);
- G32(p + 28, NumHiddenSectors);
- if (Get32(p + 32) != 0) // NumSectors32
- return false;
-
- // DriveNumber = p[0x24];
- if (p[0x25] != 0) // CurrentHead
- return false;
- if (p[0x26] != 0x80) // ExtendedBootSig
- return false;
- if (p[0x27] != 0) // reserved
- return false;
- UInt64 numSectors = Get64(p + 0x28);
- NumClusters = numSectors >> sectorsPerClusterLog;
-
- G64(p + 0x30, MftCluster);
- // G64(p + 0x38, Mft2Cluster);
- G64(p + 0x48, SerialNumber);
- UInt32 numClustersInMftRec;
- UInt32 numClustersInIndexBlock;
- G32(p + 0x40, numClustersInMftRec);
- G32(p + 0x44, numClustersInIndexBlock);
- return (numClustersInMftRec < 256 && numClustersInIndexBlock < 256);
-}
-
-struct CMftRef
-{
- UInt64 Val;
- UInt64 GetIndex() const { return Val & (((UInt64)1 << 48) - 1); }
- UInt16 GetNumber() const { return (UInt16)(Val >> 48); }
- bool IsBaseItself() const { return Val == 0; }
-};
-
-#define ATNAME(n) ATTR_TYPE_ ## n
-#define DEF_ATTR_TYPE(v, n) ATNAME(n) = v
-
-typedef enum
-{
- DEF_ATTR_TYPE(0x00, UNUSED),
- DEF_ATTR_TYPE(0x10, STANDARD_INFO),
- DEF_ATTR_TYPE(0x20, ATTRIBUTE_LIST),
- DEF_ATTR_TYPE(0x30, FILE_NAME),
- DEF_ATTR_TYPE(0x40, OBJECT_ID),
- DEF_ATTR_TYPE(0x50, SECURITY_DESCRIPTOR),
- DEF_ATTR_TYPE(0x60, VOLUME_NAME),
- DEF_ATTR_TYPE(0x70, VOLUME_INFO),
- DEF_ATTR_TYPE(0x80, DATA),
- DEF_ATTR_TYPE(0x90, INDEX_ROOT),
- DEF_ATTR_TYPE(0xA0, INDEX_ALLOCATION),
- DEF_ATTR_TYPE(0xB0, BITMAP),
- DEF_ATTR_TYPE(0xC0, REPARSE_POINT),
- DEF_ATTR_TYPE(0xD0, EA_INFO),
- DEF_ATTR_TYPE(0xE0, EA),
- DEF_ATTR_TYPE(0xF0, PROPERTY_SET),
- DEF_ATTR_TYPE(0x100, LOGGED_UTILITY_STREAM),
- DEF_ATTR_TYPE(0x1000, FIRST_USER_DEFINED_ATTRIBUTE)
-};
-
-static const Byte kFileNameType_Posix = 0;
-static const Byte kFileNameType_Win32 = 1;
-static const Byte kFileNameType_Dos = 2;
-static const Byte kFileNameType_Win32Dos = 3;
-
-struct CFileNameAttr
-{
- CMftRef ParentDirRef;
- // UInt64 CTime;
- // UInt64 MTime;
- // UInt64 ThisRecMTime;
- // UInt64 ATime;
- // UInt64 AllocatedSize;
- // UInt64 DataSize;
- // UInt16 PackedEaSize;
- UString Name;
- UInt32 Attrib;
- Byte NameType;
-
- bool IsDos() const { return NameType == kFileNameType_Dos; }
- bool Parse(const Byte *p, unsigned size);
-};
-
-static void GetString(const Byte *p, unsigned length, UString &res)
-{
- wchar_t *s = res.GetBuffer(length);
- for (unsigned i = 0; i < length; i++)
- s[i] = Get16(p + i * 2);
- s[length] = 0;
- res.ReleaseBuffer();
-}
-
-bool CFileNameAttr::Parse(const Byte *p, unsigned size)
-{
- if (size < 0x42)
- return false;
- G64(p + 0x00, ParentDirRef.Val);
- // G64(p + 0x08, CTime);
- // G64(p + 0x10, MTime);
- // G64(p + 0x18, ThisRecMTime);
- // G64(p + 0x20, ATime);
- // G64(p + 0x28, AllocatedSize);
- // G64(p + 0x30, DataSize);
- G32(p + 0x38, Attrib);
- // G16(p + 0x3C, PackedEaSize);
- NameType = p[0x41];
- unsigned length = p[0x40];
- if (0x42 + length > size)
- return false;
- GetString(p + 0x42, length, Name);
- return true;
-}
-
-struct CSiAttr
-{
- UInt64 CTime;
- UInt64 MTime;
- // UInt64 ThisRecMTime;
- UInt64 ATime;
- UInt32 Attrib;
-
- /*
- UInt32 MaxVersions;
- UInt32 Version;
- UInt32 ClassId;
- UInt32 OwnerId;
- UInt32 SecurityId;
- UInt64 QuotaCharged;
- */
-
- bool Parse(const Byte *p, unsigned size);
-};
-
-bool CSiAttr::Parse(const Byte *p, unsigned size)
-{
- if (size < 0x24)
- return false;
- G64(p + 0x00, CTime);
- G64(p + 0x08, MTime);
- // G64(p + 0x10, ThisRecMTime);
- G64(p + 0x18, ATime);
- G32(p + 0x20, Attrib);
- return true;
-}
-
-static const UInt64 kEmptyExtent = (UInt64)(Int64)-1;
-
-struct CExtent
-{
- UInt64 Virt;
- UInt64 Phy;
-
- bool IsEmpty() const { return Phy == kEmptyExtent; }
-};
-
-struct CVolInfo
-{
- Byte MajorVer;
- Byte MinorVer;
- // UInt16 Flags;
-
- bool Parse(const Byte *p, unsigned size);
-};
-
-bool CVolInfo::Parse(const Byte *p, unsigned size)
-{
- if (size < 12)
- return false;
- MajorVer = p[8];
- MinorVer = p[9];
- // Flags = Get16(p + 10);
- return true;
-}
-
-struct CAttr
-{
- UInt32 Type;
- // UInt32 Length;
- UString Name;
- // UInt16 Flags;
- // UInt16 Instance;
- CByteBuffer Data;
- Byte NonResident;
-
- // Non-Resident
- Byte CompressionUnit;
- UInt64 LowVcn;
- UInt64 HighVcn;
- UInt64 AllocatedSize;
- UInt64 Size;
- UInt64 PackSize;
- UInt64 InitializedSize;
-
- // Resident
- // UInt16 ResidentFlags;
-
- bool IsCompressionUnitSupported() const { return CompressionUnit == 0 || CompressionUnit == 4; }
-
- UInt32 Parse(const Byte *p, unsigned size);
- bool ParseFileName(CFileNameAttr &a) const { return a.Parse(Data, (unsigned)Data.GetCapacity()); }
- bool ParseSi(CSiAttr &a) const { return a.Parse(Data, (unsigned)Data.GetCapacity()); }
- bool ParseVolInfo(CVolInfo &a) const { return a.Parse(Data, (unsigned)Data.GetCapacity()); }
- bool ParseExtents(CRecordVector<CExtent> &extents, UInt64 numClustersMax, int compressionUnit) const;
- UInt64 GetSize() const { return NonResident ? Size : Data.GetCapacity(); }
- UInt64 GetPackSize() const
- {
- if (!NonResident)
- return Data.GetCapacity();
- if (CompressionUnit != 0)
- return PackSize;
- return AllocatedSize;
- }
-};
-
-#define RINOZ(x) { int __tt = (x); if (__tt != 0) return __tt; }
-
-static int CompareAttr(void *const *elem1, void *const *elem2, void *)
-{
- const CAttr &a1 = *(*((const CAttr **)elem1));
- const CAttr &a2 = *(*((const CAttr **)elem2));
- RINOZ(MyCompare(a1.Type, a2.Type));
- RINOZ(MyCompare(a1.Name, a2.Name));
- return MyCompare(a1.LowVcn, a2.LowVcn);
-}
-
-UInt32 CAttr::Parse(const Byte *p, unsigned size)
-{
- if (size < 4)
- return 0;
- G32(p, Type);
- if (Type == 0xFFFFFFFF)
- return 4;
- if (size < 0x18)
- return 0;
- PRF(printf(" T=%2X", Type));
-
- UInt32 length = Get32(p + 0x04);
- PRF(printf(" L=%3d", length));
- if (length > size)
- return 0;
- NonResident = p[0x08];
- {
- int nameLength = p[9];
- UInt32 nameOffset = Get16(p + 0x0A);
- if (nameLength != 0)
- {
- if (nameOffset + nameLength * 2 > length)
- return 0;
- GetString(p + nameOffset, nameLength, Name);
- PRF(printf(" N=%S", Name));
- }
- }
-
- // G16(p + 0x0C, Flags);
- // G16(p + 0x0E, Instance);
- // PRF(printf(" F=%4X", Flags));
- // PRF(printf(" Inst=%d", Instance));
-
- UInt32 dataSize;
- UInt32 offs;
- if (NonResident)
- {
- if (length < 0x40)
- return 0;
- PRF(printf(" NR"));
- G64(p + 0x10, LowVcn);
- G64(p + 0x18, HighVcn);
- G64(p + 0x28, AllocatedSize);
- G64(p + 0x30, Size);
- G64(p + 0x38, InitializedSize);
- G16(p + 0x20, offs);
- CompressionUnit = p[0x22];
-
- PackSize = Size;
- if (CompressionUnit != 0)
- {
- if (length < 0x48)
- return 0;
- G64(p + 0x40, PackSize);
- PRF(printf(" PS=%I64x", PackSize));
- }
-
- // PRF(printf("\n"));
- PRF(printf(" ASize=%4I64d", AllocatedSize));
- PRF(printf(" Size=%I64d", Size));
- PRF(printf(" IS=%I64d", InitializedSize));
- PRF(printf(" Low=%I64d", LowVcn));
- PRF(printf(" High=%I64d", HighVcn));
- PRF(printf(" CU=%d", (int)CompressionUnit));
- dataSize = length - offs;
- }
- else
- {
- if (length < 0x18)
- return 0;
- PRF(printf(" RES"));
- dataSize = Get32(p + 0x10);
- PRF(printf(" dataSize=%3d", dataSize));
- offs = Get16(p + 0x14);
- // G16(p + 0x16, ResidentFlags);
- // PRF(printf(" ResFlags=%4X", ResidentFlags));
- }
- if (offs > length || dataSize > length || length - dataSize < offs)
- return 0;
- Data.SetCapacity(dataSize);
- memcpy(Data, p + offs, dataSize);
- #ifdef SHOW_DEBUG_INFO
- PRF(printf(" : "));
- for (unsigned i = 0; i < Data.GetCapacity(); i++)
- {
- PRF(printf(" %02X", (int)Data[i]));
- }
- #endif
- return length;
-}
-
-bool CAttr::ParseExtents(CRecordVector<CExtent> &extents, UInt64 numClustersMax, int compressionUnit) const
-{
- const Byte *p = Data;
- unsigned size = (unsigned)Data.GetCapacity();
- UInt64 vcn = LowVcn;
- UInt64 lcn = 0;
- UInt64 highVcn1 = HighVcn + 1;
- if (LowVcn != extents.Back().Virt || highVcn1 > (UInt64)1 << 63)
- return false;
-
- extents.DeleteBack();
-
- PRF2(printf("\n# ParseExtents # LowVcn = %4I64X # HighVcn = %4I64X", LowVcn, HighVcn));
-
- while (size > 0)
- {
- Byte b = *p++;
- size--;
- if (b == 0)
- break;
- UInt32 num = b & 0xF;
- if (num == 0 || num > 8 || num > size)
- return false;
-
- int i;
- UInt64 vSize = p[num - 1];
- for (i = (int)num - 2; i >= 0; i--)
- vSize = (vSize << 8) | p[i];
- if (vSize == 0)
- return false;
- p += num;
- size -= num;
- if ((highVcn1 - vcn) < vSize)
- return false;
-
- num = (b >> 4) & 0xF;
- if (num > 8 || num > size)
- return false;
- CExtent e;
- e.Virt = vcn;
- if (num == 0)
- {
- if (compressionUnit == 0)
- return false;
- e.Phy = kEmptyExtent;
- }
- else
- {
- Int64 v = (signed char)p[num - 1];
- for (i = (int)num - 2; i >= 0; i--)
- v = (v << 8) | p[i];
- p += num;
- size -= num;
- lcn += v;
- if (lcn > numClustersMax)
- return false;
- e.Phy = lcn;
- }
- extents.Add(e);
- vcn += vSize;
- }
- CExtent e;
- e.Phy = kEmptyExtent;
- e.Virt = vcn;
- extents.Add(e);
- return (highVcn1 == vcn);
-}
-
-static const UInt64 kEmptyTag = (UInt64)(Int64)-1;
-
-static const int kNumCacheChunksLog = 1;
-static const UInt32 kNumCacheChunks = (1 << kNumCacheChunksLog);
-
-class CInStream:
- public IInStream,
- public CMyUnknownImp
-{
- UInt64 _virtPos;
- UInt64 _physPos;
- UInt64 _curRem;
- bool _sparseMode;
- size_t _compressedPos;
-
- UInt64 _tags[kNumCacheChunks];
- int _chunkSizeLog;
- CByteBuffer _inBuf;
- CByteBuffer _outBuf;
-public:
- CMyComPtr<IInStream> Stream;
- UInt64 Size;
- UInt64 InitializedSize;
- int BlockSizeLog;
- int CompressionUnit;
- bool InUse;
- CRecordVector<CExtent> Extents;
-
- HRESULT SeekToPhys() { return Stream->Seek(_physPos, STREAM_SEEK_SET, NULL); }
-
- UInt32 GetCuSize() const { return (UInt32)1 << (BlockSizeLog + CompressionUnit); }
- HRESULT InitAndSeek(int compressionUnit)
- {
- CompressionUnit = compressionUnit;
- if (compressionUnit != 0)
- {
- UInt32 cuSize = GetCuSize();
- _inBuf.SetCapacity(cuSize);
- _chunkSizeLog = BlockSizeLog + CompressionUnit;
- _outBuf.SetCapacity(kNumCacheChunks << _chunkSizeLog);
- }
- for (int i = 0; i < kNumCacheChunks; i++)
- _tags[i] = kEmptyTag;
-
- _sparseMode = false;
- _curRem = 0;
- _virtPos = 0;
- _physPos = 0;
- const CExtent &e = Extents[0];
- if (!e.IsEmpty())
- _physPos = e.Phy << BlockSizeLog;
- return SeekToPhys();
- }
-
- MY_UNKNOWN_IMP1(IInStream)
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-};
-
-static size_t Lznt1Dec(Byte *dest, size_t outBufLim, size_t destLen, const Byte *src, size_t srcLen)
-{
- size_t destSize = 0;
- while (destSize < destLen)
- {
- if (srcLen < 2 || (destSize & 0xFFF) != 0)
- break;
- UInt32 v = Get16(src);
- if (v == 0)
- break;
- src += 2;
- srcLen -= 2;
- UInt32 comprSize = (v & 0xFFF) + 1;
- if (comprSize > srcLen)
- break;
- srcLen -= comprSize;
- if ((v & 0x8000) == 0)
- {
- if (comprSize != (1 << 12))
- break;
- memcpy(dest + destSize, src, comprSize);
- src += comprSize;
- destSize += comprSize;
- }
- else
- {
- if (destSize + (1 << 12) > outBufLim || (src[0] & 1) != 0)
- return 0;
- int numDistBits = 4;
- UInt32 sbOffset = 0;
- UInt32 pos = 0;
-
- do
- {
- comprSize--;
- for (UInt32 mask = src[pos++] | 0x100; mask > 1 && comprSize > 0; mask >>= 1)
- {
- if ((mask & 1) == 0)
- {
- if (sbOffset >= (1 << 12))
- return 0;
- dest[destSize++] = src[pos++];
- sbOffset++;
- comprSize--;
- }
- else
- {
- if (comprSize < 2)
- return 0;
- UInt32 v = Get16(src + pos);
- pos += 2;
- comprSize -= 2;
-
- while (((sbOffset - 1) >> numDistBits) != 0)
- numDistBits++;
-
- UInt32 len = (v & (0xFFFF >> numDistBits)) + 3;
- if (sbOffset + len > (1 << 12))
- return 0;
- UInt32 dist = (v >> (16 - numDistBits));
- if (dist >= sbOffset)
- return 0;
- Int32 offs = -1 - dist;
- Byte *p = dest + destSize;
- for (UInt32 t = 0; t < len; t++)
- p[t] = p[t + offs];
- destSize += len;
- sbOffset += len;
- }
- }
- }
- while (comprSize > 0);
- src += pos;
- }
- }
- return destSize;
-}
-
-STDMETHODIMP CInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != NULL)
- *processedSize = 0;
- if (_virtPos >= Size)
- return (Size == _virtPos) ? S_OK: E_FAIL;
- if (size == 0)
- return S_OK;
- UInt64 rem = Size - _virtPos;
- if (size > rem)
- size = (UInt32)rem;
- if (_virtPos >= InitializedSize)
- {
- memset((Byte *)data, 0, size);
- _virtPos += size;
- *processedSize = size;
- return S_OK;
- }
- rem = InitializedSize - _virtPos;
- if (size > rem)
- size = (UInt32)rem;
-
- while (_curRem == 0)
- {
- UInt64 cacheTag = _virtPos >> _chunkSizeLog;
- UInt32 cacheIndex = (UInt32)cacheTag & (kNumCacheChunks - 1);
- if (_tags[cacheIndex] == cacheTag)
- {
- UInt32 chunkSize = (UInt32)1 << _chunkSizeLog;
- UInt32 offset = (UInt32)_virtPos & (chunkSize - 1);
- UInt32 cur = MyMin(chunkSize - offset, size);
- memcpy(data, _outBuf + (cacheIndex << _chunkSizeLog) + offset, cur);
- *processedSize = cur;
- _virtPos += cur;
- return S_OK;
- }
-
- PRF2(printf("\nVirtPos = %6d", _virtPos));
-
- UInt32 comprUnitSize = (UInt32)1 << CompressionUnit;
- UInt64 virtBlock = _virtPos >> BlockSizeLog;
- UInt64 virtBlock2 = virtBlock & ~((UInt64)comprUnitSize - 1);
-
- int left = 0, right = Extents.Size();
- for (;;)
- {
- int mid = (left + right) / 2;
- if (mid == left)
- break;
- if (virtBlock2 < Extents[mid].Virt)
- right = mid;
- else
- left = mid;
- }
-
- bool isCompressed = false;
- UInt64 virtBlock2End = virtBlock2 + comprUnitSize;
- if (CompressionUnit != 0)
- for (int i = left; i < Extents.Size(); i++)
- {
- const CExtent &e = Extents[i];
- if (e.Virt >= virtBlock2End)
- break;
- if (e.IsEmpty())
- {
- isCompressed = true;
- break;
- }
- }
-
- int i;
- for (i = left; Extents[i + 1].Virt <= virtBlock; i++);
-
- _sparseMode = false;
- if (!isCompressed)
- {
- const CExtent &e = Extents[i];
- UInt64 newPos = (e.Phy << BlockSizeLog) + _virtPos - (e.Virt << BlockSizeLog);
- if (newPos != _physPos)
- {
- _physPos = newPos;
- RINOK(SeekToPhys());
- }
- UInt64 next = Extents[i + 1].Virt;
- if (next > virtBlock2End)
- next &= ~((UInt64)comprUnitSize - 1);
- next <<= BlockSizeLog;
- if (next > Size)
- next = Size;
- _curRem = next - _virtPos;
- break;
- }
- bool thereArePhy = false;
- for (int i2 = left; i2 < Extents.Size(); i2++)
- {
- const CExtent &e = Extents[i2];
- if (e.Virt >= virtBlock2End)
- break;
- if (!e.IsEmpty())
- {
- thereArePhy = true;
- break;
- }
- }
- if (!thereArePhy)
- {
- _curRem = (Extents[i + 1].Virt << BlockSizeLog) - _virtPos;
- _sparseMode = true;
- break;
- }
-
- size_t offs = 0;
- UInt64 curVirt = virtBlock2;
- for (i = left; i < Extents.Size(); i++)
- {
- const CExtent &e = Extents[i];
- if (e.IsEmpty())
- break;
- if (e.Virt >= virtBlock2End)
- return S_FALSE;
- UInt64 newPos = (e.Phy + (curVirt - e.Virt)) << BlockSizeLog;
- if (newPos != _physPos)
- {
- _physPos = newPos;
- RINOK(SeekToPhys());
- }
- UInt64 numChunks = Extents[i + 1].Virt - curVirt;
- if (curVirt + numChunks > virtBlock2End)
- numChunks = virtBlock2End - curVirt;
- size_t compressed = (size_t)numChunks << BlockSizeLog;
- RINOK(ReadStream_FALSE(Stream, _inBuf + offs, compressed));
- curVirt += numChunks;
- _physPos += compressed;
- offs += compressed;
- }
- size_t destLenMax = GetCuSize();
- size_t destLen = destLenMax;
- UInt64 rem = Size - (virtBlock2 << BlockSizeLog);
- if (destLen > rem)
- destLen = (size_t)rem;
-
- Byte *dest = _outBuf + (cacheIndex << _chunkSizeLog);
- size_t destSizeRes = Lznt1Dec(dest, destLenMax, destLen, _inBuf, offs);
- _tags[cacheIndex] = cacheTag;
-
- // some files in Vista have destSize > destLen
- if (destSizeRes < destLen)
- {
- memset(dest, 0, destLenMax);
- if (InUse)
- return S_FALSE;
- }
- }
- if (size > _curRem)
- size = (UInt32)_curRem;
- HRESULT res = S_OK;
- if (_sparseMode)
- memset(data, 0, size);
- else
- {
- res = Stream->Read(data, size, &size);
- _physPos += size;
- }
- if (processedSize != NULL)
- *processedSize = size;
- _virtPos += size;
- _curRem -= size;
- return res;
-}
-
-STDMETHODIMP CInStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
- UInt64 newVirtPos = offset;
- switch(seekOrigin)
- {
- case STREAM_SEEK_SET: break;
- case STREAM_SEEK_CUR: newVirtPos += _virtPos; break;
- case STREAM_SEEK_END: newVirtPos += Size; break;
- default: return STG_E_INVALIDFUNCTION;
- }
- if (_virtPos != newVirtPos)
- _curRem = 0;
- _virtPos = newVirtPos;
- if (newPosition)
- *newPosition = newVirtPos;
- return S_OK;
-}
-
-class CByteBufStream:
- public IInStream,
- public CMyUnknownImp
-{
- UInt64 _virtPos;
-public:
- CByteBuffer Buf;
- void Init() { _virtPos = 0; }
-
- MY_UNKNOWN_IMP1(IInStream)
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-};
-
-STDMETHODIMP CByteBufStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != NULL)
- *processedSize = 0;
- if (_virtPos >= Buf.GetCapacity())
- return (_virtPos == Buf.GetCapacity()) ? S_OK: E_FAIL;
- UInt64 rem = Buf.GetCapacity() - _virtPos;
- if (rem < size)
- size = (UInt32)rem;
- memcpy(data, Buf + (size_t)_virtPos, size);
- if (processedSize != NULL)
- *processedSize = size;
- _virtPos += size;
- return S_OK;
-}
-
-STDMETHODIMP CByteBufStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
- switch(seekOrigin)
- {
- case STREAM_SEEK_SET: _virtPos = offset; break;
- case STREAM_SEEK_CUR: _virtPos += offset; break;
- case STREAM_SEEK_END: _virtPos = Buf.GetCapacity() + offset; break;
- default: return STG_E_INVALIDFUNCTION;
- }
- if (newPosition)
- *newPosition = _virtPos;
- return S_OK;
-}
-
-HRESULT DataParseExtents(int clusterSizeLog, const CObjectVector<CAttr> attrs,
- int attrIndex, int attrIndexLim, UInt64 numPhysClusters, CRecordVector<CExtent> &Extents)
-{
- CExtent e;
- e.Virt = 0;
- e.Phy = kEmptyExtent;
- Extents.Add(e);
- const CAttr &attr0 = attrs[attrIndex];
-
- if (attr0.AllocatedSize < attr0.Size ||
- (attrs[attrIndexLim - 1].HighVcn + 1) != (attr0.AllocatedSize >> clusterSizeLog) ||
- (attr0.AllocatedSize & ((1 << clusterSizeLog) - 1)) != 0)
- return S_FALSE;
-
- for (int i = attrIndex; i < attrIndexLim; i++)
- if (!attrs[i].ParseExtents(Extents, numPhysClusters, attr0.CompressionUnit))
- return S_FALSE;
-
- UInt64 packSizeCalc = 0;
- for (int k = 0; k < Extents.Size(); k++)
- {
- CExtent &e = Extents[k];
- if (!e.IsEmpty())
- packSizeCalc += (Extents[k + 1].Virt - e.Virt) << clusterSizeLog;
- PRF2(printf("\nSize = %4I64X", Extents[k + 1].Virt - e.Virt));
- PRF2(printf(" Pos = %4I64X", e.Phy));
- }
-
- if (attr0.CompressionUnit != 0)
- {
- if (packSizeCalc != attr0.PackSize)
- return S_FALSE;
- }
- else
- {
- if (packSizeCalc != attr0.AllocatedSize)
- return S_FALSE;
- }
- return S_OK;
-}
-
-struct CDataRef
-{
- int Start;
- int Num;
-};
-
-struct CMftRec
-{
- UInt32 Magic;
- // UInt64 Lsn;
- UInt16 SeqNumber;
- UInt16 Flags;
- // UInt16 LinkCount;
- // UInt16 NextAttrInstance;
- CMftRef BaseMftRef;
- // UInt32 ThisRecNumber;
- UInt32 MyNumNameLinks;
-
- CObjectVector<CAttr> DataAttrs;
- CObjectVector<CFileNameAttr> FileNames;
- CRecordVector<CDataRef> DataRefs;
-
- CSiAttr SiAttr;
-
-
- void MoveAttrsFrom(CMftRec &src)
- {
- DataAttrs += src.DataAttrs;
- FileNames += src.FileNames;
- src.DataAttrs.ClearAndFree();
- src.FileNames.ClearAndFree();
- }
-
- UInt64 GetPackSize() const
- {
- UInt64 res = 0;
- for (int i = 0; i < DataRefs.Size(); i++)
- res += DataAttrs[DataRefs[i].Start].GetPackSize();
- return res;
- }
-
- bool Parse(Byte *p, int sectorSizeLog, UInt32 numSectors, UInt32 recNumber, CObjectVector<CAttr> *attrs);
-
- bool IsEmpty() const { return (Magic <= 2); }
-
- bool InUse() const { return (Flags & 1) != 0; }
- bool IsDir() const { return (Flags & 2) != 0; }
-
- void ParseDataNames();
- HRESULT GetStream(IInStream *mainStream, int dataIndex,
- int clusterSizeLog, UInt64 numPhysClusters, IInStream **stream) const;
-
- UInt64 GetSize(int dataIndex) const { return DataAttrs[DataRefs[dataIndex].Start].GetSize(); }
-
- CMftRec(): MyNumNameLinks(0) {}
-};
-
-void CMftRec::ParseDataNames()
-{
- DataRefs.Clear();
- DataAttrs.Sort(CompareAttr, 0);
-
- for (int i = 0; i < DataAttrs.Size();)
- {
- CDataRef ref;
- ref.Start = i;
- for (i++; i < DataAttrs.Size(); i++)
- if (DataAttrs[ref.Start].Name != DataAttrs[i].Name)
- break;
- ref.Num = i - ref.Start;
- DataRefs.Add(ref);
- }
-}
-
-HRESULT CMftRec::GetStream(IInStream *mainStream, int dataIndex,
- int clusterSizeLog, UInt64 numPhysClusters, IInStream **destStream) const
-{
- *destStream = 0;
- CByteBufStream *streamSpec = new CByteBufStream;
- CMyComPtr<IInStream> streamTemp = streamSpec;
-
- if (dataIndex < 0)
- return E_FAIL;
-
- if (dataIndex < DataRefs.Size())
- {
- const CDataRef &ref = DataRefs[dataIndex];
- int numNonResident = 0;
- int i;
- for (i = ref.Start; i < ref.Start + ref.Num; i++)
- if (DataAttrs[i].NonResident)
- numNonResident++;
-
- const CAttr &attr0 = DataAttrs[ref.Start];
-
- if (numNonResident != 0 || ref.Num != 1)
- {
- if (numNonResident != ref.Num || !attr0.IsCompressionUnitSupported())
- return S_FALSE;
- CInStream *streamSpec = new CInStream;
- CMyComPtr<IInStream> streamTemp = streamSpec;
- RINOK(DataParseExtents(clusterSizeLog, DataAttrs, ref.Start, ref.Start + ref.Num, numPhysClusters, streamSpec->Extents));
- streamSpec->Size = attr0.Size;
- streamSpec->InitializedSize = attr0.InitializedSize;
- streamSpec->Stream = mainStream;
- streamSpec->BlockSizeLog = clusterSizeLog;
- streamSpec->InUse = InUse();
- RINOK(streamSpec->InitAndSeek(attr0.CompressionUnit));
- *destStream = streamTemp.Detach();
- return S_OK;
- }
- streamSpec->Buf = attr0.Data;
- }
- streamSpec->Init();
- *destStream = streamTemp.Detach();
- return S_OK;
-}
-
-bool CMftRec::Parse(Byte *p, int sectorSizeLog, UInt32 numSectors, UInt32 recNumber,
- CObjectVector<CAttr> *attrs)
-{
- G32(p, Magic);
- if (IsEmpty())
- return true;
- if (Magic != 0x454c4946)
- return false;
-
- UInt32 usaOffset;
- UInt32 numUsaItems;
- G16(p + 0x04, usaOffset);
- G16(p + 0x06, numUsaItems);
-
- if ((usaOffset & 1) != 0 || usaOffset + numUsaItems * 2 > ((UInt32)1 << sectorSizeLog) - 2 ||
- numUsaItems == 0 || numUsaItems - 1 != numSectors)
- return false;
-
- UInt16 usn = Get16(p + usaOffset);
- // PRF(printf("\nusn = %d", usn));
- for (UInt32 i = 1; i < numUsaItems; i++)
- {
- void *pp = p + (i << sectorSizeLog) - 2;
- if (Get16(pp) != usn)
- return false;
- SetUi16(pp, Get16(p + usaOffset + i * 2));
- }
-
- // G64(p + 0x08, Lsn);
- G16(p + 0x10, SeqNumber);
- // G16(p + 0x12, LinkCount);
- // PRF(printf(" L=%d", LinkCount));
- UInt32 attrOffs = Get16(p + 0x14);
- G16(p + 0x16, Flags);
- PRF(printf(" F=%4X", Flags));
-
- UInt32 bytesInUse = Get32(p + 0x18);
- UInt32 bytesAlloc = Get32(p + 0x1C);
- G64(p + 0x20, BaseMftRef.Val);
- if (BaseMftRef.Val != 0)
- {
- PRF(printf(" BaseRef=%d", (int)BaseMftRef.Val));
- // return false; // Check it;
- }
- // G16(p + 0x28, NextAttrInstance);
- if (usaOffset >= 0x30)
- if (Get32(p + 0x2C) != recNumber) // NTFS 3.1+
- return false;
-
- UInt32 limit = numSectors << sectorSizeLog;
- if (attrOffs >= limit || (attrOffs & 7) != 0 || bytesInUse > limit
- || bytesAlloc != limit)
- return false;
-
-
- for (UInt32 t = attrOffs; t < limit;)
- {
- CAttr attr;
- // PRF(printf("\n %2d:", Attrs.Size()));
- PRF(printf("\n"));
- UInt32 length = attr.Parse(p + t, limit - t);
- if (length == 0 || limit - t < length)
- return false;
- t += length;
- if (attr.Type == 0xFFFFFFFF)
- break;
- switch(attr.Type)
- {
- case ATTR_TYPE_FILE_NAME:
- {
- CFileNameAttr fna;
- if (!attr.ParseFileName(fna))
- return false;
- FileNames.Add(fna);
- PRF(printf(" flags = %4x", (int)fna.NameType));
- PRF(printf("\n %S", fna.Name));
- break;
- }
- case ATTR_TYPE_STANDARD_INFO:
- if (!attr.ParseSi(SiAttr))
- return false;
- break;
- case ATTR_TYPE_DATA:
- DataAttrs.Add(attr);
- break;
- default:
- if (attrs)
- attrs->Add(attr);
- break;
- }
- }
-
- return true;
-}
-
-struct CItem
-{
- int RecIndex;
- int DataIndex;
- CMftRef ParentRef;
- UString Name;
- UInt32 Attrib;
-
- bool IsDir() const { return (DataIndex < 0); }
-};
-
-struct CDatabase
-{
- CHeader Header;
- CObjectVector<CItem> Items;
- CObjectVector<CMftRec> Recs;
- CMyComPtr<IInStream> InStream;
- IArchiveOpenCallback *OpenCallback;
-
- CByteBuffer ByteBuf;
-
- CObjectVector<CAttr> VolAttrs;
-
- ~CDatabase() { ClearAndClose(); }
-
- void Clear();
- void ClearAndClose();
-
- UString GetItemPath(Int32 index) const;
- HRESULT Open();
- HRESULT ReadDir(Int32 parent, UInt32 cluster, int level);
-
- HRESULT SeekToCluster(UInt64 cluster);
-
- int FindMtfRec(const CMftRef &ref) const
- {
- UInt64 val = ref.GetIndex();
- int left = 0, right = Items.Size();
- while (left != right)
- {
- int mid = (left + right) / 2;
- UInt64 midValue = Items[mid].RecIndex;
- if (val == midValue)
- return mid;
- if (val < midValue)
- right = mid;
- else
- left = mid + 1;
- }
- return -1;
- }
-
-};
-
-HRESULT CDatabase::SeekToCluster(UInt64 cluster)
-{
- return InStream->Seek(cluster << Header.ClusterSizeLog, STREAM_SEEK_SET, NULL);
-}
-
-void CDatabase::Clear()
-{
- Items.Clear();
- Recs.Clear();
-}
-
-void CDatabase::ClearAndClose()
-{
- Clear();
- InStream.Release();
-}
-
-#define MY_DIR_PREFIX(x) L"[" x L"]" WSTRING_PATH_SEPARATOR
-
-UString CDatabase::GetItemPath(Int32 index) const
-{
- const CItem *item = &Items[index];
- UString name = item->Name;
- for (int j = 0; j < 256; j++)
- {
- CMftRef ref = item->ParentRef;
- index = FindMtfRec(ref);
- if (ref.GetIndex() == 5)
- return name;
- if (index < 0 || Recs[Items[index].RecIndex].SeqNumber != ref.GetNumber())
- return MY_DIR_PREFIX(L"UNKNOWN") + name;
- item = &Items[index];
- name = item->Name + WCHAR_PATH_SEPARATOR + name;
- }
- return MY_DIR_PREFIX(L"BAD") + name;
-}
-
-HRESULT CDatabase::Open()
-{
- Clear();
-
- static const UInt32 kHeaderSize = 512;
- Byte buf[kHeaderSize];
- RINOK(ReadStream_FALSE(InStream, buf, kHeaderSize));
- if (!Header.Parse(buf))
- return S_FALSE;
- UInt64 fileSize;
- RINOK(InStream->Seek(0, STREAM_SEEK_END, &fileSize));
- if (fileSize < Header.GetPhySize())
- return S_FALSE;
-
- SeekToCluster(Header.MftCluster);
-
- CMftRec mftRec;
- UInt32 numSectorsInRec;
- int recSizeLog;
- CMyComPtr<IInStream> mftStream;
- {
- UInt32 blockSize = 1 << 12;
- ByteBuf.SetCapacity(blockSize);
- RINOK(ReadStream_FALSE(InStream, ByteBuf, blockSize));
-
- UInt32 allocSize = Get32(ByteBuf + 0x1C);
- recSizeLog = GetLog(allocSize);
- if (recSizeLog < Header.SectorSizeLog)
- return false;
- numSectorsInRec = 1 << (recSizeLog - Header.SectorSizeLog);
- if (!mftRec.Parse(ByteBuf, Header.SectorSizeLog, numSectorsInRec, NULL, 0))
- return S_FALSE;
- if (mftRec.IsEmpty())
- return S_FALSE;
- mftRec.ParseDataNames();
- if (mftRec.DataRefs.IsEmpty())
- return S_FALSE;
- RINOK(mftRec.GetStream(InStream, 0, Header.ClusterSizeLog, Header.NumClusters, &mftStream));
- if (!mftStream)
- return S_FALSE;
- }
-
- UInt64 mftSize = mftRec.DataAttrs[0].Size;
- if ((mftSize >> 4) > Header.GetPhySize())
- return S_FALSE;
-
- UInt64 numFiles = mftSize >> recSizeLog;
- if (numFiles > (1 << 30))
- return S_FALSE;
- if (OpenCallback)
- {
- RINOK(OpenCallback->SetTotal(&numFiles, &mftSize));
- }
- const UInt32 kBufSize = (1 << 15);
- if (kBufSize < (1 << recSizeLog))
- return S_FALSE;
-
- ByteBuf.SetCapacity((size_t)kBufSize);
- Recs.Reserve((int)numFiles);
- for (UInt64 pos64 = 0;;)
- {
- if (OpenCallback)
- {
- // Sleep(0);
- UInt64 numFiles = Recs.Size();
- RINOK(OpenCallback->SetCompleted(&numFiles, &pos64));
- }
- UInt32 readSize = kBufSize;
- UInt64 rem = mftSize - pos64;
- if (readSize > rem)
- readSize = (UInt32)rem;
- if (readSize < ((UInt32)1 << recSizeLog))
- break;
- RINOK(ReadStream_FALSE(mftStream, ByteBuf, (size_t)readSize));
- pos64 += readSize;
- for (int i = 0; ((UInt32)(i + 1) << recSizeLog) <= readSize; i++)
- {
- PRF(printf("\n---------------------"));
- PRF(printf("\n%5d:", Recs.Size()));
- Byte *p = ByteBuf + ((UInt32)i << recSizeLog);
- CMftRec rec;
- if (!rec.Parse(p, Header.SectorSizeLog, numSectorsInRec, (UInt32)Recs.Size(),
- (Recs.Size() == kRecIndex_Volume) ? &VolAttrs: NULL))
- return S_FALSE;
- Recs.Add(rec);
- }
- }
-
- int i;
- for (i = 0; i < Recs.Size(); i++)
- {
- CMftRec &rec = Recs[i];
- if (!rec.BaseMftRef.IsBaseItself())
- {
- UInt64 refIndex = rec.BaseMftRef.GetIndex();
- if (refIndex > (UInt32)Recs.Size())
- return S_FALSE;
- CMftRec &refRec = Recs[(int)refIndex];
- bool moveAttrs = (refRec.SeqNumber == rec.BaseMftRef.GetNumber() && refRec.BaseMftRef.IsBaseItself());
- if (rec.InUse() && refRec.InUse())
- {
- if (!moveAttrs)
- return S_FALSE;
- }
- else if (rec.InUse() || refRec.InUse())
- moveAttrs = false;
- if (moveAttrs)
- refRec.MoveAttrsFrom(rec);
- }
- }
-
- for (i = 0; i < Recs.Size(); i++)
- Recs[i].ParseDataNames();
-
- for (i = 0; i < Recs.Size(); i++)
- {
- CMftRec &rec = Recs[i];
- if (rec.IsEmpty() || !rec.BaseMftRef.IsBaseItself())
- continue;
- int numNames = 0;
- // printf("\n%4d: ", i);
- for (int t = 0; t < rec.FileNames.Size(); t++)
- {
- const CFileNameAttr &fna = rec.FileNames[t];
- // printf("%4d %S | ", (int)fna.NameType, fna.Name);
- if (fna.IsDos())
- continue;
- int numDatas = rec.DataRefs.Size();
-
- // For hard linked files we show substreams only for first Name.
- if (numDatas > 1 && numNames > 0)
- numDatas = 1;
- numNames++;
-
- if (rec.IsDir())
- {
- CItem item;
- item.Name = fna.Name;
- item.RecIndex = i;
- item.DataIndex = -1;
- item.ParentRef = fna.ParentDirRef;
- item.Attrib = rec.SiAttr.Attrib | 0x10;
- // item.Attrib = fna.Attrib;
- Items.Add(item);
- }
- for (int di = 0; di < numDatas; di++)
- {
- CItem item;
- item.Name = fna.Name;
- item.Attrib = rec.SiAttr.Attrib;
- const UString &subName = rec.DataAttrs[rec.DataRefs[di].Start].Name;
- if (!subName.IsEmpty())
- {
- // $BadClus:$Bad is sparse file for all clusters. So we skip it.
- if (i == kRecIndex_BadClus && subName == L"$Bad")
- continue;
- item.Name += L":";
- item.Name += subName;
- item.Attrib = fna.Attrib;
- }
-
- PRF(printf("\n%3d", i));
- PRF(printf(" attrib=%2x", rec.SiAttr.Attrib));
- PRF(printf(" %S", item.Name));
-
- item.RecIndex = i;
- item.DataIndex = di;
- item.ParentRef = fna.ParentDirRef;
-
- Items.Add(item);
- rec.MyNumNameLinks++;
- }
- }
- rec.FileNames.ClearAndFree();
- }
-
- return S_OK;
-}
-
-class CHandler:
- public IInArchive,
- public IInArchiveGetStream,
- public CMyUnknownImp,
- CDatabase
-{
-public:
- MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
- INTERFACE_IInArchive(;)
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-};
-
-STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
-{
- COM_TRY_BEGIN
- IInStream *stream2;
- const CItem &item = Items[index];
- const CMftRec &rec = Recs[item.RecIndex];
- HRESULT res = rec.GetStream(InStream, item.DataIndex, Header.ClusterSizeLog, Header.NumClusters, &stream2);
- *stream = (ISequentialInStream *)stream2;
- return res;
- COM_TRY_END
-}
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidATime, VT_FILETIME},
- { NULL, kpidAttrib, VT_UI4},
- { NULL, kpidLinks, VT_UI4}
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidVolumeName, VT_BSTR},
- { NULL, kpidFileSystem, VT_BSTR},
- { NULL, kpidClusterSize, VT_UI4},
- { NULL, kpidPhySize, VT_UI8},
- { NULL, kpidHeadersSize, VT_UI8},
- { NULL, kpidCTime, VT_FILETIME},
-
- { NULL, kpidSectorSize, VT_UI4},
- { NULL, kpidId, VT_UI8}
- // { NULL, kpidSectorsPerTrack, VT_UI4},
- // { NULL, kpidNumHeads, VT_UI4},
- // { NULL, kpidHiddenSectors, VT_UI4}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-static void NtfsTimeToProp(UInt64 t, NWindows::NCOM::CPropVariant &prop)
-{
- FILETIME ft;
- ft.dwLowDateTime = (DWORD)t;
- ft.dwHighDateTime = (DWORD)(t >> 32);
- prop = ft;
-}
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
-
- const CMftRec *volRec = (Recs.Size() > kRecIndex_Volume ? &Recs[kRecIndex_Volume] : NULL);
-
- switch(propID)
- {
- case kpidClusterSize: prop = Header.ClusterSize(); break;
- case kpidPhySize: prop = Header.GetPhySize(); break;
- /*
- case kpidHeadersSize:
- {
- UInt64 val = 0;
- for (int i = 0; i < kNumSysRecs; i++)
- {
- printf("\n%2d: %8I64d ", i, Recs[i].GetPackSize());
- if (i == 8)
- i = i
- val += Recs[i].GetPackSize();
- }
- prop = val;
- break;
- }
- */
- case kpidCTime: if (volRec) NtfsTimeToProp(volRec->SiAttr.CTime, prop); break;break;
- case kpidVolumeName:
- {
- for (int i = 0; i < VolAttrs.Size(); i++)
- {
- const CAttr &attr = VolAttrs[i];
- if (attr.Type == ATTR_TYPE_VOLUME_NAME)
- {
- UString name;
- GetString(attr.Data, (int)attr.Data.GetCapacity() / 2, name);
- prop = name;
- break;
- }
- }
- break;
- }
- case kpidFileSystem:
- {
- AString s = "NTFS";
- for (int i = 0; i < VolAttrs.Size(); i++)
- {
- const CAttr &attr = VolAttrs[i];
- if (attr.Type == ATTR_TYPE_VOLUME_INFO)
- {
- CVolInfo vi;
- if (attr.ParseVolInfo(vi))
- {
- s += ' ';
- char temp[16];
- ConvertUInt32ToString(vi.MajorVer, temp);
- s += temp;
- s += '.';
- ConvertUInt32ToString(vi.MinorVer, temp);
- s += temp;
- }
- break;
- }
- }
- prop = s;
- break;
- }
- case kpidSectorSize: prop = (UInt32)1 << Header.SectorSizeLog; break;
- case kpidId: prop = Header.SerialNumber; break;
- // case kpidMediaType: prop = Header.MediaType; break;
- // case kpidSectorsPerTrack: prop = Header.SectorsPerTrack; break;
- // case kpidNumHeads: prop = Header.NumHeads; break;
- // case kpidHiddenSectors: prop = Header.NumHiddenSectors; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- const CItem &item = Items[index];
- const CMftRec &rec = Recs[item.RecIndex];
-
- const CAttr *data= NULL;
- if (item.DataIndex >= 0)
- data = &rec.DataAttrs[rec.DataRefs[item.DataIndex].Start];
-
- switch(propID)
- {
- case kpidPath:
- {
- UString name = GetItemPath(index);
- const wchar_t *prefix = NULL;
- if (!rec.InUse())
- prefix = MY_DIR_PREFIX(L"DELETED");
- else if (item.RecIndex < kNumSysRecs)
- prefix = MY_DIR_PREFIX(L"SYSTEM");
- if (prefix)
- name = prefix + name;
- prop = name;
- break;
- }
-
- case kpidIsDir: prop = item.IsDir(); break;
- case kpidMTime: NtfsTimeToProp(rec.SiAttr.MTime, prop); break;
-
- case kpidCTime: NtfsTimeToProp(rec.SiAttr.CTime, prop); break;
- case kpidATime: NtfsTimeToProp(rec.SiAttr.ATime, prop); break;
- case kpidAttrib:
- prop = item.Attrib;
- break;
- case kpidLinks: prop = rec.MyNumNameLinks; break;
- case kpidSize: if (data) prop = data->GetSize(); break;
- case kpidPackSize: if (data) prop = data->GetPackSize(); break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 *, IArchiveOpenCallback *callback)
-{
- COM_TRY_BEGIN
- {
- OpenCallback = callback;
- InStream = stream;
- HRESULT res;
- try
- {
- res = CDatabase::Open();
- if (res == S_OK)
- return S_OK;
- }
- catch(...)
- {
- Close();
- throw;
- }
- Close();
- return res;
- }
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- ClearAndClose();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = Items.Size();
- if (numItems == 0)
- return S_OK;
- UInt32 i;
- UInt64 totalSize = 0;
- for (i = 0; i < numItems; i++)
- {
- const CItem &item = Items[allFilesMode ? i : indices[i]];
- const CMftRec &rec = Recs[item.RecIndex];
- if (!rec.IsDir())
- totalSize += rec.GetSize(item.DataIndex);
- }
- RINOK(extractCallback->SetTotal(totalSize));
-
- UInt64 totalPackSize;
- totalSize = totalPackSize = 0;
-
- CByteBuffer buf;
- UInt32 clusterSize = Header.ClusterSize();
- buf.SetCapacity(clusterSize);
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CDummyOutStream *outStreamSpec = new CDummyOutStream;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
-
- for (i = 0; i < numItems; i++)
- {
- lps->InSize = totalPackSize;
- lps->OutSize = totalSize;
- RINOK(lps->SetCur());
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- Int32 index = allFilesMode ? i : indices[i];
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
- const CItem &item = Items[index];
- if (item.IsDir())
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
-
- if (!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
-
- outStreamSpec->SetStream(realOutStream);
- realOutStream.Release();
- outStreamSpec->Init();
-
- const CMftRec &rec = Recs[item.RecIndex];
- const CAttr &data = rec.DataAttrs[rec.DataRefs[item.DataIndex].Start];
-
- int res = NArchive::NExtract::NOperationResult::kDataError;
- {
- CMyComPtr<IInStream> inStream;
- HRESULT hres = rec.GetStream(InStream, item.DataIndex, Header.ClusterSizeLog, Header.NumClusters, &inStream);
- if (hres == S_FALSE)
- res = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- else
- {
- RINOK(hres);
- if (inStream)
- {
- HRESULT hres = copyCoder->Code(inStream, outStream, NULL, NULL, progress);
- if (hres != S_OK && hres != S_FALSE)
- {
- RINOK(hres);
- }
- if (/* copyCoderSpec->TotalSize == item.GetSize() && */ hres == S_OK)
- res = NArchive::NExtract::NOperationResult::kOK;
- }
- }
- }
- totalPackSize += data.GetPackSize();
- totalSize += data.GetSize();
- outStreamSpec->ReleaseStream();
- RINOK(extractCallback->SetOperationResult(res));
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = Items.Size();
- return S_OK;
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"NTFS", L"ntfs img", 0, 0xD9, { 'N', 'T', 'F', 'S', ' ', ' ', ' ', ' ', 0 }, 9, false, CreateArc, 0 };
-
-REGISTER_ARC(Fat)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/PeHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/PeHandler.cpp
deleted file mode 100644
index a1304ae45..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/PeHandler.cpp
+++ /dev/null
@@ -1,912 +0,0 @@
-// PeHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/Buffer.h"
-#include "Common/ComTry.h"
-#include "Common/IntToString.h"
-
-#include "Windows/PropVariantUtils.h"
-#include "Windows/Time.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-#define Get64(p) GetUi64(p)
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NPe {
-
-#define NUM_SCAN_SECTIONS_MAX (1 << 6)
-
-#define PE_SIG 0x00004550
-#define PE_OptHeader_Magic_32 0x10B
-#define PE_OptHeader_Magic_64 0x20B
-
-static AString GetDecString(UInt32 v)
-{
- char sz[32];
- ConvertUInt64ToString(v, sz);
- return sz;
-}
-
-struct CVersion
-{
- UInt16 Major;
- UInt16 Minor;
-
- void Parse(const Byte *buf);
- AString GetString() const { return GetDecString(Major) + '.' + GetDecString(Minor); }
-};
-
-void CVersion::Parse(const Byte *p)
-{
- Major = Get16(p);
- Minor = Get16(p + 2);
-}
-
-static const UInt32 kHeaderSize = 4 + 20;
-
-struct CHeader
-{
- UInt16 NumSections;
- UInt32 Time;
- UInt32 PointerToSymbolTable;
- UInt32 NumSymbols;
- UInt16 OptHeaderSize;
- UInt16 Flags;
- UInt16 Machine;
-
- bool Parse(const Byte *buf);
-};
-
-bool CHeader::Parse(const Byte *p)
-{
- if (Get32(p) != PE_SIG)
- return false;
- p += 4;
- Machine = Get16(p + 0);
- NumSections = Get16(p + 2);
- Time = Get32(p + 4);
- PointerToSymbolTable = Get32(p + 8);
- NumSymbols = Get32(p + 12);
- OptHeaderSize = Get16(p + 16);
- Flags = Get16(p + 18);
- return true;
-}
-
-struct CDirLink
-{
- UInt32 Va;
- UInt32 Size;
- void Parse(const Byte *p);
-};
-
-void CDirLink::Parse(const Byte *p)
-{
- Va = Get32(p);
- Size = Get32(p + 4);
-};
-
-enum
-{
- kDirLink_Certificate = 4,
- kDirLink_Debug = 6
-};
-
-struct CDebugEntry
-{
- UInt32 Flags;
- UInt32 Time;
- CVersion Ver;
- UInt32 Type;
- UInt32 Size;
- UInt32 Va;
- UInt32 Pa;
-
- void Parse(const Byte *p);
-};
-
-void CDebugEntry::Parse(const Byte *p)
-{
- Flags = Get32(p);
- Time = Get32(p + 4);
- Ver.Parse(p + 8);
- Type = Get32(p + 12);
- Size = Get32(p + 16);
- Va = Get32(p + 20);
- Pa = Get32(p + 24);
-}
-
-static const UInt32 kNumDirItemsMax = 16;
-
-struct COptHeader
-{
- UInt16 Magic;
- Byte LinkerVerMajor;
- Byte LinkerVerMinor;
-
- UInt32 CodeSize;
- UInt32 InitDataSize;
- UInt32 UninitDataSize;
-
- // UInt32 AddressOfEntryPoint;
- // UInt32 BaseOfCode;
- // UInt32 BaseOfData32;
- // UInt64 ImageBase;
-
- UInt32 SectAlign;
- UInt32 FileAlign;
-
- CVersion OsVer;
- CVersion ImageVer;
- CVersion SubsysVer;
-
- UInt32 ImageSize;
- UInt32 HeadersSize;
- UInt32 CheckSum;
- UInt16 SubSystem;
- UInt16 DllCharacts;
-
- UInt64 StackReserve;
- UInt64 StackCommit;
- UInt64 HeapReserve;
- UInt64 HeapCommit;
-
- UInt32 NumDirItems;
- CDirLink DirItems[kNumDirItemsMax];
-
- bool Is64Bit() const { return Magic == PE_OptHeader_Magic_64; }
- bool Parse(const Byte *p, UInt32 size);
-};
-
-bool COptHeader::Parse(const Byte *p, UInt32 size)
-{
- Magic = Get16(p);
- switch (Magic)
- {
- case PE_OptHeader_Magic_32:
- case PE_OptHeader_Magic_64:
- break;
- default:
- return false;
- }
- LinkerVerMajor = p[2];
- LinkerVerMinor = p[3];
-
- bool hdr64 = Is64Bit();
-
- CodeSize = Get32(p + 4);
- InitDataSize = Get32(p + 8);
- UninitDataSize = Get32(p + 12);
-
- // AddressOfEntryPoint = Get32(p + 16);
- // BaseOfCode = Get32(p + 20);
- // BaseOfData32 = Get32(p + 24);
- // ImageBase = hdr64 ? GetUi64(p + 24) :Get32(p + 28);
-
- SectAlign = Get32(p + 32);
- FileAlign = Get32(p + 36);
-
- OsVer.Parse(p + 40);
- ImageVer.Parse(p + 44);
- SubsysVer.Parse(p + 48);
-
- // reserved = Get32(p + 52);
-
- ImageSize = Get32(p + 56);
- HeadersSize = Get32(p + 60);
- CheckSum = Get32(p + 64);
- SubSystem = Get16(p + 68);
- DllCharacts = Get16(p + 70);
-
- if (hdr64)
- {
- StackReserve = Get64(p + 72);
- StackCommit = Get64(p + 80);
- HeapReserve = Get64(p + 88);
- HeapCommit = Get64(p + 96);
- }
- else
- {
- StackReserve = Get32(p + 72);
- StackCommit = Get32(p + 76);
- HeapReserve = Get32(p + 80);
- HeapCommit = Get32(p + 84);
- }
- UInt32 pos = (hdr64 ? 108 : 92);
- NumDirItems = Get32(p + pos);
- pos += 4;
- if (pos + 8 * NumDirItems != size)
- return false;
- for (UInt32 i = 0; i < NumDirItems && i < kNumDirItemsMax; i++)
- DirItems[i].Parse(p + pos + i * 8);
- return true;
-}
-
-static const UInt32 kSectionSize = 40;
-
-struct CSection
-{
- AString Name;
-
- UInt32 VSize;
- UInt32 Va;
- UInt32 PSize;
- UInt32 Pa;
- UInt32 Flags;
- UInt32 Time;
- // UInt16 NumRelocs;
- bool IsDebug;
- bool IsRealSect;
-
- CSection(): IsRealSect(false), IsDebug(false) {}
- UInt64 GetPackSize() const { return PSize; }
-
- void UpdateTotalSize(UInt32 &totalSize)
- {
- UInt32 t = Pa + PSize;
- if (t > totalSize)
- totalSize = t;
- }
- void Parse(const Byte *p);
-};
-
-static bool operator <(const CSection &a1, const CSection &a2) { return (a1.Pa < a2.Pa); }
-static bool operator ==(const CSection &a1, const CSection &a2) { return (a1.Pa == a2.Pa); }
-
-static AString GetName(const Byte *name)
-{
- const int kNameSize = 8;
- AString res;
- char *p = res.GetBuffer(kNameSize);
- memcpy(p, name, kNameSize);
- p[kNameSize] = 0;
- res.ReleaseBuffer();
- return res;
-}
-
-void CSection::Parse(const Byte *p)
-{
- Name = GetName(p);
- VSize = Get32(p + 8);
- Va = Get32(p + 12);
- PSize = Get32(p + 16);
- Pa = Get32(p + 20);
- // NumRelocs = Get16(p + 32);
- Flags = Get32(p + 36);
-}
-
-static const CUInt32PCharPair g_HeaderCharacts[] =
-{
- { 1 << 1, "Executable" },
- { 1 << 13, "DLL" },
- { 1 << 8, "32-bit" },
- { 1 << 5, "LargeAddress" },
- { 1 << 0, "NoRelocs" },
- { 1 << 2, "NoLineNums" },
- { 1 << 3, "NoLocalSyms" },
- { 1 << 4, "AggressiveWsTrim" },
- { 1 << 9, "NoDebugInfo" },
- { 1 << 10, "RemovableRun" },
- { 1 << 11, "NetRun" },
- { 1 << 12, "System" },
- { 1 << 14, "UniCPU" },
- { 1 << 7, "Little-Endian" },
- { 1 << 15, "Big-Endian" }
-};
-
-static const CUInt32PCharPair g_DllCharacts[] =
-{
- { 1 << 6, "Relocated" },
- { 1 << 7, "Integrity" },
- { 1 << 8, "NX-Compatible" },
- { 1 << 9, "NoIsolation" },
- { 1 << 10, "NoSEH" },
- { 1 << 11, "NoBind" },
- { 1 << 13, "WDM" },
- { 1 << 15, "TerminalServerAware" }
-};
-
-static const CUInt32PCharPair g_SectFlags[] =
-{
- { 1 << 3, "NoPad" },
- { 1 << 5, "Code" },
- { 1 << 6, "InitializedData" },
- { 1 << 7, "UninitializedData" },
- { 1 << 9, "Comments" },
- { 1 << 11, "Remove" },
- { 1 << 12, "COMDAT" },
- { 1 << 15, "GP" },
- { 1 << 24, "ExtendedRelocations" },
- { 1 << 25, "Discardable" },
- { 1 << 26, "NotCached" },
- { 1 << 27, "NotPaged" },
- { 1 << 28, "Shared" },
- { 1 << 29, "Execute" },
- { 1 << 30, "Read" },
- { (UInt32)1 << 31, "Write" }
-};
-
-static const CUInt32PCharPair g_MachinePairs[] =
-{
- { 0x014C, "x86" },
- { 0x0162, "MIPS-R3000" },
- { 0x0166, "MIPS-R4000" },
- { 0x0168, "MIPS-R10000" },
- { 0x0169, "MIPS-V2" },
- { 0x0184, "Alpha" },
- { 0x01A2, "SH3" },
- { 0x01A3, "SH3-DSP" },
- { 0x01A4, "SH3E" },
- { 0x01A6, "SH4" },
- { 0x01A8, "SH5" },
- { 0x01C0, "ARM" },
- { 0x01C2, "ARM-Thumb" },
- { 0x01F0, "PPC" },
- { 0x01F1, "PPC-FP" },
- { 0x0200, "IA-64" },
- { 0x0284, "Alpha-64" },
- { 0x0200, "IA-64" },
- { 0x0366, "MIPSFPU" },
- { 0x8664, "x64" },
- { 0x0EBC, "EFI" }
-};
-
-static const CUInt32PCharPair g_SubSystems[] =
-{
- { 0, "Unknown" },
- { 1, "Native" },
- { 2, "Windows GUI" },
- { 3, "Windows CUI" },
- { 7, "Posix" },
- { 9, "Windows CE" },
- { 10, "EFI" },
- { 11, "EFI Boot" },
- { 12, "EFI Runtime" },
- { 13, "EFI ROM" },
- { 14, "XBOX" }
-};
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _inStream;
- CObjectVector<CSection> _sections;
- UInt32 _peOffset;
- CHeader _header;
- COptHeader _optHeader;
- UInt32 _totalSize;
- UInt32 _totalSizeLimited;
- HRESULT LoadDebugSections(IInStream *stream, bool &thereIsSection);
- HRESULT Open2(IInStream *stream);
- bool Parse(const Byte *buf, UInt32 size);
-public:
- MY_UNKNOWN_IMP1(IInArchive)
- INTERFACE_IInArchive(;)
-};
-
-bool CHandler::Parse(const Byte *buf, UInt32 size)
-{
- UInt32 i;
- if (size < 512)
- return false;
- _peOffset = Get32(buf + 0x3C);
- if (_peOffset >= 0x1000 || _peOffset + 512 > size || (_peOffset & 7) != 0)
- return false;
-
- UInt32 pos = _peOffset;
- if (!_header.Parse(buf + pos))
- return false;
- if (_header.OptHeaderSize > 512 || _header.NumSections > NUM_SCAN_SECTIONS_MAX)
- return false;
- pos += kHeaderSize;
-
- if (!_optHeader.Parse(buf + pos, _header.OptHeaderSize))
- return false;
-
- pos += _header.OptHeaderSize;
- _totalSize = pos;
-
- for (i = 0; i < _header.NumSections; i++, pos += kSectionSize)
- {
- CSection sect;
- if (pos + kSectionSize > size)
- return false;
- sect.Parse(buf + pos);
- sect.IsRealSect = true;
- sect.UpdateTotalSize(_totalSize);
- _sections.Add(sect);
- }
-
- return true;
-}
-
-enum
-{
- kpidSectAlign = kpidUserDefined,
- kpidFileAlign,
- kpidLinkerVer,
- kpidOsVer,
- kpidImageVer,
- kpidSubsysVer,
- kpidCodeSize,
- kpidImageSize,
- kpidInitDataSize,
- kpidUnInitDataSize,
- kpidHeadersSizeUnInitDataSize,
- kpidSubSystem,
- kpidDllCharacts,
- kpidStackReserve,
- kpidStackCommit,
- kpidHeapReserve,
- kpidHeapCommit,
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidCpu, VT_BSTR},
- { NULL, kpidBit64, VT_BOOL},
- { NULL, kpidCharacts, VT_BSTR},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidPhySize, VT_UI4},
- { NULL, kpidHeadersSize, VT_UI4},
- { NULL, kpidChecksum, VT_UI4},
- { L"Image Size", kpidImageSize, VT_UI4},
- { L"Section Alignment", kpidSectAlign, VT_UI4},
- { L"File Alignment", kpidFileAlign, VT_UI4},
- { L"Code Size", kpidCodeSize, VT_UI4},
- { L"Initialized Data Size", kpidInitDataSize, VT_UI4},
- { L"Uninitialized Data Size", kpidUnInitDataSize, VT_UI4},
- { L"Linker Version", kpidLinkerVer, VT_BSTR},
- { L"OS Version", kpidOsVer, VT_BSTR},
- { L"Image Version", kpidImageVer, VT_BSTR},
- { L"Subsystem Version", kpidSubsysVer, VT_BSTR},
- { L"Subsystem", kpidSubSystem, VT_BSTR},
- { L"DLL Characteristics", kpidDllCharacts, VT_BSTR},
- { L"Stack Reserve", kpidStackReserve, VT_UI8},
- { L"Stack Commit", kpidStackCommit, VT_UI8},
- { L"Heap Reserve", kpidHeapReserve, VT_UI8},
- { L"Heap Commit", kpidHeapCommit, VT_UI8},
- };
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidCharacts, VT_BSTR},
- { NULL, kpidOffset, VT_UI8},
- { NULL, kpidVa, VT_UI8}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_WITH_NAME
-
-static void VerToProp(const CVersion &v, NCOM::CPropVariant &prop)
-{
- StringToProp(v.GetString(), prop);
-}
-
-void TimeToProp(UInt32 unixTime, NCOM::CPropVariant &prop)
-{
- if (unixTime != 0)
- {
- FILETIME ft;
- NTime::UnixTimeToFileTime(unixTime, ft);
- prop = ft;
- }
-}
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidSectAlign: prop = _optHeader.SectAlign; break;
- case kpidFileAlign: prop = _optHeader.FileAlign; break;
- case kpidLinkerVer:
- {
- CVersion v = { _optHeader.LinkerVerMajor, _optHeader.LinkerVerMinor };
- VerToProp(v, prop); break;
- break;
- }
-
- case kpidOsVer: VerToProp(_optHeader.OsVer, prop); break;
- case kpidImageVer: VerToProp(_optHeader.ImageVer, prop); break;
- case kpidSubsysVer: VerToProp(_optHeader.SubsysVer, prop); break;
- case kpidCodeSize: prop = _optHeader.CodeSize; break;
- case kpidInitDataSize: prop = _optHeader.InitDataSize; break;
- case kpidUnInitDataSize: prop = _optHeader.UninitDataSize; break;
- case kpidImageSize: prop = _optHeader.ImageSize; break;
- case kpidPhySize: prop = _totalSize; break;
- case kpidHeadersSize: prop = _optHeader.HeadersSize; break;
- case kpidChecksum: prop = _optHeader.CheckSum; break;
-
- case kpidCpu: PAIR_TO_PROP(g_MachinePairs, _header.Machine, prop); break;
- case kpidBit64: if (_optHeader.Is64Bit()) prop = true; break;
- case kpidSubSystem: PAIR_TO_PROP(g_SubSystems, _optHeader.SubSystem, prop); break;
-
- case kpidMTime:
- case kpidCTime: TimeToProp(_header.Time, prop); break;
- case kpidCharacts: FLAGS_TO_PROP(g_HeaderCharacts, _header.Flags, prop); break;
- case kpidDllCharacts: FLAGS_TO_PROP(g_DllCharacts, _optHeader.DllCharacts, prop); break;
- case kpidStackReserve: prop = _optHeader.StackReserve; break;
- case kpidStackCommit: prop = _optHeader.StackCommit; break;
- case kpidHeapReserve: prop = _optHeader.HeapReserve; break;
- case kpidHeapCommit: prop = _optHeader.HeapCommit; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NCOM::CPropVariant prop;
- const CSection &item = _sections[index];
- switch(propID)
- {
- case kpidPath: StringToProp(item.Name, prop); break;
- case kpidSize: prop = (UInt64)item.VSize; break;
- case kpidPackSize: prop = (UInt64)item.GetPackSize(); break;
- case kpidOffset: prop = item.Pa; break;
- case kpidVa: if (item.IsRealSect) prop = item.Va; break;
- case kpidMTime:
- case kpidCTime:
- TimeToProp(item.IsDebug ? item.Time : _header.Time, prop); break;
- case kpidCharacts: if (item.IsRealSect) FLAGS_TO_PROP(g_SectFlags, item.Flags, prop); break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-HRESULT CHandler::LoadDebugSections(IInStream *stream, bool &thereIsSection)
-{
- thereIsSection = false;
- const CDirLink &debugLink = _optHeader.DirItems[kDirLink_Debug];
- if (debugLink.Size == 0)
- return S_OK;
- const unsigned kEntrySize = 28;
- UInt32 numItems = debugLink.Size / kEntrySize;
- if (numItems * kEntrySize != debugLink.Size || numItems > 16)
- return S_FALSE;
-
- UInt64 pa = 0;
- int i;
- for (i = 0; i < _sections.Size(); i++)
- {
- const CSection &sect = _sections[i];
- if (sect.Va < debugLink.Va && debugLink.Va + debugLink.Size <= sect.Va + sect.PSize)
- {
- pa = sect.Pa + (debugLink.Va - sect.Va);
- break;
- }
- }
- if (i == _sections.Size())
- {
- return S_OK;
- // Exe for ARM requires S_OK
- // return S_FALSE;
- }
-
- CByteBuffer buffer;
- buffer.SetCapacity(debugLink.Size);
- Byte *buf = buffer;
-
- RINOK(stream->Seek(pa, STREAM_SEEK_SET, NULL));
- RINOK(ReadStream_FALSE(stream, buf, debugLink.Size));
-
- for (i = 0; i < (int)numItems; i++)
- {
- CDebugEntry de;
- de.Parse(buf);
-
- if (de.Size == 0)
- continue;
-
- CSection sect;
- sect.Name = ".debug" + GetDecString(i);
-
- sect.IsDebug = true;
- sect.Time = de.Time;
- sect.Va = de.Va;
- sect.Pa = de.Pa;
- sect.PSize = sect.VSize = de.Size;
- UInt32 totalSize = sect.Pa + sect.PSize;
- if (totalSize > _totalSize)
- {
- _totalSize = totalSize;
- _sections.Add(sect);
- thereIsSection = true;
- }
- buf += kEntrySize;
- }
-
- return S_OK;
-}
-
-HRESULT CHandler::Open2(IInStream *stream)
-{
- const UInt32 kBufSize = 1 << 18;
- const UInt32 kSigSize = 2;
-
- CByteBuffer buffer;
- buffer.SetCapacity(kBufSize);
- Byte *buf = buffer;
-
- size_t processed = kSigSize;
- RINOK(ReadStream_FALSE(stream, buf, processed));
- if (buf[0] != 'M' || buf[1] != 'Z')
- return S_FALSE;
- processed = kBufSize - kSigSize;
- RINOK(ReadStream(stream, buf + kSigSize, &processed));
- processed += kSigSize;
- if (!Parse(buf, (UInt32)processed))
- return S_FALSE;
- bool thereISDebug;
- RINOK(LoadDebugSections(stream, thereISDebug));
-
- const CDirLink &certLink = _optHeader.DirItems[kDirLink_Certificate];
- if (certLink.Size != 0)
- {
- CSection sect;
- sect.Name = "CERTIFICATE";
- sect.Va = 0;
- sect.Pa = certLink.Va;
- sect.PSize = sect.VSize = certLink.Size;
- sect.UpdateTotalSize(_totalSize);
- _sections.Add(sect);
- }
-
- if (thereISDebug)
- {
- const UInt32 kAlign = 1 << 12;
- UInt32 alignPos = _totalSize & (kAlign - 1);
- if (alignPos != 0)
- {
- UInt32 size = kAlign - alignPos;
- RINOK(stream->Seek(_totalSize, STREAM_SEEK_SET, NULL));
- buffer.Free();
- buffer.SetCapacity(kAlign);
- Byte *buf = buffer;
- size_t processed = size;
- RINOK(ReadStream(stream, buf, &processed));
- size_t i;
- for (i = 0; i < processed; i++)
- {
- if (buf[i] != 0)
- break;
- }
- if (processed < size && processed < 100)
- _totalSize += (UInt32)processed;
- else if (((_totalSize + i) & 0x1FF) == 0 || processed < size)
- _totalSize += (UInt32)i;
- }
- }
-
- if (_header.NumSymbols > 0 && _header.PointerToSymbolTable >= 512)
- {
- if (_header.NumSymbols >= (1 << 24))
- return S_FALSE;
- CSection sect;
- sect.Name = "COFF_SYMBOLS";
- UInt32 size = _header.NumSymbols * 18;
- RINOK(stream->Seek((UInt64)_header.PointerToSymbolTable + size, STREAM_SEEK_SET, NULL));
- Byte buf[4];
- RINOK(ReadStream_FALSE(stream, buf, 4));
- UInt32 size2 = Get32(buf);
- if (size2 >= (1 << 28))
- return S_FALSE;
- size += size2;
-
- sect.Va = 0;
- sect.Pa = _header.PointerToSymbolTable;
- sect.PSize = sect.VSize = size;
- sect.UpdateTotalSize(_totalSize);
- _sections.Add(sect);
- }
-
- UInt64 fileSize;
- RINOK(stream->Seek(0, STREAM_SEEK_END, &fileSize));
- if (fileSize > _totalSize)
- return S_FALSE;
- _totalSizeLimited = (_totalSize < fileSize) ? _totalSize : (UInt32)fileSize;
-
- {
- CObjectVector<CSection> sections = _sections;
- sections.Sort();
- UInt32 limit = (1 << 12);
- int num = 0;
- for (int i = 0; i < sections.Size(); i++)
- {
- const CSection &s = sections[i];
- if (s.Pa > limit)
- {
- CSection s2;
- s2.Pa = s2.Va = limit;
- s2.PSize = s2.VSize = s.Pa - limit;
- char sz[32];
- ConvertUInt64ToString(++num, sz);
- s2.Name = "[data-";
- s2.Name += sz;
- s2.Name += "]";
- _sections.Add(s2);
- }
- UInt32 next = s.Pa + s.PSize;
- if (next < limit)
- break;
- limit = next;
- }
- }
-
- return S_OK;
-}
-
-HRESULT CalcCheckSum(ISequentialInStream *stream, UInt32 size, UInt32 excludePos, UInt32 &res)
-{
- // size &= ~1;
- const UInt32 kBufSize = 1 << 23;
- CByteBuffer buffer;
- buffer.SetCapacity(kBufSize);
- Byte *buf = buffer;
-
- UInt32 sum = 0;
- UInt32 pos;
- for(pos = 0;;)
- {
- UInt32 rem = size - pos;
- if (rem > kBufSize)
- rem = kBufSize;
- if (rem == 0)
- break;
- size_t processed = rem;
- RINOK(ReadStream(stream, buf, &processed));
-
- /*
- for (; processed < rem; processed++)
- buf[processed] = 0;
- */
-
- if ((processed & 1) != 0)
- buf[processed] = 0;
-
- for (int j = 0; j < 4; j++)
- {
- UInt32 p = excludePos + j;
- if (pos <= p && p < pos + processed)
- buf[p - pos] = 0;
- }
-
- for (size_t i = 0; i < processed; i += 2)
- {
- sum += Get16(buf + i);
- sum = (sum + (sum >> 16)) & 0xFFFF;
- }
- pos += (UInt32)processed;
- if (rem != processed)
- break;
- }
- sum += pos;
- res = sum;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- Close();
- RINOK(Open2(inStream));
- _inStream = inStream;
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _inStream.Release();
- _sections.Clear();
-
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _sections.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _sections.Size();
- if (numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- totalSize += _sections[allFilesMode ? i : indices[i]].GetPackSize();
- extractCallback->SetTotal(totalSize);
-
- UInt64 currentTotalSize = 0;
- UInt64 currentItemSize;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- bool checkSumOK = true;
- if (_optHeader.CheckSum != 0 && (int)numItems == _sections.Size())
- {
- UInt32 checkSum = 0;
- RINOK(_inStream->Seek(0, STREAM_SEEK_SET, NULL));
- CalcCheckSum(_inStream, _totalSizeLimited, _peOffset + kHeaderSize + 64, checkSum);
- checkSumOK = (checkSum == _optHeader.CheckSum);
- }
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- streamSpec->SetStream(_inStream);
-
- for (i = 0; i < numItems; i++, currentTotalSize += currentItemSize)
- {
- lps->InSize = lps->OutSize = currentTotalSize;
- RINOK(lps->SetCur());
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- UInt32 index = allFilesMode ? i : indices[i];
- const CSection &item = _sections[index];
- currentItemSize = item.GetPackSize();
-
- CMyComPtr<ISequentialOutStream> outStream;
- RINOK(extractCallback->GetStream(index, &outStream, askMode));
- if (!testMode && !outStream)
- continue;
-
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(_inStream->Seek(item.Pa, STREAM_SEEK_SET, NULL));
- streamSpec->Init(currentItemSize);
- RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
- outStream.Release();
- RINOK(extractCallback->SetOperationResult((copyCoderSpec->TotalSize == currentItemSize) ?
- checkSumOK ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kCRCError:
- NArchive::NExtract::NOperationResult::kDataError));
- }
- return S_OK;
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"PE", L"", 0, 0xDD, { 0 }, 0, false, CreateArc, 0 };
-
-REGISTER_ARC(Pe)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHandler.cpp
deleted file mode 100644
index 93c192659..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHandler.cpp
+++ /dev/null
@@ -1,838 +0,0 @@
-// RarHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../../IPassword.h"
-
-#include "../../Common/CreateCoder.h"
-#include "../../Common/FilterCoder.h"
-#include "../../Common/MethodId.h"
-#include "../../Common/ProgressUtils.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "../../Crypto/Rar20Crypto.h"
-#include "../../Crypto/RarAes.h"
-
-#include "../Common/ItemNameUtils.h"
-#include "../Common/OutStreamWithCRC.h"
-
-#include "RarHandler.h"
-
-using namespace NWindows;
-using namespace NTime;
-
-namespace NArchive {
-namespace NRar {
-
-static const wchar_t *kHostOS[] =
-{
- L"MS DOS",
- L"OS/2",
- L"Win32",
- L"Unix",
- L"Mac OS",
- L"BeOS"
-};
-
-static const int kNumHostOSes = sizeof(kHostOS) / sizeof(kHostOS[0]);
-
-static const wchar_t *kUnknownOS = L"Unknown";
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidATime, VT_FILETIME},
- { NULL, kpidAttrib, VT_UI4},
-
- { NULL, kpidEncrypted, VT_BOOL},
- { NULL, kpidSolid, VT_BOOL},
- { NULL, kpidCommented, VT_BOOL},
- { NULL, kpidSplitBefore, VT_BOOL},
- { NULL, kpidSplitAfter, VT_BOOL},
- { NULL, kpidCRC, VT_UI4},
- { NULL, kpidHostOS, VT_BSTR},
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidUnpackVer, VT_UI1}
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidSolid, VT_BOOL},
- { NULL, kpidNumBlocks, VT_UI4},
- // { NULL, kpidEncrypted, VT_BOOL},
- { NULL, kpidIsVolume, VT_BOOL},
- { NULL, kpidNumVolumes, VT_UI4},
- { NULL, kpidPhySize, VT_UI8}
- // { NULL, kpidCommented, VT_BOOL}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-UInt64 CHandler::GetPackSize(int refIndex) const
-{
- const CRefItem &refItem = _refItems[refIndex];
- UInt64 totalPackSize = 0;
- for (int i = 0; i < refItem.NumItems; i++)
- totalPackSize += _items[refItem.ItemIndex + i].PackSize;
- return totalPackSize;
-}
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- // COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidSolid: prop = _archiveInfo.IsSolid(); break;
- // case kpidEncrypted: prop = _archiveInfo.IsEncrypted(); break; // it's for encrypted names.
- case kpidIsVolume: prop = _archiveInfo.IsVolume(); break;
- case kpidNumVolumes: prop = (UInt32)_archives.Size(); break;
- case kpidOffset: if (_archiveInfo.StartPosition != 0) prop = _archiveInfo.StartPosition; break;
- // case kpidCommented: prop = _archiveInfo.IsCommented(); break;
- case kpidNumBlocks:
- {
- UInt32 numBlocks = 0;
- for (int i = 0; i < _refItems.Size(); i++)
- if (!IsSolid(i))
- numBlocks++;
- prop = (UInt32)numBlocks;
- break;
- }
- }
- prop.Detach(value);
- return S_OK;
- // COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _refItems.Size();
- return S_OK;
-}
-
-static bool RarTimeToFileTime(const CRarTime &rarTime, FILETIME &result)
-{
- if (!DosTimeToFileTime(rarTime.DosTime, result))
- return false;
- UInt64 value = (((UInt64)result.dwHighDateTime) << 32) + result.dwLowDateTime;
- value += (UInt64)rarTime.LowSecond * 10000000;
- value += ((UInt64)rarTime.SubTime[2] << 16) +
- ((UInt64)rarTime.SubTime[1] << 8) +
- ((UInt64)rarTime.SubTime[0]);
- result.dwLowDateTime = (DWORD)value;
- result.dwHighDateTime = DWORD(value >> 32);
- return true;
-}
-
-static void RarTimeToProp(const CRarTime &rarTime, NWindows::NCOM::CPropVariant &prop)
-{
- FILETIME localFileTime, utcFileTime;
- if (RarTimeToFileTime(rarTime, localFileTime))
- {
- if (!LocalFileTimeToFileTime(&localFileTime, &utcFileTime))
- utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0;
- }
- else
- utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0;
- prop = utcFileTime;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- const CRefItem &refItem = _refItems[index];
- const CItemEx &item = _items[refItem.ItemIndex];
- switch(propID)
- {
- case kpidPath:
- {
- UString u;
- if (item.HasUnicodeName() && !item.UnicodeName.IsEmpty())
- u = item.UnicodeName;
- else
- u = MultiByteToUnicodeString(item.Name, CP_OEMCP);
- prop = (const wchar_t *)NItemName::WinNameToOSName(u);
- break;
- }
- case kpidIsDir: prop = item.IsDir(); break;
- case kpidSize: prop = item.Size; break;
- case kpidPackSize: prop = GetPackSize(index); break;
- case kpidMTime: RarTimeToProp(item.MTime, prop); break;
- case kpidCTime: if (item.CTimeDefined) RarTimeToProp(item.CTime, prop); break;
- case kpidATime: if (item.ATimeDefined) RarTimeToProp(item.ATime, prop); break;
- case kpidAttrib: prop = item.GetWinAttributes(); break;
- case kpidEncrypted: prop = item.IsEncrypted(); break;
- case kpidSolid: prop = IsSolid(index); break;
- case kpidCommented: prop = item.IsCommented(); break;
- case kpidSplitBefore: prop = item.IsSplitBefore(); break;
- case kpidSplitAfter: prop = _items[refItem.ItemIndex + refItem.NumItems - 1].IsSplitAfter(); break;
- case kpidCRC:
- {
- const CItemEx &lastItem = _items[refItem.ItemIndex + refItem.NumItems - 1];
- prop = ((lastItem.IsSplitAfter()) ? item.FileCRC : lastItem.FileCRC);
- break;
- }
- case kpidUnpackVer: prop = item.UnPackVersion; break;
- case kpidMethod:
- {
- UString method;
- if (item.Method >= Byte('0') && item.Method <= Byte('5'))
- {
- method = L"m";
- wchar_t temp[32];
- ConvertUInt64ToString(item.Method - Byte('0'), temp);
- method += temp;
- if (!item.IsDir())
- {
- method += L":";
- ConvertUInt64ToString(16 + item.GetDictSize(), temp);
- method += temp;
- }
- }
- else
- {
- wchar_t temp[32];
- ConvertUInt64ToString(item.Method, temp);
- method += temp;
- }
- prop = method;
- break;
- }
- case kpidHostOS: prop = (item.HostOS < kNumHostOSes) ? (kHostOS[item.HostOS]) : kUnknownOS; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-class CVolumeName
-{
- bool _first;
- bool _newStyle;
- UString _unchangedPart;
- UString _changedPart;
- UString _afterPart;
-public:
- CVolumeName(): _newStyle(true) {};
-
- bool InitName(const UString &name, bool newStyle)
- {
- _first = true;
- _newStyle = newStyle;
- int dotPos = name.ReverseFind('.');
- UString basePart = name;
- if (dotPos >= 0)
- {
- UString ext = name.Mid(dotPos + 1);
- if (ext.CompareNoCase(L"rar") == 0)
- {
- _afterPart = name.Mid(dotPos);
- basePart = name.Left(dotPos);
- }
- else if (ext.CompareNoCase(L"exe") == 0)
- {
- _afterPart = L".rar";
- basePart = name.Left(dotPos);
- }
- else if (!_newStyle)
- {
- if (ext.CompareNoCase(L"000") == 0 ||
- ext.CompareNoCase(L"001") == 0 ||
- ext.CompareNoCase(L"r00") == 0 ||
- ext.CompareNoCase(L"r01") == 0)
- {
- _afterPart.Empty();
- _first = false;
- _changedPart = ext;
- _unchangedPart = name.Left(dotPos + 1);
- return true;
- }
- }
- }
-
- if (!_newStyle)
- {
- _afterPart.Empty();
- _unchangedPart = basePart + UString(L".");
- _changedPart = L"r00";
- return true;
- }
-
- int numLetters = 1;
- if (basePart.Right(numLetters) == L"1" || basePart.Right(numLetters) == L"0")
- {
- while (numLetters < basePart.Length())
- {
- if (basePart[basePart.Length() - numLetters - 1] != '0')
- break;
- numLetters++;
- }
- }
- else
- return false;
- _unchangedPart = basePart.Left(basePart.Length() - numLetters);
- _changedPart = basePart.Right(numLetters);
- return true;
- }
-
- UString GetNextName()
- {
- UString newName;
- if (_newStyle || !_first)
- {
- int i;
- int numLetters = _changedPart.Length();
- for (i = numLetters - 1; i >= 0; i--)
- {
- wchar_t c = _changedPart[i];
- if (c == L'9')
- {
- c = L'0';
- newName = c + newName;
- if (i == 0)
- newName = UString(L'1') + newName;
- continue;
- }
- c++;
- newName = UString(c) + newName;
- i--;
- for (; i >= 0; i--)
- newName = _changedPart[i] + newName;
- break;
- }
- _changedPart = newName;
- }
- _first = false;
- return _unchangedPart + _changedPart + _afterPart;
- }
-};
-
-HRESULT CHandler::Open2(IInStream *stream,
- const UInt64 *maxCheckStartPosition,
- IArchiveOpenCallback *openArchiveCallback)
-{
- {
- CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
- CMyComPtr<ICryptoGetTextPassword> getTextPassword;
- CMyComPtr<IArchiveOpenCallback> openArchiveCallbackWrap = openArchiveCallback;
-
- CVolumeName seqName;
-
- UInt64 totalBytes = 0;
- UInt64 curBytes = 0;
-
- if (openArchiveCallback != NULL)
- {
- openArchiveCallbackWrap.QueryInterface(IID_IArchiveOpenVolumeCallback, &openVolumeCallback);
- openArchiveCallbackWrap.QueryInterface(IID_ICryptoGetTextPassword, &getTextPassword);
- }
-
- for (;;)
- {
- CMyComPtr<IInStream> inStream;
- if (!_archives.IsEmpty())
- {
- if (!openVolumeCallback)
- break;
-
- if(_archives.Size() == 1)
- {
- if (!_archiveInfo.IsVolume())
- break;
- UString baseName;
- {
- NCOM::CPropVariant prop;
- RINOK(openVolumeCallback->GetProperty(kpidName, &prop));
- if (prop.vt != VT_BSTR)
- break;
- baseName = prop.bstrVal;
- }
- seqName.InitName(baseName, _archiveInfo.HaveNewVolumeName());
- }
-
- UString fullName = seqName.GetNextName();
- HRESULT result = openVolumeCallback->GetStream(fullName, &inStream);
- if (result == S_FALSE)
- break;
- if (result != S_OK)
- return result;
- if (!stream)
- break;
- }
- else
- inStream = stream;
-
- UInt64 endPos = 0;
- if (openArchiveCallback != NULL)
- {
- RINOK(stream->Seek(0, STREAM_SEEK_END, &endPos));
- RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL));
- totalBytes += endPos;
- RINOK(openArchiveCallback->SetTotal(NULL, &totalBytes));
- }
-
- NArchive::NRar::CInArchive archive;
- RINOK(archive.Open(inStream, maxCheckStartPosition));
-
- if (_archives.IsEmpty())
- archive.GetArchiveInfo(_archiveInfo);
-
- CItemEx item;
- for (;;)
- {
- HRESULT result = archive.GetNextItem(item, getTextPassword);
- if (result == S_FALSE)
- break;
- RINOK(result);
- if (item.IgnoreItem())
- continue;
-
- bool needAdd = true;
- if (item.IsSplitBefore())
- {
- if (!_refItems.IsEmpty())
- {
- CRefItem &refItem = _refItems.Back();
- refItem.NumItems++;
- needAdd = false;
- }
- }
- if (needAdd)
- {
- CRefItem refItem;
- refItem.ItemIndex = _items.Size();
- refItem.NumItems = 1;
- refItem.VolumeIndex = _archives.Size();
- _refItems.Add(refItem);
- }
- _items.Add(item);
- if (openArchiveCallback != NULL && _items.Size() % 100 == 0)
- {
- UInt64 numFiles = _items.Size();
- UInt64 numBytes = curBytes + item.Position;
- RINOK(openArchiveCallback->SetCompleted(&numFiles, &numBytes));
- }
- }
- curBytes += endPos;
- _archives.Add(archive);
- }
- }
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 *maxCheckStartPosition,
- IArchiveOpenCallback *openArchiveCallback)
-{
- COM_TRY_BEGIN
- Close();
- try
- {
- HRESULT res = Open2(stream, maxCheckStartPosition, openArchiveCallback);
- if (res != S_OK)
- Close();
- return res;
- }
- catch(const CInArchiveException &) { Close(); return S_FALSE; }
- catch(...) { Close(); throw; }
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- COM_TRY_BEGIN
- _refItems.Clear();
- _items.Clear();
- _archives.Clear();
- return S_OK;
- COM_TRY_END
-}
-
-struct CMethodItem
-{
- Byte RarUnPackVersion;
- CMyComPtr<ICompressCoder> Coder;
-};
-
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *_anExtractCallback)
-{
- COM_TRY_BEGIN
- CMyComPtr<ICryptoGetTextPassword> getTextPassword;
- bool testMode = (_aTestMode != 0);
- CMyComPtr<IArchiveExtractCallback> extractCallback = _anExtractCallback;
- UInt64 censoredTotalUnPacked = 0,
- // censoredTotalPacked = 0,
- importantTotalUnPacked = 0;
- // importantTotalPacked = 0;
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _refItems.Size();
- if(numItems == 0)
- return S_OK;
- int lastIndex = 0;
- CRecordVector<int> importantIndexes;
- CRecordVector<bool> extractStatuses;
-
- for(UInt32 t = 0; t < numItems; t++)
- {
- int index = allFilesMode ? t : indices[t];
- const CRefItem &refItem = _refItems[index];
- const CItemEx &item = _items[refItem.ItemIndex];
- censoredTotalUnPacked += item.Size;
- // censoredTotalPacked += item.PackSize;
- int j;
- for(j = lastIndex; j <= index; j++)
- // if(!_items[_refItems[j].ItemIndex].IsSolid())
- if(!IsSolid(j))
- lastIndex = j;
- for(j = lastIndex; j <= index; j++)
- {
- const CRefItem &refItem = _refItems[j];
- const CItemEx &item = _items[refItem.ItemIndex];
-
- // const CItemEx &item = _items[j];
-
- importantTotalUnPacked += item.Size;
- // importantTotalPacked += item.PackSize;
- importantIndexes.Add(j);
- extractStatuses.Add(j == index);
- }
- lastIndex = index + 1;
- }
-
- extractCallback->SetTotal(importantTotalUnPacked);
- UInt64 currentImportantTotalUnPacked = 0;
- UInt64 currentImportantTotalPacked = 0;
- UInt64 currentUnPackSize, currentPackSize;
-
- CObjectVector<CMethodItem> methodItems;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder;
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CFilterCoder *filterStreamSpec = new CFilterCoder;
- CMyComPtr<ISequentialInStream> filterStream = filterStreamSpec;
-
- NCrypto::NRar20::CDecoder *rar20CryptoDecoderSpec = NULL;
- CMyComPtr<ICompressFilter> rar20CryptoDecoder;
- NCrypto::NRar29::CDecoder *rar29CryptoDecoderSpec = NULL;
- CMyComPtr<ICompressFilter> rar29CryptoDecoder;
-
- CFolderInStream *folderInStreamSpec = NULL;
- CMyComPtr<ISequentialInStream> folderInStream;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- bool solidStart = true;
- for(int i = 0; i < importantIndexes.Size(); i++,
- currentImportantTotalUnPacked += currentUnPackSize,
- currentImportantTotalPacked += currentPackSize)
- {
- lps->InSize = currentImportantTotalPacked;
- lps->OutSize = currentImportantTotalUnPacked;
- RINOK(lps->SetCur());
- CMyComPtr<ISequentialOutStream> realOutStream;
-
- Int32 askMode;
- if(extractStatuses[i])
- askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- else
- askMode = NArchive::NExtract::NAskMode::kSkip;
-
- UInt32 index = importantIndexes[i];
-
- const CRefItem &refItem = _refItems[index];
- const CItemEx &item = _items[refItem.ItemIndex];
-
- currentUnPackSize = item.Size;
-
- currentPackSize = GetPackSize(index);
-
- if(item.IgnoreItem())
- continue;
-
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
- if (!IsSolid(index))
- solidStart = true;
- if(item.IsDir())
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
-
- bool mustBeProcessedAnywhere = false;
- if(i < importantIndexes.Size() - 1)
- {
- // const CRefItem &nextRefItem = _refItems[importantIndexes[i + 1]];
- // const CItemEx &nextItemInfo = _items[nextRefItem.ItemIndex];
- // mustBeProcessedAnywhere = nextItemInfo.IsSolid();
- mustBeProcessedAnywhere = IsSolid(importantIndexes[i + 1]);
- }
-
- if (!mustBeProcessedAnywhere && !testMode && !realOutStream)
- continue;
-
- if (!realOutStream && !testMode)
- askMode = NArchive::NExtract::NAskMode::kSkip;
-
- RINOK(extractCallback->PrepareOperation(askMode));
-
- COutStreamWithCRC *outStreamSpec = new COutStreamWithCRC;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
- outStreamSpec->SetStream(realOutStream);
- outStreamSpec->Init();
- realOutStream.Release();
-
- /*
- for (int partIndex = 0; partIndex < 1; partIndex++)
- {
- CMyComPtr<ISequentialInStream> inStream;
-
- // item redefinition
- const CItemEx &item = _items[refItem.ItemIndex + partIndex];
-
- NArchive::NRar::CInArchive &archive = _archives[refItem.VolumeIndex + partIndex];
-
- inStream.Attach(archive.CreateLimitedStream(item.GetDataPosition(),
- item.PackSize));
- */
- if (!folderInStream)
- {
- folderInStreamSpec = new CFolderInStream;
- folderInStream = folderInStreamSpec;
- }
-
- folderInStreamSpec->Init(&_archives, &_items, refItem);
-
- UInt64 packSize = currentPackSize;
-
- // packedPos += item.PackSize;
- // unpackedPos += 0;
-
- CMyComPtr<ISequentialInStream> inStream;
- if (item.IsEncrypted())
- {
- CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
- if (item.UnPackVersion >= 29)
- {
- if (!rar29CryptoDecoder)
- {
- rar29CryptoDecoderSpec = new NCrypto::NRar29::CDecoder;
- rar29CryptoDecoder = rar29CryptoDecoderSpec;
- // RINOK(rar29CryptoDecoder.CoCreateInstance(CLSID_CCryptoRar29Decoder));
- }
- rar29CryptoDecoderSpec->SetRar350Mode(item.UnPackVersion < 36);
- CMyComPtr<ICompressSetDecoderProperties2> cryptoProperties;
- RINOK(rar29CryptoDecoder.QueryInterface(IID_ICompressSetDecoderProperties2,
- &cryptoProperties));
- RINOK(cryptoProperties->SetDecoderProperties2(item.Salt, item.HasSalt() ? sizeof(item.Salt) : 0));
- filterStreamSpec->Filter = rar29CryptoDecoder;
- }
- else if (item.UnPackVersion >= 20)
- {
- if (!rar20CryptoDecoder)
- {
- rar20CryptoDecoderSpec = new NCrypto::NRar20::CDecoder;
- rar20CryptoDecoder = rar20CryptoDecoderSpec;
- // RINOK(rar20CryptoDecoder.CoCreateInstance(CLSID_CCryptoRar20Decoder));
- }
- filterStreamSpec->Filter = rar20CryptoDecoder;
- }
- else
- {
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
- continue;
- }
- RINOK(filterStreamSpec->Filter.QueryInterface(IID_ICryptoSetPassword,
- &cryptoSetPassword));
-
- if (!getTextPassword)
- extractCallback.QueryInterface(IID_ICryptoGetTextPassword,
- &getTextPassword);
- if (getTextPassword)
- {
- CMyComBSTR password;
- RINOK(getTextPassword->CryptoGetTextPassword(&password));
- if (item.UnPackVersion >= 29)
- {
- CByteBuffer buffer;
- UString unicodePassword(password);
- const UInt32 sizeInBytes = unicodePassword.Length() * 2;
- buffer.SetCapacity(sizeInBytes);
- for (int i = 0; i < unicodePassword.Length(); i++)
- {
- wchar_t c = unicodePassword[i];
- ((Byte *)buffer)[i * 2] = (Byte)c;
- ((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8);
- }
- RINOK(cryptoSetPassword->CryptoSetPassword(
- (const Byte *)buffer, sizeInBytes));
- }
- else
- {
- AString oemPassword = UnicodeStringToMultiByte(
- (const wchar_t *)password, CP_OEMCP);
- RINOK(cryptoSetPassword->CryptoSetPassword(
- (const Byte *)(const char *)oemPassword, oemPassword.Length()));
- }
- }
- else
- {
- RINOK(cryptoSetPassword->CryptoSetPassword(0, 0));
- }
- filterStreamSpec->SetInStream(folderInStream);
- inStream = filterStream;
- }
- else
- {
- inStream = folderInStream;
- }
- CMyComPtr<ICompressCoder> commonCoder;
- switch(item.Method)
- {
- case '0':
- {
- commonCoder = copyCoder;
- break;
- }
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- {
- /*
- if (item.UnPackVersion >= 29)
- {
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
- continue;
- }
- */
- int m;
- for (m = 0; m < methodItems.Size(); m++)
- if (methodItems[m].RarUnPackVersion == item.UnPackVersion)
- break;
- if (m == methodItems.Size())
- {
- CMethodItem mi;
- mi.RarUnPackVersion = item.UnPackVersion;
-
- mi.Coder.Release();
- if (item.UnPackVersion <= 30)
- {
- UInt32 methodID = 0x040300;
- if (item.UnPackVersion < 20)
- methodID += 1;
- else if (item.UnPackVersion < 29)
- methodID += 2;
- else
- methodID += 3;
- RINOK(CreateCoder(EXTERNAL_CODECS_VARS methodID, mi.Coder, false));
- }
-
- if (mi.Coder == 0)
- {
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
- continue;
- }
-
- m = methodItems.Add(mi);
- }
- CMyComPtr<ICompressCoder> decoder = methodItems[m].Coder;
-
- CMyComPtr<ICompressSetDecoderProperties2> compressSetDecoderProperties;
- RINOK(decoder.QueryInterface(IID_ICompressSetDecoderProperties2,
- &compressSetDecoderProperties));
-
- Byte isSolid = (Byte)((IsSolid(index) || item.IsSplitBefore()) ? 1: 0);
- if (solidStart)
- {
- isSolid = false;
- solidStart = false;
- }
-
-
- RINOK(compressSetDecoderProperties->SetDecoderProperties2(&isSolid, 1));
-
- commonCoder = decoder;
- break;
- }
- default:
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
- continue;
- }
- HRESULT result = commonCoder->Code(inStream, outStream, &packSize, &item.Size, progress);
- if (item.IsEncrypted())
- filterStreamSpec->ReleaseInStream();
- if (result == S_FALSE)
- {
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError));
- continue;
- }
- if (result != S_OK)
- return result;
-
- /*
- if (refItem.NumItems == 1 &&
- !item.IsSplitBefore() && !item.IsSplitAfter())
- */
- {
- const CItemEx &lastItem = _items[refItem.ItemIndex + refItem.NumItems - 1];
- bool crcOK = outStreamSpec->GetCRC() == lastItem.FileCRC;
- outStream.Release();
- RINOK(extractCallback->SetOperationResult(crcOK ? NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kCRCError));
- }
- /*
- else
- {
- bool crcOK = true;
- for (int partIndex = 0; partIndex < refItem.NumItems; partIndex++)
- {
- const CItemEx &item = _items[refItem.ItemIndex + partIndex];
- if (item.FileCRC != folderInStreamSpec->CRCs[partIndex])
- {
- crcOK = false;
- break;
- }
- }
- RINOK(extractCallback->SetOperationResult(crcOK ? NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kCRCError));
- }
- */
- }
- return S_OK;
- COM_TRY_END
-}
-
-IMPL_ISetCompressCodecsInfo
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHandler.h
deleted file mode 100644
index 58e3fefcf..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHandler.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Rar/Handler.h
-
-#ifndef __RAR_HANDLER_H
-#define __RAR_HANDLER_H
-
-#include "../IArchive.h"
-#include "RarIn.h"
-#include "RarVolumeInStream.h"
-
-#include "../../Common/CreateCoder.h"
-
-namespace NArchive {
-namespace NRar {
-
-class CHandler:
- public IInArchive,
- PUBLIC_ISetCompressCodecsInfo
- public CMyUnknownImp
-{
-public:
- MY_QUERYINTERFACE_BEGIN2(IInArchive)
- QUERY_ENTRY_ISetCompressCodecsInfo
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
- INTERFACE_IInArchive(;)
-
- DECL_ISetCompressCodecsInfo
-
-private:
- CRecordVector<CRefItem> _refItems;
- CObjectVector<CItemEx> _items;
- CObjectVector<CInArchive> _archives;
- NArchive::NRar::CInArchiveInfo _archiveInfo;
-
- DECL_EXTERNAL_CODECS_VARS
-
- UInt64 GetPackSize(int refIndex) const;
- // NArchive::NRar::CInArchive _archive;
-
- bool IsSolid(int refIndex)
- {
- const CItemEx &item = _items[_refItems[refIndex].ItemIndex];
- if (item.UnPackVersion < 20)
- {
- if (_archiveInfo.IsSolid())
- return (refIndex > 0);
- return false;
- }
- return item.IsSolid();
- }
-
- HRESULT Open2(IInStream *stream,
- const UInt64 *maxCheckStartPosition,
- IArchiveOpenCallback *openArchiveCallback);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHeader.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHeader.cpp
deleted file mode 100644
index 94481e025..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHeader.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// Archive/Rar/Headers.cpp
-
-#include "StdAfx.h"
-
-#include "RarHeader.h"
-
-namespace NArchive{
-namespace NRar{
-namespace NHeader{
-
-Byte kMarker[kMarkerSize] = {0x52 + 1, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00};
-
-class CMarkerInitializer
-{
-public:
- CMarkerInitializer() { kMarker[0]--; };
-};
-
-static CMarkerInitializer markerInitializer;
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHeader.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHeader.h
deleted file mode 100644
index 4df42e628..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarHeader.h
+++ /dev/null
@@ -1,224 +0,0 @@
-// Archive/RarHeader.h
-
-#ifndef __ARCHIVE_RAR_HEADER_H
-#define __ARCHIVE_RAR_HEADER_H
-
-#include "Common/Types.h"
-
-namespace NArchive{
-namespace NRar{
-namespace NHeader{
-
-const int kMarkerSize = 7;
-extern Byte kMarker[kMarkerSize];
-
-const int kArchiveSolid = 0x1;
-
-namespace NBlockType
-{
- enum EBlockType
- {
- kMarker = 0x72,
- kArchiveHeader = 0x73,
- kFileHeader = 0x74,
- kCommentHeader = 0x75,
- kOldAuthenticity = 0x76,
- kSubBlock = 0x77,
- kRecoveryRecord = 0x78,
- kAuthenticity = 0x79,
-
- kEndOfArchive = 0x7B // Is not safe
- };
-}
-
-namespace NArchive
-{
- const UInt16 kVolume = 1;
- const UInt16 kComment = 2;
- const UInt16 kLock = 4;
- const UInt16 kSolid = 8;
- const UInt16 kNewVolName = 0x10; // ('volname.partN.rar')
- const UInt16 kAuthenticity = 0x20;
- const UInt16 kRecovery = 0x40;
- const UInt16 kBlockEncryption = 0x80;
- const UInt16 kFirstVolume = 0x100; // (set only by RAR 3.0 and later)
- const UInt16 kEncryptVer = 0x200; // RAR 3.6 there is EncryptVer Byte in End of MainHeader
-
- const int kHeaderSizeMin = 7;
-
- struct CBlock
- {
- UInt16 CRC;
- Byte Type;
- UInt16 Flags;
- UInt16 Size;
- UInt16 Reserved1;
- UInt32 Reserved2;
- // UInt16 GetRealCRC() const;
- };
-
- const int kArchiveHeaderSize = 13;
-
- const int kBlockHeadersAreEncrypted = 0x80;
-
- struct CHeader360: public CBlock
- {
- Byte EncryptVersion;
- bool IsEncrypted() const { return (Flags & NHeader::NArchive::kBlockEncryption) != 0; }
- bool IsThereEncryptVer() const { return (Flags & NHeader::NArchive::kEncryptVer) != 0; }
- bool IsEncryptOld() const { return (!IsThereEncryptVer() || EncryptVersion < 36); }
- UInt32 GetBaseSize() const { return kArchiveHeaderSize + (IsEncryptOld() ? 0 : 1); }
- };
-}
-
-namespace NFile
-{
- const int kSplitBefore = 1 << 0;
- const int kSplitAfter = 1 << 1;
- const int kEncrypted = 1 << 2;
- const int kComment = 1 << 3;
- const int kSolid = 1 << 4;
-
- const int kDictBitStart = 5;
- const int kNumDictBits = 3;
- const int kDictMask = (1 << kNumDictBits) - 1;
- const int kDictDirectoryValue = 0x7;
-
- const int kSize64Bits = 1 << 8;
- const int kUnicodeName = 1 << 9;
- const int kSalt = 1 << 10;
- const int kOldVersion = 1 << 11;
- const int kExtTime = 1 << 12;
- // const int kExtFlags = 1 << 13;
- // const int kSkipIfUnknown = 1 << 14;
-
- const int kLongBlock = 1 << 15;
-
- /*
- struct CBlock
- {
- // UInt16 HeadCRC;
- // Byte Type;
- // UInt16 Flags;
- // UInt16 HeadSize;
- UInt32 PackSize;
- UInt32 UnPackSize;
- Byte HostOS;
- UInt32 FileCRC;
- UInt32 Time;
- Byte UnPackVersion;
- Byte Method;
- UInt16 NameSize;
- UInt32 Attributes;
- };
- */
-
- /*
- struct CBlock32
- {
- UInt16 HeadCRC;
- Byte Type;
- UInt16 Flags;
- UInt16 HeadSize;
- UInt32 PackSize;
- UInt32 UnPackSize;
- Byte HostOS;
- UInt32 FileCRC;
- UInt32 Time;
- Byte UnPackVersion;
- Byte Method;
- UInt16 NameSize;
- UInt32 Attributes;
- UInt16 GetRealCRC(const void *aName, UInt32 aNameSize,
- bool anExtraDataDefined = false, Byte *anExtraData = 0) const;
- };
- struct CBlock64
- {
- UInt16 HeadCRC;
- Byte Type;
- UInt16 Flags;
- UInt16 HeadSize;
- UInt32 PackSizeLow;
- UInt32 UnPackSizeLow;
- Byte HostOS;
- UInt32 FileCRC;
- UInt32 Time;
- Byte UnPackVersion;
- Byte Method;
- UInt16 NameSize;
- UInt32 Attributes;
- UInt32 PackSizeHigh;
- UInt32 UnPackSizeHigh;
- UInt16 GetRealCRC(const void *aName, UInt32 aNameSize) const;
- };
- */
-
- const int kLabelFileAttribute = 0x08;
- const int kWinFileDirectoryAttributeMask = 0x10;
-
- enum CHostOS
- {
- kHostMSDOS = 0,
- kHostOS2 = 1,
- kHostWin32 = 2,
- kHostUnix = 3,
- kHostMacOS = 4,
- kHostBeOS = 5
- };
-}
-
-namespace NBlock
-{
- const UInt16 kLongBlock = 1 << 15;
- struct CBlock
- {
- UInt16 CRC;
- Byte Type;
- UInt16 Flags;
- UInt16 HeadSize;
- // UInt32 DataSize;
- };
-}
-
-/*
-struct CSubBlock
-{
- UInt16 HeadCRC;
- Byte HeadType;
- UInt16 Flags;
- UInt16 HeadSize;
- UInt32 DataSize;
- UInt16 SubType;
- Byte Level; // Reserved : Must be 0
-};
-
-struct CCommentBlock
-{
- UInt16 HeadCRC;
- Byte HeadType;
- UInt16 Flags;
- UInt16 HeadSize;
- UInt16 UnpSize;
- Byte UnpVer;
- Byte Method;
- UInt16 CommCRC;
-};
-
-
-struct CProtectHeader
-{
- UInt16 HeadCRC;
- Byte HeadType;
- UInt16 Flags;
- UInt16 HeadSize;
- UInt32 DataSize;
- Byte Version;
- UInt16 RecSectors;
- UInt32 TotalBlocks;
- Byte Mark[8];
-};
-*/
-
-}}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarIn.cpp
deleted file mode 100644
index 4810649ba..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarIn.cpp
+++ /dev/null
@@ -1,511 +0,0 @@
-// Archive/RarIn.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/7zCrc.h"
-
-#include "Common/StringConvert.h"
-#include "Common/UTFConvert.h"
-
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/StreamUtils.h"
-
-#include "../Common/FindSignature.h"
-
-#include "RarIn.h"
-
-namespace NArchive {
-namespace NRar {
-
-void CInArchive::ThrowExceptionWithCode(
- CInArchiveException::CCauseType cause)
-{
- throw CInArchiveException(cause);
-}
-
-HRESULT CInArchive::Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit)
-{
- try
- {
- Close();
- HRESULT res = Open2(inStream, searchHeaderSizeLimit);
- if (res == S_OK)
- return res;
- Close();
- return res;
- }
- catch(...) { Close(); throw; }
-}
-
-void CInArchive::Close()
-{
- m_Stream.Release();
-}
-
-
-static inline bool TestMarkerCandidate(const void *aTestBytes)
-{
- for (UInt32 i = 0; i < NHeader::kMarkerSize; i++)
- if (((const Byte *)aTestBytes)[i] != NHeader::kMarker[i])
- return false;
- return true;
-}
-
-HRESULT CInArchive::FindAndReadMarker(IInStream *stream, const UInt64 *searchHeaderSizeLimit)
-{
- RINOK(FindSignatureInStream(stream,
- NHeader::kMarker, NHeader::kMarkerSize,
- searchHeaderSizeLimit, m_ArchiveStartPosition));
- m_Stream = stream;
- m_Position = m_ArchiveStartPosition + NHeader::kMarkerSize;
- return m_Stream->Seek(m_Position, STREAM_SEEK_SET, NULL);
-}
-
-void CInArchive::ThrowUnexpectedEndOfArchiveException()
-{
- ThrowExceptionWithCode(CInArchiveException::kUnexpectedEndOfArchive);
-}
-
-bool CInArchive::ReadBytesAndTestSize(void *data, UInt32 size)
-{
- if (m_CryptoMode)
- {
- const Byte *bufData = (const Byte *)m_DecryptedData;
- UInt32 bufSize = m_DecryptedDataSize;
- UInt32 i;
- for (i = 0; i < size && m_CryptoPos < bufSize; i++)
- ((Byte *)data)[i] = bufData[m_CryptoPos++];
- return (i == size);
- }
- return (ReadStream_FALSE(m_Stream, data, size) == S_OK);
-}
-
-void CInArchive::ReadBytesAndTestResult(void *data, UInt32 size)
-{
- if(!ReadBytesAndTestSize(data,size))
- ThrowUnexpectedEndOfArchiveException();
-}
-
-HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 *processedSize)
-{
- size_t realProcessedSize = size;
- HRESULT result = ReadStream(m_Stream, data, &realProcessedSize);
- if (processedSize != NULL)
- *processedSize = (UInt32)realProcessedSize;
- AddToSeekValue(realProcessedSize);
- return result;
-}
-
-static UInt32 CrcUpdateUInt16(UInt32 crc, UInt16 v)
-{
- crc = CRC_UPDATE_BYTE(crc, (Byte)(v & 0xFF));
- crc = CRC_UPDATE_BYTE(crc, (Byte)((v >> 8) & 0xFF));
- return crc;
-}
-
-static UInt32 CrcUpdateUInt32(UInt32 crc, UInt32 v)
-{
- crc = CRC_UPDATE_BYTE(crc, (Byte)(v & 0xFF));
- crc = CRC_UPDATE_BYTE(crc, (Byte)((v >> 8) & 0xFF));
- crc = CRC_UPDATE_BYTE(crc, (Byte)((v >> 16) & 0xFF));
- crc = CRC_UPDATE_BYTE(crc, (Byte)((v >> 24) & 0xFF));
- return crc;
-}
-
-
-HRESULT CInArchive::Open2(IInStream *stream, const UInt64 *searchHeaderSizeLimit)
-{
- m_CryptoMode = false;
- RINOK(stream->Seek(0, STREAM_SEEK_SET, &m_StreamStartPosition));
- m_Position = m_StreamStartPosition;
-
- RINOK(FindAndReadMarker(stream, searchHeaderSizeLimit));
-
- Byte buf[NHeader::NArchive::kArchiveHeaderSize];
- UInt32 processedSize;
- ReadBytes(buf, sizeof(buf), &processedSize);
- if (processedSize != sizeof(buf))
- return S_FALSE;
- m_CurData = buf;
- m_CurPos = 0;
- m_PosLimit = sizeof(buf);
-
- m_ArchiveHeader.CRC = ReadUInt16();
- m_ArchiveHeader.Type = ReadByte();
- m_ArchiveHeader.Flags = ReadUInt16();
- m_ArchiveHeader.Size = ReadUInt16();
- m_ArchiveHeader.Reserved1 = ReadUInt16();
- m_ArchiveHeader.Reserved2 = ReadUInt32();
- m_ArchiveHeader.EncryptVersion = 0;
-
- UInt32 crc = CRC_INIT_VAL;
- crc = CRC_UPDATE_BYTE(crc, m_ArchiveHeader.Type);
- crc = CrcUpdateUInt16(crc, m_ArchiveHeader.Flags);
- crc = CrcUpdateUInt16(crc, m_ArchiveHeader.Size);
- crc = CrcUpdateUInt16(crc, m_ArchiveHeader.Reserved1);
- crc = CrcUpdateUInt32(crc, m_ArchiveHeader.Reserved2);
-
- if (m_ArchiveHeader.IsThereEncryptVer() && m_ArchiveHeader.Size > NHeader::NArchive::kArchiveHeaderSize)
- {
- ReadBytes(&m_ArchiveHeader.EncryptVersion, 1, &processedSize);
- if (processedSize != 1)
- return S_FALSE;
- crc = CRC_UPDATE_BYTE(crc, m_ArchiveHeader.EncryptVersion);
- }
-
- if(m_ArchiveHeader.CRC != (CRC_GET_DIGEST(crc) & 0xFFFF))
- ThrowExceptionWithCode(CInArchiveException::kArchiveHeaderCRCError);
- if (m_ArchiveHeader.Type != NHeader::NBlockType::kArchiveHeader)
- return S_FALSE;
- m_ArchiveCommentPosition = m_Position;
- m_SeekOnArchiveComment = true;
- return S_OK;
-}
-
-void CInArchive::SkipArchiveComment()
-{
- if (!m_SeekOnArchiveComment)
- return;
- AddToSeekValue(m_ArchiveHeader.Size - m_ArchiveHeader.GetBaseSize());
- m_SeekOnArchiveComment = false;
-}
-
-void CInArchive::GetArchiveInfo(CInArchiveInfo &archiveInfo) const
-{
- archiveInfo.StartPosition = m_ArchiveStartPosition;
- archiveInfo.Flags = m_ArchiveHeader.Flags;
- archiveInfo.CommentPosition = m_ArchiveCommentPosition;
- archiveInfo.CommentSize = (UInt16)(m_ArchiveHeader.Size - NHeader::NArchive::kArchiveHeaderSize);
-}
-
-static void DecodeUnicodeFileName(const char *name, const Byte *encName,
- int encSize, wchar_t *unicodeName, int maxDecSize)
-{
- int encPos = 0;
- int decPos = 0;
- int flagBits = 0;
- Byte flags = 0;
- Byte highByte = encName[encPos++];
- while (encPos < encSize && decPos < maxDecSize)
- {
- if (flagBits == 0)
- {
- flags = encName[encPos++];
- flagBits = 8;
- }
- switch(flags >> 6)
- {
- case 0:
- unicodeName[decPos++] = encName[encPos++];
- break;
- case 1:
- unicodeName[decPos++] = (wchar_t)(encName[encPos++] + (highByte << 8));
- break;
- case 2:
- unicodeName[decPos++] = (wchar_t)(encName[encPos] + (encName[encPos + 1] << 8));
- encPos += 2;
- break;
- case 3:
- {
- int length = encName[encPos++];
- if (length & 0x80)
- {
- Byte correction = encName[encPos++];
- for (length = (length & 0x7f) + 2;
- length > 0 && decPos < maxDecSize; length--, decPos++)
- unicodeName[decPos] = (wchar_t)(((name[decPos] + correction) & 0xff) + (highByte << 8));
- }
- else
- for (length += 2; length > 0 && decPos < maxDecSize; length--, decPos++)
- unicodeName[decPos] = name[decPos];
- }
- break;
- }
- flags <<= 2;
- flagBits -= 2;
- }
- unicodeName[decPos < maxDecSize ? decPos : maxDecSize - 1] = 0;
-}
-
-void CInArchive::ReadName(CItemEx &item, int nameSize)
-{
- item.UnicodeName.Empty();
- if (nameSize > 0)
- {
- m_NameBuffer.EnsureCapacity(nameSize + 1);
- char *buffer = (char *)m_NameBuffer;
-
- for (int i = 0; i < nameSize; i++)
- buffer[i] = ReadByte();
-
- int mainLen;
- for (mainLen = 0; mainLen < nameSize; mainLen++)
- if (buffer[mainLen] == '\0')
- break;
- buffer[mainLen] = '\0';
- item.Name = buffer;
-
- if(item.HasUnicodeName())
- {
- if(mainLen < nameSize)
- {
- int unicodeNameSizeMax = MyMin(nameSize, (0x400));
- _unicodeNameBuffer.EnsureCapacity(unicodeNameSizeMax + 1);
- DecodeUnicodeFileName(buffer, (const Byte *)buffer + mainLen + 1,
- nameSize - (mainLen + 1), _unicodeNameBuffer, unicodeNameSizeMax);
- item.UnicodeName = _unicodeNameBuffer;
- }
- else if (!ConvertUTF8ToUnicode(item.Name, item.UnicodeName))
- item.UnicodeName.Empty();
- }
- }
- else
- item.Name.Empty();
-}
-
-Byte CInArchive::ReadByte()
-{
- if (m_CurPos >= m_PosLimit)
- throw CInArchiveException(CInArchiveException::kIncorrectArchive);
- return m_CurData[m_CurPos++];
-}
-
-UInt16 CInArchive::ReadUInt16()
-{
- UInt16 value = 0;
- for (int i = 0; i < 2; i++)
- {
- Byte b = ReadByte();
- value |= (UInt16(b) << (8 * i));
- }
- return value;
-}
-
-UInt32 CInArchive::ReadUInt32()
-{
- UInt32 value = 0;
- for (int i = 0; i < 4; i++)
- {
- Byte b = ReadByte();
- value |= (UInt32(b) << (8 * i));
- }
- return value;
-}
-
-void CInArchive::ReadTime(Byte mask, CRarTime &rarTime)
-{
- rarTime.LowSecond = (Byte)(((mask & 4) != 0) ? 1 : 0);
- int numDigits = (mask & 3);
- rarTime.SubTime[0] = rarTime.SubTime[1] = rarTime.SubTime[2] = 0;
- for (int i = 0; i < numDigits; i++)
- rarTime.SubTime[3 - numDigits + i] = ReadByte();
-}
-
-void CInArchive::ReadHeaderReal(CItemEx &item)
-{
- item.Flags = m_BlockHeader.Flags;
- item.PackSize = ReadUInt32();
- item.Size = ReadUInt32();
- item.HostOS = ReadByte();
- item.FileCRC = ReadUInt32();
- item.MTime.DosTime = ReadUInt32();
- item.UnPackVersion = ReadByte();
- item.Method = ReadByte();
- int nameSize = ReadUInt16();
- item.Attrib = ReadUInt32();
-
- item.MTime.LowSecond = 0;
- item.MTime.SubTime[0] =
- item.MTime.SubTime[1] =
- item.MTime.SubTime[2] = 0;
-
- if((item.Flags & NHeader::NFile::kSize64Bits) != 0)
- {
- item.PackSize |= ((UInt64)ReadUInt32() << 32);
- item.Size |= ((UInt64)ReadUInt32() << 32);
- }
-
- ReadName(item, nameSize);
-
- if (item.HasSalt())
- for (int i = 0; i < sizeof(item.Salt); i++)
- item.Salt[i] = ReadByte();
-
- // some rar archives have HasExtTime flag without field.
- if (m_CurPos < m_PosLimit && item.HasExtTime())
- {
- Byte accessMask = (Byte)(ReadByte() >> 4);
- Byte b = ReadByte();
- Byte modifMask = (Byte)(b >> 4);
- Byte createMask = (Byte)(b & 0xF);
- if ((modifMask & 8) != 0)
- ReadTime(modifMask, item.MTime);
- item.CTimeDefined = ((createMask & 8) != 0);
- if (item.CTimeDefined)
- {
- item.CTime.DosTime = ReadUInt32();
- ReadTime(createMask, item.CTime);
- }
- item.ATimeDefined = ((accessMask & 8) != 0);
- if (item.ATimeDefined)
- {
- item.ATime.DosTime = ReadUInt32();
- ReadTime(accessMask, item.ATime);
- }
- }
-
- UInt16 fileHeaderWithNameSize = (UInt16)m_CurPos;
-
- item.Position = m_Position;
- item.MainPartSize = fileHeaderWithNameSize;
- item.CommentSize = (UInt16)(m_BlockHeader.HeadSize - fileHeaderWithNameSize);
-
- if (m_CryptoMode)
- item.AlignSize = (UInt16)((16 - ((m_BlockHeader.HeadSize) & 0xF)) & 0xF);
- else
- item.AlignSize = 0;
- AddToSeekValue(m_BlockHeader.HeadSize);
-}
-
-void CInArchive::AddToSeekValue(UInt64 addValue)
-{
- m_Position += addValue;
-}
-
-HRESULT CInArchive::GetNextItem(CItemEx &item, ICryptoGetTextPassword *getTextPassword)
-{
- if (m_SeekOnArchiveComment)
- SkipArchiveComment();
- for (;;)
- {
- if(!SeekInArchive(m_Position))
- return S_FALSE;
- if (!m_CryptoMode && (m_ArchiveHeader.Flags &
- NHeader::NArchive::kBlockHeadersAreEncrypted) != 0)
- {
- m_CryptoMode = false;
- if (getTextPassword == 0)
- return S_FALSE;
- if(!SeekInArchive(m_Position))
- return S_FALSE;
- if (!m_RarAES)
- {
- m_RarAESSpec = new NCrypto::NRar29::CDecoder;
- m_RarAES = m_RarAESSpec;
- }
- m_RarAESSpec->SetRar350Mode(m_ArchiveHeader.IsEncryptOld());
-
- // Salt
- const UInt32 kSaltSize = 8;
- Byte salt[kSaltSize];
- if(!ReadBytesAndTestSize(salt, kSaltSize))
- return S_FALSE;
- m_Position += kSaltSize;
- RINOK(m_RarAESSpec->SetDecoderProperties2(salt, kSaltSize))
- // Password
- CMyComBSTR password;
- RINOK(getTextPassword->CryptoGetTextPassword(&password))
- UString unicodePassword(password);
-
- CByteBuffer buffer;
- const UInt32 sizeInBytes = unicodePassword.Length() * 2;
- buffer.SetCapacity(sizeInBytes);
- for (int i = 0; i < unicodePassword.Length(); i++)
- {
- wchar_t c = unicodePassword[i];
- ((Byte *)buffer)[i * 2] = (Byte)c;
- ((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8);
- }
-
- RINOK(m_RarAESSpec->CryptoSetPassword((const Byte *)buffer, sizeInBytes));
-
- const UInt32 kDecryptedBufferSize = (1 << 12);
- if (m_DecryptedData.GetCapacity() == 0)
- {
- m_DecryptedData.SetCapacity(kDecryptedBufferSize);
- }
- RINOK(m_RarAES->Init());
- size_t decryptedDataSizeT = kDecryptedBufferSize;
- RINOK(ReadStream(m_Stream, (Byte *)m_DecryptedData, &decryptedDataSizeT));
- m_DecryptedDataSize = (UInt32)decryptedDataSizeT;
- m_DecryptedDataSize = m_RarAES->Filter((Byte *)m_DecryptedData, m_DecryptedDataSize);
-
- m_CryptoMode = true;
- m_CryptoPos = 0;
- }
-
- m_FileHeaderData.EnsureCapacity(7);
- if(!ReadBytesAndTestSize((Byte *)m_FileHeaderData, 7))
- return S_FALSE;
-
- m_CurData = (Byte *)m_FileHeaderData;
- m_CurPos = 0;
- m_PosLimit = 7;
- m_BlockHeader.CRC = ReadUInt16();
- m_BlockHeader.Type = ReadByte();
- m_BlockHeader.Flags = ReadUInt16();
- m_BlockHeader.HeadSize = ReadUInt16();
-
- if (m_BlockHeader.HeadSize < 7)
- ThrowExceptionWithCode(CInArchiveException::kIncorrectArchive);
-
- if (m_BlockHeader.Type == NHeader::NBlockType::kEndOfArchive)
- return S_FALSE;
-
- if (m_BlockHeader.Type == NHeader::NBlockType::kFileHeader)
- {
- m_FileHeaderData.EnsureCapacity(m_BlockHeader.HeadSize);
- m_CurData = (Byte *)m_FileHeaderData;
- m_PosLimit = m_BlockHeader.HeadSize;
- ReadBytesAndTestResult(m_CurData + m_CurPos, m_BlockHeader.HeadSize - 7);
- ReadHeaderReal(item);
- if ((CrcCalc(m_CurData + 2,
- m_BlockHeader.HeadSize - item.CommentSize - 2) & 0xFFFF) != m_BlockHeader.CRC)
- ThrowExceptionWithCode(CInArchiveException::kFileHeaderCRCError);
-
- FinishCryptoBlock();
- m_CryptoMode = false;
- SeekInArchive(m_Position); // Move Position to compressed Data;
- AddToSeekValue(item.PackSize); // m_Position points to next header;
- return S_OK;
- }
- if (m_CryptoMode && m_BlockHeader.HeadSize > (1 << 12))
- return E_FAIL; // it's for bad passwords
- if ((m_BlockHeader.Flags & NHeader::NBlock::kLongBlock) != 0)
- {
- m_FileHeaderData.EnsureCapacity(7 + 4);
- m_CurData = (Byte *)m_FileHeaderData;
- ReadBytesAndTestResult(m_CurData + m_CurPos, 4); // test it
- m_PosLimit = 7 + 4;
- UInt32 dataSize = ReadUInt32();
- AddToSeekValue(dataSize);
- if (m_CryptoMode && dataSize > (1 << 27))
- return E_FAIL; // it's for bad passwords
- m_CryptoPos = m_BlockHeader.HeadSize;
- }
- else
- m_CryptoPos = 0;
- AddToSeekValue(m_BlockHeader.HeadSize);
- FinishCryptoBlock();
- m_CryptoMode = false;
- }
-}
-
-bool CInArchive::SeekInArchive(UInt64 position)
-{
- UInt64 newPosition;
- m_Stream->Seek(position, STREAM_SEEK_SET, &newPosition);
- return newPosition == position;
-}
-
-ISequentialInStream* CInArchive::CreateLimitedStream(UInt64 position, UInt64 size)
-{
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- SeekInArchive(position);
- streamSpec->SetStream(m_Stream);
- streamSpec->Init(size);
- return inStream.Detach();
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarIn.h
deleted file mode 100644
index ff97a1090..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarIn.h
+++ /dev/null
@@ -1,126 +0,0 @@
-// RarIn.h
-
-#ifndef __ARCHIVE_RAR_IN_H
-#define __ARCHIVE_RAR_IN_H
-
-#include "Common/DynamicBuffer.h"
-#include "Common/MyCom.h"
-
-#include "../../ICoder.h"
-#include "../../IStream.h"
-
-#include "../../Common/StreamObjects.h"
-
-#include "../../Crypto/RarAes.h"
-
-#include "RarHeader.h"
-#include "RarItem.h"
-
-namespace NArchive {
-namespace NRar {
-
-class CInArchiveException
-{
-public:
- enum CCauseType
- {
- kUnexpectedEndOfArchive = 0,
- kArchiveHeaderCRCError,
- kFileHeaderCRCError,
- kIncorrectArchive
- }
- Cause;
- CInArchiveException(CCauseType cause) : Cause(cause) {}
-};
-
-class CInArchiveInfo
-{
-public:
- UInt64 StartPosition;
- UInt16 Flags;
- UInt64 CommentPosition;
- UInt16 CommentSize;
- bool IsSolid() const { return (Flags & NHeader::NArchive::kSolid) != 0; }
- bool IsCommented() const { return (Flags & NHeader::NArchive::kComment) != 0; }
- bool IsVolume() const { return (Flags & NHeader::NArchive::kVolume) != 0; }
- bool HaveNewVolumeName() const { return (Flags & NHeader::NArchive::kNewVolName) != 0; }
- bool IsEncrypted() const { return (Flags & NHeader::NArchive::kBlockEncryption) != 0; }
-};
-
-class CInArchive
-{
- CMyComPtr<IInStream> m_Stream;
-
- UInt64 m_StreamStartPosition;
- UInt64 m_Position;
- UInt64 m_ArchiveStartPosition;
-
- NHeader::NArchive::CHeader360 m_ArchiveHeader;
- CDynamicBuffer<char> m_NameBuffer;
- CDynamicBuffer<wchar_t> _unicodeNameBuffer;
- bool m_SeekOnArchiveComment;
- UInt64 m_ArchiveCommentPosition;
-
- void ReadName(CItemEx &item, int nameSize);
- void ReadHeaderReal(CItemEx &item);
-
- HRESULT ReadBytes(void *data, UInt32 size, UInt32 *aProcessedSize);
- bool ReadBytesAndTestSize(void *data, UInt32 size);
- void ReadBytesAndTestResult(void *data, UInt32 size);
-
- HRESULT FindAndReadMarker(IInStream *stream, const UInt64 *searchHeaderSizeLimit);
- HRESULT Open2(IInStream *stream, const UInt64 *searchHeaderSizeLimit);
-
- void ThrowExceptionWithCode(CInArchiveException::CCauseType cause);
- void ThrowUnexpectedEndOfArchiveException();
-
- void AddToSeekValue(UInt64 addValue);
-
-protected:
-
- CDynamicBuffer<Byte> m_FileHeaderData;
-
- NHeader::NBlock::CBlock m_BlockHeader;
-
- NCrypto::NRar29::CDecoder *m_RarAESSpec;
- CMyComPtr<ICompressFilter> m_RarAES;
-
- Byte *m_CurData; // it must point to start of Rar::Block
- UInt32 m_CurPos;
- UInt32 m_PosLimit;
- Byte ReadByte();
- UInt16 ReadUInt16();
- UInt32 ReadUInt32();
- void ReadTime(Byte mask, CRarTime &rarTime);
-
- CBuffer<Byte> m_DecryptedData;
- UInt32 m_DecryptedDataSize;
-
- bool m_CryptoMode;
- UInt32 m_CryptoPos;
- void FinishCryptoBlock()
- {
- if (m_CryptoMode)
- while ((m_CryptoPos & 0xF) != 0)
- {
- m_CryptoPos++;
- m_Position++;
- }
- }
-
-public:
- HRESULT Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit);
- void Close();
- HRESULT GetNextItem(CItemEx &item, ICryptoGetTextPassword *getTextPassword);
-
- void SkipArchiveComment();
-
- void GetArchiveInfo(CInArchiveInfo &archiveInfo) const;
-
- bool SeekInArchive(UInt64 position);
- ISequentialInStream *CreateLimitedStream(UInt64 position, UInt64 size);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarItem.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarItem.cpp
deleted file mode 100644
index 9216ae57b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarItem.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// RarItem.cpp
-
-#include "StdAfx.h"
-
-#include "RarItem.h"
-
-namespace NArchive{
-namespace NRar{
-
-bool CItem::IgnoreItem() const
-{
- switch(HostOS)
- {
- case NHeader::NFile::kHostMSDOS:
- case NHeader::NFile::kHostOS2:
- case NHeader::NFile::kHostWin32:
- return ((Attrib & NHeader::NFile::kLabelFileAttribute) != 0);
- }
- return false;
-}
-
-bool CItem::IsDir() const
-{
- if (GetDictSize() == NHeader::NFile::kDictDirectoryValue)
- return true;
- switch(HostOS)
- {
- case NHeader::NFile::kHostMSDOS:
- case NHeader::NFile::kHostOS2:
- case NHeader::NFile::kHostWin32:
- if ((Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0)
- return true;
- }
- return false;
-}
-
-UInt32 CItem::GetWinAttributes() const
-{
- UInt32 winAttributes;
- switch(HostOS)
- {
- case NHeader::NFile::kHostMSDOS:
- case NHeader::NFile::kHostOS2:
- case NHeader::NFile::kHostWin32:
- winAttributes = Attrib;
- break;
- default:
- winAttributes = 0; // must be converted from unix value;
- }
- if (IsDir())
- winAttributes |= NHeader::NFile::kWinFileDirectoryAttributeMask;
- return winAttributes;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarItem.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarItem.h
deleted file mode 100644
index 4aa4d8667..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarItem.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// RarItem.h
-
-#ifndef __ARCHIVE_RAR_ITEM_H
-#define __ARCHIVE_RAR_ITEM_H
-
-#include "Common/Types.h"
-#include "Common/MyString.h"
-
-#include "RarHeader.h"
-
-namespace NArchive{
-namespace NRar{
-
-struct CRarTime
-{
- UInt32 DosTime;
- Byte LowSecond;
- Byte SubTime[3];
-};
-
-struct CItem
-{
- UInt64 Size;
- UInt64 PackSize;
-
- CRarTime CTime;
- CRarTime ATime;
- CRarTime MTime;
-
- UInt32 FileCRC;
- UInt32 Attrib;
-
- UInt16 Flags;
- Byte HostOS;
- Byte UnPackVersion;
- Byte Method;
-
- bool CTimeDefined;
- bool ATimeDefined;
-
- AString Name;
- UString UnicodeName;
-
- Byte Salt[8];
-
- bool IsEncrypted() const { return (Flags & NHeader::NFile::kEncrypted) != 0; }
- bool IsSolid() const { return (Flags & NHeader::NFile::kSolid) != 0; }
- bool IsCommented() const { return (Flags & NHeader::NFile::kComment) != 0; }
- bool IsSplitBefore() const { return (Flags & NHeader::NFile::kSplitBefore) != 0; }
- bool IsSplitAfter() const { return (Flags & NHeader::NFile::kSplitAfter) != 0; }
- bool HasSalt() const { return (Flags & NHeader::NFile::kSalt) != 0; }
- bool HasExtTime() const { return (Flags & NHeader::NFile::kExtTime) != 0; }
- bool HasUnicodeName()const { return (Flags & NHeader::NFile::kUnicodeName) != 0; }
- bool IsOldVersion() const { return (Flags & NHeader::NFile::kOldVersion) != 0; }
-
- UInt32 GetDictSize() const { return (Flags >> NHeader::NFile::kDictBitStart) & NHeader::NFile::kDictMask; }
- bool IsDir() const;
- bool IgnoreItem() const;
- UInt32 GetWinAttributes() const;
-
- CItem(): CTimeDefined(false), ATimeDefined(false) {}
-};
-
-class CItemEx: public CItem
-{
-public:
- UInt64 Position;
- UInt16 MainPartSize;
- UInt16 CommentSize;
- UInt16 AlignSize;
- UInt64 GetFullSize() const { return MainPartSize + CommentSize + AlignSize + PackSize; };
- // DWORD GetHeaderWithCommentSize() const { return MainPartSize + CommentSize; };
- UInt64 GetCommentPosition() const { return Position + MainPartSize; };
- UInt64 GetDataPosition() const { return GetCommentPosition() + CommentSize + AlignSize; };
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarRegister.cpp
deleted file mode 100644
index a79fd0264..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarRegister.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RarRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "RarHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NRar::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Rar", L"rar r00", 0, 3, {0x52 , 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00}, 7, false, CreateArc, 0, };
-
-REGISTER_ARC(Rar)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp
deleted file mode 100644
index 25194f915..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// RarVolumeInStream.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/7zCrc.h"
-
-#include "RarVolumeInStream.h"
-
-namespace NArchive {
-namespace NRar {
-
-void CFolderInStream::Init(
- CObjectVector<CInArchive> *archives,
- const CObjectVector<CItemEx> *items,
- const CRefItem &refItem)
-{
- _archives = archives;
- _items = items;
- _refItem = refItem;
- _curIndex = 0;
- CRCs.Clear();
- _fileIsOpen = false;
-}
-
-HRESULT CFolderInStream::OpenStream()
-{
- while (_curIndex < _refItem.NumItems)
- {
- const CItemEx &item = (*_items)[_refItem.ItemIndex + _curIndex];
- _stream.Attach((*_archives)[_refItem.VolumeIndex + _curIndex].
- CreateLimitedStream(item.GetDataPosition(), item.PackSize));
- _curIndex++;
- _fileIsOpen = true;
- _crc = CRC_INIT_VAL;
- return S_OK;
- }
- return S_OK;
-}
-
-HRESULT CFolderInStream::CloseStream()
-{
- CRCs.Add(CRC_GET_DIGEST(_crc));
- _stream.Release();
- _fileIsOpen = false;
- return S_OK;
-}
-
-STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize = 0;
- while ((_curIndex < _refItem.NumItems || _fileIsOpen) && size > 0)
- {
- if (_fileIsOpen)
- {
- UInt32 localProcessedSize;
- RINOK(_stream->Read(
- ((Byte *)data) + realProcessedSize, size, &localProcessedSize));
- _crc = CrcUpdate(_crc, ((Byte *)data) + realProcessedSize, localProcessedSize);
- if (localProcessedSize == 0)
- {
- RINOK(CloseStream());
- continue;
- }
- realProcessedSize += localProcessedSize;
- size -= localProcessedSize;
- break;
- }
- else
- {
- RINOK(OpenStream());
- }
- }
- if (processedSize != 0)
- *processedSize = realProcessedSize;
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarVolumeInStream.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarVolumeInStream.h
deleted file mode 100644
index 78d95b10f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Rar/RarVolumeInStream.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// RarVolumeInStream.h
-
-#ifndef __RAR_VOLUME_IN_STREAM_H
-#define __RAR_VOLUME_IN_STREAM_H
-
-#include "../../IStream.h"
-#include "RarIn.h"
-
-namespace NArchive {
-namespace NRar {
-
-struct CRefItem
-{
- int VolumeIndex;
- int ItemIndex;
- int NumItems;
-};
-
-class CFolderInStream:
- public ISequentialInStream,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-
-private:
- CObjectVector<CInArchive> *_archives;
- const CObjectVector<CItemEx> *_items;
- CRefItem _refItem;
- int _curIndex;
- UInt32 _crc;
- bool _fileIsOpen;
- CMyComPtr<ISequentialInStream> _stream;
-
- HRESULT OpenStream();
- HRESULT CloseStream();
-public:
- void Init(CObjectVector<CInArchive> *archives,
- const CObjectVector<CItemEx> *items,
- const CRefItem &refItem);
-
- CRecordVector<UInt32> CRCs;
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/RpmHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/RpmHandler.cpp
deleted file mode 100644
index 13b67390c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/RpmHandler.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-// RpmHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/ComTry.h"
-#include "Common/MyString.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-
-using namespace NWindows;
-
-#define Get16(p) GetBe16(p)
-#define Get32(p) GetBe32(p)
-
-namespace NArchive {
-namespace NRpm {
-
-/* Reference: lib/signature.h of rpm package */
-#define RPMSIG_NONE 0 /* Do not change! */
-/* The following types are no longer generated */
-#define RPMSIG_PGP262_1024 1 /* No longer generated */ /* 256 byte */
-/* These are the new-style signatures. They are Header structures. */
-/* Inside them we can put any number of any type of signature we like. */
-
-#define RPMSIG_HEADERSIG 5 /* New Header style signature */
-
-const UInt32 kLeadSize = 96;
-struct CLead
-{
- unsigned char Magic[4];
- unsigned char Major; // not supported ver1, only support 2,3 and lator
- unsigned char Minor;
- UInt16 Type;
- UInt16 ArchNum;
- char Name[66];
- UInt16 OSNum;
- UInt16 SignatureType;
- char Reserved[16]; // pad to 96 bytes -- 8 byte aligned
- bool MagicCheck() const
- { return Magic[0] == 0xed && Magic[1] == 0xab && Magic[2] == 0xee && Magic[3] == 0xdb; };
-};
-
-const UInt32 kEntryInfoSize = 16;
-/*
-struct CEntryInfo
-{
- int Tag;
- int Type;
- int Offset; // Offset from beginning of data segment, only defined on disk
- int Count;
-};
-*/
-
-// case: SignatureType == RPMSIG_HEADERSIG
-const UInt32 kCSigHeaderSigSize = 16;
-struct CSigHeaderSig
-{
- unsigned char Magic[4];
- UInt32 Reserved;
- UInt32 IndexLen; // count of index entries
- UInt32 DataLen; // number of bytes
- bool MagicCheck()
- { return Magic[0] == 0x8e && Magic[1] == 0xad && Magic[2] == 0xe8 && Magic[3] == 0x01; };
- UInt32 GetLostHeaderLen()
- { return IndexLen * kEntryInfoSize + DataLen; };
-};
-
-static HRESULT RedSigHeaderSig(IInStream *inStream, CSigHeaderSig &h)
-{
- char dat[kCSigHeaderSigSize];
- char *cur = dat;
- RINOK(ReadStream_FALSE(inStream, dat, kCSigHeaderSigSize));
- memmove(h.Magic, cur, 4);
- cur += 4;
- cur += 4;
- h.IndexLen = Get32(cur);
- cur += 4;
- h.DataLen = Get32(cur);
- return S_OK;
-}
-
-HRESULT OpenArchive(IInStream *inStream)
-{
- UInt64 pos;
- char leadData[kLeadSize];
- char *cur = leadData;
- CLead lead;
- RINOK(ReadStream_FALSE(inStream, leadData, kLeadSize));
- memmove(lead.Magic, cur, 4);
- cur += 4;
- lead.Major = *cur++;
- lead.Minor = *cur++;
- lead.Type = Get16(cur);
- cur += 2;
- lead.ArchNum = Get16(cur);
- cur += 2;
- memmove(lead.Name, cur, sizeof(lead.Name));
- cur += sizeof(lead.Name);
- lead.OSNum = Get16(cur);
- cur += 2;
- lead.SignatureType = Get16(cur);
- cur += 2;
-
- if (!lead.MagicCheck() || lead.Major < 3)
- return S_FALSE;
-
- CSigHeaderSig sigHeader, header;
- if (lead.SignatureType == RPMSIG_NONE)
- {
- ;
- }
- else if (lead.SignatureType == RPMSIG_PGP262_1024)
- {
- UInt64 pos;
- RINOK(inStream->Seek(256, STREAM_SEEK_CUR, &pos));
- }
- else if (lead.SignatureType == RPMSIG_HEADERSIG)
- {
- RINOK(RedSigHeaderSig(inStream, sigHeader));
- if (!sigHeader.MagicCheck())
- return S_FALSE;
- UInt32 len = sigHeader.GetLostHeaderLen();
- RINOK(inStream->Seek(len, STREAM_SEEK_CUR, &pos));
- if ((pos % 8) != 0)
- {
- RINOK(inStream->Seek((pos / 8 + 1) * 8 - pos,
- STREAM_SEEK_CUR, &pos));
- }
- }
- else
- return S_FALSE;
-
- RINOK(RedSigHeaderSig(inStream, header));
- if (!header.MagicCheck())
- return S_FALSE;
- int headerLen = header.GetLostHeaderLen();
- if (headerLen == -1)
- return S_FALSE;
- RINOK(inStream->Seek(headerLen, STREAM_SEEK_CUR, &pos));
- return S_OK;
-}
-
-class CHandler:
- public IInArchive,
- public IInArchiveGetStream,
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _stream;
- UInt64 _pos;
- UInt64 _size;
- Byte _sig[4];
-public:
- MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
- INTERFACE_IInArchive(;)
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-};
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidSize, VT_UI8}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO_Table
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- NCOM::CPropVariant prop;
- switch(propID) { case kpidMainSubfile: prop = (UInt32)0; break; }
- prop.Detach(value);
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- try
- {
- Close();
- if (OpenArchive(inStream) != S_OK)
- return S_FALSE;
- RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &_pos));
- RINOK(ReadStream_FALSE(inStream, _sig, sizeof(_sig) / sizeof(_sig[0])));
- UInt64 endPosition;
- RINOK(inStream->Seek(0, STREAM_SEEK_END, &endPosition));
- _size = endPosition - _pos;
- _stream = inStream;
- return S_OK;
- }
- catch(...) { return S_FALSE; }
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _stream.Release();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = 1;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value)
-{
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidSize:
- case kpidPackSize:
- prop = _size;
- break;
- case kpidExtension:
- {
- char s[32];
- MyStringCopy(s, "cpio.");
- const char *ext;
- if (_sig[0] == 0x1F && _sig[1] == 0x8B)
- ext = "gz";
- else if (_sig[0] == 'B' && _sig[1] == 'Z' && _sig[2] == 'h')
- ext = "bz2";
- else
- ext = "lzma";
- MyStringCopy(s + MyStringLen(s), ext);
- prop = s;
- break;
- }
- }
- prop.Detach(value);
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- if (numItems == UInt32(-1))
- numItems = 1;
- if (numItems == 0)
- return S_OK;
- if (numItems != 1 || indices[0] != 0)
- return E_INVALIDARG;
-
- bool testMode = (_aTestMode != 0);
-
- RINOK(extractCallback->SetTotal(_size));
- CMyComPtr<ISequentialOutStream> outStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- RINOK(extractCallback->GetStream(0, &outStream, askMode));
- if (!testMode && !outStream)
- return S_OK;
- RINOK(extractCallback->PrepareOperation(askMode));
-
-
- CMyComPtr<ICompressCoder> copyCoder = new NCompress::CCopyCoder;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- RINOK(_stream->Seek(_pos, STREAM_SEEK_SET, NULL));
- RINOK(copyCoder->Code(_stream, outStream, NULL, NULL, progress));
- outStream.Release();
- return extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK);
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetStream(UInt32 /* index */, ISequentialInStream **stream)
-{
- COM_TRY_BEGIN
- return CreateLimitedInStream(_stream, _pos, _size, stream);
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new NArchive::NRpm::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Rpm", L"rpm", 0, 0xEB, { 0xED, 0xAB, 0xEE, 0xDB}, 4, false, CreateArc, 0 };
-
-REGISTER_ARC(Rpm)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/SplitHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/SplitHandler.cpp
deleted file mode 100644
index e43679354..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/SplitHandler.cpp
+++ /dev/null
@@ -1,374 +0,0 @@
-// SplitHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/MyString.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-
-#include "../Compress/CopyCoder.h"
-
-#include "Common/MultiStream.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NSplit {
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidSize, VT_UI8}
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidNumVolumes, VT_UI4}
-};
-
-class CHandler:
- public IInArchive,
- public IInArchiveGetStream,
- public CMyUnknownImp
-{
- UString _subName;
- CObjectVector<CMyComPtr<IInStream> > _streams;
- CRecordVector<UInt64> _sizes;
- UInt64 _totalSize;
-public:
- MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
- INTERFACE_IInArchive(;)
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidMainSubfile: prop = (UInt32)0; break;
- case kpidNumVolumes: prop = (UInt32)_streams.Size(); break;
- }
- prop.Detach(value);
- return S_OK;
-}
-
-struct CSeqName
-{
- UString _unchangedPart;
- UString _changedPart;
- bool _splitStyle;
-
- UString GetNextName()
- {
- UString newName;
- if (_splitStyle)
- {
- int i;
- int numLetters = _changedPart.Length();
- for (i = numLetters - 1; i >= 0; i--)
- {
- wchar_t c = _changedPart[i];
- if (c == 'z')
- {
- c = 'a';
- newName = c + newName;
- continue;
- }
- else if (c == 'Z')
- {
- c = 'A';
- newName = c + newName;
- continue;
- }
- c++;
- if ((c == 'z' || c == 'Z') && i == 0)
- {
- _unchangedPart += c;
- wchar_t newChar = (c == 'z') ? L'a' : L'A';
- newName.Empty();
- numLetters++;
- for (int k = 0; k < numLetters; k++)
- newName += newChar;
- break;
- }
- newName = c + newName;
- i--;
- for (; i >= 0; i--)
- newName = _changedPart[i] + newName;
- break;
- }
- }
- else
- {
- int i;
- int numLetters = _changedPart.Length();
- for (i = numLetters - 1; i >= 0; i--)
- {
- wchar_t c = _changedPart[i];
- if (c == L'9')
- {
- c = L'0';
- newName = c + newName;
- if (i == 0)
- newName = UString(L'1') + newName;
- continue;
- }
- c++;
- newName = c + newName;
- i--;
- for (; i >= 0; i--)
- newName = _changedPart[i] + newName;
- break;
- }
- }
- _changedPart = newName;
- return _unchangedPart + _changedPart;
- }
-};
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback *openArchiveCallback)
-{
- COM_TRY_BEGIN
- Close();
- if (openArchiveCallback == 0)
- return S_FALSE;
- // try
- {
- CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
- CMyComPtr<IArchiveOpenCallback> openArchiveCallbackWrap = openArchiveCallback;
- if (openArchiveCallbackWrap.QueryInterface(IID_IArchiveOpenVolumeCallback,
- &openVolumeCallback) != S_OK)
- return S_FALSE;
-
- UString name;
- {
- NCOM::CPropVariant prop;
- RINOK(openVolumeCallback->GetProperty(kpidName, &prop));
- if (prop.vt != VT_BSTR)
- return S_FALSE;
- name = prop.bstrVal;
- }
-
- int dotPos = name.ReverseFind('.');
- UString prefix, ext;
- if (dotPos >= 0)
- {
- prefix = name.Left(dotPos + 1);
- ext = name.Mid(dotPos + 1);
- }
- else
- ext = name;
- UString extBig = ext;
- extBig.MakeUpper();
-
- CSeqName seqName;
-
- int numLetters = 2;
- bool splitStyle = false;
- if (extBig.Right(2) == L"AA")
- {
- splitStyle = true;
- while (numLetters < extBig.Length())
- {
- if (extBig[extBig.Length() - numLetters - 1] != 'A')
- break;
- numLetters++;
- }
- }
- else if (ext.Right(2) == L"01")
- {
- while (numLetters < extBig.Length())
- {
- if (extBig[extBig.Length() - numLetters - 1] != '0')
- break;
- numLetters++;
- }
- if (numLetters != ext.Length())
- return S_FALSE;
- }
- else
- return S_FALSE;
-
- _streams.Add(stream);
-
- seqName._unchangedPart = prefix + ext.Left(extBig.Length() - numLetters);
- seqName._changedPart = ext.Right(numLetters);
- seqName._splitStyle = splitStyle;
-
- if (prefix.Length() < 1)
- _subName = L"file";
- else
- _subName = prefix.Left(prefix.Length() - 1);
-
- _totalSize = 0;
- UInt64 size;
- {
- NCOM::CPropVariant prop;
- RINOK(openVolumeCallback->GetProperty(kpidSize, &prop));
- if (prop.vt != VT_UI8)
- return E_INVALIDARG;
- size = prop.uhVal.QuadPart;
- }
- _totalSize += size;
- _sizes.Add(size);
-
- if (openArchiveCallback != NULL)
- {
- UInt64 numFiles = _streams.Size();
- RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL));
- }
-
- for (;;)
- {
- UString fullName = seqName.GetNextName();
- CMyComPtr<IInStream> nextStream;
- HRESULT result = openVolumeCallback->GetStream(fullName, &nextStream);
- if (result == S_FALSE)
- break;
- if (result != S_OK)
- return result;
- if (!stream)
- break;
- {
- NCOM::CPropVariant prop;
- RINOK(openVolumeCallback->GetProperty(kpidSize, &prop));
- if (prop.vt != VT_UI8)
- return E_INVALIDARG;
- size = prop.uhVal.QuadPart;
- }
- _totalSize += size;
- _sizes.Add(size);
- _streams.Add(nextStream);
- if (openArchiveCallback != NULL)
- {
- UInt64 numFiles = _streams.Size();
- RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL));
- }
- }
- }
- /*
- catch(...)
- {
- return S_FALSE;
- }
- */
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _sizes.Clear();
- _streams.Clear();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _streams.IsEmpty() ? 0 : 1;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value)
-{
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidPath: prop = _subName; break;
- case kpidSize:
- case kpidPackSize:
- prop = _totalSize;
- break;
- }
- prop.Detach(value);
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- if (numItems == UInt32(-1))
- numItems = 1;
- if (numItems == 0)
- return S_OK;
- if (numItems != 1 || indices[0] != 0)
- return E_INVALIDARG;
-
- bool testMode = (_aTestMode != 0);
- UInt64 currentTotalSize = 0;
- RINOK(extractCallback->SetTotal(_totalSize));
- CMyComPtr<ISequentialOutStream> outStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- RINOK(extractCallback->GetStream(0, &outStream, askMode));
- if (!testMode && !outStream)
- return S_OK;
- RINOK(extractCallback->PrepareOperation(askMode));
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder;
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- for (int i = 0; i < _streams.Size(); i++)
- {
- lps->InSize = lps->OutSize = currentTotalSize;
- RINOK(lps->SetCur());
- IInStream *inStream = _streams[i];
- RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
- RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
- currentTotalSize += copyCoderSpec->TotalSize;
- }
- outStream.Release();
- return extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK);
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
-{
- COM_TRY_BEGIN
- if (index != 0)
- return E_INVALIDARG;
- *stream = 0;
- CMultiStream *streamSpec = new CMultiStream;
- CMyComPtr<ISequentialInStream> streamTemp = streamSpec;
- for (int i = 0; i < _streams.Size(); i++)
- {
- CMultiStream::CSubStreamInfo subStreamInfo;
- subStreamInfo.Stream = _streams[i];
- subStreamInfo.Pos = 0;
- subStreamInfo.Size = _sizes[i];
- streamSpec->Streams.Add(subStreamInfo);
- }
- streamSpec->Init();
- *stream = streamTemp.Detach();
- return S_OK;
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
-{ L"Split", L"001", 0, 0xEA, { 0 }, 0, false, CreateArc, 0 };
-
-REGISTER_ARC(Split)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHandler.cpp
deleted file mode 100644
index 6f0ec53a6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHandler.cpp
+++ /dev/null
@@ -1,342 +0,0 @@
-// TarHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/Defs.h"
-#include "Common/NewHandler.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/ProgressUtils.h"
-
-#include "../Common/ItemNameUtils.h"
-
-#include "TarHandler.h"
-#include "TarIn.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NTar {
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidPosixAttrib, VT_UI4},
- { NULL, kpidUser, VT_BSTR},
- { NULL, kpidGroup, VT_BSTR},
- { NULL, kpidLink, VT_BSTR}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO_Table
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidPhySize: if (_phySizeDefined) prop = _phySize; break;
- }
- prop.Detach(value);
- return S_OK;
-}
-
-HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
-{
- UInt64 endPos = 0;
- {
- RINOK(stream->Seek(0, STREAM_SEEK_END, &endPos));
- RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL));
- }
-
- _isGood = true;
- UInt64 pos = 0;
- for (;;)
- {
- CItemEx item;
- bool filled;
- item.HeaderPosition = pos;
- RINOK(ReadItem(stream, filled, item));
- if (!filled)
- break;
- _items.Add(item);
-
- RINOK(stream->Seek(item.GetPackSize(), STREAM_SEEK_CUR, &pos));
- if (pos > endPos)
- return S_FALSE;
- if (pos == endPos)
- {
- _isGood = false;
- break;
- }
- if (callback != NULL)
- {
- if (_items.Size() == 1)
- {
- RINOK(callback->SetTotal(NULL, &endPos));
- }
- if (_items.Size() % 100 == 0)
- {
- UInt64 numFiles = _items.Size();
- RINOK(callback->SetCompleted(&numFiles, &pos));
- }
- }
- }
-
- if (_items.Size() == 0)
- {
- CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
- if (!callback)
- return S_FALSE;
- callback->QueryInterface(IID_IArchiveOpenVolumeCallback, (void **)&openVolumeCallback);
- if (!openVolumeCallback)
- return S_FALSE;
- NCOM::CPropVariant prop;
- if (openVolumeCallback->GetProperty(kpidName, &prop) != S_OK)
- return S_FALSE;
- if (prop.vt != VT_BSTR)
- return S_FALSE;
- UString baseName = prop.bstrVal;
- baseName = baseName.Right(4);
- if (baseName.CompareNoCase(L".tar") != 0)
- return S_FALSE;
- }
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 *, IArchiveOpenCallback *openArchiveCallback)
-{
- COM_TRY_BEGIN
- {
- Close();
- RINOK(Open2(stream, openArchiveCallback));
- _stream = stream;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::OpenSeq(ISequentialInStream *stream)
-{
- Close();
- _seqStream = stream;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _phySizeDefined = false;
- _curIndex = 0;
- _latestIsRead = false;
- _items.Clear();
- _seqStream.Release();
- _stream.Release();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = (_stream ? _items.Size() : (UInt32)(Int32)-1);
- return S_OK;
-}
-
-CHandler::CHandler()
-{
- copyCoderSpec = new NCompress::CCopyCoder();
- copyCoder = copyCoderSpec;
-}
-
-HRESULT CHandler::SkipTo(UInt32 index)
-{
- while (_curIndex < index || !_latestIsRead)
- {
- if (_latestIsRead)
- {
- UInt64 packSize = _latestItem.GetPackSize();
- RINOK(copyCoderSpec->Code(_seqStream, NULL, &packSize, &packSize, NULL));
- _latestIsRead = false;
- _curIndex++;
- }
- else
- {
- bool filled;
- // item.HeaderPosition = pos;
- RINOK(ReadItem(_seqStream, filled, _latestItem));
- if (!filled)
- return E_INVALIDARG;
- _latestIsRead = true;
- }
- }
- return S_OK;
-}
-
-static UString TarStringToUnicode(const AString &s)
-{
- return MultiByteToUnicodeString(s, CP_OEMCP);
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
-
- const CItemEx *item;
- if (_stream)
- item = &_items[index];
- else
- {
- if (index < _curIndex)
- return E_INVALIDARG;
- else
- {
- RINOK(SkipTo(index));
- item = &_latestItem;
- }
- }
-
- switch(propID)
- {
- case kpidPath: prop = NItemName::GetOSName2(TarStringToUnicode(item->Name)); break;
- case kpidIsDir: prop = item->IsDir(); break;
- case kpidSize: prop = item->Size; break;
- case kpidPackSize: prop = item->GetPackSize(); break;
- case kpidMTime:
- if (item->MTime != 0)
- {
- FILETIME ft;
- NTime::UnixTimeToFileTime(item->MTime, ft);
- prop = ft;
- }
- break;
- case kpidPosixAttrib: prop = item->Mode; break;
- case kpidUser: prop = TarStringToUnicode(item->User); break;
- case kpidGroup: prop = TarStringToUnicode(item->Group); break;
- case kpidLink: prop = TarStringToUnicode(item->LinkName); break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-HRESULT CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- ISequentialInStream *stream = _seqStream;
- bool seqMode = (_stream == NULL);
- if (!seqMode)
- stream = _stream;
-
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == (UInt32)-1);
- if (allFilesMode)
- numItems = _items.Size();
- if (_stream && numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- totalSize += _items[allFilesMode ? i : indices[i]].Size;
- extractCallback->SetTotal(totalSize);
-
- UInt64 totalPackSize;
- totalSize = totalPackSize = 0;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
- streamSpec->SetStream(stream);
-
- CLimitedSequentialOutStream *outStreamSpec = new CLimitedSequentialOutStream;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
-
- for (i = 0; i < numItems || seqMode; i++)
- {
- lps->InSize = totalPackSize;
- lps->OutSize = totalSize;
- RINOK(lps->SetCur());
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- Int32 index = allFilesMode ? i : indices[i];
- const CItemEx *item;
- if (seqMode)
- {
- HRESULT res = SkipTo(index);
- if (res == E_INVALIDARG)
- break;
- RINOK(res);
- item = &_latestItem;
- }
- else
- item = &_items[index];
-
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
- totalSize += item->Size;
- totalPackSize += item->GetPackSize();
- if (item->IsDir())
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
- bool skipMode = false;
- if (!testMode && !realOutStream)
- {
- if (!seqMode)
- continue;
- skipMode = true;
- askMode = NArchive::NExtract::NAskMode::kSkip;
- }
- RINOK(extractCallback->PrepareOperation(askMode));
-
- outStreamSpec->SetStream(realOutStream);
- realOutStream.Release();
- outStreamSpec->Init(skipMode ? 0 : item->Size, true);
-
- if (!seqMode)
- {
- RINOK(_stream->Seek(item->GetDataPosition(), STREAM_SEEK_SET, NULL));
- }
- streamSpec->Init(item->GetPackSize());
- RINOK(copyCoder->Code(inStream, outStream, NULL, NULL, progress));
- if (seqMode)
- {
- _latestIsRead = false;
- _curIndex++;
- }
- outStreamSpec->ReleaseStream();
- RINOK(extractCallback->SetOperationResult(outStreamSpec->GetRem() == 0 ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kDataError));
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
-{
- COM_TRY_BEGIN
- const CItemEx &item = _items[index];
- return CreateLimitedInStream(_stream, item.GetDataPosition(), item.Size, stream);
- COM_TRY_END
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHandler.h
deleted file mode 100644
index d2def9a1c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHandler.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// TarHandler.h
-
-#ifndef __TAR_HANDLER_H
-#define __TAR_HANDLER_H
-
-#include "Common/MyCom.h"
-#include "../IArchive.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "TarItem.h"
-
-namespace NArchive {
-namespace NTar {
-
-class CHandler:
- public IInArchive,
- public IArchiveOpenSeq,
- public IInArchiveGetStream,
- public IOutArchive,
- public CMyUnknownImp
-{
- CObjectVector<CItemEx> _items;
- CMyComPtr<IInStream> _stream;
- CMyComPtr<ISequentialInStream> _seqStream;
- bool _isGood;
-
- UInt32 _curIndex;
- bool _latestIsRead;
- CItemEx _latestItem;
-
- UInt64 _phySize;
- bool _phySizeDefined;
-
- NCompress::CCopyCoder *copyCoderSpec;
- CMyComPtr<ICompressCoder> copyCoder;
-
- HRESULT Open2(IInStream *stream, IArchiveOpenCallback *callback);
- HRESULT SkipTo(UInt32 index);
-
-public:
- MY_UNKNOWN_IMP4(
- IInArchive,
- IArchiveOpenSeq,
- IInArchiveGetStream,
- IOutArchive
- )
-
- INTERFACE_IInArchive(;)
- INTERFACE_IOutArchive(;)
- STDMETHOD(OpenSeq)(ISequentialInStream *stream);
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-
- CHandler();
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHandlerOut.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHandlerOut.cpp
deleted file mode 100644
index 7cc019c91..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHandlerOut.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-// TarHandlerOut.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "TarHandler.h"
-#include "TarUpdate.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NTar {
-
-STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type)
-{
- *type = NFileTimeType::kUnix;
- return S_OK;
-}
-
-static HRESULT GetPropString(IArchiveUpdateCallback *callback, UInt32 index, PROPID propId, AString &res)
-{
- NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(index, propId, &prop));
- if (prop.vt == VT_BSTR)
- res = UnicodeStringToMultiByte(prop.bstrVal, CP_OEMCP);
- else if (prop.vt != VT_EMPTY)
- return E_INVALIDARG;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems,
- IArchiveUpdateCallback *callback)
-{
- COM_TRY_BEGIN
- if ((_stream && !_isGood) || _seqStream)
- return E_NOTIMPL;
- CObjectVector<CUpdateItem> updateItems;
- for (UInt32 i = 0; i < numItems; i++)
- {
- CUpdateItem ui;
- Int32 newData;
- Int32 newProps;
- UInt32 indexInArchive;
- if (!callback)
- return E_FAIL;
- RINOK(callback->GetUpdateItemInfo(i, &newData, &newProps, &indexInArchive));
- ui.NewProps = IntToBool(newProps);
- ui.NewData = IntToBool(newData);
- ui.IndexInArchive = indexInArchive;
- ui.IndexInClient = i;
-
- if (IntToBool(newProps))
- {
- {
- NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(i, kpidIsDir, &prop));
- if (prop.vt == VT_EMPTY)
- ui.IsDir = false;
- else if (prop.vt != VT_BOOL)
- return E_INVALIDARG;
- else
- ui.IsDir = (prop.boolVal != VARIANT_FALSE);
- }
-
- {
- NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(i, kpidPosixAttrib, &prop));
- if (prop.vt == VT_EMPTY)
- ui.Mode = 0777 | (ui.IsDir ? 0040000 : 0100000);
- else if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- else
- ui.Mode = prop.ulVal;
- }
- {
- NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(i, kpidMTime, &prop));
- if (prop.vt == VT_EMPTY)
- ui.Time = 0;
- else if (prop.vt != VT_FILETIME)
- return E_INVALIDARG;
- else if (!NTime::FileTimeToUnixTime(prop.filetime, ui.Time))
- ui.Time = 0;
- }
- {
- NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(i, kpidPath, &prop));
- if (prop.vt == VT_BSTR)
- ui.Name = UnicodeStringToMultiByte(NItemName::MakeLegalName(prop.bstrVal), CP_OEMCP);
- else if (prop.vt != VT_EMPTY)
- return E_INVALIDARG;
- if (ui.IsDir)
- ui.Name += '/';
- }
- RINOK(GetPropString(callback, i, kpidUser, ui.User));
- RINOK(GetPropString(callback, i, kpidGroup, ui.Group));
- }
- if (IntToBool(newData))
- {
- NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(i, kpidSize, &prop));
- if (prop.vt != VT_UI8)
- return E_INVALIDARG;
- ui.Size = prop.uhVal.QuadPart;
- }
- updateItems.Add(ui);
- }
- return UpdateArchive(_stream, outStream, _items, updateItems, callback);
- COM_TRY_END
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHeader.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHeader.cpp
deleted file mode 100644
index 3275b284c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHeader.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// Archive/Tar/Header.h
-
-#include "StdAfx.h"
-
-#include "TarHeader.h"
-
-namespace NArchive {
-namespace NTar {
-namespace NFileHeader {
-
- // The checksum field is filled with this while the checksum is computed.
- const char *kCheckSumBlanks = " "; // 8 blanks, no null
-
- const char *kLongLink = "././@LongLink";
- const char *kLongLink2 = "@LongLink";
-
- // The magic field is filled with this if uname and gname are valid.
- namespace NMagic
- {
- const char *kUsTar = "ustar"; // 5 chars
- const char *kGNUTar = "GNUtar "; // 7 chars and a null
- const char *kEmpty = "\0\0\0\0\0\0\0\0"; // 7 chars and a null
- }
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHeader.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHeader.h
deleted file mode 100644
index 0b78bdc26..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarHeader.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// Archive/Tar/Header.h
-
-#ifndef __ARCHIVE_TAR_HEADER_H
-#define __ARCHIVE_TAR_HEADER_H
-
-#include "Common/Types.h"
-
-namespace NArchive {
-namespace NTar {
-
-namespace NFileHeader
-{
- const int kRecordSize = 512;
- const int kNameSize = 100;
- const int kUserNameSize = 32;
- const int kGroupNameSize = 32;
- const int kPrefixSize = 155;
-
- /*
- struct CHeader
- {
- char Name[kNameSize];
- char Mode[8];
- char UID[8];
- char GID[8];
- char Size[12];
- char ModificationTime[12];
- char CheckSum[8];
- char LinkFlag;
- char LinkName[kNameSize];
- char Magic[8];
- char UserName[kUserNameSize];
- char GroupName[kGroupNameSize];
- char DeviceMajor[8];
- char DeviceMinor[8];
- char Prefix[155];
- };
- union CRecord
- {
- CHeader Header;
- Byte Padding[kRecordSize];
- };
- */
-
- namespace NMode
- {
- const int kSetUID = 04000; // Set UID on execution
- const int kSetGID = 02000; // Set GID on execution
- const int kSaveText = 01000; // Save text (sticky bit)
- }
-
- namespace NFilePermissions
- {
- const int kUserRead = 00400; // read by owner
- const int kUserWrite = 00200; // write by owner
- const int kUserExecute = 00100; // execute/search by owner
- const int kGroupRead = 00040; // read by group
- const int kGroupWrite = 00020; // write by group
- const int kGroupExecute = 00010; // execute/search by group
- const int kOtherRead = 00004; // read by other
- const int kOtherWrite = 00002; // write by other
- const int kOtherExecute = 00001; // execute/search by other
- }
-
-
- // The linkflag defines the type of file
- namespace NLinkFlag
- {
- const char kOldNormal = '\0'; // Normal disk file, Unix compatible
- const char kNormal = '0'; // Normal disk file
- const char kLink = '1'; // Link to previously dumped file
- const char kSymbolicLink = '2'; // Symbolic link
- const char kCharacter = '3'; // Character special file
- const char kBlock = '4'; // Block special file
- const char kDirectory = '5'; // Directory
- const char kFIFO = '6'; // FIFO special file
- const char kContiguous = '7'; // Contiguous file
-
- const char kDumpDir = 'D'; /* GNUTYPE_DUMPDIR.
- data: list of files created by the --incremental (-G) option
- Each file name is preceded by either
- - 'Y' (file should be in this archive)
- - 'N' (file is a directory, or is not stored in the archive.)
- Each file name is terminated by a null + an additional null after
- the last file name. */
-
- }
- // Further link types may be defined later.
-
- // The checksum field is filled with this while the checksum is computed.
- extern const char *kCheckSumBlanks;// = " "; // 8 blanks, no null
-
- extern const char *kLongLink; // = "././@LongLink";
- extern const char *kLongLink2; // = "@LongLink";
-
- // The magic field is filled with this if uname and gname are valid.
- namespace NMagic
- {
- extern const char *kUsTar; // = "ustar"; // 5 chars
- extern const char *kGNUTar; // = "GNUtar "; // 7 chars and a null
- extern const char *kEmpty; // = "GNUtar "; // 7 chars and a null
- }
-
-}
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarIn.cpp
deleted file mode 100644
index 376b3e7c8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarIn.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-// TarIn.cpp
-
-#include "StdAfx.h"
-
-#include "Common/StringToInt.h"
-
-#include "../../Common/StreamUtils.h"
-
-#include "TarIn.h"
-
-namespace NArchive {
-namespace NTar {
-
-static void MyStrNCpy(char *dest, const char *src, int size)
-{
- for (int i = 0; i < size; i++)
- {
- char c = src[i];
- dest[i] = c;
- if (c == 0)
- break;
- }
-}
-
-static bool OctalToNumber(const char *srcString, int size, UInt64 &res)
-{
- char sz[32];
- MyStrNCpy(sz, srcString, size);
- sz[size] = 0;
- const char *end;
- int i;
- for (i = 0; sz[i] == ' '; i++);
- res = ConvertOctStringToUInt64(sz + i, &end);
- return (*end == ' ' || *end == 0);
-}
-
-static bool OctalToNumber32(const char *srcString, int size, UInt32 &res)
-{
- UInt64 res64;
- if (!OctalToNumber(srcString, size, res64))
- return false;
- res = (UInt32)res64;
- return (res64 <= 0xFFFFFFFF);
-}
-
-#define RIF(x) { if (!(x)) return S_FALSE; }
-
-static bool IsRecordLast(const char *buf)
-{
- for (int i = 0; i < NFileHeader::kRecordSize; i++)
- if (buf[i] != 0)
- return false;
- return true;
-}
-
-static void ReadString(const char *s, int size, AString &result)
-{
- char temp[NFileHeader::kRecordSize + 1];
- MyStrNCpy(temp, s, size);
- temp[size] = '\0';
- result = temp;
-}
-
-static HRESULT GetNextItemReal(ISequentialInStream *stream, bool &filled, CItemEx &item, size_t &processedSize)
-{
- item.LongLinkSize = 0;
- char buf[NFileHeader::kRecordSize];
- char *p = buf;
-
- filled = false;
-
- processedSize = NFileHeader::kRecordSize;
- RINOK(ReadStream(stream, buf, &processedSize));
- if (processedSize == 0 || (static_cast< int >( processedSize ) == NFileHeader::kRecordSize && IsRecordLast(buf)))
- return S_OK;
- if (static_cast< int >( processedSize ) < NFileHeader::kRecordSize)
- return S_FALSE;
-
- ReadString(p, NFileHeader::kNameSize, item.Name); p += NFileHeader::kNameSize;
-
- RIF(OctalToNumber32(p, 8, item.Mode)); p += 8;
-
- if (!OctalToNumber32(p, 8, item.UID)) item.UID = 0; p += 8;
- if (!OctalToNumber32(p, 8, item.GID)) item.GID = 0; p += 8;
-
- RIF(OctalToNumber(p, 12, item.Size)); p += 12;
- RIF(OctalToNumber32(p, 12, item.MTime)); p += 12;
-
- UInt32 checkSum;
- RIF(OctalToNumber32(p, 8, checkSum));
- memcpy(p, NFileHeader::kCheckSumBlanks, 8); p += 8;
-
- item.LinkFlag = *p++;
-
- ReadString(p, NFileHeader::kNameSize, item.LinkName); p += NFileHeader::kNameSize;
-
- memcpy(item.Magic, p, 8); p += 8;
-
- ReadString(p, NFileHeader::kUserNameSize, item.User); p += NFileHeader::kUserNameSize;
- ReadString(p, NFileHeader::kGroupNameSize, item.Group); p += NFileHeader::kGroupNameSize;
-
- item.DeviceMajorDefined = (p[0] != 0); RIF(OctalToNumber32(p, 8, item.DeviceMajor)); p += 8;
- item.DeviceMinorDefined = (p[0] != 0); RIF(OctalToNumber32(p, 8, item.DeviceMinor)); p += 8;
-
- AString prefix;
- ReadString(p, NFileHeader::kPrefixSize, prefix);
- p += NFileHeader::kPrefixSize;
- if (!prefix.IsEmpty() && item.IsMagic() &&
- (item.LinkFlag != 'L' /* || prefix != "00000000000" */ ))
- item.Name = prefix + AString('/') + item.Name;
-
- if (item.LinkFlag == NFileHeader::NLinkFlag::kLink)
- item.Size = 0;
-
- UInt32 checkSumReal = 0;
- for (int i = 0; i < NFileHeader::kRecordSize; i++)
- checkSumReal += (Byte)buf[i];
-
- if (checkSumReal != checkSum)
- return S_FALSE;
-
- filled = true;
- return S_OK;
-}
-
-HRESULT ReadItem(ISequentialInStream *stream, bool &filled, CItemEx &item)
-{
- size_t processedSize;
- RINOK(GetNextItemReal(stream, filled, item, processedSize));
- if (!filled)
- return S_OK;
- // GNUtar extension
- if (item.LinkFlag == 'L' || // NEXT file has a long name
- item.LinkFlag == 'K') // NEXT file has a long linkname
- {
- if (item.Name.Compare(NFileHeader::kLongLink) != 0)
- if (item.Name.Compare(NFileHeader::kLongLink2) != 0)
- return S_FALSE;
-
- AString fullName;
- if (item.Size > (1 << 15))
- return S_FALSE;
- int packSize = (int)item.GetPackSize();
- char *buffer = fullName.GetBuffer(packSize + 1);
-
- RINOK(ReadStream_FALSE(stream, buffer, packSize));
- processedSize += packSize;
- buffer[item.Size] = '\0';
- fullName.ReleaseBuffer();
-
- UInt64 headerPosition = item.HeaderPosition;
- if (item.LinkFlag == 'L')
- {
- size_t processedSize2;
- RINOK(GetNextItemReal(stream, filled, item, processedSize2));
- item.LongLinkSize = (unsigned)processedSize;
- }
- else
- {
- item.LongLinkSize = (unsigned)processedSize - NFileHeader::kRecordSize;
- item.Size = 0;
- }
- item.Name = fullName;
- item.HeaderPosition = headerPosition;
- }
- else if (item.LinkFlag == 'g' || item.LinkFlag == 'x' || item.LinkFlag == 'X')
- {
- // pax Extended Header
- return S_OK;
- }
- else if (item.LinkFlag == NFileHeader::NLinkFlag::kDumpDir)
- {
- // GNU Extensions to the Archive Format
- return S_OK;
- }
- else if (item.LinkFlag > '7' || (item.LinkFlag < '0' && item.LinkFlag != 0))
- return S_FALSE;
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarIn.h
deleted file mode 100644
index cc6e3f5b5..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarIn.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Archive/TarIn.h
-
-#ifndef __ARCHIVE_TAR_IN_H
-#define __ARCHIVE_TAR_IN_H
-
-#include "Common/MyCom.h"
-#include "../../IStream.h"
-
-#include "TarItem.h"
-
-namespace NArchive {
-namespace NTar {
-
-HRESULT ReadItem(ISequentialInStream *stream, bool &filled, CItemEx &itemInfo);
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarItem.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarItem.h
deleted file mode 100644
index afe8997db..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarItem.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// TarItem.h
-
-#ifndef __ARCHIVE_TAR_ITEM_H
-#define __ARCHIVE_TAR_ITEM_H
-
-#include "../Common/ItemNameUtils.h"
-
-#include "TarHeader.h"
-
-namespace NArchive {
-namespace NTar {
-
-struct CItem
-{
- AString Name;
- UInt64 Size;
-
- UInt32 Mode;
- UInt32 UID;
- UInt32 GID;
- UInt32 MTime;
- UInt32 DeviceMajor;
- UInt32 DeviceMinor;
-
- AString LinkName;
- AString User;
- AString Group;
-
- char Magic[8];
- char LinkFlag;
- bool DeviceMajorDefined;
- bool DeviceMinorDefined;
-
- bool IsDir() const
- {
- switch(LinkFlag)
- {
- case NFileHeader::NLinkFlag::kDirectory:
- case NFileHeader::NLinkFlag::kDumpDir:
- return true;
- case NFileHeader::NLinkFlag::kOldNormal:
- case NFileHeader::NLinkFlag::kNormal:
- return NItemName::HasTailSlash(Name, CP_OEMCP);
- }
- return false;
- }
-
- bool IsMagic() const
- {
- for (int i = 0; i < 5; i++)
- if (Magic[i] != NFileHeader::NMagic::kUsTar[i])
- return false;
- return true;
- }
-
- UInt64 GetPackSize() const { return (Size + 0x1FF) & (~((UInt64)0x1FF)); }
-};
-
-struct CItemEx: public CItem
-{
- UInt64 HeaderPosition;
- unsigned LongLinkSize;
- UInt64 GetDataPosition() const { return HeaderPosition + LongLinkSize + NFileHeader::kRecordSize; }
- UInt64 GetFullSize() const { return LongLinkSize + NFileHeader::kRecordSize + Size; }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarOut.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarOut.cpp
deleted file mode 100644
index 1ec314c73..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarOut.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-// TarOut.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-
-#include "../../Common/StreamUtils.h"
-
-#include "TarOut.h"
-
-namespace NArchive {
-namespace NTar {
-
-HRESULT COutArchive::WriteBytes(const void *buffer, UInt32 size)
-{
- return WriteStream(m_Stream, buffer, size);
-}
-
-void COutArchive::Create(ISequentialOutStream *outStream)
-{
- m_Stream = outStream;
-}
-
-static AString MakeOctalString(UInt64 value)
-{
- char s[32];
- ConvertUInt64ToString(value, s, 8);
- return AString(s) + ' ';
-}
-
-static void MyStrNCpy(char *dest, const char *src, int size)
-{
- for (int i = 0; i < size; i++)
- {
- char c = src[i];
- dest[i] = c;
- if (c == 0)
- break;
- }
-}
-
-static bool MakeOctalString8(char *s, UInt32 value)
-{
- AString tempString = MakeOctalString(value);
-
- const int kMaxSize = 8;
- if (tempString.Length() >= kMaxSize)
- return false;
- int numSpaces = kMaxSize - (tempString.Length() + 1);
- for(int i = 0; i < numSpaces; i++)
- s[i] = ' ';
- MyStringCopy(s + numSpaces, (const char *)tempString);
- return true;
-}
-
-static bool MakeOctalString12(char *s, UInt64 value)
-{
- AString tempString = MakeOctalString(value);
- const int kMaxSize = 12;
- if (tempString.Length() > kMaxSize)
- return false;
- int numSpaces = kMaxSize - tempString.Length();
- for(int i = 0; i < numSpaces; i++)
- s[i] = ' ';
- memmove(s + numSpaces, (const char *)tempString, tempString.Length());
- return true;
-}
-
-static bool CopyString(char *dest, const AString &src, int maxSize)
-{
- if (src.Length() >= maxSize)
- return false;
- MyStringCopy(dest, (const char *)src);
- return true;
-}
-
-#define RETURN_IF_NOT_TRUE(x) { if (!(x)) return E_FAIL; }
-
-HRESULT COutArchive::WriteHeaderReal(const CItem &item)
-{
- char record[NFileHeader::kRecordSize];
- char *cur = record;
- int i;
- for (i = 0; i < NFileHeader::kRecordSize; i++)
- record[i] = 0;
-
- // RETURN_IF_NOT_TRUE(CopyString(header.Name, item.Name, NFileHeader::kNameSize));
- if (item.Name.Length() > NFileHeader::kNameSize)
- return E_FAIL;
- MyStrNCpy(cur, item.Name, NFileHeader::kNameSize);
- cur += NFileHeader::kNameSize;
-
- RETURN_IF_NOT_TRUE(MakeOctalString8(cur, item.Mode));
- cur += 8;
- RETURN_IF_NOT_TRUE(MakeOctalString8(cur, item.UID));
- cur += 8;
- RETURN_IF_NOT_TRUE(MakeOctalString8(cur, item.GID));
- cur += 8;
-
- RETURN_IF_NOT_TRUE(MakeOctalString12(cur, item.Size));
- cur += 12;
- RETURN_IF_NOT_TRUE(MakeOctalString12(cur, item.MTime));
- cur += 12;
-
- memmove(cur, NFileHeader::kCheckSumBlanks, 8);
- cur += 8;
-
- *cur++ = item.LinkFlag;
-
- RETURN_IF_NOT_TRUE(CopyString(cur, item.LinkName, NFileHeader::kNameSize));
- cur += NFileHeader::kNameSize;
-
- memmove(cur, item.Magic, 8);
- cur += 8;
-
- RETURN_IF_NOT_TRUE(CopyString(cur, item.User, NFileHeader::kUserNameSize));
- cur += NFileHeader::kUserNameSize;
- RETURN_IF_NOT_TRUE(CopyString(cur, item.Group, NFileHeader::kGroupNameSize));
- cur += NFileHeader::kGroupNameSize;
-
-
- if (item.DeviceMajorDefined)
- RETURN_IF_NOT_TRUE(MakeOctalString8(cur, item.DeviceMajor));
- cur += 8;
-
- if (item.DeviceMinorDefined)
- RETURN_IF_NOT_TRUE(MakeOctalString8(cur, item.DeviceMinor));
- cur += 8;
-
-
- UInt32 checkSumReal = 0;
- for(i = 0; i < NFileHeader::kRecordSize; i++)
- checkSumReal += Byte(record[i]);
-
- RETURN_IF_NOT_TRUE(MakeOctalString8(record + 148, checkSumReal));
-
- return WriteBytes(record, NFileHeader::kRecordSize);
-}
-
-HRESULT COutArchive::WriteHeader(const CItem &item)
-{
- int nameSize = item.Name.Length();
- if (nameSize < NFileHeader::kNameSize)
- return WriteHeaderReal(item);
-
- CItem modifiedItem = item;
- int nameStreamSize = nameSize + 1;
- modifiedItem.Size = nameStreamSize;
- modifiedItem.LinkFlag = 'L';
- modifiedItem.Name = NFileHeader::kLongLink;
- modifiedItem.LinkName.Empty();
- RINOK(WriteHeaderReal(modifiedItem));
- RINOK(WriteBytes(item.Name, nameStreamSize));
- RINOK(FillDataResidual(nameStreamSize));
-
- modifiedItem = item;
- modifiedItem.Name = item.Name.Left(NFileHeader::kNameSize - 1);
- return WriteHeaderReal(modifiedItem);
-}
-
-HRESULT COutArchive::FillDataResidual(UInt64 dataSize)
-{
- UInt32 lastRecordSize = UInt32(dataSize & (NFileHeader::kRecordSize - 1));
- if (lastRecordSize == 0)
- return S_OK;
- UInt32 residualSize = NFileHeader::kRecordSize - lastRecordSize;
- Byte residualBytes[NFileHeader::kRecordSize];
- for (UInt32 i = 0; i < residualSize; i++)
- residualBytes[i] = 0;
- return WriteBytes(residualBytes, residualSize);
-}
-
-HRESULT COutArchive::WriteFinishHeader()
-{
- Byte record[NFileHeader::kRecordSize];
- int i;
- for (i = 0; i < NFileHeader::kRecordSize; i++)
- record[i] = 0;
- for (i = 0; i < 2; i++)
- {
- RINOK(WriteBytes(record, NFileHeader::kRecordSize));
- }
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarOut.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarOut.h
deleted file mode 100644
index ef837869b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarOut.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Archive/TarOut.h
-
-#ifndef __ARCHIVE_TAR_OUT_H
-#define __ARCHIVE_TAR_OUT_H
-
-#include "TarItem.h"
-
-#include "Common/MyCom.h"
-#include "../../IStream.h"
-
-namespace NArchive {
-namespace NTar {
-
-class COutArchive
-{
- CMyComPtr<ISequentialOutStream> m_Stream;
- HRESULT WriteBytes(const void *buffer, UInt32 size);
-public:
- void Create(ISequentialOutStream *outStream);
- HRESULT WriteHeaderReal(const CItem &item);
- HRESULT WriteHeader(const CItem &item);
- HRESULT FillDataResidual(UInt64 dataSize);
- HRESULT WriteFinishHeader();
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarRegister.cpp
deleted file mode 100644
index 3cc0d6052..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarRegister.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// TarRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "TarHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NTar::CHandler; }
-#ifndef EXTRACT_ONLY
-static IOutArchive *CreateArcOut() { return new NArchive::NTar::CHandler; }
-#else
-#define CreateArcOut 0
-#endif
-
-static CArcInfo g_ArcInfo =
-{ L"Tar", L"tar", 0, 0xEE, { 'u', 's', 't', 'a', 'r' }, 5, false, CreateArc, CreateArcOut };
-
-REGISTER_ARC(Tar)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarUpdate.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarUpdate.cpp
deleted file mode 100644
index 0577848f6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarUpdate.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-// TarUpdate.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/ProgressUtils.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "TarOut.h"
-#include "TarUpdate.h"
-
-namespace NArchive {
-namespace NTar {
-
-HRESULT UpdateArchive(IInStream *inStream, ISequentialOutStream *outStream,
- const CObjectVector<NArchive::NTar::CItemEx> &inputItems,
- const CObjectVector<CUpdateItem> &updateItems,
- IArchiveUpdateCallback *updateCallback)
-{
- COutArchive outArchive;
- outArchive.Create(outStream);
-
- UInt64 complexity = 0;
-
- int i;
- for(i = 0; i < updateItems.Size(); i++)
- {
- const CUpdateItem &ui = updateItems[i];
- if (ui.NewData)
- complexity += ui.Size;
- else
- complexity += inputItems[ui.IndexInArchive].GetFullSize();
- }
-
- RINOK(updateCallback->SetTotal(complexity));
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder;
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(updateCallback, true);
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<CLimitedSequentialInStream> inStreamLimited(streamSpec);
- streamSpec->SetStream(inStream);
-
- complexity = 0;
-
- for(i = 0; i < updateItems.Size(); i++)
- {
- lps->InSize = lps->OutSize = complexity;
- RINOK(lps->SetCur());
-
- const CUpdateItem &ui = updateItems[i];
- CItem item;
- if (ui.NewProps)
- {
- item.Mode = ui.Mode;
- item.Name = ui.Name;
- item.User = ui.User;
- item.Group = ui.Group;
- if (ui.IsDir)
- {
- item.LinkFlag = NFileHeader::NLinkFlag::kDirectory;
- item.Size = 0;
- }
- else
- {
- item.LinkFlag = NFileHeader::NLinkFlag::kNormal;
- item.Size = ui.Size;
- }
- item.MTime = ui.Time;
- item.DeviceMajorDefined = false;
- item.DeviceMinorDefined = false;
- item.UID = 0;
- item.GID = 0;
- memmove(item.Magic, NFileHeader::NMagic::kEmpty, 8);
- }
- else
- item = inputItems[ui.IndexInArchive];
-
- if (ui.NewData)
- {
- item.Size = ui.Size;
- if (item.Size == (UInt64)(Int64)-1)
- return E_INVALIDARG;
- }
- else
- item.Size = inputItems[ui.IndexInArchive].Size;
-
- if (ui.NewData)
- {
- CMyComPtr<ISequentialInStream> fileInStream;
- HRESULT res = updateCallback->GetStream(ui.IndexInClient, &fileInStream);
- if (res != S_FALSE)
- {
- RINOK(res);
- RINOK(outArchive.WriteHeader(item));
- if (!ui.IsDir)
- {
- RINOK(copyCoder->Code(fileInStream, outStream, NULL, NULL, progress));
- if (copyCoderSpec->TotalSize != item.Size)
- return E_FAIL;
- RINOK(outArchive.FillDataResidual(item.Size));
- }
- }
- complexity += ui.Size;
- RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
- }
- else
- {
- const CItemEx &existItemInfo = inputItems[ui.IndexInArchive];
- UInt64 size;
- if (ui.NewProps)
- {
- RINOK(outArchive.WriteHeader(item));
- RINOK(inStream->Seek(existItemInfo.GetDataPosition(), STREAM_SEEK_SET, NULL));
- size = existItemInfo.Size;
- }
- else
- {
- RINOK(inStream->Seek(existItemInfo.HeaderPosition, STREAM_SEEK_SET, NULL));
- size = existItemInfo.GetFullSize();
- }
- streamSpec->Init(size);
-
- RINOK(copyCoder->Code(inStreamLimited, outStream, NULL, NULL, progress));
- if (copyCoderSpec->TotalSize != size)
- return E_FAIL;
- RINOK(outArchive.FillDataResidual(existItemInfo.Size));
- complexity += size;
- }
- }
- return outArchive.WriteFinishHeader();
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarUpdate.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarUpdate.h
deleted file mode 100644
index fb217d196..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Tar/TarUpdate.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// TarUpdate.h
-
-#ifndef __TAR_UPDATE_H
-#define __TAR_UPDATE_H
-
-#include "../IArchive.h"
-#include "TarItem.h"
-
-namespace NArchive {
-namespace NTar {
-
-struct CUpdateItem
-{
- int IndexInArchive;
- int IndexInClient;
- UInt32 Time;
- UInt32 Mode;
- UInt64 Size;
- AString Name;
- AString User;
- AString Group;
- bool NewData;
- bool NewProps;
- bool IsDir;
-};
-
-HRESULT UpdateArchive(IInStream *inStream, ISequentialOutStream *outStream,
- const CObjectVector<CItemEx> &inputItems,
- const CObjectVector<CUpdateItem> &updateItems,
- IArchiveUpdateCallback *updateCallback);
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfHandler.cpp
deleted file mode 100644
index 07b61c515..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfHandler.cpp
+++ /dev/null
@@ -1,500 +0,0 @@
-// UdfHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/NewHandler.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/ProgressUtils.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "UdfHandler.h"
-
-namespace NArchive {
-namespace NUdf {
-
-void UdfTimeToFileTime(const CTime &t, NWindows::NCOM::CPropVariant &prop)
-{
- UInt64 numSecs;
- const Byte *d = t.Data;
- if (!NWindows::NTime::GetSecondsSince1601(t.GetYear(), d[4], d[5], d[6], d[7], d[8], numSecs))
- return;
- if (t.IsLocal())
- numSecs -= t.GetMinutesOffset() * 60;
- FILETIME ft;
- UInt64 v = (((numSecs * 100 + d[9]) * 100 + d[10]) * 100 + d[11]) * 10;
- ft.dwLowDateTime = (UInt32)v;
- ft.dwHighDateTime = (UInt32)(v >> 32);
- prop = ft;
-}
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidATime, VT_FILETIME}
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidComment, VT_BSTR},
- { NULL, kpidClusterSize, VT_UI4},
- { NULL, kpidCTime, VT_FILETIME}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidComment:
- {
- UString comment = _archive.GetComment();
- if (!comment.IsEmpty())
- prop = comment;
- break;
- }
-
- case kpidClusterSize:
- if (_archive.LogVols.Size() > 0)
- {
- UInt32 blockSize = _archive.LogVols[0].BlockSize;
- int i;
- for (i = 1; i < _archive.LogVols.Size(); i++)
- if (_archive.LogVols[i].BlockSize != blockSize)
- break;
- if (i == _archive.LogVols.Size())
- prop = blockSize;
- }
- break;
-
- case kpidCTime:
- if (_archive.LogVols.Size() == 1)
- {
- const CLogVol &vol = _archive.LogVols[0];
- if (vol.FileSets.Size() >= 1)
- UdfTimeToFileTime(vol.FileSets[0].RecodringTime, prop);
- }
- break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-class CProgressImp: public CProgressVirt
-{
- CMyComPtr<IArchiveOpenCallback> _callback;
- UInt64 _numFiles;
- UInt64 _numBytes;
-public:
- HRESULT SetTotal(UInt64 numBytes);
- HRESULT SetCompleted(UInt64 numFiles, UInt64 numBytes);
- HRESULT SetCompleted();
- CProgressImp(IArchiveOpenCallback *callback): _callback(callback), _numFiles(0), _numBytes(0) {}
-};
-
-HRESULT CProgressImp::SetTotal(UInt64 numBytes)
-{
- if (_callback)
- return _callback->SetTotal(NULL, &numBytes);
- return S_OK;
-}
-
-HRESULT CProgressImp::SetCompleted(UInt64 numFiles, UInt64 numBytes)
-{
- _numFiles = numFiles;
- _numBytes = numBytes;
- return SetCompleted();
-}
-
-HRESULT CProgressImp::SetCompleted()
-{
- if (_callback)
- return _callback->SetCompleted(&_numFiles, &_numBytes);
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback *callback)
-{
- COM_TRY_BEGIN
- {
- Close();
- CProgressImp progressImp(callback);
- RINOK(_archive.Open(stream, &progressImp));
- bool showVolName = (_archive.LogVols.Size() > 1);
- for (int volIndex = 0; volIndex < _archive.LogVols.Size(); volIndex++)
- {
- const CLogVol &vol = _archive.LogVols[volIndex];
- bool showFileSetName = (vol.FileSets.Size() > 1);
- for (int fsIndex = 0; fsIndex < vol.FileSets.Size(); fsIndex++)
- {
- const CFileSet &fs = vol.FileSets[fsIndex];
- for (int i = ((showVolName || showFileSetName) ? 0 : 1); i < fs.Refs.Size(); i++)
- {
- CRef2 ref2;
- ref2.Vol = volIndex;
- ref2.Fs = fsIndex;
- ref2.Ref = i;
- _refs2.Add(ref2);
- }
- }
- }
- _inStream = stream;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _inStream.Release();
- _archive.Clear();
- _refs2.Clear();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _refs2.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- {
- const CRef2 &ref2 = _refs2[index];
- const CLogVol &vol = _archive.LogVols[ref2.Vol];
- const CRef &ref = vol.FileSets[ref2.Fs].Refs[ref2.Ref];
- const CFile &file = _archive.Files[ref.FileIndex];
- const CItem &item = _archive.Items[file.ItemIndex];
- switch(propID)
- {
- case kpidPath: prop = _archive.GetItemPath(ref2.Vol, ref2.Fs, ref2.Ref,
- _archive.LogVols.Size() > 1, vol.FileSets.Size() > 1); break;
- case kpidIsDir: prop = item.IsDir(); break;
- case kpidSize: if (!item.IsDir()) prop = (UInt64)item.Size; break;
- case kpidPackSize: if (!item.IsDir()) prop = (UInt64)item.NumLogBlockRecorded * vol.BlockSize; break;
- case kpidMTime: UdfTimeToFileTime(item.MTime, prop); break;
- case kpidATime: UdfTimeToFileTime(item.ATime, prop); break;
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-class CBufInStream:
- public IInStream,
- public CMyUnknownImp
-{
- CByteBuffer _data;
- UInt64 _pos;
-
-public:
- void Init(const CByteBuffer &data)
- {
- _data = data;
- _pos = 0;
- }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-};
-
-
-STDMETHODIMP CBufInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != NULL)
- *processedSize = 0;
- if (_pos > _data.GetCapacity())
- return E_FAIL;
- size_t rem = _data.GetCapacity() - (size_t)_pos;
- if (size < rem)
- rem = (size_t)size;
- memcpy(data, (const Byte *)_data + _pos, rem);
- _pos += rem;
- if (processedSize != NULL)
- *processedSize = (UInt32)rem;
- return S_OK;
-}
-
-STDMETHODIMP CBufInStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
- switch(seekOrigin)
- {
- case STREAM_SEEK_SET: _pos = offset; break;
- case STREAM_SEEK_CUR: _pos += offset; break;
- case STREAM_SEEK_END: _pos = _data.GetCapacity() + offset; break;
- default: return STG_E_INVALIDFUNCTION;
- }
- if (newPosition)
- *newPosition = _pos;
- return S_OK;
-}
-
-struct CSeekExtent
-{
- UInt64 Phy;
- UInt64 Virt;
-};
-
-class CExtentsStream:
- public IInStream,
- public CMyUnknownImp
-{
- UInt64 _phyPos;
- UInt64 _virtPos;
- bool _needStartSeek;
-
- HRESULT SeekToPhys() { return Stream->Seek(_phyPos, STREAM_SEEK_SET, NULL); }
-
-public:
- CMyComPtr<IInStream> Stream;
- CRecordVector<CSeekExtent> Extents;
-
- MY_UNKNOWN_IMP1(IInStream)
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
- void ReleaseStream() { Stream.Release(); }
-
- void Init()
- {
- _virtPos = 0;
- _phyPos = 0;
- _needStartSeek = true;
- }
-
-};
-
-
-STDMETHODIMP CExtentsStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize)
- *processedSize = 0;
- if (size > 0)
- {
- UInt64 totalSize = Extents.Back().Virt;
- if (_virtPos >= totalSize)
- return (_virtPos == totalSize) ? S_OK : E_FAIL;
- int left = 0, right = Extents.Size() - 1;
- for (;;)
- {
- int mid = (left + right) / 2;
- if (mid == left)
- break;
- if (_virtPos < Extents[mid].Virt)
- right = mid;
- else
- left = mid;
- }
-
- const CSeekExtent &extent = Extents[left];
- UInt64 phyPos = extent.Phy + (_virtPos - extent.Virt);
- if (_needStartSeek || _phyPos != phyPos)
- {
- _needStartSeek = false;
- _phyPos = phyPos;
- RINOK(SeekToPhys());
- }
-
- UInt64 rem = Extents[left + 1].Virt - _virtPos;
- if (size > rem)
- size = (UInt32)rem;
-
- HRESULT res = Stream->Read(data, size, &size);
- _phyPos += size;
- _virtPos += size;
- if (processedSize)
- *processedSize = size;
- return res;
- }
- return S_OK;
-}
-
-STDMETHODIMP CExtentsStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
- switch(seekOrigin)
- {
- case STREAM_SEEK_SET: _virtPos = offset; break;
- case STREAM_SEEK_CUR: _virtPos += offset; break;
- case STREAM_SEEK_END: _virtPos = Extents.Back().Virt + offset; break;
- default: return STG_E_INVALIDFUNCTION;
- }
- if (newPosition)
- *newPosition = _virtPos;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetStream(UInt32 index, ISequentialInStream **stream)
-{
- *stream = 0;
-
- const CRef2 &ref2 = _refs2[index];
- const CLogVol &vol = _archive.LogVols[ref2.Vol];
- const CRef &ref = vol.FileSets[ref2.Fs].Refs[ref2.Ref];
- const CFile &file = _archive.Files[ref.FileIndex];
- const CItem &item = _archive.Items[file.ItemIndex];
- UInt64 size = item.Size;
-
- if (!item.IsRecAndAlloc() || !item.CheckChunkSizes() || ! _archive.CheckItemExtents(ref2.Vol, item))
- return E_NOTIMPL;
-
- if (item.IsInline)
- {
- CBufInStream *inStreamSpec = new CBufInStream;
- CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
- inStreamSpec->Init(item.InlineData);
- *stream = inStream .Detach();
- return S_OK;
- }
-
- CExtentsStream *extentStreamSpec = new CExtentsStream();
- CMyComPtr<ISequentialInStream> extentStream = extentStreamSpec;
-
- extentStreamSpec->Stream = _inStream;
-
- UInt64 virtOffset = 0;
- for (int extentIndex = 0; extentIndex < item.Extents.Size(); extentIndex++)
- {
- const CMyExtent &extent = item.Extents[extentIndex];
- UInt32 len = extent.GetLen();
- if (len == 0)
- continue;
- if (size < len)
- return S_FALSE;
-
- int partitionIndex = vol.PartitionMaps[extent.PartitionRef].PartitionIndex;
- UInt32 logBlockNumber = extent.Pos;
- const CPartition &partition = _archive.Partitions[partitionIndex];
- UInt64 offset = ((UInt64)partition.Pos << _archive.SecLogSize) +
- (UInt64)logBlockNumber * vol.BlockSize;
-
- CSeekExtent se;
- se.Phy = offset;
- se.Virt = virtOffset;
- virtOffset += len;
- extentStreamSpec->Extents.Add(se);
-
- size -= len;
- }
- if (size != 0)
- return S_FALSE;
- CSeekExtent se;
- se.Phy = 0;
- se.Virt = virtOffset;
- extentStreamSpec->Extents.Add(se);
- extentStreamSpec->Init();
- *stream = extentStream.Detach();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _refs2.Size();
- if (numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
- UInt32 i;
-
- for (i = 0; i < numItems; i++)
- {
- UInt32 index = (allFilesMode ? i : indices[i]);
- const CRef2 &ref2 = _refs2[index];
- const CRef &ref = _archive.LogVols[ref2.Vol].FileSets[ref2.Fs].Refs[ref2.Ref];
- const CFile &file = _archive.Files[ref.FileIndex];
- const CItem &item = _archive.Items[file.ItemIndex];
- if (!item.IsDir())
- totalSize += item.Size;
- }
- extractCallback->SetTotal(totalSize);
-
- UInt64 currentTotalSize = 0;
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialOutStream *outStreamSpec = new CLimitedSequentialOutStream;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
-
- for (i = 0; i < numItems; i++)
- {
- lps->InSize = lps->OutSize = currentTotalSize;
- RINOK(lps->SetCur());
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- UInt32 index = allFilesMode ? i : indices[i];
-
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
- const CRef2 &ref2 = _refs2[index];
- const CRef &ref = _archive.LogVols[ref2.Vol].FileSets[ref2.Fs].Refs[ref2.Ref];
- const CFile &file = _archive.Files[ref.FileIndex];
- const CItem &item = _archive.Items[file.ItemIndex];
-
- if (item.IsDir())
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
- currentTotalSize += item.Size;
-
- if (!testMode && !realOutStream)
- continue;
-
- RINOK(extractCallback->PrepareOperation(askMode));
- outStreamSpec->SetStream(realOutStream);
- realOutStream.Release();
- outStreamSpec->Init(item.Size);
- Int32 opRes;
- CMyComPtr<ISequentialInStream> udfInStream;
- HRESULT res = GetStream(index, &udfInStream);
- if (res == E_NOTIMPL)
- opRes = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- else if (res != S_OK)
- opRes = NArchive::NExtract::NOperationResult::kDataError;
- else
- {
- RINOK(copyCoder->Code(udfInStream, outStream, NULL, NULL, progress));
- opRes = outStreamSpec->IsFinishedOK() ?
- NArchive::NExtract::NOperationResult::kOK:
- NArchive::NExtract::NOperationResult::kDataError;
- }
- outStreamSpec->ReleaseStream();
- RINOK(extractCallback->SetOperationResult(opRes));
- }
- return S_OK;
- COM_TRY_END
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfHandler.h
deleted file mode 100644
index 63f859af3..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfHandler.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Udf/Handler.h
-
-#ifndef __UDF_HANDLER_H
-#define __UDF_HANDLER_H
-
-#include "Common/MyCom.h"
-#include "../IArchive.h"
-
-#include "UdfIn.h"
-
-namespace NArchive {
-namespace NUdf {
-
-struct CRef2
-{
- int Vol;
- int Fs;
- int Ref;
-};
-
-class CHandler:
- public IInArchive,
- public IInArchiveGetStream,
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _inStream;
- CInArchive _archive;
- CRecordVector<CRef2> _refs2;
-public:
- MY_UNKNOWN_IMP2(IInArchive, IInArchiveGetStream)
- INTERFACE_IInArchive(;)
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-};
-
-}}
-
-#endif
- \ No newline at end of file
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfIn.cpp
deleted file mode 100644
index d2f9e7319..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfIn.cpp
+++ /dev/null
@@ -1,876 +0,0 @@
-// Archive/UdfIn.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/CpuArch.h"
-
-#include "../../Common/StreamUtils.h"
-
-#include "UdfIn.h"
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-#define Get64(p) GetUi64(p)
-
-namespace NArchive {
-namespace NUdf {
-
-const int kNumPartitionsMax = 64;
-const int kNumLogVolumesMax = 64;
-const int kNumRecureseLevelsMax = 1 << 10;
-const int kNumItemsMax = 1 << 27;
-const int kNumFilesMax = 1 << 28;
-const int kNumRefsMax = 1 << 28;
-const UInt32 kNumExtentsMax = (UInt32)1 << 30;
-const UInt64 kFileNameLengthTotalMax = (UInt64)1 << 33;
-const UInt64 kInlineExtentsSizeMax = (UInt64)1 << 33;
-
-void MY_FAST_CALL Crc16GenerateTable(void);
-
-#define CRC16_INIT_VAL 0
-#define CRC16_GET_DIGEST(crc) (crc)
-#define CRC16_UPDATE_BYTE(crc, b) (g_Crc16Table[(((crc) >> 8) ^ (b)) & 0xFF] ^ ((crc) << 8))
-
-#define kCrc16Poly 0x1021
-UInt16 g_Crc16Table[256];
-
-void MY_FAST_CALL Crc16GenerateTable(void)
-{
- UInt32 i;
- for (i = 0; i < 256; i++)
- {
- UInt32 r = (i << 8);
- for (int j = 8; j > 0; j--)
- r = ((r & 0x8000) ? ((r << 1) ^ kCrc16Poly) : (r << 1)) & 0xFFFF;
- g_Crc16Table[i] = (UInt16)r;
- }
-}
-
-UInt16 MY_FAST_CALL Crc16_Update(UInt16 v, const void *data, size_t size)
-{
- const Byte *p = (const Byte *)data;
- for (; size > 0 ; size--, p++)
- v = CRC16_UPDATE_BYTE(v, *p);
- return v;
-}
-
-UInt16 MY_FAST_CALL Crc16Calc(const void *data, size_t size)
-{
- return Crc16_Update(CRC16_INIT_VAL, data, size);
-}
-
-struct CCrc16TableInit { CCrc16TableInit() { Crc16GenerateTable(); } } g_Crc16TableInit;
-
-void CDString128::Parse(const Byte *buf) { memcpy(Data, buf, sizeof(Data)); }
-
-void CDString::Parse(const Byte *p, unsigned size)
-{
- Data.SetCapacity(size);
- memcpy(Data, p, size);
-}
-
-static UString ParseDString(const Byte *data, int size)
-{
- UString res;
- wchar_t *p;
- if (size > 0)
- {
- Byte type = data[0];
- if (type == 8)
- {
- p = res.GetBuffer((int)size + 1);
- for (int i = 1; i < size; i++)
- {
- wchar_t c = data[i];
- if (c == 0)
- break;
- *p++ = c;
- }
- }
- else if (type == 16)
- {
- p = res.GetBuffer((int)size / 2 + 1);
- for (int i = 1; i + 2 <= size; i += 2)
- {
- wchar_t c = ((wchar_t)data[i] << 8) | data[i + 1];
- if (c == 0)
- break;
- *p++ = c;
- }
- }
- else
- return L"[unknow]";
- *p++ = 0;
- res.ReleaseBuffer();
- }
- return res;
-}
-
-UString CDString:: GetString() const { return ParseDString(Data, (int)Data.GetCapacity()); }
-UString CDString128::GetString() const
-{
- int size = Data[sizeof(Data) - 1];
- return ParseDString(Data, MyMin(size, (int)(sizeof(Data) - 1)));
-}
-
-void CTime::Parse(const Byte *buf) { memcpy(Data, buf, sizeof(Data)); }
-
-/*
-void CRegId::Parse(const Byte *buf)
-{
- Flags = buf[0];
- memcpy(Id, buf + 1, sizeof(Id));
- memcpy(Suffix, buf + 24, sizeof(Suffix));
-}
-*/
-
-// ECMA 3/7.1
-
-struct CExtent
-{
- UInt32 Len;
- UInt32 Pos;
-
- void Parse(const Byte *buf);
-};
-
-void CExtent::Parse(const Byte *buf)
-{
- Len = Get32(buf);
- Pos = Get32(buf + 4);
-}
-
-// ECMA 3/7.2
-
-struct CTag
-{
- UInt16 Id;
- UInt16 Version;
- // Byte Checksum;
- // UInt16 SerialNumber;
- // UInt16 Crc;
- // UInt16 CrcLen;
- // UInt32 TagLocation;
-
- HRESULT Parse(const Byte *buf, size_t size);
-};
-
-HRESULT CTag::Parse(const Byte *buf, size_t size)
-{
- if (size < 16)
- return S_FALSE;
- Byte sum = 0;
- int i;
- for (i = 0; i < 4; i++) sum = sum + buf[i];
- for (i = 5; i < 16; i++) sum = sum + buf[i];
- if (sum != buf[4] || buf[5] != 0) return S_FALSE;
-
- Id = Get16(buf);
- Version = Get16(buf + 2);
- // SerialNumber = Get16(buf + 6);
- UInt16 crc = Get16(buf + 8);
- UInt16 crcLen = Get16(buf + 10);
- // TagLocation = Get32(buf + 12);
-
- if (size >= 16 + (size_t)crcLen)
- if (crc == Crc16Calc(buf + 16, crcLen))
- return S_OK;
- return S_FALSE;
-}
-
-// ECMA 3/7.2.1
-
-enum EDescriptorType
-{
- DESC_TYPE_SpoaringTable = 0, // UDF
- DESC_TYPE_PrimVol = 1,
- DESC_TYPE_AnchorVolPtr = 2,
- DESC_TYPE_VolPtr = 3,
- DESC_TYPE_ImplUseVol = 4,
- DESC_TYPE_Partition = 5,
- DESC_TYPE_LogicalVol = 6,
- DESC_TYPE_UnallocSpace = 7,
- DESC_TYPE_Terminating = 8,
- DESC_TYPE_LogicalVolIntegrity = 9,
- DESC_TYPE_FileSet = 256,
- DESC_TYPE_FileId = 257,
- DESC_TYPE_AllocationExtent = 258,
- DESC_TYPE_Indirect = 259,
- DESC_TYPE_Terminal = 260,
- DESC_TYPE_File = 261,
- DESC_TYPE_ExtendedAttrHeader = 262,
- DESC_TYPE_UnallocatedSpace = 263,
- DESC_TYPE_SpaceBitmap = 264,
- DESC_TYPE_PartitionIntegrity = 265,
- DESC_TYPE_ExtendedFile = 266,
-};
-
-
-void CLogBlockAddr::Parse(const Byte *buf)
-{
- Pos = Get32(buf);
- PartitionRef = Get16(buf + 4);
-}
-
-void CShortAllocDesc::Parse(const Byte *buf)
-{
- Len = Get32(buf);
- Pos = Get32(buf + 4);
-}
-
-/*
-void CADImpUse::Parse(const Byte *buf)
-{
- Flags = Get16(buf);
- UdfUniqueId = Get32(buf + 2);
-}
-*/
-
-void CLongAllocDesc::Parse(const Byte *buf)
-{
- Len = Get32(buf);
- Location.Parse(buf + 4);
- // memcpy(ImplUse, buf + 10, sizeof(ImplUse));
- // adImpUse.Parse(ImplUse);
-}
-
-bool CInArchive::CheckExtent(int volIndex, int partitionRef, UInt32 blockPos, UInt32 len) const
-{
- const CLogVol &vol = LogVols[volIndex];
- const CPartition &partition = Partitions[vol.PartitionMaps[partitionRef].PartitionIndex];
- UInt64 offset = ((UInt64)partition.Pos << SecLogSize) + (UInt64)blockPos * vol.BlockSize;
- return (offset + len) <= (((UInt64)partition.Pos + partition.Len) << SecLogSize);
-}
-
-bool CInArchive::CheckItemExtents(int volIndex, const CItem &item) const
-{
- for (int i = 0; i < item.Extents.Size(); i++)
- {
- const CMyExtent &e = item.Extents[i];
- if (!CheckExtent(volIndex, e.PartitionRef, e.Pos, e.GetLen()))
- return false;
- }
- return true;
-}
-
-HRESULT CInArchive::Read(int volIndex, int partitionRef, UInt32 blockPos, UInt32 len, Byte *buf)
-{
- if (!CheckExtent(volIndex, partitionRef, blockPos, len))
- return S_FALSE;
- const CLogVol &vol = LogVols[volIndex];
- const CPartition &partition = Partitions[vol.PartitionMaps[partitionRef].PartitionIndex];
- RINOK(_stream->Seek(((UInt64)partition.Pos << SecLogSize) +
- (UInt64)blockPos * vol.BlockSize, STREAM_SEEK_SET, NULL));
- return ReadStream_FALSE(_stream, buf, len);
-}
-
-HRESULT CInArchive::Read(int volIndex, const CLongAllocDesc &lad, Byte *buf)
-{
- return Read(volIndex, lad.Location.PartitionRef, lad.Location.Pos, lad.GetLen(), (Byte *)buf);
-}
-
-HRESULT CInArchive::ReadFromFile(int volIndex, const CItem &item, CByteBuffer &buf)
-{
- if (item.Size >= (UInt32)1 << 30)
- return S_FALSE;
- if (item.IsInline)
- {
- buf = item.InlineData;
- return S_OK;
- }
- buf.SetCapacity((size_t)item.Size);
- size_t pos = 0;
- for (int i = 0; i < item.Extents.Size(); i++)
- {
- const CMyExtent &e = item.Extents[i];
- UInt32 len = e.GetLen();
- RINOK(Read(volIndex, e.PartitionRef, e.Pos, len, (Byte *)buf + pos));
- pos += len;
- }
- return S_OK;
-}
-
-
-void CIcbTag::Parse(const Byte *p)
-{
- // PriorDirectNum = Get32(p);
- // StrategyType = Get16(p + 4);
- // StrategyParam = Get16(p + 6);
- // MaxNumOfEntries = Get16(p + 8);
- FileType = p[11];
- // ParentIcb.Parse(p + 12);
- Flags = Get16(p + 18);
-}
-
-void CItem::Parse(const Byte *p)
-{
- // Uid = Get32(p + 36);
- // Gid = Get32(p + 40);
- // Permissions = Get32(p + 44);
- // FileLinkCount = Get16(p + 48);
- // RecordFormat = p[50];
- // RecordDisplayAttr = p[51];
- // RecordLen = Get32(p + 52);
- Size = Get64(p + 56);
- NumLogBlockRecorded = Get64(p + 64);
- ATime.Parse(p + 72);
- MTime.Parse(p + 84);
- // AttrtTime.Parse(p + 96);
- // CheckPoint = Get32(p + 108);
- // ExtendedAttrIcb.Parse(p + 112);
- // ImplId.Parse(p + 128);
- // UniqueId = Get64(p + 160);
-}
-
-// 4/14.4
-struct CFileId
-{
- // UInt16 FileVersion;
- Byte FileCharacteristics;
- // CByteBuffer ImplUse;
- CDString Id;
- CLongAllocDesc Icb;
-
- bool IsItLinkParent() const { return (FileCharacteristics & FILEID_CHARACS_Parent) != 0; }
- HRESULT Parse(const Byte *p, size_t size, size_t &processed);
-};
-
-HRESULT CFileId::Parse(const Byte *p, size_t size, size_t &processed)
-{
- processed = 0;
- if (size < 38)
- return S_FALSE;
- CTag tag;
- RINOK(tag.Parse(p, size));
- if (tag.Id != DESC_TYPE_FileId)
- return S_FALSE;
- // FileVersion = Get16(p + 16);
- FileCharacteristics = p[18];
- unsigned idLen = p[19];
- Icb.Parse(p + 20);
- unsigned impLen = Get16(p + 36);
- if (size < 38 + idLen + impLen)
- return S_FALSE;
- // ImplUse.SetCapacity(impLen);
- processed = 38;
- // memcpy(ImplUse, p + processed, impLen);
- processed += impLen;
- Id.Parse(p + processed, idLen);
- processed += idLen;
- for (;(processed & 3) != 0; processed++)
- if (p[processed] != 0)
- return S_FALSE;
- return (processed <= size) ? S_OK : S_FALSE;
-}
-
-HRESULT CInArchive::ReadFileItem(int volIndex, int fsIndex, const CLongAllocDesc &lad, int numRecurseAllowed)
-{
- if (Files.Size() % 100 == 0)
- RINOK(_progress->SetCompleted(Files.Size(), _processedProgressBytes));
- if (numRecurseAllowed-- == 0)
- return S_FALSE;
- CFile &file = Files.Back();
- const CLogVol &vol = LogVols[volIndex];
- CPartition &partition = Partitions[vol.PartitionMaps[lad.Location.PartitionRef].PartitionIndex];
-
- UInt32 key = lad.Location.Pos;
- UInt32 value;
- const UInt32 kRecursedErrorValue = (UInt32)(Int32)-1;
- if (partition.Map.Find(key, value))
- {
- if (value == kRecursedErrorValue)
- return S_FALSE;
- file.ItemIndex = value;
- }
- else
- {
- value = Items.Size();
- file.ItemIndex = (int)value;
- if (partition.Map.Set(key, kRecursedErrorValue))
- return S_FALSE;
- RINOK(ReadItem(volIndex, fsIndex, lad, numRecurseAllowed));
- if (!partition.Map.Set(key, value))
- return S_FALSE;
- }
- return S_OK;
-}
-
-HRESULT CInArchive::ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &lad, int numRecurseAllowed)
-{
- if (Items.Size() > kNumItemsMax)
- return S_FALSE;
- Items.Add(CItem());
- CItem &item = Items.Back();
-
- const CLogVol &vol = LogVols[volIndex];
-
- if (lad.GetLen() != vol.BlockSize)
- return S_FALSE;
-
- CByteBuffer buf;
- size_t size = lad.GetLen();
- buf.SetCapacity(size);
- RINOK(Read(volIndex, lad, buf));
-
- CTag tag;
- const Byte *p = buf;
- RINOK(tag.Parse(p, size));
- if (tag.Id != DESC_TYPE_File)
- return S_FALSE;
-
- item.IcbTag.Parse(p + 16);
- if (item.IcbTag.FileType != ICB_FILE_TYPE_DIR &&
- item.IcbTag.FileType != ICB_FILE_TYPE_FILE)
- return S_FALSE;
-
- item.Parse(p);
-
- _processedProgressBytes += (UInt64)item.NumLogBlockRecorded * vol.BlockSize + size;
-
- UInt32 extendedAttrLen = Get32(p + 168);
- UInt32 allocDescriptorsLen = Get32(p + 172);
-
- if ((extendedAttrLen & 3) != 0)
- return S_FALSE;
- int pos = 176;
- if (extendedAttrLen > size - pos)
- return S_FALSE;
- /*
- if (extendedAttrLen != 16)
- {
- if (extendedAttrLen < 24)
- return S_FALSE;
- CTag attrTag;
- RINOK(attrTag.Parse(p + pos, size));
- if (attrTag.Id != DESC_TYPE_ExtendedAttrHeader)
- return S_FALSE;
- // UInt32 implAttrLocation = Get32(p + pos + 16);
- // UInt32 applicationlAttrLocation = Get32(p + pos + 20);
- }
- */
- pos += extendedAttrLen;
-
- int desctType = item.IcbTag.GetDescriptorType();
- if (allocDescriptorsLen > size - pos)
- return S_FALSE;
- if (desctType == ICB_DESC_TYPE_INLINE)
- {
- item.IsInline = true;
- item.InlineData.SetCapacity(allocDescriptorsLen);
- memcpy(item.InlineData, p + pos, allocDescriptorsLen);
- }
- else
- {
- item.IsInline = false;
- if (desctType != ICB_DESC_TYPE_SHORT && desctType != ICB_DESC_TYPE_LONG)
- return S_FALSE;
- for (UInt32 i = 0; i < allocDescriptorsLen;)
- {
- CMyExtent e;
- if (desctType == ICB_DESC_TYPE_SHORT)
- {
- if (i + 8 > allocDescriptorsLen)
- return S_FALSE;
- CShortAllocDesc sad;
- sad.Parse(p + pos + i);
- e.Pos = sad.Pos;
- e.Len = sad.Len;
- e.PartitionRef = lad.Location.PartitionRef;
- i += 8;
- }
- else
- {
- if (i + 16 > allocDescriptorsLen)
- return S_FALSE;
- CLongAllocDesc ladNew;
- ladNew.Parse(p + pos + i);
- e.Pos = ladNew.Location.Pos;
- e.PartitionRef = ladNew.Location.PartitionRef;
- e.Len = ladNew.Len;
- i += 16;
- }
- item.Extents.Add(e);
- }
- }
-
- if (item.IcbTag.IsDir())
- {
- if (!item.CheckChunkSizes() || !CheckItemExtents(volIndex, item))
- return S_FALSE;
- CByteBuffer buf;
- RINOK(ReadFromFile(volIndex, item, buf));
- item.Size = 0;
- item.Extents.ClearAndFree();
- item.InlineData.Free();
-
- const Byte *p = buf;
- size = buf.GetCapacity();
- size_t processedTotal = 0;
- for (; processedTotal < size;)
- {
- size_t processedCur;
- CFileId fileId;
- RINOK(fileId.Parse(p + processedTotal, size - processedTotal, processedCur));
- if (!fileId.IsItLinkParent())
- {
- CFile file;
- // file.FileVersion = fileId.FileVersion;
- // file.FileCharacteristics = fileId.FileCharacteristics;
- // file.ImplUse = fileId.ImplUse;
- file.Id = fileId.Id;
-
- _fileNameLengthTotal += file.Id.Data.GetCapacity();
- if (_fileNameLengthTotal > kFileNameLengthTotalMax)
- return S_FALSE;
-
- item.SubFiles.Add(Files.Size());
- if (Files.Size() > kNumFilesMax)
- return S_FALSE;
- Files.Add(file);
- RINOK(ReadFileItem(volIndex, fsIndex, fileId.Icb, numRecurseAllowed));
- }
- processedTotal += processedCur;
- }
- }
- else
- {
- if ((UInt32)item.Extents.Size() > kNumExtentsMax - _numExtents)
- return S_FALSE;
- _numExtents += item.Extents.Size();
-
- if (item.InlineData.GetCapacity() > kInlineExtentsSizeMax - _inlineExtentsSize)
- return S_FALSE;
- _inlineExtentsSize += item.InlineData.GetCapacity();
- }
-
- return S_OK;
-}
-
-HRESULT CInArchive::FillRefs(CFileSet &fs, int fileIndex, int parent, int numRecurseAllowed)
-{
- if (_numRefs % 10000 == 0)
- {
- RINOK(_progress->SetCompleted());
- }
- if (numRecurseAllowed-- == 0)
- return S_FALSE;
- if (_numRefs >= kNumRefsMax)
- return S_FALSE;
- _numRefs++;
- CRef ref;
- ref.FileIndex = fileIndex;
- ref.Parent = parent;
- parent = fs.Refs.Size();
- fs.Refs.Add(ref);
- const CItem &item = Items[Files[fileIndex].ItemIndex];
- for (int i = 0; i < item.SubFiles.Size(); i++)
- {
- RINOK(FillRefs(fs, item.SubFiles[i], parent, numRecurseAllowed));
- }
- return S_OK;
-}
-
-HRESULT CInArchive::Open2()
-{
- Clear();
-
- UInt64 fileSize;
- RINOK(_stream->Seek(0, STREAM_SEEK_END, &fileSize));
-
- // Some UDFs contain additional 2 KB of zeros, so we also check 12, corrected to 11.
- const int kSecLogSizeMax = 12;
- Byte buf[1 << kSecLogSizeMax];
- Byte kSizesLog[] = { 11, 8, 12 };
-
- for (int i = 0;; i++)
- {
- if (i == sizeof(kSizesLog) / sizeof(kSizesLog[0]))
- return S_FALSE;
- SecLogSize = kSizesLog[i];
- Int32 bufSize = 1 << SecLogSize;
- if (bufSize > fileSize)
- return S_FALSE;
- RINOK(_stream->Seek(-bufSize, STREAM_SEEK_END, NULL));
- RINOK(ReadStream_FALSE(_stream, buf, bufSize));
- CTag tag;
- if (tag.Parse(buf, bufSize) == S_OK)
- if (tag.Id == DESC_TYPE_AnchorVolPtr)
- break;
- }
- if (SecLogSize == 12)
- SecLogSize = 11;
-
- CExtent extentVDS;
- extentVDS.Parse(buf + 16);
-
- for (UInt32 location = extentVDS.Pos; ; location++)
- {
- size_t bufSize = 1 << SecLogSize;
- size_t pos = 0;
- RINOK(_stream->Seek((UInt64)location << SecLogSize, STREAM_SEEK_SET, NULL));
- RINOK(ReadStream_FALSE(_stream, buf, bufSize));
- CTag tag;
- RINOK(tag.Parse(buf + pos, bufSize - pos));
- if (tag.Id == DESC_TYPE_Terminating)
- break;
- if (tag.Id == DESC_TYPE_Partition)
- {
- if (Partitions.Size() >= kNumPartitionsMax)
- return S_FALSE;
- CPartition partition;
- // UInt32 volDescSeqNumer = Get32(buf + 16);
- // partition.Flags = Get16(buf + 20);
- partition.Number = Get16(buf + 22);
- // partition.ContentsId.Parse(buf + 24);
-
- // memcpy(partition.ContentsUse, buf + 56, sizeof(partition.ContentsUse));
- // ContentsUse is Partition Header Description.
-
- // partition.AccessType = Get32(buf + 184);
- partition.Pos = Get32(buf + 188);
- partition.Len = Get32(buf + 192);
- // partition.ImplId.Parse(buf + 196);
- // memcpy(partition.ImplUse, buf + 228, sizeof(partition.ImplUse));
-
- Partitions.Add(partition);
- }
- else if (tag.Id == DESC_TYPE_LogicalVol)
- {
- if (LogVols.Size() >= kNumLogVolumesMax)
- return S_FALSE;
- CLogVol vol;
- vol.Id.Parse(buf + 84);
- vol.BlockSize = Get32(buf + 212);
- // vol.DomainId.Parse(buf + 216);
-
- if (vol.BlockSize < 512 || vol.BlockSize > ((UInt32)1 << 30))
- return S_FALSE;
-
- // memcpy(vol.ContentsUse, buf + 248, sizeof(vol.ContentsUse));
- vol.FileSetLocation.Parse(buf + 248);
-
- // UInt32 mapTableLength = Get32(buf + 264);
- UInt32 numPartitionMaps = Get32(buf + 268);
- if (numPartitionMaps > kNumPartitionsMax)
- return S_FALSE;
- // vol.ImplId.Parse(buf + 272);
- // memcpy(vol.ImplUse, buf + 128, sizeof(vol.ImplUse));
- size_t pos = 440;
- for (UInt32 i = 0; i < numPartitionMaps; i++)
- {
- if (pos + 2 > bufSize)
- return S_FALSE;
- CPartitionMap pm;
- pm.Type = buf[pos];
- // pm.Length = buf[pos + 1];
- Byte len = buf[pos + 1];
-
- if (pos + len > bufSize)
- return S_FALSE;
-
- // memcpy(pm.Data, buf + pos + 2, pm.Length - 2);
- if (pm.Type == 1)
- {
- if (pos + 6 > bufSize)
- return S_FALSE;
- // pm.VolSeqNumber = Get16(buf + pos + 2);
- pm.PartitionNumber = Get16(buf + pos + 4);
- }
- else
- return S_FALSE;
- pos += len;
- vol.PartitionMaps.Add(pm);
- }
- LogVols.Add(vol);
- }
- }
-
- UInt64 totalSize = 0;
-
- int volIndex;
- for (volIndex = 0; volIndex < LogVols.Size(); volIndex++)
- {
- CLogVol &vol = LogVols[volIndex];
- for (int pmIndex = 0; pmIndex < vol.PartitionMaps.Size(); pmIndex++)
- {
- CPartitionMap &pm = vol.PartitionMaps[pmIndex];
- int i;
- for (i = 0; i < Partitions.Size(); i++)
- {
- CPartition &part = Partitions[i];
- if (part.Number == pm.PartitionNumber)
- {
- if (part.VolIndex >= 0)
- return S_FALSE;
- pm.PartitionIndex = i;
- part.VolIndex = volIndex;
-
- totalSize += (UInt64)part.Len << SecLogSize;
- break;
- }
- }
- if (i == Partitions.Size())
- return S_FALSE;
- }
- }
-
- RINOK(_progress->SetTotal(totalSize));
-
- for (volIndex = 0; volIndex < LogVols.Size(); volIndex++)
- {
- CLogVol &vol = LogVols[volIndex];
-
- CLongAllocDesc nextExtent = vol.FileSetLocation;
- // while (nextExtent.ExtentLen != 0)
- // for (int i = 0; i < 1; i++)
- {
- if (nextExtent.GetLen() < 512)
- return S_FALSE;
- CByteBuffer buf;
- buf.SetCapacity(nextExtent.GetLen());
- RINOK(Read(volIndex, nextExtent, buf));
- const Byte *p = buf;
- size_t size = nextExtent.GetLen();
-
- CTag tag;
- RINOK(tag.Parse(p, size));
- if (tag.Id != DESC_TYPE_FileSet)
- return S_FALSE;
-
- CFileSet fs;
- fs.RecodringTime.Parse(p + 16);
- // fs.InterchangeLevel = Get16(p + 18);
- // fs.MaxInterchangeLevel = Get16(p + 20);
- // fs.FileSetNumber = Get32(p + 40);
- // fs.FileSetDescNumber = Get32(p + 44);
-
- // fs.Id.Parse(p + 304);
- // fs.CopyrightId.Parse(p + 336);
- // fs.AbstractId.Parse(p + 368);
-
- fs.RootDirICB.Parse(p + 400);
- // fs.DomainId.Parse(p + 416);
-
- // fs.SystemStreamDirICB.Parse(p + 464);
-
- vol.FileSets.Add(fs);
-
- // nextExtent.Parse(p + 448);
- }
-
- for (int fsIndex = 0; fsIndex < vol.FileSets.Size(); fsIndex++)
- {
- CFileSet &fs = vol.FileSets[fsIndex];
- int fileIndex = Files.Size();
- Files.Add(CFile());
- RINOK(ReadFileItem(volIndex, fsIndex, fs.RootDirICB, kNumRecureseLevelsMax));
- RINOK(FillRefs(fs, fileIndex, -1, kNumRecureseLevelsMax));
- }
- }
-
- return S_OK;
-}
-
-HRESULT CInArchive::Open(IInStream *inStream, CProgressVirt *progress)
-{
- _progress = progress;
- _stream = inStream;
- HRESULT res;
- try { res = Open2(); }
- catch(...) { Clear(); res = S_FALSE; }
- _stream.Release();
- return res;
-}
-
-void CInArchive::Clear()
-{
- Partitions.Clear();
- LogVols.Clear();
- Items.Clear();
- Files.Clear();
- _fileNameLengthTotal = 0;
- _numRefs = 0;
- _numExtents = 0;
- _inlineExtentsSize = 0;
- _processedProgressBytes = 0;
-}
-
-UString CInArchive::GetComment() const
-{
- UString res;
- for (int i = 0; i < LogVols.Size(); i++)
- {
- if (i > 0)
- res += L" ";
- res += LogVols[i].GetName();
- }
- return res;
-}
-
-static UString GetSpecName(const UString &name)
-{
- UString name2 = name;
- name2.Trim();
- if (name2.IsEmpty())
- {
- /*
- wchar_t s[32];
- ConvertUInt64ToString(id, s);
- return L"[" + (UString)s + L"]";
- */
- return L"[]";
- }
- return name;
-}
-
-static void UpdateWithName(UString &res, const UString &addString)
-{
- if (res.IsEmpty())
- res = addString;
- else
- res = addString + WCHAR_PATH_SEPARATOR + res;
-}
-
-UString CInArchive::GetItemPath(int volIndex, int fsIndex, int refIndex,
- bool showVolName, bool showFsName) const
-{
- // showVolName = true;
- const CLogVol &vol = LogVols[volIndex];
- const CFileSet &fs = vol.FileSets[fsIndex];
-
- UString name;
-
- for (;;)
- {
- const CRef &ref = fs.Refs[refIndex];
- refIndex = ref.Parent;
- if (refIndex < 0)
- break;
- UpdateWithName(name, GetSpecName(Files[ref.FileIndex].GetName()));
- }
-
- if (showFsName)
- {
- wchar_t s[32];
- ConvertUInt64ToString(fsIndex, s);
- UString newName = L"File Set ";
- newName += s;
- UpdateWithName(name, newName);
- }
-
- if (showVolName)
- {
- wchar_t s[32];
- ConvertUInt64ToString(volIndex, s);
- UString newName = s;
- UString newName2 = vol.GetName();
- if (newName2.IsEmpty())
- newName2 = L"Volume";
- newName += L'-';
- newName += newName2;
- UpdateWithName(name, newName);
- }
- return name;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfIn.h
deleted file mode 100644
index 46b9a7e85..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfIn.h
+++ /dev/null
@@ -1,375 +0,0 @@
-// Archive/UdfIn.h -- UDF / ECMA-167
-
-#ifndef __ARCHIVE_UDF_IN_H
-#define __ARCHIVE_UDF_IN_H
-
-#include "Common/MyCom.h"
-#include "Common/IntToString.h"
-#include "Common/Buffer.h"
-#include "Common/MyString.h"
-#include "Common/MyMap.h"
-
-#include "../../IStream.h"
-
-namespace NArchive {
-namespace NUdf {
-
-// ---------- ECMA Part 1 ----------
-
-// ECMA 1/7.2.12
-
-/*
-struct CDString32
-{
- Byte Data[32];
- void Parse(const Byte *buf);
- // UString GetString() const;
-};
-*/
-
-struct CDString128
-{
- Byte Data[128];
- void Parse(const Byte *buf);
- UString GetString() const;
-};
-
-struct CDString
-{
- CByteBuffer Data;
- void Parse(const Byte *p, unsigned size);
- UString GetString() const;
-};
-
-
-// ECMA 1/7.3
-
-struct CTime
-{
- Byte Data[12];
-
- unsigned GetType() const { return Data[1] >> 4; }
- bool IsLocal() const { return GetType() == 1; }
- int GetMinutesOffset() const
- {
- int t = (Data[0] | ((UInt16)Data[1] << 8)) & 0xFFF;
- if ((t >> 11) != 0)
- t -= (1 << 12);
- return (t > (60 * 24) || t < -(60 * 24)) ? 0 : t;
- }
- unsigned GetYear() const { return (Data[2] | ((UInt16)Data[3] << 8)); }
- void Parse(const Byte *buf);
-};
-
-
-// ECMA 1/7.4
-
-/*
-struct CRegId
-{
- Byte Flags;
- char Id[23];
- char Suffix[8];
-
- void Parse(const Byte *buf);
-};
-*/
-
-// ---------- ECMA Part 3: Volume Structure ----------
-
-// ECMA 3/10.5
-
-struct CPartition
-{
- // UInt16 Flags;
- UInt16 Number;
- // CRegId ContentsId;
- // Byte ContentsUse[128];
- // UInt32 AccessType;
-
- UInt32 Pos;
- UInt32 Len;
-
- // CRegId ImplId;
- // Byte ImplUse[128];
-
- int VolIndex;
- CMap32 Map;
-
- CPartition(): VolIndex(-1) {}
-
- // bool IsNsr() const { return (strncmp(ContentsId.Id, "+NSR0", 5) == 0); }
- // bool IsAllocated() const { return ((Flags & 1) != 0); }
-};
-
-struct CLogBlockAddr
-{
- UInt32 Pos;
- UInt16 PartitionRef;
-
- void Parse(const Byte *buf);
-};
-
-enum EShortAllocDescType
-{
- SHORT_ALLOC_DESC_TYPE_RecordedAndAllocated = 0,
- SHORT_ALLOC_DESC_TYPE_NotRecordedButAllocated = 1,
- SHORT_ALLOC_DESC_TYPE_NotRecordedAndNotAllocated = 2,
- SHORT_ALLOC_DESC_TYPE_NextExtent = 3
-};
-
-struct CShortAllocDesc
-{
- UInt32 Len;
- UInt32 Pos;
-
- // 4/14.14.1
- // UInt32 GetLen() const { return Len & 0x3FFFFFFF; }
- // UInt32 GetType() const { return Len >> 30; }
- // bool IsRecAndAlloc() const { return GetType() == SHORT_ALLOC_DESC_TYPE_RecordedAndAllocated; }
- void Parse(const Byte *buf);
-};
-
-/*
-struct CADImpUse
-{
- UInt16 Flags;
- UInt32 UdfUniqueId;
- void Parse(const Byte *buf);
-};
-*/
-
-struct CLongAllocDesc
-{
- UInt32 Len;
- CLogBlockAddr Location;
-
- // Byte ImplUse[6];
- // CADImpUse adImpUse; // UDF
-
- UInt32 GetLen() const { return Len & 0x3FFFFFFF; }
- UInt32 GetType() const { return Len >> 30; }
- bool IsRecAndAlloc() const { return GetType() == SHORT_ALLOC_DESC_TYPE_RecordedAndAllocated; }
- void Parse(const Byte *buf);
-};
-
-struct CPartitionMap
-{
- Byte Type;
- // Byte Len;
-
- // Type - 1
- // UInt16 VolSeqNumber;
- UInt16 PartitionNumber;
-
- // Byte Data[256];
-
- int PartitionIndex;
-};
-
-// ECMA 4/14.6
-
-enum EIcbFileType
-{
- ICB_FILE_TYPE_DIR = 4,
- ICB_FILE_TYPE_FILE = 5
-};
-
-enum EIcbDescriptorType
-{
- ICB_DESC_TYPE_SHORT = 0,
- ICB_DESC_TYPE_LONG = 1,
- ICB_DESC_TYPE_EXTENDED = 2,
- ICB_DESC_TYPE_INLINE = 3
-};
-
-struct CIcbTag
-{
- // UInt32 PriorDirectNum;
- // UInt16 StrategyType;
- // UInt16 StrategyParam;
- // UInt16 MaxNumOfEntries;
- Byte FileType;
- // CLogBlockAddr ParentIcb;
- UInt16 Flags;
-
- bool IsDir() const { return FileType == ICB_FILE_TYPE_DIR; }
- int GetDescriptorType() const { return Flags & 3; }
- void Parse(const Byte *p);
-};
-
-// const Byte FILEID_CHARACS_Existance = (1 << 0);
-const Byte FILEID_CHARACS_Parent = (1 << 3);
-
-struct CFile
-{
- // UInt16 FileVersion;
- // Byte FileCharacteristics;
- // CByteBuffer ImplUse;
- CDString Id;
-
- CFile(): /* FileVersion(0), FileCharacteristics(0), */ ItemIndex(-1) {}
- int ItemIndex;
- UString GetName() const { return Id.GetString(); }
-};
-
-struct CMyExtent
-{
- UInt32 Pos;
- UInt32 Len;
- int PartitionRef;
-
- UInt32 GetLen() const { return Len & 0x3FFFFFFF; }
- UInt32 GetType() const { return Len >> 30; }
- bool IsRecAndAlloc() const { return GetType() == SHORT_ALLOC_DESC_TYPE_RecordedAndAllocated; }
-};
-
-struct CItem
-{
- CIcbTag IcbTag;
-
- // UInt32 Uid;
- // UInt32 Gid;
- // UInt32 Permissions;
- // UInt16 FileLinkCount;
- // Byte RecordFormat;
- // Byte RecordDisplayAttr;
- // UInt32 RecordLen;
- UInt64 Size;
- UInt64 NumLogBlockRecorded;
- CTime ATime;
- CTime MTime;
- // CTime AttrtTime;
- // UInt32 CheckPoint;
- // CLongAllocDesc ExtendedAttrIcb;
- // CRegId ImplId;
- // UInt64 UniqueId;
-
- bool IsInline;
- CByteBuffer InlineData;
- CRecordVector<CMyExtent> Extents;
- CRecordVector<int> SubFiles;
-
- void Parse(const Byte *buf);
-
- bool IsRecAndAlloc() const
- {
- for (int i = 0; i < Extents.Size(); i++)
- if (!Extents[i].IsRecAndAlloc())
- return false;
- return true;
- }
-
- UInt64 GetChunksSumSize() const
- {
- if (IsInline)
- return InlineData.GetCapacity();
- UInt64 size = 0;
- for (int i = 0; i < Extents.Size(); i++)
- size += Extents[i].GetLen();
- return size;
- }
-
- bool CheckChunkSizes() const { return GetChunksSumSize() == Size; }
-
- bool IsDir() const { return IcbTag.IsDir(); }
-};
-
-struct CRef
-{
- int Parent;
- int FileIndex;
-};
-
-
-// ECMA 4 / 14.1
-struct CFileSet
-{
- CTime RecodringTime;
- // UInt16 InterchangeLevel;
- // UInt16 MaxInterchangeLevel;
- // UInt32 FileSetNumber;
- // UInt32 FileSetDescNumber;
- // CDString32 Id;
- // CDString32 CopyrightId;
- // CDString32 AbstractId;
-
- CLongAllocDesc RootDirICB;
- // CRegId DomainId;
- // CLongAllocDesc SystemStreamDirICB;
-
- CRecordVector<CRef> Refs;
-};
-
-
-// ECMA 3/10.6
-
-struct CLogVol
-{
- CDString128 Id;
- UInt32 BlockSize;
- // CRegId DomainId;
-
- // Byte ContentsUse[16];
- CLongAllocDesc FileSetLocation; // UDF
-
- // CRegId ImplId;
- // Byte ImplUse[128];
-
- CObjectVector<CPartitionMap> PartitionMaps;
- CObjectVector<CFileSet> FileSets;
-
- UString GetName() const { return Id.GetString(); }
-};
-
-struct CProgressVirt
-{
- virtual HRESULT SetTotal(UInt64 numBytes) PURE;
- virtual HRESULT SetCompleted(UInt64 numFiles, UInt64 numBytes) PURE;
- virtual HRESULT SetCompleted() PURE;
-};
-
-class CInArchive
-{
- CMyComPtr<IInStream> _stream;
- CProgressVirt *_progress;
-
- HRESULT Read(int volIndex, int partitionRef, UInt32 blockPos, UInt32 len, Byte *buf);
- HRESULT Read(int volIndex, const CLongAllocDesc &lad, Byte *buf);
- HRESULT ReadFromFile(int volIndex, const CItem &item, CByteBuffer &buf);
-
- HRESULT ReadFileItem(int volIndex, int fsIndex, const CLongAllocDesc &lad, int numRecurseAllowed);
- HRESULT ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &lad, int numRecurseAllowed);
-
- HRESULT Open2();
- HRESULT FillRefs(CFileSet &fs, int fileIndex, int parent, int numRecurseAllowed);
-
- UInt64 _processedProgressBytes;
-
- UInt64 _fileNameLengthTotal;
- int _numRefs;
- UInt32 _numExtents;
- UInt64 _inlineExtentsSize;
- bool CheckExtent(int volIndex, int partitionRef, UInt32 blockPos, UInt32 len) const;
-public:
- HRESULT Open(IInStream *inStream, CProgressVirt *progress);
- void Clear();
-
- CObjectVector<CPartition> Partitions;
- CObjectVector<CLogVol> LogVols;
-
- CObjectVector<CItem> Items;
- CObjectVector<CFile> Files;
-
- int SecLogSize;
-
- UString GetComment() const;
- UString GetItemPath(int volIndex, int fsIndex, int refIndex,
- bool showVolName, bool showFsName) const;
-
- bool CheckItemExtents(int volIndex, const CItem &item) const;
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfRegister.cpp
deleted file mode 100644
index b3a6c152e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Udf/UdfRegister.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// UdfRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "UdfHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NUdf::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Udf", L"iso", 0, 0xE0, { 0, 'N', 'S', 'R', '0' }, 5, false, CreateArc, 0 };
-
-REGISTER_ARC(Udf)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/VhdHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/VhdHandler.cpp
deleted file mode 100644
index 5fc2c9189..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/VhdHandler.cpp
+++ /dev/null
@@ -1,731 +0,0 @@
-// VhdHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/Buffer.h"
-#include "Common/ComTry.h"
-#include "Common/IntToString.h"
-#include "Common/MyString.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-
-#define Get16(p) GetBe16(p)
-#define Get32(p) GetBe32(p)
-#define Get64(p) GetBe64(p)
-
-#define G32(p, dest) dest = Get32(p);
-#define G64(p, dest) dest = Get64(p);
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NVhd {
-
-static const UInt32 kUnusedBlock = 0xFFFFFFFF;
-
-static const UInt32 kDiskType_Fixed = 2;
-static const UInt32 kDiskType_Dynamic = 3;
-static const UInt32 kDiskType_Diff = 4;
-
-static const char *kDiskTypes[] =
-{
- "0",
- "1",
- "Fixed",
- "Dynamic",
- "Differencing"
-};
-
-struct CFooter
-{
- // UInt32 Features;
- // UInt32 FormatVersion;
- UInt64 DataOffset;
- UInt32 CTime;
- UInt32 CreatorApp;
- UInt32 CreatorVersion;
- UInt32 CreatorHostOS;
- // UInt64 OriginalSize;
- UInt64 CurrentSize;
- UInt32 DiskGeometry;
- UInt32 Type;
- Byte Id[16];
- Byte SavedState;
-
- bool IsFixed() const { return Type == kDiskType_Fixed; }
- bool ThereIsDynamic() const { return Type == kDiskType_Dynamic || Type == kDiskType_Diff; }
- // bool IsSupported() const { return Type == kDiskType_Fixed || Type == kDiskType_Dynamic || Type == kDiskType_Diff; }
- UInt32 NumCyls() const { return DiskGeometry >> 16; }
- UInt32 NumHeads() const { return (DiskGeometry >> 8) & 0xFF; }
- UInt32 NumSectorsPerTrack() const { return DiskGeometry & 0xFF; }
- AString GetTypeString() const;
- bool Parse(const Byte *p);
-};
-
-AString CFooter::GetTypeString() const
-{
- if (Type < sizeof(kDiskTypes) / sizeof(kDiskTypes[0]))
- return kDiskTypes[Type];
- char s[16];
- ConvertUInt32ToString(Type, s);
- return s;
-}
-
-static bool CheckBlock(const Byte *p, unsigned size, unsigned checkSumOffset, unsigned zeroOffset)
-{
- UInt32 sum = 0;
- unsigned i;
- for (i = 0; i < checkSumOffset; i++)
- sum += p[i];
- for (i = checkSumOffset + 4; i < size; i++)
- sum += p[i];
- if (~sum != Get32(p + checkSumOffset))
- return false;
- for (i = zeroOffset; i < size; i++)
- if (p[i] != 0)
- return false;
- return true;
-}
-
-bool CFooter::Parse(const Byte *p)
-{
- if (memcmp(p, "conectix", 8) != 0)
- return false;
- // G32(p + 0x08, Features);
- // G32(p + 0x0C, FormatVersion);
- G64(p + 0x10, DataOffset);
- G32(p + 0x18, CTime);
- G32(p + 0x1C, CreatorApp);
- G32(p + 0x20, CreatorVersion);
- G32(p + 0x24, CreatorHostOS);
- // G64(p + 0x28, OriginalSize);
- G64(p + 0x30, CurrentSize);
- G32(p + 0x38, DiskGeometry);
- G32(p + 0x3C, Type);
- memcpy(Id, p + 0x44, 16);
- SavedState = p[0x54];
- return CheckBlock(p, 512, 0x40, 0x55);
-}
-
-/*
-struct CParentLocatorEntry
-{
- UInt32 Code;
- UInt32 DataSpace;
- UInt32 DataLen;
- UInt64 DataOffset;
-
- bool Parse(const Byte *p);
-};
-bool CParentLocatorEntry::Parse(const Byte *p)
-{
- G32(p + 0x00, Code);
- G32(p + 0x04, DataSpace);
- G32(p + 0x08, DataLen);
- G32(p + 0x10, DataOffset);
- return (Get32(p + 0x0C) == 0); // Resrved
-}
-*/
-
-struct CDynHeader
-{
- // UInt64 DataOffset;
- UInt64 TableOffset;
- // UInt32 HeaderVersion;
- UInt32 NumBlocks;
- int BlockSizeLog;
- UInt32 ParentTime;
- Byte ParentId[16];
- UString ParentName;
- // CParentLocatorEntry ParentLocators[8];
-
- bool Parse(const Byte *p);
- UInt32 NumBitMapSectors() const
- {
- UInt32 numSectorsInBlock = (1 << (BlockSizeLog - 9));
- return (numSectorsInBlock + 512 * 8 - 1) / (512 * 8);
- }
-};
-
-static int GetLog(UInt32 num)
-{
- for (int i = 0; i < 31; i++)
- if (((UInt32)1 << i) == num)
- return i;
- return -1;
-}
-
-bool CDynHeader::Parse(const Byte *p)
-{
- if (memcmp(p, "cxsparse", 8) != 0)
- return false;
- // G64(p + 0x08, DataOffset);
- G64(p + 0x10, TableOffset);
- // G32(p + 0x18, HeaderVersion);
- G32(p + 0x1C, NumBlocks);
- BlockSizeLog = GetLog(Get32(p + 0x20));
- if (BlockSizeLog < 9 || BlockSizeLog > 30)
- return false;
- G32(p + 0x38, ParentTime);
- if (Get32(p + 0x3C) != 0) // reserved
- return false;
- memcpy(ParentId, p + 0x28, 16);
- {
- const int kNameLength = 256;
- wchar_t *s = ParentName.GetBuffer(kNameLength);
- for (unsigned i = 0; i < kNameLength; i++)
- s[i] = Get16(p + 0x40 + i * 2);
- s[kNameLength] = 0;
- ParentName.ReleaseBuffer();
- }
- /*
- for (int i = 0; i < 8; i++)
- if (!ParentLocators[i].Parse(p + 0x240 + i * 24))
- return false;
- */
- return CheckBlock(p, 1024, 0x24, 0x240 + 8 * 24);
-}
-
-class CHandler:
- public IInStream,
- public IInArchive,
- public IInArchiveGetStream,
- public CMyUnknownImp
-{
- UInt64 _virtPos;
- UInt64 _phyPos;
- UInt64 _phyLimit;
-
- CFooter Footer;
- CDynHeader Dyn;
- CRecordVector<UInt32> Bat;
- CByteBuffer BitMap;
- UInt32 BitMapTag;
- UInt32 NumUsedBlocks;
- CMyComPtr<IInStream> Stream;
- CMyComPtr<IInStream> ParentStream;
- CHandler *Parent;
-
- HRESULT Seek(UInt64 offset);
- HRESULT InitAndSeek();
- HRESULT ReadPhy(UInt64 offset, void *data, UInt32 size);
-
- bool NeedParent() const { return Footer.Type == kDiskType_Diff; }
- UInt64 GetSize() const { return Footer.CurrentSize; }
- UInt64 GetPackSize() const
- { return Footer.ThereIsDynamic() ? ((UInt64)NumUsedBlocks << Dyn.BlockSizeLog) : Footer.CurrentSize; }
-
- UString GetParentName() const
- {
- const CHandler *p = this;
- UString res;
- while (p && p->NeedParent())
- {
- if (!res.IsEmpty())
- res += L" -> ";
- res += p->Dyn.ParentName;
- p = p->Parent;
- }
- return res;
- }
-
- bool IsOK() const
- {
- const CHandler *p = this;
- while (p->NeedParent())
- {
- p = p->Parent;
- if (p == 0)
- return false;
- }
- return true;
- }
-
- HRESULT Open3();
- HRESULT Open2(IInStream *stream, CHandler *child, IArchiveOpenCallback *openArchiveCallback, int level);
-
-public:
- MY_UNKNOWN_IMP3(IInArchive, IInArchiveGetStream, IInStream)
-
- INTERFACE_IInArchive(;)
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-};
-
-HRESULT CHandler::Seek(UInt64 offset) { return Stream->Seek(offset, STREAM_SEEK_SET, NULL); }
-
-HRESULT CHandler::InitAndSeek()
-{
- if (ParentStream)
- {
- RINOK(Parent->InitAndSeek());
- }
- _virtPos = _phyPos = 0;
- BitMapTag = kUnusedBlock;
- BitMap.SetCapacity(Dyn.NumBitMapSectors() << 9);
- return Seek(0);
-}
-
-HRESULT CHandler::ReadPhy(UInt64 offset, void *data, UInt32 size)
-{
- if (offset + size > _phyLimit)
- return S_FALSE;
- if (offset != _phyPos)
- {
- _phyPos = offset;
- RINOK(Seek(offset));
- }
- HRESULT res = ReadStream_FALSE(Stream, data, size);
- _phyPos += size;
- return res;
-}
-
-HRESULT CHandler::Open3()
-{
- RINOK(Stream->Seek(0, STREAM_SEEK_END, &_phyPos));
- if (_phyPos < 512)
- return S_FALSE;
- const UInt32 kDynSize = 1024;
- Byte buf[kDynSize];
-
- _phyLimit = _phyPos;
- RINOK(ReadPhy(_phyLimit - 512, buf, 512));
- if (!Footer.Parse(buf))
- return S_FALSE;
- _phyLimit -= 512;
-
- if (!Footer.ThereIsDynamic())
- return S_OK;
-
- RINOK(ReadPhy(0, buf + 512, 512));
- if (memcmp(buf, buf + 512, 512) != 0)
- return S_FALSE;
-
- RINOK(ReadPhy(Footer.DataOffset, buf, kDynSize));
- if (!Dyn.Parse(buf))
- return S_FALSE;
-
- if (Dyn.NumBlocks >= (UInt32)1 << 31)
- return S_FALSE;
- if (GetSize() != ((UInt64)Dyn.NumBlocks << Dyn.BlockSizeLog))
- return S_FALSE;
-
- Bat.Reserve(Dyn.NumBlocks);
- while ((UInt32)Bat.Size() < Dyn.NumBlocks)
- {
- RINOK(ReadPhy(Dyn.TableOffset + (UInt64)Bat.Size() * 4, buf, 512));
- for (UInt32 j = 0; j < 512; j += 4)
- {
- UInt32 v = Get32(buf + j);
- if (v != kUnusedBlock)
- NumUsedBlocks++;
- Bat.Add(v);
- if ((UInt32)Bat.Size() >= Dyn.NumBlocks)
- break;
- }
- }
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != NULL)
- *processedSize = 0;
- if (_virtPos >= GetSize())
- return (GetSize() == _virtPos) ? S_OK: E_FAIL;
- if (size == 0)
- return S_OK;
- UInt32 blockIndex = (UInt32)(_virtPos >> Dyn.BlockSizeLog);
- UInt32 blockSectIndex = Bat[blockIndex];
- UInt32 blockSize = (UInt32)1 << Dyn.BlockSizeLog;
- UInt32 offsetInBlock = (UInt32)_virtPos & (blockSize - 1);
- size = MyMin(blockSize - offsetInBlock, size);
-
- HRESULT res = S_OK;
- if (blockSectIndex == kUnusedBlock)
- {
- if (ParentStream)
- {
- RINOK(ParentStream->Seek(_virtPos, STREAM_SEEK_SET, NULL));
- res = ParentStream->Read(data, size, &size);
- }
- else
- memset(data, 0, size);
- }
- else
- {
- UInt64 newPos = (UInt64)blockSectIndex << 9;
- if (BitMapTag != blockIndex)
- {
- RINOK(ReadPhy(newPos, BitMap, (UInt32)BitMap.GetCapacity()));
- BitMapTag = blockIndex;
- }
- RINOK(ReadPhy(newPos + BitMap.GetCapacity() + offsetInBlock, data, size));
- for (UInt32 cur = 0; cur < size;)
- {
- UInt32 rem = MyMin(0x200 - (offsetInBlock & 0x1FF), size - cur);
- UInt32 bmi = offsetInBlock >> 9;
- if (((BitMap[bmi >> 3] >> (7 - (bmi & 7))) & 1) == 0)
- {
- if (ParentStream)
- {
- RINOK(ParentStream->Seek(_virtPos + cur, STREAM_SEEK_SET, NULL));
- RINOK(ReadStream_FALSE(ParentStream, (Byte *)data + cur, rem));
- }
- else
- {
- const Byte *p = (const Byte *)data + cur;
- for (UInt32 i = 0; i < rem; i++)
- if (p[i] != 0)
- return S_FALSE;
- }
- }
- offsetInBlock += rem;
- cur += rem;
- }
- }
- if (processedSize != NULL)
- *processedSize = size;
- _virtPos += size;
- return res;
-}
-
-STDMETHODIMP CHandler::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
- switch(seekOrigin)
- {
- case STREAM_SEEK_SET: _virtPos = offset; break;
- case STREAM_SEEK_CUR: _virtPos += offset; break;
- case STREAM_SEEK_END: _virtPos = GetSize() + offset; break;
- default: return STG_E_INVALIDFUNCTION;
- }
- if (newPosition)
- *newPosition = _virtPos;
- return S_OK;
-}
-
-enum
-{
- kpidParent = kpidUserDefined,
- kpidSavedState
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidClusterSize, VT_UI8},
- { NULL, kpidMethod, VT_BSTR},
- { L"Parent", kpidParent, VT_BSTR},
- { NULL, kpidCreatorApp, VT_BSTR},
- { NULL, kpidHostOS, VT_BSTR},
- { L"Saved State", kpidSavedState, VT_BOOL},
- { NULL, kpidId, VT_BSTR}
- };
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidCTime, VT_FILETIME}
-
- /*
- { NULL, kpidNumCyls, VT_UI4},
- { NULL, kpidNumHeads, VT_UI4},
- { NULL, kpidSectorsPerTrack, VT_UI4}
- */
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_WITH_NAME
-
-// VHD start time: 2000-01-01
-static const UInt64 kVhdTimeStartValue = (UInt64)3600 * 24 * (399 * 365 + 24 * 4);
-
-static void VhdTimeToFileTime(UInt32 vhdTime, NCOM::CPropVariant &prop)
-{
- FILETIME ft, utc;
- UInt64 v = (kVhdTimeStartValue + vhdTime) * 10000000;
- ft.dwLowDateTime = (DWORD)v;
- ft.dwHighDateTime = (DWORD)(v >> 32);
- // specification says that it's UTC time, but Virtual PC 6 writes local time. Why?
- LocalFileTimeToFileTime(&ft, &utc);
- prop = utc;
-}
-
-static void StringToAString(char *dest, UInt32 s)
-{
- for (int i = 24; i >= 0; i -= 8)
- {
- Byte b = (Byte)((s >> i) & 0xFF);
- if (b < 0x20 || b > 0x7F)
- break;
- *dest++ = b;
- }
- *dest = 0;
-}
-
-static void ConvertByteToHex(unsigned value, char *s)
-{
- for (int i = 0; i < 2; i++)
- {
- unsigned t = value & 0xF;
- value >>= 4;
- s[1 - i] = (char)((t < 10) ? ('0' + t) : ('A' + (t - 10)));
- }
-}
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidMainSubfile: prop = (UInt32)0; break;
- case kpidCTime: VhdTimeToFileTime(Footer.CTime, prop); break;
- case kpidClusterSize: if (Footer.ThereIsDynamic()) prop = (UInt32)1 << Dyn.BlockSizeLog; break;
- case kpidMethod:
- {
- AString s = Footer.GetTypeString();
- if (NeedParent())
- {
- s += " -> ";
- const CHandler *p = this;
- while (p != 0 && p->NeedParent())
- p = p->Parent;
- if (p == 0)
- s += '?';
- else
- s += p->Footer.GetTypeString();
- }
- prop = s;
- break;
- }
- case kpidCreatorApp:
- {
- char s[16];
- StringToAString(s, Footer.CreatorApp);
- AString res = s;
- res.Trim();
- ConvertUInt32ToString(Footer.CreatorVersion >> 16, s);
- res += ' ';
- res += s;
- res += '.';
- ConvertUInt32ToString(Footer.CreatorVersion & 0xFFFF, s);
- res += s;
- prop = res;
- break;
- }
- case kpidHostOS:
- {
- if (Footer.CreatorHostOS == 0x5769326b)
- prop = "Windows";
- else
- {
- char s[16];
- StringToAString(s, Footer.CreatorHostOS);
- prop = s;
- }
- break;
- }
- case kpidId:
- {
- char s[32 + 4];
- for (int i = 0; i < 16; i++)
- ConvertByteToHex(Footer.Id[i], s + i * 2);
- s[32] = 0;
- prop = s;
- break;
- }
- case kpidSavedState: prop = Footer.SavedState ? true : false; break;
- case kpidParent: if (NeedParent()) prop = GetParentName(); break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-HRESULT CHandler::Open2(IInStream *stream, CHandler *child, IArchiveOpenCallback *openArchiveCallback, int level)
-{
- Close();
- Stream = stream;
- if (level > 32)
- return S_FALSE;
- RINOK(Open3());
- if (child && memcmp(child->Dyn.ParentId, Footer.Id, 16) != 0)
- return S_FALSE;
- if (Footer.Type != kDiskType_Diff)
- return S_OK;
- CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
- if (openArchiveCallback->QueryInterface(IID_IArchiveOpenVolumeCallback, (void **)&openVolumeCallback) != S_OK)
- return S_FALSE;
- CMyComPtr<IInStream> nextStream;
- HRESULT res = openVolumeCallback->GetStream(Dyn.ParentName, &nextStream);
- if (res == S_FALSE)
- return S_OK;
- RINOK(res);
-
- Parent = new CHandler;
- ParentStream = Parent;
- return Parent->Open2(nextStream, this, openArchiveCallback, level + 1);
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * openArchiveCallback)
-{
- COM_TRY_BEGIN
- {
- HRESULT res;
- try
- {
- res = Open2(stream, NULL, openArchiveCallback, 0);
- if (res == S_OK)
- return S_OK;
- }
- catch(...)
- {
- Close();
- throw;
- }
- Close();
- return res;
- }
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- Bat.Clear();
- NumUsedBlocks = 0;
- Parent = 0;
- Stream.Release();
- ParentStream.Release();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = 1;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
-
- switch(propID)
- {
- case kpidSize: prop = GetSize(); break;
- case kpidPackSize: prop = GetPackSize(); break;
- case kpidCTime: VhdTimeToFileTime(Footer.CTime, prop); break;
- /*
- case kpidNumCyls: prop = Footer.NumCyls(); break;
- case kpidNumHeads: prop = Footer.NumHeads(); break;
- case kpidSectorsPerTrack: prop = Footer.NumSectorsPerTrack(); break;
- */
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- if (numItems == UInt32(-1))
- numItems = 1;
- if (numItems == 0)
- return S_OK;
- if (numItems != 1 || indices[0] != 0)
- return E_INVALIDARG;
-
- bool testMode = (_aTestMode != 0);
-
- RINOK(extractCallback->SetTotal(GetSize()));
- CMyComPtr<ISequentialOutStream> outStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- RINOK(extractCallback->GetStream(0, &outStream, askMode));
- if (!testMode && !outStream)
- return S_OK;
- RINOK(extractCallback->PrepareOperation(askMode));
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- int res = NArchive::NExtract::NOperationResult::kDataError;
- CMyComPtr<ISequentialInStream> inStream;
- HRESULT hres = GetStream(0, &inStream);
- if (hres == S_FALSE)
- res = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- else
- {
- RINOK(hres);
- HRESULT hres = copyCoder->Code(inStream, outStream, NULL, NULL, progress);
- if (hres == S_OK)
- {
- if (copyCoderSpec->TotalSize == GetSize())
- res = NArchive::NExtract::NOperationResult::kOK;
- }
- else
- {
- if (hres != S_FALSE)
- {
- RINOK(hres);
- }
- }
- }
- outStream.Release();
- return extractCallback->SetOperationResult(res);
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetStream(UInt32 /* index */, ISequentialInStream **stream)
-{
- COM_TRY_BEGIN
- *stream = 0;
- if (Footer.IsFixed())
- {
- CLimitedInStream *streamSpec = new CLimitedInStream;
- CMyComPtr<ISequentialInStream> streamTemp = streamSpec;
- streamSpec->SetStream(Stream);
- streamSpec->InitAndSeek(0, GetSize());
- RINOK(streamSpec->SeekToStart());
- *stream = streamTemp.Detach();
- return S_OK;
- }
- if (!Footer.ThereIsDynamic() || !IsOK())
- return S_FALSE;
- CMyComPtr<ISequentialInStream> streamTemp = this;
- RINOK(InitAndSeek());
- *stream = streamTemp.Detach();
- return S_OK;
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"VHD", L"vhd", L".mbr", 0xDC, { 'c', 'o', 'n', 'e', 'c', 't', 'i', 'x', 0, 0 }, 10, false, CreateArc, 0 };
-
-REGISTER_ARC(Vhd)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.cpp
deleted file mode 100644
index 1b8661c9f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.cpp
+++ /dev/null
@@ -1,619 +0,0 @@
-// WimHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/Defs.h"
-#include "Common/ComTry.h"
-#include "Common/StringToInt.h"
-#include "Common/UTFConvert.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../../Common/StreamUtils.h"
-#include "../../Common/ProgressUtils.h"
-
-#include "../../../../C/CpuArch.h"
-
-#include "WimHandler.h"
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-#define Get64(p) GetUi64(p)
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NWim {
-
-#define WIM_DETAILS
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidAttrib, VT_UI4},
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidATime, VT_FILETIME}
-
- #ifdef WIM_DETAILS
- , { NULL, kpidVolume, VT_UI4}
- , { NULL, kpidOffset, VT_UI8}
- , { NULL, kpidLinks, VT_UI4}
- #endif
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidComment, VT_FILETIME},
- { NULL, kpidIsVolume, VT_BOOL},
- { NULL, kpidVolume, VT_UI4},
- { NULL, kpidNumVolumes, VT_UI4}
-};
-
-static bool ParseNumber64(const AString &s, UInt64 &res)
-{
- const char *end;
- if (s.Left(2) == "0x")
- {
- if (s.Length() == 2)
- return false;
- res = ConvertHexStringToUInt64((const char *)s + 2, &end);
- }
- else
- {
- if (s.IsEmpty())
- return false;
- res = ConvertStringToUInt64(s, &end);
- }
- return *end == 0;
-}
-
-static bool ParseNumber32(const AString &s, UInt32 &res)
-{
- UInt64 res64;
- if (!ParseNumber64(s, res64) || res64 >= ((UInt64)1 << 32))
- return false;
- res = (UInt32)res64;
- return true;
-}
-
-void ParseTime(const CXmlItem &item, bool &defined, FILETIME &ft, const AString &s)
-{
- defined = false;
- int cTimeIndex = item.FindSubTag(s);
- if (cTimeIndex >= 0)
- {
- const CXmlItem &timeItem = item.SubItems[cTimeIndex];
- UInt32 high = 0, low = 0;
- if (ParseNumber32(timeItem.GetSubStringForTag("HIGHPART"), high) &&
- ParseNumber32(timeItem.GetSubStringForTag("LOWPART"), low))
- {
- defined = true;
- ft.dwHighDateTime = high;
- ft.dwLowDateTime = low;
- }
- }
-}
-
-void CImageInfo::Parse(const CXmlItem &item)
-{
- ParseTime(item, CTimeDefined, CTime, "CREATIONTIME");
- ParseTime(item, MTimeDefined, MTime, "LASTMODIFICATIONTIME");
- NameDefined = ConvertUTF8ToUnicode(item.GetSubStringForTag("NAME"), Name);
- // IndexDefined = ParseNumber32(item.GetPropertyValue("INDEX"), Index);
-}
-
-void CXml::Parse()
-{
- size_t size = Data.GetCapacity();
- if (size < 2 || (size & 1) != 0 || (size > 1 << 24))
- return;
- const Byte *p = Data;
- if (Get16(p) != 0xFEFF)
- return;
- UString s;
- {
- wchar_t *chars = s.GetBuffer((int)size / 2 + 1);
- for (size_t i = 2; i < size; i += 2)
- *chars++ = (wchar_t)Get16(p + i);
- *chars = 0;
- s.ReleaseBuffer();
- }
-
- AString utf;
- if (!ConvertUnicodeToUTF8(s, utf))
- return;
- ::CXml xml;
- if (!xml.Parse(utf))
- return;
- if (xml.Root.Name != "WIM")
- return;
-
- for (int i = 0; i < xml.Root.SubItems.Size(); i++)
- {
- const CXmlItem &item = xml.Root.SubItems[i];
- if (item.IsTagged("IMAGE"))
- {
- CImageInfo imageInfo;
- imageInfo.Parse(item);
- Images.Add(imageInfo);
- }
- }
-}
-
-static const wchar_t *kStreamsNamePrefix = L"Files" WSTRING_PATH_SEPARATOR;
-static const wchar_t *kMethodLZX = L"LZX";
-static const wchar_t *kMethodXpress = L"XPress";
-static const wchar_t *kMethodCopy = L"Copy";
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
-
- const CImageInfo *image = NULL;
- if (m_Xmls.Size() == 1)
- {
- const CXml &xml = m_Xmls[0];
- if (xml.Images.Size() == 1)
- image = &xml.Images[0];
- }
-
- switch(propID)
- {
- case kpidSize: prop = m_Database.GetUnpackSize(); break;
- case kpidPackSize: prop = m_Database.GetPackSize(); break;
-
- case kpidCTime:
- if (m_Xmls.Size() == 1)
- {
- const CXml &xml = m_Xmls[0];
- int index = -1;
- for (int i = 0; i < xml.Images.Size(); i++)
- {
- const CImageInfo &image = xml.Images[i];
- if (image.CTimeDefined)
- if (index < 0 || ::CompareFileTime(&image.CTime, &xml.Images[index].CTime) < 0)
- index = i;
- }
- if (index >= 0)
- prop = xml.Images[index].CTime;
- }
- break;
-
- case kpidMTime:
- if (m_Xmls.Size() == 1)
- {
- const CXml &xml = m_Xmls[0];
- int index = -1;
- for (int i = 0; i < xml.Images.Size(); i++)
- {
- const CImageInfo &image = xml.Images[i];
- if (image.MTimeDefined)
- if (index < 0 || ::CompareFileTime(&image.MTime, &xml.Images[index].MTime) > 0)
- index = i;
- }
- if (index >= 0)
- prop = xml.Images[index].MTime;
- }
- break;
-
- case kpidComment: if (image != NULL && image->NameDefined) prop = image->Name; break;
-
- case kpidIsVolume:
- if (m_Xmls.Size() > 0)
- {
- UInt16 volIndex = m_Xmls[0].VolIndex;
- if (volIndex < m_Volumes.Size())
- prop = (m_Volumes[volIndex].Header.NumParts > 1);
- }
- break;
- case kpidVolume:
- if (m_Xmls.Size() > 0)
- {
- UInt16 volIndex = m_Xmls[0].VolIndex;
- if (volIndex < m_Volumes.Size())
- prop = (UInt32)m_Volumes[volIndex].Header.PartNumber;
- }
- break;
- case kpidNumVolumes: if (m_Volumes.Size() > 0) prop = (UInt32)(m_Volumes.Size() - 1); break;
- case kpidMethod:
- {
- bool lzx = false, xpress = false, copy = false;
- for (int i = 0; i < m_Xmls.Size(); i++)
- {
- const CVolume &vol = m_Volumes[m_Xmls[i].VolIndex];
- const CHeader &header = vol.Header;
- if (header.IsCompressed())
- if (header.IsLzxMode())
- lzx = true;
- else
- xpress = true;
- else
- copy = true;
- }
- UString res;
- if (lzx)
- res = kMethodLZX;
- if (xpress)
- {
- if (!res.IsEmpty())
- res += L' ';
- res += kMethodXpress;
- }
- if (copy)
- {
- if (!res.IsEmpty())
- res += L' ';
- res += kMethodCopy;
- }
- prop = res;
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- if (index < (UInt32)m_Database.Items.Size())
- {
- const CItem &item = m_Database.Items[index];
- const CStreamInfo *si = NULL;
- const CVolume *vol = NULL;
- if (item.StreamIndex >= 0)
- {
- si = &m_Database.Streams[item.StreamIndex];
- vol = &m_Volumes[si->PartNumber];
- }
-
- switch(propID)
- {
- case kpidPath:
- if (item.HasMetadata)
- prop = item.Name;
- else
- {
- wchar_t sz[32];
- ConvertUInt64ToString(item.StreamIndex, sz);
- UString s = sz;
- while (s.Length() < m_NameLenForStreams)
- s = L'0' + s;
- s = UString(kStreamsNamePrefix) + s;
- prop = s;
- break;
- }
- break;
- case kpidIsDir: prop = item.isDir(); break;
- case kpidAttrib: if (item.HasMetadata) prop = item.Attrib; break;
- case kpidCTime: if (item.HasMetadata) prop = item.CTime; break;
- case kpidATime: if (item.HasMetadata) prop = item.ATime; break;
- case kpidMTime: if (item.HasMetadata) prop = item.MTime; break;
- case kpidPackSize: prop = si ? si->Resource.PackSize : (UInt64)0; break;
- case kpidSize: prop = si ? si->Resource.UnpackSize : (UInt64)0; break;
- case kpidMethod: if (si) prop = si->Resource.IsCompressed() ?
- (vol->Header.IsLzxMode() ? kMethodLZX : kMethodXpress) : kMethodCopy; break;
- #ifdef WIM_DETAILS
- case kpidVolume: if (si) prop = (UInt32)si->PartNumber; break;
- case kpidOffset: if (si) prop = (UInt64)si->Resource.Offset; break;
- case kpidLinks: prop = si ? (UInt32)si->RefCount : (UInt32)0; break;
- #endif
- }
- }
- else
- {
- index -= m_Database.Items.Size();
- {
- switch(propID)
- {
- case kpidPath:
- {
- wchar_t sz[32];
- ConvertUInt64ToString(m_Xmls[index].VolIndex, sz);
- UString s = (UString)sz + L".xml";
- prop = s;
- break;
- }
- case kpidIsDir: prop = false; break;
- case kpidPackSize:
- case kpidSize: prop = (UInt64)m_Xmls[index].Data.GetCapacity(); break;
- case kpidMethod: prop = L"Copy"; break;
- }
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-class CVolumeName
-{
- // UInt32 _volIndex;
- UString _before;
- UString _after;
-public:
- CVolumeName() {};
-
- void InitName(const UString &name)
- {
- // _volIndex = 1;
- int dotPos = name.ReverseFind('.');
- if (dotPos < 0)
- dotPos = name.Length();
- _before = name.Left(dotPos);
- _after = name.Mid(dotPos);
- }
-
- UString GetNextName(UInt32 index)
- {
- wchar_t s[32];
- ConvertUInt64ToString((index), s);
- return _before + (UString)s + _after;
- }
-};
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback *openArchiveCallback)
-{
- COM_TRY_BEGIN
- Close();
- try
- {
- CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
-
- CVolumeName seqName;
- if (openArchiveCallback != NULL)
- openArchiveCallback->QueryInterface(IID_IArchiveOpenVolumeCallback, (void **)&openVolumeCallback);
-
- UInt32 numVolumes = 1;
- int firstVolumeIndex = -1;
- for (UInt32 i = 1; i <= numVolumes; i++)
- {
- CMyComPtr<IInStream> curStream;
- if (i != 1)
- {
- UString fullName = seqName.GetNextName(i);
- HRESULT result = openVolumeCallback->GetStream(fullName, &curStream);
- if (result == S_FALSE)
- continue;
- if (result != S_OK)
- return result;
- if (!curStream)
- break;
- }
- else
- curStream = inStream;
- CHeader header;
- HRESULT res = NWim::ReadHeader(curStream, header);
- if (res != S_OK)
- {
- if (i == 1)
- return res;
- if (res == S_FALSE)
- continue;
- return res;
- }
- if (firstVolumeIndex >= 0)
- if (!header.AreFromOnArchive(m_Volumes[firstVolumeIndex].Header))
- break;
- if (m_Volumes.Size() > header.PartNumber && m_Volumes[header.PartNumber].Stream)
- break;
- CXml xml;
- xml.VolIndex = header.PartNumber;
- res = OpenArchive(curStream, header, xml.Data, m_Database);
- if (res != S_OK)
- {
- if (i == 1)
- return res;
- if (res == S_FALSE)
- continue;
- return res;
- }
-
- while (m_Volumes.Size() <= header.PartNumber)
- m_Volumes.Add(CVolume());
- CVolume &volume = m_Volumes[header.PartNumber];
- volume.Header = header;
- volume.Stream = curStream;
-
- firstVolumeIndex = header.PartNumber;
-
- bool needAddXml = true;
- if (m_Xmls.Size() != 0)
- if (xml.Data == m_Xmls[0].Data)
- needAddXml = false;
- if (needAddXml)
- {
- xml.Parse();
- m_Xmls.Add(xml);
- }
-
- if (i == 1)
- {
- if (header.PartNumber != 1)
- break;
- if (!openVolumeCallback)
- break;
- numVolumes = header.NumParts;
- {
- NCOM::CPropVariant prop;
- RINOK(openVolumeCallback->GetProperty(kpidName, &prop));
- if (prop.vt != VT_BSTR)
- break;
- seqName.InitName(prop.bstrVal);
- }
- }
- }
-
- RINOK(SortDatabase(m_Database));
-
- wchar_t sz[32];
- ConvertUInt64ToString(m_Database.Streams.Size(), sz);
- m_NameLenForStreams = MyStringLen(sz);
- }
- catch(...)
- {
- return S_FALSE;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- m_Database.Clear();
- m_Volumes.Clear();
- m_Xmls.Clear();
- m_NameLenForStreams = 0;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool allFilesMode = (numItems == UInt32(-1));
-
- if (allFilesMode)
- numItems = m_Database.Items.Size() + m_Xmls.Size();
- if (numItems == 0)
- return S_OK;
- bool testMode = (_aTestMode != 0);
-
- UInt32 i;
- UInt64 totalSize = 0;
- for (i = 0; i < numItems; i++)
- {
- UInt32 index = allFilesMode ? i : indices[i];
- if (index < (UInt32)m_Database.Items.Size())
- {
- int streamIndex = m_Database.Items[index].StreamIndex;
- if (streamIndex >= 0)
- {
- const CStreamInfo &si = m_Database.Streams[streamIndex];
- totalSize += si.Resource.UnpackSize;
- }
- }
- else
- totalSize += m_Xmls[index - (UInt32)m_Database.Items.Size()].Data.GetCapacity();
- }
-
- RINOK(extractCallback->SetTotal(totalSize));
-
- UInt64 currentTotalPacked = 0;
- UInt64 currentTotalUnPacked = 0;
- UInt64 currentItemUnPacked, currentItemPacked;
-
- int prevSuccessStreamIndex = -1;
-
- CUnpacker unpacker;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- for (i = 0; i < numItems; currentTotalUnPacked += currentItemUnPacked,
- currentTotalPacked += currentItemPacked)
- {
- currentItemUnPacked = 0;
- currentItemPacked = 0;
-
- lps->InSize = currentTotalPacked;
- lps->OutSize = currentTotalUnPacked;
-
- RINOK(lps->SetCur());
- UInt32 index = allFilesMode ? i : indices[i];
- i++;
- Int32 askMode = testMode ?
- NExtract::NAskMode::kTest :
- NExtract::NAskMode::kExtract;
-
- CMyComPtr<ISequentialOutStream> realOutStream;
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
- if (index >= (UInt32)m_Database.Items.Size())
- {
- if(!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- const CByteBuffer &data = m_Xmls[index - (UInt32)m_Database.Items.Size()].Data;
- currentItemUnPacked = data.GetCapacity();
- if (realOutStream)
- {
- RINOK(WriteStream(realOutStream, (const Byte *)data, data.GetCapacity()));
- realOutStream.Release();
- }
- RINOK(extractCallback->SetOperationResult(NExtract::NOperationResult::kOK));
- continue;
- }
-
- const CItem &item = m_Database.Items[index];
- int streamIndex = item.StreamIndex;
- if (streamIndex < 0)
- {
- if(!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(item.HasStream() ?
- NExtract::NOperationResult::kDataError :
- NExtract::NOperationResult::kOK));
- continue;
- }
-
- const CStreamInfo &si = m_Database.Streams[streamIndex];
- currentItemUnPacked = si.Resource.UnpackSize;
- currentItemPacked = si.Resource.PackSize;
-
- if(!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
- Int32 opRes = NExtract::NOperationResult::kOK;
- if (streamIndex != prevSuccessStreamIndex || realOutStream)
- {
- Byte digest[20];
- const CVolume &vol = m_Volumes[si.PartNumber];
- HRESULT res = unpacker.Unpack(vol.Stream, si.Resource, vol.Header.IsLzxMode(),
- realOutStream, progress, digest);
- if (res == S_OK)
- {
- if (memcmp(digest, si.Hash, kHashSize) == 0)
- prevSuccessStreamIndex = streamIndex;
- else
- opRes = NExtract::NOperationResult::kCRCError;
- }
- else if (res == S_FALSE)
- opRes = NExtract::NOperationResult::kDataError;
- else
- return res;
- }
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(opRes));
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = m_Database.Items.Size() + m_Xmls.Size();
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.h
deleted file mode 100644
index b7df36067..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimHandler.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// WimHandler.h
-
-#ifndef __ARCHIVE_WIM_HANDLER_H
-#define __ARCHIVE_WIM_HANDLER_H
-
-#include "Common/MyCom.h"
-#include "Common/MyXml.h"
-
-#include "../IArchive.h"
-#include "WimIn.h"
-
-namespace NArchive {
-namespace NWim {
-
-struct CVolume
-{
- CHeader Header;
- CMyComPtr<IInStream> Stream;
-};
-
-struct CImageInfo
-{
- bool CTimeDefined;
- bool MTimeDefined;
- bool NameDefined;
- // bool IndexDefined;
-
- FILETIME CTime;
- FILETIME MTime;
- UString Name;
- // UInt32 Index;
-
- CImageInfo(): CTimeDefined(false), MTimeDefined(false), NameDefined(false)
- // , IndexDefined(false)
- {}
- void Parse(const CXmlItem &item);
-};
-
-struct CXml
-{
- CByteBuffer Data;
- UInt16 VolIndex;
-
- CObjectVector<CImageInfo> Images;
-
- void Parse();
-};
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(IInArchive)
- INTERFACE_IInArchive(;)
-
-private:
- CDatabase m_Database;
- CObjectVector<CVolume> m_Volumes;
- CObjectVector<CXml> m_Xmls;
- int m_NameLenForStreams;
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.cpp
deleted file mode 100644
index 90c3c2c2f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.cpp
+++ /dev/null
@@ -1,570 +0,0 @@
-// Archive/WimIn.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/CpuArch.h"
-
-#include "Common/IntToString.h"
-
-#include "../../Common/StreamUtils.h"
-#include "../../Common/StreamObjects.h"
-#include "../../Common/LimitedStreams.h"
-
-#include "../Common/OutStreamWithSha1.h"
-
-#include "WimIn.h"
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-#define Get64(p) GetUi64(p)
-
-namespace NArchive{
-namespace NWim{
-
-static const int kChunkSizeBits = 15;
-static const UInt32 kChunkSize = (1 << kChunkSizeBits);
-
-namespace NXpress {
-
-class CDecoderFlusher
-{
- CDecoder *m_Decoder;
-public:
- bool NeedFlush;
- CDecoderFlusher(CDecoder *decoder): m_Decoder(decoder), NeedFlush(true) {}
- ~CDecoderFlusher()
- {
- if (NeedFlush)
- m_Decoder->Flush();
- m_Decoder->ReleaseStreams();
- }
-};
-
-HRESULT CDecoder::CodeSpec(UInt32 outSize)
-{
- {
- Byte levels[kMainTableSize];
- for (int i = 0; i < kMainTableSize; i += 2)
- {
- Byte b = m_InBitStream.DirectReadByte();
- levels[i] = b & 0xF;
- levels[i + 1] = b >> 4;
- }
- if (!m_MainDecoder.SetCodeLengths(levels))
- return S_FALSE;
- }
-
- while (outSize > 0)
- {
- UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream);
- if (number < 256)
- {
- m_OutWindowStream.PutByte((Byte)number);
- outSize--;
- }
- else
- {
- if (number >= kMainTableSize)
- return S_FALSE;
- UInt32 posLenSlot = number - 256;
- UInt32 posSlot = posLenSlot / kNumLenSlots;
- UInt32 len = posLenSlot % kNumLenSlots;
- UInt32 distance = (1 << posSlot) - 1 + m_InBitStream.ReadBits(posSlot);
-
- if (len == kNumLenSlots - 1)
- {
- len = m_InBitStream.DirectReadByte();
- if (len == 0xFF)
- {
- len = m_InBitStream.DirectReadByte();
- len |= (UInt32)m_InBitStream.DirectReadByte() << 8;
- }
- else
- len += kNumLenSlots - 1;
- }
-
- len += kMatchMinLen;
- UInt32 locLen = (len <= outSize ? len : outSize);
-
- if (!m_OutWindowStream.CopyBlock(distance, locLen))
- return S_FALSE;
-
- len -= locLen;
- outSize -= locLen;
- if (len != 0)
- return S_FALSE;
- }
- }
- return S_OK;
-}
-
-const UInt32 kDictSize = (1 << kNumPosSlots);
-
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream, UInt32 outSize)
-{
- if (!m_OutWindowStream.Create(kDictSize) || !m_InBitStream.Create(1 << 16))
- return E_OUTOFMEMORY;
-
- CDecoderFlusher flusher(this);
-
- m_InBitStream.SetStream(inStream);
- m_OutWindowStream.SetStream(outStream);
- m_InBitStream.Init();
- m_OutWindowStream.Init(false);
-
- RINOK(CodeSpec(outSize));
-
- flusher.NeedFlush = false;
- return Flush();
-}
-
-HRESULT CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream, UInt32 outSize)
-{
- try { return CodeReal(inStream, outStream, outSize); }
- catch(const CInBufferException &e) { return e.ErrorCode; } \
- catch(const CLzOutWindowException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-}
-
-static void GetFileTimeFromMem(const Byte *p, FILETIME *ft)
-{
- ft->dwLowDateTime = Get32(p);
- ft->dwHighDateTime = Get32(p + 4);
-}
-
-HRESULT CUnpacker::Unpack(IInStream *inStream, const CResource &resource, bool lzxMode,
- ISequentialOutStream *outStream, ICompressProgressInfo *progress)
-{
- RINOK(inStream->Seek(resource.Offset, STREAM_SEEK_SET, NULL));
-
- CLimitedSequentialInStream *limitedStreamSpec = new CLimitedSequentialInStream();
- CMyComPtr<ISequentialInStream> limitedStream = limitedStreamSpec;
- limitedStreamSpec->SetStream(inStream);
-
- if (!copyCoder)
- {
- copyCoderSpec = new NCompress::CCopyCoder;
- copyCoder = copyCoderSpec;
- }
- if (!resource.IsCompressed())
- {
- if (resource.PackSize != resource.UnpackSize)
- return S_FALSE;
- limitedStreamSpec->Init(resource.PackSize);
- return copyCoder->Code(limitedStreamSpec, outStream, NULL, NULL, progress);
- }
- if (resource.UnpackSize == 0)
- return S_OK;
- UInt64 numChunks = (resource.UnpackSize + kChunkSize - 1) >> kChunkSizeBits;
- unsigned entrySize = ((resource.UnpackSize > (UInt64)1 << 32) ? 8 : 4);
- UInt64 sizesBufSize64 = entrySize * (numChunks - 1);
- size_t sizesBufSize = (size_t)sizesBufSize64;
- if (sizesBufSize != sizesBufSize64)
- return E_OUTOFMEMORY;
- if (sizesBufSize > sizesBuf.GetCapacity())
- {
- sizesBuf.Free();
- sizesBuf.SetCapacity(sizesBufSize);
- }
- RINOK(ReadStream_FALSE(inStream, (Byte *)sizesBuf, sizesBufSize));
- const Byte *p = (const Byte *)sizesBuf;
-
- if (lzxMode && !lzxDecoder)
- {
- lzxDecoderSpec = new NCompress::NLzx::CDecoder(true);
- lzxDecoder = lzxDecoderSpec;
- RINOK(lzxDecoderSpec->SetParams(kChunkSizeBits));
- }
-
- UInt64 baseOffset = resource.Offset + sizesBufSize64;
- UInt64 outProcessed = 0;
- for (UInt32 i = 0; i < (UInt32)numChunks; i++)
- {
- UInt64 offset = 0;
- if (i > 0)
- {
- offset = (entrySize == 4) ? Get32(p): Get64(p);
- p += entrySize;
- }
- UInt64 nextOffset = resource.PackSize - sizesBufSize64;
- if (i + 1 < (UInt32)numChunks)
- nextOffset = (entrySize == 4) ? Get32(p): Get64(p);
- if (nextOffset < offset)
- return S_FALSE;
-
- RINOK(inStream->Seek(baseOffset + offset, STREAM_SEEK_SET, NULL));
- UInt64 inSize = nextOffset - offset;
- limitedStreamSpec->Init(inSize);
-
- if (progress)
- {
- RINOK(progress->SetRatioInfo(&offset, &outProcessed));
- }
-
- UInt32 outSize = kChunkSize;
- if (outProcessed + outSize > resource.UnpackSize)
- outSize = (UInt32)(resource.UnpackSize - outProcessed);
- UInt64 outSize64 = outSize;
- if (inSize == outSize)
- {
- RINOK(copyCoder->Code(limitedStreamSpec, outStream, NULL, &outSize64, NULL));
- }
- else
- {
- if (lzxMode)
- {
- lzxDecoderSpec->SetKeepHistory(false);
- RINOK(lzxDecoder->Code(limitedStreamSpec, outStream, NULL, &outSize64, NULL));
- }
- else
- {
- RINOK(xpressDecoder.Code(limitedStreamSpec, outStream, outSize));
- }
- }
- outProcessed += outSize;
- }
- return S_OK;
-}
-
-HRESULT CUnpacker::Unpack(IInStream *inStream, const CResource &resource, bool lzxMode,
- ISequentialOutStream *outStream, ICompressProgressInfo *progress, Byte *digest)
-{
- COutStreamWithSha1 *shaStreamSpec = new COutStreamWithSha1();
- CMyComPtr<ISequentialOutStream> shaStream = shaStreamSpec;
- shaStreamSpec->SetStream(outStream);
- shaStreamSpec->Init(digest != NULL);
- HRESULT result = Unpack(inStream, resource, lzxMode, shaStream, progress);
- if (digest)
- shaStreamSpec->Final(digest);
- return result;
-}
-
-static HRESULT UnpackData(IInStream *inStream, const CResource &resource, bool lzxMode, CByteBuffer &buf, Byte *digest)
-{
- size_t size = (size_t)resource.UnpackSize;
- if (size != resource.UnpackSize)
- return E_OUTOFMEMORY;
- buf.Free();
- buf.SetCapacity(size);
-
- CSequentialOutStreamImp2 *outStreamSpec = new CSequentialOutStreamImp2();
- CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
- outStreamSpec->Init((Byte *)buf, size);
-
- CUnpacker unpacker;
- return unpacker.Unpack(inStream, resource, lzxMode, outStream, NULL, digest);
-}
-
-static const UInt32 kSignatureSize = 8;
-static const Byte kSignature[kSignatureSize] = { 'M', 'S', 'W', 'I', 'M', 0, 0, 0 };
-
-void CResource::Parse(const Byte *p)
-{
- Flags = p[7];
- PackSize = Get64(p) & (((UInt64)1 << 56) - 1);
- Offset = Get64(p + 8);
- UnpackSize = Get64(p + 16);
-}
-
-#define GetResource(p, res) res.Parse(p)
-
-static void GetStream(const Byte *p, CStreamInfo &s)
-{
- s.Resource.Parse(p);
- s.PartNumber = Get16(p + 24);
- s.RefCount = Get32(p + 26);
- memcpy(s.Hash, p + 30, kHashSize);
-}
-
-static HRESULT ParseDirItem(const Byte *base, size_t pos, size_t size,
- const UString &prefix, CObjectVector<CItem> &items)
-{
- for (;;)
- {
- if (pos + 8 > size)
- return S_FALSE;
- const Byte *p = base + pos;
- UInt64 length = Get64(p);
- if (length == 0)
- return S_OK;
- if (pos + 102 > size || pos + length + 8 > size || length > ((UInt64)1 << 62))
- return S_FALSE;
- CItem item;
- item.Attrib = Get32(p + 8);
- // item.SecurityId = Get32(p + 0xC);
- UInt64 subdirOffset = Get64(p + 0x10);
- GetFileTimeFromMem(p + 0x28, &item.CTime);
- GetFileTimeFromMem(p + 0x30, &item.ATime);
- GetFileTimeFromMem(p + 0x38, &item.MTime);
- memcpy(item.Hash, p + 0x40, kHashSize);
-
- // UInt16 shortNameLen = Get16(p + 98);
- UInt16 fileNameLen = Get16(p + 100);
-
- size_t tempPos = pos + 102;
- if (tempPos + fileNameLen > size)
- return S_FALSE;
-
- wchar_t *sz = item.Name.GetBuffer(prefix.Length() + fileNameLen / 2 + 1);
- MyStringCopy(sz, (const wchar_t *)prefix);
- sz += prefix.Length();
- for (UInt16 i = 0; i + 2 <= fileNameLen; i += 2)
- *sz++ = Get16(base + tempPos + i);
- *sz++ = '\0';
- item.Name.ReleaseBuffer();
- if (fileNameLen == 0 && item.isDir() && !item.HasStream())
- {
- item.Attrib = 0x10; // some swm archives have system/hidden attributes for root
- item.Name.Delete(item.Name.Length() - 1);
- }
- items.Add(item);
- pos += (size_t)length;
- if (item.isDir() && (subdirOffset != 0))
- {
- if (subdirOffset >= size)
- return S_FALSE;
- RINOK(ParseDirItem(base, (size_t)subdirOffset, size, item.Name + WCHAR_PATH_SEPARATOR, items));
- }
- }
-}
-
-static HRESULT ParseDir(const Byte *base, size_t size,
- const UString &prefix, CObjectVector<CItem> &items)
-{
- size_t pos = 0;
- if (pos + 8 > size)
- return S_FALSE;
- const Byte *p = base + pos;
- UInt32 totalLength = Get32(p);
- // UInt32 numEntries = Get32(p + 4);
- pos += 8;
- {
- /*
- CRecordVector<UInt64> entryLens;
- UInt64 sum = 0;
- for (UInt32 i = 0; i < numEntries; i++)
- {
- if (pos + 8 > size)
- return S_FALSE;
- UInt64 len = Get64(p + pos);
- entryLens.Add(len);
- sum += len;
- pos += 8;
- }
- pos += sum; // skip security descriptors
- while ((pos & 7) != 0)
- pos++;
- if (pos != totalLength)
- return S_FALSE;
- */
- pos = totalLength;
- }
- return ParseDirItem(base, pos, size, prefix, items);
-}
-
-static int CompareHashRefs(const int *p1, const int *p2, void *param)
-{
- const CRecordVector<CStreamInfo> &streams = *(const CRecordVector<CStreamInfo> *)param;
- return memcmp(streams[*p1].Hash, streams[*p2].Hash, kHashSize);
-}
-
-static int CompareStreamsByPos(const CStreamInfo *p1, const CStreamInfo *p2, void * /* param */)
-{
- int res = MyCompare(p1->PartNumber, p2->PartNumber);
- if (res != 0)
- return res;
- return MyCompare(p1->Resource.Offset, p2->Resource.Offset);
-}
-
-int CompareItems(void *const *a1, void *const *a2, void * /* param */)
-{
- const CItem &i1 = **((const CItem **)a1);
- const CItem &i2 = **((const CItem **)a2);
-
- if (i1.isDir() != i2.isDir())
- return (i1.isDir()) ? 1 : -1;
- if (i1.isDir())
- return -MyStringCompareNoCase(i1.Name, i2.Name);
-
- int res = MyCompare(i1.StreamIndex, i2.StreamIndex);
- if (res != 0)
- return res;
- return MyStringCompareNoCase(i1.Name, i2.Name);
-}
-
-static int FindHash(const CRecordVector<CStreamInfo> &streams,
- const CRecordVector<int> &sortedByHash, const Byte *hash)
-{
- int left = 0, right = streams.Size();
- while (left != right)
- {
- int mid = (left + right) / 2;
- int streamIndex = sortedByHash[mid];
- UInt32 i;
- const Byte *hash2 = streams[streamIndex].Hash;
- for (i = 0; i < kHashSize; i++)
- if (hash[i] != hash2[i])
- break;
- if (i == kHashSize)
- return streamIndex;
- if (hash[i] < hash2[i])
- right = mid;
- else
- left = mid + 1;
- }
- return -1;
-}
-
-HRESULT CHeader::Parse(const Byte *p)
-{
- UInt32 haderSize = Get32(p + 8);
- if (haderSize < 0x74)
- return S_FALSE;
- Version = Get32(p + 0x0C);
- Flags = Get32(p + 0x10);
- if (!IsSupported())
- return S_FALSE;
- UInt32 chunkSize = Get32(p + 0x14);
- if (chunkSize != kChunkSize && chunkSize != 0)
- return S_FALSE;
- memcpy(Guid, p + 0x18, 16);
- PartNumber = Get16(p + 0x28);
- NumParts = Get16(p + 0x2A);
- int offset = 0x2C;
- if (IsNewVersion())
- {
- NumImages = Get32(p + offset);
- offset += 4;
- }
- GetResource(p + offset, OffsetResource);
- GetResource(p + offset + 0x18, XmlResource);
- GetResource(p + offset + 0x30, MetadataResource);
- /*
- if (IsNewVersion())
- {
- if (haderSize < 0xD0)
- return S_FALSE;
- IntegrityResource.Parse(p + offset + 0x4C);
- BootIndex = Get32(p + 0x48);
- }
- */
- return S_OK;
-}
-
-HRESULT ReadHeader(IInStream *inStream, CHeader &h)
-{
- const UInt32 kHeaderSizeMax = 0xD0;
- Byte p[kHeaderSizeMax];
- RINOK(ReadStream_FALSE(inStream, p, kHeaderSizeMax));
- if (memcmp(p, kSignature, kSignatureSize) != 0)
- return S_FALSE;
- return h.Parse(p);
-}
-
-HRESULT ReadStreams(IInStream *inStream, const CHeader &h, CDatabase &db)
-{
- CByteBuffer offsetBuf;
- RINOK(UnpackData(inStream, h.OffsetResource, h.IsLzxMode(), offsetBuf, NULL));
- for (size_t i = 0; i + kStreamInfoSize <= offsetBuf.GetCapacity(); i += kStreamInfoSize)
- {
- CStreamInfo s;
- GetStream((const Byte *)offsetBuf + i, s);
- if (s.PartNumber == h.PartNumber)
- db.Streams.Add(s);
- }
- return S_OK;
-}
-
-HRESULT OpenArchive(IInStream *inStream, const CHeader &h, CByteBuffer &xml, CDatabase &db)
-{
- RINOK(UnpackData(inStream, h.XmlResource, h.IsLzxMode(), xml, NULL));
-
- RINOK(ReadStreams(inStream, h, db));
- bool needBootMetadata = !h.MetadataResource.IsEmpty();
- if (h.PartNumber == 1)
- {
- int imageIndex = 1;
- for (int j = 0; j < db.Streams.Size(); j++)
- {
- // if (imageIndex > 1) break;
- const CStreamInfo &si = db.Streams[j];
- if (!si.Resource.IsMetadata() || si.PartNumber != h.PartNumber)
- continue;
- Byte hash[kHashSize];
- CByteBuffer metadata;
- RINOK(UnpackData(inStream, si.Resource, h.IsLzxMode(), metadata, hash));
- if (memcmp(hash, si.Hash, kHashSize) != 0)
- return S_FALSE;
- wchar_t sz[16];
- ConvertUInt32ToString(imageIndex++, sz);
- UString s = sz;
- s += WCHAR_PATH_SEPARATOR;
- RINOK(ParseDir(metadata, metadata.GetCapacity(), s, db.Items));
- if (needBootMetadata)
- if (h.MetadataResource.Offset == si.Resource.Offset)
- needBootMetadata = false;
- }
- }
-
- if (needBootMetadata)
- {
- CByteBuffer metadata;
- RINOK(UnpackData(inStream, h.MetadataResource, h.IsLzxMode(), metadata, NULL));
- RINOK(ParseDir(metadata, metadata.GetCapacity(), L"0" WSTRING_PATH_SEPARATOR, db.Items));
- }
- return S_OK;
-}
-
-
-HRESULT SortDatabase(CDatabase &db)
-{
- db.Streams.Sort(CompareStreamsByPos, NULL);
-
- {
- CRecordVector<int> sortedByHash;
- {
- for (int j = 0; j < db.Streams.Size(); j++)
- sortedByHash.Add(j);
- sortedByHash.Sort(CompareHashRefs, &db.Streams);
- }
-
- for (int i = 0; i < db.Items.Size(); i++)
- {
- CItem &item = db.Items[i];
- item.StreamIndex = -1;
- if (item.HasStream())
- item.StreamIndex = FindHash(db.Streams, sortedByHash, item.Hash);
- }
- }
-
- {
- CRecordVector<bool> used;
- int j;
- for (j = 0; j < db.Streams.Size(); j++)
- {
- const CStreamInfo &s = db.Streams[j];
- used.Add(s.Resource.IsMetadata() && s.PartNumber == 1);
- }
- for (int i = 0; i < db.Items.Size(); i++)
- {
- CItem &item = db.Items[i];
- if (item.StreamIndex >= 0)
- used[item.StreamIndex] = true;
- }
- for (j = 0; j < db.Streams.Size(); j++)
- if (!used[j])
- {
- CItem item;
- item.StreamIndex = j;
- item.HasMetadata = false;
- db.Items.Add(item);
- }
- }
-
- db.Items.Sort(CompareItems, NULL);
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.h
deleted file mode 100644
index e51a301aa..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimIn.h
+++ /dev/null
@@ -1,235 +0,0 @@
-// Archive/WimIn.h
-
-#ifndef __ARCHIVE_WIM_IN_H
-#define __ARCHIVE_WIM_IN_H
-
-#include "Common/Buffer.h"
-#include "Common/MyString.h"
-
-#include "../../Compress/CopyCoder.h"
-#include "../../Compress/LzxDecoder.h"
-
-namespace NArchive {
-namespace NWim {
-
-namespace NXpress {
-
-class CBitStream
-{
- CInBuffer m_Stream;
- UInt32 m_Value;
- unsigned m_BitPos;
-public:
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialInStream *s) { m_Stream.SetStream(s); }
- void ReleaseStream() { m_Stream.ReleaseStream(); }
-
- void Init() { m_Stream.Init(); m_BitPos = 0; }
- // UInt64 GetProcessedSize() const { return m_Stream.GetProcessedSize() - m_BitPos / 8; }
- Byte DirectReadByte() { return m_Stream.ReadByte(); }
-
- void Normalize()
- {
- if (m_BitPos < 16)
- {
- Byte b0 = m_Stream.ReadByte();
- Byte b1 = m_Stream.ReadByte();
- m_Value = (m_Value << 8) | b1;
- m_Value = (m_Value << 8) | b0;
- m_BitPos += 16;
- }
- }
-
- UInt32 GetValue(unsigned numBits)
- {
- Normalize();
- return (m_Value >> (m_BitPos - numBits)) & ((1 << numBits) - 1);
- }
-
- void MovePos(unsigned numBits) { m_BitPos -= numBits; }
-
- UInt32 ReadBits(unsigned numBits)
- {
- UInt32 res = GetValue(numBits);
- m_BitPos -= numBits;
- return res;
- }
-};
-
-const int kNumHuffmanBits = 16;
-const UInt32 kMatchMinLen = 3;
-const UInt32 kNumLenSlots = 16;
-const UInt32 kNumPosSlots = 16;
-const UInt32 kNumPosLenSlots = kNumPosSlots * kNumLenSlots;
-const UInt32 kMainTableSize = 256 + kNumPosLenSlots;
-
-class CDecoder
-{
- CBitStream m_InBitStream;
- CLzOutWindow m_OutWindowStream;
- NCompress::NHuffman::CDecoder<kNumHuffmanBits, kMainTableSize> m_MainDecoder;
-
- HRESULT CodeSpec(UInt32 size);
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream, UInt32 outSize);
-public:
- void ReleaseStreams()
- {
- m_OutWindowStream.ReleaseStream();
- m_InBitStream.ReleaseStream();
- }
- HRESULT Flush() { return m_OutWindowStream.Flush(); }
- HRESULT Code(ISequentialInStream *inStream, ISequentialOutStream *outStream, UInt32 outSize);
-};
-
-}
-
-namespace NResourceFlags
-{
- const Byte Compressed = 4;
- const Byte kMetadata = 2;
-}
-
-struct CResource
-{
- UInt64 PackSize;
- UInt64 Offset;
- UInt64 UnpackSize;
- Byte Flags;
-
- void Parse(const Byte *p);
- bool IsCompressed() const { return (Flags & NResourceFlags::Compressed) != 0; }
- bool IsMetadata() const { return (Flags & NResourceFlags::kMetadata) != 0; }
- bool IsEmpty() const { return (UnpackSize == 0); }
-};
-
-namespace NHeaderFlags
-{
- const UInt32 kCompression = 2;
- const UInt32 kSpanned = 8;
- const UInt32 kRpFix = 0x80;
- const UInt32 kXPRESS = 0x20000;
- const UInt32 kLZX = 0x40000;
-}
-
-struct CHeader
-{
- UInt32 Flags;
- UInt32 Version;
- // UInt32 ChunkSize;
- UInt16 PartNumber;
- UInt16 NumParts;
- UInt32 NumImages;
- Byte Guid[16];
-
- CResource OffsetResource;
- CResource XmlResource;
- CResource MetadataResource;
- /*
- CResource IntegrityResource;
- UInt32 BootIndex;
- */
-
- HRESULT Parse(const Byte *p);
- bool IsCompressed() const { return (Flags & NHeaderFlags::kCompression) != 0; }
- bool IsSupported() const { return (!IsCompressed() || (Flags & NHeaderFlags::kLZX) != 0 || (Flags & NHeaderFlags::kXPRESS) != 0 ) ; }
- bool IsLzxMode() const { return (Flags & NHeaderFlags::kLZX) != 0; }
- bool IsSpanned() const { return (!IsCompressed() || (Flags & NHeaderFlags::kSpanned) != 0); }
-
- bool IsNewVersion()const { return (Version > 0x010C00); }
-
- bool AreFromOnArchive(const CHeader &h)
- {
- return (memcmp(Guid, h.Guid, sizeof(Guid)) == 0) && (h.NumParts == NumParts);
- }
-};
-
-const UInt32 kHashSize = 20;
-const UInt32 kStreamInfoSize = 24 + 2 + 4 + kHashSize;
-
-struct CStreamInfo
-{
- CResource Resource;
- UInt16 PartNumber;
- UInt32 RefCount;
- BYTE Hash[kHashSize];
-};
-
-struct CItem
-{
- UString Name;
- UInt32 Attrib;
- // UInt32 SecurityId;
- BYTE Hash[kHashSize];
- FILETIME CTime;
- FILETIME ATime;
- FILETIME MTime;
- // UInt32 ReparseTag;
- // UInt64 HardLink;
- // UInt16 NumStreams;
- // UInt16 ShortNameLen;
- int StreamIndex;
- bool HasMetadata;
- CItem(): HasMetadata(true), StreamIndex(-1) {}
- bool isDir() const { return HasMetadata && ((Attrib & 0x10) != 0); }
- bool HasStream() const
- {
- for (int i = 0; i < kHashSize; i++)
- if (Hash[i] != 0)
- return true;
- return false;
- }
-};
-
-struct CDatabase
-{
- CRecordVector<CStreamInfo> Streams;
- CObjectVector<CItem> Items;
-
- UInt64 GetUnpackSize() const
- {
- UInt64 res = 0;
- for (int i = 0; i < Streams.Size(); i++)
- res += Streams[i].Resource.UnpackSize;
- return res;
- }
-
- UInt64 GetPackSize() const
- {
- UInt64 res = 0;
- for (int i = 0; i < Streams.Size(); i++)
- res += Streams[i].Resource.PackSize;
- return res;
- }
-
- void Clear()
- {
- Streams.Clear();
- Items.Clear();
- }
-};
-
-HRESULT ReadHeader(IInStream *inStream, CHeader &header);
-HRESULT OpenArchive(IInStream *inStream, const CHeader &header, CByteBuffer &xml, CDatabase &database);
-HRESULT SortDatabase(CDatabase &database);
-
-class CUnpacker
-{
- NCompress::CCopyCoder *copyCoderSpec;
- CMyComPtr<ICompressCoder> copyCoder;
-
- NCompress::NLzx::CDecoder *lzxDecoderSpec;
- CMyComPtr<ICompressCoder> lzxDecoder;
-
- NXpress::CDecoder xpressDecoder;
-
- CByteBuffer sizesBuf;
- HRESULT Unpack(IInStream *inStream, const CResource &res, bool lzxMode,
- ISequentialOutStream *outStream, ICompressProgressInfo *progress);
-public:
- HRESULT Unpack(IInStream *inStream, const CResource &res, bool lzxMode,
- ISequentialOutStream *outStream, ICompressProgressInfo *progress, Byte *digest);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimRegister.cpp
deleted file mode 100644
index 22344b3a2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Wim/WimRegister.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// WimRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "WimHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NWim::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Wim", L"wim swm", 0, 0xE6, { 'M', 'S', 'W', 'I', 'M', 0, 0, 0 }, 8, false, CreateArc, 0 };
-
-REGISTER_ARC(Wim)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/XarHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/XarHandler.cpp
deleted file mode 100644
index 2dddad9fb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/XarHandler.cpp
+++ /dev/null
@@ -1,586 +0,0 @@
-// XarHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/ComTry.h"
-#include "Common/MyXml.h"
-#include "Common/StringToInt.h"
-#include "Common/UTFConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../Common/LimitedStreams.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamObjects.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/BZip2Decoder.h"
-#include "../Compress/CopyCoder.h"
-#include "../Compress/ZlibDecoder.h"
-
-#include "Common/OutStreamWithSha1.h"
-
-#define XAR_SHOW_RAW
-
-#define Get16(p) GetBe16(p)
-#define Get32(p) GetBe32(p)
-#define Get64(p) GetBe64(p)
-
-namespace NArchive {
-namespace NXar {
-
-struct CFile
-{
- AString Name;
- AString Method;
- UInt64 Size;
- UInt64 PackSize;
- UInt64 Offset;
-
- // UInt32 mode;
- UInt64 CTime;
- UInt64 MTime;
- UInt64 ATime;
-
- bool IsDir;
- bool HasData;
-
- bool Sha1IsDefined;
- Byte Sha1[20];
- // bool packSha1IsDefined;
- // Byte packSha1[20];
-
- int Parent;
-
- CFile(): IsDir(false), HasData(false), Sha1IsDefined(false),
- /* packSha1IsDefined(false), */
- Parent(-1), Size(0), PackSize(0), CTime(0), MTime(0), ATime(0) {}
-};
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
- UInt64 _dataStartPos;
- CMyComPtr<IInStream> _inStream;
- AString _xml;
- CObjectVector<CFile> _files;
-
- HRESULT Open2(IInStream *stream);
- HRESULT Extract(IInStream *stream);
-public:
- MY_UNKNOWN_IMP1(IInArchive)
- INTERFACE_IInArchive(;)
-};
-
-const UInt32 kXmlSizeMax = ((UInt32)1 << 30) - (1 << 14);
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidATime, VT_FILETIME},
- { NULL, kpidMethod, VT_BSTR}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO
-
-static bool ParseNumber(const char *s, int size, UInt32 &res)
-{
- const char *end;
- res = (UInt32)ConvertStringToUInt64(s, &end);
- return (end - s == size);
-}
-
-static bool ParseUInt64(const CXmlItem &item, const char *name, UInt64 &res)
-{
- AString s = item.GetSubStringForTag(name);
- const char *end;
- res = ConvertStringToUInt64(s, &end);
- return (end - (const char *)s == s.Length());
-}
-
-static UInt64 ParseTime(const CXmlItem &item, const char *name)
-{
- AString s = item.GetSubStringForTag(name);
- if (s.Length() < 20)
- return 0;
- const char *p = s;
- if (p[ 4] != '-' || p[ 7] != '-' || p[10] != 'T' ||
- p[13] != ':' || p[16] != ':' || p[19] != 'Z')
- return 0;
- UInt32 year, month, day, hour, min, sec;
- if (!ParseNumber(p, 4, year )) return 0;
- if (!ParseNumber(p + 5, 2, month)) return 0;
- if (!ParseNumber(p + 8, 2, day )) return 0;
- if (!ParseNumber(p + 11, 2, hour )) return 0;
- if (!ParseNumber(p + 14, 2, min )) return 0;
- if (!ParseNumber(p + 17, 2, sec )) return 0;
-
- UInt64 numSecs;
- if (!NWindows::NTime::GetSecondsSince1601(year, month, day, hour, min, sec, numSecs))
- return 0;
- return numSecs * 10000000;
-}
-
-static bool HexToByte(char c, Byte &res)
-{
- if (c >= '0' && c <= '9') res = c - '0';
- else if (c >= 'A' && c <= 'F') res = c - 'A' + 10;
- else if (c >= 'a' && c <= 'f') res = c - 'a' + 10;
- else return false;
- return true;
-}
-
-#define METHOD_NAME_ZLIB "zlib"
-
-static bool ParseSha1(const CXmlItem &item, const char *name, Byte *digest)
-{
- int index = item.FindSubTag(name);
- if (index < 0)
- return false;
- const CXmlItem &checkItem = item.SubItems[index];
- AString style = checkItem.GetPropertyValue("style");
- if (style == "SHA1")
- {
- AString s = checkItem.GetSubString();
- if (s.Length() != 40)
- return false;
- for (int i = 0; i < s.Length(); i += 2)
- {
- Byte b0, b1;
- if (!HexToByte(s[i], b0) || !HexToByte(s[i + 1], b1))
- return false;
- digest[i / 2] = (b0 << 4) | b1;
- }
- return true;
- }
- return false;
-}
-
-static bool AddItem(const CXmlItem &item, CObjectVector<CFile> &files, int parent)
-{
- if (!item.IsTag)
- return true;
- if (item.Name == "file")
- {
- CFile file;
- file.Parent = parent;
- parent = files.Size();
- file.Name = item.GetSubStringForTag("name");
- AString type = item.GetSubStringForTag("type");
- if (type == "directory")
- file.IsDir = true;
- else if (type == "file")
- file.IsDir = false;
- else
- return false;
-
- int dataIndex = item.FindSubTag("data");
- if (dataIndex >= 0 && !file.IsDir)
- {
- file.HasData = true;
- const CXmlItem &dataItem = item.SubItems[dataIndex];
- if (!ParseUInt64(dataItem, "size", file.Size))
- return false;
- if (!ParseUInt64(dataItem, "length", file.PackSize))
- return false;
- if (!ParseUInt64(dataItem, "offset", file.Offset))
- return false;
- file.Sha1IsDefined = ParseSha1(dataItem, "extracted-checksum", file.Sha1);
- // file.packSha1IsDefined = ParseSha1(dataItem, "archived-checksum", file.packSha1);
- int encodingIndex = dataItem.FindSubTag("encoding");
- const CXmlItem &encodingItem = dataItem.SubItems[encodingIndex];
- if (encodingItem.IsTag)
- {
- AString s = encodingItem.GetPropertyValue("style");
- if (s.Length() >= 0)
- {
- AString appl = "application/";
- if (s.Left(appl.Length()) == appl)
- {
- s = s.Mid(appl.Length());
- AString xx = "x-";
- if (s.Left(xx.Length()) == xx)
- {
- s = s.Mid(xx.Length());
- if (s == "gzip")
- s = METHOD_NAME_ZLIB;
- }
- }
- file.Method = s;
- }
- }
- }
-
- file.CTime = ParseTime(item, "ctime");
- file.MTime = ParseTime(item, "mtime");
- file.ATime = ParseTime(item, "atime");
- files.Add(file);
- }
- for (int i = 0; i < item.SubItems.Size(); i++)
- if (!AddItem(item.SubItems[i], files, parent))
- return false;
- return true;
-}
-
-HRESULT CHandler::Open2(IInStream *stream)
-{
- UInt64 archiveStartPos;
- RINOK(stream->Seek(0, STREAM_SEEK_SET, &archiveStartPos));
-
- const UInt32 kHeaderSize = 0x1C;
- Byte buf[kHeaderSize];
- RINOK(ReadStream_FALSE(stream, buf, kHeaderSize));
-
- UInt32 size = Get16(buf + 4);
- // UInt32 ver = Get16(buf + 6); // == 0
- if (Get32(buf) != 0x78617221 || size != kHeaderSize)
- return S_FALSE;
-
- UInt64 packSize = Get64(buf + 8);
- UInt64 unpackSize = Get64(buf + 0x10);
- // UInt32 checkSumAlogo = Get32(buf + 0x18);
-
- if (unpackSize >= kXmlSizeMax)
- return S_FALSE;
-
- _dataStartPos = archiveStartPos + kHeaderSize + packSize;
-
- char *ss = _xml.GetBuffer((int)unpackSize + 1);
-
- NCompress::NZlib::CDecoder *zlibCoderSpec = new NCompress::NZlib::CDecoder();
- CMyComPtr<ICompressCoder> zlibCoder = zlibCoderSpec;
-
- CLimitedSequentialInStream *inStreamLimSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStreamLim(inStreamLimSpec);
- inStreamLimSpec->SetStream(stream);
- inStreamLimSpec->Init(packSize);
-
- CSequentialOutStreamImp2 *outStreamLimSpec = new CSequentialOutStreamImp2;
- CMyComPtr<ISequentialOutStream> outStreamLim(outStreamLimSpec);
- outStreamLimSpec->Init((Byte *)ss, (size_t)unpackSize);
-
- RINOK(zlibCoder->Code(inStreamLim, outStreamLim, NULL, NULL, NULL));
-
- if (outStreamLimSpec->GetPos() != (size_t)unpackSize)
- return S_FALSE;
-
- ss[(size_t)unpackSize] = 0;
- _xml.ReleaseBuffer();
-
- CXml xml;
- if (!xml.Parse(_xml))
- return S_FALSE;
-
- if (!xml.Root.IsTagged("xar") || xml.Root.SubItems.Size() != 1)
- return S_FALSE;
- const CXmlItem &toc = xml.Root.SubItems[0];
- if (!toc.IsTagged("toc"))
- return S_FALSE;
- if (!AddItem(toc, _files, -1))
- return S_FALSE;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- {
- Close();
- if (Open2(stream) != S_OK)
- return S_FALSE;
- _inStream = stream;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _inStream.Release();
- _files.Clear();
- _xml.Empty();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _files.Size()
- #ifdef XAR_SHOW_RAW
- + 1
- #endif
- ;
- return S_OK;
-}
-
-static void TimeToProp(UInt64 t, NWindows::NCOM::CPropVariant &prop)
-{
- if (t != 0)
- {
- FILETIME ft;
- ft.dwLowDateTime = (UInt32)(t);
- ft.dwHighDateTime = (UInt32)(t >> 32);
- prop = ft;
- }
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
-
- #ifdef XAR_SHOW_RAW
- if ((int)index == _files.Size())
- {
- switch(propID)
- {
- case kpidPath: prop = L"[TOC].xml"; break;
- case kpidSize:
- case kpidPackSize: prop = (UInt64)_xml.Length(); break;
- }
- }
- else
- #endif
- {
- const CFile &item = _files[index];
- switch(propID)
- {
- case kpidMethod:
- {
- UString name;
- if (ConvertUTF8ToUnicode(item.Method, name))
- prop = name;
- break;
- }
- case kpidPath:
- {
- AString path;
- int cur = index;
- do
- {
- const CFile &item = _files[cur];
- AString s = item.Name;
- if (s.IsEmpty())
- s = "unknown";
- if (path.IsEmpty())
- path = s;
- else
- path = s + CHAR_PATH_SEPARATOR + path;
- cur = item.Parent;
- }
- while (cur >= 0);
-
- UString name;
- if (ConvertUTF8ToUnicode(path, name))
- prop = name;
- break;
- }
-
- case kpidIsDir: prop = item.IsDir; break;
- case kpidSize: if (!item.IsDir) prop = item.Size; break;
- case kpidPackSize: if (!item.IsDir) prop = item.PackSize; break;
-
- case kpidMTime: TimeToProp(item.MTime, prop); break;
- case kpidCTime: TimeToProp(item.CTime, prop); break;
- case kpidATime: TimeToProp(item.ATime, prop); break;
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool testMode = (_aTestMode != 0);
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = _files.Size();
- if (numItems == 0)
- return S_OK;
- UInt64 totalSize = 0;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- {
- int index = (int)(allFilesMode ? i : indices[i]);
- #ifdef XAR_SHOW_RAW
- if (index == _files.Size())
- totalSize += _xml.Length();
- else
- #endif
- totalSize += _files[index].Size;
- }
- extractCallback->SetTotal(totalSize);
-
- UInt64 currentPackTotal = 0;
- UInt64 currentUnpTotal = 0;
- UInt64 currentPackSize = 0;
- UInt64 currentUnpSize = 0;
-
- const UInt32 kZeroBufSize = (1 << 14);
- CByteBuffer zeroBuf;
- zeroBuf.SetCapacity(kZeroBufSize);
- memset(zeroBuf, 0, kZeroBufSize);
-
- NCompress::CCopyCoder *copyCoderSpec = new NCompress::CCopyCoder();
- CMyComPtr<ICompressCoder> copyCoder = copyCoderSpec;
-
- NCompress::NZlib::CDecoder *zlibCoderSpec = new NCompress::NZlib::CDecoder();
- CMyComPtr<ICompressCoder> zlibCoder = zlibCoderSpec;
-
- NCompress::NBZip2::CDecoder *bzip2CoderSpec = new NCompress::NBZip2::CDecoder();
- CMyComPtr<ICompressCoder> bzip2Coder = bzip2CoderSpec;
-
- NCompress::NDeflate::NDecoder::CCOMCoder *deflateCoderSpec = new NCompress::NDeflate::NDecoder::CCOMCoder();
- CMyComPtr<ICompressCoder> deflateCoder = deflateCoderSpec;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- CLimitedSequentialInStream *inStreamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(inStreamSpec);
- inStreamSpec->SetStream(_inStream);
-
-
- CLimitedSequentialOutStream *outStreamLimSpec = new CLimitedSequentialOutStream;
- CMyComPtr<ISequentialOutStream> outStream(outStreamLimSpec);
-
- COutStreamWithSha1 *outStreamSha1Spec = new COutStreamWithSha1;
- {
- CMyComPtr<ISequentialOutStream> outStreamSha1(outStreamSha1Spec);
- outStreamLimSpec->SetStream(outStreamSha1);
- }
-
- for (i = 0; i < numItems; i++, currentPackTotal += currentPackSize, currentUnpTotal += currentUnpSize)
- {
- lps->InSize = currentPackTotal;
- lps->OutSize = currentUnpTotal;
- currentPackSize = 0;
- currentUnpSize = 0;
- RINOK(lps->SetCur());
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- Int32 index = allFilesMode ? i : indices[i];
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
- if (index < _files.Size())
- {
- const CFile &item = _files[index];
- if (item.IsDir)
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- continue;
- }
- }
-
- if (!testMode && (!realOutStream))
- continue;
- RINOK(extractCallback->PrepareOperation(askMode));
-
- outStreamSha1Spec->SetStream(realOutStream);
- realOutStream.Release();
-
- Int32 opRes = NArchive::NExtract::NOperationResult::kOK;
- #ifdef XAR_SHOW_RAW
- if (index == _files.Size())
- {
- outStreamSha1Spec->Init(false);
- outStreamLimSpec->Init(_xml.Length());
- RINOK(WriteStream(outStream, (const char *)_xml, _xml.Length()));
- currentPackSize = currentUnpSize = _xml.Length();
- }
- else
- #endif
- {
- const CFile &item = _files[index];
- if (item.HasData)
- {
- currentPackSize = item.PackSize;
- currentUnpSize = item.Size;
-
- RINOK(_inStream->Seek(_dataStartPos + item.Offset, STREAM_SEEK_SET, NULL));
- inStreamSpec->Init(item.PackSize);
- outStreamSha1Spec->Init(item.Sha1IsDefined);
- outStreamLimSpec->Init(item.Size);
- HRESULT res = S_OK;
-
- ICompressCoder *coder = NULL;
- if (item.Method == "octet-stream")
- if (item.PackSize == item.Size)
- coder = copyCoder;
- else
- opRes = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- else if (item.Method == METHOD_NAME_ZLIB)
- coder = zlibCoder;
- else if (item.Method == "bzip2")
- coder = bzip2Coder;
- else
- opRes = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
-
- if (coder)
- res = coder->Code(inStream, outStream, NULL, NULL, progress);
-
- if (res != S_OK)
- {
- if (!outStreamLimSpec->IsFinishedOK())
- opRes = NArchive::NExtract::NOperationResult::kDataError;
- else if (res != S_FALSE)
- return res;
- if (opRes == NArchive::NExtract::NOperationResult::kOK)
- opRes = NArchive::NExtract::NOperationResult::kDataError;
- }
-
- if (opRes == NArchive::NExtract::NOperationResult::kOK)
- {
- if (outStreamLimSpec->IsFinishedOK() &&
- outStreamSha1Spec->GetSize() == item.Size)
- {
- if (!outStreamLimSpec->IsFinishedOK())
- {
- opRes = NArchive::NExtract::NOperationResult::kDataError;
- }
- else if (item.Sha1IsDefined)
- {
- Byte digest[NCrypto::NSha1::kDigestSize];
- outStreamSha1Spec->Final(digest);
- if (memcmp(digest, item.Sha1, NCrypto::NSha1::kDigestSize) != 0)
- opRes = NArchive::NExtract::NOperationResult::kCRCError;
- }
- }
- else
- opRes = NArchive::NExtract::NOperationResult::kDataError;
- }
- }
- }
- outStreamSha1Spec->ReleaseStream();
- RINOK(extractCallback->SetOperationResult(opRes));
- }
- return S_OK;
- COM_TRY_END
-}
-
-static IInArchive *CreateArc() { return new NArchive::NXar::CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Xar", L"xar", 0, 0xE1, { 'x', 'a', 'r', '!', 0, 0x1C }, 6, false, CreateArc, 0 };
-
-REGISTER_ARC(Xar)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/XzHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/XzHandler.cpp
deleted file mode 100644
index 3405472c8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/XzHandler.cpp
+++ /dev/null
@@ -1,718 +0,0 @@
-// XzHandler.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-#include "../../../C/XzCrc64.h"
-#include "../../../C/XzEnc.h"
-
-#include "../../Common/ComTry.h"
-#include "../../Common/IntToString.h"
-
-#include "../ICoder.h"
-
-#include "../Common/CWrappers.h"
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/CopyCoder.h"
-
-#include "IArchive.h"
-
-#include "Common/HandlerOut.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-namespace NCompress {
-namespace NLzma2 {
-
-HRESULT SetLzma2Prop(PROPID propID, const PROPVARIANT &prop, CLzma2EncProps &lzma2Props);
-
-}}
-
-static void *SzAlloc(void *, size_t size) { return MyAlloc(size); }
-static void SzFree(void *, void *address) { MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-namespace NArchive {
-namespace NXz {
-
-struct CCrc64Gen { CCrc64Gen() { Crc64GenerateTable(); } } g_Crc64TableInit;
-
-class CHandler:
- public IInArchive,
- public IArchiveOpenSeq,
- #ifndef EXTRACT_ONLY
- public IOutArchive,
- public ISetProperties,
- public COutHandler,
- #endif
- public CMyUnknownImp
-{
- Int64 _startPosition;
- UInt64 _packSize;
- UInt64 _unpackSize;
- UInt64 _numBlocks;
- AString _methodsString;
- bool _useSeq;
- UInt64 _unpackSizeDefined;
- UInt64 _packSizeDefined;
-
- CMyComPtr<IInStream> _stream;
- CMyComPtr<ISequentialInStream> _seqStream;
-
- UInt32 _crcSize;
-
- void Init()
- {
- _crcSize = 4;
- COutHandler::Init();
- }
-
- HRESULT Open2(IInStream *inStream, IArchiveOpenCallback *callback);
-
-public:
- MY_QUERYINTERFACE_BEGIN
- MY_QUERYINTERFACE_ENTRY(IInArchive)
- MY_QUERYINTERFACE_ENTRY(IArchiveOpenSeq)
- #ifndef EXTRACT_ONLY
- MY_QUERYINTERFACE_ENTRY(IOutArchive)
- MY_QUERYINTERFACE_ENTRY(ISetProperties)
- #endif
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
- INTERFACE_IInArchive(;)
- STDMETHOD(OpenSeq)(ISequentialInStream *stream);
-
- #ifndef EXTRACT_ONLY
- INTERFACE_IOutArchive(;)
- STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProps);
- #endif
-
- CHandler();
-};
-
-CHandler::CHandler()
-{
- Init();
-}
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMethod, VT_BSTR}
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidNumBlocks, VT_UI4}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-static char GetHex(Byte value)
-{
- return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
-}
-
-static inline void AddHexToString(AString &res, Byte value)
-{
- res += GetHex((Byte)(value >> 4));
- res += GetHex((Byte)(value & 0xF));
-}
-
-static AString ConvertUInt32ToString(UInt32 value)
-{
- char temp[32];
- ::ConvertUInt32ToString(value, temp);
- return temp;
-}
-
-static AString Lzma2PropToString(int prop)
-{
- if ((prop & 1) == 0)
- return ConvertUInt32ToString(prop / 2 + 12);
- AString res;
- char c;
-
- UInt32 size = (2 | ((prop) & 1)) << ((prop) / 2 + 1);
-
- if (prop > 17)
- {
- res = ConvertUInt32ToString(size >> 10);
- c = 'm';
- }
- else
- {
- res = ConvertUInt32ToString(size);
- c = 'k';
- }
- return res + c;
-}
-
-struct CMethodNamePair
-{
- UInt32 Id;
- const char *Name;
-};
-
-static CMethodNamePair g_NamePairs[] =
-{
- { XZ_ID_Subblock, "SB" },
- { XZ_ID_Delta, "Delta" },
- { XZ_ID_X86, "x86" },
- { XZ_ID_PPC, "PPC" },
- { XZ_ID_IA64, "IA64" },
- { XZ_ID_ARM, "ARM" },
- { XZ_ID_ARMT, "ARMT" },
- { XZ_ID_SPARC, "SPARC" },
- { XZ_ID_LZMA2, "LZMA2" }
-};
-
-static AString GetMethodString(const CXzFilter &f)
-{
- AString s;
-
- for (unsigned int i = 0; i < sizeof(g_NamePairs) / sizeof(g_NamePairs[i]); i++)
- if (g_NamePairs[i].Id == f.id)
- s = g_NamePairs[i].Name;
- if (s.IsEmpty())
- {
- char temp[32];
- ::ConvertUInt64ToString(f.id, temp);
- s = temp;
- }
-
- if (f.propsSize > 0)
- {
- s += ':';
- if (f.id == XZ_ID_LZMA2 && f.propsSize == 1)
- s += Lzma2PropToString(f.props[0]);
- else if (f.id == XZ_ID_Delta && f.propsSize == 1)
- s += ConvertUInt32ToString((UInt32)f.props[0] + 1);
- else
- {
- s += '[';
- for (UInt32 bi = 0; bi < f.propsSize; bi++)
- AddHexToString(s, f.props[bi]);
- s += ']';
- }
- }
- return s;
-}
-
-static void AddString(AString &dest, const AString &src)
-{
- if (!dest.IsEmpty())
- dest += ' ';
- dest += src;
-}
-
-static const char *kChecks[] =
-{
- "NoCheck",
- "CRC32",
- NULL,
- NULL,
- "CRC64",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- "SHA256",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static AString GetCheckString(const CXzs &xzs)
-{
- size_t i;
- UInt32 mask = 0;
- for (i = 0; i < xzs.num; i++)
- mask |= ((UInt32)1 << XzFlags_GetCheckType(xzs.streams[i].flags));
- AString s;
- for (i = 0; i <= XZ_CHECK_MASK; i++)
- if (((mask >> i) & 1) != 0)
- {
- AString s2;
- if (kChecks[i])
- s2 = kChecks[i];
- else
- s2 = "Check-" + ConvertUInt32ToString((UInt32)i);
- AddString(s, s2);
- }
- return s;
-}
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidNumBlocks: if (!_useSeq) prop = _numBlocks; break;
- case kpidPhySize: if (_packSizeDefined) prop = _packSize; break;
- case kpidMethod: if (!_methodsString.IsEmpty()) prop = _methodsString; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = 1;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidSize: if (_unpackSizeDefined) prop = _unpackSize; break;
- case kpidPackSize: if (_packSizeDefined) prop = _packSize; break;
- case kpidMethod: if (!_methodsString.IsEmpty()) prop = _methodsString; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-
-struct COpenCallbackWrap
-{
- ICompressProgress p;
- IArchiveOpenCallback *OpenCallback;
- HRESULT Res;
- COpenCallbackWrap(IArchiveOpenCallback *progress);
-};
-
-static SRes OpenCallbackProgress(void *pp, UInt64 inSize, UInt64 /* outSize */)
-{
- COpenCallbackWrap *p = (COpenCallbackWrap *)pp;
- p->Res = p->OpenCallback->SetCompleted(NULL, &inSize);
- return (SRes)p->Res;
-}
-
-COpenCallbackWrap::COpenCallbackWrap(IArchiveOpenCallback *callback)
-{
- p.Progress = OpenCallbackProgress;
- OpenCallback = callback;
- Res = SZ_OK;
-}
-
-struct CXzsCPP
-{
- CXzs p;
- CXzsCPP() { Xzs_Construct(&p); }
- ~CXzsCPP() { Xzs_Free(&p, &g_Alloc); }
-};
-
-HRESULT CHandler::Open2(IInStream *inStream, IArchiveOpenCallback *callback)
-{
- CSeekInStreamWrap inStreamImp(inStream);
-
- CLookToRead lookStream;
- LookToRead_CreateVTable(&lookStream, True);
- lookStream.realStream = &inStreamImp.p;
- LookToRead_Init(&lookStream);
-
- COpenCallbackWrap openWrap(callback);
- RINOK(inStream->Seek(0, STREAM_SEEK_END, &_packSize));
- RINOK(callback->SetTotal(NULL, &_packSize));
-
- CXzsCPP xzs;
- SRes res = Xzs_ReadBackward(&xzs.p, &lookStream.s, &_startPosition, &openWrap.p, &g_Alloc);
- if (res == SZ_ERROR_NO_ARCHIVE && xzs.p.num > 0)
- res = SZ_OK;
- if (res == SZ_OK)
- {
- _packSize -= _startPosition;
- _unpackSize = Xzs_GetUnpackSize(&xzs.p);
- _unpackSizeDefined = _packSizeDefined = true;
- _numBlocks = (UInt64)Xzs_GetNumBlocks(&xzs.p);
-
- RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
- CXzStreamFlags st;
- CSeqInStreamWrap inStreamWrap(inStream);
- SRes res2 = Xz_ReadHeader(&st, &inStreamWrap.p);
-
- if (res2 == SZ_OK)
- {
- CXzBlock block;
- Bool isIndex;
- UInt32 headerSizeRes;
- res2 = XzBlock_ReadHeader(&block, &inStreamWrap.p, &isIndex, &headerSizeRes);
- if (res2 == SZ_OK && !isIndex)
- {
- int numFilters = XzBlock_GetNumFilters(&block);
- for (int i = 0; i < numFilters; i++)
- AddString(_methodsString, GetMethodString(block.filters[i]));
- }
- }
- AddString(_methodsString, GetCheckString(xzs.p));
- }
-
- if (res != SZ_OK || _startPosition != 0)
- {
- RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
- CXzStreamFlags st;
- CSeqInStreamWrap inStreamWrap(inStream);
- SRes res2 = Xz_ReadHeader(&st, &inStreamWrap.p);
- if (res2 == SZ_OK)
- {
- res = res2;
- _startPosition = 0;
- _useSeq = True;
- _unpackSizeDefined = _packSizeDefined = false;
- }
- }
- if (res == SZ_ERROR_NO_ARCHIVE)
- return S_FALSE;
- RINOK(SResToHRESULT(res));
- _stream = inStream;
- _seqStream = inStream;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream, const UInt64 *, IArchiveOpenCallback *callback)
-{
- COM_TRY_BEGIN
- try
- {
- Close();
- return Open2(inStream, callback);
- }
- catch(...) { return S_FALSE; }
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::OpenSeq(ISequentialInStream *stream)
-{
- Close();
- _seqStream = stream;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _numBlocks = 0;
- _useSeq = true;
- _unpackSizeDefined = _packSizeDefined = false;
- _methodsString.Empty();
- _stream.Release();
- _seqStream.Release();
- return S_OK;
-}
-
-class CSeekToSeqStream:
- public IInStream,
- public CMyUnknownImp
-{
-public:
- CMyComPtr<ISequentialInStream> Stream;
- MY_UNKNOWN_IMP1(IInStream)
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-};
-
-STDMETHODIMP CSeekToSeqStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- return Stream->Read(data, size, processedSize);
-}
-
-STDMETHODIMP CSeekToSeqStream::Seek(Int64, UInt32, UInt64 *) { return E_NOTIMPL; }
-
-struct CXzUnpackerCPP
-{
- Byte *InBuf;
- Byte *OutBuf;
- CXzUnpacker p;
- CXzUnpackerCPP(): InBuf(0), OutBuf(0) {}
- ~CXzUnpackerCPP()
- {
- XzUnpacker_Free(&p);
- MyFree(InBuf);
- MyFree(OutBuf);
- }
-};
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool allFilesMode = (numItems == UInt32(-1));
- if (!allFilesMode)
- {
- if (numItems == 0)
- return S_OK;
- if (numItems != 1 || indices[0] != 0)
- return E_INVALIDARG;
- }
-
- bool testMode = (_aTestMode != 0);
-
- extractCallback->SetTotal(_packSize);
- UInt64 currentTotalPacked = 0;
- RINOK(extractCallback->SetCompleted(&currentTotalPacked));
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
-
- RINOK(extractCallback->GetStream(0, &realOutStream, askMode));
-
- if (!testMode && !realOutStream)
- return S_OK;
-
- extractCallback->PrepareOperation(askMode);
-
- if (_stream)
- {
- RINOK(_stream->Seek(_startPosition, STREAM_SEEK_SET, NULL));
- }
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, true);
-
- CCompressProgressWrap progressWrap(progress);
-
- SRes res;
-
- const UInt32 kInBufSize = 1 << 15;
- const UInt32 kOutBufSize = 1 << 21;
-
- UInt32 inPos = 0;
- UInt32 inSize = 0;
- UInt32 outPos = 0;
- CXzUnpackerCPP xzu;
- res = XzUnpacker_Create(&xzu.p, &g_Alloc);
- if (res == SZ_OK)
- {
- xzu.InBuf = (Byte *)MyAlloc(kInBufSize);
- xzu.OutBuf = (Byte *)MyAlloc(kOutBufSize);
- if (xzu.InBuf == 0 || xzu.OutBuf == 0)
- res = SZ_ERROR_MEM;
- }
- if (res == SZ_OK)
- for (;;)
- {
- if (inPos == inSize)
- {
- inPos = inSize = 0;
- RINOK(_seqStream->Read(xzu.InBuf, kInBufSize, &inSize));
- }
-
- SizeT inLen = inSize - inPos;
- SizeT outLen = kOutBufSize - outPos;
- ECoderStatus status;
- res = XzUnpacker_Code(&xzu.p,
- xzu.OutBuf + outPos, &outLen,
- xzu.InBuf + inPos, &inLen,
- (inSize == 0 ? CODER_FINISH_END : CODER_FINISH_ANY), &status);
-
- // printf("\n_inPos = %6d inLen = %5d, outLen = %5d", inPos, inLen, outLen);
-
- inPos += (UInt32)inLen;
- outPos += (UInt32)outLen;
- lps->InSize += inLen;
- lps->OutSize += outLen;
-
- bool finished = (((inLen == 0) && (outLen == 0)) || res != SZ_OK);
-
- if (outPos == kOutBufSize || finished)
- {
- if (realOutStream && outPos > 0)
- {
- RINOK(WriteStream(realOutStream, xzu.OutBuf, outPos));
- }
- outPos = 0;
- }
- if (finished)
- {
- _packSize = lps->InSize;
- _unpackSize = lps->OutSize;
- _packSizeDefined = _unpackSizeDefined = true;
- if (res == SZ_OK)
- {
- if (status == CODER_STATUS_NEEDS_MORE_INPUT)
- {
- if (XzUnpacker_IsStreamWasFinished(&xzu.p))
- _packSize -= xzu.p.padSize;
- else
- res = SZ_ERROR_DATA;
- }
- else
- res = SZ_ERROR_DATA;
- }
- break;
- }
- RINOK(lps->SetCur());
- }
-
- Int32 opRes;
- switch(res)
- {
- case SZ_OK:
- opRes = NArchive::NExtract::NOperationResult::kOK; break;
- case SZ_ERROR_UNSUPPORTED:
- opRes = NArchive::NExtract::NOperationResult::kUnSupportedMethod; break;
- case SZ_ERROR_CRC:
- opRes = NArchive::NExtract::NOperationResult::kCRCError; break;
- case SZ_ERROR_DATA:
- case SZ_ERROR_ARCHIVE:
- case SZ_ERROR_NO_ARCHIVE:
- opRes = NArchive::NExtract::NOperationResult::kDataError; break;
- default:
- return SResToHRESULT(res);
- }
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(opRes));
- return S_OK;
- COM_TRY_END
-}
-
-#ifndef EXTRACT_ONLY
-
-STDMETHODIMP CHandler::GetFileTimeType(UInt32 *timeType)
-{
- *timeType = NFileTimeType::kUnix;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems,
- IArchiveUpdateCallback *updateCallback)
-{
- CSeqOutStreamWrap seqOutStream(outStream);
-
- if (numItems == 0)
- {
- SRes res = Xz_EncodeEmpty(&seqOutStream.p);
- return SResToHRESULT(res);
- }
-
- if (numItems != 1)
- return E_INVALIDARG;
-
- Int32 newData, newProps;
- UInt32 indexInArchive;
- if (!updateCallback)
- return E_FAIL;
- RINOK(updateCallback->GetUpdateItemInfo(0, &newData, &newProps, &indexInArchive));
-
- if (IntToBool(newProps))
- {
- {
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(0, kpidIsDir, &prop));
- if (prop.vt != VT_EMPTY)
- if (prop.vt != VT_BOOL || prop.boolVal != VARIANT_FALSE)
- return E_INVALIDARG;
- }
- }
-
- if (IntToBool(newData))
- {
- {
- UInt64 size;
- NCOM::CPropVariant prop;
- RINOK(updateCallback->GetProperty(0, kpidSize, &prop));
- if (prop.vt != VT_UI8)
- return E_INVALIDARG;
- size = prop.uhVal.QuadPart;
- RINOK(updateCallback->SetTotal(size));
- }
-
- CLzma2EncProps lzma2Props;
- Lzma2EncProps_Init(&lzma2Props);
-
- lzma2Props.lzmaProps.level = _level;
-
- CMyComPtr<ISequentialInStream> fileInStream;
- RINOK(updateCallback->GetStream(0, &fileInStream));
-
- CSeqInStreamWrap seqInStream(fileInStream);
-
- for (int i = 0; i < _methods.Size(); i++)
- {
- COneMethodInfo &m = _methods[i];
- SetCompressionMethod2(m
- #ifdef COMPRESS_MT
- , _numThreads
- #endif
- );
- if (m.IsLzma())
- {
- for (int j = 0; j < m.Props.Size(); j++)
- {
- const CProp &prop = m.Props[j];
- RINOK(NCompress::NLzma2::SetLzma2Prop(prop.Id, prop.Value, lzma2Props));
- }
- }
- }
-
- #ifdef COMPRESS_MT
- lzma2Props.numTotalThreads = _numThreads;
- #endif
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(updateCallback, true);
-
- CCompressProgressWrap progressWrap(progress);
- SRes res = Xz_Encode(&seqOutStream.p, &seqInStream.p, &lzma2Props, False, &progressWrap.p);
- if (res == SZ_OK)
- return updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK);
- return SResToHRESULT(res);
- }
- if (indexInArchive != 0)
- return E_INVALIDARG;
- if (_stream)
- RINOK(_stream->Seek(_startPosition, STREAM_SEEK_SET, NULL));
- return NCompress::CopyStream(_stream, outStream, 0);
-}
-
-STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProps)
-{
- COM_TRY_BEGIN
- BeforeSetProperty();
- for (int i = 0; i < numProps; i++)
- {
- RINOK(SetProperty(names[i], values[i]));
- }
- return S_OK;
- COM_TRY_END
-}
-
-#endif
-
-static IInArchive *CreateArc() { return new NArchive::NXz::CHandler; }
-#ifndef EXTRACT_ONLY
-static IOutArchive *CreateArcOut() { return new NArchive::NXz::CHandler; }
-#else
-#define CreateArcOut 0
-#endif
-
-static CArcInfo g_ArcInfo =
- { L"xz", L"xz txz", L"* .tar", 0xC, {0xFD, '7' , 'z', 'X', 'Z', '\0'}, 6, true, CreateArc, CreateArcOut };
-
-REGISTER_ARC(xz)
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ZHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ZHandler.cpp
deleted file mode 100644
index 118d6ad8e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/ZHandler.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-// ZHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../Common/ProgressUtils.h"
-#include "../Common/RegisterArc.h"
-#include "../Common/StreamUtils.h"
-
-#include "../Compress/ZDecoder.h"
-
-#include "Common/DummyOutStream.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-
-namespace NArchive {
-namespace NZ {
-
-class CHandler:
- public IInArchive,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(IInArchive)
- INTERFACE_IInArchive(;)
-
-private:
- CMyComPtr<IInStream> _stream;
- UInt64 _streamStartPosition;
- UInt64 _packSize;
- Byte _properties;
-};
-
-static IInArchive *CreateArc() { return new CHandler; }
-
-static CArcInfo g_ArcInfo =
- { L"Z", L"z taz", L"* .tar", 5, { 0x1F, 0x9D }, 2, false, CreateArc, 0 };
-
-REGISTER_ARC(Z)
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPackSize, VT_UI8}
-};
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps_NO
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = 1;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value)
-{
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidPackSize: prop = _packSize; break;
- }
- prop.Detach(value);
- return S_OK;
-}
-
-static const int kSignatureSize = 3;
-
-STDMETHODIMP CHandler::Open(IInStream *stream,
- const UInt64 * /* maxCheckStartPosition */,
- IArchiveOpenCallback * /* openArchiveCallback */)
-{
- COM_TRY_BEGIN
- {
- RINOK(stream->Seek(0, STREAM_SEEK_CUR, &_streamStartPosition));
- Byte buffer[kSignatureSize];
- RINOK(ReadStream_FALSE(stream, buffer, kSignatureSize));
- if (buffer[0] != 0x1F || buffer[1] != 0x9D)
- return S_FALSE;
- _properties = buffer[2];
-
- UInt64 endPosition;
- RINOK(stream->Seek(0, STREAM_SEEK_END, &endPosition));
- _packSize = endPosition - _streamStartPosition - kSignatureSize;
-
- _stream = stream;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- _stream.Release();
- return S_OK;
-}
-
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 testModeSpec, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- bool allFilesMode = (numItems == (UInt32)(-1));
- if (!allFilesMode)
- {
- if (numItems == 0)
- return S_OK;
- if (numItems != 1)
- return E_INVALIDARG;
- if (indices[0] != 0)
- return E_INVALIDARG;
- }
-
- bool testMode = (testModeSpec != 0);
-
- extractCallback->SetTotal(_packSize);
-
- UInt64 currentTotalPacked = 0;
-
- RINOK(extractCallback->SetCompleted(&currentTotalPacked));
-
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NExtract::NAskMode::kTest :
- NExtract::NAskMode::kExtract;
-
- RINOK(extractCallback->GetStream(0, &realOutStream, askMode));
-
- if (!testMode && !realOutStream)
- return S_OK;
-
- extractCallback->PrepareOperation(askMode);
-
- CDummyOutStream *outStreamSpec = new CDummyOutStream;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
- outStreamSpec->SetStream(realOutStream);
- outStreamSpec->Init();
- realOutStream.Release();
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, true);
-
- RINOK(_stream->Seek(_streamStartPosition + kSignatureSize, STREAM_SEEK_SET, NULL));
-
- CMyComPtr<ICompressCoder> decoder;
- NCompress::NZ::CDecoder *decoderSpec = new NCompress::NZ::CDecoder;
- decoder = decoderSpec;
-
- HRESULT result = decoderSpec->SetDecoderProperties2(&_properties, 1);
-
- int opResult;
- if (result != S_OK)
- opResult = NExtract::NOperationResult::kUnSupportedMethod;
- else
- {
- result = decoder->Code(_stream, outStream, NULL, NULL, progress);
- if (result == S_FALSE)
- opResult = NExtract::NOperationResult::kDataError;
- else
- {
- RINOK(result);
- opResult = NExtract::NOperationResult::kOK;
- }
- }
- outStream.Release();
- return extractCallback->SetOperationResult(opResult);
- COM_TRY_END
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipAddCommon.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipAddCommon.cpp
deleted file mode 100644
index 9157deeb4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipAddCommon.cpp
+++ /dev/null
@@ -1,345 +0,0 @@
-// ZipAddCommon.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/7zCrc.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../../ICoder.h"
-#include "../../IPassword.h"
-#include "../../MyVersion.h"
-
-#include "../../Common/CreateCoder.h"
-#include "../../Common/StreamObjects.h"
-#include "../../Common/StreamUtils.h"
-
-#include "../../Compress/LzmaEncoder.h"
-
-#include "../Common/InStreamWithCRC.h"
-
-#include "ZipAddCommon.h"
-#include "ZipHeader.h"
-
-namespace NArchive {
-namespace NZip {
-
-static const CMethodId kMethodId_ZipBase = 0x040100;
-static const CMethodId kMethodId_BZip2 = 0x040202;
-
-static const UInt32 kLzmaPropsSize = 5;
-static const UInt32 kLzmaHeaderSize = 4 + kLzmaPropsSize;
-
-class CLzmaEncoder:
- public ICompressCoder,
- public CMyUnknownImp
-{
- NCompress::NLzma::CEncoder *EncoderSpec;
- CMyComPtr<ICompressCoder> Encoder;
- Byte Header[kLzmaHeaderSize];
-public:
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- HRESULT SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
-
- MY_UNKNOWN_IMP
-};
-
-HRESULT CLzmaEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
-{
- if (!Encoder)
- {
- EncoderSpec = new NCompress::NLzma::CEncoder;
- Encoder = EncoderSpec;
- }
- CSequentialOutStreamImp *outStreamSpec = new CSequentialOutStreamImp;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
- outStreamSpec->Init();
- RINOK(EncoderSpec->SetCoderProperties(propIDs, props, numProps));
- RINOK(EncoderSpec->WriteCoderProperties(outStream));
- if (outStreamSpec->GetSize() != kLzmaPropsSize)
- return E_FAIL;
- Header[0] = MY_VER_MAJOR;
- Header[1] = MY_VER_MINOR;
- Header[2] = kLzmaPropsSize;
- Header[3] = 0;
- memcpy(Header + 4, outStreamSpec->GetBuffer(), kLzmaPropsSize);
- return S_OK;
-}
-
-HRESULT CLzmaEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- RINOK(WriteStream(outStream, Header, kLzmaHeaderSize));
- return Encoder->Code(inStream, outStream, inSize, outSize, progress);
-}
-
-
-CAddCommon::CAddCommon(const CCompressionMethodMode &options):
- _options(options),
- _copyCoderSpec(NULL),
- _cryptoStreamSpec(0)
- {}
-
-static HRESULT GetStreamCRC(ISequentialInStream *inStream, UInt32 &resultCRC)
-{
- UInt32 crc = CRC_INIT_VAL;
- const UInt32 kBufferSize = (1 << 14);
- Byte buffer[kBufferSize];
- for (;;)
- {
- UInt32 realProcessedSize;
- RINOK(inStream->Read(buffer, kBufferSize, &realProcessedSize));
- if (realProcessedSize == 0)
- {
- resultCRC = CRC_GET_DIGEST(crc);
- return S_OK;
- }
- crc = CrcUpdate(crc, buffer, (size_t)realProcessedSize);
- }
-}
-
-HRESULT CAddCommon::Compress(
- DECL_EXTERNAL_CODECS_LOC_VARS
- ISequentialInStream *inStream, IOutStream *outStream,
- ICompressProgressInfo *progress, CCompressingResult &operationResult)
-{
- CSequentialInStreamWithCRC *inSecCrcStreamSpec = 0;
- CInStreamWithCRC *inCrcStreamSpec = 0;
- CMyComPtr<ISequentialInStream> inCrcStream;
- {
- CMyComPtr<IInStream> inStream2;
- // we don't support stdin, since stream from stdin can require 64-bit size header
- RINOK(inStream->QueryInterface(IID_IInStream, (void **)&inStream2));
- if (inStream2)
- {
- inCrcStreamSpec = new CInStreamWithCRC;
- inCrcStream = inCrcStreamSpec;
- inCrcStreamSpec->SetStream(inStream2);
- inCrcStreamSpec->Init();
- }
- else
- {
- inSecCrcStreamSpec = new CSequentialInStreamWithCRC;
- inCrcStream = inSecCrcStreamSpec;
- inSecCrcStreamSpec->SetStream(inStream);
- inSecCrcStreamSpec->Init();
- }
- }
-
- int numTestMethods = _options.MethodSequence.Size();
- if (numTestMethods > 1 || _options.PasswordIsDefined)
- {
- if (inCrcStreamSpec == 0)
- {
- if (_options.PasswordIsDefined)
- return E_NOTIMPL;
- numTestMethods = 1;
- }
- }
- Byte method = 0;
- COutStreamReleaser outStreamReleaser;
- for (int i = 0; i < numTestMethods; i++)
- {
- if (inCrcStreamSpec != 0)
- RINOK(inCrcStreamSpec->Seek(0, STREAM_SEEK_SET, NULL));
- RINOK(outStream->Seek(0, STREAM_SEEK_SET, NULL));
- if (_options.PasswordIsDefined)
- {
- if (!_cryptoStream)
- {
- _cryptoStreamSpec = new CFilterCoder;
- _cryptoStream = _cryptoStreamSpec;
- }
- if (_options.IsAesMode)
- {
- _cryptoStreamSpec->Filter = _aesFilter = _filterAesSpec = new NCrypto::NWzAes::CEncoder;
- _filterAesSpec->SetKeyMode(_options.AesKeyMode);
- RINOK(_filterAesSpec->CryptoSetPassword(
- (const Byte *)(const char *)_options.Password, _options.Password.Length()));
- RINOK(_filterAesSpec->WriteHeader(outStream));
- }
- else
- {
- _cryptoStreamSpec->Filter = _zipCryptoFilter = _filterSpec = new NCrypto::NZip::CEncoder;
- RINOK(_filterSpec->CryptoSetPassword(
- (const Byte *)(const char *)_options.Password, _options.Password.Length()));
- UInt32 crc = 0;
- RINOK(GetStreamCRC(inStream, crc));
- RINOK(inCrcStreamSpec->Seek(0, STREAM_SEEK_SET, NULL));
- RINOK(_filterSpec->CryptoSetCRC(crc));
- RINOK(_filterSpec->WriteHeader(outStream));
- }
- RINOK(_cryptoStreamSpec->SetOutStream(outStream));
- outStreamReleaser.FilterCoder = _cryptoStreamSpec;
- }
-
- method = _options.MethodSequence[i];
- switch(method)
- {
- case NFileHeader::NCompressionMethod::kStored:
- {
- if (_copyCoderSpec == NULL)
- {
- _copyCoderSpec = new NCompress::CCopyCoder;
- _copyCoder = _copyCoderSpec;
- }
- CMyComPtr<ISequentialOutStream> outStreamNew;
- if (_options.PasswordIsDefined)
- outStreamNew = _cryptoStream;
- else
- outStreamNew = outStream;
- RINOK(_copyCoder->Code(inCrcStream, outStreamNew, NULL, NULL, progress));
- operationResult.ExtractVersion = NFileHeader::NCompressionMethod::kStoreExtractVersion;
- break;
- }
- default:
- {
- if (!_compressEncoder)
- {
- if (method == NFileHeader::NCompressionMethod::kLZMA)
- {
- CLzmaEncoder *_lzmaEncoder = new CLzmaEncoder();
- _compressEncoder = _lzmaEncoder;
- NWindows::NCOM::CPropVariant props[] =
- {
- #ifdef COMPRESS_MT
- _options.NumThreads,
- #endif
- _options.Algo,
- _options.DicSize,
- _options.NumFastBytes,
- (BSTR)(const wchar_t *)_options.MatchFinder,
- _options.NumMatchFinderCycles
- };
- PROPID propIDs[] =
- {
- #ifdef COMPRESS_MT
- NCoderPropID::kNumThreads,
- #endif
- NCoderPropID::kAlgorithm,
- NCoderPropID::kDictionarySize,
- NCoderPropID::kNumFastBytes,
- NCoderPropID::kMatchFinder,
- NCoderPropID::kMatchFinderCycles
- };
- int numProps = sizeof(propIDs) / sizeof(propIDs[0]);
- if (!_options.NumMatchFinderCyclesDefined)
- numProps--;
- RINOK(_lzmaEncoder->SetCoderProperties(propIDs, props, numProps));
- }
- else
- {
- CMethodId methodId;
- switch(method)
- {
- case NFileHeader::NCompressionMethod::kBZip2:
- methodId = kMethodId_BZip2;
- break;
- default:
- methodId = kMethodId_ZipBase + method;
- break;
- }
- RINOK(CreateCoder(
- EXTERNAL_CODECS_LOC_VARS
- methodId, _compressEncoder, true));
- if (!_compressEncoder)
- return E_NOTIMPL;
-
- if (method == NFileHeader::NCompressionMethod::kDeflated ||
- method == NFileHeader::NCompressionMethod::kDeflated64)
- {
- NWindows::NCOM::CPropVariant props[] =
- {
- _options.Algo,
- _options.NumPasses,
- _options.NumFastBytes,
- _options.NumMatchFinderCycles
- };
- PROPID propIDs[] =
- {
- NCoderPropID::kAlgorithm,
- NCoderPropID::kNumPasses,
- NCoderPropID::kNumFastBytes,
- NCoderPropID::kMatchFinderCycles
- };
- int numProps = sizeof(propIDs) / sizeof(propIDs[0]);
- if (!_options.NumMatchFinderCyclesDefined)
- numProps--;
- CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
- _compressEncoder.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties);
- if (setCoderProperties)
- {
- RINOK(setCoderProperties->SetCoderProperties(propIDs, props, numProps));
- }
- }
- else if (method == NFileHeader::NCompressionMethod::kBZip2)
- {
- NWindows::NCOM::CPropVariant props[] =
- {
- _options.DicSize,
- _options.NumPasses
- #ifdef COMPRESS_MT
- , _options.NumThreads
- #endif
- };
- PROPID propIDs[] =
- {
- NCoderPropID::kDictionarySize,
- NCoderPropID::kNumPasses
- #ifdef COMPRESS_MT
- , NCoderPropID::kNumThreads
- #endif
- };
- CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
- _compressEncoder.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties);
- if (setCoderProperties)
- {
- RINOK(setCoderProperties->SetCoderProperties(propIDs, props, sizeof(propIDs) / sizeof(propIDs[0])));
- }
- }
- }
- }
- CMyComPtr<ISequentialOutStream> outStreamNew;
- if (_options.PasswordIsDefined)
- outStreamNew = _cryptoStream;
- else
- outStreamNew = outStream;
- RINOK(_compressEncoder->Code(inCrcStream, outStreamNew, NULL, NULL, progress));
- operationResult.ExtractVersion = NFileHeader::NCompressionMethod::kDeflateExtractVersion;
- break;
- }
- }
-
- RINOK(outStream->Seek(0, STREAM_SEEK_CUR, &operationResult.PackSize));
-
- if (inCrcStreamSpec != 0)
- {
- operationResult.CRC = inCrcStreamSpec->GetCRC();
- operationResult.UnpackSize = inCrcStreamSpec->GetSize();
- }
- else
- {
- operationResult.CRC = inSecCrcStreamSpec->GetCRC();
- operationResult.UnpackSize = inSecCrcStreamSpec->GetSize();
- }
-
- if (_options.PasswordIsDefined)
- {
- if (operationResult.PackSize < operationResult.UnpackSize +
- (_options.IsAesMode ? _filterAesSpec->GetHeaderSize() : NCrypto::NZip::kHeaderSize))
- break;
- }
- else if (operationResult.PackSize < operationResult.UnpackSize)
- break;
- }
- if (_options.IsAesMode)
- {
- RINOK(_filterAesSpec->WriteFooter(outStream));
- RINOK(outStream->Seek(0, STREAM_SEEK_CUR, &operationResult.PackSize));
- }
- operationResult.Method = method;
- return outStream->SetSize(operationResult.PackSize);
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipAddCommon.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipAddCommon.h
deleted file mode 100644
index 8f5b568d6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipAddCommon.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// ZipAddCommon.h
-
-#ifndef __ZIP_ADD_COMMON_H
-#define __ZIP_ADD_COMMON_H
-
-#include "../../ICoder.h"
-#include "../../IProgress.h"
-
-#include "../../Common/CreateCoder.h"
-#include "../../Common/FilterCoder.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "../../Crypto/ZipCrypto.h"
-#include "../../Crypto/WzAes.h"
-
-#include "ZipCompressionMode.h"
-
-namespace NArchive {
-namespace NZip {
-
-struct CCompressingResult
-{
- UInt64 UnpackSize;
- UInt64 PackSize;
- UInt32 CRC;
- UInt16 Method;
- Byte ExtractVersion;
-};
-
-class CAddCommon
-{
- CCompressionMethodMode _options;
- NCompress::CCopyCoder *_copyCoderSpec;
- CMyComPtr<ICompressCoder> _copyCoder;
-
- CMyComPtr<ICompressCoder> _compressEncoder;
-
- CFilterCoder *_cryptoStreamSpec;
- CMyComPtr<ISequentialOutStream> _cryptoStream;
-
- NCrypto::NZip::CEncoder *_filterSpec;
- NCrypto::NWzAes::CEncoder *_filterAesSpec;
-
- CMyComPtr<ICompressFilter> _zipCryptoFilter;
- CMyComPtr<ICompressFilter> _aesFilter;
-
-
-public:
- CAddCommon(const CCompressionMethodMode &options);
- HRESULT Compress(
- DECL_EXTERNAL_CODECS_LOC_VARS
- ISequentialInStream *inStream, IOutStream *outStream,
- ICompressProgressInfo *progress, CCompressingResult &operationResult);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipCompressionMode.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipCompressionMode.h
deleted file mode 100644
index de5f5ccd8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipCompressionMode.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// CompressionMode.h
-
-#ifndef __ZIP_COMPRESSIONMETHOD_H
-#define __ZIP_COMPRESSIONMETHOD_H
-
-#include "Common/MyString.h"
-
-namespace NArchive {
-namespace NZip {
-
-struct CCompressionMethodMode
-{
- CRecordVector<Byte> MethodSequence;
- UString MatchFinder;
- UInt32 Algo;
- UInt32 NumPasses;
- UInt32 NumFastBytes;
- bool NumMatchFinderCyclesDefined;
- UInt32 NumMatchFinderCycles;
- UInt32 DicSize;
- #ifdef COMPRESS_MT
- UInt32 NumThreads;
- #endif
- bool PasswordIsDefined;
- AString Password;
- bool IsAesMode;
- Byte AesKeyMode;
-
- CCompressionMethodMode():
- NumMatchFinderCyclesDefined(false),
- PasswordIsDefined(false),
- IsAesMode(false),
- AesKeyMode(3)
- {}
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHandler.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHandler.cpp
deleted file mode 100644
index 927c0f34a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHandler.cpp
+++ /dev/null
@@ -1,827 +0,0 @@
-// ZipHandler.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/IntToString.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../../IPassword.h"
-
-#include "../../Common/FilterCoder.h"
-#include "../../Common/ProgressUtils.h"
-#include "../../Common/StreamObjects.h"
-#include "../../Common/StreamUtils.h"
-
-#include "../../Compress/CopyCoder.h"
-#include "../../Compress/LzmaDecoder.h"
-#include "../../Compress/ImplodeDecoder.h"
-#include "../../Compress/ShrinkDecoder.h"
-
-#include "../../Crypto/WzAes.h"
-#include "../../Crypto/ZipCrypto.h"
-#include "../../Crypto/ZipStrong.h"
-
-#include "../Common/ItemNameUtils.h"
-#include "../Common/OutStreamWithCRC.h"
-
-#include "ZipHandler.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-namespace NArchive {
-namespace NZip {
-
-static const CMethodId kMethodId_ZipBase = 0x040100;
-static const CMethodId kMethodId_BZip2 = 0x040202;
-
-static const char *kHostOS[] =
-{
- "FAT",
- "AMIGA",
- "VMS",
- "Unix",
- "VM/CMS",
- "Atari",
- "HPFS",
- "Macintosh",
- "Z-System",
- "CP/M",
- "TOPS-20",
- "NTFS",
- "SMS/QDOS",
- "Acorn",
- "VFAT",
- "MVS",
- "BeOS",
- "Tandem",
- "OS/400",
- "OS/X"
-};
-
-static const char *kUnknownOS = "Unknown";
-
-STATPROPSTG kProps[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidATime, VT_FILETIME},
-
- { NULL, kpidAttrib, VT_UI4},
-
- { NULL, kpidEncrypted, VT_BOOL},
- { NULL, kpidComment, VT_BSTR},
-
- { NULL, kpidCRC, VT_UI4},
-
- { NULL, kpidMethod, VT_BSTR},
- { NULL, kpidHostOS, VT_BSTR}
-
- // { NULL, kpidUnpackVer, VT_UI1},
-};
-
-const char *kMethods[] =
-{
- "Store",
- "Shrink",
- "Reduced1",
- "Reduced2",
- "Reduced2",
- "Reduced3",
- "Implode",
- "Tokenizing",
- "Deflate",
- "Deflate64",
- "PKImploding"
-};
-
-const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]);
-const char *kBZip2Method = "BZip2";
-const char *kLZMAMethod = "LZMA";
-const char *kJpegMethod = "Jpeg";
-const char *kWavPackMethod = "WavPack";
-const char *kPPMdMethod = "PPMd";
-const char *kAESMethod = "AES";
-const char *kZipCryptoMethod = "ZipCrypto";
-const char *kStrongCryptoMethod = "StrongCrypto";
-
-struct CStrongCryptoPair
-{
- UInt16 Id;
- const char *Name;
-};
-
-CStrongCryptoPair g_StrongCryptoPairs[] =
-{
- { NStrongCryptoFlags::kDES, "DES" },
- { NStrongCryptoFlags::kRC2old, "RC2a" },
- { NStrongCryptoFlags::k3DES168, "3DES-168" },
- { NStrongCryptoFlags::k3DES112, "3DES-112" },
- { NStrongCryptoFlags::kAES128, "pkAES-128" },
- { NStrongCryptoFlags::kAES192, "pkAES-192" },
- { NStrongCryptoFlags::kAES256, "pkAES-256" },
- { NStrongCryptoFlags::kRC2, "RC2" },
- { NStrongCryptoFlags::kBlowfish, "Blowfish" },
- { NStrongCryptoFlags::kTwofish, "Twofish" },
- { NStrongCryptoFlags::kRC4, "RC4" }
-};
-
-STATPROPSTG kArcProps[] =
-{
- { NULL, kpidBit64, VT_BOOL},
- { NULL, kpidComment, VT_BSTR}
-};
-
-CHandler::CHandler()
-{
- InitMethodProperties();
-}
-
-static AString BytesToString(const CByteBuffer &data)
-{
- AString s;
- int size = (int)data.GetCapacity();
- if (size > 0)
- {
- char *p = s.GetBuffer(size + 1);
- memcpy(p, (const Byte *)data, size);
- p[size] = '\0';
- s.ReleaseBuffer();
- }
- return s;
-}
-
-IMP_IInArchive_Props
-IMP_IInArchive_ArcProps
-
-STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidBit64: if (m_Archive.IsZip64) prop = m_Archive.IsZip64; break;
- case kpidComment:
- prop = MultiByteToUnicodeString(BytesToString(m_Archive.m_ArchiveInfo.Comment), CP_ACP);
- break;
- }
- prop.Detach(value);
- COM_TRY_END
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = m_Items.Size();
- return S_OK;
-}
-
-STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- const CItemEx &item = m_Items[index];
- switch(propID)
- {
- case kpidPath: prop = NItemName::GetOSName2(item.GetUnicodeString(item.Name)); break;
- case kpidIsDir: prop = item.IsDir(); break;
- case kpidSize: prop = item.UnPackSize; break;
- case kpidPackSize: prop = item.PackSize; break;
- case kpidTimeType:
- {
- FILETIME ft;
- UInt32 unixTime;
- if (item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kMTime, ft))
- prop = (UInt32)NFileTimeType::kWindows;
- else if (item.CentralExtra.GetUnixTime(NFileHeader::NUnixTime::kMTime, unixTime))
- prop = (UInt32)NFileTimeType::kUnix;
- else
- prop = (UInt32)NFileTimeType::kDOS;
- break;
- }
- case kpidCTime:
- {
- FILETIME ft;
- if (item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kCTime, ft))
- prop = ft;
- break;
- }
- case kpidATime:
- {
- FILETIME ft;
- if (item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kATime, ft))
- prop = ft;
- break;
- }
- case kpidMTime:
- {
- FILETIME utc;
- if (!item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kMTime, utc))
- {
- UInt32 unixTime;
- if (item.CentralExtra.GetUnixTime(NFileHeader::NUnixTime::kMTime, unixTime))
- NTime::UnixTimeToFileTime(unixTime, utc);
- else
- {
- FILETIME localFileTime;
- if (!NTime::DosTimeToFileTime(item.Time, localFileTime) ||
- !LocalFileTimeToFileTime(&localFileTime, &utc))
- utc.dwHighDateTime = utc.dwLowDateTime = 0;
- }
- }
- prop = utc;
- break;
- }
- case kpidAttrib: prop = item.GetWinAttributes(); break;
- case kpidEncrypted: prop = item.IsEncrypted(); break;
- case kpidComment: prop = item.GetUnicodeString(BytesToString(item.Comment)); break;
- case kpidCRC: if (item.IsThereCrc()) prop = item.FileCRC; break;
- case kpidMethod:
- {
- UInt16 methodId = item.CompressionMethod;
- AString method;
- if (item.IsEncrypted())
- {
- if (methodId == NFileHeader::NCompressionMethod::kWzAES)
- {
- method = kAESMethod;
- CWzAesExtraField aesField;
- if (item.CentralExtra.GetWzAesField(aesField))
- {
- method += '-';
- char s[32];
- ConvertUInt64ToString((aesField.Strength + 1) * 64 , s);
- method += s;
- method += ' ';
- methodId = aesField.Method;
- }
- }
- else
- {
- if (item.IsStrongEncrypted())
- {
- CStrongCryptoField f;
- bool finded = false;
- if (item.CentralExtra.GetStrongCryptoField(f))
- {
- for (unsigned int i = 0; i < sizeof(g_StrongCryptoPairs) / sizeof(g_StrongCryptoPairs[0]); i++)
- {
- const CStrongCryptoPair &pair = g_StrongCryptoPairs[i];
- if (f.AlgId == pair.Id)
- {
- method += pair.Name;
- finded = true;
- break;
- }
- }
- }
- if (!finded)
- method += kStrongCryptoMethod;
- }
- else
- method += kZipCryptoMethod;
- method += ' ';
- }
- }
- if (methodId < kNumMethods)
- method += kMethods[methodId];
- else switch (methodId)
- {
- case NFileHeader::NCompressionMethod::kLZMA:
- method += kLZMAMethod;
- if (item.IsLzmaEOS())
- method += ":EOS";
- break;
- case NFileHeader::NCompressionMethod::kBZip2: method += kBZip2Method; break;
- case NFileHeader::NCompressionMethod::kJpeg: method += kJpegMethod; break;
- case NFileHeader::NCompressionMethod::kWavPack: method += kWavPackMethod; break;
- case NFileHeader::NCompressionMethod::kPPMd: method += kPPMdMethod; break;
- default:
- {
- char s[32];
- ConvertUInt64ToString(methodId, s);
- method += s;
- }
- }
- prop = method;
- break;
- }
- case kpidHostOS:
- prop = (item.MadeByVersion.HostOS < sizeof(kHostOS) / sizeof(kHostOS[0])) ?
- (kHostOS[item.MadeByVersion.HostOS]) : kUnknownOS;
- break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-class CProgressImp: public CProgressVirt
-{
- CMyComPtr<IArchiveOpenCallback> _callback;
-public:
- STDMETHOD(SetTotal)(UInt64 numFiles);
- STDMETHOD(SetCompleted)(UInt64 numFiles);
- CProgressImp(IArchiveOpenCallback *callback): _callback(callback) {}
-};
-
-STDMETHODIMP CProgressImp::SetTotal(UInt64 numFiles)
-{
- if (_callback)
- return _callback->SetTotal(&numFiles, NULL);
- return S_OK;
-}
-
-STDMETHODIMP CProgressImp::SetCompleted(UInt64 numFiles)
-{
- if (_callback)
- return _callback->SetCompleted(&numFiles, NULL);
- return S_OK;
-}
-
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *callback)
-{
- COM_TRY_BEGIN
- try
- {
- Close();
- RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
- RINOK(m_Archive.Open(inStream, maxCheckStartPosition));
- CProgressImp progressImp(callback);
- return m_Archive.ReadHeaders(m_Items, &progressImp);
- }
- catch(const CInArchiveException &) { Close(); return S_FALSE; }
- catch(...) { Close(); throw; }
- COM_TRY_END
-}
-
-STDMETHODIMP CHandler::Close()
-{
- m_Items.Clear();
- m_Archive.Close();
- return S_OK;
-}
-
-//////////////////////////////////////
-// CHandler::DecompressItems
-
-class CLzmaDecoder:
- public ICompressCoder,
- public CMyUnknownImp
-{
- NCompress::NLzma::CDecoder *DecoderSpec;
- CMyComPtr<ICompressCoder> Decoder;
-public:
- CLzmaDecoder();
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- MY_UNKNOWN_IMP
-};
-
-CLzmaDecoder::CLzmaDecoder()
-{
- DecoderSpec = new NCompress::NLzma::CDecoder;
- Decoder = DecoderSpec;
-}
-
-HRESULT CLzmaDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- Byte buf[9];
- RINOK(ReadStream_FALSE(inStream, buf, 9));
- if (buf[2] != 5 || buf[3] != 0)
- return E_NOTIMPL;
- RINOK(DecoderSpec->SetDecoderProperties2(buf + 4, 5));
- return Decoder->Code(inStream, outStream, NULL, outSize, progress);
-}
-
-struct CMethodItem
-{
- UInt16 ZipMethod;
- CMyComPtr<ICompressCoder> Coder;
-};
-
-class CZipDecoder
-{
- NCrypto::NZip::CDecoder *_zipCryptoDecoderSpec;
- NCrypto::NZipStrong::CDecoder *_pkAesDecoderSpec;
- NCrypto::NWzAes::CDecoder *_wzAesDecoderSpec;
-
- CMyComPtr<ICompressFilter> _zipCryptoDecoder;
- CMyComPtr<ICompressFilter> _pkAesDecoder;
- CMyComPtr<ICompressFilter> _wzAesDecoder;
-
- CFilterCoder *filterStreamSpec;
- CMyComPtr<ISequentialInStream> filterStream;
- CMyComPtr<ICryptoGetTextPassword> getTextPassword;
- CObjectVector<CMethodItem> methodItems;
-
-public:
- CZipDecoder():
- _zipCryptoDecoderSpec(0),
- _pkAesDecoderSpec(0),
- _wzAesDecoderSpec(0),
- filterStreamSpec(0) {}
-
- HRESULT Decode(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CInArchive &archive, const CItemEx &item,
- ISequentialOutStream *realOutStream,
- IArchiveExtractCallback *extractCallback,
- ICompressProgressInfo *compressProgress,
- UInt32 numThreads, Int32 &res);
-};
-
-HRESULT CZipDecoder::Decode(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CInArchive &archive, const CItemEx &item,
- ISequentialOutStream *realOutStream,
- IArchiveExtractCallback *extractCallback,
- ICompressProgressInfo *compressProgress,
- UInt32 numThreads, Int32 &res)
-{
- res = NArchive::NExtract::NOperationResult::kDataError;
- CInStreamReleaser inStreamReleaser;
-
- bool needCRC = true;
- bool wzAesMode = false;
- bool pkAesMode = false;
- UInt16 methodId = item.CompressionMethod;
- if (item.IsEncrypted())
- {
- if (item.IsStrongEncrypted())
- {
- CStrongCryptoField f;
- if (item.CentralExtra.GetStrongCryptoField(f))
- {
- pkAesMode = true;
- }
- if (!pkAesMode)
- {
- res = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- return S_OK;
- }
- }
- if (methodId == NFileHeader::NCompressionMethod::kWzAES)
- {
- CWzAesExtraField aesField;
- if (item.CentralExtra.GetWzAesField(aesField))
- {
- wzAesMode = true;
- needCRC = aesField.NeedCrc();
- }
- }
- }
-
- COutStreamWithCRC *outStreamSpec = new COutStreamWithCRC;
- CMyComPtr<ISequentialOutStream> outStream = outStreamSpec;
- outStreamSpec->SetStream(realOutStream);
- outStreamSpec->Init(needCRC);
-
- UInt64 authenticationPos;
-
- CMyComPtr<ISequentialInStream> inStream;
- {
- UInt64 packSize = item.PackSize;
- if (wzAesMode)
- {
- if (packSize < NCrypto::NWzAes::kMacSize)
- return S_OK;
- packSize -= NCrypto::NWzAes::kMacSize;
- }
- UInt64 dataPos = item.GetDataPosition();
- inStream.Attach(archive.CreateLimitedStream(dataPos, packSize));
- authenticationPos = dataPos + packSize;
- }
-
- CMyComPtr<ICompressFilter> cryptoFilter;
- if (item.IsEncrypted())
- {
- if (wzAesMode)
- {
- CWzAesExtraField aesField;
- if (!item.CentralExtra.GetWzAesField(aesField))
- return S_OK;
- methodId = aesField.Method;
- if (!_wzAesDecoder)
- {
- _wzAesDecoderSpec = new NCrypto::NWzAes::CDecoder;
- _wzAesDecoder = _wzAesDecoderSpec;
- }
- cryptoFilter = _wzAesDecoder;
- Byte properties = aesField.Strength;
- RINOK(_wzAesDecoderSpec->SetDecoderProperties2(&properties, 1));
- }
- else if (pkAesMode)
- {
- if (!_pkAesDecoder)
- {
- _pkAesDecoderSpec = new NCrypto::NZipStrong::CDecoder;
- _pkAesDecoder = _pkAesDecoderSpec;
- }
- cryptoFilter = _pkAesDecoder;
- }
- else
- {
- if (!_zipCryptoDecoder)
- {
- _zipCryptoDecoderSpec = new NCrypto::NZip::CDecoder;
- _zipCryptoDecoder = _zipCryptoDecoderSpec;
- }
- cryptoFilter = _zipCryptoDecoder;
- }
- CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
- RINOK(cryptoFilter.QueryInterface(IID_ICryptoSetPassword, &cryptoSetPassword));
-
- if (!getTextPassword)
- extractCallback->QueryInterface(IID_ICryptoGetTextPassword, (void **)&getTextPassword);
-
- if (getTextPassword)
- {
- CMyComBSTR password;
- RINOK(getTextPassword->CryptoGetTextPassword(&password));
- AString charPassword;
- if (wzAesMode || pkAesMode)
- {
- charPassword = UnicodeStringToMultiByte((const wchar_t *)password, CP_ACP);
- /*
- for (int i = 0;; i++)
- {
- wchar_t c = password[i];
- if (c == 0)
- break;
- if (c >= 0x80)
- {
- res = NArchive::NExtract::NOperationResult::kDataError;
- return S_OK;
- }
- charPassword += (char)c;
- }
- */
- }
- else
- {
- // we use OEM. WinZip/Windows probably use ANSI for some files
- charPassword = UnicodeStringToMultiByte((const wchar_t *)password, CP_OEMCP);
- }
- HRESULT result = cryptoSetPassword->CryptoSetPassword(
- (const Byte *)(const char *)charPassword, charPassword.Length());
- if (result != S_OK)
- return S_OK;
- }
- else
- {
- RINOK(cryptoSetPassword->CryptoSetPassword(0, 0));
- }
- }
-
- int m;
- for (m = 0; m < methodItems.Size(); m++)
- if (methodItems[m].ZipMethod == methodId)
- break;
-
- if (m == methodItems.Size())
- {
- CMethodItem mi;
- mi.ZipMethod = methodId;
- if (methodId == NFileHeader::NCompressionMethod::kStored)
- mi.Coder = new NCompress::CCopyCoder;
- else if (methodId == NFileHeader::NCompressionMethod::kShrunk)
- mi.Coder = new NCompress::NShrink::CDecoder;
- else if (methodId == NFileHeader::NCompressionMethod::kImploded)
- mi.Coder = new NCompress::NImplode::NDecoder::CCoder;
- else if (methodId == NFileHeader::NCompressionMethod::kLZMA)
- mi.Coder = new CLzmaDecoder;
- else
- {
- CMethodId szMethodID;
- if (methodId == NFileHeader::NCompressionMethod::kBZip2)
- szMethodID = kMethodId_BZip2;
- else
- {
- if (methodId > 0xFF)
- {
- res = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- return S_OK;
- }
- szMethodID = kMethodId_ZipBase + (Byte)methodId;
- }
-
- RINOK(CreateCoder(EXTERNAL_CODECS_LOC_VARS szMethodID, mi.Coder, false));
-
- if (mi.Coder == 0)
- {
- res = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- return S_OK;
- }
- }
- m = methodItems.Add(mi);
- }
- ICompressCoder *coder = methodItems[m].Coder;
-
- {
- CMyComPtr<ICompressSetDecoderProperties2> setDecoderProperties;
- coder->QueryInterface(IID_ICompressSetDecoderProperties2, (void **)&setDecoderProperties);
- if (setDecoderProperties)
- {
- Byte properties = (Byte)item.Flags;
- RINOK(setDecoderProperties->SetDecoderProperties2(&properties, 1));
- }
- }
-
- #ifdef COMPRESS_MT
- {
- CMyComPtr<ICompressSetCoderMt> setCoderMt;
- coder->QueryInterface(IID_ICompressSetCoderMt, (void **)&setCoderMt);
- if (setCoderMt)
- {
- RINOK(setCoderMt->SetNumberOfThreads(numThreads));
- }
- }
- #endif
-
- {
- HRESULT result = S_OK;
- CMyComPtr<ISequentialInStream> inStreamNew;
- if (item.IsEncrypted())
- {
- if (!filterStream)
- {
- filterStreamSpec = new CFilterCoder;
- filterStream = filterStreamSpec;
- }
- filterStreamSpec->Filter = cryptoFilter;
- if (wzAesMode)
- {
- result = _wzAesDecoderSpec->ReadHeader(inStream);
- }
- else if (pkAesMode)
- {
- result =_pkAesDecoderSpec->ReadHeader(inStream, item.FileCRC, item.UnPackSize);
- if (result == S_OK)
- {
- bool passwOK;
- result = _pkAesDecoderSpec->CheckPassword(passwOK);
- if (result == S_OK && !passwOK)
- result = S_FALSE;
- }
- }
- else
- {
- result = _zipCryptoDecoderSpec->ReadHeader(inStream);
- }
-
- if (result == S_OK)
- {
- RINOK(filterStreamSpec->SetInStream(inStream));
- inStreamReleaser.FilterCoder = filterStreamSpec;
- inStreamNew = filterStream;
- if (wzAesMode)
- {
- if (!_wzAesDecoderSpec->CheckPasswordVerifyCode())
- result = S_FALSE;
- }
- }
- }
- else
- inStreamNew = inStream;
- if (result == S_OK)
- result = coder->Code(inStreamNew, outStream, NULL, &item.UnPackSize, compressProgress);
- if (result == S_FALSE)
- return S_OK;
- if (result == E_NOTIMPL)
- {
- res = NArchive::NExtract::NOperationResult::kUnSupportedMethod;
- return S_OK;
- }
-
- RINOK(result);
- }
- bool crcOK = true;
- bool authOk = true;
- if (needCRC)
- crcOK = (outStreamSpec->GetCRC() == item.FileCRC);
- if (wzAesMode)
- {
- inStream.Attach(archive.CreateLimitedStream(authenticationPos, NCrypto::NWzAes::kMacSize));
- if (_wzAesDecoderSpec->CheckMac(inStream, authOk) != S_OK)
- authOk = false;
- }
-
- res = ((crcOK && authOk) ?
- NArchive::NExtract::NOperationResult::kOK :
- NArchive::NExtract::NOperationResult::kCRCError);
- return S_OK;
-}
-
-
-STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
- Int32 _aTestMode, IArchiveExtractCallback *extractCallback)
-{
- COM_TRY_BEGIN
- CZipDecoder myDecoder;
- bool testMode = (_aTestMode != 0);
- UInt64 totalUnPacked = 0, totalPacked = 0;
- bool allFilesMode = (numItems == UInt32(-1));
- if (allFilesMode)
- numItems = m_Items.Size();
- if(numItems == 0)
- return S_OK;
- UInt32 i;
- for(i = 0; i < numItems; i++)
- {
- const CItemEx &item = m_Items[allFilesMode ? i : indices[i]];
- totalUnPacked += item.UnPackSize;
- totalPacked += item.PackSize;
- }
- RINOK(extractCallback->SetTotal(totalUnPacked));
-
- UInt64 currentTotalUnPacked = 0, currentTotalPacked = 0;
- UInt64 currentItemUnPacked, currentItemPacked;
-
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(extractCallback, false);
-
- for (i = 0; i < numItems; i++, currentTotalUnPacked += currentItemUnPacked,
- currentTotalPacked += currentItemPacked)
- {
- currentItemUnPacked = 0;
- currentItemPacked = 0;
-
- lps->InSize = currentTotalPacked;
- lps->OutSize = currentTotalUnPacked;
- RINOK(lps->SetCur());
-
- CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
- NArchive::NExtract::NAskMode::kTest :
- NArchive::NExtract::NAskMode::kExtract;
- Int32 index = allFilesMode ? i : indices[i];
-
- RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
-
- CItemEx item = m_Items[index];
- if (!item.FromLocal)
- {
- HRESULT res = m_Archive.ReadLocalItemAfterCdItem(item);
- if (res == S_FALSE)
- {
- if (item.IsDir() || realOutStream || testMode)
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
- }
- continue;
- }
- RINOK(res);
- }
-
- if (item.IsDir() || item.IgnoreItem())
- {
- // if (!testMode)
- {
- RINOK(extractCallback->PrepareOperation(askMode));
- realOutStream.Release();
- RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
- }
- continue;
- }
-
- currentItemUnPacked = item.UnPackSize;
- currentItemPacked = item.PackSize;
-
- if (!testMode && (!realOutStream))
- continue;
-
- RINOK(extractCallback->PrepareOperation(askMode));
-
- Int32 res;
- RINOK(myDecoder.Decode(
- EXTERNAL_CODECS_VARS
- m_Archive, item, realOutStream, extractCallback,
- progress, _numThreads, res));
- realOutStream.Release();
-
- RINOK(extractCallback->SetOperationResult(res))
- }
- return S_OK;
- COM_TRY_END
-}
-
-IMPL_ISetCompressCodecsInfo
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHandler.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHandler.h
deleted file mode 100644
index 1a3a441a8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHandler.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Zip/Handler.h
-
-#ifndef __ZIP_HANDLER_H
-#define __ZIP_HANDLER_H
-
-#include "Common/DynamicBuffer.h"
-#include "../../ICoder.h"
-#include "../IArchive.h"
-
-#include "../../Common/CreateCoder.h"
-
-#include "ZipIn.h"
-#include "ZipCompressionMode.h"
-
-#ifdef COMPRESS_MT
-#include "../../../Windows/System.h"
-#endif
-
-namespace NArchive {
-namespace NZip {
-
-class CHandler:
- public IInArchive,
- public IOutArchive,
- public ISetProperties,
- PUBLIC_ISetCompressCodecsInfo
- public CMyUnknownImp
-{
-public:
- MY_QUERYINTERFACE_BEGIN2(IInArchive)
- MY_QUERYINTERFACE_ENTRY(IOutArchive)
- MY_QUERYINTERFACE_ENTRY(ISetProperties)
- QUERY_ENTRY_ISetCompressCodecsInfo
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
- INTERFACE_IInArchive(;)
- INTERFACE_IOutArchive(;)
-
- STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties);
-
- DECL_ISetCompressCodecsInfo
-
- CHandler();
-private:
- CObjectVector<CItemEx> m_Items;
- CInArchive m_Archive;
-
- int m_Level;
- int m_MainMethod;
- UInt32 m_DicSize;
- UInt32 m_Algo;
- UInt32 m_NumPasses;
- UInt32 m_NumFastBytes;
- UInt32 m_NumMatchFinderCycles;
- bool m_NumMatchFinderCyclesDefined;
-
- bool m_ForceAesMode;
- bool m_IsAesMode;
- Byte m_AesKeyMode;
-
- bool m_WriteNtfsTimeExtra;
- bool m_ForseLocal;
- bool m_ForseUtf8;
-
- #ifdef COMPRESS_MT
- UInt32 _numThreads;
- #endif
-
- DECL_EXTERNAL_CODECS_VARS
-
- void InitMethodProperties()
- {
- m_Level = -1;
- m_MainMethod = -1;
- m_Algo =
- m_DicSize =
- m_NumPasses =
- m_NumFastBytes =
- m_NumMatchFinderCycles = 0xFFFFFFFF;
- m_NumMatchFinderCyclesDefined = false;
- m_ForceAesMode = false;
- m_IsAesMode = false;
- m_AesKeyMode = 3; // aes-256
- m_WriteNtfsTimeExtra = false;
- m_ForseLocal = false;
- m_ForseUtf8 = false;
- #ifdef COMPRESS_MT
- _numThreads = NWindows::NSystem::GetNumberOfProcessors();;
- #endif
- }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp
deleted file mode 100644
index 80d3572d0..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp
+++ /dev/null
@@ -1,508 +0,0 @@
-// ZipHandlerOut.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/StringConvert.h"
-#include "Common/StringToInt.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/Time.h"
-
-#include "../../IPassword.h"
-
-#include "../../Common/OutBuffer.h"
-
-#include "../../Crypto/WzAes.h"
-
-#include "../Common/ItemNameUtils.h"
-#include "../Common/ParseProperties.h"
-
-#include "ZipHandler.h"
-#include "ZipUpdate.h"
-
-using namespace NWindows;
-using namespace NCOM;
-using namespace NTime;
-
-namespace NArchive {
-namespace NZip {
-
-static const UInt32 kLzAlgoX1 = 0;
-static const UInt32 kLzAlgoX5 = 1;
-
-static const UInt32 kDeflateNumPassesX1 = 1;
-static const UInt32 kDeflateNumPassesX7 = 3;
-static const UInt32 kDeflateNumPassesX9 = 10;
-
-static const UInt32 kDeflateNumFastBytesX1 = 32;
-static const UInt32 kDeflateNumFastBytesX7 = 64;
-static const UInt32 kDeflateNumFastBytesX9 = 128;
-
-static const wchar_t *kLzmaMatchFinderX1 = L"HC4";
-static const wchar_t *kLzmaMatchFinderX5 = L"BT4";
-
-static const UInt32 kLzmaNumFastBytesX1 = 32;
-static const UInt32 kLzmaNumFastBytesX7 = 64;
-
-static const UInt32 kLzmaDicSizeX1 = 1 << 16;
-static const UInt32 kLzmaDicSizeX3 = 1 << 20;
-static const UInt32 kLzmaDicSizeX5 = 1 << 24;
-static const UInt32 kLzmaDicSizeX7 = 1 << 25;
-static const UInt32 kLzmaDicSizeX9 = 1 << 26;
-
-static const UInt32 kBZip2NumPassesX1 = 1;
-static const UInt32 kBZip2NumPassesX7 = 2;
-static const UInt32 kBZip2NumPassesX9 = 7;
-
-static const UInt32 kBZip2DicSizeX1 = 100000;
-static const UInt32 kBZip2DicSizeX3 = 500000;
-static const UInt32 kBZip2DicSizeX5 = 900000;
-
-STDMETHODIMP CHandler::GetFileTimeType(UInt32 *timeType)
-{
- *timeType = NFileTimeType::kDOS;
- return S_OK;
-}
-
-static bool IsAsciiString(const UString &s)
-{
- for (int i = 0; i < s.Length(); i++)
- {
- wchar_t c = s[i];
- if (c < 0x20 || c > 0x7F)
- return false;
- }
- return true;
-}
-
-#define COM_TRY_BEGIN2 try {
-#define COM_TRY_END2 } \
-catch(const CSystemException &e) { return e.ErrorCode; } \
-catch(...) { return E_OUTOFMEMORY; }
-
-static HRESULT GetTime(IArchiveUpdateCallback *callback, int index, PROPID propID, FILETIME &filetime)
-{
- filetime.dwHighDateTime = filetime.dwLowDateTime = 0;
- NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(index, propID, &prop));
- if (prop.vt == VT_FILETIME)
- filetime = prop.filetime;
- else if (prop.vt != VT_EMPTY)
- return E_INVALIDARG;
- return S_OK;
-}
-
-STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems,
- IArchiveUpdateCallback *callback)
-{
- COM_TRY_BEGIN2
- CObjectVector<CUpdateItem> updateItems;
- bool thereAreAesUpdates = false;
- for (UInt32 i = 0; i < numItems; i++)
- {
- CUpdateItem ui;
- Int32 newData;
- Int32 newProperties;
- UInt32 indexInArchive;
- if (!callback)
- return E_FAIL;
- RINOK(callback->GetUpdateItemInfo(i, &newData, &newProperties, &indexInArchive));
- ui.NewProperties = IntToBool(newProperties);
- ui.NewData = IntToBool(newData);
- ui.IndexInArchive = indexInArchive;
- ui.IndexInClient = i;
- bool existInArchive = (indexInArchive != UInt32(-1));
- if (existInArchive && newData)
- if (m_Items[indexInArchive].IsAesEncrypted())
- thereAreAesUpdates = true;
-
- if (IntToBool(newProperties))
- {
- UString name;
- {
- NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(i, kpidAttrib, &prop));
- if (prop.vt == VT_EMPTY)
- ui.Attributes = 0;
- else if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- else
- ui.Attributes = prop.ulVal;
- }
-
- {
- NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(i, kpidPath, &prop));
- if (prop.vt == VT_EMPTY)
- name.Empty();
- else if (prop.vt != VT_BSTR)
- return E_INVALIDARG;
- else
- name = prop.bstrVal;
- }
- {
- NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(i, kpidIsDir, &prop));
- if (prop.vt == VT_EMPTY)
- ui.IsDir = false;
- else if (prop.vt != VT_BOOL)
- return E_INVALIDARG;
- else
- ui.IsDir = (prop.boolVal != VARIANT_FALSE);
- }
-
- {
- CPropVariant prop;
- RINOK(callback->GetProperty(i, kpidTimeType, &prop));
- if (prop.vt == VT_UI4)
- ui.NtfsTimeIsDefined = (prop.ulVal == NFileTimeType::kWindows);
- else
- ui.NtfsTimeIsDefined = m_WriteNtfsTimeExtra;
- }
- RINOK(GetTime(callback, i, kpidMTime, ui.NtfsMTime));
- RINOK(GetTime(callback, i, kpidATime, ui.NtfsATime));
- RINOK(GetTime(callback, i, kpidCTime, ui.NtfsCTime));
-
- {
- FILETIME localFileTime = { 0, 0 };
- if (ui.NtfsMTime.dwHighDateTime != 0 ||
- ui.NtfsMTime.dwLowDateTime != 0)
- if (!FileTimeToLocalFileTime(&ui.NtfsMTime, &localFileTime))
- return E_INVALIDARG;
- FileTimeToDosTime(localFileTime, ui.Time);
- }
-
- name = NItemName::MakeLegalName(name);
- bool needSlash = ui.IsDir;
- const wchar_t kSlash = L'/';
- if (!name.IsEmpty())
- {
- if (name[name.Length() - 1] == kSlash)
- {
- if (!ui.IsDir)
- return E_INVALIDARG;
- needSlash = false;
- }
- }
- if (needSlash)
- name += kSlash;
-
- bool tryUtf8 = true;
- if (m_ForseLocal || !m_ForseUtf8)
- {
-//#ifdef _WIN32
-// bool defaultCharWasUsed;
-// ui.Name = UnicodeStringToMultiByte(name, CP_OEMCP, '_', defaultCharWasUsed);
-// tryUtf8 = (!m_ForseLocal && (defaultCharWasUsed ||
-// MultiByteToUnicodeString(ui.Name, CP_OEMCP) != name));
-//#else
- // FIXME
- ui.Name = UnicodeStringToMultiByte(name, CP_OEMCP);
- tryUtf8 = (!m_ForseLocal);
-//#endif
- }
-
- if (tryUtf8)
- {
- int i;
- for (i = 0; i < name.Length() && (unsigned)name[i] < 0x80; i++);
- ui.IsUtf8 = (i != name.Length());
- if (!ConvertUnicodeToUTF8(name, ui.Name))
- return E_INVALIDARG;
- }
-
- if (ui.Name.Length() >= (1 << 16))
- return E_INVALIDARG;
-
- ui.IndexInClient = i;
- /*
- if (existInArchive)
- {
- const CItemEx &itemInfo = m_Items[indexInArchive];
- // ui.Commented = itemInfo.IsCommented();
- ui.Commented = false;
- if (ui.Commented)
- {
- ui.CommentRange.Position = itemInfo.GetCommentPosition();
- ui.CommentRange.Size = itemInfo.CommentSize;
- }
- }
- else
- ui.Commented = false;
- */
- }
- if (IntToBool(newData))
- {
- UInt64 size;
- {
- NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(i, kpidSize, &prop));
- if (prop.vt != VT_UI8)
- return E_INVALIDARG;
- size = prop.uhVal.QuadPart;
- }
- ui.Size = size;
- }
- updateItems.Add(ui);
- }
-
- CMyComPtr<ICryptoGetTextPassword2> getTextPassword;
- {
- CMyComPtr<IArchiveUpdateCallback> udateCallBack2(callback);
- udateCallBack2.QueryInterface(IID_ICryptoGetTextPassword2, &getTextPassword);
- }
- CCompressionMethodMode options;
-
- if (getTextPassword)
- {
- CMyComBSTR password;
- Int32 passwordIsDefined;
- RINOK(getTextPassword->CryptoGetTextPassword2(&passwordIsDefined, &password));
- options.PasswordIsDefined = IntToBool(passwordIsDefined);
- if (options.PasswordIsDefined)
- {
- options.IsAesMode = (m_ForceAesMode ? m_IsAesMode : thereAreAesUpdates);
- options.AesKeyMode = m_AesKeyMode;
-
- if (!IsAsciiString((const wchar_t *)password))
- return E_INVALIDARG;
- if (options.IsAesMode)
- {
- if (static_cast< unsigned int >( options.Password.Length() ) > NCrypto::NWzAes::kPasswordSizeMax)
- return E_INVALIDARG;
- }
- options.Password = UnicodeStringToMultiByte((const wchar_t *)password, CP_OEMCP);
- }
- }
- else
- options.PasswordIsDefined = false;
-
- int level = m_Level;
- if (level < 0)
- level = 5;
-
- Byte mainMethod;
- if (m_MainMethod < 0)
- mainMethod = (Byte)(((level == 0) ?
- NFileHeader::NCompressionMethod::kStored :
- NFileHeader::NCompressionMethod::kDeflated));
- else
- mainMethod = (Byte)m_MainMethod;
- options.MethodSequence.Add(mainMethod);
- if (mainMethod != NFileHeader::NCompressionMethod::kStored)
- options.MethodSequence.Add(NFileHeader::NCompressionMethod::kStored);
- bool isDeflate = (mainMethod == NFileHeader::NCompressionMethod::kDeflated) ||
- (mainMethod == NFileHeader::NCompressionMethod::kDeflated64);
- bool isLZMA = (mainMethod == NFileHeader::NCompressionMethod::kLZMA);
- bool isLz = (isLZMA || isDeflate);
- bool isBZip2 = (mainMethod == NFileHeader::NCompressionMethod::kBZip2);
- options.NumPasses = m_NumPasses;
- options.DicSize = m_DicSize;
- options.NumFastBytes = m_NumFastBytes;
- options.NumMatchFinderCycles = m_NumMatchFinderCycles;
- options.NumMatchFinderCyclesDefined = m_NumMatchFinderCyclesDefined;
- options.Algo = m_Algo;
- #ifdef COMPRESS_MT
- options.NumThreads = _numThreads;
- #endif
- if (isLz)
- {
- if (isDeflate)
- {
- if (options.NumPasses == 0xFFFFFFFF)
- options.NumPasses = (level >= 9 ? kDeflateNumPassesX9 :
- (level >= 7 ? kDeflateNumPassesX7 :
- kDeflateNumPassesX1));
- if (options.NumFastBytes == 0xFFFFFFFF)
- options.NumFastBytes = (level >= 9 ? kDeflateNumFastBytesX9 :
- (level >= 7 ? kDeflateNumFastBytesX7 :
- kDeflateNumFastBytesX1));
- }
- else if (isLZMA)
- {
- if (options.DicSize == 0xFFFFFFFF)
- options.DicSize =
- (level >= 9 ? kLzmaDicSizeX9 :
- (level >= 7 ? kLzmaDicSizeX7 :
- (level >= 5 ? kLzmaDicSizeX5 :
- (level >= 3 ? kLzmaDicSizeX3 :
- kLzmaDicSizeX1))));
-
- if (options.NumFastBytes == 0xFFFFFFFF)
- options.NumFastBytes = (level >= 7 ? kLzmaNumFastBytesX7 :
- kLzmaNumFastBytesX1);
-
- options.MatchFinder =
- (level >= 5 ? kLzmaMatchFinderX5 :
- kLzmaMatchFinderX1);
- }
-
- if (options.Algo == 0xFFFFFFFF)
- options.Algo = (level >= 5 ? kLzAlgoX5 :
- kLzAlgoX1);
- }
- if (isBZip2)
- {
- if (options.NumPasses == 0xFFFFFFFF)
- options.NumPasses = (level >= 9 ? kBZip2NumPassesX9 :
- (level >= 7 ? kBZip2NumPassesX7 :
- kBZip2NumPassesX1));
- if (options.DicSize == 0xFFFFFFFF)
- options.DicSize = (level >= 5 ? kBZip2DicSizeX5 :
- (level >= 3 ? kBZip2DicSizeX3 :
- kBZip2DicSizeX1));
- }
-
- return Update(
- EXTERNAL_CODECS_VARS
- m_Items, updateItems, outStream,
- m_Archive.IsOpen() ? &m_Archive : NULL, &options, callback);
- COM_TRY_END2
-}
-
-STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties)
-{
- #ifdef COMPRESS_MT
- const UInt32 numProcessors = NSystem::GetNumberOfProcessors();
- _numThreads = numProcessors;
- #endif
- InitMethodProperties();
- for (int i = 0; i < numProperties; i++)
- {
- UString name = UString(names[i]);
- name.MakeUpper();
- if (name.IsEmpty())
- return E_INVALIDARG;
-
- const PROPVARIANT &prop = values[i];
-
- if (name[0] == L'X')
- {
- UInt32 level = 9;
- RINOK(ParsePropValue(name.Mid(1), prop, level));
- m_Level = level;
- continue;
- }
- else if (name == L"M")
- {
- if (prop.vt == VT_BSTR)
- {
- UString m = prop.bstrVal;
- m.MakeUpper();
- if (m == L"COPY") m_MainMethod = NFileHeader::NCompressionMethod::kStored;
- else if (m == L"DEFLATE") m_MainMethod = NFileHeader::NCompressionMethod::kDeflated;
- else if (m == L"DEFLATE64") m_MainMethod = NFileHeader::NCompressionMethod::kDeflated64;
- else if (m == L"BZIP2") m_MainMethod = NFileHeader::NCompressionMethod::kBZip2;
- else if (m == L"LZMA") m_MainMethod = NFileHeader::NCompressionMethod::kLZMA;
- else return E_INVALIDARG;
- }
- else if (prop.vt == VT_UI4)
- {
- switch(prop.ulVal)
- {
- case NFileHeader::NCompressionMethod::kStored:
- case NFileHeader::NCompressionMethod::kDeflated:
- case NFileHeader::NCompressionMethod::kDeflated64:
- case NFileHeader::NCompressionMethod::kBZip2:
- case NFileHeader::NCompressionMethod::kLZMA:
- m_MainMethod = (Byte)prop.ulVal;
- break;
- default:
- return E_INVALIDARG;
- }
- }
- else
- return E_INVALIDARG;
- }
- else if (name.Left(2) == L"EM")
- {
- if (prop.vt == VT_BSTR)
- {
- UString valueString = prop.bstrVal;
- valueString.MakeUpper();
- if (valueString.Left(3) == L"AES")
- {
- valueString = valueString.Mid(3);
- if (valueString == L"128")
- m_AesKeyMode = 1;
- else if (valueString == L"192")
- m_AesKeyMode = 2;
- else if (valueString == L"256" || valueString.IsEmpty())
- m_AesKeyMode = 3;
- else
- return E_INVALIDARG;
- m_IsAesMode = true;
- m_ForceAesMode = true;
- }
- else if (valueString == L"ZIPCRYPTO")
- {
- m_IsAesMode = false;
- m_ForceAesMode = true;
- }
- else
- return E_INVALIDARG;
- }
- else
- return E_INVALIDARG;
- }
- else if (name[0] == L'D')
- {
- UInt32 dicSize = kBZip2DicSizeX5;
- RINOK(ParsePropDictionaryValue(name.Mid(1), prop, dicSize));
- m_DicSize = dicSize;
- }
- else if (name.Left(4) == L"PASS")
- {
- UInt32 num = kDeflateNumPassesX9;
- RINOK(ParsePropValue(name.Mid(4), prop, num));
- m_NumPasses = num;
- }
- else if (name.Left(2) == L"FB")
- {
- UInt32 num = kDeflateNumFastBytesX9;
- RINOK(ParsePropValue(name.Mid(2), prop, num));
- m_NumFastBytes = num;
- }
- else if (name.Left(2) == L"MC")
- {
- UInt32 num = 0xFFFFFFFF;
- RINOK(ParsePropValue(name.Mid(2), prop, num));
- m_NumMatchFinderCycles = num;
- m_NumMatchFinderCyclesDefined = true;
- }
- else if (name.Left(2) == L"MT")
- {
- #ifdef COMPRESS_MT
- RINOK(ParseMtProp(name.Mid(2), prop, numProcessors, _numThreads));
- #endif
- }
- else if (name.Left(1) == L"A")
- {
- UInt32 num = kLzAlgoX5;
- RINOK(ParsePropValue(name.Mid(1), prop, num));
- m_Algo = num;
- }
- else if (name.CompareNoCase(L"TC") == 0)
- {
- RINOK(SetBoolProperty(m_WriteNtfsTimeExtra, prop));
- }
- else if (name.CompareNoCase(L"CL") == 0)
- {
- RINOK(SetBoolProperty(m_ForseLocal, prop));
- if (m_ForseLocal)
- m_ForseUtf8 = false;
- }
- else if (name.CompareNoCase(L"CU") == 0)
- {
- RINOK(SetBoolProperty(m_ForseUtf8, prop));
- if (m_ForseUtf8)
- m_ForseLocal = false;
- }
- else
- return E_INVALIDARG;
- }
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHeader.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHeader.cpp
deleted file mode 100644
index 582187b51..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHeader.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// Archive/Zip/Header.h
-
-#include "StdAfx.h"
-
-#include "ZipHeader.h"
-
-namespace NArchive {
-namespace NZip {
-
-namespace NSignature
-{
- UInt32 kLocalFileHeader = 0x04034B50 + 1;
- UInt32 kDataDescriptor = 0x08074B50 + 1;
- UInt32 kCentralFileHeader = 0x02014B50 + 1;
- UInt32 kEndOfCentralDir = 0x06054B50 + 1;
- UInt32 kZip64EndOfCentralDir = 0x06064B50 + 1;
- UInt32 kZip64EndOfCentralDirLocator = 0x07064B50 + 1;
-
- class CMarkersInitializer
- {
- public:
- CMarkersInitializer()
- {
- kLocalFileHeader--;
- kDataDescriptor--;
- kCentralFileHeader--;
- kEndOfCentralDir--;
- kZip64EndOfCentralDir--;
- kZip64EndOfCentralDirLocator--;
- }
- };
- static CMarkersInitializer g_MarkerInitializer;
-}
-
-}}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHeader.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHeader.h
deleted file mode 100644
index 4839f554d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipHeader.h
+++ /dev/null
@@ -1,276 +0,0 @@
-// Archive/Zip/Header.h
-
-#ifndef __ARCHIVE_ZIP_HEADER_H
-#define __ARCHIVE_ZIP_HEADER_H
-
-#include "Common/Types.h"
-
-namespace NArchive {
-namespace NZip {
-
-namespace NSignature
-{
- extern UInt32 kLocalFileHeader;
- extern UInt32 kDataDescriptor;
- extern UInt32 kCentralFileHeader;
- extern UInt32 kEndOfCentralDir;
- extern UInt32 kZip64EndOfCentralDir;
- extern UInt32 kZip64EndOfCentralDirLocator;
-
- static const UInt32 kMarkerSize = 4;
-}
-
-const UInt32 kEcdSize = 22;
-const UInt32 kZip64EcdSize = 44;
-const UInt32 kZip64EcdLocatorSize = 20;
-/*
-struct CEndOfCentralDirectoryRecord
-{
- UInt16 ThisDiskNumber;
- UInt16 StartCentralDirectoryDiskNumber;
- UInt16 NumEntriesInCentaralDirectoryOnThisDisk;
- UInt16 NumEntriesInCentaralDirectory;
- UInt32 CentralDirectorySize;
- UInt32 CentralDirectoryStartOffset;
- UInt16 CommentSize;
-};
-
-struct CEndOfCentralDirectoryRecordFull
-{
- UInt32 Signature;
- CEndOfCentralDirectoryRecord Header;
-};
-*/
-
-namespace NFileHeader
-{
- /*
- struct CVersion
- {
- Byte Version;
- Byte HostOS;
- };
- */
-
- namespace NCompressionMethod
- {
- enum EType
- {
- kStored = 0,
- kShrunk = 1,
- kReduced1 = 2,
- kReduced2 = 3,
- kReduced3 = 4,
- kReduced4 = 5,
- kImploded = 6,
- kReservedTokenizing = 7, // reserved for tokenizing
- kDeflated = 8,
- kDeflated64 = 9,
- kPKImploding = 10,
-
- kBZip2 = 12,
- kLZMA = 14,
- kTerse = 18,
- kLz77 = 19,
- kJpeg = 0x60,
- kWavPack = 0x61,
- kPPMd = 0x62,
- kWzAES = 0x63
- };
- const int kNumCompressionMethods = 11;
- const Byte kMadeByProgramVersion = 20;
-
- const Byte kDeflateExtractVersion = 20;
- const Byte kStoreExtractVersion = 10;
-
- const Byte kSupportedVersion = 20;
- }
-
- namespace NExtraID
- {
- enum
- {
- kZip64 = 0x01,
- kNTFS = 0x0A,
- kStrongEncrypt = 0x17,
- kUnixTime = 0x5455,
- kWzAES = 0x9901
- };
- }
-
- namespace NNtfsExtra
- {
- const UInt16 kTagTime = 1;
- enum
- {
- kMTime = 0,
- kATime,
- kCTime
- };
- }
-
- namespace NUnixTime
- {
- enum
- {
- kMTime = 0,
- kATime,
- kCTime
- };
- }
-
- const UInt32 kLocalBlockSize = 26;
- /*
- struct CLocalBlock
- {
- CVersion ExtractVersion;
-
- UInt16 Flags;
- UInt16 CompressionMethod;
- UInt32 Time;
- UInt32 FileCRC;
- UInt32 PackSize;
- UInt32 UnPackSize;
- UInt16 NameSize;
- UInt16 ExtraSize;
- };
- */
-
- const UInt32 kDataDescriptorSize = 16;
- // const UInt32 kDataDescriptor64Size = 16 + 8;
- /*
- struct CDataDescriptor
- {
- UInt32 Signature;
- UInt32 FileCRC;
- UInt32 PackSize;
- UInt32 UnPackSize;
- };
-
- struct CLocalBlockFull
- {
- UInt32 Signature;
- CLocalBlock Header;
- };
- */
-
- const UInt32 kCentralBlockSize = 42;
- /*
- struct CBlock
- {
- CVersion MadeByVersion;
- CVersion ExtractVersion;
- UInt16 Flags;
- UInt16 CompressionMethod;
- UInt32 Time;
- UInt32 FileCRC;
- UInt32 PackSize;
- UInt32 UnPackSize;
- UInt16 NameSize;
- UInt16 ExtraSize;
- UInt16 CommentSize;
- UInt16 DiskNumberStart;
- UInt16 InternalAttributes;
- UInt32 ExternalAttributes;
- UInt32 LocalHeaderOffset;
- };
-
- struct CBlockFull
- {
- UInt32 Signature;
- CBlock Header;
- };
- */
-
- namespace NFlags
- {
- const int kEncrypted = 1 << 0;
- const int kLzmaEOS = 1 << 1;
- const int kDescriptorUsedMask = 1 << 3;
- const int kStrongEncrypted = 1 << 6;
- const int kUtf8 = 1 << 11;
-
- const int kImplodeDictionarySizeMask = 1 << 1;
- const int kImplodeLiteralsOnMask = 1 << 2;
-
- const int kDeflateTypeBitStart = 1;
- const int kNumDeflateTypeBits = 2;
- const int kNumDeflateTypes = (1 << kNumDeflateTypeBits);
- const int kDeflateTypeMask = (1 << kNumDeflateTypeBits) - 1;
- }
-
- namespace NHostOS
- {
- enum EEnum
- {
- kFAT = 0,
- kAMIGA = 1,
- kVMS = 2, // VAX/VMS
- kUnix = 3,
- kVM_CMS = 4,
- kAtari = 5, // what if it's a minix filesystem? [cjh]
- kHPFS = 6, // filesystem used by OS/2 (and NT 3.x)
- kMac = 7,
- kZ_System = 8,
- kCPM = 9,
- kTOPS20 = 10, // pkzip 2.50 NTFS
- kNTFS = 11, // filesystem used by Windows NT
- kQDOS = 12, // SMS/QDOS
- kAcorn = 13, // Archimedes Acorn RISC OS
- kVFAT = 14, // filesystem used by Windows 95, NT
- kMVS = 15,
- kBeOS = 16, // hybrid POSIX/database filesystem
- kTandem = 17,
- kOS400 = 18,
- kOSX = 19
- };
- }
- namespace NUnixAttribute
- {
- const UInt32 kIFMT = 0170000; /* Unix file type mask */
-
- const UInt32 kIFDIR = 0040000; /* Unix directory */
- const UInt32 kIFREG = 0100000; /* Unix regular file */
- const UInt32 kIFSOCK = 0140000; /* Unix socket (BSD, not SysV or Amiga) */
- const UInt32 kIFLNK = 0120000; /* Unix symbolic link (not SysV, Amiga) */
- const UInt32 kIFBLK = 0060000; /* Unix block special (not Amiga) */
- const UInt32 kIFCHR = 0020000; /* Unix character special (not Amiga) */
- const UInt32 kIFIFO = 0010000; /* Unix fifo (BCC, not MSC or Amiga) */
-
- const UInt32 kISUID = 04000; /* Unix set user id on execution */
- const UInt32 kISGID = 02000; /* Unix set group id on execution */
- const UInt32 kISVTX = 01000; /* Unix directory permissions control */
- const UInt32 kENFMT = kISGID; /* Unix record locking enforcement flag */
- const UInt32 kIRWXU = 00700; /* Unix read, write, execute: owner */
- const UInt32 kIRUSR = 00400; /* Unix read permission: owner */
- const UInt32 kIWUSR = 00200; /* Unix write permission: owner */
- const UInt32 kIXUSR = 00100; /* Unix execute permission: owner */
- const UInt32 kIRWXG = 00070; /* Unix read, write, execute: group */
- const UInt32 kIRGRP = 00040; /* Unix read permission: group */
- const UInt32 kIWGRP = 00020; /* Unix write permission: group */
- const UInt32 kIXGRP = 00010; /* Unix execute permission: group */
- const UInt32 kIRWXO = 00007; /* Unix read, write, execute: other */
- const UInt32 kIROTH = 00004; /* Unix read permission: other */
- const UInt32 kIWOTH = 00002; /* Unix write permission: other */
- const UInt32 kIXOTH = 00001; /* Unix execute permission: other */
- }
-
- namespace NAmigaAttribute
- {
- const UInt32 kIFMT = 06000; /* Amiga file type mask */
- const UInt32 kIFDIR = 04000; /* Amiga directory */
- const UInt32 kIFREG = 02000; /* Amiga regular file */
- const UInt32 kIHIDDEN = 00200; /* to be supported in AmigaDOS 3.x */
- const UInt32 kISCRIPT = 00100; /* executable script (text command file) */
- const UInt32 kIPURE = 00040; /* allow loading into resident memory */
- const UInt32 kIARCHIVE = 00020; /* not modified since bit was last set */
- const UInt32 kIREAD = 00010; /* can be opened for reading */
- const UInt32 kIWRITE = 00004; /* can be opened for writing */
- const UInt32 kIEXECUTE = 00002; /* executable image, a loadable runfile */
- const UInt32 kIDELETE = 00001; /* can be deleted */
- }
-}
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipIn.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipIn.cpp
deleted file mode 100644
index f6749b972..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipIn.cpp
+++ /dev/null
@@ -1,851 +0,0 @@
-// Archive/ZipIn.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/CpuArch.h"
-
-#include "Common/DynamicBuffer.h"
-
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/StreamUtils.h"
-
-#include "ZipIn.h"
-
-#define Get16(p) GetUi16(p)
-#define Get32(p) GetUi32(p)
-#define Get64(p) GetUi64(p)
-
-namespace NArchive {
-namespace NZip {
-
-HRESULT CInArchive::Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit)
-{
- _inBufMode = false;
- Close();
- RINOK(stream->Seek(0, STREAM_SEEK_CUR, &m_StreamStartPosition));
- m_Position = m_StreamStartPosition;
- RINOK(FindAndReadMarker(stream, searchHeaderSizeLimit));
- RINOK(stream->Seek(m_Position, STREAM_SEEK_SET, NULL));
- m_Stream = stream;
- return S_OK;
-}
-
-void CInArchive::Close()
-{
- _inBuffer.ReleaseStream();
- m_Stream.Release();
-}
-
-HRESULT CInArchive::Seek(UInt64 offset)
-{
- return m_Stream->Seek(offset, STREAM_SEEK_SET, NULL);
-}
-
-//////////////////////////////////////
-// Markers
-
-static inline bool TestMarkerCandidate(const Byte *p, UInt32 &value)
-{
- value = Get32(p);
- return
- (value == NSignature::kLocalFileHeader) ||
- (value == NSignature::kEndOfCentralDir);
-}
-
-static const UInt32 kNumMarkerAddtionalBytes = 2;
-static inline bool TestMarkerCandidate2(const Byte *p, UInt32 &value)
-{
- value = Get32(p);
- if (value == NSignature::kEndOfCentralDir)
- return (Get16(p + 4) == 0);
- return (value == NSignature::kLocalFileHeader && p[4] < 128);
-}
-
-HRESULT CInArchive::FindAndReadMarker(IInStream *stream, const UInt64 *searchHeaderSizeLimit)
-{
- m_ArchiveInfo.Clear();
- m_Position = m_StreamStartPosition;
-
- Byte marker[NSignature::kMarkerSize];
- RINOK(ReadStream_FALSE(stream, marker, NSignature::kMarkerSize));
- m_Position += NSignature::kMarkerSize;
- if (TestMarkerCandidate(marker, m_Signature))
- return S_OK;
-
- CByteDynamicBuffer dynamicBuffer;
- const UInt32 kSearchMarkerBufferSize = 0x10000;
- dynamicBuffer.EnsureCapacity(kSearchMarkerBufferSize);
- Byte *buffer = dynamicBuffer;
- UInt32 numBytesPrev = NSignature::kMarkerSize - 1;
- memcpy(buffer, marker + 1, numBytesPrev);
- UInt64 curTestPos = m_StreamStartPosition + 1;
- for (;;)
- {
- if (searchHeaderSizeLimit != NULL)
- if (curTestPos - m_StreamStartPosition > *searchHeaderSizeLimit)
- break;
- size_t numReadBytes = kSearchMarkerBufferSize - numBytesPrev;
- RINOK(ReadStream(stream, buffer + numBytesPrev, &numReadBytes));
- m_Position += numReadBytes;
- UInt32 numBytesInBuffer = numBytesPrev + (UInt32)numReadBytes;
- const UInt32 kMarker2Size = NSignature::kMarkerSize + kNumMarkerAddtionalBytes;
- if (numBytesInBuffer < kMarker2Size)
- break;
- UInt32 numTests = numBytesInBuffer - kMarker2Size + 1;
- for (UInt32 pos = 0; pos < numTests; pos++)
- {
- if (buffer[pos] != 0x50)
- continue;
- if (TestMarkerCandidate2(buffer + pos, m_Signature))
- {
- curTestPos += pos;
- m_ArchiveInfo.StartPosition = curTestPos;
- m_Position = curTestPos + NSignature::kMarkerSize;
- return S_OK;
- }
- }
- curTestPos += numTests;
- numBytesPrev = numBytesInBuffer - numTests;
- memmove(buffer, buffer + numTests, numBytesPrev);
- }
- return S_FALSE;
-}
-
-HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 *processedSize)
-{
- size_t realProcessedSize = size;
- HRESULT result = S_OK;
- if (_inBufMode)
- {
- try { realProcessedSize = _inBuffer.ReadBytes((Byte *)data, size); }
- catch (const CInBufferException &e) { return e.ErrorCode; }
- }
- else
- result = ReadStream(m_Stream, data, &realProcessedSize);
- if (processedSize != NULL)
- *processedSize = (UInt32)realProcessedSize;
- m_Position += realProcessedSize;
- return result;
-}
-
-void CInArchive::Skip(UInt64 num)
-{
- for (UInt64 i = 0; i < num; i++)
- ReadByte();
-}
-
-void CInArchive::IncreaseRealPosition(UInt64 addValue)
-{
- if (m_Stream->Seek(addValue, STREAM_SEEK_CUR, &m_Position) != S_OK)
- throw CInArchiveException(CInArchiveException::kSeekStreamError);
-}
-
-bool CInArchive::ReadBytesAndTestSize(void *data, UInt32 size)
-{
- UInt32 realProcessedSize;
- if (ReadBytes(data, size, &realProcessedSize) != S_OK)
- throw CInArchiveException(CInArchiveException::kReadStreamError);
- return (realProcessedSize == size);
-}
-
-void CInArchive::SafeReadBytes(void *data, UInt32 size)
-{
- if (!ReadBytesAndTestSize(data, size))
- throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive);
-}
-
-void CInArchive::ReadBuffer(CByteBuffer &buffer, UInt32 size)
-{
- buffer.SetCapacity(size);
- if (size > 0)
- SafeReadBytes(buffer, size);
-}
-
-Byte CInArchive::ReadByte()
-{
- Byte b;
- SafeReadBytes(&b, 1);
- return b;
-}
-
-UInt16 CInArchive::ReadUInt16()
-{
- Byte buf[2];
- SafeReadBytes(buf, 2);
- return Get16(buf);
-}
-
-UInt32 CInArchive::ReadUInt32()
-{
- Byte buf[4];
- SafeReadBytes(buf, 4);
- return Get32(buf);
-}
-
-UInt64 CInArchive::ReadUInt64()
-{
- Byte buf[8];
- SafeReadBytes(buf, 8);
- return Get64(buf);
-}
-
-bool CInArchive::ReadUInt32(UInt32 &value)
-{
- Byte buf[4];
- if (!ReadBytesAndTestSize(buf, 4))
- return false;
- value = Get32(buf);
- return true;
-}
-
-void CInArchive::ReadFileName(UInt32 nameSize, AString &dest)
-{
- if (nameSize == 0)
- dest.Empty();
- char *p = dest.GetBuffer((int)nameSize);
- SafeReadBytes(p, nameSize);
- p[nameSize] = 0;
- dest.ReleaseBuffer();
-}
-
-void CInArchive::GetArchiveInfo(CInArchiveInfo &archiveInfo) const
-{
- archiveInfo = m_ArchiveInfo;
-}
-
-void CInArchive::ReadExtra(UInt32 extraSize, CExtraBlock &extraBlock,
- UInt64 &unpackSize, UInt64 &packSize, UInt64 &localHeaderOffset, UInt32 &diskStartNumber)
-{
- extraBlock.Clear();
- UInt32 remain = extraSize;
- while(remain >= 4)
- {
- CExtraSubBlock subBlock;
- subBlock.ID = ReadUInt16();
- UInt32 dataSize = ReadUInt16();
- remain -= 4;
- if (dataSize > remain) // it's bug
- dataSize = remain;
- if (subBlock.ID == NFileHeader::NExtraID::kZip64)
- {
- if (unpackSize == 0xFFFFFFFF)
- {
- if (dataSize < 8)
- break;
- unpackSize = ReadUInt64();
- remain -= 8;
- dataSize -= 8;
- }
- if (packSize == 0xFFFFFFFF)
- {
- if (dataSize < 8)
- break;
- packSize = ReadUInt64();
- remain -= 8;
- dataSize -= 8;
- }
- if (localHeaderOffset == 0xFFFFFFFF)
- {
- if (dataSize < 8)
- break;
- localHeaderOffset = ReadUInt64();
- remain -= 8;
- dataSize -= 8;
- }
- if (diskStartNumber == 0xFFFF)
- {
- if (dataSize < 4)
- break;
- diskStartNumber = ReadUInt32();
- remain -= 4;
- dataSize -= 4;
- }
- for (UInt32 i = 0; i < dataSize; i++)
- ReadByte();
- }
- else
- {
- ReadBuffer(subBlock.Data, dataSize);
- extraBlock.SubBlocks.Add(subBlock);
- }
- remain -= dataSize;
- }
- Skip(remain);
-}
-
-HRESULT CInArchive::ReadLocalItem(CItemEx &item)
-{
- const int kBufSize = 26;
- Byte p[kBufSize];
- SafeReadBytes(p, kBufSize);
-
- item.ExtractVersion.Version = p[0];
- item.ExtractVersion.HostOS = p[1];
- item.Flags = Get16(p + 2);
- item.CompressionMethod = Get16(p + 4);
- item.Time = Get32(p + 6);
- item.FileCRC = Get32(p + 10);
- item.PackSize = Get32(p + 14);
- item.UnPackSize = Get32(p + 18);
- UInt32 fileNameSize = Get16(p + 22);
- item.LocalExtraSize = Get16(p + 24);
- ReadFileName(fileNameSize, item.Name);
- item.FileHeaderWithNameSize = 4 + NFileHeader::kLocalBlockSize + fileNameSize;
- if (item.LocalExtraSize > 0)
- {
- UInt64 localHeaderOffset = 0;
- UInt32 diskStartNumber = 0;
- ReadExtra(item.LocalExtraSize, item.LocalExtra, item.UnPackSize, item.PackSize,
- localHeaderOffset, diskStartNumber);
- }
- /*
- if (item.IsDir())
- item.UnPackSize = 0; // check It
- */
- return S_OK;
-}
-
-HRESULT CInArchive::ReadLocalItemAfterCdItem(CItemEx &item)
-{
- if (item.FromLocal)
- return S_OK;
- try
- {
- RINOK(Seek(m_ArchiveInfo.Base + item.LocalHeaderPosition));
- CItemEx localItem;
- if (ReadUInt32() != NSignature::kLocalFileHeader)
- return S_FALSE;
- RINOK(ReadLocalItem(localItem));
- if (item.Flags != localItem.Flags)
- {
- if (
- (item.CompressionMethod != NFileHeader::NCompressionMethod::kDeflated ||
- (item.Flags & 0x7FF9) != (localItem.Flags & 0x7FF9)) &&
- (item.CompressionMethod != NFileHeader::NCompressionMethod::kStored ||
- (item.Flags & 0x7FFF) != (localItem.Flags & 0x7FFF)) &&
- (item.CompressionMethod != NFileHeader::NCompressionMethod::kImploded ||
- (item.Flags & 0x7FFF) != (localItem.Flags & 0x7FFF))
- )
- return S_FALSE;
- }
-
- if (item.CompressionMethod != localItem.CompressionMethod ||
- // item.Time != localItem.Time ||
- (!localItem.HasDescriptor() &&
- (
- item.FileCRC != localItem.FileCRC ||
- item.PackSize != localItem.PackSize ||
- item.UnPackSize != localItem.UnPackSize
- )
- ) ||
- item.Name.Length() != localItem.Name.Length()
- )
- return S_FALSE;
- item.FileHeaderWithNameSize = localItem.FileHeaderWithNameSize;
- item.LocalExtraSize = localItem.LocalExtraSize;
- item.LocalExtra = localItem.LocalExtra;
- item.FromLocal = true;
- }
- catch(...) { return S_FALSE; }
- return S_OK;
-}
-
-HRESULT CInArchive::ReadLocalItemDescriptor(CItemEx &item)
-{
- if (item.HasDescriptor())
- {
- const int kBufferSize = (1 << 12);
- Byte buffer[kBufferSize];
-
- UInt32 numBytesInBuffer = 0;
- UInt32 packedSize = 0;
-
- bool descriptorWasFound = false;
- for (;;)
- {
- UInt32 processedSize;
- RINOK(ReadBytes(buffer + numBytesInBuffer, kBufferSize - numBytesInBuffer, &processedSize));
- numBytesInBuffer += processedSize;
- if (numBytesInBuffer < NFileHeader::kDataDescriptorSize)
- return S_FALSE;
- UInt32 i;
- for (i = 0; i <= numBytesInBuffer - NFileHeader::kDataDescriptorSize; i++)
- {
- // descriptorSignature field is Info-ZIP's extension
- // to Zip specification.
- UInt32 descriptorSignature = Get32(buffer + i);
-
- // !!!! It must be fixed for Zip64 archives
- UInt32 descriptorPackSize = Get32(buffer + i + 8);
- if (descriptorSignature== NSignature::kDataDescriptor && descriptorPackSize == packedSize + i)
- {
- descriptorWasFound = true;
- item.FileCRC = Get32(buffer + i + 4);
- item.PackSize = descriptorPackSize;
- item.UnPackSize = Get32(buffer + i + 12);
- IncreaseRealPosition(Int64(Int32(0 - (numBytesInBuffer - i - NFileHeader::kDataDescriptorSize))));
- break;
- }
- }
- if (descriptorWasFound)
- break;
- packedSize += i;
- int j;
- for (j = 0; i < numBytesInBuffer; i++, j++)
- buffer[j] = buffer[i];
- numBytesInBuffer = j;
- }
- }
- else
- IncreaseRealPosition(item.PackSize);
- return S_OK;
-}
-
-HRESULT CInArchive::ReadLocalItemAfterCdItemFull(CItemEx &item)
-{
- if (item.FromLocal)
- return S_OK;
- try
- {
- RINOK(ReadLocalItemAfterCdItem(item));
- if (item.HasDescriptor())
- {
- RINOK(Seek(m_ArchiveInfo.Base + item.GetDataPosition() + item.PackSize));
- if (ReadUInt32() != NSignature::kDataDescriptor)
- return S_FALSE;
- UInt32 crc = ReadUInt32();
- UInt64 packSize, unpackSize;
-
- /*
- if (IsZip64)
- {
- packSize = ReadUInt64();
- unpackSize = ReadUInt64();
- }
- else
- */
- {
- packSize = ReadUInt32();
- unpackSize = ReadUInt32();
- }
-
- if (crc != item.FileCRC || item.PackSize != packSize || item.UnPackSize != unpackSize)
- return S_FALSE;
- }
- }
- catch(...) { return S_FALSE; }
- return S_OK;
-}
-
-HRESULT CInArchive::ReadCdItem(CItemEx &item)
-{
- item.FromCentral = true;
- const int kBufSize = 42;
- Byte p[kBufSize];
- SafeReadBytes(p, kBufSize);
- item.MadeByVersion.Version = p[0];
- item.MadeByVersion.HostOS = p[1];
- item.ExtractVersion.Version = p[2];
- item.ExtractVersion.HostOS = p[3];
- item.Flags = Get16(p + 4);
- item.CompressionMethod = Get16(p + 6);
- item.Time = Get32(p + 8);
- item.FileCRC = Get32(p + 12);
- item.PackSize = Get32(p + 16);
- item.UnPackSize = Get32(p + 20);
- UInt16 headerNameSize = Get16(p + 24);
- UInt16 headerExtraSize = Get16(p + 26);
- UInt16 headerCommentSize = Get16(p + 28);
- UInt32 headerDiskNumberStart = Get16(p + 30);
- item.InternalAttributes = Get16(p + 32);
- item.ExternalAttributes = Get32(p + 34);
- item.LocalHeaderPosition = Get32(p + 38);
- ReadFileName(headerNameSize, item.Name);
-
- if (headerExtraSize > 0)
- {
- ReadExtra(headerExtraSize, item.CentralExtra, item.UnPackSize, item.PackSize,
- item.LocalHeaderPosition, headerDiskNumberStart);
- }
-
- if (headerDiskNumberStart != 0)
- throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported);
-
- // May be these strings must be deleted
- /*
- if (item.IsDir())
- item.UnPackSize = 0;
- */
-
- ReadBuffer(item.Comment, headerCommentSize);
- return S_OK;
-}
-
-HRESULT CInArchive::TryEcd64(UInt64 offset, CCdInfo &cdInfo)
-{
- RINOK(Seek(offset));
- const UInt32 kEcd64Size = 56;
- Byte buf[kEcd64Size];
- if (!ReadBytesAndTestSize(buf, kEcd64Size))
- return S_FALSE;
- if (Get32(buf) != NSignature::kZip64EndOfCentralDir)
- return S_FALSE;
- // cdInfo.NumEntries = Get64(buf + 24);
- cdInfo.Size = Get64(buf + 40);
- cdInfo.Offset = Get64(buf + 48);
- return S_OK;
-}
-
-HRESULT CInArchive::FindCd(CCdInfo &cdInfo)
-{
- UInt64 endPosition;
- RINOK(m_Stream->Seek(0, STREAM_SEEK_END, &endPosition));
- const UInt32 kBufSizeMax = (1 << 16) + kEcdSize + kZip64EcdLocatorSize;
- Byte buf[kBufSizeMax];
- UInt32 bufSize = (endPosition < kBufSizeMax) ? (UInt32)endPosition : kBufSizeMax;
- if (bufSize < kEcdSize)
- return S_FALSE;
- UInt64 startPosition = endPosition - bufSize;
- RINOK(m_Stream->Seek(startPosition, STREAM_SEEK_SET, &m_Position));
- if (m_Position != startPosition)
- return S_FALSE;
- if (!ReadBytesAndTestSize(buf, bufSize))
- return S_FALSE;
- for (int i = (int)(bufSize - kEcdSize); i >= 0; i--)
- {
- if (Get32(buf + i) == NSignature::kEndOfCentralDir)
- {
- if (i >= static_cast< int >( kZip64EcdLocatorSize ) )
- {
- const Byte *locator = buf + i - kZip64EcdLocatorSize;
- if (Get32(locator) == NSignature::kZip64EndOfCentralDirLocator)
- {
- UInt64 ecd64Offset = Get64(locator + 8);
- if (TryEcd64(ecd64Offset, cdInfo) == S_OK)
- return S_OK;
- if (TryEcd64(m_ArchiveInfo.StartPosition + ecd64Offset, cdInfo) == S_OK)
- {
- m_ArchiveInfo.Base = m_ArchiveInfo.StartPosition;
- return S_OK;
- }
- }
- }
- if (Get32(buf + i + 4) == 0)
- {
- // cdInfo.NumEntries = GetUInt16(buf + i + 10);
- cdInfo.Size = Get32(buf + i + 12);
- cdInfo.Offset = Get32(buf + i + 16);
- UInt64 curPos = endPosition - bufSize + i;
- UInt64 cdEnd = cdInfo.Size + cdInfo.Offset;
- if (curPos > cdEnd)
- m_ArchiveInfo.Base = curPos - cdEnd;
- return S_OK;
- }
- }
- }
- return S_FALSE;
-}
-
-HRESULT CInArchive::TryReadCd(CObjectVector<CItemEx> &items, UInt64 cdOffset, UInt64 cdSize, CProgressVirt *progress)
-{
- items.Clear();
- RINOK(m_Stream->Seek(cdOffset, STREAM_SEEK_SET, &m_Position));
- if (m_Position != cdOffset)
- return S_FALSE;
-
- if (!_inBuffer.Create(1 << 15))
- return E_OUTOFMEMORY;
- _inBuffer.SetStream(m_Stream);
- _inBuffer.Init();
- _inBufMode = true;
-
- while(m_Position - cdOffset < cdSize)
- {
- if (ReadUInt32() != NSignature::kCentralFileHeader)
- return S_FALSE;
- CItemEx cdItem;
- RINOK(ReadCdItem(cdItem));
- items.Add(cdItem);
- if (progress && items.Size() % 1000 == 0)
- RINOK(progress->SetCompleted(items.Size()));
- }
- return (m_Position - cdOffset == cdSize) ? S_OK : S_FALSE;
-}
-
-HRESULT CInArchive::ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt64 &cdSize, CProgressVirt *progress)
-{
- m_ArchiveInfo.Base = 0;
- CCdInfo cdInfo;
- RINOK(FindCd(cdInfo));
- HRESULT res = S_FALSE;
- cdSize = cdInfo.Size;
- cdOffset = cdInfo.Offset;
- res = TryReadCd(items, m_ArchiveInfo.Base + cdOffset, cdSize, progress);
- if (res == S_FALSE && m_ArchiveInfo.Base == 0)
- {
- res = TryReadCd(items, cdInfo.Offset + m_ArchiveInfo.StartPosition, cdSize, progress);
- if (res == S_OK)
- m_ArchiveInfo.Base = m_ArchiveInfo.StartPosition;
- }
- if (!ReadUInt32(m_Signature))
- return S_FALSE;
- return res;
-}
-
-HRESULT CInArchive::ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt *progress, UInt64 &cdOffset)
-{
- items.Clear();
- while (m_Signature == NSignature::kLocalFileHeader)
- {
- // FSeek points to next byte after signature
- // NFileHeader::CLocalBlock localHeader;
- CItemEx item;
- item.LocalHeaderPosition = m_Position - m_StreamStartPosition - 4; // points to signature;
- RINOK(ReadLocalItem(item));
- item.FromLocal = true;
- ReadLocalItemDescriptor(item);
- items.Add(item);
- if (progress && items.Size() % 100 == 0)
- RINOK(progress->SetCompleted(items.Size()));
- if (!ReadUInt32(m_Signature))
- break;
- }
- cdOffset = m_Position - 4;
- for (int i = 0; i < items.Size(); i++)
- {
- if (progress && i % 1000 == 0)
- RINOK(progress->SetCompleted(items.Size()));
- if (m_Signature != NSignature::kCentralFileHeader)
- return S_FALSE;
-
- CItemEx cdItem;
- RINOK(ReadCdItem(cdItem));
-
- if (i == 0)
- {
- if (cdItem.LocalHeaderPosition == 0)
- m_ArchiveInfo.Base = m_ArchiveInfo.StartPosition;
- }
-
- int index;
- int left = 0, right = items.Size();
- for (;;)
- {
- if (left >= right)
- return S_FALSE;
- index = (left + right) / 2;
- UInt64 position = items[index].LocalHeaderPosition - m_ArchiveInfo.Base;
- if (cdItem.LocalHeaderPosition == position)
- break;
- if (cdItem.LocalHeaderPosition < position)
- right = index;
- else
- left = index + 1;
- }
- CItemEx &item = items[index];
- item.LocalHeaderPosition = cdItem.LocalHeaderPosition;
- item.MadeByVersion = cdItem.MadeByVersion;
- item.CentralExtra = cdItem.CentralExtra;
-
- if (
- // item.ExtractVersion != cdItem.ExtractVersion ||
- item.Flags != cdItem.Flags ||
- item.CompressionMethod != cdItem.CompressionMethod ||
- // item.Time != cdItem.Time ||
- item.FileCRC != cdItem.FileCRC)
- return S_FALSE;
-
- if (item.Name.Length() != cdItem.Name.Length() ||
- item.PackSize != cdItem.PackSize ||
- item.UnPackSize != cdItem.UnPackSize
- )
- return S_FALSE;
- item.Name = cdItem.Name;
- item.InternalAttributes = cdItem.InternalAttributes;
- item.ExternalAttributes = cdItem.ExternalAttributes;
- item.Comment = cdItem.Comment;
- item.FromCentral = cdItem.FromCentral;
- if (!ReadUInt32(m_Signature))
- return S_FALSE;
- }
- return S_OK;
-}
-
-struct CEcd
-{
- UInt16 thisDiskNumber;
- UInt16 startCDDiskNumber;
- UInt16 numEntriesInCDOnThisDisk;
- UInt16 numEntriesInCD;
- UInt32 cdSize;
- UInt32 cdStartOffset;
- UInt16 commentSize;
- void Parse(const Byte *p);
-};
-
-void CEcd::Parse(const Byte *p)
-{
- thisDiskNumber = Get16(p);
- startCDDiskNumber = Get16(p + 2);
- numEntriesInCDOnThisDisk = Get16(p + 4);
- numEntriesInCD = Get16(p + 6);
- cdSize = Get32(p + 8);
- cdStartOffset = Get32(p + 12);
- commentSize = Get16(p + 16);
-}
-
-struct CEcd64
-{
- UInt16 versionMade;
- UInt16 versionNeedExtract;
- UInt32 thisDiskNumber;
- UInt32 startCDDiskNumber;
- UInt64 numEntriesInCDOnThisDisk;
- UInt64 numEntriesInCD;
- UInt64 cdSize;
- UInt64 cdStartOffset;
- void Parse(const Byte *p);
- CEcd64() { memset(this, 0, sizeof(*this)); }
-};
-
-void CEcd64::Parse(const Byte *p)
-{
- versionMade = Get16(p);
- versionNeedExtract = Get16(p + 2);
- thisDiskNumber = Get32(p + 4);
- startCDDiskNumber = Get32(p + 8);
- numEntriesInCDOnThisDisk = Get64(p + 12);
- numEntriesInCD = Get64(p + 20);
- cdSize = Get64(p + 28);
- cdStartOffset = Get64(p + 36);
-}
-
-#define COPY_ECD_ITEM_16(n) if (!isZip64 || ecd. n != 0xFFFF) ecd64. n = ecd. n;
-#define COPY_ECD_ITEM_32(n) if (!isZip64 || ecd. n != 0xFFFFFFFF) ecd64. n = ecd. n;
-
-HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *progress)
-{
- // m_Signature must be kLocalFileHeaderSignature or
- // kEndOfCentralDirSignature
- // m_Position points to next byte after signature
-
- IsZip64 = false;
- items.Clear();
-
- UInt64 cdSize, cdStartOffset;
- HRESULT res = ReadCd(items, cdStartOffset, cdSize, progress);
- if (res != S_FALSE && res != S_OK)
- return res;
-
- /*
- if (res != S_OK)
- return res;
- res = S_FALSE;
- */
-
- if (res == S_FALSE)
- {
- _inBufMode = false;
- m_ArchiveInfo.Base = 0;
- RINOK(m_Stream->Seek(m_ArchiveInfo.StartPosition, STREAM_SEEK_SET, &m_Position));
- if (m_Position != m_ArchiveInfo.StartPosition)
- return S_FALSE;
- if (!ReadUInt32(m_Signature))
- return S_FALSE;
- RINOK(ReadLocalsAndCd(items, progress, cdStartOffset));
- cdSize = (m_Position - 4) - cdStartOffset;
- cdStartOffset -= m_ArchiveInfo.Base;
- }
-
- CEcd64 ecd64;
- bool isZip64 = false;
- UInt64 zip64EcdStartOffset = m_Position - 4 - m_ArchiveInfo.Base;
- if (m_Signature == NSignature::kZip64EndOfCentralDir)
- {
- IsZip64 = isZip64 = true;
- UInt64 recordSize = ReadUInt64();
-
- const int kBufSize = kZip64EcdSize;
- Byte buf[kBufSize];
- SafeReadBytes(buf, kBufSize);
- ecd64.Parse(buf);
-
- Skip(recordSize - kZip64EcdSize);
- if (!ReadUInt32(m_Signature))
- return S_FALSE;
- if (ecd64.thisDiskNumber != 0 || ecd64.startCDDiskNumber != 0)
- throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported);
- if (ecd64.numEntriesInCDOnThisDisk != static_cast< UInt64 >( items.Size() ) ||
- ecd64.numEntriesInCD != static_cast< UInt64 >( items.Size() ) ||
- ecd64.cdSize != cdSize ||
- (ecd64.cdStartOffset != cdStartOffset &&
- (!items.IsEmpty())))
- return S_FALSE;
- }
- if (m_Signature == NSignature::kZip64EndOfCentralDirLocator)
- {
- /* UInt32 startEndCDDiskNumber = */ ReadUInt32();
- UInt64 endCDStartOffset = ReadUInt64();
- /* UInt32 numberOfDisks = */ ReadUInt32();
- if (zip64EcdStartOffset != endCDStartOffset)
- return S_FALSE;
- if (!ReadUInt32(m_Signature))
- return S_FALSE;
- }
- if (m_Signature != NSignature::kEndOfCentralDir)
- return S_FALSE;
-
- const int kBufSize = kEcdSize - 4;
- Byte buf[kBufSize];
- SafeReadBytes(buf, kBufSize);
- CEcd ecd;
- ecd.Parse(buf);
-
- COPY_ECD_ITEM_16(thisDiskNumber);
- COPY_ECD_ITEM_16(startCDDiskNumber);
- COPY_ECD_ITEM_16(numEntriesInCDOnThisDisk);
- COPY_ECD_ITEM_16(numEntriesInCD);
- COPY_ECD_ITEM_32(cdSize);
- COPY_ECD_ITEM_32(cdStartOffset);
-
- ReadBuffer(m_ArchiveInfo.Comment, ecd.commentSize);
-
- if (ecd64.thisDiskNumber != 0 || ecd64.startCDDiskNumber != 0)
- throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported);
- if ((UInt16)ecd64.numEntriesInCDOnThisDisk != ((UInt16)items.Size()) ||
- (UInt16)ecd64.numEntriesInCD != ((UInt16)items.Size()) ||
- (UInt32)ecd64.cdSize != (UInt32)cdSize ||
- ((UInt32)(ecd64.cdStartOffset) != (UInt32)cdStartOffset &&
- (!items.IsEmpty())))
- return S_FALSE;
-
- _inBufMode = false;
- _inBuffer.Free();
- return S_OK;
-}
-
-ISequentialInStream* CInArchive::CreateLimitedStream(UInt64 position, UInt64 size)
-{
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> stream(streamSpec);
- SeekInArchive(m_ArchiveInfo.Base + position);
- streamSpec->SetStream(m_Stream);
- streamSpec->Init(size);
- return stream.Detach();
-}
-
-IInStream* CInArchive::CreateStream()
-{
- CMyComPtr<IInStream> stream = m_Stream;
- return stream.Detach();
-}
-
-bool CInArchive::SeekInArchive(UInt64 position)
-{
- UInt64 newPosition;
- if (m_Stream->Seek(position, STREAM_SEEK_SET, &newPosition) != S_OK)
- return false;
- return (newPosition == position);
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipIn.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipIn.h
deleted file mode 100644
index 51597898d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipIn.h
+++ /dev/null
@@ -1,123 +0,0 @@
-// Archive/ZipIn.h
-
-#ifndef __ZIP_IN_H
-#define __ZIP_IN_H
-
-#include "Common/MyCom.h"
-
-#include "../../IStream.h"
-
-#include "../../Common/InBuffer.h"
-
-#include "ZipHeader.h"
-#include "ZipItemEx.h"
-
-namespace NArchive {
-namespace NZip {
-
-class CInArchiveException
-{
-public:
- enum ECauseType
- {
- kUnexpectedEndOfArchive = 0,
- kArchiceHeaderCRCError,
- kFileHeaderCRCError,
- kIncorrectArchive,
- kDataDescroptorsAreNotSupported,
- kMultiVolumeArchiveAreNotSupported,
- kReadStreamError,
- kSeekStreamError
- }
- Cause;
- CInArchiveException(ECauseType cause): Cause(cause) {}
-};
-
-class CInArchiveInfo
-{
-public:
- UInt64 Base;
- UInt64 StartPosition;
- CByteBuffer Comment;
- CInArchiveInfo(): Base(0), StartPosition(0) {}
- void Clear()
- {
- Base = 0;
- StartPosition = 0;
- Comment.SetCapacity(0);
- }
-};
-
-class CProgressVirt
-{
-public:
- virtual ~CProgressVirt() {}
- STDMETHOD(SetTotal)(UInt64 numFiles) PURE;
- STDMETHOD(SetCompleted)(UInt64 numFiles) PURE;
-};
-
-struct CCdInfo
-{
- // UInt64 NumEntries;
- UInt64 Size;
- UInt64 Offset;
-};
-
-class CInArchive
-{
- CMyComPtr<IInStream> m_Stream;
- UInt32 m_Signature;
- UInt64 m_StreamStartPosition;
- UInt64 m_Position;
-
- bool _inBufMode;
- CInBuffer _inBuffer;
-
- HRESULT Seek(UInt64 offset);
-
- HRESULT FindAndReadMarker(IInStream *stream, const UInt64 *searchHeaderSizeLimit);
- void ReadFileName(UInt32 nameSize, AString &dest);
-
- HRESULT ReadBytes(void *data, UInt32 size, UInt32 *processedSize);
- bool ReadBytesAndTestSize(void *data, UInt32 size);
- void SafeReadBytes(void *data, UInt32 size);
- void ReadBuffer(CByteBuffer &buffer, UInt32 size);
- Byte ReadByte();
- UInt16 ReadUInt16();
- UInt32 ReadUInt32();
- UInt64 ReadUInt64();
- bool ReadUInt32(UInt32 &signature);
-
- void Skip(UInt64 num);
- void IncreaseRealPosition(UInt64 addValue);
-
- void ReadExtra(UInt32 extraSize, CExtraBlock &extraBlock,
- UInt64 &unpackSize, UInt64 &packSize, UInt64 &localHeaderOffset, UInt32 &diskStartNumber);
- HRESULT ReadLocalItem(CItemEx &item);
- HRESULT ReadLocalItemDescriptor(CItemEx &item);
- HRESULT ReadCdItem(CItemEx &item);
- HRESULT TryEcd64(UInt64 offset, CCdInfo &cdInfo);
- HRESULT FindCd(CCdInfo &cdInfo);
- HRESULT TryReadCd(CObjectVector<CItemEx> &items, UInt64 cdOffset, UInt64 cdSize, CProgressVirt *progress);
- HRESULT ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt64 &cdSize, CProgressVirt *progress);
- HRESULT ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt *progress, UInt64 &cdOffset);
-public:
- CInArchiveInfo m_ArchiveInfo;
- bool IsZip64;
-
- HRESULT ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *progress);
- HRESULT ReadLocalItemAfterCdItem(CItemEx &item);
- HRESULT ReadLocalItemAfterCdItemFull(CItemEx &item);
- HRESULT Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit);
- void Close();
- void GetArchiveInfo(CInArchiveInfo &archiveInfo) const;
- bool SeekInArchive(UInt64 position);
- ISequentialInStream *CreateLimitedStream(UInt64 position, UInt64 size);
- IInStream* CreateStream();
-
- bool IsOpen() const { return m_Stream != NULL; }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipItem.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipItem.cpp
deleted file mode 100644
index 4dd58f7d6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipItem.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-// Archive/ZipItem.cpp
-
-#include "StdAfx.h"
-
-#include "ZipHeader.h"
-#include "ZipItem.h"
-#include "../Common/ItemNameUtils.h"
-#include "../../../../C/CpuArch.h"
-
-namespace NArchive {
-namespace NZip {
-
-bool operator==(const CVersion &v1, const CVersion &v2)
-{
- return (v1.Version == v2.Version) && (v1.HostOS == v2.HostOS);
-}
-
-bool operator!=(const CVersion &v1, const CVersion &v2)
-{
- return !(v1 == v2);
-}
-
-bool CExtraSubBlock::ExtractNtfsTime(int index, FILETIME &ft) const
-{
- ft.dwHighDateTime = ft.dwLowDateTime = 0;
- UInt32 size = (UInt32)Data.GetCapacity();
- if (ID != NFileHeader::NExtraID::kNTFS || size < 32)
- return false;
- const Byte *p = (const Byte *)Data;
- p += 4; // for reserved
- size -= 4;
- while (size > 4)
- {
- UInt16 tag = GetUi16(p);
- UInt32 attrSize = GetUi16(p + 2);
- p += 4;
- size -= 4;
- if (attrSize > size)
- attrSize = size;
-
- if (tag == NFileHeader::NNtfsExtra::kTagTime && attrSize >= 24)
- {
- p += 8 * index;
- ft.dwLowDateTime = GetUi32(p);
- ft.dwHighDateTime = GetUi32(p + 4);
- return true;
- }
- p += attrSize;
- size -= attrSize;
- }
- return false;
-}
-
-bool CExtraSubBlock::ExtractUnixTime(int index, UInt32 &res) const
-{
- res = 0;
- UInt32 size = (UInt32)Data.GetCapacity();
- if (ID != NFileHeader::NExtraID::kUnixTime || size < 5)
- return false;
- const Byte *p = (const Byte *)Data;
- Byte flags = *p++;
- size--;
- for (int i = 0; i < 3; i++)
- if ((flags & (1 << i)) != 0)
- {
- if (size < 4)
- return false;
- if (index == i)
- {
- res = GetUi32(p);
- return true;
- }
- p += 4;
- size -= 4;
- }
- return false;
-}
-
-bool CLocalItem::IsDir() const
-{
- return NItemName::HasTailSlash(Name, GetCodePage());
-}
-
-bool CItem::IsDir() const
-{
- if (NItemName::HasTailSlash(Name, GetCodePage()))
- return true;
- if (!FromCentral)
- return false;
- WORD highAttributes = WORD((ExternalAttributes >> 16 ) & 0xFFFF);
- switch(MadeByVersion.HostOS)
- {
- case NFileHeader::NHostOS::kAMIGA:
- switch (highAttributes & NFileHeader::NAmigaAttribute::kIFMT)
- {
- case NFileHeader::NAmigaAttribute::kIFDIR: return true;
- case NFileHeader::NAmigaAttribute::kIFREG: return false;
- default: return false; // change it throw kUnknownAttributes;
- }
- case NFileHeader::NHostOS::kFAT:
- case NFileHeader::NHostOS::kNTFS:
- case NFileHeader::NHostOS::kHPFS:
- case NFileHeader::NHostOS::kVFAT:
- return ((ExternalAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0);
- case NFileHeader::NHostOS::kAtari:
- case NFileHeader::NHostOS::kMac:
- case NFileHeader::NHostOS::kVMS:
- case NFileHeader::NHostOS::kVM_CMS:
- case NFileHeader::NHostOS::kAcorn:
- case NFileHeader::NHostOS::kMVS:
- return false; // change it throw kUnknownAttributes;
- default:
- /*
- switch (highAttributes & NFileHeader::NUnixAttribute::kIFMT)
- {
- case NFileHeader::NUnixAttribute::kIFDIR:
- return true;
- default:
- return false;
- }
- */
- return false;
- }
-}
-
-#ifndef FILE_ATTRIBUTE_UNIX_EXTENSION
-UInt32 CLocalItem::GetWinAttributes() const
-{
- DWORD winAttributes = 0;
- if (IsDir())
- winAttributes |= FILE_ATTRIBUTE_DIRECTORY;
- return winAttributes;
-}
-#endif
-
-UInt32 CItem::GetWinAttributes() const
-{
- DWORD winAttributes = 0;
- switch(MadeByVersion.HostOS)
- {
- case NFileHeader::NHostOS::kFAT:
- case NFileHeader::NHostOS::kNTFS:
- if (FromCentral)
- winAttributes = ExternalAttributes;
- break;
-#ifdef FILE_ATTRIBUTE_UNIX_EXTENSION
- case NFileHeader::NHostOS::kUnix:
- winAttributes = (ExternalAttributes & 0xFFFF0000) | FILE_ATTRIBUTE_UNIX_EXTENSION;
- if (winAttributes & (NFileHeader::NUnixAttribute::kIFDIR << 16))
- winAttributes |= FILE_ATTRIBUTE_DIRECTORY;
- return winAttributes;
-#endif
- default:
- winAttributes = 0; // must be converted from unix value;
- }
- if (IsDir()) // test it;
- winAttributes |= FILE_ATTRIBUTE_DIRECTORY;
- return winAttributes;
-}
-
-void CLocalItem::SetFlagBits(int startBitNumber, int numBits, int value)
-{
- UInt16 mask = (UInt16)(((1 << numBits) - 1) << startBitNumber);
- Flags &= ~mask;
- Flags |= value << startBitNumber;
-}
-
-void CLocalItem::SetBitMask(int bitMask, bool enable)
-{
- if(enable)
- Flags |= bitMask;
- else
- Flags &= ~bitMask;
-}
-
-void CLocalItem::SetEncrypted(bool encrypted)
- { SetBitMask(NFileHeader::NFlags::kEncrypted, encrypted); }
-void CLocalItem::SetUtf8(bool isUtf8)
- { SetBitMask(NFileHeader::NFlags::kUtf8, isUtf8); }
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipItem.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipItem.h
deleted file mode 100644
index 31f2de732..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipItem.h
+++ /dev/null
@@ -1,281 +0,0 @@
-// Archive/ZipItem.h
-
-#ifndef __ARCHIVE_ZIP_ITEM_H
-#define __ARCHIVE_ZIP_ITEM_H
-
-#include "Common/Types.h"
-#include "Common/MyString.h"
-#include "Common/Buffer.h"
-#include "Common/UTFConvert.h"
-#include "Common/StringConvert.h"
-
-#include "ZipHeader.h"
-
-namespace NArchive {
-namespace NZip {
-
-struct CVersion
-{
- Byte Version;
- Byte HostOS;
-};
-
-bool operator==(const CVersion &v1, const CVersion &v2);
-bool operator!=(const CVersion &v1, const CVersion &v2);
-
-struct CExtraSubBlock
-{
- UInt16 ID;
- CByteBuffer Data;
- bool ExtractNtfsTime(int index, FILETIME &ft) const;
- bool ExtractUnixTime(int index, UInt32 &res) const;
-};
-
-struct CWzAesExtraField
-{
- UInt16 VendorVersion; // 0x0001 - AE-1, 0x0002 - AE-2,
- // UInt16 VendorId; // "AE"
- Byte Strength; // 1 - 128-bit , 2 - 192-bit , 3 - 256-bit
- UInt16 Method;
-
- CWzAesExtraField(): VendorVersion(2), Strength(3), Method(0) {}
-
- bool NeedCrc() const { return (VendorVersion == 1); }
-
- bool ParseFromSubBlock(const CExtraSubBlock &sb)
- {
- if (sb.ID != NFileHeader::NExtraID::kWzAES)
- return false;
- if (sb.Data.GetCapacity() < 7)
- return false;
- const Byte *p = (const Byte *)sb.Data;
- VendorVersion = (((UInt16)p[1]) << 8) | p[0];
- if (p[2] != 'A' || p[3] != 'E')
- return false;
- Strength = p[4];
- Method = (((UInt16)p[6]) << 16) | p[5];
- return true;
- }
- void SetSubBlock(CExtraSubBlock &sb) const
- {
- sb.Data.SetCapacity(7);
- sb.ID = NFileHeader::NExtraID::kWzAES;
- Byte *p = (Byte *)sb.Data;
- p[0] = (Byte)VendorVersion;
- p[1] = (Byte)(VendorVersion >> 8);
- p[2] = 'A';
- p[3] = 'E';
- p[4] = Strength;
- p[5] = (Byte)Method;
- p[6] = (Byte)(Method >> 8);
- }
-};
-
-namespace NStrongCryptoFlags
-{
- const UInt16 kDES = 0x6601;
- const UInt16 kRC2old = 0x6602;
- const UInt16 k3DES168 = 0x6603;
- const UInt16 k3DES112 = 0x6609;
- const UInt16 kAES128 = 0x660E;
- const UInt16 kAES192 = 0x660F;
- const UInt16 kAES256 = 0x6610;
- const UInt16 kRC2 = 0x6702;
- const UInt16 kBlowfish = 0x6720;
- const UInt16 kTwofish = 0x6721;
- const UInt16 kRC4 = 0x6801;
-}
-
-struct CStrongCryptoField
-{
- UInt16 Format;
- UInt16 AlgId;
- UInt16 BitLen;
- UInt16 Flags;
-
- bool ParseFromSubBlock(const CExtraSubBlock &sb)
- {
- if (sb.ID != NFileHeader::NExtraID::kStrongEncrypt)
- return false;
- const Byte *p = (const Byte *)sb.Data;
- if (sb.Data.GetCapacity() < 8)
- return false;
- Format = (((UInt16)p[1]) << 8) | p[0];
- AlgId = (((UInt16)p[3]) << 8) | p[2];
- BitLen = (((UInt16)p[5]) << 8) | p[4];
- Flags = (((UInt16)p[7]) << 8) | p[6];
- return (Format == 2);
- }
-};
-
-struct CExtraBlock
-{
- CObjectVector<CExtraSubBlock> SubBlocks;
- void Clear() { SubBlocks.Clear(); }
- size_t GetSize() const
- {
- size_t res = 0;
- for (int i = 0; i < SubBlocks.Size(); i++)
- res += SubBlocks[i].Data.GetCapacity() + 2 + 2;
- return res;
- }
- bool GetWzAesField(CWzAesExtraField &aesField) const
- {
- for (int i = 0; i < SubBlocks.Size(); i++)
- if (aesField.ParseFromSubBlock(SubBlocks[i]))
- return true;
- return false;
- }
-
- bool GetStrongCryptoField(CStrongCryptoField &f) const
- {
- for (int i = 0; i < SubBlocks.Size(); i++)
- if (f.ParseFromSubBlock(SubBlocks[i]))
- return true;
- return false;
- }
-
- bool HasWzAesField() const
- {
- CWzAesExtraField aesField;
- return GetWzAesField(aesField);
- }
-
- bool GetNtfsTime(int index, FILETIME &ft) const
- {
- for (int i = 0; i < SubBlocks.Size(); i++)
- {
- const CExtraSubBlock &sb = SubBlocks[i];
- if (sb.ID == NFileHeader::NExtraID::kNTFS)
- return sb.ExtractNtfsTime(index, ft);
- }
- return false;
- }
-
- bool GetUnixTime(int index, UInt32 &res) const
- {
- for (int i = 0; i < SubBlocks.Size(); i++)
- {
- const CExtraSubBlock &sb = SubBlocks[i];
- if (sb.ID == NFileHeader::NExtraID::kUnixTime)
- return sb.ExtractUnixTime(index, res);
- }
- return false;
- }
-
- /*
- bool HasStrongCryptoField() const
- {
- CStrongCryptoField f;
- return GetStrongCryptoField(f);
- }
- */
-
- void RemoveUnknownSubBlocks()
- {
- for (int i = SubBlocks.Size() - 1; i >= 0; i--)
- if (SubBlocks[i].ID != NFileHeader::NExtraID::kWzAES)
- SubBlocks.Delete(i);
- }
-};
-
-
-class CLocalItem
-{
-public:
- CVersion ExtractVersion;
- UInt16 Flags;
- UInt16 CompressionMethod;
- UInt32 Time;
- UInt32 FileCRC;
- UInt64 PackSize;
- UInt64 UnPackSize;
-
- AString Name;
-
- CExtraBlock LocalExtra;
-
- bool IsUtf8() const { return (Flags & NFileHeader::NFlags::kUtf8) != 0; }
-
- bool IsEncrypted() const { return (Flags & NFileHeader::NFlags::kEncrypted) != 0; }
- bool IsStrongEncrypted() const { return IsEncrypted() && (Flags & NFileHeader::NFlags::kStrongEncrypted) != 0; };
- bool IsAesEncrypted() const { return IsEncrypted() && (IsStrongEncrypted() || CompressionMethod == NFileHeader::NCompressionMethod::kWzAES); };
-
- bool IsLzmaEOS() const { return (Flags & NFileHeader::NFlags::kLzmaEOS) != 0; }
-
- bool IsDir() const;
- bool IgnoreItem() const { return false; }
- UInt32 GetWinAttributes() const;
-
- bool HasDescriptor() const { return (Flags & NFileHeader::NFlags::kDescriptorUsedMask) != 0; }
-
- UString GetUnicodeString(const AString &s) const
- {
- UString res;
- if (IsUtf8())
- if (!ConvertUTF8ToUnicode(s, res))
- res.Empty();
- if (res.IsEmpty())
- res = MultiByteToUnicodeString(s, GetCodePage());
- return res;
- }
-
-private:
- void SetFlagBits(int startBitNumber, int numBits, int value);
- void SetBitMask(int bitMask, bool enable);
-public:
- void ClearFlags() { Flags = 0; }
- void SetEncrypted(bool encrypted);
- void SetUtf8(bool isUtf8);
-
- WORD GetCodePage() const { return CP_OEMCP; }
-};
-
-class CItem: public CLocalItem
-{
-public:
- CVersion MadeByVersion;
- UInt16 InternalAttributes;
- UInt32 ExternalAttributes;
-
- UInt64 LocalHeaderPosition;
-
- FILETIME NtfsMTime;
- FILETIME NtfsATime;
- FILETIME NtfsCTime;
-
- CExtraBlock CentralExtra;
- CByteBuffer Comment;
-
- bool FromLocal;
- bool FromCentral;
- bool NtfsTimeIsDefined;
-
- bool IsDir() const;
- UInt32 GetWinAttributes() const;
-
- bool IsThereCrc() const
- {
- if (CompressionMethod == NFileHeader::NCompressionMethod::kWzAES)
- {
- CWzAesExtraField aesField;
- if (CentralExtra.GetWzAesField(aesField))
- return aesField.NeedCrc();
- }
- return (FileCRC != 0 || !IsDir());
- }
-
- WORD GetCodePage() const
- {
- return (WORD)((MadeByVersion.HostOS == NFileHeader::NHostOS::kFAT
- || MadeByVersion.HostOS == NFileHeader::NHostOS::kNTFS
- ) ? CP_OEMCP : CP_ACP);
- }
- CItem() : FromLocal(false), FromCentral(false), NtfsTimeIsDefined(false) {}
-};
-
-}}
-
-#endif
-
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipItemEx.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipItemEx.h
deleted file mode 100644
index ab62cdbb4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipItemEx.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Archive/ZipItemEx.h
-
-#ifndef __ARCHIVE_ZIP_ITEMEX_H
-#define __ARCHIVE_ZIP_ITEMEX_H
-
-#include "ZipHeader.h"
-#include "ZipItem.h"
-
-namespace NArchive {
-namespace NZip {
-
-class CItemEx: public CItem
-{
-public:
- UInt32 FileHeaderWithNameSize;
- UInt16 LocalExtraSize;
-
- UInt64 GetLocalFullSize() const
- { return FileHeaderWithNameSize + LocalExtraSize + PackSize +
- (HasDescriptor() ? NFileHeader::kDataDescriptorSize : 0); };
- /*
- UInt64 GetLocalFullSize(bool isZip64) const
- { return FileHeaderWithNameSize + LocalExtraSize + PackSize +
- (HasDescriptor() ? (isZip64 ? NFileHeader::kDataDescriptor64Size : NFileHeader::kDataDescriptorSize) : 0); };
- */
- UInt64 GetLocalExtraPosition() const
- { return LocalHeaderPosition + FileHeaderWithNameSize; };
- UInt64 GetDataPosition() const
- { return GetLocalExtraPosition() + LocalExtraSize; };
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipOut.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipOut.cpp
deleted file mode 100644
index 5b1bdeee2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipOut.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-// ZipOut.cpp
-
-#include "StdAfx.h"
-
-#include "ZipOut.h"
-#include "Common/StringConvert.h"
-#include "../../Common/OffsetStream.h"
-#include "../../Common/StreamUtils.h"
-
-namespace NArchive {
-namespace NZip {
-
-void COutArchive::Create(IOutStream *outStream)
-{
- if (!m_OutBuffer.Create(1 << 16))
- throw CSystemException(E_OUTOFMEMORY);
- m_Stream = outStream;
- m_OutBuffer.SetStream(outStream);
- m_OutBuffer.Init();
- m_BasePosition = 0;
-}
-
-void COutArchive::MoveBasePosition(UInt64 distanceToMove)
-{
- m_BasePosition += distanceToMove; // test overflow
-}
-
-void COutArchive::PrepareWriteCompressedDataZip64(UInt16 fileNameLength, bool isZip64, bool aesEncryption)
-{
- m_IsZip64 = isZip64;
- m_ExtraSize = isZip64 ? (4 + 8 + 8) : 0;
- if (aesEncryption)
- m_ExtraSize += 4 + 7;
- m_LocalFileHeaderSize = 4 + NFileHeader::kLocalBlockSize + fileNameLength + m_ExtraSize;
-}
-
-void COutArchive::PrepareWriteCompressedData(UInt16 fileNameLength, UInt64 unPackSize, bool aesEncryption)
-{
- // We test it to 0xF8000000 to support case when compressed size
- // can be larger than uncompressed size.
- PrepareWriteCompressedDataZip64(fileNameLength, unPackSize >= 0xF8000000, aesEncryption);
-}
-
-void COutArchive::PrepareWriteCompressedData2(UInt16 fileNameLength, UInt64 unPackSize, UInt64 packSize, bool aesEncryption)
-{
- bool isUnPack64 = unPackSize >= 0xFFFFFFFF;
- bool isPack64 = packSize >= 0xFFFFFFFF;
- bool isZip64 = isPack64 || isUnPack64;
- PrepareWriteCompressedDataZip64(fileNameLength, isZip64, aesEncryption);
-}
-
-void COutArchive::WriteBytes(const void *buffer, UInt32 size)
-{
- m_OutBuffer.WriteBytes(buffer, size);
- m_BasePosition += size;
-}
-
-void COutArchive::WriteByte(Byte b)
-{
- WriteBytes(&b, 1);
-}
-
-void COutArchive::WriteUInt16(UInt16 value)
-{
- for (int i = 0; i < 2; i++)
- {
- WriteByte((Byte)value);
- value >>= 8;
- }
-}
-
-void COutArchive::WriteUInt32(UInt32 value)
-{
- for (int i = 0; i < 4; i++)
- {
- WriteByte((Byte)value);
- value >>= 8;
- }
-}
-
-void COutArchive::WriteUInt64(UInt64 value)
-{
- for (int i = 0; i < 8; i++)
- {
- WriteByte((Byte)value);
- value >>= 8;
- }
-}
-
-void COutArchive::WriteExtra(const CExtraBlock &extra)
-{
- if (extra.SubBlocks.Size() != 0)
- {
- for (int i = 0; i < extra.SubBlocks.Size(); i++)
- {
- const CExtraSubBlock &subBlock = extra.SubBlocks[i];
- WriteUInt16(subBlock.ID);
- WriteUInt16((UInt16)subBlock.Data.GetCapacity());
- WriteBytes(subBlock.Data, (UInt32)subBlock.Data.GetCapacity());
- }
- }
-}
-
-void COutArchive::SeekTo(UInt64 offset)
-{
- HRESULT res = m_Stream->Seek(offset, STREAM_SEEK_SET, NULL);
- if (res != S_OK)
- throw CSystemException(res);
-}
-
-void COutArchive::WriteLocalHeader(const CLocalItem &item)
-{
- SeekTo(m_BasePosition);
-
- bool isZip64 = m_IsZip64 || item.PackSize >= 0xFFFFFFFF || item.UnPackSize >= 0xFFFFFFFF;
-
- WriteUInt32(NSignature::kLocalFileHeader);
- WriteByte(item.ExtractVersion.Version);
- WriteByte(item.ExtractVersion.HostOS);
- WriteUInt16(item.Flags);
- WriteUInt16(item.CompressionMethod);
- WriteUInt32(item.Time);
- WriteUInt32(item.FileCRC);
- WriteUInt32(isZip64 ? 0xFFFFFFFF: (UInt32)item.PackSize);
- WriteUInt32(isZip64 ? 0xFFFFFFFF: (UInt32)item.UnPackSize);
- WriteUInt16((UInt16)item.Name.Length());
- {
- UInt16 localExtraSize = (UInt16)((isZip64 ? (4 + 16): 0) + item.LocalExtra.GetSize());
- if (localExtraSize > m_ExtraSize)
- throw CSystemException(E_FAIL);
- }
- WriteUInt16((UInt16)m_ExtraSize); // test it;
- WriteBytes((const char *)item.Name, item.Name.Length());
-
- UInt32 extraPos = 0;
- if (isZip64)
- {
- extraPos += 4 + 16;
- WriteUInt16(NFileHeader::NExtraID::kZip64);
- WriteUInt16(16);
- WriteUInt64(item.UnPackSize);
- WriteUInt64(item.PackSize);
- }
-
- WriteExtra(item.LocalExtra);
- extraPos += (UInt32)item.LocalExtra.GetSize();
- for (; extraPos < m_ExtraSize; extraPos++)
- WriteByte(0);
-
- m_OutBuffer.FlushWithCheck();
- MoveBasePosition(item.PackSize);
- SeekTo(m_BasePosition);
-}
-
-void COutArchive::WriteCentralHeader(const CItem &item)
-{
- bool isUnPack64 = item.UnPackSize >= 0xFFFFFFFF;
- bool isPack64 = item.PackSize >= 0xFFFFFFFF;
- bool isPosition64 = item.LocalHeaderPosition >= 0xFFFFFFFF;
- bool isZip64 = isPack64 || isUnPack64 || isPosition64;
-
- WriteUInt32(NSignature::kCentralFileHeader);
- WriteByte(item.MadeByVersion.Version);
- WriteByte(item.MadeByVersion.HostOS);
- WriteByte(item.ExtractVersion.Version);
- WriteByte(item.ExtractVersion.HostOS);
- WriteUInt16(item.Flags);
- WriteUInt16(item.CompressionMethod);
- WriteUInt32(item.Time);
- WriteUInt32(item.FileCRC);
- WriteUInt32(isPack64 ? 0xFFFFFFFF: (UInt32)item.PackSize);
- WriteUInt32(isUnPack64 ? 0xFFFFFFFF: (UInt32)item.UnPackSize);
- WriteUInt16((UInt16)item.Name.Length());
- UInt16 zip64ExtraSize = (UInt16)((isUnPack64 ? 8: 0) + (isPack64 ? 8: 0) + (isPosition64 ? 8: 0));
- const UInt16 kNtfsExtraSize = 4 + 2 + 2 + (3 * 8);
- UInt16 centralExtraSize = (UInt16)(isZip64 ? (4 + zip64ExtraSize) : 0) + (item.NtfsTimeIsDefined ? (4 + kNtfsExtraSize) : 0);
- centralExtraSize = (UInt16)(centralExtraSize + item.CentralExtra.GetSize());
- WriteUInt16(centralExtraSize); // test it;
- WriteUInt16((UInt16)item.Comment.GetCapacity());
- WriteUInt16(0); // DiskNumberStart;
- WriteUInt16(item.InternalAttributes);
- WriteUInt32(item.ExternalAttributes);
- WriteUInt32(isPosition64 ? 0xFFFFFFFF: (UInt32)item.LocalHeaderPosition);
- WriteBytes((const char *)item.Name, item.Name.Length());
- if (isZip64)
- {
- WriteUInt16(NFileHeader::NExtraID::kZip64);
- WriteUInt16(zip64ExtraSize);
- if(isUnPack64)
- WriteUInt64(item.UnPackSize);
- if(isPack64)
- WriteUInt64(item.PackSize);
- if(isPosition64)
- WriteUInt64(item.LocalHeaderPosition);
- }
- if (item.NtfsTimeIsDefined)
- {
- WriteUInt16(NFileHeader::NExtraID::kNTFS);
- WriteUInt16(kNtfsExtraSize);
- WriteUInt32(0); // reserved
- WriteUInt16(NFileHeader::NNtfsExtra::kTagTime);
- WriteUInt16(8 * 3);
- WriteUInt32(item.NtfsMTime.dwLowDateTime);
- WriteUInt32(item.NtfsMTime.dwHighDateTime);
- WriteUInt32(item.NtfsATime.dwLowDateTime);
- WriteUInt32(item.NtfsATime.dwHighDateTime);
- WriteUInt32(item.NtfsCTime.dwLowDateTime);
- WriteUInt32(item.NtfsCTime.dwHighDateTime);
- }
- WriteExtra(item.CentralExtra);
- if (item.Comment.GetCapacity() > 0)
- WriteBytes(item.Comment, (UInt32)item.Comment.GetCapacity());
-}
-
-void COutArchive::WriteCentralDir(const CObjectVector<CItem> &items, const CByteBuffer &comment)
-{
- SeekTo(m_BasePosition);
-
- UInt64 cdOffset = GetCurrentPosition();
- for(int i = 0; i < items.Size(); i++)
- WriteCentralHeader(items[i]);
- UInt64 cd64EndOffset = GetCurrentPosition();
- UInt64 cdSize = cd64EndOffset - cdOffset;
- bool cdOffset64 = cdOffset >= 0xFFFFFFFF;
- bool cdSize64 = cdSize >= 0xFFFFFFFF;
- bool items64 = items.Size() >= 0xFFFF;
- bool isZip64 = (cdOffset64 || cdSize64 || items64);
-
- if (isZip64)
- {
- WriteUInt32(NSignature::kZip64EndOfCentralDir);
- WriteUInt64(kZip64EcdSize); // ThisDiskNumber = 0;
- WriteUInt16(45); // version
- WriteUInt16(45); // version
- WriteUInt32(0); // ThisDiskNumber = 0;
- WriteUInt32(0); // StartCentralDirectoryDiskNumber;;
- WriteUInt64((UInt64)items.Size());
- WriteUInt64((UInt64)items.Size());
- WriteUInt64((UInt64)cdSize);
- WriteUInt64((UInt64)cdOffset);
-
- WriteUInt32(NSignature::kZip64EndOfCentralDirLocator);
- WriteUInt32(0); // number of the disk with the start of the zip64 end of central directory
- WriteUInt64(cd64EndOffset);
- WriteUInt32(1); // total number of disks
- }
- WriteUInt32(NSignature::kEndOfCentralDir);
- WriteUInt16(0); // ThisDiskNumber = 0;
- WriteUInt16(0); // StartCentralDirectoryDiskNumber;
- WriteUInt16((UInt16)(items64 ? 0xFFFF: items.Size()));
- WriteUInt16((UInt16)(items64 ? 0xFFFF: items.Size()));
- WriteUInt32(cdSize64 ? 0xFFFFFFFF: (UInt32)cdSize);
- WriteUInt32(cdOffset64 ? 0xFFFFFFFF: (UInt32)cdOffset);
- UInt16 commentSize = (UInt16)comment.GetCapacity();
- WriteUInt16(commentSize);
- if (commentSize > 0)
- WriteBytes((const Byte *)comment, commentSize);
- m_OutBuffer.FlushWithCheck();
-}
-
-void COutArchive::CreateStreamForCompressing(IOutStream **outStream)
-{
- COffsetOutStream *streamSpec = new COffsetOutStream;
- CMyComPtr<IOutStream> tempStream(streamSpec);
- streamSpec->Init(m_Stream, m_BasePosition + m_LocalFileHeaderSize);
- *outStream = tempStream.Detach();
-}
-
-void COutArchive::SeekToPackedDataPosition()
-{
- SeekTo(m_BasePosition + m_LocalFileHeaderSize);
-}
-
-void COutArchive::CreateStreamForCopying(ISequentialOutStream **outStream)
-{
- CMyComPtr<ISequentialOutStream> tempStream(m_Stream);
- *outStream = tempStream.Detach();
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipOut.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipOut.h
deleted file mode 100644
index 24bc83a1f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipOut.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// ZipOut.h
-
-#ifndef __ZIP_OUT_H
-#define __ZIP_OUT_H
-
-#include "Common/MyCom.h"
-
-#include "../../IStream.h"
-#include "../../Common/OutBuffer.h"
-
-#include "ZipItem.h"
-
-namespace NArchive {
-namespace NZip {
-
-// can throw CSystemException and COutBufferException
-
-class COutArchive
-{
- CMyComPtr<IOutStream> m_Stream;
- COutBuffer m_OutBuffer;
-
- UInt64 m_BasePosition;
- UInt32 m_LocalFileHeaderSize;
- UInt32 m_ExtraSize;
- bool m_IsZip64;
-
- void WriteBytes(const void *buffer, UInt32 size);
- void WriteByte(Byte b);
- void WriteUInt16(UInt16 value);
- void WriteUInt32(UInt32 value);
- void WriteUInt64(UInt64 value);
-
- void WriteExtraHeader(const CItem &item);
- void WriteCentralHeader(const CItem &item);
- void WriteExtra(const CExtraBlock &extra);
- void SeekTo(UInt64 offset);
-public:
- void Create(IOutStream *outStream);
- void MoveBasePosition(UInt64 distanceToMove);
- UInt64 GetCurrentPosition() const { return m_BasePosition; };
- void PrepareWriteCompressedDataZip64(UInt16 fileNameLength, bool isZip64, bool aesEncryption);
- void PrepareWriteCompressedData(UInt16 fileNameLength, UInt64 unPackSize, bool aesEncryption);
- void PrepareWriteCompressedData2(UInt16 fileNameLength, UInt64 unPackSize, UInt64 packSize, bool aesEncryption);
- void WriteLocalHeader(const CLocalItem &item);
-
- void WriteCentralDir(const CObjectVector<CItem> &items, const CByteBuffer &comment);
-
- void CreateStreamForCompressing(IOutStream **outStream);
- void CreateStreamForCopying(ISequentialOutStream **outStream);
- void SeekToPackedDataPosition();
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipRegister.cpp
deleted file mode 100644
index 2fd369508..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipRegister.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// ZipRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterArc.h"
-
-#include "ZipHandler.h"
-static IInArchive *CreateArc() { return new NArchive::NZip::CHandler; }
-#ifndef EXTRACT_ONLY
-static IOutArchive *CreateArcOut() { return new NArchive::NZip::CHandler; }
-#else
-#define CreateArcOut 0
-#endif
-
-static CArcInfo g_ArcInfo =
- { L"Zip", L"zip jar xpi odt ods docx xlsx", 0, 1, { 0x50, 0x4B, 0x03, 0x04 }, 4, false, CreateArc, CreateArcOut };
-
-REGISTER_ARC(Zip)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipUpdate.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipUpdate.cpp
deleted file mode 100644
index 0f67f16c3..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipUpdate.cpp
+++ /dev/null
@@ -1,855 +0,0 @@
-// ZipUpdate.cpp
-
-#include "StdAfx.h"
-
-#include "Common/AutoPtr.h"
-#include "Common/Defs.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/Defs.h"
-#include "Windows/Thread.h"
-
-#include "../../Common/CreateCoder.h"
-#include "../../Common/LimitedStreams.h"
-#include "../../Common/OutMemStream.h"
-#include "../../Common/ProgressUtils.h"
-#ifdef COMPRESS_MT
-#include "../../Common/ProgressMt.h"
-#endif
-
-#include "../../Compress/CopyCoder.h"
-
-#include "ZipAddCommon.h"
-#include "ZipOut.h"
-#include "ZipUpdate.h"
-
-using namespace NWindows;
-using namespace NSynchronization;
-
-namespace NArchive {
-namespace NZip {
-
-static const Byte kHostOS =
- #ifdef _WIN32
- NFileHeader::NHostOS::kFAT;
- #else
- NFileHeader::NHostOS::kUnix;
- #endif
-
-static const Byte kMadeByHostOS = kHostOS;
-static const Byte kExtractHostOS = kHostOS;
-
-static const Byte kMethodForDirectory = NFileHeader::NCompressionMethod::kStored;
-static const Byte kExtractVersionForDirectory = NFileHeader::NCompressionMethod::kStoreExtractVersion;
-
-static HRESULT CopyBlockToArchive(ISequentialInStream *inStream,
- COutArchive &outArchive, ICompressProgressInfo *progress)
-{
- CMyComPtr<ISequentialOutStream> outStream;
- outArchive.CreateStreamForCopying(&outStream);
- return NCompress::CopyStream(inStream, outStream, progress);
-}
-
-static HRESULT WriteRange(IInStream *inStream, COutArchive &outArchive,
- const CUpdateRange &range, ICompressProgressInfo *progress)
-{
- UInt64 position;
- RINOK(inStream->Seek(range.Position, STREAM_SEEK_SET, &position));
-
- CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<CLimitedSequentialInStream> inStreamLimited(streamSpec);
- streamSpec->SetStream(inStream);
- streamSpec->Init(range.Size);
-
- RINOK(CopyBlockToArchive(inStreamLimited, outArchive, progress));
- return progress->SetRatioInfo(&range.Size, &range.Size);
-}
-
-static void SetFileHeader(
- COutArchive &archive,
- const CCompressionMethodMode &options,
- const CUpdateItem &ui,
- CItem &item)
-{
- item.UnPackSize = ui.Size;
- bool isDir;
-
- item.ClearFlags();
-
- if (ui.NewProperties)
- {
- isDir = ui.IsDir;
- item.Name = ui.Name;
- item.SetUtf8(ui.IsUtf8);
- item.ExternalAttributes = ui.Attributes;
- item.Time = ui.Time;
- item.NtfsMTime = ui.NtfsMTime;
- item.NtfsATime = ui.NtfsATime;
- item.NtfsCTime = ui.NtfsCTime;
- item.NtfsTimeIsDefined = ui.NtfsTimeIsDefined;
- }
- else
- isDir = item.IsDir();
-
- item.LocalHeaderPosition = archive.GetCurrentPosition();
- item.MadeByVersion.HostOS = kMadeByHostOS;
- item.MadeByVersion.Version = NFileHeader::NCompressionMethod::kMadeByProgramVersion;
-
- item.ExtractVersion.HostOS = kExtractHostOS;
-
- item.InternalAttributes = 0; // test it
- item.SetEncrypted(!isDir && options.PasswordIsDefined);
- if (isDir)
- {
- item.ExtractVersion.Version = kExtractVersionForDirectory;
- item.CompressionMethod = kMethodForDirectory;
- item.PackSize = 0;
- item.FileCRC = 0; // test it
- }
-}
-
-static void SetItemInfoFromCompressingResult(const CCompressingResult &compressingResult,
- bool isAesMode, Byte aesKeyMode, CItem &item)
-{
- item.ExtractVersion.Version = compressingResult.ExtractVersion;
- item.CompressionMethod = compressingResult.Method;
- item.FileCRC = compressingResult.CRC;
- item.UnPackSize = compressingResult.UnpackSize;
- item.PackSize = compressingResult.PackSize;
-
- item.LocalExtra.Clear();
- item.CentralExtra.Clear();
-
- if (isAesMode)
- {
- CWzAesExtraField wzAesField;
- wzAesField.Strength = aesKeyMode;
- wzAesField.Method = compressingResult.Method;
- item.CompressionMethod = NFileHeader::NCompressionMethod::kWzAES;
- item.FileCRC = 0;
- CExtraSubBlock sb;
- wzAesField.SetSubBlock(sb);
- item.LocalExtra.SubBlocks.Add(sb);
- item.CentralExtra.SubBlocks.Add(sb);
- }
-}
-
-#ifdef COMPRESS_MT
-
-static THREAD_FUNC_DECL CoderThread(void *threadCoderInfo);
-
-struct CThreadInfo
-{
- #ifdef EXTERNAL_CODECS
- CMyComPtr<ICompressCodecsInfo> _codecsInfo;
- const CObjectVector<CCodecInfoEx> *_externalCodecs;
- #endif
-
- NWindows::CThread Thread;
- NWindows::NSynchronization::CAutoResetEvent CompressEvent;
- NWindows::NSynchronization::CAutoResetEventWFMO CompressionCompletedEvent;
- bool ExitThread;
-
- CMtCompressProgress *ProgressSpec;
- CMyComPtr<ICompressProgressInfo> Progress;
-
- COutMemStream *OutStreamSpec;
- CMyComPtr<IOutStream> OutStream;
- CMyComPtr<ISequentialInStream> InStream;
-
- CAddCommon Coder;
- HRESULT Result;
- CCompressingResult CompressingResult;
-
- bool IsFree;
- UInt32 UpdateIndex;
-
- CThreadInfo(const CCompressionMethodMode &options):
- ExitThread(false),
- ProgressSpec(0),
- OutStreamSpec(0),
- Coder(options)
- {}
-
- HRESULT CreateEvents(CSynchro *sync)
- {
- RINOK(CompressEvent.CreateIfNotCreated());
- return CompressionCompletedEvent.CreateIfNotCreated(sync);
- }
- HRes CreateThread() { return Thread.Create(CoderThread, this); }
-
- void WaitAndCode();
- void StopWaitClose()
- {
- ExitThread = true;
- if (OutStreamSpec != 0)
- OutStreamSpec->StopWriting(E_ABORT);
- if (CompressEvent.IsCreated())
- CompressEvent.Set();
- Thread.Wait();
- Thread.Close();
- }
-
-};
-
-void CThreadInfo::WaitAndCode()
-{
- for (;;)
- {
- CompressEvent.Lock();
- if (ExitThread)
- return;
- Result = Coder.Compress(
- #ifdef EXTERNAL_CODECS
- _codecsInfo, _externalCodecs,
- #endif
- InStream, OutStream, Progress, CompressingResult);
- if (Result == S_OK && Progress)
- Result = Progress->SetRatioInfo(&CompressingResult.UnpackSize, &CompressingResult.PackSize);
- CompressionCompletedEvent.Set();
- }
-}
-
-static THREAD_FUNC_DECL CoderThread(void *threadCoderInfo)
-{
- ((CThreadInfo *)threadCoderInfo)->WaitAndCode();
- return 0;
-}
-
-class CThreads
-{
-public:
- CObjectVector<CThreadInfo> Threads;
- ~CThreads()
- {
- for (int i = 0; i < Threads.Size(); i++)
- Threads[i].StopWaitClose();
- }
-};
-
-struct CMemBlocks2: public CMemLockBlocks
-{
- CCompressingResult CompressingResult;
- bool Defined;
- bool Skip;
- CMemBlocks2(): Defined(false), Skip(false) {}
-};
-
-class CMemRefs
-{
-public:
- CMemBlockManagerMt *Manager;
- CObjectVector<CMemBlocks2> Refs;
- CMemRefs(CMemBlockManagerMt *manager): Manager(manager) {} ;
- ~CMemRefs()
- {
- for (int i = 0; i < Refs.Size(); i++)
- Refs[i].FreeOpt(Manager);
- }
-};
-
-class CMtProgressMixer2:
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
- UInt64 ProgressOffset;
- UInt64 InSizes[2];
- UInt64 OutSizes[2];
- CMyComPtr<IProgress> Progress;
- CMyComPtr<ICompressProgressInfo> RatioProgress;
- bool _inSizeIsMain;
-public:
- NWindows::NSynchronization::CCriticalSection CriticalSection;
- MY_UNKNOWN_IMP
- void Create(IProgress *progress, bool inSizeIsMain);
- void SetProgressOffset(UInt64 progressOffset);
- HRESULT SetRatioInfo(int index, const UInt64 *inSize, const UInt64 *outSize);
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-void CMtProgressMixer2::Create(IProgress *progress, bool inSizeIsMain)
-{
- Progress = progress;
- Progress.QueryInterface(IID_ICompressProgressInfo, &RatioProgress);
- _inSizeIsMain = inSizeIsMain;
- ProgressOffset = InSizes[0] = InSizes[1] = OutSizes[0] = OutSizes[1] = 0;
-}
-
-void CMtProgressMixer2::SetProgressOffset(UInt64 progressOffset)
-{
- CriticalSection.Enter();
- InSizes[1] = OutSizes[1] = 0;
- ProgressOffset = progressOffset;
- CriticalSection.Leave();
-}
-
-HRESULT CMtProgressMixer2::SetRatioInfo(int index, const UInt64 *inSize, const UInt64 *outSize)
-{
- NWindows::NSynchronization::CCriticalSectionLock lock(CriticalSection);
- if (index == 0 && RatioProgress)
- {
- RINOK(RatioProgress->SetRatioInfo(inSize, outSize));
- }
- if (inSize != 0)
- InSizes[index] = *inSize;
- if (outSize != 0)
- OutSizes[index] = *outSize;
- UInt64 v = ProgressOffset + (_inSizeIsMain ?
- (InSizes[0] + InSizes[1]) :
- (OutSizes[0] + OutSizes[1]));
- return Progress->SetCompleted(&v);
-}
-
-STDMETHODIMP CMtProgressMixer2::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
- return SetRatioInfo(0, inSize, outSize);
-}
-
-class CMtProgressMixer:
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
-public:
- CMtProgressMixer2 *Mixer2;
- CMyComPtr<ICompressProgressInfo> RatioProgress;
- void Create(IProgress *progress, bool inSizeIsMain);
- MY_UNKNOWN_IMP
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-void CMtProgressMixer::Create(IProgress *progress, bool inSizeIsMain)
-{
- Mixer2 = new CMtProgressMixer2;
- RatioProgress = Mixer2;
- Mixer2->Create(progress, inSizeIsMain);
-}
-
-STDMETHODIMP CMtProgressMixer::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
- return Mixer2->SetRatioInfo(1, inSize, outSize);
-}
-
-
-#endif
-
-
-static HRESULT UpdateItemOldData(COutArchive &archive,
- IInStream *inStream,
- const CUpdateItem &ui, CItemEx &item,
- /* bool izZip64, */
- ICompressProgressInfo *progress,
- UInt64 &complexity)
-{
- if (ui.NewProperties)
- {
- if (item.HasDescriptor())
- return E_NOTIMPL;
-
- // use old name size.
- // CUpdateRange range(item.GetLocalExtraPosition(), item.LocalExtraSize + item.PackSize);
- CUpdateRange range(item.GetDataPosition(), item.PackSize);
-
- // item.ExternalAttributes = ui.Attributes;
- // Test it
- item.Name = ui.Name;
- item.SetUtf8(ui.IsUtf8);
- item.Time = ui.Time;
- item.NtfsMTime = ui.NtfsMTime;
- item.NtfsATime = ui.NtfsATime;
- item.NtfsCTime = ui.NtfsCTime;
- item.NtfsTimeIsDefined = ui.NtfsTimeIsDefined;
-
- item.CentralExtra.RemoveUnknownSubBlocks();
- item.LocalExtra.RemoveUnknownSubBlocks();
-
- archive.PrepareWriteCompressedData2((UInt16)item.Name.Length(), item.UnPackSize, item.PackSize, item.LocalExtra.HasWzAesField());
- item.LocalHeaderPosition = archive.GetCurrentPosition();
- archive.SeekToPackedDataPosition();
- RINOK(WriteRange(inStream, archive, range, progress));
- complexity += range.Size;
- archive.WriteLocalHeader(item);
- }
- else
- {
- CUpdateRange range(item.LocalHeaderPosition, item.GetLocalFullSize());
-
- // set new header position
- item.LocalHeaderPosition = archive.GetCurrentPosition();
-
- RINOK(WriteRange(inStream, archive, range, progress));
- complexity += range.Size;
- archive.MoveBasePosition(range.Size);
- }
- return S_OK;
-}
-
-static void WriteDirHeader(COutArchive &archive, const CCompressionMethodMode *options,
- const CUpdateItem &ui, CItemEx &item)
-{
- SetFileHeader(archive, *options, ui, item);
- archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), ui.Size, options->IsAesMode);
- archive.WriteLocalHeader(item);
-}
-
-static HRESULT Update2St(
- DECL_EXTERNAL_CODECS_LOC_VARS
- COutArchive &archive,
- CInArchive *inArchive,
- IInStream *inStream,
- const CObjectVector<CItemEx> &inputItems,
- const CObjectVector<CUpdateItem> &updateItems,
- const CCompressionMethodMode *options,
- const CByteBuffer &comment,
- IArchiveUpdateCallback *updateCallback)
-{
- CLocalProgress *lps = new CLocalProgress;
- CMyComPtr<ICompressProgressInfo> progress = lps;
- lps->Init(updateCallback, true);
-
- CAddCommon compressor(*options);
-
- CObjectVector<CItem> items;
- UInt64 unpackSizeTotal = 0, packSizeTotal = 0;
-
- for (int itemIndex = 0; itemIndex < updateItems.Size(); itemIndex++)
- {
- lps->InSize = unpackSizeTotal;
- lps->OutSize = packSizeTotal;
- RINOK(lps->SetCur());
- const CUpdateItem &ui = updateItems[itemIndex];
- CItemEx item;
- if (!ui.NewProperties || !ui.NewData)
- {
- item = inputItems[ui.IndexInArchive];
- if (inArchive->ReadLocalItemAfterCdItemFull(item) != S_OK)
- return E_NOTIMPL;
- }
-
- if (ui.NewData)
- {
- bool isDir = ((ui.NewProperties) ? ui.IsDir : item.IsDir());
- if (isDir)
- {
- WriteDirHeader(archive, options, ui, item);
- }
- else
- {
- CMyComPtr<ISequentialInStream> fileInStream;
- HRESULT res = updateCallback->GetStream(ui.IndexInClient, &fileInStream);
- if (res == S_FALSE)
- {
- lps->ProgressOffset += ui.Size;
- RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
- continue;
- }
- RINOK(res);
-
- // file Size can be 64-bit !!!
- SetFileHeader(archive, *options, ui, item);
- archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), ui.Size, options->IsAesMode);
- CCompressingResult compressingResult;
- CMyComPtr<IOutStream> outStream;
- archive.CreateStreamForCompressing(&outStream);
- RINOK(compressor.Compress(
- EXTERNAL_CODECS_LOC_VARS
- fileInStream, outStream, progress, compressingResult));
- SetItemInfoFromCompressingResult(compressingResult, options->IsAesMode, options->AesKeyMode, item);
- archive.WriteLocalHeader(item);
- RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
- unpackSizeTotal += item.UnPackSize;
- packSizeTotal += item.PackSize;
- }
- }
- else
- {
- UInt64 complexity = 0;
- lps->SendRatio = false;
- RINOK(UpdateItemOldData(archive, inStream, ui, item, progress, complexity));
- lps->SendRatio = true;
- lps->ProgressOffset += complexity;
- }
- items.Add(item);
- lps->ProgressOffset += NFileHeader::kLocalBlockSize;
- }
- archive.WriteCentralDir(items, comment);
- return S_OK;
-}
-
-static HRESULT Update2(
- DECL_EXTERNAL_CODECS_LOC_VARS
- COutArchive &archive,
- CInArchive *inArchive,
- IInStream *inStream,
- const CObjectVector<CItemEx> &inputItems,
- const CObjectVector<CUpdateItem> &updateItems,
- const CCompressionMethodMode *options,
- const CByteBuffer &comment,
- IArchiveUpdateCallback *updateCallback)
-{
- UInt64 complexity = 0;
- UInt64 numFilesToCompress = 0;
- UInt64 numBytesToCompress = 0;
-
- int i;
- for(i = 0; i < updateItems.Size(); i++)
- {
- const CUpdateItem &ui = updateItems[i];
- if (ui.NewData)
- {
- complexity += ui.Size;
- numBytesToCompress += ui.Size;
- numFilesToCompress++;
- /*
- if (ui.Commented)
- complexity += ui.CommentRange.Size;
- */
- }
- else
- {
- CItemEx inputItem = inputItems[ui.IndexInArchive];
- if (inArchive->ReadLocalItemAfterCdItemFull(inputItem) != S_OK)
- return E_NOTIMPL;
- complexity += inputItem.GetLocalFullSize();
- // complexity += inputItem.GetCentralExtraPlusCommentSize();
- }
- complexity += NFileHeader::kLocalBlockSize;
- complexity += NFileHeader::kCentralBlockSize;
- }
-
- if (comment != 0)
- complexity += comment.GetCapacity();
- complexity++; // end of central
- updateCallback->SetTotal(complexity);
-
- CAddCommon compressor(*options);
-
- complexity = 0;
-
- #ifdef COMPRESS_MT
-
- const size_t kNumMaxThreads = (1 << 10);
- UInt32 numThreads = options->NumThreads;
- if (numThreads > kNumMaxThreads)
- numThreads = kNumMaxThreads;
-
- const size_t kMemPerThread = (1 << 25);
- const size_t kBlockSize = 1 << 16;
-
- CCompressionMethodMode options2;
- if (options != 0)
- options2 = *options;
-
- bool mtMode = ((options != 0) && (numThreads > 1));
-
- if (numFilesToCompress <= 1)
- mtMode = false;
-
- if (mtMode)
- {
- Byte method = options->MethodSequence.Front();
- if (method == NFileHeader::NCompressionMethod::kStored && !options->PasswordIsDefined)
- mtMode = false;
- if (method == NFileHeader::NCompressionMethod::kBZip2)
- {
- UInt64 averageSize = numBytesToCompress / numFilesToCompress;
- UInt32 blockSize = options->DicSize;
- if (blockSize == 0)
- blockSize = 1;
- UInt64 averageNumberOfBlocks = averageSize / blockSize;
- UInt32 numBZip2Threads = 32;
- if (averageNumberOfBlocks < numBZip2Threads)
- numBZip2Threads = (UInt32)averageNumberOfBlocks;
- if (numBZip2Threads < 1)
- numBZip2Threads = 1;
- numThreads = numThreads / numBZip2Threads;
- options2.NumThreads = numBZip2Threads;
- if (numThreads <= 1)
- mtMode = false;
- }
- if (method == NFileHeader::NCompressionMethod::kLZMA)
- {
- UInt32 numLZMAThreads = (options->Algo > 0 ? 2 : 1);
- numThreads /= numLZMAThreads;
- options2.NumThreads = numLZMAThreads;
- if (numThreads <= 1)
- mtMode = false;
- }
- }
-
- if (!mtMode)
- #endif
- return Update2St(
- EXTERNAL_CODECS_LOC_VARS
- archive, inArchive,inStream,
- inputItems, updateItems, options, comment, updateCallback);
-
-
- #ifdef COMPRESS_MT
-
- // Warning : before memManager, threads and compressingCompletedEvents
- // in order to have a "good" order for the destructor
- NWindows::NSynchronization::CSynchro synchroForCompressingCompletedEvents;
- synchroForCompressingCompletedEvents.Create();
- NWindows::NSynchronization::CSynchro synchroForOutStreamSpec;
- synchroForOutStreamSpec.Create();
-
-
- CObjectVector<CItem> items;
-
- CMtProgressMixer *mtProgressMixerSpec = new CMtProgressMixer;
- CMyComPtr<ICompressProgressInfo> progress = mtProgressMixerSpec;
- mtProgressMixerSpec->Create(updateCallback, true);
-
- CMtCompressProgressMixer mtCompressProgressMixer;
- mtCompressProgressMixer.Init(numThreads, mtProgressMixerSpec->RatioProgress);
-
- CMemBlockManagerMt memManager(kBlockSize);
- CMemRefs refs(&memManager);
-
- CThreads threads;
- CRecordVector<HANDLE> compressingCompletedEvents;
- CRecordVector<int> threadIndices; // list threads in order of updateItems
-
- {
- RINOK(memManager.AllocateSpaceAlways(&synchroForOutStreamSpec,(size_t)numThreads * (kMemPerThread / kBlockSize)));
- for(i = 0; i < updateItems.Size(); i++)
- refs.Refs.Add(CMemBlocks2());
-
- UInt32 i;
- for (i = 0; i < numThreads; i++)
- threads.Threads.Add(CThreadInfo(options2));
-
- for (i = 0; i < numThreads; i++)
- {
- CThreadInfo &threadInfo = threads.Threads[i];
- #ifdef EXTERNAL_CODECS
- threadInfo._codecsInfo = codecsInfo;
- threadInfo._externalCodecs = externalCodecs;
- #endif
- RINOK(threadInfo.CreateEvents(&synchroForCompressingCompletedEvents));
- threadInfo.OutStreamSpec = new COutMemStream(&memManager);
- RINOK(threadInfo.OutStreamSpec->CreateEvents(&synchroForOutStreamSpec));
- threadInfo.OutStream = threadInfo.OutStreamSpec;
- threadInfo.IsFree = true;
- threadInfo.ProgressSpec = new CMtCompressProgress();
- threadInfo.Progress = threadInfo.ProgressSpec;
- threadInfo.ProgressSpec->Init(&mtCompressProgressMixer, (int)i);
- RINOK(threadInfo.CreateThread());
- }
- }
- int mtItemIndex = 0;
-
- int itemIndex = 0;
- int lastRealStreamItemIndex = -1;
-
- while (itemIndex < updateItems.Size())
- {
- if ((UInt32)threadIndices.Size() < numThreads && mtItemIndex < updateItems.Size())
- {
- const CUpdateItem &ui = updateItems[mtItemIndex++];
- if (!ui.NewData)
- continue;
- CItemEx item;
- if (ui.NewProperties)
- {
- if (ui.IsDir)
- continue;
- }
- else
- {
- item = inputItems[ui.IndexInArchive];
- if (inArchive->ReadLocalItemAfterCdItemFull(item) != S_OK)
- return E_NOTIMPL;
- if (item.IsDir())
- continue;
- }
- CMyComPtr<ISequentialInStream> fileInStream;
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(mtProgressMixerSpec->Mixer2->CriticalSection);
- HRESULT res = updateCallback->GetStream(ui.IndexInClient, &fileInStream);
- if (res == S_FALSE)
- {
- complexity += ui.Size;
- complexity += NFileHeader::kLocalBlockSize;
- mtProgressMixerSpec->Mixer2->SetProgressOffset(complexity);
- RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
- refs.Refs[mtItemIndex - 1].Skip = true;
- continue;
- }
- RINOK(res);
- RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
- }
-
- for (UInt32 i = 0; i < numThreads; i++)
- {
- CThreadInfo &threadInfo = threads.Threads[i];
- if (threadInfo.IsFree)
- {
- threadInfo.IsFree = false;
- threadInfo.InStream = fileInStream;
-
- // !!!!! we must release ref before sending event
- // BUG was here in v4.43 and v4.44. It could change ref counter in two threads in same time
- fileInStream.Release();
-
- threadInfo.OutStreamSpec->Init();
- threadInfo.ProgressSpec->Reinit();
- threadInfo.CompressEvent.Set();
- threadInfo.UpdateIndex = mtItemIndex - 1;
-
- compressingCompletedEvents.Add(threadInfo.CompressionCompletedEvent);
- threadIndices.Add(i);
- break;
- }
- }
- continue;
- }
-
- if (refs.Refs[itemIndex].Skip)
- {
- itemIndex++;
- continue;
- }
-
- const CUpdateItem &ui = updateItems[itemIndex];
-
- CItemEx item;
- if (!ui.NewProperties || !ui.NewData)
- {
- item = inputItems[ui.IndexInArchive];
- if (inArchive->ReadLocalItemAfterCdItemFull(item) != S_OK)
- return E_NOTIMPL;
- }
-
- if (ui.NewData)
- {
- bool isDir = ((ui.NewProperties) ? ui.IsDir : item.IsDir());
- if (isDir)
- {
- WriteDirHeader(archive, options, ui, item);
- }
- else
- {
- if (lastRealStreamItemIndex < itemIndex)
- {
- lastRealStreamItemIndex = itemIndex;
- SetFileHeader(archive, *options, ui, item);
- // file Size can be 64-bit !!!
- archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), ui.Size, options->IsAesMode);
- }
-
- CMemBlocks2 &memRef = refs.Refs[itemIndex];
- if (memRef.Defined)
- {
- CMyComPtr<IOutStream> outStream;
- archive.CreateStreamForCompressing(&outStream);
- memRef.WriteToStream(memManager.GetBlockSize(), outStream);
- SetItemInfoFromCompressingResult(memRef.CompressingResult,
- options->IsAesMode, options->AesKeyMode, item);
- SetFileHeader(archive, *options, ui, item);
- archive.WriteLocalHeader(item);
- // RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
- memRef.FreeOpt(&memManager);
- }
- else
- {
- {
- CThreadInfo &thread = threads.Threads[threadIndices.Front()];
- if (!thread.OutStreamSpec->WasUnlockEventSent())
- {
- CMyComPtr<IOutStream> outStream;
- archive.CreateStreamForCompressing(&outStream);
- thread.OutStreamSpec->SetOutStream(outStream);
- thread.OutStreamSpec->SetRealStreamMode();
- }
- }
-
- DWORD result = ::WaitForMultipleObjects(compressingCompletedEvents.Size(),
- &compressingCompletedEvents.Front(), FALSE, INFINITE);
- int t = (int)(result - WAIT_OBJECT_0);
- CThreadInfo &threadInfo = threads.Threads[threadIndices[t]];
- threadInfo.InStream.Release();
- threadInfo.IsFree = true;
- RINOK(threadInfo.Result);
- threadIndices.Delete(t);
- compressingCompletedEvents.Delete(t);
- if (t == 0)
- {
- RINOK(threadInfo.OutStreamSpec->WriteToRealStream());
- threadInfo.OutStreamSpec->ReleaseOutStream();
- SetItemInfoFromCompressingResult(threadInfo.CompressingResult,
- options->IsAesMode, options->AesKeyMode, item);
- SetFileHeader(archive, *options, ui, item);
- archive.WriteLocalHeader(item);
- }
- else
- {
- CMemBlocks2 &memRef = refs.Refs[threadInfo.UpdateIndex];
- threadInfo.OutStreamSpec->DetachData(memRef);
- memRef.CompressingResult = threadInfo.CompressingResult;
- memRef.Defined = true;
- continue;
- }
- }
- }
- }
- else
- {
- RINOK(UpdateItemOldData(archive, inStream, ui, item, progress, complexity));
- }
- items.Add(item);
- complexity += NFileHeader::kLocalBlockSize;
- mtProgressMixerSpec->Mixer2->SetProgressOffset(complexity);
- itemIndex++;
- }
- archive.WriteCentralDir(items, comment);
- return S_OK;
- #endif
-}
-
-HRESULT Update(
- DECL_EXTERNAL_CODECS_LOC_VARS
- const CObjectVector<CItemEx> &inputItems,
- const CObjectVector<CUpdateItem> &updateItems,
- ISequentialOutStream *seqOutStream,
- CInArchive *inArchive,
- CCompressionMethodMode *compressionMethodMode,
- IArchiveUpdateCallback *updateCallback)
-{
- CMyComPtr<IOutStream> outStream;
- RINOK(seqOutStream->QueryInterface(IID_IOutStream, (void **)&outStream));
- if (!outStream)
- return E_NOTIMPL;
-
- CInArchiveInfo archiveInfo;
- if(inArchive != 0)
- {
- inArchive->GetArchiveInfo(archiveInfo);
- if (archiveInfo.Base != 0)
- return E_NOTIMPL;
- }
- else
- archiveInfo.StartPosition = 0;
-
- COutArchive outArchive;
- outArchive.Create(outStream);
- if (archiveInfo.StartPosition > 0)
- {
- CMyComPtr<ISequentialInStream> inStream;
- inStream.Attach(inArchive->CreateLimitedStream(0, archiveInfo.StartPosition));
- RINOK(CopyBlockToArchive(inStream, outArchive, NULL));
- outArchive.MoveBasePosition(archiveInfo.StartPosition);
- }
- CMyComPtr<IInStream> inStream;
- if(inArchive != 0)
- inStream.Attach(inArchive->CreateStream());
-
- return Update2(
- EXTERNAL_CODECS_LOC_VARS
- outArchive, inArchive, inStream,
- inputItems, updateItems,
- compressionMethodMode,
- archiveInfo.Comment, updateCallback);
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipUpdate.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipUpdate.h
deleted file mode 100644
index eee16738c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Archive/Zip/ZipUpdate.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Zip/Update.h
-
-#ifndef __ZIP_UPDATE_H
-#define __ZIP_UPDATE_H
-
-#include "../../ICoder.h"
-#include "../IArchive.h"
-
-#include "../../Common/CreateCoder.h"
-
-#include "ZipCompressionMode.h"
-#include "ZipIn.h"
-
-namespace NArchive {
-namespace NZip {
-
-struct CUpdateRange
-{
- UInt64 Position;
- UInt64 Size;
- CUpdateRange() {};
- CUpdateRange(UInt64 position, UInt64 size): Position(position), Size(size) {};
-};
-
-struct CUpdateItem
-{
- bool NewData;
- bool NewProperties;
- bool IsDir;
- bool NtfsTimeIsDefined;
- bool IsUtf8;
- int IndexInArchive;
- int IndexInClient;
- UInt32 Attributes;
- UInt32 Time;
- UInt64 Size;
- AString Name;
- // bool Commented;
- // CUpdateRange CommentRange;
- FILETIME NtfsMTime;
- FILETIME NtfsATime;
- FILETIME NtfsCTime;
-
- CUpdateItem(): NtfsTimeIsDefined(false), IsUtf8(false), Size(0) {}
-};
-
-HRESULT Update(
- DECL_EXTERNAL_CODECS_LOC_VARS
- const CObjectVector<CItemEx> &inputItems,
- const CObjectVector<CUpdateItem> &updateItems,
- ISequentialOutStream *seqOutStream,
- CInArchive *inArchive,
- CCompressionMethodMode *compressionMethodMode,
- IArchiveUpdateCallback *updateCallback);
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Bundles/SFXCon/Main.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Bundles/SFXCon/Main.cpp
deleted file mode 100644
index 95866fcf8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Bundles/SFXCon/Main.cpp
+++ /dev/null
@@ -1,441 +0,0 @@
-// Main.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyInitGuid.h"
-
-#include "Common/CommandLineParser.h"
-#include "Common/MyException.h"
-
-#ifdef _WIN32
-#include "Windows/DLL.h"
-#include "Windows/FileDir.h"
-#else
-#include "Common/StringConvert.h"
-#include "Windows/System.h"
-#endif
-
-#include "../../UI/Common/ExitCode.h"
-#include "../../UI/Common/Extract.h"
-
-#include "../../UI/Console/ExtractCallbackConsole.h"
-#include "../../UI/Console/List.h"
-#include "../../UI/Console/OpenCallbackConsole.h"
-
-#include "../../MyVersion.h"
-
-#include "myPrivate.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NCommandLineParser;
-
-extern CStdOutStream *g_StdStream;
-
-static const char *kCopyrightString =
-"\n7-Zip SFX " MY_VERSION_COPYRIGHT_DATE "\n"
-"p7zip Version " P7ZIP_VERSION ;
-
-static const int kNumSwitches = 6;
-
-namespace NKey {
-enum Enum
-{
- kHelp1 = 0,
- kHelp2,
- kDisablePercents,
- kYes,
- kPassword,
- kOutputDir
-};
-
-}
-
-namespace NRecursedType {
-enum EEnum
-{
- kRecursed,
- kWildCardOnlyRecursed,
- kNonRecursed
-};
-}
-/*
-static const char kRecursedIDChar = 'R';
-static const wchar_t *kRecursedPostCharSet = L"0-";
-
-namespace NRecursedPostCharIndex {
- enum EEnum
- {
- kWildCardRecursionOnly = 0,
- kNoRecursion = 1
- };
-}
-
-static const char kFileListID = '@';
-static const char kImmediateNameID = '!';
-
-static const char kSomeCludePostStringMinSize = 2; // at least <@|!><N>ame must be
-static const char kSomeCludeAfterRecursedPostStringMinSize = 2; // at least <@|!><N>ame must be
-*/
-static const CSwitchForm kSwitchForms[kNumSwitches] =
- {
- { L"?", NSwitchType::kSimple, false },
- { L"H", NSwitchType::kSimple, false },
- { L"BD", NSwitchType::kSimple, false },
- { L"Y", NSwitchType::kSimple, false },
- { L"P", NSwitchType::kUnLimitedPostString, false, 1 },
- { L"O", NSwitchType::kUnLimitedPostString, false, 1 },
- };
-
-static const int kNumCommandForms = 3;
-
-namespace NCommandType {
-enum EEnum
-{
- kTest = 0,
- // kExtract,
- kFullExtract,
- kList
-};
-
-}
-
-static const CCommandForm commandForms[kNumCommandForms] =
-{
- { L"T", false },
- // { "E", false },
- { L"X", false },
- { L"L", false }
-};
-
-static const NRecursedType::EEnum kCommandRecursedDefault[kNumCommandForms] =
-{
- NRecursedType::kRecursed
-};
-
-// static const bool kTestExtractRecursedDefault = true;
-// static const bool kAddRecursedDefault = false;
-
-static const wchar_t *kUniversalWildcard = L"*";
-static const int kCommandIndex = 0;
-
-static const char *kHelpString =
- "\nUsage: 7zSFX [<command>] [<switches>...]\n"
- "\n"
- "<Commands>\n"
- " l: List contents of archive\n"
- " t: Test integrity of archive\n"
- " x: eXtract files with full pathname (default)\n"
- "<Switches>\n"
- // " -bd Disable percentage indicator\n"
- " -o{Directory}: set Output directory\n"
- " -p{Password}: set Password\n"
- " -y: assume Yes on all queries\n";
-
-
-// ---------------------------
-// exception messages
-
-static const char *kUserErrorMessage = "Incorrect command line"; // NExitCode::kUserError
-// static const char *kIncorrectListFile = "Incorrect wildcard in listfile";
-static const char *kIncorrectWildCardInCommandLine = "Incorrect wildcard in command line";
-
-// static const CSysString kFileIsNotArchiveMessageBefore = "File \"";
-// static const CSysString kFileIsNotArchiveMessageAfter = "\" is not archive";
-
-// static const char *kProcessArchiveMessage = " archive: ";
-
-static const char *kCantFindSFX = " cannot find sfx";
-
-
-struct CArchiveCommand
-{
- NCommandType::EEnum CommandType;
- NRecursedType::EEnum DefaultRecursedType() const;
-};
-
-NRecursedType::EEnum CArchiveCommand::DefaultRecursedType() const
-{
- return kCommandRecursedDefault[CommandType];
-}
-
-void PrintHelp(void)
-{
- g_StdOut << kHelpString;
-}
-
-static void ShowMessageAndThrowException(const char *message, NExitCode::EEnum code)
-{
- g_StdOut << message << endl;
- throw code;
-}
-
-static void PrintHelpAndExit() // yyy
-{
- PrintHelp();
- ShowMessageAndThrowException(kUserErrorMessage, NExitCode::kUserError);
-}
-
-bool ParseArchiveCommand(const UString &commandString, CArchiveCommand &command)
-{
- UString commandStringUpper = commandString;
- commandStringUpper.MakeUpper();
- UString postString;
- int commandIndex = ParseCommand(kNumCommandForms, commandForms, commandStringUpper,
- postString) ;
- if (commandIndex < 0)
- return false;
- command.CommandType = (NCommandType::EEnum)commandIndex;
- return true;
-}
-
-// ------------------------------------------------------------------
-// filenames functions
-
-static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
- const UString &name, bool include, NRecursedType::EEnum type)
-{
- /*
- if(!IsWildCardFilePathLegal(name))
- return false;
- */
- bool isWildCard = DoesNameContainWildCard(name);
- bool recursed = false;
-
- switch (type)
- {
- case NRecursedType::kWildCardOnlyRecursed:
- recursed = isWildCard;
- break;
- case NRecursedType::kRecursed:
- recursed = true;
- break;
- case NRecursedType::kNonRecursed:
- recursed = false;
- break;
- }
- wildcardCensor.AddItem(include, name, recursed);
- return true;
-}
-
-void AddCommandLineWildCardToCensor(NWildcard::CCensor &wildcardCensor,
- const UString &name, bool include, NRecursedType::EEnum type)
-{
- if (!AddNameToCensor(wildcardCensor, name, include, type))
- ShowMessageAndThrowException(kIncorrectWildCardInCommandLine, NExitCode::kUserError);
-}
-
-void AddToCensorFromNonSwitchesStrings(NWildcard::CCensor &wildcardCensor,
- const UStringVector & /* nonSwitchStrings */, NRecursedType::EEnum type,
- bool /* thereAreSwitchIncludeWildCards */)
-{
- AddCommandLineWildCardToCensor(wildcardCensor, kUniversalWildcard, true, type);
-}
-
-
-#ifndef _WIN32
-static void GetArguments(int numArguments, const char *arguments[], UStringVector &parts)
-{
- parts.Clear();
- for(int i = 0; i < numArguments; i++)
- {
- UString s = MultiByteToUnicodeString(arguments[i]);
- parts.Add(s);
- }
-}
-#endif
-
-int Main2(
- #ifndef _WIN32
- int numArguments, const char *arguments[]
- #endif
-)
-{
- #ifdef _WIN32
- SetFileApisToOEM();
- #endif
-
- UStringVector commandStrings;
- #ifdef _WIN32
- NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
- #else
- extern void mySplitCommandLine(int numArguments,const char *arguments[],UStringVector &parts);
- mySplitCommandLine(numArguments,arguments,commandStrings);
- #endif
-
- // After mySplitCommandLine
- g_StdOut << kCopyrightString << " (locale=" << my_getlocale() <<",Utf16=";
- if (global_use_utf16_conversion) g_StdOut << "on";
- else g_StdOut << "off";
- g_StdOut << ",HugeFiles=";
- if (sizeof(off_t) >= 8) g_StdOut << "on,";
- else g_StdOut << "off,";
- int nbcpu = NWindows::NSystem::GetNumberOfProcessors();
- if (nbcpu > 1) g_StdOut << nbcpu << " CPUs)\n";
- else g_StdOut << nbcpu << " CPU)\n";
-
- UString arcPath = commandStrings.Front();
-
- commandStrings.Delete(0);
-
- NCommandLineParser::CParser parser(kNumSwitches);
- try
- {
- parser.ParseStrings(kSwitchForms, commandStrings);
- }
- catch(...)
- {
- PrintHelpAndExit();
- }
-
- if(parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs)
- {
- PrintHelp();
- return 0;
- }
- const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
-
- int numNonSwitchStrings = nonSwitchStrings.Size();
-
- CArchiveCommand command;
- if (numNonSwitchStrings == 0)
- command.CommandType = NCommandType::kFullExtract;
- else
- {
- if (numNonSwitchStrings > 1)
- PrintHelpAndExit();
- if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], command))
- PrintHelpAndExit();
- }
-
-
- NRecursedType::EEnum recursedType;
- recursedType = command.DefaultRecursedType();
-
- NWildcard::CCensor wildcardCensor;
-
- bool thereAreSwitchIncludeWildCards;
- thereAreSwitchIncludeWildCards = false;
- AddToCensorFromNonSwitchesStrings(wildcardCensor, nonSwitchStrings, recursedType,
- thereAreSwitchIncludeWildCards);
-
- bool yesToAll = parser[NKey::kYes].ThereIs;
-
- // NExtractMode::EEnum extractMode;
- // bool isExtractGroupCommand = command.IsFromExtractGroup(extractMode);
-
- bool passwordEnabled = parser[NKey::kPassword].ThereIs;
-
- UString password;
- if(passwordEnabled)
- password = parser[NKey::kPassword].PostStrings[0];
-
- if (!NFind::DoesFileExist(arcPath))
- throw kCantFindSFX;
-
- UString outputDir;
- if (parser[NKey::kOutputDir].ThereIs)
- {
- outputDir = parser[NKey::kOutputDir].PostStrings[0];
- NName::NormalizeDirPathPrefix(outputDir);
- }
-
- {
- UStringVector v1, v2;
- v1.Add(arcPath);
- v2.Add(arcPath);
- const NWildcard::CCensorNode &wildcardCensorHead =
- wildcardCensor.Pairs.Front().Head;
-
- CCodecs *codecs = new CCodecs;
- CMyComPtr<
- #ifdef EXTERNAL_CODECS
- ICompressCodecsInfo
- #else
- IUnknown
- #endif
- > compressCodecsInfo = codecs;
- HRESULT result = codecs->Load();
- if (result != S_OK)
- throw CSystemException(result);
-
- if(command.CommandType != NCommandType::kList)
- {
- CExtractCallbackConsole *ecs = new CExtractCallbackConsole;
- CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
- ecs->OutStream = g_StdStream;
-
- #ifndef _NO_CRYPTO
- ecs->PasswordIsDefined = passwordEnabled;
- ecs->Password = password;
- #endif
-
- ecs->Init();
-
- COpenCallbackConsole openCallback;
- openCallback.OutStream = g_StdStream;
-
- #ifndef _NO_CRYPTO
- openCallback.PasswordIsDefined = passwordEnabled;
- openCallback.Password = password;
- #endif
-
- CExtractOptions eo;
- eo.StdOutMode = false;
- eo.PathMode = NExtract::NPathMode::kFullPathnames;
- eo.TestMode = command.CommandType == NCommandType::kTest;
- eo.OverwriteMode = yesToAll ?
- NExtract::NOverwriteMode::kWithoutPrompt :
- NExtract::NOverwriteMode::kAskBefore;
- eo.OutputDir = outputDir;
- eo.YesToAll = yesToAll;
-
- UString errorMessage;
- CDecompressStat stat;
- HRESULT result = DecompressArchives(
- codecs, CIntVector(),
- v1, v2,
- wildcardCensorHead,
- eo, &openCallback, ecs, errorMessage, stat);
- if (!errorMessage.IsEmpty())
- {
- (*g_StdStream) << endl << "Error: " << errorMessage;;
- if (result == S_OK)
- result = E_FAIL;
- }
-
- if (ecs->NumArchiveErrors != 0 || ecs->NumFileErrors != 0)
- {
- if (ecs->NumArchiveErrors != 0)
- (*g_StdStream) << endl << "Archive Errors: " << ecs->NumArchiveErrors << endl;
- if (ecs->NumFileErrors != 0)
- (*g_StdStream) << endl << "Sub items Errors: " << ecs->NumFileErrors << endl;
- return NExitCode::kFatalError;
- }
- if (result != S_OK)
- throw CSystemException(result);
- }
- else
- {
- UInt64 numErrors = 0;
- HRESULT result = ListArchives(
- codecs, CIntVector(),
- false,
- v1, v2,
- wildcardCensorHead,
- true, false,
- #ifndef _NO_CRYPTO
- passwordEnabled, password,
- #endif
- numErrors);
- if (numErrors > 0)
- {
- g_StdOut << endl << "Errors: " << numErrors;
- return NExitCode::kFatalError;
- }
- if (result != S_OK)
- throw CSystemException(result);
- }
- }
- return 0;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/CMAKE/CMakeLists_Alone.txt b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/CMAKE/CMakeLists_Alone.txt
deleted file mode 100644
index a9e0438cd..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/CMAKE/CMakeLists_Alone.txt
+++ /dev/null
@@ -1,251 +0,0 @@
-cmake_minimum_required(VERSION 2.6)
-
-project(p7zip)
-
-IF(HAVE_WCHAR_H)
- OPTION(HAVE_UNICODE_WCHAR "Enable Unicode Support" YES)
- MARK_AS_ADVANCED(HAVE_UNICODE_WCHAR)
-ELSE(HAVE_WCHAR_H)
- SET(HAVE_UNICODE_WCHAR 0)
-ENDIF(HAVE_WCHAR_H)
-
-SET(HAVE_PTHREADS 0)
-FIND_PACKAGE(Threads)
-IF(WIN32 OR CMAKE_USE_PTHREADS_INIT)
- SET(HAVE_PTHREADS 1)
-ENDIF(WIN32 OR CMAKE_USE_PTHREADS_INIT)
-
-include_directories(
- ../../../myWindows
- ../../../
- ../../../include_windows
-)
-
-add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNDEBUG -D_REENTRANT -DENV_UNIX -DCOMPRESS_MT -DCOMPRESS_BZIP2_MT -DCOMPRESS_MF_MT -DBREAK_HANDLER -DBENCH_MT)
-
-add_executable(7za
-
- ../../../myWindows/myGetTickCount.cpp
- ../../../myWindows/wine_date_and_time.cpp
- ../../../myWindows/myAddExeFlag.cpp
- ../../../myWindows/mySplitCommandLine.cpp
-
- ../../UI/Console/ConsoleClose.cpp
- ../../UI/Console/ExtractCallbackConsole.cpp
- ../../UI/Console/List.cpp
- ../../UI/Console/Main.cpp
- ../../UI/Console/MainAr.cpp
- ../../UI/Console/OpenCallbackConsole.cpp
- ../../UI/Console/PercentPrinter.cpp
- ../../UI/Console/UpdateCallbackConsole.cpp
- ../../UI/Console/UserInputUtils.cpp
-
- ../../../Common/CommandLineParser.cpp
- ../../../Common/CRC.cpp
- ../../../Common/IntToString.cpp
- ../../../Common/ListFileUtils.cpp
- ../../../Common/StdInStream.cpp
- ../../../Common/StdOutStream.cpp
- ../../../Common/MyString.cpp
- ../../../Common/MyWindows.cpp
- ../../../Common/StringConvert.cpp
- ../../../Common/StringToInt.cpp
- ../../../Common/UTFConvert.cpp
- ../../../Common/MyVector.cpp
- ../../../Common/Wildcard.cpp
-
- ../../../Windows/Error.cpp
- ../../../Windows/FileDir.cpp
- ../../../Windows/FileFind.cpp
- ../../../Windows/FileIO.cpp
- ../../../Windows/FileName.cpp
- ../../../Windows/PropVariant.cpp
- ../../../Windows/PropVariantConversions.cpp
- ../../../Windows/Synchronization.cpp
- ../../../Windows/System.cpp
- ../../../Windows/Time.cpp
-
- ../../Common/CreateCoder.cpp
- ../../Common/CWrappers.cpp
- ../../Common/FilePathAutoRename.cpp
- ../../Common/FileStreams.cpp
- ../../Common/FilterCoder.cpp
- ../../Common/InBuffer.cpp
- ../../Common/InOutTempBuffer.cpp
- ../../Common/LimitedStreams.cpp
- ../../Common/LockedStream.cpp
- ../../Common/MemBlocks.cpp
- ../../Common/MethodId.cpp
- ../../Common/MethodProps.cpp
- ../../Common/OffsetStream.cpp
- ../../Common/OutBuffer.cpp
- ../../Common/OutMemStream.cpp
- ../../Common/ProgressMt.cpp
- ../../Common/ProgressUtils.cpp
- ../../Common/StreamBinder.cpp
- ../../Common/StreamObjects.cpp
- ../../Common/StreamUtils.cpp
- ../../Common/VirtThread.cpp
-
- ../../UI/Common/ArchiveCommandLine.cpp
- ../../UI/Common/ArchiveExtractCallback.cpp
- ../../UI/Common/ArchiveOpenCallback.cpp
- ../../UI/Common/DefaultName.cpp
- ../../UI/Common/EnumDirItems.cpp
- ../../UI/Common/Extract.cpp
- ../../UI/Common/ExtractingFilePath.cpp
- ../../UI/Common/LoadCodecs.cpp
- ../../UI/Common/OpenArchive.cpp
- ../../UI/Common/PropIDUtils.cpp
- ../../UI/Common/SetProperties.cpp
- ../../UI/Common/SortUtils.cpp
- ../../UI/Common/TempFiles.cpp
- ../../UI/Common/Update.cpp
- ../../UI/Common/UpdateAction.cpp
- ../../UI/Common/UpdateCallback.cpp
- ../../UI/Common/UpdatePair.cpp
- ../../UI/Common/UpdateProduce.cpp
-
- ../../Archive/Bz2Handler.cpp
- ../../Archive/GzHandler.cpp
- ../../Archive/LzmaHandler.cpp
- ../../Archive/SplitHandler.cpp
- ../../Archive/XzHandler.cpp
- ../../Archive/ZHandler.cpp
-
- ../../Archive/Common/CoderMixer2.cpp
- ../../Archive/Common/CoderMixer2MT.cpp
- ../../Archive/Common/CrossThreadProgress.cpp
- ../../Archive/Common/DummyOutStream.cpp
- ../../Archive/Common/FindSignature.cpp
- ../../Archive/Common/HandlerOut.cpp
- ../../Archive/Common/InStreamWithCRC.cpp
- ../../Archive/Common/ItemNameUtils.cpp
- ../../Archive/Common/MultiStream.cpp
- ../../Archive/Common/OutStreamWithCRC.cpp
- ../../Archive/Common/ParseProperties.cpp
-
- ../../Archive/7z/7zCompressionMode.cpp
- ../../Archive/7z/7zDecode.cpp
- ../../Archive/7z/7zEncode.cpp
- ../../Archive/7z/7zExtract.cpp
- ../../Archive/7z/7zFolderInStream.cpp
- ../../Archive/7z/7zFolderOutStream.cpp
- ../../Archive/7z/7zHandler.cpp
- ../../Archive/7z/7zHandlerOut.cpp
- ../../Archive/7z/7zHeader.cpp
- ../../Archive/7z/7zIn.cpp
- ../../Archive/7z/7zOut.cpp
- ../../Archive/7z/7zProperties.cpp
- ../../Archive/7z/7zSpecStream.cpp
- ../../Archive/7z/7zUpdate.cpp
- ../../Archive/7z/7zRegister.cpp
-
- ../../Archive/Cab/CabBlockInStream.cpp
- ../../Archive/Cab/CabHandler.cpp
- ../../Archive/Cab/CabHeader.cpp
- ../../Archive/Cab/CabIn.cpp
- ../../Archive/Cab/CabRegister.cpp
-
- ../../Archive/Tar/TarHandler.cpp
- ../../Archive/Tar/TarHandlerOut.cpp
- ../../Archive/Tar/TarHeader.cpp
- ../../Archive/Tar/TarIn.cpp
- ../../Archive/Tar/TarOut.cpp
- ../../Archive/Tar/TarRegister.cpp
- ../../Archive/Tar/TarUpdate.cpp
-
- ../../Archive/Zip/ZipAddCommon.cpp
- ../../Archive/Zip/ZipHandler.cpp
- ../../Archive/Zip/ZipHandlerOut.cpp
- ../../Archive/Zip/ZipHeader.cpp
- ../../Archive/Zip/ZipIn.cpp
- ../../Archive/Zip/ZipItem.cpp
- ../../Archive/Zip/ZipOut.cpp
- ../../Archive/Zip/ZipUpdate.cpp
- ../../Archive/Zip/ZipRegister.cpp
-
- ../../Compress/Bcj2Coder.cpp
- ../../Compress/Bcj2Register.cpp
- ../../Compress/BcjCoder.cpp
- ../../Compress/BcjRegister.cpp
- ../../Compress/BitlDecoder.cpp
- ../../Compress/BranchCoder.cpp
- ../../Compress/BranchMisc.cpp
- ../../Compress/BranchRegister.cpp
- ../../Compress/ByteSwap.cpp
- ../../Compress/BZip2Crc.cpp
- ../../Compress/BZip2Decoder.cpp
- ../../Compress/BZip2Encoder.cpp
- ../../Compress/BZip2Register.cpp
- ../../Compress/CopyCoder.cpp
- ../../Compress/CopyRegister.cpp
- ../../Compress/Deflate64Register.cpp
- ../../Compress/DeflateDecoder.cpp
- ../../Compress/DeflateEncoder.cpp
- ../../Compress/DeflateRegister.cpp
- ../../Compress/DeltaFilter.cpp
- ../../Compress/ImplodeDecoder.cpp
- ../../Compress/ImplodeHuffmanDecoder.cpp
- ../../Compress/Lzma2Decoder.cpp
- ../../Compress/Lzma2Encoder.cpp
- ../../Compress/Lzma2Register.cpp
- ../../Compress/LzmaDecoder.cpp
- ../../Compress/LzmaEncoder.cpp
- ../../Compress/LzmaRegister.cpp
- ../../Compress/LzOutWindow.cpp
- ../../Compress/Lzx86Converter.cpp
- ../../Compress/LzxDecoder.cpp
- ../../Compress/PpmdDecoder.cpp
- ../../Compress/PpmdEncoder.cpp
- ../../Compress/PpmdRegister.cpp
- ../../Compress/QuantumDecoder.cpp
- ../../Compress/ShrinkDecoder.cpp
- ../../Compress/ZDecoder.cpp
-
- ../../Compress/LZMA_Alone/LzmaBench.cpp
- ../../Compress/LZMA_Alone/LzmaBenchCon.cpp
-
- ../../Crypto/7zAes.cpp
- ../../Crypto/7zAesRegister.cpp
- ../../Crypto/HmacSha1.cpp
- ../../Crypto/MyAes.cpp
- ../../Crypto/Pbkdf2HmacSha1.cpp
- ../../Crypto/RandGen.cpp
- ../../Crypto/Sha1.cpp
- ../../Crypto/WzAes.cpp
- ../../Crypto/ZipCrypto.cpp
- ../../Crypto/ZipStrong.cpp
-
- ../../../../C/Aes.c
- ../../../../C/7zStream.c
- ../../../../C/Bra.c
- ../../../../C/Bra86.c
- ../../../../C/BraIA64.c
- ../../../../C/BwtSort.c
- ../../../../C/Delta.c
- ../../../../C/HuffEnc.c
- ../../../../C/LzFind.c
- ../../../../C/LzFindMt.c
- ../../../../C/Lzma2Dec.c
- ../../../../C/Lzma2Enc.c
- ../../../../C/LzmaDec.c
- ../../../../C/LzmaEnc.c
- ../../../../C/MtCoder.c
- ../../../../C/Sha256.c
- ../../../../C/Sort.c
- ../../../../C/Threads.c
- ../../../../C/Xz.c
- ../../../../C/XzCrc64.c
- ../../../../C/XzDec.c
- ../../../../C/XzEnc.c
- ../../../../C/XzIn.c
-
- ../../../../C/7zCrc.c
-
- )
-
-IF(HAVE_PTHREADS)
- TARGET_LINK_LIBRARIES(7za ${CMAKE_THREAD_LIBS_INIT})
-ENDIF(HAVE_PTHREADS)
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/CMAKE/generate.sh b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/CMAKE/generate.sh
deleted file mode 100644
index 4c39a1c53..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/CMAKE/generate.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-
-#TARGET="Unix Makefiles"
-TARGET="CodeBlocks - Unix Makefiles"
-#TARGET="KDevelop3"
-#TARGET="Eclipse CDT4 - Unix Makefiles"
-
-rm -fr Alone
-mkdir Alone
-cd Alone
-cp ../CMakeLists_Alone.txt CMakeLists.txt
-
-cmake -G "${TARGET}" -DCMAKE_BUILD_TYPE=Debug
-#cmake -G "${TARGET}" -DCMAKE_BUILD_TYPE=Release
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CWrappers.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CWrappers.cpp
deleted file mode 100644
index d440027d9..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CWrappers.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-// CWrappers.h
-
-#include "StdAfx.h"
-
-#include "CWrappers.h"
-
-#include "StreamUtils.h"
-
-#define PROGRESS_UNKNOWN_VALUE ((UInt64)(Int64)-1)
-
-#define CONVERT_PR_VAL(x) (x == PROGRESS_UNKNOWN_VALUE ? NULL : &x)
-
-static SRes CompressProgress(void *pp, UInt64 inSize, UInt64 outSize)
-{
- CCompressProgressWrap *p = (CCompressProgressWrap *)pp;
- p->Res = p->Progress->SetRatioInfo(CONVERT_PR_VAL(inSize), CONVERT_PR_VAL(outSize));
- return (SRes)p->Res;
-}
-
-CCompressProgressWrap::CCompressProgressWrap(ICompressProgressInfo *progress)
-{
- p.Progress = CompressProgress;
- Progress = progress;
- Res = SZ_OK;
-}
-
-static const UInt32 kStreamStepSize = (UInt32)1 << 31;
-
-SRes HRESULT_To_SRes(HRESULT res, SRes defaultRes)
-{
- switch(res)
- {
- case S_OK: return SZ_OK;
- case E_OUTOFMEMORY: return SZ_ERROR_MEM;
- case E_INVALIDARG: return SZ_ERROR_PARAM;
- case E_ABORT: return SZ_ERROR_PROGRESS;
- case S_FALSE: return SZ_ERROR_DATA;
- }
- return defaultRes;
-}
-
-static SRes MyRead(void *object, void *data, size_t *size)
-{
- CSeqInStreamWrap *p = (CSeqInStreamWrap *)object;
- UInt32 curSize = ((*size < kStreamStepSize) ? (UInt32)*size : kStreamStepSize);
- p->Res = (p->Stream->Read(data, curSize, &curSize));
- *size = curSize;
- if (p->Res == S_OK)
- return SZ_OK;
- return HRESULT_To_SRes(p->Res, SZ_ERROR_READ);
-}
-
-static size_t MyWrite(void *object, const void *data, size_t size)
-{
- CSeqOutStreamWrap *p = (CSeqOutStreamWrap *)object;
- if (p->Stream)
- {
- p->Res = WriteStream(p->Stream, data, size);
- if (p->Res != 0)
- return 0;
- }
- else
- p->Res = S_OK;
- p->Processed += size;
- return size;
-}
-
-CSeqInStreamWrap::CSeqInStreamWrap(ISequentialInStream *stream)
-{
- p.Read = MyRead;
- Stream = stream;
-}
-
-CSeqOutStreamWrap::CSeqOutStreamWrap(ISequentialOutStream *stream)
-{
- p.Write = MyWrite;
- Stream = stream;
- Res = SZ_OK;
- Processed = 0;
-}
-
-HRESULT SResToHRESULT(SRes res)
-{
- switch(res)
- {
- case SZ_OK: return S_OK;
- case SZ_ERROR_MEM: return E_OUTOFMEMORY;
- case SZ_ERROR_PARAM: return E_INVALIDARG;
- case SZ_ERROR_PROGRESS: return E_ABORT;
- case SZ_ERROR_DATA: return S_FALSE;
- }
- return E_FAIL;
-}
-
-static SRes InStreamWrap_Read(void *pp, void *data, size_t *size)
-{
- CSeekInStreamWrap *p = (CSeekInStreamWrap *)pp;
- UInt32 curSize = ((*size < kStreamStepSize) ? (UInt32)*size : kStreamStepSize);
- p->Res = p->Stream->Read(data, curSize, &curSize);
- *size = curSize;
- return (p->Res == S_OK) ? SZ_OK : SZ_ERROR_READ;
-}
-
-static SRes InStreamWrap_Seek(void *pp, Int64 *offset, ESzSeek origin)
-{
- CSeekInStreamWrap *p = (CSeekInStreamWrap *)pp;
- UInt32 moveMethod;
- switch(origin)
- {
- case SZ_SEEK_SET: moveMethod = STREAM_SEEK_SET; break;
- case SZ_SEEK_CUR: moveMethod = STREAM_SEEK_CUR; break;
- case SZ_SEEK_END: moveMethod = STREAM_SEEK_END; break;
- default: return SZ_ERROR_PARAM;
- }
- UInt64 newPosition;
- p->Res = p->Stream->Seek(*offset, moveMethod, &newPosition);
- *offset = (Int64)newPosition;
- return (p->Res == S_OK) ? SZ_OK : SZ_ERROR_READ;
-}
-
-CSeekInStreamWrap::CSeekInStreamWrap(IInStream *stream)
-{
- Stream = stream;
- p.Read = InStreamWrap_Read;
- p.Seek = InStreamWrap_Seek;
- Res = S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CWrappers.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CWrappers.h
deleted file mode 100644
index f7ac96cb9..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CWrappers.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// CWrappers.h
-
-#ifndef __C_WRAPPERS_H
-#define __C_WRAPPERS_H
-
-#include "../../../C/Types.h"
-
-#include "../ICoder.h"
-#include "../../Common/MyCom.h"
-
-struct CCompressProgressWrap
-{
- ICompressProgress p;
- ICompressProgressInfo *Progress;
- HRESULT Res;
- CCompressProgressWrap(ICompressProgressInfo *progress);
-};
-
-struct CSeqInStreamWrap
-{
- ISeqInStream p;
- ISequentialInStream *Stream;
- HRESULT Res;
- CSeqInStreamWrap(ISequentialInStream *stream);
-};
-
-struct CSeekInStreamWrap
-{
- ISeekInStream p;
- IInStream *Stream;
- HRESULT Res;
- CSeekInStreamWrap(IInStream *stream);
-};
-
-struct CSeqOutStreamWrap
-{
- ISeqOutStream p;
- ISequentialOutStream *Stream;
- HRESULT Res;
- UInt64 Processed;
- CSeqOutStreamWrap(ISequentialOutStream *stream);
-};
-
-HRESULT SResToHRESULT(SRes res);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CreateCoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CreateCoder.cpp
deleted file mode 100644
index 2742495da..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CreateCoder.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-// CreateCoder.cpp
-
-#include "StdAfx.h"
-
-#include "CreateCoder.h"
-
-#include "../../Windows/PropVariant.h"
-#include "../../Windows/Defs.h"
-#include "FilterCoder.h"
-#include "RegisterCodec.h"
-
-static const unsigned int kNumCodecsMax = 64;
-unsigned int g_NumCodecs = 0;
-const CCodecInfo *g_Codecs[kNumCodecsMax];
-void RegisterCodec(const CCodecInfo *codecInfo)
-{
- if (g_NumCodecs < kNumCodecsMax)
- g_Codecs[g_NumCodecs++] = codecInfo;
-}
-
-#ifdef EXTERNAL_CODECS
-static HRESULT ReadNumberOfStreams(ICompressCodecsInfo *codecsInfo, UInt32 index, PROPID propID, UInt32 &res)
-{
- NWindows::NCOM::CPropVariant prop;
- RINOK(codecsInfo->GetProperty(index, propID, &prop));
- if (prop.vt == VT_EMPTY)
- res = 1;
- else if (prop.vt == VT_UI4)
- res = prop.ulVal;
- else
- return E_INVALIDARG;
- return S_OK;
-}
-
-static HRESULT ReadIsAssignedProp(ICompressCodecsInfo *codecsInfo, UInt32 index, PROPID propID, bool &res)
-{
- NWindows::NCOM::CPropVariant prop;
- RINOK(codecsInfo->GetProperty(index, propID, &prop));
- if (prop.vt == VT_EMPTY)
- res = true;
- else if (prop.vt == VT_BOOL)
- res = VARIANT_BOOLToBool(prop.boolVal);
- else
- return E_INVALIDARG;
- return S_OK;
-}
-
-HRESULT LoadExternalCodecs(ICompressCodecsInfo *codecsInfo, CObjectVector<CCodecInfoEx> &externalCodecs)
-{
- UInt32 num;
- RINOK(codecsInfo->GetNumberOfMethods(&num));
- for (UInt32 i = 0; i < num; i++)
- {
- CCodecInfoEx info;
- NWindows::NCOM::CPropVariant prop;
- RINOK(codecsInfo->GetProperty(i, NMethodPropID::kID, &prop));
- // if (prop.vt != VT_BSTR)
- // info.Id.IDSize = (Byte)SysStringByteLen(prop.bstrVal);
- // memmove(info.Id.ID, prop.bstrVal, info.Id.IDSize);
- if (prop.vt != VT_UI8)
- {
- continue; // old Interface
- // return E_INVALIDARG;
- }
- info.Id = prop.uhVal.QuadPart;
- prop.Clear();
-
- RINOK(codecsInfo->GetProperty(i, NMethodPropID::kName, &prop));
- if (prop.vt == VT_BSTR)
- info.Name = prop.bstrVal;
- else if (prop.vt != VT_EMPTY)
- return E_INVALIDARG;;
-
- RINOK(ReadNumberOfStreams(codecsInfo, i, NMethodPropID::kInStreams, info.NumInStreams));
- RINOK(ReadNumberOfStreams(codecsInfo, i, NMethodPropID::kOutStreams, info.NumOutStreams));
- RINOK(ReadIsAssignedProp(codecsInfo, i, NMethodPropID::kEncoderIsAssigned, info.EncoderIsAssigned));
- RINOK(ReadIsAssignedProp(codecsInfo, i, NMethodPropID::kDecoderIsAssigned, info.DecoderIsAssigned));
-
- externalCodecs.Add(info);
- }
- return S_OK;
-}
-
-#endif
-
-bool FindMethod(
- #ifdef EXTERNAL_CODECS
- ICompressCodecsInfo * /* codecsInfo */, const CObjectVector<CCodecInfoEx> *externalCodecs,
- #endif
- const UString &name,
- CMethodId &methodId, UInt32 &numInStreams, UInt32 &numOutStreams)
-{
- UInt32 i;
- for (i = 0; i < g_NumCodecs; i++)
- {
- const CCodecInfo &codec = *g_Codecs[i];
- if (name.CompareNoCase(codec.Name) == 0)
- {
- methodId = codec.Id;
- numInStreams = codec.NumInStreams;
- numOutStreams = 1;
- return true;
- }
- }
- #ifdef EXTERNAL_CODECS
- if (externalCodecs)
- for (i = 0; i < (UInt32)externalCodecs->Size(); i++)
- {
- const CCodecInfoEx &codec = (*externalCodecs)[i];
- if (codec.Name.CompareNoCase(name) == 0)
- {
- methodId = codec.Id;
- numInStreams = codec.NumInStreams;
- numOutStreams = codec.NumOutStreams;
- return true;
- }
- }
- #endif
- return false;
-}
-
-bool FindMethod(
- #ifdef EXTERNAL_CODECS
- ICompressCodecsInfo * /* codecsInfo */, const CObjectVector<CCodecInfoEx> *externalCodecs,
- #endif
- CMethodId methodId, UString &name)
-{
- UInt32 i;
- for (i = 0; i < g_NumCodecs; i++)
- {
- const CCodecInfo &codec = *g_Codecs[i];
- if (methodId == codec.Id)
- {
- name = codec.Name;
- return true;
- }
- }
- #ifdef EXTERNAL_CODECS
- if (externalCodecs)
- for (i = 0; i < (UInt32)externalCodecs->Size(); i++)
- {
- const CCodecInfoEx &codec = (*externalCodecs)[i];
- if (methodId == codec.Id)
- {
- name = codec.Name;
- return true;
- }
- }
- #endif
- return false;
-}
-
-HRESULT CreateCoder(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CMethodId methodId,
- CMyComPtr<ICompressFilter> &filter,
- CMyComPtr<ICompressCoder> &coder,
- CMyComPtr<ICompressCoder2> &coder2,
- bool encode, bool onlyCoder)
-{
- bool created = false;
- UInt32 i;
- for (i = 0; i < g_NumCodecs; i++)
- {
- const CCodecInfo &codec = *g_Codecs[i];
- if (codec.Id == methodId)
- {
- if (encode)
- {
- if (codec.CreateEncoder)
- {
- void *p = codec.CreateEncoder();
- if (codec.IsFilter) filter = (ICompressFilter *)p;
- else if (codec.NumInStreams == 1) coder = (ICompressCoder *)p;
- else coder2 = (ICompressCoder2 *)p;
- created = (p != 0);
- break;
- }
- }
- else
- if (codec.CreateDecoder)
- {
- void *p = codec.CreateDecoder();
- if (codec.IsFilter) filter = (ICompressFilter *)p;
- else if (codec.NumInStreams == 1) coder = (ICompressCoder *)p;
- else coder2 = (ICompressCoder2 *)p;
- created = (p != 0);
- break;
- }
- }
- }
-
- #ifdef EXTERNAL_CODECS
- if (!created && externalCodecs)
- for (i = 0; i < (UInt32)externalCodecs->Size(); i++)
- {
- const CCodecInfoEx &codec = (*externalCodecs)[i];
- if (codec.Id == methodId)
- {
- if (encode)
- {
- if (codec.EncoderIsAssigned)
- {
- if (codec.IsSimpleCodec())
- {
- HRESULT result = codecsInfo->CreateEncoder(i, &IID_ICompressCoder, (void **)&coder);
- if (result != S_OK && result != E_NOINTERFACE && result != CLASS_E_CLASSNOTAVAILABLE)
- return result;
- if (!coder)
- {
- RINOK(codecsInfo->CreateEncoder(i, &IID_ICompressFilter, (void **)&filter));
- }
- }
- else
- {
- RINOK(codecsInfo->CreateEncoder(i, &IID_ICompressCoder2, (void **)&coder2));
- }
- break;
- }
- }
- else
- if (codec.DecoderIsAssigned)
- {
- if (codec.IsSimpleCodec())
- {
- HRESULT result = codecsInfo->CreateDecoder(i, &IID_ICompressCoder, (void **)&coder);
- if (result != S_OK && result != E_NOINTERFACE && result != CLASS_E_CLASSNOTAVAILABLE)
- return result;
- if (!coder)
- {
- RINOK(codecsInfo->CreateDecoder(i, &IID_ICompressFilter, (void **)&filter));
- }
- }
- else
- {
- RINOK(codecsInfo->CreateDecoder(i, &IID_ICompressCoder2, (void **)&coder2));
- }
- break;
- }
- }
- }
- #endif
-
- if (onlyCoder && filter)
- {
- CFilterCoder *coderSpec = new CFilterCoder;
- coder = coderSpec;
- coderSpec->Filter = filter;
- }
- return S_OK;
-}
-
-HRESULT CreateCoder(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CMethodId methodId,
- CMyComPtr<ICompressCoder> &coder,
- CMyComPtr<ICompressCoder2> &coder2,
- bool encode)
-{
- CMyComPtr<ICompressFilter> filter;
- return CreateCoder(
- EXTERNAL_CODECS_LOC_VARS
- methodId,
- filter, coder, coder2, encode, true);
-}
-
-HRESULT CreateCoder(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CMethodId methodId,
- CMyComPtr<ICompressCoder> &coder, bool encode)
-{
- CMyComPtr<ICompressFilter> filter;
- CMyComPtr<ICompressCoder2> coder2;
- return CreateCoder(
- EXTERNAL_CODECS_LOC_VARS
- methodId,
- coder, coder2, encode);
-}
-
-HRESULT CreateFilter(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CMethodId methodId,
- CMyComPtr<ICompressFilter> &filter,
- bool encode)
-{
- CMyComPtr<ICompressCoder> coder;
- CMyComPtr<ICompressCoder2> coder2;
- return CreateCoder(
- EXTERNAL_CODECS_LOC_VARS
- methodId,
- filter, coder, coder2, encode, false);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CreateCoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CreateCoder.h
deleted file mode 100644
index 1fcc13431..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/CreateCoder.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// CreateCoder.h
-
-#ifndef __CREATECODER_H
-#define __CREATECODER_H
-
-#include "Common/MyCom.h"
-#include "Common/MyString.h"
-#include "../ICoder.h"
-
-#include "MethodId.h"
-
-#ifdef EXTERNAL_CODECS
-
-struct CCodecInfoEx
-{
- UString Name;
- CMethodId Id;
- UInt32 NumInStreams;
- UInt32 NumOutStreams;
- bool EncoderIsAssigned;
- bool DecoderIsAssigned;
- bool IsSimpleCodec() const { return NumOutStreams == 1 && NumInStreams == 1; }
- CCodecInfoEx(): EncoderIsAssigned(false), DecoderIsAssigned(false) {}
-};
-
-HRESULT LoadExternalCodecs(ICompressCodecsInfo *codecsInfo, CObjectVector<CCodecInfoEx> &externalCodecs);
-
-#define PUBLIC_ISetCompressCodecsInfo public ISetCompressCodecsInfo,
-#define QUERY_ENTRY_ISetCompressCodecsInfo MY_QUERYINTERFACE_ENTRY(ISetCompressCodecsInfo)
-#define DECL_ISetCompressCodecsInfo STDMETHOD(SetCompressCodecsInfo)(ICompressCodecsInfo *compressCodecsInfo);
-#define IMPL_ISetCompressCodecsInfo2(x) \
-STDMETHODIMP x::SetCompressCodecsInfo(ICompressCodecsInfo *compressCodecsInfo) { \
- COM_TRY_BEGIN _codecsInfo = compressCodecsInfo; return LoadExternalCodecs(_codecsInfo, _externalCodecs); COM_TRY_END }
-#define IMPL_ISetCompressCodecsInfo IMPL_ISetCompressCodecsInfo2(CHandler)
-
-#define EXTERNAL_CODECS_VARS2 _codecsInfo, &_externalCodecs
-
-#define DECL_EXTERNAL_CODECS_VARS CMyComPtr<ICompressCodecsInfo> _codecsInfo; CObjectVector<CCodecInfoEx> _externalCodecs;
-#define EXTERNAL_CODECS_VARS EXTERNAL_CODECS_VARS2,
-
-#define DECL_EXTERNAL_CODECS_LOC_VARS2 ICompressCodecsInfo *codecsInfo, const CObjectVector<CCodecInfoEx> *externalCodecs
-#define EXTERNAL_CODECS_LOC_VARS2 codecsInfo, externalCodecs
-
-#define DECL_EXTERNAL_CODECS_LOC_VARS DECL_EXTERNAL_CODECS_LOC_VARS2,
-#define EXTERNAL_CODECS_LOC_VARS EXTERNAL_CODECS_LOC_VARS2,
-
-#else
-
-#define PUBLIC_ISetCompressCodecsInfo
-#define QUERY_ENTRY_ISetCompressCodecsInfo
-#define DECL_ISetCompressCodecsInfo
-#define IMPL_ISetCompressCodecsInfo
-#define EXTERNAL_CODECS_VARS2
-#define DECL_EXTERNAL_CODECS_VARS
-#define EXTERNAL_CODECS_VARS EXTERNAL_CODECS_VARS2
-#define DECL_EXTERNAL_CODECS_LOC_VARS2
-#define EXTERNAL_CODECS_LOC_VARS2
-#define DECL_EXTERNAL_CODECS_LOC_VARS
-#define EXTERNAL_CODECS_LOC_VARS
-
-#endif
-
-bool FindMethod(
- DECL_EXTERNAL_CODECS_LOC_VARS
- const UString &name, CMethodId &methodId, UInt32 &numInStreams, UInt32 &numOutStreams);
-
-bool FindMethod(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CMethodId methodId, UString &name);
-
-
-HRESULT CreateCoder(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CMethodId methodId,
- CMyComPtr<ICompressFilter> &filter,
- CMyComPtr<ICompressCoder> &coder,
- CMyComPtr<ICompressCoder2> &coder2,
- bool encode, bool onlyCoder);
-
-HRESULT CreateCoder(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CMethodId methodId,
- CMyComPtr<ICompressCoder> &coder,
- CMyComPtr<ICompressCoder2> &coder2,
- bool encode);
-
-HRESULT CreateCoder(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CMethodId methodId,
- CMyComPtr<ICompressCoder> &coder, bool encode);
-
-HRESULT CreateFilter(
- DECL_EXTERNAL_CODECS_LOC_VARS
- CMethodId methodId,
- CMyComPtr<ICompressFilter> &filter,
- bool encode);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilePathAutoRename.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilePathAutoRename.cpp
deleted file mode 100644
index 7d6e36f14..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilePathAutoRename.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// FilePathAutoRename.cpp
-
-#include "StdAfx.h"
-
-#include "Common/Defs.h"
-#include "Common/IntToString.h"
-
-#include "Windows/FileFind.h"
-
-#include "FilePathAutoRename.h"
-
-using namespace NWindows;
-
-static bool MakeAutoName(const UString &name,
- const UString &extension, unsigned value, UString &path)
-{
- wchar_t number[16];
- ConvertUInt32ToString(value, number);
- path = name;
- path += number;
- path += extension;
- return NFile::NFind::DoesFileOrDirExist(path);
-}
-
-bool AutoRenamePath(UString &fullProcessedPath)
-{
- UString path;
- int dotPos = fullProcessedPath.ReverseFind(L'.');
-
- int slashPos = fullProcessedPath.ReverseFind(L'/');
- #ifdef _WIN32
- int slash1Pos = fullProcessedPath.ReverseFind(L'\\');
- slashPos = MyMax(slashPos, slash1Pos);
- #endif
-
- UString name, extension;
- if (dotPos > slashPos && dotPos > 0)
- {
- name = fullProcessedPath.Left(dotPos);
- extension = fullProcessedPath.Mid(dotPos);
- }
- else
- name = fullProcessedPath;
- name += L'_';
- unsigned left = 1, right = (1 << 30);
- while (left != right)
- {
- unsigned mid = (left + right) / 2;
- if (MakeAutoName(name, extension, mid, path))
- left = mid + 1;
- else
- right = mid;
- }
- return !MakeAutoName(name, extension, right, fullProcessedPath);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilePathAutoRename.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilePathAutoRename.h
deleted file mode 100644
index 3ef87f482..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilePathAutoRename.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// Util/FilePathAutoRename.h
-
-#ifndef __FILEPATHAUTORENAME_H
-#define __FILEPATHAUTORENAME_H
-
-#include "Common/MyString.h"
-
-bool AutoRenamePath(UString &fullProcessedPath);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FileStreams.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FileStreams.cpp
deleted file mode 100644
index d913f51f1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FileStreams.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-// FileStreams.cpp
-
-#include "StdAfx.h"
-
-#ifndef _WIN32
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#endif
-
-#include "FileStreams.h"
-
-static inline HRESULT ConvertBoolToHRESULT(bool result)
-{
- #ifdef _WIN32
- if (result)
- return S_OK;
- DWORD lastError = ::GetLastError();
- if (lastError == 0)
- return E_FAIL;
- return HRESULT_FROM_WIN32(lastError);
- #else
- return result ? S_OK: E_FAIL;
- #endif
-}
-
-bool CInFileStream::Open(LPCTSTR fileName)
-{
-#ifdef ENV_UNIX
- return File.Open(fileName,_ignoreSymbolicLink);
-#else
- return File.Open(fileName);
-#endif
-}
-
-#ifdef USE_WIN_FILE
-#ifndef _UNICODE
-bool CInFileStream::Open(LPCWSTR fileName)
-{
-#ifdef ENV_UNIX
- return File.Open(fileName,_ignoreSymbolicLink);
-#else
- return File.Open(fileName);
-#endif
-}
-#endif
-#endif
-
-bool CInFileStream::OpenShared(LPCTSTR fileName, bool shareForWrite)
-{
-#ifdef ENV_UNIX
- (void)shareForWrite;
- return File.Open(fileName,_ignoreSymbolicLink);
-#else
- return File.OpenShared(fileName, shareForWrite);
-#endif
-}
-
-#ifdef USE_WIN_FILE
-#ifndef _UNICODE
-bool CInFileStream::OpenShared(LPCWSTR fileName, bool shareForWrite)
-{
- return File.OpenShared(fileName, shareForWrite);
-}
-#endif
-#endif
-
-STDMETHODIMP CInFileStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- #ifdef USE_WIN_FILE
-
- UInt32 realProcessedSize;
- bool result = File.ReadPart(data, size, realProcessedSize);
- if(processedSize != NULL)
- *processedSize = realProcessedSize;
- return ConvertBoolToHRESULT(result);
-
- #else
-
- if(processedSize != NULL)
- *processedSize = 0;
- ssize_t res = File.Read(data, (size_t)size);
- if (res == -1)
- return E_FAIL;
- if(processedSize != NULL)
- *processedSize = (UInt32)res;
- return S_OK;
-
- #endif
-}
-
-#ifndef _WIN32_WCE
-STDMETHODIMP CStdInFileStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- #ifdef _WIN32
- UInt32 realProcessedSize;
- BOOL res = ::ReadFile(GetStdHandle(STD_INPUT_HANDLE),
- data, size, (DWORD *)&realProcessedSize, NULL);
- if(processedSize != NULL)
- *processedSize = realProcessedSize;
- if (res == FALSE && GetLastError() == ERROR_BROKEN_PIPE)
- return S_OK;
- return ConvertBoolToHRESULT(res != FALSE);
-
- #else
-
- if(processedSize != NULL)
- *processedSize = 0;
- ssize_t res;
- do
- {
- res = read(0, data, (size_t)size);
- }
- while (res < 0 && (errno == EINTR));
- if (res == -1)
- return E_FAIL;
- if(processedSize != NULL)
- *processedSize = (UInt32)res;
- return S_OK;
-
- #endif
-}
-
-#endif
-
-STDMETHODIMP CInFileStream::Seek(Int64 offset, UInt32 seekOrigin,
- UInt64 *newPosition)
-{
- if(seekOrigin >= 3)
- return STG_E_INVALIDFUNCTION;
-
- #ifdef USE_WIN_FILE
-
- UInt64 realNewPosition;
- bool result = File.Seek(offset, seekOrigin, realNewPosition);
- if(newPosition != NULL)
- *newPosition = realNewPosition;
- return ConvertBoolToHRESULT(result);
-
- #else
-
- off_t res = File.Seek(offset, seekOrigin);
- if (res == -1)
- return E_FAIL;
- if(newPosition != NULL)
- *newPosition = (UInt64)res;
- return S_OK;
-
- #endif
-}
-
-STDMETHODIMP CInFileStream::GetSize(UInt64 *size)
-{
- return ConvertBoolToHRESULT(File.GetLength(*size));
-}
-
-
-//////////////////////////
-// COutFileStream
-
-HRESULT COutFileStream::Close()
-{
- return ConvertBoolToHRESULT(File.Close());
-}
-
-STDMETHODIMP COutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- #ifdef USE_WIN_FILE
-
- UInt32 realProcessedSize;
- bool result = File.WritePart(data, size, realProcessedSize);
- ProcessedSize += realProcessedSize;
- if(processedSize != NULL)
- *processedSize = realProcessedSize;
- return ConvertBoolToHRESULT(result);
-
- #else
-
- if(processedSize != NULL)
- *processedSize = 0;
- ssize_t res = File.Write(data, (size_t)size);
- if (res == -1)
- return E_FAIL;
- if(processedSize != NULL)
- *processedSize = (UInt32)res;
- ProcessedSize += res;
- return S_OK;
-
- #endif
-}
-
-STDMETHODIMP COutFileStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
- if(seekOrigin >= 3)
- return STG_E_INVALIDFUNCTION;
- #ifdef USE_WIN_FILE
-
- UInt64 realNewPosition;
- bool result = File.Seek(offset, seekOrigin, realNewPosition);
- if(newPosition != NULL)
- *newPosition = realNewPosition;
- return ConvertBoolToHRESULT(result);
-
- #else
-
- off_t res = File.Seek(offset, seekOrigin);
- if (res == -1)
- return E_FAIL;
- if(newPosition != NULL)
- *newPosition = (UInt64)res;
- return S_OK;
-
- #endif
-}
-
-STDMETHODIMP COutFileStream::SetSize(Int64 newSize)
-{
- #ifdef USE_WIN_FILE
- UInt64 currentPos;
- if(!File.Seek(0, FILE_CURRENT, currentPos))
- return E_FAIL;
- bool result = File.SetLength(newSize);
- UInt64 currentPos2;
- result = result && File.Seek(currentPos, currentPos2);
- return result ? S_OK : E_FAIL;
- #else
- return E_FAIL;
- #endif
-}
-
-#ifndef _WIN32_WCE
-STDMETHODIMP CStdOutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- if(processedSize != NULL)
- *processedSize = 0;
-
- #ifdef _WIN32
- UInt32 realProcessedSize;
- BOOL res = TRUE;
- if (size > 0)
- {
- // Seems that Windows doesn't like big amounts writing to stdout.
- // So we limit portions by 32KB.
- UInt32 sizeTemp = (1 << 15);
- if (sizeTemp > size)
- sizeTemp = size;
- res = ::WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),
- data, sizeTemp, (DWORD *)&realProcessedSize, NULL);
- size -= realProcessedSize;
- data = (const void *)((const Byte *)data + realProcessedSize);
- if(processedSize != NULL)
- *processedSize += realProcessedSize;
- }
- return ConvertBoolToHRESULT(res != FALSE);
-
- #else
-
- ssize_t res;
- do
- {
- res = write(1, data, (size_t)size);
- }
- while (res < 0 && (errno == EINTR));
- if (res == -1)
- return E_FAIL;
- if(processedSize != NULL)
- *processedSize = (UInt32)res;
- return S_OK;
-
- return S_OK;
- #endif
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FileStreams.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FileStreams.h
deleted file mode 100644
index 5c7f65e11..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FileStreams.h
+++ /dev/null
@@ -1,141 +0,0 @@
-// FileStreams.h
-
-#ifndef __FILESTREAMS_H
-#define __FILESTREAMS_H
-
-#if defined(_WIN32) || defined(ENV_UNIX)
-#define USE_WIN_FILE
-#endif
-
-#ifdef USE_WIN_FILE
-#include "../../Windows/FileIO.h"
-#else
-#include "../../Common/C_FileIO.h"
-#endif
-
-#include "../IStream.h"
-#include "../../Common/MyCom.h"
-
-class CInFileStream:
- public IInStream,
- public IStreamGetSize,
- public CMyUnknownImp
-{
- bool _ignoreSymbolicLink;
-public:
- #ifdef USE_WIN_FILE
- NWindows::NFile::NIO::CInFile File;
- #else
- NC::NFile::NIO::CInFile File;
- #endif
- CInFileStream(bool b=false) { _ignoreSymbolicLink = b; }
- virtual ~CInFileStream() {}
-
- bool Open(LPCTSTR fileName);
- #ifdef USE_WIN_FILE
- #ifndef _UNICODE
- bool Open(LPCWSTR fileName);
- #endif
- #endif
-
- bool OpenShared(LPCTSTR fileName, bool shareForWrite);
- #ifdef USE_WIN_FILE
- #ifndef _UNICODE
- bool OpenShared(LPCWSTR fileName, bool shareForWrite);
- #endif
- #endif
-
- MY_UNKNOWN_IMP2(IInStream, IStreamGetSize)
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-
- STDMETHOD(GetSize)(UInt64 *size);
-};
-
-#ifndef _WIN32_WCE
-class CStdInFileStream:
- public ISequentialInStream,
- public CMyUnknownImp
-{
-public:
- // HANDLE File;
- // CStdInFileStream() File(INVALID_HANDLE_VALUE): {}
- // void Open() { File = GetStdHandle(STD_INPUT_HANDLE); };
- MY_UNKNOWN_IMP
-
- virtual ~CStdInFileStream() {}
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-#endif
-
-class COutFileStream:
- public IOutStream,
- public CMyUnknownImp
-{
- #ifdef USE_WIN_FILE
- NWindows::NFile::NIO::COutFile File;
- #else
- NC::NFile::NIO::COutFile File;
- #endif
-public:
- virtual ~COutFileStream() {}
- bool Create(LPCTSTR fileName, bool createAlways)
- {
- ProcessedSize = 0;
- return File.Create(fileName, createAlways);
- }
- bool Open(LPCTSTR fileName, DWORD creationDisposition)
- {
- ProcessedSize = 0;
- return File.Open(fileName, creationDisposition);
- }
- #ifdef USE_WIN_FILE
- #ifndef _UNICODE
- bool Create(LPCWSTR fileName, bool createAlways)
- {
- ProcessedSize = 0;
- return File.Create(fileName, createAlways);
- }
- bool Open(LPCWSTR fileName, DWORD creationDisposition)
- {
- ProcessedSize = 0;
- return File.Open(fileName, creationDisposition);
- }
- #endif
- #endif
-
- HRESULT Close();
-
- UInt64 ProcessedSize;
-
- #ifdef USE_WIN_FILE
- bool SetTime(const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime)
- {
- return File.SetTime(cTime, aTime, mTime);
- }
- bool SetMTime(const FILETIME *mTime) { return File.SetMTime(mTime); }
- #endif
-
-
- MY_UNKNOWN_IMP1(IOutStream)
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
- STDMETHOD(SetSize)(Int64 newSize);
-};
-
-#ifndef _WIN32_WCE
-class CStdOutFileStream:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
-
- virtual ~CStdOutFileStream() {}
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-#endif
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilterCoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilterCoder.cpp
deleted file mode 100644
index d99110856..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilterCoder.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-// FilterCoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "../../Common/Defs.h"
-
-#include "FilterCoder.h"
-#include "StreamUtils.h"
-
-static const UInt32 kBufferSize = 1 << 17;
-
-CFilterCoder::CFilterCoder()
-{
- _buffer = (Byte *)::MidAlloc(kBufferSize);
-}
-
-CFilterCoder::~CFilterCoder()
-{
- ::MidFree(_buffer);
-}
-
-HRESULT CFilterCoder::WriteWithLimit(ISequentialOutStream *outStream, UInt32 size)
-{
- if (_outSizeIsDefined)
- {
- UInt64 remSize = _outSize - _nowPos64;
- if (size > remSize)
- size = (UInt32)remSize;
- }
- RINOK(WriteStream(outStream, _buffer, size));
- _nowPos64 += size;
- return S_OK;
-}
-
-
-STDMETHODIMP CFilterCoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize,
- ICompressProgressInfo *progress)
-{
- RINOK(Init());
- UInt32 bufferPos = 0;
- _outSizeIsDefined = (outSize != 0);
- if (_outSizeIsDefined)
- _outSize = *outSize;
-
- while(NeedMore())
- {
- size_t processedSize = kBufferSize - bufferPos;
-
- // Change it: It can be optimized using ReadPart
- RINOK(ReadStream(inStream, _buffer + bufferPos, &processedSize));
-
- UInt32 endPos = bufferPos + (UInt32)processedSize;
-
- bufferPos = Filter->Filter(_buffer, endPos);
- if (bufferPos > endPos)
- {
- for (; endPos< bufferPos; endPos++)
- _buffer[endPos] = 0;
- bufferPos = Filter->Filter(_buffer, endPos);
- }
-
- if (bufferPos == 0)
- {
- if (endPos > 0)
- return WriteWithLimit(outStream, endPos);
- return S_OK;
- }
- RINOK(WriteWithLimit(outStream, bufferPos));
- if (progress != NULL)
- {
- RINOK(progress->SetRatioInfo(&_nowPos64, &_nowPos64));
- }
- UInt32 i = 0;
- while(bufferPos < endPos)
- _buffer[i++] = _buffer[bufferPos++];
- bufferPos = i;
- }
- return S_OK;
-}
-
-// #ifdef _ST_MODE
-STDMETHODIMP CFilterCoder::SetOutStream(ISequentialOutStream *outStream)
-{
- _bufferPos = 0;
- _outStream = outStream;
- return Init();
-}
-
-STDMETHODIMP CFilterCoder::ReleaseOutStream()
-{
- _outStream.Release();
- return S_OK;
-};
-
-
-STDMETHODIMP CFilterCoder::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 processedSizeTotal = 0;
- while(size > 0)
- {
- UInt32 sizeMax = kBufferSize - _bufferPos;
- UInt32 sizeTemp = size;
- if (sizeTemp > sizeMax)
- sizeTemp = sizeMax;
- memmove(_buffer + _bufferPos, data, sizeTemp);
- size -= sizeTemp;
- processedSizeTotal += sizeTemp;
- data = (const Byte *)data + sizeTemp;
- UInt32 endPos = _bufferPos + sizeTemp;
- _bufferPos = Filter->Filter(_buffer, endPos);
- if (_bufferPos == 0)
- {
- _bufferPos = endPos;
- break;
- }
- if (_bufferPos > endPos)
- {
- if (size != 0)
- return E_FAIL;
- break;
- }
- RINOK(WriteWithLimit(_outStream, _bufferPos));
- UInt32 i = 0;
- while(_bufferPos < endPos)
- _buffer[i++] = _buffer[_bufferPos++];
- _bufferPos = i;
- }
- if (processedSize != NULL)
- *processedSize = processedSizeTotal;
- return S_OK;
-}
-
-STDMETHODIMP CFilterCoder::Flush()
-{
- if (_bufferPos != 0)
- {
- UInt32 endPos = Filter->Filter(_buffer, _bufferPos);
- if (endPos > _bufferPos)
- {
- for (; _bufferPos < endPos; _bufferPos++)
- _buffer[_bufferPos] = 0;
- if (Filter->Filter(_buffer, endPos) != endPos)
- return E_FAIL;
- }
- RINOK(WriteStream(_outStream, _buffer, _bufferPos));
- _bufferPos = 0;
- }
- CMyComPtr<IOutStreamFlush> flush;
- _outStream.QueryInterface(IID_IOutStreamFlush, &flush);
- if (flush)
- return flush->Flush();
- return S_OK;
-}
-
-
-STDMETHODIMP CFilterCoder::SetInStream(ISequentialInStream *inStream)
-{
- _convertedPosBegin = _convertedPosEnd = _bufferPos = 0;
- _inStream = inStream;
- return Init();
-}
-
-STDMETHODIMP CFilterCoder::ReleaseInStream()
-{
- _inStream.Release();
- return S_OK;
-};
-
-STDMETHODIMP CFilterCoder::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 processedSizeTotal = 0;
- while(size > 0)
- {
- if (_convertedPosBegin != _convertedPosEnd)
- {
- UInt32 sizeTemp = MyMin(size, _convertedPosEnd - _convertedPosBegin);
- memmove(data, _buffer + _convertedPosBegin, sizeTemp);
- _convertedPosBegin += sizeTemp;
- data = (void *)((Byte *)data + sizeTemp);
- size -= sizeTemp;
- processedSizeTotal += sizeTemp;
- break;
- }
- int i;
- for (i = 0; _convertedPosEnd + i < _bufferPos; i++)
- _buffer[i] = _buffer[i + _convertedPosEnd];
- _bufferPos = i;
- _convertedPosBegin = _convertedPosEnd = 0;
- size_t processedSizeTemp = kBufferSize - _bufferPos;
- RINOK(ReadStream(_inStream, _buffer + _bufferPos, &processedSizeTemp));
- _bufferPos = _bufferPos + (UInt32)processedSizeTemp;
- _convertedPosEnd = Filter->Filter(_buffer, _bufferPos);
- if (_convertedPosEnd == 0)
- {
- if (_bufferPos == 0)
- break;
- else
- {
- _convertedPosEnd = _bufferPos; // check it
- continue;
- }
- }
- if (_convertedPosEnd > _bufferPos)
- {
- for (; _bufferPos < _convertedPosEnd; _bufferPos++)
- _buffer[_bufferPos] = 0;
- _convertedPosEnd = Filter->Filter(_buffer, _bufferPos);
- }
- }
- if (processedSize != NULL)
- *processedSize = processedSizeTotal;
- return S_OK;
-}
-
-// #endif // _ST_MODE
-
-#ifndef _NO_CRYPTO
-STDMETHODIMP CFilterCoder::CryptoSetPassword(const Byte *data, UInt32 size)
-{
- return _setPassword->CryptoSetPassword(data, size);
-}
-#endif
-
-#ifndef EXTRACT_ONLY
-STDMETHODIMP CFilterCoder::SetCoderProperties(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties)
-{
- return _SetCoderProperties->SetCoderProperties(propIDs, properties, numProperties);
-}
-
-STDMETHODIMP CFilterCoder::WriteCoderProperties(ISequentialOutStream *outStream)
-{
- return _writeCoderProperties->WriteCoderProperties(outStream);
-}
-
-/*
-STDMETHODIMP CFilterCoder::ResetSalt()
-{
- return _CryptoResetSalt->ResetSalt();
-}
-*/
-
-STDMETHODIMP CFilterCoder::ResetInitVector()
-{
- return _CryptoResetInitVector->ResetInitVector();
-}
-#endif
-
-STDMETHODIMP CFilterCoder::SetDecoderProperties2(const Byte *data, UInt32 size)
-{
- return _setDecoderProperties->SetDecoderProperties2(data, size);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilterCoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilterCoder.h
deleted file mode 100644
index a0ec08ca6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/FilterCoder.h
+++ /dev/null
@@ -1,143 +0,0 @@
-// FilterCoder.h
-
-#ifndef __FILTERCODER_H
-#define __FILTERCODER_H
-
-#include "../../Common/MyCom.h"
-#include "../ICoder.h"
-#include "../IPassword.h"
-
-#define MY_QUERYINTERFACE_ENTRY_AG(i, sub0, sub) if (iid == IID_ ## i) \
-{ if (!sub) RINOK(sub0->QueryInterface(IID_ ## i, (void **)&sub)) \
-*outObject = (void *)(i *)this; AddRef(); return S_OK; }
-
-class CFilterCoder:
- public ICompressCoder,
- // #ifdef _ST_MODE
- public ICompressSetInStream,
- public ISequentialInStream,
- public ICompressSetOutStream,
- public ISequentialOutStream,
- public IOutStreamFlush,
- // #endif
-
- #ifndef _NO_CRYPTO
- public ICryptoSetPassword,
- #endif
- #ifndef EXTRACT_ONLY
- public ICompressSetCoderProperties,
- public ICompressWriteCoderProperties,
- // public ICryptoResetSalt,
- public ICryptoResetInitVector,
- #endif
- public ICompressSetDecoderProperties2,
- public CMyUnknownImp
-{
-protected:
- Byte *_buffer;
- // #ifdef _ST_MODE
- CMyComPtr<ISequentialInStream> _inStream;
- CMyComPtr<ISequentialOutStream> _outStream;
- UInt32 _bufferPos;
- UInt32 _convertedPosBegin;
- UInt32 _convertedPosEnd;
- // #endif
- bool _outSizeIsDefined;
- UInt64 _outSize;
- UInt64 _nowPos64;
-
- HRESULT Init()
- {
- _nowPos64 = 0;
- _outSizeIsDefined = false;
- return Filter->Init();
- }
-
- CMyComPtr<ICryptoSetPassword> _setPassword;
- #ifndef EXTRACT_ONLY
- CMyComPtr<ICompressSetCoderProperties> _SetCoderProperties;
- CMyComPtr<ICompressWriteCoderProperties> _writeCoderProperties;
- // CMyComPtr<ICryptoResetSalt> _CryptoResetSalt;
- CMyComPtr<ICryptoResetInitVector> _CryptoResetInitVector;
- #endif
- CMyComPtr<ICompressSetDecoderProperties2> _setDecoderProperties;
-public:
- CMyComPtr<ICompressFilter> Filter;
-
- CFilterCoder();
- ~CFilterCoder();
- HRESULT WriteWithLimit(ISequentialOutStream *outStream, UInt32 size);
- bool NeedMore() const
- { return (!_outSizeIsDefined || (_nowPos64 < _outSize)); }
-
-public:
- MY_QUERYINTERFACE_BEGIN
- MY_QUERYINTERFACE_ENTRY(ICompressCoder)
- // #ifdef _ST_MODE
- MY_QUERYINTERFACE_ENTRY(ICompressSetInStream)
- MY_QUERYINTERFACE_ENTRY(ISequentialInStream)
-
- MY_QUERYINTERFACE_ENTRY(ICompressSetOutStream)
- MY_QUERYINTERFACE_ENTRY(ISequentialOutStream)
- MY_QUERYINTERFACE_ENTRY(IOutStreamFlush)
- // #endif
-
- #ifndef _NO_CRYPTO
- MY_QUERYINTERFACE_ENTRY_AG(ICryptoSetPassword, Filter, _setPassword)
- #endif
-
- #ifndef EXTRACT_ONLY
- MY_QUERYINTERFACE_ENTRY_AG(ICompressSetCoderProperties, Filter, _SetCoderProperties)
- MY_QUERYINTERFACE_ENTRY_AG(ICompressWriteCoderProperties, Filter, _writeCoderProperties)
- // MY_QUERYINTERFACE_ENTRY_AG(ICryptoResetSalt, Filter, _CryptoResetSalt)
- MY_QUERYINTERFACE_ENTRY_AG(ICryptoResetInitVector, Filter, _CryptoResetInitVector)
- #endif
-
- MY_QUERYINTERFACE_ENTRY_AG(ICompressSetDecoderProperties2, Filter, _setDecoderProperties)
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
- // #ifdef _ST_MODE
- STDMETHOD(ReleaseInStream)();
- STDMETHOD(SetInStream)(ISequentialInStream *inStream);
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); \
- STDMETHOD(SetOutStream)(ISequentialOutStream *outStream);
- STDMETHOD(ReleaseOutStream)();
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Flush)();
- // #endif
-
- #ifndef _NO_CRYPTO
- STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
- #endif
- #ifndef EXTRACT_ONLY
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties);
- STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
- // STDMETHOD(ResetSalt)();
- STDMETHOD(ResetInitVector)();
- #endif
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-};
-
-// #ifdef _ST_MODE
-class CInStreamReleaser
-{
-public:
- CFilterCoder *FilterCoder;
- CInStreamReleaser(): FilterCoder(0) {}
- ~CInStreamReleaser() { if (FilterCoder) FilterCoder->ReleaseInStream(); }
-};
-
-class COutStreamReleaser
-{
-public:
- CFilterCoder *FilterCoder;
- COutStreamReleaser(): FilterCoder(0) {}
- ~COutStreamReleaser() { if (FilterCoder) FilterCoder->ReleaseOutStream(); }
-};
-// #endif
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InBuffer.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InBuffer.cpp
deleted file mode 100644
index 03924d2a8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InBuffer.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-// InBuffer.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "InBuffer.h"
-
-CInBuffer::CInBuffer():
- _buffer(0),
- _bufferLimit(0),
- _bufferBase(0),
- _stream(0),
- _bufferSize(0)
-{}
-
-bool CInBuffer::Create(UInt32 bufferSize)
-{
- const UInt32 kMinBlockSize = 1;
- if (bufferSize < kMinBlockSize)
- bufferSize = kMinBlockSize;
- if (_bufferBase != 0 && _bufferSize == bufferSize)
- return true;
- Free();
- _bufferSize = bufferSize;
- _bufferBase = (Byte *)::MidAlloc(bufferSize);
- return (_bufferBase != 0);
-}
-
-void CInBuffer::Free()
-{
- ::MidFree(_bufferBase);
- _bufferBase = 0;
-}
-
-void CInBuffer::SetStream(ISequentialInStream *stream)
-{
- _stream = stream;
-}
-
-void CInBuffer::Init()
-{
- _processedSize = 0;
- _buffer = _bufferBase;
- _bufferLimit = _buffer;
- _wasFinished = false;
- #ifdef _NO_EXCEPTIONS
- ErrorCode = S_OK;
- #endif
-}
-
-bool CInBuffer::ReadBlock()
-{
- #ifdef _NO_EXCEPTIONS
- if (ErrorCode != S_OK)
- return false;
- #endif
- if (_wasFinished)
- return false;
- _processedSize += (_buffer - _bufferBase);
- UInt32 numProcessedBytes;
- HRESULT result = _stream->Read(_bufferBase, _bufferSize, &numProcessedBytes);
- #ifdef _NO_EXCEPTIONS
- ErrorCode = result;
- #else
- if (result != S_OK)
- throw CInBufferException(result);
- #endif
- _buffer = _bufferBase;
- _bufferLimit = _buffer + numProcessedBytes;
- _wasFinished = (numProcessedBytes == 0);
- return (!_wasFinished);
-}
-
-Byte CInBuffer::ReadBlock2()
-{
- if(!ReadBlock())
- return 0xFF;
- return *_buffer++;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InBuffer.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InBuffer.h
deleted file mode 100644
index 75625bfd9..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InBuffer.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// InBuffer.h
-
-#ifndef __INBUFFER_H
-#define __INBUFFER_H
-
-#include "../IStream.h"
-#include "../../Common/MyCom.h"
-#include "../../Common/MyException.h"
-
-#ifndef _NO_EXCEPTIONS
-struct CInBufferException: public CSystemException
-{
- CInBufferException(HRESULT errorCode): CSystemException(errorCode) {}
-};
-#endif
-
-class CInBuffer
-{
- Byte *_buffer;
- Byte *_bufferLimit;
- Byte *_bufferBase;
- CMyComPtr<ISequentialInStream> _stream;
- UInt64 _processedSize;
- UInt32 _bufferSize;
- bool _wasFinished;
-
- bool ReadBlock();
- Byte ReadBlock2();
-
-public:
- #ifdef _NO_EXCEPTIONS
- HRESULT ErrorCode;
- #endif
-
- CInBuffer();
- ~CInBuffer() { Free(); }
-
- bool Create(UInt32 bufferSize);
- void Free();
-
- void SetStream(ISequentialInStream *stream);
- void Init();
- void ReleaseStream() { _stream.Release(); }
-
- bool ReadByte(Byte &b)
- {
- if (_buffer >= _bufferLimit)
- if (!ReadBlock())
- return false;
- b = *_buffer++;
- return true;
- }
- Byte ReadByte()
- {
- if (_buffer >= _bufferLimit)
- return ReadBlock2();
- return *_buffer++;
- }
- UInt32 ReadBytes(Byte *buf, UInt32 size)
- {
- if ((UInt32)(_bufferLimit - _buffer) >= size)
- {
- for (UInt32 i = 0; i < size; i++)
- buf[i] = _buffer[i];
- _buffer += size;
- return size;
- }
- for (UInt32 i = 0; i < size; i++)
- {
- if (_buffer >= _bufferLimit)
- if (!ReadBlock())
- return i;
- buf[i] = *_buffer++;
- }
- return size;
- }
- UInt64 GetProcessedSize() const { return _processedSize + (_buffer - _bufferBase); }
- bool WasFinished() const { return _wasFinished; }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InOutTempBuffer.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InOutTempBuffer.cpp
deleted file mode 100644
index 4cc0b2f24..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InOutTempBuffer.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// InOutTempBuffer.cpp
-
-#include "StdAfx.h"
-
-#include "InOutTempBuffer.h"
-#include "../../Common/Defs.h"
-// #include "Windows/Defs.h"
-
-#include "StreamUtils.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NDirectory;
-
-static UInt32 kTmpBufferMemorySize = (1 << 20);
-
-static LPCTSTR kTempFilePrefixString = TEXT("iot");
-
-CInOutTempBuffer::CInOutTempBuffer():
- _buffer(NULL)
-{
-}
-
-void CInOutTempBuffer::Create()
-{
- _buffer = new Byte[kTmpBufferMemorySize];
-}
-
-CInOutTempBuffer::~CInOutTempBuffer()
-{
- delete []_buffer;
-}
-void CInOutTempBuffer::InitWriting()
-{
- _bufferPosition = 0;
- _tmpFileCreated = false;
- _fileSize = 0;
-}
-
-bool CInOutTempBuffer::WriteToFile(const void *data, UInt32 size)
-{
- if (size == 0)
- return true;
- if(!_tmpFileCreated)
- {
- CSysString tempDirPath;
- if(!MyGetTempPath(tempDirPath))
- return false;
- if (_tempFile.Create(tempDirPath, kTempFilePrefixString, _tmpFileName) == 0)
- return false;
- // _outFile.SetOpenCreationDispositionCreateAlways();
- if(!_outFile.Create(_tmpFileName, true))
- return false;
- _tmpFileCreated = true;
- }
- UInt32 processedSize;
- if(!_outFile.Write(data, size, processedSize))
- return false;
- _fileSize += processedSize;
- return (processedSize == size);
-}
-
-bool CInOutTempBuffer::FlushWrite()
-{
- return _outFile.Close();
-}
-
-bool CInOutTempBuffer::Write(const void *data, UInt32 size)
-{
- if(_bufferPosition < kTmpBufferMemorySize)
- {
- UInt32 curSize = MyMin(kTmpBufferMemorySize - _bufferPosition, size);
- memmove(_buffer + _bufferPosition, (const Byte *)data, curSize);
- _bufferPosition += curSize;
- size -= curSize;
- data = ((const Byte *)data) + curSize;
- _fileSize += curSize;
- }
- return WriteToFile(data, size);
-}
-
-bool CInOutTempBuffer::InitReading()
-{
- _currentPositionInBuffer = 0;
- if(_tmpFileCreated)
- return _inFile.Open(_tmpFileName);
- return true;
-}
-
-HRESULT CInOutTempBuffer::WriteToStream(ISequentialOutStream *stream)
-{
- if (_currentPositionInBuffer < _bufferPosition)
- {
- UInt32 sizeToWrite = _bufferPosition - _currentPositionInBuffer;
- RINOK(WriteStream(stream, _buffer + _currentPositionInBuffer, sizeToWrite));
- _currentPositionInBuffer += sizeToWrite;
- }
- if (!_tmpFileCreated)
- return true;
- for (;;)
- {
- UInt32 localProcessedSize;
- if (!_inFile.ReadPart(_buffer, kTmpBufferMemorySize, localProcessedSize))
- return E_FAIL;
- if (localProcessedSize == 0)
- return S_OK;
- RINOK(WriteStream(stream, _buffer, localProcessedSize));
- }
-}
-
-STDMETHODIMP CSequentialOutTempBufferImp::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- if (!_buffer->Write(data, size))
- {
- if (processedSize != NULL)
- *processedSize = 0;
- return E_FAIL;
- }
- if (processedSize != NULL)
- *processedSize = size;
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InOutTempBuffer.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InOutTempBuffer.h
deleted file mode 100644
index e1e0e9711..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/InOutTempBuffer.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Util/InOutTempBuffer.h
-
-#ifndef __IN_OUT_TEMP_BUFFER_H
-#define __IN_OUT_TEMP_BUFFER_H
-
-#include "../../Windows/FileIO.h"
-#include "../../Windows/FileDir.h"
-#include "../../Common/MyCom.h"
-
-#include "../IStream.h"
-
-class CInOutTempBuffer
-{
- NWindows::NFile::NDirectory::CTempFile _tempFile;
- NWindows::NFile::NIO::COutFile _outFile;
- NWindows::NFile::NIO::CInFile _inFile;
- Byte *_buffer;
- UInt32 _bufferPosition;
- UInt32 _currentPositionInBuffer;
- CSysString _tmpFileName;
- bool _tmpFileCreated;
-
- UInt64 _fileSize;
-
- bool WriteToFile(const void *data, UInt32 size);
-public:
- CInOutTempBuffer();
- ~CInOutTempBuffer();
- void Create();
-
- void InitWriting();
- bool Write(const void *data, UInt32 size);
- UInt64 GetDataSize() const { return _fileSize; }
- bool FlushWrite();
- bool InitReading();
- HRESULT WriteToStream(ISequentialOutStream *stream);
-};
-
-class CSequentialOutTempBufferImp:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- CInOutTempBuffer *_buffer;
-public:
- // CSequentialOutStreamImp(): _size(0) {}
- // UInt32 _size;
- void Init(CInOutTempBuffer *buffer) { _buffer = buffer; }
- // UInt32 GetSize() const { return _size; }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LimitedStreams.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LimitedStreams.cpp
deleted file mode 100644
index 1837e3201..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LimitedStreams.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-// LimitedStreams.cpp
-
-#include "StdAfx.h"
-
-#include "LimitedStreams.h"
-#include "../../Common/Defs.h"
-
-STDMETHODIMP CLimitedSequentialInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize = 0;
- UInt32 sizeToRead = (UInt32)MyMin((_size - _pos), (UInt64)size);
- HRESULT result = S_OK;
- if (sizeToRead > 0)
- {
- result = _stream->Read(data, sizeToRead, &realProcessedSize);
- _pos += realProcessedSize;
- if (realProcessedSize == 0)
- _wasFinished = true;
- }
- if (processedSize != NULL)
- *processedSize = realProcessedSize;
- return result;
-}
-
-STDMETHODIMP CLimitedInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != NULL)
- *processedSize = 0;
- if (_virtPos >= _size)
- return (_virtPos == _size) ? S_OK: E_FAIL;
- UInt64 rem = _size - _virtPos;
- if (rem < size)
- size = (UInt32)rem;
- UInt64 newPos = _startOffset + _virtPos;
- if (newPos != _physPos)
- {
- _physPos = newPos;
- RINOK(SeekToPhys());
- }
- HRESULT res = _stream->Read(data, size, &size);
- if (processedSize != NULL)
- *processedSize = size;
- _physPos += size;
- _virtPos += size;
- return res;
-}
-
-STDMETHODIMP CLimitedInStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
- switch(seekOrigin)
- {
- case STREAM_SEEK_SET: _virtPos = offset; break;
- case STREAM_SEEK_CUR: _virtPos += offset; break;
- case STREAM_SEEK_END: _virtPos = _size + offset; break;
- default: return STG_E_INVALIDFUNCTION;
- }
- if (newPosition)
- *newPosition = _virtPos;
- return S_OK;
-}
-
-STDMETHODIMP CClusterInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != NULL)
- *processedSize = 0;
- if (_virtPos >= Size)
- return (_virtPos == Size) ? S_OK: E_FAIL;
-
- if (_curRem == 0)
- {
- UInt32 blockSize = (UInt32)1 << BlockSizeLog;
- UInt32 virtBlock = (UInt32)(_virtPos >> BlockSizeLog);
- UInt32 offsetInBlock = (UInt32)_virtPos & (blockSize - 1);
- UInt32 phyBlock = Vector[virtBlock];
- UInt64 newPos = StartOffset + ((UInt64)phyBlock << BlockSizeLog) + offsetInBlock;
- if (newPos != _physPos)
- {
- _physPos = newPos;
- RINOK(SeekToPhys());
- }
- _curRem = blockSize - offsetInBlock;
- for (int i = 1; i < 64 && (virtBlock + i) < (UInt32)Vector.Size() && phyBlock + i == Vector[virtBlock + i]; i++)
- _curRem += (UInt32)1 << BlockSizeLog;
- UInt64 rem = Size - _virtPos;
- if (_curRem > rem)
- _curRem = (UInt32)rem;
- }
- if (size > _curRem)
- size = _curRem;
- HRESULT res = Stream->Read(data, size, &size);
- if (processedSize != NULL)
- *processedSize = size;
- _physPos += size;
- _virtPos += size;
- _curRem -= size;
- return res;
-}
-
-STDMETHODIMP CClusterInStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
- UInt64 newVirtPos = offset;
- switch(seekOrigin)
- {
- case STREAM_SEEK_SET: break;
- case STREAM_SEEK_CUR: newVirtPos += _virtPos; break;
- case STREAM_SEEK_END: newVirtPos += Size; break;
- default: return STG_E_INVALIDFUNCTION;
- }
- if (_virtPos != newVirtPos)
- _curRem = 0;
- _virtPos = newVirtPos;
- if (newPosition)
- *newPosition = newVirtPos;
- return S_OK;
-}
-
-
-HRESULT CreateLimitedInStream(IInStream *inStream, UInt64 pos, UInt64 size, ISequentialInStream **resStream)
-{
- *resStream = 0;
- CLimitedInStream *streamSpec = new CLimitedInStream;
- CMyComPtr<ISequentialInStream> streamTemp = streamSpec;
- streamSpec->SetStream(inStream);
- RINOK(streamSpec->InitAndSeek(pos, size));
- streamSpec->SeekToStart();
- *resStream = streamTemp.Detach();
- return S_OK;
-}
-
-STDMETHODIMP CLimitedSequentialOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- HRESULT result = S_OK;
- if (processedSize != NULL)
- *processedSize = 0;
- if (size > _size)
- {
- if (_size == 0)
- {
- _overflow = true;
- if (!_overflowIsAllowed)
- return E_FAIL;
- if (processedSize != NULL)
- *processedSize = size;
- return S_OK;
- }
- size = (UInt32)_size;
- }
- if (_stream)
- result = _stream->Write(data, size, &size);
- _size -= size;
- if (processedSize != NULL)
- *processedSize = size;
- return result;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LimitedStreams.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LimitedStreams.h
deleted file mode 100644
index f6900d510..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LimitedStreams.h
+++ /dev/null
@@ -1,124 +0,0 @@
-// LimitedStreams.h
-
-#ifndef __LIMITED_STREAMS_H
-#define __LIMITED_STREAMS_H
-
-#include "../../Common/MyCom.h"
-#include "../../Common/MyVector.h"
-#include "../IStream.h"
-
-class CLimitedSequentialInStream:
- public ISequentialInStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialInStream> _stream;
- UInt64 _size;
- UInt64 _pos;
- bool _wasFinished;
-public:
- void SetStream(ISequentialInStream *stream) { _stream = stream; }
- void Init(UInt64 streamSize)
- {
- _size = streamSize;
- _pos = 0;
- _wasFinished = false;
- }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- UInt64 GetSize() const { return _pos; }
- bool WasFinished() const { return _wasFinished; }
-};
-
-class CLimitedInStream:
- public IInStream,
- public CMyUnknownImp
-{
- CMyComPtr<IInStream> _stream;
- UInt64 _virtPos;
- UInt64 _physPos;
- UInt64 _size;
- UInt64 _startOffset;
-
- HRESULT SeekToPhys() { return _stream->Seek(_physPos, STREAM_SEEK_SET, NULL); }
-public:
- void SetStream(IInStream *stream) { _stream = stream; }
- HRESULT InitAndSeek(UInt64 startOffset, UInt64 size)
- {
- _startOffset = startOffset;
- _physPos = startOffset;
- _virtPos = 0;
- _size = size;
- return SeekToPhys();
- }
-
- MY_UNKNOWN_IMP1(IInStream)
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-
- HRESULT SeekToStart() { return Seek(0, STREAM_SEEK_SET, NULL); }
-};
-
-class CClusterInStream:
- public IInStream,
- public CMyUnknownImp
-{
- UInt64 _virtPos;
- UInt64 _physPos;
- UInt32 _curRem;
-public:
- CMyComPtr<IInStream> Stream;
- UInt64 StartOffset;
- UInt64 Size;
- int BlockSizeLog;
- CRecordVector<UInt32> Vector;
-
- HRESULT SeekToPhys() { return Stream->Seek(_physPos, STREAM_SEEK_SET, NULL); }
-
- HRESULT InitAndSeek()
- {
- _curRem = 0;
- _virtPos = 0;
- _physPos = StartOffset;
- if (Vector.Size() > 0)
- {
- _physPos = StartOffset + (Vector[0] << BlockSizeLog);
- return SeekToPhys();
- }
- return S_OK;
- }
-
- MY_UNKNOWN_IMP1(IInStream)
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-};
-
-HRESULT CreateLimitedInStream(IInStream *inStream, UInt64 pos, UInt64 size, ISequentialInStream **resStream);
-
-class CLimitedSequentialOutStream:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialOutStream> _stream;
- UInt64 _size;
- bool _overflow;
- bool _overflowIsAllowed;
-public:
- MY_UNKNOWN_IMP
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- void SetStream(ISequentialOutStream *stream) { _stream = stream; }
- void ReleaseStream() { _stream.Release(); }
- void Init(UInt64 size, bool overflowIsAllowed = false)
- {
- _size = size;
- _overflow = false;
- _overflowIsAllowed = overflowIsAllowed;
- }
- bool IsFinishedOK() const { return (_size == 0 && !_overflow); }
- UInt64 GetRem() const { return _size; }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LockedStream.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LockedStream.cpp
deleted file mode 100644
index f05601cb6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LockedStream.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// LockedStream.cpp
-
-#include "StdAfx.h"
-
-#include "LockedStream.h"
-
-HRESULT CLockedInStream::Read(UInt64 startPos, void *data, UInt32 size,
- UInt32 *processedSize)
-{
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- RINOK(_stream->Seek(startPos, STREAM_SEEK_SET, NULL));
- return _stream->Read(data, size, processedSize);
-}
-
-STDMETHODIMP CLockedSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize = 0;
- HRESULT result = _lockedInStream->Read(_pos, data, size, &realProcessedSize);
- _pos += realProcessedSize;
- if (processedSize != NULL)
- *processedSize = realProcessedSize;
- return result;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LockedStream.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LockedStream.h
deleted file mode 100644
index 486e4220b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/LockedStream.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// LockedStream.h
-
-#ifndef __LOCKEDSTREAM_H
-#define __LOCKEDSTREAM_H
-
-#include "../../Windows/Synchronization.h"
-#include "../../Common/MyCom.h"
-#include "../IStream.h"
-
-class CLockedInStream
-{
- CMyComPtr<IInStream> _stream;
- NWindows::NSynchronization::CCriticalSection _criticalSection;
-public:
- void Init(IInStream *stream)
- { _stream = stream; }
- HRESULT Read(UInt64 startPos, void *data, UInt32 size, UInt32 *processedSize);
-};
-
-class CLockedSequentialInStreamImp:
- public ISequentialInStream,
- public CMyUnknownImp
-{
- CLockedInStream *_lockedInStream;
- UInt64 _pos;
-public:
- void Init(CLockedInStream *lockedInStream, UInt64 startPos)
- {
- _lockedInStream = lockedInStream;
- _pos = startPos;
- }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MemBlocks.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MemBlocks.cpp
deleted file mode 100644
index 67192b402..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MemBlocks.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-// MemBlocks.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "MemBlocks.h"
-#include "StreamUtils.h"
-
-bool CMemBlockManager::AllocateSpace(size_t numBlocks)
-{
- FreeSpace();
- if (_blockSize < sizeof(void *) || numBlocks < 1)
- return false;
- size_t totalSize = numBlocks * _blockSize;
- if (totalSize / _blockSize != numBlocks)
- return false;
- _data = ::MidAlloc(totalSize);
- if (_data == 0)
- return false;
- Byte *p = (Byte *)_data;
- for (size_t i = 0; i + 1 < numBlocks; i++, p += _blockSize)
- *(Byte **)p = (p + _blockSize);
- *(Byte **)p = 0;
- _headFree = _data;
- return true;
-}
-
-void CMemBlockManager::FreeSpace()
-{
- ::MidFree(_data);
- _data = 0;
- _headFree= 0;
-}
-
-void *CMemBlockManager::AllocateBlock()
-{
- if (_headFree == 0)
- return 0;
- void *p = _headFree;
- _headFree = *(void **)_headFree;
- return p;
-}
-
-void CMemBlockManager::FreeBlock(void *p)
-{
- if (p == 0)
- return;
- *(void **)p = _headFree;
- _headFree = p;
-}
-
-
-HRes CMemBlockManagerMt::AllocateSpace(NWindows::NSynchronization::CSynchro *sync,size_t numBlocks, size_t numNoLockBlocks)
-{
- if (numNoLockBlocks > numBlocks)
- return E_INVALIDARG;
- if (!CMemBlockManager::AllocateSpace(numBlocks))
- return E_OUTOFMEMORY;
- size_t numLockBlocks = numBlocks - numNoLockBlocks;
- Semaphore.Close();
- return Semaphore.Create(sync,(LONG)numLockBlocks, (LONG)numLockBlocks);
-}
-
-HRes CMemBlockManagerMt::AllocateSpaceAlways(NWindows::NSynchronization::CSynchro *sync,size_t desiredNumberOfBlocks, size_t numNoLockBlocks)
-{
- if (numNoLockBlocks > desiredNumberOfBlocks)
- return E_INVALIDARG;
- for (;;)
- {
- if (AllocateSpace(sync,desiredNumberOfBlocks, numNoLockBlocks) == 0)
- return 0;
- if (desiredNumberOfBlocks == numNoLockBlocks)
- return E_OUTOFMEMORY;
- desiredNumberOfBlocks = numNoLockBlocks + ((desiredNumberOfBlocks - numNoLockBlocks) >> 1);
- }
-}
-
-void CMemBlockManagerMt::FreeSpace()
-{
- Semaphore.Close();
- CMemBlockManager::FreeSpace();
-}
-
-void *CMemBlockManagerMt::AllocateBlock()
-{
- // Semaphore.Lock();
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- return CMemBlockManager::AllocateBlock();
-}
-
-void CMemBlockManagerMt::FreeBlock(void *p, bool lockMode)
-{
- if (p == 0)
- return;
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- CMemBlockManager::FreeBlock(p);
- }
- if (lockMode)
- Semaphore.Release();
-}
-
-void CMemBlocks::Free(CMemBlockManagerMt *manager)
-{
- while(Blocks.Size() > 0)
- {
- manager->FreeBlock(Blocks.Back());
- Blocks.DeleteBack();
- }
- TotalSize = 0;
-}
-
-void CMemBlocks::FreeOpt(CMemBlockManagerMt *manager)
-{
- Free(manager);
- Blocks.ClearAndFree();
-}
-
-HRESULT CMemBlocks::WriteToStream(size_t blockSize, ISequentialOutStream *outStream) const
-{
- UInt64 totalSize = TotalSize;
- for (int blockIndex = 0; totalSize > 0; blockIndex++)
- {
- UInt32 curSize = (UInt32)blockSize;
- if (totalSize < curSize)
- curSize = (UInt32)totalSize;
- if (blockIndex >= Blocks.Size())
- return E_FAIL;
- RINOK(WriteStream(outStream, Blocks[blockIndex], curSize));
- totalSize -= curSize;
- }
- return S_OK;
-}
-
-
-void CMemLockBlocks::FreeBlock(int index, CMemBlockManagerMt *memManager)
-{
- memManager->FreeBlock(Blocks[index], LockMode);
- Blocks[index] = 0;
-}
-
-void CMemLockBlocks::Free(CMemBlockManagerMt *memManager)
-{
- while (Blocks.Size() > 0)
- {
- FreeBlock(Blocks.Size() - 1, memManager);
- Blocks.DeleteBack();
- }
- TotalSize = 0;
-}
-
-HRes CMemLockBlocks::SwitchToNoLockMode(CMemBlockManagerMt *memManager)
-{
- if (LockMode)
- {
- if (Blocks.Size() > 0)
- {
- RINOK(memManager->ReleaseLockedBlocks(Blocks.Size()));
- }
- LockMode = false;
- }
- return 0;
-}
-
-void CMemLockBlocks::Detach(CMemLockBlocks &blocks, CMemBlockManagerMt *memManager)
-{
- blocks.Free(memManager);
- blocks.LockMode = LockMode;
- UInt64 totalSize = 0;
- size_t blockSize = memManager->GetBlockSize();
- for (int i = 0; i < Blocks.Size(); i++)
- {
- if (totalSize < TotalSize)
- blocks.Blocks.Add(Blocks[i]);
- else
- FreeBlock(i, memManager);
- Blocks[i] = 0;
- totalSize += blockSize;
- }
- blocks.TotalSize = TotalSize;
- Free(memManager);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MemBlocks.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MemBlocks.h
deleted file mode 100644
index f23852fbd..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MemBlocks.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// MemBlocks.h
-
-#ifndef __MEM_BLOCKS_H
-#define __MEM_BLOCKS_H
-
-#include "Common/MyVector.h"
-
-#include "Windows/Synchronization.h"
-
-#include "../IStream.h"
-
-class CMemBlockManager
-{
- void *_data;
- size_t _blockSize;
- void *_headFree;
-public:
- CMemBlockManager(size_t blockSize = (1 << 20)): _data(0), _blockSize(blockSize), _headFree(0) {}
- ~CMemBlockManager() { FreeSpace(); }
-
- bool AllocateSpace(size_t numBlocks);
- void FreeSpace();
- size_t GetBlockSize() const { return _blockSize; }
- void *AllocateBlock();
- void FreeBlock(void *p);
-};
-
-
-class CMemBlockManagerMt: public CMemBlockManager
-{
- NWindows::NSynchronization::CCriticalSection _criticalSection;
-public:
- NWindows::NSynchronization::CSemaphoreWFMO Semaphore;
-
- CMemBlockManagerMt(size_t blockSize = (1 << 20)): CMemBlockManager(blockSize) {}
- ~CMemBlockManagerMt() { FreeSpace(); }
-
- HRes AllocateSpace(NWindows::NSynchronization::CSynchro *sync, size_t numBlocks, size_t numNoLockBlocks = 0);
- HRes AllocateSpaceAlways(NWindows::NSynchronization::CSynchro *sync, size_t desiredNumberOfBlocks, size_t numNoLockBlocks = 0);
- void FreeSpace();
- void *AllocateBlock();
- void FreeBlock(void *p, bool lockMode = true);
- HRes ReleaseLockedBlocks(int number) { return Semaphore.Release(number); }
-};
-
-
-class CMemBlocks
-{
- void Free(CMemBlockManagerMt *manager);
-public:
- CRecordVector<void *> Blocks;
- UInt64 TotalSize;
-
- CMemBlocks(): TotalSize(0) {}
-
- void FreeOpt(CMemBlockManagerMt *manager);
- HRESULT WriteToStream(size_t blockSize, ISequentialOutStream *outStream) const;
-};
-
-struct CMemLockBlocks: public CMemBlocks
-{
- bool LockMode;
-
- CMemLockBlocks(): LockMode(true) {};
- void Free(CMemBlockManagerMt *memManager);
- void FreeBlock(int index, CMemBlockManagerMt *memManager);
- HRes SwitchToNoLockMode(CMemBlockManagerMt *memManager);
- void Detach(CMemLockBlocks &blocks, CMemBlockManagerMt *memManager);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodId.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodId.cpp
deleted file mode 100644
index b797b6857..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodId.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// MethodId.cpp
-
-#include "StdAfx.h"
-
-#include "MethodId.h"
-#include "../../Common/MyString.h"
-
-static inline wchar_t GetHex(Byte value)
-{
- return (wchar_t)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
-}
-
-UString ConvertMethodIdToString(UInt64 id)
-{
- wchar_t s[32];
- int len = 32;
- s[--len] = 0;
- do
- {
- s[--len] = GetHex((Byte)id & 0xF);
- id >>= 4;
- s[--len] = GetHex((Byte)id & 0xF);
- id >>= 4;
- }
- while (id != 0);
- return s + len;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodId.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodId.h
deleted file mode 100644
index 54ebc9f7d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodId.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// MethodId.h
-
-#ifndef __7Z_METHOD_ID_H
-#define __7Z_METHOD_ID_H
-
-#include "../../Common/Types.h"
-
-typedef UInt64 CMethodId;
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodProps.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodProps.cpp
deleted file mode 100644
index 5836d0f84..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodProps.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-// MethodProps.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "MethodProps.h"
-
-static const UInt64 k_LZMA = 0x030101;
-static const UInt64 k_LZMA2 = 0x21;
-
-HRESULT SetMethodProperties(const CMethod &method, const UInt64 *inSizeForReduce, IUnknown *coder)
-{
- bool tryReduce = false;
- UInt32 reducedDictionarySize = 1 << 10;
- if (inSizeForReduce != 0 && (method.Id == k_LZMA || method.Id == k_LZMA2))
- {
- for (;;)
- {
- const UInt32 step = (reducedDictionarySize >> 1);
- if (reducedDictionarySize >= *inSizeForReduce)
- {
- tryReduce = true;
- break;
- }
- reducedDictionarySize += step;
- if (reducedDictionarySize >= *inSizeForReduce)
- {
- tryReduce = true;
- break;
- }
- if (reducedDictionarySize >= ((UInt32)3 << 30))
- break;
- reducedDictionarySize += step;
- }
- }
-
- {
- int numProps = method.Props.Size();
- CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
- coder->QueryInterface(IID_ICompressSetCoderProperties, (void **)&setCoderProperties);
- if (setCoderProperties == NULL)
- {
- if (numProps != 0)
- return E_INVALIDARG;
- }
- else
- {
- CRecordVector<PROPID> propIDs;
- NWindows::NCOM::CPropVariant *values = new NWindows::NCOM::CPropVariant[numProps];
- HRESULT res = S_OK;
- try
- {
- for (int i = 0; i < numProps; i++)
- {
- const CProp &prop = method.Props[i];
- propIDs.Add(prop.Id);
- NWindows::NCOM::CPropVariant &value = values[i];
- value = prop.Value;
- // if (tryReduce && prop.Id == NCoderPropID::kDictionarySize && value.vt == VT_UI4 && reducedDictionarySize < value.ulVal)
- if (tryReduce)
- if (prop.Id == NCoderPropID::kDictionarySize)
- if (value.vt == VT_UI4)
- if (reducedDictionarySize < value.ulVal)
- value.ulVal = reducedDictionarySize;
- }
- CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
- coder->QueryInterface(IID_ICompressSetCoderProperties, (void **)&setCoderProperties);
- res = setCoderProperties->SetCoderProperties(&propIDs.Front(), values, numProps);
- }
- catch(...)
- {
- delete []values;
- throw;
- }
- delete []values;
- RINOK(res);
- }
- }
-
- /*
- CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
- coder->QueryInterface(IID_ICompressWriteCoderProperties, (void **)&writeCoderProperties);
- if (writeCoderProperties != NULL)
- {
- CSequentialOutStreamImp *outStreamSpec = new CSequentialOutStreamImp;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
- outStreamSpec->Init();
- RINOK(writeCoderProperties->WriteCoderProperties(outStream));
- size_t size = outStreamSpec->GetSize();
- filterProps.SetCapacity(size);
- memmove(filterProps, outStreamSpec->GetBuffer(), size);
- }
- */
- return S_OK;
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodProps.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodProps.h
deleted file mode 100644
index c0761c519..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/MethodProps.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// MethodProps.h
-
-#ifndef __7Z_METHOD_PROPS_H
-#define __7Z_METHOD_PROPS_H
-
-#include "../../Common/MyVector.h"
-
-#include "../../Windows/PropVariant.h"
-
-#include "MethodId.h"
-
-struct CProp
-{
- PROPID Id;
- NWindows::NCOM::CPropVariant Value;
-};
-
-struct CMethod
-{
- CMethodId Id;
- CObjectVector<CProp> Props;
-};
-
-struct CMethodsMode
-{
- CObjectVector<CMethod> Methods;
- #ifdef COMPRESS_MT
- UInt32 NumThreads;
- #endif
-
- CMethodsMode()
- #ifdef COMPRESS_MT
- : NumThreads(1)
- #endif
- {}
- bool IsEmpty() const { return Methods.IsEmpty() ; }
-};
-
-HRESULT SetMethodProperties(const CMethod &method, const UInt64 *inSizeForReduce, IUnknown *coder);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OffsetStream.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OffsetStream.cpp
deleted file mode 100644
index 24fcf1619..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OffsetStream.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-// OffsetStream.cpp
-
-#include "StdAfx.h"
-
-#include "Common/Defs.h"
-#include "OffsetStream.h"
-
-HRESULT COffsetOutStream::Init(IOutStream *stream, UInt64 offset)
-{
- _offset = offset;
- _stream = stream;
- return _stream->Seek(offset, STREAM_SEEK_SET, NULL);
-}
-
-STDMETHODIMP COffsetOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- return _stream->Write(data, size, processedSize);
-}
-
-STDMETHODIMP COffsetOutStream::Seek(Int64 offset, UInt32 seekOrigin,
- UInt64 *newPosition)
-{
- UInt64 absoluteNewPosition;
- if (seekOrigin == STREAM_SEEK_SET)
- offset += _offset;
- HRESULT result = _stream->Seek(offset, seekOrigin, &absoluteNewPosition);
- if (newPosition != NULL)
- *newPosition = absoluteNewPosition - _offset;
- return result;
-}
-
-STDMETHODIMP COffsetOutStream::SetSize(Int64 newSize)
-{
- return _stream->SetSize(_offset + newSize);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OffsetStream.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OffsetStream.h
deleted file mode 100644
index 5a69404f6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OffsetStream.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// OffsetStream.h
-
-#ifndef __OFFSETSTREAM_H
-#define __OFFSETSTREAM_H
-
-#include "Common/MyCom.h"
-#include "../IStream.h"
-
-class COffsetOutStream:
- public IOutStream,
- public CMyUnknownImp
-{
- UInt64 _offset;
- CMyComPtr<IOutStream> _stream;
-public:
- HRESULT Init(IOutStream *stream, UInt64 offset);
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
- STDMETHOD(SetSize)(Int64 newSize);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutBuffer.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutBuffer.cpp
deleted file mode 100644
index 2e5debd83..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutBuffer.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-// OutBuffer.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "OutBuffer.h"
-
-bool COutBuffer::Create(UInt32 bufferSize)
-{
- const UInt32 kMinBlockSize = 1;
- if (bufferSize < kMinBlockSize)
- bufferSize = kMinBlockSize;
- if (_buffer != 0 && _bufferSize == bufferSize)
- return true;
- Free();
- _bufferSize = bufferSize;
- _buffer = (Byte *)::MidAlloc(bufferSize);
- return (_buffer != 0);
-}
-
-void COutBuffer::Free()
-{
- ::MidFree(_buffer);
- _buffer = 0;
-}
-
-void COutBuffer::SetStream(ISequentialOutStream *stream)
-{
- _stream = stream;
-}
-
-void COutBuffer::Init()
-{
- _streamPos = 0;
- _limitPos = _bufferSize;
- _pos = 0;
- _processedSize = 0;
- _overDict = false;
- #ifdef _NO_EXCEPTIONS
- ErrorCode = S_OK;
- #endif
-}
-
-UInt64 COutBuffer::GetProcessedSize() const
-{
- UInt64 res = _processedSize + _pos - _streamPos;
- if (_streamPos > _pos)
- res += _bufferSize;
- return res;
-}
-
-
-HRESULT COutBuffer::FlushPart()
-{
- // _streamPos < _bufferSize
- UInt32 size = (_streamPos >= _pos) ? (_bufferSize - _streamPos) : (_pos - _streamPos);
- HRESULT result = S_OK;
- #ifdef _NO_EXCEPTIONS
- result = ErrorCode;
- #endif
- if (_buffer2 != 0)
- {
- memmove(_buffer2, _buffer + _streamPos, size);
- _buffer2 += size;
- }
-
- if (_stream != 0
- #ifdef _NO_EXCEPTIONS
- && (ErrorCode == S_OK)
- #endif
- )
- {
- UInt32 processedSize = 0;
- result = _stream->Write(_buffer + _streamPos, size, &processedSize);
- size = processedSize;
- }
- _streamPos += size;
- if (_streamPos == _bufferSize)
- _streamPos = 0;
- if (_pos == _bufferSize)
- {
- _overDict = true;
- _pos = 0;
- }
- _limitPos = (_streamPos > _pos) ? _streamPos : _bufferSize;
- _processedSize += size;
- return result;
-}
-
-HRESULT COutBuffer::Flush()
-{
- #ifdef _NO_EXCEPTIONS
- if (ErrorCode != S_OK)
- return ErrorCode;
- #endif
-
- while(_streamPos != _pos)
- {
- HRESULT result = FlushPart();
- if (result != S_OK)
- return result;
- }
- return S_OK;
-}
-
-void COutBuffer::FlushWithCheck()
-{
- HRESULT result = Flush();
- #ifdef _NO_EXCEPTIONS
- ErrorCode = result;
- #else
- if (result != S_OK)
- throw COutBufferException(result);
- #endif
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutBuffer.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutBuffer.h
deleted file mode 100644
index 62e77caae..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutBuffer.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// OutBuffer.h
-
-#ifndef __OUTBUFFER_H
-#define __OUTBUFFER_H
-
-#include "../IStream.h"
-#include "../../Common/MyCom.h"
-#include "../../Common/MyException.h"
-
-#ifndef _NO_EXCEPTIONS
-struct COutBufferException: public CSystemException
-{
- COutBufferException(HRESULT errorCode): CSystemException(errorCode) {}
-};
-#endif
-
-class COutBuffer
-{
-protected:
- Byte *_buffer;
- UInt32 _pos;
- UInt32 _limitPos;
- UInt32 _streamPos;
- UInt32 _bufferSize;
- CMyComPtr<ISequentialOutStream> _stream;
- UInt64 _processedSize;
- Byte *_buffer2;
- bool _overDict;
-
- HRESULT FlushPart();
-public:
- #ifdef _NO_EXCEPTIONS
- HRESULT ErrorCode;
- #endif
-
- COutBuffer(): _buffer(0), _pos(0), _stream(0), _buffer2(0) {}
- ~COutBuffer() { Free(); }
-
- bool Create(UInt32 bufferSize);
- void Free();
-
- void SetMemStream(Byte *buffer) { _buffer2 = buffer; }
- void SetStream(ISequentialOutStream *stream);
- void Init();
- HRESULT Flush();
- void FlushWithCheck();
- void ReleaseStream() { _stream.Release(); }
-
- void WriteByte(Byte b)
- {
- _buffer[_pos++] = b;
- if(_pos == _limitPos)
- FlushWithCheck();
- }
- void WriteBytes(const void *data, size_t size)
- {
- for (size_t i = 0; i < size; i++)
- WriteByte(((const Byte *)data)[i]);
- }
-
- UInt64 GetProcessedSize() const;
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutMemStream.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutMemStream.cpp
deleted file mode 100644
index ddc314864..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutMemStream.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-// OutMemStream.cpp
-
-#include "StdAfx.h"
-
-#include "OutMemStream.h"
-
-void COutMemStream::Free()
-{
- Blocks.Free(_memManager);
- Blocks.LockMode = true;
-}
-
-void COutMemStream::Init()
-{
- WriteToRealStreamEvent.Reset();
- _unlockEventWasSent = false;
- _realStreamMode = false;
- Free();
- _curBlockPos = 0;
- _curBlockIndex = 0;
-}
-
-void COutMemStream::DetachData(CMemLockBlocks &blocks)
-{
- Blocks.Detach(blocks, _memManager);
- Free();
-}
-
-
-HRESULT COutMemStream::WriteToRealStream()
-{
- RINOK(Blocks.WriteToStream(_memManager->GetBlockSize(), OutSeqStream));
- Blocks.Free(_memManager);
- return S_OK;
-}
-
-STDMETHODIMP COutMemStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- if (_realStreamMode)
- return OutSeqStream->Write(data, size, processedSize);
- if (processedSize != 0)
- *processedSize = 0;
- while(size != 0)
- {
- if ((int)_curBlockIndex < Blocks.Blocks.Size())
- {
- Byte *p = (Byte *)Blocks.Blocks[(int)_curBlockIndex] + _curBlockPos;
- size_t curSize = _memManager->GetBlockSize() - _curBlockPos;
- if (size < curSize)
- curSize = size;
- memmove(p, data, curSize);
- if (processedSize != 0)
- *processedSize += (UInt32)curSize;
- data = (const void *)((const Byte *)data + curSize);
- size -= (UInt32)curSize;
- _curBlockPos += curSize;
-
- UInt64 pos64 = GetPos();
- if (pos64 > Blocks.TotalSize)
- Blocks.TotalSize = pos64;
- if (_curBlockPos == _memManager->GetBlockSize())
- {
- _curBlockIndex++;
- _curBlockPos = 0;
- }
- continue;
- }
- HANDLE events[3] = { StopWritingEvent, WriteToRealStreamEvent, /* NoLockEvent, */ _memManager->Semaphore };
- DWORD waitResult = ::WaitForMultipleObjects((Blocks.LockMode ? 3 : 2), events, FALSE, INFINITE);
- switch (waitResult)
- {
- case (WAIT_OBJECT_0 + 0):
- return StopWriteResult;
- case (WAIT_OBJECT_0 + 1):
- {
- _realStreamMode = true;
- RINOK(WriteToRealStream());
- UInt32 processedSize2;
- HRESULT res = OutSeqStream->Write(data, size, &processedSize2);
- if (processedSize != 0)
- *processedSize += processedSize2;
- return res;
- }
- /*
- case (WAIT_OBJECT_0 + 2):
- {
- // it has bug: no write.
- if (!Blocks.SwitchToNoLockMode(_memManager))
- return E_FAIL;
- break;
- }
- */
- case (WAIT_OBJECT_0 + 2):
- break;
- default:
- return E_FAIL;
- }
- Blocks.Blocks.Add(_memManager->AllocateBlock());
- if (Blocks.Blocks.Back() == 0)
- return E_FAIL;
- }
- return S_OK;
-}
-
-STDMETHODIMP COutMemStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
- if (_realStreamMode)
- {
- if (!OutStream)
- return E_FAIL;
- return OutStream->Seek(offset, seekOrigin, newPosition);
- }
- if (seekOrigin == STREAM_SEEK_CUR)
- {
- if (offset != 0)
- return E_NOTIMPL;
- }
- else if (seekOrigin == STREAM_SEEK_SET)
- {
- if (offset != 0)
- return E_NOTIMPL;
- _curBlockIndex = 0;
- _curBlockPos = 0;
- }
- else
- return E_NOTIMPL;
- if (newPosition != 0)
- *newPosition = GetPos();
- return S_OK;
-}
-
-STDMETHODIMP COutMemStream::SetSize(Int64 newSize)
-{
- if (_realStreamMode)
- {
- if (!OutStream)
- return E_FAIL;
- return OutStream->SetSize(newSize);
- }
- Blocks.TotalSize = newSize;
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutMemStream.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutMemStream.h
deleted file mode 100644
index 4f917976e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/OutMemStream.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// OutMemStream.h
-
-#ifndef __OUTMEMSTREAM_H
-#define __OUTMEMSTREAM_H
-
-#include "Common/MyCom.h"
-#include "MemBlocks.h"
-
-class COutMemStream:
- public IOutStream,
- public CMyUnknownImp
-{
- CMemBlockManagerMt *_memManager;
- size_t _curBlockIndex;
- size_t _curBlockPos;
- bool _realStreamMode;
-
- bool _unlockEventWasSent;
- NWindows::NSynchronization::CAutoResetEventWFMO StopWritingEvent;
- NWindows::NSynchronization::CAutoResetEventWFMO WriteToRealStreamEvent;
- // NWindows::NSynchronization::CAutoResetEvent NoLockEvent;
-
- HRESULT StopWriteResult;
- CMemLockBlocks Blocks;
-
- UInt64 GetPos() const { return (UInt64)_curBlockIndex * _memManager->GetBlockSize() + _curBlockPos; }
-
- CMyComPtr<ISequentialOutStream> OutSeqStream;
- CMyComPtr<IOutStream> OutStream;
-
-public:
-
- HRes CreateEvents(NWindows::NSynchronization::CSynchro *sync)
- {
- RINOK(StopWritingEvent.CreateIfNotCreated(sync));
- return WriteToRealStreamEvent.CreateIfNotCreated(sync);
- }
-
- void SetOutStream(IOutStream *outStream)
- {
- OutStream = outStream;
- OutSeqStream = outStream;
- }
-
- void SetSeqOutStream(ISequentialOutStream *outStream)
- {
- OutStream = NULL;
- OutSeqStream = outStream;
- }
-
- void ReleaseOutStream()
- {
- OutStream.Release();
- OutSeqStream.Release();
- }
-
- COutMemStream(CMemBlockManagerMt *memManager): _memManager(memManager) { }
-
- ~COutMemStream() { Free(); }
- void Free();
-
- void Init();
- HRESULT WriteToRealStream();
-
- void DetachData(CMemLockBlocks &blocks);
-
- bool WasUnlockEventSent() const { return _unlockEventWasSent; }
-
- void SetRealStreamMode()
- {
- _unlockEventWasSent = true;
- WriteToRealStreamEvent.Set();
- }
-
- /*
- void SetNoLockMode()
- {
- _unlockEventWasSent = true;
- NoLockEvent.Set();
- }
- */
-
- void StopWriting(HRESULT res)
- {
- StopWriteResult = res;
- StopWritingEvent.Set();
- }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
- STDMETHOD(SetSize)(Int64 newSize);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressMt.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressMt.cpp
deleted file mode 100644
index 319bd241b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressMt.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// ProgressMt.h
-
-#include "StdAfx.h"
-
-#include "ProgressMt.h"
-
-void CMtCompressProgressMixer::Init(int numItems, ICompressProgressInfo *progress)
-{
- NWindows::NSynchronization::CCriticalSectionLock lock(CriticalSection);
- InSizes.Clear();
- OutSizes.Clear();
- for (int i = 0; i < numItems; i++)
- {
- InSizes.Add(0);
- OutSizes.Add(0);
- }
- TotalInSize = 0;
- TotalOutSize = 0;
- _progress = progress;
-}
-
-void CMtCompressProgressMixer::Reinit(int index)
-{
- NWindows::NSynchronization::CCriticalSectionLock lock(CriticalSection);
- InSizes[index] = 0;
- OutSizes[index] = 0;
-}
-
-HRESULT CMtCompressProgressMixer::SetRatioInfo(int index, const UInt64 *inSize, const UInt64 *outSize)
-{
- NWindows::NSynchronization::CCriticalSectionLock lock(CriticalSection);
- if (inSize != 0)
- {
- UInt64 diff = *inSize - InSizes[index];
- InSizes[index] = *inSize;
- TotalInSize += diff;
- }
- if (outSize != 0)
- {
- UInt64 diff = *outSize - OutSizes[index];
- OutSizes[index] = *outSize;
- TotalOutSize += diff;
- }
- if (_progress)
- return _progress->SetRatioInfo(&TotalInSize, &TotalOutSize);
- return S_OK;
-}
-
-
-STDMETHODIMP CMtCompressProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
- return _progress->SetRatioInfo(_index, inSize, outSize);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressMt.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressMt.h
deleted file mode 100644
index 26079d4e9..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressMt.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// ProgressMt.h
-
-#ifndef __PROGRESSMT_H
-#define __PROGRESSMT_H
-
-#include "../../Common/MyCom.h"
-#include "../../Common/MyVector.h"
-#include "../../Windows/Synchronization.h"
-
-#include "../ICoder.h"
-#include "../IProgress.h"
-
-class CMtCompressProgressMixer
-{
- CMyComPtr<ICompressProgressInfo> _progress;
- CRecordVector<UInt64> InSizes;
- CRecordVector<UInt64> OutSizes;
- UInt64 TotalInSize;
- UInt64 TotalOutSize;
-public:
- NWindows::NSynchronization::CCriticalSection CriticalSection;
- void Init(int numItems, ICompressProgressInfo *progress);
- void Reinit(int index);
- HRESULT SetRatioInfo(int index, const UInt64 *inSize, const UInt64 *outSize);
-};
-
-class CMtCompressProgress:
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
- CMtCompressProgressMixer *_progress;
- int _index;
-public:
- void Init(CMtCompressProgressMixer *progress, int index)
- {
- _progress = progress;
- _index = index;
- }
- void Reinit() { _progress->Reinit(_index); }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressUtils.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressUtils.cpp
deleted file mode 100644
index f24ff6b6f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressUtils.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// ProgressUtils.h
-
-#include "StdAfx.h"
-
-#include "ProgressUtils.h"
-
-CLocalProgress::CLocalProgress()
-{
- ProgressOffset = InSize = OutSize = 0;
- SendRatio = SendProgress = true;
-}
-
-void CLocalProgress::Init(IProgress *progress, bool inSizeIsMain)
-{
- _ratioProgress.Release();
- _progress = progress;
- _progress.QueryInterface(IID_ICompressProgressInfo, &_ratioProgress);
- _inSizeIsMain = inSizeIsMain;
-}
-
-STDMETHODIMP CLocalProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
- UInt64 inSizeNew = InSize, outSizeNew = OutSize;
- if (inSize)
- inSizeNew += (*inSize);
- if (outSize)
- outSizeNew += (*outSize);
- if (SendRatio && _ratioProgress)
- {
- RINOK(_ratioProgress->SetRatioInfo(&inSizeNew, &outSizeNew));
- }
- inSizeNew += ProgressOffset;
- outSizeNew += ProgressOffset;
- if (SendProgress)
- return _progress->SetCompleted(_inSizeIsMain ? &inSizeNew : &outSizeNew);
- return S_OK;
-}
-
-HRESULT CLocalProgress::SetCur()
-{
- return SetRatioInfo(NULL, NULL);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressUtils.h
deleted file mode 100644
index bae5395c1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/ProgressUtils.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// ProgressUtils.h
-
-#ifndef __PROGRESSUTILS_H
-#define __PROGRESSUTILS_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-#include "../IProgress.h"
-
-class CLocalProgress:
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
- CMyComPtr<IProgress> _progress;
- CMyComPtr<ICompressProgressInfo> _ratioProgress;
- bool _inSizeIsMain;
-public:
- UInt64 ProgressOffset;
- UInt64 InSize;
- UInt64 OutSize;
- bool SendRatio;
- bool SendProgress;
-
- CLocalProgress();
- void Init(IProgress *progress, bool inSizeIsMain);
- HRESULT SetCur();
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/RegisterArc.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/RegisterArc.h
deleted file mode 100644
index cd84e469c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/RegisterArc.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// RegisterArc.h
-
-#ifndef __REGISTERARC_H
-#define __REGISTERARC_H
-
-#include "../Archive/IArchive.h"
-
-typedef IInArchive * (*CreateInArchiveP)();
-typedef IOutArchive * (*CreateOutArchiveP)();
-
-struct CArcInfo
-{
- const wchar_t *Name;
- const wchar_t *Ext;
- const wchar_t *AddExt;
- Byte ClassId;
- Byte Signature[16];
- int SignatureSize;
- bool KeepName;
- CreateInArchiveP CreateInArchive;
- CreateOutArchiveP CreateOutArchive;
-};
-
-void RegisterArc(const CArcInfo *arcInfo);
-
-#define REGISTER_ARC_NAME(x) CRegister ## x
-
-#define REGISTER_ARC_DEC_SIG(x) struct REGISTER_ARC_NAME(x) { \
- REGISTER_ARC_NAME(x)() { g_ArcInfo.Signature[0]--; RegisterArc(&g_ArcInfo); }}; \
- static REGISTER_ARC_NAME(x) g_RegisterArc; \
- void registerArc ## x() { static REGISTER_ARC_NAME(x) g_RegisterArc; }
-
-#define REGISTER_ARC(x) struct REGISTER_ARC_NAME(x) { \
- REGISTER_ARC_NAME(x)() { RegisterArc(&g_ArcInfo); }}; \
- static REGISTER_ARC_NAME(x) g_RegisterArc; \
- void registerArc##x() { static REGISTER_ARC_NAME(x) g_RegisterArc; }
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/RegisterCodec.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/RegisterCodec.h
deleted file mode 100644
index 6d300749c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/RegisterCodec.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// RegisterCodec.h
-
-#ifndef __REGISTERCODEC_H
-#define __REGISTERCODEC_H
-
-#include "../Common/MethodId.h"
-
-typedef void * (*CreateCodecP)();
-struct CCodecInfo
-{
- CreateCodecP CreateDecoder;
- CreateCodecP CreateEncoder;
- CMethodId Id;
- const wchar_t *Name;
- UInt32 NumInStreams;
- bool IsFilter;
-};
-
-void RegisterCodec(const CCodecInfo *codecInfo);
-
-#define REGISTER_CODEC_NAME(x) CRegisterCodec ## x
-
-#define REGISTER_CODEC(x) struct REGISTER_CODEC_NAME(x) { \
- REGISTER_CODEC_NAME(x)() { RegisterCodec(&g_CodecInfo); }}; \
- static REGISTER_CODEC_NAME(x) g_RegisterCodec; \
- void registerCodec##x() { static REGISTER_CODEC_NAME(x) g_RegisterCodecs; }
-
-#define REGISTER_CODECS_NAME(x) CRegisterCodecs ## x
-#define REGISTER_CODECS(x) struct REGISTER_CODECS_NAME(x) { \
- REGISTER_CODECS_NAME(x)() { for (size_t i = 0; i < sizeof(g_CodecsInfo) / sizeof(g_CodecsInfo[0]); i++) \
- RegisterCodec(&g_CodecsInfo[i]); }}; \
- static REGISTER_CODECS_NAME(x) g_RegisterCodecs; \
- void registerCodec##x() { static REGISTER_CODECS_NAME(x) g_RegisterCodecs; }
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamBinder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamBinder.cpp
deleted file mode 100644
index 4ad3011e3..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamBinder.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-// StreamBinder.cpp
-
-#include "StdAfx.h"
-
-#include "StreamBinder.h"
-#include "../../Common/Defs.h"
-#include "../../Common/MyCom.h"
-
-#include <cstdio>
-
-using namespace NWindows;
-using namespace NSynchronization;
-
-class CSequentialInStreamForBinder:
- public ISequentialInStream,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-private:
- CStreamBinder *m_StreamBinder;
-public:
- ~CSequentialInStreamForBinder() { m_StreamBinder->CloseRead(); }
- void SetBinder(CStreamBinder *streamBinder) { m_StreamBinder = streamBinder; }
-};
-
-STDMETHODIMP CSequentialInStreamForBinder::Read(void *data, UInt32 size, UInt32 *processedSize)
- { return m_StreamBinder->Read(data, size, processedSize); }
-
-class CSequentialOutStreamForBinder:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-
-private:
- CStreamBinder *m_StreamBinder;
-public:
- ~CSequentialOutStreamForBinder() { m_StreamBinder->CloseWrite(); }
- void SetBinder(CStreamBinder *streamBinder) { m_StreamBinder = streamBinder; }
-};
-
-STDMETHODIMP CSequentialOutStreamForBinder::Write(const void *data, UInt32 size, UInt32 *processedSize)
- { return m_StreamBinder->Write(data, size, processedSize); }
-
-
-//////////////////////////
-// CStreamBinder
-// (_thereAreBytesToReadEvent && _bufferSize == 0) means that stream is finished.
-
-HRes CStreamBinder::CreateEvents()
-{
-#ifdef _WIN32
- RINOK(_allBytesAreWritenEvent.Create(true));
- RINOK(_thereAreBytesToReadEvent.Create());
- return _readStreamIsClosedEvent.Create();
-#else
- _synchroFor_allBytesAreWritenEvent_and_readStreamIsClosedEvent = new NWindows::NSynchronization::CSynchro();
- _synchroFor_allBytesAreWritenEvent_and_readStreamIsClosedEvent->Create();
- RINOK(_allBytesAreWritenEvent.Create(_synchroFor_allBytesAreWritenEvent_and_readStreamIsClosedEvent,true));
- RINOK(_thereAreBytesToReadEvent.Create());
- return _readStreamIsClosedEvent.Create(_synchroFor_allBytesAreWritenEvent_and_readStreamIsClosedEvent);
-#endif
-}
-
-void CStreamBinder::ReInit()
-{
- _thereAreBytesToReadEvent.Reset();
- _readStreamIsClosedEvent.Reset();
- ProcessedSize = 0;
-}
-
-
-
-void CStreamBinder::CreateStreams(ISequentialInStream **inStream,
- ISequentialOutStream **outStream)
-{
- CSequentialInStreamForBinder *inStreamSpec = new
- CSequentialInStreamForBinder;
- CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
- inStreamSpec->SetBinder(this);
- *inStream = inStreamLoc.Detach();
-
- CSequentialOutStreamForBinder *outStreamSpec = new
- CSequentialOutStreamForBinder;
- CMyComPtr<ISequentialOutStream> outStreamLoc(outStreamSpec);
- outStreamSpec->SetBinder(this);
- *outStream = outStreamLoc.Detach();
-
- _buffer = NULL;
- _bufferSize= 0;
- ProcessedSize = 0;
-}
-
-HRESULT CStreamBinder::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 sizeToRead = size;
- if (size > 0)
- {
- RINOK(_thereAreBytesToReadEvent.Lock());
- sizeToRead = MyMin(_bufferSize, size);
- if (_bufferSize > 0)
- {
- memcpy(data, _buffer, sizeToRead);
- _buffer = ((const Byte *)_buffer) + sizeToRead;
- _bufferSize -= sizeToRead;
- if (_bufferSize == 0)
- {
- _thereAreBytesToReadEvent.Reset();
- _allBytesAreWritenEvent.Set();
- }
- }
- }
- if (processedSize != NULL)
- *processedSize = sizeToRead;
- ProcessedSize += sizeToRead;
- return S_OK;
-}
-
-void CStreamBinder::CloseRead()
-{
- _readStreamIsClosedEvent.Set();
-}
-
-HRESULT CStreamBinder::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- if (size > 0)
- {
- _buffer = data;
- _bufferSize = size;
- _allBytesAreWritenEvent.Reset();
- _thereAreBytesToReadEvent.Set();
-
- HANDLE events[2];
- events[0] = _allBytesAreWritenEvent;
- events[1] = _readStreamIsClosedEvent;
- DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE);
- if (waitResult != WAIT_OBJECT_0 + 0)
- {
- // ReadingWasClosed = true;
- printf("Error: WaitForMultipleObjects in CStreamBinder::Write failed\n");
- return S_FALSE;
- }
- // if(!_allBytesAreWritenEvent.Lock())
- // return E_FAIL;
- }
- if (processedSize != NULL)
- *processedSize = size;
- return S_OK;
-}
-
-void CStreamBinder::CloseWrite()
-{
- // _bufferSize must be = 0
- _thereAreBytesToReadEvent.Set();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamBinder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamBinder.h
deleted file mode 100644
index 1cd45a451..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamBinder.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// StreamBinder.h
-
-#ifndef __STREAMBINDER_H
-#define __STREAMBINDER_H
-
-#include "../IStream.h"
-#include "../../Windows/Synchronization.h"
-
-class CStreamBinder
-{
-#ifdef _WIN32
- NWindows::NSynchronization::CManualResetEvent _allBytesAreWritenEvent;
- NWindows::NSynchronization::CManualResetEvent _thereAreBytesToReadEvent;
- NWindows::NSynchronization::CManualResetEvent _readStreamIsClosedEvent;
-#else
- NWindows::NSynchronization::CManualResetEventWFMO _allBytesAreWritenEvent;
- NWindows::NSynchronization::CManualResetEvent _thereAreBytesToReadEvent;
- NWindows::NSynchronization::CManualResetEventWFMO _readStreamIsClosedEvent;
- NWindows::NSynchronization::CSynchro * _synchroFor_allBytesAreWritenEvent_and_readStreamIsClosedEvent;
-#endif
- UInt32 _bufferSize;
- const void *_buffer;
-public:
- // bool ReadingWasClosed;
- UInt64 ProcessedSize;
-
-#ifndef _WIN32
- CStreamBinder() { _synchroFor_allBytesAreWritenEvent_and_readStreamIsClosedEvent = 0; }
- ~CStreamBinder() {
- if (_synchroFor_allBytesAreWritenEvent_and_readStreamIsClosedEvent)
- delete _synchroFor_allBytesAreWritenEvent_and_readStreamIsClosedEvent;
- _synchroFor_allBytesAreWritenEvent_and_readStreamIsClosedEvent = 0;
- }
-#endif
-
- HRes CreateEvents();
-
- void CreateStreams(ISequentialInStream **inStream,
- ISequentialOutStream **outStream);
- HRESULT Read(void *data, UInt32 size, UInt32 *processedSize);
- void CloseRead();
-
- HRESULT Write(const void *data, UInt32 size, UInt32 *processedSize);
- void CloseWrite();
- void ReInit();
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamObjects.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamObjects.cpp
deleted file mode 100644
index e043e5652..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamObjects.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// StreamObjects.cpp
-
-#include "StdAfx.h"
-
-#include "StreamObjects.h"
-#include "../../Common/Defs.h"
-
-
-STDMETHODIMP CSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- size_t rem = _size - _pos;
- if (size < rem)
- rem = (size_t)size;
- memcpy(data, _dataPointer + _pos, rem);
- _pos += rem;
- if (processedSize != NULL)
- *processedSize = (UInt32)rem;
- return S_OK;
-}
-
-
-void CWriteBuffer::Write(const void *data, size_t size)
-{
- size_t newCapacity = _size + size;
- _buffer.EnsureCapacity(newCapacity);
- memcpy(_buffer + _size, data, size);
- _size += size;
-}
-
-STDMETHODIMP CSequentialOutStreamImp::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- _writeBuffer.Write(data, (size_t)size);
- if(processedSize != NULL)
- *processedSize = size;
- return S_OK;
-}
-
-STDMETHODIMP CSequentialOutStreamImp2::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- size_t rem = _size - _pos;
- if (size < rem)
- rem = (size_t)size;
- memcpy(_buffer + _pos, data, rem);
- _pos += rem;
- if (processedSize != NULL)
- *processedSize = (UInt32)rem;
- return (rem == size ? S_OK : E_FAIL);
-}
-
-STDMETHODIMP CSequentialInStreamSizeCount::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize;
- HRESULT result = _stream->Read(data, size, &realProcessedSize);
- _size += realProcessedSize;
- if (processedSize != 0)
- *processedSize = realProcessedSize;
- return result;
-}
-
-STDMETHODIMP CSequentialOutStreamSizeCount::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize;
- HRESULT result = _stream->Write(data, size, &realProcessedSize);
- _size += realProcessedSize;
- if (processedSize != 0)
- *processedSize = realProcessedSize;
- return result;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamObjects.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamObjects.h
deleted file mode 100644
index a21089cbb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamObjects.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// StreamObjects.h
-
-#ifndef __STREAMOBJECTS_H
-#define __STREAMOBJECTS_H
-
-#include "../../Common/DynamicBuffer.h"
-#include "../../Common/MyCom.h"
-#include "../IStream.h"
-
-class CSequentialInStreamImp:
- public ISequentialInStream,
- public CMyUnknownImp
-{
- const Byte *_dataPointer;
- size_t _size;
- size_t _pos;
-
-public:
- void Init(const Byte *dataPointer, size_t size)
- {
- _dataPointer = dataPointer;
- _size = size;
- _pos = 0;
- }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-
-class CWriteBuffer
-{
- CByteDynamicBuffer _buffer;
- size_t _size;
-public:
- CWriteBuffer(): _size(0) {}
- void Init() { _size = 0; }
- void Write(const void *data, size_t size);
- size_t GetSize() const { return _size; }
- const CByteDynamicBuffer& GetBuffer() const { return _buffer; }
-};
-
-class CSequentialOutStreamImp:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- CWriteBuffer _writeBuffer;
-public:
- void Init() { _writeBuffer.Init(); }
- size_t GetSize() const { return _writeBuffer.GetSize(); }
- const CByteDynamicBuffer& GetBuffer() const { return _writeBuffer.GetBuffer(); }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-class CSequentialOutStreamImp2:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- Byte *_buffer;
- size_t _size;
- size_t _pos;
-public:
-
- void Init(Byte *buffer, size_t size)
- {
- _buffer = buffer;
- _pos = 0;
- _size = size;
- }
-
- size_t GetPos() const { return _pos; }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-class CSequentialInStreamSizeCount:
- public ISequentialInStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialInStream> _stream;
- UInt64 _size;
-public:
- void Init(ISequentialInStream *stream)
- {
- _stream = stream;
- _size = 0;
- }
- UInt64 GetSize() const { return _size; }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-class CSequentialOutStreamSizeCount:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialOutStream> _stream;
- UInt64 _size;
-public:
- void SetStream(ISequentialOutStream *stream) { _stream = stream; }
- void Init() { _size = 0; }
- UInt64 GetSize() const { return _size; }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamUtils.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamUtils.cpp
deleted file mode 100644
index 049e4aa17..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamUtils.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// StreamUtils.cpp
-
-#include "StdAfx.h"
-
-#include "StreamUtils.h"
-
-static const UInt32 kBlockSize = ((UInt32)1 << 31);
-
-HRESULT ReadStream(ISequentialInStream *stream, void *data, size_t *processedSize)
-{
- size_t size = *processedSize;
- *processedSize = 0;
- while (size != 0)
- {
- UInt32 curSize = (size < kBlockSize) ? (UInt32)size : kBlockSize;
- UInt32 processedSizeLoc;
- HRESULT res = stream->Read(data, curSize, &processedSizeLoc);
- *processedSize += processedSizeLoc;
- data = (void *)((Byte *)data + processedSizeLoc);
- size -= processedSizeLoc;
- RINOK(res);
- if (processedSizeLoc == 0)
- return S_OK;
- }
- return S_OK;
-}
-
-HRESULT ReadStream_FALSE(ISequentialInStream *stream, void *data, size_t size)
-{
- size_t processedSize = size;
- RINOK(ReadStream(stream, data, &processedSize));
- return (size == processedSize) ? S_OK : S_FALSE;
-}
-
-HRESULT ReadStream_FAIL(ISequentialInStream *stream, void *data, size_t size)
-{
- size_t processedSize = size;
- RINOK(ReadStream(stream, data, &processedSize));
- return (size == processedSize) ? S_OK : E_FAIL;
-}
-
-HRESULT WriteStream(ISequentialOutStream *stream, const void *data, size_t size)
-{
- while (size != 0)
- {
- UInt32 curSize = (size < kBlockSize) ? (UInt32)size : kBlockSize;
- UInt32 processedSizeLoc;
- HRESULT res = stream->Write(data, curSize, &processedSizeLoc);
- data = (const void *)((const Byte *)data + processedSizeLoc);
- size -= processedSizeLoc;
- RINOK(res);
- if (processedSizeLoc == 0)
- return E_FAIL;
- }
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamUtils.h
deleted file mode 100644
index f1cfd1848..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/StreamUtils.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// StreamUtils.h
-
-#ifndef __STREAMUTILS_H
-#define __STREAMUTILS_H
-
-#include "../IStream.h"
-
-HRESULT ReadStream(ISequentialInStream *stream, void *data, size_t *size);
-HRESULT ReadStream_FALSE(ISequentialInStream *stream, void *data, size_t size);
-HRESULT ReadStream_FAIL(ISequentialInStream *stream, void *data, size_t size);
-HRESULT WriteStream(ISequentialOutStream *stream, const void *data, size_t size);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/VirtThread.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/VirtThread.cpp
deleted file mode 100644
index cf39bd023..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/VirtThread.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// VirtThread.cpp
-
-#include "StdAfx.h"
-
-#include "VirtThread.h"
-
-static THREAD_FUNC_DECL CoderThread(void *p)
-{
- for (;;)
- {
- CVirtThread *t = (CVirtThread *)p;
- t->StartEvent.Lock();
- if (t->ExitEvent)
- return 0;
- t->Execute();
- t->FinishedEvent.Set();
- }
-}
-
-WRes CVirtThread::Create()
-{
- RINOK(StartEvent.CreateIfNotCreated());
- RINOK(FinishedEvent.CreateIfNotCreated());
- StartEvent.Reset();
- FinishedEvent.Reset();
- ExitEvent = false;
- if (Thread.IsCreated())
- return S_OK;
- return Thread.Create(CoderThread, this);
-}
-
-void CVirtThread::Start()
-{
- ExitEvent = false;
- StartEvent.Set();
-}
-
-CVirtThread::~CVirtThread()
-{
- ExitEvent = true;
- if (StartEvent.IsCreated())
- StartEvent.Set();
- if (Thread.IsCreated())
- Thread.Wait();
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/VirtThread.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/VirtThread.h
deleted file mode 100644
index 3830975e1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Common/VirtThread.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// VirtThread.h
-
-#ifndef __VIRTTHREAD_H
-#define __VIRTTHREAD_H
-
-#include "../../Windows/Synchronization.h"
-#include "../../Windows/Thread.h"
-
-struct CVirtThread
-{
- NWindows::NSynchronization::CAutoResetEvent StartEvent;
- NWindows::NSynchronization::CAutoResetEvent FinishedEvent;
- NWindows::CThread Thread;
- bool ExitEvent;
-
- virtual ~CVirtThread();
- WRes Create();
- void Start();
- void WaitFinish() { FinishedEvent.Lock(); }
- virtual void Execute() = 0;
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder1.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder1.cpp
deleted file mode 100644
index 3e66feeb6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder1.cpp
+++ /dev/null
@@ -1,315 +0,0 @@
-// ArjDecoder1.cpp
-
-#include "StdAfx.h"
-
-#include "ArjDecoder1.h"
-
-namespace NCompress{
-namespace NArj {
-namespace NDecoder1 {
-
-static const UInt32 kHistorySize = 26624;
-static const UInt32 kMatchMinLen = 3;
-static const UInt32 kMatchMaxLen = 256;
-
-// static const UInt32 kNC = 255 + kMatchMaxLen + 2 - kMatchMinLen;
-
-void CCoder::MakeTable(int nchar, Byte *bitlen, int tablebits,
- UInt32 *table, int tablesize)
-{
- UInt32 count[17], weight[17], start[18], *p;
- UInt32 i, k, len, ch, jutbits, avail, nextcode, mask;
-
- for (i = 1; i <= 16; i++)
- count[i] = 0;
- for (i = 0; (int)i < nchar; i++)
- count[bitlen[i]]++;
-
- start[1] = 0;
- for (i = 1; i <= 16; i++)
- start[i + 1] = start[i] + (count[i] << (16 - i));
- if (start[17] != (UInt32) (1 << 16))
- throw "Data error";
-
- jutbits = 16 - tablebits;
- for (i = 1; (int)i <= tablebits; i++)
- {
- start[i] >>= jutbits;
- weight[i] = 1 << (tablebits - i);
- }
- while (i <= 16)
- {
- weight[i] = 1 << (16 - i);
- i++;
- }
-
- i = start[tablebits + 1] >> jutbits;
- if (i != (UInt32) (1 << 16))
- {
- k = 1 << tablebits;
- while (i != k)
- table[i++] = 0;
- }
-
- avail = nchar;
- mask = 1 << (15 - tablebits);
- for (ch = 0; (int)ch < nchar; ch++)
- {
- if ((len = bitlen[ch]) == 0)
- continue;
- k = start[len];
- nextcode = k + weight[len];
- if ((int)len <= tablebits)
- {
- if (nextcode > (UInt32)tablesize)
- throw "Data error";
- for (i = start[len]; i < nextcode; i++)
- table[i] = ch;
- }
- else
- {
- p = &table[k >> jutbits];
- i = len - tablebits;
- while (i != 0)
- {
- if (*p == 0)
- {
- right[avail] = left[avail] = 0;
- *p = avail++;
- }
- if (k & mask)
- p = &right[*p];
- else
- p = &left[*p];
- k <<= 1;
- i--;
- }
- *p = ch;
- }
- start[len] = nextcode;
- }
-}
-
-void CCoder::read_pt_len(int nn, int nbit, int i_special)
-{
- UInt32 n = m_InBitStream.ReadBits(nbit);
- if (n == 0)
- {
- UInt32 c = m_InBitStream.ReadBits(nbit);
- int i;
- for (i = 0; i < nn; i++)
- pt_len[i] = 0;
- for (i = 0; i < 256; i++)
- pt_table[i] = c;
- }
- else
- {
- UInt32 i = 0;
- while (i < n)
- {
- UInt32 bitBuf = m_InBitStream.GetValue(16);
- int c = bitBuf >> 13;
- if (c == 7)
- {
- UInt32 mask = 1 << (12);
- while (mask & bitBuf)
- {
- mask >>= 1;
- c++;
- }
- }
- m_InBitStream.MovePos((c < 7) ? 3 : (int)(c - 3));
- pt_len[i++] = (Byte)c;
- if (i == (UInt32)i_special)
- {
- c = m_InBitStream.ReadBits(2);
- while (--c >= 0)
- pt_len[i++] = 0;
- }
- }
- while (i < (UInt32)nn)
- pt_len[i++] = 0;
- MakeTable(nn, pt_len, 8, pt_table, PTABLESIZE);
- }
-}
-
-void CCoder::read_c_len()
-{
- int i, c, n;
- UInt32 mask;
-
- n = m_InBitStream.ReadBits(CBIT);
- if (n == 0)
- {
- c = m_InBitStream.ReadBits(CBIT);
- for (i = 0; i < NC; i++)
- c_len[i] = 0;
- for (i = 0; i < CTABLESIZE; i++)
- c_table[i] = c;
- }
- else
- {
- i = 0;
- while (i < n)
- {
- UInt32 bitBuf = m_InBitStream.GetValue(16);
- c = pt_table[bitBuf >> (8)];
- if (c >= NT)
- {
- mask = 1 << (7);
- do
- {
- if (bitBuf & mask)
- c = right[c];
- else
- c = left[c];
- mask >>= 1;
- } while (c >= NT);
- }
- m_InBitStream.MovePos((int)(pt_len[c]));
- if (c <= 2)
- {
- if (c == 0)
- c = 1;
- else if (c == 1)
- c = m_InBitStream.ReadBits(4) + 3;
- else
- c = m_InBitStream.ReadBits(CBIT) + 20;
- while (--c >= 0)
- c_len[i++] = 0;
- }
- else
- c_len[i++] = (Byte)(c - 2);
- }
- while (i < NC)
- c_len[i++] = 0;
- MakeTable(NC, c_len, 12, c_table, CTABLESIZE);
- }
-}
-
-UInt32 CCoder::decode_c()
-{
- UInt32 j, mask;
- UInt32 bitbuf = m_InBitStream.GetValue(16);
- j = c_table[bitbuf >> 4];
- if (j >= NC)
- {
- mask = 1 << (3);
- do
- {
- if (bitbuf & mask)
- j = right[j];
- else
- j = left[j];
- mask >>= 1;
- } while (j >= NC);
- }
- m_InBitStream.MovePos((int)(c_len[j]));
- return j;
-}
-
-UInt32 CCoder::decode_p()
-{
- UInt32 j, mask;
- UInt32 bitbuf = m_InBitStream.GetValue(16);
- j = pt_table[bitbuf >> (8)];
- if (j >= NP)
- {
- mask = 1 << (7);
- do
- {
- if (bitbuf & mask)
- j = right[j];
- else
- j = left[j];
- mask >>= 1;
- } while (j >= NP);
- }
- m_InBitStream.MovePos((int)(pt_len[j]));
- if (j != 0)
- {
- j--;
- j = (1 << j) + m_InBitStream.ReadBits((int)j);
- }
- return j;
-}
-
-
-HRESULT CCoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- if (outSize == NULL)
- return E_INVALIDARG;
-
- if (!m_OutWindowStream.Create(kHistorySize))
- return E_OUTOFMEMORY;
- if (!m_InBitStream.Create(1 << 20))
- return E_OUTOFMEMORY;
-
- int size1 = sizeof(c_table) / sizeof(c_table[0]);
- for (int i = 0; i < size1; i++)
- {
- if (i % 100 == 0)
- c_table[i] = 0;
-
- c_table[i] = 0;
- }
-
-
- UInt64 pos = 0;
- m_OutWindowStream.SetStream(outStream);
- m_OutWindowStream.Init(false);
- m_InBitStream.SetStream(inStream);
- m_InBitStream.Init();
-
- CCoderReleaser coderReleaser(this);
-
- UInt32 blockSize = 0;
-
- while(pos < *outSize)
- {
- if (blockSize == 0)
- {
- if (progress != NULL)
- {
- UInt64 packSize = m_InBitStream.GetProcessedSize();
- RINOK(progress->SetRatioInfo(&packSize, &pos));
- }
- blockSize = m_InBitStream.ReadBits(16);
- read_pt_len(NT, TBIT, 3);
- read_c_len();
- read_pt_len(NP, PBIT, -1);
- }
- blockSize--;
-
- UInt32 number = decode_c();
- if (number < 256)
- {
- m_OutWindowStream.PutByte((Byte)number);
- pos++;
- continue;
- }
- else
- {
- UInt32 len = number - 256 + kMatchMinLen;
- UInt32 distance = decode_p();
- if (distance >= pos)
- return S_FALSE;
- m_OutWindowStream.CopyBlock(distance, len);
- pos += len;
- }
- }
- coderReleaser.NeedFlush = false;
- return m_OutWindowStream.Flush();
-}
-
-STDMETHODIMP CCoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress);}
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(const CLzOutWindowException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder1.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder1.h
deleted file mode 100644
index 17939dafb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder1.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// ArjDecoder1.h
-
-#ifndef __COMPRESS_ARJ_DECODER1_H
-#define __COMPRESS_ARJ_DECODER1_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "../Common/InBuffer.h"
-
-#include "BitmDecoder.h"
-#include "LzOutWindow.h"
-
-namespace NCompress {
-namespace NArj {
-namespace NDecoder1 {
-
-#define CODE_BIT 16
-
-#define THRESHOLD 3
-#define DDICSIZ 26624
-#define MAXDICBIT 16
-#define MATCHBIT 8
-#define MAXMATCH 256
-#define NC (0xFF + MAXMATCH + 2 - THRESHOLD)
-#define NP (MAXDICBIT + 1)
-#define CBIT 9
-#define NT (CODE_BIT + 3)
-#define PBIT 5
-#define TBIT 5
-
-#if NT > NP
-#define NPT NT
-#else
-#define NPT NP
-#endif
-
-#define CTABLESIZE 4096
-#define PTABLESIZE 256
-
-
-class CCoder :
- public ICompressCoder,
- public CMyUnknownImp
-{
- CLzOutWindow m_OutWindowStream;
- NBitm::CDecoder<CInBuffer> m_InBitStream;
-
- UInt32 left[2 * NC - 1];
- UInt32 right[2 * NC - 1];
- Byte c_len[NC];
- Byte pt_len[NPT];
-
- UInt32 c_table[CTABLESIZE];
- UInt32 pt_table[PTABLESIZE];
-
- void ReleaseStreams()
- {
- m_OutWindowStream.ReleaseStream();
- m_InBitStream.ReleaseStream();
- }
-
- class CCoderReleaser
- {
- CCoder *m_Coder;
- public:
- bool NeedFlush;
- CCoderReleaser(CCoder *coder): m_Coder(coder), NeedFlush(true) {}
- ~CCoderReleaser()
- {
- if (NeedFlush)
- m_Coder->m_OutWindowStream.Flush();
- m_Coder->ReleaseStreams();
- }
- };
- friend class CCoderReleaser;
-
- void MakeTable(int nchar, Byte *bitlen, int tablebits, UInt32 *table, int tablesize);
-
- void read_c_len();
- void read_pt_len(int nn, int nbit, int i_special);
- UInt32 decode_c();
- UInt32 decode_p();
-
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-public:
- MY_UNKNOWN_IMP
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
-};
-
-}}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder2.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder2.cpp
deleted file mode 100644
index 365993bc5..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder2.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-// ArjDecoder2.cpp
-
-#include "StdAfx.h"
-
-#include "ArjDecoder2.h"
-
-namespace NCompress{
-namespace NArj {
-namespace NDecoder2 {
-
-static const UInt32 kHistorySize = 26624;
-static const UInt32 kMatchMinLen = 3;
-
-HRESULT CCoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo * /* progress */)
-{
- if (outSize == NULL)
- return E_INVALIDARG;
-
- if (!m_OutWindowStream.Create(kHistorySize))
- return E_OUTOFMEMORY;
- if (!m_InBitStream.Create(1 << 20))
- return E_OUTOFMEMORY;
-
- UInt64 pos = 0;
- m_OutWindowStream.SetStream(outStream);
- m_OutWindowStream.Init(false);
- m_InBitStream.SetStream(inStream);
- m_InBitStream.Init();
- CCoderReleaser coderReleaser(this);
-
- while(pos < *outSize)
- {
- const UInt32 kStartWidth = 0;
- const UInt32 kStopWidth = 7;
- UInt32 power = 1 << kStartWidth;
- UInt32 width;
- UInt32 len = 0;
- for (width = kStartWidth; width < kStopWidth; width++)
- {
- if (m_InBitStream.ReadBits(1) == 0)
- break;
- len += power;
- power <<= 1;
- }
- if (width != 0)
- len += m_InBitStream.ReadBits(width);
- if (len == 0)
- {
- m_OutWindowStream.PutByte((Byte)m_InBitStream.ReadBits(8));
- pos++;
- continue;
- }
- else
- {
- len = len - 1 + kMatchMinLen;
- const UInt32 kStartWidth = 9;
- const UInt32 kStopWidth = 13;
- UInt32 power = 1 << kStartWidth;
- UInt32 width;
- UInt32 distance = 0;
- for (width = kStartWidth; width < kStopWidth; width++)
- {
- if (m_InBitStream.ReadBits(1) == 0)
- break;
- distance += power;
- power <<= 1;
- }
- if (width != 0)
- distance += m_InBitStream.ReadBits(width);
- if (distance >= pos)
- return S_FALSE;
- m_OutWindowStream.CopyBlock(distance, len);
- pos += len;
- }
- }
- coderReleaser.NeedFlush = false;
- return m_OutWindowStream.Flush();
-}
-
-STDMETHODIMP CCoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress);}
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(const CLzOutWindowException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder2.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder2.h
deleted file mode 100644
index cf00975da..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ArjDecoder2.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// ArjDecoder2.h
-
-#ifndef __COMPRESS_ARJ_DECODER2_H
-#define __COMPRESS_ARJ_DECODER2_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "../Common/InBuffer.h"
-
-#include "BitmDecoder.h"
-#include "LzOutWindow.h"
-
-namespace NCompress {
-namespace NArj {
-namespace NDecoder2 {
-
-class CCoder :
- public ICompressCoder,
- public CMyUnknownImp
-{
- CLzOutWindow m_OutWindowStream;
- NBitm::CDecoder<CInBuffer> m_InBitStream;
-
- void ReleaseStreams()
- {
- m_OutWindowStream.ReleaseStream();
- m_InBitStream.ReleaseStream();
- }
-
- class CCoderReleaser
- {
- CCoder *m_Coder;
- public:
- bool NeedFlush;
- CCoderReleaser(CCoder *coder): m_Coder(coder), NeedFlush(true) {}
- ~CCoderReleaser()
- {
- if (NeedFlush)
- m_Coder->m_OutWindowStream.Flush();
- m_Coder->ReleaseStreams();
- }
- };
- friend class CCoderReleaser;
-
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-public:
- MY_UNKNOWN_IMP
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
-};
-
-}}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Const.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Const.h
deleted file mode 100644
index 62427aa68..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Const.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Compress/BZip2Const.h
-
-#ifndef __COMPRESS_BZIP2_CONST_H
-#define __COMPRESS_BZIP2_CONST_H
-
-namespace NCompress {
-namespace NBZip2 {
-
-const Byte kArSig0 = 'B';
-const Byte kArSig1 = 'Z';
-const Byte kArSig2 = 'h';
-const Byte kArSig3 = '0';
-
-const Byte kFinSig0 = 0x17;
-const Byte kFinSig1 = 0x72;
-const Byte kFinSig2 = 0x45;
-const Byte kFinSig3 = 0x38;
-const Byte kFinSig4 = 0x50;
-const Byte kFinSig5 = 0x90;
-
-const Byte kBlockSig0 = 0x31;
-const Byte kBlockSig1 = 0x41;
-const Byte kBlockSig2 = 0x59;
-const Byte kBlockSig3 = 0x26;
-const Byte kBlockSig4 = 0x53;
-const Byte kBlockSig5 = 0x59;
-
-const int kNumOrigBits = 24;
-
-const int kNumTablesBits = 3;
-const int kNumTablesMin = 2;
-const int kNumTablesMax = 6;
-
-const int kNumLevelsBits = 5;
-
-const int kMaxHuffmanLen = 20; // Check it
-
-const int kMaxAlphaSize = 258;
-
-const int kGroupSize = 50;
-
-const int kBlockSizeMultMin = 1;
-const int kBlockSizeMultMax = 9;
-const UInt32 kBlockSizeStep = 100000;
-const UInt32 kBlockSizeMax = kBlockSizeMultMax * kBlockSizeStep;
-
-const int kNumSelectorsBits = 15;
-const UInt32 kNumSelectorsMax = (2 + (kBlockSizeMax / kGroupSize));
-
-const int kRleModeRepSize = 4;
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Crc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Crc.cpp
deleted file mode 100644
index 4e4741f40..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Crc.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// BZip2Crc.cpp
-
-#include "StdAfx.h"
-
-#include "BZip2Crc.h"
-
-UInt32 CBZip2Crc::Table[256];
-
-static const UInt32 kBZip2CrcPoly = 0x04c11db7; /* AUTODIN II, Ethernet, & FDDI */
-
-void CBZip2Crc::InitTable()
-{
- for (UInt32 i = 0; i < 256; i++)
- {
- UInt32 r = (i << 24);
- for (int j = 8; j > 0; j--)
- r = (r & 0x80000000) ? ((r << 1) ^ kBZip2CrcPoly) : (r << 1);
- Table[i] = r;
- }
-}
-
-class CBZip2CrcTableInit
-{
-public:
- CBZip2CrcTableInit() { CBZip2Crc::InitTable(); }
-} g_BZip2CrcTableInit;
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Crc.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Crc.h
deleted file mode 100644
index 876945b5f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Crc.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// BZip2Crc.h
-
-#ifndef __BZIP2_CRC_H
-#define __BZIP2_CRC_H
-
-#include "Common/Types.h"
-
-class CBZip2Crc
-{
- UInt32 _value;
- static UInt32 Table[256];
-public:
- static void InitTable();
- CBZip2Crc(): _value(0xFFFFFFFF) {};
- void Init() { _value = 0xFFFFFFFF; }
- void UpdateByte(Byte b) { _value = Table[(_value >> 24) ^ b] ^ (_value << 8); }
- void UpdateByte(unsigned int b) { _value = Table[(_value >> 24) ^ b] ^ (_value << 8); }
- UInt32 GetDigest() const { return _value ^ 0xFFFFFFFF; }
-};
-
-class CBZip2CombinedCrc
-{
- UInt32 _value;
-public:
- CBZip2CombinedCrc(): _value(0){};
- void Init() { _value = 0; }
- void Update(UInt32 v) { _value = ((_value << 1) | (_value >> 31)) ^ v; }
- UInt32 GetDigest() const { return _value ; }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Decoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Decoder.cpp
deleted file mode 100644
index 7b97b93e0..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Decoder.cpp
+++ /dev/null
@@ -1,813 +0,0 @@
-// BZip2Decoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "../../Common/Defs.h"
-
-#include "BZip2Crc.h"
-#include "BZip2Decoder.h"
-#include "Mtf8.h"
-
-namespace NCompress {
-namespace NBZip2 {
-
-#ifndef NO_INLINE
-#define NO_INLINE MY_FAST_CALL
-#endif
-
-const UInt32 kNumThreadsMax = 4;
-
-static const UInt32 kBufferSize = (1 << 17);
-
-static Int16 kRandNums[512] = {
- 619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
- 985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
- 733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
- 419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
- 878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
- 862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
- 150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
- 170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
- 73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
- 909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
- 641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
- 161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
- 382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
- 98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
- 227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
- 469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
- 184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
- 715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
- 951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
- 652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
- 645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
- 609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
- 653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
- 411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
- 170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
- 857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
- 669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
- 944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
- 344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
- 897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
- 433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
- 686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
- 946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
- 978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
- 680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
- 707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
- 297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
- 134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
- 343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
- 140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
- 170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
- 369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
- 804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
- 896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
- 661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
- 768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
- 61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
- 372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
- 780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
- 920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
- 645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
- 936, 638
-};
-
-bool CState::Alloc()
-{
- if (Counters == 0)
- Counters = (UInt32 *)BigAlloc((256 + kBlockSizeMax) * sizeof(UInt32));
- return (Counters != 0);
-}
-
-void CState::Free()
-{
- ::BigFree(Counters);
- Counters = 0;
-}
-
-UInt32 CDecoder::ReadBits(int numBits) { return m_InStream.ReadBits(numBits); }
-Byte CDecoder::ReadByte() {return (Byte)ReadBits(8); }
-bool CDecoder::ReadBit() { return ReadBits(1) != 0; }
-
-UInt32 CDecoder::ReadCrc()
-{
- UInt32 crc = 0;
- for (int i = 0; i < 4; i++)
- {
- crc <<= 8;
- crc |= ReadByte();
- }
- return crc;
-}
-
-UInt32 NO_INLINE ReadBits(NBitm::CDecoder<CInBuffer> *m_InStream, int num)
-{
- return m_InStream->ReadBits(num);
-}
-
-UInt32 NO_INLINE ReadBit(NBitm::CDecoder<CInBuffer> *m_InStream)
-{
- return m_InStream->ReadBits(1);
-}
-
-static HRESULT NO_INLINE ReadBlock(NBitm::CDecoder<CInBuffer> *m_InStream,
- UInt32 *CharCounters, UInt32 blockSizeMax, Byte *m_Selectors, CHuffmanDecoder *m_HuffmanDecoders,
- UInt32 *blockSizeRes, UInt32 *origPtrRes, bool *randRes)
-{
- *randRes = ReadBit(m_InStream) ? true : false;
- *origPtrRes = ReadBits(m_InStream, kNumOrigBits);
-
- // in original code it compares OrigPtr to (UInt32)(10 + blockSizeMax)) : why ?
- if (*origPtrRes >= blockSizeMax)
- return S_FALSE;
-
- CMtf8Decoder mtf;
- mtf.StartInit();
-
- int numInUse = 0;
- {
- Byte inUse16[16];
- int i;
- for (i = 0; i < 16; i++)
- inUse16[i] = (Byte)ReadBit(m_InStream);
- for (i = 0; i < 256; i++)
- if (inUse16[i >> 4])
- {
- if (ReadBit(m_InStream))
- mtf.Add(numInUse++, (Byte)i);
- }
- if (numInUse == 0)
- return S_FALSE;
- // mtf.Init(numInUse);
- }
- int alphaSize = numInUse + 2;
-
- int numTables = ReadBits(m_InStream, kNumTablesBits);
- if (numTables < kNumTablesMin || numTables > kNumTablesMax)
- return S_FALSE;
-
- UInt32 numSelectors = ReadBits(m_InStream, kNumSelectorsBits);
- if (numSelectors < 1 || numSelectors > kNumSelectorsMax)
- return S_FALSE;
-
- {
- Byte mtfPos[kNumTablesMax];
- int t = 0;
- do
- mtfPos[t] = (Byte)t;
- while(++t < numTables);
- UInt32 i = 0;
- do
- {
- int j = 0;
- while (ReadBit(m_InStream))
- if (++j >= numTables)
- return S_FALSE;
- Byte tmp = mtfPos[j];
- for (;j > 0; j--)
- mtfPos[j] = mtfPos[j - 1];
- m_Selectors[i] = mtfPos[0] = tmp;
- }
- while(++i < numSelectors);
- }
-
- int t = 0;
- do
- {
- Byte lens[kMaxAlphaSize];
- int len = (int)ReadBits(m_InStream, kNumLevelsBits);
- int i;
- for (i = 0; i < alphaSize; i++)
- {
- for (;;)
- {
- if (len < 1 || len > kMaxHuffmanLen)
- return S_FALSE;
- if (!ReadBit(m_InStream))
- break;
- len += 1 - (int)(ReadBit(m_InStream) << 1);
- }
- lens[i] = (Byte)len;
- }
- for (; i < kMaxAlphaSize; i++)
- lens[i] = 0;
- if(!m_HuffmanDecoders[t].SetCodeLengths(lens))
- return S_FALSE;
- }
- while(++t < numTables);
-
- {
- for (int i = 0; i < 256; i++)
- CharCounters[i] = 0;
- }
-
- UInt32 blockSize = 0;
- {
- UInt32 groupIndex = 0;
- UInt32 groupSize = 0;
- CHuffmanDecoder *huffmanDecoder = 0;
- int runPower = 0;
- UInt32 runCounter = 0;
-
- for (;;)
- {
- if (groupSize == 0)
- {
- if (groupIndex >= numSelectors)
- return S_FALSE;
- groupSize = kGroupSize;
- huffmanDecoder = &m_HuffmanDecoders[m_Selectors[groupIndex++]];
- }
- groupSize--;
-
- UInt32 nextSym = huffmanDecoder->DecodeSymbol(m_InStream);
-
- if (nextSym < 2)
- {
- runCounter += ((UInt32)(nextSym + 1) << runPower++);
- if (blockSizeMax - blockSize < runCounter)
- return S_FALSE;
- continue;
- }
- if (runCounter != 0)
- {
- UInt32 b = (UInt32)mtf.GetHead();
- CharCounters[b] += runCounter;
- do
- CharCounters[256 + blockSize++] = b;
- while(--runCounter != 0);
- runPower = 0;
- }
- if (nextSym <= (UInt32)numInUse)
- {
- UInt32 b = (UInt32)mtf.GetAndMove((int)nextSym - 1);
- if (blockSize >= blockSizeMax)
- return S_FALSE;
- CharCounters[b]++;
- CharCounters[256 + blockSize++] = b;
- }
- else if (nextSym == (UInt32)numInUse + 1)
- break;
- else
- return S_FALSE;
- }
- }
- *blockSizeRes = blockSize;
- return (*origPtrRes < blockSize) ? S_OK : S_FALSE;
-}
-
-void NO_INLINE DecodeBlock1(UInt32 *charCounters, UInt32 blockSize)
-{
- {
- UInt32 sum = 0;
- for (UInt32 i = 0; i < 256; i++)
- {
- sum += charCounters[i];
- charCounters[i] = sum - charCounters[i];
- }
- }
-
- UInt32 *tt = charCounters + 256;
- // Compute the T^(-1) vector
- UInt32 i = 0;
- do
- tt[charCounters[tt[i] & 0xFF]++] |= (i << 8);
- while(++i < blockSize);
-}
-
-static UInt32 NO_INLINE DecodeBlock2(const UInt32 *tt, UInt32 blockSize, UInt32 OrigPtr, COutBuffer &m_OutStream)
-{
- CBZip2Crc crc;
-
- // it's for speed optimization: prefetch & prevByte_init;
- UInt32 tPos = tt[tt[OrigPtr] >> 8];
- unsigned int prevByte = (unsigned int)(tPos & 0xFF);
-
- int numReps = 0;
-
- do
- {
- unsigned int b = (unsigned int)(tPos & 0xFF);
- tPos = tt[tPos >> 8];
-
- if (numReps == kRleModeRepSize)
- {
- for (; b > 0; b--)
- {
- crc.UpdateByte(prevByte);
- m_OutStream.WriteByte((Byte)prevByte);
- }
- numReps = 0;
- continue;
- }
- if (b != prevByte)
- numReps = 0;
- numReps++;
- prevByte = b;
- crc.UpdateByte(b);
- m_OutStream.WriteByte((Byte)b);
-
- /*
- prevByte = b;
- crc.UpdateByte(b);
- m_OutStream.WriteByte((Byte)b);
- for (; --blockSize != 0;)
- {
- b = (unsigned int)(tPos & 0xFF);
- tPos = tt[tPos >> 8];
- crc.UpdateByte(b);
- m_OutStream.WriteByte((Byte)b);
- if (b != prevByte)
- {
- prevByte = b;
- continue;
- }
- if (--blockSize == 0)
- break;
-
- b = (unsigned int)(tPos & 0xFF);
- tPos = tt[tPos >> 8];
- crc.UpdateByte(b);
- m_OutStream.WriteByte((Byte)b);
- if (b != prevByte)
- {
- prevByte = b;
- continue;
- }
- if (--blockSize == 0)
- break;
-
- b = (unsigned int)(tPos & 0xFF);
- tPos = tt[tPos >> 8];
- crc.UpdateByte(b);
- m_OutStream.WriteByte((Byte)b);
- if (b != prevByte)
- {
- prevByte = b;
- continue;
- }
- --blockSize;
- break;
- }
- if (blockSize == 0)
- break;
-
- b = (unsigned int)(tPos & 0xFF);
- tPos = tt[tPos >> 8];
-
- for (; b > 0; b--)
- {
- crc.UpdateByte(prevByte);
- m_OutStream.WriteByte((Byte)prevByte);
- }
- */
- }
- while(--blockSize != 0);
- return crc.GetDigest();
-}
-
-static UInt32 NO_INLINE DecodeBlock2Rand(const UInt32 *tt, UInt32 blockSize, UInt32 OrigPtr, COutBuffer &m_OutStream)
-{
- CBZip2Crc crc;
-
- UInt32 randIndex = 1;
- UInt32 randToGo = kRandNums[0] - 2;
-
- int numReps = 0;
-
- // it's for speed optimization: prefetch & prevByte_init;
- UInt32 tPos = tt[tt[OrigPtr] >> 8];
- unsigned int prevByte = (unsigned int)(tPos & 0xFF);
-
- do
- {
- unsigned int b = (unsigned int)(tPos & 0xFF);
- tPos = tt[tPos >> 8];
-
- {
- if (randToGo == 0)
- {
- b ^= 1;
- randToGo = kRandNums[randIndex++];
- randIndex &= 0x1FF;
- }
- randToGo--;
- }
-
- if (numReps == kRleModeRepSize)
- {
- for (; b > 0; b--)
- {
- crc.UpdateByte(prevByte);
- m_OutStream.WriteByte((Byte)prevByte);
- }
- numReps = 0;
- continue;
- }
- if (b != prevByte)
- numReps = 0;
- numReps++;
- prevByte = b;
- crc.UpdateByte(b);
- m_OutStream.WriteByte((Byte)b);
- }
- while(--blockSize != 0);
- return crc.GetDigest();
-}
-
-
-CDecoder::CDecoder()
-{
- #ifdef COMPRESS_BZIP2_MT
- m_States = 0;
- m_NumThreadsPrev = 0;
- NumThreads = 1;
- #endif;
- _needInStreamInit = true;
-}
-
-#ifdef COMPRESS_BZIP2_MT
-
-CDecoder::~CDecoder()
-{
- Free();
-}
-
-#define RINOK_THREAD(x) { WRes __result_ = (x); if(__result_ != 0) return __result_; }
-
-HRESULT CDecoder::Create()
-{
- RINOK_THREAD(CanProcessEvent.CreateIfNotCreated());
- RINOK_THREAD(CanStartWaitingEvent.CreateIfNotCreated());
- if (m_States != 0 && m_NumThreadsPrev == NumThreads)
- return S_OK;
- Free();
- MtMode = (NumThreads > 1);
- m_NumThreadsPrev = NumThreads;
- try
- {
- m_States = new CState[NumThreads];
- if (m_States == 0)
- return E_OUTOFMEMORY;
- }
- catch(...) { return E_OUTOFMEMORY; }
- for (UInt32 t = 0; t < NumThreads; t++)
- {
- CState &ti = m_States[t];
- ti.Decoder = this;
- if (MtMode)
- {
- HRESULT res = ti.Create();
- if (res != S_OK)
- {
- NumThreads = t;
- Free();
- return res;
- }
- }
- }
- return S_OK;
-}
-
-void CDecoder::Free()
-{
- if (!m_States)
- return;
- CloseThreads = true;
- CanProcessEvent.Set();
- for (UInt32 t = 0; t < NumThreads; t++)
- {
- CState &s = m_States[t];
- if (MtMode)
- s.Thread.Wait();
- s.Free();
- }
- delete []m_States;
- m_States = 0;
-}
-#endif
-
-HRESULT CDecoder::ReadSignatures(bool &wasFinished, UInt32 &crc)
-{
- wasFinished = false;
- Byte s[6];
- for (int i = 0; i < 6; i++)
- s[i] = ReadByte();
- crc = ReadCrc();
- if (s[0] == kFinSig0)
- {
- if (s[1] != kFinSig1 ||
- s[2] != kFinSig2 ||
- s[3] != kFinSig3 ||
- s[4] != kFinSig4 ||
- s[5] != kFinSig5)
- return S_FALSE;
-
- wasFinished = true;
- return (crc == CombinedCrc.GetDigest()) ? S_OK : S_FALSE;
- }
- if (s[0] != kBlockSig0 ||
- s[1] != kBlockSig1 ||
- s[2] != kBlockSig2 ||
- s[3] != kBlockSig3 ||
- s[4] != kBlockSig4 ||
- s[5] != kBlockSig5)
- return S_FALSE;
- CombinedCrc.Update(crc);
- return S_OK;
-}
-
-HRESULT CDecoder::DecodeFile(bool &isBZ, ICompressProgressInfo *progress)
-{
- #ifdef COMPRESS_BZIP2_MT
- Progress = progress;
- RINOK(Create());
- for (UInt32 t = 0; t < NumThreads; t++)
- {
- CState &s = m_States[t];
- if (!s.Alloc())
- return E_OUTOFMEMORY;
- if (MtMode)
- {
- RINOK(s.StreamWasFinishedEvent.Reset());
- RINOK(s.WaitingWasStartedEvent.Reset());
- RINOK(s.CanWriteEvent.Reset());
- }
- }
- #else
- if (!m_States[0].Alloc())
- return E_OUTOFMEMORY;
- #endif
-
- isBZ = false;
- Byte s[6];
- int i;
- for (i = 0; i < 4; i++)
- s[i] = ReadByte();
- if (s[0] != kArSig0 ||
- s[1] != kArSig1 ||
- s[2] != kArSig2 ||
- s[3] <= kArSig3 ||
- s[3] > kArSig3 + kBlockSizeMultMax)
- return S_OK;
- isBZ = true;
- UInt32 dicSize = (UInt32)(s[3] - kArSig3) * kBlockSizeStep;
-
- CombinedCrc.Init();
- #ifdef COMPRESS_BZIP2_MT
- if (MtMode)
- {
- NextBlockIndex = 0;
- StreamWasFinished1 = StreamWasFinished2 = false;
- CloseThreads = false;
- CanStartWaitingEvent.Reset();
- m_States[0].CanWriteEvent.Set();
- BlockSizeMax = dicSize;
- Result1 = Result2 = S_OK;
- CanProcessEvent.Set();
- UInt32 t;
- for (t = 0; t < NumThreads; t++)
- m_States[t].StreamWasFinishedEvent.Lock();
- CanProcessEvent.Reset();
- CanStartWaitingEvent.Set();
- for (t = 0; t < NumThreads; t++)
- m_States[t].WaitingWasStartedEvent.Lock();
- CanStartWaitingEvent.Reset();
- RINOK(Result2);
- RINOK(Result1);
- }
- else
- #endif
- {
- CState &state = m_States[0];
- for (;;)
- {
- if (progress)
- {
- UInt64 packSize = m_InStream.GetProcessedSize();
- UInt64 unpackSize = m_OutStream.GetProcessedSize();
- RINOK(progress->SetRatioInfo(&packSize, &unpackSize));
- }
- bool wasFinished;
- UInt32 crc;
- RINOK(ReadSignatures(wasFinished, crc));
- if (wasFinished)
- return S_OK;
-
- UInt32 blockSize, origPtr;
- bool randMode;
- RINOK(ReadBlock(&m_InStream, state.Counters, dicSize,
- m_Selectors, m_HuffmanDecoders,
- &blockSize, &origPtr, &randMode));
- DecodeBlock1(state.Counters, blockSize);
- if ((randMode ?
- DecodeBlock2Rand(state.Counters + 256, blockSize, origPtr, m_OutStream) :
- DecodeBlock2(state.Counters + 256, blockSize, origPtr, m_OutStream)) != crc)
- return S_FALSE;
- }
- }
- return S_OK;
-}
-
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- bool &isBZ, ICompressProgressInfo *progress)
-{
- isBZ = false;
- try
- {
-
- if (!m_InStream.Create(kBufferSize))
- return E_OUTOFMEMORY;
- if (!m_OutStream.Create(kBufferSize))
- return E_OUTOFMEMORY;
-
- if (inStream)
- m_InStream.SetStream(inStream);
-
- CDecoderFlusher flusher(this, inStream != NULL);
-
- if (_needInStreamInit)
- {
- m_InStream.Init();
- _needInStreamInit = false;
- }
- _inStart = m_InStream.GetProcessedSize();
-
- m_InStream.AlignToByte();
-
- m_OutStream.SetStream(outStream);
- m_OutStream.Init();
-
- RINOK(DecodeFile(isBZ, progress));
- flusher.NeedFlush = false;
- return Flush();
-
- }
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(const COutBufferException &e) { return e.ErrorCode; }
- catch(...) { return E_FAIL; }
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
-{
- _needInStreamInit = true;
- bool isBZ;
- RINOK(CodeReal(inStream, outStream, isBZ, progress));
- return isBZ ? S_OK : S_FALSE;
-}
-
-HRESULT CDecoder::CodeResume(ISequentialOutStream *outStream, bool &isBZ, ICompressProgressInfo *progress)
-{
- return CodeReal(NULL, outStream, isBZ, progress);
-}
-
-STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream) { m_InStream.SetStream(inStream); return S_OK; }
-STDMETHODIMP CDecoder::ReleaseInStream() { m_InStream.ReleaseStream(); return S_OK; }
-
-#ifdef COMPRESS_BZIP2_MT
-
-static THREAD_FUNC_DECL MFThread(void *p) { ((CState *)p)->ThreadFunc(); return 0; }
-
-HRESULT CState::Create()
-{
- RINOK_THREAD(StreamWasFinishedEvent.CreateIfNotCreated());
- RINOK_THREAD(WaitingWasStartedEvent.CreateIfNotCreated());
- RINOK_THREAD(CanWriteEvent.CreateIfNotCreated());
- RINOK_THREAD(Thread.Create(MFThread, this));
- return S_OK;
-}
-
-void CState::FinishStream()
-{
- Decoder->StreamWasFinished1 = true;
- StreamWasFinishedEvent.Set();
- Decoder->CS.Leave();
- Decoder->CanStartWaitingEvent.Lock();
- WaitingWasStartedEvent.Set();
-}
-
-void CState::ThreadFunc()
-{
- for (;;)
- {
- Decoder->CanProcessEvent.Lock();
- Decoder->CS.Enter();
- if (Decoder->CloseThreads)
- {
- Decoder->CS.Leave();
- return;
- }
- if (Decoder->StreamWasFinished1)
- {
- FinishStream();
- continue;
- }
- HRESULT res = S_OK;
-
- UInt32 blockIndex = Decoder->NextBlockIndex;
- UInt32 nextBlockIndex = blockIndex + 1;
- if (nextBlockIndex == Decoder->NumThreads)
- nextBlockIndex = 0;
- Decoder->NextBlockIndex = nextBlockIndex;
- UInt32 crc;
- UInt64 packSize = 0;
- UInt32 blockSize = 0, origPtr = 0;
- bool randMode = false;
-
- try
- {
- bool wasFinished;
- res = Decoder->ReadSignatures(wasFinished, crc);
- if (res != S_OK)
- {
- Decoder->Result1 = res;
- FinishStream();
- continue;
- }
- if (wasFinished)
- {
- Decoder->Result1 = res;
- FinishStream();
- continue;
- }
-
- res = ReadBlock(&Decoder->m_InStream, Counters, Decoder->BlockSizeMax,
- Decoder->m_Selectors, Decoder->m_HuffmanDecoders,
- &blockSize, &origPtr, &randMode);
- if (res != S_OK)
- {
- Decoder->Result1 = res;
- FinishStream();
- continue;
- }
- packSize = Decoder->m_InStream.GetProcessedSize();
- }
- catch(const CInBufferException &e) { res = e.ErrorCode; if (res != S_OK) res = E_FAIL; }
- catch(...) { res = E_FAIL; }
- if (res != S_OK)
- {
- Decoder->Result1 = res;
- FinishStream();
- continue;
- }
-
- Decoder->CS.Leave();
-
- DecodeBlock1(Counters, blockSize);
-
- bool needFinish = true;
- try
- {
- Decoder->m_States[blockIndex].CanWriteEvent.Lock();
- needFinish = Decoder->StreamWasFinished2;
- if (!needFinish)
- {
- if ((randMode ?
- DecodeBlock2Rand(Counters + 256, blockSize, origPtr, Decoder->m_OutStream) :
- DecodeBlock2(Counters + 256, blockSize, origPtr, Decoder->m_OutStream)) == crc)
- {
- if (Decoder->Progress)
- {
- UInt64 inSize = packSize - Decoder->_inStart;
- UInt64 unpackSize = Decoder->m_OutStream.GetProcessedSize();
- res = Decoder->Progress->SetRatioInfo(&inSize, &unpackSize);
- }
- }
- else
- res = S_FALSE;
- }
- }
- catch(const COutBufferException &e) { res = e.ErrorCode; if (res != S_OK) res = E_FAIL; }
- catch(...) { res = E_FAIL; }
- if (res != S_OK)
- {
- Decoder->Result2 = res;
- Decoder->StreamWasFinished2 = true;
- }
- Decoder->m_States[nextBlockIndex].CanWriteEvent.Set();
- if (res != S_OK || needFinish)
- {
- StreamWasFinishedEvent.Set();
- Decoder->CanStartWaitingEvent.Lock();
- WaitingWasStartedEvent.Set();
- }
- }
-}
-
-STDMETHODIMP CDecoder::SetNumberOfThreads(UInt32 numThreads)
-{
- NumThreads = numThreads;
- if (NumThreads < 1)
- NumThreads = 1;
- if (NumThreads > kNumThreadsMax)
- NumThreads = kNumThreadsMax;
- return S_OK;
-}
-#endif
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Decoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Decoder.h
deleted file mode 100644
index ca267a1d8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Decoder.h
+++ /dev/null
@@ -1,173 +0,0 @@
-// Compress/BZip2Decoder.h
-
-#ifndef __COMPRESS_BZIP2_DECODER_H
-#define __COMPRESS_BZIP2_DECODER_H
-
-#include "../../Common/MyCom.h"
-
-#ifdef COMPRESS_BZIP2_MT
-#include "../../Windows/Synchronization.h"
-#include "../../Windows/Thread.h"
-#endif
-
-#include "../ICoder.h"
-
-#include "../Common/InBuffer.h"
-#include "../Common/OutBuffer.h"
-
-#include "BitmDecoder.h"
-#include "BZip2Const.h"
-#include "BZip2Crc.h"
-#include "HuffmanDecoder.h"
-
-namespace NCompress {
-namespace NBZip2 {
-
-typedef NCompress::NHuffman::CDecoder<kMaxHuffmanLen, kMaxAlphaSize> CHuffmanDecoder;
-
-class CDecoder;
-
-struct CState
-{
- UInt32 *Counters;
-
- #ifdef COMPRESS_BZIP2_MT
-
- CDecoder *Decoder;
- NWindows::CThread Thread;
- bool m_OptimizeNumTables;
-
- NWindows::NSynchronization::CAutoResetEvent StreamWasFinishedEvent;
- NWindows::NSynchronization::CAutoResetEvent WaitingWasStartedEvent;
-
- // it's not member of this thread. We just need one event per thread
- NWindows::NSynchronization::CAutoResetEvent CanWriteEvent;
-
- Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size.
-
- HRESULT Create();
- void FinishStream();
- void ThreadFunc();
-
- #endif
-
- CState(): Counters(0) {}
- ~CState() { Free(); }
- bool Alloc();
- void Free();
-};
-
-class CDecoder :
- public ICompressCoder,
- #ifdef COMPRESS_BZIP2_MT
- public ICompressSetCoderMt,
- #endif
- public CMyUnknownImp
-{
-public:
- COutBuffer m_OutStream;
- Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size.
- NBitm::CDecoder<CInBuffer> m_InStream;
- Byte m_Selectors[kNumSelectorsMax];
- CHuffmanDecoder m_HuffmanDecoders[kNumTablesMax];
- UInt64 _inStart;
-
-private:
-
- bool _needInStreamInit;
-
- UInt32 ReadBits(int numBits);
- Byte ReadByte();
- bool ReadBit();
- UInt32 ReadCrc();
- HRESULT PrepareBlock(CState &state);
- HRESULT DecodeFile(bool &isBZ, ICompressProgressInfo *progress);
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- bool &isBZ, ICompressProgressInfo *progress);
- class CDecoderFlusher
- {
- CDecoder *_decoder;
- public:
- bool NeedFlush;
- bool ReleaseInStream;
- CDecoderFlusher(CDecoder *decoder, bool releaseInStream):
- _decoder(decoder),
- NeedFlush( true ),
- ReleaseInStream(releaseInStream){}
- ~CDecoderFlusher()
- {
- if (NeedFlush)
- _decoder->Flush();
- _decoder->ReleaseStreams(ReleaseInStream);
- }
- };
-
-public:
- CBZip2CombinedCrc CombinedCrc;
-
- #ifdef COMPRESS_BZIP2_MT
- ICompressProgressInfo *Progress;
- CState *m_States;
- UInt32 m_NumThreadsPrev;
-
- NWindows::NSynchronization::CManualResetEvent CanProcessEvent;
- NWindows::NSynchronization::CCriticalSection CS;
- UInt32 NumThreads;
- bool MtMode;
- UInt32 NextBlockIndex;
- bool CloseThreads;
- bool StreamWasFinished1;
- bool StreamWasFinished2;
- NWindows::NSynchronization::CManualResetEvent CanStartWaitingEvent;
-
- HRESULT Result1;
- HRESULT Result2;
-
- UInt32 BlockSizeMax;
- ~CDecoder();
- HRESULT Create();
- void Free();
-
- #else
- CState m_States[1];
- #endif
-
- CDecoder();
-
- HRESULT ReadSignatures(bool &wasFinished, UInt32 &crc);
-
-
- HRESULT Flush() { return m_OutStream.Flush(); }
- void ReleaseStreams(bool releaseInStream)
- {
- if (releaseInStream)
- m_InStream.ReleaseStream();
- m_OutStream.ReleaseStream();
- }
-
- MY_QUERYINTERFACE_BEGIN
- #ifdef COMPRESS_BZIP2_MT
- MY_QUERYINTERFACE_ENTRY(ICompressSetCoderMt)
- #endif
-
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(SetInStream)(ISequentialInStream *inStream);
- STDMETHOD(ReleaseInStream)();
-
- HRESULT CodeResume(ISequentialOutStream *outStream, bool &isBZ, ICompressProgressInfo *progress);
- UInt64 GetInputProcessedSize() const { return m_InStream.GetProcessedSize(); }
-
- #ifdef COMPRESS_BZIP2_MT
- STDMETHOD(SetNumberOfThreads)(UInt32 numThreads);
- #endif
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Encoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Encoder.cpp
deleted file mode 100644
index 5fd78b955..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Encoder.cpp
+++ /dev/null
@@ -1,895 +0,0 @@
-// BZip2Encoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-#include "../../../C/BwtSort.h"
-#include "../../../C/HuffEnc.h"
-
-#include "BZip2Crc.h"
-#include "BZip2Encoder.h"
-#include "Mtf8.h"
-
-namespace NCompress {
-namespace NBZip2 {
-
-const int kMaxHuffmanLenForEncoding = 16; // it must be < kMaxHuffmanLen = 20
-
-static const UInt32 kBufferSize = (1 << 17);
-static const int kNumHuffPasses = 4;
-
-bool CThreadInfo::Alloc()
-{
- if (m_BlockSorterIndex == 0)
- {
- m_BlockSorterIndex = (UInt32 *)::BigAlloc(BLOCK_SORT_BUF_SIZE(kBlockSizeMax) * sizeof(UInt32));
- if (m_BlockSorterIndex == 0)
- return false;
- }
-
- if (m_Block == 0)
- {
- m_Block = (Byte *)::MidAlloc(kBlockSizeMax * 5 + kBlockSizeMax / 10 + (20 << 10));
- if (m_Block == 0)
- return false;
- m_MtfArray = m_Block + kBlockSizeMax;
- m_TempArray = m_MtfArray + kBlockSizeMax * 2 + 2;
- }
- return true;
-}
-
-void CThreadInfo::Free()
-{
- ::BigFree(m_BlockSorterIndex);
- m_BlockSorterIndex = 0;
- ::MidFree(m_Block);
- m_Block = 0;
-}
-
-#ifdef COMPRESS_BZIP2_MT
-
-static THREAD_FUNC_DECL MFThread(void *threadCoderInfo)
-{
- return ((CThreadInfo *)threadCoderInfo)->ThreadFunc();
-}
-
-#define RINOK_THREAD(x) { WRes __result_ = (x); if(__result_ != 0) return __result_; }
-
-HRESULT CThreadInfo::Create()
-{
- RINOK_THREAD(StreamWasFinishedEvent.Create());
- RINOK_THREAD(WaitingWasStartedEvent.Create());
- RINOK_THREAD(CanWriteEvent.Create());
- RINOK_THREAD(Thread.Create(MFThread, this));
- return S_OK;
-}
-
-void CThreadInfo::FinishStream(bool needLeave)
-{
- Encoder->StreamWasFinished = true;
- StreamWasFinishedEvent.Set();
- if (needLeave)
- Encoder->CS.Leave();
- Encoder->CanStartWaitingEvent.Lock();
- WaitingWasStartedEvent.Set();
-}
-
-DWORD CThreadInfo::ThreadFunc()
-{
- for (;;)
- {
- Encoder->CanProcessEvent.Lock();
- Encoder->CS.Enter();
- if (Encoder->CloseThreads)
- {
- Encoder->CS.Leave();
- return 0;
- }
- if (Encoder->StreamWasFinished)
- {
- FinishStream(true);
- continue;
- }
- HRESULT res = S_OK;
- bool needLeave = true;
- try
- {
- UInt32 blockSize = Encoder->ReadRleBlock(m_Block);
- m_PackSize = Encoder->m_InStream.GetProcessedSize();
- m_BlockIndex = Encoder->NextBlockIndex;
- if (++Encoder->NextBlockIndex == Encoder->NumThreads)
- Encoder->NextBlockIndex = 0;
- if (blockSize == 0)
- {
- FinishStream(true);
- continue;
- }
- Encoder->CS.Leave();
- needLeave = false;
- res = EncodeBlock3(blockSize);
- }
- catch(const CInBufferException &e) { res = e.ErrorCode; }
- catch(const COutBufferException &e) { res = e.ErrorCode; }
- catch(...) { res = E_FAIL; }
- if (res != S_OK)
- {
- Encoder->Result = res;
- FinishStream(needLeave);
- continue;
- }
- }
-}
-
-#endif
-
-CEncoder::CEncoder():
- m_BlockSizeMult(kBlockSizeMultMax),
- m_OptimizeNumTables(false),
- NumPasses(1)
-{
- #ifdef COMPRESS_BZIP2_MT
- ThreadsInfo = 0;
- m_NumThreadsPrev = 0;
- NumThreads = 1;
- #endif
-}
-
-#ifdef COMPRESS_BZIP2_MT
-CEncoder::~CEncoder()
-{
- Free();
-}
-
-HRESULT CEncoder::Create()
-{
- RINOK_THREAD(CanProcessEvent.CreateIfNotCreated());
- RINOK_THREAD(CanStartWaitingEvent.CreateIfNotCreated());
- if (ThreadsInfo != 0 && m_NumThreadsPrev == NumThreads)
- return S_OK;
- try
- {
- Free();
- MtMode = (NumThreads > 1);
- m_NumThreadsPrev = NumThreads;
- ThreadsInfo = new CThreadInfo[NumThreads];
- if (ThreadsInfo == 0)
- return E_OUTOFMEMORY;
- }
- catch(...) { return E_OUTOFMEMORY; }
- for (UInt32 t = 0; t < NumThreads; t++)
- {
- CThreadInfo &ti = ThreadsInfo[t];
- ti.Encoder = this;
- if (MtMode)
- {
- HRESULT res = ti.Create();
- if (res != S_OK)
- {
- NumThreads = t;
- Free();
- return res;
- }
- }
- }
- return S_OK;
-}
-
-void CEncoder::Free()
-{
- if (!ThreadsInfo)
- return;
- CloseThreads = true;
- CanProcessEvent.Set();
- for (UInt32 t = 0; t < NumThreads; t++)
- {
- CThreadInfo &ti = ThreadsInfo[t];
- if (MtMode)
- ti.Thread.Wait();
- ti.Free();
- }
- delete []ThreadsInfo;
- ThreadsInfo = 0;
-}
-#endif
-
-UInt32 CEncoder::ReadRleBlock(Byte *buffer)
-{
- UInt32 i = 0;
- Byte prevByte;
- if (m_InStream.ReadByte(prevByte))
- {
- UInt32 blockSize = m_BlockSizeMult * kBlockSizeStep - 1;
- int numReps = 1;
- buffer[i++] = prevByte;
- while (i < blockSize) // "- 1" to support RLE
- {
- Byte b;
- if (!m_InStream.ReadByte(b))
- break;
- if (b != prevByte)
- {
- if (numReps >= kRleModeRepSize)
- buffer[i++] = (Byte)(numReps - kRleModeRepSize);
- buffer[i++] = b;
- numReps = 1;
- prevByte = b;
- continue;
- }
- numReps++;
- if (numReps <= kRleModeRepSize)
- buffer[i++] = b;
- else if (numReps == kRleModeRepSize + 255)
- {
- buffer[i++] = (Byte)(numReps - kRleModeRepSize);
- numReps = 0;
- }
- }
- // it's to support original BZip2 decoder
- if (numReps >= kRleModeRepSize)
- buffer[i++] = (Byte)(numReps - kRleModeRepSize);
- }
- return i;
-}
-
-void CThreadInfo::WriteBits2(UInt32 value, UInt32 numBits)
- { m_OutStreamCurrent->WriteBits(value, numBits); }
-void CThreadInfo::WriteByte2(Byte b) { WriteBits2(b , 8); }
-void CThreadInfo::WriteBit2(bool v) { WriteBits2((v ? 1 : 0), 1); }
-void CThreadInfo::WriteCrc2(UInt32 v)
-{
- for (int i = 0; i < 4; i++)
- WriteByte2(((Byte)(v >> (24 - i * 8))));
-}
-
-void CEncoder::WriteBits(UInt32 value, UInt32 numBits)
- { m_OutStream.WriteBits(value, numBits); }
-void CEncoder::WriteByte(Byte b) { WriteBits(b , 8); }
-void CEncoder::WriteBit(bool v) { WriteBits((v ? 1 : 0), 1); }
-void CEncoder::WriteCrc(UInt32 v)
-{
- for (int i = 0; i < 4; i++)
- WriteByte(((Byte)(v >> (24 - i * 8))));
-}
-
-
-// blockSize > 0
-void CThreadInfo::EncodeBlock(const Byte *block, UInt32 blockSize)
-{
- WriteBit2(false); // Randomised = false
-
- {
- UInt32 origPtr = BlockSort(m_BlockSorterIndex, block, blockSize);
- // if (m_BlockSorterIndex[origPtr] != 0) throw 1;
- m_BlockSorterIndex[origPtr] = blockSize;
- WriteBits2(origPtr, kNumOrigBits);
- }
-
- CMtf8Encoder mtf;
- int numInUse = 0;
- {
- bool inUse[256];
- bool inUse16[16];
- UInt32 i;
- for (i = 0; i < 256; i++)
- inUse[i] = false;
- for (i = 0; i < 16; i++)
- inUse16[i] = false;
- for (i = 0; i < blockSize; i++)
- inUse[block[i]] = true;
- for (i = 0; i < 256; i++)
- if (inUse[i])
- {
- inUse16[i >> 4] = true;
- mtf.Buf[numInUse++] = (Byte)i;
- }
- for (i = 0; i < 16; i++)
- WriteBit2(inUse16[i]);
- for (i = 0; i < 256; i++)
- if (inUse16[i >> 4])
- WriteBit2(inUse[i]);
- }
- int alphaSize = numInUse + 2;
-
- Byte *mtfs = m_MtfArray;
- UInt32 mtfArraySize = 0;
- UInt32 symbolCounts[kMaxAlphaSize];
- {
- for (int i = 0; i < kMaxAlphaSize; i++)
- symbolCounts[i] = 0;
- }
-
- {
- UInt32 rleSize = 0;
- UInt32 i = 0;
- const UInt32 *bsIndex = m_BlockSorterIndex;
- block--;
- do
- {
- int pos = mtf.FindAndMove(block[bsIndex[i]]);
- if (pos == 0)
- rleSize++;
- else
- {
- while (rleSize != 0)
- {
- rleSize--;
- mtfs[mtfArraySize++] = (Byte)(rleSize & 1);
- symbolCounts[rleSize & 1]++;
- rleSize >>= 1;
- }
- if (pos >= 0xFE)
- {
- mtfs[mtfArraySize++] = 0xFF;
- mtfs[mtfArraySize++] = (Byte)(pos - 0xFE);
- }
- else
- mtfs[mtfArraySize++] = (Byte)(pos + 1);
- symbolCounts[pos + 1]++;
- }
- }
- while (++i < blockSize);
-
- while (rleSize != 0)
- {
- rleSize--;
- mtfs[mtfArraySize++] = (Byte)(rleSize & 1);
- symbolCounts[rleSize & 1]++;
- rleSize >>= 1;
- }
-
- if (alphaSize < 256)
- mtfs[mtfArraySize++] = (Byte)(alphaSize - 1);
- else
- {
- mtfs[mtfArraySize++] = 0xFF;
- mtfs[mtfArraySize++] = (Byte)(alphaSize - 256);
- }
- symbolCounts[alphaSize - 1]++;
- }
-
- UInt32 numSymbols = 0;
- {
- for (int i = 0; i < kMaxAlphaSize; i++)
- numSymbols += symbolCounts[i];
- }
-
- int bestNumTables = kNumTablesMin;
- UInt32 bestPrice = 0xFFFFFFFF;
- UInt32 startPos = m_OutStreamCurrent->GetPos();
- Byte startCurByte = m_OutStreamCurrent->GetCurByte();
- for (int nt = kNumTablesMin; nt <= kNumTablesMax + 1; nt++)
- {
- int numTables;
-
- if(m_OptimizeNumTables)
- {
- m_OutStreamCurrent->SetPos(startPos);
- m_OutStreamCurrent->SetCurState((startPos & 7), startCurByte);
- if (nt <= kNumTablesMax)
- numTables = nt;
- else
- numTables = bestNumTables;
- }
- else
- {
- if (numSymbols < 200) numTables = 2;
- else if (numSymbols < 600) numTables = 3;
- else if (numSymbols < 1200) numTables = 4;
- else if (numSymbols < 2400) numTables = 5;
- else numTables = 6;
- }
-
- WriteBits2(numTables, kNumTablesBits);
-
- UInt32 numSelectors = (numSymbols + kGroupSize - 1) / kGroupSize;
- WriteBits2(numSelectors, kNumSelectorsBits);
-
- {
- UInt32 remFreq = numSymbols;
- int gs = 0;
- int t = numTables;
- do
- {
- UInt32 tFreq = remFreq / t;
- int ge = gs;
- UInt32 aFreq = 0;
- while (aFreq < tFreq) // && ge < alphaSize)
- aFreq += symbolCounts[ge++];
-
- if (ge - 1 > gs && t != numTables && t != 1 && (((numTables - t) & 1) == 1))
- aFreq -= symbolCounts[--ge];
-
- Byte *lens = Lens[t - 1];
- int i = 0;
- do
- lens[i] = (i >= gs && i < ge) ? 0 : 1;
- while (++i < alphaSize);
- gs = ge;
- remFreq -= aFreq;
- }
- while(--t != 0);
- }
-
-
- for (int pass = 0; pass < kNumHuffPasses; pass++)
- {
- {
- int t = 0;
- do
- memset(Freqs[t], 0, sizeof(Freqs[t]));
- while(++t < numTables);
- }
-
- {
- UInt32 mtfPos = 0;
- UInt32 g = 0;
- do
- {
- UInt32 symbols[kGroupSize];
- int i = 0;
- do
- {
- UInt32 symbol = mtfs[mtfPos++];
- if (symbol >= 0xFF)
- symbol += mtfs[mtfPos++];
- symbols[i] = symbol;
- }
- while (++i < kGroupSize && mtfPos < mtfArraySize);
-
- UInt32 bestPrice = 0xFFFFFFFF;
- int t = 0;
- do
- {
- const Byte *lens = Lens[t];
- UInt32 price = 0;
- int j = 0;
- do
- price += lens[symbols[j]];
- while (++j < i);
- if (price < bestPrice)
- {
- m_Selectors[g] = (Byte)t;
- bestPrice = price;
- }
- }
- while(++t < numTables);
- UInt32 *freqs = Freqs[m_Selectors[g++]];
- int j = 0;
- do
- freqs[symbols[j]]++;
- while (++j < i);
- }
- while (mtfPos < mtfArraySize);
- }
-
- int t = 0;
- do
- {
- UInt32 *freqs = Freqs[t];
- int i = 0;
- do
- if (freqs[i] == 0)
- freqs[i] = 1;
- while(++i < alphaSize);
- Huffman_Generate(freqs, Codes[t], Lens[t], kMaxAlphaSize, kMaxHuffmanLenForEncoding);
- }
- while(++t < numTables);
- }
-
- {
- Byte mtfSel[kNumTablesMax];
- {
- int t = 0;
- do
- mtfSel[t] = (Byte)t;
- while(++t < numTables);
- }
-
- UInt32 i = 0;
- do
- {
- Byte sel = m_Selectors[i];
- int pos;
- for (pos = 0; mtfSel[pos] != sel; pos++)
- WriteBit2(true);
- WriteBit2(false);
- for (; pos > 0; pos--)
- mtfSel[pos] = mtfSel[pos - 1];
- mtfSel[0] = sel;
- }
- while(++i < numSelectors);
- }
-
- {
- int t = 0;
- do
- {
- const Byte *lens = Lens[t];
- UInt32 len = lens[0];
- WriteBits2(len, kNumLevelsBits);
- int i = 0;
- do
- {
- UInt32 level = lens[i];
- while (len != level)
- {
- WriteBit2(true);
- if (len < level)
- {
- WriteBit2(false);
- len++;
- }
- else
- {
- WriteBit2(true);
- len--;
- }
- }
- WriteBit2(false);
- }
- while (++i < alphaSize);
- }
- while(++t < numTables);
- }
-
- {
- UInt32 groupSize = 0;
- UInt32 groupIndex = 0;
- const Byte *lens = 0;
- const UInt32 *codes = 0;
- UInt32 mtfPos = 0;
- do
- {
- UInt32 symbol = mtfs[mtfPos++];
- if (symbol >= 0xFF)
- symbol += mtfs[mtfPos++];
- if (groupSize == 0)
- {
- groupSize = kGroupSize;
- int t = m_Selectors[groupIndex++];
- lens = Lens[t];
- codes = Codes[t];
- }
- groupSize--;
- m_OutStreamCurrent->WriteBits(codes[symbol], lens[symbol]);
- }
- while (mtfPos < mtfArraySize);
- }
-
- if (!m_OptimizeNumTables)
- break;
- UInt32 price = m_OutStreamCurrent->GetPos() - startPos;
- if (price <= bestPrice)
- {
- if (nt == kNumTablesMax)
- break;
- bestPrice = price;
- bestNumTables = nt;
- }
- }
-}
-
-// blockSize > 0
-UInt32 CThreadInfo::EncodeBlockWithHeaders(const Byte *block, UInt32 blockSize)
-{
- WriteByte2(kBlockSig0);
- WriteByte2(kBlockSig1);
- WriteByte2(kBlockSig2);
- WriteByte2(kBlockSig3);
- WriteByte2(kBlockSig4);
- WriteByte2(kBlockSig5);
-
- CBZip2Crc crc;
- int numReps = 0;
- Byte prevByte = block[0];
- UInt32 i = 0;
- do
- {
- Byte b = block[i];
- if (numReps == kRleModeRepSize)
- {
- for (; b > 0; b--)
- crc.UpdateByte(prevByte);
- numReps = 0;
- continue;
- }
- if (prevByte == b)
- numReps++;
- else
- {
- numReps = 1;
- prevByte = b;
- }
- crc.UpdateByte(b);
- }
- while (++i < blockSize);
- UInt32 crcRes = crc.GetDigest();
- WriteCrc2(crcRes);
- EncodeBlock(block, blockSize);
- return crcRes;
-}
-
-void CThreadInfo::EncodeBlock2(const Byte *block, UInt32 blockSize, UInt32 numPasses)
-{
- UInt32 numCrcs = m_NumCrcs;
- bool needCompare = false;
-
- UInt32 startBytePos = m_OutStreamCurrent->GetBytePos();
- UInt32 startPos = m_OutStreamCurrent->GetPos();
- Byte startCurByte = m_OutStreamCurrent->GetCurByte();
- Byte endCurByte = 0;
- UInt32 endPos = 0;
- if (numPasses > 1 && blockSize >= (1 << 10))
- {
- UInt32 blockSize0 = blockSize / 2;
- for (;(block[blockSize0] == block[blockSize0 - 1] ||
- block[blockSize0 - 1] == block[blockSize0 - 2]) &&
- blockSize0 < blockSize; blockSize0++);
- if (blockSize0 < blockSize)
- {
- EncodeBlock2(block, blockSize0, numPasses - 1);
- EncodeBlock2(block + blockSize0, blockSize - blockSize0, numPasses - 1);
- endPos = m_OutStreamCurrent->GetPos();
- endCurByte = m_OutStreamCurrent->GetCurByte();
- if ((endPos & 7) > 0)
- WriteBits2(0, 8 - (endPos & 7));
- m_OutStreamCurrent->SetCurState((startPos & 7), startCurByte);
- needCompare = true;
- }
- }
-
- UInt32 startBytePos2 = m_OutStreamCurrent->GetBytePos();
- UInt32 startPos2 = m_OutStreamCurrent->GetPos();
- UInt32 crcVal = EncodeBlockWithHeaders(block, blockSize);
- UInt32 endPos2 = m_OutStreamCurrent->GetPos();
-
- if (needCompare)
- {
- UInt32 size2 = endPos2 - startPos2;
- if (size2 < endPos - startPos)
- {
- UInt32 numBytes = m_OutStreamCurrent->GetBytePos() - startBytePos2;
- Byte *buffer = m_OutStreamCurrent->GetStream();
- for (UInt32 i = 0; i < numBytes; i++)
- buffer[startBytePos + i] = buffer[startBytePos2 + i];
- m_OutStreamCurrent->SetPos(startPos + endPos2 - startPos2);
- m_NumCrcs = numCrcs;
- m_CRCs[m_NumCrcs++] = crcVal;
- }
- else
- {
- m_OutStreamCurrent->SetPos(endPos);
- m_OutStreamCurrent->SetCurState((endPos & 7), endCurByte);
- }
- }
- else
- {
- m_NumCrcs = numCrcs;
- m_CRCs[m_NumCrcs++] = crcVal;
- }
-}
-
-HRESULT CThreadInfo::EncodeBlock3(UInt32 blockSize)
-{
- CMsbfEncoderTemp outStreamTemp;
- outStreamTemp.SetStream(m_TempArray);
- outStreamTemp.Init();
- m_OutStreamCurrent = &outStreamTemp;
-
- m_NumCrcs = 0;
-
- EncodeBlock2(m_Block, blockSize, Encoder->NumPasses);
-
- #ifdef COMPRESS_BZIP2_MT
- if (Encoder->MtMode)
- Encoder->ThreadsInfo[m_BlockIndex].CanWriteEvent.Lock();
- #endif
- for (UInt32 i = 0; i < m_NumCrcs; i++)
- Encoder->CombinedCrc.Update(m_CRCs[i]);
- Encoder->WriteBytes(m_TempArray, outStreamTemp.GetPos(), outStreamTemp.GetCurByte());
- HRESULT res = S_OK;
- #ifdef COMPRESS_BZIP2_MT
- if (Encoder->MtMode)
- {
- UInt32 blockIndex = m_BlockIndex + 1;
- if (blockIndex == Encoder->NumThreads)
- blockIndex = 0;
-
- if (Encoder->Progress)
- {
- UInt64 unpackSize = Encoder->m_OutStream.GetProcessedSize();
- res = Encoder->Progress->SetRatioInfo(&m_PackSize, &unpackSize);
- }
-
- Encoder->ThreadsInfo[blockIndex].CanWriteEvent.Set();
- }
- #endif
- return res;
-}
-
-void CEncoder::WriteBytes(const Byte *data, UInt32 sizeInBits, Byte lastByte)
-{
- UInt32 bytesSize = (sizeInBits / 8);
- for (UInt32 i = 0; i < bytesSize; i++)
- m_OutStream.WriteBits(data[i], 8);
- WriteBits(lastByte, (sizeInBits & 7));
-}
-
-
-HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
-{
- #ifdef COMPRESS_BZIP2_MT
- Progress = progress;
- RINOK(Create());
- for (UInt32 t = 0; t < NumThreads; t++)
- #endif
- {
- #ifdef COMPRESS_BZIP2_MT
- CThreadInfo &ti = ThreadsInfo[t];
- if (MtMode)
- {
- RINOK(ti.StreamWasFinishedEvent.Reset());
- RINOK(ti.WaitingWasStartedEvent.Reset());
- RINOK(ti.CanWriteEvent.Reset());
- }
- #else
- CThreadInfo &ti = ThreadsInfo;
- ti.Encoder = this;
- #endif
-
- ti.m_OptimizeNumTables = m_OptimizeNumTables;
-
- if (!ti.Alloc())
- return E_OUTOFMEMORY;
- }
-
-
- if (!m_InStream.Create(kBufferSize))
- return E_OUTOFMEMORY;
- if (!m_OutStream.Create(kBufferSize))
- return E_OUTOFMEMORY;
-
-
- m_InStream.SetStream(inStream);
- m_InStream.Init();
-
- m_OutStream.SetStream(outStream);
- m_OutStream.Init();
-
- CFlusher flusher(this);
-
- CombinedCrc.Init();
- #ifdef COMPRESS_BZIP2_MT
- NextBlockIndex = 0;
- StreamWasFinished = false;
- CloseThreads = false;
- CanStartWaitingEvent.Reset();
- #endif
-
- WriteByte(kArSig0);
- WriteByte(kArSig1);
- WriteByte(kArSig2);
- WriteByte((Byte)(kArSig3 + m_BlockSizeMult));
-
- #ifdef COMPRESS_BZIP2_MT
-
- if (MtMode)
- {
- ThreadsInfo[0].CanWriteEvent.Set();
- Result = S_OK;
- CanProcessEvent.Set();
- UInt32 t;
- for (t = 0; t < NumThreads; t++)
- ThreadsInfo[t].StreamWasFinishedEvent.Lock();
- CanProcessEvent.Reset();
- CanStartWaitingEvent.Set();
- for (t = 0; t < NumThreads; t++)
- ThreadsInfo[t].WaitingWasStartedEvent.Lock();
- CanStartWaitingEvent.Reset();
- RINOK(Result);
- }
- else
- #endif
- {
- for (;;)
- {
- CThreadInfo &ti =
- #ifdef COMPRESS_BZIP2_MT
- ThreadsInfo[0];
- #else
- ThreadsInfo;
- #endif
- UInt32 blockSize = ReadRleBlock(ti.m_Block);
- if (blockSize == 0)
- break;
- RINOK(ti.EncodeBlock3(blockSize));
- if (progress)
- {
- UInt64 packSize = m_InStream.GetProcessedSize();
- UInt64 unpackSize = m_OutStream.GetProcessedSize();
- RINOK(progress->SetRatioInfo(&packSize, &unpackSize));
- }
- }
- }
- WriteByte(kFinSig0);
- WriteByte(kFinSig1);
- WriteByte(kFinSig2);
- WriteByte(kFinSig3);
- WriteByte(kFinSig4);
- WriteByte(kFinSig5);
-
- WriteCrc(CombinedCrc.GetDigest());
- return Flush();
-}
-
-STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(const COutBufferException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-HRESULT CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
-{
- for(UInt32 i = 0; i < numProps; i++)
- {
- const PROPVARIANT &prop = props[i];
- switch(propIDs[i])
- {
- case NCoderPropID::kNumPasses:
- {
- if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- UInt32 numPasses = prop.ulVal;
- if (numPasses == 0)
- numPasses = 1;
- if (numPasses > static_cast< UInt32 >( kNumPassesMax) )
- numPasses = kNumPassesMax;
- NumPasses = numPasses;
- m_OptimizeNumTables = (NumPasses > 1);
- break;
- }
- case NCoderPropID::kDictionarySize:
- {
- if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- UInt32 dictionary = prop.ulVal / kBlockSizeStep;
- if (dictionary < static_cast< UInt32 >( kBlockSizeMultMin) )
- dictionary = kBlockSizeMultMin;
- else if (dictionary > static_cast< UInt32 >( kBlockSizeMultMax) )
- dictionary = kBlockSizeMultMax;
- m_BlockSizeMult = dictionary;
- break;
- }
- case NCoderPropID::kNumThreads:
- {
- #ifdef COMPRESS_BZIP2_MT
- if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- NumThreads = prop.ulVal;
- if (NumThreads < 1)
- NumThreads = 1;
- #endif
- break;
- }
- default:
- return E_INVALIDARG;
- }
- }
- return S_OK;
-}
-
-#ifdef COMPRESS_BZIP2_MT
-STDMETHODIMP CEncoder::SetNumberOfThreads(UInt32 numThreads)
-{
- NumThreads = numThreads;
- if (NumThreads < 1)
- NumThreads = 1;
- return S_OK;
-}
-#endif
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Encoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Encoder.h
deleted file mode 100644
index 8a1061443..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Encoder.h
+++ /dev/null
@@ -1,245 +0,0 @@
-// BZip2Encoder.h
-
-#ifndef __COMPRESS_BZIP2_ENCODER_H
-#define __COMPRESS_BZIP2_ENCODER_H
-
-#include "../../Common/Defs.h"
-#include "../../Common/MyCom.h"
-
-#ifdef COMPRESS_BZIP2_MT
-#include "../../Windows/Synchronization.h"
-#include "../../Windows/Thread.h"
-#endif
-
-#include "../ICoder.h"
-
-#include "../Common/InBuffer.h"
-#include "../Common/OutBuffer.h"
-
-#include "BitmEncoder.h"
-#include "BZip2Const.h"
-#include "BZip2Crc.h"
-
-namespace NCompress {
-namespace NBZip2 {
-
-class CMsbfEncoderTemp
-{
- UInt32 m_Pos;
- int m_BitPos;
- Byte m_CurByte;
- Byte *Buffer;
-public:
- void SetStream(Byte *buffer) { Buffer = buffer; }
- Byte *GetStream() const { return Buffer; }
-
- void Init()
- {
- m_Pos = 0;
- m_BitPos = 8;
- m_CurByte = 0;
- }
-
- void Flush()
- {
- if (m_BitPos < 8)
- WriteBits(0, m_BitPos);
- }
-
- void WriteBits(UInt32 value, int numBits)
- {
- while (numBits > 0)
- {
- int numNewBits = MyMin(numBits, m_BitPos);
- numBits -= numNewBits;
-
- m_CurByte <<= numNewBits;
- UInt32 newBits = value >> numBits;
- m_CurByte |= Byte(newBits);
- value -= (newBits << numBits);
-
- m_BitPos -= numNewBits;
-
- if (m_BitPos == 0)
- {
- Buffer[m_Pos++] = m_CurByte;
- m_BitPos = 8;
- }
- }
- }
-
- UInt32 GetBytePos() const { return m_Pos ; }
- UInt32 GetPos() const { return m_Pos * 8 + (8 - m_BitPos); }
- Byte GetCurByte() const { return m_CurByte; }
- void SetPos(UInt32 bitPos)
- {
- m_Pos = bitPos / 8;
- m_BitPos = 8 - ((int)bitPos & 7);
- }
- void SetCurState(int bitPos, Byte curByte)
- {
- m_BitPos = 8 - bitPos;
- m_CurByte = curByte;
- }
-};
-
-class CEncoder;
-
-const int kNumPassesMax = 10;
-
-class CThreadInfo
-{
-public:
- Byte *m_Block;
-private:
- Byte *m_MtfArray;
- Byte *m_TempArray;
- UInt32 *m_BlockSorterIndex;
-
- CMsbfEncoderTemp *m_OutStreamCurrent;
-
- Byte Lens[kNumTablesMax][kMaxAlphaSize];
- UInt32 Freqs[kNumTablesMax][kMaxAlphaSize];
- UInt32 Codes[kNumTablesMax][kMaxAlphaSize];
-
- Byte m_Selectors[kNumSelectorsMax];
-
- UInt32 m_CRCs[1 << kNumPassesMax];
- UInt32 m_NumCrcs;
-
- UInt32 m_BlockIndex;
-
- void WriteBits2(UInt32 value, UInt32 numBits);
- void WriteByte2(Byte b);
- void WriteBit2(bool v);
- void WriteCrc2(UInt32 v);
-
- void EncodeBlock(const Byte *block, UInt32 blockSize);
- UInt32 EncodeBlockWithHeaders(const Byte *block, UInt32 blockSize);
- void EncodeBlock2(const Byte *block, UInt32 blockSize, UInt32 numPasses);
-public:
- bool m_OptimizeNumTables;
- CEncoder *Encoder;
- #ifdef COMPRESS_BZIP2_MT
- NWindows::CThread Thread;
-
- NWindows::NSynchronization::CAutoResetEvent StreamWasFinishedEvent;
- NWindows::NSynchronization::CAutoResetEvent WaitingWasStartedEvent;
-
- // it's not member of this thread. We just need one event per thread
- NWindows::NSynchronization::CAutoResetEvent CanWriteEvent;
-
- UInt64 m_PackSize;
-
- Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size.
- HRESULT Create();
- void FinishStream(bool needLeave);
- DWORD ThreadFunc();
- #endif
-
- CThreadInfo(): m_Block(0), m_BlockSorterIndex(0) {}
- ~CThreadInfo() { Free(); }
- bool Alloc();
- void Free();
-
- HRESULT EncodeBlock3(UInt32 blockSize);
-};
-
-class CEncoder :
- public ICompressCoder,
- public ICompressSetCoderProperties,
- #ifdef COMPRESS_BZIP2_MT
- public ICompressSetCoderMt,
- #endif
- public CMyUnknownImp
-{
- UInt32 m_BlockSizeMult;
- bool m_OptimizeNumTables;
-
- UInt32 m_NumPassesPrev;
-
- UInt32 m_NumThreadsPrev;
-public:
- CInBuffer m_InStream;
- Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size.
- CBitmEncoder<COutBuffer> m_OutStream;
- UInt32 NumPasses;
- CBZip2CombinedCrc CombinedCrc;
-
- #ifdef COMPRESS_BZIP2_MT
- CThreadInfo *ThreadsInfo;
- NWindows::NSynchronization::CManualResetEvent CanProcessEvent;
- NWindows::NSynchronization::CCriticalSection CS;
- UInt32 NumThreads;
- bool MtMode;
- UInt32 NextBlockIndex;
-
- bool CloseThreads;
- bool StreamWasFinished;
- NWindows::NSynchronization::CManualResetEvent CanStartWaitingEvent;
-
- HRESULT Result;
- ICompressProgressInfo *Progress;
- #else
- CThreadInfo ThreadsInfo;
- #endif
-
- UInt32 ReadRleBlock(Byte *buffer);
- void WriteBytes(const Byte *data, UInt32 sizeInBits, Byte lastByte);
-
- void WriteBits(UInt32 value, UInt32 numBits);
- void WriteByte(Byte b);
- void WriteBit(bool v);
- void WriteCrc(UInt32 v);
-
- #ifdef COMPRESS_BZIP2_MT
- HRESULT Create();
- void Free();
- #endif
-
-public:
- CEncoder();
- #ifdef COMPRESS_BZIP2_MT
- ~CEncoder();
- #endif
-
- HRESULT Flush() { return m_OutStream.Flush(); }
-
- void ReleaseStreams()
- {
- m_InStream.ReleaseStream();
- m_OutStream.ReleaseStream();
- }
-
- class CFlusher
- {
- CEncoder *_coder;
- public:
- CFlusher(CEncoder *coder): _coder(coder) {}
- ~CFlusher()
- {
- _coder->ReleaseStreams();
- }
- };
-
- #ifdef COMPRESS_BZIP2_MT
- MY_UNKNOWN_IMP2(ICompressSetCoderMt, ICompressSetCoderProperties)
- #else
- MY_UNKNOWN_IMP1(ICompressSetCoderProperties)
- #endif
-
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
-
- #ifdef COMPRESS_BZIP2_MT
- STDMETHOD(SetNumberOfThreads)(UInt32 numThreads);
- #endif
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Register.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Register.cpp
deleted file mode 100644
index ef14204b0..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BZip2Register.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// BZip2Register.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "BZip2Decoder.h"
-
-static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NBZip2::CDecoder); }
-#if !defined(EXTRACT_ONLY) && !defined(BZIP2_EXTRACT_ONLY)
-#include "BZip2Encoder.h"
-static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NBZip2::CEncoder); }
-#else
-#define CreateCodecOut 0
-#endif
-
-static CCodecInfo g_CodecInfo =
- { CreateCodec, CreateCodecOut, 0x040202, L"BZip2", 1, false };
-
-REGISTER_CODEC(BZip2)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Bcj2Coder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Bcj2Coder.cpp
deleted file mode 100644
index 13ce51600..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Bcj2Coder.cpp
+++ /dev/null
@@ -1,390 +0,0 @@
-// Bcj2Coder.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "Bcj2Coder.h"
-
-namespace NCompress {
-namespace NBcj2 {
-
-inline bool IsJcc(Byte b0, Byte b1) { return (b0 == 0x0F && (b1 & 0xF0) == 0x80); }
-inline bool IsJ(Byte b0, Byte b1) { return ((b1 & 0xFE) == 0xE8 || IsJcc(b0, b1)); }
-inline unsigned GetIndex(Byte b0, Byte b1) { return ((b1 == 0xE8) ? b0 : ((b1 == 0xE9) ? 256 : 257)); }
-
-#ifndef EXTRACT_ONLY
-
-static const int kBufferSize = 1 << 17;
-
-static bool inline Test86MSByte(Byte b)
-{
- return (b == 0 || b == 0xFF);
-}
-
-bool CEncoder::Create()
-{
- if (!_mainStream.Create(1 << 16))
- return false;
- if (!_callStream.Create(1 << 20))
- return false;
- if (!_jumpStream.Create(1 << 20))
- return false;
- if (!_rangeEncoder.Create(1 << 20))
- return false;
- if (_buffer == 0)
- {
- _buffer = (Byte *)MidAlloc(kBufferSize);
- if (_buffer == 0)
- return false;
- }
- return true;
-}
-
-CEncoder::~CEncoder()
-{
- ::MidFree(_buffer);
-}
-
-HRESULT CEncoder::Flush()
-{
- RINOK(_mainStream.Flush());
- RINOK(_callStream.Flush());
- RINOK(_jumpStream.Flush());
- _rangeEncoder.FlushData();
- return _rangeEncoder.FlushStream();
-}
-
-const UInt32 kDefaultLimit = (1 << 24);
-
-HRESULT CEncoder::CodeReal(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 ** /* outSizes */,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress)
-{
- if (numInStreams != 1 || numOutStreams != 4)
- return E_INVALIDARG;
-
- if (!Create())
- return E_OUTOFMEMORY;
-
- bool sizeIsDefined = false;
- UInt64 inSize = 0;
- if (inSizes != NULL)
- if (inSizes[0] != NULL)
- {
- inSize = *inSizes[0];
- if (inSize <= kDefaultLimit)
- sizeIsDefined = true;
- }
-
- ISequentialInStream *inStream = inStreams[0];
-
- _mainStream.SetStream(outStreams[0]);
- _mainStream.Init();
- _callStream.SetStream(outStreams[1]);
- _callStream.Init();
- _jumpStream.SetStream(outStreams[2]);
- _jumpStream.Init();
- _rangeEncoder.SetStream(outStreams[3]);
- _rangeEncoder.Init();
- for (int i = 0; i < 256 + 2; i++)
- _statusEncoder[i].Init();
- CCoderReleaser releaser(this);
-
- CMyComPtr<ICompressGetSubStreamSize> getSubStreamSize;
- {
- inStream->QueryInterface(IID_ICompressGetSubStreamSize, (void **)&getSubStreamSize);
- }
-
- UInt32 nowPos = 0;
- UInt64 nowPos64 = 0;
- UInt32 bufferPos = 0;
-
- Byte prevByte = 0;
-
- UInt64 subStreamIndex = 0;
- UInt64 subStreamStartPos = 0;
- UInt64 subStreamEndPos = 0;
-
- for (;;)
- {
- UInt32 processedSize = 0;
- for (;;)
- {
- UInt32 size = kBufferSize - (bufferPos + processedSize);
- UInt32 processedSizeLoc;
- if (size == 0)
- break;
- RINOK(inStream->Read(_buffer + bufferPos + processedSize, size, &processedSizeLoc));
- if (processedSizeLoc == 0)
- break;
- processedSize += processedSizeLoc;
- }
- UInt32 endPos = bufferPos + processedSize;
-
- if (endPos < 5)
- {
- // change it
- for (bufferPos = 0; bufferPos < endPos; bufferPos++)
- {
- Byte b = _buffer[bufferPos];
- _mainStream.WriteByte(b);
- UInt32 index;
- if (b == 0xE8)
- index = prevByte;
- else if (b == 0xE9)
- index = 256;
- else if (IsJcc(prevByte, b))
- index = 257;
- else
- {
- prevByte = b;
- continue;
- }
- _statusEncoder[index].Encode(&_rangeEncoder, 0);
- prevByte = b;
- }
- return Flush();
- }
-
- bufferPos = 0;
-
- UInt32 limit = endPos - 5;
- while(bufferPos <= limit)
- {
- Byte b = _buffer[bufferPos];
- _mainStream.WriteByte(b);
- if (!IsJ(prevByte, b))
- {
- bufferPos++;
- prevByte = b;
- continue;
- }
- Byte nextByte = _buffer[bufferPos + 4];
- UInt32 src =
- (UInt32(nextByte) << 24) |
- (UInt32(_buffer[bufferPos + 3]) << 16) |
- (UInt32(_buffer[bufferPos + 2]) << 8) |
- (_buffer[bufferPos + 1]);
- UInt32 dest = (nowPos + bufferPos + 5) + src;
- // if (Test86MSByte(nextByte))
- bool convert;
- if (getSubStreamSize != NULL)
- {
- UInt64 currentPos = (nowPos64 + bufferPos);
- while (subStreamEndPos < currentPos)
- {
- UInt64 subStreamSize;
- HRESULT result = getSubStreamSize->GetSubStreamSize(subStreamIndex, &subStreamSize);
- if (result == S_OK)
- {
- subStreamStartPos = subStreamEndPos;
- subStreamEndPos += subStreamSize;
- subStreamIndex++;
- }
- else if (result == S_FALSE || result == E_NOTIMPL)
- {
- getSubStreamSize.Release();
- subStreamStartPos = 0;
- subStreamEndPos = subStreamStartPos - 1;
- }
- else
- return result;
- }
- if (getSubStreamSize == NULL)
- {
- if (sizeIsDefined)
- convert = (dest < inSize);
- else
- convert = Test86MSByte(nextByte);
- }
- else if (subStreamEndPos - subStreamStartPos > kDefaultLimit)
- convert = Test86MSByte(nextByte);
- else
- {
- UInt64 dest64 = (currentPos + 5) + Int64(Int32(src));
- convert = (dest64 >= subStreamStartPos && dest64 < subStreamEndPos);
- }
- }
- else if (sizeIsDefined)
- convert = (dest < inSize);
- else
- convert = Test86MSByte(nextByte);
- unsigned index = GetIndex(prevByte, b);
- if (convert)
- {
- _statusEncoder[index].Encode(&_rangeEncoder, 1);
- bufferPos += 5;
- COutBuffer &s = (b == 0xE8) ? _callStream : _jumpStream;
- for (int i = 24; i >= 0; i -= 8)
- s.WriteByte((Byte)(dest >> i));
- prevByte = nextByte;
- }
- else
- {
- _statusEncoder[index].Encode(&_rangeEncoder, 0);
- bufferPos++;
- prevByte = b;
- }
- }
- nowPos += bufferPos;
- nowPos64 += bufferPos;
-
- if (progress != NULL)
- {
- /*
- const UInt64 compressedSize =
- _mainStream.GetProcessedSize() +
- _callStream.GetProcessedSize() +
- _jumpStream.GetProcessedSize() +
- _rangeEncoder.GetProcessedSize();
- */
- RINOK(progress->SetRatioInfo(&nowPos64, NULL));
- }
-
- UInt32 i = 0;
- while(bufferPos < endPos)
- _buffer[i++] = _buffer[bufferPos++];
- bufferPos = i;
- }
-}
-
-STDMETHODIMP CEncoder::Code(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress)
-{
- try
- {
- return CodeReal(inStreams, inSizes, numInStreams,
- outStreams, outSizes,numOutStreams, progress);
- }
- catch(const COutBufferException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-#endif
-
-HRESULT CDecoder::CodeReal(ISequentialInStream **inStreams,
- const UInt64 ** /* inSizes */,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 ** /* outSizes */,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress)
-{
- if (numInStreams != 4 || numOutStreams != 1)
- return E_INVALIDARG;
-
- if (!_mainInStream.Create(1 << 16))
- return E_OUTOFMEMORY;
- if (!_callStream.Create(1 << 20))
- return E_OUTOFMEMORY;
- if (!_jumpStream.Create(1 << 16))
- return E_OUTOFMEMORY;
- if (!_rangeDecoder.Create(1 << 20))
- return E_OUTOFMEMORY;
- if (!_outStream.Create(1 << 16))
- return E_OUTOFMEMORY;
-
- _mainInStream.SetStream(inStreams[0]);
- _callStream.SetStream(inStreams[1]);
- _jumpStream.SetStream(inStreams[2]);
- _rangeDecoder.SetStream(inStreams[3]);
- _outStream.SetStream(outStreams[0]);
-
- _mainInStream.Init();
- _callStream.Init();
- _jumpStream.Init();
- _rangeDecoder.Init();
- _outStream.Init();
-
- for (int i = 0; i < 256 + 2; i++)
- _statusDecoder[i].Init();
-
- CCoderReleaser releaser(this);
-
- Byte prevByte = 0;
- UInt32 processedBytes = 0;
- for (;;)
- {
- if (processedBytes >= (1 << 20) && progress != NULL)
- {
- /*
- const UInt64 compressedSize =
- _mainInStream.GetProcessedSize() +
- _callStream.GetProcessedSize() +
- _jumpStream.GetProcessedSize() +
- _rangeDecoder.GetProcessedSize();
- */
- const UInt64 nowPos64 = _outStream.GetProcessedSize();
- RINOK(progress->SetRatioInfo(NULL, &nowPos64));
- processedBytes = 0;
- }
- UInt32 i;
- Byte b = 0;
- const UInt32 kBurstSize = (1 << 18);
- for (i = 0; i < kBurstSize; i++)
- {
- if (!_mainInStream.ReadByte(b))
- return Flush();
- _outStream.WriteByte(b);
- if (IsJ(prevByte, b))
- break;
- prevByte = b;
- }
- processedBytes += i;
- if (i == kBurstSize)
- continue;
- unsigned index = GetIndex(prevByte, b);
- if (_statusDecoder[index].Decode(&_rangeDecoder) == 1)
- {
- UInt32 src = 0;
- CInBuffer &s = (b == 0xE8) ? _callStream : _jumpStream;
- for (int i = 0; i < 4; i++)
- {
- Byte b0;
- if(!s.ReadByte(b0))
- return S_FALSE;
- src <<= 8;
- src |= ((UInt32)b0);
- }
- UInt32 dest = src - (UInt32(_outStream.GetProcessedSize()) + 4) ;
- _outStream.WriteByte((Byte)(dest));
- _outStream.WriteByte((Byte)(dest >> 8));
- _outStream.WriteByte((Byte)(dest >> 16));
- _outStream.WriteByte((Byte)(dest >> 24));
- prevByte = (Byte)(dest >> 24);
- processedBytes += 4;
- }
- else
- prevByte = b;
- }
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress)
-{
- try
- {
- return CodeReal(inStreams, inSizes, numInStreams,
- outStreams, outSizes,numOutStreams, progress);
- }
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(const COutBufferException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Bcj2Coder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Bcj2Coder.h
deleted file mode 100644
index b8b1e7a99..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Bcj2Coder.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// Bcj2Coder.h
-
-#ifndef __COMPRESS_BCJ2_CODER_H
-#define __COMPRESS_BCJ2_CODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "RangeCoderBit.h"
-
-namespace NCompress {
-namespace NBcj2 {
-
-const int kNumMoveBits = 5;
-
-#ifndef EXTRACT_ONLY
-
-class CEncoder:
- public ICompressCoder2,
- public CMyUnknownImp
-{
- Byte *_buffer;
-public:
- CEncoder(): _buffer(0) {};
- ~CEncoder();
- bool Create();
-
- COutBuffer _mainStream;
- COutBuffer _callStream;
- COutBuffer _jumpStream;
- NCompress::NRangeCoder::CEncoder _rangeEncoder;
- NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusEncoder[256 + 2];
-
- HRESULT Flush();
- void ReleaseStreams()
- {
- _mainStream.ReleaseStream();
- _callStream.ReleaseStream();
- _jumpStream.ReleaseStream();
- _rangeEncoder.ReleaseStream();
- }
-
- class CCoderReleaser
- {
- CEncoder *_coder;
- public:
- CCoderReleaser(CEncoder *coder): _coder(coder) {}
- ~CCoderReleaser() { _coder->ReleaseStreams(); }
- };
-
-public:
-
- MY_UNKNOWN_IMP
-
- HRESULT CodeReal(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress);
- STDMETHOD(Code)(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress);
-};
-
-#endif
-
-class CDecoder:
- public ICompressCoder2,
- public CMyUnknownImp
-{
-public:
- CInBuffer _mainInStream;
- CInBuffer _callStream;
- CInBuffer _jumpStream;
- NCompress::NRangeCoder::CDecoder _rangeDecoder;
- NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusDecoder[256 + 2];
-
- COutBuffer _outStream;
-
- void ReleaseStreams()
- {
- _mainInStream.ReleaseStream();
- _callStream.ReleaseStream();
- _jumpStream.ReleaseStream();
- _rangeDecoder.ReleaseStream();
- _outStream.ReleaseStream();
- }
-
- HRESULT Flush() { return _outStream.Flush(); }
- class CCoderReleaser
- {
- CDecoder *_coder;
- public:
- CCoderReleaser(CDecoder *coder): _coder(coder) {}
- ~CCoderReleaser() { _coder->ReleaseStreams(); }
- };
-
-public:
- MY_UNKNOWN_IMP
- HRESULT CodeReal(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress);
- STDMETHOD(Code)(ISequentialInStream **inStreams,
- const UInt64 **inSizes,
- UInt32 numInStreams,
- ISequentialOutStream **outStreams,
- const UInt64 **outSizes,
- UInt32 numOutStreams,
- ICompressProgressInfo *progress);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Bcj2Register.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Bcj2Register.cpp
deleted file mode 100644
index 8eb1e7360..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Bcj2Register.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// Bcj2Register.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "Bcj2Coder.h"
-
-static void *CreateCodec() { return (void *)(ICompressCoder2 *)(new NCompress::NBcj2::CDecoder()); }
-#ifndef EXTRACT_ONLY
-static void *CreateCodecOut() { return (void *)(ICompressCoder2 *)(new NCompress::NBcj2::CEncoder()); }
-#else
-#define CreateCodecOut 0
-#endif
-
-static CCodecInfo g_CodecInfo =
- { CreateCodec, CreateCodecOut, 0x0303011B, L"BCJ2", 4, false };
-
-REGISTER_CODEC(BCJ2)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BcjCoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BcjCoder.cpp
deleted file mode 100644
index 0e34ef488..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BcjCoder.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-// BcjCoder.cpp
-
-#include "StdAfx.h"
-
-#include "BcjCoder.h"
-
-UInt32 CBCJ_x86_Encoder::SubFilter(Byte *data, UInt32 size)
-{
- return (UInt32)::x86_Convert(data, size, _bufferPos, &_prevMask, 1);
-}
-
-UInt32 CBCJ_x86_Decoder::SubFilter(Byte *data, UInt32 size)
-{
- return (UInt32)::x86_Convert(data, size, _bufferPos, &_prevMask, 0);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BcjCoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BcjCoder.h
deleted file mode 100644
index 0754bcd23..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BcjCoder.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// BcjCoder.h
-
-#ifndef __COMPRESS_BCJ_CODER_H
-#define __COMPRESS_BCJ_CODER_H
-
-#include "../../../C/Bra.h"
-
-#include "BranchCoder.h"
-
-struct CBranch86
-{
- UInt32 _prevMask;
- void x86Init() { x86_Convert_Init(_prevMask); }
-};
-
-MyClassB(BCJ_x86, 0x01, 3, CBranch86 ,
- virtual void SubInit() { x86Init(); })
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BcjRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BcjRegister.cpp
deleted file mode 100644
index 648ad8e03..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BcjRegister.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// BcjRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "BcjCoder.h"
-
-static void *CreateCodec() { return (void *)(ICompressFilter *)(new CBCJ_x86_Decoder()); }
-#ifndef EXTRACT_ONLY
-static void *CreateCodecOut() { return (void *)(ICompressFilter *)(new CBCJ_x86_Encoder()); }
-#else
-#define CreateCodecOut 0
-#endif
-
-static CCodecInfo g_CodecInfo =
- { CreateCodec, CreateCodecOut, 0x03030103, L"BCJ", 1, true };
-
-REGISTER_CODEC(BCJ)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitlDecoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitlDecoder.cpp
deleted file mode 100644
index 78665be8f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitlDecoder.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// BitlDecoder.cpp
-
-#include "StdAfx.h"
-
-#include "BitlDecoder.h"
-
-namespace NBitl {
-
-Byte kInvertTable[256];
-
-struct CInverterTableInitializer
-{
- CInverterTableInitializer()
- {
- for (int i = 0; i < 256; i++)
- {
- int x = ((i & 0x55) << 1) | ((i & 0xAA) >> 1);
- x = ((x & 0x33) << 2) | ((x & 0xCC) >> 2);
- kInvertTable[i] = (Byte)(((x & 0x0F) << 4) | ((x & 0xF0) >> 4));
- }
- }
-} g_InverterTableInitializer;
-
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitlDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitlDecoder.h
deleted file mode 100644
index 3bee413ae..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitlDecoder.h
+++ /dev/null
@@ -1,142 +0,0 @@
-// BitlDecoder.h -- the Least Significant Bit of byte is First
-
-#ifndef __BITL_DECODER_H
-#define __BITL_DECODER_H
-
-#include "../IStream.h"
-
-namespace NBitl {
-
-const int kNumBigValueBits = 8 * 4;
-
-const int kNumValueBytes = 3;
-const int kNumValueBits = 8 * kNumValueBytes;
-
-const UInt32 kMask = (1 << kNumValueBits) - 1;
-
-extern Byte kInvertTable[256];
-
-template<class TInByte>
-class CBaseDecoder
-{
-protected:
- int m_BitPos;
- UInt32 m_Value;
- TInByte m_Stream;
-public:
- UInt32 NumExtraBytes;
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream); }
- void ReleaseStream() { m_Stream.ReleaseStream(); }
- void Init()
- {
- m_Stream.Init();
- m_BitPos = kNumBigValueBits;
- m_Value = 0;
- NumExtraBytes = 0;
- }
- UInt64 GetProcessedSize() const { return m_Stream.GetProcessedSize() + NumExtraBytes - (kNumBigValueBits - m_BitPos) / 8; }
-
- void Normalize()
- {
- for (; m_BitPos >= 8; m_BitPos -= 8)
- {
- Byte b = 0;
- if (!m_Stream.ReadByte(b))
- {
- b = 0xFF; // check it
- NumExtraBytes++;
- }
- m_Value = (b << (kNumBigValueBits - m_BitPos)) | m_Value;
- }
- }
-
- UInt32 ReadBits(int numBits)
- {
- Normalize();
- UInt32 res = m_Value & ((1 << numBits) - 1);
- m_BitPos += numBits;
- m_Value >>= numBits;
- return res;
- }
-
- bool ExtraBitsWereRead() const
- {
- if (NumExtraBytes == 0)
- return false;
- return ((UInt32)(kNumBigValueBits - m_BitPos) < (NumExtraBytes << 3));
- }
-};
-
-template<class TInByte>
-class CDecoder: public CBaseDecoder<TInByte>
-{
- UInt32 m_NormalValue;
-
-public:
- void Init()
- {
- CBaseDecoder<TInByte>::Init();
- m_NormalValue = 0;
- }
-
- void Normalize()
- {
- for (; this->m_BitPos >= 8; this->m_BitPos -= 8)
- {
- Byte b = 0;
- if (!this->m_Stream.ReadByte(b))
- {
- b = 0xFF; // check it
- this->NumExtraBytes++;
- }
- m_NormalValue = (b << (kNumBigValueBits - this->m_BitPos)) | m_NormalValue;
- this->m_Value = (this->m_Value << 8) | kInvertTable[b];
- }
- }
-
- UInt32 GetValue(int numBits)
- {
- Normalize();
- return ((this->m_Value >> (8 - this->m_BitPos)) & kMask) >> (kNumValueBits - numBits);
- }
-
- void MovePos(int numBits)
- {
- this->m_BitPos += numBits;
- m_NormalValue >>= numBits;
- }
-
- UInt32 ReadBits(int numBits)
- {
- Normalize();
- UInt32 res = m_NormalValue & ((1 << numBits) - 1);
- MovePos(numBits);
- return res;
- }
-
- void AlignToByte() { MovePos((32 - this->m_BitPos) & 7); }
-
- Byte ReadByte()
- {
- if (this->m_BitPos == kNumBigValueBits)
- {
- Byte b = 0;
- if (!this->m_Stream.ReadByte(b))
- {
- b = 0xFF;
- this->NumExtraBytes++;
- }
- return b;
- }
- {
- Byte b = (Byte)(m_NormalValue & 0xFF);
- MovePos(8);
- return b;
- }
- }
-};
-
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitlEncoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitlEncoder.h
deleted file mode 100644
index 02f5a9c65..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitlEncoder.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// BitlEncoder.h -- the Least Significant Bit of byte is First
-
-#ifndef __BITL_ENCODER_H
-#define __BITL_ENCODER_H
-
-#include "../Common/OutBuffer.h"
-
-class CBitlEncoder
-{
- COutBuffer m_Stream;
- int m_BitPos;
- Byte m_CurByte;
-public:
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialOutStream *outStream) { m_Stream.SetStream(outStream); }
- void ReleaseStream() { m_Stream.ReleaseStream(); }
- void Init()
- {
- m_Stream.Init();
- m_BitPos = 8;
- m_CurByte = 0;
- }
- HRESULT Flush()
- {
- FlushByte();
- return m_Stream.Flush();
- }
-
- void FlushByte()
- {
- if(m_BitPos < 8)
- m_Stream.WriteByte(m_CurByte);
- m_BitPos = 8;
- m_CurByte = 0;
- }
-
- void WriteBits(UInt32 value, int numBits)
- {
- while(numBits > 0)
- {
- if (numBits < m_BitPos)
- {
- m_CurByte |= (value & ((1 << numBits) - 1)) << (8 - m_BitPos);
- m_BitPos -= numBits;
- return;
- }
- numBits -= m_BitPos;
- m_Stream.WriteByte((Byte)(m_CurByte | (value << (8 - m_BitPos))));
- value >>= m_BitPos;
- m_BitPos = 8;
- m_CurByte = 0;
- }
- }
- UInt32 GetBitPosition() const { return (8 - m_BitPos); }
- UInt64 GetProcessedSize() const {
- return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) /8; }
- void WriteByte(Byte b) { m_Stream.WriteByte(b);}
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitmDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitmDecoder.h
deleted file mode 100644
index 2885ed781..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitmDecoder.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// BitmDecoder.h -- the Most Significant Bit of byte is First
-
-#ifndef __BITM_DECODER_H
-#define __BITM_DECODER_H
-
-#include "../IStream.h"
-
-namespace NBitm {
-
-const int kNumBigValueBits = 8 * 4;
-const int kNumValueBytes = 3;
-const int kNumValueBits = 8 * kNumValueBytes;
-
-const UInt32 kMask = (1 << kNumValueBits) - 1;
-
-template<class TInByte>
-class CDecoder
-{
- UInt32 m_BitPos;
- UInt32 m_Value;
-public:
- TInByte m_Stream;
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream);}
- void ReleaseStream() { m_Stream.ReleaseStream();}
-
- void Init()
- {
- m_Stream.Init();
- m_BitPos = kNumBigValueBits;
- Normalize();
- }
-
- UInt64 GetProcessedSize() const { return m_Stream.GetProcessedSize() - (kNumBigValueBits - m_BitPos) / 8; }
-
- void Normalize()
- {
- for (;m_BitPos >= 8; m_BitPos -= 8)
- m_Value = (m_Value << 8) | m_Stream.ReadByte();
- }
-
- UInt32 GetValue(UInt32 numBits) const
- {
- // return (m_Value << m_BitPos) >> (kNumBigValueBits - numBits);
- return ((m_Value >> (8 - m_BitPos)) & kMask) >> (kNumValueBits - numBits);
- }
-
- void MovePos(UInt32 numBits)
- {
- m_BitPos += numBits;
- Normalize();
- }
-
- UInt32 ReadBits(UInt32 numBits)
- {
- UInt32 res = GetValue(numBits);
- MovePos(numBits);
- return res;
- }
-
- void AlignToByte() { MovePos((32 - m_BitPos) & 7); }
-};
-
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitmEncoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitmEncoder.h
deleted file mode 100644
index 25976ef61..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BitmEncoder.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// BitmEncoder.h -- the Most Significant Bit of byte is First
-
-#ifndef __BITM_ENCODER_H
-#define __BITM_ENCODER_H
-
-#include "../IStream.h"
-
-template<class TOutByte>
-class CBitmEncoder
-{
- TOutByte m_Stream;
- int m_BitPos;
- Byte m_CurByte;
-public:
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialOutStream *outStream) { m_Stream.SetStream(outStream);}
- void ReleaseStream() { m_Stream.ReleaseStream(); }
- void Init()
- {
- m_Stream.Init();
- m_BitPos = 8;
- m_CurByte = 0;
- }
- HRESULT Flush()
- {
- if(m_BitPos < 8)
- WriteBits(0, m_BitPos);
- return m_Stream.Flush();
- }
-
- void WriteBits(UInt32 value, int numBits)
- {
- while(numBits > 0)
- {
- if (numBits < m_BitPos)
- {
- m_CurByte |= ((Byte)value << (m_BitPos -= numBits));
- return;
- }
- numBits -= m_BitPos;
- UInt32 newBits = (value >> numBits);
- value -= (newBits << numBits);
- m_Stream.WriteByte((Byte)(m_CurByte | newBits));
- m_BitPos = 8;
- m_CurByte = 0;
- }
- }
- UInt64 GetProcessedSize() const {
- return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) / 8; }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchCoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchCoder.cpp
deleted file mode 100644
index 431709526..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchCoder.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// BranchCoder.cpp
-
-#include "StdAfx.h"
-
-#include "BranchCoder.h"
-
-STDMETHODIMP CBranchConverter::Init()
-{
- _bufferPos = 0;
- SubInit();
- return S_OK;
-}
-
-STDMETHODIMP_(UInt32) CBranchConverter::Filter(Byte *data, UInt32 size)
-{
- UInt32 processedSize = SubFilter(data, size);
- _bufferPos += processedSize;
- return processedSize;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchCoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchCoder.h
deleted file mode 100644
index 0e3a5c4e1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchCoder.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// BranchCoder.h
-
-#ifndef __COMPRESS_BRANCH_CODER_H
-#define __COMPRESS_BRANCH_CODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-class CBranchConverter:
- public ICompressFilter,
- public CMyUnknownImp
-{
-protected:
- UInt32 _bufferPos;
- virtual void SubInit() {}
- virtual UInt32 SubFilter(Byte *data, UInt32 size) = 0;
-public:
- MY_UNKNOWN_IMP;
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
-};
-
-#define MyClassEncoderA(Name) class C ## Name: public CBranchConverter \
- { public: UInt32 SubFilter(Byte *data, UInt32 size); };
-
-#define MyClassDecoderA(Name) class C ## Name: public CBranchConverter \
- { public: UInt32 SubFilter(Byte *data, UInt32 size); };
-
-#define MyClassEncoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \
- { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT};
-
-#define MyClassDecoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \
- { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT};
-
-#define MyClassA(Name, id, subId) \
-MyClassEncoderA(Name ## _Encoder) \
-MyClassDecoderA(Name ## _Decoder)
-
-#define MyClassB(Name, id, subId, ADD_ITEMS, ADD_INIT) \
-MyClassEncoderB(Name ## _Encoder, ADD_ITEMS, ADD_INIT) \
-MyClassDecoderB(Name ## _Decoder, ADD_ITEMS, ADD_INIT)
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchMisc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchMisc.cpp
deleted file mode 100644
index 423b723ab..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchMisc.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// BranchMisc.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Bra.h"
-
-#include "BranchMisc.h"
-
-UInt32 CBC_ARM_Encoder::SubFilter(Byte *data, UInt32 size)
- { return (UInt32)::ARM_Convert(data, size, _bufferPos, 1); }
-
-UInt32 CBC_ARM_Decoder::SubFilter(Byte *data, UInt32 size)
- { return (UInt32)::ARM_Convert(data, size, _bufferPos, 0); }
-
-UInt32 CBC_ARMT_Encoder::SubFilter(Byte *data, UInt32 size)
- { return (UInt32)::ARMT_Convert(data, size, _bufferPos, 1); }
-
-UInt32 CBC_ARMT_Decoder::SubFilter(Byte *data, UInt32 size)
- { return (UInt32)::ARMT_Convert(data, size, _bufferPos, 0); }
-
-UInt32 CBC_PPC_Encoder::SubFilter(Byte *data, UInt32 size)
- { return (UInt32)::PPC_Convert(data, size, _bufferPos, 1); }
-
-UInt32 CBC_PPC_Decoder::SubFilter(Byte *data, UInt32 size)
- { return (UInt32)::PPC_Convert(data, size, _bufferPos, 0); }
-
-UInt32 CBC_SPARC_Encoder::SubFilter(Byte *data, UInt32 size)
- { return (UInt32)::SPARC_Convert(data, size, _bufferPos, 1); }
-
-UInt32 CBC_SPARC_Decoder::SubFilter(Byte *data, UInt32 size)
- { return (UInt32)::SPARC_Convert(data, size, _bufferPos, 0); }
-
-UInt32 CBC_IA64_Encoder::SubFilter(Byte *data, UInt32 size)
- { return (UInt32)::IA64_Convert(data, size, _bufferPos, 1); }
-
-UInt32 CBC_IA64_Decoder::SubFilter(Byte *data, UInt32 size)
- { return (UInt32)::IA64_Convert(data, size, _bufferPos, 0); }
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchMisc.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchMisc.h
deleted file mode 100644
index 81198b21c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchMisc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// BranchMisc.h
-
-#ifndef __COMPRESS_BRANCH_MISC_H
-#define __COMPRESS_BRANCH_MISC_H
-
-#include "BranchCoder.h"
-
-MyClassA(BC_ARM, 0x05, 1)
-MyClassA(BC_ARMT, 0x07, 1)
-MyClassA(BC_PPC, 0x02, 5)
-MyClassA(BC_SPARC, 0x08, 5)
-MyClassA(BC_IA64, 0x04, 1)
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchRegister.cpp
deleted file mode 100644
index 380828c6d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/BranchRegister.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// BranchRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "BranchMisc.h"
-
-#define CREATE_CODEC(x) \
- static void *CreateCodec ## x() { return (void *)(ICompressFilter *)(new C ## x ## _Decoder); } \
- static void *CreateCodec ## x ## Out() { return (void *)(ICompressFilter *)(new C ## x ## _Encoder); }
-
-CREATE_CODEC(BC_PPC)
-CREATE_CODEC(BC_IA64)
-CREATE_CODEC(BC_ARM)
-CREATE_CODEC(BC_ARMT)
-CREATE_CODEC(BC_SPARC)
-
-#define METHOD_ITEM(x, id1, id2, name) { CreateCodec ## x, CreateCodec ## x ## Out, 0x03030000 + (id1 * 256) + id2, name, 1, true }
-
-static CCodecInfo g_CodecsInfo[] =
-{
- METHOD_ITEM(BC_PPC, 0x02, 0x05, L"PPC"),
- METHOD_ITEM(BC_IA64, 0x04, 1, L"IA64"),
- METHOD_ITEM(BC_ARM, 0x05, 1, L"ARM"),
- METHOD_ITEM(BC_ARMT, 0x07, 1, L"ARMT"),
- METHOD_ITEM(BC_SPARC, 0x08, 0x05, L"SPARC")
-};
-
-REGISTER_CODECS(Branch)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ByteSwap.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ByteSwap.cpp
deleted file mode 100644
index 645b6ffcd..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ByteSwap.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-// ByteSwap.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "../Common/RegisterCodec.h"
-
-class CByteSwap2:
- public ICompressFilter,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
-};
-
-class CByteSwap4:
- public ICompressFilter,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
-};
-
-STDMETHODIMP CByteSwap2::Init() { return S_OK; }
-
-STDMETHODIMP_(UInt32) CByteSwap2::Filter(Byte *data, UInt32 size)
-{
- const UInt32 kStep = 2;
- UInt32 i;
- for (i = 0; i + kStep <= size; i += kStep)
- {
- Byte b = data[i];
- data[i] = data[i + 1];
- data[i + 1] = b;
- }
- return i;
-}
-
-STDMETHODIMP CByteSwap4::Init() { return S_OK; }
-
-STDMETHODIMP_(UInt32) CByteSwap4::Filter(Byte *data, UInt32 size)
-{
- const UInt32 kStep = 4;
- UInt32 i;
- for (i = 0; i + kStep <= size; i += kStep)
- {
- Byte b0 = data[i];
- Byte b1 = data[i + 1];
- data[i] = data[i + 3];
- data[i + 1] = data[i + 2];
- data[i + 2] = b1;
- data[i + 3] = b0;
- }
- return i;
-}
-
-static void *CreateCodec2() { return (void *)(ICompressFilter *)(new CByteSwap2); }
-static void *CreateCodec4() { return (void *)(ICompressFilter *)(new CByteSwap4); }
-
-static CCodecInfo g_CodecsInfo[] =
-{
- { CreateCodec2, CreateCodec2, 0x020302, L"Swap2", 1, true },
- { CreateCodec4, CreateCodec4, 0x020304, L"Swap4", 1, true }
-};
-
-REGISTER_CODECS(ByteSwap)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CodecExports.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CodecExports.cpp
deleted file mode 100644
index 4ff1c0fcb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CodecExports.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-// CodecExports.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/ComTry.h"
-
-#include "../../Windows/PropVariant.h"
-
-#include "../ICoder.h"
-
-#include "../Common/RegisterCodec.h"
-
-extern unsigned int g_NumCodecs;
-extern const CCodecInfo *g_Codecs[];
-
-static const UInt16 kDecodeId = 0x2790;
-
-DEFINE_GUID(CLSID_CCodec,
-0x23170F69, 0x40C1, kDecodeId, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-static inline HRESULT SetPropString(const char *s, unsigned int size, PROPVARIANT *value)
-{
- if ((value->bstrVal = ::SysAllocStringByteLen(s, size)) != 0)
- value->vt = VT_BSTR;
- return S_OK;
-}
-
-static inline HRESULT SetPropGUID(const GUID &guid, PROPVARIANT *value)
-{
- return SetPropString((const char *)&guid, sizeof(GUID), value);
-}
-
-static HRESULT SetClassID(CMethodId id, bool encode, PROPVARIANT *value)
-{
- GUID clsId = CLSID_CCodec;
- for (int i = 0; i < sizeof(id); i++, id >>= 8)
- clsId.Data4[i] = (Byte)(id & 0xFF);
- if (encode)
- clsId.Data3++;
- return SetPropGUID(clsId, value);
-}
-
-static HRESULT FindCodecClassId(const GUID *clsID, UInt32 isCoder2, bool isFilter, bool &encode, int &index)
-{
- index = -1;
- if (clsID->Data1 != CLSID_CCodec.Data1 ||
- clsID->Data2 != CLSID_CCodec.Data2 ||
- (clsID->Data3 & ~1) != kDecodeId)
- return S_OK;
- encode = (clsID->Data3 != kDecodeId);
- UInt64 id = 0;
- for (int j = 0; j < 8; j++)
- id |= ((UInt64)clsID->Data4[j]) << (8 * j);
- for (unsigned i = 0; i < g_NumCodecs; i++)
- {
- const CCodecInfo &codec = *g_Codecs[i];
- if (id != codec.Id || encode && !codec.CreateEncoder || !encode && !codec.CreateDecoder)
- continue;
- if (!isFilter && codec.IsFilter || isFilter && !codec.IsFilter ||
- codec.NumInStreams != 1 && !isCoder2 || codec.NumInStreams == 1 && isCoder2)
- return E_NOINTERFACE;
- index = i;
- return S_OK;
- }
- return S_OK;
-}
-
-STDAPI CreateCoder2(bool encode, UInt32 index, const GUID *iid, void **outObject)
-{
- COM_TRY_BEGIN
- *outObject = 0;
- bool isCoder = (*iid == IID_ICompressCoder) != 0;
- bool isCoder2 = (*iid == IID_ICompressCoder2) != 0;
- bool isFilter = (*iid == IID_ICompressFilter) != 0;
- const CCodecInfo &codec = *g_Codecs[index];
- if (!isFilter && codec.IsFilter || isFilter && !codec.IsFilter ||
- codec.NumInStreams != 1 && !isCoder2 || codec.NumInStreams == 1 && isCoder2)
- return E_NOINTERFACE;
- if (encode)
- {
- if (!codec.CreateEncoder)
- return CLASS_E_CLASSNOTAVAILABLE;
- *outObject = codec.CreateEncoder();
- }
- else
- {
- if (!codec.CreateDecoder)
- return CLASS_E_CLASSNOTAVAILABLE;
- *outObject = codec.CreateDecoder();
- }
- if (isCoder)
- ((ICompressCoder *)*outObject)->AddRef();
- else if (isCoder2)
- ((ICompressCoder2 *)*outObject)->AddRef();
- else
- ((ICompressFilter *)*outObject)->AddRef();
- return S_OK;
- COM_TRY_END
-}
-
-STDAPI CreateCoder(const GUID *clsid, const GUID *iid, void **outObject)
-{
- *outObject = 0;
- bool isCoder = (*iid == IID_ICompressCoder) != 0;
- bool isCoder2 = (*iid == IID_ICompressCoder2) != 0;
- bool isFilter = (*iid == IID_ICompressFilter) != 0;
- if (!isCoder && !isCoder2 && !isFilter)
- return E_NOINTERFACE;
- bool encode;
- int codecIndex;
- HRESULT res = FindCodecClassId(clsid, isCoder2, isFilter, encode, codecIndex);
- if (res != S_OK)
- return res;
- if (codecIndex < 0)
- return CLASS_E_CLASSNOTAVAILABLE;
- return CreateCoder2(encode, codecIndex, iid, outObject);
-}
-
-STDAPI GetMethodProperty(UInt32 codecIndex, PROPID propID, PROPVARIANT *value)
-{
- ::VariantClear((VARIANTARG *)value);
- const CCodecInfo &codec = *g_Codecs[codecIndex];
- switch(propID)
- {
- case NMethodPropID::kID:
- {
- value->uhVal.QuadPart = (UInt64)codec.Id;
- value->vt = VT_UI8;
- break;
- }
- case NMethodPropID::kName:
- if ((value->bstrVal = ::SysAllocString(codec.Name)) != 0)
- value->vt = VT_BSTR;
- break;
- case NMethodPropID::kDecoder:
- if (codec.CreateDecoder)
- return SetClassID(codec.Id, false, value);
- break;
- case NMethodPropID::kEncoder:
- if (codec.CreateEncoder)
- return SetClassID(codec.Id, true, value);
- break;
- case NMethodPropID::kInStreams:
- {
- if (codec.NumInStreams != 1)
- {
- value->vt = VT_UI4;
- value->ulVal = (ULONG)codec.NumInStreams;
- }
- break;
- }
- }
- return S_OK;
-}
-
-STDAPI GetNumberOfMethods(UINT32 *numCodecs)
-{
- *numCodecs = g_NumCodecs;
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CopyCoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CopyCoder.cpp
deleted file mode 100644
index f71692a77..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CopyCoder.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-// Compress/CopyCoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "../Common/StreamUtils.h"
-
-#include "CopyCoder.h"
-
-namespace NCompress {
-
-static const UInt32 kBufferSize = 1 << 17;
-
-CCopyCoder::~CCopyCoder()
-{
- ::MidFree(_buffer);
-}
-
-STDMETHODIMP CCopyCoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 *outSize,
- ICompressProgressInfo *progress)
-{
- if (_buffer == 0)
- {
- _buffer = (Byte *)::MidAlloc(kBufferSize);
- if (_buffer == 0)
- return E_OUTOFMEMORY;
- }
-
- TotalSize = 0;
- for (;;)
- {
- UInt32 size = kBufferSize;
- if (outSize != 0)
- if (size > *outSize - TotalSize)
- size = (UInt32)(*outSize - TotalSize);
- RINOK(inStream->Read(_buffer, size, &size));
- if (size == 0)
- break;
- if (outStream)
- {
- RINOK(WriteStream(outStream, _buffer, size));
- }
- TotalSize += size;
- if (progress != NULL)
- {
- RINOK(progress->SetRatioInfo(&TotalSize, &TotalSize));
- }
- }
- return S_OK;
-}
-
-STDMETHODIMP CCopyCoder::GetInStreamProcessedSize(UInt64 *value)
-{
- *value = TotalSize;
- return S_OK;
-}
-
-HRESULT CopyStream(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress)
-{
- CMyComPtr<ICompressCoder> copyCoder = new NCompress::CCopyCoder;
- return copyCoder->Code(inStream, outStream, NULL, NULL, progress);
-}
-
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CopyCoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CopyCoder.h
deleted file mode 100644
index 751c7d711..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CopyCoder.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Compress/CopyCoder.h
-
-#ifndef __COMPRESS_COPY_CODER_H
-#define __COMPRESS_COPY_CODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-namespace NCompress {
-
-class CCopyCoder:
- public ICompressCoder,
- public ICompressGetInStreamProcessedSize,
- public CMyUnknownImp
-{
- Byte *_buffer;
-public:
- UInt64 TotalSize;
- CCopyCoder(): _buffer(0), TotalSize(0) {}
- ~CCopyCoder();
-
- MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize)
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
-};
-
-HRESULT CopyStream(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress);
-
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CopyRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CopyRegister.cpp
deleted file mode 100644
index efb9b9e95..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/CopyRegister.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// CopyRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "CopyCoder.h"
-
-static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::CCopyCoder); }
-
-static CCodecInfo g_CodecInfo =
-{ CreateCodec, CreateCodec, 0x00, L"Copy", 1, false };
-
-REGISTER_CODEC(Copy)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Deflate64Register.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Deflate64Register.cpp
deleted file mode 100644
index 509e675a5..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Deflate64Register.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// Deflate64Register.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "DeflateDecoder.h"
-
-static void *CreateCodecDeflate64() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NDecoder::CCOMCoder64); }
-#if !defined(EXTRACT_ONLY) && !defined(DEFLATE_EXTRACT_ONLY)
-#include "DeflateEncoder.h"
-static void *CreateCodecOutDeflate64() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NEncoder::CCOMCoder64); }
-#else
-#define CreateCodecOutDeflate64 0
-#endif
-
-static CCodecInfo g_CodecInfo =
- { CreateCodecDeflate64, CreateCodecOutDeflate64, 0x040109, L"Deflate64", 1, false };
-
-REGISTER_CODEC(Deflate64)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateConst.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateConst.h
deleted file mode 100644
index 9ca9c869b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateConst.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// DeflateConst.h
-
-#ifndef __DEFLATE_CONST_H
-#define __DEFLATE_CONST_H
-
-namespace NCompress {
-namespace NDeflate {
-
-const int kNumHuffmanBits = 15;
-
-const UInt32 kHistorySize32 = (1 << 15);
-const UInt32 kHistorySize64 = (1 << 16);
-
-const UInt32 kDistTableSize32 = 30;
-const UInt32 kDistTableSize64 = 32;
-
-const UInt32 kNumLenSymbols32 = 256;
-const UInt32 kNumLenSymbols64 = 255; // don't change it. It must be <= 255.
-const UInt32 kNumLenSymbolsMax = kNumLenSymbols32;
-
-const UInt32 kNumLenSlots = 29;
-
-const UInt32 kFixedDistTableSize = 32;
-const UInt32 kFixedLenTableSize = 31;
-
-const UInt32 kSymbolEndOfBlock = 0x100;
-const UInt32 kSymbolMatch = kSymbolEndOfBlock + 1;
-
-const UInt32 kMainTableSize = kSymbolMatch + kNumLenSlots;
-const UInt32 kFixedMainTableSize = kSymbolMatch + kFixedLenTableSize;
-
-const UInt32 kLevelTableSize = 19;
-
-const UInt32 kTableDirectLevels = 16;
-const UInt32 kTableLevelRepNumber = kTableDirectLevels;
-const UInt32 kTableLevel0Number = kTableLevelRepNumber + 1;
-const UInt32 kTableLevel0Number2 = kTableLevel0Number + 1;
-
-const UInt32 kLevelMask = 0xF;
-
-const Byte kLenStart32[kFixedLenTableSize] =
- {0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224, 255, 0, 0};
-const Byte kLenStart64[kFixedLenTableSize] =
- {0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224, 0, 0, 0};
-
-const Byte kLenDirectBits32[kFixedLenTableSize] =
- {0,0,0,0,0,0,0,0,1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0};
-const Byte kLenDirectBits64[kFixedLenTableSize] =
- {0,0,0,0,0,0,0,0,1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 16, 0, 0};
-
-const UInt32 kDistStart[kDistTableSize64] =
- {0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,
- 1024,1536,2048,3072,4096,6144,8192,12288,16384,24576,32768,49152};
-const Byte kDistDirectBits[kDistTableSize64] =
- {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14};
-
-const Byte kLevelDirectBits[3] = {2, 3, 7};
-
-const Byte kCodeLengthAlphabetOrder[kLevelTableSize] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
-const UInt32 kMatchMinLen = 3;
-const UInt32 kMatchMaxLen32 = kNumLenSymbols32 + kMatchMinLen - 1; //256 + 2
-const UInt32 kMatchMaxLen64 = kNumLenSymbols64 + kMatchMinLen - 1; //255 + 2
-const UInt32 kMatchMaxLen = kMatchMaxLen32;
-
-const int kFinalBlockFieldSize = 1;
-
-namespace NFinalBlockField
-{
- enum
- {
- kNotFinalBlock = 0,
- kFinalBlock = 1
- };
-}
-
-const int kBlockTypeFieldSize = 2;
-
-namespace NBlockType
-{
- enum
- {
- kStored = 0,
- kFixedHuffman = 1,
- kDynamicHuffman = 2
- };
-}
-
-const int kNumLenCodesFieldSize = 5;
-const int kNumDistCodesFieldSize = 5;
-const int kNumLevelCodesFieldSize = 4;
-
-const UInt32 kNumLitLenCodesMin = 257;
-const UInt32 kNumDistCodesMin = 1;
-const UInt32 kNumLevelCodesMin = 4;
-
-const int kLevelFieldSize = 3;
-
-const int kStoredBlockLengthFieldSize = 16;
-
-struct CLevels
-{
- Byte litLenLevels[kFixedMainTableSize];
- Byte distLevels[kFixedDistTableSize];
-
- void SubClear()
- {
- UInt32 i;
- for(i = kNumLitLenCodesMin; i < kFixedMainTableSize; i++)
- litLenLevels[i] = 0;
- for(i = 0; i < kFixedDistTableSize; i++)
- distLevels[i] = 0;
- }
-
- void SetFixedLevels()
- {
- unsigned int i;
-
- for (i = 0; i < 144; i++)
- litLenLevels[i] = 8;
- for (; i < 256; i++)
- litLenLevels[i] = 9;
- for (; i < 280; i++)
- litLenLevels[i] = 7;
- for (; i < 288; i++)
- litLenLevels[i] = 8;
- for (i = 0; i < kFixedDistTableSize; i++) // test it: InfoZip only uses kDistTableSize
- distLevels[i] = 5;
- }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateDecoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateDecoder.cpp
deleted file mode 100644
index 92d113b26..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateDecoder.cpp
+++ /dev/null
@@ -1,353 +0,0 @@
-// DeflateDecoder.cpp
-
-#include "StdAfx.h"
-
-#include "DeflateDecoder.h"
-
-namespace NCompress {
-namespace NDeflate {
-namespace NDecoder {
-
-static const int kLenIdFinished = -1;
-static const int kLenIdNeedInit = -2;
-
-CCoder::CCoder(bool deflate64Mode, bool deflateNSIS):
- _deflateNSIS(deflateNSIS),
- _deflate64Mode(deflate64Mode),
- _keepHistory(false),
- _needInitInStream(true),
- ZlibMode(false) {}
-
-UInt32 CCoder::ReadBits(int numBits)
-{
- return m_InBitStream.ReadBits(numBits);
-}
-
-bool CCoder::DeCodeLevelTable(Byte *values, int numSymbols)
-{
- int i = 0;
- do
- {
- UInt32 number = m_LevelDecoder.DecodeSymbol(&m_InBitStream);
- if (number < kTableDirectLevels)
- values[i++] = (Byte)number;
- else if (number < kLevelTableSize)
- {
- if (number == kTableLevelRepNumber)
- {
- if (i == 0)
- return false;
- int num = ReadBits(2) + 3;
- for (; num > 0 && i < numSymbols; num--, i++)
- values[i] = values[i - 1];
- }
- else
- {
- int num;
- if (number == kTableLevel0Number)
- num = ReadBits(3) + 3;
- else
- num = ReadBits(7) + 11;
- for (;num > 0 && i < numSymbols; num--)
- values[i++] = 0;
- }
- }
- else
- return false;
- }
- while(i < numSymbols);
- return true;
-}
-
-#define RIF(x) { if (!(x)) return false; }
-
-bool CCoder::ReadTables(void)
-{
- m_FinalBlock = (ReadBits(kFinalBlockFieldSize) == NFinalBlockField::kFinalBlock);
- UInt32 blockType = ReadBits(kBlockTypeFieldSize);
- if (blockType > NBlockType::kDynamicHuffman)
- return false;
-
- if (blockType == NBlockType::kStored)
- {
- m_StoredMode = true;
- m_InBitStream.AlignToByte();
- m_StoredBlockSize = ReadBits(kStoredBlockLengthFieldSize);
- if (_deflateNSIS)
- return true;
- return (m_StoredBlockSize == (UInt16)~ReadBits(kStoredBlockLengthFieldSize));
- }
-
- m_StoredMode = false;
-
- CLevels levels;
- if (blockType == NBlockType::kFixedHuffman)
- {
- levels.SetFixedLevels();
- _numDistLevels = _deflate64Mode ? kDistTableSize64 : kDistTableSize32;
- }
- else
- {
- int numLitLenLevels = ReadBits(kNumLenCodesFieldSize) + kNumLitLenCodesMin;
- _numDistLevels = ReadBits(kNumDistCodesFieldSize) + kNumDistCodesMin;
- int numLevelCodes = ReadBits(kNumLevelCodesFieldSize) + kNumLevelCodesMin;
-
- if (!_deflate64Mode)
- if (_numDistLevels > kDistTableSize32)
- return false;
-
- Byte levelLevels[kLevelTableSize];
- for (int i = 0; i < static_cast< int >( kLevelTableSize ); i++)
- {
- int position = kCodeLengthAlphabetOrder[i];
- if(i < numLevelCodes)
- levelLevels[position] = (Byte)ReadBits(kLevelFieldSize);
- else
- levelLevels[position] = 0;
- }
-
- RIF(m_LevelDecoder.SetCodeLengths(levelLevels));
-
- Byte tmpLevels[kFixedMainTableSize + kFixedDistTableSize];
- if (!DeCodeLevelTable(tmpLevels, numLitLenLevels + _numDistLevels))
- return false;
-
- levels.SubClear();
- memcpy(levels.litLenLevels, tmpLevels, numLitLenLevels);
- memcpy(levels.distLevels, tmpLevels + numLitLenLevels, _numDistLevels);
- }
- RIF(m_MainDecoder.SetCodeLengths(levels.litLenLevels));
- return m_DistDecoder.SetCodeLengths(levels.distLevels);
-}
-
-HRESULT CCoder::CodeSpec(UInt32 curSize)
-{
- if (_remainLen == kLenIdFinished)
- return S_OK;
- if (_remainLen == kLenIdNeedInit)
- {
- if (!_keepHistory)
- if (!m_OutWindowStream.Create(_deflate64Mode ? kHistorySize64: kHistorySize32))
- return E_OUTOFMEMORY;
- RINOK(InitInStream(_needInitInStream));
- m_OutWindowStream.Init(_keepHistory);
- m_FinalBlock = false;
- _remainLen = 0;
- _needReadTable = true;
- }
-
- if (curSize == 0)
- return S_OK;
-
- while(_remainLen > 0 && curSize > 0)
- {
- _remainLen--;
- Byte b = m_OutWindowStream.GetByte(_rep0);
- m_OutWindowStream.PutByte(b);
- curSize--;
- }
-
- while(curSize > 0)
- {
- if (_needReadTable)
- {
- if (m_FinalBlock)
- {
- _remainLen = kLenIdFinished;
- break;
- }
- if (!ReadTables())
- return S_FALSE;
- _needReadTable = false;
- }
-
- if(m_StoredMode)
- {
- for (; m_StoredBlockSize > 0 && curSize > 0; m_StoredBlockSize--, curSize--)
- m_OutWindowStream.PutByte(m_InBitStream.ReadByte());
- _needReadTable = (m_StoredBlockSize == 0);
- continue;
- }
- while(curSize > 0)
- {
- if (m_InBitStream.NumExtraBytes > 4)
- return S_FALSE;
-
- UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream);
- if (number < 0x100)
- {
- m_OutWindowStream.PutByte((Byte)number);
- curSize--;
- continue;
- }
- else if (number == kSymbolEndOfBlock)
- {
- _needReadTable = true;
- break;
- }
- else if (number < kMainTableSize)
- {
- number -= kSymbolMatch;
- UInt32 len;
- {
- int numBits;
- if (_deflate64Mode)
- {
- len = kLenStart64[number];
- numBits = kLenDirectBits64[number];
- }
- else
- {
- len = kLenStart32[number];
- numBits = kLenDirectBits32[number];
- }
- len += kMatchMinLen + m_InBitStream.ReadBits(numBits);
- }
- UInt32 locLen = len;
- if (locLen > curSize)
- locLen = (UInt32)curSize;
- number = m_DistDecoder.DecodeSymbol(&m_InBitStream);
- if (number >= _numDistLevels)
- return S_FALSE;
- UInt32 distance = kDistStart[number] + m_InBitStream.ReadBits(kDistDirectBits[number]);
- if (!m_OutWindowStream.CopyBlock(distance, locLen))
- return S_FALSE;
- curSize -= locLen;
- len -= locLen;
- if (len != 0)
- {
- _remainLen = (Int32)len;
- _rep0 = distance;
- break;
- }
- }
- else
- return S_FALSE;
- }
- }
- return S_OK;
-}
-
-#ifdef _NO_EXCEPTIONS
-
-#define DEFLATE_TRY_BEGIN
-#define DEFLATE_TRY_END
-
-#else
-
-#define DEFLATE_TRY_BEGIN try {
-#define DEFLATE_TRY_END } \
- catch(const CInBufferException &e) { return e.ErrorCode; } \
- catch(const CLzOutWindowException &e) { return e.ErrorCode; } \
- catch(...) { return S_FALSE; }
-
-#endif
-
-HRESULT CCoder::CodeReal(ISequentialOutStream *outStream,
- const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- DEFLATE_TRY_BEGIN
- m_OutWindowStream.SetStream(outStream);
- CCoderReleaser flusher(this);
-
- const UInt64 inStart = m_InBitStream.GetProcessedSize();
- const UInt64 start = m_OutWindowStream.GetProcessedSize();
- for (;;)
- {
- UInt32 curSize = 1 << 18;
- if (outSize != 0)
- {
- const UInt64 rem = *outSize - (m_OutWindowStream.GetProcessedSize() - start);
- if (curSize > rem)
- curSize = (UInt32)rem;
- }
- if (curSize == 0)
- break;
- RINOK(CodeSpec(curSize));
- if (_remainLen == kLenIdFinished)
- break;
- if (progress != NULL)
- {
- const UInt64 inSize = m_InBitStream.GetProcessedSize() - inStart;
- const UInt64 nowPos64 = m_OutWindowStream.GetProcessedSize() - start;
- RINOK(progress->SetRatioInfo(&inSize, &nowPos64));
- }
- }
- if (_remainLen == kLenIdFinished && ZlibMode)
- {
- m_InBitStream.AlignToByte();
- for (int i = 0; i < 4; i++)
- ZlibFooter[i] = m_InBitStream.ReadByte();
- }
- flusher.NeedFlush = false;
- HRESULT res = Flush();
- if (res == S_OK && InputEofError())
- return S_FALSE;
- return res;
- DEFLATE_TRY_END
-}
-
-HRESULT CCoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- SetInStream(inStream);
- SetOutStreamSize(outSize);
- HRESULT res = CodeReal(outStream, outSize, progress);
- ReleaseInStream();
- return res;
-}
-
-STDMETHODIMP CCoder::GetInStreamProcessedSize(UInt64 *value)
-{
- if (value == NULL)
- return E_INVALIDARG;
- *value = m_InBitStream.GetProcessedSize();
- return S_OK;
-}
-
-STDMETHODIMP CCoder::SetInStream(ISequentialInStream *inStream)
-{
- m_InBitStream.SetStream(inStream);
- return S_OK;
-}
-
-STDMETHODIMP CCoder::ReleaseInStream()
-{
- m_InBitStream.ReleaseStream();
- return S_OK;
-}
-
-STDMETHODIMP CCoder::SetOutStreamSize(const UInt64 * /* outSize */)
-{
- _remainLen = kLenIdNeedInit;
- _needInitInStream = true;
- m_OutWindowStream.Init(_keepHistory);
- return S_OK;
-}
-
-#ifndef NO_READ_FROM_CODER
-
-STDMETHODIMP CCoder::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- DEFLATE_TRY_BEGIN
- if (processedSize)
- *processedSize = 0;
- const UInt64 startPos = m_OutWindowStream.GetProcessedSize();
- m_OutWindowStream.SetMemStream((Byte *)data);
- RINOK(CodeSpec(size));
- if (processedSize)
- *processedSize = (UInt32)(m_OutWindowStream.GetProcessedSize() - startPos);
- return Flush();
- DEFLATE_TRY_END
-}
-
-#endif
-
-STDMETHODIMP CCoder::CodeResume(ISequentialOutStream *outStream, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- _remainLen = kLenIdNeedInit;
- m_OutWindowStream.Init(_keepHistory);
- return CodeReal(outStream, outSize, progress);
-}
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateDecoder.h
deleted file mode 100644
index 56ab2bea2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateDecoder.h
+++ /dev/null
@@ -1,157 +0,0 @@
-// DeflateDecoder.h
-
-#ifndef __DEFLATE_DECODER_H
-#define __DEFLATE_DECODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "../Common/InBuffer.h"
-
-#include "BitlDecoder.h"
-#include "DeflateConst.h"
-#include "HuffmanDecoder.h"
-#include "LzOutWindow.h"
-
-namespace NCompress {
-namespace NDeflate {
-namespace NDecoder {
-
-class CCoder:
- public ICompressCoder,
- public ICompressGetInStreamProcessedSize,
- #ifndef NO_READ_FROM_CODER
- public ICompressSetInStream,
- public ICompressSetOutStreamSize,
- public ISequentialInStream,
- #endif
- public CMyUnknownImp
-{
- CLzOutWindow m_OutWindowStream;
- NBitl::CDecoder<CInBuffer> m_InBitStream;
- NCompress::NHuffman::CDecoder<kNumHuffmanBits, kFixedMainTableSize> m_MainDecoder;
- NCompress::NHuffman::CDecoder<kNumHuffmanBits, kFixedDistTableSize> m_DistDecoder;
- NCompress::NHuffman::CDecoder<kNumHuffmanBits, kLevelTableSize> m_LevelDecoder;
-
- UInt32 m_StoredBlockSize;
-
- bool m_FinalBlock;
- bool m_StoredMode;
- UInt32 _numDistLevels;
-
-
- bool _deflateNSIS;
- bool _deflate64Mode;
- bool _keepHistory;
- bool _needInitInStream;
- Int32 _remainLen;
- UInt32 _rep0;
- bool _needReadTable;
-
- UInt32 ReadBits(int numBits);
-
- bool DeCodeLevelTable(Byte *values, int numSymbols);
- bool ReadTables();
-
- HRESULT Flush() { return m_OutWindowStream.Flush(); }
- class CCoderReleaser
- {
- CCoder *_coder;
- public:
- bool NeedFlush;
- CCoderReleaser(CCoder *coder): _coder(coder), NeedFlush(true) {}
- ~CCoderReleaser()
- {
- if (NeedFlush)
- _coder->Flush();
- _coder->ReleaseOutStream();
- }
- };
- friend class CCoderReleaser;
-
- HRESULT CodeSpec(UInt32 curSize);
-public:
- bool ZlibMode;
- Byte ZlibFooter[4];
-
- CCoder(bool deflate64Mode, bool deflateNSIS = false);
- virtual ~CCoder() {};
-
- void SetKeepHistory(bool keepHistory) { _keepHistory = keepHistory; }
-
- void ReleaseOutStream()
- {
- m_OutWindowStream.ReleaseStream();
- }
-
- HRESULT CodeReal(ISequentialOutStream *outStream,
- const UInt64 *outSize, ICompressProgressInfo *progress);
-
- #ifndef NO_READ_FROM_CODER
- MY_UNKNOWN_IMP4(
- ICompressGetInStreamProcessedSize,
- ICompressSetInStream,
- ICompressSetOutStreamSize,
- ISequentialInStream
- )
- #else
- MY_UNKNOWN_IMP1(
- ICompressGetInStreamProcessedSize)
- #endif
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(SetInStream)(ISequentialInStream *inStream);
- STDMETHOD(ReleaseInStream)();
- STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
-
- #ifndef NO_READ_FROM_CODER
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- #endif
-
- STDMETHOD(CodeResume)(ISequentialOutStream *outStream, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- HRESULT InitInStream(bool needInit)
- {
- if (!m_InBitStream.Create(1 << 17))
- return E_OUTOFMEMORY;
- if (needInit)
- {
- m_InBitStream.Init();
- _needInitInStream = false;
- }
- return S_OK;
- }
-
- void AlignToByte() { m_InBitStream.AlignToByte(); }
- Byte ReadByte() { return (Byte)m_InBitStream.ReadBits(8); }
- bool InputEofError() const { return m_InBitStream.ExtraBitsWereRead(); }
- UInt64 GetInputProcessedSize() const { return m_InBitStream.GetProcessedSize(); }
-
- // IGetInStreamProcessedSize
- STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
-};
-
-class CCOMCoder : public CCoder
-{
-public:
- CCOMCoder(): CCoder(false) {}
-};
-
-class CNsisCOMCoder : public CCoder
-{
-public:
- CNsisCOMCoder(): CCoder(false, true) {}
-};
-
-class CCOMCoder64 : public CCoder
-{
-public:
- CCOMCoder64(): CCoder(true) {}
-};
-
-}}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateEncoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateEncoder.cpp
deleted file mode 100644
index 4d040259d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateEncoder.cpp
+++ /dev/null
@@ -1,984 +0,0 @@
-// DeflateEncoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-#include "../../../C/HuffEnc.h"
-
-#include "Common/ComTry.h"
-
-#include "DeflateEncoder.h"
-
-#if _MSC_VER >= 1300
-#define NO_INLINE __declspec(noinline)
-#else
-#define NO_INLINE
-#endif
-
-namespace NCompress {
-namespace NDeflate {
-namespace NEncoder {
-
-const int kNumDivPassesMax = 10; // [0, 16); ratio/speed/ram tradeoff; use big value for better compression ratio.
-const UInt32 kNumTables = (1 << kNumDivPassesMax);
-
-static UInt32 kFixedHuffmanCodeBlockSizeMax = (1 << 8); // [0, (1 << 32)); ratio/speed tradeoff; use big value for better compression ratio.
-static UInt32 kDivideCodeBlockSizeMin = (1 << 7); // [1, (1 << 32)); ratio/speed tradeoff; use small value for better compression ratio.
-static UInt32 kDivideBlockSizeMin = (1 << 6); // [1, (1 << 32)); ratio/speed tradeoff; use small value for better compression ratio.
-
-static const UInt32 kMaxUncompressedBlockSize = ((1 << 16) - 1) * 1; // [1, (1 << 32))
-static const UInt32 kMatchArraySize = kMaxUncompressedBlockSize * 10; // [kMatchMaxLen * 2, (1 << 32))
-static const UInt32 kMatchArrayLimit = kMatchArraySize - kMatchMaxLen * 4 * sizeof(UInt16);
-static const UInt32 kBlockUncompressedSizeThreshold = kMaxUncompressedBlockSize -
- kMatchMaxLen - kNumOpts;
-
-static const int kMaxCodeBitLength = 11;
-static const int kMaxLevelBitLength = 7;
-
-static Byte kNoLiteralStatPrice = 11;
-static Byte kNoLenStatPrice = 11;
-static Byte kNoPosStatPrice = 6;
-
-static Byte g_LenSlots[kNumLenSymbolsMax];
-static Byte g_FastPos[1 << 9];
-
-class CFastPosInit
-{
-public:
- CFastPosInit()
- {
- unsigned int i;
- for(i = 0; i < kNumLenSlots; i++)
- {
- int c = kLenStart32[i];
- int j = 1 << kLenDirectBits32[i];
- for(int k = 0; k < j; k++, c++)
- g_LenSlots[c] = (Byte)i;
- }
-
- const int kFastSlots = 18;
- int c = 0;
- for (Byte slotFast = 0; slotFast < kFastSlots; slotFast++)
- {
- UInt32 k = (1 << kDistDirectBits[slotFast]);
- for (UInt32 j = 0; j < k; j++, c++)
- g_FastPos[c] = slotFast;
- }
- }
-};
-
-static CFastPosInit g_FastPosInit;
-
-
-inline UInt32 GetPosSlot(UInt32 pos)
-{
- if (pos < 0x200)
- return g_FastPos[pos];
- return g_FastPos[pos >> 8] + 16;
-}
-
-static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
-static void SzFree(void *p, void *address) { p = p; MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-CCoder::CCoder(bool deflate64Mode):
- m_Values(0),
- m_NumFastBytes(32),
- _fastMode(false),
- _btMode(true),
- m_OnePosMatchesMemory(0),
- m_DistanceMemory(0),
- m_NumPasses(1),
- m_NumDivPasses(1),
- m_Created(false),
- m_Deflate64Mode(deflate64Mode),
- m_Tables(0),
- m_MatchFinderCycles(0)
- // m_SetMfPasses(0)
-{
- m_MatchMaxLen = deflate64Mode ? kMatchMaxLen64 : kMatchMaxLen32;
- m_NumLenCombinations = deflate64Mode ? kNumLenSymbols64 : kNumLenSymbols32;
- m_LenStart = deflate64Mode ? kLenStart64 : kLenStart32;
- m_LenDirectBits = deflate64Mode ? kLenDirectBits64 : kLenDirectBits32;
- MatchFinder_Construct(&_lzInWindow);
-}
-
-HRESULT CCoder::Create()
-{
- COM_TRY_BEGIN
- if (m_Values == 0)
- {
- m_Values = (CCodeValue *)MyAlloc((kMaxUncompressedBlockSize) * sizeof(CCodeValue));
- if (m_Values == 0)
- return E_OUTOFMEMORY;
- }
- if (m_Tables == 0)
- {
- m_Tables = (CTables *)MyAlloc((kNumTables) * sizeof(CTables));
- if (m_Tables == 0)
- return E_OUTOFMEMORY;
- }
-
- if (m_IsMultiPass)
- {
- if (m_OnePosMatchesMemory == 0)
- {
- m_OnePosMatchesMemory = (UInt16 *)::MidAlloc(kMatchArraySize * sizeof(UInt16));
- if (m_OnePosMatchesMemory == 0)
- return E_OUTOFMEMORY;
- }
- }
- else
- {
- if (m_DistanceMemory == 0)
- {
- m_DistanceMemory = (UInt16 *)MyAlloc((kMatchMaxLen + 2) * 2 * sizeof(UInt16));
- if (m_DistanceMemory == 0)
- return E_OUTOFMEMORY;
- m_MatchDistances = m_DistanceMemory;
- }
- }
-
- if (!m_Created)
- {
- _lzInWindow.btMode = _btMode ? 1 : 0;
- _lzInWindow.numHashBytes = 3;
- if (!MatchFinder_Create(&_lzInWindow,
- m_Deflate64Mode ? kHistorySize64 : kHistorySize32,
- kNumOpts + kMaxUncompressedBlockSize,
- m_NumFastBytes, m_MatchMaxLen - m_NumFastBytes, &g_Alloc))
- return E_OUTOFMEMORY;
- if (!m_OutStream.Create(1 << 20))
- return E_OUTOFMEMORY;
- }
- if (m_MatchFinderCycles != 0)
- _lzInWindow.cutValue = m_MatchFinderCycles;
- m_Created = true;
- return S_OK;
- COM_TRY_END
-}
-
-HRESULT CCoder::BaseSetEncoderProperties2(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
-{
- for (UInt32 i = 0; i < numProps; i++)
- {
- const PROPVARIANT &prop = props[i];
- switch(propIDs[i])
- {
- case NCoderPropID::kNumPasses:
- if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- m_NumDivPasses = prop.ulVal;
- if (m_NumDivPasses == 0)
- m_NumDivPasses = 1;
- if (m_NumDivPasses == 1)
- m_NumPasses = 1;
- else if (m_NumDivPasses <= kNumDivPassesMax)
- m_NumPasses = 2;
- else
- {
- m_NumPasses = 2 + (m_NumDivPasses - kNumDivPassesMax);
- m_NumDivPasses = kNumDivPassesMax;
- }
- break;
- case NCoderPropID::kNumFastBytes:
- if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- m_NumFastBytes = prop.ulVal;
- if(m_NumFastBytes < kMatchMinLen || m_NumFastBytes > m_MatchMaxLen)
- return E_INVALIDARG;
- break;
- case NCoderPropID::kMatchFinderCycles:
- {
- if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- m_MatchFinderCycles = prop.ulVal;
- break;
- }
- case NCoderPropID::kAlgorithm:
- {
- if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- UInt32 maximize = prop.ulVal;
- _fastMode = (maximize == 0);
- _btMode = !_fastMode;
- break;
- }
- default:
- return E_INVALIDARG;
- }
- }
- return S_OK;
-}
-
-void CCoder::Free()
-{
- ::MidFree(m_OnePosMatchesMemory); m_OnePosMatchesMemory = 0;
- ::MyFree(m_DistanceMemory); m_DistanceMemory = 0;
- ::MyFree(m_Values); m_Values = 0;
- ::MyFree(m_Tables); m_Tables = 0;
-}
-
-CCoder::~CCoder()
-{
- Free();
- MatchFinder_Free(&_lzInWindow, &g_Alloc);
-}
-
-NO_INLINE void CCoder::GetMatches()
-{
- if (m_IsMultiPass)
- {
- m_MatchDistances = m_OnePosMatchesMemory + m_Pos;
- if (m_SecondPass)
- {
- m_Pos += *m_MatchDistances + 1;
- return;
- }
- }
-
- UInt32 distanceTmp[kMatchMaxLen * 2 + 3];
-
- UInt32 numPairs = (_btMode) ?
- Bt3Zip_MatchFinder_GetMatches(&_lzInWindow, distanceTmp):
- Hc3Zip_MatchFinder_GetMatches(&_lzInWindow, distanceTmp);
-
- *m_MatchDistances = (UInt16)numPairs;
-
- if (numPairs > 0)
- {
- UInt32 i;
- for(i = 0; i < numPairs; i += 2)
- {
- m_MatchDistances[i + 1] = (UInt16)distanceTmp[i];
- m_MatchDistances[i + 2] = (UInt16)distanceTmp[i + 1];
- }
- UInt32 len = distanceTmp[numPairs - 2];
- if (len == m_NumFastBytes && m_NumFastBytes != m_MatchMaxLen)
- {
- UInt32 numAvail = Inline_MatchFinder_GetNumAvailableBytes(&_lzInWindow) + 1;
- const Byte *pby = Inline_MatchFinder_GetPointerToCurrentPos(&_lzInWindow) - 1;
- const Byte *pby2 = pby - (distanceTmp[numPairs - 1] + 1);
- if (numAvail > m_MatchMaxLen)
- numAvail = m_MatchMaxLen;
- for (; len < numAvail && pby[len] == pby2[len]; len++);
- m_MatchDistances[i - 1] = (UInt16)len;
- }
- }
- if (m_IsMultiPass)
- m_Pos += numPairs + 1;
- if (!m_SecondPass)
- m_AdditionalOffset++;
-}
-
-void CCoder::MovePos(UInt32 num)
-{
- if (!m_SecondPass && num > 0)
- {
- if (_btMode)
- Bt3Zip_MatchFinder_Skip(&_lzInWindow, num);
- else
- Hc3Zip_MatchFinder_Skip(&_lzInWindow, num);
- m_AdditionalOffset += num;
- }
-}
-
-static const UInt32 kIfinityPrice = 0xFFFFFFF;
-
-NO_INLINE UInt32 CCoder::Backward(UInt32 &backRes, UInt32 cur)
-{
- m_OptimumEndIndex = cur;
- UInt32 posMem = m_Optimum[cur].PosPrev;
- UInt16 backMem = m_Optimum[cur].BackPrev;
- do
- {
- UInt32 posPrev = posMem;
- UInt16 backCur = backMem;
- backMem = m_Optimum[posPrev].BackPrev;
- posMem = m_Optimum[posPrev].PosPrev;
- m_Optimum[posPrev].BackPrev = backCur;
- m_Optimum[posPrev].PosPrev = (UInt16)cur;
- cur = posPrev;
- }
- while(cur > 0);
- backRes = m_Optimum[0].BackPrev;
- m_OptimumCurrentIndex = m_Optimum[0].PosPrev;
- return m_OptimumCurrentIndex;
-}
-
-NO_INLINE UInt32 CCoder::GetOptimal(UInt32 &backRes)
-{
- if(m_OptimumEndIndex != m_OptimumCurrentIndex)
- {
- UInt32 len = m_Optimum[m_OptimumCurrentIndex].PosPrev - m_OptimumCurrentIndex;
- backRes = m_Optimum[m_OptimumCurrentIndex].BackPrev;
- m_OptimumCurrentIndex = m_Optimum[m_OptimumCurrentIndex].PosPrev;
- return len;
- }
- m_OptimumCurrentIndex = m_OptimumEndIndex = 0;
-
- GetMatches();
-
- UInt32 numDistancePairs = m_MatchDistances[0];
- if(numDistancePairs == 0)
- return 1;
-
- const UInt16 *matchDistances = m_MatchDistances + 1;
- UInt32 lenMain = matchDistances[numDistancePairs - 2];
-
- if(lenMain > m_NumFastBytes)
- {
- backRes = matchDistances[numDistancePairs - 1];
- MovePos(lenMain - 1);
- return lenMain;
- }
- m_Optimum[1].Price = m_LiteralPrices[Inline_MatchFinder_GetIndexByte(&_lzInWindow, 0 - m_AdditionalOffset)];
- m_Optimum[1].PosPrev = 0;
-
- m_Optimum[2].Price = kIfinityPrice;
- m_Optimum[2].PosPrev = 1;
-
-
- UInt32 offs = 0;
- for(UInt32 i = kMatchMinLen; i <= lenMain; i++)
- {
- UInt32 distance = matchDistances[offs + 1];
- m_Optimum[i].PosPrev = 0;
- m_Optimum[i].BackPrev = (UInt16)distance;
- m_Optimum[i].Price = m_LenPrices[i - kMatchMinLen] + m_PosPrices[GetPosSlot(distance)];
- if (i == matchDistances[offs])
- offs += 2;
- }
-
- UInt32 cur = 0;
- UInt32 lenEnd = lenMain;
- for (;;)
- {
- ++cur;
- if(cur == lenEnd || cur == kNumOptsBase || m_Pos >= kMatchArrayLimit)
- return Backward(backRes, cur);
- GetMatches();
- matchDistances = m_MatchDistances + 1;
-
- UInt32 numDistancePairs = m_MatchDistances[0];
- UInt32 newLen = 0;
- if(numDistancePairs != 0)
- {
- newLen = matchDistances[numDistancePairs - 2];
- if(newLen > m_NumFastBytes)
- {
- UInt32 len = Backward(backRes, cur);
- m_Optimum[cur].BackPrev = matchDistances[numDistancePairs - 1];
- m_OptimumEndIndex = cur + newLen;
- m_Optimum[cur].PosPrev = (UInt16)m_OptimumEndIndex;
- MovePos(newLen - 1);
- return len;
- }
- }
- UInt32 curPrice = m_Optimum[cur].Price;
- UInt32 curAnd1Price = curPrice + m_LiteralPrices[Inline_MatchFinder_GetIndexByte(&_lzInWindow, cur - m_AdditionalOffset)];
- COptimal &optimum = m_Optimum[cur + 1];
- if (curAnd1Price < optimum.Price)
- {
- optimum.Price = curAnd1Price;
- optimum.PosPrev = (UInt16)cur;
- }
- if(numDistancePairs == 0)
- continue;
- while(lenEnd < cur + newLen)
- m_Optimum[++lenEnd].Price = kIfinityPrice;
- offs = 0;
- UInt32 distance = matchDistances[offs + 1];
- curPrice += m_PosPrices[GetPosSlot(distance)];
- for(UInt32 lenTest = kMatchMinLen; ; lenTest++)
- {
- UInt32 curAndLenPrice = curPrice + m_LenPrices[lenTest - kMatchMinLen];
- COptimal &optimum = m_Optimum[cur + lenTest];
- if (curAndLenPrice < optimum.Price)
- {
- optimum.Price = curAndLenPrice;
- optimum.PosPrev = (UInt16)cur;
- optimum.BackPrev = (UInt16)distance;
- }
- if (lenTest == matchDistances[offs])
- {
- offs += 2;
- if (offs == numDistancePairs)
- break;
- curPrice -= m_PosPrices[GetPosSlot(distance)];
- distance = matchDistances[offs + 1];
- curPrice += m_PosPrices[GetPosSlot(distance)];
- }
- }
- }
-}
-
-UInt32 CCoder::GetOptimalFast(UInt32 &backRes)
-{
- GetMatches();
- UInt32 numDistancePairs = m_MatchDistances[0];
- if (numDistancePairs == 0)
- return 1;
- UInt32 lenMain = m_MatchDistances[numDistancePairs - 1];
- backRes = m_MatchDistances[numDistancePairs];
- MovePos(lenMain - 1);
- return lenMain;
-}
-
-void CTables::InitStructures()
-{
- UInt32 i;
- for(i = 0; i < 256; i++)
- litLenLevels[i] = 8;
- litLenLevels[i++] = 13;
- for(;i < kFixedMainTableSize; i++)
- litLenLevels[i] = 5;
- for(i = 0; i < kFixedDistTableSize; i++)
- distLevels[i] = 5;
-}
-
-NO_INLINE void CCoder::LevelTableDummy(const Byte *levels, int numLevels, UInt32 *freqs)
-{
- int prevLen = 0xFF;
- int nextLen = levels[0];
- int count = 0;
- int maxCount = 7;
- int minCount = 4;
- if (nextLen == 0)
- {
- maxCount = 138;
- minCount = 3;
- }
- for (int n = 0; n < numLevels; n++)
- {
- int curLen = nextLen;
- nextLen = (n < numLevels - 1) ? levels[n + 1] : 0xFF;
- count++;
- if (count < maxCount && curLen == nextLen)
- continue;
-
- if (count < minCount)
- freqs[curLen] += (UInt32)count;
- else if (curLen != 0)
- {
- if (curLen != prevLen)
- {
- freqs[curLen]++;
- count--;
- }
- freqs[kTableLevelRepNumber]++;
- }
- else if (count <= 10)
- freqs[kTableLevel0Number]++;
- else
- freqs[kTableLevel0Number2]++;
-
- count = 0;
- prevLen = curLen;
-
- if (nextLen == 0)
- {
- maxCount = 138;
- minCount = 3;
- }
- else if (curLen == nextLen)
- {
- maxCount = 6;
- minCount = 3;
- }
- else
- {
- maxCount = 7;
- minCount = 4;
- }
- }
-}
-
-NO_INLINE void CCoder::WriteBits(UInt32 value, int numBits)
-{
- m_OutStream.WriteBits(value, numBits);
-}
-
-#define WRITE_HF2(codes, lens, i) m_OutStream.WriteBits(codes[i], lens[i])
-#define WRITE_HF(i) WriteBits(codes[i], lens[i])
-
-NO_INLINE void CCoder::LevelTableCode(const Byte *levels, int numLevels, const Byte *lens, const UInt32 *codes)
-{
- int prevLen = 0xFF;
- int nextLen = levels[0];
- int count = 0;
- int maxCount = 7;
- int minCount = 4;
- if (nextLen == 0)
- {
- maxCount = 138;
- minCount = 3;
- }
- for (int n = 0; n < numLevels; n++)
- {
- int curLen = nextLen;
- nextLen = (n < numLevels - 1) ? levels[n + 1] : 0xFF;
- count++;
- if (count < maxCount && curLen == nextLen)
- continue;
-
- if (count < minCount)
- for(int i = 0; i < count; i++)
- WRITE_HF(curLen);
- else if (curLen != 0)
- {
- if (curLen != prevLen)
- {
- WRITE_HF(curLen);
- count--;
- }
- WRITE_HF(kTableLevelRepNumber);
- WriteBits(count - 3, 2);
- }
- else if (count <= 10)
- {
- WRITE_HF(kTableLevel0Number);
- WriteBits(count - 3, 3);
- }
- else
- {
- WRITE_HF(kTableLevel0Number2);
- WriteBits(count - 11, 7);
- }
-
- count = 0;
- prevLen = curLen;
-
- if (nextLen == 0)
- {
- maxCount = 138;
- minCount = 3;
- }
- else if (curLen == nextLen)
- {
- maxCount = 6;
- minCount = 3;
- }
- else
- {
- maxCount = 7;
- minCount = 4;
- }
- }
-}
-
-NO_INLINE void CCoder::MakeTables(unsigned maxHuffLen)
-{
- Huffman_Generate(mainFreqs, mainCodes, m_NewLevels.litLenLevels, kFixedMainTableSize, maxHuffLen);
- Huffman_Generate(distFreqs, distCodes, m_NewLevels.distLevels, kDistTableSize64, maxHuffLen);
-}
-
-NO_INLINE UInt32 Huffman_GetPrice(const UInt32 *freqs, const Byte *lens, UInt32 num)
-{
- UInt32 price = 0;
- UInt32 i;
- for (i = 0; i < num; i++)
- price += lens[i] * freqs[i];
- return price;
-};
-
-NO_INLINE UInt32 Huffman_GetPrice_Spec(const UInt32 *freqs, const Byte *lens, UInt32 num, const Byte *extraBits, UInt32 extraBase)
-{
- return Huffman_GetPrice(freqs, lens, num) +
- Huffman_GetPrice(freqs + extraBase, extraBits, num - extraBase);
-}
-
-NO_INLINE UInt32 CCoder::GetLzBlockPrice() const
-{
- return
- Huffman_GetPrice_Spec(mainFreqs, m_NewLevels.litLenLevels, kFixedMainTableSize, m_LenDirectBits, kSymbolMatch) +
- Huffman_GetPrice_Spec(distFreqs, m_NewLevels.distLevels, kDistTableSize64, kDistDirectBits, 0);
-}
-
-NO_INLINE void CCoder::TryBlock()
-{
- memset(mainFreqs, 0, sizeof(mainFreqs));
- memset(distFreqs, 0, sizeof(distFreqs));
-
- m_ValueIndex = 0;
- UInt32 blockSize = BlockSizeRes;
- BlockSizeRes = 0;
- for (;;)
- {
- if (m_OptimumCurrentIndex == m_OptimumEndIndex)
- {
- if (m_Pos >= kMatchArrayLimit || BlockSizeRes >= blockSize || (!m_SecondPass &&
- ((Inline_MatchFinder_GetNumAvailableBytes(&_lzInWindow) == 0) || m_ValueIndex >= m_ValueBlockSize)))
- break;
- }
- UInt32 pos;
- UInt32 len;
- if (_fastMode)
- len = GetOptimalFast(pos);
- else
- len = GetOptimal(pos);
- CCodeValue &codeValue = m_Values[m_ValueIndex++];
- if (len >= kMatchMinLen)
- {
- UInt32 newLen = len - kMatchMinLen;
- codeValue.Len = (UInt16)newLen;
- mainFreqs[kSymbolMatch + g_LenSlots[newLen]]++;
- codeValue.Pos = (UInt16)pos;
- distFreqs[GetPosSlot(pos)]++;
- }
- else
- {
- Byte b = Inline_MatchFinder_GetIndexByte(&_lzInWindow, 0 - m_AdditionalOffset);
- mainFreqs[b]++;
- codeValue.SetAsLiteral();
- codeValue.Pos = b;
- }
- m_AdditionalOffset -= len;
- BlockSizeRes += len;
- }
- mainFreqs[kSymbolEndOfBlock]++;
- m_AdditionalOffset += BlockSizeRes;
- m_SecondPass = true;
-}
-
-NO_INLINE void CCoder::SetPrices(const CLevels &levels)
-{
- if (_fastMode)
- return;
- UInt32 i;
- for(i = 0; i < 256; i++)
- {
- Byte price = levels.litLenLevels[i];
- m_LiteralPrices[i] = ((price != 0) ? price : kNoLiteralStatPrice);
- }
-
- for(i = 0; i < m_NumLenCombinations; i++)
- {
- UInt32 slot = g_LenSlots[i];
- Byte price = levels.litLenLevels[kSymbolMatch + slot];
- m_LenPrices[i] = (Byte)(((price != 0) ? price : kNoLenStatPrice) + m_LenDirectBits[slot]);
- }
-
- for(i = 0; i < kDistTableSize64; i++)
- {
- Byte price = levels.distLevels[i];
- m_PosPrices[i] = (Byte)(((price != 0) ? price: kNoPosStatPrice) + kDistDirectBits[i]);
- }
-}
-
-NO_INLINE void Huffman_ReverseBits(UInt32 *codes, const Byte *lens, UInt32 num)
-{
- for (UInt32 i = 0; i < num; i++)
- {
- UInt32 x = codes[i];
- x = ((x & 0x5555) << 1) | ((x & 0xAAAA) >> 1);
- x = ((x & 0x3333) << 2) | ((x & 0xCCCC) >> 2);
- x = ((x & 0x0F0F) << 4) | ((x & 0xF0F0) >> 4);
- codes[i] = (((x & 0x00FF) << 8) | ((x & 0xFF00) >> 8)) >> (16 - lens[i]);
- }
-}
-
-NO_INLINE void CCoder::WriteBlock()
-{
- Huffman_ReverseBits(mainCodes, m_NewLevels.litLenLevels, kFixedMainTableSize);
- Huffman_ReverseBits(distCodes, m_NewLevels.distLevels, kDistTableSize64);
-
- for (UInt32 i = 0; i < m_ValueIndex; i++)
- {
- const CCodeValue &codeValue = m_Values[i];
- if (codeValue.IsLiteral())
- WRITE_HF2(mainCodes, m_NewLevels.litLenLevels, codeValue.Pos);
- else
- {
- UInt32 len = codeValue.Len;
- UInt32 lenSlot = g_LenSlots[len];
- WRITE_HF2(mainCodes, m_NewLevels.litLenLevels, kSymbolMatch + lenSlot);
- m_OutStream.WriteBits(len - m_LenStart[lenSlot], m_LenDirectBits[lenSlot]);
- UInt32 dist = codeValue.Pos;
- UInt32 posSlot = GetPosSlot(dist);
- WRITE_HF2(distCodes, m_NewLevels.distLevels, posSlot);
- m_OutStream.WriteBits(dist - kDistStart[posSlot], kDistDirectBits[posSlot]);
- }
- }
- WRITE_HF2(mainCodes, m_NewLevels.litLenLevels, kSymbolEndOfBlock);
-}
-
-static UInt32 GetStorePrice(UInt32 blockSize, int bitPosition)
-{
- UInt32 price = 0;
- do
- {
- UInt32 nextBitPosition = (bitPosition + kFinalBlockFieldSize + kBlockTypeFieldSize) & 7;
- int numBitsForAlign = nextBitPosition > 0 ? (8 - nextBitPosition): 0;
- UInt32 curBlockSize = (blockSize < (1 << 16)) ? blockSize : (1 << 16) - 1;
- price += kFinalBlockFieldSize + kBlockTypeFieldSize + numBitsForAlign + (2 + 2) * 8 + curBlockSize * 8;
- bitPosition = 0;
- blockSize -= curBlockSize;
- }
- while(blockSize != 0);
- return price;
-}
-
-void CCoder::WriteStoreBlock(UInt32 blockSize, UInt32 additionalOffset, bool finalBlock)
-{
- do
- {
- UInt32 curBlockSize = (blockSize < (1 << 16)) ? blockSize : (1 << 16) - 1;
- blockSize -= curBlockSize;
- WriteBits((finalBlock && (blockSize == 0) ? NFinalBlockField::kFinalBlock: NFinalBlockField::kNotFinalBlock), kFinalBlockFieldSize);
- WriteBits(NBlockType::kStored, kBlockTypeFieldSize);
- m_OutStream.FlushByte();
- WriteBits((UInt16)curBlockSize, kStoredBlockLengthFieldSize);
- WriteBits((UInt16)~curBlockSize, kStoredBlockLengthFieldSize);
- const Byte *data = Inline_MatchFinder_GetPointerToCurrentPos(&_lzInWindow)- additionalOffset;
- for(UInt32 i = 0; i < curBlockSize; i++)
- m_OutStream.WriteByte(data[i]);
- additionalOffset -= curBlockSize;
- }
- while(blockSize != 0);
-}
-
-NO_INLINE UInt32 CCoder::TryDynBlock(int tableIndex, UInt32 numPasses)
-{
- CTables &t = m_Tables[tableIndex];
- BlockSizeRes = t.BlockSizeRes;
- UInt32 posTemp = t.m_Pos;
- SetPrices(t);
-
- for (UInt32 p = 0; p < numPasses; p++)
- {
- m_Pos = posTemp;
- TryBlock();
- unsigned numHuffBits =
- (m_ValueIndex > 18000 ? 12 :
- (m_ValueIndex > 7000 ? 11 :
- (m_ValueIndex > 2000 ? 10 : 9)));
- MakeTables(numHuffBits);
- SetPrices(m_NewLevels);
- }
-
- (CLevels &)t = m_NewLevels;
-
- m_NumLitLenLevels = kMainTableSize;
- while(m_NumLitLenLevels > static_cast< int >( kNumLitLenCodesMin ) && m_NewLevels.litLenLevels[m_NumLitLenLevels - 1] == 0)
- m_NumLitLenLevels--;
-
- m_NumDistLevels = kDistTableSize64;
- while(m_NumDistLevels > static_cast< int >( kNumDistCodesMin ) && m_NewLevels.distLevels[m_NumDistLevels - 1] == 0)
- m_NumDistLevels--;
-
- UInt32 levelFreqs[kLevelTableSize];
- memset(levelFreqs, 0, sizeof(levelFreqs));
-
- LevelTableDummy(m_NewLevels.litLenLevels, m_NumLitLenLevels, levelFreqs);
- LevelTableDummy(m_NewLevels.distLevels, m_NumDistLevels, levelFreqs);
-
- Huffman_Generate(levelFreqs, levelCodes, levelLens, kLevelTableSize, kMaxLevelBitLength);
-
- m_NumLevelCodes = kNumLevelCodesMin;
- for (UInt32 i = 0; i < kLevelTableSize; i++)
- {
- Byte level = levelLens[kCodeLengthAlphabetOrder[i]];
- if (level > 0 && i >= m_NumLevelCodes)
- m_NumLevelCodes = i + 1;
- m_LevelLevels[i] = level;
- }
-
- return GetLzBlockPrice() +
- Huffman_GetPrice_Spec(levelFreqs, levelLens, kLevelTableSize, kLevelDirectBits, kTableDirectLevels) +
- kNumLenCodesFieldSize + kNumDistCodesFieldSize + kNumLevelCodesFieldSize +
- m_NumLevelCodes * kLevelFieldSize + kFinalBlockFieldSize + kBlockTypeFieldSize;
-}
-
-NO_INLINE UInt32 CCoder::TryFixedBlock(int tableIndex)
-{
- CTables &t = m_Tables[tableIndex];
- BlockSizeRes = t.BlockSizeRes;
- m_Pos = t.m_Pos;
- m_NewLevels.SetFixedLevels();
- SetPrices(m_NewLevels);
- TryBlock();
- return kFinalBlockFieldSize + kBlockTypeFieldSize + GetLzBlockPrice();
-}
-
-NO_INLINE UInt32 CCoder::GetBlockPrice(int tableIndex, int numDivPasses)
-{
- CTables &t = m_Tables[tableIndex];
- t.StaticMode = false;
- UInt32 price = TryDynBlock(tableIndex, m_NumPasses);
- t.BlockSizeRes = BlockSizeRes;
- UInt32 numValues = m_ValueIndex;
- UInt32 posTemp = m_Pos;
- UInt32 additionalOffsetEnd = m_AdditionalOffset;
-
- if (m_CheckStatic && m_ValueIndex <= kFixedHuffmanCodeBlockSizeMax)
- {
- const UInt32 fixedPrice = TryFixedBlock(tableIndex);
- t.StaticMode = (fixedPrice < price);
- if (t.StaticMode)
- price = fixedPrice;
- }
-
- const UInt32 storePrice = GetStorePrice(BlockSizeRes, 0); // bitPosition
- t.StoreMode = (storePrice <= price);
- if (t.StoreMode)
- price = storePrice;
-
- t.UseSubBlocks = false;
-
- if (numDivPasses > 1 && numValues >= kDivideCodeBlockSizeMin)
- {
- CTables &t0 = m_Tables[(tableIndex << 1)];
- (CLevels &)t0 = t;
- t0.BlockSizeRes = t.BlockSizeRes >> 1;
- t0.m_Pos = t.m_Pos;
- UInt32 subPrice = GetBlockPrice((tableIndex << 1), numDivPasses - 1);
-
- UInt32 blockSize2 = t.BlockSizeRes - t0.BlockSizeRes;
- if (t0.BlockSizeRes >= kDivideBlockSizeMin && blockSize2 >= kDivideBlockSizeMin)
- {
- CTables &t1 = m_Tables[(tableIndex << 1) + 1];
- (CLevels &)t1 = t;
- t1.BlockSizeRes = blockSize2;
- t1.m_Pos = m_Pos;
- m_AdditionalOffset -= t0.BlockSizeRes;
- subPrice += GetBlockPrice((tableIndex << 1) + 1, numDivPasses - 1);
- t.UseSubBlocks = (subPrice < price);
- if (t.UseSubBlocks)
- price = subPrice;
- }
- }
- m_AdditionalOffset = additionalOffsetEnd;
- m_Pos = posTemp;
- return price;
-}
-
-void CCoder::CodeBlock(int tableIndex, bool finalBlock)
-{
- CTables &t = m_Tables[tableIndex];
- if (t.UseSubBlocks)
- {
- CodeBlock((tableIndex << 1), false);
- CodeBlock((tableIndex << 1) + 1, finalBlock);
- }
- else
- {
- if (t.StoreMode)
- WriteStoreBlock(t.BlockSizeRes, m_AdditionalOffset, finalBlock);
- else
- {
- WriteBits((finalBlock ? NFinalBlockField::kFinalBlock: NFinalBlockField::kNotFinalBlock), kFinalBlockFieldSize);
- if (t.StaticMode)
- {
- WriteBits(NBlockType::kFixedHuffman, kBlockTypeFieldSize);
- TryFixedBlock(tableIndex);
- unsigned int i;
- const int kMaxStaticHuffLen = 9;
- for (i = 0; i < kFixedMainTableSize; i++)
- mainFreqs[i] = (UInt32)1 << (kMaxStaticHuffLen - m_NewLevels.litLenLevels[i]);
- for (i = 0; i < kFixedDistTableSize; i++)
- distFreqs[i] = (UInt32)1 << (kMaxStaticHuffLen - m_NewLevels.distLevels[i]);
- MakeTables(kMaxStaticHuffLen);
- }
- else
- {
- if (m_NumDivPasses > 1 || m_CheckStatic)
- TryDynBlock(tableIndex, 1);
- WriteBits(NBlockType::kDynamicHuffman, kBlockTypeFieldSize);
- WriteBits(m_NumLitLenLevels - kNumLitLenCodesMin, kNumLenCodesFieldSize);
- WriteBits(m_NumDistLevels - kNumDistCodesMin, kNumDistCodesFieldSize);
- WriteBits(m_NumLevelCodes - kNumLevelCodesMin, kNumLevelCodesFieldSize);
-
- for (UInt32 i = 0; i < m_NumLevelCodes; i++)
- WriteBits(m_LevelLevels[i], kLevelFieldSize);
-
- Huffman_ReverseBits(levelCodes, levelLens, kLevelTableSize);
- LevelTableCode(m_NewLevels.litLenLevels, m_NumLitLenLevels, levelLens, levelCodes);
- LevelTableCode(m_NewLevels.distLevels, m_NumDistLevels, levelLens, levelCodes);
- }
- WriteBlock();
- }
- m_AdditionalOffset -= t.BlockSizeRes;
- }
-}
-
-SRes Read(void *object, void *data, size_t *size)
-{
- const UInt32 kStepSize = (UInt32)1 << 31;
- UInt32 curSize = ((*size < kStepSize) ? (UInt32)*size : kStepSize);
- HRESULT res = ((CSeqInStream *)object)->RealStream->Read(data, curSize, &curSize);
- *size = curSize;
- return (SRes)res;
-}
-
-HRESULT CCoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */ , const UInt64 * /* outSize */ , ICompressProgressInfo *progress)
-{
- m_CheckStatic = (m_NumPasses != 1 || m_NumDivPasses != 1);
- m_IsMultiPass = (m_CheckStatic || (m_NumPasses != 1 || m_NumDivPasses != 1));
-
- RINOK(Create());
-
- m_ValueBlockSize = (7 << 10) + (1 << 12) * m_NumDivPasses;
-
- UInt64 nowPos = 0;
-
- _seqInStream.RealStream = inStream;
- _seqInStream.SeqInStream.Read = Read;
- _lzInWindow.stream = &_seqInStream.SeqInStream;
-
- MatchFinder_Init(&_lzInWindow);
- m_OutStream.SetStream(outStream);
- m_OutStream.Init();
-
- CCoderReleaser coderReleaser(this);
-
- m_OptimumEndIndex = m_OptimumCurrentIndex = 0;
-
- CTables &t = m_Tables[1];
- t.m_Pos = 0;
- t.InitStructures();
-
- m_AdditionalOffset = 0;
- do
- {
- t.BlockSizeRes = kBlockUncompressedSizeThreshold;
- m_SecondPass = false;
- GetBlockPrice(1, m_NumDivPasses);
- CodeBlock(1, Inline_MatchFinder_GetNumAvailableBytes(&_lzInWindow) == 0);
- nowPos += m_Tables[1].BlockSizeRes;
- if (progress != NULL)
- {
- UInt64 packSize = m_OutStream.GetProcessedSize();
- RINOK(progress->SetRatioInfo(&nowPos, &packSize));
- }
- }
- while (Inline_MatchFinder_GetNumAvailableBytes(&_lzInWindow) != 0);
- if (_lzInWindow.result != SZ_OK)
- return _lzInWindow.result;
- return m_OutStream.Flush();
-}
-
-HRESULT CCoder::BaseCode(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(const COutBufferException &e) { return e.ErrorCode; }
- catch(...) { return E_FAIL; }
-}
-
-STDMETHODIMP CCOMCoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
- { return BaseCode(inStream, outStream, inSize, outSize, progress); }
-
-STDMETHODIMP CCOMCoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
- { return BaseSetEncoderProperties2(propIDs, props, numProps); }
-
-STDMETHODIMP CCOMCoder64::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
- { return BaseCode(inStream, outStream, inSize, outSize, progress); }
-
-STDMETHODIMP CCOMCoder64::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
- { return BaseSetEncoderProperties2(propIDs, props, numProps); }
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateEncoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateEncoder.h
deleted file mode 100644
index 71c39e4e5..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateEncoder.h
+++ /dev/null
@@ -1,211 +0,0 @@
-// DeflateEncoder.h
-
-#ifndef __DEFLATE_ENCODER_H
-#define __DEFLATE_ENCODER_H
-
-#include "../../../C/LzFind.h"
-
-#include "Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "BitlEncoder.h"
-#include "DeflateConst.h"
-
-namespace NCompress {
-namespace NDeflate {
-namespace NEncoder {
-
-struct CCodeValue
-{
- UInt16 Len;
- UInt16 Pos;
- void SetAsLiteral() { Len = (1 << 15); }
- bool IsLiteral() const { return (Len >= (1 << 15)); }
-};
-
-struct COptimal
-{
- UInt32 Price;
- UInt16 PosPrev;
- UInt16 BackPrev;
-};
-
-const UInt32 kNumOptsBase = 1 << 12;
-const UInt32 kNumOpts = kNumOptsBase + kMatchMaxLen;
-
-class CCoder;
-
-struct CTables: public CLevels
-{
- bool UseSubBlocks;
- bool StoreMode;
- bool StaticMode;
- UInt32 BlockSizeRes;
- UInt32 m_Pos;
- void InitStructures();
-};
-
-typedef struct _CSeqInStream
-{
- ISeqInStream SeqInStream;
- CMyComPtr<ISequentialInStream> RealStream;
-} CSeqInStream;
-
-class CCoder
-{
- CMatchFinder _lzInWindow;
- CBitlEncoder m_OutStream;
-
- CSeqInStream _seqInStream;
-
-public:
- CCodeValue *m_Values;
-
- UInt16 *m_MatchDistances;
- UInt32 m_NumFastBytes;
- bool _fastMode;
- bool _btMode;
-
- UInt16 *m_OnePosMatchesMemory;
- UInt16 *m_DistanceMemory;
-
- UInt32 m_Pos;
-
- int m_NumPasses;
- int m_NumDivPasses;
- bool m_CheckStatic;
- bool m_IsMultiPass;
- UInt32 m_ValueBlockSize;
-
- UInt32 m_NumLenCombinations;
- UInt32 m_MatchMaxLen;
- const Byte *m_LenStart;
- const Byte *m_LenDirectBits;
-
- bool m_Created;
- bool m_Deflate64Mode;
-
- Byte m_LevelLevels[kLevelTableSize];
- int m_NumLitLenLevels;
- int m_NumDistLevels;
- UInt32 m_NumLevelCodes;
- UInt32 m_ValueIndex;
-
- bool m_SecondPass;
- UInt32 m_AdditionalOffset;
-
- UInt32 m_OptimumEndIndex;
- UInt32 m_OptimumCurrentIndex;
-
- Byte m_LiteralPrices[256];
- Byte m_LenPrices[kNumLenSymbolsMax];
- Byte m_PosPrices[kDistTableSize64];
-
- CLevels m_NewLevels;
- UInt32 mainFreqs[kFixedMainTableSize];
- UInt32 distFreqs[kDistTableSize64];
- UInt32 mainCodes[kFixedMainTableSize];
- UInt32 distCodes[kDistTableSize64];
- UInt32 levelCodes[kLevelTableSize];
- Byte levelLens[kLevelTableSize];
-
- UInt32 BlockSizeRes;
-
- CTables *m_Tables;
- COptimal m_Optimum[kNumOpts];
-
- UInt32 m_MatchFinderCycles;
- // IMatchFinderSetNumPasses *m_SetMfPasses;
-
- void GetMatches();
- void MovePos(UInt32 num);
- UInt32 Backward(UInt32 &backRes, UInt32 cur);
- UInt32 GetOptimal(UInt32 &backRes);
- UInt32 GetOptimalFast(UInt32 &backRes);
-
- void LevelTableDummy(const Byte *levels, int numLevels, UInt32 *freqs);
-
- void WriteBits(UInt32 value, int numBits);
- void LevelTableCode(const Byte *levels, int numLevels, const Byte *lens, const UInt32 *codes);
-
- void MakeTables(unsigned maxHuffLen);
- UInt32 GetLzBlockPrice() const;
- void TryBlock();
- UInt32 TryDynBlock(int tableIndex, UInt32 numPasses);
-
- UInt32 TryFixedBlock(int tableIndex);
-
- void SetPrices(const CLevels &levels);
- void WriteBlock();
-
- HRESULT Create();
- void Free();
-
- void WriteStoreBlock(UInt32 blockSize, UInt32 additionalOffset, bool finalBlock);
- void WriteTables(bool writeMode, bool finalBlock);
-
- void WriteBlockData(bool writeMode, bool finalBlock);
-
- void ReleaseStreams()
- {
- _seqInStream.RealStream.Release();
- m_OutStream.ReleaseStream();
- }
- class CCoderReleaser
- {
- CCoder *m_Coder;
- public:
- CCoderReleaser(CCoder *coder): m_Coder(coder) {}
- ~CCoderReleaser() { m_Coder->ReleaseStreams(); }
- };
- friend class CCoderReleaser;
-
- UInt32 GetBlockPrice(int tableIndex, int numDivPasses);
- void CodeBlock(int tableIndex, bool finalBlock);
-
-public:
- CCoder(bool deflate64Mode = false);
- ~CCoder();
-
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- HRESULT BaseCode(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- HRESULT BaseSetEncoderProperties2(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
-};
-
-
-class CCOMCoder :
- public ICompressCoder,
- public ICompressSetCoderProperties,
- public CMyUnknownImp,
- public CCoder
-{
-public:
- MY_UNKNOWN_IMP1(ICompressSetCoderProperties)
- CCOMCoder(): CCoder(false) {};
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
-};
-
-class CCOMCoder64 :
- public ICompressCoder,
- public ICompressSetCoderProperties,
- public CMyUnknownImp,
- public CCoder
-{
-public:
- MY_UNKNOWN_IMP1(ICompressSetCoderProperties)
- CCOMCoder64(): CCoder(true) {};
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
-};
-
-}}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateNsisRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateNsisRegister.cpp
deleted file mode 100644
index ffad96c21..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateNsisRegister.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// DeflateNsisRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "DeflateDecoder.h"
-
-static void *CreateCodecDeflateNsis() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NDecoder::CNsisCOMCoder); }
-
-static CCodecInfo g_CodecInfo =
- { CreateCodecDeflateNsis, 0, 0x040901, L"DeflateNSIS", 1, false };
-
-REGISTER_CODEC(DeflateNsis)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateRegister.cpp
deleted file mode 100644
index 45f55219e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeflateRegister.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// DeflateRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "DeflateDecoder.h"
-
-static void *CreateCodecDeflate() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NDecoder::CCOMCoder); }
-
-#if !defined(EXTRACT_ONLY) && !defined(DEFLATE_EXTRACT_ONLY)
-#include "DeflateEncoder.h"
-static void *CreateCodecOutDeflate() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NEncoder::CCOMCoder); }
-#else
-#define CreateCodecOutDeflate 0
-#endif
-
-static CCodecInfo g_CodecInfo =
- { CreateCodecDeflate, CreateCodecOutDeflate, 0x040108, L"Deflate", 1, false };
-
-REGISTER_CODEC(Deflate)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeltaFilter.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeltaFilter.cpp
deleted file mode 100644
index 2e421acf4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DeltaFilter.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-// DeltaFilter.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Delta.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "BranchCoder.h"
-
-struct CDelta
-{
- unsigned _delta;
- Byte _state[DELTA_STATE_SIZE];
- CDelta(): _delta(1) {}
- void DeltaInit() { Delta_Init(_state); }
-};
-
-class CDeltaEncoder:
- public ICompressFilter,
- public ICompressSetCoderProperties,
- public ICompressWriteCoderProperties,
- CDelta,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP2(ICompressSetCoderProperties, ICompressWriteCoderProperties)
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
- STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
-};
-
-class CDeltaDecoder:
- public ICompressFilter,
- public ICompressSetDecoderProperties2,
- CDelta,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2)
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-};
-
-STDMETHODIMP CDeltaEncoder::Init()
-{
- DeltaInit();
- return S_OK;
-}
-
-STDMETHODIMP_(UInt32) CDeltaEncoder::Filter(Byte *data, UInt32 size)
-{
- Delta_Encode(_state, _delta, data, size);
- return size;
-}
-
-STDMETHODIMP CDeltaEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
-{
- UInt32 delta = _delta;
- for (UInt32 i = 0; i < numProps; i++)
- {
- const PROPVARIANT &prop = props[i];
- if (propIDs[i] != NCoderPropID::kDefaultProp || prop.vt != VT_UI4 || prop.ulVal < 1 || prop.ulVal > 256)
- return E_INVALIDARG;
- delta = prop.ulVal;
- }
- _delta = delta;
- return S_OK;
-}
-
-STDMETHODIMP CDeltaEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
-{
- Byte prop = (Byte)(_delta - 1);
- return outStream->Write(&prop, 1, NULL);
-}
-
-STDMETHODIMP CDeltaDecoder::Init()
-{
- DeltaInit();
- return S_OK;
-}
-
-STDMETHODIMP_(UInt32) CDeltaDecoder::Filter(Byte *data, UInt32 size)
-{
- Delta_Decode(_state, _delta, data, size);
- return size;
-}
-
-STDMETHODIMP CDeltaDecoder::SetDecoderProperties2(const Byte *props, UInt32 size)
-{
- if (size != 1)
- return E_INVALIDARG;
- _delta = (unsigned)props[0] + 1;
- return S_OK;
-}
-
-#define CREATE_CODEC(x) \
- static void *CreateCodec ## x() { return (void *)(ICompressFilter *)(new C ## x ## Decoder); } \
- static void *CreateCodec ## x ## Out() { return (void *)(ICompressFilter *)(new C ## x ## Encoder); }
-
-CREATE_CODEC(Delta)
-
-#define METHOD_ITEM(x, id, name) { CreateCodec ## x, CreateCodec ## x ## Out, id, name, 1, true }
-
-static CCodecInfo g_CodecsInfo[] =
-{
- METHOD_ITEM(Delta, 3, L"Delta")
-};
-
-REGISTER_CODECS(Delta)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DllExports.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DllExports.cpp
deleted file mode 100644
index a7ec90270..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DllExports.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// DllExports.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/MyInitGuid.h"
-
-#include "../ICoder.h"
-
-#include "../Common/RegisterCodec.h"
-
-static const unsigned int kNumCodecsMax = 32;
-unsigned int g_NumCodecs = 0;
-const CCodecInfo *g_Codecs[kNumCodecsMax];
-void RegisterCodec(const CCodecInfo *codecInfo)
-{
- if (g_NumCodecs < kNumCodecsMax)
- g_Codecs[g_NumCodecs++] = codecInfo;
-}
-
-#ifdef _WIN32
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/)
-{
- return TRUE;
-}
-#endif
-
-static const UInt16 kDecodeId = 0x2790;
-
-DEFINE_GUID(CLSID_CCodec,
-0x23170F69, 0x40C1, kDecodeId, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-STDAPI CreateCoder(const GUID *clsid, const GUID *iid, void **outObject);
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- return CreateCoder(clsid, iid, outObject);
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DllExports2.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DllExports2.cpp
deleted file mode 100644
index 836f3fa42..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/DllExports2.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-// DllExports.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/MyInitGuid.h"
-
-#include "../ICoder.h"
-
-#include "../Common/RegisterCodec.h"
-
-extern "C"
-BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD /* dwReason */, LPVOID /*lpReserved*/)
-{
- return TRUE;
-}
-
-static const UInt16 kDecodeId = 0x2790;
-
-DEFINE_GUID(CLSID_CCodec,
-0x23170F69, 0x40C1, kDecodeId, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-STDAPI CreateCoder(const GUID *clsid, const GUID *iid, void **outObject);
-
-STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
-{
- return CreateCoder(clsid, iid, outObject);
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/HuffmanDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/HuffmanDecoder.h
deleted file mode 100644
index 74a389a16..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/HuffmanDecoder.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// Compress/HuffmanDecoder.h
-
-#ifndef __COMPRESS_HUFFMAN_DECODER_H
-#define __COMPRESS_HUFFMAN_DECODER_H
-
-#include "../../Common/Types.h"
-
-namespace NCompress {
-namespace NHuffman {
-
-const int kNumTableBits = 9;
-
-template <int kNumBitsMax, UInt32 m_NumSymbols>
-class CDecoder
-{
- UInt32 m_Limits[kNumBitsMax + 1]; // m_Limits[i] = value limit for symbols with length = i
- UInt32 m_Positions[kNumBitsMax + 1]; // m_Positions[i] = index in m_Symbols[] of first symbol with length = i
- UInt32 m_Symbols[m_NumSymbols];
- Byte m_Lengths[1 << kNumTableBits]; // Table oh length for short codes.
-
-public:
-
- bool SetCodeLengths(const Byte *codeLengths)
- {
- int lenCounts[kNumBitsMax + 1];
- UInt32 tmpPositions[kNumBitsMax + 1];
- int i;
- for(i = 1; i <= kNumBitsMax; i++)
- lenCounts[i] = 0;
- UInt32 symbol;
- for (symbol = 0; symbol < m_NumSymbols; symbol++)
- {
- int len = codeLengths[symbol];
- if (len > kNumBitsMax)
- return false;
- lenCounts[len]++;
- m_Symbols[symbol] = 0xFFFFFFFF;
- }
- lenCounts[0] = 0;
- m_Positions[0] = m_Limits[0] = 0;
- UInt32 startPos = 0;
- UInt32 index = 0;
- const UInt32 kMaxValue = (1 << kNumBitsMax);
- for (i = 1; i <= kNumBitsMax; i++)
- {
- startPos += lenCounts[i] << (kNumBitsMax - i);
- if (startPos > kMaxValue)
- return false;
- m_Limits[i] = (i == kNumBitsMax) ? kMaxValue : startPos;
- m_Positions[i] = m_Positions[i - 1] + lenCounts[i - 1];
- tmpPositions[i] = m_Positions[i];
- if(i <= kNumTableBits)
- {
- UInt32 limit = (m_Limits[i] >> (kNumBitsMax - kNumTableBits));
- for (; index < limit; index++)
- m_Lengths[index] = (Byte)i;
- }
- }
- for (symbol = 0; symbol < m_NumSymbols; symbol++)
- {
- int len = codeLengths[symbol];
- if (len != 0)
- m_Symbols[tmpPositions[len]++] = symbol;
- }
- return true;
- }
-
- template <class TBitDecoder>
- UInt32 DecodeSymbol(TBitDecoder *bitStream)
- {
- int numBits;
- UInt32 value = bitStream->GetValue(kNumBitsMax);
- if (value < m_Limits[kNumTableBits])
- numBits = m_Lengths[value >> (kNumBitsMax - kNumTableBits)];
- else
- for (numBits = kNumTableBits + 1; value >= m_Limits[numBits]; numBits++) {}
- bitStream->MovePos(numBits);
- UInt32 index = m_Positions[numBits] +
- ((value - m_Limits[numBits - 1]) >> (kNumBitsMax - numBits));
- if (index >= m_NumSymbols)
- // throw CDecoderException(); // test it
- return 0xFFFFFFFF;
- return m_Symbols[index];
- }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeDecoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeDecoder.cpp
deleted file mode 100644
index ec29bfe93..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeDecoder.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-// Implode/Decoder.cpp
-
-#include "StdAfx.h"
-
-#include "ImplodeDecoder.h"
-#include "Common/Defs.h"
-
-namespace NCompress {
-namespace NImplode {
-namespace NDecoder {
-
-class CException
-{
-public:
- enum ECauseType
- {
- kData
- } m_Cause;
- CException(ECauseType cause): m_Cause(cause) {}
-};
-
-static const int kNumDistanceLowDirectBitsForBigDict = 7;
-static const int kNumDistanceLowDirectBitsForSmallDict = 6;
-
-static const int kNumBitsInByte = 8;
-
-// static const int kLevelStructuresNumberFieldSize = kNumBitsInByte;
-static const int kLevelStructuresNumberAdditionalValue = 1;
-
-static const int kNumLevelStructureLevelBits = 4;
-static const int kLevelStructureLevelAdditionalValue = 1;
-
-static const int kNumLevelStructureRepNumberBits = 4;
-static const int kLevelStructureRepNumberAdditionalValue = 1;
-
-
-static const int kLiteralTableSize = (1 << kNumBitsInByte);
-static const int kDistanceTableSize = 64;
-static const int kLengthTableSize = 64;
-
-static const UInt32 kHistorySize =
- (1 << MyMax(kNumDistanceLowDirectBitsForBigDict,
- kNumDistanceLowDirectBitsForSmallDict)) *
- kDistanceTableSize; // = 8 KB;
-
-static const int kNumAdditionalLengthBits = 8;
-
-static const UInt32 kMatchMinLenWhenLiteralsOn = 3;
-static const UInt32 kMatchMinLenWhenLiteralsOff = 2;
-
-static const UInt32 kMatchMinLenMax = MyMax(kMatchMinLenWhenLiteralsOn,
- kMatchMinLenWhenLiteralsOff); // 3
-
-// static const UInt32 kMatchMaxLenMax = kMatchMinLenMax + (kLengthTableSize - 1) + (1 << kNumAdditionalLengthBits) - 1; // or 2
-
-enum
-{
- kMatchId = 0,
- kLiteralId = 1
-};
-
-
-CCoder::CCoder():
- m_LiteralDecoder(kLiteralTableSize),
- m_LengthDecoder(kLengthTableSize),
- m_DistanceDecoder(kDistanceTableSize)
-{
-}
-
-void CCoder::ReleaseStreams()
-{
- m_OutWindowStream.ReleaseStream();
- m_InBitStream.ReleaseStream();
-}
-
-bool CCoder::ReadLevelItems(NImplode::NHuffman::CDecoder &decoder,
- Byte *levels, int numLevelItems)
-{
- int numCodedStructures = m_InBitStream.ReadBits(kNumBitsInByte) +
- kLevelStructuresNumberAdditionalValue;
- int currentIndex = 0;
- for(int i = 0; i < numCodedStructures; i++)
- {
- int level = m_InBitStream.ReadBits(kNumLevelStructureLevelBits) +
- kLevelStructureLevelAdditionalValue;
- int rep = m_InBitStream.ReadBits(kNumLevelStructureRepNumberBits) +
- kLevelStructureRepNumberAdditionalValue;
- if (currentIndex + rep > numLevelItems)
- throw CException(CException::kData);
- for(int j = 0; j < rep; j++)
- levels[currentIndex++] = (Byte)level;
- }
- if (currentIndex != numLevelItems)
- return false;
- return decoder.SetCodeLengths(levels);
-}
-
-
-bool CCoder::ReadTables(void)
-{
- if (m_LiteralsOn)
- {
- Byte literalLevels[kLiteralTableSize];
- if (!ReadLevelItems(m_LiteralDecoder, literalLevels, kLiteralTableSize))
- return false;
- }
-
- Byte lengthLevels[kLengthTableSize];
- if (!ReadLevelItems(m_LengthDecoder, lengthLevels, kLengthTableSize))
- return false;
-
- Byte distanceLevels[kDistanceTableSize];
- return ReadLevelItems(m_DistanceDecoder, distanceLevels, kDistanceTableSize);
-}
-
-class CCoderReleaser
-{
- CCoder *m_Coder;
-public:
- CCoderReleaser(CCoder *coder): m_Coder(coder) {}
- ~CCoderReleaser() { m_Coder->ReleaseStreams(); }
-};
-
-HRESULT CCoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- if (!m_InBitStream.Create(1 << 20))
- return E_OUTOFMEMORY;
- if (!m_OutWindowStream.Create(kHistorySize))
- return E_OUTOFMEMORY;
- if (outSize == NULL)
- return E_INVALIDARG;
- UInt64 pos = 0, unPackSize = *outSize;
-
- m_OutWindowStream.SetStream(outStream);
- m_OutWindowStream.Init(false);
- m_InBitStream.SetStream(inStream);
- m_InBitStream.Init();
- CCoderReleaser coderReleaser(this);
-
- if (!ReadTables())
- return S_FALSE;
-
- while(pos < unPackSize)
- {
- if (progress != NULL && pos % (1 << 16) == 0)
- {
- UInt64 packSize = m_InBitStream.GetProcessedSize();
- RINOK(progress->SetRatioInfo(&packSize, &pos));
- }
- if(m_InBitStream.ReadBits(1) == kMatchId) // match
- {
- UInt32 lowDistBits = m_InBitStream.ReadBits(m_NumDistanceLowDirectBits);
- UInt32 distance = m_DistanceDecoder.DecodeSymbol(&m_InBitStream);
- if (distance >= static_cast< UInt32 >( kDistanceTableSize) )
- return S_FALSE;
- distance = (distance << m_NumDistanceLowDirectBits) + lowDistBits;
- UInt32 lengthSymbol = m_LengthDecoder.DecodeSymbol(&m_InBitStream);
- if (lengthSymbol >= static_cast< UInt32 >( kLengthTableSize) )
- return S_FALSE;
- UInt32 length = lengthSymbol + m_MinMatchLength;
- if (lengthSymbol == kLengthTableSize - 1) // special symbol = 63
- length += m_InBitStream.ReadBits(kNumAdditionalLengthBits);
- while(distance >= pos && length > 0)
- {
- m_OutWindowStream.PutByte(0);
- pos++;
- length--;
- }
- if (length > 0)
- m_OutWindowStream.CopyBlock(distance, length);
- pos += length;
- }
- else
- {
- Byte b;
- if (m_LiteralsOn)
- {
- UInt32 temp = m_LiteralDecoder.DecodeSymbol(&m_InBitStream);
- if (temp >= static_cast< UInt32 >( kLiteralTableSize) )
- return S_FALSE;
- b = (Byte)temp;
- }
- else
- b = (Byte)m_InBitStream.ReadBits(kNumBitsInByte);
- m_OutWindowStream.PutByte(b);
- pos++;
- }
- }
- if (pos > unPackSize)
- return S_FALSE;
- return m_OutWindowStream.Flush();
-}
-
-STDMETHODIMP CCoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(const CLzOutWindowException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-STDMETHODIMP CCoder::SetDecoderProperties2(const Byte *data, UInt32 size)
-{
- if (size < 1)
- return E_INVALIDARG;
- Byte flag = data[0];
- m_BigDictionaryOn = ((flag & 2) != 0);
- m_NumDistanceLowDirectBits = m_BigDictionaryOn ?
- kNumDistanceLowDirectBitsForBigDict:
- kNumDistanceLowDirectBitsForSmallDict;
- m_LiteralsOn = ((flag & 4) != 0);
- m_MinMatchLength = m_LiteralsOn ?
- kMatchMinLenWhenLiteralsOn :
- kMatchMinLenWhenLiteralsOff;
- return S_OK;
-}
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeDecoder.h
deleted file mode 100644
index 7ea1553ee..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeDecoder.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// ImplodeDecoder.h
-
-#ifndef __COMPRESS_IMPLODE_DECODER_H
-#define __COMPRESS_IMPLODE_DECODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "ImplodeHuffmanDecoder.h"
-#include "LzOutWindow.h"
-
-namespace NCompress {
-namespace NImplode {
-namespace NDecoder {
-
-class CCoder:
- public ICompressCoder,
- public ICompressSetDecoderProperties2,
- public CMyUnknownImp
-{
- CLzOutWindow m_OutWindowStream;
- NBitl::CDecoder<CInBuffer> m_InBitStream;
-
- NImplode::NHuffman::CDecoder m_LiteralDecoder;
- NImplode::NHuffman::CDecoder m_LengthDecoder;
- NImplode::NHuffman::CDecoder m_DistanceDecoder;
-
- bool m_BigDictionaryOn;
- bool m_LiteralsOn;
-
- int m_NumDistanceLowDirectBits;
- UInt32 m_MinMatchLength;
-
- bool ReadLevelItems(NImplode::NHuffman::CDecoder &table, Byte *levels, int numLevelItems);
- bool ReadTables();
- void DeCodeLevelTable(Byte *newLevels, int numLevels);
-public:
- CCoder();
-
- MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2)
-
- void ReleaseStreams();
- HRESULT Flush() { return m_OutWindowStream.Flush(); }
-
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-};
-
-}}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp
deleted file mode 100644
index 64345e08b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-// ImplodeHuffmanDecoder.cpp
-
-#include "StdAfx.h"
-
-#include "ImplodeHuffmanDecoder.h"
-
-namespace NCompress {
-namespace NImplode {
-namespace NHuffman {
-
-CDecoder::CDecoder(UInt32 numSymbols):
- m_NumSymbols(numSymbols)
-{
- m_Symbols = new UInt32[m_NumSymbols];
-}
-
-CDecoder::~CDecoder()
-{
- delete []m_Symbols;
-}
-
-bool CDecoder::SetCodeLengths(const Byte *codeLengths)
-{
- // int lenCounts[kNumBitsInLongestCode + 1], tmpPositions[kNumBitsInLongestCode + 1];
- int lenCounts[kNumBitsInLongestCode + 2], tmpPositions[kNumBitsInLongestCode + 1];
- int i;
- for(i = 0; i <= kNumBitsInLongestCode; i++)
- lenCounts[i] = 0;
- UInt32 symbolIndex;
- for (symbolIndex = 0; symbolIndex < m_NumSymbols; symbolIndex++)
- lenCounts[codeLengths[symbolIndex]]++;
- // lenCounts[0] = 0;
-
- // tmpPositions[0] = m_Positions[0] = m_Limitits[0] = 0;
- m_Limitits[kNumBitsInLongestCode + 1] = 0;
- m_Positions[kNumBitsInLongestCode + 1] = 0;
- lenCounts[kNumBitsInLongestCode + 1] = 0;
-
-
- UInt32 startPos = 0;
- static const UInt32 kMaxValue = (1 << kNumBitsInLongestCode);
-
- for (i = kNumBitsInLongestCode; i > 0; i--)
- {
- startPos += lenCounts[i] << (kNumBitsInLongestCode - i);
- if (startPos > kMaxValue)
- return false;
- m_Limitits[i] = startPos;
- m_Positions[i] = m_Positions[i + 1] + lenCounts[i + 1];
- tmpPositions[i] = m_Positions[i] + lenCounts[i];
-
- }
-
- // if _ZIP_MODE do not throw exception for trees containing only one node
- // #ifndef _ZIP_MODE
- if (startPos != kMaxValue)
- return false;
- // #endif
-
- for (symbolIndex = 0; symbolIndex < m_NumSymbols; symbolIndex++)
- if (codeLengths[symbolIndex] != 0)
- m_Symbols[--tmpPositions[codeLengths[symbolIndex]]] = symbolIndex;
- return true;
-}
-
-UInt32 CDecoder::DecodeSymbol(CInBit *inStream)
-{
- UInt32 numBits = 0;
- UInt32 value = inStream->GetValue(kNumBitsInLongestCode);
- int i;
- for(i = kNumBitsInLongestCode; i > 0; i--)
- {
- if (value < m_Limitits[i])
- {
- numBits = i;
- break;
- }
- }
- if (i == 0)
- return 0xFFFFFFFF;
- inStream->MovePos(numBits);
- UInt32 index = m_Positions[numBits] +
- ((value - m_Limitits[numBits + 1]) >> (kNumBitsInLongestCode - numBits));
- if (index >= m_NumSymbols)
- return 0xFFFFFFFF;
- return m_Symbols[index];
-}
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeHuffmanDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeHuffmanDecoder.h
deleted file mode 100644
index 6120a35ab..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ImplodeHuffmanDecoder.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// ImplodeHuffmanDecoder.h
-
-#ifndef __IMPLODE_HUFFMAN_DECODER_H
-#define __IMPLODE_HUFFMAN_DECODER_H
-
-#include "../Common/InBuffer.h"
-
-#include "BitlDecoder.h"
-
-namespace NCompress {
-namespace NImplode {
-namespace NHuffman {
-
-const int kNumBitsInLongestCode = 16;
-
-typedef NBitl::CDecoder<CInBuffer> CInBit;
-
-class CDecoder
-{
- UInt32 m_Limitits[kNumBitsInLongestCode + 2]; // m_Limitits[i] = value limit for symbols with length = i
- UInt32 m_Positions[kNumBitsInLongestCode + 2]; // m_Positions[i] = index in m_Symbols[] of first symbol with length = i
- UInt32 m_NumSymbols; // number of symbols in m_Symbols
- UInt32 *m_Symbols; // symbols: at first with len=1 then 2, ... 15.
-public:
- CDecoder(UInt32 numSymbols);
- ~CDecoder();
-
- bool SetCodeLengths(const Byte *codeLengths);
- UInt32 DecodeSymbol(CInBit *inStream);
-};
-
-}}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
deleted file mode 100644
index 3d8e475ff..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
+++ /dev/null
@@ -1,531 +0,0 @@
-// LzmaAlone.cpp
-
-#include "StdAfx.h"
-
-#include "../../../Common/MyWindows.h"
-#include "../../../Common/MyInitGuid.h"
-
-#include <stdio.h>
-
-#if defined(_WIN32) || defined(OS2) || defined(MSDOS)
-#include <fcntl.h>
-#include <io.h>
-#define MY_SET_BINARY_MODE(file) _setmode(_fileno(file), O_BINARY)
-#else
-#define MY_SET_BINARY_MODE(file)
-#endif
-
-#include "../../../Common/CommandLineParser.h"
-#include "../../../Common/StringConvert.h"
-#include "../../../Common/StringToInt.h"
-
-#include "../../Common/FileStreams.h"
-#include "../../Common/StreamUtils.h"
-
-#include "../LzmaDecoder.h"
-#include "../LzmaEncoder.h"
-
-#include "LzmaBenchCon.h"
-
-#ifdef COMPRESS_MF_MT
-#include "../../../Windows/System.h"
-#endif
-
-#include "../../../../C/7zVersion.h"
-#include "../../../../C/Alloc.h"
-#include "../../../../C/LzmaUtil/Lzma86Dec.h"
-#include "../../../../C/LzmaUtil/Lzma86Enc.h"
-
-using namespace NCommandLineParser;
-
-#ifdef _WIN32
-bool g_IsNT = false;
-static inline bool IsItWindowsNT()
-{
- OSVERSIONINFO versionInfo;
- versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
- return false;
- return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-#endif
-
-static const char *kCantAllocate = "Can not allocate memory";
-static const char *kReadError = "Read error";
-static const char *kWriteError = "Write error";
-
-namespace NKey {
-enum Enum
-{
- kHelp1 = 0,
- kHelp2,
- kAlgo,
- kDict,
- kFb,
- kMc,
- kLc,
- kLp,
- kPb,
- kMatchFinder,
- kMultiThread,
- kEOS,
- kStdIn,
- kStdOut,
- kFilter86
-};
-}
-
-static const CSwitchForm kSwitchForms[] =
-{
- { L"?", NSwitchType::kSimple, false },
- { L"H", NSwitchType::kSimple, false },
- { L"A", NSwitchType::kUnLimitedPostString, false, 1 },
- { L"D", NSwitchType::kUnLimitedPostString, false, 1 },
- { L"FB", NSwitchType::kUnLimitedPostString, false, 1 },
- { L"MC", NSwitchType::kUnLimitedPostString, false, 1 },
- { L"LC", NSwitchType::kUnLimitedPostString, false, 1 },
- { L"LP", NSwitchType::kUnLimitedPostString, false, 1 },
- { L"PB", NSwitchType::kUnLimitedPostString, false, 1 },
- { L"MF", NSwitchType::kUnLimitedPostString, false, 1 },
- { L"MT", NSwitchType::kUnLimitedPostString, false, 0 },
- { L"EOS", NSwitchType::kSimple, false },
- { L"SI", NSwitchType::kSimple, false },
- { L"SO", NSwitchType::kSimple, false },
- { L"F86", NSwitchType::kPostChar, false, 0, 0, L"+" }
-};
-
-static const int kNumSwitches = sizeof(kSwitchForms) / sizeof(kSwitchForms[0]);
-
-static void PrintHelp()
-{
- fprintf(stderr, "\nUsage: LZMA <e|d> inputFile outputFile [<switches>...]\n"
- " e: encode file\n"
- " d: decode file\n"
- " b: Benchmark\n"
- "<Switches>\n"
- " -a{N}: set compression mode - [0, 1], default: 1 (max)\n"
- " -d{N}: set dictionary size - [12, 30], default: 23 (8MB)\n"
- " -fb{N}: set number of fast bytes - [5, 273], default: 128\n"
- " -mc{N}: set number of cycles for match finder\n"
- " -lc{N}: set number of literal context bits - [0, 8], default: 3\n"
- " -lp{N}: set number of literal pos bits - [0, 4], default: 0\n"
- " -pb{N}: set number of pos bits - [0, 4], default: 2\n"
- " -mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, hc4], default: bt4\n"
- " -mt{N}: set number of CPU threads\n"
- " -eos: write End Of Stream marker\n"
- " -si: read data from stdin\n"
- " -so: write data to stdout\n"
- );
-}
-
-static void PrintHelpAndExit(const char *s)
-{
- fprintf(stderr, "\nError: %s\n\n", s);
- PrintHelp();
- throw -1;
-}
-
-static void IncorrectCommand()
-{
- PrintHelpAndExit("Incorrect command");
-}
-
-static void WriteArgumentsToStringList(int numArguments, const char *arguments[],
- UStringVector &strings)
-{
- for(int i = 1; i < numArguments; i++)
- strings.Add(MultiByteToUnicodeString(arguments[i]));
-}
-
-static bool GetNumber(const wchar_t *s, UInt32 &value)
-{
- value = 0;
- if (MyStringLen(s) == 0)
- return false;
- const wchar_t *end;
- UInt64 res = ConvertStringToUInt64(s, &end);
- if (*end != L'\0')
- return false;
- if (res > 0xFFFFFFFF)
- return false;
- value = UInt32(res);
- return true;
-}
-
-static void ParseUInt32(const CParser &parser, int index, UInt32 &res)
-{
- if (parser[index].ThereIs)
- if (!GetNumber(parser[index].PostStrings[0], res))
- IncorrectCommand();
-}
-
-int main2(int n, const char *args[])
-{
- #ifdef _WIN32
- g_IsNT = IsItWindowsNT();
- #endif
-
- fprintf(stderr, "\nLZMA " MY_VERSION_COPYRIGHT_DATE "\n");
-
- if (n == 1)
- {
- PrintHelp();
- return 0;
- }
-
- bool unsupportedTypes = (sizeof(Byte) != 1 || sizeof(UInt32) < 4 || sizeof(UInt64) < 4);
- if (unsupportedTypes)
- {
- fprintf(stderr, "Unsupported base types. Edit Common/Types.h and recompile");
- return 1;
- }
-
- UStringVector commandStrings;
- WriteArgumentsToStringList(n, args, commandStrings);
- CParser parser(kNumSwitches);
- try
- {
- parser.ParseStrings(kSwitchForms, commandStrings);
- }
- catch(...)
- {
- IncorrectCommand();
- }
-
- if(parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs)
- {
- PrintHelp();
- return 0;
- }
- const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
-
- int paramIndex = 0;
- if (paramIndex >= nonSwitchStrings.Size())
- IncorrectCommand();
- const UString &command = nonSwitchStrings[paramIndex++];
-
- bool dictDefined = false;
- UInt32 dict = (UInt32)-1;
- if(parser[NKey::kDict].ThereIs)
- {
- UInt32 dicLog;
- if (!GetNumber(parser[NKey::kDict].PostStrings[0], dicLog))
- IncorrectCommand();
- dict = 1 << dicLog;
- dictDefined = true;
- }
- UString mf = L"BT4";
- if (parser[NKey::kMatchFinder].ThereIs)
- mf = parser[NKey::kMatchFinder].PostStrings[0];
-
- UInt32 numThreads = (UInt32)-1;
-
- #ifdef COMPRESS_MF_MT
- if (parser[NKey::kMultiThread].ThereIs)
- {
- UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors();
- const UString &s = parser[NKey::kMultiThread].PostStrings[0];
- if (s.IsEmpty())
- numThreads = numCPUs;
- else
- if (!GetNumber(s, numThreads))
- IncorrectCommand();
- }
- #endif
-
- if (command.CompareNoCase(L"b") == 0)
- {
- const UInt32 kNumDefaultItereations = 1;
- UInt32 numIterations = kNumDefaultItereations;
- {
- if (paramIndex < nonSwitchStrings.Size())
- if (!GetNumber(nonSwitchStrings[paramIndex++], numIterations))
- numIterations = kNumDefaultItereations;
- }
- return LzmaBenchCon(stderr, numIterations, numThreads, dict);
- }
-
- if (numThreads == (UInt32)-1)
- numThreads = 1;
-
- bool encodeMode = false;
- if (command.CompareNoCase(L"e") == 0)
- encodeMode = true;
- else if (command.CompareNoCase(L"d") == 0)
- encodeMode = false;
- else
- IncorrectCommand();
-
- bool stdInMode = parser[NKey::kStdIn].ThereIs;
- bool stdOutMode = parser[NKey::kStdOut].ThereIs;
-
- CMyComPtr<ISequentialInStream> inStream;
- CInFileStream *inStreamSpec = 0;
- if (stdInMode)
- {
- inStream = new CStdInFileStream;
- MY_SET_BINARY_MODE(stdin);
- }
- else
- {
- if (paramIndex >= nonSwitchStrings.Size())
- IncorrectCommand();
- const UString &inputName = nonSwitchStrings[paramIndex++];
- inStreamSpec = new CInFileStream;
- inStream = inStreamSpec;
- if (!inStreamSpec->Open(GetSystemString(inputName)))
- {
- fprintf(stderr, "\nError: can not open input file %s\n",
- (const char *)GetOemString(inputName));
- return 1;
- }
- }
-
- CMyComPtr<ISequentialOutStream> outStream;
- COutFileStream *outStreamSpec = NULL;
- if (stdOutMode)
- {
- outStream = new CStdOutFileStream;
- MY_SET_BINARY_MODE(stdout);
- }
- else
- {
- if (paramIndex >= nonSwitchStrings.Size())
- IncorrectCommand();
- const UString &outputName = nonSwitchStrings[paramIndex++];
- outStreamSpec = new COutFileStream;
- outStream = outStreamSpec;
- if (!outStreamSpec->Create(GetSystemString(outputName), true))
- {
- fprintf(stderr, "\nError: can not open output file %s\n",
- (const char *)GetOemString(outputName));
- return 1;
- }
- }
-
- if (parser[NKey::kFilter86].ThereIs)
- {
- // -f86 switch is for x86 filtered mode: BCJ + LZMA.
- if (parser[NKey::kEOS].ThereIs || stdInMode)
- throw "Can not use stdin in this mode";
- UInt64 fileSize;
- inStreamSpec->File.GetLength(fileSize);
- if (fileSize > 0xF0000000)
- throw "File is too big";
- size_t inSize = (size_t)fileSize;
- Byte *inBuffer = 0;
- if (inSize != 0)
- {
- inBuffer = (Byte *)MyAlloc((size_t)inSize);
- if (inBuffer == 0)
- throw kCantAllocate;
- }
-
- if (ReadStream_FAIL(inStream, inBuffer, inSize) != S_OK)
- throw "Can not read";
-
- Byte *outBuffer = 0;
- size_t outSize;
- if (encodeMode)
- {
- // we allocate 105% of original size for output buffer
- outSize = (size_t)fileSize / 20 * 21 + (1 << 16);
- if (outSize != 0)
- {
- outBuffer = (Byte *)MyAlloc((size_t)outSize);
- if (outBuffer == 0)
- throw kCantAllocate;
- }
- if (!dictDefined)
- dict = 1 << 23;
- int res = Lzma86_Encode(outBuffer, &outSize, inBuffer, inSize,
- 5, dict, parser[NKey::kFilter86].PostCharIndex == 0 ? SZ_FILTER_YES : SZ_FILTER_AUTO);
- if (res != 0)
- {
- fprintf(stderr, "\nEncoder error = %d\n", (int)res);
- return 1;
- }
- }
- else
- {
- UInt64 outSize64;
- if (Lzma86_GetUnpackSize(inBuffer, inSize, &outSize64) != 0)
- throw "data error";
- outSize = (size_t)outSize64;
- if (outSize != outSize64)
- throw "too big";
- if (outSize != 0)
- {
- outBuffer = (Byte *)MyAlloc(outSize);
- if (outBuffer == 0)
- throw kCantAllocate;
- }
- int res = Lzma86_Decode(outBuffer, &outSize, inBuffer, &inSize);
- if (inSize != (size_t)fileSize)
- throw "incorrect processed size";
- if (res != 0)
- throw "LzmaDecoder error";
- }
- if (WriteStream(outStream, outBuffer, outSize) != S_OK)
- throw kWriteError;
- MyFree(outBuffer);
- MyFree(inBuffer);
- return 0;
- }
-
-
- UInt64 fileSize;
- if (encodeMode)
- {
- NCompress::NLzma::CEncoder *encoderSpec = new NCompress::NLzma::CEncoder;
- CMyComPtr<ICompressCoder> encoder = encoderSpec;
-
- if (!dictDefined)
- dict = 1 << 23;
-
- UInt32 pb = 2;
- UInt32 lc = 3; // = 0; for 32-bit data
- UInt32 lp = 0; // = 2; for 32-bit data
- UInt32 algo = 1;
- UInt32 fb = 128;
- UInt32 mc = 16 + fb / 2;
- bool mcDefined = false;
-
- bool eos = parser[NKey::kEOS].ThereIs || stdInMode;
-
- ParseUInt32(parser, NKey::kAlgo, algo);
- ParseUInt32(parser, NKey::kFb, fb);
- ParseUInt32(parser, NKey::kLc, lc);
- ParseUInt32(parser, NKey::kLp, lp);
- ParseUInt32(parser, NKey::kPb, pb);
-
- mcDefined = parser[NKey::kMc].ThereIs;
- if (mcDefined)
- if (!GetNumber(parser[NKey::kMc].PostStrings[0], mc))
- IncorrectCommand();
-
- PROPID propIDs[] =
- {
- NCoderPropID::kDictionarySize,
- NCoderPropID::kPosStateBits,
- NCoderPropID::kLitContextBits,
- NCoderPropID::kLitPosBits,
- NCoderPropID::kAlgorithm,
- NCoderPropID::kNumFastBytes,
- NCoderPropID::kMatchFinder,
- NCoderPropID::kEndMarker,
- NCoderPropID::kNumThreads,
- NCoderPropID::kMatchFinderCycles,
- };
- const int kNumPropsMax = sizeof(propIDs) / sizeof(propIDs[0]);
-
- PROPVARIANT props[kNumPropsMax];
- for (int p = 0; p < 6; p++)
- props[p].vt = VT_UI4;
-
- props[0].ulVal = (UInt32)dict;
- props[1].ulVal = (UInt32)pb;
- props[2].ulVal = (UInt32)lc;
- props[3].ulVal = (UInt32)lp;
- props[4].ulVal = (UInt32)algo;
- props[5].ulVal = (UInt32)fb;
-
- props[6].vt = VT_BSTR;
- props[6].bstrVal = (BSTR)(const wchar_t *)mf;
-
- props[7].vt = VT_BOOL;
- props[7].boolVal = eos ? VARIANT_TRUE : VARIANT_FALSE;
-
- props[8].vt = VT_UI4;
- props[8].ulVal = (UInt32)numThreads;
-
- // it must be last in property list
- props[9].vt = VT_UI4;
- props[9].ulVal = (UInt32)mc;
-
- int numProps = kNumPropsMax;
- if (!mcDefined)
- numProps--;
-
- if (encoderSpec->SetCoderProperties(propIDs, props, numProps) != S_OK)
- IncorrectCommand();
- encoderSpec->WriteCoderProperties(outStream);
-
- if (eos || stdInMode)
- fileSize = (UInt64)(Int64)-1;
- else
- inStreamSpec->File.GetLength(fileSize);
-
- for (int i = 0; i < 8; i++)
- {
- Byte b = Byte(fileSize >> (8 * i));
- if (outStream->Write(&b, 1, 0) != S_OK)
- {
- fprintf(stderr, kWriteError);
- return 1;
- }
- }
- HRESULT result = encoder->Code(inStream, outStream, 0, 0, 0);
- if (result == E_OUTOFMEMORY)
- {
- fprintf(stderr, "\nError: Can not allocate memory\n");
- return 1;
- }
- else if (result != S_OK)
- {
- fprintf(stderr, "\nEncoder error = %X\n", (unsigned int)result);
- return 1;
- }
- }
- else
- {
- NCompress::NLzma::CDecoder *decoderSpec = new NCompress::NLzma::CDecoder;
- CMyComPtr<ICompressCoder> decoder = decoderSpec;
- decoderSpec->FinishStream = true;
- const UInt32 kPropertiesSize = 5;
- Byte header[kPropertiesSize + 8];
- if (ReadStream_FALSE(inStream, header, kPropertiesSize + 8) != S_OK)
- {
- fprintf(stderr, kReadError);
- return 1;
- }
- if (decoderSpec->SetDecoderProperties2(header, kPropertiesSize) != S_OK)
- {
- fprintf(stderr, "SetDecoderProperties error");
- return 1;
- }
- fileSize = 0;
- for (int i = 0; i < 8; i++)
- fileSize |= ((UInt64)header[kPropertiesSize + i]) << (8 * i);
-
- if (decoder->Code(inStream, outStream, 0, (fileSize == (UInt64)(Int64)-1) ? 0 : &fileSize, 0) != S_OK)
- {
- fprintf(stderr, "Decoder error");
- return 1;
- }
- }
- if (outStreamSpec != NULL)
- {
- if (outStreamSpec->Close() != S_OK)
- {
- fprintf(stderr, "File closing error");
- return 1;
- }
- }
- return 0;
-}
-
-int MY_CDECL main(int n, const char *args[])
-{
- try { return main2(n, args); }
- catch(const char *s)
- {
- fprintf(stderr, "\nError: %s\n", s);
- return 1;
- }
- catch(...)
- {
- fprintf(stderr, "\nError\n");
- return 1;
- }
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp
deleted file mode 100644
index f9cc0f87d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp
+++ /dev/null
@@ -1,1018 +0,0 @@
-// LzmaBench.cpp
-
-#include "StdAfx.h"
-
-#include "LzmaBench.h"
-
-#ifndef _WIN32
-#define USE_POSIX_TIME
-#define USE_POSIX_TIME2
-#endif
-
-#ifdef USE_POSIX_TIME
-#include <time.h>
-#ifdef USE_POSIX_TIME2
-#include <sys/time.h>
-#endif
-#endif
-
-#ifdef _WIN32
-#define USE_ALLOCA
-#endif
-
-#ifdef USE_ALLOCA
-#ifdef _WIN32
-#include <malloc.h>
-#else
-#include <stdlib.h>
-#endif
-#endif
-
-#include "../../../../C/7zCrc.h"
-#include "../../../../C/Alloc.h"
-
-#include "../../../Common/MyCom.h"
-
-#ifdef BENCH_MT
-#include "../../../Windows/Synchronization.h"
-#include "../../../Windows/Thread.h"
-#endif
-
-#ifdef EXTERNAL_LZMA
-#include "../../../Windows/PropVariant.h"
-#include "../../ICoder.h"
-#else
-#include "../LzmaDecoder.h"
-#include "../LzmaEncoder.h"
-#endif
-
-static const UInt32 kUncompressMinBlockSize = 1 << 26;
-static const UInt32 kAdditionalSize = (1 << 16);
-static const UInt32 kCompressedAdditionalSize = (1 << 10);
-static const UInt32 kMaxLzmaPropSize = 5;
-
-class CBaseRandomGenerator
-{
- UInt32 A1;
- UInt32 A2;
-public:
- CBaseRandomGenerator() { Init(); }
- void Init() { A1 = 362436069; A2 = 521288629;}
- UInt32 GetRnd()
- {
- return
- ((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) +
- ((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)) );
- }
-};
-
-class CBenchBuffer
-{
-public:
- size_t BufferSize;
- Byte *Buffer;
- CBenchBuffer(): Buffer(0) {}
- virtual ~CBenchBuffer() { Free(); }
- void Free()
- {
- ::MidFree(Buffer);
- Buffer = 0;
- }
- bool Alloc(size_t bufferSize)
- {
- if (Buffer != 0 && BufferSize == bufferSize)
- return true;
- Free();
- Buffer = (Byte *)::MidAlloc(bufferSize);
- BufferSize = bufferSize;
- return (Buffer != 0);
- }
-};
-
-class CBenchRandomGenerator: public CBenchBuffer
-{
- CBaseRandomGenerator *RG;
-public:
- void Set(CBaseRandomGenerator *rg) { RG = rg; }
- UInt32 GetVal(UInt32 &res, int numBits)
- {
- UInt32 val = res & (((UInt32)1 << numBits) - 1);
- res >>= numBits;
- return val;
- }
- UInt32 GetLen(UInt32 &res)
- {
- UInt32 len = GetVal(res, 2);
- return GetVal(res, 1 + len);
- }
- void Generate()
- {
- UInt32 pos = 0;
- UInt32 rep0 = 1;
- while (pos < BufferSize)
- {
- UInt32 res = RG->GetRnd();
- res >>= 1;
- if (GetVal(res, 1) == 0 || pos < 1024)
- Buffer[pos++] = (Byte)(res & 0xFF);
- else
- {
- UInt32 len;
- len = 1 + GetLen(res);
- if (GetVal(res, 3) != 0)
- {
- len += GetLen(res);
- do
- {
- UInt32 ppp = GetVal(res, 5) + 6;
- res = RG->GetRnd();
- if (ppp > 30)
- continue;
- rep0 = /* (1 << ppp) +*/ GetVal(res, ppp);
- res = RG->GetRnd();
- }
- while (rep0 >= pos);
- rep0++;
- }
-
- for (UInt32 i = 0; i < len && pos < BufferSize; i++, pos++)
- Buffer[pos] = Buffer[pos - rep0];
- }
- }
- }
-};
-
-
-class CBenchmarkInStream:
- public ISequentialInStream,
- public CMyUnknownImp
-{
- const Byte *Data;
- size_t Pos;
- size_t Size;
-public:
- MY_UNKNOWN_IMP
- void Init(const Byte *data, size_t size)
- {
- Data = data;
- Size = size;
- Pos = 0;
- }
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- size_t remain = Size - Pos;
- UInt32 kMaxBlockSize = (1 << 20);
- if (size > kMaxBlockSize)
- size = kMaxBlockSize;
- if (size > remain)
- size = (UInt32)remain;
- for (UInt32 i = 0; i < size; i++)
- ((Byte *)data)[i] = Data[Pos + i];
- Pos += size;
- if(processedSize != NULL)
- *processedSize = size;
- return S_OK;
-}
-
-class CBenchmarkOutStream:
- public ISequentialOutStream,
- public CBenchBuffer,
- public CMyUnknownImp
-{
- // bool _overflow;
-public:
- UInt32 Pos;
- // CBenchmarkOutStream(): _overflow(false) {}
- void Init()
- {
- // _overflow = false;
- Pos = 0;
- }
- MY_UNKNOWN_IMP
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- size_t curSize = BufferSize - Pos;
- if (curSize > size)
- curSize = size;
- memcpy(Buffer + Pos, data, curSize);
- Pos += (UInt32)curSize;
- if(processedSize != NULL)
- *processedSize = (UInt32)curSize;
- if (curSize != size)
- {
- // _overflow = true;
- return E_FAIL;
- }
- return S_OK;
-}
-
-class CCrcOutStream:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
-public:
- UInt32 Crc;
- MY_UNKNOWN_IMP
- void Init() { Crc = CRC_INIT_VAL; }
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-STDMETHODIMP CCrcOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- Crc = CrcUpdate(Crc, data, size);
- if (processedSize != NULL)
- *processedSize = size;
- return S_OK;
-}
-
-static UInt64 GetTimeCount()
-{
- #ifdef USE_POSIX_TIME
- #ifdef USE_POSIX_TIME2
- timeval v;
- if (gettimeofday(&v, 0) == 0)
- return (UInt64)(v.tv_sec) * 1000000 + v.tv_usec;
- return (UInt64)time(NULL) * 1000000;
- #else
- return time(NULL);
- #endif
- #else
- /*
- LARGE_INTEGER value;
- if (::QueryPerformanceCounter(&value))
- return value.QuadPart;
- */
- return GetTickCount();
- #endif
-}
-
-static UInt64 GetFreq()
-{
- #ifdef USE_POSIX_TIME
- #ifdef USE_POSIX_TIME2
- return 1000000;
- #else
- return 1;
- #endif
- #else
- /*
- LARGE_INTEGER value;
- if (::QueryPerformanceFrequency(&value))
- return value.QuadPart;
- */
- return 1000;
- #endif
-}
-
-#ifndef USE_POSIX_TIME
-static inline UInt64 GetTime64(const FILETIME &t) { return ((UInt64)t.dwHighDateTime << 32) | t.dwLowDateTime; }
-#endif
-static UInt64 GetUserTime()
-{
- #ifdef USE_POSIX_TIME
- return clock();
- #else
- FILETIME creationTime, exitTime, kernelTime, userTime;
- if (::GetProcessTimes(::GetCurrentProcess(), &creationTime, &exitTime, &kernelTime, &userTime) != 0)
- return GetTime64(userTime) + GetTime64(kernelTime);
- return (UInt64)GetTickCount() * 10000;
- #endif
-}
-
-static UInt64 GetUserFreq()
-{
- #ifdef USE_POSIX_TIME
- return CLOCKS_PER_SEC;
- #else
- return 10000000;
- #endif
-}
-
-class CBenchProgressStatus
-{
- #ifdef BENCH_MT
- NWindows::NSynchronization::CCriticalSection CS;
- #endif
-public:
- HRESULT Res;
- bool EncodeMode;
- void SetResult(HRESULT res)
- {
- #ifdef BENCH_MT
- NWindows::NSynchronization::CCriticalSectionLock lock(CS);
- #endif
- Res = res;
- }
- HRESULT GetResult()
- {
- #ifdef BENCH_MT
- NWindows::NSynchronization::CCriticalSectionLock lock(CS);
- #endif
- return Res;
- }
-};
-
-class CBenchProgressInfo:
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
-public:
- CBenchProgressStatus *Status;
- CBenchInfo BenchInfo;
- HRESULT Res;
- IBenchCallback *callback;
- CBenchProgressInfo(): callback(0) {}
- MY_UNKNOWN_IMP
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-void SetStartTime(CBenchInfo &bi)
-{
- bi.GlobalFreq = GetFreq();
- bi.UserFreq = GetUserFreq();
- bi.GlobalTime = ::GetTimeCount();
- bi.UserTime = ::GetUserTime();
-}
-
-void SetFinishTime(const CBenchInfo &biStart, CBenchInfo &dest)
-{
- dest.GlobalFreq = GetFreq();
- dest.UserFreq = GetUserFreq();
- dest.GlobalTime = ::GetTimeCount() - biStart.GlobalTime;
- dest.UserTime = ::GetUserTime() - biStart.UserTime;
-}
-
-STDMETHODIMP CBenchProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
- HRESULT res = Status->GetResult();
- if (res != S_OK)
- return res;
- if (!callback)
- return res;
- CBenchInfo info = BenchInfo;
- SetFinishTime(BenchInfo, info);
- if (Status->EncodeMode)
- {
- info.UnpackSize = *inSize;
- info.PackSize = *outSize;
- res = callback->SetEncodeResult(info, false);
- }
- else
- {
- info.PackSize = BenchInfo.PackSize + *inSize;
- info.UnpackSize = BenchInfo.UnpackSize + *outSize;
- res = callback->SetDecodeResult(info, false);
- }
- if (res != S_OK)
- Status->SetResult(res);
- return res;
-}
-
-static const int kSubBits = 8;
-
-static UInt32 GetLogSize(UInt32 size)
-{
- for (int i = kSubBits; i < 32; i++)
- for (UInt32 j = 0; j < (1 << kSubBits); j++)
- if (size <= (((UInt32)1) << i) + (j << (i - kSubBits)))
- return (i << kSubBits) + j;
- return (32 << kSubBits);
-}
-
-static void NormalizeVals(UInt64 &v1, UInt64 &v2)
-{
- while (v1 > 1000000)
- {
- v1 >>= 1;
- v2 >>= 1;
- }
-}
-
-UInt64 GetUsage(const CBenchInfo &info)
-{
- UInt64 userTime = info.UserTime;
- UInt64 userFreq = info.UserFreq;
- UInt64 globalTime = info.GlobalTime;
- UInt64 globalFreq = info.GlobalFreq;
- NormalizeVals(userTime, userFreq);
- NormalizeVals(globalFreq, globalTime);
- if (userFreq == 0)
- userFreq = 1;
- if (globalTime == 0)
- globalTime = 1;
- return userTime * globalFreq * 1000000 / userFreq / globalTime;
-}
-
-UInt64 GetRatingPerUsage(const CBenchInfo &info, UInt64 rating)
-{
- UInt64 userTime = info.UserTime;
- UInt64 userFreq = info.UserFreq;
- UInt64 globalTime = info.GlobalTime;
- UInt64 globalFreq = info.GlobalFreq;
- NormalizeVals(userFreq, userTime);
- NormalizeVals(globalTime, globalFreq);
- if (globalFreq == 0)
- globalFreq = 1;
- if (userTime == 0)
- userTime = 1;
- return userFreq * globalTime / globalFreq * rating / userTime;
-}
-
-static UInt64 MyMultDiv64(UInt64 value, UInt64 elapsedTime, UInt64 freq)
-{
- UInt64 elTime = elapsedTime;
- NormalizeVals(freq, elTime);
- if (elTime == 0)
- elTime = 1;
- return value * freq / elTime;
-}
-
-UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 freq, UInt64 size)
-{
- UInt64 t = GetLogSize(dictionarySize) - (kBenchMinDicLogSize << kSubBits);
- UInt64 numCommandsForOne = 870 + ((t * t * 5) >> (2 * kSubBits));
- UInt64 numCommands = (UInt64)(size) * numCommandsForOne;
- return MyMultDiv64(numCommands, elapsedTime, freq);
-}
-
-UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations)
-{
- UInt64 numCommands = (inSize * 200 + outSize * 4) * numIterations;
- return MyMultDiv64(numCommands, elapsedTime, freq);
-}
-
-#ifdef EXTERNAL_LZMA
-typedef UInt32 (WINAPI * CreateObjectPointer)(const GUID *clsID,
- const GUID *interfaceID, void **outObject);
-#endif
-
-struct CEncoderInfo;
-
-struct CEncoderInfo
-{
- #ifdef BENCH_MT
- NWindows::CThread thread[2];
- #endif
- CMyComPtr<ICompressCoder> encoder;
- CBenchProgressInfo *progressInfoSpec[2];
- CMyComPtr<ICompressProgressInfo> progressInfo[2];
- UInt32 NumIterations;
- #ifdef USE_ALLOCA
- size_t AllocaSize;
- #endif
-
- struct CDecoderInfo
- {
- CEncoderInfo *Encoder;
- UInt32 DecoderIndex;
- #ifdef USE_ALLOCA
- size_t AllocaSize;
- #endif
- bool CallbackMode;
- };
- CDecoderInfo decodersInfo[2];
-
- CMyComPtr<ICompressCoder> decoders[2];
- HRESULT Results[2];
- CBenchmarkOutStream *outStreamSpec;
- CMyComPtr<ISequentialOutStream> outStream;
- IBenchCallback *callback;
- UInt32 crc;
- UInt32 kBufferSize;
- UInt32 compressedSize;
- CBenchRandomGenerator rg;
- CBenchmarkOutStream *propStreamSpec;
- CMyComPtr<ISequentialOutStream> propStream;
- HRESULT Init(UInt32 dictionarySize, UInt32 numThreads, CBaseRandomGenerator *rg);
- HRESULT Encode();
- HRESULT Decode(UInt32 decoderIndex);
-
- CEncoderInfo(): outStreamSpec(0), callback(0), propStreamSpec(0) {}
-
- #ifdef BENCH_MT
- static THREAD_FUNC_DECL EncodeThreadFunction(void *param)
- {
- CEncoderInfo *encoder = (CEncoderInfo *)param;
- #ifdef USE_ALLOCA
- alloca(encoder->AllocaSize);
- #endif
- HRESULT res = encoder->Encode();
- encoder->Results[0] = res;
- if (res != S_OK)
- encoder->progressInfoSpec[0]->Status->SetResult(res);
-
- return 0;
- }
- static THREAD_FUNC_DECL DecodeThreadFunction(void *param)
- {
- CDecoderInfo *decoder = (CDecoderInfo *)param;
- #ifdef USE_ALLOCA
- alloca(decoder->AllocaSize);
- #endif
- CEncoderInfo *encoder = decoder->Encoder;
- encoder->Results[decoder->DecoderIndex] = encoder->Decode(decoder->DecoderIndex);
- return 0;
- }
-
- HRESULT CreateEncoderThread()
- {
- return thread[0].Create(EncodeThreadFunction, this);
- }
-
- HRESULT CreateDecoderThread(int index, bool callbackMode
- #ifdef USE_ALLOCA
- , size_t allocaSize
- #endif
- )
- {
- CDecoderInfo &decoder = decodersInfo[index];
- decoder.DecoderIndex = index;
- decoder.Encoder = this;
- #ifdef USE_ALLOCA
- decoder.AllocaSize = allocaSize;
- #endif
- decoder.CallbackMode = callbackMode;
- return thread[index].Create(DecodeThreadFunction, &decoder);
- }
- #endif
-};
-
-HRESULT CEncoderInfo::Init(UInt32 dictionarySize, UInt32 numThreads, CBaseRandomGenerator *rgLoc)
-{
- rg.Set(rgLoc);
- kBufferSize = dictionarySize + kAdditionalSize;
- UInt32 kCompressedBufferSize = (kBufferSize / 2) + kCompressedAdditionalSize;
- if (!rg.Alloc(kBufferSize))
- return E_OUTOFMEMORY;
- rg.Generate();
- crc = CrcCalc(rg.Buffer, rg.BufferSize);
-
- outStreamSpec = new CBenchmarkOutStream;
- if (!outStreamSpec->Alloc(kCompressedBufferSize))
- return E_OUTOFMEMORY;
-
- outStream = outStreamSpec;
-
- propStreamSpec = 0;
- if (!propStream)
- {
- propStreamSpec = new CBenchmarkOutStream;
- propStream = propStreamSpec;
- }
- if (!propStreamSpec->Alloc(kMaxLzmaPropSize))
- return E_OUTOFMEMORY;
- propStreamSpec->Init();
-
- PROPID propIDs[] =
- {
- NCoderPropID::kDictionarySize,
- NCoderPropID::kNumThreads
- };
- const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]);
- PROPVARIANT props[kNumProps];
- props[0].vt = VT_UI4;
- props[0].ulVal = dictionarySize;
-
- props[1].vt = VT_UI4;
- props[1].ulVal = numThreads;
-
- {
- CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
- RINOK(encoder.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties));
- if (!setCoderProperties)
- return E_FAIL;
- RINOK(setCoderProperties->SetCoderProperties(propIDs, props, kNumProps));
-
- CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
- encoder.QueryInterface(IID_ICompressWriteCoderProperties, &writeCoderProperties);
- if (writeCoderProperties)
- {
- RINOK(writeCoderProperties->WriteCoderProperties(propStream));
- }
- }
- return S_OK;
-}
-
-HRESULT CEncoderInfo::Encode()
-{
- CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
- CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
- inStreamSpec->Init(rg.Buffer, rg.BufferSize);
- outStreamSpec->Init();
-
- RINOK(encoder->Code(inStream, outStream, 0, 0, progressInfo[0]));
- compressedSize = outStreamSpec->Pos;
- encoder.Release();
- return S_OK;
-}
-
-HRESULT CEncoderInfo::Decode(UInt32 decoderIndex)
-{
- CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream;
- CMyComPtr<ISequentialInStream> inStream = inStreamSpec;
- CMyComPtr<ICompressCoder> &decoder = decoders[decoderIndex];
-
- CMyComPtr<ICompressSetDecoderProperties2> compressSetDecoderProperties;
- decoder.QueryInterface(IID_ICompressSetDecoderProperties2, &compressSetDecoderProperties);
- if (!compressSetDecoderProperties)
- return E_FAIL;
-
- CCrcOutStream *crcOutStreamSpec = new CCrcOutStream;
- CMyComPtr<ISequentialOutStream> crcOutStream = crcOutStreamSpec;
-
- CBenchProgressInfo *pi = progressInfoSpec[decoderIndex];
- pi->BenchInfo.UnpackSize = 0;
- pi->BenchInfo.PackSize = 0;
-
- for (UInt32 j = 0; j < NumIterations; j++)
- {
- inStreamSpec->Init(outStreamSpec->Buffer, compressedSize);
- crcOutStreamSpec->Init();
-
- RINOK(compressSetDecoderProperties->SetDecoderProperties2(propStreamSpec->Buffer, propStreamSpec->Pos));
- UInt64 outSize = kBufferSize;
- RINOK(decoder->Code(inStream, crcOutStream, 0, &outSize, progressInfo[decoderIndex]));
- if (CRC_GET_DIGEST(crcOutStreamSpec->Crc) != crc)
- return S_FALSE;
- pi->BenchInfo.UnpackSize += kBufferSize;
- pi->BenchInfo.PackSize += compressedSize;
- }
- decoder.Release();
- return S_OK;
-}
-
-static const UInt32 kNumThreadsMax = (1 << 16);
-
-struct CBenchEncoders
-{
- CEncoderInfo *encoders;
- CBenchEncoders(UInt32 num): encoders(0) { encoders = new CEncoderInfo[num]; }
- ~CBenchEncoders() { delete []encoders; }
-};
-
-HRESULT LzmaBench(
- #ifdef EXTERNAL_LZMA
- CCodecs *codecs,
- #endif
- UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback)
-{
- UInt32 numEncoderThreads =
- #ifdef BENCH_MT
- (numThreads > 1 ? numThreads / 2 : 1);
- #else
- 1;
- #endif
- UInt32 numSubDecoderThreads =
- #ifdef BENCH_MT
- (numThreads > 1 ? 2 : 1);
- #else
- 1;
- #endif
- if (dictionarySize < (1 << kBenchMinDicLogSize) || numThreads < 1 || numEncoderThreads > kNumThreadsMax)
- {
- return E_INVALIDARG;
- }
-
- CBenchEncoders encodersSpec(numEncoderThreads);
- CEncoderInfo *encoders = encodersSpec.encoders;
-
- #ifdef EXTERNAL_LZMA
- UString name = L"LZMA";
- #endif
-
- UInt32 i;
- for (i = 0; i < numEncoderThreads; i++)
- {
- CEncoderInfo &encoder = encoders[i];
- encoder.callback = (i == 0) ? callback : 0;
-
- #ifdef EXTERNAL_LZMA
- RINOK(codecs->CreateCoder(name, true, encoder.encoder));
- #else
- encoder.encoder = new NCompress::NLzma::CEncoder;
- #endif
- for (UInt32 j = 0; j < numSubDecoderThreads; j++)
- {
- #ifdef EXTERNAL_LZMA
- RINOK(codecs->CreateCoder(name, false, encoder.decoders[j]));
- #else
- encoder.decoders[j] = new NCompress::NLzma::CDecoder;
- #endif
- }
- }
-
- CBaseRandomGenerator rg;
- rg.Init();
- for (i = 0; i < numEncoderThreads; i++)
- {
- RINOK(encoders[i].Init(dictionarySize, numThreads, &rg));
- }
-
- CBenchProgressStatus status;
- status.Res = S_OK;
- status.EncodeMode = true;
-
- for (i = 0; i < numEncoderThreads; i++)
- {
- CEncoderInfo &encoder = encoders[i];
- for (int j = 0; j < 2; j++)
- {
- encoder.progressInfo[j] = encoder.progressInfoSpec[j] = new CBenchProgressInfo;
- encoder.progressInfoSpec[j]->Status = &status;
- }
- if (i == 0)
- {
- encoder.progressInfoSpec[0]->callback = callback;
- encoder.progressInfoSpec[0]->BenchInfo.NumIterations = numEncoderThreads;
- SetStartTime(encoder.progressInfoSpec[0]->BenchInfo);
- }
-
- #ifdef BENCH_MT
- if (numEncoderThreads > 1)
- {
- #ifdef USE_ALLOCA
- encoder.AllocaSize = (i * 16 * 21) & 0x7FF;
- #endif
- RINOK(encoder.CreateEncoderThread())
- }
- else
- #endif
- {
- RINOK(encoder.Encode());
- }
- }
- #ifdef BENCH_MT
- if (numEncoderThreads > 1)
- for (i = 0; i < numEncoderThreads; i++)
- encoders[i].thread[0].Wait();
- #endif
-
- RINOK(status.Res);
-
- CBenchInfo info;
-
- SetFinishTime(encoders[0].progressInfoSpec[0]->BenchInfo, info);
- info.UnpackSize = 0;
- info.PackSize = 0;
- info.NumIterations = 1; // progressInfoSpec->NumIterations;
- for (i = 0; i < numEncoderThreads; i++)
- {
- CEncoderInfo &encoder = encoders[i];
- info.UnpackSize += encoder.kBufferSize;
- info.PackSize += encoder.compressedSize;
- }
- RINOK(callback->SetEncodeResult(info, true));
-
-
- status.Res = S_OK;
- status.EncodeMode = false;
-
- UInt32 numDecoderThreads = numEncoderThreads * numSubDecoderThreads;
- for (i = 0; i < numEncoderThreads; i++)
- {
- CEncoderInfo &encoder = encoders[i];
- encoder.NumIterations = 2 + kUncompressMinBlockSize / encoder.kBufferSize;
-
- if (i == 0)
- {
- encoder.progressInfoSpec[0]->callback = callback;
- encoder.progressInfoSpec[0]->BenchInfo.NumIterations = numDecoderThreads;
- SetStartTime(encoder.progressInfoSpec[0]->BenchInfo);
- }
-
- #ifdef BENCH_MT
- if (numDecoderThreads > 1)
- {
- for (UInt32 j = 0; j < numSubDecoderThreads; j++)
- {
- HRESULT res = encoder.CreateDecoderThread(j, (i == 0 && j == 0)
- #ifdef USE_ALLOCA
- , ((i * numSubDecoderThreads + j) * 16 * 21) & 0x7FF
- #endif
- );
- RINOK(res);
- }
- }
- else
- #endif
- {
- RINOK(encoder.Decode(0));
- }
- }
- #ifdef BENCH_MT
- HRESULT res = S_OK;
- if (numDecoderThreads > 1)
- for (i = 0; i < numEncoderThreads; i++)
- for (UInt32 j = 0; j < numSubDecoderThreads; j++)
- {
- CEncoderInfo &encoder = encoders[i];
- encoder.thread[j].Wait();
- if (encoder.Results[j] != S_OK)
- res = encoder.Results[j];
- }
- RINOK(res);
- #endif
- RINOK(status.Res);
- SetFinishTime(encoders[0].progressInfoSpec[0]->BenchInfo, info);
- info.UnpackSize = 0;
- info.PackSize = 0;
- info.NumIterations = numSubDecoderThreads * encoders[0].NumIterations;
- for (i = 0; i < numEncoderThreads; i++)
- {
- CEncoderInfo &encoder = encoders[i];
- info.UnpackSize += encoder.kBufferSize;
- info.PackSize += encoder.compressedSize;
- }
- RINOK(callback->SetDecodeResult(info, false));
- RINOK(callback->SetDecodeResult(info, true));
- return S_OK;
-}
-
-
-inline UInt64 GetLZMAUsage(bool multiThread, UInt32 dictionary)
-{
- UInt32 hs = dictionary - 1;
- hs |= (hs >> 1);
- hs |= (hs >> 2);
- hs |= (hs >> 4);
- hs |= (hs >> 8);
- hs >>= 1;
- hs |= 0xFFFF;
- if (hs > (1 << 24))
- hs >>= 1;
- hs++;
- return ((hs + (1 << 16)) + (UInt64)dictionary * 2) * 4 + (UInt64)dictionary * 3 / 2 +
- (1 << 20) + (multiThread ? (6 << 20) : 0);
-}
-
-UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary)
-{
- const UInt32 kBufferSize = dictionary;
- const UInt32 kCompressedBufferSize = (kBufferSize / 2);
- UInt32 numSubThreads = (numThreads > 1) ? 2 : 1;
- UInt32 numBigThreads = numThreads / numSubThreads;
- return (kBufferSize + kCompressedBufferSize +
- GetLZMAUsage((numThreads > 1), dictionary) + (2 << 20)) * numBigThreads;
-}
-
-static bool CrcBig(const void *data, UInt32 size, UInt32 numCycles, UInt32 crcBase)
-{
- for (UInt32 i = 0; i < numCycles; i++)
- if (CrcCalc(data, size) != crcBase)
- return false;
- return true;
-}
-
-#ifdef BENCH_MT
-struct CCrcInfo
-{
- NWindows::CThread Thread;
- const Byte *Data;
- UInt32 Size;
- UInt32 NumCycles;
- UInt32 Crc;
- bool Res;
- void Wait()
- {
- Thread.Wait();
- Thread.Close();
- }
-};
-
-static THREAD_FUNC_DECL CrcThreadFunction(void *param)
-{
- CCrcInfo *p = (CCrcInfo *)param;
- p->Res = CrcBig(p->Data, p->Size, p->NumCycles, p->Crc);
- return 0;
-}
-
-struct CCrcThreads
-{
- UInt32 NumThreads;
- CCrcInfo *Items;
- CCrcThreads(): NumThreads(0), Items(0) {}
- void WaitAll()
- {
- for (UInt32 i = 0; i < NumThreads; i++)
- Items[i].Wait();
- NumThreads = 0;
- }
- ~CCrcThreads()
- {
- WaitAll();
- delete []Items;
- }
-};
-#endif
-
-static UInt32 CrcCalc1(const Byte *buf, UInt32 size)
-{
- UInt32 crc = CRC_INIT_VAL;;
- for (UInt32 i = 0; i < size; i++)
- crc = CRC_UPDATE_BYTE(crc, buf[i]);
- return CRC_GET_DIGEST(crc);
-}
-
-static void RandGen(Byte *buf, UInt32 size, CBaseRandomGenerator &RG)
-{
- for (UInt32 i = 0; i < size; i++)
- buf[i] = (Byte)RG.GetRnd();
-}
-
-static UInt32 RandGenCrc(Byte *buf, UInt32 size, CBaseRandomGenerator &RG)
-{
- RandGen(buf, size, RG);
- return CrcCalc1(buf, size);
-}
-
-bool CrcInternalTest()
-{
- CBenchBuffer buffer;
- const UInt32 kBufferSize0 = (1 << 8);
- const UInt32 kBufferSize1 = (1 << 10);
- const UInt32 kCheckSize = (1 << 5);
- if (!buffer.Alloc(kBufferSize0 + kBufferSize1))
- return false;
- Byte *buf = buffer.Buffer;
- UInt32 i;
- for (i = 0; i < kBufferSize0; i++)
- buf[i] = (Byte)i;
- UInt32 crc1 = CrcCalc1(buf, kBufferSize0);
- if (crc1 != 0x29058C73)
- return false;
- CBaseRandomGenerator RG;
- RandGen(buf + kBufferSize0, kBufferSize1, RG);
- for (i = 0; i < kBufferSize0 + kBufferSize1 - kCheckSize; i++)
- for (UInt32 j = 0; j < kCheckSize; j++)
- if (CrcCalc1(buf + i, j) != CrcCalc(buf + i, j))
- return false;
- return true;
-}
-
-HRESULT CrcBench(UInt32 numThreads, UInt32 bufferSize, UInt64 &speed)
-{
- if (numThreads == 0)
- numThreads = 1;
-
- CBenchBuffer buffer;
- size_t totalSize = (size_t)bufferSize * numThreads;
- if (totalSize / numThreads != bufferSize)
- return E_OUTOFMEMORY;
- if (!buffer.Alloc(totalSize))
- return E_OUTOFMEMORY;
-
- Byte *buf = buffer.Buffer;
- CBaseRandomGenerator RG;
- UInt32 numCycles = ((UInt32)1 << 30) / ((bufferSize >> 2) + 1) + 1;
-
- UInt64 timeVal;
- #ifdef BENCH_MT
- CCrcThreads threads;
- if (numThreads > 1)
- {
- threads.Items = new CCrcInfo[numThreads];
- UInt32 i;
- for (i = 0; i < numThreads; i++)
- {
- CCrcInfo &info = threads.Items[i];
- Byte *data = buf + (size_t)bufferSize * i;
- info.Data = data;
- info.NumCycles = numCycles;
- info.Size = bufferSize;
- info.Crc = RandGenCrc(data, bufferSize, RG);
- }
- timeVal = GetTimeCount();
- for (i = 0; i < numThreads; i++)
- {
- CCrcInfo &info = threads.Items[i];
- RINOK(info.Thread.Create(CrcThreadFunction, &info));
- threads.NumThreads++;
- }
- threads.WaitAll();
- for (i = 0; i < numThreads; i++)
- if (!threads.Items[i].Res)
- return S_FALSE;
- }
- else
- #endif
- {
- UInt32 crc = RandGenCrc(buf, bufferSize, RG);
- timeVal = GetTimeCount();
- if (!CrcBig(buf, bufferSize, numCycles, crc))
- return S_FALSE;
- }
- timeVal = GetTimeCount() - timeVal;
- if (timeVal == 0)
- timeVal = 1;
-
- UInt64 size = (UInt64)numCycles * totalSize;
- speed = MyMultDiv64(size, timeVal, GetFreq());
- return S_OK;
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h
deleted file mode 100644
index d3cc68678..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// LzmaBench.h
-
-#ifndef __LZMABENCH_H
-#define __LZMABENCH_H
-
-#include <stdio.h>
-#include "../../../Common/Types.h"
-#ifdef EXTERNAL_LZMA
-#include "../../UI/Common/LoadCodecs.h"
-#endif
-
-struct CBenchInfo
-{
- UInt64 GlobalTime;
- UInt64 GlobalFreq;
- UInt64 UserTime;
- UInt64 UserFreq;
- UInt64 UnpackSize;
- UInt64 PackSize;
- UInt32 NumIterations;
- CBenchInfo(): NumIterations(0) {}
-};
-
-struct IBenchCallback
-{
- virtual ~IBenchCallback() {}
- virtual HRESULT SetEncodeResult(const CBenchInfo &info, bool final) = 0;
- virtual HRESULT SetDecodeResult(const CBenchInfo &info, bool final) = 0;
-};
-
-UInt64 GetUsage(const CBenchInfo &benchOnfo);
-UInt64 GetRatingPerUsage(const CBenchInfo &info, UInt64 rating);
-UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 freq, UInt64 size);
-UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations);
-
-HRESULT LzmaBench(
- #ifdef EXTERNAL_LZMA
- CCodecs *codecs,
- #endif
- UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback);
-
-const int kBenchMinDicLogSize = 18;
-
-UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary);
-
-bool CrcInternalTest();
-HRESULT CrcBench(UInt32 numThreads, UInt32 bufferSize, UInt64 &speed);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp
deleted file mode 100644
index 10eca48bb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp
+++ /dev/null
@@ -1,311 +0,0 @@
-// LzmaBenchCon.cpp
-
-#include "StdAfx.h"
-
-#include <stdio.h>
-
-#include "LzmaBench.h"
-#include "LzmaBenchCon.h"
-#include "../../../Common/IntToString.h"
-
-#if defined(BENCH_MT) || defined(_WIN32)
-#include "../../../Windows/System.h"
-#endif
-
-#ifdef BREAK_HANDLER
-#include "../../UI/Console/ConsoleClose.h"
-#endif
-#include "../../../Common/MyCom.h"
-
-struct CTotalBenchRes
-{
- UInt64 NumIterations;
- UInt64 Rating;
- UInt64 Usage;
- UInt64 RPU;
- void Init() { NumIterations = 0; Rating = 0; Usage = 0; RPU = 0; }
- void Normalize()
- {
- if (NumIterations == 0)
- return;
- Rating /= NumIterations;
- Usage /= NumIterations;
- RPU /= NumIterations;
- NumIterations = 1;
- }
- void SetMid(const CTotalBenchRes &r1, const CTotalBenchRes &r2)
- {
- Rating = (r1.Rating + r2.Rating) / 2;
- Usage = (r1.Usage + r2.Usage) / 2;
- RPU = (r1.RPU + r2.RPU) / 2;
- NumIterations = (r1.NumIterations + r2.NumIterations) / 2;
- }
-};
-
-struct CBenchCallback: public IBenchCallback
-{
- CTotalBenchRes EncodeRes;
- CTotalBenchRes DecodeRes;
- FILE *f;
- void Init() { EncodeRes.Init(); DecodeRes.Init(); }
- void Normalize() { EncodeRes.Normalize(); DecodeRes.Normalize(); }
- UInt32 dictionarySize;
- HRESULT SetEncodeResult(const CBenchInfo &info, bool final);
- HRESULT SetDecodeResult(const CBenchInfo &info, bool final);
-};
-
-static void NormalizeVals(UInt64 &v1, UInt64 &v2)
-{
- while (v1 > 1000000)
- {
- v1 >>= 1;
- v2 >>= 1;
- }
-}
-
-static UInt64 MyMultDiv64(UInt64 value, UInt64 elapsedTime, UInt64 freq)
-{
- UInt64 elTime = elapsedTime;
- NormalizeVals(freq, elTime);
- if (elTime == 0)
- elTime = 1;
- return value * freq / elTime;
-}
-
-static void PrintNumber(FILE *f, UInt64 value, int size)
-{
- char s[32];
- ConvertUInt64ToString(value, s);
- fprintf(f, " ");
- for (int len = (int)strlen(s); len < size; len++)
- fprintf(f, " ");
- fprintf(f, "%s", s);
-}
-
-static void PrintRating(FILE *f, UInt64 rating)
-{
- PrintNumber(f, rating / 1000000, 6);
-}
-
-static void PrintResults(FILE *f, UInt64 usage, UInt64 rpu, UInt64 rating)
-{
- PrintNumber(f, (usage + 5000) / 10000, 5);
- PrintRating(f, rpu);
- PrintRating(f, rating);
-}
-
-
-static void PrintResults(FILE *f, const CBenchInfo &info, UInt64 rating, CTotalBenchRes &res)
-{
- UInt64 speed = MyMultDiv64(info.UnpackSize, info.GlobalTime, info.GlobalFreq);
- PrintNumber(f, speed / 1024, 7);
- UInt64 usage = GetUsage(info);
- UInt64 rpu = GetRatingPerUsage(info, rating);
- PrintResults(f, usage, rpu, rating);
- res.NumIterations++;
- res.RPU += rpu;
- res.Rating += rating;
- res.Usage += usage;
-}
-
-static void PrintTotals(FILE *f, const CTotalBenchRes &res)
-{
- fprintf(f, " ");
- PrintResults(f, res.Usage, res.RPU, res.Rating);
-}
-
-
-HRESULT CBenchCallback::SetEncodeResult(const CBenchInfo &info, bool final)
-{
- #ifdef BREAK_HANDLER
- if (NConsoleClose::TestBreakSignal())
- return E_ABORT;
- #endif
-
- if (final)
- {
- UInt64 rating = GetCompressRating(dictionarySize, info.GlobalTime, info.GlobalFreq, info.UnpackSize);
- PrintResults(f, info, rating, EncodeRes);
- }
- return S_OK;
-}
-
-static const char *kSep = " | ";
-
-
-HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
-{
- #ifdef BREAK_HANDLER
- if (NConsoleClose::TestBreakSignal())
- return E_ABORT;
- #endif
- if (final)
- {
- UInt64 rating = GetDecompressRating(info.GlobalTime, info.GlobalFreq, info.UnpackSize, info.PackSize, info.NumIterations);
- fprintf(f, kSep);
- CBenchInfo info2 = info;
- info2.UnpackSize *= info2.NumIterations;
- info2.PackSize *= info2.NumIterations;
- info2.NumIterations = 1;
- PrintResults(f, info2, rating, DecodeRes);
- }
- return S_OK;
-}
-
-static void PrintRequirements(FILE *f, const char *sizeString, UInt64 size, const char *threadsString, UInt32 numThreads)
-{
- fprintf(f, "\nRAM %s ", sizeString);
- PrintNumber(f, (size >> 20), 5);
- fprintf(f, " MB, # %s %3d", threadsString, (unsigned int)numThreads);
-}
-
-HRESULT LzmaBenchCon(
- #ifdef EXTERNAL_LZMA
- CCodecs *codecs,
- #endif
- FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary)
-{
- if (!CrcInternalTest())
- return S_FALSE;
- #ifdef BENCH_MT
- UInt64 ramSize = NWindows::NSystem::GetRamSize(); //
- UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors();
- PrintRequirements(f, "size: ", ramSize, "CPU hardware threads:", numCPUs);
- if (numThreads == (UInt32)-1)
- numThreads = numCPUs;
- if (numThreads > 1)
- numThreads &= ~1;
- if (dictionary == (UInt32)-1)
- {
- int dicSizeLog;
- for (dicSizeLog = 25; dicSizeLog > kBenchMinDicLogSize; dicSizeLog--)
- if (GetBenchMemoryUsage(numThreads, ((UInt32)1 << dicSizeLog)) + (8 << 20) <= ramSize)
- break;
- dictionary = (1 << dicSizeLog);
- }
- #else
- if (dictionary == (UInt32)-1)
- dictionary = (1 << 22);
- numThreads = 1;
- #endif
-
- PrintRequirements(f, "usage:", GetBenchMemoryUsage(numThreads, dictionary), "Benchmark threads: ", numThreads);
-
- CBenchCallback callback;
- callback.Init();
- callback.f = f;
-
- fprintf(f, "\n\nDict Compressing | Decompressing\n ");
- int j;
- for (j = 0; j < 2; j++)
- {
- fprintf(f, " Speed Usage R/U Rating");
- if (j == 0)
- fprintf(f, kSep);
- }
- fprintf(f, "\n ");
- for (j = 0; j < 2; j++)
- {
- fprintf(f, " KB/s %% MIPS MIPS");
- if (j == 0)
- fprintf(f, kSep);
- }
- fprintf(f, "\n\n");
- for (UInt32 i = 0; i < numIterations; i++)
- {
- const int kStartDicLog = 22;
- int pow = (dictionary < ((UInt32)1 << kStartDicLog)) ? kBenchMinDicLogSize : kStartDicLog;
- while (((UInt32)1 << pow) > dictionary)
- pow--;
- for (; ((UInt32)1 << pow) <= dictionary; pow++)
- {
- fprintf(f, "%2d:", pow);
- callback.dictionarySize = (UInt32)1 << pow;
- HRESULT res = LzmaBench(
- #ifdef EXTERNAL_LZMA
- codecs,
- #endif
- numThreads, callback.dictionarySize, &callback);
- fprintf(f, "\n");
- RINOK(res);
- }
- }
- callback.Normalize();
- fprintf(f, "----------------------------------------------------------------\nAvr:");
- PrintTotals(f, callback.EncodeRes);
- fprintf(f, " ");
- PrintTotals(f, callback.DecodeRes);
- fprintf(f, "\nTot:");
- CTotalBenchRes midRes;
- midRes.SetMid(callback.EncodeRes, callback.DecodeRes);
- PrintTotals(f, midRes);
- fprintf(f, "\n");
- return S_OK;
-}
-
-struct CTempValues
-{
- UInt64 *Values;
- CTempValues(UInt32 num) { Values = new UInt64[num]; }
- ~CTempValues() { delete []Values; }
-};
-
-HRESULT CrcBenchCon(FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary)
-{
- if (!CrcInternalTest())
- return S_FALSE;
-
- #ifdef BENCH_MT
- UInt64 ramSize = NWindows::NSystem::GetRamSize();
- UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors();
- PrintRequirements(f, "size: ", ramSize, "CPU hardware threads:", numCPUs);
- if (numThreads == (UInt32)-1)
- numThreads = numCPUs;
- #else
- numThreads = 1;
- #endif
- if (dictionary == (UInt32)-1)
- dictionary = (1 << 24);
-
- CTempValues speedTotals(numThreads);
- fprintf(f, "\n\nSize");
- for (UInt32 ti = 0; ti < numThreads; ti++)
- {
- fprintf(f, " %5d", static_cast< int >( ti + 1 ) );
- speedTotals.Values[ti] = 0;
- }
- fprintf(f, "\n\n");
-
- UInt64 numSteps = 0;
- for (UInt32 i = 0; i < numIterations; i++)
- {
- for (int pow = 10; pow < 32; pow++)
- {
- UInt32 bufSize = (UInt32)1 << pow;
- if (bufSize > dictionary)
- break;
- fprintf(f, "%2d: ", pow);
- UInt64 speed;
- for (UInt32 ti = 0; ti < numThreads; ti++)
- {
- #ifdef BREAK_HANDLER
- if (NConsoleClose::TestBreakSignal())
- return E_ABORT;
- #endif
- RINOK(CrcBench(ti + 1, bufSize, speed));
- PrintNumber(f, (speed >> 20), 5);
- speedTotals.Values[ti] += speed;
- }
- fprintf(f, "\n");
- numSteps++;
- }
- }
- if (numSteps != 0)
- {
- fprintf(f, "\nAvg:");
- for (UInt32 ti = 0; ti < numThreads; ti++)
- PrintNumber(f, ((speedTotals.Values[ti] / numSteps) >> 20), 5);
- fprintf(f, "\n");
- }
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h
deleted file mode 100644
index ea8539d19..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// LzmaBenchCon.h
-
-#ifndef __LZMABENCHCON_H
-#define __LZMABENCHCON_H
-
-#include <stdio.h>
-#include "../../../Common/Types.h"
-#ifdef EXTERNAL_LZMA
-#include "../../UI/Common/LoadCodecs.h"
-#endif
-HRESULT LzmaBenchCon(
- #ifdef EXTERNAL_LZMA
- CCodecs *codecs,
- #endif
- FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary);
-
-HRESULT CrcBenchCon(FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary);
-
-#endif
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzOutWindow.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzOutWindow.cpp
deleted file mode 100644
index df46295bd..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzOutWindow.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// LzOutWindow.cpp
-
-#include "StdAfx.h"
-
-#include "LzOutWindow.h"
-
-void CLzOutWindow::Init(bool solid)
-{
- if (!solid)
- COutBuffer::Init();
- #ifdef _NO_EXCEPTIONS
- ErrorCode = S_OK;
- #endif
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzOutWindow.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzOutWindow.h
deleted file mode 100644
index d8d13c225..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzOutWindow.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// LzOutWindow.h
-
-#ifndef __LZ_OUT_WINDOW_H
-#define __LZ_OUT_WINDOW_H
-
-#include "../IStream.h"
-
-#include "../Common/OutBuffer.h"
-
-#ifndef _NO_EXCEPTIONS
-typedef COutBufferException CLzOutWindowException;
-#endif
-
-class CLzOutWindow: public COutBuffer
-{
-public:
- void Init(bool solid = false);
-
- // distance >= 0, len > 0,
- bool CopyBlock(UInt32 distance, UInt32 len)
- {
- UInt32 pos = _pos - distance - 1;
- if (distance >= _pos)
- {
- if (!_overDict || distance >= _bufferSize)
- return false;
- pos += _bufferSize;
- }
- if (_limitPos - _pos > len && _bufferSize - pos > len)
- {
- const Byte *src = _buffer + pos;
- Byte *dest = _buffer + _pos;
- _pos += len;
- do
- *dest++ = *src++;
- while(--len != 0);
- }
- else do
- {
- if (pos == _bufferSize)
- pos = 0;
- _buffer[_pos++] = _buffer[pos++];
- if (_pos == _limitPos)
- FlushWithCheck();
- }
- while(--len != 0);
- return true;
- }
-
- void PutByte(Byte b)
- {
- _buffer[_pos++] = b;
- if (_pos == _limitPos)
- FlushWithCheck();
- }
-
- Byte GetByte(UInt32 distance) const
- {
- UInt32 pos = _pos - distance - 1;
- if (pos >= _bufferSize)
- pos += _bufferSize;
- return _buffer[pos];
- }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzhDecoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzhDecoder.cpp
deleted file mode 100644
index 6f9b5065e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzhDecoder.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-// LzhDecoder.cpp
-
-#include "StdAfx.h"
-
-#include "LzhDecoder.h"
-
-#include "Windows/Defs.h"
-
-namespace NCompress{
-namespace NLzh {
-namespace NDecoder {
-
-static const UInt32 kHistorySize = (1 << 16);
-
-static const int kBlockSizeBits = 16;
-static const int kNumCBits = 9;
-static const int kNumLevelBits = 5; // smallest integer such that (1 << kNumLevelBits) > kNumLevelSymbols/
-
-UInt32 CCoder::ReadBits(int numBits) { return m_InBitStream.ReadBits(numBits); }
-
-HRESULT CCoder::ReadLevelTable()
-{
- int n = ReadBits(kNumLevelBits);
- if (n == 0)
- {
- m_LevelHuffman.Symbol = ReadBits(kNumLevelBits);
- if (m_LevelHuffman.Symbol >= kNumLevelSymbols)
- return S_FALSE;
- }
- else
- {
- if (n > kNumLevelSymbols)
- return S_FALSE;
- m_LevelHuffman.Symbol = -1;
- Byte lens[kNumLevelSymbols];
- int i = 0;
- while (i < n)
- {
- int c = m_InBitStream.ReadBits(3);
- if (c == 7)
- while (ReadBits(1))
- if (c++ > kMaxHuffmanLen)
- return S_FALSE;
- lens[i++] = (Byte)c;
- if (i == kNumSpecLevelSymbols)
- {
- c = ReadBits(2);
- while (--c >= 0)
- lens[i++] = 0;
- }
- }
- while (i < kNumLevelSymbols)
- lens[i++] = 0;
- m_LevelHuffman.SetCodeLengths(lens);
- }
- return S_OK;
-}
-
-HRESULT CCoder::ReadPTable(int numBits)
-{
- int n = ReadBits(numBits);
- if (n == 0)
- {
- m_PHuffmanDecoder.Symbol = ReadBits(numBits);
- if (m_PHuffmanDecoder.Symbol >= kNumDistanceSymbols)
- return S_FALSE;
- }
- else
- {
- if (n > kNumDistanceSymbols)
- return S_FALSE;
- m_PHuffmanDecoder.Symbol = -1;
- Byte lens[kNumDistanceSymbols];
- int i = 0;
- while (i < n)
- {
- int c = m_InBitStream.ReadBits(3);
- if (c == 7)
- while (ReadBits(1))
- {
- if (c > kMaxHuffmanLen)
- return S_FALSE;
- c++;
- }
- lens[i++] = (Byte)c;
- }
- while (i < kNumDistanceSymbols)
- lens[i++] = 0;
- m_PHuffmanDecoder.SetCodeLengths(lens);
- }
- return S_OK;
-}
-
-HRESULT CCoder::ReadCTable()
-{
- int n = ReadBits(kNumCBits);
- if (n == 0)
- {
- m_CHuffmanDecoder.Symbol = ReadBits(kNumCBits);
- if (m_CHuffmanDecoder.Symbol >= kNumCSymbols)
- return S_FALSE;
- }
- else
- {
- if (n > kNumCSymbols)
- return S_FALSE;
- m_CHuffmanDecoder.Symbol = -1;
- Byte lens[kNumCSymbols];
- int i = 0;
- while (i < n)
- {
- int c = m_LevelHuffman.Decode(&m_InBitStream);
- if (c < kNumSpecLevelSymbols)
- {
- if (c == 0)
- c = 1;
- else if (c == 1)
- c = ReadBits(4) + 3;
- else
- c = ReadBits(kNumCBits) + 20;
- while (--c >= 0)
- {
- if (i > kNumCSymbols)
- return S_FALSE;
- lens[i++] = 0;
- }
- }
- else
- lens[i++] = (Byte)(c - 2);
- }
- while (i < kNumCSymbols)
- lens[i++] = 0;
- m_CHuffmanDecoder.SetCodeLengths(lens);
- }
- return S_OK;
-}
-
-STDMETHODIMP CCoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize,
- ICompressProgressInfo *progress)
-{
- if (outSize == NULL)
- return E_INVALIDARG;
-
- if (!m_OutWindowStream.Create(kHistorySize))
- return E_OUTOFMEMORY;
- if (!m_InBitStream.Create(1 << 20))
- return E_OUTOFMEMORY;
-
- UInt64 pos = 0;
- m_OutWindowStream.SetStream(outStream);
- m_OutWindowStream.Init(false);
- m_InBitStream.SetStream(inStream);
- m_InBitStream.Init();
-
- CCoderReleaser coderReleaser(this);
-
- int pbit;
- if (m_NumDictBits <= 13)
- pbit = 4;
- else
- pbit = 5;
-
- UInt32 blockSize = 0;
-
- while(pos < *outSize)
- {
- // for (i = 0; i < dictSize; i++) dtext[i] = 0x20;
-
- if (blockSize == 0)
- {
- if (progress != NULL)
- {
- UInt64 packSize = m_InBitStream.GetProcessedSize();
- RINOK(progress->SetRatioInfo(&packSize, &pos));
- }
- blockSize = ReadBits(kBlockSizeBits);
- ReadLevelTable();
- ReadCTable();
- RINOK(ReadPTable(pbit));
- }
- blockSize--;
- UInt32 c = m_CHuffmanDecoder.Decode(&m_InBitStream);
- if (c < 256)
- {
- m_OutWindowStream.PutByte((Byte)c);
- pos++;
- }
- else if (c >= kNumCSymbols)
- return S_FALSE;
- else
- {
- // offset = (interface->method == LARC_METHOD_NUM) ? 0x100 - 2 : 0x100 - 3;
- UInt32 len = c - 256 + kMinMatch;
- UInt32 distance = m_PHuffmanDecoder.Decode(&m_InBitStream);
- if (distance != 0)
- distance = (1 << (distance - 1)) + ReadBits(distance - 1);
- if (distance >= pos)
- return S_FALSE;
- if (pos + len > *outSize)
- len = (UInt32)(*outSize - pos);
- pos += len;
- m_OutWindowStream.CopyBlock(distance, len);
- }
- }
- coderReleaser.NeedFlush = false;
- return m_OutWindowStream.Flush();
-}
-
-STDMETHODIMP CCoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress);}
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(const CLzOutWindowException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzhDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzhDecoder.h
deleted file mode 100644
index ed631e20d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzhDecoder.h
+++ /dev/null
@@ -1,106 +0,0 @@
-// LzhDecoder.h
-
-#ifndef __COMPRESS_LZH_DECODER_H
-#define __COMPRESS_LZH_DECODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "../Common/InBuffer.h"
-
-#include "BitmDecoder.h"
-#include "HuffmanDecoder.h"
-#include "LzOutWindow.h"
-
-namespace NCompress {
-namespace NLzh {
-namespace NDecoder {
-
-const int kMaxHuffmanLen = 16; // Check it
-
-const int kNumSpecLevelSymbols = 3;
-const int kNumLevelSymbols = kNumSpecLevelSymbols + kMaxHuffmanLen;
-
-const int kDictBitsMax = 16;
-const int kNumDistanceSymbols = kDictBitsMax + 1;
-
-const int kMaxMatch = 256;
-const int kMinMatch = 3;
-const int kNumCSymbols = 256 + kMaxMatch + 2 - kMinMatch;
-
-template <UInt32 m_NumSymbols>
-class CHuffmanDecoder:public NCompress::NHuffman::CDecoder<kMaxHuffmanLen, m_NumSymbols>
-{
-public:
- int Symbol;
- template <class TBitDecoder>
- UInt32 Decode(TBitDecoder *bitStream)
- {
- if (Symbol >= 0)
- return (UInt32)Symbol;
- return DecodeSymbol(bitStream);
- }
-};
-
-class CCoder :
- public ICompressCoder,
- public CMyUnknownImp
-{
- CLzOutWindow m_OutWindowStream;
- NBitm::CDecoder<CInBuffer> m_InBitStream;
-
- int m_NumDictBits;
-
- CHuffmanDecoder<kNumLevelSymbols> m_LevelHuffman;
- CHuffmanDecoder<kNumDistanceSymbols> m_PHuffmanDecoder;
- CHuffmanDecoder<kNumCSymbols> m_CHuffmanDecoder;
-
- void ReleaseStreams()
- {
- m_OutWindowStream.ReleaseStream();
- m_InBitStream.ReleaseStream();
- }
-
- class CCoderReleaser
- {
- CCoder *m_Coder;
- public:
- bool NeedFlush;
- CCoderReleaser(CCoder *coder): m_Coder(coder), NeedFlush(true) {}
- ~CCoderReleaser()
- {
- if (NeedFlush)
- m_Coder->m_OutWindowStream.Flush();
- m_Coder->ReleaseStreams();
- }
- };
- friend class CCoderReleaser;
-
- void MakeTable(int nchar, Byte *bitlen, int tablebits,
- UInt32 *table, int tablesize);
-
- UInt32 ReadBits(int numBits);
- HRESULT ReadLevelTable();
- HRESULT ReadPTable(int numBits);
- HRESULT ReadCTable();
-
-public:
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(CodeReal)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
- void SetDictionary(int numDictBits) { m_NumDictBits = numDictBits; }
- CCoder(): m_NumDictBits(0) {}
-};
-
-}}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Decoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Decoder.cpp
deleted file mode 100644
index 322015e29..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Decoder.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-// Lzma2Decoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "../Common/StreamUtils.h"
-
-#include "Lzma2Decoder.h"
-
-static HRESULT SResToHRESULT(SRes res)
-{
- switch(res)
- {
- case SZ_OK: return S_OK;
- case SZ_ERROR_MEM: return E_OUTOFMEMORY;
- case SZ_ERROR_PARAM: return E_INVALIDARG;
- // case SZ_ERROR_PROGRESS: return E_ABORT;
- case SZ_ERROR_DATA: return S_FALSE;
- }
- return E_FAIL;
-}
-
-namespace NCompress {
-namespace NLzma2 {
-
-static const UInt32 kInBufSize = 1 << 20;
-
-CDecoder::CDecoder(): _inBuf(0), _outSizeDefined(false)
-{
- Lzma2Dec_Construct(&_state);
-}
-
-static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
-static void SzFree(void *p, void *address) { p = p; MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-CDecoder::~CDecoder()
-{
- Lzma2Dec_Free(&_state, &g_Alloc);
- MyFree(_inBuf);
-}
-
-STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *prop, UInt32 size)
-{
- if (size != 1) return SZ_ERROR_UNSUPPORTED;
- RINOK(SResToHRESULT(Lzma2Dec_Allocate(&_state, prop[0], &g_Alloc)));
- if (_inBuf == 0)
- {
- _inBuf = (Byte *)MyAlloc(kInBufSize);
- if (_inBuf == 0)
- return E_OUTOFMEMORY;
- }
-
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::GetInStreamProcessedSize(UInt64 *value) { *value = _inSizeProcessed; return S_OK; }
-STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream) { _inStream = inStream; return S_OK; }
-STDMETHODIMP CDecoder::ReleaseInStream() { _inStream.Release(); return S_OK; }
-
-STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
-{
- _outSizeDefined = (outSize != NULL);
- if (_outSizeDefined)
- _outSize = *outSize;
-
- Lzma2Dec_Init(&_state);
-
- _inPos = _inSize = 0;
- _inSizeProcessed = _outSizeProcessed = 0;
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */,
- const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- if (_inBuf == 0)
- return S_FALSE;
- SetOutStreamSize(outSize);
-
- for (;;)
- {
- if (_inPos == _inSize)
- {
- _inPos = _inSize = 0;
- RINOK(inStream->Read(_inBuf, kInBufSize, &_inSize));
- }
-
- SizeT dicPos = _state.decoder.dicPos;
- SizeT curSize = _state.decoder.dicBufSize - dicPos;
- const UInt32 kStepSize = ((UInt32)1 << 22);
- if (curSize > kStepSize)
- curSize = (SizeT)kStepSize;
-
- ELzmaFinishMode finishMode = LZMA_FINISH_ANY;
- if (_outSizeDefined)
- {
- const UInt64 rem = _outSize - _outSizeProcessed;
- if (rem < curSize)
- {
- curSize = (SizeT)rem;
- /*
- // finishMode = LZMA_FINISH_END;
- we can't use LZMA_FINISH_END here to allow partial decoding
- */
- }
- }
-
- SizeT inSizeProcessed = _inSize - _inPos;
- ELzmaStatus status;
- SRes res = Lzma2Dec_DecodeToDic(&_state, dicPos + curSize, _inBuf + _inPos, &inSizeProcessed, finishMode, &status);
-
- _inPos += (UInt32)inSizeProcessed;
- _inSizeProcessed += inSizeProcessed;
- SizeT outSizeProcessed = _state.decoder.dicPos - dicPos;
- _outSizeProcessed += outSizeProcessed;
-
- bool finished = (inSizeProcessed == 0 && outSizeProcessed == 0);
- bool stopDecoding = (_outSizeDefined && _outSizeProcessed >= _outSize);
-
- if (res != 0 || _state.decoder.dicPos == _state.decoder.dicBufSize || finished || stopDecoding)
- {
- HRESULT res2 = WriteStream(outStream, _state.decoder.dic, _state.decoder.dicPos);
- if (res != 0)
- return S_FALSE;
- RINOK(res2);
- if (stopDecoding)
- return S_OK;
- if (finished)
- return (status == LZMA_STATUS_FINISHED_WITH_MARK ? S_OK : S_FALSE);
- }
- if (_state.decoder.dicPos == _state.decoder.dicBufSize)
- _state.decoder.dicPos = 0;
-
- if (progress != NULL)
- {
- RINOK(progress->SetRatioInfo(&_inSizeProcessed, &_outSizeProcessed));
- }
- }
-}
-
-#ifndef NO_READ_FROM_CODER
-
-STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize)
- *processedSize = 0;
- do
- {
- if (_inPos == _inSize)
- {
- _inPos = _inSize = 0;
- RINOK(_inStream->Read(_inBuf, kInBufSize, &_inSize));
- }
- {
- SizeT inProcessed = _inSize - _inPos;
-
- if (_outSizeDefined)
- {
- const UInt64 rem = _outSize - _outSizeProcessed;
- if (rem < size)
- size = (UInt32)rem;
- }
-
- SizeT outProcessed = size;
- ELzmaStatus status;
- SRes res = Lzma2Dec_DecodeToBuf(&_state, (Byte *)data, &outProcessed,
- _inBuf + _inPos, &inProcessed, LZMA_FINISH_ANY, &status);
- _inPos += (UInt32)inProcessed;
- _inSizeProcessed += inProcessed;
- _outSizeProcessed += outProcessed;
- size -= (UInt32)outProcessed;
- data = (Byte *)data + outProcessed;
- if (processedSize)
- *processedSize += (UInt32)outProcessed;
- RINOK(SResToHRESULT(res));
- if (inProcessed == 0 && outProcessed == 0)
- return S_OK;
- }
- }
- while (size != 0);
- return S_OK;
-}
-
-#endif
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Decoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Decoder.h
deleted file mode 100644
index fd7ca2f39..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Decoder.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Lzma2Decoder.h
-
-#ifndef __LZMA2_DECODER_H
-#define __LZMA2_DECODER_H
-
-#include "../../../C/Lzma2Dec.h"
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-namespace NCompress {
-namespace NLzma2 {
-
-class CDecoder:
- public ICompressCoder,
- public ICompressSetDecoderProperties2,
- public ICompressGetInStreamProcessedSize,
- #ifndef NO_READ_FROM_CODER
- public ICompressSetInStream,
- public ICompressSetOutStreamSize,
- public ISequentialInStream,
- #endif
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialInStream> _inStream;
- Byte *_inBuf;
- UInt32 _inPos;
- UInt32 _inSize;
- CLzma2Dec _state;
- bool _outSizeDefined;
- UInt64 _outSize;
- UInt64 _inSizeProcessed;
- UInt64 _outSizeProcessed;
-public:
-
- #ifndef NO_READ_FROM_CODER
- MY_UNKNOWN_IMP5(
- ICompressSetDecoderProperties2,
- ICompressGetInStreamProcessedSize,
- ICompressSetInStream,
- ICompressSetOutStreamSize,
- ISequentialInStream)
- #else
- MY_UNKNOWN_IMP2(
- ICompressSetDecoderProperties2,
- ICompressGetInStreamProcessedSize)
- #endif
-
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *_inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-
- STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
-
- STDMETHOD(SetInStream)(ISequentialInStream *inStream);
- STDMETHOD(ReleaseInStream)();
- STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
-
- #ifndef NO_READ_FROM_CODER
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- #endif
-
- CDecoder();
- virtual ~CDecoder();
-
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Encoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Encoder.cpp
deleted file mode 100644
index 5e4c71bea..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Encoder.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-// Lzma2Encoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "../Common/CWrappers.h"
-#include "../Common/StreamUtils.h"
-
-#include "Lzma2Encoder.h"
-
-namespace NCompress {
-
-namespace NLzma {
-
-HRESULT SetLzmaProp(PROPID propID, const PROPVARIANT &prop, CLzmaEncProps &ep);
-
-}
-
-namespace NLzma2 {
-
-static void *SzBigAlloc(void *, size_t size) { return BigAlloc(size); }
-static void SzBigFree(void *, void *address) { BigFree(address); }
-static ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree };
-
-static void *SzAlloc(void *, size_t size) { return MyAlloc(size); }
-static void SzFree(void *, void *address) { MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-CEncoder::CEncoder()
-{
- _encoder = 0;
- _encoder = Lzma2Enc_Create(&g_Alloc, &g_BigAlloc);
- if (_encoder == 0)
- throw 1;
-}
-
-CEncoder::~CEncoder()
-{
- if (_encoder != 0)
- Lzma2Enc_Destroy(_encoder);
-}
-
-HRESULT SetLzma2Prop(PROPID propID, const PROPVARIANT &prop, CLzma2EncProps &lzma2Props)
-{
- switch (propID)
- {
- case NCoderPropID::kBlockSize:
- if (prop.vt != VT_UI4) return E_INVALIDARG; lzma2Props.blockSize = prop.ulVal; break;
- case NCoderPropID::kNumThreads:
- if (prop.vt != VT_UI4) return E_INVALIDARG; lzma2Props.numTotalThreads = (int)(prop.ulVal); break;
- default:
- RINOK(NLzma::SetLzmaProp(propID, prop, lzma2Props.lzmaProps));
- }
- return S_OK;
-}
-
-STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
- const PROPVARIANT *coderProps, UInt32 numProps)
-{
- CLzma2EncProps lzma2Props;
- Lzma2EncProps_Init(&lzma2Props);
-
- for (UInt32 i = 0; i < numProps; i++)
- {
- RINOK(SetLzma2Prop(propIDs[i], coderProps[i], lzma2Props));
- }
- return SResToHRESULT(Lzma2Enc_SetProps(_encoder, &lzma2Props));
-}
-
-STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
-{
- Byte prop = Lzma2Enc_WriteProperties(_encoder);
- return WriteStream(outStream, &prop, 1);
-}
-
-STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
-{
- CSeqInStreamWrap inWrap(inStream);
- CSeqOutStreamWrap outWrap(outStream);
- CCompressProgressWrap progressWrap(progress);
-
- SRes res = Lzma2Enc_Encode(_encoder, &outWrap.p, &inWrap.p, progress ? &progressWrap.p : NULL);
- if (res == SZ_ERROR_READ && inWrap.Res != S_OK)
- return inWrap.Res;
- if (res == SZ_ERROR_WRITE && outWrap.Res != S_OK)
- return outWrap.Res;
- if (res == SZ_ERROR_PROGRESS && progressWrap.Res != S_OK)
- return progressWrap.Res;
- return SResToHRESULT(res);
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Encoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Encoder.h
deleted file mode 100644
index f0fb74d33..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Encoder.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Lzma2Encoder.h
-
-#ifndef __LZMA2_ENCODER_H
-#define __LZMA2_ENCODER_H
-
-#include "../../../C/Lzma2Enc.h"
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-namespace NCompress {
-namespace NLzma2 {
-
-class CEncoder:
- public ICompressCoder,
- public ICompressSetCoderProperties,
- public ICompressWriteCoderProperties,
- public CMyUnknownImp
-{
- CLzma2EncHandle _encoder;
-public:
- MY_UNKNOWN_IMP2(ICompressSetCoderProperties, ICompressWriteCoderProperties)
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
- STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
-
- CEncoder();
- virtual ~CEncoder();
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Register.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Register.cpp
deleted file mode 100644
index cace871ef..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzma2Register.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// Lzma2Register.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "Lzma2Decoder.h"
-
-static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NLzma2::CDecoder); }
-#ifndef EXTRACT_ONLY
-#include "Lzma2Encoder.h"
-static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NLzma2::CEncoder); }
-#else
-#define CreateCodecOut 0
-#endif
-
-static CCodecInfo g_CodecInfo =
- { CreateCodec, CreateCodecOut, 0x21, L"LZMA2", 1, false };
-
-REGISTER_CODEC(LZMA2)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaDecoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaDecoder.cpp
deleted file mode 100644
index c74d5ade3..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaDecoder.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-// LzmaDecoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "../Common/StreamUtils.h"
-
-#include "LzmaDecoder.h"
-
-static HRESULT SResToHRESULT(SRes res)
-{
- switch(res)
- {
- case SZ_OK: return S_OK;
- case SZ_ERROR_MEM: return E_OUTOFMEMORY;
- case SZ_ERROR_PARAM: return E_INVALIDARG;
- case SZ_ERROR_UNSUPPORTED: return E_NOTIMPL;
- case SZ_ERROR_DATA: return S_FALSE;
- }
- return E_FAIL;
-}
-
-namespace NCompress {
-namespace NLzma {
-
-static const UInt32 kInBufSize = 1 << 20;
-
-CDecoder::CDecoder(): _inBuf(0), _propsWereSet(false), _outSizeDefined(false), FinishStream(false)
-{
- _inSizeProcessed = 0;
- _inPos = _inSize = 0;
- LzmaDec_Construct(&_state);
-}
-
-static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
-static void SzFree(void *p, void *address) { p = p; MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-CDecoder::~CDecoder()
-{
- LzmaDec_Free(&_state, &g_Alloc);
- MyFree(_inBuf);
-}
-
-HRESULT CDecoder::CreateInputBuffer()
-{
- if (_inBuf == 0)
- {
- _inBuf = (Byte *)MyAlloc(kInBufSize);
- if (_inBuf == 0)
- return E_OUTOFMEMORY;
- }
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *prop, UInt32 size)
-{
- RINOK(SResToHRESULT(LzmaDec_Allocate(&_state, prop, size, &g_Alloc)));
- _propsWereSet = true;
- return CreateInputBuffer();
-}
-
-void CDecoder::SetOutStreamSizeResume(const UInt64 *outSize)
-{
- _outSizeDefined = (outSize != NULL);
- if (_outSizeDefined)
- _outSize = *outSize;
- _outSizeProcessed = 0;
- LzmaDec_Init(&_state);
-}
-
-STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
-{
- _inSizeProcessed = 0;
- _inPos = _inSize = 0;
- SetOutStreamSizeResume(outSize);
- return S_OK;
-}
-
-HRESULT CDecoder::CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress)
-{
- if (_inBuf == 0 || !_propsWereSet)
- return S_FALSE;
-
- UInt64 startInProgress = _inSizeProcessed;
-
- for (;;)
- {
- if (_inPos == _inSize)
- {
- _inPos = _inSize = 0;
- RINOK(inStream->Read(_inBuf, kInBufSize, &_inSize));
- }
-
- SizeT dicPos = _state.dicPos;
- SizeT curSize = _state.dicBufSize - dicPos;
- const UInt32 kStepSize = ((UInt32)1 << 22);
- if (curSize > kStepSize)
- curSize = (SizeT)kStepSize;
-
- ELzmaFinishMode finishMode = LZMA_FINISH_ANY;
- if (_outSizeDefined)
- {
- const UInt64 rem = _outSize - _outSizeProcessed;
- if (rem < curSize)
- {
- curSize = (SizeT)rem;
- if (FinishStream)
- finishMode = LZMA_FINISH_END;
- }
- }
-
- SizeT inSizeProcessed = _inSize - _inPos;
- ELzmaStatus status;
- SRes res = LzmaDec_DecodeToDic(&_state, dicPos + curSize, _inBuf + _inPos, &inSizeProcessed, finishMode, &status);
-
- _inPos += (UInt32)inSizeProcessed;
- _inSizeProcessed += inSizeProcessed;
- SizeT outSizeProcessed = _state.dicPos - dicPos;
- _outSizeProcessed += outSizeProcessed;
-
- bool finished = (inSizeProcessed == 0 && outSizeProcessed == 0);
- bool stopDecoding = (_outSizeDefined && _outSizeProcessed >= _outSize);
-
- if (res != 0 || _state.dicPos == _state.dicBufSize || finished || stopDecoding)
- {
- HRESULT res2 = WriteStream(outStream, _state.dic, _state.dicPos);
- if (res != 0)
- return S_FALSE;
- RINOK(res2);
- if (stopDecoding)
- return S_OK;
- if (finished)
- return (status == LZMA_STATUS_FINISHED_WITH_MARK ? S_OK : S_FALSE);
- }
- if (_state.dicPos == _state.dicBufSize)
- _state.dicPos = 0;
-
- if (progress)
- {
- UInt64 inSize = _inSizeProcessed - startInProgress;
- RINOK(progress->SetRatioInfo(&inSize, &_outSizeProcessed));
- }
- }
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- SetOutStreamSize(outSize);
- return CodeSpec(inStream, outStream, progress);
-}
-
-#ifndef NO_READ_FROM_CODER
-
-STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream) { _inStream = inStream; return S_OK; }
-STDMETHODIMP CDecoder::ReleaseInStream() { _inStream.Release(); return S_OK; }
-
-STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize)
- *processedSize = 0;
- do
- {
- if (_inPos == _inSize)
- {
- _inPos = _inSize = 0;
- RINOK(_inStream->Read(_inBuf, kInBufSize, &_inSize));
- }
- {
- SizeT inProcessed = _inSize - _inPos;
-
- if (_outSizeDefined)
- {
- const UInt64 rem = _outSize - _outSizeProcessed;
- if (rem < size)
- size = (UInt32)rem;
- }
-
- SizeT outProcessed = size;
- ELzmaStatus status;
- SRes res = LzmaDec_DecodeToBuf(&_state, (Byte *)data, &outProcessed,
- _inBuf + _inPos, &inProcessed, LZMA_FINISH_ANY, &status);
- _inPos += (UInt32)inProcessed;
- _inSizeProcessed += inProcessed;
- _outSizeProcessed += outProcessed;
- size -= (UInt32)outProcessed;
- data = (Byte *)data + outProcessed;
- if (processedSize)
- *processedSize += (UInt32)outProcessed;
- RINOK(SResToHRESULT(res));
- if (inProcessed == 0 && outProcessed == 0)
- return S_OK;
- }
- }
- while (size != 0);
- return S_OK;
-}
-
-HRESULT CDecoder::CodeResume(ISequentialOutStream *outStream, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- SetOutStreamSizeResume(outSize);
- return CodeSpec(_inStream, outStream, progress);
-}
-
-HRESULT CDecoder::ReadFromInputStream(void *data, UInt32 size, UInt32 *processedSize)
-{
- RINOK(CreateInputBuffer());
- if (processedSize)
- *processedSize = 0;
- while (size > 0)
- {
- if (_inPos == _inSize)
- {
- _inPos = _inSize = 0;
- RINOK(_inStream->Read(_inBuf, kInBufSize, &_inSize));
- if (_inSize == 0)
- break;
- }
- {
- UInt32 curSize = _inSize - _inPos;
- if (curSize > size)
- curSize = size;
- memcpy(data, _inBuf + _inPos, curSize);
- _inPos += curSize;
- _inSizeProcessed += curSize;
- size -= curSize;
- data = (Byte *)data + curSize;
- if (processedSize)
- *processedSize += curSize;
- }
- }
- return S_OK;
-}
-
-#endif
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaDecoder.h
deleted file mode 100644
index d4bc9d3b6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaDecoder.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// LzmaDecoder.h
-
-#ifndef __LZMA_DECODER_H
-#define __LZMA_DECODER_H
-
-#include "../../../C/LzmaDec.h"
-
-#include "../../Common/MyCom.h"
-#include "../ICoder.h"
-
-namespace NCompress {
-namespace NLzma {
-
-class CDecoder:
- public ICompressCoder,
- public ICompressSetDecoderProperties2,
- #ifndef NO_READ_FROM_CODER
- public ICompressSetInStream,
- public ICompressSetOutStreamSize,
- public ISequentialInStream,
- #endif
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialInStream> _inStream;
- Byte *_inBuf;
- UInt32 _inPos;
- UInt32 _inSize;
- CLzmaDec _state;
- bool _propsWereSet;
- bool _outSizeDefined;
- UInt64 _outSize;
- UInt64 _inSizeProcessed;
- UInt64 _outSizeProcessed;
-
- HRESULT CreateInputBuffer();
- HRESULT CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress);
- void SetOutStreamSizeResume(const UInt64 *outSize);
-
-public:
- MY_QUERYINTERFACE_BEGIN
- MY_QUERYINTERFACE_ENTRY(ICompressSetDecoderProperties2)
- #ifndef NO_READ_FROM_CODER
- MY_QUERYINTERFACE_ENTRY(ICompressSetInStream)
- MY_QUERYINTERFACE_ENTRY(ICompressSetOutStreamSize)
- MY_QUERYINTERFACE_ENTRY(ISequentialInStream)
- #endif
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
- STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
-
- #ifndef NO_READ_FROM_CODER
-
- STDMETHOD(SetInStream)(ISequentialInStream *inStream);
- STDMETHOD(ReleaseInStream)();
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-
- HRESULT CodeResume(ISequentialOutStream *outStream, const UInt64 *outSize, ICompressProgressInfo *progress);
- HRESULT ReadFromInputStream(void *data, UInt32 size, UInt32 *processedSize);
- UInt64 GetInputProcessedSize() const { return _inSizeProcessed; }
-
- #endif
-
- bool FinishStream;
-
- CDecoder();
- virtual ~CDecoder();
-
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaEncoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaEncoder.cpp
deleted file mode 100644
index 9bdedaeb6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaEncoder.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-// LzmaEncoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "../Common/CWrappers.h"
-#include "../Common/StreamUtils.h"
-
-#include "LzmaEncoder.h"
-
-namespace NCompress {
-namespace NLzma {
-
-static void *SzBigAlloc(void *, size_t size) { return BigAlloc(size); }
-static void SzBigFree(void *, void *address) { BigFree(address); }
-static ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree };
-
-static void *SzAlloc(void *, size_t size) { return MyAlloc(size); }
-static void SzFree(void *, void *address) { MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-CEncoder::CEncoder()
-{
- _encoder = 0;
- _encoder = LzmaEnc_Create(&g_Alloc);
- if (_encoder == 0)
- throw 1;
-}
-
-CEncoder::~CEncoder()
-{
- if (_encoder != 0)
- LzmaEnc_Destroy(_encoder, &g_Alloc, &g_BigAlloc);
-}
-
-inline wchar_t GetUpperChar(wchar_t c)
-{
- if (c >= 'a' && c <= 'z')
- c -= 0x20;
- return c;
-}
-
-static int ParseMatchFinder(const wchar_t *s, int *btMode, int *numHashBytes)
-{
- wchar_t c = GetUpperChar(*s++);
- if (c == L'H')
- {
- if (GetUpperChar(*s++) != L'C')
- return 0;
- int numHashBytesLoc = (int)(*s++ - L'0');
- if (numHashBytesLoc < 4 || numHashBytesLoc > 4)
- return 0;
- if (*s++ != 0)
- return 0;
- *btMode = 0;
- *numHashBytes = numHashBytesLoc;
- return 1;
- }
- if (c != L'B')
- return 0;
-
- if (GetUpperChar(*s++) != L'T')
- return 0;
- int numHashBytesLoc = (int)(*s++ - L'0');
- if (numHashBytesLoc < 2 || numHashBytesLoc > 4)
- return 0;
- c = GetUpperChar(*s++);
- if (c != L'\0')
- return 0;
- *btMode = 1;
- *numHashBytes = numHashBytesLoc;
- return 1;
-}
-
-HRESULT SetLzmaProp(PROPID propID, const PROPVARIANT &prop, CLzmaEncProps &ep)
-{
- if (propID == NCoderPropID::kMatchFinder)
- {
- if (prop.vt != VT_BSTR)
- return E_INVALIDARG;
- return ParseMatchFinder(prop.bstrVal, &ep.btMode, &ep.numHashBytes) ? S_OK : E_INVALIDARG;
- }
- if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- UInt32 v = prop.ulVal;
- switch (propID)
- {
- case NCoderPropID::kNumFastBytes: ep.fb = v; break;
- case NCoderPropID::kMatchFinderCycles: ep.mc = v; break;
- case NCoderPropID::kAlgorithm: ep.algo = v; break;
- case NCoderPropID::kDictionarySize: ep.dictSize = v; break;
- case NCoderPropID::kPosStateBits: ep.pb = v; break;
- case NCoderPropID::kLitPosBits: ep.lp = v; break;
- case NCoderPropID::kLitContextBits: ep.lc = v; break;
- default: return E_INVALIDARG;
- }
- return S_OK;
-}
-
-STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
- const PROPVARIANT *coderProps, UInt32 numProps)
-{
- CLzmaEncProps props;
- LzmaEncProps_Init(&props);
-
- for (UInt32 i = 0; i < numProps; i++)
- {
- const PROPVARIANT &prop = coderProps[i];
- PROPID propID = propIDs[i];
- switch (propID)
- {
- case NCoderPropID::kEndMarker:
- if (prop.vt != VT_BOOL) return E_INVALIDARG; props.writeEndMark = (prop.boolVal == VARIANT_TRUE); break;
- case NCoderPropID::kNumThreads:
- if (prop.vt != VT_UI4) return E_INVALIDARG; props.numThreads = prop.ulVal; break;
- default:
- RINOK(SetLzmaProp(propID, prop, props));
- }
- }
- return SResToHRESULT(LzmaEnc_SetProps(_encoder, &props));
-}
-
-STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
-{
- Byte props[LZMA_PROPS_SIZE];
- size_t size = LZMA_PROPS_SIZE;
- RINOK(LzmaEnc_WriteProperties(_encoder, props, &size));
- return WriteStream(outStream, props, size);
-}
-
-STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
-{
- CSeqInStreamWrap inWrap(inStream);
- CSeqOutStreamWrap outWrap(outStream);
- CCompressProgressWrap progressWrap(progress);
-
- SRes res = LzmaEnc_Encode(_encoder, &outWrap.p, &inWrap.p, progress ? &progressWrap.p : NULL, &g_Alloc, &g_BigAlloc);
- if (res == SZ_ERROR_READ && inWrap.Res != S_OK)
- return inWrap.Res;
- if (res == SZ_ERROR_WRITE && outWrap.Res != S_OK)
- return outWrap.Res;
- if (res == SZ_ERROR_PROGRESS && progressWrap.Res != S_OK)
- return progressWrap.Res;
- return SResToHRESULT(res);
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaEncoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaEncoder.h
deleted file mode 100644
index 904c0002c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaEncoder.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// LzmaEncoder.h
-
-#ifndef __LZMA_ENCODER_H
-#define __LZMA_ENCODER_H
-
-#include "../../../C/LzmaEnc.h"
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-namespace NCompress {
-namespace NLzma {
-
-class CEncoder:
- public ICompressCoder,
- public ICompressSetCoderProperties,
- public ICompressWriteCoderProperties,
- public CMyUnknownImp
-{
- CLzmaEncHandle _encoder;
-public:
- MY_UNKNOWN_IMP2(ICompressSetCoderProperties, ICompressWriteCoderProperties)
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
- STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
-
- CEncoder();
- virtual ~CEncoder();
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaRegister.cpp
deleted file mode 100644
index 96ed0baed..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzmaRegister.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// LzmaRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "LzmaDecoder.h"
-
-static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NLzma::CDecoder); }
-#ifndef EXTRACT_ONLY
-#include "LzmaEncoder.h"
-static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NLzma::CEncoder); }
-#else
-#define CreateCodecOut 0
-#endif
-
-static CCodecInfo g_CodecInfo =
- { CreateCodec, CreateCodecOut, 0x030101, L"LZMA", 1, false };
-
-REGISTER_CODEC(LZMA)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzx.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzx.h
deleted file mode 100644
index 249cbe51b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzx.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Lzx.h
-
-#ifndef __COMPRESS_LZX_H
-#define __COMPRESS_LZX_H
-
-namespace NCompress {
-namespace NLzx {
-
-const int kNumHuffmanBits = 16;
-const UInt32 kNumRepDistances = 3;
-
-const UInt32 kNumLenSlots = 8;
-const UInt32 kMatchMinLen = 2;
-const UInt32 kNumLenSymbols = 249;
-const UInt32 kMatchMaxLen = kMatchMinLen + (kNumLenSlots - 1) + kNumLenSymbols - 1;
-
-const int kNumAlignBits = 3;
-const UInt32 kAlignTableSize = 1 << kNumAlignBits;
-
-const UInt32 kNumPosSlots = 50;
-const UInt32 kNumPosLenSlots = kNumPosSlots * kNumLenSlots;
-
-const UInt32 kMainTableSize = 256 + kNumPosLenSlots;
-const UInt32 kLevelTableSize = 20;
-const UInt32 kMaxTableSize = kMainTableSize;
-
-const int kNumBlockTypeBits = 3;
-const int kBlockTypeVerbatim = 1;
-const int kBlockTypeAligned = 2;
-const int kBlockTypeUncompressed = 3;
-
-const int kUncompressedBlockSizeNumBits = 24;
-
-const int kNumBitsForPreTreeLevel = 4;
-
-const int kLevelSymbolZeros = 17;
-const int kLevelSymbolZerosBig = 18;
-const int kLevelSymbolSame = 19;
-
-const int kLevelSymbolZerosStartValue = 4;
-const int kLevelSymbolZerosNumBits = 4;
-
-const int kLevelSymbolZerosBigStartValue = kLevelSymbolZerosStartValue +
- (1 << kLevelSymbolZerosNumBits);
-const int kLevelSymbolZerosBigNumBits = 5;
-
-const int kLevelSymbolSameNumBits = 1;
-const int kLevelSymbolSameStartValue = 4;
-
-const int kNumBitsForAlignLevel = 3;
-
-const int kNumDictionaryBitsMin = 15;
-const int kNumDictionaryBitsMax = 21;
-const UInt32 kDictionarySizeMax = (1 << kNumDictionaryBitsMax);
-
-const int kNumLinearPosSlotBits = 17;
-const UInt32 kNumPowerPosSlots = 0x26;
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzx86Converter.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzx86Converter.cpp
deleted file mode 100644
index 06638fe78..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzx86Converter.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-// Lzx86Converter.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/Defs.h"
-
-#include "Lzx86Converter.h"
-
-namespace NCompress {
-namespace NLzx {
-
-static const int kResidue = 6 + 4;
-
-void Cx86ConvertOutStream::MakeTranslation()
-{
- if (m_Pos <= static_cast< unsigned int >( kResidue ) )
- return;
- UInt32 numBytes = m_Pos - kResidue;
- Byte *buffer = m_Buffer;
- for (UInt32 i = 0; i < numBytes;)
- {
- if (buffer[i++] == 0xE8)
- {
- Int32 absValue = 0;
- int j;
- for(j = 0; j < 4; j++)
- absValue += (UInt32)buffer[i + j] << (j * 8);
- Int32 pos = (Int32)(m_ProcessedSize + i - 1);
- if (absValue >= -pos && absValue < (Int32)m_TranslationSize)
- {
- UInt32 offset = (absValue >= 0) ?
- absValue - pos :
- absValue + m_TranslationSize;
- for(j = 0; j < 4; j++)
- {
- buffer[i + j] = (Byte)(offset & 0xFF);
- offset >>= 8;
- }
- }
- i += 4;
- }
- }
-}
-
-STDMETHODIMP Cx86ConvertOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != NULL)
- *processedSize = 0;
- if (!m_TranslationMode)
- return m_Stream->Write(data, size, processedSize);
- UInt32 realProcessedSize = 0;
- while (realProcessedSize < size)
- {
- UInt32 writeSize = MyMin(size - realProcessedSize, kUncompressedBlockSize - m_Pos);
- memmove(m_Buffer + m_Pos, (const Byte *)data + realProcessedSize, writeSize);
- m_Pos += writeSize;
- realProcessedSize += writeSize;
- if (m_Pos == static_cast< unsigned int >( kUncompressedBlockSize) )
- {
- RINOK(Flush());
- }
- }
- if (processedSize != NULL)
- *processedSize = realProcessedSize;
- return S_OK;
-}
-
-HRESULT Cx86ConvertOutStream::Flush()
-{
- if (m_Pos == 0)
- return S_OK;
- if (m_TranslationMode)
- MakeTranslation();
- UInt32 pos = 0;
- do
- {
- UInt32 processed;
- RINOK(m_Stream->Write(m_Buffer + pos, m_Pos - pos, &processed));
- if (processed == 0)
- return E_FAIL;
- pos += processed;
- }
- while(pos < m_Pos);
- m_ProcessedSize += m_Pos;
- m_Pos = 0;
- m_TranslationMode = (m_TranslationMode && (m_ProcessedSize < (1 << 30)));
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzx86Converter.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzx86Converter.h
deleted file mode 100644
index 9f110c29b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Lzx86Converter.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Lzx86Converter.h
-
-#ifndef __LZX_86_CONVERTER_H
-#define __LZX_86_CONVERTER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../IStream.h"
-
-namespace NCompress {
-namespace NLzx {
-
-const int kUncompressedBlockSize = 1 << 15;
-
-class Cx86ConvertOutStream:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialOutStream> m_Stream;
- UInt32 m_ProcessedSize;
- UInt32 m_Pos;
- UInt32 m_TranslationSize;
- bool m_TranslationMode;
- Byte m_Buffer[kUncompressedBlockSize];
-
- void MakeTranslation();
-public:
- void SetStream(ISequentialOutStream *outStream) { m_Stream = outStream; }
- void ReleaseStream() { m_Stream.Release(); }
- void Init(bool translationMode, UInt32 translationSize)
- {
- m_TranslationMode = translationMode;
- m_TranslationSize = translationSize;
- m_ProcessedSize = 0;
- m_Pos = 0;
- }
- HRESULT Flush();
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzxDecoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzxDecoder.cpp
deleted file mode 100644
index a2eceb4c2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzxDecoder.cpp
+++ /dev/null
@@ -1,387 +0,0 @@
-// LzxDecoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/Defs.h"
-
-#include "LzxDecoder.h"
-
-namespace NCompress {
-namespace NLzx {
-
-const int kLenIdNeedInit = -2;
-
-CDecoder::CDecoder(bool wimMode):
- _keepHistory(false),
- _skipByte(false),
- _wimMode(wimMode)
-{
- m_x86ConvertOutStreamSpec = new Cx86ConvertOutStream;
- m_x86ConvertOutStream = m_x86ConvertOutStreamSpec;
-}
-
-void CDecoder::ReleaseStreams()
-{
- m_OutWindowStream.ReleaseStream();
- m_InBitStream.ReleaseStream();
- m_x86ConvertOutStreamSpec->ReleaseStream();
-}
-
-STDMETHODIMP CDecoder::Flush()
-{
- RINOK(m_OutWindowStream.Flush());
- return m_x86ConvertOutStreamSpec->Flush();
-}
-
-UInt32 CDecoder::ReadBits(int numBits) { return m_InBitStream.ReadBits(numBits); }
-
-#define RIF(x) { if (!(x)) return false; }
-
-bool CDecoder::ReadTable(Byte *lastLevels, Byte *newLevels, UInt32 numSymbols)
-{
- Byte levelLevels[kLevelTableSize];
- UInt32 i;
- for (i = 0; i < kLevelTableSize; i++)
- levelLevels[i] = (Byte)ReadBits(kNumBitsForPreTreeLevel);
- RIF(m_LevelDecoder.SetCodeLengths(levelLevels));
- int num = 0;
- Byte symbol = 0;
- for (i = 0; i < numSymbols;)
- {
- if (num != 0)
- {
- lastLevels[i] = newLevels[i] = symbol;
- i++;
- num--;
- continue;
- }
- UInt32 number = m_LevelDecoder.DecodeSymbol(&m_InBitStream);
- if (number == static_cast< UInt32 >( kLevelSymbolZeros) )
- {
- num = kLevelSymbolZerosStartValue + (int)ReadBits(kLevelSymbolZerosNumBits);
- symbol = 0;
- }
- else if (number == static_cast< UInt32 >( kLevelSymbolZerosBig) )
- {
- num = kLevelSymbolZerosBigStartValue + (int)ReadBits(kLevelSymbolZerosBigNumBits);
- symbol = 0;
- }
- else if (number == static_cast< UInt32 >( kLevelSymbolSame ) || number <= static_cast< UInt32 >( kNumHuffmanBits) )
- {
- if (number <= static_cast< UInt32 >( kNumHuffmanBits) )
- num = 1;
- else
- {
- num = kLevelSymbolSameStartValue + (int)ReadBits(kLevelSymbolSameNumBits);
- number = m_LevelDecoder.DecodeSymbol(&m_InBitStream);
- if (number > static_cast< UInt32 >( kNumHuffmanBits) )
- return false;
- }
- symbol = Byte((17 + lastLevels[i] - number) % (kNumHuffmanBits + 1));
- }
- else
- return false;
- }
- return true;
-}
-
-bool CDecoder::ReadTables(void)
-{
- Byte newLevels[kMaxTableSize];
- {
- if (_skipByte)
- m_InBitStream.DirectReadByte();
- m_InBitStream.Normalize();
-
- int blockType = (int)ReadBits(kNumBlockTypeBits);
- if (blockType > kBlockTypeUncompressed)
- return false;
- if (_wimMode)
- if (ReadBits(1) == 1)
- m_UnCompressedBlockSize = (1 << 15);
- else
- m_UnCompressedBlockSize = ReadBits(16);
- else
- m_UnCompressedBlockSize = m_InBitStream.ReadBitsBig(kUncompressedBlockSizeNumBits);
-
- m_IsUncompressedBlock = (blockType == kBlockTypeUncompressed);
-
- _skipByte = (m_IsUncompressedBlock && ((m_UnCompressedBlockSize & 1) != 0));
-
- if (m_IsUncompressedBlock)
- {
- ReadBits(16 - m_InBitStream.GetBitPosition());
- if (!m_InBitStream.ReadUInt32(m_RepDistances[0]))
- return false;
- m_RepDistances[0]--;
- for (unsigned int i = 1; i < kNumRepDistances; i++)
- {
- UInt32 rep = 0;
- for (int j = 0; j < 4; j++)
- rep |= (UInt32)m_InBitStream.DirectReadByte() << (8 * j);
- m_RepDistances[i] = rep - 1;
- }
- return true;
- }
- m_AlignIsUsed = (blockType == kBlockTypeAligned);
- if (m_AlignIsUsed)
- {
- for(unsigned int i = 0; i < kAlignTableSize; i++)
- newLevels[i] = (Byte)ReadBits(kNumBitsForAlignLevel);
- RIF(m_AlignDecoder.SetCodeLengths(newLevels));
- }
- }
-
- RIF(ReadTable(m_LastMainLevels, newLevels, 256));
- RIF(ReadTable(m_LastMainLevels + 256, newLevels + 256, m_NumPosLenSlots));
- for (UInt32 i = 256 + m_NumPosLenSlots; i < kMainTableSize; i++)
- newLevels[i] = 0;
- RIF(m_MainDecoder.SetCodeLengths(newLevels));
-
- RIF(ReadTable(m_LastLenLevels, newLevels, kNumLenSymbols));
- return m_LenDecoder.SetCodeLengths(newLevels);
-}
-
-class CDecoderFlusher
-{
- CDecoder *m_Decoder;
-public:
- bool NeedFlush;
- CDecoderFlusher(CDecoder *decoder): m_Decoder(decoder), NeedFlush(true) {}
- ~CDecoderFlusher()
- {
- if (NeedFlush)
- m_Decoder->Flush();
- m_Decoder->ReleaseStreams();
- }
-};
-
-
-void CDecoder::ClearPrevLevels()
-{
- unsigned int i;
- for (i = 0; i < kMainTableSize; i++)
- m_LastMainLevels[i] = 0;
- for (i = 0; i < kNumLenSymbols; i++)
- m_LastLenLevels[i] = 0;
-};
-
-
-HRESULT CDecoder::CodeSpec(UInt32 curSize)
-{
- if (_remainLen == kLenIdNeedInit)
- {
- _remainLen = 0;
- m_InBitStream.Init();
- if (!_keepHistory || !m_IsUncompressedBlock)
- m_InBitStream.Normalize();
- if (!_keepHistory)
- {
- _skipByte = false;
- m_UnCompressedBlockSize = 0;
- ClearPrevLevels();
- UInt32 i86TranslationSize = 12000000;
- bool translationMode = true;
- if (!_wimMode)
- {
- translationMode = (ReadBits(1) != 0);
- if (translationMode)
- {
- i86TranslationSize = ReadBits(16) << 16;
- i86TranslationSize |= ReadBits(16);
- }
- }
- m_x86ConvertOutStreamSpec->Init(translationMode, i86TranslationSize);
-
- for(unsigned int i = 0 ; i < kNumRepDistances; i++)
- m_RepDistances[i] = 0;
- }
- }
-
- while(_remainLen > 0 && curSize > 0)
- {
- m_OutWindowStream.PutByte(m_OutWindowStream.GetByte(m_RepDistances[0]));
- _remainLen--;
- curSize--;
- }
-
- while(curSize > 0)
- {
- if (m_UnCompressedBlockSize == 0)
- if (!ReadTables())
- return S_FALSE;
- UInt32 next = (Int32)MyMin(m_UnCompressedBlockSize, curSize);
- curSize -= next;
- m_UnCompressedBlockSize -= next;
- if (m_IsUncompressedBlock)
- {
- while(next > 0)
- {
- m_OutWindowStream.PutByte(m_InBitStream.DirectReadByte());
- next--;
- }
- }
- else while(next > 0)
- {
- UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream);
- if (number < 256)
- {
- m_OutWindowStream.PutByte((Byte)number);
- next--;
- }
- else
- {
- UInt32 posLenSlot = number - 256;
- if (posLenSlot >= m_NumPosLenSlots)
- return S_FALSE;
- UInt32 posSlot = posLenSlot / kNumLenSlots;
- UInt32 lenSlot = posLenSlot % kNumLenSlots;
- UInt32 len = kMatchMinLen + lenSlot;
- if (lenSlot == kNumLenSlots - 1)
- {
- UInt32 lenTemp = m_LenDecoder.DecodeSymbol(&m_InBitStream);
- if (lenTemp >= kNumLenSymbols)
- return S_FALSE;
- len += lenTemp;
- }
-
- if (posSlot < kNumRepDistances)
- {
- UInt32 distance = m_RepDistances[posSlot];
- m_RepDistances[posSlot] = m_RepDistances[0];
- m_RepDistances[0] = distance;
- }
- else
- {
- UInt32 distance;
- int numDirectBits;
- if (posSlot < kNumPowerPosSlots)
- {
- numDirectBits = (int)(posSlot >> 1) - 1;
- distance = ((2 | (posSlot & 1)) << numDirectBits);
- }
- else
- {
- numDirectBits = kNumLinearPosSlotBits;
- distance = ((posSlot - 0x22) << kNumLinearPosSlotBits);
- }
-
- if (m_AlignIsUsed && numDirectBits >= kNumAlignBits)
- {
- distance += (m_InBitStream.ReadBits(numDirectBits - kNumAlignBits) << kNumAlignBits);
- UInt32 alignTemp = m_AlignDecoder.DecodeSymbol(&m_InBitStream);
- if (alignTemp >= kAlignTableSize)
- return S_FALSE;
- distance += alignTemp;
- }
- else
- distance += m_InBitStream.ReadBits(numDirectBits);
- m_RepDistances[2] = m_RepDistances[1];
- m_RepDistances[1] = m_RepDistances[0];
- m_RepDistances[0] = distance - kNumRepDistances;
- }
-
- UInt32 locLen = len;
- if (locLen > next)
- locLen = next;
-
- if (!m_OutWindowStream.CopyBlock(m_RepDistances[0], locLen))
- return S_FALSE;
-
- len -= locLen;
- next -= locLen;
- if (len != 0)
- {
- _remainLen = (int)len;
- return S_OK;
- }
- }
- }
- }
- return S_OK;
-}
-
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- if (outSize == NULL)
- return E_INVALIDARG;
- UInt64 size = *outSize;
-
- RINOK(SetInStream(inStream));
- m_x86ConvertOutStreamSpec->SetStream(outStream);
- m_OutWindowStream.SetStream(m_x86ConvertOutStream);
- RINOK(SetOutStreamSize(outSize));
-
- CDecoderFlusher flusher(this);
-
- const UInt64 start = m_OutWindowStream.GetProcessedSize();
- for (;;)
- {
- UInt32 curSize = 1 << 18;
- UInt64 rem = size - (m_OutWindowStream.GetProcessedSize() - start);
- if (curSize > rem)
- curSize = (UInt32)rem;
- if (curSize == 0)
- break;
- RINOK(CodeSpec(curSize));
- if (progress != NULL)
- {
- UInt64 inSize = m_InBitStream.GetProcessedSize();
- UInt64 nowPos64 = m_OutWindowStream.GetProcessedSize() - start;
- RINOK(progress->SetRatioInfo(&inSize, &nowPos64));
- }
- }
- flusher.NeedFlush = false;
- return Flush();
-}
-
-HRESULT CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(const CLzOutWindowException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream)
-{
- m_InBitStream.SetStream(inStream);
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::ReleaseInStream()
-{
- m_InBitStream.ReleaseStream();
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
-{
- if (outSize == NULL)
- return E_FAIL;
- _remainLen = kLenIdNeedInit;
- m_OutWindowStream.Init(_keepHistory);
- return S_OK;
-}
-
-HRESULT CDecoder::SetParams(int numDictBits)
-{
- if (numDictBits < kNumDictionaryBitsMin || numDictBits > kNumDictionaryBitsMax)
- return E_INVALIDARG;
- UInt32 numPosSlots;
- if (numDictBits < 20)
- numPosSlots = 30 + (numDictBits - 15) * 2;
- else if (numDictBits == 20)
- numPosSlots = 42;
- else
- numPosSlots = 50;
- m_NumPosLenSlots = numPosSlots * kNumLenSlots;
- if (!m_OutWindowStream.Create(kDictionarySizeMax))
- return E_OUTOFMEMORY;
- if (!m_InBitStream.Create(1 << 16))
- return E_OUTOFMEMORY;
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzxDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzxDecoder.h
deleted file mode 100644
index d7979231c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/LzxDecoder.h
+++ /dev/null
@@ -1,161 +0,0 @@
-// LzxDecoder.h
-
-#ifndef __LZX_DECODER_H
-#define __LZX_DECODER_H
-
-#include "../ICoder.h"
-
-#include "../Common/InBuffer.h"
-
-#include "HuffmanDecoder.h"
-#include "LzOutWindow.h"
-#include "Lzx.h"
-#include "Lzx86Converter.h"
-
-namespace NCompress {
-namespace NLzx {
-
-namespace NBitStream {
-
-const int kNumBigValueBits = 8 * 4;
-const int kNumValueBits = 17;
-const UInt32 kBitDecoderValueMask = (1 << kNumValueBits) - 1;
-
-class CDecoder
-{
- CInBuffer m_Stream;
- UInt32 m_Value;
- int m_BitPos;
-public:
- CDecoder() {}
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
-
- void SetStream(ISequentialInStream *s) { m_Stream.SetStream(s); }
- void ReleaseStream() { m_Stream.ReleaseStream(); }
-
- void Init()
- {
- m_Stream.Init();
- m_BitPos = kNumBigValueBits;
- }
-
- UInt64 GetProcessedSize() const
- { return m_Stream.GetProcessedSize() - (kNumBigValueBits - m_BitPos) / 8; }
-
- int GetBitPosition() const { return m_BitPos & 0xF; }
-
- void Normalize()
- {
- for (;m_BitPos >= 16; m_BitPos -= 16)
- {
- Byte b0 = m_Stream.ReadByte();
- Byte b1 = m_Stream.ReadByte();
- m_Value = (m_Value << 8) | b1;
- m_Value = (m_Value << 8) | b0;
- }
- }
-
- UInt32 GetValue(int numBits) const
- {
- return ((m_Value >> ((32 - kNumValueBits) - m_BitPos)) & kBitDecoderValueMask) >>
- (kNumValueBits - numBits);
- }
-
- void MovePos(UInt32 numBits)
- {
- m_BitPos += (int)numBits;
- Normalize();
- }
-
- UInt32 ReadBits(int numBits)
- {
- UInt32 res = GetValue(numBits);
- MovePos(numBits);
- return res;
- }
-
- UInt32 ReadBitsBig(int numBits)
- {
- int numBits0 = numBits / 2;
- int numBits1 = numBits - numBits0;
- UInt32 res = ReadBits(numBits0) << numBits1;
- return res + ReadBits(numBits1);
- }
-
- bool ReadUInt32(UInt32 &v)
- {
- if (m_BitPos != 0)
- return false;
- v = ((m_Value >> 16) & 0xFFFF) | ((m_Value << 16) & 0xFFFF0000);
- m_BitPos = kNumBigValueBits;
- return true;
- }
-
- Byte DirectReadByte() { return m_Stream.ReadByte(); }
-
-};
-}
-
-class CDecoder :
- public ICompressCoder,
- public CMyUnknownImp
-{
- NBitStream::CDecoder m_InBitStream;
- CLzOutWindow m_OutWindowStream;
-
- UInt32 m_RepDistances[kNumRepDistances];
- UInt32 m_NumPosLenSlots;
-
- bool m_IsUncompressedBlock;
- bool m_AlignIsUsed;
-
- NCompress::NHuffman::CDecoder<kNumHuffmanBits, kMainTableSize> m_MainDecoder;
- NCompress::NHuffman::CDecoder<kNumHuffmanBits, kNumLenSymbols> m_LenDecoder;
- NCompress::NHuffman::CDecoder<kNumHuffmanBits, kAlignTableSize> m_AlignDecoder;
- NCompress::NHuffman::CDecoder<kNumHuffmanBits, kLevelTableSize> m_LevelDecoder;
-
- Byte m_LastMainLevels[kMainTableSize];
- Byte m_LastLenLevels[kNumLenSymbols];
-
- Cx86ConvertOutStream *m_x86ConvertOutStreamSpec;
- CMyComPtr<ISequentialOutStream> m_x86ConvertOutStream;
-
- UInt32 m_UnCompressedBlockSize;
-
- bool _keepHistory;
- int _remainLen;
- bool _skipByte;
-
- bool _wimMode;
-
- UInt32 ReadBits(int numBits);
- bool ReadTable(Byte *lastLevels, Byte *newLevels, UInt32 numSymbols);
- bool ReadTables();
- void ClearPrevLevels();
-
- HRESULT CodeSpec(UInt32 size);
-
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-public:
- CDecoder(bool wimMode = false);
-
- MY_UNKNOWN_IMP
-
- void ReleaseStreams();
- STDMETHOD(Flush)();
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(SetInStream)(ISequentialInStream *inStream);
- STDMETHOD(ReleaseInStream)();
- STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
-
- HRESULT SetParams(int numDictBits);
- void SetKeepHistory(bool keepHistory) { _keepHistory = keepHistory; }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Mtf8.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Mtf8.h
deleted file mode 100644
index 7a6b7fe67..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Mtf8.h
+++ /dev/null
@@ -1,196 +0,0 @@
-// Mtf8.h
-
-#ifndef __COMPRESS_MTF8_H
-#define __COMPRESS_MTF8_H
-
-#include "../../Common/Types.h"
-
-namespace NCompress {
-
-struct CMtf8Encoder
-{
- Byte Buf[256];
-
- int FindAndMove(Byte v)
- {
- int pos;
- for (pos = 0; Buf[pos] != v; pos++);
- int resPos = pos;
- for (; pos >= 8; pos -= 8)
- {
- Buf[pos] = Buf[pos - 1];
- Buf[pos - 1] = Buf[pos - 2];
- Buf[pos - 2] = Buf[pos - 3];
- Buf[pos - 3] = Buf[pos - 4];
- Buf[pos - 4] = Buf[pos - 5];
- Buf[pos - 5] = Buf[pos - 6];
- Buf[pos - 6] = Buf[pos - 7];
- Buf[pos - 7] = Buf[pos - 8];
- }
- for (; pos > 0; pos--)
- Buf[pos] = Buf[pos - 1];
- Buf[0] = v;
- return resPos;
- }
-};
-
-/*
-struct CMtf8Decoder
-{
- Byte Buf[256];
-
- void Init(int) {};
- Byte GetHead() const { return Buf[0]; }
- Byte GetAndMove(int pos)
- {
- Byte res = Buf[pos];
- for (; pos >= 8; pos -= 8)
- {
- Buf[pos] = Buf[pos - 1];
- Buf[pos - 1] = Buf[pos - 2];
- Buf[pos - 2] = Buf[pos - 3];
- Buf[pos - 3] = Buf[pos - 4];
- Buf[pos - 4] = Buf[pos - 5];
- Buf[pos - 5] = Buf[pos - 6];
- Buf[pos - 6] = Buf[pos - 7];
- Buf[pos - 7] = Buf[pos - 8];
- }
- for (; pos > 0; pos--)
- Buf[pos] = Buf[pos - 1];
- Buf[0] = res;
- return res;
- }
-};
-*/
-
-#ifdef _WIN64
-#define MODE_64BIT
-#endif
-
-#ifdef MODE_64BIT
-typedef UInt64 CMtfVar;
-#define MTF_MOVS 3
-#else
-typedef UInt32 CMtfVar;
-#define MTF_MOVS 2
-#endif
-
-#define MTF_MASK ((1 << MTF_MOVS) - 1)
-
-
-struct CMtf8Decoder
-{
- CMtfVar Buf[256 >> MTF_MOVS];
-
- void StartInit() { memset(Buf, 0, sizeof(Buf)); }
- void Add(unsigned int pos, Byte val) { Buf[pos >> MTF_MOVS] |= ((CMtfVar)val << ((pos & MTF_MASK) << 3)); }
- Byte GetHead() const { return (Byte)Buf[0]; }
- Byte GetAndMove(unsigned int pos)
- {
- UInt32 lim = ((UInt32)pos >> MTF_MOVS);
- pos = (pos & MTF_MASK) << 3;
- CMtfVar prev = (Buf[lim] >> pos) & 0xFF;
-
- UInt32 i = 0;
- if ((lim & 1) != 0)
- {
- CMtfVar next = Buf[0];
- Buf[0] = (next << 8) | prev;
- prev = (next >> (MTF_MASK << 3));
- i = 1;
- lim -= 1;
- }
- for (; i < lim; i += 2)
- {
- CMtfVar next = Buf[i];
- Buf[i] = (next << 8) | prev;
- prev = (next >> (MTF_MASK << 3));
- next = Buf[i + 1];
- Buf[i + 1] = (next << 8) | prev;
- prev = (next >> (MTF_MASK << 3));
- }
- CMtfVar next = Buf[i];
- CMtfVar mask = (((CMtfVar)0x100 << pos) - 1);
- Buf[i] = (next & ~mask) | (((next << 8) | prev) & mask);
- return (Byte)Buf[0];
- }
-};
-
-/*
-const int kSmallSize = 64;
-class CMtf8Decoder
-{
- Byte SmallBuffer[kSmallSize];
- int SmallSize;
- Byte Counts[16];
- int Size;
-public:
- Byte Buf[256];
-
- Byte GetHead() const
- {
- if (SmallSize > 0)
- return SmallBuffer[kSmallSize - SmallSize];
- return Buf[0];
- }
-
- void Init(int size)
- {
- Size = size;
- SmallSize = 0;
- for (int i = 0; i < 16; i++)
- {
- Counts[i] = ((size >= 16) ? 16 : size);
- size -= Counts[i];
- }
- }
-
- Byte GetAndMove(int pos)
- {
- if (pos < SmallSize)
- {
- Byte *p = SmallBuffer + kSmallSize - SmallSize;
- Byte res = p[pos];
- for (; pos > 0; pos--)
- p[pos] = p[pos - 1];
- SmallBuffer[kSmallSize - SmallSize] = res;
- return res;
- }
- if (SmallSize == kSmallSize)
- {
- int i = Size - 1;
- int g = 16;
- do
- {
- g--;
- int offset = (g << 4);
- for (int t = Counts[g] - 1; t >= 0; t--, i--)
- Buf[i] = Buf[offset + t];
- }
- while(g != 0);
-
- for (i = kSmallSize - 1; i >= 0; i--)
- Buf[i] = SmallBuffer[i];
- Init(Size);
- }
- pos -= SmallSize;
- int g;
- for (g = 0; pos >= Counts[g]; g++)
- pos -= Counts[g];
- int offset = (g << 4);
- Byte res = Buf[offset + pos];
- for (pos; pos < 16 - 1; pos++)
- Buf[offset + pos] = Buf[offset + pos + 1];
-
- SmallSize++;
- SmallBuffer[kSmallSize - SmallSize] = res;
-
- Counts[g]--;
- return res;
- }
-};
-*/
-
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PPMD_Alone/PpmdAlone.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PPMD_Alone/PpmdAlone.cpp
deleted file mode 100644
index 25df0a0d0..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PPMD_Alone/PpmdAlone.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-// PpmdAlone.cpp
-
-#include "StdAfx.h"
-
-#include "../../../Common/MyWindows.h"
-#include "../../../Common/MyInitGuid.h"
-
-#include <stdio.h>
-
-#if defined(_WIN32) || defined(OS2) || defined(MSDOS)
-#include <fcntl.h>
-#include <io.h>
-#define MY_SET_BINARY_MODE(file) _setmode(_fileno(file), O_BINARY)
-#else
-#define MY_SET_BINARY_MODE(file)
-#endif
-
-#include "../../../Common/CommandLineParser.h"
-#include "../../../Common/StringConvert.h"
-#include "../../../Common/StringToInt.h"
-
-#include "../../Common/FileStreams.h"
-#include "../../Common/StreamUtils.h"
-
-#include "../PpmdDecoder.h"
-#include "../PpmdEncoder.h"
-
-using namespace NCommandLineParser;
-
-#ifdef _WIN32
-bool g_IsNT = false;
-static inline bool IsItWindowsNT()
-{
- OSVERSIONINFO versionInfo;
- versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
- return false;
- return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-#endif
-
-static const char *kCantAllocate = "Can not allocate memory";
-static const char *kReadError = "Read error";
-static const char *kWriteError = "Write error";
-
-namespace NKey {
-enum Enum
-{
- kHelp1 = 0,
- kHelp2,
- kOrder,
- kUsedMemorySize,
- kStdIn,
- kStdOut
-};
-}
-
-static const CSwitchForm kSwitchForms[] =
-{
- { L"?", NSwitchType::kSimple, false },
- { L"H", NSwitchType::kSimple, false },
- { L"O", NSwitchType::kUnLimitedPostString, false, 1 },
- { L"M", NSwitchType::kUnLimitedPostString, false, 1 },
- { L"SI", NSwitchType::kSimple, false },
- { L"SO", NSwitchType::kSimple, false }
-};
-
-static const int kNumSwitches = sizeof(kSwitchForms) / sizeof(kSwitchForms[0]);
-
-static void PrintHelp()
-{
- fprintf(stderr, "\nUsage: PPMD <e|d> inputFile outputFile [<switches>...]\n"
- " e: encode file\n"
- " d: decode file\n"
-/*
- " b: Benchmark\n"
-*/
- "<Switches>\n"
- " -o{N}: set order - [4, 32], default: 4\n"
- " -m{N}: set memory size - [4,512], default: 4 (4 MB)\n"
- " -si: read data from stdin (only with d)\n"
- " -so: write data to stdout\n"
- );
-}
-
-static void PrintHelpAndExit(const char *s)
-{
- fprintf(stderr, "\nError: %s\n\n", s);
- PrintHelp();
- throw -1;
-}
-
-static void IncorrectCommand()
-{
- PrintHelpAndExit("Incorrect command");
-}
-
-static void WriteArgumentsToStringList(int numArguments, const char *arguments[],
- UStringVector &strings)
-{
- for(int i = 1; i < numArguments; i++)
- strings.Add(MultiByteToUnicodeString(arguments[i]));
-}
-
-static bool GetNumber(const wchar_t *s, UInt32 &value)
-{
- value = 0;
- if (MyStringLen(s) == 0)
- return false;
- const wchar_t *end;
- UInt64 res = ConvertStringToUInt64(s, &end);
- if (*end != L'\0')
- return false;
- if (res > 0xFFFFFFFF)
- return false;
- value = UInt32(res);
- return true;
-}
-
-int main2(int n, const char *args[])
-{
- #ifdef _WIN32
- g_IsNT = IsItWindowsNT();
- #endif
-
- fprintf(stderr, "\nPPMD 4.49 Copyright (c) 1999-2007 Igor Pavlov 2007-07-05\n");
-
- if (n == 1)
- {
- PrintHelp();
- return 0;
- }
-
- bool unsupportedTypes = (sizeof(Byte) != 1 || sizeof(UInt32) < 4 || sizeof(UInt64) < 4);
- if (unsupportedTypes)
- {
- fprintf(stderr, "Unsupported base types. Edit Common/Types.h and recompile");
- return 1;
- }
-
- UStringVector commandStrings;
- WriteArgumentsToStringList(n, args, commandStrings);
- CParser parser(kNumSwitches);
- try
- {
- parser.ParseStrings(kSwitchForms, commandStrings);
- }
- catch(...)
- {
- IncorrectCommand();
- }
-
- if(parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs)
- {
- PrintHelp();
- return 0;
- }
- const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
-
- int paramIndex = 0;
- if (paramIndex >= nonSwitchStrings.Size())
- IncorrectCommand();
- const UString &command = nonSwitchStrings[paramIndex++];
-
-/* FIXME
- if (command.CompareNoCase(L"b") == 0)
- {
- const UInt32 kNumDefaultItereations = 1;
- UInt32 numIterations = kNumDefaultItereations;
- {
- if (paramIndex < nonSwitchStrings.Size())
- if (!GetNumber(nonSwitchStrings[paramIndex++], numIterations))
- numIterations = kNumDefaultItereations;
- }
- return LzmaBenchCon(stderr, numIterations, numThreads, dictionary);
- }
-*/
-
- bool encodeMode = false;
- if (command.CompareNoCase(L"e") == 0)
- encodeMode = true;
- else if (command.CompareNoCase(L"d") == 0)
- encodeMode = false;
- else
- IncorrectCommand();
-
- bool stdInMode = parser[NKey::kStdIn].ThereIs;
- bool stdOutMode = parser[NKey::kStdOut].ThereIs;
-
- CMyComPtr<ISequentialInStream> inStream;
- CInFileStream *inStreamSpec = 0;
- if (stdInMode)
- {
- inStream = new CStdInFileStream;
- MY_SET_BINARY_MODE(stdin);
- }
- else
- {
- if (paramIndex >= nonSwitchStrings.Size())
- IncorrectCommand();
- const UString &inputName = nonSwitchStrings[paramIndex++];
- inStreamSpec = new CInFileStream;
- inStream = inStreamSpec;
- if (!inStreamSpec->Open(GetSystemString(inputName)))
- {
- fprintf(stderr, "\nError: can not open input file %s\n",
- (const char *)GetOemString(inputName));
- return 1;
- }
- }
-
- CMyComPtr<ISequentialOutStream> outStream;
- if (stdOutMode)
- {
- outStream = new CStdOutFileStream;
- MY_SET_BINARY_MODE(stdout);
- }
- else
- {
- if (paramIndex >= nonSwitchStrings.Size())
- IncorrectCommand();
- const UString &outputName = nonSwitchStrings[paramIndex++];
- COutFileStream *outStreamSpec = new COutFileStream;
- outStream = outStreamSpec;
- if (!outStreamSpec->Create(GetSystemString(outputName), true))
- {
- fprintf(stderr, "\nError: can not open output file %s\n",
- (const char *)GetOemString(outputName));
- return 1;
- }
- }
-
- UInt64 fileSize;
- if (encodeMode)
- {
- // NCompress::NLZMA::CEncoder *encoderSpec = new NCompress::NLZMA::CEncoder;
- NCompress::NPpmd::CEncoder *encoderSpec = new NCompress::NPpmd::CEncoder;
- CMyComPtr<ICompressCoder> encoder = encoderSpec;
-
- if (stdInMode)
- IncorrectCommand();
-
- UInt32 order = 4;
- if(parser[NKey::kOrder].ThereIs)
- if (!GetNumber(parser[NKey::kOrder].PostStrings[0], order))
- IncorrectCommand();
- if (order < 4) order = 4;
-
- UInt32 memSize = 4;
- if(parser[NKey::kUsedMemorySize].ThereIs)
- if (!GetNumber(parser[NKey::kUsedMemorySize].PostStrings[0], memSize))
- IncorrectCommand();
- if (memSize < 4 ) memSize = 4;
-
-
- PROPID propIDs[] =
-
- {
- NCoderPropID::kUsedMemorySize,
- NCoderPropID::kOrder
- };
- const int kNumPropsMax = sizeof(propIDs) / sizeof(propIDs[0]);
-
- PROPVARIANT properties[kNumPropsMax];
- for (int p = 0; p < kNumPropsMax; p++)
- properties[p].vt = VT_UI4;
-
- properties[0].ulVal = memSize * 1024 * 1024; // memory
- properties[1].ulVal = order;
-
- int numProps = kNumPropsMax;
-
- if (encoderSpec->SetCoderProperties(propIDs, properties, numProps) != S_OK)
- IncorrectCommand();
- encoderSpec->WriteCoderProperties(outStream);
-
-/*
- if (eos || stdInMode)
- fileSize = (UInt64)(Int64)-1;
- else
-*/
- inStreamSpec->File.GetLength(fileSize);
-
- for (int i = 0; i < 8; i++)
- {
- Byte b = Byte(fileSize >> (8 * i));
- if (outStream->Write(&b, 1, 0) != S_OK)
- {
- fprintf(stderr, kWriteError);
- return 1;
- }
- }
- HRESULT result = encoder->Code(inStream, outStream, 0, 0, 0);
- if (result == E_OUTOFMEMORY)
- {
- fprintf(stderr, "\nError: Can not allocate memory\n");
- return 1;
- }
- else if (result != S_OK)
- {
- fprintf(stderr, "\nEncoder error = %X\n", (unsigned int)result);
- return 1;
- }
- }
- else
- {
- // NCompress::NLZMA::CDecoder *decoderSpec = new NCompress::NLZMA::CDecoder;
- NCompress::NPpmd::CDecoder *decoderSpec = new NCompress::NPpmd::CDecoder;
- CMyComPtr<ICompressCoder> decoder = decoderSpec;
- const UInt32 kPropertiesSize = 5;
- Byte header[kPropertiesSize + 8];
- if (ReadStream_FALSE(inStream, header, kPropertiesSize + 8) != S_OK)
- {
- fprintf(stderr, kReadError);
- return 1;
- }
- if (decoderSpec->SetDecoderProperties2(header, kPropertiesSize) != S_OK)
- {
- fprintf(stderr, "SetDecoderProperties error");
- return 1;
- }
- fileSize = 0;
- for (int i = 0; i < 8; i++)
- fileSize |= ((UInt64)header[kPropertiesSize + i]) << (8 * i);
-
- if (decoder->Code(inStream, outStream, 0, &fileSize, 0) != S_OK)
- {
- fprintf(stderr, "Decoder error");
- return 1;
- }
- }
- return 0;
-}
-
-int main(int n, const char *args[])
-{
- try { return main2(n, args); }
- catch(const char *s)
- {
- fprintf(stderr, "\nError: %s\n", s);
- return 1;
- }
- catch(...)
- {
- fprintf(stderr, "\nError\n");
- return 1;
- }
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdContext.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdContext.h
deleted file mode 100644
index cfff53eda..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdContext.h
+++ /dev/null
@@ -1,490 +0,0 @@
-// PpmdContext.h
-// 2009-05-30 : Igor Pavlov : Public domain
-// This code is based on Dmitry Shkarin's PPMdH code (public domain)
-
-#ifndef __COMPRESS_PPMD_CONTEXT_H
-#define __COMPRESS_PPMD_CONTEXT_H
-
-#include "../../Common/Types.h"
-
-#include "PpmdSubAlloc.h"
-#include "RangeCoder.h"
-
-namespace NCompress {
-namespace NPpmd {
-
-const int INT_BITS=7, PERIOD_BITS=7, TOT_BITS=INT_BITS+PERIOD_BITS,
- INTERVAL=1 << INT_BITS, BIN_SCALE=1 << TOT_BITS, MAX_FREQ=124;
-
-struct SEE2_CONTEXT
-{
- // SEE-contexts for PPM-contexts with masked symbols
- UInt16 Summ;
- Byte Shift, Count;
- void init(int InitVal) { Summ = (UInt16)(InitVal << (Shift=PERIOD_BITS-4)); Count=4; }
- unsigned int getMean()
- {
- unsigned int RetVal=(Summ >> Shift);
- Summ = (UInt16)(Summ - RetVal);
- return RetVal+(RetVal == 0);
- }
- void update()
- {
- if (Shift < PERIOD_BITS && --Count == 0)
- {
- Summ <<= 1;
- Count = (Byte)(3 << Shift++);
- }
- }
-};
-
-struct PPM_CONTEXT
-{
- UInt16 NumStats; // sizeof(UInt16) > sizeof(Byte)
- UInt16 SummFreq;
-
- struct STATE
- {
- Byte Symbol, Freq;
- UInt16 SuccessorLow;
- UInt16 SuccessorHigh;
-
- UInt32 GetSuccessor() const { return SuccessorLow | ((UInt32)SuccessorHigh << 16); }
- void SetSuccessor(UInt32 v)
- {
- SuccessorLow = (UInt16)(v & 0xFFFF);
- SuccessorHigh = (UInt16)((v >> 16) & 0xFFFF);
- }
- };
-
- UInt32 Stats;
- UInt32 Suffix;
-
- PPM_CONTEXT* createChild(CSubAllocator &subAllocator, STATE* pStats, STATE& FirstState)
- {
- PPM_CONTEXT* pc = (PPM_CONTEXT*) subAllocator.AllocContext();
- if (pc)
- {
- pc->NumStats = 1;
- pc->oneState() = FirstState;
- pc->Suffix = subAllocator.GetOffset(this);
- pStats->SetSuccessor(subAllocator.GetOffsetNoCheck(pc));
- }
- return pc;
- }
-
- STATE& oneState() const { return (STATE&) SummFreq; }
-};
-
-/////////////////////////////////
-
-const UInt16 InitBinEsc[] =
- {0x3CDD, 0x1F3F, 0x59BF, 0x48F3, 0x64A1, 0x5ABC, 0x6632, 0x6051};
-
-struct CInfo
-{
- CSubAllocator SubAllocator;
- SEE2_CONTEXT SEE2Cont[25][16], DummySEE2Cont;
- PPM_CONTEXT * MinContext, * MaxContext;
-
- PPM_CONTEXT::STATE* FoundState; // found next state transition
- int NumMasked, InitEsc, OrderFall, RunLength, InitRL, MaxOrder;
- Byte CharMask[256], NS2Indx[256], NS2BSIndx[256], HB2Flag[256];
- Byte EscCount, PrintCount, PrevSuccess, HiBitsFlag;
- UInt16 BinSumm[128][64]; // binary SEE-contexts
-
- UInt16 &GetBinSumm(const PPM_CONTEXT::STATE &rs, int numStates)
- {
- HiBitsFlag = HB2Flag[FoundState->Symbol];
- return BinSumm[rs.Freq - 1][
- PrevSuccess + NS2BSIndx[numStates - 1] +
- HiBitsFlag + 2 * HB2Flag[rs.Symbol] +
- ((RunLength >> 26) & 0x20)];
- }
-
- PPM_CONTEXT *GetContext(UInt32 offset) const { return (PPM_CONTEXT *)SubAllocator.GetPtr(offset); }
- PPM_CONTEXT *GetContextNoCheck(UInt32 offset) const { return (PPM_CONTEXT *)SubAllocator.GetPtrNoCheck(offset); }
- PPM_CONTEXT::STATE *GetState(UInt32 offset) const { return (PPM_CONTEXT::STATE *)SubAllocator.GetPtr(offset); }
- PPM_CONTEXT::STATE *GetStateNoCheck(UInt32 offset) const { return (PPM_CONTEXT::STATE *)SubAllocator.GetPtr(offset); }
-
- void RestartModelRare()
- {
- int i, k, m;
- memset(CharMask,0,sizeof(CharMask));
- SubAllocator.InitSubAllocator();
- InitRL = -((MaxOrder < 12) ? MaxOrder : 12) - 1;
- MinContext = MaxContext = (PPM_CONTEXT*) SubAllocator.AllocContext();
- MinContext->Suffix = 0;
- OrderFall = MaxOrder;
- MinContext->SummFreq = (UInt16)((MinContext->NumStats = 256) + 1);
- FoundState = (PPM_CONTEXT::STATE*)SubAllocator.AllocUnits(256 / 2);
- MinContext->Stats = SubAllocator.GetOffsetNoCheck(FoundState);
- PrevSuccess = 0;
- for (RunLength = InitRL, i = 0; i < 256; i++)
- {
- PPM_CONTEXT::STATE &state = FoundState[i];
- state.Symbol = (Byte)i;
- state.Freq = 1;
- state.SetSuccessor(0);
- }
- for (i = 0; i < 128; i++)
- for (k = 0; k < 8; k++)
- for ( m=0; m < 64; m += 8)
- BinSumm[i][k + m] = (UInt16)(BIN_SCALE - InitBinEsc[k] / (i + 2));
- for (i = 0; i < 25; i++)
- for (k = 0; k < 16; k++)
- SEE2Cont[i][k].init(5*i+10);
- }
-
- void StartModelRare(int maxOrder)
- {
- int i, k, m ,Step;
- EscCount=PrintCount=1;
- if (maxOrder < 2)
- {
- memset(CharMask,0,sizeof(CharMask));
- OrderFall = MaxOrder;
- MinContext = MaxContext;
- while (MinContext->Suffix != 0)
- {
- MinContext = GetContextNoCheck(MinContext->Suffix);
- OrderFall--;
- }
- FoundState = GetState(MinContext->Stats);
- MinContext = MaxContext;
- }
- else
- {
- MaxOrder = maxOrder;
- RestartModelRare();
- NS2BSIndx[0] = 2 * 0;
- NS2BSIndx[1] = 2 * 1;
- memset(NS2BSIndx + 2, 2 * 2, 9);
- memset(NS2BSIndx + 11, 2 * 3, 256 - 11);
- for (i = 0; i < 3; i++)
- NS2Indx[i] = (Byte)i;
- for (m = i, k = Step = 1; i < 256; i++)
- {
- NS2Indx[i] = (Byte)m;
- if ( !--k )
- {
- k = ++Step;
- m++;
- }
- }
- memset(HB2Flag, 0, 0x40);
- memset(HB2Flag + 0x40, 0x08, 0x100 - 0x40);
- DummySEE2Cont.Shift = PERIOD_BITS;
- }
- }
-
- PPM_CONTEXT* CreateSuccessors(bool skip, PPM_CONTEXT::STATE* p1)
- {
- // static UpState declaration bypasses IntelC bug
- // static PPM_CONTEXT::STATE UpState;
- PPM_CONTEXT::STATE UpState;
-
- PPM_CONTEXT *pc = MinContext;
- PPM_CONTEXT *UpBranch = GetContext(FoundState->GetSuccessor());
- PPM_CONTEXT::STATE * p, * ps[MAX_O], ** pps = ps;
- if ( !skip )
- {
- *pps++ = FoundState;
- if ( !pc->Suffix )
- goto NO_LOOP;
- }
- if ( p1 )
- {
- p = p1;
- pc = GetContext(pc->Suffix);
- goto LOOP_ENTRY;
- }
- do
- {
- pc = GetContext(pc->Suffix);
- if (pc->NumStats != 1)
- {
- if ((p = GetStateNoCheck(pc->Stats))->Symbol != FoundState->Symbol)
- do { p++; } while (p->Symbol != FoundState->Symbol);
- }
- else
- p = &(pc->oneState());
-LOOP_ENTRY:
- if (GetContext(p->GetSuccessor()) != UpBranch)
- {
- pc = GetContext(p->GetSuccessor());
- break;
- }
- *pps++ = p;
- }
- while ( pc->Suffix );
-NO_LOOP:
- if (pps == ps)
- return pc;
- UpState.Symbol = *(Byte*) UpBranch;
- UpState.SetSuccessor(SubAllocator.GetOffset(UpBranch) + 1);
- if (pc->NumStats != 1)
- {
- if ((p = GetStateNoCheck(pc->Stats))->Symbol != UpState.Symbol)
- do { p++; } while (p->Symbol != UpState.Symbol);
- unsigned int cf = p->Freq-1;
- unsigned int s0 = pc->SummFreq - pc->NumStats - cf;
- UpState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) :
- ((2 * cf + 3 * s0 - 1) / (2 * s0))));
- }
- else
- UpState.Freq = pc->oneState().Freq;
- do
- {
- pc = pc->createChild(SubAllocator, *--pps, UpState);
- if ( !pc )
- return NULL;
- }
- while (pps != ps);
- return pc;
- }
-
- void UpdateModel()
- {
- PPM_CONTEXT::STATE fs = *FoundState, * p = NULL;
- PPM_CONTEXT* pc, * Successor;
- unsigned int ns1, ns, cf, sf, s0;
- if (fs.Freq < MAX_FREQ / 4 && MinContext->Suffix != 0)
- {
- pc = GetContextNoCheck(MinContext->Suffix);
-
- if (pc->NumStats != 1)
- {
- if ((p = GetStateNoCheck(pc->Stats))->Symbol != fs.Symbol)
- {
- do { p++; } while (p->Symbol != fs.Symbol);
- if (p[0].Freq >= p[-1].Freq)
- {
- _PPMD_SWAP(p[0],p[-1]);
- p--;
- }
- }
- if (p->Freq < MAX_FREQ-9)
- {
- p->Freq += 2;
- pc->SummFreq += 2;
- }
- }
- else
- {
- p = &(pc->oneState());
- p->Freq = (Byte)(p->Freq + ((p->Freq < 32) ? 1 : 0));
- }
- }
- if ( !OrderFall )
- {
- MinContext = MaxContext = CreateSuccessors(true, p);
- FoundState->SetSuccessor(SubAllocator.GetOffset(MinContext));
- if (MinContext == 0)
- goto RESTART_MODEL;
- return;
- }
- *SubAllocator.pText++ = fs.Symbol;
- Successor = (PPM_CONTEXT*) SubAllocator.pText;
- if (SubAllocator.pText >= SubAllocator.UnitsStart)
- goto RESTART_MODEL;
- if (fs.GetSuccessor() != 0)
- {
- if ((Byte *)GetContext(fs.GetSuccessor()) <= SubAllocator.pText)
- {
- PPM_CONTEXT* cs = CreateSuccessors(false, p);
- fs.SetSuccessor(SubAllocator.GetOffset(cs));
- if (cs == NULL)
- goto RESTART_MODEL;
- }
- if ( !--OrderFall )
- {
- Successor = GetContext(fs.GetSuccessor());
- SubAllocator.pText -= (MaxContext != MinContext);
- }
- }
- else
- {
- FoundState->SetSuccessor(SubAllocator.GetOffsetNoCheck(Successor));
- fs.SetSuccessor(SubAllocator.GetOffsetNoCheck(MinContext));
- }
- s0 = MinContext->SummFreq - (ns = MinContext->NumStats) - (fs.Freq - 1);
- for (pc = MaxContext; pc != MinContext; pc = GetContext(pc->Suffix))
- {
- if ((ns1 = pc->NumStats) != 1)
- {
- if ((ns1 & 1) == 0)
- {
- void *ppp = SubAllocator.ExpandUnits(GetState(pc->Stats), ns1 >> 1);
- pc->Stats = SubAllocator.GetOffset(ppp);
- if (!ppp)
- goto RESTART_MODEL;
- }
- pc->SummFreq = (UInt16)(pc->SummFreq + (2 * ns1 < ns) + 2 * ((4 * ns1 <= ns) &
- (pc->SummFreq <= 8 * ns1)));
- }
- else
- {
- p = (PPM_CONTEXT::STATE*) SubAllocator.AllocUnits(1);
- if ( !p )
- goto RESTART_MODEL;
- *p = pc->oneState();
- pc->Stats = SubAllocator.GetOffsetNoCheck(p);
- if (p->Freq < MAX_FREQ / 4 - 1)
- p->Freq <<= 1;
- else
- p->Freq = MAX_FREQ - 4;
- pc->SummFreq = (UInt16)(p->Freq + InitEsc + (ns > 3));
- }
- cf = 2 * fs.Freq * (pc->SummFreq+6);
- sf = s0 + pc->SummFreq;
- if (cf < 6 * sf)
- {
- cf = 1 + (cf > sf)+(cf >= 4 * sf);
- pc->SummFreq += 3;
- }
- else
- {
- cf = 4 + (cf >= 9 * sf) + (cf >= 12 * sf) + (cf >= 15 * sf);
- pc->SummFreq = (UInt16)(pc->SummFreq + cf);
- }
- p = GetState(pc->Stats) + ns1;
- p->SetSuccessor(SubAllocator.GetOffset(Successor));
- p->Symbol = fs.Symbol;
- p->Freq = (Byte)cf;
- pc->NumStats = (UInt16)++ns1;
- }
- MaxContext = MinContext = GetContext(fs.GetSuccessor());
- return;
-RESTART_MODEL:
- RestartModelRare();
- EscCount = 0;
- PrintCount = 0xFF;
- }
-
- void ClearMask()
- {
- EscCount = 1;
- memset(CharMask, 0, sizeof(CharMask));
- // if (++PrintCount == 0)
- // PrintInfo(DecodedFile,EncodedFile);
- }
-
- void update1(PPM_CONTEXT::STATE* p)
- {
- (FoundState = p)->Freq += 4;
- MinContext->SummFreq += 4;
- if (p[0].Freq > p[-1].Freq)
- {
- _PPMD_SWAP(p[0],p[-1]);
- FoundState = --p;
- if (p->Freq > MAX_FREQ)
- rescale();
- }
- }
-
-
- void update2(PPM_CONTEXT::STATE* p)
- {
- (FoundState = p)->Freq += 4;
- MinContext->SummFreq += 4;
- if (p->Freq > MAX_FREQ)
- rescale();
- EscCount++;
- RunLength = InitRL;
- }
-
- SEE2_CONTEXT* makeEscFreq2(int Diff, UInt32 &scale)
- {
- SEE2_CONTEXT* psee2c;
- if (MinContext->NumStats != 256)
- {
- psee2c = SEE2Cont[NS2Indx[Diff-1]] +
- (Diff < (GetContext(MinContext->Suffix))->NumStats - MinContext->NumStats) +
- 2 * (MinContext->SummFreq < 11 * MinContext->NumStats) +
- 4 * (NumMasked > Diff) +
- HiBitsFlag;
- scale = psee2c->getMean();
- }
- else
- {
- psee2c = &DummySEE2Cont;
- scale = 1;
- }
- return psee2c;
- }
-
-
-
- void rescale()
- {
- int OldNS = MinContext->NumStats, i = MinContext->NumStats - 1, Adder, EscFreq;
- PPM_CONTEXT::STATE* p1, * p;
- PPM_CONTEXT::STATE *stats = GetStateNoCheck(MinContext->Stats);
- for (p = FoundState; p != stats; p--)
- _PPMD_SWAP(p[0], p[-1]);
- stats->Freq += 4;
- MinContext->SummFreq += 4;
- EscFreq = MinContext->SummFreq - p->Freq;
- Adder = (OrderFall != 0);
- p->Freq = (Byte)((p->Freq + Adder) >> 1);
- MinContext->SummFreq = p->Freq;
- do
- {
- EscFreq -= (++p)->Freq;
- p->Freq = (Byte)((p->Freq + Adder) >> 1);
- MinContext->SummFreq = (UInt16)(MinContext->SummFreq + p->Freq);
- if (p[0].Freq > p[-1].Freq)
- {
- PPM_CONTEXT::STATE tmp = *(p1 = p);
- do
- {
- p1[0] = p1[-1];
- }
- while (--p1 != stats && tmp.Freq > p1[-1].Freq);
- *p1 = tmp;
- }
- }
- while ( --i );
- if (p->Freq == 0)
- {
- do { i++; } while ((--p)->Freq == 0);
- EscFreq += i;
- MinContext->NumStats = (UInt16)(MinContext->NumStats - i);
- if (MinContext->NumStats == 1)
- {
- PPM_CONTEXT::STATE tmp = *stats;
- do { tmp.Freq = (Byte)(tmp.Freq - (tmp.Freq >> 1)); EscFreq >>= 1; } while (EscFreq > 1);
- SubAllocator.FreeUnits(stats, (OldNS+1) >> 1);
- *(FoundState = &MinContext->oneState()) = tmp; return;
- }
- }
- EscFreq -= (EscFreq >> 1);
- MinContext->SummFreq = (UInt16)(MinContext->SummFreq + EscFreq);
- int n0 = (OldNS+1) >> 1, n1 = (MinContext->NumStats + 1) >> 1;
- if (n0 != n1)
- MinContext->Stats = SubAllocator.GetOffset(SubAllocator.ShrinkUnits(stats, n0, n1));
- FoundState = GetState(MinContext->Stats);
- }
-
- void NextContext()
- {
- PPM_CONTEXT *c = GetContext(FoundState->GetSuccessor());
- if (!OrderFall && (Byte *)c > SubAllocator.pText)
- MinContext = MaxContext = c;
- else
- {
- UpdateModel();
- if (EscCount == 0)
- ClearMask();
- }
- }
-};
-
-// Tabulated escapes for exponential symbol distribution
-const Byte ExpEscape[16]={ 25,14, 9, 7, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2 };
-#define GET_MEAN(SUMM,SHIFT,ROUND) ((SUMM+(1 << (SHIFT-ROUND))) >> (SHIFT))
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdDecode.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdDecode.h
deleted file mode 100644
index fe6927bf8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdDecode.h
+++ /dev/null
@@ -1,156 +0,0 @@
-// PpmdDecode.h
-// 2009-05-30 : Igor Pavlov : Public domain
-// This code is based on Dmitry Shkarin's PPMdH code (public domain)
-
-#ifndef __COMPRESS_PPMD_DECODE_H
-#define __COMPRESS_PPMD_DECODE_H
-
-#include "PpmdContext.h"
-
-namespace NCompress {
-namespace NPpmd {
-
-class CRangeDecoderVirt
-{
-public:
- virtual ~CRangeDecoderVirt() {}
- virtual UInt32 GetThreshold(UInt32 total) = 0;
- virtual void Decode(UInt32 start, UInt32 size) = 0;
- virtual UInt32 DecodeBit(UInt32 size0, UInt32 numTotalBits) = 0;
-};
-
-typedef NRangeCoder::CDecoder CRangeDecoderMy;
-
-class CRangeDecoder:public CRangeDecoderVirt, public CRangeDecoderMy
-{
- UInt32 GetThreshold(UInt32 total) { return CRangeDecoderMy::GetThreshold(total); }
- void Decode(UInt32 start, UInt32 size) { CRangeDecoderMy::Decode(start, size); }
- UInt32 DecodeBit(UInt32 size0, UInt32 numTotalBits) { return CRangeDecoderMy::DecodeBit(size0, numTotalBits); }
-};
-
-struct CDecodeInfo: public CInfo
-{
- void DecodeBinSymbol(CRangeDecoderVirt *rangeDecoder)
- {
- PPM_CONTEXT::STATE& rs = MinContext->oneState();
- UInt16& bs = GetBinSumm(rs, GetContextNoCheck(MinContext->Suffix)->NumStats);
- if (rangeDecoder->DecodeBit(bs, TOT_BITS) == 0)
- {
- FoundState = &rs;
- rs.Freq = (Byte)(rs.Freq + (rs.Freq < 128 ? 1: 0));
- bs = (UInt16)(bs + INTERVAL - GET_MEAN(bs, PERIOD_BITS, 2));
- PrevSuccess = 1;
- RunLength++;
- }
- else
- {
- bs = (UInt16)(bs - GET_MEAN(bs, PERIOD_BITS, 2));
- InitEsc = ExpEscape[bs >> 10];
- NumMasked = 1;
- CharMask[rs.Symbol] = EscCount;
- PrevSuccess = 0;
- FoundState = NULL;
- }
- }
-
- void DecodeSymbol1(CRangeDecoderVirt *rangeDecoder)
- {
- PPM_CONTEXT::STATE* p = GetStateNoCheck(MinContext->Stats);
- int i, count, hiCnt;
- if ((count = rangeDecoder->GetThreshold(MinContext->SummFreq)) < (hiCnt = p->Freq))
- {
- PrevSuccess = (2 * hiCnt > MinContext->SummFreq);
- RunLength += PrevSuccess;
- rangeDecoder->Decode(0, p->Freq); // MinContext->SummFreq);
- (FoundState = p)->Freq = (Byte)(hiCnt += 4);
- MinContext->SummFreq += 4;
- if (hiCnt > MAX_FREQ)
- rescale();
- return;
- }
- PrevSuccess = 0;
- i = MinContext->NumStats - 1;
- while ((hiCnt += (++p)->Freq) <= count)
- if (--i == 0)
- {
- HiBitsFlag = HB2Flag[FoundState->Symbol];
- rangeDecoder->Decode(hiCnt, MinContext->SummFreq - hiCnt); // , MinContext->SummFreq);
- CharMask[p->Symbol] = EscCount;
- i = (NumMasked = MinContext->NumStats)-1;
- FoundState = NULL;
- do { CharMask[(--p)->Symbol] = EscCount; } while ( --i );
- return;
- }
- rangeDecoder->Decode(hiCnt - p->Freq, p->Freq); // , MinContext->SummFreq);
- update1(p);
- }
-
-
- void DecodeSymbol2(CRangeDecoderVirt *rangeDecoder)
- {
- int count, hiCnt, i = MinContext->NumStats - NumMasked;
- UInt32 freqSum;
- SEE2_CONTEXT* psee2c = makeEscFreq2(i, freqSum);
- PPM_CONTEXT::STATE* ps[256], ** pps = ps, * p = GetStateNoCheck(MinContext->Stats)-1;
- hiCnt = 0;
- do
- {
- do { p++; } while (CharMask[p->Symbol] == EscCount);
- hiCnt += p->Freq;
- *pps++ = p;
- }
- while ( --i );
-
- freqSum += hiCnt;
- count = rangeDecoder->GetThreshold(freqSum);
-
- p = *(pps = ps);
- if (count < hiCnt)
- {
- hiCnt = 0;
- while ((hiCnt += p->Freq) <= count)
- p=*++pps;
- rangeDecoder->Decode(hiCnt - p->Freq, p->Freq); // , freqSum);
-
- psee2c->update();
- update2(p);
- }
- else
- {
- rangeDecoder->Decode(hiCnt, freqSum - hiCnt); // , freqSum);
-
- i = MinContext->NumStats - NumMasked;
- pps--;
- do { CharMask[(*++pps)->Symbol] = EscCount; } while ( --i );
- psee2c->Summ = (UInt16)(psee2c->Summ + freqSum);
- NumMasked = MinContext->NumStats;
- }
- }
-
- int DecodeSymbol(CRangeDecoderVirt *rangeDecoder)
- {
- if (MinContext->NumStats != 1)
- DecodeSymbol1(rangeDecoder);
- else
- DecodeBinSymbol(rangeDecoder);
- while ( !FoundState )
- {
- do
- {
- OrderFall++;
- MinContext = GetContext(MinContext->Suffix);
- if (MinContext == 0)
- return -1;
- }
- while (MinContext->NumStats == NumMasked);
- DecodeSymbol2(rangeDecoder);
- }
- Byte symbol = FoundState->Symbol;
- NextContext();
- return symbol;
- }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdDecoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdDecoder.cpp
deleted file mode 100644
index 0ac98c8b1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdDecoder.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-// PpmdDecoder.cpp
-// 2009-05-30 : Igor Pavlov : Public domain
-
-#include "StdAfx.h"
-
-#include "Common/Defs.h"
-#include "Windows/Defs.h"
-
-#include "PpmdDecoder.h"
-
-namespace NCompress {
-namespace NPpmd {
-
-const int kLenIdFinished = -1;
-const int kLenIdNeedInit = -2;
-
-STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *properties, UInt32 size)
-{
- if (size < 5)
- return E_INVALIDARG;
- _order = properties[0];
- _usedMemorySize = 0;
- for (int i = 0; i < 4; i++)
- _usedMemorySize += ((UInt32)(properties[1 + i])) << (i * 8);
-
- if (_usedMemorySize > kMaxMemBlockSize)
- return E_NOTIMPL;
-
- if (!_rangeDecoder.Create(1 << 20))
- return E_OUTOFMEMORY;
- if (!_info.SubAllocator.StartSubAllocator(_usedMemorySize))
- return E_OUTOFMEMORY;
-
- return S_OK;
-}
-
-class CDecoderFlusher
-{
- CDecoder *_coder;
-public:
- bool NeedFlush;
- CDecoderFlusher(CDecoder *coder): _coder(coder), NeedFlush(true) {}
- ~CDecoderFlusher()
- {
- if (NeedFlush)
- _coder->Flush();
- _coder->ReleaseStreams();
- }
-};
-
-HRESULT CDecoder::CodeSpec(UInt32 size, Byte *memStream)
-{
- if (_outSizeDefined)
- {
- const UInt64 rem = _outSize - _processedSize;
- if (size > rem)
- size = (UInt32)rem;
- }
- const UInt32 startSize = size;
-
- if (_remainLen == kLenIdFinished)
- return S_OK;
- if (_remainLen == kLenIdNeedInit)
- {
- _rangeDecoder.Init();
- _remainLen = 0;
- _info.MaxOrder = 0;
- _info.StartModelRare(_order);
- }
- while (size != 0)
- {
- int symbol = _info.DecodeSymbol(&_rangeDecoder);
- if (symbol < 0)
- {
- _remainLen = kLenIdFinished;
- break;
- }
- if (memStream != 0)
- *memStream++ = (Byte)symbol;
- else
- _outStream.WriteByte((Byte)symbol);
- size--;
- }
- _processedSize += startSize - size;
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- if (!_outStream.Create(1 << 20))
- return E_OUTOFMEMORY;
-
- SetInStream(inStream);
- _outStream.SetStream(outStream);
- SetOutStreamSize(outSize);
- CDecoderFlusher flusher(this);
-
- for (;;)
- {
- _processedSize = _outStream.GetProcessedSize();
- UInt32 curSize = (1 << 18);
- RINOK(CodeSpec(curSize, NULL));
- if (_remainLen == kLenIdFinished)
- break;
- if (progress != NULL)
- {
- UInt64 inSize = _rangeDecoder.GetProcessedSize();
- RINOK(progress->SetRatioInfo(&inSize, &_processedSize));
- }
- if (_outSizeDefined)
- if (_outStream.GetProcessedSize() >= _outSize)
- break;
- }
- flusher.NeedFlush = false;
- return Flush();
-}
-
-#ifdef _NO_EXCEPTIONS
-
-#define PPMD_TRY_BEGIN
-#define PPMD_TRY_END
-
-#else
-
-#define PPMD_TRY_BEGIN try {
-#define PPMD_TRY_END } \
- catch(const CInBufferException &e) { return e.ErrorCode; } \
- catch(const COutBufferException &e) { return e.ErrorCode; } \
- catch(...) { return S_FALSE; }
-
-#endif
-
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- PPMD_TRY_BEGIN
- return CodeReal(inStream, outStream, inSize, outSize, progress);
- PPMD_TRY_END
-}
-
-STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream)
-{
- _rangeDecoder.SetStream(inStream);
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::ReleaseInStream()
-{
- _rangeDecoder.ReleaseStream();
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
-{
- _outSizeDefined = (outSize != NULL);
- if (_outSizeDefined)
- _outSize = *outSize;
- _processedSize = 0;
- _remainLen = kLenIdNeedInit;
- _outStream.Init();
- return S_OK;
-}
-
-#ifndef NO_READ_FROM_CODER
-
-STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- PPMD_TRY_BEGIN
- if (processedSize)
- *processedSize = 0;
- const UInt64 startPos = _processedSize;
- RINOK(CodeSpec(size, (Byte *)data));
- if (processedSize)
- *processedSize = (UInt32)(_processedSize - startPos);
- return Flush();
- PPMD_TRY_END
-}
-
-#endif
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdDecoder.h
deleted file mode 100644
index 31ab8f82a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdDecoder.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// PpmdDecoder.h
-// 2009-05-30 : Igor Pavlov : Public domain
-
-#ifndef __COMPRESS_PPMD_DECODER_H
-#define __COMPRESS_PPMD_DECODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "../Common/OutBuffer.h"
-
-#include "PpmdDecode.h"
-#include "RangeCoder.h"
-
-namespace NCompress {
-namespace NPpmd {
-
-class CDecoder :
- public ICompressCoder,
- public ICompressSetDecoderProperties2,
- #ifndef NO_READ_FROM_CODER
- public ICompressSetInStream,
- public ICompressSetOutStreamSize,
- public ISequentialInStream,
- #endif
- public CMyUnknownImp
-{
- CRangeDecoder _rangeDecoder;
-
- COutBuffer _outStream;
-
- CDecodeInfo _info;
-
- Byte _order;
- UInt32 _usedMemorySize;
-
- int _remainLen;
- UInt64 _outSize;
- bool _outSizeDefined;
- UInt64 _processedSize;
-
- HRESULT CodeSpec(UInt32 num, Byte *memStream);
-
-public:
-
- #ifndef NO_READ_FROM_CODER
- MY_UNKNOWN_IMP4(
- ICompressSetDecoderProperties2,
- ICompressSetInStream,
- ICompressSetOutStreamSize,
- ISequentialInStream)
- #else
- MY_UNKNOWN_IMP1(
- ICompressSetDecoderProperties2)
- #endif
-
- void ReleaseStreams()
- {
- ReleaseInStream();
- _outStream.ReleaseStream();
- }
-
- HRESULT Flush() { return _outStream.Flush(); }
-
- STDMETHOD(CodeReal)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-
- STDMETHOD(SetInStream)(ISequentialInStream *inStream);
- STDMETHOD(ReleaseInStream)();
- STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
-
- #ifndef NO_READ_FROM_CODER
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- #endif
-
- CDecoder(): _outSizeDefined(false) {}
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdEncode.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdEncode.h
deleted file mode 100644
index 012f859c8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdEncode.h
+++ /dev/null
@@ -1,142 +0,0 @@
-// PpmdEncode.h
-// 2009-05-30 : Igor Pavlov : Public domain
-// This code is based on Dmitry Shkarin's PPMdH code (public domain)
-
-#ifndef __COMPRESS_PPMD_ENCODE_H
-#define __COMPRESS_PPMD_ENCODE_H
-
-#include "PpmdContext.h"
-
-namespace NCompress {
-namespace NPpmd {
-
-struct CEncodeInfo: public CInfo
-{
- void EncodeBinSymbol(int symbol, NRangeCoder::CEncoder *rangeEncoder)
- {
- PPM_CONTEXT::STATE& rs = MinContext->oneState();
- UInt16 &bs = GetBinSumm(rs, GetContextNoCheck(MinContext->Suffix)->NumStats);
- if (rs.Symbol == symbol)
- {
- FoundState = &rs;
- rs.Freq = (Byte)(rs.Freq + (rs.Freq < 128 ? 1: 0));
- rangeEncoder->EncodeBit(bs, TOT_BITS, 0);
- bs = (UInt16)(bs + INTERVAL - GET_MEAN(bs, PERIOD_BITS, 2));
- PrevSuccess = 1;
- RunLength++;
- }
- else
- {
- rangeEncoder->EncodeBit(bs, TOT_BITS, 1);
- bs = (UInt16)(bs - GET_MEAN(bs, PERIOD_BITS, 2));
- InitEsc = ExpEscape[bs >> 10];
- NumMasked = 1;
- CharMask[rs.Symbol] = EscCount;
- PrevSuccess = 0;
- FoundState = NULL;
- }
- }
-
- void EncodeSymbol1(int symbol, NRangeCoder::CEncoder *rangeEncoder)
- {
- PPM_CONTEXT::STATE* p = GetStateNoCheck(MinContext->Stats);
- if (p->Symbol == symbol)
- {
- PrevSuccess = (2 * (p->Freq) > MinContext->SummFreq);
- RunLength += PrevSuccess;
- rangeEncoder->Encode(0, p->Freq, MinContext->SummFreq);
- (FoundState = p)->Freq += 4;
- MinContext->SummFreq += 4;
- if (p->Freq > MAX_FREQ)
- rescale();
- return;
- }
- PrevSuccess = 0;
- int LoCnt = p->Freq, i = MinContext->NumStats - 1;
- while ((++p)->Symbol != symbol)
- {
- LoCnt += p->Freq;
- if (--i == 0)
- {
- HiBitsFlag = HB2Flag[FoundState->Symbol];
- CharMask[p->Symbol] = EscCount;
- i=(NumMasked = MinContext->NumStats)-1;
- FoundState = NULL;
- do { CharMask[(--p)->Symbol] = EscCount; } while ( --i );
- rangeEncoder->Encode(LoCnt, MinContext->SummFreq - LoCnt, MinContext->SummFreq);
- return;
- }
- }
- rangeEncoder->Encode(LoCnt, p->Freq, MinContext->SummFreq);
- update1(p);
- }
-
- void EncodeSymbol2(int symbol, NRangeCoder::CEncoder *rangeEncoder)
- {
- int hiCnt, i = MinContext->NumStats - NumMasked;
- UInt32 scale;
- SEE2_CONTEXT* psee2c = makeEscFreq2(i, scale);
- PPM_CONTEXT::STATE* p = GetStateNoCheck(MinContext->Stats) - 1;
- hiCnt = 0;
- do
- {
- do { p++; } while (CharMask[p->Symbol] == EscCount);
- hiCnt += p->Freq;
- if (p->Symbol == symbol)
- goto SYMBOL_FOUND;
- CharMask[p->Symbol] = EscCount;
- }
- while ( --i );
-
- rangeEncoder->Encode(hiCnt, scale, hiCnt + scale);
- scale += hiCnt;
-
- psee2c->Summ = (UInt16)(psee2c->Summ + scale);
- NumMasked = MinContext->NumStats;
- return;
-SYMBOL_FOUND:
-
- UInt32 highCount = hiCnt;
- UInt32 lowCount = highCount - p->Freq;
- if ( --i )
- {
- PPM_CONTEXT::STATE* p1 = p;
- do
- {
- do { p1++; } while (CharMask[p1->Symbol] == EscCount);
- hiCnt += p1->Freq;
- }
- while ( --i );
- }
- // SubRange.scale += hiCnt;
- scale += hiCnt;
- rangeEncoder->Encode(lowCount, highCount - lowCount, scale);
- psee2c->update();
- update2(p);
- }
-
- void EncodeSymbol(int c, NRangeCoder::CEncoder *rangeEncoder)
- {
- if (MinContext->NumStats != 1)
- EncodeSymbol1(c, rangeEncoder);
- else
- EncodeBinSymbol(c, rangeEncoder);
- while ( !FoundState )
- {
- do
- {
- OrderFall++;
- MinContext = GetContext(MinContext->Suffix);
- if (MinContext == 0)
- return; // S_OK;
- }
- while (MinContext->NumStats == NumMasked);
- EncodeSymbol2(c, rangeEncoder);
- }
- NextContext();
- }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdEncoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdEncoder.cpp
deleted file mode 100644
index ce1b7af02..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdEncoder.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-// PpmdEncoder.cpp
-// 2009-05-30 : Igor Pavlov : Public domain
-
-#include "StdAfx.h"
-
-// #include <fstream.h>
-// #include <iomanip.h>
-
-#include "../Common/StreamUtils.h"
-
-#include "PpmdEncoder.h"
-
-namespace NCompress {
-namespace NPpmd {
-
-const UInt32 kMinMemSize = (1 << 11);
-const UInt32 kMinOrder = 2;
-
-/*
-UInt32 g_NumInner = 0;
-UInt32 g_InnerCycles = 0;
-
-UInt32 g_Encode2 = 0;
-UInt32 g_Encode2Cycles = 0;
-UInt32 g_Encode2Cycles2 = 0;
-
-class CCounter
-{
-public:
- CCounter() {}
- ~CCounter()
- {
- ofstream ofs("Res.dat");
- ofs << "innerEncode1 = " << setw(10) << g_NumInner << endl;
- ofs << "g_InnerCycles = " << setw(10) << g_InnerCycles << endl;
- ofs << "g_Encode2 = " << setw(10) << g_Encode2 << endl;
- ofs << "g_Encode2Cycles = " << setw(10) << g_Encode2Cycles << endl;
- ofs << "g_Encode2Cycles2= " << setw(10) << g_Encode2Cycles2 << endl;
-
- }
-};
-CCounter g_Counter;
-*/
-
-STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
-{
- for (UInt32 i = 0; i < numProps; i++)
- {
- const PROPVARIANT &prop = props[i];
- switch(propIDs[i])
- {
- case NCoderPropID::kUsedMemorySize:
- if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- if (prop.ulVal < kMinMemSize || prop.ulVal > kMaxMemBlockSize)
- return E_INVALIDARG;
- _usedMemorySize = (UInt32)prop.ulVal;
- break;
- case NCoderPropID::kOrder:
- if (prop.vt != VT_UI4)
- return E_INVALIDARG;
- if (prop.ulVal < static_cast< Int32 >( kMinOrder ) || prop.ulVal > static_cast< Int32 >( kMaxOrderCompress) )
- return E_INVALIDARG;
- _order = (Byte)prop.ulVal;
- break;
- default:
- return E_INVALIDARG;
- }
- }
- return S_OK;
-}
-
-STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
-{
- const UInt32 kPropSize = 5;
- Byte props[kPropSize];
- props[0] = _order;
- for (int i = 0; i < 4; i++)
- props[1 + i] = Byte(_usedMemorySize >> (8 * i));
- return WriteStream(outStream, props, kPropSize);
-}
-
-const UInt32 kUsedMemorySizeDefault = (1 << 24);
-const int kOrderDefault = 6;
-
-CEncoder::CEncoder():
- _usedMemorySize(kUsedMemorySizeDefault),
- _order(kOrderDefault)
-{
-}
-
-
-HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
-{
- if (!_inStream.Create(1 << 20))
- return E_OUTOFMEMORY;
- if (!_rangeEncoder.Create(1 << 20))
- return E_OUTOFMEMORY;
- if (!_info.SubAllocator.StartSubAllocator(_usedMemorySize))
- return E_OUTOFMEMORY;
-
- _inStream.SetStream(inStream);
- _inStream.Init();
-
- _rangeEncoder.SetStream(outStream);
- _rangeEncoder.Init();
-
- CEncoderFlusher flusher(this);
-
- _info.MaxOrder = 0;
- _info.StartModelRare(_order);
-
- for (;;)
- {
- UInt32 size = (1 << 18);
- do
- {
- Byte symbol;
- if (!_inStream.ReadByte(symbol))
- {
- // here we can write End Mark for stream version.
- // In current version this feature is not used.
- // _info.EncodeSymbol(-1, &_rangeEncoder);
- return S_OK;
- }
- _info.EncodeSymbol(symbol, &_rangeEncoder);
- }
- while (--size != 0);
- if (progress != NULL)
- {
- UInt64 inSize = _inStream.GetProcessedSize();
- UInt64 outSize = _rangeEncoder.GetProcessedSize();
- RINOK(progress->SetRatioInfo(&inSize, &outSize));
- }
- }
-}
-
-STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(const COutBufferException &e) { return e.ErrorCode; }
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(...) { return E_FAIL; }
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdEncoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdEncoder.h
deleted file mode 100644
index 07b368a7e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdEncoder.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// PpmdEncoder.h
-// 2009-05-30 : Igor Pavlov : Public domain
-
-#ifndef __COMPRESS_PPMD_ENCODER_H
-#define __COMPRESS_PPMD_ENCODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "../Common/InBuffer.h"
-
-#include "PpmdEncode.h"
-#include "RangeCoder.h"
-
-namespace NCompress {
-namespace NPpmd {
-
-class CEncoder :
- public ICompressCoder,
- public ICompressSetCoderProperties,
- public ICompressWriteCoderProperties,
- public CMyUnknownImp
-{
-public:
- CInBuffer _inStream;
-
- NRangeCoder::CEncoder _rangeEncoder;
-
- CEncodeInfo _info;
- UInt32 _usedMemorySize;
- Byte _order;
-
- HRESULT Flush()
- {
- _rangeEncoder.FlushData();
- return _rangeEncoder.FlushStream();
- }
-
- void ReleaseStreams()
- {
- _inStream.ReleaseStream();
- _rangeEncoder.ReleaseStream();
- }
-
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- class CEncoderFlusher
- {
- CEncoder *_encoder;
- public:
- CEncoderFlusher(CEncoder *encoder): _encoder(encoder) {}
- ~CEncoderFlusher()
- {
- _encoder->Flush();
- _encoder->ReleaseStreams();
- }
- };
-
-public:
-
- MY_UNKNOWN_IMP2(
- ICompressSetCoderProperties,
- ICompressWriteCoderProperties)
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
-
- STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
-
- CEncoder();
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdRegister.cpp
deleted file mode 100644
index 9f59fcdd3..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdRegister.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-// PpmdRegister.cpp
-// 2009-05-30 : Igor Pavlov : Public domain
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "PpmdDecoder.h"
-
-static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NPpmd::CDecoder); }
-#ifndef EXTRACT_ONLY
-#include "PpmdEncoder.h"
-static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NPpmd::CEncoder); }
-#else
-#define CreateCodecOut 0
-#endif
-
-static CCodecInfo g_CodecInfo =
- { CreateCodec, CreateCodecOut, 0x030401, L"PPMD", 1, false };
-
-REGISTER_CODEC(PPMD)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdSubAlloc.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdSubAlloc.h
deleted file mode 100644
index f264f6376..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdSubAlloc.h
+++ /dev/null
@@ -1,293 +0,0 @@
-// PpmdSubAlloc.h
-// 2009-05-30 : Igor Pavlov : Public domain
-// This code is based on Dmitry Shkarin's PPMdH code (public domain)
-
-#ifndef __COMPRESS_PPMD_SUB_ALLOC_H
-#define __COMPRESS_PPMD_SUB_ALLOC_H
-
-#include "../../../C/Alloc.h"
-
-#include "PpmdType.h"
-
-const UINT N1=4, N2=4, N3=4, N4=(128+3-1*N1-2*N2-3*N3)/4;
-const UINT UNIT_SIZE=12, N_INDEXES=N1+N2+N3+N4;
-
-// Extra 1 * UNIT_SIZE for NULL support
-// Extra 2 * UNIT_SIZE for s0 in GlueFreeBlocks()
-const UInt32 kExtraSize = (UNIT_SIZE * 3);
-const UInt32 kMaxMemBlockSize = 0xFFFFFFFF - kExtraSize;
-
-struct MEM_BLK
-{
- UInt16 Stamp, NU;
- UInt32 Next, Prev;
- void InsertAt(Byte *Base, UInt32 p)
- {
- Prev = p;
- MEM_BLK *pp = (MEM_BLK *)(Base + p);
- Next = pp->Next;
- pp->Next = ((MEM_BLK *)(Base + Next))->Prev = (UInt32)((Byte *)this - Base);
- }
- void Remove(Byte *Base)
- {
- ((MEM_BLK *)(Base + Prev))->Next = Next;
- ((MEM_BLK *)(Base + Next))->Prev = Prev;
- }
-};
-
-
-class CSubAllocator
-{
- UInt32 SubAllocatorSize;
- Byte Indx2Units[N_INDEXES], Units2Indx[128], GlueCount;
- UInt32 FreeList[N_INDEXES];
-
- Byte *Base;
- Byte *HeapStart, *LoUnit, *HiUnit;
-public:
- Byte *pText, *UnitsStart;
- CSubAllocator():
- SubAllocatorSize(0),
- GlueCount(0),
- LoUnit(0),
- HiUnit(0),
- pText(0),
- UnitsStart(0)
- {
- memset(Indx2Units, 0, sizeof(Indx2Units));
- memset(FreeList, 0, sizeof(FreeList));
- }
- ~CSubAllocator()
- {
- StopSubAllocator();
- };
-
- void *GetPtr(UInt32 offset) const { return (offset == 0) ? 0 : (void *)(Base + offset); }
- void *GetPtrNoCheck(UInt32 offset) const { return (void *)(Base + offset); }
- UInt32 GetOffset(void *ptr) const { return (ptr == 0) ? 0 : (UInt32)((Byte *)ptr - Base); }
- UInt32 GetOffsetNoCheck(void *ptr) const { return (UInt32)((Byte *)ptr - Base); }
- MEM_BLK *GetBlk(UInt32 offset) const { return (MEM_BLK *)(Base + offset); }
- UInt32 *GetNode(UInt32 offset) const { return (UInt32 *)(Base + offset); }
-
- void InsertNode(void* p, int indx)
- {
- *(UInt32 *)p = FreeList[indx];
- FreeList[indx] = GetOffsetNoCheck(p);
- }
-
- void* RemoveNode(int indx)
- {
- UInt32 offset = FreeList[indx];
- UInt32 *p = GetNode(offset);
- FreeList[indx] = *p;
- return (void *)p;
- }
-
- UINT U2B(int NU) const { return (UINT)(NU) * UNIT_SIZE; }
-
- void SplitBlock(void* pv, int oldIndx, int newIndx)
- {
- int i, UDiff = Indx2Units[oldIndx] - Indx2Units[newIndx];
- Byte* p = ((Byte*)pv) + U2B(Indx2Units[newIndx]);
- if (Indx2Units[i = Units2Indx[UDiff-1]] != UDiff)
- {
- InsertNode(p, --i);
- p += U2B(i = Indx2Units[i]);
- UDiff -= i;
- }
- InsertNode(p, Units2Indx[UDiff - 1]);
- }
-
- UInt32 GetUsedMemory() const
- {
- UInt32 RetVal = SubAllocatorSize - (UInt32)(HiUnit - LoUnit) - (UInt32)(UnitsStart - pText);
- for (UInt32 i = 0; i < N_INDEXES; i++)
- for (UInt32 pn = FreeList[i]; pn != 0; RetVal -= (UInt32)Indx2Units[i] * UNIT_SIZE)
- pn = *GetNode(pn);
- return (RetVal >> 2);
- }
-
- UInt32 GetSubAllocatorSize() const { return SubAllocatorSize; }
-
- void StopSubAllocator()
- {
- if (SubAllocatorSize != 0)
- {
- BigFree(Base);
- SubAllocatorSize = 0;
- Base = 0;
- }
- }
-
- bool StartSubAllocator(UInt32 size)
- {
- if (SubAllocatorSize == size)
- return true;
- StopSubAllocator();
- if (size == 0)
- Base = 0;
- else
- {
- if ((Base = (Byte *)::BigAlloc(size + kExtraSize)) == 0)
- return false;
- HeapStart = Base + UNIT_SIZE; // we need such code to support NULL;
- }
- SubAllocatorSize = size;
- return true;
- }
-
- void InitSubAllocator()
- {
- unsigned int i, k;
- memset(FreeList, 0, sizeof(FreeList));
- HiUnit = (pText = HeapStart) + SubAllocatorSize;
- UINT Diff = UNIT_SIZE * (SubAllocatorSize / 8 / UNIT_SIZE * 7);
- LoUnit = UnitsStart = HiUnit - Diff;
- for (i = 0, k=1; i < N1 ; i++, k += 1) Indx2Units[i] = (Byte)k;
- for (k++; i < N1 + N2 ;i++, k += 2) Indx2Units[i] = (Byte)k;
- for (k++; i < N1 + N2 + N3 ;i++,k += 3) Indx2Units[i] = (Byte)k;
- for (k++; i < N1 + N2 + N3 + N4; i++, k += 4) Indx2Units[i] = (Byte)k;
- GlueCount = 0;
- for (k = i = 0; k < 128; k++)
- {
- i += (Indx2Units[i] < k+1);
- Units2Indx[k] = (Byte)i;
- }
- }
-
- void GlueFreeBlocks()
- {
- UInt32 s0 = (UInt32)(HeapStart + SubAllocatorSize - Base);
-
- // We need add exta MEM_BLK with Stamp=0
- GetBlk(s0)->Stamp = 0;
- s0 += UNIT_SIZE;
- MEM_BLK *ps0 = GetBlk(s0);
-
- UInt32 p;
- unsigned int i;
- if (LoUnit != HiUnit)
- *LoUnit=0;
- ps0->Next = ps0->Prev = s0;
-
- for (i = 0; i < N_INDEXES; i++)
- while (FreeList[i] != 0)
- {
- MEM_BLK *pp = (MEM_BLK *)RemoveNode(i);
- pp->InsertAt(Base, s0);
- pp->Stamp = 0xFFFF;
- pp->NU = Indx2Units[i];
- }
- for (p = ps0->Next; p != s0; p = GetBlk(p)->Next)
- {
- for (;;)
- {
- MEM_BLK *pp = GetBlk(p);
- MEM_BLK *pp1 = GetBlk(p + pp->NU * UNIT_SIZE);
- if (pp1->Stamp != 0xFFFF || int(pp->NU) + pp1->NU >= 0x10000)
- break;
- pp1->Remove(Base);
- pp->NU = (UInt16)(pp->NU + pp1->NU);
- }
- }
- while ((p = ps0->Next) != s0)
- {
- MEM_BLK *pp = GetBlk(p);
- pp->Remove(Base);
- int sz;
- for (sz = pp->NU; sz > 128; sz -= 128, p += 128 * UNIT_SIZE)
- InsertNode(Base + p, N_INDEXES - 1);
- if (Indx2Units[i = Units2Indx[sz-1]] != sz)
- {
- int k = sz - Indx2Units[--i];
- InsertNode(Base + p + (sz - k) * UNIT_SIZE, k - 1);
- }
- InsertNode(Base + p, i);
- }
- }
- void* AllocUnitsRare(int indx)
- {
- if ( !GlueCount )
- {
- GlueCount = 255;
- GlueFreeBlocks();
- if (FreeList[indx] != 0)
- return RemoveNode(indx);
- }
- int i = indx;
- do
- {
- if (++i == static_cast< int >( N_INDEXES) )
- {
- GlueCount--;
- i = U2B(Indx2Units[indx]);
- return (UnitsStart - pText > i) ? (UnitsStart -= i) : (NULL);
- }
- } while (FreeList[i] == 0);
- void* RetVal = RemoveNode(i);
- SplitBlock(RetVal, i, indx);
- return RetVal;
- }
-
- void* AllocUnits(int NU)
- {
- int indx = Units2Indx[NU - 1];
- if (FreeList[indx] != 0)
- return RemoveNode(indx);
- void* RetVal = LoUnit;
- LoUnit += U2B(Indx2Units[indx]);
- if (LoUnit <= HiUnit)
- return RetVal;
- LoUnit -= U2B(Indx2Units[indx]);
- return AllocUnitsRare(indx);
- }
-
- void* AllocContext()
- {
- if (HiUnit != LoUnit)
- return (HiUnit -= UNIT_SIZE);
- if (FreeList[0] != 0)
- return RemoveNode(0);
- return AllocUnitsRare(0);
- }
-
- void* ExpandUnits(void* oldPtr, int oldNU)
- {
- int i0=Units2Indx[oldNU - 1], i1=Units2Indx[oldNU - 1 + 1];
- if (i0 == i1)
- return oldPtr;
- void* ptr = AllocUnits(oldNU + 1);
- if (ptr)
- {
- memcpy(ptr, oldPtr, U2B(oldNU));
- InsertNode(oldPtr, i0);
- }
- return ptr;
- }
-
- void* ShrinkUnits(void* oldPtr, int oldNU, int newNU)
- {
- int i0 = Units2Indx[oldNU - 1], i1 = Units2Indx[newNU - 1];
- if (i0 == i1)
- return oldPtr;
- if (FreeList[i1] != 0)
- {
- void* ptr = RemoveNode(i1);
- memcpy(ptr, oldPtr, U2B(newNU));
- InsertNode(oldPtr,i0);
- return ptr;
- }
- else
- {
- SplitBlock(oldPtr, i0, i1);
- return oldPtr;
- }
- }
-
- void FreeUnits(void* ptr, int oldNU)
- {
- InsertNode(ptr, Units2Indx[oldNU - 1]);
- }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdType.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdType.h
deleted file mode 100644
index e4b0203c0..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/PpmdType.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// PpmdType.h
-// 2009-05-30 : Igor Pavlov : Public domain
-// This code is based on Dmitry Shkarin's PPMdH code (public domain)
-
-#ifndef __COMPRESS_PPMD_TYPE_H
-#define __COMPRESS_PPMD_TYPE_H
-
-const int kMaxOrderCompress = 32;
-const int MAX_O = 255; /* maximum allowed model order */
-
-template <class T>
-inline void _PPMD_SWAP(T& t1,T& t2) { T tmp = t1; t1 = t2; t2 = tmp; }
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/QuantumDecoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/QuantumDecoder.cpp
deleted file mode 100644
index b4c1c2563..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/QuantumDecoder.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-// QuantumDecoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/Defs.h"
-
-#include "QuantumDecoder.h"
-
-namespace NCompress {
-namespace NQuantum {
-
-// const UInt32 kDictionarySizeMax = (1 << 21);
-
-const int kLenIdNeedInit = -2;
-
-void CDecoder::Init()
-{
- m_Selector.Init(kNumSelectors);
- for (unsigned int i = 0; i < kNumLitSelectors; i++)
- m_Literals[i].Init(kNumLitSymbols);
- unsigned int numItems = _numDictBits << 1;
- m_PosSlot[0].Init(MyMin(numItems, kNumLen3PosSymbolsMax));
- m_PosSlot[1].Init(MyMin(numItems, kNumLen4PosSymbolsMax));
- m_PosSlot[2].Init(MyMin(numItems, kNumLen5PosSymbolsMax));
- m_LenSlot.Init(kNumLenSymbols);
-}
-
-HRESULT CDecoder::CodeSpec(UInt32 curSize)
-{
- if (_remainLen == kLenIdNeedInit)
- {
- if (!_keepHistory)
- {
- if (!_outWindowStream.Create(_dictionarySize))
- return E_OUTOFMEMORY;
- Init();
- }
- if (!_rangeDecoder.Create(1 << 20))
- return E_OUTOFMEMORY;
- _rangeDecoder.Init();
- _remainLen = 0;
- }
- if (curSize == 0)
- return S_OK;
-
- while(_remainLen > 0 && curSize > 0)
- {
- _remainLen--;
- Byte b = _outWindowStream.GetByte(_rep0);
- _outWindowStream.PutByte(b);
- curSize--;
- }
-
- while(curSize > 0)
- {
- if (_rangeDecoder.Stream.WasFinished())
- return S_FALSE;
-
- unsigned int selector = m_Selector.Decode(&_rangeDecoder);
- if (selector < kNumLitSelectors)
- {
- Byte b = (Byte)((selector << (8 - kNumLitSelectorBits)) + m_Literals[selector].Decode(&_rangeDecoder));
- _outWindowStream.PutByte(b);
- curSize--;
- }
- else
- {
- selector -= kNumLitSelectors;
- unsigned int len = selector + kMatchMinLen;
- if (selector == 2)
- {
- unsigned int lenSlot = m_LenSlot.Decode(&_rangeDecoder);;
- if (lenSlot >= kNumSimpleLenSlots)
- {
- lenSlot -= 2;
- int numDirectBits = (int)(lenSlot >> 2);
- len += ((4 | (lenSlot & 3)) << numDirectBits) - 2;
- if (numDirectBits < 6)
- len += _rangeDecoder.Stream.ReadBits(numDirectBits);
- }
- else
- len += lenSlot;
- }
- UInt32 rep0 = m_PosSlot[selector].Decode(&_rangeDecoder);;
- if (rep0 >= kNumSimplePosSlots)
- {
- int numDirectBits = (int)((rep0 >> 1) - 1);
- rep0 = ((2 | (rep0 & 1)) << numDirectBits) + _rangeDecoder.Stream.ReadBits(numDirectBits);
- }
- unsigned int locLen = len;
- if (len > curSize)
- locLen = (unsigned int)curSize;
- if (!_outWindowStream.CopyBlock(rep0, locLen))
- return S_FALSE;
- curSize -= locLen;
- len -= locLen;
- if (len != 0)
- {
- _remainLen = (int)len;
- _rep0 = rep0;
- break;
- }
- }
- }
- return _rangeDecoder.Stream.WasFinished() ? S_FALSE : S_OK;
-}
-
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- if (outSize == NULL)
- return E_INVALIDARG;
- UInt64 size = *outSize;
-
- SetInStream(inStream);
- _outWindowStream.SetStream(outStream);
- SetOutStreamSize(outSize);
- CDecoderFlusher flusher(this);
-
- const UInt64 start = _outWindowStream.GetProcessedSize();
- for (;;)
- {
- UInt32 curSize = 1 << 18;
- UInt64 rem = size - (_outWindowStream.GetProcessedSize() - start);
- if (curSize > rem)
- curSize = (UInt32)rem;
- if (curSize == 0)
- break;
- RINOK(CodeSpec(curSize));
- if (progress != NULL)
- {
- UInt64 inSize = _rangeDecoder.GetProcessedSize();
- UInt64 nowPos64 = _outWindowStream.GetProcessedSize() - start;
- RINOK(progress->SetRatioInfo(&inSize, &nowPos64));
- }
- }
- flusher.NeedFlush = false;
- return Flush();
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(const CLzOutWindowException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream)
-{
- _rangeDecoder.SetStream(inStream);
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::ReleaseInStream()
-{
- _rangeDecoder.ReleaseStream();
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
-{
- if (outSize == NULL)
- return E_FAIL;
- _remainLen = kLenIdNeedInit;
- _outWindowStream.Init(_keepHistory);
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/QuantumDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/QuantumDecoder.h
deleted file mode 100644
index 383514468..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/QuantumDecoder.h
+++ /dev/null
@@ -1,287 +0,0 @@
-// QuantumDecoder.h
-
-#ifndef __COMPRESS_QUANTUM_DECODER_H
-#define __COMPRESS_QUANTUM_DECODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "../Common/InBuffer.h"
-
-#include "LzOutWindow.h"
-
-namespace NCompress {
-namespace NQuantum {
-
-class CStreamBitDecoder
-{
- UInt32 m_Value;
- CInBuffer m_Stream;
-public:
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream);}
- void ReleaseStream() { m_Stream.ReleaseStream();}
-
- void Finish() { m_Value = 0x10000; }
-
- void Init()
- {
- m_Stream.Init();
- m_Value = 0x10000;
- }
-
- UInt64 GetProcessedSize() const { return m_Stream.GetProcessedSize(); }
- bool WasFinished() const { return m_Stream.WasFinished(); };
-
- UInt32 ReadBit()
- {
- if (m_Value >= 0x10000)
- m_Value = 0x100 | m_Stream.ReadByte();
- UInt32 res = (m_Value >> 7) & 1;
- m_Value <<= 1;
- return res;
- }
-
- UInt32 ReadBits(int numBits) // numBits > 0
- {
- UInt32 res = 0;
- do
- res = (res << 1) | ReadBit();
- while(--numBits != 0);
- return res;
- }
-};
-
-const int kNumLitSelectorBits = 2;
-const unsigned int kNumLitSelectors = (1 << kNumLitSelectorBits);
-const unsigned int kNumLitSymbols = 1 << (8 - kNumLitSelectorBits);
-const unsigned int kNumMatchSelectors = 3;
-const unsigned int kNumSelectors = kNumLitSelectors + kNumMatchSelectors;
-const unsigned int kNumLen3PosSymbolsMax = 24;
-const unsigned int kNumLen4PosSymbolsMax = 36;
-const unsigned int kNumLen5PosSymbolsMax = 42;
-const unsigned int kNumLenSymbols = 27;
-
-const unsigned int kNumSymbolsMax = kNumLitSymbols; // 64
-
-const unsigned int kMatchMinLen = 3;
-const unsigned int kNumSimplePosSlots = 4;
-const unsigned int kNumSimpleLenSlots = 6;
-
-namespace NRangeCoder {
-
-class CDecoder
-{
- UInt32 Low;
- UInt32 Range;
- UInt32 Code;
-public:
- CStreamBitDecoder Stream;
- bool Create(UInt32 bufferSize) { return Stream.Create(bufferSize); }
- void SetStream(ISequentialInStream *stream) { Stream.SetStream(stream); }
- void ReleaseStream() { Stream.ReleaseStream(); }
-
- void Init()
- {
- Stream.Init();
- Low = 0;
- Range = 0x10000;
- Code = Stream.ReadBits(16);
- }
-
- void Finish()
- {
- // we need these extra two Bit_reads
- Stream.ReadBit();
- Stream.ReadBit();
- Stream.Finish();
- }
-
- UInt64 GetProcessedSize() const { return Stream.GetProcessedSize(); }
-
- UInt32 GetThreshold(UInt32 total) const
- {
- return ((Code + 1) * total - 1) / Range; // & 0xFFFF is not required;
- }
-
- void Decode(UInt32 start, UInt32 end, UInt32 total)
- {
- UInt32 high = Low + end * Range / total - 1;
- UInt32 offset = start * Range / total;
- Code -= offset;
- Low += offset;
- for (;;)
- {
- if ((Low & 0x8000) != (high & 0x8000))
- {
- if ((Low & 0x4000) == 0 || (high & 0x4000) != 0)
- break;
- Low &= 0x3FFF;
- high |= 0x4000;
- }
- Low = (Low << 1) & 0xFFFF;
- high = ((high << 1) | 1) & 0xFFFF;
- Code = ((Code << 1) | Stream.ReadBit());
- }
- Range = high - Low + 1;
- }
-};
-
-const UInt16 kUpdateStep = 8;
-const UInt16 kFreqSumMax = 3800;
-const UInt16 kReorderCountStart = 4;
-const UInt16 kReorderCount = 50;
-
-class CModelDecoder
-{
- unsigned int NumItems;
- unsigned int ReorderCount;
- UInt16 Freqs[kNumSymbolsMax + 1];
- Byte Values[kNumSymbolsMax];
-public:
- void Init(unsigned int numItems)
- {
- NumItems = numItems;
- ReorderCount = kReorderCountStart;
- for(unsigned int i = 0; i < numItems; i++)
- {
- Freqs[i] = (UInt16)(numItems - i);
- Values[i] = (Byte)i;
- }
- Freqs[numItems] = 0;
- }
-
- unsigned int Decode(CDecoder *rangeDecoder)
- {
- UInt32 threshold = rangeDecoder->GetThreshold(Freqs[0]);
- unsigned int i;
- for (i = 1; Freqs[i] > threshold; i++) {}
- rangeDecoder->Decode(Freqs[i], Freqs[i - 1], Freqs[0]);
- unsigned int res = Values[--i];
- do
- Freqs[i] += kUpdateStep;
- while(i-- != 0);
-
- if (Freqs[0] > kFreqSumMax)
- {
- if (--ReorderCount == 0)
- {
- ReorderCount = kReorderCount;
- for(i = 0; i < NumItems; i++)
- Freqs[i] = (UInt16)(((Freqs[i] - Freqs[i + 1]) + 1) >> 1);
- for(i = 0; i < NumItems - 1; i++)
- for(unsigned int j = i + 1; j < NumItems; j++)
- if (Freqs[i] < Freqs[j])
- {
- UInt16 tmpFreq = Freqs[i];
- Byte tmpVal = Values[i];
- Freqs[i] = Freqs[j];
- Values[i] = Values[j];
- Freqs[j] = tmpFreq;
- Values[j] = tmpVal;
- }
- do
- Freqs[i] = (UInt16)(Freqs[i] + Freqs[i + 1]);
- while(i-- != 0);
- }
- else
- {
- i = NumItems - 1;
- do
- {
- Freqs[i] >>= 1;
- if (Freqs[i] <= Freqs[i + 1])
- Freqs[i] = (UInt16)(Freqs[i + 1] + 1);
- }
- while(i-- != 0);
- }
- }
- return res;
- };
-};
-
-}
-
-class CDecoder:
- public ICompressCoder,
- public ICompressSetInStream,
- public ICompressSetOutStreamSize,
- public CMyUnknownImp
-{
- CLzOutWindow _outWindowStream;
- NRangeCoder::CDecoder _rangeDecoder;
-
- ///////////////////
- // State
- UInt64 _outSize;
- // UInt64 _nowPos64;
- int _remainLen; // -1 means end of stream. // -2 means need Init
- UInt32 _rep0;
-
- int _numDictBits;
- UInt32 _dictionarySize;
-
- NRangeCoder::CModelDecoder m_Selector;
- NRangeCoder::CModelDecoder m_Literals[kNumLitSelectors];
- NRangeCoder::CModelDecoder m_PosSlot[kNumMatchSelectors];
- NRangeCoder::CModelDecoder m_LenSlot;
-
- bool _keepHistory;
-
- void Init();
- HRESULT CodeSpec(UInt32 size);
-public:
- MY_UNKNOWN_IMP2(
- ICompressSetInStream,
- ICompressSetOutStreamSize)
-
- void ReleaseStreams()
- {
- _outWindowStream.ReleaseStream();
- ReleaseInStream();
- }
-
- class CDecoderFlusher
- {
- CDecoder *_decoder;
- public:
- bool NeedFlush;
- CDecoderFlusher(CDecoder *decoder): _decoder(decoder), NeedFlush(true) {}
- ~CDecoderFlusher()
- {
- if (NeedFlush)
- _decoder->Flush();
- _decoder->ReleaseStreams();
- }
- };
-
- HRESULT Flush() { return _outWindowStream.Flush(); }
-
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(SetInStream)(ISequentialInStream *inStream);
- STDMETHOD(ReleaseInStream)();
- STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
-
- void SetParams(int numDictBits)
- {
- _numDictBits = numDictBits;
- _dictionarySize = (UInt32)1 << numDictBits;
- }
- void SetKeepHistory(bool keepHistory)
- {
- _keepHistory = keepHistory;
- }
-
- CDecoder(): _keepHistory(false) {}
- virtual ~CDecoder() {}
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/RangeCoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/RangeCoder.h
deleted file mode 100644
index 1eb2a6d47..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/RangeCoder.h
+++ /dev/null
@@ -1,205 +0,0 @@
-// Compress/RangeCoder.h
-// 2009-05-30 : Igor Pavlov : Public domain
-
-#ifndef __COMPRESS_RANGE_CODER_H
-#define __COMPRESS_RANGE_CODER_H
-
-#include "../Common/InBuffer.h"
-#include "../Common/OutBuffer.h"
-
-namespace NCompress {
-namespace NRangeCoder {
-
-const int kNumTopBits = 24;
-const UInt32 kTopValue = (1 << kNumTopBits);
-
-class CEncoder
-{
- UInt32 _cacheSize;
- Byte _cache;
-public:
- UInt64 Low;
- UInt32 Range;
- COutBuffer Stream;
- bool Create(UInt32 bufferSize) { return Stream.Create(bufferSize); }
-
- void SetStream(ISequentialOutStream *stream) { Stream.SetStream(stream); }
- void Init()
- {
- Stream.Init();
- Low = 0;
- Range = 0xFFFFFFFF;
- _cacheSize = 1;
- _cache = 0;
- }
-
- void FlushData()
- {
- // Low += 1;
- for(int i = 0; i < 5; i++)
- ShiftLow();
- }
-
- HRESULT FlushStream() { return Stream.Flush(); }
-
- void ReleaseStream() { Stream.ReleaseStream(); }
-
- void Encode(UInt32 start, UInt32 size, UInt32 total)
- {
- Low += start * (Range /= total);
- Range *= size;
- while (Range < kTopValue)
- {
- Range <<= 8;
- ShiftLow();
- }
- }
-
- void ShiftLow()
- {
- if ((UInt32)Low < (UInt32)0xFF000000 || (int)(Low >> 32) != 0)
- {
- Byte temp = _cache;
- do
- {
- Stream.WriteByte((Byte)(temp + (Byte)(Low >> 32)));
- temp = 0xFF;
- }
- while(--_cacheSize != 0);
- _cache = (Byte)((UInt32)Low >> 24);
- }
- _cacheSize++;
- Low = (UInt32)Low << 8;
- }
-
- void EncodeDirectBits(UInt32 value, int numBits)
- {
- for (numBits--; numBits >= 0; numBits--)
- {
- Range >>= 1;
- Low += Range & (0 - ((value >> numBits) & 1));
- if (Range < kTopValue)
- {
- Range <<= 8;
- ShiftLow();
- }
- }
- }
-
- void EncodeBit(UInt32 size0, UInt32 numTotalBits, UInt32 symbol)
- {
- UInt32 newBound = (Range >> numTotalBits) * size0;
- if (symbol == 0)
- Range = newBound;
- else
- {
- Low += newBound;
- Range -= newBound;
- }
- while (Range < kTopValue)
- {
- Range <<= 8;
- ShiftLow();
- }
- }
-
- UInt64 GetProcessedSize() { return Stream.GetProcessedSize() + _cacheSize + 4; }
-};
-
-class CDecoder
-{
-public:
- CInBuffer Stream;
- UInt32 Range;
- UInt32 Code;
- bool Create(UInt32 bufferSize) { return Stream.Create(bufferSize); }
-
- void Normalize()
- {
- while (Range < kTopValue)
- {
- Code = (Code << 8) | Stream.ReadByte();
- Range <<= 8;
- }
- }
-
- void SetStream(ISequentialInStream *stream) { Stream.SetStream(stream); }
- void Init()
- {
- Stream.Init();
- Code = 0;
- Range = 0xFFFFFFFF;
- for(int i = 0; i < 5; i++)
- Code = (Code << 8) | Stream.ReadByte();
- }
-
- void ReleaseStream() { Stream.ReleaseStream(); }
-
- UInt32 GetThreshold(UInt32 total)
- {
- return (Code) / ( Range /= total);
- }
-
- void Decode(UInt32 start, UInt32 size)
- {
- Code -= start * Range;
- Range *= size;
- Normalize();
- }
-
- UInt32 DecodeDirectBits(int numTotalBits)
- {
- UInt32 range = Range;
- UInt32 code = Code;
- UInt32 result = 0;
- for (int i = numTotalBits; i != 0; i--)
- {
- range >>= 1;
- /*
- result <<= 1;
- if (code >= range)
- {
- code -= range;
- result |= 1;
- }
- */
- UInt32 t = (code - range) >> 31;
- code -= range & (t - 1);
- result = (result << 1) | (1 - t);
-
- if (range < kTopValue)
- {
- code = (code << 8) | Stream.ReadByte();
- range <<= 8;
- }
- }
- Range = range;
- Code = code;
- return result;
- }
-
- UInt32 DecodeBit(UInt32 size0, UInt32 numTotalBits)
- {
- UInt32 newBound = (Range >> numTotalBits) * size0;
- UInt32 symbol;
- if (Code < newBound)
- {
- symbol = 0;
- Range = newBound;
- }
- else
- {
- symbol = 1;
- Code -= newBound;
- Range -= newBound;
- }
- Normalize();
- return symbol;
- }
-
- UInt64 GetProcessedSize() {return Stream.GetProcessedSize(); }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/RangeCoderBit.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/RangeCoderBit.h
deleted file mode 100644
index b5a1830d6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/RangeCoderBit.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Compress/RangeCoderBit.h
-// 2009-05-30 : Igor Pavlov : Public domain
-
-#ifndef __COMPRESS_RANGE_CODER_BIT_H
-#define __COMPRESS_RANGE_CODER_BIT_H
-
-#include "RangeCoder.h"
-
-namespace NCompress {
-namespace NRangeCoder {
-
-const int kNumBitModelTotalBits = 11;
-const UInt32 kBitModelTotal = (1 << kNumBitModelTotalBits);
-
-const int kNumMoveReducingBits = 4;
-
-const int kNumBitPriceShiftBits = 4;
-const UInt32 kBitPrice = 1 << kNumBitPriceShiftBits;
-
-extern UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
-
-template <int numMoveBits>
-class CBitModel
-{
-public:
- UInt32 Prob;
- void UpdateModel(UInt32 symbol)
- {
- /*
- Prob -= (Prob + ((symbol - 1) & ((1 << numMoveBits) - 1))) >> numMoveBits;
- Prob += (1 - symbol) << (kNumBitModelTotalBits - numMoveBits);
- */
- if (symbol == 0)
- Prob += (kBitModelTotal - Prob) >> numMoveBits;
- else
- Prob -= (Prob) >> numMoveBits;
- }
-public:
- void Init() { Prob = kBitModelTotal / 2; }
-};
-
-template <int numMoveBits>
-class CBitEncoder: public CBitModel<numMoveBits>
-{
-public:
- void Encode(CEncoder *encoder, UInt32 symbol)
- {
- /*
- encoder->EncodeBit(this->Prob, kNumBitModelTotalBits, symbol);
- this->UpdateModel(symbol);
- */
- UInt32 newBound = (encoder->Range >> kNumBitModelTotalBits) * this->Prob;
- if (symbol == 0)
- {
- encoder->Range = newBound;
- this->Prob += (kBitModelTotal - this->Prob) >> numMoveBits;
- }
- else
- {
- encoder->Low += newBound;
- encoder->Range -= newBound;
- this->Prob -= (this->Prob) >> numMoveBits;
- }
- if (encoder->Range < kTopValue)
- {
- encoder->Range <<= 8;
- encoder->ShiftLow();
- }
- }
- UInt32 GetPrice(UInt32 symbol) const
- {
- return ProbPrices[(this->Prob ^ ((-(int)symbol)) & (kBitModelTotal - 1)) >> kNumMoveReducingBits];
- }
- UInt32 GetPrice0() const { return ProbPrices[this->Prob >> kNumMoveReducingBits]; }
- UInt32 GetPrice1() const { return ProbPrices[(this->Prob ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]; }
-};
-
-
-template <int numMoveBits>
-class CBitDecoder: public CBitModel<numMoveBits>
-{
-public:
- UInt32 Decode(CDecoder *decoder)
- {
- UInt32 newBound = (decoder->Range >> kNumBitModelTotalBits) * this->Prob;
- if (decoder->Code < newBound)
- {
- decoder->Range = newBound;
- this->Prob += (kBitModelTotal - this->Prob) >> numMoveBits;
- if (decoder->Range < kTopValue)
- {
- decoder->Code = (decoder->Code << 8) | decoder->Stream.ReadByte();
- decoder->Range <<= 8;
- }
- return 0;
- }
- else
- {
- decoder->Range -= newBound;
- decoder->Code -= newBound;
- this->Prob -= (this->Prob) >> numMoveBits;
- if (decoder->Range < kTopValue)
- {
- decoder->Code = (decoder->Code << 8) | decoder->Stream.ReadByte();
- decoder->Range <<= 8;
- }
- return 1;
- }
- }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar1Decoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar1Decoder.cpp
deleted file mode 100644
index c7540b922..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar1Decoder.cpp
+++ /dev/null
@@ -1,478 +0,0 @@
-// Rar1Decoder.cpp
-// According to unRAR license, this code may not be used to develop
-// a program that creates RAR archives
-
-#include "StdAfx.h"
-
-#include "Rar1Decoder.h"
-
-namespace NCompress {
-namespace NRar1 {
-
-static UInt32 PosL1[]={0,0,0,2,3,5,7,11,16,20,24,32,32, 256};
-static UInt32 PosL2[]={0,0,0,0,5,7,9,13,18,22,26,34,36, 256};
-static UInt32 PosHf0[]={0,0,0,0,0,8,16,24,33,33,33,33,33, 257};
-static UInt32 PosHf1[]={0,0,0,0,0,0,4,44,60,76,80,80,127, 257};
-static UInt32 PosHf2[]={0,0,0,0,0,0,2,7,53,117,233, 257,0};
-static UInt32 PosHf3[]={0,0,0,0,0,0,0,2,16,218,251, 257,0};
-static UInt32 PosHf4[]={0,0,0,0,0,0,0,0,0,255, 257,0,0};
-
-static const UInt32 kHistorySize = (1 << 16);
-
-class CCoderReleaser
-{
- CDecoder *m_Coder;
-public:
- CCoderReleaser(CDecoder *coder): m_Coder(coder) {}
- ~CCoderReleaser() { m_Coder->ReleaseStreams(); }
-};
-
-CDecoder::CDecoder(): m_IsSolid(false) { }
-
-void CDecoder::InitStructures()
-{
- for(int i = 0; i < kNumRepDists; i++)
- m_RepDists[i] = 0;
- m_RepDistPtr = 0;
- LastLength = 0;
- LastDist = 0;
-}
-
-UInt32 CDecoder::ReadBits(int numBits) { return m_InBitStream.ReadBits(numBits); }
-
-HRESULT CDecoder::CopyBlock(UInt32 distance, UInt32 len)
-{
- m_UnpackSize -= len;
- return m_OutWindowStream.CopyBlock(distance, len) ? S_OK : S_FALSE;
-}
-
-
-UInt32 CDecoder::DecodeNum(const UInt32 *posTab)
-{
- UInt32 startPos = 2;
- UInt32 num = m_InBitStream.GetValue(12);
- for (;;)
- {
- UInt32 cur = (posTab[startPos + 1] - posTab[startPos]) << (12 - startPos);
- if (num < cur)
- break;
- startPos++;
- num -= cur;
- }
- m_InBitStream.MovePos(startPos);
- return((num >> (12 - startPos)) + posTab[startPos]);
-}
-
-static Byte kShortLen1[] = {1,3,4,4,5,6,7,8,8,4,4,5,6,6 };
-static Byte kShortLen1a[] = {1,4,4,4,5,6,7,8,8,4,4,5,6,6,4 };
-static Byte kShortLen2[] = {2,3,3,3,4,4,5,6,6,4,4,5,6,6 };
-static Byte kShortLen2a[] = {2,3,3,4,4,4,5,6,6,4,4,5,6,6,4 };
-static UInt32 kShortXor1[] = {0,0xa0,0xd0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff,0xc0,0x80,0x90,0x98,0x9c,0xb0};
-static UInt32 kShortXor2[] = {0,0x40,0x60,0xa0,0xd0,0xe0,0xf0,0xf8,0xfc,0xc0,0x80,0x90,0x98,0x9c,0xb0};
-
-HRESULT CDecoder::ShortLZ()
-{
- UInt32 len, saveLen, dist;
- int distancePlace;
- Byte *kShortLen;
- const UInt32 *kShortXor;
- NumHuf = 0;
-
- if (LCount == 2)
- {
- if (ReadBits(1))
- return CopyBlock(LastDist, LastLength);
- LCount = 0;
- }
-
- UInt32 bitField = m_InBitStream.GetValue(8);
-
- if (AvrLn1 < 37)
- {
- kShortLen = Buf60 ? kShortLen1a : kShortLen1;
- kShortXor = kShortXor1;
- }
- else
- {
- kShortLen = Buf60 ? kShortLen2a : kShortLen2;
- kShortXor = kShortXor2;
- }
-
- for (len = 0; ((bitField ^ kShortXor[len]) & (~(0xff >> kShortLen[len]))) != 0; len++);
- m_InBitStream.MovePos(kShortLen[len]);
-
- if (len >= 9)
- {
- if (len == 9)
- {
- LCount++;
- return CopyBlock(LastDist, LastLength);
- }
- if (len == 14)
- {
- LCount = 0;
- len = DecodeNum(PosL2) + 5;
- dist = 0x8000 + ReadBits(15) - 1;
- LastLength = len;
- LastDist = dist;
- return CopyBlock(dist, len);
- }
-
- LCount = 0;
- saveLen = len;
- dist = m_RepDists[(m_RepDistPtr - (len - 9)) & 3];
- len = DecodeNum(PosL1) + 2;
- if (len == 0x101 && saveLen == 10)
- {
- Buf60 ^= 1;
- return S_OK;
- }
- if (dist >= 256)
- len++;
- if (dist >= MaxDist3 - 1)
- len++;
- }
- else
- {
- LCount = 0;
- AvrLn1 += len;
- AvrLn1 -= AvrLn1 >> 4;
-
- distancePlace = DecodeNum(PosHf2) & 0xff;
- dist = ChSetA[distancePlace];
- if (--distancePlace != -1)
- {
- PlaceA[dist]--;
- UInt32 lastDistance = ChSetA[distancePlace];
- PlaceA[lastDistance]++;
- ChSetA[distancePlace + 1] = lastDistance;
- ChSetA[distancePlace] = dist;
- }
- len += 2;
- }
- m_RepDists[m_RepDistPtr++] = dist;
- m_RepDistPtr &= 3;
- LastLength = len;
- LastDist = dist;
- return CopyBlock(dist, len);
-}
-
-
-HRESULT CDecoder::LongLZ()
-{
- UInt32 len;
- UInt32 dist;
- UInt32 distancePlace, newDistancePlace;
- UInt32 oldAvr2, oldAvr3;
-
- NumHuf = 0;
- Nlzb += 16;
- if (Nlzb > 0xff)
- {
- Nlzb = 0x90;
- Nhfb >>= 1;
- }
- oldAvr2=AvrLn2;
-
- if (AvrLn2 >= 122)
- len = DecodeNum(PosL2);
- else if (AvrLn2 >= 64)
- len = DecodeNum(PosL1);
- else
- {
- UInt32 bitField = m_InBitStream.GetValue(16);
- if (bitField < 0x100)
- {
- len = bitField;
- m_InBitStream.MovePos(16);
- }
- else
- {
- for (len = 0; ((bitField << len) & 0x8000) == 0; len++)
- ;
- m_InBitStream.MovePos(len + 1);
- }
- }
-
- AvrLn2 += len;
- AvrLn2 -= AvrLn2 >> 5;
-
- if (AvrPlcB > 0x28ff)
- distancePlace = DecodeNum(PosHf2);
- else if (AvrPlcB > 0x6ff)
- distancePlace = DecodeNum(PosHf1);
- else
- distancePlace = DecodeNum(PosHf0);
-
- AvrPlcB += distancePlace;
- AvrPlcB -= AvrPlcB >> 8;
- for (;;)
- {
- dist = ChSetB[distancePlace & 0xff];
- newDistancePlace = NToPlB[dist++ & 0xff]++;
- if (!(dist & 0xff))
- CorrHuff(ChSetB,NToPlB);
- else
- break;
- }
-
- ChSetB[distancePlace] = ChSetB[newDistancePlace];
- ChSetB[newDistancePlace] = dist;
-
- dist = ((dist & 0xff00) >> 1) | ReadBits(7);
-
- oldAvr3 = AvrLn3;
- if (len != 1 && len != 4)
- if (len == 0 && dist <= MaxDist3)
- {
- AvrLn3++;
- AvrLn3 -= AvrLn3 >> 8;
- }
- else
- if (AvrLn3 > 0)
- AvrLn3--;
- len += 3;
- if (dist >= MaxDist3)
- len++;
- if (dist <= 256)
- len += 8;
- if (oldAvr3 > 0xb0 || AvrPlc >= 0x2a00 && oldAvr2 < 0x40)
- MaxDist3 = 0x7f00;
- else
- MaxDist3 = 0x2001;
- m_RepDists[m_RepDistPtr++] = --dist;
- m_RepDistPtr &= 3;
- LastLength = len;
- LastDist = dist;
- return CopyBlock(dist, len);
-}
-
-
-HRESULT CDecoder::HuffDecode()
-{
- UInt32 curByte, newBytePlace;
- UInt32 len;
- UInt32 dist;
- int bytePlace;
-
- if (AvrPlc > 0x75ff) bytePlace = DecodeNum(PosHf4);
- else if (AvrPlc > 0x5dff) bytePlace = DecodeNum(PosHf3);
- else if (AvrPlc > 0x35ff) bytePlace = DecodeNum(PosHf2);
- else if (AvrPlc > 0x0dff) bytePlace = DecodeNum(PosHf1);
- else bytePlace = DecodeNum(PosHf0);
- if (StMode)
- {
- if (--bytePlace == -1)
- {
- if (ReadBits(1))
- {
- NumHuf = StMode = 0;
- return S_OK;
- }
- else
- {
- len = (ReadBits(1)) ? 4 : 3;
- dist = DecodeNum(PosHf2);
- dist = (dist << 5) | ReadBits(5);
- return CopyBlock(dist - 1, len);
- }
- }
- }
- else if (NumHuf++ >= 16 && FlagsCnt == 0)
- StMode = 1;
- bytePlace &= 0xff;
- AvrPlc += bytePlace;
- AvrPlc -= AvrPlc >> 8;
- Nhfb+=16;
- if (Nhfb > 0xff)
- {
- Nhfb=0x90;
- Nlzb >>= 1;
- }
-
- m_UnpackSize --;
- m_OutWindowStream.PutByte((Byte)(ChSet[bytePlace] >> 8));
-
- for (;;)
- {
- curByte = ChSet[bytePlace];
- newBytePlace = NToPl[curByte++ & 0xff]++;
- if ((curByte & 0xff) > 0xa1)
- CorrHuff(ChSet, NToPl);
- else
- break;
- }
-
- ChSet[bytePlace] = ChSet[newBytePlace];
- ChSet[newBytePlace] = curByte;
- return S_OK;
-}
-
-
-void CDecoder::GetFlagsBuf()
-{
- UInt32 flags, newFlagsPlace;
- UInt32 flagsPlace = DecodeNum(PosHf2);
-
- for (;;)
- {
- flags = ChSetC[flagsPlace];
- FlagBuf = flags >> 8;
- newFlagsPlace = NToPlC[flags++ & 0xff]++;
- if ((flags & 0xff) != 0)
- break;
- CorrHuff(ChSetC, NToPlC);
- }
-
- ChSetC[flagsPlace] = ChSetC[newFlagsPlace];
- ChSetC[newFlagsPlace] = flags;
-}
-
-void CDecoder::InitData()
-{
- if (!m_IsSolid)
- {
- AvrPlcB = AvrLn1 = AvrLn2 = AvrLn3 = NumHuf = Buf60 = 0;
- AvrPlc = 0x3500;
- MaxDist3 = 0x2001;
- Nhfb = Nlzb = 0x80;
- }
- FlagsCnt = 0;
- FlagBuf = 0;
- StMode = 0;
- LCount = 0;
-}
-
-void CDecoder::CorrHuff(UInt32 *CharSet,UInt32 *NumToPlace)
-{
- int i;
- for (i = 7; i >= 0; i--)
- for (int j = 0; j < 32; j++, CharSet++)
- *CharSet = (*CharSet & ~0xff) | i;
- memset(NumToPlace, 0, sizeof(NToPl));
- for (i = 6; i >= 0; i--)
- NumToPlace[i] = (7 - i) * 32;
-}
-
-void CDecoder::InitHuff()
-{
- for (UInt32 i = 0; i < 256; i++)
- {
- Place[i] = PlaceA[i] = PlaceB[i] = i;
- PlaceC[i] = (~i + 1) & 0xff;
- ChSet[i] = ChSetB[i] = i << 8;
- ChSetA[i] = i;
- ChSetC[i] = ((~i + 1) & 0xff) << 8;
- }
- memset(NToPl, 0, sizeof(NToPl));
- memset(NToPlB, 0, sizeof(NToPlB));
- memset(NToPlC, 0, sizeof(NToPlC));
- CorrHuff(ChSetB, NToPlB);
-}
-
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo * /* progress */)
-{
- if (inSize == NULL || outSize == NULL)
- return E_INVALIDARG;
-
- if (!m_OutWindowStream.Create(kHistorySize))
- return E_OUTOFMEMORY;
- if (!m_InBitStream.Create(1 << 20))
- return E_OUTOFMEMORY;
-
- m_UnpackSize = (Int64)*outSize;
- m_OutWindowStream.SetStream(outStream);
- m_OutWindowStream.Init(m_IsSolid);
- m_InBitStream.SetStream(inStream);
- m_InBitStream.Init();
-
- CCoderReleaser coderReleaser(this);
- InitData();
- if (!m_IsSolid)
- {
- InitStructures();
- InitHuff();
- }
- if (m_UnpackSize > 0)
- {
- GetFlagsBuf();
- FlagsCnt = 8;
- }
-
- while (m_UnpackSize > 0)
- {
- if (StMode)
- {
- RINOK(HuffDecode());
- continue;
- }
-
- if (--FlagsCnt < 0)
- {
- GetFlagsBuf();
- FlagsCnt=7;
- }
-
- if (FlagBuf & 0x80)
- {
- FlagBuf <<= 1;
- if (Nlzb > Nhfb)
- {
- RINOK(LongLZ());
- }
- else
- {
- RINOK(HuffDecode());
- }
- }
- else
- {
- FlagBuf <<= 1;
- if (--FlagsCnt < 0)
- {
- GetFlagsBuf();
- FlagsCnt = 7;
- }
- if (FlagBuf & 0x80)
- {
- FlagBuf <<= 1;
- if (Nlzb > Nhfb)
- {
- RINOK(HuffDecode());
- }
- else
- {
- RINOK(LongLZ());
- }
- }
- else
- {
- FlagBuf <<= 1;
- RINOK(ShortLZ());
- }
- }
- }
- if (m_UnpackSize < 0)
- return S_FALSE;
- return m_OutWindowStream.Flush();
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(const CLzOutWindowException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
-{
- if (size < 1)
- return E_INVALIDARG;
- m_IsSolid = (data[0] != 0);
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar1Decoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar1Decoder.h
deleted file mode 100644
index f7c08b386..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar1Decoder.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Rar1Decoder.h
-// According to unRAR license, this code may not be used to develop
-// a program that creates RAR archives
-
-#ifndef __COMPRESS_RAR1_DECODER_H
-#define __COMPRESS_RAR1_DECODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "../Common/InBuffer.h"
-
-#include "BitmDecoder.h"
-#include "HuffmanDecoder.h"
-#include "LzOutWindow.h"
-
-namespace NCompress {
-namespace NRar1 {
-
-const UInt32 kNumRepDists = 4;
-
-typedef NBitm::CDecoder<CInBuffer> CBitDecoder;
-
-class CDecoder :
- public ICompressCoder,
- public ICompressSetDecoderProperties2,
- public CMyUnknownImp
-{
-public:
- CLzOutWindow m_OutWindowStream;
- CBitDecoder m_InBitStream;
-
- UInt32 m_RepDists[kNumRepDists];
- UInt32 m_RepDistPtr;
-
- UInt32 LastDist;
- UInt32 LastLength;
-
- Int64 m_UnpackSize;
- bool m_IsSolid;
-
- UInt32 ReadBits(int numBits);
- HRESULT CopyBlock(UInt32 distance, UInt32 len);
-
- UInt32 DecodeNum(const UInt32 *posTab);
- HRESULT ShortLZ();
- HRESULT LongLZ();
- HRESULT HuffDecode();
- void GetFlagsBuf();
- void InitData();
- void InitHuff();
- void CorrHuff(UInt32 *CharSet, UInt32 *NumToPlace);
- void OldUnpWriteBuf();
-
- UInt32 ChSet[256],ChSetA[256],ChSetB[256],ChSetC[256];
- UInt32 Place[256],PlaceA[256],PlaceB[256],PlaceC[256];
- UInt32 NToPl[256],NToPlB[256],NToPlC[256];
- UInt32 FlagBuf,AvrPlc,AvrPlcB,AvrLn1,AvrLn2,AvrLn3;
- int Buf60,NumHuf,StMode,LCount,FlagsCnt;
- UInt32 Nhfb,Nlzb,MaxDist3;
-
- void InitStructures();
-
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
-public:
- CDecoder();
-
- MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2)
-
- void ReleaseStreams()
- {
- m_OutWindowStream.ReleaseStream();
- m_InBitStream.ReleaseStream();
- }
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar2Decoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar2Decoder.cpp
deleted file mode 100644
index 16d6b30cb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar2Decoder.cpp
+++ /dev/null
@@ -1,389 +0,0 @@
-// Rar2Decoder.cpp
-// According to unRAR license, this code may not be used to develop
-// a program that creates RAR archives
-
-#include "StdAfx.h"
-
-#include "Rar2Decoder.h"
-
-namespace NCompress {
-namespace NRar2 {
-
-namespace NMultimedia {
-
-Byte CFilter::Decode(int &channelDelta, Byte deltaByte)
-{
- D4 = D3;
- D3 = D2;
- D2 = LastDelta - D1;
- D1 = LastDelta;
- int predictedValue = ((8 * LastChar + K1 * D1 + K2 * D2 + K3 * D3 + K4 * D4 + K5 * channelDelta) >> 3);
-
- Byte realValue = (Byte)(predictedValue - deltaByte);
- int i = ((int)(signed char)deltaByte) << 3;
-
- Dif[0] += abs(i);
- Dif[1] += abs(i - D1);
- Dif[2] += abs(i + D1);
- Dif[3] += abs(i - D2);
- Dif[4] += abs(i + D2);
- Dif[5] += abs(i - D3);
- Dif[6] += abs(i + D3);
- Dif[7] += abs(i - D4);
- Dif[8] += abs(i + D4);
- Dif[9] += abs(i - channelDelta);
- Dif[10] += abs(i + channelDelta);
-
- channelDelta = LastDelta = (signed char)(realValue - LastChar);
- LastChar = realValue;
-
- if (((++ByteCount) & 0x1F) == 0)
- {
- UInt32 minDif = Dif[0];
- UInt32 numMinDif = 0;
- Dif[0] = 0;
- for (i = 1; i < sizeof(Dif) / sizeof(Dif[0]); i++)
- {
- if (Dif[i] < minDif)
- {
- minDif = Dif[i];
- numMinDif = i;
- }
- Dif[i] = 0;
- }
- switch(numMinDif)
- {
- case 1: if (K1 >= -16) K1--; break;
- case 2: if (K1 < 16) K1++; break;
- case 3: if (K2 >= -16) K2--; break;
- case 4: if (K2 < 16) K2++; break;
- case 5: if (K3 >= -16) K3--; break;
- case 6: if (K3 < 16) K3++; break;
- case 7: if (K4 >= -16) K4--; break;
- case 8: if (K4 < 16) K4++; break;
- case 9: if (K5 >= -16) K5--; break;
- case 10:if (K5 < 16) K5++; break;
- }
- }
- return realValue;
-}
-}
-
-static const char *kNumberErrorMessage = "Number error";
-
-static const UInt32 kHistorySize = 1 << 20;
-
-static const int kNumStats = 11;
-
-static const UInt32 kWindowReservSize = (1 << 22) + 256;
-
-CDecoder::CDecoder():
- m_IsSolid(false)
-{
-}
-
-void CDecoder::InitStructures()
-{
- m_MmFilter.Init();
- for(int i = 0; i < kNumRepDists; i++)
- m_RepDists[i] = 0;
- m_RepDistPtr = 0;
- m_LastLength = 0;
- memset(m_LastLevels, 0, kMaxTableSize);
-}
-
-UInt32 CDecoder::ReadBits(int numBits) { return m_InBitStream.ReadBits(numBits); }
-
-#define RIF(x) { if (!(x)) return false; }
-
-bool CDecoder::ReadTables(void)
-{
- Byte levelLevels[kLevelTableSize];
- Byte newLevels[kMaxTableSize];
- m_AudioMode = (ReadBits(1) == 1);
-
- if (ReadBits(1) == 0)
- memset(m_LastLevels, 0, kMaxTableSize);
- int numLevels;
- if (m_AudioMode)
- {
- m_NumChannels = ReadBits(2) + 1;
- if (m_MmFilter.CurrentChannel >= m_NumChannels)
- m_MmFilter.CurrentChannel = 0;
- numLevels = m_NumChannels * kMMTableSize;
- }
- else
- numLevels = kHeapTablesSizesSum;
-
- int i;
- for (i = 0; i < kLevelTableSize; i++)
- levelLevels[i] = (Byte)ReadBits(4);
- RIF(m_LevelDecoder.SetCodeLengths(levelLevels));
- i = 0;
- while (i < numLevels)
- {
- UInt32 number = m_LevelDecoder.DecodeSymbol(&m_InBitStream);
- if (number < kTableDirectLevels)
- {
- newLevels[i] = (Byte)((number + m_LastLevels[i]) & kLevelMask);
- i++;
- }
- else
- {
- if (number == kTableLevelRepNumber)
- {
- int t = ReadBits(2) + 3;
- for (int reps = t; reps > 0 && i < numLevels ; reps--, i++)
- newLevels[i] = newLevels[i - 1];
- }
- else
- {
- int num;
- if (number == kTableLevel0Number)
- num = ReadBits(3) + 3;
- else if (number == kTableLevel0Number2)
- num = ReadBits(7) + 11;
- else
- return false;
- for (;num > 0 && i < numLevels; num--)
- newLevels[i++] = 0;
- }
- }
- }
- if (m_AudioMode)
- for (i = 0; i < m_NumChannels; i++)
- {
- RIF(m_MMDecoders[i].SetCodeLengths(&newLevels[i * kMMTableSize]));
- }
- else
- {
- RIF(m_MainDecoder.SetCodeLengths(&newLevels[0]));
- RIF(m_DistDecoder.SetCodeLengths(&newLevels[kMainTableSize]));
- RIF(m_LenDecoder.SetCodeLengths(&newLevels[kMainTableSize + kDistTableSize]));
- }
- memcpy(m_LastLevels, newLevels, kMaxTableSize);
- return true;
-}
-
-bool CDecoder::ReadLastTables()
-{
- // it differs a little from pure RAR sources;
- // UInt64 ttt = m_InBitStream.GetProcessedSize() + 2;
- // + 2 works for: return 0xFF; in CInBuffer::ReadByte.
- if (m_InBitStream.GetProcessedSize() + 7 <= m_PackSize) // test it: probably incorrect;
- // if (m_InBitStream.GetProcessedSize() + 2 <= m_PackSize) // test it: probably incorrect;
- if (m_AudioMode)
- {
- UInt32 symbol = m_MMDecoders[m_MmFilter.CurrentChannel].DecodeSymbol(&m_InBitStream);
- if (symbol == 256)
- return ReadTables();
- if (symbol >= kMMTableSize)
- return false;
- }
- else
- {
- UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream);
- if (number == kReadTableNumber)
- return ReadTables();
- if (number >= kMainTableSize)
- return false;
- }
- return true;
-}
-
-class CCoderReleaser
-{
- CDecoder *m_Coder;
-public:
- CCoderReleaser(CDecoder *coder): m_Coder(coder) {}
- ~CCoderReleaser()
- {
- m_Coder->ReleaseStreams();
- }
-};
-
-bool CDecoder::DecodeMm(UInt32 pos)
-{
- while (pos-- > 0)
- {
- UInt32 symbol = m_MMDecoders[m_MmFilter.CurrentChannel].DecodeSymbol(&m_InBitStream);
- if (symbol == 256)
- return true;
- if (symbol >= kMMTableSize)
- return false;
- /*
- Byte byPredict = m_Predictor.Predict();
- Byte byReal = (Byte)(byPredict - (Byte)symbol);
- m_Predictor.Update(byReal, byPredict);
- */
- Byte byReal = m_MmFilter.Decode((Byte)symbol);
- m_OutWindowStream.PutByte(byReal);
- if (++m_MmFilter.CurrentChannel == m_NumChannels)
- m_MmFilter.CurrentChannel = 0;
- }
- return true;
-}
-
-bool CDecoder::DecodeLz(Int32 pos)
-{
- while (pos > 0)
- {
- UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream);
- UInt32 length, distance;
- if (number < 256)
- {
- m_OutWindowStream.PutByte(Byte(number));
- pos--;
- continue;
- }
- else if (number >= kMatchNumber)
- {
- number -= kMatchNumber;
- length = kNormalMatchMinLen + UInt32(kLenStart[number]) +
- m_InBitStream.ReadBits(kLenDirectBits[number]);
- number = m_DistDecoder.DecodeSymbol(&m_InBitStream);
- if (number >= kDistTableSize)
- return false;
- distance = kDistStart[number] + m_InBitStream.ReadBits(kDistDirectBits[number]);
- if (distance >= kDistLimit3)
- {
- length += 2 - ((distance - kDistLimit4) >> 31);
- // length++;
- // if (distance >= kDistLimit4)
- // length++;
- }
- }
- else if (number == kRepBothNumber)
- {
- length = m_LastLength;
- distance = m_RepDists[(m_RepDistPtr + 4 - 1) & 3];
- }
- else if (number < kLen2Number)
- {
- distance = m_RepDists[(m_RepDistPtr - (number - kRepNumber + 1)) & 3];
- number = m_LenDecoder.DecodeSymbol(&m_InBitStream);
- if (number >= kLenTableSize)
- return false;
- length = 2 + kLenStart[number] + m_InBitStream.ReadBits(kLenDirectBits[number]);
- if (distance >= kDistLimit2)
- {
- length++;
- if (distance >= kDistLimit3)
- {
- length += 2 - ((distance - kDistLimit4) >> 31);
- // length++;
- // if (distance >= kDistLimit4)
- // length++;
- }
- }
- }
- else if (number < kReadTableNumber)
- {
- number -= kLen2Number;
- distance = kLen2DistStarts[number] +
- m_InBitStream.ReadBits(kLen2DistDirectBits[number]);
- length = 2;
- }
- else if (number == kReadTableNumber)
- return true;
- else
- return false;
- m_RepDists[m_RepDistPtr++ & 3] = distance;
- m_LastLength = length;
- if (!m_OutWindowStream.CopyBlock(distance, length))
- return false;
- pos -= length;
- }
- return true;
-}
-
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- if (inSize == NULL || outSize == NULL)
- return E_INVALIDARG;
-
- if (!m_OutWindowStream.Create(kHistorySize))
- return E_OUTOFMEMORY;
- if (!m_InBitStream.Create(1 << 20))
- return E_OUTOFMEMORY;
-
- m_PackSize = *inSize;
-
- UInt64 pos = 0, unPackSize = *outSize;
-
- m_OutWindowStream.SetStream(outStream);
- m_OutWindowStream.Init(m_IsSolid);
- m_InBitStream.SetStream(inStream);
- m_InBitStream.Init();
-
- CCoderReleaser coderReleaser(this);
- if (!m_IsSolid)
- {
- InitStructures();
- if (unPackSize == 0)
- {
- if (m_InBitStream.GetProcessedSize() + 2 <= m_PackSize) // test it: probably incorrect;
- if (!ReadTables())
- return S_FALSE;
- return S_OK;
- }
- if (!ReadTables())
- return S_FALSE;
- }
-
- UInt64 startPos = m_OutWindowStream.GetProcessedSize();
- while(pos < unPackSize)
- {
- UInt32 blockSize = 1 << 20;
- if (blockSize > unPackSize - pos)
- blockSize = (UInt32)(unPackSize - pos);
- UInt64 blockStartPos = m_OutWindowStream.GetProcessedSize();
- if (m_AudioMode)
- {
- if (!DecodeMm(blockSize))
- return S_FALSE;
- }
- else
- {
- if (!DecodeLz((Int32)blockSize))
- return S_FALSE;
- }
- UInt64 globalPos = m_OutWindowStream.GetProcessedSize();
- pos = globalPos - blockStartPos;
- if (pos < blockSize)
- if (!ReadTables())
- return S_FALSE;
- pos = globalPos - startPos;
- if (progress != 0)
- {
- UInt64 packSize = m_InBitStream.GetProcessedSize();
- RINOK(progress->SetRatioInfo(&packSize, &pos));
- }
- }
- if (pos > unPackSize)
- return S_FALSE;
-
- if (!ReadLastTables())
- return S_FALSE;
- return m_OutWindowStream.Flush();
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(const CLzOutWindowException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
-{
- if (size < 1)
- return E_INVALIDARG;
- m_IsSolid = (data[0] != 0);
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar2Decoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar2Decoder.h
deleted file mode 100644
index 61a8b4dab..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar2Decoder.h
+++ /dev/null
@@ -1,174 +0,0 @@
-// Rar2Decoder.h
-// According to unRAR license, this code may not be used to develop
-// a program that creates RAR archives
-
-#ifndef __COMPRESS_RAR2_DECODER_H
-#define __COMPRESS_RAR2_DECODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "../Common/InBuffer.h"
-
-#include "BitmDecoder.h"
-#include "HuffmanDecoder.h"
-#include "LzOutWindow.h"
-
-namespace NCompress {
-namespace NRar2 {
-
-const UInt32 kNumRepDists = 4;
-const UInt32 kDistTableSize = 48;
-
-const int kMMTableSize = 256 + 1;
-
-const UInt32 kMainTableSize = 298;
-const UInt32 kLenTableSize = 28;
-
-const UInt32 kDistTableStart = kMainTableSize;
-const UInt32 kLenTableStart = kDistTableStart + kDistTableSize;
-
-const UInt32 kHeapTablesSizesSum = kMainTableSize + kDistTableSize + kLenTableSize;
-
-const UInt32 kLevelTableSize = 19;
-
-const UInt32 kMMTablesSizesSum = kMMTableSize * 4;
-
-const UInt32 kMaxTableSize = kMMTablesSizesSum;
-
-const UInt32 kTableDirectLevels = 16;
-const UInt32 kTableLevelRepNumber = kTableDirectLevels;
-const UInt32 kTableLevel0Number = kTableLevelRepNumber + 1;
-const UInt32 kTableLevel0Number2 = kTableLevel0Number + 1;
-
-const UInt32 kLevelMask = 0xF;
-
-
-const UInt32 kRepBothNumber = 256;
-const UInt32 kRepNumber = kRepBothNumber + 1;
-const UInt32 kLen2Number = kRepNumber + 4;
-
-const UInt32 kLen2NumNumbers = 8;
-const UInt32 kReadTableNumber = kLen2Number + kLen2NumNumbers;
-const UInt32 kMatchNumber = kReadTableNumber + 1;
-
-const Byte kLenStart[kLenTableSize] = {0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224};
-const Byte kLenDirectBits[kLenTableSize] = {0,0,0,0,0,0,0,0,1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5};
-
-const UInt32 kDistStart[kDistTableSize] = {0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576,32768U,49152U,65536,98304,131072,196608,262144,327680,393216,458752,524288,589824,655360,720896,786432,851968,917504,983040};
-const Byte kDistDirectBits[kDistTableSize] = {0,0,0,0,1,1,2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16};
-
-const Byte kLevelDirectBits[kLevelTableSize] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7};
-
-const Byte kLen2DistStarts[kLen2NumNumbers]={0,4,8,16,32,64,128,192};
-const Byte kLen2DistDirectBits[kLen2NumNumbers]={2,2,3, 4, 5, 6, 6, 6};
-
-const UInt32 kDistLimit2 = 0x101 - 1;
-const UInt32 kDistLimit3 = 0x2000 - 1;
-const UInt32 kDistLimit4 = 0x40000 - 1;
-
-const UInt32 kMatchMaxLen = 255 + 2;
-const UInt32 kMatchMaxLenMax = 255 + 5;
-const UInt32 kNormalMatchMinLen = 3;
-
-namespace NMultimedia {
-
-struct CFilter
-{
- int K1,K2,K3,K4,K5;
- int D1,D2,D3,D4;
- int LastDelta;
- UInt32 Dif[11];
- UInt32 ByteCount;
- int LastChar;
-
- Byte Decode(int &channelDelta, Byte delta);
-
- void Init() { memset(this, 0, sizeof(*this)); }
-
-};
-
-const int kNumChanelsMax = 4;
-
-class CFilter2
-{
-public:
- CFilter m_Filters[kNumChanelsMax];
- int m_ChannelDelta;
- int CurrentChannel;
-
- void Init() { memset(this, 0, sizeof(*this)); }
- Byte Decode(Byte delta)
- {
- return m_Filters[CurrentChannel].Decode(m_ChannelDelta, delta);
- }
-
-};
-
-}
-
-typedef NBitm::CDecoder<CInBuffer> CBitDecoder;
-
-const int kNumHuffmanBits = 15;
-
-class CDecoder :
- public ICompressCoder,
- public ICompressSetDecoderProperties2,
- public CMyUnknownImp
-{
- CLzOutWindow m_OutWindowStream;
- CBitDecoder m_InBitStream;
- NHuffman::CDecoder<kNumHuffmanBits, kMainTableSize> m_MainDecoder;
- NHuffman::CDecoder<kNumHuffmanBits, kDistTableSize> m_DistDecoder;
- NHuffman::CDecoder<kNumHuffmanBits, kLenTableSize> m_LenDecoder;
- NHuffman::CDecoder<kNumHuffmanBits, kMMTableSize> m_MMDecoders[NMultimedia::kNumChanelsMax];
- NHuffman::CDecoder<kNumHuffmanBits, kLevelTableSize> m_LevelDecoder;
-
- bool m_AudioMode;
-
- NMultimedia::CFilter2 m_MmFilter;
- int m_NumChannels;
-
- UInt32 m_RepDists[kNumRepDists];
- UInt32 m_RepDistPtr;
-
- UInt32 m_LastLength;
-
- Byte m_LastLevels[kMaxTableSize];
-
- UInt64 m_PackSize;
- bool m_IsSolid;
-
- void InitStructures();
- UInt32 ReadBits(int numBits);
- bool ReadTables();
- bool ReadLastTables();
-
- bool DecodeMm(UInt32 pos);
- bool DecodeLz(Int32 pos);
-
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
-public:
- CDecoder();
-
- MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2)
-
- void ReleaseStreams()
- {
- m_OutWindowStream.ReleaseStream();
- m_InBitStream.ReleaseStream();
- }
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Decoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Decoder.cpp
deleted file mode 100644
index b7345eb07..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Decoder.cpp
+++ /dev/null
@@ -1,834 +0,0 @@
-// Rar3Decoder.cpp
-// According to unRAR license, this code may not be used to develop
-// a program that creates RAR archives
-
-#include "StdAfx.h"
-
-#include "../Common/StreamUtils.h"
-
-#include "Rar3Decoder.h"
-
-namespace NCompress {
-namespace NRar3 {
-
-static const UInt32 kNumAlignReps = 15;
-
-static const UInt32 kSymbolReadTable = 256;
-static const UInt32 kSymbolRep = 259;
-static const UInt32 kSymbolLen2 = kSymbolRep + kNumReps;
-
-static const Byte kLenStart[kLenTableSize] = {0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224};
-static const Byte kLenDirectBits[kLenTableSize] = {0,0,0,0,0,0,0,0,1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5};
-
-static const Byte kDistDirectBits[kDistTableSize] =
- {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,
- 16,16,16,16,16,16,16,16,16,16,16,16,16,16,
- 18,18,18,18,18,18,18,18,18,18,18,18};
-
-static const Byte kLevelDirectBits[kLevelTableSize] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
-
-static const Byte kLen2DistStarts[kNumLen2Symbols]={0,4,8,16,32,64,128,192};
-static const Byte kLen2DistDirectBits[kNumLen2Symbols]={2,2,3, 4, 5, 6, 6, 6};
-
-static const UInt32 kDistLimit3 = 0x2000 - 2;
-static const UInt32 kDistLimit4 = 0x40000 - 2;
-
-static const UInt32 kNormalMatchMinLen = 3;
-
-static const UInt32 kVmDataSizeMax = 1 << 16;
-static const UInt32 kVmCodeSizeMax = 1 << 16;
-
-CDecoder::CDecoder():
- _window(0),
- _winPos(0),
- _wrPtr(0),
- _lzSize(0),
- _writtenFileSize(0),
- _vmData(0),
- _vmCode(0),
- m_IsSolid(false)
-{
-}
-
-CDecoder::~CDecoder()
-{
- InitFilters();
- ::MidFree(_vmData);
- ::MidFree(_window);
-}
-
-HRESULT CDecoder::WriteDataToStream(const Byte *data, UInt32 size)
-{
- return WriteStream(_outStream, data, size);
-}
-
-HRESULT CDecoder::WriteData(const Byte *data, UInt32 size)
-{
- HRESULT res = S_OK;
- if (_writtenFileSize < _unpackSize)
- {
- UInt32 curSize = size;
- UInt64 remain = _unpackSize - _writtenFileSize;
- if (remain < curSize)
- curSize = (UInt32)remain;
- res = WriteDataToStream(data, curSize);
- }
- _writtenFileSize += size;
- return res;
-}
-
-HRESULT CDecoder::WriteArea(UInt32 startPtr, UInt32 endPtr)
-{
- if (startPtr <= endPtr)
- return WriteData(_window + startPtr, endPtr - startPtr);
- RINOK(WriteData(_window + startPtr, kWindowSize - startPtr));
- return WriteData(_window, endPtr);
-}
-
-void CDecoder::ExecuteFilter(int tempFilterIndex, NVm::CBlockRef &outBlockRef)
-{
- CTempFilter *tempFilter = _tempFilters[tempFilterIndex];
- tempFilter->InitR[6] = (UInt32)_writtenFileSize;
- NVm::SetValue32(&tempFilter->GlobalData[0x24], (UInt32)_writtenFileSize);
- NVm::SetValue32(&tempFilter->GlobalData[0x28], (UInt32)(_writtenFileSize >> 32));
- CFilter *filter = _filters[tempFilter->FilterIndex];
- _vm.Execute(filter, tempFilter, outBlockRef, filter->GlobalData);
- delete tempFilter;
- _tempFilters[tempFilterIndex] = 0;
-}
-
-HRESULT CDecoder::WriteBuf()
-{
- UInt32 writtenBorder = _wrPtr;
- UInt32 writeSize = (_winPos - writtenBorder) & kWindowMask;
- for (int i = 0; i < _tempFilters.Size(); i++)
- {
- CTempFilter *filter = _tempFilters[i];
- if (filter == NULL)
- continue;
- if (filter->NextWindow)
- {
- filter->NextWindow = false;
- continue;
- }
- UInt32 blockStart = filter->BlockStart;
- UInt32 blockSize = filter->BlockSize;
- if (((blockStart - writtenBorder) & kWindowMask) < writeSize)
- {
- if (writtenBorder != blockStart)
- {
- RINOK(WriteArea(writtenBorder, blockStart));
- writtenBorder = blockStart;
- writeSize = (_winPos - writtenBorder) & kWindowMask;
- }
- if (blockSize <= writeSize)
- {
- UInt32 blockEnd = (blockStart + blockSize) & kWindowMask;
- if (blockStart < blockEnd || blockEnd == 0)
- _vm.SetMemory(0, _window + blockStart, blockSize);
- else
- {
- UInt32 tailSize = kWindowSize - blockStart;
- _vm.SetMemory(0, _window + blockStart, tailSize);
- _vm.SetMemory(tailSize, _window, blockEnd);
- }
- NVm::CBlockRef outBlockRef;
- ExecuteFilter(i, outBlockRef);
- while (i + 1 < _tempFilters.Size())
- {
- CTempFilter *nextFilter = _tempFilters[i + 1];
- if (nextFilter == NULL || nextFilter->BlockStart != blockStart ||
- nextFilter->BlockSize != outBlockRef.Size || nextFilter->NextWindow)
- break;
- _vm.SetMemory(0, _vm.GetDataPointer(outBlockRef.Offset), outBlockRef.Size);
- ExecuteFilter(++i, outBlockRef);
- }
- WriteDataToStream(_vm.GetDataPointer(outBlockRef.Offset), outBlockRef.Size);
- _writtenFileSize += outBlockRef.Size;
- writtenBorder = blockEnd;
- writeSize = (_winPos - writtenBorder) & kWindowMask;
- }
- else
- {
- for (int j = i; j < _tempFilters.Size(); j++)
- {
- CTempFilter *filter = _tempFilters[j];
- if (filter != NULL && filter->NextWindow)
- filter->NextWindow = false;
- }
- _wrPtr = writtenBorder;
- return S_OK; // check it
- }
- }
- }
-
- _wrPtr = _winPos;
- return WriteArea(writtenBorder, _winPos);
-}
-
-void CDecoder::InitFilters()
-{
- _lastFilter = 0;
- int i;
- for (i = 0; i < _tempFilters.Size(); i++)
- delete _tempFilters[i];
- _tempFilters.Clear();
- for (i = 0; i < _filters.Size(); i++)
- delete _filters[i];
- _filters.Clear();
-}
-
-bool CDecoder::AddVmCode(UInt32 firstByte, UInt32 codeSize)
-{
- CMemBitDecoder inp;
- inp.Init(_vmData, codeSize);
-
- UInt32 filterIndex;
- if (firstByte & 0x80)
- {
- filterIndex = NVm::ReadEncodedUInt32(inp);
- if (filterIndex == 0)
- InitFilters();
- else
- filterIndex--;
- }
- else
- filterIndex = _lastFilter;
- if (filterIndex > (UInt32)_filters.Size())
- return false;
- _lastFilter = filterIndex;
- bool newFilter = (filterIndex == (UInt32)_filters.Size());
-
- CFilter *filter;
- if (newFilter)
- {
- // check if too many filters
- if (filterIndex > 1024)
- return false;
- filter = new CFilter;
- _filters.Add(filter);
- }
- else
- {
- filter = _filters[filterIndex];
- filter->ExecCount++;
- }
-
- int numEmptyItems = 0;
- int i;
- for (i = 0; i < _tempFilters.Size(); i++)
- {
- _tempFilters[i - numEmptyItems] = _tempFilters[i];
- if (_tempFilters[i] == NULL)
- numEmptyItems++;
- if (numEmptyItems > 0)
- _tempFilters[i] = NULL;
- }
- if (numEmptyItems == 0)
- {
- _tempFilters.Add(NULL);
- numEmptyItems = 1;
- }
- CTempFilter *tempFilter = new CTempFilter;
- _tempFilters[_tempFilters.Size() - numEmptyItems] = tempFilter;
- tempFilter->FilterIndex = filterIndex;
- tempFilter->ExecCount = filter->ExecCount;
-
- UInt32 blockStart = NVm::ReadEncodedUInt32(inp);
- if (firstByte & 0x40)
- blockStart += 258;
- tempFilter->BlockStart = (blockStart + _winPos) & kWindowMask;
- if (firstByte & 0x20)
- filter->BlockSize = NVm::ReadEncodedUInt32(inp);
- tempFilter->BlockSize = filter->BlockSize;
- tempFilter->NextWindow = _wrPtr != _winPos && ((_wrPtr - _winPos) & kWindowMask) <= blockStart;
-
- memset(tempFilter->InitR, 0, sizeof(tempFilter->InitR));
- tempFilter->InitR[3] = NVm::kGlobalOffset;
- tempFilter->InitR[4] = tempFilter->BlockSize;
- tempFilter->InitR[5] = tempFilter->ExecCount;
- if (firstByte & 0x10)
- {
- UInt32 initMask = inp.ReadBits(NVm::kNumGpRegs);
- for (int i = 0; i < NVm::kNumGpRegs; i++)
- if (initMask & (1 << i))
- tempFilter->InitR[i] = NVm::ReadEncodedUInt32(inp);
- }
- if (newFilter)
- {
- UInt32 vmCodeSize = NVm::ReadEncodedUInt32(inp);
- if (vmCodeSize >= kVmCodeSizeMax || vmCodeSize == 0)
- return false;
- for (UInt32 i = 0; i < vmCodeSize; i++)
- _vmCode[i] = (Byte)inp.ReadBits(8);
- _vm.PrepareProgram(_vmCode, vmCodeSize, filter);
- }
-
- tempFilter->AllocateEmptyFixedGlobal();
-
- Byte *globalData = &tempFilter->GlobalData[0];
- for (i = 0; i < NVm::kNumGpRegs; i++)
- NVm::SetValue32(&globalData[i * 4], tempFilter->InitR[i]);
- NVm::SetValue32(&globalData[NVm::NGlobalOffset::kBlockSize], tempFilter->BlockSize);
- NVm::SetValue32(&globalData[NVm::NGlobalOffset::kBlockPos], 0); // It was commented. why?
- NVm::SetValue32(&globalData[NVm::NGlobalOffset::kExecCount], tempFilter->ExecCount);
-
- if (firstByte & 8)
- {
- UInt32 dataSize = NVm::ReadEncodedUInt32(inp);
- if (dataSize > NVm::kGlobalSize - NVm::kFixedGlobalSize)
- return false;
- CRecordVector<Byte> &globalData = tempFilter->GlobalData;
- int requredSize = (int)(dataSize + NVm::kFixedGlobalSize);
- if (globalData.Size() < requredSize)
- {
- globalData.Reserve(requredSize);
- for (; globalData.Size() < requredSize; i++)
- globalData.Add(0);
- }
- for (UInt32 i = 0; i < dataSize; i++)
- globalData[NVm::kFixedGlobalSize + i] = (Byte)inp.ReadBits(8);
- }
- return true;
-}
-
-bool CDecoder::ReadVmCodeLZ()
-{
- UInt32 firstByte = m_InBitStream.ReadBits(8);
- UInt32 length = (firstByte & 7) + 1;
- if (length == 7)
- length = m_InBitStream.ReadBits(8) + 7;
- else if (length == 8)
- length = m_InBitStream.ReadBits(16);
- if (length > kVmDataSizeMax)
- return false;
- for (UInt32 i = 0; i < length; i++)
- _vmData[i] = (Byte)m_InBitStream.ReadBits(8);
- return AddVmCode(firstByte, length);
-}
-
-bool CDecoder::ReadVmCodePPM()
-{
- int firstByte = DecodePpmSymbol();
- if (firstByte == -1)
- return false;
- UInt32 length = (firstByte & 7) + 1;
- if (length == 7)
- {
- int b1 = DecodePpmSymbol();
- if (b1 == -1)
- return false;
- length = b1 + 7;
- }
- else if (length == 8)
- {
- int b1 = DecodePpmSymbol();
- if (b1 == -1)
- return false;
- int b2 = DecodePpmSymbol();
- if (b2 == -1)
- return false;
- length = b1 * 256 + b2;
- }
- if (length > kVmDataSizeMax)
- return false;
- for (UInt32 i = 0; i < length; i++)
- {
- int b = DecodePpmSymbol();
- if (b == -1)
- return false;
- _vmData[i] = (Byte)b;
- }
- return AddVmCode(firstByte, length);
-}
-
-#define RIF(x) { if (!(x)) return S_FALSE; }
-
-UInt32 CDecoder::ReadBits(int numBits) { return m_InBitStream.ReadBits(numBits); }
-
-/////////////////////////////////////////////////
-// PPM
-
-HRESULT CDecoder::InitPPM()
-{
- Byte maxOrder = (Byte)ReadBits(7);
-
- bool reset = ((maxOrder & 0x20) != 0);
- int maxMB = 0;
- if (reset)
- maxMB = (Byte)ReadBits(8);
- else
- {
- if (_ppm.SubAllocator.GetSubAllocatorSize()== 0)
- return S_FALSE;
- }
- if (maxOrder & 0x40)
- PpmEscChar = (Byte)ReadBits(8);
- m_InBitStream.InitRangeCoder();
- /*
- if (m_InBitStream.m_BitPos != 0)
- return S_FALSE;
- */
- if (reset)
- {
- maxOrder = (maxOrder & 0x1F) + 1;
- if (maxOrder > 16)
- maxOrder = 16 + (maxOrder - 16) * 3;
- if (maxOrder == 1)
- {
- // SubAlloc.StopSubAllocator();
- _ppm.SubAllocator.StopSubAllocator();
- return S_FALSE;
- }
- // SubAlloc.StartSubAllocator(MaxMB+1);
- // StartModelRare(maxOrder);
-
- if (!_ppm.SubAllocator.StartSubAllocator((maxMB + 1) << 20))
- return E_OUTOFMEMORY;
- _ppm.MaxOrder = 0;
- _ppm.StartModelRare(maxOrder);
-
- }
- // return (minContext != NULL);
-
- return S_OK;
-}
-
-int CDecoder::DecodePpmSymbol() { return _ppm.DecodeSymbol(&m_InBitStream); }
-
-HRESULT CDecoder::DecodePPM(Int32 num, bool &keepDecompressing)
-{
- keepDecompressing = false;
- do
- {
- if (((_wrPtr - _winPos) & kWindowMask) < 260 && _wrPtr != _winPos)
- {
- RINOK(WriteBuf());
- if (_writtenFileSize > _unpackSize)
- {
- keepDecompressing = false;
- return S_OK;
- }
- }
- int c = DecodePpmSymbol();
- if (c == -1)
- {
- // Original code sets PPMError=true here and then it returns S_OK. Why ???
- // return S_OK;
- return S_FALSE;
- }
- if (c == PpmEscChar)
- {
- int nextCh = DecodePpmSymbol();
- if (nextCh == 0)
- return ReadTables(keepDecompressing);
- if (nextCh == 2 || nextCh == -1)
- return S_OK;
- if (nextCh == 3)
- {
- if (!ReadVmCodePPM())
- return S_FALSE;
- continue;
- }
- if (nextCh == 4 || nextCh == 5)
- {
- UInt32 distance = 0;
- UInt32 length = 4;
- if (nextCh == 4)
- {
- for (int i = 0; i < 3; i++)
- {
- int c = DecodePpmSymbol();
- if (c == -1)
- return S_OK;
- distance = (distance << 8) + (Byte)c;
- }
- distance++;
- length += 28;
- }
- int c = DecodePpmSymbol();
- if (c == -1)
- return S_OK;
- length += c;
- if (distance >= _lzSize)
- return S_FALSE;
- CopyBlock(distance, length);
- num -= (Int32)length;
- continue;
- }
- }
- PutByte((Byte)c);
- num--;
- }
- while (num >= 0);
- keepDecompressing = true;
- return S_OK;
-}
-
-/////////////////////////////////////////////////
-// LZ
-
-HRESULT CDecoder::ReadTables(bool &keepDecompressing)
-{
- keepDecompressing = true;
- ReadBits((8 - m_InBitStream.GetBitPosition()) & 7);
- if (ReadBits(1) != 0)
- {
- _lzMode = false;
- return InitPPM();
- }
-
- _lzMode = true;
- PrevAlignBits = 0;
- PrevAlignCount = 0;
-
- Byte levelLevels[kLevelTableSize];
- Byte newLevels[kTablesSizesSum];
-
- if (ReadBits(1) == 0)
- memset(m_LastLevels, 0, kTablesSizesSum);
-
- int i;
- for (i = 0; i < kLevelTableSize; i++)
- {
- UInt32 length = ReadBits(4);
- if (length == 15)
- {
- UInt32 zeroCount = ReadBits(4);
- if (zeroCount != 0)
- {
- zeroCount += 2;
- while (zeroCount-- > 0 && i < kLevelTableSize)
- levelLevels[i++]=0;
- i--;
- continue;
- }
- }
- levelLevels[i] = (Byte)length;
- }
- RIF(m_LevelDecoder.SetCodeLengths(levelLevels));
- i = 0;
- while (i < kTablesSizesSum)
- {
- UInt32 number = m_LevelDecoder.DecodeSymbol(&m_InBitStream);
- if (number < 16)
- {
- newLevels[i] = Byte((number + m_LastLevels[i]) & 15);
- i++;
- }
- else if (number > kLevelTableSize)
- return S_FALSE;
- else
- {
- int num;
- if (((number - 16) & 1) == 0)
- num = ReadBits(3) + 3;
- else
- num = ReadBits(7) + 11;
- if (number < 18)
- {
- if (i == 0)
- return S_FALSE;
- for (; num > 0 && i < kTablesSizesSum; num--, i++)
- newLevels[i] = newLevels[i - 1];
- }
- else
- {
- for (; num > 0 && i < kTablesSizesSum; num--)
- newLevels[i++] = 0;
- }
- }
- }
- TablesRead = true;
-
- // original code has check here:
- /*
- if (InAddr > ReadTop)
- {
- keepDecompressing = false;
- return true;
- }
- */
-
- RIF(m_MainDecoder.SetCodeLengths(&newLevels[0]));
- RIF(m_DistDecoder.SetCodeLengths(&newLevels[kMainTableSize]));
- RIF(m_AlignDecoder.SetCodeLengths(&newLevels[kMainTableSize + kDistTableSize]));
- RIF(m_LenDecoder.SetCodeLengths(&newLevels[kMainTableSize + kDistTableSize + kAlignTableSize]));
-
- memcpy(m_LastLevels, newLevels, kTablesSizesSum);
- return S_OK;
-}
-
-class CCoderReleaser
-{
- CDecoder *m_Coder;
-public:
- CCoderReleaser(CDecoder *coder): m_Coder(coder) {}
- ~CCoderReleaser()
- {
- // m_Coder->m_OutWindowStream.Flush();
- m_Coder->ReleaseStreams();
- }
-};
-
-HRESULT CDecoder::ReadEndOfBlock(bool &keepDecompressing)
-{
- if (ReadBits(1) != 0)
- {
- // old file
- TablesRead = false;
- return ReadTables(keepDecompressing);
- }
- // new file
- keepDecompressing = false;
- TablesRead = (ReadBits(1) == 0);
- return S_OK;
-}
-
-UInt32 kDistStart[kDistTableSize];
-
-class CDistInit
-{
-public:
- CDistInit() { Init(); }
- void Init()
- {
- UInt32 start = 0;
- for (UInt32 i = 0; i < kDistTableSize; i++)
- {
- kDistStart[i] = start;
- start += (1 << kDistDirectBits[i]);
- }
- }
-} g_DistInit;
-
-HRESULT CDecoder::DecodeLZ(bool &keepDecompressing)
-{
- UInt32 rep0 = _reps[0];
- UInt32 rep1 = _reps[1];
- UInt32 rep2 = _reps[2];
- UInt32 rep3 = _reps[3];
- UInt32 length = _lastLength;
- for (;;)
- {
- if (((_wrPtr - _winPos) & kWindowMask) < 260 && _wrPtr != _winPos)
- {
- RINOK(WriteBuf());
- if (_writtenFileSize > _unpackSize)
- {
- keepDecompressing = false;
- return S_OK;
- }
- }
- UInt32 number = m_MainDecoder.DecodeSymbol(&m_InBitStream);
- if (number < 256)
- {
- PutByte(Byte(number));
-
- continue;
- }
- else if (number == kSymbolReadTable)
- {
- RINOK(ReadEndOfBlock(keepDecompressing));
- break;
- }
- else if (number == 257)
- {
- if (!ReadVmCodeLZ())
- return S_FALSE;
- continue;
- }
- else if (number == 258)
- {
- }
- else if (number < kSymbolRep + 4)
- {
- if (number != kSymbolRep)
- {
- UInt32 distance;
- if (number == kSymbolRep + 1)
- distance = rep1;
- else
- {
- if (number == kSymbolRep + 2)
- distance = rep2;
- else
- {
- distance = rep3;
- rep3 = rep2;
- }
- rep2 = rep1;
- }
- rep1 = rep0;
- rep0 = distance;
- }
-
- UInt32 number = m_LenDecoder.DecodeSymbol(&m_InBitStream);
- if (number >= kLenTableSize)
- return S_FALSE;
- length = 2 + kLenStart[number] + m_InBitStream.ReadBits(kLenDirectBits[number]);
- }
- else
- {
- rep3 = rep2;
- rep2 = rep1;
- rep1 = rep0;
- if (number < 271)
- {
- number -= 263;
- rep0 = kLen2DistStarts[number] + m_InBitStream.ReadBits(kLen2DistDirectBits[number]);
- length = 2;
- }
- else if (number < 299)
- {
- number -= 271;
- length = kNormalMatchMinLen + (UInt32)kLenStart[number] + m_InBitStream.ReadBits(kLenDirectBits[number]);
- UInt32 number = m_DistDecoder.DecodeSymbol(&m_InBitStream);
- if (number >= kDistTableSize)
- return S_FALSE;
- rep0 = kDistStart[number];
- int numBits = kDistDirectBits[number];
- if (number >= (kNumAlignBits * 2) + 2)
- {
- if (numBits > kNumAlignBits)
- rep0 += (m_InBitStream.ReadBits(numBits - kNumAlignBits) << kNumAlignBits);
- if (PrevAlignCount > 0)
- {
- PrevAlignCount--;
- rep0 += PrevAlignBits;
- }
- else
- {
- UInt32 number = m_AlignDecoder.DecodeSymbol(&m_InBitStream);
- if (number < (1 << kNumAlignBits))
- {
- rep0 += number;
- PrevAlignBits = number;
- }
- else if (number == (1 << kNumAlignBits))
- {
- PrevAlignCount = kNumAlignReps;
- rep0 += PrevAlignBits;
- }
- else
- return S_FALSE;
- }
- }
- else
- rep0 += m_InBitStream.ReadBits(numBits);
- length += ((kDistLimit4 - rep0) >> 31) + ((kDistLimit3 - rep0) >> 31);
- }
- else
- return S_FALSE;
- }
- if (rep0 >= _lzSize)
- return S_FALSE;
- CopyBlock(rep0, length);
- }
- _reps[0] = rep0;
- _reps[1] = rep1;
- _reps[2] = rep2;
- _reps[3] = rep3;
- _lastLength = length;
-
- return S_OK;
-}
-
-HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress)
-{
- _writtenFileSize = 0;
- if (!m_IsSolid)
- {
- _lzSize = 0;
- _winPos = 0;
- _wrPtr = 0;
- for (int i = 0; i < kNumReps; i++)
- _reps[i] = 0;
- _lastLength = 0;
- memset(m_LastLevels, 0, kTablesSizesSum);
- TablesRead = false;
- PpmEscChar = 2;
- InitFilters();
- }
- if (!m_IsSolid || !TablesRead)
- {
- bool keepDecompressing;
- RINOK(ReadTables(keepDecompressing));
- if (!keepDecompressing)
- return S_OK;
- }
-
- for(;;)
- {
- bool keepDecompressing;
- if (_lzMode)
- {
- RINOK(DecodeLZ(keepDecompressing))
- }
- else
- {
- RINOK(DecodePPM(1 << 18, keepDecompressing))
- }
- UInt64 packSize = m_InBitStream.GetProcessedSize();
- RINOK(progress->SetRatioInfo(&packSize, &_writtenFileSize));
- if (!keepDecompressing)
- break;
- }
- RINOK(WriteBuf());
- if (_writtenFileSize < _unpackSize)
- return S_FALSE;
- // return m_OutWindowStream.Flush();
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try
- {
- if (inSize == NULL || outSize == NULL)
- return E_INVALIDARG;
-
- if (_vmData == 0)
- {
- _vmData = (Byte *)::MidAlloc(kVmDataSizeMax + kVmCodeSizeMax);
- if (_vmData == 0)
- return E_OUTOFMEMORY;
- _vmCode = _vmData + kVmDataSizeMax;
- }
-
- if (_window == 0)
- {
- _window = (Byte *)::MidAlloc(kWindowSize);
- if (_window == 0)
- return E_OUTOFMEMORY;
- }
- if (!m_InBitStream.Create(1 << 20))
- return E_OUTOFMEMORY;
- if (!_vm.Create())
- return E_OUTOFMEMORY;
-
-
- m_InBitStream.SetStream(inStream);
- m_InBitStream.Init();
- _outStream = outStream;
-
- CCoderReleaser coderReleaser(this);
- _unpackSize = *outSize;
- return CodeReal(progress);
- }
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
- // CNewException is possible here. But probably CNewException is caused
- // by error in data stream.
-}
-
-STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
-{
- if (size < 1)
- return E_INVALIDARG;
- m_IsSolid = (data[0] != 0);
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Decoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Decoder.h
deleted file mode 100644
index 73d4c224d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Decoder.h
+++ /dev/null
@@ -1,301 +0,0 @@
-// Rar3Decoder.h
-// According to unRAR license, this code may not be used to develop
-// a program that creates RAR archives
-
-#ifndef __COMPRESS_RAR3_DECODER_H
-#define __COMPRESS_RAR3_DECODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-#include "../Common/InBuffer.h"
-
-#include "BitmDecoder.h"
-#include "HuffmanDecoder.h"
-#include "PpmdDecode.h"
-#include "Rar3Vm.h"
-
-namespace NCompress {
-namespace NRar3 {
-
-const UInt32 kWindowSize = 1 << 22;
-const UInt32 kWindowMask = (kWindowSize - 1);
-
-const UInt32 kNumReps = 4;
-const UInt32 kNumLen2Symbols = 8;
-const UInt32 kLenTableSize = 28;
-const UInt32 kMainTableSize = 256 + 1 + 1 + 1 + kNumReps + kNumLen2Symbols + kLenTableSize;
-const UInt32 kDistTableSize = 60;
-
-const int kNumAlignBits = 4;
-const UInt32 kAlignTableSize = (1 << kNumAlignBits) + 1;
-
-const UInt32 kLevelTableSize = 20;
-
-const UInt32 kTablesSizesSum = kMainTableSize + kDistTableSize + kAlignTableSize + kLenTableSize;
-
-class CBitDecoder
-{
- UInt32 m_Value;
-public:
- UInt32 m_BitPos;
- CInBuffer m_Stream;
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream);}
- void ReleaseStream() { m_Stream.ReleaseStream();}
-
- void Init()
- {
- m_Stream.Init();
- m_BitPos = 0;
- m_Value = 0;
- // m_BitPos = kNumBigValueBits;
- // Normalize();
- }
-
- UInt64 GetProcessedSize() const
- { return m_Stream.GetProcessedSize() - (m_BitPos) / 8; }
- UInt32 GetBitPosition() const { return ((8 - m_BitPos) & 7); }
-
- /*
- void Normalize()
- {
- for (;m_BitPos >= 8; m_BitPos -= 8)
- m_Value = (m_Value << 8) | m_Stream.ReadByte();
- }
- */
-
- UInt32 GetValue(UInt32 numBits)
- {
- // return (m_Value << m_BitPos) >> (kNumBigValueBits - numBits);
- // return ((m_Value >> (8 - m_BitPos)) & kMask) >> (kNumValueBits - numBits);
- if (m_BitPos < numBits)
- {
- m_BitPos += 8;
- m_Value = (m_Value << 8) | m_Stream.ReadByte();
- if (m_BitPos < numBits)
- {
- m_BitPos += 8;
- m_Value = (m_Value << 8) | m_Stream.ReadByte();
- }
- }
- return m_Value >> (m_BitPos - numBits);
- }
-
- void MovePos(UInt32 numBits)
- {
- m_BitPos -= numBits;
- m_Value = m_Value & ((1 << m_BitPos) - 1);
- }
-
- UInt32 ReadBits(UInt32 numBits)
- {
- UInt32 res = GetValue(numBits);
- MovePos(numBits);
- return res;
- }
-};
-
-const int kNumTopBits = 24;
-const UInt32 kTopValue = (1 << kNumTopBits);
-const UInt32 kBot = (1 << 15);
-
-class CRangeDecoder:public NPpmd::CRangeDecoderVirt, public CBitDecoder
-{
-public:
- UInt32 Range;
- UInt32 Low;
- UInt32 Code;
-
- void Normalize()
- {
- while ((Low ^ (Low + Range)) < kTopValue ||
- Range < kBot && ((Range = (0 - Low) & (kBot - 1)), 1))
- {
- Code = (Code << 8) | m_Stream.ReadByte();
- Range <<= 8;
- Low <<= 8;
- }
- }
-
- void InitRangeCoder()
- {
- Code = 0;
- Low = 0;
- Range = 0xFFFFFFFF;
- for(int i = 0; i < 4; i++)
- Code = (Code << 8) | ReadBits(8);
- }
-
- virtual UInt32 GetThreshold(UInt32 total)
- {
- return (Code - Low) / ( Range /= total);
- }
-
- virtual void Decode(UInt32 start, UInt32 size)
- {
- Low += start * Range;
- Range *= size;
- Normalize();
- }
-
- virtual UInt32 DecodeBit(UInt32 size0, UInt32 numTotalBits)
- {
- if (((Code - Low) / (Range >>= numTotalBits)) < size0)
- {
- Decode(0, size0);
- return 0;
- }
- else
- {
- Decode(size0, (1 << numTotalBits) - size0);
- return 1;
- }
- }
-
- // UInt64 GetProcessedSizeRangeCoder() {return Stream.GetProcessedSize(); }
-};
-
-
-struct CFilter: public NVm::CProgram
-{
- CRecordVector<Byte> GlobalData;
- UInt32 BlockStart;
- UInt32 BlockSize;
- UInt32 ExecCount;
- CFilter(): BlockStart(0), BlockSize(0), ExecCount(0) {}
-};
-
-struct CTempFilter: public NVm::CProgramInitState
-{
- UInt32 BlockStart;
- UInt32 BlockSize;
- UInt32 ExecCount;
- bool NextWindow;
-
- UInt32 FilterIndex;
-};
-
-const int kNumHuffmanBits = 15;
-
-class CDecoder:
- public ICompressCoder,
- public ICompressSetDecoderProperties2,
- public CMyUnknownImp
-{
- CRangeDecoder m_InBitStream;
- Byte *_window;
- UInt32 _winPos;
- UInt32 _wrPtr;
- UInt64 _lzSize;
- UInt64 _unpackSize;
- UInt64 _writtenFileSize; // if it's > _unpackSize, then _unpackSize only written
- CMyComPtr<ISequentialOutStream> _outStream;
- NHuffman::CDecoder<kNumHuffmanBits, kMainTableSize> m_MainDecoder;
- NHuffman::CDecoder<kNumHuffmanBits, kDistTableSize> m_DistDecoder;
- NHuffman::CDecoder<kNumHuffmanBits, kAlignTableSize> m_AlignDecoder;
- NHuffman::CDecoder<kNumHuffmanBits, kLenTableSize> m_LenDecoder;
- NHuffman::CDecoder<kNumHuffmanBits, kLevelTableSize> m_LevelDecoder;
-
- UInt32 _reps[kNumReps];
- UInt32 _lastLength;
-
- Byte m_LastLevels[kTablesSizesSum];
-
- Byte *_vmData;
- Byte *_vmCode;
- NVm::CVm _vm;
- CRecordVector<CFilter *> _filters;
- CRecordVector<CTempFilter *> _tempFilters;
- UInt32 _lastFilter;
-
- bool m_IsSolid;
-
- bool _lzMode;
-
- UInt32 PrevAlignBits;
- UInt32 PrevAlignCount;
-
- bool TablesRead;
-
- NPpmd::CDecodeInfo _ppm;
- int PpmEscChar;
-
- HRESULT WriteDataToStream(const Byte *data, UInt32 size);
- HRESULT WriteData(const Byte *data, UInt32 size);
- HRESULT WriteArea(UInt32 startPtr, UInt32 endPtr);
- void ExecuteFilter(int tempFilterIndex, NVm::CBlockRef &outBlockRef);
- HRESULT WriteBuf();
-
- void InitFilters();
- bool AddVmCode(UInt32 firstByte, UInt32 codeSize);
- bool ReadVmCodeLZ();
- bool ReadVmCodePPM();
-
- UInt32 ReadBits(int numBits);
-
- HRESULT InitPPM();
- int DecodePpmSymbol();
- HRESULT DecodePPM(Int32 num, bool &keepDecompressing);
-
- HRESULT ReadTables(bool &keepDecompressing);
- HRESULT ReadEndOfBlock(bool &keepDecompressing);
- HRESULT DecodeLZ(bool &keepDecompressing);
- HRESULT CodeReal(ICompressProgressInfo *progress);
-public:
- CDecoder();
- ~CDecoder();
-
- MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2)
-
- void ReleaseStreams()
- {
- _outStream.Release();
- m_InBitStream.ReleaseStream();
- }
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-
- void CopyBlock(UInt32 distance, UInt32 len)
- {
- _lzSize += len;
- UInt32 pos = (_winPos - distance - 1) & kWindowMask;
- Byte *window = _window;
- UInt32 winPos = _winPos;
- if (kWindowSize - winPos > len && kWindowSize - pos > len)
- {
- const Byte *src = window + pos;
- Byte *dest = window + winPos;
- _winPos += len;
- do
- *dest++ = *src++;
- while(--len != 0);
- return;
- }
- do
- {
- window[winPos] = window[pos];
- winPos = (winPos + 1) & kWindowMask;
- pos = (pos + 1) & kWindowMask;
- }
- while(--len != 0);
- _winPos = winPos;
- }
-
- void PutByte(Byte b)
- {
- _window[_winPos] = b;
- _winPos = (_winPos + 1) & kWindowMask;
- _lzSize++;
- }
-
-
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Vm.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Vm.cpp
deleted file mode 100644
index 759dfbdb0..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Vm.cpp
+++ /dev/null
@@ -1,1091 +0,0 @@
-// Rar3Vm.cpp
-// According to unRAR license, this code may not be used to develop
-// a program that creates RAR archives
-
-/*
-Note:
- Due to performance considerations Rar VM may set Flags C incorrectly
- for some operands (SHL x, 0, ... ).
- Check implementation of concrete VM command
- to see if it sets flags right.
-*/
-
-#include "StdAfx.h"
-
-#include "../../../C/7zCrc.h"
-#include "../../../C/Alloc.h"
-
-#include "Rar3Vm.h"
-
-namespace NCompress {
-namespace NRar3 {
-
-UInt32 CMemBitDecoder::ReadBits(int numBits)
-{
- UInt32 res = 0;
- for (;;)
- {
- Byte b = _bitPos < _bitSize ? _data[_bitPos >> 3] : 0;
- int avail = (int)(8 - (_bitPos & 7));
- if (numBits <= avail)
- {
- _bitPos += numBits;
- return res | (b >> (avail - numBits)) & ((1 << numBits) - 1);
- }
- numBits -= avail;
- res |= (UInt32)(b & ((1 << avail) - 1)) << numBits;
- _bitPos += avail;
- }
-}
-
-UInt32 CMemBitDecoder::ReadBit() { return ReadBits(1); }
-
-namespace NVm {
-
-static const UInt32 kStackRegIndex = kNumRegs - 1;
-
-static const UInt32 FLAG_C = 1;
-static const UInt32 FLAG_Z = 2;
-static const UInt32 FLAG_S = 0x80000000;
-
-static const Byte CF_OP0 = 0;
-static const Byte CF_OP1 = 1;
-static const Byte CF_OP2 = 2;
-static const Byte CF_OPMASK = 3;
-static const Byte CF_BYTEMODE = 4;
-static const Byte CF_JUMP = 8;
-static const Byte CF_PROC = 16;
-static const Byte CF_USEFLAGS = 32;
-static const Byte CF_CHFLAGS = 64;
-
-static Byte kCmdFlags[]=
-{
- /* CMD_MOV */ CF_OP2 | CF_BYTEMODE,
- /* CMD_CMP */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_ADD */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_SUB */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_JZ */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
- /* CMD_JNZ */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
- /* CMD_INC */ CF_OP1 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_DEC */ CF_OP1 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_JMP */ CF_OP1 | CF_JUMP,
- /* CMD_XOR */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_AND */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_OR */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_TEST */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_JS */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
- /* CMD_JNS */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
- /* CMD_JB */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
- /* CMD_JBE */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
- /* CMD_JA */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
- /* CMD_JAE */ CF_OP1 | CF_JUMP | CF_USEFLAGS,
- /* CMD_PUSH */ CF_OP1,
- /* CMD_POP */ CF_OP1,
- /* CMD_CALL */ CF_OP1 | CF_PROC,
- /* CMD_RET */ CF_OP0 | CF_PROC,
- /* CMD_NOT */ CF_OP1 | CF_BYTEMODE,
- /* CMD_SHL */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_SHR */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_SAR */ CF_OP2 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_NEG */ CF_OP1 | CF_BYTEMODE | CF_CHFLAGS,
- /* CMD_PUSHA */ CF_OP0,
- /* CMD_POPA */ CF_OP0,
- /* CMD_PUSHF */ CF_OP0 | CF_USEFLAGS,
- /* CMD_POPF */ CF_OP0 | CF_CHFLAGS,
- /* CMD_MOVZX */ CF_OP2,
- /* CMD_MOVSX */ CF_OP2,
- /* CMD_XCHG */ CF_OP2 | CF_BYTEMODE,
- /* CMD_MUL */ CF_OP2 | CF_BYTEMODE,
- /* CMD_DIV */ CF_OP2 | CF_BYTEMODE,
- /* CMD_ADC */ CF_OP2 | CF_BYTEMODE | CF_USEFLAGS | CF_CHFLAGS ,
- /* CMD_SBB */ CF_OP2 | CF_BYTEMODE | CF_USEFLAGS | CF_CHFLAGS ,
- /* CMD_PRINT */ CF_OP0
-};
-
-CVm::CVm(): Mem(NULL) {}
-
-bool CVm::Create()
-{
- if (Mem == NULL)
- Mem = (Byte *)::MyAlloc(kSpaceSize + 4);
- return (Mem != NULL);
-}
-
-CVm::~CVm()
-{
- ::MyFree(Mem);
-}
-
-// CVm::Execute can change CProgram object: it clears progarm if VM returns error.
-
-bool CVm::Execute(CProgram *prg, const CProgramInitState *initState,
- CBlockRef &outBlockRef, CRecordVector<Byte> &outGlobalData)
-{
- memcpy(R, initState->InitR, sizeof(initState->InitR));
- R[kStackRegIndex] = kSpaceSize;
- R[kNumRegs] = 0;
- Flags = 0;
-
- UInt32 globalSize = MyMin((UInt32)initState->GlobalData.Size(), kGlobalSize);
- if (globalSize != 0)
- memcpy(Mem + kGlobalOffset, &initState->GlobalData[0], globalSize);
- UInt32 staticSize = MyMin((UInt32)prg->StaticData.Size(), kGlobalSize - globalSize);
- if (staticSize != 0)
- memcpy(Mem + kGlobalOffset + globalSize, &prg->StaticData[0], staticSize);
-
- bool res = true;
- #ifdef RARVM_STANDARD_FILTERS
- if (prg->StandardFilterIndex >= 0)
- ExecuteStandardFilter(prg->StandardFilterIndex);
- else
- #endif
- {
- res = ExecuteCode(prg);
- if (!res)
- prg->Commands[0].OpCode = CMD_RET;
- }
- UInt32 newBlockPos = GetFixedGlobalValue32(NGlobalOffset::kBlockPos) & kSpaceMask;
- UInt32 newBlockSize = GetFixedGlobalValue32(NGlobalOffset::kBlockSize) & kSpaceMask;
- if (newBlockPos + newBlockSize >= kSpaceSize)
- newBlockPos = newBlockSize = 0;
- outBlockRef.Offset = newBlockPos;
- outBlockRef.Size = newBlockSize;
-
- outGlobalData.Clear();
- UInt32 dataSize = GetFixedGlobalValue32(NGlobalOffset::kGlobalMemOutSize);
- dataSize = MyMin(dataSize, kGlobalSize - kFixedGlobalSize);
- if (dataSize != 0)
- {
- dataSize += kFixedGlobalSize;
- outGlobalData.Reserve(dataSize);
- for (UInt32 i = 0; i < dataSize; i++)
- outGlobalData.Add(Mem[kGlobalOffset + i]);
- }
- return res;
-}
-
-
-#define SET_IP(IP) \
- if ((IP) >= numCommands) return true; \
- if (--maxOpCount <= 0) return false; \
- cmd = commands + (IP);
-
-#define GET_FLAG_S_B(res) (((res) & 0x80) ? FLAG_S : 0)
-#define SET_IP_OP1 { UInt32 val = GetOperand32(&cmd->Op1); SET_IP(val); }
-#define FLAGS_UPDATE_SZ Flags = res == 0 ? FLAG_Z : res & FLAG_S
-#define FLAGS_UPDATE_SZ_B Flags = (res & 0xFF) == 0 ? FLAG_Z : GET_FLAG_S_B(res)
-
-UInt32 CVm::GetOperand32(const COperand *op) const
-{
- switch(op->Type)
- {
- case OP_TYPE_REG: return R[op->Data];
- case OP_TYPE_REGMEM: return GetValue32(&Mem[(op->Base + R[op->Data]) & kSpaceMask]);
- default: return op->Data;
- }
-}
-
-void CVm::SetOperand32(const COperand *op, UInt32 val)
-{
- switch(op->Type)
- {
- case OP_TYPE_REG: R[op->Data] = val; return;
- case OP_TYPE_REGMEM: SetValue32(&Mem[(op->Base + R[op->Data]) & kSpaceMask], val); return;
- }
-}
-
-Byte CVm::GetOperand8(const COperand *op) const
-{
- switch(op->Type)
- {
- case OP_TYPE_REG: return (Byte)R[op->Data];
- case OP_TYPE_REGMEM: return Mem[(op->Base + R[op->Data]) & kSpaceMask];;
- default: return (Byte)op->Data;
- }
-}
-
-void CVm::SetOperand8(const COperand *op, Byte val)
-{
- switch(op->Type)
- {
- case OP_TYPE_REG: R[op->Data] = (R[op->Data] & 0xFFFFFF00) | val; return;
- case OP_TYPE_REGMEM: Mem[(op->Base + R[op->Data]) & kSpaceMask] = val; return;
- }
-}
-
-UInt32 CVm::GetOperand(bool byteMode, const COperand *op) const
-{
- if (byteMode)
- return GetOperand8(op);
- return GetOperand32(op);
-}
-
-void CVm::SetOperand(bool byteMode, const COperand *op, UInt32 val)
-{
- if (byteMode)
- SetOperand8(op, (Byte)(val & 0xFF));
- else
- SetOperand32(op, val);
-}
-
-bool CVm::ExecuteCode(const CProgram *prg)
-{
- Int32 maxOpCount = 25000000;
- const CCommand *commands = &prg->Commands[0];
- const CCommand *cmd = commands;
- UInt32 numCommands = prg->Commands.Size();
- for (;;)
- {
- switch(cmd->OpCode)
- {
- #ifndef RARVM_NO_VM
-
- case CMD_MOV:
- SetOperand32(&cmd->Op1, GetOperand32(&cmd->Op2));
- break;
- case CMD_MOVB:
- SetOperand8(&cmd->Op1, GetOperand8(&cmd->Op2));
- break;
- case CMD_CMP:
- {
- UInt32 v1 = GetOperand32(&cmd->Op1);
- UInt32 res = v1 - GetOperand32(&cmd->Op2);
- Flags = res == 0 ? FLAG_Z : (res > v1) | (res & FLAG_S);
- }
- break;
- case CMD_CMPB:
- {
- Byte v1 = GetOperand8(&cmd->Op1);
- Byte res = v1 - GetOperand8(&cmd->Op2);
- res &= 0xFF;
- Flags = res == 0 ? FLAG_Z : (res > v1) | GET_FLAG_S_B(res);
- }
- break;
- case CMD_ADD:
- {
- UInt32 v1 = GetOperand32(&cmd->Op1);
- UInt32 res = v1 + GetOperand32(&cmd->Op2);
- SetOperand32(&cmd->Op1, res);
- Flags = (res < v1) | (res == 0 ? FLAG_Z : (res & FLAG_S));
- }
- break;
- case CMD_ADDB:
- {
- Byte v1 = GetOperand8(&cmd->Op1);
- Byte res = v1 + GetOperand8(&cmd->Op2);
- res &= 0xFF;
- SetOperand8(&cmd->Op1, (Byte)res);
- Flags = (res < v1) | (res == 0 ? FLAG_Z : GET_FLAG_S_B(res));
- }
- break;
- case CMD_ADC:
- {
- UInt32 v1 = GetOperand(cmd->ByteMode, &cmd->Op1);
- UInt32 FC = (Flags & FLAG_C);
- UInt32 res = v1 + GetOperand(cmd->ByteMode, &cmd->Op2) + FC;
- if (cmd->ByteMode)
- res &= 0xFF;
- SetOperand(cmd->ByteMode, &cmd->Op1, res);
- Flags = (res < v1 || res == v1 && FC) | (res == 0 ? FLAG_Z : (res & FLAG_S));
- }
- break;
- case CMD_SUB:
- {
- UInt32 v1 = GetOperand32(&cmd->Op1);
- UInt32 res = v1 - GetOperand32(&cmd->Op2);
- SetOperand32(&cmd->Op1, res);
- Flags = res == 0 ? FLAG_Z : (res > v1) | (res & FLAG_S);
- }
- break;
- case CMD_SUBB:
- {
- UInt32 v1 = GetOperand8(&cmd->Op1);
- UInt32 res = v1 - GetOperand8(&cmd->Op2);
- SetOperand8(&cmd->Op1, (Byte)res);
- Flags = res == 0 ? FLAG_Z : (res > v1) | (res & FLAG_S);
- }
- break;
- case CMD_SBB:
- {
- UInt32 v1 = GetOperand(cmd->ByteMode, &cmd->Op1);
- UInt32 FC = (Flags & FLAG_C);
- UInt32 res = v1 - GetOperand(cmd->ByteMode, &cmd->Op2) - FC;
- // Flags = res == 0 ? FLAG_Z : (res > v1 || res == v1 && FC) | (res & FLAG_S);
- if (cmd->ByteMode)
- res &= 0xFF;
- SetOperand(cmd->ByteMode, &cmd->Op1, res);
- Flags = (res > v1 || res == v1 && FC) | (res == 0 ? FLAG_Z : (res & FLAG_S));
- }
- break;
- case CMD_INC:
- {
- UInt32 res = GetOperand32(&cmd->Op1) + 1;
- SetOperand32(&cmd->Op1, res);
- FLAGS_UPDATE_SZ;
- }
- break;
- case CMD_INCB:
- {
- Byte res = GetOperand8(&cmd->Op1) + 1;
- SetOperand8(&cmd->Op1, res);;
- FLAGS_UPDATE_SZ_B;
- }
- break;
- case CMD_DEC:
- {
- UInt32 res = GetOperand32(&cmd->Op1) - 1;
- SetOperand32(&cmd->Op1, res);
- FLAGS_UPDATE_SZ;
- }
- break;
- case CMD_DECB:
- {
- Byte res = GetOperand8(&cmd->Op1) - 1;
- SetOperand8(&cmd->Op1, res);;
- FLAGS_UPDATE_SZ_B;
- }
- break;
- case CMD_XOR:
- {
- UInt32 res = GetOperand32(&cmd->Op1) ^ GetOperand32(&cmd->Op2);
- SetOperand32(&cmd->Op1, res);
- FLAGS_UPDATE_SZ;
- }
- break;
- case CMD_XORB:
- {
- Byte res = GetOperand8(&cmd->Op1) ^ GetOperand8(&cmd->Op2);
- SetOperand8(&cmd->Op1, res);
- FLAGS_UPDATE_SZ_B;
- }
- break;
- case CMD_AND:
- {
- UInt32 res = GetOperand32(&cmd->Op1) & GetOperand32(&cmd->Op2);
- SetOperand32(&cmd->Op1, res);
- FLAGS_UPDATE_SZ;
- }
- break;
- case CMD_ANDB:
- {
- Byte res = GetOperand8(&cmd->Op1) & GetOperand8(&cmd->Op2);
- SetOperand8(&cmd->Op1, res);
- FLAGS_UPDATE_SZ_B;
- }
- break;
- case CMD_OR:
- {
- UInt32 res = GetOperand32(&cmd->Op1) | GetOperand32(&cmd->Op2);
- SetOperand32(&cmd->Op1, res);
- FLAGS_UPDATE_SZ;
- }
- break;
- case CMD_ORB:
- {
- Byte res = GetOperand8(&cmd->Op1) | GetOperand8(&cmd->Op2);
- SetOperand8(&cmd->Op1, res);
- FLAGS_UPDATE_SZ_B;
- }
- break;
- case CMD_TEST:
- {
- UInt32 res = GetOperand32(&cmd->Op1) & GetOperand32(&cmd->Op2);
- FLAGS_UPDATE_SZ;
- }
- break;
- case CMD_TESTB:
- {
- Byte res = GetOperand8(&cmd->Op1) & GetOperand8(&cmd->Op2);
- FLAGS_UPDATE_SZ_B;
- }
- break;
- case CMD_NOT:
- SetOperand(cmd->ByteMode, &cmd->Op1, ~GetOperand(cmd->ByteMode, &cmd->Op1));
- break;
- case CMD_NEG:
- {
- UInt32 res = 0 - GetOperand32(&cmd->Op1);
- SetOperand32(&cmd->Op1, res);
- Flags = res == 0 ? FLAG_Z : FLAG_C | (res & FLAG_S);
- }
- break;
- case CMD_NEGB:
- {
- Byte res = (Byte)(0 - GetOperand8(&cmd->Op1));
- SetOperand8(&cmd->Op1, res);
- Flags = res == 0 ? FLAG_Z : FLAG_C | GET_FLAG_S_B(res);
- }
- break;
-
- case CMD_SHL:
- {
- UInt32 v1 = GetOperand32(&cmd->Op1);
- int v2 = (int)GetOperand32(&cmd->Op2);
- UInt32 res = v1 << v2;
- SetOperand32(&cmd->Op1, res);
- Flags = (res == 0 ? FLAG_Z : (res & FLAG_S)) | ((v1 << (v2 - 1)) & 0x80000000 ? FLAG_C : 0);
- }
- break;
- case CMD_SHLB:
- {
- Byte v1 = GetOperand8(&cmd->Op1);
- int v2 = (int)GetOperand8(&cmd->Op2);
- Byte res = (Byte)(v1 << v2);
- SetOperand8(&cmd->Op1, res);
- Flags = (res == 0 ? FLAG_Z : GET_FLAG_S_B(res)) | ((v1 << (v2 - 1)) & 0x80 ? FLAG_C : 0);
- }
- break;
- case CMD_SHR:
- {
- UInt32 v1 = GetOperand32(&cmd->Op1);
- int v2 = (int)GetOperand32(&cmd->Op2);
- UInt32 res = v1 >> v2;
- SetOperand32(&cmd->Op1, res);
- Flags = (res == 0 ? FLAG_Z : (res & FLAG_S)) | ((v1 >> (v2 - 1)) & FLAG_C);
- }
- break;
- case CMD_SHRB:
- {
- Byte v1 = GetOperand8(&cmd->Op1);
- int v2 = (int)GetOperand8(&cmd->Op2);
- Byte res = (Byte)(v1 >> v2);
- SetOperand8(&cmd->Op1, res);
- Flags = (res == 0 ? FLAG_Z : GET_FLAG_S_B(res)) | ((v1 >> (v2 - 1)) & FLAG_C);
- }
- break;
- case CMD_SAR:
- {
- UInt32 v1 = GetOperand32(&cmd->Op1);
- int v2 = (int)GetOperand32(&cmd->Op2);
- UInt32 res = UInt32(((Int32)v1) >> v2);
- SetOperand32(&cmd->Op1, res);
- Flags= (res == 0 ? FLAG_Z : (res & FLAG_S)) | ((v1 >> (v2 - 1)) & FLAG_C);
- }
- break;
- case CMD_SARB:
- {
- Byte v1 = GetOperand8(&cmd->Op1);
- int v2 = (int)GetOperand8(&cmd->Op2);
- Byte res = (Byte)(((signed char)v1) >> v2);
- SetOperand8(&cmd->Op1, res);
- Flags= (res == 0 ? FLAG_Z : GET_FLAG_S_B(res)) | ((v1 >> (v2 - 1)) & FLAG_C);
- }
- break;
-
- case CMD_JMP:
- SET_IP_OP1;
- continue;
- case CMD_JZ:
- if ((Flags & FLAG_Z) != 0)
- {
- SET_IP_OP1;
- continue;
- }
- break;
- case CMD_JNZ:
- if ((Flags & FLAG_Z) == 0)
- {
- SET_IP_OP1;
- continue;
- }
- break;
- case CMD_JS:
- if ((Flags & FLAG_S) != 0)
- {
- SET_IP_OP1;
- continue;
- }
- break;
- case CMD_JNS:
- if ((Flags & FLAG_S) == 0)
- {
- SET_IP_OP1;
- continue;
- }
- break;
- case CMD_JB:
- if ((Flags & FLAG_C) != 0)
- {
- SET_IP_OP1;
- continue;
- }
- break;
- case CMD_JBE:
- if ((Flags & (FLAG_C | FLAG_Z)) != 0)
- {
- SET_IP_OP1;
- continue;
- }
- break;
- case CMD_JA:
- if ((Flags & (FLAG_C | FLAG_Z)) == 0)
- {
- SET_IP_OP1;
- continue;
- }
- break;
- case CMD_JAE:
- if ((Flags & FLAG_C) == 0)
- {
- SET_IP_OP1;
- continue;
- }
- break;
-
- case CMD_PUSH:
- R[kStackRegIndex] -= 4;
- SetValue32(&Mem[R[kStackRegIndex] & kSpaceMask], GetOperand32(&cmd->Op1));
- break;
- case CMD_POP:
- SetOperand32(&cmd->Op1, GetValue32(&Mem[R[kStackRegIndex] & kSpaceMask]));
- R[kStackRegIndex] += 4;
- break;
- case CMD_CALL:
- R[kStackRegIndex] -= 4;
- SetValue32(&Mem[R[kStackRegIndex] & kSpaceMask], (UInt32)(cmd - commands + 1));
- SET_IP_OP1;
- continue;
-
- case CMD_PUSHA:
- {
- for (UInt32 i = 0, SP = R[kStackRegIndex] - 4; i < kNumRegs; i++, SP -= 4)
- SetValue32(&Mem[SP & kSpaceMask], R[i]);
- R[kStackRegIndex] -= kNumRegs * 4;
- }
- break;
- case CMD_POPA:
- {
- for (UInt32 i = 0, SP = R[kStackRegIndex]; i < kNumRegs; i++, SP += 4)
- R[kStackRegIndex - i] = GetValue32(&Mem[SP & kSpaceMask]);
- }
- break;
- case CMD_PUSHF:
- R[kStackRegIndex] -= 4;
- SetValue32(&Mem[R[kStackRegIndex]&kSpaceMask], Flags);
- break;
- case CMD_POPF:
- Flags = GetValue32(&Mem[R[kStackRegIndex] & kSpaceMask]);
- R[kStackRegIndex] += 4;
- break;
-
- case CMD_MOVZX:
- SetOperand32(&cmd->Op1, GetOperand8(&cmd->Op2));
- break;
- case CMD_MOVSX:
- SetOperand32(&cmd->Op1, (UInt32)(Int32)(signed char)GetOperand8(&cmd->Op2));
- break;
- case CMD_XCHG:
- {
- UInt32 v1 = GetOperand(cmd->ByteMode, &cmd->Op1);
- SetOperand(cmd->ByteMode, &cmd->Op1, GetOperand(cmd->ByteMode, &cmd->Op2));
- SetOperand(cmd->ByteMode, &cmd->Op2, v1);
- }
- break;
- case CMD_MUL:
- {
- UInt32 res = GetOperand32(&cmd->Op1) * GetOperand32(&cmd->Op2);
- SetOperand32(&cmd->Op1, res);
- }
- break;
- case CMD_MULB:
- {
- Byte res = GetOperand8(&cmd->Op1) * GetOperand8(&cmd->Op2);
- SetOperand8(&cmd->Op1, res);
- }
- break;
- case CMD_DIV:
- {
- UInt32 divider = GetOperand(cmd->ByteMode, &cmd->Op2);
- if (divider != 0)
- {
- UInt32 res = GetOperand(cmd->ByteMode, &cmd->Op1) / divider;
- SetOperand(cmd->ByteMode, &cmd->Op1, res);
- }
- }
- break;
-
- #endif
-
- case CMD_RET:
- {
- if (R[kStackRegIndex] >= kSpaceSize)
- return true;
- UInt32 ip = GetValue32(&Mem[R[kStackRegIndex] & kSpaceMask]);
- SET_IP(ip);
- R[kStackRegIndex] += 4;
- continue;
- }
- case CMD_PRINT:
- break;
- }
- cmd++;
- --maxOpCount;
- }
-}
-
-
-//////////////////////////////////////////////////////
-// Read program
-
-UInt32 ReadEncodedUInt32(CMemBitDecoder &inp)
-{
- switch(inp.ReadBits(2))
- {
- case 0:
- return inp.ReadBits(4);
- case 1:
- {
- UInt32 v = inp.ReadBits(4);
- if (v == 0)
- return 0xFFFFFF00 | inp.ReadBits(8);
- else
- return (v << 4) | inp.ReadBits(4);
- }
- case 2:
- return inp.ReadBits(16);
- default:
- return inp.ReadBits(32);
- }
-}
-
-void CVm::DecodeArg(CMemBitDecoder &inp, COperand &op, bool byteMode)
-{
- if (inp.ReadBit())
- {
- op.Type = OP_TYPE_REG;
- op.Data = inp.ReadBits(kNumRegBits);
- }
- else if (inp.ReadBit() == 0)
- {
- op.Type = OP_TYPE_INT;
- if (byteMode)
- op.Data = inp.ReadBits(8);
- else
- op.Data = ReadEncodedUInt32(inp);
- }
- else
- {
- op.Type = OP_TYPE_REGMEM;
- if (inp.ReadBit() == 0)
- {
- op.Data = inp.ReadBits(kNumRegBits);
- op.Base = 0;
- }
- else
- {
- if (inp.ReadBit() == 0)
- op.Data = inp.ReadBits(kNumRegBits);
- else
- op.Data = kNumRegs;
- op.Base = ReadEncodedUInt32(inp);
- }
- }
-}
-
-void CVm::ReadVmProgram(const Byte *code, UInt32 codeSize, CProgram *prg)
-{
- CMemBitDecoder inp;
- inp.Init(code, codeSize);
-
- prg->StaticData.Clear();
- if (inp.ReadBit())
- {
- UInt32 dataSize = ReadEncodedUInt32(inp) + 1;
- for (UInt32 i = 0; inp.Avail() && i < dataSize; i++)
- prg->StaticData.Add((Byte)inp.ReadBits(8));
- }
- while (inp.Avail())
- {
- prg->Commands.Add(CCommand());
- CCommand *cmd = &prg->Commands.Back();
- if (inp.ReadBit() == 0)
- cmd->OpCode = (ECommand)inp.ReadBits(3);
- else
- cmd->OpCode = (ECommand)(8 + inp.ReadBits(5));
- if (kCmdFlags[cmd->OpCode] & CF_BYTEMODE)
- cmd->ByteMode = (inp.ReadBit()) ? true : false;
- else
- cmd->ByteMode = 0;
- int opNum = (kCmdFlags[cmd->OpCode] & CF_OPMASK);
- if (opNum > 0)
- {
- DecodeArg(inp, cmd->Op1, cmd->ByteMode);
- if (opNum == 2)
- DecodeArg(inp, cmd->Op2, cmd->ByteMode);
- else
- {
- if (cmd->Op1.Type == OP_TYPE_INT && (kCmdFlags[cmd->OpCode] & (CF_JUMP | CF_PROC)))
- {
- int Distance = cmd->Op1.Data;
- if (Distance >= 256)
- Distance -= 256;
- else
- {
- if (Distance >= 136)
- Distance -= 264;
- else if (Distance >= 16)
- Distance -= 8;
- else if (Distance >= 8)
- Distance -= 16;
- Distance += prg->Commands.Size() - 1;
- }
- cmd->Op1.Data = Distance;
- }
- }
- }
- if (cmd->ByteMode)
- {
- switch (cmd->OpCode)
- {
- case CMD_MOV: cmd->OpCode = CMD_MOVB; break;
- case CMD_CMP: cmd->OpCode = CMD_CMPB; break;
- case CMD_ADD: cmd->OpCode = CMD_ADDB; break;
- case CMD_SUB: cmd->OpCode = CMD_SUBB; break;
- case CMD_INC: cmd->OpCode = CMD_INCB; break;
- case CMD_DEC: cmd->OpCode = CMD_DECB; break;
- case CMD_XOR: cmd->OpCode = CMD_XORB; break;
- case CMD_AND: cmd->OpCode = CMD_ANDB; break;
- case CMD_OR: cmd->OpCode = CMD_ORB; break;
- case CMD_TEST: cmd->OpCode = CMD_TESTB; break;
- case CMD_NEG: cmd->OpCode = CMD_NEGB; break;
- case CMD_SHL: cmd->OpCode = CMD_SHLB; break;
- case CMD_SHR: cmd->OpCode = CMD_SHRB; break;
- case CMD_SAR: cmd->OpCode = CMD_SARB; break;
- case CMD_MUL: cmd->OpCode = CMD_MULB; break;
- }
- }
- }
-}
-
-#ifdef RARVM_STANDARD_FILTERS
-
-enum EStandardFilter
-{
- SF_E8,
- SF_E8E9,
- SF_ITANIUM,
- SF_RGB,
- SF_AUDIO,
- SF_DELTA,
- SF_UPCASE
-};
-
-struct StandardFilterSignature
-{
- UInt32 Length;
- UInt32 CRC;
- EStandardFilter Type;
-}
-kStdFilters[]=
-{
- 53, 0xad576887, SF_E8,
- 57, 0x3cd7e57e, SF_E8E9,
- 120, 0x3769893f, SF_ITANIUM,
- 29, 0x0e06077d, SF_DELTA,
- 149, 0x1c2c5dc8, SF_RGB,
- 216, 0xbc85e701, SF_AUDIO,
- 40, 0x46b9c560, SF_UPCASE
-};
-
-static int FindStandardFilter(const Byte *code, UInt32 codeSize)
-{
- UInt32 crc = CrcCalc(code, codeSize);
- for (int i = 0; i < sizeof(kStdFilters) / sizeof(kStdFilters[0]); i++)
- {
- StandardFilterSignature &sfs = kStdFilters[i];
- if (sfs.CRC == crc && sfs.Length == codeSize)
- return i;
- }
- return -1;
-}
-
-#endif
-
-void CVm::PrepareProgram(const Byte *code, UInt32 codeSize, CProgram *prg)
-{
- Byte xorSum = 0;
- for (UInt32 i = 1; i < codeSize; i++)
- xorSum ^= code[i];
-
- prg->Commands.Clear();
- #ifdef RARVM_STANDARD_FILTERS
- prg->StandardFilterIndex = -1;
- #endif
-
- if (xorSum == code[0] && codeSize > 0)
- {
- #ifdef RARVM_STANDARD_FILTERS
- prg->StandardFilterIndex = FindStandardFilter(code, codeSize);
- if (prg->StandardFilterIndex >= 0)
- return;
- #endif
- // 1 byte for checksum
- ReadVmProgram(code + 1, codeSize - 1, prg);
- }
- prg->Commands.Add(CCommand());
- CCommand *cmd = &prg->Commands.Back();
- cmd->OpCode = CMD_RET;
-}
-
-void CVm::SetMemory(UInt32 pos, const Byte *data, UInt32 dataSize)
-{
- if (pos < kSpaceSize && data != Mem + pos)
- memmove(Mem + pos, data, MyMin(dataSize, kSpaceSize - pos));
-}
-
-#ifdef RARVM_STANDARD_FILTERS
-
-static void E8E9Decode(Byte *data, UInt32 dataSize, UInt32 fileOffset, bool e9)
-{
- if (dataSize <= 4)
- return;
- dataSize -= 4;
- const UInt32 kFileSize = 0x1000000;
- Byte cmpByte2 = (e9 ? 0xE9 : 0xE8);
- for (UInt32 curPos = 0; curPos < dataSize;)
- {
- Byte curByte = *(data++);
- curPos++;
- if (curByte == 0xE8 || curByte == cmpByte2)
- {
- UInt32 offset = curPos + fileOffset;
- UInt32 addr = (Int32)GetValue32(data);
- if (addr < kFileSize)
- SetValue32(data, addr - offset);
- else if ((Int32)addr < 0 && (Int32)(addr + offset) >= 0)
- SetValue32(data, addr + kFileSize);
- data += 4;
- curPos += 4;
- }
- }
-}
-
-static inline UInt32 ItaniumGetOpType(const Byte *data, int bitPos)
-{
- return (data[(unsigned int)bitPos >> 3] >> (bitPos & 7)) & 0xF;
-}
-
-
-static void ItaniumDecode(Byte *data, UInt32 dataSize, UInt32 fileOffset)
-{
- UInt32 curPos = 0;
- fileOffset >>= 4;
- while (curPos < dataSize - 21)
- {
- int b = (data[0] & 0x1F) - 0x10;
- if (b >= 0)
- {
- static Byte kCmdMasks[16] = {4,4,6,6,0,0,7,7,4,4,0,0,4,4,0,0};
- Byte cmdMask = kCmdMasks[b];
- if (cmdMask != 0)
- for (int i = 0; i < 3; i++)
- if (cmdMask & (1 << i))
- {
- int startPos = i * 41 + 18;
- if (ItaniumGetOpType(data, startPos + 24) == 5)
- {
- const UInt32 kMask = 0xFFFFF;
- Byte *p = data + ((unsigned int)startPos >> 3);
- UInt32 bitField = ((UInt32)p[0]) | ((UInt32)p[1] << 8) | ((UInt32)p[2] << 16);
- int inBit = (startPos & 7);
- UInt32 offset = (bitField >> inBit) & kMask;
- UInt32 andMask = ~(kMask << inBit);
- bitField = ((offset - fileOffset) & kMask) << inBit;
- for (int j = 0; j < 3; j++)
- {
- p[j] &= andMask;
- p[j] |= bitField;
- andMask >>= 8;
- bitField >>= 8;
- }
- }
- }
- }
- data += 16;
- curPos += 16;
- fileOffset++;
- }
-}
-
-static void DeltaDecode(Byte *data, UInt32 dataSize, UInt32 numChannels)
-{
- UInt32 srcPos = 0;
- UInt32 border = dataSize * 2;
- for (UInt32 curChannel = 0; curChannel < numChannels; curChannel++)
- {
- Byte prevByte = 0;
- for (UInt32 destPos = dataSize + curChannel; destPos < border; destPos += numChannels)
- data[destPos] = (prevByte = prevByte - data[srcPos++]);
- }
-}
-
-static void RgbDecode(Byte *srcData, UInt32 dataSize, UInt32 width, UInt32 posR)
-{
- Byte *destData = srcData + dataSize;
- const UInt32 numChannels = 3;
- for (UInt32 curChannel = 0; curChannel < numChannels; curChannel++)
- {
- Byte prevByte = 0;
-
- for (UInt32 i = curChannel; i < dataSize; i+= numChannels)
- {
- unsigned int predicted;
- if (i < width)
- predicted = prevByte;
- else
- {
- unsigned int upperLeftByte = destData[i - width];
- unsigned int upperByte = destData[i - width + 3];
- predicted = prevByte + upperByte - upperLeftByte;
- int pa = abs((int)(predicted - prevByte));
- int pb = abs((int)(predicted - upperByte));
- int pc = abs((int)(predicted - upperLeftByte));
- if (pa <= pb && pa <= pc)
- predicted = prevByte;
- else
- if (pb <= pc)
- predicted = upperByte;
- else
- predicted = upperLeftByte;
- }
- destData[i] = prevByte = (Byte)(predicted - *(srcData++));
- }
- }
- if (dataSize < 3)
- return;
- for (UInt32 i = posR, border = dataSize - 2; i < border; i += 3)
- {
- Byte g = destData[i + 1];
- destData[i] = destData[i] + g;
- destData[i + 2] = destData[i + 2] + g;
- }
-}
-
-static void AudioDecode(Byte *srcData, UInt32 dataSize, UInt32 numChannels)
-{
- Byte *destData = srcData + dataSize;
- for (UInt32 curChannel = 0; curChannel < numChannels; curChannel++)
- {
- UInt32 prevByte = 0, prevDelta = 0, dif[7];
- Int32 D1 = 0, D2 = 0, D3;
- Int32 K1 = 0, K2 = 0, K3 = 0;
- memset(dif, 0, sizeof(dif));
-
- for (UInt32 i = curChannel, byteCount = 0; i < dataSize; i += numChannels, byteCount++)
- {
- D3 = D2;
- D2 = prevDelta - D1;
- D1 = prevDelta;
-
- UInt32 predicted = 8 * prevByte + K1 * D1 + K2 * D2 + K3 * D3;
- predicted = (predicted >> 3) & 0xFF;
-
- UInt32 curByte = *(srcData++);
-
- predicted -= curByte;
- destData[i] = (Byte)predicted;
- prevDelta = (UInt32)(Int32)(signed char)(predicted - prevByte);
- prevByte = predicted;
-
- Int32 D = ((Int32)(signed char)curByte) << 3;
-
- dif[0] += abs(D);
- dif[1] += abs(D - D1);
- dif[2] += abs(D + D1);
- dif[3] += abs(D - D2);
- dif[4] += abs(D + D2);
- dif[5] += abs(D - D3);
- dif[6] += abs(D + D3);
-
- if ((byteCount & 0x1F) == 0)
- {
- UInt32 minDif = dif[0], numMinDif = 0;
- dif[0] = 0;
- for (int j = 1; j < sizeof(dif) / sizeof(dif[0]); j++)
- {
- if (dif[j] < minDif)
- {
- minDif = dif[j];
- numMinDif = j;
- }
- dif[j] = 0;
- }
- switch (numMinDif)
- {
- case 1: if (K1 >= -16) K1--; break;
- case 2: if (K1 < 16) K1++; break;
- case 3: if (K2 >= -16) K2--; break;
- case 4: if (K2 < 16) K2++; break;
- case 5: if (K3 >= -16) K3--; break;
- case 6: if (K3 < 16) K3++; break;
- }
- }
- }
- }
-}
-
-static UInt32 UpCaseDecode(Byte *data, UInt32 dataSize)
-{
- UInt32 srcPos = 0, destPos = dataSize;
- while (srcPos < dataSize)
- {
- Byte curByte = data[srcPos++];
- if (curByte == 2 && (curByte = data[srcPos++]) != 2)
- curByte -= 32;
- data[destPos++] = curByte;
- }
- return destPos - dataSize;
-}
-
-void CVm::ExecuteStandardFilter(int filterIndex)
-{
- UInt32 dataSize = R[4];
- if (dataSize >= kGlobalOffset)
- return;
- EStandardFilter filterType = kStdFilters[filterIndex].Type;
-
- switch (filterType)
- {
- case SF_E8:
- case SF_E8E9:
- E8E9Decode(Mem, dataSize, R[6], (filterType == SF_E8E9));
- break;
- case SF_ITANIUM:
- ItaniumDecode(Mem, dataSize, R[6]);
- break;
- case SF_DELTA:
- if (dataSize >= kGlobalOffset / 2)
- break;
- SetBlockPos(dataSize);
- DeltaDecode(Mem, dataSize, R[0]);
- break;
- case SF_RGB:
- if (dataSize >= kGlobalOffset / 2)
- break;
- {
- UInt32 width = R[0];
- if (width <= 3)
- break;
- SetBlockPos(dataSize);
- RgbDecode(Mem, dataSize, width, R[1]);
- }
- break;
- case SF_AUDIO:
- if (dataSize >= kGlobalOffset / 2)
- break;
- SetBlockPos(dataSize);
- AudioDecode(Mem, dataSize, R[0]);
- break;
- case SF_UPCASE:
- if (dataSize >= kGlobalOffset / 2)
- break;
- UInt32 destSize = UpCaseDecode(Mem, dataSize);
- SetBlockSize(destSize);
- SetBlockPos(dataSize);
- break;
- }
-}
-
-#endif
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Vm.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Vm.h
deleted file mode 100644
index c02534c61..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/Rar3Vm.h
+++ /dev/null
@@ -1,179 +0,0 @@
-// Rar3Vm.h
-// According to unRAR license, this code may not be used to develop
-// a program that creates RAR archives
-
-#ifndef __COMPRESS_RAR3_VM_H
-#define __COMPRESS_RAR3_VM_H
-
-#include "../../../C/CpuArch.h"
-
-#include "Common/MyVector.h"
-#include "Common/Types.h"
-
-#define RARVM_STANDARD_FILTERS
-
-namespace NCompress {
-namespace NRar3 {
-
-class CMemBitDecoder
-{
- const Byte *_data;
- UInt32 _bitSize;
- UInt32 _bitPos;
-public:
- void Init(const Byte *data, UInt32 byteSize)
- {
- _data = data;
- _bitSize = (byteSize << 3);
- _bitPos = 0;
- }
- UInt32 ReadBits(int numBits);
- UInt32 ReadBit();
- bool Avail() const { return (_bitPos < _bitSize); }
-};
-
-namespace NVm {
-
-inline UInt32 GetValue32(const void *addr) { return GetUi32(addr); }
-inline void SetValue32(void *addr, UInt32 value) { SetUi32(addr, value); }
-
-UInt32 ReadEncodedUInt32(CMemBitDecoder &inp);
-
-const int kNumRegBits = 3;
-const UInt32 kNumRegs = 1 << kNumRegBits;
-const UInt32 kNumGpRegs = kNumRegs - 1;
-
-const UInt32 kSpaceSize = 0x40000;
-const UInt32 kSpaceMask = kSpaceSize -1;
-const UInt32 kGlobalOffset = 0x3C000;
-const UInt32 kGlobalSize = 0x2000;
-const UInt32 kFixedGlobalSize = 64;
-
-namespace NGlobalOffset
-{
- const UInt32 kBlockSize = 0x1C;
- const UInt32 kBlockPos = 0x20;
- const UInt32 kExecCount = 0x2C;
- const UInt32 kGlobalMemOutSize = 0x30;
-}
-
-enum ECommand
-{
- CMD_MOV, CMD_CMP, CMD_ADD, CMD_SUB, CMD_JZ, CMD_JNZ, CMD_INC, CMD_DEC,
- CMD_JMP, CMD_XOR, CMD_AND, CMD_OR, CMD_TEST, CMD_JS, CMD_JNS, CMD_JB,
- CMD_JBE, CMD_JA, CMD_JAE, CMD_PUSH, CMD_POP, CMD_CALL, CMD_RET, CMD_NOT,
- CMD_SHL, CMD_SHR, CMD_SAR, CMD_NEG, CMD_PUSHA,CMD_POPA, CMD_PUSHF,CMD_POPF,
- CMD_MOVZX,CMD_MOVSX,CMD_XCHG, CMD_MUL, CMD_DIV, CMD_ADC, CMD_SBB, CMD_PRINT,
-
- CMD_MOVB, CMD_CMPB, CMD_ADDB, CMD_SUBB, CMD_INCB, CMD_DECB,
- CMD_XORB, CMD_ANDB, CMD_ORB, CMD_TESTB,CMD_NEGB,
- CMD_SHLB, CMD_SHRB, CMD_SARB, CMD_MULB
-};
-
-enum EOpType {OP_TYPE_REG, OP_TYPE_INT, OP_TYPE_REGMEM, OP_TYPE_NONE};
-
-// Addr in COperand object can link (point) to CVm object!!!
-
-struct COperand
-{
- EOpType Type;
- UInt32 Data;
- UInt32 Base;
- COperand(): Type(OP_TYPE_NONE), Data(0), Base(0) {}
-};
-
-struct CCommand
-{
- ECommand OpCode;
- bool ByteMode;
- COperand Op1, Op2;
-};
-
-struct CBlockRef
-{
- UInt32 Offset;
- UInt32 Size;
-};
-
-struct CProgram
-{
- CRecordVector<CCommand> Commands;
- #ifdef RARVM_STANDARD_FILTERS
- int StandardFilterIndex;
- #endif
- CRecordVector<Byte> StaticData;
-};
-
-struct CProgramInitState
-{
- UInt32 InitR[kNumGpRegs];
- CRecordVector<Byte> GlobalData;
-
- void AllocateEmptyFixedGlobal()
- {
- GlobalData.Clear();
- GlobalData.Reserve(NVm::kFixedGlobalSize);
- for (UInt32 i = 0; i < NVm::kFixedGlobalSize; i++)
- GlobalData.Add(0);
- }
-};
-
-class CVm
-{
- static UInt32 GetValue(bool byteMode, const void *addr)
- {
- if (byteMode)
- return(*(const Byte *)addr);
- else
- return GetUi32(addr);
- }
-
- static void SetValue(bool byteMode, void *addr, UInt32 value)
- {
- if (byteMode)
- *(Byte *)addr = (Byte)value;
- else
- SetUi32(addr, value);
- }
-
- UInt32 GetFixedGlobalValue32(UInt32 globalOffset) { return GetValue(false, &Mem[kGlobalOffset + globalOffset]); }
-
- void SetBlockSize(UInt32 v) { SetValue(&Mem[kGlobalOffset + NGlobalOffset::kBlockSize], v); }
- void SetBlockPos(UInt32 v) { SetValue(&Mem[kGlobalOffset + NGlobalOffset::kBlockPos], v); }
-public:
- static void SetValue(void *addr, UInt32 value) { SetValue(false, addr, value); }
-private:
- UInt32 GetOperand32(const COperand *op) const;
- void SetOperand32(const COperand *op, UInt32 val);
- Byte GetOperand8(const COperand *op) const;
- void SetOperand8(const COperand *op, Byte val);
- UInt32 GetOperand(bool byteMode, const COperand *op) const;
- void SetOperand(bool byteMode, const COperand *op, UInt32 val);
-
- void DecodeArg(CMemBitDecoder &inp, COperand &op, bool byteMode);
-
- bool ExecuteCode(const CProgram *prg);
-
- #ifdef RARVM_STANDARD_FILTERS
- void ExecuteStandardFilter(int filterIndex);
- #endif
-
- Byte *Mem;
- UInt32 R[kNumRegs + 1]; // R[kNumRegs] = 0 always (speed optimization)
- UInt32 Flags;
- void ReadVmProgram(const Byte *code, UInt32 codeSize, CProgram *prg);
-public:
- CVm();
- ~CVm();
- bool Create();
- void PrepareProgram(const Byte *code, UInt32 codeSize, CProgram *prg);
- void SetMemory(UInt32 pos, const Byte *data, UInt32 dataSize);
- bool Execute(CProgram *prg, const CProgramInitState *initState,
- CBlockRef &outBlockRef, CRecordVector<Byte> &outGlobalData);
- const Byte *GetDataPointer(UInt32 offset) const { return Mem + offset; }
-
-};
-
-#endif
-
-}}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/RarCodecsRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/RarCodecsRegister.cpp
deleted file mode 100644
index e3f6a05c4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/RarCodecsRegister.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// RarCodecsRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-
-#include "Rar1Decoder.h"
-#include "Rar2Decoder.h"
-#include "Rar3Decoder.h"
-
-#define CREATE_CODEC(x) static void *CreateCodec ## x() { return (void *)(ICompressCoder *)(new NCompress::NRar ## x::CDecoder); }
-
-CREATE_CODEC(1)
-CREATE_CODEC(2)
-CREATE_CODEC(3)
-
-#define RAR_CODEC(x, name) { CreateCodec ## x, 0, 0x040300 + x, L"Rar" name, 1, false }
-
-static CCodecInfo g_CodecsInfo[] =
-{
- RAR_CODEC(1, L"1"),
- RAR_CODEC(2, L"2"),
- RAR_CODEC(3, L"3"),
-};
-
-REGISTER_CODECS(Rar)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ShrinkDecoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ShrinkDecoder.cpp
deleted file mode 100644
index 1105220e8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ShrinkDecoder.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-// ShrinkDecoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "../Common/InBuffer.h"
-#include "../Common/OutBuffer.h"
-
-#include "BitlDecoder.h"
-#include "ShrinkDecoder.h"
-
-namespace NCompress {
-namespace NShrink {
-
-static const UInt32 kBufferSize = (1 << 20);
-static const int kNumMinBits = 9;
-
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
-{
- NBitl::CBaseDecoder<CInBuffer> inBuffer;
- COutBuffer outBuffer;
-
- if (!inBuffer.Create(kBufferSize))
- return E_OUTOFMEMORY;
- inBuffer.SetStream(inStream);
- inBuffer.Init();
-
- if (!outBuffer.Create(kBufferSize))
- return E_OUTOFMEMORY;
- outBuffer.SetStream(outStream);
- outBuffer.Init();
-
- UInt64 prevPos = 0;
- int numBits = kNumMinBits;
- UInt32 head = 257;
- bool needPrev = false;
- UInt32 lastSymbol = 0;
-
- unsigned int i;
- for (i = 0; i < kNumItems; i++)
- _parents[i] = 0;
- for (i = 0; i < kNumItems; i++)
- _suffixes[i] = 0;
- for (i = 0; i < 257; i++)
- _isFree[i] = false;
- for (; i < kNumItems; i++)
- _isFree[i] = true;
-
- for (;;)
- {
- UInt32 symbol = inBuffer.ReadBits(numBits);
- if (inBuffer.ExtraBitsWereRead())
- break;
- if (_isFree[symbol])
- return S_FALSE;
- if (symbol == 256)
- {
- UInt32 symbol = inBuffer.ReadBits(numBits);
- if (symbol == 1)
- {
- if (numBits < kNumMaxBits)
- numBits++;
- }
- else if (symbol == 2)
- {
- if (needPrev)
- _isFree[head - 1] = true;
- for (i = 257; i < kNumItems; i++)
- _isParent[i] = false;
- for (i = 257; i < kNumItems; i++)
- if (!_isFree[i])
- _isParent[_parents[i]] = true;
- for (i = 257; i < kNumItems; i++)
- if (!_isParent[i])
- _isFree[i] = true;
- head = 257;
- while (head < kNumItems && !_isFree[head])
- head++;
- if (head < kNumItems)
- {
- needPrev = true;
- _isFree[head] = false;
- _parents[head] = (UInt16)lastSymbol;
- head++;
- }
- }
- else
- return S_FALSE;
- continue;
- }
- UInt32 cur = symbol;
- i = 0;
- int corectionIndex = -1;
- while (cur >= 256)
- {
- if (cur == head - 1)
- corectionIndex = i;
- _stack[i++] = _suffixes[cur];
- cur = _parents[cur];
- }
- _stack[i++] = (Byte)cur;
- if (needPrev)
- {
- _suffixes[head - 1] = (Byte)cur;
- if (corectionIndex >= 0)
- _stack[corectionIndex] = (Byte)cur;
- }
- while (i > 0)
- outBuffer.WriteByte((_stack[--i]));
- while (head < kNumItems && !_isFree[head])
- head++;
- if (head < kNumItems)
- {
- needPrev = true;
- _isFree[head] = false;
- _parents[head] = (UInt16)symbol;
- head++;
- }
- else
- needPrev = false;
- lastSymbol = symbol;
-
- UInt64 nowPos = outBuffer.GetProcessedSize();
- if (progress != NULL && nowPos - prevPos > (1 << 18))
- {
- prevPos = nowPos;
- UInt64 packSize = inBuffer.GetProcessedSize();
- RINOK(progress->SetRatioInfo(&packSize, &nowPos));
- }
- }
- return outBuffer.Flush();
-}
-
-STDMETHODIMP CDecoder ::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(const COutBufferException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ShrinkDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ShrinkDecoder.h
deleted file mode 100644
index 9bbecd41b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ShrinkDecoder.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// ShrinkDecoder.h
-
-#ifndef __COMPRESS_SHRINK_DECODER_H
-#define __COMPRESS_SHRINK_DECODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-namespace NCompress {
-namespace NShrink {
-
-const int kNumMaxBits = 13;
-const UInt32 kNumItems = 1 << kNumMaxBits;
-
-class CDecoder :
- public ICompressCoder,
- public CMyUnknownImp
-{
- UInt16 _parents[kNumItems];
- Byte _suffixes[kNumItems];
- Byte _stack[kNumItems];
- bool _isFree[kNumItems];
- bool _isParent[kNumItems];
-
-public:
- MY_UNKNOWN_IMP
-
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZDecoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZDecoder.cpp
deleted file mode 100644
index e28c64518..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZDecoder.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-// ZDecoder.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Alloc.h"
-
-#include "../Common/InBuffer.h"
-#include "../Common/OutBuffer.h"
-
-#include "ZDecoder.h"
-
-namespace NCompress {
-namespace NZ {
-
-static const UInt32 kBufferSize = (1 << 20);
-static const Byte kNumBitsMask = 0x1F;
-static const Byte kBlockModeMask = 0x80;
-static const int kNumMinBits = 9;
-static const int kNumMaxBits = 16;
-
-void CDecoder::Free()
-{
- MyFree(_parents); _parents = 0;
- MyFree(_suffixes); _suffixes = 0;
- MyFree(_stack); _stack = 0;
-}
-
-CDecoder::~CDecoder() { Free(); }
-
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
-{
- CInBuffer inBuffer;
- COutBuffer outBuffer;
-
- if (!inBuffer.Create(kBufferSize))
- return E_OUTOFMEMORY;
- inBuffer.SetStream(inStream);
- inBuffer.Init();
-
- if (!outBuffer.Create(kBufferSize))
- return E_OUTOFMEMORY;
- outBuffer.SetStream(outStream);
- outBuffer.Init();
-
- int maxbits = _properties & kNumBitsMask;
- if (maxbits < kNumMinBits || maxbits > kNumMaxBits)
- return S_FALSE;
- UInt32 numItems = 1 << maxbits;
- bool blockMode = ((_properties & kBlockModeMask) != 0);
-
- if (maxbits != _numMaxBits || _parents == 0 || _suffixes == 0 || _stack == 0)
- {
- Free();
- _parents = (UInt16 *)MyAlloc(numItems * sizeof(UInt16)); if (_parents == 0) return E_OUTOFMEMORY;
- _suffixes = (Byte *)MyAlloc(numItems * sizeof(Byte)); if (_suffixes == 0) return E_OUTOFMEMORY;
- _stack = (Byte *)MyAlloc(numItems * sizeof(Byte)); if (_stack == 0) return E_OUTOFMEMORY;
- _numMaxBits = maxbits;
- }
-
- UInt64 prevPos = 0;
- int numBits = kNumMinBits;
- UInt32 head = blockMode ? 257 : 256;
-
- bool needPrev = false;
-
- unsigned bitPos = 0;
- unsigned numBufBits = 0;
-
- Byte buf[kNumMaxBits + 4];
-
- _parents[256] = 0; // virus protection
- _suffixes[256] = 0;
-
- for (;;)
- {
- if (numBufBits == bitPos)
- {
- numBufBits = (unsigned)inBuffer.ReadBytes(buf, numBits) * 8;
- bitPos = 0;
- UInt64 nowPos = outBuffer.GetProcessedSize();
- if (progress != NULL && nowPos - prevPos >= (1 << 18))
- {
- prevPos = nowPos;
- UInt64 packSize = inBuffer.GetProcessedSize();
- RINOK(progress->SetRatioInfo(&packSize, &nowPos));
- }
- }
- unsigned bytePos = bitPos >> 3;
- UInt32 symbol = buf[bytePos] | ((UInt32)buf[bytePos + 1] << 8) | ((UInt32)buf[bytePos + 2] << 16);
- symbol >>= (bitPos & 7);
- symbol &= (1 << numBits) - 1;
- bitPos += numBits;
- if (bitPos > numBufBits)
- break;
- if (symbol >= head)
- return S_FALSE;
- if (blockMode && symbol == 256)
- {
- numBufBits = bitPos = 0;
- numBits = kNumMinBits;
- head = 257;
- needPrev = false;
- continue;
- }
- UInt32 cur = symbol;
- int i = 0;
- while (cur >= 256)
- {
- _stack[i++] = _suffixes[cur];
- cur = _parents[cur];
- }
- _stack[i++] = (Byte)cur;
- if (needPrev)
- {
- _suffixes[head - 1] = (Byte)cur;
- if (symbol == head - 1)
- _stack[0] = (Byte)cur;
- }
- do
- outBuffer.WriteByte((_stack[--i]));
- while (i > 0);
- if (head < numItems)
- {
- needPrev = true;
- _parents[head++] = (UInt16)symbol;
- if (head > ((UInt32)1 << numBits))
- {
- if (numBits < maxbits)
- {
- numBufBits = bitPos = 0;
- numBits++;
- }
- }
- }
- else
- needPrev = false;
- }
- return outBuffer.Flush();
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(const COutBufferException &e) { return e.ErrorCode; }
- catch(...) { return S_FALSE; }
-}
-
-STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
-{
- if (size < 1)
- return E_INVALIDARG;
- _properties = data[0];
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZDecoder.h
deleted file mode 100644
index 2bd83a177..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZDecoder.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// ZDecoder.h
-
-#ifndef __COMPRESS_Z_DECODER_H
-#define __COMPRESS_Z_DECODER_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-
-namespace NCompress {
-namespace NZ {
-
-class CDecoder:
- public ICompressCoder,
- public ICompressSetDecoderProperties2,
- public CMyUnknownImp
-{
- UInt16 *_parents;
- Byte *_suffixes;
- Byte *_stack;
- Byte _properties;
- int _numMaxBits;
-
-public:
- CDecoder(): _parents(0), _suffixes(0), _stack(0), _properties(0), _numMaxBits(0) {};
- ~CDecoder();
- void Free();
-
- MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2)
-
- HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZlibDecoder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZlibDecoder.cpp
deleted file mode 100644
index a1bac27b1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZlibDecoder.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-// ZlibDecoder.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/StreamUtils.h"
-
-#include "DeflateDecoder.h"
-#include "ZlibDecoder.h"
-
-namespace NCompress {
-namespace NZlib {
-
-#define DEFLATE_TRY_BEGIN try {
-#define DEFLATE_TRY_END } \
- catch(...) { return S_FALSE; }
-
-#define ADLER_MOD 65521
-#define ADLER_LOOP_MAX 5550
-
-static UInt32 Adler32_Update(UInt32 adler, const Byte *buf, size_t size)
-{
- UInt32 a = adler & 0xFFFF;
- UInt32 b = (adler >> 16) & 0xFFFF;
- while (size > 0)
- {
- unsigned curSize = (size > ADLER_LOOP_MAX) ? ADLER_LOOP_MAX : (unsigned )size;
- unsigned i;
- for (i = 0; i < curSize; i++)
- {
- a += buf[i];
- b += a;
- }
- buf += curSize;
- size -= curSize;
- a %= ADLER_MOD;
- b %= ADLER_MOD;
- }
- return (b << 16) + a;
-}
-
-STDMETHODIMP COutStreamWithAdler::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- HRESULT result = _stream->Write(data, size, &size);
- _adler = Adler32_Update(_adler, (const Byte *)data, size);
- if (processedSize != NULL)
- *processedSize = size;
- return result;
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- DEFLATE_TRY_BEGIN
- if (!AdlerStream)
- {
- AdlerSpec = new COutStreamWithAdler;
- AdlerStream = AdlerSpec;
- }
- if (!DeflateDecoder)
- {
- DeflateDecoderSpec = new NCompress::NDeflate::NDecoder::CCOMCoder;
- DeflateDecoderSpec->ZlibMode = true;
- DeflateDecoder = DeflateDecoderSpec;
- }
-
- Byte buf[2];
- RINOK(ReadStream_FALSE(inStream, buf, 2));
- int method = buf[0] & 0xF;
- if (method != 8)
- return S_FALSE;
- // int dicSize = buf[0] >> 4;
- if ((((UInt32)buf[0] << 8) + buf[1]) % 31 != 0)
- return S_FALSE;
- if ((buf[1] & 0x20) != 0) // dictPresent
- return S_FALSE;
- // int level = (buf[1] >> 6);
-
- AdlerSpec->SetStream(outStream);
- AdlerSpec->Init();
- HRESULT res = DeflateDecoder->Code(inStream, AdlerStream, inSize, outSize, progress);
- AdlerSpec->ReleaseStream();
-
- if (res == S_OK)
- {
- const Byte *p = DeflateDecoderSpec->ZlibFooter;
- UInt32 adler = ((UInt32)p[0] << 24) | ((UInt32)p[1] << 16) | ((UInt32)p[2] << 8) | p[3];
- if (adler != AdlerSpec->GetAdler())
- return S_FALSE;
- }
- return res;
- DEFLATE_TRY_END
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZlibDecoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZlibDecoder.h
deleted file mode 100644
index 906e241b9..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Compress/ZlibDecoder.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// ZlibDecoder.h
-
-#ifndef __ZLIB_DECODER_H
-#define __ZLIB_DECODER_H
-
-#include "DeflateDecoder.h"
-
-namespace NCompress {
-namespace NZlib {
-
-const UInt32 ADLER_INIT_VAL = 1;
-
-class COutStreamWithAdler:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialOutStream> _stream;
- UInt32 _adler;
-public:
- MY_UNKNOWN_IMP
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- void SetStream(ISequentialOutStream *stream) { _stream = stream; }
- void ReleaseStream() { _stream.Release(); }
- void Init() { _adler = ADLER_INIT_VAL; }
- UInt32 GetAdler() const { return _adler; }
-};
-
-class CDecoder:
- public ICompressCoder,
- public CMyUnknownImp
-{
- COutStreamWithAdler *AdlerSpec;
- CMyComPtr<ISequentialOutStream> AdlerStream;
-
- NCompress::NDeflate::NDecoder::CCOMCoder *DeflateDecoderSpec;
- CMyComPtr<ICompressCoder> DeflateDecoder;
-public:
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
-
- MY_UNKNOWN_IMP
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/7zAes.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/7zAes.cpp
deleted file mode 100644
index 88149eb10..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/7zAes.cpp
+++ /dev/null
@@ -1,244 +0,0 @@
-// 7zAes.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/Sha256.h"
-
-#include "Windows/Synchronization.h"
-
-#include "../Common/StreamObjects.h"
-#include "../Common/StreamUtils.h"
-
-#include "7zAes.h"
-#include "MyAes.h"
-
-#ifndef EXTRACT_ONLY
-#include "RandGen.h"
-#endif
-
-using namespace NWindows;
-
-namespace NCrypto {
-namespace NSevenZ {
-
-bool CKeyInfo::IsEqualTo(const CKeyInfo &a) const
-{
- if (SaltSize != a.SaltSize || NumCyclesPower != a.NumCyclesPower)
- return false;
- for (UInt32 i = 0; i < SaltSize; i++)
- if (Salt[i] != a.Salt[i])
- return false;
- return (Password == a.Password);
-}
-
-void CKeyInfo::CalculateDigest()
-{
- if (NumCyclesPower == 0x3F)
- {
- UInt32 pos;
- for (pos = 0; pos < SaltSize; pos++)
- Key[pos] = Salt[pos];
- for (UInt32 i = 0; i < Password.GetCapacity() && pos < static_cast< UInt32 >( kKeySize ); i++)
- Key[pos++] = Password[i];
- for (; pos < static_cast< UInt32 >( kKeySize ); pos++)
- Key[pos] = 0;
- }
- else
- {
- CSha256 sha;
- Sha256_Init(&sha);
- const UInt64 numRounds = UInt64(1) << (NumCyclesPower);
- Byte temp[8] = { 0,0,0,0,0,0,0,0 };
- for (UInt64 round = 0; round < numRounds; round++)
- {
- Sha256_Update(&sha, Salt, (size_t)SaltSize);
- Sha256_Update(&sha, Password, Password.GetCapacity());
- Sha256_Update(&sha, temp, 8);
- for (int i = 0; i < 8; i++)
- if (++(temp[i]) != 0)
- break;
- }
- Sha256_Final(&sha, Key);
- }
-}
-
-bool CKeyInfoCache::Find(CKeyInfo &key)
-{
- for (int i = 0; i < Keys.Size(); i++)
- {
- const CKeyInfo &cached = Keys[i];
- if (key.IsEqualTo(cached))
- {
- for (int j = 0; j < kKeySize; j++)
- key.Key[j] = cached.Key[j];
- if (i != 0)
- {
- Keys.Insert(0, cached);
- Keys.Delete(i+1);
- }
- return true;
- }
- }
- return false;
-}
-
-void CKeyInfoCache::Add(CKeyInfo &key)
-{
- if (Find(key))
- return;
- if (Keys.Size() >= Size)
- Keys.DeleteBack();
- Keys.Insert(0, key);
-}
-
-static CKeyInfoCache g_GlobalKeyCache(32);
-static NSynchronization::CCriticalSection g_GlobalKeyCacheCriticalSection;
-
-CBase::CBase():
- _cachedKeys(16),
- _ivSize(0)
-{
- for (size_t i = 0; i < sizeof(_iv); i++)
- _iv[i] = 0;
-}
-
-void CBase::CalculateDigest()
-{
- NSynchronization::CCriticalSectionLock lock(g_GlobalKeyCacheCriticalSection);
- if (_cachedKeys.Find(_key))
- g_GlobalKeyCache.Add(_key);
- else
- {
- if (!g_GlobalKeyCache.Find(_key))
- {
- _key.CalculateDigest();
- g_GlobalKeyCache.Add(_key);
- }
- _cachedKeys.Add(_key);
- }
-}
-
-#ifndef EXTRACT_ONLY
-
-/*
-STDMETHODIMP CEncoder::ResetSalt()
-{
- _key.SaltSize = 4;
- g_RandomGenerator.Generate(_key.Salt, _key.SaltSize);
- return S_OK;
-}
-*/
-
-STDMETHODIMP CEncoder::ResetInitVector()
-{
- _ivSize = 8;
- g_RandomGenerator.Generate(_iv, (unsigned)_ivSize);
- return S_OK;
-}
-
-STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
-{
- // _key.Init();
- for (UInt32 i = _ivSize; i < sizeof(_iv); i++)
- _iv[i] = 0;
-
- UInt32 ivSize = _ivSize;
-
- // _key.NumCyclesPower = 0x3F;
- _key.NumCyclesPower = 19;
-
- Byte firstByte = (Byte)(_key.NumCyclesPower |
- (((_key.SaltSize == 0) ? 0 : 1) << 7) |
- (((ivSize == 0) ? 0 : 1) << 6));
- RINOK(outStream->Write(&firstByte, 1, NULL));
- if (_key.SaltSize == 0 && ivSize == 0)
- return S_OK;
- Byte saltSizeSpec = (Byte)((_key.SaltSize == 0) ? 0 : (_key.SaltSize - 1));
- Byte ivSizeSpec = (Byte)((ivSize == 0) ? 0 : (ivSize - 1));
- Byte secondByte = (Byte)(((saltSizeSpec) << 4) | ivSizeSpec);
- RINOK(outStream->Write(&secondByte, 1, NULL));
- if (_key.SaltSize > 0)
- {
- RINOK(WriteStream(outStream, _key.Salt, _key.SaltSize));
- }
- if (ivSize > 0)
- {
- RINOK(WriteStream(outStream, _iv, ivSize));
- }
- return S_OK;
-}
-
-HRESULT CEncoder::CreateFilter()
-{
- _aesFilter = new CAesCbcEncoder;
- return S_OK;
-}
-
-#endif
-
-STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
-{
- _key.Init();
- UInt32 i;
- for (i = 0; i < sizeof(_iv); i++)
- _iv[i] = 0;
- if (size == 0)
- return S_OK;
- UInt32 pos = 0;
- Byte firstByte = data[pos++];
-
- _key.NumCyclesPower = firstByte & 0x3F;
- if ((firstByte & 0xC0) == 0)
- return S_OK;
- _key.SaltSize = (firstByte >> 7) & 1;
- UInt32 ivSize = (firstByte >> 6) & 1;
-
- if (pos >= size)
- return E_INVALIDARG;
- Byte secondByte = data[pos++];
-
- _key.SaltSize += (secondByte >> 4);
- ivSize += (secondByte & 0x0F);
-
- if (pos + _key.SaltSize + ivSize > size)
- return E_INVALIDARG;
- for (i = 0; i < _key.SaltSize; i++)
- _key.Salt[i] = data[pos++];
- for (i = 0; i < ivSize; i++)
- _iv[i] = data[pos++];
- return S_OK;
-}
-
-STDMETHODIMP CBaseCoder::CryptoSetPassword(const Byte *data, UInt32 size)
-{
- _key.Password.SetCapacity((size_t)size);
- memcpy(_key.Password, data, (size_t)size);
- return S_OK;
-}
-
-STDMETHODIMP CBaseCoder::Init()
-{
- CalculateDigest();
- if (_aesFilter == 0)
- {
- RINOK(CreateFilter());
- }
- CMyComPtr<ICryptoProperties> cp;
- RINOK(_aesFilter.QueryInterface(IID_ICryptoProperties, &cp));
- RINOK(cp->SetKey(_key.Key, sizeof(_key.Key)));
- RINOK(cp->SetInitVector(_iv, sizeof(_iv)));
- return S_OK;
-}
-
-STDMETHODIMP_(UInt32) CBaseCoder::Filter(Byte *data, UInt32 size)
-{
- return _aesFilter->Filter(data, size);
-}
-
-HRESULT CDecoder::CreateFilter()
-{
- _aesFilter = new CAesCbcDecoder;
- return S_OK;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/7zAes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/7zAes.h
deleted file mode 100644
index ea9c585e8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/7zAes.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// 7zAes.h
-
-#ifndef __CRYPTO_7Z_AES_H
-#define __CRYPTO_7Z_AES_H
-
-#include "Common/Buffer.h"
-#include "Common/MyCom.h"
-#include "Common/MyVector.h"
-
-#include "../ICoder.h"
-#include "../IPassword.h"
-
-namespace NCrypto {
-namespace NSevenZ {
-
-const int kKeySize = 32;
-
-class CKeyInfo
-{
-public:
- int NumCyclesPower;
- UInt32 SaltSize;
- Byte Salt[16];
- CByteBuffer Password;
- Byte Key[kKeySize];
-
- bool IsEqualTo(const CKeyInfo &a) const;
- void CalculateDigest();
-
- CKeyInfo() { Init(); }
- void Init()
- {
- NumCyclesPower = 0;
- SaltSize = 0;
- for (unsigned int i = 0; i < sizeof(Salt); i++)
- Salt[i] = 0;
- }
-};
-
-class CKeyInfoCache
-{
- int Size;
- CObjectVector<CKeyInfo> Keys;
-public:
- CKeyInfoCache(int size): Size(size) {}
- bool Find(CKeyInfo &key);
- // HRESULT Calculate(CKeyInfo &key);
- void Add(CKeyInfo &key);
-};
-
-class CBase
-{
- CKeyInfoCache _cachedKeys;
-protected:
- CKeyInfo _key;
- Byte _iv[16];
- UInt32 _ivSize;
- void CalculateDigest();
- CBase();
-};
-
-class CBaseCoder:
- public ICompressFilter,
- public ICryptoSetPassword,
- public CMyUnknownImp,
- public CBase
-{
-protected:
- CMyComPtr<ICompressFilter> _aesFilter;
-
- virtual HRESULT CreateFilter() = 0;
- #ifndef CRYPTO_AES
- HRESULT CreateFilterFromDLL(REFCLSID clsID);
- #endif
-public:
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
-
- STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
-};
-
-#ifndef EXTRACT_ONLY
-
-class CEncoder:
- public CBaseCoder,
- public ICompressWriteCoderProperties,
- // public ICryptoResetSalt,
- public ICryptoResetInitVector
-{
- virtual HRESULT CreateFilter();
-public:
- MY_UNKNOWN_IMP3(
- ICryptoSetPassword,
- ICompressWriteCoderProperties,
- // ICryptoResetSalt,
- ICryptoResetInitVector)
- STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
- // STDMETHOD(ResetSalt)();
- STDMETHOD(ResetInitVector)();
-};
-#endif
-
-class CDecoder:
- public CBaseCoder,
- public ICompressSetDecoderProperties2
-{
- virtual HRESULT CreateFilter();
-public:
- MY_UNKNOWN_IMP2(
- ICryptoSetPassword,
- ICompressSetDecoderProperties2)
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/7zAesRegister.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/7zAesRegister.cpp
deleted file mode 100644
index 5e57748f5..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/7zAesRegister.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// 7zAesRegister.cpp
-
-#include "StdAfx.h"
-
-#include "../Common/RegisterCodec.h"
-#include "7zAes.h"
-
-static void *CreateCodec() { return (void *)(ICompressFilter *)(new NCrypto::NSevenZ::CDecoder()); }
-#ifndef EXTRACT_ONLY
-static void *CreateCodecOut() { return (void *)(ICompressFilter *)(new NCrypto::NSevenZ::CEncoder()); }
-#else
-#define CreateCodecOut 0
-#endif
-
-static CCodecInfo g_CodecInfo =
- { CreateCodec, CreateCodecOut, 0x06F10701, L"7zAES", 1, true };
-
-REGISTER_CODEC(7zAES)
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/HmacSha1.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/HmacSha1.cpp
deleted file mode 100644
index 13a7ff81d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/HmacSha1.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// HmacSha1.cpp
-
-#include "StdAfx.h"
-
-#include "HmacSha1.h"
-
-namespace NCrypto {
-namespace NSha1 {
-
-void CHmac::SetKey(const Byte *key, size_t keySize)
-{
- Byte keyTemp[kBlockSize];
- size_t i;
- for (i = 0; i < kBlockSize; i++)
- keyTemp[i] = 0;
- if(keySize > kBlockSize)
- {
- _sha.Init();
- _sha.Update(key, keySize);
- _sha.Final(keyTemp);
- keySize = kDigestSize;
- }
- else
- for (i = 0; i < keySize; i++)
- keyTemp[i] = key[i];
- for (i = 0; i < kBlockSize; i++)
- keyTemp[i] ^= 0x36;
- _sha.Init();
- _sha.Update(keyTemp, kBlockSize);
- for (i = 0; i < kBlockSize; i++)
- keyTemp[i] ^= 0x36 ^ 0x5C;
- _sha2.Init();
- _sha2.Update(keyTemp, kBlockSize);
-}
-
-void CHmac::Final(Byte *mac, size_t macSize)
-{
- Byte digest[kDigestSize];
- _sha.Final(digest);
- _sha2.Update(digest, kDigestSize);
- _sha2.Final(digest);
- for(size_t i = 0; i < macSize; i++)
- mac[i] = digest[i];
-}
-
-
-void CHmac32::SetKey(const Byte *key, size_t keySize)
-{
- UInt32 keyTemp[kBlockSizeInWords];
- size_t i;
- for (i = 0; i < kBlockSizeInWords; i++)
- keyTemp[i] = 0;
- if(keySize > kBlockSize)
- {
- CContext sha;
- sha.Init();
- sha.Update(key, keySize);
- Byte digest[kDigestSize];
- sha.Final(digest);
-
- for (unsigned int i = 0 ; i < kDigestSizeInWords; i++)
- keyTemp[i] =
- ((UInt32)(digest[i * 4 + 0]) << 24) |
- ((UInt32)(digest[i * 4 + 1]) << 16) |
- ((UInt32)(digest[i * 4 + 2]) << 8) |
- ((UInt32)(digest[i * 4 + 3]));
- keySize = kDigestSizeInWords;
- }
- else
- for (size_t i = 0; i < keySize; i++)
- keyTemp[i / 4] |= (key[i] << (24 - 8 * (i & 3)));
- for (i = 0; i < kBlockSizeInWords; i++)
- keyTemp[i] ^= 0x36363636;
- _sha.Init();
- _sha.Update(keyTemp, kBlockSizeInWords);
- for (i = 0; i < kBlockSizeInWords; i++)
- keyTemp[i] ^= 0x36363636 ^ 0x5C5C5C5C;
- _sha2.Init();
- _sha2.Update(keyTemp, kBlockSizeInWords);
-}
-
-void CHmac32::Final(UInt32 *mac, size_t macSize)
-{
- UInt32 digest[kDigestSizeInWords];
- _sha.Final(digest);
- _sha2.Update(digest, kDigestSizeInWords);
- _sha2.Final(digest);
- for(size_t i = 0; i < macSize; i++)
- mac[i] = digest[i];
-}
-
-void CHmac32::GetLoopXorDigest(UInt32 *mac, UInt32 numIteration)
-{
- UInt32 block[kBlockSizeInWords];
- UInt32 block2[kBlockSizeInWords];
- _sha.PrepareBlock(block, kDigestSizeInWords);
- _sha2.PrepareBlock(block2, kDigestSizeInWords);
- for(unsigned int s = 0; s < kDigestSizeInWords; s++)
- block[s] = mac[s];
- for(UInt32 i = 0; i < numIteration; i++)
- {
- _sha.GetBlockDigest(block, block2);
- _sha2.GetBlockDigest(block2, block);
- for (unsigned int s = 0; s < kDigestSizeInWords; s++)
- mac[s] ^= block[s];
- }
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/HmacSha1.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/HmacSha1.h
deleted file mode 100644
index d7181329c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/HmacSha1.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// HmacSha1.h
-// Implements HMAC-SHA-1 (RFC2104, FIPS-198)
-
-#ifndef __CRYPTO_HMAC_SHA1_H
-#define __CRYPTO_HMAC_SHA1_H
-
-#include "Sha1.h"
-
-namespace NCrypto {
-namespace NSha1 {
-
-// Use: SetKey(key, keySize); for () Update(data, size); Final(mac, macSize);
-
-class CHmac
-{
- CContext _sha;
- CContext _sha2;
-public:
- void SetKey(const Byte *key, size_t keySize);
- void Update(const Byte *data, size_t dataSize) { _sha.Update(data, dataSize); }
- void Final(Byte *mac, size_t macSize = kDigestSize);
-};
-
-class CHmac32
-{
- CContext32 _sha;
- CContext32 _sha2;
-public:
- void SetKey(const Byte *key, size_t keySize);
- void Update(const UInt32 *data, size_t dataSize) { _sha.Update(data, dataSize); }
- void Final(UInt32 *mac, size_t macSize = kDigestSizeInWords);
-
- // It'sa for hmac function. in,out: mac[kDigestSizeInWords].
- void GetLoopXorDigest(UInt32 *mac, UInt32 numIteration);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/MyAes.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/MyAes.cpp
deleted file mode 100644
index 5b0d1e8a4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/MyAes.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// Crypto/MyAes.cpp
-
-#include "StdAfx.h"
-
-#include "MyAes.h"
-
-namespace NCrypto {
-
-struct CAesTabInit { CAesTabInit() { AesGenTables();} } g_AesTabInit;
-
-STDMETHODIMP CAesCbcEncoder::Init() { return S_OK; }
-
-STDMETHODIMP_(UInt32) CAesCbcEncoder::Filter(Byte *data, UInt32 size)
-{
- return (UInt32)AesCbc_Encode(&Aes, data, size);
-}
-
-STDMETHODIMP CAesCbcEncoder::SetKey(const Byte *data, UInt32 size)
-{
- if ((size & 0x7) != 0 || size < 16 || size > 32)
- return E_INVALIDARG;
- Aes_SetKeyEncode(&Aes.aes, data, size);
- return S_OK;
-}
-
-STDMETHODIMP CAesCbcEncoder::SetInitVector(const Byte *data, UInt32 size)
-{
- if (size != AES_BLOCK_SIZE)
- return E_INVALIDARG;
- AesCbc_Init(&Aes, data);
- return S_OK;
-}
-
-STDMETHODIMP CAesCbcDecoder::Init() { return S_OK; }
-
-STDMETHODIMP_(UInt32) CAesCbcDecoder::Filter(Byte *data, UInt32 size)
-{
- return (UInt32)AesCbc_Decode(&Aes, data, size);
-}
-
-STDMETHODIMP CAesCbcDecoder::SetKey(const Byte *data, UInt32 size)
-{
- if ((size & 0x7) != 0 || size < 16 || size > 32)
- return E_INVALIDARG;
- Aes_SetKeyDecode(&Aes.aes, data, size);
- return S_OK;
-}
-
-STDMETHODIMP CAesCbcDecoder::SetInitVector(const Byte *data, UInt32 size)
-{
- if (size != AES_BLOCK_SIZE)
- return E_INVALIDARG;
- AesCbc_Init(&Aes, data);
- return S_OK;
-}
-
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/MyAes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/MyAes.h
deleted file mode 100644
index 24e90d6f1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/MyAes.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Crypto/MyAes.h
-
-#ifndef __CRYPTO_MY_AES_H
-#define __CRYPTO_MY_AES_H
-
-#include "../../../C/Aes.h"
-
-#include "../../Common/MyCom.h"
-#include "../../Common/Types.h"
-
-#include "../ICoder.h"
-
-namespace NCrypto {
-
-class CAesCbcEncoder:
- public ICompressFilter,
- public ICryptoProperties,
- public CMyUnknownImp
-{
- CAesCbc Aes;
-public:
- MY_UNKNOWN_IMP1(ICryptoProperties)
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
- STDMETHOD(SetKey)(const Byte *data, UInt32 size);
- STDMETHOD(SetInitVector)(const Byte *data, UInt32 size);
-};
-
-class CAesCbcDecoder:
- public ICompressFilter,
- public ICryptoProperties,
- public CMyUnknownImp
-{
- CAesCbc Aes;
-public:
- MY_UNKNOWN_IMP1(ICryptoProperties)
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
- STDMETHOD(SetKey)(const Byte *data, UInt32 size);
- STDMETHOD(SetInitVector)(const Byte *data, UInt32 size);
-};
-
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp
deleted file mode 100644
index cbbdec89d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-// Pbkdf2HmacSha1.cpp
-
-#include "StdAfx.h"
-
-#include "HmacSha1.h"
-
-namespace NCrypto {
-namespace NSha1 {
-
-void Pbkdf2Hmac(const Byte *pwd, size_t pwdSize, const Byte *salt, size_t saltSize,
- UInt32 numIterations, Byte *key, size_t keySize)
-{
- CHmac baseCtx;
- baseCtx.SetKey(pwd, pwdSize);
- for (UInt32 i = 1; keySize > 0; i++)
- {
- CHmac ctx = baseCtx;
- ctx.Update(salt, saltSize);
- Byte u[kDigestSize] = { (Byte)(i >> 24), (Byte)(i >> 16), (Byte)(i >> 8), (Byte)(i) };
- const unsigned int curSize = (keySize < kDigestSize) ? (unsigned int)keySize : kDigestSize;
- ctx.Update(u, 4);
- ctx.Final(u, kDigestSize);
-
- unsigned int s;
- for (s = 0; s < curSize; s++)
- key[s] = u[s];
-
- for (UInt32 j = numIterations; j > 1; j--)
- {
- ctx = baseCtx;
- ctx.Update(u, kDigestSize);
- ctx.Final(u, kDigestSize);
- for (s = 0; s < curSize; s++)
- key[s] ^= u[s];
- }
-
- key += curSize;
- keySize -= curSize;
- }
-}
-
-void Pbkdf2Hmac32(const Byte *pwd, size_t pwdSize, const UInt32 *salt, size_t saltSize,
- UInt32 numIterations, UInt32 *key, size_t keySize)
-{
- CHmac32 baseCtx;
- baseCtx.SetKey(pwd, pwdSize);
- for (UInt32 i = 1; keySize > 0; i++)
- {
- CHmac32 ctx = baseCtx;
- ctx.Update(salt, saltSize);
- UInt32 u[kDigestSizeInWords] = { i };
- const unsigned int curSize = (keySize < kDigestSizeInWords) ? (unsigned int)keySize : kDigestSizeInWords;
- ctx.Update(u, 1);
- ctx.Final(u, kDigestSizeInWords);
-
- // Speed-optimized code start
- ctx = baseCtx;
- ctx.GetLoopXorDigest(u, numIterations - 1);
- // Speed-optimized code end
-
- unsigned int s;
- for (s = 0; s < curSize; s++)
- key[s] = u[s];
-
- /*
- // Default code start
- for (UInt32 j = numIterations; j > 1; j--)
- {
- ctx = baseCtx;
- ctx.Update(u, kDigestSizeInWords);
- ctx.Final(u, kDigestSizeInWords);
- for (s = 0; s < curSize; s++)
- key[s] ^= u[s];
- }
- // Default code end
- */
-
- key += curSize;
- keySize -= curSize;
- }
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Pbkdf2HmacSha1.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Pbkdf2HmacSha1.h
deleted file mode 100644
index bb90e1214..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Pbkdf2HmacSha1.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Pbkdf2HmacSha1.h
-// Password-Based Key Derivation Function (RFC 2898, PKCS #5) based on HMAC-SHA-1
-
-#ifndef __CRYPTO_PBKDF2_HMAC_SHA1_H
-#define __CRYPTO_PBKDF2_HMAC_SHA1_H
-
-#include <stddef.h>
-#include "../../Common/Types.h"
-
-namespace NCrypto {
-namespace NSha1 {
-
-void Pbkdf2Hmac(const Byte *pwd, size_t pwdSize, const Byte *salt, size_t saltSize,
- UInt32 numIterations, Byte *key, size_t keySize);
-
-void Pbkdf2Hmac32(const Byte *pwd, size_t pwdSize, const UInt32 *salt, size_t saltSize,
- UInt32 numIterations, UInt32 *key, size_t keySize);
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RandGen.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RandGen.cpp
deleted file mode 100644
index e0e2e3abd..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RandGen.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-// RandGen.cpp
-
-#include "StdAfx.h"
-
-#include <stdio.h>
-#include "Windows/Synchronization.h"
-#include "RandGen.h"
-
-#ifndef _WIN32
-#include <unistd.h>
-#define USE_POSIX_TIME
-#define USE_POSIX_TIME2
-#endif
-
-#ifdef USE_POSIX_TIME
-#include <time.h>
-#ifdef USE_POSIX_TIME2
-#include <sys/time.h>
-#endif
-#endif
-
-// This is not very good random number generator.
-// Please use it only for salt.
-// First generated data block depends from timer and processID.
-// Other generated data blocks depend from previous state
-// Maybe it's possible to restore original timer value from generated value.
-
-void CRandomGenerator::Init()
-{
- NCrypto::NSha1::CContext hash;
- hash.Init();
-
- #ifdef _WIN32
- DWORD w = ::GetCurrentProcessId();
- hash.Update((const Byte *)&w, sizeof(w));
- w = ::GetCurrentThreadId();
- hash.Update((const Byte *)&w, sizeof(w));
- #else
- pid_t pid = getpid();
- hash.Update((const Byte *)&pid, sizeof(pid));
- pid = getppid();
- hash.Update((const Byte *)&pid, sizeof(pid));
- #endif
-
- for (int i = 0; i < 1000; i++)
- {
- #ifdef _WIN32
- LARGE_INTEGER v;
- if (::QueryPerformanceCounter(&v))
- hash.Update((const Byte *)&v.QuadPart, sizeof(v.QuadPart));
- #endif
-
- #ifdef USE_POSIX_TIME
- #ifdef USE_POSIX_TIME2
- timeval v;
- if (gettimeofday(&v, 0) == 0)
- {
- hash.Update((const Byte *)&v.tv_sec, sizeof(v.tv_sec));
- hash.Update((const Byte *)&v.tv_usec, sizeof(v.tv_usec));
- }
- #endif
- time_t v2 = time(NULL);
- hash.Update((const Byte *)&v2, sizeof(v2));
- #endif
-
- DWORD tickCount = ::GetTickCount();
- hash.Update((const Byte *)&tickCount, sizeof(tickCount));
-
- for (int j = 0; j < 100; j++)
- {
- hash.Final(_buff);
- hash.Init();
- hash.Update(_buff, NCrypto::NSha1::kDigestSize);
- }
- }
- hash.Final(_buff);
- _needInit = false;
-}
-
-static NWindows::NSynchronization::CCriticalSection g_CriticalSection;
-
-void CRandomGenerator::Generate(Byte *data, unsigned int size)
-{
- g_CriticalSection.Enter();
- if (_needInit)
- Init();
- while (size > 0)
- {
- NCrypto::NSha1::CContext hash;
-
- hash.Init();
- hash.Update(_buff, NCrypto::NSha1::kDigestSize);
- hash.Final(_buff);
-
- hash.Init();
- UInt32 salt = 0xF672ABD1;
- hash.Update((const Byte *)&salt, sizeof(salt));
- hash.Update(_buff, NCrypto::NSha1::kDigestSize);
- Byte buff[NCrypto::NSha1::kDigestSize];
- hash.Final(buff);
- for (unsigned int i = 0; i < NCrypto::NSha1::kDigestSize && size > 0; i++, size--)
- *data++ = buff[i];
- }
- g_CriticalSection.Leave();
-}
-
-CRandomGenerator g_RandomGenerator;
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RandGen.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RandGen.h
deleted file mode 100644
index 209445c43..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RandGen.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// RandGen.h
-
-#ifndef __CRYPTO_RAND_GEN_H
-#define __CRYPTO_RAND_GEN_H
-
-#include "Sha1.h"
-
-class CRandomGenerator
-{
- Byte _buff[NCrypto::NSha1::kDigestSize];
- bool _needInit;
-
- void Init();
-public:
- CRandomGenerator(): _needInit(true) {};
- void Generate(Byte *data, unsigned size);
-};
-
-extern CRandomGenerator g_RandomGenerator;
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Rar20Crypto.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Rar20Crypto.cpp
deleted file mode 100644
index c2df0e527..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Rar20Crypto.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-// Crypto/Rar20Crypto.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/7zCrc.h"
-#include "../../../C/CpuArch.h"
-#include "../../../C/RotateDefs.h"
-
-#include "Rar20Crypto.h"
-
-namespace NCrypto {
-namespace NRar20 {
-
-static const int kNumRounds = 32;
-
-static const Byte InitSubstTable[256] = {
- 215, 19,149, 35, 73,197,192,205,249, 28, 16,119, 48,221, 2, 42,
- 232, 1,177,233, 14, 88,219, 25,223,195,244, 90, 87,239,153,137,
- 255,199,147, 70, 92, 66,246, 13,216, 40, 62, 29,217,230, 86, 6,
- 71, 24,171,196,101,113,218,123, 93, 91,163,178,202, 67, 44,235,
- 107,250, 75,234, 49,167,125,211, 83,114,157,144, 32,193,143, 36,
- 158,124,247,187, 89,214,141, 47,121,228, 61,130,213,194,174,251,
- 97,110, 54,229,115, 57,152, 94,105,243,212, 55,209,245, 63, 11,
- 164,200, 31,156, 81,176,227, 21, 76, 99,139,188,127, 17,248, 51,
- 207,120,189,210, 8,226, 41, 72,183,203,135,165,166, 60, 98, 7,
- 122, 38,155,170, 69,172,252,238, 39,134, 59,128,236, 27,240, 80,
- 131, 3, 85,206,145, 79,154,142,159,220,201,133, 74, 64, 20,129,
- 224,185,138,103,173,182, 43, 34,254, 82,198,151,231,180, 58, 10,
- 118, 26,102, 12, 50,132, 22,191,136,111,162,179, 45, 4,148,108,
- 161, 56, 78,126,242,222, 15,175,146, 23, 33,241,181,190, 77,225,
- 0, 46,169,186, 68, 95,237, 65, 53,208,253,168, 9, 18,100, 52,
- 116,184,160, 96,109, 37, 30,106,140,104,150, 5,204,117,112, 84
-};
-
-void CData::UpdateKeys(const Byte *data)
-{
- for (int i = 0; i < 16; i += 4)
- for (int j = 0; j < 4; j++)
- Keys[j] ^= g_CrcTable[data[i + j]];
-}
-
-static void Swap(Byte *b1, Byte *b2)
-{
- Byte b = *b1;
- *b1 = *b2;
- *b2 = b;
-}
-
-void CData::SetPassword(const Byte *password, UInt32 passwordLen)
-{
- Keys[0] = 0xD3A3B879L;
- Keys[1] = 0x3F6D12F7L;
- Keys[2] = 0x7515A235L;
- Keys[3] = 0xA4E7F123L;
-
- Byte psw[256];
- memset(psw, 0, sizeof(psw));
- memcpy(psw, password, passwordLen);
- memcpy(SubstTable, InitSubstTable, sizeof(SubstTable));
-
- for (UInt32 j = 0; j < 256; j++)
- for (UInt32 i = 0; i < passwordLen; i += 2)
- {
- UInt32 n2 = (Byte)g_CrcTable[(psw[i + 1] + j) & 0xFF];
- UInt32 n1 = (Byte)g_CrcTable[(psw[i] - j) & 0xFF];
- for (UInt32 k = 1; (n1 & 0xFF) != n2; n1++, k++)
- Swap(&SubstTable[n1 & 0xFF], &SubstTable[(n1 + i + k) & 0xFF]);
- }
- for (UInt32 i = 0; i < passwordLen; i+= 16)
- EncryptBlock(&psw[i]);
-}
-
-void CData::CryptBlock(Byte *buf, bool encrypt)
-{
- Byte inBuf[16];
- UInt32 A, B, C, D, T, TA, TB;
-
- A = GetUi32(buf + 0) ^ Keys[0];
- B = GetUi32(buf + 4) ^ Keys[1];
- C = GetUi32(buf + 8) ^ Keys[2];
- D = GetUi32(buf + 12) ^ Keys[3];
-
- if (!encrypt)
- memcpy(inBuf, buf, sizeof(inBuf));
-
- for (int i = 0; i < kNumRounds; i++)
- {
- UInt32 key = Keys[(encrypt ? i : (kNumRounds - 1 - i)) & 3];
- T = ((C + rotlFixed(D, 11)) ^ key);
- TA = A ^ SubstLong(T);
- T = ((D ^ rotlFixed(C, 17)) + key);
- TB = B ^ SubstLong(T);
- A = C;
- B = D;
- C = TA;
- D = TB;
- }
-
- SetUi32(buf + 0, C ^ Keys[0]);
- SetUi32(buf + 4, D ^ Keys[1]);
- SetUi32(buf + 8, A ^ Keys[2]);
- SetUi32(buf + 12, B ^ Keys[3]);
-
- UpdateKeys(encrypt ? buf : inBuf);
-}
-
-STDMETHODIMP CDecoder::CryptoSetPassword(const Byte *data, UInt32 size)
-{
- _cipher.SetPassword(data, size);
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::Init()
-{
- return S_OK;
-}
-
-static const UInt32 kBlockSize = 16;
-
-STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
-{
- if (size == 0)
- return 0;
- if (size < kBlockSize)
- return kBlockSize;
- UInt32 i;
- size -= kBlockSize;
- for (i = 0; i <= size; i += kBlockSize)
- _cipher.DecryptBlock(data + i);
- return i;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Rar20Crypto.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Rar20Crypto.h
deleted file mode 100644
index b9648f59d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Rar20Crypto.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Crypto/Rar20Crypto.h
-
-#ifndef __CRYPTO_RAR20_CRYPTO_H
-#define __CRYPTO_RAR20_CRYPTO_H
-
-#include "Common/MyCom.h"
-
-#include "../ICoder.h"
-#include "../IPassword.h"
-
-namespace NCrypto {
-namespace NRar20 {
-
-class CData
-{
- Byte SubstTable[256];
- UInt32 Keys[4];
-
- UInt32 SubstLong(UInt32 t)
- {
- return (UInt32)SubstTable[(int)t & 255] |
- ((UInt32)SubstTable[(int)(t >> 8) & 255] << 8) |
- ((UInt32)SubstTable[(int)(t >> 16) & 255] << 16) |
- ((UInt32)SubstTable[(int)(t >> 24) & 255] << 24);
- }
- void UpdateKeys(const Byte *data);
- void CryptBlock(Byte *buf, bool encrypt);
-public:
- void EncryptBlock(Byte *buf) { CryptBlock(buf, true); }
- void DecryptBlock(Byte *buf) { CryptBlock(buf, false); }
- void SetPassword(const Byte *password, UInt32 passwordLen);
-};
-
-class CDecoder:
- public ICompressFilter,
- public ICryptoSetPassword,
- public CMyUnknownImp
-{
- CData _cipher;
-public:
- MY_UNKNOWN_IMP1(ICryptoSetPassword)
-
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
- STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RarAes.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RarAes.cpp
deleted file mode 100644
index bbb4ccefb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RarAes.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-// Crypto/RarAes.cpp
-// Note: you must include MyAes.cpp to project to initialize AES tables
-
-#include "StdAfx.h"
-
-#include "RarAes.h"
-#include "Sha1.h"
-
-namespace NCrypto {
-namespace NRar29 {
-
-CDecoder::CDecoder():
- _thereIsSalt(false),
- _needCalculate(true),
- _rar350Mode(false)
-{
- for (int i = 0; i < sizeof(_salt); i++)
- _salt[i] = 0;
-}
-
-STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
-{
- bool thereIsSaltPrev = _thereIsSalt;
- _thereIsSalt = false;
- if (size == 0)
- return S_OK;
- if (size < 8)
- return E_INVALIDARG;
- _thereIsSalt = true;
- bool same = false;
- if (_thereIsSalt == thereIsSaltPrev)
- {
- same = true;
- if (_thereIsSalt)
- {
- for (int i = 0; i < sizeof(_salt); i++)
- if (_salt[i] != data[i])
- {
- same = false;
- break;
- }
- }
- }
- for (int i = 0; i < sizeof(_salt); i++)
- _salt[i] = data[i];
- if (!_needCalculate && !same)
- _needCalculate = true;
- return S_OK;
-}
-
-static const int kMaxPasswordLength = 127 * 2;
-
-STDMETHODIMP CDecoder::CryptoSetPassword(const Byte *data, UInt32 size)
-{
- if (size > kMaxPasswordLength)
- size = kMaxPasswordLength;
- bool same = false;
- if (size == buffer.GetCapacity())
- {
- same = true;
- for (UInt32 i = 0; i < size; i++)
- if (data[i] != buffer[i])
- {
- same = false;
- break;
- }
- }
- if (!_needCalculate && !same)
- _needCalculate = true;
- buffer.SetCapacity(size);
- memcpy(buffer, data, size);
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::Init()
-{
- Calculate();
- Aes_SetKeyDecode(&Aes.aes, aesKey, kRarAesKeySize);
- AesCbc_Init(&Aes, aesInit);
- return S_OK;
-}
-
-STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
-{
- return (UInt32)AesCbc_Decode(&Aes, data, size);
-}
-
-void CDecoder::Calculate()
-{
- if (_needCalculate)
- {
- const int kSaltSize = 8;
-
- Byte rawPassword[kMaxPasswordLength + kSaltSize];
-
- memcpy(rawPassword, buffer, buffer.GetCapacity());
-
- size_t rawLength = buffer.GetCapacity();
-
- if (_thereIsSalt)
- {
- memcpy(rawPassword + rawLength, _salt, kSaltSize);
- rawLength += kSaltSize;
- }
-
- NSha1::CContext sha;
- sha.Init();
-
- // seems rar reverts hash for sha.
- const int hashRounds = 0x40000;
- int i;
- for (i = 0; i < hashRounds; i++)
- {
- sha.Update(rawPassword, rawLength, _rar350Mode);
- Byte pswNum[3] = { (Byte)i, (Byte)(i >> 8), (Byte)(i >> 16) };
- sha.Update(pswNum, 3, _rar350Mode);
- if (i % (hashRounds / 16) == 0)
- {
- NSha1::CContext shaTemp = sha;
- Byte digest[NSha1::kDigestSize];
- shaTemp.Final(digest);
- aesInit[i / (hashRounds / 16)] = (Byte)digest[4 * 4 + 3];
- }
- }
- /*
- // it's test message for sha
- const char *message = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
- sha.Update((const Byte *)message, strlen(message));
- */
- Byte digest[20];
- sha.Final(digest);
- for (i = 0; i < 4; i++)
- for (int j = 0; j < 4; j++)
- aesKey[i * 4 + j] = (digest[i * 4 + 3 - j]);
- }
- _needCalculate = false;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RarAes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RarAes.h
deleted file mode 100644
index 374017b84..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/RarAes.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Crypto/RarAes.h
-
-#ifndef __CRYPTO_RAR_AES_H
-#define __CRYPTO_RAR_AES_H
-
-#include "../../../C/Aes.h"
-
-#include "Common/Buffer.h"
-#include "Common/MyCom.h"
-
-#include "../ICoder.h"
-#include "../IPassword.h"
-
-namespace NCrypto {
-namespace NRar29 {
-
-const UInt32 kRarAesKeySize = 16;
-
-class CDecoder:
- public ICompressFilter,
- public ICompressSetDecoderProperties2,
- public ICryptoSetPassword,
- public CMyUnknownImp
-{
- Byte _salt[8];
- bool _thereIsSalt;
- CByteBuffer buffer;
- Byte aesKey[kRarAesKeySize];
- Byte aesInit[AES_BLOCK_SIZE];
- bool _needCalculate;
-
- CAesCbc Aes;
-
- bool _rar350Mode;
-
- void Calculate();
-
-public:
-
- MY_UNKNOWN_IMP2(
- ICryptoSetPassword,
- ICompressSetDecoderProperties2)
-
- STDMETHOD(Init)();
-
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
-
- STDMETHOD(CryptoSetPassword)(const Byte *aData, UInt32 aSize);
-
- // ICompressSetDecoderProperties
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-
- CDecoder();
- void SetRar350Mode(bool rar350Mode) { _rar350Mode = rar350Mode; }
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Sha1.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Sha1.cpp
deleted file mode 100644
index 92174d18b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Sha1.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-// Crypto/Sha1.cpp
-// This file is based on public domain
-// Steve Reid and Wei Dai's code from Crypto++
-
-#include "StdAfx.h"
-
-#include "../../../C/RotateDefs.h"
-
-#include "Sha1.h"
-
-namespace NCrypto {
-namespace NSha1 {
-
-// define it for speed optimization
-// #define _SHA1_UNROLL
-
-static const unsigned kNumW =
- #ifdef _SHA1_UNROLL
- 16;
- #else
- 80;
- #endif
-
-
-#define w0(i) (W[(i)] = data[(i)])
-
-#ifdef _SHA1_UNROLL
-#define w1(i) (W[(i)&15] = rotlFixed(W[((i)-3)&15] ^ W[((i)-8)&15] ^ W[((i)-14)&15] ^ W[((i)-16)&15], 1))
-#else
-#define w1(i) (W[(i)] = rotlFixed(W[(i)-3] ^ W[(i)-8] ^ W[(i)-14] ^ W[(i)-16], 1))
-#endif
-
-#define f1(x,y,z) (z^(x&(y^z)))
-#define f2(x,y,z) (x^y^z)
-#define f3(x,y,z) ((x&y)|(z&(x|y)))
-#define f4(x,y,z) (x^y^z)
-
-#define RK1(a,b,c,d,e,i, f, w, k) e += f(b,c,d) + w(i) + k + rotlFixed(a,5); b = rotlFixed(b,30);
-
-#define R0(a,b,c,d,e,i) RK1(a,b,c,d,e,i, f1, w0, 0x5A827999)
-#define R1(a,b,c,d,e,i) RK1(a,b,c,d,e,i, f1, w1, 0x5A827999)
-#define R2(a,b,c,d,e,i) RK1(a,b,c,d,e,i, f2, w1, 0x6ED9EBA1)
-#define R3(a,b,c,d,e,i) RK1(a,b,c,d,e,i, f3, w1, 0x8F1BBCDC)
-#define R4(a,b,c,d,e,i) RK1(a,b,c,d,e,i, f4, w1, 0xCA62C1D6)
-
-#define RX_1_4(rx1, rx4, i) rx1(a,b,c,d,e,i); rx4(e,a,b,c,d,i+1); rx4(d,e,a,b,c,i+2); rx4(c,d,e,a,b,i+3); rx4(b,c,d,e,a,i+4);
-#define RX_5(rx, i) RX_1_4(rx, rx, i);
-
-void CContextBase::Init()
-{
- _state[0] = 0x67452301;
- _state[1] = 0xEFCDAB89;
- _state[2] = 0x98BADCFE;
- _state[3] = 0x10325476;
- _state[4] = 0xC3D2E1F0;
- _count = 0;
-}
-
-void CContextBase::GetBlockDigest(UInt32 *data, UInt32 *destDigest, bool returnRes)
-{
- UInt32 a, b, c, d, e;
- UInt32 W[kNumW];
-
- a = _state[0];
- b = _state[1];
- c = _state[2];
- d = _state[3];
- e = _state[4];
- #ifdef _SHA1_UNROLL
- RX_5(R0, 0); RX_5(R0, 5); RX_5(R0, 10);
- #else
- int i;
- for (i = 0; i < 15; i += 5) { RX_5(R0, i); }
- #endif
-
- RX_1_4(R0, R1, 15);
-
-
- #ifdef _SHA1_UNROLL
- RX_5(R2, 20); RX_5(R2, 25); RX_5(R2, 30); RX_5(R2, 35);
- RX_5(R3, 40); RX_5(R3, 45); RX_5(R3, 50); RX_5(R3, 55);
- RX_5(R4, 60); RX_5(R4, 65); RX_5(R4, 70); RX_5(R4, 75);
- #else
- i = 20;
- for (; i < 40; i += 5) { RX_5(R2, i); }
- for (; i < 60; i += 5) { RX_5(R3, i); }
- for (; i < 80; i += 5) { RX_5(R4, i); }
- #endif
-
- destDigest[0] = _state[0] + a;
- destDigest[1] = _state[1] + b;
- destDigest[2] = _state[2] + c;
- destDigest[3] = _state[3] + d;
- destDigest[4] = _state[4] + e;
-
- if (returnRes)
- for (int i = 0 ; i < 16; i++)
- data[i] = W[kNumW - 16 + i];
-
- // Wipe variables
- // a = b = c = d = e = 0;
-}
-
-void CContextBase::PrepareBlock(UInt32 *block, unsigned size) const
-{
- unsigned curBufferPos = size & 0xF;
- block[curBufferPos++] = 0x80000000;
- while (curBufferPos != (16 - 2))
- block[curBufferPos++] = 0;
- const UInt64 lenInBits = (_count << 9) + ((UInt64)size << 5);
- block[curBufferPos++] = (UInt32)(lenInBits >> 32);
- block[curBufferPos++] = (UInt32)(lenInBits);
-}
-
-void CContext::Update(Byte *data, size_t size, bool rar350Mode)
-{
- bool returnRes = false;
- unsigned curBufferPos = _count2;
- while (size-- > 0)
- {
- int pos = (int)(curBufferPos & 3);
- if (pos == 0)
- _buffer[curBufferPos >> 2] = 0;
- _buffer[curBufferPos >> 2] |= ((UInt32)*data++) << (8 * (3 - pos));
- if (++curBufferPos == kBlockSize)
- {
- curBufferPos = 0;
- CContextBase::UpdateBlock(_buffer, returnRes);
- if (returnRes)
- for (unsigned int i = 0; i < kBlockSizeInWords; i++)
- {
- UInt32 d = _buffer[i];
- data[i * 4 + 0 - kBlockSize] = (Byte)(d);
- data[i * 4 + 1 - kBlockSize] = (Byte)(d >> 8);
- data[i * 4 + 2 - kBlockSize] = (Byte)(d >> 16);
- data[i * 4 + 3 - kBlockSize] = (Byte)(d >> 24);
- }
- returnRes = rar350Mode;
- }
- }
- _count2 = curBufferPos;
-}
-
-void CContext::Final(Byte *digest)
-{
- const UInt64 lenInBits = (_count << 9) + ((UInt64)_count2 << 3);
- unsigned curBufferPos = _count2;
- int pos = (int)(curBufferPos & 3);
- curBufferPos >>= 2;
- if (pos == 0)
- _buffer[curBufferPos] = 0;
- _buffer[curBufferPos++] |= ((UInt32)0x80) << (8 * (3 - pos));
-
- while (curBufferPos != (16 - 2))
- {
- curBufferPos &= 0xF;
- if (curBufferPos == 0)
- UpdateBlock();
- _buffer[curBufferPos++] = 0;
- }
- _buffer[curBufferPos++] = (UInt32)(lenInBits >> 32);
- _buffer[curBufferPos++] = (UInt32)(lenInBits);
- UpdateBlock();
-
- unsigned int i;
- for (i = 0; i < kDigestSizeInWords; i++)
- {
- UInt32 state = _state[i] & 0xFFFFFFFF;
- *digest++ = (Byte)(state >> 24);
- *digest++ = (Byte)(state >> 16);
- *digest++ = (Byte)(state >> 8);
- *digest++ = (Byte)(state);
- }
- Init();
-}
-
-///////////////////////////
-// Words version
-
-void CContext32::Update(const UInt32 *data, size_t size)
-{
- while (size-- > 0)
- {
- _buffer[_count2++] = *data++;
- if (_count2 == kBlockSizeInWords)
- {
- _count2 = 0;
- UpdateBlock();
- }
- }
-}
-
-void CContext32::Final(UInt32 *digest)
-{
- const UInt64 lenInBits = (_count << 9) + ((UInt64)_count2 << 5);
- unsigned curBufferPos = _count2;
- _buffer[curBufferPos++] = 0x80000000;
- while (curBufferPos != (16 - 2))
- {
- curBufferPos &= 0xF;
- if (curBufferPos == 0)
- UpdateBlock();
- _buffer[curBufferPos++] = 0;
- }
- _buffer[curBufferPos++] = (UInt32)(lenInBits >> 32);
- _buffer[curBufferPos++] = (UInt32)(lenInBits);
- GetBlockDigest(_buffer, digest);
- Init();
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Sha1.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Sha1.h
deleted file mode 100644
index 405be2166..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/Sha1.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Crypto/Sha1.h
-// This file is based on public domain
-// Steve Reid and Wei Dai's code from Crypto++
-
-#ifndef __CRYPTO_SHA1_H
-#define __CRYPTO_SHA1_H
-
-#include <stddef.h>
-#include "../../Common/Types.h"
-
-// Sha1 implementation in RAR before version 3.60 has bug:
-// it changes data bytes in some cases.
-// So this class supports both versions: normal_SHA and rar3Mode
-
-namespace NCrypto {
-namespace NSha1 {
-
-const unsigned kBlockSize = 64;
-const unsigned kDigestSize = 20;
-
-const unsigned kBlockSizeInWords = (kBlockSize >> 2);
-const unsigned kDigestSizeInWords = (kDigestSize >> 2);
-
-class CContextBase
-{
-protected:
- UInt32 _state[5];
- UInt64 _count;
- void UpdateBlock(UInt32 *data, bool returnRes = false)
- {
- GetBlockDigest(data, _state, returnRes);
- _count++;
- }
-public:
- void Init();
- void GetBlockDigest(UInt32 *blockData, UInt32 *destDigest, bool returnRes = false);
- // PrepareBlock can be used only when size <= 13. size in Words
- void PrepareBlock(UInt32 *block, unsigned int size) const;
-};
-
-class CContextBase2: public CContextBase
-{
-protected:
- unsigned _count2;
- UInt32 _buffer[kBlockSizeInWords];
- void UpdateBlock() { CContextBase::UpdateBlock(_buffer); }
-public:
- void Init() { CContextBase::Init(); _count2 = 0; }
-};
-
-class CContext: public CContextBase2
-{
-public:
- void Update(Byte *data, size_t size, bool rar350Mode = false);
- void Update(const Byte *data, size_t size) { Update((Byte *)data, size, false); }
- void Final(Byte *digest);
-};
-
-class CContext32: public CContextBase2
-{
-public:
- void Update(const UInt32 *data, size_t size);
- void Final(UInt32 *digest);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/WzAes.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/WzAes.cpp
deleted file mode 100644
index beb24217c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/WzAes.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-// Crypto/WzAes.cpp
-/*
-This code implements Brian Gladman's scheme
-specified in password Based File Encryption Utility.
-
-Note: you must include MyAes.cpp to project to initialize AES tables
-*/
-
-#include "StdAfx.h"
-
-#include "../Common/StreamObjects.h"
-#include "../Common/StreamUtils.h"
-
-#include "Pbkdf2HmacSha1.h"
-#include "RandGen.h"
-#include "WzAes.h"
-
-// define it if you don't want to use speed-optimized version of Pbkdf2HmacSha1
-// #define _NO_WZAES_OPTIMIZATIONS
-
-namespace NCrypto {
-namespace NWzAes {
-
-const unsigned int kAesKeySizeMax = 32;
-
-static const UInt32 kNumKeyGenIterations = 1000;
-
-STDMETHODIMP CBaseCoder::CryptoSetPassword(const Byte *data, UInt32 size)
-{
- if(size > kPasswordSizeMax)
- return E_INVALIDARG;
- _key.Password.SetCapacity(size);
- memcpy(_key.Password, data, size);
- return S_OK;
-}
-
-#define SetUi32(p, d) { UInt32 x = (d); (p)[0] = (Byte)x; (p)[1] = (Byte)(x >> 8); \
- (p)[2] = (Byte)(x >> 16); (p)[3] = (Byte)(x >> 24); }
-
-void CBaseCoder::EncryptData(Byte *data, UInt32 size)
-{
- unsigned int pos = _blockPos;
- for (; size > 0; size--)
- {
- if (pos == AES_BLOCK_SIZE)
- {
- if (++_counter[0] == 0)
- _counter[1]++;
- UInt32 temp[4];
- Aes_Encode32(&Aes, temp, _counter);
- SetUi32(_buffer, temp[0]);
- SetUi32(_buffer + 4, temp[1]);
- SetUi32(_buffer + 8, temp[2]);
- SetUi32(_buffer + 12, temp[3]);
- pos = 0;
- }
- *data++ ^= _buffer[pos++];
- }
- _blockPos = pos;
-}
-
-#ifndef _NO_WZAES_OPTIMIZATIONS
-
-static void BytesToBeUInt32s(const Byte *src, UInt32 *dest, int destSize)
-{
- for (int i = 0 ; i < destSize; i++)
- dest[i] =
- ((UInt32)(src[i * 4 + 0]) << 24) |
- ((UInt32)(src[i * 4 + 1]) << 16) |
- ((UInt32)(src[i * 4 + 2]) << 8) |
- ((UInt32)(src[i * 4 + 3]));
-}
-
-#endif
-
-STDMETHODIMP CBaseCoder::Init()
-{
- UInt32 keySize = _key.GetKeySize();
- UInt32 keysTotalSize = 2 * keySize + kPwdVerifCodeSize;
- Byte buf[2 * kAesKeySizeMax + kPwdVerifCodeSize];
-
- // for (int ii = 0; ii < 1000; ii++)
- {
- #ifdef _NO_WZAES_OPTIMIZATIONS
-
- NSha1::Pbkdf2Hmac(
- _key.Password, _key.Password.GetCapacity(),
- _key.Salt, _key.GetSaltSize(),
- kNumKeyGenIterations,
- buf, keysTotalSize);
-
- #else
-
- UInt32 buf32[(2 * kAesKeySizeMax + kPwdVerifCodeSize + 3) / 4];
- UInt32 key32SizeTotal = (keysTotalSize + 3) / 4;
- UInt32 salt[kSaltSizeMax * 4];
- UInt32 saltSizeInWords = _key.GetSaltSize() / 4;
- BytesToBeUInt32s(_key.Salt, salt, saltSizeInWords);
- NSha1::Pbkdf2Hmac32(
- _key.Password, _key.Password.GetCapacity(),
- salt, saltSizeInWords,
- kNumKeyGenIterations,
- buf32, key32SizeTotal);
- for (UInt32 j = 0; j < keysTotalSize; j++)
- buf[j] = (Byte)(buf32[j / 4] >> (24 - 8 * (j & 3)));
-
- #endif
- }
-
- _hmac.SetKey(buf + keySize, keySize);
- memcpy(_key.PwdVerifComputed, buf + 2 * keySize, kPwdVerifCodeSize);
-
- _blockPos = AES_BLOCK_SIZE;
- for (int i = 0; i < 4; i++)
- _counter[i] = 0;
-
- Aes_SetKeyEncode(&Aes, buf, keySize);
- return S_OK;
-}
-
-/*
-STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
-{
- Byte keySizeMode = 3;
- return outStream->Write(&keySizeMode, 1, NULL);
-}
-*/
-
-HRESULT CEncoder::WriteHeader(ISequentialOutStream *outStream)
-{
- UInt32 saltSize = _key.GetSaltSize();
- g_RandomGenerator.Generate(_key.Salt, saltSize);
- Init();
- RINOK(WriteStream(outStream, _key.Salt, saltSize));
- return WriteStream(outStream, _key.PwdVerifComputed, kPwdVerifCodeSize);
-}
-
-HRESULT CEncoder::WriteFooter(ISequentialOutStream *outStream)
-{
- Byte mac[kMacSize];
- _hmac.Final(mac, kMacSize);
- return WriteStream(outStream, mac, kMacSize);
-}
-
-STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
-{
- if (size != 1)
- return E_INVALIDARG;
- _key.Init();
- Byte keySizeMode = data[0];
- if (keySizeMode < 1 || keySizeMode > 3)
- return E_INVALIDARG;
- _key.KeySizeMode = keySizeMode;
- return S_OK;
-}
-
-HRESULT CDecoder::ReadHeader(ISequentialInStream *inStream)
-{
- UInt32 saltSize = _key.GetSaltSize();
- UInt32 extraSize = saltSize + kPwdVerifCodeSize;
- Byte temp[kSaltSizeMax + kPwdVerifCodeSize];
- RINOK(ReadStream_FAIL(inStream, temp, extraSize));
- UInt32 i;
- for (i = 0; i < saltSize; i++)
- _key.Salt[i] = temp[i];
- for (i = 0; i < kPwdVerifCodeSize; i++)
- _pwdVerifFromArchive[i] = temp[saltSize + i];
- return S_OK;
-}
-
-static bool CompareArrays(const Byte *p1, const Byte *p2, UInt32 size)
-{
- for (UInt32 i = 0; i < size; i++)
- if (p1[i] != p2[i])
- return false;
- return true;
-}
-
-bool CDecoder::CheckPasswordVerifyCode()
-{
- return CompareArrays(_key.PwdVerifComputed, _pwdVerifFromArchive, kPwdVerifCodeSize);
-}
-
-HRESULT CDecoder::CheckMac(ISequentialInStream *inStream, bool &isOK)
-{
- isOK = false;
- Byte mac1[kMacSize];
- RINOK(ReadStream_FAIL(inStream, mac1, kMacSize));
- Byte mac2[kMacSize];
- _hmac.Final(mac2, kMacSize);
- isOK = CompareArrays(mac1, mac2, kMacSize);
- return S_OK;
-}
-
-STDMETHODIMP_(UInt32) CEncoder::Filter(Byte *data, UInt32 size)
-{
- EncryptData(data, size);
- _hmac.Update(data, size);
- return size;
-}
-
-STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
-{
- _hmac.Update(data, size);
- EncryptData(data, size);
- return size;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/WzAes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/WzAes.h
deleted file mode 100644
index 22f4d4dd3..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/WzAes.h
+++ /dev/null
@@ -1,116 +0,0 @@
-// Crypto/WzAes.h
-/*
-This code implements Brian Gladman's scheme
-specified in password Based File Encryption Utility:
- - AES encryption (128,192,256-bit) in Counter (CTR) mode.
- - HMAC-SHA1 authentication for encrypted data (10 bytes)
- - Keys are derived by PPKDF2(RFC2898)-HMAC-SHA1 from ASCII password and
- Salt (saltSize = aesKeySize / 2).
- - 2 bytes contain Password Verifier's Code
-*/
-
-#ifndef __CRYPTO_WZ_AES_H
-#define __CRYPTO_WZ_AES_H
-
-#include "../../../C/Aes.h"
-
-#include "Common/Buffer.h"
-#include "Common/MyCom.h"
-#include "Common/MyVector.h"
-
-#include "../ICoder.h"
-#include "../IPassword.h"
-
-#include "HmacSha1.h"
-
-namespace NCrypto {
-namespace NWzAes {
-
-const unsigned int kSaltSizeMax = 16;
-const unsigned int kMacSize = 10;
-
-const UInt32 kPasswordSizeMax = 99; // 128;
-
-// Password Verification Code Size
-const unsigned int kPwdVerifCodeSize = 2;
-
-class CKeyInfo
-{
-public:
- Byte KeySizeMode; // 1 - 128-bit , 2 - 192-bit , 3 - 256-bit
- Byte Salt[kSaltSizeMax];
- Byte PwdVerifComputed[kPwdVerifCodeSize];
-
- CByteBuffer Password;
-
- UInt32 GetKeySize() const { return (8 * (KeySizeMode & 3) + 8); }
- UInt32 GetSaltSize() const { return (4 * (KeySizeMode & 3) + 4); }
-
- CKeyInfo() { Init(); }
- void Init() { KeySizeMode = 3; }
-};
-
-class CBaseCoder:
- public ICompressFilter,
- public ICryptoSetPassword,
- public CMyUnknownImp
-{
-protected:
- CKeyInfo _key;
- UInt32 _counter[AES_BLOCK_SIZE / 4];
- Byte _buffer[AES_BLOCK_SIZE];
- NSha1::CHmac _hmac;
- unsigned int _blockPos;
- Byte _pwdVerifFromArchive[kPwdVerifCodeSize];
-
- void EncryptData(Byte *data, UInt32 size);
-
- CAes Aes;
-
-public:
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size) = 0;
-
- STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
-
- UInt32 GetHeaderSize() const { return _key.GetSaltSize() + kPwdVerifCodeSize; }
-};
-
-class CEncoder:
- public CBaseCoder
- // public ICompressWriteCoderProperties
-{
-public:
- MY_UNKNOWN_IMP1(ICryptoSetPassword)
- // ICompressWriteCoderProperties
- // STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
- HRESULT WriteHeader(ISequentialOutStream *outStream);
- HRESULT WriteFooter(ISequentialOutStream *outStream);
- bool SetKeyMode(Byte mode)
- {
- if (mode < 1 || mode > 3)
- return false;
- _key.KeySizeMode = mode;
- return true;
- }
-};
-
-class CDecoder:
- public CBaseCoder,
- public ICompressSetDecoderProperties2
-{
-public:
- MY_UNKNOWN_IMP2(
- ICryptoSetPassword,
- ICompressSetDecoderProperties2)
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
- HRESULT ReadHeader(ISequentialInStream *inStream);
- bool CheckPasswordVerifyCode();
- HRESULT CheckMac(ISequentialInStream *inStream, bool &isOK);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipCrypto.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipCrypto.cpp
deleted file mode 100644
index f5972c572..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipCrypto.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-// Crypto/ZipCrypto.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/7zCrc.h"
-
-#include "../Common/StreamUtils.h"
-
-#include "RandGen.h"
-#include "ZipCrypto.h"
-
-namespace NCrypto {
-namespace NZip {
-
-void CCipher::UpdateKeys(Byte b)
-{
- Keys[0] = CRC_UPDATE_BYTE(Keys[0], b);
- Keys[1] += Keys[0] & 0xff;
- Keys[1] = Keys[1] * 134775813L + 1;
- Keys[2] = CRC_UPDATE_BYTE(Keys[2], (Byte)(Keys[1] >> 24));
-}
-
-void CCipher::SetPassword(const Byte *password, UInt32 passwordLen)
-{
- Keys[0] = 305419896L;
- Keys[1] = 591751049L;
- Keys[2] = 878082192L;
- for (UInt32 i = 0; i < passwordLen; i++)
- UpdateKeys(password[i]);
-}
-
-Byte CCipher::DecryptByteSpec()
-{
- UInt32 temp = Keys[2] | 2;
- return (Byte)((temp * (temp ^ 1)) >> 8);
-}
-
-Byte CCipher::DecryptByte(Byte b)
-{
- Byte c = (Byte)(b ^ DecryptByteSpec());
- UpdateKeys(c);
- return c;
-}
-
-Byte CCipher::EncryptByte(Byte b)
-{
- Byte c = (Byte)(b ^ DecryptByteSpec());
- UpdateKeys(b);
- return c;
-}
-
-void CCipher::DecryptHeader(Byte *buf)
-{
- for (unsigned i = 0; i < kHeaderSize; i++)
- buf[i] = DecryptByte(buf[i]);
-}
-
-void CCipher::EncryptHeader(Byte *buf)
-{
- for (unsigned i = 0; i < kHeaderSize; i++)
- buf[i] = EncryptByte(buf[i]);
-}
-
-STDMETHODIMP CEncoder::CryptoSetPassword(const Byte *data, UInt32 size)
-{
- _cipher.SetPassword(data, size);
- return S_OK;
-}
-
-STDMETHODIMP CEncoder::CryptoSetCRC(UInt32 crc)
-{
- _crc = crc;
- return S_OK;
-}
-
-STDMETHODIMP CEncoder::Init()
-{
- return S_OK;
-}
-
-HRESULT CEncoder::WriteHeader(ISequentialOutStream *outStream)
-{
- Byte header[kHeaderSize];
- g_RandomGenerator.Generate(header, kHeaderSize - 2);
-
- header[kHeaderSize - 1] = Byte(_crc >> 24);
- header[kHeaderSize - 2] = Byte(_crc >> 16);
-
- _cipher.EncryptHeader(header);
- return WriteStream(outStream, header, kHeaderSize);
-}
-
-STDMETHODIMP_(UInt32) CEncoder::Filter(Byte *data, UInt32 size)
-{
- UInt32 i;
- for (i = 0; i < size; i++)
- data[i] = _cipher.EncryptByte(data[i]);
- return i;
-}
-
-STDMETHODIMP CDecoder::CryptoSetPassword(const Byte *data, UInt32 size)
-{
- _cipher.SetPassword(data, size);
- return S_OK;
-}
-
-HRESULT CDecoder::ReadHeader(ISequentialInStream *inStream)
-{
- Byte header[kHeaderSize];
- RINOK(ReadStream_FAIL(inStream, header, kHeaderSize));
- _cipher.DecryptHeader(header);
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::Init()
-{
- return S_OK;
-}
-
-STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
-{
- UInt32 i;
- for (i = 0; i < size; i++)
- data[i] = _cipher.DecryptByte(data[i]);
- return i;
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipCrypto.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipCrypto.h
deleted file mode 100644
index 040ebb095..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipCrypto.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Crypto/ZipCrypto.h
-
-#ifndef __CRYPTO_ZIP_CRYPTO_H
-#define __CRYPTO_ZIP_CRYPTO_H
-
-#include "Common/MyCom.h"
-
-#include "../ICoder.h"
-#include "../IPassword.h"
-
-namespace NCrypto {
-namespace NZip {
-
-const unsigned kHeaderSize = 12;
-
-class CCipher
-{
- UInt32 Keys[3];
-
- void UpdateKeys(Byte b);
- Byte DecryptByteSpec();
-public:
- void SetPassword(const Byte *password, UInt32 passwordLen);
- Byte DecryptByte(Byte b);
- Byte EncryptByte(Byte b);
- void DecryptHeader(Byte *buf);
- void EncryptHeader(Byte *buf);
-};
-
-class CEncoder :
- public ICompressFilter,
- public ICryptoSetPassword,
- public ICryptoSetCRC,
- public CMyUnknownImp
-{
- CCipher _cipher;
- UInt32 _crc;
-public:
- MY_UNKNOWN_IMP2(
- ICryptoSetPassword,
- ICryptoSetCRC
- )
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
-
- STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
- STDMETHOD(CryptoSetCRC)(UInt32 crc);
- HRESULT WriteHeader(ISequentialOutStream *outStream);
-};
-
-
-class CDecoder:
- public ICompressFilter,
- public ICryptoSetPassword,
- public CMyUnknownImp
-{
- CCipher _cipher;
-public:
- MY_UNKNOWN_IMP1(ICryptoSetPassword)
-
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
- STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
-
- HRESULT ReadHeader(ISequentialInStream *inStream);
-};
-
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipStrong.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipStrong.cpp
deleted file mode 100644
index be5b42754..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipStrong.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-// Crypto/ZipStrong.cpp
-
-#include "StdAfx.h"
-
-#include "../../../C/7zCrc.h"
-#include "../../../C/CpuArch.h"
-
-#include "../Common/StreamUtils.h"
-
-#include "MyAes.h"
-#include "Sha1.h"
-#include "ZipStrong.h"
-
-namespace NCrypto {
-namespace NZipStrong {
-
-static const UInt16 kAES128 = 0x660E;
-
-// DeriveKey* function is similar to CryptDeriveKey() from Windows.
-// But MSDN tells that we need such scheme only if
-// "the required key length is longer than the hash value"
-// but ZipStrong uses it always.
-
-static void DeriveKey2(const Byte *digest, Byte c, Byte *dest)
-{
- Byte buf[64];
- memset(buf, c, 64);
- for (unsigned i = 0; i < NSha1::kDigestSize; i++)
- buf[i] ^= digest[i];
- NSha1::CContext sha;
- sha.Init();
- sha.Update(buf, 64);
- sha.Final(dest);
-}
-
-static void DeriveKey(NSha1::CContext &sha, Byte *key)
-{
- Byte digest[NSha1::kDigestSize];
- sha.Final(digest);
- Byte temp[NSha1::kDigestSize * 2];
- DeriveKey2(digest, 0x36, temp);
- DeriveKey2(digest, 0x5C, temp + NSha1::kDigestSize);
- memcpy(key, temp, 32);
-}
-
-void CKeyInfo::SetPassword(const Byte *data, UInt32 size)
-{
- NSha1::CContext sha;
- sha.Init();
- sha.Update(data, size);
- DeriveKey(sha, MasterKey);
-}
-
-STDMETHODIMP CBaseCoder::CryptoSetPassword(const Byte *data, UInt32 size)
-{
- _key.SetPassword(data, size);
- return S_OK;
-}
-
-STDMETHODIMP CBaseCoder::Init()
-{
- return S_OK;
-}
-
-HRESULT CDecoder::ReadHeader(ISequentialInStream *inStream, UInt32 /* crc */, UInt64 /* unpackSize */)
-{
- Byte temp[4];
- RINOK(ReadStream_FALSE(inStream, temp, 2));
- _ivSize = GetUi16(temp);
- if (_ivSize == 0)
- {
- return E_NOTIMPL;
- /*
- SetUi32(_iv, crc);
- for (int i = 0; i < 8; i++)
- _iv[4 + i] = (Byte)(unpackSize >> (8 * i));
- SetUi32(_iv + 12, 0);
- */
- }
- else if (_ivSize == 16)
- {
- RINOK(ReadStream_FALSE(inStream, _iv, _ivSize));
- }
- else
- return E_NOTIMPL;
- RINOK(ReadStream_FALSE(inStream, temp, 4));
- _remSize = GetUi32(temp);
- if (_remSize > _buf.GetCapacity())
- {
- _buf.Free();
- _buf.SetCapacity(_remSize);
- }
- return ReadStream_FALSE(inStream, _buf, _remSize);
-}
-
-HRESULT CDecoder::CheckPassword(bool &passwOK)
-{
- passwOK = false;
- if (_remSize < 10)
- return E_NOTIMPL;
- Byte *p = _buf;
- UInt16 format = GetUi16(p);
- if (format != 3)
- return E_NOTIMPL;
- UInt16 algId = GetUi16(p + 2);
- if (algId < kAES128)
- return E_NOTIMPL;
- algId -= kAES128;
- if (algId > 2)
- return E_NOTIMPL;
- UInt16 bitLen = GetUi16(p + 4);
- UInt16 flags = GetUi16(p + 6);
- if (algId * 64 + 128 != bitLen)
- return E_NOTIMPL;
- _key.KeySize = 16 + algId * 8;
- if ((flags & 1) == 0)
- return E_NOTIMPL;
- UInt32 rdSize = GetUi16(p + 8);
- UInt32 pos = 10;
- Byte *rd = p + pos;
- pos += rdSize;
- if (pos + 4 > _remSize)
- return E_NOTIMPL;
- UInt32 reserved = GetUi32(p + pos);
- pos += 4;
- if (reserved != 0)
- return E_NOTIMPL;
- if (pos + 2 > _remSize)
- return E_NOTIMPL;
- UInt32 validSize = GetUi16(p + pos);
- pos += 2;
- Byte *validData = p + pos;
- if (pos + validSize != _remSize)
- return E_NOTIMPL;
-
- if (!_aesFilter)
- _aesFilter = new CAesCbcDecoder;
-
- CMyComPtr<ICryptoProperties> cp;
- RINOK(_aesFilter.QueryInterface(IID_ICryptoProperties, &cp));
- {
- RINOK(cp->SetKey(_key.MasterKey, _key.KeySize));
- RINOK(cp->SetInitVector(_iv, 16));
- _aesFilter->Init();
- if (_aesFilter->Filter(rd, rdSize) != rdSize)
- return E_NOTIMPL;
- }
-
- Byte fileKey[32];
- NSha1::CContext sha;
- sha.Init();
- sha.Update(_iv, 16);
- sha.Update(rd, rdSize - 16); // we don't use last 16 bytes (PAD bytes)
- DeriveKey(sha, fileKey);
-
- RINOK(cp->SetKey(fileKey, _key.KeySize));
- RINOK(cp->SetInitVector(_iv, 16));
- _aesFilter->Init();
- if (_aesFilter->Filter(validData, validSize) != validSize)
- return E_NOTIMPL;
-
- if (validSize < 4)
- return E_NOTIMPL;
- validSize -= 4;
- if (GetUi32(validData + validSize) != CrcCalc(validData, validSize))
- return S_OK;
- passwOK = true;
- _aesFilter->Init();
- return S_OK;
-}
-
-STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
-{
- return _aesFilter->Filter(data, size);
-}
-
-}}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipStrong.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipStrong.h
deleted file mode 100644
index 6ea00b344..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/Crypto/ZipStrong.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Crypto/ZipStrong.h
-
-#ifndef __CRYPTO_ZIP_STRONG_H
-#define __CRYPTO_ZIP_STRONG_H
-
-#include "Common/MyCom.h"
-#include "Common/Buffer.h"
-
-#include "../ICoder.h"
-#include "../IPassword.h"
-
-namespace NCrypto {
-namespace NZipStrong {
-
-struct CKeyInfo
-{
- Byte MasterKey[32];
- UInt32 KeySize;
- void SetPassword(const Byte *data, UInt32 size);
-};
-
-class CBaseCoder:
- public ICompressFilter,
- public ICryptoSetPassword,
- public CMyUnknownImp
-{
-protected:
- CKeyInfo _key;
- CMyComPtr<ICompressFilter> _aesFilter;
- CByteBuffer _buf;
-public:
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size) = 0;
-
- STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
-};
-
-class CDecoder:
- public CBaseCoder
-{
- UInt32 _ivSize;
- Byte _iv[16];
- UInt32 _remSize;
-public:
- MY_UNKNOWN_IMP1(ICryptoSetPassword)
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
- HRESULT ReadHeader(ISequentialInStream *inStream, UInt32 crc, UInt64 unpackSize);
- HRESULT CheckPassword(bool &passwOK);
-};
-
-}}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/ICoder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/ICoder.h
deleted file mode 100644
index b5d4d5567..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/ICoder.h
+++ /dev/null
@@ -1,179 +0,0 @@
-// ICoder.h
-
-#ifndef __ICODER_H
-#define __ICODER_H
-
-#include "IStream.h"
-
-#define CODER_INTERFACE(i, x) DECL_INTERFACE(i, 4, x)
-
-CODER_INTERFACE(ICompressProgressInfo, 0x04)
-{
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize) PURE;
-};
-
-CODER_INTERFACE(ICompressCoder, 0x05)
-{
- STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress) PURE;
-};
-
-CODER_INTERFACE(ICompressCoder2, 0x18)
-{
- STDMETHOD(Code)(ISequentialInStream **inStreams, const UInt64 **inSizes, UInt32 numInStreams,
- ISequentialOutStream **outStreams, const UInt64 **outSizes, UInt32 numOutStreams,
- ICompressProgressInfo *progress) PURE;
-};
-
-namespace NCoderPropID
-{
- enum EEnum
- {
- kDefaultProp = 0,
- kDictionarySize,
- kUsedMemorySize,
- kOrder,
- kBlockSize,
- kPosStateBits,
- kLitContextBits,
- kLitPosBits,
- kNumFastBytes,
- kMatchFinder,
- kMatchFinderCycles,
- kNumPasses,
- kAlgorithm,
- kNumThreads,
- kEndMarker
- };
-}
-
-CODER_INTERFACE(ICompressSetCoderProperties, 0x20)
-{
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps) PURE;
-};
-
-/*
-CODER_INTERFACE(ICompressSetCoderProperties, 0x21)
-{
- STDMETHOD(SetDecoderProperties)(ISequentialInStream *inStream) PURE;
-};
-*/
-
-CODER_INTERFACE(ICompressSetDecoderProperties2, 0x22)
-{
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size) PURE;
-};
-
-CODER_INTERFACE(ICompressWriteCoderProperties, 0x23)
-{
- STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream) PURE;
-};
-
-CODER_INTERFACE(ICompressGetInStreamProcessedSize, 0x24)
-{
- STDMETHOD(GetInStreamProcessedSize)(UInt64 *value) PURE;
-};
-
-CODER_INTERFACE(ICompressSetCoderMt, 0x25)
-{
- STDMETHOD(SetNumberOfThreads)(UInt32 numThreads) PURE;
-};
-
-CODER_INTERFACE(ICompressGetSubStreamSize, 0x30)
-{
- STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value) PURE;
-};
-
-CODER_INTERFACE(ICompressSetInStream, 0x31)
-{
- STDMETHOD(SetInStream)(ISequentialInStream *inStream) PURE;
- STDMETHOD(ReleaseInStream)() PURE;
-};
-
-CODER_INTERFACE(ICompressSetOutStream, 0x32)
-{
- STDMETHOD(SetOutStream)(ISequentialOutStream *outStream) PURE;
- STDMETHOD(ReleaseOutStream)() PURE;
-};
-
-CODER_INTERFACE(ICompressSetInStreamSize, 0x33)
-{
- STDMETHOD(SetInStreamSize)(const UInt64 *inSize) PURE;
-};
-
-CODER_INTERFACE(ICompressSetOutStreamSize, 0x34)
-{
- STDMETHOD(SetOutStreamSize)(const UInt64 *outSize) PURE;
-};
-
-CODER_INTERFACE(ICompressFilter, 0x40)
-{
- STDMETHOD(Init)() PURE;
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size) PURE;
- // Filter return outSize (UInt32)
- // if (outSize <= size): Filter have converted outSize bytes
- // if (outSize > size): Filter have not converted anything.
- // and it needs at least outSize bytes to convert one block
- // (it's for crypto block algorithms).
-};
-
-CODER_INTERFACE(ICompressCodecsInfo, 0x60)
-{
- STDMETHOD(GetNumberOfMethods)(UInt32 *numMethods) PURE;
- STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) PURE;
- STDMETHOD(CreateDecoder)(UInt32 index, const GUID *iid, void **coder) PURE;
- STDMETHOD(CreateEncoder)(UInt32 index, const GUID *iid, void **coder) PURE;
-};
-CODER_INTERFACE(ISetCompressCodecsInfo, 0x61)
-{
- STDMETHOD(SetCompressCodecsInfo)(ICompressCodecsInfo *compressCodecsInfo) PURE;
-};
-
-CODER_INTERFACE(ICryptoProperties, 0x80)
-{
- STDMETHOD(SetKey)(const Byte *data, UInt32 size) PURE;
- STDMETHOD(SetInitVector)(const Byte *data, UInt32 size) PURE;
-};
-
-/*
-CODER_INTERFACE(ICryptoResetSalt, 0x88)
-{
- STDMETHOD(ResetSalt)() PURE;
-};
-*/
-
-CODER_INTERFACE(ICryptoResetInitVector, 0x8C)
-{
- STDMETHOD(ResetInitVector)() PURE;
-};
-
-CODER_INTERFACE(ICryptoSetPassword, 0x90)
-{
- STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size) PURE;
-};
-
-CODER_INTERFACE(ICryptoSetCRC, 0xA0)
-{
- STDMETHOD(CryptoSetCRC)(UInt32 crc) PURE;
-};
-
-//////////////////////
-// It's for DLL file
-namespace NMethodPropID
-{
- enum EEnum
- {
- kID,
- kName,
- kDecoder,
- kEncoder,
- kInStreams,
- kOutStreams,
- kDescription,
- kDecoderIsAssigned,
- kEncoderIsAssigned
- };
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IDecl.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IDecl.h
deleted file mode 100644
index 8316eb3ac..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IDecl.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// IDecl.h
-
-#ifndef __IDECL_H
-#define __IDECL_H
-
-#include "../Common/MyUnknown.h"
-
-#define DECL_INTERFACE_SUB(i, base, groupId, subId) \
-DEFINE_GUID(IID_ ## i, \
-0x23170F69, 0x40C1, 0x278A, 0, 0, 0, (groupId), 0, (subId), 0, 0); \
-struct i: public base
-
-#define DECL_INTERFACE(i, groupId, subId) DECL_INTERFACE_SUB(i, IUnknown, groupId, subId)
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IPassword.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IPassword.h
deleted file mode 100644
index 3ca7b090e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IPassword.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// IPassword.h
-
-#ifndef __IPASSWORD_H
-#define __IPASSWORD_H
-
-#include "../Common/MyUnknown.h"
-#include "../Common/Types.h"
-
-#include "IDecl.h"
-
-#define PASSWORD_INTERFACE(i, x) DECL_INTERFACE(i, 5, x)
-
-PASSWORD_INTERFACE(ICryptoGetTextPassword, 0x10)
-{
- STDMETHOD(CryptoGetTextPassword)(BSTR *password) PURE;
-};
-
-PASSWORD_INTERFACE(ICryptoGetTextPassword2, 0x11)
-{
- STDMETHOD(CryptoGetTextPassword2)(Int32 *passwordIsDefined, BSTR *password) PURE;
-};
-
-#endif
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IProgress.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IProgress.h
deleted file mode 100644
index d6093f173..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IProgress.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Interface/IProgress.h
-
-#ifndef __IPROGRESS_H
-#define __IPROGRESS_H
-
-#include "../Common/MyUnknown.h"
-#include "../Common/Types.h"
-
-#include "IDecl.h"
-
-#define INTERFACE_IProgress(x) \
- STDMETHOD(SetTotal)(UInt64 total) x; \
- STDMETHOD(SetCompleted)(const UInt64 *completeValue) x; \
-
-DECL_INTERFACE(IProgress, 0, 5)
-{
- INTERFACE_IProgress(PURE)
-};
-
-/*
-// {23170F69-40C1-278A-0000-000000050002}
-DEFINE_GUID(IID_IProgress2,
-0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02);
-MIDL_INTERFACE("23170F69-40C1-278A-0000-000000050002")
-IProgress2: public IUnknown
-{
-public:
- STDMETHOD(SetTotal)(const UInt64 *total) PURE;
- STDMETHOD(SetCompleted)(const UInt64 *completeValue) PURE;
-};
-*/
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IStream.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IStream.h
deleted file mode 100644
index a177a9cb4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/IStream.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// IStream.h
-
-#ifndef __ISTREAM_H
-#define __ISTREAM_H
-
-#include "../Common/MyUnknown.h"
-#include "../Common/Types.h"
-
-#include "IDecl.h"
-
-#define STREAM_INTERFACE_SUB(i, base, x) DECL_INTERFACE_SUB(i, base, 3, x)
-#define STREAM_INTERFACE(i, x) STREAM_INTERFACE_SUB(i, IUnknown, x)
-
-STREAM_INTERFACE(ISequentialInStream, 0x01)
-{
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize) PURE;
- /*
- Out: if size != 0, return_value = S_OK and (*processedSize == 0),
- then there are no more bytes in stream.
- if (size > 0) && there are bytes in stream,
- this function must read at least 1 byte.
- This function is allowed to read less than number of remaining bytes in stream.
- You must call Read function in loop, if you need exact amount of data
- */
-};
-
-STREAM_INTERFACE(ISequentialOutStream, 0x02)
-{
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize) PURE;
- /*
- if (size > 0) this function must write at least 1 byte.
- This function is allowed to write less than "size".
- You must call Write function in loop, if you need to write exact amount of data
- */
-};
-
-STREAM_INTERFACE_SUB(IInStream, ISequentialInStream, 0x03)
-{
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE;
-};
-
-STREAM_INTERFACE_SUB(IOutStream, ISequentialOutStream, 0x04)
-{
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE;
- STDMETHOD(SetSize)(Int64 newSize) PURE;
-};
-
-STREAM_INTERFACE(IStreamGetSize, 0x06)
-{
- STDMETHOD(GetSize)(UInt64 *size) PURE;
-};
-
-STREAM_INTERFACE(IOutStreamFlush, 0x07)
-{
- STDMETHOD(Flush)() PURE;
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/MyVersion.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/MyVersion.h
deleted file mode 100644
index 9e307bb4b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/MyVersion.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#define MY_VER_MAJOR 9
-#define MY_VER_MINOR 04
-#define MY_VER_BUILD 0
-#define MY_VERSION "9.04 beta"
-#define MY_7ZIP_VERSION "7-Zip 9.04 beta"
-#define MY_DATE "2009-05-30"
-#define MY_COPYRIGHT "Copyright (c) 1999-2009 Igor Pavlov"
-#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
-
-#define P7ZIP_VERSION "9.04"
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/PropID.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/PropID.h
deleted file mode 100644
index d6f3a7c1b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/PropID.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// PropID.h
-
-#ifndef __7ZIP_PROPID_H
-#define __7ZIP_PROPID_H
-
-enum
-{
- kpidNoProperty = 0,
- kpidMainSubfile = 1,
- kpidHandlerItemIndex = 2,
- kpidPath,
- kpidName,
- kpidExtension,
- kpidIsDir,
- kpidSize,
- kpidPackSize,
- kpidAttrib,
- kpidCTime,
- kpidATime,
- kpidMTime,
- kpidSolid,
- kpidCommented,
- kpidEncrypted,
- kpidSplitBefore,
- kpidSplitAfter,
- kpidDictionarySize,
- kpidCRC,
- kpidType,
- kpidIsAnti,
- kpidMethod,
- kpidHostOS,
- kpidFileSystem,
- kpidUser,
- kpidGroup,
- kpidBlock,
- kpidComment,
- kpidPosition,
- kpidPrefix,
- kpidNumSubDirs,
- kpidNumSubFiles,
- kpidUnpackVer,
- kpidVolume,
- kpidIsVolume,
- kpidOffset,
- kpidLinks,
- kpidNumBlocks,
- kpidNumVolumes,
- kpidTimeType,
- kpidBit64,
- kpidBigEndian,
- kpidCpu,
- kpidPhySize,
- kpidHeadersSize,
- kpidChecksum,
- kpidCharacts,
- kpidVa,
- kpidId,
- kpidShortName,
- kpidCreatorApp,
- kpidSectorSize,
- kpidPosixAttrib,
- kpidLink,
-
- kpidTotalSize = 0x1100,
- kpidFreeSpace,
- kpidClusterSize,
- kpidVolumeName,
-
- kpidLocalName = 0x1200,
- kpidProvider,
-
- kpidUserDefined = 0x10000
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/Agent.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/Agent.cpp
deleted file mode 100644
index 0b8f7c370..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/Agent.cpp
+++ /dev/null
@@ -1,615 +0,0 @@
-// Agent.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/Sort.h"
-
-#include "Common/ComTry.h"
-
-#include "../Common/ArchiveExtractCallback.h"
-
-#include "Agent.h"
-
-using namespace NWindows;
-
-STDMETHODIMP CAgentFolder::GetAgentFolder(CAgentFolder **agentFolder)
-{
- *agentFolder = this;
- return S_OK;
-}
-
-void CAgentFolder::LoadFolder(CProxyFolder *folder)
-{
- int i;
- CProxyItem item;
- item.Folder = folder;
- for (i = 0; i < folder->Folders.Size(); i++)
- {
- item.Index = i;
- _items.Add(item);
- LoadFolder(&folder->Folders[i]);
- }
- int start = folder->Folders.Size();
- for (i = 0; i < folder->Files.Size(); i++)
- {
- item.Index = start + i;
- _items.Add(item);
- }
-}
-
-STDMETHODIMP CAgentFolder::LoadItems()
-{
- if (!_agentSpec->_archiveLink.IsOpen)
- return E_FAIL;
- _items.Clear();
- if (_flatMode)
- LoadFolder(_proxyFolderItem);
- return S_OK;
-}
-
-STDMETHODIMP CAgentFolder::GetNumberOfItems(UInt32 *numItems)
-{
- if (_flatMode)
- *numItems = _items.Size();
- else
- *numItems = _proxyFolderItem->Folders.Size() +_proxyFolderItem->Files.Size();
- return S_OK;
-}
-
-UString CAgentFolder::GetName(UInt32 index) const
-{
- UInt32 realIndex;
- const CProxyFolder *folder;
- if (_flatMode)
- {
- const CProxyItem &item = _items[index];
- folder = item.Folder;
- realIndex = item.Index;
- }
- else
- {
- folder = _proxyFolderItem;
- realIndex = index;
- }
-
- if (realIndex < (UInt32)folder->Folders.Size())
- return folder->Folders[realIndex].Name;
- return folder->Files[realIndex - folder->Folders.Size()].Name;
-}
-
-UString CAgentFolder::GetPrefix(UInt32 index) const
-{
- if (!_flatMode)
- return UString();
- const CProxyItem &item = _items[index];
- const CProxyFolder *folder = item.Folder;
- UString path;
- while (folder != _proxyFolderItem)
- {
- path = folder->Name + UString(WCHAR_PATH_SEPARATOR) + path;
- folder = folder->Parent;
- }
- return path;
-}
-
-UString CAgentFolder::GetFullPathPrefixPlusPrefix(UInt32 index) const
-{
- return _proxyFolderItem->GetFullPathPrefix() + GetPrefix(index);
-}
-
-void CAgentFolder::GetPrefixIfAny(UInt32 index, NCOM::CPropVariant &prop) const
-{
- if (!_flatMode)
- return;
- prop = GetPrefix(index);
-}
-
-
-STDMETHODIMP CAgentFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
-{
- NCOM::CPropVariant prop;
- const CProxyFolder *folder;
- UInt32 realIndex;
- if (_flatMode)
- {
- const CProxyItem &item = _items[itemIndex];
- folder = item.Folder;
- realIndex = item.Index;
- }
- else
- {
- folder = _proxyFolderItem;
- realIndex = itemIndex;
- }
-
- if (realIndex < (UInt32)folder->Folders.Size())
- {
- const CProxyFolder &item = folder->Folders[realIndex];
- if (!_flatMode && propID == kpidSize)
- prop = item.Size;
- else if (!_flatMode && propID == kpidPackSize)
- prop = item.PackSize;
- else
- switch(propID)
- {
- case kpidIsDir: prop = true; break;
- case kpidNumSubDirs: prop = item.NumSubFolders; break;
- case kpidNumSubFiles: prop = item.NumSubFiles; break;
- case kpidName: prop = item.Name; break;
- case kpidCRC:
- {
- if (item.IsLeaf)
- {
- RINOK(_agentSpec->GetArchive()->GetProperty(item.Index, propID, value));
- }
- if (item.CrcIsDefined && value->vt == VT_EMPTY)
- prop = item.Crc;
- break;
- }
- case kpidPrefix: GetPrefixIfAny(itemIndex, prop); break;
-
- default:
- if (item.IsLeaf)
- return _agentSpec->GetArchive()->GetProperty(item.Index, propID, value);
- }
- }
- else
- {
- realIndex -= folder->Folders.Size();
- const CProxyFile &item = folder->Files[realIndex];
- switch(propID)
- {
- case kpidIsDir: prop = false; break;
- case kpidName: prop = item.Name; break;
- case kpidPrefix: GetPrefixIfAny(itemIndex, prop); break;
- default:
- return _agentSpec->GetArchive()->GetProperty(item.Index, propID, value);
- }
- }
- prop.Detach(value);
- return S_OK;
-}
-
-HRESULT CAgentFolder::BindToFolder(CProxyFolder *folder, IFolderFolder **resultFolder)
-{
- CMyComPtr<IFolderFolder> parentFolder;
- if (folder->Parent != _proxyFolderItem)
- {
- RINOK(BindToFolder(folder->Parent, &parentFolder));
- }
- else
- parentFolder = this;
- CAgentFolder *folderSpec = new CAgentFolder;
- CMyComPtr<IFolderFolder> agentFolder = folderSpec;
- folderSpec->Init(_proxyArchive, folder, parentFolder, _agentSpec);
- *resultFolder = agentFolder.Detach();
- return S_OK;
-}
-
-STDMETHODIMP CAgentFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
-{
- COM_TRY_BEGIN
-
- CProxyFolder *folder;
- UInt32 realIndex;
- if (_flatMode)
- {
- const CProxyItem &item = _items[index];
- folder = item.Folder;
- realIndex = item.Index;
- }
- else
- {
- folder = _proxyFolderItem;
- realIndex = index;
- }
- if (realIndex >= (UInt32)folder->Folders.Size())
- return E_INVALIDARG;
- return BindToFolder(&folder->Folders[realIndex], resultFolder);
- COM_TRY_END
-}
-
-STDMETHODIMP CAgentFolder::BindToFolder(const wchar_t *name, IFolderFolder **resultFolder)
-{
- COM_TRY_BEGIN
- int index = _proxyFolderItem->FindDirSubItemIndex(name);
- if (index < 0)
- return E_INVALIDARG;
- return BindToFolder(index, resultFolder);
- COM_TRY_END
-}
-
-STDMETHODIMP CAgentFolder::BindToParentFolder(IFolderFolder **resultFolder)
-{
- COM_TRY_BEGIN
- CMyComPtr<IFolderFolder> parentFolder = _parentFolder;
- *resultFolder = parentFolder.Detach();
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CAgentFolder::GetStream(UInt32 index, ISequentialInStream **stream)
-{
- CMyComPtr<IInArchiveGetStream> getStream;
- _agentSpec->GetArchive()->QueryInterface(IID_IInArchiveGetStream, (void **)&getStream);
- if (!getStream)
- return S_OK;
-
- const CProxyFolder *folder;
- UInt32 realIndex;
- if (_flatMode)
- {
- const CProxyItem &item = _items[index];
- folder = item.Folder;
- realIndex = item.Index;
- }
- else
- {
- folder = _proxyFolderItem;
- realIndex = index;
- }
-
- UInt32 indexInArchive;
- if (realIndex < (UInt32)folder->Folders.Size())
- {
- const CProxyFolder &item = folder->Folders[realIndex];
- if (!item.IsLeaf)
- return S_OK;
- indexInArchive = item.Index;
- }
- else
- indexInArchive = folder->Files[realIndex - folder->Folders.Size()].Index;
- return getStream->GetStream(indexInArchive, stream);
-}
-
-STATPROPSTG kProperties[] =
-{
- { NULL, kpidNumSubDirs, VT_UI4},
- { NULL, kpidNumSubFiles, VT_UI4},
- { NULL, kpidPrefix, VT_BSTR}
-};
-
-static const UInt32 kNumProperties = sizeof(kProperties) / sizeof(kProperties[0]);
-
-struct CArchiveItemPropertyTemp
-{
- UString Name;
- PROPID ID;
- VARTYPE Type;
-};
-
-STDMETHODIMP CAgentFolder::GetNumberOfProperties(UInt32 *numProperties)
-{
- COM_TRY_BEGIN
- RINOK(_agentSpec->GetArchive()->GetNumberOfProperties(numProperties));
- *numProperties += kNumProperties;
- if (!_flatMode)
- (*numProperties)--;
- if (!_agentSpec->_proxyArchive->ThereIsPathProp)
- (*numProperties)++;
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CAgentFolder::GetPropertyInfo(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType)
-{
- COM_TRY_BEGIN
- UInt32 numProperties;
- _agentSpec->GetArchive()->GetNumberOfProperties(&numProperties);
- if (!_agentSpec->_proxyArchive->ThereIsPathProp)
- {
- if (index == 0)
- {
- *propID = kpidName;
- *varType = VT_BSTR;
- *name = 0;
- return S_OK;
- }
- index--;
- }
-
- if (index < numProperties)
- {
- RINOK(_agentSpec->GetArchive()->GetPropertyInfo(index, name, propID, varType));
- if (*propID == kpidPath)
- *propID = kpidName;
- }
- else
- {
- const STATPROPSTG &srcItem = kProperties[index - numProperties];
- *propID = srcItem.propid;
- *varType = srcItem.vt;
- *name = 0;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STATPROPSTG kFolderProps[] =
-{
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidNumSubDirs, VT_UI4},
- { NULL, kpidNumSubFiles, VT_UI4},
- { NULL, kpidCRC, VT_UI4}
-};
-
-static const UInt32 kNumFolderProps = sizeof(kFolderProps) / sizeof(kFolderProps[0]);
-
-STDMETHODIMP CAgentFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidSize: prop = _proxyFolderItem->Size; break;
- case kpidPackSize: prop = _proxyFolderItem->PackSize; break;
- case kpidNumSubDirs: prop = _proxyFolderItem->NumSubFolders; break;
- case kpidNumSubFiles: prop = _proxyFolderItem->NumSubFiles; break;
- case kpidName: prop = _proxyFolderItem->Name; break;
- case kpidPath: prop = _proxyFolderItem->GetFullPathPrefix(); break;
- case kpidType: prop = UString(L"7-Zip.") + _agentSpec->ArchiveType; break;
- case kpidCRC: if (_proxyFolderItem->CrcIsDefined) prop = _proxyFolderItem->Crc; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CAgentFolder::GetNumberOfFolderProperties(UInt32 *numProperties)
-{
- *numProperties = kNumFolderProps;
- return S_OK;
-}
-
-STDMETHODIMP CAgentFolder::GetFolderPropertyInfo(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType)
-{
- // if (index < kNumFolderProps)
- {
- const STATPROPSTG &srcItem = kFolderProps[index];
- *propID = srcItem.propid;
- *varType = srcItem.vt;
- *name = 0;
- return S_OK;
- }
-}
-
-STDMETHODIMP CAgentFolder::GetFolderArchiveProperties(IFolderArchiveProperties **object)
-{
- CMyComPtr<IFolderArchiveProperties> temp = _agentSpec;
- *object = temp.Detach();
- return S_OK;
-}
-
-#ifdef NEW_FOLDER_INTERFACE
-
-STDMETHODIMP CAgentFolder::SetFlatMode(Int32 flatMode)
-{
- _flatMode = IntToBool(flatMode);
- return S_OK;
-}
-
-#endif
-
-void CAgentFolder::GetRealIndices(const UInt32 *indices, UInt32 numItems, CUIntVector &realIndices) const
-{
- if (!_flatMode)
- {
- _proxyFolderItem->GetRealIndices(indices, numItems, realIndices);
- return;
- }
- realIndices.Clear();
- for(UInt32 i = 0; i < numItems; i++)
- {
- const CProxyItem &item = _items[indices[i]];
- const CProxyFolder *folder = item.Folder;
- UInt32 realIndex = item.Index;
- if (realIndex < (UInt32)folder->Folders.Size())
- continue;
- realIndices.Add(folder->Files[realIndex - folder->Folders.Size()].Index);
- }
- HeapSort(&realIndices.Front(), realIndices.Size());
-}
-
-STDMETHODIMP CAgentFolder::Extract(const UInt32 *indices,
- UInt32 numItems,
- NExtract::NPathMode::EEnum pathMode,
- NExtract::NOverwriteMode::EEnum overwriteMode,
- const wchar_t *path,
- Int32 testMode,
- IFolderArchiveExtractCallback *extractCallback2)
-{
- COM_TRY_BEGIN
- CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback;
- CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
- UStringVector pathParts;
- CProxyFolder *currentProxyFolder = _proxyFolderItem;
- while (currentProxyFolder->Parent)
- {
- pathParts.Insert(0, currentProxyFolder->Name);
- currentProxyFolder = currentProxyFolder->Parent;
- }
-
- /*
- if (_flatMode)
- pathMode = NExtract::NPathMode::kNoPathnames;
- */
-
- extractCallbackSpec->InitForMulti(false, pathMode, overwriteMode);
-
- extractCallbackSpec->Init(NULL, &_agentSpec->GetArc(),
- extractCallback2,
- false, testMode ? true : false, false,
- (path ? path : L""),
- pathParts,
- (UInt64)(Int64)-1);
- CUIntVector realIndices;
- GetRealIndices(indices, numItems, realIndices);
- return _agentSpec->GetArchive()->Extract(&realIndices.Front(),
- realIndices.Size(), testMode, extractCallback);
- COM_TRY_END
-}
-
-/////////////////////////////////////////
-// CAgent
-
-CAgent::CAgent():
- _proxyArchive(NULL),
- _codecs(0)
-{
-}
-
-CAgent::~CAgent()
-{
- if (_proxyArchive != NULL)
- delete _proxyArchive;
-}
-
-STDMETHODIMP CAgent::Open(
- IInStream *inStream,
- const wchar_t *filePath,
- BSTR *archiveType,
- IArchiveOpenCallback *openArchiveCallback)
-{
- COM_TRY_BEGIN
- _archiveFilePath = filePath;
- NFile::NFind::CFileInfoW fi;
- if (!inStream)
- {
- if (!fi.Find(_archiveFilePath))
- return ::GetLastError();
- if (fi.IsDir())
- return E_FAIL;
- }
- CArcInfoEx archiverInfo0, archiverInfo1;
-
- _compressCodecsInfo.Release();
- _codecs = new CCodecs;
- _compressCodecsInfo = _codecs;
- RINOK(_codecs->Load());
-
- RINOK(_archiveLink.Open(_codecs, CIntVector(), false, inStream, _archiveFilePath, openArchiveCallback));
-
- CArc &arc = _archiveLink.Arcs.Back();
- if (!inStream)
- {
- arc.MTimeDefined = !fi.IsDevice;
- arc.MTime = fi.MTime;
- }
-
- ArchiveType = _codecs->Formats[arc.FormatIndex].Name;
- if (archiveType == 0)
- return S_OK;
- return StringToBstr(ArchiveType, archiveType);
- COM_TRY_END
-}
-
-STDMETHODIMP CAgent::ReOpen(IArchiveOpenCallback *openArchiveCallback)
-{
- COM_TRY_BEGIN
- if (_proxyArchive != NULL)
- {
- delete _proxyArchive;
- _proxyArchive = NULL;
- }
- RINOK(_archiveLink.ReOpen(_codecs, _archiveFilePath, openArchiveCallback));
- return ReadItems();
- COM_TRY_END
-}
-
-STDMETHODIMP CAgent::Close()
-{
- COM_TRY_BEGIN
- return _archiveLink.Close();
- COM_TRY_END
-}
-
-/*
-STDMETHODIMP CAgent::EnumProperties(IEnumSTATPROPSTG **EnumProperties)
-{
- return _archive->EnumProperties(EnumProperties);
-}
-*/
-
-HRESULT CAgent::ReadItems()
-{
- if (_proxyArchive != NULL)
- return S_OK;
- _proxyArchive = new CProxyArchive();
- return _proxyArchive->Load(GetArc(), NULL);
-}
-
-STDMETHODIMP CAgent::BindToRootFolder(IFolderFolder **resultFolder)
-{
- COM_TRY_BEGIN
- RINOK(ReadItems());
- CAgentFolder *folderSpec = new CAgentFolder;
- CMyComPtr<IFolderFolder> rootFolder = folderSpec;
- folderSpec->Init(_proxyArchive, &_proxyArchive->RootFolder, NULL, this);
- *resultFolder = rootFolder.Detach();
- return S_OK;
- COM_TRY_END
-}
-
-
-STDMETHODIMP CAgent::Extract(
- NExtract::NPathMode::EEnum pathMode,
- NExtract::NOverwriteMode::EEnum overwriteMode,
- const wchar_t *path,
- Int32 testMode,
- IFolderArchiveExtractCallback *extractCallback2)
-{
- COM_TRY_BEGIN
- CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback;
- CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
- extractCallbackSpec->InitForMulti(false, pathMode, overwriteMode);
- extractCallbackSpec->Init(NULL, &GetArc(),
- extractCallback2,
- false, testMode ? true : false, false,
- path,
- UStringVector(),
- (UInt64)(Int64)-1);
- return GetArchive()->Extract(0, (UInt32)(Int32)-1, testMode, extractCallback);
- COM_TRY_END
-}
-
-STDMETHODIMP CAgent::GetNumberOfProperties(UInt32 *numProperties)
-{
- COM_TRY_BEGIN
- return GetArchive()->GetNumberOfProperties(numProperties);
- COM_TRY_END
-}
-
-STDMETHODIMP CAgent::GetPropertyInfo(UInt32 index,
- BSTR *name, PROPID *propID, VARTYPE *varType)
-{
- COM_TRY_BEGIN
- RINOK(GetArchive()->GetPropertyInfo(index, name, propID, varType));
- if (*propID == kpidPath)
- *propID = kpidName;
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CAgent::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- return GetArchive()->GetArchiveProperty(propID, value);
- COM_TRY_END
-}
-
-STDMETHODIMP CAgent::GetNumberOfArchiveProperties(UInt32 *numProperties)
-{
- COM_TRY_BEGIN
- return GetArchive()->GetNumberOfArchiveProperties(numProperties);
- COM_TRY_END
-}
-
-STDMETHODIMP CAgent::GetArchivePropertyInfo(UInt32 index,
- BSTR *name, PROPID *propID, VARTYPE *varType)
-{
- COM_TRY_BEGIN
- return GetArchive()->GetArchivePropertyInfo(index,
- name, propID, varType);
- COM_TRY_END
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/Agent.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/Agent.h
deleted file mode 100644
index b95725e49..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/Agent.h
+++ /dev/null
@@ -1,232 +0,0 @@
-// Agent/Agent.h
-
-#ifndef __AGENT_AGENT_H
-#define __AGENT_AGENT_H
-
-#include "Common/MyCom.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../Common/OpenArchive.h"
-#include "../Common/UpdateAction.h"
-
-#ifdef NEW_FOLDER_INTERFACE
-#include "../FileManager/IFolder.h"
-#include "../Common/LoadCodecs.h"
-#endif
-
-#include "AgentProxy.h"
-#include "IFolderArchive.h"
-
-class CAgentFolder;
-
-DECL_INTERFACE(IArchiveFolderInternal, 0x01, 0xC)
-{
- STDMETHOD(GetAgentFolder)(CAgentFolder **agentFolder) PURE;
-};
-
-struct CProxyItem
-{
- CProxyFolder *Folder;
- UInt32 Index;
-};
-
-class CAgent;
-
-class CAgentFolder:
- public IFolderFolder,
- public IFolderProperties,
- public IGetFolderArchiveProperties,
- public IArchiveFolder,
- public IArchiveFolderInternal,
- public IInArchiveGetStream,
-#ifdef NEW_FOLDER_INTERFACE
- public IFolderOperations,
- public IFolderSetFlatMode,
-#endif
- public CMyUnknownImp
-{
-public:
-
- MY_QUERYINTERFACE_BEGIN
- MY_QUERYINTERFACE_ENTRY(IFolderFolder)
- MY_QUERYINTERFACE_ENTRY(IFolderProperties)
- MY_QUERYINTERFACE_ENTRY(IGetFolderArchiveProperties)
- MY_QUERYINTERFACE_ENTRY(IArchiveFolder)
- MY_QUERYINTERFACE_ENTRY(IArchiveFolderInternal)
- MY_QUERYINTERFACE_ENTRY(IInArchiveGetStream)
- #ifdef NEW_FOLDER_INTERFACE
- MY_QUERYINTERFACE_ENTRY(IFolderOperations)
- MY_QUERYINTERFACE_ENTRY(IFolderSetFlatMode)
- #endif
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
- void LoadFolder(CProxyFolder *folder);
- HRESULT BindToFolder(CProxyFolder *folder, IFolderFolder **resultFolder);
- void GetRealIndices(const UINT32 *indices, UINT32 numItems, CUIntVector &realIndices) const;
-
- INTERFACE_FolderFolder(;)
- INTERFACE_FolderProperties(;)
-
- STDMETHOD(GetFolderArchiveProperties)(IFolderArchiveProperties **object);
-
- // IArchiveFolder
- STDMETHOD(Extract)(const UINT32 *indices, UINT32 numItems,
- NExtract::NPathMode::EEnum pathMode,
- NExtract::NOverwriteMode::EEnum overwriteMode,
- const wchar_t *path,
- Int32 testMode,
- IFolderArchiveExtractCallback *extractCallback);
-
- STDMETHOD(GetAgentFolder)(CAgentFolder **agentFolder);
-
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream);
-
- #ifdef NEW_FOLDER_INTERFACE
- INTERFACE_FolderOperations(;)
-
- STDMETHOD(SetFlatMode)(Int32 flatMode);
- #endif
-
- CAgentFolder(): _proxyFolderItem(NULL), _flatMode(0) {}
-
- void Init(CProxyArchive *proxyHandler,
- CProxyFolder *proxyFolderItem,
- IFolderFolder *parentFolder,
- CAgent *agent)
- {
- _proxyArchive = proxyHandler;
- _proxyFolderItem = proxyFolderItem;
- _parentFolder = parentFolder;
- _agent = (IInFolderArchive *)agent;
- _agentSpec = agent;
- }
-
- void GetPathParts(UStringVector &pathParts);
- HRESULT CommonUpdateOperation(
- bool deleteOperation,
- bool createFolderOperation,
- bool renameOperation,
- const wchar_t *newItemName,
- const NUpdateArchive::CActionSet *actionSet,
- const UINT32 *indices, UINT32 numItems,
- IFolderArchiveUpdateCallback *updateCallback100);
-
-
- UString GetPrefix(UInt32 index) const;
- UString GetName(UInt32 index) const;
- UString GetFullPathPrefixPlusPrefix(UInt32 index) const;
- void GetPrefixIfAny(UInt32 index, NWindows::NCOM::CPropVariant &propVariant) const;
-
-public:
- CProxyArchive *_proxyArchive;
- CProxyFolder *_proxyFolderItem;
- CMyComPtr<IFolderFolder> _parentFolder;
- CMyComPtr<IInFolderArchive> _agent;
- CAgent *_agentSpec;
-
- CRecordVector<CProxyItem> _items;
- bool _flatMode;
-private:
-};
-
-class CAgent:
- public IInFolderArchive,
- public IFolderArchiveProperties,
- #ifndef EXTRACT_ONLY
- public IOutFolderArchive,
- public ISetProperties,
- #endif
- public CMyUnknownImp
-{
-public:
-
- MY_QUERYINTERFACE_BEGIN
- MY_QUERYINTERFACE_ENTRY(IInFolderArchive)
- MY_QUERYINTERFACE_ENTRY(IFolderArchiveProperties)
- #ifndef EXTRACT_ONLY
- MY_QUERYINTERFACE_ENTRY(IOutFolderArchive)
- MY_QUERYINTERFACE_ENTRY(ISetProperties)
- #endif
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
- INTERFACE_IInFolderArchive(;)
- INTERFACE_IFolderArchiveProperties(;)
-
- #ifndef EXTRACT_ONLY
- INTERFACE_IOutFolderArchive(;)
-
- HRESULT CommonUpdate(
- const wchar_t *newArchiveName,
- int numUpdateItems,
- IArchiveUpdateCallback *updateCallback);
-
- HRESULT CreateFolder(
- const wchar_t *newArchiveName,
- const wchar_t *folderName,
- IFolderArchiveUpdateCallback *updateCallback100);
-
- HRESULT RenameItem(
- const wchar_t *newArchiveName,
- const UINT32 *indices, UINT32 numItems,
- const wchar_t *newItemName,
- IFolderArchiveUpdateCallback *updateCallback100);
-
- // ISetProperties
- STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties);
- #endif
-
- CCodecs *_codecs;
- CMyComPtr<ICompressCodecsInfo> _compressCodecsInfo;
-
- CAgent();
- ~CAgent();
-private:
- HRESULT ReadItems();
-public:
- CProxyArchive *_proxyArchive;
- CArchiveLink _archiveLink;
-
-
- UString ArchiveType;
-
- UStringVector _names;
- UString _folderPrefix;
-
- UString _archiveNamePrefix;
- CAgentFolder *_agentFolder;
-
- UString _archiveFilePath;
-
- #ifndef EXTRACT_ONLY
- CObjectVector<UString> m_PropNames;
- CObjectVector<NWindows::NCOM::CPropVariant> m_PropValues;
- #endif
-
- const CArc &GetArc() { return _archiveLink.Arcs.Back(); }
- IInArchive *GetArchive() { return GetArc().Archive; }
- bool CanUpdate() const { return _archiveLink.Arcs.Size() == 1; }
-};
-
-#ifdef NEW_FOLDER_INTERFACE
-class CArchiveFolderManager:
- public IFolderManager,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(IFolderManager)
-
- INTERFACE_IFolderManager(;)
-
- CArchiveFolderManager(): _codecs(0) {}
-private:
- void LoadFormats();
- int FindFormat(const UString &type);
- CCodecs *_codecs;
- CMyComPtr<ICompressCodecsInfo> _compressCodecsInfo;
-};
-#endif
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/AgentOut.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/AgentOut.cpp
deleted file mode 100644
index 51a5affa1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/AgentOut.cpp
+++ /dev/null
@@ -1,535 +0,0 @@
-// AgentOut.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/Defs.h"
-#include "Windows/FileDir.h"
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-#include "Windows/Time.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "../../Common/FileStreams.h"
-
-#include "../Common/EnumDirItems.h"
-#include "../Common/HandlerLoader.h"
-#include "../Common/OpenArchive.h"
-#include "../Common/UpdateCallback.h"
-#include "../Common/UpdatePair.h"
-
-#include "Agent.h"
-#include "UpdateCallbackAgent.h"
-
-using namespace NWindows;
-using namespace NCOM;
-
-STDMETHODIMP CAgent::SetFolder(IFolderFolder *folder)
-{
- _archiveNamePrefix.Empty();
- if (folder == NULL)
- {
- _agentFolder = NULL;
- return S_OK;
- }
- else
- {
- CMyComPtr<IFolderFolder> archiveFolder = folder;
- CMyComPtr<IArchiveFolderInternal> archiveFolderInternal;
- RINOK(archiveFolder.QueryInterface(IID_IArchiveFolderInternal, &archiveFolderInternal));
- RINOK(archiveFolderInternal->GetAgentFolder(&_agentFolder));
- }
-
- UStringVector pathParts;
- pathParts.Clear();
- CMyComPtr<IFolderFolder> folderItem = folder;
- if (folderItem != NULL)
- for (;;)
- {
- CMyComPtr<IFolderFolder> newFolder;
- folderItem->BindToParentFolder(&newFolder);
- if (newFolder == NULL)
- break;
-
- NCOM::CPropVariant prop;
- if (folderItem->GetFolderProperty(kpidName, &prop) == S_OK)
- if (prop.vt == VT_BSTR)
- pathParts.Insert(0, (const wchar_t *)prop.bstrVal);
- folderItem = newFolder;
- }
-
- for (int i = 0; i < pathParts.Size(); i++)
- {
- _archiveNamePrefix += pathParts[i];
- _archiveNamePrefix += WCHAR_PATH_SEPARATOR;
- }
- return S_OK;
-}
-
-STDMETHODIMP CAgent::SetFiles(const wchar_t *folderPrefix,
- const wchar_t **names, UInt32 numNames)
-{
- _folderPrefix = folderPrefix;
- _names.Clear();
- _names.Reserve(numNames);
- for (UInt32 i = 0; i < numNames; i++)
- _names.Add(names[i]);
- return S_OK;
-}
-
-static HRESULT EnumerateArchiveItems(CAgent *agent,
- const CProxyFolder &item,
- const UString &prefix,
- CObjectVector<CArcItem> &arcItems)
-{
- int i;
- for (i = 0; i < item.Files.Size(); i++)
- {
- const CProxyFile &fileItem = item.Files[i];
- CArcItem ai;
- RINOK(agent->GetArc().GetItemMTime(fileItem.Index, ai.MTime, ai.MTimeDefined));
-
- CPropVariant property;
- agent->GetArchive()->GetProperty(fileItem.Index, kpidSize, &property);
- ai.SizeDefined = (property.vt != VT_EMPTY);
- if (ai.SizeDefined)
- ai.Size = ConvertPropVariantToUInt64(property);
- ai.IsDir = false;
- ai.Name = prefix + fileItem.Name;
- ai.Censored = true; // test it
- ai.IndexInServer = fileItem.Index;
- arcItems.Add(ai);
- }
- for (i = 0; i < item.Folders.Size(); i++)
- {
- const CProxyFolder &dirItem = item.Folders[i];
- UString fullName = prefix + dirItem.Name;
- if (dirItem.IsLeaf)
- {
- CArcItem ai;
- RINOK(agent->GetArc().GetItemMTime(dirItem.Index, ai.MTime, ai.MTimeDefined));
- ai.IsDir = true;
- ai.SizeDefined = false;
- ai.Name = fullName;
- ai.Censored = true; // test it
- ai.IndexInServer = dirItem.Index;
- arcItems.Add(ai);
- }
- RINOK(EnumerateArchiveItems(agent, dirItem, fullName + UString(WCHAR_PATH_SEPARATOR), arcItems));
- }
- return S_OK;
-}
-
-struct CAgUpCallbackImp: public IUpdateProduceCallback
-{
- const CObjectVector<CArcItem> *_arcItems;
- IFolderArchiveUpdateCallback *_callback;
-
- CAgUpCallbackImp(const CObjectVector<CArcItem> *a,
- IFolderArchiveUpdateCallback *callback): _arcItems(a), _callback(callback) {}
- HRESULT ShowDeleteFile(int arcIndex);
-};
-
-HRESULT CAgUpCallbackImp::ShowDeleteFile(int arcIndex)
-{
- return _callback->DeleteOperation((*_arcItems)[arcIndex].Name);
-}
-
-STDMETHODIMP CAgent::DoOperation(
- CCodecs *codecs,
- int formatIndex,
- const wchar_t *newArchiveName,
- const Byte *stateActions,
- const wchar_t *sfxModule,
- IFolderArchiveUpdateCallback *updateCallback100)
-{
- if (!CanUpdate())
- return E_NOTIMPL;
- NUpdateArchive::CActionSet actionSet;
- int i;
- for (i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
- actionSet.StateActions[i] = (NUpdateArchive::NPairAction::EEnum)stateActions[i];
-
- CDirItems dirItems;
-
- {
- UString folderPrefix = _folderPrefix;
- NFile::NName::NormalizeDirPathPrefix(folderPrefix);
- UStringVector errorPaths;
- CRecordVector<DWORD> errorCodes;
- dirItems.EnumerateDirItems2(folderPrefix, _archiveNamePrefix, _names, errorPaths, errorCodes);
- if (errorCodes.Size() > 0)
- return errorCodes.Front();
- }
-
- CMyComPtr<IOutArchive> outArchive;
- if (GetArchive())
- {
- RINOK(GetArchive()->QueryInterface(IID_IOutArchive, (void **)&outArchive));
- }
- else
- {
- if (formatIndex < 0)
- return E_FAIL;
- RINOK(codecs->CreateOutArchive(formatIndex, outArchive));
- #ifdef EXTERNAL_CODECS
- {
- CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
- outArchive.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
- if (setCompressCodecsInfo)
- {
- RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecs));
- }
- }
- #endif
-
- }
-
- NFileTimeType::EEnum fileTimeType;
- UInt32 value;
- RINOK(outArchive->GetFileTimeType(&value));
-
- switch(value)
- {
- case NFileTimeType::kWindows:
- case NFileTimeType::kDOS:
- case NFileTimeType::kUnix:
- fileTimeType = NFileTimeType::EEnum(value);
- break;
- default:
- return E_FAIL;
- }
-
-
- CObjectVector<CArcItem> arcItems;
- if (GetArchive())
- {
- RINOK(ReadItems());
- EnumerateArchiveItems(this, _proxyArchive->RootFolder, L"", arcItems);
- }
-
- CRecordVector<CUpdatePair2> updatePairs2;
-
- {
- CRecordVector<CUpdatePair> updatePairs;
- GetUpdatePairInfoList(dirItems, arcItems, fileTimeType, updatePairs);
- CAgUpCallbackImp upCallback(&arcItems, updateCallback100);
- UpdateProduce(updatePairs, actionSet, updatePairs2, &upCallback);
- }
-
- UInt32 numFiles = 0;
- for (i = 0; i < updatePairs2.Size(); i++)
- if (updatePairs2[i].NewData)
- numFiles++;
-
- if (updateCallback100)
- {
- RINOK(updateCallback100->SetNumFiles(numFiles));
- }
-
- CUpdateCallbackAgent updateCallbackAgent;
- updateCallbackAgent.SetCallback(updateCallback100);
- CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
- CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec );
-
- updateCallbackSpec->DirItems = &dirItems;
- updateCallbackSpec->ArcItems = &arcItems;
- updateCallbackSpec->UpdatePairs = &updatePairs2;
- updateCallbackSpec->Archive = GetArchive();
- updateCallbackSpec->Callback = &updateCallbackAgent;
-
- COutFileStream *outStreamSpec = new COutFileStream;
- CMyComPtr<IOutStream> outStream(outStreamSpec);
- UString archiveName = newArchiveName;
- {
- UString resultPath;
- int pos;
- if (!NFile::NDirectory::MyGetFullPathName(archiveName, resultPath, pos))
- return E_FAIL;
- NFile::NDirectory::CreateComplexDirectory(resultPath.Left(pos));
- }
- if (!outStreamSpec->Create(archiveName, true))
- {
- // ShowLastErrorMessage();
- return E_FAIL;
- }
-
- CMyComPtr<ISetProperties> setProperties;
- if (outArchive->QueryInterface(IID_ISetProperties, (void **)&setProperties) == S_OK)
- {
- if (m_PropNames.Size() == 0)
- {
- RINOK(setProperties->SetProperties(0, 0, 0));
- }
- else
- {
- CRecordVector<const wchar_t *> names;
- for(i = 0; i < m_PropNames.Size(); i++)
- names.Add((const wchar_t *)m_PropNames[i]);
-
- NWindows::NCOM::CPropVariant *propValues = new NWindows::NCOM::CPropVariant[m_PropValues.Size()];
- try
- {
- for (int i = 0; i < m_PropValues.Size(); i++)
- propValues[i] = m_PropValues[i];
- RINOK(setProperties->SetProperties(&names.Front(), propValues, names.Size()));
- }
- catch(...)
- {
- delete []propValues;
- return E_FAIL;
- }
- delete []propValues;
- }
- }
- m_PropNames.Clear();
- m_PropValues.Clear();
-
- if (sfxModule != NULL)
- {
- CInFileStream *sfxStreamSpec = new CInFileStream;
- CMyComPtr<IInStream> sfxStream(sfxStreamSpec);
- if (!sfxStreamSpec->Open(sfxModule))
- return E_FAIL;
- // throw "Can't open sfx module";
- RINOK(NCompress::CopyStream(sfxStream, outStream, NULL));
- }
-
- RINOK(outArchive->UpdateItems(outStream, updatePairs2.Size(),updateCallback));
- return outStreamSpec->Close();
-}
-
-STDMETHODIMP CAgent::DoOperation2(
- const wchar_t *newArchiveName,
- const Byte *stateActions,
- const wchar_t *sfxModule,
- IFolderArchiveUpdateCallback *updateCallback100)
-{
- return DoOperation(_codecs, -1, newArchiveName,
- stateActions, sfxModule, updateCallback100);
-}
-
-HRESULT CAgent::CommonUpdate(
- const wchar_t *newArchiveName,
- int numUpdateItems,
- IArchiveUpdateCallback *updateCallback)
-{
- if (!CanUpdate())
- return E_NOTIMPL;
- CMyComPtr<IOutArchive> outArchive;
- RINOK(GetArchive()->QueryInterface(IID_IOutArchive, (void **)&outArchive));
-
- COutFileStream *outStreamSpec = new COutFileStream;
- CMyComPtr<IOutStream> outStream(outStreamSpec);
-
- UString archiveName = newArchiveName;
- {
- UString resultPath;
- int pos;
- if (!NFile::NDirectory::MyGetFullPathName(archiveName, resultPath, pos))
- throw 141716;
- NFile::NDirectory::CreateComplexDirectory(resultPath.Left(pos));
- }
-
- /*
- bool isOK = false;
- for (int i = 0; i < (1 << 16); i++)
- {
- resultName = newArchiveName;
- if (i > 0)
- {
- wchar_t s[16];
- ConvertUInt32ToString(i, s);
- resultName += s;
- }
- if (outStreamSpec->Open(realPath))
- {
- isOK = true;
- break;
- }
- if (::GetLastError() != ERROR_FILE_EXISTS)
- return ::GetLastError();
- }
- if (!isOK)
- return ::GetLastError();
- */
- if (!outStreamSpec->Create(archiveName, true))
- {
- // ShowLastErrorMessage();
- return E_FAIL;
- }
-
- RINOK(outArchive->UpdateItems(outStream, numUpdateItems, updateCallback));
- return outStreamSpec->Close();
-}
-
-
-STDMETHODIMP CAgent::DeleteItems(
- const wchar_t *newArchiveName,
- const UInt32 *indices, UInt32 numItems,
- IFolderArchiveUpdateCallback *updateCallback100)
-{
- if (!CanUpdate())
- return E_NOTIMPL;
- CUpdateCallbackAgent updateCallbackAgent;
- updateCallbackAgent.SetCallback(updateCallback100);
- CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
- CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec);
-
- CUIntVector realIndices;
- _agentFolder->GetRealIndices(indices, numItems, realIndices);
- CRecordVector<CUpdatePair2> updatePairs;
- int curIndex = 0;
- UInt32 numItemsInArchive;
- RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive));
- for (UInt32 i = 0; i < numItemsInArchive; i++)
- {
- if (curIndex < realIndices.Size())
- if (realIndices[curIndex] == i)
- {
- curIndex++;
- continue;
- }
- CUpdatePair2 up2;
- up2.NewData = up2.NewProps = false;
- up2.IsAnti = false; // check it. Maybe it can be undefined
- up2.ArcIndex = i;
- updatePairs.Add(up2);
- }
- updateCallbackSpec->UpdatePairs = &updatePairs;
- updateCallbackSpec->Archive = GetArchive();
- updateCallbackSpec->Callback = &updateCallbackAgent;
- return CommonUpdate(newArchiveName, updatePairs.Size(), updateCallback);
-}
-
-HRESULT CAgent::CreateFolder(
- const wchar_t *newArchiveName,
- const wchar_t *folderName,
- IFolderArchiveUpdateCallback *updateCallback100)
-{
- if (!CanUpdate())
- return E_NOTIMPL;
- CUpdateCallbackAgent updateCallbackAgent;
- updateCallbackAgent.SetCallback(updateCallback100);
- CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
- CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec);
-
- CRecordVector<CUpdatePair2> updatePairs;
- UInt32 numItemsInArchive;
- RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive));
- for (UInt32 i = 0; i < numItemsInArchive; i++)
- {
- CUpdatePair2 up2;
- up2.NewData = up2.NewProps = false;
- up2.IsAnti = false; // check it.
- up2.ArcIndex = i;
- updatePairs.Add(up2);
- }
- CUpdatePair2 up2;
- up2.NewData = up2.NewProps = true;
- up2.IsAnti = false;
- up2.DirIndex = 0;
-
- updatePairs.Add(up2);
-
- updatePairs.ReserveDown();
-
- CDirItems dirItems;
- CDirItem di;
-
- di.Attrib = FILE_ATTRIBUTE_DIRECTORY;
- di.Size = 0;
- di.Name = _agentFolder->_proxyFolderItem->GetFullPathPrefix() + folderName;
-
- FILETIME ft;
- NTime::GetCurUtcFileTime(ft);
- di.CTime = di.ATime = di.MTime = ft;
-
- dirItems.Items.Add(di);
-
- updateCallbackSpec->Callback = &updateCallbackAgent;
- updateCallbackSpec->DirItems = &dirItems;
- updateCallbackSpec->UpdatePairs = &updatePairs;
- updateCallbackSpec->Archive = GetArchive();
- return CommonUpdate(newArchiveName, updatePairs.Size(), updateCallback);
-}
-
-
-HRESULT CAgent::RenameItem(
- const wchar_t *newArchiveName,
- const UInt32 *indices, UInt32 numItems,
- const wchar_t *newItemName,
- IFolderArchiveUpdateCallback *updateCallback100)
-{
- if (!CanUpdate())
- return E_NOTIMPL;
- if (numItems != 1)
- return E_INVALIDARG;
- CUpdateCallbackAgent updateCallbackAgent;
- updateCallbackAgent.SetCallback(updateCallback100);
- CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
- CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec);
-
- CUIntVector realIndices;
- _agentFolder->GetRealIndices(indices, numItems, realIndices);
-
- UString fullPrefix = _agentFolder->GetFullPathPrefixPlusPrefix(indices[0]);
- UString oldItemPath = fullPrefix + _agentFolder->GetName(indices[0]);
- UString newItemPath = fullPrefix + newItemName;
-
- CRecordVector<CUpdatePair2> updatePairs;
- UStringVector newNames;
-
- int curIndex = 0;
- UInt32 numItemsInArchive;
- RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive));
- for (UInt32 i = 0; i < numItemsInArchive; i++)
- {
- if (curIndex < realIndices.Size())
- if (realIndices[curIndex] == i)
- {
- CUpdatePair2 up2;
- up2.NewData = false;
- up2.NewProps = true;
- RINOK(GetArc().IsItemAnti(i, up2.IsAnti));
- up2.ArcIndex = i;
-
- UString oldFullPath;
- RINOK(GetArc().GetItemPath(i, oldFullPath));
-
- if (oldItemPath.CompareNoCase(oldFullPath.Left(oldItemPath.Length())) != 0)
- return E_INVALIDARG;
-
- up2.NewNameIndex = newNames.Add(newItemPath + oldFullPath.Mid(oldItemPath.Length()));
- updatePairs.Add(up2);
- curIndex++;
- continue;
- }
- CUpdatePair2 up2;
- up2.NewData = up2.NewProps = false;
- up2.IsAnti = false;
- up2.ArcIndex = i;
- updatePairs.Add(up2);
- }
- updateCallbackSpec->Callback = &updateCallbackAgent;
- updateCallbackSpec->UpdatePairs = &updatePairs;
- updateCallbackSpec->NewNames = &newNames;
- updateCallbackSpec->Archive = GetArchive();
- return CommonUpdate(newArchiveName, updatePairs.Size(), updateCallback);
-}
-
-STDMETHODIMP CAgent::SetProperties(const wchar_t **names,
- const PROPVARIANT *values, Int32 numProperties)
-{
- m_PropNames.Clear();
- m_PropValues.Clear();
- for (int i = 0; i < numProperties; i++)
- {
- m_PropNames.Add(names[i]);
- m_PropValues.Add(values[i]);
- }
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/AgentProxy.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/AgentProxy.cpp
deleted file mode 100644
index 9686cf345..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/AgentProxy.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-// AgentProxy.cpp
-
-#include "StdAfx.h"
-
-#include "../../../../C/Sort.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "../Common/OpenArchive.h"
-
-#include "AgentProxy.h"
-
-using namespace NWindows;
-
-int CProxyFolder::FindDirSubItemIndex(const UString &name, int &insertPos) const
-{
- int left = 0, right = Folders.Size();
- for (;;)
- {
- if (left == right)
- {
- insertPos = left;
- return -1;
- }
- int mid = (left + right) / 2;
- int compare = name.CompareNoCase(Folders[mid].Name);
- if (compare == 0)
- return mid;
- if (compare < 0)
- right = mid;
- else
- left = mid + 1;
- }
-}
-
-int CProxyFolder::FindDirSubItemIndex(const UString &name) const
-{
- int insertPos;
- return FindDirSubItemIndex(name, insertPos);
-}
-
-void CProxyFolder::AddFileSubItem(UInt32 index, const UString &name)
-{
- Files.Add(CProxyFile());
- Files.Back().Name = name;
- Files.Back().Index = index;
-}
-
-CProxyFolder* CProxyFolder::AddDirSubItem(UInt32 index, bool leaf, const UString &name)
-{
- int insertPos;
- int folderIndex = FindDirSubItemIndex(name, insertPos);
- if (folderIndex >= 0)
- {
- CProxyFolder *item = &Folders[folderIndex];
- if (leaf)
- {
- item->Index = index;
- item->IsLeaf = true;
- }
- return item;
- }
- Folders.Insert(insertPos, CProxyFolder());
- CProxyFolder *item = &Folders[insertPos];
- item->Name = name;
- item->Index = index;
- item->Parent = this;
- item->IsLeaf = leaf;
- return item;
-}
-
-void CProxyFolder::Clear()
-{
- Folders.Clear();
- Files.Clear();
-}
-
-void CProxyFolder::GetPathParts(UStringVector &pathParts) const
-{
- pathParts.Clear();
- UString result;
- const CProxyFolder *current = this;
- while (current->Parent != NULL)
- {
- pathParts.Insert(0, (const wchar_t *)current->Name);
- current = current->Parent;
- }
-}
-
-UString CProxyFolder::GetFullPathPrefix() const
-{
- UString result;
- const CProxyFolder *current = this;
- while (current->Parent != NULL)
- {
- result = current->Name + UString(WCHAR_PATH_SEPARATOR) + result;
- current = current->Parent;
- }
- return result;
-}
-
-UString CProxyFolder::GetItemName(UInt32 index) const
-{
- if (index < (UInt32)Folders.Size())
- return Folders[index].Name;
- return Files[index - Folders.Size()].Name;
-}
-
-void CProxyFolder::AddRealIndices(CUIntVector &realIndices) const
-{
- if (IsLeaf)
- realIndices.Add(Index);
- int i;
- for (i = 0; i < Folders.Size(); i++)
- Folders[i].AddRealIndices(realIndices);
- for (i = 0; i < Files.Size(); i++)
- realIndices.Add(Files[i].Index);
-}
-
-void CProxyFolder::GetRealIndices(const UInt32 *indices, UInt32 numItems, CUIntVector &realIndices) const
-{
- realIndices.Clear();
- for (UInt32 i = 0; i < numItems; i++)
- {
- int index = indices[i];
- int numDirItems = Folders.Size();
- if (index < numDirItems)
- Folders[index].AddRealIndices(realIndices);
- else
- realIndices.Add(Files[index - numDirItems].Index);
- }
- HeapSort(&realIndices.Front(), realIndices.Size());
-}
-
-///////////////////////////////////////////////
-// CProxyArchive
-
-static UInt64 GetSize(IInArchive *archive, UInt32 index, PROPID propID)
-{
- NCOM::CPropVariant prop;
- if (archive->GetProperty(index, propID, &prop) == S_OK)
- if (prop.vt != VT_EMPTY)
- return ConvertPropVariantToUInt64(prop);
- return 0;
-}
-
-void CProxyFolder::CalculateSizes(IInArchive *archive)
-{
- Size = PackSize = 0;
- NumSubFolders = Folders.Size();
- NumSubFiles = Files.Size();
- CrcIsDefined = true;
- Crc = 0;
- int i;
- for (i = 0; i < Files.Size(); i++)
- {
- UInt32 index = Files[i].Index;
- Size += GetSize(archive, index, kpidSize);
- PackSize += GetSize(archive, index, kpidPackSize);
- {
- NCOM::CPropVariant prop;
- if (archive->GetProperty(index, kpidCRC, &prop) == S_OK && prop.vt == VT_UI4)
- Crc += prop.ulVal;
- else
- CrcIsDefined = false;
- }
- }
- for (i = 0; i < Folders.Size(); i++)
- {
- CProxyFolder &f = Folders[i];
- f.CalculateSizes(archive);
- Size += f.Size;
- PackSize += f.PackSize;
- NumSubFiles += f.NumSubFiles;
- NumSubFolders += f.NumSubFolders;
- Crc += f.Crc;
- if (!f.CrcIsDefined)
- CrcIsDefined = false;
- }
-}
-
-HRESULT CProxyArchive::Load(const CArc &arc, IProgress *progress)
-{
- RootFolder.Clear();
- IInArchive *archive = arc.Archive;
- {
- ThereIsPathProp = false;
- UInt32 numProps;
- archive->GetNumberOfProperties(&numProps);
- for (UInt32 i = 0; i < numProps; i++)
- {
- CMyComBSTR name;
- PROPID propID;
- VARTYPE varType;
- RINOK(archive->GetPropertyInfo(i, &name, &propID, &varType));
- if (propID == kpidPath)
- {
- ThereIsPathProp = true;
- break;
- }
- }
- }
-
- UInt32 numItems;
- RINOK(archive->GetNumberOfItems(&numItems));
- if (progress != NULL)
- {
- UInt64 totalItems = numItems;
- RINOK(progress->SetTotal(totalItems));
- }
- UString fileName;
- for (UInt32 i = 0; i < numItems; i++)
- {
- if (progress != NULL && (i & 0xFFFFF) == 0)
- {
- UInt64 currentItemIndex = i;
- RINOK(progress->SetCompleted(&currentItemIndex));
- }
- UString filePath;
- RINOK(arc.GetItemPath(i, filePath));
- CProxyFolder *curItem = &RootFolder;
- int len = filePath.Length();
- fileName.Empty();
- for (int j = 0; j < len; j++)
- {
- wchar_t c = filePath[j];
- if (c == WCHAR_PATH_SEPARATOR || c == L'/')
- {
- curItem = curItem->AddDirSubItem((UInt32)(Int32)-1, false, fileName);
- fileName.Empty();
- }
- else
- fileName += c;
- }
-
- bool isFolder;
- RINOK(IsArchiveItemFolder(archive, i, isFolder));
- if (isFolder)
- curItem->AddDirSubItem(i, true, fileName);
- else
- curItem->AddFileSubItem(i, fileName);
- }
- RootFolder.CalculateSizes(archive);
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/AgentProxy.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/AgentProxy.h
deleted file mode 100644
index d4caca164..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/AgentProxy.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// AgentProxy.h
-
-#ifndef __AGENT_PROXY_H
-#define __AGENT_PROXY_H
-
-#include "Common/MyString.h"
-
-#include "../Common/OpenArchive.h"
-
-struct CProxyFile
-{
- UInt32 Index;
- UString Name;
-};
-
-struct CProxyFolder: public CProxyFile
-{
- CProxyFolder *Parent;
- CObjectVector<CProxyFolder> Folders;
- CObjectVector<CProxyFile> Files;
- bool IsLeaf;
-
- bool CrcIsDefined;
- UInt64 Size;
- UInt64 PackSize;
- UInt32 Crc;
- UInt32 NumSubFolders;
- UInt32 NumSubFiles;
-
- CProxyFolder(): Parent(NULL) {};
- int FindDirSubItemIndex(const UString &name, int &insertPos) const;
- int FindDirSubItemIndex(const UString &name) const;
- CProxyFolder* AddDirSubItem(UInt32 index, bool leaf, const UString &name);
- void AddFileSubItem(UInt32 index, const UString &name);
- void Clear();
-
- void GetPathParts(UStringVector &pathParts) const;
- UString GetFullPathPrefix() const;
- UString GetItemName(UInt32 index) const;
- void AddRealIndices(CUIntVector &realIndices) const;
- void GetRealIndices(const UInt32 *indices, UInt32 numItems, CUIntVector &realIndices) const;
- void CalculateSizes(IInArchive *archive);
-};
-
-struct CProxyArchive
-{
- CProxyFolder RootFolder;
- bool ThereIsPathProp;
-
- HRESULT Load(const CArc &arc, IProgress *progress);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/ArchiveFolder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/ArchiveFolder.cpp
deleted file mode 100644
index 57975e7d4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/ArchiveFolder.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-// Agent/ArchiveFolder.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-
-#include "../Common/ArchiveExtractCallback.h"
-
-#include "Agent.h"
-
-using namespace NWindows;
-using namespace NCOM;
-
-STDMETHODIMP CAgentFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
- const wchar_t *path, IFolderOperationsExtractCallback *callback)
-{
- COM_TRY_BEGIN
- CArchiveExtractCallback *extractCallbackSpec = new
- CArchiveExtractCallback;
- CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
- UStringVector pathParts;
- CProxyFolder *currentProxyFolder = _proxyFolderItem;
- while (currentProxyFolder->Parent)
- {
- pathParts.Insert(0, currentProxyFolder->Name);
- currentProxyFolder = currentProxyFolder->Parent;
- }
-
- CMyComPtr<IFolderArchiveExtractCallback> extractCallback2;
- {
- CMyComPtr<IFolderOperationsExtractCallback> callbackWrap = callback;
- RINOK(callbackWrap.QueryInterface(
- IID_IFolderArchiveExtractCallback, &extractCallback2));
- }
-
- NExtract::NPathMode::EEnum pathMode = _flatMode ?
- NExtract::NPathMode::kNoPathnames :
- NExtract::NPathMode::kCurrentPathnames;
-
- extractCallbackSpec->InitForMulti(false, pathMode, NExtract::NOverwriteMode::kAskBefore);
- extractCallbackSpec->Init(NULL, &_agentSpec->GetArc(),
- extractCallback2,
- false, false, false,
- path,
- pathParts,
- (UInt64)(Int64)-1);
- CUIntVector realIndices;
- GetRealIndices(indices, numItems, realIndices);
- return _agentSpec->GetArchive()->Extract(&realIndices.Front(),
- realIndices.Size(), BoolToInt(false), extractCallback);
- COM_TRY_END
-}
-
-STDMETHODIMP CAgentFolder::MoveTo(const UInt32 * /* indices */, UInt32 /* numItems */,
- const wchar_t * /* path */, IFolderOperationsExtractCallback * /* callback */)
-{
- return E_NOTIMPL;
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
deleted file mode 100644
index 98c75f4d9..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-// Zip/ArchiveFolder.cpp
-
-#include "StdAfx.h"
-
-#include "Agent.h"
-
-#include "Common/StringConvert.h"
-
-static inline UINT GetCurrentFileCodePage()
- { return AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
-
-void CArchiveFolderManager::LoadFormats()
-{
- if (!_codecs)
- {
- _compressCodecsInfo = _codecs = new CCodecs;
- _codecs->Load();
- }
-}
-
-int CArchiveFolderManager::FindFormat(const UString &type)
-{
- for (int i = 0; i < _codecs->Formats.Size(); i++)
- if (type.CompareNoCase(_codecs->Formats[i].Name) == 0)
- return i;
- return -1;
-}
-
-STDMETHODIMP CArchiveFolderManager::OpenFolderFile(IInStream *inStream, const wchar_t *filePath,
- IFolderFolder **resultFolder, IProgress *progress)
-{
- CMyComPtr<IArchiveOpenCallback> openArchiveCallback;
- if (progress != 0)
- {
- CMyComPtr<IProgress> progressWrapper = progress;
- progressWrapper.QueryInterface(IID_IArchiveOpenCallback, &openArchiveCallback);
- }
- CAgent *agent = new CAgent();
- CMyComPtr<IInFolderArchive> archive = agent;
- RINOK(agent->Open(inStream, filePath, NULL, openArchiveCallback));
- return agent->BindToRootFolder(resultFolder);
-}
-
-/*
-HRESULT CAgent::FolderReOpen(
- IArchiveOpenCallback *openArchiveCallback)
-{
- return ReOpenArchive(_archive, _archiveFilePath);
-}
-*/
-
-
-/*
-STDMETHODIMP CArchiveFolderManager::GetExtensions(const wchar_t *type, BSTR *extensions)
-{
- *extensions = 0;
- int formatIndex = FindFormat(type);
- if (formatIndex < 0)
- return E_INVALIDARG;
- // Exts[0].Ext;
- return StringToBstr(_codecs.Formats[formatIndex].GetAllExtensions(), extensions);
-}
-*/
-STDMETHODIMP CArchiveFolderManager::GetExtensions(BSTR *extensions)
-{
- LoadFormats();
- *extensions = 0;
- UString res;
- for (int i = 0; i < _codecs->Libs.Size(); i++)
- {
- const CCodecLib &lib = _codecs->Libs[i];
- for (int j = 0; j < lib.IconPairs.Size(); j++)
- {
- if (!res.IsEmpty())
- res += L' ';
- res += lib.IconPairs[j].Ext;
- }
- }
- return StringToBstr(res, extensions);
-}
-
-STDMETHODIMP CArchiveFolderManager::GetIconPath(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex)
-{
- LoadFormats();
- *iconPath = 0;
- *iconIndex = 0;
- for (int i = 0; i < _codecs->Libs.Size(); i++)
- {
- const CCodecLib &lib = _codecs->Libs[i];
- int ii = lib.FindIconIndex(ext);
- if (ii >= 0)
- {
- *iconIndex = ii;
- return StringToBstr(GetUnicodeString(lib.Path, GetCurrentFileCodePage()), iconPath);
- }
- }
- return S_OK;
-}
-
-/*
-STDMETHODIMP CArchiveFolderManager::GetTypes(BSTR *types)
-{
- LoadFormats();
- UString typesStrings;
- for(int i = 0; i < _codecs.Formats.Size(); i++)
- {
- const CArcInfoEx &ai = _codecs.Formats[i];
- if (ai.AssociateExts.Size() == 0)
- continue;
- if (i != 0)
- typesStrings += L' ';
- typesStrings += ai.Name;
- }
- return StringToBstr(typesStrings, types);
-}
-STDMETHODIMP CArchiveFolderManager::CreateFolderFile(const wchar_t * type,
- const wchar_t * filePath, IProgress progress)
-{
- return E_NOTIMPL;
-}
-*/
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp
deleted file mode 100644
index 8f03f44de..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/ArchiveFolderOut.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-// FolderOut.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-
-#include "Windows/FileDir.h"
-
-#include "../Common/WorkDir.h"
-
-#include "Agent.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NDirectory;
-
-static LPCWSTR kTempArcivePrefix = L"7zA";
-
-void CAgentFolder::GetPathParts(UStringVector &pathParts)
-{
- _proxyFolderItem->GetPathParts(pathParts);
-}
-
-HRESULT CAgentFolder::CommonUpdateOperation(
- bool deleteOperation,
- bool createFolderOperation,
- bool renameOperation,
- const wchar_t *newItemName,
- const NUpdateArchive::CActionSet *actionSet,
- const UINT32 *indices, UINT32 numItems,
- IFolderArchiveUpdateCallback *updateCallback100)
-{
- NWorkDir::CInfo workDirInfo;
- ReadWorkDirInfo(workDirInfo);
- UString archiveFilePath = _agentSpec->_archiveFilePath;
- UString workDir = GetWorkDir(workDirInfo, archiveFilePath);
- CreateComplexDirectory(workDir);
-
- CTempFileW tempFile;
- UString tempFileName;
- if (tempFile.Create(workDir, kTempArcivePrefix, tempFileName) == 0)
- return E_FAIL;
-
- /*
- if (SetOutProperties(anOutArchive, aCompressionInfo.Method) != S_OK)
- return NFileOperationReturnCode::kError;
- */
-
- ////////////////////////////
- // Save FolderItem;
-
- UStringVector pathParts;
- GetPathParts(pathParts);
-
- HRESULT result;
- if (deleteOperation)
- result = _agentSpec->DeleteItems(tempFileName,
- indices, numItems, updateCallback100);
- else if (createFolderOperation)
- {
- result = _agentSpec->CreateFolder(tempFileName,
- newItemName, updateCallback100);
- }
- else if (renameOperation)
- {
- result = _agentSpec->RenameItem(
- tempFileName,
- indices, numItems,
- newItemName,
- updateCallback100);
- }
- else
- {
- Byte actionSetByte[NUpdateArchive::NPairState::kNumValues];
- for (int i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
- actionSetByte[i] = (Byte)actionSet->StateActions[i];
- result = _agentSpec->DoOperation2(tempFileName, actionSetByte, NULL, updateCallback100);
- }
-
- if (result != S_OK)
- return result;
-
- _agentSpec->Close();
-
- // m_FolderItem = NULL;
-
- if (NFind::DoesFileExist(archiveFilePath))
- if (!DeleteFileAlways(archiveFilePath))
- return GetLastError();
-
- tempFile.DisableDeleting();
- if (!MyMoveFile(tempFileName, archiveFilePath))
- return GetLastError();
-
- {
- CMyComPtr<IArchiveOpenCallback> openCallback;
- if (updateCallback100)
- {
- RINOK(updateCallback100->QueryInterface(IID_IArchiveOpenCallback, (void **)&openCallback));
- }
- RINOK(_agentSpec->ReOpen(openCallback));
- }
-
- ////////////////////////////
- // Restore FolderItem;
-
- CMyComPtr<IFolderFolder> archiveFolder;
- RINOK(_agentSpec->BindToRootFolder(&archiveFolder));
- for (int i = 0; i < pathParts.Size(); i++)
- {
- CMyComPtr<IFolderFolder> newFolder;
- archiveFolder->BindToFolder(pathParts[i], &newFolder);
- if(!newFolder)
- break;
- archiveFolder = newFolder;
- }
-
- CMyComPtr<IArchiveFolderInternal> archiveFolderInternal;
- RINOK(archiveFolder.QueryInterface(IID_IArchiveFolderInternal, &archiveFolderInternal));
- CAgentFolder *agentFolder;
- RINOK(archiveFolderInternal->GetAgentFolder(&agentFolder));
- _proxyFolderItem = agentFolder->_proxyFolderItem;
- _proxyArchive = agentFolder->_proxyArchive;
- _parentFolder = agentFolder->_parentFolder;
-
- return S_OK;
-}
-
-STDMETHODIMP CAgentFolder::CopyFrom(
- const wchar_t *fromFolderPath, // test it
- const wchar_t **itemsPaths,
- UINT32 numItems,
- IProgress *progress)
-{
- COM_TRY_BEGIN
- CMyComPtr<IFolderArchiveUpdateCallback> updateCallback100;
- if (progress != 0)
- {
- RINOK(progress->QueryInterface(IID_IFolderArchiveUpdateCallback, (void **)&updateCallback100));
- }
- try
- {
- RINOK(_agentSpec->SetFiles(fromFolderPath, itemsPaths, numItems));
- RINOK(_agentSpec->SetFolder(this));
- return CommonUpdateOperation(false, false, false, NULL,
- &NUpdateArchive::kAddActionSet, 0, 0, updateCallback100);
- }
- catch(const UString &s)
- {
- RINOK(updateCallback100->UpdateErrorMessage(UString(L"Error: ") + s));
- return E_FAIL;
- }
- COM_TRY_END
-}
-
-STDMETHODIMP CAgentFolder::Delete(const UINT32 *indices, UINT32 numItems, IProgress *progress)
-{
- COM_TRY_BEGIN
- RINOK(_agentSpec->SetFolder(this));
- CMyComPtr<IFolderArchiveUpdateCallback> updateCallback100;
- if (progress != 0)
- {
- CMyComPtr<IProgress> progressWrapper = progress;
- RINOK(progressWrapper.QueryInterface(
- IID_IFolderArchiveUpdateCallback, &updateCallback100));
- }
- return CommonUpdateOperation(true, false, false, NULL,
- &NUpdateArchive::kDeleteActionSet, indices, numItems, updateCallback100);
- COM_TRY_END
-}
-
-STDMETHODIMP CAgentFolder::CreateFolder(const wchar_t *name, IProgress *progress)
-{
- COM_TRY_BEGIN
- if (_proxyFolderItem->FindDirSubItemIndex(name) >= 0)
- return ERROR_ALREADY_EXISTS;
- RINOK(_agentSpec->SetFolder(this));
- CMyComPtr<IFolderArchiveUpdateCallback> updateCallback100;
- if (progress != 0)
- {
- CMyComPtr<IProgress> progressWrapper = progress;
- RINOK(progressWrapper.QueryInterface(IID_IFolderArchiveUpdateCallback, &updateCallback100));
- }
- return CommonUpdateOperation(false, true, false, name, NULL, NULL, 0, updateCallback100);
- COM_TRY_END
-}
-
-STDMETHODIMP CAgentFolder::Rename(UINT32 index, const wchar_t *newName, IProgress *progress)
-{
- COM_TRY_BEGIN
- CUIntVector indices;
- indices.Add(index);
- RINOK(_agentSpec->SetFolder(this));
- CMyComPtr<IFolderArchiveUpdateCallback> updateCallback100;
- if (progress != 0)
- {
- CMyComPtr<IProgress> progressWrapper = progress;
- RINOK(progressWrapper.QueryInterface(IID_IFolderArchiveUpdateCallback, &updateCallback100));
- }
- return CommonUpdateOperation(false, false, true, newName, NULL, &indices.Front(),
- indices.Size(), updateCallback100);
- COM_TRY_END
-}
-
-STDMETHODIMP CAgentFolder::CreateFile(const wchar_t * /* name */, IProgress * /* progress */)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP CAgentFolder::SetProperty(UINT32 /* index */, PROPID /* propID */,
- const PROPVARIANT * /* value */, IProgress * /* progress */)
-{
- return E_NOTIMPL;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/IFolderArchive.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/IFolderArchive.h
deleted file mode 100644
index 91da1150b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/IFolderArchive.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// IFolderArchive.h
-
-#ifndef __IFOLDER_ARCHIVE_H
-#define __IFOLDER_ARCHIVE_H
-
-#include "../../IDecl.h"
-#include "../../Archive/IArchive.h"
-#include "../../UI/Common/LoadCodecs.h"
-#include "../../UI/FileManager/IFolder.h"
-
-#include "../Common/ExtractMode.h"
-#include "../Common/IFileExtractCallback.h"
-
-#define FOLDER_ARCHIVE_INTERFACE_SUB(i, base, x) DECL_INTERFACE_SUB(i, base, 0x01, x)
-#define FOLDER_ARCHIVE_INTERFACE(i, x) FOLDER_ARCHIVE_INTERFACE_SUB(i, IUnknown, x)
-
-#define INTERFACE_IArchiveFolder(x) \
- STDMETHOD(Extract)(const UInt32 *indices, UInt32 numItems, \
- NExtract::NPathMode::EEnum pathMode, \
- NExtract::NOverwriteMode::EEnum overwriteMode, \
- const wchar_t *path, Int32 testMode, \
- IFolderArchiveExtractCallback *extractCallback2) x; \
-
-FOLDER_ARCHIVE_INTERFACE(IArchiveFolder, 0x05)
-{
- INTERFACE_IArchiveFolder(PURE)
-};
-
-#define INTERFACE_IInFolderArchive(x) \
- STDMETHOD(Open)(IInStream *inStream, const wchar_t *filePath, BSTR *archiveType, IArchiveOpenCallback *openArchiveCallback) x; \
- STDMETHOD(ReOpen)(IArchiveOpenCallback *openArchiveCallback) x; \
- STDMETHOD(Close)() x; \
- STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties) x; \
- STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x; \
- STDMETHOD(BindToRootFolder)(IFolderFolder **resultFolder) x; \
- STDMETHOD(Extract)(NExtract::NPathMode::EEnum pathMode, \
- NExtract::NOverwriteMode::EEnum overwriteMode, const wchar_t *path, \
- Int32 testMode, IFolderArchiveExtractCallback *extractCallback2) x; \
-
-FOLDER_ARCHIVE_INTERFACE(IInFolderArchive, 0x0D)
-{
- INTERFACE_IInFolderArchive(PURE)
-};
-
-#define INTERFACE_IFolderArchiveUpdateCallback(x) \
- STDMETHOD(CompressOperation)(const wchar_t *name) x; \
- STDMETHOD(DeleteOperation)(const wchar_t *name) x; \
- STDMETHOD(OperationResult)(Int32 operationResult) x; \
- STDMETHOD(UpdateErrorMessage)(const wchar_t *message) x; \
- STDMETHOD(SetNumFiles)(UInt64 numFiles) x; \
-
-FOLDER_ARCHIVE_INTERFACE_SUB(IFolderArchiveUpdateCallback, IProgress, 0x0B)
-{
- INTERFACE_IFolderArchiveUpdateCallback(PURE)
-};
-
-#define INTERFACE_IOutFolderArchive(x) \
- STDMETHOD(SetFolder)(IFolderFolder *folder) x; \
- STDMETHOD(SetFiles)(const wchar_t *folderPrefix, const wchar_t **names, UInt32 numNames) x; \
- STDMETHOD(DeleteItems)(const wchar_t *newArchiveName, \
- const UInt32 *indices, UInt32 numItems, IFolderArchiveUpdateCallback *updateCallback) x; \
- STDMETHOD(DoOperation)(CCodecs *codecs, int index, \
- const wchar_t *newArchiveName, const Byte *stateActions, const wchar_t *sfxModule, \
- IFolderArchiveUpdateCallback *updateCallback) x; \
- STDMETHOD(DoOperation2)(const wchar_t *newArchiveName, const Byte *stateActions, \
- const wchar_t *sfxModule, IFolderArchiveUpdateCallback *updateCallback) x; \
-
-FOLDER_ARCHIVE_INTERFACE(IOutFolderArchive, 0x0A)
-{
- INTERFACE_IOutFolderArchive(PURE)
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp
deleted file mode 100644
index 21549c90f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/UpdateCallbackAgent.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-// UpdateCallbackAgent.h
-
-#include "StdAfx.h"
-
-#include "Windows/Error.h"
-#include "Common/IntToString.h"
-
-#include "UpdateCallbackAgent.h"
-
-using namespace NWindows;
-
-void CUpdateCallbackAgent::SetCallback(IFolderArchiveUpdateCallback *callback)
-{
- Callback = callback;
- _compressProgress.Release();
- if (Callback)
- Callback.QueryInterface(IID_ICompressProgressInfo, &_compressProgress);
-}
-
-HRESULT CUpdateCallbackAgent::SetNumFiles(UInt64 numFiles)
-{
- if (Callback)
- return Callback->SetNumFiles(numFiles);
- return S_OK;
-}
-
-
-HRESULT CUpdateCallbackAgent::SetTotal(UINT64 size)
-{
- if (Callback)
- return Callback->SetTotal(size);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackAgent::SetCompleted(const UINT64 *completeValue)
-{
- if (Callback)
- return Callback->SetCompleted(completeValue);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackAgent::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
- if (_compressProgress)
- return _compressProgress->SetRatioInfo(inSize, outSize);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackAgent::CheckBreak()
-{
- return S_OK;
-}
-
-HRESULT CUpdateCallbackAgent::Finilize()
-{
- return S_OK;
-}
-
-HRESULT CUpdateCallbackAgent::OpenFileError(const wchar_t *name, DWORD systemError)
-{
- // if (systemError == ERROR_SHARING_VIOLATION)
- {
- if (Callback)
- {
- RINOK(Callback->UpdateErrorMessage(
- UString(L"WARNING: ") +
- NError::MyFormatMessageW(systemError) +
- UString(L": ") +
- UString(name)));
- return S_FALSE;
- }
- }
- // FailedFiles.Add(name);
- return systemError;
-}
-
-HRESULT CUpdateCallbackAgent::GetStream(const wchar_t *name, bool /* isAnti */)
-{
- if (Callback)
- return Callback->CompressOperation(name);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackAgent::SetOperationResult(Int32 operationResult)
-{
- if (Callback)
- return Callback->OperationResult(operationResult);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackAgent::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
-{
- *password = NULL;
- *passwordIsDefined = BoolToInt(false);
- if (!_cryptoGetTextPassword)
- {
- if (!Callback)
- return S_OK;
- Callback.QueryInterface(IID_ICryptoGetTextPassword2, &_cryptoGetTextPassword);
- if (!_cryptoGetTextPassword)
- return S_OK;
- }
- return _cryptoGetTextPassword->CryptoGetTextPassword2(passwordIsDefined, password);
-}
-
-HRESULT CUpdateCallbackAgent::CryptoGetTextPassword(BSTR *password)
-{
- *password = NULL;
- CMyComPtr<ICryptoGetTextPassword> getTextPassword;
- Callback.QueryInterface(IID_ICryptoGetTextPassword, &getTextPassword);
- if (!getTextPassword)
- return E_NOTIMPL;
- return getTextPassword->CryptoGetTextPassword(password);
-}
-
-/*
-HRESULT CUpdateCallbackAgent::ShowDeleteFile(const wchar_t *name)
-{
- return Callback->DeleteOperation(name);
-}
-*/ \ No newline at end of file
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/UpdateCallbackAgent.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/UpdateCallbackAgent.h
deleted file mode 100644
index 1d5ed17a0..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Agent/UpdateCallbackAgent.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// UpdateCallbackAgent.h
-
-#ifndef __UPDATECALLBACKAGENT_H
-#define __UPDATECALLBACKAGENT_H
-
-#include "../Common/UpdateCallback.h"
-#include "IFolderArchive.h"
-
-class CUpdateCallbackAgent: public IUpdateCallbackUI
-{
- INTERFACE_IUpdateCallbackUI(;)
- CMyComPtr<ICryptoGetTextPassword2> _cryptoGetTextPassword;
- CMyComPtr<IFolderArchiveUpdateCallback> Callback;
- CMyComPtr<ICompressProgressInfo> _compressProgress;
-public:
- void SetCallback(IFolderArchiveUpdateCallback *callback);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Client7z/Client7z.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Client7z/Client7z.cpp
deleted file mode 100644
index 7c052171b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Client7z/Client7z.cpp
+++ /dev/null
@@ -1,853 +0,0 @@
-// Client7z.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/MyInitGuid.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/DLL.h"
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-#include "Windows/FileName.h"
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "../../Common/FileStreams.h"
-
-#include "../../Archive/IArchive.h"
-
-#include "../../IPassword.h"
-#include "../../MyVersion.h"
-
-// use another CLSIDs, if you want to support other formats (zip, rar, ...).
-// {23170F69-40C1-278A-1000-000110070000}
-DEFINE_GUID(CLSID_CFormat7z,
- 0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
-
-using namespace NWindows;
-
-#define kDllName "7z.dll"
-
-static const char *kCopyrightString = MY_7ZIP_VERSION
-" (" kDllName " client) "
-MY_COPYRIGHT " " MY_DATE;
-
-static const char *kHelpString =
-"Usage: Client7z.exe [a | l | x ] archive.7z [fileName ...]\n"
-"Examples:\n"
-" Client7z.exe a archive.7z f1.txt f2.txt : compress two files to archive.7z\n"
-" Client7z.exe l archive.7z : List contents of archive.7z\n"
-" Client7z.exe x archive.7z : eXtract files from archive.7z\n";
-
-
-typedef UINT32 (WINAPI * CreateObjectFunc)(
- const GUID *clsID,
- const GUID *interfaceID,
- void **outObject);
-
-#ifdef _WIN32
-#ifndef _UNICODE
-bool g_IsNT = false;
-static inline bool IsItWindowsNT()
-{
- OSVERSIONINFO versionInfo;
- versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
- return false;
- return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-#endif
-#endif
-
-void PrintString(const UString &s)
-{
- printf("%s", (LPCSTR)GetOemString(s));
-}
-
-void PrintString(const AString &s)
-{
- printf("%s", (LPCSTR)s);
-}
-
-void PrintNewLine()
-{
- PrintString("\n");
-}
-
-void PrintStringLn(const AString &s)
-{
- PrintString(s);
- PrintNewLine();
-}
-
-void PrintError(const AString &s)
-{
- PrintNewLine();
- PrintString(s);
- PrintNewLine();
-}
-
-static HRESULT IsArchiveItemProp(IInArchive *archive, UInt32 index, PROPID propID, bool &result)
-{
- NCOM::CPropVariant prop;
- RINOK(archive->GetProperty(index, propID, &prop));
- if (prop.vt == VT_BOOL)
- result = VARIANT_BOOLToBool(prop.boolVal);
- else if (prop.vt == VT_EMPTY)
- result = false;
- else
- return E_FAIL;
- return S_OK;
-}
-
-static HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result)
-{
- return IsArchiveItemProp(archive, index, kpidIsDir, result);
-}
-
-
-static const wchar_t *kEmptyFileAlias = L"[Content]";
-
-
-//////////////////////////////////////////////////////////////
-// Archive Open callback class
-
-
-class CArchiveOpenCallback:
- public IArchiveOpenCallback,
- public ICryptoGetTextPassword,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(ICryptoGetTextPassword)
-
- STDMETHOD(SetTotal)(const UInt64 *files, const UInt64 *bytes);
- STDMETHOD(SetCompleted)(const UInt64 *files, const UInt64 *bytes);
-
- STDMETHOD(CryptoGetTextPassword)(BSTR *password);
-
- bool PasswordIsDefined;
- UString Password;
-
- CArchiveOpenCallback() : PasswordIsDefined(false) {}
-};
-
-STDMETHODIMP CArchiveOpenCallback::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
-{
- return S_OK;
-}
-
-STDMETHODIMP CArchiveOpenCallback::SetCompleted(const UInt64 * /* files */, const UInt64 * /* bytes */)
-{
- return S_OK;
-}
-
-STDMETHODIMP CArchiveOpenCallback::CryptoGetTextPassword(BSTR *password)
-{
- if (!PasswordIsDefined)
- {
- // You can ask real password here from user
- // Password = GetPassword(OutStream);
- // PasswordIsDefined = true;
- PrintError("Password is not defined");
- return E_ABORT;
- }
- return StringToBstr(Password, password);
-}
-
-
-//////////////////////////////////////////////////////////////
-// Archive Extracting callback class
-
-static const wchar_t *kCantDeleteOutputFile = L"ERROR: Can not delete output file ";
-
-static const char *kTestingString = "Testing ";
-static const char *kExtractingString = "Extracting ";
-static const char *kSkippingString = "Skipping ";
-
-static const char *kUnsupportedMethod = "Unsupported Method";
-static const char *kCRCFailed = "CRC Failed";
-static const char *kDataError = "Data Error";
-static const char *kUnknownError = "Unknown Error";
-
-class CArchiveExtractCallback:
- public IArchiveExtractCallback,
- public ICryptoGetTextPassword,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(ICryptoGetTextPassword)
-
- // IProgress
- STDMETHOD(SetTotal)(UInt64 size);
- STDMETHOD(SetCompleted)(const UInt64 *completeValue);
-
- // IArchiveExtractCallback
- STDMETHOD(GetStream)(UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode);
- STDMETHOD(PrepareOperation)(Int32 askExtractMode);
- STDMETHOD(SetOperationResult)(Int32 resultEOperationResult);
-
- // ICryptoGetTextPassword
- STDMETHOD(CryptoGetTextPassword)(BSTR *aPassword);
-
-private:
- CMyComPtr<IInArchive> _archiveHandler;
- UString _directoryPath; // Output directory
- UString _filePath; // name inside arcvhive
- UString _diskFilePath; // full path to file on disk
- bool _extractMode;
- struct CProcessedFileInfo
- {
- FILETIME MTime;
- UInt32 Attrib;
- bool isDir;
- bool AttribDefined;
- bool MTimeDefined;
- } _processedFileInfo;
-
- COutFileStream *_outFileStreamSpec;
- CMyComPtr<ISequentialOutStream> _outFileStream;
-
-public:
- void Init(IInArchive *archiveHandler, const UString &directoryPath);
-
- UInt64 NumErrors;
- bool PasswordIsDefined;
- UString Password;
-
- CArchiveExtractCallback() : PasswordIsDefined(false) {}
-};
-
-void CArchiveExtractCallback::Init(IInArchive *archiveHandler, const UString &directoryPath)
-{
- NumErrors = 0;
- _archiveHandler = archiveHandler;
- _directoryPath = directoryPath;
- NFile::NName::NormalizeDirPathPrefix(_directoryPath);
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetTotal(UInt64 /* size */)
-{
- return S_OK;
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetCompleted(const UInt64 * /* completeValue */)
-{
- return S_OK;
-}
-
-STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
- ISequentialOutStream **outStream, Int32 askExtractMode)
-{
- *outStream = 0;
- _outFileStream.Release();
-
- {
- // Get Name
- NCOM::CPropVariant prop;
- RINOK(_archiveHandler->GetProperty(index, kpidPath, &prop));
-
- UString fullPath;
- if (prop.vt == VT_EMPTY)
- fullPath = kEmptyFileAlias;
- else
- {
- if (prop.vt != VT_BSTR)
- return E_FAIL;
- fullPath = prop.bstrVal;
- }
- _filePath = fullPath;
- }
-
- if (askExtractMode != NArchive::NExtract::NAskMode::kExtract)
- return S_OK;
-
- {
- // Get Attrib
- NCOM::CPropVariant prop;
- RINOK(_archiveHandler->GetProperty(index, kpidAttrib, &prop));
- if (prop.vt == VT_EMPTY)
- {
- _processedFileInfo.Attrib = 0;
- _processedFileInfo.AttribDefined = false;
- }
- else
- {
- if (prop.vt != VT_UI4)
- return E_FAIL;
- _processedFileInfo.Attrib = prop.ulVal;
- _processedFileInfo.AttribDefined = true;
- }
- }
-
- RINOK(IsArchiveItemFolder(_archiveHandler, index, _processedFileInfo.isDir));
-
- {
- // Get Modified Time
- NCOM::CPropVariant prop;
- RINOK(_archiveHandler->GetProperty(index, kpidMTime, &prop));
- _processedFileInfo.MTimeDefined = false;
- switch(prop.vt)
- {
- case VT_EMPTY:
- // _processedFileInfo.MTime = _utcMTimeDefault;
- break;
- case VT_FILETIME:
- _processedFileInfo.MTime = prop.filetime;
- _processedFileInfo.MTimeDefined = true;
- break;
- default:
- return E_FAIL;
- }
-
- }
- {
- // Get Size
- NCOM::CPropVariant prop;
- RINOK(_archiveHandler->GetProperty(index, kpidSize, &prop));
- bool newFileSizeDefined = (prop.vt != VT_EMPTY);
- UInt64 newFileSize;
- if (newFileSizeDefined)
- newFileSize = ConvertPropVariantToUInt64(prop);
- }
-
-
- {
- // Create folders for file
- int slashPos = _filePath.ReverseFind(WCHAR_PATH_SEPARATOR);
- if (slashPos >= 0)
- NFile::NDirectory::CreateComplexDirectory(_directoryPath + _filePath.Left(slashPos));
- }
-
- UString fullProcessedPath = _directoryPath + _filePath;
- _diskFilePath = fullProcessedPath;
-
- if (_processedFileInfo.isDir)
- {
- NFile::NDirectory::CreateComplexDirectory(fullProcessedPath);
- }
- else
- {
- NFile::NFind::CFileInfoW fi;
- if (fi.Find(fullProcessedPath))
- {
- if (!NFile::NDirectory::DeleteFileAlways(fullProcessedPath))
- {
- PrintString(UString(kCantDeleteOutputFile) + fullProcessedPath);
- return E_ABORT;
- }
- }
-
- _outFileStreamSpec = new COutFileStream;
- CMyComPtr<ISequentialOutStream> outStreamLoc(_outFileStreamSpec);
- if (!_outFileStreamSpec->Open(fullProcessedPath, CREATE_ALWAYS))
- {
- PrintString((UString)L"can not open output file " + fullProcessedPath);
- return E_ABORT;
- }
- _outFileStream = outStreamLoc;
- *outStream = outStreamLoc.Detach();
- }
- return S_OK;
-}
-
-STDMETHODIMP CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
-{
- _extractMode = false;
- switch (askExtractMode)
- {
- case NArchive::NExtract::NAskMode::kExtract: _extractMode = true; break;
- };
- switch (askExtractMode)
- {
- case NArchive::NExtract::NAskMode::kExtract: PrintString(kExtractingString); break;
- case NArchive::NExtract::NAskMode::kTest: PrintString(kTestingString); break;
- case NArchive::NExtract::NAskMode::kSkip: PrintString(kSkippingString); break;
- };
- PrintString(_filePath);
- return S_OK;
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
-{
- switch(operationResult)
- {
- case NArchive::NExtract::NOperationResult::kOK:
- break;
- default:
- {
- NumErrors++;
- PrintString(" ");
- switch(operationResult)
- {
- case NArchive::NExtract::NOperationResult::kUnSupportedMethod:
- PrintString(kUnsupportedMethod);
- break;
- case NArchive::NExtract::NOperationResult::kCRCError:
- PrintString(kCRCFailed);
- break;
- case NArchive::NExtract::NOperationResult::kDataError:
- PrintString(kDataError);
- break;
- default:
- PrintString(kUnknownError);
- }
- }
- }
-
- if (_outFileStream != NULL)
- {
- if (_processedFileInfo.MTimeDefined)
- _outFileStreamSpec->SetMTime(&_processedFileInfo.MTime);
- RINOK(_outFileStreamSpec->Close());
- }
- _outFileStream.Release();
- if (_extractMode && _processedFileInfo.AttribDefined)
- NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attrib);
- PrintNewLine();
- return S_OK;
-}
-
-
-STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
-{
- if (!PasswordIsDefined)
- {
- // You can ask real password here from user
- // Password = GetPassword(OutStream);
- // PasswordIsDefined = true;
- PrintError("Password is not defined");
- return E_ABORT;
- }
- return StringToBstr(Password, password);
-}
-
-
-
-//////////////////////////////////////////////////////////////
-// Archive Creating callback class
-
-struct CDirItem
-{
- UInt64 Size;
- FILETIME CTime;
- FILETIME ATime;
- FILETIME MTime;
- UString Name;
- UString FullPath;
- UInt32 Attrib;
-
- bool isDir() const { return (Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0 ; }
-};
-
-class CArchiveUpdateCallback:
- public IArchiveUpdateCallback2,
- public ICryptoGetTextPassword2,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP2(IArchiveUpdateCallback2, ICryptoGetTextPassword2)
-
- // IProgress
- STDMETHOD(SetTotal)(UInt64 size);
- STDMETHOD(SetCompleted)(const UInt64 *completeValue);
-
- // IUpdateCallback2
- STDMETHOD(EnumProperties)(IEnumSTATPROPSTG **enumerator);
- STDMETHOD(GetUpdateItemInfo)(UInt32 index,
- Int32 *newData, Int32 *newProperties, UInt32 *indexInArchive);
- STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value);
- STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **inStream);
- STDMETHOD(SetOperationResult)(Int32 operationResult);
- STDMETHOD(GetVolumeSize)(UInt32 index, UInt64 *size);
- STDMETHOD(GetVolumeStream)(UInt32 index, ISequentialOutStream **volumeStream);
-
- STDMETHOD(CryptoGetTextPassword2)(Int32 *passwordIsDefined, BSTR *password);
-
-public:
- CRecordVector<UInt64> VolumesSizes;
- UString VolName;
- UString VolExt;
-
- UString DirPrefix;
- const CObjectVector<CDirItem> *DirItems;
-
- bool PasswordIsDefined;
- UString Password;
- bool AskPassword;
-
- bool m_NeedBeClosed;
-
- UStringVector FailedFiles;
- CRecordVector<HRESULT> FailedCodes;
-
- CArchiveUpdateCallback(): PasswordIsDefined(false), AskPassword(false), DirItems(0) {};
-
- ~CArchiveUpdateCallback() { Finilize(); }
- HRESULT Finilize();
-
- void Init(const CObjectVector<CDirItem> *dirItems)
- {
- DirItems = dirItems;
- m_NeedBeClosed = false;
- FailedFiles.Clear();
- FailedCodes.Clear();
- }
-};
-
-STDMETHODIMP CArchiveUpdateCallback::SetTotal(UInt64 /* size */)
-{
- return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::SetCompleted(const UInt64 * /* completeValue */)
-{
- return S_OK;
-}
-
-
-STDMETHODIMP CArchiveUpdateCallback::EnumProperties(IEnumSTATPROPSTG ** /* enumerator */)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetUpdateItemInfo(UInt32 /* index */,
- Int32 *newData, Int32 *newProperties, UInt32 *indexInArchive)
-{
- if (newData != NULL)
- *newData = BoolToInt(true);
- if (newProperties != NULL)
- *newProperties = BoolToInt(true);
- if (indexInArchive != NULL)
- *indexInArchive = (UInt32)-1;
- return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- NWindows::NCOM::CPropVariant prop;
-
- if (propID == kpidIsAnti)
- {
- prop = false;
- prop.Detach(value);
- return S_OK;
- }
-
- {
- const CDirItem &dirItem = (*DirItems)[index];
- switch(propID)
- {
- case kpidPath: prop = dirItem.Name; break;
- case kpidIsDir: prop = dirItem.isDir(); break;
- case kpidSize: prop = dirItem.Size; break;
- case kpidAttrib: prop = dirItem.Attrib; break;
- case kpidCTime: prop = dirItem.CTime; break;
- case kpidATime: prop = dirItem.ATime; break;
- case kpidMTime: prop = dirItem.MTime; break;
- }
- }
- prop.Detach(value);
- return S_OK;
-}
-
-HRESULT CArchiveUpdateCallback::Finilize()
-{
- if (m_NeedBeClosed)
- {
- PrintNewLine();
- m_NeedBeClosed = false;
- }
- return S_OK;
-}
-
-static void GetStream2(const wchar_t *name)
-{
- PrintString("Compressing ");
- if (name[0] == 0)
- name = kEmptyFileAlias;
- PrintString(name);
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetStream(UInt32 index, ISequentialInStream **inStream)
-{
- RINOK(Finilize());
-
- const CDirItem &dirItem = (*DirItems)[index];
- GetStream2(dirItem.Name);
-
- if (dirItem.isDir())
- return S_OK;
-
- {
- CInFileStream *inStreamSpec = new CInFileStream;
- CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
- UString path = DirPrefix + dirItem.FullPath;
- if (!inStreamSpec->Open(path))
- {
- DWORD sysError = ::GetLastError();
- FailedCodes.Add(sysError);
- FailedFiles.Add(path);
- // if (systemError == ERROR_SHARING_VIOLATION)
- {
- PrintNewLine();
- PrintError("WARNING: can't open file");
- // PrintString(NError::MyFormatMessageW(systemError));
- return S_FALSE;
- }
- // return sysError;
- }
- *inStream = inStreamLoc.Detach();
- }
- return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::SetOperationResult(Int32 /* operationResult */)
-{
- m_NeedBeClosed = true;
- return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetVolumeSize(UInt32 index, UInt64 *size)
-{
- if (VolumesSizes.Size() == 0)
- return S_FALSE;
- if (index >= (UInt32)VolumesSizes.Size())
- index = VolumesSizes.Size() - 1;
- *size = VolumesSizes[index];
- return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetVolumeStream(UInt32 index, ISequentialOutStream **volumeStream)
-{
- wchar_t temp[16];
- ConvertUInt32ToString(index + 1, temp);
- UString res = temp;
- while (res.Length() < 2)
- res = UString(L'0') + res;
- UString fileName = VolName;
- fileName += L'.';
- fileName += res;
- fileName += VolExt;
- COutFileStream *streamSpec = new COutFileStream;
- CMyComPtr<ISequentialOutStream> streamLoc(streamSpec);
- if (!streamSpec->Create(fileName, false))
- return ::GetLastError();
- *volumeStream = streamLoc.Detach();
- return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
-{
- if (!PasswordIsDefined)
- {
- if (AskPassword)
- {
- // You can ask real password here from user
- // Password = GetPassword(OutStream);
- // PasswordIsDefined = true;
- PrintError("Password is not defined");
- return E_ABORT;
- }
- }
- *passwordIsDefined = BoolToInt(PasswordIsDefined);
- return StringToBstr(Password, password);
-}
-
-
-
-//////////////////////////////////////////////////////////////////////////
-// Main function
-
-int MY_CDECL main(int argc, char* argv[])
-{
- #ifdef _WIN32
- #ifndef _UNICODE
- g_IsNT = IsItWindowsNT();
- #endif
- #endif
-
- PrintStringLn(kCopyrightString);
-
- if (argc < 3)
- {
- PrintStringLn(kHelpString);
- return 1;
- }
- NWindows::NDLL::CLibrary library;
- if (!library.Load(TEXT(kDllName)))
- {
- PrintError("Can not load library");
- return 1;
- }
- CreateObjectFunc createObjectFunc = (CreateObjectFunc)library.GetProcAddress("CreateObject");
- if (createObjectFunc == 0)
- {
- PrintError("Can not get CreateObject");
- return 1;
- }
-
- AString command = argv[1];
- command.MakeLower();
- UString archiveName = GetUnicodeString(argv[2], CP_OEMCP);
- if (command.Compare("a") == 0)
- {
- // create archive command
- if (argc < 4)
- {
- PrintStringLn(kHelpString);
- return 1;
- }
- CObjectVector<CDirItem> dirItems;
- int i;
- for (i = 3; i < argc; i++)
- {
- CDirItem di;
- UString name = GetUnicodeString(argv[i], CP_OEMCP);
-
- NFile::NFind::CFileInfoW fi;
- if (!fi.Find(name))
- {
- PrintString(UString(L"Can't find file") + name);
- return 1;
- }
-
- di.Attrib = fi.Attrib;
- di.Size = fi.Size;
- di.CTime = fi.CTime;
- di.ATime = fi.ATime;
- di.MTime = fi.MTime;
- di.Name = name;
- di.FullPath = name;
- dirItems.Add(di);
- }
- COutFileStream *outFileStreamSpec = new COutFileStream;
- CMyComPtr<IOutStream> outFileStream = outFileStreamSpec;
- if (!outFileStreamSpec->Create(archiveName, false))
- {
- PrintError("can't create archive file");
- return 1;
- }
-
- CMyComPtr<IOutArchive> outArchive;
- if (createObjectFunc(&CLSID_CFormat7z, &IID_IOutArchive, (void **)&outArchive) != S_OK)
- {
- PrintError("Can not get class object");
- return 1;
- }
-
- CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
- CMyComPtr<IArchiveUpdateCallback2> updateCallback(updateCallbackSpec);
- updateCallbackSpec->Init(&dirItems);
- // updateCallbackSpec->PasswordIsDefined = true;
- // updateCallbackSpec->Password = L"1";
-
- HRESULT result = outArchive->UpdateItems(outFileStream, dirItems.Size(), updateCallback);
- updateCallbackSpec->Finilize();
- if (result != S_OK)
- {
- PrintError("Update Error");
- return 1;
- }
- for (i = 0; i < updateCallbackSpec->FailedFiles.Size(); i++)
- {
- PrintNewLine();
- PrintString((UString)L"Error for file: " + updateCallbackSpec->FailedFiles[i]);
- }
- if (updateCallbackSpec->FailedFiles.Size() != 0)
- return 1;
- }
- else
- {
- if (argc != 3)
- {
- PrintStringLn(kHelpString);
- return 1;
- }
-
- bool listCommand;
- if (command.Compare("l") == 0)
- listCommand = true;
- else if (command.Compare("x") == 0)
- listCommand = false;
- else
- {
- PrintError("incorrect command");
- return 1;
- }
-
- CMyComPtr<IInArchive> archive;
- if (createObjectFunc(&CLSID_CFormat7z, &IID_IInArchive, (void **)&archive) != S_OK)
- {
- PrintError("Can not get class object");
- return 1;
- }
-
- CInFileStream *fileSpec = new CInFileStream;
- CMyComPtr<IInStream> file = fileSpec;
-
- if (!fileSpec->Open(archiveName))
- {
- PrintError("Can not open archive file");
- return 1;
- }
-
- {
- CArchiveOpenCallback *openCallbackSpec = new CArchiveOpenCallback;
- CMyComPtr<IArchiveOpenCallback> openCallback(openCallbackSpec);
- openCallbackSpec->PasswordIsDefined = false;
- // openCallbackSpec->PasswordIsDefined = true;
- // openCallbackSpec->Password = L"1";
-
- if (archive->Open(file, 0, openCallback) != S_OK)
- {
- PrintError("Can not open archive");
- return 1;
- }
- }
-
- if (listCommand)
- {
- // List command
- UInt32 numItems = 0;
- archive->GetNumberOfItems(&numItems);
- for (UInt32 i = 0; i < numItems; i++)
- {
- {
- // Get uncompressed size of file
- NWindows::NCOM::CPropVariant prop;
- archive->GetProperty(i, kpidSize, &prop);
- UString s = ConvertPropVariantToString(prop);
- PrintString(s);
- PrintString(" ");
- }
- {
- // Get name of file
- NWindows::NCOM::CPropVariant prop;
- archive->GetProperty(i, kpidPath, &prop);
- UString s = ConvertPropVariantToString(prop);
- PrintString(s);
- }
- PrintString("\n");
- }
- }
- else
- {
- // Extract command
- CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback;
- CMyComPtr<IArchiveExtractCallback> extractCallback(extractCallbackSpec);
- extractCallbackSpec->Init(archive, L""); // second parameter is output folder path
- extractCallbackSpec->PasswordIsDefined = false;
- // extractCallbackSpec->PasswordIsDefined = true;
- // extractCallbackSpec->Password = L"1";
- HRESULT result = archive->Extract(NULL, (UInt32)(Int32)(-1), false, extractCallback);
- if (result != S_OK)
- {
- PrintError("Extract Error");
- return 1;
- }
- }
- }
- return 0;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/ClientCodec/ClientCodec.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/ClientCodec/ClientCodec.cpp
deleted file mode 100644
index 664889bf7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/ClientCodec/ClientCodec.cpp
+++ /dev/null
@@ -1,370 +0,0 @@
-// Client7z.cpp
-
-#include "StdAfx.h"
-
-#ifdef _WIN32
-#include <initguid.h>
-#else
-#include "Common/MyInitGuid.h"
-#endif
-
-#include "Windows/DLL.h"
-#include "../../ICoder.h"
-#include "Windows/PropVariant.h"
-#include "Common/MyCom.h"
-
-using namespace NWindows;
-
-class CFileIn : public ISequentialInStream, public CMyUnknownImp
-{
- FILE *file_;
- size_t pos_;
- public:
- MY_UNKNOWN_IMP
-
- CFileIn() : file_(0) , pos_(0) { }
- ~CFileIn() { this->close(); }
-
- HRESULT open(const char *name)
- {
- file_ = fopen(name,"rb");
- if (file_) return S_OK;
- return E_FAIL;
- }
- void close()
- {
- if (file_) fclose(file_);
- file_ = 0;
- pos_ = 0;
- }
- HRESULT Read(void *data, UInt32 size, UInt32 *processedSize)
- {
- if (file_)
- {
- size_t ret = fread (data, 1, size, file_);
- *processedSize = ret;
- pos_ += ret;
- // TBD : if ret == 0, test for feof/ferror
- return S_OK;
- }
- return E_FAIL;
- }
- size_t pos() { return pos_; }
-};
-
-class CFileOut : public ISequentialOutStream, public CMyUnknownImp
-{
- FILE *file_;
- size_t pos_;
- public:
- MY_UNKNOWN_IMP
-
- CFileOut() : file_(0) { }
- ~CFileOut() { this->close(); }
-
- HRESULT open(const char *name)
- {
- file_ = fopen(name,"wb");
- if (file_) return S_OK;
- return E_FAIL;
- }
- void close()
- {
- if (file_) fclose(file_);
- file_ = 0;
- }
- HRESULT Write(const void *data, UInt32 size, UInt32 *processedSize)
- {
- if (file_)
- {
- size_t ret = fwrite(data, 1, size, file_);
- *processedSize = ret;
- pos_ += ret;
- // TBD : if ret == 0, test for feof/ferror
- return S_OK;
- }
- return E_FAIL;
- }
- size_t pos() { return pos_; }
-};
-
-//////////////////////////////////////////////////////////////////////////
-// Main function
-
-static const char *kHelpString =
-"Usage: ClientCodec codec.so [c | d | i] [file_in file_out]\n"
-"Examples:\n"
-" ClientCodec LZMA.so i : info about the codec\n"
-" ClientCodec LZMA.so e file_in file_out : encodes file_in to file_out\n"
-" ClientCodec LZMA.so d file_in file_out : decodes file_in to file_out\n"
-;
-
-typedef UINT32 (WINAPI * CreateObjectFunc)(
- const GUID *clsID,
- const GUID *interfaceID,
- void **outObject);
-
-typedef UINT32 (WINAPI * GetNumberOfMethodsFunc)(UINT32 *numMethods);
-
-typedef UINT32 (WINAPI * GetMethodPropertyFunc)(UINT32 index, PROPID propID, PROPVARIANT *value);
-
-int main(int argc, char* argv[])
-{
- if ((argc != 3) && (argc != 5))
- {
- printf(kHelpString);
- return 1;
- }
-
- if ((argc == 3) && (strcmp(argv[2],"i") != 0))
- {
- printf(kHelpString);
- return 1;
- }
-
- NWindows::NDLL::CLibrary library;
- if (!library.Load(argv[1]))
- {
- printf("Can not load library %s\n",argv[1]);
- return 1;
- }
- CreateObjectFunc createObjectFunc = (CreateObjectFunc)library.GetProcAddress("CreateObject");
- if (createObjectFunc == 0)
- {
- printf("Can not get CreateObject\n");
- return 1;
- }
-
- GetNumberOfMethodsFunc getNumberOfMethodsFunc = (GetNumberOfMethodsFunc)library.GetProcAddress("GetNumberOfMethods");
- if (getNumberOfMethodsFunc == 0)
- {
- printf("Can not get GetNumberOfMethodsFunc\n");
- return 1;
- }
-
- UINT32 numMethods = 0;
- HRESULT res = getNumberOfMethodsFunc(&numMethods);
- if (res != S_OK)
- {
- printf("Error in GetNumberOfMethods\n");
- return 1;
- }
-
- GetMethodPropertyFunc getMethodPropertyFunc = (GetMethodPropertyFunc)library.GetProcAddress("GetMethodProperty");
- if (getMethodPropertyFunc == 0)
- {
- printf("Can not get GetMethodProperty\n");
- return 1;
- }
-
- if (argv[2][0] == 'i')
- {
- printf("%s has %d method(s)\n",argv[1],(int)numMethods);
-
- for(UINT32 m = 0; m < numMethods ; m++)
- {
- printf("\tMethod %d :\n",(int)m);
- NCOM::CPropVariant propVariant;
- res = getMethodPropertyFunc(m,NMethodPropID::kName,&propVariant);
- if (res == S_OK)
- {
- if (propVariant.vt == VT_BSTR)
- {
- printf("\t\tName : %ls\n",propVariant.bstrVal); // Unicode Name
- } else {
- printf("\t\tName : Error\n");
- }
- } else {
- printf("\t\tName : Unknown\n");
- }
- res = getMethodPropertyFunc(m,NMethodPropID::kDecoder,&propVariant);
- if ((res == S_OK) && (propVariant.vt == VT_BSTR)) printf("\t\tDecoder : YES\n");
- else printf("\t\tDecoder : NO\n");
-
- res = getMethodPropertyFunc(m,NMethodPropID::kEncoder,&propVariant);
- if ((res == S_OK) && (propVariant.vt == VT_BSTR)) printf("\t\tEncoder : YES\n");
- else printf("\t\tEncoder : NO\n");
- }
- }
-
- int numMethod = 0; // TBD
-
- if (argv[2][0] == 'e')
- {
- NCOM::CPropVariant propVariant;
- res = getMethodPropertyFunc(numMethod,NMethodPropID::kEncoder,&propVariant);
- if ((res == S_OK) && (propVariant.vt == VT_BSTR))
- {
- CMyComPtr<ICompressCoder> outCoder;
- if (createObjectFunc((const GUID *)propVariant.bstrVal, &IID_ICompressCoder, (void **)&outCoder) != S_OK)
- {
- printf("Can not get class object\n");
- return 1;
- }
- printf("Encoding : ...\n");
-
- CMyComPtr<CFileIn> inStream = new CFileIn;
- res = inStream->open(argv[3]);
- if (res != S_OK)
- {
- printf("cannot open %s\n",argv[3]);
- return 1;
- }
-
- CMyComPtr<CFileOut> outStream = new CFileOut;
- res = outStream->open(argv[4]);
- if (res != S_OK)
- {
- printf("cannot open %s\n",argv[4]);
- return 1;
- }
-{
- CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
- outCoder.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties);
- if (setCoderProperties != NULL)
- {
- printf("IID_ICompressSetCoderProperties : Found\n");
- PROPID propID = NCoderPropID::kEndMarker;
- NWindows::NCOM::CPropVariant value = true;
- res = setCoderProperties->SetCoderProperties(&propID, &value, 1);
- if (res = S_OK) printf("kEndMarker : ON\n");
- else printf("kEndMarker : KO KO\n");
- }
- else
- {
- printf("IID_ICompressSetCoderProperties : NOT Found\n");
- }
-}
-
-{
- CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
-
- outCoder.QueryInterface(IID_ICompressWriteCoderProperties, &writeCoderProperties);
-
- if (writeCoderProperties != NULL)
- {
- UINT32 len = 5; // TBD
- UInt32 processedSize;
- outStream->Write(&len, sizeof(len), &processedSize);
-
- printf("IID_ICompressWriteCoderProperties : Found\n");
- size_t pos1 = outStream->pos();
- writeCoderProperties->WriteCoderProperties(outStream);
- size_t pos2 = outStream->pos();
- printf("SizeOfProp : %d\n",(int)(pos2-pos1));
-/*
- CSequentialOutStreamImp *outStreamSpec = new CSequentialOutStreamImp;
- CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
- outStreamSpec->Init();
- writeCoderProperties->WriteCoderProperties(outStream);
-
- size_t size = outStreamSpec->GetSize();
-
- // encodingInfo.Properties.SetCapacity(size);
- if (encodingInfo.AltCoders.Size() == 0)
- encodingInfo.AltCoders.Add(CAltCoderInfo());
- CAltCoderInfo &altCoderInfo = encodingInfo.AltCoders.Front();
- altCoderInfo.Properties.SetCapacity(size);
-
- memmove(altCoderInfo.Properties, outStreamSpec->GetBuffer(), size);
-*/
- }
- else
- {
- printf("IID_ICompressWriteCoderProperties : NOT Found\n");
- UINT32 len = 0;
- UInt32 processedSize;
- outStream->Write(&len, sizeof(len), &processedSize);
- }
-}
-
- res = outCoder->Code(inStream,outStream,0,0,0);
- inStream->close();
- outStream->close();
-
- if (res == S_OK)
- {
- printf("Encoding : Done\n");
- } else {
- printf("Encoding : Error\n");
- return 1;
- }
- }
- else
- {
- printf("Encoder not available\n");
- return 1;
- }
- }
-
- if (argv[2][0] == 'd')
- {
- NCOM::CPropVariant propVariant;
- res = getMethodPropertyFunc(numMethod,NMethodPropID::kDecoder,&propVariant);
- if ((res == S_OK) && (propVariant.vt == VT_BSTR))
- {
- CMyComPtr<ICompressCoder> outCoder;
- if (createObjectFunc((const GUID *)propVariant.bstrVal, &IID_ICompressCoder, (void **)&outCoder) != S_OK)
- {
- printf("Can not get class object\n");
- return 1;
- }
- printf("Decoding : ...\n");
-
- CMyComPtr<CFileIn> inStream = new CFileIn;
- res = inStream->open(argv[3]);
- if (res != S_OK)
- {
- printf("cannot open %s\n",argv[3]);
- return 1;
- }
-
- CMyComPtr<CFileOut> outStream = new CFileOut;
- res = outStream->open(argv[4]);
- if (res != S_OK)
- {
- printf("cannot open %s\n",argv[4]);
- return 1;
- }
-{
- UINT32 len = 0;
- UInt32 processedSize;
- inStream->Read(&len, sizeof(len), &processedSize);
-
- if (len > 0)
- {
- Byte props[256]; // TBD
- inStream->Read(props, len, &processedSize);
-
- CMyComPtr<ICompressSetDecoderProperties2> setDecoderProperties;
- outCoder->QueryInterface(IID_ICompressSetDecoderProperties2, (void **)&setDecoderProperties);
- if (setDecoderProperties)
- {
- setDecoderProperties->SetDecoderProperties2(props, len);
- printf("IID_ICompressSetDecoderProperties2 : Found (%d)\n",(int)len);
- }
- }
-}
-
- // FIXME UInt64 outSize = 10511; // res = outCoder->Code(inStream,outStream,0,&outSize,0);
- res = outCoder->Code(inStream,outStream,0,0,0);
- inStream->close();
- outStream->close();
-
- if (res == S_OK)
- {
- printf("Decoding : Done\n");
- } else {
- printf("Decoding : Error\n");
- return 1;
- }
- }
- else
- {
- printf("Decoder not available\n");
- return 1;
- }
- }
-
- return 0;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveCommandLine.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
deleted file mode 100644
index a9bd1c639..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
+++ /dev/null
@@ -1,1005 +0,0 @@
-// ArchiveCommandLine.cpp
-
-#include "StdAfx.h"
-
-#ifdef _WIN32
-#include <io.h>
-#endif
-#include <stdio.h>
-
-#include "Common/ListFileUtils.h"
-#include "Common/StringConvert.h"
-#include "Common/StringToInt.h"
-
-#include "Windows/FileDir.h"
-#include "Windows/FileName.h"
-
-#include "ArchiveCommandLine.h"
-#include "EnumDirItems.h"
-#include "SortUtils.h"
-#include "Update.h"
-#include "UpdateAction.h"
-
-#include "myPrivate.h"
-
-#undef _WIN32
-
-extern bool g_CaseSensitive;
-
-#if _MSC_VER >= 1400
-#define MY_isatty_fileno(x) _isatty(_fileno(x))
-#else
-#define MY_isatty_fileno(x) isatty(fileno(x))
-#endif
-
-#define MY_IS_TERMINAL(x) (MY_isatty_fileno(x) != 0);
-
-using namespace NCommandLineParser;
-using namespace NWindows;
-using namespace NFile;
-
-namespace NKey {
-enum Enum
-{
- kHelp1 = 0,
- kHelp2,
- kHelp3,
- kDisableHeaders,
- kDisablePercents,
- kArchiveType,
- kYes,
- #ifndef _NO_CRYPTO
- kPassword,
- #endif
- kProperty,
- kOutputDir,
- kWorkingDir,
- kInclude,
- kExclude,
- kArInclude,
- kArExclude,
- kNoArName,
- kUpdate,
- kVolume,
- kRecursed,
- kSfx,
- kStdIn,
- kStdOut,
- kOverwrite,
- kEmail,
- kShowDialog,
- kUseLStat,
- kTechMode,
- kCaseSensitive,
- kCalcCrc,
-};
-
-}
-
-
-static const wchar_t kRecursedIDChar = 'R';
-static const wchar_t *kRecursedPostCharSet = L"0-";
-
-namespace NRecursedPostCharIndex {
- enum EEnum
- {
- kWildCardRecursionOnly = 0,
- kNoRecursion = 1
- };
-}
-
-static const char kImmediateNameID = '!';
-static const char kMapNameID = '#';
-static const char kFileListID = '@';
-
-static const char kSomeCludePostStringMinSize = 2; // at least <@|!><N>ame must be
-static const char kSomeCludeAfterRecursedPostStringMinSize = 2; // at least <@|!><N>ame must be
-
-static const wchar_t *kOverwritePostCharSet = L"asut";
-
-NExtract::NOverwriteMode::EEnum k_OverwriteModes[] =
-{
- NExtract::NOverwriteMode::kWithoutPrompt,
- NExtract::NOverwriteMode::kSkipExisting,
- NExtract::NOverwriteMode::kAutoRename,
- NExtract::NOverwriteMode::kAutoRenameExisting
-};
-
-static const CSwitchForm kSwitchForms[] =
- {
- { L"?", NSwitchType::kSimple, false, 0, 0, 0 },
- { L"H", NSwitchType::kSimple, false, 0, 0, 0 },
- { L"-HELP", NSwitchType::kSimple, false, 0, 0, 0 },
- { L"BA", NSwitchType::kSimple, false, 0, 0, 0 },
- { L"BD", NSwitchType::kSimple, false, 0, 0, 0 },
- { L"T", NSwitchType::kUnLimitedPostString, false, 1, 0, 0 },
- { L"Y", NSwitchType::kSimple, false, 0, 0, 0 },
- #ifndef _NO_CRYPTO
- { L"P", NSwitchType::kUnLimitedPostString, false, 0, 0, 0 },
- #endif
- { L"M", NSwitchType::kUnLimitedPostString, true, 1, 0, 0 },
- { L"O", NSwitchType::kUnLimitedPostString, false, 1, 0, 0 },
- { L"W", NSwitchType::kUnLimitedPostString, false, 0, 0, 0 },
- { L"I", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize, 0, 0 },
- { L"X", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize, 0, 0 },
- { L"AI", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize, 0, 0 },
- { L"AX", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize, 0, 0 },
- { L"AN", NSwitchType::kSimple, false, 0, 0, 0 },
- { L"U", NSwitchType::kUnLimitedPostString, true, 1, 0, 0 },
- { L"V", NSwitchType::kUnLimitedPostString, true, 1, 0, 0 },
- { L"R", NSwitchType::kPostChar, false, 0, 0, kRecursedPostCharSet },
- { L"SFX", NSwitchType::kUnLimitedPostString, false, 0, 0, 0 },
- { L"SI", NSwitchType::kUnLimitedPostString, false, 0, 0, 0 },
- { L"SO", NSwitchType::kSimple, false, 0, 0 ,0 },
- { L"AO", NSwitchType::kPostChar, false, 1, 1, kOverwritePostCharSet},
- { L"SEML", NSwitchType::kUnLimitedPostString, false, 0, 0 ,0 },
- { L"AD", NSwitchType::kSimple, false, 0, 0 ,0 },
- { L"L", NSwitchType::kSimple, false, 0, 0, 0 },
- { L"SLT", NSwitchType::kSimple, false, 0, 0 ,0 },
- { L"SSC", NSwitchType::kPostChar, false, 0, 0, L"-" },
- { L"SCRC", NSwitchType::kSimple, false, 0, 0, 0 }
- };
-
-static const CCommandForm g_CommandForms[] =
-{
- { L"A", false },
- { L"U", false },
- { L"D", false },
- { L"T", false },
- { L"E", false },
- { L"X", false },
- { L"L", false },
- { L"B", false },
- { L"I", false }
-};
-
-static const int kNumCommandForms = sizeof(g_CommandForms) / sizeof(g_CommandForms[0]);
-
-static const wchar_t *kUniversalWildcard = L"*";
-static const int kMinNonSwitchWords = 1;
-static const int kCommandIndex = 0;
-
-// ---------------------------
-// exception messages
-
-static const char *kUserErrorMessage = "Incorrect command line";
-static const char *kIncorrectListFile = "Incorrect item in listfile.\nCheck charset encoding and -scs switch.";
-static const char *kIncorrectWildCardInListFile = "Incorrect wildcard in listfile";
-static const char *kIncorrectWildCardInCommandLine = "Incorrect wildcard in command line";
-static const char *kTerminalOutError = "I won't write compressed data to a terminal";
-static const char *kSameTerminalError = "I won't write data and program's messages to same terminal";
-
-static void ThrowException(const char *errorMessage)
-{
- throw CArchiveCommandLineException(errorMessage);
-};
-
-static void ThrowUserErrorException()
-{
- ThrowException(kUserErrorMessage);
-};
-
-// ---------------------------
-
-bool CArchiveCommand::IsFromExtractGroup() const
-{
- switch(CommandType)
- {
- case NCommandType::kTest:
- case NCommandType::kExtract:
- case NCommandType::kFullExtract:
- return true;
- default:
- return false;
- }
-}
-
-NExtract::NPathMode::EEnum CArchiveCommand::GetPathMode() const
-{
- switch(CommandType)
- {
- case NCommandType::kTest:
- case NCommandType::kFullExtract:
- return NExtract::NPathMode::kFullPathnames;
- default:
- return NExtract::NPathMode::kNoPathnames;
- }
-}
-
-bool CArchiveCommand::IsFromUpdateGroup() const
-{
- return (CommandType == NCommandType::kAdd ||
- CommandType == NCommandType::kUpdate ||
- CommandType == NCommandType::kDelete);
-}
-
-static NRecursedType::EEnum GetRecursedTypeFromIndex(int index)
-{
- switch (index)
- {
- case NRecursedPostCharIndex::kWildCardRecursionOnly:
- return NRecursedType::kWildCardOnlyRecursed;
- case NRecursedPostCharIndex::kNoRecursion:
- return NRecursedType::kNonRecursed;
- default:
- return NRecursedType::kRecursed;
- }
-}
-
-static bool ParseArchiveCommand(const UString &commandString, CArchiveCommand &command)
-{
- UString commandStringUpper = commandString;
- commandStringUpper.MakeUpper();
- UString postString;
- int commandIndex = ParseCommand(kNumCommandForms, g_CommandForms, commandStringUpper,
- postString) ;
- if (commandIndex < 0)
- return false;
- command.CommandType = (NCommandType::EEnum)commandIndex;
- return true;
-}
-
-// ------------------------------------------------------------------
-// filenames functions
-
-static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
- const UString &name, bool include, NRecursedType::EEnum type)
-{
- bool isWildCard = DoesNameContainWildCard(name);
- bool recursed = false;
-
- switch (type)
- {
- case NRecursedType::kWildCardOnlyRecursed:
- recursed = isWildCard;
- break;
- case NRecursedType::kRecursed:
- recursed = true;
- break;
- case NRecursedType::kNonRecursed:
- recursed = false;
- break;
- }
- wildcardCensor.AddItem(include, name, recursed);
- return true;
-}
-
-static void AddToCensorFromListFile(NWildcard::CCensor &wildcardCensor,
- LPCWSTR fileName, bool include, NRecursedType::EEnum type, UINT codePage)
-{
- UStringVector names;
- if (!ReadNamesFromListFile(fileName, names, codePage))
- throw kIncorrectListFile;
- for (int i = 0; i < names.Size(); i++)
- if (!AddNameToCensor(wildcardCensor, names[i], include, type))
- throw kIncorrectWildCardInListFile;
-}
-
-static void AddCommandLineWildCardToCensr(NWildcard::CCensor &wildcardCensor,
- const UString &name, bool include, NRecursedType::EEnum recursedType)
-{
- if (!AddNameToCensor(wildcardCensor, name, include, recursedType))
- throw kIncorrectWildCardInCommandLine;
-}
-
-static void AddToCensorFromNonSwitchesStrings(
- int startIndex,
- NWildcard::CCensor &wildcardCensor,
- const UStringVector &nonSwitchStrings, NRecursedType::EEnum type,
- bool thereAreSwitchIncludes, UINT codePage)
-{
- if (nonSwitchStrings.Size() == startIndex && (!thereAreSwitchIncludes))
- AddCommandLineWildCardToCensr(wildcardCensor, kUniversalWildcard, true, type);
- for (int i = startIndex; i < nonSwitchStrings.Size(); i++)
- {
- const UString &s = nonSwitchStrings[i];
- if (s[0] == kFileListID)
- AddToCensorFromListFile(wildcardCensor, s.Mid(1), true, type, codePage);
- else
- AddCommandLineWildCardToCensr(wildcardCensor, s, true, type);
- }
-}
-
-#ifdef _WIN32
-static void ParseMapWithPaths(NWildcard::CCensor &wildcardCensor,
- const UString &switchParam, bool include,
- NRecursedType::EEnum commonRecursedType)
-{
- int splitPos = switchParam.Find(L':');
- if (splitPos < 0)
- ThrowUserErrorException();
- UString mappingName = switchParam.Left(splitPos);
-
- UString switchParam2 = switchParam.Mid(splitPos + 1);
- splitPos = switchParam2.Find(L':');
- if (splitPos < 0)
- ThrowUserErrorException();
-
- UString mappingSize = switchParam2.Left(splitPos);
- UString eventName = switchParam2.Mid(splitPos + 1);
-
- UInt64 dataSize64 = ConvertStringToUInt64(mappingSize, NULL);
- UInt32 dataSize = (UInt32)dataSize64;
- {
- CFileMapping fileMapping;
- if (!fileMapping.Open(FILE_MAP_READ, false, GetSystemString(mappingName)))
- ThrowException("Can not open mapping");
- LPVOID data = fileMapping.MapViewOfFile(FILE_MAP_READ, 0, dataSize);
- if (data == NULL)
- ThrowException("MapViewOfFile error");
- try
- {
- const wchar_t *curData = (const wchar_t *)data;
- if (*curData != 0)
- ThrowException("Incorrect mapping data");
- UInt32 numChars = dataSize / sizeof(wchar_t);
- UString name;
- for (UInt32 i = 1; i < numChars; i++)
- {
- wchar_t c = curData[i];
- if (c == L'\0')
- {
- AddCommandLineWildCardToCensr(wildcardCensor,
- name, include, commonRecursedType);
- name.Empty();
- }
- else
- name += c;
- }
- if (!name.IsEmpty())
- ThrowException("data error");
- }
- catch(...)
- {
- UnmapViewOfFile(data);
- throw;
- }
- UnmapViewOfFile(data);
- }
-
- {
- NSynchronization::CManualResetEvent event;
- if (event.Open(EVENT_MODIFY_STATE, false, GetSystemString(eventName)) == S_OK)
- event.Set();
- }
-}
-#endif
-
-static void AddSwitchWildCardsToCensor(NWildcard::CCensor &wildcardCensor,
- const UStringVector &strings, bool include,
- NRecursedType::EEnum commonRecursedType, UINT codePage)
-{
- for (int i = 0; i < strings.Size(); i++)
- {
- const UString &name = strings[i];
- NRecursedType::EEnum recursedType;
- int pos = 0;
- if (name.Length() < kSomeCludePostStringMinSize)
- ThrowUserErrorException();
- if (::MyCharUpper(name[pos]) == kRecursedIDChar)
- {
- pos++;
- int index = UString(kRecursedPostCharSet).Find(name[pos]);
- recursedType = GetRecursedTypeFromIndex(index);
- if (index >= 0)
- pos++;
- }
- else
- recursedType = commonRecursedType;
- if (name.Length() < pos + kSomeCludeAfterRecursedPostStringMinSize)
- ThrowUserErrorException();
- UString tail = name.Mid(pos + 1);
- if (name[pos] == kImmediateNameID)
- AddCommandLineWildCardToCensr(wildcardCensor, tail, include, recursedType);
- else if (name[pos] == kFileListID)
- AddToCensorFromListFile(wildcardCensor, tail, include, recursedType, codePage);
- #ifdef _WIN32
- else if (name[pos] == kMapNameID)
- ParseMapWithPaths(wildcardCensor, tail, include, recursedType);
- #endif
- else
- ThrowUserErrorException();
- }
-}
-
-#ifdef _WIN32
-
-// This code converts all short file names to long file names.
-
-static void ConvertToLongName(const UString &prefix, UString &name)
-{
- if (name.IsEmpty() || DoesNameContainWildCard(name))
- return;
- NFind::CFileInfoW fi;
- if (fi.Find(prefix + name))
- name = fi.Name;
-}
-
-static void ConvertToLongNames(const UString &prefix, CObjectVector<NWildcard::CItem> &items)
-{
- for (int i = 0; i < items.Size(); i++)
- {
- NWildcard::CItem &item = items[i];
- if (item.Recursive || item.PathParts.Size() != 1)
- continue;
- ConvertToLongName(prefix, item.PathParts.Front());
- }
-}
-
-static void ConvertToLongNames(const UString &prefix, NWildcard::CCensorNode &node)
-{
- ConvertToLongNames(prefix, node.IncludeItems);
- ConvertToLongNames(prefix, node.ExcludeItems);
- int i;
- for (i = 0; i < node.SubNodes.Size(); i++)
- ConvertToLongName(prefix, node.SubNodes[i].Name);
- // mix folders with same name
- for (i = 0; i < node.SubNodes.Size(); i++)
- {
- NWildcard::CCensorNode &nextNode1 = node.SubNodes[i];
- for (int j = i + 1; j < node.SubNodes.Size();)
- {
- const NWildcard::CCensorNode &nextNode2 = node.SubNodes[j];
- if (nextNode1.Name.CompareNoCase(nextNode2.Name) == 0)
- {
- nextNode1.IncludeItems += nextNode2.IncludeItems;
- nextNode1.ExcludeItems += nextNode2.ExcludeItems;
- node.SubNodes.Delete(j);
- }
- else
- j++;
- }
- }
- for (i = 0; i < node.SubNodes.Size(); i++)
- {
- NWildcard::CCensorNode &nextNode = node.SubNodes[i];
- ConvertToLongNames(prefix + nextNode.Name + wchar_t(NFile::NName::kDirDelimiter), nextNode);
- }
-}
-
-static void ConvertToLongNames(NWildcard::CCensor &censor)
-{
- for (int i = 0; i < censor.Pairs.Size(); i++)
- {
- NWildcard::CPair &pair = censor.Pairs[i];
- ConvertToLongNames(pair.Prefix, pair.Head);
- }
-}
-
-#endif
-
-static NUpdateArchive::NPairAction::EEnum GetUpdatePairActionType(int i)
-{
- switch(i)
- {
- case NUpdateArchive::NPairAction::kIgnore: return NUpdateArchive::NPairAction::kIgnore;
- case NUpdateArchive::NPairAction::kCopy: return NUpdateArchive::NPairAction::kCopy;
- case NUpdateArchive::NPairAction::kCompress: return NUpdateArchive::NPairAction::kCompress;
- case NUpdateArchive::NPairAction::kCompressAsAnti: return NUpdateArchive::NPairAction::kCompressAsAnti;
- }
- throw 98111603;
-}
-
-const UString kUpdatePairStateIDSet = L"PQRXYZW";
-const int kUpdatePairStateNotSupportedActions[] = {2, 2, 1, -1, -1, -1, -1};
-
-const UString kUpdatePairActionIDSet = L"0123"; //Ignore, Copy, Compress, Create Anti
-
-const wchar_t *kUpdateIgnoreItselfPostStringID = L"-";
-const wchar_t kUpdateNewArchivePostCharID = '!';
-
-
-static bool ParseUpdateCommandString2(const UString &command,
- NUpdateArchive::CActionSet &actionSet, UString &postString)
-{
- for (int i = 0; i < command.Length();)
- {
- wchar_t c = MyCharUpper(command[i]);
- int statePos = kUpdatePairStateIDSet.Find(c);
- if (statePos < 0)
- {
- postString = command.Mid(i);
- return true;
- }
- i++;
- if (i >= command.Length())
- return false;
- int actionPos = kUpdatePairActionIDSet.Find(::MyCharUpper(command[i]));
- if (actionPos < 0)
- return false;
- actionSet.StateActions[statePos] = GetUpdatePairActionType(actionPos);
- if (kUpdatePairStateNotSupportedActions[statePos] == actionPos)
- return false;
- i++;
- }
- postString.Empty();
- return true;
-}
-
-static void ParseUpdateCommandString(CUpdateOptions &options,
- const UStringVector &updatePostStrings,
- const NUpdateArchive::CActionSet &defaultActionSet)
-{
- for (int i = 0; i < updatePostStrings.Size(); i++)
- {
- const UString &updateString = updatePostStrings[i];
- if (updateString.CompareNoCase(kUpdateIgnoreItselfPostStringID) == 0)
- {
- if (options.UpdateArchiveItself)
- {
- options.UpdateArchiveItself = false;
- options.Commands.Delete(0);
- }
- }
- else
- {
- NUpdateArchive::CActionSet actionSet = defaultActionSet;
-
- UString postString;
- if (!ParseUpdateCommandString2(updateString, actionSet, postString))
- ThrowUserErrorException();
- if (postString.IsEmpty())
- {
- if (options.UpdateArchiveItself)
- options.Commands[0].ActionSet = actionSet;
- }
- else
- {
- if (MyCharUpper(postString[0]) != kUpdateNewArchivePostCharID)
- ThrowUserErrorException();
- CUpdateArchiveCommand uc;
- UString archivePath = postString.Mid(1);
- if (archivePath.IsEmpty())
- ThrowUserErrorException();
- uc.UserArchivePath = archivePath;
- uc.ActionSet = actionSet;
- options.Commands.Add(uc);
- }
- }
- }
-}
-
-static const char kByteSymbol = 'B';
-static const char kKiloSymbol = 'K';
-static const char kMegaSymbol = 'M';
-static const char kGigaSymbol = 'G';
-
-static bool ParseComplexSize(const UString &src, UInt64 &result)
-{
- UString s = src;
- s.MakeUpper();
-
- const wchar_t *start = s;
- const wchar_t *end;
- UInt64 number = ConvertStringToUInt64(start, &end);
- int numDigits = (int)(end - start);
- if (numDigits == 0 || s.Length() > numDigits + 1)
- return false;
- if (s.Length() == numDigits)
- {
- result = number;
- return true;
- }
- int numBits;
- switch (s[numDigits])
- {
- case kByteSymbol:
- result = number;
- return true;
- case kKiloSymbol:
- numBits = 10;
- break;
- case kMegaSymbol:
- numBits = 20;
- break;
- case kGigaSymbol:
- numBits = 30;
- break;
- default:
- return false;
- }
- if (number >= ((UInt64)1 << (64 - numBits)))
- return false;
- result = number << numBits;
- return true;
-}
-
-static void SetAddCommandOptions(
- NCommandType::EEnum commandType,
- const CParser &parser,
- CUpdateOptions &options)
-{
- NUpdateArchive::CActionSet defaultActionSet;
- switch(commandType)
- {
- case NCommandType::kAdd:
- defaultActionSet = NUpdateArchive::kAddActionSet;
- break;
- case NCommandType::kDelete:
- defaultActionSet = NUpdateArchive::kDeleteActionSet;
- break;
- default:
- defaultActionSet = NUpdateArchive::kUpdateActionSet;
- }
-
- options.UpdateArchiveItself = true;
-
- options.Commands.Clear();
- CUpdateArchiveCommand updateMainCommand;
- updateMainCommand.ActionSet = defaultActionSet;
- options.Commands.Add(updateMainCommand);
- if (parser[NKey::kUpdate].ThereIs)
- ParseUpdateCommandString(options, parser[NKey::kUpdate].PostStrings,
- defaultActionSet);
- if (parser[NKey::kWorkingDir].ThereIs)
- {
- const UString &postString = parser[NKey::kWorkingDir].PostStrings[0];
- if (postString.IsEmpty())
- NDirectory::MyGetTempPath(options.WorkingDir);
- else
- options.WorkingDir = postString;
- }
- options.SfxMode = parser[NKey::kSfx].ThereIs;
- if (options.SfxMode)
- options.SfxModule = parser[NKey::kSfx].PostStrings[0];
-
- if (parser[NKey::kVolume].ThereIs)
- {
- const UStringVector &sv = parser[NKey::kVolume].PostStrings;
- for (int i = 0; i < sv.Size(); i++)
- {
- UInt64 size = 0;
- if (!ParseComplexSize(sv[i], size))
- ThrowException("Incorrect volume size");
- options.VolumesSizes.Add(size);
- }
- }
-}
-
-static void SetMethodOptions(const CParser &parser, CObjectVector<CProperty> &properties)
-{
- if (parser[NKey::kProperty].ThereIs)
- {
- // options.MethodMode.Properties.Clear();
- for (int i = 0; i < parser[NKey::kProperty].PostStrings.Size(); i++)
- {
- CProperty property;
- const UString &postString = parser[NKey::kProperty].PostStrings[i];
- int index = postString.Find(L'=');
- if (index < 0)
- property.Name = postString;
- else
- {
- property.Name = postString.Left(index);
- property.Value = postString.Mid(index + 1);
- }
- properties.Add(property);
- }
- }
-}
-
-CArchiveCommandLineParser::CArchiveCommandLineParser():
- parser(sizeof(kSwitchForms) / sizeof(kSwitchForms[0])) {}
-
-void CArchiveCommandLineParser::Parse1(const UStringVector &commandStrings,
- CArchiveCommandLineOptions &options)
-{
- try
- {
- parser.ParseStrings(kSwitchForms, commandStrings);
- }
- catch(...)
- {
- ThrowUserErrorException();
- }
-
- options.IsInTerminal = MY_IS_TERMINAL(stdin);
- options.IsStdOutTerminal = MY_IS_TERMINAL(stdout);
- options.IsStdErrTerminal = MY_IS_TERMINAL(stderr);
- options.StdInMode = parser[NKey::kStdIn].ThereIs;
- options.StdOutMode = parser[NKey::kStdOut].ThereIs;
- options.EnableHeaders = !parser[NKey::kDisableHeaders].ThereIs;
- options.HelpMode = parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs || parser[NKey::kHelp3].ThereIs;
-
- #ifdef _WIN32
- options.LargePages = false;
- if (parser[NKey::kLargePages].ThereIs)
- {
- const UString &postString = parser[NKey::kLargePages].PostStrings.Front();
- if (postString.IsEmpty())
- options.LargePages = true;
- }
- #endif
-}
-
-static bool ConvertStringToUInt32(const wchar_t *s, UInt32 &v)
-{
- const wchar_t *end;
- UInt64 number = ConvertStringToUInt64(s, &end);
- if (*end != 0)
- return false;
- if (number > (UInt32)0xFFFFFFFF)
- return false;
- v = (UInt32)number;
- return true;
-}
-
-void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
-{
- const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
- int numNonSwitchStrings = nonSwitchStrings.Size();
- if (numNonSwitchStrings < kMinNonSwitchWords)
- ThrowUserErrorException();
-
- if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], options.Command))
- ThrowUserErrorException();
-
- options.TechMode = parser[NKey::kTechMode].ThereIs;
- options.CalcCrc = parser[NKey::kCalcCrc].ThereIs;
-
- if (parser[NKey::kCaseSensitive].ThereIs)
- g_CaseSensitive = (parser[NKey::kCaseSensitive].PostCharIndex < 0);
-
- NRecursedType::EEnum recursedType;
- if (parser[NKey::kRecursed].ThereIs)
- recursedType = GetRecursedTypeFromIndex(parser[NKey::kRecursed].PostCharIndex);
- else
- recursedType = NRecursedType::kNonRecursed;
-
- UINT codePage = CP_ACP;
-
- bool thereAreSwitchIncludes = false;
- if (parser[NKey::kInclude].ThereIs)
- {
- thereAreSwitchIncludes = true;
- AddSwitchWildCardsToCensor(options.WildcardCensor,
- parser[NKey::kInclude].PostStrings, true, recursedType, codePage);
- }
- if (parser[NKey::kExclude].ThereIs)
- AddSwitchWildCardsToCensor(options.WildcardCensor,
- parser[NKey::kExclude].PostStrings, false, recursedType, codePage);
-
- int curCommandIndex = kCommandIndex + 1;
- bool thereIsArchiveName = !parser[NKey::kNoArName].ThereIs &&
- options.Command.CommandType != NCommandType::kBenchmark &&
- options.Command.CommandType != NCommandType::kInfo;
-
- bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
- bool isExtractOrList = isExtractGroupCommand || options.Command.CommandType == NCommandType::kList;
-
- if (isExtractOrList && options.StdInMode)
- thereIsArchiveName = false;
-
- if (thereIsArchiveName)
- {
- if (curCommandIndex >= numNonSwitchStrings)
- ThrowUserErrorException();
- options.ArchiveName = nonSwitchStrings[curCommandIndex++];
- }
-
- AddToCensorFromNonSwitchesStrings(
- curCommandIndex, options.WildcardCensor,
- nonSwitchStrings, recursedType, thereAreSwitchIncludes, codePage);
-
- options.YesToAll = parser[NKey::kYes].ThereIs;
-
-#ifdef HAVE_LSTAT
- global_use_lstat = !parser[NKey::kUseLStat].ThereIs;
-#endif
-
- #ifndef _NO_CRYPTO
- options.PasswordEnabled = parser[NKey::kPassword].ThereIs;
- if (options.PasswordEnabled)
- options.Password = parser[NKey::kPassword].PostStrings[0];
- #endif
-
- options.ShowDialog = parser[NKey::kShowDialog].ThereIs;
-
- if (parser[NKey::kArchiveType].ThereIs)
- options.ArcType = parser[NKey::kArchiveType].PostStrings[0];
-
- if (isExtractOrList)
- {
- if (!options.WildcardCensor.AllAreRelative())
- ThrowException("Cannot use absolute pathnames for this command");
-
- NWildcard::CCensor archiveWildcardCensor;
-
- if (parser[NKey::kArInclude].ThereIs)
- {
- AddSwitchWildCardsToCensor(archiveWildcardCensor,
- parser[NKey::kArInclude].PostStrings, true, NRecursedType::kNonRecursed, codePage);
- }
- if (parser[NKey::kArExclude].ThereIs)
- AddSwitchWildCardsToCensor(archiveWildcardCensor,
- parser[NKey::kArExclude].PostStrings, false, NRecursedType::kNonRecursed, codePage);
-
- bool directlyAddArchiveName = false;
- if (thereIsArchiveName) {
- if ((options.ArchiveName.Find(kUniversalWildcard) == -1) && (options.ArchiveName.Find(L"?") == -1)) {
- // no wildcard => no need to scan
- directlyAddArchiveName = true;
- } else {
- AddCommandLineWildCardToCensr(archiveWildcardCensor, options.ArchiveName, true, NRecursedType::kNonRecursed);
- }
- }
-
- #ifdef _WIN32
- ConvertToLongNames(archiveWildcardCensor);
- #endif
-
- archiveWildcardCensor.ExtendExclude();
-
- if (options.StdInMode)
- {
- UString arcName = parser[NKey::kStdIn].PostStrings.Front();
- options.ArchivePathsSorted.Add(arcName);
- options.ArchivePathsFullSorted.Add(arcName);
- }
- else
- {
-
- UStringVector archivePaths;
-
- {
- CDirItems dirItems;
- {
- UStringVector errorPaths;
- CRecordVector<DWORD> errorCodes;
- HRESULT res = EnumerateItems(archiveWildcardCensor, dirItems, NULL, errorPaths, errorCodes);
- if (res != S_OK || errorPaths.Size() > 0)
- throw "cannot find archive";
- }
- for (int i = 0; i < dirItems.Items.Size(); i++)
- {
- const CDirItem &dirItem = dirItems.Items[i];
- if (!dirItem.IsDir())
- archivePaths.Add(dirItems.GetPhyPath(i));
- }
- }
-
- // Because the pathname of archive can be a symbolic link
- // do not use "AddCommandLineWildCardToCensr(archiveWildcardCensor, options.ArchiveName"
- if (directlyAddArchiveName)
- archivePaths.Add(options.ArchiveName);
-
- if (archivePaths.Size() == 0)
- throw "there is no such archive";
-
- UStringVector archivePathsFull;
-
- int i;
- for (i = 0; i < archivePaths.Size(); i++)
- {
- UString fullPath;
- NFile::NDirectory::MyGetFullPathName(archivePaths[i], fullPath);
- archivePathsFull.Add(fullPath);
- }
- CIntVector indices;
- SortFileNames(archivePathsFull, indices);
- options.ArchivePathsSorted.Reserve(indices.Size());
- options.ArchivePathsFullSorted.Reserve(indices.Size());
- for (i = 0; i < indices.Size(); i++)
- {
- options.ArchivePathsSorted.Add(archivePaths[indices[i]]);
- options.ArchivePathsFullSorted.Add(archivePathsFull[indices[i]]);
- }
-
- }
-
- if (isExtractGroupCommand)
- {
- SetMethodOptions(parser, options.ExtractProperties);
- if (options.StdOutMode && options.IsStdOutTerminal && options.IsStdErrTerminal)
- throw kSameTerminalError;
- if (parser[NKey::kOutputDir].ThereIs)
- {
- options.OutputDir = parser[NKey::kOutputDir].PostStrings[0];
- NFile::NName::NormalizeDirPathPrefix(options.OutputDir);
- }
-
- options.OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
- if (parser[NKey::kOverwrite].ThereIs)
- options.OverwriteMode =
- k_OverwriteModes[parser[NKey::kOverwrite].PostCharIndex];
- else if (options.YesToAll)
- options.OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt;
- }
- }
- else if (options.Command.IsFromUpdateGroup())
- {
- CUpdateOptions &updateOptions = options.UpdateOptions;
-
- SetAddCommandOptions(options.Command.CommandType, parser, updateOptions);
-
- SetMethodOptions(parser, updateOptions.MethodMode.Properties);
-
- options.EnablePercents = !parser[NKey::kDisablePercents].ThereIs;
-
- if (options.EnablePercents)
- {
- if ((options.StdOutMode && !options.IsStdErrTerminal) ||
- (!options.StdOutMode && !options.IsStdOutTerminal))
- options.EnablePercents = false;
- }
-
- updateOptions.EMailMode = parser[NKey::kEmail].ThereIs;
- if (updateOptions.EMailMode)
- {
- updateOptions.EMailAddress = parser[NKey::kEmail].PostStrings.Front();
- if (updateOptions.EMailAddress.Length() > 0)
- if (updateOptions.EMailAddress[0] == L'.')
- {
- updateOptions.EMailRemoveAfter = true;
- updateOptions.EMailAddress.Delete(0);
- }
- }
-
- updateOptions.StdOutMode = options.StdOutMode;
- updateOptions.StdInMode = options.StdInMode;
-
- if (updateOptions.StdOutMode && updateOptions.EMailMode)
- throw "stdout mode and email mode cannot be combined";
- if (updateOptions.StdOutMode && options.IsStdOutTerminal)
- throw kTerminalOutError;
- if (updateOptions.StdInMode)
- updateOptions.StdInFileName = parser[NKey::kStdIn].PostStrings.Front();
-
- #ifdef _WIN32
- ConvertToLongNames(options.WildcardCensor);
- #endif
- }
- else if (options.Command.CommandType == NCommandType::kBenchmark)
- {
- options.NumThreads = (UInt32)-1;
- options.DictionarySize = (UInt32)-1;
- options.NumIterations = 1;
- if (curCommandIndex < numNonSwitchStrings)
- {
- if (!ConvertStringToUInt32(nonSwitchStrings[curCommandIndex++], options.NumIterations))
- ThrowUserErrorException();
- }
- for (int i = 0; i < parser[NKey::kProperty].PostStrings.Size(); i++)
- {
- UString postString = parser[NKey::kProperty].PostStrings[i];
- postString.MakeUpper();
- if (postString.Length() < 2)
- ThrowUserErrorException();
- if (postString[0] == 'D')
- {
- int pos = 1;
- if (postString[pos] == '=')
- pos++;
- UInt32 logSize;
- if (!ConvertStringToUInt32((const wchar_t *)postString + pos, logSize))
- ThrowUserErrorException();
- if (logSize > 31)
- ThrowUserErrorException();
- options.DictionarySize = 1 << logSize;
- }
- else if (postString[0] == 'M' && postString[1] == 'T' )
- {
- int pos = 2;
- if (postString[pos] == '=')
- pos++;
- if (postString[pos] != 0)
- if (!ConvertStringToUInt32((const wchar_t *)postString + pos, options.NumThreads))
- ThrowUserErrorException();
- }
- else if (postString[0] == 'M' && postString[1] == '=' )
- {
- int pos = 2;
- if (postString[pos] != 0)
- options.Method = postString.Mid(2);
- }
- else
- ThrowUserErrorException();
- }
- }
- else if (options.Command.CommandType == NCommandType::kInfo)
- {
- }
- else
- ThrowUserErrorException();
- options.WildcardCensor.ExtendExclude();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveCommandLine.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveCommandLine.h
deleted file mode 100644
index 6f79b7eeb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveCommandLine.h
+++ /dev/null
@@ -1,107 +0,0 @@
-// ArchiveCommandLine.h
-
-#ifndef __ARCHIVECOMMANDLINE_H
-#define __ARCHIVECOMMANDLINE_H
-
-#include "Common/Wildcard.h"
-#include "Common/CommandLineParser.h"
-
-#include "Extract.h"
-#include "Update.h"
-
-struct CArchiveCommandLineException: public AString
-{
- CArchiveCommandLineException(const char *errorMessage): AString(errorMessage) {}
-};
-
-namespace NCommandType { enum EEnum
-{
- kAdd = 0,
- kUpdate,
- kDelete,
- kTest,
- kExtract,
- kFullExtract,
- kList,
- kBenchmark,
- kInfo
-};}
-
-namespace NRecursedType { enum EEnum
-{
- kRecursed,
- kWildCardOnlyRecursed,
- kNonRecursed
-};}
-
-struct CArchiveCommand
-{
- NCommandType::EEnum CommandType;
- bool IsFromExtractGroup() const;
- bool IsFromUpdateGroup() const;
- bool IsTestMode() const { return CommandType == NCommandType::kTest; }
- NExtract::NPathMode::EEnum GetPathMode() const;
-};
-
-struct CArchiveCommandLineOptions
-{
- bool HelpMode;
-
- #ifdef _WIN32
- bool LargePages;
- #endif
-
- bool IsInTerminal;
- bool IsStdOutTerminal;
- bool IsStdErrTerminal;
- bool StdInMode;
- bool StdOutMode;
- bool EnableHeaders;
-
- bool YesToAll;
- bool ShowDialog;
- // NWildcard::CCensor ArchiveWildcardCensor;
- NWildcard::CCensor WildcardCensor;
-
- CArchiveCommand Command;
- UString ArchiveName;
-
- #ifndef _NO_CRYPTO
- bool PasswordEnabled;
- UString Password;
- #endif
-
- bool TechMode;
- // Extract
- bool CalcCrc;
- bool AppendName;
- UString OutputDir;
- NExtract::NOverwriteMode::EEnum OverwriteMode;
- UStringVector ArchivePathsSorted;
- UStringVector ArchivePathsFullSorted;
- CObjectVector<CProperty> ExtractProperties;
-
- CUpdateOptions UpdateOptions;
- UString ArcType;
- bool EnablePercents;
-
- // Benchmark
- UInt32 NumIterations;
- UInt32 NumThreads;
- UInt32 DictionarySize;
- UString Method;
-
-
- CArchiveCommandLineOptions(): StdInMode(false), StdOutMode(false) {};
-};
-
-class CArchiveCommandLineParser
-{
- NCommandLineParser::CParser parser;
-public:
- CArchiveCommandLineParser();
- void Parse1(const UStringVector &commandStrings, CArchiveCommandLineOptions &options);
- void Parse2(CArchiveCommandLineOptions &options);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
deleted file mode 100644
index f3d831e05..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveExtractCallback.cpp
+++ /dev/null
@@ -1,494 +0,0 @@
-// ArchiveExtractCallback.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/Wildcard.h"
-
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "../../Common/FilePathAutoRename.h"
-
-#include "../Common/ExtractingFilePath.h"
-
-#include "ArchiveExtractCallback.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-static const wchar_t *kCantAutoRename = L"ERROR: Can not create file with auto name";
-static const wchar_t *kCantRenameFile = L"ERROR: Can not rename existing file ";
-static const wchar_t *kCantDeleteOutputFile = L"ERROR: Can not delete output file ";
-
-void CArchiveExtractCallback::Init(
- const NWildcard::CCensorNode *wildcardCensor,
- const CArc *arc,
- IFolderArchiveExtractCallback *extractCallback2,
- bool stdOutMode, bool testMode, bool crcMode,
- const UString &directoryPath,
- const UStringVector &removePathParts,
- UInt64 packSize)
-{
- _wildcardCensor = wildcardCensor;
-
- _stdOutMode = stdOutMode;
- _testMode = testMode;
- _crcMode = crcMode;
- _unpTotal = 1;
- _packTotal = packSize;
-
- _extractCallback2 = extractCallback2;
- _compressProgress.Release();
- _extractCallback2.QueryInterface(IID_ICompressProgressInfo, &_compressProgress);
-
- LocalProgressSpec->Init(extractCallback2, true);
- LocalProgressSpec->SendProgress = false;
-
-
- _removePathParts = removePathParts;
- _arc = arc;
- _directoryPath = directoryPath;
- NFile::NName::NormalizeDirPathPrefix(_directoryPath);
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetTotal(UInt64 size)
-{
- COM_TRY_BEGIN
- _unpTotal = size;
- if (!_multiArchives && _extractCallback2)
- return _extractCallback2->SetTotal(size);
- return S_OK;
- COM_TRY_END
-}
-
-static void NormalizeVals(UInt64 &v1, UInt64 &v2)
-{
- const UInt64 kMax = (UInt64)1 << 31;
- while (v1 > kMax)
- {
- v1 >>= 1;
- v2 >>= 1;
- }
-}
-
-static UInt64 MyMultDiv64(UInt64 unpCur, UInt64 unpTotal, UInt64 packTotal)
-{
- NormalizeVals(packTotal, unpTotal);
- NormalizeVals(unpCur, unpTotal);
- if (unpTotal == 0)
- unpTotal = 1;
- return unpCur * packTotal / unpTotal;
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetCompleted(const UInt64 *completeValue)
-{
- COM_TRY_BEGIN
- if (!_extractCallback2)
- return S_OK;
-
- if (_multiArchives)
- {
- if (completeValue != NULL)
- {
- UInt64 packCur = LocalProgressSpec->InSize + MyMultDiv64(*completeValue, _unpTotal, _packTotal);
- return _extractCallback2->SetCompleted(&packCur);
- }
- }
- return _extractCallback2->SetCompleted(completeValue);
- COM_TRY_END
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
- COM_TRY_BEGIN
- return _localProgress->SetRatioInfo(inSize, outSize);
- COM_TRY_END
-}
-
-void CArchiveExtractCallback::CreateComplexDirectory(const UStringVector &dirPathParts, UString &fullPath)
-{
- fullPath = _directoryPath;
- for (int i = 0; i < dirPathParts.Size(); i++)
- {
- if (i > 0)
- fullPath += wchar_t(NFile::NName::kDirDelimiter);
- fullPath += dirPathParts[i];
- NFile::NDirectory::MyCreateDirectory(fullPath);
- }
-}
-
-HRESULT CArchiveExtractCallback::GetTime(int index, PROPID propID, FILETIME &filetime, bool &filetimeIsDefined)
-{
- filetimeIsDefined = false;
- NCOM::CPropVariant prop;
- RINOK(_arc->Archive->GetProperty(index, propID, &prop));
- if (prop.vt == VT_FILETIME)
- {
- filetime = prop.filetime;
- filetimeIsDefined = (filetime.dwHighDateTime != 0 || filetime.dwLowDateTime != 0);
- }
- else if (prop.vt != VT_EMPTY)
- return E_FAIL;
- return S_OK;
-}
-
-HRESULT CArchiveExtractCallback::GetUnpackSize()
-{
- NCOM::CPropVariant prop;
- RINOK(_arc->Archive->GetProperty(_index, kpidSize, &prop));
- _curSizeDefined = (prop.vt != VT_EMPTY);
- if (_curSizeDefined)
- _curSize = ConvertPropVariantToUInt64(prop);
- return S_OK;
-}
-
-STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode)
-{
- COM_TRY_BEGIN
- _crcStream.Release();
- *outStream = 0;
- _outFileStream.Release();
-
- _encrypted = false;
- _isSplit = false;
- _curSize = 0;
- _curSizeDefined = false;
- _index = index;
-
- UString fullPath;
-
- IInArchive *archive = _arc->Archive;
- RINOK(_arc->GetItemPath(index, fullPath));
- RINOK(IsArchiveItemFolder(archive, index, _fi.IsDir));
-
- _filePath = fullPath;
-
- {
- NCOM::CPropVariant prop;
- RINOK(archive->GetProperty(index, kpidPosition, &prop));
- if (prop.vt != VT_EMPTY)
- {
- if (prop.vt != VT_UI8)
- return E_FAIL;
- _position = prop.uhVal.QuadPart;
- _isSplit = true;
- }
- }
-
- RINOK(GetArchiveItemBoolProp(archive, index, kpidEncrypted, _encrypted));
-
- RINOK(GetUnpackSize());
-
- if (_wildcardCensor)
- {
- if (!_wildcardCensor->CheckPath(fullPath, !_fi.IsDir))
- return S_OK;
- }
-
- if (askExtractMode == NArchive::NExtract::NAskMode::kExtract && !_testMode)
- {
- if (_stdOutMode)
- {
- CMyComPtr<ISequentialOutStream> outStreamLoc = new CStdOutFileStream;
- *outStream = outStreamLoc.Detach();
- return S_OK;
- }
-
- {
- NCOM::CPropVariant prop;
- RINOK(archive->GetProperty(index, kpidAttrib, &prop));
- if (prop.vt == VT_UI4)
- {
- _fi.Attrib = prop.ulVal;
- _fi.AttribDefined = true;
- }
- else if (prop.vt == VT_EMPTY)
- _fi.AttribDefined = false;
- else
- return E_FAIL;
- }
-
- RINOK(GetTime(index, kpidCTime, _fi.CTime, _fi.CTimeDefined));
- RINOK(GetTime(index, kpidATime, _fi.ATime, _fi.ATimeDefined));
- RINOK(GetTime(index, kpidMTime, _fi.MTime, _fi.MTimeDefined));
-
- bool isAnti = false;
- RINOK(_arc->IsItemAnti(index, isAnti));
-
- UStringVector pathParts;
- SplitPathToParts(fullPath, pathParts);
-
- if (pathParts.IsEmpty())
- return E_FAIL;
- int numRemovePathParts = 0;
- switch(_pathMode)
- {
- case NExtract::NPathMode::kFullPathnames:
- break;
- case NExtract::NPathMode::kCurrentPathnames:
- {
- numRemovePathParts = _removePathParts.Size();
- if (pathParts.Size() <= numRemovePathParts)
- return E_FAIL;
- for (int i = 0; i < numRemovePathParts; i++)
- if (_removePathParts[i].CompareNoCase(pathParts[i]) != 0)
- return E_FAIL;
- break;
- }
- case NExtract::NPathMode::kNoPathnames:
- {
- numRemovePathParts = pathParts.Size() - 1;
- break;
- }
- }
- pathParts.Delete(0, numRemovePathParts);
- MakeCorrectPath(pathParts);
- UString processedPath = MakePathNameFromParts(pathParts);
- if (!isAnti)
- {
- if (!_fi.IsDir)
- {
- if (!pathParts.IsEmpty())
- pathParts.DeleteBack();
- }
-
- if (!pathParts.IsEmpty())
- {
- UString fullPathNew;
- CreateComplexDirectory(pathParts, fullPathNew);
- if (_fi.IsDir)
- NFile::NDirectory::SetDirTime(fullPathNew,
- (WriteCTime && _fi.CTimeDefined) ? &_fi.CTime : NULL,
- (WriteATime && _fi.ATimeDefined) ? &_fi.ATime : NULL,
- (WriteMTime && _fi.MTimeDefined) ? &_fi.MTime : (_arc->MTimeDefined ? &_arc->MTime : NULL));
- }
- }
-
-
- UString fullProcessedPath = _directoryPath + processedPath;
-
- if (_fi.IsDir)
- {
- _diskFilePath = fullProcessedPath;
- if (isAnti)
- NFile::NDirectory::MyRemoveDirectory(_diskFilePath);
- return S_OK;
- }
-
- if (!_isSplit)
- {
- NFile::NFind::CFileInfoW fileInfo;
- if (fileInfo.Find(fullProcessedPath))
- {
- switch(_overwriteMode)
- {
- case NExtract::NOverwriteMode::kSkipExisting:
- return S_OK;
- case NExtract::NOverwriteMode::kAskBefore:
- {
- Int32 overwiteResult;
- RINOK(_extractCallback2->AskOverwrite(
- fullProcessedPath, &fileInfo.MTime, &fileInfo.Size, fullPath,
- _fi.MTimeDefined ? &_fi.MTime : NULL,
- _curSizeDefined ? &_curSize : NULL,
- &overwiteResult))
-
- switch(overwiteResult)
- {
- case NOverwriteAnswer::kCancel:
- return E_ABORT;
- case NOverwriteAnswer::kNo:
- return S_OK;
- case NOverwriteAnswer::kNoToAll:
- _overwriteMode = NExtract::NOverwriteMode::kSkipExisting;
- return S_OK;
- case NOverwriteAnswer::kYesToAll:
- _overwriteMode = NExtract::NOverwriteMode::kWithoutPrompt;
- break;
- case NOverwriteAnswer::kYes:
- break;
- case NOverwriteAnswer::kAutoRename:
- _overwriteMode = NExtract::NOverwriteMode::kAutoRename;
- break;
- default:
- return E_FAIL;
- }
- }
- default:
- break;
- }
- if (_overwriteMode == NExtract::NOverwriteMode::kAutoRename)
- {
- if (!AutoRenamePath(fullProcessedPath))
- {
- UString message = UString(kCantAutoRename) + fullProcessedPath;
- RINOK(_extractCallback2->MessageError(message));
- return E_FAIL;
- }
- }
- else if (_overwriteMode == NExtract::NOverwriteMode::kAutoRenameExisting)
- {
- UString existPath = fullProcessedPath;
- if (!AutoRenamePath(existPath))
- {
- UString message = kCantAutoRename + fullProcessedPath;
- RINOK(_extractCallback2->MessageError(message));
- return E_FAIL;
- }
- if (!NFile::NDirectory::MyMoveFile(fullProcessedPath, existPath))
- {
- UString message = UString(kCantRenameFile) + fullProcessedPath;
- RINOK(_extractCallback2->MessageError(message));
- return E_FAIL;
- }
- }
- else
- if (!NFile::NDirectory::DeleteFileAlways(fullProcessedPath))
- {
- UString message = UString(kCantDeleteOutputFile) + fullProcessedPath;
- RINOK(_extractCallback2->MessageError(message));
- return S_OK;
- // return E_FAIL;
- }
- }
- }
- if (!isAnti)
- {
- _outFileStreamSpec = new COutFileStream;
- CMyComPtr<ISequentialOutStream> outStreamLoc(_outFileStreamSpec);
- if (!_outFileStreamSpec->Open(fullProcessedPath, _isSplit ? OPEN_ALWAYS: CREATE_ALWAYS))
- {
- // if (::GetLastError() != ERROR_FILE_EXISTS || !isSplit)
- {
- UString message = L"can not open output file " + fullProcessedPath;
- RINOK(_extractCallback2->MessageError(message));
- return S_OK;
- }
- }
- if (_isSplit)
- {
- RINOK(_outFileStreamSpec->Seek(_position, STREAM_SEEK_SET, NULL));
- }
- _outFileStream = outStreamLoc;
- *outStream = outStreamLoc.Detach();
- }
- _diskFilePath = fullProcessedPath;
- }
- else
- {
- *outStream = NULL;
- }
- if (_crcMode)
- {
- _crcStreamSpec = new COutStreamWithCRC;
- _crcStream = _crcStreamSpec;
- CMyComPtr<ISequentialOutStream> crcStream = _crcStreamSpec;
- _crcStreamSpec->SetStream(*outStream);
- if (*outStream)
- (*outStream)->Release();
- *outStream = crcStream.Detach();
- _crcStreamSpec->Init(true);
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
-{
- COM_TRY_BEGIN
- _extractMode = false;
- switch (askExtractMode)
- {
- case NArchive::NExtract::NAskMode::kExtract:
- if (_testMode)
- askExtractMode = NArchive::NExtract::NAskMode::kTest;
- else
- _extractMode = true;
- break;
- };
- return _extractCallback2->PrepareOperation(_filePath, _fi.IsDir,
- askExtractMode, _isSplit ? &_position: 0);
- COM_TRY_END
-}
-
-STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
-{
- COM_TRY_BEGIN
- switch(operationResult)
- {
- case NArchive::NExtract::NOperationResult::kOK:
- case NArchive::NExtract::NOperationResult::kUnSupportedMethod:
- case NArchive::NExtract::NOperationResult::kCRCError:
- case NArchive::NExtract::NOperationResult::kDataError:
- break;
- default:
- _outFileStream.Release();
- return E_FAIL;
- }
- if (_crcStream)
- {
- CrcSum += _crcStreamSpec->GetCRC();
- _curSize = _crcStreamSpec->GetSize();
- _curSizeDefined = true;
- _crcStream.Release();
- }
- if (_outFileStream)
- {
- _outFileStreamSpec->SetTime(
- (WriteCTime && _fi.CTimeDefined) ? &_fi.CTime : NULL,
- (WriteATime && _fi.ATimeDefined) ? &_fi.ATime : NULL,
- (WriteMTime && _fi.MTimeDefined) ? &_fi.MTime : (_arc->MTimeDefined ? &_arc->MTime : NULL));
- _curSize = _outFileStreamSpec->ProcessedSize;
- _curSizeDefined = true;
- RINOK(_outFileStreamSpec->Close());
- _outFileStream.Release();
- }
- if (!_curSizeDefined)
- GetUnpackSize();
- if (_curSizeDefined)
- UnpackSize += _curSize;
- if (_fi.IsDir)
- NumFolders++;
- else
- NumFiles++;
-
- if (_extractMode && _fi.AttribDefined)
- NFile::NDirectory::MySetFileAttributes(_diskFilePath, _fi.Attrib);
- RINOK(_extractCallback2->SetOperationResult(operationResult, _encrypted));
- return S_OK;
- COM_TRY_END
-}
-
-/*
-STDMETHODIMP CArchiveExtractCallback::GetInStream(
- const wchar_t *name, ISequentialInStream **inStream)
-{
- COM_TRY_BEGIN
- CInFileStream *inFile = new CInFileStream;
- CMyComPtr<ISequentialInStream> inStreamTemp = inFile;
- if (!inFile->Open(_srcDirectoryPrefix + name))
- return ::GetLastError();
- *inStream = inStreamTemp.Detach();
- return S_OK;
- COM_TRY_END
-}
-*/
-
-STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
-{
- COM_TRY_BEGIN
- if (!_cryptoGetTextPassword)
- {
- RINOK(_extractCallback2.QueryInterface(IID_ICryptoGetTextPassword,
- &_cryptoGetTextPassword));
- }
- return _cryptoGetTextPassword->CryptoGetTextPassword(password);
- COM_TRY_END
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveExtractCallback.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveExtractCallback.h
deleted file mode 100644
index 367e4b07d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveExtractCallback.h
+++ /dev/null
@@ -1,143 +0,0 @@
-// ArchiveExtractCallback.h
-
-#ifndef __ARCHIVE_EXTRACT_CALLBACK_H
-#define __ARCHIVE_EXTRACT_CALLBACK_H
-
-#include "Common/MyCom.h"
-#include "Common/Wildcard.h"
-
-#include "../../IPassword.h"
-
-#include "../../Common/FileStreams.h"
-#include "../../Common/ProgressUtils.h"
-
-#include "../../Archive/IArchive.h"
-
-#include "../../Archive/Common/OutStreamWithCRC.h"
-
-#include "ExtractMode.h"
-#include "IFileExtractCallback.h"
-#include "OpenArchive.h"
-
-class CArchiveExtractCallback:
- public IArchiveExtractCallback,
- // public IArchiveVolumeExtractCallback,
- public ICryptoGetTextPassword,
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
- const CArc *_arc;
- const NWildcard::CCensorNode *_wildcardCensor;
- CMyComPtr<IFolderArchiveExtractCallback> _extractCallback2;
- CMyComPtr<ICompressProgressInfo> _compressProgress;
- CMyComPtr<ICryptoGetTextPassword> _cryptoGetTextPassword;
- UString _directoryPath;
- NExtract::NPathMode::EEnum _pathMode;
- NExtract::NOverwriteMode::EEnum _overwriteMode;
-
- UString _diskFilePath;
- UString _filePath;
- UInt64 _position;
- bool _isSplit;
-
- bool _extractMode;
-
- bool WriteCTime;
- bool WriteATime;
- bool WriteMTime;
-
- bool _encrypted;
-
- struct CProcessedFileInfo
- {
- FILETIME CTime;
- FILETIME ATime;
- FILETIME MTime;
- UInt32 Attrib;
-
- bool CTimeDefined;
- bool ATimeDefined;
- bool MTimeDefined;
- bool AttribDefined;
-
- bool IsDir;
- } _fi;
-
- UInt32 _index;
- UInt64 _curSize;
- bool _curSizeDefined;
- COutFileStream *_outFileStreamSpec;
- CMyComPtr<ISequentialOutStream> _outFileStream;
-
- COutStreamWithCRC *_crcStreamSpec;
- CMyComPtr<ISequentialOutStream> _crcStream;
-
- UStringVector _removePathParts;
-
- bool _stdOutMode;
- bool _testMode;
- bool _crcMode;
- bool _multiArchives;
-
- CMyComPtr<ICompressProgressInfo> _localProgress;
- UInt64 _packTotal;
- UInt64 _unpTotal;
-
- void CreateComplexDirectory(const UStringVector &dirPathParts, UString &fullPath);
- HRESULT GetTime(int index, PROPID propID, FILETIME &filetime, bool &filetimeIsDefined);
- HRESULT GetUnpackSize();
-
-public:
-
- CLocalProgress *LocalProgressSpec;
-
- UInt64 NumFolders;
- UInt64 NumFiles;
- UInt64 UnpackSize;
- UInt32 CrcSum;
-
- MY_UNKNOWN_IMP2(ICryptoGetTextPassword, ICompressProgressInfo)
- // COM_INTERFACE_ENTRY(IArchiveVolumeExtractCallback)
-
- INTERFACE_IArchiveExtractCallback(;)
-
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-
- // IArchiveVolumeExtractCallback
- // STDMETHOD(GetInStream)(const wchar_t *name, ISequentialInStream **inStream);
-
- STDMETHOD(CryptoGetTextPassword)(BSTR *password);
-
- CArchiveExtractCallback():
- WriteCTime(true),
- WriteATime(true),
- WriteMTime(true),
- _multiArchives(false)
- {
- LocalProgressSpec = new CLocalProgress();
- _localProgress = LocalProgressSpec;
- }
-
- void InitForMulti(bool multiArchives,
- NExtract::NPathMode::EEnum pathMode,
- NExtract::NOverwriteMode::EEnum overwriteMode)
- {
- _multiArchives = multiArchives;
- _pathMode = pathMode;
- _overwriteMode = overwriteMode;
- NumFolders = NumFiles = UnpackSize = 0;
- CrcSum = 0;
- }
-
- void Init(
- const NWildcard::CCensorNode *wildcardCensor,
- const CArc *arc,
- IFolderArchiveExtractCallback *extractCallback2,
- bool stdOutMode, bool testMode, bool crcMode,
- const UString &directoryPath,
- const UStringVector &removePathParts,
- UInt64 packSize);
-
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveName.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveName.cpp
deleted file mode 100644
index c3684def8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveName.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-// ArchiveName.cpp
-
-#include "StdAfx.h"
-
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-
-#include "ExtractingFilePath.h"
-
-using namespace NWindows;
-
-static UString CreateArchiveName2(const UString &srcName, bool fromPrev, bool keepName)
-{
- UString resultName = L"Archive";
- if (fromPrev)
- {
- UString dirPrefix;
- if (NFile::NDirectory::GetOnlyDirPrefix(srcName, dirPrefix))
- {
- if (dirPrefix.Length() > 0)
- if (dirPrefix[dirPrefix.Length() - 1] == WCHAR_PATH_SEPARATOR)
- {
- dirPrefix.Delete(dirPrefix.Length() - 1);
- NFile::NFind::CFileInfoW fileInfo;
- if (fileInfo.Find(dirPrefix))
- resultName = fileInfo.Name;
- }
- }
- }
- else
- {
- NFile::NFind::CFileInfoW fileInfo;
- if (!fileInfo.Find(srcName))
- // return resultName;
- return srcName;
- resultName = fileInfo.Name;
- if (!fileInfo.IsDir() && !keepName)
- {
- int dotPos = resultName.ReverseFind('.');
- if (dotPos > 0)
- {
- UString archiveName2 = resultName.Left(dotPos);
- if (archiveName2.ReverseFind('.') < 0)
- resultName = archiveName2;
- }
- }
- }
- return resultName;
-}
-
-UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName)
-{
- return GetCorrectFsPath(CreateArchiveName2(srcName, fromPrev, keepName));
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveName.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveName.h
deleted file mode 100644
index 9513fb2ba..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveName.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// ArchiveName.h
-
-#ifndef __ARCHIVENAME_H
-#define __ARCHIVENAME_H
-
-#include "Common/MyString.h"
-
-UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp
deleted file mode 100644
index d4c713eb9..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-// ArchiveOpenCallback.cpp
-
-#include "StdAfx.h"
-
-#include "Common/StringConvert.h"
-#include "Common/ComTry.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../../Common/FileStreams.h"
-
-#include "ArchiveOpenCallback.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-STDMETHODIMP COpenCallbackImp::SetTotal(const UInt64 *files, const UInt64 *bytes)
-{
- COM_TRY_BEGIN
- if (ReOpenCallback)
- return ReOpenCallback->SetTotal(files, bytes);
- if (!Callback)
- return S_OK;
- return Callback->Open_SetTotal(files, bytes);
- COM_TRY_END
-}
-
-STDMETHODIMP COpenCallbackImp::SetCompleted(const UInt64 *files, const UInt64 *bytes)
-{
- COM_TRY_BEGIN
- if (ReOpenCallback)
- return ReOpenCallback->SetCompleted(files, bytes);
- if (!Callback)
- return S_OK;
- return Callback->Open_SetCompleted(files, bytes);
- COM_TRY_END
-}
-
-STDMETHODIMP COpenCallbackImp::GetProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NCOM::CPropVariant prop;
- if (_subArchiveMode)
- switch(propID)
- {
- case kpidName: prop = _subArchiveName; break;
- }
- else
- switch(propID)
- {
- case kpidName: prop = _fileInfo.Name; break;
- case kpidIsDir: prop = _fileInfo.IsDir(); break;
- case kpidSize: prop = _fileInfo.Size; break;
- case kpidAttrib: prop = (UInt32)_fileInfo.Attrib; break;
- case kpidCTime: prop = _fileInfo.CTime; break;
- case kpidATime: prop = _fileInfo.ATime; break;
- case kpidMTime: prop = _fileInfo.MTime; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-int COpenCallbackImp::FindName(const UString &name)
-{
- for (int i = 0; i < FileNames.Size(); i++)
- if (name.CompareNoCase(FileNames[i]) == 0)
- return i;
- return -1;
-}
-
-struct CInFileStreamVol: public CInFileStream
-{
- UString Name;
- COpenCallbackImp *OpenCallbackImp;
- CMyComPtr<IArchiveOpenCallback> OpenCallbackRef;
- ~CInFileStreamVol()
- {
- if (OpenCallbackRef) /* FIXED */
- {
- int index = OpenCallbackImp->FindName(Name);
- if (index >= 0)
- OpenCallbackImp->FileNames.Delete(index);
- }
- }
-};
-
-STDMETHODIMP COpenCallbackImp::GetStream(const wchar_t *name, IInStream **inStream)
-{
- COM_TRY_BEGIN
- if (_subArchiveMode)
- return S_FALSE;
- if (Callback)
- {
- RINOK(Callback->Open_CheckBreak());
- }
- *inStream = NULL;
- UString fullPath = _folderPrefix + name;
- if (!_fileInfo.Find(fullPath))
- return S_FALSE;
- if (_fileInfo.IsDir())
- return S_FALSE;
- CInFileStreamVol *inFile = new CInFileStreamVol;
- CMyComPtr<IInStream> inStreamTemp = inFile;
- if (!inFile->Open(fullPath))
- return ::GetLastError();
- *inStream = inStreamTemp.Detach();
- inFile->Name = name;
- inFile->OpenCallbackImp = this;
- inFile->OpenCallbackRef = this;
- FileNames.Add(name);
- TotalSize += _fileInfo.Size;
- return S_OK;
- COM_TRY_END
-}
-
-#ifndef _NO_CRYPTO
-STDMETHODIMP COpenCallbackImp::CryptoGetTextPassword(BSTR *password)
-{
- COM_TRY_BEGIN
- if (ReOpenCallback)
- {
- CMyComPtr<ICryptoGetTextPassword> getTextPassword;
- ReOpenCallback.QueryInterface(IID_ICryptoGetTextPassword, &getTextPassword);
- if (getTextPassword)
- return getTextPassword->CryptoGetTextPassword(password);
- }
- if (!Callback)
- return E_NOTIMPL;
- return Callback->Open_CryptoGetTextPassword(password);
- COM_TRY_END
-}
-#endif
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveOpenCallback.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveOpenCallback.h
deleted file mode 100644
index 4abe7e164..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ArchiveOpenCallback.h
+++ /dev/null
@@ -1,104 +0,0 @@
-// ArchiveOpenCallback.h
-
-#ifndef __ARCHIVE_OPEN_CALLBACK_H
-#define __ARCHIVE_OPEN_CALLBACK_H
-
-#include "Common/MyCom.h"
-#include "Common/MyString.h"
-
-#include "Windows/FileFind.h"
-
-#ifndef _NO_CRYPTO
-#include "../../IPassword.h"
-#endif
-#include "../../Archive/IArchive.h"
-
-#ifdef _NO_CRYPTO
-
-#define INTERFACE_IOpenCallbackUI_Crypto(x)
-
-#else
-
-#define INTERFACE_IOpenCallbackUI_Crypto(x) \
- virtual HRESULT Open_CryptoGetTextPassword(BSTR *password) x; \
- virtual HRESULT Open_GetPasswordIfAny(UString &password) x; \
- virtual bool Open_WasPasswordAsked() x; \
- virtual void Open_ClearPasswordWasAskedFlag() x; \
-
-#endif
-
-#define INTERFACE_IOpenCallbackUI(x) \
- virtual HRESULT Open_CheckBreak() x; \
- virtual HRESULT Open_SetTotal(const UInt64 *files, const UInt64 *bytes) x; \
- virtual HRESULT Open_SetCompleted(const UInt64 *files, const UInt64 *bytes) x; \
- INTERFACE_IOpenCallbackUI_Crypto(x)
-
-struct IOpenCallbackUI
-{
- virtual ~IOpenCallbackUI() {}
- INTERFACE_IOpenCallbackUI(=0)
-};
-
-class COpenCallbackImp:
- public IArchiveOpenCallback,
- public IArchiveOpenVolumeCallback,
- public IArchiveOpenSetSubArchiveName,
- #ifndef _NO_CRYPTO
- public ICryptoGetTextPassword,
- #endif
- public CMyUnknownImp
-{
-public:
- #ifndef _NO_CRYPTO
- MY_UNKNOWN_IMP3(
- IArchiveOpenVolumeCallback,
- ICryptoGetTextPassword,
- IArchiveOpenSetSubArchiveName
- )
- #else
- MY_UNKNOWN_IMP2(
- IArchiveOpenVolumeCallback,
- IArchiveOpenSetSubArchiveName
- )
- #endif
-
- INTERFACE_IArchiveOpenCallback(;)
- INTERFACE_IArchiveOpenVolumeCallback(;)
-
- #ifndef _NO_CRYPTO
- STDMETHOD(CryptoGetTextPassword)(BSTR *password);
- #endif
-
- STDMETHOD(SetSubArchiveName(const wchar_t *name))
- {
- _subArchiveMode = true;
- _subArchiveName = name;
- TotalSize = 0;
- return S_OK;
- }
-
-private:
- UString _folderPrefix;
- NWindows::NFile::NFind::CFileInfoW _fileInfo;
- bool _subArchiveMode;
- UString _subArchiveName;
-public:
- UStringVector FileNames;
- IOpenCallbackUI *Callback;
- CMyComPtr<IArchiveOpenCallback> ReOpenCallback;
- UInt64 TotalSize;
-
- COpenCallbackImp(): Callback(NULL) {}
- void Init(const UString &folderPrefix, const UString &fileName)
- {
- _folderPrefix = folderPrefix;
- if (!_fileInfo.Find(_folderPrefix + fileName))
- throw 1;
- FileNames.Clear();
- _subArchiveMode = false;
- TotalSize = 0;
- }
- int FindName(const UString &name);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/CompressCall.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/CompressCall.cpp
deleted file mode 100644
index 412422689..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/CompressCall.cpp
+++ /dev/null
@@ -1,446 +0,0 @@
-// CompressCall.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-
-#include "CompressCall.h"
-
-// FIXME #include "Common/Random.h"
-#include "Common/IntToString.h"
-#include "Common/MyCom.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/Synchronization.h"
-// FIXME #include "Windows/FileMapping.h"
-#include "Windows/FileDir.h"
-
-#include "../FileManager/ProgramLocation.h"
-#include "../FileManager/RegistryUtils.h"
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif // _UNICODE
-
-using namespace NWindows;
-
-static LPCWSTR kShowDialogSwitch = L" -ad";
-static LPCWSTR kEmailSwitch = L" -seml.";
-static LPCWSTR kMapSwitch = L" -i#";
-static LPCWSTR kArchiveNoNameSwitch = L" -an";
-static LPCWSTR kArchiveTypeSwitch = L" -t";
-static LPCWSTR kArchiveMapSwitch = L" -ai#";
-static LPCWSTR kStopSwitchParsing = L" --";
-static LPCWSTR kLargePagesDisable = L" -slp-";
-
-static void AddLagePagesSwitch(UString &params)
-{
-#ifdef _WIN32
- if (!ReadLockMemoryEnable())
- params += kLargePagesDisable;
-#endif
-}
-
-HRESULT MyCreateProcess(const UString &params,
- LPCWSTR curDir, bool waitFinish,
- NWindows::NSynchronization::CBaseEvent *event)
-{
- printf("MyCreateProcess: waitFinish=%d event=%p\n",(unsigned)waitFinish,event);
- printf("\tparams : %ls\n",(const wchar_t*)params);
- printf("\tcurDir : %ls\n",(const wchar_t*)curDir);
-
- wxString cmd(params);
- wxString memoCurDir = wxGetCwd();
-
- if (curDir) { // FIXME
- wxSetWorkingDirectory(wxString(curDir));
- }
-
- printf("MyCreateProcess: cmd='%ls'\n",(const wchar_t *)cmd);
- long pid = 0;
- if (waitFinish) pid = wxExecute(cmd, wxEXEC_SYNC); // FIXME process never ends and stays zombie ...
- else pid = wxExecute(cmd, wxEXEC_ASYNC);
-
- if (curDir) {
- wxSetWorkingDirectory(memoCurDir);
- }
-
- // FIXME if (pid == 0) return E_FAIL;
-
- return S_OK;
-#ifdef _WIN32 // FIXME
- const UString params2 = params;
- BOOL result;
- {
- STARTUPINFOW startupInfo;
- startupInfo.cb = sizeof(startupInfo);
- startupInfo.lpReserved = 0;
- startupInfo.lpDesktop = 0;
- startupInfo.lpTitle = 0;
- startupInfo.dwFlags = 0;
- startupInfo.cbReserved2 = 0;
- startupInfo.lpReserved2 = 0;
-
- result = ::CreateProcessW(NULL, (LPWSTR)(LPCWSTR)params,
- NULL, NULL, FALSE, 0, NULL,
- curDir,
- &startupInfo, &processInformation);
- }
- if (result == 0)
- return ::GetLastError();
- else
- {
- ::CloseHandle(processInformation.hThread);
- if (waitFinish)
- WaitForSingleObject(processInformation.hProcess, INFINITE);
- else if (event != NULL)
- {
- HANDLE handles[] = {processInformation.hProcess, *event };
- ::WaitForMultipleObjects(sizeof(handles) / sizeof(handles[0]),
- handles, FALSE, INFINITE);
- }
- ::CloseHandle(processInformation.hProcess);
- }
- return S_OK;
-#endif
-}
-
-static UString GetQuotedString(const UString &s)
-{
- return UString(L"\"") + s + UString(L"\"");
-}
-
-static UString Get7zGuiPath()
-{
- UString path;
- UString folder;
- if (GetProgramFolderPath(folder))
- path += folder;
-#ifdef _WIN32
- path += L"7zG.exe";
-#else
- path += L"7zG";
-#endif
- return GetQuotedString(path);
-}
-
-#ifdef _WIN32
-static HRESULT CreateTempEvent(const wchar_t *name,
- NSynchronization::CManualResetEvent &event, UString &eventName)
-{
- CRandom random;
- random.Init(GetTickCount());
- for (;;)
- {
- int number = random.Generate();
- wchar_t temp[32];
- ConvertUInt64ToString((UInt32)number, temp);
- eventName = name;
- eventName += temp;
- RINOK(event.CreateWithName(false, GetSystemString(eventName)));
- if (::GetLastError() != ERROR_ALREADY_EXISTS)
- return S_OK;
- event.Close();
- }
-}
-
-static HRESULT CreateMap(const UStringVector &names,
- const UString &id,
- CFileMapping &fileMapping, NSynchronization::CManualResetEvent &event,
- UString &params)
-{
- UInt32 extraSize = 2;
- UInt32 dataSize = 0;
- for (int i = 0; i < names.Size(); i++)
- dataSize += (names[i].Length() + 1) * sizeof(wchar_t);
- UInt32 totalSize = extraSize + dataSize;
-
- UString mappingName;
-
- CRandom random;
- random.Init(GetTickCount());
- for (;;)
- {
- int number = random.Generate();
- wchar_t temp[32];
- ConvertUInt64ToString(UInt32(number), temp);
- mappingName = id;
- mappingName += L"Mapping";
- mappingName += temp;
- if (!fileMapping.Create(INVALID_HANDLE_VALUE, NULL,
- PAGE_READWRITE, totalSize, GetSystemString(mappingName)))
- return E_FAIL;
- if (::GetLastError() != ERROR_ALREADY_EXISTS)
- break;
- fileMapping.Close();
- }
-
- UString eventName;
- RINOK(CreateTempEvent(id + L"MappingEndEvent", event, eventName));
-
- params += mappingName;
- params += L":";
- wchar_t string[10];
- ConvertUInt64ToString(totalSize, string);
- params += string;
-
- params += L":";
- params += eventName;
-
- LPVOID data = fileMapping.MapViewOfFile(FILE_MAP_WRITE, 0, totalSize);
- if (data == NULL)
- return E_FAIL;
- {
- wchar_t *curData = (wchar_t *)data;
- *curData = 0;
- curData++;
- for (int i = 0; i < names.Size(); i++)
- {
- const UString &s = names[i];
- memcpy(curData, (const wchar_t *)s, s.Length() * sizeof(wchar_t));
- curData += s.Length();
- *curData++ = L'\0';
- }
- }
- return S_OK;
-}
-#endif
-
-HRESULT CompressFiles(
- const UString &curDir,
- const UString &archiveName,
- const UString &archiveType,
- const UStringVector &names,
- // const UString &outFolder,
- bool email,
- bool showDialog,
- bool waitFinish)
-{
- /*
- UString curDir;
- if (names.Size() > 0)
- {
- NFile::NDirectory::GetOnlyDirPrefix(names[0], curDir);
- }
- */
- UString params;
- params = Get7zGuiPath();
- params += L" a";
-#ifdef _WIN32
- params += kMapSwitch;
- // params += _fileNames[0];
-
- UInt32 extraSize = 2;
- UInt32 dataSize = 0;
- for (int i = 0; i < names.Size(); i++)
- dataSize += (names[i].Length() + 1) * sizeof(wchar_t);
- UInt32 totalSize = extraSize + dataSize;
-
- UString mappingName;
-
- CFileMapping fileMapping;
- CRandom random;
- random.Init(GetTickCount());
- for (;;)
- {
- int number = random.Generate();
- wchar_t temp[32];
- ConvertUInt64ToString(UInt32(number), temp);
- mappingName = L"7zCompressMapping";
- mappingName += temp;
- if (!fileMapping.Create(INVALID_HANDLE_VALUE, NULL,
- PAGE_READWRITE, totalSize, GetSystemString(mappingName)))
- {
- // MyMessageBox(IDS_ERROR, 0x02000605);
- return E_FAIL;
- }
- if (::GetLastError() != ERROR_ALREADY_EXISTS)
- break;
- fileMapping.Close();
- }
-
- NSynchronization::CManualResetEvent event;
- UString eventName;
- RINOK(CreateTempEvent(L"7zCompressMappingEndEvent", event, eventName));
-
- params += mappingName;
- params += L":";
- wchar_t string[10];
- ConvertUInt64ToString(totalSize, string);
- params += string;
-
- params += L":";
- params += eventName;
-#else
- char tempFile[256];
- static int count = 1000;
-
- sprintf(tempFile,"/tmp/7zCompress_%d_%d.tmp",(int)getpid(),count++);
-
- FILE * file = fopen(tempFile,"w");
- if (file)
- {
- for (int i = 0; i < names.Size(); i++) {
- fprintf(file,"%ls\n",(const wchar_t *)names[i]);
- printf(" TMP_%d : '%ls'\n",i,(const wchar_t *)names[i]);
- }
-
- fclose(file);
- }
- params += L" -i@";
- params += GetUnicodeString(tempFile);
-#endif
-
- if (!archiveType.IsEmpty())
- {
- params += kArchiveTypeSwitch;
- params += archiveType;
- }
-
- if (email)
- params += kEmailSwitch;
-
- if (showDialog)
- params += kShowDialogSwitch;
-
- AddLagePagesSwitch(params);
-
- params += kStopSwitchParsing;
- params += L" ";
-
- params += GetQuotedString(archiveName);
-
-#ifdef _WIN32
- LPVOID data = fileMapping.MapViewOfFile(FILE_MAP_WRITE, 0, totalSize);
- if (data == NULL)
- {
- // MyMessageBox(IDS_ERROR, 0x02000605);
- return E_FAIL;
- }
- try
- {
- wchar_t *curData = (wchar_t *)data;
- *curData = 0;
- curData++;
- for (int i = 0; i < names.Size(); i++)
- {
- const UString &unicodeString = names[i];
- memcpy(curData, (const wchar_t *)unicodeString ,
- unicodeString .Length() * sizeof(wchar_t));
- curData += unicodeString.Length();
- *curData++ = L'\0';
- }
- // MessageBox(0, params, 0, 0);
- RINOK(MyCreateProcess(params,
- (curDir.IsEmpty()? 0: (LPCWSTR)curDir),
- waitFinish, &event));
- }
- catch(...)
- {
- UnmapViewOfFile(data);
- throw;
- }
- UnmapViewOfFile(data);
-
-
- /*
- CThreadCompressMain *compressor = new CThreadCompressMain();;
- compressor->FileNames = _fileNames;
- CThread thread;
- if (!thread.Create(CThreadCompressMain::MyThreadFunction, compressor))
- throw 271824;
- */
-#else
- printf("CompressFiles : -%ls-\n",(const wchar_t *)params);
- HRESULT res = MyCreateProcess(params,
- (curDir.IsEmpty()? 0: (LPCWSTR)curDir),
- true, /* &event FIXME */ 0);
- printf("CompressFiles : END\n");
-
- remove(tempFile);
-#endif
- return S_OK;
-}
-
-static HRESULT ExtractGroupCommand(const UStringVector &archivePaths,
- const UString &params)
-{
- UString params2 = params;
- AddLagePagesSwitch(params2);
- params2 += kArchiveNoNameSwitch;
-#ifdef _WIN32
- params2 += kArchiveMapSwitch;
- CFileMapping fileMapping;
- NSynchronization::CManualResetEvent event;
- RINOK(CreateMap(archivePaths, L"7zExtract", fileMapping, event, params2));
- return MyCreateProcess(params2, 0, false, &event);
-#else
- char tempFile[256];
- static int count = 1000;
-
- sprintf(tempFile,"/tmp/7zExtract_%d_%d.tmp",(int)getpid(),count++);
-
- FILE * file = fopen(tempFile,"w");
- if (file)
- {
- for (int i = 0; i < archivePaths.Size(); i++) {
- fprintf(file,"%ls\n",(const wchar_t *)archivePaths[i]);
- printf(" TMP_%d : '%ls'\n",i,(const wchar_t *)archivePaths[i]);
- }
-
- fclose(file);
- }
- params2 += L" -ai@";
- params2 += GetUnicodeString(tempFile);
- printf("ExtractGroupCommand : -%ls-\n",(const wchar_t *)params2);
- HRESULT res = MyCreateProcess(params2, 0, true, /* &event FIXME */ 0);
- printf("ExtractGroupCommand : END\n");
-
- remove(tempFile);
-
- return res;
-#endif
-}
-
-HRESULT ExtractArchives(const UStringVector &archivePaths,
- const UString &outFolder, bool showDialog)
-{
- UString params;
- params = Get7zGuiPath();
- params += L" x";
- if (!outFolder.IsEmpty())
- {
- params += L" \"-o";
- params += outFolder;
- params += L"\"";
- }
- if (showDialog)
- params += kShowDialogSwitch;
- return ExtractGroupCommand(archivePaths, params);
-}
-
-HRESULT TestArchives(const UStringVector &archivePaths)
-{
- UString params;
- params = Get7zGuiPath();
- params += L" t";
- return ExtractGroupCommand(archivePaths, params);
-}
-
-HRESULT Benchmark()
-{
- UString params;
- params = Get7zGuiPath();
- params += L" b";
- return MyCreateProcess(params, 0, false, NULL);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/CompressCall.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/CompressCall.h
deleted file mode 100644
index feb457906..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/CompressCall.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// CompressCall.h
-
-#ifndef __COMPRESSCALL_H
-#define __COMPRESSCALL_H
-
-#include "Common/MyString.h"
-#include "Windows/Synchronization.h"
-
-HRESULT MyCreateProcess(const UString &params,
- LPCWSTR lpCurrentDirectory, bool waitFinish,
- NWindows::NSynchronization::CBaseEvent *event);
-
-HRESULT CompressFiles(
- const UString &curDir,
- const UString &archiveName,
- const UString &archiveType,
- const UStringVector &names,
- // const UString &outFolder,
- bool email, bool showDialog, bool waitFinish);
-
-HRESULT ExtractArchives(
- const UStringVector &archivePaths,
- const UString &outFolder, bool showDialog);
-
-HRESULT TestArchives(const UStringVector &archivePaths);
-
-HRESULT Benchmark();
-
-#endif
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/DefaultName.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/DefaultName.cpp
deleted file mode 100644
index 4335e2731..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/DefaultName.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-// DefaultName.cpp
-
-#include "StdAfx.h"
-
-#include "DefaultName.h"
-
-static UString GetDefaultName3(const UString &fileName,
- const UString &extension, const UString &addSubExtension)
-{
- int extLength = extension.Length();
- int fileNameLength = fileName.Length();
- if (fileNameLength > extLength + 1)
- {
- int dotPos = fileNameLength - (extLength + 1);
- if (fileName[dotPos] == '.')
- if (extension.CompareNoCase(fileName.Mid(dotPos + 1)) == 0)
- return fileName.Left(dotPos) + addSubExtension;
- }
- int dotPos = fileName.ReverseFind(L'.');
- if (dotPos > 0)
- return fileName.Left(dotPos) + addSubExtension;
-
- if (addSubExtension.IsEmpty())
- return fileName + L"~";
- else
- return fileName + addSubExtension;
-}
-
-UString GetDefaultName2(const UString &fileName,
- const UString &extension, const UString &addSubExtension)
-{
- UString name = GetDefaultName3(fileName, extension, addSubExtension);
- name.TrimRight();
- return name;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/DefaultName.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/DefaultName.h
deleted file mode 100644
index 9764ff871..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/DefaultName.h
+++ /dev/null
@@ -1,11 +0,0 @@
-// DefaultName.h
-
-#ifndef __DEFAULTNAME_H
-#define __DEFAULTNAME_H
-
-#include "Common/MyString.h"
-
-UString GetDefaultName2(const UString &fileName,
- const UString &extension, const UString &addSubExtension);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/DirItem.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/DirItem.h
deleted file mode 100644
index 29cc60d93..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/DirItem.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// DirItem.h
-
-#ifndef __DIR_ITEM_H
-#define __DIR_ITEM_H
-
-#include "Common/MyString.h"
-#include "Common/Types.h"
-#include "../../Archive/IArchive.h"
-
-struct CDirItem
-{
- UInt64 Size;
- FILETIME CTime;
- FILETIME ATime;
- FILETIME MTime;
- UString Name;
- UInt32 Attrib;
- int PhyParent;
- int LogParent;
-
- CDirItem(): PhyParent(-1), LogParent(-1) {}
- bool IsDir() const { return (Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0 ; }
-};
-
-class CDirItems
-{
- UStringVector Prefixes;
- CIntVector PhyParents;
- CIntVector LogParents;
-
- UString GetPrefixesPath(const CIntVector &parents, int index, const UString &name) const;
-public:
- CObjectVector<CDirItem> Items;
-
- int GetNumFolders() const { return Prefixes.Size(); }
- UString GetPhyPath(int index) const;
- UString GetLogPath(int index) const;
-
- int AddPrefix(int phyParent, int logParent, const UString &prefix);
- void DeleteLastPrefix();
-
- void EnumerateDirectory(int phyParent, int logParent, const UString &phyPrefix,
- UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes);
-
- void EnumerateDirItems2(
- const UString &phyPrefix,
- const UString &logPrefix,
- const UStringVector &filePaths,
- UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes);
-
- void ReserveDown();
-};
-
-struct CArcItem
-{
- UInt64 Size;
- FILETIME MTime;
- UString Name;
- bool IsDir;
- bool SizeDefined;
- bool MTimeDefined;
- bool Censored;
- UInt32 IndexInServer;
- int TimeType;
-
- CArcItem(): IsDir(false), SizeDefined(false), MTimeDefined(false), Censored(false), TimeType(-1) {}
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/EnumDirItems.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/EnumDirItems.cpp
deleted file mode 100644
index ba03ea35c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/EnumDirItems.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-// EnumDirItems.cpp
-
-#include "StdAfx.h"
-
-#include "EnumDirItems.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NName;
-
-void AddDirFileInfo(int phyParent, int logParent,
- const NFind::CFileInfoW &fi, CObjectVector<CDirItem> &dirItems)
-{
- CDirItem di;
- di.Size = fi.Size;
- di.CTime = fi.CTime;
- di.ATime = fi.ATime;
- di.MTime = fi.MTime;
- di.Attrib = fi.Attrib;
- di.PhyParent = phyParent;
- di.LogParent = logParent;
- di.Name = fi.Name;
- dirItems.Add(di);
-}
-
-UString CDirItems::GetPrefixesPath(const CIntVector &parents, int index, const UString &name) const
-{
- UString path;
- int len = name.Length();
- int i;
- for (i = index; i >= 0; i = parents[i])
- len += Prefixes[i].Length();
- int totalLen = len;
- wchar_t *p = path.GetBuffer(len);
- p[len] = 0;
- len -= name.Length();
- memcpy(p + len, (const wchar_t *)name, name.Length() * sizeof(wchar_t));
- for (i = index; i >= 0; i = parents[i])
- {
- const UString &s = Prefixes[i];
- len -= s.Length();
- memcpy(p + len, (const wchar_t *)s, s.Length() * sizeof(wchar_t));
- }
- path.ReleaseBuffer(totalLen);
- return path;
-}
-
-UString CDirItems::GetPhyPath(int index) const
-{
- const CDirItem &di = Items[index];
- return GetPrefixesPath(PhyParents, di.PhyParent, di.Name);
-}
-
-UString CDirItems::GetLogPath(int index) const
-{
- const CDirItem &di = Items[index];
- return GetPrefixesPath(LogParents, di.LogParent, di.Name);
-}
-
-void CDirItems::ReserveDown()
-{
- Prefixes.ReserveDown();
- PhyParents.ReserveDown();
- LogParents.ReserveDown();
- Items.ReserveDown();
-}
-
-int CDirItems::AddPrefix(int phyParent, int logParent, const UString &prefix)
-{
- PhyParents.Add(phyParent);
- LogParents.Add(logParent);
- return Prefixes.Add(prefix);
-}
-
-void CDirItems::DeleteLastPrefix()
-{
- PhyParents.DeleteBack();
- LogParents.DeleteBack();
- Prefixes.DeleteBack();
-}
-
-void CDirItems::EnumerateDirectory(int phyParent, int logParent, const UString &phyPrefix,
- UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes)
-{
- NFind::CEnumeratorW enumerator(phyPrefix + (wchar_t)kAnyStringWildcard);
- for (;;)
- {
- NFind::CFileInfoW fi;
- bool found;
- if (!enumerator.Next(fi, found))
- {
- errorCodes.Add(::GetLastError());
- errorPaths.Add(phyPrefix);
- return;
- }
- if (!found)
- break;
- AddDirFileInfo(phyParent, logParent, fi, Items);
- if (fi.IsDir())
- {
- const UString name2 = fi.Name + (wchar_t)kDirDelimiter;
- int parent = AddPrefix(phyParent, logParent, name2);
- EnumerateDirectory(parent, parent, phyPrefix + name2, errorPaths, errorCodes);
- }
- }
-}
-
-void CDirItems::EnumerateDirItems2(const UString &phyPrefix, const UString &logPrefix,
- const UStringVector &filePaths, UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes)
-{
- int phyParent = phyPrefix.IsEmpty() ? -1 : AddPrefix(-1, -1, phyPrefix);
- int logParent = logPrefix.IsEmpty() ? -1 : AddPrefix(-1, -1, logPrefix);
-
- for (int i = 0; i < filePaths.Size(); i++)
- {
- const UString &filePath = filePaths[i];
- NFind::CFileInfoW fi;
- const UString phyPath = phyPrefix + filePath;
- if (!fi.Find(phyPath))
- {
- errorCodes.Add(::GetLastError());
- errorPaths.Add(phyPath);
- continue;
- }
- int delimiter = filePath.ReverseFind((wchar_t)kDirDelimiter);
- UString phyPrefixCur;
- int phyParentCur = phyParent;
- if (delimiter >= 0)
- {
- phyPrefixCur = filePath.Left(delimiter + 1);
- phyParentCur = AddPrefix(phyParent, logParent, phyPrefixCur);
- }
- AddDirFileInfo(phyParentCur, logParent, fi, Items);
- if (fi.IsDir())
- {
- const UString name2 = fi.Name + (wchar_t)kDirDelimiter;
- int parent = AddPrefix(phyParentCur, logParent, name2);
- EnumerateDirectory(parent, parent, phyPrefix + phyPrefixCur + name2, errorPaths, errorCodes);
- }
- }
- ReserveDown();
-}
-
-static HRESULT EnumerateDirItems(const NWildcard::CCensorNode &curNode,
- int phyParent, int logParent, const UString &phyPrefix,
- const UStringVector &addArchivePrefix,
- CDirItems &dirItems,
- bool enterToSubFolders,
- IEnumDirItemCallback *callback,
- UStringVector &errorPaths,
- CRecordVector<DWORD> &errorCodes);
-
-static HRESULT EnumerateDirItems_Spec(const NWildcard::CCensorNode &curNode,
- int phyParent, int logParent, const UString &curFolderName,
- const UString &phyPrefix,
- const UStringVector &addArchivePrefix,
- CDirItems &dirItems,
- bool enterToSubFolders,
- IEnumDirItemCallback *callback,
- UStringVector &errorPaths,
- CRecordVector<DWORD> &errorCodes)
-
-{
- const UString name2 = curFolderName + (wchar_t)kDirDelimiter;
- int parent = dirItems.AddPrefix(phyParent, logParent, name2);
- int numItems = dirItems.Items.Size();
- HRESULT res = EnumerateDirItems(curNode, parent, parent, phyPrefix + name2,
- addArchivePrefix, dirItems, enterToSubFolders, callback, errorPaths, errorCodes);
- if (numItems == dirItems.Items.Size())
- dirItems.DeleteLastPrefix();
- return res;
-}
-
-
-static HRESULT EnumerateDirItems(const NWildcard::CCensorNode &curNode,
- int phyParent, int logParent, const UString &phyPrefix,
- const UStringVector &addArchivePrefix, // prefix from curNode
- CDirItems &dirItems,
- bool enterToSubFolders,
- IEnumDirItemCallback *callback,
- UStringVector &errorPaths,
- CRecordVector<DWORD> &errorCodes)
-{
- if (!enterToSubFolders)
- if (curNode.NeedCheckSubDirs())
- enterToSubFolders = true;
- if (callback)
- RINOK(callback->ScanProgress(dirItems.GetNumFolders(), dirItems.Items.Size(), phyPrefix));
-
- // try direct_names case at first
- if (addArchivePrefix.IsEmpty() && !enterToSubFolders)
- {
- // check that all names are direct
- int i;
- for (i = 0; i < curNode.IncludeItems.Size(); i++)
- {
- const NWildcard::CItem &item = curNode.IncludeItems[i];
- if (item.Recursive || item.PathParts.Size() != 1)
- break;
- const UString &name = item.PathParts.Front();
- if (name.IsEmpty() || DoesNameContainWildCard(name))
- break;
- }
- if (i == curNode.IncludeItems.Size())
- {
- // all names are direct (no wildcards)
- // so we don't need file_system's dir enumerator
- CRecordVector<bool> needEnterVector;
- for (i = 0; i < curNode.IncludeItems.Size(); i++)
- {
- const NWildcard::CItem &item = curNode.IncludeItems[i];
- const UString &name = item.PathParts.Front();
- const UString fullPath = phyPrefix + name;
- NFind::CFileInfoW fi;
- if (!fi.Find(fullPath))
- {
- errorCodes.Add(::GetLastError());
- errorPaths.Add(fullPath);
- continue;
- }
- bool isDir = fi.IsDir();
- if (isDir && !item.ForDir || !isDir && !item.ForFile)
- {
- errorCodes.Add((DWORD)E_FAIL);
- errorPaths.Add(fullPath);
- continue;
- }
- {
- UStringVector pathParts;
- pathParts.Add(fi.Name);
- if (curNode.CheckPathToRoot(false, pathParts, !isDir))
- continue;
- }
- AddDirFileInfo(phyParent, logParent, fi, dirItems.Items);
- if (!isDir)
- continue;
-
- UStringVector addArchivePrefixNew;
- const NWildcard::CCensorNode *nextNode = 0;
- int index = curNode.FindSubNode(name);
- if (index >= 0)
- {
- for (int t = needEnterVector.Size(); t <= index; t++)
- needEnterVector.Add(true);
- needEnterVector[index] = false;
- nextNode = &curNode.SubNodes[index];
- }
- else
- {
- nextNode = &curNode;
- addArchivePrefixNew.Add(name); // don't change it to fi.Name. It's for shortnames support
- }
-
- RINOK(EnumerateDirItems_Spec(*nextNode, phyParent, logParent, fi.Name, phyPrefix,
- addArchivePrefixNew, dirItems, true, callback, errorPaths, errorCodes));
- }
- for (i = 0; i < curNode.SubNodes.Size(); i++)
- {
- if (i < needEnterVector.Size())
- if (!needEnterVector[i])
- continue;
- const NWildcard::CCensorNode &nextNode = curNode.SubNodes[i];
- const UString fullPath = phyPrefix + nextNode.Name;
- NFind::CFileInfoW fi;
- if (!fi.Find(fullPath))
- {
- if (!nextNode.AreThereIncludeItems())
- continue;
- errorCodes.Add(::GetLastError());
- errorPaths.Add(fullPath);
- continue;
- }
- if (!fi.IsDir())
- {
- errorCodes.Add((DWORD)E_FAIL);
- errorPaths.Add(fullPath);
- continue;
- }
-
- RINOK(EnumerateDirItems_Spec(nextNode, phyParent, logParent, fi.Name, phyPrefix,
- UStringVector(), dirItems, false, callback, errorPaths, errorCodes));
- }
- return S_OK;
- }
- }
-
-
- NFind::CEnumeratorW enumerator(phyPrefix + wchar_t(kAnyStringWildcard));
- for (int ttt = 0; ; ttt++)
- {
- NFind::CFileInfoW fi;
- bool found;
- if (!enumerator.Next(fi, found))
- {
- errorCodes.Add(::GetLastError());
- errorPaths.Add(phyPrefix);
- break;
- }
- if (!found)
- break;
-
- if (callback && (ttt & 0xFF) == 0xFF)
- RINOK(callback->ScanProgress(dirItems.GetNumFolders(), dirItems.Items.Size(), phyPrefix));
- const UString &name = fi.Name;
- bool enterToSubFolders2 = enterToSubFolders;
- UStringVector addArchivePrefixNew = addArchivePrefix;
- addArchivePrefixNew.Add(name);
- {
- UStringVector addArchivePrefixNewTemp(addArchivePrefixNew);
- if (curNode.CheckPathToRoot(false, addArchivePrefixNewTemp, !fi.IsDir()))
- continue;
- }
- if (curNode.CheckPathToRoot(true, addArchivePrefixNew, !fi.IsDir()))
- {
- AddDirFileInfo(phyParent, logParent, fi, dirItems.Items);
- if (fi.IsDir())
- enterToSubFolders2 = true;
- }
- if (!fi.IsDir())
- continue;
-
- const NWildcard::CCensorNode *nextNode = 0;
- if (addArchivePrefix.IsEmpty())
- {
- int index = curNode.FindSubNode(name);
- if (index >= 0)
- nextNode = &curNode.SubNodes[index];
- }
- if (!enterToSubFolders2 && nextNode == 0)
- continue;
-
- addArchivePrefixNew = addArchivePrefix;
- if (nextNode == 0)
- {
- nextNode = &curNode;
- addArchivePrefixNew.Add(name);
- }
-
- RINOK(EnumerateDirItems_Spec(*nextNode, phyParent, logParent, name, phyPrefix,
- addArchivePrefixNew, dirItems, enterToSubFolders2, callback, errorPaths, errorCodes));
- }
- return S_OK;
-}
-
-HRESULT EnumerateItems(
- const NWildcard::CCensor &censor,
- CDirItems &dirItems,
- IEnumDirItemCallback *callback,
- UStringVector &errorPaths,
- CRecordVector<DWORD> &errorCodes)
-{
- for (int i = 0; i < censor.Pairs.Size(); i++)
- {
- const NWildcard::CPair &pair = censor.Pairs[i];
- int phyParent = pair.Prefix.IsEmpty() ? -1 : dirItems.AddPrefix(-1, -1, pair.Prefix);
- RINOK(EnumerateDirItems(pair.Head, phyParent, -1, pair.Prefix, UStringVector(), dirItems, false,
- callback, errorPaths, errorCodes));
- }
- dirItems.ReserveDown();
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/EnumDirItems.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/EnumDirItems.h
deleted file mode 100644
index eca2f8850..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/EnumDirItems.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// EnumDirItems.h
-
-#ifndef __ENUM_DIR_ITEMS_H
-#define __ENUM_DIR_ITEMS_H
-
-#include "Common/Wildcard.h"
-#include "Windows/FileFind.h"
-#include "DirItem.h"
-
-void AddDirFileInfo(int phyParent, int logParent,
- const NWindows::NFile::NFind::CFileInfoW &fi, CObjectVector<CDirItem> &dirItems);
-
-struct IEnumDirItemCallback
-{
- virtual ~IEnumDirItemCallback() {}
- virtual HRESULT ScanProgress(UInt64 numFolders, UInt64 numFiles, const wchar_t *path) = 0;
-};
-
-HRESULT EnumerateItems(
- const NWildcard::CCensor &censor,
- CDirItems &dirItems,
- IEnumDirItemCallback *callback,
- UStringVector &errorPaths,
- CRecordVector<DWORD> &errorCodes);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExitCode.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExitCode.h
deleted file mode 100644
index b6d7d4dfc..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExitCode.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// ExitCode.h
-
-#ifndef __EXIT_CODE_H
-#define __EXIT_CODE_H
-
-namespace NExitCode {
-
-enum EEnum {
-
- kSuccess = 0, // Successful operation
- kWarning = 1, // Non fatal error(s) occurred
- kFatalError = 2, // A fatal error occurred
- // kCRCError = 3, // A CRC error occurred when unpacking
- // kLockedArchive = 4, // Attempt to modify an archive previously locked
- // kWriteError = 5, // Write to disk error
- // kOpenError = 6, // Open file error
- kUserError = 7, // Command line option error
- kMemoryError = 8, // Not enough memory for operation
- // kCreateFileError = 9, // Create file error
-
- kUserBreak = 255 // User stopped the process
-
-};
-
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Extract.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Extract.cpp
deleted file mode 100644
index 933290910..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Extract.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-// Extract.cpp
-
-#include "StdAfx.h"
-
-#include <stdio.h>
-
-#include "Windows/FileDir.h"
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "../Common/ExtractingFilePath.h"
-
-#include "Extract.h"
-#include "SetProperties.h"
-
-using namespace NWindows;
-
-static HRESULT DecompressArchive(
- const CArc &arc,
- UInt64 packSize,
- const NWildcard::CCensorNode &wildcardCensor,
- const CExtractOptions &options,
- IExtractCallbackUI *callback,
- CArchiveExtractCallback *extractCallbackSpec,
- UString &errorMessage,
- UInt64 &stdInProcessed)
-{
- stdInProcessed = 0;
- IInArchive *archive = arc.Archive;
- CRecordVector<UInt32> realIndices;
- if (!options.StdInMode)
- {
- UInt32 numItems;
- RINOK(archive->GetNumberOfItems(&numItems));
-
- for (UInt32 i = 0; i < numItems; i++)
- {
- UString filePath;
- RINOK(arc.GetItemPath(i, filePath));
- bool isFolder;
- RINOK(IsArchiveItemFolder(archive, i, isFolder));
- if (!wildcardCensor.CheckPath(filePath, !isFolder))
- continue;
- realIndices.Add(i);
- }
- if (realIndices.Size() == 0)
- {
- callback->ThereAreNoFiles();
- return S_OK;
- }
- }
-
- UStringVector removePathParts;
-
- UString outDir = options.OutputDir;
- outDir.Replace(L"*", GetCorrectFsPath(arc.DefaultName));
- #ifdef _WIN32
- outDir.TrimRight();
- outDir = GetCorrectFullFsPath(outDir);
- #endif
-
- if (!outDir.IsEmpty())
- if (!NFile::NDirectory::CreateComplexDirectory(outDir))
- {
- HRESULT res = ::GetLastError();
- if (res == S_OK)
- res = E_FAIL;
- errorMessage = ((UString)L"Can not create output directory ") + outDir;
- return res;
- }
-
- extractCallbackSpec->Init(
- options.StdInMode ? &wildcardCensor : NULL,
- &arc,
- callback,
- options.StdOutMode, options.TestMode, options.CalcCrc,
- outDir,
- removePathParts,
- packSize);
-
- #ifdef COMPRESS_MT
- RINOK(SetProperties(archive, options.Properties));
- #endif
-
- HRESULT result;
- Int32 testMode = (options.TestMode && !options.CalcCrc) ? 1: 0;
- if (options.StdInMode)
- {
- result = archive->Extract(NULL, (UInt32)(Int32)-1, testMode, extractCallbackSpec);
- NCOM::CPropVariant prop;
- if (archive->GetArchiveProperty(kpidPhySize, &prop) == S_OK)
- if (prop.vt == VT_UI8 || prop.vt == VT_UI4)
- stdInProcessed = ConvertPropVariantToUInt64(prop);
- }
- else
- result = archive->Extract(&realIndices.Front(), realIndices.Size(), testMode, extractCallbackSpec);
-
- return callback->ExtractResult(result);
-}
-
-HRESULT DecompressArchives(
- CCodecs *codecs, const CIntVector &formatIndices,
- UStringVector &arcPaths, UStringVector &arcPathsFull,
- const NWildcard::CCensorNode &wildcardCensor,
- const CExtractOptions &options,
- IOpenCallbackUI *openCallback,
- IExtractCallbackUI *extractCallback,
- UString &errorMessage,
- CDecompressStat &stat)
-{
- stat.Clear();
- int i;
- UInt64 totalPackSize = 0;
- CRecordVector<UInt64> archiveSizes;
-
- int numArcs = options.StdInMode ? 1 : arcPaths.Size();
-
- for (i = 0; i < numArcs; i++)
- {
- NFile::NFind::CFileInfoW fi;
- fi.Size = 0;
- if (!options.StdInMode)
- {
- const UString &arcPath = arcPaths[i];
- if (!fi.Find(arcPath))
- throw "there is no such archive";
- if (fi.IsDir())
- throw "can't decompress folder";
- }
- archiveSizes.Add(fi.Size);
- totalPackSize += fi.Size;
- }
- CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback;
- CMyComPtr<IArchiveExtractCallback> ec(extractCallbackSpec);
- bool multi = (numArcs > 1);
- extractCallbackSpec->InitForMulti(multi, options.PathMode, options.OverwriteMode);
- if (multi)
- {
- RINOK(extractCallback->SetTotal(totalPackSize));
- }
- for (i = 0; i < numArcs; i++)
- {
- const UString &arcPath = arcPaths[i];
- NFile::NFind::CFileInfoW fi;
- if (options.StdInMode)
- {
- fi.Size = 0;
- fi.Attrib = 0;
- }
- else
- {
- if (!fi.Find(arcPath) || fi.IsDir())
- throw "there is no such archive";
- }
-
- #ifndef _NO_CRYPTO
- openCallback->Open_ClearPasswordWasAskedFlag();
- #endif
-
- RINOK(extractCallback->BeforeOpen(arcPath));
- CArchiveLink archiveLink;
-
- CIntVector formatIndices2 = formatIndices;
- #ifndef _SFX
- if (formatIndices.IsEmpty())
- {
- int pos = arcPath.ReverseFind(L'.');
- if (pos >= 0)
- {
- UString s = arcPath.Mid(pos + 1);
- int index = codecs->FindFormatForExtension(s);
- if (index >= 0 && s == L"001")
- {
- s = arcPath.Left(pos);
- pos = s.ReverseFind(L'.');
- if (pos >= 0)
- {
- int index2 = codecs->FindFormatForExtension(s.Mid(pos + 1));
- if (index2 >= 0 && s.CompareNoCase(L"rar") != 0)
- {
- formatIndices2.Add(index2);
- formatIndices2.Add(index);
- }
- }
- }
- }
- }
- #endif
- HRESULT result = archiveLink.Open2(codecs, formatIndices2, options.StdInMode, NULL, arcPath, openCallback);
- if (result == E_ABORT)
- return result;
-
- bool crypted = false;
- #ifndef _NO_CRYPTO
- crypted = openCallback->Open_WasPasswordAsked();
- #endif
-
- RINOK(extractCallback->OpenResult(arcPath, result, crypted));
- if (result != S_OK)
- continue;
-
- if (!options.StdInMode)
- for (int v = 0; v < archiveLink.VolumePaths.Size(); v++)
- {
- int index = arcPathsFull.FindInSorted(archiveLink.VolumePaths[v]);
- if (index >= 0 && index > i)
- {
- arcPaths.Delete(index);
- arcPathsFull.Delete(index);
- totalPackSize -= archiveSizes[index];
- archiveSizes.Delete(index);
- numArcs = arcPaths.Size();
- }
- }
- if (archiveLink.VolumePaths.Size() != 0)
- {
- totalPackSize += archiveLink.VolumesSize;
- RINOK(extractCallback->SetTotal(totalPackSize));
- }
-
- #ifndef _NO_CRYPTO
- UString password;
- RINOK(openCallback->Open_GetPasswordIfAny(password));
- if (!password.IsEmpty())
- {
- RINOK(extractCallback->SetPassword(password));
- }
- #endif
-
- CArc &arc = archiveLink.Arcs.Back();
- arc.MTimeDefined = (!options.StdInMode && !fi.IsDevice);
- arc.MTime = fi.MTime;
-
- UInt64 packProcessed;
- RINOK(DecompressArchive(arc,
- fi.Size + archiveLink.VolumesSize,
- wildcardCensor, options, extractCallback, extractCallbackSpec, errorMessage, packProcessed));
- if (!options.StdInMode)
- packProcessed = fi.Size + archiveLink.VolumesSize;
- extractCallbackSpec->LocalProgressSpec->InSize += packProcessed;
- extractCallbackSpec->LocalProgressSpec->OutSize = extractCallbackSpec->UnpackSize;
- if (!errorMessage.IsEmpty())
- return E_FAIL;
- }
- stat.NumFolders = extractCallbackSpec->NumFolders;
- stat.NumFiles = extractCallbackSpec->NumFiles;
- stat.UnpackSize = extractCallbackSpec->UnpackSize;
- stat.CrcSum = extractCallbackSpec->CrcSum;
-
- stat.NumArchives = arcPaths.Size();
- stat.PackSize = extractCallbackSpec->LocalProgressSpec->InSize;
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Extract.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Extract.h
deleted file mode 100644
index 442dd2b0d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Extract.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Extract.h
-
-#ifndef __EXTRACT_H
-#define __EXTRACT_H
-
-#include "Windows/FileFind.h"
-
-#include "../../Archive/IArchive.h"
-
-#include "ArchiveExtractCallback.h"
-#include "ArchiveOpenCallback.h"
-#include "ExtractMode.h"
-#include "Property.h"
-
-#include "../Common/LoadCodecs.h"
-
-struct CExtractOptions
-{
- bool StdInMode;
- bool StdOutMode;
- bool YesToAll;
- bool TestMode;
- bool CalcCrc;
- NExtract::NPathMode::EEnum PathMode;
- NExtract::NOverwriteMode::EEnum OverwriteMode;
- UString OutputDir;
-
- // bool ShowDialog;
- // bool PasswordEnabled;
- // UString Password;
- #ifdef COMPRESS_MT
- CObjectVector<CProperty> Properties;
- #endif
-
- #ifdef EXTERNAL_CODECS
- CCodecs *Codecs;
- #endif
-
- CExtractOptions():
- StdInMode(false),
- StdOutMode(false),
- YesToAll(false),
- TestMode(false),
- CalcCrc(false),
- PathMode(NExtract::NPathMode::kFullPathnames),
- OverwriteMode(NExtract::NOverwriteMode::kAskBefore)
- {}
-};
-
-struct CDecompressStat
-{
- UInt64 NumArchives;
- UInt64 UnpackSize;
- UInt64 PackSize;
- UInt64 NumFolders;
- UInt64 NumFiles;
- UInt32 CrcSum;
-
- void Clear()
- {
- NumArchives = UnpackSize = PackSize = NumFolders = NumFiles = 0;
- CrcSum = 0;
- }
-};
-
-HRESULT DecompressArchives(
- CCodecs *codecs, const CIntVector &formatIndices,
- UStringVector &archivePaths, UStringVector &archivePathsFull,
- const NWildcard::CCensorNode &wildcardCensor,
- const CExtractOptions &options,
- IOpenCallbackUI *openCallback,
- IExtractCallbackUI *extractCallback,
- UString &errorMessage,
- CDecompressStat &stat);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExtractMode.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExtractMode.h
deleted file mode 100644
index b448fb30a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExtractMode.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// ExtractMode.h
-
-#ifndef __EXTRACT_MODE_H
-#define __EXTRACT_MODE_H
-
-namespace NExtract {
-
- namespace NPathMode
- {
- enum EEnum
- {
- kFullPathnames,
- kCurrentPathnames,
- kNoPathnames
- };
- }
-
- namespace NOverwriteMode
- {
- enum EEnum
- {
- kAskBefore,
- kWithoutPrompt,
- kSkipExisting,
- kAutoRename,
- kAutoRenameExisting
- };
- }
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExtractingFilePath.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExtractingFilePath.cpp
deleted file mode 100644
index f3968cd19..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExtractingFilePath.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-// ExtractingFilePath.cpp
-
-#include "StdAfx.h"
-
-#include "Common/Wildcard.h"
-#include "Common/MyWindows.h"
-
-#include "ExtractingFilePath.h"
-
-static UString ReplaceIncorrectChars(const UString &s)
-{
- #ifdef _WIN32
- UString res;
- for (int i = 0; i < s.Length(); i++)
- {
- wchar_t c = s[i];
- if (c < 0x20 || c == '*' || c == '?' || c == '<' || c == '>' || c == '|' || c == ':' || c == '"')
- c = '_';
- res += c;
- }
- res.TrimRight();
- while (!res.IsEmpty() && res[res.Length() - 1] == '.')
- res.Delete(res.Length() - 1);
- return res;
- #else
- return s;
- #endif
-}
-
-#ifdef _WIN32
-static const wchar_t *g_ReservedNames[] =
-{
- L"CON", L"PRN", L"AUX", L"NUL"
-};
-
-static bool CheckTail(const UString &name, int len)
-{
- int dotPos = name.Find(L'.');
- if (dotPos < 0)
- dotPos = name.Length();
- UString s = name.Left(dotPos);
- s.TrimRight();
- return (s.Length() != len);
-}
-
-static bool CheckNameNum(const UString &name, const wchar_t *reservedName)
-{
- int len = MyStringLen(reservedName);
- if (name.Length() <= len)
- return true;
- if (name.Left(len).CompareNoCase(reservedName) != 0)
- return true;
- wchar_t c = name[len];
- if (c < L'0' || c > L'9')
- return true;
- return CheckTail(name, len + 1);
-}
-
-static bool IsSupportedName(const UString &name)
-{
- for (int i = 0; i < sizeof(g_ReservedNames) / sizeof(g_ReservedNames[0]); i++)
- {
- const wchar_t *reservedName = g_ReservedNames[i];
- int len = MyStringLen(reservedName);
- if (name.Length() < len)
- continue;
- if (name.Left(len).CompareNoCase(reservedName) != 0)
- continue;
- if (!CheckTail(name, len))
- return false;
- }
- if (!CheckNameNum(name, L"COM"))
- return false;
- return CheckNameNum(name, L"LPT");
-}
-#endif
-
-static UString GetCorrectFileName(const UString &path)
-{
- if (path == L".." || path == L".")
- return UString();
- return ReplaceIncorrectChars(path);
-}
-
-void MakeCorrectPath(UStringVector &pathParts)
-{
- for (int i = 0; i < pathParts.Size();)
- {
- UString &s = pathParts[i];
- s = GetCorrectFileName(s);
- if (s.IsEmpty())
- pathParts.Delete(i);
- else
- {
- #ifdef _WIN32
- if (!IsSupportedName(s))
- s = (UString)L"_" + s;
- #endif
- i++;
- }
- }
-}
-
-UString MakePathNameFromParts(const UStringVector &parts)
-{
- UString result;
- for (int i = 0; i < parts.Size(); i++)
- {
- if (i != 0)
- result += WCHAR_PATH_SEPARATOR;
- result += parts[i];
- }
- return result;
-}
-
-UString GetCorrectFsPath(const UString &path)
-{
- UString res = GetCorrectFileName(path);
- #ifdef _WIN32
- if (!IsSupportedName(res))
- res = (UString)L"_" + res;
- #endif
- return res;
-}
-
-UString GetCorrectFullFsPath(const UString &path)
-{
- UStringVector parts;
- SplitPathToParts(path, parts);
- for (int i = 0; i < parts.Size(); i++)
- {
- #ifdef _WIN32
- UString &s = parts[i];
- while (!s.IsEmpty() && s[s.Length() - 1] == '.')
- s.Delete(s.Length() - 1);
- if (!IsSupportedName(s))
- s = (UString)L"_" + s;
- #endif
- }
- return MakePathNameFromParts(parts);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExtractingFilePath.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExtractingFilePath.h
deleted file mode 100644
index da28bfc23..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ExtractingFilePath.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// ExtractingFilePath.h
-
-#ifndef __EXTRACTING_FILE_PATH_H
-#define __EXTRACTING_FILE_PATH_H
-
-#include "Common/MyString.h"
-
-UString MakePathNameFromParts(const UStringVector &parts);
-void MakeCorrectPath(UStringVector &pathParts);
-UString GetCorrectFsPath(const UString &path);
-UString GetCorrectFullFsPath(const UString &path);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/HandlerLoader.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/HandlerLoader.h
deleted file mode 100644
index 4c7e1a8f4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/HandlerLoader.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// HandlerLoader.h
-
-#ifndef __HANDLERLOADER_H
-#define __HANDLERLOADER_H
-
-#include "../../ICoder.h"
-#include "Windows/DLL.h"
-
-typedef UInt32 (WINAPI * CreateObjectFunc)(
- const GUID *clsID,
- const GUID *interfaceID,
- void **outObject);
-
-class CHandlerLoader: public NWindows::NDLL::CLibrary
-{
-public:
- HRESULT CreateHandler(LPCWSTR filepath, REFGUID clsID,
- void **archive, bool outHandler)
- {
- if (!Load(filepath))
- return GetLastError();
- CreateObjectFunc createObject = (CreateObjectFunc)
- GetProcAddress("CreateObject");
- if (createObject == NULL)
- {
- HRESULT res = ::GetLastError();
- Free();
- return res;
- }
- HRESULT res = createObject(&clsID,
- outHandler ? &IID_IOutArchive : &IID_IInArchive, (void **)archive);
- if (res != 0)
- Free();
- return res;
- }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/IFileExtractCallback.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/IFileExtractCallback.h
deleted file mode 100644
index e8dcdce5f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/IFileExtractCallback.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// IFileExtractCallback.h
-
-#ifndef __IFILEEXTRACTCALLBACK_H
-#define __IFILEEXTRACTCALLBACK_H
-
-#include "Common/MyString.h"
-#include "../../IDecl.h"
-
-namespace NOverwriteAnswer
-{
- enum EEnum
- {
- kYes,
- kYesToAll,
- kNo,
- kNoToAll,
- kAutoRename,
- kCancel
- };
-}
-
-DECL_INTERFACE_SUB(IFolderArchiveExtractCallback, IProgress, 0x01, 0x07)
-{
-public:
- STDMETHOD(AskOverwrite)(
- const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
- const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
- Int32 *answer) PURE;
- STDMETHOD(PrepareOperation)(const wchar_t *name, bool isFolder, Int32 askExtractMode, const UInt64 *position) PURE;
- STDMETHOD(MessageError)(const wchar_t *message) PURE;
- STDMETHOD(SetOperationResult)(Int32 operationResult, bool encrypted) PURE;
-};
-
-struct IExtractCallbackUI: IFolderArchiveExtractCallback
-{
- virtual HRESULT BeforeOpen(const wchar_t *name) = 0;
- virtual HRESULT OpenResult(const wchar_t *name, HRESULT result, bool encrypted) = 0;
- virtual HRESULT ThereAreNoFiles() = 0;
- virtual HRESULT ExtractResult(HRESULT result) = 0;
-
- #ifndef _NO_CRYPTO
- virtual HRESULT SetPassword(const UString &password) = 0;
- #endif
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/LoadCodecs.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/LoadCodecs.cpp
deleted file mode 100644
index ec607e8a2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/LoadCodecs.cpp
+++ /dev/null
@@ -1,697 +0,0 @@
-// LoadCodecs.cpp
-
-#include "StdAfx.h"
-
-#include "LoadCodecs.h"
-
-#include "../../../Common/MyCom.h"
-#ifdef NEW_FOLDER_INTERFACE
-#include "../../../Common/StringToInt.h"
-#endif
-#include "../../../Windows/PropVariant.h"
-
-#include "../../ICoder.h"
-#include "../../Common/RegisterArc.h"
-
-#ifdef EXTERNAL_CODECS
-#include "../../../Windows/FileFind.h"
-#include "../../../Windows/DLL.h"
-#ifdef NEW_FOLDER_INTERFACE
-#include "../../../Windows/ResourceString.h"
-static const UINT kIconTypesResId = 100;
-#endif
-
-#ifdef _WIN32
-#include "Windows/Registry.h"
-#else
-#include "Common/StringConvert.h"
-#endif
-
-using namespace NWindows;
-using namespace NFile;
-
-#ifdef _WIN32
-extern HINSTANCE g_hInstance;
-#endif
-
-static CSysString GetLibraryFolderPrefix()
-{
- #ifdef _WIN32
- TCHAR fullPath[MAX_PATH + 1];
- ::GetModuleFileName(g_hInstance, fullPath, MAX_PATH);
- CSysString path = fullPath;
- int pos = path.ReverseFind(TEXT(CHAR_PATH_SEPARATOR));
- return path.Left(pos + 1);
- #else
- const char *p7zip_home_dir = getenv("P7ZIP_HOME_DIR");
- if (p7zip_home_dir == 0) p7zip_home_dir="./";
-#ifdef _UNICODE
- return MultiByteToUnicodeString(p7zip_home_dir);
-#else
- return p7zip_home_dir;
-#endif
- #endif
-}
-
-#define kCodecsFolderName TEXT("Codecs")
-#define kFormatsFolderName TEXT("Formats")
-static const TCHAR *kMainDll = TEXT("7z.dll");
-
-#ifdef _WIN32
-static LPCTSTR kRegistryPath = TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-zip");
-static LPCTSTR kProgramPathValue = TEXT("Path");
-static bool ReadPathFromRegistry(HKEY baseKey, CSysString &path)
-{
- NRegistry::CKey key;
- if(key.Open(baseKey, kRegistryPath, KEY_READ) == ERROR_SUCCESS)
- if (key.QueryValue(kProgramPathValue, path) == ERROR_SUCCESS)
- {
- NName::NormalizeDirPathPrefix(path);
- return true;
- }
- return false;
-}
-
-#endif
-
-CSysString GetBaseFolderPrefixFromRegistry()
-{
- CSysString moduleFolderPrefix = GetLibraryFolderPrefix();
-#ifdef _UNICODE
- NFind::CFileInfoW fi;
-#else
- NFind::CFileInfo fi;
-#endif
- if (NFind::FindFile(moduleFolderPrefix + kMainDll, fi))
- if (!fi.IsDir())
- return moduleFolderPrefix;
- if (NFind::FindFile(moduleFolderPrefix + kCodecsFolderName, fi))
- if (fi.IsDir())
- return moduleFolderPrefix;
- if (NFind::FindFile(moduleFolderPrefix + kFormatsFolderName, fi))
- if (fi.IsDir())
- return moduleFolderPrefix;
- #ifdef _WIN32
- CSysString path;
- if (ReadPathFromRegistry(HKEY_CURRENT_USER, path))
- return path;
- if (ReadPathFromRegistry(HKEY_LOCAL_MACHINE, path))
- return path;
- #endif
- return moduleFolderPrefix;
-}
-
-typedef UInt32 (WINAPI *GetNumberOfMethodsFunc)(UInt32 *numMethods);
-typedef UInt32 (WINAPI *GetNumberOfFormatsFunc)(UInt32 *numFormats);
-typedef UInt32 (WINAPI *GetHandlerPropertyFunc)(PROPID propID, PROPVARIANT *value);
-typedef UInt32 (WINAPI *GetHandlerPropertyFunc2)(UInt32 index, PROPID propID, PROPVARIANT *value);
-typedef UInt32 (WINAPI *CreateObjectFunc)(const GUID *clsID, const GUID *iid, void **outObject);
-typedef UInt32 (WINAPI *SetLargePageModeFunc)();
-
-
-static HRESULT GetCoderClass(GetMethodPropertyFunc getMethodProperty, UInt32 index,
- PROPID propId, CLSID &clsId, bool &isAssigned)
-{
- NWindows::NCOM::CPropVariant prop;
- isAssigned = false;
- RINOK(getMethodProperty(index, propId, &prop));
- if (prop.vt == VT_BSTR)
- {
- isAssigned = true;
- clsId = *(const GUID *)prop.bstrVal;
- }
- else if (prop.vt != VT_EMPTY)
- return E_FAIL;
- return S_OK;
-}
-
-HRESULT CCodecs::LoadCodecs()
-{
- CCodecLib &lib = Libs.Back();
- lib.GetMethodProperty = (GetMethodPropertyFunc)lib.Lib.GetProcAddress("GetMethodProperty");
- if (lib.GetMethodProperty == NULL)
- return S_OK;
-
- UInt32 numMethods = 1;
- GetNumberOfMethodsFunc getNumberOfMethodsFunc = (GetNumberOfMethodsFunc)lib.Lib.GetProcAddress("GetNumberOfMethods");
- if (getNumberOfMethodsFunc != NULL)
- {
- RINOK(getNumberOfMethodsFunc(&numMethods));
- }
-
- for(UInt32 i = 0; i < numMethods; i++)
- {
- CDllCodecInfo info;
- info.LibIndex = Libs.Size() - 1;
- info.CodecIndex = i;
-
- RINOK(GetCoderClass(lib.GetMethodProperty, i, NMethodPropID::kEncoder, info.Encoder, info.EncoderIsAssigned));
- RINOK(GetCoderClass(lib.GetMethodProperty, i, NMethodPropID::kDecoder, info.Decoder, info.DecoderIsAssigned));
-
- Codecs.Add(info);
- }
- return S_OK;
-}
-
-static HRESULT ReadProp(
- GetHandlerPropertyFunc getProp,
- GetHandlerPropertyFunc2 getProp2,
- UInt32 index, PROPID propID, NCOM::CPropVariant &prop)
-{
- if (getProp2)
- return getProp2(index, propID, &prop);;
- return getProp(propID, &prop);
-}
-
-static HRESULT ReadBoolProp(
- GetHandlerPropertyFunc getProp,
- GetHandlerPropertyFunc2 getProp2,
- UInt32 index, PROPID propID, bool &res)
-{
- NCOM::CPropVariant prop;
- RINOK(ReadProp(getProp, getProp2, index, propID, prop));
- if (prop.vt == VT_BOOL)
- res = VARIANT_BOOLToBool(prop.boolVal);
- else if (prop.vt != VT_EMPTY)
- return E_FAIL;
- return S_OK;
-}
-
-static HRESULT ReadStringProp(
- GetHandlerPropertyFunc getProp,
- GetHandlerPropertyFunc2 getProp2,
- UInt32 index, PROPID propID, UString &res)
-{
- NCOM::CPropVariant prop;
- RINOK(ReadProp(getProp, getProp2, index, propID, prop));
- if (prop.vt == VT_BSTR)
- res = prop.bstrVal;
- else if (prop.vt != VT_EMPTY)
- return E_FAIL;
- return S_OK;
-}
-
-#endif
-
-static const unsigned int kNumArcsMax = 32;
-static unsigned int g_NumArcs = 0;
-static const CArcInfo *g_Arcs[kNumArcsMax];
-void RegisterArc(const CArcInfo *arcInfo)
-{
- if (g_NumArcs < kNumArcsMax)
- g_Arcs[g_NumArcs++] = arcInfo;
-}
-
-static void SplitString(const UString &srcString, UStringVector &destStrings)
-{
- destStrings.Clear();
- UString s;
- int len = srcString.Length();
- if (len == 0)
- return;
- for (int i = 0; i < len; i++)
- {
- wchar_t c = srcString[i];
- if (c == L' ')
- {
- if (!s.IsEmpty())
- {
- destStrings.Add(s);
- s.Empty();
- }
- }
- else
- s += c;
- }
- if (!s.IsEmpty())
- destStrings.Add(s);
-}
-
-void CArcInfoEx::AddExts(const wchar_t* ext, const wchar_t* addExt)
-{
- UStringVector exts, addExts;
- SplitString(ext, exts);
- if (addExt != 0)
- SplitString(addExt, addExts);
- for (int i = 0; i < exts.Size(); i++)
- {
- CArcExtInfo extInfo;
- extInfo.Ext = exts[i];
- if (i < addExts.Size())
- {
- extInfo.AddExt = addExts[i];
- if (extInfo.AddExt == L"*")
- extInfo.AddExt.Empty();
- }
- Exts.Add(extInfo);
- }
-}
-
-#ifdef EXTERNAL_CODECS
-
-HRESULT CCodecs::LoadFormats()
-{
- const NDLL::CLibrary &lib = Libs.Back().Lib;
- GetHandlerPropertyFunc getProp = 0;
- GetHandlerPropertyFunc2 getProp2 = (GetHandlerPropertyFunc2)
- lib.GetProcAddress("GetHandlerProperty2");
- if (getProp2 == NULL)
- {
- getProp = (GetHandlerPropertyFunc)
- lib.GetProcAddress("GetHandlerProperty");
- if (getProp == NULL)
- return S_OK;
- }
-
- UInt32 numFormats = 1;
- GetNumberOfFormatsFunc getNumberOfFormats = (GetNumberOfFormatsFunc)
- lib.GetProcAddress("GetNumberOfFormats");
- if (getNumberOfFormats != NULL)
- {
- RINOK(getNumberOfFormats(&numFormats));
- }
- if (getProp2 == NULL)
- numFormats = 1;
-
- for(UInt32 i = 0; i < numFormats; i++)
- {
- CArcInfoEx item;
- item.LibIndex = Libs.Size() - 1;
- item.FormatIndex = i;
-
- RINOK(ReadStringProp(getProp, getProp2, i, NArchive::kName, item.Name));
-
- NCOM::CPropVariant prop;
- if (ReadProp(getProp, getProp2, i, NArchive::kClassID, prop) != S_OK)
- continue;
- if (prop.vt != VT_BSTR)
- continue;
- item.ClassID = *(const GUID *)prop.bstrVal;
- prop.Clear();
-
- UString ext, addExt;
- RINOK(ReadStringProp(getProp, getProp2, i, NArchive::kExtension, ext));
- RINOK(ReadStringProp(getProp, getProp2, i, NArchive::kAddExtension, addExt));
- item.AddExts(ext, addExt);
-
- ReadBoolProp(getProp, getProp2, i, NArchive::kUpdate, item.UpdateEnabled);
- if (item.UpdateEnabled)
- ReadBoolProp(getProp, getProp2, i, NArchive::kKeepName, item.KeepName);
-
- if (ReadProp(getProp, getProp2, i, NArchive::kStartSignature, prop) == S_OK)
- if (prop.vt == VT_BSTR)
- {
- UINT len = ::SysStringByteLen(prop.bstrVal);
- item.StartSignature.SetCapacity(len);
- memmove(item.StartSignature, prop.bstrVal, len);
- }
- Formats.Add(item);
- }
- return S_OK;
-}
-
-#ifdef NEW_FOLDER_INTERFACE
-void CCodecLib::LoadIcons()
-{
-#ifdef _WIN32
- UString iconTypes = MyLoadStringW((HMODULE)Lib, kIconTypesResId);
- UStringVector pairs;
- SplitString(iconTypes, pairs);
- for (int i = 0; i < pairs.Size(); i++)
- {
- const UString &s = pairs[i];
- int pos = s.Find(L':');
- if (pos < 0)
- continue;
- CIconPair iconPair;
- const wchar_t *end;
- UString num = s.Mid(pos + 1);
- iconPair.IconIndex = (UInt32)ConvertStringToUInt64(num, &end);
- if (*end != L'\0')
- continue;
- iconPair.Ext = s.Left(pos);
- IconPairs.Add(iconPair);
- }
-#endif // #ifdef _WIN32
-}
-
-int CCodecLib::FindIconIndex(const UString &ext) const
-{
-#ifdef _WIN32
- for (int i = 0; i < IconPairs.Size(); i++)
- {
- const CIconPair &pair = IconPairs[i];
- if (ext.CompareNoCase(pair.Ext) == 0)
- return pair.IconIndex;
- }
-#endif // #ifdef _WIN32
- return -1;
-}
-#endif
-
-#ifdef _7ZIP_LARGE_PAGES
-extern "C"
-{
- extern SIZE_T g_LargePageSize;
-}
-#endif
-
-HRESULT CCodecs::LoadDll(const CSysString &dllPath)
-{
-#ifdef _WIN32
- {
- NDLL::CLibrary library;
- if (!library.LoadEx(dllPath, LOAD_LIBRARY_AS_DATAFILE))
- return S_OK;
- }
-#endif
- Libs.Add(CCodecLib());
- CCodecLib &lib = Libs.Back();
- #ifdef NEW_FOLDER_INTERFACE
- lib.Path = dllPath;
- #endif
- bool used = false;
- HRESULT res = S_OK;
- if (lib.Lib.Load(dllPath))
- {
- #ifdef NEW_FOLDER_INTERFACE
- lib.LoadIcons();
- #endif
-
- #ifdef _7ZIP_LARGE_PAGES
- if (g_LargePageSize != 0)
- {
- SetLargePageModeFunc setLargePageMode = (SetLargePageModeFunc)lib.Lib.GetProcAddress("SetLargePageMode");
- if (setLargePageMode != 0)
- setLargePageMode();
- }
- #endif
-
- lib.CreateObject = (CreateObjectFunc)lib.Lib.GetProcAddress("CreateObject");
- if (lib.CreateObject != 0)
- {
- int startSize = Codecs.Size();
- res = LoadCodecs();
- used = (Codecs.Size() != startSize);
- if (res == S_OK)
- {
- startSize = Formats.Size();
- res = LoadFormats();
- used = used || (Formats.Size() != startSize);
- }
- }
- }
- if (!used)
- Libs.DeleteBack();
- return res;
-}
-
-HRESULT CCodecs::LoadDllsFromFolder(const CSysString &folderPrefix)
-{
-#ifdef _UNICODE
- NFile::NFind::CEnumeratorW enumerator(folderPrefix + CSysString(TEXT("*")));
- NFile::NFind::CFileInfoW fi;
-#else
- NFile::NFind::CEnumerator enumerator(folderPrefix + CSysString(TEXT("*")));
- NFile::NFind::CFileInfo fi;
-#endif
- while (enumerator.Next(fi))
- {
- if (fi.IsDir())
- continue;
- RINOK(LoadDll(folderPrefix + fi.Name));
- }
- return S_OK;
-}
-
-#endif
-
-#ifndef _SFX
-static inline void SetBuffer(CByteBuffer &bb, const Byte *data, int size)
-{
- bb.SetCapacity(size);
- memmove((Byte *)bb, data, size);
-}
-#endif
-
-HRESULT CCodecs::Load()
-{
- Formats.Clear();
- #ifdef EXTERNAL_CODECS
- Codecs.Clear();
- #endif
- for (UInt32 i = 0; i < g_NumArcs; i++)
- {
- const CArcInfo &arc = *g_Arcs[i];
- CArcInfoEx item;
- item.Name = arc.Name;
- item.CreateInArchive = arc.CreateInArchive;
- item.CreateOutArchive = arc.CreateOutArchive;
- item.AddExts(arc.Ext, arc.AddExt);
- item.UpdateEnabled = (arc.CreateOutArchive != 0);
- item.KeepName = arc.KeepName;
-
- #ifndef _SFX
- SetBuffer(item.StartSignature, arc.Signature, arc.SignatureSize);
- #endif
- Formats.Add(item);
- }
- #ifdef EXTERNAL_CODECS
- const CSysString baseFolder = GetBaseFolderPrefixFromRegistry();
- RINOK(LoadDll(baseFolder + kMainDll));
- RINOK(LoadDllsFromFolder(baseFolder + kCodecsFolderName TEXT(STRING_PATH_SEPARATOR)));
- RINOK(LoadDllsFromFolder(baseFolder + kFormatsFolderName TEXT(STRING_PATH_SEPARATOR)));
- #endif
- return S_OK;
-}
-
-#ifndef _SFX
-
-int CCodecs::FindFormatForArchiveName(const UString &arcPath) const
-{
- int slashPos1 = arcPath.ReverseFind(WCHAR_PATH_SEPARATOR);
- int slashPos2 = arcPath.ReverseFind(L'.');
- int dotPos = arcPath.ReverseFind(L'.');
- if (dotPos < 0 || dotPos < slashPos1 || dotPos < slashPos2)
- return -1;
- UString ext = arcPath.Mid(dotPos + 1);
- for (int i = 0; i < Formats.Size(); i++)
- {
- const CArcInfoEx &arc = Formats[i];
- if (!arc.UpdateEnabled)
- continue;
- // if (arc.FindExtension(ext) >= 0)
- UString mainExt = arc.GetMainExt();
- if (!mainExt.IsEmpty() && ext.CompareNoCase(mainExt) == 0)
- return i;
- }
- return -1;
-}
-
-int CCodecs::FindFormatForExtension(const UString &ext) const
-{
- if (ext.IsEmpty())
- return -1;
- for (int i = 0; i < Formats.Size(); i++)
- if (Formats[i].FindExtension(ext) >= 0)
- return i;
- return -1;
-}
-
-int CCodecs::FindFormatForArchiveType(const UString &arcType) const
-{
- for (int i = 0; i < Formats.Size(); i++)
- if (Formats[i].Name.CompareNoCase(arcType) == 0)
- return i;
- return -1;
-}
-
-bool CCodecs::FindFormatForArchiveType(const UString &arcType, CIntVector &formatIndices) const
-{
- formatIndices.Clear();
- for (int pos = 0; pos < arcType.Length();)
- {
- int pos2 = arcType.Find('.', pos);
- if (pos2 < 0)
- pos2 = arcType.Length();
- const UString name = arcType.Mid(pos, pos2 - pos);
- int index = FindFormatForArchiveType(name);
- if (index < 0 && name != L"*")
- {
- formatIndices.Clear();
- return false;
- }
- formatIndices.Add(index);
- pos = pos2 + 1;
- }
- return true;
-}
-
-#endif
-
-#ifdef EXTERNAL_CODECS
-
-#ifdef EXPORT_CODECS
-extern unsigned int g_NumCodecs;
-STDAPI CreateCoder2(bool encode, UInt32 index, const GUID *iid, void **outObject);
-STDAPI GetMethodProperty(UInt32 codecIndex, PROPID propID, PROPVARIANT *value);
-// STDAPI GetNumberOfMethods(UInt32 *numCodecs);
-#endif
-
-STDMETHODIMP CCodecs::GetNumberOfMethods(UInt32 *numMethods)
-{
- *numMethods =
- #ifdef EXPORT_CODECS
- g_NumCodecs +
- #endif
- Codecs.Size();
- return S_OK;
-}
-
-STDMETHODIMP CCodecs::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- #ifdef EXPORT_CODECS
- if (index < g_NumCodecs)
- return GetMethodProperty(index, propID, value);
- #endif
-
- const CDllCodecInfo &ci = Codecs[index
- #ifdef EXPORT_CODECS
- - g_NumCodecs
- #endif
- ];
-
- if (propID == NMethodPropID::kDecoderIsAssigned)
- {
- NWindows::NCOM::CPropVariant propVariant;
- propVariant = ci.DecoderIsAssigned;
- propVariant.Detach(value);
- return S_OK;
- }
- if (propID == NMethodPropID::kEncoderIsAssigned)
- {
- NWindows::NCOM::CPropVariant propVariant;
- propVariant = ci.EncoderIsAssigned;
- propVariant.Detach(value);
- return S_OK;
- }
- return Libs[ci.LibIndex].GetMethodProperty(ci.CodecIndex, propID, value);
-}
-
-STDMETHODIMP CCodecs::CreateDecoder(UInt32 index, const GUID *iid, void **coder)
-{
- #ifdef EXPORT_CODECS
- if (index < g_NumCodecs)
- return CreateCoder2(false, index, iid, coder);
- #endif
- const CDllCodecInfo &ci = Codecs[index
- #ifdef EXPORT_CODECS
- - g_NumCodecs
- #endif
- ];
- if (ci.DecoderIsAssigned)
- return Libs[ci.LibIndex].CreateObject(&ci.Decoder, iid, (void **)coder);
- return S_OK;
-}
-
-STDMETHODIMP CCodecs::CreateEncoder(UInt32 index, const GUID *iid, void **coder)
-{
- #ifdef EXPORT_CODECS
- if (index < g_NumCodecs)
- return CreateCoder2(true, index, iid, coder);
- #endif
- const CDllCodecInfo &ci = Codecs[index
- #ifdef EXPORT_CODECS
- - g_NumCodecs
- #endif
- ];
- if (ci.EncoderIsAssigned)
- return Libs[ci.LibIndex].CreateObject(&ci.Encoder, iid, (void **)coder);
- return S_OK;
-}
-
-HRESULT CCodecs::CreateCoder(const UString &name, bool encode, CMyComPtr<ICompressCoder> &coder) const
-{
- for (int i = 0; i < Codecs.Size(); i++)
- {
- const CDllCodecInfo &codec = Codecs[i];
- if (encode && !codec.EncoderIsAssigned || !encode && !codec.DecoderIsAssigned)
- continue;
- const CCodecLib &lib = Libs[codec.LibIndex];
- UString res;
- NWindows::NCOM::CPropVariant prop;
- RINOK(lib.GetMethodProperty(codec.CodecIndex, NMethodPropID::kName, &prop));
- if (prop.vt == VT_BSTR)
- res = prop.bstrVal;
- else if (prop.vt != VT_EMPTY)
- continue;
- if (name.CompareNoCase(res) == 0)
- return lib.CreateObject(encode ? &codec.Encoder : &codec.Decoder, &IID_ICompressCoder, (void **)&coder);
- }
- return CLASS_E_CLASSNOTAVAILABLE;
-}
-
-int CCodecs::GetCodecLibIndex(UInt32 index)
-{
- #ifdef EXPORT_CODECS
- if (index < g_NumCodecs)
- return -1;
- #endif
- #ifdef EXTERNAL_CODECS
- const CDllCodecInfo &ci = Codecs[index
- #ifdef EXPORT_CODECS
- - g_NumCodecs
- #endif
- ];
- return ci.LibIndex;
- #else
- return -1;
- #endif
-}
-
-bool CCodecs::GetCodecEncoderIsAssigned(UInt32 index)
-{
- #ifdef EXPORT_CODECS
- if (index < g_NumCodecs)
- {
- NWindows::NCOM::CPropVariant prop;
- if (GetProperty(index, NMethodPropID::kEncoder, &prop) == S_OK)
- if (prop.vt != VT_EMPTY)
- return true;
- return false;
- }
- #endif
- #ifdef EXTERNAL_CODECS
- const CDllCodecInfo &ci = Codecs[index
- #ifdef EXPORT_CODECS
- - g_NumCodecs
- #endif
- ];
- return ci.EncoderIsAssigned;
- #else
- return false;
- #endif
-}
-
-HRESULT CCodecs::GetCodecId(UInt32 index, UInt64 &id)
-{
- UString s;
- NWindows::NCOM::CPropVariant prop;
- RINOK(GetProperty(index, NMethodPropID::kID, &prop));
- if (prop.vt != VT_UI8)
- return E_INVALIDARG;
- id = prop.uhVal.QuadPart;
- return S_OK;
-}
-
-UString CCodecs::GetCodecName(UInt32 index)
-{
- UString s;
- NWindows::NCOM::CPropVariant prop;
- if (GetProperty(index, NMethodPropID::kName, &prop) == S_OK)
- if (prop.vt == VT_BSTR)
- s = prop.bstrVal;
- return s;
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/LoadCodecs.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/LoadCodecs.h
deleted file mode 100644
index 71de2ff1e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/LoadCodecs.h
+++ /dev/null
@@ -1,220 +0,0 @@
-// LoadCodecs.h
-
-#ifndef __LOADCODECS_H
-#define __LOADCODECS_H
-
-#include "../../../Common/Types.h"
-#include "../../../Common/MyCom.h"
-#include "../../../Common/MyString.h"
-#include "../../../Common/Buffer.h"
-#include "../../ICoder.h"
-
-#ifdef EXTERNAL_CODECS
-#include "../../../Windows/DLL.h"
-#endif
-
-struct CDllCodecInfo
-{
- CLSID Encoder;
- CLSID Decoder;
- bool EncoderIsAssigned;
- bool DecoderIsAssigned;
- int LibIndex;
- UInt32 CodecIndex;
-};
-
-#include "../../Archive/IArchive.h"
-
-typedef IInArchive * (*CreateInArchiveP)();
-typedef IOutArchive * (*CreateOutArchiveP)();
-
-struct CArcExtInfo
-{
- UString Ext;
- UString AddExt;
- CArcExtInfo() {}
- CArcExtInfo(const UString &ext): Ext(ext) {}
- CArcExtInfo(const UString &ext, const UString &addExt): Ext(ext), AddExt(addExt) {}
-};
-
-
-struct CArcInfoEx
-{
- #ifdef EXTERNAL_CODECS
- int LibIndex;
- UInt32 FormatIndex;
- CLSID ClassID;
- #endif
- bool UpdateEnabled;
- CreateInArchiveP CreateInArchive;
- CreateOutArchiveP CreateOutArchive;
- UString Name;
- CObjectVector<CArcExtInfo> Exts;
- #ifndef _SFX
- CByteBuffer StartSignature;
- // CByteBuffer FinishSignature;
- #ifdef NEW_FOLDER_INTERFACE
- UStringVector AssociateExts;
- #endif
- #endif
- bool KeepName;
- UString GetMainExt() const
- {
- if (Exts.IsEmpty())
- return UString();
- return Exts[0].Ext;
- }
- int FindExtension(const UString &ext) const
- {
- for (int i = 0; i < Exts.Size(); i++)
- if (ext.CompareNoCase(Exts[i].Ext) == 0)
- return i;
- return -1;
- }
- UString GetAllExtensions() const
- {
- UString s;
- for (int i = 0; i < Exts.Size(); i++)
- {
- if (i > 0)
- s += ' ';
- s += Exts[i].Ext;
- }
- return s;
- }
-
- void AddExts(const wchar_t* ext, const wchar_t* addExt);
-
- CArcInfoEx():
- #ifdef EXTERNAL_CODECS
- LibIndex(-1),
- #endif
- UpdateEnabled(false),
- CreateInArchive(0), CreateOutArchive(0),
- KeepName(false)
- #ifndef _SFX
- #endif
- {}
-};
-
-#ifdef EXTERNAL_CODECS
-typedef UInt32 (WINAPI *GetMethodPropertyFunc)(UInt32 index, PROPID propID, PROPVARIANT *value);
-typedef UInt32 (WINAPI *CreateObjectFunc)(const GUID *clsID, const GUID *interfaceID, void **outObject);
-
-
-struct CCodecLib
-{
- NWindows::NDLL::CLibrary Lib;
- GetMethodPropertyFunc GetMethodProperty;
- CreateObjectFunc CreateObject;
- #ifdef NEW_FOLDER_INTERFACE
- struct CIconPair
- {
- UString Ext;
- UInt32 IconIndex;
- };
- CSysString Path;
- CObjectVector<CIconPair> IconPairs;
- void LoadIcons();
- int FindIconIndex(const UString &ext) const;
- #endif
- CCodecLib(): GetMethodProperty(0) {}
-};
-#endif
-
-class CCodecs:
- #ifdef EXTERNAL_CODECS
- public ICompressCodecsInfo,
- #else
- public IUnknown,
- #endif
- public CMyUnknownImp
-{
-public:
- #ifdef EXTERNAL_CODECS
- CObjectVector<CCodecLib> Libs;
- CObjectVector<CDllCodecInfo> Codecs;
- HRESULT LoadCodecs();
- HRESULT LoadFormats();
- HRESULT LoadDll(const CSysString &path);
- HRESULT LoadDllsFromFolder(const CSysString &folderPrefix);
-
- HRESULT CreateArchiveHandler(const CArcInfoEx &ai, void **archive, bool outHandler) const
- {
- return Libs[ai.LibIndex].CreateObject(&ai.ClassID, outHandler ? &IID_IOutArchive : &IID_IInArchive, (void **)archive);
- }
- #endif
-
-public:
- CObjectVector<CArcInfoEx> Formats;
- HRESULT Load();
-
- #ifndef _SFX
- int FindFormatForArchiveName(const UString &arcPath) const;
- int FindFormatForExtension(const UString &ext) const;
- int FindFormatForArchiveType(const UString &arcType) const;
- bool FindFormatForArchiveType(const UString &arcType, CIntVector &formatIndices) const;
- #endif
-
- MY_UNKNOWN_IMP
-
- #ifdef EXTERNAL_CODECS
- STDMETHOD(GetNumberOfMethods)(UInt32 *numMethods);
- STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value);
- STDMETHOD(CreateDecoder)(UInt32 index, const GUID *interfaceID, void **coder);
- STDMETHOD(CreateEncoder)(UInt32 index, const GUID *interfaceID, void **coder);
- #endif
-
- int GetCodecLibIndex(UInt32 index);
- bool GetCodecEncoderIsAssigned(UInt32 index);
- HRESULT GetCodecId(UInt32 index, UInt64 &id);
- UString GetCodecName(UInt32 index);
-
- HRESULT CreateInArchive(int formatIndex, CMyComPtr<IInArchive> &archive) const
- {
- const CArcInfoEx &ai = Formats[formatIndex];
- #ifdef EXTERNAL_CODECS
- if (ai.LibIndex < 0)
- #endif
- {
- archive = ai.CreateInArchive();
- return S_OK;
- }
- #ifdef EXTERNAL_CODECS
- return CreateArchiveHandler(ai, (void **)&archive, false);
- #endif
- }
- HRESULT CreateOutArchive(int formatIndex, CMyComPtr<IOutArchive> &archive) const
- {
- const CArcInfoEx &ai = Formats[formatIndex];
- #ifdef EXTERNAL_CODECS
- if (ai.LibIndex < 0)
- #endif
- {
- archive = ai.CreateOutArchive();
- return S_OK;
- }
- #ifdef EXTERNAL_CODECS
- return CreateArchiveHandler(ai, (void **)&archive, true);
- #endif
- }
- int FindOutFormatFromName(const UString &name) const
- {
- for (int i = 0; i < Formats.Size(); i++)
- {
- const CArcInfoEx &arc = Formats[i];
- if (!arc.UpdateEnabled)
- continue;
- if (arc.Name.CompareNoCase(name) == 0)
- return i;
- }
- return -1;
- }
-
- #ifdef EXTERNAL_CODECS
- HRESULT CreateCoder(const UString &name, bool encode, CMyComPtr<ICompressCoder> &coder) const;
- #endif
-
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/OpenArchive.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/OpenArchive.cpp
deleted file mode 100644
index d7d2f0f7c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/OpenArchive.cpp
+++ /dev/null
@@ -1,509 +0,0 @@
-// OpenArchive.cpp
-
-#include "StdAfx.h"
-
-#include "Common/Wildcard.h"
-
-#include "Windows/FileDir.h"
-#include "Windows/PropVariant.h"
-
-#include "../../Common/FileStreams.h"
-#include "../../Common/StreamUtils.h"
-
-#include "DefaultName.h"
-#include "OpenArchive.h"
-
-using namespace NWindows;
-
-// Static-SFX (for Linux) can be big.
-const UInt64 kMaxCheckStartPosition = 1 << 22;
-
-HRESULT GetArchiveItemBoolProp(IInArchive *archive, UInt32 index, PROPID propID, bool &result)
-{
- NCOM::CPropVariant prop;
- result = false;
- RINOK(archive->GetProperty(index, propID, &prop));
- if (prop.vt == VT_BOOL)
- result = VARIANT_BOOLToBool(prop.boolVal);
- else if (prop.vt != VT_EMPTY)
- return E_FAIL;
- return S_OK;
-}
-
-HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result)
-{
- return GetArchiveItemBoolProp(archive, index, kpidIsDir, result);
-}
-
-HRESULT CArc::GetItemPath(UInt32 index, UString &result) const
-{
- {
- NCOM::CPropVariant prop;
- RINOK(Archive->GetProperty(index, kpidPath, &prop));
- if (prop.vt == VT_BSTR)
- result = prop.bstrVal;
- else if (prop.vt == VT_EMPTY)
- result.Empty();
- else
- return E_FAIL;
- }
- if (result.IsEmpty())
- {
- result = DefaultName;
- NCOM::CPropVariant prop;
- RINOK(Archive->GetProperty(index, kpidExtension, &prop));
- if (prop.vt == VT_BSTR)
- {
- result += L'.';
- result += prop.bstrVal;
- }
- else if (prop.vt != VT_EMPTY)
- return E_FAIL;
- }
- return S_OK;
-}
-
-HRESULT CArc::GetItemMTime(UInt32 index, FILETIME &ft, bool &defined) const
-{
- NCOM::CPropVariant prop;
- defined = false;
- ft.dwHighDateTime = ft.dwLowDateTime = 0;
- RINOK(Archive->GetProperty(index, kpidMTime, &prop));
- if (prop.vt == VT_FILETIME)
- {
- ft = prop.filetime;
- defined = true;
- }
- else if (prop.vt != VT_EMPTY)
- return E_FAIL;
- else if (MTimeDefined)
- {
- ft = MTime;
- defined = true;
- }
- return S_OK;
-}
-
-#ifndef _SFX
-static inline bool TestSignature(const Byte *p1, const Byte *p2, size_t size)
-{
- for (size_t i = 0; i < size; i++)
- if (p1[i] != p2[i])
- return false;
- return true;
-}
-#endif
-
-HRESULT CArc::OpenStream(
- CCodecs *codecs,
- int formatIndex,
- IInStream *stream,
- ISequentialInStream *seqStream,
- IArchiveOpenCallback *callback)
-{
- Archive.Release();
- const UString fileName = ExtractFileNameFromPath(Path);
- UString extension;
- {
- int dotPos = fileName.ReverseFind(L'.');
- if (dotPos >= 0)
- extension = fileName.Mid(dotPos + 1);
- }
- CIntVector orderIndices;
- if (formatIndex >= 0)
- orderIndices.Add(formatIndex);
- else
- {
-
- int i;
- int numFinded = 0;
- for (i = 0; i < codecs->Formats.Size(); i++)
- if (codecs->Formats[i].FindExtension(extension) >= 0)
- orderIndices.Insert(numFinded++, i);
- else
- orderIndices.Add(i);
-
- if (!stream)
- {
- if (numFinded != 1)
- return E_NOTIMPL;
- orderIndices.DeleteFrom(1);
- }
-
- #ifndef _SFX
- if (numFinded == 0)
- {
- CIntVector orderIndices2;
- CByteBuffer byteBuffer;
- const size_t kBufferSize = (1 << 21);
- byteBuffer.SetCapacity(kBufferSize);
- RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL));
- size_t processedSize = kBufferSize;
- RINOK(ReadStream(stream, byteBuffer, &processedSize));
- if (processedSize == 0)
- return S_FALSE;
-
- const Byte *buf = byteBuffer;
- Byte hash[1 << 16];
- memset(hash, 0xFF, 1 << 16);
- Byte prevs[256];
- if (orderIndices.Size() > 255)
- return S_FALSE;
- int i;
- for (i = 0; i < orderIndices.Size(); i++)
- {
- const CArcInfoEx &ai = codecs->Formats[orderIndices[i]];
- const CByteBuffer &sig = ai.StartSignature;
- if (sig.GetCapacity() < 2)
- continue;
- UInt32 v = sig[0] | ((UInt32)sig[1] << 8);
- prevs[i] = hash[v];
- hash[v] = (Byte)i;
- }
-
- processedSize--;
- for (UInt32 pos = 0; pos < processedSize; pos++)
- {
- for (; pos < processedSize && hash[buf[pos] | ((UInt32)buf[pos + 1] << 8)] == 0xFF; pos++);
- if (pos == processedSize)
- break;
- UInt32 v = buf[pos] | ((UInt32)buf[pos + 1] << 8);
- Byte *ptr = &hash[v];
- int i = *ptr;
- do
- {
- int index = orderIndices[i];
- if( index != 0xFF )
- {
- const CArcInfoEx &ai = codecs->Formats[index];
- const CByteBuffer &sig = ai.StartSignature;
- if( sig.GetCapacity() != 0 && pos + sig.GetCapacity() <= processedSize + 1)
- if (TestSignature(buf + pos, sig, sig.GetCapacity()))
- {
- orderIndices2.Add(index);
- orderIndices[i] = 0xFF;
- *ptr = prevs[i];
- }
- }
- ptr = &prevs[i];
- i = *ptr;
- }
- while (i != 0xFF);
- }
-
- for (i = 0; i < orderIndices.Size(); i++)
- {
- int val = orderIndices[i];
- if (val != 0xFF)
- orderIndices2.Add(val);
- }
- orderIndices = orderIndices2;
- }
- else if (extension == L"000" || extension == L"001")
- {
- CByteBuffer byteBuffer;
- const size_t kBufferSize = (1 << 10);
- byteBuffer.SetCapacity(kBufferSize);
- Byte *buffer = byteBuffer;
- RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL));
- size_t processedSize = kBufferSize;
- RINOK(ReadStream(stream, buffer, &processedSize));
- if (processedSize >= 16)
- {
- Byte kRarHeader[] = {0x52 , 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00};
- if (TestSignature(buffer, kRarHeader, 7) && buffer[9] == 0x73 && (buffer[10] & 1) != 0)
- {
- for (int i = 0; i < orderIndices.Size(); i++)
- {
- int index = orderIndices[i];
- const CArcInfoEx &ai = codecs->Formats[index];
- if (ai.Name.CompareNoCase(L"rar") != 0)
- continue;
- orderIndices.Delete(i--);
- orderIndices.Insert(0, index);
- break;
- }
- }
- }
- }
- if (orderIndices.Size() >= 2)
- {
- int isoIndex = codecs->FindFormatForArchiveType(L"iso");
- int udfIndex = codecs->FindFormatForArchiveType(L"udf");
- int iIso = -1;
- int iUdf = -1;
- for (int i = 0; i < orderIndices.Size(); i++)
- {
- if (orderIndices[i] == isoIndex) iIso = i;
- if (orderIndices[i] == udfIndex) iUdf = i;
- }
- if (iUdf > iIso && iIso >= 0)
- {
- orderIndices[iUdf] = isoIndex;
- orderIndices[iIso] = udfIndex;
- }
- }
-
- #endif
- }
-
- for (int i = 0; i < orderIndices.Size(); i++)
- {
- if (stream)
- {
- RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL));
- }
- CMyComPtr<IInArchive> archive;
-
- FormatIndex = orderIndices[i];
- RINOK(codecs->CreateInArchive(FormatIndex, archive));
- if (!archive)
- continue;
-
- #ifdef EXTERNAL_CODECS
- {
- CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
- archive.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
- if (setCompressCodecsInfo)
- {
- RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecs));
- }
- }
- #endif
-
- // OutputDebugStringW(codecs->Formats[FormatIndex].Name);
-
- HRESULT result;
- if (stream)
- result = archive->Open(stream, &kMaxCheckStartPosition, callback);
- else
- {
- CMyComPtr<IArchiveOpenSeq> openSeq;
- archive.QueryInterface(IID_IArchiveOpenSeq, (void **)&openSeq);
- if (!openSeq)
- return E_NOTIMPL;
- result = openSeq->OpenSeq(seqStream);
- }
-
- if (result == S_FALSE)
- continue;
- RINOK(result);
-
- Archive = archive;
- const CArcInfoEx &format = codecs->Formats[FormatIndex];
- if (format.Exts.Size() == 0)
- DefaultName = GetDefaultName2(fileName, L"", L"");
- else
- {
- int subExtIndex = format.FindExtension(extension);
- if (subExtIndex < 0)
- subExtIndex = 0;
- const CArcExtInfo &extInfo = format.Exts[subExtIndex];
- DefaultName = GetDefaultName2(fileName, extInfo.Ext, extInfo.AddExt);
- }
- return S_OK;
- }
- return S_FALSE;
-}
-
-HRESULT CArc::OpenStreamOrFile(
- CCodecs *codecs,
- int formatIndex,
- bool stdInMode,
- IInStream *stream,
- IArchiveOpenCallback *callback)
-{
- CMyComPtr<IInStream> fileStream;
- CMyComPtr<ISequentialInStream> seqStream;
- if (stdInMode)
- seqStream = new CStdInFileStream;
- else if (!stream)
- {
- CInFileStream *fileStreamSpec = new CInFileStream(true);
- fileStream = fileStreamSpec;
- if (!fileStreamSpec->Open(Path))
- return GetLastError();
- stream = fileStream;
- }
-
- return OpenStream(codecs, formatIndex, stream, seqStream, callback);
-}
-
-HRESULT CArchiveLink::Close()
-{
- for (int i = Arcs.Size() - 1; i >= 0; i--)
- {
- RINOK(Arcs[i].Archive->Close());
- }
- IsOpen = false;
- return S_OK;
-}
-
-void CArchiveLink::Release()
-{
- while (!Arcs.IsEmpty())
- Arcs.DeleteBack();
-}
-
-HRESULT CArchiveLink::Open(
- CCodecs *codecs,
- const CIntVector &formatIndices,
- bool stdInMode,
- IInStream *stream,
- const UString &filePath,
- IArchiveOpenCallback *callback)
-{
- Release();
- if (formatIndices.Size() >= 32)
- return E_NOTIMPL;
-
- HRESULT resSpec;
-
- for (;;)
- {
- resSpec = S_OK;
- int formatIndex = -1;
- if (formatIndices.Size() >= 1)
- {
- if (Arcs.Size() >= formatIndices.Size())
- break;
- formatIndex = formatIndices[formatIndices.Size() - Arcs.Size() - 1];
- }
- else if (Arcs.Size() >= 32)
- break;
-
- if (Arcs.IsEmpty())
- {
- CArc arc;
- arc.Path = filePath;
- arc.SubfileIndex = (UInt32)(Int32)-1;
- RINOK(arc.OpenStreamOrFile(codecs, formatIndex, stdInMode, stream, callback));
- Arcs.Add(arc);
- continue;
- }
-
- const CArc &arc = Arcs.Back();
-
- resSpec = (formatIndices.Size() == 0 ? S_OK : E_NOTIMPL);
-
- UInt32 mainSubfile;
- {
- NCOM::CPropVariant prop;
- RINOK(arc.Archive->GetArchiveProperty(kpidMainSubfile, &prop));
- if (prop.vt == VT_UI4)
- mainSubfile = prop.ulVal;
- else
- break;
- UInt32 numItems;
- RINOK(arc.Archive->GetNumberOfItems(&numItems));
- if (mainSubfile >= numItems)
- break;
- }
-
-
- CMyComPtr<IInArchiveGetStream> getStream;
- if (arc.Archive->QueryInterface(IID_IInArchiveGetStream, (void **)&getStream) != S_OK || !getStream)
- break;
-
- CMyComPtr<ISequentialInStream> subSeqStream;
- if (getStream->GetStream(mainSubfile, &subSeqStream) != S_OK || !subSeqStream)
- break;
-
- CMyComPtr<IInStream> subStream;
- if (subSeqStream.QueryInterface(IID_IInStream, &subStream) != S_OK || !subStream)
- break;
-
- CArc arc2;
- RINOK(arc.GetItemPath(mainSubfile, arc2.Path));
-
- CMyComPtr<IArchiveOpenSetSubArchiveName> setSubArchiveName;
- callback->QueryInterface(IID_IArchiveOpenSetSubArchiveName, (void **)&setSubArchiveName);
- if (setSubArchiveName)
- setSubArchiveName->SetSubArchiveName(arc2.Path);
-
- arc2.SubfileIndex = mainSubfile;
- HRESULT result = arc2.OpenStream(codecs, formatIndex, subStream, NULL, callback);
- resSpec = (formatIndices.Size() == 0 ? S_OK : S_FALSE);
- if (result == S_FALSE)
- break;
- RINOK(result);
- RINOK(arc.GetItemMTime(mainSubfile, arc2.MTime, arc2.MTimeDefined));
- Arcs.Add(arc2);
- }
- IsOpen = !Arcs.IsEmpty();
- return S_OK;
-}
-
-static void SetCallback(const UString &filePath,
- IOpenCallbackUI *callbackUI,
- IArchiveOpenCallback *reOpenCallback,
- CMyComPtr<IArchiveOpenCallback> &callback)
-{
- COpenCallbackImp *openCallbackSpec = new COpenCallbackImp;
- callback = openCallbackSpec;
- openCallbackSpec->Callback = callbackUI;
- openCallbackSpec->ReOpenCallback = reOpenCallback;
-
- UString fullName;
- int fileNamePartStartIndex;
- NFile::NDirectory::MyGetFullPathName(filePath, fullName, fileNamePartStartIndex);
- openCallbackSpec->Init(
- fullName.Left(fileNamePartStartIndex),
- fullName.Mid(fileNamePartStartIndex));
-}
-
-HRESULT CArchiveLink::Open2(CCodecs *codecs,
- const CIntVector &formatIndices,
- bool stdInMode,
- IInStream *stream,
- const UString &filePath,
- IOpenCallbackUI *callbackUI)
-{
- VolumesSize = 0;
- COpenCallbackImp *openCallbackSpec = new COpenCallbackImp;
- CMyComPtr<IArchiveOpenCallback> callback = openCallbackSpec;
- openCallbackSpec->Callback = callbackUI;
-
- UString fullName, prefix, name;
- if (!stream && !stdInMode)
- {
- int fileNamePartStartIndex;
- if (!NFile::NDirectory::MyGetFullPathName(filePath, fullName, fileNamePartStartIndex))
- return GetLastError();
- prefix = fullName.Left(fileNamePartStartIndex);
- name = fullName.Mid(fileNamePartStartIndex);
- openCallbackSpec->Init(prefix, name);
- }
- else
- {
- openCallbackSpec->SetSubArchiveName(filePath);
- }
-
- RINOK(Open(codecs, formatIndices, stdInMode, stream, filePath, callback));
- VolumePaths.Add(prefix + name);
- for (int i = 0; i < openCallbackSpec->FileNames.Size(); i++)
- VolumePaths.Add(prefix + openCallbackSpec->FileNames[i]);
- VolumesSize = openCallbackSpec->TotalSize;
- return S_OK;
-}
-
-HRESULT CArchiveLink::ReOpen(CCodecs *codecs, const UString &filePath,
- IArchiveOpenCallback *callback)
-{
- if (Arcs.Size() > 1)
- return E_NOTIMPL;
-
- if (Arcs.Size() == 0)
- return Open2(codecs, CIntVector(), false, NULL, filePath, 0);
-
- CMyComPtr<IArchiveOpenCallback> openCallbackNew;
- SetCallback(filePath, NULL, callback, openCallbackNew);
-
- CInFileStream *fileStreamSpec = new CInFileStream(true);
- CMyComPtr<IInStream> stream(fileStreamSpec);
- if (!fileStreamSpec->Open(filePath))
- return GetLastError();
- HRESULT res = GetArchive()->Open(stream, &kMaxCheckStartPosition, callback);
- IsOpen = (res == S_OK);
- return res;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/OpenArchive.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/OpenArchive.h
deleted file mode 100644
index 921036235..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/OpenArchive.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// OpenArchive.h
-
-#ifndef __OPEN_ARCHIVE_H
-#define __OPEN_ARCHIVE_H
-
-#include "Common/MyString.h"
-
-#include "Windows/FileFind.h"
-
-#include "../../Archive/IArchive.h"
-
-#include "ArchiveOpenCallback.h"
-#include "LoadCodecs.h"
-
-HRESULT GetArchiveItemBoolProp(IInArchive *archive, UInt32 index, PROPID propID, bool &result);
-HRESULT IsArchiveItemFolder(IInArchive *archive, UInt32 index, bool &result);
-
-struct CArc
-{
- CMyComPtr<IInArchive> Archive;
- UString Path;
- UString DefaultName;
- int FormatIndex;
- int SubfileIndex;
- FILETIME MTime;
- bool MTimeDefined;
-
- CArc(): MTimeDefined(false) {}
-
- HRESULT GetItemPath(UInt32 index, UString &result) const;
- HRESULT GetItemMTime(UInt32 index, FILETIME &ft, bool &defined) const;
- HRESULT IsItemAnti(UInt32 index, bool &result) const
- { return GetArchiveItemBoolProp(Archive, index, kpidIsAnti, result); }
-
- HRESULT OpenStream(
- CCodecs *codecs,
- int formatIndex,
- IInStream *stream,
- ISequentialInStream *seqStream,
- IArchiveOpenCallback *callback);
-
- HRESULT OpenStreamOrFile(
- CCodecs *codecs,
- int formatIndex,
- bool stdInMode,
- IInStream *stream,
- IArchiveOpenCallback *callback);
-};
-
-struct CArchiveLink
-{
- CObjectVector<CArc> Arcs;
- UStringVector VolumePaths;
- UInt64 VolumesSize;
- bool IsOpen;
-
- CArchiveLink(): VolumesSize(0), IsOpen(false) {}
- HRESULT Close();
- void Release();
- ~CArchiveLink() { Release(); }
-
- IInArchive *GetArchive() const { return Arcs.Back().Archive; }
-
- HRESULT Open(
- CCodecs *codecs,
- const CIntVector &formatIndices,
- bool stdInMode,
- IInStream *stream,
- const UString &filePath,
- IArchiveOpenCallback *callback);
-
- HRESULT Open2(
- CCodecs *codecs,
- const CIntVector &formatIndices,
- bool stdInMode,
- IInStream *stream,
- const UString &filePath,
- IOpenCallbackUI *callbackUI);
-
- HRESULT ReOpen(
- CCodecs *codecs,
- const UString &filePath,
- IArchiveOpenCallback *callback);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/PropIDUtils.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/PropIDUtils.cpp
deleted file mode 100644
index d8c0e7d64..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/PropIDUtils.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-// PropIDUtils.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-
-#include "Windows/FileFind.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "../../PropID.h"
-
-#include "PropIDUtils.h"
-
-using namespace NWindows;
-
-void ConvertUInt32ToHex(UInt32 value, wchar_t *s)
-{
- for (int i = 0; i < 8; i++)
- {
- int t = value & 0xF;
- value >>= 4;
- s[7 - i] = (wchar_t)((t < 10) ? (L'0' + t) : (L'A' + (t - 10)));
- }
- s[8] = L'\0';
-}
-
-#define MY_ATTR_CHAR(a, n, c) ((a )& (1 << (n))) ? c : L'-';
-
-UString ConvertPropertyToString(const PROPVARIANT &prop, PROPID propID, bool full)
-{
- switch(propID)
- {
- case kpidCTime:
- case kpidATime:
- case kpidMTime:
- {
- if (prop.vt != VT_FILETIME)
- break;
- FILETIME localFileTime;
- if ((prop.filetime.dwHighDateTime == 0 &&
- prop.filetime.dwLowDateTime == 0) ||
- !::FileTimeToLocalFileTime(&prop.filetime, &localFileTime))
- return UString();
- return ConvertFileTimeToString(localFileTime, true, full);
- }
- case kpidCRC:
- {
- if (prop.vt != VT_UI4)
- break;
- wchar_t temp[12];
- ConvertUInt32ToHex(prop.ulVal, temp);
- return temp;
- }
- case kpidAttrib:
- {
- if (prop.vt != VT_UI4)
- break;
- UString res;
- UInt32 a = prop.ulVal;
- if (NFile::NFind::NAttributes::IsReadOnly(a)) res += L'R';
- if (NFile::NFind::NAttributes::IsHidden(a)) res += L'H';
- if (NFile::NFind::NAttributes::IsSystem(a)) res += L'S';
- if (NFile::NFind::NAttributes::IsDir(a)) res += L'D';
- if (NFile::NFind::NAttributes::IsArchived(a)) res += L'A';
- if (NFile::NFind::NAttributes::IsCompressed(a)) res += L'C';
- if (NFile::NFind::NAttributes::IsEncrypted(a)) res += L'E';
- return res;
- }
- case kpidPosixAttrib:
- {
- if (prop.vt != VT_UI4)
- break;
- UString res;
- UInt32 a = prop.ulVal;
- wchar_t temp[16];
- temp[0] = MY_ATTR_CHAR(a, 14, L'd');
- for (int i = 6; i >= 0; i -= 3)
- {
- temp[7 - i] = MY_ATTR_CHAR(a, i + 2, L'r');
- temp[8 - i] = MY_ATTR_CHAR(a, i + 1, L'w');
- temp[9 - i] = MY_ATTR_CHAR(a, i + 0, L'x');
- }
- temp[10] = 0;
- res = temp;
- a &= ~0x1FF;
- a &= ~0xC000;
- if (a != 0)
- {
- ConvertUInt32ToHex(a, temp);
- res = UString(temp) + L' ' + res;
- }
- return res;
- }
- }
- return ConvertPropVariantToString(prop);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/PropIDUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/PropIDUtils.h
deleted file mode 100644
index ca14d091d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/PropIDUtils.h
+++ /dev/null
@@ -1,12 +0,0 @@
-// PropIDUtils.h
-
-#ifndef __PROPID_UTILS_H
-#define __PROPID_UTILS_H
-
-#include "Common/MyString.h"
-#include "Common/Types.h"
-
-void ConvertUInt32ToHex(UInt32 value, wchar_t *s);
-UString ConvertPropertyToString(const PROPVARIANT &propVariant, PROPID propID, bool full = true);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Property.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Property.h
deleted file mode 100644
index 9fd340cbc..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Property.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Property.h
-
-#ifndef __PROPERTY_H
-#define __PROPERTY_H
-
-#include "Common/MyString.h"
-
-struct CProperty
-{
- UString Name;
- UString Value;
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SetProperties.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SetProperties.cpp
deleted file mode 100644
index 4827f2a78..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SetProperties.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-// SetProperties.cpp
-
-#include "StdAfx.h"
-
-#include "SetProperties.h"
-
-#include "Windows/PropVariant.h"
-#include "Common/MyString.h"
-#include "Common/StringToInt.h"
-#include "Common/MyCom.h"
-
-#include "../../Archive/IArchive.h"
-
-using namespace NWindows;
-using namespace NCOM;
-
-static void ParseNumberString(const UString &s, NCOM::CPropVariant &prop)
-{
- const wchar_t *endPtr;
- UInt64 result = ConvertStringToUInt64(s, &endPtr);
- if (endPtr - (const wchar_t *)s != s.Length())
- prop = s;
- else if (result <= 0xFFFFFFFF)
- prop = (UInt32)result;
- else
- prop = result;
-}
-
-HRESULT SetProperties(IUnknown *unknown, const CObjectVector<CProperty> &properties)
-{
- if (properties.IsEmpty())
- return S_OK;
- CMyComPtr<ISetProperties> setProperties;
- unknown->QueryInterface(IID_ISetProperties, (void **)&setProperties);
- if (!setProperties)
- return S_OK;
-
- UStringVector realNames;
- CPropVariant *values = new CPropVariant[properties.Size()];
- try
- {
- int i;
- for(i = 0; i < properties.Size(); i++)
- {
- const CProperty &property = properties[i];
- NCOM::CPropVariant propVariant;
- UString name = property.Name;
- if (property.Value.IsEmpty())
- {
- if (!name.IsEmpty())
- {
- wchar_t c = name[name.Length() - 1];
- if (c == L'-')
- propVariant = false;
- else if (c == L'+')
- propVariant = true;
- if (propVariant.vt != VT_EMPTY)
- name = name.Left(name.Length() - 1);
- }
- }
- else
- ParseNumberString(property.Value, propVariant);
- realNames.Add(name);
- values[i] = propVariant;
- }
- CRecordVector<const wchar_t *> names;
- for(i = 0; i < realNames.Size(); i++)
- names.Add((const wchar_t *)realNames[i]);
-
- RINOK(setProperties->SetProperties(&names.Front(), values, names.Size()));
- }
- catch(...)
- {
- delete []values;
- throw;
- }
- delete []values;
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SetProperties.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SetProperties.h
deleted file mode 100644
index 892f1a210..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SetProperties.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// SetProperties.h
-
-#ifndef __SETPROPERTIES_H
-#define __SETPROPERTIES_H
-
-#include "Property.h"
-
-HRESULT SetProperties(IUnknown *unknown, const CObjectVector<CProperty> &properties);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SortUtils.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SortUtils.cpp
deleted file mode 100644
index 061e77730..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SortUtils.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// SortUtils.cpp
-
-#include "StdAfx.h"
-
-#include "SortUtils.h"
-#include "Common/Wildcard.h"
-
-static int CompareStrings(const int *p1, const int *p2, void *param)
-{
- const UStringVector &strings = *(const UStringVector *)param;
- return CompareFileNames(strings[*p1], strings[*p2]);
-}
-
-void SortFileNames(const UStringVector &strings, CIntVector &indices)
-{
- indices.Clear();
- int numItems = strings.Size();
- indices.Reserve(numItems);
- for(int i = 0; i < numItems; i++)
- indices.Add(i);
- indices.Sort(CompareStrings, (void *)&strings);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SortUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SortUtils.h
deleted file mode 100644
index e15224611..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/SortUtils.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// SortUtils.h
-
-#ifndef __SORTUTLS_H
-#define __SORTUTLS_H
-
-#include "Common/MyString.h"
-
-void SortFileNames(const UStringVector &strings, CIntVector &indices);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/TempFiles.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/TempFiles.cpp
deleted file mode 100644
index eeaec1802..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/TempFiles.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// TempFiles.cpp
-
-#include "StdAfx.h"
-
-#include "TempFiles.h"
-
-#include "Windows/FileDir.h"
-#include "Windows/FileIO.h"
-
-using namespace NWindows;
-using namespace NFile;
-
-void CTempFiles::Clear()
-{
- while(!Paths.IsEmpty())
- {
- NDirectory::DeleteFileAlways((LPCWSTR)Paths.Back());
- Paths.DeleteBack();
- }
-}
-
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/TempFiles.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/TempFiles.h
deleted file mode 100644
index eb474a760..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/TempFiles.h
+++ /dev/null
@@ -1,16 +0,0 @@
-// TempFiles.h
-
-#ifndef __TEMPFILES_H
-#define __TEMPFILES_H
-
-#include "Common/MyString.h"
-
-class CTempFiles
-{
- void Clear();
-public:
- UStringVector Paths;
- ~CTempFiles() { Clear(); }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Update.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Update.cpp
deleted file mode 100644
index 71a83da71..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Update.cpp
+++ /dev/null
@@ -1,904 +0,0 @@
-// Update.cpp
-
-#include "StdAfx.h"
-
-#include "Update.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-#include "Windows/FileName.h"
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-#include "Windows/Time.h"
-
-#include "../../Common/FileStreams.h"
-
-#include "../../Compress/CopyCoder.h"
-
-#include "../Common/DirItem.h"
-#include "../Common/EnumDirItems.h"
-#include "../Common/OpenArchive.h"
-#include "../Common/UpdateProduce.h"
-
-#include "EnumDirItems.h"
-#include "SetProperties.h"
-#include "TempFiles.h"
-#include "UpdateCallback.h"
-
-#undef _WIN32
-
-static const char *kUpdateIsNotSupoorted =
- "update operations are not supported for this archive";
-
-using namespace NWindows;
-using namespace NCOM;
-using namespace NFile;
-using namespace NName;
-
-//static const wchar_t *kTempFolderPrefix = L"7zE";
-
-using namespace NUpdateArchive;
-
-class COutMultiVolStream:
- public IOutStream,
- public CMyUnknownImp
-{
- int _streamIndex; // required stream
- UInt64 _offsetPos; // offset from start of _streamIndex index
- UInt64 _absPos;
- UInt64 _length;
-
- struct CSubStreamInfo
- {
- COutFileStream *StreamSpec;
- CMyComPtr<IOutStream> Stream;
- UString Name;
- UInt64 Pos;
- UInt64 RealSize;
- };
- CObjectVector<CSubStreamInfo> Streams;
-public:
- // CMyComPtr<IArchiveUpdateCallback2> VolumeCallback;
- CRecordVector<UInt64> Sizes;
- UString Prefix;
- CTempFiles *TempFiles;
-
- void Init()
- {
- _streamIndex = 0;
- _offsetPos = 0;
- _absPos = 0;
- _length = 0;
- }
-
- HRESULT Close();
-
- MY_UNKNOWN_IMP1(IOutStream)
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
- STDMETHOD(SetSize)(Int64 newSize);
-};
-
-// static NSynchronization::CCriticalSection g_TempPathsCS;
-
-HRESULT COutMultiVolStream::Close()
-{
- HRESULT res = S_OK;
- for (int i = 0; i < Streams.Size(); i++)
- {
- CSubStreamInfo &s = Streams[i];
- if (s.StreamSpec)
- {
- HRESULT res2 = s.StreamSpec->Close();
- if (res2 != S_OK)
- res = res2;
- }
- }
- return res;
-}
-
-STDMETHODIMP COutMultiVolStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != NULL)
- *processedSize = 0;
- while(size > 0)
- {
- if (_streamIndex >= Streams.Size())
- {
- CSubStreamInfo subStream;
-
- wchar_t temp[16];
- ConvertUInt32ToString(_streamIndex + 1, temp);
- UString res = temp;
- while (res.Length() < 3)
- res = UString(L'0') + res;
- UString name = Prefix + res;
- subStream.StreamSpec = new COutFileStream;
- subStream.Stream = subStream.StreamSpec;
- if (!subStream.StreamSpec->Create(name, false))
- return ::GetLastError();
- {
- // NSynchronization::CCriticalSectionLock lock(g_TempPathsCS);
- TempFiles->Paths.Add(name);
- }
-
- subStream.Pos = 0;
- subStream.RealSize = 0;
- subStream.Name = name;
- Streams.Add(subStream);
- continue;
- }
- CSubStreamInfo &subStream = Streams[_streamIndex];
-
- int index = _streamIndex;
- if (index >= Sizes.Size())
- index = Sizes.Size() - 1;
- UInt64 volSize = Sizes[index];
-
- if (_offsetPos >= volSize)
- {
- _offsetPos -= volSize;
- _streamIndex++;
- continue;
- }
- if (_offsetPos != subStream.Pos)
- {
- // CMyComPtr<IOutStream> outStream;
- // RINOK(subStream.Stream.QueryInterface(IID_IOutStream, &outStream));
- RINOK(subStream.Stream->Seek(_offsetPos, STREAM_SEEK_SET, NULL));
- subStream.Pos = _offsetPos;
- }
-
- UInt32 curSize = (UInt32)MyMin((UInt64)size, volSize - subStream.Pos);
- UInt32 realProcessed;
- RINOK(subStream.Stream->Write(data, curSize, &realProcessed));
- data = (void *)((Byte *)data + realProcessed);
- size -= realProcessed;
- subStream.Pos += realProcessed;
- _offsetPos += realProcessed;
- _absPos += realProcessed;
- if (_absPos > _length)
- _length = _absPos;
- if (_offsetPos > subStream.RealSize)
- subStream.RealSize = _offsetPos;
- if (processedSize != NULL)
- *processedSize += realProcessed;
- if (subStream.Pos == volSize)
- {
- _streamIndex++;
- _offsetPos = 0;
- }
- if (realProcessed == 0 && curSize != 0)
- return E_FAIL;
- break;
- }
- return S_OK;
-}
-
-STDMETHODIMP COutMultiVolStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
-{
- if (seekOrigin >= 3)
- return STG_E_INVALIDFUNCTION;
- switch(seekOrigin)
- {
- case STREAM_SEEK_SET:
- _absPos = offset;
- break;
- case STREAM_SEEK_CUR:
- _absPos += offset;
- break;
- case STREAM_SEEK_END:
- _absPos = _length + offset;
- break;
- }
- _offsetPos = _absPos;
- if (newPosition != NULL)
- *newPosition = _absPos;
- _streamIndex = 0;
- return S_OK;
-}
-
-STDMETHODIMP COutMultiVolStream::SetSize(Int64 newSize)
-{
- if (newSize < 0)
- return E_INVALIDARG;
- int i = 0;
- while (i < Streams.Size())
- {
- CSubStreamInfo &subStream = Streams[i++];
- if ((UInt64)newSize < subStream.RealSize)
- {
- RINOK(subStream.Stream->SetSize(newSize));
- subStream.RealSize = newSize;
- break;
- }
- newSize -= subStream.RealSize;
- }
- while (i < Streams.Size())
- {
- {
- CSubStreamInfo &subStream = Streams.Back();
- subStream.Stream.Release();
- NDirectory::DeleteFileAlways(subStream.Name);
- }
- Streams.DeleteBack();
- }
- _offsetPos = _absPos;
- _streamIndex = 0;
- _length = newSize;
- return S_OK;
-}
-
-static const wchar_t *kDefaultArchiveType = L"7z";
-static const wchar_t *kSFXExtension =
- #ifdef _WIN32
- L"exe";
- #else
- L"";
- #endif
-
-bool CUpdateOptions::Init(const CCodecs *codecs, const CIntVector &formatIndices, const UString &arcPath)
-{
- if (formatIndices.Size() > 1)
- return false;
- int arcTypeIndex = -1;
- if (formatIndices.Size() != 0)
- arcTypeIndex = formatIndices[0];
- if (arcTypeIndex >= 0)
- MethodMode.FormatIndex = arcTypeIndex;
- else
- {
- MethodMode.FormatIndex = codecs->FindFormatForArchiveName(arcPath);
- // It works incorrectly for update command if archive has some non-default extension!
- if (MethodMode.FormatIndex < 0)
- MethodMode.FormatIndex = codecs->FindFormatForArchiveType(kDefaultArchiveType);
- }
- if (MethodMode.FormatIndex < 0)
- return false;
- const CArcInfoEx &arcInfo = codecs->Formats[MethodMode.FormatIndex];
- if (!arcInfo.UpdateEnabled)
- return false;
- UString typeExt = arcInfo.GetMainExt();
- UString ext = typeExt;
- if (SfxMode)
- ext = kSFXExtension;
- ArchivePath.BaseExtension = ext;
- ArchivePath.VolExtension = typeExt;
- ArchivePath.ParseFromPath(arcPath);
- for (int i = 0; i < Commands.Size(); i++)
- {
- CUpdateArchiveCommand &uc = Commands[i];
- uc.ArchivePath.BaseExtension = ext;
- uc.ArchivePath.VolExtension = typeExt;
- uc.ArchivePath.ParseFromPath(uc.UserArchivePath);
- }
- return true;
-}
-
-/*
-struct CUpdateProduceCallbackImp: public IUpdateProduceCallback
-{
- const CObjectVector<CArcItem> *_arcItems;
- IUpdateCallbackUI *_callback;
-
- CUpdateProduceCallbackImp(const CObjectVector<CArcItem> *a,
- IUpdateCallbackUI *callback): _arcItems(a), _callback(callback) {}
- virtual HRESULT ShowDeleteFile(int arcIndex);
-};
-
-HRESULT CUpdateProduceCallbackImp::ShowDeleteFile(int arcIndex)
-{
- return _callback->ShowDeleteFile((*_arcItems)[arcIndex].Name);
-}
-*/
-
-static HRESULT Compress(
- CCodecs *codecs,
- const CActionSet &actionSet,
- IInArchive *archive,
- const CCompressionMethodMode &compressionMethod,
- CArchivePath &archivePath,
- const CObjectVector<CArcItem> &arcItems,
- bool shareForWrite,
- bool stdInMode,
- /* const UString & stdInFileName, */
- bool stdOutMode,
- const CDirItems &dirItems,
- bool sfxMode,
- const UString &sfxModule,
- const CRecordVector<UInt64> &volumesSizes,
- CTempFiles &tempFiles,
- CUpdateErrorInfo &errorInfo,
- IUpdateCallbackUI *callback)
-{
- CMyComPtr<IOutArchive> outArchive;
- if (archive != NULL)
- {
- CMyComPtr<IInArchive> archive2 = archive;
- HRESULT result = archive2.QueryInterface(IID_IOutArchive, &outArchive);
- if (result != S_OK)
- throw kUpdateIsNotSupoorted;
- }
- else
- {
- RINOK(codecs->CreateOutArchive(compressionMethod.FormatIndex, outArchive));
-
- #ifdef EXTERNAL_CODECS
- {
- CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
- outArchive.QueryInterface(IID_ISetCompressCodecsInfo, (void **)&setCompressCodecsInfo);
- if (setCompressCodecsInfo)
- {
- RINOK(setCompressCodecsInfo->SetCompressCodecsInfo(codecs));
- }
- }
- #endif
- }
- if (outArchive == 0)
- throw kUpdateIsNotSupoorted;
-
- NFileTimeType::EEnum fileTimeType;
- UInt32 value;
- RINOK(outArchive->GetFileTimeType(&value));
-
- switch(value)
- {
- case NFileTimeType::kWindows:
- case NFileTimeType::kUnix:
- case NFileTimeType::kDOS:
- fileTimeType = (NFileTimeType::EEnum)value;
- break;
- default:
- return E_FAIL;
- }
-
- CRecordVector<CUpdatePair2> updatePairs2;
-
- {
- CRecordVector<CUpdatePair> updatePairs;
- GetUpdatePairInfoList(dirItems, arcItems, fileTimeType, updatePairs); // must be done only once!!!
- // CUpdateProduceCallbackImp upCallback(&arcItems, callback);
- UpdateProduce(updatePairs, actionSet, updatePairs2, NULL /* &upCallback */);
- }
-
- UInt32 numFiles = 0;
- for (int i = 0; i < updatePairs2.Size(); i++)
- if (updatePairs2[i].NewData)
- numFiles++;
-
- RINOK(callback->SetNumFiles(numFiles));
-
-
- CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
- CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec);
-
- updateCallbackSpec->ShareForWrite = shareForWrite;
- updateCallbackSpec->StdInMode = stdInMode;
- updateCallbackSpec->Callback = callback;
- updateCallbackSpec->DirItems = &dirItems;
- updateCallbackSpec->ArcItems = &arcItems;
- updateCallbackSpec->UpdatePairs = &updatePairs2;
-
- CMyComPtr<ISequentialOutStream> outStream;
-
- const UString &archiveName = archivePath.GetFinalPath();
- if (!stdOutMode)
- {
- UString resultPath;
- int pos;
- if (!NFile::NDirectory::MyGetFullPathName(archiveName, resultPath, pos))
- throw 1417161;
- NFile::NDirectory::CreateComplexDirectory(resultPath.Left(pos));
- }
-
- COutFileStream *outStreamSpec = NULL;
- COutMultiVolStream *volStreamSpec = NULL;
-
- if (volumesSizes.Size() == 0)
- {
- if (stdOutMode)
- outStream = new CStdOutFileStream;
- else
- {
- outStreamSpec = new COutFileStream;
- outStream = outStreamSpec;
- bool isOK = false;
- UString realPath;
- for (int i = 0; i < (1 << 16); i++)
- {
- if (archivePath.Temp)
- {
- if (i > 0)
- {
- wchar_t s[16];
- ConvertUInt32ToString(i, s);
- archivePath.TempPostfix = s;
- }
- realPath = archivePath.GetTempPath();
- }
- else
- realPath = archivePath.GetFinalPath();
- if (outStreamSpec->Create(realPath, false))
- {
- tempFiles.Paths.Add(realPath);
- isOK = true;
- break;
- }
- if (::GetLastError() != ERROR_FILE_EXISTS)
- break;
- if (!archivePath.Temp)
- break;
- }
- if (!isOK)
- {
- errorInfo.SystemError = ::GetLastError();
- errorInfo.FileName = realPath;
- errorInfo.Message = L"Can not open file";
- return E_FAIL;
- }
- }
- }
- else
- {
- if (stdOutMode)
- return E_FAIL;
- volStreamSpec = new COutMultiVolStream;
- outStream = volStreamSpec;
- volStreamSpec->Sizes = volumesSizes;
- volStreamSpec->Prefix = archivePath.GetFinalPath() + UString(L".");
- volStreamSpec->TempFiles = &tempFiles;
- volStreamSpec->Init();
-
- /*
- updateCallbackSpec->VolumesSizes = volumesSizes;
- updateCallbackSpec->VolName = archivePath.Prefix + archivePath.Name;
- if (!archivePath.VolExtension.IsEmpty())
- updateCallbackSpec->VolExt = UString(L'.') + archivePath.VolExtension;
- */
- }
-
- RINOK(SetProperties(outArchive, compressionMethod.Properties));
-
- if (sfxMode)
- {
- CInFileStream *sfxStreamSpec = new CInFileStream;
- CMyComPtr<IInStream> sfxStream(sfxStreamSpec);
- if (!sfxStreamSpec->Open(sfxModule))
- {
- errorInfo.SystemError = ::GetLastError();
- errorInfo.Message = L"Can't open sfx module";
- errorInfo.FileName = sfxModule;
- return E_FAIL;
- }
-
- CMyComPtr<ISequentialOutStream> sfxOutStream;
- COutFileStream *outStreamSpec = NULL;
- if (volumesSizes.Size() == 0)
- sfxOutStream = outStream;
- else
- {
- outStreamSpec = new COutFileStream;
- sfxOutStream = outStreamSpec;
- UString realPath = archivePath.GetFinalPath();
- if (!outStreamSpec->Create(realPath, false))
- {
- errorInfo.SystemError = ::GetLastError();
- errorInfo.FileName = realPath;
- errorInfo.Message = L"Can not open file";
- return E_FAIL;
- }
- }
- RINOK(NCompress::CopyStream(sfxStream, sfxOutStream, NULL));
- if (outStreamSpec)
- {
- RINOK(outStreamSpec->Close());
- }
- }
-
- HRESULT result = outArchive->UpdateItems(outStream, updatePairs2.Size(), updateCallback);
- callback->Finilize();
- RINOK(result);
- if (outStreamSpec)
- result = outStreamSpec->Close();
- else if (volStreamSpec)
- result = volStreamSpec->Close();
- return result;
-}
-
-HRESULT EnumerateInArchiveItems(const NWildcard::CCensor &censor,
- const CArc &arc,
- CObjectVector<CArcItem> &arcItems)
-{
- arcItems.Clear();
- UInt32 numItems;
- IInArchive *archive = arc.Archive;
- RINOK(archive->GetNumberOfItems(&numItems));
- arcItems.Reserve(numItems);
- for (UInt32 i = 0; i < numItems; i++)
- {
- CArcItem ai;
-
- RINOK(arc.GetItemPath(i, ai.Name));
- RINOK(IsArchiveItemFolder(archive, i, ai.IsDir));
- ai.Censored = censor.CheckPath(ai.Name, !ai.IsDir);
- RINOK(arc.GetItemMTime(i, ai.MTime, ai.MTimeDefined));
-
- {
- CPropVariant prop;
- RINOK(archive->GetProperty(i, kpidSize, &prop));
- ai.SizeDefined = (prop.vt != VT_EMPTY);
- if (ai.SizeDefined)
- ai.Size = ConvertPropVariantToUInt64(prop);
- }
-
- {
- CPropVariant prop;
- RINOK(archive->GetProperty(i, kpidTimeType, &prop));
- if (prop.vt == VT_UI4)
- {
- ai.TimeType = (int)(NFileTimeType::EEnum)prop.ulVal;
- switch(ai.TimeType)
- {
- case NFileTimeType::kWindows:
- case NFileTimeType::kUnix:
- case NFileTimeType::kDOS:
- break;
- default:
- return E_FAIL;
- }
- }
- }
-
- ai.IndexInServer = i;
- arcItems.Add(ai);
- }
- return S_OK;
-}
-
-
-static HRESULT UpdateWithItemLists(
- CCodecs *codecs,
- CUpdateOptions &options,
- IInArchive *archive,
- const CObjectVector<CArcItem> &arcItems,
- CDirItems &dirItems,
- CTempFiles &tempFiles,
- CUpdateErrorInfo &errorInfo,
- IUpdateCallbackUI2 *callback)
-{
- for(int i = 0; i < options.Commands.Size(); i++)
- {
- CUpdateArchiveCommand &command = options.Commands[i];
- if (options.StdOutMode)
- {
- RINOK(callback->StartArchive(L"stdout", archive != 0));
- }
- else
- {
- RINOK(callback->StartArchive(command.ArchivePath.GetFinalPath(),
- i == 0 && options.UpdateArchiveItself && archive != 0));
- }
-
- RINOK(Compress(
- codecs,
- command.ActionSet, archive,
- options.MethodMode,
- command.ArchivePath,
- arcItems,
- options.OpenShareForWrite,
- options.StdInMode,
- /* options.StdInFileName, */
- options.StdOutMode,
- dirItems,
- options.SfxMode, options.SfxModule,
- options.VolumesSizes,
- tempFiles,
- errorInfo, callback));
-
- RINOK(callback->FinishArchive());
- }
- return S_OK;
-}
-
-#ifdef _WIN32
-class CCurrentDirRestorer
-{
- UString m_CurrentDirectory;
-public:
- CCurrentDirRestorer()
- { NFile::NDirectory::MyGetCurrentDirectory(m_CurrentDirectory); }
- ~CCurrentDirRestorer()
- { RestoreDirectory();}
- bool RestoreDirectory()
- { return BOOLToBool(NFile::NDirectory::MySetCurrentDirectory(m_CurrentDirectory)); }
-};
-#endif
-
-struct CEnumDirItemUpdateCallback: public IEnumDirItemCallback
-{
- IUpdateCallbackUI2 *Callback;
- HRESULT ScanProgress(UInt64 numFolders, UInt64 numFiles, const wchar_t *path)
- {
- return Callback->ScanProgress(numFolders, numFiles, path);
- }
-};
-
-#ifdef _WIN32
-typedef ULONG (FAR PASCAL MY_MAPISENDDOCUMENTS)(
- ULONG_PTR ulUIParam,
- LPSTR lpszDelimChar,
- LPSTR lpszFilePaths,
- LPSTR lpszFileNames,
- ULONG ulReserved
-);
-typedef MY_MAPISENDDOCUMENTS FAR *MY_LPMAPISENDDOCUMENTS;
-#endif
-
-HRESULT UpdateArchive(
- CCodecs *codecs,
- const NWildcard::CCensor &censor,
- CUpdateOptions &options,
- CUpdateErrorInfo &errorInfo,
- IOpenCallbackUI *openCallback,
- IUpdateCallbackUI2 *callback)
-{
- if (options.StdOutMode && options.EMailMode)
- return E_FAIL;
-
- if (options.VolumesSizes.Size() > 0 && (options.EMailMode || options.SfxMode))
- return E_NOTIMPL;
-
- if (options.SfxMode)
- {
- CProperty property;
- property.Name = L"rsfx";
- property.Value = L"on";
- options.MethodMode.Properties.Add(property);
- if (options.SfxModule.IsEmpty())
- {
- errorInfo.Message = L"sfx file is not specified";
- return E_FAIL;
- }
- UString name = options.SfxModule;
- if (!NDirectory::MySearchPath(NULL, name, NULL, options.SfxModule))
- {
- errorInfo.Message = L"can't find specified sfx module";
- return E_FAIL;
- }
- }
-
- const UString archiveName = options.ArchivePath.GetFinalPath();
-
- CArchiveLink archiveLink;
- NFind::CFileInfoW archiveFileInfo;
-
- if (archiveFileInfo.Find(archiveName))
- {
- if (archiveFileInfo.IsDir())
- throw "there is no such archive";
- if (options.VolumesSizes.Size() > 0)
- return E_NOTIMPL;
- CIntVector formatIndices;
- if (options.MethodMode.FormatIndex >= 0)
- formatIndices.Add(options.MethodMode.FormatIndex);
- HRESULT result = archiveLink.Open2(codecs, formatIndices, false, NULL, archiveName, openCallback);
- if (result == E_ABORT)
- return result;
- RINOK(callback->OpenResult(archiveName, result));
- RINOK(result);
- if (archiveLink.VolumePaths.Size() > 1)
- {
- errorInfo.SystemError = (DWORD)E_NOTIMPL;
- errorInfo.Message = L"Updating for multivolume archives is not implemented";
- return E_NOTIMPL;
- }
-
- CArc &arc = archiveLink.Arcs.Back();
- arc.MTimeDefined = !archiveFileInfo.IsDevice;
- arc.MTime = archiveFileInfo.MTime;
- }
- else
- {
- /*
- if (archiveType.IsEmpty())
- throw "type of archive is not specified";
- */
- }
-
- CDirItems dirItems;
- if (options.StdInMode)
- {
- CDirItem di;
- di.Name = options.StdInFileName;
- di.Size = (UInt64)(Int64)-1;
- di.Attrib = 0;
- NTime::GetCurUtcFileTime(di.MTime);
- di.CTime = di.ATime = di.MTime;
- dirItems.Items.Add(di);
- }
- else
- {
- bool needScanning = false;
- for(int i = 0; i < options.Commands.Size(); i++)
- if (options.Commands[i].ActionSet.NeedScanning())
- needScanning = true;
- if (needScanning)
- {
- CEnumDirItemUpdateCallback enumCallback;
- enumCallback.Callback = callback;
- RINOK(callback->StartScanning());
- UStringVector errorPaths;
- CRecordVector<DWORD> errorCodes;
- HRESULT res = EnumerateItems(censor, dirItems, &enumCallback, errorPaths, errorCodes);
- for (int i = 0; i < errorPaths.Size(); i++)
- {
- RINOK(callback->CanNotFindError(errorPaths[i], errorCodes[i]));
- }
- if (res != S_OK)
- {
- if (res != E_ABORT)
- errorInfo.Message = L"Scanning error";
- // errorInfo.FileName = errorPath;
- return res;
- }
- RINOK(callback->FinishScanning());
- }
- }
-
- UString tempDirPrefix;
- bool usesTempDir = false;
-
- #ifdef _WIN32
- NDirectory::CTempDirectoryW tempDirectory;
- if (options.EMailMode && options.EMailRemoveAfter)
- {
- tempDirectory.Create(kTempFolderPrefix);
- tempDirPrefix = tempDirectory.GetPath();
- NormalizeDirPathPrefix(tempDirPrefix);
- usesTempDir = true;
- }
- #endif
-
- CTempFiles tempFiles;
-
- bool createTempFile = false;
-
- bool thereIsInArchive = archiveLink.IsOpen;
-
- if (!options.StdOutMode && options.UpdateArchiveItself)
- {
- CArchivePath &ap = options.Commands[0].ArchivePath;
- ap = options.ArchivePath;
- // if ((archive != 0 && !usesTempDir) || !options.WorkingDir.IsEmpty())
- if ((thereIsInArchive || !options.WorkingDir.IsEmpty()) && !usesTempDir && options.VolumesSizes.Size() == 0)
- {
- createTempFile = true;
- ap.Temp = true;
- if (!options.WorkingDir.IsEmpty())
- {
- ap.TempPrefix = options.WorkingDir;
- NormalizeDirPathPrefix(ap.TempPrefix);
- }
- }
- }
-
- for(int i = 0; i < options.Commands.Size(); i++)
- {
- CArchivePath &ap = options.Commands[i].ArchivePath;
- if (usesTempDir)
- {
- // Check it
- ap.Prefix = tempDirPrefix;
- // ap.Temp = true;
- // ap.TempPrefix = tempDirPrefix;
- }
- if (i > 0 || !createTempFile)
- {
- const UString &path = ap.GetFinalPath();
- if (NFind::DoesFileOrDirExist(path))
- {
- errorInfo.SystemError = 0;
- errorInfo.Message = L"File already exists";
- errorInfo.FileName = path;
- return E_FAIL;
- }
- }
- }
-
- CObjectVector<CArcItem> arcItems;
- if (thereIsInArchive)
- {
- RINOK(EnumerateInArchiveItems(censor, archiveLink.Arcs.Back(), arcItems));
- }
-
- RINOK(UpdateWithItemLists(codecs, options,
- thereIsInArchive ? archiveLink.GetArchive() : 0,
- arcItems, dirItems,
- tempFiles, errorInfo, callback));
-
- if (thereIsInArchive)
- {
- RINOK(archiveLink.Close());
- archiveLink.Release();
- }
-
- tempFiles.Paths.Clear();
- if (createTempFile)
- {
- try
- {
- CArchivePath &ap = options.Commands[0].ArchivePath;
- const UString &tempPath = ap.GetTempPath();
- if (thereIsInArchive)
- if (!NDirectory::DeleteFileAlways(archiveName))
- {
- errorInfo.SystemError = ::GetLastError();
- errorInfo.Message = L"delete file error";
- errorInfo.FileName = archiveName;
- return E_FAIL;
- }
- if (!NDirectory::MyMoveFile(tempPath, archiveName))
- {
- errorInfo.SystemError = ::GetLastError();
- errorInfo.Message = L"move file error";
- errorInfo.FileName = tempPath;
- errorInfo.FileName2 = archiveName;
- return E_FAIL;
- }
- }
- catch(...)
- {
- throw;
- }
- }
-
- #ifdef _WIN32
- if (options.EMailMode)
- {
- NDLL::CLibrary mapiLib;
- if (!mapiLib.Load(TEXT("Mapi32.dll")))
- {
- errorInfo.SystemError = ::GetLastError();
- errorInfo.Message = L"can not load Mapi32.dll";
- return E_FAIL;
- }
- MY_LPMAPISENDDOCUMENTS fnSend = (MY_LPMAPISENDDOCUMENTS)
- mapiLib.GetProcAddress("MAPISendDocuments");
- if (fnSend == 0)
- {
- errorInfo.SystemError = ::GetLastError();
- errorInfo.Message = L"can not find MAPISendDocuments function";
- return E_FAIL;
- }
- UStringVector fullPaths;
- int i;
- for(i = 0; i < options.Commands.Size(); i++)
- {
- CArchivePath &ap = options.Commands[i].ArchivePath;
- UString arcPath;
- if (!NFile::NDirectory::MyGetFullPathName(ap.GetFinalPath(), arcPath))
- {
- errorInfo.SystemError = ::GetLastError();
- return E_FAIL;
- }
- fullPaths.Add(arcPath);
- }
- CCurrentDirRestorer curDirRestorer;
- for(i = 0; i < fullPaths.Size(); i++)
- {
- UString arcPath = fullPaths[i];
- UString fileName = ExtractFileNameFromPath(arcPath);
- AString path = GetAnsiString(arcPath);
- AString name = GetAnsiString(fileName);
- // Warning!!! MAPISendDocuments function changes Current directory
- fnSend(0, ";", (LPSTR)(LPCSTR)path, (LPSTR)(LPCSTR)name, 0);
- }
- }
- #endif
- return S_OK;
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Update.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Update.h
deleted file mode 100644
index 731e9344f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/Update.h
+++ /dev/null
@@ -1,166 +0,0 @@
-// Update.h
-
-#ifndef __UPDATE_H
-#define __UPDATE_H
-
-#include "Common/Wildcard.h"
-#include "Windows/FileFind.h"
-#include "../../Archive/IArchive.h"
-
-#include "UpdateAction.h"
-#include "ArchiveOpenCallback.h"
-#include "UpdateCallback.h"
-#include "Property.h"
-#include "LoadCodecs.h"
-
-struct CArchivePath
-{
- UString Prefix; // path(folder) prefix including slash
- UString Name; // base name
- UString BaseExtension; // archive type extension or "exe" extension
- UString VolExtension; // archive type extension for volumes
-
- bool Temp;
- UString TempPrefix; // path(folder) for temp location
- UString TempPostfix;
-
- CArchivePath(): Temp(false) {};
-
- void ParseFromPath(const UString &path)
- {
- SplitPathToParts(path, Prefix, Name);
- if (Name.IsEmpty())
- return;
- int dotPos = Name.ReverseFind(L'.');
- if (dotPos <= 0)
- return;
- if (dotPos == Name.Length() - 1)
- {
- Name = Name.Left(dotPos);
- BaseExtension.Empty();
- return;
- }
- if (BaseExtension.CompareNoCase(Name.Mid(dotPos + 1)) == 0)
- {
- BaseExtension = Name.Mid(dotPos + 1);
- Name = Name.Left(dotPos);
- }
- else
- BaseExtension.Empty();
- }
-
- UString GetPathWithoutExt() const
- {
- return Prefix + Name;
- }
-
- UString GetFinalPath() const
- {
- UString path = GetPathWithoutExt();
- if (!BaseExtension.IsEmpty())
- path += UString(L'.') + BaseExtension;
- return path;
- }
-
-
- UString GetTempPath() const
- {
- UString path = TempPrefix + Name;
- if (!BaseExtension.IsEmpty())
- path += UString(L'.') + BaseExtension;
- path += L".tmp";
- path += TempPostfix;
- return path;
- }
-};
-
-struct CUpdateArchiveCommand
-{
- UString UserArchivePath;
- CArchivePath ArchivePath;
- NUpdateArchive::CActionSet ActionSet;
-};
-
-struct CCompressionMethodMode
-{
- int FormatIndex;
- CObjectVector<CProperty> Properties;
- CCompressionMethodMode(): FormatIndex(-1) {}
-};
-
-struct CUpdateOptions
-{
- CCompressionMethodMode MethodMode;
-
- CObjectVector<CUpdateArchiveCommand> Commands;
- bool UpdateArchiveItself;
- CArchivePath ArchivePath;
-
- bool SfxMode;
- UString SfxModule;
-
- bool OpenShareForWrite;
-
- bool StdInMode;
- UString StdInFileName;
- bool StdOutMode;
-
- bool EMailMode;
- bool EMailRemoveAfter;
- UString EMailAddress;
-
- UString WorkingDir;
-
- bool Init(const CCodecs *codecs, const CIntVector &formatIndices, const UString &arcPath);
-
- CUpdateOptions():
- UpdateArchiveItself(true),
- SfxMode(false),
- OpenShareForWrite(false),
- StdInMode(false),
- StdOutMode(false),
- EMailMode(false),
- EMailRemoveAfter(false)
- {}
- CRecordVector<UInt64> VolumesSizes;
-};
-
-struct CErrorInfo
-{
- DWORD SystemError;
- UString FileName;
- UString FileName2;
- UString Message;
- // UStringVector ErrorPaths;
- // CRecordVector<DWORD> ErrorCodes;
- CErrorInfo(): SystemError(0) {};
-};
-
-struct CUpdateErrorInfo: public CErrorInfo
-{
-};
-
-#define INTERFACE_IUpdateCallbackUI2(x) \
- INTERFACE_IUpdateCallbackUI(x) \
- virtual HRESULT OpenResult(const wchar_t *name, HRESULT result) x; \
- virtual HRESULT StartScanning() x; \
- virtual HRESULT ScanProgress(UInt64 numFolders, UInt64 numFiles, const wchar_t *path) x; \
- virtual HRESULT CanNotFindError(const wchar_t *name, DWORD systemError) x; \
- virtual HRESULT FinishScanning() x; \
- virtual HRESULT StartArchive(const wchar_t *name, bool updating) x; \
- virtual HRESULT FinishArchive() x; \
-
-struct IUpdateCallbackUI2: public IUpdateCallbackUI
-{
- INTERFACE_IUpdateCallbackUI2(=0)
-};
-
-HRESULT UpdateArchive(
- CCodecs *codecs,
- const NWildcard::CCensor &censor,
- CUpdateOptions &options,
- CUpdateErrorInfo &errorInfo,
- IOpenCallbackUI *openCallback,
- IUpdateCallbackUI2 *callback);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateAction.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateAction.cpp
deleted file mode 100644
index 845384fbb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateAction.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-// UpdateAction.cpp
-
-#include "StdAfx.h"
-
-#include "UpdateAction.h"
-
-namespace NUpdateArchive {
-
-const CActionSet kAddActionSet =
-{
- NPairAction::kCopy,
- NPairAction::kCopy,
- NPairAction::kCompress,
- NPairAction::kCompress,
- NPairAction::kCompress,
- NPairAction::kCompress,
- NPairAction::kCompress
-};
-
-const CActionSet kUpdateActionSet =
-{
- NPairAction::kCopy,
- NPairAction::kCopy,
- NPairAction::kCompress,
- NPairAction::kCopy,
- NPairAction::kCompress,
- NPairAction::kCopy,
- NPairAction::kCompress
-};
-
-const CActionSet kFreshActionSet =
-{
- NPairAction::kCopy,
- NPairAction::kCopy,
- NPairAction::kIgnore,
- NPairAction::kCopy,
- NPairAction::kCompress,
- NPairAction::kCopy,
- NPairAction::kCompress
-};
-
-const CActionSet kSynchronizeActionSet =
-{
- NPairAction::kCopy,
- NPairAction::kIgnore,
- NPairAction::kCompress,
- NPairAction::kCopy,
- NPairAction::kCompress,
- NPairAction::kCopy,
- NPairAction::kCompress,
-};
-
-const CActionSet kDeleteActionSet =
-{
- NPairAction::kCopy,
- NPairAction::kIgnore,
- NPairAction::kIgnore,
- NPairAction::kIgnore,
- NPairAction::kIgnore,
- NPairAction::kIgnore,
- NPairAction::kIgnore
-};
-
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateAction.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateAction.h
deleted file mode 100644
index 7da5ff2eb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateAction.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// UpdateAction.h
-
-#ifndef __UPDATE_ACTION_H
-#define __UPDATE_ACTION_H
-
-namespace NUpdateArchive {
-
- namespace NPairState
- {
- const int kNumValues = 7;
- enum EEnum
- {
- kNotMasked = 0,
- kOnlyInArchive,
- kOnlyOnDisk,
- kNewInArchive,
- kOldInArchive,
- kSameFiles,
- kUnknowNewerFiles
- };
- }
- namespace NPairAction
- {
- enum EEnum
- {
- kIgnore = 0,
- kCopy,
- kCompress,
- kCompressAsAnti
- };
- }
- struct CActionSet
- {
- NPairAction::EEnum StateActions[NPairState::kNumValues];
- bool NeedScanning() const
- {
- int i;
- for (i = 0; i < NPairState::kNumValues; i++)
- if (StateActions[i] == NPairAction::kCompress)
- return true;
- for (i = 1; i < NPairState::kNumValues; i++)
- if (StateActions[i] != NPairAction::kIgnore)
- return true;
- return false;
- }
- };
- extern const CActionSet kAddActionSet;
- extern const CActionSet kUpdateActionSet;
- extern const CActionSet kFreshActionSet;
- extern const CActionSet kSynchronizeActionSet;
- extern const CActionSet kDeleteActionSet;
-};
-
-
-#endif
-
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateCallback.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateCallback.cpp
deleted file mode 100644
index 7c85de213..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateCallback.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-// UpdateCallback.cpp
-
-#include "StdAfx.h"
-
-#include "Common/ComTry.h"
-#include "Common/Defs.h"
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../../Common/FileStreams.h"
-
-#include "UpdateCallback.h"
-
-#ifdef _MSC_VER
-#pragma warning(disable:4297)
-#endif
-
-using namespace NWindows;
-
-CArchiveUpdateCallback::CArchiveUpdateCallback():
- Callback(0),
- ShareForWrite(false),
- StdInMode(false),
- DirItems(0),
- ArcItems(0),
- UpdatePairs(0),
- NewNames(0)
- {}
-
-
-STDMETHODIMP CArchiveUpdateCallback::SetTotal(UInt64 size)
-{
- COM_TRY_BEGIN
- return Callback->SetTotal(size);
- COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::SetCompleted(const UInt64 *completeValue)
-{
- COM_TRY_BEGIN
- return Callback->SetCompleted(completeValue);
- COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
- COM_TRY_BEGIN
- return Callback->SetRatioInfo(inSize, outSize);
- COM_TRY_END
-}
-
-
-/*
-STATPROPSTG kProperties[] =
-{
- { NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidATime, VT_FILETIME},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidAttrib, VT_UI4},
- { NULL, kpidIsAnti, VT_BOOL}
-};
-
-STDMETHODIMP CArchiveUpdateCallback::EnumProperties(IEnumSTATPROPSTG **)
-{
- return CStatPropEnumerator::CreateEnumerator(kProperties, sizeof(kProperties) / sizeof(kProperties[0]), enumerator);
-}
-*/
-
-STDMETHODIMP CArchiveUpdateCallback::GetUpdateItemInfo(UInt32 index,
- Int32 *newData, Int32 *newProps, UInt32 *indexInArchive)
-{
- COM_TRY_BEGIN
- RINOK(Callback->CheckBreak());
- const CUpdatePair2 &up = (*UpdatePairs)[index];
- if (newData != NULL) *newData = BoolToInt(up.NewData);
- if (newProps != NULL) *newProps = BoolToInt(up.NewProps);
- if (indexInArchive != NULL)
- {
- *indexInArchive = (UInt32)-1;
- if (up.ExistInArchive())
- *indexInArchive = (ArcItems == 0) ? up.ArcIndex : (*ArcItems)[up.ArcIndex].IndexInServer;
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- const CUpdatePair2 &up = (*UpdatePairs)[index];
- NWindows::NCOM::CPropVariant prop;
-
- if (propID == kpidIsAnti)
- {
- prop = up.IsAnti;
- prop.Detach(value);
- return S_OK;
- }
-
- if (up.IsAnti)
- {
- switch(propID)
- {
- case kpidIsDir:
- case kpidPath:
- break;
- case kpidSize:
- prop = (UInt64)0;
- prop.Detach(value);
- return S_OK;
- default:
- prop.Detach(value);
- return S_OK;
- }
- }
-
- if (up.ExistOnDisk())
- {
- const CDirItem &di = DirItems->Items[up.DirIndex];
- switch(propID)
- {
- case kpidPath: prop = DirItems->GetLogPath(up.DirIndex); break;
- case kpidIsDir: prop = di.IsDir(); break;
- case kpidSize: prop = di.Size; break;
- case kpidAttrib: prop = di.Attrib; break;
- case kpidCTime: prop = di.CTime; break;
- case kpidATime: prop = di.ATime; break;
- case kpidMTime: prop = di.MTime; break;
- }
- }
- else
- {
- if (propID == kpidPath)
- {
- if (up.NewNameIndex >= 0)
- {
- prop = (*NewNames)[up.NewNameIndex];
- prop.Detach(value);
- return S_OK;
- }
- }
- if (up.ExistInArchive() && Archive)
- {
- UInt32 indexInArchive;
- if (ArcItems == 0)
- indexInArchive = up.ArcIndex;
- else
- indexInArchive = (*ArcItems)[up.ArcIndex].IndexInServer;
- return Archive->GetProperty(indexInArchive, propID, value);
- }
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetStream(UInt32 index, ISequentialInStream **inStream)
-{
- COM_TRY_BEGIN
- const CUpdatePair2 &up = (*UpdatePairs)[index];
- if (!up.NewData)
- return E_FAIL;
-
- RINOK(Callback->CheckBreak());
- RINOK(Callback->Finilize());
-
- if (up.IsAnti)
- {
- return Callback->GetStream((*ArcItems)[up.ArcIndex].Name, true);
- }
- const CDirItem &di = DirItems->Items[up.DirIndex];
- RINOK(Callback->GetStream(DirItems->GetLogPath(up.DirIndex), false));
-
- if (di.IsDir())
- return S_OK;
-
- if (StdInMode)
- {
- CStdInFileStream *inStreamSpec = new CStdInFileStream;
- CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
- *inStream = inStreamLoc.Detach();
- }
- else
- {
- CInFileStream *inStreamSpec = new CInFileStream;
- CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
- const UString path = DirItems->GetPhyPath(up.DirIndex);
- if (!inStreamSpec->OpenShared(path, ShareForWrite))
- {
- return Callback->OpenFileError(path, ::GetLastError());
- }
- *inStream = inStreamLoc.Detach();
- }
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::SetOperationResult(Int32 operationResult)
-{
- COM_TRY_BEGIN
- return Callback->SetOperationResult(operationResult);
- COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetVolumeSize(UInt32 index, UInt64 *size)
-{
- if (VolumesSizes.Size() == 0)
- return S_FALSE;
- if (index >= (UInt32)VolumesSizes.Size())
- index = VolumesSizes.Size() - 1;
- *size = VolumesSizes[index];
- return S_OK;
-}
-
-STDMETHODIMP CArchiveUpdateCallback::GetVolumeStream(UInt32 index, ISequentialOutStream **volumeStream)
-{
- COM_TRY_BEGIN
- wchar_t temp[16];
- ConvertUInt32ToString(index + 1, temp);
- UString res = temp;
- while (res.Length() < 2)
- res = UString(L'0') + res;
- UString fileName = VolName;
- fileName += L'.';
- fileName += res;
- fileName += VolExt;
- COutFileStream *streamSpec = new COutFileStream;
- CMyComPtr<ISequentialOutStream> streamLoc(streamSpec);
- if (!streamSpec->Create(fileName, false))
- return ::GetLastError();
- *volumeStream = streamLoc.Detach();
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
-{
- COM_TRY_BEGIN
- return Callback->CryptoGetTextPassword2(passwordIsDefined, password);
- COM_TRY_END
-}
-
-STDMETHODIMP CArchiveUpdateCallback::CryptoGetTextPassword(BSTR *password)
-{
- COM_TRY_BEGIN
- return Callback->CryptoGetTextPassword(password);
- COM_TRY_END
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateCallback.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateCallback.h
deleted file mode 100644
index 7618574ca..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateCallback.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// UpdateCallback.h
-
-#ifndef __UPDATECALLBACK_H
-#define __UPDATECALLBACK_H
-
-#include "Common/MyCom.h"
-#include "Common/MyString.h"
-
-#include "../../IPassword.h"
-#include "../../ICoder.h"
-
-#include "../Common/UpdatePair.h"
-#include "../Common/UpdateProduce.h"
-
-#define INTERFACE_IUpdateCallbackUI(x) \
- virtual HRESULT SetTotal(UInt64 size) x; \
- virtual HRESULT SetCompleted(const UInt64 *completeValue) x; \
- virtual HRESULT SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize) x; \
- virtual HRESULT CheckBreak() x; \
- virtual HRESULT Finilize() x; \
- virtual HRESULT SetNumFiles(UInt64 numFiles) x; \
- virtual HRESULT GetStream(const wchar_t *name, bool isAnti) x; \
- virtual HRESULT OpenFileError(const wchar_t *name, DWORD systemError) x; \
- virtual HRESULT SetOperationResult(Int32 operationResult) x; \
- virtual HRESULT CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password) x; \
- virtual HRESULT CryptoGetTextPassword(BSTR *password) x;
-
- // virtual HRESULT ShowDeleteFile(const wchar_t *name) x;
- // virtual HRESULT CloseProgress() { return S_OK; };
-
-struct IUpdateCallbackUI
-{
- virtual ~IUpdateCallbackUI() {}
- INTERFACE_IUpdateCallbackUI(=0)
-};
-
-class CArchiveUpdateCallback:
- public IArchiveUpdateCallback2,
- public ICryptoGetTextPassword2,
- public ICryptoGetTextPassword,
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP4(
- IArchiveUpdateCallback2,
- ICryptoGetTextPassword2,
- ICryptoGetTextPassword,
- ICompressProgressInfo)
-
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-
- INTERFACE_IArchiveUpdateCallback2(;)
-
- STDMETHOD(CryptoGetTextPassword2)(Int32 *passwordIsDefined, BSTR *password);
- STDMETHOD(CryptoGetTextPassword)(BSTR *password);
-
-public:
- CRecordVector<UInt64> VolumesSizes;
- UString VolName;
- UString VolExt;
-
- IUpdateCallbackUI *Callback;
-
- bool ShareForWrite;
- bool StdInMode;
- const CDirItems *DirItems;
- const CObjectVector<CArcItem> *ArcItems;
- const CRecordVector<CUpdatePair2> *UpdatePairs;
- const UStringVector *NewNames;
- CMyComPtr<IInArchive> Archive;
-
- CArchiveUpdateCallback();
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdatePair.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdatePair.cpp
deleted file mode 100644
index a43a9e770..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdatePair.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-// UpdatePair.cpp
-
-#include "StdAfx.h"
-
-#include <time.h>
-
-#include "Common/Defs.h"
-#include "Common/Wildcard.h"
-
-#include "Windows/Time.h"
-
-#include "SortUtils.h"
-#include "UpdatePair.h"
-
-using namespace NWindows;
-using namespace NTime;
-
-static int MyCompareTime(NFileTimeType::EEnum fileTimeType, const FILETIME &time1, const FILETIME &time2)
-{
- switch(fileTimeType)
- {
- case NFileTimeType::kWindows:
- return ::CompareFileTime(&time1, &time2);
- case NFileTimeType::kUnix:
- {
- UInt32 unixTime1, unixTime2;
- FileTimeToUnixTime(time1, unixTime1);
- FileTimeToUnixTime(time2, unixTime2);
- return MyCompare(unixTime1, unixTime2);
- }
- case NFileTimeType::kDOS:
- {
- UInt32 dosTime1, dosTime2;
- FileTimeToDosTime(time1, dosTime1);
- FileTimeToDosTime(time2, dosTime2);
- return MyCompare(dosTime1, dosTime2);
- }
- }
- throw 4191618;
-}
-
-static const wchar_t *kDuplicateFileNameMessage = L"Duplicate filename:";
-static const wchar_t *kNotCensoredCollisionMessaged = L"Internal file name collision (file on disk, file in archive):";
-
-static void ThrowError(const UString &message, const UString &s1, const UString &s2)
-{
- UString m = message;
- m += L'\n';
- m += s1;
- m += L'\n';
- m += s2;
- throw m;
-}
-
-static void TestDuplicateString(const UStringVector &strings, const CIntVector &indices)
-{
- for(int i = 0; i + 1 < indices.Size(); i++)
- if (CompareFileNames(strings[indices[i]], strings[indices[i + 1]]) == 0)
- ThrowError(kDuplicateFileNameMessage, strings[indices[i]], strings[indices[i + 1]]);
-}
-
-void GetUpdatePairInfoList(
- const CDirItems &dirItems,
- const CObjectVector<CArcItem> &arcItems,
- NFileTimeType::EEnum fileTimeType,
- CRecordVector<CUpdatePair> &updatePairs)
-{
- CIntVector dirIndices, arcIndices;
-
- int numDirItems = dirItems.Items.Size();
- int numArcItems = arcItems.Size();
-
-
- {
- UStringVector arcNames;
- arcNames.Reserve(numArcItems);
- for (int i = 0; i < numArcItems; i++)
- arcNames.Add(arcItems[i].Name);
- SortFileNames(arcNames, arcIndices);
- TestDuplicateString(arcNames, arcIndices);
- }
-
- UStringVector dirNames;
- {
- dirNames.Reserve(numDirItems);
- for (int i = 0; i < numDirItems; i++)
- dirNames.Add(dirItems.GetLogPath(i));
- SortFileNames(dirNames, dirIndices);
- TestDuplicateString(dirNames, dirIndices);
- }
-
- int dirIndex = 0, arcIndex = 0;
- while (dirIndex < numDirItems && arcIndex < numArcItems)
- {
- CUpdatePair pair;
- int dirIndex2 = dirIndices[dirIndex];
- int arcIndex2 = arcIndices[arcIndex];
- const CDirItem &di = dirItems.Items[dirIndex2];
- const CArcItem &ai = arcItems[arcIndex2];
- int compareResult = CompareFileNames(dirNames[dirIndex2], ai.Name);
- if (compareResult < 0)
- {
- pair.State = NUpdateArchive::NPairState::kOnlyOnDisk;
- pair.DirIndex = dirIndex2;
- dirIndex++;
- }
- else if (compareResult > 0)
- {
- pair.State = ai.Censored ?
- NUpdateArchive::NPairState::kOnlyInArchive:
- NUpdateArchive::NPairState::kNotMasked;
- pair.ArcIndex = arcIndex2;
- arcIndex++;
- }
- else
- {
- if (!ai.Censored)
- ThrowError(kNotCensoredCollisionMessaged, dirNames[dirIndex2], ai.Name);
- pair.DirIndex = dirIndex2;
- pair.ArcIndex = arcIndex2;
- switch (ai.MTimeDefined ? MyCompareTime(
- ai.TimeType != - 1 ? (NFileTimeType::EEnum)ai.TimeType : fileTimeType,
- di.MTime, ai.MTime): 0)
- {
- case -1: pair.State = NUpdateArchive::NPairState::kNewInArchive; break;
- case 1: pair.State = NUpdateArchive::NPairState::kOldInArchive; break;
- default:
- pair.State = (ai.SizeDefined && di.Size == ai.Size) ?
- NUpdateArchive::NPairState::kSameFiles :
- NUpdateArchive::NPairState::kUnknowNewerFiles;
- }
- dirIndex++;
- arcIndex++;
- }
- updatePairs.Add(pair);
- }
-
- for (; dirIndex < numDirItems; dirIndex++)
- {
- CUpdatePair pair;
- pair.State = NUpdateArchive::NPairState::kOnlyOnDisk;
- pair.DirIndex = dirIndices[dirIndex];
- updatePairs.Add(pair);
- }
-
- for (; arcIndex < numArcItems; arcIndex++)
- {
- CUpdatePair pair;
- int arcIndex2 = arcIndices[arcIndex];
- pair.State = arcItems[arcIndex2].Censored ?
- NUpdateArchive::NPairState::kOnlyInArchive:
- NUpdateArchive::NPairState::kNotMasked;
- pair.ArcIndex = arcIndex2;
- updatePairs.Add(pair);
- }
-
- updatePairs.ReserveDown();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdatePair.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdatePair.h
deleted file mode 100644
index 3a332649c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdatePair.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// UpdatePair.h
-
-#ifndef __UPDATE_PAIR_H
-#define __UPDATE_PAIR_H
-
-#include "DirItem.h"
-#include "UpdateAction.h"
-
-#include "../../Archive/IArchive.h"
-
-struct CUpdatePair
-{
- NUpdateArchive::NPairState::EEnum State;
- int ArcIndex;
- int DirIndex;
- CUpdatePair(): ArcIndex(-1), DirIndex(-1) {}
-};
-
-void GetUpdatePairInfoList(
- const CDirItems &dirItems,
- const CObjectVector<CArcItem> &arcItems,
- NFileTimeType::EEnum fileTimeType,
- CRecordVector<CUpdatePair> &updatePairs);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateProduce.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateProduce.cpp
deleted file mode 100644
index c21db3b2a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateProduce.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// UpdateProduce.cpp
-
-#include "StdAfx.h"
-
-#include "UpdateProduce.h"
-
-using namespace NUpdateArchive;
-
-static const char *kUpdateActionSetCollision = "Internal collision in update action set";
-
-void UpdateProduce(
- const CRecordVector<CUpdatePair> &updatePairs,
- const CActionSet &actionSet,
- CRecordVector<CUpdatePair2> &operationChain,
- IUpdateProduceCallback *callback)
-{
- for (int i = 0; i < updatePairs.Size(); i++)
- {
- const CUpdatePair &pair = updatePairs[i];
-
- CUpdatePair2 up2;
- up2.IsAnti = false;
- up2.DirIndex = pair.DirIndex;
- up2.ArcIndex = pair.ArcIndex;
- up2.NewData = up2.NewProps = true;
-
- switch(actionSet.StateActions[pair.State])
- {
- case NPairAction::kIgnore:
- /*
- if (pair.State != NPairState::kOnlyOnDisk)
- IgnoreArchiveItem(m_ArchiveItems[pair.ArcIndex]);
- // cout << "deleting";
- */
- if (callback)
- callback->ShowDeleteFile(pair.ArcIndex);
- continue;
-
- case NPairAction::kCopy:
- if (pair.State == NPairState::kOnlyOnDisk)
- throw kUpdateActionSetCollision;
- up2.NewData = up2.NewProps = false;
- break;
-
- case NPairAction::kCompress:
- if (pair.State == NPairState::kOnlyInArchive ||
- pair.State == NPairState::kNotMasked)
- throw kUpdateActionSetCollision;
- break;
-
- case NPairAction::kCompressAsAnti:
- up2.IsAnti = true;
- break;
- }
- operationChain.Add(up2);
- }
- operationChain.ReserveDown();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateProduce.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateProduce.h
deleted file mode 100644
index 66b6e95b7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/UpdateProduce.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// UpdateProduce.h
-
-#ifndef __UPDATE_PRODUCE_H
-#define __UPDATE_PRODUCE_H
-
-#include "UpdatePair.h"
-
-struct CUpdatePair2
-{
- bool NewData;
- bool NewProps;
- bool IsAnti;
-
- int DirIndex;
- int ArcIndex;
- int NewNameIndex;
-
- bool ExistOnDisk() const { return DirIndex != -1; }
- bool ExistInArchive() const { return ArcIndex != -1; }
-
- CUpdatePair2(): IsAnti(false), DirIndex(-1), ArcIndex(-1), NewNameIndex(-1) {}
-};
-
-struct IUpdateProduceCallback
-{
- virtual ~IUpdateProduceCallback() {}
- virtual HRESULT ShowDeleteFile(int arcIndex) = 0;
-};
-
-void UpdateProduce(
- const CRecordVector<CUpdatePair> &updatePairs,
- const NUpdateArchive::CActionSet &actionSet,
- CRecordVector<CUpdatePair2> &operationChain,
- IUpdateProduceCallback *callback);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/WorkDir.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/WorkDir.cpp
deleted file mode 100644
index ea5dfef43..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/WorkDir.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// WorkDir.cpp
-
-#include "StdAfx.h"
-
-#include "WorkDir.h"
-
-#include "Common/StringConvert.h"
-#include "Common/Wildcard.h"
-
-#include "Windows/FileName.h"
-#include "Windows/FileDir.h"
-
-#if _WIN32
-static inline UINT GetCurrentCodePage()
- { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NName;
-
-UString GetWorkDir(const NWorkDir::CInfo &workDirInfo, const UString &path)
-{
- NWorkDir::NMode::EEnum mode = workDirInfo.Mode;
- if (workDirInfo.ForRemovableOnly)
- {
- mode = NWorkDir::NMode::kCurrent;
- UString prefix = path.Left(3);
- if (prefix[1] == L':' && prefix[2] == WCHAR_PATH_SEPARATOR)
- {
- UINT driveType = GetDriveType(GetSystemString(prefix, GetCurrentCodePage()));
- if (driveType == DRIVE_CDROM || driveType == DRIVE_REMOVABLE)
- mode = workDirInfo.Mode;
- }
- /*
- CParsedPath parsedPath;
- parsedPath.ParsePath(archiveName);
- UINT driveType = GetDriveType(parsedPath.Prefix);
- if ((driveType != DRIVE_CDROM) && (driveType != DRIVE_REMOVABLE))
- mode = NZipSettings::NWorkDir::NMode::kCurrent;
- */
- }
- switch(mode)
- {
- case NWorkDir::NMode::kCurrent:
- {
- return ExtractDirPrefixFromPath(path);
- }
- case NWorkDir::NMode::kSpecified:
- {
- UString tempDir = workDirInfo.Path;
- NormalizeDirPathPrefix(tempDir);
- return tempDir;
- }
- default:
- {
- UString tempDir;
- if(!NFile::NDirectory::MyGetTempPath(tempDir))
- throw 141717;
- return tempDir;
- }
- }
-}
-#else
-UString GetWorkDir(const NWorkDir::CInfo &workDirInfo, const UString &path)
-{
- return L"."; // FIXME
-}
-#endif
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/WorkDir.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/WorkDir.h
deleted file mode 100644
index 0643d67a4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/WorkDir.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// WorkDir.h
-
-#ifndef __WORKDIR_H
-#define __WORKDIR_H
-
-#include "ZipRegistry.h"
-
-UString GetWorkDir(const NWorkDir::CInfo &workDirInfo, const UString &path);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ZipRegistry.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ZipRegistry.cpp
deleted file mode 100644
index 16df878fb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ZipRegistry.cpp
+++ /dev/null
@@ -1,417 +0,0 @@
-// ZipRegistry.cpp
-
-#include "StdAfx.h"
-
-#include "ZipRegistry.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/Synchronization.h"
-#include "Windows/Registry.h"
-
-#include "Windows/FileDir.h"
-
-using namespace NWindows;
-using namespace NRegistry;
-
-static const TCHAR *kCUBasePath = TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-ZIP");
-
-static NSynchronization::CCriticalSection g_RegistryOperationsCriticalSection;
-
-//////////////////////
-// ExtractionInfo
-
-static const TCHAR *kExtractionKeyName = TEXT("Extraction");
-
-static const TCHAR *kExtractionPathHistoryKeyName = TEXT("PathHistory");
-static const TCHAR *kExtractionExtractModeValueName = TEXT("ExtarctMode");
-static const TCHAR *kExtractionOverwriteModeValueName = TEXT("OverwriteMode");
-static const TCHAR *kExtractionShowPasswordValueName = TEXT("ShowPassword");
-
-static CSysString GetKeyPath(const CSysString &path)
-{
- return CSysString(kCUBasePath) + CSysString(CHAR_PATH_SEPARATOR) + path;
-}
-
-void SaveExtractionInfo(const NExtract::CInfo &info)
-{
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- CKey extractionKey;
- extractionKey.Create(HKEY_CURRENT_USER, GetKeyPath(kExtractionKeyName));
- extractionKey.RecurseDeleteKey(kExtractionPathHistoryKeyName);
- {
- CKey pathHistoryKey;
- pathHistoryKey.Create(extractionKey, kExtractionPathHistoryKeyName);
- for(int i = 0; i < info.Paths.Size(); i++)
- {
- wchar_t numberString[16];
- ConvertUInt32ToString(i, numberString);
- pathHistoryKey.SetValue(numberString, info.Paths[i]);
- }
- }
- extractionKey.SetValue(kExtractionExtractModeValueName, UInt32(info.PathMode));
- extractionKey.SetValue(kExtractionOverwriteModeValueName, UInt32(info.OverwriteMode));
- extractionKey.SetValue(kExtractionShowPasswordValueName, info.ShowPassword);
-}
-
-void ReadExtractionInfo(NExtract::CInfo &info)
-{
- info.Paths.Clear();
- info.PathMode = NExtract::NPathMode::kCurrentPathnames;
- info.OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
- info.ShowPassword = false;
-
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- CKey extractionKey;
- if(extractionKey.Open(HKEY_CURRENT_USER, GetKeyPath(kExtractionKeyName), KEY_READ) != ERROR_SUCCESS)
- return;
-
- {
- CKey pathHistoryKey;
- if(pathHistoryKey.Open(extractionKey, kExtractionPathHistoryKeyName, KEY_READ) ==
- ERROR_SUCCESS)
- {
- for (;;)
- {
- wchar_t numberString[16];
- ConvertUInt32ToString(info.Paths.Size(), numberString);
- UString path;
- if (pathHistoryKey.QueryValue(numberString, path) != ERROR_SUCCESS)
- break;
- info.Paths.Add(path);
- }
- }
- }
- UInt32 extractModeIndex;
- if (extractionKey.QueryValue(kExtractionExtractModeValueName, extractModeIndex) == ERROR_SUCCESS)
- {
- switch (extractModeIndex)
- {
- case NExtract::NPathMode::kFullPathnames:
- case NExtract::NPathMode::kCurrentPathnames:
- case NExtract::NPathMode::kNoPathnames:
- info.PathMode = NExtract::NPathMode::EEnum(extractModeIndex);
- break;
- }
- }
- UInt32 overwriteModeIndex;
- if (extractionKey.QueryValue(kExtractionOverwriteModeValueName, overwriteModeIndex) == ERROR_SUCCESS)
- {
- switch (overwriteModeIndex)
- {
- case NExtract::NOverwriteMode::kAskBefore:
- case NExtract::NOverwriteMode::kWithoutPrompt:
- case NExtract::NOverwriteMode::kSkipExisting:
- case NExtract::NOverwriteMode::kAutoRename:
- case NExtract::NOverwriteMode::kAutoRenameExisting:
- info.OverwriteMode = NExtract::NOverwriteMode::EEnum(overwriteModeIndex);
- break;
- }
- }
- if (extractionKey.QueryValue(kExtractionShowPasswordValueName,
- info.ShowPassword) != ERROR_SUCCESS)
- info.ShowPassword = false;
-}
-
-///////////////////////////////////
-// CompressionInfo
-
-static const TCHAR *kCompressionKeyName = TEXT("Compression");
-
-static const TCHAR *kCompressionHistoryArchivesKeyName = TEXT("ArcHistory");
-static const TCHAR *kCompressionLevelValueName = TEXT("Level");
-static const TCHAR *kCompressionLastFormatValueName = TEXT("Archiver");
-static const TCHAR *kCompressionShowPasswordValueName = TEXT("ShowPassword");
-static const TCHAR *kCompressionEncryptHeadersValueName = TEXT("EncryptHeaders");
-
-static const TCHAR *kCompressionOptionsKeyName = TEXT("Options");
-// static const TCHAR *kSolid = TEXT("Solid");
-// static const TCHAR *kMultiThread = TEXT("Multithread");
-
-static const WCHAR *kCompressionOptions = L"Options";
-static const TCHAR *kCompressionLevel = TEXT("Level");
-static const WCHAR *kCompressionMethod = L"Method";
-static const WCHAR *kEncryptionMethod = L"EncryptionMethod";
-static const TCHAR *kCompressionDictionary = TEXT("Dictionary");
-static const TCHAR *kCompressionOrder = TEXT("Order");
-static const TCHAR *kCompressionNumThreads = TEXT("NumThreads");
-static const TCHAR *kCompressionBlockSize = TEXT("BlockSize");
-
-
-static void SetRegString(CKey &key, const WCHAR *name, const UString &value)
-{
- if (value.IsEmpty())
- key.DeleteValue(name);
- else
- key.SetValue(name, value);
-}
-
-static void SetRegUInt32(CKey &key, const TCHAR *name, UInt32 value)
-{
- if (value == (UInt32)-1)
- key.DeleteValue(name);
- else
- key.SetValue(name, value);
-}
-
-static void GetRegString(CKey &key, const WCHAR *name, UString &value)
-{
- if (key.QueryValue(name, value) != ERROR_SUCCESS)
- value.Empty();
-}
-
-static void GetRegUInt32(CKey &key, const TCHAR *name, UInt32 &value)
-{
- if (key.QueryValue(name, value) != ERROR_SUCCESS)
- value = UInt32(-1);
-}
-
-void SaveCompressionInfo(const NCompression::CInfo &info)
-{
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
-
- CKey compressionKey;
- compressionKey.Create(HKEY_CURRENT_USER, GetKeyPath(kCompressionKeyName));
- compressionKey.RecurseDeleteKey(kCompressionHistoryArchivesKeyName);
- {
- CKey historyArchivesKey;
- historyArchivesKey.Create(compressionKey, kCompressionHistoryArchivesKeyName);
- for(int i = 0; i < info.HistoryArchives.Size(); i++)
- {
- wchar_t numberString[16];
- ConvertUInt32ToString(i, numberString);
- historyArchivesKey.SetValue(numberString, info.HistoryArchives[i]);
- }
- }
-
- // compressionKey.SetValue(kSolid, info.Solid);
- // compressionKey.SetValue(kMultiThread, info.MultiThread);
- compressionKey.RecurseDeleteKey(kCompressionOptionsKeyName);
- {
- CKey optionsKey;
- optionsKey.Create(compressionKey, kCompressionOptionsKeyName);
- for(int i = 0; i < info.FormatOptionsVector.Size(); i++)
- {
- const NCompression::CFormatOptions &fo = info.FormatOptionsVector[i];
- CKey formatKey;
- formatKey.Create(optionsKey, fo.FormatID);
-
- SetRegString(formatKey, kCompressionOptions, fo.Options);
- SetRegString(formatKey, kCompressionMethod, fo.Method);
- SetRegString(formatKey, kEncryptionMethod, fo.EncryptionMethod);
-
- SetRegUInt32(formatKey, kCompressionLevel, fo.Level);
- SetRegUInt32(formatKey, kCompressionDictionary, fo.Dictionary);
- SetRegUInt32(formatKey, kCompressionOrder, fo.Order);
- SetRegUInt32(formatKey, kCompressionBlockSize, fo.BlockLogSize);
- SetRegUInt32(formatKey, kCompressionNumThreads, fo.NumThreads);
- }
- }
-
- compressionKey.SetValue(kCompressionLevelValueName, UInt32(info.Level));
- compressionKey.SetValue(kCompressionLastFormatValueName, GetSystemString(info.ArchiveType));
-
- compressionKey.SetValue(kCompressionShowPasswordValueName, info.ShowPassword);
- compressionKey.SetValue(kCompressionEncryptHeadersValueName, info.EncryptHeaders);
- // compressionKey.SetValue(kCompressionMaximizeValueName, info.Maximize);
-}
-
-void ReadCompressionInfo(NCompression::CInfo &info)
-{
- info.HistoryArchives.Clear();
-
- // info.Solid = true;
- // info.MultiThread = IsMultiProcessor();
- info.FormatOptionsVector.Clear();
-
- info.Level = 5;
- info.ArchiveType = L"7z";
- // definedStatus.Maximize = false;
- info.ShowPassword = false;
- info.EncryptHeaders = false;
-
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- CKey compressionKey;
-
- if(compressionKey.Open(HKEY_CURRENT_USER,
- GetKeyPath(kCompressionKeyName), KEY_READ) != ERROR_SUCCESS)
- return;
-
- {
- CKey historyArchivesKey;
- if(historyArchivesKey.Open(compressionKey, kCompressionHistoryArchivesKeyName, KEY_READ) ==
- ERROR_SUCCESS)
- {
- for (;;)
- {
- wchar_t numberString[16];
- ConvertUInt32ToString(info.HistoryArchives.Size(), numberString);
- UString path;
- if (historyArchivesKey.QueryValue(numberString, path) != ERROR_SUCCESS)
- break;
- info.HistoryArchives.Add(path);
- }
- }
- }
-
-
- /*
- bool solid = false;
- if (compressionKey.QueryValue(kSolid, solid) == ERROR_SUCCESS)
- info.Solid = solid;
- bool multiThread = false;
- if (compressionKey.QueryValue(kMultiThread, multiThread) == ERROR_SUCCESS)
- info.MultiThread = multiThread;
- */
-
- {
- CKey optionsKey;
- if(optionsKey.Open(compressionKey, kCompressionOptionsKeyName, KEY_READ) ==
- ERROR_SUCCESS)
- {
- CSysStringVector formatIDs;
- optionsKey.EnumKeys(formatIDs);
- for(int i = 0; i < formatIDs.Size(); i++)
- {
- CKey formatKey;
- NCompression::CFormatOptions fo;
- fo.FormatID = formatIDs[i];
- if(formatKey.Open(optionsKey, fo.FormatID, KEY_READ) == ERROR_SUCCESS)
- {
- GetRegString(formatKey, kCompressionOptions, fo.Options);
- GetRegString(formatKey, kCompressionMethod, fo.Method);
- GetRegString(formatKey, kEncryptionMethod, fo.EncryptionMethod);
-
- GetRegUInt32(formatKey, kCompressionLevel, fo.Level);
- GetRegUInt32(formatKey, kCompressionDictionary, fo.Dictionary);
- GetRegUInt32(formatKey, kCompressionOrder, fo.Order);
- GetRegUInt32(formatKey, kCompressionBlockSize, fo.BlockLogSize);
- GetRegUInt32(formatKey, kCompressionNumThreads, fo.NumThreads);
-
- info.FormatOptionsVector.Add(fo);
- }
-
- }
- }
- }
-
- UInt32 level;
- if (compressionKey.QueryValue(kCompressionLevelValueName, level) == ERROR_SUCCESS)
- info.Level = level;
- CSysString archiveType;
- if (compressionKey.QueryValue(kCompressionLastFormatValueName, archiveType) == ERROR_SUCCESS)
- info.ArchiveType = GetUnicodeString(archiveType);
- if (compressionKey.QueryValue(kCompressionShowPasswordValueName,
- info.ShowPassword) != ERROR_SUCCESS)
- info.ShowPassword = false;
- if (compressionKey.QueryValue(kCompressionEncryptHeadersValueName,
- info.EncryptHeaders) != ERROR_SUCCESS)
- info.EncryptHeaders = false;
- /*
- if (compressionKey.QueryValue(kCompressionLevelValueName, info.Maximize) == ERROR_SUCCESS)
- definedStatus.Maximize = true;
- */
-}
-
-
-///////////////////////////////////
-// WorkDirInfo
-
-static const TCHAR *kOptionsInfoKeyName = TEXT("Options");
-
-static const TCHAR *kWorkDirTypeValueName = TEXT("WorkDirType");
-static const WCHAR *kWorkDirPathValueName = L"WorkDirPath";
-static const TCHAR *kTempRemovableOnlyValueName = TEXT("TempRemovableOnly");
-static const TCHAR *kCascadedMenuValueName = TEXT("CascadedMenu");
-static const TCHAR *kContextMenuValueName = TEXT("ContextMenu");
-
-void SaveWorkDirInfo(const NWorkDir::CInfo &info)
-{
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- CKey optionsKey;
- optionsKey.Create(HKEY_CURRENT_USER, GetKeyPath(kOptionsInfoKeyName));
- optionsKey.SetValue(kWorkDirTypeValueName, UInt32(info.Mode));
- optionsKey.SetValue(kWorkDirPathValueName, info.Path);
- optionsKey.SetValue(kTempRemovableOnlyValueName, info.ForRemovableOnly);
-}
-
-void ReadWorkDirInfo(NWorkDir::CInfo &info)
-{
- info.SetDefault();
-
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- CKey optionsKey;
- if(optionsKey.Open(HKEY_CURRENT_USER, GetKeyPath(kOptionsInfoKeyName), KEY_READ) != ERROR_SUCCESS)
- return;
-
- UInt32 dirType;
- if (optionsKey.QueryValue(kWorkDirTypeValueName, dirType) != ERROR_SUCCESS)
- return;
- switch (dirType)
- {
- case NWorkDir::NMode::kSystem:
- case NWorkDir::NMode::kCurrent:
- case NWorkDir::NMode::kSpecified:
- info.Mode = NWorkDir::NMode::EEnum(dirType);
- }
- UString sysWorkDir;
- if (optionsKey.QueryValue(kWorkDirPathValueName, sysWorkDir) != ERROR_SUCCESS)
- {
- info.Path.Empty();
- if (info.Mode == NWorkDir::NMode::kSpecified)
- info.Mode = NWorkDir::NMode::kSystem;
- }
- info.Path = GetUnicodeString(sysWorkDir);
- if (optionsKey.QueryValue(kTempRemovableOnlyValueName, info.ForRemovableOnly) != ERROR_SUCCESS)
- info.SetForRemovableOnlyDefault();
-}
-
-static void SaveOption(const TCHAR *value, bool enabled)
-{
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- CKey optionsKey;
- optionsKey.Create(HKEY_CURRENT_USER, GetKeyPath(kOptionsInfoKeyName));
- optionsKey.SetValue(value, enabled);
-}
-
-static bool ReadOption(const TCHAR *value, bool defaultValue)
-{
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- CKey optionsKey;
- if(optionsKey.Open(HKEY_CURRENT_USER, GetKeyPath(kOptionsInfoKeyName), KEY_READ) != ERROR_SUCCESS)
- return defaultValue;
- bool enabled;
- if (optionsKey.QueryValue(value, enabled) != ERROR_SUCCESS)
- return defaultValue;
- return enabled;
-}
-
-void SaveCascadedMenu(bool show)
- { SaveOption(kCascadedMenuValueName, show); }
-bool ReadCascadedMenu()
- { return ReadOption(kCascadedMenuValueName, true); }
-
-
-static void SaveValue(const TCHAR *value, UInt32 valueToWrite)
-{
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- CKey optionsKey;
- optionsKey.Create(HKEY_CURRENT_USER, GetKeyPath(kOptionsInfoKeyName));
- optionsKey.SetValue(value, valueToWrite);
-}
-
-static bool ReadValue(const TCHAR *value, UInt32 &result)
-{
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- CKey optionsKey;
- if(optionsKey.Open(HKEY_CURRENT_USER, GetKeyPath(kOptionsInfoKeyName), KEY_READ) != ERROR_SUCCESS)
- return false;
- return (optionsKey.QueryValue(value, result) == ERROR_SUCCESS);
-}
-
-void SaveContextMenuStatus(UInt32 value)
- { SaveValue(kContextMenuValueName, value); }
-
-bool ReadContextMenuStatus(UInt32 &value)
- { return ReadValue(kContextMenuValueName, value); }
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ZipRegistry.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ZipRegistry.h
deleted file mode 100644
index 30be8d895..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Common/ZipRegistry.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// ZipRegistry.h
-
-#ifndef __ZIPREGISTRY_H
-#define __ZIPREGISTRY_H
-
-#include "Common/MyString.h"
-#include "Common/Types.h"
-#include "ExtractMode.h"
-
-namespace NExtract
-{
- struct CInfo
- {
- NPathMode::EEnum PathMode;
- NOverwriteMode::EEnum OverwriteMode;
- UStringVector Paths;
- bool ShowPassword;
- };
-}
-
-namespace NCompression {
-
- struct CFormatOptions
- {
- CSysString FormatID;
- UString Options;
- UString Method;
- UString EncryptionMethod;
- UInt32 Level;
- UInt32 Dictionary;
- UInt32 Order;
- UInt32 BlockLogSize;
- UInt32 NumThreads;
- void ResetForLevelChange()
- {
- BlockLogSize = NumThreads = Level = Dictionary = Order = UInt32(-1);
- Method.Empty();
- // EncryptionMethod.Empty();
- // Options.Empty();
- }
- CFormatOptions() { ResetForLevelChange(); }
- };
-
- struct CInfo
- {
- UStringVector HistoryArchives;
- UInt32 Level;
- UString ArchiveType;
-
- CObjectVector<CFormatOptions> FormatOptionsVector;
-
- bool ShowPassword;
- bool EncryptHeaders;
- };
-}
-
-namespace NWorkDir{
-
- namespace NMode
- {
- enum EEnum
- {
- kSystem,
- kCurrent,
- kSpecified
- };
- }
- struct CInfo
- {
- NMode::EEnum Mode;
- UString Path;
- bool ForRemovableOnly;
- void SetForRemovableOnlyDefault() { ForRemovableOnly = true; }
- void SetDefault()
- {
- Mode = NMode::kSystem;
- Path.Empty();
- SetForRemovableOnlyDefault();
- }
- };
-}
-
-void SaveExtractionInfo(const NExtract::CInfo &info);
-void ReadExtractionInfo(NExtract::CInfo &info);
-
-void SaveCompressionInfo(const NCompression::CInfo &info);
-void ReadCompressionInfo(NCompression::CInfo &info);
-
-void SaveWorkDirInfo(const NWorkDir::CInfo &info);
-void ReadWorkDirInfo(NWorkDir::CInfo &info);
-
-void SaveCascadedMenu(bool enabled);
-bool ReadCascadedMenu();
-
-void SaveContextMenuStatus(UInt32 value);
-bool ReadContextMenuStatus(UInt32 &value);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ConsoleClose.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ConsoleClose.cpp
deleted file mode 100644
index 9bb2082bf..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ConsoleClose.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// ConsoleClose.cpp
-
-#include "StdAfx.h"
-
-#include "ConsoleClose.h"
-
-#include <signal.h>
-
-static int g_BreakCounter = 0;
-static const int kBreakAbortThreshold = 2;
-
-namespace NConsoleClose {
-
-static void HandlerRoutine(int)
-{
- g_BreakCounter++;
- if (g_BreakCounter < kBreakAbortThreshold)
- return ;
- exit(EXIT_FAILURE);
-}
-
-bool TestBreakSignal()
-{
- return (g_BreakCounter > 0);
-}
-
-void CheckCtrlBreak()
-{
- if (TestBreakSignal())
- throw CCtrlBreakException();
-}
-
-CCtrlHandlerSetter::CCtrlHandlerSetter()
-{
- memo_sig_int = signal(SIGINT,HandlerRoutine); // CTRL-C
- if (memo_sig_int == SIG_ERR)
- throw "SetConsoleCtrlHandler fails (SIGINT)";
- memo_sig_term = signal(SIGTERM,HandlerRoutine); // for kill -15 (before "kill -9")
- if (memo_sig_term == SIG_ERR)
- throw "SetConsoleCtrlHandler fails (SIGTERM)";
-}
-
-CCtrlHandlerSetter::~CCtrlHandlerSetter()
-{
- signal(SIGINT,memo_sig_int); // CTRL-C
- signal(SIGTERM,memo_sig_term); // kill {pid}
-}
-
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ConsoleClose.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ConsoleClose.h
deleted file mode 100644
index 042aaf2d6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ConsoleClose.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// ConsoleCloseUtils.h
-
-#ifndef __CONSOLECLOSEUTILS_H
-#define __CONSOLECLOSEUTILS_H
-
-namespace NConsoleClose {
-
-bool TestBreakSignal();
-
-class CCtrlHandlerSetter
-{
- void (*memo_sig_int)(int);
- void (*memo_sig_term)(int);
-public:
- CCtrlHandlerSetter();
- virtual ~CCtrlHandlerSetter();
-};
-
-class CCtrlBreakException
-{};
-
-void CheckCtrlBreak();
-
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp
deleted file mode 100644
index af65739c3..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ExtractCallbackConsole.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-// ExtractCallbackConsole.h
-
-#include "StdAfx.h"
-
-#include "ExtractCallbackConsole.h"
-#include "UserInputUtils.h"
-#include "ConsoleClose.h"
-
-#include "Common/Wildcard.h"
-
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-#include "Windows/Time.h"
-#include "Windows/Defs.h"
-#include "Windows/PropVariant.h"
-#include "Windows/Error.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "../../Common/FilePathAutoRename.h"
-
-#include "../Common/ExtractingFilePath.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NDirectory;
-
-static const char *kTestString = "Testing ";
-static const char *kExtractString = "Extracting ";
-static const char *kSkipString = "Skipping ";
-
-// static const char *kCantAutoRename = "can not create file with auto name\n";
-// static const char *kCantRenameFile = "can not rename existing file\n";
-// static const char *kCantDeleteOutputFile = "can not delete output file ";
-static const char *kError = "ERROR: ";
-static const char *kMemoryExceptionMessage = "Can't allocate required memory!";
-
-static const char *kProcessing = "Processing archive: ";
-static const char *kEverythingIsOk = "Everything is Ok";
-static const char *kNoFiles = "No files to process";
-
-static const char *kUnsupportedMethod = "Unsupported Method";
-static const char *kCrcFailed = "CRC Failed";
-static const char *kCrcFailedEncrypted = "CRC Failed in encrypted file. Wrong password?";
-static const char *kDataError = "Data Error";
-static const char *kDataErrorEncrypted = "Data Error in encrypted file. Wrong password?";
-static const char *kUnknownError = "Unknown Error";
-
-STDMETHODIMP CExtractCallbackConsole::SetTotal(UInt64)
-{
- if (NConsoleClose::TestBreakSignal())
- return E_ABORT;
- return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackConsole::SetCompleted(const UInt64 *)
-{
- if (NConsoleClose::TestBreakSignal())
- return E_ABORT;
- return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackConsole::AskOverwrite(
- const wchar_t *existName, const FILETIME *, const UInt64 *,
- const wchar_t *newName, const FILETIME *, const UInt64 *,
- Int32 *answer)
-{
- (*OutStream) << "file " << existName <<
- "\nalready exists. Overwrite with " << endl;
- (*OutStream) << newName;
-
- NUserAnswerMode::EEnum overwriteAnswer = ScanUserYesNoAllQuit(OutStream);
-
- switch(overwriteAnswer)
- {
- case NUserAnswerMode::kQuit: return E_ABORT;
- case NUserAnswerMode::kNo: *answer = NOverwriteAnswer::kNo; break;
- case NUserAnswerMode::kNoAll: *answer = NOverwriteAnswer::kNoToAll; break;
- case NUserAnswerMode::kYesAll: *answer = NOverwriteAnswer::kYesToAll; break;
- case NUserAnswerMode::kYes: *answer = NOverwriteAnswer::kYes; break;
- case NUserAnswerMode::kAutoRenameAll: *answer = NOverwriteAnswer::kAutoRename; break;
- default: return E_FAIL;
- }
- return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackConsole::PrepareOperation(const wchar_t *name, bool /* isFolder */, Int32 askExtractMode, const UInt64 *position)
-{
- switch (askExtractMode)
- {
- case NArchive::NExtract::NAskMode::kExtract: (*OutStream) << kExtractString; break;
- case NArchive::NExtract::NAskMode::kTest: (*OutStream) << kTestString; break;
- case NArchive::NExtract::NAskMode::kSkip: (*OutStream) << kSkipString; break;
- };
- (*OutStream) << name;
- if (position != 0)
- (*OutStream) << " <" << *position << ">";
- return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackConsole::MessageError(const wchar_t *message)
-{
- (*OutStream) << message << endl;
- NumFileErrorsInCurrentArchive++;
- NumFileErrors++;
- return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackConsole::SetOperationResult(Int32 operationResult, bool encrypted)
-{
- switch(operationResult)
- {
- case NArchive::NExtract::NOperationResult::kOK:
- break;
- default:
- {
- NumFileErrorsInCurrentArchive++;
- NumFileErrors++;
- (*OutStream) << " ";
- switch(operationResult)
- {
- case NArchive::NExtract::NOperationResult::kUnSupportedMethod:
- (*OutStream) << kUnsupportedMethod;
- break;
- case NArchive::NExtract::NOperationResult::kCRCError:
- (*OutStream) << (encrypted ? kCrcFailedEncrypted: kCrcFailed);
- break;
- case NArchive::NExtract::NOperationResult::kDataError:
- (*OutStream) << (encrypted ? kDataErrorEncrypted : kDataError);
- break;
- default:
- (*OutStream) << kUnknownError;
- }
- }
- }
- (*OutStream) << endl;
- return S_OK;
-}
-
-#ifndef _NO_CRYPTO
-
-HRESULT CExtractCallbackConsole::SetPassword(const UString &password)
-{
- PasswordIsDefined = true;
- Password = password;
- return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackConsole::CryptoGetTextPassword(BSTR *password)
-{
- if (!PasswordIsDefined)
- {
- Password = GetPassword(OutStream);
- PasswordIsDefined = true;
- }
- return StringToBstr(Password, password);
-}
-
-#endif
-
-HRESULT CExtractCallbackConsole::BeforeOpen(const wchar_t *name)
-{
- NumArchives++;
- NumFileErrorsInCurrentArchive = 0;
- (*OutStream) << endl << kProcessing << name << endl;
- return S_OK;
-}
-
-HRESULT CExtractCallbackConsole::OpenResult(const wchar_t * /* name */, HRESULT result, bool encrypted)
-{
- (*OutStream) << endl;
- if (result != S_OK)
- {
- (*OutStream) << "Error: ";
- if (result == S_FALSE)
- {
- (*OutStream) << (encrypted ?
- "Can not open encrypted archive. Wrong password?" :
- "Can not open file as archive");
- }
- else
- {
- if (result == E_OUTOFMEMORY)
- (*OutStream) << "Can't allocate required memory";
- else
- (*OutStream) << NError::MyFormatMessage(result);
- }
- (*OutStream) << endl;
- NumArchiveErrors++;
- }
- return S_OK;
-}
-
-HRESULT CExtractCallbackConsole::ThereAreNoFiles()
-{
- (*OutStream) << endl << kNoFiles << endl;
- return S_OK;
-}
-
-HRESULT CExtractCallbackConsole::ExtractResult(HRESULT result)
-{
- if (result == S_OK)
- {
- (*OutStream) << endl;
- if (NumFileErrorsInCurrentArchive == 0)
- (*OutStream) << kEverythingIsOk << endl;
- else
- {
- NumArchiveErrors++;
- (*OutStream) << "Sub items Errors: " << NumFileErrorsInCurrentArchive << endl;
- }
- }
- if (result == S_OK)
- return result;
- NumArchiveErrors++;
- if (result == E_ABORT || result == ERROR_DISK_FULL)
- return result;
- (*OutStream) << endl << kError;
- if (result == E_OUTOFMEMORY)
- (*OutStream) << kMemoryExceptionMessage;
- else
- {
- UString message;
- NError::MyFormatMessage(result, message);
- (*OutStream) << message;
- }
- (*OutStream) << endl;
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ExtractCallbackConsole.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ExtractCallbackConsole.h
deleted file mode 100644
index e42ca6f40..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/ExtractCallbackConsole.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// ExtractCallbackConsole.h
-
-#ifndef __EXTRACTCALLBACKCONSOLE_H
-#define __EXTRACTCALLBACKCONSOLE_H
-
-#include "Common/MyString.h"
-#include "Common/StdOutStream.h"
-#include "../../Common/FileStreams.h"
-#include "../../IPassword.h"
-#include "../../Archive/IArchive.h"
-#include "../Common/ArchiveExtractCallback.h"
-
-class CExtractCallbackConsole:
- public IExtractCallbackUI,
- #ifndef _NO_CRYPTO
- public ICryptoGetTextPassword,
- #endif
- public CMyUnknownImp
-{
-public:
- MY_QUERYINTERFACE_BEGIN2(IFolderArchiveExtractCallback)
- #ifndef _NO_CRYPTO
- MY_QUERYINTERFACE_ENTRY(ICryptoGetTextPassword)
- #endif
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
- STDMETHOD(SetTotal)(UInt64 total);
- STDMETHOD(SetCompleted)(const UInt64 *completeValue);
-
- // IFolderArchiveExtractCallback
- STDMETHOD(AskOverwrite)(
- const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
- const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
- Int32 *answer);
- STDMETHOD (PrepareOperation)(const wchar_t *name, bool isFolder, Int32 askExtractMode, const UInt64 *position);
-
- STDMETHOD(MessageError)(const wchar_t *message);
- STDMETHOD(SetOperationResult)(Int32 operationResult, bool encrypted);
-
- HRESULT BeforeOpen(const wchar_t *name);
- HRESULT OpenResult(const wchar_t *name, HRESULT result, bool encrypted);
- HRESULT ThereAreNoFiles();
- HRESULT ExtractResult(HRESULT result);
-
-
- #ifndef _NO_CRYPTO
- HRESULT SetPassword(const UString &password);
- STDMETHOD(CryptoGetTextPassword)(BSTR *password);
-
- bool PasswordIsDefined;
- UString Password;
-
- #endif
-
- UInt64 NumArchives;
- UInt64 NumArchiveErrors;
- UInt64 NumFileErrors;
- UInt64 NumFileErrorsInCurrentArchive;
-
- CStdOutStream *OutStream;
-
- void Init()
- {
- NumArchives = 0;
- NumArchiveErrors = 0;
- NumFileErrors = 0;
- NumFileErrorsInCurrentArchive = 0;
- }
-
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/List.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/List.cpp
deleted file mode 100644
index 411f995f7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/List.cpp
+++ /dev/null
@@ -1,616 +0,0 @@
-// List.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/MyCom.h"
-#include "Common/StdOutStream.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/Error.h"
-#include "Windows/FileDir.h"
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "../../Archive/IArchive.h"
-
-#include "../Common/OpenArchive.h"
-#include "../Common/PropIDUtils.h"
-
-#include "ConsoleClose.h"
-#include "List.h"
-#include "OpenCallbackConsole.h"
-
-using namespace NWindows;
-
-struct CPropIdToName
-{
- PROPID PropID;
- const wchar_t *Name;
-};
-
-static CPropIdToName kPropIdToName[] =
-{
- { kpidPath, L"Path" },
- { kpidName, L"Name" },
- { kpidIsDir, L"Folder" },
- { kpidSize, L"Size" },
- { kpidPackSize, L"Packed Size" },
- { kpidAttrib, L"Attributes" },
- { kpidCTime, L"Created" },
- { kpidATime, L"Accessed" },
- { kpidMTime, L"Modified" },
- { kpidSolid, L"Solid" },
- { kpidCommented, L"Commented" },
- { kpidEncrypted, L"Encrypted" },
- { kpidSplitBefore, L"Split Before" },
- { kpidSplitAfter, L"Split After" },
- { kpidDictionarySize, L"Dictionary Size" },
- { kpidCRC, L"CRC" },
- { kpidType, L"Type" },
- { kpidIsAnti, L"Anti" },
- { kpidMethod, L"Method" },
- { kpidHostOS, L"Host OS" },
- { kpidFileSystem, L"File System" },
- { kpidUser, L"User" },
- { kpidGroup, L"Group" },
- { kpidBlock, L"Block" },
- { kpidComment, L"Comment" },
- { kpidPosition, L"Position" },
- { kpidPrefix, L"Prefix" },
- { kpidNumSubDirs, L"Folders" },
- { kpidNumSubFiles, L"Files" },
- { kpidUnpackVer, L"Version" },
- { kpidVolume, L"Volume" },
- { kpidIsVolume, L"Multivolume" },
- { kpidOffset, L"Offset" },
- { kpidLinks, L"Links" },
- { kpidNumBlocks, L"Blocks" },
- { kpidNumVolumes, L"Volumes" },
-
- { kpidBit64, L"64-bit" },
- { kpidBigEndian, L"Big-endian" },
- { kpidCpu, L"CPU" },
- { kpidPhySize, L"Physical Size" },
- { kpidHeadersSize, L"Headers Size" },
- { kpidChecksum, L"Checksum" },
- { kpidCharacts, L"Characteristics" },
- { kpidVa, L"Virtual Address" },
- { kpidId, L"ID" },
- { kpidShortName, L"Short Name" },
- { kpidCreatorApp, L"Creator Application"},
- { kpidSectorSize, L"Sector Size" },
- { kpidPosixAttrib, L"Mode" },
- { kpidLink, L"Link" },
-
- { kpidTotalSize, L"Total Size" },
- { kpidFreeSpace, L"Free Space" },
- { kpidClusterSize, L"Cluster Size" },
- { kpidVolumeName, L"Label" }
-};
-
-static const char kEmptyAttribChar = '.';
-
-static const char *kListing = "Listing archive: ";
-static const wchar_t *kFilesMessage = L"files";
-static const wchar_t *kDirsMessage = L"folders";
-
-static void GetAttribString(DWORD wa, bool isDir, char *s)
-{
- s[0] = ((wa & FILE_ATTRIBUTE_DIRECTORY) != 0 || isDir) ? 'D' : kEmptyAttribChar;
- s[1] = ((wa & FILE_ATTRIBUTE_READONLY) != 0) ? 'R': kEmptyAttribChar;
- s[2] = ((wa & FILE_ATTRIBUTE_HIDDEN) != 0) ? 'H': kEmptyAttribChar;
- s[3] = ((wa & FILE_ATTRIBUTE_SYSTEM) != 0) ? 'S': kEmptyAttribChar;
- s[4] = ((wa & FILE_ATTRIBUTE_ARCHIVE) != 0) ? 'A': kEmptyAttribChar;
- s[5] = '\0';
-}
-
-enum EAdjustment
-{
- kLeft,
- kCenter,
- kRight
-};
-
-struct CFieldInfo
-{
- PROPID PropID;
- UString Name;
- EAdjustment TitleAdjustment;
- EAdjustment TextAdjustment;
- int PrefixSpacesWidth;
- int Width;
-};
-
-struct CFieldInfoInit
-{
- PROPID PropID;
- const wchar_t *Name;
- EAdjustment TitleAdjustment;
- EAdjustment TextAdjustment;
- int PrefixSpacesWidth;
- int Width;
-};
-
-static CFieldInfoInit kStandardFieldTable[] =
-{
- { kpidMTime, L" Date Time", kLeft, kLeft, 0, 19 },
- { kpidAttrib, L"Attr", kRight, kCenter, 1, 5 },
- { kpidSize, L"Size", kRight, kRight, 1, 12 },
- { kpidPackSize, L"Compressed", kRight, kRight, 1, 12 },
- { kpidPath, L"Name", kLeft, kLeft, 2, 24 }
-};
-
-static void PrintSpaces(int numSpaces)
-{
- for (int i = 0; i < numSpaces; i++)
- g_StdOut << ' ';
-}
-
-static void PrintString(EAdjustment adjustment, int width, const UString &textString)
-{
- const int numSpaces = width - textString.Length();
- int numLeftSpaces = 0;
- switch (adjustment)
- {
- case kLeft:
- numLeftSpaces = 0;
- break;
- case kCenter:
- numLeftSpaces = numSpaces / 2;
- break;
- case kRight:
- numLeftSpaces = numSpaces;
- break;
- }
- PrintSpaces(numLeftSpaces);
- g_StdOut << textString;
- PrintSpaces(numSpaces - numLeftSpaces);
-}
-
-class CFieldPrinter
-{
- CObjectVector<CFieldInfo> _fields;
-public:
- void Clear() { _fields.Clear(); }
- void Init(const CFieldInfoInit *standardFieldTable, int numItems);
- HRESULT Init(IInArchive *archive);
- void PrintTitle();
- void PrintTitleLines();
- HRESULT PrintItemInfo(const CArc &arc, UInt32 index, bool techMode);
- HRESULT PrintSummaryInfo(UInt64 numFiles, UInt64 numDirs,
- const UInt64 *size, const UInt64 *compressedSize);
-};
-
-void CFieldPrinter::Init(const CFieldInfoInit *standardFieldTable, int numItems)
-{
- Clear();
- for (int i = 0; i < numItems; i++)
- {
- CFieldInfo fieldInfo;
- const CFieldInfoInit &fieldInfoInit = standardFieldTable[i];
- fieldInfo.PropID = fieldInfoInit.PropID;
- fieldInfo.Name = fieldInfoInit.Name;
- fieldInfo.TitleAdjustment = fieldInfoInit.TitleAdjustment;
- fieldInfo.TextAdjustment = fieldInfoInit.TextAdjustment;
- fieldInfo.PrefixSpacesWidth = fieldInfoInit.PrefixSpacesWidth;
- fieldInfo.Width = fieldInfoInit.Width;
- _fields.Add(fieldInfo);
- }
-}
-
-static UString GetPropName(PROPID propID, BSTR name)
-{
- for (unsigned int i = 0; i < sizeof(kPropIdToName) / sizeof(kPropIdToName[0]); i++)
- {
- const CPropIdToName &propIdToName = kPropIdToName[i];
- if (propIdToName.PropID == propID)
- return propIdToName.Name;
- }
- if (name)
- return name;
- wchar_t s[16];
- ConvertUInt32ToString(propID, s);
- return s;
-}
-
-HRESULT CFieldPrinter::Init(IInArchive *archive)
-{
- Clear();
- UInt32 numProps;
- RINOK(archive->GetNumberOfProperties(&numProps));
- for (UInt32 i = 0; i < numProps; i++)
- {
- CMyComBSTR name;
- PROPID propID;
- VARTYPE vt;
- RINOK(archive->GetPropertyInfo(i, &name, &propID, &vt));
- CFieldInfo fieldInfo;
- fieldInfo.PropID = propID;
- fieldInfo.Name = GetPropName(propID, name);
- _fields.Add(fieldInfo);
- }
- return S_OK;
-}
-
-void CFieldPrinter::PrintTitle()
-{
- for (int i = 0; i < _fields.Size(); i++)
- {
- const CFieldInfo &fieldInfo = _fields[i];
- PrintSpaces(fieldInfo.PrefixSpacesWidth);
- PrintString(fieldInfo.TitleAdjustment,
- ((fieldInfo.PropID == kpidPath) ? 0: fieldInfo.Width), fieldInfo.Name);
- }
-}
-
-void CFieldPrinter::PrintTitleLines()
-{
- for (int i = 0; i < _fields.Size(); i++)
- {
- const CFieldInfo &fieldInfo = _fields[i];
- PrintSpaces(fieldInfo.PrefixSpacesWidth);
- for (int i = 0; i < fieldInfo.Width; i++)
- g_StdOut << '-';
- }
-}
-
-
-static BOOL IsFileTimeZero(CONST FILETIME *lpFileTime)
-{
- return (lpFileTime->dwLowDateTime == 0) && (lpFileTime->dwHighDateTime == 0);
-}
-
-static const char *kEmptyTimeString = " ";
-static void PrintTime(const NCOM::CPropVariant &prop)
-{
- if (prop.vt != VT_FILETIME)
- throw "incorrect item";
- if (IsFileTimeZero(&prop.filetime))
- g_StdOut << kEmptyTimeString;
- else
- {
- FILETIME localFileTime;
- if (!FileTimeToLocalFileTime(&prop.filetime, &localFileTime))
- throw "FileTimeToLocalFileTime error";
- char s[32];
- if (ConvertFileTimeToString(localFileTime, s, true, true))
- g_StdOut << s;
- else
- g_StdOut << kEmptyTimeString;
- }
-}
-
-HRESULT CFieldPrinter::PrintItemInfo(const CArc &arc, UInt32 index, bool techMode)
-{
- /*
- if (techMode)
- {
- g_StdOut << "Index = ";
- g_StdOut << (UInt64)index;
- g_StdOut << endl;
- }
- */
- for (int i = 0; i < _fields.Size(); i++)
- {
- const CFieldInfo &fieldInfo = _fields[i];
- if (!techMode)
- PrintSpaces(fieldInfo.PrefixSpacesWidth);
-
- NCOM::CPropVariant prop;
- if (fieldInfo.PropID == kpidPath)
- {
- UString s;
- RINOK(arc.GetItemPath(index, s));
- prop = s;
- }
- else
- {
- RINOK(arc.Archive->GetProperty(index, fieldInfo.PropID, &prop));
- }
- if (techMode)
- {
- g_StdOut << fieldInfo.Name << " = ";
- }
- int width = (fieldInfo.PropID == kpidPath) ? 0: fieldInfo.Width;
- if (fieldInfo.PropID == kpidAttrib && (prop.vt == VT_EMPTY || prop.vt == VT_UI4))
- {
- UInt32 attrib = (prop.vt == VT_EMPTY) ? 0 : prop.ulVal;
- bool isFolder;
- RINOK(IsArchiveItemFolder(arc.Archive, index, isFolder));
- char s[8];
- GetAttribString(attrib, isFolder, s);
- g_StdOut << s;
- }
- else if (prop.vt == VT_EMPTY)
- {
- if (!techMode)
- PrintSpaces(width);
- }
- else if (fieldInfo.PropID == kpidMTime)
- {
- PrintTime(prop);
- }
- else if (prop.vt == VT_BSTR)
- {
- if (techMode)
- g_StdOut << prop.bstrVal;
- else
- PrintString(fieldInfo.TextAdjustment, width, prop.bstrVal);
- }
- else
- {
- UString s = ConvertPropertyToString(prop, fieldInfo.PropID);
- s.Replace(wchar_t(0xA), L' ');
- s.Replace(wchar_t(0xD), L' ');
-
- if (techMode)
- g_StdOut << s;
- else
- PrintString(fieldInfo.TextAdjustment, width, s);
- }
- if (techMode)
- g_StdOut << endl;
- }
- return S_OK;
-}
-
-static void PrintNumberString(EAdjustment adjustment, int width, const UInt64 *value)
-{
- wchar_t textString[32] = { 0 };
- if (value != NULL)
- ConvertUInt64ToString(*value, textString);
- PrintString(adjustment, width, textString);
-}
-
-
-HRESULT CFieldPrinter::PrintSummaryInfo(UInt64 numFiles, UInt64 numDirs,
- const UInt64 *size, const UInt64 *compressedSize)
-{
- for (int i = 0; i < _fields.Size(); i++)
- {
- const CFieldInfo &fieldInfo = _fields[i];
- PrintSpaces(fieldInfo.PrefixSpacesWidth);
- NCOM::CPropVariant prop;
- if (fieldInfo.PropID == kpidSize)
- PrintNumberString(fieldInfo.TextAdjustment, fieldInfo.Width, size);
- else if (fieldInfo.PropID == kpidPackSize)
- PrintNumberString(fieldInfo.TextAdjustment, fieldInfo.Width, compressedSize);
- else if (fieldInfo.PropID == kpidPath)
- {
- wchar_t textString[32];
- ConvertUInt64ToString(numFiles, textString);
- UString temp = textString;
- temp += L" ";
- temp += kFilesMessage;
- temp += L", ";
- ConvertUInt64ToString(numDirs, textString);
- temp += textString;
- temp += L" ";
- temp += kDirsMessage;
- PrintString(fieldInfo.TextAdjustment, 0, temp);
- }
- else
- PrintString(fieldInfo.TextAdjustment, fieldInfo.Width, L"");
- }
- return S_OK;
-}
-
-bool GetUInt64Value(IInArchive *archive, UInt32 index, PROPID propID, UInt64 &value)
-{
- NCOM::CPropVariant prop;
- if (archive->GetProperty(index, propID, &prop) != S_OK)
- throw "GetPropertyValue error";
- if (prop.vt == VT_EMPTY)
- return false;
- value = ConvertPropVariantToUInt64(prop);
- return true;
-}
-
-static void PrintPropPair(const wchar_t *name, const wchar_t *value)
-{
- g_StdOut << name << " = " << value << endl;
-}
-
-HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
- bool stdInMode,
- UStringVector &arcPaths, UStringVector &arcPathsFull,
- const NWildcard::CCensorNode &wildcardCensor,
- bool enableHeaders, bool techMode,
- #ifndef _NO_CRYPTO
- bool &passwordEnabled, UString &password,
- #endif
- UInt64 &numErrors)
-{
- numErrors = 0;
- CFieldPrinter fieldPrinter;
- if (!techMode)
- fieldPrinter.Init(kStandardFieldTable, sizeof(kStandardFieldTable) / sizeof(kStandardFieldTable[0]));
-
- UInt64 numFiles2 = 0, numDirs2 = 0, totalPackSize2 = 0, totalUnPackSize2 = 0;
- UInt64 *totalPackSizePointer2 = 0, *totalUnPackSizePointer2 = 0;
- int numArcs = /* stdInMode ? 1 : */ arcPaths.Size();
- for (int i = 0; i < numArcs; i++)
- {
- const UString &archiveName = arcPaths[i];
- if (!stdInMode)
- {
- NFile::NFind::CFileInfoW fi;
- if (!fi.Find(archiveName) || fi.IsDir())
- {
- g_StdOut << endl << "Error: " << archiveName << " is not file" << endl;
- numErrors++;
- continue;
- }
- }
-
- CArchiveLink archiveLink;
-
- COpenCallbackConsole openCallback;
- openCallback.OutStream = &g_StdOut;
-
- #ifndef _NO_CRYPTO
-
- openCallback.PasswordIsDefined = passwordEnabled;
- openCallback.Password = password;
-
- #endif
-
- HRESULT result = archiveLink.Open2(codecs, formatIndices, stdInMode, NULL, archiveName, &openCallback);
- if (result != S_OK)
- {
- if (result == E_ABORT)
- return result;
- g_StdOut << endl << "Error: " << archiveName << ": ";
- if (result == S_FALSE)
- {
- #ifndef _NO_CRYPTO
- if (openCallback.Open_WasPasswordAsked())
- g_StdOut << "Can not open encrypted archive. Wrong password?";
- else
- #endif
- g_StdOut << "Can not open file as archive";
- }
- else if (result == E_OUTOFMEMORY)
- g_StdOut << "Can't allocate required memory";
- else
- g_StdOut << NError::MyFormatMessage(result);
- g_StdOut << endl;
- numErrors++;
- continue;
- }
-
- if (!stdInMode)
- for (int v = 0; v < archiveLink.VolumePaths.Size(); v++)
- {
- int index = arcPathsFull.FindInSorted(archiveLink.VolumePaths[v]);
- if (index >= 0 && index > i)
- {
- arcPaths.Delete(index);
- arcPathsFull.Delete(index);
- numArcs = arcPaths.Size();
- }
- }
-
- if (enableHeaders)
- {
- g_StdOut << endl << kListing << archiveName << endl << endl;
-
- for (int i = 0; i < archiveLink.Arcs.Size(); i++)
- {
- const CArc &arc = archiveLink.Arcs[i];
-
- g_StdOut << "----\n";
- PrintPropPair(L"Path", arc.Path);
- PrintPropPair(L"Type", codecs->Formats[arc.FormatIndex].Name);
- UInt32 numProps;
- IInArchive *archive = arc.Archive;
- if (archive->GetNumberOfArchiveProperties(&numProps) == S_OK)
- {
- for (UInt32 j = 0; j < numProps; j++)
- {
- CMyComBSTR name;
- PROPID propID;
- VARTYPE vt;
- if (archive->GetArchivePropertyInfo(j, &name, &propID, &vt) != S_OK)
- continue;
- NCOM::CPropVariant prop;
- if (archive->GetArchiveProperty(propID, &prop) != S_OK)
- continue;
- UString s = ConvertPropertyToString(prop, propID);
- if (!s.IsEmpty())
- PrintPropPair(GetPropName(propID, name), s);
- }
- }
- }
- g_StdOut << endl;
- if (techMode)
- g_StdOut << "----------\n";
- }
-
- if (enableHeaders && !techMode)
- {
- fieldPrinter.PrintTitle();
- g_StdOut << endl;
- fieldPrinter.PrintTitleLines();
- g_StdOut << endl;
- }
-
- const CArc &arc = archiveLink.Arcs.Back();
- IInArchive *archive = arc.Archive;
- if (techMode)
- {
- RINOK(fieldPrinter.Init(archive));
- }
- UInt64 numFiles = 0, numDirs = 0, totalPackSize = 0, totalUnPackSize = 0;
- UInt64 *totalPackSizePointer = 0, *totalUnPackSizePointer = 0;
- UInt32 numItems;
- RINOK(archive->GetNumberOfItems(&numItems));
- for (UInt32 i = 0; i < numItems; i++)
- {
- if (NConsoleClose::TestBreakSignal())
- return E_ABORT;
-
- UString filePath;
- HRESULT res = arc.GetItemPath(i, filePath);
- if (stdInMode && res == E_INVALIDARG)
- break;
- RINOK(res);
-
- bool isFolder;
- RINOK(IsArchiveItemFolder(archive, i, isFolder));
- if (!wildcardCensor.CheckPath(filePath, !isFolder))
- continue;
-
- fieldPrinter.PrintItemInfo(arc, i, techMode);
-
- UInt64 packSize, unpackSize;
- if (!GetUInt64Value(archive, i, kpidSize, unpackSize))
- unpackSize = 0;
- else
- totalUnPackSizePointer = &totalUnPackSize;
- if (!GetUInt64Value(archive, i, kpidPackSize, packSize))
- packSize = 0;
- else
- totalPackSizePointer = &totalPackSize;
-
- g_StdOut << endl;
-
- if (isFolder)
- numDirs++;
- else
- numFiles++;
- totalPackSize += packSize;
- totalUnPackSize += unpackSize;
- }
- if (enableHeaders && !techMode)
- {
- fieldPrinter.PrintTitleLines();
- g_StdOut << endl;
- fieldPrinter.PrintSummaryInfo(numFiles, numDirs, totalUnPackSizePointer, totalPackSizePointer);
- g_StdOut << endl;
- }
- if (totalPackSizePointer != 0)
- {
- totalPackSizePointer2 = &totalPackSize2;
- totalPackSize2 += totalPackSize;
- }
- if (totalUnPackSizePointer != 0)
- {
- totalUnPackSizePointer2 = &totalUnPackSize2;
- totalUnPackSize2 += totalUnPackSize;
- }
- numFiles2 += numFiles;
- numDirs2 += numDirs;
- }
- if (enableHeaders && !techMode && numArcs > 1)
- {
- g_StdOut << endl;
- fieldPrinter.PrintTitleLines();
- g_StdOut << endl;
- fieldPrinter.PrintSummaryInfo(numFiles2, numDirs2, totalUnPackSizePointer2, totalPackSizePointer2);
- g_StdOut << endl;
- g_StdOut << "Archives: " << numArcs << endl;
- }
- return S_OK;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/List.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/List.h
deleted file mode 100644
index 97d9fb15a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/List.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// List.h
-
-#ifndef __LIST_H
-#define __LIST_H
-
-#include "Common/Wildcard.h"
-#include "../Common/LoadCodecs.h"
-
-HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
- bool stdInMode,
- UStringVector &archivePaths, UStringVector &archivePathsFull,
- const NWildcard::CCensorNode &wildcardCensor,
- bool enableHeaders, bool techMode,
- #ifndef _NO_CRYPTO
- bool &passwordEnabled, UString &password,
- #endif
- UInt64 &errors);
-
-#endif
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/Main.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/Main.cpp
deleted file mode 100644
index 83feae3ce..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/Main.cpp
+++ /dev/null
@@ -1,642 +0,0 @@
-// Main.cpp
-
-#include "StdAfx.h"
-
-#include "Common/MyInitGuid.h"
-
-#include "Common/CommandLineParser.h"
-#include "Common/IntToString.h"
-#include "Common/MyException.h"
-#include "Common/StdOutStream.h"
-#include "Common/StringConvert.h"
-#include "Common/StringToInt.h"
-
-#include "Windows/Defs.h"
-#include "Windows/Error.h"
-#include "Windows/FileDir.h"
-#include "Windows/FileName.h"
-//#ifdef _WIN32
-//#include "Windows/MemoryLock.h"
-//#endif
-
-#include "../../ICoder.h"
-#include "../../IPassword.h"
-
-#include "../Common/ArchiveCommandLine.h"
-#include "../Common/ExitCode.h"
-#include "../Common/Extract.h"
-#ifdef EXTERNAL_CODECS
-#include "../Common/LoadCodecs.h"
-#endif
-#include "../Common/PropIDUtils.h"
-#include "../Common/Update.h"
-#include "../Common/UpdateAction.h"
-
-#include "../../Compress/LZMA_Alone/LzmaBenchCon.h"
-
-#include "ExtractCallbackConsole.h"
-#include "List.h"
-#include "OpenCallbackConsole.h"
-#include "UpdateCallbackConsole.h"
-
-#include "../../MyVersion.h"
-
-#if defined( _WIN32) && defined( _7ZIP_LARGE_PAGES)
-#include "../../../../C/Alloc.h"
-#endif
-
-#include "myPrivate.h"
-#include "Windows/System.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NCommandLineParser;
-
-// HINSTANCE g_hInstance = 0;
-extern CStdOutStream *g_StdStream;
-
-static const char *kCopyrightString = "\n7-Zip"
-#ifndef EXTERNAL_CODECS
-" (A)"
-#endif
-
-#ifdef _WIN64
-" [64]"
-#endif
-
-" " MY_VERSION_COPYRIGHT_DATE "\n"
-"p7zip Version " P7ZIP_VERSION ;
-
-static const char *kHelpString =
- "\nUsage: 7z"
-#ifdef _NO_CRYPTO
- "r"
-#else
-#ifndef EXTERNAL_CODECS
- "a"
-#endif
-#endif
- " <command> [<switches>...] <archive_name> [<file_names>...]\n"
- " [<@listfiles...>]\n"
- "\n"
- "<Commands>\n"
- " a: Add files to archive\n"
- " b: Benchmark\n"
- " d: Delete files from archive\n"
- " e: Extract files from archive (without using directory names)\n"
- " l: List contents of archive\n"
-// " l[a|t][f]: List contents of archive\n"
-// " a - with Additional fields\n"
-// " t - with all fields\n"
-// " f - with Full pathnames\n"
- " t: Test integrity of archive\n"
- " u: Update files to archive\n"
- " x: eXtract files with full paths\n"
- "<Switches>\n"
- " -ai[r[-|0]]{@listfile|!wildcard}: Include archives\n"
- " -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives\n"
- " -bd: Disable percentage indicator\n"
- " -i[r[-|0]]{@listfile|!wildcard}: Include filenames\n"
- " -m{Parameters}: set compression Method (see the manual)\n"
-#ifdef HAVE_LSTAT
- " -l: don't store symlinks; store the files/directories they point to\n"
- " CAUTION : the scanning stage can never end because of symlinks like '..'\n"
- " (ex: ln -s .. ldir)\n"
-#endif
- " -o{Directory}: set Output directory\n"
- #ifndef _NO_CRYPTO
- " -p{Password}: set Password\n"
- #endif
- " -r[-|0]: Recurse subdirectories\n"
- " (CAUTION: this flag does not do what you think, avoid using it)\n"
- " -sfx[{name}]: Create SFX archive\n"
- " -si[{name}]: read data from stdin\n"
- " -slt: show technical information for l (List) command\n"
- " -so: write data to stdout (eg: "
- "7z"
-#ifdef _NO_CRYPTO
- "r"
-#elif EXCLUDE_COM
- "a"
-#endif
- " a dummy -tgzip -so Doc.txt > archive.gz)\n"
- " -ssc[-]: set sensitive case mode\n"
- " -t{Type}: Set type of archive\n"
- " -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options\n"
- " -v{Size}[b|k|m|g]: Create volumes\n"
- " -w[{path}]: assign Work directory. Empty path means a temporary directory\n"
- " -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames\n"
- " -y: assume Yes on all queries\n";
-
-// ---------------------------
-// exception messages
-
-static const char *kEverythingIsOk = "Everything is Ok";
-static const char *kUserErrorMessage = "Incorrect command line"; // NExitCode::kUserError
-static const char *kNoFormats = "7-Zip cannot find the code that works with archives.";
-
-static const wchar_t *kDefaultSfxModule = L"7zCon.sfx";
-
-static void ShowMessageAndThrowException(CStdOutStream &s, LPCSTR message, NExitCode::EEnum code)
-{
- s << message << endl;
- throw code;
-}
-
-static void PrintHelpAndExit(CStdOutStream &s) // yyy
-{
- s << kHelpString;
- ShowMessageAndThrowException(s, kUserErrorMessage, NExitCode::kUserError);
-}
-
-#ifndef _WIN32
-static void GetArguments(int numArguments, const char *arguments[], UStringVector &parts)
-{
- parts.Clear();
- for(int i = 0; i < numArguments; i++)
- {
- UString s = MultiByteToUnicodeString(arguments[i]);
- parts.Add(s);
- }
-}
-#endif
-
-static void ShowCopyrightAndHelp(CStdOutStream &s, bool needHelp)
-{
- s << kCopyrightString << " (locale=" << /*my_getlocale() <<*/",Utf16=";
- if (global_use_utf16_conversion) s << "on";
- else s << "off";
- s << ",HugeFiles=";
- if (sizeof(off_t) >= 8) s << "on,";
- else s << "off,";
- int nbcpu = NWindows::NSystem::GetNumberOfProcessors();
- if (nbcpu > 1) s << nbcpu << " CPUs)\n";
- else s << nbcpu << " CPU)\n";
-
- if (needHelp)
- s << kHelpString;
-}
-
-#ifdef EXTERNAL_CODECS
-static void PrintString(CStdOutStream &stdStream, const AString &s, int size)
-{
- int len = s.Length();
- stdStream << s;
- for (int i = len; i < size; i++)
- stdStream << ' ';
-}
-#endif
-
-static void PrintString(CStdOutStream &stdStream, const UString &s, int size)
-{
- int len = s.Length();
- stdStream << s;
- for (int i = len; i < size; i++)
- stdStream << ' ';
-}
-
-static inline char GetHex(Byte value)
-{
- return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
-}
-
-const char *kUnsupportedArcTypeMessage = "Unsupported archive type";
-
-int Main2(
- #ifndef _WIN32
- int numArguments, const char *arguments[]
- #endif
-)
-{
- #ifdef _WIN32
- SetFileApisToOEM();
- #endif
-
- UStringVector commandStrings;
- #ifdef _WIN32
- NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
- #else
- // GetArguments(numArguments, arguments, commandStrings);
- extern void mySplitCommandLine(int numArguments,const char *arguments[],UStringVector &parts);
- mySplitCommandLine(numArguments,arguments,commandStrings);
- #endif
-
- if (commandStrings.Size() == 1)
- {
- ShowCopyrightAndHelp(g_StdOut, true);
- return 0;
- }
- commandStrings.Delete(0);
-
- CArchiveCommandLineOptions options;
-
- CArchiveCommandLineParser parser;
-
- parser.Parse1(commandStrings, options);
-
- if (options.HelpMode)
- {
- ShowCopyrightAndHelp(g_StdOut, true);
- return 0;
- }
-
- #if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
- if (options.LargePages)
- {
- SetLargePageSize();
- NSecurity::EnableLockMemoryPrivilege();
- }
- #endif
-
- CStdOutStream &stdStream = options.StdOutMode ? g_StdErr : g_StdOut;
- g_StdStream = &stdStream;
-
- if (options.EnableHeaders)
- ShowCopyrightAndHelp(stdStream, false);
-
- parser.Parse2(options);
-
- CCodecs *codecs = new CCodecs;
- CMyComPtr<
- #ifdef EXTERNAL_CODECS
- ICompressCodecsInfo
- #else
- IUnknown
- #endif
- > compressCodecsInfo = codecs;
- HRESULT result = codecs->Load();
- if (result != S_OK)
- throw CSystemException(result);
-
- bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
-
- if (codecs->Formats.Size() == 0 &&
- (isExtractGroupCommand ||
- options.Command.CommandType == NCommandType::kList ||
- options.Command.IsFromUpdateGroup()))
- throw kNoFormats;
-
- CIntVector formatIndices;
- if (!codecs->FindFormatForArchiveType(options.ArcType, formatIndices))
- throw kUnsupportedArcTypeMessage;
-
- if (options.Command.CommandType == NCommandType::kInfo)
- {
- stdStream << endl << "Formats:" << endl;
- int i;
- for (i = 0; i < codecs->Formats.Size(); i++)
- {
- const CArcInfoEx &arc = codecs->Formats[i];
- #ifdef EXTERNAL_CODECS
- if (arc.LibIndex >= 0)
- {
- char s[16];
- ConvertUInt32ToString(arc.LibIndex, s);
- PrintString(stdStream, s, 2);
- }
- else
- #endif
- stdStream << " ";
- stdStream << ' ';
- stdStream << (char)(arc.UpdateEnabled ? 'C' : ' ');
- stdStream << (char)(arc.KeepName ? 'K' : ' ');
- stdStream << " ";
- PrintString(stdStream, arc.Name, 6);
- stdStream << " ";
- UString s;
- for (int t = 0; t < arc.Exts.Size(); t++)
- {
- const CArcExtInfo &ext = arc.Exts[t];
- s += ext.Ext;
- if (!ext.AddExt.IsEmpty())
- {
- s += L" (";
- s += ext.AddExt;
- s += L')';
- }
- s += L' ';
- }
- PrintString(stdStream, s, 14);
- stdStream << " ";
- const CByteBuffer &sig = arc.StartSignature;
- for (size_t j = 0; j < sig.GetCapacity(); j++)
- {
- Byte b = sig[j];
- if (b > 0x20 && b < 0x80)
- {
- stdStream << (char)b;
- }
- else
- {
- stdStream << GetHex((Byte)((b >> 4) & 0xF));
- stdStream << GetHex((Byte)(b & 0xF));
- }
- stdStream << ' ';
- }
- stdStream << endl;
- }
- stdStream << endl << "Codecs:" << endl;
-
- #ifdef EXTERNAL_CODECS
- UInt32 numMethods;
- if (codecs->GetNumberOfMethods(&numMethods) == S_OK)
- for (UInt32 j = 0; j < numMethods; j++)
- {
- int libIndex = codecs->GetCodecLibIndex(j);
- if (libIndex >= 0)
- {
- char s[16];
- ConvertUInt32ToString(libIndex, s);
- PrintString(stdStream, s, 2);
- }
- else
- stdStream << " ";
- stdStream << ' ';
- stdStream << (char)(codecs->GetCodecEncoderIsAssigned(j) ? 'C' : ' ');
- UInt64 id;
- stdStream << " ";
- HRESULT res = codecs->GetCodecId(j, id);
- if (res != S_OK)
- id = (UInt64)(Int64)-1;
- char s[32];
- ConvertUInt64ToString(id, s, 16);
- PrintString(stdStream, s, 8);
- stdStream << " ";
- PrintString(stdStream, codecs->GetCodecName(j), 11);
- stdStream << endl;
- /*
- if (res != S_OK)
- throw "incorrect Codec ID";
- */
- }
- #endif
- return S_OK;
- }
- else if (options.Command.CommandType == NCommandType::kBenchmark)
- {
- if (options.Method.CompareNoCase(L"CRC") == 0)
- {
- HRESULT res = CrcBenchCon((FILE *)stdStream, options.NumIterations, options.NumThreads, options.DictionarySize);
- if (res != S_OK)
- {
- if (res == S_FALSE)
- {
- stdStream << "\nCRC Error\n";
- return NExitCode::kFatalError;
- }
- throw CSystemException(res);
- }
- }
- else
- {
- HRESULT res = LzmaBenchCon(
- #ifdef EXTERNAL_LZMA
- codecs,
- #endif
- (FILE *)stdStream, options.NumIterations, options.NumThreads, options.DictionarySize);
- if (res != S_OK)
- {
- if (res == S_FALSE)
- {
- stdStream << "\nDecoding Error\n";
- return NExitCode::kFatalError;
- }
- throw CSystemException(res);
- }
- }
- }
- else if (isExtractGroupCommand || options.Command.CommandType == NCommandType::kList)
- {
- if (isExtractGroupCommand)
- {
- CExtractCallbackConsole *ecs = new CExtractCallbackConsole;
- CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
-
- ecs->OutStream = &stdStream;
-
- #ifndef _NO_CRYPTO
- ecs->PasswordIsDefined = options.PasswordEnabled;
- ecs->Password = options.Password;
- #endif
-
- ecs->Init();
-
- COpenCallbackConsole openCallback;
- openCallback.OutStream = &stdStream;
-
- #ifndef _NO_CRYPTO
- openCallback.PasswordIsDefined = options.PasswordEnabled;
- openCallback.Password = options.Password;
- #endif
-
- CExtractOptions eo;
- eo.StdInMode = options.StdInMode;
- eo.StdOutMode = options.StdOutMode;
- eo.PathMode = options.Command.GetPathMode();
- eo.TestMode = options.Command.IsTestMode();
- eo.OverwriteMode = options.OverwriteMode;
- eo.OutputDir = options.OutputDir;
- eo.YesToAll = options.YesToAll;
- eo.CalcCrc = options.CalcCrc;
- #ifdef COMPRESS_MT
- eo.Properties = options.ExtractProperties;
- #endif
- UString errorMessage;
- CDecompressStat stat;
- HRESULT result = DecompressArchives(
- codecs,
- formatIndices,
- options.ArchivePathsSorted,
- options.ArchivePathsFullSorted,
- options.WildcardCensor.Pairs.Front().Head,
- eo, &openCallback, ecs, errorMessage, stat);
- if (!errorMessage.IsEmpty())
- {
- stdStream << endl << "Error: " << errorMessage;
- if (result == S_OK)
- result = E_FAIL;
- }
-
- stdStream << endl;
- if (ecs->NumArchives > 1)
- stdStream << "Archives: " << ecs->NumArchives << endl;
- if (ecs->NumArchiveErrors != 0 || ecs->NumFileErrors != 0)
- {
- if (ecs->NumArchives > 1)
- {
- stdStream << endl;
- if (ecs->NumArchiveErrors != 0)
- stdStream << "Archive Errors: " << ecs->NumArchiveErrors << endl;
- if (ecs->NumFileErrors != 0)
- stdStream << "Sub items Errors: " << ecs->NumFileErrors << endl;
- }
- if (result != S_OK)
- throw CSystemException(result);
- return NExitCode::kFatalError;
- }
- if (result != S_OK)
- throw CSystemException(result);
- if (stat.NumFolders != 0)
- stdStream << "Folders: " << stat.NumFolders << endl;
- if (stat.NumFiles != 1 || stat.NumFolders != 0)
- stdStream << "Files: " << stat.NumFiles << endl;
- stdStream
- << "Size: " << stat.UnpackSize << endl
- << "Compressed: " << stat.PackSize << endl;
- if (options.CalcCrc)
- {
- wchar_t s[16];
- ConvertUInt32ToHex(stat.CrcSum, s);
- stdStream << "CRC: " << s << endl;
- }
- }
- else
- {
- UInt64 numErrors = 0;
- HRESULT result = ListArchives(
- codecs,
- formatIndices,
- options.StdInMode,
- options.ArchivePathsSorted,
- options.ArchivePathsFullSorted,
- options.WildcardCensor.Pairs.Front().Head,
- options.EnableHeaders,
- options.TechMode,
- #ifndef _NO_CRYPTO
- options.PasswordEnabled,
- options.Password,
- #endif
- numErrors);
- if (numErrors > 0)
- {
- g_StdOut << endl << "Errors: " << numErrors;
- return NExitCode::kFatalError;
- }
- if (result != S_OK)
- throw CSystemException(result);
- }
- }
- else if (options.Command.IsFromUpdateGroup())
- {
- CUpdateOptions &uo = options.UpdateOptions;
- if (uo.SfxMode && uo.SfxModule.IsEmpty())
- uo.SfxModule = kDefaultSfxModule;
-
- COpenCallbackConsole openCallback;
- openCallback.OutStream = &stdStream;
-
- #ifndef _NO_CRYPTO
- bool passwordIsDefined =
- options.PasswordEnabled && !options.Password.IsEmpty();
- openCallback.PasswordIsDefined = passwordIsDefined;
- openCallback.Password = options.Password;
- #endif
-
- CUpdateCallbackConsole callback;
- callback.EnablePercents = options.EnablePercents;
-
- #ifndef _NO_CRYPTO
- callback.PasswordIsDefined = passwordIsDefined;
- callback.AskPassword = options.PasswordEnabled && options.Password.IsEmpty();
- callback.Password = options.Password;
- #endif
- callback.StdOutMode = uo.StdOutMode;
- callback.Init(&stdStream);
-
- CUpdateErrorInfo errorInfo;
-
- if (!uo.Init(codecs, formatIndices, options.ArchiveName))
- throw kUnsupportedArcTypeMessage;
- HRESULT result = UpdateArchive(codecs,
- options.WildcardCensor, uo,
- errorInfo, &openCallback, &callback);
-
-#ifdef ENV_UNIX
- if (uo.SfxMode)
- {
- void myAddExeFlag(const UString &name);
- for(int i = 0; i < uo.Commands.Size(); i++)
- {
- CUpdateArchiveCommand &command = uo.Commands[i];
- if (!uo.StdOutMode)
- {
- myAddExeFlag(command.ArchivePath.GetFinalPath());
- }
- }
- }
-#endif
-
- int exitCode = NExitCode::kSuccess;
- if (callback.CantFindFiles.Size() > 0)
- {
- stdStream << endl;
- stdStream << "WARNINGS for files:" << endl << endl;
- int numErrors = callback.CantFindFiles.Size();
- for (int i = 0; i < numErrors; i++)
- {
- stdStream << callback.CantFindFiles[i] << " : ";
- stdStream << NError::MyFormatMessageW(callback.CantFindCodes[i]) << endl;
- }
- stdStream << "----------------" << endl;
- stdStream << "WARNING: Cannot find " << numErrors << " file";
- if (numErrors > 1)
- stdStream << "s";
- stdStream << endl;
- exitCode = NExitCode::kWarning;
- }
-
- if (result != S_OK)
- {
- UString message;
- if (!errorInfo.Message.IsEmpty())
- {
- message += errorInfo.Message;
- message += L"\n";
- }
- if (!errorInfo.FileName.IsEmpty())
- {
- message += errorInfo.FileName;
- message += L"\n";
- }
- if (!errorInfo.FileName2.IsEmpty())
- {
- message += errorInfo.FileName2;
- message += L"\n";
- }
- if (errorInfo.SystemError != 0)
- {
- message += NError::MyFormatMessageW(errorInfo.SystemError);
- message += L"\n";
- }
- if (!message.IsEmpty())
- stdStream << L"\nError:\n" << message;
- throw CSystemException(result);
- }
- int numErrors = callback.FailedFiles.Size();
- if (numErrors == 0)
- {
- if (callback.CantFindFiles.Size() == 0)
- stdStream << kEverythingIsOk << endl;
- }
- else
- {
- stdStream << endl;
- stdStream << "WARNINGS for files:" << endl << endl;
- for (int i = 0; i < numErrors; i++)
- {
- stdStream << callback.FailedFiles[i] << " : ";
- stdStream << NError::MyFormatMessageW(callback.FailedCodes[i]) << endl;
- }
- stdStream << "----------------" << endl;
- stdStream << "WARNING: Cannot open " << numErrors << " file";
- if (numErrors > 1)
- stdStream << "s";
- stdStream << endl;
- exitCode = NExitCode::kWarning;
- }
- return exitCode;
- }
- else
- PrintHelpAndExit(stdStream);
- return 0;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/MainAr.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/MainAr.cpp
deleted file mode 100644
index 02918d79d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/MainAr.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-// MainAr.cpp
-
-#include "StdAfx.h"
-
-// #include <locale.h>
-
-#include "Windows/Error.h"
-
-#include "Common/StdOutStream.h"
-#include "Common/NewHandler.h"
-#include "Common/MyException.h"
-#include "Common/StringConvert.h"
-
-#include "../Common/ExitCode.h"
-#include "../Common/ArchiveCommandLine.h"
-#include "ConsoleClose.h"
-
-using namespace NWindows;
-
-CStdOutStream *g_StdStream = 0;
-
-#ifdef _WIN32
-#ifndef _UNICODE
-bool g_IsNT = false;
-#endif
-#if !defined(_UNICODE) || !defined(_WIN64)
-static inline bool IsItWindowsNT()
-{
- OSVERSIONINFO versionInfo;
- versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
- return false;
- return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-#endif
-#endif
-
-extern int Main2(
- #ifndef _WIN32
- int numArguments, const char *arguments[]
- #endif
-);
-
-static const char *kExceptionErrorMessage = "\n\nError:\n";
-static const char *kUserBreak = "\nBreak signaled\n";
-
-static const char *kMemoryExceptionMessage = "\n\nERROR: Can't allocate required memory!\n";
-static const char *kUnknownExceptionMessage = "\n\nUnknown Error\n";
-static const char *kInternalExceptionMessage = "\n\nInternal Error #";
-
-int MY_CDECL main
-(
-#ifndef _WIN32
-int numArguments, const char *arguments[]
-#endif
-)
-{
- g_StdStream = &g_StdOut;
- #ifdef _WIN32
-
- #ifdef _UNICODE
- #ifndef _WIN64
- if (!IsItWindowsNT())
- {
- (*g_StdStream) << "This program requires Windows NT/2000/2003/2008/XP/Vista";
- return NExitCode::kFatalError;
- }
- #endif
- #else
- g_IsNT = IsItWindowsNT();
- #endif
-
- #endif
-
- // setlocale(LC_COLLATE, ".OCP");
- NConsoleClose::CCtrlHandlerSetter ctrlHandlerSetter;
- int res = 0;
- try
- {
- res = Main2(
-#ifndef _WIN32
- numArguments, arguments
-#endif
- );
- }
- catch(const CNewException &)
- {
- (*g_StdStream) << kMemoryExceptionMessage;
- return (NExitCode::kMemoryError);
- }
- catch(const NConsoleClose::CCtrlBreakException &)
- {
- (*g_StdStream) << endl << kUserBreak;
- return (NExitCode::kUserBreak);
- }
- catch(const CArchiveCommandLineException &e)
- {
- (*g_StdStream) << kExceptionErrorMessage << e << endl;
- return (NExitCode::kUserError);
- }
- catch(const CSystemException &systemError)
- {
- if (systemError.ErrorCode == E_OUTOFMEMORY)
- {
- (*g_StdStream) << kMemoryExceptionMessage;
- return (NExitCode::kMemoryError);
- }
- if (systemError.ErrorCode == E_ABORT)
- {
- (*g_StdStream) << endl << kUserBreak;
- return (NExitCode::kUserBreak);
- }
- UString message;
- NError::MyFormatMessage(systemError.ErrorCode, message);
- (*g_StdStream) << endl << endl << "System error:" << endl <<
- message << endl;
- return (NExitCode::kFatalError);
- }
- catch(NExitCode::EEnum &exitCode)
- {
- (*g_StdStream) << kInternalExceptionMessage << exitCode << endl;
- return (exitCode);
- }
- /*
- catch(const NExitCode::CMultipleErrors &multipleErrors)
- {
- (*g_StdStream) << endl << multipleErrors.NumErrors << " errors" << endl;
- return (NExitCode::kFatalError);
- }
- */
- catch(const UString &s)
- {
- (*g_StdStream) << kExceptionErrorMessage << s << endl;
- return (NExitCode::kFatalError);
- }
- catch(const AString &s)
- {
- (*g_StdStream) << kExceptionErrorMessage << s << endl;
- return (NExitCode::kFatalError);
- }
- catch(const char *s)
- {
- (*g_StdStream) << kExceptionErrorMessage << s << endl;
- return (NExitCode::kFatalError);
- }
- catch(int t)
- {
- (*g_StdStream) << kInternalExceptionMessage << t << endl;
- return (NExitCode::kFatalError);
- }
- catch(...)
- {
- (*g_StdStream) << kUnknownExceptionMessage;
- return (NExitCode::kFatalError);
- }
- return res;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/OpenCallbackConsole.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/OpenCallbackConsole.cpp
deleted file mode 100644
index 7dba2ad5d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/OpenCallbackConsole.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// OpenCallbackConsole.cpp
-
-#include "StdAfx.h"
-
-#include "OpenCallbackConsole.h"
-
-#include "ConsoleClose.h"
-#include "UserInputUtils.h"
-
-HRESULT COpenCallbackConsole::Open_CheckBreak()
-{
- if (NConsoleClose::TestBreakSignal())
- return E_ABORT;
- return S_OK;
-}
-
-HRESULT COpenCallbackConsole::Open_SetTotal(const UInt64 *, const UInt64 *)
-{
- return Open_CheckBreak();
-}
-
-HRESULT COpenCallbackConsole::Open_SetCompleted(const UInt64 *, const UInt64 *)
-{
- return Open_CheckBreak();
-}
-
-#ifndef _NO_CRYPTO
-
-HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password)
-{
- PasswordWasAsked = true;
- RINOK(Open_CheckBreak());
- if (!PasswordIsDefined)
- {
- Password = GetPassword(OutStream);
- PasswordIsDefined = true;
- }
- return StringToBstr(Password, password);
-}
-
-HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(UString &password)
-{
- if (PasswordIsDefined)
- password = Password;
- return S_OK;
-}
-
-bool COpenCallbackConsole::Open_WasPasswordAsked()
-{
- return PasswordWasAsked;
-}
-
-void COpenCallbackConsole::Open_ClearPasswordWasAskedFlag()
-{
- PasswordWasAsked = false;
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/OpenCallbackConsole.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/OpenCallbackConsole.h
deleted file mode 100644
index c002e6a72..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/OpenCallbackConsole.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// OpenCallbackConsole.h
-
-#ifndef __OPENCALLBACKCONSOLE_H
-#define __OPENCALLBACKCONSOLE_H
-
-#include "Common/StdOutStream.h"
-#include "../Common/ArchiveOpenCallback.h"
-
-class COpenCallbackConsole: public IOpenCallbackUI
-{
-public:
- INTERFACE_IOpenCallbackUI(;)
-
- CStdOutStream *OutStream;
-
- #ifndef _NO_CRYPTO
- bool PasswordIsDefined;
- bool PasswordWasAsked;
- UString Password;
- COpenCallbackConsole(): PasswordIsDefined(false), PasswordWasAsked(false) {}
- #endif
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/PercentPrinter.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/PercentPrinter.cpp
deleted file mode 100644
index 28452b177..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/PercentPrinter.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-// PercentPrinter.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/MyString.h"
-
-#include "PercentPrinter.h"
-
-const int kPaddingSize = 2;
-const int kPercentsSize = 4;
-const int kMaxExtraSize = kPaddingSize + 32 + kPercentsSize;
-
-static void ClearPrev(char *p, int num)
-{
- int i;
- for (i = 0; i < num; i++) *p++ = '\b';
- for (i = 0; i < num; i++) *p++ = ' ';
- for (i = 0; i < num; i++) *p++ = '\b';
- *p = '\0';
-}
-
-void CPercentPrinter::ClosePrint()
-{
- if (m_NumExtraChars == 0)
- return;
- char s[kMaxExtraSize * 3 + 1];
- ClearPrev(s, m_NumExtraChars);
- (*OutStream) << s;
- m_NumExtraChars = 0;
-}
-
-void CPercentPrinter::PrintString(const char *s)
-{
- ClosePrint();
- (*OutStream) << s;
-}
-
-void CPercentPrinter::PrintString(const wchar_t *s)
-{
- ClosePrint();
- (*OutStream) << s;
-}
-
-void CPercentPrinter::PrintNewLine()
-{
- ClosePrint();
- (*OutStream) << "\n";
-}
-
-void CPercentPrinter::RePrintRatio()
-{
- char s[32];
- ConvertUInt64ToString(((m_Total == 0) ? 0 : (m_CurValue * 100 / m_Total)), s);
- int size = (int)strlen(s);
- s[size++] = '%';
- s[size] = '\0';
-
- int extraSize = kPaddingSize + MyMax(size, kPercentsSize);
- if (extraSize < m_NumExtraChars)
- extraSize = m_NumExtraChars;
-
- char fullString[kMaxExtraSize * 3];
- char *p = fullString;
- int i;
- if (m_NumExtraChars == 0)
- {
- for (i = 0; i < extraSize; i++)
- *p++ = ' ';
- m_NumExtraChars = extraSize;
- }
-
- for (i = 0; i < m_NumExtraChars; i++)
- *p++ = '\b';
- m_NumExtraChars = extraSize;
- for (; size < m_NumExtraChars; size++)
- *p++ = ' ';
- MyStringCopy(p, s);
- (*OutStream) << fullString;
- OutStream->Flush();
- m_PrevValue = m_CurValue;
-}
-
-void CPercentPrinter::PrintRatio()
-{
- if (m_CurValue < m_PrevValue + m_MinStepSize &&
- m_CurValue + m_MinStepSize > m_PrevValue && m_NumExtraChars != 0)
- return;
- RePrintRatio();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/PercentPrinter.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/PercentPrinter.h
deleted file mode 100644
index 97f2e6adb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/PercentPrinter.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// PercentPrinter.h
-
-#ifndef __PERCENTPRINTER_H
-#define __PERCENTPRINTER_H
-
-#include "Common/Types.h"
-#include "Common/StdOutStream.h"
-
-class CPercentPrinter
-{
- UInt64 m_MinStepSize;
- UInt64 m_PrevValue;
- UInt64 m_CurValue;
- UInt64 m_Total;
- int m_NumExtraChars;
-public:
- CStdOutStream *OutStream;
-
- CPercentPrinter(UInt64 minStepSize = 1): m_MinStepSize(minStepSize),
- m_PrevValue(0), m_CurValue(0), m_Total(1), m_NumExtraChars(0) {}
- void SetTotal(UInt64 total) { m_Total = total; m_PrevValue = 0; }
- void SetRatio(UInt64 doneValue) { m_CurValue = doneValue; }
- void PrintString(const char *s);
- void PrintString(const wchar_t *s);
- void PrintNewLine();
- void ClosePrint();
- void RePrintRatio();
- void PrintRatio();
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp
deleted file mode 100644
index cfd8e8321..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-// UpdateCallbackConsole.cpp
-
-#include "StdAfx.h"
-
-#include "UpdateCallbackConsole.h"
-
-#include "Windows/Error.h"
-#ifdef COMPRESS_MT
-#include "Windows/Synchronization.h"
-#endif
-
-#include "ConsoleClose.h"
-#include "UserInputUtils.h"
-
-using namespace NWindows;
-
-#ifdef COMPRESS_MT
-static NSynchronization::CCriticalSection g_CriticalSection;
-#define MT_LOCK NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
-#else
-#define MT_LOCK
-#endif
-
-static const wchar_t *kEmptyFileAlias = L"[Content]";
-
-static const char *kCreatingArchiveMessage = "Creating archive ";
-static const char *kUpdatingArchiveMessage = "Updating archive ";
-static const char *kScanningMessage = "Scanning";
-
-
-HRESULT CUpdateCallbackConsole::OpenResult(const wchar_t *name, HRESULT result)
-{
- (*OutStream) << endl;
- if (result != S_OK)
- (*OutStream) << "Error: " << name << " is not supported archive" << endl;
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::StartScanning()
-{
- (*OutStream) << kScanningMessage;
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::ScanProgress(UInt64 /* numFolders */, UInt64 /* numFiles */, const wchar_t * /* path */)
-{
- return CheckBreak();
-}
-
-HRESULT CUpdateCallbackConsole::CanNotFindError(const wchar_t *name, DWORD systemError)
-{
- CantFindFiles.Add(name);
- CantFindCodes.Add(systemError);
- // m_PercentPrinter.ClosePrint();
- if (!m_WarningsMode)
- {
- (*OutStream) << endl << endl;
- m_PercentPrinter.PrintNewLine();
- m_WarningsMode = true;
- }
- m_PercentPrinter.PrintString(name);
- m_PercentPrinter.PrintString(": WARNING: ");
- m_PercentPrinter.PrintString(NError::MyFormatMessageW(systemError));
- m_PercentPrinter.PrintNewLine();
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::FinishScanning()
-{
- (*OutStream) << endl << endl;
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::StartArchive(const wchar_t *name, bool updating)
-{
- if(updating)
- (*OutStream) << kUpdatingArchiveMessage;
- else
- (*OutStream) << kCreatingArchiveMessage;
- if (name != 0)
- (*OutStream) << name;
- else
- (*OutStream) << "StdOut";
- (*OutStream) << endl << endl;
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::FinishArchive()
-{
- (*OutStream) << endl;
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::CheckBreak()
-{
- if (NConsoleClose::TestBreakSignal())
- return E_ABORT;
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::Finilize()
-{
- MT_LOCK
- if (m_NeedBeClosed)
- {
- if (EnablePercents)
- {
- m_PercentPrinter.ClosePrint();
- }
- if (!StdOutMode && m_NeedNewLine)
- {
- m_PercentPrinter.PrintNewLine();
- m_NeedNewLine = false;
- }
- m_NeedBeClosed = false;
- }
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::SetNumFiles(UInt64 /* numFiles */)
-{
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::SetTotal(UInt64 size)
-{
- MT_LOCK
- if (EnablePercents)
- m_PercentPrinter.SetTotal(size);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::SetCompleted(const UInt64 *completeValue)
-{
- MT_LOCK
- if (completeValue != NULL)
- {
- if (EnablePercents)
- {
- m_PercentPrinter.SetRatio(*completeValue);
- m_PercentPrinter.PrintRatio();
- m_NeedBeClosed = true;
- }
- }
- if (NConsoleClose::TestBreakSignal())
- return E_ABORT;
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::SetRatioInfo(const UInt64 * /* inSize */, const UInt64 * /* outSize */)
-{
- if (NConsoleClose::TestBreakSignal())
- return E_ABORT;
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::GetStream(const wchar_t *name, bool isAnti)
-{
- MT_LOCK
- if (StdOutMode)
- return S_OK;
- if(isAnti)
- m_PercentPrinter.PrintString("Anti item ");
- else
- m_PercentPrinter.PrintString("Compressing ");
- if (name[0] == 0)
- name = kEmptyFileAlias;
- m_PercentPrinter.PrintString(name);
- if (EnablePercents)
- m_PercentPrinter.RePrintRatio();
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::OpenFileError(const wchar_t *name, DWORD systemError)
-{
- MT_LOCK
- FailedCodes.Add(systemError);
- FailedFiles.Add(name);
- // if (systemError == ERROR_SHARING_VIOLATION)
- {
- m_PercentPrinter.ClosePrint();
- m_PercentPrinter.PrintNewLine();
- m_PercentPrinter.PrintString("WARNING: ");
- m_PercentPrinter.PrintString(NError::MyFormatMessageW(systemError));
- return S_FALSE;
- }
- // return systemError;
-}
-
-HRESULT CUpdateCallbackConsole::SetOperationResult(Int32 )
-{
- m_NeedBeClosed = true;
- m_NeedNewLine = true;
- return S_OK;
-}
-
-HRESULT CUpdateCallbackConsole::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
-{
- *password = NULL;
-
- #ifdef _NO_CRYPTO
-
- *passwordIsDefined = false;
- return S_OK;
-
- #else
-
- if (!PasswordIsDefined)
- {
- if (AskPassword)
- {
- Password = GetPassword(OutStream,true);
- PasswordIsDefined = true;
- }
- }
- *passwordIsDefined = BoolToInt(PasswordIsDefined);
- return StringToBstr(Password, password);
-
- #endif
-}
-
-HRESULT CUpdateCallbackConsole::CryptoGetTextPassword(BSTR *password)
-{
- *password = NULL;
-
- #ifdef _NO_CRYPTO
-
- return E_NOTIMPL;
-
- #else
-
- if (!PasswordIsDefined)
- {
- {
- Password = GetPassword(OutStream);
- PasswordIsDefined = true;
- }
- }
- return StringToBstr(Password, password);
-
- #endif
-}
-
-/*
-HRESULT CUpdateCallbackConsole::ShowDeleteFile(const wchar_t *name)
-{
- // MT_LOCK
- if (StdOutMode)
- return S_OK;
- RINOK(Finilize());
- m_PercentPrinter.PrintString("Deleting ");
- if (name[0] == 0)
- name = kEmptyFileAlias;
- m_PercentPrinter.PrintString(name);
- if (EnablePercents)
- m_PercentPrinter.RePrintRatio();
- m_NeedBeClosed = true;
- m_NeedNewLine = true;
- return S_OK;
-}
-*/
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UpdateCallbackConsole.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UpdateCallbackConsole.h
deleted file mode 100644
index 370b2c534..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UpdateCallbackConsole.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// UpdateCallbackConsole.h
-
-#ifndef __UPDATE_CALLBACK_CONSOLE_H
-#define __UPDATE_CALLBACK_CONSOLE_H
-
-#include "Common/StdOutStream.h"
-
-#include "../Common/Update.h"
-
-#include "PercentPrinter.h"
-
-class CUpdateCallbackConsole: public IUpdateCallbackUI2
-{
- CPercentPrinter m_PercentPrinter;
- bool m_NeedBeClosed;
- bool m_NeedNewLine;
-
- bool m_WarningsMode;
-
- CStdOutStream *OutStream;
-public:
- bool EnablePercents;
- bool StdOutMode;
-
- #ifndef _NO_CRYPTO
- bool PasswordIsDefined;
- UString Password;
- bool AskPassword;
- #endif
-
- CUpdateCallbackConsole():
- m_PercentPrinter(1 << 16),
- m_WarningsMode(false),
- EnablePercents(true),
- StdOutMode(false)
- #ifndef _NO_CRYPTO
- ,
- PasswordIsDefined(false),
- AskPassword(false)
- #endif
- {}
-
- ~CUpdateCallbackConsole() { Finilize(); }
- void Init(CStdOutStream *outStream)
- {
- m_NeedBeClosed = false;
- m_NeedNewLine = false;
- FailedFiles.Clear();
- FailedCodes.Clear();
- OutStream = outStream;
- m_PercentPrinter.OutStream = outStream;
- }
-
- INTERFACE_IUpdateCallbackUI2(;)
-
- UStringVector FailedFiles;
- CRecordVector<HRESULT> FailedCodes;
-
- UStringVector CantFindFiles;
- CRecordVector<HRESULT> CantFindCodes;
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UserInputUtils.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UserInputUtils.cpp
deleted file mode 100644
index 63a280961..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UserInputUtils.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-// UserInputUtils.cpp
-
-#include "StdAfx.h"
-
-#include "Common/StdInStream.h"
-#include "Common/StringConvert.h"
-
-#include "UserInputUtils.h"
-
-#ifdef USE_FLTK
-// the programs like file-roller or xarchiver do not support archives with password
-// these programs freeze because p7zip is waiting for a password
-// defining USE_FLTK allows p7zip to use a popup in order to ask the password.
-#include <FL/Fl.H>
-#include <FL/Fl_Window.H>
-#include <FL/fl_ask.H>
-#else
-#ifdef HAVE_GETPASS
-#include <pwd.h>
-#include <unistd.h>
-#include "Common/MyException.h"
-#endif
-#endif
-
-static const char kYes = 'Y';
-static const char kNo = 'N';
-static const char kYesAll = 'A';
-static const char kNoAll = 'S';
-static const char kAutoRenameAll = 'U';
-static const char kQuit = 'Q';
-
-static const char *kFirstQuestionMessage = "?\n";
-static const char *kHelpQuestionMessage =
- "(Y)es / (N)o / (A)lways / (S)kip all / A(u)to rename all / (Q)uit? ";
-
-// return true if pressed Quite;
-
-NUserAnswerMode::EEnum ScanUserYesNoAllQuit(CStdOutStream *outStream)
-{
- (*outStream) << kFirstQuestionMessage;
- for(;;)
- {
- (*outStream) << kHelpQuestionMessage;
- AString scannedString = g_StdIn.ScanStringUntilNewLine();
- scannedString.Trim();
- if(!scannedString.IsEmpty())
- switch(::MyCharUpper(scannedString[0]))
- {
- case kYes:
- return NUserAnswerMode::kYes;
- case kNo:
- return NUserAnswerMode::kNo;
- case kYesAll:
- return NUserAnswerMode::kYesAll;
- case kNoAll:
- return NUserAnswerMode::kNoAll;
- case kAutoRenameAll:
- return NUserAnswerMode::kAutoRenameAll;
- case kQuit:
- return NUserAnswerMode::kQuit;
- }
- }
-}
-
-UString GetPassword(CStdOutStream *outStream, bool verify)
-{
-#ifdef USE_FLTK
- (void)verify;
- const char *r = fl_password("Enter password", 0);
- AString oemPassword = "";
- if (r) oemPassword = r;
-#else /* USE_FLTK */
-#ifdef HAVE_GETPASS
- (*outStream) << "\nEnter password (will not be echoed) :";
- outStream->Flush();
- AString oemPassword = getpass("");
- if (verify)
- {
- (*outStream) << "Verify password (will not be echoed) :";
- outStream->Flush();
- AString oemPassword2 = getpass("");
- if (oemPassword != oemPassword2) throw "password verification failed";
- }
-#else
- (void)verify;
- (*outStream) << "\nEnter password:";
- outStream->Flush();
- AString oemPassword = g_StdIn.ScanStringUntilNewLine();
-#endif
-#endif /* USE_FLTK */
- return MultiByteToUnicodeString(oemPassword, CP_OEMCP);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UserInputUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UserInputUtils.h
deleted file mode 100644
index 8c575194d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Console/UserInputUtils.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// UserInputUtils.h
-
-#ifndef __USERINPUTUTILS_H
-#define __USERINPUTUTILS_H
-
-#include "Common/StdOutStream.h"
-
-namespace NUserAnswerMode {
-
-enum EEnum
-{
- kYes,
- kNo,
- kYesAll,
- kNoAll,
- kAutoRenameAll,
- kQuit
-};
-}
-
-NUserAnswerMode::EEnum ScanUserYesNoAllQuit(CStdOutStream *outStream);
-UString GetPassword(CStdOutStream *outStream,bool verify = false);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Explorer/MyMessages.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Explorer/MyMessages.cpp
deleted file mode 100644
index 62ac42ec1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Explorer/MyMessages.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// MyMessages.cpp
-
-#include "StdAfx.h"
-
-#include "MyMessages.h"
-
-#include "Windows/Error.h"
-#include "Windows/ResourceString.h"
-
-#ifdef LANG
-#include "../FileManager/LangUtils.h"
-#endif
-
-using namespace NWindows;
-
-void ShowErrorMessage(HWND window, LPCWSTR message)
-{
- ::MessageBoxW(window, message, L"7-Zip", MB_OK | MB_ICONSTOP);
-}
-
-void ShowErrorMessageHwndRes(HWND window, UINT resID
- #ifdef LANG
- , UInt32 langID
- #endif
- )
-{
- ShowErrorMessage(window,
- #ifdef LANG
- LangString(resID, langID)
- #else
- MyLoadStringW(resID)
- #endif
- );
-}
-
-void ShowErrorMessageRes(UINT resID
- #ifdef LANG
- , UInt32 langID
- #endif
- )
-{
- ShowErrorMessageHwndRes(0, resID
- #ifdef LANG
- , langID
- #endif
- );
-}
-
-void ShowErrorMessageDWORD(HWND window, DWORD errorCode)
-{
- ShowErrorMessage(window, NError::MyFormatMessageW(errorCode));
-}
-
-void ShowLastErrorMessage(HWND window)
-{
- ShowErrorMessageDWORD(window, ::GetLastError());
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Explorer/MyMessages.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Explorer/MyMessages.h
deleted file mode 100644
index 10da975b2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/Explorer/MyMessages.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// MyMessages.h
-
-#ifndef __MYMESSAGES_H
-#define __MYMESSAGES_H
-
-#include "Common/MyString.h"
-#include "Common/Types.h"
-
-void ShowErrorMessage(HWND window, LPCWSTR message);
-inline void ShowErrorMessage(LPCWSTR message) { ShowErrorMessage(0, message); }
-
-void ShowErrorMessageHwndRes(HWND window, UINT resID
- #ifdef LANG
- , UInt32 langID
- #endif
- );
-
-void ShowErrorMessageRes(UINT resID
- #ifdef LANG
- , UInt32 langID
- #endif
- );
-
-// void ShowErrorMessageDWORD(HWND window, DWORD errorCode);
-// inline void ErrorMessageDWORD(DWORD errorCode) { ShowErrorMessageDWORD(0, errorCode); }
-void ShowLastErrorMessage(HWND window = 0);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/App.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/App.cpp
deleted file mode 100644
index a6103f404..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/App.cpp
+++ /dev/null
@@ -1,910 +0,0 @@
-// App.cpp
-
-#include "StdAfx.h"
-
-#include "resource.h"
-#include "OverwriteDialogRes.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/COM.h"
-#include "Windows/Error.h"
-#include "Windows/FileDir.h"
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-#include "Windows/Thread.h"
-
-#include "App.h"
-#include "CopyDialog.h"
-#include "ExtractCallback.h"
-#include "FormatUtils.h"
-#include "IFolder.h"
-#include "LangUtils.h"
-#include "RegistryUtils.h"
-#include "ViewSettings.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NFind;
-
-extern DWORD g_ComCtl32Version;
-extern HINSTANCE g_hInstance;
-
-static LPCWSTR kTempDirPrefix = L"7zE";
-
-void CPanelCallbackImp::OnTab()
-{
- if (g_App.NumPanels != 1)
- _app->Panels[1 - _index].SetFocusToList();
- _app->RefreshTitle();
-}
-
-void CPanelCallbackImp::SetFocusToPath(int index)
-{
- int newPanelIndex = index;
- if (g_App.NumPanels == 1)
- newPanelIndex = g_App.LastFocusedPanel;
- // FIXME _app->Panels[newPanelIndex]._headerComboBox.SetFocus();
- _app->RefreshTitle();
-}
-
-
-void CPanelCallbackImp::OnCopy(bool move, bool copyToSame) { _app->OnCopy(move, copyToSame, _index); }
-void CPanelCallbackImp::OnSetSameFolder() { _app->OnSetSameFolder(_index); }
-void CPanelCallbackImp::OnSetSubFolder() { _app->OnSetSubFolder(_index); }
-void CPanelCallbackImp::PanelWasFocused() { _app->SetFocusedPanel(_index); _app->RefreshTitle(_index); }
-void CPanelCallbackImp::DragBegin() { /* FIXME _app->DragBegin(_index);*/ }
-void CPanelCallbackImp::DragEnd() { /* FIXME _app->DragEnd();*/ }
-void CPanelCallbackImp::RefreshTitle(bool always) { _app->RefreshTitle(_index, always); }
-
-void CApp::SetListSettings()
-{
- bool showDots = ReadShowDots();
- bool showRealFileIcons = ReadShowRealFileIcons();
-
- DWORD extendedStyle =0; /* FIXME = LVS_EX_HEADERDRAGDROP;
- if (ReadFullRow())
- extendedStyle |= LVS_EX_FULLROWSELECT;
- if (ReadShowGrid())
- extendedStyle |= LVS_EX_GRIDLINES;
- */
- bool mySelectionMode = ReadAlternativeSelection();
-
- /*
- if (ReadSingleClick())
- {
- extendedStyle |= LVS_EX_ONECLICKACTIVATE
- | LVS_EX_TRACKSELECT;
- if (ReadUnderline())
- extendedStyle |= LVS_EX_UNDERLINEHOT;
- }
- */
-
- for (int i = 0; i < kNumPanelsMax; i++)
- {
- CPanel &panel = Panels[i];
- panel._mySelectMode = mySelectionMode;
- panel._showDots = showDots;
- panel._showRealFileIcons = showRealFileIcons;
- panel._exStyle = extendedStyle;
-
- /* FIXME
- DWORD style = (DWORD)panel._listView.GetStyle();
- if (mySelectionMode)
- style |= LVS_SINGLESEL;
- else
- style &= ~LVS_SINGLESEL;
- panel._listView.SetStyle(style);
- */
- panel.SetExtendedStyle();
- }
-}
-
-void CApp::SetShowSystemMenu()
-{
- ShowSystemMenu = ReadShowSystemMenu();
-}
-
-void CApp::CreateOnePanel(int panelIndex, const UString &mainPath, bool &archiveIsOpened, bool &encrypted)
-{
- if (PanelsCreated[panelIndex])
- return;
- m_PanelCallbackImp[panelIndex].Init(this, panelIndex);
- UString path;
- if (mainPath.IsEmpty())
- {
- if (!::ReadPanelPath(panelIndex, path))
- path.Empty();
- }
- else
- path = mainPath;
- int id = 1000 + 100 * panelIndex;
- Panels[panelIndex].Create(_window, _window,
- id, path, &m_PanelCallbackImp[panelIndex], &AppState, archiveIsOpened, encrypted);
- PanelsCreated[panelIndex] = true;
-}
-
-#if _WIN32
-static void CreateToolbar(
- HWND parent,
- NWindows::NControl::CImageList &imageList,
- NWindows::NControl::CToolBar &toolBar,
- bool LargeButtons)
-{
- toolBar.Attach(::CreateWindowEx(0,
- TOOLBARCLASSNAME,
- NULL, 0
- | WS_VISIBLE
- | TBSTYLE_FLAT
- | TBSTYLE_TOOLTIPS
- | WS_CHILD
- | CCS_NOPARENTALIGN
- | CCS_NORESIZE
- | CCS_NODIVIDER
- // | TBSTYLE_AUTOSIZE
- // | CCS_ADJUSTABLE
- ,0,0,0,0, parent, NULL, g_hInstance, NULL));
-
- // TB_BUTTONSTRUCTSIZE message, which is required for
- // backward compatibility.
- toolBar.ButtonStructSize();
-
- imageList.Create(
- LargeButtons ? 48: 24,
- LargeButtons ? 36: 24,
- ILC_MASK, 0, 0);
- toolBar.SetImageList(0, imageList);
-}
-#endif
-
-struct CButtonInfo
-{
- UINT commandID;
- UINT BitmapResID;
- UINT Bitmap2ResID;
- UINT StringResID;
- UINT32 LangID;
- UString GetText()const { return LangString(StringResID, LangID); };
-};
-
-static CButtonInfo g_StandardButtons[] =
-{
- { IDM_COPY_TO, IDB_COPY, IDB_COPY2, IDS_BUTTON_COPY, 0x03020420},
- { IDM_MOVE_TO, IDB_MOVE, IDB_MOVE2, IDS_BUTTON_MOVE, 0x03020421},
- { IDM_DELETE, IDB_DELETE, IDB_DELETE2, IDS_BUTTON_DELETE, 0x03020422} ,
- { IDM_FILE_PROPERTIES, IDB_INFO, IDB_INFO2, IDS_BUTTON_INFO, 0x03020423}
-};
-
-static CButtonInfo g_ArchiveButtons[] =
-{
- { kAddCommand, IDB_ADD, IDB_ADD2, IDS_ADD, 0x03020400},
- { kExtractCommand, IDB_EXTRACT, IDB_EXTRACT2, IDS_EXTRACT, 0x03020401},
- { kTestCommand , IDB_TEST, IDB_TEST2, IDS_TEST, 0x03020402}
-};
-
-bool SetButtonText(UINT32 commandID, CButtonInfo *buttons, int numButtons, UString &s)
-{
- for (int i = 0; i < numButtons; i++)
- {
- const CButtonInfo &b = buttons[i];
- if (b.commandID == commandID)
- {
- s = b.GetText();
- return true;
- }
- }
- return false;
-}
-
-void SetButtonText(UINT32 commandID, UString &s)
-{
- if (SetButtonText(commandID, g_StandardButtons,
- sizeof(g_StandardButtons) / sizeof(g_StandardButtons[0]), s))
- return;
- SetButtonText(commandID, g_ArchiveButtons,
- sizeof(g_ArchiveButtons) / sizeof(g_ArchiveButtons[0]), s);
-}
-
-#ifdef _WIN32
-static void AddButton(
- NControl::CImageList &imageList,
- NControl::CToolBar &toolBar,
- CButtonInfo &butInfo,
- bool showText,
- bool large)
-{
- TBBUTTON but;
- but.iBitmap = 0;
- but.idCommand = butInfo.commandID;
- but.fsState = TBSTATE_ENABLED;
- but.fsStyle = BTNS_BUTTON
- // | BTNS_AUTOSIZE
- ;
- but.dwData = 0;
-
- UString s = butInfo.GetText();
- but.iString = 0;
- if (showText)
- but.iString = (INT_PTR)(LPCWSTR)s;
-
- but.iBitmap = imageList.GetImageCount();
- HBITMAP b = ::LoadBitmap(g_hInstance,
- large ?
- MAKEINTRESOURCE(butInfo.BitmapResID):
- MAKEINTRESOURCE(butInfo.Bitmap2ResID));
- if (b != 0)
- {
- imageList.AddMasked(b, RGB(255, 0, 255));
- ::DeleteObject(b);
- }
- #ifdef _UNICODE
- toolBar.AddButton(1, &but);
- #else
- toolBar.AddButtonW(1, &but);
- #endif
-}
-
-static void AddBand(NControl::CReBar &reBar, NControl::CToolBar &toolBar)
-{
- SIZE size;
- toolBar.GetMaxSize(&size);
-
- RECT rect;
- toolBar.GetWindowRect(&rect);
-
- REBARBANDINFO rbBand;
- rbBand.cbSize = sizeof(REBARBANDINFO); // Required
- rbBand.fMask = RBBIM_STYLE
- | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE;
- rbBand.fStyle = RBBS_CHILDEDGE; // RBBS_NOGRIPPER;
- rbBand.cxMinChild = size.cx; // rect.right - rect.left;
- rbBand.cyMinChild = size.cy; // rect.bottom - rect.top;
- rbBand.cyChild = rbBand.cyMinChild;
- rbBand.cx = rbBand.cxMinChild;
- rbBand.cxIdeal = rbBand.cxMinChild;
- rbBand.hwndChild = toolBar;
- reBar.InsertBand(-1, &rbBand);
-}
-
-void CApp::ReloadToolbars()
-{
- if (!_rebar)
- return;
- HWND parent = _rebar;
-
- while(_rebar.GetBandCount() > 0)
- _rebar.DeleteBand(0);
-
- _archiveToolBar.Destroy();
- _archiveButtonsImageList.Destroy();
-
- _standardButtonsImageList.Destroy();
- _standardToolBar.Destroy();
-
- if (ShowArchiveToolbar)
- {
- CreateToolbar(parent, _archiveButtonsImageList, _archiveToolBar, LargeButtons);
- for (int i = 0; i < sizeof(g_ArchiveButtons) / sizeof(g_ArchiveButtons[0]); i++)
- AddButton(_archiveButtonsImageList, _archiveToolBar, g_ArchiveButtons[i],
- ShowButtonsLables, LargeButtons);
- AddBand(_rebar, _archiveToolBar);
- }
-
- if (ShowStandardToolbar)
- {
- CreateToolbar(parent, _standardButtonsImageList, _standardToolBar, LargeButtons);
- for (int i = 0; i < sizeof(g_StandardButtons) / sizeof(g_StandardButtons[0]); i++)
- AddButton(_standardButtonsImageList, _standardToolBar, g_StandardButtons[i],
- ShowButtonsLables, LargeButtons);
- AddBand(_rebar, _standardToolBar);
- }
-}
-#endif
-
-void CApp::ReloadRebar(HWND hwnd)
-{
-#ifdef _WIN32
- _rebar.Destroy();
- if (!ShowArchiveToolbar && !ShowStandardToolbar)
- return;
- if (g_ComCtl32Version >= MAKELONG(71, 4))
- {
- INITCOMMONCONTROLSEX icex;
- icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
- icex.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES;
- InitCommonControlsEx(&icex);
-
- _rebar.Attach(::CreateWindowEx(WS_EX_TOOLWINDOW,
- REBARCLASSNAME,
- NULL,
- WS_VISIBLE
- | WS_BORDER
- | WS_CHILD
- | WS_CLIPCHILDREN
- | WS_CLIPSIBLINGS
- // | CCS_NODIVIDER
- // | CCS_NOPARENTALIGN // it's bead for moveing of two bands
- // | CCS_TOP
- | RBS_VARHEIGHT
- | RBS_BANDBORDERS
- // | RBS_AUTOSIZE
- ,0,0,0,0, hwnd, NULL, g_hInstance, NULL));
- }
- if (_rebar == 0)
- return;
- REBARINFO rbi;
- rbi.cbSize = sizeof(REBARINFO); // Required when using this struct.
- rbi.fMask = 0;
- rbi.himl = (HIMAGELIST)NULL;
- _rebar.SetBarInfo(&rbi);
- ReloadToolbars();
-#endif // #ifdef _WIN32
-}
-
-void CApp::Create(HWND hwnd, const UString &mainPath, int xSizes[2], bool &archiveIsOpened, bool &encrypted)
-{
-#ifdef _WIN32
- ReadToolbar();
- ReloadRebar(hwnd);
-#endif
-
- int i;
- for (i = 0; i < kNumPanelsMax; i++)
- PanelsCreated[i] = false;
-
- _window.Attach(hwnd);
- AppState.Read();
- SetListSettings();
- SetShowSystemMenu();
- if (LastFocusedPanel >= kNumPanelsMax)
- LastFocusedPanel = 0;
-
- CListMode listMode;
- ReadListMode(listMode);
- for (i = 0; i < kNumPanelsMax; i++)
- {
- Panels[i]._ListViewMode = listMode.Panels[i];
- Panels[i]._xSize = xSizes[i];
- }
- for (i = 0; i < kNumPanelsMax; i++)
- if (NumPanels > 1 || i == LastFocusedPanel)
- {
- if (NumPanels == 1)
- Panels[i]._xSize = xSizes[0] + xSizes[1];
- bool archiveIsOpened2 = false;
- bool encrypted2 = false;
- bool mainPanel = (i == LastFocusedPanel);
- CreateOnePanel(i, mainPanel ? mainPath : L"", archiveIsOpened2, encrypted2);
- if (mainPanel)
- {
- archiveIsOpened = archiveIsOpened2;
- encrypted = encrypted2;
- }
- }
- SetFocusedPanel(LastFocusedPanel);
- Panels[LastFocusedPanel].SetFocusToList();
-}
-
-extern void MoveSubWindows(HWND hWnd);
-
-void CApp::SwitchOnOffOnePanel()
-{
- if (NumPanels == 1)
- {
- NumPanels++;
- bool archiveIsOpened, encrypted;
- CreateOnePanel(1 - LastFocusedPanel, UString(), archiveIsOpened, encrypted);
- // FIXME Panels[1 - LastFocusedPanel].Enable(true);
- // FIXME Panels[1 - LastFocusedPanel].Show(SW_SHOWNORMAL);
- }
- else
- {
- NumPanels--;
- // FIXME Panels[1 - LastFocusedPanel].Enable(false);
- // FIXME Panels[1 - LastFocusedPanel].Show(SW_HIDE);
- }
- MoveSubWindows(_window);
-}
-
-void CApp::Save()
-{
- AppState.Save();
- CListMode listMode;
- for (int i = 0; i < kNumPanelsMax; i++)
- {
- const CPanel &panel = Panels[i];
- UString path;
- if (panel._parentFolders.IsEmpty())
- path = panel._currentFolderPrefix;
- else
- path = GetFolderPath(panel._parentFolders[0].ParentFolder);
- SavePanelPath(i, path);
- listMode.Panels[i] = panel.GetListViewMode();
- }
- SaveListMode(listMode);
-}
-
-void CApp::Release()
-{
- // It's for unloading COM dll's: don't change it.
- for (int i = 0; i < kNumPanelsMax; i++)
- Panels[i].Release();
-}
-
-static bool IsThereFolderOfPath(const UString &path)
-{
- CFileInfoW fileInfo;
- if (!FindFile(path, fileInfo))
- return false;
- return fileInfo.IsDir();
-}
-
-// reduces path to part that exists on disk
-static void ReducePathToRealFileSystemPath(UString &path)
-{
- while(!path.IsEmpty())
- {
- if (IsThereFolderOfPath(path))
- {
- NName::NormalizeDirPathPrefix(path);
- break;
- }
- int pos = path.ReverseFind(CHAR_PATH_SEPARATOR);
- if (pos < 0)
- path.Empty();
- else
- {
- path = path.Left(pos + 1);
- if (path.Length() == 3 && path[1] == L':')
- break;
- if (path.Length() > 2 && path[0] == CHAR_PATH_SEPARATOR && path[1] == CHAR_PATH_SEPARATOR)
- {
- int nextPos = path.Find(CHAR_PATH_SEPARATOR, 2); // pos after \\COMPNAME
- if (nextPos > 0 && path.Find(CHAR_PATH_SEPARATOR, nextPos + 1) == pos)
- break;
- }
- path = path.Left(pos);
- }
- }
-}
-
-// return true for dir\, if dir exist
-static bool CheckFolderPath(const UString &path)
-{
- UString pathReduced = path;
- ReducePathToRealFileSystemPath(pathReduced);
- return (pathReduced == path);
-}
-
-static bool IsPathAbsolute(const UString &path)
-{
- if ((path.Length() >= 1 && path[0] == WCHAR_PATH_SEPARATOR) ||
- (path.Length() >= 3 && path[1] == L':' && path[2] == WCHAR_PATH_SEPARATOR))
- return true;
- return false;
-}
-
-extern UString ConvertSizeToString(UInt64 value);
-
-static UString AddSizeValue(UInt64 size)
-{
- return MyFormatNew(IDS_FILE_SIZE, 0x02000982, ConvertSizeToString(size));
-}
-
-static void AddValuePair1(UINT resourceID, UInt32 langID, UInt64 size, UString &s)
-{
- s += LangString(resourceID, langID);
- s += L" ";
- s += AddSizeValue(size);
- s += L"\n";
-}
-
-void AddValuePair2(UINT resourceID, UInt32 langID, UInt64 num, UInt64 size, UString &s)
-{
- if (num == 0)
- return;
- s += LangString(resourceID, langID);
- s += L" ";
- s += ConvertSizeToString(num);
-
- if (size != (UInt64)(Int64)-1)
- {
- s += L" ( ";
- s += AddSizeValue(size);
- s += L" )";
- }
- s += L"\n";
-}
-
-static void AddPropValueToSum(IFolderFolder *folder, int index, PROPID propID, UInt64 &sum)
-{
- if (sum == (UInt64)(Int64)-1)
- return;
- NCOM::CPropVariant prop;
- folder->GetProperty(index, propID, &prop);
- switch(prop.vt)
- {
- case VT_UI4:
- case VT_UI8:
- sum += ConvertPropVariantToUInt64(prop);
- break;
- default:
- sum = (UInt64)(Int64)-1;
- }
-}
-
-UString CPanel::GetItemsInfoString(const CRecordVector<UInt32> &indices)
-{
- UString info;
- UInt64 numDirs, numFiles, filesSize, foldersSize;
- numDirs = numFiles = filesSize = foldersSize = 0;
- int i;
- for (i = 0; i < indices.Size(); i++)
- {
- int index = indices[i];
- if (IsItemFolder(index))
- {
- AddPropValueToSum(_folder, index, kpidSize, foldersSize);
- numDirs++;
- }
- else
- {
- AddPropValueToSum(_folder, index, kpidSize, filesSize);
- numFiles++;
- }
- }
-
- AddValuePair2(IDS_FOLDERS_COLON, 0x02000321, numDirs, foldersSize, info);
- AddValuePair2(IDS_FILES_COLON, 0x02000320, numFiles, filesSize, info);
- int numDefined = ((foldersSize != (UInt64)(Int64)-1) && foldersSize != 0) ? 1: 0;
- numDefined += ((filesSize != (UInt64)(Int64)-1) && filesSize != 0) ? 1: 0;
- if (numDefined == 2)
- AddValuePair1(IDS_SIZE_COLON, 0x02000322, filesSize + foldersSize, info);
-
- info += L"\n";
- info += _currentFolderPrefix;
-
- for (i = 0; i < indices.Size() && i < kCopyDialog_NumInfoLines - 6; i++)
- {
- info += L"\n ";
- int index = indices[i];
- info += GetItemRelPath(index);
- if (IsItemFolder(index))
- info += L'\\';
- }
- if (i != indices.Size())
- info += L"\n ...";
- return info;
-}
-
-void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
-{
- int destPanelIndex = (NumPanels <= 1) ? srcPanelIndex : (1 - srcPanelIndex);
- CPanel &srcPanel = Panels[srcPanelIndex];
- CPanel &destPanel = Panels[destPanelIndex];
-
- CPanel::CDisableTimerProcessing disableTimerProcessing1(destPanel);
- CPanel::CDisableTimerProcessing disableTimerProcessing2(srcPanel);
-
- if (!srcPanel.DoesItSupportOperations())
- {
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
- return;
- }
-
- CRecordVector<UInt32> indices;
- UString destPath;
- bool useDestPanel = false;
-
- {
- if (copyToSame)
- {
- int focusedItem = srcPanel._listView.GetFocusedItem();
- if (focusedItem < 0)
- return;
- int realIndex = srcPanel.GetRealItemIndex(focusedItem);
- if (realIndex == kParentIndex)
- return;
- indices.Add(realIndex);
- destPath = srcPanel.GetItemName(realIndex);
- }
- else
- {
- srcPanel.GetOperatedItemIndices(indices);
- if (indices.Size() == 0)
- return;
- destPath = destPanel._currentFolderPrefix;
- if (NumPanels == 1)
- ReducePathToRealFileSystemPath(destPath);
- }
-
- CCopyDialog copyDialog;
- UStringVector copyFolders;
- ReadCopyHistory(copyFolders);
-
- copyDialog.Strings = copyFolders;
- copyDialog.Value = destPath;
-
- copyDialog.Title = move ?
- LangString(IDS_MOVE, 0x03020202):
- LangString(IDS_COPY, 0x03020201);
- copyDialog.Static = move ?
- LangString(IDS_MOVE_TO, 0x03020204):
- LangString(IDS_COPY_TO, 0x03020203);
-
- copyDialog.Info = srcPanel.GetItemsInfoString(indices);
-
- if (copyDialog.Create(srcPanel.GetParent()) == IDCANCEL)
- return;
-
- destPath = copyDialog.Value;
-
- if (destPath.IsEmpty())
- {
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
- return;
- }
-
- if (!IsPathAbsolute(destPath))
- {
- if (!srcPanel.IsFSFolder())
- {
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
- return;
- }
- destPath = srcPanel._currentFolderPrefix + destPath;
- }
-
- printf("destPath='%ls'\n",(const wchar_t *)destPath);
-#ifdef _WIN32
- if (destPath.Length() > 0 && destPath[0] == CHAR_PATH_SEPARATOR)
- if (destPath.Length() == 1 || destPath[1] != CHAR_PATH_SEPARATOR)
- {
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
- return;
- }
-#endif
-
- if (indices.Size() > 1 || (destPath.Length() > 0 && destPath.ReverseFind(CHAR_PATH_SEPARATOR) == destPath.Length() - 1) ||
- IsThereFolderOfPath(destPath))
- {
- NDirectory::CreateComplexDirectory(destPath);
- NName::NormalizeDirPathPrefix(destPath);
- if (!CheckFolderPath(destPath))
- {
- if (NumPanels < 2 || destPath != destPanel._currentFolderPrefix || !destPanel.DoesItSupportOperations())
- {
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
- return;
- }
- useDestPanel = true;
- }
- }
- else
- {
- int pos = destPath.ReverseFind(CHAR_PATH_SEPARATOR);
- if (pos >= 0)
- {
- UString prefix = destPath.Left(pos + 1);
- NDirectory::CreateComplexDirectory(prefix);
- if (!CheckFolderPath(prefix))
- {
- srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
- return;
- }
- }
- }
-
- AddUniqueStringToHeadOfList(copyFolders, destPath);
- while (copyFolders.Size() > 20)
- copyFolders.DeleteBack();
- SaveCopyHistory(copyFolders);
- }
-
- bool useSrcPanel = (!useDestPanel || !srcPanel.IsFSFolder() || destPanel.IsFSFolder());
- bool useTemp = useSrcPanel && useDestPanel;
- // FIXME NFile::NDirectory::CTempDirectoryW tempDirectory;
- UString tempDirPrefix;
- if (useTemp)
- {
- /* FIXME
- tempDirectory.Create(kTempDirPrefix);
- tempDirPrefix = tempDirectory.GetPath();
- NFile::NName::NormalizeDirPathPrefix(tempDirPrefix);
- */
- printf("useTemp : Not Implemented\n");
- exit(EXIT_FAILURE);
- }
-
- CSelectedState srcSelState;
- CSelectedState destSelState;
- srcPanel.SaveSelectedState(srcSelState);
- destPanel.SaveSelectedState(destSelState);
-
- HRESULT result;
- if (useSrcPanel)
- {
- UString folder = useTemp ? tempDirPrefix : destPath;
- result = srcPanel.CopyTo(indices, folder, move, true, 0);
- if (result != S_OK)
- {
- disableTimerProcessing1.Restore();
- disableTimerProcessing2.Restore();
- // For Password:
- srcPanel.SetFocusToList();
- if (result != E_ABORT)
- srcPanel.MessageBoxError(result, L"Error");
- return;
- }
- }
-
- if (useDestPanel)
- {
- UStringVector filePaths;
- UString folderPrefix;
- if (useTemp)
- folderPrefix = tempDirPrefix;
- else
- folderPrefix = srcPanel._currentFolderPrefix;
- filePaths.Reserve(indices.Size());
- for(int i = 0; i < indices.Size(); i++)
- filePaths.Add(srcPanel.GetItemRelPath(indices[i]));
-
- result = destPanel.CopyFrom(folderPrefix, filePaths, true, 0);
-
- if (result != S_OK)
- {
- disableTimerProcessing1.Restore();
- disableTimerProcessing2.Restore();
- // For Password:
- srcPanel.SetFocusToList();
- if (result != E_ABORT)
- srcPanel.MessageBoxError(result, L"Error");
- return;
- }
- }
-
- RefreshTitleAlways();
- if (copyToSame || move)
- {
- srcPanel.RefreshListCtrl(srcSelState);
- }
- if (!copyToSame)
- {
- destPanel.RefreshListCtrl(destSelState);
- srcPanel.KillSelection();
- }
- disableTimerProcessing1.Restore();
- disableTimerProcessing2.Restore();
- srcPanel.SetFocusToList();
-}
-
-void CApp::OnSetSameFolder(int srcPanelIndex)
-{
- if (NumPanels <= 1)
- return;
- const CPanel &srcPanel = Panels[srcPanelIndex];
- CPanel &destPanel = Panels[1 - srcPanelIndex];
- destPanel.BindToPathAndRefresh(srcPanel._currentFolderPrefix);
-}
-
-void CApp::OnSetSubFolder(int srcPanelIndex)
-{
- if (NumPanels <= 1)
- return;
- const CPanel &srcPanel = Panels[srcPanelIndex];
- CPanel &destPanel = Panels[1 - srcPanelIndex];
-
- int focusedItem = srcPanel._listView.GetFocusedItem();
- if (focusedItem < 0)
- return;
- int realIndex = srcPanel.GetRealItemIndex(focusedItem);
- if (!srcPanel.IsItemFolder(realIndex))
- return;
-
-
- /*
- UString string = srcPanel._currentFolderPrefix +
- srcPanel.GetItemName(realIndex) + WCHAR_PATH_SEPARATOR;
- destPanel.BindToFolder(string);
- */
- CMyComPtr<IFolderFolder> newFolder;
- if (realIndex == kParentIndex)
- {
- if (srcPanel._folder->BindToParentFolder(&newFolder) != S_OK)
- return;
- }
- else
- {
- if (srcPanel._folder->BindToFolder(realIndex, &newFolder) != S_OK)
- return;
- }
- destPanel.CloseOpenFolders();
- destPanel._folder = newFolder;
- destPanel.RefreshListCtrl();
-}
-
-/*
-int CApp::GetFocusedPanelIndex() const
-{
- return LastFocusedPanel;
- HWND hwnd = ::GetFocus();
- for (;;)
- {
- if (hwnd == 0)
- return 0;
- for (int i = 0; i < kNumPanelsMax; i++)
- {
- if (PanelsCreated[i] &&
- ((HWND)Panels[i] == hwnd || Panels[i]._listView == hwnd))
- return i;
- }
- hwnd = GetParent(hwnd);
- }
-}
- */
-
-static UString g_ToolTipBuffer;
-static CSysString g_ToolTipBufferSys;
-
-#ifdef _WIN32
-void CApp::OnNotify(int /* ctrlID */, LPNMHDR pnmh)
-{
- if (pnmh->hwndFrom == _rebar)
- {
- switch(pnmh->code)
- {
- case RBN_HEIGHTCHANGE:
- {
- MoveSubWindows(g_HWND);
- return;
- }
- }
- return ;
- }
- else
- {
- if (pnmh->code == TTN_GETDISPINFO)
- {
- LPNMTTDISPINFO info = (LPNMTTDISPINFO)pnmh;
- info->hinst = 0;
- g_ToolTipBuffer.Empty();
- SetButtonText((UINT32)info->hdr.idFrom, g_ToolTipBuffer);
- g_ToolTipBufferSys = GetSystemString(g_ToolTipBuffer);
- info->lpszText = (LPTSTR)(LPCTSTR)g_ToolTipBufferSys;
- return;
- }
- #ifndef _UNICODE
- if (pnmh->code == TTN_GETDISPINFOW)
- {
- LPNMTTDISPINFOW info = (LPNMTTDISPINFOW)pnmh;
- info->hinst = 0;
- g_ToolTipBuffer.Empty();
- SetButtonText((UINT32)info->hdr.idFrom, g_ToolTipBuffer);
- info->lpszText = (LPWSTR)(LPCWSTR)g_ToolTipBuffer;
- return;
- }
- #endif
- }
-}
-#endif
-
-void CApp::RefreshTitle(bool always)
-{
- UString path = GetFocusedPanel()._currentFolderPrefix;
- if (path.IsEmpty())
- path += LangString(IDS_APP_TITLE, 0x03000000);
- if (!always && path == PrevTitle)
- return;
- PrevTitle = path;
- NWindows::MySetWindowText(_window, path);
-}
-
-void CApp::RefreshTitle(int panelIndex, bool always)
-{
- if (panelIndex != GetFocusedPanelIndex())
- return;
- RefreshTitle(always);
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/App.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/App.h
deleted file mode 100644
index f0c9a933f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/App.h
+++ /dev/null
@@ -1,344 +0,0 @@
-// App.h
-
-#ifndef __APP_H
-#define __APP_H
-
-#include "Panel.h"
-#include "AppState.h"
-// FIXME #include "Windows/Control/ImageList.h"
-
-class CApp;
-
-extern CApp g_App;
-extern HWND g_HWND;
-
-const int kNumPanelsMax = 2;
-
-extern void MoveSubWindows(HWND hWnd);
-
-enum
-{
- kAddCommand = kToolbarStartID,
- kExtractCommand,
- kTestCommand
-};
-
-class CPanelCallbackImp: public CPanelCallback
-{
- CApp *_app;
- int _index;
-public:
- void Init(CApp *app, int index)
- {
- _app = app;
- _index = index;
- }
- virtual void OnTab();
- virtual void SetFocusToPath(int index);
- virtual void OnCopy(bool move, bool copyToSame);
- virtual void OnSetSameFolder();
- virtual void OnSetSubFolder();
- virtual void PanelWasFocused();
- virtual void DragBegin();
- virtual void DragEnd();
- virtual void RefreshTitle(bool always);
-};
-
-class CApp;
-
-#if _WIN32
-class CDropTarget:
- public IDropTarget,
- public CMyUnknownImp
-{
- CMyComPtr<IDataObject> m_DataObject;
- UStringVector m_SourcePaths;
- int m_SelectionIndex;
- bool m_DropIsAllowed; // = true, if data contain fillist
- bool m_PanelDropIsAllowed; // = false, if current target_panel is source_panel.
- // check it only if m_DropIsAllowed == true
- int m_SubFolderIndex;
- UString m_SubFolderName;
-
- CPanel *m_Panel;
- bool m_IsAppTarget; // true, if we want to drop to app window (not to panel).
-
- bool m_SetPathIsOK;
-
- bool IsItSameDrive() const;
-
- void QueryGetData(IDataObject *dataObject);
- bool IsFsFolderPath() const;
- DWORD GetEffect(DWORD keyState, POINTL pt, DWORD allowedEffect);
- void RemoveSelection();
- void PositionCursor(POINTL ptl);
- UString GetTargetPath() const;
- bool SetPath(bool enablePath) const;
- bool SetPath();
-
-public:
- MY_UNKNOWN_IMP1_MT(IDropTarget)
- STDMETHOD(DragEnter)(IDataObject * dataObject, DWORD keyState,
- POINTL pt, DWORD *effect);
- STDMETHOD(DragOver)(DWORD keyState, POINTL pt, DWORD * effect);
- STDMETHOD(DragLeave)();
- STDMETHOD(Drop)(IDataObject * dataObject, DWORD keyState,
- POINTL pt, DWORD *effect);
-
- CDropTarget():
- TargetPanelIndex(-1),
- SrcPanelIndex(-1),
- m_IsAppTarget(false),
- m_Panel(0),
- App(0),
- m_PanelDropIsAllowed(false),
- m_DropIsAllowed(false),
- m_SelectionIndex(-1),
- m_SubFolderIndex(-1),
- m_SetPathIsOK(false) {}
-
- CApp *App;
- int SrcPanelIndex; // index of D&D source_panel
- int TargetPanelIndex; // what panel to use as target_panel of Application
-};
-#endif
-
-class CApp
-{
-public:
- NWindows::CWindow _window;
- bool ShowSystemMenu;
- int NumPanels;
- int LastFocusedPanel;
-
- bool ShowStandardToolbar;
- bool ShowArchiveToolbar;
- bool ShowButtonsLables;
- bool LargeButtons;
-
- CAppState AppState;
- CPanelCallbackImp m_PanelCallbackImp[kNumPanelsMax];
- CPanel Panels[kNumPanelsMax];
- bool PanelsCreated[kNumPanelsMax];
-
-#ifdef _WIN32
- NWindows::NControl::CImageList _archiveButtonsImageList;
- NWindows::NControl::CImageList _standardButtonsImageList;
-
- NWindows::NControl::CReBar _rebar;
- NWindows::NControl::CToolBar _archiveToolBar;
- NWindows::NControl::CToolBar _standardToolBar;
-
- CDropTarget *_dropTargetSpec;
- CMyComPtr<IDropTarget> _dropTarget;
-
- void CreateDragTarget()
- {
- _dropTargetSpec = new CDropTarget();
- _dropTarget = _dropTargetSpec;
- _dropTargetSpec->App = (this);
- }
-#endif
-
- void SetFocusedPanel(int index)
- {
- LastFocusedPanel = index;
- // FIXME _dropTargetSpec->TargetPanelIndex = LastFocusedPanel;
- }
-
-#ifdef _WIN32
- void DragBegin(int panelIndex)
- {
- _dropTargetSpec->TargetPanelIndex = (NumPanels > 1) ? 1 - panelIndex : panelIndex;
- _dropTargetSpec->SrcPanelIndex = panelIndex;
- }
-
- void DragEnd()
- {
- _dropTargetSpec->TargetPanelIndex = LastFocusedPanel;
- _dropTargetSpec->SrcPanelIndex = -1;
- }
-#endif
-
-
- void OnCopy(bool move, bool copyToSame, int srcPanelIndex);
- void OnSetSameFolder(int srcPanelIndex);
- void OnSetSubFolder(int srcPanelIndex);
-
- void CreateOnePanel(int panelIndex, const UString &mainPath, bool &archiveIsOpened, bool &encrypted);
- void Create(HWND hwnd, const UString &mainPath, int xSizes[2], bool &archiveIsOpened, bool &encrypted);
- void Read();
- void Save();
- void Release();
-
-
- /*
- void SetFocus(int panelIndex)
- { Panels[panelIndex].SetFocusToList(); }
- */
- void SetFocusToLastItem()
- { Panels[LastFocusedPanel].SetFocusToLastRememberedItem(); }
-
- int GetFocusedPanelIndex() const { return LastFocusedPanel; }
-
- bool IsPanelVisible(int index) const { return (NumPanels > 1 || index == LastFocusedPanel); }
-
- /*
- void SetCurrentIndex()
- { CurrentPanel = GetFocusedPanelIndex(); }
- */
-
- CApp(): NumPanels(2), LastFocusedPanel(0) {}
- CPanel &GetFocusedPanel()
- { return Panels[GetFocusedPanelIndex()]; }
-
- // File Menu
- void OpenItem()
- { GetFocusedPanel().OpenSelectedItems(true); }
- void OpenItemInside()
- { GetFocusedPanel().OpenFocusedItemAsInternal(); }
- void OpenItemOutside()
- { GetFocusedPanel().OpenSelectedItems(false); }
- void EditItem()
- { GetFocusedPanel().EditItem(); }
- void Rename()
- { GetFocusedPanel().RenameFile(); }
- void CopyTo()
- { OnCopy(false, false, GetFocusedPanelIndex()); }
- void MoveTo()
- { OnCopy(true, false, GetFocusedPanelIndex()); }
- void Delete(bool toRecycleBin)
- { GetFocusedPanel().DeleteItems(toRecycleBin); }
- void CalculateCrc();
- void Split();
- void Combine();
- void Properties()
- { GetFocusedPanel().Properties(); }
- void Comment()
- { GetFocusedPanel().ChangeComment(); }
-
- void CreateFolder()
- { GetFocusedPanel().CreateFolder(); }
- void CreateFile()
- { GetFocusedPanel().CreateFile(); }
-
- // Edit
- void EditCut()
- { GetFocusedPanel().EditCut(); }
- void EditCopy()
- { GetFocusedPanel().EditCopy(); }
- void EditPaste()
- { GetFocusedPanel().EditPaste(); }
-
- void SelectAll(bool selectMode)
- { GetFocusedPanel().SelectAll(selectMode); }
- void InvertSelection()
- { GetFocusedPanel().InvertSelection(); }
- void SelectSpec(bool selectMode)
- { GetFocusedPanel().SelectSpec(selectMode); }
- void SelectByType(bool selectMode)
- { GetFocusedPanel().SelectByType(selectMode); }
-
- void RefreshStatusBar()
- { GetFocusedPanel().RefreshStatusBar(); }
-
- void SetListViewMode(UINT32 index)
- { GetFocusedPanel().SetListViewMode(index); }
- UINT32 GetListViewMode()
- { return GetFocusedPanel().GetListViewMode(); }
-
- void SortItemsWithPropID(PROPID propID)
- { GetFocusedPanel().SortItemsWithPropID(propID); }
-
- void OpenRootFolder()
- { GetFocusedPanel().OpenDrivesFolder(); }
- void OpenParentFolder()
- { GetFocusedPanel().OpenParentFolder(); }
- void FoldersHistory()
- { GetFocusedPanel().FoldersHistory(); }
- void RefreshView()
- { GetFocusedPanel().OnReload(); }
- void RefreshAllPanels()
- {
- for (int i = 0; i < NumPanels; i++)
- {
- int index = i;
- if (NumPanels == 1)
- index = LastFocusedPanel;
- Panels[index].OnReload();
- }
- }
- void SetListSettings();
- void SetShowSystemMenu();
- void SwitchOnOffOnePanel();
- bool GetFlatMode() { return Panels[LastFocusedPanel].GetFlatMode(); }
- void ChangeFlatMode() { Panels[LastFocusedPanel].ChangeFlatMode(); }
-
- void OpenBookmark(int index)
- { GetFocusedPanel().OpenBookmark(index); }
- void SetBookmark(int index)
- { GetFocusedPanel().SetBookmark(index); }
-
- void ReloadRebar(HWND hwnd);
- void ReloadToolbars();
- void ReadToolbar()
- {
- UINT32 mask = ReadToolbarsMask();
- ShowButtonsLables = ((mask & 1) != 0);
- LargeButtons = ((mask & 2) != 0);
- ShowStandardToolbar = ((mask & 4) != 0);
- ShowArchiveToolbar = ((mask & 8) != 0);
- }
- void SaveToolbar()
- {
- UINT32 mask = 0;
- if (ShowButtonsLables) mask |= 1;
- if (LargeButtons) mask |= 2;
- if (ShowStandardToolbar) mask |= 4;
- if (ShowArchiveToolbar) mask |= 8;
- SaveToolbarsMask(mask);
- }
- void SwitchStandardToolbar()
- {
- ShowStandardToolbar = !ShowStandardToolbar;
- SaveToolbar();
- ReloadRebar(g_HWND);
- MoveSubWindows(_window);
- }
- void SwitchArchiveToolbar()
- {
- ShowArchiveToolbar = !ShowArchiveToolbar;
- SaveToolbar();
- ReloadRebar(g_HWND);
- MoveSubWindows(_window);
- }
- void SwitchButtonsLables()
- {
- ShowButtonsLables = !ShowButtonsLables;
- SaveToolbar();
- ReloadRebar(g_HWND);
- MoveSubWindows(_window);
- }
- void SwitchLargeButtons()
- {
- LargeButtons = !LargeButtons;
- SaveToolbar();
- ReloadRebar(g_HWND);
- MoveSubWindows(_window);
- }
-
- void AddToArchive() { GetFocusedPanel().AddToArchive(); }
- void ExtractArchives() { GetFocusedPanel().ExtractArchives(); }
- void TestArchives() { GetFocusedPanel().TestArchives(); }
-
-#ifdef _WIN32
- void OnNotify(int ctrlID, LPNMHDR pnmh);
-#endif
-
- UString PrevTitle;
- void RefreshTitle(bool always = false);
- void RefreshTitleAlways() { RefreshTitle(true); }
- void RefreshTitle(int panelIndex, bool always = false);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/AppState.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/AppState.h
deleted file mode 100644
index 7b59d4547..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/AppState.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// AppState.h
-
-#ifndef __APPSTATE_H
-#define __APPSTATE_H
-
-#include "Windows/Synchronization.h"
-
-void inline AddUniqueStringToHead(UStringVector &list,
- const UString &string)
-{
- for(int i = 0; i < list.Size();)
- if (string.CompareNoCase(list[i]) == 0)
- list.Delete(i);
- else
- i++;
- list.Insert(0, string);
-}
-
-class CFastFolders
-{
- NWindows::NSynchronization::CCriticalSection _criticalSection;
-public:
- UStringVector Strings;
- void SetString(int index, const UString &string)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- while(Strings.Size() <= index)
- Strings.Add(UString());
- Strings[index] = string;
- }
- UString GetString(int index)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- if (index >= Strings.Size())
- return UString();
- return Strings[index];
- }
- void Save()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- SaveFastFolders(Strings);
- }
- void Read()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- ReadFastFolders(Strings);
- }
-};
-
-class CFolderHistory
-{
- NWindows::NSynchronization::CCriticalSection _criticalSection;
- UStringVector Strings;
- void Normalize()
- {
- const int kMaxSize = 100;
- if (Strings.Size() > kMaxSize)
- Strings.Delete(kMaxSize, Strings.Size() - kMaxSize);
- }
-
-public:
-
- void GetList(UStringVector &foldersHistory)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- foldersHistory = Strings;
- }
-
- void AddString(const UString &string)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- AddUniqueStringToHead(Strings, string);
- Normalize();
- }
-
- void RemoveAll()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- Strings.Clear();
- }
-
- void Save()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- SaveFolderHistory(Strings);
- }
-
- void Read()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- ReadFolderHistory(Strings);
- Normalize();
- }
-};
-
-struct CAppState
-{
- CFastFolders FastFolders;
- CFolderHistory FolderHistory;
- void Save()
- {
- FastFolders.Save();
- FolderHistory.Save();
- }
- void Read()
- {
- FastFolders.Read();
- FolderHistory.Read();
- }
-};
-
-
-#endif
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ClassDefs.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ClassDefs.cpp
deleted file mode 100644
index 5b4401a10..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ClassDefs.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-// ClassDefs.cpp
-
-#include "StdAfx.h"
-
-#include <initguid.h>
-
-#include "IFolder.h"
-#include "../../IPassword.h"
-#include "PluginInterface.h"
-#include "ExtractCallback.h"
-#include "../../ICoder.h"
-
-#include "../Agent/Agent.h"
-
-// {23170F69-40C1-278A-1000-000100020000}
-DEFINE_GUID(CLSID_CZipContextMenu,
-0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialog.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialog.cpp
deleted file mode 100644
index 807a5dd25..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialog.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// ComboDialog.cpp
-
-#include "StdAfx.h"
-#include "ComboDialog.h"
-
-#include "Windows/Control/Static.h"
-
-#ifdef LANG
-#include "LangUtils.h"
-#endif
-
-using namespace NWindows;
-
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDOK, 0x02000702 },
- { IDCANCEL, 0x02000710 }
-};
-#endif
-
-bool CComboDialog::OnInit()
-{
- #ifdef LANG
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- #endif
- _comboBox.Attach(GetItem(IDC_COMBO_COMBO));
-
- /*
- // why it doesn't work ?
- DWORD style = _comboBox.GetStyle();
- if (Sorted)
- style |= CBS_SORT;
- else
- style &= ~CBS_SORT;
- _comboBox.SetStyle(style);
- */
- SetText(Title);
-
- NControl::CStatic staticContol;
- staticContol.Attach(GetItem(IDC_COMBO_STATIC));
- staticContol.SetText(Static);
- _comboBox.SetText(Value);
- for(int i = 0; i < Strings.Size(); i++)
- _comboBox.AddString(Strings[i]);
- return CModalDialog::OnInit();
-}
-
-void CComboDialog::OnOK()
-{
- _comboBox.GetText(Value);
- CModalDialog::OnOK();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialog.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialog.h
deleted file mode 100644
index 0a1addc54..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialog.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// ComboDialog.h
-
-#ifndef __COMBODIALOG_H
-#define __COMBODIALOG_H
-
-#include "Windows/Control/Dialog.h"
-#include "Windows/Control/ComboBox.h"
-#include "ComboDialogRes.h"
-
-class CComboDialog: public NWindows::NControl::CModalDialog
-{
- NWindows::NControl::CComboBox _comboBox;
- virtual void OnOK();
- virtual bool OnInit();
-public:
- // bool Sorted;
- UString Title;
- UString Static;
- UString Value;
- UStringVector Strings;
- // CComboDialog(): Sorted(false) {};
- INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_COMBO, parentWindow); }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialogRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialogRes.h
deleted file mode 100644
index b5111ddfd..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialogRes.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#define IDD_DIALOG_COMBO 200
-
-#define IDC_COMBO_STATIC 1000
-#define IDC_COMBO_COMBO 1001
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialog_rc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialog_rc.cpp
deleted file mode 100644
index 086d0a4b4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ComboDialog_rc.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// PasswordDialog.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#include "Windows/Control/DialogImpl.h"
-
-#include "ComboDialogRes.h"
-
-class ComboDialogImpl : public NWindows::NControl::CModalDialogImpl
-{
- public:
- ComboDialogImpl(NWindows::NControl::CModalDialog *dialog,wxWindow * parent,int id) : CModalDialogImpl(dialog, parent, id, wxT("Combo"))
- {
-
- wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
-
-
- topsizer->Add(new wxStaticText(this, IDC_COMBO_STATIC, _T("")) , 0 ,wxALL | wxALIGN_LEFT, 5 );
-
-
- wxArrayString pathArray;
- wxComboBox *combo = new wxComboBox(this, IDC_COMBO_COMBO, wxEmptyString, wxDefaultPosition, wxSize(200,-1), pathArray, wxCB_DROPDOWN|wxCB_SORT);
-
- topsizer->Add(combo, 0 ,wxALL | wxALIGN_LEFT, 5 );
-
- topsizer->Add(CreateButtonSizer(wxOK|wxCANCEL), 0, wxALL|wxEXPAND, 5);
-
- this->OnInit();
-
- SetSizer(topsizer); // use the sizer for layout
- topsizer->SetSizeHints(this); // set size hints to honour minimum size
- }
-private:
- // Any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-REGISTER_DIALOG(IDD_DIALOG_COMBO,ComboDialog,0)
-
-BEGIN_EVENT_TABLE(ComboDialogImpl, wxDialog)
- EVT_BUTTON(wxID_ANY, CModalDialogImpl::OnAnyButton)
- EVT_CHECKBOX(wxID_ANY, CModalDialogImpl::OnAnyButton)
-END_EVENT_TABLE()
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialog.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialog.cpp
deleted file mode 100644
index 2bf603019..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialog.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-// CopyDialog.cpp
-
-#include "StdAfx.h"
-#include "CopyDialog.h"
-
-#include "Common/StringConvert.h"
-
-#include "Windows/Control/Static.h"
-#include "Windows/Shell.h"
-#include "Windows/FileName.h"
-
-#ifdef LANG
-#include "LangUtils.h"
-#endif
-
-using namespace NWindows;
-
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDOK, 0x02000702 },
- { IDCANCEL, 0x02000710 }
-};
-#endif
-
-bool CCopyDialog::OnInit()
-{
- #ifdef LANG
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- #endif
- _path.Attach(GetItem(IDC_COPY_COMBO));
- SetText(Title);
-
- NControl::CStatic staticContol;
- staticContol.Attach(GetItem(IDC_COPY_STATIC));
- staticContol.SetText(Static);
- for (int i = 0; i < Strings.Size(); i++)
- _path.AddString(Strings[i]);
- _path.SetText(Value);
- SetItemText(IDC_COPY_INFO, Info);
- return CModalDialog::OnInit();
-}
-
-bool CCopyDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
- switch(buttonID)
- {
- case IDC_COPY_SET_PATH:
- OnButtonSetPath();
- return true;
- }
- return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
-}
-
-void CCopyDialog::OnButtonSetPath()
-{
- UString currentPath;
- _path.GetText(currentPath);
-
- /*
- #ifdef LANG
- UString title = LangLoadString(IDS_EXTRACT_SET_FOLDER, 0x02000881);
- #else
- UString title = MyLoadString(IDS_EXTRACT_SET_FOLDER);
- #endif
- */
- UString title = LangStringSpec(IDS_SET_FOLDER, 0x03020209);
- // UString title = L"Specify a location for output folder";
-
- UString resultPath;
- if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
- return;
- NFile::NName::NormalizeDirPathPrefix(resultPath);
- _path.SetCurSel(-1);
- _path.SetText(resultPath);
-}
-
-void CCopyDialog::OnOK()
-{
- _path.GetText(Value);
- CModalDialog::OnOK();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialog.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialog.h
deleted file mode 100644
index 55872f1c1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialog.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// CopyDialog.h
-
-#ifndef __COPYDIALOG_H
-#define __COPYDIALOG_H
-
-#include "Windows/Control/Dialog.h"
-#include "Windows/Control/ComboBox.h"
-#include "CopyDialogRes.h"
-
-const int kCopyDialog_NumInfoLines = 11;
-
-class CCopyDialog: public NWindows::NControl::CModalDialog
-{
- NWindows::NControl::CComboBox _path;
- virtual void OnOK();
- virtual bool OnInit();
- void OnButtonSetPath();
- bool OnButtonClicked(int buttonID, HWND buttonHWND);
-public:
- UString Title;
- UString Static;
- UString Value;
- UStringVector Strings;
-
- UString Info;
-
- INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_COPY, parentWindow); }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialogRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialogRes.h
deleted file mode 100644
index 900bf29f3..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialogRes.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#define IDD_DIALOG_COPY 202
-
-#define IDC_COPY_STATIC 1000
-#define IDC_COPY_COMBO 1001
-#define IDC_COPY_SET_PATH 1002
-#define IDC_COPY_INFO 1003
-
-#define IDS_SET_FOLDER 210
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialog_rc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialog_rc.cpp
deleted file mode 100644
index 700a78a5f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/CopyDialog_rc.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-// PasswordDialog.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#include "Windows/Control/DialogImpl.h"
-
-#include "CopyDialogRes.h"
-
-class CopyDialogImpl : public NWindows::NControl::CModalDialogImpl
-{
- public:
- CopyDialogImpl(NWindows::NControl::CModalDialog *dialog,wxWindow * parent,int id) : CModalDialogImpl(dialog, parent, id, wxT("Copy"))
- {
-
- wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
-
-
- topsizer->Add(new wxStaticText(this, IDC_COPY_STATIC, _T("")) , 0 ,wxALL | wxALIGN_LEFT, 5 );
-
-
- {
- wxBoxSizer *pathSizer = new wxBoxSizer(wxHORIZONTAL);
-
- wxArrayString pathArray;
- wxComboBox *combo = new wxComboBox(this, IDC_COPY_COMBO, wxEmptyString, wxDefaultPosition, wxSize(600,-1), pathArray, wxCB_DROPDOWN|wxCB_SORT);
- wxButton *button = new wxButton(this, IDC_COPY_SET_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
- pathSizer->Add(combo, 1, wxLEFT|wxRIGHT|wxEXPAND, 5);
- pathSizer->Add(button, 0, wxLEFT|wxRIGHT|wxEXPAND, 5);
-
- topsizer->Add(pathSizer, 0 ,wxALL | wxALIGN_LEFT, 5 );
- }
-
- topsizer->Add(new wxStaticText(this, IDC_COPY_INFO, _T("line1\nline2\nline3\nline4\n")) , 0 ,wxALL | wxALIGN_LEFT, 5 );
-
- topsizer->Add(CreateButtonSizer(wxOK|wxCANCEL), 0, wxALL|wxEXPAND, 5);
-
- this->OnInit();
-
- SetSizer(topsizer); // use the sizer for layout
- topsizer->SetSizeHints(this); // set size hints to honour minimum size
- }
-private:
- // Any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-static CStringTable g_stringTable[] =
-{
- { IDS_SET_FOLDER, L"Specify a location for output folder." },
- { 0 , 0 }
-};
-
-
-REGISTER_DIALOG(IDD_DIALOG_COPY,CopyDialog,g_stringTable)
-
-BEGIN_EVENT_TABLE(CopyDialogImpl, wxDialog)
- EVT_BUTTON(wxID_ANY, CModalDialogImpl::OnAnyButton)
- EVT_CHECKBOX(wxID_ANY, CModalDialogImpl::OnAnyButton)
-END_EVENT_TABLE()
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ExtractCallback.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ExtractCallback.cpp
deleted file mode 100644
index 9902e9a1d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ExtractCallback.cpp
+++ /dev/null
@@ -1,478 +0,0 @@
-// ExtractCallback.h
-
-#include "StdAfx.h"
-
-#include "Common/Wildcard.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/Error.h"
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-#include "Windows/ResourceString.h"
-
-#include "../../Common/FilePathAutoRename.h"
-
-#include "../GUI/ExtractRes.h"
-#include "../GUI/resource.h"
-
-#include "ExtractCallback.h"
-#include "FormatUtils.h"
-#include "MessagesDialog.h"
-#include "OverwriteDialog.h"
-#ifndef _NO_CRYPTO
-#include "PasswordDialog.h"
-#endif
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NFind;
-
-CExtractCallbackImp::~CExtractCallbackImp()
-{
- if (ShowMessages && !Messages.IsEmpty())
- {
- CMessagesDialog messagesDialog;
- messagesDialog.Messages = &Messages;
- messagesDialog.Create(ParentWindow);
- }
-}
-
-void CExtractCallbackImp::Init()
-{
- Messages.Clear();
- NumArchiveErrors = 0;
- #ifndef _SFX
- NumFolders = NumFiles = 0;
- NeedAddFile = false;
- #endif
-}
-
-void CExtractCallbackImp::AddErrorMessage(LPCWSTR message)
-{
- Messages.Add(message);
-}
-
-STDMETHODIMP CExtractCallbackImp::SetNumFiles(UInt64
- #ifndef _SFX
- numFiles
- #endif
- )
-{
- #ifndef _SFX
- ProgressDialog.ProgressSynch.SetNumFilesTotal(numFiles);
- #endif
- return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackImp::SetTotal(UInt64 total)
-{
- ProgressDialog.ProgressSynch.SetProgress(total, 0);
- return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackImp::SetCompleted(const UInt64 *value)
-{
- RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
- if (value != NULL)
- ProgressDialog.ProgressSynch.SetPos(*value);
- return S_OK;
-}
-
-HRESULT CExtractCallbackImp::Open_CheckBreak()
-{
- return ProgressDialog.ProgressSynch.ProcessStopAndPause();
-}
-
-HRESULT CExtractCallbackImp::Open_SetTotal(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
-{
- // if (numFiles != NULL) ProgressDialog.ProgressSynch.SetNumFilesTotal(*numFiles);
- return S_OK;
-}
-
-HRESULT CExtractCallbackImp::Open_SetCompleted(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
-{
- RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
- // if (numFiles != NULL) ProgressDialog.ProgressSynch.SetNumFilesCur(*numFiles);
- return S_OK;
-}
-
-#ifndef _NO_CRYPTO
-
-HRESULT CExtractCallbackImp::Open_CryptoGetTextPassword(BSTR *password)
-{
- return CryptoGetTextPassword(password);
-}
-
-HRESULT CExtractCallbackImp::Open_GetPasswordIfAny(UString &password)
-{
- if (PasswordIsDefined)
- password = Password;
- return S_OK;
-}
-
-bool CExtractCallbackImp::Open_WasPasswordAsked()
-{
- return PasswordWasAsked;
-}
-
-void CExtractCallbackImp::Open_ClearPasswordWasAskedFlag()
-{
- PasswordWasAsked = false;
-}
-
-#endif
-
-
-#ifndef _SFX
-STDMETHODIMP CExtractCallbackImp::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
- ProgressDialog.ProgressSynch.SetRatioInfo(inSize, outSize);
- return S_OK;
-}
-#endif
-
-/*
-STDMETHODIMP CExtractCallbackImp::SetTotalFiles(UInt64 total)
-{
- ProgressDialog.ProgressSynch.SetNumFilesTotal(total);
- return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackImp::SetCompletedFiles(const UInt64 *value)
-{
- if (value != NULL)
- ProgressDialog.ProgressSynch.SetNumFilesCur(*value);
- return S_OK;
-}
-*/
-
-STDMETHODIMP CExtractCallbackImp::AskOverwrite(
- const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
- const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
- Int32 *answer)
-{
- COverwriteDialog dialog;
-
- dialog.OldFileInfo.Time = *existTime;
- dialog.OldFileInfo.SizeIsDefined = (existSize != NULL);
- if (dialog.OldFileInfo.SizeIsDefined)
- dialog.OldFileInfo.Size = *existSize;
- dialog.OldFileInfo.Name = existName;
-
- if (newTime == 0)
- dialog.NewFileInfo.TimeIsDefined = false;
- else
- {
- dialog.NewFileInfo.TimeIsDefined = true;
- dialog.NewFileInfo.Time = *newTime;
- }
-
- dialog.NewFileInfo.SizeIsDefined = (newSize != NULL);
- if (dialog.NewFileInfo.SizeIsDefined)
- dialog.NewFileInfo.Size = *newSize;
- dialog.NewFileInfo.Name = newName;
-
- /*
- NOverwriteDialog::NResult::EEnum writeAnswer =
- NOverwriteDialog::Execute(oldFileInfo, newFileInfo);
- */
- INT_PTR writeAnswer = dialog.Create(ProgressDialog); // ParentWindow doesn't work with 7z
-
- switch(writeAnswer)
- {
- case IDCANCEL: *answer = NOverwriteAnswer::kCancel; return E_ABORT;
- case IDYES: *answer = NOverwriteAnswer::kYes; break;
- case IDNO: *answer = NOverwriteAnswer::kNo; break;
- case IDC_BUTTON_OVERWRITE_YES_TO_ALL: *answer = NOverwriteAnswer::kYesToAll; break;
- case IDC_BUTTON_OVERWRITE_NO_TO_ALL: *answer = NOverwriteAnswer::kNoToAll; break;
- case IDC_BUTTON_OVERWRITE_AUTO_RENAME: *answer = NOverwriteAnswer::kAutoRename; break;
- default: return E_FAIL;
- }
- return S_OK;
-}
-
-
-STDMETHODIMP CExtractCallbackImp::PrepareOperation(const wchar_t *name, bool isFolder, Int32 /* askExtractMode */, const UInt64 * /* position */)
-{
- _isFolder = isFolder;
- return SetCurrentFilePath2(name);
-}
-
-STDMETHODIMP CExtractCallbackImp::MessageError(const wchar_t *message)
-{
- AddErrorMessage(message);
- return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackImp::ShowMessage(const wchar_t *message)
-{
- AddErrorMessage(message);
- return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 operationResult, bool encrypted)
-{
- switch(operationResult)
- {
- case NArchive::NExtract::NOperationResult::kOK:
- break;
- default:
- {
- UINT messageID;
- UInt32 langID;
- switch(operationResult)
- {
- case NArchive::NExtract::NOperationResult::kUnSupportedMethod:
- messageID = IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_UNSUPPORTED_METHOD;
- langID = 0x02000A91;
- break;
- case NArchive::NExtract::NOperationResult::kDataError:
- messageID = encrypted ?
- IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED:
- IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR;
- langID = encrypted ? 0x02000A94 : 0x02000A92;
- break;
- case NArchive::NExtract::NOperationResult::kCRCError:
- messageID = encrypted ?
- IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC_ENCRYPTED:
- IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC;
- langID = encrypted ? 0x02000A95 : 0x02000A93;
- break;
- default:
- return E_FAIL;
- }
- if (_needWriteArchivePath)
- {
- AddErrorMessage(_currentArchivePath);
- _needWriteArchivePath = false;
- }
- AddErrorMessage(
- MyFormatNew(messageID,
- #ifdef LANG
- langID,
- #endif
- _currentFilePath));
- }
- }
- #ifndef _SFX
- if (_isFolder)
- NumFolders++;
- else
- NumFiles++;
- ProgressDialog.ProgressSynch.SetNumFilesCur(NumFiles);
- #endif
- return S_OK;
-}
-
-////////////////////////////////////////
-// IExtractCallbackUI
-
-HRESULT CExtractCallbackImp::BeforeOpen(const wchar_t *name)
-{
- #ifndef _SFX
- ProgressDialog.ProgressSynch.SetTitleFileName(name);
- #endif
- _currentArchivePath = name;
- return S_OK;
-}
-
-HRESULT CExtractCallbackImp::SetCurrentFilePath2(const wchar_t *path)
-{
- _currentFilePath = path;
- #ifndef _SFX
- ProgressDialog.ProgressSynch.SetCurrentFileName(path);
- #endif
- return S_OK;
-}
-
-HRESULT CExtractCallbackImp::SetCurrentFilePath(const wchar_t *path)
-{
- #ifndef _SFX
- if (NeedAddFile)
- NumFiles++;
- NeedAddFile = true;
- ProgressDialog.ProgressSynch.SetNumFilesCur(NumFiles);
- #endif
- return SetCurrentFilePath2(path);
-}
-
-HRESULT CExtractCallbackImp::OpenResult(const wchar_t *name, HRESULT result, bool encrypted)
-{
- if (result != S_OK)
- {
- UString message;
- if (result == S_FALSE)
- {
- message = MyFormatNew(encrypted ? IDS_CANT_OPEN_ENCRYPTED_ARCHIVE : IDS_CANT_OPEN_ARCHIVE,
- #ifdef LANG
- (encrypted ? 0x0200060A : 0x02000609),
- #endif
- name);
- }
- else
- {
- message = name;
- message += L": ";
- UString message2;
- if (result == E_OUTOFMEMORY)
- message2 =
- #ifdef LANG
- LangString(IDS_MEM_ERROR, 0x0200060B);
- #else
- MyLoadStringW(IDS_MEM_ERROR);
- #endif
- else
- NError::MyFormatMessage(result, message2);
- message += message2;
- }
- MessageError(message);
- NumArchiveErrors++;
- }
- _currentArchivePath = name;
- _needWriteArchivePath = true;
- return S_OK;
-}
-
-HRESULT CExtractCallbackImp::ThereAreNoFiles()
-{
- return S_OK;
-}
-
-HRESULT CExtractCallbackImp::ExtractResult(HRESULT result)
-{
- if (result == S_OK)
- return result;
- NumArchiveErrors++;
- if (result == E_ABORT || result == ERROR_DISK_FULL)
- return result;
- MessageError(_currentFilePath);
- MessageError(NError::MyFormatMessageW(result));
- return S_OK;
-}
-
-#ifndef _NO_CRYPTO
-
-HRESULT CExtractCallbackImp::SetPassword(const UString &password)
-{
- PasswordIsDefined = true;
- Password = password;
- return S_OK;
-}
-
-STDMETHODIMP CExtractCallbackImp::CryptoGetTextPassword(BSTR *password)
-{
- PasswordWasAsked = true;
- if (!PasswordIsDefined)
- {
- CPasswordDialog dialog;
- if (dialog.Create(ProgressDialog) == IDCANCEL)
- return E_ABORT;
- Password = dialog.Password;
- PasswordIsDefined = true;
- }
- return StringToBstr(Password, password);
-}
-
-#endif
-
-// IExtractCallBack3
-STDMETHODIMP CExtractCallbackImp::AskWrite(
- const wchar_t *srcPath, Int32 srcIsFolder,
- const FILETIME *srcTime, const UInt64 *srcSize,
- const wchar_t *destPath,
- BSTR *destPathResult,
- Int32 *writeAnswer)
-{
- UString destPathResultTemp = destPath;
-
- // RINOK(StringToBstr(destPath, destPathResult));
-
- *destPathResult = 0;
- *writeAnswer = BoolToInt(false);
-
- UString destPathSpec = destPath;
- UString destPathSys = destPathSpec;
- bool srcIsFolderSpec = IntToBool(srcIsFolder);
- CFileInfoW destFileInfo;
- if (destFileInfo.Find(destPathSys))
- {
- if (srcIsFolderSpec)
- {
- if (!destFileInfo.IsDir())
- {
- UString message = UString(L"can not replace file \'")
- + destPathSpec +
- UString(L"\' with folder with same name");
- RINOK(MessageError(message));
- return E_ABORT;
- }
- *writeAnswer = BoolToInt(false);
- return S_OK;
- }
- if (destFileInfo.IsDir())
- {
- UString message = UString(L"can not replace folder \'")
- + destPathSpec +
- UString(L"\' with file with same name");
- RINOK(MessageError(message));
- return E_FAIL;
- }
-
- switch(OverwriteMode)
- {
- case NExtract::NOverwriteMode::kSkipExisting:
- return S_OK;
- case NExtract::NOverwriteMode::kAskBefore:
- {
- Int32 overwiteResult;
- RINOK(AskOverwrite(
- destPathSpec,
- &destFileInfo.MTime, &destFileInfo.Size,
- srcPath,
- srcTime, srcSize,
- &overwiteResult));
- switch(overwiteResult)
- {
- case NOverwriteAnswer::kCancel:
- return E_ABORT;
- case NOverwriteAnswer::kNo:
- return S_OK;
- case NOverwriteAnswer::kNoToAll:
- OverwriteMode = NExtract::NOverwriteMode::kSkipExisting;
- return S_OK;
- case NOverwriteAnswer::kYesToAll:
- OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt;
- break;
- case NOverwriteAnswer::kYes:
- break;
- case NOverwriteAnswer::kAutoRename:
- OverwriteMode = NExtract::NOverwriteMode::kAutoRename;
- break;
- default:
- return E_FAIL;
- }
- }
- }
- if (OverwriteMode == NExtract::NOverwriteMode::kAutoRename)
- {
- if (!AutoRenamePath(destPathSys))
- {
- UString message = UString(L"can not create name of file ")
- + destPathSys;
- RINOK(MessageError(message));
- return E_ABORT;
- }
- destPathResultTemp = destPathSys;
- }
- else
- if (!NFile::NDirectory::DeleteFileAlways(destPathSys))
- {
- UString message = UString(L"can not delete output file ")
- + destPathSys;
- RINOK(MessageError(message));
- return E_ABORT;
- }
- }
- *writeAnswer = BoolToInt(true);
- return StringToBstr(destPathResultTemp, destPathResult);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ExtractCallback.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ExtractCallback.h
deleted file mode 100644
index ee46222a2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ExtractCallback.h
+++ /dev/null
@@ -1,150 +0,0 @@
-// ExtractCallback.h
-
-#ifndef __EXTRACTCALLBACK_H
-#define __EXTRACTCALLBACK_H
-
-#include "../Agent/IFolderArchive.h"
-#include "Common/MyString.h"
-#include "../Common/ArchiveOpenCallback.h"
-
-#ifdef _SFX
-#include "ProgressDialog.h"
-#else
-#include "ProgressDialog2.h"
-#endif
-
-#include "Windows/ResourceString.h"
-
-#ifdef LANG
-#include "LangUtils.h"
-#endif
-
-#ifndef _NO_CRYPTO
-#include "../../IPassword.h"
-#endif
-#include "Common/MyCom.h"
-#include "IFolder.h"
-
-class CExtractCallbackImp:
- public IExtractCallbackUI,
- public IOpenCallbackUI,
- public IFolderOperationsExtractCallback,
- // public IFolderArchiveExtractCallback, // mkultiple from IProgress
- #ifndef _SFX
- public ICompressProgressInfo,
- #endif
- #ifndef _NO_CRYPTO
- public ICryptoGetTextPassword,
- #endif
- public CMyUnknownImp
-{
-public:
- MY_QUERYINTERFACE_BEGIN2(IFolderOperationsExtractCallback)
- MY_QUERYINTERFACE_ENTRY(IFolderArchiveExtractCallback)
- #ifndef _SFX
- MY_QUERYINTERFACE_ENTRY(ICompressProgressInfo)
- #endif
- #ifndef _NO_CRYPTO
- MY_QUERYINTERFACE_ENTRY(ICryptoGetTextPassword)
- #endif
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
- #ifndef _SFX
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
- #endif
-
- INTERFACE_IProgress(;)
- INTERFACE_IOpenCallbackUI(;)
-
- // IFolderArchiveExtractCallback
- // STDMETHOD(SetTotalFiles)(UInt64 total);
- // STDMETHOD(SetCompletedFiles)(const UInt64 *value);
- STDMETHOD(AskOverwrite)(
- const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
- const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
- Int32 *answer);
- STDMETHOD (PrepareOperation)(const wchar_t *name, bool isFolder, Int32 askExtractMode, const UInt64 *position);
-
- STDMETHOD(MessageError)(const wchar_t *message);
- STDMETHOD(SetOperationResult)(Int32 operationResult, bool encrypted);
-
- // IExtractCallbackUI
-
- HRESULT BeforeOpen(const wchar_t *name);
- HRESULT OpenResult(const wchar_t *name, HRESULT result, bool encrypted);
- HRESULT ThereAreNoFiles();
- HRESULT ExtractResult(HRESULT result);
-
- #ifndef _NO_CRYPTO
- HRESULT SetPassword(const UString &password);
- #endif
-
- // IFolderOperationsExtractCallback
- STDMETHOD(AskWrite)(
- const wchar_t *srcPath,
- Int32 srcIsFolder,
- const FILETIME *srcTime,
- const UInt64 *srcSize,
- const wchar_t *destPathRequest,
- BSTR *destPathResult,
- Int32 *writeAnswer);
- STDMETHOD(ShowMessage)(const wchar_t *message);
- STDMETHOD(SetCurrentFilePath)(const wchar_t *filePath);
- STDMETHOD(SetNumFiles)(UInt64 numFiles);
-
- // ICryptoGetTextPassword
- #ifndef _NO_CRYPTO
- STDMETHOD(CryptoGetTextPassword)(BSTR *password);
- #endif
-
-private:
- // bool _extractMode;
- UString _currentArchivePath;
- bool _needWriteArchivePath;
-
- UString _currentFilePath;
- bool _isFolder;
-
- // void CreateComplexDirectory(const UStringVector &aDirPathParts);
-
- HRESULT SetCurrentFilePath2(const wchar_t *filePath);
- void AddErrorMessage(LPCWSTR message);
-public:
- CProgressDialog ProgressDialog;
- UStringVector Messages;
- bool ShowMessages;
- #ifndef _SFX
- UInt64 NumFolders;
- UInt64 NumFiles;
- bool NeedAddFile;
- #endif
- HWND ParentWindow;
- INT_PTR StartProgressDialog(const UString &title)
- {
- return ProgressDialog.Create(title, ParentWindow);
- }
- UInt32 NumArchiveErrors;
- NExtract::NOverwriteMode::EEnum OverwriteMode;
-
- #ifndef _NO_CRYPTO
- bool PasswordIsDefined;
- bool PasswordWasAsked;
- UString Password;
- #endif
-
- CExtractCallbackImp():
- #ifndef _NO_CRYPTO
- PasswordIsDefined(false),
- PasswordWasAsked(false),
- #endif
- OverwriteMode(NExtract::NOverwriteMode::kAskBefore),
- ParentWindow(0),
- ShowMessages(true)
- {}
-
- ~CExtractCallbackImp();
- void Init();
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FM.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FM.cpp
deleted file mode 100644
index 6c81d4b60..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FM.cpp
+++ /dev/null
@@ -1,914 +0,0 @@
-// FM.cpp
-
-#include "StdAfx.h"
-
-#include "resource.h"
-#include "Panel.h"
-
-extern "C"
-{
- #include "../../../../C/Alloc.h"
-}
-
-#include "Common/Defs.h"
-#include "Common/StringConvert.h"
-// #include "Common/CommandLineParser.h"
-
-// FIXME #include "Windows/Control/Toolbar.h"
-#include "Windows/Error.h"
-#include "Windows/COM.h"
-#include "Windows/DLL.h"
-// FIXME #include "Windows/Security.h"
-// FIXME #include "Windows/MemoryLock.h"
-
-#include "ViewSettings.h"
-#include "../GUI/ExtractRes.h"
-
-#include "App.h"
-#include "StringUtils.h"
-
-#include "MyLoadMenu.h"
-#include "LangUtils.h"
-#include "FormatUtils.h"
-#include "RegistryUtils.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NFind;
-// using namespace NCommandLineParser;
-
-#define MAX_LOADSTRING 100
-
-#define MENU_HEIGHT 26
-
-#ifndef _UNICODE
-bool g_IsNT = false;
-#endif
-HINSTANCE g_hInstance;
-HWND g_HWND;
-bool g_OpenArchive = false;
-static UString g_MainPath;
-
-const int kNumDefaultPanels = 1;
-
-const int kSplitterWidth = 4;
-int kSplitterRateMax = 1 << 16;
-
-// bool OnMenuCommand(HWND hWnd, int id);
-
-static void local_WM_CREATE(HWND hWnd);
-
-#ifdef _WIN32
-static UString GetProgramPath()
-{
- UString s;
- NDLL::MyGetModuleFileName(g_hInstance, s);
- return s;
-}
-
-UString GetProgramFolderPrefix()
-{
- UString path = GetProgramPath();
- int pos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
- return path.Left(pos + 1);
-}
-
-
-class CSplitterPos
-{
- int _ratio; // 10000 is max
- int _pos;
- int _fullWidth;
- void SetRatioFromPos(HWND hWnd)
- { _ratio = (_pos + kSplitterWidth / 2) * kSplitterRateMax /
- MyMax(GetWidth(hWnd), 1); }
-public:
- int GetPos() const
- { return _pos; }
- int GetWidth(HWND hWnd) const
- {
- RECT rect;
- ::GetClientRect(hWnd, &rect);
- return rect.right;
- }
- void SetRatio(HWND hWnd, int aRatio)
- {
- _ratio = aRatio;
- SetPosFromRatio(hWnd);
- }
- void SetPosPure(HWND hWnd, int pos)
- {
- int posMax = GetWidth(hWnd) - kSplitterWidth;
- if (pos > posMax)
- pos = posMax;
- if (pos < 0)
- pos = 0;
- _pos = pos;
- }
- void SetPos(HWND hWnd, int pos)
- {
- _fullWidth = GetWidth(hWnd);
- SetPosPure(hWnd, pos);
- SetRatioFromPos(hWnd);
- }
- void SetPosFromRatio(HWND hWnd)
- {
- int fullWidth = GetWidth(hWnd);
- if (_fullWidth != fullWidth)
- {
- _fullWidth = fullWidth;
- SetPosPure(hWnd, GetWidth(hWnd) * _ratio / kSplitterRateMax - kSplitterWidth / 2);
- }
- }
-};
-#endif
-
-bool g_CanChangeSplitter = false;
-UINT32 g_SplitterPos = 0;
-// FIXME CSplitterPos g_Splitter;
-bool g_PanelsInfoDefined = false;
-
-int g_StartCaptureMousePos;
-int g_StartCaptureSplitterPos;
-
-CApp g_App;
-
-void MoveSubWindows(HWND hWnd);
-void OnSize(HWND hWnd);
-
-// FIXME LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
-
-const wchar_t *kWindowClass = L"FM";
-
-#ifndef _UNICODE
-static bool IsItWindowsNT()
-{
- OSVERSIONINFO versionInfo;
- versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
- return false;
- return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-#endif
-
-// FUNCTION: InitInstance(HANDLE, int)
-BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
-{
- CWindow wnd;
-
- g_hInstance = hInstance;
-
- ReloadLangSmart();
-
- // LoadString(hInstance, IDS_CLASS, windowClass, MAX_LOADSTRING);
-
- // LoadString(hInstance, IDS_APP_TITLE, title, MAX_LOADSTRING);
- UString title = LangString(IDS_APP_TITLE, 0x03000000);
-
- /*
- //If it is already running, then focus on the window
- hWnd = FindWindow(windowClass, title);
- if (hWnd)
- {
- SetForegroundWindow ((HWND) (((DWORD)hWnd) | 0x01));
- return 0;
- }
- */
-
-#ifdef _WIN32
- WNDCLASSW wc;
-
- // wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.style = 0;
- wc.lpfnWndProc = (WNDPROC) WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_FAM));
-
- // wc.hCursor = LoadCursor (NULL, IDC_ARROW);
- wc.hCursor = ::LoadCursor(0, IDC_SIZEWE);
- // wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
- wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
-
- wc.lpszMenuName = MAKEINTRESOURCEW(IDM_MENU);
- wc.lpszClassName = kWindowClass;
-
- MyRegisterClass(&wc);
-
- // RECT rect;
- // GetClientRect(hWnd, &rect);
-
- DWORD style = WS_OVERLAPPEDWINDOW;
- // DWORD style = 0;
-
- RECT rect;
- bool maximized = false;
- int x , y, xSize, ySize;
- x = y = xSize = ySize = CW_USEDEFAULT;
- bool windowPosIsRead = ReadWindowSize(rect, maximized);
-
- if (windowPosIsRead)
- {
- // x = rect.left;
- // y = rect.top;
- xSize = rect.right - rect.left;
- ySize = rect.bottom - rect.top;
- }
-#endif
-
- UINT32 numPanels, currentPanel;
- g_PanelsInfoDefined = ReadPanelsInfo(numPanels, currentPanel, g_SplitterPos);
- if (g_PanelsInfoDefined)
- {
- if (numPanels < 1 || numPanels > 2)
- numPanels = kNumDefaultPanels;
- if (currentPanel >= 2)
- currentPanel = 0;
- }
- else
- {
- numPanels = kNumDefaultPanels;
- currentPanel = 0;
- }
- g_App.NumPanels = numPanels;
- g_App.LastFocusedPanel = currentPanel;
-
-#ifdef _WIN32 // FIXME
- if (!wnd.Create(kWindowClass, title, style,
- x, y, xSize, ySize, NULL, NULL, hInstance, NULL))
- return FALSE;
- g_HWND = (HWND)wnd;
-#else
- {
- extern HWND myCreateAndShowMainWindow(LPCTSTR title,void (*fct)(HWND));
- g_HWND = myCreateAndShowMainWindow(title,local_WM_CREATE);
- }
-#endif
-
-#ifdef _WIN32
- WINDOWPLACEMENT placement;
- placement.length = sizeof(placement);
- if (wnd.GetPlacement(&placement))
- {
- if (nCmdShow == SW_SHOWNORMAL || nCmdShow == SW_SHOW ||
- nCmdShow == SW_SHOWDEFAULT)
- {
- if (maximized)
- placement.showCmd = SW_SHOWMAXIMIZED;
- else
- placement.showCmd = SW_SHOWNORMAL;
- }
- else
- placement.showCmd = nCmdShow;
- if (windowPosIsRead)
- placement.rcNormalPosition = rect;
- wnd.SetPlacement(&placement);
- // window.Show(nCmdShow);
- }
- else
- wnd.Show(nCmdShow);
-#endif
- return TRUE;
-}
-
-/*
-static void GetCommands(const UString &aCommandLine, UString &aCommands)
-{
- UString aProgramName;
- aCommands.Empty();
- bool aQuoteMode = false;
- for (int i = 0; i < aCommandLine.Length(); i++)
- {
- wchar_t aChar = aCommandLine[i];
- if (aChar == L'\"')
- aQuoteMode = !aQuoteMode;
- else if (aChar == L' ' && !aQuoteMode)
- {
- if (!aQuoteMode)
- {
- i++;
- break;
- }
- }
- else
- aProgramName += aChar;
- }
- aCommands = aCommandLine.Mid(i);
-}
-*/
-
-#ifdef _WIN32
-DWORD GetDllVersion(LPCTSTR lpszDllName)
-{
- HINSTANCE hinstDll;
- DWORD dwVersion = 0;
- hinstDll = LoadLibrary(lpszDllName);
- if(hinstDll)
- {
- DLLGETVERSIONPROC pDllGetVersion;
- pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hinstDll, "DllGetVersion");
-
- /*Because some DLLs might not implement this function, you
- must test for it explicitly. Depending on the particular
- DLL, the lack of a DllGetVersion function can be a useful
- indicator of the version.
- */
- if(pDllGetVersion)
- {
- DLLVERSIONINFO dvi;
- HRESULT hr;
-
- ZeroMemory(&dvi, sizeof(dvi));
- dvi.cbSize = sizeof(dvi);
-
- hr = (*pDllGetVersion)(&dvi);
-
- if(SUCCEEDED(hr))
- {
- dwVersion = MAKELONG(dvi.dwMinorVersion, dvi.dwMajorVersion);
- }
- }
- FreeLibrary(hinstDll);
- }
- return dwVersion;
-}
-
-DWORD g_ComCtl32Version;
-#endif
-
-/*
-#ifndef _WIN64
-typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
-
-static bool IsWow64()
-{
- LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(
- GetModuleHandle("kernel32"), "IsWow64Process");
- if (fnIsWow64Process == NULL)
- return false;
- BOOL isWow;
- if (!fnIsWow64Process(GetCurrentProcess(),&isWow))
- return false;
- return isWow != FALSE;
-}
-#endif
-*/
-
-#ifdef _WIN32
-bool IsLargePageSupported()
-{
- #ifdef _WIN64
- return true;
- #else
- OSVERSIONINFO versionInfo;
- versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
- return false;
- if (versionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || versionInfo.dwMajorVersion < 5)
- return false;
- if (versionInfo.dwMajorVersion > 5)
- return true;
- if (versionInfo.dwMinorVersion < 1)
- return false;
- if (versionInfo.dwMinorVersion > 1)
- return true;
- // return IsWow64();
- return false;
- #endif
-}
-
-static void SetMemoryLock()
-{
- if (!IsLargePageSupported())
- return;
- // if (ReadLockMemoryAdd())
- NSecurity::AddLockMemoryPrivilege();
-
- if (ReadLockMemoryEnable())
- NSecurity::EnableLockMemoryPrivilege();
-}
-#endif
-
-/*
-static const int kNumSwitches = 1;
-
-namespace NKey {
-enum Enum
-{
- kOpenArachive = 0,
-};
-
-}
-
-static const CSwitchForm kSwitchForms[kNumSwitches] =
- {
- { L"SOA", NSwitchType::kSimple, false },
- };
-*/
-
-// int APIENTRY WinMain2(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /* lpCmdLine */, int /* nCmdShow */);
-
-#ifdef _WIN32
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /* lpCmdLine */, int nCmdShow)
-{
- #ifndef _UNICODE
- g_IsNT = IsItWindowsNT();
- #endif
-
- #ifdef _WIN32
- SetLargePageSize();
- #endif
-
- InitCommonControls();
-
- g_ComCtl32Version = ::GetDllVersion(TEXT("comctl32.dll"));
-
- // OleInitialize is required for drag and drop.
- OleInitialize(NULL);
- // Maybe needs CoInitializeEx also ?
- // NCOM::CComInitializer comInitializer;
-
- UString programString, commandsString;
- // MessageBoxW(0, GetCommandLineW(), L"", 0);
- SplitStringToTwoStrings(GetCommandLineW(), programString, commandsString);
-
- commandsString.Trim();
- UString paramString, tailString;
- SplitStringToTwoStrings(commandsString, paramString, tailString);
- paramString.Trim();
-
- if (!paramString.IsEmpty())
- {
- g_MainPath = paramString;
- // return WinMain2(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
-
- // MessageBoxW(0, paramString, L"", 0);
- }
- /*
- UStringVector commandStrings;
- NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
- NCommandLineParser::CParser parser(kNumSwitches);
- try
- {
- parser.ParseStrings(kSwitchForms, commandStrings);
- const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
- if(nonSwitchStrings.Size() > 1)
- {
- g_MainPath = nonSwitchStrings[1];
- // g_OpenArchive = parser[NKey::kOpenArachive].ThereIs;
- CFileInfoW fileInfo;
- if (FindFile(g_MainPath, fileInfo))
- {
- if (!fileInfo.IsDir())
- g_OpenArchive = true;
- }
- }
- }
- catch(...) { }
- */
-
-
- SetMemoryLock();
-
- MSG msg;
- if (!InitInstance (hInstance, nCmdShow))
- return FALSE;
-
- MyLoadMenu(g_HWND);
-
- #ifndef _UNICODE
- if (g_IsNT)
- {
- HACCEL hAccels = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(IDR_ACCELERATOR1));
- while (GetMessageW(&msg, NULL, 0, 0))
- {
- if (TranslateAcceleratorW(g_HWND, hAccels, &msg) == 0)
- {
- TranslateMessage(&msg);
- DispatchMessageW(&msg);
- }
- }
- }
- else
- #endif
- {
- HACCEL hAccels = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR1));
- while (GetMessage(&msg, NULL, 0, 0))
- {
- if (TranslateAccelerator(g_HWND, hAccels, &msg) == 0)
- {
- // if (g_Hwnd != NULL || !IsDialogMessage(g_Hwnd, &msg))
- // if (!IsDialogMessage(g_Hwnd, &msg))
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
- }
-
- g_HWND = 0;
- OleUninitialize();
- return (int)msg.wParam;
-}
-
-static void SaveWindowInfo(HWND aWnd)
-{
- /*
- RECT rect;
- if (!::GetWindowRect(aWnd, &rect))
- return;
- */
- WINDOWPLACEMENT placement;
- placement.length = sizeof(placement);
- if (!::GetWindowPlacement(aWnd, &placement))
- return;
- SaveWindowSize(placement.rcNormalPosition,
- BOOLToBool(::IsZoomed(aWnd)));
- SavePanelsInfo(g_App.NumPanels, g_App.LastFocusedPanel,
- g_Splitter.GetPos());
-}
-#else
-int Main1(int argc,TCHAR **argv)
-{
- if (argc >= 2)
- {
- g_MainPath = argv[1];
- }
-
- if (!InitInstance (0, 0))
- return FALSE;
-
- MyLoadMenu(g_HWND);
-
- // FIXME : install Accelerators ?
-
- return 0;
-}
-
-#endif
-
-void ExecuteCommand(UINT commandID)
-{
- printf("FM - ExecuteCommand(%d)\n",commandID);
- switch (commandID)
- {
- case kAddCommand:
- g_App.AddToArchive();
- break;
- case kExtractCommand:
- g_App.ExtractArchives();
- break;
- case kTestCommand:
- g_App.TestArchives();
- break;
- }
-}
-
-#ifdef _WIN32
-LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- int wmId, wmEvent;
- switch (message)
- {
- case WM_COMMAND:
- wmId = LOWORD(wParam);
- wmEvent = HIWORD(wParam);
- if ((HWND) lParam != NULL && wmEvent != 0)
- break;
- if (wmId >= kToolbarStartID)
- {
- ExecuteCommand(wmId);
- return 0;
- }
- if (OnMenuCommand(hWnd, wmId))
- return 0;
- break;
- case WM_INITMENUPOPUP:
- OnMenuActivating(hWnd, HMENU(wParam), LOWORD(lParam));
- break;
-
- /*
- It doesn't help
- case WM_EXITMENULOOP:
- {
- OnMenuUnActivating(hWnd);
- break;
- }
- case WM_UNINITMENUPOPUP:
- OnMenuUnActivating(hWnd, HMENU(wParam), lParam);
- break;
- */
-
- case WM_CREATE:
- {
-
- /*
- INITCOMMONCONTROLSEX icex;
- icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
- icex.dwICC = ICC_BAR_CLASSES;
- InitCommonControlsEx(&icex);
-
- // Toolbar buttons used to create the first 4 buttons.
- TBBUTTON tbb [ ] =
- {
- // {0, 0, TBSTATE_ENABLED, BTNS_SEP, 0L, 0},
- // {VIEW_PARENTFOLDER, kParentFolderID, TBSTATE_ENABLED, BTNS_BUTTON, 0L, 0},
- // {0, 0, TBSTATE_ENABLED, BTNS_SEP, 0L, 0},
- {VIEW_NEWFOLDER, ID_FILE_CREATEFOLDER, TBSTATE_ENABLED, BTNS_BUTTON, 0L, 0},
- };
-
- int baseID = 100;
- NWindows::NControl::CToolBar aToolBar;
- aToolBar.Attach(::CreateToolbarEx (hWnd,
- WS_CHILD | WS_BORDER | WS_VISIBLE | TBSTYLE_TOOLTIPS, // | TBSTYLE_FLAT
- baseID + 2, 11,
- (HINSTANCE)HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR,
- (LPCTBBUTTON)&tbb, sizeof(tbb) / sizeof(tbb[0]),
- 0, 0, 100, 30, sizeof (TBBUTTON)));
- */
- // HCURSOR cursor = ::LoadCursor(0, IDC_SIZEWE);
- // ::SetCursor(cursor);
-
- if (g_PanelsInfoDefined)
- g_Splitter.SetPos(hWnd, g_SplitterPos);
- else
- {
- g_Splitter.SetRatio(hWnd, kSplitterRateMax / 2);
- g_SplitterPos = g_Splitter.GetPos();
- }
-
- RECT rect;
- ::GetClientRect(hWnd, &rect);
- int xSize = rect.right;
- int xSizes[2];
- xSizes[0] = g_Splitter.GetPos();
- xSizes[1] = xSize - kSplitterWidth - xSizes[0];
- if (xSizes[1] < 0)
- xSizes[1] = 0;
-
- g_App.CreateDragTarget();
- bool archiveIsOpened;
- bool encrypted;
- bool needOpenFile = false;
- if (!g_MainPath.IsEmpty() /* && g_OpenArchive */)
- {
- NFile::NFind::CFileInfoW fileInfo;
- if (NFile::NFind::FindFile(g_MainPath, fileInfo))
- if (!fileInfo.IsDir())
- needOpenFile = true;
- }
- g_App.Create(hWnd, g_MainPath, xSizes, archiveIsOpened, encrypted);
-
- if (needOpenFile && !archiveIsOpened)
- {
- UString message;
- if (encrypted)
- message = MyFormatNew(IDS_CANT_OPEN_ENCRYPTED_ARCHIVE, 0x0200060A, g_MainPath);
- else
- message = MyFormatNew(IDS_CANT_OPEN_ARCHIVE, 0x02000609, g_MainPath);
- MessageBoxW(0, message, L"7-zip", MB_ICONERROR);
- return -1;
- }
- // g_SplitterPos = 0;
-
- // ::DragAcceptFiles(hWnd, TRUE);
- RegisterDragDrop(hWnd, g_App._dropTarget);
-
- break;
- }
- case WM_DESTROY:
- {
- // ::DragAcceptFiles(hWnd, FALSE);
- RevokeDragDrop(hWnd);
- g_App._dropTarget.Release();
-
- g_App.Save();
- g_App.Release();
- SaveWindowInfo(hWnd);
- PostQuitMessage(0);
- break;
- }
- /*
- case WM_MOVE:
- {
- break;
- }
- */
- case WM_LBUTTONDOWN:
- g_StartCaptureMousePos = LOWORD(lParam);
- g_StartCaptureSplitterPos = g_Splitter.GetPos();
- ::SetCapture(hWnd);
- break;
- case WM_LBUTTONUP:
- {
- ::ReleaseCapture();
- break;
- }
- case WM_MOUSEMOVE:
- {
- if ((wParam & MK_LBUTTON) != 0 && ::GetCapture() == hWnd)
- {
- g_Splitter.SetPos(hWnd, g_StartCaptureSplitterPos +
- (short)LOWORD(lParam) - g_StartCaptureMousePos);
- MoveSubWindows(hWnd);
- }
- break;
- }
-
- case WM_SIZE:
- {
- if (g_CanChangeSplitter)
- g_Splitter.SetPosFromRatio(hWnd);
- else
- {
- g_Splitter.SetPos(hWnd, g_SplitterPos );
- g_CanChangeSplitter = true;
- }
-
- OnSize(hWnd);
- /*
- int xSize = LOWORD(lParam);
- int ySize = HIWORD(lParam);
- // int xSplitter = 2;
- int xWidth = g_SplitPos;
- // int xSplitPos = xWidth;
- g_Panel[0]._listView.MoveWindow(0, 0, xWidth, ySize);
- g_Panel[1]._listView.MoveWindow(xSize - xWidth, 0, xWidth, ySize);
- */
- return 0;
- break;
- }
- case WM_SETFOCUS:
- // g_App.SetFocus(g_App.LastFocusedPanel);
- g_App.SetFocusToLastItem();
- break;
- /*
- case WM_ACTIVATE:
- {
- int fActive = LOWORD(wParam);
- switch (fActive)
- {
- case WA_INACTIVE:
- {
- // g_FocusIndex = g_App.LastFocusedPanel;
- // g_App.LastFocusedPanel = g_App.GetFocusedPanelIndex();
- // return 0;
- }
- }
- break;
- }
- */
- /*
- case kLangWasChangedMessage:
- MyLoadMenu(g_HWND);
- return 0;
- */
-
- /*
- case WM_SETTINGCHANGE:
- break;
- */
- case WM_NOTIFY:
- {
- g_App.OnNotify((int)wParam, (LPNMHDR)lParam);
- break;
- }
- /*
- case WM_DROPFILES:
- {
- g_App.GetFocusedPanel().CompressDropFiles((HDROP)wParam);
- return 0 ;
- }
- */
- }
- #ifndef _UNICODE
- if (g_IsNT)
- return DefWindowProcW(hWnd, message, wParam, lParam);
- else
- #endif
- return DefWindowProc(hWnd, message, wParam, lParam);
-
-}
-
-void OnSize(HWND hWnd)
-{
- /*
- if (g_App._rebar)
- {
- RECT rect;
- ::GetClientRect(hWnd, &rect);
- int xSize = rect.right;
- int ySize = rect.bottom;
- // rect.bottom = 0;
- // g_App._rebar.SizeToRect(&rect);
- // g_App._rebar.Move(0, 0, xSize, ySize);
- }
- */
- MoveSubWindows(hWnd);
-}
-
-int Window_GetRealHeight(NWindows::CWindow &w)
-{
- RECT rect;
- WINDOWPLACEMENT placement;
- w.GetWindowRect(&rect);
- int res = rect.bottom - rect.top;
- if (w.GetPlacement(&placement))
- res += placement.rcNormalPosition.top;
- return res;
-}
-#else // _WIN32
-static void local_WM_CREATE(HWND hWnd)
- {
- printf("**local_WM_CREATE**\n");
-#if 0
- if (g_PanelsInfoDefined)
- g_Splitter.SetPos(hWnd, g_SplitterPos);
- else
- {
- g_Splitter.SetRatio(hWnd, kSplitterRateMax / 2);
- g_SplitterPos = g_Splitter.GetPos();
- }
-
- RECT rect;
- ::GetClientRect(hWnd, &rect);
- int xSize = rect.right;
- int xSizes[2];
- xSizes[0] = g_Splitter.GetPos();
- xSizes[1] = xSize - kSplitterWidth - xSizes[0];
- if (xSizes[1] < 0)
- xSizes[1] = 0;
-
- g_App.CreateDragTarget();
-#else
- int xSizes[2] = { 0,0 };
-#endif
- bool archiveIsOpened;
- bool encrypted;
- bool needOpenFile = false;
- if (!g_MainPath.IsEmpty() /* && g_OpenArchive */)
- {
- NFile::NFind::CFileInfoW fileInfo;
- if (NFile::NFind::FindFile(g_MainPath, fileInfo))
- if (!fileInfo.IsDir())
- needOpenFile = true;
- }
- g_App.Create(hWnd, g_MainPath, xSizes, archiveIsOpened, encrypted);
-
- if (needOpenFile && !archiveIsOpened)
- {
- UString message;
- if (encrypted)
- message = MyFormatNew(IDS_CANT_OPEN_ENCRYPTED_ARCHIVE, 0x0200060A, g_MainPath);
- else
- message = MyFormatNew(IDS_CANT_OPEN_ARCHIVE, 0x02000609, g_MainPath);
- MessageBoxW(0, message, L"7-zip", MB_ICONERROR);
- return ;// -1;
- }
- // g_SplitterPos = 0;
-
- // FIXME RegisterDragDrop(hWnd, g_App._dropTarget);
-
-}
-
-void main_WM_DESTROY()
-{
- // RevokeDragDrop(hWnd);
- // g_App._dropTarget.Release();
-printf("main_WM_DESTROY\n");
- g_App.Save();
- g_App.Release();
- // SaveWindowInfo(hWnd);
- // PostQuitMessage(0);
-}
-#endif
-
-void MoveSubWindows(HWND hWnd)
-{
-#ifdef _WIN32
- RECT rect;
- ::GetClientRect(hWnd, &rect);
- int xSize = rect.right;
- int headerSize = 0;
- if (g_App._rebar)
- headerSize = Window_GetRealHeight(g_App._rebar);
- int ySize = MyMax((int)(rect.bottom - headerSize), 0);
-
- if (g_App.NumPanels > 1)
- {
- g_App.Panels[0].Move(0, headerSize, g_Splitter.GetPos(), ySize);
- int xWidth1 = g_Splitter.GetPos() + kSplitterWidth;
- g_App.Panels[1].Move(xWidth1, headerSize, xSize - xWidth1, ySize);
- }
- else
- {
- /*
- int otherPanel = 1 - g_App.LastFocusedPanel;
- if (g_App.PanelsCreated[otherPanel])
- g_App.Panels[otherPanel].Move(0, headerSize, 0, ySize);
- */
- g_App.Panels[g_App.LastFocusedPanel].Move(0, headerSize, xSize, ySize);
- }
-#endif
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FM_rc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FM_rc.cpp
deleted file mode 100644
index 53d242c6a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FM_rc.cpp
+++ /dev/null
@@ -1,970 +0,0 @@
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-#include "wx/mimetype.h"
-#include "wx/artprov.h"
-#include "wx/imaglist.h"
-
-#include "resource.h"
-
-#include "App.h"
-
-#include "Windows/Control/DialogImpl.h"
-#include "Windows/Control/ListView.h"
-#include "Windows/Control/Window2.h"
-
-// FIXME
-#undef IDCLOSE
-#define IDCLOSE wxID_EXIT
-
-#define static const
-#include "../GUI/p7zip_32.xpm"
-#undef static
-
-extern HWND g_HWND;
-
-#define BASE_ID_PANEL_1 (1000 + 100 * 0)
-#define BASE_ID_PANEL_2 (1000 + 100 * 1)
-
-////////////////////////////////////// Tool bar images
-#include "res/AddPNG.h"
-#include "res/Add2PNG.h"
-#include "res/ExtractPNG.h"
-#include "res/Extract2PNG.h"
-#include "res/TestPNG.h"
-#include "res/Test2PNG.h"
-#include "res/CopyPNG.h"
-#include "res/Copy2PNG.h"
-#include "res/MovePNG.h"
-#include "res/Move2PNG.h"
-#include "res/DeletePNG.h"
-#include "res/Delete2PNG.h"
-#include "res/InfoPNG.h"
-#include "res/Info2PNG.h"
-
-#include <wx/mstream.h>
-#define wxGetBitmapFromMemory(name) _wxGetBitmapFromMemory(name ## _png, sizeof(name ## _png))
-
-static inline wxBitmap _wxGetBitmapFromMemory(const unsigned char *data, int length) {
- wxMemoryInputStream is(data, length);
- return wxBitmap(wxImage(is, wxBITMAP_TYPE_ANY, -1), -1);
-}
-
-///////////////////////////////////// SevenZipPanel.h /////////////////////
-
-#include <wx/listctrl.h>
-
-typedef wxListCtrl CExplorerListCtrl;
-
-class MyFrame;
-
-class SevenZipPanel : public wxPanel
-{
- static int count;
-
- CExplorerListCtrl *m_pListCtrlExplorer;
- NWindows::NControl::CWindow2 *_wList;
-
-
- wxBitmapButton *m_pBmpButtonParentFolder;
- wxComboBox *m_pComboBoxPath;
- wxStatusBar *m_pStatusBar;
-
- MyFrame *m_frame;
-
- wxImageList imgList;
-
- int _panelIndex;
-
- // wxString m_currentDirectory;
-
- // int m_nbDirs;
-
- // wxString m_prompt;
-
-public:
- SevenZipPanel(MyFrame *frame, wxWindow *parent,int id,int panelIndex);
-
- void registerWindow2(NWindows::NControl::CWindow2 *w)
- {
- _wList = w;
- _wList->OnMessage(WM_CREATE,0,0);
- }
-
- void OnAnyButton( wxCommandEvent &event );
- void OnSelected(wxListEvent& event);
- void OnDeselected(wxListEvent& event);
- void OnActivated(wxListEvent& event);
- void OnFocused(wxListEvent& event);
- void OnLeftDownBeginDrag(wxListEvent& event);
- void OnRightClick(wxListEvent& event);
- void OnColumnClick(wxListEvent& event);
-
- void OnLeftDown(wxMouseEvent &event );
- void OnRightDown(wxMouseEvent &event );
-
- void WriteText(const wxString& text) {
- printf("DEBUG : %ls\n",(const wchar_t *)text);
- }
-
- /* Don't work ...
- void OnCloseWindow(wxCloseEvent& WXUNUSED(event)) {
- _wList->OnDestroy();
- }
- */
-
- void evt_destroy() {
- _wList->OnDestroy();
- }
-
-
-private:
- DECLARE_EVENT_TABLE()
-};
-
-
-
-///////////////////////////////////// SevenZipPanel.h /////////////////////
-
-
-
-class MyFrame: public wxFrame
-{
-public:
- // ctor
- MyFrame(void (*fct)(HWND),wxFrame *frame, const wxString& title, int x, int y, int w, int h);
- // virtual ~MyFrame();
-
- void registerWindow2(int baseID,NWindows::NControl::CWindow2 *w)
- {
- printf("MyFrame::registerWindow2(%d,%p)\n",baseID,w);
- switch (baseID)
- {
- case BASE_ID_PANEL_1: _panel1->registerWindow2(w); break;
- case BASE_ID_PANEL_2: _panel2->registerWindow2(w); break;
- default: printf("FIXME - MyFrame::registerWindow2\n");
- }
- }
-
- void PopulateToolbar(wxToolBar* toolBar);
- void RecreateToolbar();
-
-
-protected:
- // callbacks
- void OnWorkerEvent(wxCommandEvent& event);
- void OnAnyMenu(wxCommandEvent& event)
- {
- extern bool OnMenuCommand(HWND hWnd, int id);
- extern void ExecuteCommand(UINT commandID);
-
- int wmId = event.GetId();
-
- if (wmId >= kToolbarStartID)
- {
- ExecuteCommand(wmId);
- return ; // 0;
- }
- OnMenuCommand(this, wmId);
- }
- void OnCloseWindow(wxCloseEvent& WXUNUSED(event))
- {
- if (_panel1) _panel1->evt_destroy();
- if (_panel2) _panel2->evt_destroy();
-
- extern void main_WM_DESTROY();
- main_WM_DESTROY();
- Destroy();
- }
-private:
- SevenZipPanel * _panel1;
- SevenZipPanel * _panel2;
- DECLARE_EVENT_TABLE()
-};
-
-enum {
- WORKER_EVENT=100 // this one gets sent from the worker thread
-};
-
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
- EVT_MENU(WORKER_EVENT, MyFrame::OnWorkerEvent)
- EVT_MENU(wxID_ANY, MyFrame::OnAnyMenu)
- EVT_CLOSE(MyFrame::OnCloseWindow)
-END_EVENT_TABLE()
-
-// My frame constructor
-MyFrame::MyFrame(void (*wm_create)(HWND),wxFrame *frame, const wxString& title,
- int x, int y, int w, int h)
- : wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
-{
-printf("===MyFrame::MyFrame===BEGIN===\n");
-
- this->SetIcon(wxICON(p7zip_32));
-
- g_HWND = this; // FIXME
-
- wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
-
- _panel1 = new SevenZipPanel(this,this,BASE_ID_PANEL_1,0); // FIXME panelIndex = 0
- _panel2 = 0;
- topsizer->Add(
- _panel1,
- 1, // make vertically stretchable
- wxEXPAND | // make horizontally stretchable
- wxALL, // and make border all around
- 0 ); // set border width to 10
-
- // Create the toolbar
- // FIXME RecreateToolbar();
-printf("===MyFrame::MyFrame===WM_CREATE===\n");
- wm_create(this);
-
- // Create the toolbar // FIXME
- RecreateToolbar();
-
-
-printf("===MyFrame::MyFrame===SIZER===\n");
-
- SetSizer( topsizer ); // use the sizer for layout
-
- topsizer->SetSizeHints( this ); // set size hints to honour minimum size
-printf("===MyFrame::MyFrame===END===\n");
-}
-
-void myCreateHandle(int n);
-void MyFrame::OnWorkerEvent(wxCommandEvent& event)
-{
- int n = event.GetInt();
- myCreateHandle(n);
-}
-
-wxWindow * g_window=0;
-HWND myCreateAndShowMainWindow(LPCTSTR title,void (*fct)(HWND))
-{
- MyFrame *frame = new MyFrame(fct,(wxFrame *)NULL, title, 50, 50, 450, 340);
- // Don't Show the frame !
- frame->Show(true); // FIXME
-
- // FIXME : SetTopWindow(g_HWND);
-
- g_window = frame;
-
- return frame;
-}
-
-
-class myToolBar
-{
- wxToolBar * m_toolbar;
-
- bool m_bShowText;
-
-public:
- myToolBar(wxToolBar * toolbar,bool bShowText ) : m_toolbar(toolbar), m_bShowText(bShowText) { }
-
- myToolBar* AddTool(int toolId, const wxString& label, const wxBitmap& bitmap1, const wxString& shortHelpString = _T(""), wxItemKind kind = wxITEM_NORMAL)
- {
- wxString text = wxEmptyString;
- if (m_bShowText) text = label;
-
- wxSize tb_size = m_toolbar->GetToolBitmapSize();
- int tb_witdh = tb_size.GetWidth();
- int tb_height = tb_size.GetHeight();
-
- if ((bitmap1.GetWidth() > tb_witdh) || ( bitmap1.GetHeight()> tb_height))
- {
- wxBitmap bmp(bitmap1.ConvertToImage().Scale(tb_witdh, tb_height));
- m_toolbar->AddTool(toolId,text,bmp,shortHelpString,kind);
- }
- else
- {
- m_toolbar->AddTool(toolId,text,bitmap1,shortHelpString,kind);
- }
-
- return this;
- }
-
- void SetToolBitmapSize(const wxSize& size)
- {
- m_toolbar->SetToolBitmapSize(size);
- }
-
- bool Realize()
- {
- return m_toolbar->Realize();
- }
-
- void AddSeparator() { m_toolbar->AddSeparator(); }
-};
-
-void MyFrame::PopulateToolbar(wxToolBar* p_toolBar)
-{/*
- toolBar->AddTool(wxID_NEW, _T("New"),toolBarBitmaps[Tool_new], wxNullBitmap, wxITEM_NORMAL,
- _T("New file"), _T("This is help for new file tool"));
- */
- myToolBar toolBar(p_toolBar,true);
-
- const int kWidth = 24;
- const int kHeight = 24;
-
- // FIXME toolBar->SetToolBitmapSize(wxSize(24,24));
- toolBar.SetToolBitmapSize(wxSize(kWidth,kHeight));
- toolBar.AddTool(kAddCommand, wxT("Add"), wxGetBitmapFromMemory(ADD2));
- toolBar.AddTool(kExtractCommand,wxT("Extract"), wxGetBitmapFromMemory(EXTRACT2));
- toolBar.AddTool(kTestCommand, wxT("Test"), wxGetBitmapFromMemory(TEST2));
-
- toolBar.AddSeparator();
-
- toolBar.AddTool(IDM_COPY_TO, wxT("Copy"), wxGetBitmapFromMemory(COPY2));
- toolBar.AddTool(IDM_MOVE_TO, wxT("Move"), wxGetBitmapFromMemory(MOVE2));
- toolBar.AddTool(IDM_DELETE, wxT("Delete"), wxGetBitmapFromMemory(DELETE2));
- toolBar.AddTool(IDM_FILE_PROPERTIES, wxT("Info"), wxGetBitmapFromMemory(INFO2));
-
- ////////////////////////////////////////////////////////
-
- /* FIXME
- if (g_mimeDatabase)
- {
- toolBar.AddSeparator();
-
- TryMime(&toolBar, _T("txt"));
- TryMime(&toolBar, _T("rar"));
- TryMime(&toolBar, _T("7z"));
- }
-
- toolBar.AddSeparator();
-
- wxIcon i_plus = wxArtProvider::GetIcon(wxART_ADD_BOOKMARK , wxART_TOOLBAR , wxSize(kWidth,kHeight));
- toolBar.AddTool(wxID_ANY, wxT("Add Bookmark"), i_plus);
-
- wxIcon i_go_up_dir = wxArtProvider::GetIcon(wxART_GO_DIR_UP , wxART_TOOLBAR , wxSize(kWidth,kHeight));
- toolBar.AddTool(wxID_ANY, wxT("Go up dir"), i_go_up_dir);
-
- wxIcon i_folder = wxArtProvider::GetIcon(wxART_FOLDER , wxART_TOOLBAR , wxSize(kWidth,kHeight));
- toolBar.AddTool(wxID_ANY, wxT("Folder"), i_folder);
-
- wxIcon i_missing_image = wxArtProvider::GetIcon(wxART_MISSING_IMAGE , wxART_TOOLBAR , wxSize(kWidth,kHeight));
- toolBar.AddTool(wxID_ANY, wxT("missing image"), i_missing_image);
- */
-
- ///////////////////////////////////////////////////////
-
- toolBar.Realize();
-
- // toolBar->SetRows(!(toolBar->IsVertical()) ? m_rows : 10 / m_rows);
-}
-void MyFrame::RecreateToolbar()
-{
- // delete and recreate the toolbar
- wxToolBar *toolBar = GetToolBar();
- // long style = toolBar ? toolBar->GetWindowStyle() : TOOLBAR_STYLE;
-
- SetToolBar(NULL);
-
- delete toolBar;
- /*
- style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_BOTTOM | wxTB_RIGHT | wxTB_HORZ_LAYOUT);
- switch( m_toolbarPosition )
- {
- case TOOLBAR_LEFT:style |= wxTB_LEFT; break;
- case TOOLBAR_TOP: style |= wxTB_TOP;break;
- case TOOLBAR_RIGHT:style |= wxTB_RIGHT;break;
- case TOOLBAR_BOTTOM:style |= wxTB_BOTTOM;break;
- }
- */
- long style = wxTB_FLAT | wxTB_NODIVIDER | wxTB_TEXT; // TOOLBAR_STYLE | wxTB_TOP;
- /*
- if ( m_showTooltips ) style &= ~wxTB_NO_TOOLTIPS;
- else style |= wxTB_NO_TOOLTIPS;
-
- if ( style & wxTB_TEXT && !(style & wxTB_NOICONS) && m_horzText ) style |= wxTB_HORZ_LAYOUT;
- */
- toolBar = CreateToolBar(style, wxID_ANY);
-
- PopulateToolbar(toolBar);
-}
-
-void registerWindow2(int baseID,NWindows::NControl::CWindow2 *w)
-{
- MyFrame * f = (MyFrame *) g_HWND;
- f->registerWindow2(baseID,w);
-
-}
-
-
-/////////////////////////////////////////////////////////
-#include "LangUtils.h"
-
-static const UINT kOpenBookmarkMenuID = 730; // FIXME / duplicate
-static const UINT kSetBookmarkMenuID = 740;
-
-
-void rc_MyLoadMenu(HWND hWnd)
-{
- wxFrame *hwnd = (wxFrame *)hWnd;
- wxMenu *m;
- wxMenu *m_file = m = new wxMenu;
- {
- m->Append(IDM_FILE_OPEN, _T("&Open\tEnter"));
- m->Append(IDM_FILE_OPEN_INSIDE,_T("Open &Inside\tCtrl+PgDn"));
- m->Append(IDM_FILE_OPEN_OUTSIDE,_T("Open O&utside\tShift+Enter"));
- m->Append(IDM_FILE_EDIT,_T("&Edit\tF4"));
- m->AppendSeparator();
- m->Append(IDM_RENAME,_T("Rena&me\tF2"));
- m->Append(IDM_COPY_TO,_T("&Copy To...\tF5"));
- m->Append(IDM_MOVE_TO,_T("&Move To...\tF6"));
- m->Append(IDM_DELETE,_T("&Delete\tDel"));
- m->AppendSeparator();
- m->Append(IDM_FILE_SPLIT,_T("&Split file..."));
- m->Append(IDM_FILE_COMBINE,_T("Com&bine files..."));
- m->AppendSeparator();
- m->Append(IDM_FILE_PROPERTIES,_T("P&roperties\tAlt+Enter"));
- m->Append(IDM_FILE_COMMENT,_T("Comme&nt\tCtrl+Z"));
- m->Append(IDM_FILE_CRC,_T("Calculate checksum"));
- m->AppendSeparator();
- m->Append(IDM_CREATE_FOLDER,_T("Create Folder\tF7"));
- m->Append(IDM_CREATE_FILE,_T("Create File\tCtrl+N"));
- m->AppendSeparator();
- m->Append(IDCLOSE,_T("E&xit\tAlt+F4"));
- }
- wxMenu *m_edit = m = new wxMenu;
- {
- m->Append(IDM_EDIT_CUT, _T("Cu&t\tCtrl+X"))->Enable(true); // GRAYED
- // m->Enable(IDM_EDIT_CUT, false);
- m->Append(IDM_EDIT_COPY, _T("&Copy\tCtrl+C"))->Enable(true); // GRAYED
- m->Append(IDM_EDIT_PASTE, _T("&Paste\tCtrl+V"))->Enable(true); // GRAYED
- m->AppendSeparator();
- m->Append(IDM_SELECT_ALL, _T("Select &All\tShift+[Grey +]"));
- m->Append(IDM_DESELECT_ALL, _T("Deselect All\tShift+[Grey -]"));
- m->Append(IDM_INVERT_SELECTION, _T("&Invert Selection\tGrey *"));
- m->Append(IDM_SELECT, _T("Select...\tGrey +"));
- m->Append(IDM_DESELECT, _T("Deselect...\tGrey -"));
- m->Append(IDM_SELECT_BY_TYPE, _T("Select by Type\tAlt+[Grey+]"));
- m->Append(IDM_DESELECT_BY_TYPE, _T("Deselect by Type\tAlt+[Grey -]"));
- }
- wxMenu *m_view = m = new wxMenu;
- {
- m->AppendRadioItem(IDM_VIEW_LARGE_ICONS, _T("Lar&ge Icons\tCtrl+1"));
- m->AppendRadioItem(IDM_VIEW_SMALL_ICONS, _T("S&mall Icons\tCtrl+2"));
- m->AppendRadioItem(IDM_VIEW_LIST, _T("&List\tCtrl+3"));
- m->AppendRadioItem(IDM_VIEW_DETAILS, _T("&Details\tCtrl+4"))->Check(true); // CHECKED
- m->AppendSeparator();
- m->Append(IDM_VIEW_ARANGE_BY_NAME, _T("Name\tCtrl+F3"));
- m->Append(IDM_VIEW_ARANGE_BY_TYPE, _T("Type\tCtrl+F4"));
- m->Append(IDM_VIEW_ARANGE_BY_DATE, _T("Date\tCtrl+F5"));
- m->Append(IDM_VIEW_ARANGE_BY_SIZE, _T("Size\tCtrl+F6"));
- m->Append(IDM_VIEW_ARANGE_NO_SORT, _T("Unsorted\tCtrl+F7"));
- m->AppendSeparator();
- m->AppendCheckItem(IDM_VIEW_FLAT_VIEW, _T("Flat View"));
- m->AppendCheckItem(IDM_VIEW_TWO_PANELS, _T("&2 Panels\tF9"));
-
- {
- wxMenu* subMenu = new wxMenu;
- subMenu->AppendCheckItem(IDM_VIEW_ARCHIVE_TOOLBAR, _T("Archive Toolbar"));
- subMenu->AppendCheckItem(IDM_VIEW_STANDARD_TOOLBAR, _T("Standard Toolbar"));
- subMenu->AppendSeparator();
- subMenu->AppendCheckItem(IDM_VIEW_TOOLBARS_LARGE_BUTTONS, _T("Large Buttons"));
- subMenu->AppendCheckItem(IDM_VIEW_TOOLBARS_SHOW_BUTTONS_TEXT, _T("Show Buttons Text"));
- m->Append(12112, _T("Toolbars"), subMenu); // FIXME ID ?
- }
- m->AppendSeparator();
- m->Append(IDM_OPEN_ROOT_FOLDER, _T("Open Root Folder\t" STRING_PATH_SEPARATOR));
- m->Append(IDM_OPEN_PARENT_FOLDER, _T("Up One Level\tBackspace"));
- m->Append(IDM_FOLDERS_HISTORY, _T("Folders History...\tAlt+F12"));
- m->AppendSeparator();
- m->Append(IDM_VIEW_REFRESH, _T("&Refresh\tCtrl+R"));
- }
- wxMenu *m_favorites = m = new wxMenu;
- {
- {
- wxMenu* subMenu = new wxMenu;
- for (int i = 0; i < 10; i++)
- {
- UString s = LangString(IDS_BOOKMARK, 0x03000720);
- s += L" ";
- wchar_t c = (wchar_t)(L'0' + i);
- s += c;
- s += L"\tAlt+Shift+";
- s += c;
- subMenu->Append( kSetBookmarkMenuID + i, wxString(s));
- }
-
- m->Append(12111, _T("&Add folder to Favorites as"), subMenu); // FIXME ID ?
- }
- m->AppendSeparator();
- for (int i = 0; i < 10; i++)
- {
- UString path = g_App.AppState.FastFolders.GetString(i);
- const int kMaxSize = 100;
- const int kFirstPartSize = kMaxSize / 2;
- if (path.Length() > kMaxSize)
- {
- path = path.Left(kFirstPartSize) + UString(L" ... ") +
- path.Right(kMaxSize - kFirstPartSize);
- }
- UString s = path;
- if (s.IsEmpty())
- s = L"-";
- s += L"\tAlt+";
- s += (wchar_t)(L'0' + i);
- // menu.AppendItem(MF_STRING, kOpenBookmarkMenuID + i, s);
- m->Append( kOpenBookmarkMenuID + i, wxString(s));
- }
-
- }
- wxMenu *m_tools = m = new wxMenu;
- {
- m->Append(IDM_OPTIONS, _T("&Options..."));
- m->Append(IDM_BENCHMARK, _T("&Benchmark"));
- }
- wxMenu *m_help = m = new wxMenu;
- {
- m->Append(IDM_HELP_CONTENTS, _T("&Contents...\tF1"));
- m->AppendSeparator();
- m->Append(IDM_ABOUT, _T("&About 7-Zip..."));
- }
-
- wxMenuBar *menuBar = new wxMenuBar;
-
- menuBar->Append(m_file, _T("&File"));
- menuBar->Append(m_edit, _T("&Edit"));
- menuBar->Append(m_view, _T("&View"));
- menuBar->Append(m_favorites, _T("F&avorites"));
- menuBar->Append(m_tools, _T("&Tools"));
- menuBar->Append(m_help, _T("&Help"));
- hwnd->SetMenuBar(menuBar);
-}
-
-//////////////////////////////////////////////////////////////////
-
-
-static CStringTable g_stringTable[] =
-{
- /* resource.rc */
- /***************/
- { IDS_APP_TITLE, L"7-Zip File Manager" },
-
- { IDS_COPY , L"Copy" },
- { IDS_MOVE , L"Move" },
- { IDS_COPY_TO , L"Copy to:" },
- { IDS_MOVE_TO , L"Move to:" },
- { IDS_COPYING , L"Copying..." },
- { IDS_MOVING , L"Moving..." },
- { IDS_CANNOT_COPY , L"You cannot move or copy items for such folders." },
- { IDS_SPLITTING , L"Splitting..." },
- { IDS_SPLIT_CONFIRM_TITLE , L"Confirm Splitting" },
- { IDS_SPLIT_CONFIRM_MESSAGE , L"Are you sure you want to split file into {0} volumes?" },
- { IDS_SPLIT_VOL_MUST_BE_SMALLER , L"Volume size must be smaller than size of original file" },
-
- { IDS_COMBINE , L"Combine Files" },
- { IDS_COMBINE_TO , L"&Combine to:" },
- { IDS_COMBINING , L"Combining..." },
- { IDS_COMBINE_SELECT_ONE_FILE , L"Select only first file" },
-
- { IDS_CHECKSUM_CALCULATING , L"Checksum calculating..." },
- { IDS_CHECKSUM_INFORMATION , L"Checksum information" },
- { IDS_CHECKSUM_CRC_DATA , L"CRC checksum for data:" },
- { IDS_CHECKSUM_CRC_DATA_NAMES , L"CRC checksum for data and names:" },
-
- { IDS_SCANNING , L"Scanning..." },
-
- { IDS_PROPERTIES , L"Properties" },
-
- { IDS_OPERATION_IS_NOT_SUPPORTED , L"Operation is not supported." },
-
- { IDS_CONFIRM_FILE_DELETE , L"Confirm File Delete" },
- { IDS_CONFIRM_FOLDER_DELETE , L"Confirm Folder Delete" },
- { IDS_CONFIRM_ITEMS_DELETE , L"Confirm Multiple File Delete" },
- { IDS_WANT_TO_DELETE_FILE , L"Are you sure you want to delete '{0}'?" },
- { IDS_WANT_TO_DELETE_FOLDER , L"Are you sure you want to delete the folder '{0}' and all its contents?" },
- { IDS_WANT_TO_DELETE_ITEMS , L"Are you sure you want to delete these {0} items?" },
- { IDS_DELETING , L"Deleting..." },
- { IDS_ERROR_DELETING , L"Error Deleting File or Folder" },
- { IDS_RENAMING , L"Renaming..." },
- { IDS_ERROR_RENAMING , L"Error Renaming File or Folder" },
- { IDS_CONFIRM_FILE_COPY , L"Confirm File Copy" },
- { IDS_WANT_TO_COPY_FILES , L"Are you sure you want to copy files to archive" },
-
- { IDS_CREATE_FOLDER , L"Create Folder" },
- { IDS_CREATE_FOLDER_NAME , L"Folder name:" },
- { IDS_CREATE_FOLDER_DEFAULT_NAME , L"New Folder" },
- { IDS_CREATE_FOLDER_ERROR , L"Error Creating Folder" },
- { IDS_CREATE_FILE , L"Create File" },
- { IDS_CREATE_FILE_NAME , L"File Name:" },
- { IDS_CREATE_FILE_DEFAULT_NAME , L"New File" },
- { IDS_CREATE_FILE_ERROR , L"Error Creating File" },
- { IDS_SELECT , L"Select" },
- { IDS_DESELECT , L"Deselect" },
- { IDS_SELECT_MASK , L"Mask:" },
- { IDS_FOLDERS_HISTORY , L"Folders History" },
- { IDS_N_SELECTED_ITEMS , L"{0} object(s) selected" },
- { IDS_FILES_COLON , L"Files:" },
- { IDS_FOLDERS_COLON , L"Folders:" },
- { IDS_SIZE_COLON , L"Size:" },
-
- { IDS_PROP_TOTAL_SIZE , L"Total Size" },
- { IDS_PROP_FREE_SPACE , L"Free Space" },
- { IDS_PROP_CLUSTER_SIZE , L"Cluster Size" },
- { IDS_PROP_VOLUME_NAME , L"Label" },
- { IDS_PROP_LOCAL_NAME , L"Local Name" },
- { IDS_PROP_PROVIDER , L"Provider" },
- { IDS_OPTIONS , L"Options" },
- { IDS_COMMENT , L"Comment" },
- { IDS_COMMENT2 , L"&Comment:" },
- { IDS_SYSTEM , L"System" },
- { IDS_TOO_MANY_ITEMS , L"Too many items" },
- { IDS_WANT_UPDATE_MODIFIED_FILE , L"File '{0}' was modified.\nDo you want to update it in the archive?" },
- { IDS_CANNOT_UPDATE_FILE , L"Can not update file\n'{0}'" },
- { IDS_CANNOT_START_EDITOR , L"Cannot start editor." },
- { IDS_OPENNING , L"Opening..." },
- { IDS_ADD , L"Add" },
- { IDS_EXTRACT , L"Extract" },
- { IDS_TEST , L"Test" },
- { IDS_BUTTON_COPY , L"Copy" },
- { IDS_BUTTON_MOVE , L"Move" },
- { IDS_BUTTON_DELETE , L"Delete" },
- { IDS_BUTTON_INFO , L"Info" },
- { IDS_BOOKMARK , L"Bookmark" },
- { IDS_COMPUTER , L"Computer" },
- { IDS_NETWORK , L"Network" },
-
- { IDS_PROGRESS_TESTING , L"Testing" },
- { IDS_MESSAGE_NO_ERRORS , L"There are no errors" },
-
- { 0 , 0 }
-};
-
-REGISTER_STRINGTABLE(g_stringTable)
-
-/////////////////////////////////////////////////////
-
-#include "res/ParentFolder.h"
-
- SevenZipPanel::SevenZipPanel(MyFrame *frame, wxWindow *parent,int id,int panelIndex) :
- wxPanel(parent,id) , m_frame(frame), _wList(0)
- {
- _panelIndex = panelIndex;
-
- int _baseID = id; // FIXME
- int _listID = _baseID + 1;
- int _comboBoxID = _baseID + 3;
- int _statusBarID = _comboBoxID + 1;
- int kParentFolderID = 100; // FIXME Panel.h
-
-
- ///Sizer for adding the controls created by users
- wxBoxSizer* pMainSizer = new wxBoxSizer(wxVERTICAL);
- int sizes[] = {150, 250, 350, -1};
- wxArrayString pathArray;
- wxBoxSizer *pPathSizer = new wxBoxSizer(wxHORIZONTAL);
- m_pBmpButtonParentFolder = new wxBitmapButton(this, kParentFolderID, wxGetBitmapFromMemory(PARENT_FOLDER), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW);
- m_pComboBoxPath = new wxComboBox(this, _comboBoxID, wxEmptyString, wxDefaultPosition, wxSize(300,-1), pathArray, wxCB_DROPDOWN | wxCB_SORT );
- pPathSizer->Add(m_pBmpButtonParentFolder, 0, wxALL|wxEXPAND, 0);
- pPathSizer->Add(m_pComboBoxPath, 1, wxALL|wxEXPAND, 5);
-
- m_pListCtrlExplorer = new CExplorerListCtrl(this,_listID,wxDefaultPosition, wxSize(300,300),
- wxLC_REPORT |
- wxSUNKEN_BORDER | wxLC_EDIT_LABELS);
-
- printf("DEBUG : new CExplorerListCtrl(id=%d) => %p\n",_listID,m_pListCtrlExplorer);
-
- m_pStatusBar = new wxStatusBar(this, _statusBarID);
- m_pStatusBar->SetFieldsCount(4, sizes);
- pMainSizer->Add(pPathSizer, 0, wxALL|wxEXPAND, 0);
- pMainSizer->Add(m_pListCtrlExplorer, 1, wxALL|wxEXPAND, 0);
- pMainSizer->Add(m_pStatusBar, 0, wxALL|wxEXPAND, 0);
- SetSizer(pMainSizer);
- SetAutoLayout (true);
- Layout();
-
-
- // m_pListCtrlExplorer->SetDropTarget(new DnDFile(this));
-
- }
-
- void SevenZipPanel::OnAnyButton( wxCommandEvent &event )
- {
- count++;
-
- int id = event.GetId();
-
- wxString msg = wxString::Format(_T("P %d : button %d \n"), count,id);
-
- WriteText(msg);
-
- _wList->OnMessage(WM_COMMAND , id , 0);
- }
-
- void SevenZipPanel::OnSelected(wxListEvent& event)
- {
- const wxListItem & item = event.GetItem();
- count++;
-
- wxString msg = wxString::Format(_T("P %d : OnSelected %d \n"), count,event.GetId());
-
- WriteText(msg);
-
- NMLISTVIEW info;
- info.hdr.hwndFrom = m_pListCtrlExplorer;
- info.hdr.code = LVN_ITEMCHANGED;
- info.uOldState = 0;
- info.uNewState = LVIS_SELECTED;
- info.lParam = item.GetData(); // event.GetIndex(); // FIXME ? event.GetData();
- _wList->OnMessage(WM_NOTIFY , event.GetId() , (LPARAM)&info);
- /*
- if ( GetWindowStyle() & wxLC_REPORT )
- {
- wxListItem info;
- info.m_itemId = event.m_itemIndex;
- info.m_col = 1;
- info.m_mask = wxLIST_MASK_TEXT;
- if ( GetItem(info) )
- {
- wxLogMessage(wxT("Value of the 2nd field of the selected item: %s"),
- info.m_text.c_str());
- }
- else
- {
- wxFAIL_MSG(wxT("wxListCtrl::GetItem() failed"));
- }
- }
- */
- }
-
- void SevenZipPanel::OnDeselected(wxListEvent& event)
- {
- const wxListItem & item = event.GetItem();
- count++;
- wxString msg = wxString::Format(_T("P %d : OnDeselected %d \n"), count,event.GetId());
- WriteText(msg);
-
- NMLISTVIEW info;
- info.hdr.hwndFrom = m_pListCtrlExplorer;
- info.hdr.code = LVN_ITEMCHANGED;
- info.uOldState = LVIS_SELECTED;
- info.uNewState = 0;
- info.lParam = item.GetData(); // event.GetIndex(); // FIXME ? event.GetData();
- _wList->OnMessage(WM_NOTIFY , event.GetId() , (LPARAM)&info);
- }
-
- void SevenZipPanel::OnColumnClick(wxListEvent& event)
- {
- count++;
- wxString msg = wxString::Format(_T("P %d : OnColumnClick %d col=%d\n"), count,event.GetId(),event.GetColumn());
- WriteText(msg);
-
- NMLISTVIEW info;
- info.hdr.hwndFrom = m_pListCtrlExplorer;
- info.hdr.code = LVN_COLUMNCLICK;
- info.iSubItem = event.GetColumn();
- _wList->OnMessage(WM_NOTIFY , event.GetId() , (LPARAM)&info);
-
- }
-
-
- void SevenZipPanel::OnActivated(wxListEvent& event)
- {
- count++;
-
- int ind = event.GetIndex();
-
- NMHDR info;
- info.hwndFrom = m_pListCtrlExplorer;
- info.code = NM_DBLCLK;
- _wList->OnMessage(WM_NOTIFY , event.GetId() , (LPARAM)&info);
-
- /*
- if ((ind >= 0) && ( ind < m_nbDirs))
- {
- wxString msg = wxString::Format(_T("P %d : OnActivated %d : DIR = %d\n"), count,event.GetId(),ind);
- WriteText(msg);
-
- wxString name = m_pListCtrlExplorer->GetItemText(ind);
-
- wxFileName filename (m_currentDirectory,name);
- BinPath(filename.GetFullPath());
-
- }
- else
- */
- {
- wxString msg = wxString::Format(_T("P %d : OnActivated %d : FILE = %d\n"), count,event.GetId(),ind);
- WriteText(msg);
- }
-
-
- }
-
- void SevenZipPanel::OnFocused(wxListEvent& event)
- {
- count++;
-
- wxString msg = wxString::Format(_T("P %d : OnFocused %d \n"), count,event.GetId());
-
- WriteText(msg);
-
- event.Skip();
- }
-
- void SevenZipPanel::OnLeftDownBeginDrag(wxListEvent& event)
- {
- count++;
-
- wxString msg = wxString::Format(_T("P %d : OnLeftDownBeginDrag %d \n"), count,event.GetId());
- WriteText(msg);
-
-#if 0
- if ( m_pListCtrlExplorer->GetSelectedItemCount() < 1) return ;
-
- // start drag operation
- wxFileDataObject filesData;
-
-
- long item = -1;
- for ( ;; )
- {
- item = m_pListCtrlExplorer->GetNextItem(item,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_SELECTED);
- if ( item == -1 )
- break;
-
- // this item is selected - do whatever is needed with it
- // wxLogMessage("Item %ld is selected.", item);
- wxString file = m_currentDirectory + _T("/") + m_pListCtrlExplorer->GetItemText(item);
-
- filesData.AddFile(file);
-
- }
-
- msg = wxString::Format(_T("P %d : wxDropSource %d \n"), count,event.GetId());
- WriteText(msg);
-
- wxDropSource source(filesData, this,
- wxDROP_ICON(dnd_copy),
- wxDROP_ICON(dnd_move),
- wxDROP_ICON(dnd_none));
-
- int flags = 0;
- /*
- if ( m_moveByDefault )
- flags |= wxDrag_DefaultMove;
- else if ( m_moveAllow )
- flags |= wxDrag_AllowMove;
- */
- flags |= wxDrag_AllowMove;
-
- msg = wxString::Format(_T("P %d : DoDragDrop %d \n"), count,event.GetId());
- WriteText(msg);
-
-
- wxDragResult result = source.DoDragDrop(flags);
-
-
- const wxChar *pc;
- switch ( result )
- {
- case wxDragError: pc = _T("Error!"); break;
- case wxDragNone: pc = _T("Nothing"); break;
- case wxDragCopy: pc = _T("Copied"); break;
- case wxDragMove: pc = _T("Moved"); break;
- case wxDragCancel: pc = _T("Cancelled"); break;
- default: pc = _T("Huh?"); break;
- }
-
- WriteText(wxString(_T(" Drag result: ")) + pc);
-#endif
- }
-
-void SevenZipPanel::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
-{
- WriteText(_T("OnLeftDown"));
-#if 0
- if ( !m_strText.empty() )
- {
- // start drag operation
- wxTextDataObject textData(m_strText);
- wxDropSource source(textData, this,
- wxDROP_ICON(dnd_copy),
- wxDROP_ICON(dnd_move),
- wxDROP_ICON(dnd_none));
-
- int flags = 0;
- if ( m_moveByDefault )
- flags |= wxDrag_DefaultMove;
- else if ( m_moveAllow )
- flags |= wxDrag_AllowMove;
-
- wxDragResult result = source.DoDragDrop(flags);
-
-#if wxUSE_STATUSBAR
- const wxChar *pc;
- switch ( result )
- {
- case wxDragError: pc = _T("Error!"); break;
- case wxDragNone: pc = _T("Nothing"); break;
- case wxDragCopy: pc = _T("Copied"); break;
- case wxDragMove: pc = _T("Moved"); break;
- case wxDragCancel: pc = _T("Cancelled"); break;
- default: pc = _T("Huh?"); break;
- }
-
- SetStatusText(wxString(_T("Drag result: ")) + pc);
-#else
- wxUnusedVar(result);
-#endif // wxUSE_STATUSBAR
- }
-#endif // wxUSE_DRAG_AND_DROP
-}
-
-void SevenZipPanel::OnRightClick(wxListEvent& event)
-{
- wxPoint point = event.GetPoint();
-
- WriteText(_T("OnRightClick"));
- wxMenu menu; // (_T("Dnd sample menu"));
-
- menu.Append(wxID_ANY, _T("&Test drag..."));
- menu.AppendSeparator();
- menu.Append(wxID_ANY, _T("item1"));
- menu.Append(wxID_ANY, _T("item2"));
- menu.Append(wxID_ANY, _T("item3"));
- menu.Append(wxID_ANY, _T("&About"));
-
- PopupMenu( &menu, point.x, point.y );
-}
-
-int SevenZipPanel::count = 0;
-
-BEGIN_EVENT_TABLE(SevenZipPanel, wxPanel)
-// EVT_MENU(wxID_ANY, SevenZipPanel::OnAnyMenu)
-// EVT_LISTBOX (wxID_ANY, MyPanel::OnListBox)
-// EVT_LISTBOX_DCLICK(wxID_ANY, MyPanel::OnAnyListBoxDoubleClick)
-EVT_BUTTON (wxID_ANY, SevenZipPanel::OnAnyButton)
-
- // EVT_CLOSE(SevenZipPanel::OnCloseWindow)
-
-/////////////////
-EVT_LIST_ITEM_SELECTED(wxID_ANY, SevenZipPanel::OnSelected)
-EVT_LIST_ITEM_DESELECTED(wxID_ANY, SevenZipPanel::OnDeselected)
-EVT_LIST_ITEM_ACTIVATED(wxID_ANY, SevenZipPanel::OnActivated)
-EVT_LIST_ITEM_FOCUSED(wxID_ANY, SevenZipPanel::OnFocused)
-
-EVT_LIST_BEGIN_DRAG(wxID_ANY, SevenZipPanel::OnLeftDownBeginDrag)
-EVT_LIST_ITEM_RIGHT_CLICK(wxID_ANY, SevenZipPanel::OnRightClick)
-
-EVT_LIST_COL_CLICK(wxID_ANY, SevenZipPanel::OnColumnClick)
-
-END_EVENT_TABLE()
-
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSDrives.h.out b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSDrives.h.out
deleted file mode 100644
index 84db5b7e2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSDrives.h.out
+++ /dev/null
@@ -1,49 +0,0 @@
-// FSDrives.h
-
-#ifndef __FSDRIVES_H
-#define __FSDRIVES_H
-
-#include "Common/MyString.h"
-#include "Common/Types.h"
-#include "Common/MyCom.h"
-#include "Windows/FileFind.h"
-#include "Windows/PropVariant.h"
-
-#include "IFolder.h"
-
-struct CDriveInfo
-{
- UString Name;
- UString FullSystemName;
- bool KnownSizes;
- UInt64 DriveSize;
- UInt64 FreeSpace;
- UInt64 ClusterSize;
- UString Type;
- UString VolumeName;
- UString FileSystemName;
-};
-
-class CFSDrives:
- public IFolderFolder,
- public IFolderGetSystemIconIndex,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(
- IFolderGetSystemIconIndex
- )
-
- INTERFACE_FolderFolder(;)
-
- STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex);
-
-private:
- HRESULT BindToFolderSpec(const wchar_t *name, IFolderFolder **resultFolder);
- CObjectVector<CDriveInfo> _drives;
- bool _volumeMode;
-public:
- void Init() { _volumeMode = false;}
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSFolder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSFolder.cpp
deleted file mode 100644
index 9c2aaa613..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSFolder.cpp
+++ /dev/null
@@ -1,701 +0,0 @@
-// FSFolder.cpp
-
-#include "StdAfx.h"
-
-#include "FSFolder.h"
-
-#include "Common/StringConvert.h"
-#include "Common/UTFConvert.h"
-#include "Common/ComTry.h"
-
-#include "Windows/Defs.h"
-#include "Windows/PropVariant.h"
-#include "Windows/FileDir.h"
-#include "Windows/FileIO.h"
-
-#include "../../PropID.h"
-
-#include "SysIconUtils.h"
-#ifdef _WIN32
-#include "FSDrives.h"
-#include "NetFolder.h"
-#endif
-
-namespace NWindows {
-namespace NFile {
-
-bool GetLongPath(LPCWSTR path, UString &longPath);
-
-}}
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NFind;
-
-namespace NFsFolder {
-
-static STATPROPSTG kProperties[] =
-{
- { NULL, kpidName, VT_BSTR},
- // { NULL, kpidIsDir, VT_BOOL},
- { NULL, kpidSize, VT_UI8},
- { NULL, kpidMTime, VT_FILETIME},
- { NULL, kpidCTime, VT_FILETIME},
- { NULL, kpidATime, VT_FILETIME},
- { NULL, kpidAttrib, VT_UI4},
- { NULL, kpidPackSize, VT_UI8},
- { NULL, kpidComment, VT_BSTR},
- { NULL, kpidPrefix, VT_BSTR}
-};
-
-HRESULT CFSFolder::Init(const UString &path, IFolderFolder *parentFolder)
-{
- _parentFolder = parentFolder;
- _path = path;
-
-#ifdef _WIN32
- _findChangeNotification.FindFirst(_path, false,
- FILE_NOTIFY_CHANGE_FILE_NAME |
- FILE_NOTIFY_CHANGE_DIR_NAME |
- FILE_NOTIFY_CHANGE_ATTRIBUTES |
- FILE_NOTIFY_CHANGE_SIZE |
- FILE_NOTIFY_CHANGE_LAST_WRITE /*|
- FILE_NOTIFY_CHANGE_LAST_ACCESS |
- FILE_NOTIFY_CHANGE_CREATION |
- FILE_NOTIFY_CHANGE_SECURITY */);
- if (!_findChangeNotification.IsHandleAllocated())
- {
- DWORD lastError = GetLastError();
- CFindFile findFile;
- CFileInfoW fileInfo;
- if (!findFile.FindFirst(_path + UString(L"*"), fileInfo))
- return lastError;
- }
-#endif
- return S_OK;
-}
-
-HRESULT GetFolderSize(const UString &path, UInt64 &numFolders, UInt64 &numFiles, UInt64 &size, IProgress *progress)
-{
- RINOK(progress->SetCompleted(NULL));
- numFiles = numFolders = size = 0;
- CEnumeratorW enumerator(path + UString(WSTRING_PATH_SEPARATOR L"*"));
- CFileInfoW fileInfo;
- while (enumerator.Next(fileInfo))
- {
- if (fileInfo.IsDir())
- {
- UInt64 subFolders, subFiles, subSize;
- RINOK(GetFolderSize(path + UString(WSTRING_PATH_SEPARATOR) + fileInfo.Name, subFolders, subFiles, subSize, progress));
- numFolders += subFolders;
- numFolders++;
- numFiles += subFiles;
- size += subSize;
- }
- else
- {
- numFiles++;
- size += fileInfo.Size;
- }
- }
- return S_OK;
-}
-
-HRESULT CFSFolder::LoadSubItems(CDirItem &dirItem, const UString &path)
-{
- {
- CEnumeratorW enumerator(path + L"*");
- CDirItem fileInfo;
- while (enumerator.Next(fileInfo))
- {
- fileInfo.CompressedSizeIsDefined = false;
- /*
- if (!GetCompressedFileSize(_path + fileInfo.Name,
- fileInfo.CompressedSize))
- fileInfo.CompressedSize = fileInfo.Size;
- */
- if (fileInfo.IsDir())
- {
- // fileInfo.Size = GetFolderSize(_path + fileInfo.Name);
- fileInfo.Size = 0;
- }
- dirItem.Files.Add(fileInfo);
- }
- }
- if (!_flatMode)
- return S_OK;
-
- for (int i = 0; i < dirItem.Files.Size(); i++)
- {
- CDirItem &item = dirItem.Files[i];
- if (item.IsDir())
- LoadSubItems(item, path + item.Name + WCHAR_PATH_SEPARATOR);
- }
- return S_OK;
-}
-
-void CFSFolder::AddRefs(CDirItem &dirItem)
-{
- int i;
- for (i = 0; i < dirItem.Files.Size(); i++)
- {
- CDirItem &item = dirItem.Files[i];
- item.Parent = &dirItem;
- _refs.Add(&item);
- }
- if (!_flatMode)
- return;
- for (i = 0; i < dirItem.Files.Size(); i++)
- {
- CDirItem &item = dirItem.Files[i];
- if (item.IsDir())
- AddRefs(item);
- }
-}
-
-STDMETHODIMP CFSFolder::LoadItems()
-{
- // OutputDebugString(TEXT("Start\n"));
- INT32 dummy;
- WasChanged(&dummy);
- Clear();
- RINOK(LoadSubItems(_root, _path));
- AddRefs(_root);
-
- // OutputDebugString(TEXT("Finish\n"));
- _commentsAreLoaded = false;
- return S_OK;
-}
-
-static const wchar_t *kDescriptionFileName = L"descript.ion";
-
-bool CFSFolder::LoadComments()
-{
- if (_commentsAreLoaded)
- return true;
- _comments.Clear();
- _commentsAreLoaded = true;
- NIO::CInFile file;
- if (!file.Open(_path + kDescriptionFileName))
- return false;
- UInt64 length;
- if (!file.GetLength(length))
- return false;
- if (length >= (1 << 28))
- return false;
- AString s;
- char *p = s.GetBuffer((int)((size_t)length + 1));
- UInt32 processedSize;
- file.Read(p, (UInt32)length, processedSize);
- p[length] = 0;
- s.ReleaseBuffer();
- if (processedSize != length)
- return false;
- file.Close();
- UString unicodeString;
- if (!ConvertUTF8ToUnicode(s, unicodeString))
- return false;
- return _comments.ReadFromString(unicodeString);
-}
-
-static bool IsAscii(const UString &testString)
-{
- for (int i = 0; i < testString.Length(); i++)
- if (testString[i] >= 0x80)
- return false;
- return true;
-}
-
-bool CFSFolder::SaveComments()
-{
- NIO::COutFile file;
- if (!file.Create(_path + kDescriptionFileName, true))
- return false;
- UString unicodeString;
- _comments.SaveToString(unicodeString);
- AString utfString;
- ConvertUnicodeToUTF8(unicodeString, utfString);
- UInt32 processedSize;
- if (!IsAscii(unicodeString))
- {
- Byte bom [] = { 0xEF, 0xBB, 0xBF, 0x0D, 0x0A };
- file.Write(bom , sizeof(bom), processedSize);
- }
- file.Write(utfString, utfString.Length(), processedSize);
- _commentsAreLoaded = false;
- return true;
-}
-
-STDMETHODIMP CFSFolder::GetNumberOfItems(UInt32 *numItems)
-{
- *numItems = _refs.Size();
- return S_OK;
-}
-
-/*
-STDMETHODIMP CFSFolder::GetNumberOfSubFolders(UInt32 *numSubFolders)
-{
- UInt32 numSubFoldersLoc = 0;
- for (int i = 0; i < _files.Size(); i++)
- if (_files[i].IsDir())
- numSubFoldersLoc++;
- *numSubFolders = numSubFoldersLoc;
- return S_OK;
-}
-*/
-
-#ifdef _WIN32
-bool MyGetCompressedFileSizeW(LPCWSTR fileName, UInt64 &size)
-{
- DWORD highPart;
- DWORD lowPart = ::GetCompressedFileSizeW(fileName, &highPart);
- if (lowPart == INVALID_FILE_SIZE && ::GetLastError() != NO_ERROR)
- {
- #ifdef WIN_LONG_PATH
- {
- UString longPath;
- if (GetLongPath(fileName, longPath))
- lowPart = ::GetCompressedFileSizeW(longPath, &highPart);
- }
- #endif
- if (lowPart == INVALID_FILE_SIZE && ::GetLastError() != NO_ERROR)
- return false;
- }
- size = (UInt64(highPart) << 32) | lowPart;
- return true;
-}
-#endif
-
-STDMETHODIMP CFSFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
-{
- NCOM::CPropVariant prop;
- if (itemIndex >= (UInt32)_refs.Size())
- return E_INVALIDARG;
- CDirItem &fileInfo = *_refs[itemIndex];
- switch(propID)
- {
- case kpidIsDir: prop = fileInfo.IsDir(); break;
- case kpidName: prop = fileInfo.Name; break;
- case kpidSize: if (!fileInfo.IsDir()) prop = fileInfo.Size; break;
- case kpidPackSize:
- if (!fileInfo.CompressedSizeIsDefined)
- {
- fileInfo.CompressedSizeIsDefined = true;
-#ifdef _WIN32
- if (fileInfo.IsDir () ||
- !MyGetCompressedFileSizeW(_path + GetRelPath(fileInfo), fileInfo.CompressedSize))
-#endif
- fileInfo.CompressedSize = fileInfo.Size;
- }
- prop = fileInfo.CompressedSize;
- break;
- case kpidAttrib: prop = (UInt32)fileInfo.Attrib; break;
- case kpidCTime: prop = fileInfo.CTime; break;
- case kpidATime: prop = fileInfo.ATime; break;
- case kpidMTime: prop = fileInfo.MTime; break;
- case kpidComment:
- {
- LoadComments();
- UString comment;
- if (_comments.GetValue(GetRelPath(fileInfo), comment))
- prop = comment;
- break;
- }
- case kpidPrefix:
- {
- if (_flatMode)
- {
- prop = GetPrefix(fileInfo);
- }
- break;
- }
- }
- prop.Detach(value);
- return S_OK;
-}
-
-HRESULT CFSFolder::BindToFolderSpec(const wchar_t *name, IFolderFolder **resultFolder)
-{
- *resultFolder = 0;
- CFSFolder *folderSpec = new CFSFolder;
- CMyComPtr<IFolderFolder> subFolder = folderSpec;
- RINOK(folderSpec->Init(_path + name + UString(WCHAR_PATH_SEPARATOR), 0));
- *resultFolder = subFolder.Detach();
- return S_OK;
-}
-
-UString CFSFolder::GetPrefix(const CDirItem &item) const
-{
- UString path;
- CDirItem *cur = item.Parent;
- while (cur->Parent != 0)
- {
- path = cur->Name + UString(WCHAR_PATH_SEPARATOR) + path;
- cur = cur->Parent;
- }
- return path;
-}
-
-UString CFSFolder::GetRelPath(const CDirItem &item) const
-{
- return GetPrefix(item) + item.Name;
-}
-
-STDMETHODIMP CFSFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
-{
- *resultFolder = 0;
- const CDirItem &fileInfo = *_refs[index];
- if (!fileInfo.IsDir())
- return E_INVALIDARG;
- return BindToFolderSpec(GetRelPath(fileInfo), resultFolder);
-}
-
-STDMETHODIMP CFSFolder::BindToFolder(const wchar_t *name, IFolderFolder **resultFolder)
-{
- return BindToFolderSpec(name, resultFolder);
-}
-
-STDMETHODIMP CFSFolder::BindToParentFolder(IFolderFolder **resultFolder)
-{
- *resultFolder = 0;
- if (_parentFolder)
- {
- CMyComPtr<IFolderFolder> parentFolder = _parentFolder;
- *resultFolder = parentFolder.Detach();
- return S_OK;
- }
- if (_path.IsEmpty())
- return E_INVALIDARG;
- printf("CFSFolder::BindToParentFolder path='%ls'\n",(const wchar_t *)_path);
- int pos = _path.ReverseFind(WCHAR_PATH_SEPARATOR);
- if (pos < 0 || pos != _path.Length() - 1)
- return E_FAIL;
- UString parentPath = _path.Left(pos);
- printf("CFSFolder::BindToParentFolder parentPath='%ls'\n",(const wchar_t *)parentPath);
- pos = parentPath.ReverseFind(WCHAR_PATH_SEPARATOR);
- if (pos < 0)
- {
-#ifdef _WIN32
- parentPath.Empty();
- CFSDrives *drivesFolderSpec = new CFSDrives;
- CMyComPtr<IFolderFolder> drivesFolder = drivesFolderSpec;
- drivesFolderSpec->Init();
- *resultFolder = drivesFolder.Detach();
-#else
- parentPath = WSTRING_PATH_SEPARATOR;
- CFSFolder *parentFolderSpec = new CFSFolder;
- CMyComPtr<IFolderFolder> parentFolder = parentFolderSpec;
- printf("CFSFolder::BindToParentFolder Init-0 with parentPath='%ls'\n",(const wchar_t *)parentPath);
- RINOK(parentFolderSpec->Init(parentPath, 0));
- *resultFolder = parentFolder.Detach();
-#endif
- return S_OK;
- }
- UString parentPathReduced = parentPath.Left(pos);
- parentPath = parentPath.Left(pos + 1);
- pos = parentPathReduced.ReverseFind(WCHAR_PATH_SEPARATOR);
- if (pos == 1)
- {
-#ifdef _WIN32
- if (parentPath[0] != WCHAR_PATH_SEPARATOR)
- return E_FAIL;
- CNetFolder *netFolderSpec = new CNetFolder;
- CMyComPtr<IFolderFolder> netFolder = netFolderSpec;
- netFolderSpec->Init(parentPath);
- *resultFolder = netFolder.Detach();
-#else
- parentPath = WSTRING_PATH_SEPARATOR;
- CFSFolder *parentFolderSpec = new CFSFolder;
- CMyComPtr<IFolderFolder> parentFolder = parentFolderSpec;
- printf("CFSFolder::BindToParentFolder Init-1 with parentPath='%ls'\n",(const wchar_t *)parentPath);
- RINOK(parentFolderSpec->Init(parentPath, 0));
- *resultFolder = parentFolder.Detach();
-#endif // ifdef _WIN32
- return S_OK;
- }
- CFSFolder *parentFolderSpec = new CFSFolder;
- CMyComPtr<IFolderFolder> parentFolder = parentFolderSpec;
- printf("CFSFolder::BindToParentFolder Init-2 with parentPath='%ls'\n",(const wchar_t *)parentPath);
- RINOK(parentFolderSpec->Init(parentPath, 0));
- *resultFolder = parentFolder.Detach();
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::GetNumberOfProperties(UInt32 *numProperties)
-{
- *numProperties = sizeof(kProperties) / sizeof(kProperties[0]);
- if (!_flatMode)
- (*numProperties)--;
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::GetPropertyInfo(UInt32 index,
- BSTR *name, PROPID *propID, VARTYPE *varType)
-{
- if (index >= sizeof(kProperties) / sizeof(kProperties[0]))
- return E_INVALIDARG;
- const STATPROPSTG &prop = kProperties[index];
- *propID = prop.propid;
- *varType = prop.vt;
- *name = 0;
- return S_OK;
-}
-
-
-STDMETHODIMP CFSFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value)
-{
- COM_TRY_BEGIN
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidType: prop = L"FSFolder"; break;
- case kpidPath: prop = _path; break;
- }
- prop.Detach(value);
- return S_OK;
- COM_TRY_END
-}
-
-STDMETHODIMP CFSFolder::WasChanged(INT32 *wasChanged)
-{
- bool wasChangedMain = false;
-#ifdef _WIN32
- for (;;)
- {
- if (!_findChangeNotification.IsHandleAllocated())
- {
- *wasChanged = BoolToInt(false);
- return S_OK;
- }
-
- DWORD waitResult = ::WaitForSingleObject(_findChangeNotification, 0);
- bool wasChangedLoc = (waitResult == WAIT_OBJECT_0);
- if (wasChangedLoc)
- {
- _findChangeNotification.FindNext();
- wasChangedMain = true;
- }
- else
- break;
- }
-#endif
- *wasChanged = BoolToInt(wasChangedMain);
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::Clone(IFolderFolder **resultFolder)
-{
- CFSFolder *fsFolderSpec = new CFSFolder;
- CMyComPtr<IFolderFolder> folderNew = fsFolderSpec;
- fsFolderSpec->Init(_path, 0);
- *resultFolder = folderNew.Detach();
- return S_OK;
-}
-
-HRESULT CFSFolder::GetItemsFullSize(const UInt32 *indices, UInt32 numItems,
- UInt64 &numFolders, UInt64 &numFiles, UInt64 &size, IProgress *progress)
-{
- numFiles = numFolders = size = 0;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- {
- int index = indices[i];
- if (index >= _refs.Size())
- return E_INVALIDARG;
- const CDirItem &fileInfo = *_refs[index];
- if (fileInfo.IsDir())
- {
- UInt64 subFolders, subFiles, subSize;
- RINOK(GetFolderSize(_path + GetRelPath(fileInfo), subFolders, subFiles, subSize, progress));
- numFolders += subFolders;
- numFolders++;
- numFiles += subFiles;
- size += subSize;
- }
- else
- {
- numFiles++;
- size += fileInfo.Size;
- }
- }
- return S_OK;
-}
-
-HRESULT CFSFolder::GetItemFullSize(int index, UInt64 &size, IProgress *progress)
-{
- const CDirItem &fileInfo = *_refs[index];
- if (fileInfo.IsDir())
- {
- /*
- CMyComPtr<IFolderFolder> subFolder;
- RINOK(BindToFolder(index, &subFolder));
- CMyComPtr<IFolderReload> aFolderReload;
- subFolder.QueryInterface(&aFolderReload);
- aFolderReload->Reload();
- UInt32 numItems;
- RINOK(subFolder->GetNumberOfItems(&numItems));
- CMyComPtr<IFolderGetItemFullSize> aGetItemFullSize;
- subFolder.QueryInterface(&aGetItemFullSize);
- for (UInt32 i = 0; i < numItems; i++)
- {
- UInt64 size;
- RINOK(aGetItemFullSize->GetItemFullSize(i, &size));
- *totalSize += size;
- }
- */
- UInt64 numFolders, numFiles;
- return GetFolderSize(_path + GetRelPath(fileInfo), numFolders, numFiles, size, progress);
- }
- size = fileInfo.Size;
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::GetItemFullSize(UInt32 index, PROPVARIANT *value, IProgress *progress)
-{
- NCOM::CPropVariant prop;
- if (index >= (UInt32)_refs.Size())
- return E_INVALIDARG;
- UInt64 size = 0;
- HRESULT result = GetItemFullSize(index, size, progress);
- prop = size;
- prop.Detach(value);
- return result;
-}
-
-HRESULT CFSFolder::GetComplexName(const wchar_t *name, UString &resultPath)
-{
- UString newName = name;
- resultPath = _path + newName;
- if (newName.Length() < 1)
- return S_OK;
- if (newName[0] == WCHAR_PATH_SEPARATOR)
- {
- resultPath = newName;
- return S_OK;
- }
- if (newName.Length() < 2)
- return S_OK;
- if (newName[1] == L':')
- resultPath = newName;
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::CreateFolder(const wchar_t *name, IProgress * /* progress */)
-{
- UString processedName;
- RINOK(GetComplexName(name, processedName));
- if(NDirectory::MyCreateDirectory(processedName))
- return S_OK;
- if(::GetLastError() == ERROR_ALREADY_EXISTS)
- return ::GetLastError();
- if (!NDirectory::CreateComplexDirectory(processedName))
- return ::GetLastError();
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::CreateFile(const wchar_t *name, IProgress * /* progress */)
-{
- UString processedName;
- RINOK(GetComplexName(name, processedName));
- NIO::COutFile outFile;
- if (!outFile.Create(processedName, false))
- return ::GetLastError();
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::Rename(UInt32 index, const wchar_t *newName, IProgress * /* progress */)
-{
- const CDirItem &fileInfo = *_refs[index];
- const UString fullPrefix = _path + GetPrefix(fileInfo);
- if (!NDirectory::MyMoveFile(fullPrefix + fileInfo.Name, fullPrefix + newName))
- return GetLastError();
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::Delete(const UInt32 *indices, UInt32 numItems,IProgress *progress)
-{
-#ifdef _WIN32
- RINOK(progress->SetTotal(numItems));
- for (UInt32 i = 0; i < numItems; i++)
- {
- const CDirItem &fileInfo = *_refs[indices[i]];
- const UString fullPath = _path + GetRelPath(fileInfo);
- bool result;
- if (fileInfo.IsDir())
- result = NDirectory::RemoveDirectoryWithSubItems(fullPath);
- else
- result = NDirectory::DeleteFileAlways(fullPath);
- if (!result)
- return GetLastError();
- UInt64 completed = i;
- RINOK(progress->SetCompleted(&completed));
- }
-#endif
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::SetProperty(UInt32 index, PROPID propID,
- const PROPVARIANT *value, IProgress * /* progress */)
-{
- if (index >= (UInt32)_refs.Size())
- return E_INVALIDARG;
- CDirItem &fileInfo = *_refs[index];
- if (fileInfo.Parent->Parent != 0)
- return E_NOTIMPL;
- switch(propID)
- {
- case kpidComment:
- {
- UString filename = fileInfo.Name;
- filename.Trim();
- if (value->vt == VT_EMPTY)
- _comments.DeletePair(filename);
- else if (value->vt == VT_BSTR)
- {
- CTextPair pair;
- pair.ID = filename;
- pair.ID.Trim();
- pair.Value = value->bstrVal;
- pair.Value.Trim();
- if (pair.Value.IsEmpty())
- _comments.DeletePair(filename);
- else
- _comments.AddPair(pair);
- }
- else
- return E_INVALIDARG;
- SaveComments();
- break;
- }
- default:
- return E_NOTIMPL;
- }
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
-{
-#ifdef _WIN32
- if (index >= (UInt32)_refs.Size())
- return E_INVALIDARG;
- const CDirItem &fileInfo = *_refs[index];
- *iconIndex = 0;
- int iconIndexTemp;
- if (GetRealIconIndex(_path + GetRelPath(fileInfo), fileInfo.Attributes, iconIndexTemp) != 0)
- {
- *iconIndex = iconIndexTemp;
- return S_OK;
- }
- return GetLastError();
-#endif
- *iconIndex = 0;
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::SetFlatMode(Int32 flatMode)
-{
- _flatMode = IntToBool(flatMode);
- return S_OK;
-}
-
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSFolder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSFolder.h
deleted file mode 100644
index 4f65f9771..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSFolder.h
+++ /dev/null
@@ -1,120 +0,0 @@
-// FSFolder.h
-
-#ifndef __FSFOLDER_H
-#define __FSFOLDER_H
-
-#include "Common/MyString.h"
-#include "Common/MyCom.h"
-#include "Windows/FileFind.h"
-#include "Windows/PropVariant.h"
-
-#include "IFolder.h"
-
-#include "TextPairs.h"
-
-namespace NFsFolder {
-
-class CFSFolder;
-
-struct CFileInfoEx: public NWindows::NFile::NFind::CFileInfoW
-{
- bool CompressedSizeIsDefined;
- UInt64 CompressedSize;
-};
-
-struct CDirItem;
-
-struct CDirItem: public CFileInfoEx
-{
- CDirItem *Parent;
- CObjectVector<CDirItem> Files;
-
- CDirItem(): Parent(0) {}
- void Clear()
- {
- Files.Clear();
- Parent = 0;
- }
-};
-
-class CFSFolder:
- public IFolderFolder,
- public IFolderWasChanged,
- public IFolderOperations,
- // public IFolderOperationsDeleteToRecycleBin,
- public IFolderGetItemFullSize,
- public IFolderClone,
- public IFolderGetSystemIconIndex,
- public IFolderSetFlatMode,
- public CMyUnknownImp
-{
- UInt64 GetSizeOfItem(int anIndex) const;
-public:
- MY_QUERYINTERFACE_BEGIN
- MY_QUERYINTERFACE_ENTRY(IFolderWasChanged)
- // MY_QUERYINTERFACE_ENTRY(IFolderOperationsDeleteToRecycleBin)
- MY_QUERYINTERFACE_ENTRY(IFolderOperations)
- MY_QUERYINTERFACE_ENTRY(IFolderGetItemFullSize)
- MY_QUERYINTERFACE_ENTRY(IFolderClone)
- MY_QUERYINTERFACE_ENTRY(IFolderGetSystemIconIndex)
- MY_QUERYINTERFACE_ENTRY(IFolderSetFlatMode)
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
-
- INTERFACE_FolderFolder(;)
- INTERFACE_FolderOperations(;)
-
- STDMETHOD(WasChanged)(INT32 *wasChanged);
- STDMETHOD(Clone)(IFolderFolder **resultFolder);
- STDMETHOD(GetItemFullSize)(UInt32 index, PROPVARIANT *value, IProgress *progress);
-
- STDMETHOD(SetFlatMode)(Int32 flatMode);
-
- STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex);
-
-private:
- UString _path;
- CDirItem _root;
- CRecordVector<CDirItem *> _refs;
-
- CMyComPtr<IFolderFolder> _parentFolder;
-
- bool _commentsAreLoaded;
- CPairsStorage _comments;
-
- bool _flatMode;
-
- // FIXME NWindows::NFile::NFind::CFindChangeNotification _findChangeNotification;
-
- HRESULT GetItemsFullSize(const UInt32 *indices, UInt32 numItems,
- UInt64 &numFolders, UInt64 &numFiles, UInt64 &size, IProgress *progress);
- HRESULT GetItemFullSize(int index, UInt64 &size, IProgress *progress);
- HRESULT GetComplexName(const wchar_t *name, UString &resultPath);
- HRESULT BindToFolderSpec(const wchar_t *name, IFolderFolder **resultFolder);
-
- bool LoadComments();
- bool SaveComments();
- HRESULT LoadSubItems(CDirItem &dirItem, const UString &path);
- void AddRefs(CDirItem &dirItem);
-public:
- HRESULT Init(const UString &path, IFolderFolder *parentFolder);
-
- CFSFolder() : _flatMode(false) {}
-
- UString GetPrefix(const CDirItem &item) const;
- UString GetRelPath(const CDirItem &item) const;
- UString GetRelPath(UInt32 index) const { return GetRelPath(*_refs[index]); }
-
- void Clear()
- {
- _root.Clear();
- _refs.Clear();
- }
-};
-
-HRESULT GetFolderSize(const UString &path, UInt64 &numFolders, UInt64 &numFiles, UInt64 &size, IProgress *progress);
-
-}
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSFolderCopy.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSFolderCopy.cpp
deleted file mode 100644
index db1ba2ba4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FSFolderCopy.cpp
+++ /dev/null
@@ -1,523 +0,0 @@
-// FSFolderCopy.cpp
-
-#include "StdAfx.h"
-
-// FIXME #include <Winbase.h>
-
-#include "FSFolder.h"
-#include "Windows/FileDir.h"
-#include "Windows/Error.h"
-
-#include "Common/StringConvert.h"
-
-#include "../../Common/FilePathAutoRename.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NFind;
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-namespace NFsFolder {
-
-/*
-static bool IsItWindows2000orHigher()
-{
- OSVERSIONINFO versionInfo;
- versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
- return false;
- return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
- (versionInfo.dwMajorVersion >= 5);
-}
-*/
-
-struct CProgressInfo
-{
- UInt64 StartPos;
- IProgress *Progress;
-};
-
-#ifdef _WIN32
-
-static DWORD CALLBACK CopyProgressRoutine(
- LARGE_INTEGER /* TotalFileSize */, // file size
- LARGE_INTEGER TotalBytesTransferred, // bytes transferred
- LARGE_INTEGER /* StreamSize */, // bytes in stream
- LARGE_INTEGER /* StreamBytesTransferred */, // bytes transferred for stream
- DWORD /* dwStreamNumber */, // current stream
- DWORD /* dwCallbackReason */, // callback reason
- HANDLE /* hSourceFile */, // handle to source file
- HANDLE /* hDestinationFile */, // handle to destination file
- LPVOID lpData // from CopyFileEx
-)
-{
- CProgressInfo &progressInfo = *(CProgressInfo *)lpData;
- UInt64 completed = progressInfo.StartPos + TotalBytesTransferred.QuadPart;
- if (progressInfo.Progress->SetCompleted(&completed) != S_OK)
- return PROGRESS_CANCEL;
- return PROGRESS_CONTINUE;
-}
-
-typedef BOOL (WINAPI * CopyFileExPointer)(
- IN LPCSTR lpExistingFileName,
- IN LPCSTR lpNewFileName,
- IN LPPROGRESS_ROUTINE lpProgressRoutine OPTIONAL,
- IN LPVOID lpData OPTIONAL,
- IN LPBOOL pbCancel OPTIONAL,
- IN DWORD dwCopyFlags
- );
-
-typedef BOOL (WINAPI * CopyFileExPointerW)(
- IN LPCWSTR lpExistingFileName,
- IN LPCWSTR lpNewFileName,
- IN LPPROGRESS_ROUTINE lpProgressRoutine OPTIONAL,
- IN LPVOID lpData OPTIONAL,
- IN LPBOOL pbCancel OPTIONAL,
- IN DWORD dwCopyFlags
- );
-
-#ifndef _UNICODE
-static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
-static CSysString GetSysPath(LPCWSTR sysPath)
- { return UnicodeStringToMultiByte(sysPath, GetCurrentCodePage()); }
-#endif
-
-#endif
-
-static bool MyCopyFile(LPCWSTR existingFile, LPCWSTR newFile, IProgress *progress, UInt64 &completedSize)
-{
-#ifdef _WIN32
- CProgressInfo progressInfo;
- progressInfo.Progress = progress;
- progressInfo.StartPos = completedSize;
- BOOL CancelFlag = FALSE;
- #ifndef _UNICODE
- if (g_IsNT)
- #endif
- {
- CopyFileExPointerW copyFunctionW = (CopyFileExPointerW)
- ::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"),
- "CopyFileExW");
- if (copyFunctionW == 0)
- return false;
- if (copyFunctionW(existingFile, newFile, CopyProgressRoutine,
- &progressInfo, &CancelFlag, COPY_FILE_FAIL_IF_EXISTS))
- return true;
- #ifdef WIN_LONG_PATH
- UString longPathExisting, longPathNew;
- if (!NDirectory::GetLongPaths(existingFile, newFile, longPathExisting, longPathNew))
- return false;
- if (copyFunctionW(longPathExisting, longPathNew, CopyProgressRoutine,
- &progressInfo, &CancelFlag, COPY_FILE_FAIL_IF_EXISTS))
- return true;
- #endif
- return false;
- }
- #ifndef _UNICODE
- else
- {
- CopyFileExPointer copyFunction = (CopyFileExPointer)
- ::GetProcAddress(::GetModuleHandleA("kernel32.dll"),
- "CopyFileExA");
- if (copyFunction != 0)
- {
- if (copyFunction(GetSysPath(existingFile), GetSysPath(newFile),
- CopyProgressRoutine,&progressInfo, &CancelFlag, COPY_FILE_FAIL_IF_EXISTS))
- return true;
- if (::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
- return false;
- }
- return BOOLToBool(::CopyFile(GetSysPath(existingFile), GetSysPath(newFile), TRUE));
- }
- #endif
-#else
- extern bool wxw_CopyFile(LPCWSTR existingFile, LPCWSTR newFile, bool overwrite);
- return wxw_CopyFile(existingFile, newFile, true);
-#endif
-}
-
-#ifdef _WIN32
-typedef BOOL (WINAPI * MoveFileWithProgressPointer)(
- IN LPCWSTR lpExistingFileName,
- IN LPCWSTR lpNewFileName,
- IN LPPROGRESS_ROUTINE lpProgressRoutine OPTIONAL,
- IN LPVOID lpData OPTIONAL,
- IN DWORD dwFlags
- );
-#endif
-
-static bool MyMoveFile(LPCWSTR existingFile, LPCWSTR newFile, IProgress *progress, UInt64 &completedSize)
-{
-#ifdef _WIN32
- // if (IsItWindows2000orHigher())
- // {
- CProgressInfo progressInfo;
- progressInfo.Progress = progress;
- progressInfo.StartPos = completedSize;
-
- MoveFileWithProgressPointer moveFunction = (MoveFileWithProgressPointer)
- ::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")),
- "MoveFileWithProgressW");
- if (moveFunction != 0)
- {
- if (moveFunction(
- existingFile, newFile, CopyProgressRoutine,
- &progressInfo, MOVEFILE_COPY_ALLOWED))
- return true;
- if (::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
- {
- #ifdef WIN_LONG_PATH
- UString longPathExisting, longPathNew;
- if (!NDirectory::GetLongPaths(existingFile, newFile, longPathExisting, longPathNew))
- return false;
- if (moveFunction(longPathExisting, longPathNew, CopyProgressRoutine,
- &progressInfo, MOVEFILE_COPY_ALLOWED))
- return true;
- #endif
- if (::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
- return false;
- }
- }
- // }
- // else
-#endif
- return NDirectory::MyMoveFile(existingFile, newFile);
-}
-
-static HRESULT MyCopyFile(
- const UString &srcPath,
- const CFileInfoW &srcFileInfo,
- const UString &destPathSpec,
- IFolderOperationsExtractCallback *callback,
- UInt64 &completedSize)
-{
- UString destPath = destPathSpec;
- if (destPath.CompareNoCase(srcPath) == 0)
- {
- UString message = UString(L"can not move file \'") + destPath + UString(L"\' onto itself");
- RINOK(callback->ShowMessage(message));
- return E_ABORT;
- }
-
- INT32 writeAskResult;
- CMyComBSTR destPathResult;
- RINOK(callback->AskWrite(
- srcPath,
- BoolToInt(false),
- &srcFileInfo.MTime, &srcFileInfo.Size,
- destPath,
- &destPathResult,
- &writeAskResult));
- if (IntToBool(writeAskResult))
- {
- UString destPathNew = UString(destPathResult);
- RINOK(callback->SetCurrentFilePath(srcPath));
- if (!MyCopyFile(srcPath, destPathNew, callback, completedSize))
- {
- UString message = NError::MyFormatMessageW(GetLastError()) +
- UString(L" \'") +
- UString(destPathNew) +
- UString(L"\'");
- RINOK(callback->ShowMessage(message));
- return E_ABORT;
- }
- }
- completedSize += srcFileInfo.Size;
- return callback->SetCompleted(&completedSize);
-}
-
-static HRESULT CopyFolder(
- const UString &srcPath,
- const UString &destPathSpec,
- IFolderOperationsExtractCallback *callback,
- UInt64 &completedSize)
-{
- RINOK(callback->SetCompleted(&completedSize));
-
- UString destPath = destPathSpec;
- int len = srcPath.Length();
- if (destPath.Length() >= len && srcPath.CompareNoCase(destPath.Left(len)) == 0)
- {
- if (destPath.Length() == len || destPath[len] == WCHAR_PATH_SEPARATOR)
- {
- UString message = UString(L"can not copy folder \'") +
- destPath + UString(L"\' onto itself");
- RINOK(callback->ShowMessage(message));
- return E_ABORT;
- }
- }
-
- if (!NDirectory::CreateComplexDirectory(destPath))
- {
- UString message = UString(L"can not create folder ") + destPath;
- RINOK(callback->ShowMessage(message));
- return E_ABORT;
- }
- CEnumeratorW enumerator(srcPath + UString(WSTRING_PATH_SEPARATOR L"*"));
- CFileInfoEx fileInfo;
- while (enumerator.Next(fileInfo))
- {
- const UString srcPath2 = srcPath + UString(WSTRING_PATH_SEPARATOR) + fileInfo.Name;
- const UString destPath2 = destPath + UString(WSTRING_PATH_SEPARATOR) + fileInfo.Name;
- if (fileInfo.IsDir())
- {
- RINOK(CopyFolder(srcPath2, destPath2, callback, completedSize));
- }
- else
- {
- RINOK(MyCopyFile(srcPath2, fileInfo, destPath2, callback, completedSize));
- }
- }
- return S_OK;
-}
-
-
-STDMETHODIMP CFSFolder::CopyTo(const UInt32 *indices, UInt32 numItems,
- const wchar_t *path, IFolderOperationsExtractCallback *callback)
-{
- if (numItems == 0)
- return S_OK;
-
- UInt64 numFolders, numFiles, totalSize;
- GetItemsFullSize(indices, numItems, numFolders, numFiles, totalSize, callback);
- RINOK(callback->SetTotal(totalSize));
- RINOK(callback->SetNumFiles(numFiles));
-
- UString destPath = path;
- if (destPath.IsEmpty())
- return E_INVALIDARG;
- bool directName = (destPath[destPath.Length() - 1] != WCHAR_PATH_SEPARATOR);
- if (directName)
- {
- if (numItems > 1)
- return E_INVALIDARG;
- }
- /*
- // doesn't work in network
- else
- if (!NDirectory::CreateComplexDirectory(destPath)))
- {
- DWORD lastError = ::GetLastError();
- UString message = UString(L"can not create folder ") +
- destPath;
- RINOK(callback->ShowMessage(message));
- return E_ABORT;
- }
- */
-
- UInt64 completedSize = 0;
- RINOK(callback->SetCompleted(&completedSize));
- for (UInt32 i = 0; i < numItems; i++)
- {
- const CDirItem &fileInfo = *_refs[indices[i]];
- UString destPath2 = destPath;
- if (!directName)
- destPath2 += fileInfo.Name;
- UString srcPath = _path + GetPrefix(fileInfo) + fileInfo.Name;
- if (fileInfo.IsDir())
- {
- RINOK(CopyFolder(srcPath, destPath2, callback, completedSize));
- }
- else
- {
- RINOK(MyCopyFile(srcPath, fileInfo, destPath2, callback, completedSize));
- }
- }
- return S_OK;
-}
-
-/////////////////////////////////////////////////
-// Move Operations
-
-HRESULT MyMoveFile(
- const UString &srcPath,
- const CFileInfoW &srcFileInfo,
- const UString &destPathSpec,
- IFolderOperationsExtractCallback *callback,
- UInt64 &completedSize)
-{
- UString destPath = destPathSpec;
- if (destPath.CompareNoCase(srcPath) == 0)
- {
- UString message = UString(L"can not move file \'")
- + destPath +
- UString(L"\' onto itself");
- RINOK(callback->ShowMessage(message));
- return E_ABORT;
- }
-
- INT32 writeAskResult;
- CMyComBSTR destPathResult;
- RINOK(callback->AskWrite(
- srcPath,
- BoolToInt(false),
- &srcFileInfo.MTime, &srcFileInfo.Size,
- destPath,
- &destPathResult,
- &writeAskResult));
- if (IntToBool(writeAskResult))
- {
- UString destPathNew = UString(destPathResult);
- RINOK(callback->SetCurrentFilePath(srcPath));
- if (!MyMoveFile(srcPath, destPathNew, callback, completedSize))
- {
- UString message = UString(L"can not move to file ") + destPathNew;
- RINOK(callback->ShowMessage(message));
- }
- }
- completedSize += srcFileInfo.Size;
- RINOK(callback->SetCompleted(&completedSize));
- return S_OK;
-}
-
-HRESULT MyMoveFolder(
- const UString &srcPath,
- const UString &destPathSpec,
- IFolderOperationsExtractCallback *callback,
- UInt64 &completedSize)
-{
- UString destPath = destPathSpec;
- int len = srcPath.Length();
- if (destPath.Length() >= len && srcPath.CompareNoCase(destPath.Left(len)) == 0)
- {
- if (destPath.Length() == len || destPath[len] == WCHAR_PATH_SEPARATOR)
- {
- UString message = UString(L"can not move folder \'") +
- destPath + UString(L"\' onto itself");
- RINOK(callback->ShowMessage(message));
- return E_ABORT;
- }
- }
-
- if (MyMoveFile(srcPath, destPath, callback, completedSize))
- return S_OK;
-
- if (!NDirectory::CreateComplexDirectory(destPath))
- {
- UString message = UString(L"can not create folder ") + destPath;
- RINOK(callback->ShowMessage(message));
- return E_ABORT;
- }
- {
- CEnumeratorW enumerator(srcPath + UString(WSTRING_PATH_SEPARATOR L"*"));
- CFileInfoEx fileInfo;
- while (enumerator.Next(fileInfo))
- {
- const UString srcPath2 = srcPath + UString(WSTRING_PATH_SEPARATOR) + fileInfo.Name;
- const UString destPath2 = destPath + UString(WSTRING_PATH_SEPARATOR) + fileInfo.Name;
- if (fileInfo.IsDir())
- {
- RINOK(MyMoveFolder(srcPath2, destPath2, callback, completedSize));
- }
- else
- {
- RINOK(MyMoveFile(srcPath2, fileInfo, destPath2, callback, completedSize));
- }
- }
- }
- if (!NDirectory::MyRemoveDirectory(srcPath))
- {
- UString message = UString(L"can not remove folder") + srcPath;
- RINOK(callback->ShowMessage(message));
- return E_ABORT;
- }
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::MoveTo(
- const UInt32 *indices,
- UInt32 numItems,
- const wchar_t *path,
- IFolderOperationsExtractCallback *callback)
-{
- if (numItems == 0)
- return S_OK;
-
- UInt64 numFolders, numFiles, totalSize;
- GetItemsFullSize(indices, numItems, numFolders, numFiles, totalSize, callback);
- RINOK(callback->SetTotal(totalSize));
- RINOK(callback->SetNumFiles(numFiles));
-
- UString destPath = path;
- if (destPath.IsEmpty())
- return E_INVALIDARG;
- bool directName = (destPath[destPath.Length() - 1] != WCHAR_PATH_SEPARATOR);
- if (directName)
- {
- if (numItems > 1)
- return E_INVALIDARG;
- }
- else
- if (!NDirectory::CreateComplexDirectory(destPath))
- {
- UString message = UString(L"can not create folder ") +
- destPath;
- RINOK(callback->ShowMessage(message));
- return E_ABORT;
- }
-
- UInt64 completedSize = 0;
- RINOK(callback->SetCompleted(&completedSize));
- for (UInt32 i = 0; i < numItems; i++)
- {
- const CDirItem &fileInfo = *_refs[indices[i]];
- UString destPath2 = destPath;
- if (!directName)
- destPath2 += fileInfo.Name;
- UString srcPath = _path + GetPrefix(fileInfo) + fileInfo.Name;
- if (fileInfo.IsDir())
- {
- RINOK(MyMoveFolder(srcPath, destPath2, callback, completedSize));
- }
- else
- {
- RINOK(MyMoveFile(srcPath, fileInfo, destPath2, callback, completedSize));
- }
- }
- return S_OK;
-}
-
-STDMETHODIMP CFSFolder::CopyFrom(const wchar_t * /* fromFolderPath */,
- const wchar_t ** /* itemsPaths */, UInt32 /* numItems */, IProgress * /* progress */)
-{
- /*
- UInt64 numFolders, numFiles, totalSize;
- numFiles = numFolders = totalSize = 0;
- UInt32 i;
- for (i = 0; i < numItems; i++)
- {
- UString path = (UString)fromFolderPath + itemsPaths[i];
-
- CFileInfoW fileInfo;
- if (!FindFile(path, fileInfo))
- return ::GetLastError();
- if (fileInfo.IsDir())
- {
- UInt64 subFolders, subFiles, subSize;
- RINOK(GetFolderSize(path + UString(WSTRING_PATH_SEPARATOR) + fileInfo.Name, subFolders, subFiles, subSize, progress));
- numFolders += subFolders;
- numFolders++;
- numFiles += subFiles;
- totalSize += subSize;
- }
- else
- {
- numFiles++;
- totalSize += fileInfo.Size;
- }
- }
- RINOK(progress->SetTotal(totalSize));
- RINOK(callback->SetNumFiles(numFiles));
- for (i = 0; i < numItems; i++)
- {
- UString path = (UString)fromFolderPath + itemsPaths[i];
- }
- return S_OK;
- */
- return E_NOTIMPL;
-}
-
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp
deleted file mode 100644
index cfc15d383..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-// FileFolderPluginOpen.cpp
-
-#include "StdAfx.h"
-
-#include "resource.h"
-
-#include "Windows/Thread.h"
-
-#include "../Agent/Agent.h"
-
-#include "LangUtils.h"
-#include "OpenCallback.h"
-#include "PluginLoader.h"
-#include "RegistryAssociations.h"
-#include "RegistryPlugins.h"
-
-using namespace NWindows;
-using namespace NRegistryAssociations;
-
-struct CThreadArchiveOpen
-{
- UString Path;
- CMyComPtr<IInStream> InStream;
- CMyComPtr<IFolderManager> FolderManager;
- CMyComPtr<IProgress> OpenCallback;
- COpenArchiveCallback *OpenCallbackSpec;
-
- CMyComPtr<IFolderFolder> Folder;
- HRESULT Result;
-
- void Process()
- {
- OpenCallbackSpec->ProgressDialog.WaitCreating();
- Result = FolderManager->OpenFolderFile(InStream, Path, &Folder, OpenCallback);
- OpenCallbackSpec->ProgressDialog.MyClose();
- }
-
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- ((CThreadArchiveOpen *)param)->Process();
- return 0;
- }
-};
-
-static int FindPlugin(const CObjectVector<CPluginInfo> &plugins,
- const UString &pluginName)
-{
- for (int i = 0; i < plugins.Size(); i++)
- if (plugins[i].Name.CompareNoCase(pluginName) == 0)
- return i;
- return -1;
-}
-
-HRESULT OpenFileFolderPlugin(
- IInStream *inStream,
- const UString &path,
- HMODULE *module,
- IFolderFolder **resultFolder,
- HWND parentWindow,
- bool &encrypted, UString &password)
-{
-#ifdef _WIN32
- CObjectVector<CPluginInfo> plugins;
- ReadFileFolderPluginInfoList(plugins);
-#endif
-
- UString extension, name, pureName, dot;
-
- int slashPos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
- UString dirPrefix;
- UString fileName;
- if (slashPos >= 0)
- {
- dirPrefix = path.Left(slashPos + 1);
- fileName = path.Mid(slashPos + 1);
- }
- else
- fileName = path;
-
- NFile::NName::SplitNameToPureNameAndExtension(fileName, pureName, dot, extension);
-
-#ifdef _WIN32
- if (!extension.IsEmpty())
- {
- CExtInfo extInfo;
- if (ReadInternalAssociation(extension, extInfo))
- {
- for (int i = extInfo.Plugins.Size() - 1; i >= 0; i--)
- {
- int pluginIndex = FindPlugin(plugins, extInfo.Plugins[i]);
- if (pluginIndex >= 0)
- {
- const CPluginInfo plugin = plugins[pluginIndex];
- plugins.Delete(pluginIndex);
- plugins.Insert(0, plugin);
- }
- }
- }
- }
-
- for (int i = 0; i < plugins.Size(); i++)
- {
- const CPluginInfo &plugin = plugins[i];
- if (!plugin.ClassIDDefined)
- continue;
-#endif // #ifdef _WIN32
- CPluginLibrary library;
-
- CThreadArchiveOpen t;
-
-#ifdef _WIN32
- if (plugin.FilePath.IsEmpty())
- t.FolderManager = new CArchiveFolderManager;
- else if (library.LoadAndCreateManager(plugin.FilePath, plugin.ClassID, &t.FolderManager) != S_OK)
- continue;
-#else
- t.FolderManager = new CArchiveFolderManager;
-#endif
-
- t.OpenCallbackSpec = new COpenArchiveCallback;
- t.OpenCallback = t.OpenCallbackSpec;
- t.OpenCallbackSpec->PasswordIsDefined = encrypted;
- t.OpenCallbackSpec->Password = password;
- t.OpenCallbackSpec->ParentWindow = parentWindow;
-
- if (inStream)
- t.OpenCallbackSpec->SetSubArchiveName(fileName);
- else
- t.OpenCallbackSpec->LoadFileInfo(dirPrefix, fileName);
-
- t.InStream = inStream;
- t.Path = path;
-
- UString progressTitle = LangString(IDS_OPENNING, 0x03020283);
- t.OpenCallbackSpec->ProgressDialog.MainWindow = parentWindow;
- t.OpenCallbackSpec->ProgressDialog.MainTitle = LangString(IDS_APP_TITLE, 0x03000000);
- t.OpenCallbackSpec->ProgressDialog.MainAddTitle = progressTitle + UString(L" ");
-
- NWindows::CThread thread;
- if (thread.Create(CThreadArchiveOpen::MyThreadFunction, &t) != S_OK)
- throw 271824;
- t.OpenCallbackSpec->StartProgressDialog(progressTitle);
-
- if (t.Result == E_ABORT)
- return t.Result;
-
- if (t.Result == S_OK)
- {
- // if (openCallbackSpec->PasswordWasAsked)
- {
- encrypted = t.OpenCallbackSpec->PasswordIsDefined;
- password = t.OpenCallbackSpec->Password;
- }
- *module = library.Detach();
- *resultFolder = t.Folder.Detach();
- return S_OK;
- }
-
- if (t.Result != S_FALSE)
- return t.Result;
-#ifdef _WIN32
- }
-#endif
- return S_FALSE;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h
deleted file mode 100644
index 692417ba1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FileFolderPluginOpen.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// FileFolderPluginOpen.h
-
-#ifndef __FILE_FOLDER_PLUGIN_OPEN_H
-#define __FILE_FOLDER_PLUGIN_OPEN_H
-
-HRESULT OpenFileFolderPlugin(IInStream *inStream, const UString &path,
- HMODULE *module, IFolderFolder **resultFolder, HWND parentWindow, bool &encrypted, UString &password);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FormatUtils.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FormatUtils.cpp
deleted file mode 100644
index 98bb043ef..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FormatUtils.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// FormatUtils.cpp
-
-#include "StdAfx.h"
-
-#include "FormatUtils.h"
-#include "Common/IntToString.h"
-#include "Windows/ResourceString.h"
-
-#ifdef LANG
-#include "LangUtils.h"
-#endif
-
-UString NumberToString(UInt64 number)
-{
- wchar_t numberString[32];
- ConvertUInt64ToString(number, numberString);
- return numberString;
-}
-
-UString MyFormatNew(const UString &format, const UString &argument)
-{
- UString result = format;
- result.Replace(L"{0}", argument);
- return result;
-}
-
-UString MyFormatNew(UINT resourceID,
- #ifdef LANG
- UInt32 langID,
- #endif
- const UString &argument)
-{
- return MyFormatNew(
- #ifdef LANG
- LangString(resourceID, langID),
- #else
- NWindows::MyLoadStringW(resourceID),
- #endif
- argument);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FormatUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FormatUtils.h
deleted file mode 100644
index 70a444347..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/FormatUtils.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// FormatUtils.h
-
-#ifndef __FORMATUTILS_H
-#define __FORMATUTILS_H
-
-#include "Common/Types.h"
-#include "Common/MyString.h"
-
-UString NumberToString(UInt64 number);
-
-UString MyFormatNew(const UString &format, const UString &argument);
-UString MyFormatNew(UINT resourceID,
- #ifdef LANG
- UInt32 langID,
- #endif
- const UString &argument);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/HelpUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/HelpUtils.h
deleted file mode 100644
index 2a7b85aff..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/HelpUtils.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// HelpUtils.h
-
-#ifndef __HELPUTILS_H
-#define __HELPUTILS_H
-
-#include "Common/MyString.h"
-
-void ShowHelpWindow(HWND hwnd, LPCWSTR topicFile);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/IFolder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/IFolder.h
deleted file mode 100644
index b301f5134..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/IFolder.h
+++ /dev/null
@@ -1,157 +0,0 @@
-// IFolder.h
-
-#ifndef __IFOLDER_H
-#define __IFOLDER_H
-
-#include "../../IProgress.h"
-#include "../../IStream.h"
-
-#define FOLDER_INTERFACE_SUB(i, b, x) DECL_INTERFACE_SUB(i, b, 8, x)
-#define FOLDER_INTERFACE(i, x) FOLDER_INTERFACE_SUB(i, IUnknown, x)
-
-namespace NPlugin
-{
- enum
- {
- kName = 0,
- kType,
- kClassID,
- kOptionsClassID
- };
-}
-
-#define INTERFACE_FolderFolder(x) \
- STDMETHOD(LoadItems)() x; \
- STDMETHOD(GetNumberOfItems)(UInt32 *numItems) x; \
- STDMETHOD(GetProperty)(UInt32 itemIndex, PROPID propID, PROPVARIANT *value) x; \
- STDMETHOD(BindToFolder)(UInt32 index, IFolderFolder **resultFolder) x; \
- STDMETHOD(BindToFolder)(const wchar_t *name, IFolderFolder **resultFolder) x; \
- STDMETHOD(BindToParentFolder)(IFolderFolder **resultFolder) x; \
- STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties) x; \
- STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x; \
- STDMETHOD(GetFolderProperty)(PROPID propID, PROPVARIANT *value) x; \
-
-FOLDER_INTERFACE(IFolderFolder, 0x00)
-{
- INTERFACE_FolderFolder(PURE)
-};
-
-FOLDER_INTERFACE(IFolderWasChanged, 0x04)
-{
- STDMETHOD(WasChanged)(Int32 *wasChanged) PURE;
-};
-
-FOLDER_INTERFACE_SUB(IFolderOperationsExtractCallback, IProgress, 0x0B)
-{
- // STDMETHOD(SetTotalFiles)(UInt64 total) PURE;
- // STDMETHOD(SetCompletedFiles)(const UInt64 *completedValue) PURE;
- STDMETHOD(AskWrite)(
- const wchar_t *srcPath,
- Int32 srcIsFolder,
- const FILETIME *srcTime,
- const UInt64 *srcSize,
- const wchar_t *destPathRequest,
- BSTR *destPathResult,
- Int32 *writeAnswer) PURE;
- STDMETHOD(ShowMessage)(const wchar_t *message) PURE;
- STDMETHOD(SetCurrentFilePath)(const wchar_t *filePath) PURE;
- STDMETHOD(SetNumFiles)(UInt64 numFiles) PURE;
-};
-
-#define INTERFACE_FolderOperations(x) \
- STDMETHOD(CreateFolder)(const wchar_t *name, IProgress *progress) x; \
- STDMETHOD(CreateFile)(const wchar_t *name, IProgress *progress) x; \
- STDMETHOD(Rename)(UInt32 index, const wchar_t *newName, IProgress *progress) x; \
- STDMETHOD(Delete)(const UInt32 *indices, UInt32 numItems, IProgress *progress) x; \
- STDMETHOD(CopyTo)(const UInt32 *indices, UInt32 numItems, \
- const wchar_t *path, IFolderOperationsExtractCallback *callback) x; \
- STDMETHOD(MoveTo)(const UInt32 *indices, UInt32 numItems, \
- const wchar_t *path, IFolderOperationsExtractCallback *callback) x; \
- STDMETHOD(CopyFrom)(const wchar_t *fromFolderPath, \
- const wchar_t **itemsPaths, UInt32 numItems, IProgress *progress) x; \
- STDMETHOD(SetProperty)(UInt32 index, PROPID propID, const PROPVARIANT *value, IProgress *progress) x; \
-
-FOLDER_INTERFACE(IFolderOperations, 0x06)
-{
- INTERFACE_FolderOperations(PURE)
-};
-
-/*
-FOLDER_INTERFACE2(IFolderOperationsDeleteToRecycleBin, 0x06, 0x03)
-{
- STDMETHOD(DeleteToRecycleBin)(const UInt32 *indices, UInt32 numItems, IProgress *progress) PURE;
-};
-*/
-
-FOLDER_INTERFACE(IFolderGetSystemIconIndex, 0x07)
-{
- STDMETHOD(GetSystemIconIndex)(UInt32 index, Int32 *iconIndex) PURE;
-};
-
-FOLDER_INTERFACE(IFolderGetItemFullSize, 0x08)
-{
- STDMETHOD(GetItemFullSize)(UInt32 index, PROPVARIANT *value, IProgress *progress) PURE;
-};
-
-FOLDER_INTERFACE(IFolderClone, 0x09)
-{
- STDMETHOD(Clone)(IFolderFolder **resultFolder) PURE;
-};
-
-FOLDER_INTERFACE(IFolderSetFlatMode, 0x0A)
-{
- STDMETHOD(SetFlatMode)(Int32 flatMode) PURE;
-};
-
-#define INTERFACE_FolderProperties(x) \
- STDMETHOD(GetNumberOfFolderProperties)(UInt32 *numProperties) x; \
- STDMETHOD(GetFolderPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x; \
-
-FOLDER_INTERFACE(IFolderProperties, 0x0E)
-{
- INTERFACE_FolderProperties(PURE)
-};
-
-#define INTERFACE_IFolderArchiveProperties(x) \
- STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value) x; \
- STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties) x; \
- STDMETHOD(GetArchivePropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x;
-
-FOLDER_INTERFACE(IFolderArchiveProperties, 0x0C)
-{
- INTERFACE_IFolderArchiveProperties(PURE)
-};
-
-FOLDER_INTERFACE(IGetFolderArchiveProperties, 0x0D)
-{
- STDMETHOD(GetFolderArchiveProperties)(IFolderArchiveProperties **object) PURE;
-};
-
-#define FOLDER_MANAGER_INTERFACE(i, x) DECL_INTERFACE(i, 9, x)
-
-#define INTERFACE_IFolderManager(x) \
- STDMETHOD(OpenFolderFile)(IInStream *inStream, const wchar_t *filePath, IFolderFolder **resultFolder, IProgress *progress) x; \
- STDMETHOD(GetExtensions)(BSTR *extensions) x; \
- STDMETHOD(GetIconPath)(const wchar_t *ext, BSTR *iconPath, Int32 *iconIndex) x; \
-
- // STDMETHOD(GetTypes)(BSTR *types) PURE;
- // STDMETHOD(CreateFolderFile)(const wchar_t *type, const wchar_t *filePath, IProgress *progress) PURE;
-
-FOLDER_MANAGER_INTERFACE(IFolderManager, 0x04)
-{
- INTERFACE_IFolderManager(PURE);
-};
-
-
-#define IMP_IFolderFolder_GetProp(k) \
- (UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) \
- { if(index >= sizeof(k) / sizeof(k[0])) return E_INVALIDARG; \
- const STATPROPSTG &srcItem = k[index]; \
- *propID = srcItem.propid; *varType = srcItem.vt; *name = 0; return S_OK; } \
-
-#define IMP_IFolderFolder_Props(c) \
- STDMETHODIMP c::GetNumberOfProperties(UInt32 *numProperties) \
- { *numProperties = sizeof(kProps) / sizeof(kProps[0]); return S_OK; } \
- STDMETHODIMP c::GetPropertyInfo IMP_IFolderFolder_GetProp(kProps)
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/LangUtils.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/LangUtils.cpp
deleted file mode 100644
index 52f853489..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/LangUtils.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-// LangUtils.cpp
-
-#include "StdAfx.h"
-
-#include "LangUtils.h"
-#include "Common/StringConvert.h"
-#include "Common/StringToInt.h"
-#include "Windows/Synchronization.h"
-#include "Windows/Window.h"
-#include "Windows/FileFind.h"
-#include "RegistryUtils.h"
-#include "ProgramLocation.h"
-
-using namespace NWindows;
-
-static CLang g_Lang;
-UString g_LangID;
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-void ReloadLang()
-{
- ReadRegLang(g_LangID);
- g_Lang.Clear();
- if (!g_LangID.IsEmpty() && g_LangID != L"-")
- {
- UString langPath = g_LangID;
- if (langPath.Find(WCHAR_PATH_SEPARATOR) < 0)
- {
- if (langPath.Find(L'.') < 0)
- langPath += L".txt";
- UString folderPath;
- if (GetProgramFolderPath(folderPath))
- langPath = folderPath + UString(L"Lang" WSTRING_PATH_SEPARATOR) + langPath;
- }
- g_Lang.Open(langPath);
- }
-}
-
-static bool g_Loaded = false;
-static NSynchronization::CCriticalSection g_CriticalSection;
-
-void LoadLangOneTime()
-{
- NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
- if (g_Loaded)
- return;
- g_Loaded = true;
- ReloadLang();
-}
-
-void LangSetDlgItemsText(HWND dialogWindow, CIDLangPair *idLangPairs, int numItems)
-{
- for (int i = 0; i < numItems; i++)
- {
- const CIDLangPair &idLangPair = idLangPairs[i];
- UString message;
- if (g_Lang.GetMessage(idLangPair.LangID, message))
- {
- NWindows::CWindow window(GetDlgItem(dialogWindow, idLangPair.ControlID));
- window.SetText(message);
- }
- }
-}
-
-void LangSetWindowText(HWND window, UInt32 langID)
-{
- UString message;
- if (g_Lang.GetMessage(langID, message))
- MySetWindowText(window, message);
-}
-
-UString LangString(UInt32 langID)
-{
- UString message;
- if (g_Lang.GetMessage(langID, message))
- return message;
- return UString();
-}
-
-UString LangString(UINT resourceID, UInt32 langID)
-{
- UString message;
- if (g_Lang.GetMessage(langID, message))
- return message;
- return NWindows::MyLoadStringW(resourceID);
-}
-
-void LoadLangs(CObjectVector<CLangEx> &langs)
-{
- langs.Clear();
- UString folderPath;
- if (!::GetProgramFolderPath(folderPath))
- return;
- folderPath += L"Lang" WSTRING_PATH_SEPARATOR;
- NWindows::NFile::NFind::CEnumeratorW enumerator(folderPath + L"*.txt");
- NWindows::NFile::NFind::CFileInfoW fileInfo;
- while (enumerator.Next(fileInfo))
- {
- if (fileInfo.IsDir())
- continue;
- CLangEx lang;
- UString filePath = folderPath + fileInfo.Name;
- const int kExtSize = 4;
- const UString ext = fileInfo.Name.Right(kExtSize);
- if (ext.CompareNoCase(L".txt") != 0)
- continue;
- lang.ShortName = fileInfo.Name.Left(fileInfo.Name.Length() - kExtSize);
- if (lang.Lang.Open(filePath))
- langs.Add(lang);
- }
-}
-
-bool SplidID(const UString &id, WORD &primID, WORD &subID)
-{
- primID = 0;
- subID = 0;
- const wchar_t *start = id;
- const wchar_t *end;
- UInt64 value = ConvertStringToUInt64(start, &end);
- if (start == end)
- return false;
- primID = (WORD)value;
- if (*end == 0)
- return true;
- if (*end != L'-')
- return false;
- start = end + 1;
- value = ConvertStringToUInt64(start, &end);
- if (start == end)
- return false;
- subID = (WORD)value;
- return (*end == 0);
-}
-
-typedef LANGID (WINAPI *GetUserDefaultUILanguageP)();
-
-void FindMatchLang(UString &shortName)
-{
- shortName.Empty();
-
- LANGID SystemDefaultLangID = GetSystemDefaultLangID(); // Lang for non-Unicode in XP64
- LANGID UserDefaultLangID = GetUserDefaultLangID(); // Standarts and formats in XP64
-
- if (SystemDefaultLangID != UserDefaultLangID)
- return;
- LANGID langID = UserDefaultLangID;
- /*
- LANGID SystemDefaultUILanguage; // english in XP64
- LANGID UserDefaultUILanguage; // english in XP64
-
- GetUserDefaultUILanguageP fn = (GetUserDefaultUILanguageP)GetProcAddress(
- GetModuleHandle("kernel32"), "GetUserDefaultUILanguage");
- if (fn != NULL)
- UserDefaultUILanguage = fn();
- fn = (GetUserDefaultUILanguageP)GetProcAddress(
- GetModuleHandle("kernel32"), "GetSystemDefaultUILanguage");
- if (fn != NULL)
- SystemDefaultUILanguage = fn();
- */
-
- WORD primLang = (WORD)(PRIMARYLANGID(langID));
- WORD subLang = (WORD)(SUBLANGID(langID));
- CObjectVector<CLangEx> langs;
- LoadLangs(langs);
- for (int i = 0; i < langs.Size(); i++)
- {
- const CLangEx &lang = langs[i];
- UString id;
- if (lang.Lang.GetMessage(0x00000002, id))
- {
- WORD primID;
- WORD subID;
- if (SplidID(id, primID, subID))
- if (primID == primLang)
- {
- if (subID == 0)
- shortName = lang.ShortName;
- if (subLang == subID)
- {
- shortName = lang.ShortName;
- return;
- }
- }
- }
- }
-}
-
-void ReloadLangSmart()
-{
- #ifndef _UNICODE
- if (g_IsNT)
- #endif
- {
- ReadRegLang(g_LangID);
- if (g_LangID.IsEmpty())
- {
- UString shortName;
- FindMatchLang(shortName);
- if (shortName.IsEmpty())
- shortName = L"-";
- SaveRegLang(shortName);
- }
- }
- ReloadLang();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/LangUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/LangUtils.h
deleted file mode 100644
index 40debdfe4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/LangUtils.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// LangUtils.h
-
-#ifndef __LANGUTILS_H
-#define __LANGUTILS_H
-
-#include "Common/Lang.h"
-#include "Windows/ResourceString.h"
-
-extern UString g_LangID;
-
-struct CIDLangPair
-{
- int ControlID;
- UInt32 LangID;
-};
-
-void ReloadLang();
-void LoadLangOneTime();
-void ReloadLangSmart();
-
-struct CLangEx
-{
- CLang Lang;
- UString ShortName;
-};
-
-void LoadLangs(CObjectVector<CLangEx> &langs);
-
-void LangSetDlgItemsText(HWND dialogWindow, CIDLangPair *idLangPairs, int numItems);
-void LangSetWindowText(HWND window, UInt32 langID);
-
-UString LangString(UInt32 langID);
-UString LangString(UINT resourceID, UInt32 langID);
-
-#ifdef LANG
-#define LangStringSpec(resourceID, langID) LangString(resourceID, langID)
-#else
-#define LangStringSpec(resourceID, langID) NWindows::MyLoadStringW(resourceID)
-#endif
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialog.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialog.cpp
deleted file mode 100644
index 667e6acc0..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialog.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-// ListViewDialog.cpp
-
-#include "StdAfx.h"
-#include "ListViewDialog.h"
-
-#ifdef LANG
-#include "LangUtils.h"
-static CIDLangPair kIDLangPairs[] =
-{
- { IDOK, 0x02000702 },
- { IDCANCEL, 0x02000710 }
-};
-#endif
-
-bool CListViewDialog::OnInit()
-{
- #ifdef LANG
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- #endif
- _listView.Attach(GetItem(IDC_LISTVIEW_LIST));
- SetText(Title);
-
- LVCOLUMN columnInfo;
- columnInfo.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
- columnInfo.fmt = LVCFMT_LEFT;
- columnInfo.iSubItem = 0;
- columnInfo.cx = 1000;
-
- _listView.InsertColumn(0, &columnInfo);
-
- for (int i = 0; i < Strings.Size(); i++)
- _listView.InsertItem(i, Strings[i]);
-
- if (Strings.Size() > 0)
- _listView.SetItemState(0, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
- StringsWereChanged = false;
- return CModalDialog::OnInit();
-}
-
-#ifdef _WIN32 // FIXME
-bool CListViewDialog::OnNotify(UINT /* controlID */, LPNMHDR header)
-{
- if (header->hwndFrom != _listView)
- return false;
- switch(header->code)
- {
- case LVN_KEYDOWN:
- {
- LPNMLVKEYDOWN keyDownInfo = LPNMLVKEYDOWN(header);
- switch(keyDownInfo->wVKey)
- {
- case VK_DELETE:
- {
- if (!DeleteIsAllowed)
- return false;
- int focusedIndex = _listView.GetFocusedItem();
- if (focusedIndex < 0)
- focusedIndex = 0;
- for (;;)
- {
- int index = _listView.GetNextSelectedItem(-1);
- if (index < 0)
- break;
- StringsWereChanged = true;
- _listView.DeleteItem(index);
- Strings.Delete(index);
- }
- if (focusedIndex >= _listView.GetItemCount())
- focusedIndex = _listView.GetItemCount() - 1;
- if (focusedIndex >= 0)
- _listView.SetItemState(focusedIndex, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED);
- return true;
- }
- case 'A':
- {
- bool ctrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
- if (ctrl)
- {
- int numItems = _listView.GetItemCount();
- for (int i = 0; i < numItems; i++)
- _listView.SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
- return true;
- }
- }
- }
- }
- }
- return false;
-}
-#endif
-
-void CListViewDialog::OnOK()
-{
- FocusedItemIndex = _listView.GetFocusedItem();
- CModalDialog::OnOK();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialog.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialog.h
deleted file mode 100644
index f27b81697..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialog.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// ListViewDialog.h
-
-#ifndef __LISTVIEWDIALOG_H
-#define __LISTVIEWDIALOG_H
-
-#include "Windows/Control/Dialog.h"
-#include "Windows/Control/ListView.h"
-#include "ListViewDialogRes.h"
-
-class CListViewDialog: public NWindows::NControl::CModalDialog
-{
- NWindows::NControl::CListView _listView;
- virtual void OnOK();
- virtual bool OnInit();
-#ifdef _WIN32 // FIXME
- virtual bool OnNotify(UINT controlID, LPNMHDR header);
-#endif
-
-public:
- UString Title;
- bool DeleteIsAllowed;
- UStringVector Strings;
- bool StringsWereChanged;
- int FocusedItemIndex;
-
- INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_LISTVIEW, wndParent); }
-
- CListViewDialog(): DeleteIsAllowed(false) {}
-
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialogRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialogRes.h
deleted file mode 100644
index 440d14b02..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialogRes.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#define IDD_DIALOG_LISTVIEW 201
-
-#define IDC_LISTVIEW_LIST 1000
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialog_rc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialog_rc.cpp
deleted file mode 100644
index 3b707ec31..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ListViewDialog_rc.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// PasswordDialog.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#include "Windows/Control/DialogImpl.h"
-
-#include "ListViewDialogRes.h"
-
-class CListViewDialogImpl : public NWindows::NControl::CModalDialogImpl
-{
- public:
- CListViewDialogImpl(NWindows::NControl::CModalDialog *dialog,wxWindow * parent,int id) :
- CModalDialogImpl(dialog,parent, id, wxT("ListView"), wxDefaultPosition, wxDefaultSize,
- wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX)
-
- {
-
- wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
-
- wxListCtrl *list = new wxListCtrl(this, IDC_LISTVIEW_LIST, wxDefaultPosition, wxSize(645,195), wxLC_REPORT | wxLC_NO_HEADER);
-
- topsizer->Add(list, 1, wxALL|wxEXPAND, 5);
-
- topsizer->Add(CreateButtonSizer(wxOK|wxCANCEL), 0, wxALL|wxEXPAND, 5);
-
- this->OnInit();
-
- SetSizer(topsizer); // use the sizer for layout
- topsizer->SetSizeHints(this); // set size hints to honour minimum size
- }
-private:
- // Any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-REGISTER_DIALOG(IDD_DIALOG_LISTVIEW,CListViewDialog,0)
-
-BEGIN_EVENT_TABLE(CListViewDialogImpl, wxDialog)
- EVT_BUTTON(wxID_ANY, CModalDialogImpl::OnAnyButton)
- EVT_CHECKBOX(wxID_ANY, CModalDialogImpl::OnAnyButton)
-END_EVENT_TABLE()
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialog.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialog.cpp
deleted file mode 100644
index 201c0bae7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialog.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// MessagesDialog.cpp
-
-#include "StdAfx.h"
-#include "MessagesDialog.h"
-#include "Common/StringConvert.h"
-#include "Common/IntToString.h"
-#include "Windows/ResourceString.h"
-
-#ifdef LANG
-#include "LangUtils.h"
-#endif
-
-using namespace NWindows;
-
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDOK, 0x02000713 }
-};
-#endif
-
-void CMessagesDialog::AddMessageDirect(LPCWSTR message)
-{
- int itemIndex = _messageList.GetItemCount();
- wchar_t sz[32];
- ConvertInt64ToString(itemIndex, sz);
- _messageList.InsertItem(itemIndex, sz);
- _messageList.SetSubItem(itemIndex, 1, message);
-}
-
-void CMessagesDialog::AddMessage(LPCWSTR message)
-{
- UString s = message;
- while (!s.IsEmpty())
- {
- int pos = s.Find(L'\n');
- if (pos < 0)
- break;
- AddMessageDirect(s.Left(pos));
- s.Delete(0, pos + 1);
- }
- AddMessageDirect(s);
-}
-
-bool CMessagesDialog::OnInit()
-{
- #ifdef LANG
- LangSetWindowText(HWND(*this), 0x02000A00);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- #endif
- _messageList.Attach(GetItem(IDC_MESSAGE_LIST));
- _messageList.SetUnicodeFormat(true);
-
- _messageList.InsertColumn(0, L"#", 30);
-
- const UString s =
- #ifdef LANG
- LangString(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN, 0x02000A80);
- #else
- MyLoadStringW(IDS_MESSAGES_DIALOG_MESSAGE_COLUMN);
- #endif
-
- _messageList.InsertColumn(1, s, 600);
-
- for(int i = 0; i < Messages->Size(); i++)
- AddMessage((*Messages)[i]);
-
- /*
- if(_messageList.GetItemCount() > 0)
- {
- UINT aState = LVIS_SELECTED | LVIS_FOCUSED;
- _messageList.SetItemState(0, aState, aState);
- }
- */
- return CModalDialog::OnInit();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialog.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialog.h
deleted file mode 100644
index 6df0d46cc..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialog.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// MessagesDialog.h
-
-#ifndef __MESSAGESDIALOG_H
-#define __MESSAGESDIALOG_H
-
-#include "MessagesDialogRes.h"
-
-#include "Windows/Control/Dialog.h"
-#include "Windows/Control/ListView.h"
-
-class CMessagesDialog: public NWindows::NControl::CModalDialog
-{
- NWindows::NControl::CListView _messageList;
- void AddMessageDirect(LPCWSTR message);
- void AddMessage(LPCWSTR message);
- virtual bool OnInit();
-public:
- const UStringVector *Messages;
- INT_PTR Create(HWND parent = 0) { return CModalDialog::Create(IDD_DIALOG_MESSAGES, parent); }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialogRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialogRes.h
deleted file mode 100644
index 39d49f573..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialogRes.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#define IDS_MESSAGES_DIALOG_MESSAGE_COLUMN 503
-#define IDD_DIALOG_MESSAGES 503
-#define IDC_MESSAGE_LIST 1000
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialog_rc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialog_rc.cpp
deleted file mode 100644
index bd1fb1f06..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MessagesDialog_rc.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-// MessagesDialog_rc.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#include "Windows/Control/DialogImpl.h"
-#include "MessagesDialogRes.h"
-
-/*
-IDD_DIALOG_MESSAGES DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
-CAPTION "7-Zip: Diagnostic messages"
-MY_FONT
-BEGIN
- DEFPUSHBUTTON "&Close", IDOK, bXPos, bYPos, bXSize, bYSize
- CONTROL "List1",IDC_MESSAGE_LIST,"SysListView32",
- LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,
- marg, marg, xSize2, ySize2 - bYSize - 6
-END
-
-STRINGTABLE
-BEGIN
- IDS_MESSAGES_DIALOG_MESSAGE_COLUMN "Message"
-END
-*/
-
-class CMessagesDialogImpl : public NWindows::NControl::CModalDialogImpl
-{
- public:
- CMessagesDialogImpl(NWindows::NControl::CModalDialog *dialog,wxWindow * parent , int id) :
- CModalDialogImpl(dialog,parent, id, wxT("7-Zip: Diagnostic messages"), wxDefaultPosition, wxDefaultSize,
- wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX | wxMINIMIZE_BOX)
- {
- wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
-
- wxListCtrl *list = new wxListCtrl(this, IDC_MESSAGE_LIST, wxDefaultPosition, wxSize(645,195), wxLC_REPORT );
-
-#if 0
- list->InsertColumn(0, wxT("Col1"), wxLIST_FORMAT_LEFT);
- list->InsertColumn(1, wxT("Col2"), wxLIST_FORMAT_RIGHT);
- list->InsertItem(0, wxT("#1"));
- list->SetItem(0, 1, L"message 1");
- list->InsertItem(1, wxT("#2"));
- list->SetItem(1, 1, L"message 2");
-#endif
- topsizer->Add(list , 1, wxALL|wxEXPAND, 5);
- topsizer->Add(new wxButton(this, wxID_OK, _T("&Close")) , 0, wxALL | wxALIGN_RIGHT, 5);
-
- this->OnInit();
-
- SetSizer(topsizer); // use the sizer for layout
- topsizer->SetSizeHints(this); // set size hints to honour minimum size
- }
-private:
- // Any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-static CStringTable g_stringTable[] =
-{
- { IDS_MESSAGES_DIALOG_MESSAGE_COLUMN, L"Message" },
- { 0 , 0 }
-};
-
-REGISTER_DIALOG(IDD_DIALOG_MESSAGES,CMessagesDialog,g_stringTable)
-
-BEGIN_EVENT_TABLE(CMessagesDialogImpl, wxDialog)
- EVT_BUTTON(wxID_ANY, CModalDialogImpl::OnAnyButton)
-END_EVENT_TABLE()
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MyLoadMenu.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MyLoadMenu.cpp
deleted file mode 100644
index 839e1f8c7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MyLoadMenu.cpp
+++ /dev/null
@@ -1,733 +0,0 @@
-// MyLoadMenu
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-
-typedef wxMenuBar * HMENU;
-
-#include "Common/StringConvert.h"
-
-// FIXME #include "Windows/Menu.h"
-#include "Windows/Error.h"
-// FIXME #include "Windows/Clipboard.h"
-
-#include "../../PropID.h"
-
-#include "resource.h"
-#include "App.h"
-// FIXME #include "AboutDialog.h"
-#include "../Common/CompressCall.h"
-
-#include "HelpUtils.h"
-#include "LangUtils.h"
-#include "PluginInterface.h"
-
-static const UINT kOpenBookmarkMenuID = 730;
-static const UINT kSetBookmarkMenuID = 740;
-
-extern HINSTANCE g_hInstance;
-
-static LPCWSTR kFMHelpTopic = L"fm/index.htm";
-
-extern void OptionsDialog(HWND hwndOwner, HINSTANCE hInstance);
-
-using namespace NWindows;
-
-static const int kFileMenuIndex = 0;
-static const int kEditMenuIndex = 1;
-static const int kViewMenuIndex = 2;
-static const int kBookmarksMenuIndex = kViewMenuIndex + 1;
-
-struct CStringLangPair
-{
- wchar_t *String;
- UINT32 LangID;
-};
-
-static CStringLangPair kStringLangPairs[] =
-{
- { L"&File", 0x03000102 },
- { L"&Edit", 0x03000103 },
- { L"&View", 0x03000104 },
- { L"&Bookmarks", 0x03000107 },
- { L"&Tools", 0x03000105 },
- { L"&Help", 0x03000106 },
-};
-
-UINT32 kAddToFavoritesLangID = 0x03000710;
-UINT32 kToolbarsLangID = 0x03000451;
-
-/*
-static int FindStringLangItem(const UString &anItem)
-{
- for (int i = 0; i < sizeof(kStringLangPairs) /
- sizeof(kStringLangPairs[0]); i++)
- if (anItem.CompareNoCase(kStringLangPairs[i].String) == 0)
- return i;
- return -1;
-}
-*/
-
-static CIDLangPair kIDLangPairs[] =
-{
- // File
- { IDM_FILE_OPEN, 0x03000210 },
- { IDM_FILE_OPEN_INSIDE, 0x03000211 },
- { IDM_FILE_OPEN_OUTSIDE, 0x03000212 },
- // { IDM_FILE_VIEW, 0x03000220 }, // FIXME : does not exist !
- { IDM_FILE_EDIT, 0x03000221 },
- { IDM_RENAME, 0x03000230 },
- { IDM_COPY_TO, 0x03000231 },
- { IDM_MOVE_TO, 0x03000232 },
- { IDM_DELETE, 0x03000233 },
- { IDM_FILE_PROPERTIES, 0x03000240 },
- { IDM_FILE_COMMENT, 0x03000241 },
- { IDM_FILE_CRC, 0x03000242 },
- { IDM_FILE_SPLIT, 0x03000270 },
- { IDM_FILE_COMBINE, 0x03000271 },
- { IDM_CREATE_FOLDER, 0x03000250 },
- { IDM_CREATE_FILE, 0x03000251 },
- // FIXME { IDCLOSE, 0x03000260 },
-
- // Edit
- { IDM_EDIT_CUT, 0x03000320 },
- { IDM_EDIT_COPY, 0x03000321 },
- { IDM_EDIT_PASTE, 0x03000322 },
-
- { IDM_SELECT_ALL, 0x03000330 },
- { IDM_DESELECT_ALL, 0x03000331 },
- { IDM_INVERT_SELECTION, 0x03000332 },
- { IDM_SELECT, 0x03000333 },
- { IDM_DESELECT, 0x03000334 },
- { IDM_SELECT_BY_TYPE, 0x03000335 },
- { IDM_DESELECT_BY_TYPE, 0x03000336 },
-
- { IDM_VIEW_LARGE_ICONS, 0x03000410 },
- { IDM_VIEW_SMALL_ICONS, 0x03000411 },
- { IDM_VIEW_LIST, 0x03000412 },
- { IDM_VIEW_DETAILS, 0x03000413 },
-
- { IDM_VIEW_ARANGE_BY_NAME, 0x02000204 },
- { IDM_VIEW_ARANGE_BY_TYPE, 0x02000214 },
- { IDM_VIEW_ARANGE_BY_DATE, 0x0200020C },
- { IDM_VIEW_ARANGE_BY_SIZE, 0x02000207 },
- { IDM_VIEW_ARANGE_NO_SORT, 0x03000420 },
-
- { IDM_OPEN_ROOT_FOLDER, 0x03000430 },
- { IDM_OPEN_PARENT_FOLDER, 0x03000431 },
- { IDM_FOLDERS_HISTORY, 0x03000432 },
-
- { IDM_VIEW_REFRESH, 0x03000440 },
-
- { IDM_VIEW_FLAT_VIEW, 0x03000449 },
- { IDM_VIEW_TWO_PANELS, 0x03000450 },
- { IDM_VIEW_ARCHIVE_TOOLBAR, 0x03000460 },
- { IDM_VIEW_STANDARD_TOOLBAR, 0x03000461 },
- { IDM_VIEW_TOOLBARS_LARGE_BUTTONS, 0x03000462 },
- { IDM_VIEW_TOOLBARS_SHOW_BUTTONS_TEXT, 0x03000463 },
-
- { IDM_OPTIONS, 0x03000510 },
- { IDM_BENCHMARK, 0x03000511 },
-
- { IDM_HELP_CONTENTS, 0x03000610 },
- { IDM_ABOUT, 0x03000620 },
-
- { 12111 , 0x03000710 }, // FIXME kAddToFavoritesLangID
- { 12112 , 0x03000451 } // FIXME kToolbarsLangID
-};
-
-
-#ifdef _WIN32
-static int FindLangItem(int ControlID)
-{
- for (int i = 0; i < sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]); i++)
- if (kIDLangPairs[i].ControlID == ControlID)
- return i;
- return -1;
-}
-#endif
-
-
-/*
-static bool g_IsNew_fMask = true;
-
-class CInit_fMask
-{
-public:
- CInit_fMask()
- {
- g_IsNew_fMask = false;
- OSVERSIONINFO vi;
- vi.dwOSVersionInfoSize = sizeof(vi);
- if (::GetVersionEx(&vi))
- {
- g_IsNew_fMask = (vi.dwMajorVersion > 4 ||
- (vi.dwMajorVersion == 4 && vi.dwMinorVersion > 0));
- }
- g_IsNew_fMask = false;
- }
-} g_Init_fMask;
-
-// it's hack for supporting Windows NT
-// constants are from WinUser.h
-
-#if(WINVER < 0x0500)
-#define MIIM_STRING 0x00000040
-#define MIIM_BITMAP 0x00000080
-#define MIIM_FTYPE 0x00000100
-#endif
-
-static UINT Get_fMaskForString()
-{
- return g_IsNew_fMask ? MIIM_STRING : MIIM_TYPE;
-}
-
-static UINT Get_fMaskForFTypeAndString()
-{
- return g_IsNew_fMask ? (MIIM_STRING | MIIM_FTYPE) : MIIM_TYPE;
-}
-*/
-
-#ifdef _WIN32
-static UINT Get_fMaskForString()
-{
- return MIIM_TYPE;
-}
-
-static UINT Get_fMaskForFTypeAndString()
-{
- return MIIM_TYPE;
-}
-#endif
-
-
-static void MyChangeItem(wxMenuItem * mi,int LangID)
-{
- UString newString = LangString(LangID);
- if (newString.IsEmpty())
- return;
- wxString ss = mi->GetItemLabel();
- UString shorcutString((const wchar_t *)ss); // = item.StringValue;
- int tabPos = shorcutString.ReverseFind(wchar_t('\t'));
- if (tabPos >= 0)
- newString += shorcutString.Mid(tabPos);
- // printf("Change Menu : %ls => %ls\n",(const wchar_t *)ss,(const wchar_t *)newString);
- mi->SetItemLabel((const wchar_t *)newString);
-
-}
-
-static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
-{
- // Sets the label of the top-level menus
- for (int i1= 0; i1< sizeof(kStringLangPairs) / sizeof(kStringLangPairs[0]); i1++)
- {
- UString newString = LangString(kStringLangPairs[i1].LangID);
- if (! newString.IsEmpty()) menuLoc->SetMenuLabel(i1, (const TCHAR *)newString);
- }
-
- // sub-menu items
- for (int i = 0; i < sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]); i++)
- {
- wxMenuItem * mi = menuLoc->FindItem(kIDLangPairs[i].ControlID);
- if (mi)
- {
- MyChangeItem(mi,kIDLangPairs[i].LangID);
- }
- else
- printf("Change Menu : id=%d index=%d<>\n",kIDLangPairs[i].ControlID,i);
- }
-}
-
-#ifdef _WIN32
-CMenu g_FileMenu;
-
-class CFileMenuDestroyer
-{
-public:
- ~CFileMenuDestroyer()
- {
- if ((HMENU)g_FileMenu != 0)
- g_FileMenu.Destroy();
- }
-} g_FileMenuDestroyer;
-#endif
-
-
-void MyLoadMenu(HWND hWnd)
-{
-#ifdef _WIN32
- if ((HMENU)g_FileMenu != 0)
- g_FileMenu.Destroy();
- HMENU oldMenu = ::GetMenu(hWnd);
- HMENU baseMenu = ::LoadMenu(g_hInstance, MAKEINTRESOURCE(IDM_MENU));
- ::SetMenu(hWnd, baseMenu);
- ::DestroyMenu(oldMenu);
- if (!g_LangID.IsEmpty())
- {
- HMENU menuOld = ::GetMenu(hWnd);
- MyChangeMenu(menuOld, 0, 0);
- }
- ::DrawMenuBar(hWnd);
-#else
- extern void rc_MyLoadMenu(HWND hWnd);
- rc_MyLoadMenu(hWnd);
- if (!g_LangID.IsEmpty())
- {
- HMENU menuOld = ((wxFrame *)hWnd)->GetMenuBar(); // ::GetMenu(hWnd);
- MyChangeMenu(menuOld, 0, 0);
- }
-#endif
-}
-
-#ifdef _WIN32
-extern HWND g_HWND;
-void MyLoadMenu()
-{
- MyLoadMenu(g_HWND);
-}
-
-static void CopyMenu(HMENU srcMenuSpec, HMENU destMenuSpec)
-{
- CMenu srcMenu;
- srcMenu.Attach(srcMenuSpec);
- CMenu destMenu;
- destMenu.Attach(destMenuSpec);
- int startPos = 0;
- for (int i = 0; i < srcMenu.GetItemCount(); i++)
- {
- CMenuItem item;
- item.fMask = MIIM_STATE | MIIM_ID | Get_fMaskForFTypeAndString();
- item.fType = MFT_STRING;
- if (srcMenu.GetItem(i, true, item))
- if (destMenu.InsertItem(startPos, true, item))
- startPos++;
- }
-}
-
-void OnMenuActivating(HWND /* hWnd */, HMENU hMenu, int position)
-{
- if (::GetSubMenu(::GetMenu(g_HWND), position) != hMenu)
- return;
- if (position == kFileMenuIndex)
- {
- if ((HMENU)g_FileMenu == 0)
- {
- g_FileMenu.CreatePopup();
- CopyMenu(hMenu, g_FileMenu);
- }
- CMenu menu;
- menu.Attach(hMenu);
- while (menu.GetItemCount() > 0)
- {
- if (!menu.RemoveItem(0, MF_BYPOSITION))
- break;
- }
- // CopyMenu(g_FileMenu, hMenu);
- g_App.GetFocusedPanel().CreateFileMenu(hMenu);
- }
- else if (position == kEditMenuIndex)
- {
- /*
- CMenu menu;
- menu.Attach(hMenu);
- menu.EnableItem(IDM_EDIT_CUT, MF_ENABLED);
- menu.EnableItem(IDM_EDIT_COPY, MF_ENABLED);
- menu.EnableItem(IDM_EDIT_PASTE, IsClipboardFormatAvailableHDROP() ? MF_ENABLED : MF_GRAYED);
- */
- }
- else if (position == kViewMenuIndex)
- {
- // View;
- CMenu menu;
- menu.Attach(hMenu);
- menu.CheckRadioItem(IDM_VIEW_LARGE_ICONS, IDM_VIEW_DETAILS,
- IDM_VIEW_LARGE_ICONS + g_App.GetListViewMode(), MF_BYCOMMAND);
- menu.CheckItem(IDM_VIEW_TWO_PANELS, MF_BYCOMMAND |
- ((g_App.NumPanels == 2) ? MF_CHECKED : MF_UNCHECKED));
- menu.CheckItem(IDM_VIEW_FLAT_VIEW, MF_BYCOMMAND |
- ((g_App.GetFlatMode()) ? MF_CHECKED : MF_UNCHECKED));
- menu.CheckItem(IDM_VIEW_ARCHIVE_TOOLBAR, MF_BYCOMMAND |
- (g_App.ShowArchiveToolbar ? MF_CHECKED : MF_UNCHECKED));
- menu.CheckItem(IDM_VIEW_STANDARD_TOOLBAR, MF_BYCOMMAND |
- (g_App.ShowStandardToolbar ? MF_CHECKED : MF_UNCHECKED));
- menu.CheckItem(IDM_VIEW_TOOLBARS_LARGE_BUTTONS, MF_BYCOMMAND |
- (g_App.LargeButtons ? MF_CHECKED : MF_UNCHECKED));
- menu.CheckItem(IDM_VIEW_TOOLBARS_SHOW_BUTTONS_TEXT, MF_BYCOMMAND |
- (g_App.ShowButtonsLables ? MF_CHECKED : MF_UNCHECKED));
- }
- else if (position == kBookmarksMenuIndex)
- {
- CMenu menu;
- menu.Attach(hMenu);
-
- CMenu subMenu;
- subMenu.Attach(menu.GetSubMenu(0));
- while (subMenu.GetItemCount() > 0)
- subMenu.RemoveItem(subMenu.GetItemCount() - 1, MF_BYPOSITION);
- int i;
- for (i = 0; i < 10; i++)
- {
- UString s = LangString(IDS_BOOKMARK, 0x03000720);
- s += L" ";
- wchar_t c = (wchar_t)(L'0' + i);
- s += c;
- s += L"\tAlt+Shift+";
- s += c;
- subMenu.AppendItem(MF_STRING, kSetBookmarkMenuID + i, s);
- }
-
- while (menu.GetItemCount() > 2)
- menu.RemoveItem(menu.GetItemCount() - 1, MF_BYPOSITION);
-
- for (i = 0; i < 10; i++)
- {
- UString path = g_App.AppState.FastFolders.GetString(i);
- const int kMaxSize = 100;
- const int kFirstPartSize = kMaxSize / 2;
- if (path.Length() > kMaxSize)
- {
- path = path.Left(kFirstPartSize) + UString(L" ... ") +
- path.Right(kMaxSize - kFirstPartSize);
- }
- UString s = path;
- if (s.IsEmpty())
- s = L"-";
- s += L"\tAlt+";
- s += (wchar_t)(L'0' + i);
- menu.AppendItem(MF_STRING, kOpenBookmarkMenuID + i, s);
- }
- }
-}
-
-/*
-It doesn't help
-void OnMenuUnActivating(HWND hWnd, HMENU hMenu, int id)
-{
- if (::GetSubMenu(::GetMenu(g_HWND), 0) != hMenu)
- return;
- // g_App.GetFocusedPanel()._contextMenu.Release();
-}
-
-void OnMenuUnActivating(HWND hWnd)
-{
-}
-*/
-
-
-void LoadFileMenu(HMENU hMenu, int startPos, bool /* forFileMode */, bool programMenu)
-{
- {
- CMenu srcMenu;
- srcMenu.Attach(::GetSubMenu(::GetMenu(g_HWND), 0));
- if ((HMENU)g_FileMenu == 0)
- {
- g_FileMenu.CreatePopup();
- CopyMenu(srcMenu, g_FileMenu);
- }
- }
-
- CMenu destMenu;
- destMenu.Attach(hMenu);
-
- for (int i = 0; i < g_FileMenu.GetItemCount(); i++)
- {
- CMenuItem item;
-
- item.fMask = MIIM_STATE | MIIM_ID | Get_fMaskForFTypeAndString();
- item.fType = MFT_STRING;
- if (g_FileMenu.GetItem(i, true, item))
- {
- if (!programMenu)
- if (item.wID == IDCLOSE)
- continue;
- /*
- bool createItem = (item.wID == IDM_CREATE_FOLDER || item.wID == IDM_CREATE_FILE);
- if (forFileMode)
- {
- if (createItem)
- continue;
- }
- else
- {
- if (!createItem)
- continue;
- }
- */
- if (destMenu.InsertItem(startPos, true, item))
- startPos++;
- }
- }
- while (destMenu.GetItemCount() > 0)
- {
- CMenuItem item;
- item.fMask = MIIM_TYPE;
- item.fType = 0;
- // item.dwTypeData = 0;
- int lastIndex = destMenu.GetItemCount() - 1;
- if (!destMenu.GetItem(lastIndex, true, item))
- break;
- if(item.fType != MFT_SEPARATOR)
- break;
- if (!destMenu.RemoveItem(lastIndex, MF_BYPOSITION))
- break;
- }
-}
-#endif
-
-bool ExecuteFileCommand(int id)
-{
- if (id >= kPluginMenuStartID)
- {
-#ifdef _WIN32
- g_App.GetFocusedPanel().InvokePluginCommand(id);
- g_App.GetFocusedPanel()._sevenZipContextMenu.Release();
- g_App.GetFocusedPanel()._systemContextMenu.Release();
-#endif
- return true;
- }
-
- switch (id)
- {
- // File
- case IDM_FILE_OPEN:
- g_App.OpenItem();
- break;
- case IDM_FILE_OPEN_INSIDE:
- g_App.OpenItemInside();
- break;
- case IDM_FILE_OPEN_OUTSIDE:
- g_App.OpenItemOutside();
- break;
- case IDM_FILE_VIEW:
- break;
- case IDM_FILE_EDIT:
- g_App.EditItem();
- break;
- case IDM_RENAME:
- g_App.Rename();
- break;
- case IDM_COPY_TO:
- g_App.CopyTo();
- break;
- case IDM_MOVE_TO:
- g_App.MoveTo();
- break;
- case IDM_DELETE:
- {
-#ifdef _WIN32 // FIXME
- bool shift = (::GetKeyState(VK_SHIFT) & 0x8000) != 0;
- g_App.Delete(!shift);
-#endif
- break;
- }
- case IDM_FILE_CRC:
- g_App.CalculateCrc();
- break;
- case IDM_FILE_SPLIT:
- g_App.Split();
- break;
- case IDM_FILE_COMBINE:
- g_App.Combine();
- break;
- case IDM_FILE_PROPERTIES:
- g_App.Properties();
- break;
- case IDM_FILE_COMMENT:
- g_App.Comment();
- break;
-
- case IDM_CREATE_FOLDER:
- g_App.CreateFolder();
- break;
- case IDM_CREATE_FILE:
- g_App.CreateFile();
- break;
- default:
- return false;
- }
- return true;
-}
-
-bool OnMenuCommand(HWND hWnd, int id)
-{
- printf("DEBUG : OnMenuCommand(%p,id=%d)-0\n",hWnd,id);
-
- if (ExecuteFileCommand(id))
- return true;
-
- printf("DEBUG : OnMenuCommand(%p,id=%d)-1\n",hWnd,id);
-
- switch (id)
- {
- // File
- /* FIXME
- case IDCLOSE:
- SendMessage(hWnd, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), (LPARAM)hWnd);
- SendMessage (hWnd, WM_CLOSE, 0, 0);
- break;
- */
-
- // Edit
- case IDM_EDIT_CUT:
- g_App.EditCut();
- break;
- case IDM_EDIT_COPY:
- g_App.EditCopy();
- break;
- case IDM_EDIT_PASTE:
- g_App.EditPaste();
- break;
- case IDM_SELECT_ALL:
- g_App.SelectAll(true);
- g_App.RefreshStatusBar();
- break;
- case IDM_DESELECT_ALL:
- g_App.SelectAll(false);
- g_App.RefreshStatusBar();
- break;
- case IDM_INVERT_SELECTION:
- g_App.InvertSelection();
- g_App.RefreshStatusBar();
- break;
- case IDM_SELECT:
- g_App.SelectSpec(true);
- g_App.RefreshStatusBar();
- break;
- case IDM_DESELECT:
- g_App.SelectSpec(false);
- g_App.RefreshStatusBar();
- break;
- case IDM_SELECT_BY_TYPE:
- g_App.SelectByType(true);
- g_App.RefreshStatusBar();
- break;
- case IDM_DESELECT_BY_TYPE:
- g_App.SelectByType(false);
- g_App.RefreshStatusBar();
- break;
-
- //View
- case IDM_VIEW_LARGE_ICONS:
- case IDM_VIEW_SMALL_ICONS:
- case IDM_VIEW_LIST:
- case IDM_VIEW_DETAILS:
- {
- UINT index = id - IDM_VIEW_LARGE_ICONS;
- if (index < 4)
- {
- g_App.SetListViewMode(index);
- /*
- CMenu menu;
- menu.Attach(::GetSubMenu(::GetMenu(hWnd), kViewMenuIndex));
- menu.CheckRadioItem(IDM_VIEW_LARGE_ICONS, IDM_VIEW_DETAILS,
- id, MF_BYCOMMAND);
- */
- }
- break;
- }
- case IDM_VIEW_ARANGE_BY_NAME:
- {
- g_App.SortItemsWithPropID(kpidName);
- break;
- }
- case IDM_VIEW_ARANGE_BY_TYPE:
- {
- g_App.SortItemsWithPropID(kpidExtension);
- break;
- }
- case IDM_VIEW_ARANGE_BY_DATE:
- {
- g_App.SortItemsWithPropID(kpidMTime);
- break;
- }
- case IDM_VIEW_ARANGE_BY_SIZE:
- {
- g_App.SortItemsWithPropID(kpidSize);
- break;
- }
- case IDM_VIEW_ARANGE_NO_SORT:
- {
- g_App.SortItemsWithPropID(kpidNoProperty);
- break;
- }
-
- case IDM_OPEN_ROOT_FOLDER:
- g_App.OpenRootFolder();
- break;
- case IDM_OPEN_PARENT_FOLDER:
- g_App.OpenParentFolder();
- break;
- case IDM_FOLDERS_HISTORY:
- g_App.FoldersHistory();
- break;
- case IDM_VIEW_REFRESH:
- g_App.RefreshView();
- break;
- case IDM_VIEW_FLAT_VIEW:
- g_App.ChangeFlatMode();
- break;
- case IDM_VIEW_TWO_PANELS:
- g_App.SwitchOnOffOnePanel();
- break;
- case IDM_VIEW_STANDARD_TOOLBAR:
- g_App.SwitchStandardToolbar();
- break;
- case IDM_VIEW_ARCHIVE_TOOLBAR:
- g_App.SwitchArchiveToolbar();
- break;
- case IDM_VIEW_TOOLBARS_SHOW_BUTTONS_TEXT:
- g_App.SwitchButtonsLables();
- break;
- case IDM_VIEW_TOOLBARS_LARGE_BUTTONS:
- g_App.SwitchLargeButtons();
- break;
-
- // Tools
- case IDM_OPTIONS:
- // FIXME OptionsDialog(hWnd, g_hInstance);
- break;
-
- case IDM_BENCHMARK:
- Benchmark();
- break;
- // Help
- case IDM_HELP_CONTENTS:
- ShowHelpWindow(NULL, kFMHelpTopic);
- break;
- case IDM_ABOUT:
- {
- /* FIXME
- CAboutDialog dialog;
- dialog.Create(hWnd);
- */
- printf("IDM_ABOUT ...\n");
- break;
- }
- default:
- {
- if (id >= kOpenBookmarkMenuID && id <= kOpenBookmarkMenuID + 9)
- {
- g_App.OpenBookmark(id - kOpenBookmarkMenuID);
- return true;
- }
- else if (id >= kSetBookmarkMenuID && id <= kSetBookmarkMenuID + 9)
- {
- g_App.SetBookmark(id - kSetBookmarkMenuID);
- return true;
- }
- return false;
- }
- }
- return true;
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MyLoadMenu.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MyLoadMenu.h
deleted file mode 100644
index 9dae77f00..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/MyLoadMenu.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// MyLoadMenu.h
-
-#ifndef __MYLOADMENU_H
-#define __MYLOADMENU_H
-
-class myHMENU; // FIXME
-typedef myHMENU * HMENU; // FIXME
-
-void OnMenuActivating(HWND hWnd, HMENU hMenu, int position);
-// void OnMenuUnActivating(HWND hWnd, HMENU hMenu, int id);
-// void OnMenuUnActivating(HWND hWnd);
-
-void MyLoadMenu(HWND hWnd);
-bool OnMenuCommand(HWND hWnd, int id);
-void MyLoadMenu();
-void LoadFileMenu(HMENU hMenu, int startPos, bool programMenu,
- bool isFsFolder, int numItems, bool allAreFiles);
-bool ExecuteFileCommand(int id);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/NetFolder.h.OUT b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/NetFolder.h.OUT
deleted file mode 100644
index 384e7f190..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/NetFolder.h.OUT
+++ /dev/null
@@ -1,56 +0,0 @@
-// NetFolder.h
-
-#ifndef __NETFOLDER_H
-#define __NETFOLDER_H
-
-#include "Common/MyString.h"
-#include "Common/Buffer.h"
-#include "Common/MyCom.h"
-#include "Windows/PropVariant.h"
-// FIXME #include "Windows/Net.h"
-
-#include "IFolder.h"
-
-struct CResourceEx // FIXME : public NWindows::NNet::CResourceW
-{
- UString Name;
-};
-
-class CNetFolder:
- public IFolderFolder,
- public IFolderGetSystemIconIndex,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(
- IFolderGetSystemIconIndex
- )
-
- INTERFACE_FolderFolder(;)
-
- STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex);
-
-private:
-#ifdef _WIN32
- NWindows::NNet::CResourceW _netResource;
- NWindows::NNet::CResourceW *_netResourcePointer;
-#else
- int _netResource;
- int *_netResourcePointer;
-#endif
-
- CObjectVector<CResourceEx> _items;
-
- CMyComPtr<IFolderFolder> _parentFolder;
- UString _path;
-
-public:
- void Init(const UString &path);
-#ifdef _WIN32
- void Init(const NWindows::NNet::CResourceW *netResource,
- IFolderFolder *parentFolder, const UString &path);
- CNetFolder(): _netResourcePointer(0) {}
-#endif
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OpenCallback.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OpenCallback.cpp
deleted file mode 100644
index a275f89bc..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OpenCallback.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// OpenCallback.cpp
-
-#include "StdAfx.h"
-
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../../Common/FileStreams.h"
-
-#include "OpenCallback.h"
-#include "PasswordDialog.h"
-
-using namespace NWindows;
-
-STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 *numFiles, const UInt64 *numBytes)
-{
- RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
- {
- NSynchronization::CCriticalSectionLock lock(_criticalSection);
- if (numFiles != NULL)
- {
- ProgressDialog.ProgressSynch.SetNumFilesTotal(*numFiles);
- ProgressDialog.ProgressSynch.SetBytesProgressMode(false);
- }
- if (numBytes != NULL)
- ProgressDialog.ProgressSynch.SetNumBytesTotal(*numBytes);
- }
- return S_OK;
-}
-
-STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 *numFiles, const UInt64 *numBytes)
-{
- RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
- NSynchronization::CCriticalSectionLock lock(_criticalSection);
- if (numFiles != NULL)
- ProgressDialog.ProgressSynch.SetNumFilesCur(*numFiles);
- if (numBytes != NULL)
- ProgressDialog.ProgressSynch.SetPos(*numBytes);
- return S_OK;
-}
-
-STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 total)
-{
- RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
- ProgressDialog.ProgressSynch.SetNumBytesTotal(total);
- return S_OK;
-}
-
-STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 *completed)
-{
- RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
- if (completed != NULL)
- ProgressDialog.ProgressSynch.SetPos(*completed);
- return S_OK;
-}
-
-STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value)
-{
- NCOM::CPropVariant prop;
- if (_subArchiveMode)
- {
- switch(propID)
- {
- case kpidName: prop = _subArchiveName; break;
- }
- }
- else
- {
- switch(propID)
- {
- case kpidName: prop = _fileInfo.Name; break;
- case kpidIsDir: prop = _fileInfo.IsDir(); break;
- case kpidSize: prop = _fileInfo.Size; break;
- case kpidAttrib: prop = (UInt32)_fileInfo.Attrib; break;
- case kpidCTime: prop = _fileInfo.CTime; break;
- case kpidATime: prop = _fileInfo.ATime; break;
- case kpidMTime: prop = _fileInfo.MTime; break;
- }
- }
- prop.Detach(value);
- return S_OK;
-}
-
-STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name,
- IInStream **inStream)
-{
- *inStream = NULL;
- if (_subArchiveMode)
- return S_FALSE;
-
- NFile::NFind::CFileInfoW fileInfo;
-
- UString fullPath = _folderPrefix + name;
- if (!fileInfo.Find(fullPath))
- return S_FALSE;
- _fileInfo = fileInfo;
- if (_fileInfo.IsDir())
- return S_FALSE;
- CInFileStream *inFile = new CInFileStream;
- CMyComPtr<IInStream> inStreamTemp = inFile;
- if (!inFile->Open(fullPath))
- return ::GetLastError();
- *inStream = inStreamTemp.Detach();
- return S_OK;
-}
-
-STDMETHODIMP COpenArchiveCallback::CryptoGetTextPassword(BSTR *password)
-{
- PasswordWasAsked = true;
- if (!PasswordIsDefined)
- {
- CPasswordDialog dialog;
-
- if (dialog.Create(ProgressDialog) == IDCANCEL)
- return E_ABORT;
-
- Password = dialog.Password;
- PasswordIsDefined = true;
- }
- return StringToBstr(Password, password);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OpenCallback.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OpenCallback.h
deleted file mode 100644
index 5f0fbefc1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OpenCallback.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// OpenCallback.h
-
-#ifndef __OPENCALLBACK_H
-#define __OPENCALLBACK_H
-
-#include "Common/MyCom.h"
-#include "Common/MyString.h"
-
-#include "Windows/FileFind.h"
-
-#include "../../IPassword.h"
-
-#include "../../Archive/IArchive.h"
-
-#ifdef _SFX
-#include "ProgressDialog.h"
-#else
-#include "ProgressDialog2.h"
-#endif
-
-
-class COpenArchiveCallback:
- public IArchiveOpenCallback,
- public IArchiveOpenVolumeCallback,
- public IArchiveOpenSetSubArchiveName,
- public IProgress,
- public ICryptoGetTextPassword,
- public CMyUnknownImp
-{
- UString _folderPrefix;
- NWindows::NFile::NFind::CFileInfoW _fileInfo;
- NWindows::NSynchronization::CCriticalSection _criticalSection;
- bool _subArchiveMode;
- UString _subArchiveName;
-
-public:
- bool PasswordIsDefined;
- bool PasswordWasAsked;
- UString Password;
- HWND ParentWindow;
- CProgressDialog ProgressDialog;
-
- MY_UNKNOWN_IMP5(
- IArchiveOpenCallback,
- IArchiveOpenVolumeCallback,
- IArchiveOpenSetSubArchiveName,
- IProgress,
- ICryptoGetTextPassword)
-
- INTERFACE_IProgress(;)
- INTERFACE_IArchiveOpenCallback(;)
- INTERFACE_IArchiveOpenVolumeCallback(;)
-
- // ICryptoGetTextPassword
- STDMETHOD(CryptoGetTextPassword)(BSTR *password);
-
- STDMETHOD(SetSubArchiveName(const wchar_t *name))
- {
- _subArchiveMode = true;
- _subArchiveName = name;
- return S_OK;
- }
-
- COpenArchiveCallback():
- ParentWindow(0)
- {
- _subArchiveMode = false;
- PasswordIsDefined = false;
- PasswordWasAsked = false;
- }
- /*
- void Init()
- {
- PasswordIsDefined = false;
- _subArchiveMode = false;
- }
- */
- void LoadFileInfo(const UString &folderPrefix, const UString &fileName)
- {
- _folderPrefix = folderPrefix;
- if (!_fileInfo.Find(_folderPrefix + fileName))
- throw 1;
- }
- void ShowMessage(const UInt64 *completed);
-
- INT_PTR StartProgressDialog(const UString &title)
- {
- return ProgressDialog.Create(title, ParentWindow);
- }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialog.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
deleted file mode 100644
index 2d6bc5217..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-// OverwriteDialog.cpp
-
-#include "StdAfx.h"
-
-#include "OverwriteDialog.h"
-
-#include "Common/StringConvert.h"
-#include "Windows/FileName.h"
-#include "Windows/Defs.h"
-#include "Windows/ResourceString.h"
-#include "Windows/Control/Static.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "FormatUtils.h"
-
-// #include "../resource.h"
-
-#ifdef LANG
-#include "LangUtils.h"
-#endif
-
-using namespace NWindows;
-
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDC_STATIC_OVERWRITE_HEADER, 0x02000901},
- { IDC_STATIC_OVERWRITE_QUESTION_BEGIN, 0x02000902 },
- { IDC_STATIC_OVERWRITE_QUESTION_END, 0x02000903 },
- { IDYES, 0x02000705 },
- { IDC_BUTTON_OVERWRITE_YES_TO_ALL, 0x02000707 },
- { IDNO, 0x02000709 },
- { IDC_BUTTON_OVERWRITE_NO_TO_ALL,0x0200070B },
- { IDC_BUTTON_OVERWRITE_AUTO_RENAME, 0x02000911 },
- { IDCANCEL, 0x02000711 }
-};
-#endif
-
-void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
- const NOverwriteDialog::CFileInfo &fileInfo)
-{
- UString sizeString;
- if (fileInfo.SizeIsDefined)
- sizeString = MyFormatNew(IDS_FILE_SIZE,
- #ifdef LANG
- 0x02000982,
- #endif
- NumberToString(fileInfo.Size));
-
- UString reducedName;
- const int kLineSize = 88;
- for (int i = 0; i < fileInfo.Name.Length();)
- {
- reducedName += fileInfo.Name.Mid(i, kLineSize);
- reducedName += L" ";
- i += kLineSize;
- }
-
- UString fullString = reducedName;
- fullString += L"\n";
- fullString += sizeString;
- fullString += L"\n";
-
- if (fileInfo.TimeIsDefined)
- {
- UString timeString;
- FILETIME localFileTime;
- if (!FileTimeToLocalFileTime(&fileInfo.Time, &localFileTime))
- throw 4190402;
- timeString = ConvertFileTimeToString(localFileTime);
-
- fullString +=
- #ifdef LANG
- LangString(IDS_FILE_MODIFIED, 0x02000983);
- #else
- MyLoadStringW(IDS_FILE_MODIFIED);
- #endif
-
- fullString += L" ";
- fullString += timeString;
- }
-
- NWindows::NControl::CDialogChildControl control;
- control.Init(*this, textID);
- control.SetText(fullString);
-
-#ifdef _WIN32 // FIXME
- SHFILEINFO shellFileInfo;
- if (::SHGetFileInfo(
- GetSystemString(fileInfo.Name), FILE_ATTRIBUTE_NORMAL, &shellFileInfo,
- sizeof(shellFileInfo), SHGFI_ICON | SHGFI_USEFILEATTRIBUTES | SHGFI_LARGEICON))
- {
- NControl::CStatic staticContol;
- staticContol.Attach(GetItem(iconID));
- staticContol.SetIcon(shellFileInfo.hIcon);
- }
-#endif
-}
-
-bool COverwriteDialog::OnInit()
-{
- #ifdef LANG
- LangSetWindowText(HWND(*this), 0x02000900);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- #endif
- SetFileInfoControl(IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME,
- IDC_STATIC_OVERWRITE_OLD_FILE_ICON, OldFileInfo);
- SetFileInfoControl(IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME,
- IDC_STATIC_OVERWRITE_NEW_FILE_ICON, NewFileInfo);
- return CModalDialog::OnInit();
-}
-
-bool COverwriteDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
- switch(buttonID)
- {
- case IDYES:
- case IDC_BUTTON_OVERWRITE_YES_TO_ALL:
- case IDNO:
- case IDC_BUTTON_OVERWRITE_NO_TO_ALL:
- case IDC_BUTTON_OVERWRITE_AUTO_RENAME:
- End(buttonID);
- return true;
- }
- return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialog.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialog.h
deleted file mode 100644
index d206fb015..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialog.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// OverwriteDialog.h
-
-#ifndef __OVERWRITEDIALOG_H
-#define __OVERWRITEDIALOG_H
-
-#include "OverwriteDialogRes.h"
-#include "Windows/Control/Dialog.h"
-
-namespace NOverwriteDialog
-{
- struct CFileInfo
- {
- bool SizeIsDefined;
- UINT64 Size;
- bool TimeIsDefined;
- FILETIME Time;
- UString Name;
- };
-}
-
-class COverwriteDialog: public NWindows::NControl::CModalDialog
-{
- void SetFileInfoControl(int textID, int iconID,
- const NOverwriteDialog::CFileInfo &fileInfo);
- virtual bool OnInit();
- bool OnButtonClicked(int buttonID, HWND buttonHWND);
-public:
- INT_PTR Create(HWND parent = 0) { return CModalDialog::Create(IDD_DIALOG_OVERWRITE, parent); }
-
- NOverwriteDialog::CFileInfo OldFileInfo;
- NOverwriteDialog::CFileInfo NewFileInfo;
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialogRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialogRes.h
deleted file mode 100644
index 66710f848..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialogRes.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#define IDS_FILE_MODIFIED 600
-#define IDS_FILE_SIZE 601
-
-#define IDD_DIALOG_OVERWRITE 502
-
-#define IDC_STATIC_OVERWRITE_HEADER 1000
-
-#define IDC_STATIC_OVERWRITE_QUESTION_BEGIN 1001
-#define IDC_STATIC_OVERWRITE_QUESTION_END 1002
-
-#define IDC_STATIC_OVERWRITE_OLD_FILE_ICON 1003
-#define IDC_STATIC_OVERWRITE_NEW_FILE_ICON 1004
-
-#define IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME 1005
-#define IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME 1006
-
-#define IDC_BUTTON_OVERWRITE_YES_TO_ALL 1010
-#define IDC_BUTTON_OVERWRITE_NO_TO_ALL 1011
-#define IDC_BUTTON_OVERWRITE_AUTO_RENAME 1012
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialog_rc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialog_rc.cpp
deleted file mode 100644
index 08ddd36de..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/OverwriteDialog_rc.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-// OverwriteDialog_rc.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#include "OverwriteDialogRes.h"
-#include "Windows/Control/DialogImpl.h"
-
-/*
-IDD_DIALOG_OVERWRITE DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
-CAPTION "Confirm File Replace"
-MY_FONT
-BEGIN
- LTEXT "Destination folder already contains processed file.", IDC_STATIC_OVERWRITE_HEADER, marg, 7, xSize2, 8
- LTEXT "Would you like to replace the existing file", IDC_STATIC_OVERWRITE_QUESTION_BEGIN, marg, 28, xSize2, 8
- ICON "", IDC_STATIC_OVERWRITE_OLD_FILE_ICON, marg, 44, iconSize, iconSize
- LTEXT "", IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME, fiXPos, 44, fiXSize, fiYSize, SS_NOPREFIX
- LTEXT "with this one?",IDC_STATIC_OVERWRITE_QUESTION_END, marg, 98, xSize2, 8
- ICON "",IDC_STATIC_OVERWRITE_NEW_FILE_ICON, marg, 114, iconSize, iconSize
- LTEXT "",IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME, fiXPos, 114, fiXSize, fiYSize, SS_NOPREFIX
- PUSHBUTTON "&Yes", IDYES, 78, b2YPos, bXSize, bYSize
- PUSHBUTTON "Yes to &All", IDC_BUTTON_OVERWRITE_YES_TO_ALL, 152, b2YPos, bXSize, bYSize
- PUSHBUTTON "&No", IDNO, 226, b2YPos, bXSize, bYSize
- PUSHBUTTON "No to A&ll", IDC_BUTTON_OVERWRITE_NO_TO_ALL, 300, b2YPos, bXSize, bYSize
- PUSHBUTTON "A&uto Rename", IDC_BUTTON_OVERWRITE_AUTO_RENAME, 181, b1YPos, 109, bYSize
- PUSHBUTTON "&Cancel", IDCANCEL, 300, b1YPos, bXSize, bYSize
-END
-*/
-
-class COverwriteDialogImpl : public NWindows::NControl::CModalDialogImpl
-{
- public:
- COverwriteDialogImpl(NWindows::NControl::CModalDialog *dialog,wxWindow * parent , int id) : CModalDialogImpl(dialog,parent, id, wxT("Confirm File Replace"))
- {
- ///Sizer for adding the controls created by users
- wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
-
- topsizer->Add(new wxStaticText(this, IDC_STATIC_OVERWRITE_HEADER, _T("Destination folder already contains processed file.")) , 0 ,wxALL | wxALIGN_LEFT, 5 );
- topsizer->Add(new wxStaticText(this, IDC_STATIC_OVERWRITE_QUESTION_BEGIN, _T("Would you like to replace the existing file")) , 0 ,wxALL | wxALIGN_LEFT, 5 );
-
- // FIXME ICON "", IDC_STATIC_OVERWRITE_OLD_FILE_ICON, marg, 44, iconSize, iconSize
- topsizer->Add(new wxStaticText(this, IDC_STATIC_OVERWRITE_OLD_FILE_SIZE_TIME, _T(""),
- wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT) , 0 ,wxALL | wxALIGN_LEFT, 15 );
- topsizer->Add(new wxStaticText(this, IDC_STATIC_OVERWRITE_QUESTION_END, _T("with this one?")) , 0 ,wxALL | wxALIGN_LEFT, 5 );
-
- // FIXME ICON "",IDC_STATIC_OVERWRITE_NEW_FILE_ICON, marg, 114, iconSize, iconSize
- topsizer->Add(new wxStaticText(this, IDC_STATIC_OVERWRITE_NEW_FILE_SIZE_TIME, _T(""),
- wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT) , 0 ,wxALL | wxALIGN_LEFT, 15 );
-
- wxBoxSizer* Sizer1 = new wxBoxSizer(wxHORIZONTAL);
- Sizer1->Add(new wxButton(this, wxID_YES, _T("&Yes")) , 0, wxALL | wxALIGN_RIGHT, 5);
- Sizer1->Add(new wxButton(this, IDC_BUTTON_OVERWRITE_YES_TO_ALL, _T("Yes to &All")) , 0, wxALL | wxALIGN_RIGHT, 5);
- Sizer1->Add(new wxButton(this, wxID_NO, _T("&No")) , 0, wxALL | wxALIGN_RIGHT, 5);
- Sizer1->Add(new wxButton(this, IDC_BUTTON_OVERWRITE_NO_TO_ALL, _T("No to A&ll")) , 0, wxALL | wxALIGN_RIGHT, 5);
- topsizer->Add(Sizer1 , 0, wxALL | wxALIGN_RIGHT, 5);
-
- wxBoxSizer* Sizer2 = new wxBoxSizer(wxHORIZONTAL);
- Sizer2->Add(new wxButton(this, IDC_BUTTON_OVERWRITE_AUTO_RENAME, _T("A&uto Rename")) , 0, wxALL | wxALIGN_RIGHT, 5);
- Sizer2->Add(new wxButton(this, wxID_CANCEL, _T("&Cancel")) , 0, wxALL | wxALIGN_RIGHT, 5);
- topsizer->Add(Sizer2 , 1, wxALL | wxALIGN_RIGHT, 5);
-
- this->OnInit();
-
- SetSizer(topsizer); // use the sizer for layout
- topsizer->SetSizeHints(this); // set size hints to honour minimum size
- }
-private:
- // Any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-static CStringTable g_stringTable[] =
-{
- { IDS_FILE_MODIFIED, L"modified on" },
- { IDS_FILE_SIZE, L"{0} bytes" },
- { 0 , 0 }
-};
-
-REGISTER_DIALOG(IDD_DIALOG_OVERWRITE,COverwriteDialog,g_stringTable)
-
-BEGIN_EVENT_TABLE(COverwriteDialogImpl, wxDialog)
- EVT_BUTTON(wxID_ANY, CModalDialogImpl::OnAnyButton)
-END_EVENT_TABLE()
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/Panel.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/Panel.cpp
deleted file mode 100644
index a9123da80..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/Panel.cpp
+++ /dev/null
@@ -1,1100 +0,0 @@
-// Panel.cpp
-
-#include "StdAfx.h"
-
-#ifdef _WIN32
-#include <Windowsx.h>
-#endif
-
-#include "Common/Defs.h"
-#include "Common/StringConvert.h"
-#include "Common/IntToString.h"
-#include "Windows/Error.h"
-#include "Windows/PropVariant.h"
-#include "Windows/Thread.h"
-
-#include "../../PropID.h"
-
-#include "Panel.h"
-#include "RootFolder.h"
-#include "FSFolder.h"
-#include "FormatUtils.h"
-#include "App.h"
-#include "ExtractCallback.h"
-
-#include "resource.h"
-#include "../GUI/ExtractRes.h"
-
-#include "../Agent/IFolderArchive.h"
-
-#include "../Common/CompressCall.h"
-#include "../Common/ArchiveName.h"
-
-using namespace NWindows;
-using namespace NControl;
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-static const UINT_PTR kTimerID = 1;
-static const UINT kTimerElapse = 1000;
-
-#ifdef _WIN32
-static DWORD kStyles[4] = { LVS_ICON, LVS_SMALLICON, LVS_LIST, LVS_REPORT };
-#endif
-
-// static const int kCreateFolderID = 101;
-// static const UINT kFileChangeNotifyMessage = WM_APP;
-
-extern HINSTANCE g_hInstance;
-extern DWORD g_ComCtl32Version;
-
-void CPanel::Release()
-{
- // It's for unloading COM dll's: don't change it.
- CloseOpenFolders();
-#ifdef _WIN32
- _sevenZipContextMenu.Release();
- _systemContextMenu.Release();
-#endif
-}
-
-CPanel::~CPanel()
-{
- CloseOpenFolders();
-}
-
-#ifdef _WIN32 // FIXME
-HWND CPanel::GetParent()
-{
- HWND h = CWindow2::GetParent();
- return (h == 0) ? _mainWindow : h;
-}
-#endif
-
-static LPCWSTR kClassName = L"7-Zip::Panel";
-
-
-HRESULT CPanel::Create(HWND mainWindow, HWND parentWindow, UINT id,
- const UString &currentFolderPrefix, CPanelCallback *panelCallback, CAppState *appState,
- bool &archiveIsOpened, bool &encrypted)
-{
- _mainWindow = mainWindow;
- _processTimer = true;
- _processNotify = true;
-
- _panelCallback = panelCallback;
- _appState = appState;
- // _index = index;
- _baseID = id;
- _comboBoxID = _baseID + 3;
- _statusBarID = _comboBoxID + 1;
-
- UString cfp = currentFolderPrefix;
-
- if (!currentFolderPrefix.IsEmpty())
- if (currentFolderPrefix[0] == L'.')
- if (!NFile::NDirectory::MyGetFullPathName(currentFolderPrefix, cfp))
- cfp = currentFolderPrefix;
- RINOK(BindToPath(cfp, archiveIsOpened, encrypted));
-
-#ifdef _WIN32
- if (!CreateEx(0, kClassName, 0, WS_CHILD | WS_VISIBLE,
- 0, 0, _xSize, 260,
- parentWindow, (HMENU)(UINT_PTR)id, g_hInstance))
- return E_FAIL;
-#else
- {
- // printf("WARNING CPanel::Create => CreateEx\n");
- // this->OnCreate(0);
- extern void registerWindow2(int baseID,NWindows::NControl::CWindow2 *w);
- registerWindow2(_baseID,this);
- }
-#endif
-
- return S_OK;
-}
-
-LRESULT CPanel::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch(message)
- {
- case kShiftSelectMessage:
- OnShiftSelectMessage();
- return 0;
- case kReLoadMessage:
- RefreshListCtrl(_selectedState);
- return 0;
- case kSetFocusToListView:
- _listView.SetFocus();
- return 0;
- case kOpenItemChanged:
- return OnOpenItemChanged(lParam);
- case kRefreshStatusBar:
- OnRefreshStatusBar();
- return 0;
-#ifdef _WIN32
- case WM_TIMER:
- OnTimer();
- return 0;
- case WM_CONTEXTMENU:
- if (OnContextMenu(HANDLE(wParam), GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)))
- return 0;
- break;
- /*
- case WM_DROPFILES:
- CompressDropFiles(HDROP(wParam));
- return 0;
- */
-#endif
- }
- return CWindow2::OnMessage(message, wParam, lParam);
-}
-
-#ifdef _WIN32
-static LRESULT APIENTRY ListViewSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- CWindow tempDialog(hwnd);
- CMyListView *w = (CMyListView *)(tempDialog.GetUserDataLongPtr());
- if (w == NULL)
- return 0;
- return w->OnMessage(message, wParam, lParam);
-}
-
-LRESULT CMyListView::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
-{
- if (message == WM_CHAR)
- {
- UINT scanCode = (UINT)((lParam >> 16) & 0xFF);
- bool extended = ((lParam & 0x1000000) != 0);
- UINT virtualKey = MapVirtualKey(scanCode, 1);
- if (virtualKey == VK_MULTIPLY || virtualKey == VK_ADD ||
- virtualKey == VK_SUBTRACT)
- return 0;
- if ((wParam == '/' && extended)
- || wParam == CHAR_PATH_SEPARATOR || wParam == '/')
- {
- _panel->OpenDrivesFolder();
- return 0;
- }
- }
- else if (message == WM_SYSCHAR)
- {
- // For Alt+Enter Beep disabling
- UINT scanCode = (UINT)(lParam >> 16) & 0xFF;
- UINT virtualKey = MapVirtualKey(scanCode, 1);
- if (virtualKey == VK_RETURN || virtualKey == VK_MULTIPLY ||
- virtualKey == VK_ADD || virtualKey == VK_SUBTRACT)
- return 0;
- }
- /*
- else if (message == WM_SYSKEYDOWN)
- {
- // return 0;
- }
- */
- else if (message == WM_KEYDOWN)
- {
- bool alt = (::GetKeyState(VK_MENU) & 0x8000) != 0;
- bool ctrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
- // bool leftCtrl = (::GetKeyState(VK_LCONTROL) & 0x8000) != 0;
- // bool RightCtrl = (::GetKeyState(VK_RCONTROL) & 0x8000) != 0;
- bool shift = (::GetKeyState(VK_SHIFT) & 0x8000) != 0;
- switch(wParam)
- {
- case VK_RETURN:
- {
- if (shift && !alt && !ctrl)
- {
- _panel->OpenSelectedItems(false);
- return 0;
- }
- break;
- }
- case VK_NEXT:
- {
- if (ctrl && !alt && !shift)
- {
- _panel->OpenFocusedItemAsInternal();
- return 0;
- }
- break;
- }
- case VK_PRIOR:
- if (ctrl && !alt && !shift)
- {
- _panel->OpenParentFolder();
- return 0;
- }
- }
- }
- else if (message == WM_SETFOCUS)
- {
- _panel->_lastFocusedIsList = true;
- _panel->_panelCallback->PanelWasFocused();
- }
- #ifndef _UNICODE
- if (g_IsNT)
- return CallWindowProcW(_origWindowProc, *this, message, wParam, lParam);
- else
- #endif
- return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
-}
-
-/*
-static LRESULT APIENTRY ComboBoxSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- CWindow tempDialog(hwnd);
- CMyComboBox *w = (CMyComboBox *)(tempDialog.GetUserDataLongPtr());
- if (w == NULL)
- return 0;
- return w->OnMessage(message, wParam, lParam);
-}
-
-LRESULT CMyComboBox::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
-{
- return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
-}
-*/
-static LRESULT APIENTRY ComboBoxEditSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- CWindow tempDialog(hwnd);
- CMyComboBoxEdit *w = (CMyComboBoxEdit *)(tempDialog.GetUserDataLongPtr());
- if (w == NULL)
- return 0;
- return w->OnMessage(message, wParam, lParam);
-}
-
-LRESULT CMyComboBoxEdit::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
-{
- // See MSDN / Subclassing a Combo Box / Creating a Combo-box Toolbar
- switch (message)
- {
- case WM_SYSKEYDOWN:
- switch (wParam)
- {
- case VK_F1:
- case VK_F2:
- {
- // check ALT
- if ((lParam & (1<<29)) == 0)
- break;
- bool alt = (::GetKeyState(VK_MENU) & 0x8000) != 0;
- bool ctrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
- bool shift = (::GetKeyState(VK_SHIFT) & 0x8000) != 0;
- if (alt && !ctrl && !shift)
- {
- _panel->_panelCallback->SetFocusToPath(wParam == VK_F1 ? 0 : 1);
- return 0;
- }
- break;
- }
- }
- break;
- case WM_KEYDOWN:
- switch (wParam)
- {
- case VK_TAB:
- // SendMessage(hwndMain, WM_ENTER, 0, 0);
- _panel->SetFocusToList();
- return 0;
- case VK_F9:
- {
- bool alt = (::GetKeyState(VK_MENU) & 0x8000) != 0;
- bool ctrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
- bool shift = (::GetKeyState(VK_SHIFT) & 0x8000) != 0;
- if (!alt && !ctrl && !shift)
- {
- g_App.SwitchOnOffOnePanel();;
- return 0;
- }
- break;
- }
- }
- break;
- case WM_CHAR:
- switch (wParam)
- {
- case VK_TAB:
- case VK_ESCAPE:
- return 0;
- }
- }
- #ifndef _UNICODE
- if (g_IsNT)
- return CallWindowProcW(_origWindowProc, *this, message, wParam, lParam);
- else
- #endif
- return CallWindowProc(_origWindowProc, *this, message, wParam, lParam);
-}
-
-static HIMAGELIST GetSysImageList(bool smallIcons)
-{
- SHFILEINFO shellInfo;
- return (HIMAGELIST)SHGetFileInfo(TEXT(""),
- FILE_ATTRIBUTE_NORMAL |FILE_ATTRIBUTE_DIRECTORY,
- &shellInfo, sizeof(shellInfo),
- SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX | (smallIcons ? SHGFI_SMALLICON : SHGFI_ICON));
-}
-
-bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
-{
- // _virtualMode = false;
- // _sortIndex = 0;
- _sortID = kpidName;
- _ascending = true;
- _lastFocusedIsList = true;
-
- DWORD style = WS_CHILD | WS_VISIBLE; // | WS_BORDER ; // | LVS_SHAREIMAGELISTS; // | LVS_SHOWSELALWAYS;;
-
- style |= LVS_SHAREIMAGELISTS;
- // style |= LVS_AUTOARRANGE;
- style |= WS_CLIPCHILDREN;
- style |= WS_CLIPSIBLINGS;
-
- const UInt32 kNumListModes = sizeof(kStyles) / sizeof(kStyles[0]);
- if (_ListViewMode >= kNumListModes)
- _ListViewMode = kNumListModes - 1;
-
- style |= kStyles[_ListViewMode]
- | WS_TABSTOP
- | LVS_EDITLABELS;
- if (_mySelectMode)
- style |= LVS_SINGLESEL;
-
- /*
- if (_virtualMode)
- style |= LVS_OWNERDATA;
- */
-
- DWORD exStyle;
- exStyle = WS_EX_CLIENTEDGE;
-
- if (!_listView.CreateEx(exStyle, style, 0, 0, 116, 260,
- HWND(*this), (HMENU)(UINT_PTR)(_baseID + 1), g_hInstance, NULL))
- return false;
-
- _listView.SetUnicodeFormat(true);
-
- _listView.SetUserDataLongPtr(LONG_PTR(&_listView));
- _listView._panel = this;
-
- #ifndef _UNICODE
- if(g_IsNT)
- _listView._origWindowProc =
- (WNDPROC)_listView.SetLongPtrW(GWLP_WNDPROC, LONG_PTR(ListViewSubclassProc));
- else
- #endif
- _listView._origWindowProc =
- (WNDPROC)_listView.SetLongPtr(GWLP_WNDPROC, LONG_PTR(ListViewSubclassProc));
-
- _listView.SetImageList(GetSysImageList(true), LVSIL_SMALL);
- _listView.SetImageList(GetSysImageList(false), LVSIL_NORMAL);
-
- // _exStyle |= LVS_EX_HEADERDRAGDROP;
- // DWORD extendedStyle = _listView.GetExtendedListViewStyle();
- // extendedStyle |= _exStyle;
- // _listView.SetExtendedListViewStyle(extendedStyle);
- SetExtendedStyle();
-
- _listView.Show(SW_SHOW);
- _listView.InvalidateRect(NULL, true);
- _listView.Update();
-
- // Ensure that the common control DLL is loaded.
- INITCOMMONCONTROLSEX icex;
-
- icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
- icex.dwICC = ICC_BAR_CLASSES;
- InitCommonControlsEx(&icex);
-
- TBBUTTON tbb [ ] =
- {
- // {0, 0, TBSTATE_ENABLED, BTNS_SEP, 0L, 0},
- {VIEW_PARENTFOLDER, kParentFolderID, TBSTATE_ENABLED, BTNS_BUTTON, 0L, 0},
- // {0, 0, TBSTATE_ENABLED, BTNS_SEP, 0L, 0},
- // {VIEW_NEWFOLDER, kCreateFolderID, TBSTATE_ENABLED, BTNS_BUTTON, 0L, 0},
- };
-
- if (g_ComCtl32Version >= MAKELONG(71, 4))
- {
- icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
- icex.dwICC = ICC_COOL_CLASSES | ICC_BAR_CLASSES;
- InitCommonControlsEx(&icex);
-
- _headerReBar.Attach(::CreateWindowEx(WS_EX_TOOLWINDOW,
- REBARCLASSNAME,
- NULL, WS_VISIBLE | WS_BORDER | WS_CHILD |
- WS_CLIPCHILDREN | WS_CLIPSIBLINGS
- | CCS_NODIVIDER
- | CCS_NOPARENTALIGN
- | CCS_TOP
- | RBS_VARHEIGHT
- | RBS_BANDBORDERS
- ,0,0,0,0, HWND(*this), NULL, g_hInstance, NULL));
- }
-
- DWORD toolbarStyle = WS_CHILD | WS_VISIBLE ;
- if (_headerReBar)
- {
- toolbarStyle |= 0
- // | WS_CLIPCHILDREN
- // | WS_CLIPSIBLINGS
-
- | TBSTYLE_TOOLTIPS
- | CCS_NODIVIDER
- | CCS_NORESIZE
- | TBSTYLE_FLAT
- ;
- }
-
- _headerToolBar.Attach(::CreateToolbarEx ((*this), toolbarStyle,
- _baseID + 2, 11,
- (HINSTANCE)HINST_COMMCTRL,
- IDB_VIEW_SMALL_COLOR,
- (LPCTBBUTTON)&tbb, sizeof(tbb) / sizeof(tbb[0]),
- 0, 0, 0, 0, sizeof (TBBUTTON)));
-
- icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
- icex.dwICC = ICC_USEREX_CLASSES;
- InitCommonControlsEx(&icex);
-
- _headerComboBox.CreateEx(0, WC_COMBOBOXEXW, NULL,
- WS_BORDER | WS_VISIBLE |WS_CHILD | CBS_DROPDOWN | CBS_AUTOHSCROLL,
- 0, 0, 100, 520,
- ((_headerReBar == 0) ? HWND(*this) : _headerToolBar),
- (HMENU)(UINT_PTR)(_comboBoxID),
- g_hInstance, NULL);
- _headerComboBox.SendMessage(CBEM_SETUNICODEFORMAT, (WPARAM)(BOOL)TRUE, 0);
-
- _headerComboBox.SetImageList(GetSysImageList(true));
-
- _headerComboBox.SetExtendedStyle(CBES_EX_PATHWORDBREAKPROC, CBES_EX_PATHWORDBREAKPROC);
-
- /*
- _headerComboBox.SetUserDataLongPtr(LONG_PTR(&_headerComboBox));
- _headerComboBox._panel = this;
- _headerComboBox._origWindowProc =
- (WNDPROC)_headerComboBox.SetLongPtr(GWLP_WNDPROC,
- LONG_PTR(ComboBoxSubclassProc));
- */
- _comboBoxEdit.Attach(_headerComboBox.GetEditControl());
-
- // _comboBoxEdit.SendMessage(CCM_SETUNICODEFORMAT, (WPARAM)(BOOL)TRUE, 0);
-
- _comboBoxEdit.SetUserDataLongPtr(LONG_PTR(&_comboBoxEdit));
- _comboBoxEdit._panel = this;
- #ifndef _UNICODE
- if(g_IsNT)
- _comboBoxEdit._origWindowProc =
- (WNDPROC)_comboBoxEdit.SetLongPtrW(GWLP_WNDPROC, LONG_PTR(ComboBoxEditSubclassProc));
- else
- #endif
- _comboBoxEdit._origWindowProc =
- (WNDPROC)_comboBoxEdit.SetLongPtr(GWLP_WNDPROC, LONG_PTR(ComboBoxEditSubclassProc));
-
- if (_headerReBar)
- {
- REBARINFO rbi;
- rbi.cbSize = sizeof(REBARINFO); // Required when using this struct.
- rbi.fMask = 0;
- rbi.himl = (HIMAGELIST)NULL;
- _headerReBar.SetBarInfo(&rbi);
-
- // Send the TB_BUTTONSTRUCTSIZE message, which is required for
- // backward compatibility.
- // _headerToolBar.SendMessage(TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
- SIZE size;
- _headerToolBar.GetMaxSize(&size);
-
- REBARBANDINFO rbBand;
- rbBand.cbSize = sizeof(REBARBANDINFO); // Required
- rbBand.fMask = RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE;
- rbBand.fStyle = RBBS_NOGRIPPER;
- rbBand.cxMinChild = size.cx;
- rbBand.cyMinChild = size.cy;
- rbBand.cyChild = size.cy;
- rbBand.cx = size.cx;
- rbBand.hwndChild = _headerToolBar;
- _headerReBar.InsertBand(-1, &rbBand);
-
- RECT rc;
- ::GetWindowRect(_headerComboBox, &rc);
- rbBand.cxMinChild = 30;
- rbBand.cyMinChild = rc.bottom - rc.top;
- rbBand.cx = 1000;
- rbBand.hwndChild = _headerComboBox;
- _headerReBar.InsertBand(-1, &rbBand);
- // _headerReBar.MaximizeBand(1, false);
- }
-
- _statusBar.Create(WS_CHILD | WS_VISIBLE, L"Status", (*this), _statusBarID);
- // _statusBar2.Create(WS_CHILD | WS_VISIBLE, L"Status", (*this), _statusBarID + 1);
-
- int sizes[] = {150, 250, 350, -1};
- _statusBar.SetParts(4, sizes);
- // _statusBar2.SetParts(5, sizes);
-
- /*
- RECT rect;
- GetClientRect(&rect);
- OnSize(0, rect.right - rect.left, rect.top - rect.bottom);
- */
-
- SetTimer(kTimerID, kTimerElapse);
-
- // InitListCtrl();
- RefreshListCtrl();
- RefreshStatusBar();
-
- return true;
-}
-#else
-bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
-{
- printf("WARNING CPanel::OnCreate\n");
- _sortID = kpidName;
- _ascending = true;
- _lastFocusedIsList = true;
-
- extern HWND g_HWND;
- HWND w = GetDlgItem(g_HWND, _comboBoxID);
- if (w == 0)
- {
- printf("Can't find id=%d\n",_comboBoxID);
- return false;
- }
- printf("CPanel::OnCreate : _headerComboBox.Attach(%p)\n",w);
- _headerComboBox.Attach(w);
-
- w = GetDlgItem(g_HWND, _statusBarID);
- if (w == 0)
- {
- printf("Can't find id=%d\n",_statusBarID);
- return false;
- }
- printf("CPanel::OnCreate : _statusBar.Attach(%p)\n",w);
- _statusBar.Attach(w);
-
- w = GetDlgItem(g_HWND, _baseID + 1);
- if (w == 0)
- {
- printf("Can't find id=%d\n",_baseID + 1);
- return false;
- }
- printf("CPanel::OnCreate : _listView.Attach(%p)\n",w);
- _listView.Attach(w);
-
- _listView.SetUnicodeFormat(true);
-
- // _listView.SetUserDataLongPtr(LONG_PTR(&_listView));
- _listView._panel = this;
-
- // FIXME _listView.SetImageList(GetSysImageList(true), LVSIL_SMALL);
- // FIXME _listView.SetImageList(GetSysImageList(false), LVSIL_NORMAL);
-
- // FIXME SetExtendedStyle();
-
- // FIXME _listView.Show(SW_SHOW);
- // FIXME _listView.InvalidateRect(NULL, true);
- _listView.Update();
-
- /* FIXME
- _headerToolBar.Attach(::CreateToolbarEx ((*this), toolbarStyle,
- _baseID + 2, 11,
- (HINSTANCE)HINST_COMMCTRL,
- IDB_VIEW_SMALL_COLOR,
- (LPCTBBUTTON)&tbb, sizeof(tbb) / sizeof(tbb[0]),
- 0, 0, 0, 0, sizeof (TBBUTTON)));
- */
-
- /* FIXME
- _headerComboBox.CreateEx(0, WC_COMBOBOXEXW, NULL,
- WS_BORDER | WS_VISIBLE |WS_CHILD | CBS_DROPDOWN | CBS_AUTOHSCROLL,
- 0, 0, 100, 520,
- ((_headerReBar == 0) ? HWND(*this) : _headerToolBar),
- (HMENU)(UINT_PTR)(_comboBoxID),
- g_hInstance, NULL);
- _headerComboBox.SendMessage(CBEM_SETUNICODEFORMAT, (WPARAM)(BOOL)TRUE, 0);
-
- _headerComboBox.SetImageList(GetSysImageList(true));
-
- _headerComboBox.SetExtendedStyle(CBES_EX_PATHWORDBREAKPROC, CBES_EX_PATHWORDBREAKPROC);
- */
-
- // FIXME _comboBoxEdit.Attach(_headerComboBox.GetEditControl());
-
- _comboBoxEdit._panel = this;
-
- // FIXME if (_headerReBar) ...
-
- // _statusBar.Create(WS_CHILD | WS_VISIBLE, L"Status", (*this), _statusBarID);
-
- // int sizes[] = {150, 250, 350, -1};
- // _statusBar.SetParts(4, sizes);
-
- // SetTimer(kTimerID, kTimerElapse);
-
- // InitListCtrl();
- RefreshListCtrl();
- RefreshStatusBar();
-
- return true;
-}
-#endif
-
-
-void CPanel::OnDestroy()
-{
- printf("CPanel::OnDestroy\n");
-
- SaveListViewInfo();
- CWindow2::OnDestroy();
-}
-
-#ifdef _WIN32
-void CPanel::ChangeWindowSize(int xSize, int ySize)
-{
- int kHeaderSize;
- int kStatusBarSize;
- // int kStatusBar2Size;
- RECT rect;
- if (_headerReBar)
- _headerReBar.GetWindowRect(&rect);
- else
- _headerToolBar.GetWindowRect(&rect);
-
- kHeaderSize = rect.bottom - rect.top;
-
- _statusBar.GetWindowRect(&rect);
- kStatusBarSize = rect.bottom - rect.top;
-
- // _statusBar2.GetWindowRect(&rect);
- // kStatusBar2Size = rect.bottom - rect.top;
-
- int yListViewSize = MyMax(ySize - kHeaderSize - kStatusBarSize, 0);
- const int kStartXPos = 32;
- if (_headerReBar)
- {
- }
- else
- {
- _headerToolBar.Move(0, 0, xSize, 0);
- _headerComboBox.Move(kStartXPos, 2,
- MyMax(xSize - kStartXPos - 10, kStartXPos), 0);
- }
- _listView.Move(0, kHeaderSize, xSize, yListViewSize);
- _statusBar.Move(0, kHeaderSize + yListViewSize, xSize, kStatusBarSize);
- // _statusBar2.MoveWindow(0, kHeaderSize + yListViewSize + kStatusBarSize, xSize, kStatusBar2Size);
- // _statusBar.MoveWindow(0, 100, xSize, kStatusBarSize);
- // _statusBar2.MoveWindow(0, 200, xSize, kStatusBar2Size);
-}
-
-bool CPanel::OnSize(WPARAM /* wParam */, int xSize, int ySize)
-{
- if (_headerReBar)
- _headerReBar.Move(0, 0, xSize, 0);
- ChangeWindowSize(xSize, ySize);
- return true;
-}
-
-bool CPanel::OnNotifyReBar(LPNMHDR header, LRESULT & /* result */)
-{
- switch(header->code)
- {
- case RBN_HEIGHTCHANGE:
- {
- RECT rect;
- GetWindowRect(&rect);
- ChangeWindowSize(rect.right - rect.left, rect.bottom - rect.top);
- return false;
- }
- }
- return false;
-}
-#endif
-
-bool CPanel::OnNotify(UINT /* controlID */, LPNMHDR header, LRESULT &result)
-{
- if (!_processNotify)
- return false;
-#ifdef _WIN32
- if (header->hwndFrom == _headerComboBox)
- return OnNotifyComboBox(header, result);
- else if (header->hwndFrom == _headerReBar)
- return OnNotifyReBar(header, result);
- // if (header->hwndFrom == _listView)
-#endif
- else if (header->hwndFrom == _listView)
- return OnNotifyList(header, result);
-#ifdef _WIN32
- else if (::GetParent(header->hwndFrom) == _listView &&
- header->code == NM_RCLICK)
- return OnRightClick((LPNMITEMACTIVATE)header, result);
-#endif
- return false;
-}
-
-bool CPanel::OnCommand(int code, int itemID, LPARAM lParam, LRESULT &result)
-{
- printf("CPanel::OnCommand(code=%d,itemID=%d)\n",code,itemID);
- if (itemID == kParentFolderID)
- {
- OpenParentFolder();
- result = 0;
- return true;
- }
- /*
- if (itemID == kCreateFolderID)
- {
- CreateFolder();
- result = 0;
- return true;
- }
- */
- if (itemID == _comboBoxID)
- {
- // FIXME if (OnComboBoxCommand(code, lParam, result))
- return true;
- }
- return CWindow2::OnCommand(code, itemID, lParam, result);
-}
-
-void CPanel::MessageBoxInfo(LPCWSTR message, LPCWSTR caption)
- { ::MessageBoxW(HWND(*this), message, caption, MB_OK); }
-void CPanel::MessageBox(LPCWSTR message, LPCWSTR caption)
- { ::MessageBoxW(HWND(*this), message, caption, MB_OK | MB_ICONSTOP); }
-void CPanel::MessageBox(LPCWSTR message)
- { MessageBox(message, L"7-Zip"); }
-void CPanel::MessageBoxMyError(LPCWSTR message)
- { MessageBox(message, L"Error"); }
-void CPanel::MessageBoxError(HRESULT errorCode, LPCWSTR caption)
-{
- UString message;
- if (errorCode == E_OUTOFMEMORY)
- message = LangString(IDS_MEM_ERROR, 0x0200060B);
- else
- if (!NError::MyFormatMessage(errorCode, message))
- message = L"Error";
- MessageBox(message, caption);
-}
-
-void CPanel::MessageBoxError(HRESULT errorCode)
- { MessageBoxError(errorCode, L"7-Zip"); }
-void CPanel::MessageBoxLastError(LPCWSTR caption)
- { MessageBoxError(::GetLastError(), caption); }
-void CPanel::MessageBoxLastError()
- { MessageBoxLastError(L"Error"); }
-
-void CPanel::MessageBoxErrorLang(UINT resourceID, UInt32 langID)
- { MessageBox(LangString(resourceID, langID)); }
-
-
-void CPanel::SetFocusToList()
-{
- _listView.SetFocus();
- // SetCurrentPathText();
-}
-
-void CPanel::SetFocusToLastRememberedItem()
-{
- if (_lastFocusedIsList)
- SetFocusToList();
-#ifdef _WIN32 // FIXME
- else
- _headerComboBox.SetFocus();
-#endif
-}
-
-UString CPanel::GetFolderTypeID() const
-{
- NCOM::CPropVariant prop;
- if (_folder->GetFolderProperty(kpidType, &prop) == S_OK)
- if (prop.vt == VT_BSTR)
- return (const wchar_t *)prop.bstrVal;
- return L"";
-}
-
-bool CPanel::IsRootFolder() const
-{
- return (GetFolderTypeID() == L"RootFolder");
-}
-
-bool CPanel::IsFSFolder() const
-{
- return (GetFolderTypeID() == L"FSFolder");
-}
-
-bool CPanel::IsFSDrivesFolder() const
-{
- return (GetFolderTypeID() == L"FSDrives");
-}
-
-UString CPanel::GetFsPath() const
-{
- if (IsFSDrivesFolder())
- return UString();
- return _currentFolderPrefix;
-}
-
-UString CPanel::GetDriveOrNetworkPrefix() const
-{
- if (!IsFSFolder())
- return UString();
- UString drive = GetFsPath();
- if (drive.Length() < 3)
- return UString();
- if (drive[0] == L'\\' && drive[1] == L'\\')
- {
- // if network
- int pos = drive.Find(L'\\', 2);
- if (pos < 0)
- return UString();
- pos = drive.Find(L'\\', pos + 1);
- if (pos < 0)
- return UString();
- return drive.Left(pos + 1);
- }
- if (drive[1] != L':' || drive[2] != L'\\')
- return UString();
- return drive.Left(3);
-}
-
-bool CPanel::DoesItSupportOperations() const
-{
- CMyComPtr<IFolderOperations> folderOperations;
- return _folder.QueryInterface(IID_IFolderOperations, &folderOperations) == S_OK;
-}
-
-void CPanel::SetListViewMode(UInt32 index)
-{
-#ifdef _WIN32 // FIXME
- if (index >= 4)
- return;
- _ListViewMode = index;
- DWORD oldStyle = (DWORD)_listView.GetStyle();
- DWORD newStyle = kStyles[index];
- if ((oldStyle & LVS_TYPEMASK) != newStyle)
- _listView.SetStyle((oldStyle & ~LVS_TYPEMASK) | newStyle);
- // RefreshListCtrlSaveFocused();
-#endif
-}
-
-void CPanel::ChangeFlatMode()
-{
- _flatMode = !_flatMode;
- RefreshListCtrlSaveFocused();
-}
-
-
-void CPanel::RefreshStatusBar()
-{
- // FIXME PostMessage(kRefreshStatusBar);
-}
-
-void CPanel::AddToArchive()
-{
- CRecordVector<UInt32> indices;
- GetOperatedItemIndices(indices);
- if (!IsFSFolder())
- {
- MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- return;
- }
- if (indices.Size() == 0)
- {
- MessageBoxErrorLang(IDS_SELECT_FILES, 0x03020A03);
- return;
- }
- UStringVector names;
- for (int i = 0; i < indices.Size(); i++)
- {
- int index = indices[i];
- names.Add(_currentFolderPrefix + GetItemRelPath(index));
- }
- const UString archiveName = CreateArchiveName(
- names.Front(), (names.Size() > 1), false);
- HRESULT res = CompressFiles(_currentFolderPrefix, archiveName, L"", names, false, true, false);
- if (res != S_OK)
- {
- if (_currentFolderPrefix.Length() >= MAX_PATH)
- MessageBoxErrorLang(IDS_MESSAGE_UNSUPPORTED_OPERATION_FOR_LONG_PATH_FOLDER, 0x03020A01);
- else
- MessageBoxError(res);
- }
- // KillSelection();
-}
-
-static UString GetSubFolderNameForExtract(const UString &archiveName)
-{
- int slashPos = archiveName.ReverseFind(WCHAR_PATH_SEPARATOR);
- int dotPos = archiveName.ReverseFind(L'.');
- if (dotPos < 0 || slashPos > dotPos)
- return archiveName + UString(L"~");
- UString res = archiveName.Left(dotPos);
- res.TrimRight();
- return res;
-}
-
-void CPanel::GetFilePaths(const CRecordVector<UInt32> &indices, UStringVector &paths)
-{
- for (int i = 0; i < indices.Size(); i++)
- {
- int index = indices[i];
- if (IsItemFolder(index))
- {
- paths.Clear();
- break;
- }
- paths.Add(_currentFolderPrefix + GetItemRelPath(index));
- }
- if (paths.Size() == 0)
- {
- MessageBoxErrorLang(IDS_SELECT_FILES, 0x03020A03);
- return;
- }
-}
-
-void CPanel::ExtractArchives()
-{
- if (_parentFolders.Size() > 0)
- {
- _panelCallback->OnCopy(false, false);
- return;
- }
- CRecordVector<UInt32> indices;
- GetOperatedItemIndices(indices);
- UStringVector paths;
- GetFilePaths(indices, paths);
- if (paths.IsEmpty())
- return;
- UString folderName;
- if (indices.Size() == 1)
- folderName = GetSubFolderNameForExtract(GetItemRelPath(indices[0]));
- else
- folderName = L"*";
- ::ExtractArchives(paths, _currentFolderPrefix + folderName + UString(WSTRING_PATH_SEPARATOR), true);
-}
-
-struct CThreadTest
-{
- CRecordVector<UInt32> Indices;
- CExtractCallbackImp *ExtractCallbackSpec;
- CMyComPtr<IFolderArchiveExtractCallback> ExtractCallback;
- CMyComPtr<IArchiveFolder> ArchiveFolder;
- HRESULT Result;
-
- void Test()
- {
- ExtractCallbackSpec->ProgressDialog.WaitCreating();
- Result = ArchiveFolder->Extract(&Indices[0], Indices.Size(),
- NExtract::NPathMode::kFullPathnames, NExtract::NOverwriteMode::kAskBefore,
- NULL, BoolToInt(true), ExtractCallback);
- ExtractCallbackSpec->ProgressDialog.MyClose();
- }
-
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- ((CThreadTest*)param)->Test();
- return 0;
- }
-};
-
-static void AddValuePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
-{
- wchar_t sz[32];
- s += LangString(resourceID, langID);
- s += L" ";
- ConvertUInt64ToString(value, sz);
- s += sz;
- s += L"\n";
-}
-
-/*
-static void AddSizePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
-{
- wchar_t sz[32];
- s += LangString(resourceID, langID);
- s += L" ";
- ConvertUInt64ToString(value, sz);
- s += sz;
- ConvertUInt64ToString(value >> 20, sz);
- s += L" (";
- s += sz;
- s += L" MB)";
- s += L"\n";
-}
-*/
-
-void CPanel::TestArchives()
-{
- CRecordVector<UInt32> indices;
- GetOperatedIndicesSmart(indices);
- CMyComPtr<IArchiveFolder> archiveFolder;
- _folder.QueryInterface(IID_IArchiveFolder, &archiveFolder);
- if (archiveFolder)
- {
- {
- CThreadTest extracter;
-
- extracter.ArchiveFolder = archiveFolder;
- extracter.ExtractCallbackSpec = new CExtractCallbackImp;
- extracter.ExtractCallback = extracter.ExtractCallbackSpec;
- extracter.ExtractCallbackSpec->ParentWindow = GetParent();
- extracter.ExtractCallbackSpec->ShowMessages = true;
-
- if (indices.IsEmpty())
- return;
-
- extracter.Indices = indices;
-
- UString title = LangString(IDS_PROGRESS_TESTING, 0x02000F90);
- UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
-
- extracter.ExtractCallbackSpec->ProgressDialog.CompressingMode = false;
- extracter.ExtractCallbackSpec->ProgressDialog.MainWindow = GetParent();
- extracter.ExtractCallbackSpec->ProgressDialog.MainTitle = progressWindowTitle;
- extracter.ExtractCallbackSpec->ProgressDialog.MainAddTitle = title + L" ";
-
- extracter.ExtractCallbackSpec->OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
- extracter.ExtractCallbackSpec->Init();
-
- NWindows::CThread extractThread;
- if (extractThread.Create(CThreadTest::MyThreadFunction, &extracter) != S_OK)
- return;
- extracter.ExtractCallbackSpec->StartProgressDialog(title);
-
- if (extracter.ExtractCallbackSpec->Messages.IsEmpty() && extracter.Result == S_OK)
- {
- UString s;
- AddValuePair(IDS_FOLDERS_COLON, 0x02000321, extracter.ExtractCallbackSpec->NumFolders, s);
- AddValuePair(IDS_FILES_COLON, 0x02000320, extracter.ExtractCallbackSpec->NumFiles, s);
- // AddSizePair(IDS_SIZE_COLON, 0x02000322, extracter.Stat.UnpackSize, s);
- // AddSizePair(IDS_COMPRESSED_COLON, 0x02000323, extracter.Stat.PackSize, s);
- s += L"\n";
- s += LangString(IDS_MESSAGE_NO_ERRORS, 0x02000608);
- MessageBoxInfo(s, LangString(IDS_PROGRESS_TESTING, 0x02000F90));
- }
- else
- {
- if (extracter.Result != S_OK && extracter.Result != E_ABORT)
- MessageBoxError(extracter.Result, L"Testing Error");
- }
- }
- RefreshTitleAlways();
- return;
- }
-
- if (!IsFSFolder())
- {
- MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- return;
- }
- UStringVector paths;
- GetFilePaths(indices, paths);
- if (paths.IsEmpty())
- return;
- ::TestArchives(paths);
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/Panel.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/Panel.h
deleted file mode 100644
index dff858f87..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/Panel.h
+++ /dev/null
@@ -1,577 +0,0 @@
-// Panel.h
-
-#ifndef __PANEL_H
-#define __PANEL_H
-
-#include "Common/MyCom.h"
-
-#include "Windows/DLL.h"
-#include "Windows/FileFind.h"
-#include "Windows/FileDir.h"
-#include "Windows/Synchronization.h"
-// #include "Windows/Handle.h"
-
-// #include "Windows/Control/ToolBar.h"
-// #include "Windows/Control/ReBar.h"
-#include "Windows/Control/ListView.h"
-#include "Windows/Control/Static.h"
-#include "Windows/Control/Edit.h"
-#include "Windows/Control/ComboBox.h"
-#include "Windows/Control/Window2.h"
-#include "Windows/Control/StatusBar.h"
-
-#include "SysIconUtils.h"
-#include "IFolder.h"
-#include "ViewSettings.h"
-#include "AppState.h"
-// #include "MyCom2.h"
-
-const int kParentFolderID = 100;
-const int kPluginMenuStartID = 1000;
-const int kToolbarStartID = 2000;
-
-const int kParentIndex = -1;
-
-struct CPanelCallback
-{
- virtual void OnTab() = 0;
- virtual void SetFocusToPath(int index) = 0;
- virtual void OnCopy(bool move, bool copyToSame) = 0;
- virtual void OnSetSameFolder() = 0;
- virtual void OnSetSubFolder() = 0;
- virtual void PanelWasFocused() = 0;
- virtual void DragBegin() = 0;
- virtual void DragEnd() = 0;
- virtual void RefreshTitle(bool always) = 0;
-};
-
-void PanelCopyItems();
-
-struct CItemProperty
-{
- UString Name;
- PROPID ID;
- VARTYPE Type;
- int Order;
- bool IsVisible;
- UInt32 Width;
-};
-
-inline bool operator<(const CItemProperty &a1, const CItemProperty &a2)
- { return (a1.Order < a2.Order); }
-
-inline bool operator==(const CItemProperty &a1, const CItemProperty &a2)
- { return (a1.Order == a2.Order); }
-
-class CItemProperties: public CObjectVector<CItemProperty>
-{
-public:
- int FindItemWithID(PROPID id)
- {
- for (int i = 0; i < Size(); i++)
- if ((*this)[i].ID == id)
- return i;
- return -1;
- }
-};
-
-struct CTempFileInfo
-{
- UString ItemName;
- UString FolderPath;
- UString FilePath;
- NWindows::NFile::NFind::CFileInfoW FileInfo;
- bool NeedDelete;
-
- CTempFileInfo(): NeedDelete(false) {}
- void DeleteDirAndFile() const
- {
- if (NeedDelete)
- {
- NWindows::NFile::NDirectory::DeleteFileAlways(FilePath);
- NWindows::NFile::NDirectory::MyRemoveDirectory(FolderPath);
- }
- }
- bool WasChanged(const NWindows::NFile::NFind::CFileInfoW &newFileInfo) const
- {
- return newFileInfo.Size != FileInfo.Size ||
- CompareFileTime(&newFileInfo.MTime, &FileInfo.MTime) != 0;
- }
-};
-
-struct CFolderLink: public CTempFileInfo
-{
- NWindows::NDLL::CLibrary Library;
- CMyComPtr<IFolderFolder> ParentFolder;
- bool UsePassword;
- UString Password;
- bool IsVirtual;
-
- UString VirtualPath;
- CFolderLink(): UsePassword(false), IsVirtual(false) {}
-
- bool WasChanged(const NWindows::NFile::NFind::CFileInfoW &newFileInfo) const
- {
- return IsVirtual || CTempFileInfo::WasChanged(newFileInfo);
- }
-
-};
-
-enum MyMessages
-{
- kShiftSelectMessage = 20000, // FIXME = WM_USER + 1,
- kReLoadMessage,
- kSetFocusToListView,
- kOpenItemChanged,
- kRefreshStatusBar
-};
-
-UString GetFolderPath(IFolderFolder * folder);
-
-class CPanel;
-
-class CMyListView: public NWindows::NControl::CListView
-{
-public:
- WNDPROC _origWindowProc;
- CPanel *_panel;
- LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
-};
-
-/*
-class CMyComboBox: public NWindows::NControl::CComboBoxEx
-{
-public:
- WNDPROC _origWindowProc;
- CPanel *_panel;
- LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
-};
-*/
-class CMyComboBoxEdit: public NWindows::NControl::CEdit
-{
-public:
- WNDPROC _origWindowProc;
- CPanel *_panel;
- LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
-};
-
-struct CSelectedState
-{
- int FocusedItem;
- UString FocusedName;
- bool SelectFocused;
- UStringVector SelectedNames;
- CSelectedState(): FocusedItem(-1), SelectFocused(false) {}
-};
-
-class CPanel :public NWindows::NControl::CWindow2
-{
- // FIXME CExtToIconMap _extToIconMap;
- UINT _baseID;
- int _comboBoxID;
- UINT _statusBarID;
-
- CAppState *_appState;
-
- bool OnCommand(int code, int itemID, LPARAM lParam, LRESULT &result);
- LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
- virtual bool OnCreate(CREATESTRUCT *createStruct);
- // FIXME virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
- virtual void OnDestroy();
- virtual bool OnNotify(UINT controlID, LPNMHDR lParam, LRESULT &result);
- void OnComboBoxCommand(UINT code, LPARAM &aParam);
- // FIXME bool OnNotifyComboBoxEndEdit(PNMCBEENDEDITW info, LRESULT &result);
- #ifndef _UNICODE
- bool OnNotifyComboBoxEndEdit(PNMCBEENDEDIT info, LRESULT &result);
- #endif
- // FIXME bool OnNotifyReBar(LPNMHDR lParam, LRESULT &result);
- // FIXME bool OnNotifyComboBox(LPNMHDR lParam, LRESULT &result);
- void OnItemChanged(NMLISTVIEW *item);
- bool OnNotifyList(LPNMHDR lParam, LRESULT &result);
- // FIXME void OnDrag(LPNMLISTVIEW nmListView);
- // FIXME bool OnKeyDown(LPNMLVKEYDOWN keyDownInfo, LRESULT &result);
- // FIXME BOOL OnBeginLabelEdit(LV_DISPINFOW * lpnmh);
- // FIXME BOOL OnEndLabelEdit(LV_DISPINFOW * lpnmh);
- void OnColumnClick(LPNMLISTVIEW info);
- // FIXME bool OnCustomDraw(LPNMLVCUSTOMDRAW lplvcd, LRESULT &result);
-
-public:
- HWND _mainWindow;
- CPanelCallback *_panelCallback;
-
-/* FIXME BEGIN */
- HWND GetParent() { return 0; }
- operator HWND() const { return 0; }
-/* FIXME END */
-
- void DeleteItems(bool toRecycleBin);
- void DeleteItemsInternal(CRecordVector<UInt32> &indices);
- void CreateFolder();
- void CreateFile();
-
-private:
-
- void ChangeWindowSize(int xSize, int ySize);
-
- void InitColumns();
- // void InitColumns2(PROPID sortID);
- void InsertColumn(int index);
-
- void SetFocusedSelectedItem(int index, bool select);
- void RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused,
- const UStringVector &selectedNames);
-
- void OnShiftSelectMessage();
- void OnArrowWithShift();
-
- void OnInsert();
- // void OnUpWithShift();
- // void OnDownWithShift();
-public:
- void myTests();
- void UpdateSelection();
- void SelectSpec(bool selectMode);
- void SelectByType(bool selectMode);
- void SelectAll(bool selectMode);
- void InvertSelection();
-private:
-
- // UString GetFileType(UInt32 index);
- LRESULT SetItemText(LVITEMW &item);
-
- // CRecordVector<PROPID> m_ColumnsPropIDs;
-
-public:
- // FIXME NWindows::NControl::CReBar _headerReBar;
- // FIXME NWindows::NControl::CToolBar _headerToolBar;
- NWindows::NControl::CComboBoxEx _headerComboBox;
- // CMyComboBox _headerComboBox;
- CMyComboBoxEdit _comboBoxEdit;
- CMyListView _listView;
- NWindows::NControl::CStatusBar _statusBar;
- bool _lastFocusedIsList;
- // NWindows::NControl::CStatusBar _statusBar2;
-
- DWORD _exStyle;
- bool _showDots;
- bool _showRealFileIcons;
- // bool _virtualMode;
- // CUIntVector _realIndices;
- bool _enableItemChangeNotify;
- bool _mySelectMode;
- CBoolVector _selectedStatusVector;
-
- CSelectedState _selectedState;
-
- UInt32 GetRealIndex(const LVITEMW &item) const
- {
- /*
- if (_virtualMode)
- return _realIndices[item.iItem];
- */
- return (UInt32)item.lParam;
- }
- int GetRealItemIndex(int indexInListView) const
- {
- /*
- if (_virtualMode)
- return indexInListView;
- */
- LPARAM param;
- if (!_listView.GetItemParam(indexInListView, param))
- throw 1;
- return (int)param;
- }
-
- UInt32 _ListViewMode;
- int _xSize;
-
- bool _flatMode;
- bool _flatModeForDisk;
- bool _flatModeForArc;
-
- bool _dontShowMode;
-
-
- UString _currentFolderPrefix;
-
- CObjectVector<CFolderLink> _parentFolders;
- NWindows::NDLL::CLibrary _library;
- CMyComPtr<IFolderFolder> _folder;
- // CMyComPtr<IFolderGetSystemIconIndex> _folderGetSystemIconIndex;
-
- UStringVector _fastFolders;
-
- void GetSelectedNames(UStringVector &selectedNames);
- void SaveSelectedState(CSelectedState &s);
- void RefreshListCtrl(const CSelectedState &s);
- void RefreshListCtrlSaveFocused();
-
- UString GetItemName(int itemIndex) const;
- UString GetItemPrefix(int itemIndex) const;
- UString GetItemRelPath(int itemIndex) const;
- bool IsItemFolder(int itemIndex) const;
- UInt64 GetItemSize(int itemIndex) const;
-
- ////////////////////////
- // PanelFolderChange.cpp
-
- void SetToRootFolder();
- HRESULT BindToPath(const UString &fullPath, bool &archiveIsOpened, bool &encrypted); // can be prefix
- HRESULT BindToPathAndRefresh(const UString &path);
- void OpenDrivesFolder();
-
- void SetBookmark(int index);
- void OpenBookmark(int index);
-
- void LoadFullPath();
- void LoadFullPathAndShow();
- void FoldersHistory();
- void OpenParentFolder();
- void CloseOpenFolders();
- void OpenRootFolder();
-
-
- HRESULT Create(HWND mainWindow, HWND parentWindow,
- UINT id,
- const UString &currentFolderPrefix,
- CPanelCallback *panelCallback,
- CAppState *appState, bool &archiveIsOpened, bool &encrypted);
- void SetFocusToList();
- void SetFocusToLastRememberedItem();
-
-
- void ReadListViewInfo();
- void SaveListViewInfo();
-
- CPanel() :
- // _virtualMode(flase),
- _exStyle(0),
- _showDots(false),
- _showRealFileIcons(false),
- _needSaveInfo(false),
- _startGroupSelect(0),
- _selectionIsDefined(false),
- _ListViewMode(3),
- _flatMode(false),
- _flatModeForDisk(false),
- _flatModeForArc(false),
- _xSize(300),
- _mySelectMode(false),
- _enableItemChangeNotify(true),
- _dontShowMode(false)
- {}
-
-
- void SetExtendedStyle()
- {
-/* FIXME
- if (_listView != 0)
- _listView.SetExtendedListViewStyle(_exStyle);
- */
- }
-
-
- bool _needSaveInfo;
- UString _typeIDString;
- CListViewInfo _listViewInfo;
- CItemProperties _properties;
- CItemProperties _visibleProperties;
-
- PROPID _sortID;
- // int _sortIndex;
- bool _ascending;
-
- void Release();
- ~CPanel();
- // FIXME void OnLeftClick(LPNMITEMACTIVATE itemActivate);
- // FIXME bool OnRightClick(LPNMITEMACTIVATE itemActivate, LRESULT &result);
-
- void OnTimer();
- void OnReload();
- bool OnContextMenu(HANDLE windowHandle, int xPos, int yPos);
-
-#ifdef _WIN32
- CMyComPtr<IContextMenu> _sevenZipContextMenu;
- CMyComPtr<IContextMenu> _systemContextMenu;
- HRESULT CreateShellContextMenu(
- const CRecordVector<UInt32> &operatedIndices,
- CMyComPtr<IContextMenu> &systemContextMenu);
- void CreateSystemMenu(HMENU menu,
- const CRecordVector<UInt32> &operatedIndices,
- CMyComPtr<IContextMenu> &systemContextMenu);
- void CreateSevenZipMenu(HMENU menu,
- const CRecordVector<UInt32> &operatedIndices,
- CMyComPtr<IContextMenu> &sevenZipContextMenu);
- void CreateFileMenu(HMENU menu,
- CMyComPtr<IContextMenu> &sevenZipContextMenu,
- CMyComPtr<IContextMenu> &systemContextMenu,
- bool programMenu);
- void CreateFileMenu(HMENU menu);
- bool InvokePluginCommand(int id);
- bool InvokePluginCommand(int id, IContextMenu *sevenZipContextMenu,
- IContextMenu *systemContextMenu);
-#endif // ifdef _WIN32
-
- void InvokeSystemCommand(const char *command);
- void Properties();
- void EditCut();
- void EditCopy();
- void EditPaste();
-
- int _startGroupSelect;
-
- bool _selectionIsDefined;
- bool _selectMark;
- int _prevFocusedItem;
-
-
- // void SortItems(int index);
- void SortItemsWithPropID(PROPID propID);
-
- void GetSelectedItemsIndices(CRecordVector<UInt32> &indices) const;
- void GetOperatedItemIndices(CRecordVector<UInt32> &indices) const;
- void GetAllItemIndices(CRecordVector<UInt32> &indices) const;
- void GetOperatedIndicesSmart(CRecordVector<UInt32> &indices) const;
- // void GetOperatedListViewIndices(CRecordVector<UInt32> &indices) const;
- void KillSelection();
-
- UString GetFolderTypeID() const;
- bool IsRootFolder() const;
- bool IsFSFolder() const;
- bool IsFSDrivesFolder() const;
-
- UString GetFsPath() const;
- UString GetDriveOrNetworkPrefix() const;
-
- bool DoesItSupportOperations() const;
-
- bool _processTimer;
- bool _processNotify;
-
- class CDisableTimerProcessing
- {
- bool _processTimerMem;
- bool _processNotifyMem;
-
- CPanel &_panel;
- public:
-
- CDisableTimerProcessing(CPanel &panel): _panel(panel)
- {
- Disable();
- }
- void Disable()
- {
- _processTimerMem = _panel._processTimer;
- _processNotifyMem = _panel._processNotify;
- _panel._processTimer = false;
- _panel._processNotify = false;
- }
- void Restore()
- {
- _panel._processTimer = _processTimerMem;
- _panel._processNotify = _processNotifyMem;
- }
- ~CDisableTimerProcessing()
- {
- Restore();
- }
- CDisableTimerProcessing& operator=(const CDisableTimerProcessing &) {; }
- };
-
- // bool _passwordIsDefined;
- // UString _password;
-
- void RefreshListCtrl();
-
- void MessageBoxInfo(LPCWSTR message, LPCWSTR caption);
- void MessageBox(LPCWSTR message);
- void MessageBox(LPCWSTR message, LPCWSTR caption);
- void MessageBoxMyError(LPCWSTR message);
- void MessageBoxError(HRESULT errorCode, LPCWSTR caption);
- void MessageBoxError(HRESULT errorCode);
- void MessageBoxLastError(LPCWSTR caption);
- void MessageBoxLastError();
-
- void MessageBoxErrorLang(UINT resourceID, UInt32 langID);
-
- void OpenFocusedItemAsInternal();
- void OpenSelectedItems(bool internal);
-
- void OpenFolderExternal(int index);
-
- void OpenFolder(int index);
- HRESULT OpenParentArchiveFolder();
- HRESULT OpenItemAsArchive(IInStream *inStream,
- const CTempFileInfo &tempFileInfo,
- const UString &virtualFilePath,
- bool &encrypted);
- HRESULT OpenItemAsArchive(const UString &name, bool &encrypted);
- HRESULT OpenItemAsArchive(int index);
- void OpenItemInArchive(int index, bool tryInternal, bool tryExternal,
- bool editMode);
- HRESULT OnOpenItemChanged(const UString &folderPath, const UString &itemName, bool usePassword, const UString &password);
- LRESULT OnOpenItemChanged(LPARAM lParam);
-
- void OpenItem(int index, bool tryInternal, bool tryExternal);
- void EditItem();
- void EditItem(int index);
-
- void RenameFile();
- void ChangeComment();
-
- void SetListViewMode(UInt32 index);
- UInt32 GetListViewMode() const { return _ListViewMode; };
-
- void ChangeFlatMode();
- bool GetFlatMode() const { return _flatMode; };
-
- void RefreshStatusBar();
- void OnRefreshStatusBar();
-
- void AddToArchive();
-
- void GetFilePaths(const CRecordVector<UInt32> &indices, UStringVector &paths);
- void ExtractArchives();
- void TestArchives();
-
- HRESULT CopyTo(const CRecordVector<UInt32> &indices, const UString &folder,
- bool moveMode, bool showErrorMessages, UStringVector *messages,
- bool &usePassword, UString &password);
-
- HRESULT CopyTo(const CRecordVector<UInt32> &indices, const UString &folder,
- bool moveMode, bool showErrorMessages, UStringVector *messages)
- {
- bool usePassword = false;
- UString password;
- if (_parentFolders.Size() > 0)
- {
- const CFolderLink &fl = _parentFolders.Back();
- usePassword = fl.UsePassword;
- password = fl.Password;
- }
- return CopyTo(indices, folder, moveMode, showErrorMessages, messages, usePassword, password);
- }
-
- HRESULT CopyFrom(const UString &folderPrefix, const UStringVector &filePaths,
- bool showErrorMessages, UStringVector *messages);
-
- void CopyFromNoAsk(const UStringVector &filePaths);
- void CopyFromAsk(const UStringVector &filePaths);
-
- // empty folderPath means create new Archive to path of first fileName.
- #ifdef _WIN32
- void DropObject(IDataObject * dataObject, const UString &folderPath);
-
- // empty folderPath means create new Archive to path of first fileName.
- void CompressDropFiles(const UStringVector &fileNames, const UString &folderPath);
-#endif
-
- void RefreshTitle(bool always = false) { _panelCallback->RefreshTitle(always); }
- void RefreshTitleAlways() { RefreshTitle(true); }
-
- UString GetItemsInfoString(const CRecordVector<UInt32> &indices);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelCopy.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelCopy.cpp
deleted file mode 100644
index 8ad3d4c91..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelCopy.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-// PanelExtract.cpp
-
-#include "StdAfx.h"
-
-#include "Panel.h"
-#include "resource.h"
-#include "LangUtils.h"
-#include "ExtractCallback.h"
-#include "Windows/Thread.h"
-////////////////////////////////////////////////////////////////
-
-#include "UpdateCallback100.h"
-
-using namespace NWindows;
-
-struct CThreadExtractInArchive2
-{
- CMyComPtr<IFolderOperations> FolderOperations;
- CRecordVector<UInt32> Indices;
- UString DestPath;
- CExtractCallbackImp *ExtractCallbackSpec;
- CMyComPtr<IFolderOperationsExtractCallback> ExtractCallback;
- HRESULT Result;
- bool MoveMode;
-
- CThreadExtractInArchive2(): MoveMode(false) {}
-
- DWORD Extract()
- {
- ExtractCallbackSpec->ProgressDialog.WaitCreating();
- if (MoveMode)
- Result = FolderOperations->MoveTo(&Indices.Front(), Indices.Size(),
- DestPath, ExtractCallback);
- else
- Result = FolderOperations->CopyTo(&Indices.Front(), Indices.Size(),
- DestPath, ExtractCallback);
- ExtractCallbackSpec->ProgressDialog.MyClose();
- return 0;
- }
-
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- return ((CThreadExtractInArchive2 *)param)->Extract();
- }
-};
-
-HRESULT CPanel::CopyTo(const CRecordVector<UInt32> &indices, const UString &folder,
- bool moveMode, bool showErrorMessages, UStringVector *messages,
- bool &usePassword, UString &password)
-{
- CMyComPtr<IFolderOperations> folderOperations;
- if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
- {
- UString errorMessage = LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- if (showErrorMessages)
- MessageBox(errorMessage);
- else if (messages != 0)
- messages->Add(errorMessage);
- return E_FAIL;
- }
-
- HRESULT res;
- {
- CThreadExtractInArchive2 extracter;
-
- extracter.ExtractCallbackSpec = new CExtractCallbackImp;
- extracter.ExtractCallback = extracter.ExtractCallbackSpec;
- extracter.ExtractCallbackSpec->ParentWindow = GetParent();
- extracter.ExtractCallbackSpec->ShowMessages = showErrorMessages;
- extracter.ExtractCallbackSpec->ProgressDialog.CompressingMode = false;
-
- UString title = moveMode ?
- LangString(IDS_MOVING, 0x03020206):
- LangString(IDS_COPYING, 0x03020205);
- UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
-
- extracter.ExtractCallbackSpec->ProgressDialog.MainWindow = GetParent();
- extracter.ExtractCallbackSpec->ProgressDialog.MainTitle = progressWindowTitle;
- extracter.ExtractCallbackSpec->ProgressDialog.MainAddTitle = title + L" ";
-
- extracter.ExtractCallbackSpec->OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
- extracter.ExtractCallbackSpec->Init();
- extracter.Indices = indices;
- extracter.DestPath = folder;
- extracter.FolderOperations = folderOperations;
- extracter.MoveMode = moveMode;
-
- extracter.ExtractCallbackSpec->PasswordIsDefined = usePassword;
- extracter.ExtractCallbackSpec->Password = password;
-
- NWindows::CThread extractThread;
- RINOK(extractThread.Create(CThreadExtractInArchive2::MyThreadFunction, &extracter));
- extracter.ExtractCallbackSpec->StartProgressDialog(title);
-
- if (messages != 0)
- *messages = extracter.ExtractCallbackSpec->Messages;
- res = extracter.Result;
-
- if (res == S_OK && extracter.ExtractCallbackSpec->Messages.IsEmpty())
- {
- usePassword = extracter.ExtractCallbackSpec->PasswordIsDefined;
- password = extracter.ExtractCallbackSpec->Password;
- }
- }
- RefreshTitleAlways();
- return res;
-}
-
-
-struct CThreadUpdate
-{
- CMyComPtr<IFolderOperations> FolderOperations;
- UString FolderPrefix;
- UStringVector FileNames;
- CRecordVector<const wchar_t *> FileNamePointers;
- CMyComPtr<IFolderArchiveUpdateCallback> UpdateCallback;
- CUpdateCallback100Imp *UpdateCallbackSpec;
- HRESULT Result;
-
- DWORD Process()
- {
- UpdateCallbackSpec->ProgressDialog.WaitCreating();
- Result = FolderOperations->CopyFrom(
- FolderPrefix,
- &FileNamePointers.Front(),
- FileNamePointers.Size(),
- UpdateCallback);
- UpdateCallbackSpec->ProgressDialog.MyClose();
- return 0;
- }
-
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- return ((CThreadUpdate *)param)->Process();
- }
-};
-
-
-HRESULT CPanel::CopyFrom(const UString &folderPrefix, const UStringVector &filePaths,
- bool showErrorMessages, UStringVector *messages)
-{
- CMyComPtr<IFolderOperations> folderOperations;
- if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
- {
- UString errorMessage = LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- if (showErrorMessages)
- MessageBox(errorMessage);
- else if (messages != 0)
- messages->Add(errorMessage);
- return E_FAIL;
- }
-
- HRESULT res;
- {
- CThreadUpdate updater;
- updater.UpdateCallbackSpec = new CUpdateCallback100Imp;
- updater.UpdateCallback = updater.UpdateCallbackSpec;
-
- UString title = LangString(IDS_COPYING, 0x03020205);
- UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
-
- updater.UpdateCallbackSpec->ProgressDialog.MainWindow = GetParent();
- updater.UpdateCallbackSpec->ProgressDialog.MainTitle = progressWindowTitle;
- updater.UpdateCallbackSpec->ProgressDialog.MainAddTitle = title + UString(L" ");
-
- updater.UpdateCallbackSpec->Init((HWND)*this, false, L"");
- updater.FolderOperations = folderOperations;
- updater.FolderPrefix = folderPrefix;
- updater.FileNames.Reserve(filePaths.Size());
- int i;
- for(i = 0; i < filePaths.Size(); i++)
- updater.FileNames.Add(filePaths[i]);
- updater.FileNamePointers.Reserve(updater.FileNames.Size());
- for(i = 0; i < updater.FileNames.Size(); i++)
- updater.FileNamePointers.Add(updater.FileNames[i]);
-
- NWindows::CThread thread;
- RINOK(thread.Create(CThreadUpdate::MyThreadFunction, &updater));
- updater.UpdateCallbackSpec->StartProgressDialog(title);
-
- if (messages != 0)
- *messages = updater.UpdateCallbackSpec->Messages;
-
- res = updater.Result;
- }
- RefreshTitleAlways();
- return res;
-}
-
-void CPanel::CopyFromNoAsk(const UStringVector &filePaths)
-{
- CDisableTimerProcessing disableTimerProcessing(*this);
-
- CSelectedState srcSelState;
- SaveSelectedState(srcSelState);
-
- HRESULT result = CopyFrom(L"", filePaths, true, 0);
-
- if (result != S_OK)
- {
- disableTimerProcessing.Restore();
- // For Password:
- SetFocusToList();
- if (result != E_ABORT)
- MessageBoxError(result);
- return;
- }
-
- RefreshListCtrl(srcSelState);
-
- disableTimerProcessing.Restore();
- SetFocusToList();
-}
-
-void CPanel::CopyFromAsk(const UStringVector &filePaths)
-{
- UString title = LangString(IDS_CONFIRM_FILE_COPY, 0x03020222);
- UString message = LangString(IDS_WANT_TO_COPY_FILES, 0x03020223);
- message += L"\n\'";
- message += _currentFolderPrefix;
- message += L"\' ?";
- int res = ::MessageBoxW(*(this), message, title, MB_YESNOCANCEL | MB_ICONQUESTION | MB_SYSTEMMODAL);
- if (res != IDYES)
- return;
-
- CopyFromNoAsk(filePaths);
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelCrc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelCrc.cpp
deleted file mode 100644
index 61490b578..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelCrc.cpp
+++ /dev/null
@@ -1,368 +0,0 @@
-// PanelSplitFile.cpp
-
-#include "StdAfx.h"
-
-#include "resource.h"
-
-extern "C"
-{
- #include "../../../../C/Alloc.h"
- #include "../../../../C/7zCrc.h"
-}
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/FileIO.h"
-#include "Windows/FileFind.h"
-#include "Windows/FileName.h"
-#include "Windows/Thread.h"
-#include "Windows/Error.h"
-
-#include "ProgressDialog2.h"
-#include "OverwriteDialogRes.h"
-
-#include "App.h"
-#include "FormatUtils.h"
-#include "LangUtils.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NName;
-
-static const UInt32 kBufSize = (1 << 15);
-
-struct CDirEnumerator
-{
- bool FlatMode;
- UString BasePrefix;
- UStringVector FileNames;
-
- CObjectVector<NFind::CEnumeratorW> Enumerators;
- UStringVector Prefixes;
- int Index;
- bool GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UString &fullPath, DWORD &errorCode);
- void Init();
-
- CDirEnumerator(): FlatMode(false) {};
-};
-
-void CDirEnumerator::Init()
-{
- Enumerators.Clear();
- Prefixes.Clear();
- Index = 0;
-}
-
-bool CDirEnumerator::GetNextFile(NFind::CFileInfoW &fileInfo, bool &filled, UString &resPath, DWORD &errorCode)
-{
- filled = false;
- for (;;)
- {
- if (Enumerators.IsEmpty())
- {
- if (Index >= FileNames.Size())
- return true;
- const UString &path = FileNames[Index];
- int pos = path.ReverseFind('\\');
- resPath.Empty();
- if (pos >= 0)
- resPath = path.Left(pos + 1);
- if (!NFind::FindFile(BasePrefix + path, fileInfo))
- {
- errorCode = ::GetLastError();
- resPath = path;
- return false;
- }
- Index++;
- break;
- }
- bool found;
- if (!Enumerators.Back().Next(fileInfo, found))
- {
- errorCode = ::GetLastError();
- resPath = Prefixes.Back();
- return false;
- }
- if (found)
- {
- resPath = Prefixes.Back();
- break;
- }
- Enumerators.DeleteBack();
- Prefixes.DeleteBack();
- }
- resPath += fileInfo.Name;
- if (!FlatMode && fileInfo.IsDir())
- {
- UString prefix = resPath + (UString)(wchar_t)kDirDelimiter;
- Enumerators.Add(NFind::CEnumeratorW(BasePrefix + prefix + (UString)(wchar_t)kAnyStringWildcard));
- Prefixes.Add(prefix);
- }
- filled = true;
- return true;
-}
-
-struct CThreadCrc
-{
- class CMyBuffer
- {
- void *_data;
- public:
- CMyBuffer(): _data(0) {}
- operator void *() { return _data; }
- bool Allocate(size_t size)
- {
- if (_data != 0)
- return false;
- _data = ::MidAlloc(size);
- return _data != 0;
- }
- ~CMyBuffer() { ::MidFree(_data); }
- };
-
- CProgressDialog *ProgressDialog;
-
- CDirEnumerator DirEnumerator;
-
- UInt64 NumFiles;
- UInt64 NumFolders;
- UInt64 DataSize;
- UInt32 DataCrcSum;
- UInt32 DataNameCrcSum;
-
- HRESULT Result;
- DWORD ErrorCode;
- UString ErrorPath;
- UString Error;
- bool ThereIsError;
-
- void Process2()
- {
- DataSize = NumFolders = NumFiles = DataCrcSum = DataNameCrcSum = 0;
- ProgressDialog->WaitCreating();
-
- CMyBuffer bufferObject;
- if (!bufferObject.Allocate(kBufSize))
- {
- Error = L"Can not allocate memory";
- ThereIsError = true;
- return;
- }
- Byte *buffer = (Byte *)(void *)bufferObject;
-
- UInt64 totalSize = 0;
-
- DirEnumerator.Init();
-
- UString scanningStr = LangString(IDS_SCANNING, 0x03020800);
- scanningStr += L" ";
-
- for (;;)
- {
- NFile::NFind::CFileInfoW fileInfo;
- bool filled;
- UString resPath;
- if (!DirEnumerator.GetNextFile(fileInfo, filled, resPath, ErrorCode))
- {
- ThereIsError = true;
- ErrorPath = resPath;
- return;
- }
- if (!filled)
- break;
- if (!fileInfo.IsDir())
- totalSize += fileInfo.Size;
- ProgressDialog->ProgressSynch.SetCurrentFileName(scanningStr + resPath);
- ProgressDialog->ProgressSynch.SetProgress(totalSize, 0);
- Result = ProgressDialog->ProgressSynch.SetPosAndCheckPaused(0);
- if (Result != S_OK)
- return;
- }
-
- ProgressDialog->ProgressSynch.SetProgress(totalSize, 0);
-
- DirEnumerator.Init();
-
- for (;;)
- {
- NFile::NFind::CFileInfoW fileInfo;
- bool filled;
- UString resPath;
- if (!DirEnumerator.GetNextFile(fileInfo, filled, resPath, ErrorCode))
- {
- ThereIsError = true;
- ErrorPath = resPath;
- return;
- }
- if (!filled)
- break;
-
- UInt32 crc = CRC_INIT_VAL;
- if (fileInfo.IsDir())
- NumFolders++;
- else
- {
- NFile::NIO::CInFile inFile;
- if (!inFile.Open(DirEnumerator.BasePrefix + resPath))
- {
- ErrorCode = ::GetLastError();
- ThereIsError = true;
- ErrorPath = resPath;
- return;
- }
- NumFiles++;
- ProgressDialog->ProgressSynch.SetCurrentFileName(resPath);
- for (;;)
- {
- UInt32 processedSize;
- if (!inFile.Read(buffer, kBufSize, processedSize))
- {
- ErrorCode = ::GetLastError();
- ThereIsError = true;
- ErrorPath = resPath;
- return;
- }
- if (processedSize == 0)
- break;
- crc = CrcUpdate(crc, buffer, processedSize);
- DataSize += processedSize;
- Result = ProgressDialog->ProgressSynch.SetPosAndCheckPaused(DataSize);
- if (Result != S_OK)
- return;
- }
- DataCrcSum += CRC_GET_DIGEST(crc);
- }
- for (int i = 0; i < resPath.Length(); i++)
- {
- wchar_t c = resPath[i];
- crc = CRC_UPDATE_BYTE(crc, ((Byte)(c & 0xFF)));
- crc = CRC_UPDATE_BYTE(crc, ((Byte)((c >> 8) & 0xFF)));
- }
- DataNameCrcSum += CRC_GET_DIGEST(crc);
- Result = ProgressDialog->ProgressSynch.SetPosAndCheckPaused(DataSize);
- if (Result != S_OK)
- return;
- }
- }
- DWORD Process()
- {
- try { Process2(); }
- catch(...) { Error = L"Error"; ThereIsError = true;}
- ProgressDialog->MyClose();
- return 0;
- }
-
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- return ((CThreadCrc *)param)->Process();
- }
-};
-
-static void ConvertUInt32ToHex(UInt32 value, wchar_t *s)
-{
- for (int i = 0; i < 8; i++)
- {
- int t = value & 0xF;
- value >>= 4;
- s[7 - i] = (wchar_t)((t < 10) ? (L'0' + t) : (L'A' + (t - 10)));
- }
- s[8] = L'\0';
-}
-
-void CApp::CalculateCrc()
-{
- int srcPanelIndex = GetFocusedPanelIndex();
- CPanel &srcPanel = Panels[srcPanelIndex];
- if (!srcPanel.IsFSFolder())
- {
- srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- return;
- }
- CRecordVector<UInt32> indices;
- srcPanel.GetOperatedItemIndices(indices);
- if (indices.IsEmpty())
- return;
-
- CThreadCrc combiner;
- for (int i = 0; i < indices.Size(); i++)
- combiner.DirEnumerator.FileNames.Add(srcPanel.GetItemRelPath(indices[i]));
- combiner.DirEnumerator.BasePrefix = srcPanel._currentFolderPrefix;
- combiner.DirEnumerator.FlatMode = GetFlatMode();
-
- {
- CProgressDialog progressDialog;
- combiner.ProgressDialog = &progressDialog;
- combiner.ErrorCode = 0;
- combiner.Result = S_OK;
- combiner.ThereIsError = false;
-
- UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
- UString title = LangString(IDS_CHECKSUM_CALCULATING, 0x03020710);
-
- progressDialog.MainWindow = _window;
- progressDialog.MainTitle = progressWindowTitle;
- progressDialog.MainAddTitle = title + UString(L" ");
-
- NWindows::CThread thread;
- if (thread.Create(CThreadCrc::MyThreadFunction, &combiner) != S_OK)
- return;
- progressDialog.Create(title, _window);
-
- if (combiner.Result != S_OK)
- {
- if (combiner.Result != E_ABORT)
- srcPanel.MessageBoxError(combiner.Result);
- }
- else if (combiner.ThereIsError)
- {
- if (combiner.Error.IsEmpty())
- {
- UString message = combiner.DirEnumerator.BasePrefix + combiner.ErrorPath;
- message += L"\n";
- message += NError::MyFormatMessageW(combiner.ErrorCode);
- srcPanel.MessageBoxMyError(message);
- }
- else
- srcPanel.MessageBoxMyError(combiner.Error);
- }
- else
- {
- UString s;
- {
- wchar_t sz[32];
-
- s += LangString(IDS_FILES_COLON, 0x02000320);
- s += L" ";
- ConvertUInt64ToString(combiner.NumFiles, sz);
- s += sz;
- s += L"\n";
-
- s += LangString(IDS_FOLDERS_COLON, 0x02000321);
- s += L" ";
- ConvertUInt64ToString(combiner.NumFolders, sz);
- s += sz;
- s += L"\n";
-
- s += LangString(IDS_SIZE_COLON, 0x02000322);
- s += L" ";
- ConvertUInt64ToString(combiner.DataSize, sz);
- s += MyFormatNew(IDS_FILE_SIZE, 0x02000982, sz);;
- s += L"\n";
-
- s += LangString(IDS_CHECKSUM_CRC_DATA, 0x03020721);
- s += L" ";
- ConvertUInt32ToHex(combiner.DataCrcSum, sz);
- s += sz;
- s += L"\n";
-
- s += LangString(IDS_CHECKSUM_CRC_DATA_NAMES, 0x03020722);
- s += L" ";
- ConvertUInt32ToHex(combiner.DataNameCrcSum, sz);
- s += sz;
- }
- srcPanel.MessageBoxInfo(s, LangString(IDS_CHECKSUM_INFORMATION, 0x03020720));
- }
- }
- RefreshTitleAlways();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelFolderChange.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
deleted file mode 100644
index 3364dc9c7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelFolderChange.cpp
+++ /dev/null
@@ -1,597 +0,0 @@
-// PanelFolderChange.cpp
-
-#include "StdAfx.h"
-
-#include "Common/StringConvert.h"
-#include "Common/Wildcard.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../../PropID.h"
-
-#ifdef _WIN32
-#include "FSDrives.h"
-#endif
-#include "LangUtils.h"
-#include "ListViewDialog.h"
-#include "Panel.h"
-#include "RootFolder.h"
-#include "ViewSettings.h"
-
-#include "resource.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NFind;
-
-void CPanel::SetToRootFolder()
-{
- _folder.Release();
- _library.Free();
- CRootFolder *rootFolderSpec = new CRootFolder;
- _folder = rootFolderSpec;
- rootFolderSpec->Init();
-}
-
-HRESULT CPanel::BindToPath(const UString &fullPath, bool &archiveIsOpened, bool &encrypted)
-{
- archiveIsOpened = false;
- encrypted = false;
- CDisableTimerProcessing disableTimerProcessing1(*this);
-
- printf("CPanel::BindToPath(%ls)\n",(const wchar_t *)fullPath);
-
- if (_parentFolders.Size() > 0)
- {
- const UString &virtPath = _parentFolders.Back().VirtualPath;
- if (fullPath.Left(virtPath.Length()) == virtPath)
- {
- for (;;)
- {
- CMyComPtr<IFolderFolder> newFolder;
- HRESULT res = _folder->BindToParentFolder(&newFolder);
- if (!newFolder || res != S_OK)
- break;
- _folder = newFolder;
- }
- UStringVector parts;
- SplitPathToParts(fullPath.Mid(virtPath.Length()), parts);
- for (int i = 0; i < parts.Size(); i++)
- {
- const UString &s = parts[i];
- if ((i == 0 || i == parts.Size() - 1) && s.IsEmpty())
- continue;
- CMyComPtr<IFolderFolder> newFolder;
- HRESULT res = _folder->BindToFolder(s, &newFolder);
- if (!newFolder || res != S_OK)
- break;
- _folder = newFolder;
- }
- return S_OK;
- }
- }
-
- CloseOpenFolders();
- UString sysPath = fullPath;
- CFileInfoW fileInfo;
- UStringVector reducedParts;
- while (!sysPath.IsEmpty())
- {
- if (fileInfo.Find(sysPath))
- break;
- int pos = sysPath.ReverseFind(WCHAR_PATH_SEPARATOR);
- if (pos < 0)
- sysPath.Empty();
- else
- {
- if (reducedParts.Size() > 0 || pos < sysPath.Length() - 1)
- reducedParts.Add(sysPath.Mid(pos + 1));
- sysPath = sysPath.Left(pos);
- }
- }
- SetToRootFolder();
- CMyComPtr<IFolderFolder> newFolder;
- if (sysPath.IsEmpty())
- {
- if (_folder->BindToFolder(fullPath, &newFolder) == S_OK)
- _folder = newFolder;
- }
- else if (fileInfo.IsDir())
- {
- NName::NormalizeDirPathPrefix(sysPath);
- if (_folder->BindToFolder(sysPath, &newFolder) == S_OK)
- _folder = newFolder;
- }
- else
- {
- UString dirPrefix;
- if (!NDirectory::GetOnlyDirPrefix(sysPath, dirPrefix))
- dirPrefix.Empty();
- if (_folder->BindToFolder(dirPrefix, &newFolder) == S_OK)
- {
- _folder = newFolder;
- LoadFullPath();
- UString fileName;
- if (NDirectory::GetOnlyName(sysPath, fileName))
- {
- HRESULT res = OpenItemAsArchive(fileName, encrypted);
- if (res != S_FALSE)
- {
- RINOK(res);
- }
- /*
- if (res == E_ABORT)
- return res;
- */
- if (res == S_OK)
- {
- archiveIsOpened = true;
- for (int i = reducedParts.Size() - 1; i >= 0; i--)
- {
- CMyComPtr<IFolderFolder> newFolder;
- _folder->BindToFolder(reducedParts[i], &newFolder);
- if (!newFolder)
- break;
- _folder = newFolder;
- }
- }
- }
- }
- }
- return S_OK;
-}
-
-HRESULT CPanel::BindToPathAndRefresh(const UString &path)
-{
- CDisableTimerProcessing disableTimerProcessing1(*this);
- bool archiveIsOpened, encrypted;
- RINOK(BindToPath(path, archiveIsOpened, encrypted));
- RefreshListCtrl(UString(), -1, true, UStringVector());
- return S_OK;
-}
-
-void CPanel::SetBookmark(int index)
-{
- _appState->FastFolders.SetString(index, _currentFolderPrefix);
-}
-
-void CPanel::OpenBookmark(int index)
-{
- BindToPathAndRefresh(_appState->FastFolders.GetString(index));
-}
-
-UString GetFolderPath(IFolderFolder *folder)
-{
- NCOM::CPropVariant prop;
- if (folder->GetFolderProperty(kpidPath, &prop) == S_OK)
- if (prop.vt == VT_BSTR)
- return (wchar_t *)prop.bstrVal;
- return UString();
-}
-
-void CPanel::LoadFullPath()
-{
- _currentFolderPrefix.Empty();
- for (int i = 0; i < _parentFolders.Size(); i++)
- {
- const CFolderLink &folderLink = _parentFolders[i];
- _currentFolderPrefix += GetFolderPath(folderLink.ParentFolder);
- _currentFolderPrefix += folderLink.ItemName;
- _currentFolderPrefix += WCHAR_PATH_SEPARATOR;
- }
- if (_folder)
- _currentFolderPrefix += GetFolderPath(_folder);
-}
-
-static int GetRealIconIndex(LPCWSTR path, DWORD attributes)
-{
- int index = -1;
- if (GetRealIconIndex(path, attributes, index) != 0)
- return index;
- return -1;
-}
-
-void CPanel::LoadFullPathAndShow()
-{
- LoadFullPath();
- _appState->FolderHistory.AddString(_currentFolderPrefix);
-
- _headerComboBox.SetText(_currentFolderPrefix);
-#ifdef _WIN32 // FIXME
- COMBOBOXEXITEM item;
- item.mask = 0;
-
- UString path = _currentFolderPrefix;
- if (path.Length() >
- #ifdef _WIN32
- 3
- #else
- 1
- #endif
- && path[path.Length() - 1] == WCHAR_PATH_SEPARATOR)
- path.Delete(path.Length() - 1);
-
- CFileInfoW info;
- DWORD attrib = FILE_ATTRIBUTE_DIRECTORY;
- if (info.Find(path))
- attrib = info.Attrib;
-
- item.iImage = GetRealIconIndex(path, attrib);
-
- if (item.iImage >= 0)
- {
- item.iSelectedImage = item.iImage;
- item.mask |= (CBEIF_IMAGE | CBEIF_SELECTEDIMAGE);
- }
- item.iItem = -1;
- _headerComboBox.SetItem(&item);
-#endif
-
- RefreshTitle();
-}
-
-#ifdef _WIN32
-LRESULT CPanel::OnNotifyComboBoxEnter(const UString &s)
-{
- if (BindToPathAndRefresh(GetUnicodeString(s)) == S_OK)
- {
- PostMessage(kSetFocusToListView);
- return TRUE;
- }
- return FALSE;
-}
-
-bool CPanel::OnNotifyComboBoxEndEdit(PNMCBEENDEDITW info, LRESULT &result)
-{
- if (info->iWhy == CBENF_ESCAPE)
- {
- _headerComboBox.SetText(_currentFolderPrefix);
- PostMessage(kSetFocusToListView);
- result = FALSE;
- return true;
- }
-
- /*
- if (info->iWhy == CBENF_DROPDOWN)
- {
- result = FALSE;
- return true;
- }
- */
-
- if (info->iWhy == CBENF_RETURN)
- {
- // When we use Edit control and press Enter.
- UString s;
- _headerComboBox.GetText(s);
- result = OnNotifyComboBoxEnter(s);
- return true;
- }
- return false;
-}
-
-#ifndef _UNICODE
-bool CPanel::OnNotifyComboBoxEndEdit(PNMCBEENDEDIT info, LRESULT &result)
-{
- if (info->iWhy == CBENF_ESCAPE)
- {
- _headerComboBox.SetText(_currentFolderPrefix);
- PostMessage(kSetFocusToListView);
- result = FALSE;
- return true;
- }
- /*
- if (info->iWhy == CBENF_DROPDOWN)
- {
- result = FALSE;
- return true;
- }
- */
-
- if (info->iWhy == CBENF_RETURN)
- {
- UString s;
- _headerComboBox.GetText(s);
- // GetUnicodeString(info->szText)
- result = OnNotifyComboBoxEnter(s);
- return true;
- }
- return false;
-}
-#endif
-
-void CPanel::AddComboBoxItem(const UString &name, int iconIndex, int indent, bool addToList)
-{
- COMBOBOXEXITEMW item;
- item.mask = CBEIF_TEXT | CBEIF_INDENT;
- item.iSelectedImage = item.iImage = iconIndex;
- if (iconIndex >= 0)
- item.mask |= (CBEIF_IMAGE | CBEIF_SELECTEDIMAGE);
- item.iItem = -1;
- item.iIndent = indent;
- item.pszText = (LPWSTR)(LPCWSTR)name;
- _headerComboBox.InsertItem(&item);
- if (addToList)
- ComboBoxPaths.Add(name);
-}
-
-extern UString RootFolder_GetName_Computer(int &iconIndex);
-extern UString RootFolder_GetName_Network(int &iconIndex);
-extern UString RootFolder_GetName_Documents(int &iconIndex);
-
-bool CPanel::OnComboBoxCommand(UINT code, LPARAM /* param */, LRESULT &result)
-{
- result = FALSE;
- switch(code)
- {
- case CBN_DROPDOWN:
- {
- ComboBoxPaths.Clear();
- _headerComboBox.ResetContent();
-
- int iconIndex;
- UString name;
-
- int i;
- UStringVector pathParts;
-
- SplitPathToParts(_currentFolderPrefix, pathParts);
- UString sumPass;
- for (i = 0; i < pathParts.Size(); i++)
- {
- UString name = pathParts[i];
- if (name.IsEmpty())
- continue;
- sumPass += name;
- UString curName = sumPass;
- if (i == 0)
- curName += WCHAR_PATH_SEPARATOR;
- CFileInfoW info;
- DWORD attrib = FILE_ATTRIBUTE_DIRECTORY;
- if (info.Find(sumPass))
- attrib = info.Attrib;
- sumPass += WCHAR_PATH_SEPARATOR;
- AddComboBoxItem(name, GetRealIconIndex(curName, attrib), i, false);
- ComboBoxPaths.Add(sumPass);
- }
-
- name = RootFolder_GetName_Documents(iconIndex);
- AddComboBoxItem(name, iconIndex, 0, true);
-
- name = RootFolder_GetName_Computer(iconIndex);
- AddComboBoxItem(name, iconIndex, 0, true);
-
- UStringVector driveStrings;
- MyGetLogicalDriveStrings(driveStrings);
- for (i = 0; i < driveStrings.Size(); i++)
- {
- UString s = driveStrings[i];
- ComboBoxPaths.Add(s);
- int iconIndex = GetRealIconIndex(s, 0);
- if (s.Length() > 0 && s[s.Length() - 1] == WCHAR_PATH_SEPARATOR)
- s.Delete(s.Length() - 1);
- AddComboBoxItem(s, iconIndex, 1, false);
- }
-
- name = RootFolder_GetName_Network(iconIndex);
- AddComboBoxItem(name, iconIndex, 0, true);
-
- // UStringVector strings; _appState->FolderHistory.GetList(strings);
-
- return false;
- }
-
- case CBN_SELENDOK:
- {
- code = code;
- int index = _headerComboBox.GetCurSel();
- if (index >= 0)
- {
- UString pass = ComboBoxPaths[index];
- _headerComboBox.SetCurSel(-1);
- _headerComboBox.SetText(pass); // it's fix for seclecting by mouse.
- if (BindToPathAndRefresh(pass) == S_OK)
- {
- PostMessage(kSetFocusToListView);
- return true;
- }
- }
- return false;
- }
- /*
- case CBN_CLOSEUP:
- {
- LoadFullPathAndShow();
- true;
-
- }
- case CBN_SELCHANGE:
- {
- // LoadFullPathAndShow();
- return true;
- }
- */
- }
- return false;
-}
-
-bool CPanel::OnNotifyComboBox(LPNMHDR header, LRESULT &result)
-{
- switch(header->code)
- {
- case CBEN_BEGINEDIT:
- {
- _lastFocusedIsList = false;
- _panelCallback->PanelWasFocused();
- break;
- }
- #ifndef _UNICODE
- case CBEN_ENDEDIT:
- {
- return OnNotifyComboBoxEndEdit((PNMCBEENDEDIT)header, result);
- }
- #endif
- case CBEN_ENDEDITW:
- {
- return OnNotifyComboBoxEndEdit((PNMCBEENDEDITW)header, result);
- }
- }
- return false;
-}
-#endif
-
-
-void CPanel::FoldersHistory()
-{
- CListViewDialog listViewDialog;
- listViewDialog.DeleteIsAllowed = true;
- listViewDialog.Title = LangString(IDS_FOLDERS_HISTORY, 0x03020260);
- _appState->FolderHistory.GetList(listViewDialog.Strings);
- if (listViewDialog.Create(GetParent()) == IDCANCEL)
- return;
- UString selectString;
- if (listViewDialog.StringsWereChanged)
- {
- _appState->FolderHistory.RemoveAll();
- for (int i = listViewDialog.Strings.Size() - 1; i >= 0; i--)
- _appState->FolderHistory.AddString(listViewDialog.Strings[i]);
- if (listViewDialog.FocusedItemIndex >= 0)
- selectString = listViewDialog.Strings[listViewDialog.FocusedItemIndex];
- }
- else
- {
- if (listViewDialog.FocusedItemIndex >= 0)
- selectString = listViewDialog.Strings[listViewDialog.FocusedItemIndex];
- }
- if (listViewDialog.FocusedItemIndex >= 0)
- BindToPathAndRefresh(selectString);
-}
-
-void CPanel::OpenParentFolder()
-{
-printf("CPanel::OpenParentFolder\n");
- LoadFullPath(); // Maybe we don't need it ??
- UString focucedName;
- if (!_currentFolderPrefix.IsEmpty())
- {
- UString string = _currentFolderPrefix;
- string.Delete(string.Length() - 1);
- int pos = string.ReverseFind(WCHAR_PATH_SEPARATOR);
- if (pos < 0)
- pos = 0;
- else
- pos++;
- focucedName = string.Mid(pos);
- }
-
- printf("CPanel::OpenParentFolder focucedName=%ls\n",(const wchar_t *)focucedName);
-
- CDisableTimerProcessing disableTimerProcessing1(*this);
- CMyComPtr<IFolderFolder> newFolder;
- _folder->BindToParentFolder(&newFolder);
- if (newFolder)
- _folder = newFolder;
- else
- {
- if (_parentFolders.IsEmpty())
- {
- SetToRootFolder();
- if (focucedName.IsEmpty())
- focucedName = GetItemName(0);
- }
- else
- {
- _folder.Release();
- _library.Free();
- CFolderLink &link = _parentFolders.Back();
- _folder = link.ParentFolder;
- _library.Attach(link.Library.Detach());
- focucedName = link.ItemName;
- if (_parentFolders.Size() > 1)
- OpenParentArchiveFolder();
- _parentFolders.DeleteBack();
- if (_parentFolders.IsEmpty())
- _flatMode = _flatModeForDisk;
- }
- }
-
- UStringVector selectedItems;
- /*
- if (!focucedName.IsEmpty())
- selectedItems.Add(focucedName);
- */
- LoadFullPath();
- // ::SetCurrentDirectory(::_currentFolderPrefix);
- RefreshListCtrl(focucedName, -1, true, selectedItems);
- _listView.EnsureVisible(_listView.GetFocusedItem(), false);
- RefreshStatusBar();
-
- printf("CPanel::OpenParentFolder-end\n");
-}
-
-void CPanel::CloseOpenFolders()
-{
- while (_parentFolders.Size() > 0)
- {
- _folder.Release();
- _library.Free();
- _folder = _parentFolders.Back().ParentFolder;
- _library.Attach(_parentFolders.Back().Library.Detach());
- if (_parentFolders.Size() > 1)
- OpenParentArchiveFolder();
- _parentFolders.DeleteBack();
- }
- _flatMode = _flatModeForDisk;
- _folder.Release();
- _library.Free();
-}
-
-void CPanel::OpenRootFolder()
-{
- CDisableTimerProcessing disableTimerProcessing1(*this);
- _parentFolders.Clear();
- SetToRootFolder();
- RefreshListCtrl(UString(), -1, true, UStringVector());
- // ::SetCurrentDirectory(::_currentFolderPrefix);
- /*
- BeforeChangeFolder();
- _currentFolderPrefix.Empty();
- AfterChangeFolder();
- SetCurrentPathText();
- RefreshListCtrl(UString(), 0, UStringVector());
- _listView.EnsureVisible(_listView.GetFocusedItem(), false);
- */
-}
-
-void CPanel::OpenDrivesFolder()
-{
-#ifdef _WIN32
- CloseOpenFolders();
- CFSDrives *fsFolderSpec = new CFSDrives;
- _folder = fsFolderSpec;
- fsFolderSpec->Init();
- RefreshListCtrl();
-#else
- printf("CPanel::OpenDrivesFolder : FIXME\n");
-#endif
-}
-
-void CPanel::OpenFolder(int index)
-{
- if (index == kParentIndex)
- {
- OpenParentFolder();
- return;
- }
- CMyComPtr<IFolderFolder> newFolder;
- _folder->BindToFolder(index, &newFolder);
- if (!newFolder)
- return;
- _folder = newFolder;
- LoadFullPath();
- // ::SetCurrentDirectory(::_currentFolderPrefix);
- RefreshListCtrl();
- UINT state = LVIS_SELECTED;
- _listView.SetItemState(_listView.GetFocusedItem(), state, state);
- _listView.EnsureVisible(_listView.GetFocusedItem(), false);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelItemOpen.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
deleted file mode 100644
index 814507925..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelItemOpen.cpp
+++ /dev/null
@@ -1,621 +0,0 @@
-// PanelItemOpen.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
-#include "wx/wx.h"
-#endif
-#include "wx/mimetype.h"
-
-#include "resource.h"
-
-#include "Common/StringConvert.h"
-// FIXME #include "Common/Random.h"
-#include "Common/StringConvert.h"
-#include "Common/AutoPtr.h"
-
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-#include "Windows/Thread.h"
-#include "Windows/Synchronization.h"
-#include "Windows/Error.h"
-
-#include "ExtractCallback.h"
-#include "UpdateCallback100.h"
-#include "IFolder.h"
-#include "FileFolderPluginOpen.h"
-#include "FormatUtils.h"
-#include "Panel.h"
-#include "RegistryUtils.h"
-#include "LangUtils.h"
-
-using namespace NWindows;
-using namespace NSynchronization;
-using namespace NFile;
-using namespace NDirectory;
-
-extern HWND g_HWND;
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-static const wchar_t *kTempDirPrefix = L"7zO";
-
-
-static bool IsNameVirus(const UString &name)
-{
- return (name.Find(L" ") >= 0);
-}
-
-struct CTmpProcessInfo: public CTempFileInfo
-{
- HANDLE ProcessHandle;
- HWND Window;
- UString FullPathFolderPrefix;
- bool UsePassword;
- UString Password;
- CTmpProcessInfo(): UsePassword(false) {}
-};
-
-class CTmpProcessInfoRelease
-{
- CTmpProcessInfo *_tmpProcessInfo;
-public:
- bool _needDelete;
- CTmpProcessInfoRelease(CTmpProcessInfo &tmpProcessInfo):
- _tmpProcessInfo(&tmpProcessInfo), _needDelete(true) {}
- ~CTmpProcessInfoRelease()
- {
- if (_needDelete)
- _tmpProcessInfo->DeleteDirAndFile();
- }
-};
-
-HRESULT CPanel::OpenItemAsArchive(IInStream *inStream,
- const CTempFileInfo &tempFileInfo,
- const UString &virtualFilePath,
- bool &encrypted)
-{
- encrypted = false;
- CFolderLink folderLink;
- (CTempFileInfo &)folderLink = tempFileInfo;
- if (inStream)
- folderLink.IsVirtual = true;
- else
- {
- if (!folderLink.FileInfo.Find(folderLink.FilePath))
- return ::GetLastError();
- if (folderLink.FileInfo.IsDir())
- return S_FALSE;
- folderLink.IsVirtual = false;
- }
-
- folderLink.VirtualPath = virtualFilePath;
-
- CMyComPtr<IFolderFolder> newFolder;
-
- // _passwordIsDefined = false;
- // _password.Empty();
-
- NDLL::CLibrary library;
-
- UString password;
- RINOK(OpenFileFolderPlugin(inStream,
- folderLink.FilePath.IsEmpty() ? virtualFilePath : folderLink.FilePath,
- &library, &newFolder, GetParent(), encrypted, password));
-
- folderLink.Password = password;
- folderLink.UsePassword = encrypted;
-
- folderLink.ParentFolder = _folder;
- _parentFolders.Add(folderLink);
- _parentFolders.Back().Library.Attach(_library.Detach());
-
- _folder.Release();
- _library.Free();
- _folder = newFolder;
- _library.Attach(library.Detach());
-
- _flatMode = _flatModeForArc;
-
- return S_OK;
-}
-
-HRESULT CPanel::OpenItemAsArchive(const UString &name, bool &encrypted)
-{
- CTempFileInfo tfi;
- tfi.ItemName = name;
- tfi.FolderPath = _currentFolderPrefix;
- tfi.FilePath = _currentFolderPrefix + name;
- return OpenItemAsArchive(NULL, tfi, _currentFolderPrefix + name, encrypted);
-}
-
-HRESULT CPanel::OpenItemAsArchive(int index)
-{
- CDisableTimerProcessing disableTimerProcessing1(*this);
- bool encrypted;
- RINOK(OpenItemAsArchive(GetItemRelPath(index), encrypted));
- RefreshListCtrl();
- return S_OK;
-}
-
-HRESULT CPanel::OpenParentArchiveFolder()
-{
- CDisableTimerProcessing disableTimerProcessing1(*this);
- if (_parentFolders.Size() < 2)
- return S_OK;
- CFolderLink &folderLink = _parentFolders.Back();
- NFind::CFileInfoW newFileInfo;
- if (NFind::FindFile(folderLink.FilePath, newFileInfo))
- {
- if (newFileInfo.Size != folderLink.FileInfo.Size ||
- CompareFileTime(&newFileInfo.MTime, &folderLink.FileInfo.MTime) != 0)
- {
- UString message = MyFormatNew(IDS_WANT_UPDATE_MODIFIED_FILE,
- 0x03020280, folderLink.ItemName);
- if (::MessageBoxW(HWND(*this), message, L"7-Zip", MB_OKCANCEL | MB_ICONQUESTION) == IDOK)
- {
- if (OnOpenItemChanged(folderLink.FolderPath, folderLink.ItemName,
- folderLink.UsePassword, folderLink.Password) != S_OK)
- {
- ::MessageBoxW(HWND(*this), MyFormatNew(IDS_CANNOT_UPDATE_FILE,
- 0x03020281, folderLink.FilePath), L"7-Zip", MB_OK | MB_ICONSTOP);
- return S_OK;
- }
- }
- }
- }
- folderLink.DeleteDirAndFile();
- return S_OK;
-}
-
-static const wchar_t *kStartExtensions[] =
-{
- L"exe", L"bat", L"com",
- L"chm",
- L"msi", L"doc", L"xls", L"ppt", L"pps", L"wps", L"wpt", L"wks", L"xlr", L"wdb",
-
- L"docx", L"docm", L"dotx", L"dotm", L"xlsx", L"xlsm", L"xltx", L"xltm", L"xlsb",
- L"xlam", L"pptx", L"pptm", L"potx", L"potm", L"ppam", L"ppsx", L"ppsm", L"xsn",
-
- L"dwf",
-
- L"odt", L"ods",
- L"wb3",
- L"pdf"
-};
-
-static bool DoItemAlwaysStart(const UString &name)
-{
- int extPos = name.ReverseFind('.');
- if (extPos < 0)
- return false;
- UString ext = name.Mid(extPos + 1);
- ext.MakeLower();
- for (int i = 0; i < sizeof(kStartExtensions) / sizeof(kStartExtensions[0]); i++)
- if (ext.Compare(kStartExtensions[i]) == 0)
- return true;
- return false;
-}
-
-#ifdef _WIN32
-static HANDLE StartEditApplication(const UString &path, HWND window)
-{
- UString command;
- ReadRegEditor(command);
- if (command.IsEmpty())
- {
- if (!MyGetWindowsDirectory(command))
- return 0;
- NFile::NName::NormalizeDirPathPrefix(command);
- command += L"notepad.exe";
- }
- command = UString(L"\"") + command + UString(L"\"");
- command += L" \"";
- command += UString(path);
- command += L"\"";
-
- PROCESS_INFORMATION processInformation;
- BOOL result;
- #ifndef _UNICODE
- if (!g_IsNT)
- {
- STARTUPINFOA startupInfo;
- startupInfo.cb = sizeof(startupInfo);
- startupInfo.lpReserved = 0;
- startupInfo.lpDesktop = 0;
- startupInfo.lpTitle = 0;
- startupInfo.dwFlags = 0;
- startupInfo.cbReserved2 = 0;
- startupInfo.lpReserved2 = 0;
-
- result = ::CreateProcessA(NULL, (CHAR *)(const CHAR *)GetSystemString(command),
- NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInformation);
- }
- else
- #endif
- {
- STARTUPINFOW startupInfo;
- startupInfo.cb = sizeof(startupInfo);
- startupInfo.lpReserved = 0;
- startupInfo.lpDesktop = 0;
- startupInfo.lpTitle = 0;
- startupInfo.dwFlags = 0;
- startupInfo.cbReserved2 = 0;
- startupInfo.lpReserved2 = 0;
-
- result = ::CreateProcessW(NULL, (WCHAR *)(const WCHAR *)command,
- NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInformation);
- }
-
- if (result != FALSE)
- {
- ::CloseHandle(processInformation.hThread);
- return processInformation.hProcess;
- }
- ::MessageBoxW(window, LangString(IDS_CANNOT_START_EDITOR, 0x03020282),
- L"7-Zip", MB_OK | MB_ICONSTOP);
- return 0;
-}
-
-#ifndef _UNICODE
-typedef BOOL (WINAPI * ShellExecuteExWP)(LPSHELLEXECUTEINFOW lpExecInfo);
-#endif
-
-#endif // _WIN32
-
-static void StartApplication(const UString &path, HWND window)
-{
- // FIXME
- extern const TCHAR * nameWindowToUnix(const TCHAR * lpFileName);
- UString tmpPath = path;
-
- wxString filename(nameWindowToUnix(tmpPath));
-
-
- wxString ext = filename.AfterLast(_T('.'));
-
- printf("StartApplication(%ls) ext='%ls'\n",(const wchar_t *)filename,(const wchar_t *)ext);
-
- if ( ! ext.empty() )
- {
- wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(ext);
- // printf("StartApplication(%ls) ft=%p\n",(const wchar_t *)filename,ft);
- if (ft)
- {
- wxString cmd;
- // wxString type; ft->GetMimeType(&type);
- wxFileType::MessageParameters params(filename); // , type);
- bool ok = ft->GetOpenCommand(&cmd, params);
- // printf("StartApplication(%ls) ok=%d\n",(const wchar_t *)filename,(int)ok);
- delete ft;
- if ( ok )
- {
- printf("StartApplication(%ls) cmd='%ls'\n",(const wchar_t *)filename,(const wchar_t *)cmd);
- long pid = wxExecute(cmd, wxEXEC_ASYNC);
- if (pid) return ;
- }
- }
- }
- ::MessageBoxW(window,
- // NError::MyFormatMessageW(::GetLastError()),
- L"There is no application associated with the given file name extension",
- L"7-Zip", MB_OK | MB_ICONSTOP);
-}
-
-void CPanel::EditItem(int index)
-{
- if (!_parentFolders.IsEmpty())
- {
- OpenItemInArchive(index, false, true, true);
- return;
- }
-#ifdef _WIN32
- HANDLE hProcess = StartEditApplication(_currentFolderPrefix + GetItemRelPath(index), (HWND)*this);
- if (hProcess != 0)
- ::CloseHandle(hProcess);
-#endif
-}
-
-void CPanel::OpenFolderExternal(int index)
-{
-#ifdef _WIN32
- HANDLE hProcess = StartApplication(GetFsPath() + GetItemRelPath(index), (HWND)*this);
- if (hProcess != 0)
- ::CloseHandle(hProcess);
-#else
- printf(" CPanel::OpenFolderExternal : FIXME\n");
-#endif
-}
-
-void CPanel::OpenItem(int index, bool tryInternal, bool tryExternal)
-{
- CDisableTimerProcessing disableTimerProcessing1(*this);
- if (!_parentFolders.IsEmpty())
- {
- OpenItemInArchive(index, tryInternal, tryExternal, false);
- return;
- }
- UString name = GetItemRelPath(index);
- if (IsNameVirus(name))
- {
- MessageBoxErrorLang(IDS_VIRUS, 0x03020284);
- return;
- }
- UString fullPath = _currentFolderPrefix + name;
- if (tryInternal)
- if (!tryExternal || !DoItemAlwaysStart(name))
- {
- HRESULT res = OpenItemAsArchive(index);
- if (res == S_OK || res == E_ABORT)
- return;
- if (res != S_FALSE)
- {
- MessageBoxError(res);
- return;
- }
- }
- if (tryExternal)
- {
- // SetCurrentDirectory opens HANDLE to folder!!!
- // NDirectory::MySetCurrentDirectory(_currentFolderPrefix);
-#ifdef _WIN32
- HANDLE hProcess = StartApplication(fullPath, (HWND)*this);
- if (hProcess != 0)
- ::CloseHandle(hProcess);
-#else
- StartApplication(fullPath, (HWND)*this);
-#endif
- }
-}
-
-HRESULT CPanel::OnOpenItemChanged(const UString &folderPath, const UString &itemName,
- bool usePassword, const UString &password)
-{
- CMyComPtr<IFolderOperations> folderOperations;
- if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
- {
- MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- return E_FAIL;
- }
- UStringVector fileNames;
- CRecordVector<const wchar_t *> fileNamePointers;
- fileNames.Add(itemName);
- fileNamePointers.Add(fileNames[0]);
-
- UString pathPrefix = folderPath;
- NName::NormalizeDirPathPrefix(pathPrefix);
-
- CUpdateCallback100Imp *callbackSpec = new CUpdateCallback100Imp;
- CMyComPtr<IProgress> callback = callbackSpec;
- callbackSpec->Init((HWND)*this, usePassword, password);
-
- return folderOperations->CopyFrom(pathPrefix, &fileNamePointers.Front(), fileNamePointers.Size(), callback);
-}
-
-LRESULT CPanel::OnOpenItemChanged(LPARAM lParam)
-{
- CTmpProcessInfo &tmpProcessInfo = *(CTmpProcessInfo *)lParam;
- // LoadCurrentPath()
- if (tmpProcessInfo.FullPathFolderPrefix != _currentFolderPrefix)
- return 0;
-
- CSelectedState state;
- SaveSelectedState(state);
-
- HRESULT result = OnOpenItemChanged(tmpProcessInfo.FolderPath, tmpProcessInfo.ItemName,
- tmpProcessInfo.UsePassword, tmpProcessInfo.Password);
- if (result != S_OK)
- return 0;
- RefreshListCtrl(state);
- return 1;
-}
-
-/*
-class CTmpProcessInfoList
-{
-public:
- CObjectVector<CTmpProcessInfo> _items;
-} g_TmpProcessInfoList;
-*/
-
-class CExitEventLauncher
-{
-public:
- NWindows::NSynchronization::CManualResetEvent _exitEvent;
- CExitEventLauncher()
- {
- if (_exitEvent.Create(false) != S_OK)
- throw 9387173;
- };
- ~CExitEventLauncher() { _exitEvent.Set(); }
-} g_ExitEventLauncher;
-
-#ifdef _WIN32
-static THREAD_FUNC_DECL MyThreadFunction(void *param)
-{
- CMyAutoPtr<CTmpProcessInfo> tmpProcessInfoPtr((CTmpProcessInfo *)param);
- CTmpProcessInfo *tmpProcessInfo = tmpProcessInfoPtr.get();
-
- HANDLE hProcess = tmpProcessInfo->ProcessHandle;
- HANDLE events[2] = { g_ExitEventLauncher._exitEvent, hProcess};
- DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE);
- ::CloseHandle(hProcess);
- if (waitResult == WAIT_OBJECT_0 + 0)
- return 0;
- if (waitResult != WAIT_OBJECT_0 + 1)
- return 1;
- Sleep(200);
- NFind::CFileInfoW newFileInfo;
- if (NFind::FindFile(tmpProcessInfo->FilePath, newFileInfo))
- {
- if (newFileInfo.Size != tmpProcessInfo->FileInfo.Size ||
- CompareFileTime(&newFileInfo.MTime, &tmpProcessInfo->FileInfo.MTime) != 0)
- {
- UString message = MyFormatNew(IDS_WANT_UPDATE_MODIFIED_FILE,
- 0x03020280, tmpProcessInfo->ItemName);
- if (::MessageBoxW(g_HWND, message, L"7-Zip", MB_OKCANCEL | MB_ICONQUESTION) == IDOK)
- {
- if (SendMessage(tmpProcessInfo->Window, kOpenItemChanged, 0, (LONG_PTR)tmpProcessInfo) != 1)
- {
- ::MessageBoxW(g_HWND, MyFormatNew(IDS_CANNOT_UPDATE_FILE,
- 0x03020281, tmpProcessInfo->FilePath), L"7-Zip", MB_OK | MB_ICONSTOP);
- return 0;
- }
- }
- }
- }
- tmpProcessInfo->DeleteDirAndFile();
- return 0;
-}
-#endif
-
-void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bool editMode)
-{
- const UString name = GetItemName(index);
- if (IsNameVirus(name))
- {
- MessageBoxErrorLang(IDS_VIRUS, 0x03020284);
- return;
- }
-
- CMyComPtr<IFolderOperations> folderOperations;
- if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
- {
- MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- return;
- }
-
-#ifdef _WIN32
- NFile::NDirectory::CTempDirectoryW tempDirectory;
- tempDirectory.Create(kTempDirPrefix);
- UString tempDir = tempDirectory.GetPath();
- UString tempDirNorm = tempDir;
- NFile::NName::NormalizeDirPathPrefix(tempDirNorm);
-
- CRecordVector<UInt32> indices;
- indices.Add(index);
-
- UStringVector messages;
-
- bool usePassword = false;
- UString password;
- if (_parentFolders.Size() > 0)
- {
- const CFolderLink &fl = _parentFolders.Back();
- usePassword = fl.UsePassword;
- password = fl.Password;
- }
-
- HRESULT result = CopyTo(indices, tempDirNorm, false, true, &messages, usePassword, password);
-
- if (_parentFolders.Size() > 0)
- {
- CFolderLink &fl = _parentFolders.Back();
- fl.UsePassword = usePassword;
- fl.Password = password;
- }
-
- if (!messages.IsEmpty())
- return;
- if (result != S_OK)
- {
- if (result != E_ABORT)
- MessageBoxError(result);
- return;
- }
-
- UString tempFilePath = tempDirNorm + name;
-
- CMyAutoPtr<CTmpProcessInfo> tmpProcessInfoPtr(new CTmpProcessInfo());
- CTmpProcessInfo *tmpProcessInfo = tmpProcessInfoPtr.get();
- tmpProcessInfo->FolderPath = tempDir;
- tmpProcessInfo->FilePath = tempFilePath;
- tmpProcessInfo->UsePassword = usePassword;
- tmpProcessInfo->Password = password;
-
- if (!NFind::FindFile(tempFilePath, tmpProcessInfo->FileInfo))
- return;
-
- if (tryInternal)
- {
- if (!tryExternal || !DoItemAlwaysStart(name))
- {
- bool encrypted;
- if (OpenItemAsArchive(name, tempDir, tempFilePath,
- _currentFolderPrefix + name, encrypted) == S_OK)
- {
- RefreshListCtrl();
- return;
- }
- }
- }
-
- CTmpProcessInfoRelease tmpProcessInfoRelease(*tmpProcessInfo);
-
- if (!tryExternal)
- return;
-
- HANDLE hProcess;
- if (editMode)
- hProcess = StartEditApplication(tempFilePath, (HWND)*this);
- else
- hProcess = StartApplication(tempFilePath, (HWND)*this);
-
- if (hProcess == 0)
- return;
-
- tmpProcessInfo->Window = (HWND)(*this);
- tmpProcessInfo->FullPathFolderPrefix = _currentFolderPrefix;
- tmpProcessInfo->ItemName = name;
- tmpProcessInfo->ProcessHandle = hProcess;
-
- NWindows::CThread thread;
- if (thread.Create(MyThreadFunction, tmpProcessInfo) != S_OK)
- throw 271824;
- tempDirectory.DisableDeleting();
- tmpProcessInfoPtr.release();
- tmpProcessInfoRelease._needDelete = false;
-#else
- printf(" CPanel::OpenItemInArchive : FIXME\n");
-#endif
-}
-
-/*
-static const UINT64 kTimeLimit = UINT64(10000000) * 3600 * 24;
-
-static bool CheckDeleteItem(UINT64 currentFileTime, UINT64 folderFileTime)
-{
- return (currentFileTime - folderFileTime > kTimeLimit &&
- folderFileTime - currentFileTime > kTimeLimit);
-}
-
-void DeleteOldTempFiles()
-{
- UString tempPath;
- if(!NFile::NDirectory::MyGetTempPath(tempPath))
- throw 1;
-
- UINT64 currentFileTime;
- NTime::GetCurUtcFileTime(currentFileTime);
- UString searchWildCard = tempPath + kTempDirPrefix + L"*.tmp";
- searchWildCard += WCHAR(NName::kAnyStringWildcard);
- NFind::CEnumeratorW enumerator(searchWildCard);
- NFind::CFileInfoW fileInfo;
- while(enumerator.Next(fileInfo))
- {
- if (!fileInfo.IsDir())
- continue;
- const UINT64 &cTime = *(const UINT64 *)(&fileInfo.CTime);
- if(CheckDeleteItem(cTime, currentFileTime))
- RemoveDirectoryWithSubItems(tempPath + fileInfo.Name);
- }
-}
-*/
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelItems.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelItems.cpp
deleted file mode 100644
index 38d925355..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelItems.cpp
+++ /dev/null
@@ -1,828 +0,0 @@
-// PanelItems.cpp
-
-#include "StdAfx.h"
-
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-// FIXME #include "Windows/Menu.h"
-
-#include "../../PropID.h"
-
-#include "resource.h"
-
-#include "LangUtils.h"
-#include "Panel.h"
-#include "PropertyName.h"
-#include "RootFolder.h"
-
-extern "C"
-{
- #include "../../../../C/Sort.h"
-}
-
-using namespace NWindows;
-
-static int GetColumnAlign(PROPID propID, VARTYPE varType)
-{
- switch(propID)
- {
- case kpidCTime:
- case kpidATime:
- case kpidMTime:
- return LVCFMT_LEFT;
- }
- switch(varType)
- {
- case VT_UI1:
- case VT_I2:
- case VT_UI2:
- case VT_I4:
- case VT_INT:
- case VT_UI4:
- case VT_UINT:
- case VT_I8:
- case VT_UI8:
- case VT_BOOL:
- return LVCFMT_RIGHT;
-
- case VT_EMPTY:
- case VT_I1:
- case VT_FILETIME:
- case VT_BSTR:
- return LVCFMT_LEFT;
-
- default:
- return LVCFMT_CENTER;
- }
-}
-
-void CPanel::InitColumns()
-{
- printf("CPanel::InitColumns\n");
- if (_needSaveInfo)
- SaveListViewInfo();
-
- _listView.DeleteAllItems();
- _selectedStatusVector.Clear();
-
- ReadListViewInfo();
-
-
- PROPID sortID;
- /*
- if (_listViewInfo.SortIndex >= 0)
- sortID = _listViewInfo.Columns[_listViewInfo.SortIndex].PropID;
- */
- sortID = _listViewInfo.SortID;
-
- _ascending = _listViewInfo.Ascending;
-
- _properties.Clear();
-
- _needSaveInfo = true;
-
- UInt32 numProperties;
- _folder->GetNumberOfProperties(&numProperties);
- int i;
- for (i = 0; i < (int)numProperties; i++)
- {
- CMyComBSTR name;
- PROPID propID;
- VARTYPE varType;
-
- if (_folder->GetPropertyInfo(i, &name, &propID, &varType) != S_OK)
- throw 1;
-
- if (propID == kpidIsDir)
- continue;
-
- CItemProperty prop;
- prop.Type = varType;
- prop.ID = propID;
- prop.Name = GetNameOfProperty(propID, name);
- prop.Order = -1;
- prop.IsVisible = true;
- prop.Width = 100;
- _properties.Add(prop);
- }
- // InitColumns2(sortID);
-
- for (;;)
- if (!_listView.DeleteColumn(0))
- break;
-
- int order = 0;
- for(i = 0; i < _listViewInfo.Columns.Size(); i++)
- {
- const CColumnInfo &columnInfo = _listViewInfo.Columns[i];
- int index = _properties.FindItemWithID(columnInfo.PropID);
- if (index >= 0)
- {
- CItemProperty &item = _properties[index];
- item.IsVisible = columnInfo.IsVisible;
- item.Width = columnInfo.Width;
- if (columnInfo.IsVisible)
- item.Order = order++;
- continue;
- }
- }
- for(i = 0; i < _properties.Size(); i++)
- {
- CItemProperty &item = _properties[i];
- if (item.Order < 0)
- item.Order = order++;
- }
-
- _visibleProperties.Clear();
- for (i = 0; i < _properties.Size(); i++)
- {
- const CItemProperty &property = _properties[i];
- if (property.IsVisible)
- _visibleProperties.Add(property);
- }
-
- // _sortIndex = 0;
- _sortID = kpidName;
- /*
- if (_listViewInfo.SortIndex >= 0)
- {
- int sortIndex = _properties.FindItemWithID(sortID);
- if (sortIndex >= 0)
- _sortIndex = sortIndex;
- }
- */
- _sortID = _listViewInfo.SortID;
-
- for (i = 0; i < _visibleProperties.Size(); i++)
- {
- InsertColumn(i);
- }
-}
-
-void CPanel::InsertColumn(int index)
-{
- //printf("CPanel::InsertColumn\n");
- const CItemProperty &property = _visibleProperties[index];
- LV_COLUMNW column;
- column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM | LVCF_ORDER;
- column.cx = property.Width;
- column.fmt = GetColumnAlign(property.ID, property.Type);
- column.iOrder = property.Order;
- column.iSubItem = index;
- column.pszText = (wchar_t *)(const wchar_t *)property.Name;
- _listView.InsertColumn(index, &column);
-}
-
-void CPanel::RefreshListCtrl()
-{
- RefreshListCtrl(UString(), -1, true, UStringVector());
-}
-
-int CALLBACK CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData);
-
-
-void CPanel::GetSelectedNames(UStringVector &selectedNames)
-{
- selectedNames.Clear();
-
- CRecordVector<UInt32> indices;
- GetSelectedItemsIndices(indices);
- selectedNames.Reserve(indices.Size());
- for (int i = 0; i < indices.Size(); i++)
- selectedNames.Add(GetItemRelPath(indices[i]));
-
- /*
- for (int i = 0; i < _listView.GetItemCount(); i++)
- {
- const int kSize = 1024;
- WCHAR name[kSize + 1];
- LVITEMW item;
- item.iItem = i;
- item.pszText = name;
- item.cchTextMax = kSize;
- item.iSubItem = 0;
- item.mask = LVIF_TEXT | LVIF_PARAM;
- if (!_listView.GetItem(&item))
- continue;
- int realIndex = GetRealIndex(item);
- if (realIndex == kParentIndex)
- continue;
- if (_selectedStatusVector[realIndex])
- selectedNames.Add(item.pszText);
- }
- */
- selectedNames.Sort();
-}
-
-void CPanel::SaveSelectedState(CSelectedState &s)
-{
- s.FocusedName.Empty();
- s.SelectedNames.Clear();
- s.FocusedItem = _listView.GetFocusedItem();
- {
- if (s.FocusedItem >= 0)
- {
- int realIndex = GetRealItemIndex(s.FocusedItem);
- if (realIndex != kParentIndex)
- s.FocusedName = GetItemRelPath(realIndex);
- /*
- const int kSize = 1024;
- WCHAR name[kSize + 1];
- LVITEMW item;
- item.iItem = focusedItem;
- item.pszText = name;
- item.cchTextMax = kSize;
- item.iSubItem = 0;
- item.mask = LVIF_TEXT;
- if (_listView.GetItem(&item))
- focusedName = item.pszText;
- */
- }
- }
- GetSelectedNames(s.SelectedNames);
-}
-
-void CPanel::RefreshListCtrl(const CSelectedState &s)
-{
- bool selectFocused = s.SelectFocused;
- if (_mySelectMode)
- selectFocused = true;
- RefreshListCtrl(s.FocusedName, s.FocusedItem, selectFocused, s.SelectedNames);
-}
-
-void CPanel::RefreshListCtrlSaveFocused()
-{
- CSelectedState state;
- SaveSelectedState(state);
- RefreshListCtrl(state);
-}
-
-void CPanel::SetFocusedSelectedItem(int index, bool select)
-{
- UINT state = LVIS_FOCUSED;
- if (select)
- state |= LVIS_SELECTED;
- _listView.SetItemState(index, state, state);
- if (!_mySelectMode && select)
- {
- int realIndex = GetRealItemIndex(index);
- if (realIndex != kParentIndex)
- _selectedStatusVector[realIndex] = true;
- }
-}
-
-void CPanel::RefreshListCtrl(const UString &focusedName, int focusedPos, bool selectFocused,
- const UStringVector &selectedNames)
-{
-printf("CPanel::RefreshListCtrl\n");
- _dontShowMode = false;
- LoadFullPathAndShow();
- // OutputDebugStringA("=======\n");
- // OutputDebugStringA("s1 \n");
- CDisableTimerProcessing timerProcessing(*this);
-
- if (focusedPos < 0)
- focusedPos = 0;
-
- _listView.SetRedraw(false);
- // m_RedrawEnabled = false;
-
-#ifdef _WIN32
- LVITEMW item;
- ZeroMemory(&item, sizeof(item));
-#else
- LVITEMW item = { 0 };
-#endif
-
- _listView.DeleteAllItems();
- _selectedStatusVector.Clear();
- // _realIndices.Clear();
- _startGroupSelect = 0;
-
- _selectionIsDefined = false;
-
- // m_Files.Clear();
- // _folder.Release();
-
- if (!_folder)
- {
- // throw 1;
- SetToRootFolder();
- }
-
- // FIXME _headerToolBar.EnableButton(kParentFolderID, !IsRootFolder());
-
- CMyComPtr<IFolderSetFlatMode> folderSetFlatMode;
- _folder.QueryInterface(IID_IFolderSetFlatMode, &folderSetFlatMode);
- if (folderSetFlatMode)
- folderSetFlatMode->SetFlatMode(BoolToInt(_flatMode));
-
- if (_folder->LoadItems() != S_OK)
- return;
-
- InitColumns();
-
-
- // OutputDebugString(TEXT("Start Dir\n"));
- UInt32 numItems;
- _folder->GetNumberOfItems(&numItems);
-
- bool showDots = _showDots && !IsRootFolder();
-
- _listView.SetItemCount(numItems + (showDots ? 1 : 0));
-
- _selectedStatusVector.Reserve(numItems);
- int cursorIndex = -1;
-
- CMyComPtr<IFolderGetSystemIconIndex> folderGetSystemIconIndex;
- if (!IsFSFolder() || _showRealFileIcons)
- _folder.QueryInterface(IID_IFolderGetSystemIconIndex, &folderGetSystemIconIndex);
-
- if (showDots)
- {
- UString itemName = L"..";
- item.iItem = _listView.GetItemCount();
- if (itemName.CompareNoCase(focusedName) == 0)
- cursorIndex = item.iItem;
- item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
- int subItem = 0;
- item.iSubItem = subItem++;
- item.lParam = kParentIndex;
- item.pszText = (wchar_t *)(const wchar_t *)itemName;
- UInt32 attributes = FILE_ATTRIBUTE_DIRECTORY;
- /* FIXME
- item.iImage = _extToIconMap.GetIconIndex(attributes, itemName);
- if (item.iImage < 0)
- item.iImage = 0;
- */
- item.iImage = -1; // FIXME
- if(_listView.InsertItem(&item) == -1)
- return;
- }
-
- // OutputDebugStringA("S1\n");
-
- for(UInt32 i = 0; i < numItems; i++)
- {
- UString itemName = GetItemName(i);
- const UString relPath = GetItemRelPath(i);
- if (relPath.CompareNoCase(focusedName) == 0)
- cursorIndex = _listView.GetItemCount();
- bool selected = false;
- if (selectedNames.FindInSorted(relPath) >= 0)
- selected = true;
- _selectedStatusVector.Add(selected);
-
- item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
-
- if (!_mySelectMode)
- if (selected)
- {
- item.mask |= LVIF_STATE;
- item.state = LVIS_SELECTED;
- }
-
- int subItem = 0;
- item.iItem = _listView.GetItemCount();
-
- item.iSubItem = subItem++;
- item.lParam = i;
-
- UString correctedName;
- if (itemName.Find(L" ") >= 0)
- {
- int pos = 0;
- for (;;)
- {
- int posNew = itemName.Find(L" ", pos);
- if (posNew < 0)
- {
- correctedName += itemName.Mid(pos);
- break;
- }
- correctedName += itemName.Mid(pos, posNew - pos);
- correctedName += L" ... ";
- pos = posNew;
- while (itemName[++pos] == ' ');
- }
- item.pszText = (wchar_t *)(const wchar_t *)correctedName;
- }
- else
- item.pszText = (wchar_t *)(const wchar_t *)itemName;
-
- NCOM::CPropVariant propVariant;
- _folder->GetProperty(i, kpidAttrib, &propVariant);
- UInt32 attributes = 0;
- if (propVariant.vt == VT_UI4)
- attributes = propVariant.ulVal;
- else
- {
- if (IsItemFolder(i))
- attributes |= FILE_ATTRIBUTE_DIRECTORY;
- }
-
- bool defined = false;
-
- if (folderGetSystemIconIndex)
- {
- folderGetSystemIconIndex->GetSystemIconIndex(i, &item.iImage);
- defined = (item.iImage > 0);
- }
- if (!defined)
- {
- if (_currentFolderPrefix.IsEmpty())
- {
- int iconIndexTemp = -1;
- GetRealIconIndex(itemName + WSTRING_PATH_SEPARATOR, attributes, iconIndexTemp);
- item.iImage = iconIndexTemp;
- }
- else
- {
- item.iImage = -1; // FIXME _extToIconMap.GetIconIndex(attributes, itemName);
- }
- }
- if (item.iImage < 0)
- item.iImage = 0;
-
- if(_listView.InsertItem(&item) == -1)
- return; // error
-
- // FIXME Added
- item.pszText = (LPWSTR)malloc(4096); // FIXME
- for(int col=1;col < _listView.GetColumnCount(); col++)
- {
- item.iSubItem = col;
- item.cchTextMax = 4096 / sizeof(item.pszText[0]);
- this->SetItemText(item);
- _listView.SetItem(&item);
- }
- free(item.pszText); item.pszText = 0;
-
- }
- // OutputDebugStringA("End2\n");
-
- if(_listView.GetItemCount() > 0 && cursorIndex >= 0)
- SetFocusedSelectedItem(cursorIndex, selectFocused);
- _listView.SortItems(CompareItems, (LPARAM)this);
- if (cursorIndex < 0 && _listView.GetItemCount() > 0)
- {
- if (focusedPos >= _listView.GetItemCount())
- focusedPos = _listView.GetItemCount() - 1;
- SetFocusedSelectedItem(focusedPos, showDots);
- }
- // m_RedrawEnabled = true;
- _listView.EnsureVisible(_listView.GetFocusedItem(), false);
- _listView.SetRedraw(true);
- _listView.InvalidateRect(NULL, true);
- // OutputDebugStringA("End1\n");
- /*
- _listView.UpdateWindow();
- */
-}
-
-void CPanel::GetSelectedItemsIndices(CRecordVector<UInt32> &indices) const
-{
- indices.Clear();
-#if 0 // FIXME - not needed anymore ? (UNIX_ENV)
- int itemIndex = -1;
- while ((itemIndex = _listView.GetNextItem(itemIndex, LVNI_SELECTED)) != -1)
- {
- LPARAM param;
- if (_listView.GetItemParam(itemIndex, param))
- indices.Add(param);
- }
-#else
- for (int i = 0; i < _selectedStatusVector.Size(); i++)
- if (_selectedStatusVector[i])
- indices.Add(i);
-#endif
- HeapSort(&indices.Front(), indices.Size());
-}
-
-void CPanel::GetOperatedItemIndices(CRecordVector<UInt32> &indices) const
-{
- GetSelectedItemsIndices(indices);
- if (!indices.IsEmpty())
- return;
- if (_listView.GetSelectedCount() == 0)
- return;
- int focusedItem = _listView.GetFocusedItem();
- if (focusedItem >= 0)
- {
- if(_listView.GetItemState(focusedItem, LVIS_SELECTED) == LVIS_SELECTED)
- {
- int realIndex = GetRealItemIndex(focusedItem);
- if (realIndex != kParentIndex)
- indices.Add(realIndex);
- }
- }
-}
-
-void CPanel::GetAllItemIndices(CRecordVector<UInt32> &indices) const
-{
- indices.Clear();
- UInt32 numItems;
- if (_folder->GetNumberOfItems(&numItems) == S_OK)
- for (UInt32 i = 0; i < numItems; i++)
- indices.Add(i);
-}
-
-void CPanel::GetOperatedIndicesSmart(CRecordVector<UInt32> &indices) const
-{
- GetOperatedItemIndices(indices);
- if (indices.IsEmpty() || (indices.Size() == 1 && indices[0] == (UInt32)(Int32)-1))
- GetAllItemIndices(indices);
-}
-
-/*
-void CPanel::GetOperatedListViewIndices(CRecordVector<UInt32> &indices) const
-{
- indices.Clear();
- int numItems = _listView.GetItemCount();
- for (int i = 0; i < numItems; i++)
- {
- int realIndex = GetRealItemIndex(i);
- if (realIndex >= 0)
- if (_selectedStatusVector[realIndex])
- indices.Add(i);
- }
- if (indices.IsEmpty())
- {
- int focusedItem = _listView.GetFocusedItem();
- if (focusedItem >= 0)
- indices.Add(focusedItem);
- }
-}
-*/
-
-void CPanel::EditItem()
-{
- int focusedItem = _listView.GetFocusedItem();
- if (focusedItem < 0)
- return;
- int realIndex = GetRealItemIndex(focusedItem);
- if (realIndex == kParentIndex)
- return;
- if (!IsItemFolder(realIndex))
- EditItem(realIndex);
-}
-
-void CPanel::OpenFocusedItemAsInternal()
-{
- int focusedItem = _listView.GetFocusedItem();
- if (focusedItem < 0)
- return;
- int realIndex = GetRealItemIndex(focusedItem);
- if (IsItemFolder(realIndex))
- OpenFolder(realIndex);
- else
- OpenItem(realIndex, true, false);
-}
-
-void CPanel::OpenSelectedItems(bool tryInternal)
-{
- CRecordVector<UInt32> indices;
- GetOperatedItemIndices(indices);
- if (indices.Size() > 20)
- {
- MessageBoxErrorLang(IDS_TOO_MANY_ITEMS, 0x02000606);
- return;
- }
-
- int focusedItem = _listView.GetFocusedItem();
- if (focusedItem >= 0)
- {
- int realIndex = GetRealItemIndex(focusedItem);
- if (realIndex == kParentIndex && (tryInternal || indices.Size() == 0))
- indices.Insert(0, realIndex);
- }
-
- bool dirIsStarted = false;
- for(int i = 0; i < indices.Size(); i++)
- {
- UInt32 index = indices[i];
- // CFileInfo &aFile = m_Files[index];
- if (IsItemFolder(index))
- {
- if (!dirIsStarted)
- {
- if (tryInternal)
- {
- OpenFolder(index);
- dirIsStarted = true;
- break;
- }
- else
- OpenFolderExternal(index);
- }
- }
- else
- OpenItem(index, (tryInternal && indices.Size() == 1), true);
- }
-}
-
-UString CPanel::GetItemName(int itemIndex) const
-{
- if (itemIndex == kParentIndex)
- return L"..";
- NCOM::CPropVariant propVariant;
- if (_folder->GetProperty(itemIndex, kpidName, &propVariant) != S_OK)
- throw 2723400;
- if (propVariant.vt != VT_BSTR)
- throw 2723401;
- return (propVariant.bstrVal);
-}
-
-UString CPanel::GetItemPrefix(int itemIndex) const
-{
- if (itemIndex == kParentIndex)
- return UString();
- NCOM::CPropVariant propVariant;
- if (_folder->GetProperty(itemIndex, kpidPrefix, &propVariant) != S_OK)
- throw 2723400;
- UString prefix;
- if (propVariant.vt == VT_BSTR)
- prefix = propVariant.bstrVal;
- return prefix;
-}
-
-UString CPanel::GetItemRelPath(int itemIndex) const
-{
- return GetItemPrefix(itemIndex) + GetItemName(itemIndex);
-}
-
-
-bool CPanel::IsItemFolder(int itemIndex) const
-{
- if (itemIndex == kParentIndex)
- return true;
- NCOM::CPropVariant propVariant;
- if (_folder->GetProperty(itemIndex, kpidIsDir, &propVariant) != S_OK)
- throw 2723400;
- if (propVariant.vt == VT_BOOL)
- return VARIANT_BOOLToBool(propVariant.boolVal);
- if (propVariant.vt == VT_EMPTY)
- return false;
- return false;
-}
-
-UINT64 CPanel::GetItemSize(int itemIndex) const
-{
- if (itemIndex == kParentIndex)
- return 0;
- NCOM::CPropVariant propVariant;
- if (_folder->GetProperty(itemIndex, kpidSize, &propVariant) != S_OK)
- throw 2723400;
- if (propVariant.vt == VT_EMPTY)
- return 0;
- return ConvertPropVariantToUInt64(propVariant);
-}
-
-void CPanel::ReadListViewInfo()
-{
- _typeIDString = GetFolderTypeID();
- if (!_typeIDString.IsEmpty())
- ::ReadListViewInfo(_typeIDString, _listViewInfo);
-}
-
-void CPanel::SaveListViewInfo()
-{
- int i;
- for(i = 0; i < _visibleProperties.Size(); i++)
- {
- CItemProperty &property = _visibleProperties[i];
- LVCOLUMN winColumnInfo;
- winColumnInfo.mask = LVCF_ORDER | LVCF_WIDTH;
- if (!_listView.GetColumn(i, &winColumnInfo))
- throw 1;
- property.Order = winColumnInfo.iOrder;
- property.Width = winColumnInfo.cx;
- }
-
- CListViewInfo viewInfo;
-
- // PROPID sortPropID = _properties[_sortIndex].ID;
- PROPID sortPropID = _sortID;
-
- _visibleProperties.Sort();
- for(i = 0; i < _visibleProperties.Size(); i++)
- {
- const CItemProperty &property = _visibleProperties[i];
- CColumnInfo columnInfo;
- columnInfo.IsVisible = property.IsVisible;
- columnInfo.PropID = property.ID;
- columnInfo.Width = property.Width;
- viewInfo.Columns.Add(columnInfo);
- }
- for(i = 0; i < _properties.Size(); i++)
- {
- const CItemProperty &property = _properties[i];
- if (!property.IsVisible)
- {
- CColumnInfo columnInfo;
- columnInfo.IsVisible = property.IsVisible;
- columnInfo.PropID = property.ID;
- columnInfo.Width = property.Width;
- viewInfo.Columns.Add(columnInfo);
- }
- }
-
- // viewInfo.SortIndex = viewInfo.FindColumnWithID(sortPropID);
- viewInfo.SortID = sortPropID;
-
- viewInfo.Ascending = _ascending;
- if (!_listViewInfo.IsEqual(viewInfo))
- {
- ::SaveListViewInfo(_typeIDString, viewInfo);
- _listViewInfo = viewInfo;
- }
-}
-
-#ifdef _WIN32
-bool CPanel::OnRightClick(LPNMITEMACTIVATE itemActiveate, LRESULT &result)
-{
- if(itemActiveate->hdr.hwndFrom == HWND(_listView))
- return false;
-
- POINT point;
- ::GetCursorPos(&point);
-
- CMenu menu;
- CMenuDestroyer menuDestroyer(menu);
-
- menu.CreatePopup();
-
- const int kCommandStart = 100;
- for(int i = 0; i < _properties.Size(); i++)
- {
- const CItemProperty &property = _properties[i];
- UINT flags = MF_STRING;
- if (property.IsVisible)
- flags |= MF_CHECKED;
- if (i == 0)
- flags |= MF_GRAYED;
- menu.AppendItem(flags, kCommandStart + i, GetSystemString(property.Name));
- }
- int menuResult = menu.Track(TPM_LEFTALIGN | TPM_RETURNCMD | TPM_NONOTIFY,
- point.x, point.y, _listView);
- if (menuResult >= kCommandStart && menuResult <= kCommandStart + _properties.Size())
- {
- int index = menuResult - kCommandStart;
- CItemProperty &property = _properties[index];
- property.IsVisible = !property.IsVisible;
-
- if (property.IsVisible)
- {
- int prevVisibleSize = _visibleProperties.Size();
- property.Order = prevVisibleSize;
- _visibleProperties.Add(property);
- InsertColumn(prevVisibleSize);
- }
- else
- {
- int visibleIndex = _visibleProperties.FindItemWithID(property.ID);
- _visibleProperties.Delete(visibleIndex);
- /*
- if (_sortIndex == index)
- {
- _sortIndex = 0;
- _ascending = true;
- }
- */
- if (_sortID == property.ID)
- {
- _sortID = kpidName;
- _ascending = true;
- }
-
- _listView.DeleteColumn(visibleIndex);
- }
- }
- result = TRUE;
- return true;
-}
-#endif // _WIN32
-
-void CPanel::OnReload()
-{
- RefreshListCtrlSaveFocused();
- OnRefreshStatusBar();
-}
-
-void CPanel::OnTimer()
-{
- if (!_processTimer)
- return;
- CMyComPtr<IFolderWasChanged> folderWasChanged;
- if (_folder.QueryInterface(IID_IFolderWasChanged, &folderWasChanged) != S_OK)
- return;
- INT32 wasChanged;
- if (folderWasChanged->WasChanged(&wasChanged) != S_OK)
- return;
- if (wasChanged == 0)
- return;
- OnReload();
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelListNotify.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelListNotify.cpp
deleted file mode 100644
index 4e956324c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelListNotify.cpp
+++ /dev/null
@@ -1,429 +0,0 @@
-// PanelListNotify.cpp
-
-#include "StdAfx.h"
-
-#include "resource.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "../Common/PropIDUtils.h"
-#include "../../PropID.h"
-
-#include "Panel.h"
-#include "FormatUtils.h"
-
-using namespace NWindows;
-
-static UString ConvertSizeToStringShort(UInt64 value)
-{
- wchar_t s[32];
- wchar_t c, c2 = L'B';
- if (value < (UInt64)10000)
- {
- c = L'B';
- c2 = L'\0';
- }
- else if (value < ((UInt64)10000 << 10))
- {
- value >>= 10;
- c = L'K';
- }
- else if (value < ((UInt64)10000 << 20))
- {
- value >>= 20;
- c = L'M';
- }
- else
- {
- value >>= 30;
- c = L'G';
- }
- ConvertUInt64ToString(value, s);
- int p = MyStringLen(s);
- s[p++] = L' ';
- s[p++] = c;
- s[p++] = c2;
- s[p++] = L'\0';
- return s;
-}
-
-UString ConvertSizeToString(UInt64 value)
-{
- wchar_t s[32];
- ConvertUInt64ToString(value, s);
- int i = MyStringLen(s);
- int pos = sizeof(s) / sizeof(s[0]);
- s[--pos] = L'\0';
- while (i > 3)
- {
- s[--pos] = s[--i];
- s[--pos] = s[--i];
- s[--pos] = s[--i];
- s[--pos] = L' ';
- }
- while (i > 0)
- s[--pos] = s[--i];
- return s + pos;
-}
-
-LRESULT CPanel::SetItemText(LVITEMW &item)
-{
- if (_dontShowMode)
- return 0;
-
- UINT32 realIndex = GetRealIndex(item);
- // printf(" CPanel::SetItemText : realIndex=%d\n",realIndex);
-
- /*
- if ((item.mask & LVIF_IMAGE) != 0)
- {
- bool defined = false;
- CComPtr<IFolderGetSystemIconIndex> folderGetSystemIconIndex;
- _folder.QueryInterface(&folderGetSystemIconIndex);
- if (folderGetSystemIconIndex)
- {
- folderGetSystemIconIndex->GetSystemIconIndex(index, &item.iImage);
- defined = (item.iImage > 0);
- }
- if (!defined)
- {
- NCOM::CPropVariant prop;
- _folder->GetProperty(index, kpidAttrib, &prop);
- UINT32 attrib = 0;
- if (prop.vt == VT_UI4)
- attrib = prop.ulVal;
- else if (IsItemFolder(index))
- attrib |= FILE_ATTRIBUTE_DIRECTORY;
- if (_currentFolderPrefix.IsEmpty())
- throw 1;
- else
- item.iImage = _extToIconMap.GetIconIndex(attrib, GetSystemString(GetItemName(index)));
- }
- // item.iImage = 1;
- }
- */
-
- if ((item.mask & LVIF_TEXT) == 0)
- return 0;
-
- if (realIndex == kParentIndex)
- return 0;
- UString s;
- UINT32 subItemIndex = item.iSubItem;
- PROPID propID = _visibleProperties[subItemIndex].ID;
- /*
- {
- NCOM::CPropVariant property;
- if(propID == kpidType)
- string = GetFileType(index);
- else
- {
- HRESULT result = m_ArchiveFolder->GetProperty(index, propID, &property);
- if (result != S_OK)
- {
- // PrintMessage("GetPropertyValue error");
- return 0;
- }
- string = ConvertPropertyToString(property, propID, false);
- }
- }
- */
- // const NFind::CFileInfo &aFileInfo = m_Files[index];
-
- NCOM::CPropVariant prop;
- /*
- bool needRead = true;
- if (propID == kpidSize)
- {
- CComPtr<IFolderGetItemFullSize> getItemFullSize;
- if (_folder.QueryInterface(&getItemFullSize) == S_OK)
- {
- if (getItemFullSize->GetItemFullSize(index, &prop) == S_OK)
- needRead = false;
- }
- }
- if (needRead)
- */
-
- if (_folder->GetProperty(realIndex, propID, &prop) != S_OK)
- throw 2723407;
-
- if ((propID == kpidSize || propID == kpidPackSize || propID == kpidClusterSize ||
- propID == kpidNumSubDirs || propID == kpidNumSubFiles) &&
- (prop.vt == VT_UI8 || prop.vt == VT_UI4))
- s = ConvertSizeToString(ConvertPropVariantToUInt64(prop));
- else if ((propID == kpidTotalSize || propID == kpidFreeSpace) &&
- (prop.vt == VT_UI8 || prop.vt == VT_UI4))
- s = ConvertSizeToStringShort(ConvertPropVariantToUInt64(prop));
- else
- {
- s = ConvertPropertyToString(prop, propID, false);
- s.Replace(wchar_t(0xA), L' ');
- s.Replace(wchar_t(0xD), L' ');
- }
- int size = item.cchTextMax;
- if(size > 0)
- {
- if(s.Length() + 1 > size)
- s = s.Left(size - 1);
- MyStringCopy(item.pszText, (const wchar_t *)s);
- }
- return 0;
-}
-
-#ifdef _WIN32
-extern DWORD g_ComCtl32Version;
-#endif
-
-void CPanel::OnItemChanged(NMLISTVIEW *item)
-{
- int index = (int)item->lParam;
- if (index == kParentIndex)
- return;
- bool oldSelected = (item->uOldState & LVIS_SELECTED) != 0;
- bool newSelected = (item->uNewState & LVIS_SELECTED) != 0;
- // Don't change this code. It works only with such check
- printf("CPanel::OnItemChanged : index=%d oldSel=%d newSel=%d\n",index,(int)oldSelected,(int)newSelected);
- if(oldSelected != newSelected) {
- printf("CPanel::OnItemChanged : _selectedStatusVector[%d] = %d\n",index,(int)newSelected);
- _selectedStatusVector[index] = newSelected;
- }
-}
-
-bool CPanel::OnNotifyList(LPNMHDR header, LRESULT &result)
-{
- printf("CPanel::OnNotifyList : FIXME\n");
- // bool alt = (::GetKeyState(VK_MENU) & 0x8000) != 0;
- // bool ctrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
- // bool shift = (::GetKeyState(VK_SHIFT) & 0x8000) != 0;
- switch(header->code)
- {
- case LVN_ITEMCHANGED:
- {
- if (_enableItemChangeNotify)
- {
- if (!_mySelectMode)
- OnItemChanged((LPNMLISTVIEW)header);
- RefreshStatusBar();
- }
- return false;
- }
- /*
-
- case LVN_ODSTATECHANGED:
- {
- break;
- }
- */
-
-#ifdef _WIN32
- case LVN_GETDISPINFOW:
- {
- LV_DISPINFOW *dispInfo = (LV_DISPINFOW *)header;
-
- //is the sub-item information being requested?
-
- if((dispInfo->item.mask & LVIF_TEXT) != 0 ||
- (dispInfo->item.mask & LVIF_IMAGE) != 0)
- SetItemText(dispInfo->item);
- return false;
- }
- case LVN_KEYDOWN:
- {
- bool boolResult = OnKeyDown(LPNMLVKEYDOWN(header), result);
- RefreshStatusBar();
- return boolResult;
- }
-#endif
-
- case LVN_COLUMNCLICK:
- OnColumnClick(LPNMLISTVIEW(header));
- return false;
- /*
- case LVN_ITEMACTIVATE:
- RefreshStatusBar();
- if (!alt && !ctrl && !shift)
- OpenSelectedItems(true);
- return false;
- */
-
- case NM_DBLCLK:
- RefreshStatusBar();
- OpenSelectedItems(true);
- return false;
-#ifdef _WIN32
- case NM_RETURN:
- {
- bool alt = (::GetKeyState(VK_MENU) & 0x8000) != 0;
- bool ctrl = (::GetKeyState(VK_CONTROL) & 0x8000) != 0;
- // bool leftCtrl = (::GetKeyState(VK_LCONTROL) & 0x8000) != 0;
- // bool RightCtrl = (::GetKeyState(VK_RCONTROL) & 0x8000) != 0;
- bool shift = (::GetKeyState(VK_SHIFT) & 0x8000) != 0;
- if (!shift && alt && !ctrl)
- {
- Properties();
- return false;
- }
- OpenSelectedItems(true);
- return false;
- }
- case NM_RCLICK:
- RefreshStatusBar();
- break;
-
- /*
- return OnRightClick((LPNMITEMACTIVATE)header, result);
- */
- /*
- case NM_CLICK:
- SendRefreshStatusBarMessage();
- return 0;
-
- // TODO : Handler default action...
- return 0;
- case LVN_ITEMCHANGED:
- {
- NMLISTVIEW *pNMLV = (NMLISTVIEW *) lpnmh;
- SelChange(pNMLV);
- return TRUE;
- }
- case NM_SETFOCUS:
- return onSetFocus(NULL);
- case NM_KILLFOCUS:
- return onKillFocus(NULL);
- */
- case NM_CLICK:
- {
- // we need SetFocusToList, if we drag-select items from other panel.
- SetFocusToList();
- RefreshStatusBar();
- if(_mySelectMode)
- if(g_ComCtl32Version >= MAKELONG(71, 4))
- OnLeftClick((LPNMITEMACTIVATE)header);
- return false;
- }
- case LVN_BEGINLABELEDITW:
- result = OnBeginLabelEdit((LV_DISPINFOW *)header);
- return true;
- case LVN_ENDLABELEDITW:
- result = OnEndLabelEdit((LV_DISPINFOW *)header);
- return true;
-
- case NM_CUSTOMDRAW:
- {
- if (_mySelectMode)
- return OnCustomDraw((LPNMLVCUSTOMDRAW)header, result);
- break;
- }
- case LVN_BEGINDRAG:
- {
- OnDrag((LPNMLISTVIEW)header);
- RefreshStatusBar();
- break;
- }
-#endif
- // case LVN_BEGINRDRAG:
- }
- return false;
-}
-
-#ifdef _WIN32
-bool CPanel::OnCustomDraw(LPNMLVCUSTOMDRAW lplvcd, LRESULT &result)
-{
- switch(lplvcd->nmcd.dwDrawStage)
- {
- case CDDS_PREPAINT :
- result = CDRF_NOTIFYITEMDRAW;
- return true;
-
- case CDDS_ITEMPREPAINT:
- /*
- SelectObject(lplvcd->nmcd.hdc,
- GetFontForItem(lplvcd->nmcd.dwItemSpec,
- lplvcd->nmcd.lItemlParam) );
- lplvcd->clrText = GetColorForItem(lplvcd->nmcd.dwItemSpec,
- lplvcd->nmcd.lItemlParam);
- lplvcd->clrTextBk = GetBkColorForItem(lplvcd->nmcd.dwItemSpec,
- lplvcd->nmcd.lItemlParam);
- */
- int realIndex = (int)lplvcd->nmcd.lItemlParam;
- bool selected = false;
- if (realIndex != kParentIndex)
- selected = _selectedStatusVector[realIndex];
- if (selected)
- lplvcd->clrTextBk = RGB(255, 192, 192);
- // lplvcd->clrText = RGB(255, 0, 128);
- else
- lplvcd->clrTextBk = _listView.GetBkColor();
- // lplvcd->clrText = RGB(0, 0, 0);
- // result = CDRF_NEWFONT;
- result = CDRF_NOTIFYITEMDRAW;
- return true;
-
- // return false;
- // return true;
- /*
- case CDDS_SUBITEM | CDDS_ITEMPREPAINT:
- if (lplvcd->iSubItem == 0)
- {
- // lplvcd->clrText = RGB(255, 0, 0);
- lplvcd->clrTextBk = RGB(192, 192, 192);
- }
- else
- {
- lplvcd->clrText = RGB(0, 0, 0);
- lplvcd->clrTextBk = RGB(255, 255, 255);
- }
- return true;
- */
-
- /* At this point, you can change the background colors for the item
- and any subitems and return CDRF_NEWFONT. If the list-view control
- is in report mode, you can simply return CDRF_NOTIFYSUBITEMREDRAW
- to customize the item's subitems individually */
- }
- return false;
-}
-#endif //#ifdef _WIN32
-
-void CPanel::OnRefreshStatusBar()
-{
- CRecordVector<UINT32> indices;
- GetOperatedItemIndices(indices);
-
- _statusBar.SetText(0, MyFormatNew(IDS_N_SELECTED_ITEMS, 0x02000301, NumberToString(indices.Size())));
-
- UString selectSizeString;
-
- if (indices.Size() > 0)
- {
- UInt64 totalSize = 0;
- for (int i = 0; i < indices.Size(); i++)
- totalSize += GetItemSize(indices[i]);
- selectSizeString = ConvertSizeToString(totalSize);
- }
- _statusBar.SetText(1, selectSizeString);
-
- int focusedItem = _listView.GetFocusedItem();
- UString sizeString;
- UString dateString;
- if (focusedItem >= 0 && _listView.GetSelectedCount() > 0)
- {
- int realIndex = GetRealItemIndex(focusedItem);
- if (realIndex != kParentIndex)
- {
- sizeString = ConvertSizeToString(GetItemSize(realIndex));
- NCOM::CPropVariant prop;
- if (_folder->GetProperty(realIndex, kpidMTime, &prop) == S_OK)
- dateString = ConvertPropertyToString(prop, kpidMTime, false);
- }
- }
- _statusBar.SetText(2, sizeString);
- _statusBar.SetText(3, dateString);
- // _statusBar.SetText(4, nameString);
- // _statusBar2.SetText(1, MyFormatNew(L"{0} bytes", NumberToStringW(totalSize)));
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelMenu.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelMenu.cpp
deleted file mode 100644
index 55ac88b96..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelMenu.cpp
+++ /dev/null
@@ -1,621 +0,0 @@
-#include "StdAfx.h"
-
-#include "Common/StringConvert.h"
-
-#include "Windows/COM.h"
-#include "Windows/Clipboard.h"
-// FIXME #include "Windows/Menu.h"
-#include "Windows/PropVariant.h"
-#include "Windows/PropVariantConversions.h"
-
-#include "../Common/PropIDUtils.h"
-#include "../../PropID.h"
-
-#include "App.h"
-#include "LangUtils.h"
-#include "MyLoadMenu.h"
-#include "PluginInterface.h"
-#include "PropertyName.h"
-
-#include "resource.h"
-#include "PropertyNameRes.h"
-
-using namespace NWindows;
-
-// {23170F69-40C1-278A-1000-000100020000}
-DEFINE_GUID(CLSID_CZipContextMenu,
-0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
-
-static const UINT kSevenZipStartMenuID = kPluginMenuStartID ;
-static const UINT kSystemStartMenuID = kPluginMenuStartID + 100;
-
-void CPanel::InvokeSystemCommand(const char *command)
-{
-#ifdef _WIN32
- NCOM::CComInitializer comInitializer;
- if (!IsFsOrPureDrivesFolder())
- return;
- CRecordVector<UInt32> operatedIndices;
- GetOperatedItemIndices(operatedIndices);
- if (operatedIndices.IsEmpty())
- return;
- CMyComPtr<IContextMenu> contextMenu;
- if (CreateShellContextMenu(operatedIndices, contextMenu) != S_OK)
- return;
-
- CMINVOKECOMMANDINFO ci;
- ZeroMemory(&ci, sizeof(ci));
- ci.cbSize = sizeof(CMINVOKECOMMANDINFO);
- ci.hwnd = GetParent();
- ci.lpVerb = command;
- contextMenu->InvokeCommand(&ci);
-#endif
-}
-
-static const wchar_t *kSeparator = L"--------------------------------------\n";
-static const wchar_t *kPropValueSeparator = L": ";
-
-extern UString ConvertSizeToString(UInt64 value);
-
-static void AddPropertyString(PROPID propID, const wchar_t *nameBSTR,
- const NCOM::CPropVariant &prop, UString &s)
-{
- if (prop.vt != VT_EMPTY)
- {
- UString val;
-
- if ((prop.vt == VT_UI8 || prop.vt == VT_UI4) && (
- propID == kpidSize ||
- propID == kpidPackSize ||
- propID == kpidNumSubDirs ||
- propID == kpidNumSubFiles ||
- propID == kpidNumBlocks ||
- propID == kpidClusterSize ||
- propID == kpidTotalSize ||
- propID == kpidFreeSpace ||
- propID == kpidPhySize ||
- propID == kpidHeadersSize ||
- propID == kpidFreeSpace
- ))
- val = ConvertSizeToString(ConvertPropVariantToUInt64(prop));
- else
- val = ConvertPropertyToString(prop, propID);
-
- if (!val.IsEmpty())
- {
- s += GetNameOfProperty(propID, nameBSTR);
- s += kPropValueSeparator;
- /*
- if (propID == kpidComment)
- s += L'\n';
- */
- s += val;
- s += L'\n';
- }
- }
-}
-
-void CPanel::Properties()
-{
- CMyComPtr<IGetFolderArchiveProperties> getFolderArchiveProperties;
- _folder.QueryInterface(IID_IGetFolderArchiveProperties, &getFolderArchiveProperties);
- if (!getFolderArchiveProperties)
- {
- InvokeSystemCommand("properties");
- return;
- }
-
- {
- UString message;
-
- CRecordVector<UInt32> operatedIndices;
- GetOperatedItemIndices(operatedIndices);
- if (operatedIndices.Size() == 1)
- {
- UInt32 index = operatedIndices[0];
- // message += L"Item:\n";
- UInt32 numProps;
- if (_folder->GetNumberOfProperties(&numProps) == S_OK)
- {
- for (UInt32 i = 0; i < numProps; i++)
- {
- CMyComBSTR name;
- PROPID propID;
- VARTYPE varType;
-
- if (_folder->GetPropertyInfo(i, &name, &propID, &varType) != S_OK)
- continue;
-
- NCOM::CPropVariant prop;
- if (_folder->GetProperty(index, propID, &prop) != S_OK)
- continue;
- AddPropertyString(propID, name, prop, message);
- }
- }
- message += kSeparator;
- }
-
- message += LangString(IDS_PROP_FILE_TYPE, 0x02000214);
- message += kPropValueSeparator;
- message += GetFolderTypeID();
- message += L"\n";
-
- {
- NCOM::CPropVariant prop;
- if (_folder->GetFolderProperty(kpidPath, &prop) == S_OK)
- {
- AddPropertyString(kpidName, L"Path", prop, message);
- }
- }
-
- CMyComPtr<IFolderProperties> folderProperties;
- _folder.QueryInterface(IID_IFolderProperties, &folderProperties);
- if (folderProperties)
- {
- UInt32 numProps;
- if (folderProperties->GetNumberOfFolderProperties(&numProps) == S_OK)
- {
- for (UInt32 i = 0; i < numProps; i++)
- {
- CMyComBSTR name;
- PROPID propID;
- VARTYPE vt;
- if (folderProperties->GetFolderPropertyInfo(i, &name, &propID, &vt) != S_OK)
- continue;
- NCOM::CPropVariant prop;
- if (_folder->GetFolderProperty(propID, &prop) != S_OK)
- continue;
- AddPropertyString(propID, name, prop, message);
- }
- }
- }
-
- CMyComPtr<IGetFolderArchiveProperties> getFolderArchiveProperties;
- _folder.QueryInterface(IID_IGetFolderArchiveProperties, &getFolderArchiveProperties);
- if (getFolderArchiveProperties)
- {
- CMyComPtr<IFolderArchiveProperties> getProps;
- getFolderArchiveProperties->GetFolderArchiveProperties(&getProps);
- if (getProps)
- {
- UInt32 numProps;
- if (getProps->GetNumberOfArchiveProperties(&numProps) == S_OK)
- {
- if (numProps > 0)
- message += kSeparator;
- for (UInt32 i = 0; i < numProps; i++)
- {
- CMyComBSTR name;
- PROPID propID;
- VARTYPE vt;
- if (getProps->GetArchivePropertyInfo(i, &name, &propID, &vt) != S_OK)
- continue;
- NCOM::CPropVariant prop;
- if (getProps->GetArchiveProperty(propID, &prop) != S_OK)
- continue;
- AddPropertyString(propID, name, prop, message);
- }
- }
- }
- }
- ::MessageBoxW(*(this), message, LangString(IDS_PROPERTIES, 0x03020900), MB_OK);
- }
-}
-
-void CPanel::EditCut()
-{
- // InvokeSystemCommand("cut");
-}
-
-void CPanel::EditCopy()
-{
- /*
- CMyComPtr<IGetFolderArchiveProperties> getFolderArchiveProperties;
- _folder.QueryInterface(IID_IGetFolderArchiveProperties, &getFolderArchiveProperties);
- if (!getFolderArchiveProperties)
- {
- InvokeSystemCommand("copy");
- return;
- }
- */
- UString s;
- CRecordVector<UInt32> indices;
- GetSelectedItemsIndices(indices);
- for (int i = 0; i < indices.Size(); i++)
- {
- if (i > 0)
- s += L"\xD\n";
- s += GetItemName(indices[i]);
- }
- ClipboardSetText(_mainWindow, s);
-}
-
-void CPanel::EditPaste()
-{
- /*
- UStringVector names;
- ClipboardGetFileNames(names);
- CopyFromNoAsk(names);
- UString s;
- for (int i = 0; i < names.Size(); i++)
- {
- s += L" ";
- s += names[i];
- }
-
- MessageBoxW(0, s, L"", 0);
- */
-
- // InvokeSystemCommand("paste");
-}
-
-#ifdef _WIN32
-HRESULT CPanel::CreateShellContextMenu(
- const CRecordVector<UInt32> &operatedIndices,
- CMyComPtr<IContextMenu> &systemContextMenu)
-{
- systemContextMenu.Release();
- UString folderPath = GetFsPath();
-
- CMyComPtr<IShellFolder> desktopFolder;
- RINOK(::SHGetDesktopFolder(&desktopFolder));
- if (!desktopFolder)
- {
- // ShowMessage("Failed to get Desktop folder.");
- return E_FAIL;
- }
-
- // Separate the file from the folder.
-
-
- // Get a pidl for the folder the file
- // is located in.
- LPITEMIDLIST parentPidl;
- DWORD eaten;
- RINOK(desktopFolder->ParseDisplayName(
- GetParent(), 0, (wchar_t *)(const wchar_t *)folderPath,
- &eaten, &parentPidl, 0));
-
- // Get an IShellFolder for the folder
- // the file is located in.
- CMyComPtr<IShellFolder> parentFolder;
- RINOK(desktopFolder->BindToObject(parentPidl,
- 0, IID_IShellFolder, (void**)&parentFolder));
- if (!parentFolder)
- {
- // ShowMessage("Invalid file name.");
- return E_FAIL;
- }
-
- // Get a pidl for the file itself.
- CRecordVector<LPITEMIDLIST> pidls;
- pidls.Reserve(operatedIndices.Size());
- for (int i = 0; i < operatedIndices.Size(); i++)
- {
- LPITEMIDLIST pidl;
- UString fileName = GetItemRelPath(operatedIndices[i]);
- if (IsFSDrivesFolder())
- fileName += WCHAR_PATH_SEPARATOR;
- RINOK(parentFolder->ParseDisplayName(GetParent(), 0,
- (wchar_t *)(const wchar_t *)fileName, &eaten, &pidl, 0));
- pidls.Add(pidl);
- }
-
- ITEMIDLIST temp;
- if (pidls.Size() == 0)
- {
- temp.mkid.cb = 0;
- /*
- LPITEMIDLIST pidl;
- HRESULT result = parentFolder->ParseDisplayName(GetParent(), 0,
- L"." WSTRING_PATH_SEPARATOR, &eaten, &pidl, 0);
- if (result != NOERROR)
- return;
- */
- pidls.Add(&temp);
- }
-
- // Get the IContextMenu for the file.
- CMyComPtr<IContextMenu> cm;
- RINOK( parentFolder->GetUIObjectOf(GetParent(), pidls.Size(),
- (LPCITEMIDLIST *)&pidls.Front(), IID_IContextMenu, 0, (void**)&cm));
- if (!cm)
- {
- // ShowMessage("Unable to get context menu interface.");
- return E_FAIL;
- }
- systemContextMenu = cm;
- return S_OK;
-}
-
-void CPanel::CreateSystemMenu(HMENU menuSpec,
- const CRecordVector<UInt32> &operatedIndices,
- CMyComPtr<IContextMenu> &systemContextMenu)
-{
- systemContextMenu.Release();
-
- CreateShellContextMenu(operatedIndices, systemContextMenu);
-
- if (systemContextMenu == 0)
- return;
-
- // Set up a CMINVOKECOMMANDINFO structure.
- CMINVOKECOMMANDINFO ci;
- ZeroMemory(&ci, sizeof(ci));
- ci.cbSize = sizeof(CMINVOKECOMMANDINFO);
- ci.hwnd = GetParent();
-
- /*
- if (Sender == GoBtn)
- {
- // Verbs that can be used are cut, paste,
- // properties, delete, and so on.
- String action;
- if (CutRb->Checked)
- action = "cut";
- else if (CopyRb->Checked)
- action = "copy";
- else if (DeleteRb->Checked)
- action = "delete";
- else if (PropertiesRb->Checked)
- action = "properties";
-
- ci.lpVerb = action.c_str();
- result = cm->InvokeCommand(&ci);
- if (result)
- ShowMessage(
- "Error copying file to clipboard.");
-
- }
- else
- */
- {
- // HMENU hMenu = CreatePopupMenu();
- CMenu popupMenu;
- // CMenuDestroyer menuDestroyer(popupMenu);
- if(!popupMenu.CreatePopup())
- throw 210503;
-
- HMENU hMenu = popupMenu;
-
- DWORD Flags = CMF_EXPLORE;
- // Optionally the shell will show the extended
- // context menu on some operating systems when
- // the shift key is held down at the time the
- // context menu is invoked. The following is
- // commented out but you can uncommnent this
- // line to show the extended context menu.
- // Flags |= 0x00000080;
- systemContextMenu->QueryContextMenu(hMenu, 0, kSystemStartMenuID, 0x7FFF, Flags);
-
-
- {
- CMenu menu;
- menu.Attach(menuSpec);
- CMenuItem menuItem;
- menuItem.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_ID;
- menuItem.fType = MFT_STRING;
- menuItem.hSubMenu = popupMenu.Detach();
- // menuDestroyer.Disable();
- menuItem.StringValue = LangString(IDS_SYSTEM, 0x030202A0);
- menu.InsertItem(0, true, menuItem);
- }
- /*
- if (Cmd < 100 && Cmd != 0)
- {
- ci.lpVerb = MAKEINTRESOURCE(Cmd - 1);
- ci.lpParameters = "";
- ci.lpDirectory = "";
- ci.nShow = SW_SHOWNORMAL;
- cm->InvokeCommand(&ci);
- }
- // If Cmd is > 100 then it's one of our
- // inserted menu items.
- else
- // Find the menu item.
- for (int i = 0; i < popupMenu1->Items->Count; i++)
- {
- TMenuItem* menu = popupMenu1->Items->Items[i];
- // Call its OnClick handler.
- if (menu->Command == Cmd - 100)
- menu->OnClick(this);
- }
- // Release the memory allocated for the menu.
- DestroyMenu(hMenu);
- */
- }
-}
-
-void CPanel::CreateFileMenu(HMENU menuSpec)
-{
- CreateFileMenu(menuSpec, _sevenZipContextMenu, _systemContextMenu, true);
-}
-
-void CPanel::CreateSevenZipMenu(HMENU menuSpec,
- const CRecordVector<UInt32> &operatedIndices,
- CMyComPtr<IContextMenu> &sevenZipContextMenu)
-{
- sevenZipContextMenu.Release();
-
- CMenu menu;
- menu.Attach(menuSpec);
- // CMenuDestroyer menuDestroyer(menu);
- // menu.CreatePopup();
-
- bool sevenZipMenuCreated = false;
-
- CMyComPtr<IContextMenu> contextMenu;
- if (contextMenu.CoCreateInstance(CLSID_CZipContextMenu, IID_IContextMenu) == S_OK)
- {
- CMyComPtr<IInitContextMenu> initContextMenu;
- if (contextMenu.QueryInterface(IID_IInitContextMenu, &initContextMenu) != S_OK)
- return;
- UString currentFolderUnicode = _currentFolderPrefix;
- UStringVector names;
- int i;
- for(i = 0; i < operatedIndices.Size(); i++)
- names.Add(currentFolderUnicode + GetItemRelPath(operatedIndices[i]));
- CRecordVector<const wchar_t *> namePointers;
- for(i = 0; i < operatedIndices.Size(); i++)
- namePointers.Add(names[i]);
-
- // NFile::NDirectory::MySetCurrentDirectory(currentFolderUnicode);
- if (initContextMenu->InitContextMenu(currentFolderUnicode, &namePointers.Front(),
- operatedIndices.Size()) == S_OK)
- {
- HRESULT res = contextMenu->QueryContextMenu(menu, 0, kSevenZipStartMenuID,
- kSystemStartMenuID - 1, 0);
- sevenZipMenuCreated = (HRESULT_SEVERITY(res) == SEVERITY_SUCCESS);
- if (sevenZipMenuCreated)
- sevenZipContextMenu = contextMenu;
- // int code = HRESULT_CODE(res);
- // int nextItemID = code;
- }
- }
-}
-
-void CPanel::CreateFileMenu(HMENU menuSpec,
- CMyComPtr<IContextMenu> &sevenZipContextMenu,
- CMyComPtr<IContextMenu> &systemContextMenu,
- bool programMenu)
-{
- sevenZipContextMenu.Release();
- systemContextMenu.Release();
-
- CRecordVector<UInt32> operatedIndices;
- GetOperatedItemIndices(operatedIndices);
-
- CMenu menu;
- menu.Attach(menuSpec);
-
- CreateSevenZipMenu(menu, operatedIndices, sevenZipContextMenu);
- if (g_App.ShowSystemMenu)
- CreateSystemMenu(menu, operatedIndices, systemContextMenu);
-
- if (menu.GetItemCount() > 0)
- menu.AppendItem(MF_SEPARATOR, 0, (LPCTSTR)0);
-
- int i;
- for (i = 0; i < operatedIndices.Size(); i++)
- if (IsItemFolder(operatedIndices[i]))
- break;
- bool allAreFiles = (i == operatedIndices.Size());
- LoadFileMenu(menu, menu.GetItemCount(), programMenu,
- IsFSFolder(), operatedIndices.Size(), allAreFiles);
-}
-
-bool CPanel::InvokePluginCommand(int id)
-{
- return InvokePluginCommand(id, _sevenZipContextMenu, _systemContextMenu);
-}
-
-bool CPanel::InvokePluginCommand(int id,
- IContextMenu *sevenZipContextMenu, IContextMenu *systemContextMenu)
-{
- UInt32 offset;
- bool isSystemMenu = (id >= kSystemStartMenuID);
- if (isSystemMenu)
- offset = id - kSystemStartMenuID;
- else
- offset = id - kSevenZipStartMenuID;
-
- CMINVOKECOMMANDINFOEX commandInfo;
- commandInfo.cbSize = sizeof(commandInfo);
- commandInfo.fMask = CMIC_MASK_UNICODE;
- commandInfo.hwnd = GetParent();
- commandInfo.lpVerb = (LPCSTR)(MAKEINTRESOURCE(offset));
- commandInfo.lpParameters = NULL;
- CSysString currentFolderSys = GetSystemString(_currentFolderPrefix);
- commandInfo.lpDirectory = (LPCSTR)(LPCTSTR)(currentFolderSys);
- commandInfo.nShow = SW_SHOW;
- commandInfo.lpTitle = "";
- commandInfo.lpVerbW = (LPCWSTR)(MAKEINTRESOURCEW(offset));
- commandInfo.lpParameters = NULL;
- UString currentFolderUnicode = _currentFolderPrefix;
- commandInfo.lpDirectoryW = currentFolderUnicode;
- commandInfo.lpTitleW = L"";
- // commandInfo.ptInvoke.x = xPos;
- // commandInfo.ptInvoke.y = yPos;
- commandInfo.ptInvoke.x = 0;
- commandInfo.ptInvoke.y = 0;
- HRESULT result;
- if (isSystemMenu)
- result = systemContextMenu->InvokeCommand(LPCMINVOKECOMMANDINFO(&commandInfo));
- else
- result = sevenZipContextMenu->InvokeCommand(LPCMINVOKECOMMANDINFO(&commandInfo));
- if (result == NOERROR)
- {
- KillSelection();
- return true;
- }
- return false;
-}
-
-bool CPanel::OnContextMenu(HANDLE windowHandle, int xPos, int yPos)
-{
- if (windowHandle != _listView)
- return false;
- /*
- POINT point;
- point.x = xPos;
- point.y = yPos;
- if (!_listView.ScreenToClient(&point))
- return false;
-
- LVHITTESTINFO info;
- info.pt = point;
- int index = _listView.HitTest(&info);
- */
-
- CRecordVector<UInt32> operatedIndices;
- GetOperatedItemIndices(operatedIndices);
-
- if (xPos < 0 || yPos < 0)
- {
- if (operatedIndices.Size() == 0)
- {
- xPos = 0;
- yPos = 0;
- }
- else
- {
- int itemIndex = _listView.GetNextItem(-1, LVNI_FOCUSED);
- if (itemIndex == -1)
- return false;
- RECT rect;
- if (!_listView.GetItemRect(itemIndex, &rect, LVIR_ICON))
- return false;
- xPos = (rect.left + rect.right) / 2;
- yPos = (rect.top + rect.bottom) / 2;
- }
- POINT point = {xPos, yPos};
- _listView.ClientToScreen(&point);
- xPos = point.x;
- yPos = point.y;
- }
-
- CMenu menu;
- CMenuDestroyer menuDestroyer(menu);
- menu.CreatePopup();
-
- CMyComPtr<IContextMenu> sevenZipContextMenu;
- CMyComPtr<IContextMenu> systemContextMenu;
- CreateFileMenu(menu, sevenZipContextMenu, systemContextMenu, false);
-
- int result = menu.Track(TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY,
- xPos, yPos, _listView);
-
- if (result == 0)
- return true;
-
- if (result >= kPluginMenuStartID)
- {
- InvokePluginCommand(result, sevenZipContextMenu, systemContextMenu);
- return true;
- }
- if (ExecuteFileCommand(result))
- return true;
- return true;
-}
-#endif
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelOperations.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelOperations.cpp
deleted file mode 100644
index 5a0d052c4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelOperations.cpp
+++ /dev/null
@@ -1,470 +0,0 @@
-// PanelOperations.cpp
-
-#include "StdAfx.h"
-
-#include "resource.h"
-
-#include "Panel.h"
-
-#include "Common/StringConvert.h"
-#include "Common/DynamicBuffer.h"
-#include "Windows/FileDir.h"
-#include "Windows/ResourceString.h"
-#include "Windows/Thread.h"
-#include "Windows/COM.h"
-
-#include "ComboDialog.h"
-
-#include "FSFolder.h"
-#include "LangUtils.h"
-#include "FormatUtils.h"
-
-#include "UpdateCallback100.h"
-
-using namespace NWindows;
-using namespace NFile;
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-enum EFolderOpType
-{
- FOLDER_TYPE_CREATE_FOLDER = 0,
- FOLDER_TYPE_DELETE = 1,
- FOLDER_TYPE_RENAME = 2
-};
-
-struct CThreadFolderOperations
-{
- EFolderOpType OpType;
- UString Name;
- UInt32 Index;
- CRecordVector<UInt32> Indices;
-
- CMyComPtr<IFolderOperations> FolderOperations;
- CMyComPtr<IProgress> UpdateCallback;
- CUpdateCallback100Imp *UpdateCallbackSpec;
- HRESULT Result;
-
- CThreadFolderOperations(EFolderOpType opType);
-
- void Process()
- {
-#ifdef _WIN32
- NCOM::CComInitializer comInitializer;
-#endif
- UpdateCallbackSpec->ProgressDialog.WaitCreating();
-
- switch(OpType)
- {
- case FOLDER_TYPE_CREATE_FOLDER:
- Result = FolderOperations->CreateFolder(Name, UpdateCallback);
- break;
- case FOLDER_TYPE_DELETE:
- Result = FolderOperations->Delete(&Indices.Front(), Indices.Size(), UpdateCallback);
- break;
- case FOLDER_TYPE_RENAME:
- Result = FolderOperations->Rename(Index, Name, UpdateCallback);
- break;
- default:
- Result = E_FAIL;
- }
- UpdateCallbackSpec->ProgressDialog.MyClose();
- }
-
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- ((CThreadFolderOperations *)param)->Process();
- return 0;
- }
-};
-
-CThreadFolderOperations::CThreadFolderOperations(EFolderOpType opType): OpType(opType) {};
-
-static void DoOperation(CThreadFolderOperations &op, CPanel &panel, const UString &progressTitle)
-{
- op.UpdateCallbackSpec = new CUpdateCallback100Imp;
- op.UpdateCallback = op.UpdateCallbackSpec;
-
- bool usePassword = false;
- UString password;
- if (panel._parentFolders.Size() > 0)
- {
- const CFolderLink &fl = panel._parentFolders.Back();
- usePassword = fl.UsePassword;
- password = fl.Password;
- }
-
- op.UpdateCallbackSpec->Init(panel.GetParent(), usePassword, password);
-
- op.UpdateCallbackSpec->ProgressDialog.MainWindow = panel._mainWindow;
- op.UpdateCallbackSpec->ProgressDialog.MainTitle = LangString(IDS_APP_TITLE, 0x03000000);
- op.UpdateCallbackSpec->ProgressDialog.MainAddTitle = progressTitle + UString(L" ");
-
- // op.FolderOperations = folderOperations;
- // op.Index = realIndex;
- // op.Name = newName;
- // HRESULT result = folderOperations->Rename(realIndex, newName, 0);
-
- NWindows::CThread thread;
- if (thread.Create(CThreadFolderOperations::MyThreadFunction, &op) != S_OK)
- throw 271824;
- op.UpdateCallbackSpec->StartProgressDialog(progressTitle);
-}
-
-#ifndef _UNICODE
-typedef int (WINAPI * SHFileOperationWP)(LPSHFILEOPSTRUCTW lpFileOp);
-#endif
-
-void CPanel::DeleteItems(bool toRecycleBin)
-{
- CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
- CRecordVector<UInt32> indices;
- GetOperatedItemIndices(indices);
- if (indices.IsEmpty())
- return;
- CSelectedState state;
- SaveSelectedState(state);
- bool useInternalDelete = false;
- if (IsFSFolder() && toRecycleBin)
- {
- #ifndef _UNICODE
- if (!g_IsNT)
- {
- CDynamicBuffer<CHAR> buffer;
- size_t size = 0;
- for (int i = 0; i < indices.Size(); i++)
- {
- const AString path = GetSystemString(GetFsPath() + GetItemRelPath(indices[i]));
- buffer.EnsureCapacity(size + path.Length() + 1);
- memmove(((CHAR *)buffer) + size, (const CHAR *)path, (path.Length() + 1) * sizeof(CHAR));
- size += path.Length() + 1;
- }
- buffer.EnsureCapacity(size + 1);
- ((CHAR *)buffer)[size] = 0;
- SHFILEOPSTRUCTA fo;
- fo.hwnd = GetParent();
- fo.wFunc = FO_DELETE;
- fo.pFrom = (const CHAR *)buffer;
- fo.pTo = 0;
- fo.fFlags = 0;
- if (toRecycleBin)
- fo.fFlags |= FOF_ALLOWUNDO;
- // fo.fFlags |= FOF_NOCONFIRMATION;
- // fo.fFlags |= FOF_NOERRORUI;
- // fo.fFlags |= FOF_SILENT;
- // fo.fFlags |= FOF_WANTNUKEWARNING;
- fo.fAnyOperationsAborted = FALSE;
- fo.hNameMappings = 0;
- fo.lpszProgressTitle = 0;
- /* int res = */ ::SHFileOperationA(&fo);
- }
- else
- #endif
- {
- CDynamicBuffer<WCHAR> buffer;
- size_t size = 0;
- int maxLen = 0;
- for (int i = 0; i < indices.Size(); i++)
- {
- // L"\\\\?\\") doesn't work here.
- const UString path = GetFsPath() + GetItemRelPath(indices[i]);
- if (path.Length() > maxLen)
- maxLen = path.Length();
- buffer.EnsureCapacity(size + path.Length() + 1);
- memmove(((WCHAR *)buffer) + size, (const WCHAR *)path, (path.Length() + 1) * sizeof(WCHAR));
- size += path.Length() + 1;
- }
- buffer.EnsureCapacity(size + 1);
- ((WCHAR *)buffer)[size] = 0;
-#ifdef _WIN32
- if (maxLen >= MAX_PATH)
- {
- if (toRecycleBin)
- {
- MessageBoxErrorLang(IDS_ERROR_LONG_PATH_TO_RECYCLE, 0x03020218);
- return;
- }
- useInternalDelete = true;
- }
- else
- {
- SHFILEOPSTRUCTW fo;
- fo.hwnd = GetParent();
- fo.wFunc = FO_DELETE;
- fo.pFrom = (const WCHAR *)buffer;
- fo.pTo = 0;
- fo.fFlags = 0;
- if (toRecycleBin)
- fo.fFlags |= FOF_ALLOWUNDO;
- fo.fAnyOperationsAborted = FALSE;
- fo.hNameMappings = 0;
- fo.lpszProgressTitle = 0;
- int res;
- #ifdef _UNICODE
- res = ::SHFileOperationW(&fo);
- #else
- SHFileOperationWP shFileOperationW = (SHFileOperationWP)
- ::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHFileOperationW");
- if (shFileOperationW == 0)
- return;
- res = shFileOperationW(&fo);
- #endif
- }
-#else
- // FIXME - how to use the recycle bin undex Gnome or KDE ?
- useInternalDelete = true;
-#endif
- }
- /*
- if (fo.fAnyOperationsAborted)
- MessageBoxError(result, LangString(IDS_ERROR_DELETING, 0x03020217));
- */
- }
- else
- useInternalDelete = true;
- if (useInternalDelete)
- DeleteItemsInternal(indices);
- RefreshListCtrl(state);
-}
-
-void CPanel::DeleteItemsInternal(CRecordVector<UInt32> &indices)
-{
- CMyComPtr<IFolderOperations> folderOperations;
- if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
- {
- MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- return;
- }
-
- UString title;
- UString message;
- if (indices.Size() == 1)
- {
- int index = indices[0];
- const UString itemName = GetItemRelPath(index);
- if (IsItemFolder(index))
- {
- title = LangString(IDS_CONFIRM_FOLDER_DELETE, 0x03020211);
- message = MyFormatNew(IDS_WANT_TO_DELETE_FOLDER, 0x03020214, itemName);
- }
- else
- {
- title = LangString(IDS_CONFIRM_FILE_DELETE, 0x03020210);
- message = MyFormatNew(IDS_WANT_TO_DELETE_FILE, 0x03020213, itemName);
- }
- }
- else
- {
- title = LangString(IDS_CONFIRM_ITEMS_DELETE, 0x03020212);
- message = MyFormatNew(IDS_WANT_TO_DELETE_ITEMS, 0x03020215,
- NumberToString(indices.Size()));
- }
- if (::MessageBoxW(GetParent(), message, title, MB_OKCANCEL | MB_ICONQUESTION) != IDOK)
- return;
-
- {
- CThreadFolderOperations op(FOLDER_TYPE_DELETE);
- op.FolderOperations = folderOperations;
- op.Indices = indices;
- DoOperation(op, *this, LangString(IDS_DELETING, 0x03020216));
- if (op.Result != S_OK)
- MessageBoxError(op.Result, LangString(IDS_ERROR_DELETING, 0x03020217));
- }
- RefreshTitleAlways();
-}
-
-#ifdef _WIN32
-BOOL CPanel::OnBeginLabelEdit(LV_DISPINFOW * lpnmh)
-{
- int realIndex = GetRealIndex(lpnmh->item);
- if (realIndex == kParentIndex)
- return TRUE;
- CMyComPtr<IFolderOperations> folderOperations;
- if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
- return TRUE;
- return FALSE;
-}
-
-BOOL CPanel::OnEndLabelEdit(LV_DISPINFOW * lpnmh)
-{
- if (lpnmh->item.pszText == NULL)
- return FALSE;
- CMyComPtr<IFolderOperations> folderOperations;
- if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
- {
- MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- return FALSE;
- }
- const UString newName = lpnmh->item.pszText;
- CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
-
- SaveSelectedState(_selectedState);
-
- int realIndex = GetRealIndex(lpnmh->item);
- if (realIndex == kParentIndex)
- return FALSE;
- const UString prefix = GetItemPrefix(realIndex);
-
-
- {
- CThreadFolderOperations op(FOLDER_TYPE_RENAME);
- op.FolderOperations = folderOperations;
- op.Index = realIndex;
- op.Name = newName;
- DoOperation(op, *this, LangString(IDS_RENAMING, 0x03020220));
- if (op.Result != S_OK)
- {
- MessageBoxError(op.Result, LangString(IDS_ERROR_RENAMING, 0x03020221));
- return FALSE;
- }
- }
-
- // Can't use RefreshListCtrl here.
- // RefreshListCtrlSaveFocused();
- _selectedState.FocusedName = prefix + newName;
- _selectedState.SelectFocused = true;
-
- // We need clear all items to disable GetText before Reload:
- // number of items can change.
- // _listView.DeleteAllItems();
- // But seems it can still call GetText (maybe for current item)
- // so we can't delete items.
-
- _dontShowMode = true;
-
- PostMessage(kReLoadMessage);
- return TRUE;
-}
-#endif
-
-void CPanel::CreateFolder()
-{
- CMyComPtr<IFolderOperations> folderOperations;
- if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
- {
- MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- return;
- }
- CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
- CSelectedState state;
- SaveSelectedState(state);
- CComboDialog comboDialog;
- comboDialog.Title = LangString(IDS_CREATE_FOLDER, 0x03020230);
- comboDialog.Static = LangString(IDS_CREATE_FOLDER_NAME, 0x03020231);
- comboDialog.Value = LangString(IDS_CREATE_FOLDER_DEFAULT_NAME, /*0x03020232*/ (UInt32)-1);
- if (comboDialog.Create(GetParent()) == IDCANCEL)
- return;
-
- UString newName = comboDialog.Value;
-
- {
- CThreadFolderOperations op(FOLDER_TYPE_CREATE_FOLDER);
- op.FolderOperations = folderOperations;
- op.Name = newName;
- DoOperation(op, *this, LangString(IDS_CREATE_FOLDER, 0x03020230));
-
- if (op.Result != S_OK)
- {
- MessageBoxError(op.Result, LangString(IDS_CREATE_FOLDER_ERROR, 0x03020233));
- return;
- }
- }
- int pos = newName.Find(L'\\');
- if (pos >= 0)
- newName = newName.Left(pos);
- if (!_mySelectMode)
- state.SelectedNames.Clear();
- state.FocusedName = newName;
- state.SelectFocused = true;
- RefreshTitleAlways();
- RefreshListCtrl(state);
-}
-
-void CPanel::CreateFile()
-{
- CMyComPtr<IFolderOperations> folderOperations;
- if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
- {
- MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- return;
- }
- CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
- CSelectedState state;
- SaveSelectedState(state);
- CComboDialog comboDialog;
- comboDialog.Title = LangString(IDS_CREATE_FILE, 0x03020240);
- comboDialog.Static = LangString(IDS_CREATE_FILE_NAME, 0x03020241);
- comboDialog.Value = LangString(IDS_CREATE_FILE_DEFAULT_NAME, /*0x03020242*/ (UInt32)-1);
- if (comboDialog.Create(GetParent()) == IDCANCEL)
- return;
- UString newName = comboDialog.Value;
- HRESULT result = folderOperations->CreateFile(newName, 0);
- if (result != S_OK)
- {
- MessageBoxError(result, LangString(IDS_CREATE_FILE_ERROR, 0x03020243));
- return;
- }
- int pos = newName.Find(L'\\');
- if (pos >= 0)
- newName = newName.Left(pos);
- if (!_mySelectMode)
- state.SelectedNames.Clear();
- state.FocusedName = newName;
- state.SelectFocused = true;
- RefreshListCtrl(state);
-}
-
-void CPanel::RenameFile()
-{
- int index = _listView.GetFocusedItem();
- if (index >= 0)
- _listView.EditLabel(index);
-}
-
-void CPanel::ChangeComment()
-{
- CPanel::CDisableTimerProcessing disableTimerProcessing2(*this);
- int index = _listView.GetFocusedItem();
- if (index < 0)
- return;
- int realIndex = GetRealItemIndex(index);
- if (realIndex == kParentIndex)
- return;
- CSelectedState state;
- SaveSelectedState(state);
- CMyComPtr<IFolderOperations> folderOperations;
- if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK)
- {
- MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- return;
- }
-
- UString comment;
- {
- NCOM::CPropVariant propVariant;
- if (_folder->GetProperty(realIndex, kpidComment, &propVariant) != S_OK)
- return;
- if (propVariant.vt == VT_BSTR)
- comment = propVariant.bstrVal;
- else if (propVariant.vt != VT_EMPTY)
- return;
- }
- UString name = GetItemRelPath(realIndex);
- CComboDialog comboDialog;
- comboDialog.Title = name + L" " + LangString(IDS_COMMENT, 0x03020290);
- comboDialog.Value = comment;
- comboDialog.Static = LangString(IDS_COMMENT2, 0x03020291);
- if (comboDialog.Create(GetParent()) == IDCANCEL)
- return;
- NCOM::CPropVariant propVariant(comboDialog.Value);
-
- HRESULT result = folderOperations->SetProperty(realIndex, kpidComment, &propVariant, NULL);
- if (result != S_OK)
- {
- MessageBoxError(result, L"Set Comment Error");
- }
- RefreshListCtrl(state);
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelSelect.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelSelect.cpp
deleted file mode 100644
index 0e2423003..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelSelect.cpp
+++ /dev/null
@@ -1,305 +0,0 @@
-// PanelSelect.cpp
-
-#include "StdAfx.h"
-
-#include "resource.h"
-
-#include "Common/StringConvert.h"
-#include "Common/Wildcard.h"
-
-#include "Panel.h"
-
-#include "ComboDialog.h"
-
-#include "LangUtils.h"
-
-void CPanel::OnShiftSelectMessage()
-{
- if (!_mySelectMode)
- return;
- int focusedItem = _listView.GetFocusedItem();
- if (focusedItem < 0)
- return;
- if (!_selectionIsDefined)
- return;
- int startItem = MyMin(focusedItem, _prevFocusedItem);
- int finishItem = MyMax(focusedItem, _prevFocusedItem);
- for (int i = 0; i < _listView.GetItemCount(); i++)
- {
- int realIndex = GetRealItemIndex(i);
- if (realIndex == kParentIndex)
- continue;
- if (i >= startItem && i <= finishItem)
- if (_selectedStatusVector[realIndex] != _selectMark)
- {
- _selectedStatusVector[realIndex] = _selectMark;
- _listView.RedrawItem(i);
- }
- }
- _prevFocusedItem = focusedItem;
-}
-
-#ifdef _WIN32
-void CPanel::OnArrowWithShift()
-{
- if (!_mySelectMode)
- return;
- int focusedItem = _listView.GetFocusedItem();
- if (focusedItem < 0)
- return;
- int realIndex = GetRealItemIndex(focusedItem);
- if (_selectionIsDefined)
- {
- if (realIndex != kParentIndex)
- _selectedStatusVector[realIndex] = _selectMark;
- }
- else
- {
- if (realIndex == kParentIndex)
- {
- _selectionIsDefined = true;
- _selectMark = true;
- }
- else
- {
- _selectionIsDefined = true;
- _selectMark = !_selectedStatusVector[realIndex];
- _selectedStatusVector[realIndex] = _selectMark;
- }
- }
- _prevFocusedItem = focusedItem;
- PostMessage(kShiftSelectMessage);
- _listView.RedrawItem(focusedItem);
-}
-
-void CPanel::OnInsert()
-{
- /*
- const int kState = CDIS_MARKED; // LVIS_DROPHILITED;
- UINT state = (_listView.GetItemState(focusedItem, LVIS_CUT) == 0) ?
- LVIS_CUT : 0;
- _listView.SetItemState(focusedItem, state, LVIS_CUT);
- // _listView.SetItemState(focusedItem, LVIS_SELECTED, LVIS_SELECTED);
-
- */
- int focusedItem = _listView.GetFocusedItem();
- if (focusedItem < 0)
- return;
- int realIndex = GetRealItemIndex(focusedItem);
- bool isSelected = !_selectedStatusVector[realIndex];
- if (realIndex != kParentIndex)
- _selectedStatusVector[realIndex] = isSelected;
-
- if (!_mySelectMode)
- _listView.SetItemState(focusedItem, isSelected ? LVIS_SELECTED: 0, LVIS_SELECTED);
-
- _listView.RedrawItem(focusedItem);
-
- int nextIndex = focusedItem + 1;
- if (nextIndex < _listView.GetItemCount())
- {
- _listView.SetItemState(nextIndex, LVIS_FOCUSED | LVIS_SELECTED,
- LVIS_FOCUSED | LVIS_SELECTED);
- _listView.EnsureVisible(nextIndex, false);
- }
-}
-#endif // _WIN32
-
-/*
-void CPanel::OnUpWithShift()
-{
- int focusedItem = _listView.GetFocusedItem();
- if (focusedItem < 0)
- return;
- int index = GetRealItemIndex(focusedItem);
- _selectedStatusVector[index] = !_selectedStatusVector[index];
- _listView.RedrawItem(index);
-}
-
-void CPanel::OnDownWithShift()
-{
- int focusedItem = _listView.GetFocusedItem();
- if (focusedItem < 0)
- return;
- int index = GetRealItemIndex(focusedItem);
- _selectedStatusVector[index] = !_selectedStatusVector[index];
- _listView.RedrawItem(index);
-}
-*/
-
-void CPanel::UpdateSelection()
-{
-printf("CPanel::UpdateSelection : _mySelectMode=%d\n",(int)_mySelectMode);
- if (!_mySelectMode)
- {
- bool enableTemp = _enableItemChangeNotify;
- _enableItemChangeNotify = false;
- int numItems = _listView.GetItemCount();
-printf("CPanel::UpdateSelection : numItems=%d\n",(int)numItems);
- for (int i = 0; i < numItems; i++)
- {
- int realIndex = GetRealItemIndex(i);
- if (realIndex != kParentIndex)
- {
- UINT value = 0;
- value = _selectedStatusVector[realIndex] ? LVIS_SELECTED: 0;
-printf("CPanel::UpdateSelection : SetItemState(%d,%d,LVIS_SELECTED)\n",(int)i,(unsigned)value);
- _listView.SetItemState(i, value, LVIS_SELECTED);
- }
- }
- _enableItemChangeNotify = enableTemp;
- }
- _listView.RedrawAllItems();
-}
-
-
-void CPanel::SelectSpec(bool selectMode)
-{
- CComboDialog comboDialog;
- comboDialog.Title = selectMode ?
- LangString(IDS_SELECT, 0x03020250):
- LangString(IDS_DESELECT, 0x03020251);
- comboDialog.Static = LangString(IDS_SELECT_MASK, 0x03020252);
- comboDialog.Value = L"*";
- if (comboDialog.Create(GetParent()) == IDCANCEL)
- return;
- const UString &mask = comboDialog.Value;
- for (int i = 0; i < _selectedStatusVector.Size(); i++)
- if (CompareWildCardWithName(mask, GetItemName(i)))
- _selectedStatusVector[i] = selectMode;
- UpdateSelection();
-}
-
-void CPanel::SelectByType(bool selectMode)
-{
- int focusedItem = _listView.GetFocusedItem();
- if (focusedItem < 0)
- return;
- int realIndex = GetRealItemIndex(focusedItem);
- UString name = GetItemName(realIndex);
- bool isItemFolder = IsItemFolder(realIndex);
-
- /*
- UINT32 numItems;
- _folder->GetNumberOfItems(&numItems);
- if ((UInt32)_selectedStatusVector.Size() != numItems)
- throw 11111;
- */
-
- if (isItemFolder)
- {
- for (int i = 0; i < _selectedStatusVector.Size(); i++)
- if (IsItemFolder(i) == isItemFolder)
- _selectedStatusVector[i] = selectMode;
- }
- else
- {
- int pos = name.ReverseFind(L'.');
- if (pos < 0)
- {
- for (int i = 0; i < _selectedStatusVector.Size(); i++)
- if (IsItemFolder(i) == isItemFolder && GetItemName(i).ReverseFind(L'.') < 0)
- _selectedStatusVector[i] = selectMode;
- }
- else
- {
- UString mask = UString(L'*') + name.Mid(pos);
- for (int i = 0; i < _selectedStatusVector.Size(); i++)
- if (IsItemFolder(i) == isItemFolder && CompareWildCardWithName(mask, GetItemName(i)))
- _selectedStatusVector[i] = selectMode;
- }
- }
- UpdateSelection();
-}
-
-void CPanel::SelectAll(bool selectMode)
-{
- for (int i = 0; i < _selectedStatusVector.Size(); i++)
- _selectedStatusVector[i] = selectMode;
- UpdateSelection();
-}
-
-void CPanel::InvertSelection()
-{
- if (!_mySelectMode)
- {
- int numSelected = 0;
- for (int i = 0; i < _selectedStatusVector.Size(); i++)
- if (_selectedStatusVector[i])
- numSelected++;
- if (numSelected == 1)
- {
- int focused = _listView.GetFocusedItem();
- if (focused >= 0)
- {
- int realIndex = GetRealItemIndex(focused);
- if (realIndex >= 0)
- if (_selectedStatusVector[realIndex])
- _selectedStatusVector[realIndex] = false;
- }
- }
- }
- for (int i = 0; i < _selectedStatusVector.Size(); i++)
- _selectedStatusVector[i] = !_selectedStatusVector[i];
- UpdateSelection();
-}
-
-void CPanel::KillSelection()
-{
- SelectAll(false);
- if (!_mySelectMode)
- {
- int focused = _listView.GetFocusedItem();
- if (focused >= 0)
- _listView.SetItemState(focused, LVIS_SELECTED, LVIS_SELECTED);
- }
-}
-
-#ifdef _WIN32
-void CPanel::OnLeftClick(LPNMITEMACTIVATE itemActivate)
-{
- if(itemActivate->hdr.hwndFrom != HWND(_listView))
- return;
- // It will be work only for Version 4.71 (IE 4);
- int indexInList = itemActivate->iItem;
- if (indexInList < 0)
- return;
- if ((itemActivate->uKeyFlags & LVKF_SHIFT) != 0)
- {
- // int focusedIndex = _listView.GetFocusedItem();
- int focusedIndex = _startGroupSelect;
- if (focusedIndex < 0)
- return;
- int startItem = MyMin(focusedIndex, indexInList);
- int finishItem = MyMax(focusedIndex, indexInList);
- for (int i = 0; i < _selectedStatusVector.Size(); i++)
- {
- int realIndex = GetRealItemIndex(i);
- if (realIndex == kParentIndex)
- continue;
- bool selected = (i >= startItem && i <= finishItem);
- if (_selectedStatusVector[realIndex] != selected)
- {
- _selectedStatusVector[realIndex] = selected;
- _listView.RedrawItem(i);
- }
- }
- }
- else
- {
- _startGroupSelect = indexInList;
- if ((itemActivate->uKeyFlags & LVKF_CONTROL) != 0)
- {
- int realIndex = GetRealItemIndex(indexInList);
- if (realIndex != kParentIndex)
- {
- _selectedStatusVector[realIndex] = !_selectedStatusVector[realIndex];
- _listView.RedrawItem(indexInList);
- }
- }
- }
- return;
-}
-#endif
-
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelSort.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelSort.cpp
deleted file mode 100644
index 5a8f87556..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelSort.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-// PanelSort.cpp
-
-#include "StdAfx.h"
-
-#include "Windows/PropVariant.h"
-
-#include "../../PropID.h"
-
-#include "Panel.h"
-
-using namespace NWindows;
-
-static UString GetExtension(const UString &name)
-{
- int dotPos = name.ReverseFind(L'.');
- if (dotPos < 0)
- return UString();
- return name.Mid(dotPos);
-}
-
-int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
-{
- if (lpData == 0) // FIXME NULL)
- return 0;
- CPanel *panel = (CPanel*)lpData;
-
- switch(panel->_sortID)
- {
- // if (panel->_sortIndex == 0)
- case kpidName:
- {
- const UString name1 = panel->GetItemName((int)lParam1);
- const UString name2 = panel->GetItemName((int)lParam2);
- int res = name1.CompareNoCase(name2);
- /*
- if (res != 0 || !panel->_flatMode)
- return res;
- const UString prefix1 = panel->GetItemPrefix(lParam1);
- const UString prefix2 = panel->GetItemPrefix(lParam2);
- return res = prefix1.CompareNoCase(prefix2);
- */
- return res;
- }
- case kpidNoProperty:
- {
- return MyCompare(lParam1, lParam2);
- }
- case kpidExtension:
- {
- const UString ext1 = GetExtension(panel->GetItemName((int)lParam1));
- const UString ext2 = GetExtension(panel->GetItemName((int)lParam2));
- return ext1.CompareNoCase(ext2);
- }
- }
- /*
- if (panel->_sortIndex == 1)
- return MyCompare(file1.Size, file2.Size);
- return ::CompareFileTime(&file1.MTime, &file2.MTime);
- */
-
- // PROPID propID = panel->_properties[panel->_sortIndex].ID;
- PROPID propID = panel->_sortID;
-
- NCOM::CPropVariant propVariant1, propVariant2;
- // Name must be first property
- panel->_folder->GetProperty((UINT32)lParam1, propID, &propVariant1);
- panel->_folder->GetProperty((UINT32)lParam2, propID, &propVariant2);
- if (propVariant1.vt != propVariant2.vt)
- return 0; // It means some BUG
- if (propVariant1.vt == VT_BSTR)
- {
-#ifdef _WIN32
- return _wcsicmp(propVariant1.bstrVal, propVariant2.bstrVal);
-#else
- return wcscmp(propVariant1.bstrVal, propVariant2.bstrVal); // FIXME _wcsicmp ?
-#endif
- }
- return propVariant1.Compare(propVariant2);
- // return 0;
-}
-
-int CALLBACK CompareItems(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
-{
- if (lpData == 0) // FIXME NULL)
- return 0;
- if (lParam1 == kParentIndex) return -1;
- if (lParam2 == kParentIndex) return 1;
-
- CPanel *panel = (CPanel*)lpData;
-
- bool isDir1 = panel->IsItemFolder((int)lParam1);
- bool isDir2 = panel->IsItemFolder((int)lParam2);
-
- if (isDir1 && !isDir2) return -1;
- if (isDir2 && !isDir1) return 1;
-
- int result = CompareItems2(lParam1, lParam2, lpData);
- return panel->_ascending ? result: (-result);
-}
-
-
-/*
-void CPanel::SortItems(int index)
-{
- if (index == _sortIndex)
- _ascending = !_ascending;
- else
- {
- _sortIndex = index;
- _ascending = true;
- switch (_properties[_sortIndex].ID)
- {
- case kpidSize:
- case kpidPackedSize:
- case kpidCTime:
- case kpidATime:
- case kpidMTime:
- _ascending = false;
- break;
- }
- }
- _listView.SortItems(CompareItems, (LPARAM)this);
- _listView.EnsureVisible(_listView.GetFocusedItem(), false);
-}
-void CPanel::SortItemsWithPropID(PROPID propID)
-{
- int index = _properties.FindItemWithID(propID);
- if (index >= 0)
- SortItems(index);
-}
-*/
-void CPanel::SortItemsWithPropID(PROPID propID)
-{
- if (propID == _sortID)
- _ascending = !_ascending;
- else
- {
- _sortID = propID;
- _ascending = true;
- switch (propID)
- {
- case kpidSize:
- case kpidPackSize:
- case kpidCTime:
- case kpidATime:
- case kpidMTime:
- _ascending = false;
- break;
- }
- }
- _listView.SortItems(CompareItems, (LPARAM)this);
- _listView.EnsureVisible(_listView.GetFocusedItem(), false);
-}
-
-
-void CPanel::OnColumnClick(LPNMLISTVIEW info)
-{
- /*
- int index = _properties.FindItemWithID(_visibleProperties[info->iSubItem].ID);
- SortItems(index);
- */
- SortItemsWithPropID(_visibleProperties[info->iSubItem].ID);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelSplitFile.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelSplitFile.cpp
deleted file mode 100644
index 36146d7a4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PanelSplitFile.cpp
+++ /dev/null
@@ -1,528 +0,0 @@
-// PanelSplitFile.cpp
-
-#include "StdAfx.h"
-
-#include "resource.h"
-
-extern "C"
-{
- #include "../../../../C/Alloc.h"
-}
-
-#include "Common/Types.h"
-#include "Common/IntToString.h"
-
-// #include "Windows/COM.h"
-#include "Windows/FileIO.h"
-#include "Windows/FileFind.h"
-#include "Windows/Thread.h"
-#include "ProgressDialog2.h"
-#include "SplitDialog.h"
-#include "CopyDialog.h"
-
-#include "../GUI/ExtractRes.h"
-
-#include "SplitUtils.h"
-#include "App.h"
-#include "FormatUtils.h"
-#include "LangUtils.h"
-
-using namespace NWindows;
-
-class CMyBuffer
-{
- void *_data;
-public:
- CMyBuffer(): _data(0) {}
- operator void *() { return _data; }
- bool Allocate(size_t size)
- {
- if (_data != 0)
- return false;
- _data = ::MidAlloc(size);
- return _data != 0;
- }
- ~CMyBuffer() { ::MidFree(_data); }
-};
-
-struct CVolSeqName
-{
- UString UnchangedPart;
- UString ChangedPart;
- CVolSeqName(): ChangedPart(L"000") {};
-
- bool ParseName(const UString &name)
- {
- if (name.Right(2) != L"01")
- return false;
- int numLetters = 2;
- while (numLetters < name.Length())
- {
- if (name[name.Length() - numLetters - 1] != '0')
- break;
- numLetters++;
- }
- UnchangedPart = name.Left(name.Length() - numLetters);
- ChangedPart = name.Right(numLetters);
- return true;
- }
-
- UString GetNextName()
- {
- UString newName;
- int i;
- int numLetters = ChangedPart.Length();
- for (i = numLetters - 1; i >= 0; i--)
- {
- wchar_t c = ChangedPart[i];
- if (c == L'9')
- {
- c = L'0';
- newName = c + newName;
- if (i == 0)
- newName = UString(L'1') + newName;
- continue;
- }
- c++;
- newName = c + newName;
- i--;
- for (; i >= 0; i--)
- newName = ChangedPart[i] + newName;
- break;
- }
- ChangedPart = newName;
- return UnchangedPart + ChangedPart;
- }
-};
-
-static const UInt32 kBufSize = (1 << 20);
-
-struct CThreadSplit
-{
- // HRESULT Result;
- // CPanel *Panel;
- CProgressDialog *ProgressDialog;
- UString FilePath;
- UString VolBasePath;
- CRecordVector<UInt64> VolumeSizes;
- UString Error;
-
- void Process2()
- {
- // NCOM::CComInitializer comInitializer;
- ProgressDialog->WaitCreating();
- NFile::NIO::CInFile inFile;
- if (!inFile.Open(FilePath))
- throw L"Can not open file";
- NFile::NIO::COutFile outFile;
- CMyBuffer bufferObject;
- if (!bufferObject.Allocate(kBufSize))
- throw L"Can not allocate buffer";
- Byte *buffer = (Byte *)(void *)bufferObject;
- UInt64 curVolSize = 0;
- CVolSeqName seqName;
- UInt64 length;
- if (!inFile.GetLength(length))
- throw "error";
-
- ProgressDialog->ProgressSynch.SetProgress(length, 0);
- UInt64 pos = 0;
-
- int volIndex = 0;
-
- for (;;)
- {
- UInt64 volSize;
- if (volIndex < VolumeSizes.Size())
- volSize = VolumeSizes[volIndex];
- else
- volSize = VolumeSizes.Back();
-
- UInt32 needSize = (UInt32)(MyMin((UInt64)kBufSize, volSize - curVolSize));
- UInt32 processedSize;
- if (!inFile.Read(buffer, needSize, processedSize))
- throw L"Can not read input file";
- if (processedSize == 0)
- break;
- needSize = processedSize;
- if (curVolSize == 0)
- {
- UString name = VolBasePath;
- name += L".";
- name += seqName.GetNextName();
- if (!outFile.Create(name, false))
- throw L"Can not create output file";
- ProgressDialog->ProgressSynch.SetCurrentFileName(name);
- }
- if (!outFile.Write(buffer, needSize, processedSize))
- throw L"Can not write output file";
- if (needSize != processedSize)
- throw L"Can not write output file";
- curVolSize += processedSize;
- if (curVolSize == volSize)
- {
- outFile.Close();
- if (volIndex < VolumeSizes.Size())
- volIndex++;
- curVolSize = 0;
- }
- pos += processedSize;
- HRESULT res = ProgressDialog->ProgressSynch.SetPosAndCheckPaused(pos);
- if (res != S_OK)
- return;
- }
- }
- void Process()
- {
- try { Process2(); }
- catch(const wchar_t *s) { Error = s; }
- catch(...) { Error = L"Error"; }
- ProgressDialog->MyClose();
- }
-
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- ((CThreadSplit *)param)->Process();
- return 0;
- }
-};
-
-void CApp::Split()
-{
- int srcPanelIndex = GetFocusedPanelIndex();
- CPanel &srcPanel = Panels[srcPanelIndex];
- if (!srcPanel.IsFSFolder())
- {
- srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- return;
- }
- CRecordVector<UInt32> indices;
- srcPanel.GetOperatedItemIndices(indices);
- if (indices.IsEmpty())
- return;
- if (indices.Size() != 1)
- {
- srcPanel.MessageBoxErrorLang(IDS_SELECT_ONE_FILE, 0x03020A02);
- return;
- }
- int index = indices[0];
- if (srcPanel.IsItemFolder(index))
- {
- srcPanel.MessageBoxErrorLang(IDS_SELECT_ONE_FILE, 0x03020A02);
- return;
- }
- const UString itemName = srcPanel.GetItemName(index);
-
- UString srcPath = srcPanel._currentFolderPrefix + srcPanel.GetItemPrefix(index);
- UString path = srcPath;
- int destPanelIndex = (NumPanels <= 1) ? srcPanelIndex : (1 - srcPanelIndex);
- CPanel &destPanel = Panels[destPanelIndex];
- if (NumPanels > 1)
- if (destPanel.IsFSFolder())
- path = destPanel._currentFolderPrefix;
- CSplitDialog splitDialog;
- splitDialog.FilePath = srcPanel.GetItemRelPath(index);
- splitDialog.Path = path;
- if (splitDialog.Create(srcPanel.GetParent()) == IDCANCEL)
- return;
-
- NFile::NFind::CFileInfoW fileInfo;
- if (!NFile::NFind::FindFile(srcPath + itemName, fileInfo))
- {
- srcPanel.MessageBoxMyError(L"Can not find file");
- return;
- }
- if (fileInfo.Size <= splitDialog.VolumeSizes.Front())
- {
- srcPanel.MessageBoxErrorLang(IDS_SPLIT_VOL_MUST_BE_SMALLER, 0x03020522);
- return;
- }
- const UInt64 numVolumes = GetNumberOfVolumes(fileInfo.Size, splitDialog.VolumeSizes);
- if (numVolumes >= 100)
- {
- wchar_t s[32];
- ConvertUInt64ToString(numVolumes, s);
- if (::MessageBoxW(srcPanel, MyFormatNew(IDS_SPLIT_CONFIRM_MESSAGE, 0x03020521, s),
- LangString(IDS_SPLIT_CONFIRM_TITLE, 0x03020520),
- MB_YESNOCANCEL | MB_ICONQUESTION | MB_TASKMODAL) != IDYES)
- return;
- }
-
- path = splitDialog.Path;
- NFile::NName::NormalizeDirPathPrefix(path);
- if (!NFile::NDirectory::CreateComplexDirectory(path))
- {
- srcPanel.MessageBoxMyError(MyFormatNew(IDS_CANNOT_CREATE_FOLDER, 0x02000603, path));
- return;
- }
-
- CThreadSplit spliter;
- // spliter.Panel = this;
-
- {
- CProgressDialog progressDialog;
- spliter.ProgressDialog = &progressDialog;
-
- UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
- UString title = LangString(IDS_SPLITTING, 0x03020510);
-
- progressDialog.MainWindow = _window;
- progressDialog.MainTitle = progressWindowTitle;
- progressDialog.MainAddTitle = title + UString(L" ");
- progressDialog.ProgressSynch.SetTitleFileName(itemName);
-
-
- spliter.FilePath = srcPath + itemName;
- spliter.VolBasePath = path + itemName;
- spliter.VolumeSizes = splitDialog.VolumeSizes;
-
- // if (splitDialog.VolumeSizes.Size() == 0) return;
-
- // CPanel::CDisableTimerProcessing disableTimerProcessing1(srcPanel);
- // CPanel::CDisableTimerProcessing disableTimerProcessing2(destPanel);
-
- NWindows::CThread thread;
- if (thread.Create(CThreadSplit::MyThreadFunction, &spliter) != S_OK)
- throw 271824;
- progressDialog.Create(title, _window);
- }
- RefreshTitleAlways();
-
-
- if (!spliter.Error.IsEmpty())
- srcPanel.MessageBoxMyError(spliter.Error);
- // disableTimerProcessing1.Restore();
- // disableTimerProcessing2.Restore();
- // srcPanel.SetFocusToList();
- // srcPanel.RefreshListCtrlSaveFocused();
-}
-
-
-struct CThreadCombine
-{
- CProgressDialog *ProgressDialog;
-
- UString InputDirPrefix;
- UStringVector Names;
- UString OutputPath;
- UInt64 TotalSize;
-
- UString Error;
- HRESULT Res;
-
- void Process2()
- {
- NFile::NIO::COutFile outFile;
- if (!outFile.Create(OutputPath, false))
- {
- Error = L"Can create open output file:\n" + OutputPath;
- return;
- }
-
- ProgressDialog->ProgressSynch.SetProgress(TotalSize, 0);
-
- CMyBuffer bufferObject;
- if (!bufferObject.Allocate(kBufSize))
- throw L"Can not allocate buffer";
- Byte *buffer = (Byte *)(void *)bufferObject;
- UInt64 pos = 0;
- for (int i = 0; i < Names.Size(); i++)
- {
- NFile::NIO::CInFile inFile;
- const UString nextName = InputDirPrefix + Names[i];
- if (!inFile.Open(nextName))
- {
- Error = L"Can not open input file:\n" + nextName;
- return;
- }
- ProgressDialog->ProgressSynch.SetCurrentFileName(nextName);
- for (;;)
- {
- UInt32 processedSize;
- if (!inFile.Read(buffer, kBufSize, processedSize))
- throw L"Can not read input file";
- if (processedSize == 0)
- break;
- UInt32 needSize = processedSize;
- if (!outFile.Write(buffer, needSize, processedSize) || needSize != processedSize)
- throw L"Can not write output file";
- pos += processedSize;
- Res = ProgressDialog->ProgressSynch.SetPosAndCheckPaused(pos);
- if (Res != S_OK)
- return;
- }
- }
- }
-
- void Process()
- {
- Res = S_OK;
- ProgressDialog->WaitCreating();
- try { Process2(); }
- catch(const wchar_t *s) { Error = s; }
- catch(...) { Error = L"Error";}
- ProgressDialog->MyClose();
- }
-
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- ((CThreadCombine *)param)->Process();
- return 0;
- }
-};
-
-extern void AddValuePair2(UINT resourceID, UInt32 langID, UInt64 num, UInt64 size, UString &s);
-
-static void AddInfoFileName(const UString &name, UString &dest)
-{
- dest += L"\n ";
- dest += name;
-}
-
-void CApp::Combine()
-{
- int srcPanelIndex = GetFocusedPanelIndex();
- CPanel &srcPanel = Panels[srcPanelIndex];
- if (!srcPanel.IsFSFolder())
- {
- srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
- return;
- }
- CRecordVector<UInt32> indices;
- srcPanel.GetOperatedItemIndices(indices);
- if (indices.IsEmpty())
- return;
- int index = indices[0];
- if (indices.Size() != 1 || srcPanel.IsItemFolder(index))
- {
- srcPanel.MessageBoxErrorLang(IDS_COMBINE_SELECT_ONE_FILE, 0x03020620);
- return;
- }
- const UString itemName = srcPanel.GetItemName(index);
-
- UString srcPath = srcPanel._currentFolderPrefix + srcPanel.GetItemPrefix(index);
- UString path = srcPath;
- int destPanelIndex = (NumPanels <= 1) ? srcPanelIndex : (1 - srcPanelIndex);
- CPanel &destPanel = Panels[destPanelIndex];
- if (NumPanels > 1)
- if (destPanel.IsFSFolder())
- path = destPanel._currentFolderPrefix;
-
- CVolSeqName volSeqName;
- if (!volSeqName.ParseName(itemName))
- {
- srcPanel.MessageBoxErrorLang(IDS_COMBINE_CANT_DETECT_SPLIT_FILE, 0x03020621);
- return;
- }
-
- CThreadCombine combiner;
-
- UString nextName = itemName;
- combiner.TotalSize = 0;
- for (;;)
- {
- NFile::NFind::CFileInfoW fileInfo;
- if (!NFile::NFind::FindFile(srcPath + nextName, fileInfo) || fileInfo.IsDir())
- break;
- combiner.Names.Add(nextName);
- combiner.TotalSize += fileInfo.Size;
- nextName = volSeqName.GetNextName();
- }
- if (combiner.Names.Size() == 1)
- {
- srcPanel.MessageBoxErrorLang(IDS_COMBINE_CANT_FIND_MORE_THAN_ONE_PART, 0x03020622);
- return;
- }
-
- if (combiner.TotalSize == 0)
- {
- srcPanel.MessageBoxMyError(L"No data");
- return;
- }
-
- UString info;
- AddValuePair2(IDS_FILES_COLON, 0x02000320, combiner.Names.Size(), combiner.TotalSize, info);
-
- info += L"\n";
- info += srcPath;
-
- int i;
- for (i = 0; i < combiner.Names.Size() && i < 2; i++)
- AddInfoFileName(combiner.Names[i], info);
- if (i != combiner.Names.Size())
- {
- if (i + 1 != combiner.Names.Size())
- AddInfoFileName(L"...", info);
- AddInfoFileName(combiner.Names.Back(), info);
- }
-
- {
- CCopyDialog copyDialog;
- copyDialog.Value = path;
- copyDialog.Title = LangString(IDS_COMBINE, 0x03020600);
- copyDialog.Title += ' ';
- copyDialog.Title += srcPanel.GetItemRelPath(index);
- copyDialog.Static = LangString(IDS_COMBINE_TO, 0x03020601);
- copyDialog.Info = info;
- if (copyDialog.Create(srcPanel.GetParent()) == IDCANCEL)
- return;
- path = copyDialog.Value;
- }
-
- NFile::NName::NormalizeDirPathPrefix(path);
- if (!NFile::NDirectory::CreateComplexDirectory(path))
- {
- srcPanel.MessageBoxMyError(MyFormatNew(IDS_CANNOT_CREATE_FOLDER, 0x02000603, path));
- return;
- }
-
- UString outName = volSeqName.UnchangedPart;
- while (!outName.IsEmpty())
- {
- int lastIndex = outName.Length() - 1;
- if (outName[lastIndex] != L'.')
- break;
- outName.Delete(lastIndex);
- }
- if (outName.IsEmpty())
- outName = L"file";
-
- NFile::NFind::CFileInfoW fileInfo;
- UString destFilePath = path + outName;
- combiner.OutputPath = destFilePath;
- if (NFile::NFind::FindFile(destFilePath, fileInfo))
- {
- srcPanel.MessageBoxMyError(MyFormatNew(IDS_FILE_EXIST, 0x03020A04, destFilePath));
- return;
- }
-
- {
- CProgressDialog progressDialog;
- combiner.ProgressDialog = &progressDialog;
-
- UString progressWindowTitle = LangString(IDS_APP_TITLE, 0x03000000);
- UString title = LangString(IDS_COMBINING, 0x03020610);
-
- progressDialog.MainWindow = _window;
- progressDialog.MainTitle = progressWindowTitle;
- progressDialog.MainAddTitle = title + UString(L" ");
-
- combiner.InputDirPrefix = srcPath;
-
- // CPanel::CDisableTimerProcessing disableTimerProcessing1(srcPanel);
- // CPanel::CDisableTimerProcessing disableTimerProcessing2(destPanel);
-
- NWindows::CThread thread;
- if (thread.Create(CThreadCombine::MyThreadFunction, &combiner) != S_OK)
- throw 271824;
- progressDialog.Create(title, _window);
- }
- RefreshTitleAlways();
-
- if (!combiner.Error.IsEmpty())
- srcPanel.MessageBoxMyError(combiner.Error);
- // disableTimerProcessing1.Restore();
- // disableTimerProcessing2.Restore();
- // srcPanel.SetFocusToList();
- // srcPanel.RefreshListCtrlSaveFocused();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialog.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialog.cpp
deleted file mode 100644
index 94e8219d4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialog.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// PasswordDialog.cpp
-
-#include "StdAfx.h"
-#include "PasswordDialog.h"
-
-#ifdef LANG
-#include "LangUtils.h"
-#endif
-
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDC_STATIC_PASSWORD_HEADER, 0x02000B01 },
- { IDC_CHECK_PASSWORD_SHOW, 0x02000B02 },
-
-};
-#endif
-
-
-bool CPasswordDialog::OnInit()
-{
- #ifdef LANG
- LangSetWindowText(HWND(*this), 0x02000B00);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- #endif
- _passwordControl.Attach(GetItem(IDC_EDIT_PASSWORD));
- _passwordControl.SetText(Password);
- _passwordControl.SetPasswordChar(TEXT('*'));
- return CModalDialog::OnInit();
-}
-
-bool CPasswordDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
- if (buttonID == IDC_CHECK_PASSWORD_SHOW)
- {
- _passwordControl.SetPasswordChar((IsButtonChecked(
- IDC_CHECK_PASSWORD_SHOW) == BST_CHECKED) ? 0: TEXT('*'));
- UString password;
- _passwordControl.GetText(password);
- _passwordControl.SetText(password);
- return true;
- }
- return CDialog::OnButtonClicked(buttonID, buttonHWND);
-}
-
-void CPasswordDialog::OnOK()
-{
- _passwordControl.GetText(Password);
- CModalDialog::OnOK();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialog.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialog.h
deleted file mode 100644
index e5a960731..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialog.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// PasswordDialog.h
-
-#ifndef __PASSWORDDIALOG_H
-#define __PASSWORDDIALOG_H
-
-#include "Windows/Control/Dialog.h"
-#include "Windows/Control/Edit.h"
-#include "PasswordDialogRes.h"
-
-class CPasswordDialog: public NWindows::NControl::CModalDialog
-{
- NWindows::NControl::CEdit _passwordControl;
- virtual void OnOK();
- virtual bool OnInit();
- virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
-public:
- UString Password;
- INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_DIALOG_PASSWORD, parentWindow); }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialogRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialogRes.h
deleted file mode 100644
index e0b426614..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialogRes.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#define IDD_DIALOG_PASSWORD 501
-#define IDC_STATIC_PASSWORD_HEADER 1000
-#define IDC_EDIT_PASSWORD 1001
-#define IDC_CHECK_PASSWORD_SHOW 1002
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialog_rc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialog_rc.cpp
deleted file mode 100644
index 533919868..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PasswordDialog_rc.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-// PasswordDialog.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#include "Windows/Control/DialogImpl.h"
-
-#include "PasswordDialogRes.h"
-
-class CPasswordDialogImpl : public NWindows::NControl::CModalDialogImpl
-{
- public:
- CPasswordDialogImpl(NWindows::NControl::CModalDialog *dialog,wxWindow * parent,int id) : CModalDialogImpl(dialog, parent, id, wxT("Enter password"))
- {
- bool bShowPassword = false;
-
- wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
-
- {
- wxStaticBoxSizer *passwdSizer = new wxStaticBoxSizer(new wxStaticBox(this,IDC_STATIC_PASSWORD_HEADER,_T("&Enter password:")),wxVERTICAL);
-
- wxTextCtrl *TxtPasswd = new wxTextCtrl(this, IDC_EDIT_PASSWORD, L"",
- wxDefaultPosition, wxSize(260,-1), bShowPassword?wxTE_LEFT:wxTE_PASSWORD );
-
- wxCheckBox *ChkShowPasswd = new wxCheckBox(this, IDC_CHECK_PASSWORD_SHOW, wxT("&Show password"));
-
- ChkShowPasswd->SetValue(bShowPassword);
- passwdSizer->Add(TxtPasswd, 0, wxALL, 5);
- passwdSizer->Add(ChkShowPasswd, 0, wxALL, 5);
-
- topsizer->Add(passwdSizer, 0, wxALL, 5);
- }
- topsizer->Add(CreateButtonSizer(wxOK|wxCANCEL), 0, wxALL|wxEXPAND, 5);
-
- this->OnInit();
-
- SetSizer(topsizer); // use the sizer for layout
- topsizer->SetSizeHints(this); // set size hints to honour minimum size
- }
-private:
- // Any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-REGISTER_DIALOG(IDD_DIALOG_PASSWORD,CPasswordDialog,0)
-
-BEGIN_EVENT_TABLE(CPasswordDialogImpl, wxDialog)
- EVT_BUTTON(wxID_ANY, CModalDialogImpl::OnAnyButton)
- EVT_CHECKBOX(wxID_ANY, CModalDialogImpl::OnAnyButton)
-END_EVENT_TABLE()
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PluginInterface.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PluginInterface.h
deleted file mode 100644
index 905aff9a4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PluginInterface.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// PluginInterface.h
-
-#ifndef __PLUGININTERFACE_H
-#define __PLUGININTERFACE_H
-
-#include "Common/MyString.h"
-
-// {23170F69-40C1-278D-0000-000100010000}
-DEFINE_GUID(IID_IInitContextMenu,
-0x23170F69, 0x40C1, 0x278D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00);
-MIDL_INTERFACE("23170F69-40C1-278D-0000-000100010000")
-IInitContextMenu: public IUnknown
-{
-public:
- STDMETHOD(InitContextMenu)(const wchar_t *aFolder, const wchar_t **aNames, UINT32 aNumFiles) PURE;
-
-};
-
-// {23170F69-40C1-278D-0000-000100020100}
-DEFINE_GUID(IID_IPluginOptionsCallback,
-0x23170F69, 0x40C1, 0x278D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
-MIDL_INTERFACE("23170F69-40C1-278D-0000-000100020000")
-IPluginOptionsCallback: public IUnknown
-{
-public:
- STDMETHOD(GetProgramFolderPath)(BSTR *value) PURE;
- STDMETHOD(GetProgramPath)(BSTR *value) PURE;
- STDMETHOD(GetRegistryCUPath)(BSTR *value) PURE;
-};
-
-// {23170F69-40C1-278D-0000-000100020000}
-DEFINE_GUID(IID_IPluginOptions,
-0x23170F69, 0x40C1, 0x278D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00);
-MIDL_INTERFACE("23170F69-40C1-278D-0000-000100020000")
-IPluginOptions: public IUnknown
-{
-public:
- STDMETHOD(PluginOptions)(HWND hWnd, IPluginOptionsCallback *callback) PURE;
- // STDMETHOD(GetFileExtensions)(BSTR *extensions) PURE;
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PluginLoader.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PluginLoader.h
deleted file mode 100644
index f48c9e97a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PluginLoader.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// PluginLoader.h
-
-#ifndef __PLUGINLOADER_H
-#define __PLUGINLOADER_H
-
-#include "Windows/DLL.h"
-
-typedef UINT32 (WINAPI * CreateObjectPointer)(
- const GUID *clsID,
- const GUID *interfaceID,
- void **outObject);
-
-class CPluginLibrary: public NWindows::NDLL::CLibrary
-{
-public:
- HRESULT CreateManager(REFGUID clsID, IFolderManager **manager)
- {
- CreateObjectPointer createObject = (CreateObjectPointer)
- GetProcAddress("CreateObject");
- if (createObject == NULL)
- return GetLastError();
- return createObject(&clsID, &IID_IFolderManager, (void **)manager);
- }
- HRESULT LoadAndCreateManager(LPCWSTR filePath, REFGUID clsID, IFolderManager **manager)
- {
- if (!Load(filePath))
- return GetLastError();
- return CreateManager(clsID, manager);
- }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgramLocation.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgramLocation.cpp
deleted file mode 100644
index ea8afd558..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgramLocation.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-// ProgramLocation.h
-
-#include "StdAfx.h"
-
-#include "ProgramLocation.h"
-
-// #include "Windows/FileName.h"
-#include "Common/StringConvert.h"
-
-
-bool GetProgramFolderPath(UString &folder)
-{
- const char *p7zip_home_dir = getenv("P7ZIP_HOME_DIR");
- if (p7zip_home_dir == 0) p7zip_home_dir="./";
-
- folder = MultiByteToUnicodeString(p7zip_home_dir);
-
- return true;
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgramLocation.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgramLocation.h
deleted file mode 100644
index 38317b45f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgramLocation.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// ProgramLocation.h
-
-#ifndef __PROGRAMLOCATION_H
-#define __PROGRAMLOCATION_H
-
-#include "Common/MyString.h"
-
-bool GetProgramFolderPath(UString &folder); // normalized
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
deleted file mode 100644
index 87a1521d0..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
+++ /dev/null
@@ -1,507 +0,0 @@
-// ProgressDialog2.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-
-#include "ProgressDialog2.h"
-
-using namespace NWindows;
-
-static const UINT_PTR kTimerID = 3;
-static const UINT kTimerElapse = 100;
-
-#ifdef LANG
-#include "LangUtils.h"
-#endif
-
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDCANCEL, 0x02000C00 },
- { IDC_PROGRESS_ELAPSED, 0x02000C01 },
- { IDC_PROGRESS_REMAINING, 0x02000C02 },
- { IDC_PROGRESS_TOTAL, 0x02000C03 },
- { IDC_PROGRESS_SPEED, 0x02000C04 },
- { IDC_PROGRESS_UNPACKED, 0x02000C05 },
- { IDC_PROGRESS_PACKED, 0x02000323 },
- { IDC_PROGRESS_RATIO, 0x02000C06 },
- { IDC_PROGRESS_SPEED, 0x02000C04 },
- { IDC_PROGRESS_FILES, 0x02000320 },
- { IDC_BUTTON_PROGRESS_PRIORITY, 0x02000C10 },
- { IDC_BUTTON_PAUSE, 0x02000C12 },
- { IDCANCEL, 0x02000711 },
-};
-#endif
-
-HRESULT CProgressSynch::ProcessStopAndPause()
-{
- for (;;)
- {
- if (GetStopped())
- return E_ABORT;
- if (!GetPaused())
- break;
- ::Sleep(100);
- }
- return S_OK;
-}
-
-HRESULT CProgressSynch::SetPosAndCheckPaused(UInt64 completed)
-{
- RINOK(ProcessStopAndPause());
- SetPos(completed);
- return S_OK;
-}
-
-#ifndef _SFX
-CProgressDialog::~CProgressDialog()
-{
- AddToTitle(L"");
-}
-void CProgressDialog::AddToTitle(LPCWSTR s)
-{
- if (MainWindow != 0)
- {
- CWindow window(MainWindow);
- window.SetText(s + UString(MainTitle));
- }
-}
-
-static const int kTitleFileNameSizeLimit = 40;
-static const int kCurrentFileNameSizeLimit = 82;
-
-static void ReduceString(UString &s, int size)
-{
- if (s.Length() > size)
- s = s.Left(size / 2) + UString(L" ... ") + s.Right(size / 2);
-}
-#endif
-
-bool CProgressDialog::OnInit()
-{
- _range = (UInt64)(Int64)(-1);
- _prevPercentValue = UInt32(-1);
- _prevElapsedSec = UInt32(-1);
- _prevRemainingSec = UInt32(-1);
- _prevSpeed = UInt32(-1);
- _prevMode = kSpeedBytes;
- _prevTime = ::GetTickCount();
- _elapsedTime = 0;
- _foreground = true;
-
- #ifdef LANG
- // LangSetWindowText(HWND(*this), 0x02000C00);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- #endif
-
-
- CWindow window(GetItem(IDC_BUTTON_PROGRESS_PRIORITY));
- window.GetText(backgroundString);
- backgroundedString = backgroundString;
- backgroundedString.Replace(L"&", L"");
-
- window = GetItem(IDC_BUTTON_PAUSE);
- window.GetText(pauseString);
-
- foregroundString = LangString(IDS_PROGRESS_FOREGROUND, 0x02000C11);
- continueString = LangString(IDS_PROGRESS_CONTINUE, 0x02000C13);
- pausedString = LangString(IDS_PROGRESS_PAUSED, 0x02000C20);
-
- m_ProgressBar.Attach(GetItem(IDC_PROGRESS1));
- _timer = SetTimer(kTimerID, kTimerElapse);
- _dialogCreatedEvent.Set();
- SetText(_title);
- SetPauseText();
- SetPriorityText();
- return CModalDialog::OnInit();
-}
-
-void CProgressDialog::OnCancel()
-{
- ProgressSynch.SetStopped(true);
-}
-
-static void ConvertSizeToString(UInt64 value, wchar_t *s)
-{
- const wchar_t *kModif = L" KM";
- for (int i = 0; ; i++)
- if (i == 2 || value < (UInt64(10000) << (i * 10)))
- {
- ConvertUInt64ToString(value >> (i * 10), s);
- s += wcslen(s);
- *s++ = ' ';
- if (i != 0)
- *s++ = kModif[i];
- *s++ = L'B';
- *s++ = L'\0';
- return;
- }
-}
-
-void CProgressDialog::SetRange(UInt64 range)
-{
- _range = range;
- _previousPos = (UInt64)(Int64)-1;
- _converter.Init(range);
- m_ProgressBar.SetRange32(0, _converter.Count(range)); // Test it for 100%
-}
-
-void CProgressDialog::SetPos(UInt64 pos)
-{
- bool redraw = true;
- if (pos < _range && pos > _previousPos)
- {
- if (pos - _previousPos < (_range >> 10))
- redraw = false;
- }
- if(redraw)
- {
- m_ProgressBar.SetPos(_converter.Count(pos)); // Test it for 100%
- _previousPos = pos;
- }
-}
-
-static void GetTimeString(UInt64 timeValue, TCHAR *s)
-{
- wsprintf(s, TEXT("%02d:%02d:%02d"),
- UInt32(timeValue / 3600),
- UInt32((timeValue / 60) % 60),
- UInt32(timeValue % 60));
-}
-
-void CProgressDialog::ShowSize(int id, UInt64 value)
-{
- wchar_t s[40];
- s[0] = 0;
- if (value != (UInt64)(Int64)-1)
- ConvertSizeToString(value, s);
- SetItemText(id, s);
-}
-
-bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
-{
- if (ProgressSynch.GetPaused())
- return true;
- UInt64 total, completed, totalFiles, completedFiles, inSize, outSize;
- bool bytesProgressMode;
- ProgressSynch.GetProgress(total, completed, totalFiles, completedFiles, inSize, outSize, bytesProgressMode);
-
- UInt32 curTime = ::GetTickCount();
-
- UInt64 progressTotal = bytesProgressMode ? total : totalFiles;
- UInt64 progressCompleted = bytesProgressMode ? completed : completedFiles;
-
- if (progressTotal != _range)
- SetRange(progressTotal);
- if (progressTotal == (UInt64)(Int64)-1)
- {
- SetPos(0);
- SetRange(progressCompleted);
- }
- else
- SetPos(progressCompleted);
-
- wchar_t s[32] = { 0 };
- if (total != (UInt64)(Int64)-1)
- ConvertSizeToString(total, s);
- SetItemText(IDC_PROGRESS_TOTAL_VALUE, s);
-
- _elapsedTime += (curTime - _prevTime);
- _prevTime = curTime;
-
- UInt32 elapsedSec = _elapsedTime / 1000;
-
- bool elapsedChanged = false;
- if (elapsedSec != _prevElapsedSec)
- {
- TCHAR s[40];
- GetTimeString(elapsedSec, s);
- SetItemText(IDC_PROGRESS_ELAPSED_VALUE, s);
- _prevElapsedSec = elapsedSec;
- elapsedChanged = true;
- }
-
- if (elapsedChanged)
- {
- if (completed != 0)
- {
-
- if (total == (UInt64)(Int64)-1)
- {
- SetItemText(IDC_PROGRESS_REMAINING_VALUE, L"");
- }
- else
- {
- UInt64 remainingTime = 0;
- if (completed < total)
- remainingTime = _elapsedTime * (total - completed) / completed;
- UInt64 remainingSec = remainingTime / 1000;
- if (remainingSec != _prevRemainingSec)
- {
- TCHAR s[40];
- GetTimeString(remainingSec, s);
- SetItemText(IDC_PROGRESS_REMAINING_VALUE, s);
- _prevRemainingSec = remainingSec;
- }
- }
- // if (elapsedChanged)
- {
- UInt32 elapsedTime = (_elapsedTime == 0) ? 1 : _elapsedTime;
- UInt64 speedB = (completed * 1000) / elapsedTime;
- UInt64 speedKB = speedB / 1024;
- UInt64 speedMB = speedKB / 1024;
- const UInt32 kLimit1 = 10;
- TCHAR s[40];
- bool needRedraw = false;
- if (speedMB >= kLimit1)
- {
- if (_prevMode != kSpeedMBytes || speedMB != _prevSpeed)
- {
- ConvertUInt64ToString(speedMB, s);
- lstrcat(s, TEXT(" MB/s"));
- _prevMode = kSpeedMBytes;
- _prevSpeed = speedMB;
- needRedraw = true;
- }
- }
- else if (speedKB >= kLimit1)
- {
- if (_prevMode != kSpeedKBytes || speedKB != _prevSpeed)
- {
- ConvertUInt64ToString(speedKB, s);
- lstrcat(s, TEXT(" KB/s"));
- _prevMode = kSpeedKBytes;
- _prevSpeed = speedKB;
- needRedraw = true;
- }
- }
- else
- {
- if (_prevMode != kSpeedBytes || speedB != _prevSpeed)
- {
- ConvertUInt64ToString(speedB, s);
- lstrcat(s, TEXT(" B/s"));
- _prevMode = kSpeedBytes;
- _prevSpeed = speedB;
- needRedraw = true;
- }
- }
- if (needRedraw)
- SetItemText(IDC_PROGRESS_SPEED_VALUE, s);
- }
- }
-
- if (total == 0)
- total = 1;
- UInt32 percentValue = (UInt32)(completed * 100 / total);
- UString titleName;
- ProgressSynch.GetTitleFileName(titleName);
- if (percentValue != _prevPercentValue || _prevTitleName != titleName)
- {
- _prevPercentValue = percentValue;
- SetTitleText();
- _prevTitleName = titleName;
- }
-
- TCHAR s[64];
- ConvertUInt64ToString(completedFiles, s);
- if (totalFiles != (UInt64)(Int64)-1)
- {
- lstrcat(s, TEXT(" / "));
- ConvertUInt64ToString(totalFiles, s + lstrlen(s));
- }
-
- SetItemText(IDC_PROGRESS_FILES_VALUE, s);
-
- const UInt64 packSize = CompressingMode ? outSize : inSize;
- const UInt64 unpackSize = CompressingMode ? inSize : outSize;
-
- if (unpackSize == (UInt64)(Int64)-1 && packSize == (UInt64)(Int64)-1)
- {
- ShowSize(IDC_PROGRESS_UNPACKED_VALUE, completed);
- SetItemText(IDC_PROGRESS_PACKED_VALUE, L"");
- }
- else
- {
- ShowSize(IDC_PROGRESS_UNPACKED_VALUE, unpackSize);
- ShowSize(IDC_PROGRESS_PACKED_VALUE, packSize);
-
- if (packSize != (UInt64)(Int64)-1 && unpackSize != (UInt64)(Int64)-1 && unpackSize != 0)
- {
- UInt64 ratio = packSize * 100 / unpackSize;
- ConvertUInt64ToString(ratio, s);
- lstrcat(s, TEXT("%"));
- SetItemText(IDC_PROGRESS_RATIO_VALUE, s);
- }
- }
- }
-
-
- UString fileName;
- ProgressSynch.GetCurrentFileName(fileName);
- if (_prevFileName != fileName)
- {
- int slashPos = fileName.ReverseFind(WCHAR_PATH_SEPARATOR);
- UString s1, s2;
- if (slashPos >= 0)
- {
- s1 = fileName.Left(slashPos + 1);
- s2 = fileName.Mid(slashPos + 1);
- }
- else
- s2 = fileName;
- ReduceString(s1, kCurrentFileNameSizeLimit);
- ReduceString(s2, kCurrentFileNameSizeLimit);
- UString s = s1 + L"\n" + s2;
- SetItemText(IDC_PROGRESS_FILE_NAME, s);
- _prevFileName == fileName;
- }
-
- return true;
-}
-
-
-////////////////////
-// CU64ToI32Converter
-
-static const UInt64 kMaxIntValue = 0x7FFFFFFF;
-
-void CU64ToI32Converter::Init(UInt64 range)
-{
- _numShiftBits = 0;
- while(range > kMaxIntValue)
- {
- range >>= 1;
- _numShiftBits++;
- }
-}
-
-int CU64ToI32Converter::Count(UInt64 aValue)
-{
- return int(aValue >> _numShiftBits);
-}
-
-const UINT CProgressDialog::kCloseMessage = WM_USER + 1;
-
-bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch(message)
- {
- case kCloseMessage:
- {
- KillTimer(_timer);
- _timer = 0;
- End(0);
- return true;
- }
- case WM_SETTEXT:
- {
- if (_timer == 0)
- return true;
- }
- }
- return CModalDialog::OnMessage(message, wParam, lParam);
-}
-
-void CProgressDialog::SetTitleText()
-{
- UString title;
- if (ProgressSynch.GetPaused())
- {
- title = pausedString;
- title += L" ";
- }
- if (_prevPercentValue != UInt32(-1))
- {
- wchar_t s[64];
- ConvertUInt64ToString(_prevPercentValue, s);
- title += s;
- title += L"%";
- }
- if (!_foreground)
- {
- title += L" ";
- title += backgroundedString;
- }
- title += L" ";
- UString totalTitle = title + _title;
- UString fileName;
- ProgressSynch.GetTitleFileName(fileName);
- if (!fileName.IsEmpty())
- {
- ReduceString(fileName, kTitleFileNameSizeLimit);
- totalTitle += L" ";
- totalTitle += fileName;
- }
- SetText(totalTitle);
- #ifndef _SFX
- AddToTitle(title + MainAddTitle);
- #endif
-}
-
-void CProgressDialog::SetPauseText()
-{
- SetItemText(IDC_BUTTON_PAUSE, ProgressSynch.GetPaused() ?
- continueString : pauseString);
- SetTitleText();
-}
-
-void CProgressDialog::OnPauseButton()
-{
- bool paused = !ProgressSynch.GetPaused();
- ProgressSynch.SetPaused(paused);
- UInt32 curTime = ::GetTickCount();
- if (paused)
- _elapsedTime += (curTime - _prevTime);
- _prevTime = curTime;
- SetPauseText();
-}
-
-void CProgressDialog::SetPriorityText()
-{
- SetItemText(IDC_BUTTON_PROGRESS_PRIORITY, _foreground ?
- backgroundString :
- foregroundString);
- SetTitleText();
-}
-
-void CProgressDialog::OnPriorityButton()
-{
- _foreground = !_foreground;
- SetPriorityClass(GetCurrentProcess(), _foreground ?
- NORMAL_PRIORITY_CLASS: IDLE_PRIORITY_CLASS);
- SetPriorityText();
-}
-
-bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
- switch(buttonID)
- {
- case IDCANCEL:
- {
- bool paused = ProgressSynch.GetPaused();;
- // ProgressSynch.SetPaused(true);
- if (!paused)
- OnPauseButton();
- int res = ::MessageBoxW(HWND(*this),
- LangString(IDS_PROGRESS_ASK_CANCEL, 0x02000C30),
- _title, MB_YESNOCANCEL);
- // ProgressSynch.SetPaused(paused);
- if (!paused)
- OnPauseButton();
- if (res == IDCANCEL || res == IDNO)
- return true;
- break;
- }
- case IDC_BUTTON_PAUSE:
- OnPauseButton();
- return true;
- case IDC_BUTTON_PROGRESS_PRIORITY:
- {
- OnPriorityButton();
- return true;
- }
- }
- return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2.h
deleted file mode 100644
index 3ab9f4c05..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2.h
+++ /dev/null
@@ -1,242 +0,0 @@
-// ProgressDialog2.h
-
-#ifndef __PROGRESS_DIALOG2_H
-#define __PROGRESS_DIALOG2_H
-
-#include "Common/Types.h"
-
-#include "Windows/Control/Dialog.h"
-#include "Windows/Control/ProgressBar.h"
-#include "Windows/Synchronization.h"
-
-#include "ProgressDialog2Res.h"
-
-class CProgressSynch
-{
- NWindows::NSynchronization::CCriticalSection _cs;
- bool _stopped;
- bool _paused;
- bool _bytesProgressMode;
-
- UInt64 _totalBytes;
- UInt64 _curBytes;
- UInt64 _totalFiles;
- UInt64 _curFiles;
- UInt64 _inSize;
- UInt64 _outSize;
-
- UString TitleFileName;
- UString CurrentFileName;
-
-public:
- CProgressSynch():
- _stopped(false), _paused(false),
- _totalBytes((UInt64)(Int64)-1), _curBytes(0),
- _totalFiles((UInt64)(Int64)-1), _curFiles(0),
- _inSize((UInt64)(Int64)-1),
- _outSize((UInt64)(Int64)-1),
- _bytesProgressMode(true)
- {}
-
- bool GetStopped()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- return _stopped;
- }
- void SetStopped(bool value)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- _stopped = value;
- }
- bool GetPaused()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- return _paused;
- }
- void SetPaused(bool value)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- _paused = value;
- }
- void SetBytesProgressMode(bool bytesProgressMode)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- _bytesProgressMode = bytesProgressMode;
- }
- void SetProgress(UInt64 total, UInt64 completed)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- _totalBytes = total;
- _curBytes = completed;
- }
- void SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- if (inSize)
- _inSize = *inSize;
- if (outSize)
- _outSize = *outSize;
- }
- void SetPos(UInt64 completed)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- _curBytes = completed;
- }
- void SetNumBytesTotal(UInt64 value)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- _totalBytes = value;
- }
- void SetNumFilesTotal(UInt64 value)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- _totalFiles = value;
- }
- void SetNumFilesCur(UInt64 value)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- _curFiles = value;
- }
- HRESULT ProcessStopAndPause();
- HRESULT SetPosAndCheckPaused(UInt64 completed);
- void GetProgress(UInt64 &total, UInt64 &completed,
- UInt64 &totalFiles, UInt64 &curFiles,
- UInt64 &inSize, UInt64 &outSize,
- bool &bytesProgressMode)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- total = _totalBytes;
- completed = _curBytes;
- totalFiles = _totalFiles;
- curFiles = _curFiles;
- inSize = _inSize;
- outSize = _outSize;
- bytesProgressMode = _bytesProgressMode;
- }
- void SetTitleFileName(const UString &fileName)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- TitleFileName = fileName;
- }
- void GetTitleFileName(UString &fileName)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- fileName = TitleFileName;
- }
- void SetCurrentFileName(const UString &fileName)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- CurrentFileName = fileName;
- }
- void GetCurrentFileName(UString &fileName)
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(_cs);
- fileName = CurrentFileName;
- }
-};
-
-class CU64ToI32Converter
-{
- UInt64 _numShiftBits;
-public:
- void Init(UInt64 _range);
- int Count(UInt64 aValue);
-};
-
-// class CProgressDialog: public NWindows::NControl::CModelessDialog
-
-enum ESpeedMode
-{
- kSpeedBytes,
- kSpeedKBytes,
- kSpeedMBytes
-};
-
-class CProgressDialog: public NWindows::NControl::CModalDialog
-{
- UString _prevFileName;
- UString _prevTitleName;
-private:
- UString backgroundString;
- UString backgroundedString;
- UString foregroundString;
- UString pauseString;
- UString continueString;
- UString pausedString;
-
-
-
- UINT_PTR _timer;
-
- UString _title;
- CU64ToI32Converter _converter;
- UInt64 _previousPos;
- UInt64 _range;
- NWindows::NControl::CProgressBar m_ProgressBar;
-
- UInt32 _prevPercentValue;
- UInt32 _prevTime;
- UInt32 _elapsedTime;
- UInt32 _prevElapsedSec;
- UInt64 _prevRemainingSec;
- ESpeedMode _prevMode;
- UInt64 _prevSpeed;
-
- bool _foreground;
-
- bool OnTimer(WPARAM timerID, LPARAM callback);
- void SetRange(UInt64 range);
- void SetPos(UInt64 pos);
- virtual bool OnInit();
- virtual void OnCancel();
- NWindows::NSynchronization::CManualResetEvent _dialogCreatedEvent;
- #ifndef _SFX
- void AddToTitle(LPCWSTR string);
- #endif
-
- void SetPauseText();
- void SetPriorityText();
- void OnPauseButton();
- void OnPriorityButton();
- bool OnButtonClicked(int buttonID, HWND buttonHWND);
-
- void SetTitleText();
- void ShowSize(int id, UInt64 value);
-
-public:
- CProgressSynch ProgressSynch;
- bool CompressingMode;
-
- #ifndef _SFX
- HWND MainWindow;
- UString MainTitle;
- UString MainAddTitle;
- ~CProgressDialog();
- #endif
-
- CProgressDialog(): _timer(0), CompressingMode(true)
- #ifndef _SFX
- ,MainWindow(0)
- #endif
- {
- if (_dialogCreatedEvent.Create() != S_OK)
- throw 1334987;
- }
-
- void WaitCreating() { _dialogCreatedEvent.Lock(); }
-
-
- INT_PTR Create(const UString &title, HWND wndParent = 0)
- {
- _title = title;
- return CModalDialog::Create(IDD_DIALOG_PROGRESS, wndParent);
- }
-
- static const UINT kCloseMessage;
-
- virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
-
- void MyClose() { PostMessage(kCloseMessage); };
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2Res.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2Res.h
deleted file mode 100644
index 16bf26342..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2Res.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#define IDC_BUTTON_PAUSE 3
-#define IDC_BUTTON_PROGRESS_PRIORITY 4
-#define IDD_DIALOG_PROGRESS 500
-#define IDS_PROGRESS_PAUSED 700
-#define IDS_PROGRESS_FOREGROUND 701
-#define IDS_PROGRESS_CONTINUE 702
-#define IDS_PROGRESS_ASK_CANCEL 703
-#define IDC_PROGRESS1 1000
-#define IDC_PROGRESS_ELAPSED 1002
-#define IDC_PROGRESS_ELAPSED_VALUE 1003
-#define IDC_PROGRESS_REMAINING 1004
-#define IDC_PROGRESS_REMAINING_VALUE 1005
-#define IDC_PROGRESS_SPEED 1006
-#define IDC_PROGRESS_SPEED_VALUE 1007
-#define IDC_PROGRESS_TOTAL 1008
-#define IDC_PROGRESS_TOTAL_VALUE 1009
-#define IDC_PROGRESS_FILE_NAME 1010
-
-#define IDC_PROGRESS_FILES 1012
-#define IDC_PROGRESS_FILES_VALUE 1013
-#define IDC_PROGRESS_RATIO 1014
-#define IDC_PROGRESS_RATIO_VALUE 1015
-#define IDC_PROGRESS_PACKED 1016
-#define IDC_PROGRESS_PACKED_VALUE 1017
-#define IDC_PROGRESS_UNPACKED 1018
-#define IDC_PROGRESS_UNPACKED_VALUE 1019
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2_rc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2_rc.cpp
deleted file mode 100644
index 016c9c85a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialog2_rc.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-// ProgressDialog2_rc.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#include "ProgressDialog2Res.h"
-
-#include "Windows/Control/DialogImpl.h"
-
-/*
-IDD_DIALOG_PROGRESS DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
-CAPTION "Progress"
-MY_FONT
-BEGIN
- PUSHBUTTON "&Background", IDC_BUTTON_PROGRESS_PRIORITY, bXPos3, bYPos, bXSize, bYSize
- PUSHBUTTON "&Pause", IDC_BUTTON_PAUSE, bXPos2, bYPos, bXSize, bYSize
- PUSHBUTTON "Cancel", IDCANCEL, bXPos1, bYPos, bXSize, bYSize
- LTEXT "Elapsed time:", IDC_PROGRESS_ELAPSED, marg, y0, x0Size, 8
- LTEXT "Remaining time:", IDC_PROGRESS_REMAINING, marg, y1, x0Size, 8
- LTEXT "Files:", IDC_PROGRESS_FILES, marg, y2, x0Size, 8
- LTEXT "Compression ratio:",IDC_PROGRESS_RATIO, marg, y3, x0Size, 8
-
- LTEXT "Total size:", IDC_PROGRESS_TOTAL, x2, y0, x2Size, 8
- LTEXT "Speed:", IDC_PROGRESS_SPEED, x2, y1, x2Size, 8
- LTEXT "Processed:", IDC_PROGRESS_UNPACKED, x2, y2, x2Size, 8
- LTEXT "Compressed size:", IDC_PROGRESS_PACKED, x2, y3, x2Size, 8
-
- RTEXT "00:00:00", IDC_PROGRESS_ELAPSED_VALUE, x1, y0, x1Size, 8
- RTEXT "", IDC_PROGRESS_REMAINING_VALUE, x1, y1, x1Size, 8
- RTEXT "", IDC_PROGRESS_FILES_VALUE, x1, y2, x1Size, 8
- RTEXT "", IDC_PROGRESS_RATIO_VALUE, x1, y3, x1Size, 8
-
- RTEXT "", IDC_PROGRESS_TOTAL_VALUE, x3, y0, x3Size, 8
- RTEXT "", IDC_PROGRESS_SPEED_VALUE, x3, y1, x3Size, 8
- RTEXT "", IDC_PROGRESS_UNPACKED_VALUE, x3, y2, x3Size, 8
- RTEXT "", IDC_PROGRESS_PACKED_VALUE, x3, y3, x3Size, 8
-
- LTEXT "", IDC_PROGRESS_FILE_NAME, marg, bYPos - 30, xSize2, 8, SS_NOPREFIX
- CONTROL "Progress1", IDC_PROGRESS1, "msctls_progress32", PBS_SMOOTH | WS_BORDER, marg, bYPos - 20, xSize2, 13
-END
-
-
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_PROGRESS_PAUSED "Paused"
- IDS_PROGRESS_FOREGROUND "&Foreground"
- IDS_PROGRESS_CONTINUE "&Continue"
- IDS_PROGRESS_ASK_CANCEL "Are you sure you want to cancel?"
-END
-
-*/
-class CProgressDialogImpl : public NWindows::NControl::CModalDialogImpl
-{
- public:
- CProgressDialogImpl(NWindows::NControl::CModalDialog *dialog,wxWindow * parent , int id) : CModalDialogImpl(dialog,parent, id, wxT("Progress"))
- {
-// FIXME : ProgressDialog2 but ProgressDialog ...
-
- ///Sizer for adding the controls created by users
- wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
-
- wxStaticText *pStaticTextElapsedTime = new wxStaticText(this, IDC_PROGRESS_ELAPSED, wxT("Elapsed time:"));
- wxStaticText *m_pStaticTextElapsedTime = new wxStaticText(this, IDC_PROGRESS_ELAPSED_VALUE, wxT("00:00:00"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
- wxStaticText *pStaticTextRemainingTime = new wxStaticText(this, IDC_PROGRESS_REMAINING, wxT("Remaining time"));
- wxStaticText *m_pStaticTextRemainingTime = new wxStaticText(this, IDC_PROGRESS_REMAINING_VALUE, wxT("00:00:00"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-
- wxStaticText *pStaticTextFiles = new wxStaticText(this, IDC_PROGRESS_FILES, wxT("Files:"));
- wxStaticText *m_pStaticTextFiles = new wxStaticText(this, IDC_PROGRESS_FILES_VALUE, wxT(" "), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-
- wxStaticText *pStaticTextRatio = new wxStaticText(this, IDC_PROGRESS_RATIO, wxT("Compression ratio:"));
- wxStaticText *m_pStaticTextRatio = new wxStaticText(this, IDC_PROGRESS_RATIO_VALUE, wxT(" "), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-
-
- wxStaticText *pStaticTextSize = new wxStaticText(this, IDC_PROGRESS_TOTAL, wxT("Total Size:"));
- wxStaticText *m_pStaticTextSize = new wxStaticText(this, IDC_PROGRESS_TOTAL_VALUE, wxT(" "), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
- wxStaticText *pStaticTextSpeed = new wxStaticText(this, IDC_PROGRESS_SPEED, wxT("Speed:"));
- wxStaticText *m_pStaticTextSpeed = new wxStaticText(this, IDC_PROGRESS_SPEED_VALUE, wxT(" "), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-
- wxStaticText *pStaticTextUnpacked = new wxStaticText(this, IDC_PROGRESS_UNPACKED, wxT("Processed:"));
- wxStaticText *m_pStaticTextUnpacked = new wxStaticText(this, IDC_PROGRESS_UNPACKED, wxT(" "), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-
- wxStaticText *pStaticTextPacked = new wxStaticText(this, IDC_PROGRESS_PACKED, wxT("Compressed size:"));
- wxStaticText *m_pStaticTextPacked = new wxStaticText(this, IDC_PROGRESS_PACKED_VALUE, wxT(" "), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-
- wxBoxSizer *pInfoSizer = new wxBoxSizer(wxHORIZONTAL);
- wxBoxSizer *pTimeSizer = new wxBoxSizer(wxHORIZONTAL);
- wxBoxSizer *pTimeLabelSizer = new wxBoxSizer(wxVERTICAL);
- pTimeLabelSizer->Add(pStaticTextElapsedTime , 0, wxALL|wxEXPAND, 5);
- pTimeLabelSizer->Add(pStaticTextRemainingTime, 0, wxALL|wxEXPAND, 5);
- pTimeLabelSizer->Add(pStaticTextFiles , 0, wxALL|wxEXPAND, 5);
- pTimeLabelSizer->Add(pStaticTextRatio , 0, wxALL|wxEXPAND, 5);
- wxBoxSizer *pTimeInfoSizer = new wxBoxSizer(wxVERTICAL);
- pTimeInfoSizer->Add(m_pStaticTextElapsedTime , 0, wxALL|wxEXPAND, 5);
- pTimeInfoSizer->Add(m_pStaticTextRemainingTime, 0, wxALL|wxEXPAND, 5);
- pTimeInfoSizer->Add(m_pStaticTextFiles , 0, wxALL|wxEXPAND, 5);
- pTimeInfoSizer->Add(m_pStaticTextRatio , 0, wxALL|wxEXPAND, 5);
- pTimeSizer->Add(pTimeLabelSizer , 0, wxALL|wxEXPAND, 5);
- pTimeSizer->Add(pTimeInfoSizer , 0, wxALL|wxEXPAND, 5);
- wxBoxSizer *pSizeSpeedSizer = new wxBoxSizer(wxHORIZONTAL);
- wxBoxSizer *pSizeSpeedLabelSizer = new wxBoxSizer(wxVERTICAL);
- pSizeSpeedLabelSizer->Add(pStaticTextSize , 0, wxALL|wxEXPAND, 5);
- pSizeSpeedLabelSizer->Add(pStaticTextSpeed , 0, wxALL|wxEXPAND, 5);
- pSizeSpeedLabelSizer->Add(pStaticTextUnpacked , 0, wxALL|wxEXPAND, 5);
- pSizeSpeedLabelSizer->Add(pStaticTextPacked , 0, wxALL|wxEXPAND, 5);
-
- wxBoxSizer *pSizeSpeedInfoSizer = new wxBoxSizer(wxVERTICAL);
- pSizeSpeedInfoSizer->Add(m_pStaticTextSize , 0, wxALL|wxEXPAND, 5);
- pSizeSpeedInfoSizer->Add(m_pStaticTextSpeed , 0, wxALL|wxEXPAND, 5);
- pSizeSpeedInfoSizer->Add(m_pStaticTextUnpacked, 0, wxALL|wxEXPAND, 5);
- pSizeSpeedInfoSizer->Add(m_pStaticTextPacked , 0, wxALL|wxEXPAND, 5);
-
- pSizeSpeedSizer->Add(pSizeSpeedLabelSizer, 1, wxALL|wxEXPAND, 5);
- pSizeSpeedSizer->Add(pSizeSpeedInfoSizer, 1, wxALL|wxEXPAND, 5);
- pInfoSizer->Add(pTimeSizer, 0, wxALL|wxEXPAND, 5);
- pInfoSizer->Add(pSizeSpeedSizer, 0, wxALL|wxEXPAND, 5);
-
- wxStaticText *m_pStaticArchiveName = new wxStaticText(this, IDC_PROGRESS_FILE_NAME, wxT(" \n "));
- wxGauge *m_pGaugeProgress = new wxGauge(this, IDC_PROGRESS1, 100);
-
- wxBoxSizer *pButtonSizer = new wxBoxSizer(wxHORIZONTAL);
- wxButton *m_pButtonBackground = new wxButton(this, IDC_BUTTON_PROGRESS_PRIORITY, wxT("&Background"));
- wxButton *m_pButtonPause = new wxButton(this, IDC_BUTTON_PAUSE, wxT("&Pause"));
- wxButton *m_pButtonCancel = new wxButton(this, wxID_CANCEL, wxT("&Cancel"));
- // FIXME pButtonSizer->AddStretchSpacer(1);
- pButtonSizer->Add(m_pButtonBackground, 0, wxALL|wxEXPAND, 5);
- pButtonSizer->Add(m_pButtonPause, 0, wxALL|wxEXPAND, 5);
- pButtonSizer->Add(m_pButtonCancel, 0, wxALL|wxEXPAND, 5);
-
- topsizer->Add(pInfoSizer, 0, wxBOTTOM|wxEXPAND, 5);
- topsizer->Add(m_pStaticArchiveName, 0, wxLEFT|wxRIGHT|wxEXPAND, 10);
- topsizer->Add(m_pGaugeProgress, 0, wxALL|wxEXPAND, 10);
- topsizer->Add(pButtonSizer, 0, wxALL|wxEXPAND, 5);
-
- this->OnInit();
-
- SetSizer(topsizer); // use the sizer for layout
- topsizer->SetSizeHints(this); // set size hints to honour minimum size
- }
-private:
- // Any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-static CStringTable g_stringTable[] =
-{
- { IDS_PROGRESS_PAUSED , L"Paused" },
- { IDS_PROGRESS_FOREGROUND , L"&Foreground" },
- { IDS_PROGRESS_CONTINUE , L"&Continue" },
- { IDS_PROGRESS_ASK_CANCEL , L"Are you sure you want to cancel?" },
- { 0 , 0 }
-};
-
-REGISTER_DIALOG(IDD_DIALOG_PROGRESS,CProgressDialog,g_stringTable)
-
-BEGIN_EVENT_TABLE(CProgressDialogImpl, wxDialog)
- EVT_TIMER(wxID_ANY, CModalDialogImpl::OnAnyTimer)
- EVT_BUTTON(wxID_ANY, CModalDialogImpl::OnAnyButton)
-END_EVENT_TABLE()
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialogRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialogRes.h
deleted file mode 100644
index 97e47228d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ProgressDialogRes.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#define IDD_DIALOG_PROGRESS 500
-
-#define IDC_PROGRESS1 1000
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PropertyName.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PropertyName.cpp
deleted file mode 100644
index 48090d38b..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PropertyName.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// PropertyName.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-
-#include "Windows/ResourceString.h"
-
-#include "../../PropID.h"
-
-#include "LangUtils.h"
-#include "PropertyName.h"
-
-#include "resource.h"
-#include "PropertyNameRes.h"
-
-struct CPropertyIDNamePair
-{
- PROPID PropID;
- UINT ResourceID;
- UInt32 LangID;
-};
-
-static CPropertyIDNamePair kPropertyIDNamePairs[] =
-{
- { kpidPath, IDS_PROP_PATH, 0x02000203 },
- { kpidName, IDS_PROP_NAME, 0x02000204 },
- { kpidExtension, IDS_PROP_EXTENSION, 0x02000205 },
- { kpidIsDir, IDS_PROP_IS_FOLDER, 0x02000206},
- { kpidSize, IDS_PROP_SIZE, 0x02000207},
- { kpidPackSize, IDS_PROP_PACKED_SIZE, 0x02000208 },
- { kpidAttrib, IDS_PROP_ATTRIBUTES, 0x02000209 },
- { kpidCTime, IDS_PROP_CTIME, 0x0200020A },
- { kpidATime, IDS_PROP_ATIME, 0x0200020B },
- { kpidMTime, IDS_PROP_MTIME, 0x0200020C },
- { kpidSolid, IDS_PROP_SOLID, 0x0200020D },
- { kpidCommented, IDS_PROP_C0MMENTED, 0x0200020E },
- { kpidEncrypted, IDS_PROP_ENCRYPTED, 0x0200020F },
- { kpidSplitBefore, IDS_PROP_SPLIT_BEFORE, 0x02000210 },
- { kpidSplitAfter, IDS_PROP_SPLIT_AFTER, 0x02000211 },
- { kpidDictionarySize, IDS_PROP_DICTIONARY_SIZE, 0x02000212 },
- { kpidCRC, IDS_PROP_CRC, 0x02000213 },
- { kpidType, IDS_PROP_FILE_TYPE, 0x02000214},
- { kpidIsAnti, IDS_PROP_ANTI, 0x02000215 },
- { kpidMethod, IDS_PROP_METHOD, 0x02000216 },
- { kpidHostOS, IDS_PROP_HOST_OS, 0x02000217 },
- { kpidFileSystem, IDS_PROP_FILE_SYSTEM, 0x02000218},
- { kpidUser, IDS_PROP_USER, 0x02000219},
- { kpidGroup, IDS_PROP_GROUP, 0x0200021A},
- { kpidBlock, IDS_PROP_BLOCK, 0x0200021B },
- { kpidComment, IDS_PROP_COMMENT, 0x0200021C },
- { kpidPosition, IDS_PROP_POSITION, 0x0200021D },
- { kpidPrefix, IDS_PROP_PREFIX, 0x0200021E },
- { kpidNumSubDirs, IDS_PROP_FOLDERS, 0x0200021F },
- { kpidNumSubFiles, IDS_PROP_FILES, 0x02000220 },
- { kpidUnpackVer, IDS_PROP_VERSION, 0x02000221},
- { kpidVolume, IDS_PROP_VOLUME, 0x02000222},
- { kpidIsVolume, IDS_PROP_IS_VOLUME, 0x02000223},
- { kpidOffset, IDS_PROP_OFFSET, 0x02000224},
- { kpidLinks, IDS_PROP_LINKS, 0x02000225},
- { kpidNumBlocks, IDS_PROP_NUM_BLOCKS, 0x02000226},
- { kpidNumVolumes, IDS_PROP_NUM_VOLUMES, 0x02000227},
-
- { kpidBit64, IDS_PROP_BIT64, 0x02000229},
- { kpidBigEndian, IDS_PROP_BIG_ENDIAN, 0x0200022A},
- { kpidCpu, IDS_PROP_CPU, 0x0200022B},
- { kpidPhySize, IDS_PROP_PHY_SIZE, 0x0200022C},
- { kpidHeadersSize, IDS_PROP_HEADERS_SIZE, 0x0200022D},
- { kpidChecksum, IDS_PROP_CHECKSUM, 0x0200022E},
- { kpidCharacts, IDS_PROP_CHARACTS, 0x0200022F},
- { kpidVa, IDS_PROP_VA, 0x02000230},
- { kpidId, IDS_PROP_ID, 0x02000231 },
- { kpidShortName, IDS_PROP_SHORT_NAME, 0x02000232 },
- { kpidCreatorApp, IDS_PROP_CREATOR_APP, 0x02000233 },
- { kpidSectorSize, IDS_PROP_SECTOR_SIZE, 0x02000234 },
- { kpidPosixAttrib, IDS_PROP_POSIX_ATTRIB, 0x02000235 },
- { kpidLink, IDS_PROP_LINK, 0x02000236 },
-
- { kpidTotalSize, IDS_PROP_TOTAL_SIZE, 0x03031100 },
- { kpidFreeSpace, IDS_PROP_FREE_SPACE, 0x03031101 },
- { kpidClusterSize, IDS_PROP_CLUSTER_SIZE, 0x03031102},
- { kpidVolumeName, IDS_PROP_VOLUME_NAME, 0x03031103 },
-
- { kpidLocalName, IDS_PROP_LOCAL_NAME, 0x03031200 },
- { kpidProvider, IDS_PROP_PROVIDER, 0x03031201 }
-};
-
-int FindProperty(PROPID propID)
-{
- for (int i = 0; i < sizeof(kPropertyIDNamePairs) / sizeof(kPropertyIDNamePairs[0]); i++)
- if (kPropertyIDNamePairs[i].PropID == propID)
- return i;
- return -1;
-}
-
-UString GetNameOfProperty(PROPID propID, const wchar_t *name)
-{
- int index = FindProperty(propID);
- if (index < 0)
- {
- if (name)
- return name;
- wchar_t s[16];
- ConvertUInt32ToString(propID, s);
- return s;
- }
- const CPropertyIDNamePair &pair = kPropertyIDNamePairs[index];
- return LangString(pair.ResourceID, pair.LangID);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PropertyName.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PropertyName.h
deleted file mode 100644
index 95e9dc9b3..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PropertyName.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// PropertyName.h
-
-#ifndef __PROPERTYNAME_H
-#define __PROPERTYNAME_H
-
-#include "Common/MyString.h"
-
-UString GetNameOfProperty(PROPID propID, const wchar_t *name);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PropertyNameRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PropertyNameRes.h
deleted file mode 100644
index 00458a24f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/PropertyNameRes.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#define IDS_PROP_PATH 3
-#define IDS_PROP_NAME 4
-#define IDS_PROP_EXTENSION 5
-#define IDS_PROP_IS_FOLDER 6
-#define IDS_PROP_SIZE 7
-#define IDS_PROP_PACKED_SIZE 8
-#define IDS_PROP_ATTRIBUTES 9
-#define IDS_PROP_CTIME 10
-#define IDS_PROP_ATIME 11
-#define IDS_PROP_MTIME 12
-#define IDS_PROP_SOLID 13
-#define IDS_PROP_C0MMENTED 14
-#define IDS_PROP_ENCRYPTED 15
-#define IDS_PROP_DICTIONARY_SIZE 16
-#define IDS_PROP_SPLIT_BEFORE 17
-#define IDS_PROP_SPLIT_AFTER 18
-#define IDS_PROP_CRC 19
-#define IDS_PROP_FILE_TYPE 20
-#define IDS_PROP_ANTI 21
-#define IDS_PROP_METHOD 22
-#define IDS_PROP_HOST_OS 23
-#define IDS_PROP_FILE_SYSTEM 24
-#define IDS_PROP_USER 25
-#define IDS_PROP_GROUP 26
-#define IDS_PROP_BLOCK 27
-#define IDS_PROP_COMMENT 28
-#define IDS_PROP_POSITION 29
-#define IDS_PROP_PREFIX 30
-#define IDS_PROP_FOLDERS 31
-#define IDS_PROP_FILES 32
-#define IDS_PROP_VERSION 33
-#define IDS_PROP_VOLUME 34
-#define IDS_PROP_IS_VOLUME 35
-#define IDS_PROP_OFFSET 36
-#define IDS_PROP_LINKS 37
-#define IDS_PROP_NUM_BLOCKS 38
-#define IDS_PROP_NUM_VOLUMES 39
-
-#define IDS_PROP_BIT64 41
-#define IDS_PROP_BIG_ENDIAN 42
-#define IDS_PROP_CPU 43
-#define IDS_PROP_PHY_SIZE 44
-#define IDS_PROP_HEADERS_SIZE 45
-#define IDS_PROP_CHECKSUM 46
-#define IDS_PROP_CHARACTS 47
-#define IDS_PROP_VA 48
-#define IDS_PROP_ID 49
-#define IDS_PROP_SHORT_NAME 50
-#define IDS_PROP_CREATOR_APP 51
-#define IDS_PROP_SECTOR_SIZE 52
-#define IDS_PROP_POSIX_ATTRIB 53
-#define IDS_PROP_LINK 54
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryAssociations.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryAssociations.cpp
deleted file mode 100644
index d4fbfe139..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryAssociations.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-// RegistryAssociations.cpp
-
-#include "StdAfx.h"
-
-#include "RegistryAssociations.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-#include "Common/StringToInt.h"
-
-#include "Windows/Registry.h"
-#include "Windows/Synchronization.h"
-
-#include "StringUtils.h"
-
-using namespace NWindows;
-using namespace NRegistry;
-
-namespace NRegistryAssociations {
-
-static NSynchronization::CCriticalSection g_CriticalSection;
-
-#define REG_PATH_FM TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-ZIP") TEXT(STRING_PATH_SEPARATOR) TEXT("FM")
-
-static const TCHAR *kCUKeyPath = REG_PATH_FM;
-static const WCHAR *kExtPlugins = L"Plugins";
-static const TCHAR *kExtEnabled = TEXT("Enabled");
-
-#define kAssociations TEXT("Associations")
-#define kAssociationsPath REG_PATH_FM TEXT(STRING_PATH_SEPARATOR) kAssociations
-
-bool ReadInternalAssociation(const wchar_t *ext, CExtInfo &extInfo)
-{
- NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
- CKey key;
- if (key.Open(HKEY_CURRENT_USER,
- CSysString(kAssociationsPath TEXT(STRING_PATH_SEPARATOR)) +
- GetSystemString(ext), KEY_READ) != ERROR_SUCCESS)
- return false;
- UString pluginsString;
- key.QueryValue(kExtPlugins, pluginsString);
- SplitString(pluginsString, extInfo.Plugins);
- return true;
-}
-
-void ReadInternalAssociations(CObjectVector<CExtInfo> &items)
-{
- items.Clear();
- NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
- CKey associationsKey;
- if (associationsKey.Open(HKEY_CURRENT_USER, kAssociationsPath, KEY_READ) != ERROR_SUCCESS)
- return;
- CSysStringVector extNames;
- associationsKey.EnumKeys(extNames);
- for(int i = 0; i < extNames.Size(); i++)
- {
- const CSysString extName = extNames[i];
- CExtInfo extInfo;
- // extInfo.Enabled = false;
- extInfo.Ext = GetUnicodeString(extName);
- CKey key;
- if (key.Open(associationsKey, extName, KEY_READ) != ERROR_SUCCESS)
- return;
- UString pluginsString;
- key.QueryValue(kExtPlugins, pluginsString);
- SplitString(pluginsString, extInfo.Plugins);
- /*
- if (key.QueryValue(kExtEnabled, extInfo.Enabled) != ERROR_SUCCESS)
- extInfo.Enabled = false;
- */
- items.Add(extInfo);
- }
-}
-
-void WriteInternalAssociations(const CObjectVector<CExtInfo> &items)
-{
- NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
- CKey mainKey;
- mainKey.Create(HKEY_CURRENT_USER, kCUKeyPath);
- mainKey.RecurseDeleteKey(kAssociations);
- CKey associationsKey;
- associationsKey.Create(mainKey, kAssociations);
- for(int i = 0; i < items.Size(); i++)
- {
- const CExtInfo &extInfo = items[i];
- CKey key;
- key.Create(associationsKey, GetSystemString(extInfo.Ext));
- key.SetValue(kExtPlugins, JoinStrings(extInfo.Plugins));
- // key.SetValue(kExtEnabled, extInfo.Enabled);
- }
-}
-
-///////////////////////////////////
-// External
-
-static const TCHAR *kShellNewKeyName = TEXT("ShellNew");
-static const TCHAR *kShellNewDataValueName = TEXT("Data");
-
-static const TCHAR *kDefaultIconKeyName = TEXT("DefaultIcon");
-static const TCHAR *kShellKeyName = TEXT("shell");
-static const TCHAR *kOpenKeyName = TEXT("open");
-static const TCHAR *kCommandKeyName = TEXT("command");
-
-static CSysString GetExtensionKeyName(const CSysString &extension)
-{
- return CSysString(TEXT(".")) + extension;
-}
-
-static CSysString GetExtProgramKeyName(const CSysString &extension)
-{
- return CSysString(TEXT("7-Zip.")) + extension;
-}
-
-static bool CheckShellExtensionInfo2(const CSysString &extension, UString &iconPath, int &iconIndex)
-{
- iconIndex = -1;
- iconPath.Empty();
- NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
- CKey extKey;
- if (extKey.Open(HKEY_CLASSES_ROOT, GetExtensionKeyName(extension), KEY_READ) != ERROR_SUCCESS)
- return false;
- CSysString programNameValue;
- if (extKey.QueryValue(NULL, programNameValue) != ERROR_SUCCESS)
- return false;
- CSysString extProgramKeyName = GetExtProgramKeyName(extension);
- UString programNameValueU = GetUnicodeString(programNameValue);
- if (programNameValueU.CompareNoCase(GetUnicodeString(extProgramKeyName)) != 0)
- return false;
- CKey iconKey;
- if (extKey.Open(HKEY_CLASSES_ROOT, extProgramKeyName + CSysString(TEXT(CHAR_PATH_SEPARATOR)) + kDefaultIconKeyName, KEY_READ) != ERROR_SUCCESS)
- return false;
- UString value;
- if (extKey.QueryValue(NULL, value) == ERROR_SUCCESS)
- {
- int pos = value.ReverseFind(L',');
- iconPath = value;
- if (pos >= 0)
- {
- const wchar_t *end;
- UInt64 index = ConvertStringToUInt64((const wchar_t *)value + pos + 1, &end);
- if (*end == 0)
- {
- iconIndex = (int)index;
- iconPath = value.Left(pos);
- }
- }
- }
- return true;
-}
-
-bool CheckShellExtensionInfo(const CSysString &extension, UString &iconPath, int &iconIndex)
-{
- NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
- if (!CheckShellExtensionInfo2(extension, iconPath, iconIndex))
- return false;
- CKey extProgKey;
- return (extProgKey.Open(HKEY_CLASSES_ROOT, GetExtProgramKeyName(extension), KEY_READ) == ERROR_SUCCESS);
-}
-
-static void DeleteShellExtensionKey(const CSysString &extension)
-{
- NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
- CKey rootKey;
- rootKey.Attach(HKEY_CLASSES_ROOT);
- rootKey.RecurseDeleteKey(GetExtensionKeyName(extension));
- rootKey.Detach();
-}
-
-static void DeleteShellExtensionProgramKey(const CSysString &extension)
-{
- NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
- CKey rootKey;
- rootKey.Attach(HKEY_CLASSES_ROOT);
- rootKey.RecurseDeleteKey(GetExtProgramKeyName(extension));
- rootKey.Detach();
-}
-
-void DeleteShellExtensionInfo(const CSysString &extension)
-{
- UString iconPath;
- int iconIndex;
- if (CheckShellExtensionInfo2(extension, iconPath, iconIndex))
- DeleteShellExtensionKey(extension);
- DeleteShellExtensionProgramKey(extension);
-}
-
-void AddShellExtensionInfo(const CSysString &extension,
- const UString &programTitle,
- const UString &programOpenCommand,
- const UString &iconPath, int iconIndex,
- const void *shellNewData, int shellNewDataSize)
-{
- DeleteShellExtensionKey(extension);
- DeleteShellExtensionProgramKey(extension);
- NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
- CSysString programKeyName = GetExtProgramKeyName(extension);
- {
- CKey extKey;
- extKey.Create(HKEY_CLASSES_ROOT, GetExtensionKeyName(extension));
- extKey.SetValue(NULL, programKeyName);
- if (shellNewData != NULL)
- {
- CKey shellNewKey;
- shellNewKey.Create(extKey, kShellNewKeyName);
- shellNewKey.SetValue(kShellNewDataValueName, shellNewData, shellNewDataSize);
- }
- }
- CKey programKey;
- programKey.Create(HKEY_CLASSES_ROOT, programKeyName);
- programKey.SetValue(NULL, programTitle);
- {
- CKey iconKey;
- iconKey.Create(programKey, kDefaultIconKeyName);
- UString iconPathFull = iconPath;
- if (iconIndex >= 0)
- {
- iconPathFull += L",";
- wchar_t s[16];
- ConvertUInt32ToString(iconIndex, s);
- iconPathFull += s;
- }
- iconKey.SetValue(NULL, iconPathFull);
- }
-
- CKey shellKey;
- shellKey.Create(programKey, kShellKeyName);
- shellKey.SetValue(NULL, TEXT(""));
-
- CKey openKey;
- openKey.Create(shellKey, kOpenKeyName);
- openKey.SetValue(NULL, TEXT(""));
-
- CKey commandKey;
- commandKey.Create(openKey, kCommandKeyName);
-
- commandKey.SetValue(NULL, programOpenCommand);
-}
-
-///////////////////////////
-// ContextMenu
-/*
-
-static const TCHAR *kContextMenuKeyName = TEXT("\\shellex\\ContextMenuHandlers\\7-ZIP");
-static const TCHAR *kContextMenuHandlerCLASSIDValue =
- TEXT("{23170F69-40C1-278A-1000-000100020000}");
-static const TCHAR *kRootKeyNameForFile = TEXT("*");
-static const TCHAR *kRootKeyNameForFolder = TEXT("Folder");
-
-static CSysString GetFullContextMenuKeyName(const CSysString &aKeyName)
- { return (aKeyName + kContextMenuKeyName); }
-
-static bool CheckContextMenuHandlerCommon(const CSysString &aKeyName)
-{
- NSynchronization::CCriticalSectionLock lock(&g_CriticalSection, true);
- CKey aKey;
- if (aKey.Open(HKEY_CLASSES_ROOT, GetFullContextMenuKeyName(aKeyName), KEY_READ)
- != ERROR_SUCCESS)
- return false;
- CSysString aValue;
- if (aKey.QueryValue(NULL, aValue) != ERROR_SUCCESS)
- return false;
- return (aValue.CompareNoCase(kContextMenuHandlerCLASSIDValue) == 0);
-}
-
-bool CheckContextMenuHandler()
-{
- return CheckContextMenuHandlerCommon(kRootKeyNameForFile) &&
- CheckContextMenuHandlerCommon(kRootKeyNameForFolder);
-}
-
-static void DeleteContextMenuHandlerCommon(const CSysString &aKeyName)
-{
- CKey rootKey;
- rootKey.Attach(HKEY_CLASSES_ROOT);
- rootKey.RecurseDeleteKey(GetFullContextMenuKeyName(aKeyName));
- rootKey.Detach();
-}
-
-void DeleteContextMenuHandler()
-{
- DeleteContextMenuHandlerCommon(kRootKeyNameForFile);
- DeleteContextMenuHandlerCommon(kRootKeyNameForFolder);
-}
-
-static void AddContextMenuHandlerCommon(const CSysString &aKeyName)
-{
- DeleteContextMenuHandlerCommon(aKeyName);
- NSynchronization::CCriticalSectionLock lock(&g_CriticalSection, true);
- CKey aKey;
- aKey.Create(HKEY_CLASSES_ROOT, GetFullContextMenuKeyName(aKeyName));
- aKey.SetValue(NULL, kContextMenuHandlerCLASSIDValue);
-}
-
-void AddContextMenuHandler()
-{
- AddContextMenuHandlerCommon(kRootKeyNameForFile);
- AddContextMenuHandlerCommon(kRootKeyNameForFolder);
-}
-*/
-
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryAssociations.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryAssociations.h
deleted file mode 100644
index 2516fd2b6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryAssociations.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// RegistryAssociations.h
-
-#ifndef __REGISTRYASSOCIATIONS_H
-#define __REGISTRYASSOCIATIONS_H
-
-#include "Common/MyString.h"
-
-namespace NRegistryAssociations {
-
- struct CExtInfo
- {
- UString Ext;
- UStringVector Plugins;
- // bool Enabled;
- };
- bool ReadInternalAssociation(const wchar_t *ext, CExtInfo &extInfo);
- void ReadInternalAssociations(CObjectVector<CExtInfo> &items);
- void WriteInternalAssociations(const CObjectVector<CExtInfo> &items);
-
- bool CheckShellExtensionInfo(const CSysString &extension, UString &iconPath, int &iconIndex);
-
- // void ReadCompressionInfo(NZipSettings::NCompression::CInfo &anInfo,
- void DeleteShellExtensionInfo(const CSysString &extension);
-
- void AddShellExtensionInfo(const CSysString &extension,
- const UString &programTitle,
- const UString &programOpenCommand,
- const UString &iconPath, int iconIndex,
- const void *shellNewData, int shellNewDataSize);
-
-
- ///////////////////////////
- // ContextMenu
- /*
- bool CheckContextMenuHandler();
- void AddContextMenuHandler();
- void DeleteContextMenuHandler();
- */
-
-}
-
-// bool GetProgramDirPrefix(CSysString &aFolder);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryPlugins.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryPlugins.h
deleted file mode 100644
index 77055ac77..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryPlugins.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// RegistryPlugins.h
-
-#ifndef __REGISTRYPLUGINS_H
-#define __REGISTRYPLUGINS_H
-
-#include "Common/MyString.h"
-
-enum EPluginType
-{
- kPluginTypeFF = 0
-};
-
-struct CPluginInfo
-{
- UString FilePath;
- EPluginType Type;
- UString Name;
- CLSID ClassID;
- CLSID OptionsClassID;
- bool ClassIDDefined;
- bool OptionsClassIDDefined;
-
- // CSysString Extension;
- // CSysString AddExtension;
- // bool UpdateEnabled;
- // bool KeepName;
-};
-
-void ReadPluginInfoList(CObjectVector<CPluginInfo> &plugins);
-void ReadFileFolderPluginInfoList(CObjectVector<CPluginInfo> &plugins);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryUtils.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryUtils.cpp
deleted file mode 100644
index f071a9c95..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryUtils.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-// RegistryUtils.cpp
-
-#include "StdAfx.h"
-
-#include "RegistryUtils.h"
-#include "Windows/Registry.h"
-
-using namespace NWindows;
-using namespace NRegistry;
-
-#define REG_PATH_7Z TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-ZIP")
-
-static const TCHAR *kCUBasePath = REG_PATH_7Z;
-static const TCHAR *kCU_FMPath = REG_PATH_7Z TEXT(STRING_PATH_SEPARATOR) TEXT("FM");
-// static const TCHAR *kLM_Path = REG_PATH_7Z TEXT(STRING_PATH_SEPARATOR) TEXT("FM");
-
-static const WCHAR *kLangValueName = L"Lang";
-static const WCHAR *kEditor = L"Editor";
-static const TCHAR *kShowDots = TEXT("ShowDots");
-static const TCHAR *kShowRealFileIcons = TEXT("ShowRealFileIcons");
-static const TCHAR *kShowSystemMenu = TEXT("ShowSystemMenu");
-
-static const TCHAR *kFullRow = TEXT("FullRow");
-static const TCHAR *kShowGrid = TEXT("ShowGrid");
-static const TCHAR *kAlternativeSelection = TEXT("AlternativeSelection");
-// static const TCHAR *kLockMemoryAdd = TEXT("LockMemoryAdd");
-static const TCHAR *kLargePagesEnable = TEXT("LargePages");
-// static const TCHAR *kSingleClick = TEXT("SingleClick");
-// static const TCHAR *kUnderline = TEXT("Underline");
-
-void SaveRegLang(const UString &langFile)
-{
- CKey key;
- key.Create(HKEY_CURRENT_USER, kCUBasePath);
- key.SetValue(kLangValueName, langFile);
-}
-
-void ReadRegLang(UString &langFile)
-{
- langFile.Empty();
- CKey key;
- if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) == ERROR_SUCCESS)
- key.QueryValue(kLangValueName, langFile);
-}
-
-void SaveRegEditor(const UString &editorPath)
-{
- CKey key;
- key.Create(HKEY_CURRENT_USER, kCU_FMPath);
- key.SetValue(kEditor, editorPath);
-}
-
-void ReadRegEditor(UString &editorPath)
-{
- editorPath.Empty();
- CKey key;
- if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS)
- key.QueryValue(kEditor, editorPath);
-}
-
-static void Save7ZipOption(const TCHAR *value, bool enabled)
-{
- CKey key;
- key.Create(HKEY_CURRENT_USER, kCUBasePath);
- key.SetValue(value, enabled);
-}
-
-static void SaveOption(const TCHAR *value, bool enabled)
-{
- CKey key;
- key.Create(HKEY_CURRENT_USER, kCU_FMPath);
- key.SetValue(value, enabled);
-}
-
-static bool Read7ZipOption(const TCHAR *value, bool defaultValue)
-{
- CKey key;
- if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) == ERROR_SUCCESS)
- {
- bool enabled;
- if (key.QueryValue(value, enabled) == ERROR_SUCCESS)
- return enabled;
- }
- return defaultValue;
-}
-
-static bool ReadOption(const TCHAR *value, bool defaultValue)
-{
- CKey key;
- if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS)
- {
- bool enabled;
- if (key.QueryValue(value, enabled) == ERROR_SUCCESS)
- return enabled;
- }
- return defaultValue;
-}
-
-/*
-static void SaveLmOption(const TCHAR *value, bool enabled)
-{
- CKey key;
- key.Create(HKEY_LOCAL_MACHINE, kLM_Path);
- key.SetValue(value, enabled);
-}
-
-static bool ReadLmOption(const TCHAR *value, bool defaultValue)
-{
- CKey key;
- if (key.Open(HKEY_LOCAL_MACHINE, kLM_Path, KEY_READ) == ERROR_SUCCESS)
- {
- bool enabled;
- if (key.QueryValue(value, enabled) == ERROR_SUCCESS)
- return enabled;
- }
- return defaultValue;
-}
-*/
-
-void SaveShowDots(bool showDots) { SaveOption(kShowDots, showDots); }
-bool ReadShowDots() { return ReadOption(kShowDots, false); }
-
-void SaveShowRealFileIcons(bool show) { SaveOption(kShowRealFileIcons, show); }
-bool ReadShowRealFileIcons() { return ReadOption(kShowRealFileIcons, false); }
-
-void SaveShowSystemMenu(bool show) { SaveOption(kShowSystemMenu, show); }
-bool ReadShowSystemMenu(){ return ReadOption(kShowSystemMenu, false); }
-
-void SaveFullRow(bool enable) { SaveOption(kFullRow, enable); }
-bool ReadFullRow() { return ReadOption(kFullRow, false); }
-
-void SaveShowGrid(bool enable) { SaveOption(kShowGrid, enable); }
-bool ReadShowGrid(){ return ReadOption(kShowGrid, false); }
-
-void SaveAlternativeSelection(bool enable) { SaveOption(kAlternativeSelection, enable); }
-bool ReadAlternativeSelection(){ return ReadOption(kAlternativeSelection, false); }
-
-/*
-void SaveSingleClick(bool enable) { SaveOption(kSingleClick, enable); }
-bool ReadSingleClick(){ return ReadOption(kSingleClick, false); }
-
-void SaveUnderline(bool enable) { SaveOption(kUnderline, enable); }
-bool ReadUnderline(){ return ReadOption(kUnderline, false); }
-*/
-
-// void SaveLockMemoryAdd(bool enable) { SaveLmOption(kLockMemoryAdd, enable); }
-// bool ReadLockMemoryAdd() { return ReadLmOption(kLockMemoryAdd, true); }
-
-void SaveLockMemoryEnable(bool enable) { Save7ZipOption(kLargePagesEnable, enable); }
-bool ReadLockMemoryEnable() { return Read7ZipOption(kLargePagesEnable, false); }
-
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryUtils.h
deleted file mode 100644
index 0fec6f80c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RegistryUtils.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// RegistryUtils.h
-
-#include "Common/StringConvert.h"
-
-#ifndef __REGISTRYUTILS_H
-#define __REGISTRYUTILS_H
-
-void SaveRegLang(const UString &langFile);
-void ReadRegLang(UString &langFile);
-
-void SaveRegEditor(const UString &editorPath);
-void ReadRegEditor(UString &editorPath);
-
-void SaveShowDots(bool showDots);
-bool ReadShowDots();
-
-void SaveShowRealFileIcons(bool show);
-bool ReadShowRealFileIcons();
-
-void SaveShowSystemMenu(bool showSystemMenu);
-bool ReadShowSystemMenu();
-
-void SaveFullRow(bool enable);
-bool ReadFullRow();
-
-void SaveShowGrid(bool enable);
-bool ReadShowGrid();
-
-void SaveAlternativeSelection(bool enable);
-bool ReadAlternativeSelection();
-
-// void SaveLockMemoryAdd(bool enable);
-// bool ReadLockMemoryAdd();
-
-bool ReadLockMemoryEnable();
-void SaveLockMemoryEnable(bool enable);
-
-/*
-void SaveSingleClick(bool enable);
-bool ReadSingleClick();
-
-void SaveUnderline(bool enable);
-bool ReadUnderline();
-*/
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RootFolder.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RootFolder.cpp
deleted file mode 100644
index bf9083bc4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RootFolder.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-// RootFolder.cpp
-
-#include "StdAfx.h"
-
-#include "resource.h"
-
-#include "RootFolder.h"
-
-#include "Common/StringConvert.h"
-#include "../../PropID.h"
-#include "Windows/Defs.h"
-#include "Windows/PropVariant.h"
-
-#ifdef _WIN32
-#include "FSDrives.h"
-#include "PhysDriveFolder.h"
-#include "NetFolder.h"
-#endif
-#include "SysIconUtils.h"
-#include "LangUtils.h"
-
-using namespace NWindows;
-
-
-static const STATPROPSTG kProperties[] =
-{
- { NULL, kpidName, VT_BSTR}
-};
-
-// static const wchar_t *kMyComputerTitle = L"Computer";
-// static const wchar_t *kMyNetworkTitle = L"Network";
-
-#ifdef _WIN32
-UString RootFolder_GetName_Computer(int &iconIndex)
-{
- iconIndex = GetIconIndexForCSIDL(CSIDL_DRIVES);
- return LangString(IDS_COMPUTER, 0x03020300);
-}
-
-UString RootFolder_GetName_Network(int &iconIndex)
-{
- iconIndex = GetIconIndexForCSIDL(CSIDL_NETWORK);
- return LangString(IDS_NETWORK, 0x03020301);
-}
-
-UString RootFolder_GetName_Documents(int &iconIndex)
-{
- iconIndex = GetIconIndexForCSIDL(CSIDL_PERSONAL);
- return LangString(IDS_DOCUMENTS, 0x03020302); ;
-}
-
-const int ROOT_INDEX_COMPUTER = 0;
-const int ROOT_INDEX_DOCUMENTS = 1;
-const int ROOT_INDEX_NETWORK = 2;
-
-void CRootFolder::Init()
-{
- _names[ROOT_INDEX_COMPUTER] = RootFolder_GetName_Computer(_iconIndices[ROOT_INDEX_COMPUTER]);
- _names[ROOT_INDEX_DOCUMENTS] = RootFolder_GetName_Documents(_iconIndices[ROOT_INDEX_DOCUMENTS]);
- _names[ROOT_INDEX_NETWORK] = RootFolder_GetName_Network(_iconIndices[ROOT_INDEX_NETWORK]);
-};
-#else
-void CRootFolder::Init()
-{
-}
-#endif
-
-STDMETHODIMP CRootFolder::LoadItems()
-{
- Init();
- return S_OK;
-}
-
-STDMETHODIMP CRootFolder::GetNumberOfItems(UInt32 *numItems)
-{
-#ifdef _WIN32
- *numItems = kNumRootFolderItems;
-#else
- *numItems = 1; // only "/" !
-#endif
- return S_OK;
-}
-
-STDMETHODIMP CRootFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
-{
- NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidIsDir: prop = true; break;
-#ifdef _WIN32
- case kpidName: prop = _names[itemIndex]; break;
-#else
- case kpidName: prop = L"/"; break;
-#endif
- }
- prop.Detach(value);
- return S_OK;
-}
-
-#ifdef _WIN32
-UString GetMyDocsPath()
-{
- UString us;
- WCHAR s[MAX_PATH + 1];
- if (SHGetSpecialFolderPathW(0, s, CSIDL_PERSONAL, FALSE))
- us = s;
- #ifndef _UNICODE
- else
- {
- CHAR s2[MAX_PATH + 1];
- if (SHGetSpecialFolderPathA(0, s2, CSIDL_PERSONAL, FALSE))
- us = GetUnicodeString(s2);
- }
- #endif
- if (us.Length() > 0 && us[us.Length() - 1] != L'\\')
- us += L'\\';
- return us;
-}
-#endif
-
-STDMETHODIMP CRootFolder::BindToFolder(UInt32 index, IFolderFolder **resultFolder)
-{
-#ifdef _WIN32
- if (index == ROOT_INDEX_COMPUTER)
- {
- CFSDrives *fsDrivesSpec = new CFSDrives;
- CMyComPtr<IFolderFolder> subFolder = fsDrivesSpec;
- fsDrivesSpec->Init();
- *resultFolder = subFolder.Detach();
- }
- else if (index == ROOT_INDEX_NETWORK)
- {
- CNetFolder *netFolderSpec = new CNetFolder;
- CMyComPtr<IFolderFolder> subFolder = netFolderSpec;
- netFolderSpec->Init(0, 0, _names[ROOT_INDEX_NETWORK] + L'\\');
- *resultFolder = subFolder.Detach();
- }
- else if (index == ROOT_INDEX_DOCUMENTS)
- {
- UString s = GetMyDocsPath();
- if (!s.IsEmpty())
- {
- NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
- CMyComPtr<IFolderFolder> subFolder = fsFolderSpec;
- RINOK(fsFolderSpec->Init(s, NULL));
- *resultFolder = subFolder.Detach();
- }
- }
- else
- return E_INVALIDARG;
- return S_OK;
-#else
- return E_INVALIDARG;
-#endif
-}
-
-static bool AreEqualNames(const UString &name1, const UString &name2)
-{
- return (name1 == name2 || name1 == (name2 + UString(WCHAR_PATH_SEPARATOR)));
-}
-
-STDMETHODIMP CRootFolder::BindToFolder(const wchar_t *name, IFolderFolder **resultFolder)
-{
- *resultFolder = 0;
- UString name2 = name;
- name2.Trim();
- if (name2.IsEmpty())
- {
- CRootFolder *rootFolderSpec = new CRootFolder;
- CMyComPtr<IFolderFolder> rootFolder = rootFolderSpec;
- rootFolderSpec->Init();
- *resultFolder = rootFolder.Detach();
- return S_OK;
- }
-#ifdef _WIN32
- for (int i = 0; i < kNumRootFolderItems; i++)
- if (AreEqualNames(name2, _names[i]))
- return BindToFolder((UInt32)i, resultFolder);
- if (AreEqualNames(name2, L"My Documents") ||
- AreEqualNames(name2, L"Documents"))
- return BindToFolder((UInt32)ROOT_INDEX_DOCUMENTS, resultFolder);
- if (AreEqualNames(name2, L"My Computer") ||
- AreEqualNames(name2, L"Computer"))
- return BindToFolder((UInt32)ROOT_INDEX_COMPUTER, resultFolder);
-#endif
- if (name2 == UString(WCHAR_PATH_SEPARATOR))
- {
- CMyComPtr<IFolderFolder> subFolder = this;
- *resultFolder = subFolder.Detach();
- return S_OK;
- }
-
- if (name2.Length () < 2)
- return E_INVALIDARG;
-
- CMyComPtr<IFolderFolder> subFolder;
-
-#ifdef _WIN32
- if (name2.Left(4) == L"\\\\.\\")
- {
- CPhysDriveFolder *folderSpec = new CPhysDriveFolder;
- subFolder = folderSpec;
- RINOK(folderSpec->Init(name2.Mid(4, 2)));
- }
- else
-#endif
- {
- if (name2[name2.Length () - 1] != WCHAR_PATH_SEPARATOR)
- name2 += WCHAR_PATH_SEPARATOR;
- NFsFolder::CFSFolder *fsFolderSpec = new NFsFolder::CFSFolder;
- subFolder = fsFolderSpec;
- if (fsFolderSpec->Init(name2, 0) != S_OK)
- {
-#ifdef _WIN32
- if (name2[0] == WCHAR_PATH_SEPARATOR)
- {
- CNetFolder *netFolderSpec = new CNetFolder;
- subFolder = netFolderSpec;
- netFolderSpec->Init(name2);
- }
- else
-#endif
- return E_INVALIDARG;
- }
- }
- *resultFolder = subFolder.Detach();
- return S_OK;
-}
-
-STDMETHODIMP CRootFolder::BindToParentFolder(IFolderFolder **resultFolder)
-{
- *resultFolder = 0;
- return S_OK;
-}
-
-STDMETHODIMP CRootFolder::GetNumberOfProperties(UInt32 *numProperties)
-{
- *numProperties = sizeof(kProperties) / sizeof(kProperties[0]);
- return S_OK;
-}
-
-STDMETHODIMP CRootFolder::GetPropertyInfo(UInt32 index,
- BSTR *name, PROPID *propID, VARTYPE *varType)
-{
- if (index >= sizeof(kProperties) / sizeof(kProperties[0]))
- return E_INVALIDARG;
- const STATPROPSTG &prop = kProperties[index];
- *propID = prop.propid;
- *varType = prop.vt;
- *name = 0;
- return S_OK;
-}
-
-STDMETHODIMP CRootFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value)
-{
- NWindows::NCOM::CPropVariant prop;
- switch(propID)
- {
- case kpidType: prop = L"RootFolder"; break;
- case kpidPath: prop = L""; break;
- }
- prop.Detach(value);
- return S_OK;
-}
-
-STDMETHODIMP CRootFolder::GetSystemIconIndex(UInt32 index, INT32 *iconIndex)
-{
-#ifdef _WIN32
- *iconIndex = _iconIndices[index];
-#else
- *iconIndex = -1; // FIXME - folder icon ?
-#endif
- return S_OK;
-}
-
-
-
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RootFolder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RootFolder.h
deleted file mode 100644
index a65bb7601..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/RootFolder.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// RootFolder.h
-
-#ifndef __ROOTFOLDER_H
-#define __ROOTFOLDER_H
-
-#include "Common/MyString.h"
-
-#include "Windows/PropVariant.h"
-
-#include "FSFolder.h"
-
-#ifdef _WIN32
-const int kNumRootFolderItems = 3;
-#endif
-
-class CRootFolder:
- public IFolderFolder,
- public IFolderGetSystemIconIndex,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP1(
- IFolderGetSystemIconIndex
- )
-
- INTERFACE_FolderFolder(;)
-
- STDMETHOD(GetSystemIconIndex)(UInt32 index, INT32 *iconIndex);
-
- void Init();
-private:
-#ifdef _WIN32
- UString _names[kNumRootFolderItems];
- int _iconIndices[kNumRootFolderItems];
-#endif
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialog.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialog.cpp
deleted file mode 100644
index bab319d19..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialog.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-// SplitDialog.cpp
-
-#include "StdAfx.h"
-#include "SplitDialog.h"
-
-#include "Common/StringToInt.h"
-#include "Windows/Shell.h"
-#include "Windows/FileName.h"
-
-#include "SplitUtils.h"
-#ifdef LANG
-#include "LangUtils.h"
-#endif
-
-#include "CopyDialogRes.h"
-
-using namespace NWindows;
-
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDC_STATIC_SPLIT_PATH, 0x03020501 },
- { IDC_STATIC_SPLIT_VOLUME, 0x02000D40 },
-};
-#endif
-
-
-bool CSplitDialog::OnInit()
-{
- #ifdef LANG
- LangSetWindowText(HWND(*this), 0x03020500);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- #endif
- _pathCombo.Attach(GetItem(IDC_COMBO_SPLIT_PATH));
- _volumeCombo.Attach(GetItem(IDC_COMBO_SPLIT_VOLUME));
-
- if (!FilePath.IsEmpty())
- {
- UString title;
- GetText(title);
- title += L' ';
- title += FilePath;
- SetText(title);
- }
- _pathCombo.SetText(Path);
- AddVolumeItems(_volumeCombo);
- _volumeCombo.SetCurSel(0);
- return CModalDialog::OnInit();
-}
-
-bool CSplitDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
- switch(buttonID)
- {
- case IDC_BUTTON_SPLIT_PATH:
- OnButtonSetPath();
- return true;
- }
- return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
-}
-
-void CSplitDialog::OnButtonSetPath()
-{
- UString currentPath;
- _pathCombo.GetText(currentPath);
- // UString title = L"Specify a location for output folder";
- UString title = LangStringSpec(IDS_SET_FOLDER, 0x03020209);
-
- UString resultPath;
- if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
- return;
- NFile::NName::NormalizeDirPathPrefix(resultPath);
- _pathCombo.SetCurSel(-1);
- _pathCombo.SetText(resultPath);
-}
-
-void CSplitDialog::OnOK()
-{
- _pathCombo.GetText(Path);
- UString volumeString;
- _volumeCombo.GetText(volumeString);
- volumeString.Trim();
- if (!ParseVolumeSizes(volumeString, VolumeSizes) || VolumeSizes.Size() == 0)
- {
- ::MessageBoxW(*this, LangString(IDS_COMPRESS_INCORRECT_VOLUME_SIZE, 0x02000D41), L"7-Zip", 0);
- return;
- }
- CModalDialog::OnOK();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialog.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialog.h
deleted file mode 100644
index 607a3daf5..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialog.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// SplitDialog.h
-
-#ifndef __SPLITDIALOG_H
-#define __SPLITDIALOG_H
-
-#include "Common/Types.h"
-#include "Windows/Control/Dialog.h"
-#include "Windows/Control/ComboBox.h"
-#include "SplitDialogRes.h"
-
-class CSplitDialog: public NWindows::NControl::CModalDialog
-{
- NWindows::NControl::CComboBox _pathCombo;
- NWindows::NControl::CComboBox _volumeCombo;
- virtual void OnOK();
- virtual bool OnInit();
- virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
- void OnButtonSetPath();
-public:
- UString FilePath;
- UString Path;
- CRecordVector<UInt64> VolumeSizes;
- INT_PTR Create(HWND parentWindow = 0)
- { return CModalDialog::Create(IDD_DIALOG_SPLIT, parentWindow); }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialogRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialogRes.h
deleted file mode 100644
index 019b70292..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialogRes.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#define IDD_DIALOG_SPLIT 504
-#define IDC_STATIC_SPLIT_PATH 1000
-#define IDC_COMBO_SPLIT_PATH 1001
-#define IDC_BUTTON_SPLIT_PATH 1002
-#define IDC_STATIC_SPLIT_VOLUME 1010
-#define IDC_COMBO_SPLIT_VOLUME 1011
-
-#define IDS_COMPRESS_INCORRECT_VOLUME_SIZE 95
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialog_rc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialog_rc.cpp
deleted file mode 100644
index 848b84ad7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitDialog_rc.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-// PasswordDialog.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#include "Windows/Control/DialogImpl.h"
-
-#include "SplitDialogRes.h"
-
-class CSplitDialogImpl : public NWindows::NControl::CModalDialogImpl
-{
- public:
- CSplitDialogImpl(NWindows::NControl::CModalDialog *dialog,wxWindow * parent,int id) : CModalDialogImpl(dialog, parent, id, wxT("Split File"))
- {
-
- wxArrayString pathArray;
-
- wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
-
-
- topsizer->Add(new wxStaticText(this, IDC_STATIC_SPLIT_PATH, _T("&Split to:")) , 0 ,wxALL | wxALIGN_LEFT, 5 );
-
-
- {
- wxBoxSizer *pathSizer = new wxBoxSizer(wxHORIZONTAL);
-
- wxComboBox *combo = new wxComboBox(this, IDC_COMBO_SPLIT_PATH, wxEmptyString, wxDefaultPosition, wxSize(600,-1), pathArray, wxCB_DROPDOWN|wxCB_SORT);
- wxButton *button = new wxButton(this, IDC_BUTTON_SPLIT_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
- pathSizer->Add(combo, 1, wxLEFT|wxRIGHT|wxEXPAND, 5);
- pathSizer->Add(button, 0, wxLEFT|wxRIGHT|wxEXPAND, 5);
-
- topsizer->Add(pathSizer, 0 ,wxALL | wxALIGN_LEFT, 5 );
- }
-
- topsizer->Add(new wxStaticText(this, IDC_STATIC_SPLIT_VOLUME, _T("Split to &volumes, bytes:")) , 0 ,wxALL | wxALIGN_LEFT, 5 );
-
- wxComboBox *combo = new wxComboBox(this, IDC_COMBO_SPLIT_VOLUME, wxEmptyString, wxDefaultPosition, wxSize(600,-1), pathArray, wxCB_DROPDOWN|wxCB_SORT);
-
- topsizer->Add(combo, 0 ,wxALL | wxALIGN_LEFT, 5 );
-
-
- topsizer->Add(CreateButtonSizer(wxOK|wxCANCEL), 0, wxALL|wxEXPAND, 5);
-
- this->OnInit();
-
- SetSizer(topsizer); // use the sizer for layout
- topsizer->SetSizeHints(this); // set size hints to honour minimum size
- }
-private:
- // Any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-static CStringTable g_stringTable[] =
-{
- { IDS_COMPRESS_INCORRECT_VOLUME_SIZE, L"Incorrect volume size" },
- { 0 , 0 }
-};
-
-
-REGISTER_DIALOG(IDD_DIALOG_SPLIT,CSplitDialog,g_stringTable)
-
-BEGIN_EVENT_TABLE(CSplitDialogImpl, wxDialog)
- EVT_BUTTON(wxID_ANY, CModalDialogImpl::OnAnyButton)
- EVT_CHECKBOX(wxID_ANY, CModalDialogImpl::OnAnyButton)
-END_EVENT_TABLE()
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitUtils.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitUtils.cpp
deleted file mode 100644
index 3a7635fa1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitUtils.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-// SplitUtils.cpp
-
-#include "StdAfx.h"
-
-#include "Common/StringToInt.h"
-
-#include "SplitUtils.h"
-#include "StringUtils.h"
-
-bool ParseVolumeSizes(const UString &s, CRecordVector<UInt64> &values)
-{
- values.Clear();
- UStringVector destStrings;
- SplitString(s, destStrings);
- bool prevIsNumber = false;
- for (int i = 0; i < destStrings.Size(); i++)
- {
- UString subString = destStrings[i];
- subString.MakeUpper();
- if (subString.IsEmpty())
- return false;
- if (subString == L"-")
- return true;
- if (prevIsNumber)
- {
- wchar_t c = subString[0];
- UInt64 &value = values.Back();
- prevIsNumber = false;
- switch(c)
- {
- case L'B':
- continue;
- case L'K':
- value <<= 10;
- continue;
- case L'M':
- value <<= 20;
- continue;
- case L'G':
- value <<= 30;
- continue;
- }
- }
- const wchar_t *start = subString;
- const wchar_t *end;
- UInt64 value = ConvertStringToUInt64(start, &end);
- if (start == end)
- return false;
- if (value == 0)
- return false;
- values.Add(value);
- prevIsNumber = true;
- UString rem = subString.Mid((int)(end - start));
- if (!rem.IsEmpty())
- destStrings.Insert(i + 1, rem);
- }
- return true;
-}
-
-void AddVolumeItems(NWindows::NControl::CComboBox &volumeCombo)
-{
- volumeCombo.AddString(TEXT("1457664 - 3.5\" floppy"));
- volumeCombo.AddString(TEXT("650M - CD"));
- volumeCombo.AddString(TEXT("700M - CD"));
- volumeCombo.AddString(TEXT("4480M - DVD"));
-}
-
-UInt64 GetNumberOfVolumes(UInt64 size, CRecordVector<UInt64> &volSizes)
-{
- if (size == 0 || volSizes.Size() == 0)
- return 1;
- UInt64 numVolumes = 0;
- for (int i = 0; i < volSizes.Size(); i++)
- {
- UInt64 volSize = volSizes[i];
- numVolumes++;
- if (volSize >= size)
- return numVolumes;
- size -= volSize;
- }
- UInt64 volSize = volSizes.Back();
- if (volSize == 0)
- return (UInt64)(Int64)-1;
- return numVolumes + (size - 1) / volSize + 1;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitUtils.h
deleted file mode 100644
index 755c707c3..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SplitUtils.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// SplitUtils.h
-
-#ifndef __SPLITUTILS_H
-#define __SPLITUTILS_H
-
-#include "Common/MyString.h"
-#include "Common/Types.h"
-#include "Windows/Control/ComboBox.h"
-
-bool ParseVolumeSizes(const UString &s, CRecordVector<UInt64> &values);
-void AddVolumeItems(NWindows::NControl::CComboBox &volumeCombo);
-
-UInt64 GetNumberOfVolumes(UInt64 size, CRecordVector<UInt64> &volSizes);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/StringUtils.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/StringUtils.cpp
deleted file mode 100644
index bddaa971e..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/StringUtils.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// StringUtils.cpp
-
-#include "StdAfx.h"
-
-#include "StringUtils.h"
-
-void SplitStringToTwoStrings(const UString &src, UString &dest1, UString &dest2)
-{
- dest1.Empty();
- dest2.Empty();
- bool quoteMode = false;
- int i;
- for (i = 0; i < src.Length(); i++)
- {
- wchar_t c = src[i];
- if (c == L'\"')
- quoteMode = !quoteMode;
- else if (c == L' ' && !quoteMode)
- {
- if (!quoteMode)
- {
- i++;
- break;
- }
- }
- else
- dest1 += c;
- }
- dest2 = src.Mid(i);
-}
-
-void SplitString(const UString &srcString, UStringVector &destStrings)
-{
- destStrings.Clear();
- UString string;
- int len = srcString.Length();
- if (len == 0)
- return;
- for (int i = 0; i < len; i++)
- {
- wchar_t c = srcString[i];
- if (c == L' ')
- {
- if (!string.IsEmpty())
- {
- destStrings.Add(string);
- string.Empty();
- }
- }
- else
- string += c;
- }
- if (!string.IsEmpty())
- destStrings.Add(string);
-}
-
-UString JoinStrings(const UStringVector &srcStrings)
-{
- UString destString;
- for (int i = 0; i < srcStrings.Size(); i++)
- {
- if (i != 0)
- destString += L' ';
- destString += srcStrings[i];
- }
- return destString;
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/StringUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/StringUtils.h
deleted file mode 100644
index 7f72b7641..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/StringUtils.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// StringUtils.h
-
-#ifndef __STRINGUTILS_H
-#define __STRINGUTILS_H
-
-#include "Common/MyString.h"
-
-void SplitStringToTwoStrings(const UString &src, UString &dest1, UString &dest2);
-
-void SplitString(const UString &srcString, UStringVector &destStrings);
-UString JoinStrings(const UStringVector &srcStrings);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SysIconUtils.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SysIconUtils.cpp
deleted file mode 100644
index d177b66e1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SysIconUtils.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-// SysIconUtils.h
-
-#include "StdAfx.h"
-
-#include "SysIconUtils.h"
-#ifndef _UNICODE
-#include "Common/StringConvert.h"
-#endif
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-int GetIconIndexForCSIDL(int csidl)
-{
-#ifdef _WIN32
- LPITEMIDLIST pidl = 0;
- SHGetSpecialFolderLocation(NULL, csidl, &pidl);
- if (pidl)
- {
- SHFILEINFO shellInfo;
- SHGetFileInfo(LPCTSTR(pidl), FILE_ATTRIBUTE_NORMAL,
- &shellInfo, sizeof(shellInfo),
- SHGFI_PIDL | SHGFI_SYSICONINDEX);
- IMalloc *pMalloc;
- SHGetMalloc(&pMalloc);
- if(pMalloc)
- {
- pMalloc->Free(pidl);
- pMalloc->Release();
- }
- return shellInfo.iIcon;
- }
-#endif // FIXME -1 ?
- return 0;
-}
-
-DWORD_PTR GetRealIconIndex(LPCTSTR path, DWORD attributes, int &iconIndex)
-{
-#ifdef _WIN32
- SHFILEINFO shellInfo;
- DWORD_PTR res = ::SHGetFileInfo(path, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
- sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX);
- iconIndex = shellInfo.iIcon;
- return res;
-#else
- return -1;
-#endif
-}
-
-
-#ifdef _WIN32
-
-#ifndef _UNICODE
-typedef int (WINAPI * SHGetFileInfoWP)(LPCWSTR pszPath, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags);
-
-struct CSHGetFileInfoInit
-{
- SHGetFileInfoWP shGetFileInfoW;
- CSHGetFileInfoInit()
- {
- shGetFileInfoW = (SHGetFileInfoWP)
- ::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHGetFileInfoW");
- }
-} g_SHGetFileInfoInit;
-#endif
-
-DWORD_PTR MySHGetFileInfoW(LPCWSTR pszPath, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags)
-{
- #ifdef _UNICODE
- return SHGetFileInfoW(
- #else
- if (g_SHGetFileInfoInit.shGetFileInfoW == 0)
- return 0;
- return g_SHGetFileInfoInit.shGetFileInfoW(
- #endif
- pszPath, dwFileAttributes, psfi, cbFileInfo, uFlags);
-}
-
-#ifndef _UNICODE
-// static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
-DWORD_PTR GetRealIconIndex(LPCWSTR path, DWORD attributes, int &iconIndex)
-{
- if(g_IsNT)
- {
- SHFILEINFOW shellInfo;
- DWORD_PTR res = ::MySHGetFileInfoW(path, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
- sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX);
- iconIndex = shellInfo.iIcon;
- return res;
- }
- else
- return GetRealIconIndex(UnicodeStringToMultiByte(path), attributes, iconIndex);
-}
-#endif
-
-DWORD_PTR GetRealIconIndex(const UString &fileName, DWORD attributes,
- int &iconIndex, UString &typeName)
-{
- #ifndef _UNICODE
- if(!g_IsNT)
- {
- SHFILEINFO shellInfo;
- shellInfo.szTypeName[0] = 0;
- DWORD_PTR res = ::SHGetFileInfoA(GetSystemString(fileName), FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
- sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX
- | SHGFI_TYPENAME);
- typeName = GetUnicodeString(shellInfo.szTypeName);
- iconIndex = shellInfo.iIcon;
- return res;
- }
- else
- #endif
- {
- SHFILEINFOW shellInfo;
- shellInfo.szTypeName[0] = 0;
- DWORD_PTR res = ::MySHGetFileInfoW(fileName, FILE_ATTRIBUTE_NORMAL | attributes, &shellInfo,
- sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX
- | SHGFI_TYPENAME);
- typeName = shellInfo.szTypeName;
- iconIndex = shellInfo.iIcon;
- return res;
- }
-}
-
-int CExtToIconMap::GetIconIndex(UINT32 attributes, const UString &fileNameSpec, UString &typeName)
-{
- UString fileName = fileNameSpec;
- if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
- {
- fileName = L"__Fldr__";
- if (_dirIconIndex < 0)
- GetRealIconIndex(fileName, attributes, _dirIconIndex, _dirTypeName);
- typeName = _dirTypeName;
- return _dirIconIndex;
- }
- int dotPos = fileName.ReverseFind('.');
- if (dotPos < 0)
- {
- fileName = L"__File__";
- if (_noExtIconIndex < 0)
- {
- int iconIndexTemp;
- GetRealIconIndex(fileName, attributes, iconIndexTemp, _noExtTypeName);
- }
- typeName = _noExtTypeName;
- return _noExtIconIndex;
- }
- CExtIconPair extIconPair;
- extIconPair.Ext = fileName.Mid(dotPos + 1);
- int anIndex = _map.FindInSorted(extIconPair);
- if (anIndex >= 0)
- return _map[anIndex].IconIndex;
- fileName = fileName.Mid(dotPos);
- GetRealIconIndex(fileName, attributes, extIconPair.IconIndex, extIconPair.TypeName);
- _map.AddToSorted(extIconPair);
- typeName = extIconPair.TypeName;
- return extIconPair.IconIndex;
-}
-
-int CExtToIconMap::GetIconIndex(UINT32 attributes, const UString &fileName)
-{
- UString typeName;
- return GetIconIndex(attributes, fileName, typeName);
-}
-#endif
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SysIconUtils.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SysIconUtils.h
deleted file mode 100644
index a90d28bc2..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/SysIconUtils.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// SysIconUtils.h
-
-#ifndef __SYSICONUTILS_H
-#define __SYSICONUTILS_H
-
-#include "Common/MyString.h"
-
-struct CExtIconPair
-{
- UString Ext;
- int IconIndex;
- UString TypeName;
-
-};
-
-inline bool operator==(const CExtIconPair &a1, const CExtIconPair &a2)
-{
- return (a1.Ext == a2.Ext);
-}
-
-inline bool operator<(const CExtIconPair &a1, const CExtIconPair &a2)
-{
- return (a1.Ext < a2.Ext);
-}
-
-class CExtToIconMap
-{
- int _dirIconIndex;
- UString _dirTypeName;
- int _noExtIconIndex;
- UString _noExtTypeName;
- CObjectVector<CExtIconPair> _map;
-public:
- CExtToIconMap(): _dirIconIndex(-1), _noExtIconIndex(-1) {}
- void Clear()
- {
- _dirIconIndex = -1;
- _noExtIconIndex = -1;
- _map.Clear();
- }
- int GetIconIndex(UINT32 attributes, const UString &fileName, UString &typeName);
- int GetIconIndex(UINT32 attributes, const UString &fileName);
-};
-
-DWORD_PTR GetRealIconIndex(LPCTSTR path, DWORD attributes, int &iconIndex);
-#ifndef _UNICODE
-DWORD_PTR GetRealIconIndex(LPCWSTR path, DWORD attributes, int &iconIndex);
-#endif
-int GetIconIndexForCSIDL(int csidl);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/TextPairs.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/TextPairs.cpp
deleted file mode 100644
index cc57c0d56..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/TextPairs.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-// TextPairs.cpp
-
-#include "StdAfx.h"
-
-#include "TextPairs.h"
-
-static const wchar_t kNewLineChar = '\n';
-static const wchar_t kQuoteChar = '\"';
-
-static const wchar_t kBOM = (wchar_t)0xFEFF;
-
-static bool IsSeparatorChar(wchar_t c)
-{
- return (c == ' ' || c == '\t');
-}
-
-static void RemoveCr(UString &s)
-{
- s.Replace(L"\x0D", L"");
-}
-
-static UString GetIDString(const wchar_t *srcString, int &finishPos)
-{
- UString result;
- bool quotes = false;
- for (finishPos = 0;;)
- {
- wchar_t c = srcString[finishPos];
- if (c == 0)
- break;
- finishPos++;
- bool isSeparatorChar = IsSeparatorChar(c);
- if (c == kNewLineChar || (isSeparatorChar && !quotes)
- || (c == kQuoteChar && quotes))
- break;
- else if (c == kQuoteChar)
- quotes = true;
- else
- result += c;
- }
- result.Trim();
- RemoveCr(result);
- return result;
-}
-
-static UString GetValueString(const wchar_t *srcString, int &finishPos)
-{
- UString result;
- for (finishPos = 0;;)
- {
- wchar_t c = srcString[finishPos];
- if (c == 0)
- break;
- finishPos++;
- if (c == kNewLineChar)
- break;
- result += c;
- }
- result.Trim();
- RemoveCr(result);
- return result;
-}
-
-static bool GetTextPairs(const UString &srcString, CObjectVector<CTextPair> &pairs)
-{
- pairs.Clear();
- int pos = 0;
-
- if (srcString.Length() > 0)
- {
- if (srcString[0] == kBOM)
- pos++;
- }
- while (pos < srcString.Length())
- {
- int finishPos;
- UString id = GetIDString((const wchar_t *)srcString + pos, finishPos);
- pos += finishPos;
- if (id.IsEmpty())
- continue;
- UString value = GetValueString((const wchar_t *)srcString + pos, finishPos);
- pos += finishPos;
- if (!id.IsEmpty())
- {
- CTextPair pair;
- pair.ID = id;
- pair.Value = value;
- pairs.Add(pair);
- }
- }
- return true;
-}
-
-static int ComparePairIDs(const UString &s1, const UString &s2)
- { return s1.CompareNoCase(s2); }
-static int ComparePairItems(const CTextPair &p1, const CTextPair &p2)
- { return ComparePairIDs(p1.ID, p2.ID); }
-
-static int ComparePairItems(void *const *a1, void *const *a2, void * /* param */)
- { return ComparePairItems(**(const CTextPair **)a1, **(const CTextPair **)a2); }
-
-void CPairsStorage::Sort() { Pairs.Sort(ComparePairItems, 0); }
-
-int CPairsStorage::FindID(const UString &id, int &insertPos)
-{
- int left = 0, right = Pairs.Size();
- while (left != right)
- {
- int mid = (left + right) / 2;
- int compResult = ComparePairIDs(id, Pairs[mid].ID);
- if (compResult == 0)
- return mid;
- if (compResult < 0)
- right = mid;
- else
- left = mid + 1;
- }
- insertPos = left;
- return -1;
-}
-
-int CPairsStorage::FindID(const UString &id)
-{
- int pos;
- return FindID(id, pos);
-}
-
-void CPairsStorage::AddPair(const CTextPair &pair)
-{
- int insertPos;
- int pos = FindID(pair.ID, insertPos);
- if (pos >= 0)
- Pairs[pos] = pair;
- else
- Pairs.Insert(insertPos, pair);
-}
-
-void CPairsStorage::DeletePair(const UString &id)
-{
- int pos = FindID(id);
- if (pos >= 0)
- Pairs.Delete(pos);
-}
-
-bool CPairsStorage::GetValue(const UString &id, UString &value)
-{
- value.Empty();
- int pos = FindID(id);
- if (pos < 0)
- return false;
- value = Pairs[pos].Value;
- return true;
-}
-
-UString CPairsStorage::GetValue(const UString &id)
-{
- int pos = FindID(id);
- if (pos < 0)
- return UString();
- return Pairs[pos].Value;
-}
-
-bool CPairsStorage::ReadFromString(const UString &text)
-{
- bool result = ::GetTextPairs(text, Pairs);
- if (result)
- Sort();
- else
- Pairs.Clear();
- return result;
-}
-
-void CPairsStorage::SaveToString(UString &text)
-{
- for (int i = 0; i < Pairs.Size(); i++)
- {
- const CTextPair &pair = Pairs[i];
- bool multiWord = (pair.ID.Find(L' ') >= 0);
- if (multiWord)
- text += L'\"';
- text += pair.ID;
- if (multiWord)
- text += L'\"';
- text += L' ';
- text += pair.Value;
- text += L'\x0D';
- text += L'\n';
- }
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/TextPairs.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/TextPairs.h
deleted file mode 100644
index 2670e0307..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/TextPairs.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// TextPairs.h
-
-#ifndef __FM_TEXT_PAIRS_H
-#define __FM_TEXT_PAIRS_H
-
-#include "Common/MyString.h"
-
-struct CTextPair
-{
- UString ID;
- UString Value;
-};
-
-class CPairsStorage
-{
- CObjectVector<CTextPair> Pairs;
- int FindID(const UString &id, int &insertPos);
- int FindID(const UString &id);
- void Sort();
-public:
- void Clear() { Pairs.Clear(); };
- bool ReadFromString(const UString &text);
- void SaveToString(UString &text);
-
- bool GetValue(const UString &id, UString &value);
- UString GetValue(const UString &id);
- void AddPair(const CTextPair &pair);
- void DeletePair(const UString &id);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/UpdateCallback100.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/UpdateCallback100.cpp
deleted file mode 100644
index 3701d2bbf..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/UpdateCallback100.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-// UpdateCallback100.cpp
-
-#include "StdAfx.h"
-
-#include "MessagesDialog.h"
-#include "PasswordDialog.h"
-#include "UpdateCallback100.h"
-
-CUpdateCallback100Imp::~CUpdateCallback100Imp()
-{
- if (ShowMessages && !Messages.IsEmpty())
- {
- CMessagesDialog messagesDialog;
- messagesDialog.Messages = &Messages;
- messagesDialog.Create(_parentWindow);
- }
-}
-
-void CUpdateCallback100Imp::AddErrorMessage(LPCWSTR message)
-{
- Messages.Add(message);
-}
-
-STDMETHODIMP CUpdateCallback100Imp::SetNumFiles(UInt64 numFiles)
-{
- ProgressDialog.ProgressSynch.SetNumFilesTotal(numFiles);
- return S_OK;
-}
-
-STDMETHODIMP CUpdateCallback100Imp::SetTotal(UInt64 size)
-{
- ProgressDialog.ProgressSynch.SetProgress(size, 0);
- return S_OK;
-}
-
-STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UInt64 *completeValue)
-{
- RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
- if (completeValue != NULL)
- ProgressDialog.ProgressSynch.SetPos(*completeValue);
- return S_OK;
-}
-
-STDMETHODIMP CUpdateCallback100Imp::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
- ProgressDialog.ProgressSynch.SetRatioInfo(inSize, outSize);
- return S_OK;
-}
-
-STDMETHODIMP CUpdateCallback100Imp::CompressOperation(const wchar_t *name)
-{
- ProgressDialog.ProgressSynch.SetCurrentFileName(name);
- return S_OK;
-}
-
-STDMETHODIMP CUpdateCallback100Imp::DeleteOperation(const wchar_t *name)
-{
- ProgressDialog.ProgressSynch.SetCurrentFileName(name);
- return S_OK;
-}
-
-STDMETHODIMP CUpdateCallback100Imp::OperationResult(Int32 /* operationResult */)
-{
- NumFiles++;
- ProgressDialog.ProgressSynch.SetNumFilesCur(NumFiles);
- return S_OK;
-}
-
-STDMETHODIMP CUpdateCallback100Imp::UpdateErrorMessage(const wchar_t *message)
-{
- AddErrorMessage(message);
- return S_OK;
-}
-
-STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
-{
- *password = NULL;
- *passwordIsDefined = BoolToInt(_passwordIsDefined);
- if (!_passwordIsDefined)
- return S_OK;
- return StringToBstr(_password, password);
-}
-
-STDMETHODIMP CUpdateCallback100Imp::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
-{
- return S_OK;
-}
-
-STDMETHODIMP CUpdateCallback100Imp::SetCompleted(const UInt64 * /* files */, const UInt64 * /* bytes */)
-{
- return ProgressDialog.ProgressSynch.ProcessStopAndPause();
-}
-
-STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword(BSTR *password)
-{
- *password = NULL;
- if (!_passwordIsDefined)
- {
- CPasswordDialog dialog;
- if (dialog.Create(_parentWindow) == IDCANCEL)
- return E_ABORT;
- _password = dialog.Password;
- _passwordIsDefined = true;
- }
- return StringToBstr(_password, password);
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/UpdateCallback100.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/UpdateCallback100.h
deleted file mode 100644
index 5ae194a2a..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/UpdateCallback100.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// UpdateCallback100.h
-
-#ifndef __UPDATE_CALLBACK100_H
-#define __UPDATE_CALLBACK100_H
-
-#include "Common/MyCom.h"
-#include "Common/MyString.h"
-
-#include "../Agent/IFolderArchive.h"
-#include "ProgressDialog2.h"
-#include "../../IPassword.h"
-
-#ifdef LANG
-#include "LangUtils.h"
-#endif
-
-class CUpdateCallback100Imp:
- public IFolderArchiveUpdateCallback,
- public ICryptoGetTextPassword2,
- public ICryptoGetTextPassword,
- public IArchiveOpenCallback,
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP5(
- IFolderArchiveUpdateCallback,
- ICryptoGetTextPassword2,
- ICryptoGetTextPassword,
- IArchiveOpenCallback,
- ICompressProgressInfo)
-
- INTERFACE_IProgress(;)
- INTERFACE_IArchiveOpenCallback(;)
- INTERFACE_IFolderArchiveUpdateCallback(;)
-
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-
- STDMETHOD(CryptoGetTextPassword)(BSTR *password);
- STDMETHOD(CryptoGetTextPassword2)(Int32 *passwordIsDefined, BSTR *password);
-private:
- bool _passwordIsDefined;
- UString _password;
-
- void AddErrorMessage(LPCWSTR message);
- bool ShowMessages;
-
-public:
- CUpdateCallback100Imp(): ShowMessages(true) {}
- ~CUpdateCallback100Imp();
- CProgressDialog ProgressDialog;
- HWND _parentWindow;
- UStringVector Messages;
- UInt64 NumFolders;
- UInt64 NumFiles;
-
- void Init(HWND parentWindow,
- bool passwordIsDefined, const UString &password)
- {
- _passwordIsDefined = passwordIsDefined;
- _password = password;
- _parentWindow = parentWindow;
- NumFolders = NumFiles = 0;
- }
- void StartProgressDialog(const UString &title)
- {
- ProgressDialog.Create(title, _parentWindow);
- }
-
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ViewSettings.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ViewSettings.cpp
deleted file mode 100644
index 53974eab1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ViewSettings.cpp
+++ /dev/null
@@ -1,426 +0,0 @@
-// ViewSettings.h
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "ViewSettings.h"
-#include "Windows/Registry.h"
-#include "Windows/Synchronization.h"
-
-using namespace NWindows;
-using namespace NRegistry;
-
-#define REG_PATH_FM TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-ZIP") TEXT(STRING_PATH_SEPARATOR) TEXT("FM")
-
-static const TCHAR *kCUBasePath = REG_PATH_FM;
-static const TCHAR *kCulumnsKeyName = REG_PATH_FM TEXT(STRING_PATH_SEPARATOR) TEXT("Columns");
-
-static const TCHAR *kPositionValueName = TEXT("Position");
-static const TCHAR *kPanelsInfoValueName = TEXT("Panels");
-static const TCHAR *kToolbars = TEXT("Toolbars");
-
-static const WCHAR *kPanelPathValueName = L"PanelPath";
-static const TCHAR *kListMode = TEXT("ListMode");
-static const TCHAR *kFolderHistoryValueName = TEXT("FolderHistory");
-static const TCHAR *kFastFoldersValueName = TEXT("FolderShortcuts");
-static const TCHAR *kCopyHistoryValueName = TEXT("CopyHistory");
-
-/*
-class CColumnInfoSpec
-{
- UInt32 PropID;
- Byte IsVisible;
- UInt32 Width;
-};
-
-struct CColumnHeader
-{
- UInt32 Version;
- UInt32 SortID;
- Byte Ascending;
-};
-*/
-
-static const UInt32 kColumnInfoSpecHeader = 12;
-static const UInt32 kColumnHeaderSize = 12;
-
-static const UInt32 kColumnInfoVersion = 1;
-
-static NSynchronization::CCriticalSection g_RegistryOperationsCriticalSection;
-
-class CTempOutBufferSpec
-{
- CByteBuffer Buffer;
- UInt32 Size;
- UInt32 Pos;
-public:
- operator const Byte *() const { return (const Byte *)Buffer; }
- void Init(UInt32 dataSize)
- {
- Buffer.SetCapacity(dataSize);
- Size = dataSize;
- Pos = 0;
- }
- void WriteByte(Byte value)
- {
- if (Pos >= Size)
- throw "overflow";
- ((Byte *)Buffer)[Pos++] = value;
- }
- void WriteUInt32(UInt32 value)
- {
- for (int i = 0; i < 4; i++)
- {
- WriteByte((Byte)value);
- value >>= 8;
- }
- }
- void WriteBool(bool value)
- {
- WriteUInt32(value ? 1 : 0);
- }
-};
-
-class CTempInBufferSpec
-{
-public:
- Byte *Buffer;
- UInt32 Size;
- UInt32 Pos;
- Byte ReadByte()
- {
- if (Pos >= Size)
- throw "overflow";
- return Buffer[Pos++];
- }
- UInt32 ReadUInt32()
- {
- UInt32 value = 0;
- for (int i = 0; i < 4; i++)
- value |= (((UInt32)ReadByte()) << (8 * i));
- return value;
- }
- bool ReadBool()
- {
- return (ReadUInt32() != 0);
- }
-};
-
-void SaveListViewInfo(const UString &id, const CListViewInfo &viewInfo)
-{
- const CObjectVector<CColumnInfo> &columns = viewInfo.Columns;
- CTempOutBufferSpec buffer;
- UInt32 dataSize = kColumnHeaderSize + kColumnInfoSpecHeader * columns.Size();
- buffer.Init(dataSize);
-
- buffer.WriteUInt32(kColumnInfoVersion);
- buffer.WriteUInt32(viewInfo.SortID);
- buffer.WriteBool(viewInfo.Ascending);
- for(int i = 0; i < columns.Size(); i++)
- {
- const CColumnInfo &column = columns[i];
- buffer.WriteUInt32(column.PropID);
- buffer.WriteBool(column.IsVisible);
- buffer.WriteUInt32(column.Width);
- }
- {
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- CKey key;
- key.Create(HKEY_CURRENT_USER, kCulumnsKeyName);
- key.SetValue(GetSystemString(id), (const Byte *)buffer, dataSize);
- }
-}
-
-void ReadListViewInfo(const UString &id, CListViewInfo &viewInfo)
-{
- viewInfo.Clear();
- CObjectVector<CColumnInfo> &columns = viewInfo.Columns;
- CByteBuffer buffer;
- UInt32 size;
- {
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- CKey key;
- if(key.Open(HKEY_CURRENT_USER, kCulumnsKeyName, KEY_READ) != ERROR_SUCCESS)
- return;
- if (key.QueryValue(GetSystemString(id), buffer, size) != ERROR_SUCCESS)
- return;
- }
- if (size < kColumnHeaderSize)
- return;
- CTempInBufferSpec inBuffer;
- inBuffer.Size = size;
- inBuffer.Buffer = (Byte *)buffer;
- inBuffer.Pos = 0;
-
-
- UInt32 version = inBuffer.ReadUInt32();
- if (version != kColumnInfoVersion)
- return;
- viewInfo.SortID = inBuffer.ReadUInt32();
- viewInfo.Ascending = inBuffer.ReadBool();
-
- size -= kColumnHeaderSize;
- if (size % kColumnInfoSpecHeader != 0)
- return;
- int numItems = size / kColumnInfoSpecHeader;
- columns.Reserve(numItems);
- for(int i = 0; i < numItems; i++)
- {
- CColumnInfo columnInfo;
- columnInfo.PropID = inBuffer.ReadUInt32();
- columnInfo.IsVisible = inBuffer.ReadBool();
- columnInfo.Width = inBuffer.ReadUInt32();
- columns.Add(columnInfo);
- }
-}
-
-static const UInt32 kWindowPositionHeaderSize = 5 * 4;
-static const UInt32 kPanelsInfoHeaderSize = 3 * 4;
-
-/*
-struct CWindowPosition
-{
- RECT Rect;
- UInt32 Maximized;
-};
-
-struct CPanelsInfo
-{
- UInt32 NumPanels;
- UInt32 CurrentPanel;
- UInt32 SplitterPos;
-};
-*/
-
-#ifdef _WIN32
-void SaveWindowSize(const RECT &rect, bool maximized)
-{
- CSysString keyName = kCUBasePath;
- CKey key;
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- key.Create(HKEY_CURRENT_USER, keyName);
- // CWindowPosition position;
- CTempOutBufferSpec buffer;
- buffer.Init(kWindowPositionHeaderSize);
- buffer.WriteUInt32(rect.left);
- buffer.WriteUInt32(rect.top);
- buffer.WriteUInt32(rect.right);
- buffer.WriteUInt32(rect.bottom);
- buffer.WriteBool(maximized);
- key.SetValue(kPositionValueName, (const Byte *)buffer, kWindowPositionHeaderSize);
-}
-
-bool ReadWindowSize(RECT &rect, bool &maximized)
-{
- CSysString keyName = kCUBasePath;
- CKey key;
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- if(key.Open(HKEY_CURRENT_USER, keyName, KEY_READ) != ERROR_SUCCESS)
- return false;
- CByteBuffer buffer;
- UInt32 size;
- if (key.QueryValue(kPositionValueName, buffer, size) != ERROR_SUCCESS)
- return false;
- if (size != kWindowPositionHeaderSize)
- return false;
- CTempInBufferSpec inBuffer;
- inBuffer.Size = size;
- inBuffer.Buffer = (Byte *)buffer;
- inBuffer.Pos = 0;
- rect.left = inBuffer.ReadUInt32();
- rect.top = inBuffer.ReadUInt32();
- rect.right = inBuffer.ReadUInt32();
- rect.bottom = inBuffer.ReadUInt32();
- maximized = inBuffer.ReadBool();
- return true;
-}
-#endif
-
-void SavePanelsInfo(UInt32 numPanels, UInt32 currentPanel, UInt32 splitterPos)
-{
- CSysString keyName = kCUBasePath;
- CKey key;
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- key.Create(HKEY_CURRENT_USER, keyName);
-
- CTempOutBufferSpec buffer;
- buffer.Init(kPanelsInfoHeaderSize);
- buffer.WriteUInt32(numPanels);
- buffer.WriteUInt32(currentPanel);
- buffer.WriteUInt32(splitterPos);
- key.SetValue(kPanelsInfoValueName, (const Byte *)buffer, kPanelsInfoHeaderSize);
-}
-
-bool ReadPanelsInfo(UInt32 &numPanels, UInt32 &currentPanel, UInt32 &splitterPos)
-{
- CSysString keyName = kCUBasePath;
- CKey key;
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- if(key.Open(HKEY_CURRENT_USER, keyName, KEY_READ) != ERROR_SUCCESS)
- return false;
- CByteBuffer buffer;
- UInt32 size;
- if (key.QueryValue(kPanelsInfoValueName, buffer, size) != ERROR_SUCCESS)
- return false;
- if (size != kPanelsInfoHeaderSize)
- return false;
- CTempInBufferSpec inBuffer;
- inBuffer.Size = size;
- inBuffer.Buffer = (Byte *)buffer;
- inBuffer.Pos = 0;
- numPanels = inBuffer.ReadUInt32();
- currentPanel = inBuffer.ReadUInt32();
- splitterPos = inBuffer.ReadUInt32();
- return true;
-}
-
-void SaveToolbarsMask(UInt32 toolbarMask)
-{
- CKey key;
- key.Create(HKEY_CURRENT_USER, kCUBasePath);
- key.SetValue(kToolbars, toolbarMask);
-}
-
-static const UInt32 kDefaultToolbarMask = 8 | 4 | 1;
-
-UInt32 ReadToolbarsMask()
-{
- CKey key;
- if(key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) != ERROR_SUCCESS)
- return kDefaultToolbarMask;
- UInt32 mask;
- if (key.QueryValue(kToolbars, mask) != ERROR_SUCCESS)
- return kDefaultToolbarMask;
- return mask;
-}
-
-
-static UString GetPanelPathName(UInt32 panelIndex)
-{
- WCHAR panelString[32];
- ConvertUInt64ToString(panelIndex, panelString);
- return UString(kPanelPathValueName) + panelString;
-}
-
-
-void SavePanelPath(UInt32 panel, const UString &path)
-{
- CKey key;
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- key.Create(HKEY_CURRENT_USER, kCUBasePath);
- key.SetValue(GetPanelPathName(panel), path);
-}
-
-bool ReadPanelPath(UInt32 panel, UString &path)
-{
- CKey key;
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- if(key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) != ERROR_SUCCESS)
- return false;
- return (key.QueryValue(GetPanelPathName(panel), path) == ERROR_SUCCESS);
-}
-
-void SaveListMode(const CListMode &listMode)
-{
- CKey key;
- key.Create(HKEY_CURRENT_USER, kCUBasePath);
- UInt32 t = 0;
- for (int i = 0; i < 2; i++)
- t |= ((listMode.Panels[i]) & 0xFF) << (i * 8);
- key.SetValue(kListMode, t);
-}
-
-void ReadListMode(CListMode &listMode)
-{
- CKey key;
- listMode.Init();
- if(key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) != ERROR_SUCCESS)
- return;
- UInt32 t;
- if (key.QueryValue(kListMode, t) != ERROR_SUCCESS)
- return;
- for (int i = 0; i < 2; i++)
- {
- listMode.Panels[i] = (t & 0xFF);
- t >>= 8;
- }
-}
-
-
-void SaveStringList(LPCTSTR valueName, const UStringVector &folders)
-{
- UInt32 sizeInChars = 0;
- int i;
- for (i = 0; i < folders.Size(); i++)
- sizeInChars += folders[i].Length() + 1;
- CBuffer<wchar_t> buffer;
- buffer.SetCapacity(sizeInChars);
- int pos = 0;
- for (i = 0; i < folders.Size(); i++)
- {
- MyStringCopy((wchar_t *)buffer + pos, (const wchar_t *)folders[i]);
- pos += folders[i].Length() + 1;
- }
- CKey key;
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- key.Create(HKEY_CURRENT_USER, kCUBasePath);
- key.SetValue(valueName, buffer, sizeInChars * sizeof(wchar_t));
-}
-
-void ReadStringList(LPCTSTR valueName, UStringVector &folders)
-{
- folders.Clear();
- CKey key;
- NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
- if(key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) != ERROR_SUCCESS)
- return;
- CByteBuffer buffer;
- UInt32 dataSize;
- if (key.QueryValue(valueName, buffer, dataSize) != ERROR_SUCCESS)
- return;
- if (dataSize % sizeof(wchar_t) != 0)
- return;
- const wchar_t *data = (const wchar_t *)(const Byte *)buffer;
- int sizeInChars = dataSize / sizeof(wchar_t);
- UString string;
- for (int i = 0; i < sizeInChars; i++)
- {
- wchar_t c = data[i];
- if (c == L'\0')
- {
- folders.Add(string);
- string.Empty();
- }
- else
- string += c;
- }
-}
-
-void SaveFolderHistory(const UStringVector &folders)
- { SaveStringList(kFolderHistoryValueName, folders); }
-void ReadFolderHistory(UStringVector &folders)
- { ReadStringList(kFolderHistoryValueName, folders); }
-
-void SaveFastFolders(const UStringVector &folders)
- { SaveStringList(kFastFoldersValueName, folders); }
-void ReadFastFolders(UStringVector &folders)
- { ReadStringList(kFastFoldersValueName, folders); }
-
-void SaveCopyHistory(const UStringVector &folders)
- { SaveStringList(kCopyHistoryValueName, folders); }
-void ReadCopyHistory(UStringVector &folders)
- { ReadStringList(kCopyHistoryValueName, folders); }
-
-void AddUniqueStringToHeadOfList(UStringVector &list,
- const UString &string)
-{
- for(int i = 0; i < list.Size();)
- if (string.CompareNoCase(list[i]) == 0)
- list.Delete(i);
- else
- i++;
- list.Insert(0, string);
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ViewSettings.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ViewSettings.h
deleted file mode 100644
index c27e70e6f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/ViewSettings.h
+++ /dev/null
@@ -1,100 +0,0 @@
-// ViewSettings.h
-
-#ifndef __VIEWSETTINGS_H
-#define __VIEWSETTINGS_H
-
-#include "Common/MyString.h"
-
-struct CColumnInfo
-{
- PROPID PropID;
- bool IsVisible;
- UInt32 Width;
-};
-
-inline bool operator==(const CColumnInfo &a1, const CColumnInfo &a2)
-{
- return (a1.PropID == a2.PropID) &&
- (a1.IsVisible == a2.IsVisible) && (a1.Width == a2.Width);
-}
-
-inline bool operator!=(const CColumnInfo &a1, const CColumnInfo &a2)
-{
- return !(a1 == a2);
-}
-
-struct CListViewInfo
-{
- CObjectVector<CColumnInfo> Columns;
- PROPID SortID;
- bool Ascending;
-
- void Clear()
- {
- SortID = 0;
- Ascending = true;
- Columns.Clear();
- }
-
- int FindColumnWithID(PROPID propID) const
- {
- for (int i = 0; i < Columns.Size(); i++)
- if (Columns[i].PropID == propID)
- return i;
- return -1;
- }
-
- bool IsEqual(const CListViewInfo &aNewInfo) const
- {
- if (Columns.Size() != aNewInfo.Columns.Size() ||
- // SortIndex != aNewInfo.SortIndex ||
- SortID != aNewInfo.SortID ||
- Ascending != aNewInfo.Ascending)
- return false;
- for (int i = 0; i < Columns.Size(); i++)
- if (Columns[i] != aNewInfo.Columns[i])
- return false;
- return true;
- }
-};
-
-void SaveListViewInfo(const UString &id, const CListViewInfo &viewInfo);
-void ReadListViewInfo(const UString &id, CListViewInfo &viewInfo);
-
-#ifdef _WIN32
-void SaveWindowSize(const RECT &rect, bool maximized);
-bool ReadWindowSize(RECT &rect, bool &maximized);
-#endif
-
-void SavePanelsInfo(UInt32 numPanels, UInt32 currentPanel, UInt32 splitterPos);
-bool ReadPanelsInfo(UInt32 &numPanels, UInt32 &currentPanel, UInt32 &splitterPos);
-
-void SaveToolbarsMask(UInt32 toolbarMask);
-UInt32 ReadToolbarsMask();
-
-void SavePanelPath(UInt32 panel, const UString &path);
-bool ReadPanelPath(UInt32 panel, UString &path);
-
-struct CListMode
-{
- UInt32 Panels[2];
- void Init() { Panels[0] = Panels[1] = 3; }
- CListMode() { Init(); }
-};
-
-void SaveListMode(const CListMode &listMode);
-void ReadListMode(CListMode &listMode);
-
-void SaveFolderHistory(const UStringVector &folders);
-void ReadFolderHistory(UStringVector &folders);
-
-void SaveFastFolders(const UStringVector &folders);
-void ReadFastFolders(UStringVector &folders);
-
-void SaveCopyHistory(const UStringVector &folders);
-void ReadCopyHistory(UStringVector &folders);
-
-void AddUniqueStringToHeadOfList(UStringVector &list,
- const UString &string);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Add2PNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Add2PNG.h
deleted file mode 100644
index a507a3066..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Add2PNG.h
+++ /dev/null
@@ -1,20 +0,0 @@
-static const unsigned char ADD2_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x12, 0x59, 0x20, 0xcb, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x3b, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0x63, 0x60, 0xc0, 0x0b, 0x78, 0xef, 0xde,
-0xbd, 0x8b, 0xe0, 0xac, 0x5a, 0xb5, 0xb6, 0x80, 0x6c, 0x0e, 0xc8, 0x28,
-0x20, 0x07, 0x62, 0x20, 0x50, 0x18, 0x02, 0x40, 0x92, 0x64, 0x71, 0xe0,
-0xa6, 0x81, 0x4c, 0x2f, 0x2f, 0x2f, 0x07, 0x72, 0x80, 0x64, 0x01, 0xf9,
-0x0e, 0x85, 0x1a, 0x05, 0x01, 0x70, 0xa3, 0x70, 0x01, 0x00, 0x61, 0xed,
-0x52, 0x81, 0x19, 0x73, 0x26, 0x18, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45,
-0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/AddPNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/AddPNG.h
deleted file mode 100644
index be1ac9124..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/AddPNG.h
+++ /dev/null
@@ -1,22 +0,0 @@
-static const unsigned char ADD_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x3d, 0x6b, 0xa4, 0x39, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x4d, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0x63, 0x60, 0xa0, 0x01, 0xe0, 0xbd, 0x0b,
-0x04, 0x17, 0xb0, 0x49, 0xac, 0x02, 0x82, 0xeb, 0x43, 0x5b, 0x02, 0xe4,
-0xb7, 0xbb, 0x20, 0x09, 0x30, 0x03, 0x49, 0xe2, 0xd6, 0x2a, 0x24, 0xb0,
-0xb6, 0x60, 0xc8, 0x4a, 0xa0, 0x7a, 0x10, 0x49, 0x82, 0xbd, 0xbc, 0xbc,
-0xbc, 0x16, 0x1c, 0x24, 0x40, 0x46, 0x39, 0x92, 0x04, 0xe9, 0x81, 0x38,
-0xf0, 0x12, 0x20, 0xbf, 0x61, 0x93, 0x60, 0x00, 0xf9, 0xad, 0x1c, 0x9b,
-0x04, 0xcd, 0x00, 0x00, 0xa3, 0xbb, 0xae, 0x61, 0x7b, 0x93, 0x6d, 0x0f,
-0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
-0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Copy2PNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Copy2PNG.h
deleted file mode 100644
index 14781e2a1..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Copy2PNG.h
+++ /dev/null
@@ -1,22 +0,0 @@
-static const unsigned char COPY2_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x12, 0x59, 0x20, 0xcb, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x52, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0x95, 0xce, 0x31, 0x0a, 0xc0, 0x30, 0x08,
-0x40, 0x51, 0xb7, 0xdc, 0xd4, 0x4d, 0x70, 0xf3, 0x9a, 0x99, 0xec, 0xe4,
-0x5d, 0x9a, 0x18, 0x68, 0xff, 0x1a, 0xc9, 0xf2, 0x79, 0x22, 0x11, 0xb9,
-0x9a, 0xc9, 0x28, 0x46, 0x92, 0xd2, 0x18, 0xda, 0x54, 0xb5, 0x5e, 0xa5,
-0xda, 0x59, 0xf0, 0xd4, 0x3d, 0x93, 0x61, 0x8c, 0x4d, 0xbf, 0x38, 0xe2,
-0xe9, 0x6b, 0x7e, 0xae, 0x2d, 0x90, 0x11, 0x3e, 0x22, 0xb2, 0xe1, 0xfb,
-0x81, 0x23, 0x00, 0x52, 0x00, 0x21, 0x5c, 0xcd, 0x0b, 0x7e, 0x4c, 0x37,
-0xbb, 0x3f, 0x86, 0x84, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
-0x44, 0xae, 0x42, 0x60, 0x82, 0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/CopyPNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/CopyPNG.h
deleted file mode 100644
index 69770b9e0..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/CopyPNG.h
+++ /dev/null
@@ -1,26 +0,0 @@
-static const unsigned char COPY_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x3d, 0x6b, 0xa4, 0x39, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x80, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0xbd, 0xd1, 0x31, 0x0e, 0x80, 0x20, 0x0c,
-0x85, 0xe1, 0x6e, 0x4e, 0x5c, 0x93, 0x8d, 0xa4, 0x1b, 0xd7, 0x64, 0x2a,
-0x53, 0xef, 0xe2, 0x43, 0x23, 0x12, 0xed, 0x5b, 0xe9, 0x60, 0x62, 0x7e,
-0xbf, 0x00, 0x22, 0xb2, 0x7d, 0x1a, 0x0b, 0xce, 0x82, 0x31, 0x62, 0x85,
-0x85, 0x4c, 0x88, 0x65, 0x42, 0x2c, 0x13, 0x82, 0x10, 0x13, 0x84, 0x85,
-0x24, 0x77, 0xec, 0xdf, 0xc7, 0x8c, 0xf0, 0x92, 0x84, 0x17, 0xbd, 0x3e,
-0xbe, 0xa7, 0xb1, 0x50, 0x58, 0x98, 0xe4, 0x17, 0x0a, 0x0b, 0x9d, 0xad,
-0xa1, 0x24, 0xf4, 0xb9, 0x38, 0x0e, 0xa0, 0xcb, 0x39, 0x1e, 0x20, 0x52,
-0x6b, 0x55, 0x39, 0xf0, 0xac, 0xb6, 0x82, 0xef, 0xbf, 0x52, 0x12, 0x42,
-0x30, 0xee, 0x23, 0x04, 0x08, 0x31, 0xc0, 0x9d, 0xc7, 0x40, 0x8c, 0x00,
-0x71, 0x02, 0x84, 0x81, 0xcd, 0x73, 0x02, 0xb6, 0x2b, 0x69, 0xbd, 0x15,
-0x92, 0x2f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae,
-0x42, 0x60, 0x82, 0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Delete2PNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Delete2PNG.h
deleted file mode 100644
index 5f0907754..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Delete2PNG.h
+++ /dev/null
@@ -1,23 +0,0 @@
-static const unsigned char DELETE2_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x12, 0x59, 0x20, 0xcb, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x5a, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0x9d, 0x8e, 0xc1, 0x11, 0x00, 0x21, 0x08,
-0x03, 0x69, 0xc0, 0x5e, 0x6d, 0xe0, 0x0a, 0xc9, 0xc3, 0x9e, 0xf8, 0x31,
-0x76, 0x73, 0x80, 0x06, 0x7d, 0xde, 0x5c, 0x46, 0xf3, 0x60, 0x27, 0x10,
-0x91, 0xcf, 0x6a, 0x65, 0xae, 0xa9, 0x34, 0x9f, 0x61, 0x6c, 0x8b, 0x19,
-0xa0, 0xcb, 0x92, 0x60, 0xc4, 0xef, 0x44, 0xfe, 0x6c, 0x6f, 0x03, 0x0a,
-0x24, 0x22, 0x58, 0x29, 0x82, 0x24, 0x2a, 0x77, 0xe6, 0x00, 0x9e, 0xc9,
-0xc4, 0x83, 0xd3, 0xc0, 0xae, 0x06, 0xbe, 0xaa, 0x55, 0x03, 0xa3, 0x05,
-0xea, 0xb4, 0x1f, 0x7a, 0x01, 0xc5, 0x78, 0x3b, 0x10, 0xc3, 0x1f, 0xc3,
-0xce, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60,
-0x82, 0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/DeletePNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/DeletePNG.h
deleted file mode 100644
index 7795bc0a8..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/DeletePNG.h
+++ /dev/null
@@ -1,26 +0,0 @@
-static const unsigned char DELETE_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x3d, 0x6b, 0xa4, 0x39, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x81, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0xc5, 0xd1, 0xc1, 0x0d, 0x80, 0x30, 0x08,
-0x05, 0x50, 0x17, 0x60, 0x57, 0xd7, 0xe1, 0xd0, 0x9d, 0x7a, 0x23, 0x6e,
-0x63, 0x2c, 0x14, 0x2d, 0xff, 0x7b, 0x55, 0x2e, 0xfd, 0x31, 0xbc, 0x58,
-0xe8, 0xb6, 0x7d, 0x57, 0x1d, 0x82, 0x97, 0xb4, 0x1a, 0xa2, 0x0e, 0xed,
-0x25, 0x44, 0x9f, 0x6a, 0x5b, 0x43, 0x02, 0xf5, 0xce, 0x0c, 0xb7, 0x18,
-0x9d, 0xe3, 0xdc, 0x09, 0xb9, 0x0e, 0x5b, 0x6f, 0x35, 0x08, 0x82, 0x20,
-0x08, 0x82, 0x10, 0xe0, 0x84, 0x00, 0x27, 0x0c, 0x04, 0x41, 0xc0, 0x66,
-0x78, 0x8a, 0x8e, 0xdf, 0xe3, 0x1f, 0x2f, 0x80, 0x90, 0x9c, 0x83, 0x01,
-0xab, 0xbb, 0xcd, 0x2b, 0x09, 0x92, 0xd8, 0x12, 0x90, 0x39, 0x03, 0x90,
-0x5c, 0x2b, 0x79, 0x41, 0x1f, 0x5a, 0xf0, 0x05, 0xad, 0x84, 0x49, 0x66,
-0x9f, 0xd4, 0x75, 0x19, 0x84, 0x3f, 0xeb, 0x04, 0x1a, 0xa7, 0x7e, 0xab,
-0x5a, 0xf7, 0xe4, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44,
-0xae, 0x42, 0x60, 0x82, 0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Extract2PNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Extract2PNG.h
deleted file mode 100644
index ee01ef69d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Extract2PNG.h
+++ /dev/null
@@ -1,18 +0,0 @@
-static const unsigned char EXTRACT2_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x12, 0x59, 0x20, 0xcb, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x22, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0x63, 0x60, 0xa0, 0x17, 0xe0, 0xbd, 0x0b,
-0x05, 0x17, 0x40, 0x9c, 0x33, 0x50, 0x70, 0x9d, 0x5c, 0x0e, 0xcc, 0x34,
-0x10, 0x87, 0xa1, 0x1c, 0x06, 0xe8, 0xe6, 0x1b, 0x00, 0xa6, 0x78, 0x38,
-0x15, 0x21, 0xee, 0x22, 0xc7, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
-0x44, 0xae, 0x42, 0x60, 0x82, 0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/ExtractPNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/ExtractPNG.h
deleted file mode 100644
index 807f8e4f6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/ExtractPNG.h
+++ /dev/null
@@ -1,18 +0,0 @@
-static const unsigned char EXTRACT_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x3d, 0x6b, 0xa4, 0x39, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x28, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0x63, 0x60, 0x18, 0x05, 0xa4, 0x81, 0xbb,
-0x28, 0x00, 0x49, 0xe2, 0xce, 0x19, 0x24, 0x70, 0xb6, 0x60, 0xc8, 0x4a,
-0xa0, 0x7a, 0x10, 0x49, 0x82, 0xbd, 0x1c, 0x19, 0x20, 0x49, 0x8c, 0x02,
-0x8a, 0x00, 0x00, 0x11, 0x6c, 0x7c, 0x67, 0x00, 0x94, 0xd4, 0x2c, 0x00,
-0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Info2PNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Info2PNG.h
deleted file mode 100644
index b517084c9..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Info2PNG.h
+++ /dev/null
@@ -1,21 +0,0 @@
-static const unsigned char INFO2_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x12, 0x59, 0x20, 0xcb, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x46, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0x63, 0x60, 0x40, 0x07, 0xbc, 0x77, 0xef,
-0x5e, 0x40, 0x70, 0x76, 0xef, 0xbe, 0x8e, 0x83, 0x73, 0xf7, 0x2e, 0x82,
-0xc3, 0x50, 0x5e, 0x5e, 0x8e, 0x61, 0x10, 0x54, 0x15, 0xc2, 0x34, 0xa0,
-0x7e, 0x84, 0x01, 0xbc, 0x77, 0x91, 0x4d, 0xab, 0xc5, 0x6d, 0x0f, 0xe9,
-0x1c, 0x90, 0xd1, 0x70, 0x5b, 0x41, 0x96, 0xc2, 0xa5, 0x40, 0xce, 0x41,
-0x38, 0xbb, 0xbc, 0x1c, 0x97, 0xb3, 0x09, 0x03, 0x00, 0x3a, 0xb2, 0x32,
-0x23, 0xbc, 0x78, 0x77, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
-0x44, 0xae, 0x42, 0x60, 0x82, 0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/InfoPNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/InfoPNG.h
deleted file mode 100644
index 18109837c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/InfoPNG.h
+++ /dev/null
@@ -1,22 +0,0 @@
-static const unsigned char INFO_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x3d, 0x6b, 0xa4, 0x39, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x57, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0x63, 0x60, 0xa0, 0x05, 0xb8, 0x0b, 0x04,
-0x17, 0xb0, 0x49, 0xdc, 0xde, 0xbd, 0x7b, 0xf7, 0x75, 0xea, 0x48, 0x80,
-0xec, 0xc0, 0x2a, 0xc1, 0x5e, 0x0e, 0x04, 0xc4, 0xba, 0x94, 0x2c, 0xc0,
-0x7b, 0x17, 0x87, 0x07, 0x79, 0x77, 0xef, 0xc6, 0xee, 0x5c, 0xdc, 0x12,
-0x77, 0x71, 0x79, 0xb0, 0x9c, 0x8a, 0x61, 0x35, 0x18, 0x25, 0x20, 0x3e,
-0xbf, 0x7b, 0x17, 0x53, 0x02, 0x1c, 0x56, 0xbb, 0xf7, 0x16, 0x10, 0x2f,
-0x71, 0x17, 0x02, 0x30, 0x24, 0x18, 0xca, 0x21, 0x00, 0x53, 0x62, 0x30,
-0x01, 0x00, 0xd3, 0xa5, 0x67, 0xc0, 0x11, 0x9d, 0x79, 0xc0, 0x00, 0x00,
-0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Move2PNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Move2PNG.h
deleted file mode 100644
index 6eafd8dfd..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Move2PNG.h
+++ /dev/null
@@ -1,21 +0,0 @@
-static const unsigned char MOVE2_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x12, 0x59, 0x20, 0xcb, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x4c, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0x95, 0xce, 0xb1, 0x0d, 0xc0, 0x20, 0x0c,
-0x44, 0xd1, 0xeb, 0xb2, 0x18, 0xad, 0x77, 0xa1, 0x63, 0x4d, 0x0a, 0x4b,
-0xa9, 0xbc, 0x4b, 0x82, 0x41, 0xf0, 0x5b, 0xae, 0xfb, 0x3c, 0xc9, 0x42,
-0xba, 0x5a, 0x67, 0x04, 0xc3, 0x49, 0x6e, 0x8c, 0x92, 0x14, 0x39, 0x2f,
-0x36, 0xdf, 0xd6, 0x3a, 0xc3, 0x18, 0x83, 0x8e, 0x54, 0xc4, 0xcb, 0x6b,
-0x3f, 0xe8, 0x69, 0x63, 0x9e, 0xb0, 0x7f, 0x50, 0x11, 0x00, 0x05, 0x40,
-0x84, 0xab, 0x7d, 0xa9, 0x14, 0x30, 0x23, 0x6c, 0x8b, 0xd3, 0x1c, 0x00,
-0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/MovePNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/MovePNG.h
deleted file mode 100644
index a0dc143a9..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/MovePNG.h
+++ /dev/null
@@ -1,25 +0,0 @@
-static const unsigned char MOVE_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x3d, 0x6b, 0xa4, 0x39, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x71, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0xbd, 0xd1, 0xb1, 0x0d, 0xc0, 0x20, 0x0c,
-0x05, 0x51, 0x2f, 0xc0, 0x56, 0x6e, 0xd9, 0x85, 0x2e, 0x6b, 0x52, 0x58,
-0xa2, 0x62, 0x97, 0x98, 0x22, 0x84, 0x10, 0x5f, 0xcb, 0x6f, 0x4f, 0x4f,
-0x08, 0x10, 0x39, 0xbe, 0x4a, 0xa1, 0x53, 0x30, 0x22, 0x96, 0x29, 0x28,
-0x10, 0x53, 0x20, 0xa6, 0x40, 0x3c, 0xc4, 0xc4, 0xc3, 0x42, 0x52, 0x9f,
-0x1b, 0xe1, 0x25, 0x49, 0xbf, 0xab, 0x14, 0x32, 0x85, 0x49, 0x7e, 0x21,
-0x53, 0x68, 0x74, 0x46, 0x81, 0xd0, 0xe6, 0xe1, 0xdb, 0x3d, 0x1e, 0x20,
-0x72, 0xcd, 0xd9, 0x0a, 0xf6, 0xb7, 0x2a, 0x10, 0x42, 0x30, 0xfe, 0x23,
-0x04, 0x1e, 0x62, 0xe0, 0x7f, 0x1e, 0x03, 0x31, 0x00, 0xd2, 0x01, 0x08,
-0x81, 0xc3, 0xbb, 0x01, 0xf5, 0x5d, 0x59, 0xea, 0x53, 0xc3, 0x86, 0x77,
-0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
-0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/ParentFolder.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/ParentFolder.h
deleted file mode 100644
index 544b9c7cf..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/ParentFolder.h
+++ /dev/null
@@ -1,91 +0,0 @@
-static unsigned char PARENT_FOLDER_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10,
-0x08, 0x03, 0x00, 0x00, 0x00, 0x28, 0x2d, 0x0f, 0x53, 0x00, 0x00, 0x03,
-0x00, 0x50, 0x4c, 0x54, 0x45, 0x01, 0x67, 0x01, 0x08, 0x6e, 0x05, 0x08,
-0x77, 0x04, 0x0c, 0x79, 0x07, 0x11, 0x70, 0x0a, 0x11, 0x7c, 0x09, 0x16,
-0x7c, 0x0c, 0x17, 0x79, 0x13, 0x1f, 0x78, 0x1f, 0x37, 0x7a, 0x0b, 0x21,
-0x7d, 0x21, 0x14, 0x8c, 0x0b, 0x19, 0x98, 0x0d, 0x1c, 0xa0, 0x0f, 0x22,
-0x81, 0x17, 0x27, 0x8c, 0x14, 0x27, 0x8f, 0x14, 0x26, 0x8b, 0x1a, 0x27,
-0x8c, 0x1b, 0x2f, 0x94, 0x1f, 0x31, 0x81, 0x1b, 0x2f, 0x81, 0x2f, 0x3b,
-0x85, 0x2e, 0x3d, 0x8a, 0x3d, 0x3e, 0x8a, 0x3f, 0x3c, 0xa1, 0x1f, 0x34,
-0xb3, 0x1b, 0x41, 0x8c, 0x3e, 0x51, 0x8e, 0x29, 0x43, 0xad, 0x22, 0x44,
-0xb7, 0x22, 0x49, 0xbd, 0x25, 0x59, 0xbe, 0x39, 0x61, 0x93, 0x2e, 0x4e,
-0x8f, 0x41, 0x6b, 0xa5, 0x6c, 0x6c, 0xa6, 0x6d, 0x79, 0xad, 0x7a, 0x57,
-0xc4, 0x2c, 0x67, 0xcc, 0x34, 0x6c, 0xd1, 0x39, 0x60, 0xc5, 0x40, 0x75,
-0xda, 0x42, 0x74, 0xd8, 0x47, 0x7f, 0xe3, 0x4c, 0xb9, 0x9c, 0x11, 0x81,
-0xac, 0x47, 0x85, 0xea, 0x53, 0x8e, 0xf4, 0x5c, 0xcc, 0x99, 0x01, 0xd6,
-0xa5, 0x17, 0xd1, 0xa4, 0x1e, 0xd3, 0xa9, 0x2c, 0xdd, 0xaf, 0x35, 0xde,
-0xb5, 0x36, 0xdf, 0xba, 0x3c, 0xe6, 0xbc, 0x3e, 0xde, 0xbe, 0x51, 0xd9,
-0xb9, 0x58, 0xdb, 0xbe, 0x66, 0xe2, 0xb8, 0x43, 0xe6, 0xbc, 0x51, 0xdf,
-0xc3, 0x6b, 0xe6, 0xc2, 0x44, 0xec, 0xc6, 0x4e, 0xea, 0xc0, 0x57, 0xf2,
-0xcc, 0x5b, 0xe2, 0xc6, 0x71, 0xe6, 0xc9, 0x79, 0xe6, 0xd1, 0x63, 0xf2,
-0xd5, 0x64, 0xf5, 0xdf, 0x79, 0xff, 0xdc, 0x77, 0xef, 0xe0, 0x7b, 0xfc,
-0xe4, 0x7c, 0x89, 0xb7, 0x8b, 0x8f, 0xbc, 0x87, 0xb7, 0xd3, 0xba, 0xdf,
-0xec, 0x86, 0xdf, 0xe6, 0xaf, 0xe3, 0xce, 0x92, 0xe4, 0xd3, 0x9e, 0xe4,
-0xd4, 0x9e, 0xec, 0xd9, 0x99, 0xec, 0xd9, 0x9f, 0xfc, 0xd4, 0x83, 0xff,
-0xdb, 0x89, 0xe5, 0xd6, 0xa3, 0xe5, 0xd7, 0xab, 0xef, 0xdf, 0xab, 0xff,
-0xe8, 0x83, 0xff, 0xea, 0x95, 0xff, 0xf2, 0x8c, 0xff, 0xf9, 0x93, 0xff,
-0xff, 0x99, 0xef, 0xf5, 0xbc, 0xf2, 0xe6, 0xa4, 0xff, 0xe6, 0xa0, 0xff,
-0xf2, 0xa9, 0xff, 0xf8, 0xa6, 0xff, 0xff, 0xac, 0xff, 0xff, 0xbe, 0xc6,
-0xdb, 0xc9, 0xd6, 0xe3, 0xd9, 0xea, 0xe2, 0xca, 0xeb, 0xe7, 0xd6, 0xee,
-0xea, 0xdb, 0xf5, 0xea, 0xc1, 0xff, 0xf4, 0xc8, 0xff, 0xfe, 0xc6, 0xfc,
-0xf9, 0xcf, 0xff, 0xff, 0xd1, 0xff, 0xff, 0xd9, 0xe5, 0xed, 0xe9, 0xff,
-0xff, 0xe7, 0xf3, 0xf4, 0xf7, 0xff, 0xff, 0xf2, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xd0, 0xf6, 0xa4, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0e, 0xc4, 0x00, 0x00,
-0x0e, 0xc4, 0x01, 0x95, 0x2b, 0x0e, 0x1b, 0x00, 0x00, 0x00, 0xc1, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0x63, 0x28, 0x86, 0x02, 0x15, 0x89, 0x74,
-0x30, 0xcd, 0x00, 0xe5, 0xfb, 0x32, 0xf1, 0xb0, 0x7b, 0x23, 0x09, 0x14,
-0x72, 0xf1, 0x4a, 0xc9, 0x09, 0x88, 0xa6, 0xc1, 0x05, 0x94, 0xb9, 0xa5,
-0xe4, 0xd5, 0xd4, 0x25, 0x19, 0x55, 0xc1, 0x02, 0xa6, 0xa6, 0xa6, 0x0c,
-0xcc, 0xac, 0xb2, 0xea, 0x1a, 0x1c, 0xac, 0xac, 0x20, 0x01, 0xd3, 0xe0,
-0xbc, 0x78, 0xa0, 0x18, 0xbf, 0x86, 0x96, 0x38, 0xc4, 0x0c, 0xd3, 0xdc,
-0xb8, 0xb8, 0xd4, 0xfc, 0x5c, 0x36, 0x2d, 0x1d, 0x31, 0xa8, 0x40, 0x72,
-0x2c, 0x10, 0x98, 0x72, 0xea, 0x68, 0x2b, 0x99, 0x9a, 0x82, 0x05, 0xa2,
-0xbd, 0xdc, 0xec, 0xcd, 0x43, 0xa4, 0xf5, 0x15, 0x7c, 0x4a, 0xec, 0xc0,
-0x02, 0x61, 0x36, 0x91, 0x45, 0x05, 0xb9, 0x7c, 0x06, 0x82, 0xfe, 0x09,
-0xe1, 0x60, 0x81, 0x50, 0xe7, 0x94, 0xb8, 0x38, 0x3f, 0x61, 0x4d, 0xc5,
-0x24, 0x4b, 0x88, 0x19, 0x8e, 0xd9, 0x31, 0x31, 0x31, 0x7a, 0x42, 0x22,
-0x9e, 0xee, 0x01, 0x10, 0x01, 0xdb, 0x9c, 0xa8, 0xa8, 0x28, 0x16, 0x19,
-0x57, 0x07, 0xb3, 0x2c, 0x88, 0x80, 0x4b, 0xa2, 0x87, 0x93, 0x85, 0xae,
-0xa1, 0xb1, 0x55, 0x10, 0xd4, 0xda, 0x10, 0x23, 0x43, 0x13, 0xeb, 0xc0,
-0x8c, 0x62, 0x98, 0x6f, 0x4d, 0x4d, 0x23, 0x32, 0x8b, 0xe1, 0x00, 0x00,
-0xfc, 0x33, 0x50, 0x72, 0x6d, 0x03, 0x36, 0xf2, 0x00, 0x00, 0x00, 0x00,
-0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Test2PNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Test2PNG.h
deleted file mode 100644
index 80a768ac6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/Test2PNG.h
+++ /dev/null
@@ -1,21 +0,0 @@
-static const unsigned char TEST2_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x12, 0x59, 0x20, 0xcb, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x47, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0xb5, 0xcd, 0xbb, 0x11, 0x00, 0x20, 0x08,
-0x03, 0x50, 0x16, 0x60, 0x57, 0x47, 0xb5, 0xb3, 0xc2, 0x0d, 0xcc, 0x0c,
-0x22, 0x9f, 0xc3, 0xde, 0x33, 0x05, 0x29, 0x5e, 0xee, 0x20, 0xfa, 0x1e,
-0x16, 0x91, 0x1e, 0x97, 0x26, 0xb0, 0x9a, 0x17, 0x31, 0x80, 0x71, 0x06,
-0xda, 0x3d, 0xc0, 0x29, 0xc0, 0x29, 0xc1, 0x28, 0xc1, 0x29, 0xc1, 0x68,
-0xd4, 0xc7, 0x0b, 0x94, 0x0a, 0x94, 0x2e, 0x78, 0xc9, 0x06, 0xae, 0xb5,
-0x39, 0x27, 0x85, 0x82, 0xfa, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45,
-0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/TestPNG.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/TestPNG.h
deleted file mode 100644
index c1c0887eb..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/res/TestPNG.h
+++ /dev/null
@@ -1,25 +0,0 @@
-static const unsigned char TEST_png[] = {
-0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
-0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x24,
-0x04, 0x03, 0x00, 0x00, 0x00, 0x3d, 0x6b, 0xa4, 0x39, 0x00, 0x00, 0x00,
-0x30, 0x50, 0x4c, 0x54, 0x45, 0xff, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00,
-0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00,
-0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x00,
-0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
-0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x14, 0x3b, 0x9d, 0x00, 0x00, 0x00,
-0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00,
-0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-0x00, 0x00, 0x01, 0xea, 0x65, 0x16, 0xa4, 0x00, 0x00, 0x00, 0x75, 0x49,
-0x44, 0x41, 0x54, 0x78, 0x9c, 0xd5, 0xd1, 0x31, 0x1a, 0x80, 0x20, 0x08,
-0x05, 0x60, 0xc7, 0x96, 0xee, 0xdb, 0xd8, 0x05, 0xb8, 0x9b, 0x9b, 0x53,
-0xdd, 0xa0, 0xce, 0x10, 0x20, 0xfa, 0x55, 0xef, 0xd5, 0x2e, 0x23, 0xf2,
-0x2b, 0x60, 0x4a, 0x63, 0xc4, 0x66, 0x91, 0x31, 0x3f, 0x9f, 0x1a, 0xc7,
-0x82, 0x07, 0xbb, 0x1d, 0x94, 0xf5, 0x1f, 0xdc, 0x6f, 0x7d, 0x00, 0xf1,
-0x2a, 0xf2, 0xc2, 0xe4, 0x65, 0x99, 0xbc, 0xd0, 0xc9, 0xbb, 0xa5, 0x4e,
-0xa0, 0xa5, 0x20, 0x38, 0x43, 0x10, 0x32, 0x43, 0x25, 0x64, 0xe8, 0x4a,
-0xd8, 0xd0, 0x12, 0x79, 0xd8, 0x52, 0x23, 0xb8, 0x25, 0xe1, 0xa0, 0x11,
-0xb2, 0x56, 0x27, 0xec, 0x1f, 0x9c, 0x30, 0x60, 0x84, 0x02, 0x23, 0x1c,
-0x28, 0xe1, 0x40, 0xc9, 0x07, 0x18, 0x21, 0x2e, 0x97, 0xf8, 0xa1, 0xe3,
-0xf9, 0x5b, 0x6d, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44,
-0xae, 0x42, 0x60, 0x82, 0x00,
-};
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/resource.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/resource.h
deleted file mode 100644
index 4bebb95a6..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/resource.h
+++ /dev/null
@@ -1,168 +0,0 @@
-#define IDI_FAM 101
-#define IDI_FM 101
-#define IDR_MENUBAR1 103
-#define IDM_MENU 103
-#define IDR_ACCELERATOR1 209
-#define IDM_FILE_OPEN 210
-#define IDM_FILE_OPEN_INSIDE 211
-#define IDM_FILE_OPEN_OUTSIDE 212
-#define IDM_FILE_VIEW 220
-#define IDM_FILE_EDIT 221
-#define IDM_RENAME 230
-#define IDM_COPY_TO 231
-#define IDM_MOVE_TO 232
-#define IDM_DELETE 233
-#define IDM_FILE_SPLIT 238
-#define IDM_FILE_COMBINE 239
-#define IDM_FILE_PROPERTIES 240
-#define IDM_FILE_COMMENT 241
-#define IDM_FILE_CRC 242
-#define IDM_CREATE_FOLDER 250
-#define IDM_CREATE_FILE 251
-#define IDM_EDIT_CUT 320
-#define IDM_EDIT_COPY 321
-#define IDM_EDIT_PASTE 322
-#define IDM_SELECT_ALL 330
-#define IDM_DESELECT_ALL 331
-#define IDM_INVERT_SELECTION 332
-#define IDM_SELECT 333
-#define IDM_DESELECT 334
-#define IDM_SELECT_BY_TYPE 335
-#define IDM_DESELECT_BY_TYPE 336
-#define IDM_VIEW_LARGE_ICONS 410
-#define IDM_VIEW_SMALL_ICONS 411
-#define IDM_VIEW_LIST 412
-#define IDM_VIEW_DETAILS 413
-#define IDM_VIEW_ARANGE_BY_NAME 420
-#define IDM_VIEW_ARANGE_BY_TYPE 421
-#define IDM_VIEW_ARANGE_BY_DATE 422
-#define IDM_VIEW_ARANGE_BY_SIZE 423
-#define IDM_VIEW_ARANGE_NO_SORT 424
-#define IDM_OPEN_ROOT_FOLDER 430
-#define IDM_OPEN_PARENT_FOLDER 431
-#define IDM_FOLDERS_HISTORY 432
-#define IDM_VIEW_REFRESH 440
-#define IDM_VIEW_FLAT_VIEW 449
-#define IDM_VIEW_TWO_PANELS 450
-#define IDM_VIEW_TOOLBARS 451
-#define IDM_VIEW_STANDARD_TOOLBAR 460
-#define IDM_VIEW_ARCHIVE_TOOLBAR 461
-#define IDM_VIEW_TOOLBARS_LARGE_BUTTONS 462
-#define IDM_VIEW_TOOLBARS_SHOW_BUTTONS_TEXT 463
-#define IDM_OPTIONS 510
-#define IDM_BENCHMARK 511
-#define IDM_HELP_CONTENTS 610
-#define IDM_ABOUT 620
-#define IDS_BOOKMARK 720
-#define IDB_ADD 2002
-#define IDB_EXTRACT 2003
-#define IDB_TEST 2004
-#define IDB_COPY 2010
-#define IDB_MOVE 2011
-#define IDB_DELETE 2012
-#define IDB_INFO 2013
-#define IDB_ADD2 2082
-#define IDB_EXTRACT2 2083
-#define IDB_TEST2 2084
-#define IDB_COPY2 2090
-#define IDB_MOVE2 2091
-#define IDB_DELETE2 2092
-#define IDB_INFO2 2093
-#define IDS_APP_TITLE 2200
-#define IDS_COPY 2201
-#define IDS_MOVE 2202
-#define IDS_COPY_TO 2203
-#define IDS_MOVE_TO 2204
-#define IDS_COPYING 2205
-#define IDS_MOVING 2206
-#define IDS_CANNOT_COPY 2207
-#define IDS_OPERATION_IS_NOT_SUPPORTED 2208
-
-#define IDS_CONFIRM_FILE_DELETE 2210
-#define IDS_CONFIRM_FOLDER_DELETE 2211
-#define IDS_CONFIRM_ITEMS_DELETE 2212
-#define IDS_WANT_TO_DELETE_FILE 2213
-#define IDS_WANT_TO_DELETE_FOLDER 2214
-#define IDS_WANT_TO_DELETE_ITEMS 2215
-#define IDS_DELETING 2216
-#define IDS_ERROR_DELETING 2217
-#define IDS_ERROR_LONG_PATH_TO_RECYCLE 2218
-
-#define IDS_RENAMING 2220
-#define IDS_ERROR_RENAMING 2221
-#define IDS_CONFIRM_FILE_COPY 2222
-#define IDS_WANT_TO_COPY_FILES 2223
-
-
-#define IDS_CREATE_FOLDER 2230
-#define IDS_CREATE_FOLDER_NAME 2231
-#define IDS_CREATE_FOLDER_DEFAULT_NAME 2232
-#define IDS_CREATE_FOLDER_ERROR 2233
-#define IDS_CREATE_FILE 2240
-#define IDS_CREATE_FILE_NAME 2241
-#define IDS_CREATE_FOLDER_DEFAULT_FILE_NAME 2242
-#define IDS_CREATE_FILE_DEFAULT_NAME 2242
-#define IDS_CREATE_FILE_ERROR 2243
-#define IDS_SELECT 2250
-#define IDS_DESELECT 2251
-#define IDS_SELECT_MASK 2252
-#define IDS_FOLDERS_HISTORY 2260
-#define IDS_N_SELECTED_ITEMS 2270
-#define IDS_FILES_COLON 2274
-#define IDS_FOLDERS_COLON 2275
-#define IDS_SIZE_COLON 2276
-
-#define IDS_TOO_MANY_ITEMS 2279
-#define IDS_WANT_UPDATE_MODIFIED_FILE 2280
-#define IDS_CANNOT_UPDATE_FILE 2281
-#define IDS_CANNOT_START_EDITOR 2282
-#define IDS_OPENNING 2283
-#define IDS_VIRUS 2284
-#define IDS_COMPUTER 2300
-#define IDS_NETWORK 2301
-#define IDS_DOCUMENTS 2302
-#define IDS_ADD 2400
-#define IDS_EXTRACT 2401
-#define IDS_TEST 2402
-#define IDS_BUTTON_COPY 2420
-#define IDS_BUTTON_MOVE 2421
-#define IDS_BUTTON_DELETE 2422
-#define IDS_BUTTON_INFO 2423
-#define IDS_PROP_TOTAL_SIZE 3100
-#define IDS_PROP_FREE_SPACE 3101
-#define IDS_PROP_CLUSTER_SIZE 3102
-#define IDS_PROP_VOLUME_NAME 3103
-#define IDS_PROP_LOCAL_NAME 3200
-#define IDS_PROP_PROVIDER 3201
-#define IDS_OPTIONS 4000
-#define IDS_COMMENT 4001
-#define IDS_COMMENT2 4002
-#define IDS_SYSTEM 4010
-
-#define IDS_SPLITTING 4020
-#define IDS_SPLIT_CONFIRM_TITLE 4021
-#define IDS_SPLIT_CONFIRM_MESSAGE 4022
-#define IDS_SPLIT_VOL_MUST_BE_SMALLER 4023
-
-#define IDS_COMBINE 4030
-#define IDS_COMBINE_TO 4031
-#define IDS_COMBINING 4032
-#define IDS_COMBINE_SELECT_ONE_FILE 4033
-#define IDS_COMBINE_CANT_DETECT_SPLIT_FILE 4034
-#define IDS_COMBINE_CANT_FIND_MORE_THAN_ONE_PART 4035
-
-#define IDS_CHECKSUM_CALCULATING 4040
-#define IDS_CHECKSUM_INFORMATION 4041
-#define IDS_CHECKSUM_CRC_DATA 4042
-#define IDS_CHECKSUM_CRC_DATA_NAMES 4043
-
-#define IDS_SCANNING 4050
-#define IDS_PROPERTIES 4060
-
-#define IDS_PROGRESS_TESTING 4100
-#define IDS_MESSAGE_NO_ERRORS 4200
-
-#define IDS_MESSAGE_UNSUPPORTED_OPERATION_FOR_LONG_PATH_FOLDER 4301
-#define IDS_SELECT_ONE_FILE 4302
-#define IDS_SELECT_FILES 4303
-#define IDS_FILE_EXIST 4304
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/wxFM.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/wxFM.cpp
deleted file mode 100644
index 1fa11d1e7..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/FileManager/wxFM.cpp
+++ /dev/null
@@ -1,345 +0,0 @@
-// wxFM.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-// #include "../GUI/p7zip_32.xpm"
-
-int Main1(int argc,TCHAR **argv);
-
-/*
-int Main1(int argc,TCHAR **argv)
-{
- // FIXME
- Sleep(10000);
-}
-*/
-
-
-#include "Windows/Registry.h"
-using namespace NWindows;
-using namespace NRegistry;
-
-
-#include "Common/StringConvert.h"
-#include "Windows/FileDir.h"
-#include "Windows/Synchronization.h"
-
-// FIXME #include "ExtractRes.h"
-#include "../Explorer/MyMessages.h"
-
-// FIXME #include "ExtractGUI.h"
-// FIXME #include "UpdateGUI.h"
-// FIXME #include "BenchmarkDialog.h"
-#include "RegistryUtils.h"
-
-using namespace NWindows;
-using namespace NFile;
-
-#include "../FileManager/ProgramLocation.h"
-
-static LPCWSTR kHelpFileName = L"help/";
-
-void ShowHelpWindow(HWND hwnd, LPCWSTR topicFile)
-{
- UString path;
- if (!::GetProgramFolderPath(path))
- return;
- path += kHelpFileName;
- path += topicFile;
- printf("ShowHelpWindow(%p,%ls)=>%ls\n",hwnd,topicFile,(const wchar_t *)path);
- // HtmlHelp(hwnd, GetSystemString(path), HH_DISPLAY_TOPIC, NULL);
- wxString path2(path);
- wxLaunchDefaultBrowser(path2);
-}
-
-////////////////////////////// TRIES ///////////////////////////////////
-
-// FIXME : duplicate
-
-#if 0
-static const TCHAR *kCUBasePath = TEXT("Software/7-ZIP");
-static const WCHAR *kLangValueName = L"Lang";
-
-void SaveRegLang(const UString &langFile)
-{
- CKey key;
- key.Create(HKEY_CURRENT_USER, kCUBasePath);
- key.SetValue(kLangValueName, langFile);
-}
-
-void ReadRegLang(UString &langFile)
-{
- langFile.Empty();
- CKey key;
- if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) == ERROR_SUCCESS)
- key.QueryValue(kLangValueName, langFile);
-}
-#endif
-
-
-//////////////////////////////////
-
-#define NEED_NAME_WINDOWS_TO_UNIX
-#include "myPrivate.h" // global_use_utf16_conversion
-
-void mySplitCommandLineW(int numArguments, TCHAR **arguments,UStringVector &parts) {
-
- parts.Clear();
- for(int ind=0;ind < numArguments; ind++) {
- UString tmp = arguments[ind];
- // tmp.Trim(); " " is a valid filename ...
- if (!tmp.IsEmpty()) {
- parts.Add(tmp);
- }
- }
-}
-
-// ----------------------------------------------------------------------------
-// private classes
-// ----------------------------------------------------------------------------
-
-// Define a new frame type
-#if 0
-class MyFrame: public wxFrame
-{
-public:
- // ctor
- MyFrame(wxFrame *frame, const wxString& title, int x, int y, int w, int h);
- // virtual ~MyFrame();
-
- // operations
- void WriteText(const wxString& text) { m_txtctrl->WriteText(text); }
-
-protected:
- // callbacks
- void OnWorkerEvent(wxCommandEvent& event);
-private:
- // just some place to put our messages in
- wxTextCtrl *m_txtctrl;
- DECLARE_EVENT_TABLE()
-};
-
-enum {
- WORKER_EVENT=100 // this one gets sent from the worker thread
-};
-
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
- EVT_MENU(WORKER_EVENT, MyFrame::OnWorkerEvent)
- // EVT_IDLE(MyFrame::OnIdle)
-END_EVENT_TABLE()
-
-// My frame constructor
-MyFrame::MyFrame(wxFrame *frame, const wxString& title,
- int x, int y, int w, int h)
- : wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
-{
- //FIXME this->SetIcon(wxICON(p7zip_32));
-
-#if wxUSE_STATUSBAR
- CreateStatusBar(2);
-#endif // wxUSE_STATUSBAR
-
- m_txtctrl = new wxTextCtrl(this, wxID_ANY, _T(""), wxPoint(0, 0), wxSize(0, 0), wxTE_MULTILINE | wxTE_READONLY);
-}
-
-void myCreateHandle(int n);
-void MyFrame::OnWorkerEvent(wxCommandEvent& event)
-{
- int n = event.GetInt();
- myCreateHandle(n);
-}
-
-wxWindow * g_window=0;
-#endif
-
-
-// Define a new application type, each program should derive a class from wxApp
-class MyApp : public wxApp
-{
-public:
- // override base class virtuals
- // ----------------------------
-
- // this one is called on application startup and is a good place for the app
- // initialization (doing it here and not in the ctor allows to have an error
- // return: if OnInit() returns false, the application terminates)
- virtual bool OnInit();
-};
-
-// Create a new application object: this macro will allow wxWidgets to create
-// the application object during program execution (it's better than using a
-// static object for many reasons) and also implements the accessor function
-// wxGetApp() which will return the reference of the right type (i.e. MyApp and
-// not wxApp)
-IMPLEMENT_APP(MyApp)
-
-time_t g_T0 = 0;
-
-#if 0
-class MyThread : public wxThread
-{
- int _argc;
- TCHAR **_argv;
-public:
- MyThread(int argc,TCHAR **argv): wxThread(),_argc(argc), _argv(argv) {}
-
- // thread execution starts here
- virtual void *Entry()
- {
- int ret = Main1(_argc,_argv);
- exit(ret);
- }
-};
-#endif
-
-// 'Main program' equivalent: the program execution "starts" here
-bool MyApp::OnInit()
-{
- // don't parse the command-line options !
- // : if ( !wxApp::OnInit() ) return false;
-
- { // define P7ZIP_HOME_DIR
- extern void my_windows_split_path(const AString &p_path, AString &dir , AString &base);
- static char p7zip_home_dir[MAX_PATH];
-
- UString fullPath;
- NDirectory::MyGetFullPathName(wxApp::argv[0], fullPath);
- AString afullPath = GetAnsiString(fullPath);
-
- AString dir,name;
-
- my_windows_split_path(afullPath,dir,name);
-
- const char *dir2 = nameWindowToUnix((const char *)dir);
- snprintf(p7zip_home_dir,sizeof(p7zip_home_dir),"P7ZIP_HOME_DIR=%s/",dir2);
- p7zip_home_dir[sizeof(p7zip_home_dir)-1] = 0;
- putenv(p7zip_home_dir);
- // DEBUG printf("putenv(%s)\n",p7zip_home_dir);
- }
- global_use_utf16_conversion = 1; // UNICODE !
-
- g_T0 = time(0);
- // DEBUG printf("MAIN Thread : 0x%lx\n",wxThread::GetCurrentId());
-
- // Create the main frame window
-#if 0
- MyFrame *frame = new MyFrame((wxFrame *)NULL, _T("7-zip Main Window"), 50, 50, 450, 340);
- // Don't Show the frame !
- frame->Show(true); // FIXME
-
- SetTopWindow(frame);
-
- g_window = frame;
-#endif
-
- /*
- MyThread *thread = new MyThread(wxApp::argc,wxApp::argv);
- thread->Create(); // != wxTHREAD_NO_ERROR
- thread->Run();
- */
-
- wxInitAllImageHandlers();
-
- Main1(wxApp::argc,wxApp::argv);
-
- // success: wxApp::OnRun() will be called which will enter the main message
- // loop and the application will run. If we returned false here, the
- // application would exit immediately.
- return true;
-}
-
-DWORD WINAPI GetTickCount(VOID) {
- static wxStopWatch sw;
- return sw.Time();
-}
-
-//////////////////////////////////////////
-
-#if 0
-#include "resource.h"
-#include "ExtractRes.h"
-
-static CStringTable g_stringTable[] =
-{
- /* resource.rc */
- /***************/
- { IDS_OPEN_TYPE_ALL_FILES, L"All Files" },
- { IDS_METHOD_STORE, L"Store" },
- { IDS_METHOD_NORMAL, L"Normal" },
- { IDS_METHOD_MAXIMUM, L"Maximum" },
- { IDS_METHOD_FAST, L"Fast" },
- { IDS_METHOD_FASTEST, L"Fastest" },
- { IDS_METHOD_ULTRA, L"Ultra" },
- { IDS_COMPRESS_NON_SOLID, L"Non-solid" },
- { IDS_COMPRESS_SOLID, L"Solid" },
-
- { IDS_COMPRESS_UPDATE_MODE_ADD, L"Add and replace files" },
- { IDS_COMPRESS_UPDATE_MODE_UPDATE, L"Update and add files" },
- { IDS_COMPRESS_UPDATE_MODE_FRESH, L"Freshen existing files" },
- { IDS_COMPRESS_UPDATE_MODE_SYNCHRONIZE, L"Synchronize files" },
- { IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE, L"Browse" },
- { IDS_COMPRESS_INCORRECT_VOLUME_SIZE, L"Incorrect volume size" },
- { IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE, L"Specified volume size: {0} bytes.\nAre you sure you want to split archive into such volumes?" },
-
- { IDS_PASSWORD_USE_ASCII, L"Use only English letters, numbers and special characters (!, #, $, ...) for password." },
- { IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH, L"Passwords do not match" },
- { IDS_PASSWORD_IS_TOO_LONG, L"Password is too long" },
-
- { IDS_PROGRESS_COMPRESSING, L"Compressing" },
- { IDS_PROGRESS_TESTING, L"Testing" },
- { IDS_MESSAGE_NO_ERRORS, L"There are no errors" },
- { IDS_FILES_COLON, L"Files:" },
- { IDS_FOLDERS_COLON, L"Folders:" },
- { IDS_SIZE_COLON, L"Size:" },
- { IDS_COMPRESSED_COLON, L"Compressed size:" },
- { IDS_ARCHIVES_COLON, L"Archives:" },
-
- /* Extract.rc */
- /**************/
- { IDS_CANNOT_CREATE_FOLDER , L"Cannot create folder '{0}'"},
- { IDS_OPEN_IS_NOT_SUPORTED_ARCHIVE, L"File is not supported archive."},
-
- { IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC , L"CRC failed in '{0}'. File is broken."},
- { IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR , L"Data error in '{0}'. File is broken"},
- { IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_UNSUPPORTED_METHOD , L"Unsupported compression method for '{0}'."},
- { IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC_ENCRYPTED , L"CRC failed in encrypted file '{0}'. Wrong password?"},
- { IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED , L"Data error in encrypted file '{0}'. Wrong password?"},
-
- { IDS_EXTRACT_SET_FOLDER , L"Specify a location for extracted files."},
- { IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CANNOT_OPEN_FILE, L"Can not open output file '{0}'."},
- { IDS_PROGRESS_EXTRACTING, L"Extracting" },
-
- { IDS_CANT_OPEN_ARCHIVE , L"Can not open file '{0}' as archive"},
- { IDS_CANT_OPEN_ENCRYPTED_ARCHIVE , L"Can not open encrypted archive '{0}'. Wrong password?"},
-
- { 0 , 0 }
-};
-
-REGISTER_STRINGTABLE(g_stringTable)
-#endif
-
-
-///////////////////////////////////////////
-
-namespace NFsFolder {
-
- // FIXME
- bool wxw_CopyFile(LPCWSTR existingFile, LPCWSTR newFile, bool overwrite)
- {
- return wxCopyFile(wxString(existingFile), wxString(newFile), overwrite);
- }
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialog.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialog.cpp
deleted file mode 100644
index c7a1cc5be..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialog.cpp
+++ /dev/null
@@ -1,581 +0,0 @@
-// BenchmarkDialog.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringToInt.h"
-#include "Common/MyException.h"
-#include "Windows/Thread.h"
-#include "Windows/Error.h"
-#include "Windows/System.h"
-#include "../FileManager/HelpUtils.h"
-// #include "BenchmarkDialogRes.h"
-#include "BenchmarkDialog.h"
-
-using namespace NWindows;
-
-// const int kNumBenchDictionaryBitsStart = 21;
-
-static LPCWSTR kHelpTopic = L"fm/benchmark.htm";
-
-static const UINT_PTR kTimerID = 4;
-static const UINT kTimerElapse = 1000;
-
-#ifdef LANG
-#include "../FileManager/LangUtils.h"
-#endif
-
-using namespace NWindows;
-
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDC_BENCHMARK_DICTIONARY, 0x02000D0C },
- { IDC_BENCHMARK_MEMORY, 0x03080001 },
- { IDC_BENCHMARK_NUM_THREADS, 0x02000D12 },
- { IDC_BENCHMARK_SPEED_LABEL, 0x03080004 },
- { IDC_BENCHMARK_RATING_LABEL, 0x03080005 },
- { IDC_BENCHMARK_COMPRESSING, 0x03080002 },
- { IDC_BENCHMARK_DECOMPRESSING, 0x03080003 },
- { IDC_BENCHMARK_CURRENT, 0x03080007 },
- { IDC_BENCHMARK_RESULTING, 0x03080008 },
- { IDC_BENCHMARK_CURRENT2, 0x03080007 },
- { IDC_BENCHMARK_RESULTING2, 0x03080008 },
- { IDC_BENCHMARK_TOTAL_RATING, 0x03080006 },
- { IDC_BENCHMARK_ELAPSED, 0x02000C01 },
- { IDC_BENCHMARK_SIZE, 0x02000C03 },
- { IDC_BENCHMARK_PASSES, 0x03080009 },
- // { IDC_BENCHMARK_ERRORS, 0x0308000A },
- { IDC_BENCHMARK_USAGE_LABEL, 0x0308000B },
- { IDC_BENCHMARK_RPU_LABEL, 0x0308000C },
- { IDC_BENCHMARK_COMBO_NUM_THREADS, 0x02000D12},
-
- { IDC_BUTTON_STOP, 0x02000714 },
- { IDC_BUTTON_RESTART, 0x02000715 },
- { IDHELP, 0x02000720 },
- { IDCANCEL, 0x02000710 }
-};
-#endif
-
-static void MyMessageBoxError(HWND hwnd, LPCWSTR message)
-{
- MessageBoxW(hwnd, message, L"7-Zip", MB_ICONERROR);
-}
-
-const LPCTSTR kProcessingString = TEXT("...");
-const LPCTSTR kMB = TEXT(" MB");
-const LPCTSTR kMIPS = TEXT(" MIPS");
-const LPCTSTR kKBs = TEXT(" KB/s");
-
-static const int kMinDicLogSize = 21;
-static const UInt32 kMinDicSize = (1 << kMinDicLogSize);
-static const UInt32 kMaxDicSize =
- #ifdef _WIN64
- (1 << 30);
- #else
- (1 << 27);
- #endif
-
-bool CBenchmarkDialog::OnInit()
-{
- #ifdef LANG
- LangSetWindowText(HWND(*this), 0x03080000);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- #endif
-
- _syncInfo.Init();
-
- m_Dictionary.Attach(GetItem(IDC_BENCHMARK_COMBO_DICTIONARY));
- int cur = 0;
- // _syncInfo.DictionarySize = (1 << kNumBenchDictionaryBitsStart);
-
- UInt32 numCPUs = NSystem::GetNumberOfProcessors();
- if (numCPUs < 1)
- numCPUs = 1;
- numCPUs = MyMin(numCPUs, (UInt32)(1 << 8));
- cur = 0;
- bool setDefaultThreads = (_syncInfo.NumThreads == (UInt32)(-1));
- if (setDefaultThreads)
- {
- _syncInfo.NumThreads = numCPUs;
- if (_syncInfo.NumThreads > 1)
- _syncInfo.NumThreads &= ~1;
- }
-
- UInt64 ramSize = NSystem::GetRamSize();
- bool setDefaultDictionary = (_syncInfo.DictionarySize == (UInt32)(-1));
- if (setDefaultDictionary)
- {
- int dicSizeLog;
- for (dicSizeLog = 25; dicSizeLog >= kBenchMinDicLogSize; dicSizeLog--)
- if (GetBenchMemoryUsage(_syncInfo.NumThreads, ((UInt32)1 << dicSizeLog)) + (8 << 20) <= ramSize)
- break;
- _syncInfo.DictionarySize = (1 << dicSizeLog);
- }
- if (_syncInfo.DictionarySize < kMinDicSize)
- _syncInfo.DictionarySize = kMinDicSize;
- if (_syncInfo.DictionarySize > kMaxDicSize)
- _syncInfo.DictionarySize = kMaxDicSize;
-
- for (int i = kMinDicLogSize; i <= 30; i++)
- for (int j = 0; j < 2; j++)
- {
- UInt32 dictionary = (1 << i) + (j << (i - 1));
- if (dictionary > kMaxDicSize)
- continue;
- TCHAR s[40];
- ConvertUInt64ToString((dictionary >> 20), s);
- lstrcat(s, kMB);
- int index = (int)m_Dictionary.AddString(s);
- m_Dictionary.SetItemData(index, dictionary);
- if (dictionary <= _syncInfo.DictionarySize)
- cur = index;
- }
- m_Dictionary.SetCurSel(cur);
-
- m_NumThreads.Attach(GetItem(IDC_BENCHMARK_COMBO_NUM_THREADS));
- for (UInt32 num = 1; ;)
- {
- if (num > numCPUs * 2)
- break;
- TCHAR s[40];
- ConvertUInt64ToString(num, s);
- int index = (int)m_NumThreads.AddString(s);
- m_NumThreads.SetItemData(index, num);
- if (num <= numCPUs && setDefaultThreads)
- {
- _syncInfo.NumThreads = num;
- cur = index;
- }
- if (num > 1)
- num++;
- num++;
- }
- m_NumThreads.SetCurSel(cur);
-
- OnChangeSettings();
-
- _syncInfo._startEvent.Set();
- _timer = SetTimer(kTimerID, kTimerElapse);
- return CModalDialog::OnInit();
-}
-
-UInt32 CBenchmarkDialog::GetNumberOfThreads()
-{
- return (UInt32)m_NumThreads.GetItemData(m_NumThreads.GetCurSel());
-}
-
-UInt32 CBenchmarkDialog::OnChangeDictionary()
-{
- UInt32 dictionary = (UInt32)m_Dictionary.GetItemData(m_Dictionary.GetCurSel());
- UInt64 memUsage = GetBenchMemoryUsage(GetNumberOfThreads(), dictionary);
- memUsage = (memUsage + (1 << 20) - 1) >> 20;
- TCHAR s[40];
- ConvertUInt64ToString(memUsage, s);
- lstrcat(s, kMB);
- SetItemText(IDC_BENCHMARK_MEMORY_VALUE, s);
- return dictionary;
-}
-
-static const UInt32 g_IDs[] =
-{
- IDC_BENCHMARK_COMPRESSING_USAGE,
- IDC_BENCHMARK_COMPRESSING_USAGE2,
- IDC_BENCHMARK_COMPRESSING_SPEED,
- IDC_BENCHMARK_COMPRESSING_SPEED2,
- IDC_BENCHMARK_COMPRESSING_RATING,
- IDC_BENCHMARK_COMPRESSING_RATING2,
- IDC_BENCHMARK_COMPRESSING_RPU,
- IDC_BENCHMARK_COMPRESSING_RPU2,
-
- IDC_BENCHMARK_DECOMPRESSING_SPEED,
- IDC_BENCHMARK_DECOMPRESSING_SPEED2,
- IDC_BENCHMARK_DECOMPRESSING_RATING,
- IDC_BENCHMARK_DECOMPRESSING_RATING2,
- IDC_BENCHMARK_DECOMPRESSING_USAGE,
- IDC_BENCHMARK_DECOMPRESSING_USAGE2,
- IDC_BENCHMARK_DECOMPRESSING_RPU,
- IDC_BENCHMARK_DECOMPRESSING_RPU2,
-
- IDC_BENCHMARK_TOTAL_USAGE_VALUE,
- IDC_BENCHMARK_TOTAL_RATING_VALUE,
- IDC_BENCHMARK_TOTAL_RPU_VALUE
-};
-
-void CBenchmarkDialog::OnChangeSettings()
-{
- EnableItem(IDC_BUTTON_STOP, true);
- UInt32 dictionary = OnChangeDictionary();
- TCHAR s[40] = { TEXT('/'), TEXT(' '), 0 };
- ConvertUInt64ToString(NSystem::GetNumberOfProcessors(), s + 2);
- SetItemText(IDC_BENCHMARK_HARDWARE_THREADS, s);
- for (int i = 0; i < sizeof(g_IDs) / sizeof(g_IDs[0]); i++)
- SetItemText(g_IDs[i], kProcessingString);
- _startTime = GetTickCount();
- PrintTime();
- NWindows::NSynchronization::CCriticalSectionLock lock(_syncInfo.CS);
- _syncInfo.Init();
- _syncInfo.DictionarySize = dictionary;
- _syncInfo.Changed = true;
- _syncInfo.NumThreads = GetNumberOfThreads();
-}
-
-void CBenchmarkDialog::OnRestartButton()
-{
- OnChangeSettings();
-}
-
-void CBenchmarkDialog::OnStopButton()
-{
- EnableItem(IDC_BUTTON_STOP, false);
- _syncInfo.Pause();
-}
-
-void CBenchmarkDialog::OnHelp()
-{
- ShowHelpWindow(NULL, kHelpTopic);
-}
-
-void CBenchmarkDialog::OnCancel()
-{
- _syncInfo.Stop();
- KillTimer(_timer);
- CModalDialog::OnCancel();
-}
-
-static void GetTimeString(UInt64 timeValue, TCHAR *s)
-{
- wsprintf(s, TEXT("%02d:%02d:%02d"),
- UInt32(timeValue / 3600),
- UInt32((timeValue / 60) % 60),
- UInt32(timeValue % 60));
-}
-
-void CBenchmarkDialog::PrintTime()
-{
- UInt32 curTime = ::GetTickCount();
- UInt32 elapsedTime = (curTime - _startTime);
- UInt32 elapsedSec = elapsedTime / 1000;
- if (elapsedSec != 0 && _syncInfo.WasPaused())
- return;
- TCHAR s[40];
- GetTimeString(elapsedSec, s);
- SetItemText(IDC_BENCHMARK_ELAPSED_VALUE, s);
-}
-
-void CBenchmarkDialog::PrintRating(UInt64 rating, UINT controlID)
-{
- TCHAR s[40];
- ConvertUInt64ToString(rating / 1000000, s);
- lstrcat(s, kMIPS);
- SetItemText(controlID, s);
-}
-
-void CBenchmarkDialog::PrintUsage(UInt64 usage, UINT controlID)
-{
- TCHAR s[40];
- ConvertUInt64ToString((usage + 5000) / 10000, s);
- lstrcat(s, TEXT("%"));
- SetItemText(controlID, s);
-}
-
-void CBenchmarkDialog::PrintResults(
- UInt32 dictionarySize,
- const CBenchInfo2 &info,
- UINT usageID, UINT speedID, UINT rpuID, UINT ratingID,
- bool decompressMode)
-{
- if (info.GlobalTime == 0)
- return;
-
- UInt64 size = info.UnpackSize;
- TCHAR s[40];
- {
- UInt64 speed = size * info.GlobalFreq / info.GlobalTime;
- ConvertUInt64ToString(speed / 1024, s);
- lstrcat(s, kKBs);
- SetItemText(speedID, s);
- }
- UInt64 rating;
- if (decompressMode)
- rating = GetDecompressRating(info.GlobalTime, info.GlobalFreq, size, info.PackSize, 1);
- else
- rating = GetCompressRating(dictionarySize, info.GlobalTime, info.GlobalFreq, size * info.NumIterations);
-
- PrintRating(rating, ratingID);
- PrintRating(GetRatingPerUsage(info, rating), rpuID);
- PrintUsage(GetUsage(info), usageID);
-}
-
-bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
-{
- PrintTime();
- NWindows::NSynchronization::CCriticalSectionLock lock(_syncInfo.CS);
-
- TCHAR s[40];
- ConvertUInt64ToString((_syncInfo.ProcessedSize >> 20), s);
- lstrcat(s, kMB);
- SetItemText(IDC_BENCHMARK_SIZE_VALUE, s);
-
- ConvertUInt64ToString(_syncInfo.NumPasses, s);
- SetItemText(IDC_BENCHMARK_PASSES_VALUE, s);
-
- /*
- ConvertUInt64ToString(_syncInfo.NumErrors, s);
- SetItemText(IDC_BENCHMARK_ERRORS_VALUE, s);
- */
-
- {
- UInt32 dicSizeTemp = (UInt32)MyMax(_syncInfo.ProcessedSize, UInt64(1) << 20);
- dicSizeTemp = MyMin(dicSizeTemp, _syncInfo.DictionarySize),
- PrintResults(dicSizeTemp,
- _syncInfo.CompressingInfoTemp,
- IDC_BENCHMARK_COMPRESSING_USAGE,
- IDC_BENCHMARK_COMPRESSING_SPEED,
- IDC_BENCHMARK_COMPRESSING_RPU,
- IDC_BENCHMARK_COMPRESSING_RATING);
- }
-
- {
- PrintResults(
- _syncInfo.DictionarySize,
- _syncInfo.CompressingInfo,
- IDC_BENCHMARK_COMPRESSING_USAGE2,
- IDC_BENCHMARK_COMPRESSING_SPEED2,
- IDC_BENCHMARK_COMPRESSING_RPU2,
- IDC_BENCHMARK_COMPRESSING_RATING2);
- }
-
- {
- PrintResults(
- _syncInfo.DictionarySize,
- _syncInfo.DecompressingInfoTemp,
- IDC_BENCHMARK_DECOMPRESSING_USAGE,
- IDC_BENCHMARK_DECOMPRESSING_SPEED,
- IDC_BENCHMARK_DECOMPRESSING_RPU,
- IDC_BENCHMARK_DECOMPRESSING_RATING,
- true);
- }
- {
- PrintResults(
- _syncInfo.DictionarySize,
- _syncInfo.DecompressingInfo,
- IDC_BENCHMARK_DECOMPRESSING_USAGE2,
- IDC_BENCHMARK_DECOMPRESSING_SPEED2,
- IDC_BENCHMARK_DECOMPRESSING_RPU2,
- IDC_BENCHMARK_DECOMPRESSING_RATING2,
- true);
- if (_syncInfo.DecompressingInfo.GlobalTime > 0 &&
- _syncInfo.CompressingInfo.GlobalTime > 0)
- {
- UInt64 comprRating = GetCompressRating(_syncInfo.DictionarySize,
- _syncInfo.CompressingInfo.GlobalTime, _syncInfo.CompressingInfo.GlobalFreq, _syncInfo.CompressingInfo.UnpackSize);
- UInt64 decomprRating = GetDecompressRating(_syncInfo.DecompressingInfo.GlobalTime,
- _syncInfo.DecompressingInfo.GlobalFreq, _syncInfo.DecompressingInfo.UnpackSize,
- _syncInfo.DecompressingInfo.PackSize, 1);
- PrintRating((comprRating + decomprRating) / 2, IDC_BENCHMARK_TOTAL_RATING_VALUE);
- PrintRating((
- GetRatingPerUsage(_syncInfo.CompressingInfo, comprRating) +
- GetRatingPerUsage(_syncInfo.DecompressingInfo, decomprRating)) / 2, IDC_BENCHMARK_TOTAL_RPU_VALUE);
- PrintUsage((GetUsage(_syncInfo.CompressingInfo) + GetUsage(_syncInfo.DecompressingInfo)) / 2, IDC_BENCHMARK_TOTAL_USAGE_VALUE);
- }
- }
- return true;
-}
-
-bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam)
-{
- if (code == CBN_SELCHANGE &&
- (itemID == IDC_BENCHMARK_COMBO_DICTIONARY ||
- itemID == IDC_BENCHMARK_COMBO_NUM_THREADS))
- {
- OnChangeSettings();
- return true;
- }
- return CModalDialog::OnCommand(code, itemID, lParam);
-}
-
-bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
- switch(buttonID)
- {
- case IDC_BUTTON_RESTART:
- OnRestartButton();
- return true;
- case IDC_BUTTON_STOP:
- OnStopButton();
- return true;
- }
- return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
-}
-
-struct CThreadBenchmark
-{
- CProgressSyncInfo *SyncInfo;
- UInt64 _startTime;
- #ifdef EXTERNAL_LZMA
- CCodecs *codecs;
- #endif
- // UInt32 dictionarySize;
- // UInt32 numThreads;
-
- HRESULT Process();
- HRESULT Result;
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- ((CThreadBenchmark *)param)->Result = ((CThreadBenchmark *)param)->Process();
- return 0;
- }
-};
-
-struct CBenchCallback: public IBenchCallback
-{
- UInt32 dictionarySize;
- CProgressSyncInfo *SyncInfo;
- HRESULT SetEncodeResult(const CBenchInfo &info, bool final);
- HRESULT SetDecodeResult(const CBenchInfo &info, bool final);
-};
-
-HRESULT CBenchCallback::SetEncodeResult(const CBenchInfo &info, bool final)
-{
- NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
- if (SyncInfo->Changed || SyncInfo->Paused || SyncInfo->Stopped)
- return E_ABORT;
- SyncInfo->ProcessedSize = info.UnpackSize;
- if (final && SyncInfo->CompressingInfo.GlobalTime == 0)
- {
- (CBenchInfo&)SyncInfo->CompressingInfo = info;
- if (SyncInfo->CompressingInfo.GlobalTime == 0)
- SyncInfo->CompressingInfo.GlobalTime = 1;
- }
- else
- (CBenchInfo&)SyncInfo->CompressingInfoTemp = info;
-
- return S_OK;
-}
-
-HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
-{
- NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
- if (SyncInfo->Changed || SyncInfo->Paused || SyncInfo->Stopped)
- return E_ABORT;
- CBenchInfo info2 = info;
- if (info2.NumIterations == 0)
- info2.NumIterations = 1;
-
- info2.UnpackSize *= info2.NumIterations;
- info2.PackSize *= info2.NumIterations;
- info2.NumIterations = 1;
-
- if (final && SyncInfo->DecompressingInfo.GlobalTime == 0)
- {
- (CBenchInfo&)SyncInfo->DecompressingInfo = info2;
- if (SyncInfo->DecompressingInfo.GlobalTime == 0)
- SyncInfo->DecompressingInfo.GlobalTime = 1;
- }
- else
- (CBenchInfo&)SyncInfo->DecompressingInfoTemp = info2;
- return S_OK;
-}
-
-HRESULT CThreadBenchmark::Process()
-{
- try
- {
- SyncInfo->WaitCreating();
- for (;;)
- {
- if (SyncInfo->WasStopped())
- return 0;
- if (SyncInfo->WasPaused())
- {
- Sleep(200);
- continue;
- }
- UInt32 dictionarySize;
- UInt32 numThreads;
- {
- NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
- if (SyncInfo->Stopped || SyncInfo->Paused)
- continue;
- if (SyncInfo->Changed)
- SyncInfo->Init();
- dictionarySize = SyncInfo->DictionarySize;
- numThreads = SyncInfo->NumThreads;
- }
-
- CBenchCallback callback;
- callback.dictionarySize = dictionarySize;
- callback.SyncInfo = SyncInfo;
- HRESULT result;
- try
- {
- result = LzmaBench(
- #ifdef EXTERNAL_LZMA
- codecs,
- #endif
- numThreads, dictionarySize, &callback);
- }
- catch(...)
- {
- result = E_FAIL;
- }
-
- if (result != S_OK)
- {
- if (result != E_ABORT)
- {
- // SyncInfo->NumErrors++;
- {
- NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
- SyncInfo->Pause();
- }
- CSysString message;
- if (result == S_FALSE)
- message = TEXT("Decoding error");
- else
- message = NError::MyFormatMessage(result);
- MessageBox(0, message, TEXT("7-Zip"), MB_ICONERROR);
- }
- }
- else
- {
- NSynchronization::CCriticalSectionLock lock(SyncInfo->CS);
- SyncInfo->NumPasses++;
- }
- }
- // return S_OK;
- }
- catch(CSystemException &e)
- {
- MessageBox(0, NError::MyFormatMessage(e.ErrorCode), TEXT("7-Zip"), MB_ICONERROR);
- return E_FAIL;
- }
- catch(...)
- {
- MyMessageBoxError(0, L"Some error");
- return E_FAIL;
- }
-}
-
-HRESULT Benchmark(
- #ifdef EXTERNAL_LZMA
- CCodecs *codecs,
- #endif
- UInt32 numThreads, UInt32 dictionarySize)
-{
- CThreadBenchmark benchmarker;
- #ifdef EXTERNAL_LZMA
- benchmarker.codecs = codecs;
- #endif
-
- CBenchmarkDialog benchmarkDialog;
- benchmarkDialog._syncInfo.DictionarySize = dictionarySize;
- benchmarkDialog._syncInfo.NumThreads = numThreads;
-
- benchmarker.SyncInfo = &benchmarkDialog._syncInfo;
- NWindows::CThread thread;
- RINOK(thread.Create(CThreadBenchmark::MyThreadFunction, &benchmarker));
- benchmarkDialog.Create(0);
- return thread.Wait();
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialog.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialog.h
deleted file mode 100644
index a57cdb399..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialog.h
+++ /dev/null
@@ -1,131 +0,0 @@
-// BenchmarkDialog.h
-
-#ifndef __BENCHMARKDIALOG_H
-#define __BENCHMARKDIALOG_H
-
-#include "BenchmarkDialogRes.h"
-
-#include "Windows/Control/Dialog.h"
-#include "Windows/Control/ComboBox.h"
-#include "Windows/Synchronization.h"
-#include "../../Compress/LZMA_Alone/LzmaBench.h"
-
-#ifdef EXTERNAL_LZMA
-#include "../Common/LoadCodecs.h"
-#endif
-
-struct CBenchInfo2 : public CBenchInfo
-{
- void Init() { GlobalTime = UserTime = 0; }
-};
-
-class CProgressSyncInfo
-{
-public:
- bool Stopped;
- bool Paused;
- bool Changed;
- UInt32 DictionarySize;
- UInt32 NumThreads;
- UInt64 NumPasses;
- // UInt64 NumErrors;
- NWindows::NSynchronization::CManualResetEvent _startEvent;
- NWindows::NSynchronization::CCriticalSection CS;
-
- CBenchInfo2 CompressingInfoTemp;
- CBenchInfo2 CompressingInfo;
- UInt64 ProcessedSize;
-
- CBenchInfo2 DecompressingInfoTemp;
- CBenchInfo2 DecompressingInfo;
-
- CProgressSyncInfo()
- {
- if (_startEvent.Create() != S_OK)
- throw 3986437;
- }
- void Init()
- {
- Changed = false;
- Stopped = false;
- Paused = false;
- CompressingInfoTemp.Init();
- CompressingInfo.Init();
- ProcessedSize = 0;
-
- DecompressingInfoTemp.Init();
- DecompressingInfo.Init();
-
- NumPasses = 0;
- // NumErrors = 0;
- }
- void Stop()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(CS);
- Stopped = true;
- }
- bool WasStopped()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(CS);
- return Stopped;
- }
- void Pause()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(CS);
- Paused = true;
- }
- void Start()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(CS);
- Paused = false;
- }
- bool WasPaused()
- {
- NWindows::NSynchronization::CCriticalSectionLock lock(CS);
- return Paused;
- }
- void WaitCreating() { _startEvent.Lock(); }
-};
-
-class CBenchmarkDialog:
- public NWindows::NControl::CModalDialog
-{
- NWindows::NControl::CComboBox m_Dictionary;
- NWindows::NControl::CComboBox m_NumThreads;
- UINT_PTR _timer;
- UINT32 _startTime;
-
- bool OnTimer(WPARAM timerID, LPARAM callback);
- virtual bool OnInit();
- void OnRestartButton();
- void OnStopButton();
- void OnHelp();
- virtual void OnCancel();
- bool OnButtonClicked(int buttonID, HWND buttonHWND);
- bool OnCommand(int code, int itemID, LPARAM lParam);
-
- void PrintTime();
- void PrintRating(UInt64 rating, UINT controlID);
- void PrintUsage(UInt64 usage, UINT controlID);
- void PrintResults(
- UINT32 dictionarySize,
- const CBenchInfo2 &info, UINT usageID, UINT speedID, UINT rpuID, UINT ratingID,
- bool decompressMode = false);
-
- UInt32 GetNumberOfThreads();
- UInt32 OnChangeDictionary();
- void OnChangeSettings();
-public:
- CProgressSyncInfo _syncInfo;
-
- CBenchmarkDialog(): _timer(0) {}
- INT_PTR Create(HWND wndParent = 0) { return CModalDialog::Create(IDD_DIALOG_BENCHMARK, wndParent); }
-};
-
-HRESULT Benchmark(
- #ifdef EXTERNAL_LZMA
- CCodecs *codecs,
- #endif
- UInt32 dictionarySize, UInt32 numThreads);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialogRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialogRes.h
deleted file mode 100644
index 6ef521881..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialogRes.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#define IDD_DIALOG_BENCHMARK 800
-#define IDC_BUTTON_STOP 1001
-#define IDC_BUTTON_RESTART 1002
-#define IDC_BENCHMARK_DICTIONARY 1010
-#define IDC_BENCHMARK_COMBO_DICTIONARY 1011
-#define IDC_BENCHMARK_MEMORY 1012
-#define IDC_BENCHMARK_MEMORY_VALUE 1013
-#define IDC_BENCHMARK_NUM_THREADS 1014
-#define IDC_BENCHMARK_COMBO_NUM_THREADS 1015
-#define IDC_BENCHMARK_HARDWARE_THREADS 1016
-
-#define IDC_BENCHMARK_SPEED_LABEL 1020
-#define IDC_BENCHMARK_RATING_LABEL 1021
-#define IDC_BENCHMARK_COMPRESSING 1022
-#define IDC_BENCHMARK_DECOMPRESSING 1023
-#define IDC_BENCHMARK_CURRENT 1024
-#define IDC_BENCHMARK_RESULTING 1025
-#define IDC_BENCHMARK_CURRENT2 1026
-#define IDC_BENCHMARK_RESULTING2 1027
-#define IDC_BENCHMARK_USAGE_LABEL 1028
-#define IDC_BENCHMARK_RPU_LABEL 1029
-
-#define IDC_BENCHMARK_COMPRESSING_SPEED 1030
-#define IDC_BENCHMARK_COMPRESSING_SPEED2 1031
-#define IDC_BENCHMARK_COMPRESSING_RATING 1032
-#define IDC_BENCHMARK_COMPRESSING_RATING2 1033
-#define IDC_BENCHMARK_COMPRESSING_USAGE 1034
-#define IDC_BENCHMARK_COMPRESSING_USAGE2 1035
-#define IDC_BENCHMARK_COMPRESSING_RPU 1036
-#define IDC_BENCHMARK_COMPRESSING_RPU2 1037
-
-
-#define IDC_BENCHMARK_DECOMPRESSING_SPEED 1040
-#define IDC_BENCHMARK_DECOMPRESSING_SPEED2 1041
-#define IDC_BENCHMARK_DECOMPRESSING_RATING 1042
-#define IDC_BENCHMARK_DECOMPRESSING_RATING2 1043
-#define IDC_BENCHMARK_DECOMPRESSING_USAGE 1044
-#define IDC_BENCHMARK_DECOMPRESSING_USAGE2 1045
-#define IDC_BENCHMARK_DECOMPRESSING_RPU 1046
-#define IDC_BENCHMARK_DECOMPRESSING_RPU2 1047
-
-
-#define IDC_BENCHMARK_TOTAL_RATING 1050
-
-#define IDC_BENCHMARK_TOTAL_RATING_VALUE 1051
-#define IDC_BENCHMARK_TOTAL_RPU_VALUE 1052
-#define IDC_BENCHMARK_TOTAL_USAGE_VALUE 1053
-
-#define IDC_BENCHMARK_ELAPSED 1060
-#define IDC_BENCHMARK_ELAPSED_VALUE 1061
-#define IDC_BENCHMARK_SIZE 1062
-#define IDC_BENCHMARK_SIZE_VALUE 1063
-#define IDC_BENCHMARK_PASSES 1066
-#define IDC_BENCHMARK_PASSES_VALUE 1067
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialog_rc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialog_rc.cpp
deleted file mode 100644
index ae6b26f2c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/BenchmarkDialog_rc.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-// BenchmarkDialog.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#include "Windows/Control/DialogImpl.h"
-#include "BenchmarkDialogRes.h"
-
-#if 0
-
-
-IDD_DIALOG_BENCHMARK DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
-CAPTION "Benchmark"
-MY_FONT
-BEGIN
-OK PUSHBUTTON "&Restart", IDC_BUTTON_RESTART, bXPos1, marg, bXSize, bYSize
-OK PUSHBUTTON "&Stop", IDC_BUTTON_STOP, bXPos1, 27, bXSize, bYSize
-
- PUSHBUTTON "&Help", IDHELP, bXPos2, bYPos, bXSize,bYSize
- PUSHBUTTON "Cancel", IDCANCEL, bXPos1, bYPos, bXSize, bYSize
-
-OK LTEXT "&Dictionary size:", IDC_BENCHMARK_DICTIONARY, marg, marg + 1, g0XSize, 8
-OK COMBOBOX IDC_BENCHMARK_COMBO_DICTIONARY, g1XPos, marg, g1XSize, 140, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
-
- LTEXT "&Number of CPU threads:", IDC_BENCHMARK_NUM_THREADS, marg, 24, g0XSize, 8
- COMBOBOX IDC_BENCHMARK_COMBO_NUM_THREADS, g1XPos, 23, g1XSize, 140, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
-
- LTEXT "Memory usage:", IDC_BENCHMARK_MEMORY, gc2XPos, marg + 1, gc2XSize, 8
- LTEXT "0 MB", IDC_BENCHMARK_MEMORY_VALUE, gc2XPos + gc2XSize, marg + 1, 40, 8
- LTEXT "1", IDC_BENCHMARK_HARDWARE_THREADS, gc2XPos, 24, 40, 8
-
- RTEXT "CPU Usage", IDC_BENCHMARK_USAGE_LABEL, gUsagePos, 53, gUsageSize, 8
- RTEXT "Speed", IDC_BENCHMARK_SPEED_LABEL, gSpeedPos, 53, gSpeedSize, 8
- RTEXT "Rating / Usage", IDC_BENCHMARK_RPU_LABEL, gRpuPos, 53, gRpuSize, 8
- RTEXT "Rating", IDC_BENCHMARK_RATING_LABEL, gRatingPos, 53, gRatingSize, 8
-
- GROUPBOX "Compressing", IDC_BENCHMARK_COMPRESSING, marg, 64, xSize2, 40
-
- LTEXT "Current", IDC_BENCHMARK_CURRENT, g10XPos, 76, gLabelSize, 8
- RTEXT "100%", IDC_BENCHMARK_COMPRESSING_USAGE, gUsagePos, 76, gUsageSize, 8
- RTEXT "100 KB/s", IDC_BENCHMARK_COMPRESSING_SPEED, gSpeedPos, 76, gSpeedSize, 8
- RTEXT "0", IDC_BENCHMARK_COMPRESSING_RPU, gRpuPos, 76, gRpuSize, 8
- RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING, gRatingPos, 76, gRatingSize, 8
-
- LTEXT "Resulting", IDC_BENCHMARK_RESULTING, g10XPos, 89, gLabelSize, 8
- RTEXT "100%", IDC_BENCHMARK_COMPRESSING_USAGE2, gUsagePos, 89, gUsageSize, 8
- RTEXT "100 KB/s", IDC_BENCHMARK_COMPRESSING_SPEED2, gSpeedPos, 89, gSpeedSize, 8
- RTEXT "0", IDC_BENCHMARK_COMPRESSING_RPU2, gRpuPos, 89, gRpuSize, 8
- RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING2, gRatingPos, 89, gRatingSize, 8
-
- GROUPBOX "Decompressing", IDC_BENCHMARK_DECOMPRESSING, marg, 111, xSize2, 40
-
- LTEXT "Current", IDC_BENCHMARK_CURRENT2, g10XPos, 123, gLabelSize, 8
- RTEXT "100%", IDC_BENCHMARK_DECOMPRESSING_USAGE, gUsagePos, 123, gUsageSize, 8
- RTEXT "100 KB/s", IDC_BENCHMARK_DECOMPRESSING_SPEED, gSpeedPos, 123, gSpeedSize, 8
- RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RPU, gRpuPos, 123, gRpuSize, 8
- RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING, gRatingPos, 123, gRatingSize, 8
-
- LTEXT "Resulting", IDC_BENCHMARK_RESULTING2, g10XPos, 136, gLabelSize, 8
- RTEXT "100%", IDC_BENCHMARK_DECOMPRESSING_USAGE2, gUsagePos, 136, gUsageSize, 8
- RTEXT "100 KB/s", IDC_BENCHMARK_DECOMPRESSING_SPEED2, gSpeedPos, 136, gSpeedSize, 8
- RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RPU2, gRpuPos, 136, gRpuSize, 8
- RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING2, gRatingPos, 136, gRatingSize, 8
-
- GROUPBOX "Total Rating", IDC_BENCHMARK_TOTAL_RATING, gTotalRatingPos, 163, gTotalRatingSize, 38
- RTEXT "0", IDC_BENCHMARK_TOTAL_USAGE_VALUE, gUsagePos, 181, gUsageSize, 8
- RTEXT "0", IDC_BENCHMARK_TOTAL_RPU_VALUE, gRpuPos, 181, gRpuSize, 8
- RTEXT "0", IDC_BENCHMARK_TOTAL_RATING_VALUE, gRatingPos, 181, gRatingSize, 8
-
- LTEXT "Elapsed time:", IDC_BENCHMARK_ELAPSED, marg, 163, g2XSize, 8
- LTEXT "Size:", IDC_BENCHMARK_SIZE, marg, 176, g2XSize, 8
- LTEXT "Passes:", IDC_BENCHMARK_PASSES, marg, 189, g2XSize, 8
- RTEXT "00:00:00", IDC_BENCHMARK_ELAPSED_VALUE, g3XPos, 163, g3XSize, 8
- RTEXT "0", IDC_BENCHMARK_SIZE_VALUE, g3XPos, 176, g3XSize, 8
- RTEXT "0", IDC_BENCHMARK_PASSES_VALUE, g3XPos, 189, g3XSize, 8
-END
-#endif // #if 0
-
-class CBenchmarkDialogImpl : public NWindows::NControl::CModalDialogImpl
-{
- public:
- CBenchmarkDialogImpl(NWindows::NControl::CModalDialog *dialog,wxWindow * parent , int id) : CModalDialogImpl(dialog,parent, id, wxT("Benchmark"))
- {
-
- wxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
-
- wxSizer *sizerLine1 = new wxBoxSizer(wxHORIZONTAL);
-
- wxSizer *sizeLine1Btn = new wxBoxSizer(wxVERTICAL);
- sizeLine1Btn->Add(new wxButton(this, IDC_BUTTON_RESTART, _T("&Restart")) , 0, wxALL|wxEXPAND, 5 );
- sizeLine1Btn->Add(new wxButton(this, IDC_BUTTON_STOP, _T("&Stop")) , 0, wxALL|wxEXPAND, 5 );
-
- wxSizer *sizeLine1Combo = new wxBoxSizer(wxVERTICAL);
-
- wxComboBox * chcDicoSize = new wxComboBox(this, IDC_BENCHMARK_COMBO_DICTIONARY,
- wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
-
- wxComboBox * chcThread = new wxComboBox(this, IDC_BENCHMARK_COMBO_NUM_THREADS,
- wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
-
- sizeLine1Combo->Add(chcDicoSize , 0, wxALL, 5 );
- sizeLine1Combo->Add(chcThread , 0, wxALL, 5 );
-
- wxSizer *sizeLine1ComboLabel = new wxBoxSizer(wxVERTICAL);
- sizeLine1ComboLabel->Add(new wxStaticText(this, IDC_BENCHMARK_DICTIONARY, _T("&Dictionary size:")) , 1, wxALL|wxEXPAND, 5 );
- sizeLine1ComboLabel->Add(new wxStaticText(this, IDC_BENCHMARK_NUM_THREADS, _T("&Number of CPU threads:")) , 1, wxALL|wxEXPAND, 5 );
-
- wxSizer *sizeLine1Col3 = new wxBoxSizer(wxVERTICAL);
- sizeLine1Col3->Add(new wxStaticText(this, IDC_BENCHMARK_MEMORY, _T("Memory usage:")) , 1, wxALL|wxEXPAND, 5 );
- sizeLine1Col3->Add(new wxStaticText(this, IDC_BENCHMARK_HARDWARE_THREADS, _T("1")) , 1, wxALL|wxEXPAND, 5 );
-
- wxSizer *sizeLine1Col4 = new wxBoxSizer(wxVERTICAL);
- sizeLine1Col4->Add(new wxStaticText(this, IDC_BENCHMARK_MEMORY_VALUE, _T("0 MB")) , 0, wxALL|wxEXPAND, 5 );
-
- sizerLine1->Add(sizeLine1ComboLabel,0, wxALL|wxEXPAND, 5);
- sizerLine1->Add(sizeLine1Combo,0, wxALL|wxEXPAND, 5);
- sizerLine1->Add(sizeLine1Col3,0, wxALL|wxEXPAND, 5);
- sizerLine1->Add(sizeLine1Col4,0, wxALL|wxEXPAND, 5);
- sizerLine1->Add(sizeLine1Btn,0, wxALL|wxEXPAND, 5);
-
- // LABEL (copy the structure of the compressing or decompressing group
-
- wxStaticBoxSizer * sizerLine2 = new wxStaticBoxSizer(new wxStaticBox(this,wxID_ANY,_T("")),wxVERTICAL);
- wxSizer *sizerLabel = new wxBoxSizer(wxHORIZONTAL);
- sizerLabel->Add(new wxStaticText(this, wxID_ANY, _T(" ")) , 1, wxALL|wxEXPAND, 5 );
- sizerLabel->Add(new wxStaticText(this, IDC_BENCHMARK_SPEED_LABEL, _T("Speed")) , 1, wxALL|wxEXPAND, 5 );
- sizerLabel->Add(new wxStaticText(this, IDC_BENCHMARK_USAGE_LABEL, _T("CPU Usage")) , 1, wxALL|wxEXPAND, 5 );
- sizerLabel->Add(new wxStaticText(this, IDC_BENCHMARK_RPU_LABEL, _T("Rating / Usage")), 1, wxALL|wxEXPAND, 5 );
- sizerLabel->Add(new wxStaticText(this, IDC_BENCHMARK_RATING_LABEL, _T("Rating")) , 1, wxALL|wxEXPAND, 5 );
-
- sizerLine2->Add(sizerLabel, 0, wxALL|wxEXPAND, 5);
-
- // GROUP COMPRESSING
-
- wxStaticBoxSizer * grpCompress = new wxStaticBoxSizer(new wxStaticBox(this,IDC_BENCHMARK_COMPRESSING,_T("Compressing")),wxVERTICAL);
- wxSizer *grpCompress1 = new wxBoxSizer(wxHORIZONTAL);
- grpCompress1->Add(new wxStaticText(this, IDC_BENCHMARK_CURRENT, _T("Current")) , 1, wxALL|wxEXPAND, 5 );
- grpCompress1->Add(new wxStaticText(this, IDC_BENCHMARK_COMPRESSING_SPEED, _T("100 KB/s")) , 1, wxALL|wxEXPAND, 5 );
- grpCompress1->Add(new wxStaticText(this, IDC_BENCHMARK_COMPRESSING_USAGE, _T("100%")) , 1, wxALL|wxEXPAND, 5 );
- grpCompress1->Add(new wxStaticText(this, IDC_BENCHMARK_COMPRESSING_RPU, _T("0")), 1, wxALL|wxEXPAND, 5 );
- grpCompress1->Add(new wxStaticText(this, IDC_BENCHMARK_COMPRESSING_RATING, _T("0")) , 1, wxALL|wxEXPAND, 5 );
-
- wxSizer *grpCompress2 = new wxBoxSizer(wxHORIZONTAL);
- grpCompress2->Add(new wxStaticText(this, IDC_BENCHMARK_RESULTING, _T("Resulting")) , 1, wxALL|wxEXPAND, 5 );
- grpCompress2->Add(new wxStaticText(this, IDC_BENCHMARK_COMPRESSING_SPEED2, _T("100 KB/s")) , 1, wxALL|wxEXPAND, 5 );
- grpCompress2->Add(new wxStaticText(this, IDC_BENCHMARK_COMPRESSING_USAGE2, _T("100%")) , 1, wxALL|wxEXPAND, 5 );
- grpCompress2->Add(new wxStaticText(this, IDC_BENCHMARK_COMPRESSING_RPU2, _T("0")) , 1, wxALL|wxEXPAND, 5);
- grpCompress2->Add(new wxStaticText(this, IDC_BENCHMARK_COMPRESSING_RATING2, _T("0")) , 1, wxALL|wxEXPAND, 5 );
-
- grpCompress->Add(grpCompress1, 0, wxALL|wxEXPAND, 5);
- grpCompress->Add(grpCompress2, 0, wxALL|wxEXPAND, 5);
-
- // GROUP DECOMPRESSING
-
- wxStaticBoxSizer * grpDecompress = new wxStaticBoxSizer(new wxStaticBox(this,IDC_BENCHMARK_DECOMPRESSING,_T("Decompressing")),wxVERTICAL);
- wxSizer *grpDecompress1 = new wxBoxSizer(wxHORIZONTAL);
- grpDecompress1->Add(new wxStaticText(this, IDC_BENCHMARK_CURRENT2, _T("Current")) , 1, wxALL|wxEXPAND, 5 );
- grpDecompress1->Add(new wxStaticText(this, IDC_BENCHMARK_DECOMPRESSING_SPEED, _T("100 KB/s")) , 1, wxALL|wxEXPAND, 5 );
- grpDecompress1->Add(new wxStaticText(this, IDC_BENCHMARK_DECOMPRESSING_USAGE, _T("100%")) , 1, wxALL|wxEXPAND, 5 );
- grpDecompress1->Add(new wxStaticText(this, IDC_BENCHMARK_DECOMPRESSING_RPU, _T("0")), 1, wxALL|wxEXPAND, 5 );
- grpDecompress1->Add(new wxStaticText(this, IDC_BENCHMARK_DECOMPRESSING_RATING, _T("0")) , 1, wxALL|wxEXPAND, 5 );
-
- wxSizer *grpDecompress2 = new wxBoxSizer(wxHORIZONTAL);
- grpDecompress2->Add(new wxStaticText(this, IDC_BENCHMARK_RESULTING2, _T("Resulting")) , 1, wxALL|wxEXPAND, 5 );
- grpDecompress2->Add(new wxStaticText(this, IDC_BENCHMARK_DECOMPRESSING_SPEED2, _T("100 KB/s")) , 1, wxALL|wxEXPAND, 5 );
- grpDecompress2->Add(new wxStaticText(this, IDC_BENCHMARK_DECOMPRESSING_USAGE2, _T("100%")) , 1, wxALL|wxEXPAND, 5 );
- grpDecompress2->Add(new wxStaticText(this, IDC_BENCHMARK_DECOMPRESSING_RPU2, _T("0")) , 1, wxALL|wxEXPAND, 5);
- grpDecompress2->Add(new wxStaticText(this, IDC_BENCHMARK_DECOMPRESSING_RATING2, _T("0")) , 1, wxALL|wxEXPAND, 5 );
-
- grpDecompress->Add(grpDecompress1, 0, wxALL|wxEXPAND, 5);
- grpDecompress->Add(grpDecompress2, 0, wxALL|wxEXPAND, 5);
-
- // GROUPE TOTAL RATING
- wxStaticBoxSizer * grpTotalRating = new wxStaticBoxSizer(new wxStaticBox(this,IDC_BENCHMARK_TOTAL_RATING,_T("Total Rating")),wxHORIZONTAL);
- grpTotalRating->Add(new wxStaticText(this, wxID_ANY, _T("")) , 1, wxALL|wxEXPAND, 5 );
- grpTotalRating->Add(new wxStaticText(this, IDC_BENCHMARK_TOTAL_USAGE_VALUE, _T("0")) , 1, wxALL|wxEXPAND, 5 );
- grpTotalRating->Add(new wxStaticText(this, IDC_BENCHMARK_TOTAL_RPU_VALUE, _T("0")) , 1, wxALL|wxEXPAND, 5 );
- grpTotalRating->Add(new wxStaticText(this, IDC_BENCHMARK_TOTAL_RATING_VALUE, _T("0")) , 1, wxALL|wxEXPAND, 5 );
-
- // GROUPE ELAPSED TIME
- wxSizer * grpElapsedTime = new wxBoxSizer(wxHORIZONTAL);
-
- wxSizer * grpElapsedTime1 = new wxBoxSizer(wxVERTICAL);
- grpElapsedTime1->Add(new wxStaticText(this, IDC_BENCHMARK_ELAPSED, _T("Elapsed time:")) , 0, wxALL|wxEXPAND, 5 );
- grpElapsedTime1->Add(new wxStaticText(this, IDC_BENCHMARK_SIZE, _T("Size:")) , 0, wxALL|wxEXPAND, 5 );
- grpElapsedTime1->Add(new wxStaticText(this, IDC_BENCHMARK_PASSES, _T("Passes:")) , 0, wxALL|wxEXPAND, 5 );
-
- wxSizer * grpElapsedTime2 = new wxBoxSizer(wxVERTICAL);
- grpElapsedTime2->Add(new wxStaticText(this, IDC_BENCHMARK_ELAPSED_VALUE, _T("00:00:00")) , 0, wxALL|wxEXPAND, 5 );
- grpElapsedTime2->Add(new wxStaticText(this, IDC_BENCHMARK_SIZE_VALUE, _T("0")) , 0, wxALL|wxEXPAND, 5 );
- grpElapsedTime2->Add(new wxStaticText(this, IDC_BENCHMARK_PASSES_VALUE, _T("0")) , 0, wxALL|wxEXPAND, 5 );
-
- grpElapsedTime->Add(grpElapsedTime1,0, wxALL|wxEXPAND, 5);
- grpElapsedTime->Add(grpElapsedTime2,0, wxALL|wxEXPAND, 5);
-
- wxSizer * grp_ElapsedTime_TotalRating = new wxBoxSizer(wxHORIZONTAL);
- grp_ElapsedTime_TotalRating->Add(grpElapsedTime, 0, wxALL|wxEXPAND, 5);
- grp_ElapsedTime_TotalRating->Add(grpTotalRating, 1, wxALL|wxEXPAND, 5);
-
- // TOP
- topsizer->Add(sizerLine1,0, wxALL|wxEXPAND, 5);
- topsizer->Add(sizerLine2,0, wxALL|wxEXPAND, 5);
- topsizer->Add(grpCompress, 0, wxALL|wxEXPAND, 5);
- topsizer->Add(grpDecompress, 0, wxALL|wxEXPAND, 5);
- topsizer->Add(grp_ElapsedTime_TotalRating, 0, wxALL|wxEXPAND, 5);
-
- topsizer->Add(CreateButtonSizer(wxHELP|wxCANCEL), 0, wxALL|wxEXPAND, 5);
-
- this->OnInit();
-
- SetSizer(topsizer); // use the sizer for layout
- topsizer->SetSizeHints(this); // set size hints to honour minimum size
- }
-private:
- // Any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-REGISTER_DIALOG(IDD_DIALOG_BENCHMARK,CBenchmarkDialog,0)
-
-// ----------------------------------------------------------------------------
-// event tables and other macros for wxWidgets
-// ----------------------------------------------------------------------------
-
-// the event tables connect the wxWidgets events with the functions (event
-// handlers) which process them. It can be also done at run-time, but for the
-// simple menu events like this the static method is much simpler.
-BEGIN_EVENT_TABLE(CBenchmarkDialogImpl, wxDialog)
- EVT_TIMER(wxID_ANY, CModalDialogImpl::OnAnyTimer)
- EVT_BUTTON(wxID_ANY, CModalDialogImpl::OnAnyButton)
- EVT_COMBOBOX(wxID_ANY, CModalDialogImpl::OnAnyChoice)
-END_EVENT_TABLE()
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialog.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialog.cpp
deleted file mode 100644
index 04a40a437..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialog.cpp
+++ /dev/null
@@ -1,1455 +0,0 @@
-// CompressDialog.cpp
-
-#include "StdAfx.h"
-
-#include "Common/Defs.h"
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/CommonDialog.h"
-#include "Windows/FileDir.h"
-#include "Windows/FileName.h"
-#include "Windows/ResourceString.h"
-#include "Windows/System.h"
-
-#include "../FileManager/FormatUtils.h"
-#include "../FileManager/HelpUtils.h"
-#include "../FileManager/SplitUtils.h"
-
-#include "../Explorer/MyMessages.h"
-
-#include "../Common/ZipRegistry.h"
-
-#include "CompressDialog.h"
-
-#include "resource.h"
-
-#ifndef _UNICODE
-extern bool g_IsNT;
-#endif
-
-#ifdef LANG
-#include "../FileManager/LangUtils.h"
-#endif
-
-#include "CompressDialogRes.h"
-
-#define MY_SIZE_OF_ARRAY(x) (sizeof(x) / sizeof(x[0]))
-
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDC_STATIC_COMPRESS_ARCHIVE, 0x02000D01 },
- { IDC_STATIC_COMPRESS_FORMAT, 0x02000D03 },
- { IDC_STATIC_COMPRESS_LEVEL, 0x02000D0B },
- { IDC_STATIC_COMPRESS_METHOD, 0x02000D04 },
- { IDC_STATIC_COMPRESS_DICTIONARY, 0x02000D0C },
- { IDC_STATIC_COMPRESS_ORDER, 0x02000D0D },
- { IDC_STATIC_COMPRESS_MEMORY, 0x02000D0E },
- { IDC_STATIC_COMPRESS_MEMORY_DE, 0x02000D0F },
- { IDC_STATIC_COMPRESS_THREADS, 0x02000D12 },
- { IDC_STATIC_COMPRESS_SOLID, 0x02000D13 },
- { IDC_STATIC_COMPRESS_VOLUME, 0x02000D40 },
- { IDC_STATIC_COMPRESS_PARAMETERS, 0x02000D06 },
-
- { IDC_STATIC_COMPRESS_UPDATE_MODE, 0x02000D02 },
- { IDC_STATIC_COMPRESS_OPTIONS, 0x02000D07 },
- { IDC_COMPRESS_SFX, 0x02000D08 },
- { IDC_COMPRESS_SHARED, 0x02000D16 },
-
- { IDC_COMPRESS_ENCRYPTION, 0x02000D10 },
- { IDC_STATIC_COMPRESS_PASSWORD1, 0x02000B01 },
- { IDC_STATIC_COMPRESS_PASSWORD2, 0x02000B03 },
- { IDC_COMPRESS_CHECK_SHOW_PASSWORD, 0x02000B02 },
- { IDC_STATIC_COMPRESS_ENCRYPTION_METHOD, 0x02000D11 },
- { IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, 0x02000D0A },
-
- { IDOK, 0x02000702 },
- { IDCANCEL, 0x02000710 },
- { IDHELP, 0x02000720 }
-};
-#endif
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NName;
-using namespace NDirectory;
-
-static const int kHistorySize = 20;
-
-static LPCWSTR kExeExt = L".exe";
-static LPCWSTR k7zFormat = L"7z";
-
-struct CLevelInfo
-{
- UInt32 ResourceID;
- UInt32 LangID;
-};
-
-enum ELevel
-{
- kStore = 0,
- kFastest = 1,
- kFast = 3,
- kNormal = 5,
- kMaximum = 7,
- kUltra = 9
-};
-
-static const CLevelInfo g_Levels[] =
-{
- { IDS_METHOD_STORE, 0x02000D81 },
- { IDS_METHOD_FASTEST, 0x02000D85 },
- { 0, 0 },
- { IDS_METHOD_FAST, 0x02000D84 },
- { 0, 0 },
- { IDS_METHOD_NORMAL, 0x02000D82 },
- { 0, 0 },
- { IDS_METHOD_MAXIMUM, 0x02000D83 },
- { 0, 0 },
- { IDS_METHOD_ULTRA, 0x02000D86 }
-};
-
-enum EMethodID
-{
- kCopy,
- kLZMA,
- kLZMA2,
- kPPMd,
- kBZip2,
- kDeflate,
- kDeflate64
-};
-
-static const LPCWSTR kMethodsNames[] =
-{
- L"Copy",
- L"LZMA",
- L"LZMA2",
- L"PPMd",
- L"BZip2",
- L"Deflate",
- L"Deflate64"
-};
-
-static const EMethodID g_7zMethods[] =
-{
- kLZMA,
- kLZMA2,
- kPPMd,
- kBZip2
-};
-
-static const EMethodID g_7zSfxMethods[] =
-{
- kCopy,
- kLZMA,
- kLZMA2,
- kPPMd
-};
-
-static EMethodID g_ZipMethods[] =
-{
- kDeflate,
- kDeflate64,
- kBZip2,
- kLZMA
-};
-
-static EMethodID g_GZipMethods[] =
-{
- kDeflate
-};
-
-static EMethodID g_BZip2Methods[] =
-{
- kBZip2
-};
-
-static EMethodID g_XzMethods[] =
-{
- kLZMA2
-};
-
-struct CFormatInfo
-{
- LPCWSTR Name;
- UInt32 LevelsMask;
- const EMethodID *MathodIDs;
- int NumMethods;
- bool Filter;
- bool Solid;
- bool MultiThread;
- bool SFX;
- bool Encrypt;
- bool EncryptFileNames;
-};
-
-#define METHODS_PAIR(x) x, MY_SIZE_OF_ARRAY(x)
-
-static const CFormatInfo g_Formats[] =
-{
- {
- L"",
- (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
- 0, 0,
- false, false, false, false, false, false
- },
- {
- k7zFormat,
- (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
- METHODS_PAIR(g_7zMethods),
- true, true, true, true, true, true
- },
- {
- L"Zip",
- (1 << 0) | (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
- METHODS_PAIR(g_ZipMethods),
- false, false, true, false, true, false
- },
- {
- L"GZip",
- (1 << 1) | (1 << 5) | (1 << 7) | (1 << 9),
- METHODS_PAIR(g_GZipMethods),
- false, false, false, false, false, false
- },
- {
- L"BZip2",
- (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
- METHODS_PAIR(g_BZip2Methods),
- false, false, true, false, false, false
- },
- {
- L"xz",
- (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
- METHODS_PAIR(g_XzMethods),
- false, false, true, false, false, false
- },
- {
- L"Tar",
- (1 << 0),
- 0, 0,
- false, false, false, false, false, false
- }
-};
-
-static bool IsMethodSupportedBySfx(int methodID)
-{
- for (int i = 0; i < MY_SIZE_OF_ARRAY(g_7zSfxMethods); i++)
- if (methodID == g_7zSfxMethods[i])
- return true;
- return false;
-};
-
-static UInt64 GetMaxRamSizeForProgram()
-{
- UInt64 physSize = NSystem::GetRamSize();
- const UInt64 kMinSysSize = (1 << 24);
- if (physSize <= kMinSysSize)
- physSize = 0;
- else
- physSize -= kMinSysSize;
- const UInt64 kMinUseSize = (1 << 25);
- if (physSize < kMinUseSize)
- physSize = kMinUseSize;
- return physSize;
-}
-
-bool CCompressDialog::OnInit()
-{
- #ifdef LANG
- LangSetWindowText(HWND(*this), 0x02000D00);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, MY_SIZE_OF_ARRAY(kIDLangPairs) );
- #endif
- _password1Control.Attach(GetItem(IDC_COMPRESS_EDIT_PASSWORD1));
- _password2Control.Attach(GetItem(IDC_COMPRESS_EDIT_PASSWORD2));
- _password1Control.SetText(Info.Password);
- _password2Control.SetText(Info.Password);
- _encryptionMethod.Attach(GetItem(IDC_COMPRESS_COMBO_ENCRYPTION_METHOD));
-
- m_ArchivePath.Attach(GetItem(IDC_COMPRESS_COMBO_ARCHIVE));
- m_Format.Attach(GetItem(IDC_COMPRESS_COMBO_FORMAT));
- m_Level.Attach(GetItem(IDC_COMPRESS_COMBO_LEVEL));
- m_Method.Attach(GetItem(IDC_COMPRESS_COMBO_METHOD));
- m_Dictionary.Attach(GetItem(IDC_COMPRESS_COMBO_DICTIONARY));
- m_Order.Attach(GetItem(IDC_COMPRESS_COMBO_ORDER));
- m_Solid.Attach(GetItem(IDC_COMPRESS_COMBO_SOLID));
- m_NumThreads.Attach(GetItem(IDC_COMPRESS_COMBO_THREADS));
-
- m_UpdateMode.Attach(GetItem(IDC_COMPRESS_COMBO_UPDATE_MODE));
- m_Volume.Attach(GetItem(IDC_COMPRESS_COMBO_VOLUME));
- m_Params.Attach(GetItem(IDC_COMPRESS_EDIT_PARAMETERS));
-
- AddVolumeItems(m_Volume);
-
- ReadCompressionInfo(m_RegistryInfo);
- CheckButton(IDC_COMPRESS_CHECK_SHOW_PASSWORD, m_RegistryInfo.ShowPassword);
- CheckButton(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, m_RegistryInfo.EncryptHeaders);
-
- UpdatePasswordControl();
-
- Info.ArchiverInfoIndex = 0;
- int i;
- for (i = 0; i < m_ArchiverInfoList.Size(); i++)
- {
- const CArcInfoEx &ai = m_ArchiverInfoList[i];
- int index = (int)m_Format.AddString(ai.Name);
- m_Format.SetItemData(index, i);
- if (ai.Name.CompareNoCase(m_RegistryInfo.ArchiveType) == 0 || i == 0)
- {
- m_Format.SetCurSel(index);
- Info.ArchiverInfoIndex = i;
- }
- }
-
- SetArchiveName(Info.ArchiveName);
- SetLevel();
- SetParams();
-
- for (i = 0; i < m_RegistryInfo.HistoryArchives.Size() && i < kHistorySize; i++)
- m_ArchivePath.AddString(m_RegistryInfo.HistoryArchives[i]);
-
- m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_ADD, 0x02000DA1));
- m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_UPDATE, 0x02000DA2));
- m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_FRESH, 0x02000DA3));
- m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_SYNCHRONIZE, 0x02000DA4));
-
- m_UpdateMode.SetCurSel(0);
-
- SetSolidBlockSize();
- SetNumThreads();
-
- TCHAR s[40] = { TEXT('/'), TEXT(' '), 0 };
- ConvertUInt32ToString(NSystem::GetNumberOfProcessors(), s + 2);
- SetItemText(IDC_COMPRESS_HARDWARE_THREADS, s);
-
- CheckButton(IDC_COMPRESS_SFX, Info.SFXMode);
- CheckButton(IDC_COMPRESS_SHARED, Info.OpenShareForWrite);
-
- CheckControlsEnable();
-
- OnButtonSFX();
-
- SetEncryptionMethod();
- SetMemoryUsage();
- return CModalDialog::OnInit();
-}
-
-namespace NCompressDialog
-{
- bool CInfo::GetFullPathName(UString &result) const
- {
- NDirectory::MySetCurrentDirectory(CurrentDirPrefix);
- return MyGetFullPathName(ArchiveName, result);
- }
-}
-
-void CCompressDialog::UpdatePasswordControl()
-{
- bool showPassword = IsShowPasswordChecked();
- TCHAR c = showPassword ? 0: TEXT('*');
- _password1Control.SetPasswordChar(c);
- _password2Control.SetPasswordChar(c);
- UString password;
- _password1Control.GetText(password);
- _password1Control.SetText(password);
- _password2Control.GetText(password);
- _password2Control.SetText(password);
-
- int cmdShow = showPassword ? SW_HIDE : SW_SHOW;
- ShowItem(IDC_STATIC_COMPRESS_PASSWORD2, cmdShow);
- _password2Control.Show(cmdShow);
-}
-
-bool CCompressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
- switch(buttonID)
- {
- case IDC_COMPRESS_BUTTON_SET_ARCHIVE:
- {
- OnButtonSetArchive();
- return true;
- }
- case IDC_COMPRESS_SFX:
- {
- OnButtonSFX();
- SetMemoryUsage();
- return true;
- }
- case IDC_COMPRESS_CHECK_SHOW_PASSWORD:
- {
- UpdatePasswordControl();
- return true;
- }
- }
- return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
-}
-
-void CCompressDialog::CheckSFXControlsEnable()
-{
- const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- bool enable = fi.SFX;
- if (enable)
- {
- int methodID = GetMethodID();
- enable = (methodID == -1 || IsMethodSupportedBySfx(methodID));
- }
- if (!enable)
- CheckButton(IDC_COMPRESS_SFX, false);
- EnableItem(IDC_COMPRESS_SFX, enable);
-}
-
-void CCompressDialog::CheckVolumeEnable()
-{
- bool isSFX = IsSFX();
- m_Volume.Enable(!isSFX);
- if (isSFX)
- m_Volume.SetText(TEXT(""));
-}
-
-void CCompressDialog::CheckControlsEnable()
-{
- const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- Info.SolidIsSpecified = fi.Solid;
- bool multiThreadEnable = fi.MultiThread;
- Info.MultiThreadIsAllowed = multiThreadEnable;
- Info.EncryptHeadersIsAllowed = fi.EncryptFileNames;
-
- EnableItem(IDC_COMPRESS_COMBO_SOLID, fi.Solid);
- EnableItem(IDC_COMPRESS_COMBO_THREADS, multiThreadEnable);
- CheckSFXControlsEnable();
- CheckVolumeEnable();
-
- EnableItem(IDC_COMPRESS_ENCRYPTION, fi.Encrypt);
-
- EnableItem(IDC_STATIC_COMPRESS_PASSWORD1, fi.Encrypt);
- EnableItem(IDC_STATIC_COMPRESS_PASSWORD2, fi.Encrypt);
- EnableItem(IDC_COMPRESS_EDIT_PASSWORD1, fi.Encrypt);
- EnableItem(IDC_COMPRESS_EDIT_PASSWORD2, fi.Encrypt);
- EnableItem(IDC_COMPRESS_CHECK_SHOW_PASSWORD, fi.Encrypt);
-
- EnableItem(IDC_STATIC_COMPRESS_ENCRYPTION_METHOD, fi.Encrypt);
- EnableItem(IDC_COMPRESS_COMBO_ENCRYPTION_METHOD, fi.Encrypt);
- EnableItem(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, fi.EncryptFileNames);
-
- ShowItem(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, fi.EncryptFileNames ? SW_SHOW : SW_HIDE);
-}
-
-bool CCompressDialog::IsSFX()
-{
- CWindow sfxButton = GetItem(IDC_COMPRESS_SFX);
- return sfxButton.IsEnabled() && IsButtonCheckedBool(IDC_COMPRESS_SFX);
-}
-
-void CCompressDialog::OnButtonSFX()
-{
- SetMethod(GetMethodID());
-
- UString fileName;
- m_ArchivePath.GetText(fileName);
- int dotPos = fileName.ReverseFind(L'.');
- int slashPos = fileName.ReverseFind(WCHAR_PATH_SEPARATOR);
- if (dotPos < 0 || dotPos <= slashPos)
- dotPos = -1;
- if (IsSFX())
- {
- if (dotPos >= 0)
- fileName = fileName.Left(dotPos);
- fileName += kExeExt;
- m_ArchivePath.SetText(fileName);
- }
- else
- {
- if (dotPos >= 0)
- {
- UString ext = fileName.Mid(dotPos);
- if (ext.CompareNoCase(kExeExt) == 0)
- {
- fileName = fileName.Left(dotPos);
- m_ArchivePath.SetText(fileName);
- }
- }
- SetArchiveName2(false); // it's for OnInit
- }
-
- CheckVolumeEnable();
-}
-
-void CCompressDialog::OnButtonSetArchive()
-{
- UString fileName;
- m_ArchivePath.GetText(fileName);
- fileName.Trim();
- Info.ArchiveName = fileName;
- UString fullFileName;
- if (!Info.GetFullPathName(fullFileName))
- {
- fullFileName = Info.ArchiveName;
- return;
- }
- UString title = LangString(IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE, 0x02000D90);
- UString s = LangString(IDS_OPEN_TYPE_ALL_FILES, 0x02000DB1);
- s += L" (*.*)";
- UString resPath;
- if (!MyGetOpenFileName(HWND(*this), title, fullFileName, s, resPath))
- return;
- m_ArchivePath.SetText(resPath);
-}
-
-// in ExtractDialog.cpp
-extern void AddUniqueString(UStringVector &strings, const UString &srcString);
-
-static bool IsAsciiString(const UString &s)
-{
- for (int i = 0; i < s.Length(); i++)
- {
- wchar_t c = s[i];
- if (c < 0x20 || c > 0x7F)
- return false;
- }
- return true;
-}
-
-void CCompressDialog::OnOK()
-{
- _password1Control.GetText(Info.Password);
- if (IsZipFormat())
- {
- if (!IsAsciiString(Info.Password))
- {
- ShowErrorMessageHwndRes(*this, IDS_PASSWORD_USE_ASCII, 0x02000B11);
- return;
- }
- UString method = GetEncryptionMethodSpec();
- method.MakeUpper();
- if (method.Find(L"AES") == 0)
- {
- if (Info.Password.Length() > 99)
- {
- ShowErrorMessageHwndRes(*this, IDS_PASSWORD_IS_TOO_LONG, 0x02000B12);
- return;
- }
- }
- }
- if (!IsShowPasswordChecked())
- {
- UString password2;
- _password2Control.GetText(password2);
- if (password2 != Info.Password)
- {
- ShowErrorMessageHwndRes(*this, IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH, 0x02000B10);
- return;
- }
- }
-
- SaveOptionsInMem();
- UString s;
- m_ArchivePath.GetText(s);
- s.Trim();
- m_RegistryInfo.HistoryArchives.Clear();
- AddUniqueString(m_RegistryInfo.HistoryArchives, s);
- Info.ArchiveName = s;
- Info.UpdateMode = NCompressDialog::NUpdateMode::EEnum(m_UpdateMode.GetCurSel());
-
- Info.Level = GetLevelSpec();
- Info.Dictionary = GetDictionarySpec();
- Info.Order = GetOrderSpec();
- Info.OrderMode = GetOrderMode();
- Info.NumThreads = GetNumThreadsSpec();
-
- UInt32 solidLogSize = GetBlockSizeSpec();
- Info.SolidBlockSize = 0;
- if (solidLogSize > 0 && solidLogSize != (UInt32)-1)
- Info.SolidBlockSize = (solidLogSize >= 64) ? (UInt64)(Int64)-1 : ((UInt64)1 << solidLogSize);
-
- Info.Method = GetMethodSpec();
- Info.EncryptionMethod = GetEncryptionMethodSpec();
- Info.ArchiverInfoIndex = GetFormatIndex();
- Info.SFXMode = IsSFX();
- Info.OpenShareForWrite = IsButtonCheckedBool(IDC_COMPRESS_SHARED);
-
- m_RegistryInfo.EncryptHeaders = Info.EncryptHeaders = IsButtonCheckedBool(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES);
-
- m_Params.GetText(Info.Options);
- UString volumeString;
- m_Volume.GetText(volumeString);
- volumeString.Trim();
- Info.VolumeSizes.Clear();
- if (!volumeString.IsEmpty())
- {
- if (!ParseVolumeSizes(volumeString, Info.VolumeSizes))
- {
- ShowErrorMessageHwndRes(*this, IDS_COMPRESS_INCORRECT_VOLUME_SIZE, 0x02000D41);
- return;
- }
- if (!Info.VolumeSizes.IsEmpty())
- {
- const UInt64 volumeSize = Info.VolumeSizes.Back();
- if (volumeSize < (100 << 10))
- {
- wchar_t s[32];
- ConvertUInt64ToString(volumeSize, s);
- if (::MessageBoxW(*this, MyFormatNew(IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE, 0x02000D42, s),
- L"7-Zip", MB_YESNOCANCEL | MB_ICONQUESTION | MB_TASKMODAL) != IDYES)
- return;
- }
- }
- }
-
- for (int i = 0; i < m_ArchivePath.GetCount(); i++)
- {
- UString sTemp;
- m_ArchivePath.GetLBText(i, sTemp);
- sTemp.Trim();
- AddUniqueString(m_RegistryInfo.HistoryArchives, sTemp);
- }
- if (m_RegistryInfo.HistoryArchives.Size() > kHistorySize)
- m_RegistryInfo.HistoryArchives.DeleteBack();
-
- m_RegistryInfo.ArchiveType = m_ArchiverInfoList[Info.ArchiverInfoIndex].Name;
- m_RegistryInfo.ShowPassword = IsShowPasswordChecked();
-
- SaveCompressionInfo(m_RegistryInfo);
-
- CModalDialog::OnOK();
-}
-
-static LPCWSTR kHelpTopic = L"fm/plugins/7-zip/add.htm";
-
-void CCompressDialog::OnHelp()
-{
- ShowHelpWindow(NULL, kHelpTopic);
-}
-
-bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
-{
- if (code == CBN_SELCHANGE)
- {
- switch(itemID)
- {
- case IDC_COMPRESS_COMBO_FORMAT:
- {
- bool isSFX = IsSFX();
- SaveOptionsInMem();
- SetLevel();
- SetSolidBlockSize();
- SetNumThreads();
- SetParams();
- CheckControlsEnable();
- SetArchiveName2(isSFX);
- SetEncryptionMethod();
- SetMemoryUsage();
- return true;
- }
- case IDC_COMPRESS_COMBO_LEVEL:
- {
- const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
- int index = FindRegistryFormatAlways(ai.Name);
- NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
- fo.ResetForLevelChange();
- SetMethod();
- SetSolidBlockSize();
- SetNumThreads();
- CheckSFXNameChange();
- SetMemoryUsage();
- return true;
- }
- case IDC_COMPRESS_COMBO_METHOD:
- {
- SetDictionary();
- SetOrder();
- SetSolidBlockSize();
- SetNumThreads();
- CheckSFXNameChange();
- SetMemoryUsage();
- return true;
- }
- case IDC_COMPRESS_COMBO_DICTIONARY:
- case IDC_COMPRESS_COMBO_ORDER:
- {
- SetSolidBlockSize();
- SetMemoryUsage();
- return true;
- }
- case IDC_COMPRESS_COMBO_THREADS:
- {
- SetMemoryUsage();
- return true;
- }
- }
- }
- return CModalDialog::OnCommand(code, itemID, lParam);
-}
-
-void CCompressDialog::CheckSFXNameChange()
-{
- bool isSFX = IsSFX();
- CheckSFXControlsEnable();
- if (isSFX != IsSFX())
- SetArchiveName2(isSFX);
-}
-
-void CCompressDialog::SetArchiveName2(bool prevWasSFX)
-{
- UString fileName;
- m_ArchivePath.GetText(fileName);
- const CArcInfoEx &prevArchiverInfo = m_ArchiverInfoList[m_PrevFormat];
- if (prevArchiverInfo.KeepName || Info.KeepName)
- {
- UString prevExtension = prevArchiverInfo.GetMainExt();
- if (prevWasSFX)
- prevExtension = kExeExt;
- else
- prevExtension = UString('.') + prevExtension;
- const int prevExtensionLen = prevExtension.Length();
- if (fileName.Length() >= prevExtensionLen)
- if (fileName.Right(prevExtensionLen).CompareNoCase(prevExtension) == 0)
- fileName = fileName.Left(fileName.Length() - prevExtensionLen);
- }
- SetArchiveName(fileName);
-}
-
-// if type.KeepName then use OriginalFileName
-// else if !KeepName remove extension
-// add new extension
-
-void CCompressDialog::SetArchiveName(const UString &name)
-{
- UString fileName = name;
- Info.ArchiverInfoIndex = GetFormatIndex();
- const CArcInfoEx &ai = m_ArchiverInfoList[Info.ArchiverInfoIndex];
- m_PrevFormat = Info.ArchiverInfoIndex;
- if (ai.KeepName)
- {
- fileName = OriginalFileName;
- }
- else
- {
- if (!Info.KeepName)
- {
- int dotPos = fileName.ReverseFind('.');
- int slashPos = MyMax(fileName.ReverseFind(WCHAR_PATH_SEPARATOR), fileName.ReverseFind('/'));
- if (dotPos >= 0 && dotPos > slashPos + 1)
- fileName = fileName.Left(dotPos);
- }
- }
-
- if (IsSFX())
- fileName += kExeExt;
- else
- {
- fileName += L'.';
- fileName += ai.GetMainExt();
- }
- m_ArchivePath.SetText(fileName);
-}
-
-int CCompressDialog::FindRegistryFormat(const UString &name)
-{
- for (int i = 0; i < m_RegistryInfo.FormatOptionsVector.Size(); i++)
- {
- const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[i];
- if (GetUnicodeString(fo.FormatID) == name)
- return i;
- }
- return -1;
-}
-
-int CCompressDialog::FindRegistryFormatAlways(const UString &name)
-{
- int index = FindRegistryFormat(name);
- if (index < 0)
- {
- NCompression::CFormatOptions fo;
- fo.FormatID = GetSystemString(name);
- index = m_RegistryInfo.FormatOptionsVector.Add(fo);
- }
- return index;
-}
-
-int CCompressDialog::GetStaticFormatIndex()
-{
- int formatIndex = GetFormatIndex();
- const CArcInfoEx &ai = m_ArchiverInfoList[formatIndex];
- for (int i = 0; i < MY_SIZE_OF_ARRAY(g_Formats); i++)
- if (ai.Name.CompareNoCase(g_Formats[i].Name) == 0)
- return i;
- return 0; // -1;
-}
-
-void CCompressDialog::SetNearestSelectComboBox(NControl::CComboBox &comboBox, UInt32 value)
-{
- for (int i = comboBox.GetCount() - 1; i >= 0; i--)
- if ((UInt32)comboBox.GetItemData(i) <= value)
- {
- comboBox.SetCurSel(i);
- return;
- }
- if (comboBox.GetCount() > 0)
- comboBox.SetCurSel(0);
-}
-
-void CCompressDialog::SetLevel()
-{
- m_Level.ResetContent();
- const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
- int index = FindRegistryFormat(ai.Name);
- UInt32 level = kNormal;
- if (index >= 0)
- {
- const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
- if (fo.Level <= kUltra)
- level = fo.Level;
- else
- level = kUltra;
- }
- int i;
- for (i = 0; i <= kUltra; i++)
- {
- if ((fi.LevelsMask & (1 << i)) != 0)
- {
- const CLevelInfo &levelInfo = g_Levels[i];
- int index = (int)m_Level.AddString(LangString(levelInfo.ResourceID, levelInfo.LangID));
- m_Level.SetItemData(index, i);
- }
- }
- SetNearestSelectComboBox(m_Level, level);
- SetMethod();
-}
-
-void CCompressDialog::SetMethod(int keepMethodId)
-{
- m_Method.ResetContent();
- UInt32 level = GetLevel();
- if (level == 0)
- {
- SetDictionary();
- SetOrder();
- return;
- }
- const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
- int index = FindRegistryFormat(ai.Name);
- UString defaultMethod;
- if (index >= 0)
- {
- const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
- defaultMethod = fo.Method;
- }
- bool isSfx = IsSFX();
- bool weUseSameMethod = false;
- for (int m = 0; m < fi.NumMethods; m++)
- {
- EMethodID methodID = fi.MathodIDs[m];
- if (isSfx)
- if (!IsMethodSupportedBySfx(methodID))
- continue;
- const LPCWSTR method = kMethodsNames[methodID];
- int itemIndex = (int)m_Method.AddString(GetSystemString(method));
- if (keepMethodId == methodID)
- {
- m_Method.SetCurSel(itemIndex);
- weUseSameMethod = true;
- continue;
- }
- if ((defaultMethod.CompareNoCase(method) == 0 || m == 0) && !weUseSameMethod)
- m_Method.SetCurSel(itemIndex);
- }
- if (!weUseSameMethod)
- {
- SetDictionary();
- SetOrder();
- }
-}
-
-bool CCompressDialog::IsZipFormat()
-{
- const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
- return (ai.Name.CompareNoCase(L"zip") == 0);
-}
-
-void CCompressDialog::SetEncryptionMethod()
-{
- _encryptionMethod.ResetContent();
- const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
- if (ai.Name.CompareNoCase(L"7z") == 0)
- {
- _encryptionMethod.AddString(TEXT("AES-256"));
- _encryptionMethod.SetCurSel(0);
- }
- else if (ai.Name.CompareNoCase(L"zip") == 0)
- {
- int index = FindRegistryFormat(ai.Name);
- UString encryptionMethod;
- if (index >= 0)
- {
- const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
- encryptionMethod = fo.EncryptionMethod;
- }
- _encryptionMethod.AddString(TEXT("ZipCrypto"));
- _encryptionMethod.AddString(TEXT("AES-256"));
- _encryptionMethod.SetCurSel(encryptionMethod.Find(L"AES") == 0 ? 1 : 0);
- }
-}
-
-int CCompressDialog::GetMethodID()
-{
- UString methodName;
- m_Method.GetText(methodName);
- for (int i = 0; i < MY_SIZE_OF_ARRAY(kMethodsNames); i++)
- if (methodName.CompareNoCase(kMethodsNames[i]) == 0)
- return i;
- return -1;
-}
-
-UString CCompressDialog::GetMethodSpec()
-{
- if (m_Method.GetCount() <= 1)
- return UString();
- UString result;
- m_Method.GetText(result);
- return result;
-}
-
-UString CCompressDialog::GetEncryptionMethodSpec()
-{
- if (_encryptionMethod.GetCount() <= 1)
- return UString();
- if (_encryptionMethod.GetCurSel() <= 0)
- return UString();
- UString result;
- _encryptionMethod.GetText(result);
- result.Replace(L"-", L"");
- return result;
-}
-
-int CCompressDialog::AddDictionarySize(UInt32 size, bool kilo, bool maga)
-{
- UInt32 sizePrint = size;
- if (kilo)
- sizePrint >>= 10;
- else if (maga)
- sizePrint >>= 20;
- TCHAR s[40];
- ConvertUInt32ToString(sizePrint, s);
- if (kilo)
- lstrcat(s, TEXT(" K"));
- else if (maga)
- lstrcat(s, TEXT(" M"));
- else
- lstrcat(s, TEXT(" "));
- lstrcat(s, TEXT("B"));
- int index = (int)m_Dictionary.AddString(s);
- m_Dictionary.SetItemData(index, size);
- return index;
-}
-
-int CCompressDialog::AddDictionarySize(UInt32 size)
-{
- if (size > 0)
- {
- if ((size & 0xFFFFF) == 0)
- return AddDictionarySize(size, false, true);
- if ((size & 0x3FF) == 0)
- return AddDictionarySize(size, true, false);
- }
- return AddDictionarySize(size, false, false);
-}
-
-void CCompressDialog::SetDictionary()
-{
- m_Dictionary.ResetContent();
- const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
- int index = FindRegistryFormat(ai.Name);
- UInt32 defaultDictionary = UInt32(-1);
- if (index >= 0)
- {
- const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
- if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
- defaultDictionary = fo.Dictionary;
- }
- int methodID = GetMethodID();
- UInt32 level = GetLevel2();
- if (methodID < 0)
- return;
- const UInt64 maxRamSize = GetMaxRamSizeForProgram();
- switch (methodID)
- {
- case kLZMA:
- case kLZMA2:
- {
- static const UInt32 kMinDicSize = (1 << 16);
- if (defaultDictionary == UInt32(-1))
- {
- if (level >= 9) defaultDictionary = (1 << 26);
- else if (level >= 7) defaultDictionary = (1 << 25);
- else if (level >= 5) defaultDictionary = (1 << 24);
- else if (level >= 3) defaultDictionary = (1 << 20);
- else defaultDictionary = (kMinDicSize);
- }
- int i;
- AddDictionarySize(kMinDicSize);
- m_Dictionary.SetCurSel(0);
- for (i = 20; i <= 30; i++)
- for (int j = 0; j < 2; j++)
- {
- if (i == 20 && j > 0)
- continue;
- UInt32 dictionary = (1 << i) + (j << (i - 1));
- if (dictionary >
- #ifdef _WIN64
- (1 << 30)
- #else
- (1 << 26)
- #endif
- )
- continue;
- AddDictionarySize(dictionary);
- UInt64 decomprSize;
- UInt64 requiredComprSize = GetMemoryUsage(dictionary, decomprSize);
- if (dictionary <= defaultDictionary && requiredComprSize <= maxRamSize)
- m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
- }
-
- // SetNearestSelectComboBox(m_Dictionary, defaultDictionary);
- break;
- }
- case kPPMd:
- {
- if (defaultDictionary == UInt32(-1))
- {
- if (level >= 9) defaultDictionary = (192 << 20);
- else if (level >= 7) defaultDictionary = ( 64 << 20);
- else if (level >= 5) defaultDictionary = ( 16 << 20);
- else defaultDictionary = ( 4 << 20);
- }
- int i;
- for (i = 20; i < 31; i++)
- for (int j = 0; j < 2; j++)
- {
- if (i == 20 && j > 0)
- continue;
- UInt32 dictionary = (1 << i) + (j << (i - 1));
- if (dictionary >= (1 << 31))
- continue;
- AddDictionarySize(dictionary);
- UInt64 decomprSize;
- UInt64 requiredComprSize = GetMemoryUsage(dictionary, decomprSize);
- if (dictionary <= defaultDictionary && requiredComprSize <= maxRamSize || m_Dictionary.GetCount() == 0)
- m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
- }
- SetNearestSelectComboBox(m_Dictionary, defaultDictionary);
- break;
- }
- case kDeflate:
- {
- AddDictionarySize(32 << 10);
- m_Dictionary.SetCurSel(0);
- break;
- }
- case kDeflate64:
- {
- AddDictionarySize(64 << 10);
- m_Dictionary.SetCurSel(0);
- break;
- }
- case kBZip2:
- {
- // UInt32 defaultDictionary;
- if (defaultDictionary == UInt32(-1))
- {
- if (level >= 5)
- defaultDictionary = (900 << 10);
- else if (level >= 3)
- defaultDictionary = (500 << 10);
- else
- defaultDictionary = (100 << 10);
- }
- for (int i = 1; i <= 9; i++)
- {
- UInt32 dictionary = (i * 100) << 10;
- AddDictionarySize(dictionary);
- if (dictionary <= defaultDictionary || m_Dictionary.GetCount() == 0)
- m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
- }
- break;
- }
- }
-}
-
-UInt32 CCompressDialog::GetComboValue(NWindows::NControl::CComboBox &c, int defMax)
-{
- if (c.GetCount() <= defMax)
- return (UInt32)-1;
- return (UInt32)c.GetItemData(c.GetCurSel());
-}
-
-UInt32 CCompressDialog::GetLevel2()
-{
- UInt32 level = GetLevel();
- if (level == (UInt32)-1)
- level = 5;
- return level;
-}
-
-int CCompressDialog::AddOrder(UInt32 size)
-{
- TCHAR s[40];
- ConvertUInt32ToString(size, s);
- int index = (int)m_Order.AddString(s);
- m_Order.SetItemData(index, size);
- return index;
-}
-
-void CCompressDialog::SetOrder()
-{
- m_Order.ResetContent();
- const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
- int index = FindRegistryFormat(ai.Name);
- UInt32 defaultOrder = UInt32(-1);
- if (index >= 0)
- {
- const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
- if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
- defaultOrder = fo.Order;
- }
- int methodID = GetMethodID();
- UInt32 level = GetLevel2();
- if (methodID < 0)
- return;
- switch (methodID)
- {
- case kLZMA:
- case kLZMA2:
- {
- if (defaultOrder == UInt32(-1))
- defaultOrder = (level >= 7) ? 64 : 32;
- for (int i = 3; i <= 8; i++)
- for (int j = 0; j < 2; j++)
- {
- UInt32 order = (1 << i) + (j << (i - 1));
- if (order <= 256)
- AddOrder(order);
- }
- AddOrder(273);
- SetNearestSelectComboBox(m_Order, defaultOrder);
- break;
- }
- case kPPMd:
- {
- if (defaultOrder == UInt32(-1))
- {
- if (level >= 9)
- defaultOrder = 32;
- else if (level >= 7)
- defaultOrder = 16;
- else if (level >= 5)
- defaultOrder = 6;
- else
- defaultOrder = 4;
- }
- int i;
- AddOrder(2);
- AddOrder(3);
- for (i = 2; i < 8; i++)
- for (int j = 0; j < 4; j++)
- {
- UInt32 order = (1 << i) + (j << (i - 2));
- if (order < 32)
- AddOrder(order);
- }
- AddOrder(32);
- SetNearestSelectComboBox(m_Order, defaultOrder);
- break;
- }
- case kDeflate:
- case kDeflate64:
- {
- if (defaultOrder == UInt32(-1))
- {
- if (level >= 9)
- defaultOrder = 128;
- else if (level >= 7)
- defaultOrder = 64;
- else
- defaultOrder = 32;
- }
- int i;
- for (i = 3; i <= 8; i++)
- for (int j = 0; j < 2; j++)
- {
- UInt32 order = (1 << i) + (j << (i - 1));
- if (order <= 256)
- AddOrder(order);
- }
- AddOrder(methodID == kDeflate64 ? 257 : 258);
- SetNearestSelectComboBox(m_Order, defaultOrder);
- break;
- }
- case kBZip2:
- {
- break;
- }
- }
-}
-
-bool CCompressDialog::GetOrderMode()
-{
- switch (GetMethodID())
- {
- case kPPMd:
- return true;
- }
- return false;
-}
-
-static const UInt32 kNoSolidBlockSize = 0;
-static const UInt32 kSolidBlockSize = 64;
-
-void CCompressDialog::SetSolidBlockSize()
-{
- m_Solid.ResetContent();
- const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- if (!fi.Solid)
- return;
-
- UInt32 level = GetLevel2();
- if (level == 0)
- return;
-
- UInt32 dictionary = GetDictionarySpec();
- if (dictionary == UInt32(-1))
- dictionary = 1;
-
- UInt32 defaultBlockSize = (UInt32)-1;
-
- const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
- int index = FindRegistryFormat(ai.Name);
- if (index >= 0)
- {
- const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
- if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
- defaultBlockSize = fo.BlockLogSize;
- }
-
- index = (int)m_Solid.AddString(LangString(IDS_COMPRESS_NON_SOLID, 0x02000D14));
- m_Solid.SetItemData(index, (UInt32)kNoSolidBlockSize);
- m_Solid.SetCurSel(0);
- bool needSet = defaultBlockSize == (UInt32)-1;
- for (int i = 20; i <= 36; i++)
- {
- if (needSet && dictionary >= (((UInt64)1 << (i - 7))) && i <= 32)
- defaultBlockSize = i;
- TCHAR s[40];
- ConvertUInt32ToString(1 << (i % 10), s);
- if (i < 30) lstrcat(s, TEXT(" M"));
- else lstrcat(s, TEXT(" G"));
- lstrcat(s, TEXT("B"));
- int index = (int)m_Solid.AddString(s);
- m_Solid.SetItemData(index, (UInt32)i);
- }
- index = (int)m_Solid.AddString(LangString(IDS_COMPRESS_SOLID, 0x02000D15));
- m_Solid.SetItemData(index, kSolidBlockSize);
- if (defaultBlockSize == (UInt32)-1)
- defaultBlockSize = kSolidBlockSize;
- if (defaultBlockSize != kNoSolidBlockSize)
- SetNearestSelectComboBox(m_Solid, defaultBlockSize);
-}
-
-void CCompressDialog::SetNumThreads()
-{
- m_NumThreads.ResetContent();
-
- const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- if (!fi.MultiThread)
- return;
-
- UInt32 numHardwareThreads = NSystem::GetNumberOfProcessors();
- UInt32 defaultValue = numHardwareThreads;
-
- const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
- int index = FindRegistryFormat(ai.Name);
- if (index >= 0)
- {
- const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
- if (fo.Method.CompareNoCase(GetMethodSpec()) == 0)
- defaultValue = fo.NumThreads;
- }
-
- UInt32 numAlgoThreadsMax = 1;
- int methodID = GetMethodID();
- switch (methodID)
- {
- case kLZMA: numAlgoThreadsMax = 2; break;
- case kLZMA2: numAlgoThreadsMax = 32; break;
- case kBZip2: numAlgoThreadsMax = 32; break;
- }
- if (IsZipFormat())
- numAlgoThreadsMax = 128;
- for (UInt32 i = 1; i <= numHardwareThreads * 2 && i <= numAlgoThreadsMax; i++)
- {
- TCHAR s[40];
- ConvertUInt32ToString(i, s);
- int index = (int)m_NumThreads.AddString(s);
- m_NumThreads.SetItemData(index, (UInt32)i);
- }
- SetNearestSelectComboBox(m_NumThreads, defaultValue);
-}
-
-
-UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemory)
-{
- decompressMemory = UInt64(Int64(-1));
- UInt32 level = GetLevel2();
- if (level == 0)
- {
- decompressMemory = (1 << 20);
- return decompressMemory;
- }
- UInt64 size = 0;
-
- const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- if (fi.Filter && level >= 9)
- size += (12 << 20) * 2 + (5 << 20);
- UInt32 numThreads = GetNumThreads2();
- if (IsZipFormat())
- {
- UInt32 numSubThreads = 1;
- if (GetMethodID() == kLZMA && numThreads > 1 && level >= 5)
- numSubThreads = 2;
- UInt32 numMainThreads = numThreads / numSubThreads;
- if (numMainThreads > 1)
- size += (UInt64)numMainThreads << 25;
- }
- int methidId = GetMethodID();
- switch (methidId)
- {
- case kLZMA:
- case kLZMA2:
- {
- UInt32 hs = dictionary - 1;
- hs |= (hs >> 1);
- hs |= (hs >> 2);
- hs |= (hs >> 4);
- hs |= (hs >> 8);
- hs >>= 1;
- hs |= 0xFFFF;
- if (hs > (1 << 24))
- hs >>= 1;
- hs++;
- UInt64 size1 = (UInt64)hs * 4;
- size1 += (UInt64)dictionary * 4;
- if (level >= 5)
- size1 += (UInt64)dictionary * 4;
- size1 += (2 << 20);
-
- UInt32 numThreads1 = 1;
- if (numThreads > 1 && level >= 5)
- {
- size1 += (2 << 20) + (4 << 20);
- numThreads1 = 2;
- }
- UInt32 numBlockThreads = numThreads / numThreads1;
- if (methidId == kLZMA || numBlockThreads == 1)
- size1 += (UInt64)dictionary * 3 / 2;
- else
- {
- UInt64 chunkSize = (UInt64)dictionary << 2;
- chunkSize = MyMax(chunkSize, (UInt64)(1 << 20));
- chunkSize = MyMin(chunkSize, (UInt64)(1 << 28));
- chunkSize = MyMax(chunkSize, (UInt64)dictionary);
- size1 += chunkSize * 2;
- }
- size += size1 * numBlockThreads;
-
- decompressMemory = dictionary + (2 << 20);
- return size;
- }
- case kPPMd:
- {
- decompressMemory = dictionary + (2 << 20);
- return size + decompressMemory;
- }
- case kDeflate:
- case kDeflate64:
- {
- UInt32 order = GetOrder();
- if (order == UInt32(-1))
- order = 32;
- if (level >= 7)
- size += (1 << 20);
- size += 3 << 20;
- decompressMemory = (2 << 20);
- return size;
- }
- case kBZip2:
- {
- decompressMemory = (7 << 20);
- UInt64 memForOneThread = (10 << 20);
- return size + memForOneThread * numThreads;
- }
- }
- return UInt64(Int64(-1));
-}
-
-UInt64 CCompressDialog::GetMemoryUsage(UInt64 &decompressMemory)
-{
- return GetMemoryUsage(GetDictionary(), decompressMemory);
-}
-
-void CCompressDialog::PrintMemUsage(UINT res, UInt64 value)
-{
- if (value == (UInt64)(Int64)-1)
- {
- SetItemText(res, TEXT("?"));
- return;
- }
- value = (value + (1 << 20) - 1) >> 20;
- TCHAR s[40];
- ConvertUInt64ToString(value, s);
- lstrcat(s, TEXT(" MB"));
- SetItemText(res, s);
-}
-
-void CCompressDialog::SetMemoryUsage()
-{
- UInt64 decompressMem;
- UInt64 memUsage = GetMemoryUsage(decompressMem);
- PrintMemUsage(IDC_STATIC_COMPRESS_MEMORY_VALUE, memUsage);
- PrintMemUsage(IDC_STATIC_COMPRESS_MEMORY_DE_VALUE, decompressMem);
-}
-
-void CCompressDialog::SetParams()
-{
- const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
- m_Params.SetText(TEXT(""));
- int index = FindRegistryFormat(ai.Name);
- if (index >= 0)
- {
- const NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
- m_Params.SetText(fo.Options);
- }
-}
-
-void CCompressDialog::SaveOptionsInMem()
-{
- const CArcInfoEx &ai = m_ArchiverInfoList[Info.ArchiverInfoIndex];
- int index = FindRegistryFormatAlways(ai.Name);
- m_Params.GetText(Info.Options);
- Info.Options.Trim();
- NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
- fo.Options = Info.Options;
- fo.Level = GetLevelSpec();
- fo.Dictionary = GetDictionarySpec();
- fo.Order = GetOrderSpec();
- fo.Method = GetMethodSpec();
- fo.EncryptionMethod = GetEncryptionMethodSpec();
- fo.NumThreads = GetNumThreadsSpec();
- fo.BlockLogSize = GetBlockSizeSpec();
-}
-
-int CCompressDialog::GetFormatIndex()
-{
- return (int)m_Format.GetItemData(m_Format.GetCurSel());
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialog.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialog.h
deleted file mode 100644
index 75eeeee82..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialog.h
+++ /dev/null
@@ -1,184 +0,0 @@
-// CompressDialog.h
-
-#ifndef __COMPRESS_DIALOG_H
-#define __COMPRESS_DIALOG_H
-
-#include "Windows/Control/ComboBox.h"
-#include "Windows/Control/Dialog.h"
-#include "Windows/Control/Edit.h"
-
-#include "../Common/LoadCodecs.h"
-#include "../Common/ZipRegistry.h"
-
-#include "CompressDialogRes.h"
-
-namespace NCompressDialog
-{
- namespace NUpdateMode
- {
- enum EEnum
- {
- kAdd,
- kUpdate,
- kFresh,
- kSynchronize,
- };
- }
- struct CInfo
- {
- NUpdateMode::EEnum UpdateMode;
- bool SolidIsSpecified;
- bool MultiThreadIsAllowed;
- UInt64 SolidBlockSize;
- UInt32 NumThreads;
-
- CRecordVector<UInt64> VolumeSizes;
-
- UInt32 Level;
- UString Method;
- UInt32 Dictionary;
- bool OrderMode;
- UInt32 Order;
- UString Options;
-
- UString EncryptionMethod;
-
- bool SFXMode;
- bool OpenShareForWrite;
-
-
- UString ArchiveName; // in: Relative for ; out: abs
- UString CurrentDirPrefix;
- bool KeepName;
-
- bool GetFullPathName(UString &result) const;
-
- int ArchiverInfoIndex;
-
- UString Password;
- bool EncryptHeadersIsAllowed;
- bool EncryptHeaders;
-
- void Init()
- {
- Level = Dictionary = Order = UInt32(-1);
- OrderMode = false;
- Method.Empty();
- Options.Empty();
- EncryptionMethod.Empty();
- }
- CInfo()
- {
- Init();
- }
- };
-}
-
-class CCompressDialog: public NWindows::NControl::CModalDialog
-{
- NWindows::NControl::CComboBox m_ArchivePath;
- NWindows::NControl::CComboBox m_Format;
- NWindows::NControl::CComboBox m_Level;
- NWindows::NControl::CComboBox m_Method;
- NWindows::NControl::CComboBox m_Dictionary;
- NWindows::NControl::CComboBox m_Order;
- NWindows::NControl::CComboBox m_Solid;
- NWindows::NControl::CComboBox m_NumThreads;
- NWindows::NControl::CComboBox m_UpdateMode;
- NWindows::NControl::CComboBox m_Volume;
- NWindows::NControl::CDialogChildControl m_Params;
-
- NWindows::NControl::CEdit _password1Control;
- NWindows::NControl::CEdit _password2Control;
- NWindows::NControl::CComboBox _encryptionMethod;
-
- NCompression::CInfo m_RegistryInfo;
-
- int m_PrevFormat;
- void SetArchiveName(const UString &name);
- int FindRegistryFormat(const UString &name);
- int FindRegistryFormatAlways(const UString &name);
-
- void CheckSFXNameChange();
- void SetArchiveName2(bool prevWasSFX);
-
- int GetStaticFormatIndex();
-
- void SetNearestSelectComboBox(NWindows::NControl::CComboBox &comboBox, UInt32 value);
-
- void SetLevel();
-
- void SetMethod(int keepMethodId = -1);
- int GetMethodID();
- UString GetMethodSpec();
- UString GetEncryptionMethodSpec();
-
- bool IsZipFormat();
-
- void SetEncryptionMethod();
-
- int AddDictionarySize(UInt32 size, bool kilo, bool maga);
- int AddDictionarySize(UInt32 size);
-
- void SetDictionary();
-
- UInt32 GetComboValue(NWindows::NControl::CComboBox &c, int defMax = 0);
-
- UInt32 GetLevel() { return GetComboValue(m_Level); }
- UInt32 GetLevelSpec() { return GetComboValue(m_Level, 1); }
- UInt32 GetLevel2();
- UInt32 GetDictionary() { return GetComboValue(m_Dictionary); }
- UInt32 GetDictionarySpec() { return GetComboValue(m_Dictionary, 1); }
- UInt32 GetOrder() { return GetComboValue(m_Order); }
- UInt32 GetOrderSpec() { return GetComboValue(m_Order, 1); }
- UInt32 GetNumThreadsSpec() { return GetComboValue(m_NumThreads, 1); }
- UInt32 GetNumThreads2() { UInt32 num = GetNumThreadsSpec(); if (num == UInt32(-1)) num = 1; return num; }
- UInt32 GetBlockSizeSpec() { return GetComboValue(m_Solid, 1); }
-
- int AddOrder(UInt32 size);
- void SetOrder();
- bool GetOrderMode();
-
- void SetSolidBlockSize();
- void SetNumThreads();
-
- UInt64 GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemory);
- UInt64 GetMemoryUsage(UInt64 &decompressMemory);
- void PrintMemUsage(UINT res, UInt64 value);
- void SetMemoryUsage();
- void SetParams();
- void SaveOptionsInMem();
-
- void UpdatePasswordControl();
- bool IsShowPasswordChecked() const
- { return IsButtonChecked(IDC_COMPRESS_CHECK_SHOW_PASSWORD) == BST_CHECKED; }
-
- int GetFormatIndex();
-public:
- CObjectVector<CArcInfoEx> m_ArchiverInfoList;
-
- NCompressDialog::CInfo Info;
- UString OriginalFileName; // for bzip2, gzip2
-
- INT_PTR Create(HWND wndParent = 0)
- { return CModalDialog::Create(IDD_DIALOG_COMPRESS, wndParent); }
-
-protected:
-
- void CheckSFXControlsEnable();
- void CheckVolumeEnable();
- void CheckControlsEnable();
-
- void OnButtonSetArchive();
- bool IsSFX();
- void OnButtonSFX();
-
- virtual bool OnInit();
- virtual bool OnCommand(int code, int itemID, LPARAM lParam);
- virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
- virtual void OnOK();
- virtual void OnHelp();
-
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialogRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialogRes.h
deleted file mode 100644
index beedde4ef..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialogRes.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#define IDD_DIALOG_COMPRESS 152
-#define IDC_STATIC_COMPRESS_MEMORY 1022
-#define IDC_STATIC_COMPRESS_MEMORY_DE 1023
-#define IDC_STATIC_COMPRESS_MEMORY_VALUE 1027
-#define IDC_STATIC_COMPRESS_MEMORY_DE_VALUE 1028
-#define IDC_COMPRESS_COMBO_ARCHIVE 1072
-#define IDC_COMPRESS_BUTTON_SET_ARCHIVE 1073
-#define IDC_COMPRESS_COMBO_LEVEL 1074
-#define IDC_COMPRESS_COMBO_UPDATE_MODE 1075
-#define IDC_COMPRESS_COMBO_FORMAT 1076
-#define IDC_COMPRESS_COMBO_VOLUME 1077
-#define IDC_COMPRESS_COMBO_METHOD 1078
-#define IDC_COMPRESS_COMBO_DICTIONARY 1079
-#define IDC_COMPRESS_COMBO_ORDER 1080
-
-#define IDC_COMPRESS_COMBO_SOLID 1081
-#define IDC_COMPRESS_COMBO_THREADS 1082
-#define IDC_COMPRESS_HARDWARE_THREADS 1083
-
-#define IDC_COMPRESS_SFX 1090
-#define IDC_COMPRESS_EDIT_PARAMETERS 1091
-
-// #define IDC_COMPRESS_SOLID 1092
-// #define IDC_COMPRESS_MULTI_THREAD 1093
-
-#define IDC_STATIC_COMPRESS_ARCHIVE 1097
-#define IDC_STATIC_COMPRESS_FORMAT 1098
-#define IDC_STATIC_COMPRESS_LEVEL 1099
-#define IDC_STATIC_COMPRESS_PARAMETERS 1100
-#define IDC_STATIC_COMPRESS_UPDATE_MODE 1101
-#define IDC_STATIC_COMPRESS_OPTIONS 1102
-#define IDC_STATIC_COMPRESS_VOLUME 1103
-#define IDC_STATIC_COMPRESS_METHOD 1104
-#define IDC_STATIC_COMPRESS_DICTIONARY 1105
-#define IDC_STATIC_COMPRESS_ORDER 1106
-
-#define IDC_STATIC_COMPRESS_SOLID 1107
-#define IDC_STATIC_COMPRESS_THREADS 1108
-
-#define IDC_COMPRESS_ENCRYPTION 1110
-#define IDC_STATIC_COMPRESS_PASSWORD1 1111
-#define IDC_COMPRESS_EDIT_PASSWORD1 1112
-#define IDC_STATIC_COMPRESS_PASSWORD2 1113
-#define IDC_COMPRESS_EDIT_PASSWORD2 1114
-#define IDC_COMPRESS_CHECK_SHOW_PASSWORD 1115
-
-#define IDC_STATIC_COMPRESS_ENCRYPTION_METHOD 1120
-#define IDC_COMPRESS_COMBO_ENCRYPTION_METHOD 1121
-
-#define IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES 1122
-
-#define IDC_COMPRESS_SHARED 1130
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialog_rc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialog_rc.cpp
deleted file mode 100644
index b69ab8daf..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/CompressDialog_rc.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-// CompressDialog.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#include "resource.h"
-#include "Windows/Control/DialogImpl.h"
-
-#include "CompressDialogRes.h"
-
-class CCompressDialogImpl : public NWindows::NControl::CModalDialogImpl
-{
- public:
- CCompressDialogImpl(NWindows::NControl::CModalDialog *dialog,wxWindow * parent , int id) : CModalDialogImpl(dialog,parent, id, wxT("Add to Archive"))
- {
- wxStaticText *m_pStaticTextMemoryCompress;
- wxStaticText *m_pStaticTextMemoryDecompress;
- wxTextCtrl *m_pTextCtrlPassword;
- wxTextCtrl *m_pTextCtrlRePassword;
- wxTextCtrl *m_pTextCtrlParameters;
- wxComboBox *m_pComboBoxArchiveName;
- wxComboBox *m_pComboBoxArchiveFormat;
- wxComboBox *m_pComboBoxCompressionLevel;
- wxComboBox *m_pComboBoxCompressionMethod;
- wxComboBox *m_pComboBoxDictionarySize;
- wxComboBox *m_pComboBoxWordSize;
- wxComboBox *m_pComboBoxUpdateMode;
- wxComboBox *m_pComboBoxEncryptionMethod;
- wxComboBox *m_pComboBoxSplitToVolumes;
- wxCheckBox *m_pCheckBoxShowPassword;
- wxCheckBox *m_pCheckBoxEncryptFileNames;
- wxButton *m_pButtonBrowse;
-
-
- ///Sizer for adding the controls created by users
- wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
-
- wxStaticText *pStaticTextArchive = new wxStaticText(this, IDC_STATIC_COMPRESS_ARCHIVE, wxT("&Archive:"));
- wxBoxSizer *pArchiveNameSizer = new wxBoxSizer(wxHORIZONTAL);
- m_pComboBoxArchiveName = new wxComboBox(this, IDC_COMPRESS_COMBO_ARCHIVE, wxEmptyString, wxDefaultPosition, wxSize(600,-1), wxArrayString(), wxCB_DROPDOWN|wxCB_SORT);
- m_pButtonBrowse = new wxButton(this, IDC_COMPRESS_BUTTON_SET_ARCHIVE, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
- pArchiveNameSizer->Add(m_pComboBoxArchiveName, 1, wxALL|wxEXPAND, 5);
- pArchiveNameSizer->Add(m_pButtonBrowse, 0, wxALL|wxEXPAND, 5);
- wxBoxSizer *pControlSizer = new wxBoxSizer(wxHORIZONTAL);
- wxBoxSizer *pLeftSizer = new wxBoxSizer(wxVERTICAL);
-
- wxBoxSizer *pCompressionOptionsSizer = new wxBoxSizer(wxHORIZONTAL);
- wxBoxSizer *pCompressionStaticSizer = new wxBoxSizer(wxVERTICAL);
- wxBoxSizer *pCompressionComboSizer = new wxBoxSizer(wxVERTICAL);
-
- wxStaticText *pStaticTextArchiveFormat = new wxStaticText(this, IDC_STATIC_COMPRESS_FORMAT, wxT("Archive &format:"));
- /*
- wxArrayString archiveFormatArray;
- archiveFormatArray.Add(wxT("7z"));
- archiveFormatArray.Add(wxT("Tar"));
- archiveFormatArray.Add(wxT("Zip"));
- m_pComboBoxArchiveFormat = new wxComboBox(this, IDC_COMPRESS_COMBO_FORMAT, archiveFormatArray.Item(0), wxDefaultPosition, wxDefaultSize, archiveFormatArray, wxCB_READONLY);
- */
-
- m_pComboBoxArchiveFormat = new wxComboBox(this, IDC_COMPRESS_COMBO_FORMAT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
-
- wxStaticText *pStaticTextCompressionLevel = new wxStaticText(this, IDC_STATIC_COMPRESS_LEVEL, wxT("Compression &level:"));
- wxArrayString compressionLevelArray;
- /*
- compressionLevelArray.Add(wxT("Store"));
- compressionLevelArray.Add(wxT("Fastest"));
- compressionLevelArray.Add(wxT("Fast"));
- compressionLevelArray.Add(wxT("Normal"));
- compressionLevelArray.Add(wxT("Maximum"));
- compressionLevelArray.Add(wxT("Ultra"));
- m_pComboBoxCompressionLevel = new wxComboBox(this, IDC_COMPRESS_COMBO_LEVEL, compressionLevelArray.Item(0), wxDefaultPosition, wxDefaultSize, compressionLevelArray, wxCB_READONLY);
- */
- m_pComboBoxCompressionLevel = new wxComboBox(this, IDC_COMPRESS_COMBO_LEVEL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
-
- wxStaticText *pStaticTextCompressionMethod = new wxStaticText(this, IDC_STATIC_COMPRESS_METHOD, wxT("Compression &method:"));
-/*
- wxArrayString compressionMethodArray;
- compressionMethodArray.Add(wxT("LZMA"));
- compressionMethodArray.Add(wxT("PPMd"));
- compressionMethodArray.Add(wxT("BZip2"));
- m_pComboBoxCompressionMethod = new wxComboBox(this, IDC_COMPRESS_COMBO_METHOD, compressionMethodArray.Item(0), wxDefaultPosition, wxDefaultSize, compressionMethodArray, wxCB_READONLY);
-*/
- m_pComboBoxCompressionMethod = new wxComboBox(this, IDC_COMPRESS_COMBO_METHOD, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
-
- wxStaticText *pStaticTextDictionarySize = new wxStaticText(this, IDC_STATIC_COMPRESS_DICTIONARY, wxT("&Dictionary size:"));
-/*
- wxArrayString dictionarySizeArray;
- dictionarySizeArray.Add(wxT("64 KB"));
- dictionarySizeArray.Add(wxT("1 MB"));
- dictionarySizeArray.Add(wxT("1 MB"));
- dictionarySizeArray.Add(wxT("2 MB"));
- dictionarySizeArray.Add(wxT("3 MB"));
- dictionarySizeArray.Add(wxT("4 MB"));
- dictionarySizeArray.Add(wxT("6 MB"));
- dictionarySizeArray.Add(wxT("8 MB"));
- dictionarySizeArray.Add(wxT("12 MB"));
- dictionarySizeArray.Add(wxT("16 MB"));
- dictionarySizeArray.Add(wxT("24 MB"));
- dictionarySizeArray.Add(wxT("32 MB"));
- dictionarySizeArray.Add(wxT("48 MB"));
- dictionarySizeArray.Add(wxT("64 MB"));
- dictionarySizeArray.Add(wxT("96 MB"));
- dictionarySizeArray.Add(wxT("128 MB"));
- m_pComboBoxDictionarySize = new wxComboBox(this, IDC_COMPRESS_COMBO_DICTIONARY, dictionarySizeArray.Item(0), wxDefaultPosition, wxDefaultSize, dictionarySizeArray, wxCB_READONLY);
-*/
- m_pComboBoxDictionarySize = new wxComboBox(this, IDC_COMPRESS_COMBO_DICTIONARY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
-
- wxStaticText *pStaticTextNumberOfThreads = new wxStaticText(this, IDC_STATIC_COMPRESS_THREADS, wxT("&Number of CPU threads:"));
-/*
- wxArrayString numberOfThreadsArray;
- numberOfThreadsArray.Add(wxT("1"));
- numberOfThreadsArray.Add(wxT("2"));
- wxComboBox *m_pComboBoxNumberOfThreads = new wxComboBox(this, IDC_COMPRESS_COMBO_THREADS, numberOfThreadsArray.Item(0), wxDefaultPosition, wxDefaultSize, numberOfThreadsArray, wxCB_READONLY);
-*/
- wxComboBox *m_pComboBoxNumberOfThreads = new wxComboBox(this, IDC_COMPRESS_COMBO_THREADS, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
-
-
-
-
-
-
- wxStaticText *pStaticTextWordSize = new wxStaticText(this, IDC_STATIC_COMPRESS_ORDER, wxT("&Word size:"));
-/*
- wxArrayString wordSizeArray;
- wordSizeArray.Add(wxT("8"));
- wordSizeArray.Add(wxT("12"));
- wordSizeArray.Add(wxT("16"));
- wordSizeArray.Add(wxT("24"));
- wordSizeArray.Add(wxT("32"));
- wordSizeArray.Add(wxT("48"));
- wordSizeArray.Add(wxT("64"));
- wordSizeArray.Add(wxT("96"));
- wordSizeArray.Add(wxT("128"));
- wordSizeArray.Add(wxT("192"));
- wordSizeArray.Add(wxT("256"));
- wordSizeArray.Add(wxT("273"));
- m_pComboBoxWordSize = new wxComboBox(this, IDC_COMPRESS_COMBO_ORDER, wordSizeArray.Item(0), wxDefaultPosition, wxDefaultSize, wordSizeArray, wxCB_READONLY);
-*/
- m_pComboBoxWordSize = new wxComboBox(this, IDC_COMPRESS_COMBO_ORDER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
-
-
- wxStaticText *pStaticTextBlockSize = new wxStaticText(this, IDC_STATIC_COMPRESS_SOLID, wxT("&Solid Block size:"));
-
- wxComboBox *m_pComboBoxBlockSize = new wxComboBox(this, IDC_COMPRESS_COMBO_SOLID, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
-
- pCompressionStaticSizer->Add(pStaticTextArchiveFormat, 1, wxALL|wxEXPAND, 5);
- pCompressionStaticSizer->Add(pStaticTextCompressionLevel, 1, wxALL|wxEXPAND, 5);
- pCompressionStaticSizer->Add(pStaticTextCompressionMethod, 1, wxALL|wxEXPAND, 5);
- pCompressionStaticSizer->Add(pStaticTextDictionarySize, 1, wxALL|wxEXPAND, 5);
- pCompressionStaticSizer->Add(pStaticTextWordSize, 1, wxALL|wxEXPAND, 5);
- pCompressionStaticSizer->Add(pStaticTextBlockSize, 1, wxALL|wxEXPAND, 5);
- pCompressionStaticSizer->Add(pStaticTextNumberOfThreads, 1, wxALL|wxEXPAND, 5);
- pCompressionComboSizer->Add(m_pComboBoxArchiveFormat, 1, wxALL|wxEXPAND, 5);
- pCompressionComboSizer->Add(m_pComboBoxCompressionLevel, 1, wxALL|wxEXPAND, 5);
- pCompressionComboSizer->Add(m_pComboBoxCompressionMethod, 1, wxALL|wxEXPAND, 5);
- pCompressionComboSizer->Add(m_pComboBoxDictionarySize, 1, wxALL|wxEXPAND, 5);
- pCompressionComboSizer->Add(m_pComboBoxWordSize, 1, wxALL|wxEXPAND, 5);
- pCompressionComboSizer->Add(m_pComboBoxBlockSize, 1, wxALL|wxEXPAND, 5);
- pCompressionComboSizer->Add(m_pComboBoxNumberOfThreads, 1, wxALL|wxEXPAND, 5);
- pCompressionOptionsSizer->Add(pCompressionStaticSizer, 1, wxALL|wxEXPAND, 0);
- pCompressionOptionsSizer->Add(pCompressionComboSizer, 1, wxALL|wxEXPAND, 0);
-
- wxBoxSizer *pMemoryUsageSizer = new wxBoxSizer(wxHORIZONTAL);
- wxBoxSizer *pMemoryUsageLabelSizer = new wxBoxSizer(wxVERTICAL);
- wxBoxSizer *pMemoryUsageInfoSizer = new wxBoxSizer(wxVERTICAL);
- wxStaticText *pStaticTextCompressMemoryUsage = new wxStaticText(this, IDC_STATIC_COMPRESS_MEMORY, wxT("Memory usage for Compressing:"));
- m_pStaticTextMemoryCompress = new wxStaticText(this, IDC_STATIC_COMPRESS_MEMORY_VALUE, wxT("709 MB"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
- wxStaticText *pStaticTextDecompressMemoryUsage = new wxStaticText(this, IDC_STATIC_COMPRESS_MEMORY_DE, wxT("Memory usage for Decompressing"));
- m_pStaticTextMemoryDecompress = new wxStaticText(this, IDC_STATIC_COMPRESS_MEMORY_DE_VALUE, wxT("66 MB"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
- pMemoryUsageLabelSizer->Add(pStaticTextCompressMemoryUsage, 1, wxALL|wxEXPAND, 5);
- pMemoryUsageLabelSizer->Add(pStaticTextDecompressMemoryUsage, 1, wxALL|wxEXPAND, 5);
- pMemoryUsageInfoSizer->Add(m_pStaticTextMemoryCompress, 1, wxALL|wxEXPAND, 5);
- pMemoryUsageInfoSizer->Add(m_pStaticTextMemoryDecompress, 1, wxALL|wxEXPAND, 5);
- pMemoryUsageSizer->Add(pMemoryUsageLabelSizer, 1, wxALL|wxEXPAND, 0);
- pMemoryUsageSizer->Add(pMemoryUsageInfoSizer, 0, wxALL|wxEXPAND, 0);
-
- wxStaticText *pStaticSplit2Volumes = new wxStaticText(this, IDC_STATIC_COMPRESS_VOLUME, wxT("Split to &volumes, bytes:"));
-/*
- wxArrayString split2VolumesArray;
- split2VolumesArray.Add(wxT("1457664 - 3.5\" floppy"));
- split2VolumesArray.Add(wxT("650M - CD"));
- split2VolumesArray.Add(wxT("700M - CD"));
- split2VolumesArray.Add(wxT("4480M - DVD"));
- m_pComboBoxSplitToVolumes = new wxComboBox(this, IDC_COMPRESS_COMBO_VOLUME, wxEmptyString, wxDefaultPosition, wxDefaultSize, split2VolumesArray, wxCB_DROPDOWN);
-*/
- m_pComboBoxSplitToVolumes = new wxComboBox(this, IDC_COMPRESS_COMBO_VOLUME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_DROPDOWN);
-
- pLeftSizer->Add(pCompressionOptionsSizer, 0, wxALL|wxEXPAND, 0);
- pLeftSizer->Add(pMemoryUsageSizer, 1, wxALL|wxEXPAND, 0);
- pLeftSizer->Add(pStaticSplit2Volumes, 0, wxALL|wxEXPAND, 5);
- pLeftSizer->Add(m_pComboBoxSplitToVolumes, 0, wxALL|wxEXPAND, 5);
-
- wxBoxSizer *pRightSizer = new wxBoxSizer(wxVERTICAL);
- wxStaticText *pStaticTextUpdateMode = new wxStaticText(this, IDC_STATIC_COMPRESS_UPDATE_MODE, wxT("&Update mode:"));
-/*
- wxArrayString updateModeArray;
- updateModeArray.Add(wxT("Add and replace files"));
- updateModeArray.Add(wxT("Update and add files"));
- updateModeArray.Add(wxT("Freshen existing files"));
- updateModeArray.Add(wxT("Synchronize files"));
- m_pComboBoxUpdateMode = new wxComboBox(this, IDC_COMPRESS_COMBO_UPDATE_MODE, updateModeArray.Item(0), wxDefaultPosition, wxDefaultSize, updateModeArray, wxCB_READONLY);
-*/
- m_pComboBoxUpdateMode = new wxComboBox(this, IDC_COMPRESS_COMBO_UPDATE_MODE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
-
- wxStaticBoxSizer *pOptionsSizer = new wxStaticBoxSizer(new wxStaticBox(this,IDC_STATIC_COMPRESS_OPTIONS,_T("Options")),wxVERTICAL);
- wxCheckBox *m_pCheckBoxSFXArchive = new wxCheckBox(this, IDC_COMPRESS_SFX, wxT("Create SF&X archive"));
- pOptionsSizer->Add(m_pCheckBoxSFXArchive, 1, wxALL|wxEXPAND, 5);
- wxCheckBox *m_pCheckBoxCompressSharedFiles = new wxCheckBox(this, IDC_COMPRESS_SHARED, wxT("Compress shared files"));
- m_pCheckBoxCompressSharedFiles->Show(false); // this option is useless undex Unix ...
- pOptionsSizer->Add(m_pCheckBoxCompressSharedFiles, 1, wxALL|wxEXPAND, 5);
-
- wxStaticBoxSizer * pEncryptSizer = new wxStaticBoxSizer(new wxStaticBox(this,IDC_COMPRESS_ENCRYPTION,_T("Encryption")),wxVERTICAL);
- wxStaticText *pStaticTextPassword = new wxStaticText(this, IDC_STATIC_COMPRESS_PASSWORD1, wxT("Enter password:"));
- m_pTextCtrlPassword = new wxTextCtrl(this, IDC_COMPRESS_EDIT_PASSWORD1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD);
- wxStaticText *pStaticTextRePassword = new wxStaticText(this, IDC_STATIC_COMPRESS_PASSWORD2, wxT("Re-enter password:"));
- m_pTextCtrlRePassword = new wxTextCtrl(this, IDC_COMPRESS_EDIT_PASSWORD2, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD);
- m_pCheckBoxShowPassword = new wxCheckBox(this, IDC_COMPRESS_CHECK_SHOW_PASSWORD, wxT("Show Password"));
- wxBoxSizer *pEncryptionMethodSizer = new wxBoxSizer(wxHORIZONTAL);
- wxStaticText *pStaticTextEncryptionMethod = new wxStaticText(this, IDC_STATIC_COMPRESS_ENCRYPTION_METHOD, wxT("&Encryption method:"));
-/*
- wxArrayString encryptionMethodArray;
- encryptionMethodArray.Add(wxT("AES-256"));
- m_pComboBoxEncryptionMethod =new wxComboBox(this, IDC_COMPRESS_COMBO_ENCRYPTION_METHOD, encryptionMethodArray.Item(0), wxDefaultPosition, wxDefaultSize, encryptionMethodArray, wxCB_READONLY);
-*/
- m_pComboBoxEncryptionMethod =new wxComboBox(this, IDC_COMPRESS_COMBO_ENCRYPTION_METHOD, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);
-
- pEncryptionMethodSizer->Add(pStaticTextEncryptionMethod, 1, wxALL|wxEXPAND, 5);
- pEncryptionMethodSizer->Add(m_pComboBoxEncryptionMethod, 1, wxALL|wxEXPAND, 5);
- m_pCheckBoxEncryptFileNames = new wxCheckBox(this, IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, wxT("Encrypt file &names"));
- pEncryptSizer->Add(pStaticTextPassword, 0, wxALL|wxEXPAND, 5);
- pEncryptSizer->Add(m_pTextCtrlPassword, 0, wxLEFT|wxRIGHT|wxEXPAND, 5);
- pEncryptSizer->Add(pStaticTextRePassword, 0, wxALL|wxEXPAND, 5);
- pEncryptSizer->Add(m_pTextCtrlRePassword, 0, wxLEFT|wxRIGHT|wxBOTTOM|wxEXPAND, 5);
- pEncryptSizer->Add(m_pCheckBoxShowPassword, 0, wxALL|wxEXPAND, 5);
- pEncryptSizer->Add(pEncryptionMethodSizer, 0, wxLEFT|wxRIGHT|wxEXPAND, 0);
- pEncryptSizer->Add(m_pCheckBoxEncryptFileNames, 0, wxALL|wxEXPAND, 5);
-
- pRightSizer->Add(pStaticTextUpdateMode, 0, wxALL|wxEXPAND, 5);
- pRightSizer->Add(m_pComboBoxUpdateMode, 0, wxALL|wxEXPAND, 5);
- pRightSizer->Add(pOptionsSizer, 1, wxALL|wxEXPAND, 5);
- pRightSizer->Add(pEncryptSizer, 0, wxALL|wxEXPAND, 5);
-
- pControlSizer->Add(pLeftSizer, 1, wxALL|wxEXPAND, 5);
- pControlSizer->Add(pRightSizer, 1, wxALL|wxEXPAND, 5);
- wxStaticText *pStaticTextParameters = new wxStaticText(this, IDC_STATIC_COMPRESS_PARAMETERS, wxT("&Parameters:"));
- m_pTextCtrlParameters = new wxTextCtrl(this, IDC_COMPRESS_EDIT_PARAMETERS, wxEmptyString);
- topsizer->Add(pStaticTextArchive, 0, wxLEFT | wxRIGHT | wxTOP |wxEXPAND, 10);
- topsizer->Add(pArchiveNameSizer, 1, wxLEFT | wxRIGHT |wxEXPAND, 5);
- topsizer->Add(pControlSizer, 0, wxALL|wxEXPAND, 5);
- topsizer->Add(pStaticTextParameters, 0, wxLEFT | wxRIGHT | wxBOTTOM |wxEXPAND, 10);
- topsizer->Add(m_pTextCtrlParameters, 0, wxLEFT | wxRIGHT |wxEXPAND, 10);
- topsizer->Add(CreateButtonSizer(wxOK | wxCANCEL | wxHELP), 0, wxALL|wxEXPAND, 10);
-
- this->OnInit();
-
- SetSizer(topsizer); // use the sizer for layout
- topsizer->SetSizeHints(this); // set size hints to honour minimum size
- }
-private:
- // Any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-REGISTER_DIALOG(IDD_DIALOG_COMPRESS,CCompressDialog,0)
-
-BEGIN_EVENT_TABLE(CCompressDialogImpl, wxDialog)
- EVT_BUTTON(wxID_ANY, CModalDialogImpl::OnAnyButton)
- EVT_CHECKBOX(wxID_ANY, CModalDialogImpl::OnAnyButton)
- EVT_COMBOBOX(wxID_ANY, CModalDialogImpl::OnAnyChoice)
-END_EVENT_TABLE()
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialog.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialog.cpp
deleted file mode 100644
index 6b3887006..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialog.cpp
+++ /dev/null
@@ -1,374 +0,0 @@
-// ExtractDialog.cpp
-
-#include "StdAfx.h"
-
-// #include <HtmlHelp.h>
-
-#include "ExtractDialog.h"
-
-#include "Common/StringConvert.h"
-#include "Windows/Shell.h"
-#include "Windows/FileName.h"
-#include "Windows/FileDir.h"
-#include "Windows/ResourceString.h"
-
-#ifndef NO_REGISTRY
-#include "../FileManager/HelpUtils.h"
-#endif
-
-#include "../Common/ZipRegistry.h"
-
-#include "../FileManager/LangUtils.h"
-
-#include "ExtractRes.h"
-#include "ExtractDialogRes.h"
-
-// #include "Help/Context/Extract.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NName;
-
-static const int kPathModeButtons[] =
-{
- IDC_EXTRACT_RADIO_FULL_PATHNAMES,
- IDC_EXTRACT_RADIO_CURRENT_PATHNAMES,
- IDC_EXTRACT_RADIO_NO_PATHNAMES
-};
-
-#ifndef _SFX
-
-static const NExtract::NPathMode::EEnum kPathModeButtonsVals[] =
-{
- NExtract::NPathMode::kFullPathnames,
- NExtract::NPathMode::kCurrentPathnames,
- NExtract::NPathMode::kNoPathnames
-};
-
-static const int kNumPathnamesButtons = sizeof(kPathModeButtons) / sizeof(kPathModeButtons[0]);
-
-static const int kOverwriteButtons[] =
-{
- IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE,
- IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT,
- IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES,
- IDC_EXTRACT_RADIO_AUTO_RENAME,
- IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING,
-};
-
-static const NExtract::NOverwriteMode::EEnum kOverwriteButtonsVals[] =
-{
- NExtract::NOverwriteMode::kAskBefore,
- NExtract::NOverwriteMode::kWithoutPrompt,
- NExtract::NOverwriteMode::kSkipExisting,
- NExtract::NOverwriteMode::kAutoRename,
- NExtract::NOverwriteMode::kAutoRenameExisting
-};
-
-static const int kNumOverwriteButtons = sizeof(kOverwriteButtons) / sizeof(kOverwriteButtons[0]);
-
-/*
-static const int kFilesButtons[] =
-{
- IDC_EXTRACT_RADIO_SELECTED_FILES,
- IDC_EXTRACT_RADIO_ALL_FILES
-};
-static const int kNumFilesButtons = sizeof(kFilesButtons) / sizeof(kFilesButtons[0]);
-*/
-
-void CExtractDialog::GetPathMode()
-{
- for (int i = 0; i < kNumPathnamesButtons; i++)
- if(IsButtonCheckedBool(kPathModeButtons[i]))
- {
- PathMode = kPathModeButtonsVals[i];
- return;
- }
- throw 1;
-}
-
-void CExtractDialog::SetPathMode()
-{
- for (int j = 0; j < 2; j++)
- {
- for (int i = 0; i < kNumPathnamesButtons; i++)
- if(PathMode == kPathModeButtonsVals[i])
- {
- CheckRadioButton(kPathModeButtons[0], kPathModeButtons[kNumPathnamesButtons - 1],
- kPathModeButtons[i]);
- return;
- }
- PathMode = kPathModeButtonsVals[0];
- }
- throw 1;
-}
-
-void CExtractDialog::GetOverwriteMode()
-{
- for (int i = 0; i < kNumOverwriteButtons; i++)
- if(IsButtonCheckedBool(kOverwriteButtons[i]))
- {
- OverwriteMode = kOverwriteButtonsVals[i];
- return;
- }
- throw 0;
-}
-
-void CExtractDialog::SetOverwriteMode()
-{
- for (int j = 0; j < 2; j++)
- {
- for (int i = 0; i < kNumOverwriteButtons; i++)
- if(OverwriteMode == kOverwriteButtonsVals[i])
- {
- CheckRadioButton(kOverwriteButtons[0], kOverwriteButtons[kNumOverwriteButtons - 1],
- kOverwriteButtons[i]);
- return;
- }
- OverwriteMode = kOverwriteButtonsVals[0];
- }
- throw 1;
-}
-
-/*
-int CExtractDialog::GetFilesMode() const
-{
- for (int i = 0; i < kNumFilesButtons; i++)
- if(IsButtonCheckedBool(kFilesButtons[i]))
- return i;
- throw 0;
-}
-*/
-
-#endif
-
-#ifdef LANG
-static CIDLangPair kIDLangPairs[] =
-{
- { IDC_STATIC_EXTRACT_EXTRACT_TO, 0x02000801 },
- { IDC_EXTRACT_PATH_MODE, 0x02000810 },
- { IDC_EXTRACT_RADIO_FULL_PATHNAMES, 0x02000811 },
- { IDC_EXTRACT_RADIO_CURRENT_PATHNAMES, 0x02000812 },
- { IDC_EXTRACT_RADIO_NO_PATHNAMES, 0x02000813 },
- { IDC_EXTRACT_OVERWRITE_MODE, 0x02000820 },
- { IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE, 0x02000821 },
- { IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT, 0x02000822 },
- { IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES, 0x02000823 },
- { IDC_EXTRACT_RADIO_AUTO_RENAME, 0x02000824 },
- { IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING, 0x02000825 },
- { IDC_EXTRACT_FILES, 0x02000830 },
- { IDC_EXTRACT_RADIO_SELECTED_FILES, 0x02000831 },
- { IDC_EXTRACT_RADIO_ALL_FILES, 0x02000832 },
- { IDC_EXTRACT_PASSWORD, 0x02000802 },
- { IDC_EXTRACT_CHECK_SHOW_PASSWORD, 0x02000B02 },
- { IDOK, 0x02000702 },
- { IDCANCEL, 0x02000710 },
- { IDHELP, 0x02000720 }
-
-};
-#endif
-
-// static const int kWildcardsButtonIndex = 2;
-
-#ifndef NO_REGISTRY
-static const int kHistorySize = 8;
-#endif
-
-bool CExtractDialog::OnInit()
-{
- #ifdef LANG
- LangSetWindowText(HWND(*this), 0x02000800);
- LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
- #endif
- #ifndef _SFX
- _passwordControl.Attach(GetItem(IDC_EXTRACT_EDIT_PASSWORD));
- _passwordControl.SetText(Password);
- _passwordControl.SetPasswordChar(TEXT('*'));
- #endif
-
- NExtract::CInfo extractionInfo;
-
- #ifdef NO_REGISTRY
- PathMode = NExtract::NPathMode::kFullPathnames;
- OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
- // extractionInfo.Paths = NExtract::NPathMode::kFullPathnames;
- #else
- ReadExtractionInfo(extractionInfo);
- CheckButton(IDC_EXTRACT_CHECK_SHOW_PASSWORD, extractionInfo.ShowPassword);
- UpdatePasswordControl();
- PathMode = extractionInfo.PathMode;
- OverwriteMode = extractionInfo.OverwriteMode;
- #endif
-
- _path.Attach(GetItem(IDC_EXTRACT_COMBO_PATH));
-
- _path.SetText(DirectoryPath);
-
- #ifndef NO_REGISTRY
- for(int i = 0; i < extractionInfo.Paths.Size() && i < kHistorySize; i++)
- _path.AddString(extractionInfo.Paths[i]);
- #endif
-
- /*
- if(extractionInfo.Paths.Size() > 0)
- _path.SetCurSel(0);
- else
- _path.SetCurSel(-1);
- */
-
-
-
- #ifndef _SFX
- SetPathMode();
- SetOverwriteMode();
-
- /*
- CheckRadioButton(kFilesButtons[0], kFilesButtons[kNumFilesButtons - 1],
- kFilesButtons[_filesMode]);
- */
-
- // CWindow selectedFilesWindow = GetItem(IDC_EXTRACT_RADIO_SELECTED_FILES);
- // selectedFilesWindow.Enable(_enableSelectedFilesButton);
-
-
- #endif
-
-
- // CWindow filesWindow = GetItem(IDC_EXTRACT_RADIO_FILES);
- // filesWindow.Enable(_enableFilesButton);
-
- // UpdateWildCardState();
- return CModalDialog::OnInit();
-}
-
-#ifndef _SFX
-void CExtractDialog::UpdatePasswordControl()
-{
- _passwordControl.SetPasswordChar((IsButtonChecked(
- IDC_EXTRACT_CHECK_SHOW_PASSWORD) == BST_CHECKED) ? 0: TEXT('*'));
- UString password;
- _passwordControl.GetText(password);
- _passwordControl.SetText(password);
-}
-#endif
-
-bool CExtractDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
-{
- /*
- for (int i = 0; i < kNumFilesButtons; i++)
- if (buttonID == kFilesButtons[i])
- {
- UpdateWildCardState();
- return true;
- }
- */
- switch(buttonID)
- {
- case IDC_EXTRACT_BUTTON_SET_PATH:
- OnButtonSetPath();
- return true;
- #ifndef _SFX
- case IDC_EXTRACT_CHECK_SHOW_PASSWORD:
- {
- UpdatePasswordControl();
- return true;
- }
- #endif
- }
- return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
-}
-
-void CExtractDialog::OnButtonSetPath()
-{
- UString currentPath;
- _path.GetText(currentPath);
- UString title = LangStringSpec(IDS_EXTRACT_SET_FOLDER, 0x02000881);
- UString resultPath;
- if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
- return;
- #ifndef NO_REGISTRY
- _path.SetCurSel(-1);
- #endif
- _path.SetText(resultPath);
-}
-
-void AddUniqueString(UStringVector &list, const UString &s)
-{
- for(int i = 0; i < list.Size(); i++)
- if (s.CompareNoCase(list[i]) == 0)
- return;
- list.Add(s);
-}
-
-void CExtractDialog::OnOK()
-{
- #ifndef _SFX
- GetPathMode();
- GetOverwriteMode();
- // _filesMode = (NExtractionDialog::NFilesMode::EEnum)GetFilesMode();
-
- _passwordControl.GetText(Password);
- #endif
-
- NExtract::CInfo extractionInfo;
- extractionInfo.PathMode = PathMode;
- extractionInfo.OverwriteMode = OverwriteMode;
- extractionInfo.ShowPassword = (IsButtonChecked(
- IDC_EXTRACT_CHECK_SHOW_PASSWORD) == BST_CHECKED);
-
- UString s;
-
- #ifdef NO_REGISTRY
-
- _path.GetText(s);
-
- #else
-
- int currentItem = _path.GetCurSel();
- if(currentItem == CB_ERR)
- {
- _path.GetText(s);
- if(_path.GetCount() >= kHistorySize)
- currentItem = _path.GetCount() - 1;
- }
- else
- _path.GetLBText(currentItem, s);
-
- #endif
-
- s.Trim();
- #ifndef _SFX
- AddUniqueString(extractionInfo.Paths, s);
- #endif
- DirectoryPath = s;
- #ifndef NO_REGISTRY
- for(int i = 0; i < _path.GetCount(); i++)
- if(i != currentItem)
- {
- UString sTemp;
- _path.GetLBText(i, sTemp);
- sTemp.Trim();
- AddUniqueString(extractionInfo.Paths, sTemp);
- }
- SaveExtractionInfo(extractionInfo);
- #endif
- CModalDialog::OnOK();
-}
-
-/*
-void CExtractDialog::UpdateWildCardState()
-{
- // UpdateData(TRUE);
- // m_Wildcards.EnableWindow(BoolToBOOL(m_Files == kWildcardsButtonIndex));
-}
-*/
-
-#ifndef NO_REGISTRY
-static LPCWSTR kHelpTopic = L"fm/plugins/7-zip/extract.htm";
-void CExtractDialog::OnHelp()
-{
- ShowHelpWindow(NULL, kHelpTopic);
- CModalDialog::OnHelp();
-}
-#endif
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialog.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialog.h
deleted file mode 100644
index 6ac82f740..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialog.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// ExtractDialog.h
-
-#ifndef __EXTRACTDIALOG_H
-#define __EXTRACTDIALOG_H
-
-#include "ExtractDialogRes.h"
-
-#include "Windows/Control/Dialog.h"
-#include "Windows/Control/Edit.h"
-#include "Windows/Control/ComboBox.h"
-
-#ifndef NO_REGISTRY
-#include "../Common/ZipRegistry.h"
-#endif
-#include "../Common/ExtractMode.h"
-
-namespace NExtractionDialog
-{
- /*
- namespace NFilesMode
- {
- enum EEnum
- {
- kSelected,
- kAll,
- kSpecified
- };
- }
- */
-}
-
-class CExtractDialog: public NWindows::NControl::CModalDialog
-{
- #ifdef NO_REGISTRY
- NWindows::NControl::CDialogChildControl _path;
- #else
- NWindows::NControl::CComboBox _path;
- #endif
-
- #ifndef _SFX
- NWindows::NControl::CEdit _passwordControl;
- #endif
-
- #ifndef _SFX
- void GetPathMode();
- void SetPathMode();
- void GetOverwriteMode();
- void SetOverwriteMode();
- // int GetFilesMode() const;
- void UpdatePasswordControl();
- #endif
-
- void OnButtonSetPath();
-
- virtual bool OnInit();
- virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
- virtual void OnOK();
- #ifndef NO_REGISTRY
- virtual void OnHelp();
- #endif
-public:
- // bool _enableSelectedFilesButton;
- // bool _enableFilesButton;
- // NExtractionDialog::NFilesMode::EEnum FilesMode;
-
- UString DirectoryPath;
- #ifndef _SFX
- UString Password;
- #endif
- NExtract::NPathMode::EEnum PathMode;
- NExtract::NOverwriteMode::EEnum OverwriteMode;
-
- INT_PTR Create(HWND aWndParent = 0)
- { return CModalDialog::Create(IDD_DIALOG_EXTRACT, aWndParent); }
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialogRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialogRes.h
deleted file mode 100644
index bc45ed239..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialogRes.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#define IDD_DIALOG_EXTRACT 137
-
-#define IDC_STATIC_EXTRACT_EXTRACT_TO 1020
-#define IDC_EXTRACT_COMBO_PATH 1021
-#define IDC_EXTRACT_BUTTON_SET_PATH 1022
-
-
-#define IDC_EXTRACT_PATH_MODE 1040
-#define IDC_EXTRACT_RADIO_FULL_PATHNAMES 1041
-#define IDC_EXTRACT_RADIO_CURRENT_PATHNAMES 1042
-#define IDC_EXTRACT_RADIO_NO_PATHNAMES 1043
-
-#define IDC_EXTRACT_OVERWRITE_MODE 1050
-#define IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE 1051
-#define IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT 1052
-#define IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES 1053
-#define IDC_EXTRACT_RADIO_SELECTED_FILES 1054
-#define IDC_EXTRACT_RADIO_ALL_FILES 1055
-#define IDC_EXTRACT_RADIO_AUTO_RENAME 1056
-#define IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING 1057
-
-
-#define IDC_EXTRACT_FILES 1060
-
-#define IDC_EXTRACT_PASSWORD 1100
-#define IDC_EXTRACT_EDIT_PASSWORD 1101
-#define IDC_EXTRACT_CHECK_SHOW_PASSWORD 1102
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialog_rc.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialog_rc.cpp
deleted file mode 100644
index 3e3b1c166..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractDialog_rc.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-// ExtractDialog.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#include "Windows/Control/DialogImpl.h"
-
-#include "ExtractRes.h"
-#include "ExtractDialogRes.h"
-
-/*
-IDD_DIALOG_EXTRACT DIALOG DISCARDABLE 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
-CAPTION "Extract"
-MY_FONT
-BEGIN
- LTEXT "E&xtract to:", IDC_STATIC_EXTRACT_EXTRACT_TO, marg, marg, xSize2, 8
-
- COMBOBOX IDC_EXTRACT_COMBO_PATH, marg, 21, xSize2 - bDotsSize - 13, 126, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
-
- PUSHBUTTON "...", IDC_EXTRACT_BUTTON_SET_PATH, xSize - marg - bDotsSize, 20, bDotsSize, bYSize, WS_GROUP
-
- GROUPBOX "Path mode",IDC_EXTRACT_PATH_MODE, marg, 44, g1XSize, 57
- CONTROL "Full pathnames", IDC_EXTRACT_RADIO_FULL_PATHNAMES,"Button", BS_AUTORADIOBUTTON | WS_GROUP,
- g1XPos2, 57, g1XSize2, 10
- CONTROL "Current pathnames",IDC_EXTRACT_RADIO_CURRENT_PATHNAMES, "Button", BS_AUTORADIOBUTTON,
- g1XPos2, 71, g1XSize2, 10
- CONTROL "No pathnames", IDC_EXTRACT_RADIO_NO_PATHNAMES, "Button", BS_AUTORADIOBUTTON,
- g1XPos2, 85, g1XSize2, 10
-
- GROUPBOX "Overwrite mode",IDC_EXTRACT_OVERWRITE_MODE, g2XPos, 44, g2XSize, 88, WS_GROUP
- CONTROL "Ask before overwrite", IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE, "Button", BS_AUTORADIOBUTTON | WS_GROUP,
- g2XPos2, 57, g2XSize2, 10
- CONTROL "Overwrite without prompt", IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT, "Button", BS_AUTORADIOBUTTON,
- g2XPos2, 71, g2XSize2, 10
- CONTROL "Skip existing files", IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES, "Button", BS_AUTORADIOBUTTON,
- g2XPos2, 85, g2XSize2, 10
- CONTROL "Auto rename", IDC_EXTRACT_RADIO_AUTO_RENAME, "Button", BS_AUTORADIOBUTTON,
- g2XPos2, 99, g2XSize2, 10
- CONTROL "Auto rename existing files", IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING, "Button", BS_AUTORADIOBUTTON,
- g2XPos2,113, g2XSize2, 10
-
- GROUPBOX "Files",IDC_EXTRACT_FILES, marg, 140, 127, 48, NOT WS_VISIBLE | WS_DISABLED | WS_GROUP
- CONTROL "&Selected files",IDC_EXTRACT_RADIO_SELECTED_FILES, "Button", BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED | WS_GROUP,
- g1XPos2, 153, g1XSize2, 10
- CONTROL "&All files",IDC_EXTRACT_RADIO_ALL_FILES, "Button", BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED,
- g1XPos2, 166, g1XSize2, 10
-
- GROUPBOX "Password",IDC_EXTRACT_PASSWORD, g2XPos, 142, g2XSize, 46
- EDITTEXT IDC_EXTRACT_EDIT_PASSWORD,154,153,130,14, ES_PASSWORD | ES_AUTOHSCROLL
- CONTROL "Show Password",IDC_EXTRACT_CHECK_SHOW_PASSWORD,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
- g2XPos2, 172, g2XSize2, 10
-
- DEFPUSHBUTTON "OK", IDOK, bXPos3, bYPos, bXSize, bYSize, WS_GROUP
- PUSHBUTTON "Cancel", IDCANCEL, bXPos2, bYPos, bXSize, bYSize
- PUSHBUTTON "Help", IDHELP, bXPos1, bYPos, bXSize, bYSize
-END
-*/
-
-
-class CExtractDialogImpl : public NWindows::NControl::CModalDialogImpl
-{
- public:
- CExtractDialogImpl(NWindows::NControl::CModalDialog *dialog,wxWindow * parent , int id) : CModalDialogImpl(dialog,parent, id, wxT("Extract"))
- {
- wxStaticText *m_pStaticTextExtractTo;
- wxTextCtrl *m_pTextCtrlPassword;
- wxButton *m_pButtonBrowse;
- wxComboBox *m_pComboBoxExtractTo;
- wxCheckBox *m_pCheckBoxShowPassword;
-
-
- ///Sizer for adding the controls created by users
- wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
-
- wxArrayString pathArray;
- m_pStaticTextExtractTo = new wxStaticText(this, IDC_STATIC_EXTRACT_EXTRACT_TO, wxT("E&xtract To:"));
- wxBoxSizer *pPathSizer = new wxBoxSizer(wxHORIZONTAL);
- m_pComboBoxExtractTo = new wxComboBox(this, IDC_EXTRACT_COMBO_PATH, wxEmptyString, wxDefaultPosition, wxDefaultSize, pathArray, wxCB_DROPDOWN|wxCB_SORT);
- m_pButtonBrowse = new wxButton(this, IDC_EXTRACT_BUTTON_SET_PATH, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
- pPathSizer->Add(m_pComboBoxExtractTo, 1, wxLEFT|wxRIGHT|wxEXPAND, 5);
- pPathSizer->Add(m_pButtonBrowse, 0, wxLEFT|wxRIGHT|wxEXPAND, 5);
-
- wxBoxSizer *pControlSizer = new wxBoxSizer(wxHORIZONTAL);
-
- wxStaticBoxSizer * grpPathMode = new wxStaticBoxSizer(new wxStaticBox(this,IDC_EXTRACT_PATH_MODE,_T("Path mode")),wxVERTICAL);
- grpPathMode->Add(new wxRadioButton(this, IDC_EXTRACT_RADIO_FULL_PATHNAMES, wxT("Full pathnames"),wxDefaultPosition, wxDefaultSize, wxRB_GROUP ) , 0 );
- grpPathMode->Add(new wxRadioButton(this, IDC_EXTRACT_RADIO_CURRENT_PATHNAMES, wxT("Current pathnames"),wxDefaultPosition, wxDefaultSize) , 0 );
- grpPathMode->Add(new wxRadioButton(this, IDC_EXTRACT_RADIO_NO_PATHNAMES, wxT("no pathnames"),wxDefaultPosition, wxDefaultSize) , 0 );
-
- wxBoxSizer *pRightSizer = new wxBoxSizer(wxVERTICAL);
-
- wxStaticBoxSizer * grpOverWriteMode = new wxStaticBoxSizer(new wxStaticBox(this,IDC_EXTRACT_OVERWRITE_MODE,wxT("Overwrite mode")),wxVERTICAL);
- grpOverWriteMode->Add(new wxRadioButton(this, IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE, wxT("Ask before overwrite"),wxDefaultPosition, wxDefaultSize, wxRB_GROUP) , 1 );
- grpOverWriteMode->Add(new wxRadioButton(this, IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT, wxT("Overwrite without prompt"),wxDefaultPosition, wxDefaultSize) , 1 );
- grpOverWriteMode->Add(new wxRadioButton(this, IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES, wxT("Skip existing files"),wxDefaultPosition, wxDefaultSize) , 1 );
- grpOverWriteMode->Add(new wxRadioButton(this, IDC_EXTRACT_RADIO_AUTO_RENAME, wxT("Auto rename"),wxDefaultPosition, wxDefaultSize) , 1 );
- grpOverWriteMode->Add(new wxRadioButton(this, IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING, wxT("Auto rename existing files"),wxDefaultPosition, wxDefaultSize) , 1 );
-
- wxStaticBoxSizer *pPasswordSizer = new wxStaticBoxSizer(new wxStaticBox(this,IDC_EXTRACT_PASSWORD,wxT("Password mode")),wxVERTICAL);
-
- m_pTextCtrlPassword = new wxTextCtrl(this, IDC_EXTRACT_EDIT_PASSWORD, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD);
- m_pCheckBoxShowPassword = new wxCheckBox(this, IDC_EXTRACT_CHECK_SHOW_PASSWORD, wxT("Show Password"));
- pPasswordSizer->Add(m_pTextCtrlPassword, 0, wxALL|wxEXPAND, 5);
- pPasswordSizer->Add(m_pCheckBoxShowPassword, 0, wxALL|wxEXPAND, 5);
-
- pRightSizer->Add(grpOverWriteMode, 1, wxALL|wxEXPAND, 5);
- pRightSizer->Add(pPasswordSizer, 0, wxALL|wxEXPAND, 5);
-
- pControlSizer->Add(grpPathMode, 1, wxALL|wxEXPAND, 5);
- pControlSizer->Add(pRightSizer, 1, wxLEFT | wxRIGHT | wxEXPAND, 5);
-
- topsizer->Add(m_pStaticTextExtractTo, 0, wxALL | wxEXPAND , 10);
- topsizer->Add(pPathSizer, 0, wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND , 5);
- topsizer->Add(pControlSizer, 1, wxALL | wxEXPAND , 5);
- topsizer->Add(CreateButtonSizer(wxOK | wxCANCEL | wxHELP), 0, wxALL | wxEXPAND , 5);
-
- this->OnInit();
-
- SetSizer(topsizer); // use the sizer for layout
- topsizer->SetSizeHints(this); // set size hints to honour minimum size
- }
-private:
- // Any class wishing to process wxWindows events must use this macro
- DECLARE_EVENT_TABLE()
-};
-
-REGISTER_DIALOG(IDD_DIALOG_EXTRACT,CExtractDialog,0)
-
-BEGIN_EVENT_TABLE(CExtractDialogImpl, wxDialog)
- EVT_BUTTON(wxID_ANY, CModalDialogImpl::OnAnyButton)
- EVT_CHECKBOX(wxID_ANY, CModalDialogImpl::OnAnyButton)
-END_EVENT_TABLE()
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractGUI.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractGUI.cpp
deleted file mode 100644
index 2f3663b0d..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractGUI.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-// ExtractGUI.cpp
-
-#include "StdAfx.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/Error.h"
-#include "Windows/FileDir.h"
-#include "Windows/FileFind.h"
-#include "Windows/Thread.h"
-
-#include "../FileManager/ExtractCallback.h"
-#include "../FileManager/FormatUtils.h"
-#include "../FileManager/LangUtils.h"
-
-#include "../Common/ArchiveExtractCallback.h"
-#include "../Common/PropIDUtils.h"
-
-#include "../Explorer/MyMessages.h"
-
-#include "resource.h"
-#include "ExtractRes.h"
-#include "ExtractDialog.h"
-#include "ExtractGUI.h"
-
-using namespace NWindows;
-
-static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
-
-struct CThreadExtracting
-{
- CCodecs *codecs;
- CExtractCallbackImp *ExtractCallbackSpec;
- CIntVector FormatIndices;
-
- UStringVector *ArchivePaths;
- UStringVector *ArchivePathsFull;
- const NWildcard::CCensorNode *WildcardCensor;
- const CExtractOptions *Options;
- CMyComPtr<IExtractCallbackUI> ExtractCallback;
- CDecompressStat Stat;
- UString ErrorMessage;
- HRESULT Result;
-
- DWORD Process()
- {
- ExtractCallbackSpec->ProgressDialog.WaitCreating();
- try
- {
- Result = DecompressArchives(
- codecs, FormatIndices,
- *ArchivePaths, *ArchivePathsFull,
- *WildcardCensor, *Options, ExtractCallbackSpec, ExtractCallback, ErrorMessage, Stat);
- }
- catch(const UString &s)
- {
- ErrorMessage = s;
- Result = E_FAIL;
- }
- catch(const wchar_t *s)
- {
- ErrorMessage = s;
- Result = E_FAIL;
- }
- catch(const char *s)
- {
- ErrorMessage = GetUnicodeString(s);
- Result = E_FAIL;
- }
- catch(...)
- {
- Result = E_FAIL;
- }
- ExtractCallbackSpec->ProgressDialog.MyClose();
- return 0;
- }
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- return ((CThreadExtracting *)param)->Process();
- }
-};
-
-#ifndef _SFX
-
-static void AddValuePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
-{
- wchar_t sz[32];
- s += LangString(resourceID, langID);
- s += L" ";
- ConvertUInt64ToString(value, sz);
- s += sz;
- s += L"\n";
-}
-
-static void AddSizePair(UINT resourceID, UInt32 langID, UInt64 value, UString &s)
-{
- wchar_t sz[32];
- s += LangString(resourceID, langID);
- s += L" ";
- ConvertUInt64ToString(value, sz);
- s += sz;
- ConvertUInt64ToString(value >> 20, sz);
- s += L" (";
- s += sz;
- s += L" MB)";
- s += L"\n";
-}
-
-#endif
-
-HRESULT ExtractGUI(
- CCodecs *codecs,
- const CIntVector &formatIndices,
- UStringVector &archivePaths,
- UStringVector &archivePathsFull,
- const NWildcard::CCensorNode &wildcardCensor,
- CExtractOptions &options,
- bool showDialog,
- CExtractCallbackImp *extractCallback)
-{
- CThreadExtracting extracter;
- extracter.codecs = codecs;
- extracter.FormatIndices = formatIndices;
-
- if (!options.TestMode)
- {
- UString outputDir = options.OutputDir;
- if (outputDir.IsEmpty())
- NFile::NDirectory::MyGetCurrentDirectory(outputDir);
- if (showDialog)
- {
- CExtractDialog dialog;
- if (!NFile::NDirectory::MyGetFullPathName(outputDir, dialog.DirectoryPath))
- {
- ShowErrorMessage(kIncorrectOutDir);
- return E_FAIL;
- }
- NFile::NName::NormalizeDirPathPrefix(dialog.DirectoryPath);
-#ifndef _WIN32
- {
- extern const TCHAR * nameWindowToUnix(const TCHAR * lpFileName);
- UString tmpDirectoryPath = dialog.DirectoryPath;
- dialog.DirectoryPath = nameWindowToUnix(tmpDirectoryPath);
- }
-#endif
-
-
- // dialog.OverwriteMode = options.OverwriteMode;
- // dialog.PathMode = options.PathMode;
-
- if(dialog.Create(0) != IDOK)
- return E_ABORT;
- outputDir = dialog.DirectoryPath;
- options.OverwriteMode = dialog.OverwriteMode;
- options.PathMode = dialog.PathMode;
- #ifndef _SFX
- extractCallback->Password = dialog.Password;
- extractCallback->PasswordIsDefined = !dialog.Password.IsEmpty();
- #endif
- }
- if (!NFile::NDirectory::MyGetFullPathName(outputDir, options.OutputDir))
- {
- ShowErrorMessage(kIncorrectOutDir);
- return E_FAIL;
- }
- NFile::NName::NormalizeDirPathPrefix(options.OutputDir);
-
- /*
- if(!NFile::NDirectory::CreateComplexDirectory(options.OutputDir))
- {
- UString s = GetUnicodeString(NError::MyFormatMessage(GetLastError()));
- UString s2 = MyFormatNew(IDS_CANNOT_CREATE_FOLDER,
- #ifdef LANG
- 0x02000603,
- #endif
- options.OutputDir);
- MyMessageBox(s2 + UString(L"\n") + s);
- return E_FAIL;
- }
- */
- }
-
- UString title = LangStringSpec(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING,
- options.TestMode ? 0x02000F90: 0x02000890);
-
- extracter.ExtractCallbackSpec = extractCallback;
- extracter.ExtractCallback = extractCallback;
- extracter.ExtractCallbackSpec->Init();
-
- extracter.ArchivePaths = &archivePaths;
- extracter.ArchivePathsFull = &archivePathsFull;
- extracter.WildcardCensor = &wildcardCensor;
- extracter.Options = &options;
-
- NWindows::CThread thread;
- RINOK(thread.Create(CThreadExtracting::MyThreadFunction, &extracter));
- extracter.ExtractCallbackSpec->StartProgressDialog(title);
- if (extracter.Result == S_OK && options.TestMode &&
- extracter.ExtractCallbackSpec->Messages.IsEmpty() &&
- extracter.ExtractCallbackSpec->NumArchiveErrors == 0)
- {
- #ifndef _SFX
- UString s;
- AddValuePair(IDS_ARCHIVES_COLON, 0x02000324, extracter.Stat.NumArchives, s);
- AddValuePair(IDS_FOLDERS_COLON, 0x02000321, extracter.Stat.NumFolders, s);
- AddValuePair(IDS_FILES_COLON, 0x02000320, extracter.Stat.NumFiles, s);
- AddSizePair(IDS_SIZE_COLON, 0x02000322, extracter.Stat.UnpackSize, s);
- AddSizePair(IDS_COMPRESSED_COLON, 0x02000323, extracter.Stat.PackSize, s);
-
- if (options.CalcCrc)
- {
- wchar_t temp[16];
- ConvertUInt32ToHex(extracter.Stat.CrcSum, temp);
- s += L"CRC: ";
- s += temp;
- s += L"\n";
- }
-
- s += L"\n";
- s += LangString(IDS_MESSAGE_NO_ERRORS, 0x02000608);
-
- MessageBoxW(0, s, LangString(IDS_PROGRESS_TESTING, 0x02000F90), 0);
- #endif
- }
- if (extracter.Result != S_OK)
- if (!extracter.ErrorMessage.IsEmpty())
- throw extracter.ErrorMessage;
- return extracter.Result;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractGUI.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractGUI.h
deleted file mode 100644
index ffefabfe0..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractGUI.h
+++ /dev/null
@@ -1,20 +0,0 @@
-// GUI/ExtractGUI.h
-
-#ifndef __EXTRACT_GUI_H
-#define __EXTRACT_GUI_H
-
-#include "../Common/Extract.h"
-
-#include "../FileManager/ExtractCallback.h"
-
-HRESULT ExtractGUI(
- CCodecs *codecs,
- const CIntVector &formatIndices,
- UStringVector &archivePaths,
- UStringVector &archivePathsFull,
- const NWildcard::CCensorNode &wildcardCensor,
- CExtractOptions &options,
- bool showDialog,
- CExtractCallbackImp *extractCallback);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractRes.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractRes.h
deleted file mode 100644
index 084181ea4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/ExtractRes.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#define IDS_UPDATE_NOT_SUPPORTED 199
-#define IDS_CANNOT_CREATE_FOLDER 200
-#define IDS_OPEN_IS_NOT_SUPORTED_ARCHIVE 201
-
-#define IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC 202
-#define IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR 203
-#define IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_UNSUPPORTED_METHOD 204
-#define IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC_ENCRYPTED 205
-#define IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED 206
-
-#define IDS_EXTRACT_SET_FOLDER 207
-#define IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CANNOT_OPEN_FILE 208
-#define IDS_PROGRESS_EXTRACTING 209
-
-#define IDS_CANT_OPEN_ARCHIVE 103
-#define IDS_CANT_OPEN_ENCRYPTED_ARCHIVE 104
-#define IDS_MEM_ERROR 105
-#define IDS_UNKNOWN_ERROR 106
-#define IDS_UNSUPPORTED_ARCHIVE_TYPE 107
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/GUI.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/GUI.cpp
deleted file mode 100644
index d01e958b3..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/GUI.cpp
+++ /dev/null
@@ -1,294 +0,0 @@
-// GUI.cpp
-
-#include "StdAfx.h"
-
-#include <initguid.h>
-
-#include "../../../../C/Alloc.h"
-
-#include "Common/CommandLineParser.h"
-#include "Common/MyException.h"
-#include "Common/NewHandler.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/Error.h"
-#ifdef _WIN32
-#include "Windows/MemoryLock.h"
-#endif
-
-#include "../Common/ArchiveCommandLine.h"
-#include "../Common/ExitCode.h"
-
-#include "../FileManager/StringUtils.h"
-
-#include "BenchmarkDialog.h"
-#include "ExtractGUI.h"
-#include "UpdateGUI.h"
-
-#include "ExtractRes.h"
-
-using namespace NWindows;
-
-HINSTANCE g_hInstance;
-#ifndef _UNICODE
-bool g_IsNT = false;
-#endif
-
-static void ErrorMessage(LPCWSTR message)
-{
- MessageBoxW(NULL, message, L"7-Zip", MB_ICONERROR | MB_OK);
-}
-
-static void ErrorLangMessage(UINT resourceID, UInt32 langID)
-{
- ErrorMessage(LangString(resourceID, langID));
-}
-
-static const char *kNoFormats = "7-Zip cannot find the code that works with archives.";
-
-static int ShowMemErrorMessage()
-{
- ErrorLangMessage(IDS_MEM_ERROR, 0x0200060B);
- return NExitCode::kMemoryError;
-}
-
-static int ShowSysErrorMessage(DWORD errorCode)
-{
- if (errorCode == E_OUTOFMEMORY)
- return ShowMemErrorMessage();
- ErrorMessage(NError::MyFormatMessageW(errorCode));
- return NExitCode::kFatalError;
-}
-
-int Main2(int argc,TCHAR **argv)
-{
- UStringVector commandStrings;
- #ifdef _WIN32
- NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
- #else
- extern void mySplitCommandLineW(int numArguments,TCHAR **arguments,UStringVector &parts);
- mySplitCommandLineW(argc,argv,commandStrings);
- #endif
-
- if (commandStrings.Size() <= 1)
- {
- MessageBoxW(0, L"Specify command", L"7-Zip", 0);
- return 0;
- }
- commandStrings.Delete(0);
-
- CArchiveCommandLineOptions options;
- CArchiveCommandLineParser parser;
-
- parser.Parse1(commandStrings, options);
- parser.Parse2(options);
-
- #ifdef _WIN32
- if (options.LargePages)
- NSecurity::EnableLockMemoryPrivilege();
- #endif
-
- CCodecs *codecs = new CCodecs;
- CMyComPtr<IUnknown> compressCodecsInfo = codecs;
- HRESULT result = codecs->Load();
- if (result != S_OK)
- throw CSystemException(result);
-
- bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
- if (codecs->Formats.Size() == 0 &&
- (isExtractGroupCommand ||
- options.Command.IsFromUpdateGroup()))
- throw kNoFormats;
-
- CIntVector formatIndices;
- if (!codecs->FindFormatForArchiveType(options.ArcType, formatIndices))
- {
- ErrorLangMessage(IDS_UNSUPPORTED_ARCHIVE_TYPE, 0x0200060D);
- return NExitCode::kFatalError;
- }
-
- if (options.Command.CommandType == NCommandType::kBenchmark)
- {
- HRESULT res = Benchmark(
- #ifdef EXTERNAL_LZMA
- codecs,
- #endif
- options.NumThreads, options.DictionarySize);
- if (res != S_OK)
- throw CSystemException(res);
- }
- else if (isExtractGroupCommand)
- {
- CExtractCallbackImp *ecs = new CExtractCallbackImp;
- CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
- ecs->ProgressDialog.CompressingMode = false;
-
- #ifndef _NO_CRYPTO
- ecs->PasswordIsDefined = options.PasswordEnabled;
- ecs->Password = options.Password;
- #endif
-
- ecs->Init();
-
- CExtractOptions eo;
- eo.StdOutMode = options.StdOutMode;
- eo.OutputDir = options.OutputDir;
- eo.YesToAll = options.YesToAll;
- eo.OverwriteMode = options.OverwriteMode;
- eo.PathMode = options.Command.GetPathMode();
- eo.TestMode = options.Command.IsTestMode();
- eo.CalcCrc = options.CalcCrc;
- #ifdef COMPRESS_MT
- eo.Properties = options.ExtractProperties;
- #endif
-
- HRESULT result = ExtractGUI(codecs, formatIndices,
- options.ArchivePathsSorted,
- options.ArchivePathsFullSorted,
- options.WildcardCensor.Pairs.Front().Head,
- eo, options.ShowDialog, ecs);
- if (result != S_OK)
- throw CSystemException(result);
- if (ecs->Messages.Size() > 0 || ecs->NumArchiveErrors != 0)
- return NExitCode::kFatalError;
- }
- else if (options.Command.IsFromUpdateGroup())
- {
- #ifndef _NO_CRYPTO
- bool passwordIsDefined = options.PasswordEnabled && !options.Password.IsEmpty();
- #endif
-
- CUpdateCallbackGUI callback;
- // callback.EnablePercents = options.EnablePercents;
-
- #ifndef _NO_CRYPTO
- callback.PasswordIsDefined = passwordIsDefined;
- callback.AskPassword = options.PasswordEnabled && options.Password.IsEmpty();
- callback.Password = options.Password;
- #endif
-
- // callback.StdOutMode = options.UpdateOptions.StdOutMode;
- callback.Init();
-
- CUpdateErrorInfo errorInfo;
-
- if (!options.UpdateOptions.Init(codecs, formatIndices, options.ArchiveName))
- {
- ErrorLangMessage(IDS_UPDATE_NOT_SUPPORTED, 0x02000601);
- return NExitCode::kFatalError;
- }
- HRESULT result = UpdateGUI(
- codecs,
- options.WildcardCensor, options.UpdateOptions,
- options.ShowDialog,
- errorInfo, &callback);
-
- if (result != S_OK)
- {
- if (!errorInfo.Message.IsEmpty())
- {
- ErrorMessage(errorInfo.Message);
- if (result == E_FAIL)
- return NExitCode::kFatalError;
- }
- throw CSystemException(result);
- }
- if (callback.FailedFiles.Size() > 0)
- return NExitCode::kWarning;
- }
- else
- {
- throw "Unsupported command";
- }
- return 0;
-}
-
-#ifdef _WIN32
-static bool inline IsItWindowsNT()
-{
- OSVERSIONINFO versionInfo;
- versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
- return false;
- return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-
-int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /* lpCmdLine */, int /* nCmdShow */)
-{
- g_hInstance = hInstance;
- #ifdef _UNICODE
- if (!IsItWindowsNT())
- {
- ErrorMessage(L"This program requires Windows NT/2000/2003/2008/XP/Vista");
- return NExitCode::kFatalError;
- }
- #else
- g_IsNT = IsItWindowsNT();
- #endif
-
- #ifdef _WIN32
- SetLargePageSize();
- #endif
-
- InitCommonControls();
-
- ReloadLang();
-
- // setlocale(LC_COLLATE, ".ACP");
- try
- {
- return Main2();
- }
-#else
-int Main1(int argc,TCHAR **argv)
-{
- ReloadLangSmart(); // ReloadLang();
-
- // setlocale(LC_COLLATE, ".ACP");
- try
- {
- return Main2(argc,argv);
- }
-#endif
- catch(const CNewException &)
- {
- return ShowMemErrorMessage();
- }
- catch(const CArchiveCommandLineException &e)
- {
- ErrorMessage(GetUnicodeString(e));
- return NExitCode::kUserError;
- }
- catch(const CSystemException &systemError)
- {
- if (systemError.ErrorCode == E_ABORT)
- return NExitCode::kUserBreak;
- return ShowSysErrorMessage(systemError.ErrorCode);
- }
- catch(const UString &s)
- {
- ErrorMessage(s);
- return NExitCode::kFatalError;
- }
- catch(const AString &s)
- {
- ErrorMessage(GetUnicodeString(s));
- return NExitCode::kFatalError;
- }
- catch(const wchar_t *s)
- {
- ErrorMessage(s);
- return NExitCode::kFatalError;
- }
- catch(const char *s)
- {
- ErrorMessage(GetUnicodeString(s));
- return NExitCode::kFatalError;
- }
- catch(...)
- {
- ErrorLangMessage(IDS_UNKNOWN_ERROR, 0x0200060C);
- return NExitCode::kFatalError;
- }
-}
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
deleted file mode 100644
index 07c74e9b5..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-// UpdateCallbackGUI.cpp
-
-#include "StdAfx.h"
-
-#include "Common/Defs.h"
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-
-#include "Windows/Error.h"
-#include "Windows/PropVariant.h"
-
-#include "../FileManager/MessagesDialog.h"
-#include "../FileManager/PasswordDialog.h"
-
-#include "UpdateCallbackGUI.h"
-
-using namespace NWindows;
-
-CUpdateCallbackGUI::~CUpdateCallbackGUI()
-{
- if (!Messages.IsEmpty())
- {
- CMessagesDialog messagesDialog;
- messagesDialog.Messages = &Messages;
- messagesDialog.Create(ParentWindow);
- }
-}
-
-void CUpdateCallbackGUI::Init()
-{
- FailedFiles.Clear();
- Messages.Clear();
- NumArchiveErrors = 0;
- NumFiles = 0;
-}
-
-void CUpdateCallbackGUI::AddErrorMessage(LPCWSTR message)
-{
- Messages.Add(message);
-}
-
-void CUpdateCallbackGUI::AddErrorMessage(const wchar_t *name, DWORD systemError)
-{
- AddErrorMessage(
- UString(L"WARNING: ") +
- NError::MyFormatMessageW(systemError) +
- UString(L": ") +
- UString(name));
-}
-
-HRESULT CUpdateCallbackGUI::OpenResult(const wchar_t *name, HRESULT result)
-{
- if (result != S_OK)
- {
- AddErrorMessage (UString(L"Error: ") + name +
- UString(L" is not supported archive"));
- }
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::StartScanning()
-{
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::CanNotFindError(const wchar_t *name, DWORD systemError)
-{
- FailedFiles.Add(name);
- AddErrorMessage(name, systemError);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::FinishScanning()
-{
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::StartArchive(const wchar_t *name, bool /* updating */)
-{
- ProgressDialog.ProgressSynch.SetTitleFileName(name);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::FinishArchive()
-{
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::CheckBreak()
-{
- return ProgressDialog.ProgressSynch.ProcessStopAndPause();
-}
-
-HRESULT CUpdateCallbackGUI::ScanProgress(UInt64 /* numFolders */, UInt64 numFiles, const wchar_t *path)
-{
- ProgressDialog.ProgressSynch.SetCurrentFileName(path);
- ProgressDialog.ProgressSynch.SetNumFilesTotal(numFiles);
- return ProgressDialog.ProgressSynch.ProcessStopAndPause();
-}
-
-HRESULT CUpdateCallbackGUI::Finilize()
-{
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::SetNumFiles(UInt64 numFiles)
-{
- ProgressDialog.ProgressSynch.SetNumFilesTotal(numFiles);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::SetTotal(UInt64 total)
-{
- ProgressDialog.ProgressSynch.SetProgress(total, 0);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::SetCompleted(const UInt64 *completeValue)
-{
- RINOK(CheckBreak());
- if (completeValue != NULL)
- ProgressDialog.ProgressSynch.SetPos(*completeValue);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
-{
- RINOK(CheckBreak());
- ProgressDialog.ProgressSynch.SetRatioInfo(inSize, outSize);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::GetStream(const wchar_t *name, bool /* isAnti */)
-{
- ProgressDialog.ProgressSynch.SetCurrentFileName(name);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::OpenFileError(const wchar_t *name, DWORD systemError)
-{
- FailedFiles.Add(name);
- // if (systemError == ERROR_SHARING_VIOLATION)
- {
- AddErrorMessage(name, systemError);
- return S_FALSE;
- }
- // return systemError;
-}
-
-HRESULT CUpdateCallbackGUI::SetOperationResult(Int32 /* operationResult */)
-{
- NumFiles++;
- ProgressDialog.ProgressSynch.SetNumFilesCur(NumFiles);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
-{
- *password = NULL;
- if (!PasswordIsDefined)
- {
- if (AskPassword)
- {
- CPasswordDialog dialog;
- if (dialog.Create(ProgressDialog) == IDCANCEL)
- return E_ABORT;
- Password = dialog.Password;
- PasswordIsDefined = true;
- }
- }
- *passwordIsDefined = BoolToInt(PasswordIsDefined);
- return StringToBstr(Password, password);
-}
-
-HRESULT CUpdateCallbackGUI::CryptoGetTextPassword(BSTR *password)
-{
- *password = NULL;
- if (!PasswordIsDefined)
- {
- CPasswordDialog dialog;
- if (dialog.Create(ProgressDialog) == IDCANCEL)
- return E_ABORT;
- Password = dialog.Password;
- PasswordIsDefined = true;
- }
- return StringToBstr(Password, password);
-}
-
-/*
-It doesn't work, since main stream waits Dialog
-HRESULT CUpdateCallbackGUI::CloseProgress()
-{
- ProgressDialog.MyClose();
- return S_OK;
-};
-*/
-
-
-HRESULT CUpdateCallbackGUI::Open_CheckBreak()
-{
- return ProgressDialog.ProgressSynch.ProcessStopAndPause();
-}
-
-HRESULT CUpdateCallbackGUI::Open_SetTotal(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
-{
- // if (numFiles != NULL) ProgressDialog.ProgressSynch.SetNumFilesTotal(*numFiles);
- return S_OK;
-}
-
-HRESULT CUpdateCallbackGUI::Open_SetCompleted(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
-{
- return ProgressDialog.ProgressSynch.ProcessStopAndPause();
-}
-
-#ifndef _NO_CRYPTO
-
-HRESULT CUpdateCallbackGUI::Open_CryptoGetTextPassword(BSTR *password)
-{
- PasswordWasAsked = true;
- if (!PasswordIsDefined)
- {
- CPasswordDialog dialog;
- if (dialog.Create(ProgressDialog) == IDCANCEL)
- return E_ABORT;
- Password = dialog.Password;
- PasswordIsDefined = true;
- }
- return StringToBstr(Password, password);
-}
-
-HRESULT CUpdateCallbackGUI::Open_GetPasswordIfAny(UString &password)
-{
- if (PasswordIsDefined)
- password = Password;
- return S_OK;
-}
-
-bool CUpdateCallbackGUI::Open_WasPasswordAsked()
-{
- return PasswordWasAsked;
-}
-
-void CUpdateCallbackGUI::Open_ClearPasswordWasAskedFlag()
-{
- PasswordWasAsked = false;
-}
-
-/*
-HRESULT CUpdateCallbackGUI::ShowDeleteFile(const wchar_t *name)
-{
- ProgressDialog.ProgressSynch.SetCurrentFileName(name);
- return S_OK;
-}
-*/
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateCallbackGUI.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateCallbackGUI.h
deleted file mode 100644
index 1f8b70e09..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateCallbackGUI.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// UpdateCallbackGUI.h
-
-#ifndef __UPDATE_CALLBACK_GUI_H
-#define __UPDATE_CALLBACK_GUI_H
-
-#include "../Common/Update.h"
-#include "../Common/ArchiveOpenCallback.h"
-#include "../FileManager/ProgressDialog2.h"
-
-class CUpdateCallbackGUI:
- public IOpenCallbackUI,
- public IUpdateCallbackUI2
-{
-public:
- // bool StdOutMode;
- bool PasswordIsDefined;
- UString Password;
- bool AskPassword;
- bool PasswordWasAsked;
- UInt64 NumFiles;
-
- CUpdateCallbackGUI():
- PasswordIsDefined(false),
- PasswordWasAsked(false),
- AskPassword(false),
- // StdOutMode(false)
- ParentWindow(0)
- {}
-
- ~CUpdateCallbackGUI();
- void Init();
-
- INTERFACE_IUpdateCallbackUI2(;)
- INTERFACE_IOpenCallbackUI(;)
-
- // HRESULT CloseProgress();
-
- UStringVector FailedFiles;
-
- CProgressDialog ProgressDialog;
- HWND ParentWindow;
- void StartProgressDialog(const UString &title)
- {
- ProgressDialog.Create(title, ParentWindow);
- }
-
- UStringVector Messages;
- int NumArchiveErrors;
- void AddErrorMessage(LPCWSTR message);
- void AddErrorMessage(const wchar_t *name, DWORD systemError);
-};
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateGUI.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateGUI.cpp
deleted file mode 100644
index 2d4dbbc2c..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateGUI.cpp
+++ /dev/null
@@ -1,389 +0,0 @@
-// UpdateGUI.cpp
-
-#include "StdAfx.h"
-
-#include "UpdateGUI.h"
-
-#include "Common/IntToString.h"
-#include "Common/StringConvert.h"
-#include "Common/StringToInt.h"
-
-#include "Windows/Error.h"
-#include "Windows/FileDir.h"
-#include "Windows/Thread.h"
-
-#include "../Common/WorkDir.h"
-
-#include "../Explorer/MyMessages.h"
-
-#include "../FileManager/StringUtils.h"
-
-#include "CompressDialog.h"
-#include "UpdateGUI.h"
-
-#include "resource.h"
-
-using namespace NWindows;
-using namespace NFile;
-
-static const wchar_t *kDefaultSfxModule = L"7z.sfx";
-static const wchar_t *kSFXExtension = L"exe";
-
-struct CThreadUpdating
-{
- CCodecs *codecs;
-
- CUpdateCallbackGUI *UpdateCallbackGUI;
- const NWildcard::CCensor *WildcardCensor;
- CUpdateOptions *Options;
-
- CUpdateErrorInfo *ErrorInfo;
- HRESULT Result;
-
- DWORD Process()
- {
- UpdateCallbackGUI->ProgressDialog.WaitCreating();
- try
- {
- Result = UpdateArchive(codecs, *WildcardCensor, *Options,
- *ErrorInfo, UpdateCallbackGUI, UpdateCallbackGUI);
- }
- catch(const UString &s)
- {
- ErrorInfo->Message = s;
- Result = E_FAIL;
- }
- catch(const wchar_t *s)
- {
- ErrorInfo->Message = s;
- Result = E_FAIL;
- }
- catch(const char *s)
- {
- ErrorInfo->Message = GetUnicodeString(s);
- Result = E_FAIL;
- }
- catch(...)
- {
- Result = E_FAIL;
- }
- UpdateCallbackGUI->ProgressDialog.MyClose();
- return 0;
- }
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- return ((CThreadUpdating *)param)->Process();
- }
-};
-
-static void AddProp(CObjectVector<CProperty> &properties, const UString &name, const UString &value)
-{
- CProperty prop;
- prop.Name = name;
- prop.Value = value;
- properties.Add(prop);
-}
-
-static void AddProp(CObjectVector<CProperty> &properties, const UString &name, UInt32 value)
-{
- wchar_t tmp[32];
- ConvertUInt64ToString(value, tmp);
- AddProp(properties, name, tmp);
-}
-
-static void AddProp(CObjectVector<CProperty> &properties, const UString &name, bool value)
-{
- AddProp(properties, name, value ? UString(L"on"): UString(L"off"));
-}
-
-static bool IsThereMethodOverride(bool is7z, const UString &propertiesString)
-{
- UStringVector strings;
- SplitString(propertiesString, strings);
- for (int i = 0; i < strings.Size(); i++)
- {
- const UString &s = strings[i];
- if (is7z)
- {
- const wchar_t *end;
- UInt64 n = ConvertStringToUInt64(s, &end);
- if (n == 0 && *end == L'=')
- return true;
- }
- else
- {
- if (s.Length() > 0)
- if (s[0] == L'm' && s[1] == L'=')
- return true;
- }
- }
- return false;
-}
-
-static void ParseAndAddPropertires(CObjectVector<CProperty> &properties,
- const UString &propertiesString)
-{
- UStringVector strings;
- SplitString(propertiesString, strings);
- for (int i = 0; i < strings.Size(); i++)
- {
- const UString &s = strings[i];
- CProperty property;
- int index = s.Find(L'=');
- if (index < 0)
- property.Name = s;
- else
- {
- property.Name = s.Left(index);
- property.Value = s.Mid(index + 1);
- }
- properties.Add(property);
- }
-}
-
-static UString GetNumInBytesString(UInt64 v)
-{
- wchar_t s[32];
- ConvertUInt64ToString(v, s);
- size_t len = wcslen(s);
- s[len++] = L'B';
- s[len] = L'\0';
- return s;
-}
-
-static void SetOutProperties(
- CObjectVector<CProperty> &properties,
- bool is7z,
- UInt32 level,
- bool setMethod,
- const UString &method,
- UInt32 dictionary,
- bool orderMode,
- UInt32 order,
- bool solidIsSpecified, UInt64 solidBlockSize,
- bool multiThreadIsAllowed, UInt32 numThreads,
- const UString &encryptionMethod,
- bool encryptHeadersIsAllowed, bool encryptHeaders,
- bool /* sfxMode */)
-{
- if (level != (UInt32)(Int32)-1)
- AddProp(properties, L"x", (UInt32)level);
- if (setMethod)
- {
- if (!method.IsEmpty())
- AddProp(properties, is7z ? L"0": L"m", method);
- if (dictionary != (UInt32)(Int32)-1)
- {
- UString name;
- if (is7z)
- name = L"0";
- if (orderMode)
- name += L"mem";
- else
- name += L"d";
- AddProp(properties, name, GetNumInBytesString(dictionary));
- }
- if (order != (UInt32)(Int32)-1)
- {
- UString name;
- if (is7z)
- name = L"0";
- if (orderMode)
- name += L"o";
- else
- name += L"fb";
- AddProp(properties, name, (UInt32)order);
- }
- }
-
- if (!encryptionMethod.IsEmpty())
- AddProp(properties, L"em", encryptionMethod);
-
- if (encryptHeadersIsAllowed)
- AddProp(properties, L"he", encryptHeaders);
- if (solidIsSpecified)
- AddProp(properties, L"s", GetNumInBytesString(solidBlockSize));
- if (multiThreadIsAllowed)
- AddProp(properties, L"mt", numThreads);
-}
-
-static HRESULT ShowDialog(
- CCodecs *codecs,
- const NWildcard::CCensor &censor,
- CUpdateOptions &options, CUpdateCallbackGUI *callback)
-{
- if (options.Commands.Size() != 1)
- throw "It must be one command";
- UString currentDirPrefix;
- {
- if (!NDirectory::MyGetCurrentDirectory(currentDirPrefix))
- return E_FAIL;
- NName::NormalizeDirPathPrefix(currentDirPrefix);
- }
-
- bool oneFile = false;
- NFind::CFileInfoW fileInfo;
- if (censor.Pairs.Size() > 0)
- {
- const NWildcard::CPair &pair = censor.Pairs[0];
- if (pair.Head.IncludeItems.Size() > 0)
- {
- const NWildcard::CItem &item = pair.Head.IncludeItems[0];
- if (item.ForFile)
- {
- UString name = pair.Prefix;
- for (int i = 0; i < item.PathParts.Size(); i++)
- {
- if (i > 0)
- name += WCHAR_PATH_SEPARATOR;
- name += item.PathParts[i];
- }
- if (fileInfo.Find(name))
- {
- if (censor.Pairs.Size() == 1 && pair.Head.IncludeItems.Size() == 1)
- oneFile = !fileInfo.IsDir();
- }
- }
- }
- }
-
- CCompressDialog dialog;
- NCompressDialog::CInfo &di = dialog.Info;
- for(int i = 0; i < codecs->Formats.Size(); i++)
- {
- const CArcInfoEx &ai = codecs->Formats[i];
- if (ai.UpdateEnabled && (oneFile || !ai.KeepName))
- dialog.m_ArchiverInfoList.Add(ai);
- }
- if(dialog.m_ArchiverInfoList.Size() == 0)
- {
- ShowErrorMessage(L"No Update Engines");
- return E_FAIL;
- }
-
- // di.ArchiveName = options.ArchivePath.GetFinalPath();
- di.ArchiveName = options.ArchivePath.GetPathWithoutExt();
- dialog.OriginalFileName = fileInfo.Name;
-
- di.CurrentDirPrefix = currentDirPrefix;
- di.SFXMode = options.SfxMode;
- di.OpenShareForWrite = options.OpenShareForWrite;
-
- if (callback->PasswordIsDefined)
- di.Password = callback->Password;
-
- di.KeepName = !oneFile;
-
- if(dialog.Create(0) != IDOK)
- return E_ABORT;
-
- options.VolumesSizes = di.VolumeSizes;
- /*
- if (di.VolumeSizeIsDefined)
- {
- MyMessageBox(L"Splitting to volumes is not supported");
- return E_FAIL;
- }
- */
-
- NUpdateArchive::CActionSet &actionSet = options.Commands.Front().ActionSet;
-
- switch(di.UpdateMode)
- {
- case NCompressDialog::NUpdateMode::kAdd:
- actionSet = NUpdateArchive::kAddActionSet;
- break;
- case NCompressDialog::NUpdateMode::kUpdate:
- actionSet = NUpdateArchive::kUpdateActionSet;
- break;
- case NCompressDialog::NUpdateMode::kFresh:
- actionSet = NUpdateArchive::kFreshActionSet;
- break;
- case NCompressDialog::NUpdateMode::kSynchronize:
- actionSet = NUpdateArchive::kSynchronizeActionSet;
- break;
- default:
- throw 1091756;
- }
- const CArcInfoEx &archiverInfo = dialog.m_ArchiverInfoList[di.ArchiverInfoIndex];
- callback->PasswordIsDefined = (!di.Password.IsEmpty());
- if (callback->PasswordIsDefined)
- callback->Password = di.Password;
-
- options.MethodMode.Properties.Clear();
-
- bool is7z = archiverInfo.Name.CompareNoCase(L"7z") == 0;
- bool methodOverride = IsThereMethodOverride(is7z, di.Options);
-
- SetOutProperties(
- options.MethodMode.Properties,
- is7z,
- di.Level,
- !methodOverride,
- di.Method,
- di.Dictionary,
- di.OrderMode, di.Order,
- di.SolidIsSpecified, di.SolidBlockSize,
- di.MultiThreadIsAllowed, di.NumThreads,
- di.EncryptionMethod,
- di.EncryptHeadersIsAllowed, di.EncryptHeaders,
- di.SFXMode);
-
- options.OpenShareForWrite = di.OpenShareForWrite;
- ParseAndAddPropertires(options.MethodMode.Properties, di.Options);
-
- if (di.SFXMode)
- options.SfxMode = true;
- options.MethodMode.FormatIndex = archiverInfo.FormatIndex;
-
- options.ArchivePath.VolExtension = archiverInfo.GetMainExt();
- if(di.SFXMode)
- options.ArchivePath.BaseExtension = kSFXExtension;
- else
- options.ArchivePath.BaseExtension = options.ArchivePath.VolExtension;
- options.ArchivePath.ParseFromPath(di.ArchiveName);
-
- NWorkDir::CInfo workDirInfo;
- ReadWorkDirInfo(workDirInfo);
- options.WorkingDir.Empty();
- if (workDirInfo.Mode != NWorkDir::NMode::kCurrent)
- {
- UString fullPath;
- NDirectory::MyGetFullPathName(di.ArchiveName, fullPath);
- options.WorkingDir = GetWorkDir(workDirInfo, fullPath);
- NDirectory::CreateComplexDirectory(options.WorkingDir);
- }
- return S_OK;
-}
-
-HRESULT UpdateGUI(
- CCodecs *codecs,
- const NWildcard::CCensor &censor,
- CUpdateOptions &options,
- bool showDialog,
- CUpdateErrorInfo &errorInfo,
- CUpdateCallbackGUI *callback)
-{
- if (showDialog)
- {
- RINOK(ShowDialog(codecs, censor, options, callback));
- }
- if (options.SfxMode && options.SfxModule.IsEmpty())
- options.SfxModule = kDefaultSfxModule;
-
- CThreadUpdating tu;
-
- tu.codecs = codecs;
-
- tu.UpdateCallbackGUI = callback;
- tu.UpdateCallbackGUI->Init();
-
- tu.WildcardCensor = &censor;
- tu.Options = &options;
- tu.ErrorInfo = &errorInfo;
-
- NWindows::CThread thread;
- RINOK(thread.Create(CThreadUpdating::MyThreadFunction, &tu))
- tu.UpdateCallbackGUI->StartProgressDialog(LangString(IDS_PROGRESS_COMPRESSING, 0x02000DC0));
- return tu.Result;
-}
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateGUI.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateGUI.h
deleted file mode 100644
index 112eff0ff..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/UpdateGUI.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// GUI/UpdateGUI.h
-
-#ifndef __UPDATE_GUI_H
-#define __UPDATE_GUI_H
-
-#include "../Common/Update.h"
-#include "UpdateCallbackGUI.h"
-
-#include "../FileManager/UpdateCallback100.h"
-
-HRESULT UpdateGUI(
- CCodecs *codecs,
- const NWildcard::CCensor &censor,
- CUpdateOptions &options,
- bool showDialog,
- CUpdateErrorInfo &errorInfo,
- CUpdateCallbackGUI *callback);
-
-#endif
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/resource.h b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/resource.h
deleted file mode 100644
index e154e035f..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/resource.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#define IDS_CONTEXT_EXTRACT 142
-#define IDS_CONTEXT_EXTRACT_HELP 143
-#define IDS_CONTEXT_COMPRESS 144
-#define IDS_CONTEXT_COMPRESS_HELP 145
-#define IDS_CONTEXT_OPEN 146
-#define IDS_CONTEXT_OPEN_HELP 147
-#define IDS_CONTEXT_TEST 148
-#define IDS_CONTEXT_TEST_HELP 149
-#define IDS_CONTEXT_CAPTION_HELP 150
-#define IDS_CONTEXT_POPUP_CAPTION 151
-#define IDS_OPEN_TYPE_ALL_FILES 80
-
-#define IDS_METHOD_STORE 81
-#define IDS_METHOD_NORMAL 82
-#define IDS_METHOD_MAXIMUM 83
-#define IDS_METHOD_FAST 84
-#define IDS_METHOD_FASTEST 85
-#define IDS_METHOD_ULTRA 86
-
-#define IDS_COMPRESS_NON_SOLID 88
-#define IDS_COMPRESS_SOLID 89
-
-#define IDS_COMPRESS_UPDATE_MODE_ADD 90
-#define IDS_COMPRESS_UPDATE_MODE_UPDATE 91
-#define IDS_COMPRESS_UPDATE_MODE_FRESH 92
-#define IDS_COMPRESS_UPDATE_MODE_SYNCHRONIZE 93
-
-#define IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE 94
-#define IDS_COMPRESS_INCORRECT_VOLUME_SIZE 95
-
-#define IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE 96
-#define IDS_CANT_UPDATE_ARCHIVE 97
-
-#define IDS_PROGRESS_COMPRESSING 98
-#define IDS_PROGRESS_TESTING 99
-#define IDS_ERROR 100
-#define IDS_MESSAGE_NO_ERRORS 101
-#define IDS_CONFIG_DIALOG_CAPTION 102
-
-#define IDS_PASSWORD_USE_ASCII 110
-#define IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH 111
-#define IDS_PASSWORD_IS_TOO_LONG 112
-
-#define IDS_FILES_COLON 2274
-#define IDS_FOLDERS_COLON 2275
-#define IDS_SIZE_COLON 2276
-#define IDS_COMPRESSED_COLON 2277
-#define IDS_ARCHIVES_COLON 2278
-
diff --git a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/wxGUI.cpp b/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/wxGUI.cpp
deleted file mode 100644
index 366bd40c4..000000000
--- a/installerbuilder/libinstaller/3rdparty/p7zip_9.04/unix/CPP/7zip/UI/GUI/wxGUI.cpp
+++ /dev/null
@@ -1,575 +0,0 @@
-// wxGUI.cpp
-
-#include "StdAfx.h"
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#define static const
-#include "../GUI/p7zip_32.xpm"
-#undef static
-
-#undef ACTIVATE_DIALOG_TESTS
-
-int Main1(int argc,TCHAR **argv);
-
-#include "Windows/Registry.h"
-using namespace NWindows;
-using namespace NRegistry;
-
-
-#include "Common/StringConvert.h"
-#include "Windows/FileDir.h"
-#include "Windows/Synchronization.h"
-
-#include "ExtractRes.h"
-#include "../Explorer/MyMessages.h"
-
-#include "ExtractGUI.h"
-#include "UpdateGUI.h"
-#include "BenchmarkDialog.h"
-#include "../FileManager/RegistryUtils.h"
-
-using namespace NWindows;
-using namespace NFile;
-
-#include "../FileManager/ProgramLocation.h"
-
-static LPCWSTR kHelpFileName = L"help/";
-
-void ShowHelpWindow(HWND hwnd, LPCWSTR topicFile)
-{
- UString path;
- if (!::GetProgramFolderPath(path))
- return;
- path += kHelpFileName;
- path += topicFile;
- printf("ShowHelpWindow(%p,%ls)=>%ls\n",hwnd,topicFile,(const wchar_t *)path);
- // HtmlHelp(hwnd, GetSystemString(path), HH_DISPLAY_TOPIC, NULL);
- wxString path2(path);
- wxLaunchDefaultBrowser(path2);
-}
-
-////////////////////////////// TRIES ///////////////////////////////////
-
-#ifdef ACTIVATE_DIALOG_TESTS
-static void ErrorMessage(const wchar_t *message)
-{
- MessageBox(0,message, wxT("7-Zip GUI"),wxICON_ERROR);
-}
-
-#include "../FileManager/PasswordDialog.h"
-#include "../FileManager/MessagesDialog.h"
-#include "../FileManager/OverwriteDialog.h"
-#include "Windows/Thread.h"
-
-void myErrorMsg(const wchar_t *message)
-{
- MessageBox(0,message, wxT("Message"),wxICON_ERROR);
-}
-
-void testCMessagesDialog()
-{
- UStringVector Messages;
-
- Messages.Add(L"message 1");
- Messages.Add(L"message 2");
- Messages.Add(L"message 3");
- Messages.Add(L"message 4");
- Messages.Add(L"message 5");
- Messages.Add(L"message 6");
- Messages.Add(L"message 7");
- Messages.Add(L"message 8");
- Messages.Add(L"message 9");
-
- CMessagesDialog messagesDialog;
- messagesDialog.Messages = &Messages;
- int ret = messagesDialog.Create( 0 ); // ParentWindow
-
- if (ret == IDOK) myErrorMsg(wxT("CMessagesDialog => IDOK"));
- else if (ret == IDCANCEL) myErrorMsg(wxT("CMessagesDialog => IDCANCEL"));
- else myErrorMsg(wxT("CMessagesDialog => ?"));
-
-}
-
-void testCOverwriteDialog()
-{
-SYSTEMTIME systemTime;
-GetSystemTime( &systemTime );
-
-
-const wchar_t *existName = L"existName";
-FILETIME data_existTime;
-FILETIME *existTime = &data_existTime ;
-UInt64 data_existSize = 1234;
-UInt64 *existSize = &data_existSize;
-const wchar_t *newName = L"newName";
-FILETIME data_newTime;
-FILETIME *newTime = &data_newTime;
-UInt64 data_newSize = 45678;
-UInt64 *newSize = &data_newSize;
-Int32 data_answer=0;
-Int32 *answer = &data_answer;
-
-SystemTimeToFileTime( &systemTime , &data_existTime);
-SystemTimeToFileTime( &systemTime , &data_newTime);
-
- COverwriteDialog dialog;
-
- dialog.OldFileInfo.Time = *existTime;
- dialog.OldFileInfo.TimeIsDefined = true; // FIXME : look again at the sample !
-
- dialog.OldFileInfo.SizeIsDefined = (existSize != NULL);
- if (dialog.OldFileInfo.SizeIsDefined)
- dialog.OldFileInfo.Size = *existSize;
- dialog.OldFileInfo.Name = existName;
-
- if (newTime == 0)
- dialog.NewFileInfo.TimeIsDefined = false;
- else
- {
- dialog.NewFileInfo.TimeIsDefined = true;
- dialog.NewFileInfo.Time = *newTime;
- }
-
- dialog.NewFileInfo.SizeIsDefined = (newSize != NULL);
- if (dialog.NewFileInfo.SizeIsDefined)
- dialog.NewFileInfo.Size = *newSize;
- dialog.NewFileInfo.Name = newName;
-
- /*
- NOverwriteDialog::NResult::EEnum writeAnswer =
- NOverwriteDialog::Execute(oldFileInfo, newFileInfo);
- */
- INT_PTR writeAnswer = dialog.Create(NULL); // ParentWindow doesn't work with 7z
-
- switch(writeAnswer)
- {
- case IDCANCEL: myErrorMsg(wxT("COverwriteDialog => IDCANCEL")); break;
- case IDNO: myErrorMsg(wxT("COverwriteDialog => IDNO")); break;
- case IDC_BUTTON_OVERWRITE_NO_TO_ALL: myErrorMsg(wxT("COverwriteDialog => IDC_BUTTON_OVERWRITE_NO_TO_ALL")); break;
- case IDC_BUTTON_OVERWRITE_YES_TO_ALL:myErrorMsg(wxT("COverwriteDialog => IDC_BUTTON_OVERWRITE_YES_TO_ALL")); break;
- case IDC_BUTTON_OVERWRITE_AUTO_RENAME:myErrorMsg(wxT("COverwriteDialog => IDC_BUTTON_OVERWRITE_AUTO_RENAME")); break;
- case IDYES: myErrorMsg(wxT("COverwriteDialog => IDYES")); break;
- default: myErrorMsg(wxT("COverwriteDialog => default")); break;
- }
-}
-
-void testCPasswordDialog()
-{
- CPasswordDialog dialog;
-
- int ret = dialog.Create(0);
- if (ret == IDOK) {
- UString Password = dialog.Password;
- UString msg = wxT("CPasswordDialog => IDOK password=\"");
- msg += Password;
- msg += wxT("\"");
- myErrorMsg(msg);
- }
- else if (ret == IDCANCEL) myErrorMsg(wxT("CPasswordDialog => IDCANCEL"));
- else myErrorMsg(wxT("CPasswordDialog => ?"));
-
-}
-
-struct CThreadProgressDialog
-{
- CProgressDialog * ProgressDialog;
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- ((CThreadProgressDialog *)param)->Result = ((CThreadProgressDialog *)param)->Process();
- return 0;
- }
- HRESULT Result;
- HRESULT Process()
- {
- Sleep(1000);
- int total = 1000;
-
- ProgressDialog->ProgressSynch.SetTitleFileName(L"SetTitleFileName");
- ProgressDialog->ProgressSynch.SetNumFilesTotal(100);
- ProgressDialog->ProgressSynch.SetNumFilesCur(1);
- ProgressDialog->ProgressSynch.SetProgress(total, 0);
- // ProgressDialog.ProgressSynch.SetRatioInfo(inSize, outSize);
- // ProgressDialog.ProgressSynch.SetCurrentFileName(name);
-
- ProgressDialog->ProgressSynch.SetPos(total/10);
- ProgressDialog->ProgressSynch.SetCurrentFileName(L"File1");
- Sleep(1000);
- ProgressDialog->ProgressSynch.SetPos(total/2);
- ProgressDialog->ProgressSynch.SetCurrentFileName(L"File2");
- Sleep(1000);
- ProgressDialog->ProgressSynch.SetPos(total);
- ProgressDialog->ProgressSynch.SetCurrentFileName(L"File3");
- Sleep(1000);
- ProgressDialog->MyClose();
- return 0;
- }
-};
-
-void testCProgressDialog()
-{
- CProgressDialog ProgressDialog;
-
- CThreadProgressDialog benchmarker;
- benchmarker.ProgressDialog = &ProgressDialog;
- NWindows::CThread thread;
- thread.Create(CThreadProgressDialog::MyThreadFunction, &benchmarker);
-
- // void StartProgressDialog(const UString &title)
- int ret = ProgressDialog.Create(L"testCProgressDialog", 0);
-
- if (ret == IDOK) myErrorMsg(wxT("CProgressDialog => IDOK"));
- else if (ret == IDCANCEL) myErrorMsg(wxT("CProgressDialog => IDCANCEL"));
- else myErrorMsg(wxT("CProgressDialog => ?"));
-
-}
-
-void testDialog(int num)
-{
- NWindows::NControl::CModalDialog dialog;
-
- printf("Generic Dialog(%d)\n",num);
- int ret = dialog.Create(num, 0);
- if (ret == IDOK) myErrorMsg(wxT("Generic Dialog => IDOK"));
- else if (ret == IDCANCEL) myErrorMsg(wxT("Generic Dialog => IDCANCEL"));
- else myErrorMsg(wxT("Generic Dialog => ?"));
-}
-
-void testMessageBox()
-{
- int ret = MessageBoxW(0, L"test yes/no/cancel",
- L"7-Zip", MB_YESNOCANCEL | MB_ICONQUESTION | MB_TASKMODAL);
- if (ret == IDYES) myErrorMsg(wxT("MessageBoxW => IDYES"));
- else if (ret == IDNO) myErrorMsg(wxT("MessageBoxW => IDNO"));
- else if (ret == IDCANCEL) myErrorMsg(wxT("MessageBoxW => IDCANCEL"));
- else myErrorMsg(wxT("MessageBoxW => ?"));
-}
-
-static void testRegistry()
-{
- SaveRegLang(L"fr");
-
- UString langFile;
- ReadRegLang(langFile);
-
- printf("testRegistry : -%ls-\n",(const wchar_t *)langFile);
-}
-
-
-int Main2(int argc,TCHAR **argv);
-
-int Main3(int argc,wxChar **argv)
-{
- testRegistry();
-
- int num = -1;
-
- if (argc >=2 )
- {
- num = argv[1][0] - L'0';
- }
- printf("num=%d\n",num);
-
-
- switch(num)
- {
- case 0:
- {
- TCHAR **argv2 = (TCHAR **)calloc(argc,sizeof(*argv));
-
- argv2[0] = argv[0];
- for(int i = 2; i < argc; i++) argv2[i-1] = argv[i];
-
- return Main2(argc-1,argv2);
- }
- // TODO Benchmark
- // TODO CCompressDialog
- // TODO CExtractDialog ?
- case 1 : testCMessagesDialog(); break;
- case 2 : testCOverwriteDialog(); break;
- case 3 : testCPasswordDialog(); break;
- case 4 : testCProgressDialog(); break;
- case 5 : testMessageBox(); break;
- case 9 :
- if (argc >= 3)
- {
- AString str = GetAnsiString(argv[2]);
- int num = atoi((const char*)str);
- testDialog(num);
- }
- else
- {
- printf("usage : 7zG 9 <windowID>\n");
- }
- break;
- default :
- printf("usage : 7zG number\n");
-
- };
-
- return 0;
-}
-
-#endif // ACTIVATE_DIALOG_TESTS
-
-static const TCHAR *kCUBasePath = TEXT("Software/7-ZIP");
-static const WCHAR *kLangValueName = L"Lang";
-
-void SaveRegLang(const UString &langFile)
-{
- CKey key;
- key.Create(HKEY_CURRENT_USER, kCUBasePath);
- key.SetValue(kLangValueName, langFile);
-}
-
-void ReadRegLang(UString &langFile)
-{
- langFile.Empty();
- CKey key;
- if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) == ERROR_SUCCESS)
- key.QueryValue(kLangValueName, langFile);
-}
-
-
-//////////////////////////////////
-
-#define NEED_NAME_WINDOWS_TO_UNIX
-#include "myPrivate.h" // global_use_utf16_conversion
-
-void mySplitCommandLineW(int numArguments, TCHAR **arguments,UStringVector &parts) {
-
- parts.Clear();
- for(int ind=0;ind < numArguments; ind++) {
- UString tmp = arguments[ind];
- // tmp.Trim(); " " is a valid filename ...
- if (!tmp.IsEmpty()) {
- parts.Add(tmp);
-// DEBUG printf("ARG %d : '%ls'\n",ind,(const wchar_t *)tmp);
- }
- }
-}
-
-// ----------------------------------------------------------------------------
-// private classes
-// ----------------------------------------------------------------------------
-
-// Define a new frame type
-class MyFrame: public wxFrame
-{
-public:
- // ctor
- MyFrame(wxFrame *frame, const wxString& title, int x, int y, int w, int h);
- // virtual ~MyFrame();
-
- // operations
- void WriteText(const wxString& text) { m_txtctrl->WriteText(text); }
-
-protected:
- // callbacks
- void OnWorkerEvent(wxCommandEvent& event);
-private:
- // just some place to put our messages in
- wxTextCtrl *m_txtctrl;
- DECLARE_EVENT_TABLE()
-};
-
-enum {
- WORKER_EVENT=100 // this one gets sent from the worker thread
-};
-
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
- EVT_MENU(WORKER_EVENT, MyFrame::OnWorkerEvent)
- // EVT_IDLE(MyFrame::OnIdle)
-END_EVENT_TABLE()
-
-// My frame constructor
-MyFrame::MyFrame(wxFrame *frame, const wxString& title,
- int x, int y, int w, int h)
- : wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
-{
- this->SetIcon(wxICON(p7zip_32));
-
-#if wxUSE_STATUSBAR
- CreateStatusBar(2);
-#endif // wxUSE_STATUSBAR
-
- m_txtctrl = new wxTextCtrl(this, wxID_ANY, _T(""), wxPoint(0, 0), wxSize(0, 0), wxTE_MULTILINE | wxTE_READONLY);
-}
-
-void myCreateHandle(int n);
-wxWindow * g_window=0;
-
-void MyFrame::OnWorkerEvent(wxCommandEvent& event)
-{
- int n = event.GetInt();
- myCreateHandle(n);
-}
-
-
-// Define a new application type, each program should derive a class from wxApp
-class MyApp : public wxApp
-{
-public:
- // override base class virtuals
- // ----------------------------
-
- // this one is called on application startup and is a good place for the app
- // initialization (doing it here and not in the ctor allows to have an error
- // return: if OnInit() returns false, the application terminates)
- virtual bool OnInit();
-};
-
-// Create a new application object: this macro will allow wxWidgets to create
-// the application object during program execution (it's better than using a
-// static object for many reasons) and also implements the accessor function
-// wxGetApp() which will return the reference of the right type (i.e. MyApp and
-// not wxApp)
-IMPLEMENT_APP(MyApp)
-
-time_t g_T0 = 0;
-class MyThread : public wxThread
-{
- int _argc;
- TCHAR **_argv;
-public:
- MyThread(int argc,TCHAR **argv): wxThread(),_argc(argc), _argv(argv) {}
-
- // thread execution starts here
- virtual void *Entry()
- {
-#ifdef ACTIVATE_DIALOG_TESTS
- int ret = Main3(_argc,_argv);
-#else
- int ret = Main1(_argc,_argv);
-#endif
- exit(ret);
- }
-};
-
-// 'Main program' equivalent: the program execution "starts" here
-bool MyApp::OnInit()
-{
- // don't parse the command-line options !
- // : if ( !wxApp::OnInit() ) return false;
-
- { // define P7ZIP_HOME_DIR
- extern void my_windows_split_path(const AString &p_path, AString &dir , AString &base);
- static char p7zip_home_dir[MAX_PATH];
-
- UString fullPath;
- NDirectory::MyGetFullPathName(wxApp::argv[0], fullPath);
- AString afullPath = GetAnsiString(fullPath);
-
- AString dir,name;
-
- my_windows_split_path(afullPath,dir,name);
-
- const char *dir2 = nameWindowToUnix((const char *)dir);
- snprintf(p7zip_home_dir,sizeof(p7zip_home_dir),"P7ZIP_HOME_DIR=%s/",dir2);
- p7zip_home_dir[sizeof(p7zip_home_dir)-1] = 0;
- putenv(p7zip_home_dir);
- // DEBUG printf("putenv(%s)\n",p7zip_home_dir);
- }
- global_use_utf16_conversion = 1; // UNICODE !
-
- g_T0 = time(0);
- // DEBUG printf("MAIN Thread : 0x%lx\n",wxThread::GetCurrentId());
-
- // Create the main frame window
- MyFrame *frame = new MyFrame((wxFrame *)NULL, _T("7-zip Main Window"), 50, 50, 450, 340);
- // Don't Show the frame !
- // frame->Show(true);
-
- SetTopWindow(frame);
-
- g_window = frame;
-
- MyThread *thread = new MyThread(wxApp::argc,wxApp::argv);
- thread->Create(); // != wxTHREAD_NO_ERROR
- thread->Run();
-
- // success: wxApp::OnRun() will be called which will enter the main message
- // loop and the application will run. If we returned false here, the
- // application would exit immediately.
- return true;
-}
-
-DWORD WINAPI GetTickCount(VOID) {
- static wxStopWatch sw;
- return sw.Time();
-}
-
-//////////////////////////////////////////
-
-#include "resource.h"
-#include "ExtractRes.h"
-
-static CStringTable g_stringTable[] =
-{
- /* resource.rc */
- /***************/
- { IDS_OPEN_TYPE_ALL_FILES, L"All Files" },
- { IDS_METHOD_STORE, L"Store" },
- { IDS_METHOD_NORMAL, L"Normal" },
- { IDS_METHOD_MAXIMUM, L"Maximum" },
- { IDS_METHOD_FAST, L"Fast" },
- { IDS_METHOD_FASTEST, L"Fastest" },
- { IDS_METHOD_ULTRA, L"Ultra" },
- { IDS_COMPRESS_NON_SOLID, L"Non-solid" },
- { IDS_COMPRESS_SOLID, L"Solid" },
-
- { IDS_COMPRESS_UPDATE_MODE_ADD, L"Add and replace files" },
- { IDS_COMPRESS_UPDATE_MODE_UPDATE, L"Update and add files" },
- { IDS_COMPRESS_UPDATE_MODE_FRESH, L"Freshen existing files" },
- { IDS_COMPRESS_UPDATE_MODE_SYNCHRONIZE, L"Synchronize files" },
- { IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE, L"Browse" },
- { IDS_COMPRESS_INCORRECT_VOLUME_SIZE, L"Incorrect volume size" },
- { IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE, L"Specified volume size: {0} bytes.\nAre you sure you want to split archive into such volumes?" },
-
- { IDS_PASSWORD_USE_ASCII, L"Use only English letters, numbers and special characters (!, #, $, ...) for password." },
- { IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH, L"Passwords do not match" },
- { IDS_PASSWORD_IS_TOO_LONG, L"Password is too long" },
-
- { IDS_PROGRESS_COMPRESSING, L"Compressing" },
- { IDS_PROGRESS_TESTING, L"Testing" },
- { IDS_MESSAGE_NO_ERRORS, L"There are no errors" },
- { IDS_FILES_COLON, L"Files:" },
- { IDS_FOLDERS_COLON, L"Folders:" },
- { IDS_SIZE_COLON, L"Size:" },
- { IDS_COMPRESSED_COLON, L"Compressed size:" },
- { IDS_ARCHIVES_COLON, L"Archives:" },
-
- /* Extract.rc */
- /**************/
- { IDS_CANNOT_CREATE_FOLDER , L"Cannot create folder '{0}'"},
- { IDS_OPEN_IS_NOT_SUPORTED_ARCHIVE, L"File is not supported archive."},
-
- { IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC , L"CRC failed in '{0}'. File is broken."},
- { IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR , L"Data error in '{0}'. File is broken"},
- { IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_UNSUPPORTED_METHOD , L"Unsupported compression method for '{0}'."},
- { IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CRC_ENCRYPTED , L"CRC failed in encrypted file '{0}'. Wrong password?"},
- { IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED , L"Data error in encrypted file '{0}'. Wrong password?"},
-
- { IDS_EXTRACT_SET_FOLDER , L"Specify a location for extracted files."},
- { IDS_MESSAGES_DIALOG_EXTRACT_MESSAGE_CANNOT_OPEN_FILE, L"Can not open output file '{0}'."},
- { IDS_PROGRESS_EXTRACTING, L"Extracting" },
-
- { IDS_CANT_OPEN_ARCHIVE , L"Can not open file '{0}' as archive"},
- { IDS_CANT_OPEN_ENCRYPTED_ARCHIVE , L"Can not open encrypted archive '{0}'. Wrong password?"},
-
- { 0 , 0 }
-};
-
-REGISTER_STRINGTABLE(g_stringTable)
-