VirtualBox

Changeset 82446 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 6, 2019 9:33:36 AM (5 years ago)
Author:
vboxsync
Message:

IoGetDevicePropertyData has trouble on Win7, don't require it (like we didn't require it before).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp

    r82445 r82446  
    111111    uint16_t        idProduct;
    112112    uint16_t        bcdDevice;
     113    uint16_t        wPort;
    113114    uint8_t         bClass;
    114115    uint8_t         bSubClass;
    115116    uint8_t         bProtocol;
    116     uint8_t         bPort;
    117117    char            szSerial[MAX_USB_SERIAL_STRING];
    118118    char            szMfgName[MAX_USB_SERIAL_STRING];
     
    373373    else
    374374    {
     375        LOG(("Setting filter class/subclass/protocol %02X/%02X/%02X\n", pDevice->bClass, pDevice->bSubClass, pDevice->bProtocol));
    375376        USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_CLASS, pDevice->bClass, true);
    376377        USBFilterSetNumExact(&DevFlt, USBFILTERIDX_DEVICE_SUB_CLASS, pDevice->bSubClass, true);
     
    379380
    380381    /* If the port number looks valid, add it to the filter. */
    381     if (pDevice->bPort != 0xffff)
    382     {
    383         USBFilterSetNumExact(&DevFlt, USBFILTERIDX_PORT, pDevice->bPort, true);
    384     }
     382    if (pDevice->wPort < 256)
     383    {
     384        LOG(("Setting filter port %04X\n", pDevice->wPort));
     385        USBFilterSetNumExact(&DevFlt, USBFILTERIDX_PORT, pDevice->wPort, true);
     386    }
     387    else
     388        LOG(("Port number not known, ignoring!"));
    385389
    386390    /* Run filters on the thing. */
     
    655659        if (!NT_SUCCESS(Status))
    656660        {
    657             /* We do need this, and it should always be available. */
     661            /* We do need this, but not critically. On Windows 7, we may get STATUS_OBJECT_NAME_NOT_FOUND. */
    658662            WARN(("IoGetDevicePropertyData failed for DEVPKEY_Device_LocationPaths, Status (0x%x)", Status));
    659             break;
    660         }
    661         LOG_STRW(pDevice->szLocationPath);
     663        }
     664        else
     665        {
     666            LOG_STRW(pDevice->szLocationPath);
     667        }
    662668
    663669        /* Query the location information. The hub number is iffy because the numbering is
     
    667673        if (!NT_SUCCESS(Status))
    668674        {
    669             /* We may well need this, and it should always be available. */
     675            /* This is useful but not critical. On Windows 7, we may get STATUS_OBJECT_NAME_NOT_FOUND. */
    670676            WARN(("IoGetDevicePropertyData failed for DEVPKEY_Device_LocationInfo, Status (0x%x)", Status));
    671             break;
    672         }
    673         LOG_STRW(wchPropBuf);
    674         rc = vboxUsbParseLocation(wchPropBuf, &hub, &port);
    675         if (!rc)
    676         {
    677             /* This *really* should not happen but it's not fatal. */
    678             WARN(("Failed to parse Location Info"));
     677            hub = port = 0xffff;
     678            Status = STATUS_SUCCESS;    /* Need to override the IoGetDevicePropertyData return. */
     679        }
     680        else
     681        {
     682            LOG_STRW(wchPropBuf);
     683            rc = vboxUsbParseLocation(wchPropBuf, &hub, &port);
     684            if (!rc)
     685            {
     686                /* This *really* should not happen but it's not fatal. */
     687                WARN(("Failed to parse Location Info"));
     688            }
    679689        }
    680690
     
    686696        }
    687697
    688         LOG(("Device pid=%x vid=%x rev=%x", pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice));
    689         pDevice->bPort        = port;
     698        LOG(("Device pid=%x vid=%x rev=%x port=%x", pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice, port));
     699        pDevice->wPort        = port;
    690700        pDevice->idVendor     = pDevDr->idVendor;
    691701        pDevice->idProduct    = pDevDr->idProduct;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette