Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/UI/GUI')
-rw-r--r--CPP/7zip/UI/GUI/BenchmarkDialog.cpp70
-rw-r--r--CPP/7zip/UI/GUI/BenchmarkDialog.h8
-rw-r--r--CPP/7zip/UI/GUI/BenchmarkDialog.rc16
-rw-r--r--CPP/7zip/UI/GUI/BenchmarkDialogRes.h3
-rw-r--r--CPP/7zip/UI/GUI/CompressDialog.cpp270
-rw-r--r--CPP/7zip/UI/GUI/CompressDialog.h2
-rw-r--r--CPP/7zip/UI/GUI/CompressDialog.rc10
-rw-r--r--CPP/7zip/UI/GUI/Extract.rc9
-rw-r--r--CPP/7zip/UI/GUI/ExtractDialog.cpp4
-rw-r--r--CPP/7zip/UI/GUI/ExtractGUI.cpp26
-rw-r--r--CPP/7zip/UI/GUI/ExtractRes.h9
-rw-r--r--CPP/7zip/UI/GUI/GUI.cpp58
-rw-r--r--CPP/7zip/UI/GUI/GUI.dsp24
-rw-r--r--CPP/7zip/UI/GUI/HashGUI.cpp81
-rw-r--r--CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp139
-rw-r--r--CPP/7zip/UI/GUI/UpdateCallbackGUI.h24
-rw-r--r--CPP/7zip/UI/GUI/UpdateCallbackGUI2.cpp59
-rw-r--r--CPP/7zip/UI/GUI/UpdateCallbackGUI2.h35
-rw-r--r--CPP/7zip/UI/GUI/UpdateGUI.cpp15
-rw-r--r--CPP/7zip/UI/GUI/makefile2
-rw-r--r--CPP/7zip/UI/GUI/resource.rc2
-rw-r--r--CPP/7zip/UI/GUI/resource3.h10
-rw-r--r--CPP/7zip/UI/GUI/resource3.rc15
23 files changed, 606 insertions, 285 deletions
diff --git a/CPP/7zip/UI/GUI/BenchmarkDialog.cpp b/CPP/7zip/UI/GUI/BenchmarkDialog.cpp
index 1f4bcab5..2f118846 100644
--- a/CPP/7zip/UI/GUI/BenchmarkDialog.cpp
+++ b/CPP/7zip/UI/GUI/BenchmarkDialog.cpp
@@ -2,6 +2,8 @@
#include "StdAfx.h"
+#include "../../../../C/CpuArch.h"
+
#include "../../../Common/Defs.h"
#include "../../../Common/IntToString.h"
#include "../../../Common/MyException.h"
@@ -15,10 +17,14 @@
#include "../FileManager/HelpUtils.h"
+#include "../../MyVersion.h"
+
#include "BenchmarkDialog.h"
using namespace NWindows;
+void GetCpuName(AString &s);
+
static LPCWSTR kHelpTopic = L"fm/benchmark.htm";
static const UINT_PTR kTimerID = 4;
@@ -72,7 +78,7 @@ static const int kMinDicLogSize = 21;
#endif
static const UInt32 kMinDicSize = (1 << kMinDicLogSize);
static const UInt32 kMaxDicSize =
- #ifdef _WIN64
+ #ifdef MY_CPU_64BIT
(1 << 30);
#else
(1 << 27);
@@ -111,6 +117,34 @@ bool CBenchmarkDialog::OnInit()
_consoleEdit.SendMessage(WM_SETFONT, (WPARAM)_font._font, TRUE);
}
+ {
+ TCHAR s[40];
+ s[0] = '/';
+ s[1] = ' ';
+ ConvertUInt32ToString(NSystem::GetNumberOfProcessors(), s + 2);
+ SetItemText(IDT_BENCH_HARDWARE_THREADS, s);
+ }
+
+ {
+ UString s;
+ {
+ AString cpuName;
+ GetCpuName(cpuName);
+ s.SetFromAscii(cpuName);
+ SetItemText(IDT_BENCH_CPU, s);
+ }
+
+ s.SetFromAscii("7-Zip " MY_VERSION " ["
+ #ifdef MY_CPU_64BIT
+ "64-bit"
+ #elif defined MY_CPU_32BIT
+ "32-bit"
+ #endif
+ "]");
+ SetItemText(IDT_BENCH_VER, s);
+ }
+
+
UInt32 numCPUs = NSystem::GetNumberOfProcessors();
if (numCPUs < 1)
numCPUs = 1;
@@ -270,9 +304,7 @@ void CBenchmarkDialog::OnChangeSettings()
{
EnableItem(IDB_STOP, true);
UInt32 dictionary = OnChangeDictionary();
- TCHAR s[40] = { TEXT('/'), TEXT(' '), 0 };
- ConvertUInt32ToString(NSystem::GetNumberOfProcessors(), s + 2);
- SetItemText(IDT_BENCH_HARDWARE_THREADS, s);
+
for (int i = 0; i < ARRAY_SIZE(g_IDs); i++)
SetItemText(g_IDs[i], kProcessingString);
_startTime = GetTickCount();
@@ -394,6 +426,14 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
ConvertUInt64ToString(Sync.NumPasses, s);
SetItemText(IDT_BENCH_PASSES_VAL, s);
+ /*
+ if (Sync.FreqWasChanged)
+ {
+ SetItemText(IDT_BENCH_FREQ, Sync.Freq);
+ Sync.FreqWasChanged = false;
+ }
+ */
+
{
UInt32 dicSizeTemp = (UInt32)MyMax(Sync.ProcessedSize, UInt64(1) << 20);
dicSizeTemp = MyMin(dicSizeTemp, Sync.DictionarySize),
@@ -498,11 +538,26 @@ struct CBenchCallback: public IBenchCallback
UInt32 dictionarySize;
CProgressSyncInfo *Sync;
+ // void AddCpuFreq(UInt64 cpuFreq);
HRESULT SetFreq(bool showFreq, UInt64 cpuFreq);
HRESULT SetEncodeResult(const CBenchInfo &info, bool final);
HRESULT SetDecodeResult(const CBenchInfo &info, bool final);
};
+/*
+void CBenchCallback::AddCpuFreq(UInt64 cpuFreq)
+{
+ NSynchronization::CCriticalSectionLock lock(Sync->CS);
+ {
+ wchar_t s[32];
+ ConvertUInt64ToString(cpuFreq, s);
+ Sync->Freq.Add_Space_if_NotEmpty();
+ Sync->Freq += s;
+ Sync->FreqWasChanged = true;
+ }
+}
+*/
+
HRESULT CBenchCallback::SetFreq(bool /* showFreq */, UInt64 /* cpuFreq */)
{
return S_OK;
@@ -605,6 +660,7 @@ HRESULT CThreadBenchmark::Process()
CBenchCallback2 callback2;
callback2.Sync = &sync;
HRESULT result;
+
try
{
CObjectVector<CProperty> props;
@@ -624,11 +680,11 @@ HRESULT CThreadBenchmark::Process()
}
{
CProperty prop;
- prop.Name = L"d";
+ prop.Name = L'd';
wchar_t s[16];
ConvertUInt32ToString(dictionarySize, s);
prop.Name += s;
- prop.Name += 'b';
+ prop.Name += L'b';
props.Add(prop);
}
}
@@ -724,7 +780,7 @@ HRESULT Benchmark(
const CProperty &prop = props[i];
UString name = prop.Name;
name.MakeLower_Ascii();
- if (name.IsEqualToNoCase(L"m") && prop.Value == L"*")
+ if (name.IsEqualTo_Ascii_NoCase("m") && prop.Value == L"*")
{
bd.TotalMode = true;
continue;
diff --git a/CPP/7zip/UI/GUI/BenchmarkDialog.h b/CPP/7zip/UI/GUI/BenchmarkDialog.h
index 82531117..a5f0292a 100644
--- a/CPP/7zip/UI/GUI/BenchmarkDialog.h
+++ b/CPP/7zip/UI/GUI/BenchmarkDialog.h
@@ -51,11 +51,15 @@ public:
AString Text;
bool TextWasChanged;
+ // UString Freq;
+ // bool FreqWasChanged;
+
CProgressSyncInfo()
{
if (_startEvent.Create() != S_OK)
throw 3986437;
}
+
void Init()
{
Changed = false;
@@ -70,9 +74,13 @@ public:
NumPasses = 0;
+ // Freq.SetFromAscii("MHz: ");
+ // FreqWasChanged = true;
+
Text.Empty();
TextWasChanged = true;
}
+
void Stop()
{
NWindows::NSynchronization::CCriticalSectionLock lock(CS);
diff --git a/CPP/7zip/UI/GUI/BenchmarkDialog.rc b/CPP/7zip/UI/GUI/BenchmarkDialog.rc
index a31d2f25..cae9097b 100644
--- a/CPP/7zip/UI/GUI/BenchmarkDialog.rc
+++ b/CPP/7zip/UI/GUI/BenchmarkDialog.rc
@@ -2,7 +2,7 @@
#include "../../GuiCommon.rc"
#define xc 332
-#define yc 228
+#define yc 248
#undef g0xs
#undef g1x
@@ -42,10 +42,13 @@
#define g3x (m + g2xs)
#undef GROUP_Y_SIZE
+#undef GROUP_Y2_SIZE
#ifdef UNDER_CE
#define GROUP_Y_SIZE 8
+#define GROUP_Y2_SIZE 8
#else
#define GROUP_Y_SIZE 40
+#define GROUP_Y2_SIZE 32
#endif
IDD_BENCH DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
@@ -101,11 +104,14 @@ BEGIN
RTEXT "", IDT_BENCH_DECOMPR_RPU2, xRpu, 136, sRpu, 8
RTEXT "", IDT_BENCH_DECOMPR_RATING2, xRating, 136, sRating, 8
- GROUPBOX "Total Rating", IDG_BENCH_TOTAL_RATING, xTotalRating, 163, sTotalRating, GROUP_Y_SIZE
+ GROUPBOX "Total Rating", IDG_BENCH_TOTAL_RATING, xTotalRating, 163, sTotalRating, GROUP_Y2_SIZE
- RTEXT "", IDT_BENCH_TOTAL_USAGE_VAL, xUsage, 181, sUsage, 8
- RTEXT "", IDT_BENCH_TOTAL_RPU_VAL, xRpu, 181, sRpu, 8
- RTEXT "", IDT_BENCH_TOTAL_RATING_VAL, xRating, 181, sRating, 8
+ RTEXT "", IDT_BENCH_TOTAL_USAGE_VAL, xUsage, 176, sUsage, 8
+ RTEXT "", IDT_BENCH_TOTAL_RPU_VAL, xRpu, 176, sRpu, 8
+ RTEXT "", IDT_BENCH_TOTAL_RATING_VAL, xRating, 176, sRating, 8
+
+ RTEXT "", IDT_BENCH_CPU, m, 202, xc, 8
+ RTEXT "", IDT_BENCH_VER, m, 216, xc, 8
LTEXT "Elapsed time:", IDT_BENCH_ELAPSED, m, 163, g2xs, 8
LTEXT "Size:", IDT_BENCH_SIZE, m, 176, g2xs, 8
diff --git a/CPP/7zip/UI/GUI/BenchmarkDialogRes.h b/CPP/7zip/UI/GUI/BenchmarkDialogRes.h
index 7dd6d031..a632d764 100644
--- a/CPP/7zip/UI/GUI/BenchmarkDialogRes.h
+++ b/CPP/7zip/UI/GUI/BenchmarkDialogRes.h
@@ -9,6 +9,9 @@
#define IDC_BENCH_NUM_THREADS 103
#define IDT_BENCH_HARDWARE_THREADS 104
+#define IDT_BENCH_VER 105
+#define IDT_BENCH_CPU 106
+
#define IDT_BENCH_COMPRESS_SPEED1 110
#define IDT_BENCH_COMPRESS_SPEED2 111
#define IDT_BENCH_COMPRESS_RATING1 112
diff --git a/CPP/7zip/UI/GUI/CompressDialog.cpp b/CPP/7zip/UI/GUI/CompressDialog.cpp
index a2d0ac2b..23b6f52f 100644
--- a/CPP/7zip/UI/GUI/CompressDialog.cpp
+++ b/CPP/7zip/UI/GUI/CompressDialog.cpp
@@ -2,6 +2,8 @@
#include "StdAfx.h"
+#include "../../../../C/CpuArch.h"
+
#include "../../../Common/IntToString.h"
#include "../../../Common/StringConvert.h"
@@ -76,7 +78,7 @@ using namespace NFile;
using namespace NName;
using namespace NDir;
-static const int kHistorySize = 20;
+static const unsigned kHistorySize = 20;
static LPCWSTR kExeExt = L".exe";
static LPCWSTR k7zFormat = L"7z";
@@ -170,7 +172,7 @@ struct CFormatInfo
LPCWSTR Name;
UInt32 LevelsMask;
const EMethodID *MathodIDs;
- int NumMethods;
+ unsigned NumMethods;
bool Filter;
bool Solid;
bool MultiThread;
@@ -372,7 +374,7 @@ bool CCompressDialog::OnInit()
m_Format.SetCurSel(index);
continue;
}
- if (i == 0 || ai.Name.IsEqualToNoCase(m_RegistryInfo.ArcType))
+ if (i == 0 || ai.Name.IsEqualTo_NoCase(m_RegistryInfo.ArcType))
{
m_Format.SetCurSel(index);
Info.FormatIndex = arcIndex;
@@ -455,7 +457,7 @@ void CCompressDialog::UpdatePasswordControl()
bool CCompressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
- switch(buttonID)
+ switch (buttonID)
{
case IDB_COMPRESS_SET_ARCHIVE:
{
@@ -554,9 +556,8 @@ bool CCompressDialog::IsSFX()
static int GetExtDotPos(const UString &s)
{
- int dotPos = s.ReverseFind('.');
- int slashPos = MyMax(s.ReverseFind(WCHAR_PATH_SEPARATOR), s.ReverseFind('/'));
- if (dotPos >= 0 && dotPos > slashPos + 1)
+ int dotPos = s.ReverseFind_Dot();
+ if (dotPos > s.ReverseFind_PathSepar() + 1)
return dotPos;
return -1;
}
@@ -578,7 +579,7 @@ void CCompressDialog::OnButtonSFX()
if (dotPos >= 0)
{
UString ext = fileName.Ptr(dotPos);
- if (ext.IsEqualToNoCase(kExeExt))
+ if (ext.IsEqualTo_NoCase(kExeExt))
{
fileName.DeleteFrom(dotPos);
m_ArchivePath.SetText(fileName);
@@ -690,8 +691,7 @@ void CCompressDialog::OnOK()
return;
}
UString method = GetEncryptionMethodSpec();
- method.MakeLower_Ascii();
- if (method.Find(L"aes") == 0)
+ if (method.IsPrefixedBy_Ascii_NoCase("aes"))
{
if (Info.Password.Len() > 99)
{
@@ -820,7 +820,7 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
{
if (code == CBN_SELCHANGE)
{
- switch(itemID)
+ switch (itemID)
{
case IDC_COMPRESS_ARCHIVE:
{
@@ -914,7 +914,7 @@ void CCompressDialog::SetArchiveName2(bool prevWasSFX)
if (prevWasSFX)
prevExtension = kExeExt;
else
- prevExtension = UString('.') + prevArchiverInfo.GetMainExt();
+ prevExtension = UString(L'.') + prevArchiverInfo.GetMainExt();
const unsigned prevExtensionLen = prevExtension.Len();
if (fileName.Len() >= prevExtensionLen)
if (StringsAreEqualNoCase(fileName.RightPtr(prevExtensionLen), prevExtension))
@@ -962,7 +962,7 @@ int CCompressDialog::FindRegistryFormat(const UString &name)
FOR_VECTOR (i, m_RegistryInfo.Formats)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[i];
- if (name.IsEqualToNoCase(GetUnicodeString(fo.FormatID)))
+ if (name.IsEqualTo_NoCase(GetUnicodeString(fo.FormatID)))
return i;
}
return -1;
@@ -984,7 +984,7 @@ int CCompressDialog::GetStaticFormatIndex()
{
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
for (unsigned i = 0; i < ARRAY_SIZE(g_Formats); i++)
- if (ai.Name.IsEqualToNoCase(g_Formats[i].Name))
+ if (ai.Name.IsEqualTo_NoCase(g_Formats[i].Name))
return i;
return 0; // -1;
}
@@ -1016,8 +1016,8 @@ void CCompressDialog::SetLevel()
else
level = 9;
}
- int i;
- for (i = 0; i <= 9; i++)
+
+ for (unsigned i = 0; i <= 9; i++)
{
if ((fi.LevelsMask & (1 << i)) != 0)
{
@@ -1051,7 +1051,8 @@ void CCompressDialog::SetMethod(int keepMethodId)
}
bool isSfx = IsSFX();
bool weUseSameMethod = false;
- for (int m = 0; m < fi.NumMethods; m++)
+
+ for (unsigned m = 0; m < fi.NumMethods; m++)
{
EMethodID methodID = fi.MathodIDs[m];
if (isSfx)
@@ -1066,9 +1067,10 @@ void CCompressDialog::SetMethod(int keepMethodId)
weUseSameMethod = true;
continue;
}
- if ((defaultMethod.IsEqualToNoCase(method) || m == 0) && !weUseSameMethod)
+ if ((defaultMethod.IsEqualTo_NoCase(method) || m == 0) && !weUseSameMethod)
m_Method.SetCurSel(itemIndex);
}
+
if (!weUseSameMethod)
{
SetDictionary();
@@ -1079,19 +1081,19 @@ void CCompressDialog::SetMethod(int keepMethodId)
bool CCompressDialog::IsZipFormat()
{
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
- return ai.Name.IsEqualToNoCase(L"zip");
+ return ai.Name.IsEqualTo_Ascii_NoCase("zip");
}
void CCompressDialog::SetEncryptionMethod()
{
_encryptionMethod.ResetContent();
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
- if (ai.Name.IsEqualToNoCase(L"7z"))
+ if (ai.Name.IsEqualTo_Ascii_NoCase("7z"))
{
_encryptionMethod.AddString(TEXT("AES-256"));
_encryptionMethod.SetCurSel(0);
}
- else if (ai.Name.IsEqualToNoCase(L"zip"))
+ else if (ai.Name.IsEqualTo_Ascii_NoCase("zip"))
{
int index = FindRegistryFormat(ai.Name);
UString encryptionMethod;
@@ -1102,7 +1104,7 @@ void CCompressDialog::SetEncryptionMethod()
}
_encryptionMethod.AddString(TEXT("ZipCrypto"));
_encryptionMethod.AddString(TEXT("AES-256"));
- _encryptionMethod.SetCurSel(encryptionMethod.Find(L"AES") == 0 ? 1 : 0);
+ _encryptionMethod.SetCurSel(encryptionMethod.IsPrefixedBy_Ascii_NoCase("aes") ? 1 : 0);
}
}
@@ -1155,138 +1157,149 @@ void CCompressDialog::SetDictionary()
m_Dictionary.ResetContent();
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
- UInt32 defaultDictionary = (UInt32)(Int32)-1;
+ UInt32 defaultDict = (UInt32)(Int32)-1;
+
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
- if (fo.Method.IsEqualToNoCase(GetMethodSpec()))
- defaultDictionary = fo.Dictionary;
+ if (fo.Method.IsEqualTo_NoCase(GetMethodSpec()))
+ defaultDict = fo.Dictionary;
}
+
int methodID = GetMethodID();
UInt32 level = GetLevel2();
if (methodID < 0)
return;
const UInt64 maxRamSize = GetMaxRamSizeForProgram();
+
switch (methodID)
{
case kLZMA:
case kLZMA2:
{
static const UInt32 kMinDicSize = (1 << 16);
- if (defaultDictionary == (UInt32)(Int32)-1)
+ if (defaultDict == (UInt32)(Int32)-1)
{
- if (level >= 9) defaultDictionary = (1 << 26);
- else if (level >= 7) defaultDictionary = (1 << 25);
- else if (level >= 5) defaultDictionary = (1 << 24);
- else if (level >= 3) defaultDictionary = (1 << 20);
- else defaultDictionary = (kMinDicSize);
+ if (level >= 9) defaultDict = (1 << 26);
+ else if (level >= 7) defaultDict = (1 << 25);
+ else if (level >= 5) defaultDict = (1 << 24);
+ else if (level >= 3) defaultDict = (1 << 20);
+ else defaultDict = (kMinDicSize);
}
- int i;
+
AddDictionarySize(kMinDicSize);
m_Dictionary.SetCurSel(0);
- for (i = 20; i <= 30; i++)
- for (int j = 0; j < 2; j++)
+
+ for (unsigned i = 20; i <= 31; i++)
+ for (unsigned j = 0; j < 2; j++)
{
if (i == 20 && j > 0)
continue;
- UInt32 dictionary = (1 << i) + (j << (i - 1));
- if (dictionary >
- #ifdef _WIN64
- (1 << 30)
+ UInt32 dict = ((UInt32)(2 + j) << (i - 1));
+ if (dict >
+ #ifdef MY_CPU_64BIT
+ (3 << 29)
#else
(1 << 26)
#endif
)
continue;
- AddDictionarySize(dictionary);
+ AddDictionarySize(dict);
UInt64 decomprSize;
- UInt64 requiredComprSize = GetMemoryUsage(dictionary, decomprSize);
- if (dictionary <= defaultDictionary && requiredComprSize <= maxRamSize)
+ UInt64 requiredComprSize = GetMemoryUsage(dict, decomprSize);
+ if (dict <= defaultDict && requiredComprSize <= maxRamSize)
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
}
- // SetNearestSelectComboBox(m_Dictionary, defaultDictionary);
+ // SetNearestSelectComboBox(m_Dictionary, defaultDict);
break;
}
+
case kPPMd:
{
- if (defaultDictionary == (UInt32)(Int32)-1)
+ if (defaultDict == (UInt32)(Int32)-1)
{
- if (level >= 9) defaultDictionary = (192 << 20);
- else if (level >= 7) defaultDictionary = ( 64 << 20);
- else if (level >= 5) defaultDictionary = ( 16 << 20);
- else defaultDictionary = ( 4 << 20);
+ if (level >= 9) defaultDict = (192 << 20);
+ else if (level >= 7) defaultDict = ( 64 << 20);
+ else if (level >= 5) defaultDict = ( 16 << 20);
+ else defaultDict = ( 4 << 20);
}
- int i;
- for (i = 20; i < 31; i++)
- for (int j = 0; j < 2; j++)
+
+ for (unsigned i = 20; i < 31; i++)
+ for (unsigned j = 0; j < 2; j++)
{
if (i == 20 && j > 0)
continue;
- UInt32 dictionary = (1 << i) + (j << (i - 1));
- if (dictionary >
- #ifdef _WIN64
+ UInt32 dict = ((UInt32)(2 + j) << (i - 1));
+ if (dict >
+ #ifdef MY_CPU_64BIT
(1 << 30)
#else
(1 << 29)
#endif
)
continue;
- AddDictionarySize(dictionary);
+ AddDictionarySize(dict);
UInt64 decomprSize;
- UInt64 requiredComprSize = GetMemoryUsage(dictionary, decomprSize);
- if (dictionary <= defaultDictionary && requiredComprSize <= maxRamSize || m_Dictionary.GetCount() == 0)
+ UInt64 requiredComprSize = GetMemoryUsage(dict, decomprSize);
+ if (dict <= defaultDict && requiredComprSize <= maxRamSize || m_Dictionary.GetCount() == 0)
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
}
- SetNearestSelectComboBox(m_Dictionary, defaultDictionary);
+
+ SetNearestSelectComboBox(m_Dictionary, defaultDict);
break;
}
+
case kDeflate:
{
AddDictionarySize(32 << 10);
m_Dictionary.SetCurSel(0);
break;
}
+
case kDeflate64:
{
AddDictionarySize(64 << 10);
m_Dictionary.SetCurSel(0);
break;
}
+
case kBZip2:
{
- if (defaultDictionary == (UInt32)(Int32)-1)
+ if (defaultDict == (UInt32)(Int32)-1)
{
- if (level >= 5)
- defaultDictionary = (900 << 10);
- else if (level >= 3)
- defaultDictionary = (500 << 10);
- else
- defaultDictionary = (100 << 10);
+ if (level >= 5) defaultDict = (900 << 10);
+ else if (level >= 3) defaultDict = (500 << 10);
+ else defaultDict = (100 << 10);
}
- for (int i = 1; i <= 9; i++)
+
+ for (unsigned i = 1; i <= 9; i++)
{
- UInt32 dictionary = (i * 100) << 10;
- AddDictionarySize(dictionary);
- if (dictionary <= defaultDictionary || m_Dictionary.GetCount() == 0)
+ UInt32 dict = ((UInt32)i * 100) << 10;
+ AddDictionarySize(dict);
+ if (dict <= defaultDict || m_Dictionary.GetCount() == 0)
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
}
+
break;
}
+
case kPPMdZip:
{
- if (defaultDictionary == (UInt32)(Int32)-1)
- defaultDictionary = (1 << (19 + (level > 8 ? 8 : level)));
- for (int i = 20; i <= 28; i++)
+ if (defaultDict == (UInt32)(Int32)-1)
+ defaultDict = (1 << (19 + (level > 8 ? 8 : level)));
+
+ for (unsigned i = 20; i <= 28; i++)
{
- UInt32 dictionary = (1 << i);
- AddDictionarySize(dictionary);
+ UInt32 dict = (1 << i);
+ AddDictionarySize(dict);
UInt64 decomprSize;
- UInt64 requiredComprSize = GetMemoryUsage(dictionary, decomprSize);
- if (dictionary <= defaultDictionary && requiredComprSize <= maxRamSize || m_Dictionary.GetCount() == 0)
+ UInt64 requiredComprSize = GetMemoryUsage(dict, decomprSize);
+ if (dict <= defaultDict && requiredComprSize <= maxRamSize || m_Dictionary.GetCount() == 0)
m_Dictionary.SetCurSel(m_Dictionary.GetCount() - 1);
}
- SetNearestSelectComboBox(m_Dictionary, defaultDictionary);
+
+ SetNearestSelectComboBox(m_Dictionary, defaultDict);
break;
}
}
@@ -1322,16 +1335,19 @@ void CCompressDialog::SetOrder()
const CArcInfoEx &ai = (*ArcFormats)[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
UInt32 defaultOrder = (UInt32)(Int32)-1;
+
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
- if (fo.Method.IsEqualToNoCase(GetMethodSpec()))
+ if (fo.Method.IsEqualTo_NoCase(GetMethodSpec()))
defaultOrder = fo.Order;
}
+
int methodID = GetMethodID();
UInt32 level = GetLevel2();
if (methodID < 0)
return;
+
switch (methodID)
{
case kLZMA:
@@ -1339,10 +1355,10 @@ void CCompressDialog::SetOrder()
{
if (defaultOrder == (UInt32)(Int32)-1)
defaultOrder = (level >= 7) ? 64 : 32;
- for (int i = 3; i <= 8; i++)
- for (int j = 0; j < 2; j++)
+ for (unsigned i = 3; i <= 8; i++)
+ for (unsigned j = 0; j < 2; j++)
{
- UInt32 order = (1 << i) + (j << (i - 1));
+ UInt32 order = ((UInt32)(2 + j) << (i - 1));
if (order <= 256)
AddOrder(order);
}
@@ -1350,66 +1366,64 @@ void CCompressDialog::SetOrder()
SetNearestSelectComboBox(m_Order, defaultOrder);
break;
}
+
case kPPMd:
{
if (defaultOrder == (UInt32)(Int32)-1)
{
- if (level >= 9)
- defaultOrder = 32;
- else if (level >= 7)
- defaultOrder = 16;
- else if (level >= 5)
- defaultOrder = 6;
- else
- defaultOrder = 4;
+ if (level >= 9) defaultOrder = 32;
+ else if (level >= 7) defaultOrder = 16;
+ else if (level >= 5) defaultOrder = 6;
+ else defaultOrder = 4;
}
- int i;
+
AddOrder(2);
AddOrder(3);
- for (i = 2; i < 8; i++)
- for (int j = 0; j < 4; j++)
+
+ for (unsigned i = 2; i < 8; i++)
+ for (unsigned j = 0; j < 4; j++)
{
- UInt32 order = (1 << i) + (j << (i - 2));
+ UInt32 order = (4 + j) << (i - 2);
if (order < 32)
AddOrder(order);
}
+
AddOrder(32);
SetNearestSelectComboBox(m_Order, defaultOrder);
break;
}
+
case kDeflate:
case kDeflate64:
{
if (defaultOrder == (UInt32)(Int32)-1)
{
- if (level >= 9)
- defaultOrder = 128;
- else if (level >= 7)
- defaultOrder = 64;
- else
- defaultOrder = 32;
+ if (level >= 9) defaultOrder = 128;
+ else if (level >= 7) defaultOrder = 64;
+ else defaultOrder = 32;
}
- int i;
- for (i = 3; i <= 8; i++)
- for (int j = 0; j < 2; j++)
+
+ for (unsigned i = 3; i <= 8; i++)
+ for (unsigned j = 0; j < 2; j++)
{
- UInt32 order = (1 << i) + (j << (i - 1));
+ UInt32 order = ((UInt32)(2 + j) << (i - 1));;
if (order <= 256)
AddOrder(order);
}
+
AddOrder(methodID == kDeflate64 ? 257 : 258);
SetNearestSelectComboBox(m_Order, defaultOrder);
break;
}
+
case kBZip2:
- {
break;
- }
+
case kPPMdZip:
{
if (defaultOrder == (UInt32)(Int32)-1)
defaultOrder = level + 3;
- for (int i = 2; i <= 16; i++)
+ for (unsigned i = 2; i <= 16; i++)
AddOrder(i);
SetNearestSelectComboBox(m_Order, defaultOrder);
break;
@@ -1442,9 +1456,9 @@ void CCompressDialog::SetSolidBlockSize()
if (level == 0)
return;
- UInt32 dictionary = GetDictionarySpec();
- if (dictionary == (UInt32)(Int32)-1)
- dictionary = 1;
+ UInt32 dict = GetDictionarySpec();
+ if (dict == (UInt32)(Int32)-1)
+ dict = 1;
UInt32 defaultBlockSize = (UInt32)(Int32)-1;
@@ -1453,7 +1467,7 @@ void CCompressDialog::SetSolidBlockSize()
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
- if (fo.Method.IsEqualToNoCase(GetMethodSpec()))
+ if (fo.Method.IsEqualTo_NoCase(GetMethodSpec()))
defaultBlockSize = fo.BlockLogSize;
}
@@ -1461,9 +1475,10 @@ void CCompressDialog::SetSolidBlockSize()
m_Solid.SetItemData(index, (UInt32)kNoSolidBlockSize);
m_Solid.SetCurSel(0);
bool needSet = defaultBlockSize == (UInt32)(Int32)-1;
- for (int i = 20; i <= 36; i++)
+
+ for (unsigned i = 20; i <= 36; i++)
{
- if (needSet && dictionary >= (((UInt64)1 << (i - 7))) && i <= 32)
+ if (needSet && dict >= (((UInt64)1 << (i - 7))) && i <= 32)
defaultBlockSize = i;
TCHAR s[40];
ConvertUInt32ToString(1 << (i % 10), s);
@@ -1473,6 +1488,7 @@ void CCompressDialog::SetSolidBlockSize()
int index = (int)m_Solid.AddString(s);
m_Solid.SetItemData(index, (UInt32)i);
}
+
index = (int)m_Solid.AddString(LangString(IDS_COMPRESS_SOLID));
m_Solid.SetItemData(index, kSolidBlockSize);
if (defaultBlockSize == (UInt32)(Int32)-1)
@@ -1497,7 +1513,7 @@ void CCompressDialog::SetNumThreads()
if (index >= 0)
{
const NCompression::CFormatOptions &fo = m_RegistryInfo.Formats[index];
- if (fo.Method.IsEqualToNoCase(GetMethodSpec()) && fo.NumThreads != (UInt32)(Int32)-1)
+ if (fo.Method.IsEqualTo_NoCase(GetMethodSpec()) && fo.NumThreads != (UInt32)(Int32)-1)
defaultValue = fo.NumThreads;
}
@@ -1521,7 +1537,7 @@ void CCompressDialog::SetNumThreads()
SetNearestSelectComboBox(m_NumThreads, defaultValue);
}
-UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemory)
+UInt64 CCompressDialog::GetMemoryUsage(UInt32 dict, UInt64 &decompressMemory)
{
decompressMemory = UInt64(Int64(-1));
UInt32 level = GetLevel2();
@@ -1536,6 +1552,7 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemo
if (fi.Filter && level >= 9)
size += (12 << 20) * 2 + (5 << 20);
UInt32 numThreads = GetNumThreads2();
+
if (IsZipFormat())
{
UInt32 numSubThreads = 1;
@@ -1545,13 +1562,15 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemo
if (numMainThreads > 1)
size += (UInt64)numMainThreads << 25;
}
+
int methidId = GetMethodID();
+
switch (methidId)
{
case kLZMA:
case kLZMA2:
{
- UInt32 hs = dictionary - 1;
+ UInt32 hs = dict - 1;
hs |= (hs >> 1);
hs |= (hs >> 2);
hs |= (hs >> 4);
@@ -1562,9 +1581,9 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemo
hs >>= 1;
hs++;
UInt64 size1 = (UInt64)hs * 4;
- size1 += (UInt64)dictionary * 4;
+ size1 += (UInt64)dict * 4;
if (level >= 5)
- size1 += (UInt64)dictionary * 4;
+ size1 += (UInt64)dict * 4;
size1 += (2 << 20);
UInt32 numThreads1 = 1;
@@ -1573,27 +1592,31 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemo
size1 += (2 << 20) + (4 << 20);
numThreads1 = 2;
}
+
UInt32 numBlockThreads = numThreads / numThreads1;
+
if (methidId == kLZMA || numBlockThreads == 1)
- size1 += (UInt64)dictionary * 3 / 2;
+ size1 += (UInt64)dict * 3 / 2;
else
{
- UInt64 chunkSize = (UInt64)dictionary << 2;
+ UInt64 chunkSize = (UInt64)dict << 2;
chunkSize = MyMax(chunkSize, (UInt64)(1 << 20));
chunkSize = MyMin(chunkSize, (UInt64)(1 << 28));
- chunkSize = MyMax(chunkSize, (UInt64)dictionary);
+ chunkSize = MyMax(chunkSize, (UInt64)dict);
size1 += chunkSize * 2;
}
size += size1 * numBlockThreads;
- decompressMemory = dictionary + (2 << 20);
+ decompressMemory = dict + (2 << 20);
return size;
}
+
case kPPMd:
{
- decompressMemory = dictionary + (2 << 20);
+ decompressMemory = dict + (2 << 20);
return size + decompressMemory;
}
+
case kDeflate:
case kDeflate64:
{
@@ -1606,18 +1629,21 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemo
decompressMemory = (2 << 20);
return size;
}
+
case kBZip2:
{
decompressMemory = (7 << 20);
UInt64 memForOneThread = (10 << 20);
return size + memForOneThread * numThreads;
}
+
case kPPMdZip:
{
- decompressMemory = dictionary + (2 << 20);
+ decompressMemory = dict + (2 << 20);
return size + (UInt64)decompressMemory * numThreads;
}
}
+
return (UInt64)(Int64)-1;
}
diff --git a/CPP/7zip/UI/GUI/CompressDialog.h b/CPP/7zip/UI/GUI/CompressDialog.h
index 3463fefc..a7a3a3a7 100644
--- a/CPP/7zip/UI/GUI/CompressDialog.h
+++ b/CPP/7zip/UI/GUI/CompressDialog.h
@@ -164,7 +164,7 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
void SetSolidBlockSize();
void SetNumThreads();
- UInt64 GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemory);
+ UInt64 GetMemoryUsage(UInt32 dict, UInt64 &decompressMemory);
UInt64 GetMemoryUsage(UInt64 &decompressMemory);
void PrintMemUsage(UINT res, UInt64 value);
void SetMemoryUsage();
diff --git a/CPP/7zip/UI/GUI/CompressDialog.rc b/CPP/7zip/UI/GUI/CompressDialog.rc
index 6c555a7e..d6ce5ac0 100644
--- a/CPP/7zip/UI/GUI/CompressDialog.rc
+++ b/CPP/7zip/UI/GUI/CompressDialog.rc
@@ -80,7 +80,7 @@ BEGIN
LTEXT "&Solid Block size:", IDT_COMPRESS_SOLID, m, 146, g0xs, 8
COMBOBOX IDC_COMPRESS_SOLID, g1x, 144, g1xs, 140, MY_COMBO
- LTEXT "&Number of CPU threads:", IDT_COMPRESS_THREADS, m, 167, g0xs, 8
+ LTEXT "Number of CPU &threads:", IDT_COMPRESS_THREADS, m, 167, g0xs, 8
COMBOBOX IDC_COMPRESS_THREADS, g1x, 165, g1xs - 35, 140, MY_COMBO
RTEXT "", IDT_COMPRESS_HARDWARE_THREADS, g1x + g1xs - 35 + 10, 167, 25, 8
@@ -95,7 +95,7 @@ BEGIN
LTEXT "Split to &volumes, bytes:", IDT_SPLIT_TO_VOLUMES, m, 225, gSize, 8
COMBOBOX IDC_COMPRESS_VOLUME, m, 237, gSize, 73, MY_COMBO_WITH_EDIT
- LTEXT "&Parameters:", IDT_COMPRESS_PARAMETERS, m, 256, gSize, 8
+ LTEXT "Parameters:", IDT_COMPRESS_PARAMETERS, m, 256, gSize, 8
EDITTEXT IDE_COMPRESS_PARAMETERS, m, 268, gSize, 14, ES_AUTOHSCROLL
@@ -130,7 +130,7 @@ BEGIN
GROUPBOX "Encryption", IDG_COMPRESS_ENCRYPTION, g4x, yPsw, g4xs, GROUP_Y_SIZE_ENCRYPT
- LTEXT "Enter password:", IDT_PASSWORD_ENTER, g4x2, yPsw + 14, g4xs2, 8
+ LTEXT "Enter &password:", IDT_PASSWORD_ENTER, g4x2, yPsw + 14, g4xs2, 8
EDITTEXT IDE_COMPRESS_PASSWORD1, g4x2, yPsw + 26, g4xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
LTEXT "Reenter password:", IDT_PASSWORD_REENTER, g4x2, yPsw + 46, g4xs2, 8
EDITTEXT IDE_COMPRESS_PASSWORD2, g4x2, yPsw + 58, g4xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
@@ -179,7 +179,7 @@ BEGIN
LTEXT "Split to &volumes, bytes:", IDT_SPLIT_TO_VOLUMES, m, 60, 32, 8
COMBOBOX IDC_COMPRESS_VOLUME, m + 32, 58, 44, 73, MY_COMBO_WITH_EDIT
- LTEXT "&Parameters:", IDT_COMPRESS_PARAMETERS, m + 80, 60, 48, 8
+ LTEXT "Parameters:", IDT_COMPRESS_PARAMETERS, m + 80, 60, 48, 8
EDITTEXT IDE_COMPRESS_PARAMETERS, m + 128, 58, 24, 13, ES_AUTOHSCROLL
COMBOBOX IDC_COMPRESS_UPDATE_MODE, m, 76, 88, 80, MY_COMBO
@@ -187,7 +187,7 @@ BEGIN
CONTROL "Compress shared files", IDX_COMPRESS_SHARED, MY_CHECKBOX, m, 94, xc, 10
- LTEXT "Enter password:", IDT_PASSWORD_ENTER, m, 112, 60, 8
+ LTEXT "Enter &password:", IDT_PASSWORD_ENTER, m, 112, 60, 8
EDITTEXT IDE_COMPRESS_PASSWORD1, m + 60, 110, 44, 13, ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Show Password", IDX_PASSWORD_SHOW, MY_CHECKBOX, m + 108, 112, 44, 10
diff --git a/CPP/7zip/UI/GUI/Extract.rc b/CPP/7zip/UI/GUI/Extract.rc
index defcfcc4..f75b2e6f 100644
--- a/CPP/7zip/UI/GUI/Extract.rc
+++ b/CPP/7zip/UI/GUI/Extract.rc
@@ -11,8 +11,14 @@ BEGIN
IDS_CANT_OPEN_ENCRYPTED_ARCHIVE "Can not open encrypted archive '{0}'. Wrong password?"
IDS_UNSUPPORTED_ARCHIVE_TYPE "Unsupported archive type"
+ IDS_CANT_OPEN_AS_TYPE "Can not open the file as {0} archive"
+ IDS_IS_OPEN_AS_TYPE "The file is open as {0} archive"
+ IDS_IS_OPEN_WITH_OFFSET "The archive is open with offset"
+
IDS_PROGRESS_EXTRACTING "Extracting"
+ IDS_PROGRESS_SKIPPING "Skipping"
+
IDS_EXTRACT_SET_FOLDER "Specify a location for extracted files."
IDS_EXTRACT_PATHS_FULL "Full pathnames"
@@ -32,7 +38,7 @@ BEGIN
IDS_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED "Data error in encrypted file '{0}'. Wrong password?"
IDS_EXTRACT_MESSAGE_CRC_ERROR_ENCRYPTED "CRC failed in encrypted file '{0}'. Wrong password?"
- IDS_EXTRACT_MSG_WRONG_PSW "Wrong password?"
+ IDS_EXTRACT_MSG_WRONG_PSW_GUESS "Wrong password?"
// IDS_EXTRACT_MSG_ENCRYPTED "Encrypted file"
IDS_EXTRACT_MSG_UNSUPPORTED_METHOD "Unsupported compression method"
@@ -43,6 +49,7 @@ BEGIN
IDS_EXTRACT_MSG_DATA_AFTER_END "There are some data after the end of the payload data"
IDS_EXTRACT_MSG_IS_NOT_ARC "Is not archive"
IDS_EXTRACT_MSG_HEADERS_ERROR "Headers Error"
+ IDS_EXTRACT_MSG_WRONG_PSW_CLAIM "Wrong password"
IDS_OPEN_MSG_UNAVAILABLE_START "Unavailable start of archive"
IDS_OPEN_MSG_UNCONFIRMED_START "Unconfirmed start of archive"
diff --git a/CPP/7zip/UI/GUI/ExtractDialog.cpp b/CPP/7zip/UI/GUI/ExtractDialog.cpp
index d1ce8255..9a14c6c4 100644
--- a/CPP/7zip/UI/GUI/ExtractDialog.cpp
+++ b/CPP/7zip/UI/GUI/ExtractDialog.cpp
@@ -143,7 +143,7 @@ bool CExtractDialog::OnInit()
GetText(s);
if (!ArcPath.IsEmpty())
{
- s += L" : ";
+ s.AddAscii(" : ");
s += ArcPath;
}
SetText(s);
@@ -289,7 +289,7 @@ void CExtractDialog::OnButtonSetPath()
void AddUniqueString(UStringVector &list, const UString &s)
{
FOR_VECTOR (i, list)
- if (s.IsEqualToNoCase(list[i]))
+ if (s.IsEqualTo_NoCase(list[i]))
return;
list.Add(s);
}
diff --git a/CPP/7zip/UI/GUI/ExtractGUI.cpp b/CPP/7zip/UI/GUI/ExtractGUI.cpp
index b5fbeaec..e58f6b2b 100644
--- a/CPP/7zip/UI/GUI/ExtractGUI.cpp
+++ b/CPP/7zip/UI/GUI/ExtractGUI.cpp
@@ -40,20 +40,20 @@ static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
static void AddValuePair(UString &s, UINT resourceID, UInt64 value, bool addColon = true)
{
- wchar_t sz[32];
- s += LangString(resourceID);
+ AddLangString(s, resourceID);
if (addColon)
s += L':';
- s += L' ';
+ s.Add_Space();
+ char sz[32];
ConvertUInt64ToString(value, sz);
- s += sz;
- s += L'\n';
+ s.AddAscii(sz);
+ s.Add_LF();
}
static void AddSizePair(UString &s, UINT resourceID, UInt64 value)
{
wchar_t sz[32];
- s += LangString(resourceID);
+ AddLangString(s, resourceID);
s += L": ";
ConvertUInt64ToString(value, sz);
s += MyFormatNew(IDS_FILE_SIZE, sz);
@@ -65,7 +65,7 @@ static void AddSizePair(UString &s, UINT resourceID, UInt64 value)
s += sz;
s += L" MB)";
}
- s += L'\n';
+ s.Add_LF();
}
#endif
@@ -122,7 +122,7 @@ HRESULT CThreadExtracting::ProcessVirt()
AddSizePair(s, IDS_PROP_SIZE, Stat.UnpackSize);
if (Stat.NumAltStreams != 0)
{
- s += L'\n';
+ s.Add_LF();
AddValuePair(s, IDS_PROP_NUM_ALT_STREAMS, Stat.NumAltStreams);
AddSizePair(s, IDS_PROP_ALT_STREAMS_SIZE, Stat.AltStreams_UnpackSize);
}
@@ -130,12 +130,12 @@ HRESULT CThreadExtracting::ProcessVirt()
if (HashBundle)
{
- s += L'\n';
+ s.Add_LF();
AddHashBundleRes(s, *HashBundle, UString());
}
- s += L'\n';
- s += LangString(IDS_MESSAGE_NO_ERRORS);
+ s.Add_LF();
+ AddLangString(s, IDS_MESSAGE_NO_ERRORS);
FinalMessage.OkMessage.Title = Title;
FinalMessage.OkMessage.Message = s;
@@ -237,7 +237,9 @@ HRESULT ExtractGUI(
0x02000603,
#endif
options.OutputDir);
- MyMessageBox(s2 + UString(L'\n') + s);
+ s2.Add_LF();
+ s2 += s;
+ MyMessageBox(s2);
return E_FAIL;
}
*/
diff --git a/CPP/7zip/UI/GUI/ExtractRes.h b/CPP/7zip/UI/GUI/ExtractRes.h
index 48738bbb..634ba6b5 100644
--- a/CPP/7zip/UI/GUI/ExtractRes.h
+++ b/CPP/7zip/UI/GUI/ExtractRes.h
@@ -6,8 +6,14 @@
#define IDS_CANT_OPEN_ENCRYPTED_ARCHIVE 3006
#define IDS_UNSUPPORTED_ARCHIVE_TYPE 3007
+#define IDS_CANT_OPEN_AS_TYPE 3017
+#define IDS_IS_OPEN_AS_TYPE 3018
+#define IDS_IS_OPEN_WITH_OFFSET 3019
+
#define IDS_PROGRESS_EXTRACTING 3300
+#define IDS_PROGRESS_SKIPPING 3325
+
#define IDS_EXTRACT_SET_FOLDER 3402
#define IDS_EXTRACT_PATHS_FULL 3411
@@ -27,7 +33,7 @@
#define IDS_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED 3703
#define IDS_EXTRACT_MESSAGE_CRC_ERROR_ENCRYPTED 3704
-#define IDS_EXTRACT_MSG_WRONG_PSW 3710
+#define IDS_EXTRACT_MSG_WRONG_PSW_GUESS 3710
// #define IDS_EXTRACT_MSG_ENCRYPTED 3711
#define IDS_EXTRACT_MSG_UNSUPPORTED_METHOD 3721
@@ -38,6 +44,7 @@
#define IDS_EXTRACT_MSG_DATA_AFTER_END 3726
#define IDS_EXTRACT_MSG_IS_NOT_ARC 3727
#define IDS_EXTRACT_MSG_HEADERS_ERROR 3728
+#define IDS_EXTRACT_MSG_WRONG_PSW_CLAIM 3729
#define IDS_OPEN_MSG_UNAVAILABLE_START 3763
#define IDS_OPEN_MSG_UNCONFIRMED_START 3764
diff --git a/CPP/7zip/UI/GUI/GUI.cpp b/CPP/7zip/UI/GUI/GUI.cpp
index 592f7673..134ac021 100644
--- a/CPP/7zip/UI/GUI/GUI.cpp
+++ b/CPP/7zip/UI/GUI/GUI.cpp
@@ -126,14 +126,8 @@ static int Main2()
#endif
#endif
- CCodecs *codecs = new CCodecs;
- #ifdef EXTERNAL_CODECS
- CExternalCodecs __externalCodecs;
- __externalCodecs.GetCodecs = codecs;
- __externalCodecs.GetHashers = codecs;
- #else
- CMyComPtr<IUnknown> compressCodecsInfo = codecs;
- #endif
+ CREATE_CODECS_OBJECT
+
codecs->CaseSensitiveChange = options.CaseSensitiveChange;
codecs->CaseSensitive = options.CaseSensitive;
ThrowException_if_Error(codecs->Load());
@@ -144,8 +138,18 @@ static int Main2()
(isExtractGroupCommand
|| options.Command.IsFromUpdateGroup()))
+ {
+ #ifdef EXTERNAL_CODECS
+ if (!codecs->MainDll_ErrorPath.IsEmpty())
+ {
+ UString s = L"7-Zip cannot load module ";
+ s += fs2us(codecs->MainDll_ErrorPath);
+ throw s;
+ }
+ #endif
throw kNoFormats;
-
+ }
+
CObjectVector<COpenType> formatIndices;
if (!ParseOpenTypes(*codecs, options.ArcType, formatIndices))
{
@@ -171,12 +175,12 @@ static int Main2()
if (isExtractGroupCommand
|| options.Command.CommandType == NCommandType::kHash
|| options.Command.CommandType == NCommandType::kBenchmark)
- ThrowException_if_Error(__externalCodecs.LoadCodecs());
+ ThrowException_if_Error(__externalCodecs.Load());
#endif
if (options.Command.CommandType == NCommandType::kBenchmark)
{
- HRESULT res = Benchmark(EXTERNAL_CODECS_VARS options.Properties);
+ HRESULT res = Benchmark(EXTERNAL_CODECS_VARS_L options.Properties);
/*
if (res == S_FALSE)
{
@@ -188,6 +192,9 @@ static int Main2()
}
else if (isExtractGroupCommand)
{
+ UStringVector ArchivePathsSorted;
+ UStringVector ArchivePathsFullSorted;
+
CExtractCallbackImp *ecs = new CExtractCallbackImp;
CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
@@ -218,14 +225,35 @@ static int Main2()
if (!options.HashMethods.IsEmpty())
{
hb_ptr = &hb;
- ThrowException_if_Error(hb.SetMethods(EXTERNAL_CODECS_VARS options.HashMethods));
+ ThrowException_if_Error(hb.SetMethods(EXTERNAL_CODECS_VARS_L options.HashMethods));
}
#endif
+ {
+ CDirItemsStat st;
+ HRESULT hresultMain = EnumerateDirItemsAndSort(
+ options.arcCensor,
+ NWildcard::k_RelatPath,
+ UString(), // addPathPrefix
+ ArchivePathsSorted,
+ ArchivePathsFullSorted,
+ st,
+ NULL // &scan: change it!!!!
+ );
+ if (hresultMain != S_OK)
+ {
+ /*
+ if (hresultMain != E_ABORT && messageWasDisplayed)
+ return NExitCode::kFatalError;
+ */
+ throw CSystemException(hresultMain);
+ }
+ }
+
HRESULT result = ExtractGUI(codecs,
formatIndices, excludedFormatIndices,
- options.ArchivePathsSorted,
- options.ArchivePathsFullSorted,
+ ArchivePathsSorted,
+ ArchivePathsFullSorted,
options.Censor.Pairs.Front().Head,
eo,
#ifndef _SFX
@@ -291,7 +319,7 @@ static int Main2()
else if (options.Command.CommandType == NCommandType::kHash)
{
bool messageWasDisplayed = false;
- HRESULT result = HashCalcGUI(EXTERNAL_CODECS_VARS
+ HRESULT result = HashCalcGUI(EXTERNAL_CODECS_VARS_L
options.Censor, options.HashOptions, messageWasDisplayed);
if (result != S_OK)
diff --git a/CPP/7zip/UI/GUI/GUI.dsp b/CPP/7zip/UI/GUI/GUI.dsp
index 1cbdbfd4..63cdb2fd 100644
--- a/CPP/7zip/UI/GUI/GUI.dsp
+++ b/CPP/7zip/UI/GUI/GUI.dsp
@@ -45,7 +45,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /Gr /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
@@ -72,7 +72,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 "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /Gz /MDd /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /Gr /MDd /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "_DEBUG"
@@ -99,7 +99,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /Gz /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /Gr /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
@@ -127,7 +127,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /Gz /MDd /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /Gr /MDd /W4 /WX /Gm /GX /ZI /Od /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "_DEBUG"
@@ -513,6 +513,14 @@ SOURCE=..\FileManager\ProgramLocation.h
# End Source File
# Begin Source File
+SOURCE=..\FileManager\PropertyName.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\FileManager\PropertyName.h
+# End Source File
+# Begin Source File
+
SOURCE=..\FileManager\RegistryUtils.cpp
# End Source File
# Begin Source File
@@ -577,6 +585,14 @@ SOURCE=.\UpdateCallbackGUI.h
# End Source File
# Begin Source File
+SOURCE=.\UpdateCallbackGUI2.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\UpdateCallbackGUI2.h
+# End Source File
+# Begin Source File
+
SOURCE=.\UpdateGUI.cpp
# End Source File
# Begin Source File
diff --git a/CPP/7zip/UI/GUI/HashGUI.cpp b/CPP/7zip/UI/GUI/HashGUI.cpp
index 903e41fc..3eb7d7d4 100644
--- a/CPP/7zip/UI/GUI/HashGUI.cpp
+++ b/CPP/7zip/UI/GUI/HashGUI.cpp
@@ -22,7 +22,6 @@ using namespace NWindows;
class CHashCallbackGUI: public CProgressThreadVirt, public IHashCallbackUI
{
UInt64 NumFiles;
- UStringVector FailedFiles;
bool _curIsFolder;
UString FirstFileName;
@@ -45,33 +44,28 @@ public:
}
};
-static void NewLine(UString &s)
-{
- s += L'\n';
-}
-
static void AddValuePair(UString &s, UINT resourceID, UInt64 value)
{
- s += LangString(resourceID);
- s += L": ";
- wchar_t sz[32];
+ AddLangString(s, resourceID);
+ s.AddAscii(": ");
+ char sz[32];
ConvertUInt64ToString(value, sz);
- s += sz;
- NewLine(s);
+ s.AddAscii(sz);
+ s.Add_LF();
}
static void AddSizeValuePair(UString &s, UINT resourceID, UInt64 value)
{
- s += LangString(resourceID);
- s += L": ";
+ AddLangString(s, resourceID);
+ s.AddAscii(": ");
wchar_t sz[32];
ConvertUInt64ToString(value, sz);
s += MyFormatNew(IDS_FILE_SIZE, sz);
ConvertUInt64ToString(value >> 20, sz);
- s += L" (";
+ s.AddAscii(" (");
s += sz;
- s += L" MB)";
- NewLine(s);
+ s.AddAscii(" MB)");
+ s.Add_LF();
}
HRESULT CHashCallbackGUI::StartScanning()
@@ -81,23 +75,20 @@ HRESULT CHashCallbackGUI::StartScanning()
return CheckBreak();
}
-HRESULT CHashCallbackGUI::ScanProgress(UInt64 /* numFolders */, UInt64 numFiles, UInt64 totalSize, const wchar_t *path, bool isDir)
+HRESULT CHashCallbackGUI::ScanProgress(const CDirItemsStat &st, const FString &path, bool isDir)
{
- return ProgressDialog.Sync.ScanProgress(numFiles, totalSize, path, isDir);
+ return ProgressDialog.Sync.ScanProgress(st.NumFiles, st.GetTotalBytes(), path, isDir);
}
-HRESULT CHashCallbackGUI::CanNotFindError(const wchar_t *name, DWORD systemError)
+HRESULT CHashCallbackGUI::ScanError(const FString &path, DWORD systemError)
{
- FailedFiles.Add(name);
- AddErrorMessage(systemError, name);
+ AddErrorMessage(systemError, fs2us(path));
return CheckBreak();
}
-HRESULT CHashCallbackGUI::FinishScanning()
+HRESULT CHashCallbackGUI::FinishScanning(const CDirItemsStat &st)
{
- CProgressSync &sync = ProgressDialog.Sync;
- sync.Set_FilePath(L"");
- return CheckBreak();
+ return ScanProgress(st, FString(), false);
}
HRESULT CHashCallbackGUI::CheckBreak()
@@ -139,12 +130,11 @@ HRESULT CHashCallbackGUI::GetStream(const wchar_t *name, bool isFolder)
return CheckBreak();
}
-HRESULT CHashCallbackGUI::OpenFileError(const wchar_t *name, DWORD systemError)
+HRESULT CHashCallbackGUI::OpenFileError(const FString &path, DWORD systemError)
{
- FailedFiles.Add(name);
// if (systemError == ERROR_SHARING_VIOLATION)
{
- AddErrorMessage(systemError, name);
+ AddErrorMessage(systemError, fs2us(path));
return S_FALSE;
}
// return systemError;
@@ -159,20 +149,22 @@ HRESULT CHashCallbackGUI::SetOperationResult(UInt64 /* fileSize */, const CHashB
return CheckBreak();
}
-static void AddHashString(UString &s, const CHasherState &h, int digestIndex, const wchar_t *title)
+static void AddHashString(UString &s, const CHasherState &h, unsigned digestIndex, const wchar_t *title)
{
s += title;
- s += L' ';
+ s.Add_Space();
char temp[k_HashCalc_DigestSize_Max * 2 + 4];
AddHashHexToString(temp, h.Digests[digestIndex], h.DigestSize);
- s.AddAsciiStr(temp);
- NewLine(s);
+ s.AddAscii(temp);
+ s.Add_LF();
}
-static void AddHashResString(UString &s, const CHasherState &h, int digestIndex, UInt32 resID)
+static void AddHashResString(UString &s, const CHasherState &h, unsigned digestIndex, UInt32 resID)
{
UString s2 = LangString(resID);
- s2.Replace(L"CRC", h.Name);
+ UString name;
+ name.SetFromAscii(h.Name);
+ s2.Replace(L"CRC", name);
AddHashString(s, h, digestIndex, s2);
}
@@ -181,14 +173,14 @@ void AddHashBundleRes(UString &s, const CHashBundle &hb, const UString &firstFil
if (hb.NumErrors != 0)
{
AddValuePair(s, IDS_PROP_NUM_ERRORS, hb.NumErrors);
- NewLine(s);
+ s.Add_LF();
}
if (hb.NumFiles == 1 && hb.NumDirs == 0 && !firstFileName.IsEmpty())
{
- s += LangString(IDS_PROP_NAME);
- s += L": ";
+ AddLangString(s, IDS_PROP_NAME);
+ s.AddAscii(": ");
s += firstFileName;
- NewLine(s);
+ s.Add_LF();
}
else
{
@@ -200,23 +192,23 @@ void AddHashBundleRes(UString &s, const CHashBundle &hb, const UString &firstFil
if (hb.NumAltStreams != 0)
{
- NewLine(s);
+ s.Add_LF();
AddValuePair(s, IDS_PROP_NUM_ALT_STREAMS, hb.NumAltStreams);
AddSizeValuePair(s, IDS_PROP_ALT_STREAMS_SIZE, hb.AltStreamsSize);
}
FOR_VECTOR (i, hb.Hashers)
{
- NewLine(s);
+ s.Add_LF();
const CHasherState &h = hb.Hashers[i];
if (hb.NumFiles == 1 && hb.NumDirs == 0)
{
- s += h.Name;
+ s.AddAscii(h.Name);
AddHashString(s, h, k_HashCalc_Index_DataSum, L":");
}
else
{
- AddHashResString(s, h, k_HashCalc_Index_DataSum, IDS_CHECKSUM_CRC_DATA);
+ AddHashResString(s, h, k_HashCalc_Index_DataSum, IDS_CHECKSUM_CRC_DATA);
AddHashResString(s, h, k_HashCalc_Index_NamesSum, IDS_CHECKSUM_CRC_DATA_NAMES);
}
if (hb.NumAltStreams != 0)
@@ -245,7 +237,7 @@ HRESULT CHashCallbackGUI::ProcessVirt()
{
NumFiles = 0;
- UString errorInfo;
+ AString errorInfo;
HRESULT res = HashCalc(EXTERNAL_CODECS_LOC_VARS
*censor, *options, errorInfo, this);
@@ -270,7 +262,8 @@ HRESULT HashCalcGUI(
const UString title = LangString(IDS_CHECKSUM_CALCULATING);
t.ProgressDialog.MainTitle = L"7-Zip"; // LangString(IDS_APP_TITLE);
- t.ProgressDialog.MainAddTitle = title + L' ';
+ t.ProgressDialog.MainAddTitle = title;
+ t.ProgressDialog.MainAddTitle.Add_Space();
RINOK(t.Create(title));
messageWasDisplayed = t.ThreadFinishedOK && t.ProgressDialog.MessagesDisplayed;
diff --git a/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp b/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
index 36af147b..240f4880 100644
--- a/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
+++ b/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
@@ -7,7 +7,7 @@
#include "../../../Windows/PropVariant.h"
-#include "../FileManager/PasswordDialog.h"
+#include "../FileManager/FormatUtils.h"
#include "../FileManager/LangUtils.h"
#include "../FileManager/resourceGUI.h"
@@ -18,29 +18,26 @@
using namespace NWindows;
-CUpdateCallbackGUI::~CUpdateCallbackGUI() {}
+// CUpdateCallbackGUI::~CUpdateCallbackGUI() {}
void CUpdateCallbackGUI::Init()
{
+ CUpdateCallbackGUI2::Init();
FailedFiles.Clear();
- NumFiles = 0;
}
-HRESULT CUpdateCallbackGUI::OpenResult(const wchar_t *name, HRESULT result, const wchar_t *errorArcType)
+void OpenResult_GUI(UString &s, const CCodecs *codecs, const CArchiveLink &arcLink, const wchar_t *name, HRESULT result);
+
+HRESULT CUpdateCallbackGUI::OpenResult(
+ const CCodecs *codecs, const CArchiveLink &arcLink, const wchar_t *name, HRESULT result)
{
- if (result != S_OK)
+ UString s;
+ OpenResult_GUI(s, codecs, arcLink, name, result);
+ if (!s.IsEmpty())
{
- UString s;
- if (errorArcType)
- {
- s += L"Can not open the file as [";
- s += errorArcType;
- s += L"] archive";
- }
- else
- s += L"The file is not supported archive";
- ProgressDialog->Sync.AddError_Message_Name(s, name);
+ ProgressDialog->Sync.AddError_Message(s);
}
+
return S_OK;
}
@@ -51,16 +48,18 @@ HRESULT CUpdateCallbackGUI::StartScanning()
return S_OK;
}
-HRESULT CUpdateCallbackGUI::CanNotFindError(const wchar_t *name, DWORD systemError)
+HRESULT CUpdateCallbackGUI::ScanError(const FString &path, DWORD systemError)
{
- FailedFiles.Add(name);
- ProgressDialog->Sync.AddError_Code_Name(systemError, name);
+ FailedFiles.Add(path);
+ ProgressDialog->Sync.AddError_Code_Name(systemError, fs2us(path));
return S_OK;
}
-HRESULT CUpdateCallbackGUI::FinishScanning()
+HRESULT CUpdateCallbackGUI::FinishScanning(const CDirItemsStat &st)
{
CProgressSync &sync = ProgressDialog->Sync;
+ RINOK(ProgressDialog->Sync.ScanProgress(st.NumFiles + st.NumAltStreams,
+ st.GetTotalBytes(), FString(), true));
sync.Set_Status(L"");
return S_OK;
}
@@ -73,7 +72,7 @@ HRESULT CUpdateCallbackGUI::StartArchive(const wchar_t *name, bool /* updating *
return S_OK;
}
-HRESULT CUpdateCallbackGUI::FinishArchive()
+HRESULT CUpdateCallbackGUI::FinishArchive(const CFinishArchiveStat & /* st */)
{
CProgressSync &sync = ProgressDialog->Sync;
sync.Set_Status(L"");
@@ -85,19 +84,22 @@ HRESULT CUpdateCallbackGUI::CheckBreak()
return ProgressDialog->Sync.CheckStop();
}
-HRESULT CUpdateCallbackGUI::ScanProgress(UInt64 /* numFolders */, UInt64 numFiles, UInt64 totalSize, const wchar_t *path, bool isDir)
+HRESULT CUpdateCallbackGUI::ScanProgress(const CDirItemsStat &st, const FString &path, bool isDir)
{
- return ProgressDialog->Sync.ScanProgress(numFiles, totalSize, path, isDir);
+ return ProgressDialog->Sync.ScanProgress(st.NumFiles + st.NumAltStreams,
+ st.GetTotalBytes(), path, isDir);
}
-HRESULT CUpdateCallbackGUI::Finilize()
+/*
+HRESULT CUpdateCallbackGUI::Finalize()
{
return S_OK;
}
+*/
-HRESULT CUpdateCallbackGUI::SetNumFiles(UInt64 numFiles)
+HRESULT CUpdateCallbackGUI::SetNumItems(UInt64 numItems)
{
- ProgressDialog->Sync.Set_NumFilesTotal(numFiles);
+ ProgressDialog->Sync.Set_NumFilesTotal(numItems);
return S_OK;
}
@@ -118,18 +120,17 @@ HRESULT CUpdateCallbackGUI::SetRatioInfo(const UInt64 *inSize, const UInt64 *out
return CheckBreak();
}
-HRESULT CUpdateCallbackGUI::GetStream(const wchar_t *name, bool /* isAnti */)
+HRESULT CUpdateCallbackGUI::GetStream(const wchar_t *name, bool isDir, bool /* isAnti */, UInt32 mode)
{
- ProgressDialog->Sync.Set_FilePath(name);
- return S_OK;
+ return SetOperation_Base(mode, name, isDir);
}
-HRESULT CUpdateCallbackGUI::OpenFileError(const wchar_t *name, DWORD systemError)
+HRESULT CUpdateCallbackGUI::OpenFileError(const FString &path, DWORD systemError)
{
- FailedFiles.Add(name);
+ FailedFiles.Add(path);
// if (systemError == ERROR_SHARING_VIOLATION)
{
- ProgressDialog->Sync.AddError_Code_Name(systemError, name);
+ ProgressDialog->Sync.AddError_Code_Name(systemError, fs2us(path));
return S_FALSE;
}
// return systemError;
@@ -142,22 +143,37 @@ HRESULT CUpdateCallbackGUI::SetOperationResult(Int32 /* operationResult */)
return S_OK;
}
+void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, const wchar_t *fileName, UString &s);
+
+HRESULT CUpdateCallbackGUI::ReportExtractResult(Int32 opRes, Int32 isEncrypted, const wchar_t *name)
+{
+ if (opRes != NArchive::NExtract::NOperationResult::kOK)
+ {
+ UString s;
+ SetExtractErrorMessage(opRes, isEncrypted, name, s);
+ ProgressDialog->Sync.AddError_Message(s);
+ }
+ return S_OK;
+}
+
+HRESULT CUpdateCallbackGUI::ReportUpdateOpeartion(UInt32 op, const wchar_t *name, bool isDir)
+{
+ return SetOperation_Base(op, name, isDir);
+}
+
HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{
*password = NULL;
+ if (passwordIsDefined)
+ *passwordIsDefined = BoolToInt(PasswordIsDefined);
if (!PasswordIsDefined)
{
- if (passwordIsDefined == 0 || AskPassword)
+ if (AskPassword)
{
- CPasswordDialog dialog;
- ProgressDialog->WaitCreating();
- if (dialog.Create(*ProgressDialog) != IDOK)
- return E_ABORT;
- Password = dialog.Password;
- PasswordIsDefined = true;
+ RINOK(ShowAskPasswordDialog())
}
}
- if (passwordIsDefined != 0)
+ if (passwordIsDefined)
*passwordIsDefined = BoolToInt(PasswordIsDefined);
return StringToBstr(Password, password);
}
@@ -201,6 +217,7 @@ HRESULT CUpdateCallbackGUI::Open_CryptoGetTextPassword(BSTR *password)
return CryptoGetTextPassword2(NULL, password);
}
+/*
HRESULT CUpdateCallbackGUI::Open_GetPasswordIfAny(bool &passwordIsDefined, UString &password)
{
passwordIsDefined = PasswordIsDefined;
@@ -213,17 +230,51 @@ bool CUpdateCallbackGUI::Open_WasPasswordAsked()
return PasswordWasAsked;
}
-void CUpdateCallbackGUI::Open_ClearPasswordWasAskedFlag()
+void CUpdateCallbackGUI::Open_Clear_PasswordWasAsked_Flag()
{
PasswordWasAsked = false;
}
+*/
-/*
-HRESULT CUpdateCallbackGUI::ShowDeleteFile(const wchar_t *name)
+HRESULT CUpdateCallbackGUI::ShowDeleteFile(const wchar_t *name, bool isDir)
{
- ProgressDialog->Sync.SetCurrentFileName(name);
+ return SetOperation_Base(NUpdateNotifyOp::kDelete, name, isDir);
+}
+
+HRESULT CUpdateCallbackGUI::FinishDeletingAfterArchiving()
+{
+ // ClosePercents2();
+ return S_OK;
+}
+
+HRESULT CUpdateCallbackGUI::DeletingAfterArchiving(const FString &path, bool isDir)
+{
+ return ProgressDialog->Sync.Set_Status2(_lang_Removing, fs2us(path), isDir);
+}
+
+HRESULT CUpdateCallbackGUI::StartOpenArchive(const wchar_t * /* name */)
+{
+ return S_OK;
+}
+
+HRESULT CUpdateCallbackGUI::ReadingFileError(const FString &path, DWORD systemError)
+{
+ FailedFiles.Add(path);
+ ProgressDialog->Sync.AddError_Code_Name(systemError, fs2us(path));
+ return S_OK;
+}
+
+HRESULT CUpdateCallbackGUI::WriteSfx(const wchar_t * /* name */, UInt64 /* size */)
+{
+ CProgressSync &sync = ProgressDialog->Sync;
+ sync.Set_Status(L"WriteSfx");
+ return S_OK;
+}
+
+HRESULT CUpdateCallbackGUI::Open_Finished()
+{
+ // ClosePercents();
return S_OK;
}
-*/
#endif
diff --git a/CPP/7zip/UI/GUI/UpdateCallbackGUI.h b/CPP/7zip/UI/GUI/UpdateCallbackGUI.h
index 21b6f432..2e0c111b 100644
--- a/CPP/7zip/UI/GUI/UpdateCallbackGUI.h
+++ b/CPP/7zip/UI/GUI/UpdateCallbackGUI.h
@@ -5,34 +5,30 @@
#include "../Common/Update.h"
#include "../Common/ArchiveOpenCallback.h"
-#include "../FileManager/ProgressDialog2.h"
+
+#include "UpdateCallbackGUI2.h"
class CUpdateCallbackGUI:
public IOpenCallbackUI,
- public IUpdateCallbackUI2
+ public IUpdateCallbackUI2,
+ public CUpdateCallbackGUI2
{
public:
- bool PasswordIsDefined;
- UString Password;
+ // CUpdateCallbackGUI();
+ // ~CUpdateCallbackGUI();
+
bool AskPassword;
- bool PasswordWasAsked;
- UInt64 NumFiles;
+
+ void Init();
CUpdateCallbackGUI():
- PasswordIsDefined(false),
- PasswordWasAsked(false),
AskPassword(false)
{}
-
- ~CUpdateCallbackGUI();
- void Init();
INTERFACE_IUpdateCallbackUI2(;)
INTERFACE_IOpenCallbackUI(;)
- UStringVector FailedFiles;
-
- CProgressDialog *ProgressDialog;
+ FStringVector FailedFiles;
};
#endif
diff --git a/CPP/7zip/UI/GUI/UpdateCallbackGUI2.cpp b/CPP/7zip/UI/GUI/UpdateCallbackGUI2.cpp
new file mode 100644
index 00000000..4eeead7d
--- /dev/null
+++ b/CPP/7zip/UI/GUI/UpdateCallbackGUI2.cpp
@@ -0,0 +1,59 @@
+// UpdateCallbackGUI2.cpp
+
+#include "StdAfx.h"
+
+#include "../FileManager/LangUtils.h"
+#include "../FileManager/PasswordDialog.h"
+
+#include "resource2.h"
+#include "resource3.h"
+#include "ExtractRes.h"
+
+#include "UpdateCallbackGUI.h"
+
+using namespace NWindows;
+
+static const UINT k_UpdNotifyLangs[] =
+{
+ IDS_PROGRESS_ADD,
+ IDS_PROGRESS_UPDATE,
+ IDS_PROGRESS_ANALYZE,
+ IDS_PROGRESS_REPLICATE,
+ IDS_PROGRESS_REPACK,
+ IDS_PROGRESS_SKIPPING,
+ IDS_PROGRESS_DELETE,
+ IDS_PROGRESS_HEADER
+};
+
+void CUpdateCallbackGUI2::Init()
+{
+ NumFiles = 0;
+
+ _lang_Removing = LangString(IDS_PROGRESS_REMOVE);
+ _lang_Ops.Clear();
+ for (unsigned i = 0; i < ARRAY_SIZE(k_UpdNotifyLangs); i++)
+ _lang_Ops.Add(LangString(k_UpdNotifyLangs[i]));
+}
+
+HRESULT CUpdateCallbackGUI2::SetOperation_Base(UInt32 notifyOp, const wchar_t *name, bool isDir)
+{
+ const UString *s = NULL;
+ if (notifyOp < _lang_Ops.Size())
+ s = &(_lang_Ops[(unsigned)notifyOp]);
+ else
+ s = &_emptyString;
+
+ return ProgressDialog->Sync.Set_Status2(*s, name, isDir);
+}
+
+
+HRESULT CUpdateCallbackGUI2::ShowAskPasswordDialog()
+{
+ CPasswordDialog dialog;
+ ProgressDialog->WaitCreating();
+ if (dialog.Create(*ProgressDialog) != IDOK)
+ return E_ABORT;
+ Password = dialog.Password;
+ PasswordIsDefined = true;
+ return S_OK;
+}
diff --git a/CPP/7zip/UI/GUI/UpdateCallbackGUI2.h b/CPP/7zip/UI/GUI/UpdateCallbackGUI2.h
new file mode 100644
index 00000000..2b30ad21
--- /dev/null
+++ b/CPP/7zip/UI/GUI/UpdateCallbackGUI2.h
@@ -0,0 +1,35 @@
+// UpdateCallbackGUI2.h
+
+#ifndef __UPDATE_CALLBACK_GUI2_H
+#define __UPDATE_CALLBACK_GUI2_H
+
+#include "../FileManager/ProgressDialog2.h"
+
+class CUpdateCallbackGUI2
+{
+ UStringVector _lang_Ops;
+ UString _emptyString;
+public:
+ UString Password;
+ bool PasswordIsDefined;
+ bool PasswordWasAsked;
+ UInt64 NumFiles;
+
+ UString _lang_Removing;
+
+ CUpdateCallbackGUI2():
+ PasswordIsDefined(false),
+ PasswordWasAsked(false),
+ NumFiles(0)
+ {}
+
+ // ~CUpdateCallbackGUI2();
+ void Init();
+
+ CProgressDialog *ProgressDialog;
+
+ HRESULT SetOperation_Base(UInt32 notifyOp, const wchar_t *name, bool isDir);
+ HRESULT ShowAskPasswordDialog();
+};
+
+#endif
diff --git a/CPP/7zip/UI/GUI/UpdateGUI.cpp b/CPP/7zip/UI/GUI/UpdateGUI.cpp
index a7af4e94..64501306 100644
--- a/CPP/7zip/UI/GUI/UpdateGUI.cpp
+++ b/CPP/7zip/UI/GUI/UpdateGUI.cpp
@@ -6,7 +6,7 @@
#include "../../../Common/StringConvert.h"
#include "../../../Common/StringToInt.h"
-// #include "../../../Windows/Error.h"
+#include "../../../Windows/DLL.h"
#include "../../../Windows/FileDir.h"
#include "../../../Windows/FileName.h"
#include "../../../Windows/Thread.h"
@@ -54,9 +54,8 @@ HRESULT CThreadUpdating::ProcessVirt()
HRESULT res = UpdateArchive(codecs, *formatIndices, *cmdArcPath,
*WildcardCensor, *Options,
ei, UpdateCallbackGUI, UpdateCallbackGUI, needSetPath);
- FinalMessage.ErrorMessage.Message = ei.Message;
- SetErrorPath1(ei.FileName);
- SetErrorPath2(ei.FileName2);
+ FinalMessage.ErrorMessage.Message.SetFromAscii(ei.Message);
+ ErrorPaths = ei.FileNames;
if (ei.SystemError != S_OK && ei.SystemError != E_FAIL && ei.SystemError != E_ABORT)
return ei.SystemError;
return res;
@@ -260,7 +259,7 @@ static HRESULT ShowDialog(
FOR_VECTOR (i, item.PathParts)
{
if (i > 0)
- name += WCHAR_PATH_SEPARATOR;
+ name.Add_PathSepar();
name += item.PathParts[i];
}
if (fileInfo.Find(us2fs(name)))
@@ -306,8 +305,8 @@ static HRESULT ShowDialog(
if (!oneFile && ai.Flags_KeepName())
continue;
if ((int)i != di.FormatIndex)
- if (ai.Name.IsEqualToNoCase(L"swfc"))
- if (!oneFile || name.Len() < 4 || !StringsAreEqualNoCase(name.RightPtr(4), L".swf"))
+ if (ai.Name.IsEqualTo_Ascii_NoCase("swfc"))
+ if (!oneFile || name.Len() < 4 || !StringsAreEqualNoCase_Ascii(name.RightPtr(4), ".swf"))
continue;
dialog.ArcIndices.Add(i);
}
@@ -387,7 +386,7 @@ static HRESULT ShowDialog(
options.MethodMode.Properties.Clear();
- bool is7z = archiverInfo.Name.IsEqualToNoCase(L"7z");
+ bool is7z = archiverInfo.Name.IsEqualTo_Ascii_NoCase("7z");
bool methodOverride = IsThereMethodOverride(is7z, di.Options);
SetOutProperties(
diff --git a/CPP/7zip/UI/GUI/makefile b/CPP/7zip/UI/GUI/makefile
index 60cfcd4b..bcafa0e5 100644
--- a/CPP/7zip/UI/GUI/makefile
+++ b/CPP/7zip/UI/GUI/makefile
@@ -18,6 +18,7 @@ GUI_OBJS = \
$O\GUI.obj \
$O\HashGUI.obj \
$O\UpdateCallbackGUI.obj \
+ $O\UpdateCallbackGUI2.obj \
$O\UpdateGUI.obj \
COMMON_OBJS = \
@@ -107,6 +108,7 @@ FM_OBJS = \
$O\LangUtils.obj \
$O\OpenCallback.obj \
$O\ProgramLocation.obj \
+ $O\PropertyName.obj \
$O\RegistryUtils.obj \
$O\SplitUtils.obj \
$O\StringUtils.obj \
diff --git a/CPP/7zip/UI/GUI/resource.rc b/CPP/7zip/UI/GUI/resource.rc
index 0f7c6235..13a09c64 100644
--- a/CPP/7zip/UI/GUI/resource.rc
+++ b/CPP/7zip/UI/GUI/resource.rc
@@ -2,6 +2,8 @@
// #include <winnt.h>
#include "resource2.rc"
+#include "resource3.rc"
+
#include "../FileManager/resourceGui.rc"
MY_VERSION_INFO(MY_VFT_APP, "7-Zip GUI", "7zg", "7zg.exe")
diff --git a/CPP/7zip/UI/GUI/resource3.h b/CPP/7zip/UI/GUI/resource3.h
new file mode 100644
index 00000000..1758d525
--- /dev/null
+++ b/CPP/7zip/UI/GUI/resource3.h
@@ -0,0 +1,10 @@
+#define IDS_PROGRESS_REMOVE 3305
+
+#define IDS_PROGRESS_ADD 3320
+#define IDS_PROGRESS_UPDATE 3321
+#define IDS_PROGRESS_ANALYZE 3322
+#define IDS_PROGRESS_REPLICATE 3323
+#define IDS_PROGRESS_REPACK 3324
+
+#define IDS_PROGRESS_DELETE 3326
+#define IDS_PROGRESS_HEADER 3327
diff --git a/CPP/7zip/UI/GUI/resource3.rc b/CPP/7zip/UI/GUI/resource3.rc
new file mode 100644
index 00000000..cfc8bc35
--- /dev/null
+++ b/CPP/7zip/UI/GUI/resource3.rc
@@ -0,0 +1,15 @@
+#include "resource3.h"
+
+STRINGTABLE
+BEGIN
+ IDS_PROGRESS_REMOVE "Removing"
+
+ IDS_PROGRESS_ADD "Adding"
+ IDS_PROGRESS_UPDATE "Updating"
+ IDS_PROGRESS_ANALYZE "Analyzing"
+ IDS_PROGRESS_REPLICATE "Replicating"
+ IDS_PROGRESS_REPACK "Repacking"
+
+ IDS_PROGRESS_DELETE "Deleting"
+ IDS_PROGRESS_HEADER "Header creating"
+END