Questions about transfer a context "Before REPARSE" to "After REPARSE".

hello every expert:
here I come with a question about the IRP which is completed with the
STATUS_REPARSE, What I need to do is to transfer a “context” from “Before
REPARSE” to “After REPARSE”.

Here is my current method:
When a IRP_MJ_CREATE request comes, my filter change the
FileObject->filename and finish it with the STATUS_REPARSE. In normal case ,
windows will send again the IRP_MJ_CREATE request with the same FileObject
as before, so what I need to do is just saving the FileObject and try to
find it when I get the IRP_MJ_CREATE again, then I can link the two
IRP_MJ_CREATE(Before REPARSE and After REPARSE) request and I can manager
the “context” by this.

this method works in most case. but when an Application try to rename a file
between two names(nameA to nameB then nameB to nameA …), the above method
is failed, what I observed is the IRP_MJ_CREATE after REPARSE comes with a
“different FileObject”, this make my context transfer method fails.

can anyone tell me what’s wrong with my method(it is based on my “brittle”
assumption that the FileObjects are same in the IRP before REPARSE and after
REPARSE ), or you can provide me a more resonable method to transfer a
“context” from “Before REPARSE” to “After REPARSE”.

thanks for your help in advance!
B.R
YANG Xiao

> can anyone tell me what’s wrong with my method(it is based on my “brittle”

assumption that the FileObjects are same in the IRP before REPARSE and after
REPARSE ), or you can provide me a more resonable method to transfer a
“context” from “Before REPARSE” to “After REPARSE”.

Do not use reparse in this case. Instead, use
IoCreateFileSpecifyDeviceObjectHint to create the 2nd file object with the new
(“reparsed”) name. The first file object will transfer most of the calls down
to this second file object.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

hello Maxim
thanks for your replay, but I am not very clear about your proposal, here
are my questions.
1.What should I do for the Original IRP from System? just complete it with
the status SUCCESS?
2.you said “The first file object will transfer most of the calls down to
this second file object”, how does this happens? is it done automaticly by
system or I must do this by myself?

any comments are welcomed.
B.R
YANG Xiao

2007/12/24, Maxim S. Shatskih :
>
> > can anyone tell me what’s wrong with my method(it is based on my
> “brittle”
> > assumption that the FileObjects are same in the IRP before REPARSE and
> after
> > REPARSE ), or you can provide me a more resonable method to transfer a
> > “context” from “Before REPARSE” to “After REPARSE”.
>
> Do not use reparse in this case. Instead, use
> IoCreateFileSpecifyDeviceObjectHint to create the 2nd file object with the
> new
> (“reparsed”) name. The first file object will transfer most of the calls
> down
> to this second file object.
>
> –
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTFSD is sponsored by OSR
>
> For our schedule debugging and file system seminars
> (including our new fs mini-filter seminar) visit:
> http://www.osr.com/seminars
>
> You are currently subscribed to ntfsd as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

> 2.you said "The first file object will transfer most of the calls down to

this second file object", how does this happens? is it done automaticly by
system or I must do this by myself?

You must do it yourself.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

I suppose another way would be to allocate a structure from the pool, in
the first create populate it with
whatever information you like, then add a unique ‘tag’ to the filename
right before calling for a Reparse.

At this point, when the new IRP_Create enters your dispatch/precreate
routine, you check for the unique ‘tag’
in the filename and remove it if it exist, then create a new context and
populate it with the data from your
saved structure, and send it on its way.

I’ve never tried this personally and am just ‘shooting from the hip’,
but I would start off conducting some
experiments somewhere along these lines.

Good Luck,

Matt

Xiao YANG wrote:

hello every expert:
here I come with a question about the IRP which is completed with the
STATUS_REPARSE, What I need to do is to transfer a “context” from
“Before REPARSE” to “After REPARSE”.

Here is my current method:
When a IRP_MJ_CREATE request comes, my filter change the
FileObject->filename and finish it with the STATUS_REPARSE. In normal
case , windows will send again the IRP_MJ_CREATE request with the same
FileObject as before, so what I need to do is just saving the
FileObject and try to find it when I get the IRP_MJ_CREATE again, then
I can link the two IRP_MJ_CREATE(Before REPARSE and After REPARSE)
request and I can manager the “context” by this.

this method works in most case. but when an Application try to rename
a file between two names(nameA to nameB then nameB to nameA …), the
above method is failed, what I observed is the IRP_MJ_CREATE after
REPARSE comes with a “different FileObject”, this make my context
transfer method fails.

can anyone tell me what’s wrong with my method(it is based on my
“brittle” assumption that the FileObjects are same in the IRP before
REPARSE and after REPARSE ), or you can provide me a more resonable
method to transfer a “context” from “Before REPARSE” to “After REPARSE”.

thanks for your help in advance!
B.R
YANG Xiao
— NTFSD is sponsored by OSR For our schedule debugging and file
system seminars (including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars You are currently subscribed to ntfsd as:
matt-martin@tx.rr.com To unsubscribe send a blank email to
xxxxx@lists.osr.com

>“MM” wrote in message news:xxxxx@ntfsd…
> I suppose another way would be to allocate a structure from the pool, in
> the first create populate it with
> whatever information you like, then add a unique ‘tag’ to the filename
> right before calling for a Reparse.

This is how I solved the issue in year 2000, but the OSR guys were very much
objecting this idea.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Would you please care to share what the objections were? I don’t see
anything wrong with it,
then again I still have a lot to learn…

Regards,
Matt

Maxim S. Shatskih wrote:

>“MM” wrote in message news:xxxxx@ntfsd…
>>I suppose another way would be to allocate a structure from the pool, in
>>the first create populate it with
>>whatever information you like, then add a unique ‘tag’ to the filename
>>right before calling for a Reparse.
>>
>>
>
>This is how I solved the issue in year 2000, but the OSR guys were very much
>objecting this idea.
>
>
>

The possibility of naming collision in these suffixes, or the possible
issues if there will be 2 such filters each with its own suffix scheme.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

“MM” wrote in message news:xxxxx@ntfsd…
> Would you please care to share what the objections were? I don’t see
> anything wrong with it,
> then again I still have a lot to learn…
>
> Regards,
> Matt
>
> Maxim S. Shatskih wrote:
>
> >>“MM” wrote in message news:xxxxx@ntfsd…
> >>I suppose another way would be to allocate a structure from the pool, in
> >>the first create populate it with
> >>whatever information you like, then add a unique ‘tag’ to the filename
> >>right before calling for a Reparse.
> >>
> >>
> >
> >This is how I solved the issue in year 2000, but the OSR guys were very much
> >objecting this idea.
> >
> >
> >
>

I am suprised you just provide a method that I am going to have a try!
that’s a lot of helps :slight_smile:
thanks for you guys!

B.R
YANG Xiao

2007/12/24, MM :
>
> I suppose another way would be to allocate a structure from the pool, in
> the first create populate it with
> whatever information you like, then add a unique ‘tag’ to the filename
> right before calling for a Reparse.
>
> At this point, when the new IRP_Create enters your dispatch/precreate
> routine, you check for the unique ‘tag’
> in the filename and remove it if it exist, then create a new context and
> populate it with the data from your
> saved structure, and send it on its way.
>
> I’ve never tried this personally and am just ‘shooting from the hip’,
> but I would start off conducting some
> experiments somewhere along these lines.
>
> Good Luck,
>
> Matt
>
> Xiao YANG wrote:
>
> > hello every expert:
> > here I come with a question about the IRP which is completed with the
> > STATUS_REPARSE, What I need to do is to transfer a “context” from
> > “Before REPARSE” to “After REPARSE”.
> >
> > Here is my current method:
> > When a IRP_MJ_CREATE request comes, my filter change the
> > FileObject->filename and finish it with the STATUS_REPARSE. In normal
> > case , windows will send again the IRP_MJ_CREATE request with the same
> > FileObject as before, so what I need to do is just saving the
> > FileObject and try to find it when I get the IRP_MJ_CREATE again, then
> > I can link the two IRP_MJ_CREATE(Before REPARSE and After REPARSE)
> > request and I can manager the “context” by this.
> >
> >
> > this method works in most case. but when an Application try to rename
> > a file between two names(nameA to nameB then nameB to nameA …), the
> > above method is failed, what I observed is the IRP_MJ_CREATE after
> > REPARSE comes with a “different FileObject”, this make my context
> > transfer method fails.
> >
> > can anyone tell me what’s wrong with my method(it is based on my
> > “brittle” assumption that the FileObjects are same in the IRP before
> > REPARSE and after REPARSE ), or you can provide me a more resonable
> > method to transfer a “context” from “Before REPARSE” to “After REPARSE”.
> >
> > thanks for your help in advance!
> > B.R
> > YANG Xiao
> > — NTFSD is sponsored by OSR For our schedule debugging and file
> > system seminars (including our new fs mini-filter seminar) visit:
> > http://www.osr.com/seminars You are currently subscribed to ntfsd as:
> > matt-martin@tx.rr.com To unsubscribe send a blank email to
> > xxxxx@lists.osr.com
>
>
> —
> NTFSD is sponsored by OSR
>
> For our schedule debugging and file system seminars
> (including our new fs mini-filter seminar) visit:
> http://www.osr.com/seminars
>
> You are currently subscribed to ntfsd as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>