Serial Físico do hd

Delphi

29/11/2013

olá, pessoal alguém conhece uma função que retorne o serial físico do hd? grato.
Marcos Morais

Marcos Morais

Curtidas 0

Respostas

Luiz Eduardo

Luiz Eduardo

29/11/2013

Maneira mais fácil é usando a WMI.
GOSTEI 0
Gustavo Bretas

Gustavo Bretas

29/11/2013

Segue:

function SerialNum(FDrive: String): String;
Var
  Serial: DWord;
  DirLen, Flags: DWord;
  DLabel: Array [0 .. 11] of Char;
begin
  Try
    GetVolumeInformation(PChar(FDrive + ':\'), DLabel, 12, @Serial, DirLen, Flags, nil, 0);
    Result := IntToHex(Serial, 8);
  Except
    Result := '';
  end;
end;
GOSTEI 0
POSTAR