win-pvdrivers

changeset 932:f03bcaa67233

fix compile warnings
author James Harper <james.harper@bendigoit.com.au>
date Sun Jun 12 14:05:50 2011 +1000 (2011-06-12)
parents b655cd52f2ad
children f64a6d173e8d
files xenusb/xenusb_devurb.c xenusb/xenusb_fdo.c xenusb/xenusb_hub.c
line diff
     1.1 --- a/xenusb/xenusb_devurb.c	Sun Jun 12 00:17:30 2011 +1000
     1.2 +++ b/xenusb/xenusb_devurb.c	Sun Jun 12 14:05:50 2011 +1000
     1.3 @@ -100,14 +100,6 @@ XenUsb_UrbCallback(usbif_shadow_t *shado
     1.4        KdPrint((__DRIVER_NAME "     URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER\n"));
     1.5      }
     1.6      shadow->urb->UrbBulkOrInterruptTransfer.TransferBufferLength = shadow->total_length;
     1.7 -{
     1.8 -  PUCHAR grr;
     1.9 -  if (shadow->urb->UrbBulkOrInterruptTransfer.TransferBufferMDL)
    1.10 -    grr = MmGetSystemAddressForMdl(shadow->urb->UrbBulkOrInterruptTransfer.TransferBufferMDL);
    1.11 -  else
    1.12 -    grr = shadow->urb->UrbBulkOrInterruptTransfer.TransferBuffer;
    1.13 -  FUNCTION_MSG("data = %02x %02x %02x %02x\n", (ULONG)grr[0], (ULONG)grr[1], (ULONG)grr[2], (ULONG)grr[3]);
    1.14 -}
    1.15      break;
    1.16    case URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL:
    1.17      KdPrint((__DRIVER_NAME "     URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL\n"));
     2.1 --- a/xenusb/xenusb_fdo.c	Sun Jun 12 00:17:30 2011 +1000
     2.2 +++ b/xenusb/xenusb_fdo.c	Sun Jun 12 14:05:50 2011 +1000
     2.3 @@ -98,11 +98,6 @@ XenUsb_ExecuteRequest(
     2.4    FUNCTION_MSG("MmGetMdlByteCount = %d\n", MmGetMdlByteCount(mdl));
     2.5    FUNCTION_MSG("MmGetMdlByteOffset = %d\n", MmGetMdlByteOffset(mdl));
     2.6    
     2.7 -{
     2.8 -  PUCHAR grr = MmGetSystemAddressForMdl(mdl);
     2.9 -  FUNCTION_MSG("data = %02x %02x %02x %02x\n", (ULONG)grr[0], (ULONG)grr[1], (ULONG)grr[2], (ULONG)grr[3]);
    2.10 -}
    2.11 -  
    2.12    remaining = MmGetMdlByteCount(mdl);
    2.13    offset = (USHORT)MmGetMdlByteOffset(mdl);
    2.14    shadow->req.buffer_length = (USHORT)MmGetMdlByteCount(mdl);
     3.1 --- a/xenusb/xenusb_hub.c	Sun Jun 12 00:17:30 2011 +1000
     3.2 +++ b/xenusb/xenusb_hub.c	Sun Jun 12 14:05:50 2011 +1000
     3.3 @@ -214,14 +214,14 @@ XenUsbHub_EvtIoInternalDeviceControl(
     3.4    PXENUSB_PDO_DEVICE_DATA xupdd = GetXupdd(device);
     3.5    WDF_REQUEST_PARAMETERS wrp;
     3.6    PURB urb;
     3.7 +#if (NTDDI_VERSION >= NTDDI_VISTA)
     3.8    PUSB_START_FAILDATA usfd;
     3.9 -#if (NTDDI_VERSION >= NTDDI_VISTA)
    3.10    PHUB_DEVICE_CONFIG_INFO hdci;
    3.11    PUSB_TOPOLOGY_ADDRESS uta;
    3.12    PUSB_HUB_NAME uhn;
    3.13 +  size_t length;
    3.14  #endif
    3.15    xenusb_device_t *usb_device;
    3.16 -  ULONG length;
    3.17  
    3.18    UNREFERENCED_PARAMETER(input_buffer_length);
    3.19    UNREFERENCED_PARAMETER(output_buffer_length);
    3.20 @@ -301,7 +301,7 @@ XenUsbHub_EvtIoInternalDeviceControl(
    3.21    case IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE_EX: /* incomplete probably */
    3.22      FUNCTION_MSG("IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE_EX (returning %p)\n", xupdd->usb_device);
    3.23      *(PVOID *)wrp.Parameters.Others.Arg1 = xupdd->usb_device;
    3.24 -    *(ULONG_PTR *)wrp.Parameters.Others.Arg2 = (ULONG_PTR)0x123456789ABCDEF;
    3.25 +    *(ULONG_PTR *)wrp.Parameters.Others.Arg2 = (ULONG_PTR)0x123456789ABCDEFL;
    3.26      status = STATUS_SUCCESS;
    3.27      break;
    3.28    case IOCTL_INTERNAL_USB_GET_TOPOLOGY_ADDRESS:
    3.29 @@ -1203,6 +1203,10 @@ XenUsbHub_UBIH_InitializeUsbDeviceEx(
    3.30   PUSB_ID_ERROR_INFORMATION IdErrInfo)
    3.31  {
    3.32    NTSTATUS status;
    3.33 +  
    3.34 +  UNREFERENCED_PARAMETER(BusContext);
    3.35 +  UNREFERENCED_PARAMETER(DeviceHandle);
    3.36 +  UNREFERENCED_PARAMETER(IdErrInfo);
    3.37    FUNCTION_ENTER();
    3.38    FUNCTION_MSG("IdErrInfo->Version = %d\n", IdErrInfo->Version);
    3.39    FUNCTION_MSG("IdErrInfo->PathError = %d\n", IdErrInfo->PathError);
    3.40 @@ -1256,6 +1260,8 @@ XenUsbHub_UBIH_CaculatePipeBandwidth(
    3.41    USB_DEVICE_SPEED DeviceSpeed)
    3.42  {
    3.43    UNREFERENCED_PARAMETER(BusContext);
    3.44 +  UNREFERENCED_PARAMETER(PipeInfo);
    3.45 +  UNREFERENCED_PARAMETER(DeviceSpeed);
    3.46    FUNCTION_ENTER();
    3.47    FUNCTION_EXIT();
    3.48    return (ULONG)-1;
    3.49 @@ -1267,6 +1273,7 @@ XenUsbHub_UBIH_SetBusSystemWakeMode(
    3.50    ULONG Mode)
    3.51  {
    3.52    UNREFERENCED_PARAMETER(BusContext);
    3.53 +  UNREFERENCED_PARAMETER(Mode);
    3.54    FUNCTION_ENTER();
    3.55    FUNCTION_EXIT();
    3.56    return;
    3.57 @@ -1280,6 +1287,9 @@ XenUsbHub_UBIH_SetDeviceFlag(
    3.58    ULONG ValueLength)
    3.59  {
    3.60    UNREFERENCED_PARAMETER(BusContext);
    3.61 +  UNREFERENCED_PARAMETER(DeviceFlagGuid);
    3.62 +  UNREFERENCED_PARAMETER(ValueData);
    3.63 +  UNREFERENCED_PARAMETER(ValueLength);
    3.64    FUNCTION_ENTER();
    3.65    FUNCTION_EXIT();
    3.66    return;
    3.67 @@ -1293,6 +1303,9 @@ XenUsbHub_UBIH_HubTestPoint(
    3.68    PVOID test_data)
    3.69  {
    3.70    UNREFERENCED_PARAMETER(bus_context);
    3.71 +  UNREFERENCED_PARAMETER(device_handle);
    3.72 +  UNREFERENCED_PARAMETER(op_code);
    3.73 +  UNREFERENCED_PARAMETER(test_data);
    3.74    FUNCTION_ENTER();
    3.75    FUNCTION_MSG("device_handle = %p\n", device_handle);
    3.76    FUNCTION_MSG("op_code = %p\n", op_code);
    3.77 @@ -1310,6 +1323,10 @@ XenUsbHub_UBIH_GetDevicePerformanceInfo(
    3.78    PULONG LengthOfDataCopied)
    3.79  {
    3.80    UNREFERENCED_PARAMETER(BusContext);
    3.81 +  UNREFERENCED_PARAMETER(DeviceHandle);
    3.82 +  UNREFERENCED_PARAMETER(DeviceInformationBuffer);
    3.83 +  UNREFERENCED_PARAMETER(DeviceInformationBufferLength);
    3.84 +  UNREFERENCED_PARAMETER(LengthOfDataCopied);
    3.85    FUNCTION_ENTER();
    3.86    FUNCTION_EXIT();
    3.87    return STATUS_UNSUCCESSFUL;
    3.88 @@ -1332,6 +1349,8 @@ XenUsbHub_UBIH_GetDeviceAddress(
    3.89    PUSHORT DeviceAddress)
    3.90  {
    3.91    UNREFERENCED_PARAMETER(BusContext);
    3.92 +  UNREFERENCED_PARAMETER(DeviceHandle);
    3.93 +  UNREFERENCED_PARAMETER(DeviceAddress);
    3.94    FUNCTION_ENTER();
    3.95    FUNCTION_EXIT();
    3.96    return STATUS_UNSUCCESSFUL;
    3.97 @@ -1345,6 +1364,9 @@ XenUsbHub_UBIH_RefDeviceHandle(
    3.98    ULONG Tag)
    3.99  {
   3.100    UNREFERENCED_PARAMETER(BusContext);
   3.101 +  UNREFERENCED_PARAMETER(DeviceHandle);
   3.102 +  UNREFERENCED_PARAMETER(Object);
   3.103 +  UNREFERENCED_PARAMETER(Tag);
   3.104    FUNCTION_ENTER();
   3.105    FUNCTION_EXIT();
   3.106    return STATUS_UNSUCCESSFUL;
   3.107 @@ -1358,6 +1380,9 @@ XenUsbHub_UBIH_DerefDeviceHandle(
   3.108    ULONG Tag)
   3.109  {
   3.110    UNREFERENCED_PARAMETER(BusContext);
   3.111 +  UNREFERENCED_PARAMETER(DeviceHandle);
   3.112 +  UNREFERENCED_PARAMETER(Object);
   3.113 +  UNREFERENCED_PARAMETER(Tag);
   3.114    FUNCTION_ENTER();
   3.115    FUNCTION_MSG("This should do something\n");
   3.116    FUNCTION_EXIT();
   3.117 @@ -1371,6 +1396,8 @@ XenUsbHub_UBIH_SetDeviceHandleIdleReadyS
   3.118    ULONG NewIdleReadyState)
   3.119  {
   3.120    UNREFERENCED_PARAMETER(BusContext);
   3.121 +  UNREFERENCED_PARAMETER(DeviceHandle);
   3.122 +  UNREFERENCED_PARAMETER(NewIdleReadyState);
   3.123    FUNCTION_ENTER();
   3.124    FUNCTION_EXIT();
   3.125    return (ULONG)-1;
   3.126 @@ -1389,6 +1416,14 @@ XenUsbHub_UBIH_CreateUsbDeviceV7(
   3.127      PUNICODE_STRING PhysicalDeviceObjectName)
   3.128  {
   3.129    UNREFERENCED_PARAMETER(BusContext);
   3.130 +  UNREFERENCED_PARAMETER(NewDeviceHandle);
   3.131 +  UNREFERENCED_PARAMETER(HsHubDeviceHandle);
   3.132 +  UNREFERENCED_PARAMETER(PortStatus);
   3.133 +  UNREFERENCED_PARAMETER(PortPath);
   3.134 +  UNREFERENCED_PARAMETER(CdErrorInfo);
   3.135 +  UNREFERENCED_PARAMETER(TtPortNumber);
   3.136 +  UNREFERENCED_PARAMETER(PdoDeviceObject);
   3.137 +  UNREFERENCED_PARAMETER(PhysicalDeviceObjectName);
   3.138    FUNCTION_ENTER();
   3.139    FUNCTION_EXIT();
   3.140    return STATUS_UNSUCCESSFUL;
   3.141 @@ -1401,6 +1436,8 @@ XenUsbHub_UBIH_GetContainerIdForPort(
   3.142    LPGUID ContainerId)
   3.143  {
   3.144    UNREFERENCED_PARAMETER(BusContext);
   3.145 +  UNREFERENCED_PARAMETER(PortNumber);
   3.146 +  UNREFERENCED_PARAMETER(ContainerId);
   3.147    FUNCTION_ENTER();
   3.148    FUNCTION_EXIT();
   3.149    return STATUS_UNSUCCESSFUL;
   3.150 @@ -1413,6 +1450,8 @@ XenUsbHub_UBIH_SetContainerIdForPort(
   3.151    LPGUID ContainerId)
   3.152  {
   3.153    UNREFERENCED_PARAMETER(BusContext);
   3.154 +  UNREFERENCED_PARAMETER(PortNumber);
   3.155 +  UNREFERENCED_PARAMETER(ContainerId);
   3.156    FUNCTION_ENTER();
   3.157    FUNCTION_EXIT();
   3.158    return STATUS_UNSUCCESSFUL;
   3.159 @@ -1424,6 +1463,7 @@ XenUsbHub_UBIH_AbortAllDevicePipes(
   3.160    PUSB_DEVICE_HANDLE DeviceHandle)
   3.161  {
   3.162    UNREFERENCED_PARAMETER(BusContext);
   3.163 +  UNREFERENCED_PARAMETER(DeviceHandle);
   3.164    FUNCTION_ENTER();
   3.165    FUNCTION_EXIT();
   3.166    return STATUS_UNSUCCESSFUL;
   3.167 @@ -1436,6 +1476,8 @@ XenUsbHub_UBIH_SetDeviceErrataFlag(
   3.168    ULONG DeviceErrataFlag)
   3.169  {
   3.170    UNREFERENCED_PARAMETER(BusContext);
   3.171 +  UNREFERENCED_PARAMETER(DeviceHandle);
   3.172 +  UNREFERENCED_PARAMETER(DeviceErrataFlag);
   3.173    FUNCTION_ENTER();
   3.174    FUNCTION_EXIT();
   3.175    return;
   3.176 @@ -1579,6 +1621,13 @@ XenUsbHub_UBIU_QueryControllerType(
   3.177    PUCHAR PciProgIf)
   3.178  {
   3.179    UNREFERENCED_PARAMETER(BusContext);
   3.180 +  UNREFERENCED_PARAMETER(HcdiOptionFlags);
   3.181 +  UNREFERENCED_PARAMETER(PciVendorId);
   3.182 +  UNREFERENCED_PARAMETER(PciDeviceId);
   3.183 +  UNREFERENCED_PARAMETER(PciClass);
   3.184 +  UNREFERENCED_PARAMETER(PciSubClass);
   3.185 +  UNREFERENCED_PARAMETER(PciRevisionId);
   3.186 +  UNREFERENCED_PARAMETER(PciProgIf);
   3.187    FUNCTION_ENTER();
   3.188    FUNCTION_EXIT();
   3.189    return STATUS_UNSUCCESSFUL;
   3.190 @@ -1669,98 +1718,18 @@ XenUsbHub_ProcessHubInterruptEvent(xenus
   3.191    return;
   3.192  }
   3.193  
   3.194 -#if 0
   3.195 -static VOID
   3.196 -XenUsbHub_HubInterruptTimer(WDFTIMER timer)
   3.197 -{
   3.198 -  NTSTATUS status;
   3.199 -  xenusb_endpoint_t *endpoint = *GetEndpoint(timer);
   3.200 -  WDFDEVICE pdo_device = endpoint->interface->config->device->pdo_device;
   3.201 -  PXENUSB_PDO_DEVICE_DATA xupdd = GetXupdd(pdo_device);
   3.202 -  PXENUSB_DEVICE_DATA xudd = GetXudd(xupdd->wdf_device_bus_fdo);
   3.203 -  WDF_REQUEST_PARAMETERS wrp;
   3.204 -  WDFREQUEST request;
   3.205 -  PURB urb;
   3.206 -  ULONG i;
   3.207 -  
   3.208 -  //FUNCTION_ENTER();
   3.209 -  WdfSpinLockAcquire(endpoint->lock);
   3.210 -  status = WdfIoQueueRetrieveNextRequest(endpoint->queue, &request);
   3.211 -  if (status == STATUS_NO_MORE_ENTRIES)
   3.212 -  {
   3.213 -    WdfTimerStop(timer, FALSE);
   3.214 -    WdfSpinLockRelease(endpoint->lock);
   3.215 -    //KdPrint((__DRIVER_NAME "      No More Entries\n", status));
   3.216 -    //FUNCTION_EXIT();
   3.217 -    return;
   3.218 -  }
   3.219 -  if (!NT_SUCCESS(status))
   3.220 -  {
   3.221 -    WdfTimerStop(timer, FALSE);
   3.222 -    WdfSpinLockRelease(endpoint->lock);
   3.223 -    KdPrint((__DRIVER_NAME "      Failed to get request from queue %08x\n", status));
   3.224 -    //FUNCTION_EXIT();
   3.225 -    return;
   3.226 -  }
   3.227 -  
   3.228 -  WDF_REQUEST_PARAMETERS_INIT(&wrp);
   3.229 -  WdfRequestGetParameters(request, &wrp);
   3.230 -
   3.231 -  urb = (PURB)wrp.Parameters.Others.Arg1;
   3.232 -  ASSERT(urb);
   3.233 -  ASSERT(urb->UrbHeader.Function == URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER);
   3.234 -  RtlZeroMemory(urb->UrbBulkOrInterruptTransfer.TransferBuffer, urb->UrbBulkOrInterruptTransfer.TransferBufferLength);
   3.235 -  if (urb->UrbBulkOrInterruptTransfer.TransferFlags & (USBD_TRANSFER_DIRECTION_IN | USBD_SHORT_TRANSFER_OK))
   3.236 -  {
   3.237 -    BOOLEAN port_change_flag = FALSE;
   3.238 -    // check for hub change too
   3.239 -    //((PUCHAR)urb->UrbBulkOrInterruptTransfer.TransferBuffer)[0] |= 1;
   3.240 -    urb->UrbBulkOrInterruptTransfer.TransferBufferLength = 0;
   3.241 -    for (i = 0; i < xudd->num_ports; i++)
   3.242 -    {
   3.243 -#if 0
   3.244 -      if (xudd->ports[i].port_status & (1 << PORT_RESET))
   3.245 -      {
   3.246 -        if (xudd->ports[i].reset_counter-- == 0)
   3.247 -        {
   3.248 -          xudd->ports[i].port_status &= ~(1 << PORT_RESET);
   3.249 -          xudd->ports[i].port_status |= (1 << PORT_ENABLE);
   3.250 -          xudd->ports[i].port_change |= (1 << PORT_RESET);
   3.251 -        }
   3.252 -        FUNCTION_MSG("reset counter = %d\n", xudd->ports[i].reset_counter);
   3.253 -      }
   3.254 -#endif
   3.255 -      if (xudd->ports[i].port_change)
   3.256 -      {
   3.257 -        FUNCTION_MSG("Port change on port %d - status = %04x, change = %04x\n",
   3.258 -          xudd->ports[i].port_number, xudd->ports[i].port_status, xudd->ports[i].port_change);
   3.259 -        ((PUCHAR)urb->UrbBulkOrInterruptTransfer.TransferBuffer)[xudd->ports[i].port_number >> 3] |= 1 << (xudd->ports[i].port_number & 7);
   3.260 -        port_change_flag = TRUE;
   3.261 -      }
   3.262 -    }
   3.263 -    if (port_change_flag)
   3.264 -      urb->UrbBulkOrInterruptTransfer.TransferBufferLength = 2;
   3.265 -    urb->UrbHeader.Status = USBD_STATUS_SUCCESS;
   3.266 -    WdfSpinLockRelease(endpoint->lock);
   3.267 -    WdfRequestComplete(request, STATUS_SUCCESS);
   3.268 -  }
   3.269 -  else
   3.270 -  {
   3.271 -    KdPrint((__DRIVER_NAME "      Direction mismatch\n"));
   3.272 -    urb->UrbHeader.Status = USBD_STATUS_INVALID_PARAMETER;
   3.273 -    WdfSpinLockRelease(endpoint->lock);
   3.274 -    WdfRequestComplete(request, STATUS_UNSUCCESSFUL);
   3.275 -  }
   3.276 -  //FUNCTION_EXIT();
   3.277 -  return;
   3.278 -}
   3.279 -#endif
   3.280 -
   3.281  static NTSTATUS
   3.282  XenUsbHub_EvtDeviceWdmIrpPreprocessQUERY_INTERFACE(WDFDEVICE device, PIRP irp)
   3.283  {
   3.284    PIO_STACK_LOCATION stack;
   3.285    union {
   3.286 +    USB_BUS_INTERFACE_HUB_V5 ubih5;
   3.287 +#if (NTDDI_VERSION >= NTDDI_VISTA)
   3.288 +    USB_BUS_INTERFACE_HUB_V7 ubih6;
   3.289 +    USB_BUS_INTERFACE_HUB_V7 ubih7;
   3.290 +#endif
   3.291 +  } ubih;
   3.292 +  union {
   3.293      USB_BUS_INTERFACE_USBDI_V1 ubiu0;
   3.294      USB_BUS_INTERFACE_USBDI_V1 ubiu1;
   3.295      USB_BUS_INTERFACE_USBDI_V2 ubiu2;
   3.296 @@ -1774,7 +1743,84 @@ XenUsbHub_EvtDeviceWdmIrpPreprocessQUERY
   3.297    stack = IoGetCurrentIrpStackLocation(irp);
   3.298  
   3.299    if (memcmp(stack->Parameters.QueryInterface.InterfaceType, &USB_BUS_INTERFACE_HUB_GUID, sizeof(GUID)) == 0)
   3.300 +  {
   3.301      KdPrint((__DRIVER_NAME "     USB_BUS_INTERFACE_HUB_GUID\n"));
   3.302 +    if ((stack->Parameters.QueryInterface.Version == USB_BUSIF_HUB_VERSION_5 && stack->Parameters.QueryInterface.Size == sizeof(USB_BUS_INTERFACE_HUB_V5))
   3.303 +#if (NTDDI_VERSION >= NTDDI_VISTA)  
   3.304 +      || (stack->Parameters.QueryInterface.Version == USB_BUSIF_HUB_VERSION_6 && stack->Parameters.QueryInterface.Size == sizeof(USB_BUS_INTERFACE_HUB_V6))
   3.305 +      || (stack->Parameters.QueryInterface.Version == USB_BUSIF_HUB_VERSION_7 && stack->Parameters.QueryInterface.Size == sizeof(USB_BUS_INTERFACE_HUB_V7))
   3.306 +#endif
   3.307 +    )
   3.308 +    {
   3.309 +      ubih.ubih5.Size = stack->Parameters.QueryInterface.Size;
   3.310 +      ubih.ubih5.Version = stack->Parameters.QueryInterface.Version;
   3.311 +      ubih.ubih5.BusContext = device;
   3.312 +      ubih.ubih5.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
   3.313 +      ubih.ubih5.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
   3.314 +      /* these two were changed to the Ex functions in v6 so we set them here so they don't get overwritten */
   3.315 +      ubih.ubih5.CreateUsbDevice = XenUsbHub_UBIH_CreateUsbDevice;
   3.316 +      ubih.ubih5.InitializeUsbDevice = XenUsbHub_UBIH_InitializeUsbDevice;
   3.317 +      switch (stack->Parameters.QueryInterface.Version)
   3.318 +      {
   3.319 +#if (NTDDI_VERSION >= NTDDI_VISTA)  
   3.320 +      case USB_BUSIF_HUB_VERSION_7:
   3.321 +        ubih.ubih7.HubTestPoint = XenUsbHub_UBIH_HubTestPoint;
   3.322 +        ubih.ubih7.GetDevicePerformanceInfo = XenUsbHub_UBIH_GetDevicePerformanceInfo;
   3.323 +        ubih.ubih7.WaitAsyncPowerUp = XenUsbHub_UBIH_WaitAsyncPowerUp;
   3.324 +        ubih.ubih7.GetDeviceAddress = XenUsbHub_UBIH_GetDeviceAddress;
   3.325 +        ubih.ubih7.RefDeviceHandle = XenUsbHub_UBIH_RefDeviceHandle;
   3.326 +        ubih.ubih7.DerefDeviceHandle = XenUsbHub_UBIH_DerefDeviceHandle;
   3.327 +        ubih.ubih7.SetDeviceHandleIdleReadyState = XenUsbHub_UBIH_SetDeviceHandleIdleReadyState;
   3.328 +        ubih.ubih7.HubIsRoot = XenUsbHub_UBIH_HubIsRoot;
   3.329 +        ubih.ubih7.AcquireBusSemaphore = XenUsbHub_UBIH_AcquireBusSemaphore;
   3.330 +        ubih.ubih7.ReleaseBusSemaphore = XenUsbHub_UBIH_ReleaseBusSemaphore;
   3.331 +        ubih.ubih7.CaculatePipeBandwidth = XenUsbHub_UBIH_CaculatePipeBandwidth;
   3.332 +        ubih.ubih7.SetBusSystemWakeMode = XenUsbHub_UBIH_SetBusSystemWakeMode;
   3.333 +        ubih.ubih7.SetDeviceFlag = XenUsbHub_UBIH_SetDeviceFlag;
   3.334 +        ubih.ubih7.HubTestPoint = XenUsbHub_UBIH_HubTestPoint;
   3.335 +        ubih.ubih7.GetDevicePerformanceInfo = XenUsbHub_UBIH_GetDevicePerformanceInfo;
   3.336 +        ubih.ubih7.WaitAsyncPowerUp = XenUsbHub_UBIH_WaitAsyncPowerUp;
   3.337 +        ubih.ubih7.GetDeviceAddress = XenUsbHub_UBIH_GetDeviceAddress;
   3.338 +        ubih.ubih7.RefDeviceHandle = XenUsbHub_UBIH_RefDeviceHandle;
   3.339 +        ubih.ubih7.DerefDeviceHandle = XenUsbHub_UBIH_DerefDeviceHandle;
   3.340 +        ubih.ubih7.SetDeviceHandleIdleReadyState = XenUsbHub_UBIH_SetDeviceHandleIdleReadyState;
   3.341 +        ubih.ubih7.CreateUsbDeviceV7 = XenUsbHub_UBIH_CreateUsbDeviceV7;
   3.342 +        ubih.ubih7.GetContainerIdForPort = XenUsbHub_UBIH_GetContainerIdForPort;
   3.343 +        ubih.ubih7.SetContainerIdForPort = XenUsbHub_UBIH_SetContainerIdForPort;
   3.344 +        ubih.ubih7.AbortAllDevicePipes = XenUsbHub_UBIH_AbortAllDevicePipes;
   3.345 +        ubih.ubih7.SetDeviceErrataFlag = XenUsbHub_UBIH_SetDeviceErrataFlag;  
   3.346 +        /* fall through */
   3.347 +      case USB_BUSIF_HUB_VERSION_6:
   3.348 +        ubih.ubih6.CreateUsbDevice = XenUsbHub_UBIH_CreateUsbDeviceEx;
   3.349 +        ubih.ubih6.InitializeUsbDevice = XenUsbHub_UBIH_InitializeUsbDeviceEx;
   3.350 +        ubih.ubih6.HubIsRoot = XenUsbHub_UBIH_HubIsRoot;
   3.351 +        ubih.ubih6.AcquireBusSemaphore = XenUsbHub_UBIH_AcquireBusSemaphore;
   3.352 +        ubih.ubih6.ReleaseBusSemaphore = XenUsbHub_UBIH_ReleaseBusSemaphore;
   3.353 +        ubih.ubih6.CaculatePipeBandwidth = XenUsbHub_UBIH_CaculatePipeBandwidth;
   3.354 +        ubih.ubih6.SetBusSystemWakeMode = XenUsbHub_UBIH_SetBusSystemWakeMode;
   3.355 +        ubih.ubih6.SetDeviceFlag = XenUsbHub_UBIH_SetDeviceFlag;
   3.356 +        /* fall through */
   3.357 +#endif
   3.358 +      case USB_BUSIF_HUB_VERSION_5:
   3.359 +        ubih.ubih5.GetUsbDescriptors = XenUsbHub_UBIH_GetUsbDescriptors;
   3.360 +        ubih.ubih5.RemoveUsbDevice = XenUsbHub_UBIH_RemoveUsbDevice;
   3.361 +        ubih.ubih5.RestoreUsbDevice = XenUsbHub_UBIH_RestoreUsbDevice;
   3.362 +        ubih.ubih5.GetPortHackFlags = XenUsbHub_UBIH_GetPortHackFlags;
   3.363 +        ubih.ubih5.QueryDeviceInformation = XenUsbHub_UBIH_QueryDeviceInformation;
   3.364 +        ubih.ubih5.GetControllerInformation = XenUsbHub_UBIH_GetControllerInformation;
   3.365 +        ubih.ubih5.ControllerSelectiveSuspend = XenUsbHub_UBIH_ControllerSelectiveSuspend;
   3.366 +        ubih.ubih5.GetExtendedHubInformation = XenUsbHub_UBIH_GetExtendedHubInformation;
   3.367 +        ubih.ubih5.GetRootHubSymbolicName = XenUsbHub_UBIH_GetRootHubSymbolicName;
   3.368 +        ubih.ubih5.GetDeviceBusContext = XenUsbHub_UBIH_GetDeviceBusContext;
   3.369 +        ubih.ubih5.Initialize20Hub = XenUsbHub_UBIH_Initialize20Hub;
   3.370 +        ubih.ubih5.RootHubInitNotification = XenUsbHub_UBIH_RootHubInitNotification;
   3.371 +        ubih.ubih5.FlushTransfers = XenUsbHub_UBIH_FlushTransfers;
   3.372 +        ubih.ubih5.SetDeviceHandleData = XenUsbHub_UBIH_SetDeviceHandleData;
   3.373 +      }
   3.374 +      irp->IoStatus.Information = 0;
   3.375 +      irp->IoStatus.Status = STATUS_SUCCESS;
   3.376 +    }
   3.377 +  }
   3.378    else if (memcmp(stack->Parameters.QueryInterface.InterfaceType, &USB_BUS_INTERFACE_USBDI_GUID, sizeof(GUID)) == 0)
   3.379    {
   3.380      KdPrint((__DRIVER_NAME "     USB_BUS_INTERFACE_USBDI_GUID\n"));
   3.381 @@ -1794,23 +1840,23 @@ XenUsbHub_EvtDeviceWdmIrpPreprocessQUERY
   3.382        ubiu->ubiu0.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
   3.383        switch (stack->Parameters.QueryInterface.Version)
   3.384        {
   3.385 +#if (NTDDI_VERSION >= NTDDI_VISTA)  
   3.386 +      case USB_BUSIF_USBDI_VERSION_3:
   3.387 +        ubiu->ubiu3.QueryBusTimeEx = XenUsbHub_UBIU_QueryBusTimeEx;
   3.388 +        ubiu->ubiu3.QueryControllerType = XenUsbHub_UBIU_QueryControllerType;
   3.389 +        /* fall through */
   3.390 +#endif
   3.391 +      case USB_BUSIF_USBDI_VERSION_2:
   3.392 +        ubiu->ubiu2.EnumLogEntry  = XenUsbHub_UBIU_EnumLogEntry;
   3.393 +        /* fall through */
   3.394 +      case USB_BUSIF_USBDI_VERSION_1:
   3.395 +        ubiu->ubiu1.IsDeviceHighSpeed = XenUsbHub_UBIU_IsDeviceHighSpeed;
   3.396 +        /* fall through */
   3.397        case USB_BUSIF_USBDI_VERSION_0:          
   3.398          ubiu->ubiu0.GetUSBDIVersion = XenUsbHub_UBIU_GetUSBDIVersion;
   3.399          ubiu->ubiu0.QueryBusTime = XenUsbHub_UBIU_QueryBusTime;
   3.400          ubiu->ubiu0.SubmitIsoOutUrb = XenUsbHub_UBIU_SubmitIsoOutUrb;
   3.401          ubiu->ubiu0.QueryBusInformation = XenUsbHub_UBIU_QueryBusInformation;
   3.402 -        /* fall through */
   3.403 -      case USB_BUSIF_USBDI_VERSION_1:
   3.404 -        ubiu->ubiu1.IsDeviceHighSpeed = XenUsbHub_UBIU_IsDeviceHighSpeed;
   3.405 -        /* fall through */
   3.406 -      case USB_BUSIF_USBDI_VERSION_2:
   3.407 -        ubiu->ubiu2.EnumLogEntry  = XenUsbHub_UBIU_EnumLogEntry;
   3.408 -        /* fall through */
   3.409 -#if (NTDDI_VERSION >= NTDDI_VISTA)  
   3.410 -      case USB_BUSIF_USBDI_VERSION_3:
   3.411 -        ubiu->ubiu3.QueryBusTimeEx = XenUsbHub_UBIU_QueryBusTimeEx;
   3.412 -        ubiu->ubiu3.QueryControllerType = XenUsbHub_UBIU_QueryControllerType;
   3.413 -#endif
   3.414        }
   3.415        irp->IoStatus.Information = 0;
   3.416        irp->IoStatus.Status = STATUS_SUCCESS;
   3.417 @@ -1869,27 +1915,10 @@ XenUsb_EvtChildListCreateDevice(WDFCHILD
   3.418    WDF_PNPPOWER_EVENT_CALLBACKS child_pnp_power_callbacks;
   3.419    WDF_DEVICE_POWER_CAPABILITIES child_power_capabilities;
   3.420    WDF_IO_QUEUE_CONFIG queue_config;
   3.421 -  WDF_QUERY_INTERFACE_CONFIG interface_config;
   3.422 -  union {
   3.423 -    USB_BUS_INTERFACE_HUB_V5 ubih5; /* support version 5 */
   3.424  #if (NTDDI_VERSION >= NTDDI_VISTA)
   3.425 -    USB_BUS_INTERFACE_HUB_V7 ubih7; /* support versions 6,  and 7 - base definition changed */
   3.426 -#endif
   3.427 -  } ubih;
   3.428 -#if 0
   3.429 -  union {
   3.430 -    USB_BUS_INTERFACE_USBDI_V1 ubiu1;
   3.431 -    USB_BUS_INTERFACE_USBDI_V2 ubiu2;
   3.432 -#if (NTDDI_VERSION >= NTDDI_VISTA)
   3.433 -    USB_BUS_INTERFACE_USBDI_V3 ubiu3;
   3.434 -#endif
   3.435 -  } ubiu;
   3.436 -#endif
   3.437 -#if (NTDDI_VERSION >= NTDDI_VISTA)
   3.438 +  WDF_QUERY_INTERFACE_CONFIG interface_config;
   3.439    USB_BUS_INTERFACE_HUB_SELECTIVE_SUSPEND ubihss;
   3.440  #endif
   3.441 -  WDF_TIMER_CONFIG timer_config;
   3.442 -  //WDF_OBJECT_ATTRIBUTES timer_attributes;
   3.443    UCHAR pnp_minor_functions[] = { IRP_MN_QUERY_INTERFACE };
   3.444  
   3.445    FUNCTION_ENTER();
   3.446 @@ -2076,115 +2105,7 @@ XenUsb_EvtChildListCreateDevice(WDFCHILD
   3.447    child_power_capabilities.DeviceState[PowerSystemShutdown]  = PowerDeviceD3;
   3.448    WdfDeviceSetPowerCapabilities(child_device, &child_power_capabilities);  
   3.449  
   3.450 -  ubih.ubih5.BusContext = child_device;
   3.451 -  ubih.ubih5.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
   3.452 -  ubih.ubih5.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
   3.453 -  ubih.ubih5.GetUsbDescriptors = XenUsbHub_UBIH_GetUsbDescriptors;
   3.454 -  ubih.ubih5.RemoveUsbDevice = XenUsbHub_UBIH_RemoveUsbDevice;
   3.455 -  ubih.ubih5.RestoreUsbDevice = XenUsbHub_UBIH_RestoreUsbDevice;
   3.456 -  ubih.ubih5.GetPortHackFlags = XenUsbHub_UBIH_GetPortHackFlags;
   3.457 -  ubih.ubih5.QueryDeviceInformation = XenUsbHub_UBIH_QueryDeviceInformation;
   3.458 -  ubih.ubih5.GetControllerInformation = XenUsbHub_UBIH_GetControllerInformation;
   3.459 -  ubih.ubih5.ControllerSelectiveSuspend = XenUsbHub_UBIH_ControllerSelectiveSuspend;
   3.460 -  ubih.ubih5.GetExtendedHubInformation = XenUsbHub_UBIH_GetExtendedHubInformation;
   3.461 -  ubih.ubih5.GetRootHubSymbolicName = XenUsbHub_UBIH_GetRootHubSymbolicName;
   3.462 -  ubih.ubih5.GetDeviceBusContext = XenUsbHub_UBIH_GetDeviceBusContext;
   3.463 -  ubih.ubih5.Initialize20Hub = XenUsbHub_UBIH_Initialize20Hub;
   3.464 -  ubih.ubih5.RootHubInitNotification = XenUsbHub_UBIH_RootHubInitNotification;
   3.465 -  ubih.ubih5.FlushTransfers = XenUsbHub_UBIH_FlushTransfers;
   3.466 -  ubih.ubih5.SetDeviceHandleData = XenUsbHub_UBIH_SetDeviceHandleData;
   3.467 -#if (NTDDI_VERSION >= NTDDI_VISTA)  
   3.468 -  ubih.ubih6.CreateUsbDevice = XenUsbHub_UBIH_CreateUsbDeviceEx;
   3.469 -  ubih.ubih6.InitializeUsbDevice = XenUsbHub_UBIH_InitializeUsbDeviceEx;
   3.470 -  ubih.ubih6.HubIsRoot = XenUsbHub_UBIH_HubIsRoot;
   3.471 -  ubih.ubih6.AcquireBusSemaphore = XenUsbHub_UBIH_AcquireBusSemaphore;
   3.472 -  ubih.ubih6.ReleaseBusSemaphore = XenUsbHub_UBIH_ReleaseBusSemaphore;
   3.473 -  ubih.ubih6.CaculatePipeBandwidth = XenUsbHub_UBIH_CaculatePipeBandwidth;
   3.474 -  ubih.ubih6.SetBusSystemWakeMode = XenUsbHub_UBIH_SetBusSystemWakeMode;
   3.475 -  ubih.ubih6.SetDeviceFlag = XenUsbHub_UBIH_SetDeviceFlag;
   3.476 -  ubih.ubih7.HubTestPoint = XenUsbHub_UBIH_HubTestPoint;
   3.477 -  ubih.ubih7.GetDevicePerformanceInfo = XenUsbHub_UBIH_GetDevicePerformanceInfo;
   3.478 -  ubih.ubih7.WaitAsyncPowerUp = XenUsbHub_UBIH_WaitAsyncPowerUp;
   3.479 -  ubih.ubih7.GetDeviceAddress = XenUsbHub_UBIH_GetDeviceAddress;
   3.480 -  ubih.ubih7.RefDeviceHandle = XenUsbHub_UBIH_RefDeviceHandle;
   3.481 -  ubih.ubih7.DerefDeviceHandle = XenUsbHub_UBIH_DerefDeviceHandle;
   3.482 -  ubih.ubih7.SetDeviceHandleIdleReadyState = XenUsbHub_UBIH_SetDeviceHandleIdleReadyState;
   3.483 -  ubih.ubih7.HubIsRoot = XenUsbHub_UBIH_HubIsRoot;
   3.484 -  ubih.ubih7.AcquireBusSemaphore = XenUsbHub_UBIH_AcquireBusSemaphore;
   3.485 -  ubih.ubih7.ReleaseBusSemaphore = XenUsbHub_UBIH_ReleaseBusSemaphore;
   3.486 -  ubih.ubih7.CaculatePipeBandwidth = XenUsbHub_UBIH_CaculatePipeBandwidth;
   3.487 -  ubih.ubih7.SetBusSystemWakeMode = XenUsbHub_UBIH_SetBusSystemWakeMode;
   3.488 -  ubih.ubih7.SetDeviceFlag = XenUsbHub_UBIH_SetDeviceFlag;
   3.489 -  ubih.ubih7.HubTestPoint = XenUsbHub_UBIH_HubTestPoint;
   3.490 -  ubih.ubih7.GetDevicePerformanceInfo = XenUsbHub_UBIH_GetDevicePerformanceInfo;
   3.491 -  ubih.ubih7.WaitAsyncPowerUp = XenUsbHub_UBIH_WaitAsyncPowerUp;
   3.492 -  ubih.ubih7.GetDeviceAddress = XenUsbHub_UBIH_GetDeviceAddress;
   3.493 -  ubih.ubih7.RefDeviceHandle = XenUsbHub_UBIH_RefDeviceHandle;
   3.494 -  ubih.ubih7.DerefDeviceHandle = XenUsbHub_UBIH_DerefDeviceHandle;
   3.495 -  ubih.ubih7.SetDeviceHandleIdleReadyState = XenUsbHub_UBIH_SetDeviceHandleIdleReadyState;
   3.496 -  ubih.ubih7.CreateUsbDeviceV7 = XenUsbHub_UBIH_CreateUsbDeviceV7;
   3.497 -  ubih.ubih7.GetContainerIdForPort = XenUsbHub_UBIH_GetContainerIdForPort;
   3.498 -  ubih.ubih7.SetContainerIdForPort = XenUsbHub_UBIH_SetContainerIdForPort;
   3.499 -  ubih.ubih7.AbortAllDevicePipes = XenUsbHub_UBIH_AbortAllDevicePipes;
   3.500 -  ubih.ubih7.SetDeviceErrataFlag = XenUsbHub_UBIH_SetDeviceErrataFlag;  
   3.501 -  ubih.ubih7.Size = sizeof(USB_BUS_INTERFACE_HUB_V7);
   3.502 -  ubih.ubih7.Version = USB_BUSIF_HUB_VERSION_7;
   3.503 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&interface_config, (PINTERFACE)&ubih, &USB_BUS_INTERFACE_HUB_GUID, NULL);
   3.504 -  status = WdfDeviceAddQueryInterface(child_device, &interface_config);
   3.505 -  if (!NT_SUCCESS(status))
   3.506 -    return status;
   3.507 -
   3.508 -  ubih.ubih6.Size = sizeof(USB_BUS_INTERFACE_HUB_V6);
   3.509 -  ubih.ubih6.Version = USB_BUSIF_HUB_VERSION_6;
   3.510 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&interface_config, (PINTERFACE)&ubih, &USB_BUS_INTERFACE_HUB_GUID, NULL);
   3.511 -  status = WdfDeviceAddQueryInterface(child_device, &interface_config);
   3.512 -  if (!NT_SUCCESS(status))
   3.513 -    return status;
   3.514 -#endif
   3.515 -
   3.516 -  ubih.ubih5.CreateUsbDevice = XenUsbHub_UBIH_CreateUsbDevice;
   3.517 -  ubih.ubih5.InitializeUsbDevice = XenUsbHub_UBIH_InitializeUsbDevice;
   3.518 -  ubih.ubih5.Size = sizeof(USB_BUS_INTERFACE_HUB_V5);
   3.519 -  ubih.ubih5.Version = USB_BUSIF_HUB_VERSION_5;
   3.520 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&interface_config, (PINTERFACE)&ubih, &USB_BUS_INTERFACE_HUB_GUID, NULL);
   3.521 -  status = WdfDeviceAddQueryInterface(child_device, &interface_config);
   3.522 -  if (!NT_SUCCESS(status))
   3.523 -    return status;
   3.524 -#if 0
   3.525 -  ubiu.ubiu1.BusContext = child_device;
   3.526 -  ubiu.ubiu1.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
   3.527 -  ubiu.ubiu1.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
   3.528 -  ubiu.ubiu1.GetUSBDIVersion = XenUsbHub_UBIU_GetUSBDIVersion;
   3.529 -  ubiu.ubiu1.QueryBusTime = XenUsbHub_UBIU_QueryBusTime;
   3.530 -  ubiu.ubiu1.SubmitIsoOutUrb = XenUsbHub_UBIU_SubmitIsoOutUrb;
   3.531 -  ubiu.ubiu1.QueryBusInformation = XenUsbHub_UBIU_QueryBusInformation;
   3.532 -  ubiu.ubiu1.IsDeviceHighSpeed = XenUsbHub_UBIU_IsDeviceHighSpeed;
   3.533 -  ubiu.ubiu2.EnumLogEntry  = XenUsbHub_UBIU_EnumLogEntry;
   3.534 -#if (NTDDI_VERSION >= NTDDI_VISTA)  
   3.535 -  ubiu.ubiu3.QueryBusTimeEx = XenUsbHub_UBIU_QueryBusTimeEx;
   3.536 -  ubiu.ubiu3.QueryControllerType = XenUsbHub_UBIU_QueryControllerType;
   3.537 -  ubiu.ubiu3.Size = sizeof(USB_BUS_INTERFACE_USBDI_V3);
   3.538 -  ubiu.ubiu3.Version = USB_BUSIF_HUB_VERSION_3;
   3.539 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&interface_config, (PINTERFACE)&ubiu, &USB_BUS_INTERFACE_USBDI_GUID, NULL);
   3.540 -  status = WdfDeviceAddQueryInterface(child_device, &interface_config);
   3.541 -  if (!NT_SUCCESS(status))
   3.542 -    return status;
   3.543 -#endif
   3.544 -
   3.545 -  ubiu.ubiu2.Size = sizeof(USB_BUS_INTERFACE_USBDI_V2);
   3.546 -  ubiu.ubiu2.Version = USB_BUSIF_HUB_VERSION_2;
   3.547 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&interface_config, (PINTERFACE)&ubiu, &USB_BUS_INTERFACE_USBDI_GUID, NULL);
   3.548 -  status = WdfDeviceAddQueryInterface(child_device, &interface_config);
   3.549 -  if (!NT_SUCCESS(status))
   3.550 -  return status;
   3.551 -
   3.552 -  ubiu.ubiu1.Size = sizeof(USB_BUS_INTERFACE_USBDI_V1);
   3.553 -  ubiu.ubiu1.Version = USB_BUSIF_HUB_VERSION_1;
   3.554 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&interface_config, (PINTERFACE)&ubiu, &USB_BUS_INTERFACE_USBDI_GUID, NULL);
   3.555 -  status = WdfDeviceAddQueryInterface(child_device, &interface_config);
   3.556 -  if (!NT_SUCCESS(status))
   3.557 -    return status;
   3.558 -
   3.559 +#if (NTDDI_VERSION >= NTDDI_VISTA)
   3.560    ubihss.BusContext = child_device;
   3.561    ubihss.Size = sizeof(USB_BUS_INTERFACE_HUB_SELECTIVE_SUSPEND);
   3.562    ubihss.Version = USB_BUSIF_HUB_SS_VERSION_0;
   3.563 @@ -2192,7 +2113,7 @@ XenUsb_EvtChildListCreateDevice(WDFCHILD
   3.564    ubihss.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
   3.565    ubihss.SuspendHub = XenUsbHub_UBIHSS_SuspendHub;
   3.566    ubihss.ResumeHub = XenUsbHub_UBIHSS_ResumeHub;
   3.567 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&interface_config, (PINTERFACE)&ubiu, &USB_BUS_INTERFACE_HUB_SS_GUID, NULL);
   3.568 +  WDF_QUERY_INTERFACE_CONFIG_INIT(&interface_config, (PINTERFACE)&ubihss, &USB_BUS_INTERFACE_HUB_SS_GUID, NULL);
   3.569    status = WdfDeviceAddQueryInterface(child_device, &interface_config);
   3.570    if (!NT_SUCCESS(status))
   3.571      return status;