Create Sample Code

Does anyone have some sample code on how to grow a IRP during a
IRP_MJ_CREATE call. I need to open the file and do a query before the file
is actually opened.

Thanks,
Ken


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

Simply send the request down and let the open occur. If you decide that
you do not want the open to succeed, call IoCancleFileOpen() to close it
and return.

No need to open it twice when one instance will do.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ken Galipeau
Sent: Tuesday, December 11, 2001 9:30 AM
To: File Systems Developers
Subject: [ntfsd] Create Sample Code

Does anyone have some sample code on how to grow a IRP during a
IRP_MJ_CREATE call. I need to open the file and do a query before the
file is actually opened.

Thanks,
Ken


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


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

Open the file using the original IRP, then do a query, then - if it fails - call IoCancelFileOpen and fail the original IRP.

Max

----- Original Message -----
From: Ken Galipeau
To: File Systems Developers
Sent: Tuesday, December 11, 2001 8:30 PM
Subject: [ntfsd] Create Sample Code

Does anyone have some sample code on how to grow a IRP during a IRP_MJ_CREATE call. I need to open the file and do a query before the file is actually opened.

Thanks,
Ken


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


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

MessageI wish it was that simple, the problem is I want to modify the call
parameters depending what I query. Once the open has occurred it is too late
to modify or undo the modify.

Ken
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Tuesday, December 11, 2001 1:04 PM
To: File Systems Developers
Subject: [ntfsd] RE: Create Sample Code

Simply send the request down and let the open occur. If you decide that
you do not want the open to succeed, call IoCancleFileOpen() to close it and
return.

No need to open it twice when one instance will do.

Jamey
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ken Galipeau
Sent: Tuesday, December 11, 2001 9:30 AM
To: File Systems Developers
Subject: [ntfsd] Create Sample Code

Does anyone have some sample code on how to grow a IRP during a
IRP_MJ_CREATE call. I need to open the file and do a query before the file
is actually opened.

Thanks,
Ken


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

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


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

No. Simply call IoCancelFileOpen() and then resend the modified request.

It is that simple.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ken Galipeau
Sent: Tuesday, December 11, 2001 12:54 PM
To: File Systems Developers
Subject: [ntfsd] RE: Create Sample Code

I wish it was that simple, the problem is I want to modify the call
parameters depending what I query. Once the open has occurred it is too
late to modify or undo the modify.

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Tuesday, December 11, 2001 1:04 PM
To: File Systems Developers
Subject: [ntfsd] RE: Create Sample Code

Simply send the request down and let the open occur. If you decide that
you do not want the open to succeed, call IoCancleFileOpen() to close it
and return.

No need to open it twice when one instance will do.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ken Galipeau
Sent: Tuesday, December 11, 2001 9:30 AM
To: File Systems Developers
Subject: [ntfsd] Create Sample Code

Does anyone have some sample code on how to grow a IRP during a
IRP_MJ_CREATE call. I need to open the file and do a query before the
file is actually opened.

Thanks,
Ken


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


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


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


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

MessageWhat happens to the FileObject that has been closed. Won’t parameters
have been changed, or might the name have been munged? I also remember that
the FileObject could get deleted.

Also there is no IoCancelFileOpen in NT4.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Tuesday, December 11, 2001 4:49 PM
To: File Systems Developers
Subject: [ntfsd] RE: Create Sample Code

No. Simply call IoCancelFileOpen() and then resend the modified request.

It is that simple.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ken Galipeau
Sent: Tuesday, December 11, 2001 12:54 PM
To: File Systems Developers
Subject: [ntfsd] RE: Create Sample Code

I wish it was that simple, the problem is I want to modify the call
parameters depending what I query. Once the open has occurred it is too late
to modify or undo the modify.

Ken
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Tuesday, December 11, 2001 1:04 PM
To: File Systems Developers
Subject: [ntfsd] RE: Create Sample Code

Simply send the request down and let the open occur. If you decide
that you do not want the open to succeed, call IoCancleFileOpen() to close
it and return.

No need to open it twice when one instance will do.

