mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-23 23:21:08 +01:00
Taskbar11: Load the classic context menu from EP's taskbar implementation if the context menu does not exist in explorer.exe
This commit is contained in:
parent
39609e4b54
commit
bfca879e68
@ -2005,7 +2005,11 @@ INT64 Shell_TrayWndSubclassProc(
|
|||||||
pt.x = GET_X_LPARAM(lParam);
|
pt.x = GET_X_LPARAM(lParam);
|
||||||
pt.y = GET_Y_LPARAM(lParam);
|
pt.y = GET_Y_LPARAM(lParam);
|
||||||
|
|
||||||
HMENU hMenu = LoadMenuW(GetModuleHandle(NULL), MAKEINTRESOURCEW(205));
|
HMENU hMenu = LoadMenuW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(205));
|
||||||
|
if (!hMenu)
|
||||||
|
{
|
||||||
|
hMenu = LoadMenuW(g_hMyTaskbar, MAKEINTRESOURCEW(205));
|
||||||
|
}
|
||||||
if (hMenu)
|
if (hMenu)
|
||||||
{
|
{
|
||||||
HMENU hSubMenu = GetSubMenu(hMenu, 0);
|
HMENU hSubMenu = GetSubMenu(hMenu, 0);
|
||||||
@ -9940,7 +9944,7 @@ BOOL CheckExplorerSymbols(symbols_addr* symbols_PTRS)
|
|||||||
|
|
||||||
const WCHAR* GetTaskbarDllChecked(symbols_addr* symbols_PTRS)
|
const WCHAR* GetTaskbarDllChecked(symbols_addr* symbols_PTRS)
|
||||||
{
|
{
|
||||||
if (bOldTaskbar < 2 || !IsWindows11Version22H2OrHigher())
|
if (!IsWindows11Version22H2OrHigher())
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -9958,9 +9962,13 @@ const WCHAR* GetTaskbarDllChecked(symbols_addr* symbols_PTRS)
|
|||||||
return pszTaskbarDll;
|
return pszTaskbarDll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Behavior based on selected Taskbar style:
|
||||||
|
// - Windows 11: Load our taskbar DLL with LOAD_LIBRARY_AS_DATAFILE for the old context menu
|
||||||
|
// - Windows 10: Skip loading
|
||||||
|
// - Windows 10 (ExplorerPatcher): Load it fully
|
||||||
HMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCHAR* pszTaskbarDll)
|
HMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const WCHAR* pszTaskbarDll)
|
||||||
{
|
{
|
||||||
if (!symbols_PTRS || !pszTaskbarDll)
|
if (bOldTaskbar == 1 || !symbols_PTRS || !pszTaskbarDll)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -9970,7 +9978,7 @@ HMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const
|
|||||||
SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, szPath);
|
SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, szPath);
|
||||||
wcscat_s(szPath, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\");
|
wcscat_s(szPath, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\");
|
||||||
wcscat_s(szPath, MAX_PATH, pszTaskbarDll);
|
wcscat_s(szPath, MAX_PATH, pszTaskbarDll);
|
||||||
HMODULE hMyTaskbar = LoadLibraryW(szPath);
|
HMODULE hMyTaskbar = bOldTaskbar >= 2 ? LoadLibraryW(szPath) : LoadLibraryExW(szPath, NULL, LOAD_LIBRARY_AS_DATAFILE);
|
||||||
if (!hMyTaskbar)
|
if (!hMyTaskbar)
|
||||||
{
|
{
|
||||||
wprintf(L"[TB] '%s' not found\n", pszTaskbarDll);
|
wprintf(L"[TB] '%s' not found\n", pszTaskbarDll);
|
||||||
@ -9978,6 +9986,11 @@ HMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const
|
|||||||
}
|
}
|
||||||
g_hMyTaskbar = hMyTaskbar;
|
g_hMyTaskbar = hMyTaskbar;
|
||||||
|
|
||||||
|
if (!bOldTaskbar)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
typedef DWORD (*GetVersion_t)();
|
typedef DWORD (*GetVersion_t)();
|
||||||
GetVersion_t GetVersion = (GetVersion_t)GetProcAddress(hMyTaskbar, "GetVersion");
|
GetVersion_t GetVersion = (GetVersion_t)GetProcAddress(hMyTaskbar, "GetVersion");
|
||||||
DWORD version = GetVersion ? GetVersion() : 0;
|
DWORD version = GetVersion ? GetVersion() : 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user