How can we discover the location of an embedded resource within a .Net assembly? By “location”, I mean the beginning and ending byte positions in the assembly. Is there any tool or some sample code to achieve this?
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What your looking for is a PE File reader/parser. The complete specification is located on msdn: http://msdn.microsoft.com/en-us/windows/hardware/gg463119
Managed Resources:
This parser looks pretty close to what you are after: http://www.codeproject.com/KB/dotnet/asmex.aspx
And there are several other PE file readers, this one also looks promising however does not specifically call out managed resources. You might also look at Kris Stanton’s Exploring pe file headers using managed code.
Win32 Resources:
Win32 resources are much easier. Many of the same PE readers will offset into the file to locate the resources. Once there, there is a well defined set of structures that define the layout of the resources. MSDN has defined these, and others have written about it. A few google searches should get you there.