This commit is contained in:
Igor Pavlov
2011-04-11 00:00:00 +00:00
committed by Kornel Lesiński
parent de4f8c22fe
commit 35596517f2
322 changed files with 9989 additions and 7759 deletions

View File

@@ -4,6 +4,7 @@
#include "Common/IntToString.h"
#include "Common/MyException.h"
#include "Common/StringConvert.h"
#include "Windows/Error.h"
#include "Windows/System.h"
@@ -85,6 +86,25 @@ bool CBenchmarkDialog::OnInit()
Sync.Init();
if (TotalMode)
{
_consoleEdit.Attach(GetItem(IDC_BENCHMARK2_EDIT));
LOGFONT f;
memset(&f, 0, sizeof(f));
f.lfHeight = 14;
f.lfWidth = 0;
f.lfWeight = FW_DONTCARE;
f.lfCharSet = DEFAULT_CHARSET;
f.lfOutPrecision = OUT_DEFAULT_PRECIS;
f.lfClipPrecision = CLIP_DEFAULT_PRECIS;
f.lfQuality = DEFAULT_QUALITY;
f.lfPitchAndFamily = FIXED_PITCH;
MyStringCopy(f.lfFaceName, TEXT(""));
_font.Create(&f);
if (_font._font)
_consoleEdit.SendMessage(WM_SETFONT, (WPARAM)_font._font, TRUE);
}
UInt32 numCPUs = NSystem::GetNumberOfProcessors();
if (numCPUs < 1)
@@ -101,8 +121,8 @@ bool CBenchmarkDialog::OnInit()
int cur = 0;
for (UInt32 num = 1; num <= numCPUs * 2;)
{
TCHAR s[40];
ConvertUInt64ToString(num, s);
TCHAR s[16];
ConvertUInt32ToString(num, s);
int index = (int)m_NumThreads.AddString(s);
m_NumThreads.SetItemData(index, num);
if (num <= Sync.NumThreads)
@@ -143,8 +163,8 @@ bool CBenchmarkDialog::OnInit()
UInt32 dictionary = (1 << i) + (j << (i - 1));
if (dictionary > kMaxDicSize)
continue;
TCHAR s[40];
ConvertUInt64ToString((dictionary >> 20), s);
TCHAR s[16];
ConvertUInt32ToString((dictionary >> 20), s);
lstrcat(s, kMB);
int index = (int)m_Dictionary.AddString(s);
m_Dictionary.SetItemData(index, dictionary);
@@ -158,10 +178,47 @@ bool CBenchmarkDialog::OnInit()
Sync._startEvent.Set();
_timer = SetTimer(kTimerID, kTimerElapse);
NormalizePosition();
if (TotalMode)
NormalizeSize(true);
else
NormalizePosition();
return CModalDialog::OnInit();
}
bool CBenchmarkDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
{
if (!TotalMode)
return false;
int mx, my;
GetMargins(8, mx, my);
int bx1, bx2, by;
GetItemSizes(IDCANCEL, bx1, by);
GetItemSizes(IDHELP, bx2, by);
int y = ySize - my - by;
int x = xSize - mx - bx1;
InvalidateRect(NULL);
MoveItem(IDCANCEL, x, y, bx1, by);
MoveItem(IDHELP, x - mx - bx2, y, bx2, by);
if (_consoleEdit)
{
int yPos = ySize - my - by;
RECT rect;
GetClientRectOfItem(IDC_BENCHMARK2_EDIT, rect);
int y = rect.top;
int ySize2 = yPos - my - y;
const int kMinYSize = 20;
int xx = xSize - mx * 2;
if (ySize2 < kMinYSize)
{
ySize2 = kMinYSize;
}
_consoleEdit.Move(mx, y, xx, ySize2);
}
return false;
}
UInt32 CBenchmarkDialog::GetNumberOfThreads()
{
return (UInt32)m_NumThreads.GetItemData(m_NumThreads.GetCurSel());
@@ -209,7 +266,7 @@ void CBenchmarkDialog::OnChangeSettings()
EnableItem(IDC_BUTTON_STOP, true);
UInt32 dictionary = OnChangeDictionary();
TCHAR s[40] = { TEXT('/'), TEXT(' '), 0 };
ConvertUInt64ToString(NSystem::GetNumberOfProcessors(), s + 2);
ConvertUInt32ToString(NSystem::GetNumberOfProcessors(), s + 2);
SetItemText(IDC_BENCHMARK_HARDWARE_THREADS, s);
for (int i = 0; i < sizeof(g_IDs) / sizeof(g_IDs[0]); i++)
SetItemText(g_IDs[i], kProcessingString);
@@ -305,15 +362,32 @@ void CBenchmarkDialog::PrintResults(
rating = GetCompressRating(dictionarySize, info.GlobalTime, info.GlobalFreq, size * info.NumIterations);
PrintRating(rating, ratingID);
PrintRating(GetRatingPerUsage(info, rating), rpuID);
PrintUsage(GetUsage(info), usageID);
PrintRating(info.GetRatingPerUsage(rating), rpuID);
PrintUsage(info.GetUsage(), usageID);
}
bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
{
PrintTime();
bool printTime = true;
if (TotalMode)
{
if (Sync.WasStopped())
printTime = false;
}
if (printTime)
PrintTime();
NWindows::NSynchronization::CCriticalSectionLock lock(Sync.CS);
if (TotalMode)
{
if (Sync.TextWasChanged)
{
_consoleEdit.SetText(GetSystemString(Sync.Text));
Sync.TextWasChanged = false;
}
return true;
}
TCHAR s[40];
ConvertUInt64ToString((Sync.ProcessedSize >> 20), s);
lstrcat(s, kMB);
@@ -377,9 +451,11 @@ bool CBenchmarkDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
Sync.DecompressingInfo.PackSize, 1);
PrintRating((comprRating + decomprRating) / 2, IDC_BENCHMARK_TOTAL_RATING_VALUE);
PrintRating((
GetRatingPerUsage(Sync.CompressingInfo, comprRating) +
GetRatingPerUsage(Sync.DecompressingInfo, decomprRating)) / 2, IDC_BENCHMARK_TOTAL_RPU_VALUE);
PrintUsage((GetUsage(Sync.CompressingInfo) + GetUsage(Sync.DecompressingInfo)) / 2, IDC_BENCHMARK_TOTAL_USAGE_VALUE);
Sync.CompressingInfo.GetRatingPerUsage(comprRating) +
Sync.DecompressingInfo.GetRatingPerUsage(decomprRating)) / 2, IDC_BENCHMARK_TOTAL_RPU_VALUE);
PrintUsage(
(Sync.CompressingInfo.GetUsage() +
Sync.DecompressingInfo.GetUsage()) / 2, IDC_BENCHMARK_TOTAL_USAGE_VALUE);
}
}
return true;
@@ -414,7 +490,6 @@ bool CBenchmarkDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
struct CThreadBenchmark
{
CBenchmarkDialog *BenchmarkDialog;
UInt64 _startTime;
DECL_EXTERNAL_CODECS_VARS
// UInt32 dictionarySize;
// UInt32 numThreads;
@@ -478,6 +553,35 @@ HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
return S_OK;
}
struct CBenchCallback2: public IBenchPrintCallback
{
CProgressSyncInfo *Sync;
void Print(const char *s);
void NewLine();
HRESULT CheckBreak();
};
void CBenchCallback2::Print(const char *s)
{
NSynchronization::CCriticalSectionLock lock(Sync->CS);
Sync->Text += s;
Sync->TextWasChanged = true;
}
void CBenchCallback2::NewLine()
{
Print("\xD\n");
}
HRESULT CBenchCallback2::CheckBreak()
{
if (Sync->Changed || Sync->Paused || Sync->Stopped)
return E_ABORT;
return S_OK;
}
HRESULT CThreadBenchmark::Process()
{
CProgressSyncInfo &sync = BenchmarkDialog->Sync;
@@ -508,12 +612,44 @@ HRESULT CThreadBenchmark::Process()
CBenchCallback callback;
callback.dictionarySize = dictionarySize;
callback.Sync = &sync;
CBenchCallback2 callback2;
callback2.Sync = &sync;
HRESULT result;
try
{
result = LzmaBench(
EXTERNAL_CODECS_VARS
numThreads, dictionarySize, &callback);
CObjectVector<CProperty> props;
if (BenchmarkDialog->TotalMode)
{
props = BenchmarkDialog->Props;
}
else
{
{
CProperty prop;
prop.Name = L"mt";
wchar_t s[16];
ConvertUInt32ToString(numThreads, s);
prop.Value = s;
props.Add(prop);
}
{
CProperty prop;
prop.Name = L"d";
wchar_t s[16];
ConvertUInt32ToString(dictionarySize, s);
prop.Name += s;
prop.Name += 'b';
props.Add(prop);
}
}
result = Bench(EXTERNAL_CODECS_VARS
BenchmarkDialog->TotalMode ? &callback2 : NULL,
BenchmarkDialog->TotalMode ? NULL : &callback,
props, 1, false);
if (BenchmarkDialog->TotalMode)
{
sync.Stop();
}
}
catch(...)
{
@@ -561,7 +697,7 @@ HRESULT CThreadBenchmark::Process()
HRESULT Benchmark(
DECL_EXTERNAL_CODECS_LOC_VARS
UInt32 numThreads, UInt32 dictionarySize, HWND hwndParent)
const CObjectVector<CProperty> props, HWND hwndParent)
{
CThreadBenchmark benchmarker;
#ifdef EXTERNAL_CODECS
@@ -569,13 +705,21 @@ HRESULT Benchmark(
benchmarker._externalCodecs = *externalCodecs;
#endif
CBenchmarkDialog benchmarkDialog;
benchmarkDialog.Sync.DictionarySize = dictionarySize;
benchmarkDialog.Sync.NumThreads = numThreads;
CBenchmarkDialog bd;
bd.Props = props;
bd.TotalMode = false;
for (int i = 0; i < props.Size(); i++)
{
const CProperty &prop = props[i];
if (prop.Name.CompareNoCase(L"m") == 0 && prop.Value == L"*")
bd.TotalMode = true;
}
bd.Sync.DictionarySize = (UInt32)-1;
bd.Sync.NumThreads = (UInt32)-1;
benchmarker.BenchmarkDialog = &bd;
benchmarker.BenchmarkDialog = &benchmarkDialog;
NWindows::CThread thread;
RINOK(thread.Create(CThreadBenchmark::MyThreadFunction, &benchmarker));
benchmarkDialog.Create(hwndParent);
bd.Create(hwndParent);
return thread.Wait();
}

View File

@@ -5,6 +5,7 @@
#include "Windows/Synchronization.h"
#include "Windows/Control/ComboBox.h"
#include "Windows/Control/Edit.h"
#include "../Common/Bench.h"
@@ -37,6 +38,9 @@ public:
CBenchInfo2 DecompressingInfoTemp;
CBenchInfo2 DecompressingInfo;
AString Text;
bool TextWasChanged;
CProgressSyncInfo()
{
if (_startEvent.Create() != S_OK)
@@ -56,6 +60,9 @@ public:
NumPasses = 0;
// NumErrors = 0;
Text.Empty();
TextWasChanged = true;
}
void Stop()
{
@@ -85,14 +92,33 @@ public:
void WaitCreating() { _startEvent.Lock(); }
};
struct CMyFont
{
HFONT _font;
CMyFont(): _font(NULL) {}
~CMyFont()
{
if (_font)
DeleteObject(_font);
}
void Create(const LOGFONT *lplf)
{
_font = CreateFontIndirect(lplf);
}
};
class CBenchmarkDialog:
public NWindows::NControl::CModalDialog
{
NWindows::NControl::CComboBox m_Dictionary;
NWindows::NControl::CComboBox m_NumThreads;
NWindows::NControl::CEdit _consoleEdit;
UINT_PTR _timer;
UINT32 _startTime;
CMyFont _font;
bool OnSize(WPARAM /* wParam */, int xSize, int ySize);
bool OnTimer(WPARAM timerID, LPARAM callback);
virtual bool OnInit();
void OnRestartButton();
@@ -115,12 +141,14 @@ class CBenchmarkDialog:
void OnChangeSettings();
public:
CProgressSyncInfo Sync;
bool TotalMode;
CObjectVector<CProperty> Props;
CBenchmarkDialog(): _timer(0) {}
CBenchmarkDialog(): _timer(0), TotalMode(false) {}
INT_PTR Create(HWND wndParent = 0)
{
BIG_DIALOG_SIZE(332, 228);
return CModalDialog::Create(SIZED_DIALOG(IDD_DIALOG_BENCHMARK), wndParent);
return CModalDialog::Create(TotalMode ? IDD_DIALOG_BENCHMARK_TOTAL : SIZED_DIALOG(IDD_DIALOG_BENCHMARK), wndParent);
}
void MessageBoxError(LPCWSTR message)
{
@@ -130,6 +158,6 @@ public:
HRESULT Benchmark(
DECL_EXTERNAL_CODECS_LOC_VARS
UInt32 numThreads, UInt32 dictionarySize, HWND hwndParent = NULL);
const CObjectVector<CProperty> props, HWND hwndParent = NULL);
#endif

View File

@@ -41,6 +41,12 @@
#define g3xs 36
#define g3x (m + g2xs)
#undef GROUP_Y_SIZE
#ifdef UNDER_CE
#define GROUP_Y_SIZE 8
#else
#define GROUP_Y_SIZE 40
#endif
IDD_DIALOG_BENCHMARK DIALOG 0, 0, xs, ys MY_MODAL_DIALOG_STYLE | WS_MINIMIZEBOX
CAPTION "Benchmark"
@@ -66,7 +72,7 @@ BEGIN
RTEXT "Rating / Usage", IDC_BENCHMARK_RPU_LABEL, xRpu, 54, sRpu, 8
RTEXT "Rating", IDC_BENCHMARK_RATING_LABEL, xRating, 54, sRating, 8
GROUPBOX "Compressing", IDC_BENCHMARK_COMPRESSING, m, 64, xc, 40
GROUPBOX "Compressing", IDC_BENCHMARK_COMPRESSING, m, 64, xc, GROUP_Y_SIZE
LTEXT "Current", IDC_BENCHMARK_CURRENT, g4x, 76, sLabel, 8
RTEXT "100%", IDC_BENCHMARK_COMPRESSING_USAGE, xUsage, 76, sUsage, 8
@@ -80,7 +86,7 @@ BEGIN
RTEXT "0", IDC_BENCHMARK_COMPRESSING_RPU2, xRpu, 89, sRpu, 8
RTEXT "0", IDC_BENCHMARK_COMPRESSING_RATING2, xRating, 89, sRating, 8
GROUPBOX "Decompressing", IDC_BENCHMARK_DECOMPRESSING, m, 111, xc, 40
GROUPBOX "Decompressing", IDC_BENCHMARK_DECOMPRESSING, m, 111, xc, GROUP_Y_SIZE
LTEXT "Current", IDC_BENCHMARK_CURRENT2, g4x, 123, sLabel, 8
RTEXT "100%", IDC_BENCHMARK_DECOMPRESSING_USAGE, xUsage, 123, sUsage, 8
@@ -94,7 +100,7 @@ BEGIN
RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RPU2, xRpu, 136, sRpu, 8
RTEXT "0", IDC_BENCHMARK_DECOMPRESSING_RATING2, xRating, 136, sRating, 8
GROUPBOX "Total Rating", IDC_BENCHMARK_TOTAL_RATING, xTotalRating, 163, sTotalRating, 38
GROUPBOX "Total Rating", IDC_BENCHMARK_TOTAL_RATING, xTotalRating, 163, sTotalRating, GROUP_Y_SIZE
RTEXT "0", IDC_BENCHMARK_TOTAL_USAGE_VALUE, xUsage, 181, sUsage, 8
RTEXT "0", IDC_BENCHMARK_TOTAL_RPU_VALUE, xRpu, 181, sRpu, 8
RTEXT "0", IDC_BENCHMARK_TOTAL_RATING_VALUE, xRating, 181, sRating, 8
@@ -225,3 +231,18 @@ BEGIN
END
#endif
#include "../../GuiCommon.rc"
#define xc 360
#define yc 260
IDD_DIALOG_BENCHMARK_TOTAL MY_RESIZE_DIALOG
CAPTION "Benchmark"
{
LTEXT "Elapsed time:", IDC_BENCHMARK_ELAPSED, m, m, 58, 8
RTEXT "00:00:00", IDC_BENCHMARK_ELAPSED_VALUE, m + 58, m, 38, 8
EDITTEXT IDC_BENCHMARK2_EDIT, m, m + 14, xc, yc - bys - m - 14, ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL | WS_VSCROLL | WS_HSCROLL
PUSHBUTTON "&Help", IDHELP, bx2, by, bxs, bys
PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
}

View File

@@ -1,5 +1,7 @@
#define IDD_DIALOG_BENCHMARK 550
#define IDD_DIALOG_BENCHMARK_2 650
#define IDD_DIALOG_BENCHMARK_TOTAL 750
#define IDD_DIALOG_BENCHMARK_TOTAL_2 750
#define IDC_BUTTON_STOP 1001
#define IDC_BUTTON_RESTART 1002
#define IDC_BENCHMARK_DICTIONARY 1010
@@ -53,3 +55,5 @@
#define IDC_BENCHMARK_SIZE_VALUE 1063
#define IDC_BENCHMARK_PASSES 1066
#define IDC_BENCHMARK_PASSES_VALUE 1067
#define IDC_BENCHMARK2_EDIT 1090

View File

@@ -351,7 +351,10 @@ namespace NCompressDialog
#ifndef UNDER_CE
NDirectory::MySetCurrentDirectory(CurrentDirPrefix);
#endif
return MyGetFullPathName(ArchiveName, result);
FString resultF;
bool res = MyGetFullPathName(us2fs(ArchiveName), resultF);
result = fs2us(resultF);
return res;
}
}
@@ -1236,6 +1239,7 @@ bool CCompressDialog::GetOrderMode()
switch (GetMethodID())
{
case kPPMd:
case kPPMdZip:
return true;
}
return false;

View File

@@ -49,7 +49,7 @@ namespace NCompressDialog
UString ArchiveName; // in: Relative for ; out: abs
UString CurrentDirPrefix;
FString CurrentDirPrefix;
bool KeepName;
bool GetFullPathName(UString &result) const;

View File

@@ -36,6 +36,16 @@
#define yOpt 72
#define yPsw 128
#undef GROUP_Y_SIZE
#undef GROUP_Y_SIZE_ENCRYPT
#ifdef UNDER_CE
#define GROUP_Y_SIZE 8
#define GROUP_Y_SIZE_ENCRYPT 8
#else
#define GROUP_Y_SIZE 48
#define GROUP_Y_SIZE_ENCRYPT 128
#endif
IDD_DIALOG_COMPRESS MY_DIALOG
CAPTION "Add to Archive"
BEGIN
@@ -82,13 +92,13 @@ BEGIN
LTEXT "&Update mode:",IDC_STATIC_COMPRESS_UPDATE_MODE, g4x, 39, g4xs, 8
COMBOBOX IDC_COMPRESS_COMBO_UPDATE_MODE, g4x, 51, g4xs, 80, MY_COMBO
GROUPBOX "Options",IDC_STATIC_COMPRESS_OPTIONS, g4x, yOpt, g4xs, 48
GROUPBOX "Options",IDC_STATIC_COMPRESS_OPTIONS, g4x, yOpt, g4xs, GROUP_Y_SIZE
CONTROL "Create SF&X archive",IDC_COMPRESS_SFX, MY_CHECKBOX,
g4x2, yOpt + 14, g4xs2, 10
CONTROL "Compress shared files",IDC_COMPRESS_SHARED, MY_CHECKBOX,
g4x2, yOpt + 30, g4xs2, 10
GROUPBOX "Encryption",IDC_COMPRESS_ENCRYPTION, g4x, yPsw, g4xs, 127
GROUPBOX "Encryption", IDC_COMPRESS_ENCRYPTION, g4x, yPsw, g4xs, GROUP_Y_SIZE_ENCRYPT
LTEXT "Enter password:",IDC_STATIC_COMPRESS_PASSWORD1, g4x2, yPsw + 14, g4xs2, 8
EDITTEXT IDC_COMPRESS_EDIT_PASSWORD1, g4x2, yPsw + 26, g4xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL

View File

@@ -352,4 +352,3 @@ void CExtractDialog::OnHelp()
CModalDialog::OnHelp();
}
#endif

