2 * PROJECT: ReactOS Universal Serial Bus Hub Driver
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/usb/usbhub/fdo.c
7 * Hervé Poussineau (hpoussin@reactos.org)
8 * Michael Martin (michael.martin@reactos.org)
9 * Johannes Anderwald (johannes.anderwald@reactos.org)
14 #define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
19 PDEVICE_OBJECT DeviceObject
,
24 DPRINT("Entered Urb Completion\n");
27 // Get the original Irp
29 OriginalIrp
= (PIRP
)Context
;
32 // Update it to match what was returned for the IRP that was passed to RootHub
34 OriginalIrp
->IoStatus
.Status
= Irp
->IoStatus
.Status
;
35 OriginalIrp
->IoStatus
.Information
= Irp
->IoStatus
.Information
;
36 DPRINT("Status %x, Information %x\n", Irp
->IoStatus
.Status
, Irp
->IoStatus
.Information
);
39 // Complete the original Irp
41 IoCompleteRequest(OriginalIrp
, IO_NO_INCREMENT
);
44 // Return this status so the IO Manager doesnt mess with the Irp
46 return STATUS_MORE_PROCESSING_REQUIRED
;
51 PDEVICE_OBJECT RootHubDeviceObject
,
52 IN ULONG IoControlCode
,
54 OUT PVOID OutParameter1
,
55 OUT PVOID OutParameter2
)
59 IO_STATUS_BLOCK IoStatus
;
60 PIO_STACK_LOCATION ForwardStack
, CurrentStack
;
64 // Get the current stack location for the Irp
66 CurrentStack
= IoGetCurrentIrpStackLocation(Irp
);
70 // Pull the Urb from that stack, it will be reused in the Irp sent to RootHub
72 Urb
= (PURB
)CurrentStack
->Parameters
.Others
.Argument1
;
76 // Create the Irp to forward to RootHub
78 ForwardIrp
= IoBuildAsynchronousFsdRequest(IRP_MJ_SHUTDOWN
,
86 DPRINT1("Failed to allocate IRP\n");
87 return STATUS_INSUFFICIENT_RESOURCES
;
91 // Get the new Irps next stack
93 ForwardStack
= IoGetNextIrpStackLocation(ForwardIrp
);
96 // Copy the stack for the current irp into the next stack of new irp
98 RtlCopyMemory(ForwardStack
, CurrentStack
, sizeof(IO_STACK_LOCATION
));
100 IoStatus
.Status
= STATUS_NOT_SUPPORTED
;
101 IoStatus
.Information
= 0;
104 // Mark the Irp from upper driver as pending
106 IoMarkIrpPending(Irp
);
109 // Now set the completion routine for the new Irp.
111 IoSetCompletionRoutine(ForwardIrp
,
118 Status
= IoCallDriver(RootHubDeviceObject
, ForwardIrp
);
121 // Always return pending as the completion routine will take care of it
123 return STATUS_PENDING
;
128 IN PDEVICE_OBJECT DeviceObject
)
131 PHUB_DEVICE_EXTENSION HubDeviceExtension
;
132 PHUB_CHILDDEVICE_EXTENSION ChildDeviceExtension
;
135 ChildDeviceExtension
= (PHUB_CHILDDEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
136 ASSERT(ChildDeviceExtension
->Common
.IsFDO
== FALSE
);
137 HubDeviceExtension
= (PHUB_DEVICE_EXTENSION
)ChildDeviceExtension
->ParentDeviceObject
->DeviceExtension
;
139 for(Index
= 0; Index
< USB_MAXCHILDREN
; Index
++)
141 if (HubDeviceExtension
->ChildDeviceObject
[Index
] == DeviceObject
)
154 USBHUB_PdoHandleInternalDeviceControl(
155 IN PDEVICE_OBJECT DeviceObject
,
159 PIO_STACK_LOCATION Stack
;
160 ULONG_PTR Information
= 0;
161 PHUB_DEVICE_EXTENSION HubDeviceExtension
;
162 PHUB_CHILDDEVICE_EXTENSION ChildDeviceExtension
;
163 PDEVICE_OBJECT RootHubDeviceObject
;
166 //DPRINT1("UsbhubInternalDeviceControlPdo(%x) called\n", DeviceObject);
169 // get current stack location
171 Stack
= IoGetCurrentIrpStackLocation(Irp
);
175 // Set default status
177 Status
= Irp
->IoStatus
.Status
;
179 ChildDeviceExtension
= (PHUB_CHILDDEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
180 ASSERT(ChildDeviceExtension
->Common
.IsFDO
== FALSE
);
181 HubDeviceExtension
= (PHUB_DEVICE_EXTENSION
)ChildDeviceExtension
->ParentDeviceObject
->DeviceExtension
;
182 RootHubDeviceObject
= HubDeviceExtension
->RootHubPhysicalDeviceObject
;
184 if(!IsValidPDO(DeviceObject
))
186 DPRINT1("[USBHUB] Request for removed device object %p\n", DeviceObject
);
187 Irp
->IoStatus
.Status
= STATUS_DEVICE_NOT_CONNECTED
;
188 Irp
->IoStatus
.Information
= 0;
189 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
190 return STATUS_DEVICE_NOT_CONNECTED
;
193 switch (Stack
->Parameters
.DeviceIoControl
.IoControlCode
)
195 case IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO
:
197 PHUB_DEVICE_EXTENSION DeviceExtension
;
199 DPRINT("IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO\n");
200 if (Irp
->AssociatedIrp
.SystemBuffer
== NULL
201 || Stack
->Parameters
.DeviceIoControl
.OutputBufferLength
!= sizeof(PVOID
))
203 Status
= STATUS_INVALID_PARAMETER
;
208 DeviceExtension
= (PHUB_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
210 pHubPointer
= (PVOID
*)Irp
->AssociatedIrp
.SystemBuffer
;
213 Information
= sizeof(PVOID
);
214 Status
= STATUS_SUCCESS
;
218 case IOCTL_INTERNAL_USB_SUBMIT_URB
:
220 //DPRINT1("IOCTL_INTERNAL_USB_SUBMIT_URB\n");
225 Urb
= (PURB
)Stack
->Parameters
.Others
.Argument1
;
229 // Set the real device handle
231 //DPRINT("UsbdDeviceHandle %x, ChildDeviceHandle %x\n", Urb->UrbHeader.UsbdDeviceHandle, ChildDeviceExtension->UsbDeviceHandle);
233 Urb
->UrbHeader
.UsbdDeviceHandle
= ChildDeviceExtension
->UsbDeviceHandle
;
238 switch (Urb
->UrbHeader
.Function
)
243 case URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE
:
244 DPRINT1("URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE\n");
246 case URB_FUNCTION_CLASS_DEVICE
:
247 DPRINT1("URB_FUNCTION_CLASS_DEVICE\n");
249 case URB_FUNCTION_GET_STATUS_FROM_DEVICE
:
250 DPRINT1("URB_FUNCTION_GET_STATUS_FROM_DEVICE\n");
252 case URB_FUNCTION_SELECT_CONFIGURATION
:
253 DPRINT1("URB_FUNCTION_SELECT_CONFIGURATION\n");
255 case URB_FUNCTION_SELECT_INTERFACE
:
256 DPRINT1("URB_FUNCTION_SELECT_INTERFACE\n");
258 case URB_FUNCTION_CLASS_OTHER
:
259 DPRINT1("URB_FUNCTION_CLASS_OTHER\n");
261 case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
:
264 DPRINT1("URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER\n");
265 DPRINT1("PipeHandle %x\n", Urb->UrbBulkOrInterruptTransfer.PipeHandle);
266 DPRINT1("TransferFlags %x\n", Urb->UrbBulkOrInterruptTransfer.TransferFlags);
267 DPRINT1("Buffer %x\n", Urb->UrbBulkOrInterruptTransfer.TransferBuffer);
268 DPRINT1("BufferMDL %x\n", Urb->UrbBulkOrInterruptTransfer.TransferBufferMDL);
269 DPRINT1("Length %x\n", Urb->UrbBulkOrInterruptTransfer.TransferBufferLength);
270 DPRINT1("UrbLink %x\n", Urb->UrbBulkOrInterruptTransfer.UrbLink);
271 DPRINT1("hca %x\n", Urb->UrbBulkOrInterruptTransfer.hca);
272 if (Urb->UrbBulkOrInterruptTransfer.TransferFlags == USBD_SHORT_TRANSFER_OK)
279 case URB_FUNCTION_CLASS_INTERFACE
:
280 DPRINT1("URB_FUNCTION_CLASS_INTERFACE\n");
282 case URB_FUNCTION_VENDOR_DEVICE
:
283 DPRINT1("URB_FUNCTION_VENDOR_DEVICE\n");
286 DPRINT1("IOCTL_INTERNAL_USB_SUBMIT_URB Function %x NOT IMPLEMENTED\n", Urb
->UrbHeader
.Function
);
289 Urb
->UrbHeader
.UsbdDeviceHandle
= ChildDeviceExtension
->UsbDeviceHandle
;
290 //DPRINT1("Stack->CompletionRoutine %x\n", Stack->CompletionRoutine);
292 // Send the request to RootHub
294 Status
= FowardUrbToRootHub(RootHubDeviceObject
, IOCTL_INTERNAL_USB_SUBMIT_URB
, Irp
, Urb
, NULL
);
299 // FIXME: Can these be sent to RootHub?
301 case IOCTL_INTERNAL_USB_RESET_PORT
:
302 DPRINT1("IOCTL_INTERNAL_USB_RESET_PORT\n");
304 case IOCTL_INTERNAL_USB_GET_PORT_STATUS
:
306 PORT_STATUS_CHANGE PortStatus
;
308 PUCHAR PortStatusBits
;
310 PortStatusBits
= (PUCHAR
)Stack
->Parameters
.Others
.Argument1
;
312 // USBD_PORT_ENABLED (bit 0) or USBD_PORT_CONNECTED (bit 1)
314 DPRINT1("IOCTL_INTERNAL_USB_GET_PORT_STATUS\n");
315 DPRINT("Arg1 %x\n", *PortStatusBits
);
317 if (Stack
->Parameters
.Others
.Argument1
)
319 for (PortId
= 1; PortId
<= HubDeviceExtension
->UsbExtHubInfo
.NumberOfPorts
; PortId
++)
321 Status
= GetPortStatusAndChange(RootHubDeviceObject
, PortId
, &PortStatus
);
322 if (NT_SUCCESS(Status
))
324 DPRINT("Connect %x\n", ((PortStatus
.Status
& USB_PORT_STATUS_CONNECT
) << 1) << ((PortId
- 1) * 2));
325 DPRINT("Enable %x\n", ((PortStatus
.Status
& USB_PORT_STATUS_ENABLE
) >> 1) << ((PortId
- 1) * 2));
327 (((PortStatus
.Status
& USB_PORT_STATUS_CONNECT
) << 1) << ((PortId
- 1) * 2)) +
328 (((PortStatus
.Status
& USB_PORT_STATUS_ENABLE
) >> 1) << ((PortId
- 1) * 2));
334 DPRINT1("Arg1 %x\n", *PortStatusBits
);
335 Status
= STATUS_SUCCESS
;
338 case IOCTL_INTERNAL_USB_ENABLE_PORT
:
339 DPRINT1("IOCTL_INTERNAL_USB_ENABLE_PORT\n");
341 case IOCTL_INTERNAL_USB_CYCLE_PORT
:
342 DPRINT1("IOCTL_INTERNAL_USB_CYCLE_PORT\n");
344 case IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE
:
346 DPRINT1("IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE\n");
347 if (Stack
->Parameters
.Others
.Argument1
)
349 // store device handle
350 *(PVOID
*)Stack
->Parameters
.Others
.Argument1
= (PVOID
)ChildDeviceExtension
->UsbDeviceHandle
;
351 Status
= STATUS_SUCCESS
;
356 Status
= STATUS_INVALID_PARAMETER
;
360 case IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO
:
362 if (Stack
->Parameters
.Others
.Argument1
)
364 // inform caller that it is a real usb hub
365 *(PVOID
*)Stack
->Parameters
.Others
.Argument1
= NULL
;
368 if (Stack
->Parameters
.Others
.Argument2
)
370 // output device object
371 *(PVOID
*)Stack
->Parameters
.Others
.Argument2
= DeviceObject
;
375 Status
= STATUS_SUCCESS
;
380 DPRINT1("Unknown IOCTL code 0x%lx\n", Stack
->Parameters
.DeviceIoControl
.IoControlCode
);
381 Information
= Irp
->IoStatus
.Information
;
382 Status
= Irp
->IoStatus
.Status
;
386 if (Status
!= STATUS_PENDING
)
388 Irp
->IoStatus
.Information
= Information
;
389 Irp
->IoStatus
.Status
= Status
;
390 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
396 USBHUB_PdoStartDevice(
397 IN PDEVICE_OBJECT DeviceObject
,
400 PHUB_CHILDDEVICE_EXTENSION ChildDeviceExtension
;
402 DPRINT("USBHUB_PdoStartDevice %x\n", DeviceObject
);
403 ChildDeviceExtension
= (PHUB_CHILDDEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
406 // This should be a PDO
408 ASSERT(ChildDeviceExtension
->Common
.IsFDO
== FALSE
);
411 // FIXME: Fow now assume success
415 return STATUS_SUCCESS
;
420 IN PDEVICE_OBJECT DeviceObject
,
422 OUT ULONG_PTR
* Information
)
424 PHUB_CHILDDEVICE_EXTENSION ChildDeviceExtension
;
426 PUNICODE_STRING SourceString
= NULL
;
427 PWCHAR ReturnString
= NULL
;
428 NTSTATUS Status
= STATUS_SUCCESS
;
430 IdType
= IoGetCurrentIrpStackLocation(Irp
)->Parameters
.QueryId
.IdType
;
431 ChildDeviceExtension
= (PHUB_CHILDDEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
435 case BusQueryDeviceID
:
437 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceID\n");
438 SourceString
= &ChildDeviceExtension
->usDeviceId
;
441 case BusQueryHardwareIDs
:
443 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n");
444 SourceString
= &ChildDeviceExtension
->usHardwareIds
;
447 case BusQueryCompatibleIDs
:
449 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryCompatibleIDs\n");
450 SourceString
= &ChildDeviceExtension
->usCompatibleIds
;
453 case BusQueryInstanceID
:
455 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryInstanceID\n");
456 SourceString
= &ChildDeviceExtension
->usInstanceId
;
460 DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_ID / unknown query id type 0x%lx\n", IdType
);
461 return STATUS_NOT_SUPPORTED
;
469 ReturnString
= ExAllocatePool(PagedPool
, SourceString
->MaximumLength
);
475 return STATUS_INSUFFICIENT_RESOURCES
;
481 RtlCopyMemory(ReturnString
, SourceString
->Buffer
, SourceString
->MaximumLength
);
484 *Information
= (ULONG_PTR
)ReturnString
;
490 USBHUB_PdoQueryDeviceText(
491 IN PDEVICE_OBJECT DeviceObject
,
493 OUT ULONG_PTR
* Information
)
495 PHUB_CHILDDEVICE_EXTENSION ChildDeviceExtension
;
496 DEVICE_TEXT_TYPE DeviceTextType
;
497 PUNICODE_STRING SourceString
= NULL
;
498 PWCHAR ReturnString
= NULL
;
499 NTSTATUS Status
= STATUS_SUCCESS
;
502 DeviceTextType
= IoGetCurrentIrpStackLocation(Irp
)->Parameters
.QueryDeviceText
.DeviceTextType
;
503 LocaleId
= IoGetCurrentIrpStackLocation(Irp
)->Parameters
.QueryDeviceText
.LocaleId
;
504 ChildDeviceExtension
= (PHUB_CHILDDEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
510 switch (DeviceTextType
)
512 case DeviceTextDescription
:
513 case DeviceTextLocationInformation
:
515 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n");
518 // does the device provide a text description
520 if (ChildDeviceExtension
->usTextDescription
.Buffer
&& ChildDeviceExtension
->usTextDescription
.Length
)
525 SourceString
= &ChildDeviceExtension
->usTextDescription
;
531 DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / unknown device text type 0x%lx\n", DeviceTextType
);
532 Status
= STATUS_NOT_SUPPORTED
;
539 ReturnString
= ExAllocatePool(PagedPool
, SourceString
->MaximumLength
);
540 RtlCopyMemory(ReturnString
, SourceString
->Buffer
, SourceString
->MaximumLength
);
541 DPRINT1("%S\n", ReturnString
);
542 *Information
= (ULONG_PTR
)ReturnString
;
550 IN PDEVICE_OBJECT DeviceObject
,
555 PIO_STACK_LOCATION Stack
;
556 ULONG_PTR Information
= 0;
557 PHUB_CHILDDEVICE_EXTENSION UsbChildExtension
;
560 PDEVICE_RELATIONS DeviceRelation
;
561 PDEVICE_OBJECT ParentDevice
;
563 UsbChildExtension
= (PHUB_CHILDDEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
564 Stack
= IoGetCurrentIrpStackLocation(Irp
);
565 MinorFunction
= Stack
->MinorFunction
;
567 switch (MinorFunction
)
569 case IRP_MN_START_DEVICE
:
571 DPRINT("IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
572 Status
= USBHUB_PdoStartDevice(DeviceObject
, Irp
);
575 case IRP_MN_QUERY_CAPABILITIES
:
577 PDEVICE_CAPABILITIES DeviceCapabilities
;
579 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
581 DeviceCapabilities
= (PDEVICE_CAPABILITIES
)Stack
->Parameters
.DeviceCapabilities
.Capabilities
;
582 // FIXME: capabilities can change with connected device
583 DeviceCapabilities
->LockSupported
= FALSE
;
584 DeviceCapabilities
->EjectSupported
= FALSE
;
585 DeviceCapabilities
->Removable
= TRUE
;
586 DeviceCapabilities
->DockDevice
= FALSE
;
587 DeviceCapabilities
->UniqueID
= FALSE
;
588 DeviceCapabilities
->SilentInstall
= FALSE
;
589 DeviceCapabilities
->RawDeviceOK
= FALSE
;
590 DeviceCapabilities
->SurpriseRemovalOK
= FALSE
;
591 DeviceCapabilities
->HardwareDisabled
= FALSE
;
592 //DeviceCapabilities->NoDisplayInUI = FALSE;
593 DeviceCapabilities
->Address
= UsbChildExtension
->PortNumber
;
594 DeviceCapabilities
->UINumber
= 0;
595 DeviceCapabilities
->DeviceState
[0] = PowerDeviceD0
;
596 for (i
= 1; i
< PowerSystemMaximum
; i
++)
597 DeviceCapabilities
->DeviceState
[i
] = PowerDeviceD3
;
598 //DeviceCapabilities->DeviceWake = PowerDeviceUndefined;
599 DeviceCapabilities
->D1Latency
= 0;
600 DeviceCapabilities
->D2Latency
= 0;
601 DeviceCapabilities
->D3Latency
= 0;
602 Status
= STATUS_SUCCESS
;
605 case IRP_MN_QUERY_RESOURCES
:
607 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n");
609 Information
= Irp
->IoStatus
.Information
;
610 Status
= Irp
->IoStatus
.Status
;
613 case IRP_MN_QUERY_RESOURCE_REQUIREMENTS
:
615 DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
617 Information
= Irp
->IoStatus
.Information
;
618 Status
= Irp
->IoStatus
.Status
;
621 case IRP_MN_QUERY_DEVICE_TEXT
:
623 Status
= USBHUB_PdoQueryDeviceText(DeviceObject
, Irp
, &Information
);
626 case IRP_MN_QUERY_ID
:
628 Status
= USBHUB_PdoQueryId(DeviceObject
, Irp
, &Information
);
631 case IRP_MN_QUERY_BUS_INFORMATION
:
633 PPNP_BUS_INFORMATION BusInfo
;
634 BusInfo
= (PPNP_BUS_INFORMATION
)ExAllocatePool(PagedPool
, sizeof(PNP_BUS_INFORMATION
));
635 RtlCopyMemory(&BusInfo
->BusTypeGuid
,
637 sizeof(BusInfo
->BusTypeGuid
));
638 BusInfo
->LegacyBusType
= PNPBus
;
640 BusInfo
->BusNumber
= 0;
641 Information
= (ULONG_PTR
)BusInfo
;
642 Status
= STATUS_SUCCESS
;
645 case IRP_MN_REMOVE_DEVICE
:
647 PHUB_DEVICE_EXTENSION HubDeviceExtension
= (PHUB_DEVICE_EXTENSION
)UsbChildExtension
->ParentDeviceObject
->DeviceExtension
;
648 PUSB_BUS_INTERFACE_HUB_V5 HubInterface
= &HubDeviceExtension
->HubInterface
;
649 ParentDevice
= UsbChildExtension
->ParentDeviceObject
;
651 DPRINT("IRP_MJ_PNP / IRP_MN_REMOVE_DEVICE\n");
653 /* remove us from pdo list */
655 for(Index
= 0; Index
< USB_MAXCHILDREN
; Index
++)
657 if (HubDeviceExtension
->ChildDeviceObject
[Index
] == DeviceObject
)
659 /* Remove the device */
660 Status
= HubInterface
->RemoveUsbDevice(HubDeviceExtension
->UsbDInterface
.BusContext
, UsbChildExtension
->UsbDeviceHandle
, 0);
662 /* FIXME handle error */
663 ASSERT(Status
== STATUS_SUCCESS
);
666 HubDeviceExtension
->ChildDeviceObject
[Index
] = NULL
;
672 /* Complete the IRP */
673 Irp
->IoStatus
.Status
= STATUS_SUCCESS
;
674 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);
677 IoDeleteDevice(DeviceObject
);
681 /* invalidate device relations */
682 IoInvalidateDeviceRelations(ParentDevice
, BusRelations
);
685 return STATUS_SUCCESS
;
687 case IRP_MN_QUERY_DEVICE_RELATIONS
:
689 /* only target relations are supported */
690 if (Stack
->Parameters
.QueryDeviceRelations
.Type
!= TargetDeviceRelation
)
693 Status
= Irp
->IoStatus
.Status
;
697 /* allocate device relations */
698 DeviceRelation
= (PDEVICE_RELATIONS
)ExAllocatePool(NonPagedPool
, sizeof(DEVICE_RELATIONS
));
702 Status
= STATUS_INSUFFICIENT_RESOURCES
;
706 /* init device relation */
707 DeviceRelation
->Count
= 1;
708 DeviceRelation
->Objects
[0] = DeviceObject
;
709 ObReferenceObject(DeviceRelation
->Objects
[0]);
712 Irp
->IoStatus
.Information
= (ULONG_PTR
)DeviceRelation
;
713 Status
= STATUS_SUCCESS
;
716 case IRP_MN_QUERY_STOP_DEVICE
:
717 case IRP_MN_QUERY_REMOVE_DEVICE
:
719 /* Sure, no problem */
720 Status
= STATUS_SUCCESS
;
724 case IRP_MN_QUERY_INTERFACE
:
726 DPRINT1("IRP_MN_QUERY_INTERFACE\n");
727 if (IsEqualGUIDAligned(Stack
->Parameters
.QueryInterface
.InterfaceType
, &USB_BUS_INTERFACE_USBDI_GUID
))
729 DPRINT1("USB_BUS_INTERFACE_USBDI_GUID\n");
730 RtlCopyMemory(Stack
->Parameters
.QueryInterface
.Interface
, &UsbChildExtension
->DeviceInterface
, Stack
->Parameters
.QueryInterface
.Size
);
731 Status
= STATUS_SUCCESS
;
736 IoSkipCurrentIrpStackLocation(Irp
);
737 return IoCallDriver(UsbChildExtension
->ParentDeviceObject
, Irp
);
739 case IRP_MN_SURPRISE_REMOVAL
:
741 DPRINT("[USBHUB] HandlePnp IRP_MN_SURPRISE_REMOVAL\n");
742 Status
= STATUS_SUCCESS
;
747 DPRINT1("PDO IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction
);
748 Information
= Irp
->IoStatus
.Information
;
749 Status
= Irp
->IoStatus
.Status
;
753 Irp
->IoStatus
.Information
= Information
;
754 Irp
->IoStatus
.Status
= Status
;
755 IoCompleteRequest(Irp
, IO_NO_INCREMENT
);