mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-23 23:21:08 +01:00
Taskbar10: Various fixes for 26052+ support
This commit is contained in:
parent
438eb1d443
commit
dfe340d2f8
@ -1 +1 @@
|
||||
Subproject commit 0fbda72e30fe4b7cdb25f325a7943469c1b483f9
|
||||
Subproject commit 25b9ac6431efa6cea5461f41eae0376eb2642e26
|
@ -2525,61 +2525,97 @@ INT64 Shell_TrayWndSubclassProc(
|
||||
DWORD_PTR bIsPrimaryTaskbar
|
||||
)
|
||||
{
|
||||
if (uMsg == WM_NCDESTROY)
|
||||
switch (uMsg)
|
||||
{
|
||||
if (bIsPrimaryTaskbar)
|
||||
case WM_NCDESTROY:
|
||||
{
|
||||
UnhookWindowsHookEx(Shell_TrayWndMouseHook);
|
||||
if (bIsPrimaryTaskbar)
|
||||
{
|
||||
UnhookWindowsHookEx(Shell_TrayWndMouseHook);
|
||||
}
|
||||
RemoveWindowSubclass(hWnd, Shell_TrayWndSubclassProc, Shell_TrayWndSubclassProc);
|
||||
break;
|
||||
}
|
||||
RemoveWindowSubclass(hWnd, Shell_TrayWndSubclassProc, Shell_TrayWndSubclassProc);
|
||||
}
|
||||
else if (bOldTaskbar && !bIsPrimaryTaskbar && TaskbarCenter_ShouldCenter(dwMMOldTaskbarAl) && TaskbarCenter_ShouldStartBeCentered(dwMMOldTaskbarAl) && (uMsg == WM_NCLBUTTONDOWN || uMsg == WM_NCRBUTTONUP) && HandleTaskbarCornerInteraction(hWnd, uMsg, wParam, lParam))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (!bIsPrimaryTaskbar && uMsg == WM_CONTEXTMENU)
|
||||
{
|
||||
// Received some times when right clicking a secondary taskbar button, and it would
|
||||
// show the classic taskbar context menu but containing only "Show desktop" instead
|
||||
// of ours or a button's jump list, so we cancel it and that seems to properly invoke
|
||||
// the right menu
|
||||
return 0;
|
||||
}
|
||||
else if (!bOldTaskbar && !bIsPrimaryTaskbar && uMsg == WM_SETCURSOR)
|
||||
{
|
||||
// Received when mouse is over taskbar edge and autohide is on
|
||||
PostMessageW(hWnd, WM_ACTIVATE, WA_ACTIVE, NULL);
|
||||
}
|
||||
else if (bOldTaskbar && uMsg == WM_LBUTTONDBLCLK && bTaskbarAutohideOnDoubleClick)
|
||||
{
|
||||
ToggleTaskbarAutohide();
|
||||
return 0;
|
||||
}
|
||||
else if (uMsg == WM_HOTKEY && wParam == 500 && lParam == MAKELPARAM(MOD_WIN, 0x41) && IsWindows11())
|
||||
{
|
||||
InvokeActionCenter();
|
||||
return 0;
|
||||
/*if (lpShouldDisplayCCButton)
|
||||
case WM_NCLBUTTONDOWN:
|
||||
case WM_NCRBUTTONUP:
|
||||
{
|
||||
*lpShouldDisplayCCButton = 1;
|
||||
if (bOldTaskbar && !bIsPrimaryTaskbar && TaskbarCenter_ShouldCenter(dwMMOldTaskbarAl) && TaskbarCenter_ShouldStartBeCentered(dwMMOldTaskbarAl) && HandleTaskbarCornerInteraction(hWnd, uMsg, wParam, lParam))
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
LRESULT lRes = DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
if (lpShouldDisplayCCButton)
|
||||
case WM_CONTEXTMENU:
|
||||
{
|
||||
*lpShouldDisplayCCButton = bHideControlCenterButton;
|
||||
if (!bIsPrimaryTaskbar)
|
||||
{
|
||||
// Received some times when right clicking a secondary taskbar button, and it would
|
||||
// show the classic taskbar context menu but containing only "Show desktop" instead
|
||||
// of ours or a button's jump list, so we cancel it and that seems to properly invoke
|
||||
// the right menu
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_SETCURSOR:
|
||||
{
|
||||
if (!bOldTaskbar && !bIsPrimaryTaskbar)
|
||||
{
|
||||
// Received when mouse is over taskbar edge and autohide is on
|
||||
PostMessageW(hWnd, WM_ACTIVATE, WA_ACTIVE, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_LBUTTONDBLCLK:
|
||||
{
|
||||
if (bOldTaskbar && bTaskbarAutohideOnDoubleClick)
|
||||
{
|
||||
ToggleTaskbarAutohide();
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_HOTKEY:
|
||||
{
|
||||
if (wParam == 500 && lParam == MAKELPARAM(MOD_WIN, 'A') && global_rovi.dwBuildNumber >= 25921 && bOldTaskbar == 1)
|
||||
{
|
||||
InvokeActionCenter();
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_DISPLAYCHANGE:
|
||||
{
|
||||
if (bIsPrimaryTaskbar)
|
||||
{
|
||||
UpdateStartMenuPositioning(MAKELPARAM(TRUE, FALSE));
|
||||
}
|
||||
break;
|
||||
}
|
||||
/*case WM_PARENTNOTIFY:
|
||||
{
|
||||
if (!bOldTaskbar && wParam == WM_RBUTTONDOWN && !Shell_TrayWndMouseHook) // && !IsUndockingDisabled
|
||||
{
|
||||
DWORD dwThreadId = GetCurrentThreadId();
|
||||
Shell_TrayWndMouseHook = SetWindowsHookExW(WH_MOUSE, Shell_TrayWndMouseProc, NULL, dwThreadId);
|
||||
}
|
||||
break;
|
||||
}*/
|
||||
case WM_SETTINGCHANGE:
|
||||
{
|
||||
if (IsWindows11Version22H2OrHigher() && (*((WORD*)&(lParam)+1)) && !wcscmp(lParam, L"EnsureXAML"))
|
||||
{
|
||||
EnsureXAML();
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x558:
|
||||
{
|
||||
g_bIsDesktopRaised = (lParam & 1) == 0;
|
||||
break;
|
||||
}
|
||||
return lRes;*/
|
||||
}
|
||||
else if (bIsPrimaryTaskbar && uMsg == WM_DISPLAYCHANGE)
|
||||
{
|
||||
UpdateStartMenuPositioning(MAKELPARAM(TRUE, FALSE));
|
||||
}
|
||||
//else if (!bOldTaskbar && uMsg == WM_PARENTNOTIFY && wParam == WM_RBUTTONDOWN && !Shell_TrayWndMouseHook) // && !IsUndockingDisabled
|
||||
//{
|
||||
// DWORD dwThreadId = GetCurrentThreadId();
|
||||
// Shell_TrayWndMouseHook = SetWindowsHookExW(WH_MOUSE, Shell_TrayWndMouseProc, NULL, dwThreadId);
|
||||
//}
|
||||
else if (uMsg == RegisterWindowMessageW(L"Windows11ContextMenu_" _T(EP_CLSID)))
|
||||
|
||||
if (uMsg >= 0xC000 && uMsg <= 0xFFFF && uMsg == RegisterWindowMessageW(L"Windows11ContextMenu_" _T(EP_CLSID)))
|
||||
{
|
||||
POINT pt;
|
||||
pt.x = GET_X_LPARAM(lParam);
|
||||
@ -2726,15 +2762,7 @@ INT64 Shell_TrayWndSubclassProc(
|
||||
DestroyMenu(hMenu);
|
||||
}
|
||||
}
|
||||
else if (uMsg == 1368)
|
||||
{
|
||||
g_bIsDesktopRaised = (lParam & 1) == 0;
|
||||
}
|
||||
else if (uMsg == WM_SETTINGCHANGE && IsWindows11Version22H2OrHigher() && (*((WORD*)&(lParam)+1)) && !wcscmp(lParam, L"EnsureXAML"))
|
||||
{
|
||||
EnsureXAML();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
#endif
|
||||
@ -10130,7 +10158,9 @@ int RtlQueryFeatureConfigurationHook(UINT32 featureId, int sectionType, INT64* c
|
||||
{
|
||||
if (bOldTaskbar)
|
||||
{
|
||||
// Fixes start menu positioning when the taskbar is at the left or right side
|
||||
// This feature flag when enabled makes the flyouts disregard the left and right offsets, so that they
|
||||
// appear over the Copilot sidebar instead of beside it. Disabling this fixes start menu positioning
|
||||
// when the taskbar is at the left or right side, but it produce that aforementioned behavior.
|
||||
buffer->enabledState = FEATURE_ENABLED_STATE_DISABLED;
|
||||
}
|
||||
break;
|
||||
@ -10548,7 +10578,7 @@ BOOL Moment2PatchToastCenter(LPMODULEINFO mi)
|
||||
//
|
||||
// Pattern 2:
|
||||
// Will have a match if CToastCenterExperienceManager::ShouldShowWithinWorkArea() is inlined.
|
||||
// ```0F 10 45 ?? ?? 0F 7F 44 24 ?? 44 // movups - movdqu - cmp```
|
||||
// ```0F 10 45 ?? ?? 0F 7F 44 24 ?? 44 38 // movups - movdqu - cmp```
|
||||
// 25951.1000: 36B2C4
|
||||
//
|
||||
// Pattern 3:
|
||||
@ -10558,20 +10588,20 @@ BOOL Moment2PatchToastCenter(LPMODULEINFO mi)
|
||||
//
|
||||
// Pattern 4:
|
||||
// Same as pattern 2, but different length of the movdqu instruction.
|
||||
// ```0F 10 45 ?? ?? 0F 7F 45 ?? 44 // movups - movdqu - cmp```
|
||||
// ```0F 10 45 ?? ?? 0F 7F 45 ?? 44 38 // movups - movdqu - cmp```
|
||||
// No matches yet, just in case.
|
||||
int assignmentSize = 10;
|
||||
PBYTE rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x44\x24\x00\x48\x8B\xCF", "xxx??xxxx?xxx");
|
||||
if (!rcMonitorAssignment)
|
||||
{
|
||||
rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x44\x24\x00\x44", "xxx??xxxx?x");
|
||||
rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x44\x24\x00\x44\x38", "xxx??xxxx?xx");
|
||||
if (!rcMonitorAssignment)
|
||||
{
|
||||
assignmentSize = 9;
|
||||
rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x45\x00\x48\x8B\xCF", "xxx??xxx?xxx");
|
||||
if (!rcMonitorAssignment)
|
||||
{
|
||||
rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x45\x00\x44", "xxx??xxx?x");
|
||||
rcMonitorAssignment = FindPattern(mi->lpBaseOfDll, mi->SizeOfImage, "\x0F\x10\x45\x00\x00\x0F\x7F\x45\x00\x44\x38", "xxx??xxx?xx");
|
||||
if (!rcMonitorAssignment) return FALSE;
|
||||
}
|
||||
}
|
||||
@ -11865,22 +11895,9 @@ BOOL CrashCounterHandleEntryPoint()
|
||||
|
||||
#pragma region "Loader for alternate taskbar implementation"
|
||||
#ifdef _WIN64
|
||||
void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS)
|
||||
BOOL CheckExplorerSymbols(symbols_addr* symbols_PTRS)
|
||||
{
|
||||
if (!IsWindows11Version22H2OrHigher())
|
||||
return; // Definitely unsupported
|
||||
|
||||
if (bOldTaskbar <= 1)
|
||||
return; // Not enabled
|
||||
|
||||
const WCHAR* pszTaskbarDll = PickTaskbarDll();
|
||||
if (!pszTaskbarDll)
|
||||
{
|
||||
wprintf(L"[TB] Unsupported build\n");
|
||||
return;
|
||||
}
|
||||
|
||||
bool bAllValid = true;
|
||||
BOOL bAllValid = TRUE;
|
||||
for (SIZE_T j = 0; j < ARRAYSIZE(symbols_PTRS->explorer_PTRS); ++j)
|
||||
{
|
||||
DWORD i = symbols_PTRS->explorer_PTRS[j];
|
||||
@ -11888,10 +11905,33 @@ void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS)
|
||||
if (!bAllValid)
|
||||
break;
|
||||
}
|
||||
return bAllValid;
|
||||
}
|
||||
|
||||
if (!bAllValid)
|
||||
const WCHAR* GetTaskbarDllChecked(symbols_addr* symbols_PTRS)
|
||||
{
|
||||
if (bOldTaskbar < 2 || !IsWindows11Version22H2OrHigher())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
const WCHAR* pszTaskbarDll = PickTaskbarDll();
|
||||
if (!pszTaskbarDll)
|
||||
{
|
||||
wprintf(L"[TB] Unsupported build\n");
|
||||
return NULL;
|
||||
}
|
||||
if (!CheckExplorerSymbols(symbols_PTRS))
|
||||
{
|
||||
wprintf(L"[TB] Missing offsets\n");
|
||||
return NULL;
|
||||
}
|
||||
return pszTaskbarDll;
|
||||
}
|
||||
|
||||
void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCHAR* pszTaskbarDll)
|
||||
{
|
||||
if (!symbols_PTRS || !pszTaskbarDll)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@ -12345,6 +12385,12 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
}
|
||||
}
|
||||
|
||||
const WCHAR* pszTaskbarDll = GetTaskbarDllChecked(&symbols_PTRS);
|
||||
if (bOldTaskbar >= 2 && !pszTaskbarDll)
|
||||
{
|
||||
bOldTaskbar = 1;
|
||||
}
|
||||
|
||||
|
||||
HANDLE hUser32 = LoadLibraryW(L"user32.dll");
|
||||
CreateWindowInBand = GetProcAddress(hUser32, "CreateWindowInBand");
|
||||
@ -12685,7 +12731,7 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
#endif
|
||||
|
||||
VnPatchIAT(hTwinuiPcshell, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegGetValueW", twinuipcshell_RegGetValueW);
|
||||
PrepareAlternateTaskbarImplementation(&symbols_PTRS);
|
||||
PrepareAlternateTaskbarImplementation(&symbols_PTRS, pszTaskbarDll);
|
||||
printf("Setup twinui.pcshell functions done\n");
|
||||
|
||||
|
||||
|
@ -703,16 +703,21 @@ inline const WCHAR* PickTaskbarDll()
|
||||
return L"ep_taskbar.2.dll";
|
||||
}
|
||||
|
||||
if (b >= 25201 && b <= 25915) // Pre-reboot Dev channel until early Canary channel
|
||||
if (b >= 25201 && b <= 25915) // Pre-reboot Dev channel until early Canary channel, nuked ITrayComponentHost methods related to classic search box
|
||||
{
|
||||
return L"ep_taskbar.3.dll";
|
||||
}
|
||||
|
||||
if (b >= 25921) // Canary channel with nuked classic system tray
|
||||
if (b >= 25921 && b <= 26040) // Canary channel with nuked classic system tray
|
||||
{
|
||||
return L"ep_taskbar.4.dll";
|
||||
}
|
||||
|
||||
if (b >= 26052) // Same as 4 but with 2 new methods in ITrayComponentHost between GetTrayUI and ProgrammableTaskbarReportClick
|
||||
{
|
||||
return L"ep_taskbar.5.dll";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -440,6 +440,17 @@ BOOL DownloadResource(BOOL bInstall, LPCWSTR pwszURL, DWORD dwSize, LPCSTR chash
|
||||
return bOk;
|
||||
}
|
||||
|
||||
BOOL ProcessTaskbarDlls(BOOL bInstall, HINSTANCE hInstance, WCHAR wszPath[260], BOOL bExtractMode)
|
||||
{
|
||||
BOOL bOk = TRUE;
|
||||
LPCWSTR pwszTaskbarDllName = bExtractMode ? NULL : PickTaskbarDll();
|
||||
if (bOk) bOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.2.dll")), hInstance, IDR_EP_TASKBAR_2, wszPath, L"ep_taskbar.2.dll");
|
||||
if (bOk) bOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.3.dll")), hInstance, IDR_EP_TASKBAR_3, wszPath, L"ep_taskbar.3.dll");
|
||||
if (bOk) bOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.4.dll")), hInstance, IDR_EP_TASKBAR_4, wszPath, L"ep_taskbar.4.dll");
|
||||
if (bOk) bOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.5.dll")), hInstance, IDR_EP_TASKBAR_5, wszPath, L"ep_taskbar.5.dll");
|
||||
return bOk;
|
||||
}
|
||||
|
||||
int WINAPI wWinMain(
|
||||
_In_ HINSTANCE hInstance,
|
||||
_In_opt_ HINSTANCE hPrevInstance,
|
||||
@ -481,10 +492,8 @@ int WINAPI wWinMain(
|
||||
if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_MS_WEBVIEW2_LOADER, wszPath, L"WebView2Loader.dll");
|
||||
if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_STARTMENU, wszPath, L"wincorlib.dll");
|
||||
if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_GUI, wszPath, L"ep_gui.dll");
|
||||
if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_TASKBAR_2, wszPath, L"ep_taskbar.2.dll");
|
||||
if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_TASKBAR_3, wszPath, L"ep_taskbar.3.dll");
|
||||
if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_TASKBAR_4, wszPath, L"ep_taskbar.4.dll");
|
||||
return 0;
|
||||
if (bOk) bOk = ProcessTaskbarDlls(bInstall, hInstance, wszPath, TRUE);
|
||||
return !bOk;
|
||||
}
|
||||
|
||||
WCHAR wszOwnPath[MAX_PATH];
|
||||
@ -823,10 +832,7 @@ int WINAPI wWinMain(
|
||||
if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_EP_WEATHER_STUB, wszPath, L"ep_weather_host_stub.dll");
|
||||
if (bOk) bOk = InstallResource(bInstall, hInstance, IDR_MS_WEBVIEW2_LOADER, wszPath, L"WebView2Loader.dll");
|
||||
}
|
||||
LPCWSTR pwszTaskbarDllName = PickTaskbarDll();
|
||||
if (bOk) bOk = InstallResource(bInstall && pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.2.dll"), hInstance, IDR_EP_TASKBAR_2, wszPath, L"ep_taskbar.2.dll");
|
||||
if (bOk) bOk = InstallResource(bInstall && pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.3.dll"), hInstance, IDR_EP_TASKBAR_3, wszPath, L"ep_taskbar.3.dll");
|
||||
if (bOk) bOk = InstallResource(bInstall && pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.4.dll"), hInstance, IDR_EP_TASKBAR_4, wszPath, L"ep_taskbar.4.dll");
|
||||
if (bOk) bOk = ProcessTaskbarDlls(bInstall, hInstance, wszPath, FALSE);
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
|
@ -165,6 +165,11 @@
|
||||
<PreprocessorDefinitions>EP_TASKBAR_4_EXISTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="Exists('..\build\$(Configuration)\ep_taskbar.5.dll')">
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>EP_TASKBAR_5_EXISTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\ExplorerPatcher\utility.c" />
|
||||
<ClCompile Include="ep_setup.c" />
|
||||
|
@ -118,6 +118,10 @@ IDR_EP_TASKBAR_3 RCDATA "..\\build\\Release\\ep_taskbar.3.dll
|
||||
IDR_EP_TASKBAR_4 RCDATA "..\\build\\Release\\ep_taskbar.4.dll"
|
||||
#endif
|
||||
|
||||
#if EP_TASKBAR_5_EXISTS
|
||||
IDR_EP_TASKBAR_5 RCDATA "..\\build\\Release\\ep_taskbar.5.dll"
|
||||
#endif
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#define IDR_EP_TASKBAR_2 110
|
||||
#define IDR_EP_TASKBAR_3 111
|
||||
#define IDR_EP_TASKBAR_4 112
|
||||
#define IDR_EP_TASKBAR_5 113
|
||||
|
||||
#define IDS_SETUP_UNINSTALL_PROMPT 301
|
||||
#define IDS_SETUP_INSTALL_LOGOFF 302
|
||||
|
Loading…
Reference in New Issue
Block a user