lire le N° de série du processeur et le N° de série du disque Avec delphi
Code Source
implementation
function getserial : string;
var v1,v2,v3,v4 : longword;
begin
asm
push edx
push ecx
push ebx
push eax
mov eax,2
db $f
db $a2
mov v1,edx
mov v2,eax
mov v3,ebx
mov v4,ecx
pop eax
pop ebx
pop ecx
pop edx
end;
getserial :=
inttohex(v1,8)+'-'+inttohex(v2,8)+'-'+inttohex(v3,8)+'-'+inttohex(v4,8);
end;
function GetSerialIDEx: string;
var
VolumeSerialNumber : DWORD;
MaximumComponentLength : DWORD;
FileSystemFlags : DWORD;
SerialNumber : string;
begin
GetVolumeInformation('C:',nil,0,@VolumeSerialNumber,
MaximumComponentLength,
FileSystemFlags,nil,0);
SerialNumber := IntToHex(HiWord(VolumeSerialNumber), 4) +'-' +
IntToHex(LoWord(VolumeSerialNumber), 4);
Result:=SerialNumber;
end;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.Text:=getserial;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit2.Text:=GetSerialIDEx;
end;
end.
function getserial : string;
var v1,v2,v3,v4 : longword;
begin
asm
push edx
push ecx
push ebx
push eax
mov eax,2
db $f
db $a2
mov v1,edx
mov v2,eax
mov v3,ebx
mov v4,ecx
pop eax
pop ebx
pop ecx
pop edx
end;
getserial :=
inttohex(v1,8)+'-'+inttohex(v2,8)+'-'+inttohex(v3,8)+'-'+inttohex(v4,8);
end;
function GetSerialIDEx: string;
var
VolumeSerialNumber : DWORD;
MaximumComponentLength : DWORD;
FileSystemFlags : DWORD;
SerialNumber : string;
begin
GetVolumeInformation('C:',nil,0,@VolumeSerialNumber,
MaximumComponentLength,
FileSystemFlags,nil,0);
SerialNumber := IntToHex(HiWord(VolumeSerialNumber), 4) +'-' +
IntToHex(LoWord(VolumeSerialNumber), 4);
Result:=SerialNumber;
end;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.Text:=getserial;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit2.Text:=GetSerialIDEx;
end;
end.