[1166] | 1 | /*
|
---|
| 2 | * Copyright 2021 Jacek Caban for CodeWeavers
|
---|
| 3 | *
|
---|
| 4 | * This library is free software; you can redistribute it and/or
|
---|
| 5 | * modify it under the terms of the GNU Lesser General Public
|
---|
| 6 | * License as published by the Free Software Foundation; either
|
---|
| 7 | * version 2.1 of the License, or (at your option) any later version.
|
---|
| 8 | *
|
---|
| 9 | * This library is distributed in the hope that it will be useful,
|
---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 12 | * Lesser General Public License for more details.
|
---|
| 13 | *
|
---|
| 14 | * You should have received a copy of the GNU Lesser General Public
|
---|
| 15 | * License along with this library; if not, write to the Free Software
|
---|
| 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
| 17 | */
|
---|
| 18 |
|
---|
| 19 | import "unknwn.idl";
|
---|
| 20 | import "oaidl.idl";
|
---|
| 21 | import "ocidl.idl";
|
---|
| 22 |
|
---|
| 23 | #ifndef __WIDL__
|
---|
| 24 | #define threading(model)
|
---|
| 25 | #endif
|
---|
| 26 |
|
---|
| 27 | typedef struct _EVENT_DESCRIPTOR
|
---|
| 28 | {
|
---|
| 29 | USHORT Id;
|
---|
| 30 | UCHAR Version;
|
---|
| 31 | UCHAR Channel;
|
---|
| 32 | UCHAR Level;
|
---|
| 33 | UCHAR Opcode;
|
---|
| 34 | USHORT Task;
|
---|
| 35 | ULONGLONG Keyword;
|
---|
| 36 | } EVENT_DESCRIPTOR, *PEVENT_DESCRIPTOR;
|
---|
| 37 | typedef const EVENT_DESCRIPTOR *PCEVENT_DESCRIPTOR;
|
---|
| 38 |
|
---|
| 39 | typedef struct _EVENT_HEADER
|
---|
| 40 | {
|
---|
| 41 | USHORT Size;
|
---|
| 42 | USHORT HeaderType;
|
---|
| 43 | USHORT Flags;
|
---|
| 44 | USHORT EventProperty;
|
---|
| 45 | ULONG ThreadId;
|
---|
| 46 | ULONG ProcessId;
|
---|
| 47 | LARGE_INTEGER TimeStamp;
|
---|
| 48 | GUID ProviderId;
|
---|
| 49 | EVENT_DESCRIPTOR EventDescriptor;
|
---|
| 50 | union {
|
---|
| 51 | struct {
|
---|
| 52 | ULONG KernelTime;
|
---|
| 53 | ULONG UserTime;
|
---|
| 54 | } DUMMYSTRUCTNAME;
|
---|
| 55 | ULONG64 ProcessorTime;
|
---|
| 56 | } DUMMYUNIONNAME;
|
---|
| 57 | GUID ActivityId;
|
---|
| 58 | } EVENT_HEADER, *PEVENT_HEADER;
|
---|
| 59 |
|
---|
| 60 | typedef struct _ETW_BUFFER_CONTEXT
|
---|
| 61 | {
|
---|
| 62 | union {
|
---|
| 63 | struct {
|
---|
| 64 | UCHAR ProcessorNumber;
|
---|
| 65 | UCHAR Alignment;
|
---|
| 66 | } DUMMYSTRUCTNAME;
|
---|
| 67 | USHORT ProcessorIndex;
|
---|
| 68 | } DUMMYUNIONNAME;
|
---|
| 69 | USHORT LoggerId;
|
---|
| 70 | } ETW_BUFFER_CONTEXT, *PETW_BUFFER_CONTEXT;
|
---|
| 71 |
|
---|
| 72 | typedef struct _EVENT_HEADER_EXTENDED_DATA_ITEM
|
---|
| 73 | {
|
---|
| 74 | USHORT Reserved1;
|
---|
| 75 | USHORT ExtType;
|
---|
| 76 | USHORT Linkage;
|
---|
| 77 | USHORT DataSize;
|
---|
| 78 | ULONGLONG DataPtr;
|
---|
| 79 | } EVENT_HEADER_EXTENDED_DATA_ITEM, *PEVENT_HEADER_EXTENDED_DATA_ITEM;
|
---|
| 80 |
|
---|
| 81 | typedef struct _EVENT_RECORD
|
---|
| 82 | {
|
---|
| 83 | EVENT_HEADER EventHeader;
|
---|
| 84 | ETW_BUFFER_CONTEXT BufferContext;
|
---|
| 85 | USHORT ExtendedDataCount;
|
---|
| 86 | USHORT UserDataLength;
|
---|
| 87 | EVENT_HEADER_EXTENDED_DATA_ITEM *ExtendedData;
|
---|
| 88 | void *UserData;
|
---|
| 89 | void *UserContext;
|
---|
| 90 | } EVENT_RECORD, *PEVENT_RECORD;
|
---|
| 91 |
|
---|
| 92 | typedef ULONG64 TRACEHANDLE, *PTRACEHANDLE;
|
---|
| 93 |
|
---|
| 94 | [
|
---|
| 95 | object,
|
---|
| 96 | uuid(8cc97f40-9028-4ff3-9b62-7d1f79ca7bcb),
|
---|
| 97 | local
|
---|
| 98 | ]
|
---|
| 99 | interface ITraceEvent : IUnknown
|
---|
| 100 | {
|
---|
| 101 | HRESULT Clone([out, retval] ITraceEvent **NewEvent);
|
---|
| 102 |
|
---|
| 103 | HRESULT GetUserContext([out, retval] void **UserContext);
|
---|
| 104 |
|
---|
| 105 | HRESULT GetEventRecord([out, retval] PEVENT_RECORD *EventRecord);
|
---|
| 106 |
|
---|
| 107 | HRESULT SetPayload([in, size_is(PayloadSize)] BYTE *Payload,
|
---|
| 108 | [in] ULONG PayloadSize);
|
---|
| 109 |
|
---|
| 110 | HRESULT SetEventDescriptor([in] PCEVENT_DESCRIPTOR EventDescriptor);
|
---|
| 111 |
|
---|
| 112 | HRESULT SetProcessId([in] ULONG ProcessId);
|
---|
| 113 |
|
---|
| 114 | HRESULT SetProcessorIndex([in] ULONG ProcessorIndex);
|
---|
| 115 |
|
---|
| 116 | HRESULT SetThreadId([in] ULONG ThreadId);
|
---|
| 117 |
|
---|
| 118 | HRESULT SetThreadTimes([in] ULONG KernelTime,
|
---|
| 119 | [in] ULONG UserTime);
|
---|
| 120 |
|
---|
| 121 | HRESULT SetActivityId([in] LPCGUID ActivityId);
|
---|
| 122 |
|
---|
| 123 | HRESULT SetTimeStamp([in] LARGE_INTEGER *TimeStamp);
|
---|
| 124 |
|
---|
| 125 | HRESULT SetProviderId([in] LPCGUID ProviderId);
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 | interface ITraceRelogger;
|
---|
| 129 |
|
---|
| 130 | [
|
---|
| 131 | object,
|
---|
| 132 | uuid(3ed25501-593f-43e9-8f38-3ab46f5a4a52)
|
---|
| 133 | ]
|
---|
| 134 | interface ITraceEventCallback : IUnknown
|
---|
| 135 | {
|
---|
| 136 | HRESULT OnBeginProcessTrace([in] ITraceEvent *HeaderEvent,
|
---|
| 137 | [in] ITraceRelogger *Relogger);
|
---|
| 138 |
|
---|
| 139 | HRESULT OnFinalizeProcessTrace([in] ITraceRelogger *Relogger);
|
---|
| 140 |
|
---|
| 141 | HRESULT OnEvent([in] ITraceEvent *Event,
|
---|
| 142 | [in] ITraceRelogger *Relogger);
|
---|
| 143 | }
|
---|
| 144 |
|
---|
| 145 | [
|
---|
| 146 | object,
|
---|
| 147 | uuid(f754ad43-3bcc-4286-8009-9c5da214e84e),
|
---|
| 148 | local
|
---|
| 149 | ]
|
---|
| 150 | interface ITraceRelogger : IUnknown
|
---|
| 151 | {
|
---|
| 152 | HRESULT AddLogfileTraceStream([in] BSTR LogfileName,
|
---|
| 153 | [in] void *UserContext,
|
---|
| 154 | [out, retval] TRACEHANDLE *TraceHandle);
|
---|
| 155 |
|
---|
| 156 | HRESULT AddRealtimeTraceStream([in] BSTR LoggerName,
|
---|
| 157 | [in] void *UserContext,
|
---|
| 158 | [out, retval] TRACEHANDLE *TraceHandle);
|
---|
| 159 |
|
---|
| 160 | HRESULT RegisterCallback([in] ITraceEventCallback *Callback);
|
---|
| 161 |
|
---|
| 162 | HRESULT Inject([in] ITraceEvent *Event);
|
---|
| 163 |
|
---|
| 164 | HRESULT CreateEventInstance([in] TRACEHANDLE TraceHandle,
|
---|
| 165 | [in] ULONG Flags,
|
---|
| 166 | [out, retval] ITraceEvent **Event);
|
---|
| 167 |
|
---|
| 168 | HRESULT ProcessTrace();
|
---|
| 169 |
|
---|
| 170 | HRESULT SetOutputFilename([in] BSTR LogfileName);
|
---|
| 171 |
|
---|
| 172 | HRESULT SetCompressionMode([in] BOOLEAN CompressionMode);
|
---|
| 173 |
|
---|
| 174 | HRESULT Cancel();
|
---|
| 175 | }
|
---|
| 176 |
|
---|
| 177 | [
|
---|
| 178 | uuid(7b40792d-05ff-44c4-9058-f440c71f17d4),
|
---|
| 179 | threading(both)
|
---|
| 180 | ]
|
---|
| 181 | coclass CTraceRelogger
|
---|
| 182 | {
|
---|
| 183 | [default] interface ITraceRelogger;
|
---|
| 184 | }
|
---|