From af3bff4b9f3da43fd14644eaf1e4885c5f196c2b Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Sun, 22 Oct 2023 16:37:02 +0700 Subject: [PATCH 1/5] Update README.md --- CHANGELOG.md | 6 +++--- README.md | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cdc27eeb..3836c2687 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,10 +15,10 @@ Note: After updating to this version, the symbols will be re-downloaded even if * Taskbar10: Fixed Control Center and Toast Center positioning on build 25951 (Canary). (dca0b3a) * Taskbar10: Fixed start menu position when the taskbar is at the left or right side on Moment 4 builds. (a57471f) * Taskbar10: Fixed the Windows 10 taskbar background patch to not crash anymore on build 25951 (Canary). (b52bd79) -* Taskbar10: Made taskbar fonts (when using classic theme mitigations) more accurate (thanks @aubymori). (8fc53a1) -* Start10: Fixed a bug where certain texts in the Windows 10 Start menu stayed in English. (c6a7d3f, ed251e9) +* Taskbar10: Made classic theme taskbar fonts more accurate. Thanks @aubymori! (8fc53a1) +* Start10: Fixed a bug where certain texts in the Windows 10 Start menu stayed in English. (655e62c, 5321766) * Start10: Properly fixed start menu showing/hiding along with its original animations on builds 22000.65+. (7e2f768) -* GUI: Fixed a bug where "Remember last used section" doesn't remember the current page after being enabled. (dcf72bb) +* GUI: Fixed a bug where "Remember last used section" doesn't remember the current page after being enabled. (11160c8) * Symbols: Reworked how symbols are managed so that symbols don't need to be successfully downloaded in succession. (8412bd6) ## 22621.2361.58 diff --git a/README.md b/README.md index 1baeb0325..36d42b5e4 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # ExplorerPatcher + +[![Join on Discord](https://discordapp.com/api/guilds/1155912047897350204/widget.png?style=shield)](https://discord.gg/gsPcfqHTD2) + This project aims to enhance the working environment on Windows. PayPal donations: [here](https://www.paypal.com/donate?business=valentingabrielradu%40gmail.com&no_recurring=0&item_name=ExplorerPatcher¤cy_code=EUR) or using e-mail address valentingabrielradu@gmail.com -Discord server: [here](https://discord.gg/gsPcfqHTD2) - [Read more](https://github.com/valinet/ExplorerPatcher/wiki) From bdc06de667b2ef774df6e94896159676193f4461 Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Tue, 24 Oct 2023 20:49:28 +0700 Subject: [PATCH 2/5] Taskbar10: Don't register the Win+X window more than once (thanks @roflcopter4) --- ExplorerPatcher/dllmain.c | 98 ++++++++++++++++++++++++--------------- ExplorerPatcher/utility.h | 4 +- 2 files changed, 62 insertions(+), 40 deletions(-) diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index 41af42f2f..48b2a5d5b 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -1247,29 +1247,32 @@ DWORD ShowLauncherTipContextMenu( offset_in_class = 8; } - WNDCLASS wc = { 0 }; - wc.style = CS_DBLCLKS; - wc.lpfnWndProc = CLauncherTipContextMenu_WndProc; - wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); - wc.hInstance = GetModuleHandle(NULL); - wc.lpszClassName = LAUNCHERTIP_CLASS_NAME; - wc.hCursor = LoadCursorW(NULL, IDC_ARROW); - RegisterClass(&wc); + static ATOM windowRegistrationAtom = 0; + if (windowRegistrationAtom == 0) + { + WNDCLASS wc = { + .style = CS_DBLCLKS, + .lpfnWndProc = CLauncherTipContextMenu_WndProc, + .hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH), + .hInstance = GetModuleHandleW(NULL), + .lpszClassName = LAUNCHERTIP_CLASS_NAME, + .hCursor = LoadCursorW(NULL, IDC_ARROW) + }; + ATOM atom = RegisterClassW(&wc); + if (atom) + windowRegistrationAtom = atom; + } hWinXWnd = CreateWindowInBand( 0, - LAUNCHERTIP_CLASS_NAME, + MAKEINTATOM(windowRegistrationAtom), 0, WS_POPUP, - 0, - 0, - 0, - 0, - 0, - 0, + 0, 0, 0, 0, + NULL, NULL, GetModuleHandle(NULL), (char*)params->_this - 0x58, - 7 + 7 // ZBID_IMMERSIVE_EDGY ); // DO NOT USE ShowWindow here; it breaks the window order // and renders the desktop toggle unusable; but leave @@ -10689,8 +10692,25 @@ static struct int startExperienceManager_bMaybeFullScreenMode; } g_SMAnimationPatchOffsets; -enum EDGEUI_TRAYSTUCKPLACE {}; -enum DWMTRANSITION_TARGET {}; +// Names are custom +enum EDGEUI_TRAYSTUCKPLACE +{ + TSP_LEFT, + TSP_TOP, + TSP_RIGHT, + TSP_BOTTOM, +}; + +// Names taken from Windows.UI.Xaml.pdb, only defining the used ones +enum DWMTRANSITION_TARGET +{ + DWMTARGET_LAUNCHERFLYOUTTOLEFT = 0x4D, + DWMTARGET_LAUNCHERFLYOUTTORIGHT = 0x4E, + DWMTARGET_LAUNCHERFLYOUTTOTOP = 0x4F, + DWMTARGET_LAUNCHERFLYOUTTOBOTTOM = 0x50, + DWMTARGET_LAUNCHERFLYOUT = 0x51, + DWMTARGET_LAUNCHERFULLSCREEN = 0x52, +}; HRESULT(*CStartExperienceManager_GetMonitorInformationFunc)(void* _this, void* experience, RECT* a3, enum EDGEUI_TRAYSTUCKPLACE* pTsp, bool* a5, RECT* a6, HMONITOR* a7); HRESULT(*CExperienceManagerAnimationHelper_BeginFunc)(void* _this, void*, enum DWMTRANSITION_TARGET, const RECT*, const RECT*, const RECT*, const RECT*, const RECT*); @@ -10713,17 +10733,17 @@ HRESULT OnViewCloakingHook(void* eventHandler, void* experience) if (FAILED(hr)) return hr; - enum DWMTRANSITION_TARGET target = 0x51; + enum DWMTRANSITION_TARGET target = DWMTARGET_LAUNCHERFLYOUT; if (*(bool*)((PBYTE)experience + 0x34)) - target = 0x52; - else if (tsp == 0) - target = 0x4D; - else if (tsp == 1) - target = 0x4F; - else if (tsp == 2) - target = 0x4E; - else if (tsp == 3) - target = 0x50; + target = DWMTARGET_LAUNCHERFULLSCREEN; + else if (tsp == TSP_LEFT) + target = DWMTARGET_LAUNCHERFLYOUTTOLEFT; + else if (tsp == TSP_TOP) + target = DWMTARGET_LAUNCHERFLYOUTTOTOP; + else if (tsp == TSP_RIGHT) + target = DWMTARGET_LAUNCHERFLYOUTTORIGHT; + else if (tsp == TSP_BOTTOM) + target = DWMTARGET_LAUNCHERFLYOUTTOBOTTOM; hr = CExperienceManagerAnimationHelper_BeginFunc( _this + g_SMAnimationPatchOffsets.startExperienceManager_closingAnimation, @@ -10741,17 +10761,19 @@ HRESULT CStartExperienceManager_GetMonitorInformationHook(void* _this, void* exp if (SUCCEEDED(hr) && *(PBYTE)_ReturnAddress() == 0x85 && *((PBYTE)_ReturnAddress() + 1) == 0xC0 && *((PBYTE)_ReturnAddress() + 2) == 0x78) { experience = (PBYTE)_this + g_SMAnimationPatchOffsets.startExperienceManager_singleViewShellExperience; - enum DWMTRANSITION_TARGET target = 0x51; + + enum DWMTRANSITION_TARGET target = DWMTARGET_LAUNCHERFLYOUT; if (*(bool*)((PBYTE)experience + 0x34)) - target = 0x52; - else if (*pTsp == 0) - target = 0x4E; - else if (*pTsp == 1) - target = 0x50; - else if (*pTsp == 2) - target = 0x4D; - else if (*pTsp == 3) - target = 0x4F; + target = DWMTARGET_LAUNCHERFULLSCREEN; + else if (*pTsp == TSP_LEFT) + target = DWMTARGET_LAUNCHERFLYOUTTORIGHT; + else if (*pTsp == TSP_TOP) + target = DWMTARGET_LAUNCHERFLYOUTTOBOTTOM; + else if (*pTsp == TSP_RIGHT) + target = DWMTARGET_LAUNCHERFLYOUTTOLEFT; + else if (*pTsp == TSP_BOTTOM) + target = DWMTARGET_LAUNCHERFLYOUTTOTOP; + CExperienceManagerAnimationHelper_BeginFunc( (PBYTE)_this + g_SMAnimationPatchOffsets.startExperienceManager_openingAnimation, *(void**)((PBYTE)experience + 0x18), // viewWrapper diff --git a/ExplorerPatcher/utility.h b/ExplorerPatcher/utility.h index 38c29bb62..095187a8d 100644 --- a/ExplorerPatcher/utility.h +++ b/ExplorerPatcher/utility.h @@ -345,7 +345,7 @@ inline LSTATUS SHRegGetValueFromHKCUHKLMWithOpt( static HWND(WINAPI* CreateWindowInBand)( _In_ DWORD dwExStyle, - _In_opt_ ATOM atom, + _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, @@ -357,7 +357,7 @@ static HWND(WINAPI* CreateWindowInBand)( _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam, DWORD band - ); +); BOOL(WINAPI* GetWindowBand)(HWND hWnd, PDWORD pdwBand); From 845d2b55c98ac4ad13fb87e760c7f5af62935263 Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Wed, 25 Oct 2023 21:25:27 +0700 Subject: [PATCH 3/5] Setup: Fixed uninstallation of EP installations that have went through upgrades before the proper Pin to Start fix --- ExplorerPatcher/symbols.c | 15 ++++++--------- ExplorerPatcher/utility.h | 2 +- ep_setup/ep_setup.c | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ExplorerPatcher/symbols.c b/ExplorerPatcher/symbols.c index 057f38863..ca47cf07f 100644 --- a/ExplorerPatcher/symbols.c +++ b/ExplorerPatcher/symbols.c @@ -556,9 +556,8 @@ LoadSymbolsResult LoadSymbols(symbols_addr* symbols_PTRS) { szStoredHash[0] = 0; dwSize = sizeof(szStoredHash); - RegQueryValueExA(hKey, "Hash", 0, NULL, szStoredHash, &dwSize); - - if (!_stricmp(szHash, szStoredHash)) + if (RegQueryValueExA(hKey, "Hash", 0, NULL, szStoredHash, &dwSize) == ERROR_SUCCESS + && !_stricmp(szHash, szStoredHash)) { dwSize = sizeof(DWORD); RegQueryValueExW(hKey, TEXT(TWINUI_PCSHELL_SB_0), 0, NULL, &symbols_PTRS->twinui_pcshell_PTRS[0], &dwSize); @@ -613,9 +612,8 @@ LoadSymbolsResult LoadSymbols(symbols_addr* symbols_PTRS) { szStoredHash[0] = 0; dwSize = sizeof(szStoredHash); - RegQueryValueExA(hKey, "Hash", 0, NULL, szStoredHash, &dwSize); - - if (!_stricmp(szHash, szStoredHash)) + if (RegQueryValueExA(hKey, "Hash", 0, NULL, szStoredHash, &dwSize) == ERROR_SUCCESS + && !_stricmp(szHash, szStoredHash)) { dwSize = sizeof(DWORD); RegQueryValueExW(hKey, TEXT(STARTDOCKED_SB_0), 0, NULL, &symbols_PTRS->startdocked_PTRS[0], &dwSize); @@ -663,9 +661,8 @@ LoadSymbolsResult LoadSymbols(symbols_addr* symbols_PTRS) { szStoredHash[0] = 0; dwSize = sizeof(szStoredHash); - RegQueryValueExA(hKey, "Hash", 0, NULL, szStoredHash, &dwSize); - - if (!_stricmp(szHash, szStoredHash)) + if (RegQueryValueExA(hKey, "Hash", 0, NULL, szStoredHash, &dwSize) == ERROR_SUCCESS + && !_stricmp(szHash, szStoredHash)) { dwSize = sizeof(DWORD); RegQueryValueExW(hKey, TEXT(STARTUI_SB_0), 0, NULL, &symbols_PTRS->startui_PTRS[0], &dwSize); diff --git a/ExplorerPatcher/utility.h b/ExplorerPatcher/utility.h index 095187a8d..3cf566397 100644 --- a/ExplorerPatcher/utility.h +++ b/ExplorerPatcher/utility.h @@ -343,7 +343,7 @@ inline LSTATUS SHRegGetValueFromHKCUHKLMWithOpt( return lRes; } -static HWND(WINAPI* CreateWindowInBand)( +HWND(WINAPI* CreateWindowInBand)( _In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, diff --git a/ep_setup/ep_setup.c b/ep_setup/ep_setup.c index e2b2c1208..dcf40369d 100644 --- a/ep_setup/ep_setup.c +++ b/ep_setup/ep_setup.c @@ -977,10 +977,20 @@ int WINAPI wWinMain( if (bOk && IsWindows11()) { GetWindowsDirectoryW(wszPath, MAX_PATH); - wcscat_s(wszPath, MAX_PATH, L"\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\en-US\\StartTileDataLegacy.dll.mui"); + wcscat_s(wszPath, MAX_PATH, L"\\SystemApps\\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\\en-US"); if (FileExistsW(wszPath)) { - bOk = DeleteFileW(wszPath); + wcscat_s(wszPath, MAX_PATH, L"\\StartTileDataLegacy.dll.mui"); + if (FileExistsW(wszPath)) + { + bOk = DeleteFileW(wszPath); + } + PathRemoveExtensionW(wszPath); + wcscat_s(wszPath, MAX_PATH, L".prev"); + if (FileExistsW(wszPath)) + { + bOk = DeleteFileW(wszPath); + } if (bOk) { GetWindowsDirectoryW(wszPath, MAX_PATH); From a7c87ce37d3f576a26a96d0158157b8a7e195f33 Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Thu, 26 Oct 2023 00:16:12 +0700 Subject: [PATCH 4/5] Setup: Fixed uninstallation of EP installations that have went through upgrades before the proper Pin to Start fix ^2 --- ep_setup/ep_setup.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ep_setup/ep_setup.c b/ep_setup/ep_setup.c index dcf40369d..7706463c0 100644 --- a/ep_setup/ep_setup.c +++ b/ep_setup/ep_setup.c @@ -985,11 +985,14 @@ int WINAPI wWinMain( { bOk = DeleteFileW(wszPath); } - PathRemoveExtensionW(wszPath); - wcscat_s(wszPath, MAX_PATH, L".prev"); - if (FileExistsW(wszPath)) + if (bOk) { - bOk = DeleteFileW(wszPath); + PathRemoveExtensionW(wszPath); + wcscat_s(wszPath, MAX_PATH, L".prev"); + if (FileExistsW(wszPath)) + { + bOk = DeleteFileW(wszPath); + } } if (bOk) { From ac268b1acbfb3833a5ace7ff5f8e7787c28ff255 Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Fri, 27 Oct 2023 02:08:05 +0700 Subject: [PATCH 5/5] Taskbar10: Partially fixed Windows 11 Start menu and Search positioning on builds 23545+ (Dev) --- CHANGELOG.md | 1 + ExplorerPatcher/StartMenu.c | 38 ++++++++++++++++++++++++++++++------- ExplorerPatcher/StartMenu.h | 31 +++++++++++++++++++++++------- 3 files changed, 56 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3836c2687..ea043aff7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Note: After updating to this version, the symbols will be re-downloaded even if * Start10: Properly fixed start menu showing/hiding along with its original animations on builds 22000.65+. (7e2f768) * GUI: Fixed a bug where "Remember last used section" doesn't remember the current page after being enabled. (11160c8) * Symbols: Reworked how symbols are managed so that symbols don't need to be successfully downloaded in succession. (8412bd6) +* Setup: Fixed uninstallation of EP installations that have went through upgrades before the proper Pin to Start fix. (845d2b5, a7c87ce) ## 22621.2361.58 diff --git a/ExplorerPatcher/StartMenu.c b/ExplorerPatcher/StartMenu.c index a0f16912a..2e4597f5e 100644 --- a/ExplorerPatcher/StartMenu.c +++ b/ExplorerPatcher/StartMenu.c @@ -677,6 +677,7 @@ BOOL NeedsRo_PositionStartMenuForMonitor( //hr = (*(HRESULT(**)(INT64, INT64*))(*(INT64*)pTaskbarLayoutFactory + 48))(pTaskbarLayoutFactory, &v12); hr = pTaskbarLayoutFactory->lpVtbl->get_Current(pTaskbarLayoutFactory, &pTaskbarLayout); } + int interfaceVersion = 1; if (SUCCEEDED(hr)) { /*hr = (**(HRESULT(***)(INT64, GUID*, INT64*))v12)( @@ -689,6 +690,15 @@ BOOL NeedsRo_PositionStartMenuForMonitor( &IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager, &pTaskbarLayoutManager ); + if (hr == E_NOINTERFACE) + { + interfaceVersion = 2; + hr = pTaskbarLayout->lpVtbl->QueryInterface( + pTaskbarLayout, + &IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager2, + &pTaskbarLayoutManager + ); + } } if (SUCCEEDED(hr)) { @@ -714,12 +724,26 @@ BOOL NeedsRo_PositionStartMenuForMonitor( if (data->operation == STARTMENU_POSITIONING_OPERATION_ADD) { - hr = pTaskbarLayoutManager->lpVtbl->ReportMonitorAdded( - pTaskbarLayoutManager, - hMonitor, - &instanceof_WindowsUdk_UI_Shell_ITaskbarSettings, - NULL - ); + if (interfaceVersion == 1) + { + hr = pTaskbarLayoutManager->lpVtbl->ReportMonitorAdded( + pTaskbarLayoutManager, + hMonitor, + &instanceof_WindowsUdk_UI_Shell_ITaskbarSettings, + NULL + ); + } + else + { + unsigned __int64 result = 0; + hr = pTaskbarLayoutManager->lpVtbl->ReportMonitorAdded2( + pTaskbarLayoutManager, + hMonitor, + &instanceof_WindowsUdk_UI_Shell_ITaskbarSettings, + NULL, + &result + ); + } data->pMonitorList[InterlockedIncrement(data->pMonitorCount) - 1] = hMonitor; printf("[Positioning] Added settings for monitor %p : %d\n", hMonitor, data->location); } @@ -729,7 +753,7 @@ BOOL NeedsRo_PositionStartMenuForMonitor( pTaskbarLayoutManager, hMonitor, &instanceof_WindowsUdk_UI_Shell_ITaskbarSettings - ); + ); // TODO Doesn't work when the 2nd interface is used. Needs further investigation printf("[Positioning] Changed settings for monitor: %p : %d\n", hMonitor, data->location); } else if (data->operation == STARTMENU_POSITIONING_OPERATION_REMOVE) diff --git a/ExplorerPatcher/StartMenu.h b/ExplorerPatcher/StartMenu.h index 87869f36c..8ecbe807f 100644 --- a/ExplorerPatcher/StartMenu.h +++ b/ExplorerPatcher/StartMenu.h @@ -291,9 +291,16 @@ interface WindowsUdk_UI_Shell_TaskbarLayoutStatics // : IInspectable }; DEFINE_GUID(IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager, - 0x4FB10D7C4, + 0xFB10D7C4, 0x4F7F, 0x5DE5, 0xA5, 0x28, - 0x7e, 0xfe, 0xf4, 0x18, 0xaa, 0x48 + 0x7E, 0xFE, 0xF4, 0x18, 0xAA, 0x48 +); + +// Used in 23545+ (or maybe couple lower builds too). Still named ITaskbarLayoutManager but has different ReportMonitorAdded signature. +DEFINE_GUID(IID_WindowsUdk_UI_Shell_ITaskbarLayoutManager2, + 0x98F82ED2, + 0x4791, 0x58A0, 0x8D, 0x2F, + 0xDA, 0xBD, 0x7A, 0x2F, 0x18, 0x9F ); typedef struct WindowsUdk_UI_Shell_TaskbarLayoutManagerVtbl // : IInspectableVtbl @@ -325,11 +332,21 @@ typedef struct WindowsUdk_UI_Shell_TaskbarLayoutManagerVtbl // : IInspectableVtb __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This, /* [out] */ __RPC__out TrustLevel* trustLevel); - HRESULT(STDMETHODCALLTYPE* ReportMonitorAdded)( - __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This, - __RPC__in HMONITOR hMonitor, - __RPC__in void* _instance_of_winrt_WindowsUdk_UI_Shell_ITaskbarSettings, - __RPC__in LPRECT _unknown_lpGeometry); + union + { + HRESULT(STDMETHODCALLTYPE* ReportMonitorAdded)( + __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This, + __RPC__in HMONITOR hMonitor, + __RPC__in void* _instance_of_winrt_WindowsUdk_UI_Shell_ITaskbarSettings, + __RPC__in void* _unknown_shellViewToRectMap); + + HRESULT(STDMETHODCALLTYPE* ReportMonitorAdded2)( + __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This, + __RPC__in HMONITOR hMonitor, + __RPC__in void* _instance_of_winrt_WindowsUdk_UI_Shell_ITaskbarSettings, + __RPC__in void* _unknown_shellViewToRectMap, + /* [out] */ __RPC__out unsigned __int64* result); + }; HRESULT(STDMETHODCALLTYPE* ReportMonitorRemoved)( __RPC__in WindowsUdk_UI_Shell_TaskbarLayoutManager* This,