This commit is contained in:
Igor Pavlov
2023-12-22 17:17:05 +00:00
committed by Kornel
parent ec44a8a070
commit a36c48cece
954 changed files with 42199 additions and 25482 deletions

View File

@@ -17,4 +17,7 @@
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware></windowsSettings></application>
</assembly>

View File

@@ -22,9 +22,7 @@
#include "../FileManager/DialogSize.h"
#include "../FileManager/HelpUtils.h"
#ifdef LANG
#include "../FileManager/LangUtils.h"
#endif
#include "../../MyVersion.h"
@@ -156,7 +154,7 @@ void CSyncData::Init()
NeedPrint_Dec_1 =
NeedPrint_Dec =
NeedPrint_Tot = false;
};
}
struct CBenchProgressSync
@@ -243,7 +241,7 @@ class CBenchmarkDialog;
struct CThreadBenchmark
{
CBenchmarkDialog *BenchmarkDialog;
DECL_EXTERNAL_CODECS_LOC_VARS2;
DECL_EXTERNAL_CODECS_LOC_VARS_DECL
// HRESULT Result;
HRESULT Process();
@@ -290,15 +288,15 @@ class CBenchmarkDialog:
Sync.Init();
}
virtual bool OnInit();
virtual bool OnDestroy();
virtual bool OnSize(WPARAM /* wParam */, int xSize, int ySize);
virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
virtual bool OnCommand(int code, int itemID, LPARAM lParam);
virtual void OnHelp();
virtual void OnCancel();
virtual bool OnTimer(WPARAM timerID, LPARAM callback);
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
virtual bool OnInit() Z7_override;
virtual bool OnDestroy() Z7_override;
virtual bool OnSize(WPARAM /* wParam */, int xSize, int ySize) Z7_override;
virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam) Z7_override;
virtual bool OnCommand(unsigned code, unsigned itemID, LPARAM lParam) Z7_override;
virtual void OnHelp() Z7_override;
virtual void OnCancel() Z7_override;
virtual bool OnTimer(WPARAM timerID, LPARAM callback) Z7_override;
virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND) Z7_override;
void Disable_Stop_Button();
void OnStopButton();
@@ -315,7 +313,7 @@ class CBenchmarkDialog:
UInt32 GetNumberOfThreads();
size_t OnChangeDictionary();
void SetItemText_Number(int itemID, UInt64 val, LPCTSTR post = NULL);
void SetItemText_Number(unsigned itemID, UInt64 val, LPCTSTR post = NULL);
void Print_MemUsage(UString &s, UInt64 memUsage) const;
bool IsMemoryUsageOK(UInt64 memUsage) const
{ return memUsage + (1 << 20) <= RamSize_Limit; }
@@ -347,17 +345,17 @@ public:
TotalMode(false)
{}
~CBenchmarkDialog();
~CBenchmarkDialog() Z7_DESTRUCTOR_override;
bool PostMsg_Finish(LPARAM param)
bool PostMsg_Finish(WPARAM wparam)
{
if ((HWND)*this)
return PostMsg(k_Message_Finished, param);
return PostMsg(k_Message_Finished, wparam);
// the (HWND)*this is NULL only for some internal code failure
return true;
}
INT_PTR Create(HWND wndParent = 0)
INT_PTR Create(HWND wndParent = NULL)
{
BIG_DIALOG_SIZE(332, 228);
return CModalDialog::Create(TotalMode ? IDD_BENCH_TOTAL : SIZED_DIALOG(IDD_BENCH), wndParent);
@@ -385,13 +383,13 @@ public:
UString HResultToMessage(HRESULT errorCode);
#ifdef LANG
#ifdef Z7_LANG
static const UInt32 kLangIDs[] =
{
IDT_BENCH_DICTIONARY,
IDT_BENCH_MEMORY,
IDT_BENCH_NUM_THREADS,
IDT_BENCH_SPEED,
IDT_BENCH_SIZE,
IDT_BENCH_RATING_LABEL,
IDT_BENCH_USAGE_LABEL,
IDT_BENCH_RPU_LABEL,
@@ -406,9 +404,9 @@ static const UInt32 kLangIDs[] =
IDB_RESTART
};
static const UInt32 kLangIDs_Colon[] =
static const UInt32 kLangIDs_RemoveColon[] =
{
IDT_BENCH_SIZE
IDT_BENCH_SPEED
};
#endif
@@ -439,18 +437,18 @@ static int ComboBox_Add_UInt32(NWindows::NControl::CComboBox &cb, UInt32 v)
{
TCHAR s[16];
ConvertUInt32ToString(v, s);
int index = (int)cb.AddString(s);
cb.SetItemData(index, v);
const int index = (int)cb.AddString(s);
cb.SetItemData(index, (LPARAM)v);
return index;
}
bool CBenchmarkDialog::OnInit()
{
#ifdef LANG
#ifdef Z7_LANG
LangSetWindowText(*this, IDD_BENCH);
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
// LangSetDlgItems_Colon(*this, kLangIDs_Colon, ARRAY_SIZE(kLangIDs_Colon));
LangSetDlgItems(*this, kLangIDs, Z7_ARRAY_SIZE(kLangIDs));
LangSetDlgItems_RemoveColon(*this, kLangIDs_RemoveColon, Z7_ARRAY_SIZE(kLangIDs_RemoveColon));
LangSetDlgItemText(*this, IDT_BENCH_CURRENT2, IDT_BENCH_CURRENT);
LangSetDlgItemText(*this, IDT_BENCH_RESULTING2, IDT_BENCH_RESULTING);
#endif
@@ -486,7 +484,7 @@ bool CBenchmarkDialog::OnInit()
NSystem::CProcessAffinity threadsInfo;
threadsInfo.InitST();
#ifndef _7ZIP_ST
#ifndef Z7_ST
if (threadsInfo.Get() && threadsInfo.processAffinityMask != 0)
numCPUs = threadsInfo.GetNumProcessThreads();
else
@@ -531,7 +529,7 @@ bool CBenchmarkDialog::OnInit()
if (numThreads == (UInt32)(Int32)-1)
numThreads = numCPUs;
if (numThreads > 1)
numThreads &= ~1;
numThreads &= ~(UInt32)1;
const UInt32 kNumThreadsMax = (1 << 12);
if (numThreads > kNumThreadsMax)
numThreads = kNumThreadsMax;
@@ -603,7 +601,7 @@ bool CBenchmarkDialog::OnInit()
ConvertUInt32ToString(d, s);
lstrcat(s, post);
const int index = (int)m_Dictionary.AddString(s);
m_Dictionary.SetItemData(index, dict);
m_Dictionary.SetItemData(index, (LPARAM)dict);
if (dict <= Sync.DictSize)
cur = index;
if (dict >= kMaxDicSize)
@@ -711,18 +709,18 @@ UInt32 CBenchmarkDialog::GetNumberOfThreads()
s[0] = (wchar_t)('0' + (val) / 100); \
s[1] = (wchar_t)('0' + (val) % 100 / 10); \
s[2] = (wchar_t)('0' + (val) % 10); \
s[3] = 0; }
s += 3; s[0] = 0; }
static void NumberToDot3(UInt64 val, WCHAR *s)
static WCHAR *NumberToDot3(UInt64 val, WCHAR *s)
{
ConvertUInt64ToString(val / 1000, s);
s = ConvertUInt64ToString(val / 1000, s);
const UInt32 rem = (UInt32)(val % 1000);
s += MyStringLen(s);
*s++ = '.';
UINT_TO_STR_3(s, rem);
UINT_TO_STR_3(s, rem)
return s;
}
void CBenchmarkDialog::SetItemText_Number(int itemID, UInt64 val, LPCTSTR post)
void CBenchmarkDialog::SetItemText_Number(unsigned itemID, UInt64 val, LPCTSTR post)
{
TCHAR s[64];
ConvertUInt64ToString(val, s);
@@ -758,7 +756,7 @@ size_t CBenchmarkDialog::OnChangeDictionary()
UString s;
Print_MemUsage(s, memUsage);
#ifdef _7ZIP_LARGE_PAGES
#ifdef Z7_LARGE_PAGES
{
AString s2;
Add_LargePages_String(s2);
@@ -875,7 +873,7 @@ void CBenchmarkDialog::StartBenchmark()
const UInt32 numThreads = GetNumberOfThreads();
const UInt32 numPasses = (UInt32)m_NumPasses.GetItemData_of_CurSel();
for (unsigned i = 0; i < ARRAY_SIZE(g_IDs); i++)
for (unsigned i = 0; i < Z7_ARRAY_SIZE(g_IDs); i++)
SetItemText(g_IDs[i], kProcessingString);
SetItemText_Empty(IDT_BENCH_LOG);
@@ -916,7 +914,7 @@ void CBenchmarkDialog::StartBenchmark()
{
MyKillTimer();
MessageBoxError_Status(L"Can't create thread");
};
}
return;
}
@@ -1000,19 +998,17 @@ void CBenchmarkDialog::PrintTime()
WCHAR s[64];
// GetTimeString(elapsedTime / 1000, s);
ConvertUInt32ToString(elapsedTime / 1000, s);
WCHAR *p = ConvertUInt32ToString(elapsedTime / 1000, s);
if (_finishTime_WasSet)
{
WCHAR *p = s + MyStringLen(s);
*p++ = '.';
UINT_TO_STR_3(p, elapsedTime % 1000);
UINT_TO_STR_3(p, elapsedTime % 1000)
}
// NumberToDot3((UInt64)elapsedTime, s);
// p = NumberToDot3((UInt64)elapsedTime, s);
wcscat(s, L" s");
MyStringCopy(p, L" s");
// if (WasStopped_in_GUI) wcscat(s, L" X"); // for debug
@@ -1051,7 +1047,7 @@ static UInt32 GetRating(const CTotalBenchRes &info)
if (rating32 != rating64)
rating32 = (UInt32)(Int32)-1;
return rating32;
};
}
static void AddUsageString(UString &s, const CTotalBenchRes &info)
@@ -1088,7 +1084,7 @@ static void AddRatingString(UString &s, const CTotalBenchRes &info)
// s += " ";
// s.Add_UInt32(GetRating(info));
Add_Dot3String(s, GetRating(info));
};
}
static void AddRatingsLine(UString &s, const CTotalBenchRes &enc, const CTotalBenchRes &dec
@@ -1127,8 +1123,7 @@ void CBenchmarkDialog::PrintRating(UInt64 rating, UINT controlID)
{
// SetItemText_Number(controlID, GetMips(rating), kMIPS);
WCHAR s[64];
NumberToDot3(GetMips(rating), s);
MyStringCat(s, L" GIPS");
MyStringCopy(NumberToDot3(GetMips(rating), s), L" GIPS");
SetItemText(controlID, s);
}
@@ -1391,7 +1386,7 @@ void CBenchmarkDialog::UpdateGui()
}
bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam)
bool CBenchmarkDialog::OnCommand(unsigned code, unsigned itemID, LPARAM lParam)
{
if (code == CBN_SELCHANGE &&
(itemID == IDC_BENCH_DICTIONARY ||
@@ -1405,7 +1400,7 @@ bool CBenchmarkDialog::OnCommand(int code, int itemID, LPARAM lParam)
}
bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
bool CBenchmarkDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
{
switch (buttonID)
{
@@ -1425,14 +1420,14 @@ bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
// ---------- Benchmark Thread ----------
struct CBenchCallback: public IBenchCallback
struct CBenchCallback Z7_final: public IBenchCallback
{
UInt64 dictionarySize;
CBenchProgressSync *Sync;
CBenchmarkDialog *BenchmarkDialog;
HRESULT SetEncodeResult(const CBenchInfo &info, bool final);
HRESULT SetDecodeResult(const CBenchInfo &info, bool final);
HRESULT SetEncodeResult(const CBenchInfo &info, bool final) Z7_override;
HRESULT SetDecodeResult(const CBenchInfo &info, bool final) Z7_override;
};
HRESULT CBenchCallback::SetEncodeResult(const CBenchInfo &info, bool final)
@@ -1494,14 +1489,14 @@ HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
}
struct CBenchCallback2: public IBenchPrintCallback
struct CBenchCallback2 Z7_final: public IBenchPrintCallback
{
CBenchProgressSync *Sync;
bool TotalMode;
void Print(const char *s);
void NewLine();
HRESULT CheckBreak();
void Print(const char *s) Z7_override;
void NewLine() Z7_override;
HRESULT CheckBreak() Z7_override;
};
void CBenchCallback2::Print(const char *s)
@@ -1528,12 +1523,12 @@ HRESULT CBenchCallback2::CheckBreak()
struct CFreqCallback: public IBenchFreqCallback
struct CFreqCallback Z7_final: public IBenchFreqCallback
{
CBenchmarkDialog *BenchmarkDialog;
virtual HRESULT AddCpuFreq(unsigned numThreads, UInt64 freq, UInt64 usage);
virtual HRESULT FreqsFinished(unsigned numThreads);
virtual HRESULT AddCpuFreq(unsigned numThreads, UInt64 freq, UInt64 usage) Z7_override;
virtual HRESULT FreqsFinished(unsigned numThreads) Z7_override;
};
HRESULT CFreqCallback::AddCpuFreq(unsigned numThreads, UInt64 freq, UInt64 usage)
@@ -1839,7 +1834,7 @@ HRESULT Benchmark(
COneMethodInfo method;
UInt32 numCPUs = 1;
#ifndef _7ZIP_ST
#ifndef Z7_ST
numCPUs = NSystem::GetNumberOfProcessors();
#endif
UInt32 numThreads = numCPUs;
@@ -1860,8 +1855,8 @@ HRESULT Benchmark(
ParseNumberString(prop.Value, propVariant);
if (name.IsPrefixedBy(L"mt"))
{
#ifndef _7ZIP_ST
RINOK(ParseMtProp(name.Ptr(2), propVariant, numCPUs, numThreads));
#ifndef Z7_ST
RINOK(ParseMtProp(name.Ptr(2), propVariant, numCPUs, numThreads))
if (numThreads != numCPUs)
bd.Sync.NumThreads = numThreads;
#endif
@@ -1893,14 +1888,14 @@ HRESULT Benchmark(
if (method.Get_DicSize(dict))
bd.Sync.DictSize = dict;
}
bd.Sync.Level = method.GetLevel();
bd.Sync.Level = (int)method.GetLevel();
// Dummy(1000 * 1000 * 1);
{
CThreadBenchmark &benchmarker = bd._threadBenchmark;
#ifdef EXTERNAL_CODECS
benchmarker.__externalCodecs = __externalCodecs;
#ifdef Z7_EXTERNAL_CODECS
benchmarker._externalCodecs = _externalCodecs;
#endif
benchmarker.BenchmarkDialog = &bd;
}

View File

@@ -1,7 +1,7 @@
// BenchmarkDialog.h
#ifndef __BENCHMARK_DIALOG_H
#define __BENCHMARK_DIALOG_H
#ifndef ZIP7_INC_BENCHMARK_DIALOG_H
#define ZIP7_INC_BENCHMARK_DIALOG_H
#include "../../Common/CreateCoder.h"
#include "../../UI/Common/Property.h"

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
// CompressDialog.h
#ifndef __COMPRESS_DIALOG_H
#define __COMPRESS_DIALOG_H
#ifndef ZIP7_INC_COMPRESS_DIALOG_H
#define ZIP7_INC_COMPRESS_DIALOG_H
#include "../../../Common/Wildcard.h"
@@ -45,6 +45,7 @@ namespace NCompressDialog
UInt32 Level;
UString Method;
UInt64 Dict64;
// UInt64 Dict64_Chain;
bool OrderMode;
UInt32 Order;
UString Options;
@@ -93,6 +94,7 @@ namespace NCompressDialog
NumThreads = (UInt32)(Int32)-1;
SolidIsSpecified = false;
Dict64 = (UInt64)(Int64)(-1);
// Dict64_Chain = (UInt64)(Int64)(-1);
OrderMode = false;
Method.Empty();
Options.Empty();
@@ -144,12 +146,15 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
NWindows::NControl::CComboBox m_Level;
NWindows::NControl::CComboBox m_Method;
NWindows::NControl::CComboBox m_Dictionary;
// NWindows::NControl::CComboBox m_Dictionary_Chain;
NWindows::NControl::CComboBox m_Order;
NWindows::NControl::CComboBox m_Solid;
NWindows::NControl::CComboBox m_NumThreads;
NWindows::NControl::CComboBox m_MemUse;
NWindows::NControl::CComboBox m_Volume;
int _dictionaryCombo_left;
UStringVector _memUse_Strings;
NWindows::NControl::CDialogChildControl m_Params;
@@ -163,6 +168,7 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
int _auto_MethodId;
UInt32 _auto_Dict; // (UInt32)(Int32)-1 means unknown
UInt32 _auto_Dict_Chain; // (UInt32)(Int32)-1 means unknown
UInt32 _auto_Order;
UInt64 _auto_Solid;
UInt32 _auto_NumThreads;
@@ -201,7 +207,7 @@ public:
void CheckSFXNameChange();
void SetArchiveName2(bool prevWasSFX);
int GetStaticFormatIndex();
unsigned GetStaticFormatIndex();
void SetNearestSelectComboBox(NWindows::NControl::CComboBox &comboBox, UInt32 value);
@@ -224,6 +230,7 @@ public:
{
SetDictionary2();
EnableMultiCombo(IDC_COMPRESS_DICTIONARY);
// EnableMultiCombo(IDC_COMPRESS_DICTIONARY2);
SetOrder2();
EnableMultiCombo(IDC_COMPRESS_ORDER);
}
@@ -243,6 +250,7 @@ public:
int AddDict2(size_t sizeReal, size_t sizeShow);
int AddDict(size_t size);
// int AddDict_Chain(size_t size);
void SetDictionary2();
@@ -254,6 +262,8 @@ public:
UInt32 GetLevel2();
UInt64 GetDictSpec() { return GetComboValue_64(m_Dictionary, 1); }
// UInt64 GetDictChainSpec() { return GetComboValue_64(m_Dictionary_Chain, 1); }
UInt64 GetDict2()
{
UInt64 num = GetDictSpec();
@@ -319,6 +329,8 @@ public:
void PrintMemUsage(UINT res, UInt64 value);
void SetMemoryUsage();
void Print_Params();
void SetParams();
void SaveOptionsInMem();
@@ -328,7 +340,9 @@ public:
unsigned GetFormatIndex();
bool SetArcPathFields(const UString &path, UString &name, bool always);
bool GetFinalPath_Smart(UString &resPath);
bool SetArcPathFields(const UString &path);
bool GetFinalPath_Smart(UString &resPath) const;
void ArcPath_WasChanged(const UString &newPath);
void CheckSFXControlsEnable();
// void CheckVolumeEnable();
@@ -339,11 +353,12 @@ public:
bool IsSFX();
void OnButtonSFX();
virtual bool OnInit();
virtual bool OnCommand(int code, int itemID, LPARAM lParam);
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
virtual void OnOK();
virtual void OnHelp();
virtual bool OnInit() Z7_override;
virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam) Z7_override;
virtual bool OnCommand(unsigned code, unsigned itemID, LPARAM lParam) Z7_override;
virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND) Z7_override;
virtual void OnOK() Z7_override;
virtual void OnHelp() Z7_override;
void MessageBoxError(LPCWSTR message)
{
@@ -361,15 +376,14 @@ public:
NCompressDialog::CInfo Info;
UString OriginalFileName; // for bzip2, gzip2
bool CurrentDirWasChanged;
INT_PTR Create(HWND wndParent = 0)
INT_PTR Create(HWND wndParent = NULL)
{
BIG_DIALOG_SIZE(400, 320);
return CModalDialog::Create(SIZED_DIALOG(IDD_COMPRESS), wndParent);
}
CCompressDialog(): CurrentDirWasChanged(false) {};
CCompressDialog() {}
};
@@ -383,10 +397,10 @@ class COptionsDialog: public NWindows::NControl::CModalDialog
bool DefaultVal;
CBoolPair BoolPair;
int Id;
int Set_Id;
unsigned Id;
unsigned Set_Id;
void SetIDs(int id, int set_Id)
void SetIDs(unsigned id, unsigned set_Id)
{
Id = id;
Set_Id = set_Id;
@@ -442,15 +456,15 @@ class COptionsDialog: public NWindows::NControl::CModalDialog
void On_CheckBoxSet_Prec_Clicked();
void On_CheckBoxSet_Clicked(const CBoolBox &bb);
virtual bool OnInit();
virtual bool OnCommand(int code, int itemID, LPARAM lParam);
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
virtual void OnOK();
virtual void OnHelp();
virtual bool OnInit() Z7_override;
virtual bool OnCommand(unsigned code, unsigned itemID, LPARAM lParam) Z7_override;
virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND) Z7_override;
virtual void OnOK() Z7_override;
virtual void OnHelp() Z7_override;
public:
INT_PTR Create(HWND wndParent = 0)
INT_PTR Create(HWND wndParent = NULL)
{
BIG_DIALOG_SIZE(240, 232);
return CModalDialog::Create(SIZED_DIALOG(IDD_COMPRESS_OPTIONS), wndParent);
@@ -461,7 +475,7 @@ public:
// , TimePrec(0)
{
Reset_TimePrec();
};
}
};
#endif

View File

@@ -48,6 +48,11 @@
#define GROUP_Y_SIZE_ENCRYPT 128
#endif
// #define DICT_SIZE_SPACE 8
// #define DICT_SIZE 54
// #define DICT_x (g1x + g1xs - DICT_SIZE)
// #define DICT2_x (DICT_x - DICT_SIZE_SPACE - DICT_SIZE)
#define yPsw (yOpt + GROUP_Y_SIZE + 8)
IDD_COMPRESS DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE MY_FONT
@@ -69,9 +74,14 @@ BEGIN
LTEXT "&Dictionary size:", IDT_COMPRESS_DICTIONARY, m, 104, g0xs, 8
COMBOBOX IDC_COMPRESS_DICTIONARY, g1x, 102, g1xs, 167, MY_COMBO
// LTEXT "&Dictionary size:", IDT_COMPRESS_DICTIONARY, m, 104, DICT_x - m, 16 // 8, SS_LEFTNOWORDWRAP
// LTEXT "", IDT_COMPRESS_PARAMS_INFO, m, 283, xs, MY_TEXT_NOPREFIX
// CTEXT "-", 0, DICT_x - DICT_SIZE_SPACE, 104, DICT_SIZE_SPACE, 8
// COMBOBOX IDC_COMPRESS_DICTIONARY2, DICT2_x, 102, DICT_SIZE, 140, MY_COMBO
// COMBOBOX IDC_COMPRESS_DICTIONARY, DICT_x, 102, DICT_SIZE, 140, MY_COMBO
LTEXT "&Word size:", IDT_COMPRESS_ORDER, m, 125, g0xs, 8
COMBOBOX IDC_COMPRESS_ORDER, g1x, 123, g1xs, 141, MY_COMBO
COMBOBOX IDC_COMPRESS_ORDER, g1x, 123, g1xs, 140, MY_COMBO
LTEXT "&Solid Block size:", IDT_COMPRESS_SOLID, m, 146, g0xs, 8
COMBOBOX IDC_COMPRESS_SOLID, g1x, 144, g1xs, 140, MY_COMBO

View File

@@ -22,6 +22,7 @@
#define IDG_COMPRESS_NTFS 115
#define IDC_COMPRESS_PATH_MODE 116
#define IDC_COMPRESS_MEM_USE 117
// #define IDC_COMPRESS_DICTIONARY2 118
#define IDE_COMPRESS_PASSWORD1 120
#define IDE_COMPRESS_PASSWORD2 121
@@ -32,6 +33,7 @@
// #define IDB_COMPRESS_OPTIONS 140
#define IDB_COMPRESS_OPTIONS 2100
#define IDT_COMPRESS_OPTIONS 141
// #define IDT_COMPRESS_PARAMS_INFO 142
#define IDT_COMPRESS_PATH_MODE 3410

View File

@@ -9,7 +9,7 @@
#include "../../../Windows/FileDir.h"
#include "../../../Windows/ResourceString.h"
#ifndef NO_REGISTRY
#ifndef Z7_NO_REGISTRY
#include "../FileManager/HelpUtils.h"
#endif
@@ -28,7 +28,7 @@ using namespace NName;
extern HINSTANCE g_hInstance;
#ifndef _SFX
#ifndef Z7_SFX
static const UInt32 kPathMode_IDs[] =
{
@@ -70,7 +70,7 @@ static const
#endif
#ifdef LANG
#ifdef Z7_LANG
static const UInt32 kLangIDs[] =
{
@@ -87,23 +87,23 @@ static const UInt32 kLangIDs[] =
// static const int kWildcardsButtonIndex = 2;
#ifndef NO_REGISTRY
#ifndef Z7_NO_REGISTRY
static const unsigned kHistorySize = 16;
#endif
#ifndef _SFX
#ifndef Z7_SFX
// it's used in CompressDialog also
void AddComboItems(NControl::CComboBox &combo, const UInt32 *langIDs, unsigned numItems, const int *values, int curVal);
void AddComboItems(NControl::CComboBox &combo, const UInt32 *langIDs, unsigned numItems, const int *values, int curVal)
{
int curSel = 0;
unsigned curSel = 0;
for (unsigned i = 0; i < numItems; i++)
{
UString s = LangString(langIDs[i]);
s.RemoveChar(L'&');
int index = (int)combo.AddString(s);
combo.SetItemData(index, i);
const int index = (int)combo.AddString(s);
combo.SetItemData(index, (LPARAM)i);
if (values[i] == curVal)
curSel = i;
}
@@ -126,8 +126,8 @@ void CExtractDialog::CheckButton_TwoBools(UINT id, const CBoolPair &b1, const CB
void CExtractDialog::GetButton_Bools(UINT id, CBoolPair &b1, CBoolPair &b2)
{
bool val = IsButtonCheckedBool(id);
bool oldVal = GetBoolsVal(b1, b2);
const bool val = IsButtonCheckedBool(id);
const bool oldVal = GetBoolsVal(b1, b2);
if (val != oldVal)
b1.Def = b2.Def = true;
b1.Val = b2.Val = val;
@@ -137,7 +137,7 @@ void CExtractDialog::GetButton_Bools(UINT id, CBoolPair &b1, CBoolPair &b2)
bool CExtractDialog::OnInit()
{
#ifdef LANG
#ifdef Z7_LANG
{
UString s;
LangString_OnlyFromLangFile(IDD_EXTRACT, s);
@@ -150,18 +150,18 @@ bool CExtractDialog::OnInit()
}
SetText(s);
// LangSetWindowText(*this, IDD_EXTRACT);
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
LangSetDlgItems(*this, kLangIDs, Z7_ARRAY_SIZE(kLangIDs));
}
#endif
#ifndef _SFX
#ifndef Z7_SFX
_passwordControl.Attach(GetItem(IDE_EXTRACT_PASSWORD));
_passwordControl.SetText(Password);
_passwordControl.SetPasswordChar(TEXT('*'));
_pathName.Attach(GetItem(IDE_EXTRACT_NAME));
#endif
#ifdef NO_REGISTRY
#ifdef Z7_NO_REGISTRY
PathMode = NExtract::NPathMode::kFullPaths;
OverwriteMode = NExtract::NOverwriteMode::kAsk;
@@ -191,7 +191,7 @@ bool CExtractDialog::OnInit()
UString pathPrefix = DirPath;
#ifndef _SFX
#ifndef Z7_SFX
if (_info.SplitDest.Val)
{
@@ -210,7 +210,7 @@ bool CExtractDialog::OnInit()
_path.SetText(pathPrefix);
#ifndef NO_REGISTRY
#ifndef Z7_NO_REGISTRY
for (unsigned i = 0; i < _info.Paths.Size() && i < kHistorySize; i++)
_path.AddString(_info.Paths[i]);
#endif
@@ -222,13 +222,13 @@ bool CExtractDialog::OnInit()
_path.SetCurSel(-1);
*/
#ifndef _SFX
#ifndef Z7_SFX
_pathMode.Attach(GetItem(IDC_EXTRACT_PATH_MODE));
_overwriteMode.Attach(GetItem(IDC_EXTRACT_OVERWRITE_MODE));
AddComboItems(_pathMode, kPathMode_IDs, ARRAY_SIZE(kPathMode_IDs), kPathModeButtonsVals, PathMode);
AddComboItems(_overwriteMode, kOverwriteMode_IDs, ARRAY_SIZE(kOverwriteMode_IDs), kOverwriteButtonsVals, OverwriteMode);
AddComboItems(_pathMode, kPathMode_IDs, Z7_ARRAY_SIZE(kPathMode_IDs), kPathModeButtonsVals, PathMode);
AddComboItems(_overwriteMode, kOverwriteMode_IDs, Z7_ARRAY_SIZE(kOverwriteMode_IDs), kOverwriteButtonsVals, OverwriteMode);
#endif
@@ -243,7 +243,7 @@ bool CExtractDialog::OnInit()
return CModalDialog::OnInit();
}
#ifndef _SFX
#ifndef Z7_SFX
void CExtractDialog::UpdatePasswordControl()
{
_passwordControl.SetPasswordChar(IsShowPasswordChecked() ? 0 : TEXT('*'));
@@ -253,14 +253,14 @@ void CExtractDialog::UpdatePasswordControl()
}
#endif
bool CExtractDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
bool CExtractDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
{
switch (buttonID)
{
case IDB_EXTRACT_SET_PATH:
OnButtonSetPath();
return true;
#ifndef _SFX
#ifndef Z7_SFX
case IDX_EXTRACT_NAME_ENABLE:
ShowItem_Bool(IDE_EXTRACT_NAME, IsButtonCheckedBool(IDX_EXTRACT_NAME_ENABLE));
return true;
@@ -282,7 +282,7 @@ void CExtractDialog::OnButtonSetPath()
UString resultPath;
if (!MyBrowseForFolder(*this, title, currentPath, resultPath))
return;
#ifndef NO_REGISTRY
#ifndef Z7_NO_REGISTRY
_path.SetCurSel(-1);
#endif
_path.SetText(resultPath);
@@ -299,7 +299,7 @@ void AddUniqueString(UStringVector &list, const UString &s)
void CExtractDialog::OnOK()
{
#ifndef _SFX
#ifndef Z7_SFX
int pathMode2 = kPathModeButtonsVals[_pathMode.GetCurSel()];
if (PathMode != NExtract::NPathMode::kCurPaths ||
pathMode2 != NExtract::NPathMode::kFullPaths)
@@ -313,7 +313,7 @@ void CExtractDialog::OnOK()
#endif
#ifndef NO_REGISTRY
#ifndef Z7_NO_REGISTRY
// GetButton_Bools(IDX_EXTRACT_ALT_STREAMS, AltStreams, _info.AltStreams);
GetButton_Bools(IDX_EXTRACT_NT_SECUR, NtSecurity, _info.NtSecurity);
@@ -350,7 +350,7 @@ void CExtractDialog::OnOK()
UString s;
#ifdef NO_REGISTRY
#ifdef Z7_NO_REGISTRY
_path.GetText(s);
@@ -371,9 +371,9 @@ void CExtractDialog::OnOK()
s.Trim();
NName::NormalizeDirPathPrefix(s);
#ifndef _SFX
#ifndef Z7_SFX
bool splitDest = IsButtonCheckedBool(IDX_EXTRACT_NAME_ENABLE);
const bool splitDest = IsButtonCheckedBool(IDX_EXTRACT_NAME_ENABLE);
if (splitDest)
{
UString pathName;
@@ -392,9 +392,9 @@ void CExtractDialog::OnOK()
DirPath = s;
#ifndef NO_REGISTRY
#ifndef Z7_NO_REGISTRY
_info.Paths.Clear();
#ifndef _SFX
#ifndef Z7_SFX
AddUniqueString(_info.Paths, s);
#endif
for (int i = 0; i < _path.GetCount(); i++)
@@ -411,7 +411,7 @@ void CExtractDialog::OnOK()
CModalDialog::OnOK();
}
#ifndef NO_REGISTRY
#ifndef Z7_NO_REGISTRY
#define kHelpTopic "fm/plugins/7-zip/extract.htm"
void CExtractDialog::OnHelp()
{

View File

@@ -1,7 +1,7 @@
// ExtractDialog.h
#ifndef __EXTRACT_DIALOG_H
#define __EXTRACT_DIALOG_H
#ifndef ZIP7_INC_EXTRACT_DIALOG_H
#define ZIP7_INC_EXTRACT_DIALOG_H
#include "ExtractDialogRes.h"
@@ -12,7 +12,7 @@
#include "../FileManager/DialogSize.h"
#ifndef NO_REGISTRY
#ifndef Z7_NO_REGISTRY
#include "../Common/ZipRegistry.h"
#endif
@@ -33,20 +33,20 @@ namespace NExtractionDialog
class CExtractDialog: public NWindows::NControl::CModalDialog
{
#ifdef NO_REGISTRY
#ifdef Z7_NO_REGISTRY
NWindows::NControl::CDialogChildControl _path;
#else
NWindows::NControl::CComboBox _path;
#endif
#ifndef _SFX
#ifndef Z7_SFX
NWindows::NControl::CEdit _pathName;
NWindows::NControl::CEdit _passwordControl;
NWindows::NControl::CComboBox _pathMode;
NWindows::NControl::CComboBox _overwriteMode;
#endif
#ifndef _SFX
#ifndef Z7_SFX
// int GetFilesMode() const;
void UpdatePasswordControl();
#endif
@@ -55,13 +55,13 @@ class CExtractDialog: public NWindows::NControl::CModalDialog
void CheckButton_TwoBools(UINT id, const CBoolPair &b1, const CBoolPair &b2);
void GetButton_Bools(UINT id, CBoolPair &b1, CBoolPair &b2);
virtual bool OnInit();
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
virtual void OnOK();
virtual bool OnInit() Z7_override;
virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND) Z7_override;
virtual void OnOK() Z7_override;
#ifndef NO_REGISTRY
#ifndef Z7_NO_REGISTRY
virtual void OnHelp();
virtual void OnHelp() Z7_override;
NExtract::CInfo _info;
@@ -76,7 +76,7 @@ public:
UString DirPath;
UString ArcPath;
#ifndef _SFX
#ifndef Z7_SFX
UString Password;
#endif
bool PathMode_Force;
@@ -84,16 +84,16 @@ public:
NExtract::NPathMode::EEnum PathMode;
NExtract::NOverwriteMode::EEnum OverwriteMode;
#ifndef _SFX
#ifndef Z7_SFX
// CBoolPair AltStreams;
CBoolPair NtSecurity;
#endif
CBoolPair ElimDup;
INT_PTR Create(HWND aWndParent = 0)
INT_PTR Create(HWND aWndParent = NULL)
{
#ifdef _SFX
#ifdef Z7_SFX
BIG_DIALOG_SIZE(240, 64);
#else
BIG_DIALOG_SIZE(300, 160);

View File

@@ -36,7 +36,7 @@ using namespace NDir;
static const wchar_t * const kIncorrectOutDir = L"Incorrect output directory path";
#ifndef _SFX
#ifndef Z7_SFX
static void AddValuePair(UString &s, UINT resourceID, UInt64 value, bool addColon = true)
{
@@ -60,10 +60,10 @@ static void AddSizePair(UString &s, UINT resourceID, UInt64 value)
class CThreadExtracting: public CProgressThreadVirt
{
HRESULT ProcessVirt();
HRESULT ProcessVirt() Z7_override;
public:
/*
#ifdef EXTERNAL_CODECS
#ifdef Z7_EXTERNAL_CODECS
const CExternalCodecs *externalCodecs;
#endif
*/
@@ -78,19 +78,19 @@ public:
const NWildcard::CCensorNode *WildcardCensor;
const CExtractOptions *Options;
#ifndef _SFX
#ifndef Z7_SFX
CHashBundle *HashBundle;
virtual void ProcessWasFinished_GuiVirt();
virtual void ProcessWasFinished_GuiVirt() Z7_override;
#endif
CMyComPtr<IExtractCallbackUI> ExtractCallback;
CMyComPtr<IFolderArchiveExtractCallback> FolderArchiveExtractCallback;
UString Title;
CPropNameValPairs Pairs;
};
#ifndef _SFX
#ifndef Z7_SFX
void CThreadExtracting::ProcessWasFinished_GuiVirt()
{
if (HashBundle && !Pairs.IsEmpty())
@@ -102,7 +102,7 @@ HRESULT CThreadExtracting::ProcessVirt()
{
CDecompressStat Stat;
#ifndef _SFX
#ifndef Z7_SFX
/*
if (HashBundle)
HashBundle->Init();
@@ -111,20 +111,21 @@ HRESULT CThreadExtracting::ProcessVirt()
HRESULT res = Extract(
/*
#ifdef EXTERNAL_CODECS
#ifdef Z7_EXTERNAL_CODECS
externalCodecs,
#endif
*/
codecs,
*FormatIndices, *ExcludedFormatIndices,
*ArchivePaths, *ArchivePathsFull,
*WildcardCensor, *Options, ExtractCallbackSpec, ExtractCallback,
#ifndef _SFX
*WildcardCensor, *Options,
ExtractCallbackSpec, ExtractCallbackSpec, FolderArchiveExtractCallback,
#ifndef Z7_SFX
HashBundle,
#endif
FinalMessage.ErrorMessage.Message, Stat);
#ifndef _SFX
#ifndef Z7_SFX
if (res == S_OK && ExtractCallbackSpec->IsOK())
{
if (HashBundle)
@@ -172,7 +173,7 @@ HRESULT ExtractGUI(
UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
CExtractOptions &options,
#ifndef _SFX
#ifndef Z7_SFX
CHashBundle *hb,
#endif
bool showDialog,
@@ -184,8 +185,8 @@ HRESULT ExtractGUI(
CThreadExtracting extracter;
/*
#ifdef EXTERNAL_CODECS
extracter.externalCodecs = __externalCodecs;
#ifdef Z7_EXTERNAL_CODECS
extracter.externalCodecs = _externalCodecs;
#endif
*/
extracter.codecs = codecs;
@@ -222,7 +223,7 @@ HRESULT ExtractGUI(
if (archivePathsFull.Size() == 1)
dialog.ArcPath = archivePathsFull[0];
#ifndef _SFX
#ifndef Z7_SFX
// dialog.AltStreams = options.NtOptions.AltStreams;
dialog.NtSecurity = options.NtOptions.NtSecurity;
if (extractCallback->PasswordIsDefined)
@@ -238,7 +239,7 @@ HRESULT ExtractGUI(
options.PathMode = dialog.PathMode;
options.ElimDup = dialog.ElimDup;
#ifndef _SFX
#ifndef Z7_SFX
// options.NtOptions.AltStreams = dialog.AltStreams;
options.NtOptions.NtSecurity = dialog.NtSecurity;
extractCallback->Password = dialog.Password;
@@ -258,7 +259,7 @@ HRESULT ExtractGUI(
{
UString s = GetUnicodeString(NError::MyFormatMessage(GetLastError()));
UString s2 = MyFormatNew(IDS_CANNOT_CREATE_FOLDER,
#ifdef LANG
#ifdef Z7_LANG
0x02000603,
#endif
options.OutputDir);
@@ -275,7 +276,7 @@ HRESULT ExtractGUI(
extracter.Title = title;
extracter.ExtractCallbackSpec = extractCallback;
extracter.ExtractCallbackSpec->ProgressDialog = &extracter;
extracter.ExtractCallback = extractCallback;
extracter.FolderArchiveExtractCallback = extractCallback;
extracter.ExtractCallbackSpec->Init();
extracter.CompressingMode = false;
@@ -284,13 +285,13 @@ HRESULT ExtractGUI(
extracter.ArchivePathsFull = &archivePathsFull;
extracter.WildcardCensor = &wildcardCensor;
extracter.Options = &options;
#ifndef _SFX
#ifndef Z7_SFX
extracter.HashBundle = hb;
#endif
extracter.IconID = IDI_ICON;
RINOK(extracter.Create(title, hwndParent));
RINOK(extracter.Create(title, hwndParent))
messageWasDisplayed = extracter.ThreadFinishedOK && extracter.MessagesDisplayed;
return extracter.Result;
}

View File

@@ -1,7 +1,7 @@
// GUI/ExtractGUI.h
#ifndef __EXTRACT_GUI_H
#define __EXTRACT_GUI_H
#ifndef ZIP7_INC_EXTRACT_GUI_H
#define ZIP7_INC_EXTRACT_GUI_H
#include "../Common/Extract.h"
@@ -28,7 +28,7 @@ HRESULT ExtractGUI(
UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
CExtractOptions &options,
#ifndef _SFX
#ifndef Z7_SFX
CHashBundle *hb,
#endif
bool showDialog,

View File

@@ -7,8 +7,11 @@
#endif
#include "../../../Common/MyWindows.h"
#if defined(__MINGW32__) || defined(__MINGW64__)
#include <shlwapi.h>
#else
#include <Shlwapi.h>
#endif
#include "../../../Common/MyInitGuid.h"
@@ -23,7 +26,7 @@
#include "../Common/ExitCode.h"
#include "../FileManager/StringUtils.h"
#include "../FileManager/MyWindowsNew.h"
#include "../FileManager/LangUtils.h"
#include "BenchmarkDialog.h"
#include "ExtractGUI.h"
@@ -34,7 +37,9 @@
using namespace NWindows;
#ifdef EXTERNAL_CODECS
#ifdef Z7_EXTERNAL_CODECS
extern
const CExternalCodecs *g_ExternalCodecs_Ptr;
const CExternalCodecs *g_ExternalCodecs_Ptr;
#endif
@@ -51,20 +56,23 @@ DWORD g_ComCtl32Version;
static DWORD GetDllVersion(LPCTSTR dllName)
{
DWORD dwVersion = 0;
HINSTANCE hinstDll = LoadLibrary(dllName);
if (hinstDll)
const HMODULE hmodule = LoadLibrary(dllName);
if (hmodule)
{
DLLGETVERSIONPROC pDllGetVersion = (DLLGETVERSIONPROC)(void *)GetProcAddress(hinstDll, "DllGetVersion");
if (pDllGetVersion)
const
DLLGETVERSIONPROC f_DllGetVersion = Z7_GET_PROC_ADDRESS(
DLLGETVERSIONPROC, hmodule,
"DllGetVersion");
if (f_DllGetVersion)
{
DLLVERSIONINFO dvi;
ZeroMemory(&dvi, sizeof(dvi));
dvi.cbSize = sizeof(dvi);
HRESULT hr = (*pDllGetVersion)(&dvi);
const HRESULT hr = (*f_DllGetVersion)(&dvi);
if (SUCCEEDED(hr))
dwVersion = MAKELONG(dvi.dwMinorVersion, dvi.dwMajorVersion);
dwVersion = (DWORD)MAKELONG(dvi.dwMinorVersion, dvi.dwMajorVersion);
}
FreeLibrary(hinstDll);
FreeLibrary(hmodule);
}
return dwVersion;
}
@@ -100,9 +108,9 @@ static int ShowMemErrorMessage()
return NExitCode::kMemoryError;
}
static int ShowSysErrorMessage(DWORD errorCode)
static int ShowSysErrorMessage(HRESULT errorCode)
{
if ((HRESULT)errorCode == E_OUTOFMEMORY)
if (errorCode == E_OUTOFMEMORY)
return ShowMemErrorMessage();
ErrorMessage(HResultToMessage(errorCode));
return NExitCode::kFatalError;
@@ -125,7 +133,7 @@ static int Main2()
#endif
if (commandStrings.Size() == 0)
{
MessageBoxW(0, L"Specify command", L"7-Zip", 0);
MessageBoxW(NULL, L"Specify command", L"7-Zip", 0);
return 0;
}
@@ -142,14 +150,14 @@ static int Main2()
ThrowException_if_Error(codecs->Load());
Codecs_AddHashArcHandler(codecs);
#ifdef EXTERNAL_CODECS
#ifdef Z7_EXTERNAL_CODECS
{
g_ExternalCodecs_Ptr = &__externalCodecs;
g_ExternalCodecs_Ptr = &_externalCodecs;
UString s;
codecs->GetCodecsErrorMessage(s);
if (!s.IsEmpty())
{
MessageBoxW(0, s, L"7-Zip", MB_ICONERROR);
MessageBoxW(NULL, s, L"7-Zip", MB_ICONERROR);
}
}
@@ -162,7 +170,7 @@ static int Main2()
|| options.Command.IsFromUpdateGroup()))
{
#ifdef EXTERNAL_CODECS
#ifdef Z7_EXTERNAL_CODECS
if (!codecs->MainDll_ErrorPath.IsEmpty())
{
UString s ("7-Zip cannot load module: ");
@@ -194,12 +202,12 @@ static int Main2()
// excludedFormats.Sort();
}
#ifdef EXTERNAL_CODECS
#ifdef Z7_EXTERNAL_CODECS
if (isExtractGroupCommand
|| options.Command.IsFromUpdateGroup()
|| options.Command.CommandType == NCommandType::kHash
|| options.Command.CommandType == NCommandType::kBenchmark)
ThrowException_if_Error(__externalCodecs.Load());
ThrowException_if_Error(_externalCodecs.Load());
#endif
if (options.Command.CommandType == NCommandType::kBenchmark)
@@ -227,7 +235,7 @@ static int Main2()
CExtractCallbackImp *ecs = new CExtractCallbackImp;
CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
#ifndef _NO_CRYPTO
#ifndef Z7_NO_CRYPTO
ecs->PasswordIsDefined = options.PasswordEnabled;
ecs->Password = options.Password;
#endif
@@ -241,13 +249,13 @@ static int Main2()
eo.YesToAll = options.YesToAll;
eo.TestMode = options.Command.IsTestCommand();
#ifndef _SFX
#ifndef Z7_SFX
eo.Properties = options.Properties;
#endif
bool messageWasDisplayed = false;
#ifndef _SFX
#ifndef Z7_SFX
CHashBundle hb;
CHashBundle *hb_ptr = NULL;
@@ -289,7 +297,7 @@ static int Main2()
ArchivePathsFullSorted,
options.Censor.Pairs.Front().Head,
eo,
#ifndef _SFX
#ifndef Z7_SFX
hb_ptr,
#endif
options.ShowDialog, messageWasDisplayed, ecs);
@@ -304,14 +312,14 @@ static int Main2()
}
else if (options.Command.IsFromUpdateGroup())
{
#ifndef _NO_CRYPTO
#ifndef Z7_NO_CRYPTO
bool passwordIsDefined = options.PasswordEnabled && !options.Password.IsEmpty();
#endif
CUpdateCallbackGUI callback;
// callback.EnablePercents = options.EnablePercents;
#ifndef _NO_CRYPTO
#ifndef Z7_NO_CRYPTO
callback.PasswordIsDefined = passwordIsDefined;
callback.AskPassword = options.PasswordEnabled && options.Password.IsEmpty();
callback.Password = options.Password;
@@ -407,7 +415,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
OleInitialize(NULL);
#endif
#ifdef Z7_LANG
LoadLangOneTime();
#endif
// setlocale(LC_COLLATE, ".ACP");
try
@@ -456,7 +466,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
catch(int v)
{
AString e ("Error: ");
e.Add_UInt32(v);
e.Add_UInt32((unsigned)v);
ErrorMessage(e);
return NExitCode::kFatalError;
}

View File

@@ -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 /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" /D "_7ZIP_LARGE_PAGES" /FAcs /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /Gr /MD /W4 /WX /GX /O1 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "Z7_LANG" /D "Z7_LONG_PATH" /D "Z7_EXTERNAL_CODECS" /D "Z7_DEVICE_FILE" /D "Z7_LARGE_PAGES" /FAcs /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 /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" /D "_7ZIP_LARGE_PAGES" /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 "Z7_LANG" /D "Z7_LONG_PATH" /D "Z7_EXTERNAL_CODECS" /D "Z7_DEVICE_FILE" /D "Z7_LARGE_PAGES" /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 /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" /D "_7ZIP_LARGE_PAGES" /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 "Z7_LANG" /D "Z7_LONG_PATH" /D "Z7_EXTERNAL_CODECS" /D "Z7_DEVICE_FILE" /D "Z7_LARGE_PAGES" /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 /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" /D "_7ZIP_LARGE_PAGES" /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 "Z7_LANG" /D "Z7_LONG_PATH" /D "Z7_EXTERNAL_CODECS" /D "Z7_DEVICE_FILE" /D "Z7_LARGE_PAGES" /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"
@@ -485,10 +485,6 @@ SOURCE=..\FileManager\ExtractCallback.h
# End Source File
# Begin Source File
SOURCE=..\FileManager\FolderInterface.h
# End Source File
# Begin Source File
SOURCE=..\FileManager\FormatUtils.cpp
# End Source File
# Begin Source File
@@ -669,6 +665,14 @@ SOURCE=..\..\Common\MethodProps.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\MultiOutStream.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\MultiOutStream.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\ProgressUtils.cpp
# End Source File
# Begin Source File
@@ -777,6 +781,10 @@ SOURCE=..\..\..\..\C\7zTypes.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\7zWindows.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Alloc.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
@@ -872,6 +880,14 @@ SOURCE=..\..\..\Common\CommandLineParser.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Common.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Compiler.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\CRC.cpp
# End Source File
# Begin Source File
@@ -928,6 +944,10 @@ SOURCE=..\..\..\Common\MyVector.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\MyWindows.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\NewHandler.cpp
# End Source File
# Begin Source File
@@ -1226,6 +1246,14 @@ SOURCE=..\..\Archive\IArchive.h
SOURCE=..\..\ICoder.h
# End Source File
# Begin Source File
SOURCE=..\..\IDecl.h
# End Source File
# Begin Source File
SOURCE=..\..\IStream.h
# End Source File
# End Group
# End Target
# End Project

View File

@@ -22,7 +22,7 @@ using namespace NWindows;
class CHashCallbackGUI: public CProgressThreadVirt, public IHashCallbackUI
class CHashCallbackGUI Z7_final: public CProgressThreadVirt, public IHashCallbackUI
{
UInt64 NumFiles;
bool _curIsFolder;
@@ -31,24 +31,28 @@ class CHashCallbackGUI: public CProgressThreadVirt, public IHashCallbackUI
CPropNameValPairs PropNameValPairs;
HRESULT ProcessVirt();
virtual void ProcessWasFinished_GuiVirt();
HRESULT ProcessVirt() Z7_override;
virtual void ProcessWasFinished_GuiVirt() Z7_override;
public:
const NWildcard::CCensor *censor;
const CHashOptions *options;
DECL_EXTERNAL_CODECS_LOC_VARS2;
DECL_EXTERNAL_CODECS_LOC_VARS_DECL
CHashCallbackGUI() {}
~CHashCallbackGUI() { }
INTERFACE_IHashCallbackUI(;)
Z7_IFACE_IMP(IDirItemsCallback)
Z7_IFACE_IMP(IHashCallbackUI)
/*
void AddErrorMessage(DWORD systemError, const wchar_t *name)
{
Sync.AddError_Code_Name(systemError, name);
}
*/
void AddErrorMessage(HRESULT systemError, const wchar_t *name)
{
Sync.AddError_Code_Name(systemError, name);
}
};
@@ -106,13 +110,13 @@ HRESULT CHashCallbackGUI::ScanProgress(const CDirItemsStat &st, const FString &p
HRESULT CHashCallbackGUI::ScanError(const FString &path, DWORD systemError)
{
AddErrorMessage(systemError, fs2us(path));
AddErrorMessage(HRESULT_FROM_WIN32(systemError), fs2us(path));
return CheckBreak();
}
HRESULT CHashCallbackGUI::FinishScanning(const CDirItemsStat &st)
{
return ScanProgress(st, FString(), false);
return ScanProgress(st, FString(), false); // isDir
}
HRESULT CHashCallbackGUI::CheckBreak()
@@ -158,7 +162,7 @@ HRESULT CHashCallbackGUI::OpenFileError(const FString &path, DWORD systemError)
{
// if (systemError == ERROR_SHARING_VIOLATION)
{
AddErrorMessage(systemError, fs2us(path));
AddErrorMessage(HRESULT_FROM_WIN32(systemError), fs2us(path));
return S_FALSE;
}
// return systemError;
@@ -305,8 +309,8 @@ HRESULT HashCalcGUI(
bool &messageWasDisplayed)
{
CHashCallbackGUI t;
#ifdef EXTERNAL_CODECS
t.__externalCodecs = __externalCodecs;
#ifdef Z7_EXTERNAL_CODECS
t._externalCodecs = _externalCodecs;
#endif
t.censor = &censor;
t.options = &options;
@@ -319,7 +323,7 @@ HRESULT HashCalcGUI(
t.MainAddTitle = title;
t.MainAddTitle.Add_Space();
RINOK(t.Create(title));
RINOK(t.Create(title))
messageWasDisplayed = t.ThreadFinishedOK && t.MessagesDisplayed;
return S_OK;
}
@@ -352,8 +356,8 @@ void ShowHashResults(const CHashBundle &hb, HWND hwnd)
ShowHashResults(propPairs, hwnd);
}
void CHashCallbackGUI::ProcessWasFinished_GuiVirt()
{
ShowHashResults(PropNameValPairs, *this);
if (Result != E_ABORT)
ShowHashResults(PropNameValPairs, *this);
}

View File

@@ -1,7 +1,7 @@
// HashGUI.h
#ifndef __HASH_GUI_H
#define __HASH_GUI_H
#ifndef ZIP7_INC_HASH_GUI_H
#define ZIP7_INC_HASH_GUI_H
#include "../Common/HashCalc.h"
#include "../Common/Property.h"

View File

@@ -1,21 +1,6 @@
// StdAfx.h
#ifndef __STDAFX_H
#define __STDAFX_H
// #define _WIN32_WINNT 0x0400
#define _WIN32_WINNT 0x0500
#define WINVER _WIN32_WINNT
#include "../../../Common/Common.h"
// #include "../../../Common/MyWindows.h"
// #include <CommCtrl.h>
// #include <ShlObj.h>
// #include <Shlwapi.h>
// #define printf(x) NO_PRINTF_(x)
// #define sprintf(x) NO_SPRINTF_(x)
#if _MSC_VER >= 1800
#pragma warning(disable : 4464) // relative include path contains '..'
#endif
#include "../FileManager/StdAfx.h"

View File

@@ -51,7 +51,7 @@ HRESULT CUpdateCallbackGUI::StartScanning()
HRESULT CUpdateCallbackGUI::ScanError(const FString &path, DWORD systemError)
{
FailedFiles.Add(path);
ProgressDialog->Sync.AddError_Code_Name(systemError, fs2us(path));
ProgressDialog->Sync.AddError_Code_Name(HRESULT_FROM_WIN32(systemError), fs2us(path));
return S_OK;
}
@@ -59,7 +59,7 @@ HRESULT CUpdateCallbackGUI::FinishScanning(const CDirItemsStat &st)
{
CProgressSync &sync = ProgressDialog->Sync;
RINOK(ProgressDialog->Sync.ScanProgress(st.NumFiles + st.NumAltStreams,
st.GetTotalBytes(), FString(), true));
st.GetTotalBytes(), FString(), true))
sync.Set_Status(L"");
return S_OK;
}
@@ -130,7 +130,7 @@ HRESULT CUpdateCallbackGUI::OpenFileError(const FString &path, DWORD systemError
FailedFiles.Add(path);
// if (systemError == ERROR_SHARING_VIOLATION)
{
ProgressDialog->Sync.AddError_Code_Name(systemError, fs2us(path));
ProgressDialog->Sync.AddError_Code_Name(HRESULT_FROM_WIN32(systemError), fs2us(path));
return S_FALSE;
}
// return systemError;
@@ -209,7 +209,7 @@ HRESULT CUpdateCallbackGUI::Open_SetCompleted(const UInt64 * /* numFiles */, con
return ProgressDialog->Sync.CheckStop();
}
#ifndef _NO_CRYPTO
#ifndef Z7_NO_CRYPTO
HRESULT CUpdateCallbackGUI::Open_CryptoGetTextPassword(BSTR *password)
{
@@ -260,7 +260,7 @@ HRESULT CUpdateCallbackGUI::StartOpenArchive(const wchar_t * /* name */)
HRESULT CUpdateCallbackGUI::ReadingFileError(const FString &path, DWORD systemError)
{
FailedFiles.Add(path);
ProgressDialog->Sync.AddError_Code_Name(systemError, fs2us(path));
ProgressDialog->Sync.AddError_Code_Name(HRESULT_FROM_WIN32(systemError), fs2us(path));
return S_OK;
}

View File

@@ -1,34 +1,31 @@
// UpdateCallbackGUI.h
#ifndef __UPDATE_CALLBACK_GUI_H
#define __UPDATE_CALLBACK_GUI_H
#ifndef ZIP7_INC_UPDATE_CALLBACK_GUI_H
#define ZIP7_INC_UPDATE_CALLBACK_GUI_H
#include "../Common/Update.h"
#include "../Common/ArchiveOpenCallback.h"
#include "UpdateCallbackGUI2.h"
class CUpdateCallbackGUI:
class CUpdateCallbackGUI Z7_final:
public IOpenCallbackUI,
public IUpdateCallbackUI2,
public CUpdateCallbackGUI2
{
Z7_IFACE_IMP(IOpenCallbackUI)
Z7_IFACE_IMP(IUpdateCallbackUI)
Z7_IFACE_IMP(IDirItemsCallback)
Z7_IFACE_IMP(IUpdateCallbackUI2)
public:
// CUpdateCallbackGUI();
// ~CUpdateCallbackGUI();
bool AskPassword;
void Init();
FStringVector FailedFiles;
CUpdateCallbackGUI():
AskPassword(false)
{}
INTERFACE_IUpdateCallbackUI2(;)
INTERFACE_IOpenCallbackUI(;)
FStringVector FailedFiles;
void Init();
};
#endif

View File

@@ -31,7 +31,7 @@ void CUpdateCallbackGUI2::Init()
_lang_Removing = LangString(IDS_PROGRESS_REMOVE);
_lang_Ops.Clear();
for (unsigned i = 0; i < ARRAY_SIZE(k_UpdNotifyLangs); i++)
for (unsigned i = 0; i < Z7_ARRAY_SIZE(k_UpdNotifyLangs); i++)
_lang_Ops.Add(LangString(k_UpdNotifyLangs[i]));
}

View File

@@ -1,7 +1,7 @@
// UpdateCallbackGUI2.h
#ifndef __UPDATE_CALLBACK_GUI2_H
#define __UPDATE_CALLBACK_GUI2_H
#ifndef ZIP7_INC_UPDATE_CALLBACK_GUI2_H
#define ZIP7_INC_UPDATE_CALLBACK_GUI2_H
#include "../FileManager/ProgressDialog2.h"
@@ -23,7 +23,6 @@ public:
NumFiles(0)
{}
// ~CUpdateCallbackGUI2();
void Init();
CProgressDialog *ProgressDialog;

View File

@@ -37,7 +37,7 @@ UString HResultToMessage(HRESULT errorCode);
class CThreadUpdating: public CProgressThreadVirt
{
HRESULT ProcessVirt();
HRESULT ProcessVirt() Z7_override;
public:
CCodecs *codecs;
const CObjectVector<COpenType> *formatIndices;
@@ -185,7 +185,7 @@ static void ParseAndAddPropertires(CObjectVector<CProperty> &properties,
property.Name = s;
else
{
property.Name.SetFrom(s, index);
property.Name.SetFrom(s, (unsigned)index);
property.Value = s.Ptr(index + 1);
}
properties.Add(property);
@@ -222,6 +222,16 @@ static void SetOutProperties(
name += (di.OrderMode ? "mem" : "d");
AddProp_Size(properties, name, di.Dict64);
}
/*
if (di.Dict64_Chain != (UInt64)(Int64)-1)
{
AString name;
if (is7z)
name = "0";
name += "dc";
AddProp_Size(properties, name, di.Dict64_Chain);
}
*/
if (di.Order != (UInt32)(Int32)-1)
{
AString name;
@@ -287,17 +297,17 @@ static const C_UpdateMode_ToAction_Pair g_UpdateMode_Pairs[] =
static int FindActionSet(const NUpdateArchive::CActionSet &actionSet)
{
for (unsigned i = 0; i < ARRAY_SIZE(g_UpdateMode_Pairs); i++)
for (unsigned i = 0; i < Z7_ARRAY_SIZE(g_UpdateMode_Pairs); i++)
if (actionSet.IsEqualTo(*g_UpdateMode_Pairs[i].ActionSet))
return i;
return (int)i;
return -1;
}
static int FindUpdateMode(NCompressDialog::NUpdateMode::EEnum mode)
{
for (unsigned i = 0; i < ARRAY_SIZE(g_UpdateMode_Pairs); i++)
for (unsigned i = 0; i < Z7_ARRAY_SIZE(g_UpdateMode_Pairs); i++)
if (mode == g_UpdateMode_Pairs[i].UpdateMode)
return i;
return (int)i;
return -1;
}
@@ -365,10 +375,14 @@ static HRESULT ShowDialog(
}
}
/*
// v23: we restore current dir in dialog code
#if defined(_WIN32) && !defined(UNDER_CE)
CCurrentDirRestorer curDirRestorer;
#endif
*/
CCompressDialog dialog;
NCompressDialog::CInfo &di = dialog.Info;
dialog.ArcFormats = &codecs->Formats;
@@ -453,9 +467,11 @@ static HRESULT ShowDialog(
if (di.PreserveATime.Def)
options.PreserveATime = di.PreserveATime.Val;
/*
#if defined(_WIN32) && !defined(UNDER_CE)
curDirRestorer.NeedRestore = dialog.CurrentDirWasChanged;
#endif
*/
options.VolumesSizes = di.VolumeSizes;
/*
@@ -539,7 +555,7 @@ HRESULT UpdateGUI(
bool needSetPath = true;
if (showDialog)
{
RINOK(ShowDialog(codecs, censor.CensorPaths, options, callback, hwndParent));
RINOK(ShowDialog(codecs, censor.CensorPaths, options, callback, hwndParent))
needSetPath = false;
}
if (options.SfxMode && options.SfxModule.IsEmpty())
@@ -582,7 +598,7 @@ HRESULT UpdateGUI(
tu.Options = &options;
tu.IconID = IDI_ICON;
RINOK(tu.Create(title, hwndParent));
RINOK(tu.Create(title, hwndParent))
messageWasDisplayed = tu.ThreadFinishedOK && tu.MessagesDisplayed;
return tu.Result;

View File

@@ -1,7 +1,7 @@
// GUI/UpdateGUI.h
#ifndef __UPDATE_GUI_H
#define __UPDATE_GUI_H
#ifndef ZIP7_INC_UPDATE_GUI_H
#define ZIP7_INC_UPDATE_GUI_H
#include "../Common/Update.h"

View File

@@ -1,13 +1,13 @@
PROG = 7zG.exe
CFLAGS = $(CFLAGS) \
-DLANG \
-DEXTERNAL_CODECS \
-DZ7_LANG \
-DZ7_EXTERNAL_CODECS \
!IFDEF UNDER_CE
LIBS = $(LIBS) ceshell.lib Commctrl.lib
!ELSE
LIBS = $(LIBS) comctl32.lib htmlhelp.lib comdlg32.lib gdi32.lib
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -DSUPPORT_DEVICE_FILE -D_7ZIP_LARGE_PAGES
CFLAGS = $(CFLAGS) -DZ7_LONG_PATH -DZ7_LARGE_PAGES -DZ7_DEVICE_FILE
!ENDIF
GUI_OBJS = \
@@ -72,6 +72,7 @@ WIN_CTRL_OBJS = \
$O\FilterCoder.obj \
$O\LimitedStreams.obj \
$O\MethodProps.obj \
$O\MultiOutStream.obj \
$O\ProgressUtils.obj \
$O\PropId.obj \
$O\StreamObjects.obj \