ImageRvaToVa

The ImageRvaToVa function locates a Relative Virtual Address (RVA) within the image header of a file that is mapped as a file and returns the virtual address of the corresponding byte in the file.

LPVOID ImageRvaToVa(

IN PIMAGE_NT_HEADERS NtHeaders,  
IN LPVOID Base,  
IN DWORD Rva,  
IN OUT PIMAGE_SECTION_HEADER *LastRvaSection  
);  

Parameters

NtHeaders

A pointer to an IMAGE_NT_HEADERS structure. This can be obtained by calling the ImageNtHeader function.

Base

The base address of an image that is mapped into memory through a call to MapViewOfFile.

Rva

The relative virtual address to locate.

LastRvaSection

The last RVA section. This is an optional parameter. When specified, it points to a variable that contains the last section value used for the specified image to translate an RVA to a VA.

Return Values

If the function succeeds, the return value is the virtual address in the mapped file.

If the function fails, then the return value is NULL. To retrieve extended error information, call GetLastError.

Remarks

The ImageRvaToVa function locates an RVA within the image header of a file that is mapped as a file and returns the virtual address of the corresponding byte in the file.