View File

@@ -18,6 +18,13 @@
#define g2xs (xc - g1xs - gSpace)
#define g2xs2 (g2xs - m - m)
#undef GROUP_Y_SIZE
#ifdef UNDER_CE
#define GROUP_Y_SIZE 8
#else
#define GROUP_Y_SIZE 56
#endif
IDD_DIALOG_EXTRACT MY_DIALOG
CAPTION "Extract"
BEGIN
@@ -31,11 +38,7 @@ BEGIN
LTEXT "Overwrite mode:", IDC_EXTRACT_OVERWRITE_MODE, m, m + 68, g1xs, 8
COMBOBOX IDC_EXTRACT_COMBO_OVERWRITE_MODE, m, m + 80, g1xs, 140, MY_COMBO
#ifdef UNDER_CE
LTEXT "Password", IDC_EXTRACT_PASSWORD, g2x, m + 36, g2xs, 8
#else
GROUPBOX "Password", IDC_EXTRACT_PASSWORD, g2x, m + 36, g2xs, 56
#endif
GROUPBOX "Password", IDC_EXTRACT_PASSWORD, g2x, m + 36, g2xs, GROUP_Y_SIZE
EDITTEXT IDC_EXTRACT_EDIT_PASSWORD, g2x2, m + 50, g2xs2, 14, ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Show Password", IDC_EXTRACT_CHECK_SHOW_PASSWORD, MY_CHECKBOX, g2x2, m + 72, g2xs2, 10

