From 4978024ea47099dd199683a55ee650c5715021f6 Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Sat, 2 Nov 2024 20:29:32 +0700 Subject: [PATCH] Start10: Use the latest known good JumpViewUI.dll on 22H2 and up --- ep_setup/ep_setup.c | 2 ++ ep_setup/ep_setup.vcxproj | 2 ++ ep_startmenu/ep_sm_main.c | 23 +++++++++++++++++++++-- ep_startmenu/ep_sm_main_cpp.cpp | 24 ++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/ep_setup/ep_setup.c b/ep_setup/ep_setup.c index affb843..a45b872 100644 --- a/ep_setup/ep_setup.c +++ b/ep_setup/ep_setup.c @@ -1412,6 +1412,7 @@ int WINAPI wWinMain( // C:\Windows\SystemApps\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy // + dxgi.dll + // + JumpViewUI_.dll (download, optional) // + StartUI_.dll (download, optional) // + wincorlib.dll // + wincorlib_orig.dll (symlink) @@ -1442,6 +1443,7 @@ int WINAPI wWinMain( bOk = CreateSymbolicLinkW(wszSymLinkPath, wszOrigPath, 0); } + if (bOk) bOk = InstallResource(bInstall && bUnpackCustomStartUI, hInstance, zipFile, "JumpViewUI/JumpViewUI.dll", wszPath, L"JumpViewUI_.dll"); if (bOk) bOk = InstallResource(bInstall && bUnpackCustomStartUI, hInstance, zipFile, "StartUI/StartUI.dll", wszPath, L"StartUI_.dll"); // Delete remnants from earlier versions diff --git a/ep_setup/ep_setup.vcxproj b/ep_setup/ep_setup.vcxproj index 1935b68..586c87a 100644 --- a/ep_setup/ep_setup.vcxproj +++ b/ep_setup/ep_setup.vcxproj @@ -386,6 +386,8 @@ + + diff --git a/ep_startmenu/ep_sm_main.c b/ep_startmenu/ep_sm_main.c index 90389d2..8351bae 100644 --- a/ep_startmenu/ep_sm_main.c +++ b/ep_startmenu/ep_sm_main.c @@ -10,6 +10,8 @@ HMODULE hModule = NULL; HMODULE hOrig = NULL; SRWLOCK lockInstanced = { .Ptr = SRWLOCK_INIT }; BOOL bInstanced = FALSE; +BOOL g_bIsUsingOwnJumpViewUI = FALSE; +BOOL g_bIsUsingOwnStartUI = FALSE; DEFINE_GUID(IID_StartDocked_App, 0x4C2CAEAD, 0x9DA8, 0x30EC, 0xB6, 0xD3, 0xCB, 0xD5, 0x74, 0xED, 0xCB, 0x35); // 4C2CAEAD-9DA8-30EC-B6D3-CBD574EDCB35 DEFINE_GUID(IID_StartUI_App, 0x1ECDC9E0, 0xBDB1, 0x3551, 0x8C, 0xEE, 0x4B, 0x77, 0x54, 0x0C, 0x44, 0xB3); // 1ECDC9E0-BDB1-3551-8CEE-4B77540C44B3 @@ -39,6 +41,7 @@ BOOL GetStartUIName(WCHAR* out, int cch) wcscpy_s(szPath, MAX_PATH, L"StartUI_.dll"); if (FileExistsW(szPath)) { + g_bIsUsingOwnStartUI = TRUE; if (out && cch) wcscpy_s(out, cch, szPath); return TRUE; @@ -120,6 +123,15 @@ void Init() { // VnPatchIAT(GetModuleHandleW(NULL), "api-ms-win-core-sysinfo-l1-2-0.dll", "GetProductInfo", start_GetProductInfo); PatchXamlMetaDataProviderGuid(); + if (g_bIsUsingOwnStartUI) + { + LoadLibraryW(g_szStartUIName); + } + if (FileExistsW(L"JumpViewUI_.dll")) + { + LoadLibraryW(L"JumpViewUI_.dll"); + g_bIsUsingOwnJumpViewUI = TRUE; + } } HMODULE hMod; GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, hModule, &hMod); @@ -152,6 +164,7 @@ wchar_t* GetCmdArguments(int* a1) extern HRESULT LoadOurShellCommonPri(); extern HRESULT GetActivationFactoryByPCWSTR_InStartUI(PCWSTR activatableClassId, REFIID riid, void** ppv); +extern HRESULT GetActivationFactoryByPCWSTR_InJumpViewUI(PCWSTR activatableClassId, REFIID riid, void** ppv); #pragma comment(linker, "/export:?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z=GetActivationFactoryByPCWSTR,@129") HRESULT GetActivationFactoryByPCWSTR(PCWSTR activatableClassId, REFIID riid, void** ppv) @@ -185,11 +198,17 @@ HRESULT GetActivationFactoryByPCWSTR(PCWSTR activatableClassId, REFIID riid, voi return GetActivationFactoryByPCWSTR_InStartUI(L"StartUI.startui_XamlTypeInfo.XamlMetaDataProvider", riid, ppv); } } - - if (wcsncmp(activatableClassId, L"StartUI.", 8) == 0) + else if (wcsncmp(activatableClassId, L"StartUI.", 8) == 0) { return GetActivationFactoryByPCWSTR_InStartUI(activatableClassId, riid, ppv); } + else if (wcsncmp(activatableClassId, L"JumpViewUI.", 11) == 0) + { + if (g_bIsUsingOwnJumpViewUI) + { + return GetActivationFactoryByPCWSTR_InJumpViewUI(activatableClassId, riid, ppv); + } + } return pGetActivationFactoryByPCWSTR(activatableClassId, riid, ppv); } diff --git a/ep_startmenu/ep_sm_main_cpp.cpp b/ep_startmenu/ep_sm_main_cpp.cpp index bd5075f..6028b04 100644 --- a/ep_startmenu/ep_sm_main_cpp.cpp +++ b/ep_startmenu/ep_sm_main_cpp.cpp @@ -93,3 +93,27 @@ extern "C" HRESULT GetActivationFactoryByPCWSTR_InStartUI(PCWSTR activatableClas return activationFactory.CopyTo(riid, ppv); } + +extern "C" HRESULT GetActivationFactoryByPCWSTR_InJumpViewUI(PCWSTR activatableClassId, REFIID riid, void** ppv) +{ + typedef HRESULT (WINAPI* DllGetActivationFactory_t)(HSTRING, IActivationFactory**); + static DllGetActivationFactory_t pfnGetActivationFactory; + if (!pfnGetActivationFactory) + { + HMODULE hModule = GetModuleHandleW(L"JumpViewUI_.dll"); + if (hModule) + { + pfnGetActivationFactory = (DllGetActivationFactory_t)GetProcAddress(hModule, "DllGetActivationFactory"); + } + } + + if (!pfnGetActivationFactory) + return E_FAIL; + + ComPtr activationFactory; + HRESULT hr = pfnGetActivationFactory(Wrappers::HStringReference(activatableClassId).Get(), &activationFactory); + if (FAILED(hr)) + return hr; + + return activationFactory.CopyTo(riid, ppv); +}