Skip to content

Commit 80414f5

Browse files
committed
File Explorer: Disable XAML views when Windows 11 command bar is disabled (#3447)
1 parent 47b44cc commit 80414f5

3 files changed

Lines changed: 23 additions & 10 deletions

File tree

ExplorerPatcher/dllmain.c

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8102,6 +8102,12 @@ DEFINE_GUID(CLSID_XamlIslandViewAdapter,
81028102
0x8A, 0xE5, 0xA8, 0x8E, 0x9A, 0x33
81038103
);
81048104

8105+
DEFINE_GUID(CLSID_FileExplorerFolderView,
8106+
0x2AA9162E,
8107+
0xC906, 0x4DD9, 0xAD, 0x0B,
8108+
0x3D, 0x24, 0xA8, 0xEE, 0xF5, 0xA0
8109+
);
8110+
81058111
DEFINE_GUID(CLSID_UIRibbonFramework,
81068112
0x926749FA,
81078113
0x2615, 0x4987, 0x88, 0x45,
@@ -8128,6 +8134,16 @@ HRESULT ExplorerFrame_CoCreateInstanceHook(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
81288134
}
81298135
return CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);
81308136
}
8137+
8138+
HRESULT shell32_CoCreateInstanceHook(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID* ppv)
8139+
{
8140+
if (IsEqualCLSID(rclsid, &CLSID_FileExplorerFolderView))
8141+
{
8142+
if (dwFileExplorerCommandUI != 0 && dwFileExplorerCommandUI != 3 && dwFileExplorerCommandUI != 4)
8143+
return REGDB_E_CLASSNOTREG;
8144+
}
8145+
return CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);
8146+
}
81318147
#pragma endregion
81328148

81338149

@@ -9215,7 +9231,7 @@ int RtlQueryFeatureConfigurationHook(UINT32 featureId, int sectionType, INT64* c
92159231
}
92169232
break;
92179233
}
9218-
case 40729001: // WASDKInFileExplorer - Removed in 22635.2915+
9234+
/*case 40729001: // WASDKInFileExplorer - Removed in 22635.2915+
92199235
case 42295138: // XAMLFolderViewSupport - Depends on WASDKInFileExplorer
92209236
{
92219237
if (dwFileExplorerCommandUI == 1 // Windows 10 Ribbon <-- fixes crashing when navigating back to a WASDK view
@@ -9228,15 +9244,13 @@ int RtlQueryFeatureConfigurationHook(UINT32 featureId, int sectionType, INT64* c
92289244
// without WASDK, and returning to a page with WASDK.
92299245
//
92309246
// However this also disables the new Gallery page altogether.
9231-
// TODO- We have to find a way to either fix the crashing or make Gallery use the non WASDK view in the
9232-
// TODO same way as when Explorer is opened into Control Panel then going to Gallery.
92339247
//
9234-
// TODO- We cannot rely on feature flag patches because they will eventually be removed.
9248+
// Fixed by shell32_CoCreateInstanceHook by returning class not registered for CLSID_FileExplorerFolderView
92359249
//
92369250
buffer->enabledState = FEATURE_ENABLED_STATE_DISABLED;
92379251
}
92389252
break;
9239-
}
9253+
}*/
92409254
case 40950262: // FEMNB "File Explorer Modern Navigation Bar"
92419255
{
92429256
if (dwFileExplorerCommandUI == 3 // Windows 11 Command Bar (no Tabs, classic Address Bar)
@@ -9307,15 +9321,14 @@ DWORD InjectBasicFunctions(BOOL bIsExplorer, BOOL bInstall)
93079321
VnPatchIAT(hShell32, "user32.dll", "TrackPopupMenu", shell32_TrackPopupMenu);
93089322
}
93099323
else
9310-
{
93119324
#endif
9325+
{
93129326
VnPatchIAT(hShell32, "user32.dll", "TrackPopupMenu", TrackPopupMenuHook);
9313-
#if WITH_MAIN_PATCHER
93149327
}
9315-
#endif
93169328
if (bIsExplorerProcess)
93179329
{
93189330
HOOK_IMMERSIVE_MENUS(Shell32);
9331+
VnPatchDelayIAT(hShell32, "api-ms-win-core-com-l1-1-0.dll", "CoCreateInstance", shell32_CoCreateInstanceHook);
93199332
}
93209333
VnPatchIAT(hShell32, "user32.dll", "SystemParametersInfoW", DisableImmersiveMenus_SystemParametersInfoW);
93219334
if (!bIsExplorer)

ep_setup/resources/ep_setup.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ BEGIN
7272
VALUE "FileDescription", "ExplorerPatcher Setup Program"
7373
VER_FILE_STRING
7474
VALUE "InternalName", "ep_setup.exe"
75-
VALUE "LegalCopyright", "(C) 2021-2024 ExplorerPatcher Developers. All rights reserved."
75+
VALUE "LegalCopyright", "(C) 2021-2025 ExplorerPatcher Developers. All rights reserved."
7676
VALUE "OriginalFilename", "ep_setup.exe"
7777
VALUE "ProductName", "ExplorerPatcher"
7878
VER_PRODUCT_STRING

ep_setup/resources/ep_setup_debug.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ BEGIN
7272
VALUE "FileDescription", "ExplorerPatcher Setup Program (Debug Build)"
7373
VER_FILE_STRING
7474
VALUE "InternalName", "ep_setup.exe"
75-
VALUE "LegalCopyright", "(C) 2021-2024 ExplorerPatcher Developers. All rights reserved."
75+
VALUE "LegalCopyright", "(C) 2021-2025 ExplorerPatcher Developers. All rights reserved."
7676
VALUE "OriginalFilename", "ep_setup.exe"
7777
VALUE "ProductName", "ExplorerPatcher"
7878
VER_PRODUCT_STRING

0 commit comments

Comments
 (0)