| 1 |
`**********************************************************************` |
| 2 |
`* This is a template file for the tracewpp preprocessor. *` |
| 3 |
`* If you need to use a custom version of this file in your project, *` |
| 4 |
`* please clone it from this one and point WPP to it by specifying *` |
| 5 |
`* -gen:{yourfile}*.tmh on the RUN_WPP line in your sources file. *` |
| 6 |
`* *` |
| 7 |
`* Copyright (c) Microsoft Corporation. All rights reserved. *` |
| 8 |
`**********************************************************************` |
| 9 |
// Checksum="`Compiler.Checksum`" Generated file. Do not edit. |
| 10 |
// File created by `Compiler.Name` compiler version `Compiler.Version` |
| 11 |
// from template `TemplateFile` |
| 12 |
|
| 13 |
// *************************************************************************** |
| 14 |
// PREVIEW: Behavior of the -man option, the `TemplateFile` template, and the |
| 15 |
// associated configuration options may change in future versions of tracewpp. |
| 16 |
// *************************************************************************** |
| 17 |
|
| 18 |
#pragma once |
| 19 |
|
| 20 |
// Define the macros (if any) specified on the tracewpp command line. |
| 21 |
// -- Begin macro definitions. |
| 22 |
`FORALL def IN MacroDefinitions` |
| 23 |
#define `def.Name` `def.Alias` |
| 24 |
`ENDFOR` |
| 25 |
// -- End macro definitions. |
| 26 |
|
| 27 |
// The "`Manifest.HeaderFileName`" file should be generated by running the |
| 28 |
// MC.exe tool: mc.exe -um `Manifest.Arguments` |
| 29 |
#include "`Manifest.HeaderFileName`" |
| 30 |
`IF FOUND WPP_INIT_TRACING` |
| 31 |
|
| 32 |
#ifndef WPP_INIT_TRACING |
| 33 |
#define WPP_INIT_TRACING(...) WPP_INIT() |
| 34 |
#endif |
| 35 |
`ENDIF FOUND WPP_INIT_TRACING` |
| 36 |
|
| 37 |
// WPP_LOG_ALWAYS: |
| 38 |
// Called for each event: WPP_LOG_ALWAYS(EX, MSG, arg1, arg2, arg3...) Other() |
| 39 |
// If defined, the definition needs to include a trailing comma or semicolon. |
| 40 |
// In addition, you will need to define a WPP_EX_[args](args...) macro to |
| 41 |
// extract any needed information from the other arguments (e.g. LEVEL). |
| 42 |
#ifndef WPP_LOG_ALWAYS |
| 43 |
#define WPP_LOG_ALWAYS(...) |
| 44 |
#endif |
| 45 |
|
| 46 |
// WPP_DEBUG: |
| 47 |
// Called for each enabled event: WPP_DEBUG((MSG, arg1, arg2, arg3...)), Other() |
| 48 |
// Potential definition: printf MsgArgs |
| 49 |
// Definition should not include any trailing comma or semicolon. |
| 50 |
#ifdef WPP_DEBUG |
| 51 |
#define WPP_INVOKE_WPP_DEBUG(MsgArgs) WPP_DEBUG(MsgArgs) |
| 52 |
#else // WPP_DEBUG |
| 53 |
#define WPP_INVOKE_WPP_DEBUG(MsgArgs) (void)0 |
| 54 |
#endif // WPP_DEBUG |
| 55 |
|
| 56 |
#ifndef WPP_FORCEINLINE |
| 57 |
#define WPP_FORCEINLINE __forceinline |
| 58 |
#endif |
| 59 |
|
| 60 |
#define WPP_THIS_FILE `SourceFile.CanonicalName` |
| 61 |
|
| 62 |
#define WPP_FLATTEN(...) __VA_ARGS__ |
| 63 |
#define WPP_INVOKE_MCMACRO(f, args) f args |
| 64 |
#define WPP_EVAL(x) x |
| 65 |
#define WPP_GLUE5(a, b, c, d, e) a ## b ## c ## d ## e |
| 66 |
#define WPP_XGLUE5(a, b, c, d, e) WPP_GLUE5(a, b, c, d, e) |
| 67 |
#define WPP_(Id) WPP_XGLUE5(WPP_, Id, _, WPP_THIS_FILE, __LINE__) |
| 68 |
|
| 69 |
// Calls EventRegister_[ProviderName] for each provider in the generated manifest. |
| 70 |
#define WPP_INIT() \ |
| 71 |
{ \ |
| 72 |
`FORALL ControlGuid IN ControlGuids` |
| 73 |
` FORALL TraceGuid IN ControlGuid.TraceGuids` |
| 74 |
EventRegister_`ControlGuid.Symbol``IF TraceGuid No`_`TraceGuid.No``ENDIF`(); \ |
| 75 |
` ENDFOR TraceGuid` |
| 76 |
`ENDFOR ControlGuid` |
| 77 |
} |
| 78 |
|
| 79 |
// Calls EventUnregister_[ProviderName] for each provider in the generated manifest. |
| 80 |
#define WPP_CLEANUP() \ |
| 81 |
{ \ |
| 82 |
`FORALL ControlGuid IN ControlGuids` |
| 83 |
` FORALL TraceGuid IN ControlGuid.TraceGuids` |
| 84 |
EventUnregister_`ControlGuid.Symbol``IF TraceGuid No`_`TraceGuid.No``ENDIF`(); \ |
| 85 |
` ENDFOR TraceGuid` |
| 86 |
`ENDFOR ControlGuid` |
| 87 |
} |
| 88 |
|
| 89 |
// WPP_ENABLED helpers |
| 90 |
`FORALL ControlGuid IN ControlGuids` |
| 91 |
` FORALL TraceGuid IN ControlGuid.TraceGuids WHERE !No` |
| 92 |
#define WPP_ENABLED_`ControlGuid.Symbol`(level, keyword) \ |
| 93 |
(`ControlGuid.Symbol`_Context.IsEnabled && McGenLevelKeywordEnabled(&`ControlGuid.Symbol`_Context, (level), (keyword))) |
| 94 |
` ENDFOR TraceGuid` |
| 95 |
`ENDFOR ControlGuid` |
| 96 |
|
| 97 |
// Adapters |
| 98 |
|
| 99 |
#ifndef WPP_ADAPTER_PUSTR |
| 100 |
#ifdef WPP_CHECK_FOR_NULL_STRING |
| 101 |
# define WPP_ADAPTER_PUSTR(x) \ |
| 102 |
(x) ? (x)->Length/2 : 4, \ |
| 103 |
(x) ? (x)->Buffer : L"NULL" |
| 104 |
#else // WPP_CHECK_FOR_NULL_STRING |
| 105 |
# define WPP_ADAPTER_PUSTR(x) (x)->Length/2, (x)->Buffer |
| 106 |
#endif // WPP_CHECK_FOR_NULL_STRING |
| 107 |
#endif // WPP_ADAPTER_PUSTR |
| 108 |
|
| 109 |
#ifndef WPP_ADAPTER_PCSTR |
| 110 |
#ifdef WPP_CHECK_FOR_NULL_STRING |
| 111 |
# define WPP_ADAPTER_PCSTR(x) \ |
| 112 |
(x) ? (x)->Length : 4, \ |
| 113 |
(x) ? (x)->Buffer : "NULL" |
| 114 |
#else // WPP_CHECK_FOR_NULL_STRING |
| 115 |
# define WPP_ADAPTER_PCSTR(x) (x)->Length, (x)->Buffer |
| 116 |
#endif // WPP_CHECK_FOR_NULL_STRING |
| 117 |
#endif // WPP_ADAPTER_PCSTR |
| 118 |
|
| 119 |
#ifndef WPP_ADAPTER_PSID |
| 120 |
# define WPP_ADAPTER_PSID(pSid) (const SID*)pSid |
| 121 |
#endif // WPP_ADAPTER_PSID |
| 122 |
|
| 123 |
#ifndef WPP_ADAPTER_PVOID |
| 124 |
# define WPP_ADAPTER_PVOID(intptr) (const void*)intptr |
| 125 |
#endif // WPP_ADAPTER_PVOID |
| 126 |
|
| 127 |
#ifndef WPP_ADAPTER_PFILETIME |
| 128 |
# define WPP_ADAPTER_PFILETIME(i64) (const FILETIME*)&i64 |
| 129 |
#endif // WPP_ADAPTER_PFILETIME |
| 130 |
|
| 131 |
#ifndef WPP_ADAPTER_CCCC |
| 132 |
# define WPP_ADAPTER_CCCC(val) (const char*)&val |
| 133 |
#endif // WPP_ADAPTER_CCCC |
| 134 |
|
| 135 |
#ifndef WPP_ADAPTER_BIN |
| 136 |
# define WPP_ADAPTER_BIN(x) (x).Length, (const unsigned char*)(x).Buffer |
| 137 |
#endif // WPP_ADAPTER_BIN |
| 138 |
|
| 139 |
#ifdef __cplusplus |
| 140 |
|
| 141 |
#ifndef WPP_ADAPTER_CPPSTR |
| 142 |
#define WPP_ADAPTER_CPPSTR(x) static_cast<USHORT>(x.size()), x.c_str() |
| 143 |
#endif // WPP_ADAPTER_CPPSTR |
| 144 |
|
| 145 |
#ifndef WPP_ADAPTER_CPPVEC |
| 146 |
#define WPP_ADAPTER_CPPVEC(x) static_cast<USHORT>(x.size()), x.data() |
| 147 |
#endif // WPP_ADAPTER_CPPVEC |
| 148 |
|
| 149 |
#endif // __cplusplus |
| 150 |
|
| 151 |
#ifndef WPP_BINARY_def |
| 152 |
# define WPP_BINARY_def |
| 153 |
typedef struct tagWPP_BINARY |
| 154 |
{ |
| 155 |
_Field_size_bytes_(Length) void const* Buffer; |
| 156 |
USHORT Length; |
| 157 |
} WPP_BINARY; |
| 158 |
#endif // WPP_BINARY_def |
| 159 |
|
| 160 |
#ifndef WPP_BINARY_func |
| 161 |
# define WPP_BINARY_func |
| 162 |
WPP_FORCEINLINE WPP_BINARY |
| 163 |
WppBinary(_In_reads_bytes_(Length) void const* Buffer, USHORT Length) |
| 164 |
{ |
| 165 |
WPP_BINARY data; |
| 166 |
data.Buffer = Buffer; |
| 167 |
data.Length = Length; |
| 168 |
return data; |
| 169 |
} |
| 170 |
#endif // WPP_BINARY_func |
| 171 |
|
| 172 |
// Functions |
| 173 |
`FORALL f IN Funcs WHERE !DoubleP && !MsgArgs && !NoMsg` |
| 174 |
#undef `f.Name` |
| 175 |
#ifdef __INTELLISENSE__ |
| 176 |
#define `f.Name`(`f.FixedArgs`MSG, ...) ((void)(MSG, ## __VA_ARGS__)) |
| 177 |
#else |
| 178 |
#define `f.Name` WPP_(CALL) |
| 179 |
#endif |
| 180 |
`ENDFOR` |
| 181 |
`FORALL f IN Funcs WHERE !DoubleP && !MsgArgs && NoMsg` |
| 182 |
#undef `f.Name` |
| 183 |
#ifdef __INTELLISENSE__ |
| 184 |
#define `f.Name`(`f.FixedArgs`) ((void)0) |
| 185 |
#else |
| 186 |
#define `f.Name` WPP_(CALL) |
| 187 |
#endif |
| 188 |
`ENDFOR` |
| 189 |
`FORALL f IN Funcs WHERE DoubleP && !MsgArgs` |
| 190 |
#undef `f.Name` |
| 191 |
#ifdef __INTELLISENSE__ |
| 192 |
#define `f.Name`(ARGS) ((void)ARGS) |
| 193 |
#else |
| 194 |
#define `f.Name`(ARGS) WPP_(CALL) ARGS |
| 195 |
#endif |
| 196 |
`ENDFOR` |
| 197 |
`FORALL f IN Funcs WHERE MsgArgs` |
| 198 |
#undef `f.Name` |
| 199 |
#ifdef __INTELLISENSE__ |
| 200 |
#define `f.Name`(`f.FixedArgs`MSGARGS) ((void)(MSGARGS)) |
| 201 |
#else |
| 202 |
#define `f.Name`(`f.FixedArgs`MSGARGS) WPP_(CALL)(`f.FixedArgs`MSGARGS) |
| 203 |
#endif |
| 204 |
`ENDFOR` |
| 205 |
`FORALL r IN Reorder` |
| 206 |
#undef WPP_REORDER_`r.Name` |
| 207 |
#define WPP_REORDER_`r.Name`(`r.Arguments`) `r.PermutationNoLeadingComma` |
| 208 |
`ENDFOR` |
| 209 |
|
| 210 |
// Messages |
| 211 |
`FORALL i IN Messages WHERE !MsgArgs` |
| 212 |
|
| 213 |
// `i.Name` |
| 214 |
#ifndef WPP`i.GooId`_PRE |
| 215 |
# define WPP`i.GooId`_PRE(`i.GooArgs`) |
| 216 |
#endif |
| 217 |
#ifndef WPP`i.GooId`_POST |
| 218 |
# define WPP`i.GooId`_POST(`i.GooArgs`) |
| 219 |
#endif |
| 220 |
WPP_FORCEINLINE ULONG WPP_MFUNC_`i.Name`(`i.FuncArgDecls`) |
| 221 |
{ return WPP_INVOKE_MCMACRO(`Manifest.Prefix``i.Name`_AssumeEnabled, (`i.FuncArgExprs`)); } |
| 222 |
#define WPP_CALL_`i.Name`(`i.FixedArgs``i.MacroArgs`) \ |
| 223 |
WPP_LOG_ALWAYS(WPP_EX`i.GooId`(`i.GooVals`), `i.DbgMacroArgs`) \ |
| 224 |
WPP`i.GooId`_PRE(`i.GooVals`) \ |
| 225 |
(( \ |
| 226 |
MCGEN_EVENT_ENABLED(`i.Name`) \ |
| 227 |
? WPP_INVOKE_WPP_DEBUG((`i.DbgMacroArgs`)), \ |
| 228 |
WPP_MFUNC_`i.Name`(`i.MacroExprsNoLeadingComma`) \ |
| 229 |
: 0 \ |
| 230 |
)) \ |
| 231 |
WPP`i.GooId`_POST(`i.GooVals`) |
| 232 |
`ENDFOR i IN Messages WHERE !MsgArgs` |
| 233 |
`FORALL i IN Messages WHERE MsgArgs` |
| 234 |
|
| 235 |
// `i.Name` |
| 236 |
#ifndef WPP`i.GooId`_PRE |
| 237 |
# define WPP`i.GooId`_PRE(`i.GooArgs`) |
| 238 |
#endif |
| 239 |
#ifndef WPP`i.GooId`_POST |
| 240 |
# define WPP`i.GooId`_POST(`i.GooArgs`) |
| 241 |
#endif |
| 242 |
WPP_FORCEINLINE ULONG WPP_MFUNC_`i.Name`(`i.FuncArgDecls`) |
| 243 |
{ return WPP_INVOKE_MCMACRO(`Manifest.Prefix``i.Name`_AssumeEnabled, (`i.FuncArgExprs`)); } |
| 244 |
#define WPP_CALL_`i.Name`(`i.FixedArgs` MSGARGS) \ |
| 245 |
WPP_LOG_ALWAYS(WPP_EX`i.GooId`(`i.GooVals`), WPP_FLATTEN MSGARGS) \ |
| 246 |
WPP`i.GooId`_PRE(`i.GooVals`) \ |
| 247 |
(( \ |
| 248 |
MCGEN_EVENT_ENABLED(`i.Name`) \ |
| 249 |
? WPP_INVOKE_WPP_DEBUG(MSGARGS), \ |
| 250 |
WPP_MFUNC_`i.Name` WPP_EVAL((`i.SyntheticExprsNoLeadingComma`WPP_REORDER_`i.ReorderSig` MSGARGS)) \ |
| 251 |
: 0 \ |
| 252 |
)) \ |
| 253 |
WPP`i.GooId`_POST(`i.GooVals`) |
| 254 |
`ENDFOR i IN Messages WHERE MsgArgs` |