Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I determine for which platform an executable is compiled?

I have a need to work with Windows executables which are made for x86, x64, and IA64. I'd like to programmatically figure out the platform by examining the files themselves.

My target language is PowerShell but a C# example will do. Failing either of those, if you know the logic required that would be great.

like image 545
halr9000 Avatar asked Oct 13 '08 15:10

halr9000


1 Answers

If you have Visual Studio installed you can use dumpbin.exe. There's also the Get-PEHeader cmdlet in the PowerShell Community Extensions that can be used to test for executable images.

Dumpbin will report DLLs as machine (x86) or machine (x64)

Get-PEHeader will report DLLs as either PE32 or PE32+

like image 136
Keith Hill Avatar answered Sep 29 '22 01:09

Keith Hill