ReactOS 0.4.15-dev-8428-g6910fa6
precomp.h File Reference
#include <wdm.h>
#include <hidpddi.h>
#include <stdio.h>
#include <hidport.h>
Include dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  HIDCLASS_DRIVER_EXTENSION
 
struct  HIDCLASS_COMMON_DEVICE_EXTENSION
 
struct  HIDCLASS_FDO_EXTENSION
 
struct  HIDCLASS_PDO_DEVICE_EXTENSION
 
struct  __HIDCLASS_FILEOP_CONTEXT__
 
struct  HIDCLASS_IRP_CONTEXT
 

Macros

#define _HIDPI_NO_FUNCTION_MACROS_
 
#define HIDCLASS_TAG   'CdiH'
 

Typedefs

typedef struct HIDCLASS_DRIVER_EXTENSIONPHIDCLASS_DRIVER_EXTENSION
 
typedef struct HIDCLASS_COMMON_DEVICE_EXTENSIONPHIDCLASS_COMMON_DEVICE_EXTENSION
 
typedef struct HIDCLASS_FDO_EXTENSIONPHIDCLASS_FDO_EXTENSION
 
typedef struct HIDCLASS_PDO_DEVICE_EXTENSIONPHIDCLASS_PDO_DEVICE_EXTENSION
 
typedef struct __HIDCLASS_FILEOP_CONTEXT__ HIDCLASS_FILEOP_CONTEXT
 
typedef struct __HIDCLASS_FILEOP_CONTEXT__PHIDCLASS_FILEOP_CONTEXT
 
typedef struct HIDCLASS_IRP_CONTEXTPHIDCLASS_IRP_CONTEXT
 

Functions

