Media Detect (0x0002)

Detects if removable media has been inserted or removed.

Parameters

function
Set to 0x0002 – media detect request function.
parameter0
Not used.
parameter1
Not used.
parameter2
Not used.
bufferLength
Length of buffer used to store media state. This is typically 4 bytes (1 LONG).
buffer
Pointer to the buffer where the media state is stored. This is typically a pointer to a LONG.

Status values to be returned in buffer:

Value

Meaning

0x00000000

ERROR_NO_ERROR_FOUND = Media is in the device and ready.

0x00000017

ERROR_MEDIA_NOT_PRESENT = No media is in the device.

0x00000018

ERROR_MEDIA_CHANGED = New media was inserted into the device.

Return Values

The following table lists return values and descriptions.

0x00000000

ERROR_NO_ERROR_FOUND

Remarks

The CDM typically performs a TEST UNIT READY or similar operation on the device to determine if media was inserted or removed from the device. If the CDM detects that media has been removed or changed, the CDM must deactivate the device using CDI_Object_Update before completing the message. The CDM should not automatically activate the device if media is detected. It must wait until it receives an activate request before activating a device.