Jamey
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ken Galipeau
Sent: Tuesday, December 11, 2001 9:30 AM
To: File Systems Developers
Subject: [ntfsd] Create Sample Code

Does anyone have some sample code on how to grow a IRP during a
IRP_MJ_CREATE call. I need to open the file and do a query before the file
is actually opened.

Thanks,
Ken


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

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

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

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


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

MessageIt is trivial to rev.eng. IoCancelFileOpen from w2k and port it to NT4.
It just sends CLEANUP and CLOSE IRPs.

Max

----- Original Message -----
From: Ken Galipeau
To: File Systems Developers
Sent: Wednesday, December 12, 2001 2:04 AM
Subject: [ntfsd] RE: Create Sample Code

What happens to the FileObject that has been closed. Won’t parameters have been changed, or might the name have been munged? I also remember that the FileObject could get deleted.

Also there is no IoCancelFileOpen in NT4.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Tuesday, December 11, 2001 4:49 PM
To: File Systems Developers
Subject: [ntfsd] RE: Create Sample Code

No. Simply call IoCancelFileOpen() and then resend the modified request.

It is that simple.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Ken Galipeau
Sent: Tuesday, December 11, 2001 12:54 PM
To: File Systems Developers
Subject: [ntfsd] RE: Create Sample Code

I wish it was that simple, the problem is I want to modify the call parameters depending what I query. Once the open has occurred it is too late to modify or undo the modify.

Ken
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Tuesday, December 11, 2001 1:04 PM
To: File Systems Developers
Subject: [ntfsd] RE: Create Sample Code

Simply send the request down and let the open occur. If you decide that you do not want the open to succeed, call IoCancleFileOpen() to close it and return.

No need to open it twice when one instance will do.

Jamey
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Ken Galipeau
Sent: Tuesday, December 11, 2001 9:30 AM
To: File Systems Developers
Subject: [ntfsd] Create Sample Code

Does anyone have some sample code on how to grow a IRP during a IRP_MJ_CREATE call. I need to open the file and do a query before the file is actually opened.

Thanks,
Ken


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

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

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

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

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


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

But see what is in MSDN about IoCancelFileOpen:

***
The following routines are for system use. Do not use them in your driver.

IoCancelFileOpen
IoUpdateDiskGeometry


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

So what?

The routine is exported and described. It is known what does it do, detaily known.
Why not use it?

Max

----- Original Message -----
From:
To: “File Systems Developers”
Sent: Wednesday, December 12, 2001 5:14 AM
Subject: [ntfsd] Re: Create Sample Code

> But see what is in MSDN about IoCancelFileOpen:
>
> ***
> The following routines are for system use. Do not use them in your driver.
>
> IoCancelFileOpen
> IoUpdateDiskGeometry
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


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

You’re right Max, of course.

And I can append this for anonym using “xxxxx@aivan7.net”:

The sentence from MSDN is probably for device drivers,
but not for FSFD. There is a description for it in IFS Kit
and there is no a single phrase like “don’t use this routine”.

So if you aren’t developing FSFD forget this routine
because IT’S REALLY NOT FOR YOU.
As you probably noticed, this list is mainly for FS developers.
If you aren’t interested in FS land, use NTDEV list instead.

Paul

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Maxim S. Shatskih
Sent: Wednesday, December 12, 2001 11:36 AM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

So what?

The routine is exported and described. It is known what does it do, detaily
known.
Why not use it?

Max

----- Original Message -----
From:
To: “File Systems Developers”
Sent: Wednesday, December 12, 2001 5:14 AM
Subject: [ntfsd] Re: Create Sample Code

> But see what is in MSDN about IoCancelFileOpen:
>
> ***
> The following routines are for system use. Do not use them in your driver.
>
> IoCancelFileOpen
> IoUpdateDiskGeometry
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


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


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

Yes, you can use this contrary to the warning. In fact, you should use
it should you need to abort the open rather than try to do it by hand.
(Of course, I’m referring to Win2K. On NT4, you have to roll your own
IoCancelFileOpen.)

-----Original Message-----
From: xxxxx@aivan7.net [mailto:xxxxx@aivan7.net]
Sent: Wednesday, December 12, 2001 12:15 AM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

