ClearCommError calls NtDeviceIoControlFile and, from IOCTL_SERIAL_GET_COMMSTATUS, it returns a SERIAL_STATUS structure
IOCTL_SERIAL_GET_COMMSTATUS data format

Phan Anh Dung (GAM.VN.DAP)
21
Reputation points
In the function ClearCommError from Winbase API, an IOCTL call with code IOCTL_SERIAL_GET_COMMSTATUS is sent to the device (the COM port) driver and a pointer Request is passed as a parameter. What exactly is expected to be returned to the function by this pointer from the driver side? What is the format of the thing the pointer points to after the call? If it is a struct then what struct?
Yes, I'm using Windows 11.
The application is written in C, using Winbase API, the particular function is ClearCommError (see https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-clearcommerror). The driver is a standard COM port driver using KMDF.
Any help would be greatly appreciated, thanks!