Debian Codegraph @

src/gallium/frontends/mediafoundation/wppconfig/rev1/defaultwpp.ini

raw
1 #
2 # Default configuration options for tracewpp.
3 #
4 # This file provides configuration settings for tracewpp. By default, tracewpp
5 # uses "defaultwpp.ini" for configuration settings. An alternate INI file can
6 # be specified via the -defwpp parameter. Additional configuration settings can
7 # be specified via the -ini parameter or via "begin_wpp config" blocks in
8 # files specified via the -scan parameter.
9 #
10 # When parsing an INI file or a "begin_wpp config" block, tracewpp searches for
11 # syntax that looks like a function call, e.g. "FunctionName(arg1, ...);". For
12 # each function call, if the function name is one of the recognized commands
13 # described below (e.g. NOPREFIX, USEPREFIX, INCLUDE), that command is
14 # executed. Otherwise, the function call is treated as the definition of a
15 # trace function.
16
17 ################################
18 # General configuration commands
19 ################################
20 #
21 # FUNC FunctionName(ARG1, ARG2, MSG, ...);
22 # FUNC FunctionName{ARG1=value, ARG2=value}(ARG3, ARG4, MSG, ...);
23 #
24 # Defines a trace function and its arguments. The tracewpp tool will scan all
25 # source files for calls to the specified trace function. The generated TMH
26 # file will then define the specified name as a macro and will generate code
27 # to handle each call to the macro.
28 #
29 # Function definitions are often prefixed by "FUNC", e.g.
30 # "FUNC DoTraceMessage(LEVEL, MSG, ...);". The "FUNC" prefix is optional
31 # but is helpful in drawing attention to function definitions.
32 #
33 # Arguments provided in {braces} are defaulted parameters (sometimes called
34 # "assumed arguments"). If you define a trace function
35 # MyTrace{ARG1=5}(MSG, ...), then WPP will treat any use
36 # of MyTrace("...", a, b) as if it were MyTrace(5, "...", a, b), and WPP will
37 # generate macros for MyTrace that include an ARG1 parameter (for use by
38 # user-specified expressions in the macro definition).
39 #
40 # Note that when using TMF-based WPP, WPP will expect the user to define
41 # ENABLED and LOGGER macros based on the arguments for defined functions.
42 # For example, if you define a trace function
43 # MyTrace(FLAG, MYARG, MSG, ...), WPP will expect user-defined macros
44 # WPP_FLAG_MYARG_ENABLED(FLAG, MYARG) and WPP_FLAG_MYARG_LOGGER(FLAG, MYARG)
45 # to be provided by the user. These user-supplied macros are usually defined
46 # in terms of the corresponding WPP-supplied macros WPP_LEVEL_ENABLED(LEVEL)
47 # and WPP_LEVEL_LOGGER(LEVEL).
48 #
49 # Certain argument names trigger special behavior:
50 # - "MSG" is the format string.
51 # - "..." is a placeholder for the format string arguments. If present, it
52 # must be the last argument.
53 # - "PUBLIC_FILTER" marks the function as conditionally public. The function
54 # will be public if the WPP_PUBLIC_<Flag> macro is defined when the file is
55 # compiled (where <Flag> is the value of the PUBLIC_FILTER argument).
56 #
57 # Certain argument names trigger special behavior in manifest-based WPP:
58 # - "ControlGuid" specifies the name of the control GUID for the event. If
59 # there is no ControlGuid argument, tracewpp will determine the control
60 # GUID based on the event's level or keywords.
61 # - "Level" specifies the level of the event. If there is no Level argument,
62 # tracewpp will look for valid level names in all arguments of the event.
63 # If no level name is found, the level will default to "win:Verbose".
64 # - "Keywords" specifies the keywords (flags) of the event. If there is no
65 # Keywords argument, tracewpp will look for valid keyword names in all
66 # arguments of the event. If no keywords are found, the keyword will be
67 # "win:AnyKeyword" (i.e. 0).
68 # - "Name" specifies the event name.
69 # - "Id" allows manual assignment of event Id and Version attributes. Syntax
70 # is either "ID" or "IDvVERSION", e.g. "24" or "24v2". The specified Id
71 # must be a number from 0..65535 that is outside of the auto-assignment
72 # pool. Note that the auto-assignment pool defaults to 10..65535, so manual
73 # assignment generally requires adjusting the auto-assignment pool (via the
74 # TRACERANGE command).
75 # - "Func" specifies the name of the event's call site function. Note that
76 # when using manifest-based WPP, tracewpp is unable to automatically set
77 # the event's function name during manifest generation. The function name
78 # can be manually specified via the Func parameter or it can be included in
79 # the event payload via DEFAULT_FUNC_NAME_IN_EVENT/USE_FUNC_NAME_IN_EVENT.
80 #
81 # NOPREFIX(FunctionName);
82 #
83 # Removes the default trace message prefix "%!STDPREFIX!" for the specified
84 # trace function.
85 #
86 # USEPREFIX(FunctionName, [Prefix, ArgNames...]);
87 # USESUFFIX(FunctionName, [Suffix, ArgNames...]);
88 #
89 # Sets the trace message prefix or suffix for the specified trace function.
90 # Each time WPP sees function("message", ...), it will add the specified
91 # prefix or suffix to "message".
92 #
93 # PUBLIC_FILTER(FunctionName, Flag);
94 #
95 # Marks the named function as conditionally public. The function will be
96 # public if the WPP_PUBLIC_<Flag> macro is defined when the file is compiled.
97 # Public functions omit certain metadata from the TMF such as filename and
98 # line number. (Not applicable to manifest-based WPP.)
99 #
100 # INCLUDE(IniFileName);
101 #
102 # Immediately processes the specified file as an INI file.
103 #
104 # PROCESSFILES(SourceFile...);
105 #
106 # Processes the specified input file(s) as if they were specified on the
107 # tracewpp command line. Example: PROCESSFILES("MyFile.cpp", "B*.c");
108 #
109 # SCANFORMACROS(HeaderFile...);
110 #
111 # Scans the specified file(s) as if they were specified with
112 # /scan:HeaderFile on the tracewpp command line.
113 #
114 # SEPARATE_TRACE_GUID_PER_FILE(Enabled);
115 #
116 # If enabled (1), a new trace GUID will be generated for each input file
117 # scanned. This is useful for TMF-based WPP, as it means changes in one
118 # source file will not affect the trace GUID or event IDs of other source
119 # files. This is undesirable for manifest-based WPP, as it requires a
120 # large number of providers to be registered.
121 #
122 # This is enabled (1) by default for TMF-based WPP. This is disabled (0) by
123 # default for manifest-based WPP (when the /man parameter is specified).
124 #
125 # TRACERANGE(Min, Max);
126 #
127 # Configures the range of numbers that WPP will use when automatically
128 # assigning event IDs. Default is 10..65535. If manually assigning Ids, you
129 # will need to reduce this range to reserve Ids for manual assignment, e.g.
130 # use TRACERANGE(1000, 65535) so that Ids 1..999 can be manually assigned.
131 #
132 # WPP_FLAGS(Option...);
133 #
134 # Processes the specified options as if they were specified on the tracewpp
135 # command line. Example: WPP_FLAGS(noshrieks, p:MyProject);
136
137 ################################
138 # Type definition commands
139 ################################
140 #
141 # The following commands can be used to define data types for use with WPP
142 # trace functions. WPP type definitions may include the following settings:
143 #
144 # - Name: the WPP name of the type being defined. This name must be unique.
145 # When reading the WPP format strings from source code, WPP matches the
146 # requested type against this name. For example, "%d" will cause WPP to look
147 # for a type named "d", and "%!HRESULT!" will cause WPP to look for a type
148 # named "HRESULT".
149 # - EquivType: the name of the type in C or C++, e.g. "int". This type will be
150 # used for the parameter of the inline helper function in the generated
151 # code.
152 # - MofType: the MOF name of the type (shows up in the TMF file).
153 # - FormatSpec: the format string to use for this type in the message string.
154 # For example, if FormatSpec is "I64x" then a message string might look like:
155 # "Value = %10!I64x!".
156 # - Sig: the short name to use for this type when generating the names for
157 # helper functions. Two different WPP types might use the same signature
158 # because the types are compatible in terms of the helper functions (the
159 # underlying C/C++ types are the same and the types serialize into ETW data
160 # the same way).
161 # - Priority: the priority to give the type during argument sorting (only
162 # significant when the /reorder parameter is used). This value is typically
163 # set to the type's alignment so that more-aligned values sort first and
164 # remain aligned within the ETW data.
165 # - ManifestType: describes the how the type should be treated in
166 # manifest-based WPP. The ManifestType is a semicolon-separated list of type
167 # parameters. The first parameter is required and specifies the winmeta input
168 # type, e.g. "win:UInt32" (valid winmeta types are described in winmeta.xml).
169 # Subsequent parameters specify options in the form of a name=value pair. The
170 # supported options are:
171 # - outType: Specifies the winmeta output type (i.e. a type formatting
172 # qualifier), e.g. "xs:string". If not set, the type will not include an
173 # outType attribute in the manifest and will receive default formatting by
174 # the trace decoder. Example use of outType: win:Int32;outType=win:HResult
175 # - adapter: Specifies a function or macro that should be applied to values
176 # of this type before passing the value to the MC-generated EventWrite
177 # macro. For example, if argument a10 has no adapter and argument a11 has
178 # "ADAPT" as its adapter, the MC-generated EventWrite macro would be
179 # invoked as EventWriteMyEvent(a10, ADAPT(a11)). The adapter might perform
180 # a cast (e.g. cast ULONG_PTR to void*) or in the case of a Counted type
181 # might convert a single value into a length+pointer pair. For example, the
182 # adapter for a PUNICODE_STRING type might be the following macro:
183 # #define ADAPT_PSTR(p) p->Length/2, p->Buffer
184 # Example use of adapter: win:CountedUnicodeString;adapter=ADAPT_PSTR
185 #
186 # CUSTOM_TYPE(Name, BaseType(Extension), [FormatSpec]);
187 #
188 # Creates a new type by adding an extension to an existing type. Typically
189 # used to define enumerations, e.g.:
190 # ItemListByte(EnumValues...), ItemListShort(EnumValues...),
191 # ItemListLong(EnumValues...), ItemSetByte(EnumValues...),
192 # ItemSetShort(EnumValues...), ItemSetLong(EnumValues...),
193 # ItemEnum(EnumName), or ItemFlagsEnum(EnumName).
194 #
195 # ItemList types are used for list enums, i.e. items counting up from 0.
196 # ItemList types support skipping values via Value=number syntax.
197 #
198 # ItemSet types are used for bitset enums, i.e. the first item has value
199 # 1, the second has value 2, the third has value 4, the fourth has value 8.
200 #
201 # ItemEnum and ItemFlagsEnum types reference the name of a C/C++ enum and
202 # are resolved using symbol information from the PDB. (ItemEnum and
203 # ItemFlagsEnum do not work for manifest-based WPP because the PDB is not
204 # used for resolving enumerations.)
205 #
206 # TYPEMACRO(Name, BaseType(Extension), [FormatSpec]);
207 #
208 # Deprecated. Same as CUSTOM_TYPE.
209 #
210 # DEFINE_SIMPLE_TYPE(Name, EquivType, MofType, FormatSpec, Sig, Priority,
211 # [ManifestType]);
212 #
213 # Creates a new fixed-length type that is passed to the helper function by
214 # value (uses helper macro WPP_LOGTYPEVAL). Size in the event payload will
215 # be sizeof(EquivType).
216 #
217 # DEFINE_SIMPLE_TYPE_PTR(Name, EquivType, MofType, FormatSpec, Sig, Priority,
218 # [ManifestType]);
219 #
220 # Creates a new fixed-length type that is passed to the helper function by
221 # address (uses helper macro WPP_LOGTYPEPTR). Size in the event payload will
222 # be sizeof(*value).
223 #
224 # DEFINE_FLAVOR(Name, BaseType, [MofType, FormatSpec, ManifestType]);
225 #
226 # Defines a new type that is based on another similar type, potentially
227 # overriding the base type's MofType, FormatSpec, and manifest type. Omitted
228 # or blank settings will remain the same as the base type.
229 #
230 # DEFINE_CPLX_TYPE(Name, MacroName, EquivType, MofType, FormatSpec, Sig,
231 # Priority, [ManifestType]);
232 #
233 # Defines a complex type, i.e. one that requires special handling via a
234 # helper macro other than WPP_LOGTYPEVAL or WPP_LOGTYPEPTR. Any type with a
235 # variable length (e.g. any string type) is complex.
236 #
237 # MacroName is the name of the helper macro that WPP should invoke when
238 # passing this value to the helper function. The helper macro should itself
239 # invoke the WPP_LOGPAIR macro with the data size and the data pointer. (Note
240 # that helper macros are only used for TMF-based WPP, not for manifest-based
241 # WPP.)
242
243 ################################
244 # Manifest definition commands
245 ################################
246 #
247 # The following commands are used with manifest-based WPP. Many of these
248 # commands accept a required Name, and allow for an optional Symbol. The item
249 # defined by such a command can be referenced by either its name or its
250 # symbol. If no symbol is defined, it can only be referenced by its name. The
251 # symbol may be useful in cases where the desired name is not a C/C++-friendly
252 # identifier.
253 #
254 # MANIFEST_CONFIGURATION(ManifestFile, [HeaderFile, Prefix]);
255 #
256 # For use with manifest-based WPP. Normally specified via the command-line
257 # -man option, not in an INI file or via configuration blocks.
258 #
259 # MANIFEST_RESOURCES(ResourceFile, [MessageFile, Culture]);
260 #
261 # For use with manifest-based WPP. Specifies information about the installed
262 # location of the DLL/EXE/SYS file that contains a manifest's resource data.
263 # If not specified, Culture defaults to "en-us". Since the install location
264 # is usually not known at build time, tracewpp defaults to using dummy paths
265 # for the resource file and message file. The dummy paths are typically
266 # overridden by the /rf and /mf parameters on the wevtutil command line
267 # during manifest installation. Note that the ResourceFile and MessageFile
268 # values must be absolute paths.
269 #
270 # DEFINE_CONTROL_GUID(Name, [Guid, Symbol]);
271 #
272 # For use with manifest-based WPP. Defines a control GUID (aka a provider).
273 # If the Guid parameter is not specified, the GUID for the provider will be
274 # computed by hashing the Name using the same name hashing algorithm as is
275 # used by tracelog, xperf, EventSource, and other ETW tools.
276 #
277 # DEFINE_BIT(Name, [Mask, Symbol]);
278 #
279 # For use with manifest-based WPP. Adds a keyword to the most recently
280 # defined control guid. The default mask of the keyword is the control
281 # guid's lowest unused keyword bit.
282 #
283 # Mask may be specified as decimal or hexadecimal and must be a power of 2.
284 #
285 # DEFINE_KEYWORD(Name, ControlGuidId, Mask, [Symbol]);
286 #
287 # For use with manifest-based WPP. Defines a keyword associated with the
288 # specified control GUID. Rarely used: DEFINE_BIT is usually simpler.
289 #
290 # DEFINE_LEVEL(Name, ControlGuidId, Value, [Symbol]);
291 #
292 # For use with manifest-based WPP. Defines a level associated with the
293 # specified control GUID. The level value must not conflict with any
294 # built-in levels (level values 0 through 15 are built-in levels). Rarely
295 # used: the built-in levels are sufficient for most components.
296 #
297 # DEFINE_BUILTIN_KEYWORD(Name, Mask, [Symbol, Symbol...]);
298 #
299 # For use with manifest-based WPP. Normally used in the defaultwpp.ini file,
300 # not in per-project INI files or configuration blocks. Defines a global
301 # (Microsoft-defined) keyword value. These keywords can be used with any
302 # control GUID. These keywords will not be defined in the manifest - they
303 # are expected to match keyword definitions from winmeta.xml.
304 #
305 # DEFINE_BUILTIN_LEVEL(Name, Value, [Symbol, Symbol...]);
306 #
307 # For use with manifest-based WPP. Normally used in the defaultwpp.ini file,
308 # not in per-project INI files or configuration blocks. Defines a global
309 # (Microsoft-defined) level value. These levels can be used with any control
310 # GUID. These levels will not be defined in the manifest - they are expected
311 # to match level definitions from winmeta.xml.
312 #
313 # DEFAULT_FUNC_NAME_IN_EVENT(Expression, [TypeName]);
314 #
315 # For use with manifest-based WPP. When using manifest-based WPP, tracewpp is
316 # unable to automatically set the event's function name during manifest
317 # generation. The function name can be manually specified via the Func
318 # parameter or it can be included in the event payload via
319 # DEFAULT_FUNC_NAME_IN_EVENT or USE_FUNC_NAME_IN_EVENT.
320
321 # The DEFAULT_FUNC_NAME_IN_EVENT command will add a hidden string property
322 # named "!FUNC!" to every event (except when overridden by
323 # USE_FUNC_NAME_IN_EVENT). The value of the property will be taken from the
324 # specified Expression. The Expression will typically be set to
325 # "__FUNCTION__". TypeName is the WPP name of the type to use for the hidden
326 # argument. TypeName defaults to "hs" (i.e. nul-terminated char* string).
327 #
328 # USE_FUNC_NAME_IN_EVENT(FunctionName, Expression, [TypeName]);
329 #
330 # For use with manifest-based WPP. When using manifest-based WPP, tracewpp is
331 # unable to automatically set the event's function name during manifest
332 # generation. The function name can be manually specified via the Func
333 # parameter or it can be included in the event payload via
334 # DEFAULT_FUNC_NAME_IN_EVENT or USE_FUNC_NAME_IN_EVENT.
335 #
336 # The USE_FUNC_NAME_IN_EVENT command with a non-empty value for Expression
337 # will add a hidden string property named "!FUNC!" to every event generated
338 # by the specified trace function. The value of the property will be taken
339 # from the specified Expression. The Expression will typically be set to
340 # "__FUNCTION__". TypeName is the WPP name of the type to use for the hidden
341 # argument. TypeName defaults to "hs" (i.e. nul-terminated char* string).
342 #
343 # If Expression is empty (i.e. ""), the "!FUNC!" property will not be added
344 # to events generated by the specified trace function. A blank Expression
345 # can be used to override a default set by DEFAULT_FUNC_NAME_IN_EVENT.
346 #
347
348 ################################
349 # Format string syntax
350 ################################
351 #
352 # The format string is parsed to determine the type and format of event
353 # properties. Format string syntax is similar to printf, i.e. a '%' character
354 # not immediately followed by another '%' character will be treated as the
355 # start of a property reference.
356 #
357 # A property reference is parsed as one of the following:
358 #
359 # '%' [ '{' PropertyName '}' ] [Prefix] ShortTypeName
360 # '%' [ '{' PropertyName '}' ] [ArgNum] '!' [Prefix] LongTypeName '!'
361 #
362 # {PropertyName} is optional. If specified, the name must contain only
363 # identifier characters, i.e. a-z, 0-9, and '_'.
364 #
365 # Prefix includes flags ('-', '+', '#'), width digits, and/or '.' followed by
366 # precision digits. Note that prefix does not support "*" or ".*".
367 #
368 # If prefix is specified, it will be included in the event's format string
369 # along with the type's FormatSpec. For example, "%+02hX" would be parsed as
370 # Prefix="+02", ShortTypeName="hX". Type "hX" has FormatSpec="X", so the final
371 # WPP format string for the property would be "+02X".
372 #
373 # If the -NoShrieks command-line option is set and the prefix before a
374 # ShortTypeName contains only digits, tracewpp will treat the number as an
375 # ArgNum instead of a Width.
376 #
377 # The ArgNum before '!' is optional. It indicates the index of the argument to
378 # use for this property reference. If not specified, ArgNum is determined from
379 # the position of the property reference in the format string.
380 #
381 # By default, ShortTypeName is a length (one of "", "I", "I64", "h", "w", "l",
382 # or "ll") followed by a specifier (any single character). However, if the
383 # -NoShrieks command-line option is set, ShortTypeName is any number of
384 # identifier characters (a-z, A-Z, 0-9, '_') and ends at the first
385 # non-identifier character.
386 #
387 # LongTypeName is any non-empty sequence of characters ending at the '!'.
388 #
389 # ShortTypeName or LongTypeName must match the name of a defined WPP type (i.e.
390 # the type names defined below or your own custom types).
391 #
392
393 ################################
394 # Default WPP configuration
395 ################################
396
397 # our basic arithmetic types
398
399 DEFINE_SIMPLE_TYPE( XINT64, signed __int64, ItemLongLongX, "I64x", i, 8, win:HexInt64);
400 DEFINE_SIMPLE_TYPE( XXINT64,signed __int64, ItemLongLongXX,"I64X", i, 8, win:HexInt64);
401 DEFINE_SIMPLE_TYPE( OINT64, signed __int64, ItemLongLongO, "I64o", i, 8, win:HexInt64);
402
403 DEFINE_SIMPLE_TYPE( SBYTE, signed char, ItemChar, "c", c, 1, win:Int8);
404 DEFINE_SIMPLE_TYPE( SSHORT, signed short, ItemShort, "hd", h, 2, win:Int16);
405 DEFINE_SIMPLE_TYPE( SINT, signed int, ItemLong, "d", d, 4, win:Int32);
406 DEFINE_SIMPLE_TYPE( SLONG, signed long, ItemLong, "ld", l, 4, win:Int32);
407 DEFINE_SIMPLE_TYPE( SINT64, signed __int64, ItemLongLong, "I64d", i, 8, win:Int64);
408
409 DEFINE_SIMPLE_TYPE( UBYTE, unsigned char, ItemChar, "c", C, 1, win:UInt8);
410 DEFINE_SIMPLE_TYPE( USHORT, unsigned short, ItemShort, "hu", H, 2, win:UInt16);
411 DEFINE_SIMPLE_TYPE( UINT, unsigned int, ItemLong, "u", D, 4, win:UInt32);
412 DEFINE_SIMPLE_TYPE( ULONG, unsigned long, ItemLong, "lu", L, 4, win:UInt32);
413 DEFINE_SIMPLE_TYPE( UINT64, unsigned __int64,ItemULongLong, "I64u", I, 8, win:UInt64);
414
415 DEFINE_SIMPLE_TYPE( DOUBLE, double, ItemDouble, "s", g, 8, win:Double);
416
417 DEFINE_FLAVOR( UCHAR, UBYTE, ItemUChar, "c", win:UInt8; outType=xs:string);
418 DEFINE_FLAVOR( SCHAR, SBYTE, ItemChar, "c", win:Int8; outType=xs:string);
419
420 # arch dependent types
421
422 DEFINE_SIMPLE_TYPE( SLONGPTR, LONG_PTR, ItemPtr, "Id", p, 7, win:Pointer; adapter=WPP_ADAPTER_PVOID; outType=xs:long);
423 DEFINE_SIMPLE_TYPE( ULONGPTR, ULONG_PTR, ItemPtr, "Iu", P, 7, win:Pointer; adapter=WPP_ADAPTER_PVOID; outType=xs:unsignedLong);
424 DEFINE_SIMPLE_TYPE( PTR, const void*, ItemPtr, "p", q, 6, win:Pointer);
425 DEFINE_SIMPLE_TYPE( HANDLE, const void*, ItemPtr, "p", q, 6, win:Pointer);
426
427 DEFINE_SIMPLE_TYPE_PTR(GUID, LPCGUID, ItemGuid, "s", _guid_, 4, win:GUID);
428
429 # Predefined constants.
430 # Typically used in the function's prefix or suffix.
431 DEFINE_SIMPLE_TYPE( COMPNAME,,, "__COMPNAME__",,);
432 DEFINE_SIMPLE_TYPE( FILE,,, "__FILE__",,);
433 DEFINE_SIMPLE_TYPE( LINE,,, "__LINE__",,);
434 DEFINE_SIMPLE_TYPE( SPACE,,, " ",,);
435
436 # The following can be used in the prefix or suffix.
437 DEFINE_SIMPLE_TYPE( FUNC,,, "%!FUNC!",,);
438 DEFINE_SIMPLE_TYPE( LEVEL,,, "%!LEVEL!",,);
439 DEFINE_SIMPLE_TYPE( KEYWORDS,,, "%!FLAGS!",,);
440 DEFINE_SIMPLE_TYPE( STDPREFIX,,, "%0",,); # Only works at start of prefix. Ignored for manifest-based WPP.
441 DEFINE_SIMPLE_TYPE( MOD,,, "%1!s!",,);
442 DEFINE_SIMPLE_TYPE( TYP,,, "%2!s!",,);
443 DEFINE_SIMPLE_TYPE( TID,,, "%3!x!",,);
444 DEFINE_SIMPLE_TYPE( NOW,,, "%4!s!",,);
445 DEFINE_SIMPLE_TYPE( SEQ,,, "%7!u!",,);
446 DEFINE_SIMPLE_TYPE( PID,,, "%8!x!",,);
447 DEFINE_SIMPLE_TYPE( CPU,,, "%9!u!",,);
448
449 # Complex types
450
451 # Strings and SID require custom processing
452 DEFINE_CPLX_TYPE(ASTR, WPP_LOGASTR, LPCSTR, ItemString, "s", s, 1, win:AnsiString);
453 DEFINE_CPLX_TYPE(ARSTR, WPP_LOGASTR, LPCSTR, ItemRString, "s", s, 1, win:AnsiString);
454 DEFINE_CPLX_TYPE(ARWSTR,WPP_LOGWSTR, LPCWSTR, ItemRWString,"s", S, 2, win:UnicodeString);
455 DEFINE_CPLX_TYPE(WSTR, WPP_LOGWSTR, LPCWSTR, ItemWString, "s", S, 2, win:UnicodeString);
456 DEFINE_CPLX_TYPE(CSTR, WPP_LOGPCSTR, const CSTRING*, ItemPString, "s", z, 1, win:CountedAnsiString; adapter=WPP_ADAPTER_PCSTR);
457 DEFINE_CPLX_TYPE(USTR, WPP_LOGPUSTR, PCUNICODE_STRING, ItemPWString,"s", Z, 2, win:CountedUnicodeString; adapter=WPP_ADAPTER_PUSTR);
458 DEFINE_CPLX_TYPE(ANSTR, WPP_LOGPCSTR, const ANSI_STRING*, ItemPString, "s", aZ, 1, win:CountedAnsiString; adapter=WPP_ADAPTER_PCSTR);
459 DEFINE_CPLX_TYPE(sid, WPP_LOGPSID, PSID, ItemSid, "s", _sid_, 0, win:SID; adapter=WPP_ADAPTER_PSID);
460
461 # Raw binary data. Usage: DoTraceMessage(FLAG, "%!BIN!", WppBinary(pointer, size));
462 DEFINE_CPLX_TYPE(BIN, WPP_LOGCSTR, WPP_BINARY, ItemHexDump, "s", _zb_, 1, win:CountedBinary; adapter=WPP_ADAPTER_BIN);
463
464 # C++ string types
465 DEFINE_CPLX_TYPE(str, WPP_LOGCPPSTR, const std::string&, ItemPString, "s", _str_, 0, win:CountedAnsiString; adapter=WPP_ADAPTER_CPPSTR);
466 DEFINE_CPLX_TYPE(wstr, WPP_LOGCPPSTR, const std::wstring&, ItemPWString, "s", _wstr_, 0, win:CountedUnicodeString; adapter=WPP_ADAPTER_CPPSTR);
467 DEFINE_CPLX_TYPE(sv, WPP_LOGCPPVEC, const std::string_view&, ItemPString, "s", _sv_, 0, win:CountedAnsiString; adapter=WPP_ADAPTER_CPPVEC);
468 DEFINE_CPLX_TYPE(wsv, WPP_LOGCPPVEC, const std::wstring_view&,ItemPWString, "s", _wsv_, 0, win:CountedUnicodeString; adapter=WPP_ADAPTER_CPPVEC);
469
470 # Define printf-compatible types
471
472 DEFINE_FLAVOR(e, DOUBLE,,);
473 DEFINE_FLAVOR(E, DOUBLE,,);
474 DEFINE_FLAVOR(f, DOUBLE,,);
475 DEFINE_FLAVOR(g, DOUBLE,,);
476 DEFINE_FLAVOR(G, DOUBLE,,);
477
478 DEFINE_FLAVOR(c, SCHAR,,);
479 DEFINE_FLAVOR(hc, SCHAR,,);
480 DEFINE_FLAVOR(lc, SSHORT,,);
481 DEFINE_FLAVOR(wc, SSHORT,,);
482 DEFINE_FLAVOR(C, SSHORT,,);
483
484 DEFINE_FLAVOR(s, ASTR,,);
485 DEFINE_FLAVOR(hs, ASTR,,);
486 DEFINE_FLAVOR(S, WSTR,,);
487 DEFINE_FLAVOR(ws, WSTR,,);
488 DEFINE_FLAVOR(ls, WSTR,,);
489
490 DEFINE_FLAVOR(hi, SSHORT,,);
491 DEFINE_FLAVOR(hd, SSHORT,,);
492 DEFINE_FLAVOR(hu, USHORT,,"u");
493 DEFINE_FLAVOR(hx, USHORT,,"x", win:UInt16; outType=win:HexInt16);
494 DEFINE_FLAVOR(hX, USHORT,,"X", win:UInt16; outType=win:HexInt16);
495 DEFINE_FLAVOR(ho, USHORT,,"o", win:UInt16; outType=win:HexInt16);
496
497 DEFINE_FLAVOR(Id, ULONGPTR,,"Id");
498 DEFINE_FLAVOR(Iu, ULONGPTR,,"Iu");
499 DEFINE_FLAVOR(Ix, ULONGPTR,,"Ix", win:Pointer; adapter=WPP_ADAPTER_PVOID);
500 DEFINE_FLAVOR(IX, ULONGPTR,,"IX", win:Pointer; adapter=WPP_ADAPTER_PVOID);
501 DEFINE_FLAVOR(Io, ULONGPTR,,"Io", win:Pointer; adapter=WPP_ADAPTER_PVOID);
502
503 DEFINE_FLAVOR(i, SINT,,);
504 DEFINE_FLAVOR(d, SINT,,);
505 DEFINE_FLAVOR(u, UINT,,"u");
506 DEFINE_FLAVOR(x, UINT,,"x", win:HexInt32);
507 DEFINE_FLAVOR(X, UINT,,"X", win:HexInt32);
508 DEFINE_FLAVOR(o, UINT,,"o", win:HexInt32);
509
510 DEFINE_FLAVOR(cccc, SINT, ItemChar4, "s", win:AnsiString; length=4; adapter=WPP_ADAPTER_CCCC);
511
512 DEFINE_FLAVOR(li, SLONG,,);
513 DEFINE_FLAVOR(ld, SLONG,,);
514 DEFINE_FLAVOR(lu, ULONG,,"u");
515 DEFINE_FLAVOR(lx, ULONG,,"x", win:HexInt32);
516 DEFINE_FLAVOR(lX, ULONG,,"X", win:HexInt32);
517 DEFINE_FLAVOR(lo, ULONG,,"o", win:HexInt32);
518
519 DEFINE_FLAVOR(I64d, SINT64,,);
520 DEFINE_FLAVOR(I64u, UINT64,,);
521 DEFINE_FLAVOR(I64x, XINT64,,"I64x");
522 DEFINE_FLAVOR(I64X, XXINT64,,"I64X");
523 DEFINE_FLAVOR(I64o, OINT64,,"I64o");
524
525 DEFINE_FLAVOR(lld, SINT64,,);
526 DEFINE_FLAVOR(llu, UINT64,,);
527 DEFINE_FLAVOR(llx, XINT64,,"I64x");
528 DEFINE_FLAVOR(llX, XXINT64,,"I64X");
529 DEFINE_FLAVOR(llo, OINT64,,"I64o");
530
531 DEFINE_FLAVOR(p, PTR,,);
532
533 DEFINE_FLAVOR(Z, ANSTR,,);
534 DEFINE_FLAVOR(wZ, USTR,,);
535 DEFINE_FLAVOR(z, CSTR,,);
536 DEFINE_FLAVOR(hZ, CSTR,,);
537
538 # default formats for those who don't care to provide their own strings
539
540 DEFINE_FLAVOR(XBYTE, SBYTE,, "02x", win:UInt8; outType=win:HexInt8);
541 DEFINE_FLAVOR(OBYTE, SBYTE,, "o", win:UInt8; outType=win:HexInt8);
542
543 DEFINE_FLAVOR(XSHORT, SSHORT,, "04hX", win:UInt16; outType=win:HexInt16);
544 DEFINE_FLAVOR(OSHORT, SSHORT,, "ho", win:UInt16; outType=win:HexInt16);
545
546 DEFINE_FLAVOR(XINT, SINT,, "08x", win:HexInt32);
547 DEFINE_FLAVOR(OINT, SINT,, "o", win:HexInt32);
548
549 DEFINE_FLAVOR(XLONG, SLONG,, "08lX", win:HexInt32);
550 DEFINE_FLAVOR(OLONG, SLONG,, "lo", win:HexInt32);
551
552 DEFINE_FLAVOR(XLONGPTR, SLONGPTR,,"Ix", win:Pointer; adapter=WPP_ADAPTER_PVOID);
553 DEFINE_FLAVOR(OLONGPTR, SLONGPTR,,"Io", win:Pointer; adapter=WPP_ADAPTER_PVOID);
554
555 # special formats
556
557 DEFINE_FLAVOR(IPADDR, UINT, ItemIPAddr, "s", win:UInt32; outType=win:IPv4);
558 DEFINE_FLAVOR(PORT, USHORT, ItemPort, "s", win:UInt16; outType=win:Port);
559 DEFINE_FLAVOR(STATUS, SINT, ItemNTSTATUS, "s", win:HexInt32; outType=win:NTSTATUS);
560 DEFINE_FLAVOR(WINERROR, UINT, ItemWINERROR, "s", win:UInt32; outType=win:Win32Error);
561 DEFINE_FLAVOR(HRESULT, SINT, ItemHRESULT, "s", win:Int32; outType=win:HResult);
562
563 # Note: The %!NDIS_STATUS! and %!NDIS_OID! types work for for TMF-based WPP but
564 # do not work well with manifest-based WPP. Manifest-based ETW decoders will
565 # treat %!NDIS_STATUS! and %!NDIS_OID! items as HexInt32 items.
566 DEFINE_FLAVOR(NDIS_STATUS, SINT, ItemNDIS_STATUS, "s", win:HexInt32);
567 DEFINE_FLAVOR(NDIS_OID, UINT, ItemNDIS_OID, "s", win:HexInt32);
568
569 DEFINE_FLAVOR(ipaddr,IPADDR,,);
570 DEFINE_FLAVOR(port,PORT,,);
571 DEFINE_FLAVOR(status,STATUS,,);
572 DEFINE_FLAVOR(hresult,HRESULT,,);
573 DEFINE_FLAVOR(winerr,WINERROR,,);
574 DEFINE_FLAVOR(guid,GUID,,);
575
576 # time related stuff
577
578 DEFINE_FLAVOR(TIMESTAMP, SINT64, ItemTimestamp, "s", win:FILETIME; adapter=WPP_ADAPTER_PFILETIME);
579 DEFINE_FLAVOR(TIME, SINT64, ItemTimestamp, "s", win:FILETIME; adapter=WPP_ADAPTER_PFILETIME);
580 DEFINE_FLAVOR(DATE, SINT64, ItemTimestamp, "s", win:FILETIME; adapter=WPP_ADAPTER_PFILETIME);
581 DEFINE_FLAVOR(WAITTIME, SINT64, ItemTimestamp, "s", win:FILETIME; adapter=WPP_ADAPTER_PFILETIME);
582
583 DEFINE_FLAVOR(due, SINT64, ItemWaitTime, "s", win:FILETIME; adapter=WPP_ADAPTER_PFILETIME);
584 DEFINE_FLAVOR(delta, SINT64, ItemTimeDelta, "s");
585 DEFINE_FLAVOR(datetime, SINT64, ItemTimestamp, "s", win:FILETIME; adapter=WPP_ADAPTER_PFILETIME);
586
587 # enumeration types
588
589 DEFINE_FLAVOR(ItemListByte, SBYTE, ItemListByte, "s", win:UInt8);
590 DEFINE_FLAVOR(ItemListShort, SSHORT, ItemListShort, "s", win:UInt16);
591 DEFINE_FLAVOR(ItemListLong, SLONG, ItemListLong, "s", win:UInt32);
592
593 DEFINE_FLAVOR(ItemSetByte, UBYTE, ItemSetByte, "s", win:UInt8; outType=win:HexInt8);
594 DEFINE_FLAVOR(ItemSetShort, USHORT, ItemSetShort, "s", win:UInt16; outType=win:HexInt16);
595 DEFINE_FLAVOR(ItemSetLong, ULONG, ItemSetLong, "s", win:HexInt32);
596
597 # Note: The "ItemEnum" and "ItemFlagsEnum" types work for for TMF-based WPP but
598 # do not work well with manifest-based WPP. Manifest-based ETW decoders will
599 # treat types based on "ItemEnum" as UInt32 and will treat types based on
600 # "ItemFlagsEnum" as HexInt32. For better results, use ItemListLong,
601 # ItemSetLong, or a "begin_wpp enum" block for your enumeration.
602 DEFINE_FLAVOR(ItemEnum, ULONG, ItemEnum, "s");
603 DEFINE_FLAVOR(ItemFlagsEnum, ULONG, ItemFlagsEnum, "s", win:HexInt32);
604
605 DEFINE_FLAVOR(CLSID, GUID, ItemCLSID, "s");
606 DEFINE_FLAVOR(LIBID, GUID, ItemLIBID, "s");
607 DEFINE_FLAVOR(IID, GUID, ItemIID, "s");
608
609 CUSTOM_TYPE(b1, ItemSetByte(1,2,3,4,5,6,7,8) );
610 CUSTOM_TYPE(b2, ItemSetShort(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) );
611 CUSTOM_TYPE(b4, ItemSetLong(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32) );
612
613 CUSTOM_TYPE(bool, ItemListLong(false,true) );
614 CUSTOM_TYPE(bool16, ItemListShort(false,true) );
615 CUSTOM_TYPE(bool8, ItemListByte(false,true) );
616 CUSTOM_TYPE(BOOLEAN, ItemListByte(FALSE,TRUE) );
617
618 CUSTOM_TYPE(irql, ItemListByte(Low,APC,DPC) );
619
620 CUSTOM_TYPE(pnpmn, ItemListByte(IRP_MN_START_DEVICE,IRP_MN_QUERY_REMOVE_DEVICE,IRP_MN_REMOVE_DEVICE,IRP_MN_CANCEL_REMOVE_DEVICE,IRP_MN_STOP_DEVICE,IRP_MN_QUERY_STOP_DEVICE,IRP_MN_CANCEL_STOP_DEVICE,IRP_MN_QUERY_DEVICE_RELATIONS,IRP_MN_QUERY_INTERFACE,IRP_MN_QUERY_CAPABILITIES,IRP_MN_QUERY_RESOURCES,IRP_MN_QUERY_RESOURCE_REQUIREMENTS,IRP_MN_QUERY_DEVICE_TEXT,IRP_MN_FILTER_RESOURCE_REQUIREMENTS,IRP_MN_PNP_14,IRP_MN_READ_CONFIG,IRP_MN_WRITE_CONFIG,IRP_MN_EJECT,IRP_MN_SET_LOCK,IRP_MN_QUERY_ID,IRP_MN_QUERY_PNP_DEVICE_STATE,IRP_MN_QUERY_BUS_INFORMATION,IRP_MN_DEVICE_USAGE_NOTIFICATION,IRP_MN_SURPRISE_REMOVAL) );
621 CUSTOM_TYPE(sysctrl, ItemListByte(IRP_MN_QUERY_ALL_DATA,IRP_MN_QUERY_SINGLE_INSTANCE, IRP_MN_CHANGE_SINGLE_INSTANCE, IRP_MN_CHANGE_SINGLE_ITEM, IRP_MN_ENABLE_EVENTS, IRP_MN_DISABLE_EVENTS, IRP_MN_ENABLE_COLLECTION, IRP_MN_DISABLE_COLLECTION, IRP_MN_REGINFO, IRP_MN_EXECUTE_METHOD, IRP_MN_Reserved_0a, IRP_MN_REGINFO_EX) );
622 CUSTOM_TYPE(pnpmj, ItemListByte(IRP_MJ_CREATE,IRP_MJ_CREATE_NAMED_PIPE,IRP_MJ_CLOSE,IRP_MJ_READ,IRP_MJ_WRITE,IRP_MJ_QUERY_INFORMATION,IRP_MJ_SET_INFORMATION,IRP_MJ_QUERY_EA,IRP_MJ_SET_EA,IRP_MJ_FLUSH_BUFFERS,IRP_MJ_QUERY_VOLUME_INFORMATION,IRP_MJ_SET_VOLUME_INFORMATION,IRP_MJ_DIRECTORY_CONTROL,IRP_MJ_FILE_SYSTEM_CONTROL,IRP_MJ_DEVICE_CONTROL,IRP_MJ_INTERNAL_DEVICE_CONTROL,IRP_MJ_SHUTDOWN,IRP_MJ_LOCK_CONTROL,IRP_MJ_CLEANUP,IRP_MJ_CREATE_MAILSLOT,IRP_MJ_QUERY_SECURITY,IRP_MJ_SET_SECURITY,IRP_MJ_POWER,IRP_MJ_SYSTEM_CONTROL,IRP_MJ_DEVICE_CHANGE,IRP_MJ_QUERY_QUOTA,IRP_MJ_SET_QUOTA,IRP_MJ_PNP) );
623
624 # Built-in levels (for use with manifests)
625
626 DEFINE_BUILTIN_LEVEL(win:LogAlways, 0, WINEVENT_LEVEL_LOG_ALWAYS);
627 DEFINE_BUILTIN_LEVEL(win:Critical, 1, WINEVENT_LEVEL_CRITICAL, TRACE_LEVEL_CRITICAL);
628 DEFINE_BUILTIN_LEVEL(win:Error, 2, WINEVENT_LEVEL_ERROR, TRACE_LEVEL_ERROR);
629 DEFINE_BUILTIN_LEVEL(win:Warning, 3, WINEVENT_LEVEL_WARNING, TRACE_LEVEL_WARNING);
630 DEFINE_BUILTIN_LEVEL(win:Informational, 4, WINEVENT_LEVEL_INFO, TRACE_LEVEL_INFORMATION);
631 DEFINE_BUILTIN_LEVEL(win:Verbose, 5, WINEVENT_LEVEL_VERBOSE, TRACE_LEVEL_VERBOSE);
632 DEFINE_BUILTIN_LEVEL(win:ReservedLevel6, 6, WINEVENT_LEVEL_RESERVED_6);
633 DEFINE_BUILTIN_LEVEL(win:ReservedLevel7, 7, WINEVENT_LEVEL_RESERVED_7);
634 DEFINE_BUILTIN_LEVEL(win:ReservedLevel8, 8, WINEVENT_LEVEL_RESERVED_8);
635 DEFINE_BUILTIN_LEVEL(win:ReservedLevel9, 9, WINEVENT_LEVEL_RESERVED_9);
636 DEFINE_BUILTIN_LEVEL(win:ReservedLevel10, 10, WINEVENT_LEVEL_RESERVED_10);
637 DEFINE_BUILTIN_LEVEL(win:ReservedLevel11, 11, WINEVENT_LEVEL_RESERVED_11);
638 DEFINE_BUILTIN_LEVEL(win:ReservedLevel12, 12, WINEVENT_LEVEL_RESERVED_12);
639 DEFINE_BUILTIN_LEVEL(win:ReservedLevel13, 13, WINEVENT_LEVEL_RESERVED_13);
640 DEFINE_BUILTIN_LEVEL(win:ReservedLevel14, 14, WINEVENT_LEVEL_RESERVED_14);
641 DEFINE_BUILTIN_LEVEL(win:ReservedLevel15, 15, WINEVENT_LEVEL_RESERVED_15);
642
643 # Built-in keywords (for use with manifests)
644
645 DEFINE_BUILTIN_KEYWORD(win:AnyKeyword, 0x0, WINEVT_KEYWORD_ANY);
646 DEFINE_BUILTIN_KEYWORD(win:ResponseTime, 0x0001000000000000, WINEVENT_KEYWORD_RESPONSE_TIME);
647 DEFINE_BUILTIN_KEYWORD(win:WDIContext, 0x0002000000000000, WINEVENT_KEYWORD_WDI_CONTEXT);
648 DEFINE_BUILTIN_KEYWORD(win:WDIDiag, 0x0004000000000000, WINEVENT_KEYWORD_WDI_DIAG);
649 DEFINE_BUILTIN_KEYWORD(win:SQM, 0x0008000000000000, WINEVENT_KEYWORD_SQM);
650 DEFINE_BUILTIN_KEYWORD(win:AuditFailure, 0x0010000000000000, WINEVENT_KEYWORD_AUDIT_FAILURE);
651 DEFINE_BUILTIN_KEYWORD(win:AuditSuccess, 0x0020000000000000, WINEVENT_KEYWORD_AUDIT_SUCCESS);
652 DEFINE_BUILTIN_KEYWORD(win:CorrelationHint, 0x0040000000000000, WINEVENT_KEYWORD_CORRELATION_HINT);
653 DEFINE_BUILTIN_KEYWORD(win:ReservedKeyword56, 0x0100000000000000, WINEVENT_KEYWORD_RESERVED_56);
654 DEFINE_BUILTIN_KEYWORD(win:ReservedKeyword57, 0x0200000000000000, WINEVENT_KEYWORD_RESERVED_57);
655 DEFINE_BUILTIN_KEYWORD(win:ReservedKeyword58, 0x0400000000000000, WINEVENT_KEYWORD_RESERVED_58);
656 DEFINE_BUILTIN_KEYWORD(win:ReservedKeyword59, 0x0800000000000000, WINEVENT_KEYWORD_RESERVED_59);
657 DEFINE_BUILTIN_KEYWORD(win:ReservedKeyword60, 0x1000000000000000, WINEVENT_KEYWORDE_RESERVED_60);
658 DEFINE_BUILTIN_KEYWORD(win:ReservedKeyword61, 0x2000000000000000, WINEVENT_KEYWORD_RESERVED_61);
659 DEFINE_BUILTIN_KEYWORD(win:ReservedKeyword62, 0x4000000000000000, WINEVENT_KEYWORD_RESERVED_62);
660 DEFINE_BUILTIN_KEYWORD(win:ReservedKeyword63, 0x8000000000000000, WINEVENT_KEYWORD_RESERVED_63);
661
662 # default tracing macros
663 FUNC DoTraceMessage(LEVEL,MSG,...); # Uses WPP-provided ENABLED/LOGGER macros
664 FUNC DoDebugTrace(TRACELEVEL,MSG,...); # Requires used-defined ENABLED/LOGGER macros
665
666 # default prefix (use traceprt default)
667 USEPREFIX(*,"%!STDPREFIX!"); # traceprt will add standard prefix
668
669 # the source file that calls WPP_INIT_TRACING is given special treatment
670 WPP_FLAGS(-lookfor:WPP_INIT_TRACING);