But see what is in MSDN about IoCancelFileOpen:

***
The following routines are for system use. Do not use them in your
driver.

IoCancelFileOpen
IoUpdateDiskGeometry


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


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

We actually coded our own version of this function by sending cleanup
and close IPRs.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@aivan7.net
Sent: Wednesday, December 12, 2001 5:15 AM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

But see what is in MSDN about IoCancelFileOpen:

***
The following routines are for system use. Do not use them in your
driver.

IoCancelFileOpen
IoUpdateDiskGeometry


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


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

RE: [ntfsd] Re: Create Sample Code>If you aren’t interested in FS land, use NTDEV list instead.

I use both :slight_smile:

Max


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

Message"Maxim S. Shatskih" wrote in message
news:xxxxx@ntfsd…
>It is trivial to rev.eng. IoCancelFileOpen from w2k and port it to NT4.
>It just sends CLEANUP and CLOSE IRPs.
>

Gee, I remember writing equivalent code for NT V4, and I seem to remember
there were some tricks to it. And while sending a CLEANUP and CLOSE is what
you need to do, how those are sent so that they work all the time wasn’t
exactly “trivial”. At least not to me.

Then again, at OSR it’s Tony who know about file systems…

Peter
OSR


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

Here is how we did it:

VOID SciCancelFileOpen(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT
FileObject)
{
PIRP irp;
PIO_STACK_LOCATION irpSp;
KEVENT event;
KIRQL irql;
IO_STATUS_BLOCK ioStatus;
PVPB vpb;
ASSERT(!(FileObject->Flags & FO_HANDLE_CREATED));
KeInitializeEvent(&event, NotificationEvent, FALSE);
KeClearEvent(&FileObject->Event);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->RequestorMode = KernelMode;
irp->UserEvent = &event;
irp->UserIosb = &irp->IoStatus;
irp->Overlay.AsynchronousParameters.UserApcRoutine =
(PIO_APC_ROUTINE)NULL;
irp->Flags = IRP_SYNCHRONOUS_API | IRP_CLOSE_OPERATION;
irpSp = IoGetNextIrpStackLocation(irp);
irpSp->MajorFunction = IRP_MJ_CLEANUP;
irpSp->FileObject = FileObject;
if (IoCallDriver(DeviceObject, irp) == STATUS_PENDING)
KeWaitForSingleObject(&event, UserRequest, KernelMode, FALSE,
NULL);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
KeClearEvent(&FileObject->Event);
KeClearEvent(&event);
irpSp = IoGetNextIrpStackLocation(irp);
irpSp->MajorFunction = IRP_MJ_CLOSE;
irpSp->FileObject = FileObject;
irp->UserIosb = &ioStatus;
irp->UserEvent = &event;
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->AssociatedIrp.SystemBuffer = NULL;
irp->Flags = IRP_CLOSE_OPERATION | IRP_SYNCHRONOUS_API;
vpb = FileObject->Vpb;
// Make sure the VPBs reference count ius adjusted properly;
if (vpb && !(FileObject->Flags & FO_DIRECT_DEVICE_OPEN))
{
IoAcquireVpbSpinLock(&irql);
vpb->ReferenceCount += 0xffffffff;
IoReleaseVpbSpinLock(irql);
}
if (IoCallDriver(DeviceObject, irp) == STATUS_PENDING)
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE,
NULL);
}

The only difference in this code and the code we saw in the debugger is
that the w2k version of IoCancelFileOpen() inserts each IRP into the
threads IRP queue. Since we do not have access to IopQueueThreadIrp()
and IopDequeueThreadIrp(), I think those are the names, I wouldhave to
load the checked build to verify, we simply left them out. Not sure if
there are any specific problems with this code that we have yet to find,
but it has been working for quite some time in numerous drivers.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Viscarola
Sent: Thursday, December 13, 2001 3:00 PM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Message"Maxim S. Shatskih" wrote in message
news:xxxxx@ntfsd…
>It is trivial to rev.eng. IoCancelFileOpen from w2k and port it to NT4.

