Skip to content

Commit a076253

Browse files
committed
Fix issue #3000: Shell extension performance issue
1 parent cbec710 commit a076253

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

DownloadDeps.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ if not %ERRORLEVEL% == 0 (
1111
set downloadsdir=%~dp0\build\WinMergeDownloadDeps
1212
set urls_destdirs=^
1313
https://github.com/WinMerge/winmerge/releases/download/winmerge_manual_another_build_tools_v2/winmerge_manual_another_build_tools_v2.zip!Docs\Manual\Tools ^
14-
https://github.com/WinMerge/winmerge/releases/download/ShellExtension-1.18.7.0/ShellExtension-1.18.7.0.zip!Build ^
14+
https://github.com/WinMerge/winmerge/releases/download/ShellExtension-1.18.8.0/ShellExtension-1.18.8.0.zip!Build ^
1515
https://github.com/WinMerge/winmerge/releases/download/Merge7z2501.0/Merge7z2501.0-x86.zip!Build\x86\Release ^
1616
https://github.com/WinMerge/winmerge/releases/download/Merge7z2501.0/Merge7z2501.0-x64.zip!Build\X64\Release ^
1717
https://github.com/WinMerge/winmerge/releases/download/Merge7z2501.0/Merge7z2501.0-ARM.zip!Build\ARM64\Release ^

ShellExtension/ShellExtension/ShellExtension.rc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ END
5353
//
5454

5555
VS_VERSION_INFO VERSIONINFO
56-
FILEVERSION 1,18,7,0
57-
PRODUCTVERSION 1,18,7,0
56+
FILEVERSION 1,18,8,0
57+
PRODUCTVERSION 1,18,8,0
5858
FILEFLAGSMASK 0x3fL
5959
#ifdef _DEBUG
6060
FILEFLAGS 0x1L
@@ -71,12 +71,12 @@ BEGIN
7171
BEGIN
7272
VALUE "CompanyName", "https://winmerge.org"
7373
VALUE "FileDescription", "WinMerge Shell Integration library"
74-
VALUE "FileVersion", "1.18.7.0"
74+
VALUE "FileVersion", "1.18.8.0"
7575
VALUE "InternalName", "ShellExtension"
76-
VALUE "LegalCopyright", "Copyright 2003-2023"
76+
VALUE "LegalCopyright", "Copyright 2003-2025"
7777
VALUE "OriginalFilename", "ShellExtension.DLL"
7878
VALUE "ProductName", "WinMerge Shell Integration library"
79-
VALUE "ProductVersion", "1.18.7.0"
79+
VALUE "ProductVersion", "1.18.8.0"
8080
END
8181
END
8282
BLOCK "VarFileInfo"

ShellExtension/ShellExtension/WinMergeShell.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include "../Common/WinMergeContextMenu.h"
4444
#include <sys/types.h>
4545
#include <sys/stat.h>
46+
#include <algorithm>
4647

4748
OBJECT_ENTRY_AUTO(CLSID_WinMergeShell, CWinMergeShell)
4849

@@ -182,8 +183,11 @@ HRESULT CWinMergeShell::Initialize(LPCITEMIDLIST pidlFolder,
182183

183184
hr = S_OK;
184185

186+
/// Max. filecount to select
187+
constexpr unsigned MaxFileCount = 3u;
188+
185189
// Get all file names.
186-
for (UINT x = 0 ; x < uNumFilesDropped; x++)
190+
for (UINT x = 0 ; x < (std::min)(MaxFileCount + 1, uNumFilesDropped); x++)
187191
{
188192
// Get the number of bytes required by the file's full pathname
189193
UINT wPathnameSize = DragQueryFile(hDropInfo, x, NULL, 0);

ShellExtension/WinMergeContextMenu/WinMergeContextMenu.rc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ END
4545
//
4646

4747
VS_VERSION_INFO VERSIONINFO
48-
FILEVERSION 1,0,6,0
49-
PRODUCTVERSION 1,0,6,0
48+
FILEVERSION 1,0,7,0
49+
PRODUCTVERSION 1,0,7,0
5050
FILEFLAGSMASK 0x3fL
5151
#ifdef _DEBUG
5252
FILEFLAGS 0x1L
@@ -63,12 +63,12 @@ BEGIN
6363
BEGIN
6464
VALUE "CompanyName", "https://winmerge.org"
6565
VALUE "FileDescription", "WinMerge Shell Integration library"
66-
VALUE "FileVersion", "1.0.6.0"
66+
VALUE "FileVersion", "1.0.7.0"
6767
VALUE "InternalName", "WinMergeContextMenu"
68-
VALUE "LegalCopyright", "Copyright 2021-2023"
68+
VALUE "LegalCopyright", "Copyright 2021-2025"
6969
VALUE "OriginalFilename", "WinMergeContextMenu.dll"
7070
VALUE "ProductName", "WinMerge Shell Integration library"
71-
VALUE "ProductVersion", "1.0.6.0"
71+
VALUE "ProductVersion", "1.0.7.0"
7272
END
7373
END
7474
BLOCK "VarFileInfo"

ShellExtension/WinMergeContextMenu/dllmain.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <vector>
1313
#include <sstream>
1414
#include <memory>
15+
#include <algorithm>
1516
#include <Shlwapi.h>
1617
#include <ExDisp.h>
1718
#include <ShlObj.h>
@@ -164,8 +165,10 @@ class WinMergeExplorerCommandBase : public RuntimeClass<RuntimeClassFlags<WinRtC
164165
}
165166
else
166167
{
168+
/// Max. filecount to select
169+
constexpr DWORD MaxFileCount = 3u;
167170
selection->GetCount(&dwNumItems);
168-
for (DWORD i = 0; i < dwNumItems; ++i)
171+
for (DWORD i = 0; i < (std::min)(MaxFileCount + 1, dwNumItems); ++i)
169172
{
170173
ComPtr<IShellItem> psi;
171174
wil::unique_cotaskmem_string pszFilePath;

0 commit comments

Comments
 (0)