├── .gitattributes ├── .gitignore ├── Compressor.cpp ├── Compressor.h ├── GlobalVars.cpp ├── GlobalVars.h ├── Header.h ├── LZMA.cpp ├── LZMA.h ├── LzmaLib.lib ├── NSISEmulator.cpp ├── NSISEmulator.h ├── NsisDecompiler.cpp ├── NsisDecompiler.h ├── NsisDecompiler.rc ├── NsisDecompiler.sln ├── NsisDecompiler.vcxproj ├── NsisDecompiler.vcxproj.filters ├── NsisDecompilerDlg.cpp ├── NsisDecompilerDlg.h ├── NsisFile.cpp ├── NsisFile.h ├── ReadMe.txt ├── Resource.h ├── System.vcxproj ├── System.vcxproj.filters ├── System ├── Buffers.c ├── Buffers.h ├── Call.S ├── Plugin.c ├── Plugin.h ├── Plugins.cpp ├── Plugins.h ├── System.c ├── System.h ├── exdll.h ├── nsis │ ├── Plugins.cpp │ └── Plugins.h ├── stdafx.c └── stdafx.h ├── Text.txt ├── Utils.cpp ├── Utils.h ├── _lzma ├── 7zip │ ├── Aes.mak │ ├── Archive │ │ ├── 7z │ │ │ ├── 7zCompressionMode.cpp │ │ │ ├── 7zCompressionMode.h │ │ │ ├── 7zDecode.cpp │ │ │ ├── 7zDecode.h │ │ │ ├── 7zEncode.cpp │ │ │ ├── 7zEncode.h │ │ │ ├── 7zExtract.cpp │ │ │ ├── 7zFolderInStream.cpp │ │ │ ├── 7zFolderInStream.h │ │ │ ├── 7zFolderOutStream.cpp │ │ │ ├── 7zFolderOutStream.h │ │ │ ├── 7zHandler.cpp │ │ │ ├── 7zHandler.h │ │ │ ├── 7zHandlerOut.cpp │ │ │ ├── 7zHeader.cpp │ │ │ ├── 7zHeader.h │ │ │ ├── 7zIn.cpp │ │ │ ├── 7zIn.h │ │ │ ├── 7zItem.h │ │ │ ├── 7zOut.cpp │ │ │ ├── 7zOut.h │ │ │ ├── 7zProperties.cpp │ │ │ ├── 7zProperties.h │ │ │ ├── 7zRegister.cpp │ │ │ ├── 7zSpecStream.cpp │ │ │ ├── 7zSpecStream.h │ │ │ ├── 7zUpdate.cpp │ │ │ ├── 7zUpdate.h │ │ │ ├── StdAfx.cpp │ │ │ └── StdAfx.h │ │ ├── Archive.def │ │ ├── Archive2.def │ │ ├── ArchiveExports.cpp │ │ ├── Common │ │ │ ├── CoderMixer2.cpp │ │ │ ├── CoderMixer2.h │ │ │ ├── CoderMixer2MT.cpp │ │ │ ├── CoderMixer2MT.h │ │ │ ├── CrossThreadProgress.cpp │ │ │ ├── CrossThreadProgress.h │ │ │ ├── DummyOutStream.cpp │ │ │ ├── DummyOutStream.h │ │ │ ├── HandlerOut.cpp │ │ │ ├── HandlerOut.h │ │ │ ├── InStreamWithCRC.cpp │ │ │ ├── InStreamWithCRC.h │ │ │ ├── ItemNameUtils.cpp │ │ │ ├── ItemNameUtils.h │ │ │ ├── MultiStream.cpp │ │ │ ├── MultiStream.h │ │ │ ├── OutStreamWithCRC.cpp │ │ │ ├── OutStreamWithCRC.h │ │ │ ├── ParseProperties.cpp │ │ │ ├── ParseProperties.h │ │ │ └── StdAfx.h │ │ ├── DllExports2.cpp │ │ ├── IArchive.h │ │ ├── Icons │ │ │ └── 7z.ico │ │ ├── LzmaHandler.cpp │ │ ├── SplitHandler.cpp │ │ ├── StdAfx.h │ │ └── XzHandler.cpp │ ├── Asm.mak │ ├── Bundles │ │ ├── Alone7z │ │ │ ├── Alone.dsp │ │ │ ├── Alone.dsw │ │ │ ├── StdAfx.cpp │ │ │ ├── StdAfx.h │ │ │ ├── makefile │ │ │ └── resource.rc │ │ ├── Format7zExtractR │ │ │ ├── StdAfx.cpp │ │ │ ├── StdAfx.h │ │ │ ├── makefile │ │ │ └── resource.rc │ │ ├── Format7zR │ │ │ ├── StdAfx.cpp │ │ │ ├── StdAfx.h │ │ │ ├── makefile │ │ │ └── resource.rc │ │ └── LzmaCon │ │ │ ├── LzmaAlone.cpp │ │ │ ├── LzmaCon.dsp │ │ │ ├── LzmaCon.dsw │ │ │ ├── LzmaCon.sln │ │ │ ├── LzmaCon.vcproj │ │ │ ├── LzmaCon.vcxproj │ │ │ ├── LzmaCon.vcxproj.filters │ │ │ ├── StdAfx.cpp │ │ │ ├── StdAfx.h │ │ │ ├── makefile │ │ │ └── makefile.gcc │ ├── Common │ │ ├── CWrappers.cpp │ │ ├── CWrappers.h │ │ ├── CreateCoder.cpp │ │ ├── CreateCoder.h │ │ ├── FilePathAutoRename.cpp │ │ ├── FilePathAutoRename.h │ │ ├── FileStreams.cpp │ │ ├── FileStreams.h │ │ ├── FilterCoder.cpp │ │ ├── FilterCoder.h │ │ ├── InBuffer.cpp │ │ ├── InBuffer.h │ │ ├── InOutTempBuffer.cpp │ │ ├── InOutTempBuffer.h │ │ ├── LimitedStreams.cpp │ │ ├── LimitedStreams.h │ │ ├── LockedStream.cpp │ │ ├── LockedStream.h │ │ ├── MethodId.cpp │ │ ├── MethodId.h │ │ ├── MethodProps.cpp │ │ ├── MethodProps.h │ │ ├── OffsetStream.cpp │ │ ├── OffsetStream.h │ │ ├── OutBuffer.cpp │ │ ├── OutBuffer.h │ │ ├── ProgressUtils.cpp │ │ ├── ProgressUtils.h │ │ ├── RegisterArc.h │ │ ├── RegisterCodec.h │ │ ├── StdAfx.h │ │ ├── StreamBinder.cpp │ │ ├── StreamBinder.h │ │ ├── StreamObjects.cpp │ │ ├── StreamObjects.h │ │ ├── StreamUtils.cpp │ │ ├── StreamUtils.h │ │ ├── VirtThread.cpp │ │ └── VirtThread.h │ ├── Compress │ │ ├── Bcj2Coder.cpp │ │ ├── Bcj2Coder.h │ │ ├── Bcj2Register.cpp │ │ ├── BcjCoder.cpp │ │ ├── BcjCoder.h │ │ ├── BcjRegister.cpp │ │ ├── BranchCoder.cpp │ │ ├── BranchCoder.h │ │ ├── BranchMisc.cpp │ │ ├── BranchMisc.h │ │ ├── BranchRegister.cpp │ │ ├── ByteSwap.cpp │ │ ├── CodecExports.cpp │ │ ├── CopyCoder.cpp │ │ ├── CopyCoder.h │ │ ├── CopyRegister.cpp │ │ ├── DeltaFilter.cpp │ │ ├── Lzma2Decoder.cpp │ │ ├── Lzma2Decoder.h │ │ ├── Lzma2Encoder.cpp │ │ ├── Lzma2Encoder.h │ │ ├── Lzma2Register.cpp │ │ ├── LzmaDecoder.cpp │ │ ├── LzmaDecoder.h │ │ ├── LzmaEncoder.cpp │ │ ├── LzmaEncoder.h │ │ ├── LzmaRegister.cpp │ │ ├── PpmdDecoder.h │ │ ├── PpmdEncoder.cpp │ │ ├── PpmdRegister.cpp │ │ ├── RangeCoder.h │ │ ├── RangeCoderBit.h │ │ └── StdAfx.h │ ├── Crc.mak │ ├── Guid.txt │ ├── ICoder.h │ ├── IDecl.h │ ├── IPassword.h │ ├── IProgress.h │ ├── IStream.h │ ├── MyVersion.h │ ├── MyVersionInfo.rc │ ├── PropID.h │ ├── SubBuild.mak │ └── UI │ │ ├── Client7z │ │ ├── Client7z.cpp │ │ ├── Client7z.dsp │ │ ├── Client7z.dsw │ │ ├── StdAfx.cpp │ │ ├── StdAfx.h │ │ └── makefile │ │ ├── Common │ │ ├── ArchiveCommandLine.cpp │ │ ├── ArchiveCommandLine.h │ │ ├── ArchiveExtractCallback.cpp │ │ ├── ArchiveExtractCallback.h │ │ ├── ArchiveName.cpp │ │ ├── ArchiveName.h │ │ ├── ArchiveOpenCallback.cpp │ │ ├── ArchiveOpenCallback.h │ │ ├── Bench.cpp │ │ ├── Bench.h │ │ ├── DefaultName.cpp │ │ ├── DefaultName.h │ │ ├── DirItem.h │ │ ├── EnumDirItems.cpp │ │ ├── EnumDirItems.h │ │ ├── ExitCode.h │ │ ├── Extract.cpp │ │ ├── Extract.h │ │ ├── ExtractMode.h │ │ ├── ExtractingFilePath.cpp │ │ ├── ExtractingFilePath.h │ │ ├── IFileExtractCallback.h │ │ ├── LoadCodecs.cpp │ │ ├── LoadCodecs.h │ │ ├── OpenArchive.cpp │ │ ├── OpenArchive.h │ │ ├── PropIDUtils.cpp │ │ ├── PropIDUtils.h │ │ ├── Property.h │ │ ├── SetProperties.cpp │ │ ├── SetProperties.h │ │ ├── SortUtils.cpp │ │ ├── SortUtils.h │ │ ├── StdAfx.h │ │ ├── TempFiles.cpp │ │ ├── TempFiles.h │ │ ├── Update.cpp │ │ ├── Update.h │ │ ├── UpdateAction.cpp │ │ ├── UpdateAction.h │ │ ├── UpdateCallback.cpp │ │ ├── UpdateCallback.h │ │ ├── UpdatePair.cpp │ │ ├── UpdatePair.h │ │ ├── UpdateProduce.cpp │ │ ├── UpdateProduce.h │ │ ├── WorkDir.cpp │ │ ├── WorkDir.h │ │ └── ZipRegistry.h │ │ └── Console │ │ ├── BenchCon.cpp │ │ ├── BenchCon.h │ │ ├── ConsoleClose.cpp │ │ ├── ConsoleClose.h │ │ ├── ExtractCallbackConsole.cpp │ │ ├── ExtractCallbackConsole.h │ │ ├── List.cpp │ │ ├── List.h │ │ ├── Main.cpp │ │ ├── MainAr.cpp │ │ ├── OpenCallbackConsole.cpp │ │ ├── OpenCallbackConsole.h │ │ ├── PercentPrinter.cpp │ │ ├── PercentPrinter.h │ │ ├── StdAfx.cpp │ │ ├── StdAfx.h │ │ ├── UpdateCallbackConsole.cpp │ │ ├── UpdateCallbackConsole.h │ │ ├── UserInputUtils.cpp │ │ ├── UserInputUtils.h │ │ ├── makefile │ │ └── resource.rc ├── Common │ ├── AutoPtr.h │ ├── Buffer.h │ ├── CRC.cpp │ ├── C_FileIO.cpp │ ├── C_FileIO.h │ ├── ComTry.h │ ├── CommandLineParser.cpp │ ├── CommandLineParser.h │ ├── Defs.h │ ├── DynamicBuffer.h │ ├── IntToString.cpp │ ├── IntToString.h │ ├── ListFileUtils.cpp │ ├── ListFileUtils.h │ ├── MyCom.h │ ├── MyException.h │ ├── MyGuidDef.h │ ├── MyInitGuid.h │ ├── MyString.cpp │ ├── MyString.h │ ├── MyUnknown.h │ ├── MyVector.cpp │ ├── MyVector.h │ ├── MyWindows.h │ ├── NewHandler.cpp │ ├── NewHandler.h │ ├── StdAfx.h │ ├── StdInStream.cpp │ ├── StdInStream.h │ ├── StdOutStream.cpp │ ├── StdOutStream.h │ ├── StringConvert.cpp │ ├── StringConvert.h │ ├── StringToInt.cpp │ ├── StringToInt.h │ ├── Types.h │ ├── UTFConvert.cpp │ ├── UTFConvert.h │ ├── Wildcard.cpp │ └── Wildcard.h ├── Windows │ ├── DLL.cpp │ ├── DLL.h │ ├── Defs.h │ ├── Error.cpp │ ├── Error.h │ ├── FileDir.cpp │ ├── FileDir.h │ ├── FileFind.cpp │ ├── FileFind.h │ ├── FileIO.cpp │ ├── FileIO.h │ ├── FileMapping.cpp │ ├── FileMapping.h │ ├── FileName.cpp │ ├── FileName.h │ ├── Handle.h │ ├── MemoryLock.cpp │ ├── MemoryLock.h │ ├── NtCheck.h │ ├── PropVariant.cpp │ ├── PropVariant.h │ ├── PropVariantConversions.cpp │ ├── PropVariantConversions.h │ ├── Registry.cpp │ ├── Registry.h │ ├── StdAfx.h │ ├── Synchronization.cpp │ ├── Synchronization.h │ ├── System.cpp │ ├── System.h │ ├── Thread.h │ ├── Time.cpp │ └── Time.h └── c │ ├── 7z.h │ ├── 7zAlloc.c │ ├── 7zAlloc.h │ ├── 7zBuf.c │ ├── 7zBuf.h │ ├── 7zBuf2.c │ ├── 7zCrc.c │ ├── 7zCrc.h │ ├── 7zCrcOpt.c │ ├── 7zDec.c │ ├── 7zFile.c │ ├── 7zFile.h │ ├── 7zIn.c │ ├── 7zStream.c │ ├── 7zVersion.h │ ├── Alloc.c │ ├── Alloc.h │ ├── Bcj2.c │ ├── Bcj2.h │ ├── Bra.c │ ├── Bra.h │ ├── Bra86.c │ ├── BraIA64.c │ ├── CpuArch.c │ ├── CpuArch.h │ ├── Delta.c │ ├── Delta.h │ ├── LzFind.c │ ├── LzFind.h │ ├── LzFindMt.c │ ├── LzFindMt.h │ ├── LzHash.h │ ├── Lzma2Dec.c │ ├── Lzma2Dec.h │ ├── Lzma2Enc.c │ ├── Lzma2Enc.h │ ├── Lzma86.h │ ├── Lzma86Dec.c │ ├── Lzma86Enc.c │ ├── LzmaDec.c │ ├── LzmaDec.h │ ├── LzmaEnc.c │ ├── LzmaEnc.h │ ├── LzmaLib.c │ ├── LzmaLib.h │ ├── MtCoder.c │ ├── MtCoder.h │ ├── Ppmd.h │ ├── Ppmd7.c │ ├── Ppmd7.h │ ├── Ppmd7Dec.c │ ├── Ppmd7Enc.c │ ├── RotateDefs.h │ ├── Sha256.c │ ├── Sha256.h │ ├── Threads.c │ ├── Threads.h │ ├── Types.h │ ├── Util │ ├── 7z │ │ ├── 7z.dsp │ │ ├── 7z.dsw │ │ ├── 7zMain.c │ │ ├── makefile │ │ └── makefile.gcc │ ├── Lzma │ │ ├── LzmaUtil.c │ │ ├── LzmaUtil.dsp │ │ ├── LzmaUtil.dsw │ │ ├── makefile │ │ └── makefile.gcc │ ├── LzmaLib │ │ ├── LzmaLib.def │ │ ├── LzmaLib.dsp │ │ ├── LzmaLib.dsw │ │ ├── LzmaLibExports.c │ │ ├── makefile │ │ └── resource.rc │ └── SfxSetup │ │ ├── SfxSetup.c │ │ ├── SfxSetup.dsp │ │ ├── SfxSetup.dsw │ │ ├── makefile │ │ ├── makefile_con │ │ ├── resource.rc │ │ └── setup.ico │ ├── Xz.c │ ├── Xz.h │ ├── XzCrc64.c │ ├── XzCrc64.h │ ├── XzDec.c │ ├── XzEnc.c │ ├── XzEnc.h │ └── XzIn.c ├── crc32.c ├── crc32.h ├── include ├── zconf.h └── zlib.h ├── lib ├── LzmaLib.lib ├── zdll.lib └── zlib.def ├── lzma ├── 7z.h ├── 7zAlloc.c ├── 7zAlloc.h ├── 7zBuf.c ├── 7zBuf.h ├── 7zBuf2.c ├── 7zCrc.c ├── 7zCrc.h ├── 7zCrcOpt.c ├── 7zDec.c ├── 7zFile.c ├── 7zFile.h ├── 7zIn.c ├── 7zStream.c ├── 7zVersion.h ├── Alloc.c ├── Alloc.h ├── Bcj2.c ├── Bcj2.h ├── Bra.c ├── Bra.h ├── Bra86.c ├── BraIA64.c ├── CpuArch.c ├── CpuArch.h ├── Delta.c ├── Delta.h ├── LzFind.c ├── LzFind.h ├── LzFindMt.c ├── LzFindMt.h ├── LzHash.h ├── Lzma2Dec.c ├── Lzma2Dec.h ├── Lzma2Enc.c ├── Lzma2Enc.h ├── Lzma86.h ├── Lzma86Dec.c ├── Lzma86Enc.c ├── LzmaDec.c ├── LzmaDec.h ├── LzmaEnc.c ├── LzmaEnc.h ├── LzmaLib.c ├── LzmaLib.h ├── MtCoder.c ├── MtCoder.h ├── MyVersion.h ├── MyVersionInfo.rc ├── Ppmd.h ├── Ppmd7.c ├── Ppmd7.h ├── Ppmd7Dec.c ├── Ppmd7Enc.c ├── RotateDefs.h ├── Sha256.c ├── Sha256.h ├── Threads.c ├── Threads.h ├── Types.h ├── Util │ ├── 7z │ │ ├── 7z.dsp │ │ ├── 7z.dsw │ │ ├── 7zMain.c │ │ ├── makefile │ │ └── makefile.gcc │ ├── Lzma │ │ ├── LzmaUtil.c │ │ ├── LzmaUtil.dsp │ │ ├── LzmaUtil.dsw │ │ ├── makefile │ │ └── makefile.gcc │ ├── LzmaLib │ │ ├── LzmaLib.def │ │ ├── LzmaLib.dsp │ │ ├── LzmaLib.dsw │ │ ├── LzmaLib.vcxproj │ │ ├── LzmaLib.vcxproj.filters │ │ ├── LzmaLibExports.c │ │ ├── RCa08116 │ │ ├── RCb08116 │ │ ├── TextFile1.txt │ │ ├── makefile │ │ └── resource.rc │ └── SfxSetup │ │ ├── SfxSetup.c │ │ ├── SfxSetup.dsp │ │ ├── SfxSetup.dsw │ │ ├── makefile │ │ ├── makefile_con │ │ ├── resource.rc │ │ └── setup.ico ├── Xz.c ├── Xz.h ├── XzCrc64.c ├── XzCrc64.h ├── XzDec.c ├── XzEnc.c ├── XzEnc.h └── XzIn.c ├── res ├── NsisDecompiler.ico ├── NsisDecompiler.rc2 ├── icon1.ico └── icon2.ico ├── stdafx.cpp ├── stdafx.h ├── targetver.h └── zlib1.dll /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /Compressor.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | #include "Compressor.h" 3 | 4 | 5 | CCompressor::CCompressor(void) 6 | { 7 | } 8 | 9 | 10 | CCompressor::~CCompressor(void) 11 | { 12 | } 13 | 14 | /************************************************************************/ 15 | // 16 | /***********************************************************************/ 17 | bool CCompressor::Reset() 18 | { 19 | memset(&_stream,0,sizeof(z_stream_s)); 20 | //inflateInit(&_stream); 21 | 22 | return true; 23 | } 24 | /************************************************************************/ 25 | // 26 | /************************************************************************/ 27 | bool CCompressor::DecompressAndCopyToBuffer(byte* inbuff,int inlength,std::vector *out_vect) 28 | { 29 | lzmacoder.Inflate(inbuff,inlength,out_vect); 30 | 31 | return false; 32 | } -------------------------------------------------------------------------------- /Compressor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | #include 4 | #include "include/zlib.h" 5 | #include "include/zlib.h" 6 | #include "LZMA.h" 7 | 8 | // the compresion wrapper 9 | 10 | class CCompressor 11 | { 12 | public: 13 | CCompressor(void); 14 | ~CCompressor(void); 15 | bool Reset(); 16 | bool DecompressAndCopyToBuffer(byte* inbuff,int inlength,std::vector *out_vect); 17 | 18 | CLZMA lzmacoder; 19 | 20 | private: 21 | z_stream _stream; 22 | }; 23 | 24 | -------------------------------------------------------------------------------- /GlobalVars.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/GlobalVars.cpp -------------------------------------------------------------------------------- /GlobalVars.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/GlobalVars.h -------------------------------------------------------------------------------- /Header.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/Header.h -------------------------------------------------------------------------------- /LZMA.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "stdafx.h" 3 | 4 | #include 5 | 6 | class CLZMA 7 | { 8 | public: 9 | CLZMA(void); 10 | ~CLZMA(void); 11 | // extract buffer 12 | bool Inflate(byte* inbuff,size_t inlength,std::vector *out_vect); 13 | 14 | private: 15 | }; 16 | 17 | -------------------------------------------------------------------------------- /LzmaLib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/LzmaLib.lib -------------------------------------------------------------------------------- /NSISEmulator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/NSISEmulator.h -------------------------------------------------------------------------------- /NsisDecompiler.h: -------------------------------------------------------------------------------- 1 | 2 | // NsisDecompiler.h : main header file for the PROJECT_NAME application 3 | // 4 | 5 | #pragma once 6 | 7 | #ifndef __AFXWIN_H__ 8 | #error "include 'stdafx.h' before including this file for PCH" 9 | #endif 10 | 11 | #include "resource.h" // main symbols 12 | 13 | 14 | // CNsisDecompilerApp: 15 | // See NsisDecompiler.cpp for the implementation of this class 16 | // 17 | 18 | class CNsisDecompilerApp : public CWinApp 19 | { 20 | public: 21 | CNsisDecompilerApp(); 22 | 23 | // Overrides 24 | public: 25 | virtual BOOL InitInstance(); 26 | 27 | // Implementation 28 | 29 | DECLARE_MESSAGE_MAP() 30 | }; 31 | 32 | extern CNsisDecompilerApp theApp; -------------------------------------------------------------------------------- /NsisDecompiler.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/NsisDecompiler.rc -------------------------------------------------------------------------------- /NsisDecompiler.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NsisDecompiler", "NsisDecompiler.vcxproj", "{FC77BFBC-E683-4B5D-B124-9DDCA5BCAD04}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LzmaLib", "lzma\Util\LzmaLib\LzmaLib.vcxproj", "{203E2C7A-C806-4C38-B8ED-D517C9F94D8D}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {FC77BFBC-E683-4B5D-B124-9DDCA5BCAD04}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {FC77BFBC-E683-4B5D-B124-9DDCA5BCAD04}.Debug|Win32.Build.0 = Debug|Win32 16 | {FC77BFBC-E683-4B5D-B124-9DDCA5BCAD04}.Release|Win32.ActiveCfg = Release|Win32 17 | {FC77BFBC-E683-4B5D-B124-9DDCA5BCAD04}.Release|Win32.Build.0 = Release|Win32 18 | {203E2C7A-C806-4C38-B8ED-D517C9F94D8D}.Debug|Win32.ActiveCfg = Debug|Win32 19 | {203E2C7A-C806-4C38-B8ED-D517C9F94D8D}.Debug|Win32.Build.0 = Debug|Win32 20 | {203E2C7A-C806-4C38-B8ED-D517C9F94D8D}.Release|Win32.ActiveCfg = Release|Win32 21 | {203E2C7A-C806-4C38-B8ED-D517C9F94D8D}.Release|Win32.Build.0 = Release|Win32 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /NsisDecompilerDlg.h: -------------------------------------------------------------------------------- 1 | 2 | // NsisDecompilerDlg.h : header file 3 | // 4 | 5 | #pragma once 6 | #include "NsisFile.h" 7 | #include "afxcmn.h" 8 | #include "NSISEmulator.h" 9 | 10 | // CNsisDecompilerDlg dialog 11 | class CNsisDecompilerDlg : public CDialogEx 12 | { 13 | // Construction 14 | public: 15 | CNsisDecompilerDlg(CWnd* pParent = NULL); // standard constructor 16 | 17 | // Dialog Data 18 | enum { IDD = IDD_NSISDECOMPILER_DIALOG }; 19 | 20 | protected: 21 | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support 22 | 23 | 24 | // Implementation 25 | protected: 26 | HICON m_hIcon; 27 | 28 | 29 | // Generated message map functions 30 | virtual BOOL OnInitDialog(); 31 | afx_msg void OnPaint(); 32 | afx_msg HCURSOR OnQueryDragIcon(); 33 | DECLARE_MESSAGE_MAP() 34 | public: 35 | afx_msg void OnBnClickedButton1(); 36 | // file processor 37 | CNsisFile _nsisFile; 38 | CNSISEmulator _nsisEmulator; 39 | 40 | 41 | 42 | afx_msg void OnBnClickedOk(); 43 | afx_msg void OnBnClickedCancel(); 44 | CListCtrl m_SourceCode; 45 | CListCtrl m_Stack; 46 | CListCtrl m_Variables; 47 | CListCtrl m_CallSteck; 48 | CImageList m_ImageList; 49 | 50 | void ShowVariables(); 51 | void ShowStack(); 52 | void ShowCallStack(); 53 | 54 | int m_lastitem; 55 | afx_msg void OnBnClickedButton2(); 56 | virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam); 57 | }; 58 | -------------------------------------------------------------------------------- /NsisFile.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/NsisFile.cpp -------------------------------------------------------------------------------- /Resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/Resource.h -------------------------------------------------------------------------------- /System/Buffers.h: -------------------------------------------------------------------------------- 1 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 2 | #pragma once 3 | #endif 4 | 5 | #ifndef BUFFERS_H 6 | #define BUFFERS_H 7 | 8 | #endif /* BUFFERS_H */ 9 | -------------------------------------------------------------------------------- /System/Plugin.h: -------------------------------------------------------------------------------- 1 | // Unicode support by Jim Park -- 08/23/2007 2 | 3 | #ifndef ___PLUGIN__H___ 4 | #define ___PLUGIN__H___ 5 | #include "exdll.h" // nsis plugin 6 | 7 | #define PLUGINFUNCTION(name) \ 8 | void __declspec(dllexport) name( \ 9 | HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra) { \ 10 | /*g_hwndParent=hwndParent;*/ \ 11 | EXDLL_INIT(); \ 12 | //extra->RegisterPluginCallback(g_hInstance, NSISCallback); 13 | #define PLUGINFUNCTIONEND } 14 | 15 | #define PLUGINFUNCTIONSHORT(name) void __declspec(dllexport) name(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop) { \ 16 | g_stringsize=string_size; \ 17 | g_stacktop=stacktop; 18 | 19 | extern BOOL IsUnicode(void); 20 | extern TCHAR *AllocStr(TCHAR *str); 21 | extern void myitoa64(__int64 i, TCHAR *buffer); 22 | extern TCHAR *AllocString(); 23 | extern TCHAR *system_getuservariable(int varnum); 24 | extern TCHAR *system_setuservariable(int varnum, TCHAR *var); 25 | extern TCHAR* system_popstring(); // NULL - stack empty 26 | extern TCHAR* system_pushstring(TCHAR *str); 27 | extern __int64 myatoi64(TCHAR *s); 28 | extern int popint64(); // -1 -> stack empty 29 | extern void system_pushint(int value); 30 | 31 | extern HANDLE GlobalCopy(HANDLE Old); 32 | extern void *copymem(void *output, void *input, size_t cbSize); 33 | 34 | extern UINT_PTR NSISCallback(enum NSPIM); 35 | 36 | extern HWND g_hwndParent; 37 | extern HINSTANCE g_hInstance; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /System/Plugins.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Plugins.h 3 | * 4 | * This file is a part of NSIS. 5 | * 6 | * Copyright (C) 1999-2009 Nullsoft and Contributors 7 | * 8 | * Licensed under the zlib/libpng license (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * 11 | * Licence details can be found in the file COPYING. 12 | * 13 | * This software is provided 'as-is', without any express or implied 14 | * warranty. 15 | * 16 | * Unicode support by Jim Park -- 08/21/2007 17 | */ 18 | 19 | #ifndef __X18_PLUGINS_H 20 | #define __X18_PLUGINS_H 21 | 22 | #include 23 | #include "tstring.h" 24 | 25 | class Plugins 26 | { 27 | public: 28 | void FindCommands(const tstring& path, bool displayInfo); 29 | bool IsPluginCommand(const tstring& command) const; 30 | tstring NormalizedCommand(const tstring& command) const; 31 | int GetPluginHandle(bool uninst, const tstring& command) const; 32 | tstring GetPluginPath(const tstring& command) const; 33 | void SetDllDataHandle(bool uninst, const tstring& command, int dataHandle); 34 | 35 | private: // methods 36 | void GetExports(const tstring &pathToDll, bool displayInfo); 37 | 38 | private: // data members 39 | std::map m_command_lowercase_to_command; 40 | std::map m_command_to_path; 41 | std::map m_command_to_data_handle; 42 | std::map m_command_to_uninstall_data_handle; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /System/nsis/Plugins.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Plugins.h 3 | * 4 | * This file is a part of NSIS. 5 | * 6 | * Copyright (C) 1999-2009 Nullsoft and Contributors 7 | * 8 | * Licensed under the zlib/libpng license (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * 11 | * Licence details can be found in the file COPYING. 12 | * 13 | * This software is provided 'as-is', without any express or implied 14 | * warranty. 15 | * 16 | * Unicode support by Jim Park -- 08/21/2007 17 | */ 18 | 19 | #ifndef __X18_PLUGINS_H 20 | #define __X18_PLUGINS_H 21 | 22 | #include 23 | #include "tstring.h" 24 | 25 | class Plugins 26 | { 27 | public: 28 | void FindCommands(const tstring& path, bool displayInfo); 29 | bool IsPluginCommand(const tstring& command) const; 30 | tstring NormalizedCommand(const tstring& command) const; 31 | int GetPluginHandle(bool uninst, const tstring& command) const; 32 | tstring GetPluginPath(const tstring& command) const; 33 | void SetDllDataHandle(bool uninst, const tstring& command, int dataHandle); 34 | 35 | private: // methods 36 | void GetExports(const tstring &pathToDll, bool displayInfo); 37 | 38 | private: // data members 39 | std::map m_command_lowercase_to_command; 40 | std::map m_command_to_path; 41 | std::map m_command_to_data_handle; 42 | std::map m_command_to_uninstall_data_handle; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /System/stdafx.c: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // AnyDLL.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /System/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 7 | #pragma once 8 | #endif 9 | 10 | #ifndef STDAFX_H 11 | #define STDAFX_H 12 | 13 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 14 | // Windows Header Files: 15 | #include 16 | 17 | // TODO: reference additional headers your program requires here 18 | //#define SYSTEM_LOG_DEBUG 19 | 20 | #endif /* STDAFX_H */ 21 | -------------------------------------------------------------------------------- /Text.txt: -------------------------------------------------------------------------------- 1 | // * the installer is composed of the following parts: 2 | // exehead (~34kb) 3 | // firstheader (struct firstheader) 4 | // * headers (compressed together): 5 | // header (struct header - contains pointers to all blocks) 6 | // pages (struct page) 7 | // section headers (struct section) 8 | // entries/instructions (struct entry) 9 | // strings (null seperated) 10 | // language tables (language id, dialog offset, language strings) 11 | // colors (struct color) 12 | // data block (compressed files and uninstaller data) 13 | // CRC (optional - 4 bytes) 14 | // 15 | // headers + datablock is at least 512 bytes if CRC enabled 16 | 17 | *headers = [4 compressed length][compressed data] 18 | 19 | [compressed data] = [size][headers][size][uninstaller exe header][size][file 1][size][file2] ... 20 | 21 | [headers] = [header(struct header)][page*NB_PAGES->num][Secstion*NB_SECTION->num] 22 | 23 | 24 | 25 | 26 | nsis dont store the compress method - they simply used the stub.exe with included compressing algorithm. total 6 stubs lzma/bzip/lzw + _solid version. 27 | to detect the compression algorutm you need binary compare files from C:\Program Files (x86)\NSIS\Stubs\ and yours exe, the first 34 kb should be match at 98% 28 | 29 | 30 | lang_table - the array offsets for string table. if you need e 31 | 32 | lang_table[x] = offeset in 33 | 34 | 35 | global_wars[0] - path 36 | global_wars[1] - $0 -------------------------------------------------------------------------------- /Utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Header.h" 4 | void myDelete(TCHAR *buf, int flags); 5 | int is_valid_instpath(TCHAR *s); 6 | TCHAR * mystrcpy(TCHAR *out, const TCHAR *in); 7 | TCHAR * skip_root(TCHAR *path); 8 | void myitoa(TCHAR *s, int d); 9 | void validate_filename(TCHAR *in); 10 | TCHAR * findchar(TCHAR *str, TCHAR c); 11 | int validpathspec(TCHAR *ubuf); 12 | // mini_memcpy takes the number of bytes to copy. 13 | void mini_memcpy(void *out, const void *in, int len); 14 | int mystrlen(const TCHAR *in); 15 | WIN32_FIND_DATA * file_exists(TCHAR *buf); 16 | // Separates a full path to the directory portion and file name portion 17 | // and returns the pointer to the filename portion. 18 | TCHAR * trimslashtoend(TCHAR *buf); 19 | TCHAR *addtrailingslash(TCHAR *str); 20 | #define lastchar(str) *CharPrev(str,str+mystrlen(str)) 21 | TCHAR * mystrcat(TCHAR *out, const TCHAR *concat); 22 | void remove_ro_attr(TCHAR *file); 23 | void MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew); 24 | 25 | enum myGetProcAddressFunctions { 26 | MGA_GetDiskFreeSpaceEx, 27 | MGA_MoveFileEx, 28 | MGA_RegDeleteKeyEx, 29 | MGA_OpenProcessToken, 30 | MGA_LookupPrivilegeValue, 31 | MGA_AdjustTokenPrivileges, 32 | MGA_GetUserDefaultUILanguage, 33 | MGA_SHAutoComplete, 34 | MGA_SHGetFolderPath 35 | }; 36 | 37 | void * myGetProcAddress(const enum myGetProcAddressFunctions func); 38 | HANDLE myOpenFile(const TCHAR *fn, DWORD da, DWORD cd); 39 | void * NSISGetProcAddress(HANDLE dllHandle, TCHAR* funcName); 40 | int myatoi(TCHAR *s); 41 | -------------------------------------------------------------------------------- /_lzma/7zip/Aes.mak: -------------------------------------------------------------------------------- 1 | C_OBJS = $(C_OBJS) \ 2 | $O\Aes.obj 3 | 4 | !IF "$(CPU)" != "IA64" && "$(CPU)" != "MIPS" && "$(CPU)" != "ARM" 5 | ASM_OBJS = $(ASM_OBJS) \ 6 | $O\AesOpt.obj 7 | !ENDIF 8 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/7z/7zCompressionMode.cpp: -------------------------------------------------------------------------------- 1 | // CompressionMethod.cpp 2 | 3 | #include "StdAfx.h" 4 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/7z/7zCompressionMode.h: -------------------------------------------------------------------------------- 1 | // 7zCompressionMode.h 2 | 3 | #ifndef __7Z_COMPRESSION_MODE_H 4 | #define __7Z_COMPRESSION_MODE_H 5 | 6 | #include "../../../Common/MyString.h" 7 | 8 | #include "../../../Windows/PropVariant.h" 9 | 10 | #include "../../Common/MethodProps.h" 11 | 12 | namespace NArchive { 13 | namespace N7z { 14 | 15 | struct CMethodFull: public CMethod 16 | { 17 | UInt32 NumInStreams; 18 | UInt32 NumOutStreams; 19 | bool IsSimpleCoder() const { return (NumInStreams == 1) && (NumOutStreams == 1); } 20 | }; 21 | 22 | struct CBind 23 | { 24 | UInt32 InCoder; 25 | UInt32 InStream; 26 | UInt32 OutCoder; 27 | UInt32 OutStream; 28 | }; 29 | 30 | struct CCompressionMethodMode 31 | { 32 | CObjectVector Methods; 33 | CRecordVector Binds; 34 | #ifndef _7ZIP_ST 35 | UInt32 NumThreads; 36 | #endif 37 | bool PasswordIsDefined; 38 | UString Password; 39 | 40 | bool IsEmpty() const { return (Methods.IsEmpty() && !PasswordIsDefined); } 41 | CCompressionMethodMode(): PasswordIsDefined(false) 42 | #ifndef _7ZIP_ST 43 | , NumThreads(1) 44 | #endif 45 | {} 46 | }; 47 | 48 | }} 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/7z/7zEncode.h: -------------------------------------------------------------------------------- 1 | // 7zEncode.h 2 | 3 | #ifndef __7Z_ENCODE_H 4 | #define __7Z_ENCODE_H 5 | 6 | // #include "../../Common/StreamObjects.h" 7 | 8 | #include "7zCompressionMode.h" 9 | 10 | #include "../Common/CoderMixer2.h" 11 | #include "../Common/CoderMixer2MT.h" 12 | #ifdef _ST_MODE 13 | #include "../Common/CoderMixer2ST.h" 14 | #endif 15 | #include "7zItem.h" 16 | 17 | #include "../../Common/CreateCoder.h" 18 | 19 | namespace NArchive { 20 | namespace N7z { 21 | 22 | class CEncoder 23 | { 24 | NCoderMixer::CCoderMixer2MT *_mixerCoderSpec; 25 | CMyComPtr _mixerCoder; 26 | 27 | CObjectVector _codersInfo; 28 | 29 | CCompressionMethodMode _options; 30 | NCoderMixer::CBindInfo _bindInfo; 31 | NCoderMixer::CBindInfo _decompressBindInfo; 32 | NCoderMixer::CBindReverseConverter *_bindReverseConverter; 33 | CRecordVector _decompressionMethods; 34 | 35 | HRESULT CreateMixerCoder(DECL_EXTERNAL_CODECS_LOC_VARS 36 | const UInt64 *inSizeForReduce); 37 | 38 | bool _constructed; 39 | public: 40 | CEncoder(const CCompressionMethodMode &options); 41 | ~CEncoder(); 42 | HRESULT EncoderConstr(); 43 | HRESULT Encode( 44 | DECL_EXTERNAL_CODECS_LOC_VARS 45 | ISequentialInStream *inStream, 46 | const UInt64 *inStreamSize, const UInt64 *inSizeForReduce, 47 | CFolder &folderItem, 48 | ISequentialOutStream *outStream, 49 | CRecordVector &packSizes, 50 | ICompressProgressInfo *compressProgress); 51 | }; 52 | 53 | }} 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/7z/7zFolderInStream.h: -------------------------------------------------------------------------------- 1 | // 7zFolderInStream.h 2 | 3 | #ifndef __7Z_FOLDER_IN_STREAM_H 4 | #define __7Z_FOLDER_IN_STREAM_H 5 | 6 | #include "../../ICoder.h" 7 | #include "../IArchive.h" 8 | #include "../Common/InStreamWithCRC.h" 9 | 10 | #include "7zItem.h" 11 | 12 | namespace NArchive { 13 | namespace N7z { 14 | 15 | class CFolderInStream: 16 | public ISequentialInStream, 17 | public ICompressGetSubStreamSize, 18 | public CMyUnknownImp 19 | { 20 | CSequentialInStreamWithCRC *_inStreamWithHashSpec; 21 | CMyComPtr _inStreamWithHash; 22 | CMyComPtr _updateCallback; 23 | 24 | bool _currentSizeIsDefined; 25 | bool _fileIsOpen; 26 | UInt64 _currentSize; 27 | UInt64 _filePos; 28 | const UInt32 *_fileIndices; 29 | UInt32 _numFiles; 30 | UInt32 _fileIndex; 31 | 32 | HRESULT OpenStream(); 33 | HRESULT CloseStream(); 34 | void AddDigest(); 35 | 36 | public: 37 | CRecordVector Processed; 38 | CRecordVector CRCs; 39 | CRecordVector Sizes; 40 | 41 | MY_UNKNOWN_IMP1(ICompressGetSubStreamSize) 42 | STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); 43 | STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value); 44 | 45 | CFolderInStream(); 46 | void Init(IArchiveUpdateCallback *updateCallback, const UInt32 *fileIndices, UInt32 numFiles); 47 | UInt64 GetFullSize() const 48 | { 49 | UInt64 size = 0; 50 | for (int i = 0; i < Sizes.Size(); i++) 51 | size += Sizes[i]; 52 | return size; 53 | } 54 | }; 55 | 56 | }} 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/7z/7zFolderOutStream.h: -------------------------------------------------------------------------------- 1 | // 7zFolderOutStream.h 2 | 3 | #ifndef __7Z_FOLDER_OUT_STREAM_H 4 | #define __7Z_FOLDER_OUT_STREAM_H 5 | 6 | #include "../../IStream.h" 7 | #include "../IArchive.h" 8 | #include "../Common/OutStreamWithCRC.h" 9 | 10 | #include "7zIn.h" 11 | 12 | namespace NArchive { 13 | namespace N7z { 14 | 15 | class CFolderOutStream: 16 | public ISequentialOutStream, 17 | public ICompressGetSubStreamSize, 18 | public CMyUnknownImp 19 | { 20 | COutStreamWithCRC *_crcStreamSpec; 21 | CMyComPtr _crcStream; 22 | const CArchiveDatabaseEx *_db; 23 | const CBoolVector *_extractStatuses; 24 | CMyComPtr _extractCallback; 25 | UInt32 _ref2Offset; 26 | UInt32 _startIndex; 27 | int _currentIndex; 28 | bool _testMode; 29 | bool _checkCrc; 30 | bool _fileIsOpen; 31 | UInt64 _rem; 32 | 33 | HRESULT OpenFile(); 34 | HRESULT CloseFileAndSetResult(Int32 res); 35 | HRESULT CloseFileAndSetResult(); 36 | HRESULT ProcessEmptyFiles(); 37 | public: 38 | MY_UNKNOWN_IMP1(ICompressGetSubStreamSize) 39 | 40 | CFolderOutStream(); 41 | 42 | STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); 43 | STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value); 44 | 45 | HRESULT Init( 46 | const CArchiveDatabaseEx *db, 47 | UInt32 ref2Offset, UInt32 startIndex, 48 | const CBoolVector *extractStatuses, 49 | IArchiveExtractCallback *extractCallback, 50 | bool testMode, bool checkCrc); 51 | HRESULT FlushCorrupted(Int32 resultEOperationResult); 52 | HRESULT WasWritingFinished() const 53 | { return (_currentIndex == _extractStatuses->Size()) ? S_OK: E_FAIL; } 54 | }; 55 | 56 | }} 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/7z/7zHeader.cpp: -------------------------------------------------------------------------------- 1 | // 7zHeader.cpp 2 | 3 | #include "StdAfx.h" 4 | #include "7zHeader.h" 5 | 6 | namespace NArchive { 7 | namespace N7z { 8 | 9 | Byte kSignature[kSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C}; 10 | #ifdef _7Z_VOL 11 | Byte kFinishSignature[kSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C + 1}; 12 | #endif 13 | 14 | }} 15 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/7z/7zProperties.h: -------------------------------------------------------------------------------- 1 | // 7zProperties.h 2 | 3 | #ifndef __7Z_PROPERTIES_H 4 | #define __7Z_PROPERTIES_H 5 | 6 | #include "../../PropID.h" 7 | 8 | namespace NArchive { 9 | namespace N7z { 10 | 11 | enum 12 | { 13 | kpidPackedSize0 = kpidUserDefined, 14 | kpidPackedSize1, 15 | kpidPackedSize2, 16 | kpidPackedSize3, 17 | kpidPackedSize4 18 | }; 19 | 20 | }} 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/7z/7zRegister.cpp: -------------------------------------------------------------------------------- 1 | // 7zRegister.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "../../Common/RegisterArc.h" 6 | 7 | #include "7zHandler.h" 8 | static IInArchive *CreateArc() { return new NArchive::N7z::CHandler; } 9 | #ifndef EXTRACT_ONLY 10 | static IOutArchive *CreateArcOut() { return new NArchive::N7z::CHandler; } 11 | #else 12 | #define CreateArcOut 0 13 | #endif 14 | 15 | static CArcInfo g_ArcInfo = 16 | { L"7z", L"7z", 0, 7, {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C}, 6, false, CreateArc, CreateArcOut }; 17 | 18 | REGISTER_ARC(7z) 19 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/7z/7zSpecStream.cpp: -------------------------------------------------------------------------------- 1 | // 7zSpecStream.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "7zSpecStream.h" 6 | 7 | STDMETHODIMP CSequentialInStreamSizeCount2::Read(void *data, UInt32 size, UInt32 *processedSize) 8 | { 9 | UInt32 realProcessedSize; 10 | HRESULT result = _stream->Read(data, size, &realProcessedSize); 11 | _size += realProcessedSize; 12 | if (processedSize != 0) 13 | *processedSize = realProcessedSize; 14 | return result; 15 | } 16 | 17 | STDMETHODIMP CSequentialInStreamSizeCount2::GetSubStreamSize( 18 | UInt64 subStream, UInt64 *value) 19 | { 20 | if (_getSubStreamSize == NULL) 21 | return E_NOTIMPL; 22 | return _getSubStreamSize->GetSubStreamSize(subStream, value); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/7z/7zSpecStream.h: -------------------------------------------------------------------------------- 1 | // 7zSpecStream.h 2 | 3 | #ifndef __7Z_SPEC_STREAM_H 4 | #define __7Z_SPEC_STREAM_H 5 | 6 | #include "../../IStream.h" 7 | #include "../../ICoder.h" 8 | #include "../../../Common/MyCom.h" 9 | 10 | class CSequentialInStreamSizeCount2: 11 | public ISequentialInStream, 12 | public ICompressGetSubStreamSize, 13 | public CMyUnknownImp 14 | { 15 | CMyComPtr _stream; 16 | CMyComPtr _getSubStreamSize; 17 | UInt64 _size; 18 | public: 19 | void Init(ISequentialInStream *stream) 20 | { 21 | _stream = stream; 22 | _getSubStreamSize = 0; 23 | _stream.QueryInterface(IID_ICompressGetSubStreamSize, &_getSubStreamSize); 24 | _size = 0; 25 | } 26 | UInt64 GetSize() const { return _size; } 27 | 28 | MY_UNKNOWN_IMP1(ICompressGetSubStreamSize) 29 | 30 | STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); 31 | 32 | STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value); 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/7z/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // StdAfx.cpp 2 | 3 | #include "StdAfx.h" 4 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/7z/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include "../../../Common/MyWindows.h" 7 | #include "../../../Common/NewHandler.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Archive.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | CreateObject PRIVATE 3 | GetHandlerProperty PRIVATE 4 | GetNumberOfFormats PRIVATE 5 | GetHandlerProperty2 PRIVATE 6 | CreateObject PRIVATE 7 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Archive2.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | CreateObject PRIVATE 3 | GetHandlerProperty PRIVATE 4 | GetNumberOfFormats PRIVATE 5 | GetHandlerProperty2 PRIVATE 6 | CreateObject PRIVATE 7 | GetNumberOfMethods PRIVATE 8 | GetMethodProperty PRIVATE 9 | SetLargePageMode PRIVATE 10 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Common/CrossThreadProgress.cpp: -------------------------------------------------------------------------------- 1 | // CrossThreadProgress.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "CrossThreadProgress.h" 6 | 7 | STDMETHODIMP CCrossThreadProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize) 8 | { 9 | InSize = inSize; 10 | OutSize = outSize; 11 | ProgressEvent.Set(); 12 | WaitEvent.Lock(); 13 | return Result; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Common/CrossThreadProgress.h: -------------------------------------------------------------------------------- 1 | // CrossThreadProgress.h 2 | 3 | #ifndef __CROSSTHREADPROGRESS_H 4 | #define __CROSSTHREADPROGRESS_H 5 | 6 | #include "../../ICoder.h" 7 | #include "../../../Windows/Synchronization.h" 8 | #include "../../../Common/MyCom.h" 9 | 10 | class CCrossThreadProgress: 11 | public ICompressProgressInfo, 12 | public CMyUnknownImp 13 | { 14 | public: 15 | const UInt64 *InSize; 16 | const UInt64 *OutSize; 17 | HRESULT Result; 18 | NWindows::NSynchronization::CAutoResetEvent ProgressEvent; 19 | NWindows::NSynchronization::CAutoResetEvent WaitEvent; 20 | 21 | HRes Create() 22 | { 23 | RINOK(ProgressEvent.CreateIfNotCreated()); 24 | return WaitEvent.CreateIfNotCreated(); 25 | } 26 | void Init() 27 | { 28 | ProgressEvent.Reset(); 29 | WaitEvent.Reset(); 30 | } 31 | 32 | MY_UNKNOWN_IMP 33 | 34 | STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize); 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Common/DummyOutStream.cpp: -------------------------------------------------------------------------------- 1 | // DummyOutStream.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "DummyOutStream.h" 6 | 7 | STDMETHODIMP CDummyOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize) 8 | { 9 | UInt32 realProcessedSize; 10 | HRESULT result; 11 | if(!_stream) 12 | { 13 | realProcessedSize = size; 14 | result = S_OK; 15 | } 16 | else 17 | result = _stream->Write(data, size, &realProcessedSize); 18 | _size += realProcessedSize; 19 | if(processedSize != NULL) 20 | *processedSize = realProcessedSize; 21 | return result; 22 | } 23 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Common/DummyOutStream.h: -------------------------------------------------------------------------------- 1 | // DummyOutStream.h 2 | 3 | #ifndef __DUMMYOUTSTREAM_H 4 | #define __DUMMYOUTSTREAM_H 5 | 6 | #include "../../IStream.h" 7 | #include "Common/MyCom.h" 8 | 9 | class CDummyOutStream: 10 | public ISequentialOutStream, 11 | public CMyUnknownImp 12 | { 13 | CMyComPtr _stream; 14 | UInt64 _size; 15 | public: 16 | void SetStream(ISequentialOutStream *outStream) { _stream = outStream; } 17 | void ReleaseStream() { _stream.Release(); } 18 | void Init() { _size = 0; } 19 | MY_UNKNOWN_IMP 20 | STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); 21 | UInt64 GetSize() const { return _size; } 22 | }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Common/InStreamWithCRC.cpp: -------------------------------------------------------------------------------- 1 | // InStreamWithCRC.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "InStreamWithCRC.h" 6 | 7 | STDMETHODIMP CSequentialInStreamWithCRC::Read(void *data, UInt32 size, UInt32 *processedSize) 8 | { 9 | UInt32 realProcessedSize; 10 | HRESULT result = _stream->Read(data, size, &realProcessedSize); 11 | _size += realProcessedSize; 12 | if (size > 0 && realProcessedSize == 0) 13 | _wasFinished = true; 14 | _crc = CrcUpdate(_crc, data, realProcessedSize); 15 | if(processedSize != NULL) 16 | *processedSize = realProcessedSize; 17 | return result; 18 | } 19 | 20 | STDMETHODIMP CInStreamWithCRC::Read(void *data, UInt32 size, UInt32 *processedSize) 21 | { 22 | UInt32 realProcessedSize; 23 | HRESULT result = _stream->Read(data, size, &realProcessedSize); 24 | /* 25 | if (size > 0 && realProcessedSize == 0) 26 | _wasFinished = true; 27 | */ 28 | _size += realProcessedSize; 29 | _crc = CrcUpdate(_crc, data, realProcessedSize); 30 | if(processedSize != NULL) 31 | *processedSize = realProcessedSize; 32 | return result; 33 | } 34 | 35 | STDMETHODIMP CInStreamWithCRC::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) 36 | { 37 | if (seekOrigin != STREAM_SEEK_SET || offset != 0) 38 | return E_FAIL; 39 | _size = 0; 40 | _crc = CRC_INIT_VAL; 41 | return _stream->Seek(offset, seekOrigin, newPosition); 42 | } 43 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Common/ItemNameUtils.cpp: -------------------------------------------------------------------------------- 1 | // Archive/Common/ItemNameUtils.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "../../../../C/Types.h" 6 | 7 | #include "ItemNameUtils.h" 8 | 9 | namespace NArchive { 10 | namespace NItemName { 11 | 12 | static const wchar_t kOSDirDelimiter = WCHAR_PATH_SEPARATOR; 13 | static const wchar_t kDirDelimiter = L'/'; 14 | 15 | UString MakeLegalName(const UString &name) 16 | { 17 | UString zipName = name; 18 | zipName.Replace(kOSDirDelimiter, kDirDelimiter); 19 | return zipName; 20 | } 21 | 22 | UString GetOSName(const UString &name) 23 | { 24 | UString newName = name; 25 | newName.Replace(kDirDelimiter, kOSDirDelimiter); 26 | return newName; 27 | } 28 | 29 | UString GetOSName2(const UString &name) 30 | { 31 | if (name.IsEmpty()) 32 | return UString(); 33 | UString newName = GetOSName(name); 34 | if (newName[newName.Length() - 1] == kOSDirDelimiter) 35 | newName.Delete(newName.Length() - 1); 36 | return newName; 37 | } 38 | 39 | bool HasTailSlash(const AString &name, UINT codePage) 40 | { 41 | if (name.IsEmpty()) 42 | return false; 43 | LPCSTR prev = 44 | #if defined(_WIN32) && !defined(UNDER_CE) 45 | CharPrevExA((WORD)codePage, name, &name[name.Length()], 0); 46 | #else 47 | (LPCSTR)(name) + (name.Length() - 1); 48 | #endif 49 | return (*prev == '/'); 50 | } 51 | 52 | #ifndef _WIN32 53 | UString WinNameToOSName(const UString &name) 54 | { 55 | UString newName = name; 56 | newName.Replace(L'\\', kOSDirDelimiter); 57 | return newName; 58 | } 59 | #endif 60 | 61 | }} 62 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Common/ItemNameUtils.h: -------------------------------------------------------------------------------- 1 | // Archive/Common/ItemNameUtils.h 2 | 3 | #ifndef __ARCHIVE_ITEMNAMEUTILS_H 4 | #define __ARCHIVE_ITEMNAMEUTILS_H 5 | 6 | #include "../../../Common/MyString.h" 7 | 8 | namespace NArchive { 9 | namespace NItemName { 10 | 11 | UString MakeLegalName(const UString &name); 12 | UString GetOSName(const UString &name); 13 | UString GetOSName2(const UString &name); 14 | bool HasTailSlash(const AString &name, UINT codePage); 15 | 16 | #ifdef _WIN32 17 | inline UString WinNameToOSName(const UString &name) { return name; } 18 | #else 19 | UString WinNameToOSName(const UString &name); 20 | #endif 21 | 22 | }} 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Common/OutStreamWithCRC.cpp: -------------------------------------------------------------------------------- 1 | // OutStreamWithCRC.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "OutStreamWithCRC.h" 6 | 7 | STDMETHODIMP COutStreamWithCRC::Write(const void *data, UInt32 size, UInt32 *processedSize) 8 | { 9 | HRESULT result = S_OK; 10 | if (_stream) 11 | result = _stream->Write(data, size, &size); 12 | if (_calculate) 13 | _crc = CrcUpdate(_crc, data, size); 14 | _size += size; 15 | if (processedSize != NULL) 16 | *processedSize = size; 17 | return result; 18 | } 19 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Common/OutStreamWithCRC.h: -------------------------------------------------------------------------------- 1 | // OutStreamWithCRC.h 2 | 3 | #ifndef __OUT_STREAM_WITH_CRC_H 4 | #define __OUT_STREAM_WITH_CRC_H 5 | 6 | #include "../../../../C/7zCrc.h" 7 | 8 | #include "../../../Common/MyCom.h" 9 | 10 | #include "../../IStream.h" 11 | 12 | class COutStreamWithCRC: 13 | public ISequentialOutStream, 14 | public CMyUnknownImp 15 | { 16 | CMyComPtr _stream; 17 | UInt64 _size; 18 | UInt32 _crc; 19 | bool _calculate; 20 | public: 21 | MY_UNKNOWN_IMP 22 | STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); 23 | void SetStream(ISequentialOutStream *stream) { _stream = stream; } 24 | void ReleaseStream() { _stream.Release(); } 25 | void Init(bool calculate = true) 26 | { 27 | _size = 0; 28 | _calculate = calculate; 29 | _crc = CRC_INIT_VAL; 30 | } 31 | void InitCRC() { _crc = CRC_INIT_VAL; } 32 | UInt64 GetSize() const { return _size; } 33 | UInt32 GetCRC() const { return CRC_GET_DIGEST(_crc); } 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Common/ParseProperties.h: -------------------------------------------------------------------------------- 1 | // ParseProperties.h 2 | 3 | #ifndef __PARSEPROPERTIES_H 4 | #define __PARSEPROPERTIES_H 5 | 6 | #include "Common/MyString.h" 7 | #include "Common/Types.h" 8 | 9 | HRESULT ParsePropValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue); 10 | HRESULT ParsePropDictionaryValue(const UString &srcStringSpec, UInt32 &dicSize); 11 | HRESULT ParsePropDictionaryValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue); 12 | 13 | bool StringToBool(const UString &s, bool &res); 14 | HRESULT SetBoolProperty(bool &dest, const PROPVARIANT &value); 15 | int ParseStringToUInt32(const UString &srcString, UInt32 &number); 16 | HRESULT ParseMtProp(const UString &name, const PROPVARIANT &prop, UInt32 defaultNumThreads, UInt32 &numThreads); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Common/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include "../../../Common/MyWindows.h" 7 | #include "../../../Common/NewHandler.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /_lzma/7zip/Archive/Icons/7z.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/_lzma/7zip/Archive/Icons/7z.ico -------------------------------------------------------------------------------- /_lzma/7zip/Archive/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include "../../Common/MyWindows.h" 7 | #include "../../Common/NewHandler.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /_lzma/7zip/Asm.mak: -------------------------------------------------------------------------------- 1 | !IF "$(CPU)" == "ARM" 2 | $(ASM_OBJS): ../../../../Asm/Arm/$(*B).asm 3 | $(COMPL_ASM) 4 | !ELSEIF "$(CPU)" != "IA64" && "$(CPU)" != "MIPS" 5 | $(ASM_OBJS): ../../../../Asm/x86/$(*B).asm 6 | $(COMPL_ASM) 7 | !ENDIF 8 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/Alone7z/Alone.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "Alone"=.\Alone.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/Alone7z/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // StdAfx.cpp 2 | 3 | #include "StdAfx.h" 4 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/Alone7z/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include "../../../Common/MyWindows.h" 7 | #include "../../../Common/NewHandler.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/Alone7z/resource.rc: -------------------------------------------------------------------------------- 1 | #include "../../MyVersionInfo.rc" 2 | 3 | MY_VERSION_INFO_APP("7-Zip Standalone Console", "7zr") 4 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/Format7zExtractR/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // StdAfx.cpp 2 | 3 | #include "StdAfx.h" 4 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/Format7zExtractR/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include "../../../Common/MyWindows.h" 7 | #include "../../../Common/NewHandler.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/Format7zExtractR/resource.rc: -------------------------------------------------------------------------------- 1 | #include "../../MyVersionInfo.rc" 2 | 3 | MY_VERSION_INFO_DLL("7z Standalone Extracting Plugin", "7zxr") 4 | 5 | 101 ICON "../../Archive/Icons/7z.ico" 6 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/Format7zR/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // StdAfx.cpp 2 | 3 | #include "StdAfx.h" 4 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/Format7zR/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include "../../../Common/MyWindows.h" 7 | #include "../../../Common/NewHandler.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/Format7zR/resource.rc: -------------------------------------------------------------------------------- 1 | #include "../../MyVersionInfo.rc" 2 | 3 | MY_VERSION_INFO_DLL("7z Standalone Plugin", "7zr") 4 | 5 | 101 ICON "../../Archive/Icons/7z.ico" 6 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/LzmaCon/LzmaCon.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "LzmaCon"=.\LzmaCon.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/LzmaCon/LzmaCon.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LzmaCon", "LzmaCon.vcproj", "{78955E6A-DD61-4F8A-AAF6-3D248E415A17}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {78955E6A-DD61-4F8A-AAF6-3D248E415A17}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {78955E6A-DD61-4F8A-AAF6-3D248E415A17}.Debug|Win32.Build.0 = Debug|Win32 14 | {78955E6A-DD61-4F8A-AAF6-3D248E415A17}.Release|Win32.ActiveCfg = Release|Win32 15 | {78955E6A-DD61-4F8A-AAF6-3D248E415A17}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/LzmaCon/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // StdAfx.cpp 2 | 3 | #include "StdAfx.h" 4 | -------------------------------------------------------------------------------- /_lzma/7zip/Bundles/LzmaCon/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include "../../../Common/MyWindows.h" 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/FilePathAutoRename.cpp: -------------------------------------------------------------------------------- 1 | // FilePathAutoRename.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "Common/Defs.h" 6 | #include "Common/IntToString.h" 7 | 8 | #include "Windows/FileFind.h" 9 | 10 | #include "FilePathAutoRename.h" 11 | 12 | using namespace NWindows; 13 | 14 | static bool MakeAutoName(const UString &name, 15 | const UString &extension, unsigned value, UString &path) 16 | { 17 | wchar_t number[16]; 18 | ConvertUInt32ToString(value, number); 19 | path = name; 20 | path += number; 21 | path += extension; 22 | return NFile::NFind::DoesFileOrDirExist(path); 23 | } 24 | 25 | bool AutoRenamePath(UString &fullProcessedPath) 26 | { 27 | UString path; 28 | int dotPos = fullProcessedPath.ReverseFind(L'.'); 29 | 30 | int slashPos = fullProcessedPath.ReverseFind(L'/'); 31 | #ifdef _WIN32 32 | int slash1Pos = fullProcessedPath.ReverseFind(L'\\'); 33 | slashPos = MyMax(slashPos, slash1Pos); 34 | #endif 35 | 36 | UString name, extension; 37 | if (dotPos > slashPos && dotPos > 0) 38 | { 39 | name = fullProcessedPath.Left(dotPos); 40 | extension = fullProcessedPath.Mid(dotPos); 41 | } 42 | else 43 | name = fullProcessedPath; 44 | name += L'_'; 45 | unsigned left = 1, right = (1 << 30); 46 | while (left != right) 47 | { 48 | unsigned mid = (left + right) / 2; 49 | if (MakeAutoName(name, extension, mid, path)) 50 | left = mid + 1; 51 | else 52 | right = mid; 53 | } 54 | return !MakeAutoName(name, extension, right, fullProcessedPath); 55 | } 56 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/FilePathAutoRename.h: -------------------------------------------------------------------------------- 1 | // Util/FilePathAutoRename.h 2 | 3 | #ifndef __FILEPATHAUTORENAME_H 4 | #define __FILEPATHAUTORENAME_H 5 | 6 | #include "Common/MyString.h" 7 | 8 | bool AutoRenamePath(UString &fullProcessedPath); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/InOutTempBuffer.h: -------------------------------------------------------------------------------- 1 | // InOutTempBuffer.h 2 | 3 | #ifndef __IN_OUT_TEMP_BUFFER_H 4 | #define __IN_OUT_TEMP_BUFFER_H 5 | 6 | #include "../../Common/MyCom.h" 7 | #include "../../Windows/FileDir.h" 8 | #include "../../Windows/FileIO.h" 9 | 10 | #include "../IStream.h" 11 | 12 | class CInOutTempBuffer 13 | { 14 | NWindows::NFile::NDirectory::CTempFile _tempFile; 15 | NWindows::NFile::NIO::COutFile _outFile; 16 | Byte *_buf; 17 | UInt32 _bufPos; 18 | CSysString _tempFileName; 19 | bool _tempFileCreated; 20 | UInt64 _size; 21 | UInt32 _crc; 22 | 23 | bool WriteToFile(const void *data, UInt32 size); 24 | public: 25 | CInOutTempBuffer(); 26 | ~CInOutTempBuffer(); 27 | void Create(); 28 | 29 | void InitWriting(); 30 | bool Write(const void *data, UInt32 size); 31 | 32 | HRESULT WriteToStream(ISequentialOutStream *stream); 33 | UInt64 GetDataSize() const { return _size; } 34 | }; 35 | 36 | class CSequentialOutTempBufferImp: 37 | public ISequentialOutStream, 38 | public CMyUnknownImp 39 | { 40 | CInOutTempBuffer *_buf; 41 | public: 42 | void Init(CInOutTempBuffer *buffer) { _buf = buffer; } 43 | MY_UNKNOWN_IMP 44 | 45 | STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/LockedStream.cpp: -------------------------------------------------------------------------------- 1 | // LockedStream.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "LockedStream.h" 6 | 7 | HRESULT CLockedInStream::Read(UInt64 startPos, void *data, UInt32 size, 8 | UInt32 *processedSize) 9 | { 10 | NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); 11 | RINOK(_stream->Seek(startPos, STREAM_SEEK_SET, NULL)); 12 | return _stream->Read(data, size, processedSize); 13 | } 14 | 15 | STDMETHODIMP CLockedSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize) 16 | { 17 | UInt32 realProcessedSize = 0; 18 | HRESULT result = _lockedInStream->Read(_pos, data, size, &realProcessedSize); 19 | _pos += realProcessedSize; 20 | if (processedSize != NULL) 21 | *processedSize = realProcessedSize; 22 | return result; 23 | } 24 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/LockedStream.h: -------------------------------------------------------------------------------- 1 | // LockedStream.h 2 | 3 | #ifndef __LOCKEDSTREAM_H 4 | #define __LOCKEDSTREAM_H 5 | 6 | #include "../../Windows/Synchronization.h" 7 | #include "../../Common/MyCom.h" 8 | #include "../IStream.h" 9 | 10 | class CLockedInStream 11 | { 12 | CMyComPtr _stream; 13 | NWindows::NSynchronization::CCriticalSection _criticalSection; 14 | public: 15 | void Init(IInStream *stream) 16 | { _stream = stream; } 17 | HRESULT Read(UInt64 startPos, void *data, UInt32 size, UInt32 *processedSize); 18 | }; 19 | 20 | class CLockedSequentialInStreamImp: 21 | public ISequentialInStream, 22 | public CMyUnknownImp 23 | { 24 | CLockedInStream *_lockedInStream; 25 | UInt64 _pos; 26 | public: 27 | void Init(CLockedInStream *lockedInStream, UInt64 startPos) 28 | { 29 | _lockedInStream = lockedInStream; 30 | _pos = startPos; 31 | } 32 | 33 | MY_UNKNOWN_IMP 34 | 35 | STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/MethodId.cpp: -------------------------------------------------------------------------------- 1 | // MethodId.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "MethodId.h" 6 | #include "../../Common/MyString.h" 7 | 8 | static inline wchar_t GetHex(Byte value) 9 | { 10 | return (wchar_t)((value < 10) ? ('0' + value) : ('A' + (value - 10))); 11 | } 12 | 13 | UString ConvertMethodIdToString(UInt64 id) 14 | { 15 | wchar_t s[32]; 16 | int len = 32; 17 | s[--len] = 0; 18 | do 19 | { 20 | s[--len] = GetHex((Byte)id & 0xF); 21 | id >>= 4; 22 | s[--len] = GetHex((Byte)id & 0xF); 23 | id >>= 4; 24 | } 25 | while (id != 0); 26 | return s + len; 27 | } 28 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/MethodId.h: -------------------------------------------------------------------------------- 1 | // MethodId.h 2 | 3 | #ifndef __7Z_METHOD_ID_H 4 | #define __7Z_METHOD_ID_H 5 | 6 | #include "../../Common/Types.h" 7 | 8 | typedef UInt64 CMethodId; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/MethodProps.h: -------------------------------------------------------------------------------- 1 | // MethodProps.h 2 | 3 | #ifndef __7Z_METHOD_PROPS_H 4 | #define __7Z_METHOD_PROPS_H 5 | 6 | #include "../../Common/MyVector.h" 7 | 8 | #include "../../Windows/PropVariant.h" 9 | 10 | #include "MethodId.h" 11 | 12 | struct CProp 13 | { 14 | PROPID Id; 15 | NWindows::NCOM::CPropVariant Value; 16 | }; 17 | 18 | struct CMethod 19 | { 20 | CMethodId Id; 21 | CObjectVector Props; 22 | }; 23 | 24 | struct CMethodsMode 25 | { 26 | CObjectVector Methods; 27 | #ifndef _7ZIP_ST 28 | UInt32 NumThreads; 29 | #endif 30 | 31 | CMethodsMode() 32 | #ifndef _7ZIP_ST 33 | : NumThreads(1) 34 | #endif 35 | {} 36 | bool IsEmpty() const { return Methods.IsEmpty() ; } 37 | }; 38 | 39 | HRESULT SetMethodProperties(const CMethod &method, const UInt64 *inSizeForReduce, IUnknown *coder); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/OffsetStream.cpp: -------------------------------------------------------------------------------- 1 | // OffsetStream.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "Common/Defs.h" 6 | #include "OffsetStream.h" 7 | 8 | HRESULT COffsetOutStream::Init(IOutStream *stream, UInt64 offset) 9 | { 10 | _offset = offset; 11 | _stream = stream; 12 | return _stream->Seek(offset, STREAM_SEEK_SET, NULL); 13 | } 14 | 15 | STDMETHODIMP COffsetOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize) 16 | { 17 | return _stream->Write(data, size, processedSize); 18 | } 19 | 20 | STDMETHODIMP COffsetOutStream::Seek(Int64 offset, UInt32 seekOrigin, 21 | UInt64 *newPosition) 22 | { 23 | UInt64 absoluteNewPosition; 24 | if (seekOrigin == STREAM_SEEK_SET) 25 | offset += _offset; 26 | HRESULT result = _stream->Seek(offset, seekOrigin, &absoluteNewPosition); 27 | if (newPosition != NULL) 28 | *newPosition = absoluteNewPosition - _offset; 29 | return result; 30 | } 31 | 32 | STDMETHODIMP COffsetOutStream::SetSize(UInt64 newSize) 33 | { 34 | return _stream->SetSize(_offset + newSize); 35 | } 36 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/OffsetStream.h: -------------------------------------------------------------------------------- 1 | // OffsetStream.h 2 | 3 | #ifndef __OFFSETSTREAM_H 4 | #define __OFFSETSTREAM_H 5 | 6 | #include "Common/MyCom.h" 7 | #include "../IStream.h" 8 | 9 | class COffsetOutStream: 10 | public IOutStream, 11 | public CMyUnknownImp 12 | { 13 | UInt64 _offset; 14 | CMyComPtr _stream; 15 | public: 16 | HRESULT Init(IOutStream *stream, UInt64 offset); 17 | 18 | MY_UNKNOWN_IMP 19 | 20 | STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); 21 | STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition); 22 | STDMETHOD(SetSize)(UInt64 newSize); 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/OutBuffer.h: -------------------------------------------------------------------------------- 1 | // OutBuffer.h 2 | 3 | #ifndef __OUTBUFFER_H 4 | #define __OUTBUFFER_H 5 | 6 | #include "../IStream.h" 7 | #include "../../Common/MyCom.h" 8 | #include "../../Common/MyException.h" 9 | 10 | #ifndef _NO_EXCEPTIONS 11 | struct COutBufferException: public CSystemException 12 | { 13 | COutBufferException(HRESULT errorCode): CSystemException(errorCode) {} 14 | }; 15 | #endif 16 | 17 | class COutBuffer 18 | { 19 | protected: 20 | Byte *_buffer; 21 | UInt32 _pos; 22 | UInt32 _limitPos; 23 | UInt32 _streamPos; 24 | UInt32 _bufferSize; 25 | CMyComPtr _stream; 26 | UInt64 _processedSize; 27 | Byte *_buffer2; 28 | bool _overDict; 29 | 30 | HRESULT FlushPart(); 31 | public: 32 | #ifdef _NO_EXCEPTIONS 33 | HRESULT ErrorCode; 34 | #endif 35 | 36 | COutBuffer(): _buffer(0), _pos(0), _stream(0), _buffer2(0) {} 37 | ~COutBuffer() { Free(); } 38 | 39 | bool Create(UInt32 bufferSize); 40 | void Free(); 41 | 42 | void SetMemStream(Byte *buffer) { _buffer2 = buffer; } 43 | void SetStream(ISequentialOutStream *stream); 44 | void Init(); 45 | HRESULT Flush(); 46 | void FlushWithCheck(); 47 | void ReleaseStream() { _stream.Release(); } 48 | 49 | void WriteByte(Byte b) 50 | { 51 | _buffer[_pos++] = b; 52 | if(_pos == _limitPos) 53 | FlushWithCheck(); 54 | } 55 | void WriteBytes(const void *data, size_t size) 56 | { 57 | for (size_t i = 0; i < size; i++) 58 | WriteByte(((const Byte *)data)[i]); 59 | } 60 | 61 | UInt64 GetProcessedSize() const; 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/ProgressUtils.cpp: -------------------------------------------------------------------------------- 1 | // ProgressUtils.h 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "ProgressUtils.h" 6 | 7 | CLocalProgress::CLocalProgress() 8 | { 9 | ProgressOffset = InSize = OutSize = 0; 10 | SendRatio = SendProgress = true; 11 | } 12 | 13 | void CLocalProgress::Init(IProgress *progress, bool inSizeIsMain) 14 | { 15 | _ratioProgress.Release(); 16 | _progress = progress; 17 | _progress.QueryInterface(IID_ICompressProgressInfo, &_ratioProgress); 18 | _inSizeIsMain = inSizeIsMain; 19 | } 20 | 21 | STDMETHODIMP CLocalProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize) 22 | { 23 | UInt64 inSizeNew = InSize, outSizeNew = OutSize; 24 | if (inSize) 25 | inSizeNew += (*inSize); 26 | if (outSize) 27 | outSizeNew += (*outSize); 28 | if (SendRatio && _ratioProgress) 29 | { 30 | RINOK(_ratioProgress->SetRatioInfo(&inSizeNew, &outSizeNew)); 31 | } 32 | inSizeNew += ProgressOffset; 33 | outSizeNew += ProgressOffset; 34 | if (SendProgress) 35 | return _progress->SetCompleted(_inSizeIsMain ? &inSizeNew : &outSizeNew); 36 | return S_OK; 37 | } 38 | 39 | HRESULT CLocalProgress::SetCur() 40 | { 41 | return SetRatioInfo(NULL, NULL); 42 | } 43 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/ProgressUtils.h: -------------------------------------------------------------------------------- 1 | // ProgressUtils.h 2 | 3 | #ifndef __PROGRESSUTILS_H 4 | #define __PROGRESSUTILS_H 5 | 6 | #include "../../Common/MyCom.h" 7 | 8 | #include "../ICoder.h" 9 | #include "../IProgress.h" 10 | 11 | class CLocalProgress: 12 | public ICompressProgressInfo, 13 | public CMyUnknownImp 14 | { 15 | CMyComPtr _progress; 16 | CMyComPtr _ratioProgress; 17 | bool _inSizeIsMain; 18 | public: 19 | UInt64 ProgressOffset; 20 | UInt64 InSize; 21 | UInt64 OutSize; 22 | bool SendRatio; 23 | bool SendProgress; 24 | 25 | CLocalProgress(); 26 | void Init(IProgress *progress, bool inSizeIsMain); 27 | HRESULT SetCur(); 28 | 29 | MY_UNKNOWN_IMP 30 | 31 | STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize); 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/RegisterArc.h: -------------------------------------------------------------------------------- 1 | // RegisterArc.h 2 | 3 | #ifndef __REGISTER_ARC_H 4 | #define __REGISTER_ARC_H 5 | 6 | #include "../Archive/IArchive.h" 7 | 8 | typedef IInArchive * (*CreateInArchiveP)(); 9 | typedef IOutArchive * (*CreateOutArchiveP)(); 10 | 11 | struct CArcInfo 12 | { 13 | const wchar_t *Name; 14 | const wchar_t *Ext; 15 | const wchar_t *AddExt; 16 | Byte ClassId; 17 | Byte Signature[16]; 18 | int SignatureSize; 19 | bool KeepName; 20 | CreateInArchiveP CreateInArchive; 21 | CreateOutArchiveP CreateOutArchive; 22 | }; 23 | 24 | void RegisterArc(const CArcInfo *arcInfo); 25 | 26 | #define REGISTER_ARC_NAME(x) CRegister ## x 27 | 28 | #define REGISTER_ARC(x) struct REGISTER_ARC_NAME(x) { \ 29 | REGISTER_ARC_NAME(x)() { RegisterArc(&g_ArcInfo); }}; \ 30 | static REGISTER_ARC_NAME(x) g_RegisterArc; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/RegisterCodec.h: -------------------------------------------------------------------------------- 1 | // RegisterCodec.h 2 | 3 | #ifndef __REGISTERCODEC_H 4 | #define __REGISTERCODEC_H 5 | 6 | #include "../Common/MethodId.h" 7 | 8 | typedef void * (*CreateCodecP)(); 9 | struct CCodecInfo 10 | { 11 | CreateCodecP CreateDecoder; 12 | CreateCodecP CreateEncoder; 13 | CMethodId Id; 14 | const wchar_t *Name; 15 | UInt32 NumInStreams; 16 | bool IsFilter; 17 | }; 18 | 19 | void RegisterCodec(const CCodecInfo *codecInfo); 20 | 21 | #define REGISTER_CODEC_NAME(x) CRegisterCodec ## x 22 | 23 | #define REGISTER_CODEC(x) struct REGISTER_CODEC_NAME(x) { \ 24 | REGISTER_CODEC_NAME(x)() { RegisterCodec(&g_CodecInfo); }}; \ 25 | static REGISTER_CODEC_NAME(x) g_RegisterCodec; 26 | 27 | #define REGISTER_CODECS_NAME(x) CRegisterCodecs ## x 28 | #define REGISTER_CODECS(x) struct REGISTER_CODECS_NAME(x) { \ 29 | REGISTER_CODECS_NAME(x)() { for (int i = 0; i < sizeof(g_CodecsInfo) / sizeof(g_CodecsInfo[0]); i++) \ 30 | RegisterCodec(&g_CodecsInfo[i]); }}; \ 31 | static REGISTER_CODECS_NAME(x) g_RegisterCodecs; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include "../../Common/MyWindows.h" 7 | #include "../../Common/NewHandler.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/StreamBinder.h: -------------------------------------------------------------------------------- 1 | // StreamBinder.h 2 | 3 | #ifndef __STREAMBINDER_H 4 | #define __STREAMBINDER_H 5 | 6 | #include "../IStream.h" 7 | #include "../../Windows/Synchronization.h" 8 | 9 | class CStreamBinder 10 | { 11 | NWindows::NSynchronization::CManualResetEvent _allBytesAreWritenEvent; 12 | NWindows::NSynchronization::CManualResetEvent _thereAreBytesToReadEvent; 13 | NWindows::NSynchronization::CManualResetEvent _readStreamIsClosedEvent; 14 | UInt32 _bufferSize; 15 | const void *_buffer; 16 | public: 17 | // bool ReadingWasClosed; 18 | UInt64 ProcessedSize; 19 | CStreamBinder() {} 20 | HRes CreateEvents(); 21 | 22 | void CreateStreams(ISequentialInStream **inStream, 23 | ISequentialOutStream **outStream); 24 | HRESULT Read(void *data, UInt32 size, UInt32 *processedSize); 25 | void CloseRead(); 26 | 27 | HRESULT Write(const void *data, UInt32 size, UInt32 *processedSize); 28 | void CloseWrite(); 29 | void ReInit(); 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/StreamUtils.h: -------------------------------------------------------------------------------- 1 | // StreamUtils.h 2 | 3 | #ifndef __STREAMUTILS_H 4 | #define __STREAMUTILS_H 5 | 6 | #include "../IStream.h" 7 | 8 | HRESULT ReadStream(ISequentialInStream *stream, void *data, size_t *size); 9 | HRESULT ReadStream_FALSE(ISequentialInStream *stream, void *data, size_t size); 10 | HRESULT ReadStream_FAIL(ISequentialInStream *stream, void *data, size_t size); 11 | HRESULT WriteStream(ISequentialOutStream *stream, const void *data, size_t size); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/VirtThread.cpp: -------------------------------------------------------------------------------- 1 | // VirtThread.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "VirtThread.h" 6 | 7 | static THREAD_FUNC_DECL CoderThread(void *p) 8 | { 9 | for (;;) 10 | { 11 | CVirtThread *t = (CVirtThread *)p; 12 | t->StartEvent.Lock(); 13 | if (t->ExitEvent) 14 | return 0; 15 | t->Execute(); 16 | t->FinishedEvent.Set(); 17 | } 18 | } 19 | 20 | WRes CVirtThread::Create() 21 | { 22 | RINOK(StartEvent.CreateIfNotCreated()); 23 | RINOK(FinishedEvent.CreateIfNotCreated()); 24 | StartEvent.Reset(); 25 | FinishedEvent.Reset(); 26 | ExitEvent = false; 27 | if (Thread.IsCreated()) 28 | return S_OK; 29 | return Thread.Create(CoderThread, this); 30 | } 31 | 32 | void CVirtThread::Start() 33 | { 34 | ExitEvent = false; 35 | StartEvent.Set(); 36 | } 37 | 38 | CVirtThread::~CVirtThread() 39 | { 40 | ExitEvent = true; 41 | if (StartEvent.IsCreated()) 42 | StartEvent.Set(); 43 | if (Thread.IsCreated()) 44 | Thread.Wait(); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /_lzma/7zip/Common/VirtThread.h: -------------------------------------------------------------------------------- 1 | // VirtThread.h 2 | 3 | #ifndef __VIRTTHREAD_H 4 | #define __VIRTTHREAD_H 5 | 6 | #include "../../Windows/Synchronization.h" 7 | #include "../../Windows/Thread.h" 8 | 9 | struct CVirtThread 10 | { 11 | NWindows::NSynchronization::CAutoResetEvent StartEvent; 12 | NWindows::NSynchronization::CAutoResetEvent FinishedEvent; 13 | NWindows::CThread Thread; 14 | bool ExitEvent; 15 | 16 | ~CVirtThread(); 17 | WRes Create(); 18 | void Start(); 19 | void WaitFinish() { FinishedEvent.Lock(); } 20 | virtual void Execute() = 0; 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/Bcj2Register.cpp: -------------------------------------------------------------------------------- 1 | // Bcj2Register.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "../Common/RegisterCodec.h" 6 | 7 | #include "Bcj2Coder.h" 8 | 9 | static void *CreateCodec() { return (void *)(ICompressCoder2 *)(new NCompress::NBcj2::CDecoder()); } 10 | #ifndef EXTRACT_ONLY 11 | static void *CreateCodecOut() { return (void *)(ICompressCoder2 *)(new NCompress::NBcj2::CEncoder()); } 12 | #else 13 | #define CreateCodecOut 0 14 | #endif 15 | 16 | static CCodecInfo g_CodecInfo = 17 | { CreateCodec, CreateCodecOut, 0x0303011B, L"BCJ2", 4, false }; 18 | 19 | REGISTER_CODEC(BCJ2) 20 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/BcjCoder.cpp: -------------------------------------------------------------------------------- 1 | // BcjCoder.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "BcjCoder.h" 6 | 7 | UInt32 CBCJ_x86_Encoder::SubFilter(Byte *data, UInt32 size) 8 | { 9 | return (UInt32)::x86_Convert(data, size, _bufferPos, &_prevMask, 1); 10 | } 11 | 12 | UInt32 CBCJ_x86_Decoder::SubFilter(Byte *data, UInt32 size) 13 | { 14 | return (UInt32)::x86_Convert(data, size, _bufferPos, &_prevMask, 0); 15 | } 16 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/BcjCoder.h: -------------------------------------------------------------------------------- 1 | // BcjCoder.h 2 | 3 | #ifndef __COMPRESS_BCJ_CODER_H 4 | #define __COMPRESS_BCJ_CODER_H 5 | 6 | #include "../../../C/Bra.h" 7 | 8 | #include "BranchCoder.h" 9 | 10 | struct CBranch86 11 | { 12 | UInt32 _prevMask; 13 | void x86Init() { x86_Convert_Init(_prevMask); } 14 | }; 15 | 16 | MyClassB(BCJ_x86, 0x01, 3, CBranch86 , 17 | virtual void SubInit() { x86Init(); }) 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/BcjRegister.cpp: -------------------------------------------------------------------------------- 1 | // BcjRegister.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "../Common/RegisterCodec.h" 6 | 7 | #include "BcjCoder.h" 8 | 9 | static void *CreateCodec() { return (void *)(ICompressFilter *)(new CBCJ_x86_Decoder()); } 10 | #ifndef EXTRACT_ONLY 11 | static void *CreateCodecOut() { return (void *)(ICompressFilter *)(new CBCJ_x86_Encoder()); } 12 | #else 13 | #define CreateCodecOut 0 14 | #endif 15 | 16 | static CCodecInfo g_CodecInfo = 17 | { CreateCodec, CreateCodecOut, 0x03030103, L"BCJ", 1, true }; 18 | 19 | REGISTER_CODEC(BCJ) 20 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/BranchCoder.cpp: -------------------------------------------------------------------------------- 1 | // BranchCoder.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "BranchCoder.h" 6 | 7 | STDMETHODIMP CBranchConverter::Init() 8 | { 9 | _bufferPos = 0; 10 | SubInit(); 11 | return S_OK; 12 | } 13 | 14 | STDMETHODIMP_(UInt32) CBranchConverter::Filter(Byte *data, UInt32 size) 15 | { 16 | UInt32 processedSize = SubFilter(data, size); 17 | _bufferPos += processedSize; 18 | return processedSize; 19 | } 20 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/BranchCoder.h: -------------------------------------------------------------------------------- 1 | // BranchCoder.h 2 | 3 | #ifndef __COMPRESS_BRANCH_CODER_H 4 | #define __COMPRESS_BRANCH_CODER_H 5 | 6 | #include "../../Common/MyCom.h" 7 | 8 | #include "../ICoder.h" 9 | 10 | class CBranchConverter: 11 | public ICompressFilter, 12 | public CMyUnknownImp 13 | { 14 | protected: 15 | UInt32 _bufferPos; 16 | virtual void SubInit() {} 17 | virtual UInt32 SubFilter(Byte *data, UInt32 size) = 0; 18 | public: 19 | MY_UNKNOWN_IMP; 20 | STDMETHOD(Init)(); 21 | STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size); 22 | }; 23 | 24 | #define MyClassEncoderA(Name) class C ## Name: public CBranchConverter \ 25 | { public: UInt32 SubFilter(Byte *data, UInt32 size); }; 26 | 27 | #define MyClassDecoderA(Name) class C ## Name: public CBranchConverter \ 28 | { public: UInt32 SubFilter(Byte *data, UInt32 size); }; 29 | 30 | #define MyClassEncoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \ 31 | { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT}; 32 | 33 | #define MyClassDecoderB(Name, ADD_ITEMS, ADD_INIT) class C ## Name: public CBranchConverter, public ADD_ITEMS \ 34 | { public: UInt32 SubFilter(Byte *data, UInt32 size); ADD_INIT}; 35 | 36 | #define MyClassA(Name, id, subId) \ 37 | MyClassEncoderA(Name ## _Encoder) \ 38 | MyClassDecoderA(Name ## _Decoder) 39 | 40 | #define MyClassB(Name, id, subId, ADD_ITEMS, ADD_INIT) \ 41 | MyClassEncoderB(Name ## _Encoder, ADD_ITEMS, ADD_INIT) \ 42 | MyClassDecoderB(Name ## _Decoder, ADD_ITEMS, ADD_INIT) 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/BranchMisc.cpp: -------------------------------------------------------------------------------- 1 | // BranchMisc.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "../../../C/Bra.h" 6 | 7 | #include "BranchMisc.h" 8 | 9 | UInt32 CBC_ARM_Encoder::SubFilter(Byte *data, UInt32 size) 10 | { return (UInt32)::ARM_Convert(data, size, _bufferPos, 1); } 11 | 12 | UInt32 CBC_ARM_Decoder::SubFilter(Byte *data, UInt32 size) 13 | { return (UInt32)::ARM_Convert(data, size, _bufferPos, 0); } 14 | 15 | UInt32 CBC_ARMT_Encoder::SubFilter(Byte *data, UInt32 size) 16 | { return (UInt32)::ARMT_Convert(data, size, _bufferPos, 1); } 17 | 18 | UInt32 CBC_ARMT_Decoder::SubFilter(Byte *data, UInt32 size) 19 | { return (UInt32)::ARMT_Convert(data, size, _bufferPos, 0); } 20 | 21 | UInt32 CBC_PPC_Encoder::SubFilter(Byte *data, UInt32 size) 22 | { return (UInt32)::PPC_Convert(data, size, _bufferPos, 1); } 23 | 24 | UInt32 CBC_PPC_Decoder::SubFilter(Byte *data, UInt32 size) 25 | { return (UInt32)::PPC_Convert(data, size, _bufferPos, 0); } 26 | 27 | UInt32 CBC_SPARC_Encoder::SubFilter(Byte *data, UInt32 size) 28 | { return (UInt32)::SPARC_Convert(data, size, _bufferPos, 1); } 29 | 30 | UInt32 CBC_SPARC_Decoder::SubFilter(Byte *data, UInt32 size) 31 | { return (UInt32)::SPARC_Convert(data, size, _bufferPos, 0); } 32 | 33 | UInt32 CBC_IA64_Encoder::SubFilter(Byte *data, UInt32 size) 34 | { return (UInt32)::IA64_Convert(data, size, _bufferPos, 1); } 35 | 36 | UInt32 CBC_IA64_Decoder::SubFilter(Byte *data, UInt32 size) 37 | { return (UInt32)::IA64_Convert(data, size, _bufferPos, 0); } 38 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/BranchMisc.h: -------------------------------------------------------------------------------- 1 | // BranchMisc.h 2 | 3 | #ifndef __COMPRESS_BRANCH_MISC_H 4 | #define __COMPRESS_BRANCH_MISC_H 5 | 6 | #include "BranchCoder.h" 7 | 8 | MyClassA(BC_ARM, 0x05, 1) 9 | MyClassA(BC_ARMT, 0x07, 1) 10 | MyClassA(BC_PPC, 0x02, 5) 11 | MyClassA(BC_SPARC, 0x08, 5) 12 | MyClassA(BC_IA64, 0x04, 1) 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/BranchRegister.cpp: -------------------------------------------------------------------------------- 1 | // BranchRegister.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "../Common/RegisterCodec.h" 6 | 7 | #include "BranchMisc.h" 8 | 9 | #define CREATE_CODEC(x) \ 10 | static void *CreateCodec ## x() { return (void *)(ICompressFilter *)(new C ## x ## _Decoder); } \ 11 | static void *CreateCodec ## x ## Out() { return (void *)(ICompressFilter *)(new C ## x ## _Encoder); } 12 | 13 | CREATE_CODEC(BC_PPC) 14 | CREATE_CODEC(BC_IA64) 15 | CREATE_CODEC(BC_ARM) 16 | CREATE_CODEC(BC_ARMT) 17 | CREATE_CODEC(BC_SPARC) 18 | 19 | #define METHOD_ITEM(x, id1, id2, name) { CreateCodec ## x, CreateCodec ## x ## Out, 0x03030000 + (id1 * 256) + id2, name, 1, true } 20 | 21 | static CCodecInfo g_CodecsInfo[] = 22 | { 23 | METHOD_ITEM(BC_PPC, 0x02, 0x05, L"PPC"), 24 | METHOD_ITEM(BC_IA64, 0x04, 1, L"IA64"), 25 | METHOD_ITEM(BC_ARM, 0x05, 1, L"ARM"), 26 | METHOD_ITEM(BC_ARMT, 0x07, 1, L"ARMT"), 27 | METHOD_ITEM(BC_SPARC, 0x08, 0x05, L"SPARC") 28 | }; 29 | 30 | REGISTER_CODECS(Branch) 31 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/CopyCoder.cpp: -------------------------------------------------------------------------------- 1 | // Compress/CopyCoder.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "../../../C/Alloc.h" 6 | 7 | #include "../Common/StreamUtils.h" 8 | 9 | #include "CopyCoder.h" 10 | 11 | namespace NCompress { 12 | 13 | static const UInt32 kBufferSize = 1 << 17; 14 | 15 | CCopyCoder::~CCopyCoder() 16 | { 17 | ::MidFree(_buffer); 18 | } 19 | 20 | STDMETHODIMP CCopyCoder::Code(ISequentialInStream *inStream, 21 | ISequentialOutStream *outStream, 22 | const UInt64 * /* inSize */, const UInt64 *outSize, 23 | ICompressProgressInfo *progress) 24 | { 25 | if (_buffer == 0) 26 | { 27 | _buffer = (Byte *)::MidAlloc(kBufferSize); 28 | if (_buffer == 0) 29 | return E_OUTOFMEMORY; 30 | } 31 | 32 | TotalSize = 0; 33 | for (;;) 34 | { 35 | UInt32 size = kBufferSize; 36 | if (outSize != 0) 37 | if (size > *outSize - TotalSize) 38 | size = (UInt32)(*outSize - TotalSize); 39 | RINOK(inStream->Read(_buffer, size, &size)); 40 | if (size == 0) 41 | break; 42 | if (outStream) 43 | { 44 | RINOK(WriteStream(outStream, _buffer, size)); 45 | } 46 | TotalSize += size; 47 | if (progress != NULL) 48 | { 49 | RINOK(progress->SetRatioInfo(&TotalSize, &TotalSize)); 50 | } 51 | } 52 | return S_OK; 53 | } 54 | 55 | STDMETHODIMP CCopyCoder::GetInStreamProcessedSize(UInt64 *value) 56 | { 57 | *value = TotalSize; 58 | return S_OK; 59 | } 60 | 61 | HRESULT CopyStream(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress) 62 | { 63 | CMyComPtr copyCoder = new NCompress::CCopyCoder; 64 | return copyCoder->Code(inStream, outStream, NULL, NULL, progress); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/CopyCoder.h: -------------------------------------------------------------------------------- 1 | // Compress/CopyCoder.h 2 | 3 | #ifndef __COMPRESS_COPY_CODER_H 4 | #define __COMPRESS_COPY_CODER_H 5 | 6 | #include "../../Common/MyCom.h" 7 | 8 | #include "../ICoder.h" 9 | 10 | namespace NCompress { 11 | 12 | class CCopyCoder: 13 | public ICompressCoder, 14 | public ICompressGetInStreamProcessedSize, 15 | public CMyUnknownImp 16 | { 17 | Byte *_buffer; 18 | public: 19 | UInt64 TotalSize; 20 | CCopyCoder(): TotalSize(0), _buffer(0) {}; 21 | ~CCopyCoder(); 22 | 23 | MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize) 24 | 25 | STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, 26 | const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress); 27 | STDMETHOD(GetInStreamProcessedSize)(UInt64 *value); 28 | }; 29 | 30 | HRESULT CopyStream(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress); 31 | 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/CopyRegister.cpp: -------------------------------------------------------------------------------- 1 | // CopyRegister.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "../Common/RegisterCodec.h" 6 | 7 | #include "CopyCoder.h" 8 | 9 | static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::CCopyCoder); } 10 | 11 | static CCodecInfo g_CodecInfo = 12 | { CreateCodec, CreateCodec, 0x00, L"Copy", 1, false }; 13 | 14 | REGISTER_CODEC(Copy) 15 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/Lzma2Encoder.h: -------------------------------------------------------------------------------- 1 | // Lzma2Encoder.h 2 | 3 | #ifndef __LZMA2_ENCODER_H 4 | #define __LZMA2_ENCODER_H 5 | 6 | #include "../../../C/Lzma2Enc.h" 7 | 8 | #include "../../Common/MyCom.h" 9 | 10 | #include "../ICoder.h" 11 | 12 | namespace NCompress { 13 | namespace NLzma2 { 14 | 15 | class CEncoder: 16 | public ICompressCoder, 17 | public ICompressSetCoderProperties, 18 | public ICompressWriteCoderProperties, 19 | public CMyUnknownImp 20 | { 21 | CLzma2EncHandle _encoder; 22 | public: 23 | MY_UNKNOWN_IMP2(ICompressSetCoderProperties, ICompressWriteCoderProperties) 24 | 25 | STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, 26 | const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress); 27 | STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps); 28 | STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream); 29 | 30 | CEncoder(); 31 | virtual ~CEncoder(); 32 | }; 33 | 34 | }} 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/Lzma2Register.cpp: -------------------------------------------------------------------------------- 1 | // Lzma2Register.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "../Common/RegisterCodec.h" 6 | 7 | #include "Lzma2Decoder.h" 8 | 9 | static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NLzma2::CDecoder); } 10 | #ifndef EXTRACT_ONLY 11 | #include "Lzma2Encoder.h" 12 | static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NLzma2::CEncoder); } 13 | #else 14 | #define CreateCodecOut 0 15 | #endif 16 | 17 | static CCodecInfo g_CodecInfo = 18 | { CreateCodec, CreateCodecOut, 0x21, L"LZMA2", 1, false }; 19 | 20 | REGISTER_CODEC(LZMA2) 21 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/LzmaEncoder.h: -------------------------------------------------------------------------------- 1 | // LzmaEncoder.h 2 | 3 | #ifndef __LZMA_ENCODER_H 4 | #define __LZMA_ENCODER_H 5 | 6 | #include "../../C/LzmaEnc.h" 7 | 8 | #include "../../Common/MyCom.h" 9 | 10 | #include "../ICoder.h" 11 | 12 | namespace NCompress { 13 | namespace NLzma { 14 | 15 | class CEncoder: 16 | public ICompressCoder, 17 | public ICompressSetCoderProperties, 18 | public ICompressWriteCoderProperties, 19 | public CMyUnknownImp 20 | { 21 | CLzmaEncHandle _encoder; 22 | public: 23 | MY_UNKNOWN_IMP2(ICompressSetCoderProperties, ICompressWriteCoderProperties) 24 | 25 | STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, 26 | const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress); 27 | STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps); 28 | STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream); 29 | 30 | CEncoder(); 31 | virtual ~CEncoder(); 32 | }; 33 | 34 | }} 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/LzmaRegister.cpp: -------------------------------------------------------------------------------- 1 | // LzmaRegister.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "../Common/RegisterCodec.h" 6 | 7 | #include "LzmaDecoder.h" 8 | 9 | static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NLzma::CDecoder); } 10 | #ifndef EXTRACT_ONLY 11 | #include "LzmaEncoder.h" 12 | static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NLzma::CEncoder); } 13 | #else 14 | #define CreateCodecOut 0 15 | #endif 16 | 17 | static CCodecInfo g_CodecInfo = 18 | { CreateCodec, CreateCodecOut, 0x030101, L"LZMA", 1, false }; 19 | 20 | REGISTER_CODEC(LZMA) 21 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/PpmdRegister.cpp: -------------------------------------------------------------------------------- 1 | // PpmdRegister.cpp 2 | // 2009-05-30 : Igor Pavlov : Public domain 3 | 4 | #include "StdAfx.h" 5 | 6 | #include "../Common/RegisterCodec.h" 7 | 8 | #include "PpmdDecoder.h" 9 | 10 | static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NPpmd::CDecoder); } 11 | #ifndef EXTRACT_ONLY 12 | #include "PpmdEncoder.h" 13 | static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NPpmd::CEncoder); } 14 | #else 15 | #define CreateCodecOut 0 16 | #endif 17 | 18 | static CCodecInfo g_CodecInfo = 19 | { CreateCodec, CreateCodecOut, 0x030401, L"PPMD", 1, false }; 20 | 21 | REGISTER_CODEC(PPMD) 22 | -------------------------------------------------------------------------------- /_lzma/7zip/Compress/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include "../../Common/MyWindows.h" 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /_lzma/7zip/Crc.mak: -------------------------------------------------------------------------------- 1 | C_OBJS = $(C_OBJS) \ 2 | $O\7zCrc.obj 3 | !IF "$(CPU)" == "IA64" || "$(CPU)" == "MIPS" 4 | C_OBJS = $(C_OBJS) \ 5 | !ELSE 6 | ASM_OBJS = $(ASM_OBJS) \ 7 | !ENDIF 8 | $O\7zCrcOpt.obj 9 | -------------------------------------------------------------------------------- /_lzma/7zip/IDecl.h: -------------------------------------------------------------------------------- 1 | // IDecl.h 2 | 3 | #ifndef __IDECL_H 4 | #define __IDECL_H 5 | 6 | #include "../Common/MyUnknown.h" 7 | 8 | #define DECL_INTERFACE_SUB(i, base, groupId, subId) \ 9 | DEFINE_GUID(IID_ ## i, \ 10 | 0x23170F69, 0x40C1, 0x278A, 0, 0, 0, (groupId), 0, (subId), 0, 0); \ 11 | struct i: public base 12 | 13 | #define DECL_INTERFACE(i, groupId, subId) DECL_INTERFACE_SUB(i, IUnknown, groupId, subId) 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /_lzma/7zip/IPassword.h: -------------------------------------------------------------------------------- 1 | // IPassword.h 2 | 3 | #ifndef __IPASSWORD_H 4 | #define __IPASSWORD_H 5 | 6 | #include "../Common/MyUnknown.h" 7 | #include "../Common/Types.h" 8 | 9 | #include "IDecl.h" 10 | 11 | #define PASSWORD_INTERFACE(i, x) DECL_INTERFACE(i, 5, x) 12 | 13 | PASSWORD_INTERFACE(ICryptoGetTextPassword, 0x10) 14 | { 15 | STDMETHOD(CryptoGetTextPassword)(BSTR *password) PURE; 16 | }; 17 | 18 | PASSWORD_INTERFACE(ICryptoGetTextPassword2, 0x11) 19 | { 20 | STDMETHOD(CryptoGetTextPassword2)(Int32 *passwordIsDefined, BSTR *password) PURE; 21 | }; 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /_lzma/7zip/IProgress.h: -------------------------------------------------------------------------------- 1 | // Interface/IProgress.h 2 | 3 | #ifndef __IPROGRESS_H 4 | #define __IPROGRESS_H 5 | 6 | #include "../Common/MyUnknown.h" 7 | #include "../Common/Types.h" 8 | 9 | #include "IDecl.h" 10 | 11 | #define INTERFACE_IProgress(x) \ 12 | STDMETHOD(SetTotal)(UInt64 total) x; \ 13 | STDMETHOD(SetCompleted)(const UInt64 *completeValue) x; \ 14 | 15 | DECL_INTERFACE(IProgress, 0, 5) 16 | { 17 | INTERFACE_IProgress(PURE) 18 | }; 19 | 20 | /* 21 | // {23170F69-40C1-278A-0000-000000050002} 22 | DEFINE_GUID(IID_IProgress2, 23 | 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02); 24 | MIDL_INTERFACE("23170F69-40C1-278A-0000-000000050002") 25 | IProgress2: public IUnknown 26 | { 27 | public: 28 | STDMETHOD(SetTotal)(const UInt64 *total) PURE; 29 | STDMETHOD(SetCompleted)(const UInt64 *completeValue) PURE; 30 | }; 31 | */ 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /_lzma/7zip/MyVersion.h: -------------------------------------------------------------------------------- 1 | #define MY_VER_MAJOR 9 2 | #define MY_VER_MINOR 20 3 | #define MY_VER_BUILD 0 4 | #define MY_VERSION "9.20" 5 | #define MY_7ZIP_VERSION "7-Zip 9.20" 6 | #define MY_DATE "2010-11-18" 7 | #define MY_COPYRIGHT "Copyright (c) 1999-2010 Igor Pavlov" 8 | #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE 9 | -------------------------------------------------------------------------------- /_lzma/7zip/MyVersionInfo.rc: -------------------------------------------------------------------------------- 1 | #define MY_VS_FFI_FILEFLAGSMASK 0x0000003FL 2 | #define MY_VOS_NT_WINDOWS32 0x00040004L 3 | #define MY_VOS_CE_WINDOWS32 0x00050004L 4 | 5 | #define MY_VFT_APP 0x00000001L 6 | #define MY_VFT_DLL 0x00000002L 7 | 8 | // #include 9 | #include "MyVersion.h" 10 | 11 | #define MY_VER MY_VER_MAJOR,MY_VER_MINOR,MY_VER_BUILD,0 12 | 13 | #ifdef DEBUG 14 | #define DBG_FL VS_FF_DEBUG 15 | #else 16 | #define DBG_FL 0 17 | #endif 18 | 19 | #define MY_VERSION_INFO(fileType, descr, intName, origName) \ 20 | LANGUAGE 9, 1 \ 21 | 1 VERSIONINFO \ 22 | FILEVERSION MY_VER \ 23 | PRODUCTVERSION MY_VER \ 24 | FILEFLAGSMASK MY_VS_FFI_FILEFLAGSMASK \ 25 | FILEFLAGS DBG_FL \ 26 | FILEOS MY_VOS_NT_WINDOWS32 \ 27 | FILETYPE fileType \ 28 | FILESUBTYPE 0x0L \ 29 | BEGIN \ 30 | BLOCK "StringFileInfo" \ 31 | BEGIN \ 32 | BLOCK "040904b0" \ 33 | BEGIN \ 34 | VALUE "CompanyName", "Igor Pavlov" \ 35 | VALUE "FileDescription", descr \ 36 | VALUE "FileVersion", MY_VERSION \ 37 | VALUE "InternalName", intName \ 38 | VALUE "LegalCopyright", MY_COPYRIGHT \ 39 | VALUE "OriginalFilename", origName \ 40 | VALUE "ProductName", "7-Zip" \ 41 | VALUE "ProductVersion", MY_VERSION \ 42 | END \ 43 | END \ 44 | BLOCK "VarFileInfo" \ 45 | BEGIN \ 46 | VALUE "Translation", 0x409, 1200 \ 47 | END \ 48 | END 49 | 50 | #define MY_VERSION_INFO_APP(descr, intName) MY_VERSION_INFO(MY_VFT_APP, descr, intName, intName ".exe") 51 | 52 | #define MY_VERSION_INFO_DLL(descr, intName) MY_VERSION_INFO(MY_VFT_DLL, descr, intName, intName ".dll") 53 | -------------------------------------------------------------------------------- /_lzma/7zip/PropID.h: -------------------------------------------------------------------------------- 1 | // PropID.h 2 | 3 | #ifndef __7ZIP_PROPID_H 4 | #define __7ZIP_PROPID_H 5 | 6 | enum 7 | { 8 | kpidNoProperty = 0, 9 | kpidMainSubfile = 1, 10 | kpidHandlerItemIndex = 2, 11 | kpidPath, 12 | kpidName, 13 | kpidExtension, 14 | kpidIsDir, 15 | kpidSize, 16 | kpidPackSize, 17 | kpidAttrib, 18 | kpidCTime, 19 | kpidATime, 20 | kpidMTime, 21 | kpidSolid, 22 | kpidCommented, 23 | kpidEncrypted, 24 | kpidSplitBefore, 25 | kpidSplitAfter, 26 | kpidDictionarySize, 27 | kpidCRC, 28 | kpidType, 29 | kpidIsAnti, 30 | kpidMethod, 31 | kpidHostOS, 32 | kpidFileSystem, 33 | kpidUser, 34 | kpidGroup, 35 | kpidBlock, 36 | kpidComment, 37 | kpidPosition, 38 | kpidPrefix, 39 | kpidNumSubDirs, 40 | kpidNumSubFiles, 41 | kpidUnpackVer, 42 | kpidVolume, 43 | kpidIsVolume, 44 | kpidOffset, 45 | kpidLinks, 46 | kpidNumBlocks, 47 | kpidNumVolumes, 48 | kpidTimeType, 49 | kpidBit64, 50 | kpidBigEndian, 51 | kpidCpu, 52 | kpidPhySize, 53 | kpidHeadersSize, 54 | kpidChecksum, 55 | kpidCharacts, 56 | kpidVa, 57 | kpidId, 58 | kpidShortName, 59 | kpidCreatorApp, 60 | kpidSectorSize, 61 | kpidPosixAttrib, 62 | kpidLink, 63 | kpidError, 64 | 65 | kpidTotalSize = 0x1100, 66 | kpidFreeSpace, 67 | kpidClusterSize, 68 | kpidVolumeName, 69 | 70 | kpidLocalName = 0x1200, 71 | kpidProvider, 72 | 73 | kpidUserDefined = 0x10000 74 | }; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /_lzma/7zip/SubBuild.mak: -------------------------------------------------------------------------------- 1 | cd $(@D) 2 | $(MAKE) -nologo $(TARGETS) 3 | cd .. 4 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Client7z/Client7z.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "Client7z"=.\Client7z.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Client7z/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // StdAfx.cpp 2 | 3 | #include "StdAfx.h" 4 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Client7z/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include 7 | #include 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Client7z/makefile: -------------------------------------------------------------------------------- 1 | PROG = 7z.exe 2 | MY_CONSOLE = 1 3 | CFLAGS = $(CFLAGS) -I ../../../ 4 | 5 | CONSOLE_OBJS = \ 6 | $O\Client7z.obj \ 7 | 8 | COMMON_OBJS = \ 9 | $O\IntToString.obj \ 10 | $O\NewHandler.obj \ 11 | $O\MyString.obj \ 12 | $O\StringConvert.obj \ 13 | $O\StringToInt.obj \ 14 | $O\MyVector.obj \ 15 | $O\Wildcard.obj \ 16 | 17 | WIN_OBJS = \ 18 | $O\DLL.obj \ 19 | $O\FileDir.obj \ 20 | $O\FileFind.obj \ 21 | $O\FileIO.obj \ 22 | $O\FileName.obj \ 23 | $O\PropVariant.obj \ 24 | $O\PropVariantConversions.obj \ 25 | 26 | 7ZIP_COMMON_OBJS = \ 27 | $O\FileStreams.obj \ 28 | 29 | OBJS = \ 30 | $O\StdAfx.obj \ 31 | $(CONSOLE_OBJS) \ 32 | $(COMMON_OBJS) \ 33 | $(WIN_OBJS) \ 34 | $(7ZIP_COMMON_OBJS) \ 35 | 36 | !include "../../../Build.mak" 37 | 38 | $(CONSOLE_OBJS): $(*B).cpp 39 | $(COMPL) 40 | $(COMMON_OBJS): ../../../Common/$(*B).cpp 41 | $(COMPL) 42 | $(WIN_OBJS): ../../../Windows/$(*B).cpp 43 | $(COMPL) 44 | $(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp 45 | $(COMPL) 46 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/ArchiveName.cpp: -------------------------------------------------------------------------------- 1 | // ArchiveName.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "Windows/FileDir.h" 6 | #include "Windows/FileFind.h" 7 | 8 | #include "ExtractingFilePath.h" 9 | 10 | using namespace NWindows; 11 | 12 | static UString CreateArchiveName2(const UString &srcName, bool fromPrev, bool keepName) 13 | { 14 | UString resultName = L"Archive"; 15 | if (fromPrev) 16 | { 17 | UString dirPrefix; 18 | if (NFile::NDirectory::GetOnlyDirPrefix(srcName, dirPrefix)) 19 | { 20 | if (dirPrefix.Length() > 0) 21 | if (dirPrefix[dirPrefix.Length() - 1] == WCHAR_PATH_SEPARATOR) 22 | { 23 | dirPrefix.Delete(dirPrefix.Length() - 1); 24 | NFile::NFind::CFileInfoW fileInfo; 25 | if (fileInfo.Find(dirPrefix)) 26 | resultName = fileInfo.Name; 27 | } 28 | } 29 | } 30 | else 31 | { 32 | NFile::NFind::CFileInfoW fileInfo; 33 | if (!fileInfo.Find(srcName)) 34 | // return resultName; 35 | return srcName; 36 | resultName = fileInfo.Name; 37 | if (!fileInfo.IsDir() && !keepName) 38 | { 39 | int dotPos = resultName.ReverseFind('.'); 40 | if (dotPos > 0) 41 | { 42 | UString archiveName2 = resultName.Left(dotPos); 43 | if (archiveName2.ReverseFind('.') < 0) 44 | resultName = archiveName2; 45 | } 46 | } 47 | } 48 | return resultName; 49 | } 50 | 51 | UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName) 52 | { 53 | return GetCorrectFsPath(CreateArchiveName2(srcName, fromPrev, keepName)); 54 | } 55 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/ArchiveName.h: -------------------------------------------------------------------------------- 1 | // ArchiveName.h 2 | 3 | #ifndef __ARCHIVENAME_H 4 | #define __ARCHIVENAME_H 5 | 6 | #include "Common/MyString.h" 7 | 8 | UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/Bench.h: -------------------------------------------------------------------------------- 1 | // Bench.h 2 | 3 | #ifndef __7ZIP_BENCH_H 4 | #define __7ZIP_BENCH_H 5 | 6 | #include "../../Common/CreateCoder.h" 7 | 8 | struct CBenchInfo 9 | { 10 | UInt64 GlobalTime; 11 | UInt64 GlobalFreq; 12 | UInt64 UserTime; 13 | UInt64 UserFreq; 14 | UInt64 UnpackSize; 15 | UInt64 PackSize; 16 | UInt32 NumIterations; 17 | CBenchInfo(): NumIterations(0) {} 18 | }; 19 | 20 | struct IBenchCallback 21 | { 22 | virtual HRESULT SetEncodeResult(const CBenchInfo &info, bool final) = 0; 23 | virtual HRESULT SetDecodeResult(const CBenchInfo &info, bool final) = 0; 24 | }; 25 | 26 | UInt64 GetUsage(const CBenchInfo &benchOnfo); 27 | UInt64 GetRatingPerUsage(const CBenchInfo &info, UInt64 rating); 28 | UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 freq, UInt64 size); 29 | UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations); 30 | 31 | HRESULT LzmaBench( 32 | DECL_EXTERNAL_CODECS_LOC_VARS 33 | UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback); 34 | 35 | const int kBenchMinDicLogSize = 18; 36 | 37 | UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary); 38 | 39 | bool CrcInternalTest(); 40 | HRESULT CrcBench(UInt32 numThreads, UInt32 bufferSize, UInt64 &speed); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/DefaultName.cpp: -------------------------------------------------------------------------------- 1 | // DefaultName.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "DefaultName.h" 6 | 7 | static UString GetDefaultName3(const UString &fileName, 8 | const UString &extension, const UString &addSubExtension) 9 | { 10 | int extLength = extension.Length(); 11 | int fileNameLength = fileName.Length(); 12 | if (fileNameLength > extLength + 1) 13 | { 14 | int dotPos = fileNameLength - (extLength + 1); 15 | if (fileName[dotPos] == '.') 16 | if (extension.CompareNoCase(fileName.Mid(dotPos + 1)) == 0) 17 | return fileName.Left(dotPos) + addSubExtension; 18 | } 19 | int dotPos = fileName.ReverseFind(L'.'); 20 | if (dotPos > 0) 21 | return fileName.Left(dotPos) + addSubExtension; 22 | 23 | if (addSubExtension.IsEmpty()) 24 | return fileName + L"~"; 25 | else 26 | return fileName + addSubExtension; 27 | } 28 | 29 | UString GetDefaultName2(const UString &fileName, 30 | const UString &extension, const UString &addSubExtension) 31 | { 32 | UString name = GetDefaultName3(fileName, extension, addSubExtension); 33 | name.TrimRight(); 34 | return name; 35 | } 36 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/DefaultName.h: -------------------------------------------------------------------------------- 1 | // DefaultName.h 2 | 3 | #ifndef __DEFAULTNAME_H 4 | #define __DEFAULTNAME_H 5 | 6 | #include "Common/MyString.h" 7 | 8 | UString GetDefaultName2(const UString &fileName, 9 | const UString &extension, const UString &addSubExtension); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/EnumDirItems.h: -------------------------------------------------------------------------------- 1 | // EnumDirItems.h 2 | 3 | #ifndef __ENUM_DIR_ITEMS_H 4 | #define __ENUM_DIR_ITEMS_H 5 | 6 | #include "Common/Wildcard.h" 7 | #include "Windows/FileFind.h" 8 | #include "DirItem.h" 9 | 10 | void AddDirFileInfo(int phyParent, int logParent, 11 | const NWindows::NFile::NFind::CFileInfoW &fi, CObjectVector &dirItems); 12 | 13 | struct IEnumDirItemCallback 14 | { 15 | virtual HRESULT ScanProgress(UInt64 numFolders, UInt64 numFiles, const wchar_t *path) = 0; 16 | }; 17 | 18 | HRESULT EnumerateItems( 19 | const NWildcard::CCensor &censor, 20 | CDirItems &dirItems, 21 | IEnumDirItemCallback *callback, 22 | UStringVector &errorPaths, 23 | CRecordVector &errorCodes); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/ExitCode.h: -------------------------------------------------------------------------------- 1 | // ExitCode.h 2 | 3 | #ifndef __EXIT_CODE_H 4 | #define __EXIT_CODE_H 5 | 6 | namespace NExitCode { 7 | 8 | enum EEnum { 9 | 10 | kSuccess = 0, // Successful operation 11 | kWarning = 1, // Non fatal error(s) occurred 12 | kFatalError = 2, // A fatal error occurred 13 | // kCRCError = 3, // A CRC error occurred when unpacking 14 | // kLockedArchive = 4, // Attempt to modify an archive previously locked 15 | // kWriteError = 5, // Write to disk error 16 | // kOpenError = 6, // Open file error 17 | kUserError = 7, // Command line option error 18 | kMemoryError = 8, // Not enough memory for operation 19 | // kCreateFileError = 9, // Create file error 20 | 21 | kUserBreak = 255 // User stopped the process 22 | 23 | }; 24 | 25 | } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/ExtractMode.h: -------------------------------------------------------------------------------- 1 | // ExtractMode.h 2 | 3 | #ifndef __EXTRACT_MODE_H 4 | #define __EXTRACT_MODE_H 5 | 6 | namespace NExtract { 7 | 8 | namespace NPathMode 9 | { 10 | enum EEnum 11 | { 12 | kFullPathnames, 13 | kCurrentPathnames, 14 | kNoPathnames 15 | }; 16 | } 17 | 18 | namespace NOverwriteMode 19 | { 20 | enum EEnum 21 | { 22 | kAskBefore, 23 | kWithoutPrompt, 24 | kSkipExisting, 25 | kAutoRename, 26 | kAutoRenameExisting 27 | }; 28 | } 29 | } 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/ExtractingFilePath.h: -------------------------------------------------------------------------------- 1 | // ExtractingFilePath.h 2 | 3 | #ifndef __EXTRACTING_FILE_PATH_H 4 | #define __EXTRACTING_FILE_PATH_H 5 | 6 | #include "Common/MyString.h" 7 | 8 | UString MakePathNameFromParts(const UStringVector &parts); 9 | void MakeCorrectPath(UStringVector &pathParts); 10 | UString GetCorrectFsPath(const UString &path); 11 | UString GetCorrectFullFsPath(const UString &path); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/IFileExtractCallback.h: -------------------------------------------------------------------------------- 1 | // IFileExtractCallback.h 2 | 3 | #ifndef __IFILEEXTRACTCALLBACK_H 4 | #define __IFILEEXTRACTCALLBACK_H 5 | 6 | #include "Common/MyString.h" 7 | #include "../../IDecl.h" 8 | 9 | namespace NOverwriteAnswer 10 | { 11 | enum EEnum 12 | { 13 | kYes, 14 | kYesToAll, 15 | kNo, 16 | kNoToAll, 17 | kAutoRename, 18 | kCancel 19 | }; 20 | } 21 | 22 | DECL_INTERFACE_SUB(IFolderArchiveExtractCallback, IProgress, 0x01, 0x07) 23 | { 24 | public: 25 | STDMETHOD(AskOverwrite)( 26 | const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize, 27 | const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize, 28 | Int32 *answer) PURE; 29 | STDMETHOD(PrepareOperation)(const wchar_t *name, bool isFolder, Int32 askExtractMode, const UInt64 *position) PURE; 30 | STDMETHOD(MessageError)(const wchar_t *message) PURE; 31 | STDMETHOD(SetOperationResult)(Int32 operationResult, bool encrypted) PURE; 32 | }; 33 | 34 | struct IExtractCallbackUI: IFolderArchiveExtractCallback 35 | { 36 | virtual HRESULT BeforeOpen(const wchar_t *name) = 0; 37 | virtual HRESULT OpenResult(const wchar_t *name, HRESULT result, bool encrypted) = 0; 38 | virtual HRESULT ThereAreNoFiles() = 0; 39 | virtual HRESULT ExtractResult(HRESULT result) = 0; 40 | 41 | #ifndef _NO_CRYPTO 42 | virtual HRESULT SetPassword(const UString &password) = 0; 43 | #endif 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/PropIDUtils.h: -------------------------------------------------------------------------------- 1 | // PropIDUtils.h 2 | 3 | #ifndef __PROPID_UTILS_H 4 | #define __PROPID_UTILS_H 5 | 6 | #include "Common/MyString.h" 7 | #include "Common/Types.h" 8 | 9 | void ConvertUInt32ToHex(UInt32 value, wchar_t *s); 10 | UString ConvertPropertyToString(const PROPVARIANT &propVariant, PROPID propID, bool full = true); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/Property.h: -------------------------------------------------------------------------------- 1 | // Property.h 2 | 3 | #ifndef __PROPERTY_H 4 | #define __PROPERTY_H 5 | 6 | #include "Common/MyString.h" 7 | 8 | struct CProperty 9 | { 10 | UString Name; 11 | UString Value; 12 | }; 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/SetProperties.h: -------------------------------------------------------------------------------- 1 | // SetProperties.h 2 | 3 | #ifndef __SETPROPERTIES_H 4 | #define __SETPROPERTIES_H 5 | 6 | #include "Property.h" 7 | 8 | HRESULT SetProperties(IUnknown *unknown, const CObjectVector &properties); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/SortUtils.cpp: -------------------------------------------------------------------------------- 1 | // SortUtils.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "SortUtils.h" 6 | #include "Common/Wildcard.h" 7 | 8 | static int CompareStrings(const int *p1, const int *p2, void *param) 9 | { 10 | const UStringVector &strings = *(const UStringVector *)param; 11 | return CompareFileNames(strings[*p1], strings[*p2]); 12 | } 13 | 14 | void SortFileNames(const UStringVector &strings, CIntVector &indices) 15 | { 16 | indices.Clear(); 17 | int numItems = strings.Size(); 18 | indices.Reserve(numItems); 19 | for(int i = 0; i < numItems; i++) 20 | indices.Add(i); 21 | indices.Sort(CompareStrings, (void *)&strings); 22 | } 23 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/SortUtils.h: -------------------------------------------------------------------------------- 1 | // SortUtils.h 2 | 3 | #ifndef __SORTUTLS_H 4 | #define __SORTUTLS_H 5 | 6 | #include "Common/MyString.h" 7 | 8 | void SortFileNames(const UStringVector &strings, CIntVector &indices); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/StdAfx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include "../../../Common/MyWindows.h" 7 | #include "../../../Common/NewHandler.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/TempFiles.cpp: -------------------------------------------------------------------------------- 1 | // TempFiles.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "TempFiles.h" 6 | 7 | #include "Windows/FileDir.h" 8 | #include "Windows/FileIO.h" 9 | 10 | using namespace NWindows; 11 | using namespace NFile; 12 | 13 | void CTempFiles::Clear() 14 | { 15 | while(!Paths.IsEmpty()) 16 | { 17 | NDirectory::DeleteFileAlways((LPCWSTR)Paths.Back()); 18 | Paths.DeleteBack(); 19 | } 20 | } 21 | 22 | 23 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/TempFiles.h: -------------------------------------------------------------------------------- 1 | // TempFiles.h 2 | 3 | #ifndef __TEMPFILES_H 4 | #define __TEMPFILES_H 5 | 6 | #include "Common/MyString.h" 7 | 8 | class CTempFiles 9 | { 10 | void Clear(); 11 | public: 12 | UStringVector Paths; 13 | ~CTempFiles() { Clear(); } 14 | }; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/UpdateAction.cpp: -------------------------------------------------------------------------------- 1 | // UpdateAction.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "UpdateAction.h" 6 | 7 | namespace NUpdateArchive { 8 | 9 | const CActionSet kAddActionSet = 10 | {{ 11 | NPairAction::kCopy, 12 | NPairAction::kCopy, 13 | NPairAction::kCompress, 14 | NPairAction::kCompress, 15 | NPairAction::kCompress, 16 | NPairAction::kCompress, 17 | NPairAction::kCompress 18 | }}; 19 | 20 | const CActionSet kUpdateActionSet = 21 | {{ 22 | NPairAction::kCopy, 23 | NPairAction::kCopy, 24 | NPairAction::kCompress, 25 | NPairAction::kCopy, 26 | NPairAction::kCompress, 27 | NPairAction::kCopy, 28 | NPairAction::kCompress 29 | }}; 30 | 31 | const CActionSet kFreshActionSet = 32 | {{ 33 | NPairAction::kCopy, 34 | NPairAction::kCopy, 35 | NPairAction::kIgnore, 36 | NPairAction::kCopy, 37 | NPairAction::kCompress, 38 | NPairAction::kCopy, 39 | NPairAction::kCompress 40 | }}; 41 | 42 | const CActionSet kSynchronizeActionSet = 43 | {{ 44 | NPairAction::kCopy, 45 | NPairAction::kIgnore, 46 | NPairAction::kCompress, 47 | NPairAction::kCopy, 48 | NPairAction::kCompress, 49 | NPairAction::kCopy, 50 | NPairAction::kCompress, 51 | }}; 52 | 53 | const CActionSet kDeleteActionSet = 54 | {{ 55 | NPairAction::kCopy, 56 | NPairAction::kIgnore, 57 | NPairAction::kIgnore, 58 | NPairAction::kIgnore, 59 | NPairAction::kIgnore, 60 | NPairAction::kIgnore, 61 | NPairAction::kIgnore 62 | }}; 63 | 64 | } 65 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/UpdateAction.h: -------------------------------------------------------------------------------- 1 | // UpdateAction.h 2 | 3 | #ifndef __UPDATE_ACTION_H 4 | #define __UPDATE_ACTION_H 5 | 6 | namespace NUpdateArchive { 7 | 8 | namespace NPairState 9 | { 10 | const int kNumValues = 7; 11 | enum EEnum 12 | { 13 | kNotMasked = 0, 14 | kOnlyInArchive, 15 | kOnlyOnDisk, 16 | kNewInArchive, 17 | kOldInArchive, 18 | kSameFiles, 19 | kUnknowNewerFiles 20 | }; 21 | } 22 | 23 | namespace NPairAction 24 | { 25 | enum EEnum 26 | { 27 | kIgnore = 0, 28 | kCopy, 29 | kCompress, 30 | kCompressAsAnti 31 | }; 32 | } 33 | 34 | struct CActionSet 35 | { 36 | NPairAction::EEnum StateActions[NPairState::kNumValues]; 37 | bool NeedScanning() const 38 | { 39 | int i; 40 | for (i = 0; i < NPairState::kNumValues; i++) 41 | if (StateActions[i] == NPairAction::kCompress) 42 | return true; 43 | for (i = 1; i < NPairState::kNumValues; i++) 44 | if (StateActions[i] != NPairAction::kIgnore) 45 | return true; 46 | return false; 47 | } 48 | }; 49 | 50 | extern const CActionSet kAddActionSet; 51 | extern const CActionSet kUpdateActionSet; 52 | extern const CActionSet kFreshActionSet; 53 | extern const CActionSet kSynchronizeActionSet; 54 | extern const CActionSet kDeleteActionSet; 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/UpdatePair.h: -------------------------------------------------------------------------------- 1 | // UpdatePair.h 2 | 3 | #ifndef __UPDATE_PAIR_H 4 | #define __UPDATE_PAIR_H 5 | 6 | #include "DirItem.h" 7 | #include "UpdateAction.h" 8 | 9 | #include "../../Archive/IArchive.h" 10 | 11 | struct CUpdatePair 12 | { 13 | NUpdateArchive::NPairState::EEnum State; 14 | int ArcIndex; 15 | int DirIndex; 16 | CUpdatePair(): ArcIndex(-1), DirIndex(-1) {} 17 | }; 18 | 19 | void GetUpdatePairInfoList( 20 | const CDirItems &dirItems, 21 | const CObjectVector &arcItems, 22 | NFileTimeType::EEnum fileTimeType, 23 | CRecordVector &updatePairs); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/UpdateProduce.h: -------------------------------------------------------------------------------- 1 | // UpdateProduce.h 2 | 3 | #ifndef __UPDATE_PRODUCE_H 4 | #define __UPDATE_PRODUCE_H 5 | 6 | #include "UpdatePair.h" 7 | 8 | struct CUpdatePair2 9 | { 10 | bool NewData; 11 | bool NewProps; 12 | bool IsAnti; 13 | 14 | int DirIndex; 15 | int ArcIndex; 16 | int NewNameIndex; 17 | 18 | bool ExistOnDisk() const { return DirIndex != -1; } 19 | bool ExistInArchive() const { return ArcIndex != -1; } 20 | 21 | CUpdatePair2(): IsAnti(false), DirIndex(-1), ArcIndex(-1), NewNameIndex(-1) {} 22 | }; 23 | 24 | struct IUpdateProduceCallback 25 | { 26 | virtual HRESULT ShowDeleteFile(int arcIndex) = 0; 27 | }; 28 | 29 | void UpdateProduce( 30 | const CRecordVector &updatePairs, 31 | const NUpdateArchive::CActionSet &actionSet, 32 | CRecordVector &operationChain, 33 | IUpdateProduceCallback *callback); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/WorkDir.cpp: -------------------------------------------------------------------------------- 1 | // WorkDir.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "Common/StringConvert.h" 6 | #include "Common/Wildcard.h" 7 | 8 | #include "Windows/FileDir.h" 9 | #include "Windows/FileName.h" 10 | 11 | #include "WorkDir.h" 12 | 13 | using namespace NWindows; 14 | using namespace NFile; 15 | 16 | UString GetWorkDir(const NWorkDir::CInfo &workDirInfo, const UString &path) 17 | { 18 | NWorkDir::NMode::EEnum mode = workDirInfo.Mode; 19 | #ifndef UNDER_CE 20 | if (workDirInfo.ForRemovableOnly) 21 | { 22 | mode = NWorkDir::NMode::kCurrent; 23 | UString prefix = path.Left(3); 24 | if (prefix[1] == L':' && prefix[2] == L'\\') 25 | { 26 | UINT driveType = GetDriveType(GetSystemString(prefix, ::AreFileApisANSI() ? CP_ACP : CP_OEMCP)); 27 | if (driveType == DRIVE_CDROM || driveType == DRIVE_REMOVABLE) 28 | mode = workDirInfo.Mode; 29 | } 30 | /* 31 | CParsedPath parsedPath; 32 | parsedPath.ParsePath(archiveName); 33 | UINT driveType = GetDriveType(parsedPath.Prefix); 34 | if ((driveType != DRIVE_CDROM) && (driveType != DRIVE_REMOVABLE)) 35 | mode = NZipSettings::NWorkDir::NMode::kCurrent; 36 | */ 37 | } 38 | #endif 39 | switch(mode) 40 | { 41 | case NWorkDir::NMode::kCurrent: 42 | { 43 | return ExtractDirPrefixFromPath(path); 44 | } 45 | case NWorkDir::NMode::kSpecified: 46 | { 47 | UString tempDir = workDirInfo.Path; 48 | NName::NormalizeDirPathPrefix(tempDir); 49 | return tempDir; 50 | } 51 | default: 52 | { 53 | UString tempDir; 54 | if (!NDirectory::MyGetTempPath(tempDir)) 55 | throw 141717; 56 | return tempDir; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Common/WorkDir.h: -------------------------------------------------------------------------------- 1 | // WorkDir.h 2 | 3 | #ifndef __WORKDIR_H 4 | #define __WORKDIR_H 5 | 6 | #include "ZipRegistry.h" 7 | 8 | UString GetWorkDir(const NWorkDir::CInfo &workDirInfo, const UString &path); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Console/BenchCon.h: -------------------------------------------------------------------------------- 1 | // BenchCon.h 2 | 3 | #ifndef __BENCH_CON_H 4 | #define __BENCH_CON_H 5 | 6 | #include 7 | 8 | #include "../../Common/CreateCoder.h" 9 | 10 | HRESULT LzmaBenchCon( 11 | DECL_EXTERNAL_CODECS_LOC_VARS 12 | FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary); 13 | 14 | HRESULT CrcBenchCon(FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Console/ConsoleClose.cpp: -------------------------------------------------------------------------------- 1 | // ConsoleClose.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "ConsoleClose.h" 6 | 7 | static int g_BreakCounter = 0; 8 | static const int kBreakAbortThreshold = 2; 9 | 10 | namespace NConsoleClose { 11 | 12 | #if !defined(UNDER_CE) && defined(_WIN32) 13 | static BOOL WINAPI HandlerRoutine(DWORD ctrlType) 14 | { 15 | if (ctrlType == CTRL_LOGOFF_EVENT) 16 | { 17 | // printf("\nCTRL_LOGOFF_EVENT\n"); 18 | return TRUE; 19 | } 20 | 21 | g_BreakCounter++; 22 | if (g_BreakCounter < kBreakAbortThreshold) 23 | return TRUE; 24 | return FALSE; 25 | /* 26 | switch(ctrlType) 27 | { 28 | case CTRL_C_EVENT: 29 | case CTRL_BREAK_EVENT: 30 | if (g_BreakCounter < kBreakAbortThreshold) 31 | return TRUE; 32 | } 33 | return FALSE; 34 | */ 35 | } 36 | #endif 37 | 38 | bool TestBreakSignal() 39 | { 40 | #ifdef UNDER_CE 41 | return false; 42 | #else 43 | /* 44 | if (g_BreakCounter > 0) 45 | return true; 46 | */ 47 | return (g_BreakCounter > 0); 48 | #endif 49 | } 50 | 51 | void CheckCtrlBreak() 52 | { 53 | if (TestBreakSignal()) 54 | throw CCtrlBreakException(); 55 | } 56 | 57 | CCtrlHandlerSetter::CCtrlHandlerSetter() 58 | { 59 | #if !defined(UNDER_CE) && defined(_WIN32) 60 | if(!SetConsoleCtrlHandler(HandlerRoutine, TRUE)) 61 | throw "SetConsoleCtrlHandler fails"; 62 | #endif 63 | } 64 | 65 | CCtrlHandlerSetter::~CCtrlHandlerSetter() 66 | { 67 | #if !defined(UNDER_CE) && defined(_WIN32) 68 | if(!SetConsoleCtrlHandler(HandlerRoutine, FALSE)) 69 | throw "SetConsoleCtrlHandler fails"; 70 | #endif 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Console/ConsoleClose.h: -------------------------------------------------------------------------------- 1 | // ConsoleCloseUtils.h 2 | 3 | #ifndef __CONSOLECLOSEUTILS_H 4 | #define __CONSOLECLOSEUTILS_H 5 | 6 | namespace NConsoleClose { 7 | 8 | bool TestBreakSignal(); 9 | 10 | class CCtrlHandlerSetter 11 | { 12 | public: 13 | CCtrlHandlerSetter(); 14 | virtual ~CCtrlHandlerSetter(); 15 | }; 16 | 17 | class CCtrlBreakException 18 | {}; 19 | 20 | void CheckCtrlBreak(); 21 | 22 | } 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Console/List.h: -------------------------------------------------------------------------------- 1 | // List.h 2 | 3 | #ifndef __LIST_H 4 | #define __LIST_H 5 | 6 | #include "Common/Wildcard.h" 7 | #include "../Common/LoadCodecs.h" 8 | 9 | HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices, 10 | bool stdInMode, 11 | UStringVector &archivePaths, UStringVector &archivePathsFull, 12 | const NWildcard::CCensorNode &wildcardCensor, 13 | bool enableHeaders, bool techMode, 14 | #ifndef _NO_CRYPTO 15 | bool &passwordEnabled, UString &password, 16 | #endif 17 | UInt64 &errors); 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Console/OpenCallbackConsole.cpp: -------------------------------------------------------------------------------- 1 | // OpenCallbackConsole.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "OpenCallbackConsole.h" 6 | 7 | #include "ConsoleClose.h" 8 | #include "UserInputUtils.h" 9 | 10 | HRESULT COpenCallbackConsole::Open_CheckBreak() 11 | { 12 | if (NConsoleClose::TestBreakSignal()) 13 | return E_ABORT; 14 | return S_OK; 15 | } 16 | 17 | HRESULT COpenCallbackConsole::Open_SetTotal(const UInt64 *, const UInt64 *) 18 | { 19 | return Open_CheckBreak(); 20 | } 21 | 22 | HRESULT COpenCallbackConsole::Open_SetCompleted(const UInt64 *, const UInt64 *) 23 | { 24 | return Open_CheckBreak(); 25 | } 26 | 27 | #ifndef _NO_CRYPTO 28 | 29 | HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password) 30 | { 31 | PasswordWasAsked = true; 32 | RINOK(Open_CheckBreak()); 33 | if (!PasswordIsDefined) 34 | { 35 | Password = GetPassword(OutStream); 36 | PasswordIsDefined = true; 37 | } 38 | return StringToBstr(Password, password); 39 | } 40 | 41 | HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(UString &password) 42 | { 43 | if (PasswordIsDefined) 44 | password = Password; 45 | return S_OK; 46 | } 47 | 48 | bool COpenCallbackConsole::Open_WasPasswordAsked() 49 | { 50 | return PasswordWasAsked; 51 | } 52 | 53 | void COpenCallbackConsole::Open_ClearPasswordWasAskedFlag() 54 | { 55 | PasswordWasAsked = false; 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Console/OpenCallbackConsole.h: -------------------------------------------------------------------------------- 1 | // OpenCallbackConsole.h 2 | 3 | #ifndef __OPENCALLBACKCONSOLE_H 4 | #define __OPENCALLBACKCONSOLE_H 5 | 6 | #include "Common/StdOutStream.h" 7 | #include "../Common/ArchiveOpenCallback.h" 8 | 9 | class COpenCallbackConsole: public IOpenCallbackUI 10 | { 11 | public: 12 | INTERFACE_IOpenCallbackUI(;) 13 | 14 | CStdOutStream *OutStream; 15 | 16 | #ifndef _NO_CRYPTO 17 | bool PasswordIsDefined; 18 | bool PasswordWasAsked; 19 | UString Password; 20 | COpenCallbackConsole(): PasswordIsDefined(false), PasswordWasAsked(false) {} 21 | #endif 22 | }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Console/PercentPrinter.h: -------------------------------------------------------------------------------- 1 | // PercentPrinter.h 2 | 3 | #ifndef __PERCENTPRINTER_H 4 | #define __PERCENTPRINTER_H 5 | 6 | #include "Common/Types.h" 7 | #include "Common/StdOutStream.h" 8 | 9 | class CPercentPrinter 10 | { 11 | UInt64 m_MinStepSize; 12 | UInt64 m_PrevValue; 13 | UInt64 m_CurValue; 14 | UInt64 m_Total; 15 | int m_NumExtraChars; 16 | public: 17 | CStdOutStream *OutStream; 18 | 19 | CPercentPrinter(UInt64 minStepSize = 1): m_MinStepSize(minStepSize), 20 | m_PrevValue(0), m_CurValue(0), m_Total(1), m_NumExtraChars(0) {} 21 | void SetTotal(UInt64 total) { m_Total = total; m_PrevValue = 0; } 22 | void SetRatio(UInt64 doneValue) { m_CurValue = doneValue; } 23 | void PrintString(const char *s); 24 | void PrintString(const wchar_t *s); 25 | void PrintNewLine(); 26 | void ClosePrint(); 27 | void RePrintRatio(); 28 | void PrintRatio(); 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Console/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | // StdAfx.cpp 2 | 3 | #include "StdAfx.h" 4 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Console/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include "../../../Common/MyWindows.h" 7 | #include "../../../Common/NewHandler.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Console/UpdateCallbackConsole.h: -------------------------------------------------------------------------------- 1 | // UpdateCallbackConsole.h 2 | 3 | #ifndef __UPDATE_CALLBACK_CONSOLE_H 4 | #define __UPDATE_CALLBACK_CONSOLE_H 5 | 6 | #include "Common/StdOutStream.h" 7 | 8 | #include "../Common/Update.h" 9 | 10 | #include "PercentPrinter.h" 11 | 12 | class CUpdateCallbackConsole: public IUpdateCallbackUI2 13 | { 14 | CPercentPrinter m_PercentPrinter; 15 | bool m_NeedBeClosed; 16 | bool m_NeedNewLine; 17 | 18 | bool m_WarningsMode; 19 | 20 | CStdOutStream *OutStream; 21 | public: 22 | bool EnablePercents; 23 | bool StdOutMode; 24 | 25 | #ifndef _NO_CRYPTO 26 | bool PasswordIsDefined; 27 | UString Password; 28 | bool AskPassword; 29 | #endif 30 | 31 | CUpdateCallbackConsole(): 32 | m_PercentPrinter(1 << 16), 33 | #ifndef _NO_CRYPTO 34 | PasswordIsDefined(false), 35 | AskPassword(false), 36 | #endif 37 | StdOutMode(false), 38 | EnablePercents(true), 39 | m_WarningsMode(false) 40 | {} 41 | 42 | ~CUpdateCallbackConsole() { Finilize(); } 43 | void Init(CStdOutStream *outStream) 44 | { 45 | m_NeedBeClosed = false; 46 | m_NeedNewLine = false; 47 | FailedFiles.Clear(); 48 | FailedCodes.Clear(); 49 | OutStream = outStream; 50 | m_PercentPrinter.OutStream = outStream; 51 | } 52 | 53 | INTERFACE_IUpdateCallbackUI2(;) 54 | 55 | UStringVector FailedFiles; 56 | CRecordVector FailedCodes; 57 | 58 | UStringVector CantFindFiles; 59 | CRecordVector CantFindCodes; 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Console/UserInputUtils.h: -------------------------------------------------------------------------------- 1 | // UserInputUtils.h 2 | 3 | #ifndef __USERINPUTUTILS_H 4 | #define __USERINPUTUTILS_H 5 | 6 | #include "Common/StdOutStream.h" 7 | 8 | namespace NUserAnswerMode { 9 | 10 | enum EEnum 11 | { 12 | kYes, 13 | kNo, 14 | kYesAll, 15 | kNoAll, 16 | kAutoRenameAll, 17 | kQuit 18 | }; 19 | } 20 | 21 | NUserAnswerMode::EEnum ScanUserYesNoAllQuit(CStdOutStream *outStream); 22 | UString GetPassword(CStdOutStream *outStream); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /_lzma/7zip/UI/Console/resource.rc: -------------------------------------------------------------------------------- 1 | #include "../../MyVersionInfo.rc" 2 | 3 | MY_VERSION_INFO_APP("7-Zip Console", "7z") 4 | -------------------------------------------------------------------------------- /_lzma/Common/AutoPtr.h: -------------------------------------------------------------------------------- 1 | // Common/AutoPtr.h 2 | 3 | #ifndef __COMMON_AUTOPTR_H 4 | #define __COMMON_AUTOPTR_H 5 | 6 | template class CMyAutoPtr 7 | { 8 | T *_p; 9 | public: 10 | CMyAutoPtr(T *p = 0) : _p(p) {} 11 | CMyAutoPtr(CMyAutoPtr& p): _p(p.release()) {} 12 | CMyAutoPtr& operator=(CMyAutoPtr& p) 13 | { 14 | reset(p.release()); 15 | return (*this); 16 | } 17 | ~CMyAutoPtr() { delete _p; } 18 | T& operator*() const { return *_p; } 19 | // T* operator->() const { return (&**this); } 20 | T* get() const { return _p; } 21 | T* release() 22 | { 23 | T *tmp = _p; 24 | _p = 0; 25 | return tmp; 26 | } 27 | void reset(T* p = 0) 28 | { 29 | if (p != _p) 30 | delete _p; 31 | _p = p; 32 | } 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /_lzma/Common/CRC.cpp: -------------------------------------------------------------------------------- 1 | // Common/CRC.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "../C/7zCrc.h" 6 | 7 | struct CCRCTableInit { CCRCTableInit() { CrcGenerateTable(); } } g_CRCTableInit; 8 | -------------------------------------------------------------------------------- /_lzma/Common/C_FileIO.h: -------------------------------------------------------------------------------- 1 | // Common/C_FileIO.h 2 | 3 | #ifndef __COMMON_C_FILEIO_H 4 | #define __COMMON_C_FILEIO_H 5 | 6 | #include 7 | #include 8 | 9 | #include "Types.h" 10 | #include "MyWindows.h" 11 | 12 | namespace NC { 13 | namespace NFile { 14 | namespace NIO { 15 | 16 | class CFileBase 17 | { 18 | protected: 19 | int _handle; 20 | bool OpenBinary(const char *name, int flags); 21 | public: 22 | CFileBase(): _handle(-1) {}; 23 | ~CFileBase() { Close(); } 24 | bool Close(); 25 | bool GetLength(UInt64 &length) const; 26 | off_t Seek(off_t distanceToMove, int moveMethod) const; 27 | }; 28 | 29 | class CInFile: public CFileBase 30 | { 31 | public: 32 | bool Open(const char *name); 33 | bool OpenShared(const char *name, bool shareForWrite); 34 | ssize_t Read(void *data, size_t size); 35 | }; 36 | 37 | class COutFile: public CFileBase 38 | { 39 | public: 40 | bool Create(const char *name, bool createAlways); 41 | bool Open(const char *name, DWORD creationDisposition); 42 | ssize_t Write(const void *data, size_t size); 43 | }; 44 | 45 | }}} 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /_lzma/Common/ComTry.h: -------------------------------------------------------------------------------- 1 | // ComTry.h 2 | 3 | #ifndef __COM_TRY_H 4 | #define __COM_TRY_H 5 | 6 | #include "MyWindows.h" 7 | // #include "Exception.h" 8 | // #include "NewHandler.h" 9 | 10 | #define COM_TRY_BEGIN try { 11 | #define COM_TRY_END } catch(...) { return E_OUTOFMEMORY; } 12 | 13 | // catch(const CNewException &) { return E_OUTOFMEMORY; } 14 | // catch(const CSystemException &e) { return e.ErrorCode; } 15 | // catch(...) { return E_FAIL; } 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /_lzma/Common/Defs.h: -------------------------------------------------------------------------------- 1 | // Common/Defs.h 2 | 3 | #ifndef __COMMON_DEFS_H 4 | #define __COMMON_DEFS_H 5 | 6 | template inline T MyMin(T a, T b) 7 | { return a < b ? a : b; } 8 | template inline T MyMax(T a, T b) 9 | { return a > b ? a : b; } 10 | 11 | template inline int MyCompare(T a, T b) 12 | { return a < b ? -1 : (a == b ? 0 : 1); } 13 | 14 | inline int BoolToInt(bool value) 15 | { return (value ? 1: 0); } 16 | 17 | inline bool IntToBool(int value) 18 | { return (value != 0); } 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /_lzma/Common/DynamicBuffer.h: -------------------------------------------------------------------------------- 1 | // Common/DynamicBuffer.h 2 | 3 | #ifndef __COMMON_DYNAMIC_BUFFER_H 4 | #define __COMMON_DYNAMIC_BUFFER_H 5 | 6 | #include "Buffer.h" 7 | 8 | template class CDynamicBuffer: public CBuffer 9 | { 10 | void GrowLength(size_t size) 11 | { 12 | size_t delta; 13 | if (this->_capacity > 64) 14 | delta = this->_capacity / 4; 15 | else if (this->_capacity > 8) 16 | delta = 16; 17 | else 18 | delta = 4; 19 | delta = MyMax(delta, size); 20 | size_t newCap = this->_capacity + delta; 21 | if (newCap < delta) 22 | newCap = this->_capacity + size; 23 | SetCapacity(newCap); 24 | } 25 | public: 26 | CDynamicBuffer(): CBuffer() {}; 27 | CDynamicBuffer(const CDynamicBuffer &buffer): CBuffer(buffer) {}; 28 | CDynamicBuffer(size_t size): CBuffer(size) {}; 29 | CDynamicBuffer& operator=(const CDynamicBuffer &buffer) 30 | { 31 | this->Free(); 32 | if (buffer._capacity > 0) 33 | { 34 | SetCapacity(buffer._capacity); 35 | memmove(this->_items, buffer._items, buffer._capacity * sizeof(T)); 36 | } 37 | return *this; 38 | } 39 | void EnsureCapacity(size_t capacity) 40 | { 41 | if (this->_capacity < capacity) 42 | GrowLength(capacity - this->_capacity); 43 | } 44 | }; 45 | 46 | typedef CDynamicBuffer CCharDynamicBuffer; 47 | typedef CDynamicBuffer CWCharDynamicBuffer; 48 | typedef CDynamicBuffer CByteDynamicBuffer; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /_lzma/Common/IntToString.cpp: -------------------------------------------------------------------------------- 1 | // Common/IntToString.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "IntToString.h" 6 | 7 | void ConvertUInt64ToString(UInt64 value, char *s, UInt32 base) 8 | { 9 | if (base < 2 || base > 36) 10 | { 11 | *s = '\0'; 12 | return; 13 | } 14 | char temp[72]; 15 | int pos = 0; 16 | do 17 | { 18 | int delta = (int)(value % base); 19 | temp[pos++] = (char)((delta < 10) ? ('0' + delta) : ('a' + (delta - 10))); 20 | value /= base; 21 | } 22 | while (value != 0); 23 | do 24 | *s++ = temp[--pos]; 25 | while (pos > 0); 26 | *s = '\0'; 27 | } 28 | 29 | void ConvertUInt64ToString(UInt64 value, wchar_t *s) 30 | { 31 | wchar_t temp[32]; 32 | int pos = 0; 33 | do 34 | { 35 | temp[pos++] = (wchar_t)(L'0' + (int)(value % 10)); 36 | value /= 10; 37 | } 38 | while (value != 0); 39 | do 40 | *s++ = temp[--pos]; 41 | while (pos > 0); 42 | *s = L'\0'; 43 | } 44 | 45 | void ConvertUInt32ToString(UInt32 value, char *s) { ConvertUInt64ToString(value, s); } 46 | void ConvertUInt32ToString(UInt32 value, wchar_t *s) { ConvertUInt64ToString(value, s); } 47 | 48 | void ConvertInt64ToString(Int64 value, char *s) 49 | { 50 | if (value < 0) 51 | { 52 | *s++ = '-'; 53 | value = -value; 54 | } 55 | ConvertUInt64ToString(value, s); 56 | } 57 | 58 | void ConvertInt64ToString(Int64 value, wchar_t *s) 59 | { 60 | if (value < 0) 61 | { 62 | *s++ = L'-'; 63 | value = -value; 64 | } 65 | ConvertUInt64ToString(value, s); 66 | } 67 | 68 | void ConvertUInt32ToHexWithZeros(UInt32 value, char *s) 69 | { 70 | for (int i = 0; i < 8; i++) 71 | { 72 | int t = value & 0xF; 73 | value >>= 4; 74 | s[7 - i] = (char)((t < 10) ? ('0' + t) : ('A' + (t - 10))); 75 | } 76 | s[8] = '\0'; 77 | } 78 | -------------------------------------------------------------------------------- /_lzma/Common/IntToString.h: -------------------------------------------------------------------------------- 1 | // Common/IntToString.h 2 | 3 | #ifndef __COMMON_INT_TO_STRING_H 4 | #define __COMMON_INT_TO_STRING_H 5 | 6 | #include 7 | #include "Types.h" 8 | 9 | void ConvertUInt64ToString(UInt64 value, char *s, UInt32 base = 10); 10 | void ConvertUInt64ToString(UInt64 value, wchar_t *s); 11 | void ConvertInt64ToString(Int64 value, char *s); 12 | void ConvertInt64ToString(Int64 value, wchar_t *s); 13 | 14 | void ConvertUInt32ToString(UInt32 value, char *s); 15 | void ConvertUInt32ToString(UInt32 value, wchar_t *s); 16 | 17 | void ConvertUInt32ToHexWithZeros(UInt32 value, char *s); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /_lzma/Common/ListFileUtils.h: -------------------------------------------------------------------------------- 1 | // Common/ListFileUtils.h 2 | 3 | #ifndef __COMMON_LISTFILEUTILS_H 4 | #define __COMMON_LISTFILEUTILS_H 5 | 6 | #include "MyString.h" 7 | #include "Types.h" 8 | 9 | bool ReadNamesFromListFile(LPCWSTR fileName, UStringVector &strings, UINT codePage = CP_OEMCP); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /_lzma/Common/MyException.h: -------------------------------------------------------------------------------- 1 | // Common/Exception.h 2 | 3 | #ifndef __COMMON_EXCEPTION_H 4 | #define __COMMON_EXCEPTION_H 5 | 6 | #include "MyWindows.h" 7 | 8 | struct CSystemException 9 | { 10 | HRESULT ErrorCode; 11 | CSystemException(HRESULT errorCode): ErrorCode(errorCode) {} 12 | }; 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /_lzma/Common/MyGuidDef.h: -------------------------------------------------------------------------------- 1 | // Common/MyGuidDef.h 2 | 3 | #ifndef GUID_DEFINED 4 | #define GUID_DEFINED 5 | 6 | #include "Types.h" 7 | 8 | typedef struct { 9 | UInt32 Data1; 10 | UInt16 Data2; 11 | UInt16 Data3; 12 | unsigned char Data4[8]; 13 | } GUID; 14 | 15 | #ifdef __cplusplus 16 | #define REFGUID const GUID & 17 | #else 18 | #define REFGUID const GUID * 19 | #endif 20 | 21 | #define REFCLSID REFGUID 22 | #define REFIID REFGUID 23 | 24 | #ifdef __cplusplus 25 | inline int operator==(REFGUID g1, REFGUID g2) 26 | { 27 | for (int i = 0; i < (int)sizeof(g1); i++) 28 | if (((unsigned char *)&g1)[i] != ((unsigned char *)&g2)[i]) 29 | return 0; 30 | return 1; 31 | } 32 | inline int operator!=(REFGUID g1, REFGUID g2) { return !(g1 == g2); } 33 | #endif 34 | 35 | #ifdef __cplusplus 36 | #define MY_EXTERN_C extern "C" 37 | #else 38 | #define MY_EXTERN_C extern 39 | #endif 40 | 41 | #endif 42 | 43 | 44 | #ifdef DEFINE_GUID 45 | #undef DEFINE_GUID 46 | #endif 47 | 48 | #ifdef INITGUID 49 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ 50 | MY_EXTERN_C const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } 51 | #else 52 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ 53 | MY_EXTERN_C const GUID name 54 | #endif 55 | -------------------------------------------------------------------------------- /_lzma/Common/MyInitGuid.h: -------------------------------------------------------------------------------- 1 | // Common/MyInitGuid.h 2 | 3 | #ifndef __COMMON_MY_INITGUID_H 4 | #define __COMMON_MY_INITGUID_H 5 | 6 | #ifdef _WIN32 7 | #ifdef UNDER_CE 8 | #include 9 | #endif 10 | #include 11 | #ifdef UNDER_CE 12 | DEFINE_GUID(IID_IUnknown, 13 | 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); 14 | #endif 15 | #else 16 | #define INITGUID 17 | #include "MyGuidDef.h" 18 | DEFINE_GUID(IID_IUnknown, 19 | 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /_lzma/Common/MyUnknown.h: -------------------------------------------------------------------------------- 1 | // MyUnknown.h 2 | 3 | #ifndef __MY_UNKNOWN_H 4 | #define __MY_UNKNOWN_H 5 | 6 | #ifdef _WIN32 7 | #include 8 | #include 9 | #else 10 | #include "MyWindows.h" 11 | #endif 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /_lzma/Common/NewHandler.h: -------------------------------------------------------------------------------- 1 | // Common/NewHandler.h 2 | 3 | #ifndef __COMMON_NEWHANDLER_H 4 | #define __COMMON_NEWHANDLER_H 5 | 6 | class CNewException {}; 7 | 8 | #ifdef _WIN32 9 | void 10 | #ifdef _MSC_VER 11 | __cdecl 12 | #endif 13 | operator delete(void *p) throw(); 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /_lzma/Common/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | // #include "MyWindows.h" 7 | #include "NewHandler.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /_lzma/Common/StdInStream.h: -------------------------------------------------------------------------------- 1 | // Common/StdInStream.h 2 | 3 | #ifndef __COMMON_STDINSTREAM_H 4 | #define __COMMON_STDINSTREAM_H 5 | 6 | #include 7 | 8 | #include "MyString.h" 9 | #include "Types.h" 10 | 11 | class CStdInStream 12 | { 13 | bool _streamIsOpen; 14 | FILE *_stream; 15 | public: 16 | CStdInStream(): _streamIsOpen(false) {}; 17 | CStdInStream(FILE *stream): _streamIsOpen(false), _stream(stream) {}; 18 | ~CStdInStream(); 19 | bool Open(LPCTSTR fileName); 20 | bool Close(); 21 | 22 | AString ScanStringUntilNewLine(bool allowEOF = false); 23 | void ReadToString(AString &resultString); 24 | UString ScanUStringUntilNewLine(); 25 | 26 | bool Eof(); 27 | int GetChar(); 28 | }; 29 | 30 | extern CStdInStream g_StdIn; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /_lzma/Common/StdOutStream.h: -------------------------------------------------------------------------------- 1 | // Common/StdOutStream.h 2 | 3 | #ifndef __COMMON_STDOUTSTREAM_H 4 | #define __COMMON_STDOUTSTREAM_H 5 | 6 | #include 7 | 8 | #include "Types.h" 9 | 10 | class CStdOutStream 11 | { 12 | bool _streamIsOpen; 13 | FILE *_stream; 14 | public: 15 | CStdOutStream (): _streamIsOpen(false), _stream(0) {}; 16 | CStdOutStream (FILE *stream): _streamIsOpen(false), _stream(stream) {}; 17 | ~CStdOutStream (); 18 | operator FILE *() { return _stream; } 19 | bool Open(const char *fileName); 20 | bool Close(); 21 | bool Flush(); 22 | CStdOutStream & operator<<(CStdOutStream & (* aFunction)(CStdOutStream &)); 23 | CStdOutStream & operator<<(const char *string); 24 | CStdOutStream & operator<<(const wchar_t *string); 25 | CStdOutStream & operator<<(char c); 26 | CStdOutStream & operator<<(int number); 27 | CStdOutStream & operator<<(UInt64 number); 28 | }; 29 | 30 | CStdOutStream & endl(CStdOutStream & outStream); 31 | 32 | extern CStdOutStream g_StdOut; 33 | extern CStdOutStream g_StdErr; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /_lzma/Common/StringToInt.h: -------------------------------------------------------------------------------- 1 | // Common/StringToInt.h 2 | 3 | #ifndef __COMMON_STRINGTOINT_H 4 | #define __COMMON_STRINGTOINT_H 5 | 6 | #include 7 | #include "Types.h" 8 | 9 | UInt64 ConvertStringToUInt64(const char *s, const char **end); 10 | UInt64 ConvertOctStringToUInt64(const char *s, const char **end); 11 | UInt64 ConvertHexStringToUInt64(const char *s, const char **end); 12 | UInt64 ConvertStringToUInt64(const wchar_t *s, const wchar_t **end); 13 | 14 | Int64 ConvertStringToInt64(const char *s, const char **end); 15 | 16 | #endif 17 | 18 | 19 | -------------------------------------------------------------------------------- /_lzma/Common/Types.h: -------------------------------------------------------------------------------- 1 | // Common/Types.h 2 | 3 | #ifndef __COMMON_TYPES_H 4 | #define __COMMON_TYPES_H 5 | 6 | #include "../C/Types.h" 7 | 8 | typedef int HRes; 9 | 10 | #endif 11 | 12 | -------------------------------------------------------------------------------- /_lzma/Common/UTFConvert.h: -------------------------------------------------------------------------------- 1 | // Common/UTFConvert.h 2 | 3 | #ifndef __COMMON_UTFCONVERT_H 4 | #define __COMMON_UTFCONVERT_H 5 | 6 | #include "MyString.h" 7 | 8 | bool ConvertUTF8ToUnicode(const AString &utfString, UString &resultString); 9 | bool ConvertUnicodeToUTF8(const UString &unicodeString, AString &resultString); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /_lzma/Windows/DLL.h: -------------------------------------------------------------------------------- 1 | // Windows/DLL.h 2 | 3 | #ifndef __WINDOWS_DLL_H 4 | #define __WINDOWS_DLL_H 5 | 6 | #include "../Common/MyString.h" 7 | 8 | namespace NWindows { 9 | namespace NDLL { 10 | 11 | #ifdef UNDER_CE 12 | #define My_GetProcAddress(module, proceName) GetProcAddressA(module, proceName) 13 | #else 14 | #define My_GetProcAddress(module, proceName) ::GetProcAddress(module, proceName) 15 | #endif 16 | 17 | class CLibrary 18 | { 19 | bool LoadOperations(HMODULE newModule); 20 | protected: 21 | HMODULE _module; 22 | public: 23 | CLibrary(): _module(NULL) {}; 24 | ~CLibrary() { Free(); } 25 | 26 | operator HMODULE() const { return _module; } 27 | HMODULE* operator&() { return &_module; } 28 | bool IsLoaded() const { return (_module != NULL); }; 29 | 30 | void Attach(HMODULE m) 31 | { 32 | Free(); 33 | _module = m; 34 | } 35 | HMODULE Detach() 36 | { 37 | HMODULE m = _module; 38 | _module = NULL; 39 | return m; 40 | } 41 | 42 | bool Free(); 43 | bool LoadEx(LPCTSTR fileName, DWORD flags = LOAD_LIBRARY_AS_DATAFILE); 44 | bool Load(LPCTSTR fileName); 45 | #ifndef _UNICODE 46 | bool LoadEx(LPCWSTR fileName, DWORD flags = LOAD_LIBRARY_AS_DATAFILE); 47 | bool Load(LPCWSTR fileName); 48 | #endif 49 | FARPROC GetProc(LPCSTR procName) const { return My_GetProcAddress(_module, procName); } 50 | }; 51 | 52 | bool MyGetModuleFileName(HMODULE hModule, CSysString &result); 53 | #ifndef _UNICODE 54 | bool MyGetModuleFileName(HMODULE hModule, UString &result); 55 | #endif 56 | 57 | }} 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /_lzma/Windows/Defs.h: -------------------------------------------------------------------------------- 1 | // Windows/Defs.h 2 | 3 | #ifndef __WINDOWS_DEFS_H 4 | #define __WINDOWS_DEFS_H 5 | 6 | #include "../Common/MyWindows.h" 7 | 8 | #ifdef _WIN32 9 | inline bool LRESULTToBool(LRESULT v) { return (v != FALSE); } 10 | inline bool BOOLToBool(BOOL v) { return (v != FALSE); } 11 | inline BOOL BoolToBOOL(bool v) { return (v ? TRUE: FALSE); } 12 | #endif 13 | 14 | inline VARIANT_BOOL BoolToVARIANT_BOOL(bool v) { return (v ? VARIANT_TRUE: VARIANT_FALSE); } 15 | inline bool VARIANT_BOOLToBool(VARIANT_BOOL v) { return (v != VARIANT_FALSE); } 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /_lzma/Windows/Error.cpp: -------------------------------------------------------------------------------- 1 | // Windows/Error.h 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "Windows/Error.h" 6 | #ifndef _UNICODE 7 | #include "Common/StringConvert.h" 8 | #endif 9 | 10 | #ifndef _UNICODE 11 | extern bool g_IsNT; 12 | #endif 13 | 14 | namespace NWindows { 15 | namespace NError { 16 | 17 | bool MyFormatMessage(DWORD messageID, CSysString &message) 18 | { 19 | LPVOID msgBuf; 20 | if (::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 21 | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 22 | NULL,messageID, 0, (LPTSTR) &msgBuf,0, NULL) == 0) 23 | return false; 24 | message = (LPCTSTR)msgBuf; 25 | ::LocalFree(msgBuf); 26 | return true; 27 | } 28 | 29 | #ifndef _UNICODE 30 | bool MyFormatMessage(DWORD messageID, UString &message) 31 | { 32 | if (g_IsNT) 33 | { 34 | LPVOID msgBuf; 35 | if (::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | 36 | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 37 | NULL, messageID, 0, (LPWSTR) &msgBuf, 0, NULL) == 0) 38 | return false; 39 | message = (LPCWSTR)msgBuf; 40 | ::LocalFree(msgBuf); 41 | return true; 42 | } 43 | CSysString messageSys; 44 | bool result = MyFormatMessage(messageID, messageSys); 45 | message = GetUnicodeString(messageSys); 46 | return result; 47 | } 48 | #endif 49 | 50 | }} 51 | -------------------------------------------------------------------------------- /_lzma/Windows/Error.h: -------------------------------------------------------------------------------- 1 | // Windows/Error.h 2 | 3 | #ifndef __WINDOWS_ERROR_H 4 | #define __WINDOWS_ERROR_H 5 | 6 | #include "Common/MyString.h" 7 | 8 | namespace NWindows { 9 | namespace NError { 10 | 11 | bool MyFormatMessage(DWORD messageID, CSysString &message); 12 | inline CSysString MyFormatMessage(DWORD messageID) 13 | { 14 | CSysString message; 15 | MyFormatMessage(messageID, message); 16 | return message; 17 | } 18 | #ifdef _UNICODE 19 | inline UString MyFormatMessageW(DWORD messageID) 20 | { return MyFormatMessage(messageID); } 21 | #else 22 | bool MyFormatMessage(DWORD messageID, UString &message); 23 | inline UString MyFormatMessageW(DWORD messageID) 24 | { 25 | UString message; 26 | MyFormatMessage(messageID, message); 27 | return message; 28 | } 29 | #endif 30 | 31 | }} 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /_lzma/Windows/FileMapping.cpp: -------------------------------------------------------------------------------- 1 | // Windows/FileMapping.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "Windows/FileMapping.h" 6 | 7 | namespace NWindows { 8 | namespace NFile { 9 | namespace NMapping { 10 | 11 | 12 | }}} 13 | -------------------------------------------------------------------------------- /_lzma/Windows/FileMapping.h: -------------------------------------------------------------------------------- 1 | // Windows/FileMapping.h 2 | 3 | #ifndef __WINDOWS_FILEMAPPING_H 4 | #define __WINDOWS_FILEMAPPING_H 5 | 6 | #include "Common/Types.h" 7 | 8 | #include "Handle.h" 9 | 10 | namespace NWindows { 11 | 12 | class CFileMapping: public CHandle 13 | { 14 | public: 15 | WRes Create(DWORD protect, UInt64 maxSize, LPCTSTR name) 16 | { 17 | _handle = ::CreateFileMapping(INVALID_HANDLE_VALUE, NULL, protect, (DWORD)(maxSize >> 32), (DWORD)maxSize, name); 18 | return ::GetLastError(); 19 | } 20 | 21 | WRes Open(DWORD desiredAccess, LPCTSTR name) 22 | { 23 | #ifdef UNDER_CE 24 | WRes res = Create(PAGE_READONLY, 0, name); 25 | if (res == ERROR_ALREADY_EXISTS) 26 | return 0; 27 | Close(); 28 | if (res == 0) 29 | res = ERROR_FILE_NOT_FOUND; 30 | return res; 31 | #else 32 | _handle = ::OpenFileMapping(desiredAccess, FALSE, name); 33 | if (_handle != 0) 34 | return 0; 35 | return ::GetLastError(); 36 | #endif 37 | } 38 | 39 | LPVOID Map(DWORD desiredAccess, UInt64 fileOffset, SIZE_T numberOfBytesToMap) 40 | { 41 | return ::MapViewOfFile(_handle, desiredAccess, (DWORD)(fileOffset >> 32), (DWORD)fileOffset, numberOfBytesToMap); 42 | } 43 | 44 | #ifndef UNDER_CE 45 | LPVOID Map(DWORD desiredAccess, UInt64 fileOffset, SIZE_T numberOfBytesToMap, LPVOID baseAddress) 46 | { 47 | return ::MapViewOfFileEx(_handle, desiredAccess, (DWORD)(fileOffset >> 32), (DWORD)fileOffset, numberOfBytesToMap, baseAddress); 48 | } 49 | #endif 50 | }; 51 | 52 | class CFileUnmapper 53 | { 54 | const void *_data; 55 | public: 56 | CFileUnmapper(const void *data) : _data(data) {} 57 | ~CFileUnmapper() { ::UnmapViewOfFile(_data); } 58 | }; 59 | 60 | } 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /_lzma/Windows/FileName.cpp: -------------------------------------------------------------------------------- 1 | // Windows/FileName.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "Windows/FileName.h" 6 | #include "Common/Wildcard.h" 7 | 8 | namespace NWindows { 9 | namespace NFile { 10 | namespace NName { 11 | 12 | void NormalizeDirPathPrefix(CSysString &dirPath) 13 | { 14 | if (dirPath.IsEmpty()) 15 | return; 16 | if (dirPath.ReverseFind(kDirDelimiter) != dirPath.Length() - 1) 17 | dirPath += kDirDelimiter; 18 | } 19 | 20 | #ifndef _UNICODE 21 | void NormalizeDirPathPrefix(UString &dirPath) 22 | { 23 | if (dirPath.IsEmpty()) 24 | return; 25 | if (dirPath.ReverseFind(wchar_t(kDirDelimiter)) != dirPath.Length() - 1) 26 | dirPath += wchar_t(kDirDelimiter); 27 | } 28 | #endif 29 | 30 | const wchar_t kExtensionDelimiter = L'.'; 31 | 32 | void SplitNameToPureNameAndExtension(const UString &fullName, 33 | UString &pureName, UString &extensionDelimiter, UString &extension) 34 | { 35 | int index = fullName.ReverseFind(kExtensionDelimiter); 36 | if (index < 0) 37 | { 38 | pureName = fullName; 39 | extensionDelimiter.Empty(); 40 | extension.Empty(); 41 | } 42 | else 43 | { 44 | pureName = fullName.Left(index); 45 | extensionDelimiter = kExtensionDelimiter; 46 | extension = fullName.Mid(index + 1); 47 | } 48 | } 49 | 50 | }}} 51 | -------------------------------------------------------------------------------- /_lzma/Windows/FileName.h: -------------------------------------------------------------------------------- 1 | // Windows/FileName.h 2 | 3 | #ifndef __WINDOWS_FILENAME_H 4 | #define __WINDOWS_FILENAME_H 5 | 6 | #include "../../C/Types.h" 7 | 8 | #include "../Common/MyString.h" 9 | 10 | namespace NWindows { 11 | namespace NFile { 12 | namespace NName { 13 | 14 | const TCHAR kDirDelimiter = CHAR_PATH_SEPARATOR; 15 | const TCHAR kAnyStringWildcard = '*'; 16 | 17 | void NormalizeDirPathPrefix(CSysString &dirPath); // ensures that it ended with '\\' 18 | #ifndef _UNICODE 19 | void NormalizeDirPathPrefix(UString &dirPath); // ensures that it ended with '\\' 20 | #endif 21 | 22 | void SplitNameToPureNameAndExtension(const UString &fullName, 23 | UString &pureName, UString &extensionDelimiter, UString &extension); 24 | 25 | }}} 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /_lzma/Windows/Handle.h: -------------------------------------------------------------------------------- 1 | // Windows/Handle.h 2 | 3 | #ifndef __WINDOWS_HANDLE_H 4 | #define __WINDOWS_HANDLE_H 5 | 6 | namespace NWindows { 7 | 8 | class CHandle 9 | { 10 | protected: 11 | HANDLE _handle; 12 | public: 13 | operator HANDLE() { return _handle; } 14 | CHandle(): _handle(NULL) {} 15 | ~CHandle() { Close(); } 16 | bool IsCreated() const { return (_handle != NULL); } 17 | bool Close() 18 | { 19 | if (_handle == NULL) 20 | return true; 21 | if (!::CloseHandle(_handle)) 22 | return false; 23 | _handle = NULL; 24 | return true; 25 | } 26 | void Attach(HANDLE handle) { _handle = handle; } 27 | HANDLE Detach() 28 | { 29 | HANDLE handle = _handle; 30 | _handle = NULL; 31 | return handle; 32 | } 33 | }; 34 | 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /_lzma/Windows/MemoryLock.h: -------------------------------------------------------------------------------- 1 | // Windows/MemoryLock.h 2 | 3 | #ifndef __WINDOWS_MEMORYLOCK_H 4 | #define __WINDOWS_MEMORYLOCK_H 5 | 6 | namespace NWindows { 7 | namespace NSecurity { 8 | 9 | #ifndef UNDER_CE 10 | bool EnableLockMemoryPrivilege(bool enable = true); 11 | #endif 12 | 13 | }} 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /_lzma/Windows/NtCheck.h: -------------------------------------------------------------------------------- 1 | // Windows/NtCheck.h 2 | 3 | #ifndef __WINDOWS_NT_CHECK_H 4 | #define __WINDOWS_NT_CHECK_H 5 | 6 | #ifdef _WIN32 7 | 8 | #if !defined(_WIN64) && !defined(UNDER_CE) 9 | static inline bool IsItWindowsNT() 10 | { 11 | OSVERSIONINFO vi; 12 | vi.dwOSVersionInfoSize = sizeof(vi); 13 | return (::GetVersionEx(&vi) && vi.dwPlatformId == VER_PLATFORM_WIN32_NT); 14 | } 15 | #endif 16 | 17 | #ifndef _UNICODE 18 | #if defined(_WIN64) || defined(UNDER_CE) 19 | bool g_IsNT = true; 20 | #define SET_IS_NT 21 | #else 22 | bool g_IsNT = false; 23 | #define SET_IS_NT g_IsNT = IsItWindowsNT(); 24 | #endif 25 | #define NT_CHECK_ACTION 26 | // #define NT_CHECK_ACTION { NT_CHECK_FAIL_ACTION } 27 | #else 28 | #if !defined(_WIN64) && !defined(UNDER_CE) 29 | #define NT_CHECK_ACTION if (!IsItWindowsNT()) { NT_CHECK_FAIL_ACTION } 30 | #else 31 | #define NT_CHECK_ACTION 32 | #endif 33 | #define SET_IS_NT 34 | #endif 35 | 36 | #define NT_CHECK NT_CHECK_ACTION SET_IS_NT 37 | 38 | #else 39 | 40 | #define NT_CHECK 41 | 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /_lzma/Windows/PropVariantConversions.h: -------------------------------------------------------------------------------- 1 | // Windows/PropVariantConversions.h 2 | 3 | #ifndef __PROP_VARIANT_CONVERSIONS_H 4 | #define __PROP_VARIANT_CONVERSIONS_H 5 | 6 | #include "Common/MyString.h" 7 | #include "Common/Types.h" 8 | 9 | bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime = true, bool includeSeconds = true); 10 | UString ConvertFileTimeToString(const FILETIME &ft, bool includeTime = true, bool includeSeconds = true); 11 | UString ConvertPropVariantToString(const PROPVARIANT &prop); 12 | UInt64 ConvertPropVariantToUInt64(const PROPVARIANT &prop); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /_lzma/Windows/StdAfx.h: -------------------------------------------------------------------------------- 1 | // StdAfx.h 2 | 3 | #ifndef __STDAFX_H 4 | #define __STDAFX_H 5 | 6 | #include "../Common/MyWindows.h" 7 | #include "../Common/NewHandler.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /_lzma/Windows/Synchronization.cpp: -------------------------------------------------------------------------------- 1 | // Windows/Synchronization.cpp 2 | 3 | #include "StdAfx.h" 4 | 5 | #include "Synchronization.h" 6 | 7 | namespace NWindows { 8 | namespace NSynchronization { 9 | 10 | }} 11 | -------------------------------------------------------------------------------- /_lzma/Windows/System.h: -------------------------------------------------------------------------------- 1 | // Windows/System.h 2 | 3 | #ifndef __WINDOWS_SYSTEM_H 4 | #define __WINDOWS_SYSTEM_H 5 | 6 | #include "../Common/Types.h" 7 | 8 | namespace NWindows { 9 | namespace NSystem { 10 | 11 | UInt32 GetNumberOfProcessors(); 12 | UInt64 GetRamSize(); 13 | 14 | }} 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /_lzma/Windows/Thread.h: -------------------------------------------------------------------------------- 1 | // Windows/Thread.h 2 | 3 | #ifndef __WINDOWS_THREAD_H 4 | #define __WINDOWS_THREAD_H 5 | 6 | #include "../C/Threads.h" 7 | 8 | #include "Defs.h" 9 | 10 | namespace NWindows { 11 | 12 | class CThread 13 | { 14 | ::CThread thread; 15 | public: 16 | CThread() { Thread_Construct(&thread); } 17 | ~CThread() { Close(); } 18 | bool IsCreated() { return Thread_WasCreated(&thread) != 0; } 19 | WRes Close() { return Thread_Close(&thread); } 20 | WRes Create(THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE *startAddress)(void *), LPVOID parameter) 21 | { return Thread_Create(&thread, startAddress, parameter); } 22 | WRes Wait() { return Thread_Wait(&thread); } 23 | 24 | #ifdef _WIN32 25 | operator HANDLE() { return thread; } 26 | void Attach(HANDLE handle) { thread = handle; } 27 | HANDLE Detach() { HANDLE h = thread; thread = NULL; return h; } 28 | DWORD Resume() { return ::ResumeThread(thread); } 29 | DWORD Suspend() { return ::SuspendThread(thread); } 30 | bool Terminate(DWORD exitCode) { return BOOLToBool(::TerminateThread(thread, exitCode)); } 31 | int GetPriority() { return ::GetThreadPriority(thread); } 32 | bool SetPriority(int priority) { return BOOLToBool(::SetThreadPriority(thread, priority)); } 33 | #endif 34 | }; 35 | 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /_lzma/Windows/Time.h: -------------------------------------------------------------------------------- 1 | // Windows/Time.h 2 | 3 | #ifndef __WINDOWS_TIME_H 4 | #define __WINDOWS_TIME_H 5 | 6 | #include "Common/Types.h" 7 | 8 | namespace NWindows { 9 | namespace NTime { 10 | 11 | bool DosTimeToFileTime(UInt32 dosTime, FILETIME &fileTime); 12 | bool FileTimeToDosTime(const FILETIME &fileTime, UInt32 &dosTime); 13 | void UnixTimeToFileTime(UInt32 unixTime, FILETIME &fileTime); 14 | bool FileTimeToUnixTime(const FILETIME &fileTime, UInt32 &unixTime); 15 | bool GetSecondsSince1601(unsigned year, unsigned month, unsigned day, 16 | unsigned hour, unsigned min, unsigned sec, UInt64 &resSeconds); 17 | void GetCurUtcFileTime(FILETIME &ft); 18 | 19 | }} 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /_lzma/c/7zAlloc.c: -------------------------------------------------------------------------------- 1 | /* 7zAlloc.c -- Allocation functions 2 | 2010-10-29 : Igor Pavlov : Public domain */ 3 | 4 | #include "7zAlloc.h" 5 | 6 | /* #define _SZ_ALLOC_DEBUG */ 7 | /* use _SZ_ALLOC_DEBUG to debug alloc/free operations */ 8 | 9 | #ifdef _SZ_ALLOC_DEBUG 10 | 11 | #ifdef _WIN32 12 | #include 13 | #endif 14 | 15 | #include 16 | int g_allocCount = 0; 17 | int g_allocCountTemp = 0; 18 | 19 | #endif 20 | 21 | void *SzAlloc(void *p, size_t size) 22 | { 23 | p = p; 24 | if (size == 0) 25 | return 0; 26 | #ifdef _SZ_ALLOC_DEBUG 27 | fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount); 28 | g_allocCount++; 29 | #endif 30 | return malloc(size); 31 | } 32 | 33 | void SzFree(void *p, void *address) 34 | { 35 | p = p; 36 | #ifdef _SZ_ALLOC_DEBUG 37 | if (address != 0) 38 | { 39 | g_allocCount--; 40 | fprintf(stderr, "\nFree; count = %10d", g_allocCount); 41 | } 42 | #endif 43 | free(address); 44 | } 45 | 46 | void *SzAllocTemp(void *p, size_t size) 47 | { 48 | p = p; 49 | if (size == 0) 50 | return 0; 51 | #ifdef _SZ_ALLOC_DEBUG 52 | fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTemp); 53 | g_allocCountTemp++; 54 | #ifdef _WIN32 55 | return HeapAlloc(GetProcessHeap(), 0, size); 56 | #endif 57 | #endif 58 | return malloc(size); 59 | } 60 | 61 | void SzFreeTemp(void *p, void *address) 62 | { 63 | p = p; 64 | #ifdef _SZ_ALLOC_DEBUG 65 | if (address != 0) 66 | { 67 | g_allocCountTemp--; 68 | fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp); 69 | } 70 | #ifdef _WIN32 71 | HeapFree(GetProcessHeap(), 0, address); 72 | return; 73 | #endif 74 | #endif 75 | free(address); 76 | } 77 | -------------------------------------------------------------------------------- /_lzma/c/7zAlloc.h: -------------------------------------------------------------------------------- 1 | /* 7zAlloc.h -- Allocation functions 2 | 2010-10-29 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_ALLOC_H 5 | #define __7Z_ALLOC_H 6 | 7 | #include 8 | 9 | void *SzAlloc(void *p, size_t size); 10 | void SzFree(void *p, void *address); 11 | 12 | void *SzAllocTemp(void *p, size_t size); 13 | void SzFreeTemp(void *p, void *address); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /_lzma/c/7zBuf.c: -------------------------------------------------------------------------------- 1 | /* 7zBuf.c -- Byte Buffer 2 | 2008-03-28 3 | Igor Pavlov 4 | Public domain */ 5 | 6 | #include "7zBuf.h" 7 | 8 | void Buf_Init(CBuf *p) 9 | { 10 | p->data = 0; 11 | p->size = 0; 12 | } 13 | 14 | int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc) 15 | { 16 | p->size = 0; 17 | if (size == 0) 18 | { 19 | p->data = 0; 20 | return 1; 21 | } 22 | p->data = (Byte *)alloc->Alloc(alloc, size); 23 | if (p->data != 0) 24 | { 25 | p->size = size; 26 | return 1; 27 | } 28 | return 0; 29 | } 30 | 31 | void Buf_Free(CBuf *p, ISzAlloc *alloc) 32 | { 33 | alloc->Free(alloc, p->data); 34 | p->data = 0; 35 | p->size = 0; 36 | } 37 | -------------------------------------------------------------------------------- /_lzma/c/7zBuf.h: -------------------------------------------------------------------------------- 1 | /* 7zBuf.h -- Byte Buffer 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_BUF_H 5 | #define __7Z_BUF_H 6 | 7 | #include "Types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | typedef struct 14 | { 15 | Byte *data; 16 | size_t size; 17 | } CBuf; 18 | 19 | void Buf_Init(CBuf *p); 20 | int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc); 21 | void Buf_Free(CBuf *p, ISzAlloc *alloc); 22 | 23 | typedef struct 24 | { 25 | Byte *data; 26 | size_t size; 27 | size_t pos; 28 | } CDynBuf; 29 | 30 | void DynBuf_Construct(CDynBuf *p); 31 | void DynBuf_SeekToBeg(CDynBuf *p); 32 | int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc); 33 | void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /_lzma/c/7zBuf2.c: -------------------------------------------------------------------------------- 1 | /* 7zBuf2.c -- Byte Buffer 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #include 5 | #include "7zBuf.h" 6 | 7 | void DynBuf_Construct(CDynBuf *p) 8 | { 9 | p->data = 0; 10 | p->size = 0; 11 | p->pos = 0; 12 | } 13 | 14 | void DynBuf_SeekToBeg(CDynBuf *p) 15 | { 16 | p->pos = 0; 17 | } 18 | 19 | int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc) 20 | { 21 | if (size > p->size - p->pos) 22 | { 23 | size_t newSize = p->pos + size; 24 | Byte *data; 25 | newSize += newSize / 4; 26 | data = (Byte *)alloc->Alloc(alloc, newSize); 27 | if (data == 0) 28 | return 0; 29 | p->size = newSize; 30 | memcpy(data, p->data, p->pos); 31 | alloc->Free(alloc, p->data); 32 | p->data = data; 33 | } 34 | memcpy(p->data + p->pos, buf, size); 35 | p->pos += size; 36 | return 1; 37 | } 38 | 39 | void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc) 40 | { 41 | alloc->Free(alloc, p->data); 42 | p->data = 0; 43 | p->size = 0; 44 | p->pos = 0; 45 | } 46 | -------------------------------------------------------------------------------- /_lzma/c/7zCrc.h: -------------------------------------------------------------------------------- 1 | /* 7zCrc.h -- CRC32 calculation 2 | 2009-11-21 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_CRC_H 5 | #define __7Z_CRC_H 6 | 7 | #include "Types.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | extern UInt32 g_CrcTable[]; 12 | 13 | /* Call CrcGenerateTable one time before other CRC functions */ 14 | void MY_FAST_CALL CrcGenerateTable(void); 15 | 16 | #define CRC_INIT_VAL 0xFFFFFFFF 17 | #define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL) 18 | #define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 19 | 20 | UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size); 21 | UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size); 22 | 23 | EXTERN_C_END 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /_lzma/c/7zCrcOpt.c: -------------------------------------------------------------------------------- 1 | /* 7zCrcOpt.c -- CRC32 calculation : optimized version 2 | 2009-11-23 : Igor Pavlov : Public domain */ 3 | 4 | #include "CpuArch.h" 5 | 6 | #ifdef MY_CPU_LE 7 | 8 | #define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 9 | 10 | UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table) 11 | { 12 | const Byte *p = (const Byte *)data; 13 | for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++) 14 | v = CRC_UPDATE_BYTE_2(v, *p); 15 | for (; size >= 4; size -= 4, p += 4) 16 | { 17 | v ^= *(const UInt32 *)p; 18 | v = 19 | table[0x300 + (v & 0xFF)] ^ 20 | table[0x200 + ((v >> 8) & 0xFF)] ^ 21 | table[0x100 + ((v >> 16) & 0xFF)] ^ 22 | table[0x000 + ((v >> 24))]; 23 | } 24 | for (; size > 0; size--, p++) 25 | v = CRC_UPDATE_BYTE_2(v, *p); 26 | return v; 27 | } 28 | 29 | UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table) 30 | { 31 | return CrcUpdateT4(v, data, size, table); 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /_lzma/c/7zVersion.h: -------------------------------------------------------------------------------- 1 | #define MY_VER_MAJOR 9 2 | #define MY_VER_MINOR 20 3 | #define MY_VER_BUILD 0 4 | #define MY_VERSION "9.20" 5 | #define MY_DATE "2010-11-18" 6 | #define MY_COPYRIGHT ": Igor Pavlov : Public domain" 7 | #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE 8 | -------------------------------------------------------------------------------- /_lzma/c/Alloc.h: -------------------------------------------------------------------------------- 1 | /* Alloc.h -- Memory allocation functions 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __COMMON_ALLOC_H 5 | #define __COMMON_ALLOC_H 6 | 7 | #include 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | void *MyAlloc(size_t size); 14 | void MyFree(void *address); 15 | 16 | #ifdef _WIN32 17 | 18 | void SetLargePageSize(); 19 | 20 | void *MidAlloc(size_t size); 21 | void MidFree(void *address); 22 | void *BigAlloc(size_t size); 23 | void BigFree(void *address); 24 | 25 | #else 26 | 27 | #define MidAlloc(size) MyAlloc(size) 28 | #define MidFree(address) MyFree(address) 29 | #define BigAlloc(size) MyAlloc(size) 30 | #define BigFree(address) MyFree(address) 31 | 32 | #endif 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /_lzma/c/Bcj2.h: -------------------------------------------------------------------------------- 1 | /* Bcj2.h -- Converter for x86 code (BCJ2) 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __BCJ2_H 5 | #define __BCJ2_H 6 | 7 | #include "Types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /* 14 | Conditions: 15 | outSize <= FullOutputSize, 16 | where FullOutputSize is full size of output stream of x86_2 filter. 17 | 18 | If buf0 overlaps outBuf, there are two required conditions: 19 | 1) (buf0 >= outBuf) 20 | 2) (buf0 + size0 >= outBuf + FullOutputSize). 21 | 22 | Returns: 23 | SZ_OK 24 | SZ_ERROR_DATA - Data error 25 | */ 26 | 27 | int Bcj2_Decode( 28 | const Byte *buf0, SizeT size0, 29 | const Byte *buf1, SizeT size1, 30 | const Byte *buf2, SizeT size2, 31 | const Byte *buf3, SizeT size3, 32 | Byte *outBuf, SizeT outSize); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /_lzma/c/Delta.c: -------------------------------------------------------------------------------- 1 | /* Delta.c -- Delta converter 2 | 2009-05-26 : Igor Pavlov : Public domain */ 3 | 4 | #include "Delta.h" 5 | 6 | void Delta_Init(Byte *state) 7 | { 8 | unsigned i; 9 | for (i = 0; i < DELTA_STATE_SIZE; i++) 10 | state[i] = 0; 11 | } 12 | 13 | static void MyMemCpy(Byte *dest, const Byte *src, unsigned size) 14 | { 15 | unsigned i; 16 | for (i = 0; i < size; i++) 17 | dest[i] = src[i]; 18 | } 19 | 20 | void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size) 21 | { 22 | Byte buf[DELTA_STATE_SIZE]; 23 | unsigned j = 0; 24 | MyMemCpy(buf, state, delta); 25 | { 26 | SizeT i; 27 | for (i = 0; i < size;) 28 | { 29 | for (j = 0; j < delta && i < size; i++, j++) 30 | { 31 | Byte b = data[i]; 32 | data[i] = (Byte)(b - buf[j]); 33 | buf[j] = b; 34 | } 35 | } 36 | } 37 | if (j == delta) 38 | j = 0; 39 | MyMemCpy(state, buf + j, delta - j); 40 | MyMemCpy(state + delta - j, buf, j); 41 | } 42 | 43 | void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size) 44 | { 45 | Byte buf[DELTA_STATE_SIZE]; 46 | unsigned j = 0; 47 | MyMemCpy(buf, state, delta); 48 | { 49 | SizeT i; 50 | for (i = 0; i < size;) 51 | { 52 | for (j = 0; j < delta && i < size; i++, j++) 53 | { 54 | buf[j] = data[i] = (Byte)(buf[j] + data[i]); 55 | } 56 | } 57 | } 58 | if (j == delta) 59 | j = 0; 60 | MyMemCpy(state, buf + j, delta - j); 61 | MyMemCpy(state + delta - j, buf, j); 62 | } 63 | -------------------------------------------------------------------------------- /_lzma/c/Delta.h: -------------------------------------------------------------------------------- 1 | /* Delta.h -- Delta converter 2 | 2009-04-15 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __DELTA_H 5 | #define __DELTA_H 6 | 7 | #include "Types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #define DELTA_STATE_SIZE 256 14 | 15 | void Delta_Init(Byte *state); 16 | void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size); 17 | void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /_lzma/c/Lzma86Dec.c: -------------------------------------------------------------------------------- 1 | /* Lzma86Dec.c -- LZMA + x86 (BCJ) Filter Decoder 2 | 2009-08-14 : Igor Pavlov : Public domain */ 3 | 4 | #include "Lzma86.h" 5 | 6 | #include "Alloc.h" 7 | #include "Bra.h" 8 | #include "LzmaDec.h" 9 | 10 | static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } 11 | static void SzFree(void *p, void *address) { p = p; MyFree(address); } 12 | 13 | SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize) 14 | { 15 | unsigned i; 16 | if (srcLen < LZMA86_HEADER_SIZE) 17 | return SZ_ERROR_INPUT_EOF; 18 | *unpackSize = 0; 19 | for (i = 0; i < sizeof(UInt64); i++) 20 | *unpackSize += ((UInt64)src[LZMA86_SIZE_OFFSET + i]) << (8 * i); 21 | return SZ_OK; 22 | } 23 | 24 | SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen) 25 | { 26 | ISzAlloc g_Alloc = { SzAlloc, SzFree }; 27 | SRes res; 28 | int useFilter; 29 | SizeT inSizePure; 30 | ELzmaStatus status; 31 | 32 | if (*srcLen < LZMA86_HEADER_SIZE) 33 | return SZ_ERROR_INPUT_EOF; 34 | 35 | useFilter = src[0]; 36 | 37 | if (useFilter > 1) 38 | { 39 | *destLen = 0; 40 | return SZ_ERROR_UNSUPPORTED; 41 | } 42 | 43 | inSizePure = *srcLen - LZMA86_HEADER_SIZE; 44 | res = LzmaDecode(dest, destLen, src + LZMA86_HEADER_SIZE, &inSizePure, 45 | src + 1, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &status, &g_Alloc); 46 | *srcLen = inSizePure + LZMA86_HEADER_SIZE; 47 | if (res != SZ_OK) 48 | return res; 49 | if (useFilter == 1) 50 | { 51 | UInt32 x86State; 52 | x86_Convert_Init(x86State); 53 | x86_Convert(dest, *destLen, 0, &x86State, 0); 54 | } 55 | return SZ_OK; 56 | } 57 | -------------------------------------------------------------------------------- /_lzma/c/LzmaLib.c: -------------------------------------------------------------------------------- 1 | /* LzmaLib.c -- LZMA library wrapper 2 | 2008-08-05 3 | Igor Pavlov 4 | Public domain */ 5 | 6 | #include "LzmaEnc.h" 7 | #include "LzmaDec.h" 8 | #include "Alloc.h" 9 | #include "LzmaLib.h" 10 | 11 | static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } 12 | static void SzFree(void *p, void *address) { p = p; MyFree(address); } 13 | static ISzAlloc g_Alloc = { SzAlloc, SzFree }; 14 | 15 | MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen, 16 | unsigned char *outProps, size_t *outPropsSize, 17 | int level, /* 0 <= level <= 9, default = 5 */ 18 | unsigned dictSize, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */ 19 | int lc, /* 0 <= lc <= 8, default = 3 */ 20 | int lp, /* 0 <= lp <= 4, default = 0 */ 21 | int pb, /* 0 <= pb <= 4, default = 2 */ 22 | int fb, /* 5 <= fb <= 273, default = 32 */ 23 | int numThreads /* 1 or 2, default = 2 */ 24 | ) 25 | { 26 | CLzmaEncProps props; 27 | LzmaEncProps_Init(&props); 28 | props.level = level; 29 | props.dictSize = dictSize; 30 | props.lc = lc; 31 | props.lp = lp; 32 | props.pb = pb; 33 | props.fb = fb; 34 | props.numThreads = numThreads; 35 | 36 | return LzmaEncode(dest, destLen, src, srcLen, &props, outProps, outPropsSize, 0, 37 | NULL, &g_Alloc, &g_Alloc); 38 | } 39 | 40 | 41 | MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen, 42 | const unsigned char *props, size_t propsSize) 43 | { 44 | ELzmaStatus status; 45 | return LzmaDecode(dest, destLen, src, srcLen, props, (unsigned)propsSize, LZMA_FINISH_ANY, &status, &g_Alloc); 46 | } 47 | -------------------------------------------------------------------------------- /_lzma/c/RotateDefs.h: -------------------------------------------------------------------------------- 1 | /* RotateDefs.h -- Rotate functions 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __ROTATE_DEFS_H 5 | #define __ROTATE_DEFS_H 6 | 7 | #ifdef _MSC_VER 8 | 9 | #include 10 | #define rotlFixed(x, n) _rotl((x), (n)) 11 | #define rotrFixed(x, n) _rotr((x), (n)) 12 | 13 | #else 14 | 15 | #define rotlFixed(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) 16 | #define rotrFixed(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) 17 | 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /_lzma/c/Sha256.h: -------------------------------------------------------------------------------- 1 | /* Sha256.h -- SHA-256 Hash 2 | 2010-06-11 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __CRYPTO_SHA256_H 5 | #define __CRYPTO_SHA256_H 6 | 7 | #include "Types.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | #define SHA256_DIGEST_SIZE 32 12 | 13 | typedef struct 14 | { 15 | UInt32 state[8]; 16 | UInt64 count; 17 | Byte buffer[64]; 18 | } CSha256; 19 | 20 | void Sha256_Init(CSha256 *p); 21 | void Sha256_Update(CSha256 *p, const Byte *data, size_t size); 22 | void Sha256_Final(CSha256 *p, Byte *digest); 23 | 24 | EXTERN_C_END 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /_lzma/c/Util/7z/7z.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "7z"=.\7z.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /_lzma/c/Util/7z/makefile: -------------------------------------------------------------------------------- 1 | MY_STATIC_LINK=1 2 | CFLAGS = $(CFLAGS) -D_7ZIP_PPMD_SUPPPORT 3 | 4 | PROG = 7zDec.exe 5 | 6 | C_OBJS = \ 7 | $O\7zAlloc.obj \ 8 | $O\7zBuf.obj \ 9 | $O\7zBuf2.obj \ 10 | $O\7zCrc.obj \ 11 | $O\7zCrcOpt.obj \ 12 | $O\7zFile.obj \ 13 | $O\7zDec.obj \ 14 | $O\7zIn.obj \ 15 | $O\7zStream.obj \ 16 | $O\Bcj2.obj \ 17 | $O\Bra.obj \ 18 | $O\Bra86.obj \ 19 | $O\CpuArch.obj \ 20 | $O\Lzma2Dec.obj \ 21 | $O\LzmaDec.obj \ 22 | $O\Ppmd7.obj \ 23 | $O\Ppmd7Dec.obj \ 24 | 25 | 7Z_OBJS = \ 26 | $O\7zMain.obj \ 27 | 28 | OBJS = \ 29 | $(7Z_OBJS) \ 30 | $(C_OBJS) \ 31 | 32 | !include "../../../CPP/Build.mak" 33 | 34 | $(7Z_OBJS): $(*B).c 35 | $(COMPL_O1) 36 | $(C_OBJS): ../../$(*B).c 37 | $(COMPL_O2) 38 | -------------------------------------------------------------------------------- /_lzma/c/Util/7z/makefile.gcc: -------------------------------------------------------------------------------- 1 | PROG = 7zDec 2 | CXX = g++ 3 | LIB = 4 | RM = rm -f 5 | CFLAGS = -c -O2 -Wall 6 | 7 | OBJS = 7zMain.o 7zAlloc.o 7zBuf.o 7zBuf2.o 7zCrc.o 7zCrcOpt.o 7zDec.o 7zIn.o CpuArch.o LzmaDec.o Lzma2Dec.o Bra.o Bra86.o Bcj2.o Ppmd7.o Ppmd7Dec.o 7zFile.o 7zStream.o 8 | 9 | all: $(PROG) 10 | 11 | $(PROG): $(OBJS) 12 | $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) 13 | 14 | 7zMain.o: 7zMain.c 15 | $(CXX) $(CFLAGS) 7zMain.c 16 | 17 | 7zAlloc.o: 7zAlloc.c 18 | $(CXX) $(CFLAGS) ../../7zAlloc.c 19 | 20 | 7zBuf.o: ../../7zBuf.c 21 | $(CXX) $(CFLAGS) ../../7zBuf.c 22 | 23 | 7zBuf2.o: ../../7zBuf2.c 24 | $(CXX) $(CFLAGS) ../../7zBuf2.c 25 | 26 | 7zCrc.o: ../../7zCrc.c 27 | $(CXX) $(CFLAGS) ../../7zCrc.c 28 | 29 | 7zCrcOpt.o: ../../7zCrc.c 30 | $(CXX) $(CFLAGS) ../../7zCrcOpt.c 31 | 32 | 7zDec.o: ../../7zDec.c 33 | $(CXX) $(CFLAGS) -D_7ZIP_PPMD_SUPPPORT ../../7zDec.c 34 | 35 | 7zIn.o: ../../7zIn.c 36 | $(CXX) $(CFLAGS) ../../7zIn.c 37 | 38 | CpuArch.o: ../../CpuArch.c 39 | $(CXX) $(CFLAGS) ../../CpuArch.c 40 | 41 | LzmaDec.o: ../../LzmaDec.c 42 | $(CXX) $(CFLAGS) ../../LzmaDec.c 43 | 44 | Lzma2Dec.o: ../../Lzma2Dec.c 45 | $(CXX) $(CFLAGS) ../../Lzma2Dec.c 46 | 47 | Bra.o: ../../Bra.c 48 | $(CXX) $(CFLAGS) ../../Bra.c 49 | 50 | Bra86.o: ../../Bra86.c 51 | $(CXX) $(CFLAGS) ../../Bra86.c 52 | 53 | Bcj2.o: ../../Bcj2.c 54 | $(CXX) $(CFLAGS) ../../Bcj2.c 55 | 56 | Ppmd7.o: ../../Ppmd7.c 57 | $(CXX) $(CFLAGS) ../../Ppmd7.c 58 | 59 | Ppmd7Dec.o: ../../Ppmd7Dec.c 60 | $(CXX) $(CFLAGS) ../../Ppmd7Dec.c 61 | 62 | 7zFile.o: ../../7zFile.c 63 | $(CXX) $(CFLAGS) ../../7zFile.c 64 | 65 | 7zStream.o: ../../7zStream.c 66 | $(CXX) $(CFLAGS) ../../7zStream.c 67 | 68 | clean: 69 | -$(RM) $(PROG) $(OBJS) 70 | 71 | -------------------------------------------------------------------------------- /_lzma/c/Util/Lzma/LzmaUtil.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "LzmaUtil"=.\LzmaUtil.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /_lzma/c/Util/Lzma/makefile: -------------------------------------------------------------------------------- 1 | MY_STATIC_LINK=1 2 | PROG = LZMAc.exe 3 | 4 | CFLAGS = $(CFLAGS) \ 5 | 6 | LIB_OBJS = \ 7 | $O\LzmaUtil.obj \ 8 | 9 | C_OBJS = \ 10 | $O\Alloc.obj \ 11 | $O\LzFind.obj \ 12 | $O\LzFindMt.obj \ 13 | $O\LzmaDec.obj \ 14 | $O\LzmaEnc.obj \ 15 | $O\7zFile.obj \ 16 | $O\7zStream.obj \ 17 | $O\Threads.obj \ 18 | 19 | OBJS = \ 20 | $(LIB_OBJS) \ 21 | $(C_OBJS) \ 22 | 23 | !include "../../../CPP/Build.mak" 24 | 25 | $(LIB_OBJS): $(*B).c 26 | $(COMPL_O2) 27 | $(C_OBJS): ../../$(*B).c 28 | $(COMPL_O2) 29 | -------------------------------------------------------------------------------- /_lzma/c/Util/Lzma/makefile.gcc: -------------------------------------------------------------------------------- 1 | PROG = lzma 2 | CXX = g++ 3 | LIB = 4 | RM = rm -f 5 | CFLAGS = -c -O2 -Wall -D_7ZIP_ST 6 | 7 | OBJS = \ 8 | LzmaUtil.o \ 9 | Alloc.o \ 10 | LzFind.o \ 11 | LzmaDec.o \ 12 | LzmaEnc.o \ 13 | 7zFile.o \ 14 | 7zStream.o \ 15 | 16 | 17 | all: $(PROG) 18 | 19 | $(PROG): $(OBJS) 20 | $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) $(LIB2) 21 | 22 | LzmaUtil.o: LzmaUtil.c 23 | $(CXX) $(CFLAGS) LzmaUtil.c 24 | 25 | Alloc.o: ../../Alloc.c 26 | $(CXX) $(CFLAGS) ../../Alloc.c 27 | 28 | LzFind.o: ../../LzFind.c 29 | $(CXX) $(CFLAGS) ../../LzFind.c 30 | 31 | LzmaDec.o: ../../LzmaDec.c 32 | $(CXX) $(CFLAGS) ../../LzmaDec.c 33 | 34 | LzmaEnc.o: ../../LzmaEnc.c 35 | $(CXX) $(CFLAGS) ../../LzmaEnc.c 36 | 37 | 7zFile.o: ../../7zFile.c 38 | $(CXX) $(CFLAGS) ../../7zFile.c 39 | 40 | 7zStream.o: ../../7zStream.c 41 | $(CXX) $(CFLAGS) ../../7zStream.c 42 | 43 | clean: 44 | -$(RM) $(PROG) $(OBJS) 45 | -------------------------------------------------------------------------------- /_lzma/c/Util/LzmaLib/LzmaLib.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | LzmaCompress 3 | LzmaUncompress 4 | 5 | -------------------------------------------------------------------------------- /_lzma/c/Util/LzmaLib/LzmaLib.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "LzmaLib"=.\LzmaLib.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /_lzma/c/Util/LzmaLib/LzmaLibExports.c: -------------------------------------------------------------------------------- 1 | /* LzmaLibExports.c -- LZMA library DLL Entry point 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #include 5 | 6 | BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) 7 | { 8 | hInstance = hInstance; 9 | dwReason = dwReason; 10 | lpReserved = lpReserved; 11 | return TRUE; 12 | } 13 | -------------------------------------------------------------------------------- /_lzma/c/Util/LzmaLib/makefile: -------------------------------------------------------------------------------- 1 | MY_STATIC_LINK=1 2 | SLIB = sLZMA.lib 3 | PROG = LZMA.dll 4 | SLIBPATH = $O\$(SLIB) 5 | 6 | DEF_FILE = LzmaLib.def 7 | CFLAGS = $(CFLAGS) \ 8 | 9 | LIB_OBJS = \ 10 | $O\LzmaLibExports.obj \ 11 | 12 | C_OBJS = \ 13 | $O\Alloc.obj \ 14 | $O\LzFind.obj \ 15 | $O\LzFindMt.obj \ 16 | $O\LzmaDec.obj \ 17 | $O\LzmaEnc.obj \ 18 | $O\LzmaLib.obj \ 19 | $O\Threads.obj \ 20 | 21 | OBJS = \ 22 | $(LIB_OBJS) \ 23 | $(C_OBJS) \ 24 | $O\resource.res 25 | 26 | !include "../../../CPP/Build.mak" 27 | 28 | $(SLIBPATH): $O $(OBJS) 29 | lib -out:$(SLIBPATH) $(OBJS) $(LIBS) 30 | 31 | $(LIB_OBJS): $(*B).c 32 | $(COMPL_O2) 33 | $(C_OBJS): ../../$(*B).c 34 | $(COMPL_O2) 35 | -------------------------------------------------------------------------------- /_lzma/c/Util/LzmaLib/resource.rc: -------------------------------------------------------------------------------- 1 | #include "../../../CPP/7zip/MyVersionInfo.rc" 2 | 3 | MY_VERSION_INFO_DLL("LZMA library", "LZMA") 4 | 5 | -------------------------------------------------------------------------------- /_lzma/c/Util/SfxSetup/SfxSetup.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "SfxSetup"=.\SfxSetup.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /_lzma/c/Util/SfxSetup/makefile: -------------------------------------------------------------------------------- 1 | PROG = 7zS2.sfx 2 | LIBS = $(LIBS) 3 | CFLAGS = $(CFLAGS) -DUNICODE -D_UNICODE 4 | 5 | C_OBJS = \ 6 | $O\7zAlloc.obj \ 7 | $O\7zBuf.obj \ 8 | $O\7zBuf2.obj \ 9 | $O\7zCrc.obj \ 10 | $O\7zCrcOpt.obj \ 11 | $O\7zFile.obj \ 12 | $O\7zDec.obj \ 13 | $O\7zIn.obj \ 14 | $O\7zStream.obj \ 15 | $O\Bcj2.obj \ 16 | $O\Bra.obj \ 17 | $O\Bra86.obj \ 18 | $O\CpuArch.obj \ 19 | $O\Lzma2Dec.obj \ 20 | $O\LzmaDec.obj \ 21 | 22 | 7Z_OBJS = \ 23 | $O\SfxSetup.obj \ 24 | 25 | OBJS = \ 26 | $(7Z_OBJS) \ 27 | $(C_OBJS) \ 28 | $O\resource.res 29 | 30 | !include "../../../CPP/Build.mak" 31 | 32 | $(7Z_OBJS): $(*B).c 33 | $(COMPL_O1) 34 | $(C_OBJS): ../../$(*B).c 35 | $(COMPL_O1) 36 | -------------------------------------------------------------------------------- /_lzma/c/Util/SfxSetup/makefile_con: -------------------------------------------------------------------------------- 1 | PROG = 7zS2con.sfx 2 | LIBS = $(LIBS) 3 | CFLAGS = $(CFLAGS) -DUNICODE -D_UNICODE -D_CONSOLE 4 | 5 | C_OBJS = \ 6 | $O\7zAlloc.obj \ 7 | $O\7zBuf.obj \ 8 | $O\7zBuf2.obj \ 9 | $O\7zCrc.obj \ 10 | $O\7zCrcOpt.obj \ 11 | $O\7zFile.obj \ 12 | $O\7zDec.obj \ 13 | $O\7zIn.obj \ 14 | $O\7zStream.obj \ 15 | $O\Bcj2.obj \ 16 | $O\Bra.obj \ 17 | $O\Bra86.obj \ 18 | $O\CpuArch.obj \ 19 | $O\Lzma2Dec.obj \ 20 | $O\LzmaDec.obj \ 21 | 22 | 7Z_OBJS = \ 23 | $O\SfxSetup.obj \ 24 | 25 | OBJS = \ 26 | $(7Z_OBJS) \ 27 | $(C_OBJS) \ 28 | $O\resource.res 29 | 30 | !include "../../../CPP/Build.mak" 31 | 32 | $(7Z_OBJS): $(*B).c 33 | $(COMPL_O1) 34 | $(C_OBJS): ../../$(*B).c 35 | $(COMPL_O1) 36 | -------------------------------------------------------------------------------- /_lzma/c/Util/SfxSetup/resource.rc: -------------------------------------------------------------------------------- 1 | #include "../../../CPP/7zip/MyVersionInfo.rc" 2 | 3 | MY_VERSION_INFO_APP("7z Setup SFX small", "7zS2.sfx") 4 | 5 | 1 ICON "setup.ico" 6 | 7 | -------------------------------------------------------------------------------- /_lzma/c/Util/SfxSetup/setup.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/_lzma/c/Util/SfxSetup/setup.ico -------------------------------------------------------------------------------- /_lzma/c/XzCrc64.c: -------------------------------------------------------------------------------- 1 | /* XzCrc64.c -- CRC64 calculation 2 | 2010-04-16 : Igor Pavlov : Public domain */ 3 | 4 | #include "XzCrc64.h" 5 | 6 | #define kCrc64Poly UINT64_CONST(0xC96C5795D7870F42) 7 | UInt64 g_Crc64Table[256]; 8 | 9 | void MY_FAST_CALL Crc64GenerateTable(void) 10 | { 11 | UInt32 i; 12 | for (i = 0; i < 256; i++) 13 | { 14 | UInt64 r = i; 15 | int j; 16 | for (j = 0; j < 8; j++) 17 | r = (r >> 1) ^ ((UInt64)kCrc64Poly & ~((r & 1) - 1)); 18 | g_Crc64Table[i] = r; 19 | } 20 | } 21 | 22 | UInt64 MY_FAST_CALL Crc64Update(UInt64 v, const void *data, size_t size) 23 | { 24 | const Byte *p = (const Byte *)data; 25 | for (; size > 0 ; size--, p++) 26 | v = CRC64_UPDATE_BYTE(v, *p); 27 | return v; 28 | } 29 | 30 | UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size) 31 | { 32 | return CRC64_GET_DIGEST(Crc64Update(CRC64_INIT_VAL, data, size)); 33 | } 34 | -------------------------------------------------------------------------------- /_lzma/c/XzCrc64.h: -------------------------------------------------------------------------------- 1 | /* XzCrc64.h -- CRC64 calculation 2 | 2010-04-16 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __XZ_CRC64_H 5 | #define __XZ_CRC64_H 6 | 7 | #include 8 | 9 | #include "Types.h" 10 | 11 | EXTERN_C_BEGIN 12 | 13 | extern UInt64 g_Crc64Table[]; 14 | 15 | void MY_FAST_CALL Crc64GenerateTable(void); 16 | 17 | #define CRC64_INIT_VAL UINT64_CONST(0xFFFFFFFFFFFFFFFF) 18 | #define CRC64_GET_DIGEST(crc) ((crc) ^ CRC64_INIT_VAL) 19 | #define CRC64_UPDATE_BYTE(crc, b) (g_Crc64Table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 20 | 21 | UInt64 MY_FAST_CALL Crc64Update(UInt64 crc, const void *data, size_t size); 22 | UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size); 23 | 24 | EXTERN_C_END 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /_lzma/c/XzEnc.h: -------------------------------------------------------------------------------- 1 | /* XzEnc.h -- Xz Encode 2 | 2009-04-15 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __XZ_ENC_H 5 | #define __XZ_ENC_H 6 | 7 | #include "Lzma2Enc.h" 8 | 9 | #include "Xz.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | SRes Xz_Encode(ISeqOutStream *outStream, ISeqInStream *inStream, 16 | const CLzma2EncProps *lzma2Props, Bool useSubblock, 17 | ICompressProgress *progress); 18 | 19 | SRes Xz_EncodeEmpty(ISeqOutStream *outStream); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /crc32.c: -------------------------------------------------------------------------------- 1 | /* 2 | * crc32.c 3 | * 4 | * This file is a part of NSIS. 5 | * 6 | * Copyright (C) 1999-2009 Nullsoft and Contributors 7 | * 8 | * Licensed under the zlib/libpng license (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * 11 | * Licence details can be found in the file COPYING. 12 | * 13 | * This software is provided 'as-is', without any express or implied 14 | * warranty. 15 | * 16 | * Unicode support by Jim Park -- 08/24/2007 17 | */ 18 | 19 | 20 | #include "crc32.h" 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /crc32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * crc32.h 3 | * 4 | * This file is a part of NSIS. 5 | * 6 | * Copyright (C) 1999-2009 Nullsoft and Contributors 7 | * 8 | * Licensed under the zlib/libpng license (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * 11 | * Licence details can be found in the file COPYING. 12 | * 13 | * This software is provided 'as-is', without any express or implied 14 | * warranty. 15 | * 16 | * Reviewed for Unicode support by Jim Park -- 08/24/2007 17 | */ 18 | 19 | 20 | typedef unsigned __int32 crc32_t; 21 | 22 | crc32_t CRC32(crc32_t crc, const unsigned char *buf, unsigned int len); 23 | 24 | -------------------------------------------------------------------------------- /lib/LzmaLib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/lib/LzmaLib.lib -------------------------------------------------------------------------------- /lib/zdll.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/lib/zdll.lib -------------------------------------------------------------------------------- /lib/zlib.def: -------------------------------------------------------------------------------- 1 | ; zlib data compression library 2 | EXPORTS 3 | ; basic functions 4 | zlibVersion 5 | deflate 6 | deflateEnd 7 | inflate 8 | inflateEnd 9 | ; advanced functions 10 | deflateSetDictionary 11 | deflateCopy 12 | deflateReset 13 | deflateParams 14 | deflateTune 15 | deflateBound 16 | deflatePending 17 | deflatePrime 18 | deflateSetHeader 19 | inflateSetDictionary 20 | inflateGetDictionary 21 | inflateSync 22 | inflateCopy 23 | inflateReset 24 | inflateReset2 25 | inflatePrime 26 | inflateMark 27 | inflateGetHeader 28 | inflateBack 29 | inflateBackEnd 30 | zlibCompileFlags 31 | ; utility functions 32 | compress 33 | compress2 34 | compressBound 35 | uncompress 36 | gzopen 37 | gzdopen 38 | gzbuffer 39 | gzsetparams 40 | gzread 41 | gzwrite 42 | gzprintf 43 | gzvprintf 44 | gzputs 45 | gzgets 46 | gzputc 47 | gzgetc 48 | gzungetc 49 | gzflush 50 | gzseek 51 | gzrewind 52 | gztell 53 | gzoffset 54 | gzeof 55 | gzdirect 56 | gzclose 57 | gzclose_r 58 | gzclose_w 59 | gzerror 60 | gzclearerr 61 | ; large file functions 62 | gzopen64 63 | gzseek64 64 | gztell64 65 | gzoffset64 66 | adler32_combine64 67 | crc32_combine64 68 | ; checksum functions 69 | adler32 70 | crc32 71 | adler32_combine 72 | crc32_combine 73 | ; various hacks, don't look :) 74 | deflateInit_ 75 | deflateInit2_ 76 | inflateInit_ 77 | inflateInit2_ 78 | inflateBackInit_ 79 | gzgetc_ 80 | zError 81 | inflateSyncPoint 82 | get_crc_table 83 | inflateUndermine 84 | inflateResetKeep 85 | deflateResetKeep 86 | gzopen_w 87 | -------------------------------------------------------------------------------- /lzma/7zAlloc.c: -------------------------------------------------------------------------------- 1 | /* 7zAlloc.c -- Allocation functions 2 | 2010-10-29 : Igor Pavlov : Public domain */ 3 | 4 | #include "7zAlloc.h" 5 | 6 | /* #define _SZ_ALLOC_DEBUG */ 7 | /* use _SZ_ALLOC_DEBUG to debug alloc/free operations */ 8 | 9 | #ifdef _SZ_ALLOC_DEBUG 10 | 11 | #ifdef _WIN32 12 | #include 13 | #endif 14 | 15 | #include 16 | int g_allocCount = 0; 17 | int g_allocCountTemp = 0; 18 | 19 | #endif 20 | 21 | void *SzAlloc(void *p, size_t size) 22 | { 23 | p = p; 24 | if (size == 0) 25 | return 0; 26 | #ifdef _SZ_ALLOC_DEBUG 27 | fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount); 28 | g_allocCount++; 29 | #endif 30 | return malloc(size); 31 | } 32 | 33 | void SzFree(void *p, void *address) 34 | { 35 | p = p; 36 | #ifdef _SZ_ALLOC_DEBUG 37 | if (address != 0) 38 | { 39 | g_allocCount--; 40 | fprintf(stderr, "\nFree; count = %10d", g_allocCount); 41 | } 42 | #endif 43 | free(address); 44 | } 45 | 46 | void *SzAllocTemp(void *p, size_t size) 47 | { 48 | p = p; 49 | if (size == 0) 50 | return 0; 51 | #ifdef _SZ_ALLOC_DEBUG 52 | fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTemp); 53 | g_allocCountTemp++; 54 | #ifdef _WIN32 55 | return HeapAlloc(GetProcessHeap(), 0, size); 56 | #endif 57 | #endif 58 | return malloc(size); 59 | } 60 | 61 | void SzFreeTemp(void *p, void *address) 62 | { 63 | p = p; 64 | #ifdef _SZ_ALLOC_DEBUG 65 | if (address != 0) 66 | { 67 | g_allocCountTemp--; 68 | fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp); 69 | } 70 | #ifdef _WIN32 71 | HeapFree(GetProcessHeap(), 0, address); 72 | return; 73 | #endif 74 | #endif 75 | free(address); 76 | } 77 | -------------------------------------------------------------------------------- /lzma/7zAlloc.h: -------------------------------------------------------------------------------- 1 | /* 7zAlloc.h -- Allocation functions 2 | 2010-10-29 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_ALLOC_H 5 | #define __7Z_ALLOC_H 6 | 7 | #include 8 | 9 | void *SzAlloc(void *p, size_t size); 10 | void SzFree(void *p, void *address); 11 | 12 | void *SzAllocTemp(void *p, size_t size); 13 | void SzFreeTemp(void *p, void *address); 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /lzma/7zBuf.c: -------------------------------------------------------------------------------- 1 | /* 7zBuf.c -- Byte Buffer 2 | 2008-03-28 3 | Igor Pavlov 4 | Public domain */ 5 | 6 | #include "7zBuf.h" 7 | 8 | void Buf_Init(CBuf *p) 9 | { 10 | p->data = 0; 11 | p->size = 0; 12 | } 13 | 14 | int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc) 15 | { 16 | p->size = 0; 17 | if (size == 0) 18 | { 19 | p->data = 0; 20 | return 1; 21 | } 22 | p->data = (Byte *)alloc->Alloc(alloc, size); 23 | if (p->data != 0) 24 | { 25 | p->size = size; 26 | return 1; 27 | } 28 | return 0; 29 | } 30 | 31 | void Buf_Free(CBuf *p, ISzAlloc *alloc) 32 | { 33 | alloc->Free(alloc, p->data); 34 | p->data = 0; 35 | p->size = 0; 36 | } 37 | -------------------------------------------------------------------------------- /lzma/7zBuf.h: -------------------------------------------------------------------------------- 1 | /* 7zBuf.h -- Byte Buffer 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_BUF_H 5 | #define __7Z_BUF_H 6 | 7 | #include "Types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | typedef struct 14 | { 15 | Byte *data; 16 | size_t size; 17 | } CBuf; 18 | 19 | void Buf_Init(CBuf *p); 20 | int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc); 21 | void Buf_Free(CBuf *p, ISzAlloc *alloc); 22 | 23 | typedef struct 24 | { 25 | Byte *data; 26 | size_t size; 27 | size_t pos; 28 | } CDynBuf; 29 | 30 | void DynBuf_Construct(CDynBuf *p); 31 | void DynBuf_SeekToBeg(CDynBuf *p); 32 | int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc); 33 | void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /lzma/7zBuf2.c: -------------------------------------------------------------------------------- 1 | /* 7zBuf2.c -- Byte Buffer 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #include 5 | #include "7zBuf.h" 6 | 7 | void DynBuf_Construct(CDynBuf *p) 8 | { 9 | p->data = 0; 10 | p->size = 0; 11 | p->pos = 0; 12 | } 13 | 14 | void DynBuf_SeekToBeg(CDynBuf *p) 15 | { 16 | p->pos = 0; 17 | } 18 | 19 | int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc) 20 | { 21 | if (size > p->size - p->pos) 22 | { 23 | size_t newSize = p->pos + size; 24 | Byte *data; 25 | newSize += newSize / 4; 26 | data = (Byte *)alloc->Alloc(alloc, newSize); 27 | if (data == 0) 28 | return 0; 29 | p->size = newSize; 30 | memcpy(data, p->data, p->pos); 31 | alloc->Free(alloc, p->data); 32 | p->data = data; 33 | } 34 | memcpy(p->data + p->pos, buf, size); 35 | p->pos += size; 36 | return 1; 37 | } 38 | 39 | void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc) 40 | { 41 | alloc->Free(alloc, p->data); 42 | p->data = 0; 43 | p->size = 0; 44 | p->pos = 0; 45 | } 46 | -------------------------------------------------------------------------------- /lzma/7zCrc.h: -------------------------------------------------------------------------------- 1 | /* 7zCrc.h -- CRC32 calculation 2 | 2009-11-21 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_CRC_H 5 | #define __7Z_CRC_H 6 | 7 | #include "Types.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | extern UInt32 g_CrcTable[]; 12 | 13 | /* Call CrcGenerateTable one time before other CRC functions */ 14 | void MY_FAST_CALL CrcGenerateTable(void); 15 | 16 | #define CRC_INIT_VAL 0xFFFFFFFF 17 | #define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL) 18 | #define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 19 | 20 | UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size); 21 | UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size); 22 | 23 | EXTERN_C_END 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /lzma/7zCrcOpt.c: -------------------------------------------------------------------------------- 1 | /* 7zCrcOpt.c -- CRC32 calculation : optimized version 2 | 2009-11-23 : Igor Pavlov : Public domain */ 3 | 4 | #include "CpuArch.h" 5 | 6 | #ifdef MY_CPU_LE 7 | 8 | #define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 9 | 10 | UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table) 11 | { 12 | const Byte *p = (const Byte *)data; 13 | for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++) 14 | v = CRC_UPDATE_BYTE_2(v, *p); 15 | for (; size >= 4; size -= 4, p += 4) 16 | { 17 | v ^= *(const UInt32 *)p; 18 | v = 19 | table[0x300 + (v & 0xFF)] ^ 20 | table[0x200 + ((v >> 8) & 0xFF)] ^ 21 | table[0x100 + ((v >> 16) & 0xFF)] ^ 22 | table[0x000 + ((v >> 24))]; 23 | } 24 | for (; size > 0; size--, p++) 25 | v = CRC_UPDATE_BYTE_2(v, *p); 26 | return v; 27 | } 28 | 29 | UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table) 30 | { 31 | return CrcUpdateT4(v, data, size, table); 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /lzma/7zVersion.h: -------------------------------------------------------------------------------- 1 | #define MY_VER_MAJOR 9 2 | #define MY_VER_MINOR 20 3 | #define MY_VER_BUILD 0 4 | #define MY_VERSION "9.20" 5 | #define MY_DATE "2010-11-18" 6 | #define MY_COPYRIGHT ": Igor Pavlov : Public domain" 7 | #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE 8 | -------------------------------------------------------------------------------- /lzma/Alloc.h: -------------------------------------------------------------------------------- 1 | /* Alloc.h -- Memory allocation functions 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __COMMON_ALLOC_H 5 | #define __COMMON_ALLOC_H 6 | 7 | #include 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | void *MyAlloc(size_t size); 14 | void MyFree(void *address); 15 | 16 | #ifdef _WIN32 17 | 18 | void SetLargePageSize(); 19 | 20 | void *MidAlloc(size_t size); 21 | void MidFree(void *address); 22 | void *BigAlloc(size_t size); 23 | void BigFree(void *address); 24 | 25 | #else 26 | 27 | #define MidAlloc(size) MyAlloc(size) 28 | #define MidFree(address) MyFree(address) 29 | #define BigAlloc(size) MyAlloc(size) 30 | #define BigFree(address) MyFree(address) 31 | 32 | #endif 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /lzma/Bcj2.h: -------------------------------------------------------------------------------- 1 | /* Bcj2.h -- Converter for x86 code (BCJ2) 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __BCJ2_H 5 | #define __BCJ2_H 6 | 7 | #include "Types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /* 14 | Conditions: 15 | outSize <= FullOutputSize, 16 | where FullOutputSize is full size of output stream of x86_2 filter. 17 | 18 | If buf0 overlaps outBuf, there are two required conditions: 19 | 1) (buf0 >= outBuf) 20 | 2) (buf0 + size0 >= outBuf + FullOutputSize). 21 | 22 | Returns: 23 | SZ_OK 24 | SZ_ERROR_DATA - Data error 25 | */ 26 | 27 | int Bcj2_Decode( 28 | const Byte *buf0, SizeT size0, 29 | const Byte *buf1, SizeT size1, 30 | const Byte *buf2, SizeT size2, 31 | const Byte *buf3, SizeT size3, 32 | Byte *outBuf, SizeT outSize); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /lzma/Delta.c: -------------------------------------------------------------------------------- 1 | /* Delta.c -- Delta converter 2 | 2009-05-26 : Igor Pavlov : Public domain */ 3 | 4 | #include "Delta.h" 5 | 6 | void Delta_Init(Byte *state) 7 | { 8 | unsigned i; 9 | for (i = 0; i < DELTA_STATE_SIZE; i++) 10 | state[i] = 0; 11 | } 12 | 13 | static void MyMemCpy(Byte *dest, const Byte *src, unsigned size) 14 | { 15 | unsigned i; 16 | for (i = 0; i < size; i++) 17 | dest[i] = src[i]; 18 | } 19 | 20 | void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size) 21 | { 22 | Byte buf[DELTA_STATE_SIZE]; 23 | unsigned j = 0; 24 | MyMemCpy(buf, state, delta); 25 | { 26 | SizeT i; 27 | for (i = 0; i < size;) 28 | { 29 | for (j = 0; j < delta && i < size; i++, j++) 30 | { 31 | Byte b = data[i]; 32 | data[i] = (Byte)(b - buf[j]); 33 | buf[j] = b; 34 | } 35 | } 36 | } 37 | if (j == delta) 38 | j = 0; 39 | MyMemCpy(state, buf + j, delta - j); 40 | MyMemCpy(state + delta - j, buf, j); 41 | } 42 | 43 | void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size) 44 | { 45 | Byte buf[DELTA_STATE_SIZE]; 46 | unsigned j = 0; 47 | MyMemCpy(buf, state, delta); 48 | { 49 | SizeT i; 50 | for (i = 0; i < size;) 51 | { 52 | for (j = 0; j < delta && i < size; i++, j++) 53 | { 54 | buf[j] = data[i] = (Byte)(buf[j] + data[i]); 55 | } 56 | } 57 | } 58 | if (j == delta) 59 | j = 0; 60 | MyMemCpy(state, buf + j, delta - j); 61 | MyMemCpy(state + delta - j, buf, j); 62 | } 63 | -------------------------------------------------------------------------------- /lzma/Delta.h: -------------------------------------------------------------------------------- 1 | /* Delta.h -- Delta converter 2 | 2009-04-15 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __DELTA_H 5 | #define __DELTA_H 6 | 7 | #include "Types.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | #define DELTA_STATE_SIZE 256 14 | 15 | void Delta_Init(Byte *state); 16 | void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size); 17 | void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /lzma/Lzma86Dec.c: -------------------------------------------------------------------------------- 1 | /* Lzma86Dec.c -- LZMA + x86 (BCJ) Filter Decoder 2 | 2009-08-14 : Igor Pavlov : Public domain */ 3 | 4 | #include "Lzma86.h" 5 | 6 | #include "Alloc.h" 7 | #include "Bra.h" 8 | #include "LzmaDec.h" 9 | 10 | static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } 11 | static void SzFree(void *p, void *address) { p = p; MyFree(address); } 12 | 13 | SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize) 14 | { 15 | unsigned i; 16 | if (srcLen < LZMA86_HEADER_SIZE) 17 | return SZ_ERROR_INPUT_EOF; 18 | *unpackSize = 0; 19 | for (i = 0; i < sizeof(UInt64); i++) 20 | *unpackSize += ((UInt64)src[LZMA86_SIZE_OFFSET + i]) << (8 * i); 21 | return SZ_OK; 22 | } 23 | 24 | SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen) 25 | { 26 | ISzAlloc g_Alloc = { SzAlloc, SzFree }; 27 | SRes res; 28 | int useFilter; 29 | SizeT inSizePure; 30 | ELzmaStatus status; 31 | 32 | if (*srcLen < LZMA86_HEADER_SIZE) 33 | return SZ_ERROR_INPUT_EOF; 34 | 35 | useFilter = src[0]; 36 | 37 | if (useFilter > 1) 38 | { 39 | *destLen = 0; 40 | return SZ_ERROR_UNSUPPORTED; 41 | } 42 | 43 | inSizePure = *srcLen - LZMA86_HEADER_SIZE; 44 | res = LzmaDecode(dest, destLen, src + LZMA86_HEADER_SIZE, &inSizePure, 45 | src + 1, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &status, &g_Alloc); 46 | *srcLen = inSizePure + LZMA86_HEADER_SIZE; 47 | if (res != SZ_OK) 48 | return res; 49 | if (useFilter == 1) 50 | { 51 | UInt32 x86State; 52 | x86_Convert_Init(x86State); 53 | x86_Convert(dest, *destLen, 0, &x86State, 0); 54 | } 55 | return SZ_OK; 56 | } 57 | -------------------------------------------------------------------------------- /lzma/LzmaLib.c: -------------------------------------------------------------------------------- 1 | /* LzmaLib.c -- LZMA library wrapper 2 | 2008-08-05 3 | Igor Pavlov 4 | Public domain */ 5 | 6 | #include "LzmaEnc.h" 7 | #include "LzmaDec.h" 8 | #include "Alloc.h" 9 | #include "LzmaLib.h" 10 | 11 | static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); } 12 | static void SzFree(void *p, void *address) { p = p; MyFree(address); } 13 | static ISzAlloc g_Alloc = { SzAlloc, SzFree }; 14 | 15 | MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen, 16 | unsigned char *outProps, size_t *outPropsSize, 17 | int level, /* 0 <= level <= 9, default = 5 */ 18 | unsigned dictSize, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */ 19 | int lc, /* 0 <= lc <= 8, default = 3 */ 20 | int lp, /* 0 <= lp <= 4, default = 0 */ 21 | int pb, /* 0 <= pb <= 4, default = 2 */ 22 | int fb, /* 5 <= fb <= 273, default = 32 */ 23 | int numThreads /* 1 or 2, default = 2 */ 24 | ) 25 | { 26 | CLzmaEncProps props; 27 | LzmaEncProps_Init(&props); 28 | props.level = level; 29 | props.dictSize = dictSize; 30 | props.lc = lc; 31 | props.lp = lp; 32 | props.pb = pb; 33 | props.fb = fb; 34 | props.numThreads = numThreads; 35 | 36 | return LzmaEncode(dest, destLen, src, srcLen, &props, outProps, outPropsSize, 0, 37 | NULL, &g_Alloc, &g_Alloc); 38 | } 39 | 40 | 41 | MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen, 42 | const unsigned char *props, size_t propsSize) 43 | { 44 | ELzmaStatus status; 45 | return LzmaDecode(dest, destLen, src, srcLen, props, (unsigned)propsSize, LZMA_FINISH_ANY, &status, &g_Alloc); 46 | } 47 | -------------------------------------------------------------------------------- /lzma/MyVersion.h: -------------------------------------------------------------------------------- 1 | #define MY_VER_MAJOR 9 2 | #define MY_VER_MINOR 20 3 | #define MY_VER_BUILD 0 4 | #define MY_VERSION "9.20" 5 | #define MY_7ZIP_VERSION "7-Zip 9.20" 6 | #define MY_DATE "2010-11-18" 7 | #define MY_COPYRIGHT "Copyright (c) 1999-2010 Igor Pavlov" 8 | #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE 9 | -------------------------------------------------------------------------------- /lzma/MyVersionInfo.rc: -------------------------------------------------------------------------------- 1 | #define MY_VS_FFI_FILEFLAGSMASK 0x0000003FL 2 | #define MY_VOS_NT_WINDOWS32 0x00040004L 3 | #define MY_VOS_CE_WINDOWS32 0x00050004L 4 | 5 | #define MY_VFT_APP 0x00000001L 6 | #define MY_VFT_DLL 0x00000002L 7 | 8 | // #include 9 | #include "MyVersion.h" 10 | 11 | #define MY_VER MY_VER_MAJOR,MY_VER_MINOR,MY_VER_BUILD,0 12 | 13 | #ifdef DEBUG 14 | #define DBG_FL VS_FF_DEBUG 15 | #else 16 | #define DBG_FL 0 17 | #endif 18 | 19 | #define MY_VERSION_INFO(fileType, descr, intName, origName) \ 20 | LANGUAGE 9, 1 \ 21 | 1 VERSIONINFO \ 22 | FILEVERSION MY_VER \ 23 | PRODUCTVERSION MY_VER \ 24 | FILEFLAGSMASK MY_VS_FFI_FILEFLAGSMASK \ 25 | FILEFLAGS DBG_FL \ 26 | FILEOS MY_VOS_NT_WINDOWS32 \ 27 | FILETYPE fileType \ 28 | FILESUBTYPE 0x0L \ 29 | BEGIN \ 30 | BLOCK "StringFileInfo" \ 31 | BEGIN \ 32 | BLOCK "040904b0" \ 33 | BEGIN \ 34 | VALUE "CompanyName", "Igor Pavlov" \ 35 | VALUE "FileDescription", descr \ 36 | VALUE "FileVersion", MY_VERSION \ 37 | VALUE "InternalName", intName \ 38 | VALUE "LegalCopyright", MY_COPYRIGHT \ 39 | VALUE "OriginalFilename", origName \ 40 | VALUE "ProductName", "7-Zip" \ 41 | VALUE "ProductVersion", MY_VERSION \ 42 | END \ 43 | END \ 44 | BLOCK "VarFileInfo" \ 45 | BEGIN \ 46 | VALUE "Translation", 0x409, 1200 \ 47 | END \ 48 | END 49 | 50 | #define MY_VERSION_INFO_APP(descr, intName) MY_VERSION_INFO(MY_VFT_APP, descr, intName, intName ".exe") 51 | 52 | #define MY_VERSION_INFO_DLL(descr, intName) MY_VERSION_INFO(MY_VFT_DLL, descr, intName, intName ".dll") 53 | -------------------------------------------------------------------------------- /lzma/RotateDefs.h: -------------------------------------------------------------------------------- 1 | /* RotateDefs.h -- Rotate functions 2 | 2009-02-07 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __ROTATE_DEFS_H 5 | #define __ROTATE_DEFS_H 6 | 7 | #ifdef _MSC_VER 8 | 9 | #include 10 | #define rotlFixed(x, n) _rotl((x), (n)) 11 | #define rotrFixed(x, n) _rotr((x), (n)) 12 | 13 | #else 14 | 15 | #define rotlFixed(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) 16 | #define rotrFixed(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) 17 | 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /lzma/Sha256.h: -------------------------------------------------------------------------------- 1 | /* Sha256.h -- SHA-256 Hash 2 | 2010-06-11 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __CRYPTO_SHA256_H 5 | #define __CRYPTO_SHA256_H 6 | 7 | #include "Types.h" 8 | 9 | EXTERN_C_BEGIN 10 | 11 | #define SHA256_DIGEST_SIZE 32 12 | 13 | typedef struct 14 | { 15 | UInt32 state[8]; 16 | UInt64 count; 17 | Byte buffer[64]; 18 | } CSha256; 19 | 20 | void Sha256_Init(CSha256 *p); 21 | void Sha256_Update(CSha256 *p, const Byte *data, size_t size); 22 | void Sha256_Final(CSha256 *p, Byte *digest); 23 | 24 | EXTERN_C_END 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /lzma/Util/7z/7z.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "7z"=.\7z.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /lzma/Util/7z/makefile: -------------------------------------------------------------------------------- 1 | MY_STATIC_LINK=1 2 | CFLAGS = $(CFLAGS) -D_7ZIP_PPMD_SUPPPORT 3 | 4 | PROG = 7zDec.exe 5 | 6 | C_OBJS = \ 7 | $O\7zAlloc.obj \ 8 | $O\7zBuf.obj \ 9 | $O\7zBuf2.obj \ 10 | $O\7zCrc.obj \ 11 | $O\7zCrcOpt.obj \ 12 | $O\7zFile.obj \ 13 | $O\7zDec.obj \ 14 | $O\7zIn.obj \ 15 | $O\7zStream.obj \ 16 | $O\Bcj2.obj \ 17 | $O\Bra.obj \ 18 | $O\Bra86.obj \ 19 | $O\CpuArch.obj \ 20 | $O\Lzma2Dec.obj \ 21 | $O\LzmaDec.obj \ 22 | $O\Ppmd7.obj \ 23 | $O\Ppmd7Dec.obj \ 24 | 25 | 7Z_OBJS = \ 26 | $O\7zMain.obj \ 27 | 28 | OBJS = \ 29 | $(7Z_OBJS) \ 30 | $(C_OBJS) \ 31 | 32 | !include "../../../CPP/Build.mak" 33 | 34 | $(7Z_OBJS): $(*B).c 35 | $(COMPL_O1) 36 | $(C_OBJS): ../../$(*B).c 37 | $(COMPL_O2) 38 | -------------------------------------------------------------------------------- /lzma/Util/7z/makefile.gcc: -------------------------------------------------------------------------------- 1 | PROG = 7zDec 2 | CXX = g++ 3 | LIB = 4 | RM = rm -f 5 | CFLAGS = -c -O2 -Wall 6 | 7 | OBJS = 7zMain.o 7zAlloc.o 7zBuf.o 7zBuf2.o 7zCrc.o 7zCrcOpt.o 7zDec.o 7zIn.o CpuArch.o LzmaDec.o Lzma2Dec.o Bra.o Bra86.o Bcj2.o Ppmd7.o Ppmd7Dec.o 7zFile.o 7zStream.o 8 | 9 | all: $(PROG) 10 | 11 | $(PROG): $(OBJS) 12 | $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) 13 | 14 | 7zMain.o: 7zMain.c 15 | $(CXX) $(CFLAGS) 7zMain.c 16 | 17 | 7zAlloc.o: 7zAlloc.c 18 | $(CXX) $(CFLAGS) ../../7zAlloc.c 19 | 20 | 7zBuf.o: ../../7zBuf.c 21 | $(CXX) $(CFLAGS) ../../7zBuf.c 22 | 23 | 7zBuf2.o: ../../7zBuf2.c 24 | $(CXX) $(CFLAGS) ../../7zBuf2.c 25 | 26 | 7zCrc.o: ../../7zCrc.c 27 | $(CXX) $(CFLAGS) ../../7zCrc.c 28 | 29 | 7zCrcOpt.o: ../../7zCrc.c 30 | $(CXX) $(CFLAGS) ../../7zCrcOpt.c 31 | 32 | 7zDec.o: ../../7zDec.c 33 | $(CXX) $(CFLAGS) -D_7ZIP_PPMD_SUPPPORT ../../7zDec.c 34 | 35 | 7zIn.o: ../../7zIn.c 36 | $(CXX) $(CFLAGS) ../../7zIn.c 37 | 38 | CpuArch.o: ../../CpuArch.c 39 | $(CXX) $(CFLAGS) ../../CpuArch.c 40 | 41 | LzmaDec.o: ../../LzmaDec.c 42 | $(CXX) $(CFLAGS) ../../LzmaDec.c 43 | 44 | Lzma2Dec.o: ../../Lzma2Dec.c 45 | $(CXX) $(CFLAGS) ../../Lzma2Dec.c 46 | 47 | Bra.o: ../../Bra.c 48 | $(CXX) $(CFLAGS) ../../Bra.c 49 | 50 | Bra86.o: ../../Bra86.c 51 | $(CXX) $(CFLAGS) ../../Bra86.c 52 | 53 | Bcj2.o: ../../Bcj2.c 54 | $(CXX) $(CFLAGS) ../../Bcj2.c 55 | 56 | Ppmd7.o: ../../Ppmd7.c 57 | $(CXX) $(CFLAGS) ../../Ppmd7.c 58 | 59 | Ppmd7Dec.o: ../../Ppmd7Dec.c 60 | $(CXX) $(CFLAGS) ../../Ppmd7Dec.c 61 | 62 | 7zFile.o: ../../7zFile.c 63 | $(CXX) $(CFLAGS) ../../7zFile.c 64 | 65 | 7zStream.o: ../../7zStream.c 66 | $(CXX) $(CFLAGS) ../../7zStream.c 67 | 68 | clean: 69 | -$(RM) $(PROG) $(OBJS) 70 | 71 | -------------------------------------------------------------------------------- /lzma/Util/Lzma/LzmaUtil.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "LzmaUtil"=.\LzmaUtil.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /lzma/Util/Lzma/makefile: -------------------------------------------------------------------------------- 1 | MY_STATIC_LINK=1 2 | PROG = LZMAc.exe 3 | 4 | CFLAGS = $(CFLAGS) \ 5 | 6 | LIB_OBJS = \ 7 | $O\LzmaUtil.obj \ 8 | 9 | C_OBJS = \ 10 | $O\Alloc.obj \ 11 | $O\LzFind.obj \ 12 | $O\LzFindMt.obj \ 13 | $O\LzmaDec.obj \ 14 | $O\LzmaEnc.obj \ 15 | $O\7zFile.obj \ 16 | $O\7zStream.obj \ 17 | $O\Threads.obj \ 18 | 19 | OBJS = \ 20 | $(LIB_OBJS) \ 21 | $(C_OBJS) \ 22 | 23 | !include "../../../CPP/Build.mak" 24 | 25 | $(LIB_OBJS): $(*B).c 26 | $(COMPL_O2) 27 | $(C_OBJS): ../../$(*B).c 28 | $(COMPL_O2) 29 | -------------------------------------------------------------------------------- /lzma/Util/Lzma/makefile.gcc: -------------------------------------------------------------------------------- 1 | PROG = lzma 2 | CXX = g++ 3 | LIB = 4 | RM = rm -f 5 | CFLAGS = -c -O2 -Wall -D_7ZIP_ST 6 | 7 | OBJS = \ 8 | LzmaUtil.o \ 9 | Alloc.o \ 10 | LzFind.o \ 11 | LzmaDec.o \ 12 | LzmaEnc.o \ 13 | 7zFile.o \ 14 | 7zStream.o \ 15 | 16 | 17 | all: $(PROG) 18 | 19 | $(PROG): $(OBJS) 20 | $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) $(LIB2) 21 | 22 | LzmaUtil.o: LzmaUtil.c 23 | $(CXX) $(CFLAGS) LzmaUtil.c 24 | 25 | Alloc.o: ../../Alloc.c 26 | $(CXX) $(CFLAGS) ../../Alloc.c 27 | 28 | LzFind.o: ../../LzFind.c 29 | $(CXX) $(CFLAGS) ../../LzFind.c 30 | 31 | LzmaDec.o: ../../LzmaDec.c 32 | $(CXX) $(CFLAGS) ../../LzmaDec.c 33 | 34 | LzmaEnc.o: ../../LzmaEnc.c 35 | $(CXX) $(CFLAGS) ../../LzmaEnc.c 36 | 37 | 7zFile.o: ../../7zFile.c 38 | $(CXX) $(CFLAGS) ../../7zFile.c 39 | 40 | 7zStream.o: ../../7zStream.c 41 | $(CXX) $(CFLAGS) ../../7zStream.c 42 | 43 | clean: 44 | -$(RM) $(PROG) $(OBJS) 45 | -------------------------------------------------------------------------------- /lzma/Util/LzmaLib/LzmaLib.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | LzmaCompress 3 | LzmaUncompress 4 | 5 | -------------------------------------------------------------------------------- /lzma/Util/LzmaLib/LzmaLib.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "LzmaLib"=.\LzmaLib.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /lzma/Util/LzmaLib/LzmaLib.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {b4ff16f8-c033-44d7-af8b-83f323d650b7} 6 | 7 | 8 | 9 | 10 | Spec 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Spec 39 | 40 | 41 | -------------------------------------------------------------------------------- /lzma/Util/LzmaLib/LzmaLibExports.c: -------------------------------------------------------------------------------- 1 | /* LzmaLibExports.c -- LZMA library DLL Entry point 2 | 2008-10-04 : Igor Pavlov : Public domain */ 3 | 4 | #include 5 | 6 | BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) 7 | { 8 | hInstance = hInstance; 9 | dwReason = dwReason; 10 | lpReserved = lpReserved; 11 | return TRUE; 12 | } 13 | -------------------------------------------------------------------------------- /lzma/Util/LzmaLib/RCa08116: -------------------------------------------------------------------------------- 1 | #line 1"D:\\NetnucleusProjects\\NsisDecompiler\\lzma\\Util\\LzmaLib\\resource.rc" 2 | #line 1 3 | #include "MyVersionInfo.rc" 4 | #line 3 5 | MY_VERSION_INFO_DLL("LZMA library", "LZMA") 6 | -------------------------------------------------------------------------------- /lzma/Util/LzmaLib/RCb08116: -------------------------------------------------------------------------------- 1 | #line 1"D:\\NetnucleusProjects\\NsisDecompiler\\lzma\\Util\\LzmaLib\\resource.rc" 2 | #line 1 3 | #include "MyVersionInfo.rc" 4 | #line 3 5 | MY_VERSION_INFO_DLL("LZMA library", "LZMA") 6 | -------------------------------------------------------------------------------- /lzma/Util/LzmaLib/TextFile1.txt: -------------------------------------------------------------------------------- 1 | // Settings common to both installers and uninstallers 2 | typedef struct 3 | { 4 | int flags; // CH_FLAGS_* 5 | struct block_header blocks[BLOCKS_NUM]; 6 | 7 | // InstallDirRegKey stuff 8 | int install_reg_rootkey; 9 | // these two are not processed! 10 | int install_reg_key_ptr, install_reg_value_ptr; 11 | int bg_color1, bg_color2, bg_textcolor; 12 | // installation log window colors 13 | int lb_bg, lb_fg; 14 | // langtable size 15 | int langtable_size; 16 | // license background color 17 | int license_bg; 18 | // .on* calls 19 | int code_onInit; 20 | int code_onInstSuccess; 21 | int code_onInstFailed; 22 | int code_onUserAbort; 23 | int code_onGUIInit; 24 | int code_onGUIEnd; 25 | int code_onMouseOverSection; 26 | int code_onVerifyInstDir; 27 | int code_onSelChange; 28 | int code_onRebootFailed; 29 | int install_types[NSIS_MAX_INST_TYPES+1]; 30 | int install_directory_ptr; // default install dir. 31 | int install_directory_auto_append; // auto append part 32 | int str_uninstchild; 33 | int str_uninstcmd; 34 | int str_wininit; 35 | } header; 36 | -------------------------------------------------------------------------------- /lzma/Util/LzmaLib/makefile: -------------------------------------------------------------------------------- 1 | MY_STATIC_LINK=1 2 | SLIB = sLZMA.lib 3 | PROG = LZMA.dll 4 | SLIBPATH = $O\$(SLIB) 5 | 6 | DEF_FILE = LzmaLib.def 7 | CFLAGS = $(CFLAGS) \ 8 | 9 | LIB_OBJS = \ 10 | $O\LzmaLibExports.obj \ 11 | 12 | C_OBJS = \ 13 | $O\Alloc.obj \ 14 | $O\LzFind.obj \ 15 | $O\LzFindMt.obj \ 16 | $O\LzmaDec.obj \ 17 | $O\LzmaEnc.obj \ 18 | $O\LzmaLib.obj \ 19 | $O\Threads.obj \ 20 | 21 | OBJS = \ 22 | $(LIB_OBJS) \ 23 | $(C_OBJS) \ 24 | $O\resource.res 25 | 26 | !include "../../../CPP/Build.mak" 27 | 28 | $(SLIBPATH): $O $(OBJS) 29 | lib -out:$(SLIBPATH) $(OBJS) $(LIBS) 30 | 31 | $(LIB_OBJS): $(*B).c 32 | $(COMPL_O2) 33 | $(C_OBJS): ../../$(*B).c 34 | $(COMPL_O2) 35 | -------------------------------------------------------------------------------- /lzma/Util/SfxSetup/SfxSetup.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "SfxSetup"=.\SfxSetup.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /lzma/Util/SfxSetup/makefile: -------------------------------------------------------------------------------- 1 | PROG = 7zS2.sfx 2 | LIBS = $(LIBS) 3 | CFLAGS = $(CFLAGS) -DUNICODE -D_UNICODE 4 | 5 | C_OBJS = \ 6 | $O\7zAlloc.obj \ 7 | $O\7zBuf.obj \ 8 | $O\7zBuf2.obj \ 9 | $O\7zCrc.obj \ 10 | $O\7zCrcOpt.obj \ 11 | $O\7zFile.obj \ 12 | $O\7zDec.obj \ 13 | $O\7zIn.obj \ 14 | $O\7zStream.obj \ 15 | $O\Bcj2.obj \ 16 | $O\Bra.obj \ 17 | $O\Bra86.obj \ 18 | $O\CpuArch.obj \ 19 | $O\Lzma2Dec.obj \ 20 | $O\LzmaDec.obj \ 21 | 22 | 7Z_OBJS = \ 23 | $O\SfxSetup.obj \ 24 | 25 | OBJS = \ 26 | $(7Z_OBJS) \ 27 | $(C_OBJS) \ 28 | $O\resource.res 29 | 30 | !include "../../../CPP/Build.mak" 31 | 32 | $(7Z_OBJS): $(*B).c 33 | $(COMPL_O1) 34 | $(C_OBJS): ../../$(*B).c 35 | $(COMPL_O1) 36 | -------------------------------------------------------------------------------- /lzma/Util/SfxSetup/makefile_con: -------------------------------------------------------------------------------- 1 | PROG = 7zS2con.sfx 2 | LIBS = $(LIBS) 3 | CFLAGS = $(CFLAGS) -DUNICODE -D_UNICODE -D_CONSOLE 4 | 5 | C_OBJS = \ 6 | $O\7zAlloc.obj \ 7 | $O\7zBuf.obj \ 8 | $O\7zBuf2.obj \ 9 | $O\7zCrc.obj \ 10 | $O\7zCrcOpt.obj \ 11 | $O\7zFile.obj \ 12 | $O\7zDec.obj \ 13 | $O\7zIn.obj \ 14 | $O\7zStream.obj \ 15 | $O\Bcj2.obj \ 16 | $O\Bra.obj \ 17 | $O\Bra86.obj \ 18 | $O\CpuArch.obj \ 19 | $O\Lzma2Dec.obj \ 20 | $O\LzmaDec.obj \ 21 | 22 | 7Z_OBJS = \ 23 | $O\SfxSetup.obj \ 24 | 25 | OBJS = \ 26 | $(7Z_OBJS) \ 27 | $(C_OBJS) \ 28 | $O\resource.res 29 | 30 | !include "../../../CPP/Build.mak" 31 | 32 | $(7Z_OBJS): $(*B).c 33 | $(COMPL_O1) 34 | $(C_OBJS): ../../$(*B).c 35 | $(COMPL_O1) 36 | -------------------------------------------------------------------------------- /lzma/Util/SfxSetup/resource.rc: -------------------------------------------------------------------------------- 1 | #include "../../../CPP/7zip/MyVersionInfo.rc" 2 | 3 | MY_VERSION_INFO_APP("7z Setup SFX small", "7zS2.sfx") 4 | 5 | 1 ICON "setup.ico" 6 | 7 | -------------------------------------------------------------------------------- /lzma/Util/SfxSetup/setup.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/lzma/Util/SfxSetup/setup.ico -------------------------------------------------------------------------------- /lzma/XzCrc64.c: -------------------------------------------------------------------------------- 1 | /* XzCrc64.c -- CRC64 calculation 2 | 2010-04-16 : Igor Pavlov : Public domain */ 3 | 4 | #include "XzCrc64.h" 5 | 6 | #define kCrc64Poly UINT64_CONST(0xC96C5795D7870F42) 7 | UInt64 g_Crc64Table[256]; 8 | 9 | void MY_FAST_CALL Crc64GenerateTable(void) 10 | { 11 | UInt32 i; 12 | for (i = 0; i < 256; i++) 13 | { 14 | UInt64 r = i; 15 | int j; 16 | for (j = 0; j < 8; j++) 17 | r = (r >> 1) ^ ((UInt64)kCrc64Poly & ~((r & 1) - 1)); 18 | g_Crc64Table[i] = r; 19 | } 20 | } 21 | 22 | UInt64 MY_FAST_CALL Crc64Update(UInt64 v, const void *data, size_t size) 23 | { 24 | const Byte *p = (const Byte *)data; 25 | for (; size > 0 ; size--, p++) 26 | v = CRC64_UPDATE_BYTE(v, *p); 27 | return v; 28 | } 29 | 30 | UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size) 31 | { 32 | return CRC64_GET_DIGEST(Crc64Update(CRC64_INIT_VAL, data, size)); 33 | } 34 | -------------------------------------------------------------------------------- /lzma/XzCrc64.h: -------------------------------------------------------------------------------- 1 | /* XzCrc64.h -- CRC64 calculation 2 | 2010-04-16 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __XZ_CRC64_H 5 | #define __XZ_CRC64_H 6 | 7 | #include 8 | 9 | #include "Types.h" 10 | 11 | EXTERN_C_BEGIN 12 | 13 | extern UInt64 g_Crc64Table[]; 14 | 15 | void MY_FAST_CALL Crc64GenerateTable(void); 16 | 17 | #define CRC64_INIT_VAL UINT64_CONST(0xFFFFFFFFFFFFFFFF) 18 | #define CRC64_GET_DIGEST(crc) ((crc) ^ CRC64_INIT_VAL) 19 | #define CRC64_UPDATE_BYTE(crc, b) (g_Crc64Table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) 20 | 21 | UInt64 MY_FAST_CALL Crc64Update(UInt64 crc, const void *data, size_t size); 22 | UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size); 23 | 24 | EXTERN_C_END 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /lzma/XzEnc.h: -------------------------------------------------------------------------------- 1 | /* XzEnc.h -- Xz Encode 2 | 2009-04-15 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __XZ_ENC_H 5 | #define __XZ_ENC_H 6 | 7 | #include "Lzma2Enc.h" 8 | 9 | #include "Xz.h" 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | SRes Xz_Encode(ISeqOutStream *outStream, ISeqInStream *inStream, 16 | const CLzma2EncProps *lzma2Props, Bool useSubblock, 17 | ICompressProgress *progress); 18 | 19 | SRes Xz_EncodeEmpty(ISeqOutStream *outStream); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /res/NsisDecompiler.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/res/NsisDecompiler.ico -------------------------------------------------------------------------------- /res/NsisDecompiler.rc2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/res/NsisDecompiler.rc2 -------------------------------------------------------------------------------- /res/icon1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/res/icon1.ico -------------------------------------------------------------------------------- /res/icon2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/res/icon2.ico -------------------------------------------------------------------------------- /stdafx.cpp: -------------------------------------------------------------------------------- 1 | 2 | // stdafx.cpp : source file that includes just the standard includes 3 | // NsisDecompiler.pch will be the pre-compiled header 4 | // stdafx.obj will contain the pre-compiled type information 5 | 6 | #include "stdafx.h" 7 | 8 | 9 | -------------------------------------------------------------------------------- /targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Noice2k/NsisDecompiler/e9024bfa035e096715455f41c5f09db8ecf5cb9d/zlib1.dll --------------------------------------------------------------------------------