mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-23 23:21:08 +01:00
Taskbar10: Add support for loading ep_taskbar on Windows 10 1904x
This commit is contained in:
parent
3c50ea3c68
commit
a8bd290977
@ -9944,10 +9944,6 @@ BOOL CheckExplorerSymbols(symbols_addr* symbols_PTRS)
|
||||
|
||||
const WCHAR* GetTaskbarDllChecked(symbols_addr* symbols_PTRS)
|
||||
{
|
||||
if (!IsWindows11Version22H2OrHigher())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
const WCHAR* pszTaskbarDll = PickTaskbarDll();
|
||||
if (!pszTaskbarDll)
|
||||
{
|
||||
@ -10001,7 +9997,25 @@ HMODULE PrepareAlternateTaskbarImplementation(symbols_addr* symbols_PTRS, const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
explorer_TrayUI_CreateInstanceFunc = GetProcAddress(hMyTaskbar, "EP_TrayUI_CreateInstance");
|
||||
TrayUI_CreateInstance_t pfnMyTrayUICreateInstance = (TrayUI_CreateInstance_t)GetProcAddress(hMyTaskbar, "EP_TrayUI_CreateInstance");
|
||||
if (IsWindows11())
|
||||
{
|
||||
explorer_TrayUI_CreateInstanceFunc = pfnMyTrayUICreateInstance;
|
||||
}
|
||||
else if (explorer_TrayUI_CreateInstanceFunc)
|
||||
{
|
||||
funchook_prepare(
|
||||
funchook,
|
||||
(void**)&explorer_TrayUI_CreateInstanceFunc,
|
||||
pfnMyTrayUICreateInstance
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("[TB] Failed to hook TrayUI_CreateInstance()\n");
|
||||
FreeLibrary(hMyTaskbar);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
typedef void (*CopyExplorerSymbols_t)(symbols_addr* symbols);
|
||||
CopyExplorerSymbols_t CopyExplorerSymbols = (CopyExplorerSymbols_t)GetProcAddress(hMyTaskbar, "CopyExplorerSymbols");
|
||||
@ -10603,8 +10617,8 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
{
|
||||
// Find pointers to various stuff needed to have a working Windows 10 taskbar and Windows 10 taskbar context menu on Windows 11 taskbar
|
||||
#if defined(_M_X64)
|
||||
// 4C 8D 05 ? ? ? ? 48 8D 0D ? ? ? ? E8 ? ? ? ? 48 8B
|
||||
// ^^^^^^^ ^^^^^^^
|
||||
// 4C 8D 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B
|
||||
// ^^^^^^^^^^^ ^^^^^^^^^^^
|
||||
// Ref: CTray::Init()
|
||||
PBYTE match = FindPattern(
|
||||
hExplorer,
|
||||
@ -10615,29 +10629,42 @@ DWORD Inject(BOOL bIsExplorer)
|
||||
if (match)
|
||||
{
|
||||
match += 7; // Point to 48
|
||||
g_pTrayUIHost = match + 7 + *(int*)(match + 3);
|
||||
g_pTrayUIHost = (ITrayUIHost*)(match + 7 + *(int*)(match + 3));
|
||||
match += 7; // Point to E8
|
||||
explorer_TrayUI_CreateInstanceFunc = match + 5 + *(int*)(match + 1);
|
||||
explorer_TrayUI_CreateInstanceFunc = (TrayUI_CreateInstance_t)(match + 5 + *(int*)(match + 1));
|
||||
}
|
||||
#elif defined(_M_ARM64)
|
||||
// TODO Add support for ARM64
|
||||
#endif
|
||||
if (g_pTrayUIHost)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(_M_X64)
|
||||
// 4C 8D 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 85 C0
|
||||
// ^^^^^^^^^^^ ^^^^^^^^^^^
|
||||
// Ref: CTray::Init()
|
||||
PBYTE match = FindPattern(
|
||||
hExplorer,
|
||||
miExplorer.SizeOfImage,
|
||||
"\x4C\x8D\x05\x00\x00\x00\x00\x48\x8D\x0D\x00\x00\x00\x00\xE8\x00\x00\x00\x00\x85\xC0",
|
||||
"xxx????xxx????x????xx"
|
||||
);
|
||||
if (match)
|
||||
{
|
||||
printf("ITrayUIHost = %llX\n", (PBYTE)g_pTrayUIHost - (PBYTE)hExplorer);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Failed to find ITrayUIHost\n");
|
||||
}
|
||||
if (explorer_TrayUI_CreateInstanceFunc) // TODO This does not exist anymore in 26244+
|
||||
{
|
||||
printf("explorer.exe!TrayUI_CreateInstance() = %llX\n", (PBYTE)explorer_TrayUI_CreateInstanceFunc - (PBYTE)hExplorer);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Failed to find explorer.exe!TrayUI_CreateInstance()\n");
|
||||
match += 7; // Point to 48
|
||||
g_pTrayUIHost = (ITrayUIHost*)(match + 7 + *(int*)(match + 3));
|
||||
match += 7; // Point to E8
|
||||
explorer_TrayUI_CreateInstanceFunc = (TrayUI_CreateInstance_t)(match + 5 + *(int*)(match + 1));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (g_pTrayUIHost)
|
||||
{
|
||||
printf("ITrayUIHost = %llX\n", (PBYTE)g_pTrayUIHost - (PBYTE)hExplorer);
|
||||
}
|
||||
if (explorer_TrayUI_CreateInstanceFunc)
|
||||
{
|
||||
printf("explorer.exe!TrayUI_CreateInstance() = %llX\n", (PBYTE)explorer_TrayUI_CreateInstanceFunc - (PBYTE)hExplorer);
|
||||
}
|
||||
|
||||
// Enable Windows 10 taskbar search box on 22621+
|
||||
|
@ -13,6 +13,7 @@ void printf_guid(GUID guid)
|
||||
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
LRESULT CALLBACK BalloonWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (msg == WM_CREATE)
|
||||
@ -82,7 +83,6 @@ __declspec(dllexport) int CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
const wchar_t TestToastXML[] =
|
||||
L"<toast scenario=\"reminder\" "
|
||||
L"activationType=\"protocol\" launch=\"https://github.com/valinet/ExplorerPatcher\" duration=\"%s\">\r\n"
|
||||
@ -138,7 +138,7 @@ __declspec(dllexport) int CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, L
|
||||
}
|
||||
#endif
|
||||
|
||||
__declspec(dllexport) int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
||||
/*__declspec(dllexport)*/ int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
||||
{
|
||||
Sleep(100);
|
||||
TCHAR wszExplorerPath[MAX_PATH + 1];
|
||||
@ -170,14 +170,14 @@ __declspec(dllexport) int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstan
|
||||
return 0;
|
||||
}
|
||||
|
||||
__declspec(dllexport) int CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
||||
/*__declspec(dllexport)*/ int CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
||||
{
|
||||
Sleep(2000);
|
||||
ZZLaunchExplorer(hWnd, hInstance, lpszCmdLine, nCmdShow);
|
||||
return 0;
|
||||
}
|
||||
|
||||
__declspec(dllexport) int CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
||||
/*__declspec(dllexport)*/ int CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow)
|
||||
{
|
||||
BeginExplorerRestart(NULL);
|
||||
FinishExplorerRestart();
|
||||
|
@ -104,7 +104,8 @@ DEFINE_GUID(IID_ITrayUIComponent,
|
||||
0x64, 0xb4, 0xc0, 0x9b, 0x21, 0x1b
|
||||
);
|
||||
|
||||
EP_INLINE HRESULT(*explorer_TrayUI_CreateInstanceFunc)(ITrayUIHost* host, REFIID riid, void** ppv);
|
||||
typedef HRESULT(*TrayUI_CreateInstance_t)(ITrayUIHost* host, REFIID riid, void** ppv);
|
||||
EP_INLINE TrayUI_CreateInstance_t explorer_TrayUI_CreateInstanceFunc;
|
||||
#pragma endregion
|
||||
|
||||
inline int FileExistsW(wchar_t* file)
|
||||
@ -122,19 +123,19 @@ inline int FileExistsW(wchar_t* file)
|
||||
// https://stackoverflow.com/questions/1672677/print-a-guid-variable
|
||||
void printf_guid(GUID guid);
|
||||
|
||||
#ifdef _DEBUG
|
||||
LRESULT CALLBACK BalloonWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
__declspec(dllexport) int CALLBACK ZZTestBalloon(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||
|
||||
#ifdef _DEBUG
|
||||
__declspec(dllexport) int CALLBACK ZZTestToast(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||
#endif
|
||||
|
||||
__declspec(dllexport) int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||
/*__declspec(dllexport)*/ int CALLBACK ZZLaunchExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||
|
||||
__declspec(dllexport) int CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||
/*__declspec(dllexport)*/ int CALLBACK ZZLaunchExplorerDelayed(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||
|
||||
__declspec(dllexport) int CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||
/*__declspec(dllexport)*/ int CALLBACK ZZRestartExplorer(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow);
|
||||
|
||||
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
|
||||
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
|
||||
@ -941,6 +942,16 @@ inline const WCHAR* PickTaskbarDll()
|
||||
{
|
||||
DWORD b = global_rovi.dwBuildNumber;
|
||||
|
||||
if (b >= 19041 && b <= 19045) // Windows 10 20H2, 21H2, 22H2
|
||||
{
|
||||
return L"ep_taskbar.0.dll";
|
||||
}
|
||||
|
||||
if (b >= 21343 && b <= 22000) // Windows 11 21H2
|
||||
{
|
||||
return L"ep_taskbar.1.dll";
|
||||
}
|
||||
|
||||
if ((b >= 22621 && b <= 22635) // 22H2-23H2 Release, Release Preview, and Beta channels
|
||||
|| (b >= 23403 && b <= 25197)) // Early pre-reboot Dev channel until post-reboot Dev channel
|
||||
{
|
||||
|
@ -825,6 +825,7 @@ BOOL DownloadResource(BOOL bInstall, LPCWSTR pwszURL, DWORD dwSize, LPCSTR chash
|
||||
void ProcessTaskbarDlls(BOOL* bInOutOk, BOOL bInstall, BOOL bExtractMode, HINSTANCE hInstance, unzFile zipFile, WCHAR wszPath[260])
|
||||
{
|
||||
LPCWSTR pwszTaskbarDllName = bExtractMode ? NULL : PickTaskbarDll();
|
||||
if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.0.dll")), hInstance, zipFile, "ep_taskbar.0.dll", wszPath, L"ep_taskbar.0.dll");
|
||||
if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.2.dll")), hInstance, zipFile, "ep_taskbar.2.dll", wszPath, L"ep_taskbar.2.dll");
|
||||
if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.3.dll")), hInstance, zipFile, "ep_taskbar.3.dll", wszPath, L"ep_taskbar.3.dll");
|
||||
if (*bInOutOk) *bInOutOk = InstallResource(bInstall && (bExtractMode || pwszTaskbarDllName && !wcscmp(pwszTaskbarDllName, L"ep_taskbar.4.dll")), hInstance, zipFile, "ep_taskbar.4.dll", wszPath, L"ep_taskbar.4.dll");
|
||||
|
@ -82,7 +82,7 @@ void PatchXamlMetaDataProviderGuid()
|
||||
PIMAGE_NT_HEADERS64 ntHeader = (PIMAGE_NT_HEADERS64)((u_char*)dosHeader + dosHeader->e_lfanew);
|
||||
if (ntHeader->Signature == IMAGE_NT_SIGNATURE)
|
||||
{
|
||||
PIMAGE_SECTION_HEADER firstSection = IMAGE_FIRST_SECTION(ntHeader);
|
||||
PIMAGE_SECTION_HEADER firstSection = IMAGE_FIRST_SECTION(ntHeader);
|
||||
for (unsigned int i = 0; i < ntHeader->FileHeader.NumberOfSections; ++i)
|
||||
{
|
||||
PIMAGE_SECTION_HEADER section = firstSection + i;
|
||||
|
Loading…
Reference in New Issue
Block a user