The following summarizes the I/O control codes handled by serial drivers.
Returns the current values of the performance statistics for the device. The statistics include the number of characters transmitted, the number of characters received, and various errors. The values increase until they are explicitly reset with SERIAL_IOCTL_CLEAR_STATS.
If a driver does not implement this IOCTL, it should return an error and not modify the output buffer. If the modem driver is involved in processing the I/O, it will adjust the return value from error to success but only return zeros for the counter values.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(SERIALPERF_STATS).
The driver returns data to the buffer at Irp->AssociatedIrp.SystemBuffer.
The Information field is set to sizeof(SERIALPERF_STATS) when the Status field is set to STATUS_SUCCESS. Otherwise, the Information field is set to zero if the Status field is set to STATUS_BUFFER_TOO_SMALL.
Resets the performance statistics for the device.
None.
None
The Information field is set to zero and the Status field is set to STATUS_SUCCESS.
Returns information about the characteristics of the attached communication device.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(SERIAL_COMMPROP).
The driver returns the information to the buffer at
Irp->AssociatedIrp.SystemBuffer.
The Information field is set to sizeof(SERIAL_COMMPROP) when the Status field is set to STATUS_SUCCESS. Otherwise, the Information field is set to zero and the Status field is set to STATUS_BUFFER_TOO_SMALL.
Returns a bitmask indicating the status.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(ULONG).
The driver returns the bitmask to the buffer at
Irp->AssociatedIrp.SystemBuffer.
The Information field is set to sizeof(ULONG) when the Status field is set to STATUS_SUCCESS. Otherwise, the Information field is set to zero and the Status field is set to STATUS_BUFFER_TOO_SMALL.
Returns general status information, including how many Errors and HoldReasons have occurred, how much data is in the driver’s buffers as indicated by the AmountInInQueue and AmountInOutQueue values, and whether EofReceived and WaitForImmediate are set.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(SERIAL_STATUS).
The driver returns information to the buffer at
Irp->AssociatedIrp.SystemBuffer.
The Information field is set to sizeof(SERIAL_STATUS) when the Status field is set to STATUS_SUCCESS. Otherwise, the Information field is set to zero and the Status field is set to STATUS_BUFFER_TOO_SMALL.
Sets the device to a known state.
None
None
The Status field is set to STATUS_SUCCESS and the Information field is set to zero.
Purges the specified operation(s) or queues: one or more of the current and all pending writes, the current and all pending reads, the transmit buffer if one exists, and the receive buffer if one exists.
Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes of the buffer at Irp->AssociatedIrp.SystemBuffer, which contains a bitmask of type ULONG, indicating what to purge.
None
The Information field is set to zero, and the Status field is set to STATUS_SUCCESS or possibly to STATUS_PENDING, STATUS_CANCELLED, or STATUS_INVALID_PARAMETER.
Enables or disables insertion of the line status or modem status into the RX stream at the behest of a user-mode application.While this state is enabled, the serial driver inserts the caller-supplied escape character, together with one of the following, into the data stream being read from the device:
Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes of the buffer at Irp->AssociatedIrp.SystemBuffer, which contains a value of type UCHAR, indicating whether to enable LSRMST-insertion mode. A value of zero indicates the driver should disable LSRMST-insertion mode. A nonzero value is the caller-supplied escape character.
None
The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_BUFFER_TOO_SMALL or STATUS_INVALID_PARAMETER if the input escape character is the same as the current XOFF or XON character, or if handflow error replacement is enabled.
Returns the current baud-rate setting.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(SERIAL_BAUD_RATE).
The driver returns the data to the buffer at Irp->AssociatedIrp.SystemBuffer.
The Information field is set to sizeof(SERIAL_BAUD_RATE) when the Status field is set to STATUS_SUCCESS. Otherwise, the Information field is set to zero, and the Status field is set to STATUS_BUFFER_TOO_SMALL.
Sets the speed at which characters are sent over the serial line.
Parameters.DeviceIoControl.InputBufferLength indicates the size in
bytes (must be >= sizeof(SERIAL_BAUD_RATE)) of the buffer at
Irp->AssociatedIrp.SystemBuffer.
None
The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_INVALID_PARAMETER or STATUS_BUFFER_TOO_SMALL.
Resizes the driver’s internal typeahead and input buffers. The driver can allocate buffers larger than the requested sizes and can refuse to allocate buffers larger than its capacity.
Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes (must be >= sizeof(SERIAL_QUEUE_SIZE)) of the buffer at Irp->AssociatedIrp.SystemBuffer, containing the InSize and OutSize specifications.
None
The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_BUFFER_TOO_SMALL or STATUS_INSUFFICIENT_RESOURCES if the driver cannot satisfy the request by allocating more memory.
Returns the current values for the flow control and handshaking.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(SERIAL_HANDFLOW).
The driver returns the information to the buffer at Irp->AssociatedIrp.SystemBuffer.
The Information field is set to sizeof(SERIAL_HANDFLOW) when the Status field is set to STATUS_SUCCESS. Otherwise, the Information field is set to zero and the Status field is set to STATUS_BUFFER_TOO_SMALL.
Sets up flow control and handshaking for subsequent operations.
Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes (must be >= sizeof(SERIAL_HANDFLOW)) of the buffer at Irp->AssociatedIrp.SystemBuffer, which contains the values to be set.
None
The Information field is set to zero, and the Status field can be set to STATUS_SUCCESS or possibly to STATUS_BUFFER_TOO_SMALL or STATUS_INVALID_PARAMETER.
Returns the current values of the stop-bits, parity, and word-length parameters for the device.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(SERIAL_LINE_CONTROL).
The driver returns data to the buffer at Irp->AssociatedIrp.SystemBuffer.
The Information field is set to sizeof(SERIAL_LINE_CONTROL) when the Status field is set to STATUS_SUCCESS. Otherwise, the Information field is set to zero if the Status field is set to STATUS_BUFFER_TOO_SMALL.
Resets the stop-bits, parity, and word-length parameters for the device.
Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes (must be >= sizeof(SERIAL_LINE_CONTROL)) of the buffer at Irp->AssociatedIrp.SystemBuffer.
None
The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_BUFFER_TOO_SMALL or STATUS_INVALID_PARAMETER.
Causes a break condition to be transmitted by the UART.
None
None
The Status field is set to STATUS_SUCCESS and the Information field is set to zero.
Disables the transmission of break conditions by the UART.
None
None
The Status field is set to STATUS_SUCCESS and the Information field is set to zero.
Returns the current settings for read and write time-outs on the device.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(SERIAL_TIMEOUTS).
The driver returns information to the buffer at Irp->AssociatedIrp.SystemBuffer.
The Information field is set to sizeof(SERIAL_TIMEOUTS) when the Status field is set to STATUS_SUCCESS. The Information field is set to zero when the Status field is set to STATUS_BUFFER_TOO_SMALL.
Sets up time-out constraints for serial I/O operations.
Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes (must be >= sizeof(SERIAL_TIMEOUTS)) of the buffer at Irp->AssociatedIrp.SystemBuffer.
None
The Information field is set to zero. The Status field can be set to STATUS_SUCCESS or STATUS_BUFFER_TOO_SMALL.
Causes a single character to be transmitted as soon as the hardware is available.
The buffer at Irp->AssociatedIrp.SystemBuffer contains the character to be sent. Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(UCHAR).
None
The Information field is set to one when the Status field is set to STATUS_SUCCESS. Otherwise, the Information field is set to zero, and the Status field can be set to STATUS_PENDING, STATUS_CANCELLED, STATUS_BUFFER_TOO_SMALL, or STATUS_INVALID_PARAMETER if another immediate character is already pending.
Sends the specified XOFF character, sets up a timer to track the specified time-out value, and decrements the supplied count of characters for each subsequently written character until the count goes to zero or a time-out occurs. This IOCTL supports software emulation of the serial chip in certain protected subsystems.
Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes (must be >= sizeof(SERIAL_XOFF_COUNTER)) of the buffer at Irp->AssociatedIrp.SystemBuffer, which contains the data.
None
The Information field is set to zero. The Status field can be set to STATUS_SUCCESS (all requested characters written) or possibly to STATUS_SERIAL_MORE_WRITES, STATUS_SERIAL_COUNTER_TIMEOUT, STATUS_BUFFER_TOO_SMALL, or STATUS_INVALID_PARAMETER if the XoffChar specified is inconsistent with the current flow-control specification.
Sets DTR (data terminal ready).
None
None
The Information field is set to zero. The Status field can be set to STATUS_SUCCESS or to STATUS_INVALID_PARAMETER if the current handshake setup is inconsistent with the requested operation.
Clears DTR.
None
None
The Information field is set to zero. The Status field can be set to STATUS_SUCCESS or to STATUS_INVALID_PARAMETER if the current handshake setup is inconsistent with the requested operation.
Sets RTS (request to send).
None
None
The Information field is set to zero. The Status field can be set to STATUS_SUCCESS or to STATUS_INVALID_PARAMETER if the current handshake setup is inconsistent with the requested operation.
Clears RTS.
None
None
The Information field is set to zero. The Status field can be set to STATUS_SUCCESS or to STATUS_INVALID_PARAMETER if the current handshake setup is inconsistent with the requested operation.
Returns the state of the DTR and RTS lines at the time this request is processed.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(ULONG).
The driver returns information to the buffer at
Irp->AssociatedIrp.SystemBuffer.
The Information field is set to sizeof(ULONG) when the Status field is set to STATUS_SUCCESS. The Information field is set to zero when the Status field is set to STATUS_BUFFER_TOO_SMALL.
Enables emulation of receipt of characters, which the serial driver might already have in its internal buffers.
None
None
The Status field is set to STATUS_SUCCESS and the Information field is set to zero.
Disables emulation of receipt of characters.
None
None
The Status field is set to STATUS_SUCCESS and the Information field is set to zero.
Returns the current value of the event wait mask.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(ULONG).
The driver returns the information to the buffer at Irp->AssociatedIrp.SystemBuffer.
The Information field is set to sizeof(ULONG) when the Status field is set to STATUS_SUCCESS. Otherwise, the Information field is set to zero, and the Status field can be set to STATUS_PENDING, STATUS_CANCELLED, or STATUS_BUFFER_TOO_SMALL.
Causes the driver to track the specified events, or, if the specified value is zero, to complete pending waits.
Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes (must be >= sizeof(ULONG)) of the bitmask at Irp->AssociatedIrp.SystemBuffer.
None
The Information field is set to zero. The Status field is set to STATUS_SUCCESS or possibly to STATUS_PENDING, STATUS_CANCELLED, STATUS_BUFFER_TOO_SMALL, or STATUS_INVALID_PARAMETER.
Returns information about which events have occurred among those that the caller was waiting on.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes (must be >= sizeof(ULONG)) of the buffer.
The driver returns a bitmask with bits set for events that occurred (or with a value of zero if the preceding set-waitmask request specified zero) to the buffer at Irp->AssociatedIrp.SystemBuffer.
The Information field is set to sizeof(ULONG) when the Status field is set to STATUS_SUCCESS. Otherwise, the Information field is set to zero, and the Status field can be set to STATUS_PENDING or STATUS_INVALID_PARAMETER if a wait is already pending.
Returns the current values for the special characters used by the driver.
Parameters.DeviceIoControl.OutputBufferLength indicates the size in bytes of the buffer, which must be >= sizeof(SERIAL_CHARS).
The driver returns the information to the buffer at
Irp->AssociatedIrp.SystemBuffer.
The Information field is set to sizeof(SERIAL_CHARS) when the Status field is set to STATUS_SUCCESS. Otherwise, the Information field is set to zero and the Status field is set to STATUS_BUFFER_TOO_SMALL.
Sets special characters (EofChar, ErrorChar, BreakChar, EventChar, XonChar, and XoffChar) used by the driver.
Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes (must be >= sizeof(SERIAL_CHARS)) of the buffer at Irp->AssociatedIrp.SystemBuffer, which contains the values to the used.
None
The Information field is set to zero, and the Status field is set to STATUS_SUCCESS or possibly to STATUS_BUFFER_TOO_SMALL or STATUS_INVALID_PARAMETER if the specified values for XonChar and XoffChar are identical.