1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2025-01-18 16:54:13 +01:00

Option to disable Office hotkeys (Ctrl+Alt+Shift+Windows key combinations) (#661) (.4)

This commit is contained in:
Valentin Radu 2022-01-14 00:13:02 +02:00
parent 33e659f9db
commit befa3eaeb4
4 changed files with 46 additions and 3 deletions

View File

@ -10,6 +10,7 @@ Tested on OS build 22000.376.
* Ability to choose a Windows 10 or Windows 11 Start button style for the Windows 10 taskbar (#436, thanks @krlvm)
* Support for screen readers in the Properties window (#627) (.1)
* Option to disable `Office` hotkeys (`Ctrl`+`Alt`+`Shift`+`Windows` key combinations) (#661) (.4)
#### Feature enhancements

View File

@ -81,6 +81,7 @@ BOOL bDoNotRedirectSystemToSettingsApp = FALSE;
BOOL bDoNotRedirectProgramsAndFeaturesToSettingsApp = FALSE;
BOOL bDoNotRedirectDateAndTimeToSettingsApp = FALSE;
BOOL bDoNotRedirectNotificationIconsToSettingsApp = FALSE;
BOOL bDisableOfficeHotkeys = FALSE;
#define TASKBARGLOMLEVEL_DEFAULT 2
#define MMTASKBARGLOMLEVEL_DEFAULT 2
DWORD dwTaskbarGlomLevel = TASKBARGLOMLEVEL_DEFAULT;
@ -4460,6 +4461,15 @@ void WINAPI LoadSettings(LPARAM lParam)
&bDoNotRedirectNotificationIconsToSettingsApp,
&dwSize
);
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
TEXT("DisableOfficeHotkeys"),
0,
NULL,
&bDisableOfficeHotkeys,
&dwSize
);
dwTemp = TASKBARGLOMLEVEL_DEFAULT;
dwSize = sizeof(DWORD);
RegQueryValueExW(
@ -6253,6 +6263,30 @@ BOOL explorer_SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom)
#pragma endregion
#pragma region "Disable Office Hotkeys"
const UINT office_hotkeys[10] = { 0x57, 0x54, 0x59, 0x4F, 0x50, 0x44, 0x4C, 0x58, 0x4E, 0x20 };
BOOL explorer_RegisterHotkeyHook(HWND hWnd, int id, UINT fsModifiers, UINT vk)
{
if (fsModifiers == (MOD_ALT | MOD_CONTROL | MOD_SHIFT | MOD_WIN | MOD_NOREPEAT) && (
vk == office_hotkeys[0] ||
vk == office_hotkeys[1] ||
vk == office_hotkeys[2] ||
vk == office_hotkeys[3] ||
vk == office_hotkeys[4] ||
vk == office_hotkeys[5] ||
vk == office_hotkeys[6] ||
vk == office_hotkeys[7] ||
vk == office_hotkeys[8] ||
vk == office_hotkeys[9]))
{
SetLastError(ERROR_HOTKEY_ALREADY_REGISTERED);
return FALSE;
}
return RegisterHotKey(hWnd, id, fsModifiers, vk);
}
#pragma endregion
DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall)
{
//Sleep(150);
@ -7010,6 +7044,12 @@ DWORD Inject(BOOL bIsExplorer)
printf("Open Start on monitor thread\n");
if (bDisableOfficeHotkeys)
{
VnPatchIAT(hExplorer, "user32.dll", "RegisterHotKey", explorer_RegisterHotkeyHook);
}
if (bEnableArchivePlugin)
{
ArchiveMenuThreadParams* params = calloc(1, sizeof(ArchiveMenuThreadParams));

View File

@ -360,6 +360,8 @@
"PropertiesInWinX"=dword:00000000
;b Remove shortcut key from program settings item in Win+X menu
"NoMenuAccelerator"=dword:00000000
;b Disable Office hotkeys (Ctrl+Alt+Shift+Windows key combinations) *
"DisableOfficeHotkeys"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
;c 6 Default action in the Alt+F4 dialog on the desktop
;x 256 Switch user

View File

@ -1,7 +1,7 @@
#define VER_MAJOR 22000
#define VER_MINOR 376
#define VER_BUILD_HI 41
#define VER_BUILD_LO 3
#define VER_BUILD_LO 4
#define VER_FLAGS VS_FF_PRERELEASE
@ -12,5 +12,5 @@
#define VER_STR(arg) #arg
// The String form of the version numbers
#define VER_FILE_STRING VALUE "FileVersion", "22000.376.41.3"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.376.41.3"
#define VER_FILE_STRING VALUE "FileVersion", "22000.376.41.4"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.376.41.4"