Debian Codegraph @

src/gallium/frontends/mediafoundation/wppconfig/rev1/km-storheader.tpl

raw
1 `**********************************************************************`
2 `* This is an include template file for the tracewpp preprocessor. *`
3 `* *`
4 `* Copyright (c) Microsoft Corporation. All rights reserved. *`
5 `**********************************************************************`
6 // template `TemplateFile`
7
8 #ifdef WPP_THIS_FILE
9 // included twice
10 # define WPP_ALREADY_INCLUDED
11 # undef WPP_THIS_FILE
12 #endif // #ifdef WPP_THIS_FILE
13
14 #define WPP_THIS_FILE `SourceFile.CanonicalName`
15
16 #ifndef WPP_ALREADY_INCLUDED
17
18 `* Dump the definitions specified via -D on the command line to WPP *`
19 `FORALL def IN MacroDefinitions`
20 #define `def.Name` `def.Alias`
21 `ENDFOR`
22
23 #include <stortrce.h>
24 #include <stddef.h>
25 #include <stdarg.h>
26 #include <wmistr.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #if !defined(_NTRTL_)
33 #if !defined(_NTHAL_)
34 // fake RTL_TIME_ZONE_INFORMATION //
35 typedef int RTL_TIME_ZONE_INFORMATION;
36 #endif
37 #define _WMIKM_
38 #endif
39
40 #ifndef WPP_TRACE
41 #define WPP_TRACE StorWmiTraceMessage
42 #endif
43
44 #if ENABLE_WPP_RECORDER
45 #error ENABLE_WPP_RECORDER not supported by km-StorDefault.tpl
46 #endif
47
48 ///////////////////////////////////////////////////////////////////////////////
49 //
50 // B O R R O W E D D E F I N I T I O N S
51 //
52 ///////////////////////////////////////////////////////////////////////////////
53
54 #if !defined(_NTDEF_)
55 typedef struct _UNICODE_STRING {
56 USHORT Length;
57 USHORT MaximumLength;
58 PWSTR Buffer;
59 } UNICODE_STRING;
60 typedef UNICODE_STRING *PUNICODE_STRING;
61 typedef const UNICODE_STRING *PCUNICODE_STRING;
62 #endif
63
64 #define TRACE_MESSAGE_SEQUENCE 1 // Message should include a sequence number
65 #define TRACE_MESSAGE_GUID 2 // Message includes a GUID
66 #define TRACE_MESSAGE_COMPONENTID 4 // Message has no GUID, Component ID instead
67 #define TRACE_MESSAGE_TIMESTAMP 8 // Message includes a timestamp
68 #define TRACE_MESSAGE_PERFORMANCE_TIMESTAMP 16 // *Obsolete* Clock type is controlled by
69 // the logger
70 #define TRACE_MESSAGE_SYSTEMINFO 32 // Message includes system information TID,PID
71 #define TRACE_MESSAGE_FLAG_MASK 0xFFFF // Only the lower 16 bits of flags are
72 // placed in the message those above 16
73 // bits are reserved for local processing
74 #ifndef TRACE_MESSAGE_MAXIMUM_SIZE
75 #define TRACE_MESSAGE_MAXIMUM_SIZE 8*1024 // the maximum size allowed for a single trace
76 #endif // message
77
78 #ifndef NTSTATUS
79 typedef LONG NTSTATUS;
80 #endif
81
82 #ifndef NT_SUCCESS
83 #define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
84 #endif
85
86 #define STATUS_SUCCESS ((NTSTATUS)0x00000000L) // ntsubauth
87 #define STATUS_WMI_GUID_NOT_FOUND ((NTSTATUS)0xC0000295L)
88 #define STATUS_BUFFER_TOO_SMALL ((NTSTATUS)0xC0000023L)
89 #define STATUS_INVALID_PARAMETER ((NTSTATUS)0xC000000DL)
90 #define STATUS_INVALID_DEVICE_REQUEST ((NTSTATUS)0xC0000010L)
91
92 typedef ULONG64 TRACEHANDLE, *PTRACEHANDLE;
93
94 #ifndef TRACE_INFORMATION_CLASS_DEFINE
95 typedef enum _TRACE_INFORMATION_CLASS {
96 TraceIdClass,
97 TraceHandleClass,
98 TraceEnableFlagsClass,
99 TraceEnableLevelClass,
100 GlobalLoggerHandleClass,
101 EventLoggerHandleClass,
102 AllLoggerHandlesClass,
103 TraceHandleByNameClass
104 } TRACE_INFORMATION_CLASS;
105 #endif
106
107 //
108 // Action code for IoWMIRegistrationControl api
109 //
110
111 #define WMIREG_ACTION_REGISTER 1
112 #define WMIREG_ACTION_DEREGISTER 2
113 #define WMIREG_ACTION_REREGISTER 3
114 #define WMIREG_ACTION_UPDATE_GUIDS 4
115 #define WMIREG_ACTION_BLOCK_IRPS 5
116
117 ///////////////////////////////////////////////////////////////////////////////
118
119 __inline ULONG64 WppQueryLogger(_In_opt_ PCWSTR LoggerName)
120 {
121 ULONG ReturnLength;
122 LONG Status;
123 ULONG64 TraceHandle;
124 UNICODE_STRING Buffer;
125
126 StorRtlInitUnicodeString(&Buffer, LoggerName ? LoggerName : L"stdout");
127
128 Status = StorWmiQueryTraceInformation(TraceHandleByNameClass,
129 (PVOID)&TraceHandle,
130 sizeof(TraceHandle),
131 &ReturnLength,
132 (PVOID)&Buffer
133 );
134 if (Status != STATUS_SUCCESS) {
135 return (ULONG64)0;
136 }
137
138 return TraceHandle;
139 }
140
141 typedef LONG (*WMIENTRY_NEW)(
142 _In_ UCHAR MinorFunction,
143 _In_opt_ PVOID DataPath,
144 _In_ ULONG BufferLength,
145 _Inout_updates_bytes_(BufferLength) PVOID Buffer,
146 _In_ PVOID Context,
147 _Out_ PULONG Size
148 );
149
150 typedef struct _WPP_TRACE_CONTROL_BLOCK
151 {
152 WMIENTRY_NEW Callback;
153 LPCGUID ControlGuid;
154 struct _WPP_TRACE_CONTROL_BLOCK *Next;
155 __int64 Logger;
156 PUNICODE_STRING RegistryPath;
157 UCHAR FlagsLen;
158 UCHAR Level;
159 USHORT Reserved;
160 ULONG Flags[1];
161 ULONG ReservedFlags;
162 } WPP_TRACE_CONTROL_BLOCK, *PWPP_TRACE_CONTROL_BLOCK;
163
164 VOID WppCleanupKm(_In_ PVOID TraceContext);
165
166 #define WPP_CLEANUP(DriverObject, TraceContext) WppCleanupKm(TraceContext)
167
168 //
169 // Callback routine to be defined by the driver, which will be called from WPP callback
170 // WPP will pass current valued of : GUID, Logger, Enable, Flags, and Level
171 //
172 // To activate driver must define WPP_PRIVATE_ENABLE_CALLBACK in their code, sample below
173 // #define WPP_PRIVATE_ENABLE_CALLBACK MyPrivateCallback;
174 //
175 typedef
176 VOID
177 (*PFN_WPP_PRIVATE_ENABLE_CALLBACK)(
178 _In_ LPCGUID Guid,
179 _In_ __int64 Logger,
180 _In_ BOOLEAN Enable,
181 _In_ ULONG Flags,
182 _In_ UCHAR Level);
183
184 #ifdef __cplusplus
185 } // extern "C"
186 #endif
187
188 #endif // #ifndef WPP_ALREADY_INCLUDED