Skip to content

Conversation

@kkent030315
Copy link
Contributor

@kkent030315 kkent030315 commented Oct 31, 2024

Added resource parser implementation as proposed in the issue but with also manifests and fixed version info.

  • Added parser for resource entries
  • Added parser for RT_VERSION
  • Added parser for RT_MANIFEST
  • Added integration tests for the parsers

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.

this is a huge PR! Thank you for adding this though.

Some general feedback:

  1. There is a lot of new pub fields, pub structs and pub functions
    a. I believe i've mentioned in past, but to reiterate: goblin is very conservative with pub, can consider it in your mind as basically 1.0, but occasionally letting through breaking changes; with that in mind, it's important to ask yourself/ourselves whether:

    i. will the new pub structs/enums, etc., have new fields, either by addition by the binary stakeholders (microsoft, linux (i guess?), apple), or by some current oversight; if yes, or likely to have new fields added, either needs to be marked `#[non_exhaustive]`, or a field hidden so that it isn't constructible, and so adding a new field is legal. the owners of the format adding new fields is unlikely, but it has happened during the existence of this crate (e.g., apple adding new binary variants, new `LC_COMMANDS`, etc.)
    ii. do you _really_ need a field `pub`? similarly with a function; if yes, that's fine, but if any doubt, start with private/`pub(crate)` and we can make it pub later if needed; once it's pub it generally can't go back.
    
  2. I haven't investigate in detail, but I assume a lot of the offset math is checked/etc., before doing any kind of unprotected/panicable &[offset..foo]; from what I've seen it all looks good, just want to double check, and I know you've fixed that in the past, so i suspect you already know this one.

  3. be aware of allocations, etc., especially temporary ones, and as i mentioned, probably need to make a decision for the utf16 strings, as I mentioned in some comments.

Anyway, this is great work, other than some fairly minor nits, this looks pretty good to go, but just wanted to get some of the pub fields that don't need to be pub fixed, and etc.

Thank you for your patience and this amazing work!

@kkent030315

This comment was marked as resolved.

@m4b
Copy link
Owner

m4b commented Jan 5, 2025

is this in a reviewable state ? i can't remember where we left off exactly, a lot of PRs lately :)

kkent030315 added a commit to kkent030315/goblin-experimental that referenced this pull request Mar 26, 2025
@m4b
Copy link
Owner

m4b commented Jun 16, 2025

friendly ping on state of this :)

@kkent030315
Copy link
Contributor Author

@m4b Since it's almost half a year ago, it would be nice to get re-review. Thank you!

@m4b
Copy link
Owner

m4b commented Jul 7, 2025

looks like CI is failing; rebase?

@m4b
Copy link
Owner

m4b commented Jul 7, 2025

i will make it priority to review this and get this in once CI passing; i appreciate your patience! please feel free to aggressively ping me if i do not respond :)

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.

once the utf16 string stuff is fixed, i think it will be ready to merge, after CI passes, etc. thank you for your patience and great work!

@kkent030315
Copy link
Contributor Author

@m4b Thank you so much for your review.. it's being >2,000 lines of code. Everything you've concerned should be addressed now. Did double check on my end as well.

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.

Sorry I'd really like to keep Utf16String non-pub for now if we can help it, as this is already adding a ton of new public datatypes. After this, I think we are safe to merge this; thank you for your patience!

error::Error::Malformed(format!("Cannot map RT_VERSION at {offset:#x}"))
})?;
let iterator = ResourceStringIterator { data };
let strings = iterator.collect::<Result<Vec<_>, _>>()?;
Copy link
Owner

Choose a reason for hiding this comment

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

perf: i'm not sure you have to allocate here if you just use it to generate fixed_info?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately yes, we need it to find a VS_VERSION_INFO entry.

@kkent030315
Copy link
Contributor Author

@m4b Sorry on a bit delay, I addresses the rest and would like to get the feedback :)

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 for your patience; the Utf16String is still pub, I think you forgot to add that after marking key pub, but otherwise this is ready to go, thanks for your patience! If you're too busy I can merge and fix it myself since it's very minor, but I'd prefer if possible to have it all in one patch. thank you again for your work on this!

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.

Huzzah! Thank you for all your patience ! Great stuff !

@m4b m4b merged commit cfe9c26 into m4b:master Jul 26, 2025
5 checks passed
@m4b
Copy link
Owner

m4b commented Jul 26, 2025

NB: backwards compatible

@kkent030315 kkent030315 deleted the rsrcversioninfo branch August 16, 2025 08:34
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.

2 participants