get CPU id (很全的)[8]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 ypyrock 的 blog

  mov eax,1
  db $0f,$a2               /// cpuid
  mov bid,bl
  pop edx
  pop ecx
  pop ebx
  pop eax
end;
checkxeon:=(bid=$3);
end;
function tcpudata.checkpentium4:boolean;
var bid:byte;
begin
asm
  push eax
  push ebx
  push ecx
  push edx
  mov eax,1
  db $0f,$a2               /// cpuid
  mov bid,bl
  pop edx
  pop ecx
  pop ebx
  pop eax
end;
checkpentium4:=(bid=$8);
end;
function tcpudata.checkithanium:boolean;
var res:dword;
    binarray:array[0..31] of byte;
    i:byte;
begin
asm
  push eax
  push ebx
  push ecx
  push edx
  mov eax,1
  db $0f,$a2               /// cpuid
  mov res,edx
  pop edx
  pop ecx
  pop ebx
  pop eax
end;
for i:=0 to 31 do
  begin
   binarray[i]:=res mod 2;
   res:=res div 2;
  end;
checkithanium:=(checkpentium4 and (binarray[30]=1));
end;
function tcpudata.intelp5n:string;
begin
if checkmmx then intelp5n:='intel pentium(r) mmx(tm)'
else intelp5n:='intel pentium(r)';
end;
function tcpudata.intelp6n:string;
begin
if checkceleron then intelp6n:='intel celeron(r)'
else
if checkpentiumiii then intelp6n:='intel pentium(r) iii'
else
if checkxeon then intelp6n:='intel pentium(r) iii xeon(tm)'
else
if not checkmmx then intelp6n:='intel pentium(r) pro'
else intelp6n:='intel pentium(r) ii';  
end;
function tcpudata.amdk5n:string;
var family,model,stepping:byte;
begin
getfms(family,model,stepping);
if model=0 then amdk5n:='amd k5'
else amdk5n:=getextendedcpuname;
end;
function tcpudata.cyrix686n:string;
begin
if cpudata.getmaxextendedfunctions>0 then cyrix686n:=getextendedcpuname
else
if checkmmx then cyrix686n:='via cyrix 6x86mii'
else
cyrix686n:='via cyrix 6x86';
end;
function tcpudata.genericcpun:string;
var sysinfo:tsysteminfo;
begin
getsysteminfo(sysinfo);
if sysinfo.dwprocessortype=386
    then genericcpun:='generic 386 cpu'
else
if sysinfo.dwprocessortype=486
    then genericcpun:='generic 486 cpu'
else
if sysinfo.dwprocessortype=586
    then genericcpun:='pentium class cpu'
else genericcpun:='unknown cpu';
end;
function tcpudata.p5cachel1di:word;
begin
if checkmmx then p5cachel1di:=16
else p5cachel1di:=8;
end;
function tcpudata.p6cachel1di:word;
begin
if not checkmmx then p6cachel1di:=8
else p6cachel1di:=16;
end;
function tcpudata.p6cachel2:word;
var family,model,stepping:byte;
begin
if checkceleron then p6cachel2:=128
else
if checkpentiumiii then begin
                          getfms(family,model,stepping);
                          if model=7 then p6cachel2:=512
                          else if model=8 then p6cachel2:=256
                          else p6cachel2:=512;
                         end
else if not checkmmx then p6cachel2:=512
else p6cachel2:=512;
end;
function tcpudata.authenticamd:tcpurec;
var family,model,stepping:byte;
    efamily,emodel,estepping:byte;
begin
getfms(family,model,stepping);
if family=4 then begin
                   authenticamd.name:='amd 486';
                   authenticamd.vendor:=getvendorstring;

本文关键:delphi cpu id
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top