2 * Copyright (C) 2005 Mike McCormack
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
28 #define EVENT_TRACE_CONTROL_QUERY 0
29 #define EVENT_TRACE_CONTROL_STOP 1
30 #define EVENT_TRACE_CONTROL_UPDATE 2
31 #define EVENT_TRACE_CONTROL_FLUSH 3
33 #define TRACE_LEVEL_NONE 0
34 #define TRACE_LEVEL_CRITICAL 1
35 #define TRACE_LEVEL_FATAL 1
36 #define TRACE_LEVEL_ERROR 2
37 #define TRACE_LEVEL_WARNING 3
38 #define TRACE_LEVEL_INFORMATION 4
39 #define TRACE_LEVEL_VERBOSE 5
41 #define EVENT_TRACE_FILE_MODE_NONE 0x00000000
42 #define EVENT_TRACE_FILE_MODE_SEQUENTIAL 0x00000001
43 #define EVENT_TRACE_FILE_MODE_CIRCULAR 0x00000002
44 #define EVENT_TRACE_FILE_MODE_APPEND 0x00000004
45 #define EVENT_TRACE_FILE_MODE_NEWFILE 0x00000008
46 #define EVENT_TRACE_FILE_MODE_PREALLOCATE 0x00000020
47 #define EVENT_TRACE_NONSTOPPABLE_MODE 0x00000040
48 #define EVENT_TRACE_SECURE_MODE 0x00000080
49 #define EVENT_TRACE_REAL_TIME_MODE 0x00000100
50 #define EVENT_TRACE_DELAY_OPEN_FILE_MODE 0x00000200
51 #define EVENT_TRACE_BUFFERING_MODE 0x00000400
52 #define EVENT_TRACE_PRIVATE_LOGGER_MODE 0x00000800
53 #define EVENT_TRACE_ADD_HEADER_MODE 0x00001000
54 #define EVENT_TRACE_USE_KBYTES_FOR_SIZE 0x00002000
55 #define EVENT_TRACE_USE_GLOBAL_SEQUENCE 0x00004000
56 #define EVENT_TRACE_USE_LOCAL_SEQUENCE 0x00008000
57 #define EVENT_TRACE_RELOG_MODE 0x00010000
58 #define EVENT_TRACE_PRIVATE_IN_PROC 0x00020000
59 #define EVENT_TRACE_MODE_RESERVED 0x00100000
60 #define EVENT_TRACE_STOP_ON_HYBRID_SHUTDOWN 0x00400000
61 #define EVENT_TRACE_PERSIST_ON_HYBRID_SHUTDOWN 0x00800000
62 #define EVENT_TRACE_USE_PAGED_MEMORY 0x01000000
63 #define EVENT_TRACE_SYSTEM_LOGGER_MODE 0x02000000
64 #define EVENT_TRACE_INDEPENDENT_SESSION_MODE 0x08000000
65 #define EVENT_TRACE_NO_PER_PROCESSOR_BUFFERING 0x10000000
66 #define EVENT_TRACE_ADDTO_TRIAGE_DUMP 0x80000000
68 DEFINE_GUID (SystemTraceControlGuid
, 0x9e814aad, 0x3204, 0x11d2, 0x9a, 0x82, 0x00, 0x60, 0x08, 0xa8, 0x69, 0x39);
70 typedef ULONG64 TRACEHANDLE
, *PTRACEHANDLE
;
72 struct _EVENT_TRACE_LOGFILEA
;
73 struct _EVENT_TRACE_LOGFILEW
;
75 typedef struct _EVENT_TRACE_LOGFILEA EVENT_TRACE_LOGFILEA
, *PEVENT_TRACE_LOGFILEA
;
76 typedef struct _EVENT_TRACE_LOGFILEW EVENT_TRACE_LOGFILEW
, *PEVENT_TRACE_LOGFILEW
;
78 typedef ULONG (WINAPI
* PEVENT_TRACE_BUFFER_CALLBACKA
)( PEVENT_TRACE_LOGFILEA
);
79 typedef ULONG (WINAPI
* PEVENT_TRACE_BUFFER_CALLBACKW
)( PEVENT_TRACE_LOGFILEW
);
81 typedef ULONG (WINAPI
* WMIDPREQUEST
)( WMIDPREQUESTCODE
, PVOID
, ULONG
*, PVOID
);
83 typedef struct _TRACE_GUID_REGISTRATION
87 } TRACE_GUID_REGISTRATION
, *PTRACE_GUID_REGISTRATION
;
89 typedef struct _TRACE_GUID_PROPERTIES
{
96 } TRACE_GUID_PROPERTIES
, *PTRACE_GUID_PROPERTIES
;
98 typedef struct _EVENT_TRACE_HEADER
103 USHORT FieldTypeFlags
;
122 LARGE_INTEGER TimeStamp
;
141 } EVENT_TRACE_HEADER
, *PEVENT_TRACE_HEADER
;
143 typedef struct _EVENT_TRACE
145 EVENT_TRACE_HEADER Header
;
147 ULONG ParentInstanceId
;
152 } EVENT_TRACE
, *PEVENT_TRACE
;
154 typedef VOID (WINAPI
* PEVENT_CALLBACK
)( PEVENT_TRACE
);
156 typedef struct _TRACE_LOGFILE_HEADER
167 UCHAR SubMinorVersion
;
170 ULONG ProviderVersion
;
171 ULONG NumberOfProcessors
;
172 LARGE_INTEGER EndTime
;
173 ULONG TimerResolution
;
174 ULONG MaximumFileSize
;
176 ULONG BuffersWritten
;
179 GUID LogInstanceGuid
;
190 TIME_ZONE_INFORMATION TimeZone
;
191 LARGE_INTEGER BootTime
;
192 LARGE_INTEGER PerfFreq
;
193 LARGE_INTEGER StartTime
;
196 } TRACE_LOGFILE_HEADER
, *PTRACE_LOGFILE_HEADER
;
198 struct _EVENT_TRACE_LOGFILEW
202 LONGLONG CurrentTime
;
204 EVENT_TRACE CurrentEvent
;
205 TRACE_LOGFILE_HEADER LogfileHeader
;
206 PEVENT_TRACE_BUFFER_CALLBACKW BufferCallback
;
210 PEVENT_CALLBACK EventCallback
;
214 struct _EVENT_TRACE_LOGFILEA
218 LONGLONG CurrentTime
;
220 EVENT_TRACE CurrentEvent
;
221 TRACE_LOGFILE_HEADER LogfileHeader
;
222 PEVENT_TRACE_BUFFER_CALLBACKA BufferCallback
;
226 PEVENT_CALLBACK EventCallback
;
230 typedef struct _EVENT_TRACE_PROPERTIES
234 ULONG MinimumBuffers
;
235 ULONG MaximumBuffers
;
236 ULONG MaximumFileSize
;
240 ULONG NumberOfBuffers
;
243 ULONG BuffersWritten
;
244 ULONG LogBuffersLost
;
245 ULONG RealTimeBuffersLost
;
246 HANDLE LoggerThreadId
;
247 ULONG LogFileNameOffset
;
248 ULONG LoggerNameOffset
;
249 } EVENT_TRACE_PROPERTIES
, *PEVENT_TRACE_PROPERTIES
;
251 #define INVALID_PROCESSTRACE_HANDLE ((TRACEHANDLE)~(ULONG_PTR)0)
253 ULONG WINAPI
CloseTrace(TRACEHANDLE
);
254 ULONG WINAPI
ControlTraceA(TRACEHANDLE
,LPCSTR
,PEVENT_TRACE_PROPERTIES
,ULONG
);
255 ULONG WINAPI
ControlTraceW(TRACEHANDLE
,LPCWSTR
,PEVENT_TRACE_PROPERTIES
,ULONG
);
256 #define ControlTrace WINELIB_NAME_AW(ControlTrace)
257 ULONG WINAPI
EnableTrace(ULONG
,ULONG
,ULONG
,LPCGUID
,TRACEHANDLE
);
258 ULONG WINAPI
FlushTraceA(TRACEHANDLE
,LPCSTR
,PEVENT_TRACE_PROPERTIES
);
259 ULONG WINAPI
FlushTraceW(TRACEHANDLE
,LPCWSTR
,PEVENT_TRACE_PROPERTIES
);
260 #define FlushTrace WINELIB_NAME_AW(FlushTrace)
261 ULONG WINAPI
GetTraceEnableFlags(TRACEHANDLE
);
262 UCHAR WINAPI
GetTraceEnableLevel(TRACEHANDLE
);
263 TRACEHANDLE WINAPI
GetTraceLoggerHandle(PVOID
);
264 ULONG WINAPI
QueryAllTracesA(PEVENT_TRACE_PROPERTIES
*,ULONG
,PULONG
);
265 ULONG WINAPI
QueryAllTracesW(PEVENT_TRACE_PROPERTIES
*,ULONG
,PULONG
);
266 #define QueryAllTraces WINELIB_NAME_AW(QueryAllTraces)
267 ULONG WINAPI
RegisterTraceGuidsA(WMIDPREQUEST
,PVOID
,LPCGUID
,ULONG
,PTRACE_GUID_REGISTRATION
,LPCSTR
,LPCSTR
,PTRACEHANDLE
);
268 ULONG WINAPI
RegisterTraceGuidsW(WMIDPREQUEST
,PVOID
,LPCGUID
,ULONG
,PTRACE_GUID_REGISTRATION
,LPCWSTR
,LPCWSTR
,PTRACEHANDLE
);
269 #define RegisterTraceGuids WINELIB_NAME_AW(RegisterTraceGuids)
270 ULONG WINAPI
StartTraceA(PTRACEHANDLE
,LPCSTR
,PEVENT_TRACE_PROPERTIES
);
271 ULONG WINAPI
StartTraceW(PTRACEHANDLE
,LPCWSTR
,PEVENT_TRACE_PROPERTIES
);
272 #define StartTrace WINELIB_NAME_AW(StartTrace)
273 ULONG WINAPI
TraceEvent(TRACEHANDLE
,PEVENT_TRACE_HEADER
);
274 ULONG WINAPIV
TraceMessage(TRACEHANDLE
,ULONG
,LPGUID
,USHORT
,...);
275 ULONG WINAPI
TraceMessageVa(TRACEHANDLE
,ULONG
,LPGUID
,USHORT
,__ms_va_list
);
276 ULONG WINAPI
UnregisterTraceGuids(TRACEHANDLE
);
282 #endif /* _EVNTRACE_ */