Expand Minimize

ImageDirectoryEntryToDataEx function

Locates a directory entry within the image header and returns the address of the data for the directory entry. This function returns the section header for the data located, if one exists.

Syntax


PVOID WINAPI ImageDirectoryEntryToDataEx(
  _In_       PVOID Base,
  _In_       BOOLEAN MappedAsImage,
  _In_       USHORT DirectoryEntry,
  _Out_      PULONG Size,
  _Out_opt_  PIMAGE_SECTION_HEADER *FoundHeader
);

Parameters

Base [in]

The base address of the image or data file.

MappedAsImage [in]

If the flag is TRUE, the file is mapped by the system as an image. If this flag is FALSE, the file is mapped as a data file by the MapViewOfFile function.

DirectoryEntry [in]

The directory entry to be located. The value must be one of the following values.

ValueMeaning
IMAGE_DIRECTORY_ENTRY_ARCHITECTURE
7

Architecture-specific data

IMAGE_DIRECTORY_ENTRY_BASERELOC
5

Base relocation table

IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
11

Bound import directory

IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR
14

COM descriptor table

IMAGE_DIRECTORY_ENTRY_DEBUG
6

Debug directory

IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT
13

Delay import table

IMAGE_DIRECTORY_ENTRY_EXCEPTION
3

Exception directory

IMAGE_DIRECTORY_ENTRY_EXPORT
0

Export directory

IMAGE_DIRECTORY_ENTRY_GLOBALPTR
8

The relative virtual address of global pointer

IMAGE_DIRECTORY_ENTRY_IAT
12

Import address table

IMAGE_DIRECTORY_ENTRY_IMPORT
1

Import directory

IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG
10

Load configuration directory

IMAGE_DIRECTORY_ENTRY_RESOURCE
2

Resource directory

IMAGE_DIRECTORY_ENTRY_SECURITY
4

Security directory

IMAGE_DIRECTORY_ENTRY_TLS
9

Thread local storage directory

 

Size [out]

A pointer to a variable that receives the size of the data for the directory entry that is located.

FoundHeader [out, optional]

A pointer to an IMAGE_SECTION_HEADER structure that receives the data. If the section header does not exist, this parameter is NULL.

Return value

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

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

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

 

 

Community Additions

ADD
Show:
© 2014 Microsoft