检查是否有任何运行的二进制是32位还是64位 [英] Check if any running binary is 32 or 64 bit

查看:264
本文介绍了检查是否有任何运行的二进制是32位还是64位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是可能的,检查应用程序包的二进制过程是在32或64位模式下运行的<一个href=\"http://stackoverflow.com/questions/7335245/macosx-find-out-if-a-process-given-a-pid-is-running-in-32bit-or-in-64bit-inte\">answered在这个问题上,但我可以验证它只能与GUI进程的作品。

It is possible to check if an app bundle's binary process is running in 32 or 64 bit mode, as answered in this question, but I can verify that it only works with GUI processes.

不过,我也需要检查没有一个GUI,不是包的一部分流程。

However, I need to also check processes that don't have a GUI and is not part of a bundle.

所以,编程,不调用系统函数或其他可执行文件,我如何测试如果有进程在32位或64位模式下运行,由于进程pid?

So, programmatically, without calling system functions or other executables, how can I test if any process is running in 32 or 64 bit mode, given the process pid?

推荐答案

好了,我终于找到了答案已经在SO <一个href=\"http://stackoverflow.com/questions/7983962/is-there-a-way-to-check-if-process-is-64-bit-or-32-bit\">here,碳。
现在为了使用code,这包括要求:

Ok, so I finally found the answer was already on SO here, for Carbon. In order to use that code now, this include is required:

#include <sys/sysctl.h>

另外,看来该部件到处理结构已从

Also, it appears that the member to the process structure has changed from

proc->kp_proc.p_flags 

这样:

proc->kp_proc.p_flag

这篇关于检查是否有任何运行的二进制是32位还是64位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