usb驱动问题,大家看看为什么在KeWaitForSingleObject处死等不回!!!!
我在一个IRP的取消例程中,给USB设备发送通知。 出现了上述问题。
VOID IrpCancelRoutine(IN PDEVICE_OBJECT fdo, IN PIRP Irp){ PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION)fdo->DeviceExtension; IoAcquireRemoveLock(&pdx->RemoveLock, Irp); // Release the global cancel spin lock. // Do this while not holding any other spin locks so that we exit at the right IRQL. IoReleaseCancelSpinLock(Irp->CancelIrql); if( Irp == pdx->pBufIrp) { KeInitializeEvent(&event, NotificationEvent, FALSE); //pdx->LowerDeviceObject, 已经初始化完成 irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_SUBMIT_URB, pdx->LowerDeviceObject, NULL, 0, NULL, 0, TRUE, &event, &ioStatus); ntStatus = IoCallDriver(pdx->LowerDeviceObject, irp); if(ntStatus == STATUS_PENDING) { //在此处死等,在其他线程上先文中不存在这个问题,取消历程中,存在此问题。为啥 status = KeWaitForSingleObject(pdx->phExitEvent,Executive,ernelMode,FALSE,NULL); } //...其他处理 } //取消IRP}