How disk/storage drivers detect a read-only disk?

Do inbox Windows disk drivers detect a read only disk by sending a SCSI
sense command
after write has failed, and looking for SCSI_SENSE_DATA_PROTECT sense code?

Are there other signs of a read-only device, such as some USB storage class
protocol command?

I have an ESATA and USB disk adapter with a write protect switch.
In write-protected state it seems to work with FAT32 formatted disk,
but disk formatted with NTFS fails to mount, and eventlog shows lot of disk
errors.
Suspect that the adapter fails writes with wrong status indication.
How can I check this? what to look for?

Thanks,
– pa

> Do inbox Windows disk drivers detect a read only disk by sending a SCSI

sense command
after write has failed, and looking for SCSI_SENSE_DATA_PROTECT sense code?

Yes. I think so and use this approach in my miniport driver. IIRC it just takes effect in after win2000.

Wayne

The source for the disk driver is in the WDK (src\storage\class\disk), so
you can go look at the code that handles IOCTL_DISK_IS_WRITABLE. This is how
the FSDs determine if the disk is writable or not.

-scott


Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com

“Pavel A.” wrote in message news:xxxxx@ntfsd…
> Do inbox Windows disk drivers detect a read only disk by sending a SCSI
> sense command
> after write has failed, and looking for SCSI_SENSE_DATA_PROTECT sense
> code?
>
> Are there other signs of a read-only device, such as some USB storage
> class protocol command?
>
> I have an ESATA and USB disk adapter with a write protect switch.
> In write-protected state it seems to work with FAT32 formatted disk,
> but disk formatted with NTFS fails to mount, and eventlog shows lot of
> disk errors.
> Suspect that the adapter fails writes with wrong status indication.
> How can I check this? what to look for?
>
> Thanks,
> – pa
>

“Wayne Gong” wrote in message news:xxxxx@ntfsd…
>> Do inbox Windows disk drivers detect a read only disk by sending a SCSI
>> sense command
>> after write has failed, and looking for SCSI_SENSE_DATA_PROTECT sense
>> code?
>
> Yes. I think so and use this approach in my miniport driver. IIRC it just
> takes effect in after win2000.
>
> Wayne

Thanks, Wayne. I’ve asked the maker of this device, and they replied that
they
already implemented SCSI_SENSE_DATA_PROTECT - but for whatever
reason it does not work well with win7, so they are going to try some other
idea.

Regards,
–pa