close
Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.

Commit 3e3535e

Browse files
committed
Update to Windows 11 WPT and drop Windows 7
This changes UIforETW to prefer and try to install the latest version of Window Performance Toolkit (WPT) from the Windows 11 SDK. This is currently the same version that you can install from the Microsoft Store as Windows Performance Analyzer (Preview). The name of the installer changed (and it got much bigger!) so the packaging script and startup code both changed. In addition it seemed like time to drop Windows 7 support so the packaging script and startup code no longer have support for Windows 7. This reduces the size of the ETW package.
1 parent 5a79a17 commit 3e3535e

2 files changed

Lines changed: 22 additions & 51 deletions

File tree

‎UIforETW/UIforETWDlg.cpp‎

Lines changed: 19 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -438,64 +438,37 @@ BOOL CUIforETWDlg::OnInitDialog()
438438
auto xperfVersion = GetFileVersion(GetXperfPath());
439439
constexpr int64_t requiredXperfVersion = (10llu << 48) + 0 + (10586llu << 16) + (15llu << 0);
440440
// Windows 10 spring 2019 version, 10.0.18362.1 - requires Windows 8 or higher?
441-
constexpr int64_t preferredXperfVersion = (10llu << 48) + 0 + (18362llu << 16) + (1llu << 0);
441+
constexpr int64_t preferredXperfVersion = (10llu << 48) + 0 + (22000llu << 16) + (194llu << 0);
442442

443443
wchar_t systemDir[MAX_PATH];
444444
systemDir[0] = 0;
445445
GetSystemDirectory(systemDir, ARRAYSIZE(systemDir));
446446
std::wstring msiExecPath = systemDir + std::wstring(L"\\msiexec.exe");
447447

