Interrupt 21h Function 440Dh Minor Code 48h

Locks or unlocks the volume in the given drive (preventing or permitting its removal) or returns the locked status of the given drive.

mov ax, 440Dh           ; generic IOCTL
mov bx, DriveNum        ; see below 
mov ch, 8               ; device category
mov cl, 48h             ; Lock or Unlock Removable Media
mov dx, seg ParamBlock  ; see below
mov ds, dx
mov dx, offset ParamBlock
int 21h

jc  error

Parameters

DriveNum
Drive to lock or unlock. This parameter can be 0 for default drive, 1 for A, 2 for B, and so on.
ParamBlock
Address of a PARAMBLOCK structure that specifies the operation to carry out and receives a count of the number of locks on the drive.

Return Value

Clears the carry flag and copies the number of pending locks on the given drive to the NumLocks member of the PARAMBLOCK structure if successful. Otherwise, the function sets the carry flag and sets the AX register to one of the following error values:

01h The function is not supported.
B0h The volume is not locked in the drive.
B2h The volume is not removable.
B4h The lock count has been exceeded.