简体   繁体   English

程序集中的嵌入式资源位置

[英]Embedded Resource location within the assembly

How can we discover the location of an embedded resource within a.Net assembly?我们如何在.Net 程序集中发现嵌入资源的位置? 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.提前致谢。

What your looking for is a PE File reader/parser.您正在寻找的是PE 文件阅读器/解析器。 The complete specification is located on msdn: http://msdn.microsoft.com/en-us/windows/hardware/gg463119完整的规范位于 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这个解析器看起来非常接近你所追求的: 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.还有其他几个 PE 文件阅读器,这个看起来也很有前途,但没有专门调用托管资源。 You might also look at Kris Stanton's Exploring pe file headers using managed code .您还可以查看 Kris Stanton 的Exploring pe file headers using managed code

Win32 Resources: Win32 资源:

Win32 resources are much easier. Win32 资源要容易得多。 Many of the same PE readers will offset into the file to locate the resources.许多相同的PE阅读器将偏移到文件中以定位资源。 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 . MSDN 已经定义了这些其他人也写过 A few google searches should get you there.一些谷歌搜索应该可以让你到达那里。

You can do trial and error.您可以反复试验。 Check the byte structure of resource which you know is embedded and try to locate the same using Hex Editor.检查您知道嵌入的资源的字节结构,并尝试使用十六进制编辑器找到相同的位置。 If you don't have the resource, you may try extracting using Resource Hacker: http://www.angusj.com/resourcehacker/如果您没有资源,您可以尝试使用 Resource Hacker 进行提取: http://www.angusj.com/resourcehacker/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM