[实用程序源码及工具软件] C++取CPUID源码

[复制链接]
 楼主| hotpower 发表于 2023-9-18 23:21 | 显示全部楼层 |阅读模式
  1. string GetCPUID()
  2. {
  3. #ifndef _WINXP
  4.         INT32 dwBuf[4] = { 0 };
  5.         __cpuidex(dwBuf, 1, 1);
  6.         return int2hex(dwBuf[3], 8) + int2hex(dwBuf[0], 8);
  7. #else
  8.         uint32_t s1 = 0, s2 = 0;
  9.         __asm {
  10.                 mov eax, 01h;
  11.                 xor edx, edx;
  12.                 cpuid;
  13.                 mov s1, edx;
  14.                 mov s2, eax;
  15.         }
  16.         return int2hex(s1, 8) + int2hex(s2, 8);
  17. #endif
  18. }


您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:[url=http://www.21ic.com/tools/HotWC3_V1.23.html]

1460

主题

21619

帖子

508

粉丝
快速回复 在线客服 返回列表 返回顶部