View File

@@ -8,6 +8,7 @@
#include "Windows/Error.h"
#include "Windows/FileDir.h"
#include "Windows/FileFind.h"
#include "Windows/FileName.h"
#include "Windows/Thread.h"
#include "../FileManager/ExtractCallback.h"
@@ -128,7 +129,7 @@ HRESULT ExtractGUI(
if (!options.TestMode)
{
UString outputDir = options.OutputDir;
FString outputDir = options.OutputDir;
#ifndef UNDER_CE
if (outputDir.IsEmpty())
NFile::NDirectory::MyGetCurrentDirectory(outputDir);
@@ -136,20 +137,22 @@ HRESULT ExtractGUI(
if (showDialog)
{
CExtractDialog dialog;
if (!NFile::NDirectory::MyGetFullPathName(outputDir, dialog.DirectoryPath))
FString outputDirFull;
if (!NFile::NDirectory::MyGetFullPathName(outputDir, outputDirFull))
{
ShowErrorMessage(kIncorrectOutDir);
messageWasDisplayed = true;
return E_FAIL;
}
NFile::NName::NormalizeDirPathPrefix(dialog.DirectoryPath);
NFile::NName::NormalizeDirPathPrefix(outputDirFull);
dialog.DirectoryPath = fs2us(outputDirFull);
// dialog.OverwriteMode = options.OverwriteMode;
// dialog.PathMode = options.PathMode;
if (dialog.Create(hwndParent) != IDOK)
return E_ABORT;
outputDir = dialog.DirectoryPath;
outputDir = us2fs(dialog.DirectoryPath);
options.OverwriteMode = dialog.OverwriteMode;
options.PathMode = dialog.PathMode;
#ifndef _SFX

View File

@@ -121,7 +121,7 @@ static int Main2()
#ifdef EXTERNAL_CODECS
codecs, &externalCodecs,
#endif
options.NumThreads, options.DictionarySize);
options.Properties);
if (res != S_OK)
throw CSystemException(res);
}
@@ -146,7 +146,7 @@ static int Main2()
eo.TestMode = options.Command.IsTestMode();
eo.CalcCrc = options.CalcCrc;
#if !defined(_7ZIP_ST) && !defined(_SFX)
eo.Properties = options.ExtractProperties;
eo.Properties = options.Properties;
#endif
bool messageWasDisplayed = false;
@@ -280,4 +280,3 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
return NExitCode::kFatalError;
}
}

