Changeset 81058 in vbox for trunk/src/VBox/HostDrivers/VBoxUSB/win/lib
- Timestamp:
- Sep 27, 2019 2:07:15 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp
r80964 r81058 125 125 { 126 126 dwErr = GetLastError(); 127 AssertMsgFailed(("CreateFile FAILED to open %s, dwErr (%d)\n", pVuDev->szName, dwErr));128 LogRelFunc(("Failed to open `%s' (dwErr=% d)!\n", pVuDev->szName, dwErr));127 AssertMsgFailed(("CreateFile FAILED to open %s, dwErr=%u\n", pVuDev->szName, dwErr)); 128 LogRelFunc(("Failed to open `%s' (dwErr=%u)!\n", pVuDev->szName, dwErr)); 129 129 return VERR_GENERAL_FAILURE; 130 130 } … … 140 140 dwErr = GetLastError(); 141 141 AssertMsgFailed(("DeviceIoControl SUPUSB_IOCTL_GET_VERSION failed with LastError=%Rwa\n", dwErr)); 142 LogRelFunc(("SUPUSB_IOCTL_GET_VERSION failed on `%s' (dwErr=% d)!\n", pVuDev->szName, dwErr));142 LogRelFunc(("SUPUSB_IOCTL_GET_VERSION failed on `%s' (dwErr=%u)!\n", pVuDev->szName, dwErr)); 143 143 break; 144 144 } … … 159 159 dwErr = GetLastError(); 160 160 AssertMsgFailed(("DeviceIoControl SUPUSB_IOCTL_IS_OPERATIONAL failed with LastError=%Rwa\n", dwErr)); 161 LogRelFunc(("SUPUSB_IOCTL_IS_OPERATIONAL failed on `%s' (dwErr=% d)!\n", pVuDev->szName, dwErr));161 LogRelFunc(("SUPUSB_IOCTL_IS_OPERATIONAL failed on `%s' (dwErr=%u)!\n", pVuDev->szName, dwErr)); 162 162 break; 163 163 } … … 255 255 { 256 256 DWORD dwErr = GetLastError(); NOREF(dwErr); 257 AssertMsgFailed(("SetupDiGetClassDevs, dwErr (% d)\n", dwErr));257 AssertMsgFailed(("SetupDiGetClassDevs, dwErr (%u)\n", dwErr)); 258 258 return VERR_GENERAL_FAILURE; 259 259 } … … 273 273 break; 274 274 275 AssertMsgFailed(("SetupDiEnumDeviceInterfaces, dwErr (% d), resuming\n", dwErr));275 AssertMsgFailed(("SetupDiEnumDeviceInterfaces, dwErr (%u), resuming\n", dwErr)); 276 276 continue; 277 277 } … … 397 397 { 398 398 #ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS 399 AssertMsgFailed(("DeviceIoControl 1 fail dwErr (% d)\n", GetLastError()));399 AssertMsgFailed(("DeviceIoControl 1 fail dwErr (%u)\n", GetLastError())); 400 400 #endif 401 401 return VERR_GENERAL_FAILURE; … … 427 427 { 428 428 DWORD dwErr = GetLastError(); NOREF(dwErr); 429 AssertMsgFailed(("DeviceIoControl 2 fail dwErr (% d)\n", dwErr));429 AssertMsgFailed(("DeviceIoControl 2 fail dwErr (%u)\n", dwErr)); 430 430 rc = VERR_GENERAL_FAILURE; 431 431 } … … 526 526 { 527 527 DWORD dwErr = GetLastError(); 528 LogRelFunc(("IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION #1 failed (dwErr=% d) on hub %s port %d\n", dwErr, lpcszHubName, iPort));528 LogRelFunc(("IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION #1 failed (dwErr=%u) on hub %s port %d\n", dwErr, lpcszHubName, iPort)); 529 529 #ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS 530 530 AssertFailed(); … … 563 563 { 564 564 DWORD dwErr = GetLastError(); 565 LogRelFunc(("IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION #2 failed (dwErr=% d) on hub %s port %d\n", dwErr, lpcszHubName, iPort));565 LogRelFunc(("IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION #2 failed (dwErr=%u) on hub %s port %d\n", dwErr, lpcszHubName, iPort)); 566 566 #ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS 567 567 AssertFailed(); … … 617 617 { 618 618 DWORD dwErr = GetLastError(); 619 LogRel(("Getting USB descriptor (id %u) failed with error %ldon hub %s port %d\n", iDr, dwErr, lpcszHubName, iPort));619 LogRel(("Getting USB descriptor (id %u) failed (dwErr=%u) on hub %s port %d\n", iDr, dwErr, lpcszHubName, iPort)); 620 620 return RTErrConvertFromWin32(dwErr); 621 621 } … … 777 777 { 778 778 DWORD dwErr = GetLastError(); NOREF(dwErr); 779 LogRel(("Getting USB connection information failed with error %ldon hub %s\n", dwErr, lpcszHubName));780 AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed dwErr (%d)\n", dwErr));779 LogRel(("Getting USB connection information failed (dwErr=%u) on hub %s\n", dwErr, lpcszHubName)); 780 AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed (dwErr=%u)\n", dwErr)); 781 781 return VERR_GENERAL_FAILURE; 782 782 } … … 887 887 &cbReturned, NULL)) 888 888 { 889 LogRel(("Getting USB node information failed with error %ldon hub %s\n", GetLastError(), lpszName));889 LogRel(("Getting USB node information failed (dwErr=%u) on hub %s\n", GetLastError(), lpszName)); 890 890 AssertFailed(); 891 891 break; … … 1091 1091 if (HubDevice == INVALID_HANDLE_VALUE) 1092 1092 { 1093 LogRelFunc(("Failed to open hub `%s' (dwErr=% d)\n", lpcszHubFile, GetLastError()));1093 LogRelFunc(("Failed to open hub `%s' (dwErr=%u)\n", lpcszHubFile, GetLastError())); 1094 1094 return VERR_FILE_NOT_FOUND; 1095 1095 } … … 1110 1110 { 1111 1111 DWORD dwErr = GetLastError(); NOREF(dwErr); 1112 LogRel(("IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX failed with error %ldon hub %s, port %d\n", dwErr, lpcszHubFile, iPort));1113 AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed dwErr (% d)\n", dwErr));1112 LogRel(("IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX failed (dwErr=%u) on hub %s, port %d\n", dwErr, lpcszHubFile, iPort)); 1113 AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed dwErr (%u)\n", dwErr)); 1114 1114 CloseHandle(HubDevice); 1115 1115 return VERR_GENERAL_FAILURE; … … 1328 1328 DWORD dwErr = GetLastError(); 1329 1329 #ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS 1330 1331 AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed dwErr (%d)\n", dwErr));1330 /* ERROR_DEVICE_NOT_CONNECTED -> device was removed just now */ 1331 AssertMsg(dwErr == ERROR_DEVICE_NOT_CONNECTED, (__FUNCTION__": DeviceIoControl failed dwErr (%u)\n", dwErr)); 1332 1332 #endif 1333 1333 LogRelFunc(("SUPUSB_IOCTL_GET_DEVICE failed on '%s' (dwErr=%u)!\n", pDevInfos->szName, dwErr)); 1334 1335 1334 CloseHandle(hDev); 1335 break; 1336 1336 } 1337 1337 … … 1343 1343 if (!DeviceIoControl(pGlobal->hMonitor, SUPUSBFLT_IOCTL_GET_DEVICE, &hDevice, sizeof (hDevice), &MonInfo, sizeof (MonInfo), &cbReturned, NULL)) 1344 1344 { 1345 1346 1347 AssertMsgFailed(("Monitor DeviceIoControl failed dwErr (%d)\n", dwErr));1345 DWORD dwErr = GetLastError(); 1346 /* ERROR_DEVICE_NOT_CONNECTED -> device was removed just now */ 1347 AssertMsgFailed(("Monitor DeviceIoControl failed dwErr (%u)\n", dwErr)); 1348 1348 LogRelFunc(("SUPUSBFLT_IOCTL_GET_DEVICE failed for '%s' (hDevice=%p, dwErr=%u)!\n", pDevInfos->szName, hDevice, dwErr)); 1349 1350 1349 CloseHandle(hDev); 1350 break; 1351 1351 } 1352 1352 … … 1431 1431 { 1432 1432 DWORD dwErr = GetLastError(); NOREF(dwErr); 1433 AssertMsgFailed(("WaitForMultipleObjects failed, dwErr (% d)\n", dwErr));1433 AssertMsgFailed(("WaitForMultipleObjects failed, dwErr (%u)\n", dwErr)); 1434 1434 return VERR_GENERAL_FAILURE; 1435 1435 } … … 1450 1450 { 1451 1451 DWORD dwErr = GetLastError(); NOREF(dwErr); 1452 AssertMsgFailed(("SetEvent failed, dwErr (% d)\n", dwErr));1452 AssertMsgFailed(("SetEvent failed, dwErr (%u)\n", dwErr)); 1453 1453 return VERR_GENERAL_FAILURE; 1454 1454 } … … 1498 1498 &cbReturned, NULL)) 1499 1499 { 1500 DWORD dwErr = GetLastError(); NOREF(dwErr); 1501 AssertMsgFailed(("DeviceIoControl failed with dwErr (%d(\n", dwErr)); 1500 DWORD dwErr = GetLastError(); 1501 AssertMsgFailed(("DeviceIoControl failed with dwErr (%u)\n", dwErr)); 1502 LogRelFunc(("SUPUSBFLT_IOCTL_ADD_FILTER failed (dwErr=%u)!\n", dwErr)); 1502 1503 return NULL; 1503 1504 } … … 1506 1507 { 1507 1508 AssertMsgFailed(("Adding filter failed with %d\n", FltAddRc.rc)); 1509 LogRelFunc(("Adding a USB filter failed with rc=%d!\n", FltAddRc.rc)); 1508 1510 return NULL; 1509 1511 } 1512 1513 LogRel(("Added USB filter (ID=%u, type=%d) for device %04X:%04X rev %04X, c/s/p %02X/%02X/%02X, Manufacturer=`%s' Product=`%s' Serial=`%s'\n", FltAddRc.uId, USBFilterGetFilterType(pFilter), 1514 USBFilterGetNum(pFilter, USBFILTERIDX_VENDOR_ID), USBFilterGetNum(pFilter, USBFILTERIDX_PRODUCT_ID), USBFilterGetNum(pFilter, USBFILTERIDX_DEVICE_REV), 1515 USBFilterGetNum(pFilter, USBFILTERIDX_DEVICE_CLASS), USBFilterGetNum(pFilter, USBFILTERIDX_DEVICE_SUB_CLASS), USBFilterGetNum(pFilter, USBFILTERIDX_DEVICE_PROTOCOL), 1516 USBFilterGetString(pFilter, USBFILTERIDX_MANUFACTURER_STR) ? USBFilterGetString(pFilter, USBFILTERIDX_MANUFACTURER_STR) : "<null>", 1517 USBFilterGetString(pFilter, USBFILTERIDX_PRODUCT_STR) ? USBFilterGetString(pFilter, USBFILTERIDX_PRODUCT_STR) : "<null>", 1518 USBFilterGetString(pFilter, USBFILTERIDX_SERIAL_NUMBER_STR) ? USBFilterGetString(pFilter, USBFILTERIDX_SERIAL_NUMBER_STR) : "<null>")); 1519 1510 1520 return (void *)FltAddRc.uId; 1511 1521 } … … 1529 1539 uId = (uintptr_t)pvId; 1530 1540 if (!DeviceIoControl(g_VBoxUsbGlobal.hMonitor, SUPUSBFLT_IOCTL_REMOVE_FILTER, &uId, sizeof(uId), NULL, 0,&cbReturned, NULL)) 1531 AssertMsgFailed(("DeviceIoControl failed with LastError=%Rwa\n", GetLastError())); 1541 { 1542 DWORD dwErr = GetLastError(); 1543 AssertMsgFailed(("DeviceIoControl failed with LastError=%Rwa\n", dwErr)); 1544 LogRelFunc(("SUPUSBFLT_IOCTL_REMOVE_FILTER failed (dwErr=%u)!\n", dwErr)); 1545 } 1546 else 1547 LogRel(("Removed USB filter ID=%u\n", uId)); 1532 1548 } 1533 1549 … … 1544 1560 { 1545 1561 DWORD dwErr = GetLastError(); 1546 AssertMsgFailed(("DeviceIoControl failed with dwErr (%d(\n", dwErr)); 1562 AssertMsgFailed(("DeviceIoControl failed with dwErr (%u)\n", dwErr)); 1563 LogRelFunc(("SUPUSBFLT_IOCTL_RUN_FILTERS failed (dwErr=%u)!\n", dwErr)); 1547 1564 return RTErrConvertFromWin32(dwErr); 1548 1565 } … … 1571 1588 { 1572 1589 DWORD dwErr = GetLastError(); NOREF(dwErr); 1573 AssertMsg(dwErr == ERROR_IO_PENDING, ("DeleteTimerQueueTimer failed, dwErr (% d)\n", dwErr));1590 AssertMsg(dwErr == ERROR_IO_PENDING, ("DeleteTimerQueueTimer failed, dwErr (%u)\n", dwErr)); 1574 1591 } 1575 1592 } … … 1583 1600 { 1584 1601 DWORD dwErr = GetLastError(); NOREF(dwErr); 1585 AssertMsgFailed(("CreateTimerQueueTimer failed, dwErr (% d)\n", dwErr));1602 AssertMsgFailed(("CreateTimerQueueTimer failed, dwErr (%u)\n", dwErr)); 1586 1603 1587 1604 /* call it directly */ … … 1738 1755 { 1739 1756 DWORD dwErr = GetLastError(); 1740 LogRelFunc(("CreateFile failed (dwErr=% d) for `%s'\n", dwErr, USBMON_DEVICE_NAME));1757 LogRelFunc(("CreateFile failed (dwErr=%u) for `%s'\n", dwErr, USBMON_DEVICE_NAME)); 1741 1758 rc = VERR_FILE_NOT_FOUND; 1742 1759 } … … 1810 1827 BOOL fRc = CloseHandle(g_VBoxUsbGlobal.hThread); NOREF(fRc); 1811 1828 DWORD dwErr = GetLastError(); NOREF(dwErr); 1812 AssertMsg(fRc, ("CloseHandle for hThread failed (dwErr=% d)\n", dwErr));1829 AssertMsg(fRc, ("CloseHandle for hThread failed (dwErr=%u)\n", dwErr)); 1813 1830 g_VBoxUsbGlobal.hThread = INVALID_HANDLE_VALUE; 1814 1831 } … … 1816 1833 { 1817 1834 DWORD dwErr = GetLastError(); NOREF(dwErr); 1818 AssertMsgFailed(("CreateThread failed, dwErr (%d)\n", dwErr));1835 AssertMsgFailed(("CreateThread failed, (dwErr=%u)\n", dwErr)); 1819 1836 rc = VERR_GENERAL_FAILURE; 1820 1837 } … … 1826 1843 { 1827 1844 DWORD dwErr = GetLastError(); NOREF(dwErr); 1828 AssertMsgFailed(("CreateTimerQueue failed (dwErr=% d)\n", dwErr));1845 AssertMsgFailed(("CreateTimerQueue failed (dwErr=%u)\n", dwErr)); 1829 1846 } 1830 1847 } … … 1842 1859 { 1843 1860 DWORD dwErr = GetLastError(); NOREF(dwErr); 1844 LogRelFunc(("SUPUSBFLT_IOCTL_GET_VERSION failed (dwErr=% d)\n", dwErr));1861 LogRelFunc(("SUPUSBFLT_IOCTL_GET_VERSION failed (dwErr=%u)\n", dwErr)); 1845 1862 AssertFailed(); 1846 1863 rc = VERR_VERSION_MISMATCH; … … 1864 1881 else 1865 1882 { 1866 DWORD dwErr = GetLastError(); NOREF(dwErr); 1867 AssertMsgFailed(("CreateEvent for InterruptEvent failed (dwErr=%d)\n", dwErr)); 1883 AssertMsgFailed(("CreateEvent for InterruptEvent failed (dwErr=%u)\n", GetLastError())); 1868 1884 rc = VERR_GENERAL_FAILURE; 1869 1885 } … … 1874 1890 else 1875 1891 { 1876 DWORD dwErr = GetLastError(); NOREF(dwErr); 1877 AssertMsgFailed(("CreateEvent for NotifyEvent failed (dwErr=%d)\n", dwErr)); 1892 AssertMsgFailed(("CreateEvent for NotifyEvent failed (dwErr=%u)\n", GetLastError())); 1878 1893 rc = VERR_GENERAL_FAILURE; 1879 1894 } … … 1903 1918 BOOL fRc; 1904 1919 fRc = PostMessage(g_VBoxUsbGlobal.hWnd, WM_CLOSE, 0, 0); 1905 AssertMsg(fRc, ("PostMessage for hWnd failed (dwErr=% d)\n", GetLastError()));1920 AssertMsg(fRc, ("PostMessage for hWnd failed (dwErr=%u)\n", GetLastError())); 1906 1921 1907 1922 if (g_VBoxUsbGlobal.hThread != NULL) … … 1910 1925 Assert(dwResult == WAIT_OBJECT_0); NOREF(dwResult); 1911 1926 fRc = CloseHandle(g_VBoxUsbGlobal.hThread); 1912 AssertMsg(fRc, ("CloseHandle for hThread failed (dwErr=% d)\n", GetLastError()));1927 AssertMsg(fRc, ("CloseHandle for hThread failed (dwErr=%u)\n", GetLastError())); 1913 1928 } 1914 1929 … … 1917 1932 fRc = DeleteTimerQueueTimer(g_VBoxUsbGlobal.hTimerQueue, g_VBoxUsbGlobal.hTimer, 1918 1933 INVALID_HANDLE_VALUE); /* <-- to block until the timer is completed */ 1919 AssertMsg(fRc, ("DeleteTimerQueueTimer failed (dwErr=% d)\n", GetLastError()));1934 AssertMsg(fRc, ("DeleteTimerQueueTimer failed (dwErr=%u)\n", GetLastError())); 1920 1935 } 1921 1936 … … 1924 1939 fRc = DeleteTimerQueueEx(g_VBoxUsbGlobal.hTimerQueue, 1925 1940 INVALID_HANDLE_VALUE); /* <-- to block until all timers are completed */ 1926 AssertMsg(fRc, ("DeleteTimerQueueEx failed (dwErr=% d)\n", GetLastError()));1941 AssertMsg(fRc, ("DeleteTimerQueueEx failed (dwErr=%u)\n", GetLastError())); 1927 1942 } 1928 1943 1929 1944 fRc = CloseHandle(g_VBoxUsbGlobal.hMonitor); 1930 AssertMsg(fRc, ("CloseHandle for hMonitor failed (dwErr=% d)\n", GetLastError()));1945 AssertMsg(fRc, ("CloseHandle for hMonitor failed (dwErr=%u)\n", GetLastError())); 1931 1946 g_VBoxUsbGlobal.hMonitor = INVALID_HANDLE_VALUE; 1932 1947 1933 1948 fRc = CloseHandle(g_VBoxUsbGlobal.hInterruptEvent); 1934 AssertMsg(fRc, ("CloseHandle for hInterruptEvent failed lasterr=%u\n", GetLastError()));1949 AssertMsg(fRc, ("CloseHandle for hInterruptEvent failed (dwErr=%u)\n", GetLastError())); 1935 1950 g_VBoxUsbGlobal.hInterruptEvent = NULL; 1936 1951 1937 1952 fRc = CloseHandle(g_VBoxUsbGlobal.hNotifyEvent); 1938 AssertMsg(fRc, ("CloseHandle for hNotifyEvent failed (dwErr=% d)\n", GetLastError()));1953 AssertMsg(fRc, ("CloseHandle for hNotifyEvent failed (dwErr=%u)\n", GetLastError())); 1939 1954 g_VBoxUsbGlobal.hNotifyEvent = NULL; 1940 1955
Note:
See TracChangeset
for help on using the changeset viewer.