Generic IOCTL (Device-Driver Function 13h)

IOCTLREQUEST STRUC

giLength db ? ;length of record, in bytes

giUnit db ? ;unit number (block device only)

giFunction db 13h ;function number

giStatus dw ? ;status

giReserved1 db 8 dup(?) ;reserved

giCategory db ? ;INPUT: device category

giMinorCode db ? ;INPUT: minor code

giReserved2 dd ? ;reserved

giIOCTLData dd ? ;INPUT: IOCTL data address

IOCTLREQUEST ENDS

Generic IOCTL (Device-Driver Function 13h) directs the driver to carry out the generic input-and-output-control function specified by the giCategory and giMinorCode fields.

This function can be used for both block- and character-device drivers.

Fields

giLength

Specifies the length, in bytes, of the IOCTLREQUEST structure.

giUnit

Specifies the device number on which to carry out the IOCTL function. This field is used for block-device drivers only.

giFunction

Specifies the Generic IOCTL function: 13h.

giStatus

Specifies the status of the completed function. If the function is successful, the driver must set the done bit (bit 8). Otherwise, the driver must set both the error and done bits (bits 15 and 8) and copy an error value to the low-order byte.

giReserved1

Reserved; do not use.

giCategory

Specifies the device category. Serial, console, parallel, and disk drivers are represented by the following values:

Value Meaning

01h Serial device
03h Console (display)
05h Parallel printer
08h Disk

If the driver supports a type of device not listed, the giCategory field must specify an 8-bit number that uniquely identifies the device. The driver must check this value.

giMinorCode

Specifies the minor code for Interrupt 21h Function 440Ch, Generic IOCTL for Character Devices. The meaning of the minor code depends on the device category. For serial, console, and parallel drivers, it can be one of the following:

Minor Code Function

45h Set Iteration Count
4Ah Select Code Page
4Ch Start Code-Page Prepare
4Dh End Code-Page Prepare
65h Get Iteration Count
6Ah Query Selected Code Page
6Bh Query Code-Page Prepare List

For disk drivers, the value specifies the minor code for Interrupt 21h Function 440Dh, Generic IOCTL for Block Devices. It can be one of the following:

Minor Code Function

40h Set Device Parameters
41h Write Track on Logical Drive
42h Format Track on Logical Drive
46h Set Media ID
60h Get Device Parameters
61h Read Track on Logical Drive
62h Verify Track on Logical Drive
66h Get Media ID
68h Sense Media Type

Drivers can support additional minor codes as needed.

giReserved2

Reserved; do not use.

giIOCTLData

Contains a 32-bit address (segment:offset) of the structure associated with the specified IOCTL function. The structure type and contents depend on the minor code as specified by the giMinorCode field.

Comments

The driver must interpret the category and minor codes to determine which operation to carry out and then return any applicable information in the structure pointed to by the giIOCTLData field.

MS-DOS calls this function only if bit 6 is set in the dhAttributes field of the driver's DEVICEHEADER structure. For a full description of the DEVICEHEADER structure, see Section 9.9, “Structures.”

See Also

Device-Driver Function 19h Query IOCTL
Interrupt 21h Function 440Ch Generic IOCTL for Character Devices
Interrupt 21h Function 440Dh Generic IOCTL for Block Devices