1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194:
| #ifndef _INTERCEPTION_H_ #define _INTERCEPTION_H_
#ifdef INTERCEPTION_STATIC #define INTERCEPTION_API #else #if defined _WIN32 || defined __CYGWIN__ #ifdef INTERCEPTION_EXPORT #ifdef __GNUC__ #define INTERCEPTION_API __attribute__((dllexport)) #else #define INTERCEPTION_API __declspec(dllexport) #endif #else #ifdef __GNUC__ #define INTERCEPTION_API __attribute__((dllimport)) #else #define INTERCEPTION_API __declspec(dllimport) #endif #endif #else #if __GNUC__ >= 4 #define INTERCEPTION_API __attribute__ ((visibility("default"))) #else #define INTERCEPTION_API #endif #endif #endif
#ifdef __cplusplus extern "C" { #endif
#define INTERCEPTION_MAX_KEYBOARD 10
#define INTERCEPTION_MAX_MOUSE 10
#define INTERCEPTION_MAX_DEVICE ((INTERCEPTION_MAX_KEYBOARD) + (INTERCEPTION_MAX_MOUSE))
#define INTERCEPTION_KEYBOARD(index) ((index) + 1)
#define INTERCEPTION_MOUSE(index) ((INTERCEPTION_MAX_KEYBOARD) + (index) + 1)
typedef void *InterceptionContext;
typedef int InterceptionDevice;
typedef int InterceptionPrecedence;
typedef unsigned short InterceptionFilter;
typedef int (*InterceptionPredicate)(InterceptionDevice device);
enum InterceptionKeyState { INTERCEPTION_KEY_DOWN = 0x00, INTERCEPTION_KEY_UP = 0x01, INTERCEPTION_KEY_E0 = 0x02, INTERCEPTION_KEY_E1 = 0x04, INTERCEPTION_KEY_TERMSRV_SET_LED = 0x08, INTERCEPTION_KEY_TERMSRV_SHADOW = 0x10, INTERCEPTION_KEY_TERMSRV_VKPACKET = 0x20 };
enum InterceptionFilterKeyState { INTERCEPTION_FILTER_KEY_NONE = 0x0000, INTERCEPTION_FILTER_KEY_ALL = 0xFFFF, INTERCEPTION_FILTER_KEY_DOWN = INTERCEPTION_KEY_UP, INTERCEPTION_FILTER_KEY_UP = INTERCEPTION_KEY_UP << 1, INTERCEPTION_FILTER_KEY_E0 = INTERCEPTION_KEY_E0 << 1, INTERCEPTION_FILTER_KEY_E1 = INTERCEPTION_KEY_E1 << 1, INTERCEPTION_FILTER_KEY_TERMSRV_SET_LED = INTERCEPTION_KEY_TERMSRV_SET_LED << 1, INTERCEPTION_FILTER_KEY_TERMSRV_SHADOW = INTERCEPTION_KEY_TERMSRV_SHADOW << 1, INTERCEPTION_FILTER_KEY_TERMSRV_VKPACKET = INTERCEPTION_KEY_TERMSRV_VKPACKET << 1 };
enum InterceptionMouseState { INTERCEPTION_MOUSE_LEFT_BUTTON_DOWN = 0x001, INTERCEPTION_MOUSE_LEFT_BUTTON_UP = 0x002, INTERCEPTION_MOUSE_RIGHT_BUTTON_DOWN = 0x004, INTERCEPTION_MOUSE_RIGHT_BUTTON_UP = 0x008, INTERCEPTION_MOUSE_MIDDLE_BUTTON_DOWN = 0x010, INTERCEPTION_MOUSE_MIDDLE_BUTTON_UP = 0x020,
INTERCEPTION_MOUSE_BUTTON_1_DOWN = INTERCEPTION_MOUSE_LEFT_BUTTON_DOWN, INTERCEPTION_MOUSE_BUTTON_1_UP = INTERCEPTION_MOUSE_LEFT_BUTTON_UP, INTERCEPTION_MOUSE_BUTTON_2_DOWN = INTERCEPTION_MOUSE_RIGHT_BUTTON_DOWN, INTERCEPTION_MOUSE_BUTTON_2_UP = INTERCEPTION_MOUSE_RIGHT_BUTTON_UP, INTERCEPTION_MOUSE_BUTTON_3_DOWN = INTERCEPTION_MOUSE_MIDDLE_BUTTON_DOWN, INTERCEPTION_MOUSE_BUTTON_3_UP = INTERCEPTION_MOUSE_MIDDLE_BUTTON_UP,
INTERCEPTION_MOUSE_BUTTON_4_DOWN = 0x040, INTERCEPTION_MOUSE_BUTTON_4_UP = 0x080, INTERCEPTION_MOUSE_BUTTON_5_DOWN = 0x100, INTERCEPTION_MOUSE_BUTTON_5_UP = 0x200,
INTERCEPTION_MOUSE_WHEEL = 0x400, INTERCEPTION_MOUSE_HWHEEL = 0x800 };
enum InterceptionFilterMouseState { INTERCEPTION_FILTER_MOUSE_NONE = 0x0000, INTERCEPTION_FILTER_MOUSE_ALL = 0xFFFF,
INTERCEPTION_FILTER_MOUSE_LEFT_BUTTON_DOWN = INTERCEPTION_MOUSE_LEFT_BUTTON_DOWN, INTERCEPTION_FILTER_MOUSE_LEFT_BUTTON_UP = INTERCEPTION_MOUSE_LEFT_BUTTON_UP, INTERCEPTION_FILTER_MOUSE_RIGHT_BUTTON_DOWN = INTERCEPTION_MOUSE_RIGHT_BUTTON_DOWN, INTERCEPTION_FILTER_MOUSE_RIGHT_BUTTON_UP = INTERCEPTION_MOUSE_RIGHT_BUTTON_UP, INTERCEPTION_FILTER_MOUSE_MIDDLE_BUTTON_DOWN = INTERCEPTION_MOUSE_MIDDLE_BUTTON_DOWN, INTERCEPTION_FILTER_MOUSE_MIDDLE_BUTTON_UP = INTERCEPTION_MOUSE_MIDDLE_BUTTON_UP,
INTERCEPTION_FILTER_MOUSE_BUTTON_1_DOWN = INTERCEPTION_MOUSE_BUTTON_1_DOWN, INTERCEPTION_FILTER_MOUSE_BUTTON_1_UP = INTERCEPTION_MOUSE_BUTTON_1_UP, INTERCEPTION_FILTER_MOUSE_BUTTON_2_DOWN = INTERCEPTION_MOUSE_BUTTON_2_DOWN, INTERCEPTION_FILTER_MOUSE_BUTTON_2_UP = INTERCEPTION_MOUSE_BUTTON_2_UP, INTERCEPTION_FILTER_MOUSE_BUTTON_3_DOWN = INTERCEPTION_MOUSE_BUTTON_3_DOWN, INTERCEPTION_FILTER_MOUSE_BUTTON_3_UP = INTERCEPTION_MOUSE_BUTTON_3_UP,
INTERCEPTION_FILTER_MOUSE_BUTTON_4_DOWN = INTERCEPTION_MOUSE_BUTTON_4_DOWN, INTERCEPTION_FILTER_MOUSE_BUTTON_4_UP = INTERCEPTION_MOUSE_BUTTON_4_UP, INTERCEPTION_FILTER_MOUSE_BUTTON_5_DOWN = INTERCEPTION_MOUSE_BUTTON_5_DOWN, INTERCEPTION_FILTER_MOUSE_BUTTON_5_UP = INTERCEPTION_MOUSE_BUTTON_5_UP,
INTERCEPTION_FILTER_MOUSE_WHEEL = INTERCEPTION_MOUSE_WHEEL, INTERCEPTION_FILTER_MOUSE_HWHEEL = INTERCEPTION_MOUSE_HWHEEL,
INTERCEPTION_FILTER_MOUSE_MOVE = 0x1000 };
enum InterceptionMouseFlag { INTERCEPTION_MOUSE_MOVE_RELATIVE = 0x000, INTERCEPTION_MOUSE_MOVE_ABSOLUTE = 0x001, INTERCEPTION_MOUSE_VIRTUAL_DESKTOP = 0x002, INTERCEPTION_MOUSE_ATTRIBUTES_CHANGED = 0x004, INTERCEPTION_MOUSE_MOVE_NOCOALESCE = 0x008, INTERCEPTION_MOUSE_TERMSRV_SRC_SHADOW = 0x100 };
typedef struct { unsigned short state; unsigned short flags; short rolling; int x; int y; unsigned int information; } InterceptionMouseStroke;
typedef struct { unsigned short code; unsigned short state; unsigned int information; } InterceptionKeyStroke;
typedef char InterceptionStroke[sizeof(InterceptionMouseStroke)];
InterceptionContext INTERCEPTION_API interception_create_context(void);
void INTERCEPTION_API interception_destroy_context(InterceptionContext context);
InterceptionPrecedence INTERCEPTION_API interception_get_precedence(InterceptionContext context, InterceptionDevice device);
void INTERCEPTION_API interception_set_precedence(InterceptionContext context, InterceptionDevice device, InterceptionPrecedence precedence);
InterceptionFilter INTERCEPTION_API interception_get_filter(InterceptionContext context, InterceptionDevice device);
void INTERCEPTION_API interception_set_filter(InterceptionContext context, InterceptionPredicate predicate, InterceptionFilter filter);
InterceptionDevice INTERCEPTION_API interception_wait(InterceptionContext context);
InterceptionDevice INTERCEPTION_API interception_wait_with_timeout(InterceptionContext context, unsigned long milliseconds);
int INTERCEPTION_API interception_send(InterceptionContext context, InterceptionDevice device, const InterceptionStroke *stroke, unsigned int nstroke);
int INTERCEPTION_API interception_receive(InterceptionContext context, InterceptionDevice device, InterceptionStroke *stroke, unsigned int nstroke);
unsigned int INTERCEPTION_API interception_get_hardware_id(InterceptionContext context, InterceptionDevice device, void *hardware_id_buffer, unsigned int buffer_size);
int INTERCEPTION_API interception_is_invalid(InterceptionDevice device);
int INTERCEPTION_API interception_is_keyboard(InterceptionDevice device);
int INTERCEPTION_API interception_is_mouse(InterceptionDevice device);
#ifdef __cplusplus } #endif
#endif |