How can I determine whether a process is 32 or 64 bit?

前端 未结 3 1438
忘掉有多难
忘掉有多难 2021-02-07 19:36

Given a Windows process handle, how can I determine, using C++ code, whether the process is 32 bit or 64 bit?

3条回答
  •  遇见更好的自我
    2021-02-07 20:37

    If you have a process handle, use IsWow64Process().

    If IsWow64Process() reports true, the process is 32-bit running on a 64-bit OS.

    If IsWow64Process() reports false (or does not exist in kernel32.dll), then the process is either 32-bit running on a 32-bit OS, or is 64-bit running on a 64-bit OS. To know if the OS itself is 32-bit or 64-bit, use GetNativeSystemInfo() (or GetSystemInfo() if GetNativeSystemInfo() is not available in kernel32.dll).

提交回复
热议问题