Int 21H [2.0] Function 44H (68) Subfunction 04H IOCTL: read control data from block-device driver

Transfers control data from a block-device driver directly into an application program's buffer. The length and contents of the data are specific to each device driver and do not follow any standard format. This function does not necessarily result in any input from the physical device.

Call with:

AH = 44H

AL = 04H

BL = drive code (0 = default, 1 = A, 2 = B, etc.)

CX = number of bytes to read

DS:DX = segment:offset of buffer

Returns:

If function successful

Carry flag = clear

AX = bytes transferred

and buffer contains control data from device driver

If function unsuccessful

Carry flag = set

AX = error code

Notes:

When supported by the driver, this subfunction can be used to obtain hardware-dependent status and availability information that is not provided by other MS-DOS function calls.

Block-device drivers are not required to support IOCTL Subfunction 04H. If this subfunction is requested and the driver does not have the ability to process control data, control returns to the program with the carry flag set and error code 0001H (invalid function) in register AX.

Example:

Read a control string from the block-device driver for drive C into the buffer buff.

buflen equ 64 ; length of buffer

ctllen dw ? ; length of control string

buff db buflen dup (0) ; receives control string

.

.

.

mov ax,4404h ; function & subfunction

mov bl,3 ; drive C = 3

mov cx,buflen ; buffer length

mov dx,seg buff ; buffer address

mov ds,dx

mov dx,offset buff

int 21h ; transfer to MS-DOS

jc error ; jump if read failed

mov ctllen,ax ; save control string length

.

.

.