Now I understand what you want. I will tell you this:
You are in the WRONG section of tech help; this is hardware.
Hardware.
Your talking about CODE. Software.........
So, if you want to look at (look and not steal, of course) some software that does just what your talking about, then what I suggested was HD Manufacturers Diagnostic software.
Like Maxtor "powermax." It gives the Serial # of the hard drive in the software GUI (so you can give it to Maxtor for an RMA).
Now, the trick is,,,,,,, to have YOUR software read all hard drives the same way....... and create a unique identifier.
Doesn't sound that tough (for a software nerd

Hey, I just do hard ware. Try the link on the left.......... .. right next to your last post to go find some S/W TECHIE Forums.
GL