micetools/src/micetools/dll/comdevice.h

23 lines
617 B
C
Raw Normal View History

2022-07-02 15:07:54 +00:00
#pragma once
#include "hooks/com.h"
#include "common.h"
#include "hooks/files.h"
2022-06-13 03:22:52 +00:00
typedef struct com_device {
com_hook_t* com;
file_hook_t* file;
2022-07-02 15:07:54 +00:00
ring_buffer_t in;
ring_buffer_t out;
2022-06-13 03:22:52 +00:00
HANDLE event;
2022-07-02 15:07:54 +00:00
HANDLE thread;
2022-06-13 03:22:52 +00:00
} com_device_t;
2022-07-02 15:07:54 +00:00
typedef DWORD(WINAPI FnComDeviceThread)(com_device_t* com);
short comdev_read(com_device_t* com, unsigned char* buffer, short bytes);
bool comdev_write(com_device_t* com, unsigned char* buffer, short bytes);
short comdev_available(com_device_t* com);
void com_device_thread(com_device_t* com, FnComDeviceThread* thread);
com_device_t* new_com_device(BYTE port);