Jump to content

DSK_UNLOCKEJECTMEDIA

From EDM2


Category
IOCTL_DISK (08h)
Function
DSK_UNLOCKEJECTMEDIA (40h)
Description
Removable Media Control

Description

This function physically locks/unlocks the media in the drive. It also ejects or loads the media for drives that support these functions.

Parameter Packet Format

Parameter Packet
Field Length C Datatype
Length Command Information BYTE UCHAR
Drive Unit BYTE UCHAR

Data Packet Format

None

Returns

Possible values are shown in the following list:

Code Description
0 NO_ERROR
1 ERROR_INVALID_FUNCTION
6 ERROR_INVALID_HANDLE
15 ERROR_INVALID_DRIVE
31 ERROR_GEN_FAILURE
87 ERROR_INVALID_PARAMETER
111 ERROR_BUFFER_OVERFLOW
115 ERROR_PROTECTION_VIOLATION
117 ERROR_INVALID_CATEGORY
119 ERROR_BAD_DRIVER_LEVEL
163 ERROR_UNCERTAIN_MEDIA
165 ERROR_MONITORS_NOT_SUPPORTED

Remarks

Not all floppy drives support these functions. The Length Command Information field uses bits 0-1 to specify the action: 00 (Unlock), 01 (Lock, can be locked with or without media; if locked without media, media will be ejected when inserted until an Unlock IOCtl is issued), 10 (Eject Media, if the drive is not locked), or 11 (Loads Media). This IOCtl can be issued without a previously allocated file handle by using a file handle of -1 and specifying the Drive Unit (0=A, 1=B, 2=C, and so forth). Media in the drive is not required.