First, please try not to send GET_CONFIGURATION directly to devices.
Some devices will actually hang until the command times out. We’ve
already worked around this for you on all devices, so please use
IOCTL_CDROM_GET_CONFIGURATION to get/set GET_CONFIGURATION data.
(Supported on XP and higher, only requires READ access to device.)
Legacy CD writers may not support this command (rare for new drives), at
which point you’ll need to also get mode page 2Ah and check for CD-R and
CD-RW ability – only send READ_DISC_INFO/READ_TRACK_INFO if these bits
are set, as some drives will also lock up when sent these commands (only
older CD-ROM drives). Summary: It’s a dangerous world, talking directly
to CD/DVD devices.
Most people only want to know if the file system mounted on a device is
writable, so you should consider GetVolumeInformation() if you’re above
the file system. This is highly recommended, as the file system can
(and will) hide all the nasty details surrounding CD/DVD media from you.
If you’re *not* “above” the file system, then you must provide
additional clarification about about what you consider to be a
“writable” media.
* Packet writable media (i.e. CD-RW formatted as packet-written media)
* Sector-writable media (i.e. DVD+RW media formatted, no defect
management)
* Sequentially writable media (i.e. almost any write-once media, such as
CD-R)
* Disk-like media (i.e. DVD-RAM or other sector-addressable,
hardware-defect-managed media)
If you need some background on the various methods of writing to CD/DVD
media types, please check out the latest MMC4 specification, which you
can download a draft of at ftp://ftp.t10.org/t10/drafts/mmc4/. There’s
a good “models” section or two in there to get you started. You can
also look at the feature descriptions to understand and parse the
results of the GET_CONFIGURATION command you see above.
As an aside, if you are on the device stack, please don’t send commands
directly to a device’s PDO as Anton suggests – this is considered a
breach of the NT layered architecture, and generally bad form. Instead,
send IRPs to the “next lower” device object (which may or may not be the
PDO). Software which sends directly to the PDO has historically caused
more interop problems, and I think if you search this list is generally
frowned upon by this list’s membership.
.
-----Original Message-----
From: Anton Kolomyeytsev [mailto:xxxxx@cooldev.com]
Sent: Friday, February 04, 2005 11:35 AM
Subject: RE: IOCTL_IS_DISK_WRITABLE Problem with CD’s
Just send to device PDO IRP_MJ_SCSI with GET_CONFIGURATION (0x46) SCSI
opcode embedded to determine which profile is active (read-only or
read-write). For old hardware w/o get config support try sending
READ_DISC_INFO (0x51) to determine disc type (you should be interested
in CD-R or CD-RW only). This kind of stuff would work always.
P.S. DVD-RAM, DVD+RW and some pre-formatted DVD-RW (restricted
overwrite) are always writable. For DVD+R, DVD-R, CD-R and CD-RW you’ll
have to send READ_DISC_INFO to see if disc has “closed” status (no B0
pointer to next allowed session).
Regards,
Anton Kolomyeytsev
CEO, Rocket Division Software
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Handal, Thomas
Sent: Friday, February 04, 2005 9:28 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] IOCTL_IS_DISK_WRITABLE Problem with CD’s
Hi Henry,
Thanks for your reply. I don’t believe that there are any third
party apps on the CD/DVD stack. I have tried the driver I wrote on 3 or
4 machines and they all have the same result. Is there any other way to
determine if a CD drive is writable or not? How about detecting if it is
a CD-ROM or CD-R/RW, etc? Also for DVD-ROM or DVD-RAM? I’ve tried
everything so far that I can think of:
- Getting description of device and looking for “ROM” - that won’t
work
- IOCTL_IS_DISK_WRITABLE - doesn’t work for CDs…
- Characteristics & FILE_READ_ONLY_VOLUME in kernel - doesn’t work
and also stated as “Unreliable” by Neil Christiansen
- Tried asking it nicely… that doesn’t work either…
- Whacked it with a baseball bat a few times… stopped
spinning-up… that wasn’t good… got a new one and asked it nicely…
but that didn’t work…
I am SOO lost here… and it seems that it should be such a SIMPLE
thing… I have run out of hair to pull… please help me!
Please tell me about some new undocumented saving function!!! PLEASE!!!
Thanks
Tom
On 04 Feb 2005, you wrote in ntdev:
Hi Tom,
First question I would have to ask is, do you have *any* third party
software installed? If so, does this still happen when you use a
clean
installation of Windows XP? Finally, is this restricted to a single
type of CD/DVD drive (i.e. only drives from one vendor)?
This behavior certainly seems unusual, and is not what I would expect
either. Two possibilities are:
(A) 3rd party software on the CD/DVD stack may modify the results of
this IOCTL.
(B) The firmware on the device reports that it is always a randomly
writable, hardware defect managed media.
Looking forward to hearing your results.
.
-----Original Message-----
From: Handal, Thomas [mailto:xxxxx@websense.com]
Sent: Thursday, February 03, 2005 1:59 PM
Subject: IOCTL_IS_DISK_WRITABLE Problem with CD’s
Hi all
I am having a problem with the IOCTL_IS_DISK_WRITABLE call. It
works great with Floppy’s and Removable thumb drives, etc. But for
CD’s,
I am having a problem. It does not matter if the drive is a
CD-ROM/RW/R
or whatever. The problem that I am having is that regardless of what
CD
media I am using, (burnt, stamped, etc.) it ALWAYS says it is
WRITABLE.
I don’t understand why. Can anyone shed some light on this and how to
get around it?
Thanks in advance… I truly appreciate any help…
Tom
Tom Handal
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com