Files
TeamTofuShop_capnhook/hooklib/uart.h
T
2024-08-20 11:29:32 -04:00

43 lines
865 B
C

#pragma once
#include <windows.h>
#ifdef __GNUC__
#include <ntdef.h>
#else
#include <winnt.h>
#endif
#include <devioctl.h>
#include <ntddser.h>
#include <stdbool.h>
#include "hook/iobuf.h"
#include "hook/iohook.h"
struct uart {
HANDLE fd;
unsigned int port_no;
SERIAL_BAUD_RATE baud;
SERIAL_STATUS status;
SERIAL_CHARS chars;
SERIAL_HANDFLOW handflow;
SERIAL_LINE_CONTROL line;
SERIAL_TIMEOUTS timeouts;
DWORD mask;
bool cts_on;
bool dsr_on;
bool ring_on;
bool rlsd_on;
bool dtr_on;
bool rts_on;
ULONG modem_control;
struct iobuf written;
struct iobuf readable;
};
void uart_init(struct uart *uart, unsigned int port_no);
void uart_fini(struct uart *uart);
bool uart_match_irp(const struct uart *uart, const struct irp *irp);
HRESULT uart_handle_irp(struct uart *uart, struct irp *irp);