2005-10-31 16:46:46 +00:00
|
|
|
#include <ntifs.h>
|
|
|
|
#include <kbdmou.h>
|
|
|
|
#include <ntddkbd.h>
|
|
|
|
#include <stdio.h>
|
2008-11-30 19:28:11 +00:00
|
|
|
#include <pseh/pseh2.h>
|
2008-02-26 16:00:00 +00:00
|
|
|
|
2007-06-04 09:25:04 +00:00
|
|
|
#include <debug.h>
|
2007-03-18 00:27:02 +00:00
|
|
|
|
2006-01-07 06:31:55 +00:00
|
|
|
#define MAX_PATH 260
|
2005-10-31 16:46:46 +00:00
|
|
|
|
2006-07-17 22:13:40 +00:00
|
|
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
|
|
|
|
2009-08-24 17:12:25 +00:00
|
|
|
#define CLASS_TAG 'CdbK'
|
2008-07-25 20:24:46 +00:00
|
|
|
#define DPFLTR_CLASS_NAME_ID DPFLTR_KBDCLASS_ID
|
2007-06-04 09:25:04 +00:00
|
|
|
|
2005-10-31 16:46:46 +00:00
|
|
|
typedef enum
|
2005-05-01 20:38:29 +00:00
|
|
|
{
|
2005-10-31 16:46:46 +00:00
|
|
|
dsStopped,
|
|
|
|
dsStarted,
|
|
|
|
dsPaused,
|
|
|
|
dsRemoved,
|
|
|
|
dsSurpriseRemoved
|
2005-11-05 08:21:59 +00:00
|
|
|
} PORT_DEVICE_STATE;
|
2005-10-31 16:46:46 +00:00
|
|
|
|
2005-11-05 08:21:59 +00:00
|
|
|
typedef struct _CLASS_DRIVER_EXTENSION
|
2005-10-31 16:46:46 +00:00
|
|
|
{
|
2005-11-09 11:15:42 +00:00
|
|
|
UNICODE_STRING RegistryPath;
|
|
|
|
|
2005-10-31 16:46:46 +00:00
|
|
|
/* Registry settings */
|
|
|
|
ULONG ConnectMultiplePorts;
|
2005-11-05 08:21:59 +00:00
|
|
|
ULONG DataQueueSize;
|
|
|
|
UNICODE_STRING DeviceBaseName;
|
2005-05-01 20:38:29 +00:00
|
|
|
|
2005-11-05 08:21:59 +00:00
|
|
|
PDEVICE_OBJECT MainClassDeviceObject;
|
|
|
|
} CLASS_DRIVER_EXTENSION, *PCLASS_DRIVER_EXTENSION;
|
2005-05-01 20:38:29 +00:00
|
|
|
|
2005-10-31 16:46:46 +00:00
|
|
|
typedef struct _COMMON_DEVICE_EXTENSION
|
|
|
|
{
|
|
|
|
BOOLEAN IsClassDO;
|
|
|
|
} COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
|
2005-05-01 20:38:29 +00:00
|
|
|
|
2005-11-05 08:21:59 +00:00
|
|
|
typedef struct _PORT_DEVICE_EXTENSION
|
2005-10-31 16:46:46 +00:00
|
|
|
{
|
|
|
|
COMMON_DEVICE_EXTENSION Common;
|
2005-05-01 20:38:29 +00:00
|
|
|
|
2006-02-24 13:38:14 +00:00
|
|
|
LIST_ENTRY ListEntry;
|
|
|
|
PDEVICE_OBJECT DeviceObject;
|
2005-11-05 08:21:59 +00:00
|
|
|
PORT_DEVICE_STATE PnpState;
|
|
|
|
PDEVICE_OBJECT LowerDevice;
|
2006-04-16 07:17:34 +00:00
|
|
|
PDEVICE_OBJECT ClassDO;
|
2012-01-21 02:59:46 +00:00
|
|
|
HANDLE FileHandle;
|
2005-11-05 08:21:59 +00:00
|
|
|
UNICODE_STRING InterfaceName;
|
|
|
|
} PORT_DEVICE_EXTENSION, *PPORT_DEVICE_EXTENSION;
|
|
|
|
|
|
|
|
typedef struct _CLASS_DEVICE_EXTENSION
|
2005-10-31 16:46:46 +00:00
|
|
|
{
|
|
|
|
COMMON_DEVICE_EXTENSION Common;
|
2005-05-01 20:38:29 +00:00
|
|
|
|
2005-11-05 08:21:59 +00:00
|
|
|
PCLASS_DRIVER_EXTENSION DriverExtension;
|
2005-05-01 20:38:29 +00:00
|
|
|
|
2006-02-24 13:38:14 +00:00
|
|
|
LIST_ENTRY ListHead;
|
|
|
|
KSPIN_LOCK ListSpinLock;
|
2005-10-31 16:46:46 +00:00
|
|
|
KSPIN_LOCK SpinLock;
|
2007-11-02 12:36:50 +00:00
|
|
|
PIRP PendingIrp;
|
2007-03-18 00:27:02 +00:00
|
|
|
SIZE_T InputCount;
|
2005-10-31 16:46:46 +00:00
|
|
|
PKEYBOARD_INPUT_DATA PortData;
|
2006-07-17 22:13:40 +00:00
|
|
|
LPCWSTR DeviceName;
|
2005-11-05 08:21:59 +00:00
|
|
|
} CLASS_DEVICE_EXTENSION, *PCLASS_DEVICE_EXTENSION;
|
2005-05-01 20:38:29 +00:00
|
|
|
|
2005-10-31 16:46:46 +00:00
|
|
|
/* misc.c */
|
2005-05-01 20:38:29 +00:00
|
|
|
|
2006-02-24 13:38:14 +00:00
|
|
|
NTSTATUS
|
|
|
|
ForwardIrpAndWait(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN PIRP Irp);
|
|
|
|
|
2007-06-04 09:25:04 +00:00
|
|
|
DRIVER_DISPATCH ForwardIrpAndForget;
|
2007-03-18 00:27:02 +00:00
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
DuplicateUnicodeString(
|
|
|
|
IN ULONG Flags,
|
|
|
|
IN PCUNICODE_STRING SourceString,
|
|
|
|
OUT PUNICODE_STRING DestinationString);
|