xref: /reactos/dll/ntdll/etw/trace.c (revision 1734f297)
1 /*
2  * ntdll.dll Event Tracing Functions
3  */
4 
5 #include <ntdll.h>
6 
7 #include <wmistr.h>
8 #include <evntrace.h>
9 
10 #define NDEBUG
11 #include <debug.h>
12 
13 #define FIXME DPRINT1
14 
15 /*
16  * @unimplemented
17  */
18 ULONG CDECL
19 EtwTraceMessage(
20     TRACEHANDLE  SessionHandle,
21     ULONG        MessageFlags,
22     LPCGUID      MessageGuid,
23     USHORT       MessageNumber,
24     ...)
25 {
26     FIXME("TraceMessage()\n");
27     return ERROR_SUCCESS;
28 }
29 
30 TRACEHANDLE
31 NTAPI
32 EtwGetTraceLoggerHandle(
33     PVOID Buffer
34 )
35 {
36     FIXME("EtwGetTraceLoggerHandle stub()\n");
37     return (TRACEHANDLE)-1;
38 }
39 
40 
41 ULONG
42 NTAPI
43 EtwTraceEvent(
44     TRACEHANDLE SessionHandle,
45     PEVENT_TRACE_HEADER EventTrace
46 )
47 {
48     FIXME("EtwTraceEvent stub()\n");
49 
50     if (!SessionHandle || !EventTrace)
51     {
52         /* invalid parameters */
53         return ERROR_INVALID_PARAMETER;
54     }
55 
56     if (EventTrace->Size != sizeof(EVENT_TRACE_HEADER))
57     {
58         /* invalid parameter */
59         return ERROR_INVALID_PARAMETER;
60     }
61 
62     return ERROR_SUCCESS;
63 }
64 
65 ULONG
66 NTAPI
67 EtwGetTraceEnableFlags(
68     TRACEHANDLE TraceHandle
69 )
70 {
71     FIXME("EtwGetTraceEnableFlags stub()\n");
72     return 0xFF;
73 }
74 
75 UCHAR
76 NTAPI
77 EtwGetTraceEnableLevel(
78     TRACEHANDLE TraceHandle
79 )
80 {
81     FIXME("EtwGetTraceEnableLevel stub()\n");
82     return 0xFF;
83 }
84 
85 ULONG
86 NTAPI
87 EtwUnregisterTraceGuids(
88     TRACEHANDLE RegistrationHandle
89 )
90 {
91     FIXME("EtwUnregisterTraceGuids stub()\n");
92     return ERROR_SUCCESS;
93 }
94 
95 ULONG
96 NTAPI
97 EtwRegisterTraceGuidsA(
98     WMIDPREQUEST RequestAddress,
99     PVOID RequestContext,
100     LPCGUID ControlGuid,
101     ULONG GuidCount,
102     PTRACE_GUID_REGISTRATION TraceGuidReg,
103     LPCSTR MofImagePath,
104     LPCSTR MofResourceName,
105     PTRACEHANDLE RegistrationHandle
106 )
107 {
108     FIXME("EtwRegisterTraceGuidsA stub()\n");
109     return ERROR_SUCCESS;
110 }
111 
112 ULONG
113 NTAPI
114 EtwRegisterTraceGuidsW(
115     WMIDPREQUEST RequestAddress,
116     PVOID RequestContext,
117     LPCGUID ControlGuid,
118     ULONG GuidCount,
119     PTRACE_GUID_REGISTRATION TraceGuidReg,
120     LPCWSTR MofImagePath,
121     LPCWSTR MofResourceName,
122     PTRACEHANDLE RegistrationHandle
123 )
124 {
125     FIXME("EtwRegisterTraceGuidsW stub()\n");
126     return ERROR_SUCCESS;
127 }
128 
129 ULONG WINAPI EtwStartTraceW( PTRACEHANDLE pSessionHandle, LPCWSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
130 {
131     FIXME("(%p, %s, %p) stub\n", pSessionHandle, SessionName, Properties);
132     if (pSessionHandle) *pSessionHandle = 0xcafe4242;
133     return ERROR_SUCCESS;
134 }
135 
136 ULONG WINAPI EtwStartTraceA( PTRACEHANDLE pSessionHandle, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
137 {
138     FIXME("(%p, %s, %p) stub\n", pSessionHandle, SessionName, Properties);
139     if (pSessionHandle) *pSessionHandle = 0xcafe4242;
140     return ERROR_SUCCESS;
141 }
142 
143 /******************************************************************************
144  * EtwControlTraceW [NTDLL.@]
145  *
146  * Control a givel event trace session
147  *
148  */
149 ULONG WINAPI EtwControlTraceW( TRACEHANDLE hSession, LPCWSTR SessionName, PEVENT_TRACE_PROPERTIES Properties, ULONG control )
150 {
151     FIXME("(%I64x, %s, %p, %d) stub\n", hSession, SessionName, Properties, control);
152     return ERROR_SUCCESS;
153 }
154 
155 /******************************************************************************
156  * EtwControlTraceA [NTDLL.@]
157  *
158  * See ControlTraceW.
159  *
160  */
161 ULONG WINAPI EtwControlTraceA( TRACEHANDLE hSession, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties, ULONG control )
162 {
163     FIXME("(%I64x, %s, %p, %d) stub\n", hSession, SessionName, Properties, control);
164     return ERROR_SUCCESS;
165 }
166 
167 /******************************************************************************
168  * EtwEnableTrace [NTDLL.@]
169  */
170 ULONG WINAPI EtwEnableTrace( ULONG enable, ULONG flag, ULONG level, LPCGUID guid, TRACEHANDLE hSession )
171 {
172     FIXME("(%d, 0x%x, %d, %p, %I64x): stub\n", enable, flag, level,
173             guid, hSession);
174 
175     return ERROR_SUCCESS;
176 }
177 
178 /******************************************************************************
179  * EtwQueryAllTracesW [NTDLL.@]
180  *
181  * Query information for started event trace sessions
182  *
183  */
184 ULONG WINAPI EtwQueryAllTracesW( PEVENT_TRACE_PROPERTIES * parray, ULONG arraycount, PULONG psessioncount )
185 {
186     FIXME("(%p, %d, %p) stub\n", parray, arraycount, psessioncount);
187 
188     if (psessioncount) *psessioncount = 0;
189     return ERROR_SUCCESS;
190 }
191 
192 /******************************************************************************
193  * QueryAllTracesA [NTDLL.@]
194  *
195  * See EtwQueryAllTracesA.
196  */
197 ULONG WINAPI EtwQueryAllTracesA( PEVENT_TRACE_PROPERTIES * parray, ULONG arraycount, PULONG psessioncount )
198 {
199     FIXME("(%p, %d, %p) stub\n", parray, arraycount, psessioncount);
200 
201     if (psessioncount) *psessioncount = 0;
202     return ERROR_SUCCESS;
203 }
204 
205 /******************************************************************************
206  * EtwFlushTraceA [NTDLL.@]
207  *
208  */
209 ULONG WINAPI EtwFlushTraceA( TRACEHANDLE hSession, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
210 {
211     return EtwControlTraceA( hSession, SessionName, Properties, EVENT_TRACE_CONTROL_FLUSH );
212 }
213 
214 /******************************************************************************
215  * EtwFlushTraceW [NTDLL.@]
216  *
217  */
218 ULONG WINAPI EtwFlushTraceW( TRACEHANDLE hSession, LPCWSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
219 {
220     return EtwControlTraceW( hSession, SessionName, Properties, EVENT_TRACE_CONTROL_FLUSH );
221 }
222 
223 /******************************************************************************
224  * EtwQueryTraceA [NTDLL.@]
225  *
226  */
227 ULONG WINAPI EtwQueryTraceA( TRACEHANDLE hSession, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
228 {
229     return EtwControlTraceA( hSession, SessionName, Properties, EVENT_TRACE_CONTROL_QUERY );
230 }
231 
232 /******************************************************************************
233  * EtwQueryTraceW [NTDLL.@]
234  *
235  */
236 ULONG WINAPI EtwQueryTraceW( TRACEHANDLE hSession, LPCWSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
237 {
238     return EtwControlTraceW( hSession, SessionName, Properties, EVENT_TRACE_CONTROL_QUERY );
239 }
240 
241 /******************************************************************************
242  * EtwStopTraceA [NTDLL.@]
243  *
244  */
245 ULONG WINAPI EtwStopTraceA( TRACEHANDLE hSession, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
246 {
247     return EtwControlTraceA( hSession, SessionName, Properties, EVENT_TRACE_CONTROL_STOP );
248 }
249 
250 /******************************************************************************
251  * EtwStopTraceW [NTDLL.@]
252  *
253  */
254 ULONG WINAPI EtwStopTraceW( TRACEHANDLE hSession, LPCWSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
255 {
256     return EtwControlTraceW( hSession, SessionName, Properties, EVENT_TRACE_CONTROL_STOP );
257 }
258 
259 /******************************************************************************
260  * EtwUpdateTraceA [NTDLL.@]
261  *
262  */
263 ULONG WINAPI EtwUpdateTraceA( TRACEHANDLE hSession, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
264 {
265     return EtwControlTraceA( hSession, SessionName, Properties, EVENT_TRACE_CONTROL_UPDATE );
266 }
267 
268 /******************************************************************************
269  * EtwUpdateTraceW [NTDLL.@]
270  *
271  */
272 ULONG WINAPI EtwUpdateTraceW( TRACEHANDLE hSession, LPCWSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
273 {
274     return EtwControlTraceW( hSession, SessionName, Properties, EVENT_TRACE_CONTROL_UPDATE );
275 }
276 
277 /* EOF */
278