NTSTATUS HidClassFDO_PnP (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS HidClassFDO_DispatchRequest (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS HidClassFDO_DispatchRequestSynchronous (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS HidClassPDO_CreatePDO (IN PDEVICE_OBJECT DeviceObject, OUT PDEVICE_RELATIONS *OutDeviceRelations)
 
NTSTATUS HidClassPDO_PnP (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
PHIDP_COLLECTION_DESC HidClassPDO_GetCollectionDescription (PHIDP_DEVICE_DESC DeviceDescription, ULONG CollectionNumber)
 
PHIDP_REPORT_IDS HidClassPDO_GetReportDescription (PHIDP_DEVICE_DESC DeviceDescription, ULONG CollectionNumber)
 
PHIDP_REPORT_IDS HidClassPDO_GetReportDescriptionByReportID (PHIDP_DEVICE_DESC DeviceDescription, UCHAR ReportID)
 

Macro Definition Documentation

◆ _HIDPI_NO_FUNCTION_MACROS_

#define _HIDPI_NO_FUNCTION_MACROS_

Definition at line 4 of file precomp.h.

◆ HIDCLASS_TAG

#define HIDCLASS_TAG   'CdiH'

Definition at line 10 of file precomp.h.

Typedef Documentation

◆ HIDCLASS_FILEOP_CONTEXT

◆ PHIDCLASS_COMMON_DEVICE_EXTENSION

◆ PHIDCLASS_DRIVER_EXTENSION

◆ PHIDCLASS_FDO_EXTENSION

◆ PHIDCLASS_FILEOP_CONTEXT

◆ PHIDCLASS_IRP_CONTEXT

◆ PHIDCLASS_PDO_DEVICE_EXTENSION

Function Documentation

◆ HidClassFDO_DispatchRequest()

NTSTATUS HidClassFDO_DispatchRequest ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 217 of file fdo.c.

220{
221 PHIDCLASS_COMMON_DEVICE_EXTENSION CommonDeviceExtension;
223 PIO_STACK_LOCATION IoStack;
224
225 //
226 // get device extension
227 //
228 CommonDeviceExtension = DeviceObject->DeviceExtension;
229
230 ASSERT(Irp->CurrentLocation > 0);
231
232 //
233 // create stack location
234 //
236
237 //
238 // get next stack location
239 //
241
242 //
243 // store device object
244 //
245 IoStack->DeviceObject = DeviceObject;
246
247 //
248 // sanity check
249 //
250 ASSERT(CommonDeviceExtension->DriverExtension->MajorFunction[IoStack->MajorFunction] != NULL);
251
252 //
253 // call driver
254 //
255 Status = CommonDeviceExtension->DriverExtension->MajorFunction[IoStack->MajorFunction](DeviceObject, Irp);
256
257 //
258 // done
259 //
260 return Status;
261}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
Status
Definition: gdiplustypes.h:25
#define ASSERT(a)
Definition: mode.c:44
PHIDCLASS_DRIVER_EXTENSION DriverExtension
Definition: precomp.h:39
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]
Definition: precomp.h:17
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:3223
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
FORCEINLINE VOID IoSetNextIrpStackLocation(_Inout_ PIRP Irp)
Definition: iofuncs.h:2680

Referenced by HidClass_Power(), and HidClassFDO_PnP().

◆ HidClassFDO_DispatchRequestSynchronous()

NTSTATUS HidClassFDO_DispatchRequestSynchronous ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 147 of file fdo.c.

150{
152 PHIDCLASS_COMMON_DEVICE_EXTENSION CommonDeviceExtension;
154 PIO_STACK_LOCATION IoStack;
155
156 //
157 // init event
158 //
160
161 //
162 // get device extension
163 //
164 CommonDeviceExtension = DeviceObject->DeviceExtension;
165
166 //
167 // set completion routine
168 //
170
171 ASSERT(Irp->CurrentLocation > 0);
172 //
173 // create stack location
174 //
176
177 //
178 // get next stack location
179 //
181
182 //
183 // store device object
184 //
185 IoStack->DeviceObject = DeviceObject;
186
187 //
188 // sanity check
189 //
190 ASSERT(CommonDeviceExtension->DriverExtension->MajorFunction[IoStack->MajorFunction] != NULL);
191
192 //
193 // call minidriver (hidusb)
194 //
195 Status = CommonDeviceExtension->DriverExtension->MajorFunction[IoStack->MajorFunction](DeviceObject, Irp);
196
197 //
198 // wait for the request to finish
199 //
200 if (Status == STATUS_PENDING)
201 {
203
204 //
205 // update status
206 //
207 Status = Irp->IoStatus.Status;
208 }
209
210 //
211 // done
212 //
213 return Status;
214}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
NTSTATUS NTAPI HidClassFDO_DispatchRequestSynchronousCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
Definition: fdo.c:129
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
#define KernelMode
Definition: asm.h:34
@ NotificationEvent
#define STATUS_PENDING
Definition: ntstatus.h:82
@ Executive
Definition: ketypes.h:415

Referenced by HidClassFDO_GetDescriptors(), HidClassFDO_RemoveDevice(), HidClassFDO_StartDevice(), HidClassPDO_HandleQueryDeviceId(), and HidClassPDO_HandleQueryHardwareId().

◆ HidClassFDO_PnP()

NTSTATUS HidClassFDO_PnP ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 631 of file fdo.c.

634{
635 PIO_STACK_LOCATION IoStack;
636 PHIDCLASS_FDO_EXTENSION FDODeviceExtension;
638
639 //
640 // get device extension
641 //
642 FDODeviceExtension = DeviceObject->DeviceExtension;
643 ASSERT(FDODeviceExtension->Common.IsFDO);
644
645 //
646 // get current irp stack location
647 //
649 switch (IoStack->MinorFunction)
650 {
652 {
654 }
656 {
658 }
660 {
662 }
667 {
668 //
669 // set status to success and fall through
670 //
671 Irp->IoStatus.Status = STATUS_SUCCESS;
672 }
673 default:
674 {
675 //
676 // dispatch to mini driver
677 //
680 return Status;
681 }
682 }
683}
NTSTATUS HidClassFDO_RemoveDevice(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:464
NTSTATUS HidClassFDO_DispatchRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:217
NTSTATUS HidClassFDO_StartDevice(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:393
NTSTATUS HidClassFDO_DeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: fdo.c:559
#define IoCopyCurrentIrpStackLocationToNext(Irp)
Definition: ntifs_ex.h:413
#define STATUS_SUCCESS
Definition: shellext.h:65
HIDCLASS_COMMON_DEVICE_EXTENSION Common
Definition: precomp.h:58
#define IRP_MN_CANCEL_STOP_DEVICE
#define IRP_MN_START_DEVICE
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_QUERY_REMOVE_DEVICE

Referenced by HidClass_PnP().

◆ HidClassPDO_CreatePDO()

NTSTATUS HidClassPDO_CreatePDO ( IN PDEVICE_OBJECT  DeviceObject,
OUT PDEVICE_RELATIONS OutDeviceRelations 
)

Definition at line 660 of file pdo.c.

663{
664 PHIDCLASS_FDO_EXTENSION FDODeviceExtension;
666 PDEVICE_OBJECT PDODeviceObject;
667 PHIDCLASS_PDO_DEVICE_EXTENSION PDODeviceExtension;
668 ULONG Index;
669 PDEVICE_RELATIONS DeviceRelations;
671
672 //
673 // get device extension
674 //
675 FDODeviceExtension = DeviceObject->DeviceExtension;
676 ASSERT(FDODeviceExtension->Common.IsFDO);
677
678 //
679 // first allocate device relations
680 //
683 if (!DeviceRelations)
684 {
685 //
686 // no memory
687 //
689 }
690
691 //
692 // zero device relations
693 //
694 RtlZeroMemory(DeviceRelations, Length);
695
696 //
697 // let's create a PDO for top level collection
698 //
699 Index = 0;
700 while (Index < FDODeviceExtension->Common.DeviceDescription.CollectionDescLength)
701 {
702 //
703 // let's create the device object
704 //
707 NULL,
710 FALSE,
711 &PDODeviceObject);
712 if (!NT_SUCCESS(Status))
713 {
714 //
715 // failed to create device
716 //
717 DPRINT1("[HIDCLASS] Failed to create PDO %x\n", Status);
718 break;
719 }
720
721 //
722 // patch stack size
723 //
724 PDODeviceObject->StackSize = DeviceObject->StackSize + 1;
725
726 //
727 // get device extension
728 //
729 PDODeviceExtension = PDODeviceObject->DeviceExtension;
730
731 //
732 // init device extension
733 //
737 PDODeviceExtension->Common.IsFDO = FALSE;
738 PDODeviceExtension->FDODeviceExtension = FDODeviceExtension;
739 PDODeviceExtension->FDODeviceObject = DeviceObject;
740 PDODeviceExtension->Common.DriverExtension = FDODeviceExtension->Common.DriverExtension;
741 PDODeviceExtension->CollectionNumber = FDODeviceExtension->Common.DeviceDescription.CollectionDesc[Index].CollectionNumber;
742
743 //
744 // copy device data
745 //
746 RtlCopyMemory(&PDODeviceExtension->Common.Attributes, &FDODeviceExtension->Common.Attributes, sizeof(HID_DEVICE_ATTRIBUTES));
747 RtlCopyMemory(&PDODeviceExtension->Common.DeviceDescription, &FDODeviceExtension->Common.DeviceDescription, sizeof(HIDP_DEVICE_DESC));
748 RtlCopyMemory(&PDODeviceExtension->Capabilities, &FDODeviceExtension->Capabilities, sizeof(DEVICE_CAPABILITIES));
749
750 //
751 // set device flags
752 //
753 PDODeviceObject->Flags |= DO_MAP_IO_BUFFER;
754
755 //
756 // device is initialized
757 //
758 PDODeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
759
760 //
761 // store device object in device relations
762 //
763 DeviceRelations->Objects[Index] = PDODeviceObject;
764 DeviceRelations->Count++;
765
766 //
767 // move to next
768 //
769 Index++;
770
771 }
772
773
774 //
775 // check if creating succeeded
776 //
777 if (!NT_SUCCESS(Status))
778 {
779 //
780 // failed
781 //
782 for (Index = 0; Index < DeviceRelations->Count; Index++)
783 {
784 //
785 // delete device
786 //
787 IoDeleteDevice(DeviceRelations->Objects[Index]);
788 }
789
790 //
791 // free device relations
792 //
793 ExFreePoolWithTag(DeviceRelations, HIDCLASS_TAG);
794 return Status;
795 }
796
797 //
798 // store device relations
799 //
800 *OutDeviceRelations = DeviceRelations;
801
802 //
803 // done
804 //
805 return STATUS_SUCCESS;
806}
#define DPRINT1
Definition: precomp.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define HIDCLASS_TAG
Definition: precomp.h:10
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _DEVICE_OBJECT * PDEVICE_OBJECT
#define DO_MAP_IO_BUFFER
Definition: env_spec_w32.h:397
#define PagedPool
Definition: env_spec_w32.h:308
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:138
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
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 IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
#define FILE_DEVICE_UNKNOWN
Definition: winioctl.h:79
HIDP_DEVICE_DESC DeviceDescription
Definition: precomp.h:44
HID_DEVICE_ATTRIBUTES Attributes
Definition: precomp.h:49
HID_DEVICE_EXTENSION HidDeviceExtension
Definition: precomp.h:29
PDRIVER_OBJECT DriverObject
Definition: precomp.h:14
DEVICE_CAPABILITIES Capabilities
Definition: precomp.h:63
HIDCLASS_COMMON_DEVICE_EXTENSION Common
Definition: precomp.h:87
PDEVICE_OBJECT FDODeviceObject
Definition: precomp.h:107
PHIDCLASS_FDO_EXTENSION FDODeviceExtension
Definition: precomp.h:112
DEVICE_CAPABILITIES Capabilities
Definition: precomp.h:92
PVOID DeviceExtension
Definition: env_spec_w32.h:418
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2163
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
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ WDFCOLLECTION _In_ ULONG Index
DEVICE_CAPABILITIES
Definition: iotypes.h:965

Referenced by HidClassFDO_DeviceRelations().

◆ HidClassPDO_GetCollectionDescription()

PHIDP_COLLECTION_DESC HidClassPDO_GetCollectionDescription ( PHIDP_DEVICE_DESC  DeviceDescription,
ULONG  CollectionNumber 
)

Definition at line 19 of file pdo.c.

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}
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING DeviceDescription
Definition: wdfpdo.h:432

Referenced by HidClass_BuildIrp(), HidClass_DeviceControl(), HidClass_ReadCompleteIrp(), and HidClassPDO_HandleQueryHardwareId().

◆ HidClassPDO_GetReportDescription()

PHIDP_REPORT_IDS HidClassPDO_GetReportDescription ( PHIDP_DEVICE_DESC  DeviceDescription,
ULONG  CollectionNumber 
)

Definition at line 45 of file pdo.c.

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}

Referenced by HidClass_BuildIrp(), and HidClass_ReadCompleteIrp().

◆ HidClassPDO_GetReportDescriptionByReportID()

PHIDP_REPORT_IDS HidClassPDO_GetReportDescriptionByReportID ( PHIDP_DEVICE_DESC  DeviceDescription,
UCHAR  ReportID 
)

Definition at line 71 of file pdo.c.

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}
_Must_inspect_result_ _In_ UCHAR ReportID
Definition: hidpi.h:482

Referenced by HidClass_DeviceControl().

◆ HidClassPDO_PnP()

NTSTATUS HidClassPDO_PnP ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 379 of file pdo.c.

382{
383 PHIDCLASS_PDO_DEVICE_EXTENSION PDODeviceExtension;
384 PIO_STACK_LOCATION IoStack;
387 PDEVICE_RELATIONS DeviceRelation;
388 ULONG Index, bFound;
389
390 //
391 // get device extension
392 //
393 PDODeviceExtension = DeviceObject->DeviceExtension;
394 ASSERT(PDODeviceExtension->Common.IsFDO == FALSE);
395
396 //
397 // get current irp stack location
398 //
400
401 //
402 // handle request
403 //
404 switch (IoStack->MinorFunction)
405 {
406 case IRP_MN_QUERY_ID:
407 {
408 if (IoStack->Parameters.QueryId.IdType == BusQueryDeviceID)
409 {
410 //
411 // handle query device id
412 //
414 break;
415 }
416 else if (IoStack->Parameters.QueryId.IdType == BusQueryHardwareIDs)
417 {
418 //
419 // handle instance id
420 //
422 break;
423 }
424 else if (IoStack->Parameters.QueryId.IdType == BusQueryInstanceID)
425 {
426 //
427 // handle instance id
428 //
430 break;
431 }
432 else if (IoStack->Parameters.QueryId.IdType == BusQueryCompatibleIDs)
433 {
434 //
435 // handle instance id
436 //
438 break;
439 }
440
441 DPRINT1("[HIDCLASS]: IRP_MN_QUERY_ID IdType %x unimplemented\n", IoStack->Parameters.QueryId.IdType);
443 Irp->IoStatus.Information = 0;
444 break;
445 }
447 {
448 if (IoStack->Parameters.DeviceCapabilities.Capabilities == NULL)
449 {
450 //
451 // invalid request
452 //
454 break;
455 }
456
457 //
458 // copy capabilities
459 //
460 RtlCopyMemory(IoStack->Parameters.DeviceCapabilities.Capabilities,
461 &PDODeviceExtension->Capabilities,
462 sizeof(DEVICE_CAPABILITIES));
464 break;
465 }
467 {
468 //
469 //
470 //
472
473 //
474 // fill in result
475 //
476 RtlCopyMemory(&BusInformation->BusTypeGuid, &GUID_BUS_TYPE_HID, sizeof(GUID));
477 BusInformation->LegacyBusType = PNPBus;
478 BusInformation->BusNumber = 0; //FIXME
479
480 //
481 // store result
482 //
483 Irp->IoStatus.Information = (ULONG_PTR)BusInformation;
485 break;
486 }
488 {
489 //
490 // FIXME set flags when driver fails / disabled
491 //
493 break;
494 }
496 {
497 //
498 // only target relations are supported
499 //
501 {
502 //
503 // not supported
504 //
505 Status = Irp->IoStatus.Status;
506 break;
507 }
508
509 //
510 // allocate device relations
511 //
513 if (!DeviceRelation)
514 {
515 //
516 // no memory
517 //
519 break;
520 }
521
522 //
523 // init device relation
524 //
525 DeviceRelation->Count = 1;
526 DeviceRelation->Objects[0] = DeviceObject;
527 ObReferenceObject(DeviceRelation->Objects[0]);
528
529 //
530 // store result
531 //
532 Irp->IoStatus.Information = (ULONG_PTR)DeviceRelation;
534 break;
535 }
537 {
538 //
539 // FIXME: support polled devices
540 //
541 ASSERT(PDODeviceExtension->Common.DriverExtension->DevicesArePolled == FALSE);
542
543 //
544 // now register the device interface
545 //
547 &GUID_DEVINTERFACE_HID,
548 NULL,
549 &PDODeviceExtension->DeviceInterface);
550 DPRINT("[HIDCLASS] IoRegisterDeviceInterfaceState Status %x\n", Status);
551 if (NT_SUCCESS(Status))
552 {
553 //
554 // enable device interface
555 //
556 Status = IoSetDeviceInterfaceState(&PDODeviceExtension->DeviceInterface, TRUE);
557 DPRINT("[HIDCLASS] IoSetDeviceInterFaceState %x\n", Status);
558 }
559
560 //
561 // done
562 //
564 break;
565 }
567 {
568 /* Disable the device interface */
569 if (PDODeviceExtension->DeviceInterface.Length != 0)
570 IoSetDeviceInterfaceState(&PDODeviceExtension->DeviceInterface, FALSE);
571
572 //
573 // remove us from the fdo's pdo list
574 //
575 bFound = FALSE;
576 for (Index = 0; Index < PDODeviceExtension->FDODeviceExtension->DeviceRelations->Count; Index++)
577 {
578 if (PDODeviceExtension->FDODeviceExtension->DeviceRelations->Objects[Index] == DeviceObject)
579 {
580 //
581 // remove us
582 //
583 bFound = TRUE;
584 PDODeviceExtension->FDODeviceExtension->DeviceRelations->Objects[Index] = NULL;
585 break;
586 }
587 }
588
589 /* Complete the IRP */
590 Irp->IoStatus.Status = STATUS_SUCCESS;
592
593 if (bFound)
594 {
595 /* Delete our device object*/
597 }
598
599 return STATUS_SUCCESS;
600 }
602 {
603 DPRINT1("[HIDCLASS] PDO IRP_MN_QUERY_INTERFACE not implemented\n");
604
605 //
606 // do nothing
607 //
608 Status = Irp->IoStatus.Status;
609 break;
610 }
615 {
616 //
617 // no/op
618 //
619#if 0
621#else
622 DPRINT1("Denying removal of HID device due to IRP cancellation bugs\n");
624#endif
625 break;
626 }
627 default:
628 {
629 //
630 // do nothing
631 //
632 Status = Irp->IoStatus.Status;
633 break;
634 }
635 }
636
637 //
638 // complete request
639 //
640 if (Status != STATUS_PENDING)
641 {
642 //
643 // store result
644 //
645 Irp->IoStatus.Status = Status;
646
647 //
648 // complete request
649 //
651 }
652
653 //
654 // done processing
655 //
656 return Status;
657}
#define ULONG_PTR
Definition: config.h:101
#define NonPagedPool
Definition: env_spec_w32.h:307
NTSTATUS HidClassPDO_HandleQueryCompatibleId(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:350
NTSTATUS HidClassPDO_HandleQueryInstanceId(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:312
NTSTATUS HidClassPDO_HandleQueryHardwareId(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:172
NTSTATUS HidClassPDO_HandleQueryDeviceId(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pdo.c:97
@ PNPBus
Definition: hwresource.cpp:152
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
Definition: deviface.c:955
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
Definition: deviface.c:1311
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
#define STATUS_DEVICE_CONFIGURATION_ERROR
Definition: ntstatus.h:619
#define DPRINT
Definition: sndvol32.h:73
PDEVICE_RELATIONS DeviceRelations
Definition: precomp.h:78
UNICODE_STRING DeviceInterface
Definition: precomp.h:102
struct _IO_STACK_LOCATION::@3976::@4003 DeviceCapabilities
union _IO_STACK_LOCATION::@1567 Parameters
struct _IO_STACK_LOCATION::@3976::@4007 QueryId
struct _IO_STACK_LOCATION::@3976::@4001 QueryDeviceRelations
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_In_ WDFDEVICE _In_ PPNP_BUS_INFORMATION BusInformation
Definition: wdfdevice.h:3915
@ TargetDeviceRelation
Definition: iotypes.h:2156
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IO_NO_INCREMENT
Definition: iotypes.h:598
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_QUERY_ID
#define IRP_MN_QUERY_CAPABILITIES
@ BusQueryCompatibleIDs
Definition: iotypes.h:2938
@ BusQueryInstanceID
Definition: iotypes.h:2939
@ BusQueryDeviceID
Definition: iotypes.h:2936
@ BusQueryHardwareIDs
Definition: iotypes.h:2937
#define IRP_MN_QUERY_BUS_INFORMATION
#define ObReferenceObject
Definition: obfuncs.h:204

Referenced by HidClass_PnP().