How can I get in C++ the same behavior of `wevtutil qe Application`?

226 views Asked by At

I would like to export the Windows Application event log to an XML file.

In the past I asked How can I programmatically (C++) save the event log file as a CSV? with no success.

Today I tried EvtArchiveExportedLog fails with ERROR_DIRECTORY with no success: I get the error ERROR_FILE_NOT_FOUND instead of ERROR_DIRECTORY and I have no idea on how to

grant access privileges to the calling thread

as suggested in the answer https://stackoverflow.com/a/5110631/

The command line wevtutil qe Application > Application.xml does exactly what I need and I would like to get the same behavior with C++ code (apart from system("wevtutil qe Application > Application.xml");).

Iterating over all the events seems poorly performing https://serverfault.com/a/353439/44612

0

There are 0 answers