In my filter it is sometimes necessary to change the FileObject->FileName in
the preOp for IRP_MJ_CREATE. This seems to work OK, and underlying drivers
correctly open the modified named file. At the moment I am saving the
previous data values and restoring in the postOp.
Is this necessary (e.g. to ensure that the correct previous FileName buffer
gets freed by some higher layer), or is the save/restore mechanism simply
cluttering up my code?
More generally, there may be a need to document what are the rules about
“ownership” of the fields of Data when they may have been modified by a
filter.
Brian
Brian,
You do not have to restore the FileName field in the FileObject in your post
operation callback.As long as you have freed it when you replaced it with
your own FileName things would just work fine. The FileName which you put in
the FileObject will eventually get freed when the FileObject is freed.
I’ll pass your documentation request to our doc team and will make sure
details regarding the ownership gets added.
Thanks
Ravinder
This posting is provided “AS IS” with no warranties, and confers no rights.
“Brian Collins” wrote in message
news:xxxxx@ntfsd…
> In my filter it is sometimes necessary to change the FileObject->FileName
in
> the preOp for IRP_MJ_CREATE. This seems to work OK, and underlying drivers
> correctly open the modified named file. At the moment I am saving the
> previous data values and restoring in the postOp.
>
> Is this necessary (e.g. to ensure that the correct previous FileName
buffer
> gets freed by some higher layer), or is the save/restore mechanism simply
> cluttering up my code?
>
> More generally, there may be a need to document what are the rules about
> “ownership” of the fields of Data when they may have been modified by a
> filter.
>
> Brian
>
>
>
You don’t have to restore previous FileName. But if you don’t restore it
then it’s your responsibility to free the buffer (simply call ExFreePool
on it) if you are allocating your own buffer when changing FileName.
-----Original Message-----
From: Brian Collins [mailto:xxxxx@iOra.com]
Sent: Tuesday, April 27, 2004 8:12 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Is it necessary to Save/Restore changes to FileObject?
In my filter it is sometimes necessary to change the
FileObject->FileName in
the preOp for IRP_MJ_CREATE. This seems to work OK, and underlying
drivers
correctly open the modified named file. At the moment I am saving the
previous data values and restoring in the postOp.
Is this necessary (e.g. to ensure that the correct previous FileName
buffer
gets freed by some higher layer), or is the save/restore mechanism
simply
cluttering up my code?
More generally, there may be a need to document what are the rules about
“ownership” of the fields of Data when they may have been modified by a
filter.
Brian
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as:
xxxxx@borland.com
To unsubscribe send a blank email to xxxxx@lists.osr.com