22{
25
26 MouseInput = DeviceExtension->MouseBuffer + DeviceExtension->MouseInBuffer;
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 switch (DeviceExtension->MouseState)
61 {
64 DeviceExtension->MouseLogiBuffer[DeviceExtension->MouseState] =
Input;
65 DeviceExtension->MouseState++;
66 break;
67
69 DeviceExtension->MouseLogiBuffer[2] =
Input;
71
72
73
74 if (!(DeviceExtension->MouseLogiBuffer[0] & 0xC0))
75 {
77 i8042MouHandle(DeviceExtension, DeviceExtension->MouseLogiBuffer[0]);
78 i8042MouHandle(DeviceExtension, DeviceExtension->MouseLogiBuffer[1]);
79 i8042MouHandle(DeviceExtension, DeviceExtension->MouseLogiBuffer[2]);
80
81
82
83
84
85 return;
86 }
87
88
89 if (((DeviceExtension->MouseLogiBuffer[0] & 0x48) != 0x48) ||
90 (((DeviceExtension->MouseLogiBuffer[1] & 0x0C) >> 2) !=
91 (DeviceExtension->MouseLogiBuffer[2] & 0x03)))
92 {
93 WARN_(I8042PRT,
"Ps2pp packet fails sanity checks\n");
94 return;
95 }
96
97
98 PktType = ((DeviceExtension->MouseLogiBuffer[0] & 0x30) >> 2) |
99 ((DeviceExtension->MouseLogiBuffer[1] & 0x30) >> 4);
100
101 switch (PktType)
102 {
103 case 0:
104
105
106
107
108 return;
109 case 1:
111 if (DeviceExtension->MouseLogiBuffer[2] & 0x10)
113
114 if (DeviceExtension->MouseLogiBuffer[2] & 0x20)
116
117 if (DeviceExtension->MouseLogiBuffer[2] & 0x0F)
118 {
120 if (DeviceExtension->MouseLogiBuffer[2] & 0x08)
121 MouseInput->
ButtonData = (DeviceExtension->MouseLogiBuffer[2] & 0x07) - 8;
122 else
123 MouseInput->
ButtonData = DeviceExtension->MouseLogiBuffer[2] & 0x07;
124 }
126 DeviceExtension,
128 DeviceExtension->MouseHook.QueueMousePacket(DeviceExtension->MouseHook.CallContext);
129 return;
130 default:
131
132
133
134 return;
135 }
136
137 default:
138 WARN_(I8042PRT,
"Unexpected input state for ps2pp!\n");
139 }
140}
VOID i8042MouHandle(IN PI8042_MOUSE_EXTENSION DeviceExtension, IN UCHAR Output)
VOID i8042MouHandleButtons(IN PI8042_MOUSE_EXTENSION DeviceExtension, IN USHORT Mask)
#define MOUSE_BUTTON_4_DOWN
#define MOUSE_BUTTON_5_DOWN
#define RtlZeroMemory(Destination, Length)