google / UIforETW

User interface for recording and managing ETW traces
https://randomascii.wordpress.com/2015/04/14/uiforetw-windows-performance-made-easier/
Apache License 2.0
1.55k stars 201 forks source link

UIforETW does not start if windows 10 sdk is not in default path #159

Open juliusjunghans opened 1 year ago

juliusjunghans commented 1 year ago

Hi,

uiforetw starts and says that it will install if you run some version of it, shown in the popup. im currently using: etwpackage1.56

windows 10 sdk is installed and wpa is also installed, a "where xperf.exe" shows the correct path. would be nice if uiforetw could at least check if xperf.exe is in the path and not just assume in good old windows tradition that its in C:\programs....

randomascii commented 1 year ago

In UIforETWDlg.cpp there is this line of code which attempts to retrieve the install directory for SDK directory and, by extension, WPA:

wpt10Dir_ = ReadRegistryString(HKEY_LOCAL_MACHINE, L"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0", L"InstallationFolder", true);

You'd have to debug this to understand why it isn't correctly handling your SDK install location.

MagicAndre1981 commented 1 year ago

I also get message that WPT is missing,

image

but I have the 22621.755 installed and in normal location in "C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\:

image

I don't have this key in registry. I always query KitsRoot10 value for getting root install path of Windows tools.

randomascii commented 1 year ago

What version of UIforETW are you running? In commit 6115a3b681e4bbb22baf0d005409d253703121db I added logic to search more widely for xperf, because the registry key is not always present. Specifically, if WPT 22H2 is installed as a stand-alone product then it is installed to ProgramFiles instead of ProgramFilesX86 and cannot be located in the SDK install folder.

My solution was to scan the path looking for xperf.exe. This may require exiting UIforETW after it installs WPT so that when it is relaunched it gets the updated path.

What is HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots set to on your machine, and what version of UIforETW are you running? PRs happily accepted.

MagicAndre1981 commented 1 year ago

I use the latest etwpackage1.58.zip and here are my data:

image

randomascii commented 1 year ago

There are some heuristics in CUIforETWDlg::GetInstallFolder() that could fail in various ways. UIforETW reads a registry key to get the install directory for WPT. If that read succeeds but points to the wrong place then things will break. If that read fails then it will look in progFilesDir and progFilesx86Dir.

Can you debug and figure out why none of this is working? It may be that deleting the "else" at line 373 of UIforETWDlg.cpp is needed - that looks wrong.

We could add code to use your recommended registry key, but I don't know if it will be any more reliable than the one that I currently use - it might just fail under different circumstances.

MagicAndre1981 commented 1 year ago

The KitsRoot10 is the correct value. It was 80 and 81 for Windows 8(.1) SDK. So, look for this value first and follback to your other ways if it not found for what ever reasons. I don't have VS installed my host system (only in VMs) and remote debuging for non UWP apps is ugly

MagicAndre1981 commented 1 year ago

I tried to debug the issue, but I can't compile it even if I have C++ workload and MFC installed.

randomascii commented 1 year ago

I think it requires ATL to be installed as well (or instead of MFC?), but without seeing what error messages you are getting I can't offer any more useful suggestions.

MagicAndre1981 commented 1 year ago

I have both installed. I get this error:

error MSB8041: MFC libraries are required for this project. Install them from the Visual Studio installer (Individual Components tab) for any toolsets and architectures being used.

I have all MFC/ATL (16.x, 17.x) things installed, I only skipped the ARM64 versions of the libs.

randomascii commented 1 year ago

image

This is what I have installed, FWIW.

Maybe remove the ARM64 configuration of the solution?

randomascii commented 1 year ago

Let me know if https://github.com/google/UIforETW/releases/tag/v.158c works

MagicAndre1981 commented 1 year ago

Let me know if https://github.com/google/UIforETW/releases/tag/v.158c works

works fine now for me. thanks

BigEntropy commented 8 months ago

What is the best way to get UIforETW to work on Windows 7 x64? If I use WPT10 from UIforETW kit, then the program at startup reports that this version of WPT is not compatible with Win7x64. If I use WPT v.4 for Win7x64, UIforETW does not see WPT v.4 installed because it is located in a different place. Is there any way to resolve this issue?

MagicAndre1981 commented 8 months ago

for Windows 7 the last working WPT version was from Windows 10 1511 Build 10586 SDK