From 3bbd227c6ae4a22f8ce8f7435b28ed258ae8eec1 Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Thu, 18 Nov 2021 20:17:19 +0200 Subject: [PATCH] Preserve taskbar toolbar layouts --- CHANGELOG.md | 1 + ExplorerPatcher/dllmain.c | 15 +++++++++++++++ version.h | 6 +++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ca079f..5b09cb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Tested on build 22000.318 and 22000.346 (currently in Windows Insider beta and r * `ep_setup /extract` - extracts `ExplorerPatcher.IA-32.dll` and `ExplorerPatcher.amd64.dll` to current directory * `ep-setup /extract test` - extracts to `test` folder in current directory * `ep-setup /extract "C:\test with space"` - extracts to `C:\test with space` directory +* Taskbar toolbar layouts are preserved when switching between Windows 10 and Windows 11 taskbars and in general (these will be reset when installing this update but should be subsequently remembered) (#395) (.2) #### Feature enhancements diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index 7714f2e..85a549d 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -4622,6 +4622,20 @@ LSTATUS explorer_SHGetValueW(HKEY a1, const WCHAR* a2, const WCHAR* a3, DWORD* a return SHGetValueW(a1, v10, a3, a4, a5, a6); } +LSTATUS explorer_OpenRegStream(HKEY hkey, PCWSTR pszSubkey, PCWSTR pszValue, DWORD grfMode) +{ + DWORD flOldProtect[6]; + + if (!lstrcmpiW(pszValue, L"TaskbarWinXP") + && VirtualProtect(pszValue, 0xC8ui64, 0x40u, flOldProtect)) + { + lstrcpyW(pszValue, L"TaskbarWinEP"); + VirtualProtect(pszValue, 0xC8ui64, flOldProtect[0], flOldProtect); + } + + return OpenRegStream(hkey, pszSubkey, pszValue, grfMode); +} + LSTATUS explorer_RegOpenKeyExW(HKEY a1, WCHAR* a2, DWORD a3, REGSAM a4, HKEY* a5) { DWORD flOldProtect[6]; @@ -5249,6 +5263,7 @@ DWORD Inject(BOOL bIsExplorer) VnPatchIAT(hExplorer, "user32.dll", "LoadMenuW", explorer_LoadMenuW); } VnPatchIAT(hExplorer, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegOpenKeyExW", explorer_RegOpenKeyExW); + VnPatchIAT(hExplorer, "shell32.dll", (LPCSTR)85, explorer_OpenRegStream); VnPatchIAT(hExplorer, "user32.dll", "TrackPopupMenuEx", explorer_TrackPopupMenuExHook); if (bClassicThemeMitigations) { diff --git a/version.h b/version.h index c51d5a4..d949be9 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define VER_MAJOR 22000 #define VER_MINOR 318 #define VER_BUILD_HI 38 -#define VER_BUILD_LO 1 +#define VER_BUILD_LO 2 #define VER_FLAGS VS_FF_PRERELEASE @@ -12,5 +12,5 @@ #define VER_STR(arg) #arg // The String form of the version numbers -#define VER_FILE_STRING VALUE "FileVersion", "22000.318.38.1" -#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.318.38.1" +#define VER_FILE_STRING VALUE "FileVersion", "22000.318.38.2" +#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.318.38.2"