Search code examples
windowsvisual-c++visual-studio-2013etw

C++ project using Windows Event Log


I´m trying to learn the concept of writing events to Windows Event Log using Manifest and I followed the documentation provided by Microsoft.

I´ll describe the steps I took and where it went wrong. Hopefully someone can tell me whats missing or what I'm doing wrong.

  1. Created a Instrumentation Manifest using ECManGen.exe proving information about the provider (C++ Console application), e.g. path to .exe-file. Created channels for all the type (Debug, Administration, Operational, and Analytic). Finally created an event that I later wanted to write to log. (Also created Tasks and Keywords to organize the Event).

  2. Created a new project in Visual Studio 2013 (C++ Console Application) and included the Manifest (.man) file.

  3. Changed the build settings for the Manifest file to Custom build tool and set command line to mc -v -h . "%(FullPath)" and output to %(Filename).rc;%(Filename).h;.

  4. I then built the project with no problems generating the .rc-file, .h-file, and .bin-files.

  5. After the build I included the all the files to the project generated in Step 4 and rebuild. The rebuild generated the .res-file out of the .rc-file and the resource tab looks like this:

    Project -Manifest.rc
    -11

  6. The last step was to register the provider with wevtutil im Manifest.man and this is where I get the error. I received the following error:

    Warning: Publisher GGSProvider resources are not accessible.

    Failed to open metadata for publisher GGSEventManifest.man. The system cannot find the file specified.

Does anyone see what is wrong or can provide a simple step-by-step guide?

Thanks for any contribution!


Solution

  • I did the following steps but with an DLL-project and it works fine. Can someone explain this behavior?

    The next task is to create an event!