[FASTFAT] Lock DirResource when modifying an entry on disk.
[reactos.git] / drivers / input / sermouse / sermouse.h
1 #ifndef _SERMOUSE_PCH_
2 #define _SERMOUSE_PCH_
3
4 #include <ntddk.h>
5 #include <ntddser.h>
6 #include <kbdmou.h>
7
8 #define SERMOUSE_TAG 'uoMS'
9
10 typedef enum
11 {
12 dsStopped,
13 dsStarted,
14 dsPaused,
15 dsRemoved,
16 dsSurpriseRemoved
17 } SERMOUSE_DEVICE_STATE;
18
19 typedef enum
20 {
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;
26
27 /* Size for packet buffer used in interrupt routine */
28 #define PACKET_BUFFER_SIZE 4
29
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
42
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
49
50 typedef struct _SERMOUSE_DRIVER_EXTENSION
51 {
52 USHORT NumberOfButtons;
53 } SERMOUSE_DRIVER_EXTENSION, *PSERMOUSE_DRIVER_EXTENSION;
54
55 typedef struct _SERMOUSE_DEVICE_EXTENSION
56 {
57 PDEVICE_OBJECT LowerDevice;
58 SERMOUSE_DEVICE_STATE PnpState;
59 SERMOUSE_MOUSE_TYPE MouseType;
60 PSERMOUSE_DRIVER_EXTENSION DriverExtension;
61
62 HANDLE WorkerThreadHandle;
63 KEVENT StopWorkerThreadEvent;
64
65 ULONG ActiveQueue;
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;
74
75 /************************************ createclose.c */
76
77 DRIVER_DISPATCH SermouseCreate;
78
79 DRIVER_DISPATCH SermouseClose;
80
81 DRIVER_DISPATCH SermouseCleanup;
82
83 /************************************ detect.c */
84
85 SERMOUSE_MOUSE_TYPE
86 SermouseDetectLegacyDevice(
87 IN PDEVICE_OBJECT LowerDevice);
88
89 /************************************ fdo.c */
90
91 DRIVER_ADD_DEVICE SermouseAddDevice;
92
93 DRIVER_DISPATCH SermousePnp;
94
95 /************************************ internaldevctl.c */
96
97 DRIVER_DISPATCH SermouseInternalDeviceControl;
98
99 /************************************ misc.c */
100
101 NTSTATUS
102 ForwardIrpAndWait(
103 IN PDEVICE_OBJECT DeviceObject,
104 IN PIRP Irp);
105
106 NTSTATUS NTAPI
107 ForwardIrpAndForget(
108 IN PDEVICE_OBJECT DeviceObject,
109 IN PIRP Irp);
110
111 /************************************ readmouse.c */
112
113 VOID NTAPI
114 SermouseDeviceWorker(
115 PVOID Context);
116
117 #endif /* _SERMOUSE_PCH_ */