include: Add IGlobalOptions interface.
[wine] / include / evntrace.h
1 /*
2  * Copyright (C) 2005 Mike McCormack
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 #ifndef _EVNTRACE_
20 #define _EVNTRACE_
21
22 #include <guiddef.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
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
32
33 typedef ULONG64 TRACEHANDLE, *PTRACEHANDLE;
34
35 struct _EVENT_TRACE_LOGFILEA;
36 struct _EVENT_TRACE_LOGFILEW;
37
38 typedef struct _EVENT_TRACE_LOGFILEA EVENT_TRACE_LOGFILEA, *PEVENT_TRACE_LOGFILEA;
39 typedef struct _EVENT_TRACE_LOGFILEW EVENT_TRACE_LOGFILEW, *PEVENT_TRACE_LOGFILEW;
40
41 typedef ULONG (WINAPI * PEVENT_TRACE_BUFFER_CALLBACKA)( PEVENT_TRACE_LOGFILEA );
42 typedef ULONG (WINAPI * PEVENT_TRACE_BUFFER_CALLBACKW)( PEVENT_TRACE_LOGFILEW );
43
44 typedef ULONG (WINAPI * WMIDPREQUEST)( WMIDPREQUESTCODE, PVOID, ULONG*, PVOID );
45
46 typedef struct _TRACE_GUID_REGISTRATION
47 {
48     LPCGUID Guid;
49     HANDLE RegHandle;
50 } TRACE_GUID_REGISTRATION, *PTRACE_GUID_REGISTRATION;
51
52 typedef struct _TRACE_GUID_PROPERTIES {
53     GUID    Guid;
54     ULONG   GuidType;
55     ULONG   LoggerId;
56     ULONG   EnableLevel;
57     ULONG   EnableFlags;
58     BOOLEAN IsEnable;
59 } TRACE_GUID_PROPERTIES, *PTRACE_GUID_PROPERTIES;
60
61 typedef struct _EVENT_TRACE_HEADER
62 {
63     USHORT Size;
64     union
65     {
66         USHORT FieldTypeFlags;
67         struct
68         {
69             UCHAR HeaderType;
70             UCHAR MarkerFlags;
71         } DUMMYSTRUCTNAME;
72     } DUMMYUNIONNAME;
73     union
74     {
75         ULONG Version;
76         struct
77         {
78             UCHAR Type;
79             UCHAR Level;
80             USHORT Version;
81         } Class;
82     } DUMMYUNIONNAME1;
83     ULONG ThreadId;
84     ULONG ProcessId;
85     LARGE_INTEGER TimeStamp;
86     union
87     {
88         GUID Guid;
89         ULONGLONG GuidPtr;
90     } DUMMYUNIONNAME2;
91     union
92     {
93         struct
94         {
95             ULONG ClientContext;
96             ULONG Flags;
97         } DUMMYSTRUCTNAME1;
98         struct
99         {
100             ULONG KernelTime;
101             ULONG UserTime;
102         } DUMMYSTRUCTNAME2;
103     } DUMMYUNIONNAME3;
104 } EVENT_TRACE_HEADER, *PEVENT_TRACE_HEADER;
105
106 typedef struct _EVENT_TRACE
107 {
108     EVENT_TRACE_HEADER Header;
109     ULONG InstanceId;
110     ULONG ParentInstanceId;
111     GUID ParentGuid;
112     PVOID MofData;
113     ULONG MofLength;
114     ULONG ClientContext;
115 } EVENT_TRACE, *PEVENT_TRACE;
116
117 typedef VOID (WINAPI * PEVENT_CALLBACK)( PEVENT_TRACE );
118
119 typedef struct _TRACE_LOGFILE_HEADER
120 {
121     ULONG BufferSize;
122     union
123     {
124         ULONG Version;
125         struct 
126         {
127             UCHAR MajorVersion;
128             UCHAR MinorVersion;
129             UCHAR SubVersion;
130             UCHAR SubMinorVersion;
131         } VersionDetail;
132     } DUMMYUNIONNAME;
133     ULONG ProviderVersion;
134     ULONG NumberOfProcessors;
135     LARGE_INTEGER EndTime;
136     ULONG TimerResolution;
137     ULONG MaximumFileSize;
138     ULONG LogFileMode;
139     ULONG BuffersWritten;
140     union
141     {
142         GUID LogInstanceGuid;
143         struct
144         {
145             ULONG StartBuffers;
146             ULONG PointerSize;
147             ULONG EventsLost;
148             ULONG CpuSpeedInMHZ;
149         } DUMMYSTRUCTNAME;
150     } DUMMYUNIONNAME1;
151     LPWSTR LoggerName;
152     LPWSTR LogFileName;
153     TIME_ZONE_INFORMATION TimeZone;
154     LARGE_INTEGER BootTime;
155     LARGE_INTEGER PerfFreq;
156     LARGE_INTEGER StartTime;
157     ULONG ReservedTime;
158     ULONG BuffersLost;
159 } TRACE_LOGFILE_HEADER, *PTRACE_LOGFILE_HEADER;
160
161 struct _EVENT_TRACE_LOGFILEW
162 {
163     LPWSTR LogFileName;
164     LPWSTR LoggerName;
165     LONGLONG CurrentTime;
166     ULONG LogFileMode;
167     EVENT_TRACE CurrentEvent;
168     TRACE_LOGFILE_HEADER LogfileHeader;
169     PEVENT_TRACE_BUFFER_CALLBACKW BufferCallback;
170     ULONG BufferSize;
171     ULONG Filled;
172     ULONG EventsLost;
173     PEVENT_CALLBACK EventCallback;
174     PVOID Context;
175 };
176
177 struct _EVENT_TRACE_LOGFILEA
178 {
179     LPSTR LogFileName;
180     LPSTR LoggerName;
181     LONGLONG CurrentTime;
182     ULONG LogFileMode;
183     EVENT_TRACE CurrentEvent;
184     TRACE_LOGFILE_HEADER LogfileHeader;
185     PEVENT_TRACE_BUFFER_CALLBACKA BufferCallback;
186     ULONG BufferSize;
187     ULONG Filled;
188     ULONG EventsLost;
189     PEVENT_CALLBACK EventCallback;
190     PVOID Context;
191 };
192
193 typedef struct _EVENT_TRACE_PROPERTIES
194 {
195     WNODE_HEADER Wnode;
196     ULONG BufferSize;
197     ULONG MinimumBuffers;
198     ULONG MaximumBuffers;
199     ULONG MaximumFileSize;
200     ULONG LogFileMode;
201     ULONG FlushTimer;
202     LONG AgeLimit;
203     ULONG NumberOfBuffers;
204     ULONG FreeBuffers;
205     ULONG EventsLost;
206     ULONG BuffersWritten;
207     ULONG LogBuffersLost;
208     ULONG RealTimeBuffersLost;
209     HANDLE LoggerThreadId;
210     ULONG LoggerFileNameOffset;
211     ULONG LoggerNameOffset;
212 } EVENT_TRACE_PROPERTIES, *PEVENT_TRACE_PROPERTIES;
213
214 #define INVALID_PROCESSTRACE_HANDLE ((TRACEHANDLE)~(ULONG_PTR)0)
215
216 ULONG WINAPI CloseTrace(TRACEHANDLE);
217 ULONG WINAPI ControlTraceA(TRACEHANDLE,LPCSTR,PEVENT_TRACE_PROPERTIES,ULONG);
218 ULONG WINAPI ControlTraceW(TRACEHANDLE,LPCWSTR,PEVENT_TRACE_PROPERTIES,ULONG);
219 #define      ControlTrace WINELIB_NAME_AW(ControlTrace)
220 ULONG WINAPI EnableTrace(ULONG,ULONG,ULONG,LPCGUID,TRACEHANDLE);
221 ULONG WINAPI FlushTraceA(TRACEHANDLE,LPCSTR,PEVENT_TRACE_PROPERTIES);
222 ULONG WINAPI FlushTraceW(TRACEHANDLE,LPCWSTR,PEVENT_TRACE_PROPERTIES);
223 #define      FlushTrace WINELIB_NAME_AW(FlushTrace)
224 ULONG WINAPI QueryAllTracesA(PEVENT_TRACE_PROPERTIES*,ULONG,PULONG);
225 ULONG WINAPI QueryAllTracesW(PEVENT_TRACE_PROPERTIES*,ULONG,PULONG);
226 #define      QueryAllTraces WINELIB_NAME_AW(QueryAllTraces)
227 ULONG WINAPI RegisterTraceGuidsA(WMIDPREQUEST,PVOID,LPCGUID,ULONG,PTRACE_GUID_REGISTRATION,LPCSTR,LPCSTR,PTRACEHANDLE);
228 ULONG WINAPI RegisterTraceGuidsW(WMIDPREQUEST,PVOID,LPCGUID,ULONG,PTRACE_GUID_REGISTRATION,LPCWSTR,LPCWSTR,PTRACEHANDLE);
229 #define      RegisterTraceGuids WINELIB_NAME_AW(RegisterTraceGuids)
230 ULONG WINAPI StartTraceA(PTRACEHANDLE,LPCSTR,PEVENT_TRACE_PROPERTIES);
231 ULONG WINAPI StartTraceW(PTRACEHANDLE,LPCWSTR,PEVENT_TRACE_PROPERTIES);
232 #define      StartTrace WINELIB_NAME_AW(StartTrace)
233 ULONG WINAPI TraceEvent(TRACEHANDLE,PEVENT_TRACE_HEADER);
234 ULONG WINAPIV TraceMessage(TRACEHANDLE,ULONG,LPGUID,USHORT,...);
235 ULONG WINAPI TraceMessageVa(TRACEHANDLE,ULONG,LPGUID,USHORT,__ms_va_list);
236 ULONG WINAPI UnregisterTraceGuids(TRACEHANDLE);
237
238 #ifdef __cplusplus
239 }
240 #endif
241
242 #endif /* _EVNTRACE_ */