Solved

HDD manufacturer serial number

Posted on 2011-02-20
16
2,346 Views
Last Modified: 2012-05-11
How to obtain the HDD manufacturer serial number which works for Extract physical serial number for IDE, RAID IDE, SCSI, RAID SCSI, SATA, RAID SATA, SATA2, RAID SATA2, SATA3, RAID SATA3 in Windows 98, ME, NT, 2000, 2003, 2008, XP, Vista, 7 in DELPHI.

in both 32 or 64 OS.
Please provide me the source code in DELPHI.

PS :Do not give me the source code which based on volume C or D or E drives.
0
Comment
Question by:sidhi
  • 6
  • 4
  • 2
  • +2
16 Comments
 
LVL 47

Accepted Solution

by:
dlethe earned 400 total points
Comment Utility
This isn't possible or practical for all hardware.  Every RAID controller has vendor-specific APIs, and not all controllers even have the intelligence or architecture to facilitate pass-through commands to get to the disks.

Now getting JBOD is a different thing entirely, .. but it is a lot of work (I know, I've done it, plus have support for maybe a dozen RAID controllers).   but this would still require thousands of hours of development time.  ATA/IDE/SATA uses one family of IOCTLS, and is easiest, but WinME/Win9x uses different code from WInNT/2K'  same source code can be used between win 2k/2k3/2k8, but Vista/Win7 needs to be a little different;

SCSI/SAS/FC/USB-attached  uses SCSI command-set.  ATA/SATA/IDE uses ATA command-set.  But even on JBOD, SATA disks may use SCSI command-set depending on the motherboard & controller.

The location of serial numbers is standardized for disks that speak the native ATA commands, but the SCSI spec allows serial numbers to be in one of several places, so you have to go through a list of a dozen places.

Also if you are using 64-bit O/S then pass-through commands don't work properly, so you have to make sure your source code compiles.

So just forget this project, the best you can do is read serial numbers from the registry, but all anybody has to do is change the registry entry and the info is not valid.  Also in many cases, depending on the specific O/S & hardware config, the registry entries are also wrong.

0
 
LVL 3

Expert Comment

by:maosalah
Comment Utility
0
 
LVL 19

Assisted Solution

by:Thommy
Thommy earned 100 total points
Comment Utility
Check following resources...

Retrieving volume's (disk / drive) serial number
http://delphi.about.com/od/windowsshellapi/a/volumeserial.htm

Read HDD serial number
http://www.delphipages.com/forum/showthread.php?t=202273

IDE harddisk serial number
http://www.delphi3000.com/articles/article_1164.asp?SK=

How can I get H.D.D serial number and CPU serial too?
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/7003d7ae-90b5-41d0-b113-67e9301c8eec/
0
 
LVL 47

Assisted Solution

by:dlethe
dlethe earned 400 total points
Comment Utility
I response to the other advice
1) Retrieving the volume serial number is useless, as this can be changed any time via the registry
2) The ReadHDD seriial # logic is CORRECT.  However it is only valid for ATA/SATA, but this IOCTL will not work for WinMe -> Win7.  MSFT has other IOCTLs, depending on what O/S you have.  
Also the IOCTL will break for a SAS+SATA controller, and SCSI, FC, SAS controllers.  It only deals with the ATA command0set

The IDE link includes other code for the older MS O/Ss, but it still won't help with anything but a direct-connect non-RAID ATA/IDE drive.  It also has same constraints I mentioned before.


0
 
LVL 47

Expert Comment

by:dlethe
Comment Utility
I object, the answer #34939113 is correct.  Nothing on the planet will work with everything, because it is all vendor/product specific, but feel free to award points to other authors as they did provide links to some code that will work for a few types of non-RAID disks.
0
 

Author Comment

by:sidhi
Comment Utility
How about the SATA ? Any source code ?
0
 
LVL 47

Assisted Solution

by:dlethe
dlethe earned 400 total points
Comment Utility
SATA is where it starts to get difficult, because you have to use different pass-through code depending on whether the disk is emulating an IDE disk using the ATA instruction set, or if it is attached to a SAS/SATA controller; or a RAID controller in non-RAID mode, or RAID controller in RAID mode.

If RAID controller, then it is vendor specific.  Beyond that, if it is attached to a SAS/SATA controller you have to "speak" SCSI commands to it, and encapsulate SATA commands, which may be 12 or 16 bytes long, depending on controller.   The problem, is if you take a shortcut and just speak to the disk as if it is a SCSI-attached SATA, then the serial number field typically isn't available.  It can be in one of a half-dozen places, it it is anywhere at all.    The bridge chips used by the SATA disks on the SAS/SATA controllers aren't all standardized.

So I don't have anything I can (well, am willing to give you), as the only code that I know of that handles it is stuff that I wrote, and there are thousands of lines of code relating to discovery alone.  

(That is another issue .. you have to FIND the drive, and then query the hardware to figure out what interface it uses.  Even a complete discovery is going to take several hundred lines of code, because you don't want it to break if somebody is doing things like using software based RAID, or a disk is spundown/failed'; or a RAID controller is attached
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:sidhi
Comment Utility
If that's so why the Seagate / WD were able to make a program named drivedetect (seagate) or datalifeguard(WD). Which both of them able to read our HDD serial number ?

for examples :
- WD the HDD serial number is like WD-WCAYU4xxxxxx
- Seagate the HDD serial number is like  5YD2xxxx

So how to get the Manufacture Serial Number ?

PS : Seagate HDD serial number almost similar with the one mentioned above about Volume Serial Number.
0
 
LVL 47

Assisted Solution

by:dlethe
dlethe earned 400 total points
Comment Utility
That program only works with a few interface types.  It certainly does not work with RAID, nor will it work with all bridge chips, not by a long shot.  It wont work with most HP controllers, even if they are in NON-RAID mode.

Too many options.  I assure you to get the little that SEAGATE returns, you are talking hundreds of hours worth of development, and that is just for WinXP+.
32 vs 64 bit is different.
The low-level APIs are different for Win2K/NT, then WinXP.  It isn't even possible to compile a program that will support even all the 32-bit operating systems, with just a single transport, unless the program basically is a wrapper that includes programs compiled with the various WinDDK libraries.

Look, you are asking for a program that runs on every flavor of windows on the planet, that works with all possible proprietary disk interfaces, whether open, closed, with or without documentation, that can query internal fields that may not even exist in the first place.    I forgot to mention, there is no requirement for a unique serial number in some versions of the specs, so you WILL find disks that don't have it no matter what.

0
 
LVL 19

Expert Comment

by:Thommy
Comment Utility
@mlmcc
In my opinion the points should be splitted!!!
0
 

Author Comment

by:sidhi
Comment Utility
should be spiltted... then any body know how to get the SN from SATA HDD for Win XP only on Delphi ?
0
 
LVL 47

Expert Comment

by:dlethe
Comment Utility
same issue doing a SATA HDD for ANY operating system.  There are many ways to connect an ATA device, and the protocol changes with the type of physical connection.  A SATA disk will speak SCSI protocol if the disk is attached to a SAS/SATA controller, or in general if attached to any kind of RAID controller.  But attach it to a USB enclosure, and you need a huge database of vendor-specific stuff to determine what pass-thr0ugh mechanism is appropriate
0
 

Author Comment

by:sidhi
Comment Utility
Just make it simple. anybody has the source code in DELPHI so I could get the HDD Serial Number ?
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This is about my first experience with programming Arduino.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now