I want to get physical disk serialnumber from sata disk. Before i got the number through IOCTL_ATA_PASS_THROUGH from my application. but one of my office PC doesn’t give me serialnumber of hard disk.
PC details.
vista 32 bit service pack 1.
SATA Disk
driver NVDIA nforce serial ATA controller
Disk lies under SCSI port.
so i couldn’t get the disk serialnumber through “IOCTL_ATA_PASS_THROUGH”.
Now, i want to write a driver to get serialnumber from disk.
I ask your help, to give me the direction for which type of driver should give me serialnumber information from directly from disk by pass my pc NVDIA nforce serial ATA controller driver.
Need help,
Regards,
k.karthikeyan
use scsi passthrough and read the scsi serial number from the appropriate
mode page. See the scsi specs for details.
http://www.t10.org/cgi-bin/ac.pl?t=f&f=spc3r23.pdf
Page 80 or 83 generally work.
Generically - use scsi pass through first and then if that doesn’t work try
other methods.
Mark Roddy
On Sat, Dec 6, 2008 at 9:58 AM, wrote:
> I want to get physical disk serialnumber from sata disk. Before i got the
> number through IOCTL_ATA_PASS_THROUGH from my application. but one of my
> office PC doesn’t give me serialnumber of hard disk.
>
> PC details.
> vista 32 bit service pack 1.
> SATA Disk
> driver NVDIA nforce serial ATA controller
> Disk lies under SCSI port.
>
> so i couldn’t get the disk serialnumber through “IOCTL_ATA_PASS_THROUGH”.
>
> Now, i want to write a driver to get serialnumber from disk.
>
> I ask your help, to give me the direction for which type of driver should
> give me serialnumber information from directly from disk by pass my pc
> NVDIA nforce serial ATA controller driver.
>
> Need help,
> Regards,
> k.karthikeyan
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Hi,
Thank you for your reply.
I allready tried scsi pass through. It doesn’t work.
Please let me know Any other method.
Regards,
k.karthikeyan
What didn’t work about it? It is possible that the nvidia miniport doesn’t
provide the translation support, but it is also possible that you are simply
not implementing the requests correctly.
Mark Roddy
On Sat, Dec 6, 2008 at 12:02 PM, wrote:
> Hi,
>
> Thank you for your reply.
> I allready tried scsi pass through. It doesn’t work.
> Please let me know Any other method.
>
> Regards,
> k.karthikeyan
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
In scsi pass through i get product id, vendorid,version but not serial number.
Any ideas?
Regards,
k.karthikeyan
You still haven’t shown us “what doesn’t work”.
However, from the sparse clues below all you’re reading is the
standard inquiry data. The disk (or device) serial number comes from
Page 83h. It’s been a Windows requirement for a number of years that
disks have a unique ID in Page 83h but it’s still a remote
possibility that you may come across the odd legacy disk that doesn’t
support it.
Suggest you look at IOCTL_STORAGE_QUERY_PROPERTY, it’s a little more
complex but will retrieve the data you’re after.
Mark.
At 22:58 06/12/2008, xxxxx@yahoo.com wrote:
In scsi pass through i get product id, vendorid,version but not serial number.
Any ideas?
Regards,
k.karthikeyan
HDD Model: ST3160211AS
Size: 150GB
Interface Type: Serial ATA II
/////my code help from windows ddk spti.c
SCSI_PASS_THROUGH_WITH_BUFFERS sptwb;
ZeroMemory(&sptwb,sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS));
sptwb.spt.Length = sizeof(SCSI_PASS_THROUGH);
sptwb.spt.PathId = 0;
sptwb.spt.TargetId = 0;
sptwb.spt.Lun = 0;
sptwb.spt.CdbLength = CDB6GENERIC_LENGTH;
sptwb.spt.SenseInfoLength = SPT_SENSE_LENGTH;
sptwb.spt.DataIn = SCSI_IOCTL_DATA_IN;
sptwb.spt.DataTransferLength = 192;
sptwb.spt.TimeOutValue = 10;
sptwb.spt.DataBufferOffset =
offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucDataBuf);
sptwb.spt.SenseInfoOffset =
offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucSenseBuf);
sptwb.spt.Cdb[0] = SCSIOP_INQUIRY;
sptwb.spt.Cdb[2] = 0x83;
sptwb.spt.Cdb[4] = 192;
length = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucDataBuf) +
sptwb.spt.DataTransferLength;
status = DeviceIoControl(fileHandle,
IOCTL_SCSI_PASS_THROUGH,
&sptwb,
sizeof(SCSI_PASS_THROUGH),
&sptwb,
length,
&returned,
FALSE);
PrintStatusResults(status,returned,&sptwb,length);
This code doesn’t give me HDD serialnumber.
Any problem in this code.
please let me know.
Try adding Cdb[1] = 1.
xxxxx@yahoo.com
Sent by: xxxxx@lists.osr.com
12/06/2008 09:49 PM
Please respond to
“Windows System Software Devs Interest List”
To
“Windows System Software Devs Interest List”
cc
Subject
RE:[ntdev] Get physical disk serialnumber
HDD Model: ST3160211AS
Size: 150GB
Interface Type: Serial ATA II
/////my code help from windows ddk spti.c
SCSI_PASS_THROUGH_WITH_BUFFERS sptwb;
ZeroMemory(&sptwb,sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS));
sptwb.spt.Length = sizeof(SCSI_PASS_THROUGH);
sptwb.spt.PathId = 0;
sptwb.spt.TargetId = 0;
sptwb.spt.Lun = 0;
sptwb.spt.CdbLength = CDB6GENERIC_LENGTH;
sptwb.spt.SenseInfoLength = SPT_SENSE_LENGTH;
sptwb.spt.DataIn = SCSI_IOCTL_DATA_IN;
sptwb.spt.DataTransferLength = 192;
sptwb.spt.TimeOutValue = 10;
sptwb.spt.DataBufferOffset =
offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucDataBuf);
sptwb.spt.SenseInfoOffset =
offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucSenseBuf);
sptwb.spt.Cdb[0] = SCSIOP_INQUIRY;
sptwb.spt.Cdb[2] = 0x83;
sptwb.spt.Cdb[4] = 192;
length = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucDataBuf) +
sptwb.spt.DataTransferLength;
status = DeviceIoControl(fileHandle,
IOCTL_SCSI_PASS_THROUGH,
&sptwb,
sizeof(SCSI_PASS_THROUGH),
&sptwb,
length,
&returned,
FALSE);
PrintStatusResults(status,returned,&sptwb,length);
This code doesn’t give me HDD serialnumber.
Any problem in this code.
please let me know.
—
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
And if 83 flunks try 80.
Mark Roddy
On Sat, Dec 6, 2008 at 10:38 PM, wrote:
>
> Try adding Cdb[1] = 1.
>
>
>
> xxxxx@yahoo.com
> Sent by: xxxxx@lists.osr.com
>
> 12/06/2008 09:49 PM
> Please respond to
> “Windows System Software Devs Interest List”
>
> To
> “Windows System Software Devs Interest List” cc
> Subject
> RE:[ntdev] Get physical disk serialnumber
>
>
>
>
> HDD Model: ST3160211AS
> Size: 150GB
> Interface Type: Serial ATA II
>
> /////my code help from windows ddk spti.c
> SCSI_PASS_THROUGH_WITH_BUFFERS sptwb;
>
> ZeroMemory(&sptwb,sizeof(SCSI_PASS_THROUGH_WITH_BUFFERS));
> sptwb.spt.Length = sizeof(SCSI_PASS_THROUGH);
> sptwb.spt.PathId = 0;
> sptwb.spt.TargetId = 0;
> sptwb.spt.Lun = 0;
> sptwb.spt.CdbLength = CDB6GENERIC_LENGTH;
> sptwb.spt.SenseInfoLength = SPT_SENSE_LENGTH;
> sptwb.spt.DataIn = SCSI_IOCTL_DATA_IN;
> sptwb.spt.DataTransferLength = 192;
> sptwb.spt.TimeOutValue = 10;
> sptwb.spt.DataBufferOffset =
> offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucDataBuf);
> sptwb.spt.SenseInfoOffset =
> offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucSenseBuf);
>
> sptwb.spt.Cdb[0] = SCSIOP_INQUIRY;
> sptwb.spt.Cdb[2] = 0x83;
> sptwb.spt.Cdb[4] = 192;
> length = offsetof(SCSI_PASS_THROUGH_WITH_BUFFERS,ucDataBuf) +
> sptwb.spt.DataTransferLength;
>
> status = DeviceIoControl(fileHandle,
> IOCTL_SCSI_PASS_THROUGH,
> &sptwb,
> sizeof(SCSI_PASS_THROUGH),
> &sptwb,
> length,
> &returned,
> FALSE);
>
> PrintStatusResults(status,returned,&sptwb,length);
>
>
> This code doesn’t give me HDD serialnumber.
>
> Any problem in this code.
>
> please let me know.
>
>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
IOCTL_STORAGE_QUERY_PROPERTY only gets the serial number on some releases of
the OS, on others it doesn’t. Probably the correct algorithm is:
first try IOCTL_STORAGE_QUERY_PROPERTY,
then try SPT page 83 then try SPT page 80 then give up or try AT pass
through.
Mark Roddy
On Sat, Dec 6, 2008 at 7:23 PM, Mark S. Edwards wrote:
> You still haven’t shown us “what doesn’t work”.
>
> However, from the sparse clues below all you’re reading is the standard
> inquiry data. The disk (or device) serial number comes from Page 83h. It’s
> been a Windows requirement for a number of years that disks have a unique ID
> in Page 83h but it’s still a remote possibility that you may come across the
> odd legacy disk that doesn’t support it.
>
> Suggest you look at IOCTL_STORAGE_QUERY_PROPERTY, it’s a little more
> complex but will retrieve the data you’re after.
>
> Mark.
>
>
>
> At 22:58 06/12/2008, xxxxx@yahoo.com wrote:
>
>> In scsi pass through i get product id, vendorid,version but not serial
>> number.
>>
>>
>> Any ideas?
>>
>> Regards,
>> k.karthikeyan
>>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Also be aware that IOCTL_STORAGE_QUERY_PROPERTY changed the way it decoded
the serial number on Vista, i.e. issue the call on a system with XP, then
upgrade to Vista and issue the same call to the same disk and you will get a
different result.
–
Don Burn (MVP, Windows DDK)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
“Mark Roddy” wrote in message news:xxxxx@ntdev…
> IOCTL_STORAGE_QUERY_PROPERTY only gets the serial number on some releases
> of
> the OS, on others it doesn’t. Probably the correct algorithm is:
> first try IOCTL_STORAGE_QUERY_PROPERTY,
> then try SPT page 83 then try SPT page 80 then give up or try AT pass
> through.
> Mark Roddy
>
>
> On Sat, Dec 6, 2008 at 7:23 PM, Mark S. Edwards
> wrote:
>
>> You still haven’t shown us “what doesn’t work”.
>>
>> However, from the sparse clues below all you’re reading is the standard
>> inquiry data. The disk (or device) serial number comes from Page 83h.
>> It’s
>> been a Windows requirement for a number of years that disks have a unique
>> ID
>> in Page 83h but it’s still a remote possibility that you may come across
>> the
>> odd legacy disk that doesn’t support it.
>>
>> Suggest you look at IOCTL_STORAGE_QUERY_PROPERTY, it’s a little more
>> complex but will retrieve the data you’re after.
>>
>> Mark.
>>
>>
>>
>> At 22:58 06/12/2008, xxxxx@yahoo.com wrote:
>>
>>> In scsi pass through i get product id, vendorid,version but not serial
>>> number.
>>>
>>>
>>> Any ideas?
>>>
>>> Regards,
>>> k.karthikeyan
>>>
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
Hi,
Thanks for your reply.
I tried IOCTL_STORAGE_QUERY_PROPERTY it gives me everything except “Serialnumber”. Serialnumber field is blank in IOCTL_STORAGE_QUERY_PROPERTY .
In SCSI_PASS_THROUGH i tried with Cdb[1] = 1 for page 83 and also 80.
It doesn’t give me SerialNumber.
In ATA_PASS_THROUGH returns invalid function error on Deviceiocontrol. My current driver is “NVDIA nforce serial ATA controller”. If i change the driver into Vista default IDE dual driver. I got what i want through "ATA_PASS_THROUGH " as well as IOCTL_STORAGE_QUERY_PROPERTY.
But i want to get my serial number with out driver concern, so i want to write a driver which can gives me my serial number. Here my problem is which level driver i have to write, (i tried on Disk lower level filter driver it doesn’t give me my result). Please guide me Which level driver i have to write for this problem.
Thank you,
Regards,
k.karthikeyan
hi again,
Is there any way to use atapi.sys Virtually for my physical disk to get serialnumber via ATA_PASS_THROUGH. whith out changing the current driver controller for my physical disk[now my current controller is “NVDIA nforce serial ATA controller”].
I dont know where to start. Please guide me.
Regards,
k.karthikeyan
No that doesn’t make much sense. The nvidia driver is the lowest level
driver, somehow putting atapi.sys in the stack isn’t going to alter that.
Mark Roddy
On Mon, Dec 8, 2008 at 2:11 AM, wrote:
> hi again,
>
> Is there any way to use atapi.sys Virtually for my physical disk to get
> serialnumber via ATA_PASS_THROUGH. whith out changing the current driver
> controller for my physical disk[now my current controller is “NVDIA nforce
> serial ATA controller”].
>
> I dont know where to start. Please guide me.
>
> Regards,
> k.karthikeyan
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Hi,
Is there any other way to get hard disk serial number.
If the miniport doesn’t support scsi-sata conversion of mode page requests
then you are out of luck here. I would conduct two experiments to confirm
that it is the miniport.
-
try a different disk from a different vendor on the same system with the
nvidia driver.
-
move the offending disk to a different system with a different scsiport
based sata driver, or plug a third party sas/sata card into the same system
and connect the disk to it (lsi, adaptec, etc.) and validate that your
software is working correctly. FYI I can confirm that both lsi and adaptec
scsi miniports correctly provide the disk serial number mode pages (80 or
-
for sata disks.
Either your software continues to be broken or the nvidia miniport is
disfunctional.
Mark Roddy
On Mon, Dec 8, 2008 at 8:07 AM, wrote:
> Hi,
> Is there any other way to get hard disk serial number.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>