Platform SDK: Debugging and Error Handling

IMAGE_SECTION_HEADER

The IMAGE_SECTION_HEADER structure represents the image section header format.

typedef struct _IMAGE_SECTION_HEADER {
    BYTE    Name[IMAGE_SIZEOF_SHORT_NAME];
    union {
        DWORD   PhysicalAddress;
        DWORD   VirtualSize;
    } Misc;
    DWORD   VirtualAddress;
    DWORD   SizeOfRawData;
    DWORD   PointerToRawData;
    DWORD   PointerToRelocations;
    DWORD   PointerToLinenumbers;
    WORD    NumberOfRelocations;
    WORD    NumberOfLinenumbers;
    DWORD   Characteristics;
} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;

Members

Name
An 8-byte, null-filled string. There is no terminating null character if the string is exactly eight characters long. For longer names, this member contains a forward slash (/) followed by a decimal number that is an offset into the string table. Executable images do not use a string table and do not support section names longer than eight characters.
PhysicalAddress
Specifies the file address.
VirtualSize
Total size of the section when loaded into memory. If this value is greater than the SizeOfRawData member, the section is filled with zeroes.
VirtualAddress
The address of the first byte of the section when loaded into memory, relative to the image base.
SizeOfRawData
The size of the initialized data on disk. This value must be a multiple of the FileAlignment member of the IMAGE_OPTIONAL_HEADER structure. If this value is less than the VirtualSize member, the remainder of the section is filled with zeroes. If the section contains only uninitialized data, the member is zero.
PointerToRawData
File pointer to the first page within the COFF file. This value must be a multiple of the FileAlignment member of the IMAGE_OPTIONAL_HEADER structure. If a section contains only uninitialized data, this member is zero.
PointerToRelocations
File pointer to the beginning of the relocation entries for the section. If there are no relocations, this value is zero.
PointerToLinenumbers
File pointer to the beginning of the line-number entries for the section. If there are no COFF line numbers, this value is zero.
NumberOfRelocations
Number of relocation entries for the section. This value is zero for executable images.
NumberOfLinenumbers
Number of line-number entries for the section.
Characteristics
Specifies the characteristics of the image.
Flag Description
IMAGE_SCN_TYPE_REG Reserved.
IMAGE_SCN_TYPE_DSECT Reserved.
IMAGE_SCN_TYPE_NOLOAD Reserved.
IMAGE_SCN_TYPE_GROUP Reserved.
IMAGE_SCN_TYPE_NO_PAD Reserved.
IMAGE_SCN_TYPE_COPY Reserved.
IMAGE_SCN_CNT_CODE Section contains executable code.
IMAGE_SCN_CNT_INITIALIZED_DATA Section contains initialized data.
IMAGE_SCN_CNT_UNINITIALIZED_DATA Section contains uninitialized data.
IMAGE_SCN_LNK_OTHER Reserved.
IMAGE_SCN_LNK_INFO Reserved.
IMAGE_SCN_TYPE_OVER Reserved.
IMAGE_SCN_LNK_COMDAT Section contains COMDAT data.
IMAGE_SCN_MEM_FARDATA Reserved.
IMAGE_SCN_MEM_PURGEABLE Reserved.
IMAGE_SCN_MEM_16BIT Reserved.
IMAGE_SCN_MEM_LOCKED Reserved.
IMAGE_SCN_MEM_PRELOAD Reserved.
IMAGE_SCN_ALIGN_1BYTES Align data on a 1-byte boundary.
IMAGE_SCN_ALIGN_2BYTES Align data on a 2-byte boundary.
IMAGE_SCN_ALIGN_4BYTES Align data on a 4-byte boundary.
IMAGE_SCN_ALIGN_8BYTES Align data on a 8-byte boundary.
IMAGE_SCN_ALIGN_16BYTES Align data on a 16-byte boundary.
IMAGE_SCN_ALIGN_32BYTES Align data on a 32-byte boundary.
IMAGE_SCN_ALIGN_64BYTES Align data on a 64-byte boundary.
IMAGE_SCN_LNK_NRELOC_OVFL Section contains extended relocations.
IMAGE_SCN_MEM_DISCARDABLE Section can be discarded as needed.
IMAGE_SCN_MEM_NOT_CACHED Section cannot be cached.
IMAGE_SCN_MEM_NOT_PAGED Section cannot be paged.
IMAGE_SCN_MEM_SHARED Section can be shared in memory.
IMAGE_SCN_MEM_EXECUTE Section can be executed as code.
IMAGE_SCN_MEM_READ Section can be read.
IMAGE_SCN_MEM_WRITE Section can be written to.

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 Winnt.h; include Windows.h.

See Also

Image Help Library Overview, ImageHlp Structures, ImageDirectoryEntryToDataEx, ImageRvaToSection, ImageRvaToVa, LOADED_IMAGE