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

add support for obj, dll, and coff object file formats #36

Merged
merged 4 commits into from
Mar 13, 2021
Merged

Conversation

bojand
Copy link
Owner

@bojand bojand commented Mar 5, 2021

Fixes #33.

  • exe and dll have the same magic number
  • There are 3 variants of Common Object File Format, for i386, x64, and ia64 architectures. A function was added for each one.

@bojand bojand changed the title add sspport for obj, dll, and coff object file formats add support for obj, dll, and coff object file formats Mar 5, 2021
Comment on lines +109 to +122
/// Returns whether a buffer is a Common Object File Format for i386 architecture.
pub fn is_coff_i386(buf: &[u8]) -> bool {
buf.len() > 2 && buf[0] == 0x4C && buf[1] == 0x01
}

/// Returns whether a buffer is a Common Object File Format for x64 architecture.
pub fn is_coff_x64(buf: &[u8]) -> bool {
buf.len() > 2 && buf[0] == 0x64 && buf[1] == 0x86
}

/// Returns whether a buffer is a Common Object File Format for Itanium architecture.
pub fn is_coff_ia64(buf: &[u8]) -> bool {
buf.len() > 2 && buf[0] == 0x00 && buf[1] == 0x02
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should also have a generic is_coff function, and register that as a matcher instead of all of the specific ones

Comment on lines 35 to 39
/// Returns whether a buffer is a DLL.
pub fn is_dll(buf: &[u8]) -> bool {
is_exe(buf)
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

The fact that we can't distinguish between dll and exe should also be documented here.

@bojand bojand merged commit 86a08ae into master Mar 13, 2021
@bojand bojand deleted the msi_dll_coff branch March 13, 2021 18:24
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.

Feature request: Add support for obj, dll, msi
2 participants