۱۶-فروردین-۱۳۹۱, ۰۶:۱۹:۵۴
بدست آوردن مدل سی پی یو و شماره سریال سی پی یو که در 64 بیتی هم کار می کند.
کد:
var
_eax, _ebx, _ecx, _edx: Longword;
i: Integer;
b: Byte;
s, s1, s2, s3, s_all: string;
P:Integer;
const
gn_speed_x: Integer = 8;
gn_text_x: Integer = 15;
gl_start: Boolean = True;
Procedure GetCPUinformation(var SerialNumber,Processor:string);
Procedure ASM1;
Asm
mov eax,0
db $0F,$A2
mov _ebx,ebx
mov _ecx,ecx
mov _edx,edx
end;
Procedure ASM2;
Asm
mov eax,1
db $0F,$A2
mov _eax,eax
mov _ebx,ebx
mov _ecx,ecx
mov _edx,edx
end;
Procedure ASM3;
Asm
mov eax,3
db $0F,$A2
mov _ecx,ecx
mov _edx,edx
end;
Procedure ASM4;
Asm
mov eax,1
db $0F,$A2
mov _edx,edx
end;
Procedure ASM5;
Asm
mov eax,$80000000
db $0F,$A2
mov _eax,eax
end;
Procedure ASM6;
Asm
mov eax,$80000002
db $0F
db $A2
mov _eax,eax
mov _ebx,ebx
mov _ecx,ecx
mov _edx,edx
end;
Procedure ASM7;
Asm
mov eax,$80000003
db $0F
db $A2
mov _eax,eax
mov _ebx,ebx
mov _ecx,ecx
mov _edx,edx
end;
Procedure ASM8;
Asm
mov eax,$80000004
db $0F
db $A2
mov _eax,eax
mov _ebx,ebx
mov _ecx,ecx
mov _edx,edx
end;
Begin
P:=0;
ASM1;
for i := 0 to 3 do
begin
b := lo(_ebx);
s := s + chr(b);
b := lo(_ecx);
s1:= s1 + chr(b);
b := lo(_edx);
s2:= s2 + chr(b);
_ebx := _ebx shr 8;
_ecx := _ecx shr 8;
_edx := _edx shr 8;
end;
Inc(P);
Inc(P);
ASM2;
b := lo(_eax) and 15;
Inc(P);
b := lo(_eax) shr 4;
Inc(P);
b := hi(_eax) and 15;
Inc(P);
b := hi(_eax) shr 4;
Inc(P);
b := lo((_eax shr 16)) and 15;
Inc(P);
b := lo((_eax shr 20));
Inc(P);
b := lo(_ebx);
Inc(P);
b := hi(_ebx);
Inc(P);
b := lo(_ebx shr 16);
Inc(P);
b := hi(_ebx shr 16);
Inc(P);
s := IntToHex(_eax, 8);
ASM3;
s1 := IntToHex(_edx, 8);
s2 := IntToHex(_ecx, 8);
Insert('-', s, 5);
Insert('-', s1, 5);
Insert('-', s2, 5);
Inc(P);
SerialNumber:=Trim(s + '-' + s1 + '-' + s2);
ASM4;
Inc(P);
Inc(P);
ASM5;
if _eax > $80000000 then
begin
Inc(P);
Inc(P);
ASM6;
s := '';
s1 := '';
s2 := '';
s3 := '';
for i := 0 to 3 do
begin
b := lo(_eax);
s3:= s3 + chr(b);
b := lo(_ebx);
s := s + chr(b);
b := lo(_ecx);
s1 := s1 + chr(b);
b := lo(_edx);
s2 := s2 + chr(b);
_eax := _eax shr 8;
_ebx := _ebx shr 8;
_ecx := _ecx shr 8;
_edx := _edx shr 8;
end;
s_all := s3 + s + s1 + s2;
ASM7;
s := '';
s1 := '';
s2 := '';
s3 := '';
for i := 0 to 3 do
begin
b := lo(_eax);
s3 := s3 + chr(b);
b := lo(_ebx);
s := s + chr(b);
b := lo(_ecx);
s1 := s1 + chr(b);
b := lo(_edx);
s2 := s2 + chr(b);
_eax := _eax shr 8;
_ebx := _ebx shr 8;
_ecx := _ecx shr 8;
_edx := _edx shr 8;
end;
s_all := s_all + s3 + s + s1 + s2;
ASM8;
s := '';
s1 := '';
s2 := '';
s3 := '';
for i := 0 to 3 do
begin
b := lo(_eax);
s3 := s3 + chr(b);
b := lo(_ebx);
s := s + chr(b);
b := lo(_ecx);
s1 := s1 + chr(b);
b := lo(_edx);
s2 := s2 + chr(b);
_eax := _eax shr 8;
_ebx := _ebx shr 8;
_ecx := _ecx shr 8;
_edx := _edx shr 8;
end;
Inc(P);
if s2[Length(s2)] = #0 then setlength(s2, Length(s2) - 1);
Inc(P);
Processor:=Trim(s_all + s3 + s + s1 + s2);
end;
End;