From 9882261229e887e52e4bd2be0ec3e24a2f46e064 Mon Sep 17 00:00:00 2001 From: Bruce Dawson Date: Tue, 9 Nov 2021 22:07:09 -0800 Subject: [PATCH] Install WPT prerequisites as well WPTx64 (DesktopEditions)-x86_en-us.msi is the WPT installer, but it doesn't fully install unless WPTx64 (OnecoreUAP)-x86_en-us.msi is installed first. So let's do that. This changes the packaging and the installation process. --- UIforETW/UIforETWDlg.cpp | 25 ++++++++++++++++++------- package_etw.bat | 11 ++++++++--- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/UIforETW/UIforETWDlg.cpp b/UIforETW/UIforETWDlg.cpp index 80e89736..c4df4534 100644 --- a/UIforETW/UIforETWDlg.cpp +++ b/UIforETW/UIforETWDlg.cpp @@ -452,14 +452,25 @@ BOOL CUIforETWDlg::OnInitDialog() // Install 64-bit WPT 10 if needed and if available. if (xperfVersion < preferredXperfVersion) { - const std::wstring installPath10 = CanonicalizePath(GetExeDir() + L"..\\third_party\\wpt10\\WPTx64 (DesktopEditions)-x86_en-us.msi"); - if (PathFileExists(installPath10.c_str())) + const std::wstring installPath10[] = { - ChildProcess child(msiExecPath); - std::wstring args = L" /i \"" + installPath10 + L"\""; - child.Run(true, L"msiexec.exe" + args); - const DWORD installResult10 = child.GetExitCode(); - if (!installResult10) + CanonicalizePath(GetExeDir() + L"..\\third_party\\wpt10\\WPTx64 (OnecoreUAP)-x86_en-us.msi"), + CanonicalizePath(GetExeDir() + L"..\\third_party\\wpt10\\WPTx64 (DesktopEditions)-x86_en-us.msi"), + }; + if (PathFileExists(installPath10[0].c_str()) && PathFileExists(installPath10[1].c_str())) + { + bool success = true; + DWORD installResult10 = 0; + for (const auto& installPath : installPath10) + { + ChildProcess child(msiExecPath); + std::wstring args = L" /i \"" + installPath + L"\""; + child.Run(true, L"msiexec.exe" + args); + installResult10 = child.GetExitCode(); + if (installResult10) + success = false; + } + if (success) { xperfVersion = GetFileVersion(GetXperfPath()); outputPrintf(L"WPT version %llu.%llu.%llu.%llu was installed.\n", diff --git a/package_etw.bat b/package_etw.bat index 23c43379..d1ea9601 100644 --- a/package_etw.bat +++ b/package_etw.bat @@ -16,12 +16,17 @@ mkdir %destdir%\lib mkdir %destdir%\third_party mkdir %symboldir% -set wptredistmsi=Windows Performance Toolkit\Redistributables\WPTx64 (DesktopEditions)-x86_en-us.msi +@rem Prerequisite for the WPT installer +set wptredistmsi1=Windows Performance Toolkit\Redistributables\WPTx64 (OnecoreUAP)-x86_en-us.msi +@rem The WPT installer +set wptredistmsi2=Windows Performance Toolkit\Redistributables\WPTx64 (DesktopEditions)-x86_en-us.msi set wpt10=c:\Program Files (x86)\Windows Kits\10\ -if not exist "%wpt10%%wptredistmsi%" goto nowpt10 +if not exist "%wpt10%%wptredistmsi1%" goto nowpt10 +if not exist "%wpt10%%wptredistmsi2%" goto nowpt10 mkdir %destdir%\third_party\wpt10 -xcopy "%wpt10%%wptredistmsi%" %destdir%\third_party\wpt10 +xcopy "%wpt10%%wptredistmsi1%" %destdir%\third_party\wpt10 +xcopy "%wpt10%%wptredistmsi2%" %destdir%\third_party\wpt10 @if errorlevel 1 goto copyfailure xcopy "%wpt10%Licenses\10.0.22000.0\sdk_license.rtf" %destdir%\third_party\wpt10 @if errorlevel 1 goto copyfailure