Skip to content

Commit 6874ea0

Browse files
authored
Merge pull request #9 from valinet/master
update: 22621.1992.56.3
2 parents 0eab830 + 5bda71f commit 6874ea0

File tree

5 files changed

+81
-22
lines changed

5 files changed

+81
-22
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
This document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub.
44

5+
## 22621.1992.56
6+
7+
Tested on OS build 22621.1992. Installer requires Internet connectivity.
8+
9+
#### Details
10+
11+
##### 1
12+
13+
* Windows 10 Start menu: Fixed a bug that prevented the menu from working on OS builds 22621.1413 and newer (46c5041). Please read these important notes regarding the fix [here](https://github.com/valinet/ExplorerPatcher/discussions/1679).
14+
15+
##### 2
16+
17+
* Windows 10 Start menu: Fixed a bug that prevented centering on Windows 10 (275a91f).
18+
19+
##### 3
20+
21+
* Windows 10 taskbar: Correct centering of taskbar items when search box is enabled in Windows 10 (2e43c67).
22+
523
## 22621.1555.55
624

725
Tested on OS build 22621.1555. Installer requires Internet connectivity.

ExplorerPatcher/TaskbarCenter.c

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ extern HWND PeopleButton_LastHWND;
66
extern DWORD dwWeatherToLeft;
77
extern DWORD dwOldTaskbarAl;
88
extern DWORD dwMMOldTaskbarAl;
9+
extern DWORD dwSearchboxTaskbarMode;
910
extern wchar_t* EP_TASKBAR_LENGTH_PROP_NAME;
1011
#define EP_TASKBAR_LENGTH_TOO_SMALL 20
1112
BOOL bTaskbarCenterHasPatchedSHWindowsPolicy = FALSE;
@@ -144,9 +145,11 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
144145
{
145146
GetClientRect(hWndStart, &rcStart);
146147
HWND hTrayButton = NULL;
147-
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
148+
wchar_t* pCn = L"TrayButton";
149+
if (!IsWindows11() && dwSearchboxTaskbarMode == 2) pCn = L"TrayDummySearchControl";
150+
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, NULL))
148151
{
149-
if (!IsWindowVisible(hTrayButton)) continue;
152+
if (pCn == L"TrayButton" && !IsWindowVisible(hTrayButton)) continue;
150153
RECT rcTrayButton;
151154
GetClientRect(hTrayButton, &rcTrayButton);
152155
if (bIsTaskbarHorizontal)
@@ -157,6 +160,10 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
157160
{
158161
rcStart.bottom += (rcTrayButton.bottom - rcTrayButton.top);
159162
}
163+
if (pCn == L"TrayDummySearchControl") {
164+
pCn = L"TrayButton";
165+
hTrayButton = NULL;
166+
}
160167
}
161168
}
162169
RECT rc;
@@ -180,13 +187,19 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
180187
GetClientRect(hWndStart, &rcTrayButton);
181188
DWORD dwDim = (rcTrayButton.right - rcTrayButton.left);
182189
HWND hTrayButton = NULL;
183-
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
190+
wchar_t* pCn = L"TrayButton";
191+
if (!IsWindows11() && dwSearchboxTaskbarMode == 2) pCn = L"TrayDummySearchControl";
192+
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, NULL))
184193
{
185-
if (!IsWindowVisible(hTrayButton)) continue;
194+
if (pCn == L"TrayButton" && !IsWindowVisible(hTrayButton)) continue;
186195
GetClientRect(hTrayButton, &rcTrayButton);
187196
MoveWindow(hTrayButton, ((mi.rcMonitor.right - mi.rcMonitor.left) - (rcStart.right - rcStart.left)) / 2 + dwDim, rcStart.top, rcTrayButton.right, rcTrayButton.bottom, TRUE);
188197
if (!bIsPrimaryTaskbar) InvalidateRect(hTrayButton, NULL, TRUE);
189198
dwDim += (rcTrayButton.right - rcTrayButton.left);
199+
if (pCn == L"TrayDummySearchControl") {
200+
pCn = L"TrayButton";
201+
hTrayButton = NULL;
202+
}
190203
}
191204
}
192205
else
@@ -196,13 +209,19 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
196209
GetClientRect(hWndStart, &rcTrayButton);
197210
DWORD dwDim = (rcTrayButton.bottom - rcTrayButton.top);
198211
HWND hTrayButton = NULL;
199-
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
212+
wchar_t* pCn = L"TrayButton";
213+
if (!IsWindows11() && dwSearchboxTaskbarMode == 2) pCn = L"TrayDummySearchControl";
214+
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, NULL))
200215
{
201-
if (!IsWindowVisible(hTrayButton)) continue;
216+
if (pCn == L"TrayButton" && !IsWindowVisible(hTrayButton)) continue;
202217
GetClientRect(hTrayButton, &rcTrayButton);
203218
MoveWindow(hTrayButton, rcStart.left, ((mi.rcMonitor.bottom - mi.rcMonitor.top) - (rcStart.bottom - rcStart.top)) / 2 + dwDim, rcTrayButton.right, rcTrayButton.bottom, TRUE);
204219
InvalidateRect(hTrayButton, NULL, TRUE);
205220
dwDim += (rcTrayButton.bottom - rcTrayButton.top);
221+
if (pCn == L"TrayDummySearchControl") {
222+
pCn = L"TrayButton";
223+
hTrayButton = NULL;
224+
}
206225
}
207226
}
208227
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
@@ -310,13 +329,19 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
310329
GetClientRect(hWndStart, &rcTrayButton);
311330
DWORD dwDim = (rcTrayButton.right - rcTrayButton.left);
312331
HWND hTrayButton = NULL;
313-
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
332+
wchar_t* pCn = L"TrayButton";
333+
if (!IsWindows11() && dwSearchboxTaskbarMode == 2) pCn = L"TrayDummySearchControl";
334+
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, NULL))
314335
{
315-
if (!IsWindowVisible(hTrayButton)) continue;
336+
if (pCn == L"TrayButton" && !IsWindowVisible(hTrayButton)) continue;
316337
GetClientRect(hTrayButton, &rcTrayButton);
317338
MoveWindow(hTrayButton, (rc.left - mi.rcMonitor.left) + lpRect->left - (rcStart.right - rcStart.left) + dwDim, rcStart.top, rcTrayButton.right, rcTrayButton.bottom, TRUE);
318339
if (!bIsPrimaryTaskbar) InvalidateRect(hTrayButton, NULL, TRUE);
319340
dwDim += (rcTrayButton.right - rcTrayButton.left);
341+
if (pCn == L"TrayDummySearchControl") {
342+
pCn = L"TrayButton";
343+
hTrayButton = NULL;
344+
}
320345
}
321346
}
322347
else
@@ -326,13 +351,19 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
326351
GetClientRect(hWndStart, &rcTrayButton);
327352
DWORD dwDim = (rcTrayButton.bottom - rcTrayButton.top);
328353
HWND hTrayButton = NULL;
329-
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
354+
wchar_t* pCn = L"TrayButton";
355+
if (!IsWindows11() && dwSearchboxTaskbarMode == 2) pCn = L"TrayDummySearchControl";
356+
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, NULL))
330357
{
331-
if (!IsWindowVisible(hTrayButton)) continue;
358+
if (pCn == L"TrayButton" && !IsWindowVisible(hTrayButton)) continue;
332359
GetClientRect(hTrayButton, &rcTrayButton);
333360
MoveWindow(hTrayButton, rcStart.left, (rc.top - mi.rcMonitor.top) + lpRect->top - (rcStart.bottom - rcStart.top) + dwDim, rcTrayButton.right, rcTrayButton.bottom, TRUE);
334361
InvalidateRect(hTrayButton, NULL, TRUE);
335362
dwDim += (rcTrayButton.bottom - rcTrayButton.top);
363+
if (pCn == L"TrayDummySearchControl") {
364+
pCn = L"TrayButton";
365+
hTrayButton = NULL;
366+
}
336367
}
337368
}
338369
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
@@ -442,9 +473,11 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
442473
GetClientRect(hWndStart, &rcTrayButton);
443474
DWORD dwDim = bIsTaskbarHorizontal ? (rcTrayButton.right - rcTrayButton.left) : (rcTrayButton.bottom - rcTrayButton.top);
444475
HWND hTrayButton = NULL;
445-
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
476+
wchar_t* pCn = L"TrayButton";
477+
if (!IsWindows11() && dwSearchboxTaskbarMode == 2) pCn = L"TrayDummySearchControl";
478+
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, NULL))
446479
{
447-
if (!IsWindowVisible(hTrayButton)) continue;
480+
if (pCn == L"TrayButton" && !IsWindowVisible(hTrayButton)) continue;
448481
GetClientRect(hTrayButton, &rcTrayButton);
449482
if (bIsTaskbarHorizontal)
450483
{
@@ -456,6 +489,10 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
456489
}
457490
if (!bIsPrimaryTaskbar || !bIsTaskbarHorizontal) InvalidateRect(hTrayButton, NULL, TRUE);
458491
dwDim += bIsTaskbarHorizontal ? (rcTrayButton.right - rcTrayButton.left) : (rcTrayButton.bottom - rcTrayButton.top);
492+
if (pCn == L"TrayDummySearchControl") {
493+
pCn = L"TrayButton";
494+
hTrayButton = NULL;
495+
}
459496
}
460497
}
461498
}

