mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2025-01-20 01:12:49 +01:00
Taskbar notification: Hardened event name, proper detection of existing instance
This commit is contained in:
parent
6c72c7a15d
commit
9e9f958057
@ -17,7 +17,7 @@ BOOL GetClientRectHook(HWND hWnd, LPRECT lpRect)
|
||||
wchar_t wszClassName[100];
|
||||
ZeroMemory(wszClassName, 100);
|
||||
GetClassNameW(hWnd, wszClassName, 100);
|
||||
if (!wcscmp(wszClassName, L"Shell_TrayWnd") || !wcscmp(wszClassName, L"Shell_SecondaryTrayWnd"))
|
||||
if (!wcscmp(wszClassName, L"MSTaskListWClass"))
|
||||
{
|
||||
TaskbarCenter_Notify();
|
||||
}
|
||||
@ -26,18 +26,18 @@ BOOL GetClientRectHook(HWND hWnd, LPRECT lpRect)
|
||||
|
||||
HRESULT TaskbarCenter_Initialize(HMODULE hExplorer)
|
||||
{
|
||||
if (!(hEvent = CreateEventW(NULL, TRUE, FALSE, TASKBAR_CHANGED_NOTIFICATION)))
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
if (FindWindowExW(NULL, NULL, L"Shell_TrayWnd", NULL))
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
// This is one of the methods called by explorer!CTaskListWnd::_RecomputeLayout
|
||||
if (!VnPatchDelayIAT(hExplorer, "ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll", "GetClientRect", GetClientRectHook))
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
if (!(hEvent = CreateEventW(NULL, TRUE, FALSE, TASKBAR_CHANGED_NOTIFICATION)))
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
#include <Windows.h>
|
||||
#include <valinet/hooking/iatpatch.h>
|
||||
|
||||
#define TASKBAR_CHANGED_NOTIFICATION L"Global\\ExplorerPatcher_TaskbarChangedNotification"
|
||||
#define TASKBAR_CHANGED_NOTIFICATION L"Global\\ExplorerPatcher_TaskbarChangedNotification_{B37553B7-425C-44F6-A04A-126849EE59CB}"
|
||||
|
||||
HRESULT TaskbarCenter_Initialize(HMODULE);
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user