Solved

HDD manufacturer serial number

Posted on 2011-02-20
16
2,489 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
  • +2
16 Comments
 
LVL 47

Accepted Solution

by:
dlethe earned 400 total points
ID: 34939113
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
ID: 34939122
0
 
LVL 19

Assisted Solution

by:Thommy
Thommy earned 100 total points
ID: 34939341
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Assisted Solution

by:dlethe
dlethe earned 400 total points
ID: 34940152
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
ID: 35225043
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
ID: 35225695
How about the SATA ? Any source code ?
0
 
LVL 47

Assisted Solution

by:dlethe
dlethe earned 400 total points
ID: 35225791
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
 

Author Comment

by:sidhi
ID: 35226974
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
ID: 35228913
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
ID: 35229805
@mlmcc
In my opinion the points should be splitted!!!
0
 

Author Comment

by:sidhi
ID: 35252834
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
ID: 35252944
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
ID: 35254902
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
ID: 35473635
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Does your iMac really need a hardware upgrade? Will upgrading RAM speed-up your computer? If yes, then how can you proceed? Upgrading RAM in your iMac is not as simple as it may seem. This article will help you in getting and installing right RA…
This paper addresses the security of Sennheiser DECT Contact Center and Office (CC&O) headsets. It describes the DECT security chain comprised of “Pairing”, “Per Call Authentication” and “Encryption”, which are all part of the standard DECT protocol.

733 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