47 if (!DeviceExtension->MouseAbsolute)
55 DeviceExtension->PreparsedData,
56 DeviceExtension->Report,
57 DeviceExtension->ReportLength);
65 DeviceExtension->MouseAbsolute =
TRUE;
73 DeviceExtension->PreparsedData,
74 DeviceExtension->Report,
75 DeviceExtension->ReportLength);
81 ASSERT(DeviceExtension->ValueCapsX.LogicalMax > 0);
82 ASSERT(DeviceExtension->ValueCapsX.LogicalMax > DeviceExtension->ValueCapsX.LogicalMin);
97 DeviceExtension->PreparsedData,
98 DeviceExtension->Report,
99 DeviceExtension->ReportLength);
105 ASSERT(DeviceExtension->ValueCapsX.LogicalMax > 0);
106 ASSERT(DeviceExtension->ValueCapsX.LogicalMax > DeviceExtension->ValueCapsX.LogicalMin);
112 if (!DeviceExtension->MouseAbsolute)
120 DeviceExtension->PreparsedData,
121 DeviceExtension->Report,
122 DeviceExtension->ReportLength);
130 DeviceExtension->MouseAbsolute =
TRUE;
138 DeviceExtension->PreparsedData,
139 DeviceExtension->Report,
140 DeviceExtension->ReportLength);
146 ASSERT(DeviceExtension->ValueCapsY.LogicalMax > 0);
147 ASSERT(DeviceExtension->ValueCapsY.LogicalMax > DeviceExtension->ValueCapsY.LogicalMin);
162 DeviceExtension->PreparsedData,
163 DeviceExtension->Report,
164 DeviceExtension->ReportLength);
170 ASSERT(DeviceExtension->ValueCapsY.LogicalMax > 0);
171 ASSERT(DeviceExtension->ValueCapsY.LogicalMax > DeviceExtension->ValueCapsY.LogicalMin);
188 ULONG CurrentUsageListLength;
195 CurrentUsageListLength = DeviceExtension->UsageListLength;
199 DeviceExtension->CurrentUsageList,
200 &CurrentUsageListLength,
201 DeviceExtension->PreparsedData,
202 DeviceExtension->Report,
203 DeviceExtension->ReportLength);
206 DPRINT1(
"MouHid_GetButtonFlags failed to get usages with %x\n",
Status);
212 DeviceExtension->CurrentUsageList,
213 DeviceExtension->BreakUsageList,
214 DeviceExtension->MakeUsageList,
215 DeviceExtension->UsageListLength);
218 DPRINT1(
"MouHid_GetButtonFlags failed to get usages with %x\n",
Status);
222 if (DeviceExtension->UsageListLength)
228 Usage = DeviceExtension->BreakUsageList[
Index];
243 if (DeviceExtension->UsageListLength)
249 Usage = DeviceExtension->MakeUsageList[
Index];
265 TempList = DeviceExtension->CurrentUsageList;
266 DeviceExtension->CurrentUsageList = DeviceExtension->PreviousUsageList;
267 DeviceExtension->PreviousUsageList = TempList;
269 if (DeviceExtension->MouseAbsolute)
282 ULONG InputDataConsumed;
284 if (!DeviceExtension->ClassService)
288 ASSERT(DeviceExtension->ClassService);
289 ASSERT(DeviceExtension->ClassDeviceObject);
295 (*(
PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassService)(DeviceExtension->ClassDeviceObject, InputData, InputData + 1, &InputDataConsumed);
325 DPRINT1(
"[MOUHID] ReadCompletion terminating read Status %x\n",
Irp->IoStatus.Status);
350 MouseInputData.
LastX = LastX;
351 MouseInputData.
LastY = LastY;
374 DPRINT(
"[MOUHID] failed to get wheel status with %x\n",
Status);
378 DPRINT(
"[MOUHID] ReportData %02x %02x %02x %02x %02x %02x %02x\n",
379 DeviceExtension->
Report[0] & 0xFF,
380 DeviceExtension->
Report[1] & 0xFF, DeviceExtension->
Report[2] & 0xFF,
381 DeviceExtension->
Report[3] & 0xFF, DeviceExtension->
Report[4] & 0xFF,
382 DeviceExtension->
Report[5] & 0xFF, DeviceExtension->
Report[6] & 0xFF);
407 DeviceExtension->Irp->MdlAddress = DeviceExtension->ReportMDL;
417 IoStack->
FileObject = DeviceExtension->FileObject;
423 DeviceExtension->ReadReportActive =
TRUE;
455 DPRINT(
"MOUHID: IRP_MJ_CREATE\n");
504 DPRINT(
"[MOUHID] MouHid_InitiateRead: status %x\n",
Status);
584 DPRINT1(
"[MOUHID] IOCTL_MOUSE_QUERY_ATTRIBUTES Buffer too small\n");
608 DPRINT(
"[MOUHID] InputDataQueueLength %x\n",
Attributes->InputDataQueueLength);
722 ULONG InputBufferSize,
724 ULONG OutputBufferSize,
796 DPRINT1(
"[MOUHID] failed to obtain collection information with %x\n",
Status);
819 DPRINT1(
"[MOUHID] failed to obtain collection information with %x\n",
Status);
927 DPRINT(
"[MOUHID] mouse wheel support detected\n",
Status);
945 DPRINT(
"[MOUHID] mouse wheel support detected with z-axis\n",
Status);
1005 if (DeviceExtension->
Report)
1122 Irp->IoStatus.Status = 0;
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define STATUS_PRIVILEGE_NOT_HELD
PDEVICE_OBJECT PhysicalDeviceObject
#define STATUS_NOT_SUPPORTED
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
DRIVER_INITIALIZE DriverEntry
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeRaiseIrql(irql, oldIrql)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeLowerIrql(oldIrql)
#define KeSetEvent(pEvt, foo, foo2)
VOID NTAPI KeClearEvent(IN PKEVENT Event)
#define IOCTL_HID_GET_COLLECTION_DESCRIPTOR
#define IOCTL_HID_FLUSH_QUEUE
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
#define IOCTL_HID_GET_COLLECTION_INFORMATION
HIDAPI NTSTATUS NTAPI HidP_UsageListDifference(IN PUSAGE PreviousUsageList, IN PUSAGE CurrentUsageList, OUT PUSAGE BreakUsageList, OUT PUSAGE MakeUsageList, IN ULONG UsageListLength)
HIDAPI NTSTATUS NTAPI HidP_GetCaps(IN PHIDP_PREPARSED_DATA PreparsedData, OUT PHIDP_CAPS Capabilities)
HIDAPI NTSTATUS NTAPI HidP_GetSpecificValueCaps(IN HIDP_REPORT_TYPE ReportType, IN USAGE UsagePage, IN USHORT LinkCollection, IN USAGE Usage, OUT PHIDP_VALUE_CAPS ValueCaps, IN OUT PUSHORT ValueCapsLength, IN PHIDP_PREPARSED_DATA PreparsedData)
HIDAPI ULONG NTAPI HidP_MaxUsageListLength(IN HIDP_REPORT_TYPE ReportType, IN USAGE UsagePage OPTIONAL, IN PHIDP_PREPARSED_DATA PreparsedData)
#define HIDP_STATUS_SUCCESS
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG _In_ PHIDP_PREPARSED_DATA PreparsedData
#define HIDP_LINK_COLLECTION_UNSPECIFIED
_Must_inspect_result_ HIDAPI NTSTATUS NTAPI HidP_GetScaledUsageValue(_In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_ USHORT LinkCollection, _In_ USAGE Usage, _Out_ PLONG UsageValue, _In_ PHIDP_PREPARSED_DATA PreparsedData, _In_reads_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength)
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE _Out_ PHIDP_VALUE_CAPS _Inout_ PUSHORT ValueCapsLength
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE _Out_ PHIDP_VALUE_CAPS ValueCaps
_Must_inspect_result_ _In_ ULONG UsageListLength
#define HIDP_STATUS_BAD_LOG_PHY_VALUES
_Must_inspect_result_ HIDAPI NTSTATUS NTAPI HidP_GetUsages(_In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_ USHORT LinkCollection, _Out_writes_to_(*UsageLength, *UsageLength) USAGE *UsageList, _Inout_ ULONG *UsageLength, _In_ PHIDP_PREPARSED_DATA PreparsedData, _Out_writes_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength)
_Must_inspect_result_ HIDAPI NTSTATUS NTAPI HidP_GetUsageValue(_In_ HIDP_REPORT_TYPE ReportType, _In_ USAGE UsagePage, _In_ USHORT LinkCollection, _In_ USAGE Usage, _Out_ PULONG UsageValue, _In_ PHIDP_PREPARSED_DATA PreparsedData, _In_reads_bytes_(ReportLength) PCHAR Report, _In_ ULONG ReportLength)
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
#define HID_USAGE_GENERIC_MOUSE
#define HID_USAGE_PAGE_BUTTON
#define HID_USAGE_GENERIC_X
#define HID_USAGE_GENERIC_POINTER
#define HID_USAGE_GENERIC_Z
#define HID_USAGE_GENERIC_WHEEL
#define HID_USAGE_PAGE_GENERIC
#define HID_USAGE_GENERIC_Y
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
VOID(STDAPICALLTYPE * PSERVICE_CALLBACK_ROUTINE)(IN PVOID NormalContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2, IN OUT PVOID SystemArgument3)
#define IOCTL_INTERNAL_MOUSE_DISABLE
#define IOCTL_INTERNAL_MOUSE_ENABLE
#define IOCTL_INTERNAL_MOUSE_DISCONNECT
#define IOCTL_INTERNAL_MOUSE_CONNECT
VOID NTAPI MmBuildMdlForNonPagedPool(IN PMDL Mdl)
#define ExFreePoolWithTag(_P, _T)
NTSTATUS NTAPI MouHid_SystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI MouHid_Pnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI MouHid_CreateCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
NTSTATUS NTAPI MouHid_Power(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI MouHid_DeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
VOID NTAPI MouHid_Unload(IN PDRIVER_OBJECT DriverObject)
NTSTATUS NTAPI MouHid_Flush(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
VOID MouHid_DispatchInputData(IN PMOUHID_DEVICE_EXTENSION DeviceExtension, IN PMOUSE_INPUT_DATA InputData)
NTSTATUS NTAPI MouHid_FreeResources(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI MouHid_Close(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS MouHid_SubmitRequest(PDEVICE_OBJECT DeviceObject, ULONG IoControlCode, ULONG InputBufferSize, PVOID InputBuffer, ULONG OutputBufferSize, PVOID OutputBuffer)
NTSTATUS MouHid_InitiateRead(IN PMOUHID_DEVICE_EXTENSION DeviceExtension)
NTSTATUS NTAPI MouHid_AddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
NTSTATUS NTAPI MouHid_StartDeviceCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
NTSTATUS NTAPI MouHid_InternalDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI MouHid_StartDevice(IN PDEVICE_OBJECT DeviceObject)
VOID MouHid_GetButtonFlags(IN PMOUHID_DEVICE_EXTENSION DeviceExtension, OUT PUSHORT ButtonFlags, OUT PUSHORT Flags)
static USHORT MouHid_ButtonUpFlags[]
NTSTATUS NTAPI MouHid_Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS NTAPI MouHid_ReadCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
VOID MouHid_GetButtonMove(IN PMOUHID_DEVICE_EXTENSION DeviceExtension, OUT PLONG LastX, OUT PLONG LastY)
static USHORT MouHid_ButtonDownFlags[]
#define VIRTUAL_SCREEN_SIZE_Y
#define VIRTUAL_SCREEN_SIZE_X
static const TBBUTTON Buttons[]
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT * NextDeviceObject
struct _MOUSE_ATTRIBUTES MOUSE_ATTRIBUTES
#define MOUSE_LEFT_BUTTON_DOWN
#define MOUSE_LEFT_BUTTON_UP
#define MOUSE_MIDDLE_BUTTON_DOWN
#define MOUSE_BUTTON_4_DOWN
#define MOUSE_BUTTON_5_UP
#define MOUSE_HID_HARDWARE
#define MOUSE_MOVE_ABSOLUTE
#define IOCTL_MOUSE_QUERY_ATTRIBUTES
#define MOUSE_BUTTON_5_DOWN
#define MOUSE_BUTTON_4_UP
#define MOUSE_RIGHT_BUTTON_UP
#define MOUSE_MIDDLE_BUTTON_UP
#define WHEELMOUSE_HID_HARDWARE
#define MOUSE_RIGHT_BUTTON_DOWN
#define IRP_MN_SURPRISE_REMOVAL
#define IoSkipCurrentIrpStackLocation(Irp)
#define IoCopyCurrentIrpStackLocationToNext(Irp)
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
#define IoCompleteRequest
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
VOID NTAPI IoReuseIrp(IN OUT PIRP Irp, IN NTSTATUS Status)
BOOLEAN NTAPI IoCancelIrp(IN PIRP Irp)
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
VOID NTAPI IoFreeIrp(IN PIRP Irp)
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
#define FILE_DEVICE_MOUSE
#define IRP_MJ_DEVICE_CONTROL
#define STATUS_MORE_PROCESSING_REQUIRED
#define STATUS_BUFFER_TOO_SMALL
HIDP_VALUE_CAPS ValueCapsY
PDEVICE_OBJECT ClassDeviceObject
PDEVICE_OBJECT NextDeviceObject
HIDP_VALUE_CAPS ValueCapsX
KEVENT ReadCompletionEvent
USHORT InputReportByteLength
struct _IO_STACK_LOCATION::@1580::@1581 DeviceIoControl
struct _IO_STACK_LOCATION::@3979::@3983 Read
union _IO_STACK_LOCATION::@1580 Parameters
struct _IO_STACK_LOCATION::@3979::@3980 Create
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_DEVICE_NOT_CONNECTED
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_SHARING_VIOLATION
#define STATUS_INSUFFICIENT_RESOURCES
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
_Must_inspect_result_ _In_ ULONG Flags
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
#define IRP_MN_CANCEL_STOP_DEVICE
#define IRP_MN_START_DEVICE
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MJ_SYSTEM_CONTROL
#define IRP_MJ_FLUSH_BUFFERS
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
#define IRP_MN_STOP_DEVICE
#define IRP_MN_QUERY_REMOVE_DEVICE
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql