Browse Source

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

pull/1081/head
lordmilko 4 years ago committed by Valentin-Gabriel Radu
parent
commit
21c2f219d5
  1. 42
      ExplorerPatcher/dllmain.c
  2. 3
      ExplorerPatcher/settings.reg

42
ExplorerPatcher/dllmain.c

@ -92,6 +92,7 @@ DWORD bTaskbarAutohideOnDoubleClick = FALSE; @@ -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() @@ -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) @@ -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) @@ -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");
}
}

3
ExplorerPatcher/settings.reg

@ -537,6 +537,9 @@ @@ -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

Loading…
Cancel
Save