Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:WEVT_TEMPLATE resource

From ReverseEngineering.wiki
Format
On this wiki Facts · Code · Notes · Topics

The compiled event-provider manifest that mc.exe-built PE files (drivers, DLLs, EXEs) carry in a resource named WEVT_TEMPLATE: little-endian, starting with the signature CRIM, listing providers (WEVT) with their channels, events, keywords, levels, opcodes, tasks and binary-XML templates.

Since Windows Vista a Windows event manifest can be stored in a PE file (Format:PE (Portable Executable)) as a resource of the custom type named WEVT_TEMPLATE. Kernel drivers that log through ETW usually carry one. The Event Log service reads it, with the message table (see Format:Windows XML Event Log (EVTX)), to render event text. All of the following is from Joachim Metz's libfwevt documentation (GFDL text, summarised here); fields it marks unknown are marked so.

Layout

Little-endian, strings UTF-16LE without BOM.

  • Instrumentation manifest: CRIM signature, u32 size, u16 major version (3), u16 minor version (1), u32 number of providers, then 20-byte provider descriptors: GUID (16 bytes) and u32 offset of the provider data. All offsets are relative to the start of the manifest. Fact:WEVT TEMPLATE resource/magic/CRIM header.
  • Provider: WEVT, u32 size, u32 message-table id (0xFFFFFFFF if none), u32 number of element descriptors, u32 number of unknown values, then 8-byte descriptors (u32 offset, u32 unknown). Each referenced element identifies itself by signature: CHAN channels, EVNT events, KEYW keywords, LEVL levels, MAPS maps (BMAP bitmaps and VMAP value maps), OPCO opcodes, TASK tasks, TTBL template table; PRVA is documented as unknown.
  • Event definition, 48 bytes: u16 id, u8 version, u8 channel, u8 level, u8 opcode, u16 task, u64 keywords, u32 message id, u32 offsets of template, opcode, level and task definitions (0 if unset), then three unknown fields: Fact:WEVT TEMPLATE resource/struct/Event definition. The EVNT block is EVNT, u32 size, u32 count, u32 unknown, entries.
  • Keyword definition, 16 bytes: u64 bitmask, u32 message id, u32 data offset (name stored as u32 size, UTF-16 string, padding to 8 bytes). Channel definition, 16 bytes: u32 id, u32 name offset, u32 unknown, u32 message id.
  • Template table: TTBL, u32 size, u32 count, then TEMP templates: u32 size, u32 item descriptor count, u32 item name count, u32 items offset, u32 unknown (1 seen for EventData, 2 for UserData), GUID, a binary XML fragment (like Format:Windows XML Event Log (EVTX) binary XML, but name offsets unused and the item list stored outside), 20-byte item descriptors (inType u8 at +4, outType u8 at +5, u16 count at +12, u16 length at +14, u32 name offset at +16), item names. inType values: 1 UnicodeString, 2 AnsiString, 3-10 Int8/UInt8/Int16/UInt16/Int32/UInt32/Int64/UInt64, 0x0B Float, 0x0C Double, 0x0D Boolean, 0x0E Binary, 0x0F GUID, 0x10 Pointer, 0x11 FILETIME, 0x12 SYSTEMTIME, 0x13 SID, 0x14 HexInt32, 0x15 HexInt64. Fact:WEVT TEMPLATE resource/enum/Template item input type.

Reversing use

The template table gives each event's field names and types, so an event id seen in EtwWrite/EventWrite calls in a driver can be mapped to a readable schema. Extract the resource from the PE (resource type name WEVT_TEMPLATE, resource id 1 in typical files: Unverified) and parse it with libfwevt/pyfwevt.

Code & repositories

  • https://github.com/libyal/libfwevt @ 684e0834f27d3883c878dbe7e601a7c4052df623 · license: LGPL-3.0-or-later (declared by the contributor for the files used; GitHub reports LGPL-3.0 for the repository)
    libfwevt: documentation/Windows Event manifest binary format.asciidoc (GFDL 1.3) and the LGPL-3 parser
    Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2026-10-09