Mega Code Archive

 
Categories / Delphi / Examples
 

Detect the hd serial number

Use this code to detect the hard disk's serial number: Thanks to Jonathan Arnett for a corrected version of previously posted code. uses SysUtils, Dialogs, Windows; function HDD_Serial : string; var SerialNum : dword; a, b : dword; Buffer : array [0..255] of char; begin if GetVolumeInformation('c:\', Buffer, SizeOf(Buffer), @SerialNum, a, b, nil, 0) then Result := IntToHex(SerialNum, 8) else Result := ''; end;