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
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
相关文章推荐
- How to find if native dll is compiled as x64 or x86?
- How to tell if a file is an EXE or a DLL?
- How to check if a static library is built for 64-bit?
- C# Tips: How to tell if system is little endian or big endian?
- C Tips: How to tell if system is little endian or big endian?
- How to check if a journal is EI, SCI, ISI, SCIE or SSCI and get its Impact Factor
- How to check if a Number is Positive or Negative in Java - Interview Question
- How to justify if a windows program is 32 bit or 64 bit
- How to Check if Linux (Ubuntu, Fedora Redhat, CentOS) is 32-bit or 64-bit
- Linux / Unix Script: Simple Process Checker To Find Out If A Service Is Running or Not
- How to check if a machine is physical or virtual
- 技术人生:Knowing when or where it’s appropriate to use a technique or tool is just as important as knowing how to use it.
- How do I know if my Mac Pro is 32 or 64 bit system?
- How to find public key token for a .NET DLL or assembly
- how to judge if the temptable or normal table that you created exists
- A program to check if a binary tree is BST or not
- RunningMapReduceExampleTFIDF - hadoop-clusternet - This document describes how to run the TF-IDF MapReduce example against ascii books. - This project is for those who wants to experiment hadoop as a skunkworks in a small cluster (1-10 nodes) - Google Pro
- how to add syscall on x86_64
- iOS常见问题之 Restore the connection to device and run “xxx” again, or if “xxx” is still ru
- Android Studio之让人懵逼的错误:Failed to load native library 'native-platform.dll' for Windows 10 x86.