mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-11 23:09:54 -06:00
9.06 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
829409452d
commit
c99f3ebdd6
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <initguid.h>
|
||||
#include "Common/MyInitGuid.h"
|
||||
|
||||
#include "Common/CommandLineParser.h"
|
||||
#include "Common/StringConvert.h"
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Windows/Error.h"
|
||||
#include "Windows/FileDir.h"
|
||||
#include "Windows/FileName.h"
|
||||
#include "Windows/NtCheck.h"
|
||||
#include "Windows/ResourceString.h"
|
||||
|
||||
#include "../../ICoder.h"
|
||||
@@ -23,28 +24,16 @@
|
||||
#include "../../UI/GUI/ExtractRes.h"
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
#ifndef _UNICODE
|
||||
bool g_IsNT = false;
|
||||
static inline bool IsItWindowsNT()
|
||||
{
|
||||
OSVERSIONINFO versionInfo;
|
||||
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
|
||||
if (!::GetVersionEx(&versionInfo))
|
||||
return false;
|
||||
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
|
||||
}
|
||||
|
||||
#ifdef UNDER_CE
|
||||
bool g_LVN_ITEMACTIVATE_Support = true;
|
||||
#endif
|
||||
|
||||
static const wchar_t *kUnknownExceptionMessage = L"ERROR: Unknown Error!";
|
||||
|
||||
void ErrorMessageForHRESULT(HRESULT res)
|
||||
{
|
||||
UString s;
|
||||
if (res == E_OUTOFMEMORY)
|
||||
s = NWindows::MyLoadStringW(IDS_MEM_ERROR);
|
||||
else
|
||||
s = NWindows::NError::MyFormatMessageW(res);
|
||||
ShowErrorMessage(s);
|
||||
ShowErrorMessage(HResultToMessage(res));
|
||||
}
|
||||
|
||||
int APIENTRY WinMain2()
|
||||
@@ -53,11 +42,17 @@ int APIENTRY WinMain2()
|
||||
bool assumeYes = false;
|
||||
bool outputFolderDefined = false;
|
||||
UString outputFolder;
|
||||
UStringVector subStrings;
|
||||
NCommandLineParser::SplitCommandLine(GetCommandLineW(), subStrings);
|
||||
for (int i = 1; i < subStrings.Size(); i++)
|
||||
UStringVector commandStrings;
|
||||
NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
|
||||
|
||||
#ifndef UNDER_CE
|
||||
if (commandStrings.Size() > 0)
|
||||
commandStrings.Delete(0);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < commandStrings.Size(); i++)
|
||||
{
|
||||
const UString &s = subStrings[i];
|
||||
const UString &s = commandStrings[i];
|
||||
if (s.CompareNoCase(L"-y") == 0)
|
||||
assumeYes = true;
|
||||
else if (s.Left(2).CompareNoCase(L"-o") == 0)
|
||||
@@ -122,32 +117,44 @@ int APIENTRY WinMain2()
|
||||
NWildcard::CCensorNode wildcardCensor;
|
||||
wildcardCensor.AddItem(true, L"*", true, true, true);
|
||||
|
||||
bool messageWasDisplayed = false;
|
||||
result = ExtractGUI(codecs, CIntVector(), v1, v2,
|
||||
wildcardCensor, eo, (assumeYes ? false: true), ecs);
|
||||
wildcardCensor, eo, (assumeYes ? false: true), messageWasDisplayed, ecs);
|
||||
|
||||
if (result == S_OK)
|
||||
{
|
||||
if (ecs->Messages.Size() > 0 || ecs->NumArchiveErrors != 0)
|
||||
if (!ecs->IsOK())
|
||||
return NExitCode::kFatalError;
|
||||
return 0;
|
||||
}
|
||||
if (result == E_ABORT)
|
||||
return NExitCode::kUserBreak;
|
||||
if (result == S_FALSE)
|
||||
ShowErrorMessage(L"Error in archive");
|
||||
else
|
||||
ErrorMessageForHRESULT(result);
|
||||
if (!messageWasDisplayed)
|
||||
{
|
||||
if (result == S_FALSE)
|
||||
ShowErrorMessage(L"Error in archive");
|
||||
else
|
||||
ErrorMessageForHRESULT(result);
|
||||
}
|
||||
if (result == E_OUTOFMEMORY)
|
||||
return NExitCode::kMemoryError;
|
||||
return NExitCode::kFatalError;
|
||||
}
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /* lpCmdLine */, int /* nCmdShow */)
|
||||
#define NT_CHECK_FAIL_ACTION ShowErrorMessage(L"Unsupported Windows version"); return NExitCode::kFatalError;
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
|
||||
#ifdef UNDER_CE
|
||||
LPWSTR
|
||||
#else
|
||||
LPSTR
|
||||
#endif
|
||||
/* lpCmdLine */, int /* nCmdShow */)
|
||||
{
|
||||
g_hInstance = (HINSTANCE)hInstance;
|
||||
#ifndef _UNICODE
|
||||
g_IsNT = IsItWindowsNT();
|
||||
#endif
|
||||
|
||||
NT_CHECK
|
||||
|
||||
try
|
||||
{
|
||||
return WinMain2();
|
||||
|
||||
Reference in New Issue
Block a user