阅读:1469回复:1
ps2鼠标过滤驱动中,IoCallDriver总返回STATUS_PENDING是怎么回事?IoSetCompletionRoutine(NewIrp,MouFilter_WriteBufferCompletion_TimeOut,&TimeoutEvent, TRUE, TRUE,TRUE); Status = IoCallDriver(devExt->TopOfStack, NewIrp); if (Status == STATUS_PENDING) { timeout.LowPart = (ULONG)(-1 * 1000 * 1000); timeout.HighPart = -1; Status = KeWaitForSingleObject(&TimeoutEvent, Executive, KernelMode, FALSE, &timeout); if (Status == STATUS_TIMEOUT) { KdPrint(("发送命令超时...\n")); Status = STATUS_IO_TIMEOUT; // Cancel the Irp we just sent. KdPrint(("取消刚才超时的命令IRP...\n等待命令取消...\n")); IoCancelIrp(NewIrp); // And wait until the cancel completes Status = KeWaitForSingleObject(&TimeoutEvent,Executive, KernelMode, FALSE,NULL); if(Status == STATUS_TIMEOUT) { KdPrint(("等待取消命令延时...\n")); } } MouFilter_WriteBufferCompletion_TimeOut() { KeSetEvent(kevent, IO_NO_INCREMENT,FALSE); } 代码如上,正常情况下,win32进程发消息给ps2鼠标,执行这里是OK的,命令都可以发送成功,但是在鼠标进行快速移动或者点击的时候,总是发送超时,导致鼠标会僵死一会儿,然后才有反应,请各位指导下,这是怎么回事? |
|
沙发#
发布于:2012-11-12 18:47
IoCallDriver调用设备栈TopOfStack,会没有重入吗
|
|