This web page refers to our older busTRACE 6.0 which is no longer shipping. Click here for details on our latest generation busTRACE software.
This WEB page comes from the busTRACE 6.0 User's Manual. (Table of Contents)
Starting with Windows Vista, the CD-ROM class driver includes support for an IOCTL_CDROM_EXCLUSIVE_ACCESS request. This request instructs the CD-ROM class driver to:
CD/DVD/HD/BD recording applications use this IOCTL to ensure that they have exclusive access to the device while they are recording to it. This utility, included with busTRACE 6.0, provides a means for you to monitor which application has received exclusive access to the device. You can run this utility from the busTRACE Start Menu. Here is a sample screenshot:
In this sample, we are using Windows Media Player to burn an audio CD to our Toshiba DVD recorder. Note how the application shows you that "Windows Media Player" currently has exclusive access to the device.
When you select a CD/DVD/HD/BD device, the toolbar buttons will become enabled. If you are a software developer, you can use these buttons to force a lock of the drive to see how your software handles a "locked" condition.
The following information is available in more detail within the Windows Driver Kit (WDK). We provide some basic information so that you can better understand what our application is doing.
Report the access state of a CD-ROM device
To determine the current access state of a CD-ROM device, we issue an IOCTL_CDROM_EXCLUSIVE_ACCESS with a CDROM_EXCLUSIVE_ACCESS structure to the class driver. This structure is defined in the WDK as follows:
The EXCLUSIVE_ACCESS_REQUEST_TYPE-typed enumeration value is defined as:
We set the RequestType field to ExclusiveAccessQueryState and set the Flags field to zero. The CD-ROM class driver then returns to us a CDROM_EXCLUSIVE_LOCK_STATE structure. This structure is defined as:
The LockState field returns TRUE if the device is locked, else FALSE. If the device is locked, we can look at the returned CallerName field to determine who has received an exclusive lock on the device.
Lock a CD-ROM device for exclusive access
To gain exclusive access to a CD/DVD/HD/BD device, we issue an IOCTL_CDROM_EXCLUSIVE_ACCESS with a CDROM_EXCLUSIVE_LOCK structure to the class driver. This structure is defined in the WDK as follows:
See above for a definition of the CDROM_EXCLUSIVE_ACCESS structure. To lock the device, we set the Access.RequestType field to ExclusiveAccessLockDevice. We set the Flags field to 0 to dismount the file system or 1 to ignore the file system mount. We also set the CallerName field with an identifier string.
Unlock a CD-ROM device
To release our exclusive lock on a CD/DVD/HD/BD device, we issue an IOCTL_CDROM_EXCLUSIVE_ACCESS with a CDROM_EXCLUSIVE_LOCK structure to the class driver. See above for a definition. We set the Access.RequestType field to ExclusiveAccessUnlockDevice.
Full information on IOCTL_CDROM_EXCLUSIVE_ACCESS can be found in Microsoft's Windows Driver Kit (WDK). Structure declarations can be found in the WDK file ntddcdrm.h.