Va&rva and RVA to RAW

Source: Internet
Author: User

Va&rva

VA refers to the absolute address of the virtual memory of the process, the RVA (Relative virtual address, relative virtual addresses) refers to the relative address starting at a base location (ImageBase). VA and RVA meet the conversion relationship below.

RVA + ImageBase = VA

The head information of PE (portable executable) mostly exists in RVA form. The reason is that, when the PE file (primarily a DLL) is loaded into a specific location of process virtual memory, the location may have loaded other PE files (dll,dynamic Linked Library). It must be loaded into other blank locations by repositioning (relocation), which will not be accessible if the PE header information is using Va. Therefore, using RVA to locate information, even if a relocation occurs, as long as the relative address relative to the base location does not change, you can access the specified information normally, no problem occurs.

Tips:

In a 32-bit widows OS, each process is allocated 4GB of virtual memory, so the range of VA values in the process is 0000 0000 ~ FFFF FFFF.

RVA to RAW

When the PE file is loaded into memory, the mapping between the memory address and the file offset can be accurately completed for each section area. This mapping is generally called RVA to RAW, as follows:

  1. Find the section area of the RVA.
  2. Calculates the file offset (RVA) using a simple formula.

According to the Image_section_header structure, the conversion formula is as follows:

Raw-pointertorawdata = rva-virtualaddress

In turn, you get:

RAW = rva-virtualaddress + pointertorawdata

Preference

Reverse engineering Core principle \ (p_{92}\) \ (p_{104}\)

This post understands RVA, VA, RAW, offset

Va&rva and RVA to RAW

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.