typedefstruct_IMAGE_FILE_HEADER { WORD Machine; WORD NumberOfSections; DWORD TimeDateStamp; DWORD PointerToSymbolTable; DWORD NumberOfSymbols; WORD SizeOfOptionalHeader; WORD Characteristics; } IMAGE_FILE_HEADER,*PIMAGE_FILE_HEADER;
与PE文件有区别
在PE文件中映像文件头就是NT文件头,它是PE头的成员NT头的成员
而在COFF中上来就是镜像文件头
使用dumpbin观察main.obj文件的映像文件头
1 2 3 4 5 6 7 8 9 10 11 12
Dump of file main.obj
File Type: COFF OBJECT
FILE HEADER VALUES 8664 machine (x64) E number of sections 62F46FCA time date stamp Thu Aug 1110:56:102022 4E5 file pointer to symbol table 30 number of symbols 0 size of optional header 0 characteristics
SECTION HEADER #1 .drectve name 0 physical address 0 virtual address 18 size of raw data 244 file pointer to raw data (00000244 to 0000025B) 0 file pointer to relocation table 0 file pointer to line numbers 0 number of relocations 0 number of line numbers 100A00 flags Info #0x200,该段包含的是注释或者其他信息 Remove #0x800,链接成exe文件时该段最终被抛弃 1 byte align #0x100000,1字节对齐,相当于没有对齐要求
.debug
调试信息
.debug$S表示包含符号相关的调试信息段
.debug$P表示预编译头的调试信息段
.debug$T表示类型相关的调试信息段
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
SECTION HEADER #2 .debug$S name 0 physical address 0 virtual address 74 size of raw data 11C file pointer to raw data (0000011C to 0000018F) 0 file pointer to relocation table 0 file pointer to line numbers 0 number of relocations 0 number of line numbers 42100040 flags Initialized Data Discardable 1 byte align Read Only