2 * Copyright 2021 Jacek Caban for CodeWeavers
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.
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.
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
24 #define threading
(model
)
27 typedef struct _EVENT_DESCRIPTOR
36 } EVENT_DESCRIPTOR
, *PEVENT_DESCRIPTOR
;
37 typedef const EVENT_DESCRIPTOR
*PCEVENT_DESCRIPTOR
;
39 typedef struct _EVENT_HEADER
47 LARGE_INTEGER TimeStamp
;
49 EVENT_DESCRIPTOR EventDescriptor
;
55 ULONG64 ProcessorTime
;
58 } EVENT_HEADER
, *PEVENT_HEADER
;
60 typedef struct _ETW_BUFFER_CONTEXT
64 UCHAR ProcessorNumber
;
67 USHORT ProcessorIndex
;
70 } ETW_BUFFER_CONTEXT
, *PETW_BUFFER_CONTEXT
;
72 typedef struct _EVENT_HEADER_EXTENDED_DATA_ITEM
79 } EVENT_HEADER_EXTENDED_DATA_ITEM
, *PEVENT_HEADER_EXTENDED_DATA_ITEM
;
81 typedef struct _EVENT_RECORD
83 EVENT_HEADER EventHeader
;
84 ETW_BUFFER_CONTEXT BufferContext
;
85 USHORT ExtendedDataCount
;
86 USHORT UserDataLength
;
87 EVENT_HEADER_EXTENDED_DATA_ITEM
*ExtendedData
;
90 } EVENT_RECORD
, *PEVENT_RECORD
;
92 typedef ULONG64 TRACEHANDLE
, *PTRACEHANDLE
;
96 uuid(8cc97f40
-9028-4ff3
-9b62
-7d1f79ca7bcb
),
99 interface ITraceEvent
: IUnknown
101 HRESULT Clone
([out, retval] ITraceEvent
**NewEvent
);
103 HRESULT GetUserContext
([out, retval] void **UserContext
);
105 HRESULT GetEventRecord
([out, retval] PEVENT_RECORD
*EventRecord
);
107 HRESULT SetPayload
([in, size_is(PayloadSize
)] BYTE *Payload
,
108 [in] ULONG PayloadSize
);
110 HRESULT SetEventDescriptor
([in] PCEVENT_DESCRIPTOR EventDescriptor
);
112 HRESULT SetProcessId
([in] ULONG ProcessId
);
114 HRESULT SetProcessorIndex
([in] ULONG ProcessorIndex
);
116 HRESULT SetThreadId
([in] ULONG ThreadId
);
118 HRESULT SetThreadTimes
([in] ULONG KernelTime
,
119 [in] ULONG UserTime
);
121 HRESULT SetActivityId
([in] LPCGUID ActivityId
);
123 HRESULT SetTimeStamp
([in] LARGE_INTEGER
*TimeStamp
);
125 HRESULT SetProviderId
([in] LPCGUID ProviderId
);
128 interface ITraceRelogger
;
132 uuid(3ed25501
-593f
-43e9
-8f38
-3ab46f5a4a52
)
134 interface ITraceEventCallback
: IUnknown
136 HRESULT OnBeginProcessTrace
([in] ITraceEvent
*HeaderEvent
,
137 [in] ITraceRelogger
*Relogger
);
139 HRESULT OnFinalizeProcessTrace
([in] ITraceRelogger
*Relogger
);
141 HRESULT OnEvent
([in] ITraceEvent
*Event
,
142 [in] ITraceRelogger
*Relogger
);
147 uuid(f754ad43
-3bcc
-4286-8009-9c5da214e84e
),
150 interface ITraceRelogger
: IUnknown
152 HRESULT AddLogfileTraceStream
([in] BSTR LogfileName
,
153 [in] void *UserContext
,
154 [out, retval] TRACEHANDLE
*TraceHandle
);
156 HRESULT AddRealtimeTraceStream
([in] BSTR LoggerName
,
157 [in] void *UserContext
,
158 [out, retval] TRACEHANDLE
*TraceHandle
);
160 HRESULT RegisterCallback
([in] ITraceEventCallback
*Callback);
162 HRESULT Inject
([in] ITraceEvent
*Event
);
164 HRESULT CreateEventInstance
([in] TRACEHANDLE TraceHandle
,
166 [out, retval] ITraceEvent
**Event
);
168 HRESULT ProcessTrace
();
170 HRESULT SetOutputFilename
([in] BSTR LogfileName
);
172 HRESULT SetCompressionMode
([in] BOOLEAN CompressionMode
);
178 uuid(7b40792d
-05ff
-44c4
-9058-f440c71f17d4
),
181 coclass CTraceRelogger
183 [default] interface ITraceRelogger
;