PE文件结构(0x03)

PE文件的NT映像头 

IMAGE_NT_HEADERS STRUCT{
    +0H    DWORD                    //Signature
    +4H    IMAGE_FILE_HEADER        //FileHeader
    +18H   IMAGE_OPTIONAL_HEADER32  //OptionalHeader
}    IMAGE_NT_HEADER ENDS

开始的第一个成员是PE的标志,也就是PE..(50 45 00 00).

第二个成员是什么呢?是一个结构,大结构包含着的一个小结构 ,IMAGE_FILE_HEADER.

typedef struct _IMAGE_FILE_HEADER {
  WORD      Machine;                        //运行平台
  WORD      NumberOfSections;               //区块数
  DWORD     TimeDateStamp;                  //文件创建时间和日期
  DWORD     PointerToSymbolTable;           //指向符号表(用于调试)
  DWORD     NumberOfSymbols;                //符号表中符号的个数
  WORD      SizeOfOptionalHeader;           //IMAGE_OPTIONAL_HEADER32结构的大小
  WORD      Characteristics;                //文件属性
} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;

解释一下,在微软官方的文档中 

Machine ----> IMAGE_FILE_MACHINE_XXXX 

ValueMeaning

IMAGE_FILE_MACHINE_I386

0x014c

x86

IMAGE_FILE_MACHINE_IA64

0x0200

Intel Itanium

IMAGE_FILE_MACHINE_AMD64

0x8664

x64

TimeDateStamp

这个记录了文件被创立的时间,这个值是自1970年1月1日以来,用格林尼治时间(GMT)计算的秒数,超级精准,是比文件系统的日期时间还要精准的时间指示器。

SizeOfOptionalHeader

这个是上上面的PE文件的NT映像头 的第三个结构的大小,却是记录在了这个结构中,对于32位pe文件来说,这个值通常是(00E0h),但对于64位的pe32+文件来说,这个值一般是(00F0h).

Characteristics

记录的是文件属性,每个属性有固定的值

ValueMeaning

IMAGE_FILE_RELOCS_STRIPPED

0x0001

Relocation information was stripped from the file. The file must be loaded at its preferred base address. If the base address is not available, the loader reports an error.

IMAGE_FILE_EXECUTABLE_IMAGE

0x0002

The file is executable (there are no unresolved external references).

IMAGE_FILE_LINE_NUMS_STRIPPED

0x0004

COFF line numbers were stripped from the file.

IMAGE_FILE_LOCAL_SYMS_STRIPPED

0x0008

COFF symbol table entries were stripped from file.

IMAGE_FILE_AGGRESIVE_WS_TRIM

0x0010

Aggressively trim the working set. This value is obsolete.

IMAGE_FILE_LARGE_ADDRESS_AWARE

0x0020

The application can handle addresses larger than 2 GB.

IMAGE_FILE_BYTES_REVERSED_LO

0x0080

The bytes of the word are reversed. This flag is obsolete.

IMAGE_FILE_32BIT_MACHINE

0x0100

The computer supports 32-bit words.

IMAGE_FILE_DEBUG_STRIPPED

0x0200

Debugging information was removed and stored separately in another file.

IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP

0x0400

If the image is on removable media, copy it to and run it from the swap file.

IMAGE_FILE_NET_RUN_FROM_SWAP

0x0800

If the image is on the network, copy it to and run it from the swap file.

IMAGE_FILE_SYSTEM

0x1000

The image is a system file.

IMAGE_FILE_DLL

0x2000

The image is a DLL file. While it is an executable file, it cannot be run directly.

IMAGE_FILE_UP_SYSTEM_ONLY

0x4000

The file should be run only on a uniprocessor computer.

IMAGE_FILE_BYTES_REVERSED_HI

0x8000

The bytes of the word are reversed. This flag is obsolete.

 

有多个属性时,可以通过或运算得到。

 

接下来依旧拿微信开刀

 

 

可以看到  

平台: 对照表可以得到x86

区块数:0006

时间:5A38CE83秒,就不计算了= =

符号表和个数都没有

IMAGE_OPTIONAL_HEADER32:这个微信是32位的,结构大小一般为00E0,没错

文件属性:0102  对照表格应该是

IMAGE_FILE_EXECUTABLE_IMAGE

0x0002

The file is executable (there are no unresolved external references).

IMAGE_FILE_32BIT_MACHINE

0x0100

The computer supports 32-bit words.

可执行的文件➕计算机支持32位系统。

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值