From 98cb7a6a2e8642ed9662f0a4fe97e05cc1e2d1c2 Mon Sep 17 00:00:00 2001 From: Anixx Date: Sat, 17 Aug 2024 23:56:15 +0300 Subject: [PATCH 1/2] Update classic-taskbar-buttons-lite.wh.cpp Fix for artefacts --- mods/classic-taskbar-buttons-lite.wh.cpp | 37 +++++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/mods/classic-taskbar-buttons-lite.wh.cpp b/mods/classic-taskbar-buttons-lite.wh.cpp index 9c631b706..75cec0e82 100644 --- a/mods/classic-taskbar-buttons-lite.wh.cpp +++ b/mods/classic-taskbar-buttons-lite.wh.cpp @@ -2,7 +2,7 @@ // @id classic-taskbar-buttons-lite // @name Classic Taskbar 3D buttons Lite // @description Lightweight mod, restoring the 3D buttons in classic theme -// @version 1.2 +// @version 1.3 // @author Anixx // @github https://github.com/Anixx // @include explorer.exe @@ -61,9 +61,6 @@ void CALCON CTaskBtnGroup__DrawBar_hook( { uState |= DFCS_PUSHED; } - - lprcDest->left++; - lprcDest->right--; DrawFrameControl( hDC, @@ -86,6 +83,30 @@ void CALCON CTaskBtnGroup__DrawBar_hook( return; } + +/* Add spacing between taskbar items */ +typedef long (* CTaskBtnGroup_SetLocation_t)(void *, int, int, LPRECT); +CTaskBtnGroup_SetLocation_t CTaskBtnGroup_SetLocation_orig; +long __cdecl CTaskBtnGroup_SetLocation_hook( + void *pThis, + int i1, + int i2, + LPRECT lprc +) +{ + APPBARDATA abd; + abd.cbSize = sizeof(APPBARDATA); + if (SHAppBarMessage(ABM_GETTASKBARPOS, &abd)) + { + if (abd.uEdge == ABE_BOTTOM || abd.uEdge == ABE_TOP) + { + lprc->right -= 2; + } + } + + return CTaskBtnGroup_SetLocation_orig(pThis, i1, i2, lprc); +} + BOOL Wh_ModInit(void) { HMODULE hExplorer = GetModuleHandleW(NULL); @@ -101,6 +122,14 @@ BOOL Wh_ModInit(void) (void *)CTaskBtnGroup__DrawBar_hook, FALSE }, + { + { + L"public: virtual long __cdecl CTaskBtnGroup::SetLocation(int,int,struct tagRECT const *)" + }, + (void **)&CTaskBtnGroup_SetLocation_orig, + (void*)CTaskBtnGroup_SetLocation_hook, + FALSE + } }; From 732888bb660105936de27ba9b4d8c53c223c2987 Mon Sep 17 00:00:00 2001 From: Anixx Date: Sun, 18 Aug 2024 00:24:43 +0300 Subject: [PATCH 2/2] Update classic-taskbar-buttons-lite.wh.cpp rename variable --- mods/classic-taskbar-buttons-lite.wh.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/classic-taskbar-buttons-lite.wh.cpp b/mods/classic-taskbar-buttons-lite.wh.cpp index 75cec0e82..b3c285c69 100644 --- a/mods/classic-taskbar-buttons-lite.wh.cpp +++ b/mods/classic-taskbar-buttons-lite.wh.cpp @@ -111,7 +111,7 @@ BOOL Wh_ModInit(void) { HMODULE hExplorer = GetModuleHandleW(NULL); - WindhawkUtils::SYMBOL_HOOK hooks[] = { + WindhawkUtils::SYMBOL_HOOK explorerExeHooks[] = { { { L"private: void " @@ -133,7 +133,7 @@ BOOL Wh_ModInit(void) }; - if (!WindhawkUtils::HookSymbols(hExplorer, hooks, ARRAYSIZE(hooks))) + if (!WindhawkUtils::HookSymbols(hExplorer, explorerExeHooks, ARRAYSIZE(explorerExeHooks))) { Wh_Log(L"Failed to hook one or more functions"); return FALSE;