Windows Portable Executeable Format

PE Structure

  • Dos Header

  • Dos Stub

  • Nt Headers => (nt_signature | file_header | optional_header)

  • Data Directories

  • Sections

pe-structure

Dos Header

PE file prefix with MZ(0x4D, 0x5A)

Nt Headers

File Header

Optional Header

the data directories are an array of IMAGE_DATA_DIRECTORY structures. Each structure contains the RVA and size of a specific data directory. The number of data directories is defined by the NumberOfRvaAndSizes field in the optional header.

can use the following code to get the data directories

can use the following code to get the specific data directory

PE Sections

.text - Contains the executable code.

.rdata - Contains read-only data.

.data - Contains initialized data.

.rsrc - Contains resources.

.reloc - Contains base relocations.

.idata - Contains import information.

.edata - Contains export information.

.pdata - Contains exception handling information.

.debug - Contains debugging information.

.tls - Contains thread local storage data.

.xdata - Contains exception handling data.

.bss - Contains uninitialized data.

.idata - Contains import information.

.edata - Contains export information.

.rsrc - Contains resources.

.reloc - Contains base relocations.

.tls - Contains thread local storage data.

.xdata - Contains exception handling data.

.pdata - Contains exception handling information.

.debug - Contains debugging information.

.bss - Contains uninitialized data.

.rdata - Contains read-only data.

.data - Contains initialized data.

.text - Contains the executable code.

can use the following code to get the sections

Last updated