fixed difference in signedness warning
[reactos.git] / reactos / drivers / input / sermouse / sermouse.h
1 #include <ntifs.h>
2 #include <kbdmou.h>
3 #include <ntddser.h>
4 #include <ntddmou.h>
5
6 #if defined(__GNUC__)
7 #include <stdio.h>
8
9 /* FIXME: these prototypes MUST NOT be here! */
10 NTSTATUS NTAPI
11 IoAttachDeviceToDeviceStackSafe(
12 IN PDEVICE_OBJECT SourceDevice,
13 IN PDEVICE_OBJECT TargetDevice,
14 OUT PDEVICE_OBJECT *AttachedToDeviceObject);
15 #elif defined(_MSC_VER)
16 NTSTATUS NTAPI
17 IoAttachDeviceToDeviceStackSafe(
18 IN PDEVICE_OBJECT SourceDevice,
19 IN PDEVICE_OBJECT TargetDevice,
20 OUT PDEVICE_OBJECT *AttachedToDeviceObject);
21 #else
22 #error Unknown compiler!
23 #endif
24
25 typedef enum
26 {
27 dsStopped,
28 dsStarted,
29 dsPaused,
30 dsRemoved,
31 dsSurpriseRemoved
32 } SERMOUSE_DEVICE_STATE;
33
34 typedef enum
35 {
36 mtNone, /* No Mouse */
37 mtMicrosoft, /* Microsoft Mouse with 2 buttons */
38 mtLogitech, /* Logitech Mouse with 3 buttons */
39 mtWheelZ /* Microsoft Wheel Mouse (aka Z Mouse) */
40 } SERMOUSE_MOUSE_TYPE;
41
42 /* Size for packet buffer used in interrupt routine */
43 #define PACKET_BUFFER_SIZE 4
44
45 /* Hardware byte mask for left button */
46 #define LEFT_BUTTON_MASK 0x20
47 /* Hardware to Microsoft specific code byte shift for left button */
48 #define LEFT_BUTTON_SHIFT 5
49 /* Hardware byte mask for right button */
50 #define RIGHT_BUTTON_MASK 0x10
51 /* Hardware to Microsoft specific code byte shift for right button */
52 #define RIGHT_BUTTON_SHIFT 3
53 /* Hardware byte mask for middle button */
54 #define MIDDLE_BUTTON_MASK 0x20
55 /* Hardware to Microsoft specific code byte shift for middle button */
56 #define MIDDLE_BUTTON_SHIFT 3
57
58 /* Microsoft byte mask for left button */
59 #define MOUSE_BUTTON_LEFT 0x01
60 /* Microsoft byte mask for right button */
61 #define MOUSE_BUTTON_RIGHT 0x02
62 /* Microsoft byte mask for middle button */
63 #define MOUSE_BUTTON_MIDDLE 0x04
64
65 typedef struct _SERMOUSE_DRIVER_EXTENSION
66 {
67 ULONG MouseDataQueueSize;
68 ULONG NumberOfButtons;
69 UNICODE_STRING PointerDeviceBaseName;
70 ULONG SampleRate;
71 } SERMOUSE_DRIVER_EXTENSION, *PSERMOUSE_DRIVER_EXTENSION;
72
73 typedef struct _SERMOUSE_DEVICE_EXTENSION
74 {
75 PDEVICE_OBJECT LowerDevice;
76 SERMOUSE_DEVICE_STATE PnpState;
77 SERMOUSE_MOUSE_TYPE MouseType;
78 PSERMOUSE_DRIVER_EXTENSION DriverExtension;
79
80 HANDLE WorkerThreadHandle;
81 KEVENT StopWorkerThreadEvent;
82
83 ULONG ActiveQueue;
84 ULONG InputDataCount[2];
85 CONNECT_DATA ConnectData;
86 MOUSE_INPUT_DATA* MouseInputData[2];
87 UCHAR PacketBuffer[PACKET_BUFFER_SIZE];
88 ULONG PacketBufferPosition;
89 ULONG PreviousButtons;
90 MOUSE_ATTRIBUTES AttributesInformation;
91 } SERMOUSE_DEVICE_EXTENSION, *PSERMOUSE_DEVICE_EXTENSION;
92
93 /************************************ createclose.c */
94
95 NTSTATUS NTAPI
96 SermouseCreate(
97 IN PDEVICE_OBJECT DeviceObject,
98 IN PIRP Irp);
99
100 NTSTATUS NTAPI
101 SermouseClose(
102 IN PDEVICE_OBJECT DeviceObject,
103 IN PIRP Irp);
104
105 NTSTATUS NTAPI
106 SermouseCleanup(
107 IN PDEVICE_OBJECT DeviceObject,
108 IN PIRP Irp);
109
110 /************************************ detect.c */
111
112 SERMOUSE_MOUSE_TYPE
113 SermouseDetectLegacyDevice(
114 IN PDEVICE_OBJECT LowerDevice);
115
116 /************************************ fdo.c */
117
118 NTSTATUS NTAPI
119 SermouseAddDevice(
120 IN PDRIVER_OBJECT DriverObject,
121 IN PDEVICE_OBJECT Pdo);
122
123 NTSTATUS NTAPI
124 SermousePnp(
125 IN PDEVICE_OBJECT DeviceObject,
126 IN PIRP Irp);
127
128 /************************************ internaldevctl.c */
129
130 NTSTATUS NTAPI
131 SermouseInternalDeviceControl(
132 IN PDEVICE_OBJECT DeviceObject,
133 IN PIRP Irp);
134
135 /************************************ misc.c */
136
137 NTSTATUS
138 ForwardIrpAndWait(
139 IN PDEVICE_OBJECT DeviceObject,
140 IN PIRP Irp);
141
142 NTSTATUS NTAPI
143 ForwardIrpAndForget(
144 IN PDEVICE_OBJECT DeviceObject,
145 IN PIRP Irp);
146
147 /************************************ readmouse.c */
148
149 VOID NTAPI
150 SermouseDeviceWorker(
151 PVOID Context);