VirtualBox

Ignore:
Timestamp:
Sep 12, 2011 11:21:20 AM (13 years ago)
Author:
vboxsync
Message:

VBoxUsbLib-win.cpp: Don't assert if we somehow failed to open the driver (sloppy init code?). FUNCTION is not necessary in assertion message since it's part of the standard output (RTAssertMsg1)

File:
1 edited

Legend:

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

    r38280 r38713  
    9797    {
    9898        DWORD winEr = GetLastError();
    99         AssertMsgFailed((__FUNCTION__": CreateFile FAILED to open %s, winEr (%d)\n", pVuDev->szName, winEr));
     99        AssertMsgFailed(("CreateFile FAILED to open %s, winEr (%d)\n", pVuDev->szName, winEr));
    100100        return VERR_GENERAL_FAILURE;
    101101    }
     
    109109        if (!DeviceIoControl(hOut, SUPUSB_IOCTL_GET_VERSION, NULL, 0,&version, sizeof(version),  &cbReturned, NULL))
    110110        {
    111             AssertMsgFailed((__FUNCTION__": DeviceIoControl SUPUSB_IOCTL_GET_VERSION failed with LastError=%Rwa\n", GetLastError()));
     111            AssertMsgFailed(("DeviceIoControl SUPUSB_IOCTL_GET_VERSION failed with LastError=%Rwa\n", GetLastError()));
    112112            break;
    113113        }
     
    116116                || version.u32Minor <  USBDRV_MINOR_VERSION)
    117117        {
    118             AssertMsgFailed((__FUNCTION__": Invalid version %d:%d vs %d:%d\n", version.u32Major, version.u32Minor, USBDRV_MAJOR_VERSION, USBDRV_MINOR_VERSION));
     118            AssertMsgFailed(("Invalid version %d:%d vs %d:%d\n", version.u32Major, version.u32Minor, USBDRV_MAJOR_VERSION, USBDRV_MINOR_VERSION));
    119119            break;
    120120        }
     
    122122        if (!DeviceIoControl(hOut, SUPUSB_IOCTL_IS_OPERATIONAL, NULL, 0, NULL, NULL, &cbReturned, NULL))
    123123        {
    124             AssertMsgFailed((__FUNCTION__": DeviceIoControl SUPUSB_IOCTL_IS_OPERATIONAL failed with LastError=%Rwa\n", GetLastError()));
     124            AssertMsgFailed(("DeviceIoControl SUPUSB_IOCTL_IS_OPERATIONAL failed with LastError=%Rwa\n", GetLastError()));
    125125            break;
    126126        }
     
    149149    if (!pIfDetailData)
    150150    {
    151         AssertMsgFailed((__FUNCTION__": RTMemAllocZ failed\n"));
     151        AssertMsgFailed(("RTMemAllocZ failed\n"));
    152152        return VERR_OUT_OF_RESOURCES;
    153153    }
     
    167167        {
    168168            DWORD winEr = GetLastError();
    169             AssertMsgFailed((__FUNCTION__": SetupDiGetDeviceInterfaceDetail, cbRequired (%d), was (%d), winEr (%d)\n", cbDbgRequired, cbIfDetailData, winEr));
     169            AssertMsgFailed(("SetupDiGetDeviceInterfaceDetail, cbRequired (%d), was (%d), winEr (%d)\n", cbDbgRequired, cbIfDetailData, winEr));
    170170            rc = VERR_GENERAL_FAILURE;
    171171            break;
     
    181181        {
    182182            DWORD winEr = GetLastError();
    183             AssertMsgFailed((__FUNCTION__": SetupDiGetDeviceRegistryPropertyA, cbRequired (%d), was (%d), winEr (%d)\n", cbDbgRequired, sizeof (pVuDev->szDriverRegName), winEr));
     183            AssertMsgFailed(("SetupDiGetDeviceRegistryPropertyA, cbRequired (%d), was (%d), winEr (%d)\n", cbDbgRequired, sizeof (pVuDev->szDriverRegName), winEr));
    184184            rc = VERR_GENERAL_FAILURE;
    185185            break;
     
    217217    {
    218218        DWORD winEr = GetLastError();
    219         AssertMsgFailed((__FUNCTION__": SetupDiGetClassDevs, winEr (%d)\n", winEr));
     219        AssertMsgFailed(("SetupDiGetClassDevs, winEr (%d)\n", winEr));
    220220        return VERR_GENERAL_FAILURE;
    221221    }
     
    235235                break;
    236236
    237             AssertMsgFailed((__FUNCTION__": SetupDiEnumDeviceInterfaces, winEr (%d), resuming\n", winEr));
     237            AssertMsgFailed(("SetupDiEnumDeviceInterfaces, winEr (%d), resuming\n", winEr));
    238238            continue;
    239239        }
     
    243243        if (!pVuDev)
    244244        {
    245             AssertMsgFailed((__FUNCTION__": RTMemAllocZ failed, resuming\n"));
     245            AssertMsgFailed(("RTMemAllocZ failed, resuming\n"));
    246246            continue;
    247247        }
     
    250250        if (!RT_SUCCESS(rc))
    251251        {
    252             AssertMsgFailed((__FUNCTION__": usbLibVuDevicePopulate failed, rc (%d), resuming\n", rc));
     252            AssertMsgFailed(("usbLibVuDevicePopulate failed, rc (%d), resuming\n", rc));
    253253            continue;
    254254        }
     
    356356#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
    357357        DWORD winEr = GetLastError();
    358         AssertMsgFailed((__FUNCTION__": DeviceIoControl 1 fail winEr (%d)\n", winEr));
     358        AssertMsgFailed(("DeviceIoControl 1 fail winEr (%d)\n", winEr));
    359359#endif
    360360        return VERR_GENERAL_FAILURE;
     
    386386    {
    387387        DWORD winEr = GetLastError();
    388         AssertMsgFailed((__FUNCTION__": DeviceIoControl 2 fail winEr (%d)\n", winEr));
     388        AssertMsgFailed(("DeviceIoControl 2 fail winEr (%d)\n", winEr));
    389389        rc = VERR_GENERAL_FAILURE;
    390390    }
     
    954954                 DWORD winEr = GetLastError();
    955955                 /* ERROR_DEVICE_NOT_CONNECTED -> device was removed just now */
    956                  AssertMsgFailed((__FUNCTION__": Monitor DeviceIoControl failed winEr (%d)\n", winEr));
     956                 AssertMsgFailed(("Monitor DeviceIoControl failed winEr (%d)\n", winEr));
    957957                 Log(("SUPUSBFLT_IOCTL_GET_DEVICE: DeviceIoControl no longer connected\n"));
    958958                 CloseHandle(hDev);
     
    10391039        {
    10401040            DWORD winEr = GetLastError();
    1041             AssertMsgFailed((__FUNCTION__": WaitForMultipleObjects failed, winEr (%d)\n", winEr));
     1041            AssertMsgFailed(("WaitForMultipleObjects failed, winEr (%d)\n", winEr));
    10421042            return VERR_GENERAL_FAILURE;
    10431043        }
     
    10581058    {
    10591059        DWORD winEr = GetLastError();
    1060         AssertMsgFailed((__FUNCTION__": SetEvent failed, winEr (%d)\n", winEr));
     1060        AssertMsgFailed(("SetEvent failed, winEr (%d)\n", winEr));
    10611061        return VERR_GENERAL_FAILURE;
    10621062    }
     
    11951195    {
    11961196            DWORD winEr = GetLastError();
    1197             AssertMsgFailed((__FUNCTION__": CreateTimerQueueTimer failed, winEr (%d)\n", winEr));
     1197            AssertMsgFailed(("CreateTimerQueueTimer failed, winEr (%d)\n", winEr));
    11981198
    11991199            /* call it directly */
     
    13661366                                return VINF_SUCCESS;
    13671367                            else
    1368                                 AssertMsgFailed((__FUNCTION__": SetEvent failed, rc (%d)\n", rc));
     1368                                AssertMsgFailed(("SetEvent failed, rc (%d)\n", rc));
    13691369                        }
    13701370                        else
    13711371                        {
    13721372                            DWORD winEr = GetLastError();
    1373                             AssertMsgFailed((__FUNCTION__": SetEvent Ioctl failed, winEr (%d)\n", winEr));
     1373                            AssertMsgFailed(("SetEvent Ioctl failed, winEr (%d)\n", winEr));
    13741374                            rc = VERR_VERSION_MISMATCH;
    13751375                        }
     
    14041404                                {
    14051405                                    DWORD winEr = GetLastError();
    1406                                     AssertMsgFailed((__FUNCTION__": CloseHandle for hThread failed winEr(%d)\n", winEr));
     1406                                    AssertMsgFailed(("CloseHandle for hThread failed winEr(%d)\n", winEr));
    14071407                                }
    14081408                            }
     
    14101410                            {
    14111411                                DWORD winEr = GetLastError();
    1412                                 AssertMsgFailed((__FUNCTION__": CreateThread failed, winEr (%d)\n", winEr));
     1412                                AssertMsgFailed(("CreateThread failed, winEr (%d)\n", winEr));
    14131413                                rc = VERR_GENERAL_FAILURE;
    14141414                            }
     
    14171417                        {
    14181418                            DWORD winEr = GetLastError();
    1419                             AssertMsgFailed((__FUNCTION__": CreateTimerQueue failed winEr(%d)\n", winEr));
     1419                            AssertMsgFailed(("CreateTimerQueue failed winEr(%d)\n", winEr));
    14201420                        }
    14211421#endif
     
    14331433                {
    14341434                    DWORD winEr = GetLastError();
    1435                     AssertMsgFailed((__FUNCTION__": DeviceIoControl failed winEr(%d)\n", winEr));
     1435                    AssertMsgFailed(("DeviceIoControl failed winEr(%d)\n", winEr));
    14361436                    rc = VERR_VERSION_MISMATCH;
    14371437                }
     
    14531453        {
    14541454            DWORD winEr = GetLastError();
    1455             AssertMsgFailed((__FUNCTION__": CreateEvent for InterruptEvent failed winEr(%d)\n", winEr));
     1455            AssertMsgFailed(("CreateEvent for InterruptEvent failed winEr(%d)\n", winEr));
    14561456            rc = VERR_GENERAL_FAILURE;
    14571457        }
     
    14621462    {
    14631463        DWORD winEr = GetLastError();
    1464         AssertMsgFailed((__FUNCTION__": CreateEvent for NotifyEvent failed winEr(%d)\n", winEr));
     1464        AssertMsgFailed(("CreateEvent for NotifyEvent failed winEr(%d)\n", winEr));
    14651465        rc = VERR_GENERAL_FAILURE;
    14661466    }
     
    14951495    {
    14961496        DWORD winEr = GetLastError();
    1497         AssertMsgFailed((__FUNCTION__": PostMessage for hWnd failed winEr(%d)\n", winEr));
    1498     }
    1499 
    1500     DWORD dwResult = WaitForSingleObject(g_VBoxUsbGlobal.hThread, INFINITE);
    1501     Assert(dwResult == WAIT_OBJECT_0);
    1502     bRc = CloseHandle(g_VBoxUsbGlobal.hThread);
    1503     if (!bRc)
    1504     {
    1505         DWORD winEr = GetLastError();
    1506         AssertMsgFailed((__FUNCTION__": CloseHandle for hThread failed winEr(%d)\n", winEr));
     1497        AssertMsgFailed(("PostMessage for hWnd failed winEr(%d)\n", winEr));
     1498    }
     1499
     1500    if (g_VBoxUsbGlobal.hThread != NULL)
     1501    {
     1502        DWORD dwResult = WaitForSingleObject(g_VBoxUsbGlobal.hThread, INFINITE);
     1503        Assert(dwResult == WAIT_OBJECT_0);
     1504        bRc = CloseHandle(g_VBoxUsbGlobal.hThread);
     1505        if (!bRc)
     1506        {
     1507            DWORD winEr = GetLastError();
     1508            AssertMsgFailed(("CloseHandle for hThread failed winEr(%d)\n", winEr));
     1509        }
    15071510    }
    15081511
     
    15151518        {
    15161519            DWORD winEr = GetLastError();
    1517             AssertMsgFailed((__FUNCTION__": DeleteTimerQueueEx failed winEr(%d)\n", winEr));
    1518         }
    1519     }
    1520 
    1521     bRc = DeleteTimerQueueEx(g_VBoxUsbGlobal.hTimerQueue,
    1522             INVALID_HANDLE_VALUE /* <-- to block until all timers are completed */
    1523             );
    1524     if (!bRc)
    1525     {
    1526         DWORD winEr = GetLastError();
    1527         AssertMsgFailed((__FUNCTION__": DeleteTimerQueueEx failed winEr(%d)\n", winEr));
     1520            AssertMsgFailed(("DeleteTimerQueueEx failed winEr(%d)\n", winEr));
     1521        }
     1522    }
     1523
     1524    if (g_VBoxUsbGlobal.hTimerQueue)
     1525    {
     1526        bRc = DeleteTimerQueueEx(g_VBoxUsbGlobal.hTimerQueue,
     1527                INVALID_HANDLE_VALUE /* <-- to block until all timers are completed */
     1528                );
     1529        if (!bRc)
     1530        {
     1531            DWORD winEr = GetLastError();
     1532            AssertMsgFailed(("DeleteTimerQueueEx failed winEr(%d)\n", winEr));
     1533        }
    15281534    }
    15291535#endif
     
    15331539    {
    15341540        DWORD winEr = GetLastError();
    1535         AssertMsgFailed((__FUNCTION__": CloseHandle for hMonitor failed winEr(%d)\n", winEr));
     1541        AssertMsgFailed(("CloseHandle for hMonitor failed winEr(%d)\n", winEr));
    15361542    }
    15371543
     
    15401546    {
    15411547        DWORD winEr = GetLastError();
    1542         AssertMsgFailed((__FUNCTION__": CloseHandle for hInterruptEvent failed winEr(%d)\n", winEr));
     1548        AssertMsgFailed(("CloseHandle for hInterruptEvent failed winEr(%d)\n", winEr));
    15431549    }
    15441550
     
    15471553    {
    15481554        DWORD winEr = GetLastError();
    1549         AssertMsgFailed((__FUNCTION__": CloseHandle for hNotifyEvent failed winEr(%d)\n", winEr));
     1555        AssertMsgFailed(("CloseHandle for hNotifyEvent failed winEr(%d)\n", winEr));
    15501556    }
    15511557
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