ReactOS 0.4.15-dev-7711-g5627da4
mouhid.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS HID Stack
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/hid/mouhid/mouhid.c
5 * PURPOSE: Mouse HID Driver
6 * PROGRAMMERS:
7 * Michael Martin (michael.martin@reactos.org)
8 * Johannes Anderwald (johannes.anderwald@reactos.org)
9 */
10
11#include "mouhid.h"
12
14{
15 0xFF, /* unused */
21};
22
24{
25 0xFF, /* unused */
31};
32
33
34VOID
36 IN PMOUHID_DEVICE_EXTENSION DeviceExtension,
37 OUT PLONG LastX,
38 OUT PLONG LastY)
39{
41 ULONG ValueX, ValueY;
42
43 /* init result */
44 *LastX = 0;
45 *LastY = 0;
46
47 if (!DeviceExtension->MouseAbsolute)
48 {
49 /* get scaled usage value x */
54 LastX,
55 DeviceExtension->PreparsedData,
56 DeviceExtension->Report,
57 DeviceExtension->ReportLength);
58
60 {
61 /* FIXME: handle more errors */
63 {
64 /* FIXME: assume it operates in absolute mode */
65 DeviceExtension->MouseAbsolute = TRUE;
66
67 /* get unscaled value */
72 &ValueX,
73 DeviceExtension->PreparsedData,
74 DeviceExtension->Report,
75 DeviceExtension->ReportLength);
76
77 /* FIXME handle error */
79
80 /* absolute pointing devices values need be in range 0 - 0xffff */
81 ASSERT(DeviceExtension->ValueCapsX.LogicalMax > 0);
82 ASSERT(DeviceExtension->ValueCapsX.LogicalMax > DeviceExtension->ValueCapsX.LogicalMin);
83
84 /* convert to logical range */
85 *LastX = (ValueX * VIRTUAL_SCREEN_SIZE_X) / DeviceExtension->ValueCapsX.LogicalMax;
86 }
87 }
88 }
89 else
90 {
91 /* get unscaled value */
96 &ValueX,
97 DeviceExtension->PreparsedData,
98 DeviceExtension->Report,
99 DeviceExtension->ReportLength);
100
101 /* FIXME handle error */
103
104 /* absolute pointing devices values need be in range 0 - 0xffff */
105 ASSERT(DeviceExtension->ValueCapsX.LogicalMax > 0);
106 ASSERT(DeviceExtension->ValueCapsX.LogicalMax > DeviceExtension->ValueCapsX.LogicalMin);
107
108 /* convert to logical range */
109 *LastX = (ValueX * VIRTUAL_SCREEN_SIZE_X) / DeviceExtension->ValueCapsX.LogicalMax;
110 }
111
112 if (!DeviceExtension->MouseAbsolute)
113 {
114 /* get scaled usage value y */
119 LastY,
120 DeviceExtension->PreparsedData,
121 DeviceExtension->Report,
122 DeviceExtension->ReportLength);
123
125 {
126 // FIXME: handle more errors
128 {
129 // assume it operates in absolute mode
130 DeviceExtension->MouseAbsolute = TRUE;
131
132 // get unscaled value
137 &ValueY,
138 DeviceExtension->PreparsedData,
139 DeviceExtension->Report,
140 DeviceExtension->ReportLength);
141
142 /* FIXME handle error */
144
145 /* absolute pointing devices values need be in range 0 - 0xffff */
146 ASSERT(DeviceExtension->ValueCapsY.LogicalMax > 0);
147 ASSERT(DeviceExtension->ValueCapsY.LogicalMax > DeviceExtension->ValueCapsY.LogicalMin);
148
149 /* convert to logical range */
150 *LastY = (ValueY * VIRTUAL_SCREEN_SIZE_Y) / DeviceExtension->ValueCapsY.LogicalMax;
151 }
152 }
153 }
154 else
155 {
156 // get unscaled value
161 &ValueY,
162 DeviceExtension->PreparsedData,
163 DeviceExtension->Report,
164 DeviceExtension->ReportLength);
165
166 /* FIXME handle error */
168
169 /* absolute pointing devices values need be in range 0 - 0xffff */
170 ASSERT(DeviceExtension->ValueCapsY.LogicalMax > 0);
171 ASSERT(DeviceExtension->ValueCapsY.LogicalMax > DeviceExtension->ValueCapsY.LogicalMin);
172
173 /* convert to logical range */
174 *LastY = (ValueY * VIRTUAL_SCREEN_SIZE_Y) / DeviceExtension->ValueCapsY.LogicalMax;
175 }
176}
177
178VOID
180 IN PMOUHID_DEVICE_EXTENSION DeviceExtension,
181 OUT PUSHORT ButtonFlags,
183{
185 USAGE Usage;
186 ULONG Index;
187 PUSAGE TempList;
188 ULONG CurrentUsageListLength;
189
190 /* init flags */
191 *ButtonFlags = 0;
192 *Flags = 0;
193
194 /* get usages */
195 CurrentUsageListLength = DeviceExtension->UsageListLength;
199 DeviceExtension->CurrentUsageList,
200 &CurrentUsageListLength,
201 DeviceExtension->PreparsedData,
202 DeviceExtension->Report,
203 DeviceExtension->ReportLength);
205 {
206 DPRINT1("MouHid_GetButtonFlags failed to get usages with %x\n", Status);
207 return;
208 }
209
210 /* extract usage list difference */
211 Status = HidP_UsageListDifference(DeviceExtension->PreviousUsageList,
212 DeviceExtension->CurrentUsageList,
213 DeviceExtension->BreakUsageList,
214 DeviceExtension->MakeUsageList,
215 DeviceExtension->UsageListLength);
217 {
218 DPRINT1("MouHid_GetButtonFlags failed to get usages with %x\n", Status);
219 return;
220 }
221
222 if (DeviceExtension->UsageListLength)
223 {
224 Index = 0;
225 do
226 {
227 /* get usage */
228 Usage = DeviceExtension->BreakUsageList[Index];
229 if (!Usage)
230 break;
231
232 if (Usage <= 5)
233 {
234 /* max 5 buttons supported */
235 *ButtonFlags |= MouHid_ButtonDownFlags[Usage];
236 }
237
238 /* move to next index*/
239 Index++;
240 }while(Index < DeviceExtension->UsageListLength);
241 }
242
243 if (DeviceExtension->UsageListLength)
244 {
245 Index = 0;
246 do
247 {
248 /* get usage */
249 Usage = DeviceExtension->MakeUsageList[Index];
250 if (!Usage)
251 break;
252
253 if (Usage <= 5)
254 {
255 /* max 5 buttons supported */
256 *ButtonFlags |= MouHid_ButtonUpFlags[Usage];
257 }
258
259 /* move to next index*/
260 Index++;
261 }while(Index < DeviceExtension->UsageListLength);
262 }
263
264 /* now switch the previous list with current list */
265 TempList = DeviceExtension->CurrentUsageList;
266 DeviceExtension->CurrentUsageList = DeviceExtension->PreviousUsageList;
267 DeviceExtension->PreviousUsageList = TempList;
268
269 if (DeviceExtension->MouseAbsolute)
270 {
271 // mouse operates absolute
273 }
274}
275
276VOID
278 IN PMOUHID_DEVICE_EXTENSION DeviceExtension,
279 IN PMOUSE_INPUT_DATA InputData)
280{
282 ULONG InputDataConsumed;
283
284 if (!DeviceExtension->ClassService)
285 return;
286
287 /* sanity check */
288 ASSERT(DeviceExtension->ClassService);
289 ASSERT(DeviceExtension->ClassDeviceObject);
290
291 /* raise irql */
293
294 /* dispatch input data */
295 (*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassService)(DeviceExtension->ClassDeviceObject, InputData, InputData + 1, &InputDataConsumed);
296
297 /* lower irql to previous level */
299}
300
302NTAPI
305 IN PIRP Irp,
307{
308 PMOUHID_DEVICE_EXTENSION DeviceExtension;
309 USHORT ButtonFlags;
310 LONG UsageValue;
312 LONG LastX, LastY;
313 MOUSE_INPUT_DATA MouseInputData;
315
316 /* get device extension */
317 DeviceExtension = Context;
318
319 if (Irp->IoStatus.Status == STATUS_PRIVILEGE_NOT_HELD ||
320 Irp->IoStatus.Status == STATUS_DEVICE_NOT_CONNECTED ||
321 Irp->IoStatus.Status == STATUS_CANCELLED ||
322 DeviceExtension->StopReadReport)
323 {
324 /* failed to read or should be stopped*/
325 DPRINT1("[MOUHID] ReadCompletion terminating read Status %x\n", Irp->IoStatus.Status);
326
327 /* report no longer active */
328 DeviceExtension->ReadReportActive = FALSE;
329
330 /* request stopping of the report cycle */
331 DeviceExtension->StopReadReport = FALSE;
332
333 /* signal completion event */
334 KeSetEvent(&DeviceExtension->ReadCompletionEvent, 0, 0);
336 }
337
338 /* get mouse change */
339 MouHid_GetButtonMove(DeviceExtension, &LastX, &LastY);
340
341 /* get mouse change flags */
342 MouHid_GetButtonFlags(DeviceExtension, &ButtonFlags, &Flags);
343
344 /* init input data */
345 RtlZeroMemory(&MouseInputData, sizeof(MOUSE_INPUT_DATA));
346
347 /* init input data */
348 MouseInputData.ButtonFlags = ButtonFlags;
349 MouseInputData.Flags = Flags;
350 MouseInputData.LastX = LastX;
351 MouseInputData.LastY = LastY;
352
353 /* detect mouse wheel change */
354 if (DeviceExtension->MouseIdentifier == WHEELMOUSE_HID_HARDWARE)
355 {
356 /* get usage */
357 UsageValue = 0;
362 &UsageValue,
363 DeviceExtension->PreparsedData,
364 DeviceExtension->Report,
365 DeviceExtension->ReportLength);
366 if (Status == HIDP_STATUS_SUCCESS && UsageValue != 0)
367 {
368 /* store wheel status */
369 MouseInputData.ButtonFlags |= MOUSE_WHEEL;
370 MouseInputData.ButtonData = (USHORT)(UsageValue * WHEEL_DELTA);
371 }
372 else
373 {
374 DPRINT("[MOUHID] failed to get wheel status with %x\n", Status);
375 }
376 }
377
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);
383
384 DPRINT("[MOUHID] LastX %ld LastY %ld Flags %x ButtonFlags %x ButtonData %x\n", MouseInputData.LastX, MouseInputData.LastY, MouseInputData.Flags, MouseInputData.ButtonFlags, MouseInputData.ButtonData);
385
386 /* dispatch mouse action */
387 MouHid_DispatchInputData(DeviceExtension, &MouseInputData);
388
389 /* re-init read */
390 MouHid_InitiateRead(DeviceExtension);
391
392 /* stop completion */
394}
395
398 IN PMOUHID_DEVICE_EXTENSION DeviceExtension)
399{
400 PIO_STACK_LOCATION IoStack;
402
403 /* re-use irp */
404 IoReuseIrp(DeviceExtension->Irp, STATUS_SUCCESS);
405
406 /* init irp */
407 DeviceExtension->Irp->MdlAddress = DeviceExtension->ReportMDL;
408
409 /* get next stack location */
410 IoStack = IoGetNextIrpStackLocation(DeviceExtension->Irp);
411
412 /* init stack location */
413 IoStack->Parameters.Read.Length = DeviceExtension->ReportLength;
414 IoStack->Parameters.Read.Key = 0;
415 IoStack->Parameters.Read.ByteOffset.QuadPart = 0LL;
416 IoStack->MajorFunction = IRP_MJ_READ;
417 IoStack->FileObject = DeviceExtension->FileObject;
418
419 /* set completion routine */
420 IoSetCompletionRoutine(DeviceExtension->Irp, MouHid_ReadCompletion, DeviceExtension, TRUE, TRUE, TRUE);
421
422 /* read is active */
423 DeviceExtension->ReadReportActive = TRUE;
424
425 /* start the read */
426 Status = IoCallDriver(DeviceExtension->NextDeviceObject, DeviceExtension->Irp);
427
428 /* done */
429 return Status;
430}
431
433NTAPI
436 IN PIRP Irp,
438{
441}
442
443
445NTAPI
448 IN PIRP Irp)
449{
450 PIO_STACK_LOCATION IoStack;
453 PMOUHID_DEVICE_EXTENSION DeviceExtension;
454
455 DPRINT("MOUHID: IRP_MJ_CREATE\n");
456
457 /* get device extension */
458 DeviceExtension = DeviceObject->DeviceExtension;
459
460 /* get stack location */
462
463 /* copy stack location to next */
465
466 /* init event */
468
469 /* prepare irp */
471
472 /* call lower driver */
473 Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
474 if (Status == STATUS_PENDING)
475 {
476 /* request pending */
478 }
479
480 /* check for success */
481 if (!NT_SUCCESS(Status))
482 {
483 /* failed */
484 Irp->IoStatus.Status = Status;
486 return Status;
487 }
488
489 /* is the driver already in use */
490 if (DeviceExtension->FileObject == NULL)
491 {
492 /* did the caller specify correct attributes */
493 ASSERT(IoStack->Parameters.Create.SecurityContext);
494 if (IoStack->Parameters.Create.SecurityContext->DesiredAccess)
495 {
496 /* store file object */
497 DeviceExtension->FileObject = IoStack->FileObject;
498
499 /* reset event */
500 KeClearEvent(&DeviceExtension->ReadCompletionEvent);
501
502 /* initiating read */
503 Status = MouHid_InitiateRead(DeviceExtension);
504 DPRINT("[MOUHID] MouHid_InitiateRead: status %x\n", Status);
505 if (Status == STATUS_PENDING)
506 {
507 /* report irp is pending */
509 }
510 }
511 }
512
513 /* complete request */
514 Irp->IoStatus.Status = Status;
516 return Status;
517}
518
519
521NTAPI
524 IN PIRP Irp)
525{
526 PMOUHID_DEVICE_EXTENSION DeviceExtension;
527
528 /* get device extension */
529 DeviceExtension = DeviceObject->DeviceExtension;
530
531 DPRINT("[MOUHID] IRP_MJ_CLOSE ReadReportActive %x\n", DeviceExtension->ReadReportActive);
532
533 if (DeviceExtension->ReadReportActive)
534 {
535 /* request stopping of the report cycle */
536 DeviceExtension->StopReadReport = TRUE;
537
538 /* wait until the reports have been read */
540
541 /* cancel irp */
542 IoCancelIrp(DeviceExtension->Irp);
543 }
544
545 DPRINT("[MOUHID] IRP_MJ_CLOSE ReadReportActive %x\n", DeviceExtension->ReadReportActive);
546
547 /* remove file object */
548 DeviceExtension->FileObject = NULL;
549
550 /* skip location */
552
553 /* pass irp to down the stack */
554 return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
555}
556
558NTAPI
561 IN PIRP Irp)
562{
563 PIO_STACK_LOCATION IoStack;
565 PMOUHID_DEVICE_EXTENSION DeviceExtension;
567
568 /* get current stack location */
570
571 DPRINT("[MOUHID] InternalDeviceControl %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
572
573 /* get device extension */
574 DeviceExtension = DeviceObject->DeviceExtension;
575
576 /* handle requests */
577 switch (IoStack->Parameters.DeviceIoControl.IoControlCode)
578 {
580 /* verify output buffer length */
581 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(MOUSE_ATTRIBUTES))
582 {
583 /* invalid request */
584 DPRINT1("[MOUHID] IOCTL_MOUSE_QUERY_ATTRIBUTES Buffer too small\n");
585 Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
588 }
589
590 /* get output buffer */
591 Attributes = Irp->AssociatedIrp.SystemBuffer;
592
593 /* type of mouse */
594 Attributes->MouseIdentifier = DeviceExtension->MouseIdentifier;
595
596 /* number of buttons */
597 Attributes->NumberOfButtons = DeviceExtension->UsageListLength;
598
599 /* sample rate not used for usb */
600 Attributes->SampleRate = 0;
601
602 /* queue length */
603 Attributes->InputDataQueueLength = 2;
604
605 DPRINT("[MOUHID] MouseIdentifier %x\n", Attributes->MouseIdentifier);
606 DPRINT("[MOUHID] NumberOfButtons %x\n", Attributes->NumberOfButtons);
607 DPRINT("[MOUHID] SampleRate %x\n", Attributes->SampleRate);
608 DPRINT("[MOUHID] InputDataQueueLength %x\n", Attributes->InputDataQueueLength);
609
610 /* complete request */
611 Irp->IoStatus.Information = sizeof(MOUSE_ATTRIBUTES);
612 Irp->IoStatus.Status = STATUS_SUCCESS;
614 return STATUS_SUCCESS;
615
617 /* verify input buffer length */
618 if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA))
619 {
620 /* invalid request */
621 Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
624 }
625
626 /* is it already connected */
627 if (DeviceExtension->ClassService)
628 {
629 /* already connected */
630 Irp->IoStatus.Status = STATUS_SHARING_VIOLATION;
633 }
634
635 /* get connect data */
636 Data = IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
637
638 /* store connect details */
639 DeviceExtension->ClassDeviceObject = Data->ClassDeviceObject;
640 DeviceExtension->ClassService = Data->ClassService;
641
642 /* completed successfully */
643 Irp->IoStatus.Status = STATUS_SUCCESS;
645 return STATUS_SUCCESS;
646
648 /* not supported */
649 Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
652
654 /* not supported */
655 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
658
660 /* not supported */
661 Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
664 }
665
666 DPRINT1("[MOUHID] Unknown DeviceControl %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
667 /* unknown request not supported */
668 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
671}
672
674NTAPI
677 IN PIRP Irp)
678{
679 PMOUHID_DEVICE_EXTENSION DeviceExtension;
680
681 /* get device extension */
682 DeviceExtension = DeviceObject->DeviceExtension;
683
684 /* skip stack location */
686
687 /* pass and forget */
688 return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
689}
690
692NTAPI
695 IN PIRP Irp)
696{
697 PMOUHID_DEVICE_EXTENSION DeviceExtension;
698
699 DeviceExtension = DeviceObject->DeviceExtension;
702 return PoCallDriver(DeviceExtension->NextDeviceObject, Irp);
703}
704
706NTAPI
709 IN PIRP Irp)
710{
711 PMOUHID_DEVICE_EXTENSION DeviceExtension;
712
713 DeviceExtension = DeviceObject->DeviceExtension;
715 return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
716}
717
722 ULONG InputBufferSize,
724 ULONG OutputBufferSize,
726{
728 PMOUHID_DEVICE_EXTENSION DeviceExtension;
729 PIRP Irp;
732
733 /* get device extension */
734 DeviceExtension = DeviceObject->DeviceExtension;
735
736 /* init event */
738
739 /* build request */
741 DeviceExtension->NextDeviceObject,
743 InputBufferSize,
745 OutputBufferSize,
746 FALSE,
747 &Event,
748 &IoStatus);
749 if (!Irp)
750 {
751 /* no memory */
753 }
754
755 /* send request */
756 Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
757 if (Status == STATUS_PENDING)
758 {
759 /* wait for request to complete */
761 Status = IoStatus.Status;
762 }
763
764 /* done */
765 return Status;
766}
767
769NTAPI
772{
780 PMOUHID_DEVICE_EXTENSION DeviceExtension;
782
783 /* get device extension */
784 DeviceExtension = DeviceObject->DeviceExtension;
785
786 /* query collection information */
789 0,
790 NULL,
792 &Information);
793 if (!NT_SUCCESS(Status))
794 {
795 /* failed to query collection information */
796 DPRINT1("[MOUHID] failed to obtain collection information with %x\n", Status);
797 return Status;
798 }
799
800 /* lets allocate space for preparsed data */
802 if (!PreparsedData)
803 {
804 /* no memory */
805 DPRINT1("[MOUHID] no memory size %u\n", Information.DescriptorSize);
807 }
808
809 /* now obtain the preparsed data */
812 0,
813 NULL,
814 Information.DescriptorSize,
816 if (!NT_SUCCESS(Status))
817 {
818 /* failed to get preparsed data */
819 DPRINT1("[MOUHID] failed to obtain collection information with %x\n", Status);
821 return Status;
822 }
823
824 /* lets get the caps */
827 {
828 /* failed to get capabilities */
829 DPRINT1("[MOUHID] failed to obtain caps with %x\n", Status);
831 return Status;
832 }
833
834 DPRINT("[MOUHID] Usage %x UsagePage %x InputReportLength %lu\n", Capabilities.Usage, Capabilities.UsagePage, Capabilities.InputReportByteLength);
835
836 /* verify capabilities */
838 {
839 /* not supported */
841 return STATUS_UNSUCCESSFUL;
842 }
843
844 /* init input report */
846 ASSERT(DeviceExtension->ReportLength);
847 DeviceExtension->Report = ExAllocatePoolWithTag(NonPagedPool, DeviceExtension->ReportLength, MOUHID_TAG);
848 ASSERT(DeviceExtension->Report);
849 RtlZeroMemory(DeviceExtension->Report, DeviceExtension->ReportLength);
850
851 /* build mdl */
852 DeviceExtension->ReportMDL = IoAllocateMdl(DeviceExtension->Report,
853 DeviceExtension->ReportLength,
854 FALSE,
855 FALSE,
856 NULL);
857 ASSERT(DeviceExtension->ReportMDL);
858
859 /* init mdl */
860 MmBuildMdlForNonPagedPool(DeviceExtension->ReportMDL);
861
862 /* get max number of buttons */
866 DPRINT("[MOUHID] Buttons %lu\n", Buttons);
867 ASSERT(Buttons > 0);
868
869 /* now allocate an array for those buttons */
871 if (!Buffer)
872 {
873 /* no memory */
876 }
877 DeviceExtension->UsageListBuffer = Buffer;
878
879 /* init usage lists */
880 RtlZeroMemory(Buffer, sizeof(USAGE) * 4 * Buttons);
881 DeviceExtension->CurrentUsageList = Buffer;
882 Buffer += Buttons;
883 DeviceExtension->PreviousUsageList = Buffer;
884 Buffer += Buttons;
885 DeviceExtension->MakeUsageList = Buffer;
886 Buffer += Buttons;
887 DeviceExtension->BreakUsageList = Buffer;
888
889 /* store number of buttons */
890 DeviceExtension->UsageListLength = (USHORT)Buttons;
891
892 /* store preparsed data */
893 DeviceExtension->PreparsedData = PreparsedData;
894
895 ValueCapsLength = 1;
900 &DeviceExtension->ValueCapsX,
903
904 ValueCapsLength = 1;
909 &DeviceExtension->ValueCapsY,
912
913 /* now check for wheel mouse support */
914 ValueCapsLength = 1;
919 &ValueCaps,
923 {
924 /* mouse has wheel support */
925 DeviceExtension->MouseIdentifier = WHEELMOUSE_HID_HARDWARE;
926 DeviceExtension->WheelUsagePage = ValueCaps.UsagePage;
927 DPRINT("[MOUHID] mouse wheel support detected\n", Status);
928 }
929 else
930 {
931 /* check if the mouse has z-axis */
932 ValueCapsLength = 1;
937 &ValueCaps,
941 {
942 /* wheel support */
943 DeviceExtension->MouseIdentifier = WHEELMOUSE_HID_HARDWARE;
944 DeviceExtension->WheelUsagePage = ValueCaps.UsagePage;
945 DPRINT("[MOUHID] mouse wheel support detected with z-axis\n", Status);
946 }
947 }
948
949 /* check if mice is absolute */
950 if (DeviceExtension->ValueCapsY.IsAbsolute &&
951 DeviceExtension->ValueCapsX.IsAbsolute)
952 {
953 /* mice is absolute */
954 DeviceExtension->MouseAbsolute = TRUE;
955 }
956
957 /* completed successfully */
958 return STATUS_SUCCESS;
959}
960
962NTAPI
965 IN PIRP Irp,
967{
970}
971
973NTAPI
976{
977 PMOUHID_DEVICE_EXTENSION DeviceExtension;
978
979 /* get device extension */
980 DeviceExtension = DeviceObject->DeviceExtension;
981
982 /* free resources */
983 if (DeviceExtension->PreparsedData)
984 {
985 ExFreePoolWithTag(DeviceExtension->PreparsedData, MOUHID_TAG);
986 DeviceExtension->PreparsedData = NULL;
987 }
988
989 if (DeviceExtension->UsageListBuffer)
990 {
992 DeviceExtension->UsageListBuffer = NULL;
993 DeviceExtension->CurrentUsageList = NULL;
994 DeviceExtension->PreviousUsageList = NULL;
995 DeviceExtension->MakeUsageList = NULL;
996 DeviceExtension->BreakUsageList = NULL;
997 }
998
999 if (DeviceExtension->ReportMDL)
1000 {
1001 IoFreeMdl(DeviceExtension->ReportMDL);
1002 DeviceExtension->ReportMDL = NULL;
1003 }
1004
1005 if (DeviceExtension->Report)
1006 {
1007 ExFreePoolWithTag(DeviceExtension->Report, MOUHID_TAG);
1008 DeviceExtension->Report = NULL;
1009 }
1010
1011 return STATUS_SUCCESS;
1012}
1013
1015NTAPI
1018 IN PIRP Irp)
1019{
1020 PIO_STACK_LOCATION IoStack;
1021 PMOUHID_DEVICE_EXTENSION DeviceExtension;
1022
1023 /* get device extension */
1024 DeviceExtension = DeviceObject->DeviceExtension;
1025
1026 /* skip current stack location */
1028
1029 /* get next stack location */
1030 IoStack = IoGetNextIrpStackLocation(Irp);
1031
1032 /* change request to hid flush queue request */
1034 IoStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_HID_FLUSH_QUEUE;
1035
1036 /* call device */
1037 return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
1038}
1039
1041NTAPI
1044 IN PIRP Irp)
1045{
1046 PIO_STACK_LOCATION IoStack;
1047 KEVENT Event;
1049 PMOUHID_DEVICE_EXTENSION DeviceExtension;
1050
1051 /* get device extension */
1052 DeviceExtension = DeviceObject->DeviceExtension;
1053
1054 /* get current irp stack */
1056 DPRINT("[MOUHID] IRP_MJ_PNP Request: %x\n", IoStack->MinorFunction);
1057
1058 switch (IoStack->MinorFunction)
1059 {
1060 case IRP_MN_STOP_DEVICE:
1062 /* free resources */
1068 /* indicate success */
1069 Irp->IoStatus.Status = STATUS_SUCCESS;
1070
1071 /* skip irp stack location */
1073
1074 /* dispatch to lower device */
1075 return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
1076
1078 /* FIXME synchronization */
1079
1080 /* request stop */
1081 DeviceExtension->StopReadReport = TRUE;
1082
1083 /* cancel irp */
1084 IoCancelIrp(DeviceExtension->Irp);
1085
1086 /* free resources */
1088
1089 /* indicate success */
1090 Irp->IoStatus.Status = STATUS_SUCCESS;
1091
1092 /* skip irp stack location */
1094
1095 /* dispatch to lower device */
1096 Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
1097
1098 /* wait for completion of stop event */
1100
1101 /* free irp */
1102 IoFreeIrp(DeviceExtension->Irp);
1103
1104 /* detach device */
1105 IoDetachDevice(DeviceExtension->NextDeviceObject);
1106
1107 /* delete device */
1109
1110 /* done */
1111 return Status;
1112
1114 /* init event */
1116
1117 /* copy stack location */
1119
1120 /* set completion routine */
1122 Irp->IoStatus.Status = 0;
1123
1124 /* pass request */
1125 Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
1126 if (Status == STATUS_PENDING)
1127 {
1129 Status = Irp->IoStatus.Status;
1130 }
1131
1132 if (!NT_SUCCESS(Status))
1133 {
1134 /* failed */
1135 Irp->IoStatus.Status = Status;
1137 return Status;
1138 }
1139
1140 /* lets start the device */
1142 DPRINT("MouHid_StartDevice %x\n", Status);
1143
1144 /* complete request */
1145 Irp->IoStatus.Status = Status;
1147
1148 /* done */
1149 return Status;
1150
1151 default:
1152 /* skip irp stack location */
1154
1155 /* dispatch to lower device */
1156 return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
1157 }
1158}
1159
1161NTAPI
1165{
1168 PMOUHID_DEVICE_EXTENSION DeviceExtension;
1170
1171 /* create device object */
1174 NULL,
1176 0,
1177 FALSE,
1178 &DeviceObject);
1179 if (!NT_SUCCESS(Status))
1180 {
1181 /* failed to create device object */
1182 return Status;
1183 }
1184
1185 /* now attach it */
1187 if (!NextDeviceObject)
1188 {
1189 /* failed to attach */
1192 }
1193
1194 /* get device extension */
1195 DeviceExtension = DeviceObject->DeviceExtension;
1196
1197 /* zero extension */
1198 RtlZeroMemory(DeviceExtension, sizeof(MOUHID_DEVICE_EXTENSION));
1199
1200 /* init device extension */
1201 DeviceExtension->MouseIdentifier = MOUSE_HID_HARDWARE;
1202 DeviceExtension->WheelUsagePage = 0;
1203 DeviceExtension->NextDeviceObject = NextDeviceObject;
1205 DeviceExtension->Irp = IoAllocateIrp(NextDeviceObject->StackSize, FALSE);
1206
1207 /* FIXME handle allocation error */
1208 ASSERT(DeviceExtension->Irp);
1209
1210 /* FIXME query parameter 'FlipFlopWheel', 'WheelScalingFactor' */
1211
1212 /* set power state to D0 */
1213 State.DeviceState = PowerDeviceD0;
1215
1216 /* init device object */
1218 DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
1219
1220 /* completed successfully */
1221 return STATUS_SUCCESS;
1222}
1223
1224VOID
1225NTAPI
1228{
1230}
1231
1232
1234NTAPI
1237 IN PUNICODE_STRING RegPath)
1238{
1239 /* FIXME check for parameters 'UseOnlyMice', 'TreatAbsoluteAsRelative', 'TreatAbsolutePointerAsAbsolute' */
1240
1241 /* initialize driver object */
1242 DriverObject->MajorFunction[IRP_MJ_CREATE] = MouHid_Create;
1243 DriverObject->MajorFunction[IRP_MJ_CLOSE] = MouHid_Close;
1247 DriverObject->MajorFunction[IRP_MJ_POWER] = MouHid_Power;
1248 DriverObject->MajorFunction[IRP_MJ_PNP] = MouHid_Pnp;
1250 DriverObject->DriverUnload = MouHid_Unload;
1251 DriverObject->DriverExtension->AddDevice = MouHid_AddDevice;
1252
1253 /* done */
1254 return STATUS_SUCCESS;
1255}
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:115
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
Definition: bufpool.h:45
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define NonPagedPool
Definition: env_spec_w32.h:307
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
#define IoFreeMdl
Definition: fxmdl.h:89
#define IoAllocateMdl
Definition: fxmdl.h:88
Status
Definition: gdiplustypes.h:25
#define IOCTL_HID_GET_COLLECTION_DESCRIPTOR
Definition: hidclass.h:58
#define IOCTL_HID_FLUSH_QUEUE
Definition: hidclass.h:57
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
#define IOCTL_HID_GET_COLLECTION_INFORMATION
Definition: hidclass.h:59
HIDAPI NTSTATUS NTAPI HidP_UsageListDifference(IN PUSAGE PreviousUsageList, IN PUSAGE CurrentUsageList, OUT PUSAGE BreakUsageList, OUT PUSAGE MakeUsageList, IN ULONG UsageListLength)
Definition: hidp.c:148
HIDAPI NTSTATUS NTAPI HidP_GetCaps(IN PHIDP_PREPARSED_DATA PreparsedData, OUT PHIDP_CAPS Capabilities)
Definition: hidp.c:26
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)
Definition: hidp.c:98
HIDAPI ULONG NTAPI HidP_MaxUsageListLength(IN HIDP_REPORT_TYPE ReportType, IN USAGE UsagePage OPTIONAL, IN PHIDP_PREPARSED_DATA PreparsedData)
Definition: hidp.c:79
#define HIDP_STATUS_SUCCESS
Definition: hidpi.h:248
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG _In_ PHIDP_PREPARSED_DATA PreparsedData
Definition: hidpi.h:335
#define HIDP_LINK_COLLECTION_UNSPECIFIED
Definition: hidpi.h:185
_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
Definition: hidpi.h:400
@ HidP_Input
Definition: hidpi.h:238
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE _Out_ PHIDP_VALUE_CAPS ValueCaps
Definition: hidpi.h:399
_Must_inspect_result_ _In_ ULONG UsageListLength
Definition: hidpi.h:647
#define HIDP_STATUS_BAD_LOG_PHY_VALUES
Definition: hidpi.h:255
_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
Definition: hidpi.h:384
USHORT USAGE
Definition: hidusage.h:30
#define HID_USAGE_GENERIC_MOUSE
Definition: hidusage.h:33
#define HID_USAGE_PAGE_BUTTON
Definition: hidusage.h:183
#define HID_USAGE_GENERIC_X
Definition: hidusage.h:39
USHORT * PUSAGE
Definition: hidusage.h:30
#define HID_USAGE_GENERIC_POINTER
Definition: hidusage.h:32
#define HID_USAGE_GENERIC_Z
Definition: hidusage.h:41
#define HID_USAGE_GENERIC_WHEEL
Definition: hidusage.h:47
#define HID_USAGE_PAGE_GENERIC
Definition: hidusage.h:176
#define HID_USAGE_GENERIC_Y
Definition: hidusage.h:40
HRESULT Create([out]ITransactionReceiver **ppReceiver)
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
VOID(STDAPICALLTYPE * PSERVICE_CALLBACK_ROUTINE)(IN PVOID NormalContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2, IN OUT PVOID SystemArgument3)
Definition: kbdmou.h:86
#define IOCTL_INTERNAL_MOUSE_DISABLE
Definition: kbdmou.h:77
#define IOCTL_INTERNAL_MOUSE_ENABLE
Definition: kbdmou.h:74
#define IOCTL_INTERNAL_MOUSE_DISCONNECT
Definition: kbdmou.h:71
#define IOCTL_INTERNAL_MOUSE_CONNECT
Definition: kbdmou.h:68
VOID NTAPI MmBuildMdlForNonPagedPool(IN PMDL Mdl)
Definition: mdlsup.c:424
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
NTSTATUS NTAPI MouHid_SystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: mouhid.c:707
NTSTATUS NTAPI MouHid_Pnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: mouhid.c:1042
NTSTATUS NTAPI MouHid_CreateCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: mouhid.c:434
NTSTATUS NTAPI MouHid_Power(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: mouhid.c:693
NTSTATUS NTAPI MouHid_DeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: mouhid.c:675
VOID NTAPI MouHid_Unload(IN PDRIVER_OBJECT DriverObject)
Definition: mouhid.c:1226
NTSTATUS NTAPI MouHid_Flush(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: mouhid.c:1016
VOID MouHid_DispatchInputData(IN PMOUHID_DEVICE_EXTENSION DeviceExtension, IN PMOUSE_INPUT_DATA InputData)
Definition: mouhid.c:277
NTSTATUS NTAPI MouHid_FreeResources(IN PDEVICE_OBJECT DeviceObject)
Definition: mouhid.c:974
NTSTATUS NTAPI MouHid_Close(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: mouhid.c:522
NTSTATUS MouHid_SubmitRequest(PDEVICE_OBJECT DeviceObject, ULONG IoControlCode, ULONG InputBufferSize, PVOID InputBuffer, ULONG OutputBufferSize, PVOID OutputBuffer)
Definition: mouhid.c:719
NTSTATUS MouHid_InitiateRead(IN PMOUHID_DEVICE_EXTENSION DeviceExtension)
Definition: mouhid.c:397
NTSTATUS NTAPI MouHid_AddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: mouhid.c:1162
NTSTATUS NTAPI MouHid_StartDeviceCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: mouhid.c:963
NTSTATUS NTAPI MouHid_InternalDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: mouhid.c:559
NTSTATUS NTAPI MouHid_StartDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: mouhid.c:770
VOID MouHid_GetButtonFlags(IN PMOUHID_DEVICE_EXTENSION DeviceExtension, OUT PUSHORT ButtonFlags, OUT PUSHORT Flags)
Definition: mouhid.c:179
static USHORT MouHid_ButtonUpFlags[]
Definition: mouhid.c:13
NTSTATUS NTAPI MouHid_Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: mouhid.c:446
NTSTATUS NTAPI MouHid_ReadCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: mouhid.c:303
VOID MouHid_GetButtonMove(IN PMOUHID_DEVICE_EXTENSION DeviceExtension, OUT PLONG LastX, OUT PLONG LastY)
Definition: mouhid.c:35
static USHORT MouHid_ButtonDownFlags[]
Definition: mouhid.c:23
#define MOUHID_TAG
Definition: mouhid.h:142
#define VIRTUAL_SCREEN_SIZE_Y
Definition: mouhid.h:136
#define VIRTUAL_SCREEN_SIZE_X
Definition: mouhid.h:135
static const TBBUTTON Buttons[]
Definition: mplay32.c:41
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT * NextDeviceObject
Definition: ndis.h:4642
#define KernelMode
Definition: asm.h:34
struct _MOUSE_ATTRIBUTES MOUSE_ATTRIBUTES
#define MOUSE_LEFT_BUTTON_DOWN
Definition: ntddmou.h:46
#define MOUSE_LEFT_BUTTON_UP
Definition: ntddmou.h:47
#define MOUSE_MIDDLE_BUTTON_DOWN
Definition: ntddmou.h:50
#define MOUSE_BUTTON_4_DOWN
Definition: ntddmou.h:52
#define MOUSE_BUTTON_5_UP
Definition: ntddmou.h:55
#define MOUSE_HID_HARDWARE
Definition: ntddmou.h:104
#define MOUSE_WHEEL
Definition: ntddmou.h:56
#define MOUSE_MOVE_ABSOLUTE
Definition: ntddmou.h:68
#define IOCTL_MOUSE_QUERY_ATTRIBUTES
Definition: ntddmou.h:32
#define MOUSE_BUTTON_5_DOWN
Definition: ntddmou.h:54
#define MOUSE_BUTTON_4_UP
Definition: ntddmou.h:53
#define MOUSE_RIGHT_BUTTON_UP
Definition: ntddmou.h:49
#define MOUSE_MIDDLE_BUTTON_UP
Definition: ntddmou.h:51
#define WHEELMOUSE_HID_HARDWARE
Definition: ntddmou.h:105
#define MOUSE_RIGHT_BUTTON_DOWN
Definition: ntddmou.h:48
@ NotificationEvent
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IoCopyCurrentIrpStackLocationToNext(Irp)
Definition: ntifs_ex.h:413
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
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)
Definition: device.c:1031
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define IoCompleteRequest
Definition: irp.c:1240
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
VOID NTAPI IoReuseIrp(IN OUT PIRP Irp, IN NTSTATUS Status)
Definition: irp.c:1971
BOOLEAN NTAPI IoCancelIrp(IN PIRP Irp)
Definition: irp.c:1101
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)
Definition: irp.c:881
#define IoCallDriver
Definition: irp.c:1225
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:729
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:758
@ DevicePowerState
Definition: ntpoapi.h:63
@ PowerDeviceD0
Definition: ntpoapi.h:49
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define FILE_DEVICE_MOUSE
Definition: winioctl.h:121
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define DPRINT
Definition: sndvol32.h:71
PUSAGE CurrentUsageList
Definition: mouhid.h:65
USHORT MouseIdentifier
Definition: mouhid.h:45
HIDP_VALUE_CAPS ValueCapsY
Definition: mouhid.h:130
PFILE_OBJECT FileObject
Definition: mouhid.h:105
PDEVICE_OBJECT ClassDeviceObject
Definition: mouhid.h:35
PDEVICE_OBJECT NextDeviceObject
Definition: mouhid.h:20
PUSAGE PreviousUsageList
Definition: mouhid.h:70
HIDP_VALUE_CAPS ValueCapsX
Definition: mouhid.h:125
USHORT UsageListLength
Definition: mouhid.h:60
KEVENT ReadCompletionEvent
Definition: mouhid.h:30
USAGE UsagePage
Definition: hidpi.h:151
USHORT InputReportByteLength
Definition: hidpi.h:152
USAGE Usage
Definition: hidpi.h:150
USAGE UsagePage
Definition: hidpi.h:201
BOOLEAN IsAbsolute
Definition: hidpi.h:211
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3128
USHORT ButtonData
Definition: ntddmou.h:83
USHORT ButtonFlags
Definition: ntddmou.h:82
USHORT Flags
Definition: ntddmou.h:78
#define WHEEL_DELTA
Definition: treelist.c:99
#define LL
Definition: tui.h:150
#define NTAPI
Definition: typedefs.h:36
uint16_t * PUSHORT
Definition: typedefs.h:56
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
int32_t * PLONG
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_SHARING_VIOLATION
Definition: udferr_usr.h:154
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:325
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1049
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2793
#define IRP_MN_CANCEL_STOP_DEVICE
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_START_DEVICE
#define IRP_MN_REMOVE_DEVICE
#define DO_POWER_PAGABLE
#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_MJ_POWER
#define IRP_MN_QUERY_REMOVE_DEVICE
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
@ Executive
Definition: ketypes.h:415