190 lines
3.5 KiB
C
190 lines
3.5 KiB
C
|
/*++
|
||
|
Copyright (c) 1997 Microsoft Corporation
|
||
|
|
||
|
Module Name:
|
||
|
|
||
|
moufiltr.h
|
||
|
|
||
|
Abstract:
|
||
|
|
||
|
This module contains the common private declarations for the mouse
|
||
|
packet filter
|
||
|
|
||
|
Environment:
|
||
|
|
||
|
kernel mode only
|
||
|
|
||
|
Notes:
|
||
|
|
||
|
|
||
|
Revision History:
|
||
|
|
||
|
|
||
|
--*/
|
||
|
|
||
|
#ifndef MOUFILTER_H
|
||
|
#define MOUFILTER_H
|
||
|
|
||
|
#include "ntddk.h"
|
||
|
#include "kbdmou.h"
|
||
|
#include <ntddmou.h>
|
||
|
#include <ntdd8042.h>
|
||
|
|
||
|
#define MOUFILTER_POOL_TAG (ULONG) 'tlFM'
|
||
|
#undef ExAllocatePool
|
||
|
#define ExAllocatePool(type, size) \
|
||
|
ExAllocatePoolWithTag (type, size, MOUFILTER_POOL_TAG)
|
||
|
|
||
|
#if DBG
|
||
|
|
||
|
#define TRAP() DbgBreakPoint()
|
||
|
#define DbgRaiseIrql(_x_,_y_) KeRaiseIrql(_x_,_y_)
|
||
|
#define DbgLowerIrql(_x_) KeLowerIrql(_x_)
|
||
|
|
||
|
#else // DBG
|
||
|
|
||
|
#define TRAP()
|
||
|
#define DbgRaiseIrql(_x_,_y_)
|
||
|
#define DbgLowerIrql(_x_)
|
||
|
|
||
|
#endif
|
||
|
|
||
|
typedef struct _DEVICE_EXTENSION
|
||
|
{
|
||
|
//
|
||
|
// A backpointer to the device object for which this is the extension
|
||
|
//
|
||
|
PDEVICE_OBJECT Self;
|
||
|
|
||
|
//
|
||
|
// "THE PDO" (ejected by the bus)
|
||
|
//
|
||
|
PDEVICE_OBJECT PDO;
|
||
|
|
||
|
//
|
||
|
// The top of the stack before this filter was added. AKA the location
|
||
|
// to which all IRPS should be directed.
|
||
|
//
|
||
|
PDEVICE_OBJECT TopOfStack;
|
||
|
|
||
|
//
|
||
|
// Number of creates sent down
|
||
|
//
|
||
|
LONG EnableCount;
|
||
|
|
||
|
//
|
||
|
// Previous hook routine and context
|
||
|
//
|
||
|
PVOID UpperContext;
|
||
|
PI8042_MOUSE_ISR UpperIsrHook;
|
||
|
|
||
|
//
|
||
|
// Write to the mouse in the context of MouFilter_IsrHook
|
||
|
//
|
||
|
IN PI8042_ISR_WRITE_PORT IsrWritePort;
|
||
|
|
||
|
//
|
||
|
// Context for IsrWritePort, QueueMousePacket
|
||
|
//
|
||
|
IN PVOID CallContext;
|
||
|
|
||
|
//
|
||
|
// Queue the current packet (ie the one passed into MouFilter_IsrHook)
|
||
|
// to be reported to the class driver
|
||
|
//
|
||
|
IN PI8042_QUEUE_PACKET QueueMousePacket;
|
||
|
|
||
|
//
|
||
|
// The real connect data that this driver reports to
|
||
|
//
|
||
|
CONNECT_DATA UpperConnectData;
|
||
|
|
||
|
//
|
||
|
// current power state of the device
|
||
|
//
|
||
|
DEVICE_POWER_STATE DeviceState;
|
||
|
|
||
|
//
|
||
|
// State of the stack and this device object
|
||
|
//
|
||
|
BOOLEAN Started;
|
||
|
BOOLEAN SurpriseRemoved;
|
||
|
BOOLEAN Removed;
|
||
|
|
||
|
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
|
||
|
|
||
|
//
|
||
|
// Prototypes
|
||
|
//
|
||
|
|
||
|
NTSTATUS
|
||
|
MouFilter_AddDevice(
|
||
|
IN PDRIVER_OBJECT DriverObject,
|
||
|
IN PDEVICE_OBJECT BusDeviceObject
|
||
|
);
|
||
|
|
||
|
NTSTATUS
|
||
|
MouFilter_CreateClose (
|
||
|
IN PDEVICE_OBJECT DeviceObject,
|
||
|
IN PIRP Irp
|
||
|
);
|
||
|
|
||
|
NTSTATUS
|
||
|
MouFilter_DispatchPassThrough(
|
||
|
IN PDEVICE_OBJECT DeviceObject,
|
||
|
IN PIRP Irp
|
||
|
);
|
||
|
|
||
|
NTSTATUS
|
||
|
MouFilter_InternIoCtl (
|
||
|
IN PDEVICE_OBJECT DeviceObject,
|
||
|
IN PIRP Irp
|
||
|
);
|
||
|
|
||
|
NTSTATUS
|
||
|
MouFilter_IoCtl (
|
||
|
IN PDEVICE_OBJECT DeviceObject,
|
||
|
IN PIRP Irp
|
||
|
);
|
||
|
|
||
|
NTSTATUS
|
||
|
MouFilter_PnP (
|
||
|
IN PDEVICE_OBJECT DeviceObject,
|
||
|
IN PIRP Irp
|
||
|
);
|
||
|
|
||
|
NTSTATUS
|
||
|
MouFilter_Power (
|
||
|
IN PDEVICE_OBJECT DeviceObject,
|
||
|
IN PIRP Irp
|
||
|
);
|
||
|
|
||
|
BOOLEAN
|
||
|
MouFilter_IsrHook (
|
||
|
PDEVICE_OBJECT DeviceObject,
|
||
|
PMOUSE_INPUT_DATA CurrentInput,
|
||
|
POUTPUT_PACKET CurrentOutput,
|
||
|
UCHAR StatusByte,
|
||
|
PUCHAR DataByte,
|
||
|
PBOOLEAN ContinueProcessing,
|
||
|
PMOUSE_STATE MouseState,
|
||
|
PMOUSE_RESET_SUBSTATE ResetSubState
|
||
|
);
|
||
|
|
||
|
VOID
|
||
|
MouFilter_ServiceCallback(
|
||
|
IN PDEVICE_OBJECT DeviceObject,
|
||
|
IN PMOUSE_INPUT_DATA InputDataStart,
|
||
|
IN PMOUSE_INPUT_DATA InputDataEnd,
|
||
|
IN OUT PULONG InputDataConsumed
|
||
|
);
|
||
|
|
||
|
VOID
|
||
|
MouFilter_Unload (
|
||
|
IN PDRIVER_OBJECT DriverObject
|
||
|
);
|
||
|
|
||
|
#endif // MOUFILTER_H
|
||
|
|
||
|
|