首先通过判断是否是64位系统,然后IsWow64Process函数判断是否是64位程序的进程。
主要代码:(判断否是64位系统不明的参考我另外一篇文章):
InBlock.gif
  //打开进程并返回句柄
InBlock.gif      hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pe32.th32ProcessID);
InBlock.gif      
if ((pe32.th32ProcessID !=0 ) && (pe32.th32ProcessID != 4) && (pe32.th32ProcessID != 8))
InBlock.gif      {
InBlock.gif        
//64位系统执行
InBlock.gif        
if (CWindOS::IsWow64())
InBlock.gif        {
InBlock.gif          BOOL y5023=TRUE;
InBlock.gif          EnumProcessModulesEx(hProcess, &hModules,
sizeof(hModules), &cbNeeded,PDW);
InBlock.gif          
//判断是否是64或32模块进程
InBlock.gif          IsWow64Process(hProcess,&y5023);
InBlock.gif          
if (y5023==FALSE)
InBlock.gif          {
InBlock.gif            
//枚举第一个模块句柄也就是自身
InBlock.gif            QueryFullProcessImageNameA(hProcess,0,strProcessName,&PDW);
InBlock.gif          }
InBlock.gif          
else
InBlock.gif          {  
//得到自身的完整名称
InBlock.gif            GetModuleFileNameExA(hProcess, hModules, strProcessName,
sizeof(strProcessName));
InBlock.gif          }
InBlock.gif        }
InBlock.gif        
else
InBlock.gif        {  
//32位系统执行
InBlock.gif          EnumProcessModules(hProcess, &hModules,
sizeof(hModules), &cbNeeded);    
InBlock.gif          GetModuleFileNameExA(hProcess, hModules, strProcessName,
sizeof(strProcessName));
InBlock.gif        }
InBlock.gif        
//内存信息
InBlock.gif      
//  GetProcessMemoryInfo(hProcess,&nc,sizeof(nc));