IOCTL_CDROM_EXCLUSIVE_ACCESS IOCTL

The IOCTL_CDROM_EXCLUSIVE_ACCESS request instructs the CD-ROM class driver to:

  • Report the access state of a CD-ROM device.

  • Lock a CD-ROM device for exclusive access.

  • Unlock a CD-ROM device for exclusive access.

A valid FileObject handle must exist in order for this IOCTL to succeed. The FileObject handle protects the system from unexpected application termination or accidental acquisition of an exclusive access lock without subsequent release of the exclusive access lock. A valid FileObject handle is necessary because when an application closes, the CD-ROM class driver will receive CLEANUP and CLOSE I/O Request Packets (IRPs), which it can use to automatically release an exclusive access lock obtained by that handle. This simple method protects against the majority of accidental releases of exclusive access. Any methods used to avoid this functionality may reduce the safety and effectiveness of the exclusive access locking method.

Major Code

IRP_MJ_DEVICE_CONTROL

Input Buffer

Depending on the operation that the caller requests, the caller must provide one of the following structures as input at Irp->AssociatedIrp.SystemBuffer:

Input Buffer Length

The Parameters.DeviceIoControl.InputBufferLength member in the IO_STACK_LOCATION structure indicates the size, in bytes, of the user-allocated input buffer.

Output Buffer

If the caller requests the exclusive access state of the CD-ROM device (RequestType = ExclusiveAccessQueryState), the CD-ROM class driver returns a CDROM_EXCLUSIVE_LOCK_STATE-type structure in the buffer at Irp->AssociatedIrp.SystemBuffer whose LockState member indicates the access state of the device.

Output Buffer Length

The Parameters.DeviceIoControl.OutputBufferLength member in the I/O stack location (IO_STACK_LOCATION) indicates the size, in bytes, of the output buffer.

Status Block

The Information field is set to the number of bytes that are returned. The Status field is set to STATUS_SUCCESS if the request succeeds.

If the request fails, the Status field might be set to one of the following error messages:

Requirements

   
Header ntddcdrm.h (include Ntddcdrm.h)

See Also

CDROM_EXCLUSIVE_ACCESS

CDROM_EXCLUSIVE_LOCK

CDROM_EXCLUSIVE_LOCK_STATE

EXCLUSIVE_ACCESS_REQUEST_TYPE

IO_STACK_LOCATION