448-
if (Is64BitWindows() && PathFileExists(msiExecPath.c_str()))
448+
if (IsWindowsTenOrGreater() && Is64BitWindows() && PathFileExists(msiExecPath.c_str()))
449449
{
450450
// The installers are available as part of etwpackage.zip on
451451
// https://github.com/google/UIforETW/releases
452-
if (IsWindowsSevenOrLesser())
452+
// Install 64-bit WPT 10 if needed and if available.
453+
if (xperfVersion < preferredXperfVersion)
453454
{
454-
// The newest (Anniversary Edition or beyond) WPT doesn't work on Windows 7.
455-
// Install the older 64-bit WPT 10 if needed and if available.
456-
if (xperfVersion < requiredXperfVersion)
455+
const std::wstring installPath10 = CanonicalizePath(GetExeDir() + L"..\\third_party\\wpt10\\WPTx64 (DesktopEditions)-x86_en-us.msi");
456+
if (PathFileExists(installPath10.c_str()))
457457
{
458-
const std::wstring installPathOld10 = CanonicalizePath(GetExeDir() + L"..\\third_party\\oldwpt10\\WPTx64-x86_en-us.msi");
459-
if (PathFileExists(installPathOld10.c_str()))
458+
ChildProcess child(msiExecPath);
459+
std::wstring args = L" /i \"" + installPath10 + L"\"";
460+
child.Run(true, L"msiexec.exe" + args);
461+
const DWORD installResult10 = child.GetExitCode();
462+
if (!installResult10)
460463
{
461-
ChildProcess child(msiExecPath);
462-
std::wstring args = L" /i \"" + installPathOld10 + L"\"";
463-
child.Run(true, L"msiexec.exe" + args);
464-
const DWORD installResult10 = child.GetExitCode();
465-
if (!installResult10)
466-
{
467-
outputPrintf(L"WPT version 10.0.10586 was installed.\n");
468-
}
469-
else
470-
{
471-
outputPrintf(L"Failure code %u while installing WPT 10.\n", installResult10);
472-
}
464+
xperfVersion = GetFileVersion(GetXperfPath());
465+
outputPrintf(L"WPT version %llu.%llu.%llu.%llu was installed.\n",
466+
xperfVersion >> 48, (xperfVersion >> 32) & 0xFFFF,
467+
(xperfVersion >> 16) & 0xFFFF, xperfVersion & 0xFFFF);
473468
}
474-
}
475-
}
476-
else
477-
{
478-
// Install 64-bit WPT 10 if needed and if available.
479-
if (xperfVersion < preferredXperfVersion)
480-
{
481-
const std::wstring installPath10 = CanonicalizePath(GetExeDir() + L"..\\third_party\\wpt10\\WPTx64-x86_en-us.msi");
482-
if (PathFileExists(installPath10.c_str()))
469+
else
483470
{
484-
ChildProcess child(msiExecPath);
485-
std::wstring args = L" /i \"" + installPath10 + L"\"";
486-
child.Run(true, L"msiexec.exe" + args);
487-
const DWORD installResult10 = child.GetExitCode();
488-
if (!installResult10)
489-
{
490-
xperfVersion = GetFileVersion(GetXperfPath());
491-
outputPrintf(L"WPT version %llu.%llu.%llu.%llu was installed.\n",
492-
xperfVersion >> 48, (xperfVersion >> 32) & 0xFFFF,
493-
(xperfVersion >> 16) & 0xFFFF, xperfVersion & 0xFFFF);
494-
}
495-
else
496-
{
497-
outputPrintf(L"Failure code %u while installing WPT 10.\n", installResult10);
498-
}
471+
outputPrintf(L"Failure code %u while installing WPT 10.\n", installResult10);
499472
}
500473
}
501474
xperfVersion = GetFileVersion(GetXperfPath());
@@ -551,6 +524,8 @@ BOOL CUIforETWDlg::OnInitDialog()
551524
// that Python scripts which rely on xperf.exe being in the path will fail.
552525
// This adds the WPT10 directory to the path. We could just do this when WPT
553526
// has been freshly installed but this seems cleaner.
527+
// We add it to the end of the path so that it won't affect systems that
528+
// already have WPT in the path, perhaps from the store.
554529
auto path = GetEnvironmentVariableString(L"path");
555530
path += L';' + wpt10Dir_;
556531
SetEnvironmentVariable(L"path", path.c_str());

‎package_etw.bat‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,14 @@ mkdir %destdir%\lib
1616
mkdir %destdir%\third_party
1717
mkdir %symboldir%
1818

19-
set wptredistmsi=Windows Performance Toolkit\Redistributables\WPTx64-x86_en-us.msi
20-
set oldwptredistmsi=Windows Performance Toolkit\OldRedistributables\WPTx64-x86_en-us.msi
19+
set wptredistmsi=Windows Performance Toolkit\Redistributables\WPTx64 (DesktopEditions)-x86_en-us.msi
2120

2221
set wpt10=c:\Program Files (x86)\Windows Kits\10\
2322
if not exist "%wpt10%%wptredistmsi%" goto nowpt10
24-
if not exist "%wpt10%%oldwptredistmsi%" goto nooldwpt10
2523
mkdir %destdir%\third_party\wpt10
26-
mkdir %destdir%\third_party\oldwpt10
2724
xcopy "%wpt10%%wptredistmsi%" %destdir%\third_party\wpt10
2825
@if errorlevel 1 goto copyfailure
29-
xcopy "%wpt10%%oldwptredistmsi%" %destdir%\third_party\oldwpt10
30-
@if errorlevel 1 goto copyfailure
31-
xcopy "%wpt10%Licenses\10.0.15063.0\sdk_license.rtf" %destdir%\third_party\wpt10
26+
xcopy "%wpt10%Licenses\10.0.22000.0\sdk_license.rtf" %destdir%\third_party\wpt10
3227
@if errorlevel 1 goto copyfailure
3328
ren %destdir%\third_party\wpt10\sdk_license.rtf LICENSE.rtf
3429

@@ -42,6 +37,7 @@ call %vcvars32%
4237
@rem Build DelayedCreateProcess.exe to the bin directory
4338
@echo Building DelayedCreateProcess.exe
4439
call DelayedCreateProcess\make.bat
40+
del DelayedCreateProcess.obj
4541

4642
cd /d %UIforETW%ETWInsights
4743
@echo Building ETWInsights

0 commit comments

Comments
 (0)