cancelling an open from within IRP_MJ_CREATE

Assuming a successful call has already been made to the lower level FSD
from within a filter driver, I understand it is possible to “cancel” that
previous open by sending an IRP_MJ_CLEANUP and IRP_MJ_CLOSE back down to
the FSD. This must also be done synchronously. Unfortunately, the
IoBuildSynchronousFsdRequest API allows the creation of a number of
different IRP types but _CLEANUP and _CLOSE are not among them.

Can anyone post a viable snippet of code to show this newbie how that
should otherwise be done?

Thanks…

IoCancelFileOpen in the DDK. This API is supported under 2k and XP. If
you need NT4 support, you’ll need to send down the cleanup and close
yourself as you suggested. Check the NTFSD archives, there are a lot of
helpful messages on this topic.

  • Nicholas Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bill
Sent: Tuesday, December 10, 2002 10:49 AM
To: File Systems Developers
Subject: [ntfsd] cancelling an open from within IRP_MJ_CREATE

Assuming a successful call has already been made to the lower
level FSD from within a filter driver, I understand it is
possible to “cancel” that previous open by sending an
IRP_MJ_CLEANUP and IRP_MJ_CLOSE back down to the FSD. This
must also be done synchronously. Unfortunately, the
IoBuildSynchronousFsdRequest API allows the creation of a
number of different IRP types but _CLEANUP and _CLOSE are not
among them.

Can anyone post a viable snippet of code to show this newbie
how that should otherwise be done?

Thanks…


You are currently subscribed to ntfsd as: xxxxx@nryan.com
To unsubscribe send a blank email to %%email.unsub%%

Another Doh! moment for me, I’m afraid. I read of this API in the OSR FAQ
and zipped right over the 2000 applicability. I was laboring under the
impression that it was XP only. Many thanks. Better get my glasses
prescription checked…

IoCancelFileOpen in the DDK. This API is supported under 2k and XP. If
you need NT4 support, you’ll need to send down the cleanup and close
yourself as you suggested. Check the NTFSD archives, there are a lot of
helpful messages on this topic.

  • Nicholas Ryan

> the FSD. This must also be done synchronously. Unfortunately, the

IoBuildSynchronousFsdRequest API allows the creation of a number of
different IRP types but _CLEANUP and _CLOSE are not among them.

Use IoCancelFileOpen to send these IRPs.

Max

In addition to the "new " IoCancelFileOpen API, you could use the CREATE IRP
you already have (presumably in your driver’s completion routine.) Just
fill in the next I/O stack location with CLEANUP, call IoCallDriver, wait
for completion of THAT I/O, then do the same for the CLOSE function.
Finally, complete the original IRP with whatever error status you’d like.

Carl Appellof

“Bill” wrote in message news:xxxxx@ntfsd…
>
> Assuming a successful call has already been made to the lower level FSD
> from within a filter driver, I understand it is possible to “cancel” that
> previous open by sending an IRP_MJ_CLEANUP and IRP_MJ_CLOSE back down to
> the FSD. This must also be done synchronously. Unfortunately, the
> IoBuildSynchronousFsdRequest API allows the creation of a number of
> different IRP types but _CLEANUP and _CLOSE are not among them.
>
> Can anyone post a viable snippet of code to show this newbie how that
> should otherwise be done?
>
> Thanks…
>
>

No. IoCancelFileOpen also manipulates the VPB’s reference count.

Max

----- Original Message -----
From: “Carl Appellof”
Newsgroups: ntfsd
To: “File Systems Developers”
Sent: Thursday, December 12, 2002 4:14 AM
Subject: [ntfsd] Re: cancelling an open from within IRP_MJ_CREATE

> In addition to the "new " IoCancelFileOpen API, you could use the
CREATE IRP
> you already have (presumably in your driver’s completion routine.)
Just
> fill in the next I/O stack location with CLEANUP, call IoCallDriver,
wait
> for completion of THAT I/O, then do the same for the CLOSE function.
> Finally, complete the original IRP with whatever error status you’d
like.
>
> Carl Appellof
>
> “Bill” wrote in message news:xxxxx@ntfsd…
> >
> > Assuming a successful call has already been made to the lower
level FSD
> > from within a filter driver, I understand it is possible to
“cancel” that
> > previous open by sending an IRP_MJ_CLEANUP and IRP_MJ_CLOSE back
down to
> > the FSD. This must also be done synchronously. Unfortunately,
the
> > IoBuildSynchronousFsdRequest API allows the creation of a number
of
> > different IRP types but _CLEANUP and _CLOSE are not among them.
> >
> > Can anyone post a viable snippet of code to show this newbie how
that
> > should otherwise be done?
> >
> > Thanks…
> >
> >
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to %%email.unsub%%
>