summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/lzma/CPP/7zip/UI/FileManager
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/lzma/CPP/7zip/UI/FileManager')
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp452
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h19
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp4
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.h12
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/DialogSize.h4
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp221
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h172
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/FormatUtils.h4
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/LangUtils.h18
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h53
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp47
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h34
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp10
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h12
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp27
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h35
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp342
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h121
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h3
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc11
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyName.h4
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h9
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/StdAfx.h83
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp93
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h15
-rw-r--r--3rdparty/lzma/CPP/7zip/UI/FileManager/resource.h17
26 files changed, 1155 insertions, 667 deletions
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp b/3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp
index 066ac219190..5170302c332 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.cpp
@@ -4,7 +4,7 @@
#include "../../../Common/MyWindows.h"
-#include <commctrl.h>
+#include "../../../Common/IntToString.h"
#ifndef UNDER_CE
#include "../../../Windows/CommonDialog.h"
@@ -25,7 +25,6 @@
#ifdef USE_MY_BROWSE_DIALOG
#include "../../../Common/Defs.h"
-#include "../../../Common/IntToString.h"
#include "../../../Common/Wildcard.h"
#include "../../../Windows/FileDir.h"
@@ -40,11 +39,11 @@
#include "PropertyNameRes.h"
#include "SysIconUtils.h"
-#ifndef _SFX
+#ifndef Z7_SFX
#include "RegistryUtils.h"
#endif
-#endif
+#endif // USE_MY_BROWSE_DIALOG
#include "ComboDialog.h"
#include "LangUtils.h"
@@ -56,6 +55,11 @@ using namespace NFile;
using namespace NName;
using namespace NFind;
+static void MessageBox_Error_Global(HWND wnd, const wchar_t *message)
+{
+ ::MessageBoxW(wnd, message, L"7-Zip", MB_ICONERROR);
+}
+
#ifdef USE_MY_BROWSE_DIALOG
extern bool g_LVN_ITEMACTIVATE_Support;
@@ -63,19 +67,8 @@ extern bool g_LVN_ITEMACTIVATE_Support;
static const int kParentIndex = -1;
static const UINT k_Message_RefreshPathEdit = WM_APP + 1;
-static HRESULT GetNormalizedError()
-{
- DWORD errorCode = GetLastError();
- return errorCode == 0 ? E_FAIL : errorCode;
-}
-
extern UString HResultToMessage(HRESULT errorCode);
-static void MessageBox_Error_Global(HWND wnd, const wchar_t *message)
-{
- ::MessageBoxW(wnd, message, L"7-Zip", MB_ICONERROR);
-}
-
static void MessageBox_HResError(HWND wnd, HRESULT errorCode, const wchar_t *name)
{
UString s = HResultToMessage(errorCode);
@@ -98,17 +91,21 @@ class CBrowseDialog: public NControl::CModalDialog
CExtToIconMap _extToIconMap;
int _sortIndex;
bool _ascending;
+ #ifndef Z7_SFX
bool _showDots;
+ #endif
UString _topDirPrefix; // we don't open parent of that folder
UString DirPrefix;
- virtual bool OnInit();
- virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
- virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
- virtual bool OnNotify(UINT controlID, LPNMHDR header);
- virtual bool OnKeyDown(LPNMLVKEYDOWN keyDownInfo);
- virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
- virtual void OnOK();
+ virtual bool OnInit() 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 OnNotify(UINT controlID, LPNMHDR header) 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;
+
+ bool OnKeyDown(LPNMLVKEYDOWN keyDownInfo);
void Post_RefreshPathEdit() { PostMsg(k_Message_RefreshPathEdit); }
@@ -126,59 +123,37 @@ class CBrowseDialog: public NControl::CModalDialog
int GetRealItemIndex(int indexInListView) const
{
LPARAM param;
- if (!_list.GetItemParam(indexInListView, param))
+ if (!_list.GetItemParam((unsigned)indexInListView, param))
return (int)-1;
return (int)param;
}
public:
+
+ bool SaveMode;
bool FolderMode;
+ int FilterIndex; // [in / out]
+ CObjectVector<CBrowseFilterInfo> Filters;
+
+ UString FilePath; // [in / out]
UString Title;
- UString FilePath; // input/ result path
- bool ShowAllFiles;
- UStringVector Filters;
- UString FilterDescription;
-
- CBrowseDialog(): FolderMode(false), _showDots(false), ShowAllFiles(true) {}
- void SetFilter(const UString &s);
- INT_PTR Create(HWND parent = 0) { return CModalDialog::Create(IDD_BROWSE, parent); }
- int CompareItems(LPARAM lParam1, LPARAM lParam2);
+
+ CBrowseDialog():
+ #ifndef Z7_SFX
+ _showDots(false),
+ #endif
+ SaveMode(false)
+ , FolderMode(false)
+ , FilterIndex(-1)
+ {}
+ INT_PTR Create(HWND parent = NULL) { return CModalDialog::Create(IDD_BROWSE, parent); }
+ int CompareItems(LPARAM lParam1, LPARAM lParam2) const;
};
-void CBrowseDialog::SetFilter(const UString &s)
-{
- Filters.Clear();
- UString mask;
- unsigned i;
- for (i = 0; i < s.Len(); i++)
- {
- wchar_t c = s[i];
- if (c == ';')
- {
- if (!mask.IsEmpty())
- Filters.Add(mask);
- mask.Empty();
- }
- else
- mask += c;
- }
- if (!mask.IsEmpty())
- Filters.Add(mask);
- ShowAllFiles = Filters.IsEmpty();
- for (i = 0; i < Filters.Size(); i++)
- {
- const UString &f = Filters[i];
- if (f == L"*.*" || f == L"*")
- {
- ShowAllFiles = true;
- break;
- }
- }
-}
bool CBrowseDialog::OnInit()
{
- #ifdef LANG
+ #ifdef Z7_LANG
LangSetDlgItems(*this, NULL, 0);
#endif
if (!Title.IsEmpty())
@@ -187,16 +162,11 @@ bool CBrowseDialog::OnInit()
_filterCombo.Attach(GetItem(IDC_BROWSE_FILTER));
_pathEdit.Attach(GetItem(IDE_BROWSE_PATH));
- if (FolderMode)
- HideItem(IDC_BROWSE_FILTER);
- else
- EnableItem(IDC_BROWSE_FILTER, false);
-
#ifndef UNDER_CE
_list.SetUnicodeFormat();
#endif
- #ifndef _SFX
+ #ifndef Z7_SFX
CFmSettings st;
st.Load();
if (st.SingleClick)
@@ -205,22 +175,34 @@ bool CBrowseDialog::OnInit()
#endif
{
- UString s;
- if (!FilterDescription.IsEmpty())
- s = FilterDescription;
- else if (ShowAllFiles)
- s = L"*.*";
- else
+ /*
+ Filters.Clear(); // for debug
+ if (Filters.IsEmpty() && !FolderMode)
{
- FOR_VECTOR (i, Filters)
- {
- if (i != 0)
- s.Add_Space();
- s += Filters[i];
- }
+ CBrowseFilterInfo &f = Filters.AddNew();
+ const UString mask("*.*");
+ f.Masks.Add(mask);
+ // f.Description = "(";
+ f.Description += mask;
+ // f.Description += ")";
+ }
+ */
+
+ FOR_VECTOR (i, Filters)
+ {
+ _filterCombo.AddString(Filters[i].Description);
+ }
+
+ if (Filters.Size() <= 1)
+ {
+ if (FolderMode)
+ HideItem(IDC_BROWSE_FILTER);
+ else
+ EnableItem(IDC_BROWSE_FILTER, false);
}
- _filterCombo.AddString(s);
- _filterCombo.SetCurSel(0);
+
+ if (/* FilterIndex >= 0 && */ (unsigned)FilterIndex < Filters.Size())
+ _filterCombo.SetCurSel(FilterIndex);
}
_list.SetImageList(GetSysImageList(true), LVSIL_SMALL);
@@ -235,7 +217,7 @@ bool CBrowseDialog::OnInit()
column.fmt = LVCFMT_RIGHT;
column.cx = 100;
const UString s = LangString(IDS_PROP_SIZE);
- column.pszText = (wchar_t *)(const wchar_t *)s;
+ column.pszText = s.Ptr_non_const();
_list.InsertColumn(2, &column);
}
@@ -261,7 +243,7 @@ bool CBrowseDialog::OnInit()
_topDirPrefix.Empty();
{
- int rootSize = GetRootPrefixSize(FilePath);
+ unsigned rootSize = GetRootPrefixSize(FilePath);
#if defined(_WIN32) && !defined(UNDER_CE)
// We can go up from root folder to drives list
if (IsDrivePath(FilePath))
@@ -301,7 +283,7 @@ bool CBrowseDialog::OnInit()
#ifndef UNDER_CE
/* If we clear UISF_HIDEFOCUS, the focus rectangle in ListView will be visible,
even if we use mouse for pressing the button to open this dialog. */
- PostMsg(MY__WM_UPDATEUISTATE, MAKEWPARAM(MY__UIS_CLEAR, MY__UISF_HIDEFOCUS));
+ PostMsg(Z7_WIN_WM_UPDATEUISTATE, MAKEWPARAM(Z7_WIN_UIS_CLEAR, Z7_WIN_UISF_HIDEFOCUS));
#endif
return CModalDialog::OnInit();
@@ -368,6 +350,24 @@ bool CBrowseDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
return CModalDialog::OnMessage(message, wParam, lParam);
}
+
+bool CBrowseDialog::OnCommand(unsigned code, unsigned itemID, LPARAM lParam)
+{
+ if (code == CBN_SELCHANGE)
+ {
+ switch (itemID)
+ {
+ case IDC_BROWSE_FILTER:
+ {
+ Reload();
+ return true;
+ }
+ }
+ }
+ return CModalDialog::OnCommand(code, itemID, lParam);
+}
+
+
bool CBrowseDialog::OnNotify(UINT /* controlID */, LPNMHDR header)
{
if (header->hwndFrom != _list)
@@ -385,7 +385,7 @@ bool CBrowseDialog::OnNotify(UINT /* controlID */, LPNMHDR header)
break;
case LVN_COLUMNCLICK:
{
- int index = LPNMLISTVIEW(header)->iSubItem;
+ const int index = LPNMLISTVIEW(header)->iSubItem;
if (index == _sortIndex)
_ascending = !_ascending;
else
@@ -413,7 +413,7 @@ bool CBrowseDialog::OnNotify(UINT /* controlID */, LPNMHDR header)
bool CBrowseDialog::OnKeyDown(LPNMLVKEYDOWN keyDownInfo)
{
- bool ctrl = IsKeyDown(VK_CONTROL);
+ const bool ctrl = IsKeyDown(VK_CONTROL);
switch (keyDownInfo->wVKey)
{
@@ -434,7 +434,8 @@ bool CBrowseDialog::OnKeyDown(LPNMLVKEYDOWN keyDownInfo)
return false;
}
-bool CBrowseDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+
+bool CBrowseDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
{
switch (buttonID)
{
@@ -468,27 +469,27 @@ bool CBrowseDialog::GetParentPath(const UString &path, UString &parentPrefix, US
if (_topDirPrefix == path)
return false;
UString s = path;
- if (s.Back() == WCHAR_PATH_SEPARATOR)
+ if (IS_PATH_SEPAR(s.Back()))
s.DeleteBack();
if (s.IsEmpty())
return false;
- if (s.Back() == WCHAR_PATH_SEPARATOR)
+ if (IS_PATH_SEPAR(s.Back()))
return false;
- int pos = s.ReverseFind_PathSepar();
- parentPrefix.SetFrom(s, pos + 1);
- name = s.Ptr(pos + 1);
+ const unsigned pos1 = (unsigned)(s.ReverseFind_PathSepar() + 1);
+ parentPrefix.SetFrom(s, pos1);
+ name = s.Ptr(pos1);
return true;
}
-int CBrowseDialog::CompareItems(LPARAM lParam1, LPARAM lParam2)
+int CBrowseDialog::CompareItems(LPARAM lParam1, LPARAM lParam2) const
{
if (lParam1 == kParentIndex) return -1;
if (lParam2 == kParentIndex) return 1;
const CFileInfo &f1 = _files[(int)lParam1];
const CFileInfo &f2 = _files[(int)lParam2];
- bool isDir1 = f1.IsDir();
- bool isDir2 = f2.IsDir();
+ const bool isDir1 = f1.IsDir();
+ const bool isDir2 = f2.IsDir();
if (isDir1 && !isDir2) return -1;
if (isDir2 && !isDir1) return 1;
@@ -509,16 +510,16 @@ static int CALLBACK CompareItems2(LPARAM lParam1, LPARAM lParam2, LPARAM lpData)
static void ConvertSizeToString(UInt64 v, wchar_t *s)
{
- Byte c = 0;
+ char c = 0;
if (v >= ((UInt64)10000 << 20)) { v >>= 30; c = 'G'; }
else if (v >= ((UInt64)10000 << 10)) { v >>= 20; c = 'M'; }
else if (v >= ((UInt64)10000 << 0)) { v >>= 10; c = 'K'; }
- ConvertUInt64ToString(v, s);
+ s = ConvertUInt64ToString(v, s);
if (c != 0)
{
- s += MyStringLen(s);
*s++ = ' ';
- *s++ = c;
+ *s++ = (wchar_t)c;
+ *s++ = 'B';
*s++ = 0;
}
}
@@ -531,46 +532,62 @@ HRESULT CBrowseDialog::Reload(const UString &pathPrefix, const UString &selected
#ifndef UNDER_CE
bool isDrive = false;
- if (pathPrefix.IsEmpty() || pathPrefix == kSuperPathPrefix)
+ if (pathPrefix.IsEmpty() || pathPrefix.IsEqualTo(kSuperPathPrefix))
{
isDrive = true;
FStringVector drives;
if (!MyGetLogicalDriveStrings(drives))
- return GetNormalizedError();
+ return GetLastError_noZero_HRESULT();
FOR_VECTOR (i, drives)
{
- FString d = drives[i];
- if (d.Len() < 3 || d.Back() != '\\')
+ const FString &d = drives[i];
+ if (d.Len() < 2 || d.Back() != '\\')
return E_FAIL;
- d.DeleteBack();
CFileInfo &fi = files.AddNew();
fi.SetAsDir();
fi.Name = d;
+ fi.Name.DeleteBack();
}
}
else
#endif
{
- CEnumerator enumerator(us2fs(pathPrefix + L'*'));
+ const UStringVector *masks = NULL;
+ if (!Filters.IsEmpty() && _filterCombo.GetCount() > 0)
+ {
+ const int selected = _filterCombo.GetCurSel();
+ // GetItemData_of_CurSel(); // we don't use data field
+ if (/* selected >= 0 && */ (unsigned)selected < Filters.Size())
+ {
+ const UStringVector &m = Filters[selected].Masks;
+ if (m.Size() > 1 || (m.Size() == 1
+ && !m[0].IsEqualTo("*.*")
+ && !m[0].IsEqualTo("*")))
+ masks = &m;
+ }
+ }
+ CEnumerator enumerator;
+ enumerator.SetDirPrefix(us2fs(pathPrefix));
+ CFileInfo fi;
for (;;)
{
bool found;
- CFileInfo fi;
if (!enumerator.Next(fi, found))
- return GetNormalizedError();
+ return GetLastError_noZero_HRESULT();
if (!found)
break;
if (!fi.IsDir())
{
if (FolderMode)
continue;
- if (!ShowAllFiles)
+ if (masks)
{
unsigned i;
- for (i = 0; i < Filters.Size(); i++)
- if (DoesWildcardMatchName(Filters[i], fs2us(fi.Name)))
+ const unsigned numMasks = masks->Size();
+ for (i = 0; i < numMasks; i++)
+ if (DoesWildcardMatchName((*masks)[i], fs2us(fi.Name)))
break;
- if (i == Filters.Size())
+ if (i == numMasks)
continue;
}
}
@@ -589,21 +606,21 @@ HRESULT CBrowseDialog::Reload(const UString &pathPrefix, const UString &selected
LVITEMW item;
- int index = 0;
+ unsigned index = 0;
int cursorIndex = -1;
- #ifndef _SFX
+ #ifndef Z7_SFX
if (_showDots && _topDirPrefix != DirPrefix)
{
- item.iItem = index;
- const UString itemName = L"..";
+ item.iItem = (int)index;
+ const UString itemName ("..");
if (selectedName.IsEmpty())
- cursorIndex = index;
+ cursorIndex = (int)index;
item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
- int subItem = 0;
- item.iSubItem = subItem++;
+ unsigned subItem = 0;
+ item.iSubItem = (int)(subItem++);
item.lParam = kParentIndex;
- item.pszText = (wchar_t *)(const wchar_t *)itemName;
+ item.pszText = itemName.Ptr_non_const();
item.iImage = _extToIconMap.GetIconIndex(FILE_ATTRIBUTE_DIRECTORY, DirPrefix);
if (item.iImage < 0)
item.iImage = 0;
@@ -616,16 +633,16 @@ HRESULT CBrowseDialog::Reload(const UString &pathPrefix, const UString &selected
for (unsigned i = 0; i < _files.Size(); i++, index++)
{
- item.iItem = index;
+ item.iItem = (int)index;
const CFileInfo &fi = _files[i];
const UString name = fs2us(fi.Name);
if (!selectedName.IsEmpty() && CompareFileNames(name, selectedName) == 0)
- cursorIndex = index;
+ cursorIndex = (int)index;
item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
- int subItem = 0;
- item.iSubItem = subItem++;
- item.lParam = i;
- item.pszText = (wchar_t *)(const wchar_t *)name;
+ unsigned subItem = 0;
+ item.iSubItem = (int)(subItem++);
+ item.lParam = (LPARAM)i;
+ item.pszText = name.Ptr_non_const();
const UString fullPath = DirPrefix + name;
#ifndef UNDER_CE
@@ -642,16 +659,14 @@ HRESULT CBrowseDialog::Reload(const UString &pathPrefix, const UString &selected
_list.InsertItem(&item);
wchar_t s[32];
{
- FILETIME ft;
s[0] = 0;
- if (FileTimeToLocalFileTime(&fi.MTime, &ft))
- ConvertFileTimeToString(ft, s,
+ ConvertUtcFileTimeToString(fi.MTime, s,
#ifndef UNDER_CE
- true
+ kTimestampPrintLevel_MIN
#else
- false
+ kTimestampPrintLevel_DAY
#endif
- , false);
+ );
_list.SetSubItem(index, subItem++, s);
}
{
@@ -676,14 +691,14 @@ HRESULT CBrowseDialog::Reload(const UString &pathPrefix, const UString &selected
HRESULT CBrowseDialog::Reload()
{
UString selected;
- int index = _list.GetNextSelectedItem(-1);
+ const int index = _list.GetNextSelectedItem(-1);
if (index >= 0)
{
- int fileIndex = GetRealItemIndex(index);
+ const int fileIndex = GetRealItemIndex(index);
if (fileIndex != kParentIndex)
selected = fs2us(_files[fileIndex].Name);
}
- UString dirPathTemp = DirPrefix;
+ const UString dirPathTemp = DirPrefix;
return Reload(dirPathTemp, selected);
}
@@ -699,14 +714,14 @@ void CBrowseDialog::OpenParentFolder()
void CBrowseDialog::SetPathEditText()
{
- int index = _list.GetNextSelectedItem(-1);
+ const int index = _list.GetNextSelectedItem(-1);
if (index < 0)
{
if (FolderMode)
_pathEdit.SetText(DirPrefix);
return;
}
- int fileIndex = GetRealItemIndex(index);
+ const int fileIndex = GetRealItemIndex(index);
if (fileIndex == kParentIndex)
{
if (FolderMode)
@@ -746,7 +761,7 @@ void CBrowseDialog::OnCreateDir()
{
if (!NDir::CreateComplexDir(destPath))
{
- MessageBox_HResError((HWND)*this, GetNormalizedError(), fs2us(destPath));
+ MessageBox_HResError((HWND)*this, GetLastError_noZero_HRESULT(), fs2us(destPath));
}
else
{
@@ -760,10 +775,10 @@ void CBrowseDialog::OnCreateDir()
void CBrowseDialog::OnItemEnter()
{
- int index = _list.GetNextSelectedItem(-1);
+ const int index = _list.GetNextSelectedItem(-1);
if (index < 0)
return;
- int fileIndex = GetRealItemIndex(index);
+ const int fileIndex = GetRealItemIndex(index);
if (fileIndex == kParentIndex)
OpenParentFolder();
else
@@ -780,8 +795,10 @@ void CBrowseDialog::OnItemEnter()
*/
return;
}
- UString s = DirPrefix + fs2us(file.Name) + WCHAR_PATH_SEPARATOR;
- HRESULT res = Reload(s, L"");
+ UString s = DirPrefix;
+ s += fs2us(file.Name);
+ s.Add_PathSepar();
+ const HRESULT res = Reload(s, UString());
if (res != S_OK)
MessageBox_HResError(*this, res, s);
SetPathEditText();
@@ -801,10 +818,13 @@ void CBrowseDialog::FinishOnOK()
FilePath = fs2us(destPath);
if (FolderMode)
NormalizeDirPathPrefix(FilePath);
+ FilterIndex = _filterCombo.GetCurSel();
End(IDOK);
}
-#endif
+#endif // USE_MY_BROWSE_DIALOG
+
+
bool MyBrowseForFolder(HWND owner, LPCWSTR title, LPCWSTR path, UString &resultPath)
{
@@ -812,12 +832,13 @@ bool MyBrowseForFolder(HWND owner, LPCWSTR title, LPCWSTR path, UString &resultP
#ifndef UNDER_CE
- #ifdef USE_MY_BROWSE_DIALOG
+#ifdef USE_MY_BROWSE_DIALOG
if (!IsSuperOrDevicePath(path))
- #endif
+ if (MyStringLen(path) < MAX_PATH)
+#endif
return NShell::BrowseForFolder(owner, title, path, resultPath);
- #endif
+ #endif // UNDER_CE
#ifdef USE_MY_BROWSE_DIALOG
@@ -830,64 +851,107 @@ bool MyBrowseForFolder(HWND owner, LPCWSTR title, LPCWSTR path, UString &resultP
if (dialog.Create(owner) != IDOK)
return false;
resultPath = dialog.FilePath;
- #endif
-
return true;
+
+ #endif
}
-bool MyBrowseForFile(HWND owner, LPCWSTR title, LPCWSTR path,
- LPCWSTR filterDescription, LPCWSTR filter, UString &resultPath)
-{
- resultPath.Empty();
- #ifndef UNDER_CE
+// LPCWSTR filterDescription, LPCWSTR filter,
- #ifdef USE_MY_BROWSE_DIALOG
- if (!IsSuperOrDevicePath(path))
- #endif
+bool CBrowseInfo::BrowseForFile(const CObjectVector<CBrowseFilterInfo> &filters)
+{
+#ifndef UNDER_CE
+#ifdef USE_MY_BROWSE_DIALOG
+ /* win10:
+ GetOpenFileName() for FilePath doesn't support super prefix "\\\\?\\"
+ GetOpenFileName() for FilePath doesn't support long path
+ */
+ if (!IsSuperOrDevicePath(FilePath))
+ // if (filters.Size() > 100) // for debug
+#endif
{
- if (MyGetOpenFileName(owner, title, NULL, path, filterDescription, filter, resultPath))
+ const UString filePath_Store = FilePath;
+ UString dirPrefix;
+ {
+ FString prefix, name;
+ if (NDir::GetFullPathAndSplit(us2fs(FilePath), prefix, name))
+ {
+ dirPrefix = fs2us(prefix);
+ FilePath = fs2us(name);
+ }
+ }
+ UStringVector filters2;
+ FOR_VECTOR (i, filters)
+ {
+ const CBrowseFilterInfo &fi = filters[i];
+ filters2.Add(fi.Description);
+ UString s;
+ FOR_VECTOR (k, fi.Masks)
+ {
+ if (k != 0)
+ s += ";";
+ s += fi.Masks[k];
+ }
+ filters2.Add(s);
+ }
+ if (CommonDlg_BrowseForFile(!dirPrefix.IsEmpty() ? dirPrefix.Ptr(): NULL, filters2))
return true;
- #ifdef UNDER_CE
+ FilePath = filePath_Store;
+
+ #ifdef UNDER_CE
return false;
- #else
+ #else
// maybe we must use GetLastError in WinCE.
- DWORD errorCode = CommDlgExtendedError();
- const wchar_t *errorMessage = NULL;
- switch (errorCode)
- {
- case 0: return false; // cancel or close obn dialog
- case FNERR_INVALIDFILENAME: errorMessage = L"Invalid File Name"; break;
- default: errorMessage = L"Open Dialog Error";
- }
- if (!errorMessage)
- return false;
+ const DWORD errorCode = CommDlgExtendedError();
+ #ifdef USE_MY_BROWSE_DIALOG
+ // FNERR_INVALIDFILENAME is expected error, if long path was used
+ if (errorCode != FNERR_INVALIDFILENAME
+ || FilePath.Len() < MAX_PATH)
+ #endif
{
- UString s = errorMessage;
+ if (errorCode == 0) // cancel or close on dialog
+ return false;
+ const char *message = NULL;
+ if (errorCode == FNERR_INVALIDFILENAME)
+ message = "Invalid file name";
+ UString s ("Open Dialog Error:");
+ s.Add_LF();
+ if (message)
+ s += message;
+ else
+ {
+ char temp[16];
+ ConvertUInt32ToHex8Digits(errorCode, temp);
+ s += "Error #";
+ s += temp;
+ }
s.Add_LF();
- s += path;
- MessageBox_Error_Global(owner, s);
+ s += FilePath;
+ MessageBox_Error_Global(hwndOwner, s);
}
- #endif
+ #endif // UNDER_CE
}
- #endif
+#endif // UNDER_CE
- #ifdef USE_MY_BROWSE_DIALOG
+#ifdef USE_MY_BROWSE_DIALOG
+
CBrowseDialog dialog;
- if (title)
- dialog.Title = title;
- if (path)
- dialog.FilePath = path;
+
dialog.FolderMode = false;
- if (filter)
- dialog.SetFilter(filter);
- if (filterDescription)
- dialog.FilterDescription = filterDescription;
- if (dialog.Create(owner) != IDOK)
+ dialog.SaveMode = SaveMode;
+ dialog.FilterIndex = FilterIndex;
+ dialog.Filters = filters;
+
+ if (lpstrTitle)
+ dialog.Title = lpstrTitle;
+ dialog.FilePath = FilePath;
+ if (dialog.Create(hwndOwner) != IDOK)
return false;
- resultPath = dialog.FilePath;
- #endif
+ FilePath = dialog.FilePath;
+ FilterIndex = dialog.FilterIndex;
+#endif
return true;
}
@@ -912,7 +976,9 @@ bool CorrectFsPath(const UString &relBase, const UString &path2, UString &result
result.Empty();
UString path = path2;
+ #ifdef _WIN32
path.Replace(L'/', WCHAR_PATH_SEPARATOR);
+ #endif
unsigned start = 0;
UString base;
@@ -925,9 +991,7 @@ bool CorrectFsPath(const UString &relBase, const UString &path2, UString &result
return true;
}
#endif
- int pos = GetRootPrefixSize(path);
- if (pos > 0)
- start = pos;
+ start = GetRootPrefixSize(path);
}
else
{
@@ -952,7 +1016,7 @@ bool CorrectFsPath(const UString &relBase, const UString &path2, UString &result
if (path.Back() == WCHAR_PATH_SEPARATOR)
{
path.DeleteBack();
- result.Insert(0, WCHAR_PATH_SEPARATOR);;
+ result.Insert(0, WCHAR_PATH_SEPARATOR);
}
int pos = path.ReverseFind(WCHAR_PATH_SEPARATOR) + 1;
UString cur = path.Ptr(pos);
@@ -972,8 +1036,8 @@ bool CorrectFsPath(const UString &relBase, const UString &path2, UString &result
{
if (start == path.Len())
break;
- int slashPos = path.Find(WCHAR_PATH_SEPARATOR, start);
- cur.SetFrom(path.Ptr(start), (slashPos < 0 ? path.Len() : slashPos) - start);
+ const int slashPos = path.Find(WCHAR_PATH_SEPARATOR, start);
+ cur.SetFrom(path.Ptr(start), (slashPos < 0 ? path.Len() : (unsigned)slashPos) - start);
if (checkExist)
{
CFileInfo fi;
@@ -993,8 +1057,8 @@ bool CorrectFsPath(const UString &relBase, const UString &path2, UString &result
result += cur;
if (slashPos < 0)
break;
+ start = (unsigned)(slashPos + 1);
result.Add_PathSepar();
- start = slashPos + 1;
}
return true;
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h
index 957af2e2577..2ad8d5443a3 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/BrowseDialog.h
@@ -1,12 +1,23 @@
// BrowseDialog.h
-#ifndef __BROWSE_DIALOG_H
-#define __BROWSE_DIALOG_H
+#ifndef ZIP7_INC_BROWSE_DIALOG_H
+#define ZIP7_INC_BROWSE_DIALOG_H
-#include "../../../Common/MyString.h"
+#include "../../../Windows/CommonDialog.h"
bool MyBrowseForFolder(HWND owner, LPCWSTR title, LPCWSTR path, UString &resultPath);
-bool MyBrowseForFile(HWND owner, LPCWSTR title, LPCWSTR path, LPCWSTR filterDescription, LPCWSTR filter, UString &resultPath);
+
+struct CBrowseFilterInfo
+{
+ UStringVector Masks;
+ UString Description;
+};
+
+struct CBrowseInfo: public NWindows::CCommonDialogInfo
+{
+ bool BrowseForFile(const CObjectVector<CBrowseFilterInfo> &filters);
+};
+
/* CorrectFsPath removes undesirable characters in names (dots and spaces at the end of file)
But it doesn't change "bad" name in any of the following cases:
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp b/3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp
index 729743e8795..921972eab10 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.cpp
@@ -5,7 +5,7 @@
#include "../../../Windows/Control/Static.h"
-#ifdef LANG
+#ifdef Z7_LANG
#include "LangUtils.h"
#endif
@@ -13,7 +13,7 @@ using namespace NWindows;
bool CComboDialog::OnInit()
{
- #ifdef LANG
+ #ifdef Z7_LANG
LangSetDlgItems(*this, NULL, 0);
#endif
_comboBox.Attach(GetItem(IDC_COMBO));
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.h
index 29b28b5b49c..bb0fda80e16 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/ComboDialog.h
@@ -1,7 +1,7 @@
// ComboDialog.h
-#ifndef __COMBO_DIALOG_H
-#define __COMBO_DIALOG_H
+#ifndef ZIP7_INC_COMBO_DIALOG_H
+#define ZIP7_INC_COMBO_DIALOG_H
#include "../../../Windows/Control/ComboBox.h"
#include "../../../Windows/Control/Dialog.h"
@@ -11,9 +11,9 @@
class CComboDialog: public NWindows::NControl::CModalDialog
{
NWindows::NControl::CComboBox _comboBox;
- virtual void OnOK();
- virtual bool OnInit();
- virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
+ virtual void OnOK() Z7_override;
+ virtual bool OnInit() Z7_override;
+ virtual bool OnSize(WPARAM wParam, int xSize, int ySize) Z7_override;
public:
// bool Sorted;
UString Title;
@@ -22,7 +22,7 @@ public:
UStringVector Strings;
// CComboDialog(): Sorted(false) {};
- INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_COMBO, parentWindow); }
+ INT_PTR Create(HWND parentWindow = NULL) { return CModalDialog::Create(IDD_COMBO, parentWindow); }
};
#endif
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/DialogSize.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/DialogSize.h
index 504541bdf3c..9f2270bd40e 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/DialogSize.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/DialogSize.h
@@ -1,7 +1,7 @@
// DialogSize.h
-#ifndef __DIALOG_SIZE_H
-#define __DIALOG_SIZE_H
+#ifndef ZIP7_INC_DIALOG_SIZE_H
+#define ZIP7_INC_DIALOG_SIZE_H
#include "../../../Windows/Control/Dialog.h"
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp b/3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp
index 7d61d14d9d9..f67404479b0 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.cpp
@@ -17,7 +17,7 @@
#include "../../Common/StreamUtils.h"
#include "../Common/ExtractingFilePath.h"
-#ifndef _SFX
+#ifndef Z7_SFX
#include "../Common/ZipRegistry.h"
#endif
@@ -28,7 +28,7 @@
#include "FormatUtils.h"
#include "LangUtils.h"
#include "OverwriteDialog.h"
-#ifndef _NO_CRYPTO
+#ifndef Z7_NO_CRYPTO
#include "PasswordDialog.h"
#endif
#include "PropertyName.h"
@@ -44,10 +44,11 @@ void CExtractCallbackImp::Init()
_lang_Extracting = LangString(IDS_PROGRESS_EXTRACTING);
_lang_Testing = LangString(IDS_PROGRESS_TESTING);
_lang_Skipping = LangString(IDS_PROGRESS_SKIPPING);
+ _lang_Reading = "Reading";
NumArchiveErrors = 0;
ThereAreMessageErrors = false;
- #ifndef _SFX
+ #ifndef Z7_SFX
NumFolders = NumFiles = 0;
NeedAddFile = false;
#endif
@@ -59,29 +60,27 @@ void CExtractCallbackImp::AddError_Message(LPCWSTR s)
ProgressDialog->Sync.AddError_Message(s);
}
-#ifndef _SFX
+#ifndef Z7_SFX
-STDMETHODIMP CExtractCallbackImp::SetNumFiles(UInt64
- #ifndef _SFX
- numFiles
- #endif
- )
+Z7_COM7F_IMF(CExtractCallbackImp::SetNumFiles(UInt64 numFiles))
{
- #ifndef _SFX
+ #ifdef Z7_SFX
+ UNUSED_VAR(numFiles)
+ #else
ProgressDialog->Sync.Set_NumFilesTotal(numFiles);
- #endif
+ #endif
return S_OK;
}
#endif
-STDMETHODIMP CExtractCallbackImp::SetTotal(UInt64 total)
+Z7_COM7F_IMF(CExtractCallbackImp::SetTotal(UInt64 total))
{
ProgressDialog->Sync.Set_NumBytesTotal(total);
return S_OK;
}
-STDMETHODIMP CExtractCallbackImp::SetCompleted(const UInt64 *value)
+Z7_COM7F_IMF(CExtractCallbackImp::SetCompleted(const UInt64 *value))
{
return ProgressDialog->Sync.Set_NumBytesCur(value);
}
@@ -138,7 +137,7 @@ HRESULT CExtractCallbackImp::Open_Finished()
return ProgressDialog->Sync.CheckStop();
}
-#ifndef _NO_CRYPTO
+#ifndef Z7_NO_CRYPTO
HRESULT CExtractCallbackImp::Open_CryptoGetTextPassword(BSTR *password)
{
@@ -167,8 +166,8 @@ void CExtractCallbackImp::Open_Clear_PasswordWasAsked_Flag()
#endif
-#ifndef _SFX
-STDMETHODIMP CExtractCallbackImp::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
+#ifndef Z7_SFX
+Z7_COM7F_IMF(CExtractCallbackImp::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize))
{
ProgressDialog->Sync.Set_Ratio(inSize, outSize);
return S_OK;
@@ -176,13 +175,13 @@ STDMETHODIMP CExtractCallbackImp::SetRatioInfo(const UInt64 *inSize, const UInt6
#endif
/*
-STDMETHODIMP CExtractCallbackImp::SetTotalFiles(UInt64 total)
+Z7_COM7F_IMF(CExtractCallbackImp::SetTotalFiles(UInt64 total)
{
ProgressDialog->Sync.SetNumFilesTotal(total);
return S_OK;
}
-STDMETHODIMP CExtractCallbackImp::SetCompletedFiles(const UInt64 *value)
+Z7_COM7F_IMF(CExtractCallbackImp::SetCompletedFiles(const UInt64 *value)
{
if (value != NULL)
ProgressDialog->Sync.SetNumFilesCur(*value);
@@ -190,10 +189,10 @@ STDMETHODIMP CExtractCallbackImp::SetCompletedFiles(const UInt64 *value)
}
*/
-STDMETHODIMP CExtractCallbackImp::AskOverwrite(
+Z7_COM7F_IMF(CExtractCallbackImp::AskOverwrite(
const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
- Int32 *answer)
+ Int32 *answer))
{
COverwriteDialog dialog;
@@ -222,7 +221,7 @@ STDMETHODIMP CExtractCallbackImp::AskOverwrite(
}
-STDMETHODIMP CExtractCallbackImp::PrepareOperation(const wchar_t *name, Int32 isFolder, Int32 askExtractMode, const UInt64 * /* position */)
+Z7_COM7F_IMF(CExtractCallbackImp::PrepareOperation(const wchar_t *name, Int32 isFolder, Int32 askExtractMode, const UInt64 * /* position */))
{
_isFolder = IntToBool(isFolder);
_currentFilePath = name;
@@ -233,13 +232,14 @@ STDMETHODIMP CExtractCallbackImp::PrepareOperation(const wchar_t *name, Int32 is
case NArchive::NExtract::NAskMode::kExtract: msg = &_lang_Extracting; break;
case NArchive::NExtract::NAskMode::kTest: msg = &_lang_Testing; break;
case NArchive::NExtract::NAskMode::kSkip: msg = &_lang_Skipping; break;
+ case NArchive::NExtract::NAskMode::kReadExternal: msg = &_lang_Reading; break;
// default: s = "Unknown operation";
}
return ProgressDialog->Sync.Set_Status2(*msg, name, IntToBool(isFolder));
}
-STDMETHODIMP CExtractCallbackImp::MessageError(const wchar_t *s)
+Z7_COM7F_IMF(CExtractCallbackImp::MessageError(const wchar_t *s))
{
AddError_Message(s);
return S_OK;
@@ -252,9 +252,9 @@ HRESULT CExtractCallbackImp::MessageError(const char *message, const FString &pa
return S_OK;
}
-#ifndef _SFX
+#ifndef Z7_SFX
-STDMETHODIMP CExtractCallbackImp::ShowMessage(const wchar_t *s)
+Z7_COM7F_IMF(CExtractCallbackImp::ShowMessage(const wchar_t *s))
{
AddError_Message(s);
return S_OK;
@@ -262,6 +262,7 @@ STDMETHODIMP CExtractCallbackImp::ShowMessage(const wchar_t *s)
#endif
+void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, const wchar_t *fileName, UString &s);
void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, const wchar_t *fileName, UString &s)
{
s.Empty();
@@ -269,25 +270,33 @@ void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, const wchar_t *fileNam
if (opRes == NArchive::NExtract::NOperationResult::kOK)
return;
+ #ifndef Z7_SFX
UINT messageID = 0;
+ #endif
UINT id = 0;
switch (opRes)
{
case NArchive::NExtract::NOperationResult::kUnsupportedMethod:
+ #ifndef Z7_SFX
messageID = IDS_EXTRACT_MESSAGE_UNSUPPORTED_METHOD;
+ #endif
id = IDS_EXTRACT_MSG_UNSUPPORTED_METHOD;
break;
case NArchive::NExtract::NOperationResult::kDataError:
+ #ifndef Z7_SFX
messageID = encrypted ?
IDS_EXTRACT_MESSAGE_DATA_ERROR_ENCRYPTED:
IDS_EXTRACT_MESSAGE_DATA_ERROR;
+ #endif
id = IDS_EXTRACT_MSG_DATA_ERROR;
break;
case NArchive::NExtract::NOperationResult::kCRCError:
+ #ifndef Z7_SFX
messageID = encrypted ?
IDS_EXTRACT_MESSAGE_CRC_ERROR_ENCRYPTED:
IDS_EXTRACT_MESSAGE_CRC_ERROR;
+ #endif
id = IDS_EXTRACT_MSG_CRC_ERROR;
break;
case NArchive::NExtract::NOperationResult::kUnavailable:
@@ -316,18 +325,19 @@ void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, const wchar_t *fileNam
}
UString msg;
- UString msgOld;
- #ifndef _SFX
+ #ifndef Z7_SFX
+ UString msgOld;
+ #ifdef Z7_LANG
if (id != 0)
LangString_OnlyFromLangFile(id, msg);
if (messageID != 0 && msg.IsEmpty())
LangString_OnlyFromLangFile(messageID, msgOld);
- #endif
-
+ #endif
if (msg.IsEmpty() && !msgOld.IsEmpty())
s = MyFormatNew(msgOld, fileName);
else
+ #endif
{
if (msg.IsEmpty() && id != 0)
LangString(id, msg);
@@ -335,25 +345,23 @@ void SetExtractErrorMessage(Int32 opRes, Int32 encrypted, const wchar_t *fileNam
s += msg;
else
{
- char temp[16];
- ConvertUInt32ToString(opRes, temp);
- s.AddAscii("Error #");
- s.AddAscii(temp);
+ s += "Error #";
+ s.Add_UInt32((UInt32)opRes);
}
if (encrypted && opRes != NArchive::NExtract::NOperationResult::kWrongPassword)
{
- // s.AddAscii(" : ");
+ // s += " : ";
// AddLangString(s, IDS_EXTRACT_MSG_ENCRYPTED);
- s.AddAscii(" : ");
+ s += " : ";
AddLangString(s, IDS_EXTRACT_MSG_WRONG_PSW_GUESS);
}
- s.AddAscii(" : ");
+ s += " : ";
s += fileName;
}
}
-STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 opRes, Int32 encrypted)
+Z7_COM7F_IMF(CExtractCallbackImp::SetOperationResult(Int32 opRes, Int32 encrypted))
{
switch (opRes)
{
@@ -368,7 +376,7 @@ STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 opRes, Int32 encrypte
}
}
- #ifndef _SFX
+ #ifndef Z7_SFX
if (_isFolder)
NumFolders++;
else
@@ -379,7 +387,7 @@ STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 opRes, Int32 encrypte
return S_OK;
}
-STDMETHODIMP CExtractCallbackImp::ReportExtractResult(Int32 opRes, Int32 encrypted, const wchar_t *name)
+Z7_COM7F_IMF(CExtractCallbackImp::ReportExtractResult(Int32 opRes, Int32 encrypted, const wchar_t *name))
{
if (opRes != NArchive::NExtract::NOperationResult::kOK)
{
@@ -396,8 +404,8 @@ STDMETHODIMP CExtractCallbackImp::ReportExtractResult(Int32 opRes, Int32 encrypt
HRESULT CExtractCallbackImp::BeforeOpen(const wchar_t *name, bool /* testMode */)
{
- #ifndef _SFX
- RINOK(ProgressDialog->Sync.CheckStop());
+ #ifndef Z7_SFX
+ RINOK(ProgressDialog->Sync.CheckStop())
ProgressDialog->Sync.Set_TitleFileName(name);
#endif
_currentArchivePath = name;
@@ -407,17 +415,17 @@ HRESULT CExtractCallbackImp::BeforeOpen(const wchar_t *name, bool /* testMode */
HRESULT CExtractCallbackImp::SetCurrentFilePath2(const wchar_t *path)
{
_currentFilePath = path;
- #ifndef _SFX
+ #ifndef Z7_SFX
ProgressDialog->Sync.Set_FilePath(path);
#endif
return S_OK;
}
-#ifndef _SFX
+#ifndef Z7_SFX
-HRESULT CExtractCallbackImp::SetCurrentFilePath(const wchar_t *path)
+Z7_COM7F_IMF(CExtractCallbackImp::SetCurrentFilePath(const wchar_t *path))
{
- #ifndef _SFX
+ #ifndef Z7_SFX
if (NeedAddFile)
NumFiles++;
NeedAddFile = true;
@@ -451,11 +459,12 @@ static void AddNewLineString(UString &s, const UString &m)
s.Add_LF();
}
+UString GetOpenArcErrorMessage(UInt32 errorFlags);
UString GetOpenArcErrorMessage(UInt32 errorFlags)
{
UString s;
- for (unsigned i = 0; i < ARRAY_SIZE(k_ErrorFlagsIds); i++)
+ for (unsigned i = 0; i < Z7_ARRAY_SIZE(k_ErrorFlagsIds); i++)
{
UInt32 f = ((UInt32)1 << i);
if ((errorFlags & f) == 0)
@@ -466,7 +475,7 @@ UString GetOpenArcErrorMessage(UInt32 errorFlags)
continue;
if (f == kpv_ErrorFlags_EncryptedHeadersError)
{
- m.AddAscii(" : ");
+ m += " : ";
AddLangString(m, IDS_EXTRACT_MSG_WRONG_PSW_GUESS);
}
if (!s.IsEmpty())
@@ -483,7 +492,7 @@ UString GetOpenArcErrorMessage(UInt32 errorFlags)
ConvertUInt32ToHex(errorFlags, sz + 2);
if (!s.IsEmpty())
s.Add_LF();
- s.AddAscii(sz);
+ s += sz;
}
return s;
@@ -503,7 +512,7 @@ static void ErrorInfo_Print(UString &s, const CArcErrorInfo &er)
if (warningFlags != 0)
{
s += GetNameOfProperty(kpidWarningFlags, L"Warnings");
- s.AddAscii(":");
+ s += ":";
s.Add_LF();
AddNewLineString(s, GetOpenArcErrorMessage(warningFlags));
}
@@ -511,7 +520,7 @@ static void ErrorInfo_Print(UString &s, const CArcErrorInfo &er)
if (!er.WarningMessage.IsEmpty())
{
s += GetNameOfProperty(kpidWarning, L"Warning");
- s.AddAscii(": ");
+ s += ": ";
s += er.WarningMessage;
s.Add_LF();
}
@@ -519,12 +528,13 @@ static void ErrorInfo_Print(UString &s, const CArcErrorInfo &er)
static UString GetBracedType(const wchar_t *type)
{
- UString s = L'[';
+ UString s ('[');
s += type;
- s += L']';
+ s += ']';
return s;
}
+void OpenResult_GUI(UString &s, const CCodecs *codecs, const CArchiveLink &arcLink, const wchar_t *name, HRESULT result);
void OpenResult_GUI(UString &s, const CCodecs *codecs, const CArchiveLink &arcLink, const wchar_t *name, HRESULT result)
{
FOR_VECTOR (level, arcLink.Arcs)
@@ -634,7 +644,9 @@ HRESULT CExtractCallbackImp::ExtractResult(HRESULT result)
if (result == S_OK)
return result;
NumArchiveErrors++;
- if (result == E_ABORT || result == ERROR_DISK_FULL)
+ if (result == E_ABORT
+ || result == HRESULT_FROM_WIN32(ERROR_DISK_FULL)
+ )
return result;
Add_ArchiveName_Error();
@@ -644,7 +656,7 @@ HRESULT CExtractCallbackImp::ExtractResult(HRESULT result)
return S_OK;
}
-#ifndef _NO_CRYPTO
+#ifndef Z7_NO_CRYPTO
HRESULT CExtractCallbackImp::SetPassword(const UString &password)
{
@@ -653,14 +665,14 @@ HRESULT CExtractCallbackImp::SetPassword(const UString &password)
return S_OK;
}
-STDMETHODIMP CExtractCallbackImp::CryptoGetTextPassword(BSTR *password)
+Z7_COM7F_IMF(CExtractCallbackImp::CryptoGetTextPassword(BSTR *password))
{
PasswordWasAsked = true;
if (!PasswordIsDefined)
{
CPasswordDialog dialog;
- #ifndef _SFX
- bool showPassword = NExtract::Read_ShowPassword();
+ #ifndef Z7_SFX
+ const bool showPassword = NExtract::Read_ShowPassword();
dialog.ShowPassword = showPassword;
#endif
ProgressDialog->WaitCreating();
@@ -668,7 +680,7 @@ STDMETHODIMP CExtractCallbackImp::CryptoGetTextPassword(BSTR *password)
return E_ABORT;
Password = dialog.Password;
PasswordIsDefined = true;
- #ifndef _SFX
+ #ifndef Z7_SFX
if (dialog.ShowPassword != showPassword)
NExtract::Save_ShowPassword(dialog.ShowPassword);
#endif
@@ -678,24 +690,24 @@ STDMETHODIMP CExtractCallbackImp::CryptoGetTextPassword(BSTR *password)
#endif
-#ifndef _SFX
+#ifndef Z7_SFX
-STDMETHODIMP CExtractCallbackImp::AskWrite(
+Z7_COM7F_IMF(CExtractCallbackImp::AskWrite(
const wchar_t *srcPath, Int32 srcIsFolder,
const FILETIME *srcTime, const UInt64 *srcSize,
const wchar_t *destPath,
BSTR *destPathResult,
- Int32 *writeAnswer)
+ Int32 *writeAnswer))
{
UString destPathResultTemp = destPath;
// RINOK(StringToBstr(destPath, destPathResult));
- *destPathResult = 0;
+ *destPathResult = NULL;
*writeAnswer = BoolToInt(false);
FString destPathSys = us2fs(destPath);
- bool srcIsFolderSpec = IntToBool(srcIsFolder);
+ const bool srcIsFolderSpec = IntToBool(srcIsFolder);
CFileInfo destFileInfo;
if (destFileInfo.Find(destPathSys))
@@ -704,7 +716,7 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
{
if (!destFileInfo.IsDir())
{
- RINOK(MessageError("can not replace file with folder with same name", destPathSys));
+ RINOK(MessageError("Cannot replace file with folder with same name", destPathSys))
return E_ABORT;
}
*writeAnswer = BoolToInt(false);
@@ -713,12 +725,12 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
if (destFileInfo.IsDir())
{
- RINOK(MessageError("can not replace folder with file with same name", destPathSys));
+ RINOK(MessageError("Cannot replace folder with file with same name", destPathSys))
*writeAnswer = BoolToInt(false);
return S_OK;
}
- switch (OverwriteMode)
+ switch ((int)OverwriteMode)
{
case NExtract::NOverwriteMode::kSkip:
return S_OK;
@@ -726,8 +738,8 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
{
Int32 overwriteResult;
UString destPathSpec = destPath;
- int slashPos = destPathSpec.ReverseFind_PathSepar();
- destPathSpec.DeleteFrom(slashPos + 1);
+ const int slashPos = destPathSpec.ReverseFind_PathSepar();
+ destPathSpec.DeleteFrom((unsigned)(slashPos + 1));
destPathSpec += fs2us(destFileInfo.Name);
RINOK(AskOverwrite(
@@ -735,7 +747,7 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
&destFileInfo.MTime, &destFileInfo.Size,
srcPath,
srcTime, srcSize,
- &overwriteResult));
+ &overwriteResult))
switch (overwriteResult)
{
@@ -748,31 +760,38 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
default:
return E_FAIL;
}
+ break;
}
+ default:
+ break;
}
if (OverwriteMode == NExtract::NOverwriteMode::kRename)
{
if (!AutoRenamePath(destPathSys))
{
- RINOK(MessageError("can not create name for file", destPathSys));
+ RINOK(MessageError("Cannot create name for file", destPathSys))
return E_ABORT;
}
destPathResultTemp = fs2us(destPathSys);
}
else
+ {
+ if (NFind::DoesFileExist_Raw(destPathSys))
if (!NDir::DeleteFileAlways(destPathSys))
+ if (GetLastError() != ERROR_FILE_NOT_FOUND)
{
- RINOK(MessageError("can not delete output file", destPathSys));
+ RINOK(MessageError("Cannot delete output file", destPathSys))
return E_ABORT;
}
+ }
}
*writeAnswer = BoolToInt(true);
return StringToBstr(destPathResultTemp, destPathResult);
}
-STDMETHODIMP CExtractCallbackImp::UseExtractToStream(Int32 *res)
+Z7_COM7F_IMF(CExtractCallbackImp::UseExtractToStream(Int32 *res))
{
*res = BoolToInt(StreamMode);
return S_OK;
@@ -782,7 +801,7 @@ static HRESULT GetTime(IGetProp *getProp, PROPID propID, FILETIME &ft, bool &ftD
{
ftDefined = false;
NCOM::CPropVariant prop;
- RINOK(getProp->GetProp(propID, &prop));
+ RINOK(getProp->GetProp(propID, &prop))
if (prop.vt == VT_FILETIME)
{
ft = prop.filetime;
@@ -798,7 +817,7 @@ static HRESULT GetItemBoolProp(IGetProp *getProp, PROPID propID, bool &result)
{
NCOM::CPropVariant prop;
result = false;
- RINOK(getProp->GetProp(propID, &prop));
+ RINOK(getProp->GetProp(propID, &prop))
if (prop.vt == VT_BOOL)
result = VARIANT_BOOLToBool(prop.boolVal);
else if (prop.vt != VT_EMPTY)
@@ -807,13 +826,13 @@ static HRESULT GetItemBoolProp(IGetProp *getProp, PROPID propID, bool &result)
}
-STDMETHODIMP CExtractCallbackImp::GetStream7(const wchar_t *name,
+Z7_COM7F_IMF(CExtractCallbackImp::GetStream7(const wchar_t *name,
Int32 isDir,
ISequentialOutStream **outStream, Int32 askExtractMode,
- IGetProp *getProp)
+ IGetProp *getProp))
{
COM_TRY_BEGIN
- *outStream = 0;
+ *outStream = NULL;
_newVirtFileWasAdded = false;
_hashStreamWasUsed = false;
_needUpdateStat = false;
@@ -829,20 +848,20 @@ STDMETHODIMP CExtractCallbackImp::GetStream7(const wchar_t *name,
_filePath = name;
_isFolder = IntToBool(isDir);
_curSize = 0;
- _curSizeDefined = false;
+ _curSize_Defined = false;
UInt64 size = 0;
bool sizeDefined;
{
NCOM::CPropVariant prop;
- RINOK(getProp->GetProp(kpidSize, &prop));
+ RINOK(getProp->GetProp(kpidSize, &prop))
sizeDefined = ConvertPropVariantToUInt64(prop, size);
}
if (sizeDefined)
{
_curSize = size;
- _curSizeDefined = true;
+ _curSize_Defined = true;
}
if (askExtractMode != NArchive::NExtract::NAskMode::kExtract &&
@@ -862,12 +881,12 @@ STDMETHODIMP CExtractCallbackImp::GetStream7(const wchar_t *name,
file.IsAltStream = _isAltStream;
file.Size = 0;
- RINOK(GetTime(getProp, kpidCTime, file.CTime, file.CTimeDefined));
- RINOK(GetTime(getProp, kpidATime, file.ATime, file.ATimeDefined));
- RINOK(GetTime(getProp, kpidMTime, file.MTime, file.MTimeDefined));
+ RINOK(GetTime(getProp, kpidCTime, file.CTime, file.CTimeDefined))
+ RINOK(GetTime(getProp, kpidATime, file.ATime, file.ATimeDefined))
+ RINOK(GetTime(getProp, kpidMTime, file.MTime, file.MTimeDefined))
NCOM::CPropVariant prop;
- RINOK(getProp->GetProp(kpidAttrib, &prop));
+ RINOK(getProp->GetProp(kpidAttrib, &prop))
if (prop.vt == VT_UI4)
{
file.Attrib = prop.ulVal;
@@ -897,12 +916,14 @@ STDMETHODIMP CExtractCallbackImp::GetStream7(const wchar_t *name,
COM_TRY_END
}
-STDMETHODIMP CExtractCallbackImp::PrepareOperation7(Int32 askExtractMode)
+Z7_COM7F_IMF(CExtractCallbackImp::PrepareOperation7(Int32 askExtractMode))
{
COM_TRY_BEGIN
_needUpdateStat = (
- askExtractMode == NArchive::NExtract::NAskMode::kExtract ||
- askExtractMode == NArchive::NExtract::NAskMode::kTest);
+ askExtractMode == NArchive::NExtract::NAskMode::kExtract
+ || askExtractMode == NArchive::NExtract::NAskMode::kTest
+ || askExtractMode == NArchive::NExtract::NAskMode::kReadExternal
+ );
/*
_extractMode = false;
@@ -920,27 +941,27 @@ STDMETHODIMP CExtractCallbackImp::PrepareOperation7(Int32 askExtractMode)
COM_TRY_END
}
-STDMETHODIMP CExtractCallbackImp::SetOperationResult7(Int32 opRes, Int32 encrypted)
+Z7_COM7F_IMF(CExtractCallbackImp::SetOperationResult8(Int32 opRes, Int32 encrypted, UInt64 size))
{
COM_TRY_BEGIN
if (VirtFileSystem && _newVirtFileWasAdded)
{
// FIXME: probably we must request file size from VirtFileSystem
// _curSize = VirtFileSystem->GetLastFileSize()
- // _curSizeDefined = true;
- RINOK(VirtFileSystemSpec->CloseMemFile());
+ // _curSize_Defined = true;
+ RINOK(VirtFileSystemSpec->CloseMemFile())
}
if (_hashStream && _hashStreamWasUsed)
{
_hashStreamSpec->_hash->Final(_isFolder, _isAltStream, _filePath);
_curSize = _hashStreamSpec->GetSize();
- _curSizeDefined = true;
+ _curSize_Defined = true;
_hashStreamSpec->ReleaseStream();
_hashStreamWasUsed = false;
}
else if (_hashCalc && _needUpdateStat)
{
- _hashCalc->SetSize(_curSize);
+ _hashCalc->SetSize(size); // (_curSize) before 21.04
_hashCalc->Final(_isFolder, _isAltStream, _filePath);
}
return SetOperationResult(opRes, encrypted);
@@ -948,11 +969,10 @@ STDMETHODIMP CExtractCallbackImp::SetOperationResult7(Int32 opRes, Int32 encrypt
}
-static const size_t k_SizeT_MAX = (size_t)((size_t)0 - 1);
-static const UInt32 kBlockSize = ((UInt32)1 << 31);
+// static const UInt32 kBlockSize = ((UInt32)1 << 31);
-STDMETHODIMP CVirtFileSystem::Write(const void *data, UInt32 size, UInt32 *processedSize)
+Z7_COM7F_IMF(CVirtFileSystem::Write(const void *data, UInt32 size, UInt32 *processedSize))
{
if (processedSize)
*processedSize = 0;
@@ -975,8 +995,9 @@ STDMETHODIMP CVirtFileSystem::Write(const void *data, UInt32 size, UInt32 *proce
if (b < a)
b = a;
useMem = false;
- if (b <= k_SizeT_MAX && b <= MaxTotalAllocSize)
- useMem = file.Data.ReAlloc_KeepData((size_t)b, (size_t)file.Size);
+ const size_t b_sizet = (size_t)b;
+ if (b == b_sizet && b <= MaxTotalAllocSize)
+ useMem = file.Data.ReAlloc_KeepData(b_sizet, (size_t)file.Size);
}
if (useMem)
{
@@ -988,7 +1009,7 @@ STDMETHODIMP CVirtFileSystem::Write(const void *data, UInt32 size, UInt32 *proce
}
_fileMode = true;
}
- RINOK(FlushToDisk(false));
+ RINOK(FlushToDisk(false))
return _outFileStream->Write(data, size, processedSize);
}
@@ -1009,10 +1030,10 @@ HRESULT CVirtFileSystem::FlushToDisk(bool closeLast)
{
_outFileStream.Release();
return E_FAIL;
- // MessageBoxMyError(UString(L"Can't create file ") + fs2us(tempFilePath));
+ // MessageBoxMyError(UString("Can't create file ") + fs2us(tempFilePath));
}
_fileIsOpen = true;
- RINOK(WriteStream(_outFileStream, file.Data, (size_t)file.Size));
+ RINOK(WriteStream(_outFileStream, file.Data, (size_t)file.Size))
}
if (_numFlushed == Files.Size() - 1 && !closeLast)
break;
@@ -1027,7 +1048,7 @@ HRESULT CVirtFileSystem::FlushToDisk(bool closeLast)
_numFlushed++;
_fileIsOpen = false;
if (file.AttribDefined)
- NDir::SetFileAttrib(path, file.Attrib);
+ NDir::SetFileAttrib_PosixHighDetect(path, file.Attrib);
}
return S_OK;
}
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h
index 6cd8d0aa83d..c2aa4700c85 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/ExtractCallback.h
@@ -1,42 +1,42 @@
// ExtractCallback.h
-#ifndef __EXTRACT_CALLBACK_H
-#define __EXTRACT_CALLBACK_H
+#ifndef ZIP7_INC_EXTRACT_CALLBACK_H
+#define ZIP7_INC_EXTRACT_CALLBACK_H
#include "../../../../C/Alloc.h"
#include "../../../Common/MyCom.h"
#include "../../../Common/StringConvert.h"
-#ifndef _SFX
+#ifndef Z7_SFX
#include "../Agent/IFolderArchive.h"
#endif
#include "../Common/ArchiveExtractCallback.h"
#include "../Common/ArchiveOpenCallback.h"
-#ifndef _NO_CRYPTO
+#ifndef Z7_NO_CRYPTO
#include "../../IPassword.h"
#endif
-#ifndef _SFX
+#ifndef Z7_SFX
#include "IFolder.h"
#endif
#include "ProgressDialog2.h"
-#ifdef LANG
-#include "LangUtils.h"
+#ifdef Z7_LANG
+// #include "LangUtils.h"
#endif
-#ifndef _SFX
+#ifndef Z7_SFX
class CGrowBuf
{
Byte *_items;
size_t _size;
- CLASS_NO_COPY(CGrowBuf);
+ Z7_CLASS_NO_COPY(CGrowBuf)
public:
bool ReAlloc_KeepData(size_t newSize, size_t keepSize)
@@ -52,7 +52,7 @@ public:
return true;
}
- CGrowBuf(): _items(0), _size(0) {}
+ CGrowBuf(): _items(NULL), _size(0) {}
~CGrowBuf() { MyFree(_items); }
operator Byte *() { return _items; }
@@ -92,10 +92,11 @@ struct CVirtFile
IsAltStream(false) {}
};
-class CVirtFileSystem:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
+
+Z7_CLASS_IMP_NOQIB_1(
+ CVirtFileSystem,
+ ISequentialOutStream
+)
UInt64 _totalAllocSize;
size_t _pos;
@@ -156,104 +157,86 @@ public:
HRESULT CloseFile(const FString &path);
HRESULT FlushToDisk(bool closeLast);
size_t GetPos() const { return _pos; }
-
- MY_UNKNOWN_IMP
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
};
#endif
-class CExtractCallbackImp:
- public IExtractCallbackUI, // it includes IFolderArchiveExtractCallback
- public IOpenCallbackUI,
+class CExtractCallbackImp Z7_final:
+ public IFolderArchiveExtractCallback,
+ /* IExtractCallbackUI:
+ before v23.00 : it included IFolderArchiveExtractCallback
+ since v23.00 : it doesn't include IFolderArchiveExtractCallback
+ */
+ public IExtractCallbackUI, // NON-COM interface since 23.00
+ public IOpenCallbackUI, // NON-COM interface
public IFolderArchiveExtractCallback2,
- #ifndef _SFX
+ #ifndef Z7_SFX
public IFolderOperationsExtractCallback,
public IFolderExtractToStreamCallback,
public ICompressProgressInfo,
- #endif
- #ifndef _NO_CRYPTO
+ #endif
+ #ifndef Z7_NO_CRYPTO
public ICryptoGetTextPassword,
- #endif
+ #endif
public CMyUnknownImp
{
- HRESULT MessageError(const char *message, const FString &path);
- void Add_ArchiveName_Error();
-public:
- MY_QUERYINTERFACE_BEGIN2(IFolderArchiveExtractCallback)
- MY_QUERYINTERFACE_ENTRY(IFolderArchiveExtractCallback2)
- #ifndef _SFX
- MY_QUERYINTERFACE_ENTRY(IFolderOperationsExtractCallback)
- MY_QUERYINTERFACE_ENTRY(IFolderExtractToStreamCallback)
- MY_QUERYINTERFACE_ENTRY(ICompressProgressInfo)
- #endif
- #ifndef _NO_CRYPTO
- MY_QUERYINTERFACE_ENTRY(ICryptoGetTextPassword)
- #endif
- MY_QUERYINTERFACE_END
- MY_ADDREF_RELEASE
-
- INTERFACE_IProgress(;)
- INTERFACE_IOpenCallbackUI(;)
- INTERFACE_IFolderArchiveExtractCallback(;)
- INTERFACE_IFolderArchiveExtractCallback2(;)
- // STDMETHOD(SetTotalFiles)(UInt64 total);
- // STDMETHOD(SetCompletedFiles)(const UInt64 *value);
-
- INTERFACE_IExtractCallbackUI(;)
-
- #ifndef _SFX
- // IFolderOperationsExtractCallback
- STDMETHOD(AskWrite)(
- const wchar_t *srcPath,
- Int32 srcIsFolder,
- const FILETIME *srcTime,
- const UInt64 *srcSize,
- const wchar_t *destPathRequest,
- BSTR *destPathResult,
- Int32 *writeAnswer);
- STDMETHOD(ShowMessage)(const wchar_t *message);
- STDMETHOD(SetCurrentFilePath)(const wchar_t *filePath);
- STDMETHOD(SetNumFiles)(UInt64 numFiles);
- INTERFACE_IFolderExtractToStreamCallback(;)
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
- #endif
+ Z7_COM_QI_BEGIN2(IFolderArchiveExtractCallback)
+ Z7_COM_QI_ENTRY(IFolderArchiveExtractCallback2)
+ #ifndef Z7_SFX
+ Z7_COM_QI_ENTRY(IFolderOperationsExtractCallback)
+ Z7_COM_QI_ENTRY(IFolderExtractToStreamCallback)
+ Z7_COM_QI_ENTRY(ICompressProgressInfo)
+ #endif
+ #ifndef Z7_NO_CRYPTO
+ Z7_COM_QI_ENTRY(ICryptoGetTextPassword)
+ #endif
+ Z7_COM_QI_END
+ Z7_COM_ADDREF_RELEASE
+
+ Z7_IFACE_IMP(IExtractCallbackUI)
+ Z7_IFACE_IMP(IOpenCallbackUI)
+ Z7_IFACE_COM7_IMP(IProgress)
+ Z7_IFACE_COM7_IMP(IFolderArchiveExtractCallback)
+ Z7_IFACE_COM7_IMP(IFolderArchiveExtractCallback2)
+ #ifndef Z7_SFX
+ Z7_IFACE_COM7_IMP(IFolderOperationsExtractCallback)
+ Z7_IFACE_COM7_IMP(IFolderExtractToStreamCallback)
+ Z7_IFACE_COM7_IMP(ICompressProgressInfo)
+ #endif
+ #ifndef Z7_NO_CRYPTO
+ Z7_IFACE_COM7_IMP(ICryptoGetTextPassword)
+ #endif
- // ICryptoGetTextPassword
- #ifndef _NO_CRYPTO
- STDMETHOD(CryptoGetTextPassword)(BSTR *password);
- #endif
-private:
UString _currentArchivePath;
bool _needWriteArchivePath;
- UString _currentFilePath;
bool _isFolder;
+ UString _currentFilePath;
+ UString _filePath;
+ #ifndef Z7_SFX
+ bool _needUpdateStat;
+ bool _newVirtFileWasAdded;
bool _isAltStream;
+ bool _curSize_Defined;
UInt64 _curSize;
- bool _curSizeDefined;
- UString _filePath;
// bool _extractMode;
// bool _testMode;
- bool _newVirtFileWasAdded;
- bool _needUpdateStat;
-
-
- HRESULT SetCurrentFilePath2(const wchar_t *filePath);
- void AddError_Message(LPCWSTR message);
-
- #ifndef _SFX
bool _hashStreamWasUsed;
COutStreamWithHash *_hashStreamSpec;
CMyComPtr<ISequentialOutStream> _hashStream;
IHashCalc *_hashCalc; // it's for stat in Test operation
- #endif
+ #endif
+
+ HRESULT SetCurrentFilePath2(const wchar_t *filePath);
+ void AddError_Message(LPCWSTR message);
+ HRESULT MessageError(const char *message, const FString &path);
+ void Add_ArchiveName_Error();
public:
- #ifndef _SFX
+ #ifndef Z7_SFX
CVirtFileSystem *VirtFileSystemSpec;
CMyComPtr<ISequentialOutStream> VirtFileSystem;
#endif
@@ -263,7 +246,7 @@ public:
bool StreamMode;
CProgressDialog *ProgressDialog;
- #ifndef _SFX
+ #ifndef Z7_SFX
UInt64 NumFolders;
UInt64 NumFiles;
bool NeedAddFile;
@@ -272,7 +255,7 @@ public:
bool ThereAreMessageErrors;
NExtract::NOverwriteMode::EEnum OverwriteMode;
- #ifndef _NO_CRYPTO
+ #ifndef Z7_NO_CRYPTO
bool PasswordIsDefined;
bool PasswordWasAsked;
UString Password;
@@ -282,6 +265,7 @@ public:
UString _lang_Extracting;
UString _lang_Testing;
UString _lang_Skipping;
+ UString _lang_Reading;
UString _lang_Empty;
bool _totalFilesDefined;
@@ -289,27 +273,25 @@ public:
bool MultiArcMode;
CExtractCallbackImp():
- #ifndef _NO_CRYPTO
+ #ifndef Z7_SFX
+ _hashCalc(NULL),
+ #endif
+ ProcessAltStreams(true),
+ StreamMode(false),
+ OverwriteMode(NExtract::NOverwriteMode::kAsk),
+ #ifndef Z7_NO_CRYPTO
PasswordIsDefined(false),
PasswordWasAsked(false),
#endif
- OverwriteMode(NExtract::NOverwriteMode::kAsk),
- StreamMode(false),
- ProcessAltStreams(true),
-
_totalFilesDefined(false),
_totalBytesDefined(false),
MultiArcMode(false)
-
- #ifndef _SFX
- , _hashCalc(NULL)
- #endif
{}
~CExtractCallbackImp();
void Init();
- #ifndef _SFX
+ #ifndef Z7_SFX
void SetHashCalc(IHashCalc *hashCalc) { _hashCalc = hashCalc; }
void SetHashMethods(IHashCalc *hash)
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/FormatUtils.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/FormatUtils.h
index 993e803390f..1db08eff323 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/FormatUtils.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/FormatUtils.h
@@ -1,7 +1,7 @@
// FormatUtils.h
-#ifndef __FORMAT_UTILS_H
-#define __FORMAT_UTILS_H
+#ifndef ZIP7_INC_FORMAT_UTILS_H
+#define ZIP7_INC_FORMAT_UTILS_H
#include "../../../Common/MyTypes.h"
#include "../../../Common/MyString.h"
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/LangUtils.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/LangUtils.h
index d63a443c6d3..d53d270eade 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/LangUtils.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/LangUtils.h
@@ -1,13 +1,16 @@
// LangUtils.h
-#ifndef __LANG_UTILS_H
-#define __LANG_UTILS_H
+#ifndef ZIP7_INC_LANG_UTILS_H
+#define ZIP7_INC_LANG_UTILS_H
-#include "../../../Windows/ResourceString.h"
+#include "../../../Common/Lang.h"
-#ifdef LANG
+#include "../../../Windows/ResourceString.h"
extern UString g_LangID;
+extern CLang g_Lang;
+
+#ifdef Z7_LANG
struct CIDLangPair
{
@@ -17,11 +20,11 @@ struct CIDLangPair
void ReloadLang();
void LoadLangOneTime();
-FString GetLangDirPrefix();
void LangSetDlgItemText(HWND dialog, UInt32 controlID, UInt32 langID);
void LangSetDlgItems(HWND dialog, const UInt32 *ids, unsigned numItems);
void LangSetDlgItems_Colon(HWND dialog, const UInt32 *ids, unsigned numItems);
+void LangSetDlgItems_RemoveColon(HWND dialog, const UInt32 *ids, unsigned numItems);
void LangSetWindowText(HWND window, UInt32 langID);
UString LangString(UInt32 langID);
@@ -37,4 +40,9 @@ inline void AddLangString(UString &s, UInt32 langID) { s += NWindows::MyLoadStri
#endif
+FString GetLangDirPrefix();
+// bool LangOpen(CLang &lang, CFSTR fileName);
+
+void Lang_GetShortNames_for_DefaultLang(AStringVector &names, unsigned &subLang);
+
#endif
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h
index 48a95359e6f..325babcd492 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/MyWindowsNew.h
@@ -1,11 +1,54 @@
// MyWindowsNew.h
-#ifndef __MY_WINDOWS_NEW_H
-#define __MY_WINDOWS_NEW_H
+#ifndef ZIP7_INC_MY_WINDOWS_NEW_H
+#define ZIP7_INC_MY_WINDOWS_NEW_H
-#ifdef _MSC_VER
+#if defined(__MINGW32__) || defined(__MINGW64__) || defined(__MINGW32_VERSION)
+#include <shobjidl.h>
+#if defined(__MINGW32_VERSION) && !defined(__ITaskbarList3_INTERFACE_DEFINED__)
+// for old mingw
+extern "C" {
+DEFINE_GUID(IID_ITaskbarList3, 0xEA1AFB91, 0x9E28, 0x4B86, 0x90, 0xE9, 0x9E, 0x9F, 0x8A, 0x5E, 0xEF, 0xAF);
+DEFINE_GUID(CLSID_TaskbarList, 0x56fdf344, 0xfd6d, 0x11d0, 0x95,0x8a, 0x00,0x60,0x97,0xc9,0xa0,0x90);
+}
+#endif
+
+#else // is not __MINGW*
+
+#ifndef Z7_OLD_WIN_SDK
#include <ShObjIdl.h>
+#else
+
+#ifndef HIMAGELIST
+struct _IMAGELIST;
+typedef struct _IMAGELIST* HIMAGELIST;
+#endif
+
+#ifndef __ITaskbarList_INTERFACE_DEFINED__
+#define __ITaskbarList_INTERFACE_DEFINED__
+DEFINE_GUID(IID_ITaskbarList, 0x56FDF342, 0xFD6D, 0x11d0, 0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90);
+struct ITaskbarList: public IUnknown
+{
+ STDMETHOD(HrInit)(void) = 0;
+ STDMETHOD(AddTab)(HWND hwnd) = 0;
+ STDMETHOD(DeleteTab)(HWND hwnd) = 0;
+ STDMETHOD(ActivateTab)(HWND hwnd) = 0;
+ STDMETHOD(SetActiveAlt)(HWND hwnd) = 0;
+};
+#endif // __ITaskbarList_INTERFACE_DEFINED__
+
+#ifndef __ITaskbarList2_INTERFACE_DEFINED__
+#define __ITaskbarList2_INTERFACE_DEFINED__
+DEFINE_GUID(IID_ITaskbarList2, 0x602D4995, 0xB13A, 0x429b, 0xA6, 0x6E, 0x19, 0x35, 0xE4, 0x4F, 0x43, 0x17);
+struct ITaskbarList2: public ITaskbarList
+{
+ STDMETHOD(MarkFullscreenWindow)(HWND hwnd, BOOL fFullscreen) = 0;
+};
+#endif // __ITaskbarList2_INTERFACE_DEFINED__
+
+#endif // Z7_OLD_WIN_SDK
+
#ifndef __ITaskbarList3_INTERFACE_DEFINED__
#define __ITaskbarList3_INTERFACE_DEFINED__
@@ -69,8 +112,8 @@ struct ITaskbarList3: public ITaskbarList2
STDMETHOD(SetThumbnailClip)(HWND hwnd, RECT *prcClip) = 0;
};
-#endif
+#endif // __ITaskbarList3_INTERFACE_DEFINED__
-#endif
+#endif // __MINGW*
#endif
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp b/3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
index c6feb9021bb..096527ccf96 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.cpp
@@ -17,7 +17,7 @@
using namespace NWindows;
-#ifdef LANG
+#ifdef Z7_LANG
static const UInt32 kLangIDs[] =
{
IDT_OVERWRITE_HEADER,
@@ -40,9 +40,15 @@ void COverwriteDialog::ReduceString(UString &s)
s.Delete(size / 2, s.Len() - size);
s.Insert(size / 2, L" ... ");
}
+ if (!s.IsEmpty() && s.Back() == ' ')
+ {
+ // s += (wchar_t)(0x2423);
+ s.InsertAtFront(L'\"');
+ s += L'\"';
+ }
}
-void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
+void COverwriteDialog::SetFileInfoControl(unsigned textID, unsigned iconID,
const NOverwriteDialog::CFileInfo &fileInfo)
{
UString sizeString;
@@ -51,8 +57,8 @@ void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
const UString &fileName = fileInfo.Name;
int slashPos = fileName.ReverseFind_PathSepar();
- UString s1 = fileName.Left(slashPos + 1);
- UString s2 = fileName.Ptr(slashPos + 1);
+ UString s1 = fileName.Left((unsigned)(slashPos + 1));
+ UString s2 = fileName.Ptr((unsigned)(slashPos + 1));
ReduceString(s1);
ReduceString(s2);
@@ -66,13 +72,10 @@ void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
if (fileInfo.TimeIsDefined)
{
- FILETIME localFileTime;
- if (!FileTimeToLocalFileTime(&fileInfo.Time, &localFileTime))
- throw 4190402;
AddLangString(s, IDS_PROP_MTIME);
- s += L": ";
- wchar_t t[32];
- ConvertFileTimeToString(localFileTime, t);
+ s += ": ";
+ char t[32];
+ ConvertUtcFileTimeToString(fileInfo.Time, t);
s += t;
}
@@ -93,17 +96,33 @@ void COverwriteDialog::SetFileInfoControl(int textID, int iconID,
bool COverwriteDialog::OnInit()
{
- #ifdef LANG
+ #ifdef Z7_LANG
LangSetWindowText(*this, IDD_OVERWRITE);
- LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
+ LangSetDlgItems(*this, kLangIDs, Z7_ARRAY_SIZE(kLangIDs));
#endif
SetFileInfoControl(IDT_OVERWRITE_OLD_FILE_SIZE_TIME, IDI_OVERWRITE_OLD_FILE, OldFileInfo);
SetFileInfoControl(IDT_OVERWRITE_NEW_FILE_SIZE_TIME, IDI_OVERWRITE_NEW_FILE, NewFileInfo);
NormalizePosition();
+
+ if (!ShowExtraButtons)
+ {
+ HideItem(IDB_YES_TO_ALL);
+ HideItem(IDB_NO_TO_ALL);
+ HideItem(IDB_AUTO_RENAME);
+ }
+
+ if (DefaultButton_is_NO)
+ {
+ PostMsg(DM_SETDEFID, IDNO);
+ HWND h = GetItem(IDNO);
+ PostMsg(WM_NEXTDLGCTL, (WPARAM)h, TRUE);
+ // ::SetFocus(h);
+ }
+
return CModalDialog::OnInit();
}
-bool COverwriteDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+bool COverwriteDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
{
switch (buttonID)
{
@@ -112,7 +131,7 @@ bool COverwriteDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
case IDB_YES_TO_ALL:
case IDB_NO_TO_ALL:
case IDB_AUTO_RENAME:
- End(buttonID);
+ End((INT_PTR)buttonID);
return true;
}
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h
index da7fa55ff68..a9ca99158ee 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/OverwriteDialog.h
@@ -1,7 +1,7 @@
// OverwriteDialog.h
-#ifndef __OVERWRITE_DIALOG_H
-#define __OVERWRITE_DIALOG_H
+#ifndef ZIP7_INC_OVERWRITE_DIALOG_H
+#define ZIP7_INC_OVERWRITE_DIALOG_H
#include "../../../Windows/Control/Dialog.h"
@@ -20,7 +20,7 @@ namespace NOverwriteDialog
void SetTime(const FILETIME *t)
{
- if (t == 0)
+ if (!t)
TimeIsDefined = false;
else
{
@@ -28,15 +28,19 @@ namespace NOverwriteDialog
Time = *t;
}
}
+
+ void SetSize(UInt64 size)
+ {
+ SizeIsDefined = true;
+ Size = size;
+ }
+
void SetSize(const UInt64 *size)
{
- if (size == 0)
+ if (!size)
SizeIsDefined = false;
else
- {
- SizeIsDefined = true;
- Size = *size;
- }
+ SetSize(*size);
}
};
}
@@ -45,13 +49,19 @@ class COverwriteDialog: public NWindows::NControl::CModalDialog
{
bool _isBig;
- void SetFileInfoControl(int textID, int iconID, const NOverwriteDialog::CFileInfo &fileInfo);
- virtual bool OnInit();
- bool OnButtonClicked(int buttonID, HWND buttonHWND);
+ void SetFileInfoControl(unsigned textID, unsigned iconID, const NOverwriteDialog::CFileInfo &fileInfo);
+ virtual bool OnInit() Z7_override;
+ virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND) Z7_override;
void ReduceString(UString &s);
public:
- INT_PTR Create(HWND parent = 0)
+ bool ShowExtraButtons;
+ bool DefaultButton_is_NO;
+
+
+ COverwriteDialog(): ShowExtraButtons(true), DefaultButton_is_NO(false) {}
+
+ INT_PTR Create(HWND parent = NULL)
{
BIG_DIALOG_SIZE(280, 200);
#ifdef UNDER_CE
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp b/3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp
index 6ead39c3764..bf995802aba 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.cpp
@@ -4,11 +4,11 @@
#include "PasswordDialog.h"
-#ifdef LANG
+#ifdef Z7_LANG
#include "LangUtils.h"
#endif
-#ifdef LANG
+#ifdef Z7_LANG
static const UInt32 kLangIDs[] =
{
IDT_PASSWORD_ENTER,
@@ -30,9 +30,9 @@ void CPasswordDialog::SetTextSpec()
bool CPasswordDialog::OnInit()
{
- #ifdef LANG
+ #ifdef Z7_LANG
LangSetWindowText(*this, IDD_PASSWORD);
- LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
+ LangSetDlgItems(*this, kLangIDs, Z7_ARRAY_SIZE(kLangIDs));
#endif
_passwordEdit.Attach(GetItem(IDE_PASSWORD_PASSWORD));
CheckButton(IDX_PASSWORD_SHOW, ShowPassword);
@@ -40,7 +40,7 @@ bool CPasswordDialog::OnInit()
return CModalDialog::OnInit();
}
-bool CPasswordDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+bool CPasswordDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
{
if (buttonID == IDX_PASSWORD_SHOW)
{
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h
index 339ebdaf072..e05c4adf7e5 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/PasswordDialog.h
@@ -1,7 +1,7 @@
// PasswordDialog.h
-#ifndef __PASSWORD_DIALOG_H
-#define __PASSWORD_DIALOG_H
+#ifndef ZIP7_INC_PASSWORD_DIALOG_H
+#define ZIP7_INC_PASSWORD_DIALOG_H
#include "../../../Windows/Control/Dialog.h"
#include "../../../Windows/Control/Edit.h"
@@ -12,9 +12,9 @@ class CPasswordDialog: public NWindows::NControl::CModalDialog
{
NWindows::NControl::CEdit _passwordEdit;
- virtual void OnOK();
- virtual bool OnInit();
- virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
+ virtual void OnOK() Z7_override;
+ virtual bool OnInit() Z7_override;
+ virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND) Z7_override;
void SetTextSpec();
void ReadControls();
public:
@@ -22,7 +22,7 @@ public:
bool ShowPassword;
CPasswordDialog(): ShowPassword(false) {}
- INT_PTR Create(HWND parentWindow = 0) { return CModalDialog::Create(IDD_PASSWORD, parentWindow); }
+ INT_PTR Create(HWND parentWindow = NULL) { return CModalDialog::Create(IDD_PASSWORD, parentWindow); }
};
#endif
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp
index 65201a9ed16..fc6f559923f 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.cpp
@@ -15,7 +15,7 @@ extern HINSTANCE g_hInstance;
static const UINT_PTR kTimerID = 3;
static const UINT kTimerElapse = 100;
-#ifdef LANG
+#ifdef Z7_LANG
#include "LangUtils.h"
#endif
@@ -32,7 +32,7 @@ HRESULT CProgressSync::ProcessStopAndPause()
return S_OK;
}
-#ifndef _SFX
+#ifndef Z7_SFX
CProgressDialog::~CProgressDialog()
{
AddToTitle(L"");
@@ -45,15 +45,17 @@ void CProgressDialog::AddToTitle(LPCWSTR s)
#endif
+#define UNDEFINED_VAL ((UInt64)(Int64)-1)
+
bool CProgressDialog::OnInit()
{
- _range = (UInt64)(Int64)-1;
- _prevPercentValue = -1;
+ _range = UNDEFINED_VAL;
+ _prevPercentValue = UNDEFINED_VAL;
_wasCreated = true;
_dialogCreatedEvent.Set();
- #ifdef LANG
+ #ifdef Z7_LANG
LangSetDlgItems(*this, NULL, 0);
#endif
@@ -114,15 +116,15 @@ bool CProgressDialog::OnTimer(WPARAM /* timerID */, LPARAM /* callback */)
if (total == 0)
total = 1;
- int percentValue = (int)(completed * 100 / total);
+ const UInt64 percentValue = completed * 100 / total;
if (percentValue != _prevPercentValue)
{
wchar_t s[64];
ConvertUInt64ToString(percentValue, s);
UString title = s;
- title += L"% ";
+ title += "% ";
SetText(title + _title);
- #ifndef _SFX
+ #ifndef Z7_SFX
AddToTitle(title + MainAddTitle);
#endif
_prevPercentValue = percentValue;
@@ -136,8 +138,11 @@ bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
case kCloseMessage:
{
- KillTimer(_timer);
- _timer = 0;
+ if (_timer)
+ {
+ KillTimer(kTimerID);
+ _timer = 0;
+ }
if (_inCancelMessageBox)
{
_externalCloseMessageWasReceived = true;
@@ -156,7 +161,7 @@ bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
return CModalDialog::OnMessage(message, wParam, lParam);
}
-bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+bool CProgressDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
{
switch (buttonID)
{
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h
index 0f41b57aed6..1fe9587a541 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog.h
@@ -1,7 +1,7 @@
// ProgressDialog.h
-#ifndef __PROGRESS_DIALOG_H
-#define __PROGRESS_DIALOG_H
+#ifndef ZIP7_INC_PROGRESS_DIALOG_H
+#define ZIP7_INC_PROGRESS_DIALOG_H
#include "../../../Windows/Synchronization.h"
#include "../../../Windows/Thread.h"
@@ -85,24 +85,27 @@ private:
UInt64 _range;
NWindows::NControl::CProgressBar m_ProgressBar;
- int _prevPercentValue;
+ UInt64 _prevPercentValue;
bool _wasCreated;
bool _needClose;
bool _inCancelMessageBox;
bool _externalCloseMessageWasReceived;
- bool OnTimer(WPARAM timerID, LPARAM callback);
+ virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND) Z7_override;
+ virtual bool OnTimer(WPARAM timerID, LPARAM callback) Z7_override;
+ virtual bool OnInit() Z7_override;
+ virtual void OnCancel() Z7_override;
+ virtual void OnOK() Z7_override;
+ virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam) Z7_override;
+
void SetRange(UInt64 range);
void SetPos(UInt64 pos);
- virtual bool OnInit();
- virtual void OnCancel();
- virtual void OnOK();
+
NWindows::NSynchronization::CManualResetEvent _dialogCreatedEvent;
- #ifndef _SFX
+ #ifndef Z7_SFX
void AddToTitle(LPCWSTR string);
#endif
- bool OnButtonClicked(int buttonID, HWND buttonHWND);
void WaitCreating() { _dialogCreatedEvent.Lock(); }
void CheckNeedClose();
@@ -111,7 +114,7 @@ public:
CProgressSync Sync;
int IconID;
- #ifndef _SFX
+ #ifndef Z7_SFX
HWND MainWindow;
UString MainTitle;
UString MainAddTitle;
@@ -119,8 +122,8 @@ public:
#endif
CProgressDialog(): _timer(0)
- #ifndef _SFX
- ,MainWindow(0)
+ #ifndef Z7_SFX
+ ,MainWindow(NULL)
#endif
{
IconID = -1;
@@ -133,11 +136,11 @@ public:
throw 1334987;
}
- INT_PTR Create(const UString &title, NWindows::CThread &thread, HWND wndParent = 0)
+ INT_PTR Create(const UString &title, NWindows::CThread &thread, HWND wndParent = NULL)
{
_title = title;
INT_PTR res = CModalDialog::Create(IDD_PROGRESS, wndParent);
- thread.Wait();
+ thread.Wait_Close();
return res;
}
@@ -146,8 +149,6 @@ public:
kCloseMessage = WM_APP + 1
};
- virtual bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
-
void ProcessWasFinished()
{
WaitCreating();
@@ -155,7 +156,7 @@ public:
PostMsg(kCloseMessage);
else
_needClose = true;
- };
+ }
};
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
index 8c38b81aa0a..1521d83ceca 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.cpp
@@ -2,10 +2,14 @@
#include "StdAfx.h"
+#ifdef Z7_OLD_WIN_SDK
+#include <ShlGuid.h>
+#endif
+
#include "../../../Common/IntToString.h"
#include "../../../Common/StringConvert.h"
-#include "../../../Windows/Control/Static.h"
+#include "../../../Windows/Clipboard.h"
#include "../../../Windows/ErrorMsg.h"
#include "../GUI/ExtractRes.h"
@@ -43,7 +47,7 @@ static const UINT kCreateDelay =
static const DWORD kPauseSleepTime = 100;
-#ifdef LANG
+#ifdef Z7_LANG
static const UInt32 kLangIDs[] =
{
@@ -67,19 +71,19 @@ static const UInt32 kLangIDs_Colon[] =
#endif
-#define UNDEFINED_VAL ((UInt64)(Int64)-1)
-#define INIT_AS_UNDEFINED(v) v = UNDEFINED_VAL;
-#define IS_UNDEFINED_VAL(v) ((v) == UNDEFINED_VAL)
-#define IS_DEFINED_VAL(v) ((v) != UNDEFINED_VAL)
+#define UNDEFINED_VAL ((UInt64)(Int64)-1)
+#define INIT_AS_UNDEFINED(v) v = UNDEFINED_VAL;
+#define IS_UNDEFINED_VAL(v) ((v) == UNDEFINED_VAL)
+#define IS_DEFINED_VAL(v) ((v) != UNDEFINED_VAL)
CProgressSync::CProgressSync():
_stopped(false), _paused(false),
_bytesProgressMode(true),
+ _isDir(false),
_totalBytes(UNDEFINED_VAL), _completedBytes(0),
_totalFiles(UNDEFINED_VAL), _curFiles(0),
_inSize(UNDEFINED_VAL),
- _outSize(UNDEFINED_VAL),
- _isDir(false)
+ _outSize(UNDEFINED_VAL)
{}
#define CHECK_STOP if (_stopped) return E_ABORT; if (!_paused) return S_OK;
@@ -217,7 +221,7 @@ void CProgressSync::AddError_Message_Name(const wchar_t *message, const wchar_t
UString s;
if (name && *name != 0)
s += name;
- if (message && *message != 0 )
+ if (message && *message != 0)
{
if (!s.IsEmpty())
s.Add_LF();
@@ -228,15 +232,18 @@ void CProgressSync::AddError_Message_Name(const wchar_t *message, const wchar_t
AddError_Message(s);
}
-void CProgressSync::AddError_Code_Name(DWORD systemError, const wchar_t *name)
+void CProgressSync::AddError_Code_Name(HRESULT systemError, const wchar_t *name)
{
UString s = NError::MyFormatMessage(systemError);
if (systemError == 0)
- s = L"Error";
+ s = "Error";
AddError_Message_Name(s, name);
}
-CProgressDialog::CProgressDialog(): _timer(0), CompressingMode(true), MainWindow(0)
+CProgressDialog::CProgressDialog():
+ _timer(0),
+ CompressingMode(true),
+ MainWindow(NULL)
{
_isDir = false;
@@ -259,25 +266,25 @@ CProgressDialog::CProgressDialog(): _timer(0), CompressingMode(true), MainWindow
throw 1334987;
if (_createDialogEvent.Create() != S_OK)
throw 1334987;
- #ifdef __ITaskbarList3_INTERFACE_DEFINED__
+ // #ifdef __ITaskbarList3_INTERFACE_DEFINED__
CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (void**)&_taskbarList);
if (_taskbarList)
_taskbarList->HrInit();
- #endif
+ // #endif
}
-#ifndef _SFX
+#ifndef Z7_SFX
CProgressDialog::~CProgressDialog()
{
- #ifdef __ITaskbarList3_INTERFACE_DEFINED__
+ // #ifdef __ITaskbarList3_INTERFACE_DEFINED__
SetTaskbarProgressState(TBPF_NOPROGRESS);
- #endif
+ // #endif
AddToTitle(L"");
}
void CProgressDialog::AddToTitle(LPCWSTR s)
{
- if (MainWindow != 0)
+ if (MainWindow)
{
CWindow window(MainWindow);
window.SetText((UString)s + MainTitle);
@@ -289,7 +296,7 @@ void CProgressDialog::AddToTitle(LPCWSTR s)
void CProgressDialog::SetTaskbarProgressState()
{
- #ifdef __ITaskbarList3_INTERFACE_DEFINED__
+ // #ifdef __ITaskbarList3_INTERFACE_DEFINED__
if (_taskbarList && _hwndForTaskbar)
{
TBPFLAG tbpFlags;
@@ -299,7 +306,7 @@ void CProgressDialog::SetTaskbarProgressState()
tbpFlags = _errorsWereDisplayed ? TBPF_ERROR: TBPF_NORMAL;
SetTaskbarProgressState(tbpFlags);
}
- #endif
+ // #endif
}
static const unsigned kTitleFileNameSizeLimit = 36;
@@ -328,37 +335,40 @@ bool CProgressDialog::OnInit()
if (!_hwndForTaskbar)
_hwndForTaskbar = *this;
- INIT_AS_UNDEFINED(_progressBar_Range);
- INIT_AS_UNDEFINED(_progressBar_Pos);
+ INIT_AS_UNDEFINED(_progressBar_Range)
+ INIT_AS_UNDEFINED(_progressBar_Pos)
- INIT_AS_UNDEFINED(_prevPercentValue);
- INIT_AS_UNDEFINED(_prevElapsedSec);
- INIT_AS_UNDEFINED(_prevRemainingSec);
+ INIT_AS_UNDEFINED(_prevPercentValue)
+ INIT_AS_UNDEFINED(_prevElapsedSec)
+ INIT_AS_UNDEFINED(_prevRemainingSec)
- INIT_AS_UNDEFINED(_prevSpeed);
+ INIT_AS_UNDEFINED(_prevSpeed)
_prevSpeed_MoveBits = 0;
_prevTime = ::GetTickCount();
_elapsedTime = 0;
- INIT_AS_UNDEFINED(_totalBytes_Prev);
- INIT_AS_UNDEFINED(_processed_Prev);
- INIT_AS_UNDEFINED(_packed_Prev);
- INIT_AS_UNDEFINED(_ratio_Prev);
+ INIT_AS_UNDEFINED(_totalBytes_Prev)
+ INIT_AS_UNDEFINED(_processed_Prev)
+ INIT_AS_UNDEFINED(_packed_Prev)
+ INIT_AS_UNDEFINED(_ratio_Prev)
+
_filesStr_Prev.Empty();
+ _filesTotStr_Prev.Empty();
_foreground = true;
m_ProgressBar.Attach(GetItem(IDC_PROGRESS1));
_messageList.Attach(GetItem(IDL_PROGRESS_MESSAGES));
_messageList.SetUnicodeFormat();
+ _messageList.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT);
_wasCreated = true;
_dialogCreatedEvent.Set();
- #ifdef LANG
- LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
- LangSetDlgItems_Colon(*this, kLangIDs_Colon, ARRAY_SIZE(kLangIDs_Colon));
+ #ifdef Z7_LANG
+ LangSetDlgItems(*this, kLangIDs, Z7_ARRAY_SIZE(kLangIDs));
+ LangSetDlgItems_Colon(*this, kLangIDs_Colon, Z7_ARRAY_SIZE(kLangIDs_Colon));
#endif
CWindow window(GetItem(IDB_PROGRESS_BACKGROUND));
@@ -420,13 +430,14 @@ static const UINT kIDs[] =
IDT_PROGRESS_ELAPSED, IDT_PROGRESS_ELAPSED_VAL,
IDT_PROGRESS_REMAINING, IDT_PROGRESS_REMAINING_VAL,
IDT_PROGRESS_FILES, IDT_PROGRESS_FILES_VAL,
- IDT_PROGRESS_RATIO, IDT_PROGRESS_RATIO_VAL,
+ 0, IDT_PROGRESS_FILES_TOTAL,
IDT_PROGRESS_ERRORS, IDT_PROGRESS_ERRORS_VAL,
IDT_PROGRESS_TOTAL, IDT_PROGRESS_TOTAL_VAL,
IDT_PROGRESS_SPEED, IDT_PROGRESS_SPEED_VAL,
IDT_PROGRESS_PROCESSED, IDT_PROGRESS_PROCESSED_VAL,
- IDT_PROGRESS_PACKED, IDT_PROGRESS_PACKED_VAL
+ IDT_PROGRESS_PACKED, IDT_PROGRESS_PACKED_VAL,
+ IDT_PROGRESS_RATIO, IDT_PROGRESS_RATIO_VAL
};
bool CProgressDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
@@ -446,12 +457,12 @@ bool CProgressDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
InvalidateRect(NULL);
- int xSizeClient = xSize - mx * 2;
+ const int xSizeClient = xSize - mx * 2;
{
- int i;
+ unsigned i;
for (i = 800; i > 40; i = i * 9 / 10)
- if (Units_To_Pixels_X(i) <= xSizeClient)
+ if (Units_To_Pixels_X((int)i) <= xSizeClient)
break;
_numReduceSymbols = i / 4;
}
@@ -466,7 +477,7 @@ bool CProgressDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
int mx2 = mx;
for (;; mx2--)
{
- int bSize2 = bSizeX * 3 + mx2 * 2;
+ const int bSize2 = bSizeX * 3 + mx2 * 2;
if (bSize2 <= xSizeClient)
break;
if (mx2 < 5)
@@ -481,7 +492,7 @@ bool CProgressDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
{
RECT r;
GetClientRectOfItem(IDL_PROGRESS_MESSAGES, r);
- int y = r.top;
+ const int y = r.top;
int ySize2 = yPos - my - y;
const int kMinYSize = _buttonSizeY + _buttonSizeY * 3 / 4;
int xx = xSize - mx * 2;
@@ -512,13 +523,13 @@ bool CProgressDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
labelSize = Units_To_Pixels_X(MY_PROGRESS_LABEL_UNITS_MIN);
valueSize = Units_To_Pixels_X(MY_PROGRESS_VAL_UNITS);
padSize = Units_To_Pixels_X(MY_PROGRESS_PAD_UNITS);
- int requiredSize = (labelSize + valueSize) * 2 + padSize;
+ const int requiredSize = (labelSize + valueSize) * 2 + padSize;
int gSize;
{
if (requiredSize < xSizeClient)
{
- int incr = (xSizeClient - requiredSize) / 3;
+ const int incr = (xSizeClient - requiredSize) / 3;
labelSize += incr;
}
else
@@ -533,16 +544,17 @@ bool CProgressDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
labelSize = gSize - valueSize;
yPos = my;
- for (int i = 0; i < ARRAY_SIZE(kIDs); i += 2)
+ for (unsigned i = 0; i < Z7_ARRAY_SIZE(kIDs); i += 2)
{
int x = mx;
- const int kNumColumn1Items = 5 * 2;
+ const unsigned kNumColumn1Items = 5 * 2;
if (i >= kNumColumn1Items)
{
if (i == kNumColumn1Items)
yPos = my;
x = mx + gSize + padSize;
}
+ if (kIDs[i] != 0)
MoveItem(kIDs[i], x, yPos, labelSize, sY);
MoveItem(kIDs[i + 1], x + labelSize, yPos, valueSize, sY);
yPos += sStep;
@@ -558,7 +570,7 @@ void CProgressDialog::SetProgressRange(UInt64 range)
if (range == _progressBar_Range)
return;
_progressBar_Range = range;
- INIT_AS_UNDEFINED(_progressBar_Pos);
+ INIT_AS_UNDEFINED(_progressBar_Pos)
_progressConv.Init(range);
m_ProgressBar.SetRange32(0, _progressConv.Count(range));
}
@@ -570,16 +582,17 @@ void CProgressDialog::SetProgressPos(UInt64 pos)
pos - _progressBar_Pos >= (_progressBar_Range >> 10))
{
m_ProgressBar.SetPos(_progressConv.Count(pos));
- #ifdef __ITaskbarList3_INTERFACE_DEFINED__
+ // #ifdef __ITaskbarList3_INTERFACE_DEFINED__
if (_taskbarList && _hwndForTaskbar)
_taskbarList->SetProgressValue(_hwndForTaskbar, pos, _progressBar_Range);
- #endif
+ // #endif
_progressBar_Pos = pos;
}
}
#define UINT_TO_STR_2(val) { s[0] = (wchar_t)('0' + (val) / 10); s[1] = (wchar_t)('0' + (val) % 10); s += 2; }
+void GetTimeString(UInt64 timeValue, wchar_t *s);
void GetTimeString(UInt64 timeValue, wchar_t *s)
{
UInt64 hours = timeValue / 3600;
@@ -594,10 +607,10 @@ void GetTimeString(UInt64 timeValue, wchar_t *s)
else
{
UInt32 hours32 = (UInt32)hours;
- UINT_TO_STR_2(hours32);
+ UINT_TO_STR_2(hours32)
}
- *s++ = ':'; UINT_TO_STR_2(minutes);
- *s++ = ':'; UINT_TO_STR_2(seconds);
+ *s++ = ':'; UINT_TO_STR_2(minutes)
+ *s++ = ':'; UINT_TO_STR_2(seconds)
*s = 0;
}
@@ -613,11 +626,12 @@ static void ConvertSizeToString(UInt64 v, wchar_t *s)
s += MyStringLen(s);
*s++ = ' ';
*s++ = c;
+ *s++ = 'B';
*s++ = 0;
}
}
-void CProgressDialog::ShowSize(int id, UInt64 val, UInt64 &prev)
+void CProgressDialog::ShowSize(unsigned id, UInt64 val, UInt64 &prev)
{
if (val == prev)
return;
@@ -761,7 +775,7 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
{
if (IS_DEFINED_VAL(_prevRemainingSec))
{
- INIT_AS_UNDEFINED(_prevRemainingSec);
+ INIT_AS_UNDEFINED(_prevRemainingSec)
SetItemText(IDT_PROGRESS_REMAINING_VAL, L"");
}
}
@@ -780,8 +794,9 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
}
}
{
- UInt64 elapsedTime = (_elapsedTime == 0) ? 1 : _elapsedTime;
- UInt64 v = (progressCompleted * 1000) / elapsedTime;
+ const UInt64 elapsedTime = (_elapsedTime == 0) ? 1 : _elapsedTime;
+ // 22.02: progressCompleted can be for number of files
+ UInt64 v = (completed * 1000) / elapsedTime;
Byte c = 0;
unsigned moveBits = 0;
if (v >= ((UInt64)10000 << 10)) { moveBits = 20; c = 'M'; }
@@ -825,17 +840,25 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
{
wchar_t s[64];
+
ConvertUInt64ToString(completedFiles, s);
- if (IS_DEFINED_VAL(totalFiles))
- {
- wcscat(s, L" / ");
- ConvertUInt64ToString(totalFiles, s + wcslen(s));
- }
if (_filesStr_Prev != s)
{
_filesStr_Prev = s;
SetItemText(IDT_PROGRESS_FILES_VAL, s);
}
+
+ s[0] = 0;
+ if (IS_DEFINED_VAL(totalFiles))
+ {
+ MyStringCopy(s, L" / ");
+ ConvertUInt64ToString(totalFiles, s + MyStringLen(s));
+ }
+ if (_filesTotStr_Prev != s)
+ {
+ _filesTotStr_Prev = s;
+ SetItemText(IDT_PROGRESS_FILES_TOTAL, s);
+ }
}
const UInt64 packSize = CompressingMode ? outSize : inSize;
@@ -862,7 +885,7 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
{
_ratio_Prev = ratio;
ConvertUInt64ToString(ratio, s);
- wcscat(s, L"%");
+ MyStringCat(s, L"%");
SetItemText(IDT_PROGRESS_RATIO_VAL, s);
}
}
@@ -889,8 +912,8 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
int slashPos = _filePath.ReverseFind_PathSepar();
if (slashPos >= 0)
{
- s1.SetFrom(_filePath, slashPos + 1);
- s2 = _filePath.Ptr(slashPos + 1);
+ s1.SetFrom(_filePath, (unsigned)(slashPos + 1));
+ s2 = _filePath.Ptr((unsigned)(slashPos + 1));
}
else
s2 = _filePath;
@@ -939,7 +962,7 @@ INT_PTR CProgressDialog::Create(const UString &title, NWindows::CThread &thread,
CWaitCursor waitCursor;
HANDLE h[] = { thread, _createDialogEvent };
- WRes res2 = WaitForMultipleObjects(ARRAY_SIZE(h), h, FALSE, kCreateDelay);
+ const DWORD res2 = WaitForMultipleObjects(Z7_ARRAY_SIZE(h), h, FALSE, kCreateDelay);
if (res2 == WAIT_OBJECT_0 && !Sync.ThereIsMessage())
return 0;
}
@@ -951,9 +974,8 @@ INT_PTR CProgressDialog::Create(const UString &title, NWindows::CThread &thread,
{
_wasCreated = true;
_dialogCreatedEvent.Set();
- res = res;
}
- thread.Wait();
+ thread.Wait_Close();
if (!MessagesDisplayed)
MessageBoxW(wndParent, L"Progress Error", L"7-Zip", MB_ICONERROR);
return res;
@@ -962,9 +984,9 @@ INT_PTR CProgressDialog::Create(const UString &title, NWindows::CThread &thread,
bool CProgressDialog::OnExternalCloseMessage()
{
// it doesn't work if there is MessageBox.
- #ifdef __ITaskbarList3_INTERFACE_DEFINED__
+ // #ifdef __ITaskbarList3_INTERFACE_DEFINED__
SetTaskbarProgressState(TBPF_NOPROGRESS);
- #endif
+ // #endif
// AddToTitle(L"Finished ");
// SetText(L"Finished2 ");
@@ -974,7 +996,9 @@ bool CProgressDialog::OnExternalCloseMessage()
::SendMessage(GetItem(IDCANCEL), BM_SETSTYLE, BS_DEFPUSHBUTTON, MAKELPARAM(TRUE, 0));
HideItem(IDB_PROGRESS_BACKGROUND);
HideItem(IDB_PAUSE);
-
+
+ ProcessWasFinished_GuiVirt();
+
bool thereAreMessages;
CProgressFinalMessage fm;
{
@@ -982,20 +1006,22 @@ bool CProgressDialog::OnExternalCloseMessage()
thereAreMessages = !Sync.Messages.IsEmpty();
fm = Sync.FinalMessage;
}
+
if (!fm.ErrorMessage.Message.IsEmpty())
{
MessagesDisplayed = true;
if (fm.ErrorMessage.Title.IsEmpty())
- fm.ErrorMessage.Title = L"7-Zip";
+ fm.ErrorMessage.Title = "7-Zip";
MessageBoxW(*this, fm.ErrorMessage.Message, fm.ErrorMessage.Title, MB_ICONERROR);
}
else if (!thereAreMessages)
{
MessagesDisplayed = true;
+
if (!fm.OkMessage.Message.IsEmpty())
{
if (fm.OkMessage.Title.IsEmpty())
- fm.OkMessage.Title = L"7-Zip";
+ fm.OkMessage.Title = "7-Zip";
MessageBoxW(*this, fm.OkMessage.Message, fm.OkMessage.Title, MB_OK);
}
}
@@ -1017,10 +1043,17 @@ bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
case kCloseMessage:
{
- KillTimer(_timer);
- _timer = 0;
+ if (_timer)
+ {
+ /* 21.03 : KillTimer(kTimerID) instead of KillTimer(_timer).
+ But (_timer == kTimerID) in Win10. So it worked too */
+ KillTimer(kTimerID);
+ _timer = 0;
+ }
if (_inCancelMessageBox)
{
+ /* if user is in MessageBox(), we will call OnExternalCloseMessage()
+ later, when MessageBox() will be closed */
_externalCloseMessageWasReceived = true;
break;
}
@@ -1050,8 +1083,8 @@ void CProgressDialog::SetTitleText()
{
char temp[32];
ConvertUInt64ToString(_prevPercentValue, temp);
- s.AddAscii(temp);
- s += L'%';
+ s += temp;
+ s += '%';
}
if (!_foreground)
{
@@ -1060,7 +1093,7 @@ void CProgressDialog::SetTitleText()
}
s.Add_Space();
- #ifndef _SFX
+ #ifndef Z7_SFX
{
unsigned len = s.Len();
s += MainAddTitle;
@@ -1117,13 +1150,16 @@ void CProgressDialog::OnPriorityButton()
void CProgressDialog::AddMessageDirect(LPCWSTR message, bool needNumber)
{
- int itemIndex = _messageList.GetItemCount();
wchar_t sz[16];
sz[0] = 0;
if (needNumber)
ConvertUInt32ToString(_numMessages + 1, sz);
- _messageList.InsertItem(itemIndex, sz);
- _messageList.SetSubItem(itemIndex, 1, message);
+ const unsigned itemIndex = _messageStrings.Size(); // _messageList.GetItemCount();
+ if (_messageList.InsertItem(itemIndex, sz) == (int)itemIndex)
+ {
+ _messageList.SetSubItem(itemIndex, 1, message);
+ _messageStrings.Add(message);
+ }
}
void CProgressDialog::AddMessage(LPCWSTR message)
@@ -1132,12 +1168,12 @@ void CProgressDialog::AddMessage(LPCWSTR message)
bool needNumber = true;
while (!s.IsEmpty())
{
- int pos = s.Find(L'\n');
+ const int pos = s.Find(L'\n');
if (pos < 0)
break;
- AddMessageDirect(s.Left(pos), needNumber);
+ AddMessageDirect(s.Left((unsigned)pos), needNumber);
needNumber = false;
- s.DeleteFrontal(pos + 1);
+ s.DeleteFrontal((unsigned)pos + 1);
}
AddMessageDirect(s, needNumber);
_numMessages++;
@@ -1179,7 +1215,7 @@ void CProgressDialog::UpdateMessagesDialog()
}
-bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
+bool CProgressDialog::OnButtonClicked(unsigned buttonID, HWND buttonHWND)
{
switch (buttonID)
{
@@ -1192,24 +1228,42 @@ bool CProgressDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
End(IDCLOSE);
break;
}
+
+ if (_cancelWasPressed)
+ return true;
- bool paused = Sync.Get_Paused();
+ const bool paused = Sync.Get_Paused();
+
if (!paused)
+ {
OnPauseButton();
+ }
+
_inCancelMessageBox = true;
- int res = ::MessageBoxW(*this, LangString(IDS_PROGRESS_ASK_CANCEL), _title, MB_YESNOCANCEL);
+ const int res = ::MessageBoxW(*this, LangString(IDS_PROGRESS_ASK_CANCEL), _title, MB_YESNOCANCEL);
_inCancelMessageBox = false;
+ if (res == IDYES)
+ _cancelWasPressed = true;
+
if (!paused)
+ {
OnPauseButton();
- if (res == IDCANCEL || res == IDNO)
+ }
+
+ if (_externalCloseMessageWasReceived)
{
- if (_externalCloseMessageWasReceived)
- OnExternalCloseMessage();
+ /* we have received kCloseMessage while we were in MessageBoxW().
+ so we call OnExternalCloseMessage() here.
+ it can show MessageBox and it can close dialog */
+ OnExternalCloseMessage();
return true;
}
- _cancelWasPressed = true;
+ if (!_cancelWasPressed)
+ return true;
+
MessagesDisplayed = true;
+ // we will call Sync.Set_Stopped(true) in OnButtonClicked() : OnCancel()
break;
}
@@ -1245,11 +1299,107 @@ void CProgressDialog::ProcessWasFinished()
}
+bool CProgressDialog::OnNotify(UINT /* controlID */, LPNMHDR header)
+{
+ if (header->hwndFrom != _messageList)
+ return false;
+ switch (header->code)
+ {
+ case LVN_KEYDOWN:
+ {
+ LPNMLVKEYDOWN keyDownInfo = LPNMLVKEYDOWN(header);
+ switch (keyDownInfo->wVKey)
+ {
+ case 'A':
+ {
+ if (IsKeyDown(VK_CONTROL))
+ {
+ _messageList.SelectAll();
+ return true;
+ }
+ break;
+ }
+ case VK_INSERT:
+ case 'C':
+ {
+ if (IsKeyDown(VK_CONTROL))
+ {
+ CopyToClipboard();
+ return true;
+ }
+ break;
+ }
+ }
+ }
+ }
+ return false;
+}
+
+
+static void ListView_GetSelected(NControl::CListView &listView, CUIntVector &vector)
+{
+ vector.Clear();
+ int index = -1;
+ for (;;)
+ {
+ index = listView.GetNextSelectedItem(index);
+ if (index < 0)
+ break;
+ vector.Add((unsigned)index);
+ }
+}
+
+
+void CProgressDialog::CopyToClipboard()
+{
+ CUIntVector indexes;
+ ListView_GetSelected(_messageList, indexes);
+ UString s;
+ unsigned numIndexes = indexes.Size();
+ if (numIndexes == 0)
+ numIndexes = (unsigned)_messageList.GetItemCount();
+
+ for (unsigned i = 0; i < numIndexes; i++)
+ {
+ const unsigned index = (i < indexes.Size() ? indexes[i] : i);
+ // s.Add_UInt32(index);
+ // s += ": ";
+ s += _messageStrings[index];
+ {
+ s +=
+ #ifdef _WIN32
+ "\r\n"
+ #else
+ "\n"
+ #endif
+ ;
+ }
+ }
+
+ ClipboardSetText(*this, s);
+}
+
+
+static THREAD_FUNC_DECL MyThreadFunction(void *param)
+{
+ CProgressThreadVirt *p = (CProgressThreadVirt *)param;
+ try
+ {
+ p->Process();
+ p->ThreadFinishedOK = true;
+ }
+ catch (...) { p->Result = E_FAIL; }
+ return 0;
+}
+
+
HRESULT CProgressThreadVirt::Create(const UString &title, HWND parentWindow)
{
NWindows::CThread thread;
- RINOK(thread.Create(MyThreadFunction, this));
- ProgressDialog.Create(title, thread, parentWindow);
+ const WRes wres = thread.Create(MyThreadFunction, this);
+ if (wres != 0)
+ return HRESULT_FROM_WIN32(wres);
+ CProgressDialog::Create(title, thread, parentWindow);
return S_OK;
}
@@ -1265,7 +1415,7 @@ static void AddMessageToString(UString &dest, const UString &src)
void CProgressThreadVirt::Process()
{
- CProgressCloser closer(ProgressDialog);
+ CProgressCloser closer(*this);
UString m;
try { Result = ProcessVirt(); }
catch(const wchar_t *s) { m = s; }
@@ -1273,12 +1423,10 @@ void CProgressThreadVirt::Process()
catch(const char *s) { m = GetUnicodeString(s); }
catch(int v)
{
- wchar_t s[16];
- ConvertUInt32ToString(v, s);
- m = L"Error #";
- m += s;
+ m = "Error #";
+ m.Add_UInt32((unsigned)v);
}
- catch(...) { m = L"Error"; }
+ catch(...) { m = "Error"; }
if (Result != E_ABORT)
{
if (m.IsEmpty() && Result != S_OK)
@@ -1295,7 +1443,7 @@ void CProgressThreadVirt::Process()
}
}
- CProgressSync &sync = ProgressDialog.Sync;
+ CProgressSync &sync = Sync;
NSynchronization::CCriticalSectionLock lock(sync._cs);
if (m.IsEmpty())
{
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h
index 03f836da219..4ca9be7a40c 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2.h
@@ -1,7 +1,7 @@
// ProgressDialog2.h
-#ifndef __PROGRESS_DIALOG_2_H
-#define __PROGRESS_DIALOG_2_H
+#ifndef ZIP7_INC_PROGRESS_DIALOG_2_H
+#define ZIP7_INC_PROGRESS_DIALOG_2_H
#include "../../../Common/MyCom.h"
@@ -36,6 +36,7 @@ class CProgressSync
public:
bool _bytesProgressMode;
+ bool _isDir;
UInt64 _totalBytes;
UInt64 _completedBytes;
UInt64 _totalFiles;
@@ -46,7 +47,6 @@ public:
UString _titleFileName;
UString _status;
UString _filePath;
- bool _isDir;
UStringVector Messages;
CProgressFinalMessage FinalMessage;
@@ -96,7 +96,8 @@ public:
void AddError_Message(const wchar_t *message);
void AddError_Message_Name(const wchar_t *message, const wchar_t *name);
- void AddError_Code_Name(DWORD systemError, const wchar_t *name);
+ // void AddError_Code_Name(DWORD systemError, const wchar_t *name);
+ void AddError_Code_Name(HRESULT systemError, const wchar_t *name);
bool ThereIsMessage() const { return !Messages.IsEmpty() || FinalMessage.ThereIsMessage(); }
};
@@ -151,11 +152,12 @@ class CProgressDialog: public NWindows::NControl::CModalDialog
NWindows::NControl::CProgressBar m_ProgressBar;
NWindows::NControl::CListView _messageList;
- int _numMessages;
+ unsigned _numMessages;
+ UStringVector _messageStrings;
- #ifdef __ITaskbarList3_INTERFACE_DEFINED__
+ // #ifdef __ITaskbarList3_INTERFACE_DEFINED__
CMyComPtr<ITaskbarList3> _taskbarList;
- #endif
+ // #endif
HWND _hwndForTaskbar;
UInt32 _prevTime;
@@ -169,7 +171,9 @@ class CProgressDialog: public NWindows::NControl::CModalDialog
UInt64 _processed_Prev;
UInt64 _packed_Prev;
UInt64 _ratio_Prev;
+
UString _filesStr_Prev;
+ UString _filesTotStr_Prev;
unsigned _prevSpeed_MoveBits;
UInt64 _prevSpeed;
@@ -193,26 +197,29 @@ class CProgressDialog: public NWindows::NControl::CModalDialog
bool _externalCloseMessageWasReceived;
- #ifdef __ITaskbarList3_INTERFACE_DEFINED__
+ // #ifdef __ITaskbarList3_INTERFACE_DEFINED__
void SetTaskbarProgressState(TBPFLAG tbpFlags)
{
if (_taskbarList && _hwndForTaskbar)
_taskbarList->SetProgressState(_hwndForTaskbar, tbpFlags);
}
- #endif
+ // #endif
void SetTaskbarProgressState();
void UpdateStatInfo(bool showAll);
- bool OnTimer(WPARAM timerID, LPARAM callback);
void SetProgressRange(UInt64 range);
void SetProgressPos(UInt64 pos);
- virtual bool OnInit();
- virtual bool OnSize(WPARAM wParam, int xSize, int ySize);
- virtual void OnCancel();
- virtual void OnOK();
+ virtual bool OnTimer(WPARAM timerID, LPARAM callback) Z7_override;
+ virtual bool OnInit() Z7_override;
+ virtual bool OnSize(WPARAM wParam, int xSize, int ySize) Z7_override;
+ virtual void OnCancel() Z7_override;
+ virtual void OnOK() Z7_override;
+ virtual bool OnNotify(UINT /* controlID */, LPNMHDR header) Z7_override;
+ void CopyToClipboard();
+
NWindows::NSynchronization::CManualResetEvent _createDialogEvent;
NWindows::NSynchronization::CManualResetEvent _dialogCreatedEvent;
- #ifndef _SFX
+ #ifndef Z7_SFX
void AddToTitle(LPCWSTR string);
#endif
@@ -220,11 +227,11 @@ class CProgressDialog: public NWindows::NControl::CModalDialog
void SetPriorityText();
void OnPauseButton();
void OnPriorityButton();
- bool OnButtonClicked(int buttonID, HWND buttonHWND);
- bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam);
+ bool OnButtonClicked(unsigned buttonID, HWND buttonHWND) Z7_override;
+ bool OnMessage(UINT message, WPARAM wParam, LPARAM lParam) Z7_override;
void SetTitleText();
- void ShowSize(int id, UInt64 val, UInt64 &prev);
+ void ShowSize(unsigned id, UInt64 val, UInt64 &prev);
void UpdateMessagesDialog();
@@ -246,10 +253,10 @@ public:
int IconID;
HWND MainWindow;
- #ifndef _SFX
+ #ifndef Z7_SFX
UString MainTitle;
UString MainAddTitle;
- ~CProgressDialog();
+ ~CProgressDialog() Z7_DESTRUCTOR_override;
#endif
CProgressDialog();
@@ -259,9 +266,20 @@ public:
_dialogCreatedEvent.Lock();
}
- INT_PTR Create(const UString &title, NWindows::CThread &thread, HWND wndParent = 0);
+ INT_PTR Create(const UString &title, NWindows::CThread &thread, HWND wndParent = NULL);
+
+
+ /* how it works:
+ 1) the working thread calls ProcessWasFinished()
+ that sends kCloseMessage message to CProgressDialog (GUI) thread
+ 2) CProgressDialog (GUI) thread receives kCloseMessage message and
+ calls ProcessWasFinished_GuiVirt();
+ So we can implement ProcessWasFinished_GuiVirt() and show special
+ results window in GUI thread with CProgressDialog as parent window
+ */
void ProcessWasFinished();
+ virtual void ProcessWasFinished_GuiVirt() {}
};
@@ -273,7 +291,8 @@ public:
~CProgressCloser() { _p->ProcessWasFinished(); }
};
-class CProgressThreadVirt
+
+class CProgressThreadVirt: public CProgressDialog
{
protected:
FStringVector ErrorPaths;
@@ -281,33 +300,59 @@ protected:
// error if any of HRESULT, ErrorMessage, ErrorPath
virtual HRESULT ProcessVirt() = 0;
- void Process();
public:
HRESULT Result;
bool ThreadFinishedOK; // if there is no fatal exception
- CProgressDialog ProgressDialog;
-
- static THREAD_FUNC_DECL MyThreadFunction(void *param)
- {
- CProgressThreadVirt *p = (CProgressThreadVirt *)param;
- try
- {
- p->Process();
- p->ThreadFinishedOK = true;
- }
- catch (...) { p->Result = E_FAIL; }
- return 0;
- }
+ void Process();
void AddErrorPath(const FString &path) { ErrorPaths.Add(path); }
- HRESULT Create(const UString &title, HWND parentWindow = 0);
+ HRESULT Create(const UString &title, HWND parentWindow = NULL);
CProgressThreadVirt(): Result(E_FAIL), ThreadFinishedOK(false) {}
CProgressMessageBoxPair &GetMessagePair(bool isError) { return isError ? FinalMessage.ErrorMessage : FinalMessage.OkMessage; }
-
};
UString HResultToMessage(HRESULT errorCode);
+/*
+how it works:
+
+client code inherits CProgressThreadVirt and calls
+CProgressThreadVirt::Create()
+{
+ it creates new thread that calls CProgressThreadVirt::Process();
+ it creates modal progress dialog window with ProgressDialog.Create()
+}
+
+CProgressThreadVirt::Process()
+{
+ {
+ Result = ProcessVirt(); // virtual function that must implement real work
+ }
+ if (exceptions) or FinalMessage.ErrorMessage.Message
+ {
+ set message to ProgressDialog.Sync.FinalMessage.ErrorMessage.Message
+ }
+ else if (FinalMessage.OkMessage.Message)
+ {
+ set message to ProgressDialog.Sync.FinalMessage.OkMessage
+ }
+
+ PostMsg(kCloseMessage);
+}
+
+
+CProgressDialog::OnExternalCloseMessage()
+{
+ if (ProgressDialog.Sync.FinalMessage)
+ {
+ WorkWasFinishedVirt();
+ Show (ProgressDialog.Sync.FinalMessage)
+ MessagesDisplayed = true;
+ }
+}
+
+*/
+
#endif
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h
index b45d7b49506..736c7179a18 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2Res.h
@@ -28,6 +28,7 @@
#define IDT_PROGRESS_PACKED_VAL 110
#define IDT_PROGRESS_FILES_VAL 111
+#define IDT_PROGRESS_FILES_TOTAL 112
#define IDT_PROGRESS_ELAPSED_VAL 120
#define IDT_PROGRESS_REMAINING_VAL 121
@@ -41,7 +42,7 @@
#ifdef UNDER_CE
#define MY_PROGRESS_VAL_UNITS 44
#else
-#define MY_PROGRESS_VAL_UNITS 76
+#define MY_PROGRESS_VAL_UNITS 72
#endif
#define MY_PROGRESS_LABEL_UNITS_MIN 60
#define MY_PROGRESS_LABEL_UNITS_START 90
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc
index e9713930be1..dc7d797ff72 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/ProgressDialog2a.rc
@@ -44,30 +44,35 @@ DIALOG_ID DIALOG 0, 0, xs, ys MY_MODAL_RESIZE_DIALOG_STYLE MY_FONT
CAPTION "Progress"
{
DEFPUSHBUTTON "&Background", IDB_PROGRESS_BACKGROUND, bx3, by, bxs, bys
- PUSHBUTTON "&Pause", IDB_PAUSE bx2, by, bxs, bys
+ PUSHBUTTON "&Pause", IDB_PAUSE, bx2, by, bxs, bys
PUSHBUTTON "Cancel", IDCANCEL, bx1, by, bxs, bys
+
LTEXT "Elapsed time:", IDT_PROGRESS_ELAPSED, m, y0, x0s, 8
LTEXT "Remaining time:", IDT_PROGRESS_REMAINING, m, y1, x0s, 8
LTEXT "Files:", IDT_PROGRESS_FILES, m, y2, x0s, 8
- LTEXT "Compression ratio:", IDT_PROGRESS_RATIO, m, y3, x0s, 8
+
LTEXT "Errors:", IDT_PROGRESS_ERRORS, m, y4, x0s, 8
+
LTEXT "Total size:", IDT_PROGRESS_TOTAL, x2, y0, x2s, 8
LTEXT "Speed:", IDT_PROGRESS_SPEED, x2, y1, x2s, 8
LTEXT "Processed:", IDT_PROGRESS_PROCESSED,x2, y2, x2s, 8
LTEXT "Compressed size:" , IDT_PROGRESS_PACKED, x2, y3, x2s, 8
+ LTEXT "Compression ratio:", IDT_PROGRESS_RATIO, x2, y4, x2s, 8
+
RTEXT "", IDT_PROGRESS_ELAPSED_VAL, x1, y0, x1s, MY_TEXT_NOPREFIX
RTEXT "", IDT_PROGRESS_REMAINING_VAL, x1, y1, x1s, MY_TEXT_NOPREFIX
RTEXT "", IDT_PROGRESS_FILES_VAL, x1, y2, x1s, MY_TEXT_NOPREFIX
- RTEXT "", IDT_PROGRESS_RATIO_VAL, x1, y3, x1s, MY_TEXT_NOPREFIX
+ RTEXT "", IDT_PROGRESS_FILES_TOTAL, x1, y3, x1s, MY_TEXT_NOPREFIX
RTEXT "", IDT_PROGRESS_ERRORS_VAL, x1, y4, x1s, MY_TEXT_NOPREFIX
RTEXT "", IDT_PROGRESS_TOTAL_VAL, x3, y0, x3s, MY_TEXT_NOPREFIX
RTEXT "", IDT_PROGRESS_SPEED_VAL, x3, y1, x3s, MY_TEXT_NOPREFIX
RTEXT "", IDT_PROGRESS_PROCESSED_VAL, x3, y2, x3s, MY_TEXT_NOPREFIX
RTEXT "", IDT_PROGRESS_PACKED_VAL, x3, y3, x3s, MY_TEXT_NOPREFIX
+ RTEXT "", IDT_PROGRESS_RATIO_VAL, x3, y4, x3s, MY_TEXT_NOPREFIX
LTEXT "", IDT_PROGRESS_STATUS, m, z3, xc, MY_TEXT_NOPREFIX
CONTROL "", IDT_PROGRESS_FILE_NAME, "Static", SS_NOPREFIX | SS_LEFTNOWORDWRAP, m, z2, xc, z2s
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyName.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyName.h
index 4f0d6dc11d9..fa6e5c54050 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyName.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyName.h
@@ -1,7 +1,7 @@
// PropertyName.h
-#ifndef __PROPERTY_NAME_H
-#define __PROPERTY_NAME_H
+#ifndef ZIP7_INC_PROPERTY_NAME_H
+#define ZIP7_INC_PROPERTY_NAME_H
#include "../../../Common/MyString.h"
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h
index 67f339028fe..913887e4a42 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/PropertyNameRes.h
@@ -93,3 +93,12 @@
#define IDS_PROP_READ_ONLY 1093
#define IDS_PROP_OUT_NAME 1094
#define IDS_PROP_COPY_LINK 1095
+#define IDS_PROP_ARC_FILE_NAME 1096
+#define IDS_PROP_IS_HASH 1097
+#define IDS_PROP_CHANGE_TIME 1098
+#define IDS_PROP_USER_ID 1099
+#define IDS_PROP_GROUP_ID 1100
+#define IDS_PROP_DEVICE_MAJOR 1101
+#define IDS_PROP_DEVICE_MINOR 1102
+#define IDS_PROP_DEV_MAJOR 1103
+#define IDS_PROP_DEV_MINOR 1104
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/StdAfx.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/StdAfx.h
new file mode 100644
index 00000000000..789cc6e7403
--- /dev/null
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/StdAfx.h
@@ -0,0 +1,83 @@
+// StdAfx.h
+
+#ifndef ZIP7_INC_STDAFX_H
+#define ZIP7_INC_STDAFX_H
+
+#if defined(_MSC_VER) && _MSC_VER >= 1800
+#pragma warning(disable : 4464) // relative include path contains '..'
+#endif
+
+#include "../../../../C/Compiler.h"
+
+Z7_DIAGNOSCTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
+#ifndef _WIN32_WINNT
+// #define _WIN32_WINNT 0x0400
+#define _WIN32_WINNT 0x0500
+// #define _WIN32_WINNT 0x0600
+// #define _WIN32_WINNT 0x0A00
+#endif
+#ifndef WINVER
+#define WINVER _WIN32_WINNT
+#endif
+// #define _WIN32_IE 0x400 // for debug
+Z7_DIAGNOSCTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
+
+#include "../../../Common/Common.h"
+#include "../../../Common/MyWindows.h"
+
+#endif
+
+/*
+WINVER and _WIN32_WINNT
+
+MSVC6 / 2003sdk:
+{
+ <windows.h> doesn't set _WIN32_WINNT
+ if WINVER is not set <windows.h> sets WINVER to value:
+ 0x0400 : MSVC6
+ 0x0501 : Windows Server 2003 PSDK / 2003 R2 PSDK
+}
+
+SDK for Win7 (and later)
+{
+ <windows.h> sets _WIN32_WINNT if it's not set.
+ <windows.h> sets WINVER if it's not set.
+<windows.h> includes <sdkddkver.h> that does:
+#if !defined(_WIN32_WINNT) && !defined(_CHICAGO_)
+ #define _WIN32_WINNT 0x0601 // in win7 sdk
+ #define _WIN32_WINNT 0x0A00 // in win10 sdk
+#endif
+#ifndef WINVER
+ #ifdef _WIN32_WINNT
+ #define WINVER _WIN32_WINNT
+ else
+ #define WINVER 0x0601 // in win7 sdk
+ #define WINVER 0x0A00 // in win10 sdk
+ endif
+#endif
+}
+
+Some GUI structures defined by windows will be larger,
+If (_WIN32_WINNT) value is larger.
+
+Also if we send sizeof(win_gui_struct) to some windows function,
+and we compile that code with big (_WIN32_WINNT) value,
+the window function in old Windows can fail, if that old Windows
+doesn't understand new big version of (win_gui_struct) compiled
+with big (_WIN32_WINNT) value.
+
+So it's better to define smallest (_WIN32_WINNT) value here.
+In 7-Zip FM we use some functions that require (_WIN32_WINNT == 0x0500).
+So it's simpler to define (_WIN32_WINNT == 0x0500) here.
+If we define (_WIN32_WINNT == 0x0400) here, we need some manual
+declarations for functions and macros that require (0x0500) functions.
+Also libs must contain these (0x0500+) functions.
+
+Some code in 7-zip FM uses also CommCtrl.h structures
+that depend from (_WIN32_IE) value. But default
+(_WIN32_IE) value from <windows.h> probably is OK for us.
+So we don't set _WIN32_IE here.
+default _WIN32_IE value set by <windows.h>:
+ 0x501 2003sdk
+ 0xa00 win10 sdk
+*/
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp b/3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp
index c8ea8b95aef..1c7cab00faf 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.cpp
@@ -10,7 +10,11 @@
#include "SysIconUtils.h"
+#if defined(__MINGW32__) || defined(__MINGW64__)
+#include <shlobj.h>
+#else
#include <ShlObj.h>
+#endif
#ifndef _UNICODE
extern bool g_IsNT;
@@ -18,48 +22,55 @@ extern bool g_IsNT;
int GetIconIndexForCSIDL(int csidl)
{
- LPITEMIDLIST pidl = 0;
+ LPITEMIDLIST pidl = NULL;
SHGetSpecialFolderLocation(NULL, csidl, &pidl);
if (pidl)
{
SHFILEINFO shellInfo;
- SHGetFileInfo(LPCTSTR(pidl), FILE_ATTRIBUTE_NORMAL,
- &shellInfo, sizeof(shellInfo),
- SHGFI_PIDL | SHGFI_SYSICONINDEX);
- IMalloc *pMalloc;
+ shellInfo.iIcon = 0;
+ const DWORD_PTR res = SHGetFileInfo((LPCTSTR)(const void *)(pidl), FILE_ATTRIBUTE_NORMAL,
+ &shellInfo, sizeof(shellInfo),
+ SHGFI_PIDL | SHGFI_SYSICONINDEX);
+ /*
+ IMalloc *pMalloc;
SHGetMalloc(&pMalloc);
if (pMalloc)
{
pMalloc->Free(pidl);
pMalloc->Release();
}
- return shellInfo.iIcon;
+ */
+ // we use OLE2.dll function here
+ CoTaskMemFree(pidl);
+ if (res)
+ return shellInfo.iIcon;
}
return 0;
}
#ifndef _UNICODE
-typedef int (WINAPI * SHGetFileInfoWP)(LPCWSTR pszPath, DWORD attrib, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags);
+typedef DWORD_PTR (WINAPI * Func_SHGetFileInfoW)(LPCWSTR pszPath, DWORD attrib, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags);
-struct CSHGetFileInfoInit
+static struct C_SHGetFileInfo_Init
{
- SHGetFileInfoWP shGetFileInfoW;
- CSHGetFileInfoInit()
+ Func_SHGetFileInfoW f_SHGetFileInfoW;
+ C_SHGetFileInfo_Init()
{
- shGetFileInfoW = (SHGetFileInfoWP)
- ::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "SHGetFileInfoW");
+ f_SHGetFileInfoW = Z7_GET_PROC_ADDRESS(
+ Func_SHGetFileInfoW, ::GetModuleHandleW(L"shell32.dll"),
+ "SHGetFileInfoW");
}
-} g_SHGetFileInfoInit;
+} g_SHGetFileInfo_Init;
#endif
-static DWORD_PTR MySHGetFileInfoW(LPCWSTR pszPath, DWORD attrib, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags)
+static DWORD_PTR My_SHGetFileInfoW(LPCWSTR pszPath, DWORD attrib, SHFILEINFOW *psfi, UINT cbFileInfo, UINT uFlags)
{
#ifdef _UNICODE
return SHGetFileInfo
#else
- if (g_SHGetFileInfoInit.shGetFileInfoW == 0)
+ if (!g_SHGetFileInfo_Init.f_SHGetFileInfoW)
return 0;
- return g_SHGetFileInfoInit.shGetFileInfoW
+ return g_SHGetFileInfo_Init.f_SHGetFileInfoW
#endif
(pszPath, attrib, psfi, cbFileInfo, uFlags);
}
@@ -70,7 +81,7 @@ DWORD_PTR GetRealIconIndex(CFSTR path, DWORD attrib, int &iconIndex)
if (!g_IsNT)
{
SHFILEINFO shellInfo;
- DWORD_PTR res = ::SHGetFileInfo(fs2fas(path), FILE_ATTRIBUTE_NORMAL | attrib, &shellInfo,
+ const DWORD_PTR res = ::SHGetFileInfo(fs2fas(path), FILE_ATTRIBUTE_NORMAL | attrib, &shellInfo,
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX);
iconIndex = shellInfo.iIcon;
return res;
@@ -79,7 +90,7 @@ DWORD_PTR GetRealIconIndex(CFSTR path, DWORD attrib, int &iconIndex)
#endif
{
SHFILEINFOW shellInfo;
- DWORD_PTR res = ::MySHGetFileInfoW(fs2us(path), FILE_ATTRIBUTE_NORMAL | attrib, &shellInfo,
+ const DWORD_PTR res = ::My_SHGetFileInfoW(fs2us(path), FILE_ATTRIBUTE_NORMAL | attrib, &shellInfo,
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX);
iconIndex = shellInfo.iIcon;
return res;
@@ -106,7 +117,7 @@ DWORD_PTR GetRealIconIndex(const UString &fileName, DWORD attrib, int &iconIndex
{
SHFILEINFOW shellInfo;
shellInfo.szTypeName[0] = 0;
- DWORD_PTR res = ::MySHGetFileInfoW(fileName, FILE_ATTRIBUTE_NORMAL | attrib, &shellInfo,
+ DWORD_PTR res = ::My_SHGetFileInfoW(fileName, FILE_ATTRIBUTE_NORMAL | attrib, &shellInfo,
sizeof(shellInfo), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX | SHGFI_TYPENAME);
if (typeName)
*typeName = shellInfo.szTypeName;
@@ -116,15 +127,15 @@ DWORD_PTR GetRealIconIndex(const UString &fileName, DWORD attrib, int &iconIndex
}
*/
-static int FindInSorted_Attrib(const CRecordVector<CAttribIconPair> &vect, DWORD attrib, int &insertPos)
+static int FindInSorted_Attrib(const CRecordVector<CAttribIconPair> &vect, DWORD attrib, unsigned &insertPos)
{
unsigned left = 0, right = vect.Size();
while (left != right)
{
- unsigned mid = (left + right) / 2;
- DWORD midAttrib = vect[mid].Attrib;
+ const unsigned mid = (left + right) / 2;
+ const DWORD midAttrib = vect[mid].Attrib;
if (attrib == midAttrib)
- return mid;
+ return (int)mid;
if (attrib < midAttrib)
right = mid;
else
@@ -134,15 +145,15 @@ static int FindInSorted_Attrib(const CRecordVector<CAttribIconPair> &vect, DWORD
return -1;
}
-static int FindInSorted_Ext(const CObjectVector<CExtIconPair> &vect, const wchar_t *ext, int &insertPos)
+static int FindInSorted_Ext(const CObjectVector<CExtIconPair> &vect, const wchar_t *ext, unsigned &insertPos)
{
unsigned left = 0, right = vect.Size();
while (left != right)
{
- unsigned mid = (left + right) / 2;
- int compare = MyStringCompareNoCase(ext, vect[mid].Ext);
+ const unsigned mid = (left + right) / 2;
+ const int compare = MyStringCompareNoCase(ext, vect[mid].Ext);
if (compare == 0)
- return mid;
+ return (int)mid;
if (compare < 0)
right = mid;
else
@@ -158,11 +169,11 @@ int CExtToIconMap::GetIconIndex(DWORD attrib, const wchar_t *fileName /*, UStrin
unsigned i;
for (i = 0;; i++)
{
- wchar_t c = fileName[i];
+ const wchar_t c = fileName[i];
if (c == 0)
break;
if (c == '.')
- dotPos = i;
+ dotPos = (int)i;
}
/*
@@ -177,12 +188,12 @@ int CExtToIconMap::GetIconIndex(DWORD attrib, const wchar_t *fileName /*, UStrin
if ((attrib & FILE_ATTRIBUTE_DIRECTORY) != 0 || dotPos < 0)
{
- int insertPos = 0;
- int index = FindInSorted_Attrib(_attribMap, attrib, insertPos);
+ unsigned insertPos = 0;
+ const int index = FindInSorted_Attrib(_attribMap, attrib, insertPos);
if (index >= 0)
{
// if (typeName) *typeName = _attribMap[index].TypeName;
- return _attribMap[index].IconIndex;
+ return _attribMap[(unsigned)index].IconIndex;
}
CAttribIconPair pair;
GetRealIconIndex(
@@ -207,8 +218,8 @@ int CExtToIconMap::GetIconIndex(DWORD attrib, const wchar_t *fileName /*, UStrin
}
const wchar_t *ext = fileName + dotPos + 1;
- int insertPos = 0;
- int index = FindInSorted_Ext(_extMap, ext, insertPos);
+ unsigned insertPos = 0;
+ const int index = FindInSorted_Ext(_extMap, ext, insertPos);
if (index >= 0)
{
const CExtIconPair &pa = _extMap[index];
@@ -218,7 +229,7 @@ int CExtToIconMap::GetIconIndex(DWORD attrib, const wchar_t *fileName /*, UStrin
for (i = 0;; i++)
{
- wchar_t c = ext[i];
+ const wchar_t c = ext[i];
if (c == 0)
break;
if (c < L'0' || c > L'9')
@@ -253,3 +264,15 @@ int CExtToIconMap::GetIconIndex(DWORD attrib, const UString &fileName)
return GetIconIndex(attrib, fileName, NULL);
}
*/
+
+HIMAGELIST GetSysImageList(bool smallIcons)
+{
+ SHFILEINFO shellInfo;
+ return (HIMAGELIST)SHGetFileInfo(TEXT(""),
+ FILE_ATTRIBUTE_NORMAL |
+ FILE_ATTRIBUTE_DIRECTORY,
+ &shellInfo, sizeof(shellInfo),
+ SHGFI_USEFILEATTRIBUTES |
+ SHGFI_SYSICONINDEX |
+ (smallIcons ? SHGFI_SMALLICON : SHGFI_ICON));
+}
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h
index f1b27fa1541..1d34ef6818f 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/SysIconUtils.h
@@ -1,11 +1,11 @@
// SysIconUtils.h
-#ifndef __SYS_ICON_UTILS_H
-#define __SYS_ICON_UTILS_H
+#ifndef ZIP7_INC_SYS_ICON_UTILS_H
+#define ZIP7_INC_SYS_ICON_UTILS_H
#include "../../../Common/MyWindows.h"
-#include <commctrl.h>
+#include <CommCtrl.h>
#include "../../../Common/MyString.h"
@@ -50,13 +50,6 @@ public:
DWORD_PTR GetRealIconIndex(CFSTR path, DWORD attrib, int &iconIndex);
int GetIconIndexForCSIDL(int csidl);
-inline HIMAGELIST GetSysImageList(bool smallIcons)
-{
- SHFILEINFO shellInfo;
- return (HIMAGELIST)SHGetFileInfo(TEXT(""),
- FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY,
- &shellInfo, sizeof(shellInfo),
- SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX | (smallIcons ? SHGFI_SMALLICON : SHGFI_ICON));
-}
+HIMAGELIST GetSysImageList(bool smallIcons);
#endif
diff --git a/3rdparty/lzma/CPP/7zip/UI/FileManager/resource.h b/3rdparty/lzma/CPP/7zip/UI/FileManager/resource.h
index b7ca17f1b22..9d605c6d43a 100644
--- a/3rdparty/lzma/CPP/7zip/UI/FileManager/resource.h
+++ b/3rdparty/lzma/CPP/7zip/UI/FileManager/resource.h
@@ -26,6 +26,14 @@
#define IDM_SHA1 104
#define IDM_SHA256 105
+
+#define IDM_FILE 500
+#define IDM_EDIT 501
+#define IDM_VIEW 502
+#define IDM_FAVORITES 503
+#define IDM_TOOLS 504
+#define IDM_HELP 505
+
#define IDM_OPEN 540
#define IDM_OPEN_INSIDE 541
#define IDM_OPEN_OUTSIDE 542
@@ -47,6 +55,11 @@
#define IDM_LINK 558
#define IDM_ALT_STREAMS 559
+#define IDM_VER_EDIT 580
+#define IDM_VER_COMMIT 581
+#define IDM_VER_REVERT 582
+#define IDM_VER_DIFF 583
+
#define IDM_OPEN_INSIDE_ONE 590
#define IDM_OPEN_INSIDE_PARSER 591
@@ -85,6 +98,10 @@
#define IDM_VIEW_TOOLBARS_LARGE_BUTTONS 752
#define IDM_VIEW_TOOLBARS_SHOW_BUTTONS_TEXT 753
+#define IDM_VIEW_TIME_POPUP 760
+#define IDM_VIEW_TIME 761
+
+#define IDM_ADD_TO_FAVORITES 800
#define IDS_BOOKMARK 801
#define IDM_OPTIONS 900