Format:Windows message table resource (RT MESSAGETABLE)
| Extensions | .dll, .exe, .mc (source) |
|---|---|
| Endianness | little |
| Website | https://learn.microsoft.com/en-us/windows/win32/menurc/messagetable-resource |
| On this wiki | Facts · Code · Notes · Topics |
RT_MESSAGETABLE (type 11) resources of PE files, used by event-log message DLLs and FormatMessage: a block count, blocks of (LowId, HighId, OffsetToEntries) and variable-length entries (Length, Flags, Text) where Flags 1 means UTF-16 text and 0 ANSI.
Overview
Message tables are compiled by the message compiler (mc.exe, windmc in MinGW) from .mc scripts into a resource of type RT_MESSAGETABLE (numeric type 11), normally resource id 1. They carry the text of Windows event-log messages (a service's EventMessageFile registry value points to such a DLL), and are read by FormatMessage with FORMAT_MESSAGE_FROM_HMODULE. Reverse engineers get readable, numbered status/error strings from them even in stripped binaries. Sibling resource formats: Format:Windows dialog template resource (RT DIALOG), Format:Windows menu resource (RT MENU).
Layout
All little endian. MESSAGE_RESOURCE_DATA: DWORD NumberOfBlocks, then NumberOfBlocks MESSAGE_RESOURCE_BLOCK of 12 bytes: DWORD LowId, DWORD HighId, DWORD OffsetToEntries (from the start of the resource). At each OffsetToEntries lie HighId - LowId + 1 consecutive MESSAGE_RESOURCE_ENTRY records: WORD Length (size of this entry including the 4-byte header, entries padded to 4 bytes), WORD Flags (MESSAGE_RESOURCE_UNICODE 0x0001 = text is UTF-16LE, 0 = ANSI in a code page), then the text bytes. Text usually ends with NUL (and often \r\n) and contains FormatMessage inserts %1, %2!d!. See Fact:Windows message table resource (RT MESSAGETABLE)/struct/MESSAGE_RESOURCE_BLOCK.
Code & repositories
- https://github.com/mirror/mingw-w64 @
93f3505a758fe70e56678f00e753af3bc4f640bb· license: ZPL-2.1 (declared by the contributor for the files used; GitHub reports BSD-2-Clause (read from COPYING; GitHub's detector did not classify it) for the repository)
MinGW-w64 headers; winnt.h defines the MESSAGE_RESOURCE_* structures.
Tested on: source read, not run: source read · checked 2026-10-18; last activity 2024-09-25
Pitfalls
- Message ids are 32-bit values with severity, customer bit, facility and code packed in (top two bits severity, 0x20000000 customer flag); an .mc id like 0xC0000005 is the whole DWORD, not an index.
- There is one table per language (resource language id); pick the language before parsing.
- Unverified: the id bit-split and the registry link are from general Windows knowledge, not read from a source this session.
Evidence & references
- https://github.com/mirror/mingw-w64 at commit 93f3505a758fe70e56678f00e753af3bc4f640bb:
mingw-w64-headers/include/winnt.hlines 9027-9058 (MESSAGE_RESOURCE_ENTRY, MESSAGE_RESOURCE_UNICODE 0x0001, MESSAGE_RESOURCE_BLOCK, MESSAGE_RESOURCE_DATA).