PID来判断运行中的某进程是32位还是64位
答案:2 悬赏:30 手机版
解决时间 2021-03-23 09:12
- 提问者网友:轻浮
- 2021-03-22 11:06
PID来判断运行中的某进程是32位还是64位
最佳答案
- 五星知识达人网友:鱼芗
- 2021-03-22 11:15
使用kernel32的导出函数IsWow64Process,我在加载驱动的时候使用这个方法,是64位的不Hook。
#include typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle( "kernel32 "), "IsWow64Process "); BOOL IsWow64() { BOOL bIsWow64 = FALSE; if (NULL != fnIsWow64Process) { if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64)) {// handle error std::cout < < "Handle Error " <
#include typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle( "kernel32 "), "IsWow64Process "); BOOL IsWow64() { BOOL bIsWow64 = FALSE; if (NULL != fnIsWow64Process) { if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64)) {// handle error std::cout < < "Handle Error " <
全部回答
- 1楼网友:往事埋风中
- 2021-03-22 12:47
iswow64process
确定指定进程是否运行在64位操作系统的32环境(wow64)下。
64位系统 运行64位程序 返回false
64位系统 运行32位程序 返回true
32位系统 运行64位程序 不能运行
32位系统 运行32程序 返回false
#include
#include
typedef bool (winapi *lpfn_iswow64process) (handle, pbool);
lpfn_iswow64process fniswow64process;
bool iswow64()
{
bool biswow64 = false;
//iswow64process is not available on all supported versions of windows.
//use getmodulehandle to get a handle to the dll that contains the function
//and getprocaddress to get a pointer to the function if available.
fniswow64process = (lpfn_iswow64process) getprocaddress(
getmodulehandle(text("kernel32")),"iswow64process");
if(null != fniswow64process)
{
if (!fniswow64process(getcurrentprocess(),&biswow64))
{
//handle error
}
}
return biswow64;
}
int main( void )
{
if(iswow64())
_tprintf(text("the process is running under wow64.\n"));
else
_tprintf(text("the process is not running under wow64.\n"));
return 0;
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