4.45 beta

This commit is contained in:
Igor Pavlov
2007-04-17 00:00:00 +00:00
committed by Kornel Lesiński
parent d9666cf046
commit a145bfc7cf
458 changed files with 13144 additions and 18608 deletions

View File

@@ -44,7 +44,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BREAK_HANDLER" /D "BENCH_MT" /D "_7ZIP_LARGE_PAGES" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BREAK_HANDLER" /D "BENCH_MT" /D "_7ZIP_LARGE_PAGES" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -94,7 +94,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BREAK_HANDLER" /D "BENCH_MT" /D "_7ZIP_LARGE_PAGES" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -120,7 +120,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "../../../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BREAK_HANDLER" /D "BENCH_MT" /D "_7ZIP_LARGE_PAGES" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -316,14 +316,6 @@ SOURCE=..\..\..\Windows\Time.h
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\Common\Alloc.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Alloc.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Buffer.h
# End Source File
# Begin Source File
@@ -340,6 +332,10 @@ SOURCE=..\..\..\Common\ComTry.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\CRC.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Defs.h
# End Source File
# Begin Source File
@@ -468,14 +464,6 @@ SOURCE=..\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
SOURCE=..\Common\ArchiverInfo.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\ArchiverInfo.h
# End Source File
# Begin Source File
SOURCE=..\Common\CompressionMode.h
# End Source File
# Begin Source File
@@ -528,6 +516,14 @@ SOURCE=..\Common\IFileExtractCallback.h
# End Source File
# Begin Source File
SOURCE=..\Common\LoadCodecs.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\LoadCodecs.h
# End Source File
# Begin Source File
SOURCE=..\Common\OpenArchive.cpp
# End Source File
# Begin Source File
@@ -644,6 +640,10 @@ SOURCE=..\..\Common\FileStreams.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\RegisterArc.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\StreamUtils.cpp
# End Source File
# Begin Source File
@@ -654,6 +654,26 @@ SOURCE=..\..\Common\StreamUtils.h
# Begin Group "Compress"
# PROP Default_Filter ""
# Begin Group "LzmaBench"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.h
# End Source File
# Begin Source File
SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.h
# End Source File
# End Group
# Begin Source File
SOURCE=..\..\Compress\Copy\CopyCoder.cpp
@@ -663,5 +683,27 @@ SOURCE=..\..\Compress\Copy\CopyCoder.cpp
SOURCE=..\..\Compress\Copy\CopyCoder.h
# End Source File
# End Group
# Begin Group "C"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\..\C\7zCrc.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\7zCrc.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Alloc.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Alloc.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -28,9 +28,9 @@ static const char *kTestingString = "Testing ";
static const char *kExtractingString = "Extracting ";
static const char *kSkippingString = "Skipping ";
static const char *kCantAutoRename = "can not create file with auto name\n";
static const char *kCantRenameFile = "can not rename existing file\n";
static const char *kCantDeleteOutputFile = "can not delete output file ";
// static const char *kCantAutoRename = "can not create file with auto name\n";
// static const char *kCantRenameFile = "can not rename existing file\n";
// static const char *kCantDeleteOutputFile = "can not delete output file ";
static const char *kError = "ERROR: ";
static const char *kMemoryExceptionMessage = "Can't allocate required memory!";

View File

