阅读:1188回复:3
IoSetCompletionRoutine的问题,20分!
小弟想做一个包过滤程序,
过滤函数如下: NTSTATUS Pass( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp ) { DbgPrint(\"get Package!!!\\n\"); PIO_STACK_LOCATION pIrpStack; pIrpStack = IoGetCurrentIrpStackLocation( Irp ); IoCopyCurrentIrpStackLocationToNext(Irp); IoSetCompletionRoutine( Irp, GenericCompletion, 0, TRUE, TRUE, TRUE ); return IoCallDriver( m_TcpgetDevice, Irp); } NTSTATUS GenericCompletion( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context ) { if(Irp->PendingReturned) { IoMarkIrpPending(Irp); } return STATUS_SUCCESS; } 但是发现一个问题,第一次调用IoSetCompletionRoutine没有问题, 当接到第二个irp时,再调用IoSetCompletionRoutine,就会蓝屏, 希望有经验的大虾多指教! 谢谢! |
|
沙发#
发布于:2002-05-23 20:43
请检查是否
Irp->CurrentLocation > 1 估计你在IoCopyCurrentIrpStackLocationToNext(Irp); 时你的Irp->CurrentLocation = 1了。 |
|
|
板凳#
发布于:2002-05-23 20:58
首先谢谢你的回复,
但是我已经添加了以下代码,还是不管用。 if (Irp->CurrentLocation == 1) { return STATUS_INVALID_DEVICE_REQUEST; } |
|
地板#
发布于:2002-05-24 10:57
再试试看
NTSTATUS GenericCompletion( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context ) { if(Irp->PendingReturned) { IoMarkIrpPending(Irp); } return STATUS_MORE_PROCESSING_REQUIRED; } |
|
|