@ -2488,7 +2488,7 @@ LRESULT CALLBACK Shell_TrayWndMouseProc(
return CallNextHookEx ( Shell_TrayWndMouseHook , nCode , wParam , lParam ) ;
return CallNextHookEx ( Shell_TrayWndMouseHook , nCode , wParam , lParam ) ;
}
}
struct ITrayUIHost * g_pTrayUIHost ;
ITrayUIHost * g_pTrayUIHost ;
INT64 Shell_TrayWndSubclassProc (
INT64 Shell_TrayWndSubclassProc (
_In_ HWND hWnd ,
_In_ HWND hWnd ,
@ -2574,8 +2574,8 @@ INT64 Shell_TrayWndSubclassProc(
if ( g_pTrayUIHost )
if ( g_pTrayUIHost )
{
{
void * * pTrayUIHostVtbl = * ( void * * * ) g_pTrayUIHost ;
void * * pTrayUIHostVtbl = * ( void * * * ) g_pTrayUIHost ;
BOOL ( * ShouldDeleteContextMenuUndo ) ( struct ITrayUIHost * ) = pTrayUIHostVtbl [ 13 ] ;
BOOL ( * ShouldDeleteContextMenuUndo ) ( ITrayUIHost * ) = pTrayUIHostVtbl [ 13 ] ;
UINT ( * GetContextMenuUndoResourceId ) ( struct ITrayUIHost * ) = pTrayUIHostVtbl [ 14 ] ;
UINT ( * GetContextMenuUndoResourceId ) ( ITrayUIHost * ) = pTrayUIHostVtbl [ 14 ] ;
if ( ShouldDeleteContextMenuUndo ( g_pTrayUIHost ) )
if ( ShouldDeleteContextMenuUndo ( g_pTrayUIHost ) )
{
{
@ -4433,39 +4433,6 @@ INT64 winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageHo
# pragma endregion
# pragma endregion
# pragma region "Enable old taskbar"
# ifdef _WIN64
HRESULT ( * explorer_RoGetActivationFactoryFunc ) ( HSTRING activatableClassId , GUID * iid , void * * factory ) ;
HRESULT explorer_RoGetActivationFactoryHook ( HSTRING activatableClassId , GUID * iid , void * * factory )
{
PCWSTR StringRawBuffer = WindowsGetStringRawBuffer ( activatableClassId , 0 ) ;
if ( ! wcscmp ( StringRawBuffer , L " WindowsUdk.ApplicationModel.AppExtensions.XamlExtensions " ) )
{
if ( IsEqualGUID ( iid , & IID_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics ) )
{
* factory = & instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics ;
return S_OK ;
}
if ( IsEqualGUID ( iid , & IID_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2 ) )
{
* factory = & instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2 ;
return S_OK ;
}
}
return explorer_RoGetActivationFactoryFunc ( activatableClassId , iid , factory ) ;
}
FARPROC explorer_GetProcAddressHook ( HMODULE hModule , const CHAR * lpProcName )
{
if ( ( * ( ( WORD * ) & ( lpProcName ) + 1 ) ) & & ! strncmp ( lpProcName , " RoGetActivationFactory " , 22 ) )
return ( FARPROC ) explorer_RoGetActivationFactoryHook ;
else
return GetProcAddress ( hModule , lpProcName ) ;
}
# endif
# pragma endregion
# pragma region "Open power user menu on Win+X"
# pragma region "Open power user menu on Win+X"
# ifdef _WIN64
# ifdef _WIN64
LRESULT explorer_SendMessageW ( HWND hWndx , UINT uMsg , WPARAM wParam , LPARAM lParam )
LRESULT explorer_SendMessageW ( HWND hWndx , UINT uMsg , WPARAM wParam , LPARAM lParam )
@ -8689,7 +8656,7 @@ DEFINE_GUID(CLSID_UIRibbonFramework,
0xC3 , 0x3E , 0x65 , 0xF2 , 0xB9 , 0x57
0xC3 , 0x3E , 0x65 , 0xF2 , 0xB9 , 0x57
) ;
) ;
DEFINE_GUID ( IID_UIRibbonFramework ,
DEFINE_GUID ( IID_I UIRibbonFramework ,
0xF4F0385D ,
0xF4F0385D ,
0x6872 , 0x43A8 , 0xAD , 0x09 ,
0x6872 , 0x43A8 , 0xAD , 0x09 ,
0x4C , 0x33 , 0x9C , 0xB3 , 0xF5 , 0xC5
0x4C , 0x33 , 0x9C , 0xB3 , 0xF5 , 0xC5
@ -8697,12 +8664,14 @@ DEFINE_GUID(IID_UIRibbonFramework,
HRESULT ExplorerFrame_CoCreateInstanceHook ( REFCLSID rclsid , LPUNKNOWN pUnkOuter , DWORD dwClsContext , REFIID riid , LPVOID * ppv )
HRESULT ExplorerFrame_CoCreateInstanceHook ( REFCLSID rclsid , LPUNKNOWN pUnkOuter , DWORD dwClsContext , REFIID riid , LPVOID * ppv )
{
{
if ( dwFileExplorerCommandUI ! = 0 & & dwFileExplorerCommandUI ! = 3 & & dwFileExplorerCommandUI ! = 4 & & IsEqualCLSID ( rclsid , & CLSID_XamlIslandViewAdapter ) )
if ( IsEqualCLSID ( rclsid , & CLSID_XamlIslandViewAdapter ) )
{
{
if ( dwFileExplorerCommandUI ! = 0 & & dwFileExplorerCommandUI ! = 3 & & dwFileExplorerCommandUI ! = 4 )
return REGDB_E_CLASSNOTREG ;
return REGDB_E_CLASSNOTREG ;
}
}
if ( dwFileExplorerCommandUI = = 2 & & IsEqualCLSID ( rclsid , & CLSID_UIRibbonFramework ) & & IsEqualIID ( riid , & IID_UIRibbonFramework ) )
else if ( IsEqualCLSID ( rclsid , & CLSID_UIRibbonFramework ) & & IsEqualIID ( riid , & IID_I UIRibbonFramework ) )
{
{
if ( dwFileExplorerCommandUI = = 2 )
return REGDB_E_CLASSNOTREG ;
return REGDB_E_CLASSNOTREG ;
}
}
return CoCreateInstance ( rclsid , pUnkOuter , dwClsContext , riid , ppv ) ;
return CoCreateInstance ( rclsid , pUnkOuter , dwClsContext , riid , ppv ) ;
@ -8710,7 +8679,7 @@ HRESULT ExplorerFrame_CoCreateInstanceHook(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
# pragma endregion
# pragma endregion
# pragma region "Change language UI style"
# pragma region "Change language UI style + Enable old taskbar "
# ifdef _WIN64
# ifdef _WIN64
DEFINE_GUID ( CLSID_InputSwitchControl ,
DEFINE_GUID ( CLSID_InputSwitchControl ,
0xB9BC2A50 ,
0xB9BC2A50 ,
@ -8718,7 +8687,7 @@ DEFINE_GUID(CLSID_InputSwitchControl,
0x5D , 0xB1 , 0x4e , 0x18 , 0x4b , 0xae
0x5D , 0xB1 , 0x4e , 0x18 , 0x4b , 0xae
) ;
) ;
DEFINE_GUID ( IID_InputSwitchControl ,
DEFINE_GUID ( IID_II nputSwitchControl ,
0xB9BC2A50 ,
0xB9BC2A50 ,
0x43C3 , 0x41AA , 0xa0 , 0x82 ,
0x43C3 , 0x41AA , 0xa0 , 0x82 ,
0x5D , 0xB1 , 0x4e , 0x18 , 0x4b , 0xae
0x5D , 0xB1 , 0x4e , 0x18 , 0x4b , 0xae
@ -8857,6 +8826,12 @@ HRESULT CInputSwitchControl_ShowInputSwitchHook(IInputSwitchControl* _this, RECT
return CInputSwitchControl_ShowInputSwitchFunc ( _this , lpRect ) ;
return CInputSwitchControl_ShowInputSwitchFunc ( _this , lpRect ) ;
}
}
DEFINE_GUID ( CLSID_TrayUIComponent ,
0x88FC85D3 ,
0x7090 , 0x4F53 , 0x8F , 0x7A ,
0xEB , 0x02 , 0x68 , 0x16 , 0x27 , 0x88
) ;
HRESULT explorer_CoCreateInstanceHook (
HRESULT explorer_CoCreateInstanceHook (
REFCLSID rclsid ,
REFCLSID rclsid ,
LPUNKNOWN pUnkOuter ,
LPUNKNOWN pUnkOuter ,
@ -8865,10 +8840,10 @@ HRESULT explorer_CoCreateInstanceHook(
IUnknown * * ppv
IUnknown * * ppv
)
)
{
{
if ( IsEqualCLSID ( rclsid , & CLSID_InputSwitchControl ) & & IsEqualIID ( riid , & IID_InputSwitchControl ) )
if ( IsEqualCLSID ( rclsid , & CLSID_InputSwitchControl ) & & IsEqualIID ( riid , & IID_II nputSwitchControl ) )
{
{
HRESULT hr = CoCreateInstance ( rclsid , pUnkOuter , dwClsContext , riid , ppv ) ;
HRESULT hr = CoCreateInstance ( rclsid , pUnkOuter , dwClsContext , riid , ppv ) ;
if ( SUCCEEDED ( hr ) )
if ( SUCCEEDED ( hr ) & & bOldTaskbar & & dwIMEStyle )
{
{
// The commented method below is no longer required as I have now came to patching
// The commented method below is no longer required as I have now came to patching
// the interface's vtable.
// the interface's vtable.
@ -8939,6 +8914,14 @@ HRESULT explorer_CoCreateInstanceHook(
}
}
return hr ;
return hr ;
}
}
else if ( IsEqualCLSID ( rclsid , & CLSID_TrayUIComponent ) & & IsEqualIID ( riid , & IID_ITrayUIComponent ) )
{
if ( bOldTaskbar & & explorer_TrayUI_CreateInstanceFunc )
{
* ppv = & instanceof_ITrayUIComponent ;
return S_OK ;
}
}
return CoCreateInstance ( rclsid , pUnkOuter , dwClsContext , riid , ppv ) ;
return CoCreateInstance ( rclsid , pUnkOuter , dwClsContext , riid , ppv ) ;
}
}
# endif
# endif
@ -11845,10 +11828,6 @@ DWORD Inject(BOOL bIsExplorer)
{
{
VnPatchIAT ( hExplorer , " user32.dll " , ( LPCSTR ) 2005 , explorer_SetChildWindowNoActivateHook ) ;
VnPatchIAT ( hExplorer , " user32.dll " , ( LPCSTR ) 2005 , explorer_SetChildWindowNoActivateHook ) ;
VnPatchDelayIAT ( hExplorer , " ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll " , " SendMessageW " , explorer_SendMessageW ) ;
VnPatchDelayIAT ( hExplorer , " ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll " , " SendMessageW " , explorer_SendMessageW ) ;
// A certain configuration update in 23560.1000 broke this method, this didn't get called with
// "RoGetActivationFactory" anymore. ~~We're now hooking RoGetActivationFactory directly.~~ Pulled back for now.
explorer_RoGetActivationFactoryFunc = RoGetActivationFactory ;
VnPatchIAT ( hExplorer , " api-ms-win-core-libraryloader-l1-2-0.dll " , " GetProcAddress " , explorer_GetProcAddressHook ) ;
VnPatchIAT ( hExplorer , " shell32.dll " , " ShellExecuteW " , explorer_ShellExecuteW ) ;
VnPatchIAT ( hExplorer , " shell32.dll " , " ShellExecuteW " , explorer_ShellExecuteW ) ;
VnPatchIAT ( hExplorer , " shell32.dll " , " ShellExecuteExW " , explorer_ShellExecuteExW ) ;
VnPatchIAT ( hExplorer , " shell32.dll " , " ShellExecuteExW " , explorer_ShellExecuteExW ) ;
VnPatchIAT ( hExplorer , " API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL " , " RegGetValueW " , explorer_RegGetValueW ) ;
VnPatchIAT ( hExplorer , " API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL " , " RegGetValueW " , explorer_RegGetValueW ) ;
@ -11900,26 +11879,20 @@ DWORD Inject(BOOL bIsExplorer)
VnPatchIAT ( hExplorer , " user32.dll " , " SetWindowCompositionAttribute " , explorer_SetWindowCompositionAttribute ) ;
VnPatchIAT ( hExplorer , " user32.dll " , " SetWindowCompositionAttribute " , explorer_SetWindowCompositionAttribute ) ;
}
}
//VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "CreateWindowExW", explorer_CreateWindowExW);
//VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "CreateWindowExW", explorer_CreateWindowExW);
if ( bOldTaskbar & & dwIMEStyle )
{
VnPatchIAT ( hExplorer , " api-ms-win-core-com-l1-1-0.dll " , " CoCreateInstance " , explorer_CoCreateInstanceHook ) ;
}
if ( bOldTaskbar )
if ( bOldTaskbar )
{
{
VnPatchIAT ( hExplorer , " api-ms-win-core-com-l1-1-0.dll " , " CoCreateInstance " , explorer_CoCreateInstanceHook ) ;
VnPatchIAT ( hExplorer , " API-MS-WIN-NTUSER-RECTANGLE-L1-1-0.DLL " , " SetRect " , explorer_SetRect ) ;
VnPatchIAT ( hExplorer , " API-MS-WIN-NTUSER-RECTANGLE-L1-1-0.DLL " , " SetRect " , explorer_SetRect ) ;
}
if ( bOldTaskbar )
{
VnPatchIAT ( hExplorer , " USER32.DLL " , " DeleteMenu " , explorer_DeleteMenu ) ;
VnPatchIAT ( hExplorer , " USER32.DLL " , " DeleteMenu " , explorer_DeleteMenu ) ;
}
if ( global_rovi . dwBuildNumber > = 22572 )
if ( bOldTaskbar & & global_rovi . dwBuildNumber > = 22572 )
{
{
VnPatchIAT ( hExplorer , " dwmapi.dll " , " DwmUpdateThumbnailProperties " , explorer_DwmUpdateThumbnailPropertiesHook ) ;
VnPatchIAT ( hExplorer , " dwmapi.dll " , " DwmUpdateThumbnailProperties " , explorer_DwmUpdateThumbnailPropertiesHook ) ;
PatchExplorer_UpdateWindowAccentProperties ( ) ;
PatchExplorer_UpdateWindowAccentProperties ( ) ;
}
}
}
if ( IsWindows11 ( ) )
if ( IsWindows11 ( ) )
{
{
// Find a pointer to ITrayUIHost needed to have a working Windows 10 taskbar context menu on Windows 11 taskbar
// Find pointers to various stuff needed to have a working Windows 10 taskbar and Windows 10 taskbar context menu on Windows 11 taskbar
// Ref: CTray::Init()
// Ref: CTray::Init()
// 4C 8D 05 ? ? ? ? 48 8D 0D ? ? ? ? E8 ? ? ? ? 48 8B
// 4C 8D 05 ? ? ? ? 48 8D 0D ? ? ? ? E8 ? ? ? ? 48 8B
// ^^^^^^^ ^^^^^^^
// ^^^^^^^ ^^^^^^^
@ -11933,14 +11906,14 @@ DWORD Inject(BOOL bIsExplorer)
{
{
match + = 7 ; // Point to 48
match + = 7 ; // Point to 48
g_pTrayUIHost = match + 7 + * ( int * ) ( match + 3 ) ;
g_pTrayUIHost = match + 7 + * ( int * ) ( match + 3 ) ;
// match += 7; // Point to E8
match + = 7 ; // Point to E8
// explorer_TrayUI_CreateInstanceFunc = match + 5 + *(int*)(match + 1);
explorer_TrayUI_CreateInstanceFunc = match + 5 + * ( int * ) ( match + 1 ) ;
printf ( " ITrayUIHost = %llX \n " , ( PBYTE ) g_pTrayUIHost - ( PBYTE ) hExplorer ) ;
printf ( " ITrayUIHost = %llX \n " , ( PBYTE ) g_pTrayUIHost - ( PBYTE ) hExplorer ) ;
// printf("explorer.exe!TrayUI_CreateInstance() = %llX\n", (PBYTE)explorer_TrayUI_CreateInstanceFunc - (PBYTE)hExplorer);
printf ( " explorer.exe!TrayUI_CreateInstance() = %llX \n " , ( PBYTE ) explorer_TrayUI_CreateInstanceFunc - ( PBYTE ) hExplorer ) ;
}
}
else
else
{
{
printf ( " Failed to find ITrayUIHost, the custom Windows 11 taskbar context menu will not have the undo function \n " ) ;
printf ( " Failed to find ITrayUIHost \n " ) ;
}
}
}
}
@ -12181,23 +12154,6 @@ DWORD Inject(BOOL bIsExplorer)
HANDLE hCombase = LoadLibraryW ( L " combase.dll " ) ;
HANDLE hCombase = LoadLibraryW ( L " combase.dll " ) ;
if ( IsWindows11 ( ) )
if ( IsWindows11 ( ) )
{
{
/*if (bOldTaskbar) // TODO Pulled back for now, crashes on 22621.2428
{
// Hook RoGetActivationFactory() for old taskbar
explorer_RoGetActivationFactoryFunc = GetProcAddress ( hCombase , " RoGetActivationFactory " ) ;
if ( explorer_RoGetActivationFactoryFunc )
{
rv = funchook_prepare (
funchook ,
( void * * ) & explorer_RoGetActivationFactoryFunc ,
explorer_RoGetActivationFactoryHook
) ;
}
if ( rv ! = 0 )
{
printf ( " Failed to hook RoGetActivationFactory(). rv = %d \n " , rv ) ;
}
} */
if ( IsWindows11Version22H2OrHigher ( ) )
if ( IsWindows11Version22H2OrHigher ( ) )
{
{
// Fixed a bug that crashed Explorer when a folder window was opened after a first one was closed on OS builds 22621+
// Fixed a bug that crashed Explorer when a folder window was opened after a first one was closed on OS builds 22621+
@ -12259,6 +12215,8 @@ DWORD Inject(BOOL bIsExplorer)
HANDLE hPnidui = LoadLibraryW ( L " pnidui.dll " ) ;
HANDLE hPnidui = LoadLibraryW ( L " pnidui.dll " ) ;
if ( hPnidui )
{
VnPatchIAT ( hPnidui , " api-ms-win-core-com-l1-1-0.dll " , " CoCreateInstance " , pnidui_CoCreateInstanceHook ) ;
VnPatchIAT ( hPnidui , " api-ms-win-core-com-l1-1-0.dll " , " CoCreateInstance " , pnidui_CoCreateInstanceHook ) ;
VnPatchIAT ( hPnidui , " user32.dll " , " TrackPopupMenu " , pnidui_TrackPopupMenuHook ) ;
VnPatchIAT ( hPnidui , " user32.dll " , " TrackPopupMenu " , pnidui_TrackPopupMenuHook ) ;
HOOK_IMMERSIVE_MENUS ( Pnidui ) ;
HOOK_IMMERSIVE_MENUS ( Pnidui ) ;
@ -12269,6 +12227,7 @@ DWORD Inject(BOOL bIsExplorer)
}
}
# endif
# endif
printf ( " Setup pnidui functions done \n " ) ;
printf ( " Setup pnidui functions done \n " ) ;
}
# ifdef _WIN64
# ifdef _WIN64
@ -12395,6 +12354,8 @@ DWORD Inject(BOOL bIsExplorer)
}
}
}
}
if ( bOldTaskbar )
{
MODULEINFO mi ;
MODULEINFO mi ;
GetModuleInformation ( GetCurrentProcess ( ) , hWindowsudkShellcommon , & mi , sizeof ( MODULEINFO ) ) ;
GetModuleInformation ( GetCurrentProcess ( ) , hWindowsudkShellcommon , & mi , sizeof ( MODULEINFO ) ) ;
@ -12423,6 +12384,7 @@ DWORD Inject(BOOL bIsExplorer)
printf ( " Setup windowsudk.shellcommon functions done \n " ) ;
printf ( " Setup windowsudk.shellcommon functions done \n " ) ;
}
}
}
}
}