>It just sends CLEANUP and CLOSE IRPs.
>

Gee, I remember writing equivalent code for NT V4, and I seem to
remember there were some tricks to it. And while sending a CLEANUP and
CLOSE is what you need to do, how those are sent so that they work all
the time wasn’t exactly “trivial”. At least not to me.

Then again, at OSR it’s Tony who know about file systems…

Peter
OSR


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


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

Of course, the one BIG problem with the code below is that you are not
checking for failure from IoAllocateIrp(), so the filter
will blow up under low resources conditions…
There’s one more issue which I’ll touch upon later.

Ravi

This posting is provided “AS IS” with no warranties, and confers no
rights. You assume all risk for your use.

-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Thursday, December 13, 2001 2:02 AM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Here is how we did it:

VOID SciCancelFileOpen(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT
FileObject)
{
PIRP irp;
PIO_STACK_LOCATION irpSp;
KEVENT event;
KIRQL irql;
IO_STATUS_BLOCK ioStatus;
PVPB vpb;
ASSERT(!(FileObject->Flags & FO_HANDLE_CREATED));
KeInitializeEvent(&event, NotificationEvent, FALSE);
KeClearEvent(&FileObject->Event);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->RequestorMode = KernelMode;
irp->UserEvent = &event;
irp->UserIosb = &irp->IoStatus;
irp->Overlay.AsynchronousParameters.UserApcRoutine =
(PIO_APC_ROUTINE)NULL;
irp->Flags = IRP_SYNCHRONOUS_API | IRP_CLOSE_OPERATION;
irpSp = IoGetNextIrpStackLocation(irp);
irpSp->MajorFunction = IRP_MJ_CLEANUP;
irpSp->FileObject = FileObject;
if (IoCallDriver(DeviceObject, irp) == STATUS_PENDING)
KeWaitForSingleObject(&event, UserRequest, KernelMode, FALSE,
NULL);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
KeClearEvent(&FileObject->Event);
KeClearEvent(&event);
irpSp = IoGetNextIrpStackLocation(irp);
irpSp->MajorFunction = IRP_MJ_CLOSE;
irpSp->FileObject = FileObject;
irp->UserIosb = &ioStatus;
irp->UserEvent = &event;
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->AssociatedIrp.SystemBuffer = NULL;
irp->Flags = IRP_CLOSE_OPERATION | IRP_SYNCHRONOUS_API;
vpb = FileObject->Vpb;
// Make sure the VPBs reference count ius adjusted properly;
if (vpb && !(FileObject->Flags & FO_DIRECT_DEVICE_OPEN))
{
IoAcquireVpbSpinLock(&irql);
vpb->ReferenceCount += 0xffffffff;
IoReleaseVpbSpinLock(irql);
}
if (IoCallDriver(DeviceObject, irp) == STATUS_PENDING)
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE,
NULL); }

The only difference in this code and the code we saw in the debugger is
that the w2k version of IoCancelFileOpen() inserts each IRP into the
threads IRP queue. Since we do not have access to IopQueueThreadIrp()
and IopDequeueThreadIrp(), I think those are the names, I wouldhave to
load the checked build to verify, we simply left them out. Not sure if
there are any specific problems with this code that we have yet to find,
but it has been working for quite some time in numerous drivers.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Viscarola
Sent: Thursday, December 13, 2001 3:00 PM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Message"Maxim S. Shatskih" wrote in message
news:xxxxx@ntfsd…
>It is trivial to rev.eng. IoCancelFileOpen from w2k and port it to NT4.

>It just sends CLEANUP and CLOSE IRPs.
>

Gee, I remember writing equivalent code for NT V4, and I seem to
remember there were some tricks to it. And while sending a CLEANUP and
CLOSE is what you need to do, how those are sent so that they work all
the time wasn’t exactly “trivial”. At least not to me.

Then again, at OSR it’s Tony who know about file systems…

Peter
OSR


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


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


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

Later?

Don’t keep me in suspense.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ravisankar
Pudipeddi
Sent: Thursday, December 13, 2001 6:53 PM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Of course, the one BIG problem with the code below is that you are not
checking for failure from IoAllocateIrp(), so the filter will blow up
under low resources conditions… There’s one more issue which I’ll touch
upon later.

