ReactOS  0.4.15-dev-1200-gc3b3fcd
evntprov.h
Go to the documentation of this file.
1 /*
2  * evntprov.h
3  *
4  * This file is part of the ReactOS PSDK package.
5  *
6  * Contributors:
7  * Created by Amine Khaldi.
8  *
9  * THIS SOFTWARE IS NOT COPYRIGHTED
10  *
11  * This source code is offered for use in the public domain. You may
12  * use, modify or distribute it freely.
13  *
14  * This code is distributed in the hope that it will be useful but
15  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
16  * DISCLAIMED. This includes but is not limited to warranties of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18  *
19  */
20 
21 #pragma once
22 
23 #define _EVNTPROV_
24 
25 #ifndef EVNTAPI
26 #ifndef MIDL_PASS
27 #ifdef _EVNT_SOURCE_
28 #define EVNTAPI __stdcall
29 #else
30 #define EVNTAPI DECLSPEC_IMPORT __stdcall
31 #endif /* _EVNT_SOURCE_ */
32 #endif /* MIDL_PASS */
33 #endif /* EVNTAPI */
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #define EVENT_MIN_LEVEL (0)
40 #define EVENT_MAX_LEVEL (0xff)
41 
42 #define EVENT_ACTIVITY_CTRL_GET_ID (1)
43 #define EVENT_ACTIVITY_CTRL_SET_ID (2)
44 #define EVENT_ACTIVITY_CTRL_CREATE_ID (3)
45 #define EVENT_ACTIVITY_CTRL_GET_SET_ID (4)
46 #define EVENT_ACTIVITY_CTRL_CREATE_SET_ID (5)
47 
49 
50 #define MAX_EVENT_DATA_DESCRIPTORS (128)
51 #define MAX_EVENT_FILTER_DATA_SIZE (1024)
52 
53 #define EVENT_FILTER_TYPE_SCHEMATIZED (0x80000000)
54 
55 typedef struct _EVENT_DATA_DESCRIPTOR {
60 
61 typedef struct _EVENT_DESCRIPTOR {
71 
72 #ifndef _EVNTRACE_
73 typedef struct _EVENT_FILTER_DESCRIPTOR {
78 #endif
79 
80 typedef struct _EVENT_FILTER_HEADER {
88 
89 #ifndef _ETW_KM_
90 
91 typedef VOID
93  _In_ LPCGUID SourceId,
94  _In_ ULONG IsEnabled,
100 
101 #if (WINVER >= _WIN32_WINNT_VISTA)
102 ULONG
103 EVNTAPI
105  _In_ LPCGUID ProviderId,
109 
110 ULONG
111 EVNTAPI
114 
115 BOOLEAN
116 EVNTAPI
120 
121 BOOLEAN
122 EVNTAPI
125  _In_ UCHAR Level,
127 
128 ULONG
129 EVNTAPI
130 EventWrite(
135 
136 ULONG
137 EVNTAPI
145 
146 ULONG
147 EVNTAPI
150  _In_ UCHAR Level,
152  _In_ PCWSTR String);
153 
154 ULONG
155 EVNTAPI
159 
160 #endif /* (WINVER >= _WIN32_WINNT_VISTA) */
161 
162 #if (WINVER >= _WIN32_WINNT_WIN7)
163 ULONG
164 EVNTAPI
169  _In_ ULONG Flags,
174 #endif
175 
176 #endif // _ETW_KM_
177 
179 VOID
181  _Out_ PEVENT_DATA_DESCRIPTOR EventDataDescriptor,
182  _In_reads_bytes_(DataSize) const VOID* DataPtr,
184 {
185  EventDataDescriptor->Ptr = (ULONGLONG)(ULONG_PTR)DataPtr;
186  EventDataDescriptor->Size = DataSize;
187  EventDataDescriptor->Reserved = 0;
188 }
189 
191 VOID
194  _In_ USHORT Id,
196  _In_ UCHAR Channel,
197  _In_ UCHAR Level,
198  _In_ USHORT Task,
199  _In_ UCHAR Opcode,
201 {
202  EventDescriptor->Id = Id;
204  EventDescriptor->Channel = Channel;
206  EventDescriptor->Task = Task;
209 }
210 
212 VOID
215 {
217 }
218 
220 USHORT
223 {
224  return (EventDescriptor->Id);
225 }
226 
228 UCHAR
231 {
232  return (EventDescriptor->Version);
233 }
234 
236 USHORT
239 {
240  return (EventDescriptor->Task);
241 }
242 
244 UCHAR
247 {
248  return (EventDescriptor->Opcode);
249 }
250 
252 UCHAR
255 {
256  return (EventDescriptor->Channel);
257 }
258 
260 UCHAR
263 {
264  return (EventDescriptor->Level);
265 }
266 
268 ULONGLONG
271 {
272  return (EventDescriptor->Keyword);
273 }
274 
279  _In_ USHORT Id)
280 {
281  EventDescriptor->Id = Id;
282  return (EventDescriptor);
283 }
284 
290 {
292  return (EventDescriptor);
293 }
294 
299  _In_ USHORT Task)
300 {
301  EventDescriptor->Task = Task;
302  return (EventDescriptor);
303 }
304 
309  _In_ UCHAR Opcode)
310 {
312  return (EventDescriptor);
313 }
314 
319  _In_ UCHAR Level)
320 {
322  return (EventDescriptor);
323 }
324 
329  _In_ UCHAR Channel)
330 {
331  EventDescriptor->Channel = Channel;
332  return (EventDescriptor);
333 }
334 
340 {
342  return (EventDescriptor);
343 }
344 
345 
351 {
353  return (EventDescriptor);
354 }
355 
356 #ifdef __cplusplus
357 }
358 #endif
FORCEINLINE UCHAR EventDescGetLevel(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
Definition: evntprov.h:261
struct _EVENT_FILTER_HEADER * PEVENT_FILTER_HEADER
FORCEINLINE UCHAR EventDescGetVersion(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
Definition: evntprov.h:229
const uint16_t * PCWSTR
Definition: typedefs.h:57
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:361
FORCEINLINE USHORT EventDescGetId(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
Definition: evntprov.h:221
_In_ PVOID _In_ ULONG Opcode
Definition: hubbusif.h:330
ULONG EVNTAPI EventWriteEx(_In_ REGHANDLE RegHandle, _In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ ULONG64 Filter, _In_ ULONG Flags, _In_opt_ LPCGUID ActivityId, _In_opt_ LPCGUID RelatedActivityId, _In_ ULONG UserDataCount, _In_reads_opt_(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData)
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG _In_ ULONGLONG _In_opt_ PEVENT_FILTER_DESCRIPTOR _Inout_opt_ PVOID CallbackContext
Definition: wmitypes.h:55
FORCEINLINE VOID EventDescZero(_Out_ PEVENT_DESCRIPTOR EventDescriptor)
Definition: evntprov.h:213
struct _EVENT_DESCRIPTOR EVENT_DESCRIPTOR
_In_ PCEVENT_DESCRIPTOR _In_opt_ LPCGUID _In_ ULONG UserDataCount
Definition: wmifuncs.h:119
ULONG EVNTAPI EventWrite(_In_ REGHANDLE RegHandle, _In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ ULONG UserDataCount, _In_reads_opt_(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData)
FORCEINLINE USHORT EventDescGetTask(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
Definition: evntprov.h:237
VOID(NTAPI * PENABLECALLBACK)(_In_ LPCGUID SourceId, _In_ ULONG IsEnabled, _In_ UCHAR Level, _In_ ULONGLONG MatchAnyKeyword, _In_ ULONGLONG MatchAllKeyword, _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData, _Inout_opt_ PVOID CallbackContext)
Definition: evntprov.h:92
ULONGLONG InstanceId
Definition: evntprov.h:84
ULONGLONG Keyword
Definition: evntprov.h:68
struct _EVENT_FILTER_DESCRIPTOR * PEVENT_FILTER_DESCRIPTOR
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
static WCHAR String[]
Definition: stringtable.c:55
ULONG EVNTAPI EventUnregister(_In_ REGHANDLE RegHandle)
BOOLEAN EVNTAPI EventEnabled(_In_ REGHANDLE RegHandle, _In_ PCEVENT_DESCRIPTOR EventDescriptor)
struct _EVENT_DATA_DESCRIPTOR * PEVENT_DATA_DESCRIPTOR
FORCEINLINE PEVENT_DESCRIPTOR EventDescSetKeyword(_In_ PEVENT_DESCRIPTOR EventDescriptor, _In_ ULONGLONG Keyword)
Definition: evntprov.h:337
FORCEINLINE PEVENT_DESCRIPTOR EventDescOrKeyword(_In_ PEVENT_DESCRIPTOR EventDescriptor, _In_ ULONGLONG Keyword)
Definition: evntprov.h:348
FORCEINLINE ULONGLONG EventDescGetKeyword(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
Definition: evntprov.h:269
#define _In_opt_
Definition: no_sal2.h:213
const EVENT_DESCRIPTOR * PCEVENT_DESCRIPTOR
Definition: evntprov.h:70
_In_opt_ PETWENABLECALLBACK EnableCallback
Definition: wmifuncs.h:76
DWORD Id
uint32_t ULONG_PTR
Definition: typedefs.h:65
FORCEINLINE PEVENT_DESCRIPTOR EventDescSetId(_In_ PEVENT_DESCRIPTOR EventDescriptor, _In_ USHORT Id)
Definition: evntprov.h:277
FORCEINLINE PEVENT_DESCRIPTOR EventDescSetLevel(_In_ PEVENT_DESCRIPTOR EventDescriptor, _In_ UCHAR Level)
Definition: evntprov.h:317
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
FORCEINLINE PEVENT_DESCRIPTOR EventDescSetOpcode(_In_ PEVENT_DESCRIPTOR EventDescriptor, _In_ UCHAR Opcode)
Definition: evntprov.h:307
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
struct _EVENT_FILTER_HEADER EVENT_FILTER_HEADER
_In_ PCEVENT_DESCRIPTOR _In_opt_ LPCGUID _In_opt_ LPCGUID RelatedActivityId
Definition: wmifuncs.h:130
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1802
unsigned char BOOLEAN
struct _EVENT_FILTER_DESCRIPTOR EVENT_FILTER_DESCRIPTOR
#define FORCEINLINE
Definition: ntbasedef.h:216
#define _Out_
Definition: no_sal2.h:323
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
Definition: wmitypes.h:55
_In_opt_ PETWENABLECALLBACK _In_opt_ PVOID _Out_ PREGHANDLE RegHandle
Definition: wmifuncs.h:76
BOOLEAN EVNTAPI EventProviderEnabled(_In_ REGHANDLE RegHandle, _In_ UCHAR Level, _In_ ULONGLONG Keyword)
struct Keyword Keyword
Definition: tokenize.c:33
ULONGLONG * PREGHANDLE
Definition: evntprov.h:48
FORCEINLINE UCHAR EventDescGetChannel(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
Definition: evntprov.h:253
FORCEINLINE UCHAR EventDescGetOpcode(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
Definition: evntprov.h:245
uint64_t ULONGLONG
Definition: typedefs.h:67
struct _EVENT_DESCRIPTOR * PEVENT_DESCRIPTOR
ULONG EVNTAPI EventActivityIdControl(_In_ ULONG ControlCode, _Inout_ LPGUID ActivityId)
ULONG EVNTAPI EventWriteTransfer(_In_ REGHANDLE RegHandle, _In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_opt_ LPCGUID ActivityId, _In_opt_ LPCGUID RelatedActivityId, _In_ ULONG UserDataCount, _In_reads_opt_(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData)
#define _Inout_
Definition: no_sal2.h:244
unsigned __int64 ULONG64
Definition: imports.h:198
unsigned char UCHAR
Definition: xmlstorage.h:181
_In_ PCEVENT_DESCRIPTOR _In_opt_ LPCGUID ActivityId
Definition: wmifuncs.h:119
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG MatchAnyKeyword
Definition: wmitypes.h:55
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG _In_ ULONGLONG MatchAllKeyword
Definition: wmitypes.h:55
#define VOID
Definition: acefi.h:82
#define _In_reads_bytes_(size)
Definition: no_sal2.h:229
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG _In_ ULONGLONG _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData
Definition: wmitypes.h:55
_In_ PCEVENT_DESCRIPTOR EventDescriptor
Definition: wmifuncs.h:93
#define _In_
Definition: no_sal2.h:204
ULONG EVNTAPI EventWriteString(_In_ REGHANDLE RegHandle, _In_ UCHAR Level, _In_ ULONGLONG Keyword, _In_ PCWSTR String)
unsigned short USHORT
Definition: pedump.c:61
struct _EVENT_DATA_DESCRIPTOR EVENT_DATA_DESCRIPTOR
FORCEINLINE VOID EventDescCreate(_Out_ PEVENT_DESCRIPTOR EventDescriptor, _In_ USHORT Id, _In_ UCHAR Version, _In_ UCHAR Channel, _In_ UCHAR Level, _In_ USHORT Task, _In_ UCHAR Opcode, _In_ ULONGLONG Keyword)
Definition: evntprov.h:192
#define _In_reads_opt_(size)
Definition: no_sal2.h:231
unsigned int ULONG
Definition: retypes.h:1
ULONGLONG REGHANDLE
Definition: evntprov.h:48
FORCEINLINE PEVENT_DESCRIPTOR EventDescSetVersion(_In_ PEVENT_DESCRIPTOR EventDescriptor, _In_ UCHAR Version)
Definition: evntprov.h:287
#define EVNTAPI
Definition: evntprov.h:30
#define memset(x, y, z)
Definition: compat.h:39
ULONG EVNTAPI EventRegister(_In_ LPCGUID ProviderId, _In_opt_ PENABLECALLBACK EnableCallback, _In_opt_ PVOID CallbackContext, _Out_ PREGHANDLE RegHandle)
FORCEINLINE PEVENT_DESCRIPTOR EventDescSetChannel(_In_ PEVENT_DESCRIPTOR EventDescriptor, _In_ UCHAR Channel)
Definition: evntprov.h:327
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
FORCEINLINE VOID EventDataDescCreate(_Out_ PEVENT_DATA_DESCRIPTOR EventDataDescriptor, _In_reads_bytes_(DataSize) const VOID *DataPtr, _In_ ULONG DataSize)
Definition: evntprov.h:180
FORCEINLINE PEVENT_DESCRIPTOR EventDescSetTask(_In_ PEVENT_DESCRIPTOR EventDescriptor, _In_ USHORT Task)
Definition: evntprov.h:297
#define _Inout_opt_
Definition: no_sal2.h:258