7 #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
8 #define SERMOUSE_TAG TAG('S', 'M', 'o', 'u')
17 } SERMOUSE_DEVICE_STATE
;
21 mtNone
, /* No Mouse */
22 mtMicrosoft
, /* Microsoft Mouse with 2 buttons */
23 mtLogitech
, /* Logitech Mouse with 3 buttons */
24 mtWheelZ
/* Microsoft Wheel Mouse (aka Z Mouse) */
25 } SERMOUSE_MOUSE_TYPE
;
27 /* Size for packet buffer used in interrupt routine */
28 #define PACKET_BUFFER_SIZE 4
30 /* Hardware byte mask for left button */
31 #define LEFT_BUTTON_MASK 0x20
32 /* Hardware to Microsoft specific code byte shift for left button */
33 #define LEFT_BUTTON_SHIFT 5
34 /* Hardware byte mask for right button */
35 #define RIGHT_BUTTON_MASK 0x10
36 /* Hardware to Microsoft specific code byte shift for right button */
37 #define RIGHT_BUTTON_SHIFT 3
38 /* Hardware byte mask for middle button */
39 #define MIDDLE_BUTTON_MASK 0x20
40 /* Hardware to Microsoft specific code byte shift for middle button */
41 #define MIDDLE_BUTTON_SHIFT 3
43 /* Microsoft byte mask for left button */
44 #define MOUSE_BUTTON_LEFT 0x01
45 /* Microsoft byte mask for right button */
46 #define MOUSE_BUTTON_RIGHT 0x02
47 /* Microsoft byte mask for middle button */
48 #define MOUSE_BUTTON_MIDDLE 0x04
50 typedef struct _SERMOUSE_DRIVER_EXTENSION
52 USHORT NumberOfButtons
;
53 } SERMOUSE_DRIVER_EXTENSION
, *PSERMOUSE_DRIVER_EXTENSION
;
55 typedef struct _SERMOUSE_DEVICE_EXTENSION
57 PDEVICE_OBJECT LowerDevice
;
58 SERMOUSE_DEVICE_STATE PnpState
;
59 SERMOUSE_MOUSE_TYPE MouseType
;
60 PSERMOUSE_DRIVER_EXTENSION DriverExtension
;
62 HANDLE WorkerThreadHandle
;
63 KEVENT StopWorkerThreadEvent
;
66 ULONG InputDataCount
[2];
67 CONNECT_DATA ConnectData
;
68 MOUSE_INPUT_DATA MouseInputData
[2];
69 UCHAR PacketBuffer
[PACKET_BUFFER_SIZE
];
70 ULONG PacketBufferPosition
;
71 ULONG PreviousButtons
;
72 MOUSE_ATTRIBUTES AttributesInformation
;
73 } SERMOUSE_DEVICE_EXTENSION
, *PSERMOUSE_DEVICE_EXTENSION
;
75 /************************************ createclose.c */
77 DRIVER_DISPATCH SermouseCreate
;
79 DRIVER_DISPATCH SermouseClose
;
81 DRIVER_DISPATCH SermouseCleanup
;
83 /************************************ detect.c */
86 SermouseDetectLegacyDevice(
87 IN PDEVICE_OBJECT LowerDevice
);
89 /************************************ fdo.c */
91 DRIVER_ADD_DEVICE SermouseAddDevice
;
93 DRIVER_DISPATCH SermousePnp
;
95 /************************************ internaldevctl.c */
97 DRIVER_DISPATCH SermouseInternalDeviceControl
;
99 /************************************ misc.c */
103 IN PDEVICE_OBJECT DeviceObject
,
108 IN PDEVICE_OBJECT DeviceObject
,
111 /************************************ readmouse.c */
114 SermouseDeviceWorker(