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.
Syntax
PVOID WINAPI ImageRvaToVa(
__in PIMAGE_NT_HEADERS NtHeaders,
__in PVOID Base,
__in ULONG Rva,
__in_opt PIMAGE_SECTION_HEADER *LastRvaSection
);
Parameters
- NtHeaders [in]
-
A pointer to an
IMAGE_NT_HEADERS structure. This structure can be obtained by calling the
ImageNtHeader function.
- Base [in]
-
The base address of an image that is mapped into memory through a call to the
MapViewOfFile function.
- Rva [in]
-
The relative virtual address to be located.
- LastRvaSection [in, optional]
-
A pointer to an
IMAGE_SECTION_HEADER structure that specifies 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 Value
If the function succeeds, the return value is the virtual address in the mapped file.
If the function fails, 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.
All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function.
Requirements
| Redistributable | DbgHelp.dll 5.1 or later |
| Header | Dbghelp.h |
| Library | Dbghelp.lib |
| DLL | Dbghelp.dll |
See Also
DbgHelp Functions
IMAGE_NT_HEADERS
IMAGE_SECTION_HEADER
ImageNtHeader
MapViewOfFile
Send comments about this topic to Microsoft
Build date: 11/20/2008