This commit is contained in:
Igor Pavlov
2014-11-23 00:00:00 +00:00
committed by Kornel Lesiński
parent 83f8ddcc5b
commit f08f4dcc3c
1158 changed files with 76451 additions and 35082 deletions

0
CPP/7zip/Bundles/SFXCon/7z.ico Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

42
CPP/7zip/Bundles/SFXCon/SFXCon.dsp Executable file → Normal file
View File

@@ -42,7 +42,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 "WIN32" /D "_CONSOLE" /D "_MBCS" /D "EXTRACT_ONLY" /D "_SFX" /D "NO_READ_FROM_CODER" /Yu"StdAfx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "EXTRACT_ONLY" /D "_SFX" /D "NO_READ_FROM_CODER" /Yu"StdAfx.h" /FD /c
# ADD BASE RSC /l 0x419 /d "NDEBUG"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
@@ -50,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"C:\Util\7zCon.sfx" /opt:NOWIN98
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"C:\Util\7zCon.exe" /opt:NOWIN98
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "SFXCon - Win32 Debug"
@@ -67,7 +67,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 /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\\" /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "EXTRACT_ONLY" /D "_SFX" /D "NO_READ_FROM_CODER" /Yu"StdAfx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /MTd /W4 /WX /Gm /GX /ZI /Od /I "..\..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "EXTRACT_ONLY" /D "_SFX" /D "NO_READ_FROM_CODER" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE RSC /l 0x419 /d "_DEBUG"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
@@ -75,7 +75,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"C:\Util\7zCon.sfx" /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"C:\Util\7zCon.exe" /pdbtype:sept
!ENDIF
@@ -141,6 +141,14 @@ SOURCE=..\..\Archive\Common\ItemNameUtils.h
# End Source File
# Begin Source File
SOURCE=..\..\Archive\Common\MultiStream.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Archive\Common\MultiStream.h
# End Source File
# Begin Source File
SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp
# End Source File
# Begin Source File
@@ -229,10 +237,6 @@ SOURCE=..\..\Archive\7z\7zHandler.h
# End Source File
# Begin Source File
SOURCE=..\..\Archive\7z\7zHeader.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Archive\7z\7zHeader.h
# End Source File
# Begin Source File
@@ -251,6 +255,10 @@ SOURCE=..\..\Archive\7z\7zItem.h
SOURCE=..\..\Archive\7z\7zRegister.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Archive\SplitHandler.cpp
# End Source File
# End Group
# Begin Group "Compress"
@@ -345,11 +353,11 @@ SOURCE=..\..\..\Windows\DLL.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Error.cpp
SOURCE=..\..\..\Windows\ErrorMsg.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Error.h
SOURCE=..\..\..\Windows\ErrorMsg.h
# End Source File
# Begin Source File
@@ -393,11 +401,11 @@ SOURCE=..\..\..\Windows\PropVariant.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\PropVariantConversions.cpp
SOURCE=..\..\..\Windows\PropVariantConv.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\PropVariantConversions.h
SOURCE=..\..\..\Windows\PropVariantConv.h
# End Source File
# Begin Source File
@@ -593,6 +601,10 @@ SOURCE=..\..\Common\ProgressUtils.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\PropId.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\StreamBinder.cpp
# End Source File
# Begin Source File
@@ -815,7 +827,11 @@ SOURCE=.\7z.ico
# End Source File
# Begin Source File
SOURCE=.\Main.cpp
SOURCE=..\..\Archive\IArchive.h
# End Source File
# Begin Source File
SOURCE=.\SfxCon.cpp
# End Source File
# End Target
# End Project

0
CPP/7zip/Bundles/SFXCon/SFXCon.dsw Executable file → Normal file
View File

View File

