开发者

How can I tell if another process is 64bit?

开发者 https://www.devze.com 2023-02-21 04:12 出处:网络
开发者_JAVA百科I\'ve got a Process for a running application. How can I tell (without p/invoking, preferably) if that process is 64bit?I don\'t think there is a 100% definitive way to know without a
开发者_JAVA百科

I've got a Process for a running application.

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


I don't think there is a 100% definitive way to know without a PInvoke.

But one item which may work though is to inspect the set of loaded modules (Process.Modules). If the primary modules (user32, kernel32, etc ...) come from the Wow64 directory and you're running an a 64 bit machine then there is a solid chance it's a 32 bit process. If they don't come from the Wow64 directory and it's a 64 bit machine then it's likely it's a 64 bit process.

Again not definitive but a good estimate.


You'll need to use PInvoke IsWow64Process.


As mentioned by others you can use IsWow64Process which is easily implemented here.


Easily, if a process is running on a 64bit Operating System then it's a 64bit process.

It is possible for code originally written for 32bit systems to run on 64bit versions because it can operate within the memory restrictions of the 64bit environment. However it is no longer bound by those restrictions regardless of whether or not it is designed to take advantage of that fact. As such there is no such thing as a "32bit process" if it's running on a 64bit bit machine.

Think of it like a Dog that's been trained to remain within a certain area using invisible fencing. If the fenced area was expanded later on you would find that some smarter dogs would immediately begin making use of the new area. Even though other dogs might not be aware of the change and continue to operate within their perceived boundaries, that doesn't mean that their limitations would be different than that of the smarter ones.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号