summaryrefslogtreecommitdiffstats
path: root/app-arch/p7zip/files/p7zip_4.57-libun7zip.patch
diff options
context:
space:
mode:
Diffstat (limited to 'app-arch/p7zip/files/p7zip_4.57-libun7zip.patch')
-rw-r--r--app-arch/p7zip/files/p7zip_4.57-libun7zip.patch684
1 files changed, 684 insertions, 0 deletions
diff --git a/app-arch/p7zip/files/p7zip_4.57-libun7zip.patch b/app-arch/p7zip/files/p7zip_4.57-libun7zip.patch
new file mode 100644
index 0000000..07a3188
--- /dev/null
+++ b/app-arch/p7zip/files/p7zip_4.57-libun7zip.patch
@@ -0,0 +1,684 @@
+diff -dPNur p7zip_4.57/CPP/7zip/Bundles/Un7Zip/makefile p7zip_4.57-new/CPP/7zip/Bundles/Un7Zip/makefile
+--- p7zip_4.57/CPP/7zip/Bundles/Un7Zip/makefile 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.57-new/CPP/7zip/Bundles/Un7Zip/makefile 2008-04-11 19:39:40.000000000 +0200
+@@ -0,0 +1,99 @@
++PROG=libun7zip.so
++
++LOCAL_FLAGS= \
++ -DEXTRACT_ONLY \
++ -DNO_READ_FROM_CODER \
++ -D_SFX
++
++include ../../../../makefile.crc32
++include ../../../../makefile.machine
++
++LOCAL_SHARED=$(LINK_SHARED)
++LIBS=$(LOCAL_LIBS_DLL)
++
++OBJS=\
++myGetTickCount.o\
++wine_date_and_time.o\
++mySplitCommandLine.o\
++CommandLineParser.o\
++CRC.o\
++IntToString.o\
++StdInStream.o\
++StdOutStream.o\
++MyString.o\
++MyWindows.o\
++StringConvert.o\
++MyVector.o\
++Wildcard.o\
++CoderMixer2.o\
++CoderMixer2MT.o\
++CrossThreadProgress.o\
++FilterCoder.o\
++ItemNameUtils.o\
++OutStreamWithCRC.o\
++ConsoleClose.o\
++ExtractCallbackConsole.o\
++ExtractCallbackNULL.o\
++List.o\
++OpenCallbackConsole.o\
++UserInputUtils.o\
++7zDecode.o\
++7zExtract.o\
++7zFolderOutStream.o\
++7zHandler.o\
++7zHeader.o\
++7zIn.o\
++7zRegister.o\
++LZMADecoder.o\
++LZMARegister.o\
++BranchCoder.o\
++x86.o\
++x86_2.o\
++PPMDDecoder.o\
++PPMDRegister.o\
++LZOutWindow.o\
++CopyCoder.o\
++CopyRegister.o\
++7zAES.o\
++7zAESRegister.o\
++MyAES.o\
++Error.o\
++FileDir.o\
++FileFind.o\
++FileIO.o\
++FileName.o\
++PropVariant.o\
++PropVariantConversions.o\
++Synchronization.o\
++System.o\
++FilePathAutoRename.o\
++FileStreams.o\
++InBuffer.o\
++LimitedStreams.o\
++LockedStream.o\
++StreamUtils.o\
++OutBuffer.o\
++ProgressUtils.o\
++StreamBinder.o\
++StreamObjects.o\
++VirtThread.o \
++ArchiveExtractCallback.o\
++ArchiveOpenCallback.o\
++DefaultName.o\
++LoadCodecs.o\
++Extract.o\
++ExtractingFilePath.o\
++OpenArchive.o\
++PropIDUtils.o\
++CreateCoder.o\
++Sha256.o \
++BranchX86.o \
++BCJ2Register.o\
++BCJRegister.o\
++Threads.o\
++$(OBJ_CRC32) \
++Aes.o \
++Un7Zip.o
++
++include ../../../../makefile.glb
++
+diff -dPNur p7zip_4.57/CPP/7zip/Bundles/Un7Zip/makefile.depend p7zip_4.57-new/CPP/7zip/Bundles/Un7Zip/makefile.depend
+--- p7zip_4.57/CPP/7zip/Bundles/Un7Zip/makefile.depend 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.57-new/CPP/7zip/Bundles/Un7Zip/makefile.depend 2008-04-11 18:37:10.000000000 +0200
+@@ -0,0 +1 @@
++
+\ No newline at end of file
+diff -dPNur p7zip_4.57/CPP/7zip/Bundles/Un7Zip/makefile.list p7zip_4.57-new/CPP/7zip/Bundles/Un7Zip/makefile.list
+--- p7zip_4.57/CPP/7zip/Bundles/Un7Zip/makefile.list 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.57-new/CPP/7zip/Bundles/Un7Zip/makefile.list 2008-04-11 19:19:43.000000000 +0200
+@@ -0,0 +1,180 @@
++wine_date_and_time.o : ../../../myWindows/wine_date_and_time.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../myWindows/wine_date_and_time.cpp
++myGetTickCount.o : ../../../myWindows/myGetTickCount.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../myWindows/myGetTickCount.cpp
++mySplitCommandLine.o : ../../../myWindows/mySplitCommandLine.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../myWindows/mySplitCommandLine.cpp
++CommandLineParser.o : ../../../Common/CommandLineParser.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/CommandLineParser.cpp
++CRC.o : ../../../Common/CRC.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/CRC.cpp
++IntToString.o : ../../../Common/IntToString.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/IntToString.cpp
++ListFileUtils.o : ../../../Common/ListFileUtils.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/ListFileUtils.cpp
++MyWindows.o : ../../../Common/MyWindows.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/MyWindows.cpp
++Random.o : ../../../Common/Random.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/Random.cpp
++StdInStream.o : ../../../Common/StdInStream.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/StdInStream.cpp
++StdOutStream.o : ../../../Common/StdOutStream.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/StdOutStream.cpp
++MyString.o : ../../../Common/MyString.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/MyString.cpp
++StringConvert.o : ../../../Common/StringConvert.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/StringConvert.cpp
++StringToInt.o : ../../../Common/StringToInt.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/StringToInt.cpp
++UTFConvert.o : ../../../Common/UTFConvert.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/UTFConvert.cpp
++MyVector.o : ../../../Common/MyVector.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/MyVector.cpp
++Wildcard.o : ../../../Common/Wildcard.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Common/Wildcard.cpp
++CoderMixer2.o : ../../Archive/Common/CoderMixer2.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Archive/Common/CoderMixer2.cpp
++CoderMixer2MT.o : ../../Archive/Common/CoderMixer2MT.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Archive/Common/CoderMixer2MT.cpp
++CrossThreadProgress.o : ../../Archive/Common/CrossThreadProgress.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Archive/Common/CrossThreadProgress.cpp
++ItemNameUtils.o : ../../Archive/Common/ItemNameUtils.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Archive/Common/ItemNameUtils.cpp
++OutStreamWithCRC.o : ../../Archive/Common/OutStreamWithCRC.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Archive/Common/OutStreamWithCRC.cpp
++ConsoleClose.o : ../../UI/Console/ConsoleClose.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Console/ConsoleClose.cpp
++ExtractCallbackConsole.o : ../../UI/Console/ExtractCallbackConsole.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Console/ExtractCallbackConsole.cpp
++List.o : ../../UI/Console/List.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Console/List.cpp
++MainAr.o : ../../UI/Console/MainAr.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Console/MainAr.cpp
++OpenCallbackConsole.o : ../../UI/Console/OpenCallbackConsole.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Console/OpenCallbackConsole.cpp
++UserInputUtils.o : ../../UI/Console/UserInputUtils.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Console/UserInputUtils.cpp
++7zDecode.o : ../../Archive/7z/7zDecode.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Archive/7z/7zDecode.cpp
++7zExtract.o : ../../Archive/7z/7zExtract.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Archive/7z/7zExtract.cpp
++7zFolderOutStream.o : ../../Archive/7z/7zFolderOutStream.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Archive/7z/7zFolderOutStream.cpp
++7zHandler.o : ../../Archive/7z/7zHandler.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Archive/7z/7zHandler.cpp
++7zHeader.o : ../../Archive/7z/7zHeader.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Archive/7z/7zHeader.cpp
++7zIn.o : ../../Archive/7z/7zIn.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Archive/7z/7zIn.cpp
++LZMADecoder.o : ../../Compress/LZMA/LZMADecoder.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Compress/LZMA/LZMADecoder.cpp
++BranchCoder.o : ../../Compress/Branch/BranchCoder.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Compress/Branch/BranchCoder.cpp
++x86.o : ../../Compress/Branch/x86.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Compress/Branch/x86.cpp
++x86_2.o : ../../Compress/Branch/x86_2.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Compress/Branch/x86_2.cpp
++PPMDDecoder.o : ../../Compress/PPMD/PPMDDecoder.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Compress/PPMD/PPMDDecoder.cpp
++LZOutWindow.o : ../../Compress/LZ/LZOutWindow.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Compress/LZ/LZOutWindow.cpp
++CopyCoder.o : ../../Compress/Copy/CopyCoder.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Compress/Copy/CopyCoder.cpp
++7zAES.o : ../../Crypto/7zAES/7zAES.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Crypto/7zAES/7zAES.cpp
++MyAES.o : ../../Crypto/AES/MyAES.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Crypto/AES/MyAES.cpp
++Sha256.o : ../../Crypto/Hash/Sha256.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Crypto/Hash/Sha256.cpp
++Error.o : ../../../Windows/Error.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Windows/Error.cpp
++FileDir.o : ../../../Windows/FileDir.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Windows/FileDir.cpp
++FileFind.o : ../../../Windows/FileFind.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Windows/FileFind.cpp
++FileIO.o : ../../../Windows/FileIO.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Windows/FileIO.cpp
++FileName.o : ../../../Windows/FileName.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Windows/FileName.cpp
++PropVariant.o : ../../../Windows/PropVariant.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Windows/PropVariant.cpp
++PropVariantConversions.o : ../../../Windows/PropVariantConversions.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Windows/PropVariantConversions.cpp
++Synchronization.o : ../../../Windows/Synchronization.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Windows/Synchronization.cpp
++System.o : ../../../Windows/System.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../../Windows/System.cpp
++CreateCoder.o : ../../Common/CreateCoder.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/CreateCoder.cpp
++FilePathAutoRename.o : ../../Common/FilePathAutoRename.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/FilePathAutoRename.cpp
++FileStreams.o : ../../Common/FileStreams.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/FileStreams.cpp
++FilterCoder.o : ../../Common/FilterCoder.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/FilterCoder.cpp
++InBuffer.o : ../../Common/InBuffer.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/InBuffer.cpp
++LimitedStreams.o : ../../Common/LimitedStreams.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/LimitedStreams.cpp
++LockedStream.o : ../../Common/LockedStream.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/LockedStream.cpp
++StreamUtils.o : ../../Common/StreamUtils.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/StreamUtils.cpp
++OutBuffer.o : ../../Common/OutBuffer.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/OutBuffer.cpp
++ProgressUtils.o : ../../Common/ProgressUtils.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/ProgressUtils.cpp
++StreamBinder.o : ../../Common/StreamBinder.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/StreamBinder.cpp
++StreamObjects.o : ../../Common/StreamObjects.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/StreamObjects.cpp
++VirtThread.o : ../../Common/VirtThread.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Common/VirtThread.cpp
++ArchiveExtractCallback.o : ../../UI/Common/ArchiveExtractCallback.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Common/ArchiveExtractCallback.cpp
++ArchiveOpenCallback.o : ../../UI/Common/ArchiveOpenCallback.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Common/ArchiveOpenCallback.cpp
++LoadCodecs.o : ../../UI/Common/LoadCodecs.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Common/LoadCodecs.cpp
++DefaultName.o : ../../UI/Common/DefaultName.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Common/DefaultName.cpp
++Extract.o : ../../UI/Common/Extract.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Common/Extract.cpp
++ExtractingFilePath.o : ../../UI/Common/ExtractingFilePath.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Common/ExtractingFilePath.cpp
++OpenArchive.o : ../../UI/Common/OpenArchive.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Common/OpenArchive.cpp
++PropIDUtils.o : ../../UI/Common/PropIDUtils.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Common/PropIDUtils.cpp
++Main.o : ./Main.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ./Main.cpp
++BranchX86.o : ../../../../C/Compress/Branch/BranchX86.c
++ $(CC) $(CFLAGS) $(CC_SHARED) ../../../../C/Compress/Branch/BranchX86.c
++7zRegister.o : ../../Archive/7z/7zRegister.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Archive/7z/7zRegister.cpp
++LZMARegister.o : ../../Compress/LZMA/LZMARegister.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Compress/LZMA/LZMARegister.cpp
++BCJ2Register.o : ../../Compress/Branch/BCJ2Register.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Compress/Branch/BCJ2Register.cpp
++BCJRegister.o : ../../Compress/Branch/BCJRegister.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Compress/Branch/BCJRegister.cpp
++PPMDRegister.o : ../../Compress/PPMD/PPMDRegister.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Compress/PPMD/PPMDRegister.cpp
++CopyRegister.o : ../../Compress/Copy/CopyRegister.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Compress/Copy/CopyRegister.cpp
++7zAESRegister.o : ../../Crypto/7zAES/7zAESRegister.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../Crypto/7zAES/7zAESRegister.cpp
++Threads.o : ../../../../C/Threads.c
++ $(CC) $(CFLAGS) $(CC_SHARED) ../../../../C/Threads.c
++Aes.o : ../../../../C/Crypto/Aes.c
++ $(CC) $(CFLAGS) $(CC_SHARED) ../../../../C/Crypto/Aes.c
++# CRC32, C version
++7zCrc.o : ../../../../C/7zCrc.c
++ $(CC) $(CFLAGS) $(CC_SHARED) ../../../../C/7zCrc.c
++# CRC32, ASM version
++7zCrcT8.o : ../../../../C/7zCrcT8.c
++ $(CC) $(CFLAGS) $(CC_SHARED) ../../../../C/7zCrcT8.c
++ExtractCallbackNULL.o : ../../UI/Console/ExtractCallbackNULL.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ../../UI/Console/ExtractCallbackNULL.cpp
++Un7Zip.o : ./Un7Zip.cpp
++ $(CXX) $(CFLAGS) $(CC_SHARED) ./Un7Zip.cpp
+diff -dPNur p7zip_4.57/CPP/7zip/Bundles/Un7Zip/testlib.c p7zip_4.57-new/CPP/7zip/Bundles/Un7Zip/testlib.c
+--- p7zip_4.57/CPP/7zip/Bundles/Un7Zip/testlib.c 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.57-new/CPP/7zip/Bundles/Un7Zip/testlib.c 2008-04-11 18:37:10.000000000 +0200
+@@ -0,0 +1,7 @@
++
++#include "u7zip.h"
++
++int main(int argc, char *argv[])
++{
++ return un7zip(argv[1], "/tmp", 0);
++}
+diff -dPNur p7zip_4.57/CPP/7zip/Bundles/Un7Zip/u7zip.h p7zip_4.57-new/CPP/7zip/Bundles/Un7Zip/u7zip.h
+--- p7zip_4.57/CPP/7zip/Bundles/Un7Zip/u7zip.h 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.57-new/CPP/7zip/Bundles/Un7Zip/u7zip.h 2008-04-11 18:37:10.000000000 +0200
+@@ -0,0 +1,19 @@
++#ifndef __UN7ZIP_H
++#define __UN7ZIP_H
++
++#define LIST_7Z 0
++#define TEST_7Z 1
++#define EXTRACT_7Z 2
++
++#define S_OK 0x00000000L
++#define S_FALSE 0x00000001L
++#define E_NOTIMPL 0x80004001L
++#define E_NOINTERFACE 0x80004002L
++#define E_ABORT 0x80004004L
++#define E_FAIL 0x80004005L
++#define E_OUTOFMEMORY 0x8007000EL
++#define E_INVALIDARG 0x80070057L
++
++int un7zip(char *name, char *dir, int command);
++
++#endif
+diff -dPNur p7zip_4.57/CPP/7zip/Bundles/Un7Zip/Un7Zip.cpp p7zip_4.57-new/CPP/7zip/Bundles/Un7Zip/Un7Zip.cpp
+--- p7zip_4.57/CPP/7zip/Bundles/Un7Zip/Un7Zip.cpp 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.57-new/CPP/7zip/Bundles/Un7Zip/Un7Zip.cpp 2008-04-11 19:33:45.000000000 +0200
+@@ -0,0 +1,148 @@
++// Un7Zip.cpp
++
++#include "StdAfx.h"
++
++#include "Common/MyInitGuid.h"
++
++#include "Common/StdOutStream.h"
++#include "Common/Wildcard.h"
++#include "Common/StringConvert.h"
++#include "Common/MyCom.h"
++#include "Common/MyException.h"
++
++#include "Windows/FileDir.h"
++#include "Windows/FileName.h"
++#include "Windows/Defs.h"
++
++#include "../../IPassword.h"
++#include "../../ICoder.h"
++
++#include "../../UI/Common/OpenArchive.h"
++#include "../../UI/Common/DefaultName.h"
++#include "../../UI/Common/ExitCode.h"
++#include "../../UI/Common/Extract.h"
++
++#include "../../UI/Console/List.h"
++#include "../../UI/Console/OpenCallbackConsole.h"
++#include "../../UI/Console/ExtractCallbackNULL.h"
++
++
++static int Un7Zip(char *name, char *dir, int command);
++
++extern "C" {
++
++int un7zip(char *name, char *dir, int command)
++{
++ return Un7Zip(name, dir, command);
++}
++
++}
++
++using namespace NWindows;
++using namespace NFile;
++
++static const wchar_t *kUniversalWildcard = L"*";
++static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor)
++{
++ wildcardCensor.AddItem(true, kUniversalWildcard, false);
++ return true;
++}
++
++static int Un7Zip(char *name, char *dir, int commands)
++{
++
++ CStdOutStream *g_StdStream = &g_StdOut;
++
++ NWildcard::CCensor wildcardCensor;
++ AddNameToCensor(wildcardCensor);
++ bool passwordEnabled = 1;
++ UString password = L"null";
++
++ UString outputDir= MultiByteToUnicodeString(dir);
++ UString archiveName = MultiByteToUnicodeString(name);
++
++ NFind::CFileInfoW archiveFileInfo;
++
++ if (!NFind::FindFile(archiveName, archiveFileInfo))
++ return S_FALSE;
++ if (archiveFileInfo.IsDirectory())
++ return S_FALSE;
++
++ {
++
++ UStringVector v1, v2;
++ v1.Add(archiveName);
++ v2.Add(archiveName);
++
++
++ CCodecs *codecs = new CCodecs;
++ CMyComPtr<
++ #ifdef EXTERNAL_CODECS
++ ICompressCodecsInfo
++ #else
++ IUnknown
++ #endif
++ > compressCodecsInfo = codecs;
++ HRESULT result = codecs->Load();
++ if (result != S_OK)
++ throw CSystemException(result);
++
++ const NWildcard::CCensorNode &wildcardCensorHead =
++ wildcardCensor.Pairs.Front().Head;
++
++ if(commands > 0)
++ {
++ CExtractCallbackNULL *ecs = new CExtractCallbackNULL;
++ CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
++ ecs->OutStream = g_StdStream;
++ ecs->PasswordIsDefined = passwordEnabled;
++ ecs->Password = password;
++ ecs->Init();
++
++ COpenCallbackConsole openCallback;
++ openCallback.OutStream = g_StdStream;
++ openCallback.PasswordIsDefined = passwordEnabled;
++ openCallback.Password = password;
++
++ CExtractOptions eo;
++ eo.StdOutMode = false;
++ eo.PathMode = NExtract::NPathMode::kFullPathnames;
++ if(commands == 1)
++ eo.TestMode = 1;
++ else
++ eo.TestMode = 0;
++ eo.OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt;
++ eo.OutputDir = outputDir;
++ eo.YesToAll = 1;
++
++ UString errorMessage;
++ CDecompressStat stat;
++
++ HRESULT result = DecompressArchives(
++ codecs,
++ v1, v2,
++ wildcardCensorHead,
++ eo, &openCallback, ecs, errorMessage, stat);
++
++ if (ecs->NumArchiveErrors != 0 || ecs->NumFileErrors != 0)
++ return S_FALSE;
++ if (result != S_OK)
++ return S_FALSE;
++ }
++ else
++ {
++ UInt64 numErrors = 0;
++ HRESULT result = ListArchives(
++ codecs,
++ v1, v2,
++ wildcardCensorHead,
++ true, false,
++ passwordEnabled,
++ password, numErrors);
++
++ if (result != S_OK)
++ return S_FALSE;;
++ }
++ }
++ return S_OK;
++}
+diff -dPNur p7zip_4.57/CPP/7zip/UI/Console/ExtractCallbackNULL.cpp p7zip_4.57-new/CPP/7zip/UI/Console/ExtractCallbackNULL.cpp
+--- p7zip_4.57/CPP/7zip/UI/Console/ExtractCallbackNULL.cpp 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.57-new/CPP/7zip/UI/Console/ExtractCallbackNULL.cpp 2008-04-11 19:28:29.000000000 +0200
+@@ -0,0 +1,132 @@
++// ExtractCallbackNULL.cpp
++
++#include "StdAfx.h"
++
++#include "ExtractCallbackNULL.h"
++#include "UserInputUtils.h"
++#include "ConsoleClose.h"
++
++#include "Common/Wildcard.h"
++
++#include "Windows/FileDir.h"
++#include "Windows/FileFind.h"
++#include "Windows/Time.h"
++#include "Windows/Defs.h"
++#include "Windows/PropVariant.h"
++#include "Windows/Error.h"
++#include "Windows/PropVariantConversions.h"
++
++#include "../../Common/FilePathAutoRename.h"
++
++#include "../Common/ExtractingFilePath.h"
++
++using namespace NWindows;
++using namespace NFile;
++using namespace NDirectory;
++
++STDMETHODIMP CExtractCallbackNULL::SetTotal(UInt64 size)
++{
++ if (NConsoleClose::TestBreakSignal())
++ return E_ABORT;
++ return S_OK;
++}
++
++STDMETHODIMP CExtractCallbackNULL::SetCompleted(const UInt64 *completeValue)
++{
++ if (NConsoleClose::TestBreakSignal())
++ return E_ABORT;
++ return S_OK;
++}
++
++STDMETHODIMP CExtractCallbackNULL::AskOverwrite(
++ const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
++ const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
++ Int32 *answer)
++{
++
++ NUserAnswerMode::EEnum overwriteAnswer = ScanUserYesNoAllQuit(OutStream);
++
++ switch(overwriteAnswer)
++ {
++ case NUserAnswerMode::kQuit:
++ return E_ABORT;
++ case NUserAnswerMode::kNo:
++ *answer = NOverwriteAnswer::kNo;
++ break;
++ case NUserAnswerMode::kNoAll:
++ *answer = NOverwriteAnswer::kNoToAll;
++ break;
++ case NUserAnswerMode::kYesAll:
++ *answer = NOverwriteAnswer::kYesToAll;
++ break;
++ case NUserAnswerMode::kYes:
++ *answer = NOverwriteAnswer::kYes;
++ break;
++ case NUserAnswerMode::kAutoRename:
++ *answer = NOverwriteAnswer::kAutoRename;
++ break;
++ default:
++ return E_FAIL;
++ }
++ return S_OK;
++}
++
++STDMETHODIMP CExtractCallbackNULL::PrepareOperation(const wchar_t *name, bool /* isFolder */, Int32 askExtractMode, const UInt64 *position)
++{
++ return S_OK;
++}
++
++STDMETHODIMP CExtractCallbackNULL::MessageError(const wchar_t *message)
++{
++ return S_OK;
++}
++
++STDMETHODIMP CExtractCallbackNULL::SetOperationResult(Int32 operationResult, bool encrypted)
++{
++ return S_OK;
++}
++
++STDMETHODIMP CExtractCallbackNULL::CryptoGetTextPassword(BSTR *password)
++{
++ if (!PasswordIsDefined)
++ {
++ Password = GetPassword(OutStream);
++ PasswordIsDefined = true;
++ }
++ CMyComBSTR tempName(Password);
++ *password = tempName.Detach();
++ return S_OK;
++}
++
++HRESULT CExtractCallbackNULL::BeforeOpen(const wchar_t *name)
++{
++ return S_OK;
++}
++
++HRESULT CExtractCallbackNULL::OpenResult(const wchar_t *name, HRESULT result, bool encrypted)
++{
++ return S_OK;
++}
++
++HRESULT CExtractCallbackNULL::ThereAreNoFiles()
++{
++ return S_OK;
++}
++
++HRESULT CExtractCallbackNULL::ExtractResult(HRESULT result)
++{
++ if (result == S_OK)
++ return result;
++ if (result == E_ABORT)
++ return result;
++ if (result == E_OUTOFMEMORY)
++ return result;
++ return S_OK;
++}
++
++HRESULT CExtractCallbackNULL::SetPassword(const UString &password)
++{
++ PasswordIsDefined = true;
++ Password = password;
++ return S_OK;
++}
+diff -dPNur p7zip_4.57/CPP/7zip/UI/Console/ExtractCallbackNULL.h p7zip_4.57-new/CPP/7zip/UI/Console/ExtractCallbackNULL.h
+--- p7zip_4.57/CPP/7zip/UI/Console/ExtractCallbackNULL.h 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.57-new/CPP/7zip/UI/Console/ExtractCallbackNULL.h 2008-04-11 19:28:46.000000000 +0200
+@@ -0,0 +1,65 @@
++// ExtractCallbackNULL.h
++
++#ifndef __EXTRACTCALLBACKCONSOLE_H
++#define __EXTRACTCALLBACKCONSOLE_H
++
++#include "Common/MyString.h"
++#include "Common/StdOutStream.h"
++#include "../../Common/FileStreams.h"
++#include "../../IPassword.h"
++#include "../../Archive/IArchive.h"
++#include "../Common/ArchiveExtractCallback.h"
++
++class CExtractCallbackNULL:
++ public IExtractCallbackUI,
++ public ICryptoGetTextPassword,
++ public CMyUnknownImp
++{
++public:
++ MY_UNKNOWN_IMP2(IFolderArchiveExtractCallback, ICryptoGetTextPassword)
++
++ STDMETHOD(SetTotal)(UInt64 total);
++ STDMETHOD(SetCompleted)(const UInt64 *completeValue);
++
++ // IFolderArchiveExtractCallback
++ STDMETHOD(AskOverwrite)(
++ const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
++ const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
++ Int32 *answer);
++ STDMETHOD (PrepareOperation)(const wchar_t *name, bool isFolder, Int32 askExtractMode, const UInt64 *position);
++
++ STDMETHOD(MessageError)(const wchar_t *message);
++ STDMETHOD(SetOperationResult)(Int32 operationResult, bool encrypted);
++
++ // ICryptoGetTextPassword
++ STDMETHOD(CryptoGetTextPassword)(BSTR *password);
++
++ HRESULT BeforeOpen(const wchar_t *name);
++ HRESULT OpenResult(const wchar_t *name, HRESULT result, bool encrypted);
++ HRESULT ThereAreNoFiles();
++ HRESULT ExtractResult(HRESULT result);
++
++ HRESULT SetPassword(const UString &password);
++
++public:
++ bool PasswordIsDefined;
++ UString Password;
++
++ UInt64 NumArchives;
++ UInt64 NumArchiveErrors;
++ UInt64 NumFileErrors;
++ UInt64 NumFileErrorsInCurrentArchive;
++
++ CStdOutStream *OutStream;
++
++ void Init()
++ {
++ NumArchives = 0;
++ NumArchiveErrors = 0;
++ NumFileErrors = 0;
++ NumFileErrorsInCurrentArchive = 0;
++ }
++
++};
++
++#endif