mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 14:07:00 -06:00
9.06 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
829409452d
commit
c99f3ebdd6
@@ -284,6 +284,10 @@ SOURCE=..\..\..\Windows\MemoryLock.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\NtCheck.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\PropVariant.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -9,6 +9,7 @@ static const int kBreakAbortThreshold = 2;
|
||||
|
||||
namespace NConsoleClose {
|
||||
|
||||
#ifndef UNDER_CE
|
||||
static BOOL WINAPI HandlerRoutine(DWORD ctrlType)
|
||||
{
|
||||
if (ctrlType == CTRL_LOGOFF_EVENT)
|
||||
@@ -32,14 +33,19 @@ static BOOL WINAPI HandlerRoutine(DWORD ctrlType)
|
||||
return FALSE;
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
bool TestBreakSignal()
|
||||
{
|
||||
#ifdef UNDER_CE
|
||||
return false;
|
||||
#else
|
||||
/*
|
||||
if (g_BreakCounter > 0)
|
||||
return true;
|
||||
*/
|
||||
return (g_BreakCounter > 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CheckCtrlBreak()
|
||||
@@ -50,14 +56,18 @@ void CheckCtrlBreak()
|
||||
|
||||
CCtrlHandlerSetter::CCtrlHandlerSetter()
|
||||
{
|
||||
#ifndef UNDER_CE
|
||||
if(!SetConsoleCtrlHandler(HandlerRoutine, TRUE))
|
||||
throw "SetConsoleCtrlHandler fails";
|
||||
#endif
|
||||
}
|
||||
|
||||
CCtrlHandlerSetter::~CCtrlHandlerSetter()
|
||||
{
|
||||
#ifndef UNDER_CE
|
||||
if(!SetConsoleCtrlHandler(HandlerRoutine, FALSE))
|
||||
throw "SetConsoleCtrlHandler fails";
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -433,6 +433,7 @@ HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
|
||||
for (int i = 0; i < numArcs; i++)
|
||||
{
|
||||
const UString &archiveName = arcPaths[i];
|
||||
UInt64 arcPackSize = 0;
|
||||
if (!stdInMode)
|
||||
{
|
||||
NFile::NFind::CFileInfoW fi;
|
||||
@@ -442,6 +443,7 @@ HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
|
||||
numErrors++;
|
||||
continue;
|
||||
}
|
||||
arcPackSize = fi.Size;
|
||||
}
|
||||
|
||||
CArchiveLink archiveLink;
|
||||
@@ -583,6 +585,14 @@ HRESULT ListArchives(CCodecs *codecs, const CIntVector &formatIndices,
|
||||
totalPackSize += packSize;
|
||||
totalUnPackSize += unpackSize;
|
||||
}
|
||||
|
||||
if (!stdInMode && totalPackSizePointer == 0)
|
||||
{
|
||||
if (archiveLink.VolumePaths.Size() != 0)
|
||||
arcPackSize += archiveLink.VolumesSize;
|
||||
totalPackSize = arcPackSize;
|
||||
totalPackSizePointer = &totalPackSize;
|
||||
}
|
||||
if (enableHeaders && !techMode)
|
||||
{
|
||||
fieldPrinter.PrintTitleLines();
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#if defined( _WIN32) && defined( _7ZIP_LARGE_PAGES)
|
||||
#include "../../../../C/Alloc.h"
|
||||
#endif
|
||||
|
||||
#include "Common/MyInitGuid.h"
|
||||
|
||||
#include "Common/CommandLineParser.h"
|
||||
@@ -11,17 +15,11 @@
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/StringToInt.h"
|
||||
|
||||
#include "Windows/Defs.h"
|
||||
#include "Windows/Error.h"
|
||||
#include "Windows/FileDir.h"
|
||||
#include "Windows/FileName.h"
|
||||
#ifdef _WIN32
|
||||
#include "Windows/MemoryLock.h"
|
||||
#endif
|
||||
|
||||
#include "../../ICoder.h"
|
||||
#include "../../IPassword.h"
|
||||
|
||||
#include "../Common/ArchiveCommandLine.h"
|
||||
#include "../Common/ExitCode.h"
|
||||
#include "../Common/Extract.h"
|
||||
@@ -29,8 +27,6 @@
|
||||
#include "../Common/LoadCodecs.h"
|
||||
#endif
|
||||
#include "../Common/PropIDUtils.h"
|
||||
#include "../Common/Update.h"
|
||||
#include "../Common/UpdateAction.h"
|
||||
|
||||
#include "../../Compress/LZMA_Alone/LzmaBenchCon.h"
|
||||
|
||||
@@ -41,10 +37,6 @@
|
||||
|
||||
#include "../../MyVersion.h"
|
||||
|
||||
#if defined( _WIN32) && defined( _7ZIP_LARGE_PAGES)
|
||||
#include "../../../../C/Alloc.h"
|
||||
#endif
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NFile;
|
||||
using namespace NCommandLineParser;
|
||||
@@ -117,8 +109,9 @@ static const char *kHelpString =
|
||||
// exception messages
|
||||
|
||||
static const char *kEverythingIsOk = "Everything is Ok";
|
||||
static const char *kUserErrorMessage = "Incorrect command line"; // NExitCode::kUserError
|
||||
static const char *kUserErrorMessage = "Incorrect command line";
|
||||
static const char *kNoFormats = "7-Zip cannot find the code that works with archives.";
|
||||
static const char *kUnsupportedArcTypeMessage = "Unsupported archive type";
|
||||
|
||||
static const wchar_t *kDefaultSfxModule = L"7zCon.sfx";
|
||||
|
||||
@@ -128,19 +121,19 @@ static void ShowMessageAndThrowException(CStdOutStream &s, LPCSTR message, NExit
|
||||
throw code;
|
||||
}
|
||||
|
||||
static void PrintHelpAndExit(CStdOutStream &s) // yyy
|
||||
static void PrintHelpAndExit(CStdOutStream &s)
|
||||
{
|
||||
s << kHelpString;
|
||||
ShowMessageAndThrowException(s, kUserErrorMessage, NExitCode::kUserError);
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
static void GetArguments(int numArguments, const char *arguments[], UStringVector &parts)
|
||||
static void GetArguments(int numArgs, const char *args[], UStringVector &parts)
|
||||
{
|
||||
parts.Clear();
|
||||
for(int i = 0; i < numArguments; i++)
|
||||
for (int i = 0; i < numArgs; i++)
|
||||
{
|
||||
UString s = MultiByteToUnicodeString(arguments[i]);
|
||||
UString s = MultiByteToUnicodeString(args[i]);
|
||||
parts.Add(s);
|
||||
}
|
||||
}
|
||||
@@ -177,15 +170,13 @@ static inline char GetHex(Byte value)
|
||||
return (char)((value < 10) ? ('0' + value) : ('A' + (value - 10)));
|
||||
}
|
||||
|
||||
const char *kUnsupportedArcTypeMessage = "Unsupported archive type";
|
||||
|
||||
int Main2(
|
||||
#ifndef _WIN32
|
||||
int numArguments, const char *arguments[]
|
||||
int numArgs, const char *args[]
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(UNDER_CE)
|
||||
SetFileApisToOEM();
|
||||
#endif
|
||||
|
||||
@@ -193,7 +184,7 @@ int Main2(
|
||||
#ifdef _WIN32
|
||||
NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
|
||||
#else
|
||||
GetArguments(numArguments, arguments, commandStrings);
|
||||
GetArguments(numArgs, args, commandStrings);
|
||||
#endif
|
||||
|
||||
if (commandStrings.Size() == 1)
|
||||
|
||||
@@ -2,85 +2,54 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
// #include <locale.h>
|
||||
#include "Common/MyException.h"
|
||||
#include "Common/StdOutStream.h"
|
||||
|
||||
#include "Windows/Error.h"
|
||||
#include "Windows/NtCheck.h"
|
||||
|
||||
#include "Common/StdOutStream.h"
|
||||
#include "Common/NewHandler.h"
|
||||
#include "Common/MyException.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "../Common/ExitCode.h"
|
||||
#include "../Common/ArchiveCommandLine.h"
|
||||
#include "../Common/ExitCode.h"
|
||||
|
||||
#include "ConsoleClose.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
CStdOutStream *g_StdStream = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef _UNICODE
|
||||
bool g_IsNT = false;
|
||||
#endif
|
||||
#if !defined(_UNICODE) || !defined(_WIN64)
|
||||
static inline bool IsItWindowsNT()
|
||||
{
|
||||
OSVERSIONINFO versionInfo;
|
||||
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
|
||||
if (!::GetVersionEx(&versionInfo))
|
||||
return false;
|
||||
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern int Main2(
|
||||
#ifndef _WIN32
|
||||
int numArguments, const char *arguments[]
|
||||
int numArgs, const char *args[]
|
||||
#endif
|
||||
);
|
||||
|
||||
static const char *kExceptionErrorMessage = "\n\nError:\n";
|
||||
static const char *kUserBreak = "\nBreak signaled\n";
|
||||
|
||||
static const char *kMemoryExceptionMessage = "\n\nERROR: Can't allocate required memory!\n";
|
||||
static const char *kUnknownExceptionMessage = "\n\nUnknown Error\n";
|
||||
static const char *kInternalExceptionMessage = "\n\nInternal Error #";
|
||||
|
||||
#define NT_CHECK_FAIL_ACTION (*g_StdStream) << "Unsupported Windows version"; return NExitCode::kFatalError;
|
||||
|
||||
int MY_CDECL main
|
||||
(
|
||||
#ifndef _WIN32
|
||||
int numArguments, const char *arguments[]
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
int numArgs, const char *args[]
|
||||
#endif
|
||||
)
|
||||
{
|
||||
g_StdStream = &g_StdOut;
|
||||
#ifdef _WIN32
|
||||
|
||||
#ifdef _UNICODE
|
||||
#ifndef _WIN64
|
||||
if (!IsItWindowsNT())
|
||||
{
|
||||
(*g_StdStream) << "This program requires Windows NT/2000/2003/2008/XP/Vista";
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
g_IsNT = IsItWindowsNT();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// setlocale(LC_COLLATE, ".OCP");
|
||||
NT_CHECK
|
||||
|
||||
NConsoleClose::CCtrlHandlerSetter ctrlHandlerSetter;
|
||||
int res = 0;
|
||||
try
|
||||
{
|
||||
res = Main2(
|
||||
#ifndef _WIN32
|
||||
numArguments, arguments
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
numArgs, args
|
||||
#endif
|
||||
);
|
||||
}
|
||||
catch(const CNewException &)
|
||||
@@ -112,8 +81,7 @@ int numArguments, const char *arguments[]
|
||||
}
|
||||
UString message;
|
||||
NError::MyFormatMessage(systemError.ErrorCode, message);
|
||||
(*g_StdStream) << endl << endl << "System error:" << endl <<
|
||||
message << endl;
|
||||
(*g_StdStream) << endl << endl << "System error:" << endl << message << endl;
|
||||
return (NExitCode::kFatalError);
|
||||
}
|
||||
catch(NExitCode::EEnum &exitCode)
|
||||
|
||||
@@ -23,13 +23,18 @@ static const char *kHelpQuestionMessage =
|
||||
NUserAnswerMode::EEnum ScanUserYesNoAllQuit(CStdOutStream *outStream)
|
||||
{
|
||||
(*outStream) << kFirstQuestionMessage;
|
||||
for(;;)
|
||||
for (;;)
|
||||
{
|
||||
(*outStream) << kHelpQuestionMessage;
|
||||
AString scannedString = g_StdIn.ScanStringUntilNewLine();
|
||||
scannedString.Trim();
|
||||
if(!scannedString.IsEmpty())
|
||||
switch(::MyCharUpper(scannedString[0]))
|
||||
if (!scannedString.IsEmpty())
|
||||
switch(
|
||||
::MyCharUpper(
|
||||
#ifdef UNDER_CE
|
||||
(wchar_t)
|
||||
#endif
|
||||
scannedString[0]))
|
||||
{
|
||||
case kYes:
|
||||
return NUserAnswerMode::kYes;
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
PROG = 7z.exe
|
||||
LIBS = $(LIBS) user32.lib oleaut32.lib advapi32.lib
|
||||
MY_CONSOLE = 1
|
||||
CFLAGS = $(CFLAGS) -I ../../../ \
|
||||
-DCOMPRESS_MT \
|
||||
-DWIN_LONG_PATH \
|
||||
-DEXTERNAL_LZMA \
|
||||
-DEXTERNAL_CODECS \
|
||||
-DBREAK_HANDLER \
|
||||
-DBENCH_MT \
|
||||
-D_7ZIP_LARGE_PAGES \
|
||||
-DSUPPORT_DEVICE_FILE \
|
||||
|
||||
!IFNDEF UNDER_CE
|
||||
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -D_7ZIP_LARGE_PAGES -DSUPPORT_DEVICE_FILE
|
||||
!ENDIF
|
||||
|
||||
|
||||
CONSOLE_OBJS = \
|
||||
$O\ConsoleClose.obj \
|
||||
|
||||
Reference in New Issue
Block a user