1> I want to know that IRP_MJ_CLEANUP is Asynchronous (i.e do we have to
write some code to wait for the request to complete)
2> If we have to write some code then what is the code and where do we write
it. We presently write some waiting code in the Dispatch routine after
IOCallDriver.
The code for waiting follows
if (result == STATUS_PENDING)
{
NTSTATUS localStatus;
rec-\>flag = 4;
localStatus = KeWaitForSingleObject(rec-\>waitEvent, Executive, KernelMode,
FALSE, NULL);
ASSERT(NT_SUCCESS(localStatus));
}
We then wakeup this wait by calling the following code in the completion
routine
if (NULL != waitEvent) {
if (rec-\>flag == 4) {
KeSetEvent(waitEvent, IO_NO_INCREMENT, FALSE);
}
}
NOTE:- rec->flag is passed in the context field of the completion routine
3> I had tried to use IoIsOperationSynchronous(Irp) function. but the
function causes the System to crash (with some error msg indicating Illegal
Access or something like that)
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
Some notes:
- IoIsOperationSynchronous() needs a valid file object pointer
to be present in the current stack location. This is probably
not your case.
- IRP_MJ_CLEANUP is inherently synchronous, which means
that the IoManager always waits for the completion of this
request.
- Your code with dependence on some flag is not correct.
Consider a case when the underlying driver returns pending,
but the completion routine is executed before your code
if (…) {rec->flag=4;…}. Then you will wait forever!
Paul
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Vikhram Shetty
Sent: Wednesday, August 28, 2002 7:02 AM
To: File Systems Developers
Subject: [ntfsd] Require Help on IRP_MJ_CLEANUP
1> I want to know that IRP_MJ_CLEANUP is Asynchronous (i.e do we have to
write some code to wait for the request to complete)
2> If we have to write some code then what is the code and where do we
2> write
it. We presently write some waiting code in the Dispatch routine after
IOCallDriver.
The code for waiting follows
if (result == STATUS_PENDING)
{
NTSTATUS localStatus;
rec-\>flag = 4;
localStatus = KeWaitForSingleObject(rec-\>waitEvent, Executive,
KernelMode,
FALSE, NULL);
ASSERT(NT_SUCCESS(localStatus));
}
We then wakeup this wait by calling the following code in the completion
routine
if (NULL != waitEvent) {
if (rec-\>flag == 4) {
KeSetEvent(waitEvent, IO_NO_INCREMENT, FALSE);
}
}
NOTE:- rec-\>flag is passed in the context field of the completion
routine
3\> I had tried to use IoIsOperationSynchronous(Irp) function. but the
function causes the System to crash (with some error msg indicating
Illegal
Access or something like that)
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
---
You are currently subscribed to ntfsd as: xxxxx@compelson.com
To unsubscribe send a blank email to %%email.unsub%%