2.2 Keyboard I/O Control Codes
The system-supplied keyboard class driver passes most IRP_MJ_DEVICE_CONTROL requests on to the underlying port driver as IRP_MJ_INTERNAL_DEVICE_CONTROL requests. In addition, the class driver communicates with the port driver using driver-defined I/O control codes and driver-created IRPs set up with IRP_MJ_INTERNAL_DEVICE_CONTROL and one of the IOCTL_INTERNAL_KEYBOARD_XXX.
IOCTL_KEYBOARD_QUERY_ATTRIBUTES
Operation
The keyboard class driver passes this request on to the port driver, which returns the KEYBOARD_ATTRIBUTES information.
Input
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the output buffer, which must be >= sizeof(KEYBOARD_ATTRIBUTES).
Output
The driver returns the KEYBOARD_ATTRIBUTES data to the buffer at Irp->AssociatedIrp.SystemBuffer.
I/O Status Block
The Information field is set to the number of bytes of returned attribute data if the Status field is set to STATUS_SUCCESS. Otherwise, the Status field can be set to STATUS_INVALID_PARAMETER or to STATUS_BUFFER_TOO_SMALL.
IOCTL_KEYBOARD_QUERY_TYPEMATIC
Operation
The class driver passes this request on to the port driver, which returns the KEYBOARD_TYPEMATIC_PARAMETERS information.
Input
The buffer at Irp->AssociatedIrp.SystemBuffer contains a UnitId value identifying the target keyboard port. The driver should validate the input UnitId before collecting the requested typematic information.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the output buffer, which must be >= sizeof(KEYBOARD_TYPEMATIC_PARAMETERS).
Output
The driver returns the KEYBOARD_TYPEMATIC_PARAMETERS data to the buffer at Irp->AssociatedIrp.SystemBuffer.
I/O Status Block
The Information field is set to the number of bytes of returned typematic data if the Status field is set to STATUS_SUCCESS. Otherwise, the Status field can be set to STATUS_INVALID_PARAMETER if the input UnitId is invalid or to STATUS_BUFFER_TOO_SMALL.
IOCTL_KEYBOARD_SET_TYPEMATIC
Operation
The keyboard class driver passes this request to the port driver, so that it can set the typematic rate and delay on the device.
Input
The buffer at Irp->AssociatedIrp.SystemBuffer contains the KEYBOARD_TYPEMATIC_PARAMETERS data specifying the rate and delay values. Parameters.DeviceIoControl.InputBufferLength in the I/O stack location of the IRP indicates the buffer's size in bytes. The driver should validate the input UnitId, before resetting the typematic rate and delay.
Output
None
I/O Status Block
The Information field is set to zero. If the Status field is not set to STATUS_SUCCESS, it can be set to STATUS_INVALID_PARAMETER if the input UnitId is invalid, to STATUS_PARITY_ERROR if the number of retries exceeds the driver's limit, to STATUS_IO_TIMEOUT if the requested operation timed out on the device, or to STATUS_BUFFER_TOO_SMALL.
IOCTL_KEYBOARD_QUERY_INDICATORS
Operation
The class driver passes this request on to the port driver, which returns the KEYBOARD_INDICATOR_PARAMETERS information.
Input
The buffer at Irp->AssociatedIrp.SystemBuffer contains a UnitId value identifying the target keyboard port. The driver should validate the input UnitId before collecting the requested indicators information.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the output buffer, which must be >= sizeof(KEYBOARD_INDICATOR_PARAMETERS).
Output
The driver returns the KEYBOARD_INDICATOR_PARAMETERS data to the buffer at Irp->AssociatedIrp.SystemBuffer.
I/O Status Block
The Information field is set to the number of bytes of returned indicator data if the Status field is set to STATUS_SUCCESS. Otherwise, it can be set to STATUS_INVALID_PARAMETER if the input UnitId is invalid or to STATUS_BUFFER_TOO_SMALL.
IOCTL_KEYBOARD_SET_INDICATORS
Operation
The keyboard class driver passes this request to the port driver, which sets the indicators on the device.
Input
The buffer at Irp->AssociatedIrp.SystemBuffer contains the KEYBOARD_INDICATOR_PARAMETERS to be set on the device. Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(KEYBOARD_INDICATOR_PARAMETERS).
The buffer at Irp->AssociatedIrp.SystemBuffer contains a UnitId value identifying the target keyboard port. The driver should validate the input UnitId before resetting the indicators.
Output
None
I/O Status Block
The Information field is set to zero. If the Status field is not set to STATUS_SUCCESS, it can be set to STATUS_INVALID_PARAMETER if the input UnitId is invalid, to STATUS_PARITY_ERROR if the number of retries exceeds the driver's limit, to STATUS_IO_TIMEOUT if the requested operation timed out on the device, or to STATUS_BUFFER_TOO_SMALL.
IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION
Operation
The class driver passes this request on to the port driver, which returns the KEYBOARD_INDICATOR_TRANSLATION information.
Input
Parameters.DeviceIoControl.OutputBufferLength in the I/O stack location of the IRP indicates the size in bytes of the output buffer, which must be >= sizeof(KEYBOARD_INDICATOR_TRANSLATION). Note that this structure contains a variable-sized array of INDICATOR_LIST entries, and the size of this array depends on the device-specific number of indicators.
Output
The driver returns the KEYBOARD_INDICATOR_TRANSLATION data to the buffer at Irp->AssociatedIrp.SystemBuffer.
I/O Status Block
The Information field is set to the number of bytes of returned translation data if the Status field is set to STATUS_SUCCESS. Otherwise, the Status field can be set to STATUS_INVALID_PARAMETER if the input UnitId is invalid or to STATUS_BUFFER_TOO_SMALL.
IOCTL_KEYBOARD_INSERT_DATA
Operation
None. This request is intercepted within the Win32 subsystem.
IOCTL_INTERNAL_KEYBOARD_CONNECT
Operation
After the class driver has opened the device object representing the keyboard port, the class driver sets up and sends this request to the port driver in order to establish a connection to the port device.
Input
The buffer at Parameters.DeviceIoControl.Type3InputBuffer contains the CONNECT_DATA, including a pointer to the class device object and a pointer to the class service callback routine. Parameters.DeviceIoControl.InputBufferLength in the I/O stack location of the IRP indicates the input buffer's size in bytes.
Output
None
I/O Status Block
The Information field is set to zero. The Status field is set to STATUS_SUCCESS or to STATUS_NO_SUCH_DEVICE if the device is not present, to STATUS_SHARING_VIOLATION if the device is already connected, or to STATUS_INVALID_PARAMETER if the connection data is not valid.
IOCTL_INTERNAL_KEYBOARD_DISCONNECT
Operation
None. Currently, the keyboard device cannot be unloaded dynamically so this request is never sent to the port driver.
IOCTL_INTERNAL_KEYBOARD_ENABLE
Operation
Enables keyboard interrupts at the request of the class driver, which has just been sent a create request.
Input
None
Output
None
I/O Status Block
The Information field is set to zero. The Status field is set to STATUS_SUCCESS or to STATUS_DEVICE_DATA_ERROR if the device interrupt could not be enabled.
IOCTL_INTERNAL_KEYBOARD_DISABLE
Operation
Disables keyboard interrupts at the request of the class driver, which has just been sent a close request.
Input
None
Output
None
I/O Status Block
The Information field is set to zero. The Status field is set to STATUS_SUCCESS or to STATUS_DEVICE_DATA_ERROR if the device interrupt could not be disabled or was already disabled.