mov bx, Handle ;handle of device
mov cx, MaxBytes ;maximum amount of data to receive
mov dx, seg Buffer
mov ds, dx
mov dx, offset Buffer ;ds:dx points to buffer to receive data
mov ax, 4402h ;Receive Control Data from Character Device
int 21h
jc error_handler ;carry set means error
mov ActualBytes, ax ;number of bytes received
Receive Control Data from Character Device (Function 4402h) reads control information of any length and format from a character-device driver. The format of the information is device-specific and does not follow any standard.
Handle
Identifies the device to receive information from.
MaxBytes
Specifies the maximum number of bytes to read.
Buffer
Points to the buffer to receive the data read from the device. The buffer must be at least as large as MaxBytes.
If the function is successful, the carry flag is clear, the buffer is filled in with the requested information, and the AX register contains the number of bytes received. Otherwise, the carry flag is set and the AX register contains an error value, which may be one of the following:
Value | Name |
0001h | ERROR_INVALID_FUNCTION |
0005h | ERROR_ACCESS_DENIED |
0006h | ERROR_INVALID_HANDLE |
000Dh | ERROR_INVALID_DATA |
Character-device drivers are not required to support this function or Send Control Data to Character Device (Function 4403h). A program should use Get Device Data (Function 4400h) and examine bit 14 in the device-status value to ensure that the device driver can process control data.
Function 4400h Get Device Data
Function 4403h Send Control Data to Character Device
Function 4404h Receive Control Data from Block Device
Function 4405h Send Control Data to Block Device