From 9844324b5e25b6449bc9e4b2572782c1bcd8fd83 Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Thu, 4 Jul 2024 06:10:23 +0700 Subject: [PATCH 1/5] Symbols: Update explorer.exe symbols reading for 26244+ --- CHANGELOG.md | 2 +- ExplorerPatcher/dllmain.c | 67 +++++++++++++++++++++++++++++++++------ ExplorerPatcher/hooking.h | 6 ++++ ExplorerPatcher/symbols.c | 24 ++++++++------ 4 files changed, 80 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91cc369cb..c86dcc192 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ Tested on OS builds 22621.3296, 22621.3447, 22621.3527, 22635.3566, 26058.1000, ##### 3 -* All: Updated some patterns to work with 22635.3430+ (Beta) and recent 24H2 builds. (b51ef38) +* All: Updated some patterns to work with 22635.3430+ (Beta) and recent 24H2 builds. (6d22947) * This should fix the Windows 10 start menu crashing and Win+X not working on both aforementioned builds when symbols are not yet downloaded. ##### 4 diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index dc4598026..5dd58e76d 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -1861,6 +1861,18 @@ void UpdateStartMenuPositioning(LPARAM loIsShouldInitializeArray_hiIsShouldRoIni } } } + +__declspec(dllexport) unsigned __int64 FindTaskbarLayoutTokenByHMONITOR(HMONITOR hMonitor) +{ + for (DWORD i = 0; i < dwMonitorCount; i++) + { + if (hMonitorList[i].hMonitor == hMonitor) + { + return hMonitorList[i].token; + } + } + return 0; +} #else void UpdateStartMenuPositioning(LPARAM loIsShouldInitializeArray_hiIsShouldRoInitialize) {} #endif @@ -11480,10 +11492,16 @@ BOOL FixStartMenuAnimation(LPMODULEINFO mi) } // ### CStartExperienceManager::Hide() - // ``` - // 74 ?? ?? 03 00 00 00 44 88 - // ^^ Turn jz into jmp - // ``` + // * Pattern 1, mov [rbx+2A3h], r12b: + // ``` + // 74 ?? ?? 03 00 00 00 44 88 + // ^^ Turn jz into jmp + // ``` + // * Pattern 2, mov byte ptr [rbx+2A3h], 1: + // ``` + // 74 ?? ?? 03 00 00 00 C6 83 + // ^^ Turn jz into jmp + // ``` // Perform on exactly two matches PBYTE matchHideA = FindPattern( mi->lpBaseOfDll, @@ -11507,6 +11525,31 @@ BOOL FixStartMenuAnimation(LPMODULEINFO mi) } } + if (!matchHideA || !matchHideB) + { + matchHideA = FindPattern( + mi->lpBaseOfDll, + mi->SizeOfImage, + "\x74\x00\x00\x03\x00\x00\x00\xC6\x83", + "x??xxxxxx" + ); + matchHideB = NULL; + if (matchHideA) + { + printf("[SMA] matchHideA in CStartExperienceManager::Hide() = %llX\n", matchHideA - (PBYTE)mi->lpBaseOfDll); + matchHideB = FindPattern( + matchHideA + 14, + mi->SizeOfImage - (matchHideA + 14 - (PBYTE)mi->lpBaseOfDll), + "\x74\x00\x00\x03\x00\x00\x00\xC6\x83", + "x??xxxxxx" + ); + if (matchHideB) + { + printf("[SMA] matchHideB in CStartExperienceManager::Hide() = %llX\n", matchHideB - (PBYTE)mi->lpBaseOfDll); + } + } + } + if (!matchVtable || !matchSingleViewShellExperienceFields || !matchAnimationHelperFields @@ -11859,11 +11902,11 @@ const WCHAR* GetTaskbarDllChecked(symbols_addr* symbols_PTRS) return pszTaskbarDll; } -void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCHAR* pszTaskbarDll) +HMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCHAR* pszTaskbarDll) { if (!symbols_PTRS || !pszTaskbarDll) { - return; + return NULL; } wchar_t szPath[MAX_PATH]; @@ -11875,7 +11918,7 @@ void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCH if (!hMyTaskbar) { wprintf(L"[TB] '%s' not found\n", pszTaskbarDll); - return; + return NULL; } typedef DWORD (*GetVersion_t)(); @@ -11884,7 +11927,8 @@ void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCH if (version != 2) { wprintf(L"[TB] '%s' with version %d is not compatible\n", pszTaskbarDll, version); - return; + FreeLibrary(hMyTaskbar); + return NULL; } explorer_TrayUI_CreateInstanceFunc = GetProcAddress(hMyTaskbar, "EP_TrayUI_CreateInstance"); @@ -11908,6 +11952,7 @@ void PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCH } wprintf(L"[TB] Using '%s'\n", pszTaskbarDll); + return hMyTaskbar; } #endif #endif @@ -12764,7 +12809,7 @@ DWORD Inject(BOOL bIsExplorer) VnPatchIAT(hTwinuiPcshell, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegGetValueW", twinuipcshell_RegGetValueW); #if WITH_ALT_TASKBAR_IMPL - PrepareAlternateTaskbarImplementation(&symbols_PTRS, pszTaskbarDll); + HMODULE hMyTaskbar = PrepareAlternateTaskbarImplementation(&symbols_PTRS, pszTaskbarDll); #endif printf("Setup twinui.pcshell functions done\n"); @@ -13151,6 +13196,10 @@ DWORD Inject(BOOL bIsExplorer) VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "GetClientRect", TaskbarCenter_GetClientRectHook); +#if WITH_ALT_TASKBAR_IMPL + if (hMyTaskbar) + VnPatchIAT(hMyTaskbar, "USER32.dll", "GetClientRect", TaskbarCenter_GetClientRectHook); +#endif VnPatchIAT(hExplorer, "SHCORE.dll", (LPCSTR)190, TaskbarCenter_SHWindowsPolicy); printf("Initialized taskbar centering module.\n"); diff --git a/ExplorerPatcher/hooking.h b/ExplorerPatcher/hooking.h index e47dc2cdc..39e0df9e6 100644 --- a/ExplorerPatcher/hooking.h +++ b/ExplorerPatcher/hooking.h @@ -96,8 +96,14 @@ extern "C" #endif #if HOW_TO_HOOK == HOOK_WITH_FUNCHOOK +#ifdef __cplusplus +inline +#endif funchook_t* funchook; #elif HOW_TO_HOOK == HOOK_WITH_DETOURS +#ifdef __cplusplus +inline +#endif void* funchook; #endif diff --git a/ExplorerPatcher/symbols.c b/ExplorerPatcher/symbols.c index 8704a73cb..3c240fc4e 100644 --- a/ExplorerPatcher/symbols.c +++ b/ExplorerPatcher/symbols.c @@ -8,6 +8,9 @@ const char* explorer_SN[EXPLORER_SB_CNT] = { EXPLORER_SB_4, EXPLORER_SB_5 }; +const char* explorer_SN_26244[1] = { + EXPLORER_SB_4, +}; const char* twinui_pcshell_SN[TWINUI_PCSHELL_SB_CNT] = { TWINUI_PCSHELL_SB_0, TWINUI_PCSHELL_SB_1, @@ -113,16 +116,19 @@ static BOOL ProcessExplorerSymbols(const char* pszSettingsPath, DWORD* pOffsets) } printf("[Symbols] Reading symbols...\n"); - if (VnGetSymbols( - pszSettingsPath, - pOffsets, - explorer_SN, - EXPLORER_SB_CNT - )) + if (VnGetSymbols(pszSettingsPath, pOffsets, explorer_SN, ARRAYSIZE(explorer_SN)) != 0) { - printf("[Symbols] Failure in reading symbols for \"%s\".\n", explorer_sb_dll); - if (hKey) RegCloseKey(hKey); - return FALSE; + DWORD offsets26244[ARRAYSIZE(explorer_SN_26244)]; + if (VnGetSymbols(pszSettingsPath, offsets26244, explorer_SN_26244, ARRAYSIZE(explorer_SN_26244)) == 0) + { + pOffsets[4] = offsets26244[0]; + } + else + { + printf("[Symbols] Failure in reading symbols for \"%s\".\n", explorer_sb_dll); + if (hKey) RegCloseKey(hKey); + return FALSE; + } } RegSetValueExW(hKey, TEXT(EXPLORER_SB_0), 0, REG_DWORD, &pOffsets[0], sizeof(DWORD)); From 146070da76f805b3283dcb885a6274bd28d26696 Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Tue, 9 Jul 2024 07:02:16 +0700 Subject: [PATCH 2/5] Build: Include ep_taskbar in official builds --- .github/workflows/build.yml | 8 ++++++++ ExplorerPatcher/ExplorerPatcher.vcxproj | 6 ------ ExplorerPatcher/dllmain.c | 10 ---------- ExplorerPatcher/utility.h | 11 ----------- ep_setup/ep_setup.c | 2 -- ep_setup/ep_setup.vcxproj | 9 --------- ep_setup/resources/ep_setup.rc | 6 ------ 7 files changed, 8 insertions(+), 44 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd40911cb..8699cd0ff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,6 +85,14 @@ jobs: - name: Restore NuGet packages run: | nuget restore ExplorerPatcher.sln + + - name: Download ep_taskbar + uses: robinraju/release-downloader@v1 + with: + repository: ExplorerPatcher/ep_taskbar_releases + fileName: ep_taskbar.*.dll + latest: true + outputDir: build/Release - name: Build funchook shell: powershell diff --git a/ExplorerPatcher/ExplorerPatcher.vcxproj b/ExplorerPatcher/ExplorerPatcher.vcxproj index cbad6c562..b2d90270d 100644 --- a/ExplorerPatcher/ExplorerPatcher.vcxproj +++ b/ExplorerPatcher/ExplorerPatcher.vcxproj @@ -24,7 +24,6 @@ CenterTitlebarTextLibrary 10.0 ExplorerPatcher - 0 @@ -91,11 +90,6 @@ ExplorerPatcher.IA-32 $(SolutionDir)\build\$(Configuration)\ - - - WITH_ALT_TASKBAR_IMPL=1;%(PreprocessorDefinitions) - - Level3 diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index 5dd58e76d..15dcd0e95 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -11868,7 +11868,6 @@ BOOL CrashCounterHandleEntryPoint() #pragma region "Loader for alternate taskbar implementation" #ifdef _WIN64 -#if WITH_ALT_TASKBAR_IMPL BOOL CheckExplorerSymbols(symbols_addr* symbols_PTRS) { BOOL bAllValid = TRUE; @@ -11955,7 +11954,6 @@ HMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const return hMyTaskbar; } #endif -#endif #pragma endregion @@ -12446,11 +12444,7 @@ DWORD Inject(BOOL bIsExplorer) #endif } -#if WITH_ALT_TASKBAR_IMPL const WCHAR* pszTaskbarDll = GetTaskbarDllChecked(&symbols_PTRS); -#else - const WCHAR* pszTaskbarDll = NULL; -#endif if (bOldTaskbar >= 2 && !pszTaskbarDll) { bOldTaskbar = 1; @@ -12808,9 +12802,7 @@ DWORD Inject(BOOL bIsExplorer) #endif VnPatchIAT(hTwinuiPcshell, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegGetValueW", twinuipcshell_RegGetValueW); -#if WITH_ALT_TASKBAR_IMPL HMODULE hMyTaskbar = PrepareAlternateTaskbarImplementation(&symbols_PTRS, pszTaskbarDll); -#endif printf("Setup twinui.pcshell functions done\n"); @@ -13196,10 +13188,8 @@ DWORD Inject(BOOL bIsExplorer) VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "GetClientRect", TaskbarCenter_GetClientRectHook); -#if WITH_ALT_TASKBAR_IMPL if (hMyTaskbar) VnPatchIAT(hMyTaskbar, "USER32.dll", "GetClientRect", TaskbarCenter_GetClientRectHook); -#endif VnPatchIAT(hExplorer, "SHCORE.dll", (LPCSTR)190, TaskbarCenter_SHWindowsPolicy); printf("Initialized taskbar centering module.\n"); diff --git a/ExplorerPatcher/utility.h b/ExplorerPatcher/utility.h index 100327b91..671e127dd 100644 --- a/ExplorerPatcher/utility.h +++ b/ExplorerPatcher/utility.h @@ -32,10 +32,6 @@ #define WM_MSG_GUI_SECTION WM_USER + 1 #define WM_MSG_GUI_SECTION_GET 1 -#ifndef WITH_ALT_TASKBAR_IMPL -#define WITH_ALT_TASKBAR_IMPL 0 -#endif - #ifdef __cplusplus extern "C" { #endif @@ -695,7 +691,6 @@ inline BOOL IsStockWindows10TaskbarAvailable() return global_rovi.dwBuildNumber < 26002; } -#if WITH_ALT_TASKBAR_IMPL inline const WCHAR* PickTaskbarDll() { DWORD b = global_rovi.dwBuildNumber; @@ -737,12 +732,6 @@ inline BOOL DoesTaskbarDllExist() wcscat_s(szPath, MAX_PATH, pszTaskbarDll); return FileExistsW(szPath); } -#else -inline BOOL DoesTaskbarDllExist() -{ - return FALSE; -} -#endif inline void AdjustTaskbarStyleValue(DWORD* pdwValue) { diff --git a/ep_setup/ep_setup.c b/ep_setup/ep_setup.c index ceef45776..d05c670e7 100644 --- a/ep_setup/ep_setup.c +++ b/ep_setup/ep_setup.c @@ -457,13 +457,11 @@ BOOL DownloadResource(BOOL bInstall, LPCWSTR pwszURL, DWORD dwSize, LPCSTR chash void ProcessTaskbarDlls(BOOL* bInOutOk, BOOL bInstall, BOOL bExtractMode, HINSTANCE hInstance, WCHAR wszPath[260]) { -#if WITH_ALT_TASKBAR_IMPL LPCWSTR pwszTaskbarDllName = bExtractMode ? NULL : PickTaskbarDll(); if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.2.dll")), hInstance, IDR_EP_TASKBAR_2, wszPath, L"ep_taskbar.2.dll"); if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.3.dll")), hInstance, IDR_EP_TASKBAR_3, wszPath, L"ep_taskbar.3.dll"); if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.4.dll")), hInstance, IDR_EP_TASKBAR_4, wszPath, L"ep_taskbar.4.dll"); if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.5.dll")), hInstance, IDR_EP_TASKBAR_5, wszPath, L"ep_taskbar.5.dll"); -#endif } int WINAPI wWinMain( diff --git a/ep_setup/ep_setup.vcxproj b/ep_setup/ep_setup.vcxproj index 0efd94f5f..a296fa898 100644 --- a/ep_setup/ep_setup.vcxproj +++ b/ep_setup/ep_setup.vcxproj @@ -24,7 +24,6 @@ {2fd40b09-f224-4e9a-b2fe-a22b50b2debf} epsetup 10.0 - 0 @@ -87,14 +86,6 @@ false $(SolutionDir)\build\$(Configuration)\ - - - WITH_ALT_TASKBAR_IMPL=1;%(PreprocessorDefinitions) - - - WITH_ALT_TASKBAR_IMPL=1;%(PreprocessorDefinitions) - - Level3 diff --git a/ep_setup/resources/ep_setup.rc b/ep_setup/resources/ep_setup.rc index abb201517..c8261ed2d 100644 --- a/ep_setup/resources/ep_setup.rc +++ b/ep_setup/resources/ep_setup.rc @@ -106,9 +106,6 @@ IDR_EP_STARTMENU RCDATA "..\\build\\Release\\ep_startmenu.dll IDR_EP_GUI RCDATA "..\\build\\Release\\ep_gui.dll" -#ifdef WITH_ALT_TASKBAR_IMPL -#if WITH_ALT_TASKBAR_IMPL - #if EP_TASKBAR_2_EXISTS IDR_EP_TASKBAR_2 RCDATA "..\\build\\Release\\ep_taskbar.2.dll" #endif @@ -125,9 +122,6 @@ IDR_EP_TASKBAR_4 RCDATA "..\\build\\Release\\ep_taskbar.4.dll IDR_EP_TASKBAR_5 RCDATA "..\\build\\Release\\ep_taskbar.5.dll" #endif -#endif -#endif - #endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// From 0b86e55059a31e154ae6bcbdf647ad9fe6d09aaa Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Tue, 9 Jul 2024 07:07:18 +0700 Subject: [PATCH 3/5] Build: Include ep_taskbar in official builds ^2 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8699cd0ff..ce2554fdc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,7 +92,7 @@ jobs: repository: ExplorerPatcher/ep_taskbar_releases fileName: ep_taskbar.*.dll latest: true - outputDir: build/Release + out-file-path: build/Release - name: Build funchook shell: powershell From 51f06243e66728ff12afb9e9f38b3a493bea51ef Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Tue, 9 Jul 2024 10:00:25 +0700 Subject: [PATCH 4/5] Version: 22621.3810.66.1 --- CHANGELOG.md | 11 +++++++++++ ExplorerPatcher-L10N | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c86dcc192..6e1feedea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ This document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub. +## 22621.3810.66 + +##### 1 + +Tested on OS builds 19045.4598, 22621.3296, 22621.3810, 26120.961, and 26244.5000. (Note: 22621 and 22631 share the same OS files) + +* Taskbar10: Introduced a new taskbar implementation: Windows 10 (ExplorerPatcher). (146070d, 0b86e55) + * You can try this implementation out by changing the "Taskbar style" to "Windows 10 (ExplorerPatcher)". + * For now, this is **only available for builds 22621, 22631, and 22635.** Other builds will not have the option. + * Refer to [this wiki article](https://github.com/valinet/ExplorerPatcher/wiki/ExplorerPatcher's-taskbar-implementation) for more information including important ones. + ## 22621.3527.65 Tested on OS builds 22621.3296, 22621.3447, 22621.3527, 22635.3566, 26058.1000, 26120.461, and 26200.5001. (Note: 22621 and 22631 share the same OS files) diff --git a/ExplorerPatcher-L10N b/ExplorerPatcher-L10N index 6ac517280..8c0c7b41c 160000 --- a/ExplorerPatcher-L10N +++ b/ExplorerPatcher-L10N @@ -1 +1 @@ -Subproject commit 6ac51728081b41238e030bcfee3947433f150c40 +Subproject commit 8c0c7b41c8cbc61a64df529b123cf6dd0f4cb401 From 016214a3813ee225fe352af4b2d822f01e0a7cfa Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Tue, 9 Jul 2024 10:16:26 +0700 Subject: [PATCH 5/5] L10N: Fix compile --- ExplorerPatcher-L10N | 2 +- ep_gui/resources/lang/ep_gui.en-US.rc | 2 +- version.h | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ExplorerPatcher-L10N b/ExplorerPatcher-L10N index 8c0c7b41c..441d6658a 160000 --- a/ExplorerPatcher-L10N +++ b/ExplorerPatcher-L10N @@ -1 +1 @@ -Subproject commit 8c0c7b41c8cbc61a64df529b123cf6dd0f4cb401 +Subproject commit 441d6658a540fdbf44dfaad5ebe34114e5736d11 diff --git a/ep_gui/resources/lang/ep_gui.en-US.rc b/ep_gui/resources/lang/ep_gui.en-US.rc index 6485b9525..89c0a74f7 100644 --- a/ep_gui/resources/lang/ep_gui.en-US.rc +++ b/ep_gui/resources/lang/ep_gui.en-US.rc @@ -382,6 +382,7 @@ BEGIN IDS_UPDATES_POLICY_2 "Do not check for updates" IDS_UPDATES_PREFER_STAGING "Receive pre-release versions, if available (not recommended)" IDS_UPDATES_DOWNGRADES "Suggest the latest version on the server, even if it's older (not recommended)" + IDS_UPDATES_USELOCAL "Build updates locally before installing" IDS_UPDATES_UPDATESERVERS "Update servers:" IDS_UPDATES_RELEASES "Releases" IDS_UPDATES_RELEASES_PROMPT "Type a URL that serves resources adhering to GitHub's releases API. To learn how to configure your own update server, please consult the wiki." @@ -391,7 +392,6 @@ BEGIN IDS_UPDATES_INSTALL "Update program and restart File Explorer" IDS_UPDATES_CHANGES "Read about changes in the latest releases" IDS_UPDATES_LEARN "Learn more" - IDS_UPDATES_USELOCAL "Build updates locally before installing" IDS_ADV "Advanced" diff --git a/version.h b/version.h index bffa8139b..101bc10a7 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define VER_MAJOR 22621 -#define VER_MINOR 3527 -#define VER_BUILD_HI 65 -#define VER_BUILD_LO 5 +#define VER_MINOR 3810 +#define VER_BUILD_HI 66 +#define VER_BUILD_LO 1 #define VER_FLAGS VS_FF_PRERELEASE