@@ -1915,86 +1915,106 @@ DWORD FixTaskbarAutohide(DWORD unused)
1915
1915
#pragma region "EnsureXAML on OS builds 22621+"
1916
1916
#ifdef _WIN64
1917
1917
DEFINE_GUID (uuidof_Windows_Internal_Shell_XamlExplorerHost_IXamlApplicationStatics ,
1918
- 0xECC13292 , 0x27EF , 0x547A , 0xAC , 0x8B , 0x76 , 0xCD , 0x17 , 0x32 , 0x21 , 0x86 );
1918
+ 0xECC13292 ,
1919
+ 0x27EF , 0x547A , 0xAC , 0x8B ,
1920
+ 0x76 , 0xCD , 0x17 , 0x32 , 0x21 , 0x86
1921
+ );
1922
+
1923
+ // 22621.2134+. Still named IXamlApplicationStatics.
1924
+ DEFINE_GUID (uuidof_Windows_Internal_Shell_XamlExplorerHost_IXamlApplicationStatics2 ,
1925
+ 0x5148D7B1 ,
1926
+ 0x800E , 0x5C86 , 0x8F , 0x69 ,
1927
+ 0x55 , 0x81 , 0x97 , 0x48 , 0x31 , 0x23
1928
+ );
1919
1929
1920
1930
DEFINE_GUID (uuidof_Windows_UI_Core_ICoreWindow5 ,
1921
- 0x28258A12 , 0x7D82 , 0x505B , 0xB2 , 0x10 , 0x71 , 0x2B , 0x04 , 0xA5 , 0x88 , 0x82 );
1931
+ 0x28258A12 ,
1932
+ 0x7D82 , 0x505B , 0xB2 , 0x10 ,
1933
+ 0x71 , 0x2B , 0x04 , 0xA5 , 0x88 , 0x82
1934
+ );
1922
1935
1923
1936
BOOL bIsXAMLEnsured = FALSE;
1924
1937
void EnsureXAML ()
1925
1938
{
1926
- signed int v0 ; // eax
1927
- signed int v2 ; // eax
1939
+ if (bIsXAMLEnsured )
1940
+ return ;
1941
+ bIsXAMLEnsured = TRUE;
1942
+ ULONGLONG initTime = GetTickCount64 ();
1943
+ HRESULT hr ;
1928
1944
1929
- if (!bIsXAMLEnsured )
1945
+ HSTRING_HEADER hstringheaderXamlApplication ;
1946
+ HSTRING hstringXamlApplication = NULL ;
1947
+ hr = WindowsCreateStringReference (L"Windows.Internal.Shell.XamlExplorerHost.XamlApplication" , 55 , & hstringheaderXamlApplication , & hstringXamlApplication );
1948
+ if (FAILED (hr ))
1930
1949
{
1931
- bIsXAMLEnsured = TRUE;
1932
- ULONGLONG initTime = GetTickCount64 ();
1933
-
1934
- IInspectable * pUIXamlApplicationFactory = NULL ;
1935
- HSTRING_HEADER hstringheaderXamlApplication ;
1936
- HSTRING hstringXamlApplication = NULL ;
1937
- IInspectable * pCoreWindow5 = NULL ;
1938
- HSTRING_HEADER hstringheaderWindowsXamlManager ;
1939
- HSTRING hstringWindowsXamlManager = NULL ;
1950
+ printf ("[EnsureXAML] WindowsCreateStringReference(XamlApplication) failed. 0x%lX\n" , hr );
1951
+ goto cleanup ;
1952
+ }
1940
1953
1941
- if ( FAILED ( WindowsCreateStringReference ( L"Windows.Internal.Shell.XamlExplorerHost.XamlApplication" , 0x37u , & hstringheaderXamlApplication , & hstringXamlApplication )) || ! hstringXamlApplication )
1942
- {
1943
- printf ( "Error in sub_1800135EC on WindowsCreateStringReference.\n" );
1944
- goto cleanup ;
1945
- }
1946
- if (FAILED (RoGetActivationFactory ( hstringXamlApplication , & uuidof_Windows_Internal_Shell_XamlExplorerHost_IXamlApplicationStatics , & pUIXamlApplicationFactory )) || ! pUIXamlApplicationFactory )
1954
+ IInspectable * pXamlApplicationStatics = NULL ;
1955
+ hr = RoGetActivationFactory ( hstringXamlApplication , & uuidof_Windows_Internal_Shell_XamlExplorerHost_IXamlApplicationStatics , & pXamlApplicationStatics );
1956
+ if ( FAILED ( hr ))
1957
+ {
1958
+ hr = RoGetActivationFactory ( hstringXamlApplication , & uuidof_Windows_Internal_Shell_XamlExplorerHost_IXamlApplicationStatics2 , & pXamlApplicationStatics );
1959
+ if (FAILED (hr ) )
1947
1960
{
1948
- printf ("Error in sub_1800135EC on RoGetActivationFactory. \n" );
1961
+ printf ("[EnsureXAML] RoGetActivationFactory(IXamlApplicationStatics) failed. 0x%lX \n" , hr );
1949
1962
goto cleanup0 ;
1950
1963
}
1964
+ }
1951
1965
1952
- IUnknown * pXamlApplication = NULL ;
1953
- (* (void (__fastcall* * )(__int64 , __int64 * ))(* (INT64 * )pUIXamlApplicationFactory + 48 ))(pUIXamlApplicationFactory , & pXamlApplication ); // get_Current
1954
- if (!pXamlApplication )
1955
- {
1956
- printf ("Error in sub_1800135EC on pUIXamlApplicationFactory + 48.\n" );
1957
- goto cleanup1 ;
1958
- }
1959
- else pXamlApplication -> lpVtbl -> Release (pXamlApplication );
1966
+ IUnknown * pXamlApplication = NULL ;
1967
+ HRESULT (* IXamlApplicationStatics_get_Current )(IInspectable * , void * * ) = ((void * * )pXamlApplicationStatics -> lpVtbl )[6 ];
1968
+ hr = IXamlApplicationStatics_get_Current (pXamlApplicationStatics , & pXamlApplication );
1969
+ if (FAILED (hr ))
1970
+ {
1971
+ printf ("[EnsureXAML] IXamlApplicationStatics::get_Current() failed.\n" );
1972
+ goto cleanup1 ;
1973
+ }
1974
+ pXamlApplication -> lpVtbl -> Release (pXamlApplication );
1960
1975
1961
- if (FAILED (WindowsCreateStringReference (L"Windows.UI.Xaml.Hosting.WindowsXamlManager" , 0x2Au , & hstringheaderWindowsXamlManager , & hstringWindowsXamlManager )))
1962
- {
1963
- printf ("Error in sub_1800135EC on WindowsCreateStringReference 2.\n" );
1964
- goto cleanup1 ;
1965
- }
1966
- if (FAILED (RoGetActivationFactory (hstringWindowsXamlManager , & uuidof_Windows_UI_Core_ICoreWindow5 , & pCoreWindow5 )))
1967
- {
1968
- printf ("Error in sub_1800135EC on RoGetActivationFactory 2.\n" );
1969
- goto cleanup2 ;
1970
- }
1976
+ HSTRING_HEADER hstringheaderWindowsXamlManager ;
1977
+ HSTRING hstringWindowsXamlManager = NULL ;
1978
+ hr = WindowsCreateStringReference (L"Windows.UI.Xaml.Hosting.WindowsXamlManager" , 42 , & hstringheaderWindowsXamlManager , & hstringWindowsXamlManager );
1979
+ if (FAILED (hr ))
1980
+ {
1981
+ printf ("[EnsureXAML] WindowsCreateStringReference(WindowsXamlManager) failed. 0x%lX\n" , hr );
1982
+ goto cleanup1 ;
1983
+ }
1984
+
1985
+ __x_ABI_CWindows_CUI_CCore_CICoreWindow5 * pCoreWindow5 = NULL ;
1986
+ hr = RoGetActivationFactory (hstringWindowsXamlManager , & uuidof_Windows_UI_Core_ICoreWindow5 , & pCoreWindow5 );
1987
+ if (FAILED (hr ))
1988
+ {
1989
+ printf ("[EnsureXAML] RoGetActivationFactory(ICoreWindow5) failed. 0x%lX\n" , hr );
1990
+ goto cleanup2 ;
1991
+ }
1971
1992
1972
- if (pCoreWindow5 )
1993
+ if (pCoreWindow5 )
1994
+ {
1995
+ __x_ABI_CWindows_CSystem_CIDispatcherQueue * pDispatcherQueue = NULL ;
1996
+ hr = pCoreWindow5 -> lpVtbl -> get_DispatcherQueue (pCoreWindow5 , & pDispatcherQueue );
1997
+ if (FAILED (hr ))
1973
1998
{
1974
- IUnknown * pDispatcherQueue = NULL ;
1975
- (* (void (__fastcall* * )(__int64 , __int64 * ))(* (INT64 * )pCoreWindow5 + 48 ))(pCoreWindow5 , & pDispatcherQueue ); // get_DispatcherQueue
1976
- if (!pDispatcherQueue )
1977
- {
1978
- printf ("Error in sub_1800135EC on pCoreWindow5 + 48.\n" );
1979
- goto cleanup3 ;
1980
- }
1981
- // Keep pDispatcherQueue referenced in memory
1999
+ printf ("[EnsureXAML] ICoreWindow5::get_DispatcherQueue() failed.\n" );
2000
+ goto cleanup3 ;
1982
2001
}
2002
+ // Keep pDispatcherQueue referenced in memory
2003
+ }
1983
2004
1984
- ULONGLONG finalTime = GetTickCount64 ();
1985
- printf ("EnsureXAML %lld ms.\n" , finalTime - initTime );
2005
+ ULONGLONG finalTime = GetTickCount64 ();
2006
+ printf ("[ EnsureXAML] %lld ms.\n" , finalTime - initTime );
1986
2007
1987
- cleanup3 :
1988
- if (pCoreWindow5 ) pCoreWindow5 -> lpVtbl -> Release (pCoreWindow5 );
1989
- cleanup2 :
1990
- if (hstringWindowsXamlManager ) WindowsDeleteString (hstringWindowsXamlManager );
1991
- cleanup1 :
1992
- if (pUIXamlApplicationFactory ) pUIXamlApplicationFactory -> lpVtbl -> Release (pUIXamlApplicationFactory );
1993
- cleanup0 :
1994
- if (hstringXamlApplication ) WindowsDeleteString (hstringXamlApplication );
1995
- cleanup :
1996
- ;
1997
- }
2008
+ cleanup3 :
2009
+ if (pCoreWindow5 ) pCoreWindow5 -> lpVtbl -> Release (pCoreWindow5 );
2010
+ cleanup2 :
2011
+ if (hstringWindowsXamlManager ) WindowsDeleteString (hstringWindowsXamlManager );
2012
+ cleanup1 :
2013
+ if (pXamlApplicationStatics ) pXamlApplicationStatics -> lpVtbl -> Release (pXamlApplicationStatics );
2014
+ cleanup0 :
2015
+ if (hstringXamlApplication ) WindowsDeleteString (hstringXamlApplication );
2016
+ cleanup :
2017
+ ;
1998
2018
}
1999
2019
2000
2020
HRESULT (* ICoreWindow5_get_DispatcherQueueFunc )(INT64 , INT64 );
@@ -8573,13 +8593,27 @@ HRESULT shell32_DriveTypeCategorizer_CreateInstanceHook(IUnknown* pUnkOuter, REF
8573
8593
8574
8594
8575
8595
#pragma region "File Explorer command bar and ribbon support"
8596
+ DEFINE_GUID (CLSID_XamlIslandViewAdapter ,
8597
+ 0x6480100B ,
8598
+ 0x5A83 , 0x4D1E , 0x9F , 0x69 ,
8599
+ 0x8A , 0xE5 , 0xA8 , 0x8E , 0x9A , 0x33
8600
+ );
8601
+
8576
8602
DEFINE_GUID (CLSID_UIRibbonFramework ,
8577
- 0x926749FA , 0x2615 , 0x4987 , 0x88 , 0x45 , 0xC3 , 0x3E , 0x65 , 0xF2 , 0xB9 , 0x57 );
8603
+ 0x926749FA ,
8604
+ 0x2615 , 0x4987 , 0x88 , 0x45 ,
8605
+ 0xC3 , 0x3E , 0x65 , 0xF2 , 0xB9 , 0x57
8606
+ );
8607
+
8578
8608
DEFINE_GUID (IID_UIRibbonFramework ,
8579
- 0xF4F0385D , 0x6872 , 0x43A8 , 0xAD , 0x09 , 0x4C , 0x33 , 0x9C , 0xB3 , 0xF5 , 0xC5 );
8609
+ 0xF4F0385D ,
8610
+ 0x6872 , 0x43A8 , 0xAD , 0x09 ,
8611
+ 0x4C , 0x33 , 0x9C , 0xB3 , 0xF5 , 0xC5
8612
+ );
8613
+
8580
8614
HRESULT ExplorerFrame_CoCreateInstanceHook (REFCLSID rclsid , LPUNKNOWN pUnkOuter , DWORD dwClsContext , REFIID riid , LPVOID * ppv )
8581
8615
{
8582
- if (( dwFileExplorerCommandUI != 0 ) && * ( INT64 * ) & rclsid -> Data1 == 0x4D1E5A836480100B && * ( INT64 * ) rclsid -> Data4 == 0x339A8EA8E58A699F )
8616
+ if (dwFileExplorerCommandUI != 0 && IsEqualCLSID ( rclsid , & CLSID_XamlIslandViewAdapter ) )
8583
8617
{
8584
8618
return REGDB_E_CLASSNOTREG ;
8585
8619
}
@@ -9643,6 +9677,29 @@ int RtlQueryFeatureConfigurationHook(UINT32 featureId, int sectionType, INT64* c
9643
9677
// flyouts alignment, notification center alignment, Windows key shortcuts on
9644
9678
// OS builds 22621.1413+
9645
9679
//
9680
+ // Removed in 22621.2134+
9681
+ //
9682
+ buffer -> enabledState = FEATURE_ENABLED_STATE_DISABLED ;
9683
+ }
9684
+ break ;
9685
+ }
9686
+ #endif
9687
+ #if 1
9688
+ case 40729001 : // WASDKInFileExplorer
9689
+ {
9690
+ if (dwFileExplorerCommandUI != 0 )
9691
+ {
9692
+ // Disable the new Windows App SDK views (in Home and Gallery) when not using the Windows 11 command bar
9693
+ //
9694
+ // There is an issue where Explorer crashes when one goes to a page with WASDK, goes to another page
9695
+ // without WASDK, and returning to a page with WASDK.
9696
+ //
9697
+ // However this also disables the new Gallery page altogether.
9698
+ // TODO- We have to find a way to either fix the crashing or make Gallery use the non WASDK view in the
9699
+ // TODO same way as when Explorer is opened into Control Panel then going to Gallery.
9700
+ //
9701
+ // TODO- We cannot rely on feature flag patches because they will eventually be removed.
9702
+ //
9646
9703
buffer -> enabledState = FEATURE_ENABLED_STATE_DISABLED ;
9647
9704
}
9648
9705
break ;
@@ -11521,7 +11578,6 @@ DWORD Inject(BOOL bIsExplorer)
11521
11578
ArchiveMenuThread ,
11522
11579
params ,
11523
11580
0 ,
11524
- 0 ,
11525
11581
0
11526
11582
);
11527
11583
}
0 commit comments