Windows串口编程的IOCTL和函数
2023-06-15
158
0
下面是常见的IOCTL及对应的Win32 API函数列表,包括COM端口和USB设备的操作。
IOCTRL的宏定义位于文件:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\ntddser.h
中
IOCTL值 | Win32 API函数 |
---|---|
IOCTL_SERIAL_GET_DTRRTS | GetCommModemStatus |
IOCTL_SERIAL_SET_DTR | EscapeCommFunction |
IOCTL_SERIAL_CLR_DTR | EscapeCommFunction |
IOCTL_SERIAL_SET_RTS | EscapeCommFunction |
IOCTL_SERIAL_CLR_RTS | EscapeCommFunction |
IOCTL_SERIAL_GET_CONFIG | GetCommConfig |
IOCTL_SERIAL_SET_CONFIG | SetCommConfig |
IOCTL_SERIAL_SET_BREAK_ON | EscapeCommFunction |
IOCTL_SERIAL_SET_BREAK_OFF | EscapeCommFunction |
IOCTL_SERIAL_SET_WAIT_MASK | SetCommMask |
IOCTL_SERIAL_WAIT_ON_MASK | WaitCommEvent |
IOCTL_SERIAL_SET_CHAR | SetCommState |
IOCTL_SERIAL_GET_CHAR | GetCommState |
IOCTL_SERIAL_SET_TIMEOUTS | SetCommTimeouts |
IOCTL_SERIAL_GET_TIMEOUTS | GetCommTimeouts |
IOCTL_SERIAL_GET_PROPERTIES | GetCommProperties |
IOCTL_SERIAL_GET_MODEMSTATUS | GetCommModemStatus |
IOCTL_SERIAL_GET_COMMSTATUS | GetCommError |
IOCTL_SERIAL_XOFF_COUNTER | ClearCommError |
IOCTL_SERIAL_LSRMST_INSERT | DeviceIoControl |
IOCTL_SERIAL_LSRMST_ESCAPE | EscapeCommFunction |
IOCTL_SERIAL_GET_STATS | DeviceIoControl |
IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION | DeviceIoControl |
IOCTL_USB_GET_NODE_CONNECTION_INFORMATION | DeviceIoControl |
IOCTL_USB_GET_NODE_CONNECTION_NAME | DeviceIoControl |
IOCTL_USB_GET_NODE_INFORMATION | DeviceIoControl |
IOCTL_USB_GET_DEVICE_DESCRIPTOR | DeviceIoControl |
IOCTL_USB_GET_DESCRIPTOR_FROM_DEVICE | DeviceIoControl |
IOCTL_USB_GET_DESCRIPTOR_REQUEST | DeviceIoControl |
IOCTL_USB_GET_STATUS_REQUEST | DeviceIoControl |
IOCTL_USB_CYCLE_PORT | DeviceIoControl |
IOCTL_USB_GET_HUB_CAPABILITIES_EX | DeviceIoControl |
IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME | DeviceIoControl |
IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX | DeviceIoControl |
IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES | DeviceIoControl |
IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX_V2 | DeviceIoControl |
IOCTL_USB_GET_POWER_STATE_MAP | DeviceIoControl |
IOCTL_USB_GET_HUB_CAPABILITIES_EX2 | DeviceIoControl |
注意:由于DeviceIoControl
函数是通用的设备通信函数,例如对于USB设备,您需要设置不同的IOCTL
值来获得有关设备的信息。