vbox的更動 38785 路徑 trunk/src/VBox/HostDrivers/VBoxUSB
- 時間撮記:
- 2011-9-16 下午09:42:20 (13 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp
r38715 r38785 51 51 * Structures and Typedefs * 52 52 *******************************************************************************/ 53 typedef struct _USB_INTERFACE_DESCRIPTOR2 53 typedef struct _USB_INTERFACE_DESCRIPTOR2 54 54 { 55 55 UCHAR bLength; … … 86 86 } VBOXUSB_STRING_DR_ENTRY, *PVBOXUSB_STRING_DR_ENTRY; 87 87 88 /** 88 /** 89 89 * This represents VBoxUsb device instance 90 90 */ … … 344 344 { 345 345 char *pStringUTF8 = NULL; 346 /** @todo r=bird: This code is making bad asumptions that strings are sane and 347 * that stuff succeeds: 348 * http://vbox.innotek.de/pipermail/vbox-dev/2011-August/004516.html 349 * 350 * Also, why is this code converting stuff to the ANSI code page?!? If 351 * That's somehow required, the reason must be documented since all strings in 352 * VBox are UTF-8 unless explicitly stated otherwise! */ 346 353 RTUtf16ToUtf8((PCRTUTF16)pDrList->StrDr.bString, &pStringUTF8); 347 354 RTStrUtf8ToCurrentCP(lppszString, pStringUTF8); … … 1249 1256 g_VBoxUsbGlobal.hWnd = NULL; 1250 1257 1251 /* 1258 /* 1252 1259 * Register the Window Class and the hitten window create. 1253 1260 */ … … 1284 1291 SWP_NOACTIVATE | SWP_HIDEWINDOW | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE); 1285 1292 1286 /* 1293 /* 1287 1294 * The message pump. 1288 1295 */ … … 1344 1351 * Open the USB monitor device, starting if needed. 1345 1352 */ 1346 g_VBoxUsbGlobal.hMonitor = CreateFile(USBMON_DEVICE_NAME, 1347 GENERIC_READ | GENERIC_WRITE, 1348 FILE_SHARE_READ | FILE_SHARE_WRITE, 1353 g_VBoxUsbGlobal.hMonitor = CreateFile(USBMON_DEVICE_NAME, 1354 GENERIC_READ | GENERIC_WRITE, 1355 FILE_SHARE_READ | FILE_SHARE_WRITE, 1349 1356 NULL, 1350 OPEN_EXISTING, 1351 FILE_ATTRIBUTE_SYSTEM, 1357 OPEN_EXISTING, 1358 FILE_ATTRIBUTE_SYSTEM, 1352 1359 NULL); 1353 1360 … … 1357 1364 if (hr == S_OK) 1358 1365 { 1359 g_VBoxUsbGlobal.hMonitor = CreateFile(USBMON_DEVICE_NAME, 1360 GENERIC_READ | GENERIC_WRITE, 1366 g_VBoxUsbGlobal.hMonitor = CreateFile(USBMON_DEVICE_NAME, 1367 GENERIC_READ | GENERIC_WRITE, 1361 1368 FILE_SHARE_READ | FILE_SHARE_WRITE, 1362 NULL, 1363 OPEN_EXISTING, 1364 FILE_ATTRIBUTE_SYSTEM, 1369 NULL, 1370 OPEN_EXISTING, 1371 FILE_ATTRIBUTE_SYSTEM, 1365 1372 NULL); 1366 1373 if (g_VBoxUsbGlobal.hMonitor == INVALID_HANDLE_VALUE) … … 1376 1383 { 1377 1384 /* 1378 * Check the USB monitor version. 1379 * 1380 * Drivers are backwards compatible within the same major 1381 * number. We consider the minor version number this library 1385 * Check the USB monitor version. 1386 * 1387 * Drivers are backwards compatible within the same major 1388 * number. We consider the minor version number this library 1382 1389 * is compiled with to be the minimum required by the driver. 1383 * This is by reasoning that the library uses the full feature 1384 * set of the driver it's written for. 1390 * This is by reasoning that the library uses the full feature 1391 * set of the driver it's written for. 1385 1392 */ 1386 1393 USBSUP_VERSION Version = {0}; 1387 1394 DWORD cbReturned = 0; 1388 if (DeviceIoControl(g_VBoxUsbGlobal.hMonitor, SUPUSBFLT_IOCTL_GET_VERSION, 1389 NULL, 0, 1390 &Version, sizeof (Version), 1395 if (DeviceIoControl(g_VBoxUsbGlobal.hMonitor, SUPUSBFLT_IOCTL_GET_VERSION, 1396 NULL, 0, 1397 &Version, sizeof (Version), 1391 1398 &cbReturned, NULL)) 1392 1399 { 1393 if ( Version.u32Major == USBMON_MAJOR_VERSION 1400 if ( Version.u32Major == USBMON_MAJOR_VERSION 1394 1401 && Version.u32Minor >= USBMON_MINOR_VERSION) 1395 1402 { 1396 1403 #ifndef VBOX_USB_USE_DEVICE_NOTIFICATION 1397 1404 /* 1398 * Tell the monitor driver which event object to use 1405 * Tell the monitor driver which event object to use 1399 1406 * for notifications. 1400 1407 */ … … 1410 1417 if (RT_SUCCESS(rc)) 1411 1418 { 1412 /* 1419 /* 1413 1420 * We're DONE! 1414 */ 1421 */ 1415 1422 return VINF_SUCCESS; 1416 1423 } … … 1445 1452 if (g_VBoxUsbGlobal.hWnd) 1446 1453 { 1447 /* 1454 /* 1448 1455 * We're DONE! 1449 * 1450 * Juse ensure that the event is set so the 1456 * 1457 * Juse ensure that the event is set so the 1451 1458 * first "wait change" request is processed. 1452 1459 */ … … 1480 1487 else 1481 1488 { 1482 LogRel((__FUNCTION__": USB Monitor driver version mismatch! driver=%u.%u library=%u.%u\n", 1489 LogRel((__FUNCTION__": USB Monitor driver version mismatch! driver=%u.%u library=%u.%u\n", 1483 1490 Version.u32Major, Version.u32Minor, USBMON_MAJOR_VERSION, USBMON_MINOR_VERSION)); 1484 1491 #ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS … … 1580 1587 AssertMsg(bRc, ("CloseHandle for hMonitor failed winEr(%d)\n", GetLastError())); 1581 1588 g_VBoxUsbGlobal.hMonitor = INVALID_HANDLE_VALUE; 1582 1589 1583 1590 bRc = CloseHandle(g_VBoxUsbGlobal.hInterruptEvent); 1584 1591 AssertMsg(bRc, ("CloseHandle for hInterruptEvent failed lasterr=%u\n", GetLastError()));
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器