Post · 4 min read· pp. 560–562

WMI_LOGGER_MODE

Public symbol files for the kernel in Windows XP SP3 and Windows Server 2003 SP2 show that the LoggerMode in the WMI_LOGGER_CONTEXT was once defined in union with a WMI_LOGGER_MODE structure of ULONG bit fields:

MaskDefinitionVersions
0x00000001ULONG SequentialFile : 1;5.0 to 5.2
0x00000002ULONG CircularFile : 1;5.0 to 5.2
0x00000004ULONG AppendFile : 1;5.1 to 5.2
ULONG Unused1 : 6;5.0 only
ULONG Unused1 : 5;5.1 to 5.2
0x00000100ULONG RealTime : 1;5.0 to 5.2
0x00000200ULONG DelayOpenFile : 1;5.0 to 5.2
0x00000400ULONG BufferOnly : 1;5.0 to 5.2
0x00000800ULONG PrivateLogger : 1;5.0 to 5.2
0x00001000ULONG AddHeader : 1;5.0 to 5.2
0x00002000ULONG UseExisting : 1;5.1 to 5.2
0x00004000ULONG UseGlobalSequence : 1;5.1 to 5.2
0x00008000ULONG UseLocalSequence : 1;5.1 to 5.2
ULONG Unused2 : 16;5.1 to 5.2

The symbol files show that this stopped for version 6.0. When it began is an open question. That it was established for all builds of versions 5.1 and 5.2 must be almost certain. The suggestion is strong that it dates from version 5.0. See especially that PrivateLogger is defined for the kernel’s symbol files even though it is not known to the kernel. It is, however, meaningful to the user-mode implementation right from the start. Though the two implementations, kernel-mode and user-mode, soon diverged, their WMI_LOGGER_CONTEXT structures very plainly had a common origin for version 5.0, and it is here thought that they had the WMI_LOGGER_MODE in common too.

On the other hand, the WMI_LOGGER_MODE can’t have been more than peripheral to the programming even in the versions for which its definition is certain. See in particular the uneven definition of flags for version 5.1: EVENT_TRACE_FILE_MODE_APPEND becomes AppendFile, presumably narrowing what had been left as Unused1, but no bit field is defined for what was then the similarly new EVENT_TRACE_FILE_MODE_NEWFILE.

Kernel Mode Logger Modes

It is perhaps as well to collect here the various bits that represent the wide variety of possible logger modes, as kept in the LoggerMode member of the kernel-mode WMI_LOGGER_CONTEXT. Some are documented, and are defined as macros in EVNTRACE.H, but Microsoft’s names for some are known only from the NTWMI.H header which Microsoft published in the Enterprise edition of the Windows Driver Kit (WDK) for Windows 10 version 1511. The reckoning of which flags are supported in which versions is in preparation: do not rely on it.

ValueNameVersionsKernel-Mode Constraints
0x00000001EVENT_TRACE_FILE_MODE_SEQUENTIAL5.0 and higherinvalid with EVENT_TRACE_FILE_MODE_CIRCULAR
0x00000002EVENT_TRACE_FILE_MODE_CIRCULAR5.0 and higherinvalid with EVENT_TRACE_FILE_MODE_SEQUENTIAL
5.1 and higherinvalid with EVENT_TRACE_FILE_MODE_APPEND
0x00000004EVENT_TRACE_FILE_MODE_APPEND5.1 and higherinvalid with EVENT_TRACE_FILE_MODE_CIRCULAR
0x00000008EVENT_TRACE_FILE_MODE_NEWFILE5.1 and higher
0x00000010unknown5.2 onlybut not defined for 5.2 DDK
EVENT_TRACE_USE_MS_FLUSH_TIMER6.1 and higher
0x00000020EVENT_TRACE_FILE_MODE_PREALLOCATE5.1 and higher
0x00000040EVENT_TRACE_NONSTOPPABLE_MODE6.0 and higher
0x00000080EVENT_TRACE_SECURE_MODE6.0 and higher
0x00000100EVENT_TRACE_REAL_TIME_MODE5.0 and higher
0x00000200EVENT_TRACE_DELAY_OPEN_FILE_MODE5.0 onlyrequires LogFileName
5.1 and higher
6.1 and higherignored (but see note)
0x00000400EVENT_TRACE_BUFFERING_MODE5.0 and higher
0x00000800EVENT_TRACE_PRIVATE_LOGGER_MODEuser-mode only
0x00001000EVENT_TRACE_ADD_HEADER_MODE5.0 only
6.1 and highermostly ignored
0x00002000EVENT_TRACE_USE_KBYTES_FOR_SIZE5.2 and higherbut not defined for 5.2 DDK
0x00004000EVENT_TRACE_USE_GLOBAL_SEQUENCE5.1 and higherinvalid with EVENT_TRACE_USE_LOCAL_SEQUENCE
0x00008000EVENT_TRACE_USE_LOCAL_SEQUENCE5.1 and higherinvalid with EVENT_TRACE_USE_GLOBAL_SEQUENCE
0x00010000EVENT_TRACE_RELOG_MODEuser-mode only
0x00020000EVENT_TRACE_PRIVATE_IN_PROCuser-mode only
0x00040000EVENT_TRACE_BUFFER_INTERFACE_MODE6.1 and higher
0x00080000EVENT_TRACE_KD_FILTER_MODE5.1 and higherbut not defined for 5.1 DDK
0x00100000EVENT_TRACE_REALTIME_RELOG_MODE6.0 and higher
6.1 and highermostly ignored
0x00200000EVENT_TRACE_LOST_EVENTS_DEBUG_MODE6.2 and higher
0x00400000EVENT_TRACE_STOP_ON_HYBRID_SHUTDOWN6.2 and higher
0x00800000EVENT_TRACE_PERSIST_ON_HYBRID_SHUTDOWN6.2 and higher
0x01000000EVENT_TRACE_USE_PAGED_MEMORY5.1 and higher
0x02000000EVENT_TRACE_SYSTEM_LOGGER_MODE6.2 and higher
0x04000000EVENT_TRACE_COMPRESSED_MODE6.2 and higherinvalid
0x08000000EVENT_TRACE_INDEPENDENT_SESSION_MODE6.3 and higher
0x10000000EVENT_TRACE_NO_PER_PROCESSOR_BUFFERING6.1 and higher
0x20000000EVENT_TRACE_BLOCKING_MODE
0x40000000apparently unused
0x80000000EVENT_TRACE_ADDTO_TRIAGE_DUMP6.2 and higher

Very many combinations of these bits are invalid. Some bits are not known to the kernel but are instead vital to the separate NTDLL implementation that lets user-mode processes do their own event tracing.