I may be late, but this may help the future reader:
To read the .evt file with standard lib (say, in C ++), you need to know the ELF_LOGFILE_HEADER structure and the EVENTLOGRECORD structure . Also here is the event log file format.
Now everything is simpler what you need to do:
I. Declare Structures
Log Header Structure
typedef unsigned long ULONG; typedef struct _EVENTLOGHEADER { ULONG HeaderSize; ULONG Signature; ULONG MajorVersion; ULONG MinorVersion; ULONG StartOffset; ULONG EndOffset; ULONG CurrentRecordNumber; ULONG OldestRecordNumber; ULONG MaxSize; ULONG Flags; ULONG Retention; ULONG EndHeaderSize; } EVENTLOGHEADER, *PEVENTLOGHEADER;
Log Entry Structure
typedef unsigned long DWORD; typedef unsigned short WORD; typedef struct _EVENTLOGRECORD { DWORD Length; DWORD Reserved; DWORD RecordNumber; DWORD TimeGenerated; DWORD TimeWritten; DWORD EventID; WORD EventType; WORD NumStrings; WORD EventCategory; WORD ReservedFlags; DWORD ClosingRecordNumber; DWORD StringOffset; DWORD UserSidLength; DWORD UserSidOffset; DWORD DataLength; DWORD DataOffset; } EVENTLOGRECORD, *PEVENTLOGRECORD;
II. Read it!
First declare the variable std::ifstream to open and read the file (binary)
using namespace std; ifstream file; file.open(fileName,ios::in|ios::binary); if(file.is_open()){ _EVENTLOGHEADER logheader; _EVENTLOGRECORD logRecord;
Wish it helps someone
source share