Skip to content

How do I embed a .res file into a PE file? #105271

Answered by MichalStrehovsky
jgh07 asked this question in Q&A
Discussion options

You must be logged in to vote

RES file format and contents of the .rsrc section are similar, but subtly different. https://github.com/dotnet/corert/blob/master/src/ILCompiler.Build.Tasks/src/DumpNativeResources.cs is a sample converter from .rsrc section to a res file. You'll need to do this in the opposite direction.

When doing the conversion, you'll see that the data structures within the rsrc section refer to offsets from the beginning of the file (not from the beginning of the section). The SectionLocation argument that gets passed to your Serialize override should come handy for that since it tells where in the file rsrc section is getting placed.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@jgh07
Comment options

Comment options

You must be logged in to vote
1 reply
@jgh07
Comment options

Answer selected by jgh07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants