ReactOS  0.4.14-dev-49-gfb4591c
kbdhid.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/kbdhid/kbdhid.c
5  * PURPOSE: Keyboard HID Driver
6  * PROGRAMMERS:
7  * Michael Martin (michael.martin@reactos.org)
8  * Johannes Anderwald (johannes.anderwald@reactos.org)
9  */
10 
11 #include "kbdhid.h"
12 
13 VOID
15  IN PKBDHID_DEVICE_EXTENSION DeviceExtension,
16  IN PKEYBOARD_INPUT_DATA InputData)
17 {
18  KIRQL OldIrql;
19  ULONG InputDataConsumed;
20 
21  if (!DeviceExtension->ClassService)
22  return;
23 
24  /* sanity check */
25  ASSERT(DeviceExtension->ClassService);
26  ASSERT(DeviceExtension->ClassDeviceObject);
27 
28  /* raise irql */
30 
31  /* dispatch input data */
32  (*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassService)(DeviceExtension->ClassDeviceObject, InputData, InputData + 1, &InputDataConsumed);
33 
34  /* lower irql to previous level */
36 }
37 
38 BOOLEAN
39 NTAPI
42  IN PCHAR NewScanCodes,
43  IN ULONG Length)
44 {
45  KEYBOARD_INPUT_DATA InputData;
46  ULONG Index;
47  PKBDHID_DEVICE_EXTENSION DeviceExtension;
48  CHAR Prefix = 0;
49 
50  /* get device extension */
51  DeviceExtension = Context;
52 
53  for(Index = 0; Index < Length; Index++)
54  {
55  DPRINT("[KBDHID] ScanCode Index %lu ScanCode %x\n", Index, NewScanCodes[Index] & 0xFF);
56 
57  /* check if this is E0 or E1 prefix */
58  if (NewScanCodes[Index] == (CHAR)0xE0 || NewScanCodes[Index] == (CHAR)0xE1)
59  {
60  Prefix = NewScanCodes[Index];
61  continue;
62  }
63 
64  /* init input data */
65  RtlZeroMemory(&InputData, sizeof(KEYBOARD_INPUT_DATA));
66 
67  /* use keyboard unit id */
68  InputData.UnitId = DeviceExtension->KeyboardTypematic.UnitId;
69 
70  if (NewScanCodes[Index] & 0x80)
71  {
72  /* scan codes with 0x80 flag are a key break */
73  InputData.Flags |= KEY_BREAK;
74  }
75 
76  /* set a prefix if needed */
77  if (Prefix)
78  {
79  InputData.Flags |= (Prefix == (CHAR)0xE0 ? KEY_E0 : KEY_E1);
80  Prefix = 0;
81  }
82 
83  /* store key code */
84  InputData.MakeCode = NewScanCodes[Index] & 0x7F;
85 
86  /* dispatch scan codes */
87  KbdHid_DispatchInputData(Context, &InputData);
88  }
89 
90  /* done */
91  return TRUE;
92 }
93 
94 
96 NTAPI
99  IN PIRP Irp,
100  IN PVOID Context)
101 {
102  PKBDHID_DEVICE_EXTENSION DeviceExtension;
104  ULONG ButtonLength;
105 
106  /* get device extension */
107  DeviceExtension = Context;
108 
109  if (Irp->IoStatus.Status == STATUS_PRIVILEGE_NOT_HELD ||
110  Irp->IoStatus.Status == STATUS_DEVICE_NOT_CONNECTED ||
111  Irp->IoStatus.Status == STATUS_CANCELLED ||
112  DeviceExtension->StopReadReport)
113  {
114  /* failed to read or should be stopped*/
115  DPRINT1("[KBDHID] ReadCompletion terminating read Status %x\n", Irp->IoStatus.Status);
116 
117  /* report no longer active */
118  DeviceExtension->ReadReportActive = FALSE;
119 
120  /* request stopping of the report cycle */
121  DeviceExtension->StopReadReport = FALSE;
122 
123  /* signal completion event */
124  KeSetEvent(&DeviceExtension->ReadCompletionEvent, 0, 0);
126  }
127 
128  //
129  // print out raw report
130  //
131  ASSERT(DeviceExtension->ReportLength >= 9);
132  DPRINT("[KBDHID] ReadCompletion %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", DeviceExtension->Report[0], DeviceExtension->Report[1], DeviceExtension->Report[2],
133  DeviceExtension->Report[3], DeviceExtension->Report[4], DeviceExtension->Report[5],
134  DeviceExtension->Report[6], DeviceExtension->Report[7], DeviceExtension->Report[8]);
135 
136 
137  /* get current usages */
138  ButtonLength = DeviceExtension->UsageListLength;
141  DeviceExtension->CurrentUsageList,
142  &ButtonLength,
143  DeviceExtension->PreparsedData,
144  DeviceExtension->Report,
145  DeviceExtension->ReportLength);
147 
148  /* FIXME check if needs mapping */
149 
150  /* get usage difference */
152  DeviceExtension->CurrentUsageList,
153  DeviceExtension->BreakUsageList,
154  DeviceExtension->MakeUsageList,
155  DeviceExtension->UsageListLength);
157 
158  /* replace previous usage list with current list */
159  RtlMoveMemory(DeviceExtension->PreviousUsageList,
160  DeviceExtension->CurrentUsageList,
161  sizeof(USAGE_AND_PAGE) * DeviceExtension->UsageListLength);
162 
163  /* translate break usage list */
165  DeviceExtension->UsageListLength,
167  &DeviceExtension->ModifierState,
169  DeviceExtension);
171 
172  /* translate new usage list */
174  DeviceExtension->UsageListLength,
176  &DeviceExtension->ModifierState,
178  DeviceExtension);
180 
181  /* re-init read */
182  KbdHid_InitiateRead(DeviceExtension);
183 
184  /* stop completion */
186 }
187 
188 NTSTATUS
190  IN PKBDHID_DEVICE_EXTENSION DeviceExtension)
191 {
192  PIO_STACK_LOCATION IoStack;
194 
195  /* re-use irp */
196  IoReuseIrp(DeviceExtension->Irp, STATUS_SUCCESS);
197 
198  /* init irp */
199  DeviceExtension->Irp->MdlAddress = DeviceExtension->ReportMDL;
200 
201  /* get next stack location */
202  IoStack = IoGetNextIrpStackLocation(DeviceExtension->Irp);
203 
204  /* init stack location */
205  IoStack->Parameters.Read.Length = DeviceExtension->ReportLength;
206  IoStack->Parameters.Read.Key = 0;
207  IoStack->Parameters.Read.ByteOffset.QuadPart = 0LL;
208  IoStack->MajorFunction = IRP_MJ_READ;
209  IoStack->FileObject = DeviceExtension->FileObject;
210 
211  /* set completion routine */
212  IoSetCompletionRoutine(DeviceExtension->Irp, KbdHid_ReadCompletion, DeviceExtension, TRUE, TRUE, TRUE);
213 
214  /* read is active */
215  DeviceExtension->ReadReportActive = TRUE;
216 
217  /* start the read */
218  Status = IoCallDriver(DeviceExtension->NextDeviceObject, DeviceExtension->Irp);
219 
220  /* done */
221  return Status;
222 }
223 
224 NTSTATUS
225 NTAPI
228  IN PIRP Irp,
229  IN PVOID Context)
230 {
233 }
234 
235 
236 NTSTATUS
237 NTAPI
240  IN PIRP Irp)
241 {
242  PIO_STACK_LOCATION IoStack;
244  KEVENT Event;
245  PKBDHID_DEVICE_EXTENSION DeviceExtension;
246 
247  DPRINT("[KBDHID]: IRP_MJ_CREATE\n");
248 
249  /* get device extension */
250  DeviceExtension = DeviceObject->DeviceExtension;
251 
252  /* get stack location */
254 
255  /* copy stack location to next */
257 
258  /* init event */
260 
261  /* prepare irp */
263 
264  /* call lower driver */
265  Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
266  if (Status == STATUS_PENDING)
267  {
268  /* request pending */
270  }
271 
272  /* check for success */
273  if (!NT_SUCCESS(Status))
274  {
275  /* failed */
276  Irp->IoStatus.Status = Status;
278  return Status;
279  }
280 
281  /* is the driver already in use */
282  if (DeviceExtension->FileObject == NULL)
283  {
284  /* did the caller specify correct attributes */
285  ASSERT(IoStack->Parameters.Create.SecurityContext);
286  if (IoStack->Parameters.Create.SecurityContext->DesiredAccess)
287  {
288  /* store file object */
289  DeviceExtension->FileObject = IoStack->FileObject;
290 
291  /* reset event */
292  KeClearEvent(&DeviceExtension->ReadCompletionEvent);
293 
294  /* initiating read */
295  Status = KbdHid_InitiateRead(DeviceExtension);
296  DPRINT("[KBDHID] KbdHid_InitiateRead: status %x\n", Status);
297  if (Status == STATUS_PENDING)
298  {
299  /* report irp is pending */
301  }
302  }
303  }
304 
305  /* complete request */
306  Irp->IoStatus.Status = Status;
308  return Status;
309 }
310 
311 
312 NTSTATUS
313 NTAPI
316  IN PIRP Irp)
317 {
318  PKBDHID_DEVICE_EXTENSION DeviceExtension;
319 
320  /* get device extension */
321  DeviceExtension = DeviceObject->DeviceExtension;
322 
323  DPRINT("[KBDHID] IRP_MJ_CLOSE ReadReportActive %x\n", DeviceExtension->ReadReportActive);
324 
325  if (DeviceExtension->ReadReportActive)
326  {
327  /* request stopping of the report cycle */
328  DeviceExtension->StopReadReport = TRUE;
329 
330  /* wait until the reports have been read */
332 
333  /* cancel irp */
334  IoCancelIrp(DeviceExtension->Irp);
335  }
336 
337  DPRINT("[KBDHID] IRP_MJ_CLOSE ReadReportActive %x\n", DeviceExtension->ReadReportActive);
338 
339  /* remove file object */
340  DeviceExtension->FileObject = NULL;
341 
342  /* skip location */
344 
345  /* pass irp to down the stack */
346  return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
347 }
348 
349 NTSTATUS
350 NTAPI
353  IN PIRP Irp)
354 {
355  PIO_STACK_LOCATION IoStack;
356  PKBDHID_DEVICE_EXTENSION DeviceExtension;
359 
360  /* get current stack location */
362 
363  DPRINT("[KBDHID] InternalDeviceControl %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
364 
365  /* get device extension */
366  DeviceExtension = DeviceObject->DeviceExtension;
367 
368  switch (IoStack->Parameters.DeviceIoControl.IoControlCode)
369  {
371  /* verify output buffer length */
372  if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(MOUSE_ATTRIBUTES))
373  {
374  /* invalid request */
375  DPRINT1("[KBDHID] IOCTL_KEYBOARD_QUERY_ATTRIBUTES Buffer too small\n");
376  Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
379  }
380 
381  /* get output buffer */
382  Attributes = Irp->AssociatedIrp.SystemBuffer;
383 
384  /* copy attributes */
386  &DeviceExtension->Attributes,
387  sizeof(KEYBOARD_ATTRIBUTES));
388 
389  /* complete request */
390  Irp->IoStatus.Information = sizeof(MOUSE_ATTRIBUTES);
391  Irp->IoStatus.Status = STATUS_SUCCESS;
393  return STATUS_SUCCESS;
394 
396  /* verify input buffer length */
397  if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA))
398  {
399  /* invalid request */
400  Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
403  }
404 
405  /* is it already connected */
406  if (DeviceExtension->ClassService)
407  {
408  /* already connected */
409  Irp->IoStatus.Status = STATUS_SHARING_VIOLATION;
412  }
413 
414  /* get connect data */
415  Data = IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
416 
417  /* store connect details */
418  DeviceExtension->ClassDeviceObject = Data->ClassDeviceObject;
419  DeviceExtension->ClassService = Data->ClassService;
420 
421  /* completed successfully */
422  Irp->IoStatus.Status = STATUS_SUCCESS;
424  return STATUS_SUCCESS;
425 
427  /* not implemented */
428  Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
430  return STATUS_NOT_IMPLEMENTED;
431 
433  /* not supported */
434  Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
436  return STATUS_NOT_SUPPORTED;
437 
439  /* not supported */
440  Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
442  return STATUS_NOT_SUPPORTED;
443 
445  if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS))
446  {
447  /* invalid parameter */
448  Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
451  }
452 
453  /* copy indicators */
454  RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer,
455  &DeviceExtension->KeyboardIndicator,
457 
458  /* complete request */
459  Irp->IoStatus.Status = STATUS_SUCCESS;
460  Irp->IoStatus.Information = sizeof(KEYBOARD_INDICATOR_PARAMETERS);
462  return STATUS_NOT_IMPLEMENTED;
463 
465  if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_TYPEMATIC_PARAMETERS))
466  {
467  /* invalid parameter */
468  Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
471  }
472 
473  /* copy indicators */
474  RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer,
475  &DeviceExtension->KeyboardTypematic,
477 
478  /* done */
479  Irp->IoStatus.Status = STATUS_SUCCESS;
480  Irp->IoStatus.Information = sizeof(KEYBOARD_TYPEMATIC_PARAMETERS);
482  return STATUS_SUCCESS;
483 
485  if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS))
486  {
487  /* invalid parameter */
488  Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
491  }
492 
493  /* copy indicators */
494  RtlCopyMemory(&DeviceExtension->KeyboardIndicator,
495  Irp->AssociatedIrp.SystemBuffer,
497 
498  /* done */
499  Irp->IoStatus.Status = STATUS_SUCCESS;
500  Irp->IoStatus.Information = 0;
502  return STATUS_SUCCESS;
503 
505  if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_TYPEMATIC_PARAMETERS))
506  {
507  /* invalid parameter */
508  Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
511  }
512 
513  /* copy indicators */
514  RtlCopyMemory(&DeviceExtension->KeyboardTypematic,
515  Irp->AssociatedIrp.SystemBuffer,
517 
518  /* done */
519  Irp->IoStatus.Status = STATUS_SUCCESS;
520  Irp->IoStatus.Information = 0;
522  return STATUS_SUCCESS;
523 
525  /* not implemented */
526  DPRINT1("IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION not implemented\n");
527  Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
529  return STATUS_NOT_IMPLEMENTED;
530  }
531 
532  /* unknown control code */
533  DPRINT1("[KBDHID] Unknown DeviceControl %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
534  /* unknown request not supported */
535  Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
537  return STATUS_NOT_SUPPORTED;
538 }
539 
540 NTSTATUS
541 NTAPI
544  IN PIRP Irp)
545 {
546  PKBDHID_DEVICE_EXTENSION DeviceExtension;
547 
548  /* get device extension */
549  DeviceExtension = DeviceObject->DeviceExtension;
550 
551  /* skip stack location */
553 
554  /* pass and forget */
555  return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
556 }
557 
558 NTSTATUS
559 NTAPI
562  IN PIRP Irp)
563 {
564  PKBDHID_DEVICE_EXTENSION DeviceExtension;
565 
566  DeviceExtension = DeviceObject->DeviceExtension;
569  return PoCallDriver(DeviceExtension->NextDeviceObject, Irp);
570 }
571 
572 NTSTATUS
573 NTAPI
576  IN PIRP Irp)
577 {
578  PKBDHID_DEVICE_EXTENSION DeviceExtension;
579 
580  DeviceExtension = DeviceObject->DeviceExtension;
582  return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
583 }
584 
585 NTSTATUS
589  ULONG InputBufferSize,
591  ULONG OutputBufferSize,
593 {
594  KEVENT Event;
595  PKBDHID_DEVICE_EXTENSION DeviceExtension;
596  PIRP Irp;
599 
600  /* get device extension */
601  DeviceExtension = DeviceObject->DeviceExtension;
602 
603  /* init event */
605 
606  /* build request */
608  DeviceExtension->NextDeviceObject,
609  InputBuffer,
610  InputBufferSize,
611  OutputBuffer,
612  OutputBufferSize,
613  FALSE,
614  &Event,
615  &IoStatus);
616  if (!Irp)
617  {
618  /* no memory */
620  }
621 
622  /* send request */
623  Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
624  if (Status == STATUS_PENDING)
625  {
626  /* wait for request to complete */
628  Status = IoStatus.Status;
629  }
630 
631  /* done */
632  return Status;
633 }
634 
635 NTSTATUS
636 NTAPI
639 {
641  ULONG Buttons;
645  PKBDHID_DEVICE_EXTENSION DeviceExtension;
647 
648  /* get device extension */
649  DeviceExtension = DeviceObject->DeviceExtension;
650 
651  /* query collection information */
654  0,
655  NULL,
657  &Information);
658  if (!NT_SUCCESS(Status))
659  {
660  /* failed to query collection information */
661  DPRINT1("[KBDHID] failed to obtain collection information with %x\n", Status);
662  return Status;
663  }
664 
665  /* lets allocate space for preparsed data */
667  if (!PreparsedData)
668  {
669  /* no memory */
670  DPRINT1("[KBDHID] no memory size %u\n", Information.DescriptorSize);
672  }
673 
674  /* now obtain the preparsed data */
677  0,
678  NULL,
679  Information.DescriptorSize,
680  PreparsedData);
681  if (!NT_SUCCESS(Status))
682  {
683  /* failed to get preparsed data */
684  DPRINT1("[KBDHID] failed to obtain collection information with %x\n", Status);
686  return Status;
687  }
688 
689  /* lets get the caps */
692  {
693  /* failed to get capabilities */
694  DPRINT1("[KBDHID] failed to obtain caps with %x\n", Status);
696  return Status;
697  }
698 
699  DPRINT("[KBDHID] Usage %x UsagePage %x InputReportLength %lu\n", Capabilities.Usage, Capabilities.UsagePage, Capabilities.InputReportByteLength);
700 
701  /* init input report */
703  ASSERT(DeviceExtension->ReportLength);
704  DeviceExtension->Report = ExAllocatePoolWithTag(NonPagedPool, DeviceExtension->ReportLength, KBDHID_TAG);
705  ASSERT(DeviceExtension->Report);
706  RtlZeroMemory(DeviceExtension->Report, DeviceExtension->ReportLength);
707 
708  /* build mdl */
709  DeviceExtension->ReportMDL = IoAllocateMdl(DeviceExtension->Report,
710  DeviceExtension->ReportLength,
711  FALSE,
712  FALSE,
713  NULL);
714  ASSERT(DeviceExtension->ReportMDL);
715 
716  /* init mdl */
717  MmBuildMdlForNonPagedPool(DeviceExtension->ReportMDL);
718 
719  /* get max number of buttons */
721  DPRINT("[KBDHID] Buttons %lu\n", Buttons);
722  ASSERT(Buttons > 0);
723 
724  /* now allocate an array for those buttons */
726  if (!Buffer)
727  {
728  /* no memory */
731  }
732  DeviceExtension->UsageListBuffer = Buffer;
733 
734  /* init usage lists */
735  RtlZeroMemory(Buffer, sizeof(USAGE_AND_PAGE) * 4 * Buttons);
736  DeviceExtension->CurrentUsageList = Buffer;
737  Buffer += Buttons;
738  DeviceExtension->PreviousUsageList = Buffer;
739  Buffer += Buttons;
740  DeviceExtension->MakeUsageList = Buffer;
741  Buffer += Buttons;
742  DeviceExtension->BreakUsageList = Buffer;
743 
744  //
745  // FIMXE: implement device hacks
746  //
747  // UsageMappings
748  // KeyboardTypeOverride
749  // KeyboardSubTypeOverride
750  // KeyboardNumberTotalKeysOverride
751  // KeyboardNumberFunctionKeysOverride
752  // KeyboardNumberIndicatorsOverride
753 
754  /* store number of buttons */
755  DeviceExtension->UsageListLength = (USHORT)Buttons;
756 
757  /* store preparsed data */
758  DeviceExtension->PreparsedData = PreparsedData;
759 
760  /* completed successfully */
761  return STATUS_SUCCESS;
762 }
763 
764 NTSTATUS
765 NTAPI
768  IN PIRP Irp,
769  IN PVOID Context)
770 {
773 }
774 
775 NTSTATUS
776 NTAPI
779 {
780  PKBDHID_DEVICE_EXTENSION DeviceExtension;
781 
782  /* get device extension */
783  DeviceExtension = DeviceObject->DeviceExtension;
784 
785  /* free resources */
786  if (DeviceExtension->PreparsedData)
787  {
788  ExFreePoolWithTag(DeviceExtension->PreparsedData, KBDHID_TAG);
789  DeviceExtension->PreparsedData = NULL;
790  }
791 
792  if (DeviceExtension->UsageListBuffer)
793  {
794  ExFreePoolWithTag(DeviceExtension->UsageListBuffer, KBDHID_TAG);
795  DeviceExtension->UsageListBuffer = NULL;
796  DeviceExtension->CurrentUsageList = NULL;
797  DeviceExtension->PreviousUsageList = NULL;
798  DeviceExtension->MakeUsageList = NULL;
799  DeviceExtension->BreakUsageList = NULL;
800  }
801 
802  if (DeviceExtension->ReportMDL)
803  {
804  IoFreeMdl(DeviceExtension->ReportMDL);
805  DeviceExtension->ReportMDL = NULL;
806  }
807 
808  if (DeviceExtension->Report)
809  {
810  ExFreePoolWithTag(DeviceExtension->Report, KBDHID_TAG);
811  DeviceExtension->Report = NULL;
812  }
813 
814  return STATUS_SUCCESS;
815 }
816 
817 NTSTATUS
818 NTAPI
821  IN PIRP Irp)
822 {
823  PIO_STACK_LOCATION IoStack;
824  PKBDHID_DEVICE_EXTENSION DeviceExtension;
825 
826  /* get device extension */
827  DeviceExtension = DeviceObject->DeviceExtension;
828 
829  /* skip current stack location */
831 
832  /* get next stack location */
833  IoStack = IoGetNextIrpStackLocation(Irp);
834 
835  /* change request to hid flush queue request */
837  IoStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_HID_FLUSH_QUEUE;
838 
839  /* call device */
840  return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
841 }
842 
843 NTSTATUS
844 NTAPI
847  IN PIRP Irp)
848 {
849  PIO_STACK_LOCATION IoStack;
850  KEVENT Event;
852  PKBDHID_DEVICE_EXTENSION DeviceExtension;
853 
854  /* get device extension */
855  DeviceExtension = DeviceObject->DeviceExtension;
856 
857  /* get current irp stack */
859  DPRINT("[KBDHID] IRP_MJ_PNP Request: %x\n", IoStack->MinorFunction);
860 
861  switch (IoStack->MinorFunction)
862  {
863  case IRP_MN_STOP_DEVICE:
865  /* free resources */
867  /* fall through */
872  /* indicate success */
873  Irp->IoStatus.Status = STATUS_SUCCESS;
874 
875  /* skip irp stack location */
877 
878  /* dispatch to lower device */
879  return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
880 
882  /* FIXME synchronization */
883 
884  /* cancel irp */
885  IoCancelIrp(DeviceExtension->Irp);
886 
887  /* free resources */
889 
890  /* indicate success */
891  Irp->IoStatus.Status = STATUS_SUCCESS;
892 
893  /* skip irp stack location */
895 
896  /* dispatch to lower device */
897  Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
898 
899  IoFreeIrp(DeviceExtension->Irp);
900  IoDetachDevice(DeviceExtension->NextDeviceObject);
902  return Status;
903 
904  case IRP_MN_START_DEVICE:
905  /* init event */
907 
908  /* copy stack location */
910 
911  /* set completion routine */
913  Irp->IoStatus.Status = 0;
914 
915  /* pass request */
916  Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
917  if (Status == STATUS_PENDING)
918  {
920  Status = Irp->IoStatus.Status;
921  }
922 
923  if (!NT_SUCCESS(Status))
924  {
925  /* failed */
926  Irp->IoStatus.Status = Status;
928  return Status;
929  }
930 
931  /* lets start the device */
933  DPRINT("KbdHid_StartDevice %x\n", Status);
934 
935  /* complete request */
936  Irp->IoStatus.Status = Status;
938 
939  /* done */
940  return Status;
941 
942  default:
943  /* skip irp stack location */
945 
946  /* dispatch to lower device */
947  return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
948  }
949 }
950 
951 NTSTATUS
952 NTAPI
956 {
959  PKBDHID_DEVICE_EXTENSION DeviceExtension;
961 
962  /* create device object */
964  sizeof(KBDHID_DEVICE_EXTENSION),
965  NULL,
967  0,
968  FALSE,
969  &DeviceObject);
970  if (!NT_SUCCESS(Status))
971  {
972  /* failed to create device object */
973  return Status;
974  }
975 
976  /* now attach it */
978  if (!NextDeviceObject)
979  {
980  /* failed to attach */
983  }
984 
985  /* get device extension */
986  DeviceExtension = DeviceObject->DeviceExtension;
987 
988  /* zero extension */
989  RtlZeroMemory(DeviceExtension, sizeof(KBDHID_DEVICE_EXTENSION));
990 
991  /* init device extension */
992  DeviceExtension->NextDeviceObject = NextDeviceObject;
994 
995  /* init keyboard attributes */
999  DeviceExtension->Attributes.NumberOfIndicators = 3; // caps, num lock, scroll lock
1000  DeviceExtension->Attributes.NumberOfKeysTotal = 101;
1001  DeviceExtension->Attributes.InputDataQueueLength = 1;
1006 
1007  /* allocate irp */
1008  DeviceExtension->Irp = IoAllocateIrp(NextDeviceObject->StackSize, FALSE);
1009 
1010  /* FIXME handle allocation error */
1011  ASSERT(DeviceExtension->Irp);
1012 
1013  /* set power state to D0 */
1014  State.DeviceState = PowerDeviceD0;
1016 
1017  /* init device object */
1020 
1021  /* completed successfully */
1022  return STATUS_SUCCESS;
1023 }
1024 
1025 VOID
1026 NTAPI
1029 {
1030  UNIMPLEMENTED;
1031 }
1032 
1033 
1034 NTSTATUS
1035 NTAPI
1038  IN PUNICODE_STRING RegPath)
1039 {
1040  /* initialize driver object */
1051 
1052  /* done */
1053  return STATUS_SUCCESS;
1054 }
NTSTATUS KbdHid_InitiateRead(IN PKBDHID_DEVICE_EXTENSION DeviceExtension)
Definition: kbdhid.c:189
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMaximum
Definition: ntddkbd.h:131
signed char * PCHAR
Definition: retypes.h:7
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define DO_POWER_PAGABLE
PFILE_OBJECT FileObject
Definition: kbdhid.h:96
#define IN
Definition: typedefs.h:38
#define KBDHID_TAG
Definition: kbdhid.h:148
PUSAGE_AND_PAGE MakeUsageList
Definition: kbdhid.h:71
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define IOCTL_KEYBOARD_QUERY_TYPEMATIC
Definition: ntddkbd.h:41
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define TRUE
Definition: types.h:120
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1631
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define LL
Definition: tui.h:85
#define IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION
Definition: ntddkbd.h:38
#define IRP_MN_REMOVE_DEVICE
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG _In_ PHIDP_PREPARSED_DATA PreparsedData
Definition: hidpi.h:333
PUSAGE_AND_PAGE BreakUsageList
Definition: kbdhid.h:66
UCHAR Type
Definition: ntddkbd.h:101
PUSAGE_AND_PAGE PreviousUsageList
Definition: kbdhid.h:61
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
#define IRP_MJ_FLUSH_BUFFERS
VOID NTAPI IoReuseIrp(IN OUT PIRP Irp, IN NTSTATUS Status)
Definition: irp.c:1971
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:63
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
NTSTATUS NTAPI PoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp)
Definition: power.c:485
_In_ PIRP Irp
Definition: csq.h:116
HIDAPI ULONG NTAPI HidP_MaxUsageListLength(IN HIDP_REPORT_TYPE ReportType, IN USAGE UsagePage OPTIONAL, IN PHIDP_PREPARSED_DATA PreparsedData)
Definition: hidp.c:99
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
NTSTATUS NTAPI KbdHid_Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:238
PDEVICE_OBJECT ClassDeviceObject
Definition: kbdhid.h:36
NTSTATUS NTAPI KbdHid_FreeResources(IN PDEVICE_OBJECT DeviceObject)
Definition: kbdhid.c:777
char CHAR
Definition: xmlstorage.h:175
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
VOID NTAPI MmBuildMdlForNonPagedPool(IN PMDL Mdl)
Definition: mdlsup.c:428
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:1296
KEYBOARD_TYPEMATIC_PARAMETERS KeyboardTypematic
Definition: kbdhid.h:126
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1114
#define KEY_BREAK
Definition: ntddkbd.h:71
PDEVICE_OBJECT NextDeviceObject
Definition: kbdhid.h:21
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
struct _KEYBOARD_TYPEMATIC_PARAMETERS KEYBOARD_TYPEMATIC_PARAMETERS
USHORT NumberOfKeysTotal
Definition: ntddkbd.h:128
CHAR InputBuffer[80]
Definition: conmgr.c:33
#define IOCTL_HID_GET_COLLECTION_DESCRIPTOR
Definition: hidclass.h:58
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:515
struct _KEYBOARD_INDICATOR_PARAMETERS KEYBOARD_INDICATOR_PARAMETERS
FORCEINLINE VOID IoCopyCurrentIrpStackLocationToNext(_Inout_ PIRP Irp)
Definition: iofuncs.h:2820
UCHAR KIRQL
Definition: env_spec_w32.h:591
PUSAGE_AND_PAGE CurrentUsageList
Definition: kbdhid.h:56
NTSTATUS NTAPI KbdHid_ReadCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: kbdhid.c:97
#define KEYBOARD_TYPEMATIC_RATE_MINIMUM
Definition: kbdhid.h:131
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define STATUS_SHARING_VIOLATION
Definition: udferr_usr.h:154
#define IRP_MN_QUERY_REMOVE_DEVICE
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
#define IOCTL_KEYBOARD_SET_TYPEMATIC
Definition: ntddkbd.h:44
#define KEYBOARD_TYPEMATIC_DELAY_MAXIMUM
Definition: kbdhid.h:135
PDEVICE_OBJECT NTAPI IoAttachDeviceToDeviceStack(IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice)
Definition: device.c:966
NTSTATUS KbdHid_SubmitRequest(PDEVICE_OBJECT DeviceObject, ULONG IoControlCode, ULONG InputBufferSize, PVOID InputBuffer, ULONG OutputBufferSize, PVOID OutputBuffer)
Definition: kbdhid.c:586
PDRIVER_EXTENSION DriverExtension
Definition: iotypes.h:2174
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
#define HID_USAGE_PAGE_KEYBOARD
Definition: hidusage.h:181
KEYBOARD_INDICATOR_PARAMETERS KeyboardIndicator
Definition: kbdhid.h:121
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define KEYBOARD_TYPE_UNKNOWN
Definition: kbdhid.h:140
#define MICROSOFT_KBD_FUNC
Definition: kbdhid.h:139
KEVENT ReadCompletionEvent
Definition: kbdhid.h:31
#define MICROSOFT_KBD_101_TYPE
Definition: kbdhid.h:141
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
#define IoCompleteRequest
Definition: irp.c:1240
void DPRINT(...)
Definition: polytest.cpp:61
#define IOCTL_INTERNAL_KEYBOARD_DISABLE
Definition: kbdmou.h:65
Definition: bufpool.h:45
BOOLEAN NTAPI KbdHid_InsertScanCodes(IN PVOID Context, IN PCHAR NewScanCodes, IN ULONG Length)
Definition: kbdhid.c:40
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
HIDAPI NTSTATUS NTAPI HidP_GetCaps(IN PHIDP_PREPARSED_DATA PreparsedData, OUT PHIDP_CAPS Capabilities)
Definition: hidp.c:33
KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMinimum
Definition: ntddkbd.h:130
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
VOID NTAPI KbdHid_Unload(IN PDRIVER_OBJECT DriverObject)
Definition: kbdhid.c:1027
#define IRP_MN_QUERY_STOP_DEVICE
NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegPath)
Definition: kbdhid.c:1036
#define IOCTL_KEYBOARD_QUERY_INDICATORS
Definition: ntddkbd.h:35
#define IOCTL_INTERNAL_KEYBOARD_DISCONNECT
Definition: kbdmou.h:59
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
static const TBBUTTON Buttons[]
Definition: mplay32.c:41
#define IRP_MN_STOP_DEVICE
USAGE UsagePage
Definition: hidpi.h:151
NTSTATUS NTAPI KbdHid_InternalDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:351
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define DO_BUFFERED_IO
Definition: env_spec_w32.h:394
struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA
Definition: hidpi.h:39
USHORT NumberOfIndicators
Definition: ntddkbd.h:127
NTSTATUS NTAPI KbdHid_Pnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:845
#define IRP_MN_START_DEVICE
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
static const UCHAR Index[8]
Definition: usbohci.c:18
NTSTATUS NTAPI KbdHid_Flush(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:819
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ HIDAPI NTSTATUS NTAPI HidP_TranslateUsageAndPagesToI8042ScanCodes(_In_reads_(UsageListLength) PUSAGE_AND_PAGE ChangedUsageList, _In_ ULONG UsageListLength, _In_ HIDP_KEYBOARD_DIRECTION KeyAction, _Inout_ PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, _In_ PHIDP_INSERT_SCANCODES InsertCodesProcedure, _In_opt_ PVOID InsertCodesContext)
VOID NTAPI IoFreeMdl(PMDL Mdl)
Definition: iomdl.c:146
#define IOCTL_INTERNAL_KEYBOARD_CONNECT
Definition: kbdmou.h:56
#define IOCTL_HID_GET_COLLECTION_INFORMATION
Definition: hidclass.h:59
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT _Inout_opt_ PDEVICE_OBJECT * NextDeviceObject
Definition: ndis.h:4640
NTSTATUS NTAPI KbdHid_StartDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: kbdhid.c:637
VOID(STDAPICALLTYPE * PSERVICE_CALLBACK_ROUTINE)(IN PVOID NormalContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2, IN OUT PVOID SystemArgument3)
Definition: kbdmou.h:86
#define IRP_MJ_POWER
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
NTSTATUS NTAPI KbdHid_DeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:542
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
PDRIVER_UNLOAD DriverUnload
Definition: iotypes.h:2180
KEYBOARD_ID KeyboardIdentifier
Definition: ntddkbd.h:124
UCHAR Subtype
Definition: ntddkbd.h:102
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2647
#define KEY_E1
Definition: ntddkbd.h:73
NTSTATUS NTAPI KbdHid_CreateCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: kbdhid.c:226
#define IRP_MJ_SYSTEM_CONTROL
NTSTATUS NTAPI KbdHid_SystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:574
#define KEYBOARD_TYPEMATIC_RATE_DEFAULT
Definition: kbdhid.h:133
Status
Definition: gdiplustypes.h:24
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
PDRIVER_ADD_DEVICE AddDevice
Definition: iotypes.h:2112
#define HIDP_LINK_COLLECTION_UNSPECIFIED
Definition: hidpi.h:185
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
enum State_ State
Definition: pofuncs.h:54
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
VOID NTAPI PoStartNextPowerIrp(IN PIRP Irp)
Definition: power.c:626
USAGE Usage
Definition: hidpi.h:150
USHORT NumberOfFunctionKeys
Definition: ntddkbd.h:126
NTSTATUS NTAPI KbdHid_AddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: kbdhid.c:953
unsigned short USHORT
Definition: pedump.c:61
NTSTATUS NTAPI KbdHid_StartDeviceCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: kbdhid.c:766
#define KEY_E0
Definition: ntddkbd.h:72
ULONG InputDataQueueLength
Definition: ntddkbd.h:129
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
NTSTATUS NTAPI KbdHid_Close(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:314
#define IOCTL_INTERNAL_KEYBOARD_ENABLE
Definition: kbdmou.h:62
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 DPRINT1
Definition: precomp.h:8
#define IRP_MJ_READ
Definition: rdpdr.c:46
BOOLEAN NTAPI IoCancelIrp(IN PIRP Irp)
Definition: irp.c:1101
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
PHIDP_PREPARSED_DATA PreparsedData
Definition: kbdhid.h:76
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: iotypes.h:2181
#define IOCTL_KEYBOARD_QUERY_ATTRIBUTES
Definition: ntddkbd.h:32
struct tagContext Context
Definition: acpixf.h:1024
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:566
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
#define UNIMPLEMENTED
Definition: debug.h:114
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
POWER_STATE NTAPI PoSetPowerState(IN PDEVICE_OBJECT DeviceObject, IN POWER_STATE_TYPE Type, IN POWER_STATE State)
Definition: power.c:597
NTSTATUS NTAPI KbdHid_Power(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:560
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
#define HIDP_STATUS_SUCCESS
Definition: hidpi.h:248
KEYBOARD_ATTRIBUTES Attributes
Definition: kbdhid.h:111
#define IRP_MN_CANCEL_STOP_DEVICE
USHORT UsageListLength
Definition: kbdhid.h:51
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
HIDAPI NTSTATUS NTAPI HidP_GetUsagesEx(IN HIDP_REPORT_TYPE ReportType, IN USHORT LinkCollection, OUT PUSAGE_AND_PAGE ButtonList, IN OUT ULONG *UsageLength, IN PHIDP_PREPARSED_DATA PreparsedData, IN PCHAR Report, IN ULONG ReportLength)
Definition: hidp.c:203
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
#define IOCTL_KEYBOARD_SET_INDICATORS
Definition: ntddkbd.h:47
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define KEYBOARD_TYPEMATIC_DELAY_MINIMUM
Definition: kbdhid.h:134
struct _MOUSE_ATTRIBUTES MOUSE_ATTRIBUTES
#define CHAR(Char)
#define IOCTL_HID_FLUSH_QUEUE
Definition: hidclass.h:57
HRESULT Create([out]ITransactionReceiver **ppReceiver)
#define FILE_DEVICE_KEYBOARD
Definition: winioctl.h:116
USHORT InputReportByteLength
Definition: hidpi.h:152
HIDAPI NTSTATUS NTAPI HidP_UsageAndPageListDifference(IN PUSAGE_AND_PAGE PreviousUsageList, IN PUSAGE_AND_PAGE CurrentUsageList, OUT PUSAGE_AND_PAGE BreakUsageList, OUT PUSAGE_AND_PAGE MakeUsageList, IN ULONG UsageListLength)
Definition: hidp.c:218
HIDP_KEYBOARD_MODIFIER_STATE ModifierState
Definition: kbdhid.h:116
VOID KbdHid_DispatchInputData(IN PKBDHID_DEVICE_EXTENSION DeviceExtension, IN PKEYBOARD_INPUT_DATA InputData)
Definition: kbdhid.c:14
Iosb Information
Definition: create.c:4377
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52