Ravi

This posting is provided “AS IS” with no warranties, and confers no
rights. You assume all risk for your use.

-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Thursday, December 13, 2001 2:02 AM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Here is how we did it:

VOID SciCancelFileOpen(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT
FileObject)
{
PIRP irp;
PIO_STACK_LOCATION irpSp;
KEVENT event;
KIRQL irql;
IO_STATUS_BLOCK ioStatus;
PVPB vpb;
ASSERT(!(FileObject->Flags & FO_HANDLE_CREATED));
KeInitializeEvent(&event, NotificationEvent, FALSE);
KeClearEvent(&FileObject->Event);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->RequestorMode = KernelMode;
irp->UserEvent = &event;
irp->UserIosb = &irp->IoStatus;
irp->Overlay.AsynchronousParameters.UserApcRoutine =
(PIO_APC_ROUTINE)NULL;
irp->Flags = IRP_SYNCHRONOUS_API | IRP_CLOSE_OPERATION;
irpSp = IoGetNextIrpStackLocation(irp);
irpSp->MajorFunction = IRP_MJ_CLEANUP;
irpSp->FileObject = FileObject;
if (IoCallDriver(DeviceObject, irp) == STATUS_PENDING)
KeWaitForSingleObject(&event, UserRequest, KernelMode, FALSE,
NULL);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
KeClearEvent(&FileObject->Event);
KeClearEvent(&event);
irpSp = IoGetNextIrpStackLocation(irp);
irpSp->MajorFunction = IRP_MJ_CLOSE;
irpSp->FileObject = FileObject;
irp->UserIosb = &ioStatus;
irp->UserEvent = &event;
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->AssociatedIrp.SystemBuffer = NULL;
irp->Flags = IRP_CLOSE_OPERATION | IRP_SYNCHRONOUS_API;
vpb = FileObject->Vpb;
// Make sure the VPBs reference count ius adjusted properly;
if (vpb && !(FileObject->Flags & FO_DIRECT_DEVICE_OPEN))
{
IoAcquireVpbSpinLock(&irql);
vpb->ReferenceCount += 0xffffffff;
IoReleaseVpbSpinLock(irql);
}
if (IoCallDriver(DeviceObject, irp) == STATUS_PENDING)
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE,
NULL); }

The only difference in this code and the code we saw in the debugger is
that the w2k version of IoCancelFileOpen() inserts each IRP into the
threads IRP queue. Since we do not have access to IopQueueThreadIrp()
and IopDequeueThreadIrp(), I think those are the names, I wouldhave to
load the checked build to verify, we simply left them out. Not sure if
there are any specific problems with this code that we have yet to find,
but it has been working for quite some time in numerous drivers.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Viscarola
Sent: Thursday, December 13, 2001 3:00 PM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Message"Maxim S. Shatskih" wrote in message
news:xxxxx@ntfsd…
>It is trivial to rev.eng. IoCancelFileOpen from w2k and port it to NT4.

>It just sends CLEANUP and CLOSE IRPs.
>

Gee, I remember writing equivalent code for NT V4, and I seem to
remember there were some tricks to it. And while sending a CLEANUP and
CLOSE is what you need to do, how those are sent so that they work all
the time wasn’t exactly “trivial”. At least not to me.

Then again, at OSR it’s Tony who know about file systems…

Peter
OSR


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


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


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


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

Thanks for the IRP allocation failure potential; another pair of eyes is
always good.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ravisankar
Pudipeddi
Sent: Thursday, December 13, 2001 6:53 PM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Of course, the one BIG problem with the code below is that you are not
checking for failure from IoAllocateIrp(), so the filter will blow up
under low resources conditions… There’s one more issue which I’ll touch
upon later.

Ravi

This posting is provided “AS IS” with no warranties, and confers no
rights. You assume all risk for your use.

-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Thursday, December 13, 2001 2:02 AM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Here is how we did it:

