Skip to content

Commit

Permalink
Start10: Use the latest known good JumpViewUI.dll on 22H2 and up
Browse files Browse the repository at this point in the history
  • Loading branch information
Amrsatrio committed Nov 2, 2024
1 parent ac10697 commit 4978024
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ep_setup/ep_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions ep_setup/ep_setup.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@
<DownloadFile DestinationFolder="..\build\$(Configuration)\$(Platform)\ep_setup_files\pnidui" DestinationFileName="pnidui.dll" SourceUrl="https://msdl.microsoft.com/download/symbols/pnidui.dll/63AF842D210000/pnidui.dll" SkipUnchangedFiles="true" Retries="3" Condition="'$(Platform)' == 'ARM64'" />
<DownloadFile DestinationFolder="..\build\$(Configuration)\$(Platform)\ep_setup_files\StartUI" DestinationFileName="StartUI.dll" SourceUrl="https://msdl.microsoft.com/download/symbols/startui.dll/C1AEED44852000/startui.dll" SkipUnchangedFiles="true" Retries="3" Condition="'$(Platform)' == 'x64'" />
<DownloadFile DestinationFolder="..\build\$(Configuration)\$(Platform)\ep_setup_files\StartUI" DestinationFileName="StartUI.dll" SourceUrl="https://msdl.microsoft.com/download/symbols/startui.dll/122A50F3AB9000/startui.dll" SkipUnchangedFiles="true" Retries="3" Condition="'$(Platform)' == 'ARM64'" />
<DownloadFile DestinationFolder="..\build\$(Configuration)\$(Platform)\ep_setup_files\JumpViewUI" DestinationFileName="JumpViewUI.dll" SourceUrl="https://msdl.microsoft.com/download/symbols/jumpviewui.dll/C814664216A000/jumpviewui.dll" SkipUnchangedFiles="true" Retries="3" Condition="'$(Platform)' == 'x64'" />
<DownloadFile DestinationFolder="..\build\$(Configuration)\$(Platform)\ep_setup_files\JumpViewUI" DestinationFileName="JumpViewUI.dll" SourceUrl="https://msdl.microsoft.com/download/symbols/jumpviewui.dll/45558FDB1E9000/jumpviewui.dll" SkipUnchangedFiles="true" Retries="3" Condition="'$(Platform)' == 'ARM64'" />
<Copy SourceFiles="@(PackFile)" DestinationFolder="..\build\$(Configuration)\$(Platform)\ep_setup_files\%(RecursiveDir)" />
<ZipDirectory SourceDirectory="..\build\$(Configuration)\$(Platform)\ep_setup_files" DestinationFile="..\build\$(Configuration)\$(Platform)\ep_setup_files.zip" Overwrite="true" />
<EncryptFile OutputFile="..\build\$(Configuration)\$(Platform)\ep_setup_files.zip" EncryptionKey="$(ZipEncryptionKey)" Condition="'$(WithEncryption)' == 'true'" />
Expand Down
23 changes: 21 additions & 2 deletions ep_startmenu/ep_sm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand Down
24 changes: 24 additions & 0 deletions ep_startmenu/ep_sm_main_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<IActivationFactory> activationFactory;
HRESULT hr = pfnGetActivationFactory(Wrappers::HStringReference(activatableClassId).Get(), &activationFactory);
if (FAILED(hr))
return hr;

return activationFactory.CopyTo(riid, ppv);
}

0 comments on commit 4978024

Please sign in to comment.