ExplorerPatcher/dllmain.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9246,19 +9246,20 @@ HMODULE patched_LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlag
92469246
if (IsWindows11Version22H2Build1413OrHigher()) return LoadLibraryExW(lpLibFileName, hFile, dwFlags);
92479247
WCHAR path[MAX_PATH];
92489248
GetSystemDirectoryW(path, MAX_PATH);
9249-
wcscat_s(path, MAX_PATH, L"\\StartTileData.dll");
9249+
wcscat_s(path, MAX_PATH, L"\\AppResolver.dll");
92509250
if (!_wcsicmp(path, lpLibFileName))
92519251
{
92529252
GetWindowsDirectoryW(path, MAX_PATH);
9253-
wcscat_s(path, MAX_PATH, L"\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\StartTileDataLegacy.dll");
9253+
wcscat_s(path, MAX_PATH, L"\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\AppResolverLegacy.dll");
92549254
return LoadLibraryExW(path, hFile, dwFlags);
92559255
}
9256+
if (IsWindows11Version22H2Build1413OrHigher()) return LoadLibraryExW(lpLibFileName, hFile, dwFlags);
92569257
GetSystemDirectoryW(path, MAX_PATH);
9257-
wcscat_s(path, MAX_PATH, L"\\AppResolver.dll");
9258+
wcscat_s(path, MAX_PATH, L"\\StartTileData.dll");
92589259
if (!_wcsicmp(path, lpLibFileName))
92599260
{
92609261
GetWindowsDirectoryW(path, MAX_PATH);
9261-
wcscat_s(path, MAX_PATH, L"\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\AppResolverLegacy.dll");
9262+
wcscat_s(path, MAX_PATH, L"\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\StartTileDataLegacy.dll");
92629263
return LoadLibraryExW(path, hFile, dwFlags);
92639264
}
92649265
return LoadLibraryExW(lpLibFileName, hFile, dwFlags);
@@ -11041,7 +11042,8 @@ void StartMenu_LoadSettings(BOOL bRestartIfChanged)
1104111042
if (hKey)
1104211043
{
1104311044
dwSize = sizeof(DWORD);
11044-
dwVal = 0;
11045+
if (IsWindows11()) dwVal = 0;
11046+
else dwVal = 1;
1104511047
RegQueryValueExW(
1104611048
hKey,
1104711049
TEXT("Start_ShowClassicMode"),

ExplorerPatcher/settings.reg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@
327327
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_NoStartMenuMorePrograms"=dword:00000000
328328
;u 通过资源管理器向Windows10开始菜单添加磁贴
329329
;pin_tiles
330+
;y IMPORTANT, MUST READ: Notice regarding this feature (online)
331+
;https://github.com/valinet/ExplorerPatcher/discussions/1679
330332
;g StartMenu_Windows10
331333

332334

version.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#define VER_MAJOR 22621
2-
#define VER_MINOR 1555
3-
#define VER_BUILD_HI 55
4-
#define VER_BUILD_LO 2
2+
#define VER_MINOR 1992
3+
#define VER_BUILD_HI 56
4+
#define VER_BUILD_LO 3
55
#define VER_FLAGS VS_FF_PRERELEASE
66

77

@@ -12,5 +12,5 @@
1212
#define VER_STR(arg) #arg
1313

1414
// The String form of the version numbers
15-
#define VER_FILE_STRING VALUE "FileVersion", "22621.1555.55.2"
16-
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22621.1555.55.2"
15+
#define VER_FILE_STRING VALUE "FileVersion", "22621.1992.56.3"
16+
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22621.1992.56.3"

0 commit comments

Comments
 (0)