址就在0x0040 0000,下面给出这个结构体成员 的一些值:
e_magic |
0x5a4d |
unsigned short |
e_cblp |
0x0090 |
unsigned short |
e_cp |
0x0003 |
unsigned short |
e_crlc |
0x0000 |
unsigned short |
e_cparhdr |
0x0004 |
unsigned short |
e_minalloc |
0x0000 |
unsigned short |
e_maxalloc |
0xffff |
unsigned short |
e_ss |
0x0000 |
unsigned short |
e_sp |
0x00b8 |
unsigned short |
e_csum |
0x0000 |
unsigned short |
e_ip |
0x0000 |
unsigned short |
e_cs |
0x0000 |
unsigned short |
e_lfarlc |
0x0040 |
unsigned short |
e_ovno |
0x0000 |
unsigned short |
e_res |
0x0040001c "" |
unsigned short [4] |
e_oemid |
0x0000 |
unsigned short |
e_oeminfo |
0x0000 |
unsigned short |
e_res2 |
0x00400028 "" |
unsigned short [10] |
e_lfanew |
0x000000e0 |
long |
注意系统对这个区域的保护:
这个区域将是只读的。
根据PE文件的规定,在0x3c这个偏移量的位置(也就是 __ImageBase.e_lfanew这个成员)指明了IMAGE_FILE_HEAD的偏移量。我们直接用一个IMAGE_FILE_HEAD 指针指向这个位置,就可以看到IMAGE_FILE_HEAD的值了:
Machine |
0x014c |
unsigned short |
NumberOfSections |
0x0005 |
unsigned short |
TimeDateStamp |
0x4a94cfc5 |
unsigned long |
PointerToSymbolTable |
0x00000000 |
unsigned long |
NumberOfSymbols |
0x00000000 |
unsigned long |
SizeOfOptionalHeader |
0x00e0 |
unsigned short |
Characteristics |
0x0102 |
unsigned short |
再按照这个结构体得到的SizeOfOptionalHeader,我们将得以遍历所有的section head。
紧接着 IMAGE_FILE_HEAD之后的是一个叫IMAGE_OPTIONAL_HEAD的结构体,我们直接用一个指针指向这个位置并 得到实际的值:
把它和从文件里面DUMP出来的数据比较,可以发现它们是一致的:
OPTIONAL HEADER VALUES
10B magic # (PE32)
9.00 linker version
5BE00 size of code
E200 size of initialized data
0 size of uninitialized data
5BB6
|