mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2025-02-20 20:41:26 +01:00
Taskbar10: Centered taskbar works in remote sessions and when animations are turned off system-wide
This commit is contained in:
parent
a52d3eb615
commit
a7ab5287c6
@ -259,7 +259,10 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="lvt.c" />
|
||||
<ClCompile Include="lvt.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SettingsMonitor.c" />
|
||||
<ClCompile Include="StartMenu.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
|
@ -1,11 +1,14 @@
|
||||
#include "TaskbarCenter.h"
|
||||
|
||||
DEFINE_GUID(POLID_TurnOffSPIAnimations, 0xD7AF00A, 0xB468, 0x4A39, 0xB0, 0x16, 0x33, 0x3E, 0x22, 0x77, 0xAB, 0xED);
|
||||
extern int(*SHWindowsPolicy)(REFIID);
|
||||
extern HWND PeopleButton_LastHWND;
|
||||
extern DWORD dwWeatherToLeft;
|
||||
extern DWORD dwOldTaskbarAl;
|
||||
extern DWORD dwMMOldTaskbarAl;
|
||||
extern wchar_t* EP_TASKBAR_LENGTH_PROP_NAME;
|
||||
#define EP_TASKBAR_LENGTH_TOO_SMALL 20
|
||||
BOOL bTaskbarCenterHasPatchedSHWindowsPolicy = FALSE;
|
||||
|
||||
HRESULT TaskbarCenter_Center(HWND hWnd, HWND hWndTaskbar, RECT rc, BOOL bIsTaskbarHorizontal)
|
||||
{
|
||||
@ -428,4 +431,29 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
|
||||
}
|
||||
if (bWasCalled) return bWasCalled;
|
||||
return GetClientRect(hWnd, lpRect);
|
||||
}
|
||||
|
||||
BOOL TaskbarCenter_SHWindowsPolicy(REFIID riid)
|
||||
{
|
||||
if (IsEqualIID(riid, &POLID_TurnOffSPIAnimations) && (TaskbarCenter_ShouldCenter(dwOldTaskbarAl) || TaskbarCenter_ShouldCenter(dwMMOldTaskbarAl)))
|
||||
{
|
||||
DWORD flOldProtect = 0;
|
||||
if (!bTaskbarCenterHasPatchedSHWindowsPolicy && *((unsigned char*)_ReturnAddress() + 7) == 0x0F)
|
||||
{
|
||||
if (*((unsigned char*)_ReturnAddress() + 8) == 0x85 && VirtualProtect((unsigned char*)_ReturnAddress() + 9, 1, PAGE_EXECUTE_READWRITE, &flOldProtect))
|
||||
{
|
||||
*((unsigned char*)_ReturnAddress() + 9) += 2;
|
||||
VirtualProtect((unsigned char*)_ReturnAddress() + 9, 1, flOldProtect, &flOldProtect);
|
||||
}
|
||||
else if (*((unsigned char*)_ReturnAddress() + 8) == 0x84 && VirtualProtect((unsigned char*)_ReturnAddress() + 13, 2, PAGE_EXECUTE_READWRITE, &flOldProtect))
|
||||
{
|
||||
*((unsigned char*)_ReturnAddress() + 13) += 0x90;
|
||||
*((unsigned char*)_ReturnAddress() + 13) += 0x90;
|
||||
VirtualProtect((unsigned char*)_ReturnAddress() + 13, 2, flOldProtect, &flOldProtect);
|
||||
}
|
||||
bTaskbarCenterHasPatchedSHWindowsPolicy = TRUE;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return SHWindowsPolicy(riid);
|
||||
}
|
@ -39,4 +39,6 @@ inline BOOL TaskbarCenter_ShouldLeftAlignWhenSpaceConstrained(DWORD dwSetting)
|
||||
}
|
||||
|
||||
BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect);
|
||||
|
||||
BOOL TaskbarCenter_SHWindowsPolicy(REFIID riid);
|
||||
#endif
|
@ -147,6 +147,7 @@ int Code = 0;
|
||||
HRESULT InjectStartFromExplorer();
|
||||
void InvokeClockFlyout();
|
||||
void WINAPI Explorer_RefreshUI(int unused);
|
||||
int (*SHWindowsPolicy)(REFIID);
|
||||
|
||||
#define ORB_STYLE_WINDOWS10 0
|
||||
#define ORB_STYLE_WINDOWS11 1
|
||||
@ -9164,8 +9165,9 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_PRIVATE_INTERFACES
|
||||
HANDLE hShcore = LoadLibraryW(L"shcore.dll");
|
||||
SHWindowsPolicy = GetProcAddress(hShcore, (LPCSTR)190);
|
||||
#ifdef USE_PRIVATE_INTERFACES
|
||||
explorer_SHCreateStreamOnModuleResourceWFunc = GetProcAddress(hShcore, (LPCSTR)109);
|
||||
VnPatchIAT(hExplorer, "shcore.dll", (LPCSTR)0x6D, explorer_SHCreateStreamOnModuleResourceWHook);
|
||||
#endif
|
||||
@ -9620,14 +9622,9 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
|
||||
|
||||
|
||||
if (VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "GetClientRect", TaskbarCenter_GetClientRectHook))
|
||||
{
|
||||
printf("Initialized taskbar centering module.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Failed to initialize taskbar centering module.\n");
|
||||
}
|
||||
VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "GetClientRect", TaskbarCenter_GetClientRectHook);
|
||||
VnPatchIAT(hExplorer, "SHCORE.dll", (LPCSTR)190, TaskbarCenter_SHWindowsPolicy);
|
||||
printf("Initialized taskbar centering module.\n");
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user