如果你安装了Visual Studio或Platform SDK,你可以使用dumpbin /headers
来查看PE头值。
64位可执行文件的例子。
PE signature found
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
8664 machine (x64)
5 number of sections
4987EDCA time date stamp Tue Feb 03 08:10:02 2009
0 file pointer to symbol table
0 number of symbols
F0 size of optional header
23 characteristics
Relocations stripped
Executable
Application can handle large (>2GB) addresses
OPTIONAL HEADER VALUES
20B magic # (PE32+)
8.00 linker version
2A600 size of code
18A00 size of initialized data
0 size of uninitialized data
2AE90 entry point (000000000042AE90)
1000 base of code
...
对于32位:
PE signature found
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
14C machine (x86)
3 number of sections
4B0C786D time date stamp Wed Nov 25 01:21:01 2009
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
103 characteristics
Relocations stripped
Executable
32 bit word machine
OPTIONAL HEADER VALUES
10B magic # (PE32)
9.00 linker version
42000 size of code
4000 size of initialized data
6F000 size of uninitialized data
B0EE0 entry point (004B0EE0)
70000 base of code
...
文件头的第一个值告诉你架构:x86的0x14C或x64的0x8664。