LOCK/UNLOCK

mov bx, DriveNum  ; drive number 0=default, 1=A, 2=B ...
mov ch, 8         ; device category must be 8
mov cl, 48h       ; LOCK/UNLOCK minor number 
mov ax, 440D      ; generic IOCTL function number
mov dx, seg ParamBlock
mov ds, dx
mov dx, offset ParamBlock
int 21h
jnc success
mov [ErrorValue], ax  
 

Locks or unlocks the drive.

01h Function not supported
B0h Volume not locked in drive
B2h Volume not removable
B4h Lock count exceeded

DriveNum (BX)
Specifies the drive for the operation. Can be 0 for the default drive, 1 for A, 2 for B, and so on.
ParamBlock (DS:DX)
Address of the parameter block for the function. The block has two byte fields. The first is LOCK_UNLOCK_OP, which has one of the following values:
0 Lock volume in drive
1 UnLock volume in drive
02 Return lock/unlock status

The values 03h through 0FFh are reserved.

The second byte field is filled on return from the call as the lock status of the drive.