2014-02-06 11:18:34 +00:00
|
|
|
#ifndef _SERMOUSE_PCH_
|
|
|
|
#define _SERMOUSE_PCH_
|
|
|
|
|
2014-01-29 10:56:25 +00:00
|
|
|
#include <ntddk.h>
|
2005-11-09 11:57:58 +00:00
|
|
|
#include <ntddser.h>
|
2014-01-29 10:56:25 +00:00
|
|
|
#include <kbdmou.h>
|
2005-11-09 11:57:58 +00:00
|
|
|
|
2009-08-24 17:12:25 +00:00
|
|
|
#define SERMOUSE_TAG 'uoMS'
|
2005-11-09 11:57:58 +00:00
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
dsStopped,
|
|
|
|
dsStarted,
|
|
|
|
dsPaused,
|
|
|
|
dsRemoved,
|
|
|
|
dsSurpriseRemoved
|
|
|
|
} SERMOUSE_DEVICE_STATE;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
mtNone, /* No Mouse */
|
|
|
|
mtMicrosoft, /* Microsoft Mouse with 2 buttons */
|
|
|
|
mtLogitech, /* Logitech Mouse with 3 buttons */
|
|
|
|
mtWheelZ /* Microsoft Wheel Mouse (aka Z Mouse) */
|
|
|
|
} SERMOUSE_MOUSE_TYPE;
|
|
|
|
|
|
|
|
/* Size for packet buffer used in interrupt routine */
|
|
|
|
#define PACKET_BUFFER_SIZE 4
|
|
|
|
|
|
|
|
/* Hardware byte mask for left button */
|
|
|
|
#define LEFT_BUTTON_MASK 0x20
|
|
|
|
/* Hardware to Microsoft specific code byte shift for left button */
|
|
|
|
#define LEFT_BUTTON_SHIFT 5
|
|
|
|
/* Hardware byte mask for right button */
|
|
|
|
#define RIGHT_BUTTON_MASK 0x10
|
|
|
|
/* Hardware to Microsoft specific code byte shift for right button */
|
|
|
|
#define RIGHT_BUTTON_SHIFT 3
|
|
|
|
/* Hardware byte mask for middle button */
|
|
|
|
#define MIDDLE_BUTTON_MASK 0x20
|
|
|
|
/* Hardware to Microsoft specific code byte shift for middle button */
|
|
|
|
#define MIDDLE_BUTTON_SHIFT 3
|
|
|
|
|
|
|
|
/* Microsoft byte mask for left button */
|
|
|
|
#define MOUSE_BUTTON_LEFT 0x01
|
|
|
|
/* Microsoft byte mask for right button */
|
|
|
|
#define MOUSE_BUTTON_RIGHT 0x02
|
|
|
|
/* Microsoft byte mask for middle button */
|
|
|
|
#define MOUSE_BUTTON_MIDDLE 0x04
|
|
|
|
|
|
|
|
typedef struct _SERMOUSE_DRIVER_EXTENSION
|
|
|
|
{
|
2006-06-07 17:33:57 +00:00
|
|
|
USHORT NumberOfButtons;
|
2005-11-09 11:57:58 +00:00
|
|
|
} SERMOUSE_DRIVER_EXTENSION, *PSERMOUSE_DRIVER_EXTENSION;
|
|
|
|
|
|
|
|
typedef struct _SERMOUSE_DEVICE_EXTENSION
|
|
|
|
{
|
|
|
|
PDEVICE_OBJECT LowerDevice;
|
|
|
|
SERMOUSE_DEVICE_STATE PnpState;
|
|
|
|
SERMOUSE_MOUSE_TYPE MouseType;
|
|
|
|
PSERMOUSE_DRIVER_EXTENSION DriverExtension;
|
|
|
|
|
|
|
|
HANDLE WorkerThreadHandle;
|
|
|
|
KEVENT StopWorkerThreadEvent;
|
|
|
|
|
|
|
|
ULONG ActiveQueue;
|
|
|
|
ULONG InputDataCount[2];
|
|
|
|
CONNECT_DATA ConnectData;
|
2006-04-23 08:46:25 +00:00
|
|
|
MOUSE_INPUT_DATA MouseInputData[2];
|
2005-11-09 11:57:58 +00:00
|
|
|
UCHAR PacketBuffer[PACKET_BUFFER_SIZE];
|
|
|
|
ULONG PacketBufferPosition;
|
|
|
|
ULONG PreviousButtons;
|
|
|
|
MOUSE_ATTRIBUTES AttributesInformation;
|
|
|
|
} SERMOUSE_DEVICE_EXTENSION, *PSERMOUSE_DEVICE_EXTENSION;
|
|
|
|
|
|
|
|
/************************************ createclose.c */
|
|
|
|
|
2007-03-18 00:27:02 +00:00
|
|
|
DRIVER_DISPATCH SermouseCreate;
|
2005-11-09 11:57:58 +00:00
|
|
|
|
2007-03-18 00:27:02 +00:00
|
|
|
DRIVER_DISPATCH SermouseClose;
|
2005-11-09 11:57:58 +00:00
|
|
|
|
2007-03-18 00:27:02 +00:00
|
|
|
DRIVER_DISPATCH SermouseCleanup;
|
2005-11-09 11:57:58 +00:00
|
|
|
|
|
|
|
/************************************ detect.c */
|
|
|
|
|
|
|
|
SERMOUSE_MOUSE_TYPE
|
|
|
|
SermouseDetectLegacyDevice(
|
|
|
|
IN PDEVICE_OBJECT LowerDevice);
|
|
|
|
|
|
|
|
/************************************ fdo.c */
|
|
|
|
|
2007-03-18 00:27:02 +00:00
|
|
|
DRIVER_ADD_DEVICE SermouseAddDevice;
|
2005-11-09 11:57:58 +00:00
|
|
|
|
2007-03-18 00:27:02 +00:00
|
|
|
DRIVER_DISPATCH SermousePnp;
|
2005-11-09 11:57:58 +00:00
|
|
|
|
|
|
|
/************************************ internaldevctl.c */
|
|
|
|
|
2007-03-18 00:27:02 +00:00
|
|
|
DRIVER_DISPATCH SermouseInternalDeviceControl;
|
2005-11-09 11:57:58 +00:00
|
|
|
|
|
|
|
/************************************ misc.c */
|
|
|
|
|
|
|
|
NTSTATUS NTAPI
|
|
|
|
ForwardIrpAndForget(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp);
|
|
|
|
|
|
|
|
/************************************ readmouse.c */
|
|
|
|
|
|
|
|
VOID NTAPI
|
|
|
|
SermouseDeviceWorker(
|
|
|
|
PVOID Context);
|
2014-02-06 11:18:34 +00:00
|
|
|
|
|
|
|
#endif /* _SERMOUSE_PCH_ */
|