Skip to content

Commit 19177e4

Browse files
committed
ep_taskbar: Hook context menu functions
1 parent 214ad2b commit 19177e4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ExplorerPatcher/dllmain.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,10 +2284,12 @@ INT64 ReBarWindow32SubclassProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPARAM wPar
22842284
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
22852285
}
22862286

2287+
HMODULE g_hMyTaskbar;
2288+
22872289
HMENU explorer_LoadMenuW(HINSTANCE hInstance, LPCWSTR lpMenuName)
22882290
{
22892291
HMENU hMenu = LoadMenuW(hInstance, lpMenuName);
2290-
if (hInstance == GetModuleHandle(NULL) && lpMenuName == MAKEINTRESOURCEW(205))
2292+
if ((hInstance == GetModuleHandle(NULL) || (g_hMyTaskbar && hInstance == g_hMyTaskbar)) && lpMenuName == MAKEINTRESOURCEW(205))
22912293
{
22922294
HMENU hSubMenu = GetSubMenu(hMenu, 0);
22932295
if (hSubMenu)
@@ -11919,6 +11921,7 @@ HMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const
1191911921
wprintf(L"[TB] '%s' not found\n", pszTaskbarDll);
1192011922
return NULL;
1192111923
}
11924+
g_hMyTaskbar = hMyTaskbar;
1192211925

1192311926
typedef DWORD (*GetVersion_t)();
1192411927
GetVersion_t GetVersion = (GetVersion_t)GetProcAddress(hMyTaskbar, "GetVersion");
@@ -12609,7 +12612,7 @@ DWORD Inject(BOOL bIsExplorer)
1260912612
ShouldSystemUseDarkMode = (ShouldSystemUseDarkMode_t)GetProcAddress(hUxtheme, MAKEINTRESOURCEA(138));
1261012613
if (bOldTaskbar)
1261112614
{
12612-
VnPatchIAT(hExplorer, "uxtheme.dll", MAKEINTRESOURCEA(138), PeopleBand_DrawTextWithGlowHook);
12615+
VnPatchIAT(hExplorer, "uxtheme.dll", MAKEINTRESOURCEA(126), PeopleBand_DrawTextWithGlowHook);
1261312616
}
1261412617
// DwmExtendFrameIntoClientArea hooked in LoadSettings
1261512618
printf("Setup uxtheme functions done\n");
@@ -12807,6 +12810,11 @@ DWORD Inject(BOOL bIsExplorer)
1280712810

1280812811
VnPatchIAT(hTwinuiPcshell, "API-MS-WIN-CORE-REGISTRY-L1-1-0.DLL", "RegGetValueW", twinuipcshell_RegGetValueW);
1280912812
HMODULE hMyTaskbar = PrepareAlternateTaskbarImplementation(&symbols_PTRS, pszTaskbarDll);
12813+
if (hMyTaskbar)
12814+
{
12815+
VnPatchIAT(hMyTaskbar, "user32.dll", "LoadMenuW", explorer_LoadMenuW);
12816+
VnPatchIAT(hMyTaskbar, "user32.dll", "TrackPopupMenuEx", explorer_TrackPopupMenuExHook);
12817+
}
1281012818
printf("Setup twinui.pcshell functions done\n");
1281112819

1281212820

0 commit comments

Comments
 (0)