5 PIMAGE_SECTION_HEADER
GetSection(LOADED_IMAGE Image
, DWORD RVA
)
8 PIMAGE_SECTION_HEADER pSection
;
10 for (i
= 0, pSection
= Image
.Sections
; i
< Image
.NumberOfSections
; i
++, pSection
++)
12 if (RVA
>= pSection
->VirtualAddress
&&
13 RVA
< pSection
->VirtualAddress
+ pSection
->Misc
.VirtualSize
)
21 BYTE
*GetAddressFromRVA(LOADED_IMAGE Image
, DWORD RVA
)
24 PIMAGE_SECTION_HEADER pSection
;
26 if (!(pSection
= GetSection(Image
, RVA
))) return NULL
;
27 delta
= (int)(pSection
->VirtualAddress
- pSection
->PointerToRawData
);
28 return (BYTE
*)Image
.MappedAddress
+ RVA
- delta
;