VirtualBox

Changeset 34274 in vbox


Ignore:
Timestamp:
Nov 23, 2010 10:39:27 AM (14 years ago)
Author:
vboxsync
Message:

USBLib-win: be more verbose on last error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/USBLib-win.cpp

    r34265 r34274  
    100100        if (!DeviceIoControl(hOut, SUPUSB_IOCTL_GET_VERSION, NULL, 0,&version, sizeof(version),  &cbReturned, NULL))
    101101        {
    102             Log(("DeviceIoControl SUPUSB_IOCTL_GET_VERSION failed with rc=%d\n", GetLastError()));
     102            Log(("DeviceIoControl SUPUSB_IOCTL_GET_VERSION failed with LastError=%Rwa\n", GetLastError()));
    103103            goto failure;
    104104        }
     
    112112        if (!DeviceIoControl(hOut, SUPUSB_IOCTL_IS_OPERATIONAL, NULL, 0, NULL, NULL, &cbReturned, NULL))
    113113        {
    114             Log(("DeviceIoControl SUPUSB_IOCTL_IS_OPERATIONAL failed with rc=%d\n", GetLastError()));
     114            Log(("DeviceIoControl SUPUSB_IOCTL_IS_OPERATIONAL failed with LastError=%Rwa\n", GetLastError()));
    115115            goto failure;
    116116        }
     
    151151
    152152    functionClassDeviceData = (PSP_DEVICE_INTERFACE_DETAIL_DATA) RTMemAllocZ(predictedLength);
    153     if(NULL == functionClassDeviceData)
     153    if (NULL == functionClassDeviceData)
    154154    {
    155155        return false;
     
    16931693    {
    16941694#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
    1695         AssertMsgFailed(("DeviceIoControl IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION failed with %d\n", GetLastError()));
     1695        AssertMsgFailed(("DeviceIoControl IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION failed with LastError=%Rwa\n", GetLastError()));
    16961696#else
    1697         LogRel(("DeviceIoControl IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION failed with %d\n", GetLastError()));
     1697        LogRel(("DeviceIoControl IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION failed with LastError=%Rwa\n", GetLastError()));
    16981698#endif
    16991699        return NULL;
     
    17631763    {
    17641764#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
    1765         AssertMsgFailed(("DeviceIoControl IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION failed with %d\n", GetLastError()));
     1765        AssertMsgFailed(("DeviceIoControl IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION failed with LastError=%Rwa\n", GetLastError()));
    17661766#else
    1767         LogRel(("DeviceIoControl IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION failed with %d\n", GetLastError()));
     1767        LogRel(("DeviceIoControl IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION failed with LastError=%Rwa\n", GetLastError()));
    17681768#endif
    17691769        RTMemFree(configDescReq);
     
    21202120    {
    21212121#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
    2122         AssertMsgFailed(("DeviceIoControl IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION failed with %d\n", GetLastError()));
     2122        AssertMsgFailed(("DeviceIoControl IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION failed with LastError=%Rwa\n", GetLastError()));
    21232123#else
    2124         LogRel(("DeviceIoControl IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION failed with %d\n", GetLastError()));
     2124        LogRel(("DeviceIoControl IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION failed with LastError=%Rwa\n", GetLastError()));
    21252125#endif
    21262126        return NULL;
     
    24902490        {
    24912491            DWORD LastError = GetLastError(); NOREF(LastError);
    2492             AssertMsgFailed(("OpenService failed LastError=%Rwa\n", LastError));
     2492            AssertMsgFailed(("OpenService failed with LastError=%Rwa\n", LastError));
    24932493        }
    24942494        CloseServiceHandle(hSMgr);
     
    25242524        {
    25252525            /* AssertFailed(); */
    2526             LogRel(("usbproxy: Unable to open monitor driver!! (rc=%d)\n", GetLastError()));
     2526            LogRel(("usbproxy: Unable to open monitor driver!! LastError=%Rwa\n", GetLastError()));
    25272527            rc = VERR_FILE_NOT_FOUND;
    25282528            goto failure;
     
    25362536    if (!DeviceIoControl(g_hUSBMonitor, SUPUSBFLT_IOCTL_GET_VERSION, NULL, 0,&version, sizeof(version),  &cbReturned, NULL))
    25372537    {
    2538         LogRel(("usbproxy: Unable to query filter version!! (rc=%d)\n", GetLastError()));
     2538        LogRel(("usbproxy: Unable to query filter version!! LastError=%Rwa\n", GetLastError()));
    25392539        rc = VERR_VERSION_MISMATCH;
    25402540        goto failure;
     
    26132613    if (!DeviceIoControl(g_hUSBMonitor, SUPUSBFLT_IOCTL_CAPTURE_DEVICE, &capture, sizeof(capture),  NULL, 0, &cbReturned, NULL))
    26142614    {
    2615         AssertMsgFailed(("DeviceIoControl failed with %d\n", GetLastError()));
     2615        AssertMsgFailed(("DeviceIoControl failed with LastError=%Rwa\n", GetLastError()));
    26162616        return RTErrConvertFromWin32(GetLastError());
    26172617    }
     
    26442644    if (!DeviceIoControl(g_hUSBMonitor, SUPUSBFLT_IOCTL_RELEASE_DEVICE, &release, sizeof(release),  NULL, 0, &cbReturned, NULL))
    26452645    {
    2646         AssertMsgFailed(("DeviceIoControl failed with %d\n", GetLastError()));
     2646        AssertMsgFailed(("DeviceIoControl failed with LastError=%Rwa\n", GetLastError()));
    26472647        return RTErrConvertFromWin32(GetLastError());
    26482648    }
     
    26672667    if (!DeviceIoControl(g_hUSBMonitor, SUPUSBFLT_IOCTL_ADD_FILTER, (LPVOID)pFilter, sizeof(*pFilter), &add_out, sizeof(add_out), &cbReturned, NULL))
    26682668    {
    2669         AssertMsgFailed(("DeviceIoControl failed with %d\n", GetLastError()));
     2669        AssertMsgFailed(("DeviceIoControl failed with LastError=%Rwa\n", GetLastError()));
    26702670        return NULL;
    26712671    }
     
    26912691    uId = (uintptr_t)pvId;
    26922692    if (!DeviceIoControl(g_hUSBMonitor, SUPUSBFLT_IOCTL_REMOVE_FILTER, &uId, sizeof(uId),  NULL, 0,&cbReturned, NULL))
    2693         AssertMsgFailed(("DeviceIoControl failed with %d\n", GetLastError()));
     2693        AssertMsgFailed(("DeviceIoControl failed with LastError=%Rwa\n", GetLastError()));
    26942694}
    26952695
     
    27772777        if (!DeviceIoControl(g_hUSBMonitor, SUPUSBFLT_IOCTL_GET_NUM_DEVICES, NULL, 0, &numdev, sizeof(numdev), &cbReturned, NULL))
    27782778        {
    2779             AssertMsgFailed(("DeviceIoControl failed with %d\n", GetLastError()));
     2779            AssertMsgFailed(("DeviceIoControl failed with LastError=%Rwa\n", GetLastError()));
    27802780            return RTErrConvertFromWin32(GetLastError());
    27812781        }
     
    28272827            if (!DeviceIoControl(hDev, SUPUSB_IOCTL_GET_DEVICE, &dev, sizeof(dev), &dev, sizeof(dev), &cbReturned, NULL))
    28282828            {
    2829                 int iErr = GetLastError();
     2829                DWORD LastError = GetLastError();
    28302830                /* ERROR_DEVICE_NOT_CONNECTED -> device was removed just now */
    2831                 AssertMsg(iErr == ERROR_DEVICE_NOT_CONNECTED, ("DeviceIoControl %d failed with %d\n", i, iErr));
     2831                AssertMsg(LastError == ERROR_DEVICE_NOT_CONNECTED, ("DeviceIoControl %d failed with LastError=%Rwa\n", i, LastError));
    28322832                Log(("SUPUSB_IOCTL_GET_DEVICE: DeviceIoControl %d no longer connected\n", i));
    28332833            }
     
    28562856        }
    28572857        else
    2858             AssertMsgFailed(("Unexpected failure to open %s. lasterr=%d\n", pszDevname, GetLastError()));
     2858            AssertMsgFailed(("Unexpected failure to open %s. LastError=%Rwa\n", pszDevname, GetLastError()));
    28592859    }
    28602860
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