您的位置:首页 > 其它

How to find if native dll is compiled as x64 or x86?

2012-06-13 22:13 295 查看
Question:

I want to determine if native assembly is complied as x64 or x86 from a managed code application (c#). I think it must somewhere in the PE header since the OS loader needs to know this info but I couldn't find it. I prefer of
course to do it in managed code but if it necessary I can use native C++.



Answer:

In case anyone is still looking for this (I just got here from google) there is an easy way to do this with
corflags. Open Visual Studio Command Prompt and type "corflags [your assembly]". You'll get something like this:

c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC>corflags "C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll"

Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 3.5.21022.8 Copyright (c) Microsoft Corporation. All rights reserved.

Version : v2.0.50727

CLR Header: 2.5

PE : PE32

CorFlags : 24

ILONLY : 0

32BIT : 0

Signed : 1

You're looking at PE and 32BIT specifically.

AnyCpu:

PE: PE32

32BIT: 0

x86:

PE: PE32

32BIT: 1

x64:

PE: PE32+

32BIT: 0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