Pl Help: Failing IRPs for READ-ONLY Disk in BUS Driver

Hello,
Here goes, when a disk is detected by PnP I am creating a child device
(PDO) in my BUS driver for the newly arrived disk, and I am handling
SCSIOP_XXX in IRP_MJ_DEVICE_CONTROL(i.e SRB_FUNCTION_EXECUTE_SCSI), I am
seeing that on each arrival of disk/volume SCSIOP_WRITE gets called and it
attempts to write, if it’s READ-ONLY disk it crashes system, to avoid the
crash I am failing the IRP from writing on to the read-only disks, but the
disk is in-accessible from windows explore though I am seeing the disk in
disk mgmt.Also observed that SCSIOP_WRITE is getting called when ever Disk
Mgmt is launched.

I tried to inform OS that disk is read-only using

IOCT_DISK_IS_WRITABLE unfortunately it never get’s called, I am calling

this in IRP_MJ_INTERNAL_DEVICE_CONTROL dispatch routine of child device.

Passed FILE_READ_ONLY_DEVICE(DeviceCharacteristics) when creating the

device i.e. in IoCreateDevice(), didn’t work or no effect.

Am I doing right? or is there a better way to inform OS about READ-ONLY
devices/disks or some better approach to fail IRPs intended for read-only
disks so that disks/volumes are accessible from other parts of OS.

If they are dynamic disk it’s understandable that LDM services/drivers
periodically attempts to update LDM database, but why does OS attempts to
write on to basic disks? Would appreciate any help or pointers.

Warm Regards,
Anand
xxxxx@yahoo.com