VirtualBox

Ignore:
Timestamp:
Jul 29, 2016 1:44:32 PM (9 years ago)
Author:
vboxsync
Message:

HostDrivers: warnings

File:
1 edited

Legend:

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

    r62686 r62690  
    114114    if (hOut == INVALID_HANDLE_VALUE)
    115115    {
    116         DWORD winEr = GetLastError();
    117         AssertMsgFailed(("CreateFile FAILED to open %s, winEr (%d)\n", pVuDev->szName, winEr));
     116        DWORD dwErr = GetLastError(); NOREF(dwErr);
     117        AssertMsgFailed(("CreateFile FAILED to open %s, dwErr (%d)\n", pVuDev->szName, dwErr));
    118118        return VERR_GENERAL_FAILURE;
    119119    }
     
    132132
    133133        if (   version.u32Major != USBDRV_MAJOR_VERSION
    134             || version.u32Minor <  USBDRV_MINOR_VERSION)
     134#if USBDRV_MINOR_VERSION != 0
     135            || version.u32Minor <  USBDRV_MINOR_VERSION
     136#endif
     137           )
    135138        {
    136139            AssertMsgFailed(("Invalid version %d:%d vs %d:%d\n", version.u32Major, version.u32Minor, USBDRV_MAJOR_VERSION, USBDRV_MINOR_VERSION));
     
    184187                                &DevInfoData))
    185188        {
    186             DWORD winEr = GetLastError();
    187             AssertMsgFailed(("SetupDiGetDeviceInterfaceDetail, cbRequired (%d), was (%d), winEr (%d)\n", cbDbgRequired, cbIfDetailData, winEr));
     189            DWORD dwErr = GetLastError(); NOREF(dwErr);
     190            AssertMsgFailed(("SetupDiGetDeviceInterfaceDetail, cbRequired (%d), was (%d), dwErr (%d)\n", cbDbgRequired, cbIfDetailData, dwErr));
    188191            rc = VERR_GENERAL_FAILURE;
    189192            break;
     
    198201            &cbDbgRequired))
    199202        {
    200             DWORD winEr = GetLastError();
    201             AssertMsgFailed(("SetupDiGetDeviceRegistryPropertyA, cbRequired (%d), was (%d), winEr (%d)\n", cbDbgRequired, sizeof (pVuDev->szDriverRegName), winEr));
     203            DWORD dwErr = GetLastError(); NOREF(dwErr);
     204            AssertMsgFailed(("SetupDiGetDeviceRegistryPropertyA, cbRequired (%d), was (%d), dwErr (%d)\n", cbDbgRequired, sizeof (pVuDev->szDriverRegName), dwErr));
    202205            rc = VERR_GENERAL_FAILURE;
    203206            break;
     
    234237    if (hDevInfo == INVALID_HANDLE_VALUE)
    235238    {
    236         DWORD winEr = GetLastError();
    237         AssertMsgFailed(("SetupDiGetClassDevs, winEr (%d)\n", winEr));
     239        DWORD dwErr = GetLastError(); NOREF(dwErr);
     240        AssertMsgFailed(("SetupDiGetClassDevs, dwErr (%d)\n", dwErr));
    238241        return VERR_GENERAL_FAILURE;
    239242    }
     
    249252                            &IfData))
    250253        {
    251             DWORD winEr = GetLastError();
    252             if (winEr == ERROR_NO_MORE_ITEMS)
     254            DWORD dwErr = GetLastError();
     255            if (dwErr == ERROR_NO_MORE_ITEMS)
    253256                break;
    254257
    255             AssertMsgFailed(("SetupDiEnumDeviceInterfaces, winEr (%d), resuming\n", winEr));
     258            AssertMsgFailed(("SetupDiEnumDeviceInterfaces, dwErr (%d), resuming\n", dwErr));
    256259            continue;
    257260        }
     
    360363    {
    361364#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
    362         DWORD winEr = GetLastError();
    363         AssertMsgFailed(("DeviceIoControl 1 fail winEr (%d)\n", winEr));
     365        DWORD dwErr = GetLastError();
     366        AssertMsgFailed(("DeviceIoControl 1 fail dwErr (%d)\n", dwErr));
    364367#endif
    365368        return VERR_GENERAL_FAILURE;
     
    390393    else
    391394    {
    392         DWORD winEr = GetLastError();
    393         AssertMsgFailed(("DeviceIoControl 2 fail winEr (%d)\n", winEr));
     395        DWORD dwErr = GetLastError(); NOREF(dwErr);
     396        AssertMsgFailed(("DeviceIoControl 2 fail dwErr (%d)\n", dwErr));
    394397        rc = VERR_GENERAL_FAILURE;
    395398    }
     
    488491                                &cbReturned, NULL))
    489492    {
    490         DWORD winEr = GetLastError();
    491         LogRelFunc(("DeviceIoControl 1 fail winEr (%d)\n", winEr));
     493        DWORD dwErr = GetLastError();
     494        LogRelFunc(("DeviceIoControl 1 fail dwErr (%d)\n", dwErr));
    492495#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
    493496        AssertFailed();
     
    525528                                    &cbReturned, NULL))
    526529        {
    527             DWORD winEr = GetLastError();
    528             LogRelFunc(("DeviceIoControl 2 fail winEr (%d)\n", winEr));
     530            DWORD dwErr = GetLastError();
     531            LogRelFunc(("DeviceIoControl 2 fail dwErr (%d)\n", dwErr));
    529532#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
    530533            AssertFailed();
     
    729732    char Buf[sizeof (USB_NODE_CONNECTION_INFORMATION_EX) + (sizeof (USB_PIPE_INFO) * 20)];
    730733    PUSB_NODE_CONNECTION_INFORMATION_EX pConInfo = (PUSB_NODE_CONNECTION_INFORMATION_EX)Buf;
    731     PUSB_PIPE_INFO paPipeInfo = (PUSB_PIPE_INFO)(Buf + sizeof (PUSB_NODE_CONNECTION_INFORMATION_EX));
     734    //PUSB_PIPE_INFO paPipeInfo = (PUSB_PIPE_INFO)(Buf + sizeof (PUSB_NODE_CONNECTION_INFORMATION_EX));
    732735    DWORD cbReturned = 0;
    733736    memset(&Buf, 0, sizeof (Buf));
     
    738741                                  &cbReturned, NULL))
    739742    {
    740         DWORD winEr = GetLastError();
    741         AssertMsg(winEr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed winEr (%d)\n", winEr));
     743        DWORD dwErr = GetLastError(); NOREF(dwErr);
     744        AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed dwErr (%d)\n", dwErr));
    742745        return VERR_GENERAL_FAILURE;
    743746    }
     
    894897}
    895898
     899#if 0 /* unused */
    896900static PUSBSUP_GET_DEVICES usbLibMonGetDevRqAlloc(uint32_t cDevs, PDWORD pcbRq)
    897901{
     
    905909    return pRq;
    906910}
     911#endif
    907912
    908913static int usbLibMonDevicesCmp(PUSBDEVICE pDev, PVBOXUSB_DEV pDevInfo)
     
    913918}
    914919
    915 static int usbLibMonDevicesUpdate(PVBOXUSBGLOBALSTATE pGlobal, PUSBDEVICE pDevs, uint32_t cDevs, PVBOXUSB_DEV pDevInfos, uint32_t cDevInfos)
    916 {
     920static int usbLibMonDevicesUpdate(PVBOXUSBGLOBALSTATE pGlobal, PUSBDEVICE pDevs, PVBOXUSB_DEV pDevInfos)
     921{
     922
    917923    PUSBDEVICE pDevsHead = pDevs;
    918924    for (; pDevInfos; pDevInfos = pDevInfos->pNext)
     
    941947            if (!DeviceIoControl(hDev, SUPUSB_IOCTL_GET_DEVICE, &Dev, sizeof (Dev), &Dev, sizeof (Dev), &cbReturned, NULL))
    942948            {
    943                  DWORD winEr = GetLastError();
     949#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
     950                 DWORD dwErr = GetLastError(); NOREF(dwErr);
    944951                 /* ERROR_DEVICE_NOT_CONNECTED -> device was removed just now */
    945 #ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
    946                  AssertMsg(winEr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed winEr (%d)\n", winEr));
     952                 AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed dwErr (%d)\n", dwErr));
    947953#endif
    948954                 Log(("SUPUSB_IOCTL_GET_DEVICE: DeviceIoControl no longer connected\n"));
     
    958964            if (!DeviceIoControl(pGlobal->hMonitor, SUPUSBFLT_IOCTL_GET_DEVICE, &hDevice, sizeof (hDevice), &MonInfo, sizeof (MonInfo), &cbReturned, NULL))
    959965            {
    960                  DWORD winEr = GetLastError();
     966                 DWORD dwErr = GetLastError(); NOREF(dwErr);
    961967                 /* ERROR_DEVICE_NOT_CONNECTED -> device was removed just now */
    962                  AssertMsgFailed(("Monitor DeviceIoControl failed winEr (%d)\n", winEr));
     968                 AssertMsgFailed(("Monitor DeviceIoControl failed dwErr (%d)\n", dwErr));
    963969                 Log(("SUPUSBFLT_IOCTL_GET_DEVICE: DeviceIoControl no longer connected\n"));
    964970                 CloseHandle(hDev);
     
    10211027        if (RT_SUCCESS(rc))
    10221028        {
    1023             rc = usbLibMonDevicesUpdate(pGlobal, *ppDevs, *pcDevs, pDevInfos, cDevInfos);
     1029            rc = usbLibMonDevicesUpdate(pGlobal, *ppDevs, pDevInfos);
    10241030            AssertRC(rc);
    10251031            usbLibVuFreeDevices(pDevInfos);
     
    10491055        default:
    10501056        {
    1051             DWORD winEr = GetLastError();
    1052             AssertMsgFailed(("WaitForMultipleObjects failed, winEr (%d)\n", winEr));
     1057            DWORD dwErr = GetLastError(); NOREF(dwErr);
     1058            AssertMsgFailed(("WaitForMultipleObjects failed, dwErr (%d)\n", dwErr));
    10531059            return VERR_GENERAL_FAILURE;
    10541060        }
     
    10651071static int usbLibInterruptWaitChange(PVBOXUSBGLOBALSTATE pGlobal)
    10661072{
    1067     BOOL bRc = SetEvent(pGlobal->hInterruptEvent);
    1068     if (!bRc)
    1069     {
    1070         DWORD winEr = GetLastError();
    1071         AssertMsgFailed(("SetEvent failed, winEr (%d)\n", winEr));
     1073    BOOL fRc = SetEvent(pGlobal->hInterruptEvent);
     1074    if (!fRc)
     1075    {
     1076        DWORD dwErr = GetLastError(); NOREF(dwErr);
     1077        AssertMsgFailed(("SetEvent failed, dwErr (%d)\n", dwErr));
    10721078        return VERR_GENERAL_FAILURE;
    10731079    }
     
    11171123                &cbReturned, NULL))
    11181124    {
    1119         DWORD winEr = GetLastError();
    1120         AssertMsgFailed(("DeviceIoControl failed with winEr (%d(\n", winEr));
     1125        DWORD dwErr = GetLastError(); NOREF(dwErr);
     1126        AssertMsgFailed(("DeviceIoControl failed with dwErr (%d(\n", dwErr));
    11211127        return NULL;
    11221128    }
     
    11621168                &cbReturned, NULL))
    11631169    {
    1164         DWORD winEr = GetLastError();
    1165         AssertMsgFailed(("DeviceIoControl failed with winEr (%d(\n", winEr));
    1166         return RTErrConvertFromWin32(winEr);
     1170        DWORD dwErr = GetLastError();
     1171        AssertMsgFailed(("DeviceIoControl failed with dwErr (%d(\n", dwErr));
     1172        return RTErrConvertFromWin32(dwErr);
    11671173    }
    11681174
     
    11751181static VOID CALLBACK usbLibTimerCallback(__in PVOID lpParameter, __in BOOLEAN TimerOrWaitFired)
    11761182{
     1183    RT_NOREF2(lpParameter, TimerOrWaitFired);
    11771184    SetEvent(g_VBoxUsbGlobal.hNotifyEvent);
    11781185}
     
    11901197        if (!DeleteTimerQueueTimer(g_VBoxUsbGlobal.hTimerQueue, g_VBoxUsbGlobal.hTimer, NULL))
    11911198        {
    1192             DWORD winEr = GetLastError();
    1193             AssertMsg(winEr == ERROR_IO_PENDING, ("DeleteTimerQueueTimer failed, winEr (%d)\n", winEr));
     1199            DWORD dwErr = GetLastError(); NOREF(dwErr);
     1200            AssertMsg(dwErr == ERROR_IO_PENDING, ("DeleteTimerQueueTimer failed, dwErr (%d)\n", dwErr));
    11941201        }
    11951202    }
     
    12021209                               WT_EXECUTEONLYONCE))
    12031210    {
    1204         DWORD winEr = GetLastError();
    1205         AssertMsgFailed(("CreateTimerQueueTimer failed, winEr (%d)\n", winEr));
     1211        DWORD dwErr = GetLastError(); NOREF(dwErr);
     1212        AssertMsgFailed(("CreateTimerQueueTimer failed, dwErr (%d)\n", dwErr));
    12061213
    12071214        /* call it directly */
     
    12431250    static LPCSTR   s_szVBoxUsbWndClassName = "VBoxUsbLibClass";
    12441251    const HINSTANCE hInstance               = (HINSTANCE)GetModuleHandle(NULL);
     1252    RT_NOREF1(lpParameter);
    12451253
    12461254    Assert(g_VBoxUsbGlobal.hWnd == NULL);
     
    13611369                    if (g_VBoxUsbGlobal.hMonitor == INVALID_HANDLE_VALUE)
    13621370                    {
    1363                         DWORD winEr = GetLastError();
    1364                         LogRelFunc(("CreateFile failed winEr(%d)\n", winEr));
     1371                        DWORD dwErr = GetLastError();
     1372                        LogRelFunc(("CreateFile failed dwErr(%d)\n", dwErr));
    13651373                        rc = VERR_FILE_NOT_FOUND;
    13661374                    }
     
    13871395                {
    13881396                    if (   Version.u32Major == USBMON_MAJOR_VERSION
    1389                         && Version.u32Minor >= USBMON_MINOR_VERSION)
     1397#if USBMON_MINOR_VERSION != 0
     1398                        && Version.u32Minor >= USBMON_MINOR_VERSION
     1399#endif
     1400                        )
    13901401                    {
    13911402#ifndef VBOX_USB_USE_DEVICE_NOTIFICATION
     
    14151426                        else
    14161427                        {
    1417                             DWORD winEr = GetLastError();
    1418                             AssertMsgFailed(("SetEvent Ioctl failed, winEr (%d)\n", winEr));
     1428                            DWORD dwErr = GetLastError();
     1429                            AssertMsgFailed(("SetEvent Ioctl failed, dwErr (%d)\n", dwErr));
    14191430                            rc = VERR_VERSION_MISMATCH;
    14201431                        }
     
    14601471                                dwResult = WaitForSingleObject(g_VBoxUsbGlobal.hThread, INFINITE);
    14611472                                Assert(dwResult == WAIT_OBJECT_0);
    1462                                 BOOL bRc = CloseHandle(g_VBoxUsbGlobal.hThread);
    1463                                 AssertMsg(bRc, ("CloseHandle for hThread failed winEr(%d)\n", GetLastError()));
     1473                                BOOL fRc = CloseHandle(g_VBoxUsbGlobal.hThread); NOREF(fRc);
     1474                                DWORD dwErr = GetLastError(); NOREF(dwErr);
     1475                                AssertMsg(fRc, ("CloseHandle for hThread failed dwErr(%d)\n", dwErr));
    14641476                                g_VBoxUsbGlobal.hThread = INVALID_HANDLE_VALUE;
    14651477                            }
    14661478                            else
    14671479                            {
    1468                                 DWORD winEr = GetLastError();
    1469                                 AssertMsgFailed(("CreateThread failed, winEr (%d)\n", winEr));
     1480                                DWORD dwErr = GetLastError(); NOREF(dwErr);
     1481                                AssertMsgFailed(("CreateThread failed, dwErr (%d)\n", dwErr));
    14701482                                rc = VERR_GENERAL_FAILURE;
    14711483                            }
     
    14761488                        else
    14771489                        {
    1478                             DWORD winEr = GetLastError();
    1479                             AssertMsgFailed(("CreateTimerQueue failed winEr(%d)\n", winEr));
     1490                            DWORD dwErr = GetLastError(); NOREF(dwErr);
     1491                            AssertMsgFailed(("CreateTimerQueue failed dwErr(%d)\n", dwErr));
    14801492                        }
    14811493#endif
     
    14931505                else
    14941506                {
    1495                     DWORD winEr = GetLastError();
    1496                     AssertMsgFailed(("DeviceIoControl failed winEr(%d)\n", winEr));
     1507                    DWORD dwErr = GetLastError(); NOREF(dwErr);
     1508                    AssertMsgFailed(("DeviceIoControl failed dwErr(%d)\n", dwErr));
    14971509                    rc = VERR_VERSION_MISMATCH;
    14981510                }
     
    15151527        else
    15161528        {
    1517             DWORD winEr = GetLastError();
    1518             AssertMsgFailed(("CreateEvent for InterruptEvent failed winEr(%d)\n", winEr));
     1529            DWORD dwErr = GetLastError(); NOREF(dwErr);
     1530            AssertMsgFailed(("CreateEvent for InterruptEvent failed dwErr(%d)\n", dwErr));
    15191531            rc = VERR_GENERAL_FAILURE;
    15201532        }
     
    15251537    else
    15261538    {
    1527         DWORD winEr = GetLastError();
    1528         AssertMsgFailed(("CreateEvent for NotifyEvent failed winEr(%d)\n", winEr));
     1539        DWORD dwErr = GetLastError(); NOREF(dwErr);
     1540        AssertMsgFailed(("CreateEvent for NotifyEvent failed dwErr(%d)\n", dwErr));
    15291541        rc = VERR_GENERAL_FAILURE;
    15301542    }
     
    15521564    }
    15531565
    1554     BOOL bRc;
     1566    BOOL fRc;
    15551567#ifdef VBOX_USB_USE_DEVICE_NOTIFICATION
    1556     bRc = PostMessage(g_VBoxUsbGlobal.hWnd, WM_CLOSE, 0, 0);
    1557     AssertMsg(bRc, ("PostMessage for hWnd failed winEr(%d)\n", GetLastError()));
     1568    fRc = PostMessage(g_VBoxUsbGlobal.hWnd, WM_CLOSE, 0, 0);
     1569    AssertMsg(fRc, ("PostMessage for hWnd failed dwErr(%d)\n", GetLastError()));
    15581570
    15591571    if (g_VBoxUsbGlobal.hThread != NULL)
    15601572    {
    15611573        DWORD dwResult = WaitForSingleObject(g_VBoxUsbGlobal.hThread, INFINITE);
    1562         Assert(dwResult == WAIT_OBJECT_0);
    1563         bRc = CloseHandle(g_VBoxUsbGlobal.hThread);
    1564         AssertMsg(bRc, ("CloseHandle for hThread failed winEr(%d)\n", GetLastError()));
     1574        Assert(dwResult == WAIT_OBJECT_0); NOREF(dwResult);
     1575        fRc = CloseHandle(g_VBoxUsbGlobal.hThread);
     1576        AssertMsg(fRc, ("CloseHandle for hThread failed dwErr(%d)\n", GetLastError()));
    15651577    }
    15661578
    15671579    if (g_VBoxUsbGlobal.hTimer)
    15681580    {
    1569         bRc = DeleteTimerQueueTimer(g_VBoxUsbGlobal.hTimerQueue, g_VBoxUsbGlobal.hTimer,
     1581        fRc = DeleteTimerQueueTimer(g_VBoxUsbGlobal.hTimerQueue, g_VBoxUsbGlobal.hTimer,
    15701582                                    INVALID_HANDLE_VALUE); /* <-- to block until the timer is completed */
    1571         AssertMsg(bRc, ("DeleteTimerQueueTimer failed winEr(%d)\n", GetLastError()));
     1583        AssertMsg(fRc, ("DeleteTimerQueueTimer failed dwErr(%d)\n", GetLastError()));
    15721584    }
    15731585
    15741586    if (g_VBoxUsbGlobal.hTimerQueue)
    15751587    {
    1576         bRc = DeleteTimerQueueEx(g_VBoxUsbGlobal.hTimerQueue,
     1588        fRc = DeleteTimerQueueEx(g_VBoxUsbGlobal.hTimerQueue,
    15771589                                 INVALID_HANDLE_VALUE); /* <-- to block until all timers are completed */
    1578         AssertMsg(bRc, ("DeleteTimerQueueEx failed winEr(%d)\n", GetLastError()));
     1590        AssertMsg(fRc, ("DeleteTimerQueueEx failed dwErr(%d)\n", GetLastError()));
    15791591    }
    15801592#endif /* VBOX_USB_USE_DEVICE_NOTIFICATION */
    15811593
    1582     bRc = CloseHandle(g_VBoxUsbGlobal.hMonitor);
    1583     AssertMsg(bRc, ("CloseHandle for hMonitor failed winEr(%d)\n", GetLastError()));
     1594    fRc = CloseHandle(g_VBoxUsbGlobal.hMonitor);
     1595    AssertMsg(fRc, ("CloseHandle for hMonitor failed dwErr(%d)\n", GetLastError()));
    15841596    g_VBoxUsbGlobal.hMonitor = INVALID_HANDLE_VALUE;
    15851597
    1586     bRc = CloseHandle(g_VBoxUsbGlobal.hInterruptEvent);
    1587     AssertMsg(bRc, ("CloseHandle for hInterruptEvent failed lasterr=%u\n", GetLastError()));
     1598    fRc = CloseHandle(g_VBoxUsbGlobal.hInterruptEvent);
     1599    AssertMsg(fRc, ("CloseHandle for hInterruptEvent failed lasterr=%u\n", GetLastError()));
    15881600    g_VBoxUsbGlobal.hInterruptEvent = NULL;
    15891601
    1590     bRc = CloseHandle(g_VBoxUsbGlobal.hNotifyEvent);
    1591     AssertMsg(bRc, ("CloseHandle for hNotifyEvent failed winEr(%d)\n", GetLastError()));
     1602    fRc = CloseHandle(g_VBoxUsbGlobal.hNotifyEvent);
     1603    AssertMsg(fRc, ("CloseHandle for hNotifyEvent failed dwErr(%d)\n", GetLastError()));
    15921604    g_VBoxUsbGlobal.hNotifyEvent = NULL;
    15931605
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