forked from BestBurning/kmclass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kmclass.h
158 lines (114 loc) · 3.88 KB
/
kmclass.h
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
#ifndef _KEYMOUSE_H
#define _KEYMOUSE_H
#ifndef METHOD_BUFFERED
#define METHOD_BUFFERED 0
#endif
#ifndef CTL_CODE
#define CTL_CODE( DeviceType, Function, Method, Access ) ( \
((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
)
#endif
#ifndef FILE_ANY_ACCESS
#define FILE_ANY_ACCESS 0
#endif
#ifndef KEYBOARD_DEVICE
#define KEYBOARD_DEVICE 0
#endif
#ifndef MOUSE_DEVICE
#define MOUSE_DEVICE 1
#endif
//
// Define the various device type values. Note that values used by Microsoft
// Corporation are in the range 0-0x7FFF(32767), and 0x8000(32768)-0xFFFF(65535)
// are reserved for use by customers.
//
#define FILE_DEVICE_KEYMOUSE 0x8000
//
// Macro definition for defining IOCTL and FSCTL function control codes. Note
// that function codes 0-0x7FF(2047) are reserved for Microsoft Corporation,
// and 0x800(2048)-0xFFF(4095) are reserved for customers.
//
#define KEYMOUSE_IOCTL_BASE 0x800
//
// The device driver IOCTLs
//
#define CTL_CODE_KEYMOUSE(i) (ULONG)(CTL_CODE(FILE_DEVICE_KEYMOUSE, KEYMOUSE_IOCTL_BASE + i, METHOD_BUFFERED, FILE_ANY_ACCESS))
#define IOCTL_KEYBOARD CTL_CODE_KEYMOUSE(0)
#define IOCTL_MOUSE CTL_CODE_KEYMOUSE(1)
//
// Name that Win32 front end will use to open the KeyMouse device
//
#define KEYMOUSE_DEVICE_NAME L"\\Device\\kmclass"
#define KEYMOUSE_DOS_DEVICE_NAME L"\\DosDevices\\kmclass"
#ifdef UNICODE
#define KEYMOUSE_WIN32_DEVICE_NAME L"\\\\.\\kmclass"
#define KEYMOUSE_DRIVER_NAME L"kmclass"
#else
#define KEYMOUSE_WIN32_DEVICE_NAME "\\\\.\\kmclass"
#define KEYMOUSE_DRIVER_NAME "kmclass"
#endif
typedef struct _KEYBOARD_INPUT_DATA {
USHORT UnitId;
USHORT MakeCode;
USHORT Flags;
USHORT Reserved;
ULONG ExtraInformation;
} KEYBOARD_INPUT_DATA, * PKEYBOARD_INPUT_DATA;
//
// Define the keyboard input data Flags.
//
#define KEY_MAKE 0
#define KEY_BREAK 1
#define KEY_E0 2
#define KEY_E1 4
#define KEY_TERMSRV_SET_LED 8
#define KEY_TERMSRV_SHADOW 0x10
#define KEY_TERMSRV_VKPACKET 0x20
#define KEY_DOWN KEY_MAKE
#define KEY_UP KEY_BREAK
#define KEY_BLANK -1
typedef struct _MOUSE_INPUT_DATA {
USHORT UnitId;
USHORT Flags;
union {
ULONG Buttons;
struct {
USHORT ButtonFlags;
USHORT ButtonData;
};
};
ULONG RawButtons;
LONG LastX;
LONG LastY;
ULONG ExtraInformation;
} MOUSE_INPUT_DATA, * PMOUSE_INPUT_DATA;
//
// Define the mouse button state indicators.
//
#define MOUSE_LEFT_BUTTON 0x0001
#define MOUSE_RIGHT_BUTTON 0x0002
#define MOUSE_LEFT_BUTTON_DOWN 0x0001 // Left Button changed to down.
#define MOUSE_LEFT_BUTTON_UP 0x0002 // Left Button changed to up.
#define MOUSE_RIGHT_BUTTON_DOWN 0x0004 // Right Button changed to down.
#define MOUSE_RIGHT_BUTTON_UP 0x0008 // Right Button changed to up.
#define MOUSE_MIDDLE_BUTTON_DOWN 0x0010 // Middle Button changed to down.
#define MOUSE_MIDDLE_BUTTON_UP 0x0020 // Middle Button changed to up.
#define MOUSE_BUTTON_1_DOWN MOUSE_LEFT_BUTTON_DOWN
#define MOUSE_BUTTON_1_UP MOUSE_LEFT_BUTTON_UP
#define MOUSE_BUTTON_2_DOWN MOUSE_RIGHT_BUTTON_DOWN
#define MOUSE_BUTTON_2_UP MOUSE_RIGHT_BUTTON_UP
#define MOUSE_BUTTON_3_DOWN MOUSE_MIDDLE_BUTTON_DOWN
#define MOUSE_BUTTON_3_UP MOUSE_MIDDLE_BUTTON_UP
#define MOUSE_BUTTON_4_DOWN 0x0040
#define MOUSE_BUTTON_4_UP 0x0080
#define MOUSE_BUTTON_5_DOWN 0x0100
#define MOUSE_BUTTON_5_UP 0x0200
#define MOUSE_WHEEL 0x0400
//
// Define the mouse indicator flags.
//
#define MOUSE_MOVE_RELATIVE 0
#define MOUSE_MOVE_ABSOLUTE 1
#define MOUSE_VIRTUAL_DESKTOP 0x02 // the coordinates are mapped to the virtual desktop
#define MOUSE_ATTRIBUTES_CHANGED 0x04 // requery for mouse attributes
#endif