mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 06:06:59 -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();
|
||||
|
||||
@@ -337,11 +337,11 @@ SOURCE=..\..\UI\FileManager\PasswordDialog.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\UI\FileManager\ProgressDialog.cpp
|
||||
SOURCE=..\..\UI\FileManager\ProgressDialog2.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\UI\FileManager\ProgressDialog.h
|
||||
SOURCE=..\..\UI\FileManager\ProgressDialog2.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "7zip Common"
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
PROG = 7z.sfx
|
||||
LIBS = $(LIBS) user32.lib oleaut32.lib shell32.lib ole32.lib
|
||||
CFLAGS = $(CFLAGS) -I ../../../ \
|
||||
-DNO_REGISTRY \
|
||||
-DEXTRACT_ONLY \
|
||||
-DNO_READ_FROM_CODER \
|
||||
-D_SFX \
|
||||
|
||||
!IFDEF UNDER_CE
|
||||
LIBS = $(LIBS) ceshell.lib Commctrl.lib
|
||||
!ELSE
|
||||
LIBS = $(LIBS) comctl32.lib comdlg32.lib
|
||||
!ENDIF
|
||||
|
||||
SFX_WIN_OBJS = \
|
||||
$O\Main.obj \
|
||||
|
||||
@@ -68,10 +73,15 @@ UI_COMMON_OBJS = \
|
||||
FM_OBJS = \
|
||||
$O\ExtractCallback.obj \
|
||||
$O\FormatUtils.obj \
|
||||
$O\MessagesDialog.obj \
|
||||
$O\OverwriteDialog.obj \
|
||||
$O\PasswordDialog.obj \
|
||||
$O\ProgressDialog.obj \
|
||||
$O\ProgressDialog2.obj \
|
||||
|
||||
!IFDEF UNDER_CE
|
||||
FM_OBJS = $(FM_OBJS) \
|
||||
$O\BrowseDialog.obj \
|
||||
$O\SysIconUtils.obj \
|
||||
!ENDIF
|
||||
|
||||
AR_COMMON_OBJS = \
|
||||
$O\CoderMixer2.obj \
|
||||
|
||||
@@ -1,7 +1 @@
|
||||
#define IDD_DIALOG_EXTRACT 137
|
||||
|
||||
#define IDI_ICON3 159
|
||||
|
||||
#define IDC_STATIC_EXTRACT_EXTRACT_TO 1020
|
||||
#define IDC_EXTRACT_COMBO_PATH 1021
|
||||
#define IDC_EXTRACT_BUTTON_SET_PATH 1022
|
||||
#define IDI_ICON 1
|
||||
|
||||
@@ -1,34 +1,43 @@
|
||||
#include "../../MyVersionInfo.rc"
|
||||
#include "../../GuiCommon.rc"
|
||||
#include "../../UI/GUI/ExtractDialogRes.h"
|
||||
#include "resource.h"
|
||||
|
||||
MY_VERSION_INFO_APP("7z SFX", "7z.sfx")
|
||||
|
||||
#define xSize2 214
|
||||
#define ySize2 64
|
||||
#define xc 240
|
||||
#define yc 64
|
||||
|
||||
#define xSize (xSize2 + marg + marg)
|
||||
#define ySize (ySize2 + marg + marg)
|
||||
IDI_ICON ICON "7z.ico"
|
||||
|
||||
#define bYPos (ySize - marg - bYSize)
|
||||
#define bXPos1 (xSize - marg - bXSize)
|
||||
#define bXPos2 (bXPos1 - 10 - bXSize)
|
||||
|
||||
IDI_ICON3 ICON "7z.ico"
|
||||
|
||||
IDD_DIALOG_EXTRACT DIALOG 0, 0, xSize, ySize MY_MODAL_DIALOG_STYLE
|
||||
IDD_DIALOG_EXTRACT MY_DIALOG
|
||||
CAPTION "7-Zip self-extracting archive"
|
||||
MY_FONT
|
||||
BEGIN
|
||||
LTEXT "E&xtract to:", IDC_STATIC_EXTRACT_EXTRACT_TO, marg, marg, xSize2, 8
|
||||
EDITTEXT IDC_EXTRACT_COMBO_PATH, marg, 21, xSize2 - bDotsSize - 13, 14, ES_AUTOHSCROLL
|
||||
PUSHBUTTON "...", IDC_EXTRACT_BUTTON_SET_PATH, xSize - marg - bDotsSize, 20, bDotsSize, bYSize, WS_GROUP
|
||||
DEFPUSHBUTTON "Extract", IDOK, , bXPos2, bYPos, bXSize, bYSize, WS_GROUP
|
||||
PUSHBUTTON "Cancel", IDCANCEL, bXPos1, bYPos, bXSize, bYSize
|
||||
LTEXT "E&xtract to:", IDC_STATIC_EXTRACT_EXTRACT_TO, m, m, xc, 8
|
||||
EDITTEXT IDC_EXTRACT_COMBO_PATH, m, 21, xc - bxsDots - 12, 14, ES_AUTOHSCROLL
|
||||
PUSHBUTTON "...", IDC_EXTRACT_BUTTON_SET_PATH, xs - m - bxsDots, 20, bxsDots, bys, WS_GROUP
|
||||
DEFPUSHBUTTON "Extract", IDOK, bx2, by, bxs, bys, WS_GROUP
|
||||
PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
|
||||
END
|
||||
|
||||
#include "../../UI/FileManager/MessagesDialog.rc"
|
||||
#ifdef UNDER_CE
|
||||
|
||||
#undef xc
|
||||
#define xc 144
|
||||
|
||||
IDD_DIALOG_EXTRACT_2 MY_DIALOG
|
||||
CAPTION "7-Zip self-extracting archive"
|
||||
BEGIN
|
||||
LTEXT "E&xtract to:", IDC_STATIC_EXTRACT_EXTRACT_TO, m, m, xc - bxsDots - 12, 8
|
||||
EDITTEXT IDC_EXTRACT_COMBO_PATH, m, m + bys + 4, xc, 14, ES_AUTOHSCROLL
|
||||
PUSHBUTTON "...", IDC_EXTRACT_BUTTON_SET_PATH, xs - m - bxsDots, m, bxsDots, bys, WS_GROUP
|
||||
DEFPUSHBUTTON "Extract", IDOK, bx2, by, bxs, bys, WS_GROUP
|
||||
PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
|
||||
END
|
||||
|
||||
#endif
|
||||
|
||||
#include "../../UI/FileManager/OverwriteDialog.rc"
|
||||
#include "../../UI/FileManager/PasswordDialog.rc"
|
||||
#include "../../UI/FileManager/ProgressDialog.rc"
|
||||
#include "../../UI/FileManager/ProgressDialog2.rc"
|
||||
#include "../../UI/GUI/Extract.rc"
|
||||
|
||||
Reference in New Issue
Block a user