在网上找了很久,终于找了一段能读出正确CPU ID 的代码,以下代码经过Delphi7测试
procedure TForm1.Button1Click(Sender: TObject);
var_eax, _ebx, _ecx, _edx: Longword;
s, s1, s2,result: string;
begin
asm
push eax
push ebx
push ecx
push edx
mov eax,1
db $0F,$A2
mov _eax,eax
mov _ebx,ebx
mov _ecx,ecx
mov _edx,edx
pop edx
pop ecx
pop ebx
pop eax
end;
s := IntToHex(_eax, 8);
s1 := IntToHex(_edx, 8);
s2 := IntToHex(_ecx, 8);
result:=s+s1+s2;
edit1.Text:=result;
end;
本文提供了一段使用Delphi7实现的代码示例,该代码能够正确读取出CPUID。通过汇编指令获取CPUID,并将其转换为十六进制字符串形式进行展示。
2887

被折叠的 条评论
为什么被折叠?



