1 #ifndef _KBDCLASS_PCH_ 2 #define _KBDCLASS_PCH_ 3 4 #include <ntifs.h> 5 #include <ntddkbd.h> 6 7 #define MAX_PATH 260 8 9 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 10 11 #define CLASS_TAG 'CdbK' 12 #define DPFLTR_CLASS_NAME_ID DPFLTR_KBDCLASS_ID 13 14 typedef enum 15 { 16 dsStopped, 17 dsStarted, 18 dsPaused, 19 dsRemoved, 20 dsSurpriseRemoved 21 } PORT_DEVICE_STATE; 22 23 typedef struct _CLASS_DRIVER_EXTENSION 24 { 25 UNICODE_STRING RegistryPath; 26 27 /* Registry settings */ 28 ULONG ConnectMultiplePorts; 29 ULONG DataQueueSize; 30 UNICODE_STRING DeviceBaseName; 31 32 PDEVICE_OBJECT MainClassDeviceObject; 33 } CLASS_DRIVER_EXTENSION, *PCLASS_DRIVER_EXTENSION; 34 35 typedef struct _COMMON_DEVICE_EXTENSION 36 { 37 BOOLEAN IsClassDO; 38 } COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION; 39 40 typedef struct _PORT_DEVICE_EXTENSION 41 { 42 COMMON_DEVICE_EXTENSION Common; 43 44 LIST_ENTRY ListEntry; 45 PDEVICE_OBJECT DeviceObject; 46 PORT_DEVICE_STATE PnpState; 47 PDEVICE_OBJECT LowerDevice; 48 PDEVICE_OBJECT ClassDO; 49 HANDLE FileHandle; 50 UNICODE_STRING InterfaceName; 51 } PORT_DEVICE_EXTENSION, *PPORT_DEVICE_EXTENSION; 52 53 typedef struct _CLASS_DEVICE_EXTENSION 54 { 55 COMMON_DEVICE_EXTENSION Common; 56 57 PCLASS_DRIVER_EXTENSION DriverExtension; 58 59 LIST_ENTRY ListHead; 60 KSPIN_LOCK ListSpinLock; 61 KSPIN_LOCK SpinLock; 62 PIRP PendingIrp; 63 SIZE_T InputCount; 64 PKEYBOARD_INPUT_DATA PortData; 65 LPCWSTR DeviceName; 66 } CLASS_DEVICE_EXTENSION, *PCLASS_DEVICE_EXTENSION; 67 68 /* misc.c */ 69 70 NTSTATUS 71 ForwardIrpAndWait( 72 IN PDEVICE_OBJECT DeviceObject, 73 IN PIRP Irp); 74 75 DRIVER_DISPATCH ForwardIrpAndForget; 76 77 NTSTATUS 78 DuplicateUnicodeString( 79 IN ULONG Flags, 80 IN PCUNICODE_STRING SourceString, 81 OUT PUNICODE_STRING DestinationString); 82 83 #endif /* _KBDCLASS_PCH_ */ 84