5

C/C++ has the set of predefined structures and constants corresponding to an exe-header and so on. Do exist some analogical standard namespaces, classes in C# special for analyzing of portable executable files? Or is it only a prerogative of unmanaged unsafe more native languages?

7
  • C# is perfectly capable of reading binary files. Nothing at all to stop you doing this. Commented Oct 1, 2013 at 11:00
  • 2
    David, it's exactly what I did before, but I think maybe I try to reinvent the wheel. Commented Oct 1, 2013 at 11:09
  • Well, you could always try a websearch. Commented Oct 1, 2013 at 11:12
  • 2
    Of course, I did, but could not find the answer. Commented Oct 1, 2013 at 11:17
  • 1
    Google. Oh, really "C# pe file" works, it seems I use too specific request form. I think it's not a reason to remove the question, isn't it? Maybe it can be userful for people having the same mindset. Commented Oct 1, 2013 at 12:17

3 Answers 3

9

There exists an managed library called PeNet which is available as open source and as a NuGet package, too. You can access and change nearly all structures in the PE header with this library. PeNet GitHub

Disclaimer: I'm the main author of the library

Sign up to request clarification or add additional context in comments.

Comments

4

There's not much built-in to the language (if anything), but there's lots of examples out there, such as

1 Comment

Both of these links are dead
0

An interesting library which is published for a number of languages including c#:

https://formats.kaitai.io/microsoft_pe/csharp.html

It uses another Kaitai's class named "Kaitai Struct", which is another interesting and more general class for reading binary files.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.