I’m using Red Gate’s .NET Reflector for decompiling .NET assemblies. It’s a great tool but it lacks, at least in the free version I’m using, information about the platform architecture of an assembly. Sometimes I want to know whether an assembly was built for Any CPU, x86 or x64.
The tool that help you find this information is CorFlags.exe from Windows SDK. It displays or configures the corflags section of a PE image. Here is an example of the output of corflags.exe:
Version : v2.0.50727 CLR Header: 2.5 PE : PE32 CorFlags : 1 ILONLY : 1 32BIT : 0 Signed : 0
The platform architecture is encoded in a combination of the PE and 32BIT flags:
- Any CPU: PE=PE32 and 32BIT=0
- x86: PE=PE32 and 32BIT=1
- 64-bit: PE=PE32+ and 32BIT=0
So for the example above, PE is PE32 and 32BIT is 0, thus the platform architecture is Any CPU.
You can read more about this tool on Gaurav Seth’s blog.