I am using Hard disk ID for my software to check if the authentic user is using the software. For IDE type hard disk i get the id using the procedure GetIdeSerialNumber.
but in case of SATA drives it gives the id as blank.
Then in case of SATA drives i am using volume id as unique id.
but volume id will change when system is formatted
Now I want to know which hard drive i am using ,and how to get the hard disk id of SATA drive in delphi 7 ?
EDIT: the software according to client specifications needs to be locked to the hardware, the ID's concerned are
- MAC address
- HD id (SATA or IDE)
- Controller ID (this is motor to drive the hardware of which the software is delvped, the ID is unique)
The client has accpted the if system is changed the the authentication layer will fail, but we have been given the go ahead for the software locking to hardware..
so i wanted to know how to get the SATA ID
WMI is your best bet for retrieving the hard drive serial number, though older versions of Windows (95 and 98) aren't supported.
I recommend that you use the volume serial number. It's hardware agnostic. It will be tied to that installation of Windows instead of the physical hard drive. This makes a lot of sense and should be good enough.
Note that the user will have to reactivate if they reinstall Windows or some other restore situations, so you need to allow some leeway. That's the trickiest part to implement. Of course, that's the reason to use multiple IDs. You allow one or more to change, just not all of them, without requiring reactivation.
来源:https://stackoverflow.com/questions/8831024/hard-disk-id-of-sata-drives