Search code examples
c#portable-executableentry-point

Reading PE files EntryPointAdress using c#


Is there a good way to read PE files entrypoint? I found some codes in the following line http://code.cheesydesign.com/?p=572

My code is:

PeHeaderReader reader = new PeHeaderReader("c:\\testfile.exe");
if (reader.Is32BitHeader)
{
   long EntryPoint = reader.OptionalHeader32.AddressOfEntryPoint;
}

The problem is the entrypoint is not accurate?


Solution

  • I Solved the probelm by converting the EntryPoint(RVA) to FileOffest . Thanks