How to tell if binary is x86 or amd64?

First get dumpbin tool, ships with any Windows SDK.

Run dumpbin /headers on the binary, then look at the magic number.

This is an amd64 binary:

 

c:\>dumpbin /headers c:\amd64\msvcr100.dll | findstr magic
             20B magic # (PE32+)

This is a 32-bit binary:

 

c:\DPMedusa1>dumpbin /headers c:\x86\msvcr100.dll | findstr magic
             10B magic # (PE32)

 

dumpbin also works on executables, for example on my amd64 machine:

 

c:\>dumpbin /headers c:\Windows\System32\calc.exe | findstr magic
             20B magic # (PE32+)

 

c:\>dumpbin /headers c:\Windows\SysWOW64\calc.exe | findstr magic
             10B magic # (PE32)

Comments