ImageRvaToSection

The ImageRvaToSection function locates a relative virtual address (RVA) within the image header of a file that is mapped as a file and returns a pointer to the section table entry for that virtual address.

PIMAGE_SECTION_HEADER ImageRvaToSection(
  IN PIMAGE_NT_HEADERS NtHeaders,  
  IN LPVOID Base,                  
  IN DWORD Rva                     
);
 

Parameters

NtHeaders
Pointer to an IMAGE_NT_HEADERS structure. This structure can be obtained by calling the ImageNtHeader function.
Base
Specifies the base address of an image that is mapped into memory through a call to MapViewOfFile.
Rva
Specifies the relative virtual address to locate.

Return Values

If the function succeeds, the return value is a pointer to an IMAGE_SECTION_HEADER structure.

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

Remarks

The ImageRvaToSection function locates an RVA within the image header of a file that is mapped as a file and returns a pointer to the section table entry for that virtual address.

QuickInfo

  Windows NT: Requires version 4.0 or later.
  Windows: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in imagehlp.h.
  Import Library: Use imagehlp.lib.

See Also

PE Image Helper (ImageHlp) Overview, Image Access, ImageNtHeader, MapViewOfFile