@@ -2,16 +2,16 @@
#include "StdAfx.h"
#include "Common/MyInitGuid.h"
#include "../../../Common/MyInitGuid.h"
#include "Common/CommandLineParser.h"
#include "Common/MyException.h"
#include "../../../Common/CommandLineParser.h"
#include "../../../Common/MyException.h"
#ifdef _WIN32
#include "Windows/DLL.h"
#include "Windows/FileDir.h"
#include "../../../Windows/DLL.h"
#include "../../../Windows/FileDir.h"
#endif
#include "Windows/FileName.h"
#include "../../../Windows/FileName.h"
#include "../../UI/Common/ExitCode.h"
#include "../../UI/Common/Extract.h"
@@ -24,6 +24,7 @@
using namespace NWindows;
using namespace NFile;
using namespace NDir;
using namespace NCommandLineParser;
#ifdef _WIN32
@@ -54,7 +55,7 @@ namespace NRecursedType {
enum EEnum
{
kRecursed,
kWildCardOnlyRecursed,
kWildcardOnlyRecursed,
kNonRecursed
};
}
@@ -65,7 +66,7 @@ static const wchar_t *kRecursedPostCharSet = L"0-";
namespace NRecursedPostCharIndex {
enum EEnum
{
kWildCardRecursionOnly = 0,
kWildcardRecursionOnly = 0,
kNoRecursion = 1
};
}
@@ -77,36 +78,17 @@ static const char kSomeCludePostStringMinSize = 2; // at least <@|!><N>ame must
static const char kSomeCludeAfterRecursedPostStringMinSize = 2; // at least <@|!><N>ame must be
*/
static const CSwitchForm kSwitchForms[kNumSwitches] =
{
{ L"?", NSwitchType::kSimple, false },
{ L"H", NSwitchType::kSimple, false },
{ L"BD", NSwitchType::kSimple, false },
{ L"Y", NSwitchType::kSimple, false },
{ L"P", NSwitchType::kUnLimitedPostString, false, 1 },
{ L"O", NSwitchType::kUnLimitedPostString, false, 1 },
};
{
{ "?", NSwitchType::kSimple },
{ "H", NSwitchType::kSimple },
{ "BD", NSwitchType::kSimple },
{ "Y", NSwitchType::kSimple },
{ "P", NSwitchType::kString, false, 1 },
{ "O", NSwitchType::kString, false, 1 },
};
static const int kNumCommandForms = 3;
namespace NCommandType {
enum EEnum
{
kTest = 0,
// kExtract,
kFullExtract,
kList
};
}
static const CCommandForm commandForms[kNumCommandForms] =
{
{ L"T", false },
// { "E", false },
{ L"X", false },
{ L"L", false }
};
static const NRecursedType::EEnum kCommandRecursedDefault[kNumCommandForms] =
{
NRecursedType::kRecursed
@@ -137,7 +119,7 @@ static const char *kHelpString =
static const char *kUserErrorMessage = "Incorrect command line"; // NExitCode::kUserError
// static const char *kIncorrectListFile = "Incorrect wildcard in listfile";
static const char *kIncorrectWildCardInCommandLine = "Incorrect wildcard in command line";
static const char *kIncorrectWildcardInCommandLine = "Incorrect wildcard in command line";
// static const CSysString kFileIsNotArchiveMessageBefore = "File \"";
// static const CSysString kFileIsNotArchiveMessageAfter = "\" is not archive";
@@ -146,13 +128,40 @@ static const char *kIncorrectWildCardInCommandLine = "Incorrect wildcard in com
static const char *kCantFindSFX = " cannot find sfx";
namespace NCommandType
{
enum EEnum
{
kTest = 0,
kFullExtract,
kList
};
}
static const char *g_Commands = "txl";
struct CArchiveCommand
{
NCommandType::EEnum CommandType;
NRecursedType::EEnum DefaultRecursedType() const;
};
bool ParseArchiveCommand(const UString &commandString, CArchiveCommand &command)
{
UString s = commandString;
s.MakeLower_Ascii();
if (s.Len() != 1)
return false;
if (s[0] >= 0x80)
return false;
int index = FindCharPosInString(g_Commands, (char)s[0]);
if (index < 0)
return false;
command.CommandType = (NCommandType::EEnum)index;
return true;
}
NRecursedType::EEnum CArchiveCommand::DefaultRecursedType() const
{
return kCommandRecursedDefault[CommandType];
@@ -175,19 +184,6 @@ static void PrintHelpAndExit() // yyy
ShowMessageAndThrowException(kUserErrorMessage, NExitCode::kUserError);
}
bool ParseArchiveCommand(const UString &commandString, CArchiveCommand &command)
{
UString commandStringUpper = commandString;
commandStringUpper.MakeUpper();
UString postString;
int commandIndex = ParseCommand(kNumCommandForms, commandForms, commandStringUpper,
postString) ;
if (commandIndex < 0)
return false;
command.CommandType = (NCommandType::EEnum)commandIndex;
return true;
}
// ------------------------------------------------------------------
// filenames functions
@@ -195,16 +191,16 @@ static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
const UString &name, bool include, NRecursedType::EEnum type)
{
/*
if (!IsWildCardFilePathLegal(name))
if (!IsWildcardFilePathLegal(name))
return false;
*/
bool isWildCard = DoesNameContainWildCard(name);
bool isWildcard = DoesNameContainWildcard(name);
bool recursed = false;
switch (type)
{
case NRecursedType::kWildCardOnlyRecursed:
recursed = isWildCard;
case NRecursedType::kWildcardOnlyRecursed:
recursed = isWildcard;
break;
case NRecursedType::kRecursed:
recursed = true;
@@ -213,22 +209,22 @@ static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
recursed = false;
break;
}
wildcardCensor.AddItem(include, name, recursed);
wildcardCensor.AddPreItem(include, name, recursed, true);
return true;
}
void AddCommandLineWildCardToCensor(NWildcard::CCensor &wildcardCensor,
void AddCommandLineWildcardToCensor(NWildcard::CCensor &wildcardCensor,
const UString &name, bool include, NRecursedType::EEnum type)
{
if (!AddNameToCensor(wildcardCensor, name, include, type))
ShowMessageAndThrowException(kIncorrectWildCardInCommandLine, NExitCode::kUserError);
ShowMessageAndThrowException(kIncorrectWildcardInCommandLine, NExitCode::kUserError);
}
void AddToCensorFromNonSwitchesStrings(NWildcard::CCensor &wildcardCensor,
const UStringVector & /* nonSwitchStrings */, NRecursedType::EEnum type,
bool /* thereAreSwitchIncludeWildCards */)
bool /* thereAreSwitchIncludeWildcards */)
{
AddCommandLineWildCardToCensor(wildcardCensor, kUniversalWildcard, true, type);
AddCommandLineWildcardToCensor(wildcardCensor, kUniversalWildcard, true, type);
}
@@ -269,7 +265,7 @@ int Main2(
{
FString path;
NDLL::MyGetModuleFileName(path);
if (!NDirectory::MyGetFullPathName(path, arcPath))
if (!MyGetFullPathName(path, arcPath))
{
g_StdOut << "GetFullPathName Error";
return NExitCode::kFatalError;
@@ -320,10 +316,11 @@ int Main2(
NWildcard::CCensor wildcardCensor;
bool thereAreSwitchIncludeWildCards;
thereAreSwitchIncludeWildCards = false;
bool thereAreSwitchIncludeWildcards;
thereAreSwitchIncludeWildcards = false;
AddToCensorFromNonSwitchesStrings(wildcardCensor, nonSwitchStrings, recursedType,
thereAreSwitchIncludeWildCards);
thereAreSwitchIncludeWildcards);
bool yesToAll = parser[NKey::kYes].ThereIs;
@@ -346,6 +343,9 @@ int Main2(
NName::NormalizeDirPathPrefix(outputDir);
}
wildcardCensor.AddPathsToCensor(NWildcard::k_RelatPath);
{
UStringVector v1, v2;
v1.Add(fs2us(arcPath));
@@ -388,21 +388,23 @@ int Main2(
CExtractOptions eo;
eo.StdOutMode = false;
eo.PathMode = NExtract::NPathMode::kFullPathnames;
eo.TestMode = command.CommandType == NCommandType::kTest;
eo.OverwriteMode = yesToAll ?
NExtract::NOverwriteMode::kWithoutPrompt :
NExtract::NOverwriteMode::kAskBefore;
eo.OutputDir = outputDir;
eo.YesToAll = yesToAll;
eo.TestMode = command.CommandType == NCommandType::kTest;
eo.PathMode = NExtract::NPathMode::kFullPaths;
eo.OverwriteMode = yesToAll ?
NExtract::NOverwriteMode::kOverwrite :
NExtract::NOverwriteMode::kAsk;
eo.OutputDir = outputDir;
UString errorMessage;
CDecompressStat stat;
HRESULT result = DecompressArchives(
codecs, CIntVector(),
HRESULT result = Extract(
codecs, CObjectVector<COpenType>(), CIntVector(),
v1, v2,
wildcardCensorHead,
eo, &openCallback, ecs, errorMessage, stat);
eo, &openCallback, ecs,
// NULL, // hash
errorMessage, stat);
if (!errorMessage.IsEmpty())
{
(*g_StdStream) << endl << "Error: " << errorMessage;;
@@ -410,10 +412,10 @@ int Main2(
result = E_FAIL;
}
if (ecs->NumArchiveErrors != 0 || ecs->NumFileErrors != 0)
if (ecs->NumArcsWithError != 0 || ecs->NumFileErrors != 0)
{
if (ecs->NumArchiveErrors != 0)
(*g_StdStream) << endl << "Archive Errors: " << ecs->NumArchiveErrors << endl;
if (ecs->NumArcsWithError != 0)
(*g_StdStream) << endl << "Archive Errors" << endl;
if (ecs->NumFileErrors != 0)
(*g_StdStream) << endl << "Sub items Errors: " << ecs->NumFileErrors << endl;
return NExitCode::kFatalError;
@@ -424,16 +426,20 @@ int Main2(
else
{
UInt64 numErrors = 0;
UInt64 numWarnings = 0;
HRESULT result = ListArchives(
codecs, CIntVector(),
false,
codecs, CObjectVector<COpenType>(), CIntVector(),
false, // stdInMode
v1, v2,
true, // processAltStreams
false, // showAltStreams
wildcardCensorHead,
true, false,
true, // enableHeaders
false, // techMode
#ifndef _NO_CRYPTO
passwordEnabled, password,
#endif
numErrors);
numErrors, numWarnings);
if (numErrors > 0)
{
g_StdOut << endl << "Errors: " << numErrors;

0
CPP/7zip/Bundles/SFXCon/StdAfx.cpp Executable file → Normal file
View File

3
CPP/7zip/Bundles/SFXCon/StdAfx.h Executable file → Normal file
View File

@@ -3,7 +3,6 @@
#ifndef __STDAFX_H
#define __STDAFX_H
#include "../../../Common/MyWindows.h"
#include "../../../Common/NewHandler.h"
#include "../../../Common/Common.h"
#endif

66
CPP/7zip/Bundles/SFXCon/makefile Executable file → Normal file
View File

@@ -1,12 +1,12 @@
PROG = 7zCon.sfx
MY_CONSOLE = 1
CFLAGS = $(CFLAGS) -I ../../../ \
CFLAGS = $(CFLAGS) \
-DEXTRACT_ONLY \
-DNO_READ_FROM_CODER \
-D_SFX \
SFX_CONSOLE_OBJS = \
$O\Main.obj \
CURRENT_OBJS = \
$O\SfxCon.obj \
CONSOLE_OBJS = \
$O\ConsoleClose.obj \
@@ -20,24 +20,24 @@ COMMON_OBJS = \
$O\CommandLineParser.obj \
$O\CRC.obj \
$O\IntToString.obj \
$O\MyString.obj \
$O\MyVector.obj \
$O\NewHandler.obj \
$O\StdInStream.obj \
$O\StdOutStream.obj \
$O\MyString.obj \
$O\StringConvert.obj \
$O\MyVector.obj \
$O\Wildcard.obj \
$O\UTFConvert.obj \
WIN_OBJS = \
$O\DLL.obj \
$O\Error.obj \
$O\ErrorMsg.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileName.obj \
$O\PropVariant.obj \
$O\PropVariantConversions.obj \
$O\PropVariantConv.obj \
$O\Synchronization.obj \
7ZIP_COMMON_OBJS = \
@@ -51,6 +51,7 @@ WIN_OBJS = \
$O\LockedStream.obj \
$O\OutBuffer.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
$O\StreamBinder.obj \
$O\StreamObjects.obj \
$O\StreamUtils.obj \
@@ -66,11 +67,15 @@ UI_COMMON_OBJS = \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
AR_OBJS = \
$O\SplitHandler.obj \
AR_COMMON_OBJS = \
$O\CoderMixer2.obj \
$O\CoderMixer2MT.obj \
$O\CrossThreadProgress.obj \
$O\ItemNameUtils.obj \
$O\MultiStream.obj \
$O\OutStreamWithCRC.obj \
@@ -79,7 +84,6 @@ AR_COMMON_OBJS = \
$O\7zExtract.obj \
$O\7zFolderOutStream.obj \
$O\7zHandler.obj \
$O\7zHeader.obj \
$O\7zIn.obj \
$O\7zRegister.obj \
@@ -117,48 +121,4 @@ C_OBJS = \
!include "../../Aes.mak"
!include "../../Crc.mak"
OBJS = \
$O\StdAfx.obj \
$(SFX_CONSOLE_OBJS) \
$(CONSOLE_OBJS) \
$(COMMON_OBJS) \
$(WIN_OBJS) \
$(7ZIP_COMMON_OBJS) \
$(UI_COMMON_OBJS) \
$(AR_COMMON_OBJS) \
$(7Z_OBJS) \
$(COMPRESS_OBJS) \
$(CRYPTO_OBJS) \
$(C_OBJS) \
$(ASM_OBJS) \
$O\resource.res
!include "../../../Build.mak"
$(SFX_CONSOLE_OBJS): $(*B).cpp
$(COMPL)
$(CONSOLE_OBJS): ../../UI/Console/$(*B).cpp
$(COMPL)
$(COMMON_OBJS): ../../../Common/$(*B).cpp
$(COMPL)
$(WIN_OBJS): ../../../Windows/$(*B).cpp
$(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
$(UI_COMMON_OBJS): ../../UI/Common/$(*B).cpp
$(COMPL)
$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp
$(COMPL)
$(7Z_OBJS): ../../Archive/7z/$(*B).cpp
$(COMPL)
$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
$(COMPL)
$(CRYPTO_OBJS): ../../Crypto/$(*B).cpp
$(COMPL)
$(C_OBJS): ../../../../C/$(*B).c
$(COMPL_O2)
!include "../../Asm.mak"
!include "../../7zip.mak"

0
CPP/7zip/Bundles/SFXCon/resource.rc Executable file → Normal file
View File