Thread: Api for getting hard drive's serial no.

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    70

    Api for getting hard drive's serial no.

    Which api can I used to get hard drive's serial number ?
    Can anybody please help me.......
    Chintan R Naik

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Well I not on a windows machine at the second so I can't look at the Platform SDK. But I'm pretty sure you are looking for EnumDevices() or something like that.

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Okay, ignore my ramblings That is completely wrong. I'm taking a look on msdn to see what is available.

    Ah here we go:

    Code:
    BOOL GetVolumeInformation(
      LPCTSTR lpRootPathName,
      LPTSTR lpVolumeNameBuffer,
      DWORD nVolumeNameSize,
      LPDWORD lpVolumeSerialNumber,
      LPDWORD lpMaximumComponentLength,
      LPDWORD lpFileSystemFlags,
      LPTSTR lpFileSystemNameBuffer,
      DWORD nFileSystemNameSize
    );
    Enjoy!

  4. #4
    Registered User
    Join Date
    Jun 2003
    Posts
    70

    code:----------------------------------------------------------------------------
    BOOL GetVolumeInformation(
    LPCTSTR lpRootPathName,
    LPTSTR lpVolumeNameBuffer,
    DWORD nVolumeNameSize,
    LPDWORD lpVolumeSerialNumber,
    LPDWORD lpMaximumComponentLength,
    LPDWORD lpFileSystemFlags,
    LPTSTR lpFileSystemNameBuffer,
    DWORD nFileSystemNameSize
    );
    --------------------------------------------------------------------------------


    But GetVolumeInformation() works for partitions just like C:, D:, and so on.....

    Does it gives hard drive's serial number or partition's serial number ?
    Chintan R Naik

  5. #5
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Originally posted by cr_naik

    code:----------------------------------------------------------------------------
    BOOL GetVolumeInformation(
    LPCTSTR lpRootPathName,
    LPTSTR lpVolumeNameBuffer,
    DWORD nVolumeNameSize,
    LPDWORD lpVolumeSerialNumber,
    LPDWORD lpMaximumComponentLength,
    LPDWORD lpFileSystemFlags,
    LPTSTR lpFileSystemNameBuffer,
    DWORD nFileSystemNameSize
    );
    --------------------------------------------------------------------------------


    But GetVolumeInformation() works for partitions just like C:, D:, and so on.....

    Does it gives hard drive's serial number or partition's serial number ?
    Judging by the 4th parameter of the function; yes, it does. You could try looking it up on MSDN.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hard Drives & Directories
    By magic in forum Windows Programming
    Replies: 4
    Last Post: 09-19-2003, 12:22 PM
  2. C API for Hard Ware Configuration
    By skumar in forum C Programming
    Replies: 5
    Last Post: 11-15-2002, 02:58 AM
  3. installing hard drives and IDE cables...
    By dbaryl in forum Tech Board
    Replies: 14
    Last Post: 09-02-2002, 10:11 AM
  4. Getting the hard drive serial number?
    By kes103 in forum Windows Programming
    Replies: 2
    Last Post: 01-18-2002, 03:03 PM
  5. Getting the hard drive serial number?
    By kes103 in forum C Programming
    Replies: 2
    Last Post: 01-18-2002, 01:43 PM