1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-24 07:30:22 +01:00

Taskbar10: Don't register the Win+X window more than once (thanks @roflcopter4)

This commit is contained in:
Amrsatrio 2023-10-24 20:49:28 +07:00
parent af3bff4b9f
commit bdc06de667
2 changed files with 62 additions and 40 deletions

View File

@ -1247,29 +1247,32 @@ DWORD ShowLauncherTipContextMenu(
offset_in_class = 8; offset_in_class = 8;
} }
WNDCLASS wc = { 0 }; static ATOM windowRegistrationAtom = 0;
wc.style = CS_DBLCLKS; if (windowRegistrationAtom == 0)
wc.lpfnWndProc = CLauncherTipContextMenu_WndProc; {
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); WNDCLASS wc = {
wc.hInstance = GetModuleHandle(NULL); .style = CS_DBLCLKS,
wc.lpszClassName = LAUNCHERTIP_CLASS_NAME; .lpfnWndProc = CLauncherTipContextMenu_WndProc,
wc.hCursor = LoadCursorW(NULL, IDC_ARROW); .hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH),
RegisterClass(&wc); .hInstance = GetModuleHandleW(NULL),
.lpszClassName = LAUNCHERTIP_CLASS_NAME,
.hCursor = LoadCursorW(NULL, IDC_ARROW)
};
ATOM atom = RegisterClassW(&wc);
if (atom)
windowRegistrationAtom = atom;
}
hWinXWnd = CreateWindowInBand( hWinXWnd = CreateWindowInBand(
0, 0,
LAUNCHERTIP_CLASS_NAME, MAKEINTATOM(windowRegistrationAtom),
0, 0,
WS_POPUP, WS_POPUP,
0, 0, 0, 0, 0,
0, NULL, NULL,
0,
0,
0,
0,
GetModuleHandle(NULL), GetModuleHandle(NULL),
(char*)params->_this - 0x58, (char*)params->_this - 0x58,
7 7 // ZBID_IMMERSIVE_EDGY
); );
// DO NOT USE ShowWindow here; it breaks the window order // DO NOT USE ShowWindow here; it breaks the window order
// and renders the desktop toggle unusable; but leave // and renders the desktop toggle unusable; but leave
@ -10689,8 +10692,25 @@ static struct
int startExperienceManager_bMaybeFullScreenMode; int startExperienceManager_bMaybeFullScreenMode;
} g_SMAnimationPatchOffsets; } g_SMAnimationPatchOffsets;
enum EDGEUI_TRAYSTUCKPLACE {}; // Names are custom
enum DWMTRANSITION_TARGET {}; enum EDGEUI_TRAYSTUCKPLACE
{
TSP_LEFT,
TSP_TOP,
TSP_RIGHT,
TSP_BOTTOM,
};
// Names taken from Windows.UI.Xaml.pdb, only defining the used ones
enum DWMTRANSITION_TARGET
{
DWMTARGET_LAUNCHERFLYOUTTOLEFT = 0x4D,
DWMTARGET_LAUNCHERFLYOUTTORIGHT = 0x4E,
DWMTARGET_LAUNCHERFLYOUTTOTOP = 0x4F,
DWMTARGET_LAUNCHERFLYOUTTOBOTTOM = 0x50,
DWMTARGET_LAUNCHERFLYOUT = 0x51,
DWMTARGET_LAUNCHERFULLSCREEN = 0x52,
};
HRESULT(*CStartExperienceManager_GetMonitorInformationFunc)(void* _this, void* experience, RECT* a3, enum EDGEUI_TRAYSTUCKPLACE* pTsp, bool* a5, RECT* a6, HMONITOR* a7); HRESULT(*CStartExperienceManager_GetMonitorInformationFunc)(void* _this, void* experience, RECT* a3, enum EDGEUI_TRAYSTUCKPLACE* pTsp, bool* a5, RECT* a6, HMONITOR* a7);
HRESULT(*CExperienceManagerAnimationHelper_BeginFunc)(void* _this, void*, enum DWMTRANSITION_TARGET, const RECT*, const RECT*, const RECT*, const RECT*, const RECT*); HRESULT(*CExperienceManagerAnimationHelper_BeginFunc)(void* _this, void*, enum DWMTRANSITION_TARGET, const RECT*, const RECT*, const RECT*, const RECT*, const RECT*);
@ -10713,17 +10733,17 @@ HRESULT OnViewCloakingHook(void* eventHandler, void* experience)
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
enum DWMTRANSITION_TARGET target = 0x51; enum DWMTRANSITION_TARGET target = DWMTARGET_LAUNCHERFLYOUT;
if (*(bool*)((PBYTE)experience + 0x34)) if (*(bool*)((PBYTE)experience + 0x34))
target = 0x52; target = DWMTARGET_LAUNCHERFULLSCREEN;
else if (tsp == 0) else if (tsp == TSP_LEFT)
target = 0x4D; target = DWMTARGET_LAUNCHERFLYOUTTOLEFT;
else if (tsp == 1) else if (tsp == TSP_TOP)
target = 0x4F; target = DWMTARGET_LAUNCHERFLYOUTTOTOP;
else if (tsp == 2) else if (tsp == TSP_RIGHT)
target = 0x4E; target = DWMTARGET_LAUNCHERFLYOUTTORIGHT;
else if (tsp == 3) else if (tsp == TSP_BOTTOM)
target = 0x50; target = DWMTARGET_LAUNCHERFLYOUTTOBOTTOM;
hr = CExperienceManagerAnimationHelper_BeginFunc( hr = CExperienceManagerAnimationHelper_BeginFunc(
_this + g_SMAnimationPatchOffsets.startExperienceManager_closingAnimation, _this + g_SMAnimationPatchOffsets.startExperienceManager_closingAnimation,
@ -10741,17 +10761,19 @@ HRESULT CStartExperienceManager_GetMonitorInformationHook(void* _this, void* exp
if (SUCCEEDED(hr) && *(PBYTE)_ReturnAddress() == 0x85 && *((PBYTE)_ReturnAddress() + 1) == 0xC0 && *((PBYTE)_ReturnAddress() + 2) == 0x78) if (SUCCEEDED(hr) && *(PBYTE)_ReturnAddress() == 0x85 && *((PBYTE)_ReturnAddress() + 1) == 0xC0 && *((PBYTE)_ReturnAddress() + 2) == 0x78)
{ {
experience = (PBYTE)_this + g_SMAnimationPatchOffsets.startExperienceManager_singleViewShellExperience; experience = (PBYTE)_this + g_SMAnimationPatchOffsets.startExperienceManager_singleViewShellExperience;
enum DWMTRANSITION_TARGET target = 0x51;
enum DWMTRANSITION_TARGET target = DWMTARGET_LAUNCHERFLYOUT;
if (*(bool*)((PBYTE)experience + 0x34)) if (*(bool*)((PBYTE)experience + 0x34))
target = 0x52; target = DWMTARGET_LAUNCHERFULLSCREEN;
else if (*pTsp == 0) else if (*pTsp == TSP_LEFT)
target = 0x4E; target = DWMTARGET_LAUNCHERFLYOUTTORIGHT;
else if (*pTsp == 1) else if (*pTsp == TSP_TOP)
target = 0x50; target = DWMTARGET_LAUNCHERFLYOUTTOBOTTOM;
else if (*pTsp == 2) else if (*pTsp == TSP_RIGHT)
target = 0x4D; target = DWMTARGET_LAUNCHERFLYOUTTOLEFT;
else if (*pTsp == 3) else if (*pTsp == TSP_BOTTOM)
target = 0x4F; target = DWMTARGET_LAUNCHERFLYOUTTOTOP;
CExperienceManagerAnimationHelper_BeginFunc( CExperienceManagerAnimationHelper_BeginFunc(
(PBYTE)_this + g_SMAnimationPatchOffsets.startExperienceManager_openingAnimation, (PBYTE)_this + g_SMAnimationPatchOffsets.startExperienceManager_openingAnimation,
*(void**)((PBYTE)experience + 0x18), // viewWrapper *(void**)((PBYTE)experience + 0x18), // viewWrapper

View File

@ -345,7 +345,7 @@ inline LSTATUS SHRegGetValueFromHKCUHKLMWithOpt(
static HWND(WINAPI* CreateWindowInBand)( static HWND(WINAPI* CreateWindowInBand)(
_In_ DWORD dwExStyle, _In_ DWORD dwExStyle,
_In_opt_ ATOM atom, _In_opt_ LPCWSTR lpClassName,
_In_opt_ LPCWSTR lpWindowName, _In_opt_ LPCWSTR lpWindowName,
_In_ DWORD dwStyle, _In_ DWORD dwStyle,
_In_ int X, _In_ int X,
@ -357,7 +357,7 @@ static HWND(WINAPI* CreateWindowInBand)(
_In_opt_ HINSTANCE hInstance, _In_opt_ HINSTANCE hInstance,
_In_opt_ LPVOID lpParam, _In_opt_ LPVOID lpParam,
DWORD band DWORD band
); );
BOOL(WINAPI* GetWindowBand)(HWND hWnd, PDWORD pdwBand); BOOL(WINAPI* GetWindowBand)(HWND hWnd, PDWORD pdwBand);