@@ -392,7 +392,9 @@ bool GetUInt64Value(IInArchive *archive, UInt32 index, PROPID propID, UInt64 &va
return true;
}
HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFull,
HRESULT ListArchives(
CCodecs *codecs,
UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
bool enableHeaders, bool techMode, bool &passwordEnabled, UString &password)
{
@@ -427,7 +429,7 @@ HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFul
openCallback.PasswordIsDefined = passwordEnabled;
openCallback.Password = password;
HRESULT result = MyOpenArchive(archiveName, archiveLink, &openCallback);
HRESULT result = MyOpenArchive(codecs, archiveName, archiveLink, &openCallback);
if (result != S_OK)
{
g_StdOut << endl << "Error: " << archiveName << " is not supported archive" << endl;

View File

@@ -4,8 +4,11 @@
#define __LIST_H
#include "Common/Wildcard.h"
#include "../Common/LoadCodecs.h"
HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFull,
HRESULT ListArchives(
CCodecs *codecs,
UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
bool enableHeaders, bool techMode, bool &passwordEnabled, UString &password);

View File

@@ -5,32 +5,37 @@
#include <io.h>
#include "Common/MyInitGuid.h"
#include "Common/CommandLineParser.h"
#include "Common/StdOutStream.h"
#include "Common/Wildcard.h"
#include "Common/ListFileUtils.h"
#include "Common/StringConvert.h"
#include "Common/StdInStream.h"
#include "Common/StringToInt.h"
#include "Common/Exception.h"
#include "Common/IntToString.h"
#include "Common/ListFileUtils.h"
#include "Common/StdInStream.h"
#include "Common/StdOutStream.h"
#include "Common/StringConvert.h"
#include "Common/StringToInt.h"
#include "Common/Wildcard.h"
#include "Windows/FileDir.h"
#include "Windows/FileName.h"
#include "Windows/Defs.h"
#include "Windows/Error.h"
// #include "Windows/System.h"
#ifdef _WIN32
#include "Windows/MemoryLock.h"
#endif
#include "../../IPassword.h"
#include "../../ICoder.h"
#include "../Common/ArchiverInfo.h"
#include "../Common/UpdateAction.h"
#include "../Common/Update.h"
#include "../Common/Extract.h"
#include "../Common/ArchiveCommandLine.h"
#include "../Common/ExitCode.h"
#ifdef EXTERNAL_CODECS
#include "../Common/LoadCodecs.h"
#endif
#include "../../Compress/LZMA_Alone/LzmaBenchCon.h"
#include "List.h"
#include "OpenCallbackConsole.h"
@@ -39,8 +44,11 @@
#include "../../MyVersion.h"
#ifndef EXCLUDE_COM
#include "Windows/DLL.h"
#if defined( _WIN32) && defined( _7ZIP_LARGE_PAGES)
extern "C"
{
#include "../../../../C/Alloc.h"
}
#endif
using namespace NWindows;
@@ -51,12 +59,12 @@ HINSTANCE g_hInstance = 0;
extern CStdOutStream *g_StdStream;
static const char *kCopyrightString = "\n7-Zip"
#ifdef EXCLUDE_COM
#ifndef EXTERNAL_CODECS
" (A)"
#endif
#ifdef UNICODE
" [NT]"
#ifdef _WIN64
" [64]"
#endif
" " MY_VERSION_COPYRIGHT_DATE "\n";
@@ -65,14 +73,17 @@ static const char *kHelpString =
"\nUsage: 7z"
#ifdef _NO_CRYPTO
"r"
#elif EXCLUDE_COM
#else
#ifndef EXTERNAL_CODECS
"a"
#endif
#endif
" <command> [<switches>...] <archive_name> [<file_names>...]\n"
" [<@listfiles...>]\n"
"\n"
"<Commands>\n"
" a: Add files to archive\n"
" b: Benchmark\n"
" d: Delete files from archive\n"
" e: Extract files from archive (without using directory names)\n"
" l: List contents of archive\n"
@@ -151,6 +162,29 @@ static void ShowCopyrightAndHelp(CStdOutStream &s, bool needHelp)
s << kHelpString;
}
#ifdef EXTERNAL_CODECS
static void PrintString(CStdOutStream &stdStream, const AString &s, int size)
{
int len = s.Length();
stdStream << s;
for (int i = len; i < size; i++)
stdStream << ' ';
}
#endif
static void PrintString(CStdOutStream &stdStream, const UString &s, int size)
{
int len = s.Length();
stdStream << s;
for (int i = len; i < size; i++)
stdStream << ' ';
}
static inline char GetHex(Byte value)
{
return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
}
int Main2(
#ifndef _WIN32
int numArguments, const char *arguments[]
@@ -187,9 +221,12 @@ int Main2(
return 0;
}
#ifdef _WIN32
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
if (options.LargePages)
{
SetLargePageSize();
NSecurity::EnableLockMemoryPrivilege();
}
#endif
CStdOutStream &stdStream = options.StdOutMode ? g_StdErr : g_StdOut;
@@ -200,9 +237,145 @@ int Main2(
parser.Parse2(options);
CCodecs *codecs = new CCodecs;
CMyComPtr<
#ifdef EXTERNAL_CODECS
ICompressCodecsInfo
#else
IUnknown
#endif
> compressCodecsInfo = codecs;
HRESULT result = codecs->Load();
if (result != S_OK)
throw CSystemException(result);
bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
if(isExtractGroupCommand ||
options.Command.CommandType == NCommandType::kList)
if (options.Command.CommandType == NCommandType::kInfo)
{
stdStream << endl << "Formats:" << endl;
int i;
for (i = 0; i < codecs->Formats.Size(); i++)
{
const CArcInfoEx &arc = codecs->Formats[i];
#ifdef EXTERNAL_CODECS
if (arc.LibIndex >= 0)
{
char s[32];
ConvertUInt64ToString(arc.LibIndex, s);
PrintString(stdStream, s, 2);
}
else
#endif
stdStream << " ";
stdStream << ' ';
stdStream << (char)(arc.UpdateEnabled ? 'C' : ' ');
stdStream << (char)(arc.KeepName ? 'K' : ' ');
stdStream << " ";
PrintString(stdStream, arc.Name, 6);
stdStream << " ";
UString s;
for (int t = 0; t < arc.Exts.Size(); t++)
{
const CArcExtInfo &ext = arc.Exts[t];
s += ext.Ext;
if (!ext.AddExt.IsEmpty())
{
s += L" (";
s += ext.AddExt;
s += L')';
}
s += L' ';
}
PrintString(stdStream, s, 14);
stdStream << " ";
const CByteBuffer &sig = arc.StartSignature;
for (size_t j = 0; j < sig.GetCapacity(); j++)
{
Byte b = sig[j];
if (b > 0x20 && b < 0x80)
{
stdStream << (char)b;
}
else
{
stdStream << GetHex((Byte)((b >> 4) & 0xF));
stdStream << GetHex((Byte)(b & 0xF));
}
stdStream << ' ';
}
stdStream << endl;
}
stdStream << endl << "Codecs:" << endl;
#ifdef EXTERNAL_CODECS
UINT32 numMethods;
if (codecs->GetNumberOfMethods(&numMethods) == S_OK)
for (UInt32 j = 0; j < numMethods; j++)
{
int libIndex = codecs->GetCodecLibIndex(j);
if (libIndex >= 0)
{
char s[32];
ConvertUInt64ToString(libIndex, s);
PrintString(stdStream, s, 2);
}
else
stdStream << " ";
stdStream << ' ';
stdStream << (char)(codecs->GetCodecEncoderIsAssigned(j) ? 'C' : ' ');
UInt64 id;
stdStream << " ";
HRESULT res = codecs->GetCodecId(j, id);
if (res != S_OK)
id = (UInt64)(Int64)-1;
char s[32];
ConvertUInt64ToString(id, s, 16);
PrintString(stdStream, s, 8);
stdStream << " ";
PrintString(stdStream, codecs->GetCodecName(j), 11);
stdStream << endl;
/*
if (res != S_OK)
throw "incorrect Codec ID";
*/
}
#endif
return S_OK;
}
else if (options.Command.CommandType == NCommandType::kBenchmark)
{
if (options.Method.CompareNoCase(L"CRC") == 0)
{
HRESULT res = CrcBenchCon((FILE *)stdStream, options.NumIterations, options.NumThreads, options.DictionarySize);
if (res != S_OK)
{
if (res == S_FALSE)
{
stdStream << "\nCRC Error\n";
return NExitCode::kFatalError;
}
throw CSystemException(res);
}
}
else
{
HRESULT res = LzmaBenchCon(
#ifdef EXTERNAL_LZMA
codecs,
#endif
(FILE *)stdStream, options.NumIterations, options.NumThreads, options.DictionarySize);
if (res != S_OK)
{
if (res == S_FALSE)
{
stdStream << "\nDecoding Error\n";
return NExitCode::kFatalError;
}
throw CSystemException(res);
}
}
}
else if (isExtractGroupCommand || options.Command.CommandType == NCommandType::kList)
{
if(isExtractGroupCommand)
{
@@ -231,6 +404,7 @@ int Main2(
#endif
UString errorMessage;
HRESULT result = DecompressArchives(
codecs,
options.ArchivePathsSorted,
options.ArchivePathsFullSorted,
options.WildcardCensor.Pairs.Front().Head,
@@ -266,6 +440,7 @@ int Main2(
else
{
HRESULT result = ListArchives(
codecs,
options.ArchivePathsSorted,
options.ArchivePathsFullSorted,
options.WildcardCensor.Pairs.Front().Head,
@@ -303,7 +478,10 @@ int Main2(
CUpdateErrorInfo errorInfo;
HRESULT result = UpdateArchive(options.WildcardCensor, uo,
if (!uo.Init(codecs, options.ArchiveName, options.ArcType))
throw "Unsupported archive type";
HRESULT result = UpdateArchive(codecs,
options.WildcardCensor, uo,
errorInfo, &openCallback, &callback);
int exitCode = NExitCode::kSuccess;

View File

@@ -10,21 +10,11 @@
#include "Common/NewHandler.h"
#include "Common/Exception.h"
#include "Common/StringConvert.h"
#ifdef _WIN32
#include "Common/Alloc.h"
#endif
#include "../Common/ExitCode.h"
#include "../Common/ArchiveCommandLine.h"
#include "ConsoleClose.h"
#ifdef CRC_GENERATE_TABLE
extern "C"
{
#include "../../../../C/7zCrc.h"
}
#endif
using namespace NWindows;
CStdOutStream *g_StdStream = 0;
@@ -66,9 +56,6 @@ int numArguments, const char *arguments[]
#endif
)
{
#ifdef CRC_GENERATE_TABLE
CrcGenerateTable();
#endif
g_StdStream = &g_StdOut;
#ifdef _UNICODE
if (!IsItWindowsNT())
@@ -80,10 +67,6 @@ int numArguments, const char *arguments[]
g_IsNT = IsItWindowsNT();
#endif
#ifdef _WIN32
SetLargePageSize();
#endif
// setlocale(LC_COLLATE, ".OCP");
NConsoleClose::CCtrlHandlerSetter ctrlHandlerSetter;
int res = 0;

View File

@@ -75,7 +75,7 @@ void CPercentPrinter::RePrintRatio()
m_NumExtraChars = extraSize;
for (; size < m_NumExtraChars; size++)
*p++ = ' ';
strcpy(p, s);
MyStringCopy(p, s);
(*OutStream) << fullString;
OutStream->Flush();
m_PrevValue = m_CurValue;

View File

@@ -1,6 +1,13 @@
PROG = 7z.exe
LIBS = $(LIBS) user32.lib oleaut32.lib advapi32.lib
CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MT -DWIN_LONG_PATH
CFLAGS = $(CFLAGS) -I ../../../ \
-DCOMPRESS_MT \
-DWIN_LONG_PATH \
-DEXTERNAL_LZMA \
-DEXTERNAL_CODECS \
-DBREAK_HANDLER \
-DBENCH_MT \
-D_7ZIP_LARGE_PAGES \
CONSOLE_OBJS = \
$O\ConsoleClose.obj \
@@ -14,8 +21,8 @@ CONSOLE_OBJS = \
$O\UserInputUtils.obj \
COMMON_OBJS = \
$O\Alloc.obj \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\IntToString.obj \
$O\ListFileUtils.obj \
$O\NewHandler.obj \
@@ -49,11 +56,11 @@ UI_COMMON_OBJS = \
$O\ArchiveCommandLine.obj \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
$O\ArchiverInfo.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
$O\LoadCodecs.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
$O\SetProperties.obj \
@@ -66,6 +73,14 @@ UI_COMMON_OBJS = \
$O\UpdateProduce.obj \
$O\WorkDir.obj \
LZMA_BENCH_OBJS = \
$O\LzmaBench.obj \
$O\LzmaBenchCon.obj \
C_OBJS = \
$O\Alloc.obj \
!include "../../Crc2.mak"
OBJS = \
$O\StdAfx.obj \
@@ -75,6 +90,9 @@ OBJS = \
$(7ZIP_COMMON_OBJS) \
$(UI_COMMON_OBJS) \
$O\CopyCoder.obj \
$(LZMA_BENCH_OBJS) \
$(C_OBJS) \
$(CRC_OBJS) \
$O\resource.res
!include "../../../Build.mak"
@@ -91,3 +109,8 @@ $(UI_COMMON_OBJS): ../Common/$(*B).cpp
$(COMPL)
$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
$(COMPL)
$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp
$(COMPL)
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Crc.mak"