Use types from windows-sys#273
Conversation
| "sha1", | ||
| "tracing", | ||
| "twox-hash", | ||
| "windows-sys", |
There was a problem hiding this comment.
@brianrob, do we need to list this in third parties md? Not sure if this is technically 3rd party or not.
beaubelgrave
left a comment
There was a problem hiding this comment.
Approved, looks good, thanks for doing this! We may require a follow up item on the third party tracking of windows-sys if it's technically 3rd party.
|
Windows-sys uses MIT license, we should go ahead and add it to our THIRD-PARTY-NOTICES.md before merging. If you update this PR with that fix, I'll go ahead and approve again and merge. @utpilla. |
I have updated Reference: https://github.com/microsoft/windows-rs/blob/master/license-mit |
Changes
Replaces four hand-rolled ETW types that surface (or will surface) on the crate's public API with re-exports from
windows-sys:EVENT_RECORDEVENT_HEADEREVENT_HEADER_EXTENDED_DATA_ITEMEVENT_DESCRIPTORWhy
Precursor to the TDH decoder work tracked in #270. That decoder will take a
&EVENT_RECORDfromAncillaryData::record()and hand it to a TDH-based decode call. Sourcing the public types fromwindows-sysgives us a single type identity end to end and shrinks theone_collectcrate's public API surface.This was the open question I raised on #270, and this PR is following Option B mentioned in the issue.
Scope
Deliberately constrained to only the four public types. The rest of
etw/abi.rsstays hand-rolled:extern "system"blocks (StartTraceW,ControlTraceW,EnableTraceEx2,OpenTraceW,ProcessTrace,CloseTrace,TraceQueryInformation,TraceSetInformation, plus the privilege helpers andGetActiveProcessorCount).EVENT_TRACE_PROPERTIES,WNODE_HEADER,ENABLE_TRACE_PARAMETERS,EVENT_FILTER_DESCRIPTOR,EVENT_TRACE_LOGFILE,TRACE_LOGFILE_HEADER,EVENT_TRACE,EVENT_TRACE_HEADER,TRACE_PROFILE_INTERVAL,TOKEN_PRIVILEGES,EVENT_FILTER_LEVEL_KW,CLASSIC_EVENT_ID).TRACE_LEVEL_*/EVENT_CONTROL_CODE_*/EVENT_HEADER_EXT_TYPE_*/EVENT_ENABLE_PROPERTY_*constants.TraceSession,TraceEnable,TraceFilter,flush_trace,wide_string.A full migration of the FFI is a fair follow-up but out of scope here to keep this PR focused on the bare-minimum change the TDH work needs.
Safety
The trait impl contains three
unsafeoperations, each backed by aconst _: () = assert!(...)guard above the impl block so futurewindows-syslayout drift fails the build instead of producing wrong bytes silently:provider_guid/activity_guidtransmutewindows_sys::core::GUID→ ourGuid. Guarded bysize_of+align_ofequality asserts.processor_indexreadsu16out of a union arm. Guarded by an assertedsize_of == 2and analign_of >= align_of::<u16>()onETW_BUFFER_CONTEXT_0.Follow-ups (not in this PR)
etw/abi.rs's FFI towindows-sysin a focused later PR if we ever want to retire the hand-rolled extern blocks.