Platform SDK: Debugging and Error Handling

ImageDirectoryEntryToData

The ImageDirectoryEntryToData function obtains access to image-specific data.

This function has been superseded by the ImageDirectoryEntryToDataEx function. Use ImageDirectoryEntryToDataEx to retrieve the section header.

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

Parameters

Base
[in] Specifies the base address of the image.
MappedAsImage
[in] Specifies how the file is mapped. If this flag is TRUE, the file is mapped by the system as an image. If the flag is FALSE, the file is mapped as a data file by the MapViewOfFile function.
DirectoryEntry
[in] Specifies the index number of the desired directory entry. This parameter can be one of the following values.
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_ARCHITECTURE Architecture-specific data
IMAGE_DIRECTORY_ENTRY_GLOBALPTR Relative virtual address 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
IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT Delay import table
IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR COM descriptor table

Size
[out] Receives the size, in bytes, of the data for the directory entry.

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.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Dbghelp.h.
  Library: Use Dbghelp.lib.

See Also

Debug Help Library Overview, DbgHelp Functions, ImageDirectoryEntryToDataEx, MapViewOfFile