From boitboy on 2013-09-17 10:21:34
C++ 获取CPUID
//获取CPUID
CString GetCpuId()
{
CString str2,str3;
unsigned long s1,s2;
_asm // 得到CPU ID的高32位
{
mov eax,01h
xor edx,edx
cpuid
mov s2,eax
}
str2.Format(_T("%08X-"),s2);
_asm // 得到CPU ID的低64位
{
mov eax,03h
xor ecx,ecx
xor edx,edx
cpuid
mov s1,edx
mov s2,ecx
}
str3.Format(_T("%08X-%08X\n"),s1,s2);
CString strCpuId=str2+str3;
return strCpuId;
}