加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

运行时是否正确检查Windows是否为64位? (C )

发布时间:2020-12-14 04:14:01 所属栏目:Windows 来源:网络整理
导读:bool Win64bit = (sizeof(int*) == 8) ? 1 : 0; 我需要这个,所以我的应用程序可以正常使用Windows注册表功能(或者我需要?). 我做得对吗? 以下是Raymond Chen在 http://blogs.msdn.com/oldnewthing/archive/2005/02/01/364563.aspx博客中建议的内容: BOOL
bool Win64bit = (sizeof(int*) == 8) ? 1 : 0;

我需要这个,所以我的应用程序可以正常使用Windows注册表功能(或者我需要?).

我做得对吗?

以下是Raymond Chen在 http://blogs.msdn.com/oldnewthing/archive/2005/02/01/364563.aspx博客中建议的内容:
BOOL Is64BitWindows()
{
#if defined(_WIN64)
    return TRUE;  // 64-bit programs run only on Win64
#elif defined(_WIN32)
    // 32-bit programs run on both 32-bit and 64-bit Windows
    // so must sniff
    BOOL f64 = FALSE;
    return IsWow64Process(GetCurrentProcess(),&f64) && f64;
#else
    return FALSE; // Win64 does not support Win16
#endif
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读