Platform SDK: Win32 API

Interrupt 21h Function 440Dh Minor Code 49h

Ejects the specified media.

mov ax, 440Dh     ; generic IOCTL
mov bx, DriveNum  ; see below
mov ch, 8         ; device category
mov cl, 49h       ; Eject Removable Media
int 21h

jc  error

Parameters

DriveNum
Drive to eject. This parameter can be 0 for default drive, 1 for A, 2 for B, and so on.

Return Values

Clears the carry flag if successful. Otherwise, the function sets the carry flag and sets the AX register to one of the following error values.

Value Meaning
01h The function is not supported.
B1h The volume is locked in the drive.
B2h The volume is not removable.
B5h The valid eject request has failed.

Remarks

If a given physical drive has more than one logical volume, all volumes must be unlocked by using Lock/Unlock Removable Media (Interrupt 21h Function 440Dh Minor Code 48h) before the drive will eject.