Problem installing a WPT manifest using wevtutil

I am trying to add performance counters and custom events to a piece of software so that I can view them using the Windows Performance Toolkit programs such as XPerf and GPUView. I am going to refrain, using all my powers of restraint, from launching into Qatari speech about the state of documentation for software and the time that I have now wasted trying to tear up prompts from the Internet. I will tell you how I got to where I now, just in case, this is useful for other lost souls.

Until now, I realized that I had to write an Event manifest for my performance and event counters. You can do this manually or with a tool called ecmangen.exe . The documentation for this program provides a good step-by-step guide for creating an event manifest, but does not explain how to integrate them with your code.

The next step, as far as I can do this, is to use two crypto command-line applications: MC.exe and CTRPP.exe . It seems they generate C or C # headers, source and resource files to add events and counts to your code, respectively. Then you need to create your code (look at the samples in "C: \ Program Files \ Microsoft SDKs \ Windows \ v7.1 \ Samples \ winbase \ Eventing"), and then we'll move on to where I'm stuck right now: using the following correctly mysterious tool wevtutil.exe '

This tool needs two things: the binary (exe or DLL) that you compiled with these resources in it, and the manifest file that you used to create these resources. The problem I am facing is that it is very picky about where the binary is located, and I could not determine the shape of this nit-picking. Spells and sacrifices of the goat have not yielded any results.

If I have a path defined in the 'resourceFileName' field of the 'provider' tag in the manifest file, for example 'c: \ MYDIR \ TEd.exe', then this is normal. If, however, I put the same exe in another folder (one of which was not C: \ tw \ TEd.exe), it complains.

The indicated error message is 'Warning: TEd-Event-Provider developer resources are not available.' but no more detailed explanation of why and where he tried to look.

So, am I going to add the tools incorrectly, is there a manual explaining all gotchas, and what is the nature of "wevtutil.exe weird selectivity for directory names.

Thanks in advance,

Tim.

+4
source share
3 answers

I just had the same message and struggled for an hour to resolve it before I got a brain wave and read the error message. -).

The solution to my problem was to simply add the ".rc" file to my project and then rebuild. Looking back, this is pretty obvious, but for a while I was a little embarrassed.

Hope this helps.


Edit - February 4th Okay, not too sure if I know what the problem is, but the next batch of script is how I did it. Good luck.

rem ------------------------------------------------------------------- rem Do all of this from the project directory rem ------------------------------------------------------------------- rem Generate Header and Resource - remove the ReadOnly attrib to "help" it along attrib -r MyModuleTracing.h mc.exe -um MyModuleTracing.xml rem This generates MyModuleTracing.h and MyModuleTracing.rc, add both to your project rem ------------------------------------------------------------------- rem ** Now build the project ** rem ------------------------------------------------------------------- rem Register MyModule Tracing with the system if exist MyModuleTracing.xml ( wevtutil um MyModuleTracing.xml copy MyModuleTracing.xml Release cd Release copy MyModule.dll %SystemRoot%\System32 wevtutil im MyModuleTracing.xml ) rem ------------------------------------------------------------------- rem Do a capture, and also export the results to an XML file. xperf -start MyModuleSession -on [REPLACE_WITH_YOUR_GUID] -f MyModuleSession.etl xperf -on base -f Kernel.etl rem Run the app, wait until exit, and then stop the capture start /wait MyModule.exe xperf -stop xperf -stop MyModuleSession xperf -merge MyModuleSession.etl Kernel.etl MyModuleSessionMerged.etl tracerpt MyModuleSessionMerged.etl -o MyModuleSessionMerged.xml -of XML 
+1
source

I had the same problem - as far as I can tell if there is a directory length limit on wevtutil. When I installed the file from a directory with a shorter path, it worked.

+1
source

In case someone else comes across this, you can make everything work from an arbitrary directory:

Add USER Read & Execute privs to a directory containing or above your project:

icacls projectdir /grant BUILTIN\Users:(OI)(CI)(RX)

Then the installation of the manifest should work without errors:

wevtutil im yourmanifest.man /rf: c: \ full \ path \ to \ yourprogram.exe /mf: c: \ full \ path \ to \ yourprogram.exe

+1
source

Source: https://habr.com/ru/post/1335390/


All Articles