diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2016-09-29 03:00:00 +0300 |
---|---|---|
committer | Kornel LesinĚski <kornel@geekhood.net> | 2016-12-08 15:12:54 +0300 |
commit | 232ce7957441b06193c4cbdc1bc9e71436fadfdb (patch) | |
tree | cbfba61cb993434ebb38be4e058a977d91a8676a /CPP/7zip/Bundles | |
parent | 1eddf527cacc149016ec987d554d3dfb52b69131 (diff) |
16.0316.03
Diffstat (limited to 'CPP/7zip/Bundles')
-rw-r--r-- | CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp | 5 | ||||
-rw-r--r-- | CPP/7zip/Bundles/SFXCon/SFXCon.dsp | 9 | ||||
-rw-r--r-- | CPP/7zip/Bundles/SFXCon/SfxCon.cpp | 57 | ||||
-rw-r--r-- | CPP/7zip/Bundles/SFXCon/makefile | 2 | ||||
-rw-r--r-- | CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp | 3 | ||||
-rw-r--r-- | CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp | 9 | ||||
-rw-r--r-- | CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp | 6 | ||||
-rw-r--r-- | CPP/7zip/Bundles/SFXSetup/makefile | 1 | ||||
-rw-r--r-- | CPP/7zip/Bundles/SFXWin/SFXWin.dsp | 9 | ||||
-rw-r--r-- | CPP/7zip/Bundles/SFXWin/SfxWin.cpp | 6 | ||||
-rw-r--r-- | CPP/7zip/Bundles/SFXWin/makefile | 3 |
11 files changed, 84 insertions, 26 deletions
diff --git a/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp b/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp index 5ca288f4..178753e5 100644 --- a/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp +++ b/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp @@ -749,11 +749,10 @@ static int main2(int numArgs, const char *args[]) } } - if (!stdOutMode) - Print_Size("Output size: ", outStreamSpec->ProcessedSize); - if (outStreamSpec) { + if (!stdOutMode) + Print_Size("Output size: ", outStreamSpec->ProcessedSize); if (outStreamSpec->Close() != S_OK) throw "File closing error"; } diff --git a/CPP/7zip/Bundles/SFXCon/SFXCon.dsp b/CPP/7zip/Bundles/SFXCon/SFXCon.dsp index 4f55d013..b21b9e84 100644 --- a/CPP/7zip/Bundles/SFXCon/SFXCon.dsp +++ b/CPP/7zip/Bundles/SFXCon/SFXCon.dsp @@ -804,6 +804,15 @@ SOURCE=..\..\..\..\C\Delta.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\DllSecur.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\C\DllSecur.h +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Lzma2Dec.c # SUBTRACT CPP /YX /Yc /Yu # End Source File diff --git a/CPP/7zip/Bundles/SFXCon/SfxCon.cpp b/CPP/7zip/Bundles/SFXCon/SfxCon.cpp index d74f472d..d828922f 100644 --- a/CPP/7zip/Bundles/SFXCon/SfxCon.cpp +++ b/CPP/7zip/Bundles/SFXCon/SfxCon.cpp @@ -24,6 +24,8 @@ #include "../../MyVersion.h" +#include "../../../../C/DllSecur.h" + using namespace NWindows; using namespace NFile; using namespace NDir; @@ -103,7 +105,7 @@ static const wchar_t *kUniversalWildcard = L"*"; static const int kCommandIndex = 0; static const char *kHelpString = - "\nUsage: 7zSFX [<command>] [<switches>...]\n" + "\nUsage: 7zSFX [<command>] [<switches>...] [<file_name>...]\n" "\n" "<Commands>\n" // " l: List contents of archive\n" @@ -222,13 +224,6 @@ void AddCommandLineWildcardToCensor(NWildcard::CCensor &wildcardCensor, ShowMessageAndThrowException(kIncorrectWildcardInCommandLine, NExitCode::kUserError); } -void AddToCensorFromNonSwitchesStrings(NWildcard::CCensor &wildcardCensor, - const UStringVector & /* nonSwitchStrings */, NRecursedType::EEnum type, - bool /* thereAreSwitchIncludeWildcards */) -{ - AddCommandLineWildcardToCensor(wildcardCensor, kUniversalWildcard, true, type); -} - #ifndef _WIN32 static void GetArguments(int numArgs, const char *args[], UStringVector &parts) @@ -248,6 +243,11 @@ int Main2( #endif ) { + #ifdef _WIN32 + // do we need load Security DLLs for console program? + LoadSecurityDlls(); + #endif + #if defined(_WIN32) && !defined(UNDER_CE) SetFileApisToOEM(); #endif @@ -283,9 +283,16 @@ int Main2( commandStrings.Delete(0); NCommandLineParser::CParser parser(kNumSwitches); + try { - parser.ParseStrings(kSwitchForms, commandStrings); + if (!parser.ParseStrings(kSwitchForms, commandStrings)) + { + g_StdOut << "Command line error:" << endl + << parser.ErrorMessage << endl + << parser.ErrorLine << endl; + return NExitCode::kUserError; + } } catch(...) { @@ -297,19 +304,23 @@ int Main2( PrintHelp(); return 0; } + const UStringVector &nonSwitchStrings = parser.NonSwitchStrings; - int numNonSwitchStrings = nonSwitchStrings.Size(); + unsigned curCommandIndex = 0; CArchiveCommand command; - if (numNonSwitchStrings == 0) + if (nonSwitchStrings.IsEmpty()) command.CommandType = NCommandType::kFullExtract; else { - if (numNonSwitchStrings > 1) - PrintHelpAndExit(); - if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], command)) - PrintHelpAndExit(); + const UString &cmd = nonSwitchStrings[curCommandIndex]; + if (!ParseArchiveCommand(cmd, command)) + { + g_StdOut << "ERROR: Unknown command:" << endl << cmd << endl; + return NExitCode::kUserError; + } + curCommandIndex = 1; } @@ -318,11 +329,17 @@ int Main2( NWildcard::CCensor wildcardCensor; - bool thereAreSwitchIncludeWildcards; - thereAreSwitchIncludeWildcards = false; - - AddToCensorFromNonSwitchesStrings(wildcardCensor, nonSwitchStrings, recursedType, - thereAreSwitchIncludeWildcards); + { + if (nonSwitchStrings.Size() == curCommandIndex) + AddCommandLineWildcardToCensor(wildcardCensor, kUniversalWildcard, true, recursedType); + for (; curCommandIndex < nonSwitchStrings.Size(); curCommandIndex++) + { + const UString &s = nonSwitchStrings[curCommandIndex]; + if (s.IsEmpty()) + throw "Empty file path"; + AddCommandLineWildcardToCensor(wildcardCensor, s, true, recursedType); + } + } bool yesToAll = parser[NKey::kYes].ThereIs; diff --git a/CPP/7zip/Bundles/SFXCon/makefile b/CPP/7zip/Bundles/SFXCon/makefile index f1cd2f57..4c201c00 100644 --- a/CPP/7zip/Bundles/SFXCon/makefile +++ b/CPP/7zip/Bundles/SFXCon/makefile @@ -4,6 +4,7 @@ CFLAGS = $(CFLAGS) \ -DEXTRACT_ONLY \ -DNO_READ_FROM_CODER \ -D_SFX \ + -D_CONSOLE \ CURRENT_OBJS = \ $O\SfxCon.obj \ @@ -114,6 +115,7 @@ C_OBJS = \ $O\BraIA64.obj \ $O\CpuArch.obj \ $O\Delta.obj \ + $O\DllSecur.obj \ $O\Lzma2Dec.obj \ $O\LzmaDec.obj \ $O\Ppmd7.obj \ diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp index ba41fd1a..b1592993 100644 --- a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp +++ b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp @@ -55,8 +55,7 @@ struct CThreadExtracting Result = ArchiveLink.Open2(options, ExtractCallbackSpec); if (Result != S_OK) { - if (Result != S_OK) - ErrorMessage = kCantOpenArchive; + ErrorMessage = kCantOpenArchive; return; } diff --git a/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp b/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp index f2783e02..787c1bde 100644 --- a/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp +++ b/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp @@ -706,6 +706,15 @@ SOURCE=..\..\..\..\C\Delta.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\DllSecur.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\C\DllSecur.h +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Lzma2Dec.c # SUBTRACT CPP /YX /Yc /Yu # End Source File diff --git a/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp b/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp index 68e28eda..aef2e196 100644 --- a/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp +++ b/CPP/7zip/Bundles/SFXSetup/SfxSetup.cpp @@ -23,6 +23,8 @@ #include "ExtractEngine.h" +#include "../../../../C/DllSecur.h" + #include "resource.h" using namespace NWindows; @@ -135,6 +137,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, NT_CHECK + #ifdef _WIN32 + LoadSecurityDlls(); + #endif + // InitCommonControls(); UString archiveName, switches; diff --git a/CPP/7zip/Bundles/SFXSetup/makefile b/CPP/7zip/Bundles/SFXSetup/makefile index 5f6f6032..5849cf36 100644 --- a/CPP/7zip/Bundles/SFXSetup/makefile +++ b/CPP/7zip/Bundles/SFXSetup/makefile @@ -100,6 +100,7 @@ C_OBJS = \ $O\BraIA64.obj \ $O\CpuArch.obj \ $O\Delta.obj \ + $O\DllSecur.obj \ $O\Lzma2Dec.obj \ $O\LzmaDec.obj \ $O\Threads.obj \ diff --git a/CPP/7zip/Bundles/SFXWin/SFXWin.dsp b/CPP/7zip/Bundles/SFXWin/SFXWin.dsp index 1f3d88d1..301a6c5c 100644 --- a/CPP/7zip/Bundles/SFXWin/SFXWin.dsp +++ b/CPP/7zip/Bundles/SFXWin/SFXWin.dsp @@ -888,6 +888,15 @@ SOURCE=..\..\..\..\C\Delta.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\DllSecur.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\C\DllSecur.h +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Lzma2Dec.c # SUBTRACT CPP /YX /Yc /Yu # End Source File diff --git a/CPP/7zip/Bundles/SFXWin/SfxWin.cpp b/CPP/7zip/Bundles/SFXWin/SfxWin.cpp index c301ecf8..db7acfef 100644 --- a/CPP/7zip/Bundles/SFXWin/SfxWin.cpp +++ b/CPP/7zip/Bundles/SFXWin/SfxWin.cpp @@ -28,6 +28,8 @@ #include "../../UI/GUI/ExtractGUI.h" #include "../../UI/GUI/ExtractRes.h" +#include "../../../../C/DllSecur.h" + using namespace NWindows; using namespace NFile; using namespace NDir; @@ -220,6 +222,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, try { + #ifdef _WIN32 + LoadSecurityDlls(); + #endif + return WinMain2(); } catch(const CNewException &) diff --git a/CPP/7zip/Bundles/SFXWin/makefile b/CPP/7zip/Bundles/SFXWin/makefile index 0ffec922..dc48ae88 100644 --- a/CPP/7zip/Bundles/SFXWin/makefile +++ b/CPP/7zip/Bundles/SFXWin/makefile @@ -131,8 +131,9 @@ C_OBJS = \ $O\Bra.obj \ $O\Bra86.obj \ $O\BraIA64.obj \ - $O\Delta.obj \ $O\CpuArch.obj \ + $O\Delta.obj \ + $O\DllSecur.obj \ $O\Lzma2Dec.obj \ $O\LzmaDec.obj \ $O\Ppmd7.obj \ |