VOID SciCancelFileOpen(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT
FileObject)
{
PIRP irp;
PIO_STACK_LOCATION irpSp;
KEVENT event;
KIRQL irql;
IO_STATUS_BLOCK ioStatus;
PVPB vpb;
ASSERT(!(FileObject->Flags & FO_HANDLE_CREATED));
KeInitializeEvent(&event, NotificationEvent, FALSE);
KeClearEvent(&FileObject->Event);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->RequestorMode = KernelMode;
irp->UserEvent = &event;
irp->UserIosb = &irp->IoStatus;
irp->Overlay.AsynchronousParameters.UserApcRoutine =
(PIO_APC_ROUTINE)NULL;
irp->Flags = IRP_SYNCHRONOUS_API | IRP_CLOSE_OPERATION;
irpSp = IoGetNextIrpStackLocation(irp);
irpSp->MajorFunction = IRP_MJ_CLEANUP;
irpSp->FileObject = FileObject;
if (IoCallDriver(DeviceObject, irp) == STATUS_PENDING)
KeWaitForSingleObject(&event, UserRequest, KernelMode, FALSE,
NULL);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
KeClearEvent(&FileObject->Event);
KeClearEvent(&event);
irpSp = IoGetNextIrpStackLocation(irp);
irpSp->MajorFunction = IRP_MJ_CLOSE;
irpSp->FileObject = FileObject;
irp->UserIosb = &ioStatus;
irp->UserEvent = &event;
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->AssociatedIrp.SystemBuffer = NULL;
irp->Flags = IRP_CLOSE_OPERATION | IRP_SYNCHRONOUS_API;
vpb = FileObject->Vpb;
// Make sure the VPBs reference count ius adjusted properly;
if (vpb && !(FileObject->Flags & FO_DIRECT_DEVICE_OPEN))
{
IoAcquireVpbSpinLock(&irql);
vpb->ReferenceCount += 0xffffffff;
IoReleaseVpbSpinLock(irql);
}
if (IoCallDriver(DeviceObject, irp) == STATUS_PENDING)
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE,
NULL); }

The only difference in this code and the code we saw in the debugger is
that the w2k version of IoCancelFileOpen() inserts each IRP into the
threads IRP queue. Since we do not have access to IopQueueThreadIrp()
and IopDequeueThreadIrp(), I think those are the names, I wouldhave to
load the checked build to verify, we simply left them out. Not sure if
there are any specific problems with this code that we have yet to find,
but it has been working for quite some time in numerous drivers.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Viscarola
Sent: Thursday, December 13, 2001 3:00 PM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Message"Maxim S. Shatskih" wrote in message
news:xxxxx@ntfsd…
>It is trivial to rev.eng. IoCancelFileOpen from w2k and port it to NT4.

>It just sends CLEANUP and CLOSE IRPs.
>

Gee, I remember writing equivalent code for NT V4, and I seem to
remember there were some tricks to it. And while sending a CLEANUP and
CLOSE is what you need to do, how those are sent so that they work all
the time wasn’t exactly “trivial”. At least not to me.

Then again, at OSR it’s Tony who know about file systems…

Peter
OSR


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


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


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


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

Jamey,
Here is something I noticed:

first irp sets UserIosb to the IoStatus in the Irp itself while the second
sets it to a local variable. Should they both use the local.

1st IRP does:
irp->UserEvent = &event;
irp->UserIosb = &irp->IoStatus;
2ns IRP does:
irp->UserIosb = &ioStatus;
irp->UserEvent = &event;

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Friday, December 14, 2001 1:47 AM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Later?

Don’t keep me in suspense.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ravisankar
Pudipeddi
Sent: Thursday, December 13, 2001 6:53 PM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Of course, the one BIG problem with the code below is that you are not
checking for failure from IoAllocateIrp(), so the filter will blow up
under low resources conditions… There’s one more issue which I’ll touch
upon later.

Ravi

This posting is provided “AS IS” with no warranties, and confers no
rights. You assume all risk for your use.

-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Thursday, December 13, 2001 2:02 AM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Here is how we did it:

