ImageDirectoryEntryToData

The ImageDirectoryEntryToData function obtains access to image-specific data.

PVOID ImageDirectoryEntryToData(
  IN LPVOID Base,            
  IN BOOLEAN MappedAsImage,  
  IN USHORT DirectoryEntry,  
  OUT PULONG Size            
);
 

Parameters

Base
Specifies the base address of the image.
MappedAsImage
Specifies how the image is mapped. If this flag is TRUE, the image is mapped by the system loader. If the flag is FALSE, the file is mapped by a call to the MapViewOfFile function.
DirectoryEntry
Specifies the index number of the desired directory entry. The value must be one of the following:
Value Meaning
IMAGE_DIRECTORY_ENTRY_EXPORT Export directory
IMAGE_DIRECTORY_ENTRY_IMPORT Import directory
IMAGE_DIRECTORY_ENTRY_RESOURCE Resource directory
IMAGE_DIRECTORY_ENTRY_EXCEPTION Exception directory
IMAGE_DIRECTORY_ENTRY_SECURITY Security directory
IMAGE_DIRECTORY_ENTRY_BASERELOC Base relocation table
IMAGE_DIRECTORY_ENTRY_DEBUG Debug directory
IMAGE_DIRECTORY_ENTRY_COPYRIGHT
IMAGE_DIRECTORY_ENTRY_GLOBALPTR RVA of global pointer
IMAGE_DIRECTORY_ENTRY_TLS thread local storage directory
IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG Load configuration directory
IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT Bound import directory
IMAGE_DIRECTORY_ENTRY_IAT Import address table

Size
Specifies the size of the desired directory entry's data.

Return Values

If the function succeeds, the return value is a pointer to the directory entry's data.

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

Remarks

The ImageDirectoryEntryToData function is used to obtain access to image-specific data.

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, MapViewOfFile