Skip to content

Commit

Permalink
ep_taskbar: Hook context menu functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Amrsatrio committed Jul 21, 2024
1 parent 214ad2b commit 19177e4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ExplorerPatcher/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -2284,10 +2284,12 @@ INT64 ReBarWindow32SubclassProc(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPARAM wPar
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}

HMODULE g_hMyTaskbar;

HMENU explorer_LoadMenuW(HINSTANCE hInstance, LPCWSTR lpMenuName)
{
HMENU hMenu = LoadMenuW(hInstance, lpMenuName);
if (hInstance == GetModuleHandle(NULL) && lpMenuName == MAKEINTRESOURCEW(205))
if ((hInstance == GetModuleHandle(NULL) || (g_hMyTaskbar && hInstance == g_hMyTaskbar)) && lpMenuName == MAKEINTRESOURCEW(205))
{
HMENU hSubMenu = GetSubMenu(hMenu, 0);
if (hSubMenu)
Expand Down Expand Up @@ -11919,6 +11921,7 @@ HMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const
wprintf(L"[TB] '%s' not found\n", pszTaskbarDll);
return NULL;
}
g_hMyTaskbar = hMyTaskbar;

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

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


Expand Down

0 comments on commit 19177e4

Please sign in to comment.