mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-30 18:24:36 +01:00
Taskbar10: Various *important* fixes:
- Revised the method for enabling the old taskbar by intercepting the code path for initializing the new taskbar, due to a very rare issue where our hook does not get called on certain recent builds. (#2499) - Fixed crash on 25921+ due to the removal of pnidui.dll. (#2558) - Fixed potential stability issues when using the new taskbar on 22621.2787+.
This commit is contained in:
parent
a7a3d2727c
commit
ec68783677
@ -281,6 +281,10 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Taskbar10.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TaskbarCenter.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
</ExcludedFromBuild>
|
||||
|
45
ExplorerPatcher/Taskbar10.c
Normal file
45
ExplorerPatcher/Taskbar10.c
Normal file
@ -0,0 +1,45 @@
|
||||
#include "utility.h"
|
||||
|
||||
#pragma region "Enable old taskbar"
|
||||
/***
|
||||
Our target is in `CTray::Init()`. It constructs either the Windows 11 or the Windows 10 taskbar based on the result of
|
||||
`winrt::WindowsUdk::ApplicationModel::AppExtensions::XamlExtensions::IsExtensionAvailable()`. We can to make the last
|
||||
argument of that function be set to false, so that we'll get the Windows 10 taskbar instead of the Windows 11 one that
|
||||
gets constructed through `CTray::InitializeTrayUIComponent()`.
|
||||
|
||||
Alternatively, we can modify the behavior of `CTray::InitializeTrayUIComponent`. It contains the code to call
|
||||
`TrayUI_CreateInstance()` that resides in `Taskbar.dll` (checked through HKLM\SOFTWARE\Classes\CLSID\<the CLSID>) which
|
||||
is a copy of the Windows 10 taskbar code but modified over the time to support the Windows 11 taskbar. We see that it
|
||||
calls `CoCreateInstance` to get an `ITrayUIComponent` interface to an instance of `TrayUIComponent`. We hook that
|
||||
function to make it return our own custom `ITrayUIComponent` instance. Our `ITrayUIComponent::InitializeWithTray()`
|
||||
function calls `TrayUI_CreateInstance()` of `explorer.exe` that is also called when the last argument of
|
||||
`IsExtensionAvailable()` after the call is false.
|
||||
|
||||
This way, we can get the Windows 10 taskbar which resides in explorer.exe without hooking LoadLibraryExW() in order to
|
||||
perform our initial method which has been known to be inconsistent on some systems. (Thanks feature flags!)
|
||||
***/
|
||||
|
||||
static ULONG STDMETHODCALLTYPE nimplAddRefRelease(IUnknown* This)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE ITrayUIComponent_QueryInterface(ITrayUIComponent* This, REFIID riid, void** ppvObject)
|
||||
{
|
||||
// Should never be called
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE ITrayUIComponent_InitializeWithTray(ITrayUIComponent* This, ITrayUIHost* host, ITrayUI** result)
|
||||
{
|
||||
return explorer_TrayUI_CreateInstanceFunc(host, &IID_ITrayUI, (void**)result);
|
||||
}
|
||||
|
||||
static const ITrayUIComponentVtbl instanceof_ITrayUIComponentVtbl = {
|
||||
.QueryInterface = ITrayUIComponent_QueryInterface,
|
||||
.AddRef = nimplAddRefRelease,
|
||||
.Release = nimplAddRefRelease,
|
||||
.InitializeWithTray = ITrayUIComponent_InitializeWithTray
|
||||
};
|
||||
const ITrayUIComponent instanceof_ITrayUIComponent = { &instanceof_ITrayUIComponentVtbl };
|
||||
#pragma endregion
|
@ -2488,7 +2488,7 @@ LRESULT CALLBACK Shell_TrayWndMouseProc(
|
||||
return CallNextHookEx(Shell_TrayWndMouseHook, nCode, wParam, lParam);
|
||||
}
|
||||
|
||||
struct ITrayUIHost* g_pTrayUIHost;
|
||||
ITrayUIHost* g_pTrayUIHost;
|
||||
|
||||
INT64 Shell_TrayWndSubclassProc(
|
||||
_In_ HWND hWnd,
|
||||
@ -2574,8 +2574,8 @@ INT64 Shell_TrayWndSubclassProc(
|
||||
if (g_pTrayUIHost)
|
||||
{
|
||||
void** pTrayUIHostVtbl = *(void***)g_pTrayUIHost;
|
||||
BOOL(*ShouldDeleteContextMenuUndo)(struct ITrayUIHost*) = pTrayUIHostVtbl[13];
|
||||
UINT(*GetContextMenuUndoResourceId)(struct ITrayUIHost*) = pTrayUIHostVtbl[14];
|
||||
BOOL(*ShouldDeleteContextMenuUndo)(ITrayUIHost*) = pTrayUIHostVtbl[13];
|
||||
UINT(*GetContextMenuUndoResourceId)(ITrayUIHost*) = pTrayUIHostVtbl[14];
|
||||
|
||||
if (ShouldDeleteContextMenuUndo(g_pTrayUIHost))
|
||||
{
|
||||
@ -4433,39 +4433,6 @@ INT64 winrt_Windows_Internal_Shell_implementation_MeetAndChatManager_OnMessageHo
|
||||
#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"
|
||||
#ifdef _WIN64
|
||||
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
|
||||
);
|
||||
|
||||
DEFINE_GUID(IID_UIRibbonFramework,
|
||||
DEFINE_GUID(IID_IUIRibbonFramework,
|
||||
0xF4F0385D,
|
||||
0x6872, 0x43A8, 0xAD, 0x09,
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
if (dwFileExplorerCommandUI == 2 && IsEqualCLSID(rclsid, &CLSID_UIRibbonFramework) && IsEqualIID(riid, &IID_UIRibbonFramework))
|
||||
else if (IsEqualCLSID(rclsid, &CLSID_UIRibbonFramework) && IsEqualIID(riid, &IID_IUIRibbonFramework))
|
||||
{
|
||||
if (dwFileExplorerCommandUI == 2)
|
||||
return REGDB_E_CLASSNOTREG;
|
||||
}
|
||||
return CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);
|
||||
@ -8710,7 +8679,7 @@ HRESULT ExplorerFrame_CoCreateInstanceHook(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
|
||||
#pragma endregion
|
||||
|
||||
|
||||
#pragma region "Change language UI style"
|
||||
#pragma region "Change language UI style + Enable old taskbar"
|
||||
#ifdef _WIN64
|
||||
DEFINE_GUID(CLSID_InputSwitchControl,
|
||||
0xB9BC2A50,
|
||||
@ -8718,7 +8687,7 @@ DEFINE_GUID(CLSID_InputSwitchControl,
|
||||
0x5D, 0xB1, 0x4e, 0x18, 0x4b, 0xae
|
||||
);
|
||||
|
||||
DEFINE_GUID(IID_InputSwitchControl,
|
||||
DEFINE_GUID(IID_IInputSwitchControl,
|
||||
0xB9BC2A50,
|
||||
0x43C3, 0x41AA, 0xa0, 0x82,
|
||||
0x5D, 0xB1, 0x4e, 0x18, 0x4b, 0xae
|
||||
@ -8857,6 +8826,12 @@ HRESULT CInputSwitchControl_ShowInputSwitchHook(IInputSwitchControl* _this, RECT
|
||||
return CInputSwitchControl_ShowInputSwitchFunc(_this, lpRect);
|
||||
}
|
||||
|
||||
DEFINE_GUID(CLSID_TrayUIComponent,
|
||||
0x88FC85D3,
|
||||
0x7090, 0x4F53, 0x8F, 0x7A,
|
||||
0xEB, 0x02, 0x68, 0x16, 0x27, 0x88
|
||||
);
|
||||
|
||||
HRESULT explorer_CoCreateInstanceHook(
|
||||
REFCLSID rclsid,
|
||||
LPUNKNOWN pUnkOuter,
|
||||
@ -8865,10 +8840,10 @@ HRESULT explorer_CoCreateInstanceHook(
|
||||
IUnknown** ppv
|
||||
)
|
||||
{
|
||||
if (IsEqualCLSID(rclsid, &CLSID_InputSwitchControl) && IsEqualIID(riid, &IID_InputSwitchControl))
|
||||
if (IsEqualCLSID(rclsid, &CLSID_InputSwitchControl) && IsEqualIID(riid, &IID_IInputSwitchControl))
|
||||
{
|
||||
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 interface's vtable.
|
||||
@ -8939,6 +8914,14 @@ HRESULT explorer_CoCreateInstanceHook(
|
||||
}
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
@ -11845,10 +11828,6 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
{
|
||||
VnPatchIAT(hExplorer, "user32.dll", (LPCSTR)2005, explorer_SetChildWindowNoActivateHook);
|
||||
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", "ShellExecuteExW", explorer_ShellExecuteExW);
|
||||
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);
|
||||
}
|
||||
//VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "CreateWindowExW", explorer_CreateWindowExW);
|
||||
if (bOldTaskbar && dwIMEStyle)
|
||||
if (bOldTaskbar)
|
||||
{
|
||||
VnPatchIAT(hExplorer, "api-ms-win-core-com-l1-1-0.dll", "CoCreateInstance", explorer_CoCreateInstanceHook);
|
||||
}
|
||||
if (bOldTaskbar)
|
||||
{
|
||||
VnPatchIAT(hExplorer, "API-MS-WIN-NTUSER-RECTANGLE-L1-1-0.DLL", "SetRect", explorer_SetRect);
|
||||
}
|
||||
if (bOldTaskbar)
|
||||
{
|
||||
VnPatchIAT(hExplorer, "USER32.DLL", "DeleteMenu", explorer_DeleteMenu);
|
||||
}
|
||||
if (bOldTaskbar && global_rovi.dwBuildNumber >= 22572)
|
||||
if (global_rovi.dwBuildNumber >= 22572)
|
||||
{
|
||||
VnPatchIAT(hExplorer, "dwmapi.dll", "DwmUpdateThumbnailProperties", explorer_DwmUpdateThumbnailPropertiesHook);
|
||||
PatchExplorer_UpdateWindowAccentProperties();
|
||||
}
|
||||
}
|
||||
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()
|
||||
// 4C 8D 05 ? ? ? ? 48 8D 0D ? ? ? ? E8 ? ? ? ? 48 8B
|
||||
// ^^^^^^^ ^^^^^^^
|
||||
@ -11933,14 +11906,14 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
{
|
||||
match += 7; // Point to 48
|
||||
g_pTrayUIHost = match + 7 + *(int*)(match + 3);
|
||||
// match += 7; // Point to E8
|
||||
// explorer_TrayUI_CreateInstanceFunc = match + 5 + *(int*)(match + 1);
|
||||
match += 7; // Point to E8
|
||||
explorer_TrayUI_CreateInstanceFunc = match + 5 + *(int*)(match + 1);
|
||||
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
|
||||
{
|
||||
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");
|
||||
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())
|
||||
{
|
||||
// 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");
|
||||
if (hPnidui)
|
||||
{
|
||||
VnPatchIAT(hPnidui, "api-ms-win-core-com-l1-1-0.dll", "CoCreateInstance", pnidui_CoCreateInstanceHook);
|
||||
VnPatchIAT(hPnidui, "user32.dll", "TrackPopupMenu", pnidui_TrackPopupMenuHook);
|
||||
HOOK_IMMERSIVE_MENUS(Pnidui);
|
||||
@ -12269,6 +12227,7 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
}
|
||||
#endif
|
||||
printf("Setup pnidui functions done\n");
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN64
|
||||
@ -12395,6 +12354,8 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
}
|
||||
}
|
||||
|
||||
if (bOldTaskbar)
|
||||
{
|
||||
MODULEINFO mi;
|
||||
GetModuleInformation(GetCurrentProcess(), hWindowsudkShellcommon, &mi, sizeof(MODULEINFO));
|
||||
|
||||
@ -12423,6 +12384,7 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
printf("Setup windowsudk.shellcommon functions done\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -5,127 +5,6 @@
|
||||
RTL_OSVERSIONINFOW global_rovi;
|
||||
DWORD32 global_ubr;
|
||||
|
||||
#pragma region "Weird stuff"
|
||||
/***
|
||||
Let me explain the weird stuff. This was not documented here before so updating this was a hell of a task.
|
||||
|
||||
Our target is in `CTray::Init()`. It constructs either the Windows 11 or the Windows 10 taskbar based on the result of
|
||||
`winrt::WindowsUdk::ApplicationModel::AppExtensions::XamlExtensions::IsExtensionAvailable()`. We have to make the last
|
||||
argument of that function be set to false, so that we'll get the Windows 10 taskbar. In order to make a patch that does
|
||||
not use patterns, we hook `RoGetActivationFactory` and return a dummy object with our own specially crafted vtable.
|
||||
|
||||
So the calls are as follows:
|
||||
|
||||
`CTray::Init()` calls `factory_cache_entry<XamlExtensions, IXamlExtensionsStatics>::call()` to get an interface to
|
||||
`XamlExtensions` (located in windowsudk.shellcommon.dll) through `IXamlExtensionsStatics`. First, the factory cache
|
||||
system tries to retrieve its activation factory. It calls `RoGetActivationFactory` with the `IID` of
|
||||
`IXamlExtensionsStatics`. Our hook makes that function return a dummy `IXamlExtensionsStatics` with our own vtable.
|
||||
Despite the name, it is an activation factory. (Ref: `explorer_RoGetActivationFactoryHook()` in dllmain.c)
|
||||
|
||||
Then, the cache system checks if the factory implements `IAgileObject` by calling `QueryInterface(IID_IAgileObject)` of
|
||||
the factory. This will be used to determine if the factory should be cached or not. We intercept this call and do
|
||||
nothing to make the process easy, so the factory will never be cached. In reality, `XamlExtensions` does not implement
|
||||
`IAgileObject`.
|
||||
|
||||
Then, the cache system calls the lambda that's passed into `factory_cache_entry<~>::call()` in order to retrieve an
|
||||
interface that can be used. The lambda that `CTray::Init()` passes into the system, retrieves an instance of
|
||||
`XamlExtensions` by calling `IXamlExtensionsStatics::Current()` of the factory using COM. Here, we intercept the call
|
||||
through our custom `IXamlExtensionsStatics` vtable and return a dummy `XamlExtensions` instance with our own vtable
|
||||
whose `QueryInterface()` with the IID of `IXamlExtensions2` returns a dummy `IXamlExtensions2` with our own vtable.
|
||||
|
||||
On builds with the "Never combine" feature on the new taskbar, it uses `IXamlExtensionsStatics2::GetForCategory()`
|
||||
instead of `IXamlExtensionsStatics::Current()`.
|
||||
|
||||
Now that `CTray::Init()` has an instance of `XamlExtensions`, it calls `IXamlExtensions2::IsExtensionAvailable()`.
|
||||
As the name says, if the extension (or Windows 11 taskbar) is available, `CTray::Init()` will continue to make the
|
||||
Windows 11 taskbar through `CTray::InitializeTrayUIComponent()`. Otherwise, it will make the Windows 10 taskbar through
|
||||
`TrayUI_CreateInstance()` that has been since ages.
|
||||
|
||||
`CTray::Init()` gets that value through the `IXamlExtensions2` interface of the `XamlExtensions` instance. COM calls are
|
||||
made, which are `QueryInterface(IID_IXamlExtensions2)` and `IXamlExtensions2::IsExtensionAvailable()` itself. We
|
||||
intercept the former call through our custom vtable for our dummy `XamlExtensions` instance to return a dummy
|
||||
`IXamlExtensions2` with our own vtable too. Then, we intercept the latter call through our custom `IXamlExtensions2`
|
||||
vtable to have the last argument set to false, and now we have the good old taskbar.
|
||||
***/
|
||||
|
||||
static ULONG STDMETHODCALLTYPE nimplAddRefRelease(IUnknown* This)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE nimplReturnHResultNotImpl(IUnknown* This)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics_QueryInterface(WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics* This, REFIID riid, void** ppvObject)
|
||||
{
|
||||
// Should only be called with IID_IAgileObject
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics_Current(WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics* This, void** _instance_of_winrt_WindowsUdk_ApplicationModel_AppExtensions_XamlExtensions)
|
||||
{
|
||||
*_instance_of_winrt_WindowsUdk_ApplicationModel_AppExtensions_XamlExtensions = &instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2_GetForCategory(WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2* This, HSTRING a2, void** _instance_of_winrt_WindowsUdk_ApplicationModel_AppExtensions_XamlExtensions)
|
||||
{
|
||||
*_instance_of_winrt_WindowsUdk_ApplicationModel_AppExtensions_XamlExtensions = &instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2_QueryInterface(WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2* This, REFIID riid, void** ppvObject)
|
||||
{
|
||||
if (IsEqualIID(riid, &IID_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2))
|
||||
{
|
||||
*ppvObject = &instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2;
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2_IsExtensionAvailable(WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2* This, HSTRING a2, HSTRING a3, BYTE* a4)
|
||||
{
|
||||
*a4 = 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStaticsVtbl instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStaticsVtbl = {
|
||||
.QueryInterface = WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics_QueryInterface,
|
||||
.AddRef = nimplAddRefRelease,
|
||||
.Release = nimplAddRefRelease,
|
||||
.GetIids = nimplReturnHResultNotImpl,
|
||||
.GetRuntimeClassName = nimplReturnHResultNotImpl,
|
||||
.GetTrustLevel = nimplReturnHResultNotImpl,
|
||||
.Current = WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics_Current
|
||||
};
|
||||
const WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics = { &instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStaticsVtbl };
|
||||
|
||||
static const WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2Vtbl instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2Vtbl = {
|
||||
.QueryInterface = WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics_QueryInterface,
|
||||
.AddRef = nimplAddRefRelease,
|
||||
.Release = nimplAddRefRelease,
|
||||
.GetIids = nimplReturnHResultNotImpl,
|
||||
.GetRuntimeClassName = nimplReturnHResultNotImpl,
|
||||
.GetTrustLevel = nimplReturnHResultNotImpl,
|
||||
.GetForCategory = WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2_GetForCategory
|
||||
};
|
||||
const WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2 instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2 = { &instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2Vtbl };
|
||||
|
||||
static const WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2Vtbl instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2Vtbl = {
|
||||
.QueryInterface = WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2_QueryInterface,
|
||||
.AddRef = nimplAddRefRelease,
|
||||
.Release = nimplAddRefRelease,
|
||||
.GetIids = nimplReturnHResultNotImpl,
|
||||
.GetRuntimeClassName = nimplReturnHResultNotImpl,
|
||||
.GetTrustLevel = nimplReturnHResultNotImpl,
|
||||
.IsExtensionAvailable = WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2_IsExtensionAvailable
|
||||
};
|
||||
const WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2 instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2 = { &instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2Vtbl };
|
||||
#pragma endregion
|
||||
|
||||
void printf_guid(GUID guid)
|
||||
{
|
||||
printf("Guid = {%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}\n",
|
||||
|
@ -81,160 +81,55 @@ HRESULT ShellExecuteFromExplorer(
|
||||
|
||||
void ToggleTaskbarAutohide();
|
||||
|
||||
#pragma region "Weird stuff"
|
||||
typedef interface WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics;
|
||||
#pragma region "Enable old taskbar"
|
||||
typedef interface ITrayUIHost ITrayUIHost;
|
||||
|
||||
DEFINE_GUID(IID_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics,
|
||||
0x18c02f2e,
|
||||
0x2754, 0x5a20, 0x8b, 0xd5,
|
||||
0x0b, 0x34, 0xce, 0x79, 0xda, 0x2b
|
||||
typedef interface ITrayUI ITrayUI;
|
||||
|
||||
DEFINE_GUID(IID_ITrayUI,
|
||||
0x12b454e1,
|
||||
0x6e50, 0x42b8, 0xbc, 0x3e,
|
||||
0xae, 0x7f, 0x54, 0x91, 0x99, 0xd6
|
||||
);
|
||||
|
||||
typedef struct WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStaticsVtbl // : IInspectableVtbl
|
||||
typedef interface ITrayUIComponent ITrayUIComponent;
|
||||
|
||||
DEFINE_GUID(IID_ITrayUIComponent,
|
||||
0x27775f88,
|
||||
0x01d3, 0x46ec, 0xa1, 0xc1,
|
||||
0x64, 0xb4, 0xc0, 0x9b, 0x21, 0x1b
|
||||
);
|
||||
|
||||
typedef struct ITrayUIComponentVtbl // : IUnknownVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* QueryInterface)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics* This,
|
||||
__RPC__in ITrayUIComponent* This,
|
||||
/* [in] */ __RPC__in REFIID riid,
|
||||
/* [annotation][iid_is][out] */
|
||||
_COM_Outptr_ void** ppvObject);
|
||||
|
||||
ULONG(STDMETHODCALLTYPE* AddRef)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics* This);
|
||||
__RPC__in ITrayUIComponent* This);
|
||||
|
||||
ULONG(STDMETHODCALLTYPE* Release)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics* This);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* GetIids)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics* This,
|
||||
/* [out] */ __RPC__out ULONG* iidCount,
|
||||
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics* This,
|
||||
/* [out] */ __RPC__deref_out_opt HSTRING* className);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics* This,
|
||||
/* [out] */ __RPC__out TrustLevel* trustLevel);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* Current)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics* This,
|
||||
/* [out] */ __RPC__out void** _instance_of_winrt_WindowsUdk_ApplicationModel_AppExtensions_XamlExtensions);
|
||||
__RPC__in ITrayUIComponent* This);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* InitializeWithTray)(
|
||||
__RPC__in ITrayUIComponent* This,
|
||||
/* [in] */ __RPC__in ITrayUIHost* host,
|
||||
/* [out] */ __RPC__out ITrayUI** result);
|
||||
END_INTERFACE
|
||||
} WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStaticsVtbl;
|
||||
} ITrayUIComponentVtbl;
|
||||
|
||||
interface WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics // : IInspectable
|
||||
interface ITrayUIComponent // : IInspectable
|
||||
{
|
||||
const struct WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStaticsVtbl* lpVtbl;
|
||||
const struct ITrayUIComponentVtbl* lpVtbl;
|
||||
};
|
||||
|
||||
typedef interface WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2 WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2;
|
||||
|
||||
DEFINE_GUID(IID_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2,
|
||||
0x0fe87da5,
|
||||
0xa7a6, 0x5de3, 0x83, 0x5f,
|
||||
0xd9, 0x8c, 0x87, 0x56, 0x01, 0x44
|
||||
);
|
||||
|
||||
typedef struct WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2Vtbl // : IInspectableVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* QueryInterface)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2* This,
|
||||
/* [in] */ __RPC__in REFIID riid,
|
||||
/* [annotation][iid_is][out] */
|
||||
_COM_Outptr_ void** ppvObject);
|
||||
|
||||
ULONG(STDMETHODCALLTYPE* AddRef)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2* This);
|
||||
|
||||
ULONG(STDMETHODCALLTYPE* Release)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2* This);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* GetIids)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2* This,
|
||||
/* [out] */ __RPC__out ULONG* iidCount,
|
||||
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2* This,
|
||||
/* [out] */ __RPC__deref_out_opt HSTRING* className);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2* This,
|
||||
/* [out] */ __RPC__out TrustLevel* trustLevel);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* GetForCategory)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2* This,
|
||||
__RPC__in HSTRING a2,
|
||||
/* [out] */ __RPC__out void** _instance_of_winrt_WindowsUdk_ApplicationModel_AppExtensions_XamlExtensions);
|
||||
|
||||
END_INTERFACE
|
||||
} WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2Vtbl;
|
||||
|
||||
interface WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2 // : IInspectable
|
||||
{
|
||||
const struct WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2Vtbl* lpVtbl;
|
||||
};
|
||||
|
||||
typedef interface WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2 WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2;
|
||||
|
||||
DEFINE_GUID(IID_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2,
|
||||
0x34a95314,
|
||||
0xca5c, 0x5fad, 0xae, 0x7c,
|
||||
0x1a, 0x90, 0x18, 0x11, 0x66, 0xc1
|
||||
);
|
||||
|
||||
typedef struct WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2Vtbl // : IInspectableVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* QueryInterface)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2* This,
|
||||
/* [in] */ __RPC__in REFIID riid,
|
||||
/* [annotation][iid_is][out] */
|
||||
_COM_Outptr_ void** ppvObject);
|
||||
|
||||
ULONG(STDMETHODCALLTYPE* AddRef)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2* This);
|
||||
|
||||
ULONG(STDMETHODCALLTYPE* Release)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2* This);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* GetIids)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2* This,
|
||||
/* [out] */ __RPC__out ULONG* iidCount,
|
||||
/* [size_is][size_is][out] */ __RPC__deref_out_ecount_full_opt(*iidCount) IID** iids);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* GetRuntimeClassName)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2* This,
|
||||
/* [out] */ __RPC__deref_out_opt HSTRING* className);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* GetTrustLevel)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2* This,
|
||||
/* [out] */ __RPC__out TrustLevel* trustLevel);
|
||||
|
||||
HRESULT(STDMETHODCALLTYPE* IsExtensionAvailable)(
|
||||
__RPC__in WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2* This,
|
||||
__RPC__in HSTRING a2,
|
||||
__RPC__in HSTRING a3,
|
||||
/* [out] */ __RPC__out BYTE* a4);
|
||||
|
||||
END_INTERFACE
|
||||
} WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2Vtbl;
|
||||
|
||||
interface WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2 // : IInspectable
|
||||
{
|
||||
const struct WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2Vtbl* lpVtbl;
|
||||
};
|
||||
|
||||
extern const WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics;
|
||||
extern const WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2 instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensionsStatics2;
|
||||
extern const WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2 instanceof_WindowsUdk_ApplicationModel_AppExtensions_IXamlExtensions2;
|
||||
extern const ITrayUIComponent instanceof_ITrayUIComponent;
|
||||
HRESULT(*explorer_TrayUI_CreateInstanceFunc)(ITrayUIHost* host, REFIID riid, void** ppv);
|
||||
#pragma endregion
|
||||
|
||||
inline int FileExistsW(wchar_t* file)
|
||||
|
@ -1235,7 +1235,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
|
||||
GUI_SubstituteLocalizedString(text, MAX_LINE_LENGTH);
|
||||
if (_this->sectionNames[currentSection + 1][0] == 0)
|
||||
{
|
||||
wcscpy_s(_this->sectionNames[currentSection + 1], 20, text);
|
||||
wcscpy_s(_this->sectionNames[currentSection + 1], 32, text);
|
||||
}
|
||||
if (hDC)
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ typedef struct _GUI
|
||||
void* pAccPropServices;
|
||||
HWND hAccLabel;
|
||||
BOOL bShouldAnnounceSelected;
|
||||
WCHAR sectionNames[20][20];
|
||||
WCHAR sectionNames[20][32];
|
||||
BOOL bRebuildIfTabOrderIsEmpty;
|
||||
int dwPageLocation;
|
||||
DWORD last_section;
|
||||
|
Loading…
Reference in New Issue
Block a user