File tree Expand file tree Collapse file tree
crates/fspy_preload_windows/src/windows/detours Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,14 +130,12 @@ unsafe fn read_process_image_attribute<'a>(
130130 let attribute_count =
131131 ( attribute_list. TotalLength - attributes_offset) / size_of :: < PS_ATTRIBUTE > ( ) ;
132132
133- // SAFETY: TotalLength covers a contiguous variable-length tail by API contract; addr_of avoids
134- // first creating a reference to the one-element placeholder array in the Rust definition.
135- let attributes: & [ PS_ATTRIBUTE ] = unsafe {
136- std:: slice:: from_raw_parts (
137- std:: ptr:: addr_of!( attribute_list. Attributes ) . cast ( ) ,
138- attribute_count,
139- )
140- } ;
133+ // The Rust field exposes the first placeholder entry as a reference; TotalLength describes how
134+ // many contiguous entries follow it in the actual variable-length allocation.
135+ let first_attribute = attribute_list. Attributes . first ( ) ?;
136+ // SAFETY: TotalLength covers a contiguous variable-length tail starting at first_attribute.
137+ let attributes: & [ PS_ATTRIBUTE ] =
138+ unsafe { std:: slice:: from_raw_parts ( std:: ptr:: from_ref ( first_attribute) , attribute_count) } ;
141139 for attribute in attributes {
142140 if attribute. Attribute != PS_ATTRIBUTE_IMAGE_NAME {
143141 continue ;
You can’t perform that action at this time.
0 commit comments