1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-15 03:27:35 +01:00

Other: Add support for disabling Aero Snap Quadrants on Windows 11

This commit is contained in:
lordmilko 2022-03-23 20:04:00 +11:00 committed by Valentin-Gabriel Radu
parent efd52cf951
commit 21c2f219d5
2 changed files with 45 additions and 0 deletions

View File

@ -92,6 +92,7 @@ DWORD bTaskbarAutohideOnDoubleClick = FALSE;
DWORD dwOrbStyle = 0;
DWORD bEnableSymbolDownload = TRUE;
DWORD dwAltTabSettings = 0;
DWORD bDisableAeroSnapQuadrants = FALSE;
DWORD dwSnapAssistSettings = 0;
DWORD dwStartShowClassicMode = 0;
BOOL bDoNotRedirectSystemToSettingsApp = FALSE;
@ -1023,6 +1024,23 @@ void ToggleLauncherTipContextMenu()
#pragma endregion
#pragma region "windowsudk.shellcommon Hooks"
static HRESULT(WINAPI *SLGetWindowsInformationDWORDFunc)(PCWSTR pwszValueName, DWORD* pdwValue) = NULL;
HRESULT WINAPI windowsudkshellcommon_SLGetWindowsInformationDWORDHook(PCWSTR pwszValueName, DWORD* pdwValue)
{
HRESULT hr = SLGetWindowsInformationDWORDFunc(pwszValueName, pdwValue);
if (bDisableAeroSnapQuadrants && !wcsncmp(pwszValueName, L"Shell-Windowing-LimitSnappedWindows", 35))
*pdwValue = 1;
return hr;
}
#pragma endregion
#pragma region "twinui.pcshell.dll hooks"
#ifdef _WIN64
#define LAUNCHERTIP_CLASS_NAME L"LauncherTipWnd"
@ -6166,6 +6184,16 @@ void WINAPI LoadSettings(LPARAM lParam)
LaunchPropertiesGUI(hModule);
#endif
}
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
TEXT("DisableAeroSnapQuadrants"),
0,
NULL,
&bDisableAeroSnapQuadrants,
&dwSize
);
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
@ -9475,6 +9503,20 @@ DWORD Inject(BOOL bIsExplorer)
VnPatchIAT(hInputSwitch, "user32.dll", "TrackPopupMenuEx", inputswitch_TrackPopupMenuExHook);
printf("Setup inputswitch functions done\n");
}
HANDLE hWindowsudkShellcommon = LoadLibraryW(L"windowsudk.shellcommon.dll");
HANDLE hSLC = LoadLibraryW(L"slc.dll");
if (hWindowsudkShellcommon && hSLC)
{
SLGetWindowsInformationDWORDFunc = GetProcAddress(hSLC, "SLGetWindowsInformationDWORD");
if (SLGetWindowsInformationDWORDFunc)
{
VnPatchDelayIAT(hWindowsudkShellcommon, "ext-ms-win-security-slc-l1-1-0.dll", "SLGetWindowsInformationDWORD", windowsudkshellcommon_SLGetWindowsInformationDWORDHook);
}
printf("Setup windowsudk.shellcommon functions done\n");
}
}

View File

@ -537,6 +537,9 @@
;x 4 Restart
"Start_PowerButtonAction"=dword:00000002
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Disable Window Snap Quadrants
"DisableAeroSnapQuadrants"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 2 Snap Assist style
;x 0 Windows 11 (default)
;x 3 Windows 10