On Windows, like:
is64 abc.exe 1
is32 def.exe 1
While abc.exe is compiled 64-bit and def.exe is 32-bit on Windows.
migrated from stackoverflow.com Aug 31 '12 at 9:40
This question came from our site for professional and enthusiast programmers.
The PE32 format stands for Portable Executable 32-bit, while PE32+ is Portable Executable 64-bit format.
Not exactly like that.
You can use the
I wrote a pair of programs strictly doing what you asked for (With the addition of error messages on errors et cetera.) (And actually, it's one program with a define that changes its behaviour to be perfectly accurate, but that doesn't matter.)
You can find them on my Dropbox, here. Source code is included in the package but you can discard it if it's unneeded. It's basically only included in case you don't trust my binaries.
Example of use:
Basically, the program works by first memory-mapping the binary, then locating the PE header and finally simply comparing the Machine field to the value for whichever architecture you ask for. Essentially a very simple process.