ReactOS 0.4.16-dev-311-g9382aa2
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/* This structure starts with the same layout as KEYBOARD_INDICATOR_TRANSLATION */
18
23
24
25VOID
27 IN PKBDHID_DEVICE_EXTENSION DeviceExtension,
28 IN PKEYBOARD_INPUT_DATA InputData)
29{
31 ULONG InputDataConsumed;
32
33 if (!DeviceExtension->ClassService)
34 return;
35
36 /* sanity check */
37 ASSERT(DeviceExtension->ClassService);
38 ASSERT(DeviceExtension->ClassDeviceObject);
39
40 /* raise irql */
42
43 /* dispatch input data */
44 (*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassService)(DeviceExtension->ClassDeviceObject, InputData, InputData + 1, &InputDataConsumed);
45
46 /* lower irql to previous level */
48}
49
54 IN PCHAR NewScanCodes,
56{
57 KEYBOARD_INPUT_DATA InputData;
59 PKBDHID_DEVICE_EXTENSION DeviceExtension;
60 CHAR Prefix = 0;
61
62 /* get device extension */
63 DeviceExtension = Context;
64
65 for(Index = 0; Index < Length; Index++)
66 {
67 DPRINT("[KBDHID] ScanCode Index %lu ScanCode %x\n", Index, NewScanCodes[Index] & 0xFF);
68
69 /* check if this is E0 or E1 prefix */
70 if (NewScanCodes[Index] == (CHAR)0xE0 || NewScanCodes[Index] == (CHAR)0xE1)
71 {
72 Prefix = NewScanCodes[Index];
73 continue;
74 }
75
76 /* init input data */
77 RtlZeroMemory(&InputData, sizeof(KEYBOARD_INPUT_DATA));
78
79 /* use keyboard unit id */
80 InputData.UnitId = DeviceExtension->KeyboardTypematic.UnitId;
81
82 if (NewScanCodes[Index] & 0x80)
83 {
84 /* scan codes with 0x80 flag are a key break */
85 InputData.Flags |= KEY_BREAK;
86 }
87
88 /* set a prefix if needed */
89 if (Prefix)
90 {
91 InputData.Flags |= (Prefix == (CHAR)0xE0 ? KEY_E0 : KEY_E1);
92 Prefix = 0;
93 }
94
95 /* store key code */
96 InputData.MakeCode = NewScanCodes[Index] & 0x7F;
97
98 /* dispatch scan codes */
100 }
101
102 /* done */
103 return TRUE;
104}
105
106
108NTAPI
111 IN PIRP Irp,
113{
114 PKBDHID_DEVICE_EXTENSION DeviceExtension;
116 ULONG ButtonLength;
117
118 /* get device extension */
119 DeviceExtension = Context;
120
121 if (Irp->IoStatus.Status == STATUS_PRIVILEGE_NOT_HELD ||
122 Irp->IoStatus.Status == STATUS_DEVICE_NOT_CONNECTED ||
123 Irp->IoStatus.Status == STATUS_CANCELLED ||
124 DeviceExtension->StopReadReport)
125 {
126 /* failed to read or should be stopped*/
127 DPRINT1("[KBDHID] ReadCompletion terminating read Status %x\n", Irp->IoStatus.Status);
128
129 /* report no longer active */
130 DeviceExtension->ReadReportActive = FALSE;
131
132 /* request stopping of the report cycle */
133 DeviceExtension->StopReadReport = FALSE;
134
135 /* signal completion event */
136 KeSetEvent(&DeviceExtension->ReadCompletionEvent, 0, 0);
138 }
139
140 //
141 // print out raw report
142 //
143 ASSERT(DeviceExtension->ReportLength >= 9);
144 DPRINT("[KBDHID] ReadCompletion %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", DeviceExtension->Report[0], DeviceExtension->Report[1], DeviceExtension->Report[2],
145 DeviceExtension->Report[3], DeviceExtension->Report[4], DeviceExtension->Report[5],
146 DeviceExtension->Report[6], DeviceExtension->Report[7], DeviceExtension->Report[8]);
147
148
149 /* get current usages */
150 ButtonLength = DeviceExtension->UsageListLength;
153 DeviceExtension->CurrentUsageList,
154 &ButtonLength,
155 DeviceExtension->PreparsedData,
156 DeviceExtension->Report,
157 DeviceExtension->ReportLength);
159
160 /* FIXME check if needs mapping */
161
162 /* get usage difference */
164 DeviceExtension->CurrentUsageList,
165 DeviceExtension->BreakUsageList,
166 DeviceExtension->MakeUsageList,
167 DeviceExtension->UsageListLength);
169
170 /* replace previous usage list with current list */
171 RtlMoveMemory(DeviceExtension->PreviousUsageList,
172 DeviceExtension->CurrentUsageList,
173 sizeof(USAGE_AND_PAGE) * DeviceExtension->UsageListLength);
174
175 /* translate break usage list */
177 DeviceExtension->UsageListLength,
179 &DeviceExtension->ModifierState,
181 DeviceExtension);
183
184 /* translate new usage list */
186 DeviceExtension->UsageListLength,
188 &DeviceExtension->ModifierState,
190 DeviceExtension);
192
193 /* re-init read */
194 KbdHid_InitiateRead(DeviceExtension);
195
196 /* stop completion */
198}
199
202 IN PKBDHID_DEVICE_EXTENSION DeviceExtension)
203{
204 PIO_STACK_LOCATION IoStack;
206
207 /* re-use irp */
208 IoReuseIrp(DeviceExtension->Irp, STATUS_SUCCESS);
209
210 /* init irp */
211 DeviceExtension->Irp->MdlAddress = DeviceExtension->ReportMDL;
212
213 /* get next stack location */
214 IoStack = IoGetNextIrpStackLocation(DeviceExtension->Irp);
215
216 /* init stack location */
217 IoStack->Parameters.Read.Length = DeviceExtension->ReportLength;
218 IoStack->Parameters.Read.Key = 0;
219 IoStack->Parameters.Read.ByteOffset.QuadPart = 0LL;
220 IoStack->MajorFunction = IRP_MJ_READ;
221 IoStack->FileObject = DeviceExtension->FileObject;
222
223 /* set completion routine */
224 IoSetCompletionRoutine(DeviceExtension->Irp, KbdHid_ReadCompletion, DeviceExtension, TRUE, TRUE, TRUE);
225
226 /* read is active */
227 DeviceExtension->ReadReportActive = TRUE;
228
229 /* start the read */
230 Status = IoCallDriver(DeviceExtension->NextDeviceObject, DeviceExtension->Irp);
231
232 /* done */
233 return Status;
234}
235
237NTAPI
240 IN PIRP Irp,
242{
245}
246
247
249NTAPI
252 IN PIRP Irp)
253{
254 PIO_STACK_LOCATION IoStack;
257 PKBDHID_DEVICE_EXTENSION DeviceExtension;
258
259 DPRINT("[KBDHID]: IRP_MJ_CREATE\n");
260
261 /* get device extension */
262 DeviceExtension = DeviceObject->DeviceExtension;
263
264 /* get stack location */
266
267 /* copy stack location to next */
269
270 /* init event */
272
273 /* prepare irp */
275
276 /* call lower driver */
277 Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
278 if (Status == STATUS_PENDING)
279 {
280 /* request pending */
282 }
283
284 /* check for success */
285 if (!NT_SUCCESS(Status))
286 {
287 /* failed */
288 Irp->IoStatus.Status = Status;
290 return Status;
291 }
292
293 /* is the driver already in use */
294 if (DeviceExtension->FileObject == NULL)
295 {
296 /* did the caller specify correct attributes */
297 ASSERT(IoStack->Parameters.Create.SecurityContext);
298 if (IoStack->Parameters.Create.SecurityContext->DesiredAccess)
299 {
300 /* store file object */
301 DeviceExtension->FileObject = IoStack->FileObject;
302
303 /* reset event */
304 KeClearEvent(&DeviceExtension->ReadCompletionEvent);
305
306 /* initiating read */
307 Status = KbdHid_InitiateRead(DeviceExtension);
308 DPRINT("[KBDHID] KbdHid_InitiateRead: status %x\n", Status);
309 if (Status == STATUS_PENDING)
310 {
311 /* report irp is pending */
313 }
314 }
315 }
316
317 /* complete request */
318 Irp->IoStatus.Status = Status;
320 return Status;
321}
322
323
325NTAPI
328 IN PIRP Irp)
329{
330 PKBDHID_DEVICE_EXTENSION DeviceExtension;
331
332 /* get device extension */
333 DeviceExtension = DeviceObject->DeviceExtension;
334
335 DPRINT("[KBDHID] IRP_MJ_CLOSE ReadReportActive %x\n", DeviceExtension->ReadReportActive);
336
337 if (DeviceExtension->ReadReportActive)
338 {
339 /* request stopping of the report cycle */
340 DeviceExtension->StopReadReport = TRUE;
341
342 /* wait until the reports have been read */
344
345 /* cancel irp */
346 IoCancelIrp(DeviceExtension->Irp);
347 }
348
349 DPRINT("[KBDHID] IRP_MJ_CLOSE ReadReportActive %x\n", DeviceExtension->ReadReportActive);
350
351 /* remove file object */
352 DeviceExtension->FileObject = NULL;
353
354 /* skip location */
356
357 /* pass irp to down the stack */
358 return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
359}
360
362NTAPI
365 IN PIRP Irp)
366{
367 PIO_STACK_LOCATION IoStack;
368 PKBDHID_DEVICE_EXTENSION DeviceExtension;
371
372 /* get current stack location */
374
375 DPRINT("[KBDHID] InternalDeviceControl %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
376
377 /* get device extension */
378 DeviceExtension = DeviceObject->DeviceExtension;
379
380 switch (IoStack->Parameters.DeviceIoControl.IoControlCode)
381 {
383 /* verify output buffer length */
384 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_ATTRIBUTES))
385 {
386 /* invalid request */
387 DPRINT1("[KBDHID] IOCTL_KEYBOARD_QUERY_ATTRIBUTES Buffer too small\n");
388 Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
391 }
392
393 /* get output buffer */
394 Attributes = Irp->AssociatedIrp.SystemBuffer;
395
396 /* copy attributes */
398 &DeviceExtension->Attributes,
399 sizeof(KEYBOARD_ATTRIBUTES));
400
401 /* complete request */
402 Irp->IoStatus.Information = sizeof(KEYBOARD_ATTRIBUTES);
403 Irp->IoStatus.Status = STATUS_SUCCESS;
405 return STATUS_SUCCESS;
406
408 /* verify input buffer length */
409 if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA))
410 {
411 /* invalid request */
412 Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
415 }
416
417 /* is it already connected */
418 if (DeviceExtension->ClassService)
419 {
420 /* already connected */
421 Irp->IoStatus.Status = STATUS_SHARING_VIOLATION;
424 }
425
426 /* get connect data */
427 Data = IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
428
429 /* store connect details */
430 DeviceExtension->ClassDeviceObject = Data->ClassDeviceObject;
431 DeviceExtension->ClassService = Data->ClassService;
432
433 /* completed successfully */
434 Irp->IoStatus.Status = STATUS_SUCCESS;
436 return STATUS_SUCCESS;
437
439 /* not implemented */
440 Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
443
445 /* not supported */
446 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
449
451 /* not supported */
452 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
455
457 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS))
458 {
459 /* buffer too small */
460 Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
463 }
464
465 /* copy indicators */
466 RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer,
467 &DeviceExtension->KeyboardIndicator,
469
470 /* complete request */
471 Irp->IoStatus.Status = STATUS_SUCCESS;
472 Irp->IoStatus.Information = sizeof(KEYBOARD_INDICATOR_PARAMETERS);
475
477 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_TYPEMATIC_PARAMETERS))
478 {
479 /* buffer too small */
480 Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
483 }
484
485 /* copy indicators */
486 RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer,
487 &DeviceExtension->KeyboardTypematic,
489
490 /* done */
491 Irp->IoStatus.Status = STATUS_SUCCESS;
492 Irp->IoStatus.Information = sizeof(KEYBOARD_TYPEMATIC_PARAMETERS);
494 return STATUS_SUCCESS;
495
497 if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS))
498 {
499 /* invalid parameter */
500 Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
503 }
504
505 /* copy indicators */
506 RtlCopyMemory(&DeviceExtension->KeyboardIndicator,
507 Irp->AssociatedIrp.SystemBuffer,
509
510 /* done */
511 Irp->IoStatus.Status = STATUS_SUCCESS;
512 Irp->IoStatus.Information = 0;
514 return STATUS_SUCCESS;
515
517 if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_TYPEMATIC_PARAMETERS))
518 {
519 /* invalid parameter */
520 Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
523 }
524
525 /* copy indicators */
526 RtlCopyMemory(&DeviceExtension->KeyboardTypematic,
527 Irp->AssociatedIrp.SystemBuffer,
529
530 /* done */
531 Irp->IoStatus.Status = STATUS_SUCCESS;
532 Irp->IoStatus.Information = 0;
534 return STATUS_SUCCESS;
535
537 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION))
538 {
539 /* buffer too small */
540 Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
543 }
544
545 /* copy translations */
546 RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer,
549
550 /* done */
551 Irp->IoStatus.Status = STATUS_SUCCESS;
552 Irp->IoStatus.Information = sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION);
554 return STATUS_SUCCESS;
555 }
556
557 /* unknown control code */
558 DPRINT1("[KBDHID] Unknown DeviceControl %x\n", IoStack->Parameters.DeviceIoControl.IoControlCode);
559 /* unknown request not supported */
560 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
563}
564
566NTAPI
569 IN PIRP Irp)
570{
571 PKBDHID_DEVICE_EXTENSION DeviceExtension;
572
573 /* get device extension */
574 DeviceExtension = DeviceObject->DeviceExtension;
575
576 /* skip stack location */
578
579 /* pass and forget */
580 return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
581}
582
584NTAPI
587 IN PIRP Irp)
588{
589 PKBDHID_DEVICE_EXTENSION DeviceExtension;
590
591 DeviceExtension = DeviceObject->DeviceExtension;
594 return PoCallDriver(DeviceExtension->NextDeviceObject, Irp);
595}
596
598NTAPI
601 IN PIRP Irp)
602{
603 PKBDHID_DEVICE_EXTENSION DeviceExtension;
604
605 DeviceExtension = DeviceObject->DeviceExtension;
607 return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
608}
609
614 ULONG InputBufferSize,
616 ULONG OutputBufferSize,
618{
620 PKBDHID_DEVICE_EXTENSION DeviceExtension;
621 PIRP Irp;
624
625 /* get device extension */
626 DeviceExtension = DeviceObject->DeviceExtension;
627
628 /* init event */
630
631 /* build request */
633 DeviceExtension->NextDeviceObject,
635 InputBufferSize,
637 OutputBufferSize,
638 FALSE,
639 &Event,
640 &IoStatus);
641 if (!Irp)
642 {
643 /* no memory */
645 }
646
647 /* send request */
648 Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
649 if (Status == STATUS_PENDING)
650 {
651 /* wait for request to complete */
653 Status = IoStatus.Status;
654 }
655
656 /* done */
657 return Status;
658}
659
661NTAPI
664{
670 PKBDHID_DEVICE_EXTENSION DeviceExtension;
672
673 /* get device extension */
674 DeviceExtension = DeviceObject->DeviceExtension;
675
676 /* query collection information */
679 0,
680 NULL,
682 &Information);
683 if (!NT_SUCCESS(Status))
684 {
685 /* failed to query collection information */
686 DPRINT1("[KBDHID] failed to obtain collection information with %x\n", Status);
687 return Status;
688 }
689
690 /* lets allocate space for preparsed data */
692 if (!PreparsedData)
693 {
694 /* no memory */
695 DPRINT1("[KBDHID] no memory size %u\n", Information.DescriptorSize);
697 }
698
699 /* now obtain the preparsed data */
702 0,
703 NULL,
704 Information.DescriptorSize,
706 if (!NT_SUCCESS(Status))
707 {
708 /* failed to get preparsed data */
709 DPRINT1("[KBDHID] failed to obtain collection information with %x\n", Status);
711 return Status;
712 }
713
714 /* lets get the caps */
717 {
718 /* failed to get capabilities */
719 DPRINT1("[KBDHID] failed to obtain caps with %x\n", Status);
721 return Status;
722 }
723
724 DPRINT("[KBDHID] Usage %x UsagePage %x InputReportLength %lu\n", Capabilities.Usage, Capabilities.UsagePage, Capabilities.InputReportByteLength);
725
726 /* init input report */
728 ASSERT(DeviceExtension->ReportLength);
729 DeviceExtension->Report = ExAllocatePoolWithTag(NonPagedPool, DeviceExtension->ReportLength, KBDHID_TAG);
730 ASSERT(DeviceExtension->Report);
731 RtlZeroMemory(DeviceExtension->Report, DeviceExtension->ReportLength);
732
733 /* build mdl */
734 DeviceExtension->ReportMDL = IoAllocateMdl(DeviceExtension->Report,
735 DeviceExtension->ReportLength,
736 FALSE,
737 FALSE,
738 NULL);
739 ASSERT(DeviceExtension->ReportMDL);
740
741 /* init mdl */
742 MmBuildMdlForNonPagedPool(DeviceExtension->ReportMDL);
743
744 /* get max number of buttons */
746 DPRINT("[KBDHID] Buttons %lu\n", Buttons);
747 ASSERT(Buttons > 0);
748
749 /* now allocate an array for those buttons */
751 if (!Buffer)
752 {
753 /* no memory */
756 }
757 DeviceExtension->UsageListBuffer = Buffer;
758
759 /* init usage lists */
761 DeviceExtension->CurrentUsageList = Buffer;
762 Buffer += Buttons;
763 DeviceExtension->PreviousUsageList = Buffer;
764 Buffer += Buttons;
765 DeviceExtension->MakeUsageList = Buffer;
766 Buffer += Buttons;
767 DeviceExtension->BreakUsageList = Buffer;
768
769 //
770 // FIMXE: implement device hacks
771 //
772 // UsageMappings
773 // KeyboardTypeOverride
774 // KeyboardSubTypeOverride
775 // KeyboardNumberTotalKeysOverride
776 // KeyboardNumberFunctionKeysOverride
777 // KeyboardNumberIndicatorsOverride
778
779 /* store number of buttons */
780 DeviceExtension->UsageListLength = (USHORT)Buttons;
781
782 /* store preparsed data */
783 DeviceExtension->PreparsedData = PreparsedData;
784
785 /* completed successfully */
786 return STATUS_SUCCESS;
787}
788
790NTAPI
793 IN PIRP Irp,
795{
798}
799
801NTAPI
804{
805 PKBDHID_DEVICE_EXTENSION DeviceExtension;
806
807 /* get device extension */
808 DeviceExtension = DeviceObject->DeviceExtension;
809
810 /* free resources */
811 if (DeviceExtension->PreparsedData)
812 {
813 ExFreePoolWithTag(DeviceExtension->PreparsedData, KBDHID_TAG);
814 DeviceExtension->PreparsedData = NULL;
815 }
816
817 if (DeviceExtension->UsageListBuffer)
818 {
820 DeviceExtension->UsageListBuffer = NULL;
821 DeviceExtension->CurrentUsageList = NULL;
822 DeviceExtension->PreviousUsageList = NULL;
823 DeviceExtension->MakeUsageList = NULL;
824 DeviceExtension->BreakUsageList = NULL;
825 }
826
827 if (DeviceExtension->ReportMDL)
828 {
829 IoFreeMdl(DeviceExtension->ReportMDL);
830 DeviceExtension->ReportMDL = NULL;
831 }
832
833 if (DeviceExtension->Report)
834 {
835 ExFreePoolWithTag(DeviceExtension->Report, KBDHID_TAG);
836 DeviceExtension->Report = NULL;
837 }
838
839 return STATUS_SUCCESS;
840}
841
843NTAPI
846 IN PIRP Irp)
847{
848 PIO_STACK_LOCATION IoStack;
849 PKBDHID_DEVICE_EXTENSION DeviceExtension;
850
851 /* get device extension */
852 DeviceExtension = DeviceObject->DeviceExtension;
853
854 /* skip current stack location */
856
857 /* get next stack location */
859
860 /* change request to hid flush queue request */
862 IoStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_HID_FLUSH_QUEUE;
863
864 /* call device */
865 return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
866}
867
869NTAPI
872 IN PIRP Irp)
873{
874 PIO_STACK_LOCATION IoStack;
877 PKBDHID_DEVICE_EXTENSION DeviceExtension;
878
879 /* get device extension */
880 DeviceExtension = DeviceObject->DeviceExtension;
881
882 /* get current irp stack */
884 DPRINT("[KBDHID] IRP_MJ_PNP Request: %x\n", IoStack->MinorFunction);
885
886 switch (IoStack->MinorFunction)
887 {
890 /* free resources */
892 /* fall through */
897 /* indicate success */
898 Irp->IoStatus.Status = STATUS_SUCCESS;
899
900 /* skip irp stack location */
902
903 /* dispatch to lower device */
904 return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
905
907 /* FIXME synchronization */
908
909 /* cancel irp */
910 IoCancelIrp(DeviceExtension->Irp);
911
912 /* free resources */
914
915 /* indicate success */
916 Irp->IoStatus.Status = STATUS_SUCCESS;
917
918 /* skip irp stack location */
920
921 /* dispatch to lower device */
922 Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
923
924 IoFreeIrp(DeviceExtension->Irp);
925 IoDetachDevice(DeviceExtension->NextDeviceObject);
927 return Status;
928
930 /* init event */
932
933 /* copy stack location */
935
936 /* set completion routine */
938 Irp->IoStatus.Status = 0;
939
940 /* pass request */
941 Status = IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
942 if (Status == STATUS_PENDING)
943 {
945 Status = Irp->IoStatus.Status;
946 }
947
948 if (!NT_SUCCESS(Status))
949 {
950 /* failed */
951 Irp->IoStatus.Status = Status;
953 return Status;
954 }
955
956 /* lets start the device */
958 DPRINT("KbdHid_StartDevice %x\n", Status);
959
960 /* complete request */
961 Irp->IoStatus.Status = Status;
963
964 /* done */
965 return Status;
966
967 default:
968 /* skip irp stack location */
970
971 /* dispatch to lower device */
972 return IoCallDriver(DeviceExtension->NextDeviceObject, Irp);
973 }
974}
975
977NTAPI
981{
984 PKBDHID_DEVICE_EXTENSION DeviceExtension;
986
987 /* create device object */
990 NULL,
992 0,
993 FALSE,
994 &DeviceObject);
995 if (!NT_SUCCESS(Status))
996 {
997 /* failed to create device object */
998 return Status;
999 }
1000
1001 /* now attach it */
1003 if (!NextDeviceObject)
1004 {
1005 /* failed to attach */
1008 }
1009
1010 /* get device extension */
1011 DeviceExtension = DeviceObject->DeviceExtension;
1012
1013 /* zero extension */
1014 RtlZeroMemory(DeviceExtension, sizeof(KBDHID_DEVICE_EXTENSION));
1015
1016 /* init device extension */
1017 DeviceExtension->NextDeviceObject = NextDeviceObject;
1019
1020 /* init keyboard attributes */
1024 DeviceExtension->Attributes.NumberOfIndicators = 3; // caps, num lock, scroll lock
1025 DeviceExtension->Attributes.NumberOfKeysTotal = 101;
1026 DeviceExtension->Attributes.InputDataQueueLength = 1;
1031
1032 /* allocate irp */
1033 DeviceExtension->Irp = IoAllocateIrp(NextDeviceObject->StackSize, FALSE);
1034
1035 /* FIXME handle allocation error */
1036 ASSERT(DeviceExtension->Irp);
1037
1038 /* set power state to D0 */
1039 State.DeviceState = PowerDeviceD0;
1041
1042 /* init device object */
1044 DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
1045
1046 /* completed successfully */
1047 return STATUS_SUCCESS;
1048}
1049
1050VOID
1051NTAPI
1054{
1056}
1057
1058
1060NTAPI
1063 IN PUNICODE_STRING RegPath)
1064{
1065 /* initialize driver object */
1066 DriverObject->MajorFunction[IRP_MJ_CREATE] = KbdHid_Create;
1067 DriverObject->MajorFunction[IRP_MJ_CLOSE] = KbdHid_Close;
1071 DriverObject->MajorFunction[IRP_MJ_POWER] = KbdHid_Power;
1072 DriverObject->MajorFunction[IRP_MJ_PNP] = KbdHid_Pnp;
1074 DriverObject->DriverUnload = KbdHid_Unload;
1075 DriverObject->DriverExtension->AddDevice = KbdHid_AddDevice;
1076
1077 /* done */
1078 return STATUS_SUCCESS;
1079}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define CHAR(Char)
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
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 STATUS_PENDING
Definition: d3dkmdt.h:43
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
#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:33
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_GetCaps(IN PHIDP_PREPARSED_DATA PreparsedData, OUT PHIDP_CAPS Capabilities)
Definition: hidp.c:26
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:176
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:161
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
@ HidP_Input
Definition: hidpi.h:238
@ HidP_Keyboard_Break
Definition: hidpi.h:48
@ HidP_Keyboard_Make
Definition: hidpi.h:49
_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)
struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA
Definition: hidpi.h:39
#define HID_USAGE_PAGE_KEYBOARD
Definition: hidusage.h:181
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
NTSTATUS NTAPI KbdHid_DeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:567
NTSTATUS NTAPI KbdHid_FreeResources(IN PDEVICE_OBJECT DeviceObject)
Definition: kbdhid.c:802
NTSTATUS NTAPI KbdHid_ReadCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: kbdhid.c:109
NTSTATUS NTAPI KbdHid_Power(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:585
NTSTATUS NTAPI KbdHid_StartDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: kbdhid.c:662
struct _LOCAL_KEYBOARD_INDICATOR_TRANSLATION LOCAL_KEYBOARD_INDICATOR_TRANSLATION
NTSTATUS NTAPI KbdHid_StartDeviceCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: kbdhid.c:791
struct _LOCAL_KEYBOARD_INDICATOR_TRANSLATION * PLOCAL_KEYBOARD_INDICATOR_TRANSLATION
VOID KbdHid_DispatchInputData(IN PKBDHID_DEVICE_EXTENSION DeviceExtension, IN PKEYBOARD_INPUT_DATA InputData)
Definition: kbdhid.c:26
NTSTATUS NTAPI KbdHid_InternalDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:363
BOOLEAN NTAPI KbdHid_InsertScanCodes(IN PVOID Context, IN PCHAR NewScanCodes, IN ULONG Length)
Definition: kbdhid.c:52
NTSTATUS NTAPI KbdHid_Flush(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:844
NTSTATUS NTAPI KbdHid_CreateCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: kbdhid.c:238
NTSTATUS NTAPI KbdHid_Create(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:250
NTSTATUS NTAPI KbdHid_Close(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:326
NTSTATUS KbdHid_SubmitRequest(PDEVICE_OBJECT DeviceObject, ULONG IoControlCode, ULONG InputBufferSize, PVOID InputBuffer, ULONG OutputBufferSize, PVOID OutputBuffer)
Definition: kbdhid.c:611
NTSTATUS NTAPI KbdHid_Pnp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:870
NTSTATUS NTAPI KbdHid_SystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: kbdhid.c:599
VOID NTAPI KbdHid_Unload(IN PDRIVER_OBJECT DriverObject)
Definition: kbdhid.c:1052
static LOCAL_KEYBOARD_INDICATOR_TRANSLATION IndicatorTranslation
Definition: kbdhid.c:19
NTSTATUS NTAPI KbdHid_AddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
Definition: kbdhid.c:978
NTSTATUS KbdHid_InitiateRead(IN PKBDHID_DEVICE_EXTENSION DeviceExtension)
Definition: kbdhid.c:201
#define KEYBOARD_TYPEMATIC_DELAY_MINIMUM
Definition: kbdhid.h:134
#define KEYBOARD_TYPE_UNKNOWN
Definition: kbdhid.h:140
#define MICROSOFT_KBD_FUNC
Definition: kbdhid.h:139
#define MICROSOFT_KBD_101_TYPE
Definition: kbdhid.h:141
#define KEYBOARD_TYPEMATIC_DELAY_MAXIMUM
Definition: kbdhid.h:135
#define KEYBOARD_TYPEMATIC_RATE_MINIMUM
Definition: kbdhid.h:131
#define KBDHID_TAG
Definition: kbdhid.h:148
#define KEYBOARD_TYPEMATIC_RATE_DEFAULT
Definition: kbdhid.h:133
#define IOCTL_INTERNAL_KEYBOARD_ENABLE
Definition: kbdmou.h:62
#define IOCTL_INTERNAL_KEYBOARD_DISABLE
Definition: kbdmou.h:65
#define IOCTL_INTERNAL_KEYBOARD_CONNECT
Definition: kbdmou.h:56
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_KEYBOARD_DISCONNECT
Definition: kbdmou.h:59
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
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
#define IOCTL_KEYBOARD_QUERY_TYPEMATIC
Definition: ntddkbd.h:41
#define KEYBOARD_CAPS_LOCK_ON
Definition: ntddkbd.h:81
struct _KEYBOARD_TYPEMATIC_PARAMETERS KEYBOARD_TYPEMATIC_PARAMETERS
#define KEY_BREAK
Definition: ntddkbd.h:71
#define IOCTL_KEYBOARD_QUERY_INDICATORS
Definition: ntddkbd.h:35
#define IOCTL_KEYBOARD_SET_INDICATORS
Definition: ntddkbd.h:47
#define IOCTL_KEYBOARD_QUERY_ATTRIBUTES
Definition: ntddkbd.h:32
#define IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION
Definition: ntddkbd.h:38
#define KEYBOARD_SCROLL_LOCK_ON
Definition: ntddkbd.h:83
#define IOCTL_KEYBOARD_SET_TYPEMATIC
Definition: ntddkbd.h:44
struct _KEYBOARD_ATTRIBUTES KEYBOARD_ATTRIBUTES
#define KEY_E1
Definition: ntddkbd.h:73
struct _KEYBOARD_INDICATOR_PARAMETERS KEYBOARD_INDICATOR_PARAMETERS
#define KEY_E0
Definition: ntddkbd.h:72
#define KEYBOARD_NUM_LOCK_ON
Definition: ntddkbd.h:82
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
@ 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
unsigned short USHORT
Definition: pedump.c:61
#define FILE_DEVICE_KEYBOARD
Definition: winioctl.h:56
#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:73
PDEVICE_OBJECT ClassDeviceObject
Definition: kbdhid.h:36
PDEVICE_OBJECT NextDeviceObject
Definition: kbdhid.h:21
USHORT UsageListLength
Definition: kbdhid.h:51
KEYBOARD_TYPEMATIC_PARAMETERS KeyboardTypematic
Definition: kbdhid.h:126
PUSAGE_AND_PAGE PreviousUsageList
Definition: kbdhid.h:61
KEVENT ReadCompletionEvent
Definition: kbdhid.h:31
PUSAGE_AND_PAGE CurrentUsageList
Definition: kbdhid.h:56
PUSAGE_AND_PAGE MakeUsageList
Definition: kbdhid.h:71
PUSAGE_AND_PAGE BreakUsageList
Definition: kbdhid.h:66
PHIDP_PREPARSED_DATA PreparsedData
Definition: kbdhid.h:76
PFILE_OBJECT FileObject
Definition: kbdhid.h:96
KEYBOARD_INDICATOR_PARAMETERS KeyboardIndicator
Definition: kbdhid.h:121
HIDP_KEYBOARD_MODIFIER_STATE ModifierState
Definition: kbdhid.h:116
KEYBOARD_ATTRIBUTES Attributes
Definition: kbdhid.h:111
USAGE UsagePage
Definition: hidpi.h:151
USHORT InputReportByteLength
Definition: hidpi.h:152
USAGE Usage
Definition: hidpi.h:150
struct _IO_STACK_LOCATION::@1580::@1581 DeviceIoControl
struct _IO_STACK_LOCATION::@3979::@3983 Read
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
union _IO_STACK_LOCATION::@1580 Parameters
struct _IO_STACK_LOCATION::@3979::@3980 Create
KEYBOARD_ID KeyboardIdentifier
Definition: ntddkbd.h:124
KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMaximum
Definition: ntddkbd.h:131
ULONG InputDataQueueLength
Definition: ntddkbd.h:129
USHORT NumberOfKeysTotal
Definition: ntddkbd.h:128
USHORT NumberOfIndicators
Definition: ntddkbd.h:127
KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMinimum
Definition: ntddkbd.h:130
USHORT NumberOfFunctionKeys
Definition: ntddkbd.h:126
UCHAR Subtype
Definition: ntddkbd.h:102
UCHAR Type
Definition: ntddkbd.h:101
INDICATOR_LIST IndicatorList[3]
Definition: kbdhid.c:16
#define LL
Definition: tui.h:167
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
#define STATUS_DEVICE_NOT_CONNECTED
Definition: udferr_usr.h:160
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#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
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
#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
_In_ __drv_aliasesMem PSTRING Prefix
Definition: rtlfuncs.h:1647
char CHAR
Definition: xmlstorage.h:175