Eject Removable Drive

Entry:
    AH = 46h
    AL = 0h, reserved
    DL = Drive number
Exit:
    carry clear
        AH = 0
    carry set
        AH = error code
 

This function logically ejects a media from the specified drive.

This function must be supported for all removable drives numbered 80h and above. If a fixed disk supports the Removable Drive Control API subset, then this function is always returned with carry set and AH = B2h, Volume not removable. An attempt to eject media locked in a drive must return with carry set and AH = B1h, Volume locked in drive.

This function represents a request to remove the volume in the specified drive. Whether the drive is actually ejected is implementation dependent, but system software that issues or observes this call should flush any buffers it is holding for that volume.

If this call is issued for a drive without media, the request is returned with carry set and AH = 31h, No media in drive.

If this call is issued to an unlocked, removable media drive with media present, the INT 13h code must invoke INT 15h (AH)=52h to determine if it may proceed with the ejection request. If the ejection request is rejected, then the error code returned in (AH) is the same as the INT 15h error code. If the ejection request is accepted and issued and subsequently fails, the request is returned with carry set and AH = B5h.