How to determine file offset of each section using RVA in pe file ?
-
How to determine file offset of each section using RVA in pe file ?
-
How to determine file offset of each section using RVA in pe file ?
Quote from Visual Studio, Microsoft Portable Executable and Common Object File Format Specification
RVA Relative virtual address. In an image file, the address of an item after it is loaded into memory, with the base address of the image file subtracted from it. The RVA of an item almost always differs from its position within the file on disk (file pointer). In an object file, an RVA is less meaningful because memory locations are not assigned. In this case, an RVA would be an address within a section (described later in this table), to which a relocation is later applied during linking. For simplicity, a compiler should just set the first RVA in each section to zero.
-
How to determine file offset of each section using RVA in pe file ?
I recommend that you read the many books written by Matt Pietreck on the subject. Even books about Win98 or XP will do. They are Classics, but, explain the lot, in your case in particular, how executable files are mapped to memory. I think that this forms part of the foundation every software engineer should have at his finger tips. Matt wrote several books about spelunking in the bowels of the various windows versions. However User Beware! If you are just interested in how your windows version on your computer does things, read, spelunk, and learn! If you start writing software on the basis of what you learn there, BEWARE! It will work, without doubt on Your computer(where you did the Spelunking!) There is absolutely no guarantee that it will work on any other computer, nor, that it will work after the next windows update! Microsoft provides a large API (Application Program Interface), which Microsoft guarantees to support over the various upgrades. Doing things outside this interface, will sooner or later lead to disaster. Regards, :)
Bram van Kampen