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:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2009-06-02 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:59 +0300
commit829409452d85cd6dd9dfc9151f109d6e13a2bb1c (patch)
treee0acaea47044d167f35fa197584dee1bde41c329 /CPP/7zip/UI/GUI
parent8874e4fbc9faabdcff719b9b2ac8ebad4f282bbe (diff)
9.04 beta
Diffstat (limited to 'CPP/7zip/UI/GUI')
-rwxr-xr-xCPP/7zip/UI/GUI/CompressDialog.cpp142
-rwxr-xr-xCPP/7zip/UI/GUI/CompressDialog.h19
-rwxr-xr-xCPP/7zip/UI/GUI/CompressDialog.rc2
-rwxr-xr-xCPP/7zip/UI/GUI/ExtractGUI.cpp25
-rwxr-xr-xCPP/7zip/UI/GUI/GUI.cpp32
-rwxr-xr-xCPP/7zip/UI/GUI/GUI.dsp76
-rwxr-xr-xCPP/7zip/UI/GUI/UpdateCallbackGUI.cpp15
-rwxr-xr-xCPP/7zip/UI/GUI/UpdateGUI.cpp22
-rwxr-xr-xCPP/7zip/UI/GUI/makefile7
9 files changed, 201 insertions, 139 deletions
diff --git a/CPP/7zip/UI/GUI/CompressDialog.cpp b/CPP/7zip/UI/GUI/CompressDialog.cpp
index 64ee31d8..04a40a43 100755
--- a/CPP/7zip/UI/GUI/CompressDialog.cpp
+++ b/CPP/7zip/UI/GUI/CompressDialog.cpp
@@ -2,19 +2,19 @@
#include "StdAfx.h"
-#include "resource.h"
#include "Common/Defs.h"
-#include "Common/StringConvert.h"
#include "Common/IntToString.h"
+#include "Common/StringConvert.h"
+
#include "Windows/CommonDialog.h"
#include "Windows/FileDir.h"
#include "Windows/FileName.h"
#include "Windows/ResourceString.h"
#include "Windows/System.h"
+#include "../FileManager/FormatUtils.h"
#include "../FileManager/HelpUtils.h"
#include "../FileManager/SplitUtils.h"
-#include "../FileManager/FormatUtils.h"
#include "../Explorer/MyMessages.h"
@@ -22,6 +22,8 @@
#include "CompressDialog.h"
+#include "resource.h"
+
#ifndef _UNICODE
extern bool g_IsNT;
#endif
@@ -112,6 +114,7 @@ enum EMethodID
{
kCopy,
kLZMA,
+ kLZMA2,
kPPMd,
kBZip2,
kDeflate,
@@ -122,6 +125,7 @@ static const LPCWSTR kMethodsNames[] =
{
L"Copy",
L"LZMA",
+ L"LZMA2",
L"PPMd",
L"BZip2",
L"Deflate",
@@ -131,6 +135,7 @@ static const LPCWSTR kMethodsNames[] =
static const EMethodID g_7zMethods[] =
{
kLZMA,
+ kLZMA2,
kPPMd,
kBZip2
};
@@ -139,6 +144,7 @@ static const EMethodID g_7zSfxMethods[] =
{
kCopy,
kLZMA,
+ kLZMA2,
kPPMd
};
@@ -160,6 +166,11 @@ static EMethodID g_BZip2Methods[] =
kBZip2
};
+static EMethodID g_XzMethods[] =
+{
+ kLZMA2
+};
+
struct CFormatInfo
{
LPCWSTR Name;
@@ -206,7 +217,13 @@ static const CFormatInfo g_Formats[] =
L"BZip2",
(1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
METHODS_PAIR(g_BZip2Methods),
- false, false, true, false, false
+ false, false, true, false, false, false
+ },
+ {
+ L"xz",
+ (1 << 1) | (1 << 3) | (1 << 5) | (1 << 7) | (1 << 9),
+ METHODS_PAIR(g_XzMethods),
+ false, false, true, false, false, false
},
{
L"Tar",
@@ -273,20 +290,23 @@ bool CCompressDialog::OnInit()
Info.ArchiverInfoIndex = 0;
int i;
- for(i = 0; i < m_ArchiverInfoList.Size(); i++)
+ for (i = 0; i < m_ArchiverInfoList.Size(); i++)
{
const CArcInfoEx &ai = m_ArchiverInfoList[i];
- m_Format.AddString(ai.Name);
- if (ai.Name.CompareNoCase(m_RegistryInfo.ArchiveType) == 0)
+ int index = (int)m_Format.AddString(ai.Name);
+ m_Format.SetItemData(index, i);
+ if (ai.Name.CompareNoCase(m_RegistryInfo.ArchiveType) == 0 || i == 0)
+ {
+ m_Format.SetCurSel(index);
Info.ArchiverInfoIndex = i;
+ }
}
- m_Format.SetCurSel(Info.ArchiverInfoIndex);
SetArchiveName(Info.ArchiveName);
SetLevel();
SetParams();
- for(i = 0; i < m_RegistryInfo.HistoryArchives.Size() && i < kHistorySize; i++)
+ for (i = 0; i < m_RegistryInfo.HistoryArchives.Size() && i < kHistorySize; i++)
m_ArchivePath.AddString(m_RegistryInfo.HistoryArchives[i]);
m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_ADD, 0x02000DA1));
@@ -300,7 +320,7 @@ bool CCompressDialog::OnInit()
SetNumThreads();
TCHAR s[40] = { TEXT('/'), TEXT(' '), 0 };
- ConvertUInt64ToString(NSystem::GetNumberOfProcessors(), s + 2);
+ ConvertUInt32ToString(NSystem::GetNumberOfProcessors(), s + 2);
SetItemText(IDC_COMPRESS_HARDWARE_THREADS, s);
CheckButton(IDC_COMPRESS_SFX, Info.SFXMode);
@@ -423,7 +443,7 @@ bool CCompressDialog::IsSFX()
void CCompressDialog::OnButtonSFX()
{
- SetMethod();
+ SetMethod(GetMethodID());
UString fileName;
m_ArchivePath.GetText(fileName);
@@ -431,8 +451,7 @@ void CCompressDialog::OnButtonSFX()
int slashPos = fileName.ReverseFind(WCHAR_PATH_SEPARATOR);
if (dotPos < 0 || dotPos <= slashPos)
dotPos = -1;
- bool isSFX = IsSFX();
- if (isSFX)
+ if (IsSFX())
{
if (dotPos >= 0)
fileName = fileName.Left(dotPos);
@@ -545,7 +564,7 @@ void CCompressDialog::OnOK()
Info.Method = GetMethodSpec();
Info.EncryptionMethod = GetEncryptionMethodSpec();
- Info.ArchiverInfoIndex = m_Format.GetCurSel();
+ Info.ArchiverInfoIndex = GetFormatIndex();
Info.SFXMode = IsSFX();
Info.OpenShareForWrite = IsButtonCheckedBool(IDC_COMPRESS_SHARED);
@@ -577,7 +596,7 @@ void CCompressDialog::OnOK()
}
}
- for(int i = 0; i < m_ArchivePath.GetCount(); i++)
+ for (int i = 0; i < m_ArchivePath.GetCount(); i++)
{
UString sTemp;
m_ArchivePath.GetLBText(i, sTemp);
@@ -624,7 +643,7 @@ bool CCompressDialog::OnCommand(int code, int itemID, LPARAM lParam)
}
case IDC_COMPRESS_COMBO_LEVEL:
{
- const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
int index = FindRegistryFormatAlways(ai.Name);
NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
fo.ResetForLevelChange();
@@ -697,7 +716,7 @@ void CCompressDialog::SetArchiveName2(bool prevWasSFX)
void CCompressDialog::SetArchiveName(const UString &name)
{
UString fileName = name;
- Info.ArchiverInfoIndex = m_Format.GetCurSel();
+ Info.ArchiverInfoIndex = GetFormatIndex();
const CArcInfoEx &ai = m_ArchiverInfoList[Info.ArchiverInfoIndex];
m_PrevFormat = Info.ArchiverInfoIndex;
if (ai.KeepName)
@@ -750,7 +769,7 @@ int CCompressDialog::FindRegistryFormatAlways(const UString &name)
int CCompressDialog::GetStaticFormatIndex()
{
- int formatIndex = m_Format.GetCurSel();
+ int formatIndex = GetFormatIndex();
const CArcInfoEx &ai = m_ArchiverInfoList[formatIndex];
for (int i = 0; i < MY_SIZE_OF_ARRAY(g_Formats); i++)
if (ai.Name.CompareNoCase(g_Formats[i].Name) == 0)
@@ -774,7 +793,7 @@ void CCompressDialog::SetLevel()
{
m_Level.ResetContent();
const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
UInt32 level = kNormal;
if (index >= 0)
@@ -799,7 +818,7 @@ void CCompressDialog::SetLevel()
SetMethod();
}
-void CCompressDialog::SetMethod()
+void CCompressDialog::SetMethod(int keepMethodId)
{
m_Method.ResetContent();
UInt32 level = GetLevel();
@@ -810,7 +829,7 @@ void CCompressDialog::SetMethod()
return;
}
const CFormatInfo &fi = g_Formats[GetStaticFormatIndex()];
- const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
UString defaultMethod;
if (index >= 0)
@@ -819,7 +838,8 @@ void CCompressDialog::SetMethod()
defaultMethod = fo.Method;
}
bool isSfx = IsSFX();
- for(int m = 0; m < fi.NumMethods; m++)
+ bool weUseSameMethod = false;
+ for (int m = 0; m < fi.NumMethods; m++)
{
EMethodID methodID = fi.MathodIDs[m];
if (isSfx)
@@ -827,23 +847,32 @@ void CCompressDialog::SetMethod()
continue;
const LPCWSTR method = kMethodsNames[methodID];
int itemIndex = (int)m_Method.AddString(GetSystemString(method));
- if (defaultMethod.CompareNoCase(method) == 0 || m == 0)
+ if (keepMethodId == methodID)
+ {
m_Method.SetCurSel(itemIndex);
+ weUseSameMethod = true;
+ continue;
+ }
+ if ((defaultMethod.CompareNoCase(method) == 0 || m == 0) && !weUseSameMethod)
+ m_Method.SetCurSel(itemIndex);
+ }
+ if (!weUseSameMethod)
+ {
+ SetDictionary();
+ SetOrder();
}
- SetDictionary();
- SetOrder();
}
bool CCompressDialog::IsZipFormat()
{
- const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
return (ai.Name.CompareNoCase(L"zip") == 0);
}
void CCompressDialog::SetEncryptionMethod()
{
_encryptionMethod.ResetContent();
- const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
if (ai.Name.CompareNoCase(L"7z") == 0)
{
_encryptionMethod.AddString(TEXT("AES-256"));
@@ -903,7 +932,7 @@ int CCompressDialog::AddDictionarySize(UInt32 size, bool kilo, bool maga)
else if (maga)
sizePrint >>= 20;
TCHAR s[40];
- ConvertUInt64ToString(sizePrint, s);
+ ConvertUInt32ToString(sizePrint, s);
if (kilo)
lstrcat(s, TEXT(" K"));
else if (maga)
@@ -931,7 +960,7 @@ int CCompressDialog::AddDictionarySize(UInt32 size)
void CCompressDialog::SetDictionary()
{
m_Dictionary.ResetContent();
- const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
UInt32 defaultDictionary = UInt32(-1);
if (index >= 0)
@@ -948,6 +977,7 @@ void CCompressDialog::SetDictionary()
switch (methodID)
{
case kLZMA:
+ case kLZMA2:
{
static const UInt32 kMinDicSize = (1 << 16);
if (defaultDictionary == UInt32(-1))
@@ -1066,7 +1096,7 @@ UInt32 CCompressDialog::GetLevel2()
int CCompressDialog::AddOrder(UInt32 size)
{
TCHAR s[40];
- ConvertUInt64ToString(size, s);
+ ConvertUInt32ToString(size, s);
int index = (int)m_Order.AddString(s);
m_Order.SetItemData(index, size);
return index;
@@ -1075,7 +1105,7 @@ int CCompressDialog::AddOrder(UInt32 size)
void CCompressDialog::SetOrder()
{
m_Order.ResetContent();
- const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
UInt32 defaultOrder = UInt32(-1);
if (index >= 0)
@@ -1091,6 +1121,7 @@ void CCompressDialog::SetOrder()
switch (methodID)
{
case kLZMA:
+ case kLZMA2:
{
if (defaultOrder == UInt32(-1))
defaultOrder = (level >= 7) ? 64 : 32;
@@ -1193,7 +1224,7 @@ void CCompressDialog::SetSolidBlockSize()
UInt32 defaultBlockSize = (UInt32)-1;
- const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
if (index >= 0)
{
@@ -1211,7 +1242,7 @@ void CCompressDialog::SetSolidBlockSize()
if (needSet && dictionary >= (((UInt64)1 << (i - 7))) && i <= 32)
defaultBlockSize = i;
TCHAR s[40];
- ConvertUInt64ToString(1 << (i % 10), s);
+ ConvertUInt32ToString(1 << (i % 10), s);
if (i < 30) lstrcat(s, TEXT(" M"));
else lstrcat(s, TEXT(" G"));
lstrcat(s, TEXT("B"));
@@ -1237,7 +1268,7 @@ void CCompressDialog::SetNumThreads()
UInt32 numHardwareThreads = NSystem::GetNumberOfProcessors();
UInt32 defaultValue = numHardwareThreads;
- const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
int index = FindRegistryFormat(ai.Name);
if (index >= 0)
{
@@ -1250,23 +1281,16 @@ void CCompressDialog::SetNumThreads()
int methodID = GetMethodID();
switch (methodID)
{
- case kLZMA:
- {
- numAlgoThreadsMax = 2;
- break;
- }
- case kBZip2:
- {
- numAlgoThreadsMax = 32;
- break;
- }
+ case kLZMA: numAlgoThreadsMax = 2; break;
+ case kLZMA2: numAlgoThreadsMax = 32; break;
+ case kBZip2: numAlgoThreadsMax = 32; break;
}
if (IsZipFormat())
numAlgoThreadsMax = 128;
for (UInt32 i = 1; i <= numHardwareThreads * 2 && i <= numAlgoThreadsMax; i++)
{
TCHAR s[40];
- ConvertUInt64ToString(i, s);
+ ConvertUInt32ToString(i, s);
int index = (int)m_NumThreads.AddString(s);
m_NumThreads.SetItemData(index, (UInt32)i);
}
@@ -1298,9 +1322,11 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemo
if (numMainThreads > 1)
size += (UInt64)numMainThreads << 25;
}
- switch (GetMethodID())
+ int methidId = GetMethodID();
+ switch (methidId)
{
case kLZMA:
+ case kLZMA2:
{
UInt32 hs = dictionary - 1;
hs |= (hs >> 1);
@@ -1313,7 +1339,7 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemo
hs >>= 1;
hs++;
UInt64 size1 = (UInt64)hs * 4;
- size1 += (UInt64)dictionary * 11 / 2;
+ size1 += (UInt64)dictionary * 4;
if (level >= 5)
size1 += (UInt64)dictionary * 4;
size1 += (2 << 20);
@@ -1324,7 +1350,18 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt32 dictionary, UInt64 &decompressMemo
size1 += (2 << 20) + (4 << 20);
numThreads1 = 2;
}
- size += size1 * numThreads / numThreads1;
+ UInt32 numBlockThreads = numThreads / numThreads1;
+ if (methidId == kLZMA || numBlockThreads == 1)
+ size1 += (UInt64)dictionary * 3 / 2;
+ else
+ {
+ UInt64 chunkSize = (UInt64)dictionary << 2;
+ chunkSize = MyMax(chunkSize, (UInt64)(1 << 20));
+ chunkSize = MyMin(chunkSize, (UInt64)(1 << 28));
+ chunkSize = MyMax(chunkSize, (UInt64)dictionary);
+ size1 += chunkSize * 2;
+ }
+ size += size1 * numBlockThreads;
decompressMemory = dictionary + (2 << 20);
return size;
@@ -1363,7 +1400,7 @@ UInt64 CCompressDialog::GetMemoryUsage(UInt64 &decompressMemory)
void CCompressDialog::PrintMemUsage(UINT res, UInt64 value)
{
- if (value == (UInt64)Int64(-1))
+ if (value == (UInt64)(Int64)-1)
{
SetItemText(res, TEXT("?"));
return;
@@ -1385,7 +1422,7 @@ void CCompressDialog::SetMemoryUsage()
void CCompressDialog::SetParams()
{
- const CArcInfoEx &ai = m_ArchiverInfoList[m_Format.GetCurSel()];
+ const CArcInfoEx &ai = m_ArchiverInfoList[GetFormatIndex()];
m_Params.SetText(TEXT(""));
int index = FindRegistryFormat(ai.Name);
if (index >= 0)
@@ -1411,3 +1448,8 @@ void CCompressDialog::SaveOptionsInMem()
fo.NumThreads = GetNumThreadsSpec();
fo.BlockLogSize = GetBlockSizeSpec();
}
+
+int CCompressDialog::GetFormatIndex()
+{
+ return (int)m_Format.GetItemData(m_Format.GetCurSel());
+}
diff --git a/CPP/7zip/UI/GUI/CompressDialog.h b/CPP/7zip/UI/GUI/CompressDialog.h
index a88d472c..75eeeee8 100755
--- a/CPP/7zip/UI/GUI/CompressDialog.h
+++ b/CPP/7zip/UI/GUI/CompressDialog.h
@@ -1,15 +1,16 @@
// CompressDialog.h
-#ifndef __COMPRESSDIALOG_H
-#define __COMPRESSDIALOG_H
-
-#include "../Common/ZipRegistry.h"
-#include "../Common/LoadCodecs.h"
-#include "CompressDialogRes.h"
+#ifndef __COMPRESS_DIALOG_H
+#define __COMPRESS_DIALOG_H
+#include "Windows/Control/ComboBox.h"
#include "Windows/Control/Dialog.h"
#include "Windows/Control/Edit.h"
-#include "Windows/Control/ComboBox.h"
+
+#include "../Common/LoadCodecs.h"
+#include "../Common/ZipRegistry.h"
+
+#include "CompressDialogRes.h"
namespace NCompressDialog
{
@@ -107,7 +108,7 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
void SetLevel();
- void SetMethod();
+ void SetMethod(int keepMethodId = -1);
int GetMethodID();
UString GetMethodSpec();
UString GetEncryptionMethodSpec();
@@ -151,6 +152,8 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
void UpdatePasswordControl();
bool IsShowPasswordChecked() const
{ return IsButtonChecked(IDC_COMPRESS_CHECK_SHOW_PASSWORD) == BST_CHECKED; }
+
+ int GetFormatIndex();
public:
CObjectVector<CArcInfoEx> m_ArchiverInfoList;
diff --git a/CPP/7zip/UI/GUI/CompressDialog.rc b/CPP/7zip/UI/GUI/CompressDialog.rc
index 397a2756..8e79f1bf 100755
--- a/CPP/7zip/UI/GUI/CompressDialog.rc
+++ b/CPP/7zip/UI/GUI/CompressDialog.rc
@@ -58,7 +58,7 @@ BEGIN
PUSHBUTTON "...", IDC_COMPRESS_BUTTON_SET_ARCHIVE, xSize - marg - bDotsSize, 17, bDotsSize, bYSize, WS_GROUP
LTEXT "Archive &format:", IDC_STATIC_COMPRESS_FORMAT, marg, 41, g0XSize, 8
- COMBOBOX IDC_COMPRESS_COMBO_FORMAT, g1XPos, 39, g1XSize , 80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_COMPRESS_COMBO_FORMAT, g1XPos, 39, g1XSize , 80,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Compression &level:",IDC_STATIC_COMPRESS_LEVEL, marg, 62, g0XSize, 8
COMBOBOX IDC_COMPRESS_COMBO_LEVEL, g1XPos, 60, g1XSize, 80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
diff --git a/CPP/7zip/UI/GUI/ExtractGUI.cpp b/CPP/7zip/UI/GUI/ExtractGUI.cpp
index a03bd77a..95864d2c 100755
--- a/CPP/7zip/UI/GUI/ExtractGUI.cpp
+++ b/CPP/7zip/UI/GUI/ExtractGUI.cpp
@@ -2,26 +2,27 @@
#include "StdAfx.h"
-#include "ExtractGUI.h"
-
-#include "Common/StringConvert.h"
#include "Common/IntToString.h"
+#include "Common/StringConvert.h"
-#include "Windows/FileDir.h"
#include "Windows/Error.h"
+#include "Windows/FileDir.h"
#include "Windows/FileFind.h"
#include "Windows/Thread.h"
-#include "../FileManager/FormatUtils.h"
#include "../FileManager/ExtractCallback.h"
+#include "../FileManager/FormatUtils.h"
#include "../FileManager/LangUtils.h"
#include "../Common/ArchiveExtractCallback.h"
+#include "../Common/PropIDUtils.h"
+
#include "../Explorer/MyMessages.h"
+
#include "resource.h"
#include "ExtractRes.h"
-
#include "ExtractDialog.h"
+#include "ExtractGUI.h"
using namespace NWindows;
@@ -198,6 +199,16 @@ HRESULT ExtractGUI(
AddValuePair(IDS_FILES_COLON, 0x02000320, extracter.Stat.NumFiles, s);
AddSizePair(IDS_SIZE_COLON, 0x02000322, extracter.Stat.UnpackSize, s);
AddSizePair(IDS_COMPRESSED_COLON, 0x02000323, extracter.Stat.PackSize, s);
+
+ if (options.CalcCrc)
+ {
+ wchar_t temp[16];
+ ConvertUInt32ToHex(extracter.Stat.CrcSum, temp);
+ s += L"CRC: ";
+ s += temp;
+ s += L"\n";
+ }
+
s += L"\n";
s += LangString(IDS_MESSAGE_NO_ERRORS, 0x02000608);
@@ -209,5 +220,3 @@ HRESULT ExtractGUI(
throw extracter.ErrorMessage;
return extracter.Result;
}
-
-
diff --git a/CPP/7zip/UI/GUI/GUI.cpp b/CPP/7zip/UI/GUI/GUI.cpp
index e1117188..3a1a633e 100755
--- a/CPP/7zip/UI/GUI/GUI.cpp
+++ b/CPP/7zip/UI/GUI/GUI.cpp
@@ -4,31 +4,27 @@
#include <initguid.h>
-extern "C"
-{
- #include "../../../../C/Alloc.h"
-}
+#include "../../../../C/Alloc.h"
-#include "Common/NewHandler.h"
-#include "Common/StringConvert.h"
#include "Common/CommandLineParser.h"
#include "Common/MyException.h"
+#include "Common/StringConvert.h"
#include "Windows/Error.h"
#ifdef _WIN32
#include "Windows/MemoryLock.h"
#endif
-#include "../FileManager/StringUtils.h"
-
-#include "../Common/ExitCode.h"
#include "../Common/ArchiveCommandLine.h"
+#include "../Common/ExitCode.h"
-#include "ExtractRes.h"
+#include "../FileManager/StringUtils.h"
+#include "BenchmarkDialog.h"
#include "ExtractGUI.h"
#include "UpdateGUI.h"
-#include "BenchmarkDialog.h"
+
+#include "ExtractRes.h"
using namespace NWindows;
@@ -119,8 +115,12 @@ static int Main2()
CExtractCallbackImp *ecs = new CExtractCallbackImp;
CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
ecs->ProgressDialog.CompressingMode = false;
+
+ #ifndef _NO_CRYPTO
ecs->PasswordIsDefined = options.PasswordEnabled;
ecs->Password = options.Password;
+ #endif
+
ecs->Init();
CExtractOptions eo;
@@ -130,6 +130,7 @@ static int Main2()
eo.OverwriteMode = options.OverwriteMode;
eo.PathMode = options.Command.GetPathMode();
eo.TestMode = options.Command.IsTestMode();
+ eo.CalcCrc = options.CalcCrc;
#ifdef COMPRESS_MT
eo.Properties = options.ExtractProperties;
#endif
@@ -146,14 +147,19 @@ static int Main2()
}
else if (options.Command.IsFromUpdateGroup())
{
- bool passwordIsDefined =
- options.PasswordEnabled && !options.Password.IsEmpty();
+ #ifndef _NO_CRYPTO
+ bool passwordIsDefined = options.PasswordEnabled && !options.Password.IsEmpty();
+ #endif
CUpdateCallbackGUI callback;
// callback.EnablePercents = options.EnablePercents;
+
+ #ifndef _NO_CRYPTO
callback.PasswordIsDefined = passwordIsDefined;
callback.AskPassword = options.PasswordEnabled && options.Password.IsEmpty();
callback.Password = options.Password;
+ #endif
+
// callback.StdOutMode = options.UpdateOptions.StdOutMode;
callback.Init();
diff --git a/CPP/7zip/UI/GUI/GUI.dsp b/CPP/7zip/UI/GUI/GUI.dsp
index e5fbec0e..42c83c60 100755
--- 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 /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_MT" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_MT" /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 /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_MT" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_MT" /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 /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_MT" /Yu"stdafx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_MT" /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 /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_MT" /Yu"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_MT" /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"
@@ -379,91 +379,63 @@ SOURCE=..\Explorer\MyMessages.h
# Begin Group "Dialogs"
# PROP Default_Filter ""
-# Begin Group "Progress"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\FileManager\ProgressDialog2.cpp
+SOURCE=.\BenchmarkDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\FileManager\ProgressDialog2.h
+SOURCE=.\BenchmarkDialog.h
# End Source File
-# End Group
-# Begin Group "Messages"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\FileManager\MessagesDialog.cpp
+SOURCE=.\CompressDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\FileManager\MessagesDialog.h
+SOURCE=.\CompressDialog.h
# End Source File
-# End Group
-# Begin Group "Overwtite"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\FileManager\OverwriteDialog.cpp
+SOURCE=.\ExtractDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\FileManager\OverwriteDialog.h
+SOURCE=.\ExtractDialog.h
# End Source File
-# End Group
-# Begin Group "Password"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\FileManager\PasswordDialog.cpp
+SOURCE=..\FileManager\MessagesDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\FileManager\PasswordDialog.h
+SOURCE=..\FileManager\MessagesDialog.h
# End Source File
-# End Group
-# Begin Group "Compress Dialog"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\CompressDialog.cpp
+SOURCE=..\FileManager\OverwriteDialog.cpp
# End Source File
# Begin Source File
-SOURCE=.\CompressDialog.h
+SOURCE=..\FileManager\OverwriteDialog.h
# End Source File
-# End Group
-# Begin Group "Extract Dialog"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\ExtractDialog.cpp
+SOURCE=..\FileManager\PasswordDialog.cpp
# End Source File
# Begin Source File
-SOURCE=.\ExtractDialog.h
+SOURCE=..\FileManager\PasswordDialog.h
# End Source File
-# End Group
-# Begin Group "Benchmark Dialog"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\BenchmarkDialog.cpp
+SOURCE=..\FileManager\ProgressDialog2.cpp
# End Source File
# Begin Source File
-SOURCE=.\BenchmarkDialog.h
+SOURCE=..\FileManager\ProgressDialog2.h
# End Source File
# End Group
-# End Group
# Begin Group "FM Common"
# PROP Default_Filter ""
@@ -962,5 +934,17 @@ SOURCE=..\..\..\Windows\Window.cpp
SOURCE=..\..\..\Windows\Window.h
# End Source File
# End Group
+# Begin Group "Archive Common"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\Archive\Common\OutStreamWithCRC.h
+# End Source File
+# End Group
# End Target
# End Project
diff --git a/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp b/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
index 10c0a798..07c74e9b 100755
--- a/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
+++ b/CPP/7zip/UI/GUI/UpdateCallbackGUI.cpp
@@ -156,6 +156,7 @@ HRESULT CUpdateCallbackGUI::SetOperationResult(Int32 /* operationResult */)
HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{
+ *password = NULL;
if (!PasswordIsDefined)
{
if (AskPassword)
@@ -171,6 +172,20 @@ HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BST
return StringToBstr(Password, password);
}
+HRESULT CUpdateCallbackGUI::CryptoGetTextPassword(BSTR *password)
+{
+ *password = NULL;
+ if (!PasswordIsDefined)
+ {
+ CPasswordDialog dialog;
+ if (dialog.Create(ProgressDialog) == IDCANCEL)
+ return E_ABORT;
+ Password = dialog.Password;
+ PasswordIsDefined = true;
+ }
+ return StringToBstr(Password, password);
+}
+
/*
It doesn't work, since main stream waits Dialog
HRESULT CUpdateCallbackGUI::CloseProgress()
diff --git a/CPP/7zip/UI/GUI/UpdateGUI.cpp b/CPP/7zip/UI/GUI/UpdateGUI.cpp
index ef9a2d70..2d4dbbc2 100755
--- a/CPP/7zip/UI/GUI/UpdateGUI.cpp
+++ b/CPP/7zip/UI/GUI/UpdateGUI.cpp
@@ -4,32 +4,28 @@
#include "UpdateGUI.h"
-#include "resource.h"
-#include "Common/StringConvert.h"
#include "Common/IntToString.h"
+#include "Common/StringConvert.h"
#include "Common/StringToInt.h"
-#include "Windows/FileDir.h"
#include "Windows/Error.h"
-#include "Windows/FileFind.h"
+#include "Windows/FileDir.h"
#include "Windows/Thread.h"
-#include "../FileManager/FormatUtils.h"
-#include "../FileManager/ExtractCallback.h"
-#include "../FileManager/StringUtils.h"
-
-#include "../Common/ArchiveExtractCallback.h"
#include "../Common/WorkDir.h"
+
#include "../Explorer/MyMessages.h"
-#include "ExtractRes.h"
+
+#include "../FileManager/StringUtils.h"
#include "CompressDialog.h"
#include "UpdateGUI.h"
+#include "resource.h"
+
using namespace NWindows;
using namespace NFile;
-// static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
static const wchar_t *kDefaultSfxModule = L"7z.sfx";
static const wchar_t *kSFXExtension = L"exe";
@@ -242,7 +238,7 @@ static HRESULT ShowDialog(
name += WCHAR_PATH_SEPARATOR;
name += item.PathParts[i];
}
- if (NFind::FindFile(name, fileInfo))
+ if (fileInfo.Find(name))
{
if (censor.Pairs.Size() == 1 && pair.Head.IncludeItems.Size() == 1)
oneFile = !fileInfo.IsDir();
@@ -355,7 +351,7 @@ static HRESULT ShowDialog(
UString fullPath;
NDirectory::MyGetFullPathName(di.ArchiveName, fullPath);
options.WorkingDir = GetWorkDir(workDirInfo, fullPath);
- NFile::NDirectory::CreateComplexDirectory(options.WorkingDir);
+ NDirectory::CreateComplexDirectory(options.WorkingDir);
}
return S_OK;
}
diff --git a/CPP/7zip/UI/GUI/makefile b/CPP/7zip/UI/GUI/makefile
index b92935ab..233e2ee2 100755
--- a/CPP/7zip/UI/GUI/makefile
+++ b/CPP/7zip/UI/GUI/makefile
@@ -8,6 +8,7 @@ CFLAGS = $(CFLAGS) -I ../../../ \
-DEXTERNAL_CODECS \
-DBENCH_MT \
-D_7ZIP_LARGE_PAGES \
+ -DSUPPORT_DEVICE_FILE \
GUI_OBJS = \
$O\BenchmarkDialog.obj \
@@ -85,6 +86,9 @@ UI_COMMON_OBJS = \
$O\WorkDir.obj \
$O\ZipRegistry.obj \
+AR_COMMON_OBJS = \
+ $O\OutStreamWithCRC.obj \
+
LZMA_BENCH_OBJS = \
$O\LzmaBench.obj \
@@ -117,6 +121,7 @@ OBJS = \
$(WIN_CTRL_OBJS) \
$(7ZIP_COMMON_OBJS) \
$(UI_COMMON_OBJS) \
+ $(AR_COMMON_OBJS) \
$(FM_OBJS)\
$O\MyMessages.obj \
$O\CopyCoder.obj \
@@ -139,6 +144,8 @@ $(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
$(UI_COMMON_OBJS): ../Common/$(*B).cpp
$(COMPL)
+$(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp
+ $(COMPL)
$(FM_OBJS): ../FileManager/$(*B).cpp
$(COMPL)
$O\MyMessages.obj: ../Explorer/MyMessages.cpp