View File

@@ -585,6 +585,14 @@ SOURCE=..\..\Common\FilterCoder.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\MethodProps.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\MethodProps.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\ProgressUtils.cpp
# End Source File
# Begin Source File

View File

@@ -10,6 +10,7 @@
#include "Windows/Error.h"
#include "Windows/FileDir.h"
#include "Windows/FileName.h"
#include "Windows/Thread.h"
#include "../Common/WorkDir.h"
@@ -17,7 +18,6 @@
#include "../Explorer/MyMessages.h"
#include "../FileManager/LangUtils.h"
#include "../FileManager/ProgramLocation.h"
#include "../FileManager/StringUtils.h"
#include "../FileManager/resourceGui.h"
@@ -29,7 +29,7 @@
using namespace NWindows;
using namespace NFile;
static const wchar_t *kDefaultSfxModule = L"7z.sfx";
static CFSTR kDefaultSfxModule = FTEXT("7z.sfx");
static const wchar_t *kSFXExtension = L"exe";
extern void AddMessageToString(UString &dest, const UString &src);
@@ -52,8 +52,8 @@ HRESULT CThreadUpdating::ProcessVirt()
HRESULT res = UpdateArchive(codecs, *WildcardCensor, *Options,
ei, UpdateCallbackGUI, UpdateCallbackGUI);
ErrorMessage = ei.Message;
ErrorPath1 = ei.FileName;
ErrorPath2 = ei.FileName2;
SetErrorPath1(ei.FileName);
SetErrorPath2(ei.FileName2);
if (ei.SystemError != S_OK && ei.SystemError != E_FAIL && ei.SystemError != E_ABORT)
return ei.SystemError;
return res;
@@ -197,7 +197,7 @@ static HRESULT ShowDialog(
{
if (options.Commands.Size() != 1)
throw "It must be one command";
UString currentDirPrefix;
FString currentDirPrefix;
#ifndef UNDER_CE
{
if (!NDirectory::MyGetCurrentDirectory(currentDirPrefix))
@@ -207,7 +207,7 @@ static HRESULT ShowDialog(
#endif
bool oneFile = false;
NFind::CFileInfoW fileInfo;
NFind::CFileInfo fileInfo;
UString name;
if (censor.Pairs.Size() > 0)
{
@@ -224,7 +224,7 @@ static HRESULT ShowDialog(
name += WCHAR_PATH_SEPARATOR;
name += item.PathParts[i];
}
if (fileInfo.Find(name))
if (fileInfo.Find(us2fs(name)))
{
if (censor.Pairs.Size() == 1 && pair.Head.IncludeItems.Size() == 1)
oneFile = !fileInfo.IsDir();
@@ -253,7 +253,7 @@ static HRESULT ShowDialog(
// di.ArchiveName = options.ArchivePath.GetFinalPath();
di.ArchiveName = options.ArchivePath.GetPathWithoutExt();
dialog.OriginalFileName = options.ArchivePath.Prefix + fileInfo.Name;
dialog.OriginalFileName = options.ArchivePath.Prefix + fs2us(fileInfo.Name);
di.CurrentDirPrefix = currentDirPrefix;
di.SFXMode = options.SfxMode;
@@ -338,9 +338,10 @@ static HRESULT ShowDialog(
options.WorkingDir.Empty();
if (workDirInfo.Mode != NWorkDir::NMode::kCurrent)
{
UString fullPath;
NDirectory::MyGetFullPathName(di.ArchiveName, fullPath);
options.WorkingDir = GetWorkDir(workDirInfo, fullPath);
FString fullPath;
NDirectory::MyGetFullPathName(us2fs(di.ArchiveName), fullPath);
FString namePart;
options.WorkingDir = GetWorkDir(workDirInfo, fullPath, namePart);
NDirectory::CreateComplexDirectory(options.WorkingDir);
}
return S_OK;
@@ -362,9 +363,7 @@ HRESULT UpdateGUI(
}
if (options.SfxMode && options.SfxModule.IsEmpty())
{
UString folder;
if (!GetProgramFolderPath(folder))
folder.Empty();
FString folder = NWindows::NDLL::GetModuleDirPrefix();
options.SfxModule = folder + kDefaultSfxModule;
}

View File

@@ -6,7 +6,7 @@ CFLAGS = $(CFLAGS) -I ../../../ \
!IFDEF UNDER_CE
LIBS = $(LIBS) ceshell.lib Commctrl.lib
!ELSE
LIBS = $(LIBS) comctl32.lib htmlhelp.lib comdlg32.lib
LIBS = $(LIBS) comctl32.lib htmlhelp.lib comdlg32.lib gdi32.lib
CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -DSUPPORT_DEVICE_FILE -D_7ZIP_LARGE_PAGES
!ENDIF
@@ -63,6 +63,7 @@ WIN_CTRL_OBJS = \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\FilterCoder.obj \
$O\MethodProps.obj \
$O\ProgressUtils.obj \
$O\StreamUtils.obj \