1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2025-01-31 12:03:50 +01:00

File Explorer: Option to disable ribbon

This commit is contained in:
Valentin Radu 2022-03-28 20:32:53 +03:00
parent 3f96325ad6
commit 244e4a0936
4 changed files with 81 additions and 7 deletions

View File

@ -465,6 +465,18 @@ LSTATUS GUI_Internal_RegSetValueExW(
{ {
return RegisterDWMService(*(DWORD*)lpData, 0); return RegisterDWMService(*(DWORD*)lpData, 0);
} }
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_FileExplorerCommandUI"))
{
if (!*(DWORD*)lpData)
{
RegDeleteKeyW(HKEY_CURRENT_USER, L"SOFTWARE\\Classes\\CLSID\\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\\InProcServer32");
}
else
{
RegSetKeyValueW(HKEY_CURRENT_USER, L"SOFTWARE\\Classes\\CLSID\\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\\InProcServer32", L"", REG_SZ, L"", 1);
}
RegSetKeyValueW(HKEY_CURRENT_USER, _T(REGPATH), L"FileExplorerCommandUI", REG_DWORD, lpData, sizeof(DWORD));
}
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_RegisterAsShellExtension")) else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_RegisterAsShellExtension"))
{ {
HKEY hKey2 = NULL; HKEY hKey2 = NULL;
@ -538,7 +550,7 @@ LSTATUS GUI_Internal_RegSetValueExW(
} }
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
} }
LSTATUS GUI_RegSetValueExW( LSTATUS GUI_RegSetValueExW(
@ -700,6 +712,16 @@ LSTATUS GUI_Internal_RegQueryValueExW(
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_FileExplorerCommandUI"))
{
if (RegGetValueW(HKEY_CURRENT_USER, L"SOFTWARE\\Classes\\CLSID\\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\\InProcServer32", L"", RRF_RT_REG_SZ, NULL, NULL, NULL) != ERROR_SUCCESS)
{
*lpcbData = sizeof(DWORD);
*(DWORD*)lpData = 0;
return ERROR_SUCCESS;
}
return RegQueryValueExW(hKey, L"FileExplorerCommandUI", lpReserved, lpType, lpData, lpcbData);
}
else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_RegisterAsShellExtension")) else if (!wcscmp(lpValueName, L"Virtualized_" _T(EP_CLSID) L"_RegisterAsShellExtension"))
{ {
HKEY hKey2 = NULL; HKEY hKey2 = NULL;

View File

@ -81,6 +81,7 @@ DWORD bMonitorOverride = TRUE;
DWORD bOpenAtLogon = FALSE; DWORD bOpenAtLogon = FALSE;
DWORD bClockFlyoutOnWinC = FALSE; DWORD bClockFlyoutOnWinC = FALSE;
DWORD bUseClassicDriveGrouping = FALSE; DWORD bUseClassicDriveGrouping = FALSE;
DWORD dwFileExplorerCommandUI = 9999;
DWORD bDisableImmersiveContextMenu = FALSE; DWORD bDisableImmersiveContextMenu = FALSE;
DWORD bClassicThemeMitigations = FALSE; DWORD bClassicThemeMitigations = FALSE;
DWORD bWasClassicThemeMitigationsSet = FALSE; DWORD bWasClassicThemeMitigationsSet = FALSE;
@ -5872,6 +5873,28 @@ void WINAPI LoadSettings(LPARAM lParam)
&dwSize &dwSize
); );
dwSize = sizeof(DWORD); dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
TEXT("FileExplorerCommandUI"),
0,
NULL,
&dwFileExplorerCommandUI,
&dwSize
);
if (dwFileExplorerCommandUI == 9999)
{
if (IsWindows11())
{
DWORD bIsWindows11CommandBarDisabled = (RegGetValueW(HKEY_CURRENT_USER, L"SOFTWARE\\Classes\\CLSID\\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\\InProcServer32", L"", RRF_RT_REG_SZ, NULL, NULL, NULL) == ERROR_SUCCESS);
RegSetValueExW(hKey, L"FileExplorerCommandUI", 0, REG_DWORD, &bIsWindows11CommandBarDisabled, sizeof(DWORD));
dwFileExplorerCommandUI = bIsWindows11CommandBarDisabled;
}
else
{
dwFileExplorerCommandUI = 0;
}
}
dwSize = sizeof(DWORD);
RegQueryValueExW( RegQueryValueExW(
hKey, hKey,
TEXT("DisableImmersiveContextMenu"), TEXT("DisableImmersiveContextMenu"),
@ -8164,6 +8187,22 @@ HRESULT shell32_DriveTypeCategorizer_CreateInstanceHook(IUnknown* pUnkOuter, REF
#pragma endregion #pragma endregion
#pragma region "Disable ribbon in File Explorer"
DEFINE_GUID(CLSID_UIRibbonFramework,
0x926749FA, 0x2615, 0x4987, 0x88, 0x45, 0xC3, 0x3E, 0x65, 0xF2, 0xB9, 0x57);
DEFINE_GUID(IID_UIRibbonFramework,
0xF4F0385D, 0x6872, 0x43A8, 0xAD, 0x09, 0x4C, 0x33, 0x9C, 0xB3, 0xF5, 0xC5);
HRESULT ExplorerFrame_CoCreateInstanceHook(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID* ppv)
{
if (dwFileExplorerCommandUI == 2 && IsEqualCLSID(rclsid, &CLSID_UIRibbonFramework) && IsEqualIID(riid, &IID_UIRibbonFramework))
{
return REGDB_E_CLASSNOTREG;
}
return CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);
}
#pragma endregion
#pragma region "Change language UI style" #pragma region "Change language UI style"
#ifdef _WIN64 #ifdef _WIN64
DEFINE_GUID(CLSID_InputSwitchControl, DEFINE_GUID(CLSID_InputSwitchControl,
@ -9858,6 +9897,10 @@ DWORD Inject(BOOL bIsExplorer)
printf("Setup shell32 functions done\n"); printf("Setup shell32 functions done\n");
HANDLE hExplorerFrame = GetModuleHandleW(L"ExplorerFrame.dll");
VnPatchIAT(hExplorerFrame, "api-ms-win-core-com-l1-1-0.dll", "CoCreateInstance", ExplorerFrame_CoCreateInstanceHook);
printf("Setup explorerframe functions done\n");
if (IsWindows11()) if (IsWindows11())
{ {

View File

@ -158,15 +158,18 @@
;q ;q
;b Register as shell extension ;b Register as shell extension
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_RegisterAsShellExtension"=dword:00000000 ;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_RegisterAsShellExtension"=dword:00000000
[-HKEY_CURRENT_USER\Software\Classes\CLSID\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\InprocServer32]
;d Disable the Windows 11 command bar *
@=""
[-HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32] [-HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32]
;d Disable the Windows 11 context menu * ;d Disable the Windows 11 context menu *
@="" @=""
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Use classic drive groupings in This PC * ;b Use classic drive groupings in This PC *
"UseClassicDriveGrouping"=dword:00000000 "UseClassicDriveGrouping"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 3 Control Interface *
;x 0 Windows 11 Command Bar (default)
;x 1 Windows 10 Ribbon
;x 2 Windows 7 Command Bar
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_FileExplorerCommandUI"=dword:00000000
;t The following settings take effect on newly created File Explorer windows: ;t The following settings take effect on newly created File Explorer windows:
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;i Use immersive menus when displaying Windows 10 context menus ** ;i Use immersive menus when displaying Windows 10 context menus **

View File

@ -142,9 +142,18 @@
;https://github.com/valinet/ExplorerPatcher/wiki/Using-ExplorerPatcher-as-shell-extension ;https://github.com/valinet/ExplorerPatcher/wiki/Using-ExplorerPatcher-as-shell-extension
;q ;q
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Register as shell extension
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_RegisterAsShellExtension"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Use classic drive groupings in This PC * ;b Use classic drive groupings in This PC *
"UseClassicDriveGrouping"=dword:00000000 "UseClassicDriveGrouping"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 2 Control Interface
;x 0 Windows 10 Ribbon (default)
;x 2 Windows 7 Command Bar
"FileExplorerCommandUI"=dword:00000000
;t The following settings take effect on newly created File Explorer windows:
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;i Use immersive menus when displaying Windows 10 context menus ** ;i Use immersive menus when displaying Windows 10 context menus **
"DisableImmersiveContextMenu"=dword:00000000 "DisableImmersiveContextMenu"=dword:00000000
[-HKEY_CURRENT_USER\Software\Classes\CLSID\{056440FD-8568-48e7-A632-72157243B55B}\InprocServer32] [-HKEY_CURRENT_USER\Software\Classes\CLSID\{056440FD-8568-48e7-A632-72157243B55B}\InprocServer32]
@ -159,9 +168,6 @@
;p 2 ;p 2
;b Mica effect on title bar ;b Mica effect on title bar
"MicaEffectOnTitlebar"=dword:00000000 "MicaEffectOnTitlebar"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Register as shell extension
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_RegisterAsShellExtension"=dword:00000000
;T Start menu ;T Start menu