New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PE: Support multiple debug directories and VCFeature metadata #403
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems fine to me, other than the fixes w.r.t. &Vec<T>
-> &[T]
Ok(idd) | ||
let idd_list = (0..entries) | ||
.map(|i| { | ||
let entry = offset + i * core::mem::size_of::<ImageDebugDirectory>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice :)
@@ -127,60 +145,119 @@ pub struct CodeviewPDB70DebugInfo<'a> { | |||
} | |||
|
|||
impl<'a> CodeviewPDB70DebugInfo<'a> { | |||
pub fn parse(bytes: &'a [u8], idd: &ImageDebugDirectory) -> error::Result<Option<Self>> { | |||
pub fn parse(bytes: &'a [u8], idd: &Vec<ImageDebugDirectory>) -> error::Result<Option<Self>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should take a &[ImageDebugDirectory]
to be more idiomatic rust
Self::parse_with_opts(bytes, idd, &options::ParseOptions::default()) | ||
} | ||
|
||
pub fn parse_with_opts( | ||
bytes: &'a [u8], | ||
idd: &ImageDebugDirectory, | ||
idd: &Vec<ImageDebugDirectory>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto here
} | ||
|
||
impl<'a> VCFeatureInfo { | ||
pub fn parse(bytes: &'a [u8], idd: &Vec<ImageDebugDirectory>) -> error::Result<Option<Self>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto, &[IMageDebugDirectory]
|
||
pub fn parse_with_opts( | ||
bytes: &'a [u8], | ||
idd: &Vec<ImageDebugDirectory>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
pub struct DebugData<'a> { | ||
pub image_debug_directory: ImageDebugDirectory, | ||
pub image_debug_directories: Vec<ImageDebugDirectory>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know if there is a maximum image debug directories possible? if yes, perhaps we should make this an array and put it back to Copy
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the maximum entry is defined as 21.
https://github.com/winsiderss/systeminformer/blob/6f97511ad7bb0c8807d99a3151494f55d0e21fc8/phlib/include/mapimg.h#L714
This PR addresses the issue #314.
DebugData::image_debug_directory: ImageDebugDirectory
intoVec<ImageDebugDirectory>
as someone pointed out in the PE images with multiple debug directory entries not fully supported #314 (comment). So this is to be an breaking change.IMAGE_DEBUG_TYPE_VC_FEATURE
(IMAGE_DEBUG_VC_FEATURE_ENTRY
) in the debug directory.If anyone have suggestion of making this semantics without breaking the backward compatibility I am open to discuss.