VOID SciCancelFileOpen(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT
FileObject)
{
PIRP irp;
PIO_STACK_LOCATION irpSp;
KEVENT event;
KIRQL irql;
IO_STATUS_BLOCK ioStatus;
PVPB vpb;
ASSERT(!(FileObject->Flags & FO_HANDLE_CREATED));
KeInitializeEvent(&event, NotificationEvent, FALSE);
KeClearEvent(&FileObject->Event);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->RequestorMode = KernelMode;
irp->UserEvent = &event;
irp->UserIosb = &irp->IoStatus;
irp->Overlay.AsynchronousParameters.UserApcRoutine =
(PIO_APC_ROUTINE)NULL;
irp->Flags = IRP_SYNCHRONOUS_API | IRP_CLOSE_OPERATION;
irpSp = IoGetNextIrpStackLocation(irp);
irpSp->MajorFunction = IRP_MJ_CLEANUP;
irpSp->FileObject = FileObject;
if (IoCallDriver(DeviceObject, irp) == STATUS_PENDING)
KeWaitForSingleObject(&event, UserRequest, KernelMode, FALSE,
NULL);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
KeClearEvent(&FileObject->Event);
KeClearEvent(&event);
irpSp = IoGetNextIrpStackLocation(irp);
irpSp->MajorFunction = IRP_MJ_CLOSE;
irpSp->FileObject = FileObject;
irp->UserIosb = &ioStatus;
irp->UserEvent = &event;
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->AssociatedIrp.SystemBuffer = NULL;
irp->Flags = IRP_CLOSE_OPERATION | IRP_SYNCHRONOUS_API;
vpb = FileObject->Vpb;
// Make sure the VPBs reference count ius adjusted properly;
if (vpb && !(FileObject->Flags & FO_DIRECT_DEVICE_OPEN))
{
IoAcquireVpbSpinLock(&irql);
vpb->ReferenceCount += 0xffffffff;
IoReleaseVpbSpinLock(irql);
}
if (IoCallDriver(DeviceObject, irp) == STATUS_PENDING)
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE,
NULL); }

The only difference in this code and the code we saw in the debugger is
that the w2k version of IoCancelFileOpen() inserts each IRP into the
threads IRP queue. Since we do not have access to IopQueueThreadIrp()
and IopDequeueThreadIrp(), I think those are the names, I wouldhave to
load the checked build to verify, we simply left them out. Not sure if
there are any specific problems with this code that we have yet to find,
but it has been working for quite some time in numerous drivers.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Viscarola
Sent: Thursday, December 13, 2001 3:00 PM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Message"Maxim S. Shatskih" wrote in message
news:xxxxx@ntfsd…
>It is trivial to rev.eng. IoCancelFileOpen from w2k and port it to NT4.

>It just sends CLEANUP and CLOSE IRPs.
>

Gee, I remember writing equivalent code for NT V4, and I seem to
remember there were some tricks to it. And while sending a CLEANUP and
CLOSE is what you need to do, how those are sent so that they work all
the time wasn’t exactly “trivial”. At least not to me.

Then again, at OSR it’s Tony who know about file systems…

Peter
OSR


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


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


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


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


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

WOW!!!

Thanks! You guys have cause me to revisit my reason for needing to
cancel a file open!

In my case, I needed the canonical filename of a create operations.
There is a problem with related file objects in that their names may be
lost. I was pre-opening the file by sending the request down and
allowing the open to occur. I would then get the canonical name and call
IoCancelFileOpen().

At this point, I would replace the filename in the file object with the
canonical name, NULL the related file object and return STATUS_REPARSE.
This would cause the request to be reissued; unless I wanted to fail the
request. So far, under much stress, I have seen no problems.

But Dooh!

I do not need to do this. I can change the code to get the canonical
name of the, already opened, related file object and then concatenate
the current file object name. I will still need to have a case for open
by ID, but it will probably be a very rare code path.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ken Galipeau
Sent: Thursday, December 13, 2001 11:12 PM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Jamey,
Here is something I noticed:

first irp sets UserIosb to the IoStatus in the Irp itself while the
second sets it to a local variable. Should they both use the local.

