Skip to content
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

Nearly fully documented the optional PE header. #399

Merged
merged 7 commits into from Mar 18, 2024

Conversation

JohnScience
Copy link
Contributor

@JohnScience JohnScience commented Mar 14, 2024

There's still some work needed for documentation of data directories field in the optional header but it's a separate module.

This PR also...

  • introduces two new modules for constants that are used in the optional header (dll_characteristic and subsystem).
  • further refines the documentation of the COFF header module.

@JohnScience
Copy link
Contributor Author

@m4b

Copy link
Owner

@m4b m4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be honest this is quite a lot of documentation to review, though not a bad thing, thank you for the PR! What a strange world we're entering with gen ai though :)

my only major concerns are about the various doc aliases, they appear to alias things that don't exist, and i think that should be fixed before merging

src/pe/header.rs Show resolved Hide resolved
pub characteristics: u16,
}

pub const SIZEOF_COFF_HEADER: usize = 20;
/// PE\0\0, little endian
pub const PE_MAGIC: u32 = 0x0000_4550;
pub const SIZEOF_PE_MAGIC: usize = 4;
/// The contents of this field are assumed to be applicable to any machine type

// Q (JohnScience): doesn't it make sense to move all these constants to a dedicated module
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly, yes; it's what we do for other formats iirc

// Q (JohnScience): doesn't it make sense to move all these constants to a dedicated module
// and then re-export them from here? This way, the module will be more organized.
//
// Also, don't we want to declare them in a macro to remove the boilerplate and make the implementation
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file a issue if you feel theres room for improvement :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m4b I will do so and leave a TODO item with the explanation.

#[derive(Debug, PartialEq, Copy, Clone, Default)]
pub struct Header {
pub dos_header: DosHeader,
/// DOS program for legacy loaders
pub dos_stub: DosStub,

// Q (JohnScience): should we care about the "rich header"?
// https://0xrick.github.io/win-internals/pe3/#rich-header
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be a good thing if it is real and people use it for stuff 🤷

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohnScience would you mind filing an issue for the rich header?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m4b It is mostly useful for cybersecurity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohnScience would you mind filing an issue for the rich header?

Done, #400

src/pe/optional_header.rs Show resolved Hide resolved
Copy link
Owner

@m4b m4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@m4b m4b merged commit ff22089 into m4b:master Mar 18, 2024
6 checks passed
@m4b
Copy link
Owner

m4b commented Mar 18, 2024

release: non-breaking

@JohnScience
Copy link
Contributor Author

to be honest this is quite a lot of documentation to review, though not a bad thing, thank you for the PR! What a strange world we're entering with gen ai though :)

my only major concerns are about the various doc aliases, they appear to alias things that don't exist, and i think that should be fixed before merging

Doc aliases improve the searchability of various items by allowing users finding them by their Windows name. See Rustdoc > Advanced features > Add aliases for an item in documentation search

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants