Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Serial Number of an IDE Hard Disk

OSR_Community_UserOSR_Community_User Member Posts: 110,217
Hi All,
How can we obtain the Serial number of an IDE Hard Disk using
standard method ie from DeviceIoControl. From the spec, the words 10-19 in
the Identify Device represents the Serial number.

But if i issue the IOCTL_SCSI_GET_INQUIRY_DATA, the returned buffer doesnot
contain the Serial Number. If i read the Identify Device info from within my
driver, i am getting the Serial Number. Am i missing something? Why the
standard ATA driver is not copying the Serial number to the return buffer?

Is there any other way to obtain the serial number/ uniquely identify the
drive.

I also need to findout which all drive letters are mapped to a specific hard
disk.. in 95 there are some std VxD services available which may give the
driveletters provided with the disk number. In NT, we don't have any such
unique number for the hard disks...right ?

//
I need some mechanism to Uniquely Identify a Hard Disk. I am hoping that the
disk serial number may help.

Thanks in Advance

balan

Comments

  • Hi,
    The harddisk signature can uniquely identify a harddisk in NT.
    Similarly Serial Number can identify a partition.

    To get the serial number do a CreateFile for \??\PHYSICALDRIVE0
    where 0 is ur harddisk number as shown by windisk.

    Then do a DeviceIoControl with IOCTL --> IOCTL_DISK_GET_DRIVE_LAYOUT
    The returned DRIVE_LAYOUT_INFORMATION structure contains all info.

    regards
    Sumtush

    >-----Original Message-----
    >Hi All,
    > How can we obtain the Serial number of an IDE Hard Disk using
    >standard method ie from DeviceIoControl. From the spec, the words 10-19 in
    >the Identify Device represents the Serial number.
    >
    >But if i issue the IOCTL_SCSI_GET_INQUIRY_DATA, the returned buffer doesnot
    >contain the Serial Number. If i read the Identify Device info from within
    >my
    >driver, i am getting the Serial Number. Am i missing something? Why the
    >standard ATA driver is not copying the Serial number to the return buffer?
    >
    >Is there any other way to obtain the serial number/ uniquely identify the
    >drive.
    >
    >I also need to findout which all drive letters are mapped to a specific
    >hard
    >disk.. in 95 there are some std VxD services available which may give the
    >driveletters provided with the disk number. In NT, we don't have any such
    >unique number for the hard disks...right ?
    >
    >I need some mechanism to Uniquely Identify a Hard Disk. I am hoping that
    >the
    >disk serial number may help.
    >
    >Thanks in Advance
    >
    >balan

    ______________________________________________________
    Get Your Private, Free Email at http://www.hotmail.com
  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,663
    Serial numbers are not disk signatures.

    The disk serial number is a requirement for SCSI-II compatible disk devices.
    It unfortunately is not a requirement for IDE drives.

    There is a defect in ScsiPort that does not return valid results for the
    serial number from a call to IOCTL_SCSI_GET_INQUIRY_DATA. Instead for SCSI
    disks you have to do it the old fashioned way and read the Inquiry data
    directly.

    For IDE drives your are stuck. The best you could do is to use the NT
    supplied disk signature. Note that a disk signature is a binary value while
    the disk serial nubmer is an ascii string.

    -----Original Message-----
    From: [email protected]
    [mailto:[email protected]]On Behalf Of Tushar Banerjee
    Sent: Tuesday, April 18, 2000 5:43 AM
    To: NT Developers Interest List
    Subject: [ntdev] RE: Serial Number of an IDE Hard Disk


    Hi,
    The harddisk signature can uniquely identify a harddisk in NT.
    Similarly Serial Number can identify a partition.

    To get the serial number do a CreateFile for \??\PHYSICALDRIVE0
    where 0 is ur harddisk number as shown by windisk.

    Then do a DeviceIoControl with IOCTL --> IOCTL_DISK_GET_DRIVE_LAYOUT
    The returned DRIVE_LAYOUT_INFORMATION structure contains all info.

    regards
    Sumtush

    >-----Original Message-----
    >Hi All,
    > How can we obtain the Serial number of an IDE Hard Disk using
    >standard method ie from DeviceIoControl. From the spec, the words 10-19 in
    >the Identify Device represents the Serial number.
    >
    >But if i issue the IOCTL_SCSI_GET_INQUIRY_DATA, the returned buffer doesnot
    >contain the Serial Number. If i read the Identify Device info from within
    >my
    >driver, i am getting the Serial Number. Am i missing something? Why the
    >standard ATA driver is not copying the Serial number to the return buffer?
    >
    >Is there any other way to obtain the serial number/ uniquely identify the
    >drive.
    >
    >I also need to findout which all drive letters are mapped to a specific
    >hard
    >disk.. in 95 there are some std VxD services available which may give the
    >driveletters provided with the disk number. In NT, we don't have any such
    >unique number for the hard disks...right ?
    >
    >I need some mechanism to Uniquely Identify a Hard Disk. I am hoping that
    >the
    >disk serial number may help.
    >
    >Thanks in Advance
    >
    >balan

    ______________________________________________________
    Get Your Private, Free Email at http://www.hotmail.com


    ---
    You are currently subscribed to ntdev as: [email protected]
    To unsubscribe send a blank email to $subst('Email.Unsub')
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    If you get the disk layout, (IOCTL_DISK_GET_LAYOUT?
    GET_PARTIION_INFOMRATION? I'd have to look, just take a peek in the docs)
    One of the fields in the returned structure is the volume signature. This
    may be sufficient for you, maybe not. For non-scsi devices, you can't
    expect all the mode pages to work. In fact, you can't expect ANY of them to
    work, though some are emulated.

    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of BALAN
    > Sent: Tuesday, April 18, 2000 4:21 AM
    > To: NT Developers Interest List
    > Subject: [ntdev] Serial Number of an IDE Hard Disk
    >
    >
    > Hi All,
    > How can we obtain the Serial number of an IDE Hard Disk using
    > standard method ie from DeviceIoControl. From the spec, the words 10-19 in
    > the Identify Device represents the Serial number.
    >
    > But if i issue the IOCTL_SCSI_GET_INQUIRY_DATA, the returned
    > buffer doesnot
    > contain the Serial Number. If i read the Identify Device info
    > from within my
    > driver, i am getting the Serial Number. Am i missing something? Why the
    > standard ATA driver is not copying the Serial number to the return buffer?
    >
    > Is there any other way to obtain the serial number/ uniquely identify the
    > drive.
    >
    > I also need to findout which all drive letters are mapped to a
    > specific hard
    > disk.. in 95 there are some std VxD services available which may give the
    > driveletters provided with the disk number. In NT, we don't have any such
    > unique number for the hard disks...right ?
    >
    > //
    > I need some mechanism to Uniquely Identify a Hard Disk. I am
    > hoping that the
    > disk serial number may help.
    >
    > Thanks in Advance
    >
    > balan
    >
    >
    > ---
    > You are currently subscribed to ntdev as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 16-20 October 2023 Live, Online
Developing Minifilters 13-17 November 2023 Live, Online
Internals & Software Drivers 4-8 Dec 2023 Live, Online
Writing WDF Drivers 10-14 July 2023 Live, Online