Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Bug in Message Compiler (MC.exe) when compiling Kernel Macro (-km) for an ETW manifest?

$
0
0

I am working on an instrumentation manifest that returns events with fixed-length binary data (blobs). I have two events that return different-sized blobs, but MC.exe conflates them, rendering one of them incorrect.

Here is a stripped-down example: [event manifest]

...<templates><template tid="tid_test10"><data inType="win:Binary" name="Test10" length="10" outType="xs:hexBinary" /></template><template tid="tid_test20"><data inType="win:Binary" name="Test20" length="20" outType="xs:hexBinary" /></template></templates>
...<events><event level="win:Informational" symbol="Test20" template="tid_test20" value="20" /><event level="win:Informational" symbol="Test10" template="tid_test10" value="10" /><events>
....

resulting in: [kernel macros include file]

...
#define EventWriteTest20(Activity, Test20)\
    EventEnabledTest20() ?\
    Template_b(WCdlfdHandle, &Test20, Activity, Test20)\
    : STATUS_SUCCESS\
...
#define EventWriteTest10(Activity, Test10)\
    EventEnabledTest10() ?\
    Template_b(WCdlfdHandle, &Test10, Activity, Test10)\
    : STATUS_SUCCESS\
...
//
//Template from manifest : tid_test20
//
#ifndef Template_b_def
#define Template_b_def
ETW_INLINE
ULONG
Template_b(
    _In_ REGHANDLE RegHandle,
    _In_ PCEVENT_DESCRIPTOR Descriptor,
    _In_opt_ LPCGUID Activity,
    _In_reads_(20) const UCHAR*  Test20
    )
{
#define ARGUMENT_COUNT_b 1
    EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_b];
    EventDataDescCreate(&EventData[0], Test20, (ULONG)sizeof(char)*20);
    return EtwWrite(RegHandle, Descriptor, Activity, ARGUMENT_COUNT_b, EventData);
}
#endif

Both events end up using the template of the first event defined. In this case, Test10 puts out twenty bytes. When I swap the event order, Test20 puts out ten bytes. I have tried differentiating the events in a number of ways without affecting the outcome.

Does anyone know of a way to force Message Compiler to generate and use different template macros, even though the C++ signatures are identical?

Thanks in advance.


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>