Platform SDK: Win32 API

Int 21h Function 440Dh Minor Code 48h (FAT32)

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, DeviceCat       ; See below
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_handler       ; Carry set means error

Parameters

DriveNum
Drive to lock or unlock (0 = default drive, 1 = A, 2 = B, and so on).
DeviceCat
Specifies a FAT16, FAT12 or FAT32 drive.
Value Description
08h FAT32, FAT16, or FAT12 drive.
48h FAT32, FAT16, or FAT12 drive. This value is supported on Windows 95 OEM Service Release 2 and later.

Note: Because this call may be implemented in the device driver, the 48h form of this call may fail on FAT16 or FAT12 media. Therefore, applications making the 48h form of this call must fall back on the 08h form if the 48h call fails.

ParamBlock
Pointer to a PARAMBLOCK structure that specifies the operation to carry out and receives a count of the number of locks on the drive.

Return Values

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

Value Description
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.