views:

45

answers:

2

I'm new to Windows programming, and I'm looking for an equivalent of the Unix 'file' command that I can run on compiled objects (including .lib files and executables) to discover with what bitness they were compiled. For example, on my Mac I can run:

    file /usr/bin/python
    /usr/bin/python: Mach-O universal binary with 3 architectures
    /usr/bin/python (for architecture x86_64):  Mach-O 64-bit executable x86_64
    /usr/bin/python (for architecture i386):    Mach-O executable i386
    /usr/bin/python (for architecture ppc7400): Mach-O executable ppc

Is there any command I can run to inspect compiled objects on Windows? Maybe part of Visual Studio?

+1  A: 

For managed binaries you can use the corflags command. It will dump out similar information for managed binaries

C:\Users\jaredpar\winconfig> corflags .\Utils\Reflector\Reflector.exe
Microsoft (R) .NET Framework CorFlags Conversion Tool.  Version  4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Version   : v1.0.3705
CLR Header: 2.0
PE        : PE32
CorFlags  : 9
ILONLY    : 1
32BIT     : 0
Signed    : 1
JaredPar
Thanks, but I need this information for non managed binaries.
RecessionCone
+1  A: 

As Luke suggested, dumpbin was the right command. Specifically, dumpbin /headers will show a bunch of information about the binary.

Thanks, Luke!

RecessionCone
Another tool which provides similar information is [Dependency Walker](http://www.dependencywalker.com/).
RecessionCone