1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2025-01-19 01:04:08 +01:00

Alt-Tab: Enable Windows 10 style in OS builds 22621+

This commit is contained in:
Valentin Radu 2022-08-06 23:34:52 +03:00
parent 7d6b0933e1
commit cb951df606
3 changed files with 63 additions and 11 deletions

View File

@ -9658,10 +9658,20 @@ INT64 twinui_pcshell_IsUndockedAssetAvailableHook(INT a1, INT64 a2, INT64 a3, co
// else, show Windows 11 style basically
else
{
return twinui_pcshell_IsUndockedAssetAvailableFunc(a1, a2, a3, a4);
if (twinui_pcshell_IsUndockedAssetAvailableFunc)
return twinui_pcshell_IsUndockedAssetAvailableFunc(a1, a2, a3, a4);
return 1;
}
}
INT64(*twinui_pcshell_CMultitaskingViewManager__CreateDCompMTVHostFunc)(INT64 a1, unsigned int a2, INT64 a3, INT64 a4, INT64* a5);
INT64(*twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostFunc)(INT64 a1, unsigned int a2, INT64 a3, INT64 a4, INT64* a5);
INT64 twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostHook(INT64 a1, unsigned int a2, INT64 a3, INT64 a4, INT64* a5)
{
if (!twinui_pcshell_IsUndockedAssetAvailableHook(a2, 0, 0, 0, NULL)) return twinui_pcshell_CMultitaskingViewManager__CreateDCompMTVHostFunc(a1, a2, a3, a4, a5);
return twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostFunc(a1, a2, a3, a4, a5);
}
BOOL IsDebuggerPresentHook()
{
return FALSE;
@ -10180,17 +10190,37 @@ DWORD Inject(BOOL bIsExplorer)
if (symbols_PTRS.twinui_pcshell_PTRS[7] && symbols_PTRS.twinui_pcshell_PTRS[7] != 0xFFFFFFFF)
{
twinui_pcshell_IsUndockedAssetAvailableFunc = (INT64(*)(void*, POINT*))
((uintptr_t)hTwinuiPcshell + symbols_PTRS.twinui_pcshell_PTRS[7]);
rv = funchook_prepare(
funchook,
(void**)&twinui_pcshell_IsUndockedAssetAvailableFunc,
twinui_pcshell_IsUndockedAssetAvailableHook
);
if (rv != 0)
if (IsWindows11Version22H2OrHigher())
{
FreeLibraryAndExitThread(hModule, rv);
return rv;
twinui_pcshell_CMultitaskingViewManager__CreateDCompMTVHostFunc = (INT64(*)(void*, POINT*))
((uintptr_t)hTwinuiPcshell + symbols_PTRS.twinui_pcshell_PTRS[TWINUI_PCSHELL_SB_CNT - 1]);
twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostFunc = (INT64(*)(void*, POINT*))
((uintptr_t)hTwinuiPcshell + symbols_PTRS.twinui_pcshell_PTRS[7]);
rv = funchook_prepare(
funchook,
(void**)&twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostFunc,
twinui_pcshell_CMultitaskingViewManager__CreateXamlMTVHostHook
);
if (rv != 0)
{
FreeLibraryAndExitThread(hModule, rv);
return rv;
}
}
else
{
twinui_pcshell_IsUndockedAssetAvailableFunc = (INT64(*)(void*, POINT*))
((uintptr_t)hTwinuiPcshell + symbols_PTRS.twinui_pcshell_PTRS[7]);
rv = funchook_prepare(
funchook,
(void**)&twinui_pcshell_IsUndockedAssetAvailableFunc,
twinui_pcshell_IsUndockedAssetAvailableHook
);
if (rv != 0)
{
FreeLibraryAndExitThread(hModule, rv);
return rv;
}
}
}

View File

@ -246,6 +246,16 @@ DWORD DownloadSymbols(DownloadSymbolsParams* params)
VirtualProtect(twinui_pcshell_SN, sizeof(twinui_pcshell_SN), flOldProtect, &flOldProtect);
}
}
if (IsWindows11Version22H2OrHigher())
{
DWORD flOldProtect = 0;
if (VirtualProtect(twinui_pcshell_SN, sizeof(twinui_pcshell_SN), PAGE_EXECUTE_READWRITE, &flOldProtect))
{
twinui_pcshell_SN[7] = "CMultitaskingViewManager::_CreateXamlMTVHost";
twinui_pcshell_SN[TWINUI_PCSHELL_SB_CNT - 1] = "CMultitaskingViewManager::_CreateDCompMTVHost";
VirtualProtect(twinui_pcshell_SN, sizeof(twinui_pcshell_SN), flOldProtect, &flOldProtect);
}
}
if (VnGetSymbols(
szSettingsPath,
symbols_PTRS.twinui_pcshell_PTRS,
@ -1124,6 +1134,17 @@ BOOL LoadSymbols(symbols_addr* symbols_PTRS, HMODULE hModule)
&(symbols_PTRS->twinui_pcshell_PTRS[7]),
&dwSize
);
if (IsWindows11Version22H2OrHigher())
{
RegQueryValueExW(
hKey,
TEXT(TWINUI_PCSHELL_SB_LAST),
0,
NULL,
&(symbols_PTRS->twinui_pcshell_PTRS[TWINUI_PCSHELL_SB_CNT - 1]),
&dwSize
);
}
RegCloseKey(hKey);
if (IsWindows11())

View File

@ -19,6 +19,7 @@
#define TWINUI_PCSHELL_SB_6 "CLauncherTipContextMenu::ShowLauncherTipContextMenu"
#define TWINUI_PCSHELL_SB_7 "IsUndockedAssetAvailable"
#define TWINUI_PCSHELL_SB_8 "winrt::Windows::Internal::Shell::implementation::MeetAndChatManager::OnMessage" // should be always last
#define TWINUI_PCSHELL_SB_LAST TWINUI_PCSHELL_SB_8
#define TWINUI_PCSHELL_SB_CNT 9
#define STARTDOCKED_SB_NAME "StartDocked"
#define STARTDOCKED_SB_0 "StartDocked::LauncherFrame::ShowAllApps" // UNUSED