ReactOS 0.4.17-dev-1421-g4623072
pdo.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Universal Serial Bus Human Interface Device Driver
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/hid/hidclass/fdo.c
5 * PURPOSE: HID Class Driver
6 * PROGRAMMERS:
7 * Michael Martin (michael.martin@reactos.org)
8 * Johannes Anderwald (johannes.anderwald@reactos.org)
9 */
10
11#include "precomp.h"
12
13#include <wdmguid.h>
14
15#define NDEBUG
16#include <debug.h>
17
21 ULONG CollectionNumber)
22{
24
25 for(Index = 0; Index < DeviceDescription->CollectionDescLength; Index++)
26 {
27 if (DeviceDescription->CollectionDesc[Index].CollectionNumber == CollectionNumber)
28 {
29 //
30 // found collection
31 //
32 return &DeviceDescription->CollectionDesc[Index];
33 }
34 }
35
36 //
37 // failed to find collection
38 //
39 DPRINT1("[HIDCLASS] GetCollectionDescription CollectionNumber %x not found\n", CollectionNumber);
41 return NULL;
42}
43
47 ULONG CollectionNumber)
48{
50
51 for (Index = 0; Index < DeviceDescription->ReportIDsLength; Index++)
52 {
53 if (DeviceDescription->ReportIDs[Index].CollectionNumber == CollectionNumber)
54 {
55 //
56 // found collection
57 //
58 return &DeviceDescription->ReportIDs[Index];
59 }
60 }
61
62 //
63 // failed to find collection
64 //
65 DPRINT1("[HIDCLASS] GetReportDescription CollectionNumber %x not found\n", CollectionNumber);
67 return NULL;
68}
69
74{
76
77 for (Index = 0; Index < DeviceDescription->ReportIDsLength; Index++)
78 {
79 if (DeviceDescription->ReportIDs[Index].ReportID == ReportID)
80 {
81 //
82 // found report id
83 //
84 return &DeviceDescription->ReportIDs[Index];
85 }
86 }
87
88 //
89 // failed to find report id
90 //
91 DPRINT1("[HIDCLASS] GetReportDescriptionByReportID ReportID %x not found\n", ReportID);
93 return NULL;
94}
95
96static
99 _In_ PWSTR HardwareIds,
101 _In_ BOOLEAN MultiString)
102{
103 ULONG Size = 0;
104 PWSTR p, p2, Buffer;
105
106 for (p = HardwareIds; *p; p += wcslen(p) + 1)
107 {
108 Size += wcslen(p) + 9;
109 if (!MultiString)
110 break;
111 }
112
114 if (!Buffer)
115 return NULL;
116
117 for (p = HardwareIds; *p; )
118 {
119 RtlCopyMemory(p2, L"HID", 6);
120 p2 += 3;
121 while (*p != L'\\')
122 ++p;
123 for (; *p != UNICODE_NULL; ++p, ++p2)
124 *p2 = *p;
125 if (InterfaceNumber > 0)
126 p2 += _swprintf(p2, L"&Col%02x", InterfaceNumber);
127 if (!MultiString)
128 break;
129 *p2 = UNICODE_NULL;
130 ++p2;
131 ++p;
132 }
133 *p2 = UNICODE_NULL;
134 ++p2;
135
136 ExFreePool(HardwareIds);
137 return Buffer;
138}
139
143 IN PIRP Irp)
144{
145 PHIDCLASS_PDO_DEVICE_EXTENSION PDODeviceExtension;
147
148 //
149 // get device extension
150 //
151 PDODeviceExtension = DeviceObject->DeviceExtension;
152 ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
153
154 //
155 // copy current stack location
156 //
158
159 //
160 // call mini-driver
161 //
163 if (!NT_SUCCESS(Status))
164 {
165 //
166 // failed
167 //
168 return Status;
169 }
170
171 //
172 // get buffer
173 //
174 Irp->IoStatus.Information = (ULONG_PTR)HidClassPDO_AppendInterfaceNumber((PWSTR)Irp->IoStatus.Information, PDODeviceExtension->CollectionNumber, FALSE);
175
176 //
177 // store result
178 //
179 return STATUS_SUCCESS;
180}
181
185 IN PIRP Irp)
186{
188 PHIDCLASS_PDO_DEVICE_EXTENSION PDODeviceExtension;
189 WCHAR Buffer[200];
190 ULONG Offset = 0;
191 LPWSTR Ptr;
192 PHIDP_COLLECTION_DESC CollectionDescription;
193
194 //
195 // get device extension
196 //
197 PDODeviceExtension = DeviceObject->DeviceExtension;
198 ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
199
200 //
201 // copy current stack location
202 //
204
205 //
206 // call mini-driver
207 //
209 if (!NT_SUCCESS(Status))
210 {
211 //
212 // failed
213 //
214 return Status;
215 }
216
217 //
218 // append collection number (if required)
219 //
220 Irp->IoStatus.Information = (ULONG_PTR)HidClassPDO_AppendInterfaceNumber((PWSTR)Irp->IoStatus.Information, PDODeviceExtension->CollectionNumber, TRUE);
221 for (Ptr = (PWSTR)Irp->IoStatus.Information; *Ptr; Ptr += wcslen(Ptr) + 1)
222 ;
223 Offset = Ptr - (PCWSTR)Irp->IoStatus.Information;
224 RtlCopyMemory(Buffer, (PCWSTR)Irp->IoStatus.Information, Offset * sizeof(WCHAR));
225
226 //
227 // get collection description
228 //
229 CollectionDescription = HidClassPDO_GetCollectionDescription(&PDODeviceExtension->Common.DeviceDescription, PDODeviceExtension->CollectionNumber);
230 ASSERT(CollectionDescription);
231
232 if (CollectionDescription->UsagePage == HID_USAGE_PAGE_GENERIC)
233 {
234 switch (CollectionDescription->Usage)
235 {
238 //
239 // Pointer / Mouse
240 //
241 Offset += _swprintf(&Buffer[Offset], L"HID_DEVICE_SYSTEM_MOUSE") + 1;
242 break;
245 //
246 // Joystick / Gamepad
247 //
248 Offset += _swprintf(&Buffer[Offset], L"HID_DEVICE_SYSTEM_GAME") + 1;
249 break;
252 //
253 // Keyboard / Keypad
254 //
255 Offset += _swprintf(&Buffer[Offset], L"HID_DEVICE_SYSTEM_KEYBOARD") + 1;
256 break;
258 //
259 // System Control
260 //
261 Offset += _swprintf(&Buffer[Offset], L"HID_DEVICE_SYSTEM_CONTROL") + 1;
262 break;
263 }
264 }
265 else if (CollectionDescription->UsagePage == HID_USAGE_PAGE_CONSUMER && CollectionDescription->Usage == HID_USAGE_CONSUMERCTRL)
266 {
267 //
268 // Consumer Audio Control
269 //
270 Offset += _swprintf(&Buffer[Offset], L"HID_DEVICE_SYSTEM_CONSUMER") + 1;
271 }
272
273 //
274 // add HID_DEVICE_UP:0001_U:0002'
275 //
276 Offset += _swprintf(&Buffer[Offset], L"HID_DEVICE_UP:%04X_U:%04X", CollectionDescription->UsagePage, CollectionDescription->Usage) + 1;
277
278 //
279 // add HID
280 //
281 Offset += _swprintf(&Buffer[Offset], L"HID_DEVICE") + 1;
282
283 //
284 // free old buffer
285 //
286 ExFreePoolWithTag((PVOID)Irp->IoStatus.Information, 0);
287
288 //
289 // allocate buffer
290 //
292 if (!Ptr)
293 {
294 //
295 // no memory
296 //
297 Irp->IoStatus.Information = 0;
299 }
300
301 //
302 // copy buffer
303 //
304 RtlCopyMemory(Ptr, Buffer, Offset * sizeof(WCHAR));
306
307 //
308 // store result
309 //
310 Irp->IoStatus.Information = (ULONG_PTR)Ptr;
311 return STATUS_SUCCESS;
312}
313
317 IN PIRP Irp)
318{
320 PHIDCLASS_PDO_DEVICE_EXTENSION PDODeviceExtension;
321
322 //
323 // get device extension
324 //
325 PDODeviceExtension = DeviceObject->DeviceExtension;
326 ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
327
328 //
329 // allocate buffer
330 //
332 if (!Buffer)
333 {
334 //
335 // failed
336 //
338 }
339
340 //
341 // write device id
342 //
343 _swprintf(Buffer, L"%04x", PDODeviceExtension->InstanceID);
344 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
345
346 //
347 // done
348 //
349 return STATUS_SUCCESS;
350}
351
355 IN PIRP Irp)
356{
358
360 if (!Buffer)
361 {
362 //
363 // no memory
364 //
366 }
367
368 //
369 // zero buffer
370 //
371 Buffer[0] = 0;
372 Buffer[1] = 0;
373
374 //
375 // store result
376 //
377 Irp->IoStatus.Information = (ULONG_PTR)Buffer;
378 return STATUS_SUCCESS;
379}
380
384 IN PIRP Irp)
385{
386 PHIDCLASS_PDO_DEVICE_EXTENSION PDODeviceExtension;
387 PIO_STACK_LOCATION IoStack;
390 PDEVICE_RELATIONS DeviceRelation;
391 ULONG Index, bFound;
392
393 //
394 // get device extension
395 //
396 PDODeviceExtension = DeviceObject->DeviceExtension;
397 ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
398
399 //
400 // get current irp stack location
401 //
403
404 //
405 // handle request
406 //
407 switch (IoStack->MinorFunction)
408 {
409 case IRP_MN_QUERY_ID:
410 {
411 if (IoStack->Parameters.QueryId.IdType == BusQueryDeviceID)
412 {
413 //
414 // handle query device id
415 //
417 break;
418 }
419 else if (IoStack->Parameters.QueryId.IdType == BusQueryHardwareIDs)
420 {
421 //
422 // handle instance id
423 //
425 break;
426 }
427 else if (IoStack->Parameters.QueryId.IdType == BusQueryInstanceID)
428 {
429 //
430 // handle instance id
431 //
433 break;
434 }
435 else if (IoStack->Parameters.QueryId.IdType == BusQueryCompatibleIDs)
436 {
437 //
438 // handle instance id
439 //
441 break;
442 }
443
444 DPRINT1("[HIDCLASS]: IRP_MN_QUERY_ID IdType %x unimplemented\n", IoStack->Parameters.QueryId.IdType);
446 Irp->IoStatus.Information = 0;
447 break;
448 }
450 {
451 if (IoStack->Parameters.DeviceCapabilities.Capabilities == NULL)
452 {
453 //
454 // invalid request
455 //
457 break;
458 }
459
460 //
461 // copy capabilities
462 //
463 RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities,
464 &PDODeviceExtension->Capabilities,
465 sizeof(DEVICE_CAPABILITIES));
466
467 //
468 // override some capabilities
469 //
470 IoStack->Parameters.DeviceCapabilities.Capabilities->Removable = FALSE;
471 IoStack->Parameters.DeviceCapabilities.Capabilities->SilentInstall = TRUE;
472 IoStack->Parameters.DeviceCapabilities.Capabilities->SurpriseRemovalOK = TRUE;
473 IoStack->Parameters.DeviceCapabilities.Capabilities->RawDeviceOK = !PDODeviceExtension->IsKeyboardOrMouse;
474
476 break;
477 }
479 {
480 //
481 //
482 //
484
485 //
486 // fill in result
487 //
488 RtlCopyMemory(&BusInformation->BusTypeGuid, &GUID_BUS_TYPE_HID, sizeof(GUID));
489 BusInformation->LegacyBusType = PNPBus;
490 BusInformation->BusNumber = 0; //FIXME
491
492 //
493 // store result
494 //
495 Irp->IoStatus.Information = (ULONG_PTR)BusInformation;
497 break;
498 }
500 {
501 //
502 // FIXME set flags when driver fails / disabled
503 //
505 break;
506 }
508 {
509 //
510 // only target relations are supported
511 //
513 {
514 //
515 // not supported
516 //
517 Status = Irp->IoStatus.Status;
518 break;
519 }
520
521 //
522 // allocate device relations
523 //
525 if (!DeviceRelation)
526 {
527 //
528 // no memory
529 //
531 break;
532 }
533
534 //
535 // init device relation
536 //
537 DeviceRelation->Count = 1;
538 DeviceRelation->Objects[0] = DeviceObject;
539 ObReferenceObject(DeviceRelation->Objects[0]);
540
541 //
542 // store result
543 //
544 Irp->IoStatus.Information = (ULONG_PTR)DeviceRelation;
546 break;
547 }
549 {
550 //
551 // FIXME: support polled devices
552 //
553 ASSERT(PDODeviceExtension->Common.DriverExtension->DevicesArePolled == FALSE);
554
555 if (!PDODeviceExtension->IsKeyboardOrMouse)
556 {
557 //
558 // now register the device interface
559 //
561 &GUID_DEVINTERFACE_HID,
562 NULL,
563 &PDODeviceExtension->DeviceInterface);
564 DPRINT("[HIDCLASS] IoRegisterDeviceInterfaceState Status %x\n", Status);
565 if (NT_SUCCESS(Status))
566 {
567 //
568 // enable device interface
569 //
570 Status = IoSetDeviceInterfaceState(&PDODeviceExtension->DeviceInterface, TRUE);
571 DPRINT("[HIDCLASS] IoSetDeviceInterFaceState %x\n", Status);
572 }
573 }
574
575 //
576 // done
577 //
579 break;
580 }
582 {
583 /* Disable the device interface */
584 if (PDODeviceExtension->DeviceInterface.Length != 0)
585 IoSetDeviceInterfaceState(&PDODeviceExtension->DeviceInterface, FALSE);
586
587 //
588 // remove us from the fdo's pdo list
589 //
590 bFound = FALSE;
591 for (Index = 0; Index < PDODeviceExtension->FDODeviceExtension->DeviceRelations->Count; Index++)
592 {
593 if (PDODeviceExtension->FDODeviceExtension->DeviceRelations->Objects[Index] == DeviceObject)
594 {
595 //
596 // remove us
597 //
598 bFound = TRUE;
599 PDODeviceExtension->FDODeviceExtension->DeviceRelations->Objects[Index] = NULL;
600 break;
601 }
602 }
603
604 /* Complete the IRP */
605 Irp->IoStatus.Status = STATUS_SUCCESS;
607
608 if (bFound)
609 {
610 /* Delete our device object*/
612 }
613
614 return STATUS_SUCCESS;
615 }
617 {
618 //
619 // return error default
620 //
621 Status = Irp->IoStatus.Status;
622
623 //
624 // check for known interfaces
625 //
626 if (IsEqualGUIDAligned(IoStack->Parameters.QueryInterface.InterfaceType,
627 &GUID_HID_INTERFACE_NOTIFY))
628 {
629 PHID_INTERFACE_NOTIFY_PNP HidInterfaceNotify = (PHID_INTERFACE_NOTIFY_PNP)IoStack->Parameters.QueryInterface.Interface;
630 if (IoStack->Parameters.QueryInterface.Size == sizeof(*HidInterfaceNotify) &&
631 IoStack->Parameters.QueryInterface.Version == 1)
632 {
633 DPRINT1("[HIDCLASS] PDO IRP_MN_QUERY_INTERFACE/GUID_HID_INTERFACE_NOTIFY not implemented\n");
634 ASSERT(FALSE);
635 }
636 }
637 else if (IsEqualGUIDAligned(IoStack->Parameters.QueryInterface.InterfaceType,
638 &GUID_HID_INTERFACE_HIDPARSE))
639 {
640 PHID_INTERFACE_HIDPARSE HidInterfaceHidparse = (PHID_INTERFACE_HIDPARSE)IoStack->Parameters.QueryInterface.Interface;
641 if (IoStack->Parameters.QueryInterface.Size == sizeof(*HidInterfaceHidparse) &&
642 IoStack->Parameters.QueryInterface.Version == 1)
643 {
644 HidInterfaceHidparse->HidpGetCaps = HidP_GetCaps;
646 }
647 }
648 break;
649 }
654 {
655 //
656 // no/op
657 //
658#if 0
660#else
661 DPRINT1("Denying removal of HID device due to IRP cancellation bugs\n");
663#endif
664 break;
665 }
666 default:
667 {
668 //
669 // do nothing
670 //
671 Status = Irp->IoStatus.Status;
672 break;
673 }
674 }
675
676 //
677 // complete request
678 //
679 if (Status != STATUS_PENDING)
680 {
681 //
682 // store result
683 //
684 Irp->IoStatus.Status = Status;
685
686 //
687 // complete request
688 //
690 }
691
692 //
693 // done processing
694 //
695 return Status;
696}
697
701 OUT PDEVICE_RELATIONS *OutDeviceRelations)
702{
703 PHIDCLASS_FDO_EXTENSION FDODeviceExtension;
705 PDEVICE_OBJECT PDODeviceObject;
706 PHIDCLASS_PDO_DEVICE_EXTENSION PDODeviceExtension;
707 PHIDP_COLLECTION_DESC CollectionDescription;
708 ULONG Index;
709 PDEVICE_RELATIONS DeviceRelations;
711
712 //
713 // get device extension
714 //
715 FDODeviceExtension = DeviceObject->DeviceExtension;
716 ASSERT(FDODeviceExtension->Common.IsFDO);
717
718 //
719 // first allocate device relations
720 //
723 if (!DeviceRelations)
724 {
725 //
726 // no memory
727 //
729 }
730
731 //
732 // zero device relations
733 //
734 RtlZeroMemory(DeviceRelations, Length);
735
736 //
737 // let's create a PDO for top level collection
738 //
739 Index = 0;
740 while (Index < FDODeviceExtension->Common.DeviceDescription.CollectionDescLength)
741 {
742 //
743 // let's create the device object
744 //
747 NULL,
750 FALSE,
751 &PDODeviceObject);
752 if (!NT_SUCCESS(Status))
753 {
754 //
755 // failed to create device
756 //
757 DPRINT1("[HIDCLASS] Failed to create PDO %x\n", Status);
758 break;
759 }
760
761 //
762 // patch stack size
763 //
764 PDODeviceObject->StackSize = DeviceObject->StackSize + 1;
765
766 //
767 // get device extension
768 //
769 PDODeviceExtension = PDODeviceObject->DeviceExtension;
770
771 //
772 // init device extension
773 //
774 CollectionDescription = &FDODeviceExtension->Common.DeviceDescription.CollectionDesc[Index];
777 PDODeviceExtension->Common.HidDeviceExtension.PhysicalDeviceObject = PDODeviceObject;
778 PDODeviceExtension->Common.IsFDO = FALSE;
779 PDODeviceExtension->FDODeviceExtension = FDODeviceExtension;
780 PDODeviceExtension->FDODeviceObject = DeviceObject;
781 PDODeviceExtension->Common.DriverExtension = FDODeviceExtension->Common.DriverExtension;
782 PDODeviceExtension->CollectionNumber = CollectionDescription->CollectionNumber;
783 PDODeviceExtension->InstanceID = Index;
784
785 //
786 // copy device data
787 //
788 RtlCopyMemory(&PDODeviceExtension->Common.Attributes, &FDODeviceExtension->Common.Attributes, sizeof(HID_DEVICE_ATTRIBUTES));
789 RtlCopyMemory(&PDODeviceExtension->Common.DeviceDescription, &FDODeviceExtension->Common.DeviceDescription, sizeof(HIDP_DEVICE_DESC));
790 RtlCopyMemory(&PDODeviceExtension->Capabilities, &FDODeviceExtension->Capabilities, sizeof(DEVICE_CAPABILITIES));
791
792 //
793 // is it a keyboard or mouse (we'll need it for multiple things)
794 //
795 PDODeviceExtension->IsKeyboardOrMouse = CollectionDescription->UsagePage == HID_USAGE_PAGE_GENERIC &&
796 (CollectionDescription->Usage == HID_USAGE_GENERIC_POINTER ||
797 CollectionDescription->Usage == HID_USAGE_GENERIC_MOUSE ||
798 CollectionDescription->Usage == HID_USAGE_GENERIC_KEYBOARD ||
799 CollectionDescription->Usage == HID_USAGE_GENERIC_KEYPAD);
800
801 //
802 // set device flags
803 //
804 PDODeviceObject->Flags |= DO_MAP_IO_BUFFER;
805
806 //
807 // device is initialized
808 //
809 PDODeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
810
811 //
812 // store device object in device relations
813 //
814 DeviceRelations->Objects[Index] = PDODeviceObject;
815 DeviceRelations->Count++;
816
817 //
818 // move to next
819 //
820 Index++;
821
822 }
823
824
825 //
826 // check if creating succeeded
827 //
828 if (!NT_SUCCESS(Status))
829 {
830 //
831 // failed
832 //
833 for (Index = 0; Index < DeviceRelations->Count; Index++)
834 {
835 //
836 // delete device
837 //
838 IoDeleteDevice(DeviceRelations->Objects[Index]);
839 }
840
841 //
842 // free device relations
843 //
844 ExFreePoolWithTag(DeviceRelations, HIDCLASS_TAG);
845 return Status;
846 }
847
848 //
849 // store device relations
850 //
851 *OutDeviceRelations = DeviceRelations;
852
853 //
854 // done
855 //
856 return STATUS_SUCCESS;
857}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
Definition: bufpool.h:45
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#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
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
#define L(x)
Definition: resources.c:13
#define HIDCLASS_TAG
Definition: precomp.h:10
#define ULONG_PTR
Definition: config.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _DEVICE_OBJECT * PDEVICE_OBJECT
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define NonPagedPool
Definition: env_spec_w32.h:307
#define DO_MAP_IO_BUFFER
Definition: env_spec_w32.h:397
#define PagedPool
Definition: env_spec_w32.h:308
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
Status
Definition: gdiplustypes.h:24
GLfloat GLfloat p
Definition: glext.h:8902
NTSTATUS HidClassFDO_DispatchRequestSynchronous(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:147
PHIDP_REPORT_IDS HidClassPDO_GetReportDescriptionByReportID(PHIDP_DEVICE_DESC DeviceDescription, UCHAR ReportID)
Definition: pdo.c:71
NTSTATUS HidClassPDO_HandleQueryCompatibleId(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:353
NTSTATUS HidClassPDO_PnP(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:382
PHIDP_REPORT_IDS HidClassPDO_GetReportDescription(PHIDP_DEVICE_DESC DeviceDescription, ULONG CollectionNumber)
Definition: pdo.c:45
NTSTATUS HidClassPDO_CreatePDO(IN PDEVICE_OBJECT DeviceObject, OUT PDEVICE_RELATIONS *OutDeviceRelations)
Definition: pdo.c:699
PHIDP_COLLECTION_DESC HidClassPDO_GetCollectionDescription(PHIDP_DEVICE_DESC DeviceDescription, ULONG CollectionNumber)
Definition: pdo.c:19
NTSTATUS HidClassPDO_HandleQueryInstanceId(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:315
NTSTATUS HidClassPDO_HandleQueryHardwareId(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:183
static PCWSTR HidClassPDO_AppendInterfaceNumber(_In_ PWSTR HardwareIds, _In_ ULONG InterfaceNumber, _In_ BOOLEAN MultiString)
Definition: pdo.c:98
NTSTATUS HidClassPDO_HandleQueryDeviceId(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:141
struct _HID_INTERFACE_HIDPARSE * PHID_INTERFACE_HIDPARSE
struct _HID_INTERFACE_NOTIFY_PNP * PHID_INTERFACE_NOTIFY_PNP
HIDAPI NTSTATUS NTAPI HidP_GetCaps(IN PHIDP_PREPARSED_DATA PreparsedData, OUT PHIDP_CAPS Capabilities)
Definition: hidp.c:26
_Must_inspect_result_ _In_ UCHAR ReportID
Definition: hidpi.h:482
#define HID_USAGE_GENERIC_GAMEPAD
Definition: hidusage.h:35
#define HID_USAGE_GENERIC_MOUSE
Definition: hidusage.h:33
#define HID_USAGE_CONSUMERCTRL
Definition: hidusage.h:203
#define HID_USAGE_GENERIC_POINTER
Definition: hidusage.h:32
#define HID_USAGE_GENERIC_KEYPAD
Definition: hidusage.h:37
#define HID_USAGE_PAGE_GENERIC
Definition: hidusage.h:176
#define HID_USAGE_PAGE_CONSUMER
Definition: hidusage.h:186
#define HID_USAGE_GENERIC_SYSTEM_CTL
Definition: hidusage.h:38
#define HID_USAGE_GENERIC_KEYBOARD
Definition: hidusage.h:36
#define HID_USAGE_GENERIC_JOYSTICK
Definition: hidusage.h:34
_In_ PIRP Irp
Definition: kse.h:79
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:142
#define _In_
Definition: no_sal2.h:158
#define UNICODE_NULL
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define IoCopyCurrentIrpStackLocationToNext(Irp)
Definition: ntifs_ex.h:413
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:1038
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1261
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
Definition: deviface.c:1451
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
Definition: deviface.c:1807
#define IoCompleteRequest
Definition: irp.c:1272
#define STATUS_DEVICE_CONFIGURATION_ERROR
Definition: ntstatus.h:713
short WCHAR
Definition: pedump.c:58
#define FILE_DEVICE_UNKNOWN
Definition: winioctl.h:79
@ PNPBus
Definition: restypes.h:137
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
HIDP_DEVICE_DESC DeviceDescription
Definition: precomp.h:44
PHIDCLASS_DRIVER_EXTENSION DriverExtension
Definition: precomp.h:39
HID_DEVICE_ATTRIBUTES Attributes
Definition: precomp.h:49
HID_DEVICE_EXTENSION HidDeviceExtension
Definition: precomp.h:29
PDRIVER_OBJECT DriverObject
Definition: precomp.h:14
PDEVICE_RELATIONS DeviceRelations
Definition: precomp.h:83
HIDCLASS_COMMON_DEVICE_EXTENSION Common
Definition: precomp.h:58
DEVICE_CAPABILITIES Capabilities
Definition: precomp.h:63
HIDCLASS_COMMON_DEVICE_EXTENSION Common
Definition: precomp.h:92
PDEVICE_OBJECT FDODeviceObject
Definition: precomp.h:122
PHIDCLASS_FDO_EXTENSION FDODeviceExtension
Definition: precomp.h:127
DEVICE_CAPABILITIES Capabilities
Definition: precomp.h:97
UNICODE_STRING DeviceInterface
Definition: precomp.h:117
PVOID DeviceExtension
Definition: env_spec_w32.h:418
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2165
UCHAR CollectionNumber
Definition: hidpddi.h:11
PHIDP_COLLECTION_DESC CollectionDesc
Definition: hidpddi.h:38
ULONG CollectionDescLength
Definition: hidpddi.h:39
PDEVICE_OBJECT PhysicalDeviceObject
Definition: hidport.h:17
PVOID MiniDeviceExtension
Definition: hidport.h:19
PDEVICE_OBJECT NextDeviceObject
Definition: hidport.h:18
PHIDP_GETCAPS HidpGetCaps
Definition: hidclass.h:131
union _IO_STACK_LOCATION::@1823 Parameters
struct _IO_STACK_LOCATION::@5134::@5160 QueryInterface
struct _IO_STACK_LOCATION::@5134::@5165 QueryId
struct _IO_STACK_LOCATION::@5134::@5159 QueryDeviceRelations
struct _IO_STACK_LOCATION::@5134::@5161 DeviceCapabilities
#define STATUS_PENDING
Definition: telnetd.h:14
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
unsigned char UCHAR
Definition: typedefs.h:53
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
uint16_t * LPWSTR
Definition: typedefs.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PVOID _In_ LONG InterfaceNumber
Definition: usbdlib.h:196
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_In_ WDFDEVICE _In_ PPNP_BUS_INFORMATION BusInformation
Definition: wdfdevice.h:3921
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
Definition: wdfpdo.h:432
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235
#define IRP_MN_CANCEL_STOP_DEVICE
DEVICE_CAPABILITIES
Definition: iotypes.h:965
@ TargetDeviceRelation
Definition: iotypes.h:2158
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_START_DEVICE
#define IRP_MN_QUERY_ID
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_QUERY_CAPABILITIES
#define IRP_MN_CANCEL_REMOVE_DEVICE
@ BusQueryCompatibleIDs
Definition: iotypes.h:2953
@ BusQueryInstanceID
Definition: iotypes.h:2954
@ BusQueryDeviceID
Definition: iotypes.h:2951
@ BusQueryHardwareIDs
Definition: iotypes.h:2952
#define IRP_MN_QUERY_BUS_INFORMATION
#define IRP_MN_QUERY_REMOVE_DEVICE
#define ObReferenceObject
Definition: obfuncs.h:204