jimcooper1
asked on
C Code to determine HDD serial number
Does anyone have a code snippet in C that retrieves a Hard Disk Drive serial number (manufacturers number not Volume Serial Number) Most graeful if you would share.
ASKER
Thanks, but I'm really looking for a C solution rather than C++
If you are using Windows, use GetVolumeInformation Win32 API
http://msdn.microsoft.com/en-us/library/aa364993(VS.85).aspx
http://support.microsoft.com/kb/139547
If you are using Linux, you will have to use some ioctls ... look into source code of hdparm
http://sourceforge.net/projects/hdparm/
http://msdn.microsoft.com/en-us/library/aa364993(VS.85).aspx
http://support.microsoft.com/kb/139547
If you are using Linux, you will have to use some ioctls ... look into source code of hdparm
http://sourceforge.net/projects/hdparm/
ASKER
Thanks, but I need the hardware serial number rather than the Volume serial number (and also need the C code rather than C++)
>> Thanks, but I'm really looking for a C solution rather than C++
Please take another look at the link I posted, it references a link to code that is C code (although there is some assembly as well).
http://www.winsim.com/diskid32/
Please take another look at the link I posted, it references a link to code that is C code (although there is some assembly as well).
http://www.winsim.com/diskid32/
ASKER
evilrix,
thanks for the second post, that diskid32.cpp does in fact seem to be C rather than C++. That'll take quite a bit of unpicking for me..best I knuckle down and try to understand it. Hopefully someone might have a simpler solution.
Regards
Jim
thanks for the second post, that diskid32.cpp does in fact seem to be C rather than C++. That'll take quite a bit of unpicking for me..best I knuckle down and try to understand it. Hopefully someone might have a simpler solution.
Regards
Jim
What platform?
>> evilrix, thanks for the second post
No worries.
No worries.
ASKER
What platform??
Win32 (XP and Vista) possibly Win64 as well
Regards
Win32 (XP and Vista) possibly Win64 as well
Regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for that .. although I am proficient at C, I am no Windows API programmer. I think I'll downgrade my self from intermediate to moron!!!
http://www.codeproject.com/KB/mcpp/DriveInfoEx.aspx