1st IRP does:
irp->UserEvent = &event;
irp->UserIosb = &irp->IoStatus;
2ns IRP does:
irp->UserIosb = &ioStatus;
irp->UserEvent = &event;

Ken

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Jamey Kirby
Sent: Friday, December 14, 2001 1:47 AM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Later?

Don’t keep me in suspense.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ravisankar
Pudipeddi
Sent: Thursday, December 13, 2001 6:53 PM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Of course, the one BIG problem with the code below is that you are not
checking for failure from IoAllocateIrp(), so the filter will blow up
under low resources conditions… There’s one more issue which I’ll touch
upon later.

Ravi

This posting is provided “AS IS” with no warranties, and confers no
rights. You assume all risk for your use.

-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Thursday, December 13, 2001 2:02 AM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Here is how we did it:

VOID SciCancelFileOpen(PDEVICE_OBJECT DeviceObject, PFILE_OBJECT
FileObject)
{
PIRP irp;
PIO_STACK_LOCATION irpSp;
KEVENT event;
KIRQL irql;
IO_STATUS_BLOCK ioStatus;
PVPB vpb;
ASSERT(!(FileObject->Flags & FO_HANDLE_CREATED));
KeInitializeEvent(&event, NotificationEvent, FALSE);
KeClearEvent(&FileObject->Event);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->RequestorMode = KernelMode;
irp->UserEvent = &event;
irp->UserIosb = &irp->IoStatus;
irp->Overlay.AsynchronousParameters.UserApcRoutine =
(PIO_APC_ROUTINE)NULL;
irp->Flags = IRP_SYNCHRONOUS_API | IRP_CLOSE_OPERATION;
irpSp = IoGetNextIrpStackLocation(irp);
irpSp->MajorFunction = IRP_MJ_CLEANUP;
irpSp->FileObject = FileObject;
if (IoCallDriver(DeviceObject, irp) == STATUS_PENDING)
KeWaitForSingleObject(&event, UserRequest, KernelMode, FALSE,
NULL);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
KeClearEvent(&FileObject->Event);
KeClearEvent(&event);
irpSp = IoGetNextIrpStackLocation(irp);
irpSp->MajorFunction = IRP_MJ_CLOSE;
irpSp->FileObject = FileObject;
irp->UserIosb = &ioStatus;
irp->UserEvent = &event;
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->AssociatedIrp.SystemBuffer = NULL;
irp->Flags = IRP_CLOSE_OPERATION | IRP_SYNCHRONOUS_API;
vpb = FileObject->Vpb;
// Make sure the VPBs reference count ius adjusted properly;
if (vpb && !(FileObject->Flags & FO_DIRECT_DEVICE_OPEN))
{
IoAcquireVpbSpinLock(&irql);
vpb->ReferenceCount += 0xffffffff;
IoReleaseVpbSpinLock(irql);
}
if (IoCallDriver(DeviceObject, irp) == STATUS_PENDING)
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE,
NULL); }

The only difference in this code and the code we saw in the debugger is
that the w2k version of IoCancelFileOpen() inserts each IRP into the
threads IRP queue. Since we do not have access to IopQueueThreadIrp()
and IopDequeueThreadIrp(), I think those are the names, I wouldhave to
load the checked build to verify, we simply left them out. Not sure if
there are any specific problems with this code that we have yet to find,
but it has been working for quite some time in numerous drivers.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Viscarola
Sent: Thursday, December 13, 2001 3:00 PM
To: File Systems Developers
Subject: [ntfsd] Re: Create Sample Code

Message"Maxim S. Shatskih" wrote in message
news:xxxxx@ntfsd…
>It is trivial to rev.eng. IoCancelFileOpen from w2k and port it to NT4.

>It just sends CLEANUP and CLOSE IRPs.
>

Gee, I remember writing equivalent code for NT V4, and I seem to
remember there were some tricks to it. And while sending a CLEANUP and
CLOSE is what you need to do, how those are sent so that they work all
the time wasn’t exactly “trivial”. At least not to me.

Then again, at OSR it’s Tony who know about file systems…

Peter
OSR


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


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


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


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


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


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