DelphiFAQ Home Search:

Detect the HD serial number

 

comments8 comments. Current rating: 3 stars (3 votes). Leave comments and/ or rate it.

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;

Comments:

2006-01-04, 08:38:19
Saysansay@yahoo.com from Indonesia  
Nice, ok Can U Help Me How To Detec MotherBord,Vga card, Lan Card Etc Serial Number
Tank's Before
2006-11-09, 09:53:24
anonymous from Poland  
It's partition serial number
2007-01-11, 21:49:01
anonymous from Romania  
rating
EXCELENT!!! i was looking for this for a verry long time
2007-01-24, 15:42:16
anonymous from United States  
rating
Correct, this is not useful as partition serial number and it can be changed after deleting and creating a new partition or by editing particular sector of a hard drive. It is not hard drive serial number exactly! Serial number you can get through hardware ports or with hardware library that allows direct access to the hardware under Win32.
2007-02-03, 03:32:58
anonymous from Iran  
please help me to how configuration the version & model of the modem & cdrom of the
pc .
thanks.
2007-02-25, 03:45:22
anonymous from Iran  
Thanks.
But I Want HDD phisical serial Number No Volume Info.
Can You Hel Me !
2007-08-06, 15:51:23
marxjo from Poland  
rating
You get partition serial numeber that is always different when you format it. Next time, this value is completely different.
2008-02-23, 04:28:54
anonymous from Czech Republic  
Very g00d :)

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Washington, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.