]> git.proxmox.com Git - rustc.git/blame - vendor/windows/src/Windows/Win32/System/Diagnostics/Etw/impl.rs
New upstream version 1.70.0+dfsg1
[rustc.git] / vendor / windows / src / Windows / Win32 / System / Diagnostics / Etw / impl.rs
CommitLineData
353b0b11
FG
1#[doc = "*Required features: `\"Win32_System_Diagnostics_Etw\"`, `\"implement\"`*"]
2pub trait ITraceEvent_Impl: Sized {
3 fn Clone(&self) -> ::windows::core::Result<ITraceEvent>;
4 fn GetUserContext(&self) -> ::windows::core::Result<*mut ::core::ffi::c_void>;
5 fn GetEventRecord(&self) -> ::windows::core::Result<*mut EVENT_RECORD>;
6 fn SetPayload(&self, payload: *const u8, payloadsize: u32) -> ::windows::core::Result<()>;
7 fn SetEventDescriptor(&self, eventdescriptor: *const EVENT_DESCRIPTOR) -> ::windows::core::Result<()>;
8 fn SetProcessId(&self, processid: u32) -> ::windows::core::Result<()>;
9 fn SetProcessorIndex(&self, processorindex: u32) -> ::windows::core::Result<()>;
10 fn SetThreadId(&self, threadid: u32) -> ::windows::core::Result<()>;
11 fn SetThreadTimes(&self, kerneltime: u32, usertime: u32) -> ::windows::core::Result<()>;
12 fn SetActivityId(&self, activityid: *const ::windows::core::GUID) -> ::windows::core::Result<()>;
13 fn SetTimeStamp(&self, timestamp: *const i64) -> ::windows::core::Result<()>;
14 fn SetProviderId(&self, providerid: *const ::windows::core::GUID) -> ::windows::core::Result<()>;
15}
16impl ::windows::core::RuntimeName for ITraceEvent {}
17impl ITraceEvent_Vtbl {
18 pub const fn new<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>() -> ITraceEvent_Vtbl {
19 unsafe extern "system" fn Clone<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, newevent: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT {
20 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
21 let this = (*this).get_impl();
22 match this.Clone() {
23 ::core::result::Result::Ok(ok__) => {
24 ::core::ptr::write(newevent, ::core::mem::transmute(ok__));
25 ::windows::core::HRESULT(0)
26 }
27 ::core::result::Result::Err(err) => err.into(),
28 }
29 }
30 unsafe extern "system" fn GetUserContext<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, usercontext: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT {
31 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
32 let this = (*this).get_impl();
33 match this.GetUserContext() {
34 ::core::result::Result::Ok(ok__) => {
35 ::core::ptr::write(usercontext, ::core::mem::transmute(ok__));
36 ::windows::core::HRESULT(0)
37 }
38 ::core::result::Result::Err(err) => err.into(),
39 }
40 }
41 unsafe extern "system" fn GetEventRecord<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, eventrecord: *mut *mut EVENT_RECORD) -> ::windows::core::HRESULT {
42 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
43 let this = (*this).get_impl();
44 match this.GetEventRecord() {
45 ::core::result::Result::Ok(ok__) => {
46 ::core::ptr::write(eventrecord, ::core::mem::transmute(ok__));
47 ::windows::core::HRESULT(0)
48 }
49 ::core::result::Result::Err(err) => err.into(),
50 }
51 }
52 unsafe extern "system" fn SetPayload<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, payload: *const u8, payloadsize: u32) -> ::windows::core::HRESULT {
53 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
54 let this = (*this).get_impl();
55 this.SetPayload(::core::mem::transmute_copy(&payload), ::core::mem::transmute_copy(&payloadsize)).into()
56 }
57 unsafe extern "system" fn SetEventDescriptor<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, eventdescriptor: *const EVENT_DESCRIPTOR) -> ::windows::core::HRESULT {
58 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
59 let this = (*this).get_impl();
60 this.SetEventDescriptor(::core::mem::transmute_copy(&eventdescriptor)).into()
61 }
62 unsafe extern "system" fn SetProcessId<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, processid: u32) -> ::windows::core::HRESULT {
63 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
64 let this = (*this).get_impl();
65 this.SetProcessId(::core::mem::transmute_copy(&processid)).into()
66 }
67 unsafe extern "system" fn SetProcessorIndex<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, processorindex: u32) -> ::windows::core::HRESULT {
68 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
69 let this = (*this).get_impl();
70 this.SetProcessorIndex(::core::mem::transmute_copy(&processorindex)).into()
71 }
72 unsafe extern "system" fn SetThreadId<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, threadid: u32) -> ::windows::core::HRESULT {
73 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
74 let this = (*this).get_impl();
75 this.SetThreadId(::core::mem::transmute_copy(&threadid)).into()
76 }
77 unsafe extern "system" fn SetThreadTimes<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, kerneltime: u32, usertime: u32) -> ::windows::core::HRESULT {
78 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
79 let this = (*this).get_impl();
80 this.SetThreadTimes(::core::mem::transmute_copy(&kerneltime), ::core::mem::transmute_copy(&usertime)).into()
81 }
82 unsafe extern "system" fn SetActivityId<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, activityid: *const ::windows::core::GUID) -> ::windows::core::HRESULT {
83 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
84 let this = (*this).get_impl();
85 this.SetActivityId(::core::mem::transmute_copy(&activityid)).into()
86 }
87 unsafe extern "system" fn SetTimeStamp<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, timestamp: *const i64) -> ::windows::core::HRESULT {
88 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
89 let this = (*this).get_impl();
90 this.SetTimeStamp(::core::mem::transmute_copy(&timestamp)).into()
91 }
92 unsafe extern "system" fn SetProviderId<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEvent_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, providerid: *const ::windows::core::GUID) -> ::windows::core::HRESULT {
93 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
94 let this = (*this).get_impl();
95 this.SetProviderId(::core::mem::transmute_copy(&providerid)).into()
96 }
97 Self {
98 base__: ::windows::core::IUnknown_Vtbl::new::<Identity, OFFSET>(),
99 Clone: Clone::<Identity, Impl, OFFSET>,
100 GetUserContext: GetUserContext::<Identity, Impl, OFFSET>,
101 GetEventRecord: GetEventRecord::<Identity, Impl, OFFSET>,
102 SetPayload: SetPayload::<Identity, Impl, OFFSET>,
103 SetEventDescriptor: SetEventDescriptor::<Identity, Impl, OFFSET>,
104 SetProcessId: SetProcessId::<Identity, Impl, OFFSET>,
105 SetProcessorIndex: SetProcessorIndex::<Identity, Impl, OFFSET>,
106 SetThreadId: SetThreadId::<Identity, Impl, OFFSET>,
107 SetThreadTimes: SetThreadTimes::<Identity, Impl, OFFSET>,
108 SetActivityId: SetActivityId::<Identity, Impl, OFFSET>,
109 SetTimeStamp: SetTimeStamp::<Identity, Impl, OFFSET>,
110 SetProviderId: SetProviderId::<Identity, Impl, OFFSET>,
111 }
112 }
113 pub fn matches(iid: &windows::core::GUID) -> bool {
114 iid == &<ITraceEvent as ::windows::core::ComInterface>::IID
115 }
116}
117#[doc = "*Required features: `\"Win32_System_Diagnostics_Etw\"`, `\"implement\"`*"]
118pub trait ITraceEventCallback_Impl: Sized {
119 fn OnBeginProcessTrace(&self, headerevent: ::core::option::Option<&ITraceEvent>, relogger: ::core::option::Option<&ITraceRelogger>) -> ::windows::core::Result<()>;
120 fn OnFinalizeProcessTrace(&self, relogger: ::core::option::Option<&ITraceRelogger>) -> ::windows::core::Result<()>;
121 fn OnEvent(&self, event: ::core::option::Option<&ITraceEvent>, relogger: ::core::option::Option<&ITraceRelogger>) -> ::windows::core::Result<()>;
122}
123impl ::windows::core::RuntimeName for ITraceEventCallback {}
124impl ITraceEventCallback_Vtbl {
125 pub const fn new<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEventCallback_Impl, const OFFSET: isize>() -> ITraceEventCallback_Vtbl {
126 unsafe extern "system" fn OnBeginProcessTrace<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEventCallback_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, headerevent: *mut ::core::ffi::c_void, relogger: *mut ::core::ffi::c_void) -> ::windows::core::HRESULT {
127 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
128 let this = (*this).get_impl();
129 this.OnBeginProcessTrace(::windows::core::from_raw_borrowed(&headerevent), ::windows::core::from_raw_borrowed(&relogger)).into()
130 }
131 unsafe extern "system" fn OnFinalizeProcessTrace<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEventCallback_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, relogger: *mut ::core::ffi::c_void) -> ::windows::core::HRESULT {
132 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
133 let this = (*this).get_impl();
134 this.OnFinalizeProcessTrace(::windows::core::from_raw_borrowed(&relogger)).into()
135 }
136 unsafe extern "system" fn OnEvent<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceEventCallback_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, event: *mut ::core::ffi::c_void, relogger: *mut ::core::ffi::c_void) -> ::windows::core::HRESULT {
137 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
138 let this = (*this).get_impl();
139 this.OnEvent(::windows::core::from_raw_borrowed(&event), ::windows::core::from_raw_borrowed(&relogger)).into()
140 }
141 Self {
142 base__: ::windows::core::IUnknown_Vtbl::new::<Identity, OFFSET>(),
143 OnBeginProcessTrace: OnBeginProcessTrace::<Identity, Impl, OFFSET>,
144 OnFinalizeProcessTrace: OnFinalizeProcessTrace::<Identity, Impl, OFFSET>,
145 OnEvent: OnEvent::<Identity, Impl, OFFSET>,
146 }
147 }
148 pub fn matches(iid: &windows::core::GUID) -> bool {
149 iid == &<ITraceEventCallback as ::windows::core::ComInterface>::IID
150 }
151}
152#[doc = "*Required features: `\"Win32_System_Diagnostics_Etw\"`, `\"Win32_Foundation\"`, `\"implement\"`*"]
153#[cfg(feature = "Win32_Foundation")]
154pub trait ITraceRelogger_Impl: Sized {
155 fn AddLogfileTraceStream(&self, logfilename: &::windows::core::BSTR, usercontext: *const ::core::ffi::c_void) -> ::windows::core::Result<RELOGSTREAM_HANDLE>;
156 fn AddRealtimeTraceStream(&self, loggername: &::windows::core::BSTR, usercontext: *const ::core::ffi::c_void) -> ::windows::core::Result<RELOGSTREAM_HANDLE>;
157 fn RegisterCallback(&self, callback: ::core::option::Option<&ITraceEventCallback>) -> ::windows::core::Result<()>;
158 fn Inject(&self, event: ::core::option::Option<&ITraceEvent>) -> ::windows::core::Result<()>;
159 fn CreateEventInstance(&self, tracehandle: RELOGSTREAM_HANDLE, flags: u32) -> ::windows::core::Result<ITraceEvent>;
160 fn ProcessTrace(&self) -> ::windows::core::Result<()>;
161 fn SetOutputFilename(&self, logfilename: &::windows::core::BSTR) -> ::windows::core::Result<()>;
162 fn SetCompressionMode(&self, compressionmode: super::super::super::Foundation::BOOLEAN) -> ::windows::core::Result<()>;
163 fn Cancel(&self) -> ::windows::core::Result<()>;
164}
165#[cfg(feature = "Win32_Foundation")]
166impl ::windows::core::RuntimeName for ITraceRelogger {}
167#[cfg(feature = "Win32_Foundation")]
168impl ITraceRelogger_Vtbl {
169 pub const fn new<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceRelogger_Impl, const OFFSET: isize>() -> ITraceRelogger_Vtbl {
170 unsafe extern "system" fn AddLogfileTraceStream<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceRelogger_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, logfilename: ::std::mem::MaybeUninit<::windows::core::BSTR>, usercontext: *const ::core::ffi::c_void, tracehandle: *mut RELOGSTREAM_HANDLE) -> ::windows::core::HRESULT {
171 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
172 let this = (*this).get_impl();
173 match this.AddLogfileTraceStream(::core::mem::transmute(&logfilename), ::core::mem::transmute_copy(&usercontext)) {
174 ::core::result::Result::Ok(ok__) => {
175 ::core::ptr::write(tracehandle, ::core::mem::transmute(ok__));
176 ::windows::core::HRESULT(0)
177 }
178 ::core::result::Result::Err(err) => err.into(),
179 }
180 }
181 unsafe extern "system" fn AddRealtimeTraceStream<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceRelogger_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, loggername: ::std::mem::MaybeUninit<::windows::core::BSTR>, usercontext: *const ::core::ffi::c_void, tracehandle: *mut RELOGSTREAM_HANDLE) -> ::windows::core::HRESULT {
182 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
183 let this = (*this).get_impl();
184 match this.AddRealtimeTraceStream(::core::mem::transmute(&loggername), ::core::mem::transmute_copy(&usercontext)) {
185 ::core::result::Result::Ok(ok__) => {
186 ::core::ptr::write(tracehandle, ::core::mem::transmute(ok__));
187 ::windows::core::HRESULT(0)
188 }
189 ::core::result::Result::Err(err) => err.into(),
190 }
191 }
192 unsafe extern "system" fn RegisterCallback<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceRelogger_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, callback: *mut ::core::ffi::c_void) -> ::windows::core::HRESULT {
193 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
194 let this = (*this).get_impl();
195 this.RegisterCallback(::windows::core::from_raw_borrowed(&callback)).into()
196 }
197 unsafe extern "system" fn Inject<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceRelogger_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, event: *mut ::core::ffi::c_void) -> ::windows::core::HRESULT {
198 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
199 let this = (*this).get_impl();
200 this.Inject(::windows::core::from_raw_borrowed(&event)).into()
201 }
202 unsafe extern "system" fn CreateEventInstance<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceRelogger_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, tracehandle: RELOGSTREAM_HANDLE, flags: u32, event: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT {
203 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
204 let this = (*this).get_impl();
205 match this.CreateEventInstance(::core::mem::transmute_copy(&tracehandle), ::core::mem::transmute_copy(&flags)) {
206 ::core::result::Result::Ok(ok__) => {
207 ::core::ptr::write(event, ::core::mem::transmute(ok__));
208 ::windows::core::HRESULT(0)
209 }
210 ::core::result::Result::Err(err) => err.into(),
211 }
212 }
213 unsafe extern "system" fn ProcessTrace<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceRelogger_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void) -> ::windows::core::HRESULT {
214 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
215 let this = (*this).get_impl();
216 this.ProcessTrace().into()
217 }
218 unsafe extern "system" fn SetOutputFilename<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceRelogger_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, logfilename: ::std::mem::MaybeUninit<::windows::core::BSTR>) -> ::windows::core::HRESULT {
219 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
220 let this = (*this).get_impl();
221 this.SetOutputFilename(::core::mem::transmute(&logfilename)).into()
222 }
223 unsafe extern "system" fn SetCompressionMode<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceRelogger_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void, compressionmode: super::super::super::Foundation::BOOLEAN) -> ::windows::core::HRESULT {
224 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
225 let this = (*this).get_impl();
226 this.SetCompressionMode(::core::mem::transmute_copy(&compressionmode)).into()
227 }
228 unsafe extern "system" fn Cancel<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: ITraceRelogger_Impl, const OFFSET: isize>(this: *mut ::core::ffi::c_void) -> ::windows::core::HRESULT {
229 let this = (this as *const *const ()).offset(OFFSET) as *const Identity;
230 let this = (*this).get_impl();
231 this.Cancel().into()
232 }
233 Self {
234 base__: ::windows::core::IUnknown_Vtbl::new::<Identity, OFFSET>(),
235 AddLogfileTraceStream: AddLogfileTraceStream::<Identity, Impl, OFFSET>,
236 AddRealtimeTraceStream: AddRealtimeTraceStream::<Identity, Impl, OFFSET>,
237 RegisterCallback: RegisterCallback::<Identity, Impl, OFFSET>,
238 Inject: Inject::<Identity, Impl, OFFSET>,
239 CreateEventInstance: CreateEventInstance::<Identity, Impl, OFFSET>,
240 ProcessTrace: ProcessTrace::<Identity, Impl, OFFSET>,
241 SetOutputFilename: SetOutputFilename::<Identity, Impl, OFFSET>,
242 SetCompressionMode: SetCompressionMode::<Identity, Impl, OFFSET>,
243 Cancel: Cancel::<Identity, Impl, OFFSET>,
244 }
245 }
246 pub fn matches(iid: &windows::core::GUID) -> bool {
247 iid == &<ITraceRelogger as ::windows::core::ComInterface>::IID
248 }
249}