How can I determine if another process is 64 bit?

I have a Process for a running application.

How can I say (without p / invoking, preferably) if this process is 64 bit?

+8
c # process 64bit
source share
4 answers

You will need to use PInvoke IsWow64Process .

+4
source share

I don’t think there is a 100% final way to find out without PInvoke.

But one element that can work is to check the set of loaded modules ( Process.Modules ). If the primary modules (user32, kernel32, etc.) come from the Wow64 directory and you start the 64-bit machine, then there is a possibility that this is a 32-bit process. If they do not come from the Wow64 directory, and this is a 64-bit machine, then this is probably a 64-bit process.

Again not a final, but a good mark.

+4
source share

As others have already mentioned, you can use IsWow64Process , which is easily implemented here .

0
source share

It is easy if the process runs on a 64-bit operating system, then this is a 64-bit process.

It is possible that the code originally written for 32-bit systems runs on 64-bit versions, since it can work within the limits of memory in a 64-bit environment. However, this restriction is no longer bound by these restrictions, regardless of whether it is intended to exploit this fact. As such, there is no such thing as a β€œ32-bit process” if it runs on a 64-bit machine.

Think of it as a Dog that has been trained to stay in a specific area using an invisible fence. If the fenced area were expanded later, you will find that some smarter dogs will immediately start using the new area. Although other dogs may not be aware of the changes and continue to operate within their intended boundaries, this does not mean that their limitations will differ from their smarter ones.

-4
source share

All Articles