How to export a read-only disk from a virtual storport miniport driver?

I have a virtual storport miniport driver and am trying to use to export a read-only disk device on which is installed an NTFS partition. If this were a full disk device driver I could return STATUS_MEDIA_WRITE_PROTECTED from the IOCTL_DISK_IS_WRITABLE IOCTL, but this is only a miniport and therefore doesn’t handle this IOCTL directly.

I’ve tried setting the DeviceType to READ_ONLY_DIRECT_ACCESS_DEVICE instead of DIRECT_ACCESS_DEVICE in the INQUIRYDATA, but this make Windows think the device is a CDROM rather than a normal disk.

I’ve considered just failing write requests, but this seems a bit heavy handed – and then NTFS still wouldn’t know the device itself is read-only.

Is this possible?

Process SCSIOP_MODE_SENSE.

PMODE_PARAMETER_HEADER ModeParmHeader
= (PMODE_PARAMETER_HEADER)Srb->DataBuffer;
if (readonly)
{
print(“It’s a read only device\n”);
ModeParmHeader->DeviceSpecificParameter|=MODE_DSP_WRITE_PROTECT;
}

It takes effect after windows 2000.

Thanks
Wayne