Changeset 37047 in vbox
- Timestamp:
- May 12, 2011 10:29:26 AM (14 years ago)
- Location:
- trunk/src/VBox/HostDrivers/VBoxUSB/win
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxUSB/win/cmn/VBoxDrvTool.cpp
r36968 r37047 132 132 } 133 133 134 /* !!!NOTE: the caller MUST be the IRP owner!!! * 135 * !! one can not post threaded IRPs this way!! */ 136 VBOXDRVTOOL_DECL(NTSTATUS) VBoxDrvToolIoPostSyncWithTimeout(PDEVICE_OBJECT pDevObj, PIRP pIrp, ULONG dwTimeoutMs) 137 { 138 KEVENT Event; 139 KeInitializeEvent(&Event, NotificationEvent, FALSE); 140 NTSTATUS Status = VBoxDrvToolIoPostAsync(pDevObj, pIrp, &Event); 141 if (Status == STATUS_PENDING) 142 { 143 LARGE_INTEGER Interval; 144 PLARGE_INTEGER pInterval = NULL; 145 if (dwTimeoutMs != RT_INDEFINITE_WAIT) 146 { 147 Interval.QuadPart = -(int64_t) dwTimeoutMs /* ms */ * 10000; 148 pInterval = &Interval; 149 } 150 151 Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, pInterval); 152 if (Status == STATUS_TIMEOUT) 153 { 154 #ifdef DEBUG_misha 155 /* debugging only */ 156 AssertFailed(); 157 #endif 158 if (!IoCancelIrp(pIrp)) 159 { 160 /* this may happen, but this is something the caller with timeout is not expecting */ 161 AssertFailed(); 162 } 163 164 /* wait for the IRP to complete */ 165 KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); 166 } 167 else 168 { 169 Assert(Status == STATUS_SUCCESS); 170 } 171 172 /* by this time the IRP is completed */ 173 Status = pIrp->IoStatus.Status; 174 } 175 return Status; 176 } 177 134 178 VBOXDRVTOOL_DECL(VOID) VBoxDrvToolRefWaitEqual(PVBOXDRVTOOL_REF pRef, uint32_t u32Val) 135 179 { -
trunk/src/VBox/HostDrivers/VBoxUSB/win/cmn/VBoxDrvTool.h
r36968 r37047 76 76 VBOXDRVTOOL_DECL(NTSTATUS) VBoxDrvToolIoPostAsync(PDEVICE_OBJECT pDevObj, PIRP pIrp, PKEVENT pEvent); 77 77 VBOXDRVTOOL_DECL(NTSTATUS) VBoxDrvToolIoPostSync(PDEVICE_OBJECT pDevObj, PIRP pIrp); 78 VBOXDRVTOOL_DECL(NTSTATUS) VBoxDrvToolIoPostSyncWithTimeout(PDEVICE_OBJECT pDevObj, PIRP pIrp, ULONG dwTimeoutMs); 78 79 DECLINLINE(NTSTATUS) VBoxDrvToolIoComplete(PIRP pIrp, NTSTATUS Status, ULONG ulInfo) 79 80 { -
trunk/src/VBox/HostDrivers/VBoxUSB/win/cmn/VBoxUsbTool.cpp
r36968 r37047 85 85 } 86 86 87 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolUrbPost(PDEVICE_OBJECT pDevObj, PURB pUrb) 88 { 89 return VBoxUsbToolIoInternalCtlSendSync(pDevObj, IOCTL_INTERNAL_USB_SUBMIT_URB, pUrb, NULL); 90 } 91 92 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetDescriptor(PDEVICE_OBJECT pDevObj, void *pvBuffer, int cbBuffer, int Type, int iIndex, int LangId) 87 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolUrbPost(PDEVICE_OBJECT pDevObj, PURB pUrb, ULONG dwTimeoutMs) 88 { 89 if (dwTimeoutMs == RT_INDEFINITE_WAIT) 90 return VBoxUsbToolIoInternalCtlSendSync(pDevObj, IOCTL_INTERNAL_USB_SUBMIT_URB, pUrb, NULL); 91 return VBoxUsbToolIoInternalCtlSendSyncWithTimeout(pDevObj, IOCTL_INTERNAL_USB_SUBMIT_URB, pUrb, NULL, dwTimeoutMs); 92 } 93 94 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetDescriptor(PDEVICE_OBJECT pDevObj, void *pvBuffer, int cbBuffer, int Type, int iIndex, int LangId, ULONG dwTimeoutMs) 93 95 { 94 96 NTSTATUS Status; … … 100 102 return STATUS_INSUFFICIENT_RESOURCES; 101 103 } 104 105 PUSB_COMMON_DESCRIPTOR pCmn = (PUSB_COMMON_DESCRIPTOR)pvBuffer; 106 pCmn->bLength = cbBuffer; 107 pCmn->bDescriptorType = Type; 102 108 103 109 pUrb->UrbHeader.Function = URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE; … … 109 115 pUrb->UrbControlDescriptorRequest.LanguageId = (USHORT)LangId; 110 116 111 Status = VBoxUsbToolUrbPost(pDevObj, pUrb );117 Status = VBoxUsbToolUrbPost(pDevObj, pUrb, dwTimeoutMs); 112 118 #ifdef DEBUG_misha 113 119 Assert(Status == STATUS_SUCCESS); … … 129 135 } 130 136 131 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetStringDescriptorA(PDEVICE_OBJECT pDevObj, char *pResult, ULONG cbResult, int iIndex, int LangId )137 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetStringDescriptorA(PDEVICE_OBJECT pDevObj, char *pResult, ULONG cbResult, int iIndex, int LangId, ULONG dwTimeoutMs) 132 138 { 133 139 char aBuf[MAXIMUM_USB_STRING_LENGTH]; … … 143 149 pDr->bDescriptorType = USB_STRING_DESCRIPTOR_TYPE; 144 150 145 NTSTATUS Status = VBoxUsbToolGetDescriptor(pDevObj, pDr, cbBuf, USB_STRING_DESCRIPTOR_TYPE, iIndex, LangId );151 NTSTATUS Status = VBoxUsbToolGetDescriptor(pDevObj, pDr, cbBuf, USB_STRING_DESCRIPTOR_TYPE, iIndex, LangId, dwTimeoutMs); 146 152 if (NT_SUCCESS(Status)) 147 153 { … … 175 181 } 176 182 177 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetLangID(PDEVICE_OBJECT pDevObj, int *pLangId )183 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetLangID(PDEVICE_OBJECT pDevObj, int *pLangId, ULONG dwTimeoutMs) 178 184 { 179 185 char aBuf[MAXIMUM_USB_STRING_LENGTH]; … … 189 195 pDr->bDescriptorType = USB_STRING_DESCRIPTOR_TYPE; 190 196 191 NTSTATUS Status = VBoxUsbToolGetDescriptor(pDevObj, pDr, cbBuf, USB_STRING_DESCRIPTOR_TYPE, 0, 0 );197 NTSTATUS Status = VBoxUsbToolGetDescriptor(pDevObj, pDr, cbBuf, USB_STRING_DESCRIPTOR_TYPE, 0, 0, dwTimeoutMs); 192 198 if (NT_SUCCESS(Status)) 193 199 { … … 260 266 pUrb->UrbPipeRequest.Reserved = 0; 261 267 262 NTSTATUS Status = VBoxUsbToolUrbPost(pDevObj, pUrb );268 NTSTATUS Status = VBoxUsbToolUrbPost(pDevObj, pUrb, RT_INDEFINITE_WAIT); 263 269 if (!NT_SUCCESS(Status) || !USBD_SUCCESS(pUrb->UrbHeader.Status)) 264 270 { … … 287 293 pSl->Parameters.Others.Argument2 = NULL; 288 294 289 NTSTATUS Status = VBoxUsbToolUrbPost(pDevObj, (PURB)&Urb );295 NTSTATUS Status = VBoxUsbToolUrbPost(pDevObj, (PURB)&Urb, RT_INDEFINITE_WAIT); 290 296 Assert(NT_SUCCESS(Status)); 291 297 if (NT_SUCCESS(Status)) … … 307 313 UsbBuildSelectConfigurationRequest(pUrb, (USHORT)cbUrb, NULL); 308 314 309 NTSTATUS Status = VBoxUsbToolUrbPost(pDevObj, pUrb );315 NTSTATUS Status = VBoxUsbToolUrbPost(pDevObj, pUrb, RT_INDEFINITE_WAIT); 310 316 Assert(NT_SUCCESS(Status)); 311 317 312 318 VBoxUsbToolUrbFree(pUrb); 319 320 return Status; 321 } 322 323 VBOXUSBTOOL_DECL(PIRP) VBoxUsbToolIoBuildAsyncInternalCtl(PDEVICE_OBJECT pDevObj, ULONG uCtl, void *pvArg1, void *pvArg2) 324 { 325 PIRP pIrp = IoAllocateIrp(pDevObj->StackSize, FALSE); 326 Assert(pIrp); 327 if (!pIrp) 328 { 329 return NULL; 330 } 331 332 pIrp->IoStatus.Status = STATUS_SUCCESS; 333 pIrp->IoStatus.Information = NULL; 334 335 PIO_STACK_LOCATION pSl = IoGetNextIrpStackLocation(pIrp); 336 pSl->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; 337 pSl->MinorFunction = 0; 338 pSl->Parameters.DeviceIoControl.IoControlCode = uCtl; 339 pSl->Parameters.Others.Argument1 = pvArg1; 340 pSl->Parameters.Others.Argument2 = pvArg2; 341 return pIrp; 342 } 343 344 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolIoInternalCtlSendSyncWithTimeout(PDEVICE_OBJECT pDevObj, ULONG uCtl, void *pvArg1, void *pvArg2, ULONG dwTimeoutMs) 345 { 346 /* since we're going to cancel the irp on timeout, we should allocate our own IRP rather than using the threaded one 347 * */ 348 PIRP pIrp = VBoxUsbToolIoBuildAsyncInternalCtl(pDevObj, uCtl, pvArg1, pvArg2); 349 if (!pIrp) 350 { 351 return STATUS_INSUFFICIENT_RESOURCES; 352 } 353 354 NTSTATUS Status = VBoxDrvToolIoPostSyncWithTimeout(pDevObj, pIrp, dwTimeoutMs); 355 356 IoFreeIrp(pIrp); 313 357 314 358 return Status; -
trunk/src/VBox/HostDrivers/VBoxUSB/win/cmn/VBoxUsbTool.h
r36968 r37047 47 47 VBOXUSBTOOL_DECL(PURB) VBoxUsbToolUrbReinit(PURB pUrb, USHORT cbSize, USHORT u16Function); 48 48 VBOXUSBTOOL_DECL(VOID) VBoxUsbToolUrbFree(PURB pUrb); 49 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolUrbPost(PDEVICE_OBJECT pDevObj, PURB pUrb );50 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetDescriptor(PDEVICE_OBJECT pDevObj, void *pvBuffer, int cbBuffer, int Type, int iIndex, int LangId );51 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetStringDescriptorA(PDEVICE_OBJECT pDevObj, char *pResult, ULONG cbResult, int iIndex, int LangId );52 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetLangID(PDEVICE_OBJECT pDevObj, int *pLangId );49 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolUrbPost(PDEVICE_OBJECT pDevObj, PURB pUrb, ULONG dwTimeoutMs); 50 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetDescriptor(PDEVICE_OBJECT pDevObj, void *pvBuffer, int cbBuffer, int Type, int iIndex, int LangId, ULONG dwTimeoutMs); 51 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetStringDescriptorA(PDEVICE_OBJECT pDevObj, char *pResult, ULONG cbResult, int iIndex, int LangId, ULONG dwTimeoutMs); 52 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetLangID(PDEVICE_OBJECT pDevObj, int *pLangId, ULONG dwTimeoutMs); 53 53 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetDeviceSpeed(PDEVICE_OBJECT pDevObj, BOOLEAN *pbIsHigh); 54 54 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolPipeClear(PDEVICE_OBJECT pDevObj, HANDLE hPipe, bool fReset); … … 57 57 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolIoInternalCtlSendAsync(PDEVICE_OBJECT pDevObj, ULONG uCtl, void *pvArg1, void *pvArg2, PKEVENT pEvent, PIO_STATUS_BLOCK pIoStatus); 58 58 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolIoInternalCtlSendSync(PDEVICE_OBJECT pDevObj, ULONG uCtl, void *pvArg1, void *pvArg2); 59 VBOXUSBTOOL_DECL(PIRP) VBoxUsbToolIoBuildAsyncInternalCtl(PDEVICE_OBJECT pDevObj, ULONG uCtl, void *pvArg1, void *pvArg2); 60 VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolIoInternalCtlSendSyncWithTimeout(PDEVICE_OBJECT pDevObj, ULONG uCtl, void *pvArg1, void *pvArg2, ULONG dwTimeoutMs); 59 61 VBOXUSBTOOL_DECL(VOID) VBoxUsbToolStringDescriptorToUnicodeString(PUSB_STRING_DESCRIPTOR pDr, PUNICODE_STRING pUnicode); 60 62 -
trunk/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbRt.cpp
r36968 r37047 301 301 { 302 302 memset(pDevExt->Rt.devdescr, 0, sizeof (USB_DEVICE_DESCRIPTOR)); 303 Status = VBoxUsbToolGetDescriptor(pDevExt->pLowerDO, pDevExt->Rt.devdescr, sizeof (USB_DEVICE_DESCRIPTOR), USB_DEVICE_DESCRIPTOR_TYPE, 0, 0 );303 Status = VBoxUsbToolGetDescriptor(pDevExt->pLowerDO, pDevExt->Rt.devdescr, sizeof (USB_DEVICE_DESCRIPTOR), USB_DEVICE_DESCRIPTOR_TYPE, 0, 0, RT_INDEFINITE_WAIT); 304 304 if (NT_SUCCESS(Status)) 305 305 { … … 312 312 for (; i < pDevExt->Rt.devdescr->bNumConfigurations; ++i) 313 313 { 314 Status = VBoxUsbToolGetDescriptor(pDevExt->pLowerDO, pDr, sizeof (USB_CONFIGURATION_DESCRIPTOR), USB_CONFIGURATION_DESCRIPTOR_TYPE, i, 0 );314 Status = VBoxUsbToolGetDescriptor(pDevExt->pLowerDO, pDr, sizeof (USB_CONFIGURATION_DESCRIPTOR), USB_CONFIGURATION_DESCRIPTOR_TYPE, i, 0, RT_INDEFINITE_WAIT); 315 315 if (!NT_SUCCESS(Status)) 316 316 { … … 326 326 } 327 327 328 Status = VBoxUsbToolGetDescriptor(pDevExt->pLowerDO, pDevExt->Rt.cfgdescr[i], uTotalLength, USB_CONFIGURATION_DESCRIPTOR_TYPE, i, 0 );328 Status = VBoxUsbToolGetDescriptor(pDevExt->pLowerDO, pDevExt->Rt.cfgdescr[i], uTotalLength, USB_CONFIGURATION_DESCRIPTOR_TYPE, i, 0, RT_INDEFINITE_WAIT); 329 329 if (!NT_SUCCESS(Status)) 330 330 { … … 428 428 if (pDr) 429 429 { 430 Status = VBoxUsbToolGetDescriptor(pDevExt->pLowerDO, pDr, sizeof(*pDr), USB_DEVICE_DESCRIPTOR_TYPE, 0, 0 );430 Status = VBoxUsbToolGetDescriptor(pDevExt->pLowerDO, pDr, sizeof(*pDr), USB_DEVICE_DESCRIPTOR_TYPE, 0, 0, RT_INDEFINITE_WAIT); 431 431 if (NT_SUCCESS(Status)) 432 432 { … … 443 443 { 444 444 int langId; 445 Status = VBoxUsbToolGetLangID(pDevExt->pLowerDO, &langId );445 Status = VBoxUsbToolGetLangID(pDevExt->pLowerDO, &langId, RT_INDEFINITE_WAIT); 446 446 if (NT_SUCCESS(Status)) 447 447 { 448 Status = VBoxUsbToolGetStringDescriptorA(pDevExt->pLowerDO, pDevExt->Rt.szSerial, sizeof (pDevExt->Rt.szSerial), pDr->iSerialNumber, langId );448 Status = VBoxUsbToolGetStringDescriptorA(pDevExt->pLowerDO, pDevExt->Rt.szSerial, sizeof (pDevExt->Rt.szSerial), pDr->iSerialNumber, langId, RT_INDEFINITE_WAIT); 449 449 } 450 450 else … … 572 572 pUrb->UrbSelectConfiguration.ConfigurationDescriptor = NULL; 573 573 574 Status = VBoxUsbToolUrbPost(pDevExt->pLowerDO, pUrb );574 Status = VBoxUsbToolUrbPost(pDevExt->pLowerDO, pUrb, RT_INDEFINITE_WAIT); 575 575 if(NT_SUCCESS(Status) && USBD_SUCCESS(pUrb->UrbHeader.Status)) 576 576 { … … 618 618 if (pUrb) 619 619 { 620 Status = VBoxUsbToolUrbPost(pDevExt->pLowerDO, pUrb );620 Status = VBoxUsbToolUrbPost(pDevExt->pLowerDO, pUrb, RT_INDEFINITE_WAIT); 621 621 if (NT_SUCCESS(Status) && USBD_SUCCESS(pUrb->UrbHeader.Status)) 622 622 { … … 815 815 pUrb->UrbSelectInterface.Interface.Length = GET_USBD_INTERFACE_SIZE(pIfDr->bNumEndpoints); 816 816 817 Status = VBoxUsbToolUrbPost(pDevExt->pLowerDO, pUrb );817 Status = VBoxUsbToolUrbPost(pDevExt->pLowerDO, pUrb, RT_INDEFINITE_WAIT); 818 818 if (NT_SUCCESS(Status) && USBD_SUCCESS(pUrb->UrbHeader.Status)) 819 819 { -
trunk/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbFlt.cpp
r37042 r37047 150 150 KeReleaseSpinLock(&g_VBoxUsbFltGlobals.Lock.Lock, g_VBoxUsbFltGlobals.Lock.OldIrql); 151 151 152 153 typedef struct VBOXUSBFLT_BLDEV 154 { 155 LIST_ENTRY ListEntry; 156 uint16_t idVendor; 157 uint16_t idProduct; 158 uint16_t bcdDevice; 159 } VBOXUSBFLT_BLDEV, *PVBOXUSBFLT_BLDEV; 160 161 #define PVBOXUSBFLT_BLDEV_FROM_LE(_pLe) ( (PVBOXUSBFLT_BLDEV)( ((uint8_t*)(_pLe)) - RT_OFFSETOF(VBOXUSBFLT_BLDEV, ListEntry) ) ) 162 152 163 typedef struct VBOXUSBFLTGLOBALS 153 164 { 154 165 LIST_ENTRY DeviceList; 155 166 LIST_ENTRY ContextList; 167 /* devices known to misbehave */ 168 LIST_ENTRY BlackDeviceList; 156 169 VBOXUSBFLT_LOCK Lock; 157 170 } VBOXUSBFLTGLOBALS, *PVBOXUSBFLTGLOBALS; 158 171 static VBOXUSBFLTGLOBALS g_VBoxUsbFltGlobals; 172 173 static bool vboxUsbFltBlDevMatchLocked(uint16_t idVendor, uint16_t idProduct, uint16_t bcdDevice) 174 { 175 for (PLIST_ENTRY pEntry = g_VBoxUsbFltGlobals.BlackDeviceList.Flink; 176 pEntry != &g_VBoxUsbFltGlobals.BlackDeviceList; 177 pEntry = pEntry->Flink) 178 { 179 PVBOXUSBFLT_BLDEV pDev = PVBOXUSBFLT_BLDEV_FROM_LE(pEntry); 180 if (pDev->idVendor != idVendor) 181 continue; 182 if (pDev->idProduct != idProduct) 183 continue; 184 if (pDev->bcdDevice != bcdDevice) 185 continue; 186 187 return true; 188 } 189 return false; 190 } 191 192 static NTSTATUS vboxUsbFltBlDevAddLocked(uint16_t idVendor, uint16_t idProduct, uint16_t bcdDevice) 193 { 194 if (vboxUsbFltBlDevMatchLocked(idVendor, idProduct, bcdDevice)) 195 return STATUS_SUCCESS; 196 PVBOXUSBFLT_BLDEV pDev = (PVBOXUSBFLT_BLDEV)VBoxUsbMonMemAllocZ(sizeof (*pDev)); 197 if (!pDev) 198 { 199 AssertFailed(); 200 return STATUS_INSUFFICIENT_RESOURCES; 201 } 202 203 pDev->idVendor = idVendor; 204 pDev->idProduct = idProduct; 205 pDev->bcdDevice = bcdDevice; 206 InsertHeadList(&g_VBoxUsbFltGlobals.BlackDeviceList, &pDev->ListEntry); 207 return STATUS_SUCCESS; 208 } 209 210 static void vboxUsbFltBlDevClearLocked() 211 { 212 PLIST_ENTRY pNext; 213 for (PLIST_ENTRY pEntry = g_VBoxUsbFltGlobals.BlackDeviceList.Flink; 214 pEntry != &g_VBoxUsbFltGlobals.BlackDeviceList; 215 pEntry = pNext) 216 { 217 pNext = pEntry->Flink; 218 VBoxUsbMonMemFree(pEntry); 219 } 220 } 221 222 static void vboxUsbFltBlDevPopulateWithKnownLocked() 223 { 224 /* this one halts when trying to get string descriptors from it */ 225 vboxUsbFltBlDevAddLocked(0x5ac, 0x921c, 0x115); 226 } 227 159 228 160 229 DECLINLINE(void) vboxUsbFltDevRetain(PVBOXUSBFLT_DEVICE pDevice) … … 217 286 static PVBOXUSBFLT_DEVICE vboxUsbFltDevGetLocked(PDEVICE_OBJECT pPdo) 218 287 { 219 #ifdef DEBUG_mis ta288 #ifdef DEBUG_misha 220 289 for (PLIST_ENTRY pEntry = g_VBoxUsbFltGlobals.DeviceList.Flink; 221 290 pEntry != &g_VBoxUsbFltGlobals.DeviceList; … … 315 384 } 316 385 386 #define VBOXUSBMON_POPULATE_REQUEST_TIMEOUT_MS 10000 387 317 388 static NTSTATUS vboxUsbFltDevPopulate(PVBOXUSBFLT_DEVICE pDevice, PDEVICE_OBJECT pDo /*, BOOLEAN bPopulateNonFilterProps*/) 318 389 { … … 331 402 do 332 403 { 333 Status = VBoxUsbToolGetDescriptor(pDo, pDevDr, sizeof(*pDevDr), USB_DEVICE_DESCRIPTOR_TYPE, 0, 0 );404 Status = VBoxUsbToolGetDescriptor(pDo, pDevDr, sizeof(*pDevDr), USB_DEVICE_DESCRIPTOR_TYPE, 0, 0, VBOXUSBMON_POPULATE_REQUEST_TIMEOUT_MS); 334 405 if (!NT_SUCCESS(Status)) 335 406 { 336 LogRel(("VBoxUSBGetDeviceDescription: getting device descriptor failed\n")); 407 LogRel((__FUNCTION__": getting device descriptor failed\n")); 408 break; 409 } 410 411 if (vboxUsbFltBlDevMatchLocked(pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice)) 412 { 413 LogRel((__FUNCTION__": found a known black list device, vid(0x%x), pid(0x%x), rev(0x%x)\n", pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice)); 414 #ifdef DEBUG_misha 415 AssertFailed(); 416 #endif 417 Status = STATUS_UNSUCCESSFUL; 337 418 break; 338 419 } … … 354 435 int langId; 355 436 356 Status = VBoxUsbToolGetLangID(pDo, &langId );437 Status = VBoxUsbToolGetLangID(pDo, &langId, VBOXUSBMON_POPULATE_REQUEST_TIMEOUT_MS); 357 438 if (!NT_SUCCESS(Status)) 358 439 { 359 440 AssertMsgFailed((__FUNCTION__": reading language ID failed\n")); 441 if (Status == STATUS_CANCELLED) 442 { 443 AssertMsgFailed((__FUNCTION__": found a new black list device, vid(0x%x), pid(0x%x), rev(0x%x)\n", pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice)); 444 vboxUsbFltBlDevAddLocked(pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice); 445 Status = STATUS_UNSUCCESSFUL; 446 } 360 447 break; 361 448 } … … 363 450 if (pDevDr->iSerialNumber) 364 451 { 365 Status = VBoxUsbToolGetStringDescriptorA(pDo, pDevice->szSerial, sizeof (pDevice->szSerial), pDevDr->iSerialNumber, langId );452 Status = VBoxUsbToolGetStringDescriptorA(pDo, pDevice->szSerial, sizeof (pDevice->szSerial), pDevDr->iSerialNumber, langId, VBOXUSBMON_POPULATE_REQUEST_TIMEOUT_MS); 366 453 if (!NT_SUCCESS(Status)) 367 454 { 368 455 AssertMsgFailed((__FUNCTION__": reading serial number failed\n")); 456 if (Status == STATUS_CANCELLED) 457 { 458 AssertMsgFailed((__FUNCTION__": found a new black list device, vid(0x%x), pid(0x%x), rev(0x%x)\n", pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice)); 459 vboxUsbFltBlDevAddLocked(pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice); 460 Status = STATUS_UNSUCCESSFUL; 461 } 369 462 break; 370 463 } … … 373 466 if (pDevDr->iManufacturer) 374 467 { 375 Status = VBoxUsbToolGetStringDescriptorA(pDo, pDevice->szMfgName, sizeof (pDevice->szMfgName), pDevDr->iManufacturer, langId );468 Status = VBoxUsbToolGetStringDescriptorA(pDo, pDevice->szMfgName, sizeof (pDevice->szMfgName), pDevDr->iManufacturer, langId, VBOXUSBMON_POPULATE_REQUEST_TIMEOUT_MS); 376 469 if (!NT_SUCCESS(Status)) 377 470 { 378 471 AssertMsgFailed((__FUNCTION__": reading manufacturer name failed\n")); 472 if (Status == STATUS_CANCELLED) 473 { 474 AssertMsgFailed((__FUNCTION__": found a new black list device, vid(0x%x), pid(0x%x), rev(0x%x)\n", pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice)); 475 vboxUsbFltBlDevAddLocked(pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice); 476 Status = STATUS_UNSUCCESSFUL; 477 } 379 478 break; 380 479 } … … 383 482 if (pDevDr->iProduct) 384 483 { 385 Status = VBoxUsbToolGetStringDescriptorA(pDo, pDevice->szProduct, sizeof (pDevice->szProduct), pDevDr->iProduct, langId );484 Status = VBoxUsbToolGetStringDescriptorA(pDo, pDevice->szProduct, sizeof (pDevice->szProduct), pDevDr->iProduct, langId, VBOXUSBMON_POPULATE_REQUEST_TIMEOUT_MS); 386 485 if (!NT_SUCCESS(Status)) 387 486 { 388 487 AssertMsgFailed((__FUNCTION__": reading product name failed\n")); 488 if (Status == STATUS_CANCELLED) 489 { 490 AssertMsgFailed((__FUNCTION__": found a new black list device, vid(0x%x), pid(0x%x), rev(0x%x)\n", pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice)); 491 vboxUsbFltBlDevAddLocked(pDevDr->idVendor, pDevDr->idProduct, pDevDr->bcdDevice); 492 Status = STATUS_UNSUCCESSFUL; 493 } 389 494 break; 390 495 } … … 1218 1323 InitializeListHead(&g_VBoxUsbFltGlobals.DeviceList); 1219 1324 InitializeListHead(&g_VBoxUsbFltGlobals.ContextList); 1325 InitializeListHead(&g_VBoxUsbFltGlobals.BlackDeviceList); 1326 vboxUsbFltBlDevPopulateWithKnownLocked(); 1220 1327 VBOXUSBFLT_LOCK_INIT(); 1221 1328 return STATUS_SUCCESS; … … 1269 1376 vboxUsbFltDevRelease(pDevice); 1270 1377 } 1378 1379 vboxUsbFltBlDevClearLocked(); 1380 1271 1381 VBOXUSBFLT_LOCK_TERM(); 1272 1382
Note:
See TracChangeset
for help on using the changeset viewer.