Filter driver problem

Hello guys,
Hello Eliyas Yakub, if you hear me :wink:

I used Eliyas Yakub’s sample JoyFlt for writing my own mouse filter driver.
Everything works just fine under NT4 and W2k. But under XP I have a
problem - in some moment BSOD appears.

In general this filter driver uses such an idea:
when mouse IRP comes down driver pends that IRP and sends its own (subst
one) IRP to mouse stack. In completion routine driver copies data from
subst Irp to the original one, completes original Irp and returns
STATUS_MORE_PROCESSING_REQUIRED. This logic is necessary because I need the
possibility to stroke mouse data manually.

Look at it:

NTSTATUS MeMiceDispatchRead(
PDEVICE_OBJECT DeviceObject,
PIRP pOrigIrp)
{
/*
: :
*/

IoSetCancelRoutine(pOrigIrp,MeOrigIrpCancelRoutine);
IoMarkIrpPending(pOrigIrp);

return IoCallDriver(pLowerDeviceObject,pSubstIrp);
}

NTSTATUS MeMiceReadComplete(
PDEVICE_OBJECT pDevice,
PIRP pSubstIrp,
PVOID Context)
{
/*
copy data to original IRP
: :
*/

pOrigIrp->IoStatus.Status=pIrp->IoStatus.Status;
pOrigIrp->IoStatus.Information=pIrp->IoStatus.Information;
IoCompleteRequest(pOrigIrp, IO_MOUSE_INCREMENT);

STATUS_MORE_PROCESSING_REQUIRED;
}

After experiments I saw that (I think so) the problem is that Irp completion
in MeMiceReadComplete() happenes earlier than return from
MeMiceDispatchRead(). So I have such an impression that I have to
synchronize somehow MeMiceDispatchRead() and MeMiceReadComplete(). Could it
be so, guys? Why did this logic work under NT4/W2k but under XP it failed?
BSOD happens in ntoskrnl’s KeInsertQueueAps(), error Page fault (0xE)

Thanks.

Bye,
SaB


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com