13#define NDEBUG_USBHUB_PNP
14#define NDEBUG_USBHUB_ENUM
25 DPRINT(
"USBH_IrpCompletion: Irp - %p\n",
Irp);
40 DPRINT(
"USBH_HubPnPIrpComplete: Irp - %p\n",
Irp);
46 DPRINT1(
"USBH_HubPnPIrpComplete: Irp failed - %lX\n",
Irp->IoStatus.Status);
66 DPRINT(
"USBH_QueryCapsComplete: ... \n");
70 if (
Irp->PendingReturned)
93 DPRINT(
"USBHUB_GetBusInterface: ... \n");
99 DPRINT1(
"USBHUB_GetBusInterface: IoAllocateIrp() failed\n");
153 DPRINT(
"USBHUB_GetBusInterfaceUSBDI: ... \n");
159 DPRINT1(
"USBHUB_GetBusInterfaceUSBDI: IoAllocateIrp() failed\n");
212 DPRINT(
"USBH_QueryCapabilities: ... \n");
220 DPRINT1(
"USBH_QueryCapabilities: IoAllocateIrp() failed\n");
267 DPRINT(
"USBH_OpenConfiguration ... \n");
270 HubExtension->LowerPDO != HubExtension->RootHubPdo)
273 HubExtension->HubConfigDescriptor,
287 HubExtension->HubConfigDescriptor,
300 HubExtension->HubConfigDescriptor,
311 HubExtension->HubConfigDescriptor,
365 DPRINT(
"USBD_InitUsb2Hub ... \n");
367 Initialize20Hub = HubExtension->BusInterface.Initialize20Hub;
369 if (!Initialize20Hub)
378 TtCount = HubExtension->HubDescriptor->bNumberOfPorts;
383 return Initialize20Hub(HubExtension->BusInterface.BusContext,
395 DPRINT(
"USBH_AbortInterruptPipe: HubExtension - %p\n", HubExtension);
410 Urb->
PipeHandle = HubExtension->PipeInfo.PipeHandle;
445 DPRINT(
"USBH_FdoCleanup: HubExtension - %p\n", HubExtension);
451 if (HubExtension->ResetRequestCount)
464 HubExtension->ResetPortIrp =
NULL;
477 if (HubExtension->PendingWakeIrp)
479 WakeIrp = HubExtension->PendingWakeIrp;
480 HubExtension->PendingWakeIrp =
NULL;
483 if (HubExtension->PendingIdleIrp)
485 IdleIrp = HubExtension->PendingIdleIrp;
486 HubExtension->PendingIdleIrp =
NULL;
512 if (HubExtension->SCEIrp)
527 HubExtension->SCEIrp =
NULL;
530 if (!HubExtension->PortData ||
531 !HubExtension->HubDescriptor)
536 PortData = HubExtension->PortData;
537 NumberPorts = HubExtension->HubDescriptor->bNumberOfPorts;
551 PortExtension->
PortPdoFlags &= ~USBHUB_PDO_FLAG_IDLE_NOTIFICATION;
554 if (PortIdleIrp->Cancel)
569 PortExtension->
PortPdoFlags &= ~USBHUB_PDO_FLAG_WAIT_WAKE;
578 KeSetEvent(&HubExtension->PendingRequestEvent,
619 if (HubExtension->SCEBitmap)
624 if (HubExtension->HubDescriptor)
629 if (HubExtension->HubConfigDescriptor)
634 HubExtension->HubFlags &= ~USBHUB_FDO_FLAG_DEVICE_STARTED;
636 HubExtension->HubDescriptor =
NULL;
637 HubExtension->HubConfigDescriptor =
NULL;
639 HubExtension->SCEIrp =
NULL;
640 HubExtension->SCEBitmap =
NULL;
649 ULONG DisableRemoteWakeup = 0;
655 static WCHAR DisableWakeValueName[] =
L"DisableRemoteWakeup";
657 DPRINT(
"USBH_StartHubFdoDevice: ... \n");
675 HubExtension->HubFlags = 0;
676 HubExtension->HubConfigDescriptor =
NULL;
677 HubExtension->HubDescriptor =
NULL;
678 HubExtension->SCEIrp =
NULL;
679 HubExtension->SCEBitmap =
NULL;
681 HubExtension->PendingRequestCount = 1;
682 HubExtension->ResetRequestCount = 0;
683 HubExtension->PendingIdleIrp =
NULL;
684 HubExtension->PendingWakeIrp =
NULL;
710 HubExtension->RootHubPdo =
NULL;
713 &HubExtension->RootHubPdo,
714 &HubExtension->RootHubPdo2);
726 DPRINT1(
"USBH_StartHubFdoDevice: USBHUB_FDO_FLAG_DEVICE_FAILED - TRUE\n");
734 &DisableRemoteWakeup,
735 sizeof(DisableRemoteWakeup),
736 DisableWakeValueName,
737 sizeof(DisableWakeValueName));
741 DPRINT(
"USBH_StartHubFdoDevice: DisableRemoteWakeup - TRUE\n");
742 HubExtension->HubFlags &= ~USBHUB_FDO_FLAG_REMOTE_WAKEUP;
751 &HubExtension->BusInterface);
755 DPRINT1(
"USBH_StartHubFdoDevice: USBHUB_GetBusInterface() failed - %lX\n",
761 &HubExtension->BusInterfaceUSBDI);
765 DPRINT1(
"USBH_StartHubFdoDevice: USBHUB_GetBusInterfaceUSBDI() failed - %lX\n",
778 DPRINT1(
"USBH_StartHubFdoDevice: USBH_GetDeviceType() failed - %lX\n",
797 DPRINT1(
"USBH_StartHubFdoDevice: HubCount > 6 - %x\n", HubCount);
802 ParentPdoExtension = HubExtension->LowerPDO->DeviceExtension;
805 ParentPort = ParentPdoExtension->
PortNumber - 1;
806 PortData = &ParentHubExtension->
PortData[ParentPort];
822 &HubExtension->HubDeviceDescriptor);
826 DPRINT1(
"USBH_StartHubFdoDevice: USBH_GetDeviceDescriptor() failed - %lX\n",
832 &HubExtension->HubConfigDescriptor);
836 DPRINT1(
"USBH_StartHubFdoDevice: USBH_GetConfigurationDescriptor() failed - %lX\n",
845 DPRINT1(
"USBH_StartHubFdoDevice: USBH_SyncGetHubDescriptor() failed - %lX\n",
851 HubExtension->HubConfigDescriptor);
856 HubExtension->MaxPowerPerPort = 100;
860 HubExtension->HubConfigDescriptor->MaxPower = 250;
865 HubExtension->MaxPowerPerPort = 500;
872 DPRINT1(
"USBH_StartHubFdoDevice: USBH_OpenConfiguration() failed - %lX\n",
887 HubExtension->SCEIrp =
IoAllocateIrp(HubExtension->Common.SelfDevice->StackSize,
890 HubExtension->ResetPortIrp =
IoAllocateIrp(HubExtension->Common.SelfDevice->StackSize,
893 if (!HubExtension->SCEIrp || !HubExtension->ResetPortIrp)
899 HubExtension->SCEBitmapLength = HubExtension->PipeInfo.MaximumPacketSize;
902 HubExtension->SCEBitmapLength,
905 if (!HubExtension->SCEBitmap)
911 RtlZeroMemory(HubExtension->SCEBitmap, HubExtension->SCEBitmapLength);
926 Port <= HubExtension->HubDescriptor->bNumberOfPorts;
935 if (HubExtension->LowerPDO == HubExtension->RootHubPdo)
949 if (HubExtension->HubDescriptor)
952 HubExtension->HubDescriptor =
NULL;
955 if (HubExtension->SCEIrp)
958 HubExtension->SCEIrp =
NULL;
961 if (HubExtension->ResetPortIrp)
964 HubExtension->ResetPortIrp =
NULL;
967 if (HubExtension->SCEBitmap)
970 HubExtension->SCEBitmap =
NULL;
973 if (HubExtension->HubConfigDescriptor)
976 HubExtension->HubConfigDescriptor =
NULL;
993 DPRINT(
"USBH_FdoStartDevice: HubExtension - %p\n", HubExtension);
995 HubExtension->RootHubPdo =
NULL;
998 &HubExtension->RootHubPdo,
999 &HubExtension->RootHubPdo2);
1003 if (HubExtension->RootHubPdo)
1009 DPRINT1(
"USBH_FdoStartDevice: FIXME. start ParentDevice\n");
1015 DPRINT1(
"USBH_FdoStartDevice: FIXME. USBH_SyncGetRootHubPdo return - %lX\n",
1049 DPRINT_ENUM(
"USBH_FdoQueryBusRelations: HubFlags - %lX\n",
1050 HubExtension->HubFlags);
1055 goto RelationsWorker;
1058 if (!HubExtension->HubDescriptor)
1061 goto RelationsWorker;
1070 Interval.QuadPart = -10000LL * 1000;
1073 DPRINT_ENUM(
"USBH_FdoQueryBusRelations: Skip enumeration\n");
1074 goto RelationsWorker;
1085 NumberPorts = HubExtension->HubDescriptor->bNumberOfPorts;
1086 DPRINT_ENUM(
"USBH_FdoQueryBusRelations: NumberPorts - %x\n", NumberPorts);
1091 if (
Irp->IoStatus.Information)
1093 DPRINT1(
"FIXME: leaking old bus relations\n");
1098 if (!DeviceRelations)
1100 HubExtension->HubFlags &= ~USBHUB_FDO_FLAG_NOT_ENUMERATED;
1113 goto RelationsWorker;
1118 DeviceRelations->
Count = 0;
1124 HubExtension->HubFlags &= ~USBHUB_FDO_FLAG_NOT_ENUMERATED;
1137 goto RelationsWorker;
1140 HubExtension->HubFlags &= ~USBHUB_FDO_FLAG_ENUM_POST_RECOVER;
1144 PortData = &HubExtension->PortData[
Port - 1];
1160 DeviceRelations->
Count = 0;
1164 DPRINT_ENUM(
"USBH_FdoQueryBusRelations: Port - %x, ConnectStatus - %x\n",
1182 DPRINT1(
"USBH_FdoQueryBusRelations: DbgBreakPoint() \n");
1193 PdoExtension->EnumFlags &= ~USBHUB_ENUM_FLAG_DEVICE_PRESENT;
1223 PdoDevice->
Flags &= ~DO_DEVICE_INITIALIZING;
1225 DeviceRelations->
Objects[DeviceRelations->
Count++] = PdoDevice;
1228 PdoExtension->PortPdoFlags &= ~USBHUB_PDO_FLAG_POWER_D1_OR_D2;
1290 DPRINT1(
"USBH_FdoQueryBusRelations: FIXME USBH_DeviceIs2xDualMode()\n");
1305 DeviceRelations->
Count++;
1329 HubExtension->HubFlags &= ~USBHUB_FDO_FLAG_NOT_ENUMERATED;
1349 if (DeviceRelations)
1361 if (DeviceRelations && DeviceRelations->
Count)
1366 Entry = HubExtension->PdoList.Flink;
1368 while (
Entry != &HubExtension->PdoList)
1394 for (GhostPort =
Port;
1395 GhostPort < DeviceRelations->
Count;
1398 DeviceRelations->
Objects[GhostPort] =
1399 DeviceRelations->
Objects[GhostPort + 1];
1404 DeviceRelations->
Count--;
1414 Irp->IoStatus.Information = (
ULONG_PTR)DeviceRelations;
1417 PdoList = &HubExtension->PdoList;
1427 PdoExtension->EnumFlags &= ~USBHUB_ENUM_FLAG_DEVICE_PRESENT;
1456 DPRINT1(
"USBH_FdoStopDevice: UNIMPLEMENTED. FIXME\n");
1474 DPRINT(
"USBH_FdoRemoveDevice: HubExtension - %p\n", HubExtension);
1476 HubDescriptor = HubExtension->HubDescriptor;
1478 if (HubDescriptor && HubExtension->PortData)
1482 for (ix = 0; ix < NumPorts; ++ix)
1484 PortData = HubExtension->PortData + ix;
1494 PortExtension->
EnumFlags &= ~USBHUB_ENUM_FLAG_DEVICE_PRESENT;
1506 if (HubExtension->PortData)
1509 HubExtension->PortData =
NULL;
1512 DPRINT1(
"USBH_FdoRemoveDevice: call IoWMIRegistrationControl UNIMPLEMENTED. FIXME\n");
1532 DPRINT(
"USBH_FdoSurpriseRemoveDevice: HubExtension - %p, Irp - %p\n",
1536 if (!HubExtension->PortData ||
1537 !HubExtension->HubDescriptor)
1542 PortData = HubExtension->PortData;
1543 NumberPorts = HubExtension->HubDescriptor->bNumberOfPorts;
1551 PortExtension->
EnumFlags &= ~USBHUB_ENUM_FLAG_DEVICE_PRESENT;
1567 size_t Remaining =
sizeof(
Buffer);
1583 DPRINT(
"USBH_PdoQueryId: BusQueryDeviceID\n");
1587 DPRINT(
"USBH_PdoQueryId: USBHUB_PDO_FLAG_INIT_PORT_FAILED\n");
1593 L"USB\\Vid_0000&Pid_0000");
1602 L"USB\\Vid_%04x&Pid_%04x",
1617 DPRINT(
"USBH_PdoQueryId: BusQueryDeviceID - %S\n",
Id);
1621 DPRINT(
"USBH_PdoQueryId: BusQueryHardwareIDs\n");
1625 DPRINT(
"USBH_PdoQueryId: USBHUB_PDO_FLAG_INIT_PORT_FAILED\n");
1641 L"USB\\Vid_%04x&Pid_%04x&Rev_%04x",
1654 L"USB\\Vid_%04x&Pid_%04x",
1672 DPRINT(
"USBH_PdoQueryId: BusQueryHardwareID - %S\n",
Id);
1682 DPRINT(
"USBH_PdoQueryId: BusQueryCompatibleIDs\n");
1686 DPRINT(
"USBH_PdoQueryId: USBHUB_PDO_FLAG_INIT_PORT_FAILED\n");
1702 L"USB\\DevClass_%02x&SubClass_%02x&Prot_%02x",
1715 L"USB\\DevClass_%02x&SubClass_%02x",
1727 L"USB\\DevClass_%02x",
1747 L"USB\\Class_%02x&SubClass_%02x&Prot_%02x",
1760 L"USB\\Class_%02x&SubClass_%02x",
1789 DPRINT(
"USBH_PdoQueryId: BusQueryCompatibleID - %S\n",
Id);
1799 DPRINT(
"USBH_PdoQueryId: BusQueryInstanceID\n");
1801 if (PortExtension->SerialNumber)
1804 PortExtension->SN_DescriptorLength,
1812 PortExtension->SerialNumber,
1813 PortExtension->SN_DescriptorLength);
1818 Length =
sizeof(PortExtension->InstanceID) +
1828 PortExtension->InstanceID,
1829 sizeof(PortExtension->InstanceID));
1833 DPRINT(
"USBH_PdoQueryId: BusQueryInstanceID - %S\n",
Id);
1837 DPRINT1(
"USBH_PdoQueryId: unknown query id type 0x%lx\n",
IdType);
1838 return Irp->IoStatus.Status;
1868 DPRINT(
"USBH_PdoQueryDeviceText ... \n");
1877 return Irp->IoStatus.Status;
1888 iProduct = PortExtension->DeviceDescriptor.iProduct;
1890 if (PortExtension->DeviceHandle && iProduct &&
1891 !PortExtension->IgnoringHwSerial &&
1952 DPRINT(
"USBH_PdoQueryDeviceText: Descriptor->bString - %S\n",
1999 NumSymbols *
sizeof(
WCHAR));
2015 DPRINT(
"USBH_SymbolicLink ... \n");
2022 &PortExtension->SymbolicLinkName);
2028 PortExtension->SymbolicLinkName.Buffer,
2029 PortExtension->SymbolicLinkName.Length,
2039 NameBuffer = PortExtension->SymbolicLinkName.Buffer;
2046 ExFreePool(PortExtension->SymbolicLinkName.Buffer);
2048 PortExtension->SymbolicLinkName.Buffer =
NULL;
2065 DPRINT(
"USBH_RestoreDevice ... \n");
2067 HubExtension = PortExtension->HubExtension;
2075 ASSERT(PortExtension->PortNumber > 0);
2076 PortData = &HubExtension->
PortData[PortExtension->PortNumber - 1];
2078 if (PortExtension->Common.SelfDevice != PortData->
DeviceObject)
2085 PortExtension->PortNumber,
2091 for (ix = 0; ix < 3; ix++)
2094 PortExtension->PortNumber,
2107 PortExtension->PortPdoFlags &= ~USBHUB_PDO_FLAG_POWER_D3;
2111 PortExtension->PortPdoFlags &= ~USBHUB_PDO_FLAG_PORT_RESTORE_FAIL;
2131 DPRINT(
"USBH_PdoStartDevice: PortExtension - %p\n", PortExtension);
2133 if (!PortExtension->HubExtension &&
2136 PortExtension->HubExtension = PortExtension->RootHubExtension;
2139 HubExtension = PortExtension->HubExtension;
2145 PortExtension->DeviceHandle);
2150 Guid = &GUID_DEVINTERFACE_USB_HUB;
2154 Guid = &GUID_DEVINTERFACE_USB_DEVICE;
2171 PortExtension->CurrentPowerState.DeviceState =
PowerDeviceD0;
2173 DPRINT1(
"USBH_PdoStartDevice: call IoWMIRegistrationControl UNIMPLEMENTED. FIXME\n");
2187 PIRP IdleNotificationIrp;
2195 DPRINT(
"USBH_PdoRemoveDevice ... \n");
2197 PortDevice = PortExtension->Common.SelfDevice;
2198 PortExtension->HubExtension =
NULL;
2200 Port = PortExtension->PortNumber;
2204 HubExtension->CurrentPowerState.DeviceState !=
PowerDeviceD0 &&
2211 IdleNotificationIrp = PortExtension->IdleNotificationIrp;
2213 if (IdleNotificationIrp)
2215 PortExtension->IdleNotificationIrp =
NULL;
2216 PortExtension->PortPdoFlags &= ~USBHUB_PDO_FLAG_IDLE_NOTIFICATION;
2218 if (IdleNotificationIrp->Cancel)
2220 IdleNotificationIrp =
NULL;
2223 if (IdleNotificationIrp)
2229 WakeIrp = PortExtension->PdoWaitWakeIrp;
2233 PortExtension->PdoWaitWakeIrp =
NULL;
2234 PortExtension->PortPdoFlags &= ~USBHUB_PDO_FLAG_WAIT_WAKE;
2243 KeSetEvent(&HubExtension->PendingRequestEvent,
2252 if (IdleNotificationIrp)
2272 PortExtension->PortPdoFlags &= ~USBHUB_PDO_FLAG_REG_DEV_INTERFACE;
2284 if (HubExtension->PortData &&
2285 HubExtension->PortData[
Port - 1].DeviceObject == PortDevice)
2293 PortExtension->PortPdoFlags &= ~USBHUB_PDO_FLAG_DEVICE_STARTED;
2295 if (HubExtension && HubExtension->PortData)
2297 PortData = &HubExtension->PortData[
Port - 1];
2332 DPRINT1(
"USBH_PdoRemoveDevice: call IoWMIRegistrationControl UNIMPLEMENTED. FIXME\n");
2343 DPRINT(
"USBH_PdoRemoveDevice: call USBH_CheckIdleDeferred()\n");
2355 DPRINT1(
"USBH_PdoStopDevice: UNIMPLEMENTED. FIXME\n");
2371 DPRINT_PNP(
"USBH_FdoPnP: HubExtension - %p, Irp - %p, Minor - %X\n",
2388 DPRINT_PNP(
"USBH_FdoPnP: HubFlags - %lX\n", HubExtension->HubFlags);
2398 if ((HubExtension->CurrentPowerState.DeviceState ==
PowerDeviceD0) ||
2402 IsCheckIdle =
FALSE;
2406 DPRINT_PNP(
"USBH_FdoPnP: IsCheckIdle - TRUE\n");
2415 IsCheckIdle =
FALSE;
2421 DPRINT_PNP(
"FDO IRP_MN_QUERY_REMOVE_DEVICE\n");
2428 IsCheckIdle =
FALSE;
2435 DPRINT_PNP(
"FDO IRP_MN_CANCEL_REMOVE_DEVICE\n");
2442 IsCheckIdle =
FALSE;
2448 DPRINT_PNP(
"FDO IRP_MN_QUERY_STOP_DEVICE\n");
2454 DPRINT_PNP(
"FDO IRP_MN_CANCEL_STOP_DEVICE\n");
2460 DPRINT_PNP(
"FDO IRP_MN_QUERY_DEVICE_RELATIONS\n");
2471 DPRINT_PNP(
"USBH_FdoPnP: IsCheckIdle - TRUE\n");
2475 HubExtension->HubFlags &= ~USBHUB_FDO_FLAG_HUB_BUSY;
2484 DPRINT_PNP(
"FDO IRP_MN_QUERY_CAPABILITIES\n");
2503 DPRINT_PNP(
"FDO IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
2508 DPRINT_PNP(
"FDO IRP_MN_QUERY_DEVICE_TEXT\n");
2513 DPRINT_PNP(
"FDO IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
2543 DPRINT_PNP(
"FDO IRP_MN_QUERY_PNP_DEVICE_STATE\n");
2554 DPRINT_PNP(
"FDO IRP_MN_QUERY_BUS_INFORMATION\n");
2559 DPRINT_PNP(
"FDO IRP_MN_DEVICE_USAGE_NOTIFICATION\n");
2583 DPRINT_PNP(
"USBH_FdoPnP: call USBH_CheckIdleDeferred()\n");
2587 HubExtension->HubFlags &= ~USBHUB_FDO_FLAG_STATE_CHANGING;
2608 DPRINT_PNP(
"USBH_PdoPnP: PortExtension - %p, Irp - %p, Minor - %X\n",
2615 *IsCompleteIrp =
TRUE;
2624 DPRINT_PNP(
"PDO IRP_MN_QUERY_REMOVE_DEVICE\n");
2632 DPRINT_PNP(
"PDO IRP_MN_CANCEL_REMOVE_DEVICE\n");
2640 DPRINT_PNP(
"PDO IRP_MN_QUERY_STOP_DEVICE\n");
2644 DPRINT_PNP(
"PDO IRP_MN_CANCEL_STOP_DEVICE\n");
2648 DPRINT_PNP(
"PDO IRP_MN_QUERY_DEVICE_RELATIONS\n");
2652 return Irp->IoStatus.Status;
2663 DeviceRelation->
Count = 1;
2664 DeviceRelation->
Objects[0] = PortExtension->Common.SelfDevice;
2684 &USB_BUS_INTERFACE_USBDI_GUID))
2689 HubExtension = PortExtension->HubExtension;
2693 HubExtension = PortExtension->RootHubExtension;
2700 DPRINT_PNP(
"PDO IRP_MN_QUERY_CAPABILITIES\n");
2708 &PortExtension->Capabilities,
2726 DPRINT_PNP(
"PDO IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
2738 DPRINT_PNP(
"PDO IRP_MN_QUERY_DEVICE_TEXT\n");
2742 DPRINT_PNP(
"PDO IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n");
2775 DPRINT_PNP(
"PDO IRP_MN_QUERY_PNP_DEVICE_STATE\n");
2788 DPRINT_PNP(
"PDO IRP_MN_QUERY_BUS_INFORMATION\n");
2813 DPRINT_PNP(
"PDO IRP_MN_DEVICE_USAGE_NOTIFICATION\n");
2826 PortExtension->PortPdoFlags &= ~USBHUB_PDO_FLAG_REG_DEV_INTERFACE;
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define InterlockedIncrement
#define InterlockedDecrement
_In_ BUS_QUERY_ID_TYPE IdType
#define NT_SUCCESS(StatCode)
static const WCHAR DefaultId[]
VOID NTAPI USBHUB_DumpingIDs(IN PVOID Id)
NTSTATUS NTAPI USBH_StartHubFdoDevice(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp)
NTSTATUS NTAPI USBHUB_GetBusInterface(IN PDEVICE_OBJECT DeviceObject, OUT PUSB_BUS_INTERFACE_HUB_V5 BusInterface)
NTSTATUS NTAPI USBH_RestoreDevice(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN BOOLEAN IsKeepDeviceData)
NTSTATUS NTAPI USBH_PdoPnP(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN PIRP Irp, IN UCHAR Minor, OUT BOOLEAN *IsCompleteIrp)
NTSTATUS NTAPI USBH_QueryCapsComplete(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
NTSTATUS NTAPI USBH_IrpCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
NTSTATUS NTAPI USBH_OpenConfiguration(IN PUSBHUB_FDO_EXTENSION HubExtension)
NTSTATUS NTAPI USBH_HubPnPIrpComplete(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
NTSTATUS NTAPI USBH_PdoStopDevice(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN PIRP Irp)
NTSTATUS NTAPI USBH_PdoRemoveDevice(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN PUSBHUB_FDO_EXTENSION HubExtension)
VOID NTAPI USBH_QueryCapabilities(IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_CAPABILITIES DeviceCapabilities)
NTSTATUS NTAPI USBHUB_GetBusInterfaceUSBDI(IN PDEVICE_OBJECT DeviceObject, OUT PUSB_BUS_INTERFACE_USBDI_V2 BusInterfaceUSBDI)
NTSTATUS NTAPI USBH_FdoStartDevice(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp)
VOID NTAPI USBH_FdoCleanup(IN PUSBHUB_FDO_EXTENSION HubExtension)
NTSTATUS NTAPI USBH_PdoStartDevice(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN PIRP Irp)
NTSTATUS NTAPI USBD_Initialize20Hub(IN PUSBHUB_FDO_EXTENSION HubExtension)
NTSTATUS NTAPI USBH_FdoRemoveDevice(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp)
NTSTATUS NTAPI USBH_AbortInterruptPipe(IN PUSBHUB_FDO_EXTENSION HubExtension)
NTSTATUS NTAPI USBH_FdoQueryBusRelations(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp)
NTSTATUS NTAPI USBH_PdoQueryDeviceText(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN PIRP Irp)
NTSTATUS NTAPI USBH_SymbolicLink(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN const GUID *InterfaceClassGuid, IN BOOLEAN IsEnable)
NTSTATUS NTAPI USBH_FdoStopDevice(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp)
NTSTATUS NTAPI USBH_PdoQueryId(IN PUSBHUB_PORT_PDO_EXTENSION PortExtension, IN PIRP Irp)
NTSTATUS NTAPI USBH_FdoPnP(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp, IN UCHAR Minor)
VOID NTAPI USBH_FdoSurpriseRemoveDevice(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp)
VOID NTAPI USBH_HubCancelWakeIrp(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp)
NTSTATUS NTAPI USBH_HubSetD0(IN PUSBHUB_FDO_EXTENSION HubExtension)
VOID NTAPI USBH_HubCompletePortWakeIrps(IN PUSBHUB_FDO_EXTENSION HubExtension, IN NTSTATUS NtStatus)
VOID NTAPI USBH_CompletePowerIrp(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP Irp, IN NTSTATUS NtStatus)
#define InterlockedExchangePointer(Target, Value)
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define IsListEmpty(ListHead)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
struct _DEVICE_OBJECT * PDEVICE_OBJECT
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeReleaseSpinLock(sl, irql)
#define KeSetEvent(pEvt, foo, foo2)
#define KeAcquireSpinLock(sl, irql)
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
#define KeDelayExecutionThread(mode, foo, t)
#define KeInitializeSpinLock(sl)
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
struct _USB_BUS_INTERFACE_HUB_V5 USB_BUS_INTERFACE_HUB_V5
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
#define USB_BUSIF_HUB_VERSION_5
USB_BUSIFFN_INITIALIZE_20HUB * PUSB_BUSIFFN_INITIALIZE_20HUB
_In_ PUSB_DEVICE_HANDLE _In_ ULONG TtCount
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI void WINAPI DbgBreakPoint(void)
#define LOW_REALTIME_PRIORITY
IoSetCancelRoutine(Irp, CancelRoutine)
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
#define ExFreePoolWithTag(_P, _T)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define IRP_MN_SURPRISE_REMOVAL
#define IoCopyCurrentIrpStackLocationToNext(Irp)
VOID NTAPI IoDetachDevice(IN PDEVICE_OBJECT TargetDevice)
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
#define IoCompleteRequest
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
BOOLEAN NTAPI IoCancelIrp(IN PIRP Irp)
VOID NTAPI IoFreeIrp(IN PIRP Irp)
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
VOID NTAPI IoAcquireCancelSpinLock(OUT PKIRQL Irql)
#define POWER_SYSTEM_MAXIMUM
enum _DEVICE_POWER_STATE DEVICE_POWER_STATE
#define STATUS_DELETE_PENDING
#define STATUS_NOT_SUPPORTED
#define STATUS_NOT_IMPLEMENTED
NTSTRSAFEVAPI RtlStringCbPrintfExW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _Outptr_opt_result_bytebuffer_(*pcbRemaining) NTSTRSAFE_PWSTR *ppszDestEnd, _Out_opt_ size_t *pcbRemaining, _In_ STRSAFE_DWORD dwFlags, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
VOID NTAPI IoInvalidateDeviceRelations(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_RELATION_TYPE Type)
struct _INTERFACE * PINTERFACE
#define LANGIDFROMLCID(l)
#define SUBLANG_ENGLISH_US
VOID NTAPI KeInitializeSemaphore(IN PKSEMAPHORE Semaphore, IN LONG Count, IN LONG Limit)
LONG NTAPI KeReleaseSemaphore(IN PKSEMAPHORE Semaphore, IN KPRIORITY Increment, IN LONG Adjustment, IN BOOLEAN Wait)
#define STATUS_MORE_PROCESSING_REQUIRED
const KSDEVICE_DESCRIPTOR DeviceDescriptor
base of all file and directory entries
PDEVICE_OBJECT SelfDevice
PDEVICE_OBJECT Objects[1]
struct _IO_STACK_LOCATION::@3974::@4001 DeviceCapabilities
struct _IO_STACK_LOCATION::@3974::@4000 QueryInterface
struct _IO_STACK_LOCATION::@3974::@4005 QueryId
struct _IO_STACK_LOCATION::@3974::@4006 QueryDeviceText
struct _IO_STACK_LOCATION::@3974::@3999 QueryDeviceRelations
union _IO_STACK_LOCATION::@1575 Parameters
USBD_PIPE_HANDLE PipeHandle
struct _URB_SELECT_CONFIGURATION UrbSelectConfiguration
PUSBD_INTERFACE_INFORMATION Interface
PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor
PUSBHUB_PORT_DATA PortData
COMMON_DEVICE_EXTENSION Common
PDEVICE_OBJECT RootHubPdo
USB_CONNECTION_STATUS ConnectionStatus
USB_PORT_STATUS_AND_CHANGE PortStatus
PDEVICE_OBJECT DeviceObject
PUSB_DEVICE_HANDLE DeviceHandle
PUSBHUB_FDO_EXTENSION HubExtension
static VOID ErrorExit(LPTSTR lpszMessage)
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_NO_SUCH_DEVICE
#define STATUS_UNSUCCESSFUL
#define STATUS_INVALID_DEVICE_STATE
#define STATUS_INSUFFICIENT_RESOURCES
USHORT CurrentConnectStatus
USB_PORT_STATUS PortStatus
USB_20_PORT_STATUS Usb20PortStatus
#define MAXIMUM_USB_STRING_LENGTH
#define USB_DEVICE_CLASS_HUB
enum _USB_DEVICE_TYPE USB_DEVICE_TYPE
#define URB_FUNCTION_ABORT_PIPE
#define USB_BUSIF_USBDI_VERSION_2
struct _USB_BUS_INTERFACE_USBDI_V2 USB_BUS_INTERFACE_USBDI_V2
PURB NTAPI USBD_CreateConfigurationRequestEx(PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, PUSBD_INTERFACE_LIST_ENTRY InterfaceList)
PUSB_INTERFACE_DESCRIPTOR NTAPI USBD_ParseConfigurationDescriptorEx(PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, PVOID StartPosition, LONG InterfaceNumber, LONG AlternateSetting, LONG InterfaceClass, LONG InterfaceSubClass, LONG InterfaceProtocol)
ULONG NTAPI USBD_GetPdoRegistryParameter(PDEVICE_OBJECT PhysicalDeviceObject, PVOID Parameter, ULONG ParameterLength, PWCHAR KeyName, ULONG KeyNameLength)
_In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceList
NTSTATUS NTAPI USBH_SubmitStatusChangeTransfer(IN PUSBHUB_FDO_EXTENSION HubExtension)
NTSTATUS NTAPI USBH_WriteFailReasonID(IN PDEVICE_OBJECT DeviceObject, IN ULONG FailReason)
PWSTR GenericUSBDeviceString
VOID NTAPI USBHUB_SetDeviceHandleData(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PDEVICE_OBJECT UsbDevicePdo, IN PVOID DeviceHandle)
NTSTATUS NTAPI USBH_SyncGetHubDescriptor(IN PUSBHUB_FDO_EXTENSION HubExtension)
NTSTATUS NTAPI USBD_RemoveDeviceEx(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PUSB_DEVICE_HANDLE DeviceHandle, IN ULONG Flags)
VOID NTAPI USBH_CompleteIrp(IN PIRP Irp, IN NTSTATUS CompleteStatus)
NTSTATUS NTAPI USBD_UnRegisterRootHubCallBack(IN PUSBHUB_FDO_EXTENSION HubExtension)
NTSTATUS NTAPI USBH_CheckDeviceLanguage(IN PDEVICE_OBJECT DeviceObject, IN USHORT LanguageId)
NTSTATUS NTAPI USBH_GetDeviceDescriptor(IN PDEVICE_OBJECT DeviceObject, IN PUSB_DEVICE_DESCRIPTOR HubDeviceDescriptor)
NTSTATUS NTAPI USBH_SyncGetRootHubPdo(IN PDEVICE_OBJECT DeviceObject, IN OUT PDEVICE_OBJECT *OutPdo1, IN OUT PDEVICE_OBJECT *OutPdo2)
NTSTATUS NTAPI USBH_Wait(IN ULONG Milliseconds)
VOID NTAPI USBH_CheckIdleDeferred(IN PUSBHUB_FDO_EXTENSION HubExtension)
NTSTATUS NTAPI USBH_SyncGetStringDescriptor(IN PDEVICE_OBJECT DeviceObject, IN UCHAR Index, IN USHORT LanguageId, IN PUSB_STRING_DESCRIPTOR Descriptor, IN ULONG NumberOfBytes, IN PULONG OutLength, IN BOOLEAN IsValidateLength)
PUSBHUB_PORT_PDO_EXTENSION NTAPI PdoExt(IN PDEVICE_OBJECT DeviceObject)
VOID NTAPI USBH_HubCancelIdleIrp(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PIRP IdleIrp)
NTSTATUS NTAPI USBH_SyncGetPortStatus(IN PUSBHUB_FDO_EXTENSION HubExtension, IN USHORT Port, IN PUSB_PORT_STATUS_AND_CHANGE PortStatus, IN ULONG Length)
PUSB_DEVICE_HANDLE NTAPI USBH_SyncGetDeviceHandle(IN PDEVICE_OBJECT DeviceObject)
VOID NTAPI USBHUB_FlushAllTransfers(IN PUSBHUB_FDO_EXTENSION HubExtension)
NTSTATUS NTAPI USBH_GetConfigurationDescriptor(IN PDEVICE_OBJECT DeviceObject, IN PUSB_CONFIGURATION_DESCRIPTOR *OutDescriptor)
NTSTATUS NTAPI USBD_RegisterRootHubCallBack(IN PUSBHUB_FDO_EXTENSION HubExtension)
NTSTATUS NTAPI USBH_CreateDevice(IN PUSBHUB_FDO_EXTENSION HubExtension, IN USHORT Port, IN USB_PORT_STATUS UsbPortStatus, IN ULONG IsWait)
NTSTATUS NTAPI USBH_SyncDisablePort(IN PUSBHUB_FDO_EXTENSION HubExtension, IN USHORT Port)
NTSTATUS NTAPI USBH_ResetDevice(IN PUSBHUB_FDO_EXTENSION HubExtension, IN USHORT Port, IN BOOLEAN IsKeepDeviceData, IN BOOLEAN IsWait)
NTSTATUS NTAPI USBH_GetDeviceType(IN PUSBHUB_FDO_EXTENSION HubExtension, IN PUSB_DEVICE_HANDLE DeviceHandle, OUT USB_DEVICE_TYPE *OutDeviceType)
NTSTATUS NTAPI USBH_SyncResetPort(IN PUSBHUB_FDO_EXTENSION HubExtension, IN USHORT Port)
NTSTATUS NTAPI USBH_SyncGetHubCount(IN PDEVICE_OBJECT DeviceObject, IN OUT PULONG OutHubCount)
NTSTATUS NTAPI USBH_SetPdoRegistryParameter(IN PDEVICE_OBJECT DeviceObject, IN PCWSTR ValueName, IN PVOID Data, IN ULONG DataSize, IN ULONG Type, IN ULONG DevInstKeyType)
NTSTATUS NTAPI USBH_FdoSyncSubmitUrb(IN PDEVICE_OBJECT FdoDevice, IN PURB Urb)
NTSTATUS NTAPI USBH_SyncPowerOnPorts(IN PUSBHUB_FDO_EXTENSION HubExtension)
NTSTATUS NTAPI USBH_PassIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
BOOLEAN NTAPI USBH_HubIsBusPowered(IN PDEVICE_OBJECT DeviceObject, IN PUSB_CONFIGURATION_DESCRIPTOR HubConfigDescriptor)
NTSTATUS NTAPI USBH_SyncClearPortStatus(IN PUSBHUB_FDO_EXTENSION HubExtension, IN USHORT Port, IN USHORT RequestValue)
#define USBHUB_FDO_FLAG_DEVICE_STARTED
#define USBHUB_FDO_FLAG_MULTIPLE_TTS
#define USBHUB_PDO_FLAG_DEVICE_STARTED
#define USBHUB_FDO_FLAG_DEVICE_STOPPING
#define USBHUB_PDO_FLAG_OVERCURRENT_PORT
#define USBHUB_FDO_FLAG_DEVICE_SUSPENDED
#define USBHUB_FDO_FLAG_USB20_HUB
#define USBHUB_PDO_FLAG_HS_USB1_DUALMODE
#define USBHUB_FDO_FLAG_WITEM_INIT
#define USBHUB_FDO_FLAG_ESD_RECOVERING
#define USBHUB_PDO_FLAG_INSUFFICIENT_PWR
#define USBHUB_PDO_FLAG_PORT_HIGH_SPEED
#define USBHUB_PDO_FLAG_PORT_LOW_SPEED
#define USBHUB_ENUM_FLAG_DEVICE_PRESENT
#define USBHUB_FAIL_NESTED_TOO_DEEPLY
#define USBHUB_PDO_FLAG_HUB_DEVICE
#define USBHUB_FEATURE_C_PORT_CONNECTION
#define USBHUB_FDO_FLAG_GOING_IDLE
#define USBHUB_FDO_FLAG_REMOTE_WAKEUP
#define USBHUB_FDO_FLAG_DEVICE_REMOVED
#define USBHUB_FDO_FLAG_DO_ENUMERATION
#define USBHUB_FDO_FLAG_DEVICE_FAILED
#define USBHUB_PDO_FLAG_MULTI_INTERFACE
#define USBHUB_FDO_FLAG_HUB_BUSY
#define USBHUB_PDO_FLAG_PORT_RESTORE_FAIL
#define USBHUB_FDO_FLAG_WAIT_IDLE_REQUEST
#define USBHUB_PDO_FLAG_ENUMERATED
#define USBHUB_PDO_FLAG_POWER_D3
#define USBHUB_ENUM_FLAG_GHOST_DEVICE
#define USBHUB_PDO_FLAG_NOT_CONNECTED
#define USBHUB_PDO_FLAG_REG_DEV_INTERFACE
#define USBHUB_FAIL_NO_FAIL
#define USBHUB_MAX_CASCADE_LEVELS
#define USBHUB_FDO_FLAG_DEVICE_STOPPED
#define USBHUB_PDO_FLAG_INIT_PORT_FAILED
#define USBHUB_PDO_FLAG_DELETE_PENDING
@ DeviceFailedEnumeration
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_ WDFDRIVER _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT _In_opt_ PDEVICE_OBJECT Pdo
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
_In_ WDFUSBINTERFACE _In_ UCHAR _Out_ PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor
#define IsEqualGUIDAligned(guid1, guid2)
#define DeviceCapabilities
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
_In_ CONST GUID * InterfaceClassGuid
#define PLUGPLAY_REGKEY_DEVICE
#define IRP_MN_CANCEL_STOP_DEVICE
#define STATUS_CONTINUE_COMPLETION
#define IRP_MN_QUERY_PNP_DEVICE_STATE
#define IRP_MN_QUERY_INTERFACE
#define IRP_MN_START_DEVICE
#define PNP_DEVICE_FAILED
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
#define IRP_MN_READ_CONFIG
#define IRP_MN_WRITE_CONFIG
#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS
#define IRP_MN_REMOVE_DEVICE
#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IRP_MN_QUERY_STOP_DEVICE
#define IRP_MN_QUERY_DEVICE_TEXT
#define IRP_MN_QUERY_CAPABILITIES
#define IRP_MN_QUERY_RESOURCES
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define IRP_MN_STOP_DEVICE
@ DeviceTextLocationInformation
enum _DEVICE_TEXT_TYPE DEVICE_TEXT_TYPE
enum _DEVICE_RELATION_TYPE DEVICE_RELATION_TYPE
#define IRP_MN_QUERY_BUS_INFORMATION
#define IRP_MN_QUERY_REMOVE_DEVICE
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
#define ObDereferenceObject
#define ObReferenceObject