如何确定进程是 32 位还是 64 位? [英] How can I determine whether a process is 32 or 64 bit?
本文介绍了如何确定进程是 32 位还是 64 位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给定一个 Windows 进程句柄,如何使用 C++ 代码确定进程是 32 位还是 64 位?
Given a Windows process handle, how can I determine, using C++ code, whether the process is 32 bit or 64 bit?
推荐答案
如果你有模块的句柄,那么你可以这样做:
If you have handle to the module then you can do this:
IMAGE_NT_HEADERS * headers = ImageNtHeader(handle);
if ( headers->FileHeader.Machine == IMAGE_FILE_MACHINE_I386 )
{
//module is x86
}
else if ( headers->FileHeader.Machine == IMAGE_FILE_MACHINE_AMD64 )
{
//module is x64
}
我从我自己的答案中获得了帮助.
这篇关于如何确定进程是 32 位还是 64 位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文