Relative Virtual Addressing Explaine d:

Một phần của tài liệu tìm hiểu, phân tích virus (Trang 71)

Trong m t file th c thi hay m t file DLL, thì RVA luôn luôn là a ch c a m t item khi c n p vào

trong b nh , v i base address (ImageBase) c a imaging file c tr i : RVA = VA ImageBase do dó VA = RVA + ImageBase.

It's exactly the same thing as file offset but it's relative to a point in virtual address space, not the beginning of the PE file.

Ví d :N u m t PE file n p t i a ch 400000h trong virtual address (VA) space và ch ng trình b t u th c thi t i virtual address 401000h, chúng ta có th nói r ng ch ng trình b t u th c thi t i RVA 1000h. An VA is relative to the starting VA of the module. The RVA of an item will almost always differ from its position within the file on disk - the offset. This is a pitfall for newcomers to PE programming.

Most of the addresses in the PE file are RVAs and are meaningful only when the PE file is loaded into memory by the PE loader

Thu t ng "Virtual Address" c s d ngb i vì Windows t o ra m t không gian a ch o riêng bi t cho m i process, không l thu c vào physical memory. Cho h u h t t t c các m c ích , m t virtual address c xem xét ch là m t address. Nh nói trên, m t virtual address là không th d oán tr c

c nh m t RVA, b i vì trình loader không th load the image at its preferred base address.

T i sao PE file format l i s d ng RVA? ó là làm gi m b t quá trình n p c a trình loader. ó là b i vì n um t module có th c relocated b t kì v trí nào trong không gian a ch o , nó s gây tr ng i cho trình loader fix m i hardcoded address trong module. Nh ng ng c l i , n u t t c relocatable items trong file use RVA, there is no need for the loader to fix anything: nó ch n gi n relocates toàn b moduel t im t new starting VA.

Một phần của tài liệu tìm hiểu, phân tích virus (Trang 71)